From: support Date: Tue, 5 Jul 2022 11:51:58 +0000 (+0000) Subject: Built motion from commit 8b4dd4e9.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=fe34ad61d4b5ab5c7a095da95027f3813bdc90e6;p=motion2.git Built motion from commit 8b4dd4e9.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 254e9d3..bd8e76e 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-05T08:23:27.507Z", + "time": "2022-07-05T11:44:08.197Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c5859e2..130d032 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-05T08:23:27.507Z", + "time": "2022-07-05T11:44:08.197Z", "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 92986e9..baeccd1 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 _0x5ede=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','sequelize','getDataValue','STRING','contactManager','integration','motionbar','jscripty','script'];(function(_0x273e48,_0x4b4339){var _0x3b8e3f=function(_0x4ec17e){while(--_0x4ec17e){_0x273e48['push'](_0x273e48['shift']());}};_0x3b8e3f(++_0x4b4339);}(_0x5ede,0x13a));var _0xe5ed=function(_0x4386bb,_0x31bdd4){_0x4386bb=_0x4386bb-0x0;var _0xe5e733=_0x5ede[_0x4386bb];return _0xe5e733;};'use strict';var Sequelize=require(_0xe5ed('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2df64a){return this[_0xe5ed('0x1')]('action');}},'action':{'type':Sequelize[_0xe5ed('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe5ed('0x3'),_0xe5ed('0x4'),_0xe5ed('0x5'),_0xe5ed('0x6'),'urlForward','browser','bot',_0xe5ed('0x7')]],'msg':_0xe5ed('0x8')}},'comment':_0xe5ed('0x8')},'data1':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0x9')},'data2':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0xa')},'data3':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comment':_0xe5ed('0xb')},'data4':{'type':Sequelize[_0xe5ed('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xe5ed('0xc')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xe5ed('0xd')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x5e83=['integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x57a352,_0xbd7532){var _0x5cd613=function(_0x2e51c4){while(--_0x2e51c4){_0x57a352['push'](_0x57a352['shift']());}};_0x5cd613(++_0xbd7532);}(_0x5e83,0x111));var _0x35e8=function(_0xd3db70,_0x95661c){_0xd3db70=_0xd3db70-0x0;var _0x56707a=_0x5e83[_0xd3db70];return _0x56707a;};'use strict';var Sequelize=require(_0x35e8('0x0'));module[_0x35e8('0x1')]={'name':{'type':Sequelize[_0x35e8('0x2')],'get':function(_0x3db920){return this[_0x35e8('0x3')](_0x35e8('0x4'));}},'action':{'type':Sequelize[_0x35e8('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x35e8('0x6'),_0x35e8('0x7'),_0x35e8('0x8'),_0x35e8('0x9'),'urlForward',_0x35e8('0xa'),_0x35e8('0xb'),_0x35e8('0xc')]],'msg':_0x35e8('0xd')}},'comment':_0x35e8('0xd')},'data1':{'type':Sequelize[_0x35e8('0x5')](0x1000),'comment':_0x35e8('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x35e8('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x35e8('0x5')](0x1000),'comments':_0x35e8('0x10')},'data6':{'type':Sequelize[_0x35e8('0x5')],'comments':_0x35e8('0x11')},'data7':{'type':Sequelize[_0x35e8('0x12')],'comments':_0x35e8('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9e86ea1..95c82ac 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 _0xee95=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','update','body','Action','find','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xee95,0x150));var _0x5ee9=function(_0x2d1341,_0x36dce5){_0x2d1341=_0x2d1341-0x0;var _0x112b70=_0xee95[_0x2d1341];return _0x112b70;};'use strict';var emlformat=require(_0x5ee9('0x0'));var rimraf=require(_0x5ee9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ee9('0x2'));var rp=require(_0x5ee9('0x3'));var moment=require(_0x5ee9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ee9('0x5'));var util=require(_0x5ee9('0x6'));var path=require('path');var sox=require(_0x5ee9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ee9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ee9('0x9'));var _=require(_0x5ee9('0xa'));var squel=require('squel');var crypto=require(_0x5ee9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5ee9('0xc'));var toCsv=require(_0x5ee9('0xd'));var querystring=require('querystring');var Papa=require(_0x5ee9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ee9('0xf'));var as=require(_0x5ee9('0x10'));var hardwareService=require(_0x5ee9('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ee9('0x12'));var config=require(_0x5ee9('0x13'));var licenseUtil=require(_0x5ee9('0x14'));var db=require(_0x5ee9('0x15'))['db'];function respondWithStatusCode(_0x58c6ff,_0x37abd2){_0x37abd2=_0x37abd2||0xcc;return function(_0x16e720){if(_0x16e720){return _0x58c6ff[_0x5ee9('0x16')](_0x37abd2);}return _0x58c6ff['status'](_0x37abd2)[_0x5ee9('0x17')]();};}function respondWithResult(_0x1c9362,_0xea5588){_0xea5588=_0xea5588||0xc8;return function(_0xc15afb){if(_0xc15afb){return _0x1c9362[_0x5ee9('0x18')](_0xea5588)[_0x5ee9('0x19')](_0xc15afb);}};}function respondWithFilteredResult(_0xb073fa,_0x58f01d){return function(_0x53622a){if(_0x53622a){var _0x5d6a0d=typeof _0x58f01d[_0x5ee9('0x1a')]===_0x5ee9('0x1b')&&typeof _0x58f01d[_0x5ee9('0x1c')]===_0x5ee9('0x1b');var _0x1ce21b=_0x53622a[_0x5ee9('0x1d')];var _0xa93d5f=_0x5d6a0d?0x0:_0x58f01d[_0x5ee9('0x1a')];var _0x4e8b4a=_0x5d6a0d?_0x53622a['count']:_0x58f01d[_0x5ee9('0x1a')]+_0x58f01d[_0x5ee9('0x1c')];var _0x117caa;if(_0x4e8b4a>=_0x1ce21b){_0x4e8b4a=_0x1ce21b;_0x117caa=0xc8;}else{_0x117caa=0xce;}_0xb073fa[_0x5ee9('0x18')](_0x117caa);return _0xb073fa['set'](_0x5ee9('0x1e'),_0xa93d5f+'-'+_0x4e8b4a+'/'+_0x1ce21b)['json'](_0x53622a);}return null;};}function patchUpdates(_0xc5d143){return function(_0x1e7ec1){try{jsonpatch[_0x5ee9('0x1f')](_0x1e7ec1,_0xc5d143,!![]);}catch(_0x5d13b4){return BPromise[_0x5ee9('0x20')](_0x5d13b4);}return _0x1e7ec1[_0x5ee9('0x21')]();};}function saveUpdates(_0x3eff2a,_0x1cea79){return function(_0x1ba592){if(_0x1ba592){return _0x1ba592['update'](_0x3eff2a)[_0x5ee9('0x22')](function(_0xc43a7b){return _0xc43a7b;});}return null;};}function removeEntity(_0x2545ff,_0x3a8bb9){return function(_0x5c6a4b){if(_0x5c6a4b){return _0x5c6a4b[_0x5ee9('0x23')]()[_0x5ee9('0x22')](function(){_0x2545ff['status'](0xcc)[_0x5ee9('0x17')]();});}};}function handleEntityNotFound(_0x57fc0c,_0x13e6ab){return function(_0x29ca92){if(!_0x29ca92){_0x57fc0c[_0x5ee9('0x16')](0x194);}return _0x29ca92;};}function handleError(_0x16ab6b,_0x1e2dc5){_0x1e2dc5=_0x1e2dc5||0x1f4;return function(_0x515640){logger[_0x5ee9('0x24')](_0x515640['stack']);if(_0x515640[_0x5ee9('0x25')]){delete _0x515640[_0x5ee9('0x25')];}_0x16ab6b[_0x5ee9('0x18')](_0x1e2dc5)[_0x5ee9('0x26')](_0x515640);};}exports[_0x5ee9('0x27')]=function(_0x3626a5,_0x56c29d){if(_0x3626a5[_0x5ee9('0x28')]['id']){delete _0x3626a5[_0x5ee9('0x28')]['id'];}return db[_0x5ee9('0x29')][_0x5ee9('0x2a')]({'where':{'id':_0x3626a5['params']['id']}})[_0x5ee9('0x22')](handleEntityNotFound(_0x56c29d,null))[_0x5ee9('0x22')](saveUpdates(_0x3626a5[_0x5ee9('0x28')],null))[_0x5ee9('0x22')](respondWithResult(_0x56c29d,null))[_0x5ee9('0x2b')](handleError(_0x56c29d,null));};exports[_0x5ee9('0x23')]=function(_0x124702,_0x1bab97){return db[_0x5ee9('0x29')][_0x5ee9('0x2a')]({'where':{'id':_0x124702[_0x5ee9('0x2c')]['id']}})[_0x5ee9('0x22')](handleEntityNotFound(_0x1bab97,null))['then'](removeEntity(_0x1bab97,null))['catch'](handleError(_0x1bab97,null));}; \ No newline at end of file +var _0xdeea=['body','Action','find','params','catch','rimraf','zip-dir','request-promise','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','stack','name','send','update'];(function(_0x54096a,_0x5cb699){var _0x4b5bd0=function(_0x361d0c){while(--_0x361d0c){_0x54096a['push'](_0x54096a['shift']());}};_0x4b5bd0(++_0x5cb699);}(_0xdeea,0xef));var _0xadee=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xdeea[_0x13b02f];return _0x12e9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadee('0x0'));var zipdir=require(_0xadee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xadee('0x3'));var sox=require('sox');var csv=require(_0xadee('0x4'));var ejs=require(_0xadee('0x5'));var fs=require('fs');var fs_extra=require(_0xadee('0x6'));var _=require(_0xadee('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xadee('0x8'));var deskjs=require(_0xadee('0x9'));var toCsv=require(_0xadee('0x4'));var querystring=require('querystring');var Papa=require(_0xadee('0xa'));var Redis=require(_0xadee('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xadee('0xc'));var hardwareService=require(_0xadee('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xadee('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0xadee('0xf'));var db=require(_0xadee('0x10'))['db'];function respondWithStatusCode(_0x407dc1,_0x1522b7){_0x1522b7=_0x1522b7||0xcc;return function(_0x1b633b){if(_0x1b633b){return _0x407dc1[_0xadee('0x11')](_0x1522b7);}return _0x407dc1[_0xadee('0x12')](_0x1522b7)[_0xadee('0x13')]();};}function respondWithResult(_0x4b2dfd,_0xb74fe2){_0xb74fe2=_0xb74fe2||0xc8;return function(_0x40e043){if(_0x40e043){return _0x4b2dfd[_0xadee('0x12')](_0xb74fe2)[_0xadee('0x14')](_0x40e043);}};}function respondWithFilteredResult(_0x2b0c3f,_0x4c9e9f){return function(_0x39bac3){if(_0x39bac3){var _0x4082e8=typeof _0x4c9e9f[_0xadee('0x15')]==='undefined'&&typeof _0x4c9e9f['limit']===_0xadee('0x16');var _0x439c13=_0x39bac3[_0xadee('0x17')];var _0xe6ceeb=_0x4082e8?0x0:_0x4c9e9f[_0xadee('0x15')];var _0x19081b=_0x4082e8?_0x39bac3[_0xadee('0x17')]:_0x4c9e9f['offset']+_0x4c9e9f[_0xadee('0x18')];var _0x4506bf;if(_0x19081b>=_0x439c13){_0x19081b=_0x439c13;_0x4506bf=0xc8;}else{_0x4506bf=0xce;}_0x2b0c3f[_0xadee('0x12')](_0x4506bf);return _0x2b0c3f[_0xadee('0x19')](_0xadee('0x1a'),_0xe6ceeb+'-'+_0x19081b+'/'+_0x439c13)[_0xadee('0x14')](_0x39bac3);}return null;};}function patchUpdates(_0x581bad){return function(_0x59c0e8){try{jsonpatch['apply'](_0x59c0e8,_0x581bad,!![]);}catch(_0x4d07fa){return BPromise['reject'](_0x4d07fa);}return _0x59c0e8[_0xadee('0x1b')]();};}function saveUpdates(_0x1b9136,_0x3f3b73){return function(_0x586ad1){if(_0x586ad1){return _0x586ad1['update'](_0x1b9136)['then'](function(_0x16f2a1){return _0x16f2a1;});}return null;};}function removeEntity(_0x1678ea,_0x3f4504){return function(_0x27fa76){if(_0x27fa76){return _0x27fa76[_0xadee('0x1c')]()[_0xadee('0x1d')](function(){_0x1678ea['status'](0xcc)[_0xadee('0x13')]();});}};}function handleEntityNotFound(_0x392a01,_0x12f583){return function(_0x26aec3){if(!_0x26aec3){_0x392a01[_0xadee('0x11')](0x194);}return _0x26aec3;};}function handleError(_0x25499d,_0x18e897){_0x18e897=_0x18e897||0x1f4;return function(_0xfd6d20){logger['error'](_0xfd6d20[_0xadee('0x1e')]);if(_0xfd6d20['name']){delete _0xfd6d20[_0xadee('0x1f')];}_0x25499d[_0xadee('0x12')](_0x18e897)[_0xadee('0x20')](_0xfd6d20);};}exports[_0xadee('0x21')]=function(_0x34dbd7,_0x51e0d1){if(_0x34dbd7[_0xadee('0x22')]['id']){delete _0x34dbd7[_0xadee('0x22')]['id'];}return db[_0xadee('0x23')][_0xadee('0x24')]({'where':{'id':_0x34dbd7[_0xadee('0x25')]['id']}})[_0xadee('0x1d')](handleEntityNotFound(_0x51e0d1,null))[_0xadee('0x1d')](saveUpdates(_0x34dbd7[_0xadee('0x22')],null))[_0xadee('0x1d')](respondWithResult(_0x51e0d1,null))['catch'](handleError(_0x51e0d1,null));};exports[_0xadee('0x1c')]=function(_0xeac7d,_0x5a49a6){return db[_0xadee('0x23')][_0xadee('0x24')]({'where':{'id':_0xeac7d['params']['id']}})['then'](handleEntityNotFound(_0x5a49a6,null))['then'](removeEntity(_0x5a49a6,null))[_0xadee('0x26')](handleError(_0x5a49a6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c6ce16e..a8b47a8 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 _0x537a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','util'];(function(_0x153d48,_0x13d8bd){var _0x1954cc=function(_0x3152bd){while(--_0x3152bd){_0x153d48['push'](_0x153d48['shift']());}};_0x1954cc(++_0x13d8bd);}(_0x537a,0x1ac));var _0xa537=function(_0x58e35f,_0x105022){_0x58e35f=_0x58e35f-0x0;var _0x475308=_0x537a[_0x58e35f];return _0x475308;};'use strict';var _=require('lodash');var util=require(_0xa537('0x0'));var logger=require(_0xa537('0x1'))(_0xa537('0x2'));var moment=require(_0xa537('0x3'));var BPromise=require(_0xa537('0x4'));var rp=require(_0xa537('0x5'));var fs=require('fs');var path=require(_0xa537('0x6'));var rimraf=require(_0xa537('0x7'));var config=require(_0xa537('0x8'));var attributes=require(_0xa537('0x9'));module[_0xa537('0xa')]=function(_0x5e7487,_0x1f8c26){return _0x5e7487['define'](_0xa537('0xb'),attributes,{'tableName':_0xa537('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4708=['Action','tools_actions','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x421ead,_0x379f09){var _0x19de8f=function(_0x22ebf4){while(--_0x22ebf4){_0x421ead['push'](_0x421ead['shift']());}};_0x19de8f(++_0x379f09);}(_0x4708,0xa7));var _0x8470=function(_0x46b4e2,_0x22fb1d){_0x46b4e2=_0x46b4e2-0x0;var _0x5b48fc=_0x4708[_0x46b4e2];return _0x5b48fc;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8470('0x2'));var rp=require(_0x8470('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8470('0x4'));var config=require(_0x8470('0x5'));var attributes=require(_0x8470('0x6'));module[_0x8470('0x7')]=function(_0x310710,_0x45206e){return _0x310710[_0x8470('0x8')](_0x8470('0x9'),attributes,{'tableName':_0x8470('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5a99baf..6e0d954 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x53ec,0x192));var _0xc53e=function(_0x3f0b2a,_0x52f963){_0x3f0b2a=_0x3f0b2a-0x0;var _0x23bd63=_0x53ec[_0x3f0b2a];return _0x23bd63;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x814b,0x1a2));var _0xb814=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x814b[_0x4ca796];return _0x171f87;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a5a2a79..40defa3 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 _0x77ba=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','update'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x77ba,0x154));var _0xa77b=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x77ba[_0x207a02];return _0xd995c3;};'use strict';var multer=require(_0xa77b('0x0'));var util=require(_0xa77b('0x1'));var path=require(_0xa77b('0x2'));var timeout=require(_0xa77b('0x3'));var express=require('express');var router=express[_0xa77b('0x4')]();var fs_extra=require(_0xa77b('0x5'));var auth=require(_0xa77b('0x6'));var interaction=require(_0xa77b('0x7'));var config=require(_0xa77b('0x8'));var controller=require('./action.controller');router[_0xa77b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa77b('0xa')]);router[_0xa77b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa77b('0xc')]);module['exports']=router; \ No newline at end of file +var _0xc884=['/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x19b4fe,_0x829daa){var _0x6bbb1f=function(_0x420788){while(--_0x420788){_0x19b4fe['push'](_0x19b4fe['shift']());}};_0x6bbb1f(++_0x829daa);}(_0xc884,0x171));var _0x4c88=function(_0x363270,_0x1214ca){_0x363270=_0x363270-0x0;var _0x428f76=_0xc884[_0x363270];return _0x428f76;};'use strict';var multer=require('multer');var util=require(_0x4c88('0x0'));var path=require(_0x4c88('0x1'));var timeout=require(_0x4c88('0x2'));var express=require('express');var router=express[_0x4c88('0x3')]();var fs_extra=require(_0x4c88('0x4'));var auth=require(_0x4c88('0x5'));var interaction=require(_0x4c88('0x6'));var config=require(_0x4c88('0x7'));var controller=require('./action.controller');router[_0x4c88('0x8')](_0x4c88('0x9'),auth[_0x4c88('0xa')](),controller['update']);router[_0x4c88('0xb')](_0x4c88('0x9'),auth[_0x4c88('0xa')](),controller[_0x4c88('0xc')]);module[_0x4c88('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1a8243e..4ff6757 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x2675,0x75));var _0x5267=function(_0x303f87,_0x1e0f6b){_0x303f87=_0x303f87-0x0;var _0x3c3226=_0x2675[_0x303f87];return _0x3c3226;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x4c99c2,_0x25e58d){var _0x59bf59=function(_0x1d662f){while(--_0x1d662f){_0x4c99c2['push'](_0x4c99c2['shift']());}};_0x59bf59(++_0x25e58d);}(_0xeff8,0x186));var _0x8eff=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xeff8[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index afe0c40..80f910a 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 _0xb2ed=['CustomReports','UserProfileResource','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','filters','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','params','include','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','right_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','keyBy','select','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','runReport','Limited\x20Query:','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','get'];(function(_0x46f647,_0x33ee02){var _0x4e1af9=function(_0x25f7d7){while(--_0x25f7d7){_0x46f647['push'](_0x46f647['shift']());}};_0x4e1af9(++_0x33ee02);}(_0xb2ed,0x120));var _0xdb2e=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xb2ed[_0xe0b81f];return _0x290e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2e('0x1'));var rp=require(_0xdb2e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdb2e('0x3'));var util=require(_0xdb2e('0x4'));var path=require(_0xdb2e('0x5'));var sox=require(_0xdb2e('0x6'));var csv=require(_0xdb2e('0x7'));var ejs=require(_0xdb2e('0x8'));var fs=require('fs');var fs_extra=require(_0xdb2e('0x9'));var _=require(_0xdb2e('0xa'));var squel=require(_0xdb2e('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb2e('0xc'));var deskjs=require(_0xdb2e('0xd'));var toCsv=require(_0xdb2e('0x7'));var querystring=require(_0xdb2e('0xe'));var Papa=require(_0xdb2e('0xf'));var Redis=require(_0xdb2e('0x10'));var authService=require(_0xdb2e('0x11'));var qs=require(_0xdb2e('0x12'));var as=require(_0xdb2e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb2e('0x14'))(_0xdb2e('0x15'));var utils=require(_0xdb2e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb2e('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0xdb2e('0x18'))[_0xdb2e('0x19')];function respondWithStatusCode(_0x247337,_0x74bdc4){_0x74bdc4=_0x74bdc4||0xcc;return function(_0x3ef2a0){if(_0x3ef2a0){return _0x247337[_0xdb2e('0x1a')](_0x74bdc4);}return _0x247337[_0xdb2e('0x1b')](_0x74bdc4)[_0xdb2e('0x1c')]();};}function respondWithResult(_0x2131c5,_0x9ffbbc){_0x9ffbbc=_0x9ffbbc||0xc8;return function(_0x487e85){if(_0x487e85){return _0x2131c5[_0xdb2e('0x1b')](_0x9ffbbc)[_0xdb2e('0x1d')](_0x487e85);}};}function respondWithFilteredResult(_0x4fa14b,_0x16e416){return function(_0x5a4f4d){if(_0x5a4f4d){var _0x25de74=typeof _0x16e416[_0xdb2e('0x1e')]==='undefined'&&typeof _0x16e416['limit']===_0xdb2e('0x1f');var _0x1eaa89=_0x5a4f4d[_0xdb2e('0x20')];var _0x4e1e9e=_0x25de74?0x0:_0x16e416[_0xdb2e('0x1e')];var _0x37cfe8=_0x25de74?_0x5a4f4d['count']:_0x16e416['offset']+_0x16e416['limit'];var _0x96841a;if(_0x37cfe8>=_0x1eaa89){_0x37cfe8=_0x1eaa89;_0x96841a=0xc8;}else{_0x96841a=0xce;}_0x4fa14b[_0xdb2e('0x1b')](_0x96841a);return _0x4fa14b[_0xdb2e('0x21')](_0xdb2e('0x22'),_0x4e1e9e+'-'+_0x37cfe8+'/'+_0x1eaa89)[_0xdb2e('0x1d')](_0x5a4f4d);}return null;};}function patchUpdates(_0x2b3c08){return function(_0x22256c){try{jsonpatch[_0xdb2e('0x23')](_0x22256c,_0x2b3c08,!![]);}catch(_0x37b042){return BPromise[_0xdb2e('0x24')](_0x37b042);}return _0x22256c['save']();};}function saveUpdates(_0x523262,_0x49d314){return function(_0x4a7ab6){if(_0x4a7ab6){return _0x4a7ab6['update'](_0x523262)[_0xdb2e('0x25')](function(_0x67c853){return _0x67c853;});}return null;};}function removeEntity(_0x22f932,_0x4e99bd){return function(_0x3e8c5f){if(_0x3e8c5f){return _0x3e8c5f[_0xdb2e('0x26')]()[_0xdb2e('0x25')](function(){var _0x5ba45c=_0x3e8c5f[_0xdb2e('0x27')]({'plain':!![]});var _0x40cf5a=_0xdb2e('0x28');return db[_0xdb2e('0x29')][_0xdb2e('0x26')]({'where':{'type':_0x40cf5a,'resourceId':_0x5ba45c['id']}})[_0xdb2e('0x25')](function(){return _0x3e8c5f;});})[_0xdb2e('0x25')](function(){_0x22f932[_0xdb2e('0x1b')](0xcc)[_0xdb2e('0x1c')]();});}};}function handleEntityNotFound(_0x4a5ee1,_0x4274f5){return function(_0x3b393b){if(!_0x3b393b){_0x4a5ee1[_0xdb2e('0x1a')](0x194);}return _0x3b393b;};}function handleError(_0x354c16,_0xaf4631){_0xaf4631=_0xaf4631||0x1f4;return function(_0xa5a88e){logger['error'](_0xa5a88e[_0xdb2e('0x2a')]);if(_0xa5a88e[_0xdb2e('0x2b')]){delete _0xa5a88e[_0xdb2e('0x2b')];}_0x354c16[_0xdb2e('0x1b')](_0xaf4631)['send'](_0xa5a88e);};}exports[_0xdb2e('0x2c')]=function(_0x4c05bd,_0x25ae45){var _0x55c8ac={},_0x9f5b4={},_0x1384a4={'count':0x0,'rows':[]};var _0x5454b0=_[_0xdb2e('0x2d')](db[_0xdb2e('0x2e')][_0xdb2e('0x2f')],function(_0x389f35){return{'name':_0x389f35[_0xdb2e('0x30')],'type':_0x389f35['type'][_0xdb2e('0x31')]};});_0x9f5b4['model']=_[_0xdb2e('0x2d')](_0x5454b0,_0xdb2e('0x2b'));_0x9f5b4['query']=_['keys'](_0x4c05bd['query']);_0x9f5b4[_0xdb2e('0x32')]=_['intersection'](_0x9f5b4[_0xdb2e('0x33')],_0x9f5b4['query']);_0x55c8ac['attributes']=_[_0xdb2e('0x34')](_0x9f5b4[_0xdb2e('0x33')],qs['fields'](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x36')]));_0x55c8ac[_0xdb2e('0x37')]=_0x55c8ac['attributes'][_0xdb2e('0x38')]?_0x55c8ac['attributes']:_0x9f5b4[_0xdb2e('0x33')];if(!_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x39')](_0xdb2e('0x3a'))){_0x55c8ac['limit']=qs[_0xdb2e('0x3b')](_0x4c05bd['query'][_0xdb2e('0x3b')]);_0x55c8ac[_0xdb2e('0x1e')]=qs[_0xdb2e('0x1e')](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x1e')]);}_0x55c8ac['order']=qs[_0xdb2e('0x3c')](_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3c')]);_0x55c8ac[_0xdb2e('0x3d')]=qs[_0xdb2e('0x32')](_[_0xdb2e('0x3e')](_0x4c05bd[_0xdb2e('0x35')],_0x9f5b4[_0xdb2e('0x32')]),_0x5454b0);if(_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3f')]){_0x55c8ac[_0xdb2e('0x3d')]=_[_0xdb2e('0x40')](_0x55c8ac['where'],{'$or':_[_0xdb2e('0x2d')](_0x5454b0,function(_0x954a4e){if(_0x954a4e[_0xdb2e('0x41')]!==_0xdb2e('0x42')){var _0x13d0f7={};_0x13d0f7[_0x954a4e[_0xdb2e('0x2b')]]={'$like':'%'+_0x4c05bd[_0xdb2e('0x35')][_0xdb2e('0x3f')]+'%'};return _0x13d0f7;}})});}_0x55c8ac=_[_0xdb2e('0x40')]({},_0x55c8ac,_0x4c05bd[_0xdb2e('0x43')]);var _0x2d13ab={'where':_0x55c8ac[_0xdb2e('0x3d')]};return db['AnalyticCustomReport'][_0xdb2e('0x20')](_0x2d13ab)[_0xdb2e('0x25')](function(_0x3437a0){_0x1384a4[_0xdb2e('0x20')]=_0x3437a0;if(_0x4c05bd['query'][_0xdb2e('0x44')]){_0x55c8ac['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x55c8ac);})[_0xdb2e('0x25')](function(_0x13f2fe){_0x1384a4[_0xdb2e('0x45')]=_0x13f2fe;return _0x1384a4;})[_0xdb2e('0x25')](respondWithFilteredResult(_0x25ae45,_0x55c8ac))['catch'](handleError(_0x25ae45,null));};exports['show']=function(_0x111f08,_0x3fc088){var _0x1d99a0={'raw':![],'where':{'id':_0x111f08[_0xdb2e('0x46')]['id']}},_0x552401={};_0x552401[_0xdb2e('0x33')]=_['keys'](db[_0xdb2e('0x2e')][_0xdb2e('0x2f')]);_0x552401['query']=_['keys'](_0x111f08[_0xdb2e('0x35')]);_0x552401['filters']=_[_0xdb2e('0x34')](_0x552401[_0xdb2e('0x33')],_0x552401[_0xdb2e('0x35')]);_0x1d99a0[_0xdb2e('0x37')]=_[_0xdb2e('0x34')](_0x552401[_0xdb2e('0x33')],qs[_0xdb2e('0x36')](_0x111f08[_0xdb2e('0x35')][_0xdb2e('0x36')]));_0x1d99a0[_0xdb2e('0x37')]=_0x1d99a0[_0xdb2e('0x37')][_0xdb2e('0x38')]?_0x1d99a0['attributes']:_0x552401['model'];if(_0x111f08[_0xdb2e('0x35')][_0xdb2e('0x44')]){_0x1d99a0[_0xdb2e('0x47')]=[{'all':!![]}];}_0x1d99a0=_[_0xdb2e('0x40')]({},_0x1d99a0,_0x111f08[_0xdb2e('0x43')]);return db[_0xdb2e('0x2e')][_0xdb2e('0x48')](_0x1d99a0)[_0xdb2e('0x25')](handleEntityNotFound(_0x3fc088,null))[_0xdb2e('0x25')](respondWithResult(_0x3fc088,null))[_0xdb2e('0x49')](handleError(_0x3fc088,null));};exports[_0xdb2e('0x4a')]=function(_0x4ae62a,_0xbbaf63){return db[_0xdb2e('0x2e')]['create'](_0x4ae62a[_0xdb2e('0x4b')],{})[_0xdb2e('0x25')](function(_0x43ba10){var _0x5152e8=_0x4ae62a['user'][_0xdb2e('0x27')]({'plain':!![]});if(!_0x5152e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5152e8['role']===_0xdb2e('0x4c')){var _0x136203=_0x43ba10[_0xdb2e('0x27')]({'plain':!![]});var _0x50a7e5='Reports';return db[_0xdb2e('0x4d')][_0xdb2e('0x48')]({'where':{'name':_0x50a7e5,'userProfileId':_0x5152e8[_0xdb2e('0x4e')]},'raw':!![]})[_0xdb2e('0x25')](function(_0x654a03){if(_0x654a03&&_0x654a03[_0xdb2e('0x4f')]===0x0){return db[_0xdb2e('0x29')][_0xdb2e('0x4a')]({'name':_0x136203['name'],'resourceId':_0x136203['id'],'type':_0xdb2e('0x28'),'sectionId':_0x654a03['id']},{})[_0xdb2e('0x25')](function(){return _0x43ba10;});}else{return _0x43ba10;}})[_0xdb2e('0x49')](function(_0x543e7e){logger[_0xdb2e('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x543e7e);throw _0x543e7e;});}return _0x43ba10;})[_0xdb2e('0x25')](respondWithResult(_0xbbaf63,0xc9))['catch'](handleError(_0xbbaf63,null));};exports['update']=function(_0x6935bc,_0xbbcbeb){if(_0x6935bc[_0xdb2e('0x4b')]['id']){delete _0x6935bc['body']['id'];}return db['AnalyticCustomReport'][_0xdb2e('0x48')]({'where':{'id':_0x6935bc[_0xdb2e('0x46')]['id']}})[_0xdb2e('0x25')](handleEntityNotFound(_0xbbcbeb,null))[_0xdb2e('0x25')](saveUpdates(_0x6935bc['body'],null))['then'](respondWithResult(_0xbbcbeb,null))['catch'](handleError(_0xbbcbeb,null));};exports[_0xdb2e('0x26')]=function(_0x1b876a,_0x9accb6){return db[_0xdb2e('0x2e')]['find']({'where':{'id':_0x1b876a[_0xdb2e('0x46')]['id']}})[_0xdb2e('0x25')](handleEntityNotFound(_0x9accb6,null))[_0xdb2e('0x25')](removeEntity(_0x9accb6,null))[_0xdb2e('0x49')](handleError(_0x9accb6,null));};exports['preview']=function(_0x3d9df1,_0x4e1c83){var _0x296ec2=0xa;var _0x54d8b8=[_0xdb2e('0x51'),_0xdb2e('0x52'),'right_join',_0xdb2e('0x53')];var _0x194672={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':_0xdb2e('0x56'),'MAX':_0xdb2e('0x57'),'MIN':'MIN(%s)','AVG':_0xdb2e('0x58'),'GROUP_CONCAT':_0xdb2e('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdb2e('0x5a')};var _0x584168={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':_0xdb2e('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4ade26=function(_0x4af46d){return!_['includes']([_0xdb2e('0x5f'),'IS\x20NOT\x20NULL',_0xdb2e('0x60'),'IS\x20NOT\x20EMPTY'],_0x4af46d);};var _0x2a3936=function(_0x4c8699){if(!_0x4c8699||!_0x4c8699[_0xdb2e('0x61')]['length']){return'';}for(var _0x4cd4f2='(',_0x3a3c9c=0x0;_0x3a3c9c<_0x4c8699[_0xdb2e('0x61')][_0xdb2e('0x38')];_0x3a3c9c+=0x1){_0x3a3c9c>0x0&&(_0x4cd4f2+='\x20'+_0x4c8699[_0xdb2e('0x62')]+'\x20');_0x4cd4f2+=_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x63')]?_0x2a3936(_0x4c8699[_0xdb2e('0x61')][_0x3a3c9c][_0xdb2e('0x63')]):_0x4c8699[_0xdb2e('0x61')][_0x3a3c9c][_0xdb2e('0x64')]+'\x20'+_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x65')]+(_0x4ade26(_0x4c8699['rules'][_0x3a3c9c]['condition'])?'\x20'+_0x4c8699['rules'][_0x3a3c9c][_0xdb2e('0x66')]:'');}return _0x4cd4f2+')';};var _0x3aef1c={'where':{'id':_0x3d9df1[_0xdb2e('0x46')]['id']}},_0x55d5b6,_0xcd07be,_0x4ae7bf,_0x37410b,_0xf52371;_0x3aef1c=_[_0xdb2e('0x40')]({},_0x3aef1c,_0x3d9df1['options']);return db['AnalyticCustomReport']['find'](_0x3aef1c)[_0xdb2e('0x25')](function(_0x18e31e){if(_0x18e31e){_0x55d5b6=_0x18e31e;return _0x18e31e[_0xdb2e('0x67')]();}return null;})['then'](function(_0x4ef15a){if(_0x4ef15a){if(!_0x4ef15a[_0xdb2e('0x38')]){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))](_0xdb2e('0x6a'),0x193);}_0xcd07be=_0x4ef15a;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})[_0xdb2e('0x25')](function(_0x410137){if(_0x410137){_0x4ae7bf=_['keyBy'](_0x410137,'id');var _0x2e70fb;var _0x39af88=squel['select']();_0x39af88[_0xdb2e('0x6d')](_0x55d5b6[_0xdb2e('0x6e')]);for(var _0x1e95fa=0x0;_0x1e95fa<_0xcd07be[_0xdb2e('0x38')];_0x1e95fa+=0x1){_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x6f')]?_0x4ae7bf[_0xcd07be[_0x1e95fa][_0xdb2e('0x6f')]][_0xdb2e('0x70')]:_0xcd07be[_0x1e95fa]['field'];_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x194672[_0xcd07be[_0x1e95fa][_0xdb2e('0x71')]],'%s',_0x2e70fb):_0x2e70fb;_0x2e70fb=_0xcd07be[_0x1e95fa][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x584168[_0xcd07be[_0x1e95fa]['format']],'%s',_0x2e70fb):_0x2e70fb;if(_0xcd07be[_0x1e95fa][_0xdb2e('0x74')]){_0x39af88[_0xdb2e('0x63')](_0x2e70fb);}_0xcd07be[_0x1e95fa][_0xdb2e('0x75')]&&_0x39af88[_0xdb2e('0x76')](_0x2e70fb,_0xcd07be[_0x1e95fa][_0xdb2e('0x75')]===_0xdb2e('0x77')?![]:!![]);_0x39af88[_0xdb2e('0x64')](_0x2e70fb,_0xcd07be[_0x1e95fa][_0xdb2e('0x78')]||_0x2e70fb);}if(_0x55d5b6[_0xdb2e('0x79')]){_0x55d5b6['joins']=JSON['parse'](_0x55d5b6[_0xdb2e('0x79')]);for(var _0x5dd40a=0x0;_0x5dd40a<_0x55d5b6[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x5dd40a+=0x1){if(_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x41')]&&_['includes'](_0x54d8b8,_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x41')])&&_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7a')]&&_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x7b')]&&_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7c')]){_0x39af88[_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x41')]](_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7b')],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x55d5b6[_0xdb2e('0x6e')],_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7a')],_0x55d5b6[_0xdb2e('0x79')][_0x5dd40a][_0xdb2e('0x7b')],_0x55d5b6['joins'][_0x5dd40a][_0xdb2e('0x7c')]));}}}if(_0x55d5b6['conditions']){_0x55d5b6[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x55d5b6[_0xdb2e('0x7e')]);_0x39af88[_0xdb2e('0x3d')](_0x2a3936(_0x55d5b6[_0xdb2e('0x7e')][_0xdb2e('0x63')]));}_0xf52371=_0x39af88[_0xdb2e('0x80')]();_0x39af88[_0xdb2e('0x3b')](_0x296ec2);_0x39af88[_0xdb2e('0x1e')](0x0);logger[_0xdb2e('0x81')]('Limited\x20Query:',_0x39af88[_0xdb2e('0x82')]());return dbH[_0xdb2e('0x83')][_0xdb2e('0x35')](_0x39af88['toString'](),{'type':dbH['sequelize'][_0xdb2e('0x84')][_0xdb2e('0x85')]});}})[_0xdb2e('0x25')](respondWithResult(_0x4e1c83,null))[_0xdb2e('0x49')](handleError(_0x4e1c83,null));};function runReport(_0x383a6b,_0x4f5de4,_0x627b45){var _0xc8aaf1=_0x4f5de4[_0xdb2e('0x2b')];var _0x3f8e5a=0xa;var _0x27df56=[_0xdb2e('0x51'),'left_join',_0xdb2e('0x86'),_0xdb2e('0x53')];var _0x570777={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xdb2e('0x57'),'MIN':_0xdb2e('0x87'),'AVG':_0xdb2e('0x58'),'GROUP_CONCAT':_0xdb2e('0x59'),'GROUP_CONCAT ASC':_0xdb2e('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x485d3d={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdb2e('0x89')};var _0x3f005a=function(_0x3e7129){return!_[_0xdb2e('0x8a')]([_0xdb2e('0x5f'),_0xdb2e('0x8b'),'IS\x20EMPTY',_0xdb2e('0x8c')],_0x3e7129);};var _0x5dc883=function(_0x3ea83e){if(!_0x3ea83e||!_0x3ea83e[_0xdb2e('0x61')]['length']){return'';}for(var _0x5f2011='(',_0x313267=0x0;_0x313267<_0x3ea83e['rules'][_0xdb2e('0x38')];_0x313267+=0x1){_0x313267>0x0&&(_0x5f2011+='\x20'+_0x3ea83e[_0xdb2e('0x62')]+'\x20');_0x5f2011+=_0x3ea83e['rules'][_0x313267][_0xdb2e('0x63')]?_0x5dc883(_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x63')]):_0x3ea83e['rules'][_0x313267][_0xdb2e('0x64')]+'\x20'+_0x3ea83e['rules'][_0x313267]['condition']+(_0x3f005a(_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x65')])?'\x20'+_0x3ea83e[_0xdb2e('0x61')][_0x313267][_0xdb2e('0x66')]:'');}return _0x5f2011+')';};var _0x2ab1e1={'where':{'id':_0x383a6b['id']}},_0x2648f6,_0x56b2f6,_0x5041d0,_0x19f61a,_0x13c5d7;_0x2ab1e1=_['merge']({},_0x2ab1e1,_0x627b45);return db[_0xdb2e('0x2e')][_0xdb2e('0x48')](_0x2ab1e1)[_0xdb2e('0x25')](function(_0x2166c3){if(_0x2166c3){_0x2648f6=_0x2166c3;return _0x2166c3[_0xdb2e('0x67')]();}return null;})[_0xdb2e('0x25')](function(_0x5eb83f){if(_0x5eb83f){if(!_0x5eb83f[_0xdb2e('0x38')]){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))](_0xdb2e('0x6a'),0x193);}_0x56b2f6=_0x5eb83f;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})[_0xdb2e('0x25')](function(_0x215b57){if(_0x215b57){_0x5041d0=_[_0xdb2e('0x8d')](_0x215b57,'id');var _0x11d9bb;var _0x4ac2e3=squel[_0xdb2e('0x8e')]();_0x4ac2e3['from'](_0x2648f6[_0xdb2e('0x6e')]);for(var _0x132c8f=0x0;_0x132c8f<_0x56b2f6[_0xdb2e('0x38')];_0x132c8f+=0x1){_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x6f')]?_0x5041d0[_0x56b2f6[_0x132c8f][_0xdb2e('0x6f')]]['metric']:_0x56b2f6[_0x132c8f]['field'];_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x570777[_0x56b2f6[_0x132c8f][_0xdb2e('0x71')]],'%s',_0x11d9bb):_0x11d9bb;_0x11d9bb=_0x56b2f6[_0x132c8f][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x485d3d[_0x56b2f6[_0x132c8f][_0xdb2e('0x73')]],'%s',_0x11d9bb):_0x11d9bb;if(_0x56b2f6[_0x132c8f][_0xdb2e('0x74')]){_0x4ac2e3['group'](_0x11d9bb);}_0x56b2f6[_0x132c8f][_0xdb2e('0x75')]&&_0x4ac2e3[_0xdb2e('0x76')](_0x11d9bb,_0x56b2f6[_0x132c8f][_0xdb2e('0x75')]==='DESC'?![]:!![]);_0x4ac2e3[_0xdb2e('0x64')](_0x11d9bb,_0x56b2f6[_0x132c8f][_0xdb2e('0x78')]||_0x11d9bb);}if(_0x2648f6['joins']){_0x2648f6[_0xdb2e('0x79')]=JSON[_0xdb2e('0x7f')](_0x2648f6[_0xdb2e('0x79')]);for(var _0x314cf2=0x0;_0x314cf2<_0x2648f6[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x314cf2+=0x1){if(_0x2648f6['joins'][_0x314cf2]['type']&&_[_0xdb2e('0x8a')](_0x27df56,_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['type'])&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['parentKey']&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7b')]&&_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['foreignKey']){_0x4ac2e3[_0x2648f6['joins'][_0x314cf2][_0xdb2e('0x41')]](_0x2648f6[_0xdb2e('0x79')][_0x314cf2]['foreignTable'],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x2648f6[_0xdb2e('0x6e')],_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7a')],_0x2648f6['joins'][_0x314cf2]['foreignTable'],_0x2648f6[_0xdb2e('0x79')][_0x314cf2][_0xdb2e('0x7c')]));}}}if(_0x2648f6[_0xdb2e('0x7e')]){_0x2648f6[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x2648f6[_0xdb2e('0x7e')]);_0x4ac2e3[_0xdb2e('0x3d')](_0x5dc883(_0x2648f6[_0xdb2e('0x7e')][_0xdb2e('0x63')]));}_0x13c5d7=_0x4ac2e3[_0xdb2e('0x80')]();_0x4ac2e3[_0xdb2e('0x3b')](_0x3f8e5a);_0x4ac2e3['offset'](0x0);return;}})[_0xdb2e('0x25')](function(){if(_0x4f5de4[_0xdb2e('0x8f')]===_0xdb2e('0x90')){return null;}var _0x18f6c4=_[_0xdb2e('0x40')](_0x4f5de4,{'name':_0x4f5de4[_0xdb2e('0x91')]||_0x4f5de4[_0xdb2e('0x2b')]||_0x2648f6['name'],'basename':_0xc8aaf1,'savename':util['format'](_0xdb2e('0x92'),_0x4f5de4[_0xdb2e('0x2b')]||_0x2648f6[_0xdb2e('0x2b')],require(_0xdb2e('0x93'))['generate'](0x4),_0x4f5de4['output']||_0xdb2e('0x94')),'reportId':_0x2648f6['id'],'reportType':_0xdb2e('0x95')});return db[_0xdb2e('0x96')][_0xdb2e('0x4a')](_0x18f6c4,{'raw':!![]});})[_0xdb2e('0x25')](function(_0x35a6cd){if(_0x2648f6[_0xdb2e('0x6e')]===_0xdb2e('0x97')){_0x13c5d7[_0xdb2e('0x3d')](_0x2648f6[_0xdb2e('0x6e')]+_0xdb2e('0x98'),_0x4f5de4['startDate'],_0x4f5de4[_0xdb2e('0x99')]);}else{_0x13c5d7[_0xdb2e('0x3d')](_0x2648f6[_0xdb2e('0x6e')]+_0xdb2e('0x9a'),_0x4f5de4[_0xdb2e('0x9b')],_0x4f5de4[_0xdb2e('0x99')]);}if(_0x35a6cd){logger[_0xdb2e('0x9c')](_0xdb2e('0x9d'),_0x13c5d7[_0xdb2e('0x82')]());require(_0xdb2e('0x9e'))['fork'](path[_0xdb2e('0x51')](__dirname,'../../components/export/',_0x35a6cd[_0xdb2e('0x8f')]),[_0x35a6cd['id'],_0x13c5d7[_0xdb2e('0x82')](),path[_0xdb2e('0x51')](__dirname,_0xdb2e('0x9f'),_0x35a6cd[_0xdb2e('0xa0')]),_0xc8aaf1]);return _0x35a6cd;}else{var _0x3796eb=squel[_0xdb2e('0x8e')]();_0x3796eb['from']('('+_0x13c5d7[_0xdb2e('0x82')]()+')','countTable');_0x3796eb[_0xdb2e('0x64')](_0xdb2e('0xa1'),'count');_0x13c5d7[_0xdb2e('0x3b')](_0x4f5de4['limit']||_0x3f8e5a);_0x13c5d7[_0xdb2e('0x1e')](_0x4f5de4['offset']||0x0);return dbH['sequelize'][_0xdb2e('0x35')](_0x3796eb['toString'](),{'type':dbH['sequelize'][_0xdb2e('0x84')][_0xdb2e('0x85')]})['then'](function(_0x52f959){if(!_0x52f959[_0xdb2e('0x38')]){_0x19f61a=0x0;}else{_0x19f61a=_0x52f959[0x0][_0xdb2e('0x20')]||0x0;}return dbH[_0xdb2e('0x83')][_0xdb2e('0x35')](_0x13c5d7['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xdb2e('0x85')]});})[_0xdb2e('0x25')](function(_0x14e7c9){return{'rows':_0x14e7c9||[],'count':_0x19f61a};});}});}exports['run']=function(_0x18b044,_0x561a71){return runReport(_0x18b044['params'],_0x18b044[_0xdb2e('0x35')],_0x18b044[_0xdb2e('0x43')])['then'](respondWithResult(_0x561a71,null))[_0xdb2e('0x49')](handleError(_0x561a71,null));};exports[_0xdb2e('0xa2')]=runReport;exports[_0xdb2e('0x35')]=function(_0x45f862,_0x482d19){var _0x5027c4=0xa;var _0xf30a64=[_0xdb2e('0x51'),_0xdb2e('0x52'),'right_join',_0xdb2e('0x53')];var _0x12cbdb={'SUM':_0xdb2e('0x54'),'COUNT':_0xdb2e('0x55'),'COUNT DISTINCT':_0xdb2e('0x56'),'MAX':_0xdb2e('0x57'),'MIN':_0xdb2e('0x87'),'AVG':_0xdb2e('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xdb2e('0x88'),'GROUP_CONCAT DESC':_0xdb2e('0x5a')};var _0x35679c={'SEC_TO_TIME':_0xdb2e('0x5b'),'DATE':_0xdb2e('0x5c'),'HOUR':_0xdb2e('0x5d'),'ROUND':_0xdb2e('0x5e'),'UNIX_TIMESTAMP':_0xdb2e('0x89')};var _0x415b46=function(_0x1efd55){return!_[_0xdb2e('0x8a')]([_0xdb2e('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xdb2e('0x8c')],_0x1efd55);};var _0x357939=function(_0x35db1a){if(!_0x35db1a||!_0x35db1a[_0xdb2e('0x61')][_0xdb2e('0x38')]){return'';}for(var _0x455a00='(',_0x56d13c=0x0;_0x56d13c<_0x35db1a['rules'][_0xdb2e('0x38')];_0x56d13c+=0x1){_0x56d13c>0x0&&(_0x455a00+='\x20'+_0x35db1a[_0xdb2e('0x62')]+'\x20');_0x455a00+=_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x63')]?_0x357939(_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x63')]):_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x64')]+'\x20'+_0x35db1a[_0xdb2e('0x61')][_0x56d13c]['condition']+(_0x415b46(_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x65')])?'\x20'+_0x35db1a[_0xdb2e('0x61')][_0x56d13c][_0xdb2e('0x66')]:'');}return _0x455a00+')';};var _0x24b78e={'where':{'id':_0x45f862[_0xdb2e('0x46')]['id']}},_0x967c55,_0x11db14,_0x2cb682,_0x2adaed,_0x96c187;_0x24b78e=_[_0xdb2e('0x40')]({},_0x24b78e,_0x45f862['options']);return db['AnalyticCustomReport']['find'](_0x24b78e)[_0xdb2e('0x25')](function(_0xd0a841){if(_0xd0a841){_0x967c55=_0xd0a841;return _0xd0a841[_0xdb2e('0x67')]();}return null;})[_0xdb2e('0x25')](function(_0x3588dc){if(_0x3588dc){if(!_0x3588dc['length']){throw new db[(_0xdb2e('0x68'))][(_0xdb2e('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x11db14=_0x3588dc;return db[_0xdb2e('0x6b')][_0xdb2e('0x6c')]({'raw':!![]});}return null;})['then'](function(_0x4a992b){if(_0x4a992b){_0x2cb682=_[_0xdb2e('0x8d')](_0x4a992b,'id');var _0x54988b;var _0x127531=squel['select']();_0x127531[_0xdb2e('0x6d')](_0x967c55[_0xdb2e('0x6e')]);for(var _0x402c85=0x0;_0x402c85<_0x11db14[_0xdb2e('0x38')];_0x402c85+=0x1){_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x6f')]?_0x2cb682[_0x11db14[_0x402c85][_0xdb2e('0x6f')]][_0xdb2e('0x70')]:_0x11db14[_0x402c85][_0xdb2e('0x64')];_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x71')]?_[_0xdb2e('0x72')](_0x12cbdb[_0x11db14[_0x402c85][_0xdb2e('0x71')]],'%s',_0x54988b):_0x54988b;_0x54988b=_0x11db14[_0x402c85][_0xdb2e('0x73')]?_[_0xdb2e('0x72')](_0x35679c[_0x11db14[_0x402c85][_0xdb2e('0x73')]],'%s',_0x54988b):_0x54988b;if(_0x11db14[_0x402c85]['groupBy']){_0x127531[_0xdb2e('0x63')](_0x54988b);}_0x11db14[_0x402c85]['orderBy']&&_0x127531[_0xdb2e('0x76')](_0x54988b,_0x11db14[_0x402c85]['orderBy']===_0xdb2e('0x77')?![]:!![]);_0x127531[_0xdb2e('0x64')](_0x54988b,_0x11db14[_0x402c85]['alias']||_0x54988b);}if(_0x967c55['joins']){_0x967c55[_0xdb2e('0x79')]=JSON['parse'](_0x967c55[_0xdb2e('0x79')]);for(var _0x341715=0x0;_0x341715<_0x967c55[_0xdb2e('0x79')][_0xdb2e('0x38')];_0x341715+=0x1){if(_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x41')]&&_['includes'](_0xf30a64,_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x41')])&&_0x967c55['joins'][_0x341715]['parentKey']&&_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7b')]&&_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7c')]){_0x127531[_0x967c55['joins'][_0x341715]['type']](_0x967c55[_0xdb2e('0x79')][_0x341715]['foreignTable'],null,util[_0xdb2e('0x73')](_0xdb2e('0x7d'),_0x967c55[_0xdb2e('0x6e')],_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7a')],_0x967c55[_0xdb2e('0x79')][_0x341715][_0xdb2e('0x7b')],_0x967c55['joins'][_0x341715][_0xdb2e('0x7c')]));}}}if(_0x967c55[_0xdb2e('0x7e')]){_0x967c55[_0xdb2e('0x7e')]=JSON[_0xdb2e('0x7f')](_0x967c55[_0xdb2e('0x7e')]);_0x127531[_0xdb2e('0x3d')](_0x357939(_0x967c55[_0xdb2e('0x7e')]['group']));}_0x96c187=_0x127531[_0xdb2e('0x80')]();_0x127531[_0xdb2e('0x3b')](_0x5027c4);_0x127531[_0xdb2e('0x1e')](0x0);logger['debug'](_0xdb2e('0xa3'),_0x127531[_0xdb2e('0x82')]());return dbH['sequelize'][_0xdb2e('0x35')](_0x127531[_0xdb2e('0x82')](),{'type':dbH[_0xdb2e('0x83')][_0xdb2e('0x84')]['SELECT']});}})[_0xdb2e('0x25')](function(){return{'sql':_0x96c187['toString']()};})[_0xdb2e('0x25')](respondWithResult(_0x482d19,null))['catch'](handleError(_0x482d19,null));}; \ No newline at end of file +var _0x5e11=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_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)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','QueryTypes','SELECT','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','getFields','ValidationErrorItem','DESC','web','fullPath','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','sequelize','run','runReport','right_join','alias','Limited\x20Query:','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','error','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','create','body'];(function(_0x409a9e,_0x269849){var _0xffa2e=function(_0xcda550){while(--_0xcda550){_0x409a9e['push'](_0x409a9e['shift']());}};_0xffa2e(++_0x269849);}(_0x5e11,0x1a6));var _0x15e1=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x5e11[_0x20cf8a];return _0x54e165;};'use strict';var emlformat=require(_0x15e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15e1('0x2'));var moment=require(_0x15e1('0x3'));var BPromise=require(_0x15e1('0x4'));var Mustache=require(_0x15e1('0x5'));var util=require(_0x15e1('0x6'));var path=require(_0x15e1('0x7'));var sox=require(_0x15e1('0x8'));var csv=require('to-csv');var ejs=require(_0x15e1('0x9'));var fs=require('fs');var fs_extra=require(_0x15e1('0xa'));var _=require(_0x15e1('0xb'));var squel=require('squel');var crypto=require(_0x15e1('0xc'));var jsforce=require(_0x15e1('0xd'));var deskjs=require(_0x15e1('0xe'));var toCsv=require(_0x15e1('0xf'));var querystring=require('querystring');var Papa=require(_0x15e1('0x10'));var Redis=require('ioredis');var authService=require(_0x15e1('0x11'));var qs=require(_0x15e1('0x12'));var as=require(_0x15e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15e1('0x14'))(_0x15e1('0x15'));var utils=require(_0x15e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15e1('0x17'));var db=require(_0x15e1('0x18'))['db'];var dbH=require('../../mysqldb')[_0x15e1('0x19')];function respondWithStatusCode(_0x2e6cbc,_0x5746f9){_0x5746f9=_0x5746f9||0xcc;return function(_0x2b180f){if(_0x2b180f){return _0x2e6cbc[_0x15e1('0x1a')](_0x5746f9);}return _0x2e6cbc[_0x15e1('0x1b')](_0x5746f9)[_0x15e1('0x1c')]();};}function respondWithResult(_0xbb69d0,_0x207d1a){_0x207d1a=_0x207d1a||0xc8;return function(_0x344787){if(_0x344787){return _0xbb69d0[_0x15e1('0x1b')](_0x207d1a)['json'](_0x344787);}};}function respondWithFilteredResult(_0x2f35ca,_0x27978b){return function(_0xa7e863){if(_0xa7e863){var _0x4aa16c=typeof _0x27978b[_0x15e1('0x1d')]===_0x15e1('0x1e')&&typeof _0x27978b[_0x15e1('0x1f')]===_0x15e1('0x1e');var _0x5b53d4=_0xa7e863['count'];var _0x4a1fdd=_0x4aa16c?0x0:_0x27978b[_0x15e1('0x1d')];var _0x2555e7=_0x4aa16c?_0xa7e863[_0x15e1('0x20')]:_0x27978b[_0x15e1('0x1d')]+_0x27978b[_0x15e1('0x1f')];var _0x387671;if(_0x2555e7>=_0x5b53d4){_0x2555e7=_0x5b53d4;_0x387671=0xc8;}else{_0x387671=0xce;}_0x2f35ca[_0x15e1('0x1b')](_0x387671);return _0x2f35ca[_0x15e1('0x21')](_0x15e1('0x22'),_0x4a1fdd+'-'+_0x2555e7+'/'+_0x5b53d4)[_0x15e1('0x23')](_0xa7e863);}return null;};}function patchUpdates(_0x4f5e23){return function(_0x1f4487){try{jsonpatch[_0x15e1('0x24')](_0x1f4487,_0x4f5e23,!![]);}catch(_0x5b4718){return BPromise[_0x15e1('0x25')](_0x5b4718);}return _0x1f4487[_0x15e1('0x26')]();};}function saveUpdates(_0x292fae,_0x5d2f57){return function(_0x228a63){if(_0x228a63){return _0x228a63[_0x15e1('0x27')](_0x292fae)[_0x15e1('0x28')](function(_0x297c67){return _0x297c67;});}return null;};}function removeEntity(_0x54b108,_0x4874b4){return function(_0x389ea2){if(_0x389ea2){return _0x389ea2[_0x15e1('0x29')]()[_0x15e1('0x28')](function(){var _0x1271aa=_0x389ea2[_0x15e1('0x2a')]({'plain':!![]});var _0x3b0793='CustomReports';return db['UserProfileResource'][_0x15e1('0x29')]({'where':{'type':_0x3b0793,'resourceId':_0x1271aa['id']}})[_0x15e1('0x28')](function(){return _0x389ea2;});})[_0x15e1('0x28')](function(){_0x54b108[_0x15e1('0x1b')](0xcc)[_0x15e1('0x1c')]();});}};}function handleEntityNotFound(_0x95cf29,_0x52cd79){return function(_0x4b8d7c){if(!_0x4b8d7c){_0x95cf29[_0x15e1('0x1a')](0x194);}return _0x4b8d7c;};}function handleError(_0x3a6757,_0x5196a9){_0x5196a9=_0x5196a9||0x1f4;return function(_0x447828){logger[_0x15e1('0x2b')](_0x447828['stack']);if(_0x447828[_0x15e1('0x2c')]){delete _0x447828['name'];}_0x3a6757[_0x15e1('0x1b')](_0x5196a9)[_0x15e1('0x2d')](_0x447828);};}exports['index']=function(_0x390ffa,_0x10bf08){var _0x583b49={},_0xd8f259={},_0x1a9a1d={'count':0x0,'rows':[]};var _0x129dbb=_['map'](db[_0x15e1('0x2e')][_0x15e1('0x2f')],function(_0xe29a55){return{'name':_0xe29a55[_0x15e1('0x30')],'type':_0xe29a55[_0x15e1('0x31')]['key']};});_0xd8f259[_0x15e1('0x32')]=_[_0x15e1('0x33')](_0x129dbb,'name');_0xd8f259[_0x15e1('0x34')]=_[_0x15e1('0x35')](_0x390ffa['query']);_0xd8f259['filters']=_[_0x15e1('0x36')](_0xd8f259[_0x15e1('0x32')],_0xd8f259['query']);_0x583b49['attributes']=_[_0x15e1('0x36')](_0xd8f259['model'],qs[_0x15e1('0x37')](_0x390ffa[_0x15e1('0x34')]['fields']));_0x583b49[_0x15e1('0x38')]=_0x583b49['attributes'][_0x15e1('0x39')]?_0x583b49['attributes']:_0xd8f259['model'];if(!_0x390ffa['query'][_0x15e1('0x3a')](_0x15e1('0x3b'))){_0x583b49['limit']=qs[_0x15e1('0x1f')](_0x390ffa['query']['limit']);_0x583b49['offset']=qs['offset'](_0x390ffa[_0x15e1('0x34')][_0x15e1('0x1d')]);}_0x583b49[_0x15e1('0x3c')]=qs[_0x15e1('0x3d')](_0x390ffa[_0x15e1('0x34')][_0x15e1('0x3d')]);_0x583b49[_0x15e1('0x3e')]=qs[_0x15e1('0x3f')](_[_0x15e1('0x40')](_0x390ffa[_0x15e1('0x34')],_0xd8f259[_0x15e1('0x3f')]),_0x129dbb);if(_0x390ffa['query']['filter']){_0x583b49[_0x15e1('0x3e')]=_[_0x15e1('0x41')](_0x583b49[_0x15e1('0x3e')],{'$or':_[_0x15e1('0x33')](_0x129dbb,function(_0x5363e7){if(_0x5363e7[_0x15e1('0x31')]!=='VIRTUAL'){var _0x1962f3={};_0x1962f3[_0x5363e7[_0x15e1('0x2c')]]={'$like':'%'+_0x390ffa[_0x15e1('0x34')][_0x15e1('0x42')]+'%'};return _0x1962f3;}})});}_0x583b49=_[_0x15e1('0x41')]({},_0x583b49,_0x390ffa[_0x15e1('0x43')]);var _0x21d5d0={'where':_0x583b49[_0x15e1('0x3e')]};return db[_0x15e1('0x2e')][_0x15e1('0x20')](_0x21d5d0)[_0x15e1('0x28')](function(_0x8e3585){_0x1a9a1d[_0x15e1('0x20')]=_0x8e3585;if(_0x390ffa[_0x15e1('0x34')][_0x15e1('0x44')]){_0x583b49[_0x15e1('0x45')]=[{'all':!![]}];}return db[_0x15e1('0x2e')][_0x15e1('0x46')](_0x583b49);})[_0x15e1('0x28')](function(_0x466edf){_0x1a9a1d[_0x15e1('0x47')]=_0x466edf;return _0x1a9a1d;})[_0x15e1('0x28')](respondWithFilteredResult(_0x10bf08,_0x583b49))[_0x15e1('0x48')](handleError(_0x10bf08,null));};exports['show']=function(_0x2a3a67,_0xaeca2e){var _0x45fdb5={'raw':![],'where':{'id':_0x2a3a67[_0x15e1('0x49')]['id']}},_0x3bfa74={};_0x3bfa74[_0x15e1('0x32')]=_[_0x15e1('0x35')](db[_0x15e1('0x2e')]['rawAttributes']);_0x3bfa74[_0x15e1('0x34')]=_[_0x15e1('0x35')](_0x2a3a67[_0x15e1('0x34')]);_0x3bfa74[_0x15e1('0x3f')]=_['intersection'](_0x3bfa74[_0x15e1('0x32')],_0x3bfa74[_0x15e1('0x34')]);_0x45fdb5[_0x15e1('0x38')]=_['intersection'](_0x3bfa74['model'],qs[_0x15e1('0x37')](_0x2a3a67[_0x15e1('0x34')]['fields']));_0x45fdb5['attributes']=_0x45fdb5['attributes'][_0x15e1('0x39')]?_0x45fdb5[_0x15e1('0x38')]:_0x3bfa74[_0x15e1('0x32')];if(_0x2a3a67[_0x15e1('0x34')][_0x15e1('0x44')]){_0x45fdb5[_0x15e1('0x45')]=[{'all':!![]}];}_0x45fdb5=_[_0x15e1('0x41')]({},_0x45fdb5,_0x2a3a67[_0x15e1('0x43')]);return db[_0x15e1('0x2e')]['find'](_0x45fdb5)[_0x15e1('0x28')](handleEntityNotFound(_0xaeca2e,null))[_0x15e1('0x28')](respondWithResult(_0xaeca2e,null))[_0x15e1('0x48')](handleError(_0xaeca2e,null));};exports[_0x15e1('0x4a')]=function(_0x381e4b,_0x309520){return db[_0x15e1('0x2e')][_0x15e1('0x4a')](_0x381e4b[_0x15e1('0x4b')],{})[_0x15e1('0x28')](function(_0x351582){var _0x3ee90b=_0x381e4b['user'][_0x15e1('0x2a')]({'plain':!![]});if(!_0x3ee90b)throw new Error(_0x15e1('0x4c'));if(_0x3ee90b['role']===_0x15e1('0x4d')){var _0xa4c3ef=_0x351582['get']({'plain':!![]});var _0x1bb451='Reports';return db['UserProfileSection'][_0x15e1('0x4e')]({'where':{'name':_0x1bb451,'userProfileId':_0x3ee90b[_0x15e1('0x4f')]},'raw':!![]})[_0x15e1('0x28')](function(_0x57c9a4){if(_0x57c9a4&&_0x57c9a4[_0x15e1('0x50')]===0x0){return db[_0x15e1('0x51')][_0x15e1('0x4a')]({'name':_0xa4c3ef[_0x15e1('0x2c')],'resourceId':_0xa4c3ef['id'],'type':_0x15e1('0x52'),'sectionId':_0x57c9a4['id']},{})[_0x15e1('0x28')](function(){return _0x351582;});}else{return _0x351582;}})['catch'](function(_0x223e34){logger[_0x15e1('0x2b')](_0x15e1('0x53'),_0x223e34);throw _0x223e34;});}return _0x351582;})[_0x15e1('0x28')](respondWithResult(_0x309520,0xc9))['catch'](handleError(_0x309520,null));};exports['update']=function(_0x581b22,_0x3cd6af){if(_0x581b22['body']['id']){delete _0x581b22[_0x15e1('0x4b')]['id'];}return db[_0x15e1('0x2e')][_0x15e1('0x4e')]({'where':{'id':_0x581b22[_0x15e1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cd6af,null))[_0x15e1('0x28')](saveUpdates(_0x581b22[_0x15e1('0x4b')],null))[_0x15e1('0x28')](respondWithResult(_0x3cd6af,null))[_0x15e1('0x48')](handleError(_0x3cd6af,null));};exports['destroy']=function(_0x385f4e,_0x3b1980){return db[_0x15e1('0x2e')][_0x15e1('0x4e')]({'where':{'id':_0x385f4e[_0x15e1('0x49')]['id']}})[_0x15e1('0x28')](handleEntityNotFound(_0x3b1980,null))['then'](removeEntity(_0x3b1980,null))[_0x15e1('0x48')](handleError(_0x3b1980,null));};exports['preview']=function(_0x2cc615,_0x2188be){var _0x3b125d=0xa;var _0x594a59=['join',_0x15e1('0x54'),'right_join',_0x15e1('0x55')];var _0xac4b3f={'SUM':_0x15e1('0x56'),'COUNT':_0x15e1('0x57'),'COUNT DISTINCT':_0x15e1('0x58'),'MAX':_0x15e1('0x59'),'MIN':_0x15e1('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x15e1('0x5b'),'GROUP_CONCAT ASC':_0x15e1('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x574fcf={'SEC_TO_TIME':_0x15e1('0x5d'),'DATE':'DATE(%s)','HOUR':_0x15e1('0x5e'),'ROUND':_0x15e1('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x167835=function(_0x1369ff){return!_[_0x15e1('0x60')]([_0x15e1('0x61'),_0x15e1('0x62'),_0x15e1('0x63'),_0x15e1('0x64')],_0x1369ff);};var _0x4762a4=function(_0x3908b2){if(!_0x3908b2||!_0x3908b2[_0x15e1('0x65')][_0x15e1('0x39')]){return'';}for(var _0xd35ed='(',_0x4002c3=0x0;_0x4002c3<_0x3908b2[_0x15e1('0x65')][_0x15e1('0x39')];_0x4002c3+=0x1){_0x4002c3>0x0&&(_0xd35ed+='\x20'+_0x3908b2[_0x15e1('0x66')]+'\x20');_0xd35ed+=_0x3908b2[_0x15e1('0x65')][_0x4002c3]['group']?_0x4762a4(_0x3908b2[_0x15e1('0x65')][_0x4002c3][_0x15e1('0x67')]):_0x3908b2['rules'][_0x4002c3][_0x15e1('0x68')]+'\x20'+_0x3908b2[_0x15e1('0x65')][_0x4002c3][_0x15e1('0x69')]+(_0x167835(_0x3908b2[_0x15e1('0x65')][_0x4002c3]['condition'])?'\x20'+_0x3908b2[_0x15e1('0x65')][_0x4002c3][_0x15e1('0x6a')]:'');}return _0xd35ed+')';};var _0x4aae02={'where':{'id':_0x2cc615['params']['id']}},_0x59c17e,_0x306df3,_0x3dbd01,_0x196234,_0x4db560;_0x4aae02=_['merge']({},_0x4aae02,_0x2cc615[_0x15e1('0x43')]);return db[_0x15e1('0x2e')]['find'](_0x4aae02)[_0x15e1('0x28')](function(_0x22f298){if(_0x22f298){_0x59c17e=_0x22f298;return _0x22f298['getFields']();}return null;})[_0x15e1('0x28')](function(_0x33a0ff){if(_0x33a0ff){if(!_0x33a0ff[_0x15e1('0x39')]){throw new db[(_0x15e1('0x6b'))]['ValidationErrorItem'](_0x15e1('0x6c'),0x193);}_0x306df3=_0x33a0ff;return db[_0x15e1('0x6d')][_0x15e1('0x46')]({'raw':!![]});}return null;})[_0x15e1('0x28')](function(_0x47d028){if(_0x47d028){_0x3dbd01=_[_0x15e1('0x6e')](_0x47d028,'id');var _0x4c094b;var _0x55f426=squel[_0x15e1('0x6f')]();_0x55f426[_0x15e1('0x70')](_0x59c17e[_0x15e1('0x71')]);for(var _0xd1517d=0x0;_0xd1517d<_0x306df3[_0x15e1('0x39')];_0xd1517d+=0x1){_0x4c094b=_0x306df3[_0xd1517d]['MetricId']?_0x3dbd01[_0x306df3[_0xd1517d][_0x15e1('0x72')]][_0x15e1('0x73')]:_0x306df3[_0xd1517d][_0x15e1('0x68')];_0x4c094b=_0x306df3[_0xd1517d][_0x15e1('0x74')]?_[_0x15e1('0x75')](_0xac4b3f[_0x306df3[_0xd1517d][_0x15e1('0x74')]],'%s',_0x4c094b):_0x4c094b;_0x4c094b=_0x306df3[_0xd1517d]['format']?_['replace'](_0x574fcf[_0x306df3[_0xd1517d][_0x15e1('0x76')]],'%s',_0x4c094b):_0x4c094b;if(_0x306df3[_0xd1517d][_0x15e1('0x77')]){_0x55f426[_0x15e1('0x67')](_0x4c094b);}_0x306df3[_0xd1517d]['orderBy']&&_0x55f426[_0x15e1('0x3c')](_0x4c094b,_0x306df3[_0xd1517d][_0x15e1('0x78')]==='DESC'?![]:!![]);_0x55f426['field'](_0x4c094b,_0x306df3[_0xd1517d]['alias']||_0x4c094b);}if(_0x59c17e[_0x15e1('0x79')]){_0x59c17e[_0x15e1('0x79')]=JSON[_0x15e1('0x7a')](_0x59c17e[_0x15e1('0x79')]);for(var _0x318124=0x0;_0x318124<_0x59c17e['joins'][_0x15e1('0x39')];_0x318124+=0x1){if(_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x31')]&&_[_0x15e1('0x60')](_0x594a59,_0x59c17e[_0x15e1('0x79')][_0x318124]['type'])&&_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x7b')]&&_0x59c17e['joins'][_0x318124][_0x15e1('0x7c')]&&_0x59c17e['joins'][_0x318124][_0x15e1('0x7d')]){_0x55f426[_0x59c17e['joins'][_0x318124][_0x15e1('0x31')]](_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x7c')],null,util[_0x15e1('0x76')](_0x15e1('0x7e'),_0x59c17e[_0x15e1('0x71')],_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x7b')],_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x7c')],_0x59c17e[_0x15e1('0x79')][_0x318124][_0x15e1('0x7d')]));}}}if(_0x59c17e[_0x15e1('0x7f')]){_0x59c17e[_0x15e1('0x7f')]=JSON[_0x15e1('0x7a')](_0x59c17e[_0x15e1('0x7f')]);_0x55f426[_0x15e1('0x3e')](_0x4762a4(_0x59c17e['conditions'][_0x15e1('0x67')]));}_0x4db560=_0x55f426['clone']();_0x55f426[_0x15e1('0x1f')](_0x3b125d);_0x55f426['offset'](0x0);logger[_0x15e1('0x80')]('Limited\x20Query:',_0x55f426[_0x15e1('0x81')]());return dbH['sequelize'][_0x15e1('0x34')](_0x55f426[_0x15e1('0x81')](),{'type':dbH['sequelize'][_0x15e1('0x82')][_0x15e1('0x83')]});}})[_0x15e1('0x28')](respondWithResult(_0x2188be,null))[_0x15e1('0x48')](handleError(_0x2188be,null));};function runReport(_0x4eb287,_0xab0db0,_0x45d9fa){var _0x486848=_0xab0db0[_0x15e1('0x2c')];var _0x11057b=0xa;var _0x4e5eff=['join',_0x15e1('0x54'),'right_join',_0x15e1('0x55')];var _0x2fa990={'SUM':_0x15e1('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x15e1('0x59'),'MIN':'MIN(%s)','AVG':_0x15e1('0x84'),'GROUP_CONCAT':_0x15e1('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x15e1('0x85')};var _0x1bfef0={'SEC_TO_TIME':_0x15e1('0x5d'),'DATE':_0x15e1('0x86'),'HOUR':_0x15e1('0x5e'),'ROUND':_0x15e1('0x5f'),'UNIX_TIMESTAMP':_0x15e1('0x87')};var _0x46b446=function(_0x4ecdf8){return!_[_0x15e1('0x60')]([_0x15e1('0x61'),_0x15e1('0x62'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4ecdf8);};var _0x582dbb=function(_0x3ad29f){if(!_0x3ad29f||!_0x3ad29f['rules']['length']){return'';}for(var _0x26bfbe='(',_0x36c127=0x0;_0x36c127<_0x3ad29f[_0x15e1('0x65')][_0x15e1('0x39')];_0x36c127+=0x1){_0x36c127>0x0&&(_0x26bfbe+='\x20'+_0x3ad29f[_0x15e1('0x66')]+'\x20');_0x26bfbe+=_0x3ad29f[_0x15e1('0x65')][_0x36c127][_0x15e1('0x67')]?_0x582dbb(_0x3ad29f[_0x15e1('0x65')][_0x36c127][_0x15e1('0x67')]):_0x3ad29f['rules'][_0x36c127][_0x15e1('0x68')]+'\x20'+_0x3ad29f[_0x15e1('0x65')][_0x36c127][_0x15e1('0x69')]+(_0x46b446(_0x3ad29f[_0x15e1('0x65')][_0x36c127]['condition'])?'\x20'+_0x3ad29f[_0x15e1('0x65')][_0x36c127]['value']:'');}return _0x26bfbe+')';};var _0x1324d4={'where':{'id':_0x4eb287['id']}},_0x1d21a5,_0x304e7d,_0x294aac,_0x1d644c,_0x2a268a;_0x1324d4=_[_0x15e1('0x41')]({},_0x1324d4,_0x45d9fa);return db[_0x15e1('0x2e')]['find'](_0x1324d4)['then'](function(_0x5f19ac){if(_0x5f19ac){_0x1d21a5=_0x5f19ac;return _0x5f19ac[_0x15e1('0x88')]();}return null;})['then'](function(_0x110fd4){if(_0x110fd4){if(!_0x110fd4['length']){throw new db[(_0x15e1('0x6b'))][(_0x15e1('0x89'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x304e7d=_0x110fd4;return db[_0x15e1('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x15e1('0x28')](function(_0x44af13){if(_0x44af13){_0x294aac=_[_0x15e1('0x6e')](_0x44af13,'id');var _0x58ef97;var _0x20a607=squel[_0x15e1('0x6f')]();_0x20a607['from'](_0x1d21a5[_0x15e1('0x71')]);for(var _0x25acb7=0x0;_0x25acb7<_0x304e7d['length'];_0x25acb7+=0x1){_0x58ef97=_0x304e7d[_0x25acb7][_0x15e1('0x72')]?_0x294aac[_0x304e7d[_0x25acb7][_0x15e1('0x72')]][_0x15e1('0x73')]:_0x304e7d[_0x25acb7][_0x15e1('0x68')];_0x58ef97=_0x304e7d[_0x25acb7][_0x15e1('0x74')]?_[_0x15e1('0x75')](_0x2fa990[_0x304e7d[_0x25acb7][_0x15e1('0x74')]],'%s',_0x58ef97):_0x58ef97;_0x58ef97=_0x304e7d[_0x25acb7][_0x15e1('0x76')]?_[_0x15e1('0x75')](_0x1bfef0[_0x304e7d[_0x25acb7][_0x15e1('0x76')]],'%s',_0x58ef97):_0x58ef97;if(_0x304e7d[_0x25acb7][_0x15e1('0x77')]){_0x20a607[_0x15e1('0x67')](_0x58ef97);}_0x304e7d[_0x25acb7][_0x15e1('0x78')]&&_0x20a607['order'](_0x58ef97,_0x304e7d[_0x25acb7][_0x15e1('0x78')]===_0x15e1('0x8a')?![]:!![]);_0x20a607['field'](_0x58ef97,_0x304e7d[_0x25acb7]['alias']||_0x58ef97);}if(_0x1d21a5[_0x15e1('0x79')]){_0x1d21a5[_0x15e1('0x79')]=JSON[_0x15e1('0x7a')](_0x1d21a5['joins']);for(var _0x33cf94=0x0;_0x33cf94<_0x1d21a5[_0x15e1('0x79')]['length'];_0x33cf94+=0x1){if(_0x1d21a5[_0x15e1('0x79')][_0x33cf94]['type']&&_[_0x15e1('0x60')](_0x4e5eff,_0x1d21a5['joins'][_0x33cf94][_0x15e1('0x31')])&&_0x1d21a5[_0x15e1('0x79')][_0x33cf94][_0x15e1('0x7b')]&&_0x1d21a5[_0x15e1('0x79')][_0x33cf94][_0x15e1('0x7c')]&&_0x1d21a5['joins'][_0x33cf94][_0x15e1('0x7d')]){_0x20a607[_0x1d21a5[_0x15e1('0x79')][_0x33cf94][_0x15e1('0x31')]](_0x1d21a5[_0x15e1('0x79')][_0x33cf94]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1d21a5[_0x15e1('0x71')],_0x1d21a5['joins'][_0x33cf94][_0x15e1('0x7b')],_0x1d21a5[_0x15e1('0x79')][_0x33cf94][_0x15e1('0x7c')],_0x1d21a5[_0x15e1('0x79')][_0x33cf94][_0x15e1('0x7d')]));}}}if(_0x1d21a5[_0x15e1('0x7f')]){_0x1d21a5[_0x15e1('0x7f')]=JSON['parse'](_0x1d21a5[_0x15e1('0x7f')]);_0x20a607['where'](_0x582dbb(_0x1d21a5[_0x15e1('0x7f')][_0x15e1('0x67')]));}_0x2a268a=_0x20a607['clone']();_0x20a607[_0x15e1('0x1f')](_0x11057b);_0x20a607['offset'](0x0);return;}})[_0x15e1('0x28')](function(){if(_0xab0db0['output']===_0x15e1('0x8b')){return null;}var _0x417fa6=_[_0x15e1('0x41')](_0xab0db0,{'name':_0xab0db0[_0x15e1('0x8c')]||_0xab0db0[_0x15e1('0x2c')]||_0x1d21a5[_0x15e1('0x2c')],'basename':_0x486848,'savename':util[_0x15e1('0x76')](_0x15e1('0x8d'),_0xab0db0['name']||_0x1d21a5[_0x15e1('0x2c')],require(_0x15e1('0x8e'))['generate'](0x4),_0xab0db0[_0x15e1('0x8f')]||_0x15e1('0x90')),'reportId':_0x1d21a5['id'],'reportType':_0x15e1('0x91')});return db[_0x15e1('0x92')][_0x15e1('0x4a')](_0x417fa6,{'raw':!![]});})[_0x15e1('0x28')](function(_0x282d48){if(_0x1d21a5[_0x15e1('0x71')]===_0x15e1('0x93')){_0x2a268a[_0x15e1('0x3e')](_0x1d21a5[_0x15e1('0x71')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xab0db0[_0x15e1('0x94')],_0xab0db0[_0x15e1('0x95')]);}else{_0x2a268a[_0x15e1('0x3e')](_0x1d21a5[_0x15e1('0x71')]+_0x15e1('0x96'),_0xab0db0[_0x15e1('0x94')],_0xab0db0['endDate']);}if(_0x282d48){logger[_0x15e1('0x97')](_0x15e1('0x98'),_0x2a268a[_0x15e1('0x81')]());require(_0x15e1('0x99'))[_0x15e1('0x9a')](path[_0x15e1('0x9b')](__dirname,'../../components/export/',_0x282d48['output']),[_0x282d48['id'],_0x2a268a['toString'](),path[_0x15e1('0x9b')](__dirname,_0x15e1('0x9c'),_0x282d48[_0x15e1('0x9d')]),_0x486848]);return _0x282d48;}else{var _0x3f14c7=squel[_0x15e1('0x6f')]();_0x3f14c7[_0x15e1('0x70')]('('+_0x2a268a[_0x15e1('0x81')]()+')',_0x15e1('0x9e'));_0x3f14c7[_0x15e1('0x68')](_0x15e1('0x9f'),'count');_0x2a268a[_0x15e1('0x1f')](_0xab0db0['limit']||_0x11057b);_0x2a268a[_0x15e1('0x1d')](_0xab0db0[_0x15e1('0x1d')]||0x0);return dbH[_0x15e1('0xa0')]['query'](_0x3f14c7[_0x15e1('0x81')](),{'type':dbH[_0x15e1('0xa0')]['QueryTypes'][_0x15e1('0x83')]})[_0x15e1('0x28')](function(_0x19b76f){if(!_0x19b76f[_0x15e1('0x39')]){_0x1d644c=0x0;}else{_0x1d644c=_0x19b76f[0x0][_0x15e1('0x20')]||0x0;}return dbH['sequelize'][_0x15e1('0x34')](_0x2a268a[_0x15e1('0x81')](),{'type':dbH['sequelize']['QueryTypes'][_0x15e1('0x83')]});})['then'](function(_0x353694){return{'rows':_0x353694||[],'count':_0x1d644c};});}});}exports[_0x15e1('0xa1')]=function(_0x3e19fb,_0x11fcf9){return runReport(_0x3e19fb[_0x15e1('0x49')],_0x3e19fb[_0x15e1('0x34')],_0x3e19fb[_0x15e1('0x43')])[_0x15e1('0x28')](respondWithResult(_0x11fcf9,null))[_0x15e1('0x48')](handleError(_0x11fcf9,null));};exports[_0x15e1('0xa2')]=runReport;exports[_0x15e1('0x34')]=function(_0x5e314c,_0x94c33){var _0x2b0d63=0xa;var _0x463fc3=[_0x15e1('0x9b'),'left_join',_0x15e1('0xa3'),_0x15e1('0x55')];var _0x2fa4ac={'SUM':_0x15e1('0x56'),'COUNT':_0x15e1('0x57'),'COUNT DISTINCT':_0x15e1('0x58'),'MAX':_0x15e1('0x59'),'MIN':_0x15e1('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x15e1('0x5c'),'GROUP_CONCAT DESC':_0x15e1('0x85')};var _0x9fa5f0={'SEC_TO_TIME':_0x15e1('0x5d'),'DATE':_0x15e1('0x86'),'HOUR':_0x15e1('0x5e'),'ROUND':_0x15e1('0x5f'),'UNIX_TIMESTAMP':_0x15e1('0x87')};var _0x378229=function(_0x56e2ed){return!_[_0x15e1('0x60')](['IS\x20NULL',_0x15e1('0x62'),_0x15e1('0x63'),_0x15e1('0x64')],_0x56e2ed);};var _0x274a2a=function(_0x5d580e){if(!_0x5d580e||!_0x5d580e[_0x15e1('0x65')][_0x15e1('0x39')]){return'';}for(var _0x3d5c51='(',_0x16fb87=0x0;_0x16fb87<_0x5d580e[_0x15e1('0x65')][_0x15e1('0x39')];_0x16fb87+=0x1){_0x16fb87>0x0&&(_0x3d5c51+='\x20'+_0x5d580e['operator']+'\x20');_0x3d5c51+=_0x5d580e[_0x15e1('0x65')][_0x16fb87]['group']?_0x274a2a(_0x5d580e[_0x15e1('0x65')][_0x16fb87][_0x15e1('0x67')]):_0x5d580e[_0x15e1('0x65')][_0x16fb87]['field']+'\x20'+_0x5d580e['rules'][_0x16fb87][_0x15e1('0x69')]+(_0x378229(_0x5d580e[_0x15e1('0x65')][_0x16fb87][_0x15e1('0x69')])?'\x20'+_0x5d580e[_0x15e1('0x65')][_0x16fb87][_0x15e1('0x6a')]:'');}return _0x3d5c51+')';};var _0x19d4f4={'where':{'id':_0x5e314c[_0x15e1('0x49')]['id']}},_0x238c92,_0x34f79e,_0x9e7769,_0x1d9698,_0x3e402a;_0x19d4f4=_[_0x15e1('0x41')]({},_0x19d4f4,_0x5e314c[_0x15e1('0x43')]);return db['AnalyticCustomReport'][_0x15e1('0x4e')](_0x19d4f4)[_0x15e1('0x28')](function(_0x34370e){if(_0x34370e){_0x238c92=_0x34370e;return _0x34370e[_0x15e1('0x88')]();}return null;})[_0x15e1('0x28')](function(_0x3f15fa){if(_0x3f15fa){if(!_0x3f15fa['length']){throw new db['Sequelize'][(_0x15e1('0x89'))](_0x15e1('0x6c'),0x193);}_0x34f79e=_0x3f15fa;return db[_0x15e1('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x15e1('0x28')](function(_0x2eb0b5){if(_0x2eb0b5){_0x9e7769=_[_0x15e1('0x6e')](_0x2eb0b5,'id');var _0x8117cb;var _0x4a0b84=squel[_0x15e1('0x6f')]();_0x4a0b84[_0x15e1('0x70')](_0x238c92['table']);for(var _0x4fb91e=0x0;_0x4fb91e<_0x34f79e[_0x15e1('0x39')];_0x4fb91e+=0x1){_0x8117cb=_0x34f79e[_0x4fb91e]['MetricId']?_0x9e7769[_0x34f79e[_0x4fb91e][_0x15e1('0x72')]]['metric']:_0x34f79e[_0x4fb91e][_0x15e1('0x68')];_0x8117cb=_0x34f79e[_0x4fb91e]['function']?_[_0x15e1('0x75')](_0x2fa4ac[_0x34f79e[_0x4fb91e][_0x15e1('0x74')]],'%s',_0x8117cb):_0x8117cb;_0x8117cb=_0x34f79e[_0x4fb91e][_0x15e1('0x76')]?_[_0x15e1('0x75')](_0x9fa5f0[_0x34f79e[_0x4fb91e][_0x15e1('0x76')]],'%s',_0x8117cb):_0x8117cb;if(_0x34f79e[_0x4fb91e]['groupBy']){_0x4a0b84[_0x15e1('0x67')](_0x8117cb);}_0x34f79e[_0x4fb91e][_0x15e1('0x78')]&&_0x4a0b84[_0x15e1('0x3c')](_0x8117cb,_0x34f79e[_0x4fb91e][_0x15e1('0x78')]===_0x15e1('0x8a')?![]:!![]);_0x4a0b84[_0x15e1('0x68')](_0x8117cb,_0x34f79e[_0x4fb91e][_0x15e1('0xa4')]||_0x8117cb);}if(_0x238c92['joins']){_0x238c92[_0x15e1('0x79')]=JSON[_0x15e1('0x7a')](_0x238c92[_0x15e1('0x79')]);for(var _0x27afbf=0x0;_0x27afbf<_0x238c92[_0x15e1('0x79')][_0x15e1('0x39')];_0x27afbf+=0x1){if(_0x238c92[_0x15e1('0x79')][_0x27afbf][_0x15e1('0x31')]&&_['includes'](_0x463fc3,_0x238c92[_0x15e1('0x79')][_0x27afbf]['type'])&&_0x238c92['joins'][_0x27afbf][_0x15e1('0x7b')]&&_0x238c92[_0x15e1('0x79')][_0x27afbf]['foreignTable']&&_0x238c92[_0x15e1('0x79')][_0x27afbf][_0x15e1('0x7d')]){_0x4a0b84[_0x238c92['joins'][_0x27afbf]['type']](_0x238c92[_0x15e1('0x79')][_0x27afbf][_0x15e1('0x7c')],null,util[_0x15e1('0x76')](_0x15e1('0x7e'),_0x238c92['table'],_0x238c92[_0x15e1('0x79')][_0x27afbf][_0x15e1('0x7b')],_0x238c92[_0x15e1('0x79')][_0x27afbf][_0x15e1('0x7c')],_0x238c92['joins'][_0x27afbf][_0x15e1('0x7d')]));}}}if(_0x238c92['conditions']){_0x238c92['conditions']=JSON['parse'](_0x238c92['conditions']);_0x4a0b84['where'](_0x274a2a(_0x238c92[_0x15e1('0x7f')][_0x15e1('0x67')]));}_0x3e402a=_0x4a0b84['clone']();_0x4a0b84[_0x15e1('0x1f')](_0x2b0d63);_0x4a0b84[_0x15e1('0x1d')](0x0);logger[_0x15e1('0x80')](_0x15e1('0xa5'),_0x4a0b84[_0x15e1('0x81')]());return dbH['sequelize'][_0x15e1('0x34')](_0x4a0b84[_0x15e1('0x81')](),{'type':dbH[_0x15e1('0xa0')][_0x15e1('0x82')][_0x15e1('0x83')]});}})[_0x15e1('0x28')](function(){return{'sql':_0x3e402a[_0x15e1('0x81')]()};})['then'](respondWithResult(_0x94c33,null))['catch'](handleError(_0x94c33,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2b0b420..86a4ede 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 _0x9e06=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util'];(function(_0x473155,_0x2f4730){var _0x57525a=function(_0x14a8f2){while(--_0x14a8f2){_0x473155['push'](_0x473155['shift']());}};_0x57525a(++_0x2f4730);}(_0x9e06,0x106));var _0x69e0=function(_0x422d30,_0x5ec4b1){_0x422d30=_0x422d30-0x0;var _0x236072=_0x9e06[_0x422d30];return _0x236072;};'use strict';var _=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var logger=require(_0x69e0('0x2'))(_0x69e0('0x3'));var moment=require(_0x69e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x69e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69e0('0x6'));var config=require(_0x69e0('0x7'));var attributes=require(_0x69e0('0x8'));module[_0x69e0('0x9')]=function(_0x47d2aa,_0x308873){return _0x47d2aa[_0x69e0('0xa')](_0x69e0('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x784f=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','api','moment','bluebird','path','rimraf'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x784f,0xb5));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf784('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf784('0x1'));var moment=require(_0xf784('0x2'));var BPromise=require(_0xf784('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf784('0x4'));var rimraf=require(_0xf784('0x5'));var config=require(_0xf784('0x6'));var attributes=require(_0xf784('0x7'));module[_0xf784('0x8')]=function(_0x1a5ca1,_0x2bf767){return _0x1a5ca1[_0xf784('0x9')](_0xf784('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index edafa04..a0c8200 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 _0xefe6=['rpc','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe6,0x8c));var _0x6efe=function(_0x58e09b,_0x6ef44c){_0x58e09b=_0x58e09b-0x0;var _0x243038=_0xefe6[_0x58e09b];return _0x243038;};'use strict';var _=require('lodash');var util=require(_0x6efe('0x0'));var moment=require(_0x6efe('0x1'));var BPromise=require(_0x6efe('0x2'));var rs=require(_0x6efe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6efe('0x4'))['db'];var utils=require(_0x6efe('0x5'));var logger=require(_0x6efe('0x6'))(_0x6efe('0x7'));var config=require(_0x6efe('0x8'));var jayson=require(_0x6efe('0x9'));var client=jayson['client'][_0x6efe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28e0ae,_0xc70024,_0x4f71ee){return new BPromise(function(_0x2cc472,_0x102471){return client['request'](_0x28e0ae,_0x4f71ee)['then'](function(_0x1c383f){logger[_0x6efe('0xb')](_0x6efe('0xc'),_0xc70024,_0x6efe('0xd'));logger[_0x6efe('0xe')](_0x6efe('0xf'),_0xc70024,_0x6efe('0xd'),JSON[_0x6efe('0x10')](_0x1c383f));if(_0x1c383f[_0x6efe('0x11')]){if(_0x1c383f[_0x6efe('0x11')]['code']===0x1f4){logger[_0x6efe('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc70024,_0x1c383f['error'][_0x6efe('0x12')]);return _0x102471(_0x1c383f['error'][_0x6efe('0x12')]);}logger[_0x6efe('0x11')](_0x6efe('0xc'),_0xc70024,_0x1c383f[_0x6efe('0x11')][_0x6efe('0x12')]);return _0x2cc472(_0x1c383f[_0x6efe('0x11')][_0x6efe('0x12')]);}else{logger[_0x6efe('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xc70024,_0x6efe('0xd'));_0x2cc472(_0x1c383f[_0x6efe('0x13')][_0x6efe('0x12')]);}})[_0x6efe('0x14')](function(_0x2f9c19){logger[_0x6efe('0x11')](_0x6efe('0xc'),_0xc70024,_0x2f9c19);_0x102471(_0x2f9c19);});});} \ No newline at end of file +var _0xd84e=['message','info','request\x20sent','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','stringify','error'];(function(_0x2b1fdc,_0x3bb6da){var _0x41a285=function(_0x210fd0){while(--_0x210fd0){_0x2b1fdc['push'](_0x2b1fdc['shift']());}};_0x41a285(++_0x3bb6da);}(_0xd84e,0x83));var _0xed84=function(_0x3e7d44,_0x5685fd){_0x3e7d44=_0x3e7d44-0x0;var _0x43ab1f=_0xd84e[_0x3e7d44];return _0x43ab1f;};'use strict';var _=require('lodash');var util=require(_0xed84('0x0'));var moment=require('moment');var BPromise=require(_0xed84('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed84('0x2'));var db=require(_0xed84('0x3'))['db'];var utils=require(_0xed84('0x4'));var logger=require(_0xed84('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xed84('0x6'));var client=jayson[_0xed84('0x7')][_0xed84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ff88a,_0x245d05,_0x5f456d){return new BPromise(function(_0x3d6e78,_0x329282){return client[_0xed84('0x9')](_0x1ff88a,_0x5f456d)['then'](function(_0x54a67d){logger['info'](_0xed84('0xa'),_0x245d05,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x245d05,'request\x20sent',JSON[_0xed84('0xb')](_0x54a67d));if(_0x54a67d[_0xed84('0xc')]){if(_0x54a67d['error']['code']===0x1f4){logger['error'](_0xed84('0xa'),_0x245d05,_0x54a67d[_0xed84('0xc')][_0xed84('0xd')]);return _0x329282(_0x54a67d[_0xed84('0xc')][_0xed84('0xd')]);}logger[_0xed84('0xc')](_0xed84('0xa'),_0x245d05,_0x54a67d['error'][_0xed84('0xd')]);return _0x3d6e78(_0x54a67d['error']['message']);}else{logger[_0xed84('0xe')](_0xed84('0xa'),_0x245d05,_0xed84('0xf'));_0x3d6e78(_0x54a67d[_0xed84('0x10')][_0xed84('0xd')]);}})[_0xed84('0x11')](function(_0x34155e){logger[_0xed84('0xc')](_0xed84('0xa'),_0x245d05,_0x34155e);_0x329282(_0x34155e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a49aa23..f6226bc 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 _0x0211=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','preview','/:id/run','/:id/query','isAuthenticated','query','post','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x23a6c3,_0xcbb1d3){var _0x30c897=function(_0x19168b){while(--_0x19168b){_0x23a6c3['push'](_0x23a6c3['shift']());}};_0x30c897(++_0xcbb1d3);}(_0x0211,0x1b6));var _0x1021=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0211[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x1021('0x0'));var path=require(_0x1021('0x1'));var timeout=require(_0x1021('0x2'));var express=require(_0x1021('0x3'));var router=express[_0x1021('0x4')]();var fs_extra=require(_0x1021('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1021('0x6'));var config=require(_0x1021('0x7'));var controller=require(_0x1021('0x8'));router[_0x1021('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1021('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1021('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x1021('0xa')]);router[_0x1021('0x9')](_0x1021('0xb'),auth['isAuthenticated'](),controller['run']);router[_0x1021('0x9')](_0x1021('0xc'),auth[_0x1021('0xd')](),controller[_0x1021('0xe')]);router[_0x1021('0xf')]('/',auth[_0x1021('0xd')](),controller['create']);router['put'](_0x1021('0x10'),auth[_0x1021('0xd')](),controller[_0x1021('0x11')]);router[_0x1021('0x12')](_0x1021('0x10'),auth[_0x1021('0xd')](),controller[_0x1021('0x13')]);module[_0x1021('0x14')]=router; \ No newline at end of file +var _0xad18=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query','post','create','update','delete','destroy'];(function(_0x4502fb,_0x23865f){var _0x1b4664=function(_0x58f705){while(--_0x58f705){_0x4502fb['push'](_0x4502fb['shift']());}};_0x1b4664(++_0x23865f);}(_0xad18,0xfb));var _0x8ad1=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xad18[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x8ad1('0x0'));var util=require(_0x8ad1('0x1'));var path=require(_0x8ad1('0x2'));var timeout=require(_0x8ad1('0x3'));var express=require('express');var router=express[_0x8ad1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8ad1('0x5'));var interaction=require(_0x8ad1('0x6'));var config=require(_0x8ad1('0x7'));var controller=require(_0x8ad1('0x8'));router[_0x8ad1('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ad1('0xa')]);router[_0x8ad1('0x9')](_0x8ad1('0xb'),auth[_0x8ad1('0xc')](),controller[_0x8ad1('0xd')]);router[_0x8ad1('0x9')](_0x8ad1('0xe'),auth['isAuthenticated'](),controller[_0x8ad1('0xf')]);router[_0x8ad1('0x9')](_0x8ad1('0x10'),auth[_0x8ad1('0xc')](),controller[_0x8ad1('0x11')]);router[_0x8ad1('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0x8ad1('0x12')]);router[_0x8ad1('0x13')]('/',auth[_0x8ad1('0xc')](),controller[_0x8ad1('0x14')]);router['put'](_0x8ad1('0xb'),auth[_0x8ad1('0xc')](),controller[_0x8ad1('0x15')]);router[_0x8ad1('0x16')](_0x8ad1('0xb'),auth[_0x8ad1('0xc')](),controller[_0x8ad1('0x17')]);module[_0x8ad1('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 8b58f09..0931d7c 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x339301,_0x4d9089){_0x339301=_0x339301-0x0;var _0x25a96f=_0xb4c7[_0x339301];return _0x25a96f;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x36888f,_0x3b541e){var _0x1f79ea=function(_0x460d8d){while(--_0x460d8d){_0x36888f['push'](_0x36888f['shift']());}};_0x1f79ea(++_0x3b541e);}(_0xabce,0x103));var _0xeabc=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xabce[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e841ae7..ed11253 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 _0x687b=['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','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x2efe4f,_0x35b3d9){_0x2efe4f=_0x2efe4f-0x0;var _0x251e7e=_0x687b[_0x2efe4f];return _0x251e7e;};'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'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x4ff681,_0x30ba0f){var _0x2465d0=function(_0x19e7a5){while(--_0x19e7a5){_0x4ff681['push'](_0x4ff681['shift']());}};_0x2465d0(++_0x30ba0f);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a7d7566..57173e1 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 _0xc6f5=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc6f5,0x197));var _0x5c6f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc6f5[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5c6f('0x0'));var util=require(_0x5c6f('0x1'));var logger=require(_0x5c6f('0x2'))('api');var moment=require(_0x5c6f('0x3'));var BPromise=require(_0x5c6f('0x4'));var rp=require(_0x5c6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c6f('0x6'));var config=require(_0x5c6f('0x7'));var attributes=require(_0x5c6f('0x8'));module[_0x5c6f('0x9')]=function(_0xb1212c,_0x20564b){return _0xb1212c[_0x5c6f('0xa')](_0x5c6f('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc87=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x203c0c,_0x12e4fb){var _0x1a6c4b=function(_0x19b7e8){while(--_0x19b7e8){_0x203c0c['push'](_0x203c0c['shift']());}};_0x1a6c4b(++_0x12e4fb);}(_0xfc87,0x68));var _0x7fc8=function(_0x5d94e7,_0x57a0cc){_0x5d94e7=_0x5d94e7-0x0;var _0x47d432=_0xfc87[_0x5d94e7];return _0x47d432;};'use strict';var _=require(_0x7fc8('0x0'));var util=require(_0x7fc8('0x1'));var logger=require(_0x7fc8('0x2'))(_0x7fc8('0x3'));var moment=require(_0x7fc8('0x4'));var BPromise=require(_0x7fc8('0x5'));var rp=require(_0x7fc8('0x6'));var fs=require('fs');var path=require(_0x7fc8('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7fc8('0x8'));module[_0x7fc8('0x9')]=function(_0x561956,_0x595f6f){return _0x561956[_0x7fc8('0xa')](_0x7fc8('0xb'),attributes,{'tableName':_0x7fc8('0xc'),'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 2183b2c..b288252 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 _0x942a=['debug','request\x20sent','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x445a84,_0x311a44){var _0x5e3a6e=function(_0x326ca3){while(--_0x326ca3){_0x445a84['push'](_0x445a84['shift']());}};_0x5e3a6e(++_0x311a44);}(_0x942a,0x171));var _0xa942=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x942a[_0x151381];return _0x2afab6;};'use strict';var _=require('lodash');var util=require(_0xa942('0x0'));var moment=require('moment');var BPromise=require(_0xa942('0x1'));var rs=require(_0xa942('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa942('0x3'));var logger=require(_0xa942('0x4'))('rpc');var config=require(_0xa942('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa942('0x6')][_0xa942('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dd053,_0x3af71a,_0x99a6df){return new BPromise(function(_0x490d8d,_0x2a367a){return client[_0xa942('0x8')](_0x4dd053,_0x99a6df)[_0xa942('0x9')](function(_0x435806){logger[_0xa942('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3af71a,'request\x20sent');logger[_0xa942('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3af71a,_0xa942('0xc'),JSON[_0xa942('0xd')](_0x435806));if(_0x435806[_0xa942('0xe')]){if(_0x435806[_0xa942('0xe')][_0xa942('0xf')]===0x1f4){logger[_0xa942('0xe')](_0xa942('0x10'),_0x3af71a,_0x435806[_0xa942('0xe')][_0xa942('0x11')]);return _0x2a367a(_0x435806[_0xa942('0xe')][_0xa942('0x11')]);}logger[_0xa942('0xe')](_0xa942('0x10'),_0x3af71a,_0x435806[_0xa942('0xe')][_0xa942('0x11')]);return _0x490d8d(_0x435806['error'][_0xa942('0x11')]);}else{logger[_0xa942('0xa')](_0xa942('0x10'),_0x3af71a,_0xa942('0xc'));_0x490d8d(_0x435806[_0xa942('0x12')][_0xa942('0x11')]);}})[_0xa942('0x13')](function(_0x30771a){logger['error'](_0xa942('0x10'),_0x3af71a,_0x30771a);_0x2a367a(_0x30771a);});});} \ No newline at end of file +var _0x31ce=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31ce,0x117));var _0xe31c=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x31ce[_0x33fcbb];return _0x2efe40;};'use strict';var _=require(_0xe31c('0x0'));var util=require('util');var moment=require(_0xe31c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe31c('0x2'));var db=require(_0xe31c('0x3'))['db'];var utils=require(_0xe31c('0x4'));var logger=require(_0xe31c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe31c('0x6')][_0xe31c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22c081,_0x3c8126,_0x4cf64c){return new BPromise(function(_0x9a93b,_0x4aa9f9){return client[_0xe31c('0x8')](_0x22c081,_0x4cf64c)[_0xe31c('0x9')](function(_0x4f0895){logger[_0xe31c('0xa')](_0xe31c('0xb'),_0x3c8126,'request\x20sent');logger[_0xe31c('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3c8126,_0xe31c('0xd'),JSON[_0xe31c('0xe')](_0x4f0895));if(_0x4f0895[_0xe31c('0xf')]){if(_0x4f0895[_0xe31c('0xf')]['code']===0x1f4){logger[_0xe31c('0xf')](_0xe31c('0xb'),_0x3c8126,_0x4f0895['error'][_0xe31c('0x10')]);return _0x4aa9f9(_0x4f0895['error'][_0xe31c('0x10')]);}logger['error'](_0xe31c('0xb'),_0x3c8126,_0x4f0895[_0xe31c('0xf')]['message']);return _0x9a93b(_0x4f0895['error']['message']);}else{logger[_0xe31c('0xa')](_0xe31c('0xb'),_0x3c8126,_0xe31c('0xd'));_0x9a93b(_0x4f0895[_0xe31c('0x11')][_0xe31c('0x10')]);}})['catch'](function(_0x2e660a){logger[_0xe31c('0xf')](_0xe31c('0xb'),_0x3c8126,_0x2e660a);_0x4aa9f9(_0x2e660a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2eb3f04..e42c433 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 _0x8ffd=['multer','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0x6d205c,_0x305498){var _0x3b5e06=function(_0x112835){while(--_0x112835){_0x6d205c['push'](_0x6d205c['shift']());}};_0x3b5e06(++_0x305498);}(_0x8ffd,0x18c));var _0xd8ff=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x8ffd[_0x34d275];return _0x1379cc;};'use strict';var multer=require(_0xd8ff('0x0'));var util=require('util');var path=require(_0xd8ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8ff('0x2'));var router=express[_0xd8ff('0x3')]();var fs_extra=require(_0xd8ff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8ff('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xd8ff('0x6')]('/',auth[_0xd8ff('0x7')](),controller['index']);router[_0xd8ff('0x6')](_0xd8ff('0x8'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x9')]);router[_0xd8ff('0x6')](_0xd8ff('0xa'),auth[_0xd8ff('0x7')](),controller['preview']);router[_0xd8ff('0x6')](_0xd8ff('0xb'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0xc')]);router[_0xd8ff('0x6')](_0xd8ff('0xd'),auth['isAuthenticated'](),controller[_0xd8ff('0xe')]);router[_0xd8ff('0xf')]('/',auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x10')]);router[_0xd8ff('0x11')](_0xd8ff('0x8'),auth[_0xd8ff('0x7')](),controller[_0xd8ff('0x12')]);router[_0xd8ff('0x13')](_0xd8ff('0x8'),auth['isAuthenticated'](),controller[_0xd8ff('0x14')]);module[_0xd8ff('0x15')]=router; \ No newline at end of file +var _0x26e9=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','run','/:id/query','post','create','put','update','delete'];(function(_0x11831c,_0x226c32){var _0x317d0e=function(_0x16ef92){while(--_0x16ef92){_0x11831c['push'](_0x11831c['shift']());}};_0x317d0e(++_0x226c32);}(_0x26e9,0x1a2));var _0x926e=function(_0xfc5a04,_0xb77332){_0xfc5a04=_0xfc5a04-0x0;var _0x24b690=_0x26e9[_0xfc5a04];return _0x24b690;};'use strict';var multer=require('multer');var util=require(_0x926e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x926e('0x1'));var router=express[_0x926e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x926e('0x3'));var interaction=require(_0x926e('0x4'));var config=require(_0x926e('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x926e('0x6')]('/',auth[_0x926e('0x7')](),controller[_0x926e('0x8')]);router[_0x926e('0x6')](_0x926e('0x9'),auth[_0x926e('0x7')](),controller[_0x926e('0xa')]);router[_0x926e('0x6')]('/:id/preview',auth['isAuthenticated'](),controller[_0x926e('0xb')]);router['get']('/:id/run',auth[_0x926e('0x7')](),controller[_0x926e('0xc')]);router['get'](_0x926e('0xd'),auth['isAuthenticated'](),controller['query']);router[_0x926e('0xe')]('/',auth[_0x926e('0x7')](),controller[_0x926e('0xf')]);router[_0x926e('0x10')](_0x926e('0x9'),auth[_0x926e('0x7')](),controller[_0x926e('0x11')]);router[_0x926e('0x12')](_0x926e('0x9'),auth[_0x926e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c6e3b42..fa4f1eb 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 _0xecd9=['csv','pdf','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','moment','STRING','ENUM'];(function(_0x2d4c1b,_0x1e282c){var _0x2039c5=function(_0x3c40db){while(--_0x3c40db){_0x2d4c1b['push'](_0x2d4c1b['shift']());}};_0x2039c5(++_0x1e282c);}(_0xecd9,0x19e));var _0x9ecd=function(_0x42d560,_0x195f36){_0x42d560=_0x42d560-0x0;var _0x3d236e=_0xecd9[_0x42d560];return _0x3d236e;};'use strict';var Sequelize=require(_0x9ecd('0x0'));var moment=require(_0x9ecd('0x1'));module['exports']={'name':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9ecd('0x3')](_0x9ecd('0x4'),_0x9ecd('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x9ecd('0x4')},'savename':{'type':Sequelize[_0x9ecd('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x9ecd('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x9ecd('0x2')],'defaultValue':_0x9ecd('0x7')},'type':{'type':Sequelize['ENUM']('manual',_0x9ecd('0x8')),'allowNull':![],'defaultValue':_0x9ecd('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x9ecd('0xa')]},'reportType':{'type':Sequelize[_0x9ecd('0x2')]}}; \ No newline at end of file +var _0x04d5=['STRING','ENUM','csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports'];(function(_0x5abb0d,_0xb39231){var _0x30db9d=function(_0x40bf01){while(--_0x40bf01){_0x5abb0d['push'](_0x5abb0d['shift']());}};_0x30db9d(++_0xb39231);}(_0x04d5,0x1dd));var _0x504d=function(_0x41d419,_0x30fe84){_0x41d419=_0x41d419-0x0;var _0x233a5e=_0x04d5[_0x41d419];return _0x233a5e;};'use strict';var Sequelize=require(_0x504d('0x0'));var moment=require(_0x504d('0x1'));module[_0x504d('0x2')]={'name':{'type':Sequelize[_0x504d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x504d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x504d('0x4')](_0x504d('0x5'),_0x504d('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x504d('0x7')]},'endDate':{'type':Sequelize[_0x504d('0x7')]},'status':{'type':Sequelize[_0x504d('0x3')],'defaultValue':_0x504d('0x8')},'type':{'type':Sequelize[_0x504d('0x4')](_0x504d('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x504d('0xa')](0xb)[_0x504d('0xb')]},'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 58c800b..d92362a 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 _0x84a4=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','VIRTUAL','filter','merge','AnalyticExtractedReport','rows','catch','show','rawAttributes','includeAll','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','body','params','basename','savename','output','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','server/files/reports','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch'];(function(_0x43a954,_0x1d73d7){var _0x1973f6=function(_0x3de96c){while(--_0x3de96c){_0x43a954['push'](_0x43a954['shift']());}};_0x1973f6(++_0x1d73d7);}(_0x84a4,0xab));var _0x484a=function(_0x3411a4,_0x60d585){_0x3411a4=_0x3411a4-0x0;var _0x4eb325=_0x84a4[_0x3411a4];return _0x4eb325;};'use strict';var emlformat=require(_0x484a('0x0'));var rimraf=require(_0x484a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x484a('0x2'));var rp=require(_0x484a('0x3'));var moment=require(_0x484a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x484a('0x5'));var util=require(_0x484a('0x6'));var path=require(_0x484a('0x7'));var sox=require('sox');var csv=require(_0x484a('0x8'));var ejs=require(_0x484a('0x9'));var fs=require('fs');var fs_extra=require(_0x484a('0xa'));var _=require(_0x484a('0xb'));var squel=require(_0x484a('0xc'));var crypto=require(_0x484a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x484a('0xe'));var Papa=require(_0x484a('0xf'));var Redis=require('ioredis');var authService=require(_0x484a('0x10'));var qs=require(_0x484a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x484a('0x12'))('api');var utils=require(_0x484a('0x13'));var config=require(_0x484a('0x14'));var licenseUtil=require(_0x484a('0x15'));var db=require(_0x484a('0x16'))['db'];function respondWithStatusCode(_0x45adb7,_0x108f33){_0x108f33=_0x108f33||0xcc;return function(_0x162e93){if(_0x162e93){return _0x45adb7['sendStatus'](_0x108f33);}return _0x45adb7[_0x484a('0x17')](_0x108f33)['end']();};}function respondWithResult(_0x412718,_0x4ce308){_0x4ce308=_0x4ce308||0xc8;return function(_0x1bee5e){if(_0x1bee5e){return _0x412718[_0x484a('0x17')](_0x4ce308)['json'](_0x1bee5e);}};}function respondWithFilteredResult(_0xb40d8c,_0x298c16){return function(_0x41dbf9){if(_0x41dbf9){var _0x2fc281=typeof _0x298c16[_0x484a('0x18')]===_0x484a('0x19')&&typeof _0x298c16['limit']===_0x484a('0x19');var _0x361783=_0x41dbf9['count'];var _0x1e07a5=_0x2fc281?0x0:_0x298c16['offset'];var _0x3886da=_0x2fc281?_0x41dbf9[_0x484a('0x1a')]:_0x298c16[_0x484a('0x18')]+_0x298c16['limit'];var _0x4fbc5f;if(_0x3886da>=_0x361783){_0x3886da=_0x361783;_0x4fbc5f=0xc8;}else{_0x4fbc5f=0xce;}_0xb40d8c[_0x484a('0x17')](_0x4fbc5f);return _0xb40d8c[_0x484a('0x1b')](_0x484a('0x1c'),_0x1e07a5+'-'+_0x3886da+'/'+_0x361783)[_0x484a('0x1d')](_0x41dbf9);}return null;};}function patchUpdates(_0x675651){return function(_0x54c4f2){try{jsonpatch[_0x484a('0x1e')](_0x54c4f2,_0x675651,!![]);}catch(_0x438268){return BPromise[_0x484a('0x1f')](_0x438268);}return _0x54c4f2[_0x484a('0x20')]();};}function saveUpdates(_0x71fd0e,_0x249187){return function(_0x116fe5){if(_0x116fe5){return _0x116fe5[_0x484a('0x21')](_0x71fd0e)[_0x484a('0x22')](function(_0x4beede){return _0x4beede;});}return null;};}function removeEntity(_0x25fbfc,_0x11a042){return function(_0x22237f){if(_0x22237f){return _0x22237f[_0x484a('0x23')]()[_0x484a('0x22')](function(){var _0x2e65cf=_0x22237f[_0x484a('0x24')]({'plain':!![]});var _0x2a0809='ExtractedReports';return db[_0x484a('0x25')]['destroy']({'where':{'type':_0x2a0809,'resourceId':_0x2e65cf['id']}})['then'](function(){return _0x22237f;});})[_0x484a('0x22')](function(){_0x25fbfc[_0x484a('0x17')](0xcc)[_0x484a('0x26')]();});}};}function handleEntityNotFound(_0x9d67ec,_0x2751c1){return function(_0x397830){if(!_0x397830){_0x9d67ec['sendStatus'](0x194);}return _0x397830;};}function handleError(_0x129bdc,_0x2aa596){_0x2aa596=_0x2aa596||0x1f4;return function(_0x1f86cc){logger[_0x484a('0x27')](_0x1f86cc['stack']);if(_0x1f86cc['name']){delete _0x1f86cc[_0x484a('0x28')];}_0x129bdc[_0x484a('0x17')](_0x2aa596)[_0x484a('0x29')](_0x1f86cc);};}exports['index']=function(_0x186264,_0x694567){var _0x3e3350={},_0x288093={},_0x136560={'count':0x0,'rows':[]};var _0xaebc60=_[_0x484a('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x8f3c4d){return{'name':_0x8f3c4d['fieldName'],'type':_0x8f3c4d[_0x484a('0x2b')]['key']};});_0x288093['model']=_[_0x484a('0x2a')](_0xaebc60,_0x484a('0x28'));_0x288093['query']=_[_0x484a('0x2c')](_0x186264[_0x484a('0x2d')]);_0x288093[_0x484a('0x2e')]=_[_0x484a('0x2f')](_0x288093[_0x484a('0x30')],_0x288093[_0x484a('0x2d')]);_0x3e3350['attributes']=_[_0x484a('0x2f')](_0x288093[_0x484a('0x30')],qs['fields'](_0x186264['query'][_0x484a('0x31')]));_0x3e3350[_0x484a('0x32')]=_0x3e3350[_0x484a('0x32')][_0x484a('0x33')]?_0x3e3350[_0x484a('0x32')]:_0x288093['model'];if(!_0x186264[_0x484a('0x2d')][_0x484a('0x34')](_0x484a('0x35'))){_0x3e3350[_0x484a('0x36')]=qs['limit'](_0x186264[_0x484a('0x2d')]['limit']);_0x3e3350[_0x484a('0x18')]=qs[_0x484a('0x18')](_0x186264[_0x484a('0x2d')][_0x484a('0x18')]);}_0x3e3350['order']=qs[_0x484a('0x37')](_0x186264[_0x484a('0x2d')]['sort']);_0x3e3350[_0x484a('0x38')]=qs['filters'](_['pick'](_0x186264[_0x484a('0x2d')],_0x288093[_0x484a('0x2e')]),_0xaebc60);if(_0x186264[_0x484a('0x2d')]['filter']){_0x3e3350[_0x484a('0x38')]=_['merge'](_0x3e3350[_0x484a('0x38')],{'$or':_[_0x484a('0x2a')](_0xaebc60,function(_0x3ff0c0){if(_0x3ff0c0[_0x484a('0x2b')]!==_0x484a('0x39')){var _0x5e6b4f={};_0x5e6b4f[_0x3ff0c0[_0x484a('0x28')]]={'$like':'%'+_0x186264[_0x484a('0x2d')][_0x484a('0x3a')]+'%'};return _0x5e6b4f;}})});}_0x3e3350=_[_0x484a('0x3b')]({},_0x3e3350,_0x186264['options']);var _0x2a8c68={'where':_0x3e3350['where']};return db[_0x484a('0x3c')][_0x484a('0x1a')](_0x2a8c68)['then'](function(_0x3a05f1){_0x136560[_0x484a('0x1a')]=_0x3a05f1;if(_0x186264[_0x484a('0x2d')]['includeAll']){_0x3e3350['include']=[{'all':!![]}];}return db[_0x484a('0x3c')]['findAll'](_0x3e3350);})[_0x484a('0x22')](function(_0x219bff){_0x136560[_0x484a('0x3d')]=_0x219bff;return _0x136560;})[_0x484a('0x22')](respondWithFilteredResult(_0x694567,_0x3e3350))[_0x484a('0x3e')](handleError(_0x694567,null));};exports[_0x484a('0x3f')]=function(_0x6fe4a,_0x5c1ffa){var _0x526400={'raw':!![],'where':{'id':_0x6fe4a['params']['id']}},_0x660453={};_0x660453[_0x484a('0x30')]=_[_0x484a('0x2c')](db[_0x484a('0x3c')][_0x484a('0x40')]);_0x660453['query']=_[_0x484a('0x2c')](_0x6fe4a[_0x484a('0x2d')]);_0x660453[_0x484a('0x2e')]=_[_0x484a('0x2f')](_0x660453[_0x484a('0x30')],_0x660453[_0x484a('0x2d')]);_0x526400['attributes']=_[_0x484a('0x2f')](_0x660453[_0x484a('0x30')],qs[_0x484a('0x31')](_0x6fe4a[_0x484a('0x2d')]['fields']));_0x526400[_0x484a('0x32')]=_0x526400[_0x484a('0x32')]['length']?_0x526400[_0x484a('0x32')]:_0x660453[_0x484a('0x30')];if(_0x6fe4a[_0x484a('0x2d')][_0x484a('0x41')]){_0x526400[_0x484a('0x42')]=[{'all':!![]}];}_0x526400=_[_0x484a('0x3b')]({},_0x526400,_0x6fe4a[_0x484a('0x43')]);return db[_0x484a('0x3c')][_0x484a('0x44')](_0x526400)[_0x484a('0x22')](handleEntityNotFound(_0x5c1ffa,null))['then'](respondWithResult(_0x5c1ffa,null))[_0x484a('0x3e')](handleError(_0x5c1ffa,null));};exports[_0x484a('0x45')]=function(_0x5b4f2c,_0xe03d74){return db[_0x484a('0x3c')]['create'](_0x5b4f2c['body'],{})[_0x484a('0x22')](function(_0x28d0b0){var _0x363d3d=_0x5b4f2c['user']['get']({'plain':!![]});if(!_0x363d3d)throw new Error(_0x484a('0x46'));if(_0x363d3d[_0x484a('0x47')]===_0x484a('0x48')){var _0x2ad4a5=_0x28d0b0[_0x484a('0x24')]({'plain':!![]});var _0x149c73=_0x484a('0x49');return db[_0x484a('0x4a')][_0x484a('0x44')]({'where':{'name':_0x149c73,'userProfileId':_0x363d3d['userProfileId']},'raw':!![]})[_0x484a('0x22')](function(_0x4b5603){if(_0x4b5603&&_0x4b5603['autoAssociation']===0x0){return db['UserProfileResource'][_0x484a('0x45')]({'name':_0x2ad4a5['name'],'resourceId':_0x2ad4a5['id'],'type':_0x4b5603[_0x484a('0x28')],'sectionId':_0x4b5603['id']},{})[_0x484a('0x22')](function(){return _0x28d0b0;});}else{return _0x28d0b0;}})['catch'](function(_0x22239b){logger[_0x484a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22239b);throw _0x22239b;});}return _0x28d0b0;})[_0x484a('0x22')](respondWithResult(_0xe03d74,0xc9))[_0x484a('0x3e')](handleError(_0xe03d74,null));};exports[_0x484a('0x21')]=function(_0x4f8f8d,_0x36203c){if(_0x4f8f8d[_0x484a('0x4b')]['id']){delete _0x4f8f8d[_0x484a('0x4b')]['id'];}return db[_0x484a('0x3c')][_0x484a('0x44')]({'where':{'id':_0x4f8f8d[_0x484a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36203c,null))['then'](saveUpdates(_0x4f8f8d[_0x484a('0x4b')],null))[_0x484a('0x22')](respondWithResult(_0x36203c,null))[_0x484a('0x3e')](handleError(_0x36203c,null));};exports[_0x484a('0x23')]=function(_0x106aae,_0x386e67){return db[_0x484a('0x3c')][_0x484a('0x44')]({'where':{'id':_0x106aae[_0x484a('0x4c')]['id']}})[_0x484a('0x22')](handleEntityNotFound(_0x386e67,null))[_0x484a('0x22')](removeEntity(_0x386e67,null))[_0x484a('0x3e')](handleError(_0x386e67,null));};exports['download']=function(_0x52058e,_0x3a997a,_0x280433){return db['AnalyticExtractedReport'][_0x484a('0x44')]({'where':{'id':_0x52058e['params']['id']},'attributes':[_0x484a('0x28'),_0x484a('0x4d'),_0x484a('0x4e'),_0x484a('0x4f')],'raw':!![]})[_0x484a('0x22')](handleEntityNotFound(_0x3a997a,null))['then'](function(_0x32be83){if(_0x32be83){if(!fs['existsSync'](path['join'](config['root'],'server/files/reports',_0x32be83['savename']))){throw new db[(_0x484a('0x50'))]['ValidationError'](_0x484a('0x51'));}if(_0x52058e['query'][_0x484a('0x52')]){return _0x3a997a[_0x484a('0x53')](0xc8);}return _0x3a997a['download'](path['join'](config['root'],_0x484a('0x54'),_0x32be83[_0x484a('0x4e')]),util['format'](_0x484a('0x55'),_0x32be83[_0x484a('0x4d')]||_0x32be83[_0x484a('0x28')],_0x32be83[_0x484a('0x4f')][_0x484a('0x56')]()));}})[_0x484a('0x3e')](handleError(_0x3a997a,null));}; \ No newline at end of file +var _0xe6df=['include','findAll','rows','catch','show','params','rawAttributes','keys','fields','includeAll','find','create','body','role','user','userProfileId','autoAssociation','savename','output','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','type','options'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe6df,0x13f));var _0xfe6d=function(_0x284e3e,_0x35157e){_0x284e3e=_0x284e3e-0x0;var _0x274860=_0xe6df[_0x284e3e];return _0x274860;};'use strict';var emlformat=require(_0xfe6d('0x0'));var rimraf=require(_0xfe6d('0x1'));var zipdir=require(_0xfe6d('0x2'));var jsonpatch=require(_0xfe6d('0x3'));var rp=require(_0xfe6d('0x4'));var moment=require(_0xfe6d('0x5'));var BPromise=require(_0xfe6d('0x6'));var Mustache=require(_0xfe6d('0x7'));var util=require(_0xfe6d('0x8'));var path=require(_0xfe6d('0x9'));var sox=require(_0xfe6d('0xa'));var csv=require('to-csv');var ejs=require(_0xfe6d('0xb'));var fs=require('fs');var fs_extra=require(_0xfe6d('0xc'));var _=require(_0xfe6d('0xd'));var squel=require(_0xfe6d('0xe'));var crypto=require(_0xfe6d('0xf'));var jsforce=require(_0xfe6d('0x10'));var deskjs=require(_0xfe6d('0x11'));var toCsv=require(_0xfe6d('0x12'));var querystring=require(_0xfe6d('0x13'));var Papa=require(_0xfe6d('0x14'));var Redis=require(_0xfe6d('0x15'));var authService=require(_0xfe6d('0x16'));var qs=require(_0xfe6d('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe6d('0x18'));var logger=require(_0xfe6d('0x19'))(_0xfe6d('0x1a'));var utils=require(_0xfe6d('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xfe6d('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef48d,_0x2b4f7d){_0x2b4f7d=_0x2b4f7d||0xcc;return function(_0x3f248b){if(_0x3f248b){return _0x2ef48d['sendStatus'](_0x2b4f7d);}return _0x2ef48d[_0xfe6d('0x1d')](_0x2b4f7d)['end']();};}function respondWithResult(_0x40291a,_0x495657){_0x495657=_0x495657||0xc8;return function(_0x37a41f){if(_0x37a41f){return _0x40291a[_0xfe6d('0x1d')](_0x495657)[_0xfe6d('0x1e')](_0x37a41f);}};}function respondWithFilteredResult(_0x19ca42,_0x18f3b0){return function(_0x54ffd1){if(_0x54ffd1){var _0x1dbf4b=typeof _0x18f3b0[_0xfe6d('0x1f')]==='undefined'&&typeof _0x18f3b0[_0xfe6d('0x20')]===_0xfe6d('0x21');var _0x4f598d=_0x54ffd1['count'];var _0x579d2c=_0x1dbf4b?0x0:_0x18f3b0[_0xfe6d('0x1f')];var _0x3727cf=_0x1dbf4b?_0x54ffd1[_0xfe6d('0x22')]:_0x18f3b0[_0xfe6d('0x1f')]+_0x18f3b0[_0xfe6d('0x20')];var _0x4ae8e4;if(_0x3727cf>=_0x4f598d){_0x3727cf=_0x4f598d;_0x4ae8e4=0xc8;}else{_0x4ae8e4=0xce;}_0x19ca42[_0xfe6d('0x1d')](_0x4ae8e4);return _0x19ca42['set'](_0xfe6d('0x23'),_0x579d2c+'-'+_0x3727cf+'/'+_0x4f598d)[_0xfe6d('0x1e')](_0x54ffd1);}return null;};}function patchUpdates(_0x21a3f0){return function(_0x4da6b8){try{jsonpatch[_0xfe6d('0x24')](_0x4da6b8,_0x21a3f0,!![]);}catch(_0x4c23e2){return BPromise[_0xfe6d('0x25')](_0x4c23e2);}return _0x4da6b8[_0xfe6d('0x26')]();};}function saveUpdates(_0x296619,_0x540f9e){return function(_0x514c96){if(_0x514c96){return _0x514c96['update'](_0x296619)[_0xfe6d('0x27')](function(_0x3c9bc6){return _0x3c9bc6;});}return null;};}function removeEntity(_0x74cfc9,_0x3079a9){return function(_0x5622bd){if(_0x5622bd){return _0x5622bd[_0xfe6d('0x28')]()['then'](function(){var _0x4815a5=_0x5622bd[_0xfe6d('0x29')]({'plain':!![]});var _0x4e97ac=_0xfe6d('0x2a');return db[_0xfe6d('0x2b')][_0xfe6d('0x28')]({'where':{'type':_0x4e97ac,'resourceId':_0x4815a5['id']}})[_0xfe6d('0x27')](function(){return _0x5622bd;});})[_0xfe6d('0x27')](function(){_0x74cfc9['status'](0xcc)[_0xfe6d('0x2c')]();});}};}function handleEntityNotFound(_0x5b948b,_0x2b6e6f){return function(_0x4cd19a){if(!_0x4cd19a){_0x5b948b[_0xfe6d('0x2d')](0x194);}return _0x4cd19a;};}function handleError(_0xbe599f,_0x4dfef5){_0x4dfef5=_0x4dfef5||0x1f4;return function(_0x324533){logger[_0xfe6d('0x2e')](_0x324533[_0xfe6d('0x2f')]);if(_0x324533[_0xfe6d('0x30')]){delete _0x324533[_0xfe6d('0x30')];}_0xbe599f[_0xfe6d('0x1d')](_0x4dfef5)[_0xfe6d('0x31')](_0x324533);};}exports[_0xfe6d('0x32')]=function(_0x53141d,_0x177c1d){var _0x5839c9={},_0x248e41={},_0x294a41={'count':0x0,'rows':[]};var _0x1ef7f2=_[_0xfe6d('0x33')](db[_0xfe6d('0x34')]['rawAttributes'],function(_0x38011b){return{'name':_0x38011b[_0xfe6d('0x35')],'type':_0x38011b['type'][_0xfe6d('0x36')]};});_0x248e41[_0xfe6d('0x37')]=_[_0xfe6d('0x33')](_0x1ef7f2,_0xfe6d('0x30'));_0x248e41[_0xfe6d('0x38')]=_['keys'](_0x53141d[_0xfe6d('0x38')]);_0x248e41[_0xfe6d('0x39')]=_[_0xfe6d('0x3a')](_0x248e41[_0xfe6d('0x37')],_0x248e41[_0xfe6d('0x38')]);_0x5839c9[_0xfe6d('0x3b')]=_[_0xfe6d('0x3a')](_0x248e41[_0xfe6d('0x37')],qs['fields'](_0x53141d[_0xfe6d('0x38')]['fields']));_0x5839c9[_0xfe6d('0x3b')]=_0x5839c9[_0xfe6d('0x3b')][_0xfe6d('0x3c')]?_0x5839c9[_0xfe6d('0x3b')]:_0x248e41[_0xfe6d('0x37')];if(!_0x53141d[_0xfe6d('0x38')][_0xfe6d('0x3d')]('nolimit')){_0x5839c9[_0xfe6d('0x20')]=qs[_0xfe6d('0x20')](_0x53141d['query']['limit']);_0x5839c9[_0xfe6d('0x1f')]=qs[_0xfe6d('0x1f')](_0x53141d[_0xfe6d('0x38')][_0xfe6d('0x1f')]);}_0x5839c9['order']=qs[_0xfe6d('0x3e')](_0x53141d[_0xfe6d('0x38')][_0xfe6d('0x3e')]);_0x5839c9['where']=qs[_0xfe6d('0x39')](_[_0xfe6d('0x3f')](_0x53141d[_0xfe6d('0x38')],_0x248e41[_0xfe6d('0x39')]),_0x1ef7f2);if(_0x53141d[_0xfe6d('0x38')][_0xfe6d('0x40')]){_0x5839c9[_0xfe6d('0x41')]=_[_0xfe6d('0x42')](_0x5839c9['where'],{'$or':_['map'](_0x1ef7f2,function(_0x4ac3eb){if(_0x4ac3eb[_0xfe6d('0x43')]!=='VIRTUAL'){var _0x580ec2={};_0x580ec2[_0x4ac3eb[_0xfe6d('0x30')]]={'$like':'%'+_0x53141d[_0xfe6d('0x38')][_0xfe6d('0x40')]+'%'};return _0x580ec2;}})});}_0x5839c9=_[_0xfe6d('0x42')]({},_0x5839c9,_0x53141d[_0xfe6d('0x44')]);var _0x53333e={'where':_0x5839c9[_0xfe6d('0x41')]};return db[_0xfe6d('0x34')][_0xfe6d('0x22')](_0x53333e)[_0xfe6d('0x27')](function(_0x2350e8){_0x294a41[_0xfe6d('0x22')]=_0x2350e8;if(_0x53141d['query']['includeAll']){_0x5839c9[_0xfe6d('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xfe6d('0x46')](_0x5839c9);})[_0xfe6d('0x27')](function(_0xc1b3f){_0x294a41[_0xfe6d('0x47')]=_0xc1b3f;return _0x294a41;})['then'](respondWithFilteredResult(_0x177c1d,_0x5839c9))[_0xfe6d('0x48')](handleError(_0x177c1d,null));};exports[_0xfe6d('0x49')]=function(_0x299758,_0x48442f){var _0x349f7d={'raw':!![],'where':{'id':_0x299758[_0xfe6d('0x4a')]['id']}},_0x35d209={};_0x35d209[_0xfe6d('0x37')]=_['keys'](db[_0xfe6d('0x34')][_0xfe6d('0x4b')]);_0x35d209[_0xfe6d('0x38')]=_[_0xfe6d('0x4c')](_0x299758[_0xfe6d('0x38')]);_0x35d209[_0xfe6d('0x39')]=_[_0xfe6d('0x3a')](_0x35d209[_0xfe6d('0x37')],_0x35d209[_0xfe6d('0x38')]);_0x349f7d[_0xfe6d('0x3b')]=_[_0xfe6d('0x3a')](_0x35d209[_0xfe6d('0x37')],qs['fields'](_0x299758[_0xfe6d('0x38')][_0xfe6d('0x4d')]));_0x349f7d[_0xfe6d('0x3b')]=_0x349f7d['attributes'][_0xfe6d('0x3c')]?_0x349f7d[_0xfe6d('0x3b')]:_0x35d209[_0xfe6d('0x37')];if(_0x299758['query'][_0xfe6d('0x4e')]){_0x349f7d[_0xfe6d('0x45')]=[{'all':!![]}];}_0x349f7d=_[_0xfe6d('0x42')]({},_0x349f7d,_0x299758[_0xfe6d('0x44')]);return db[_0xfe6d('0x34')][_0xfe6d('0x4f')](_0x349f7d)['then'](handleEntityNotFound(_0x48442f,null))[_0xfe6d('0x27')](respondWithResult(_0x48442f,null))[_0xfe6d('0x48')](handleError(_0x48442f,null));};exports['create']=function(_0x1d830d,_0x4df72e){return db[_0xfe6d('0x34')][_0xfe6d('0x50')](_0x1d830d[_0xfe6d('0x51')],{})[_0xfe6d('0x27')](function(_0x57d29d){var _0x2c864b=_0x1d830d['user'][_0xfe6d('0x29')]({'plain':!![]});if(!_0x2c864b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c864b[_0xfe6d('0x52')]===_0xfe6d('0x53')){var _0x4d645f=_0x57d29d[_0xfe6d('0x29')]({'plain':!![]});var _0xad2ff1=_0xfe6d('0x2a');return db['UserProfileSection'][_0xfe6d('0x4f')]({'where':{'name':_0xad2ff1,'userProfileId':_0x2c864b[_0xfe6d('0x54')]},'raw':!![]})[_0xfe6d('0x27')](function(_0x5ef8e6){if(_0x5ef8e6&&_0x5ef8e6[_0xfe6d('0x55')]===0x0){return db[_0xfe6d('0x2b')][_0xfe6d('0x50')]({'name':_0x4d645f[_0xfe6d('0x30')],'resourceId':_0x4d645f['id'],'type':_0x5ef8e6[_0xfe6d('0x30')],'sectionId':_0x5ef8e6['id']},{})[_0xfe6d('0x27')](function(){return _0x57d29d;});}else{return _0x57d29d;}})[_0xfe6d('0x48')](function(_0x5602f4){logger[_0xfe6d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5602f4);throw _0x5602f4;});}return _0x57d29d;})['then'](respondWithResult(_0x4df72e,0xc9))[_0xfe6d('0x48')](handleError(_0x4df72e,null));};exports['update']=function(_0x5180cf,_0x31ae0f){if(_0x5180cf[_0xfe6d('0x51')]['id']){delete _0x5180cf[_0xfe6d('0x51')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5180cf[_0xfe6d('0x4a')]['id']}})[_0xfe6d('0x27')](handleEntityNotFound(_0x31ae0f,null))[_0xfe6d('0x27')](saveUpdates(_0x5180cf[_0xfe6d('0x51')],null))[_0xfe6d('0x27')](respondWithResult(_0x31ae0f,null))[_0xfe6d('0x48')](handleError(_0x31ae0f,null));};exports['destroy']=function(_0x591088,_0x2242f7){return db[_0xfe6d('0x34')][_0xfe6d('0x4f')]({'where':{'id':_0x591088[_0xfe6d('0x4a')]['id']}})[_0xfe6d('0x27')](handleEntityNotFound(_0x2242f7,null))[_0xfe6d('0x27')](removeEntity(_0x2242f7,null))[_0xfe6d('0x48')](handleError(_0x2242f7,null));};exports['download']=function(_0x5b5e97,_0x2fa0f8,_0x195023){return db[_0xfe6d('0x34')][_0xfe6d('0x4f')]({'where':{'id':_0x5b5e97[_0xfe6d('0x4a')]['id']},'attributes':['name','basename',_0xfe6d('0x56'),_0xfe6d('0x57')],'raw':!![]})[_0xfe6d('0x27')](handleEntityNotFound(_0x2fa0f8,null))[_0xfe6d('0x27')](function(_0x4d1cef){if(_0x4d1cef){if(!fs['existsSync'](path[_0xfe6d('0x58')](config[_0xfe6d('0x59')],_0xfe6d('0x5a'),_0x4d1cef[_0xfe6d('0x56')]))){throw new db['Sequelize']['ValidationError'](_0xfe6d('0x5b'));}if(_0x5b5e97['query'][_0xfe6d('0x5c')]){return _0x2fa0f8['sendStatus'](0xc8);}return _0x2fa0f8[_0xfe6d('0x5d')](path[_0xfe6d('0x58')](config[_0xfe6d('0x59')],_0xfe6d('0x5a'),_0x4d1cef[_0xfe6d('0x56')]),util[_0xfe6d('0x5e')](_0xfe6d('0x5f'),_0x4d1cef[_0xfe6d('0x60')]||_0x4d1cef['name'],_0x4d1cef[_0xfe6d('0x57')]['toLowerCase']()));}})[_0xfe6d('0x48')](handleError(_0x2fa0f8,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e403640..8a371b9 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 _0xa97c=['./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xba9946,_0x3e270b){var _0x55b343=function(_0x3309da){while(--_0x3309da){_0xba9946['push'](_0xba9946['shift']());}};_0x55b343(++_0x3e270b);}(_0xa97c,0x1d8));var _0xca97=function(_0x27eff2,_0x1fbaf0){_0x27eff2=_0x27eff2-0x0;var _0x352a1f=_0xa97c[_0x27eff2];return _0x352a1f;};'use strict';var _=require(_0xca97('0x0'));var util=require('util');var logger=require(_0xca97('0x1'))(_0xca97('0x2'));var moment=require('moment');var BPromise=require(_0xca97('0x3'));var rp=require(_0xca97('0x4'));var fs=require('fs');var path=require(_0xca97('0x5'));var rimraf=require(_0xca97('0x6'));var config=require(_0xca97('0x7'));var attributes=require(_0xca97('0x8'));module[_0xca97('0x9')]=function(_0x37e7d2,_0xa41039){return _0x37e7d2[_0xca97('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xca97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2fc=['lodash','util','api','bluebird','request-promise','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xb2fc,0x15f));var _0xcb2f=function(_0xf1c89c,_0x12a9dd){_0xf1c89c=_0xf1c89c-0x0;var _0x2099b8=_0xb2fc[_0xf1c89c];return _0x2099b8;};'use strict';var _=require(_0xcb2f('0x0'));var util=require(_0xcb2f('0x1'));var logger=require('../../config/logger')(_0xcb2f('0x2'));var moment=require('moment');var BPromise=require(_0xcb2f('0x3'));var rp=require(_0xcb2f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb2f('0x5'));var attributes=require(_0xcb2f('0x6'));module['exports']=function(_0x5cfcc7,_0x572889){return _0x5cfcc7[_0xcb2f('0x7')]('AnalyticExtractedReport',attributes,{'tableName':_0xcb2f('0x8'),'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 2c974dd..6bfffff 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 _0x6d40=['rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x375362,_0x21b72a){var _0x14ceac=function(_0x31bc4d){while(--_0x31bc4d){_0x375362['push'](_0x375362['shift']());}};_0x14ceac(++_0x21b72a);}(_0x6d40,0x1ec));var _0x06d4=function(_0x177600,_0x307b54){_0x177600=_0x177600-0x0;var _0xb6282f=_0x6d40[_0x177600];return _0xb6282f;};'use strict';var _=require(_0x06d4('0x0'));var util=require(_0x06d4('0x1'));var moment=require('moment');var BPromise=require(_0x06d4('0x2'));var rs=require(_0x06d4('0x3'));var fs=require('fs');var Redis=require(_0x06d4('0x4'));var db=require(_0x06d4('0x5'))['db'];var utils=require(_0x06d4('0x6'));var logger=require(_0x06d4('0x7'))(_0x06d4('0x8'));var config=require(_0x06d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x06d4('0xa')][_0x06d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f174,_0x208e2d,_0x35275f){return new BPromise(function(_0x4b5868,_0x1d6f8e){return client[_0x06d4('0xc')](_0x36f174,_0x35275f)[_0x06d4('0xd')](function(_0x3ca834){logger[_0x06d4('0xe')](_0x06d4('0xf'),_0x208e2d,_0x06d4('0x10'));logger[_0x06d4('0x11')](_0x06d4('0x12'),_0x208e2d,_0x06d4('0x10'),JSON[_0x06d4('0x13')](_0x3ca834));if(_0x3ca834[_0x06d4('0x14')]){if(_0x3ca834[_0x06d4('0x14')][_0x06d4('0x15')]===0x1f4){logger[_0x06d4('0x14')](_0x06d4('0xf'),_0x208e2d,_0x3ca834[_0x06d4('0x14')][_0x06d4('0x16')]);return _0x1d6f8e(_0x3ca834[_0x06d4('0x14')]['message']);}logger['error'](_0x06d4('0xf'),_0x208e2d,_0x3ca834['error'][_0x06d4('0x16')]);return _0x4b5868(_0x3ca834[_0x06d4('0x14')][_0x06d4('0x16')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x208e2d,_0x06d4('0x10'));_0x4b5868(_0x3ca834[_0x06d4('0x17')][_0x06d4('0x16')]);}})[_0x06d4('0x18')](function(_0x1be3c2){logger[_0x06d4('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x208e2d,_0x1be3c2);_0x1d6f8e(_0x1be3c2);});});} \ No newline at end of file +var _0xb0bf=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20d47f,_0x5ae529){var _0x40e585=function(_0x359a18){while(--_0x359a18){_0x20d47f['push'](_0x20d47f['shift']());}};_0x40e585(++_0x5ae529);}(_0xb0bf,0x8b));var _0xfb0b=function(_0x41db8e,_0x306aaf){_0x41db8e=_0x41db8e-0x0;var _0x444431=_0xb0bf[_0x41db8e];return _0x444431;};'use strict';var _=require(_0xfb0b('0x0'));var util=require(_0xfb0b('0x1'));var moment=require(_0xfb0b('0x2'));var BPromise=require(_0xfb0b('0x3'));var rs=require(_0xfb0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb0b('0x5'))['db'];var utils=require(_0xfb0b('0x6'));var logger=require(_0xfb0b('0x7'))(_0xfb0b('0x8'));var config=require(_0xfb0b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb0b('0xa')][_0xfb0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54d7a1,_0x3130ac,_0x3cea1a){return new BPromise(function(_0x13928d,_0x2b8f62){return client['request'](_0x54d7a1,_0x3cea1a)[_0xfb0b('0xc')](function(_0x1a5b5a){logger[_0xfb0b('0xd')](_0xfb0b('0xe'),_0x3130ac,_0xfb0b('0xf'));logger[_0xfb0b('0x10')](_0xfb0b('0x11'),_0x3130ac,_0xfb0b('0xf'),JSON[_0xfb0b('0x12')](_0x1a5b5a));if(_0x1a5b5a[_0xfb0b('0x13')]){if(_0x1a5b5a[_0xfb0b('0x13')][_0xfb0b('0x14')]===0x1f4){logger[_0xfb0b('0x13')](_0xfb0b('0xe'),_0x3130ac,_0x1a5b5a[_0xfb0b('0x13')][_0xfb0b('0x15')]);return _0x2b8f62(_0x1a5b5a[_0xfb0b('0x13')][_0xfb0b('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3130ac,_0x1a5b5a[_0xfb0b('0x13')]['message']);return _0x13928d(_0x1a5b5a[_0xfb0b('0x13')][_0xfb0b('0x15')]);}else{logger[_0xfb0b('0xd')](_0xfb0b('0xe'),_0x3130ac,'request\x20sent');_0x13928d(_0x1a5b5a[_0xfb0b('0x16')][_0xfb0b('0x15')]);}})['catch'](function(_0x954ac9){logger['error'](_0xfb0b('0xe'),_0x3130ac,_0x954ac9);_0x2b8f62(_0x954ac9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ea85374..f31ac67 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 _0x0477=['../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8e0cd6,_0x364ace){var _0x162215=function(_0xea40c5){while(--_0xea40c5){_0x8e0cd6['push'](_0x8e0cd6['shift']());}};_0x162215(++_0x364ace);}(_0x0477,0x188));var _0x7047=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x0477[_0x555b2f];return _0x81c0a6;};'use strict';var multer=require(_0x7047('0x0'));var util=require(_0x7047('0x1'));var path=require('path');var timeout=require(_0x7047('0x2'));var express=require(_0x7047('0x3'));var router=express[_0x7047('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7047('0x5'));var interaction=require(_0x7047('0x6'));var config=require(_0x7047('0x7'));var controller=require(_0x7047('0x8'));router[_0x7047('0x9')]('/',auth[_0x7047('0xa')](),controller['index']);router[_0x7047('0x9')](_0x7047('0xb'),auth[_0x7047('0xa')](),controller[_0x7047('0xc')]);router[_0x7047('0x9')](_0x7047('0xd'),auth['isAuthenticated'](),controller[_0x7047('0xe')]);router[_0x7047('0xf')]('/',auth[_0x7047('0xa')](),controller['create']);router['put'](_0x7047('0xb'),auth[_0x7047('0xa')](),controller[_0x7047('0x10')]);router[_0x7047('0x11')]('/:id',auth[_0x7047('0xa')](),controller[_0x7047('0x12')]);module['exports']=router; \ No newline at end of file +var _0x00b0=['download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x00b0,0x11b));var _0x000b=function(_0x484664,_0x14e738){_0x484664=_0x484664-0x0;var _0x3fcf3f=_0x00b0[_0x484664];return _0x3fcf3f;};'use strict';var multer=require(_0x000b('0x0'));var util=require(_0x000b('0x1'));var path=require(_0x000b('0x2'));var timeout=require(_0x000b('0x3'));var express=require(_0x000b('0x4'));var router=express[_0x000b('0x5')]();var fs_extra=require(_0x000b('0x6'));var auth=require(_0x000b('0x7'));var interaction=require(_0x000b('0x8'));var config=require(_0x000b('0x9'));var controller=require(_0x000b('0xa'));router[_0x000b('0xb')]('/',auth['isAuthenticated'](),controller[_0x000b('0xc')]);router[_0x000b('0xb')](_0x000b('0xd'),auth[_0x000b('0xe')](),controller[_0x000b('0xf')]);router[_0x000b('0xb')]('/:id/download',auth[_0x000b('0xe')](),controller[_0x000b('0x10')]);router[_0x000b('0x11')]('/',auth[_0x000b('0xe')](),controller[_0x000b('0x12')]);router[_0x000b('0x13')](_0x000b('0xd'),auth[_0x000b('0xe')](),controller[_0x000b('0x14')]);router[_0x000b('0x15')](_0x000b('0xd'),auth[_0x000b('0xe')](),controller[_0x000b('0x16')]);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 d7d62ec..f8abde9 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 _0xe02f=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3ba1ca,_0x225761){var _0x51d416=function(_0x407c4f){while(--_0x407c4f){_0x3ba1ca['push'](_0x3ba1ca['shift']());}};_0x51d416(++_0x225761);}(_0xe02f,0x1b9));var _0xfe02=function(_0x10f7f7,_0x457207){_0x10f7f7=_0x10f7f7-0x0;var _0x4ca615=_0xe02f[_0x10f7f7];return _0x4ca615;};'use strict';var Sequelize=require(_0xfe02('0x0'));module[_0xfe02('0x1')]={'field':{'type':Sequelize[_0xfe02('0x2')]},'alias':{'type':Sequelize[_0xfe02('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xfe02('0x3')]},'groupBy':{'type':Sequelize[_0xfe02('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xfe02('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf812=['BOOLEAN','STRING','exports','TEXT'];(function(_0xa1cd8d,_0x4579fa){var _0x640b99=function(_0x563e7a){while(--_0x563e7a){_0xa1cd8d['push'](_0xa1cd8d['shift']());}};_0x640b99(++_0x4579fa);}(_0xf812,0xd2));var _0x2f81=function(_0x57c501,_0x319f03){_0x57c501=_0x57c501-0x0;var _0x4f15ba=_0xf812[_0x57c501];return _0x4f15ba;};'use strict';var Sequelize=require('sequelize');module[_0x2f81('0x0')]={'field':{'type':Sequelize[_0x2f81('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x2f81('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2f81('0x3')]},'custom':{'type':Sequelize[_0x2f81('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7b32f93..f56c33c 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 _0xd6a7=['undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','then','include','show','params','keys','merge','find','catch','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4583d0,_0x24551f){var _0x7b3c5a=function(_0x14946a){while(--_0x14946a){_0x4583d0['push'](_0x4583d0['shift']());}};_0x7b3c5a(++_0x24551f);}(_0xd6a7,0x11f));var _0x7d6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6a7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d6a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d6a('0x2'));var moment=require('moment');var BPromise=require(_0x7d6a('0x3'));var Mustache=require(_0x7d6a('0x4'));var util=require(_0x7d6a('0x5'));var path=require(_0x7d6a('0x6'));var sox=require(_0x7d6a('0x7'));var csv=require(_0x7d6a('0x8'));var ejs=require(_0x7d6a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d6a('0xa'));var squel=require(_0x7d6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x7d6a('0xc'));var deskjs=require(_0x7d6a('0xd'));var toCsv=require(_0x7d6a('0x8'));var querystring=require('querystring');var Papa=require(_0x7d6a('0xe'));var Redis=require('ioredis');var authService=require(_0x7d6a('0xf'));var qs=require(_0x7d6a('0x10'));var as=require(_0x7d6a('0x11'));var hardwareService=require(_0x7d6a('0x12'));var logger=require(_0x7d6a('0x13'))(_0x7d6a('0x14'));var utils=require(_0x7d6a('0x15'));var config=require(_0x7d6a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d6a('0x17'))['db'];function respondWithStatusCode(_0x58ab9e,_0x135cf7){_0x135cf7=_0x135cf7||0xcc;return function(_0x2bae7b){if(_0x2bae7b){return _0x58ab9e[_0x7d6a('0x18')](_0x135cf7);}return _0x58ab9e[_0x7d6a('0x19')](_0x135cf7)[_0x7d6a('0x1a')]();};}function respondWithResult(_0x442e20,_0x882d0d){_0x882d0d=_0x882d0d||0xc8;return function(_0x5a73dd){if(_0x5a73dd){return _0x442e20[_0x7d6a('0x19')](_0x882d0d)[_0x7d6a('0x1b')](_0x5a73dd);}};}function respondWithFilteredResult(_0x4db851,_0x59d158){return function(_0xc9fa53){if(_0xc9fa53){var _0x281e90=typeof _0x59d158[_0x7d6a('0x1c')]===_0x7d6a('0x1d')&&typeof _0x59d158[_0x7d6a('0x1e')]===_0x7d6a('0x1d');var _0x1f591e=_0xc9fa53[_0x7d6a('0x1f')];var _0x135a0c=_0x281e90?0x0:_0x59d158[_0x7d6a('0x1c')];var _0x28455f=_0x281e90?_0xc9fa53[_0x7d6a('0x1f')]:_0x59d158[_0x7d6a('0x1c')]+_0x59d158[_0x7d6a('0x1e')];var _0x1e3b12;if(_0x28455f>=_0x1f591e){_0x28455f=_0x1f591e;_0x1e3b12=0xc8;}else{_0x1e3b12=0xce;}_0x4db851[_0x7d6a('0x19')](_0x1e3b12);return _0x4db851[_0x7d6a('0x20')]('Content-Range',_0x135a0c+'-'+_0x28455f+'/'+_0x1f591e)[_0x7d6a('0x1b')](_0xc9fa53);}return null;};}function patchUpdates(_0xbbe6ce){return function(_0x34b523){try{jsonpatch[_0x7d6a('0x21')](_0x34b523,_0xbbe6ce,!![]);}catch(_0xa0753b){return BPromise[_0x7d6a('0x22')](_0xa0753b);}return _0x34b523[_0x7d6a('0x23')]();};}function saveUpdates(_0x54f126,_0x4bfd79){return function(_0x3e35ee){if(_0x3e35ee){return _0x3e35ee[_0x7d6a('0x24')](_0x54f126)['then'](function(_0x4c6db3){return _0x4c6db3;});}return null;};}function removeEntity(_0x53f946,_0x376281){return function(_0x3af0e0){if(_0x3af0e0){return _0x3af0e0[_0x7d6a('0x25')]()['then'](function(){_0x53f946[_0x7d6a('0x19')](0xcc)[_0x7d6a('0x1a')]();});}};}function handleEntityNotFound(_0x50f626,_0x51bddd){return function(_0x40425a){if(!_0x40425a){_0x50f626[_0x7d6a('0x18')](0x194);}return _0x40425a;};}function handleError(_0x1e1fa3,_0xe8dd2e){_0xe8dd2e=_0xe8dd2e||0x1f4;return function(_0x58f9a2){logger[_0x7d6a('0x26')](_0x58f9a2['stack']);if(_0x58f9a2[_0x7d6a('0x27')]){delete _0x58f9a2[_0x7d6a('0x27')];}_0x1e1fa3[_0x7d6a('0x19')](_0xe8dd2e)[_0x7d6a('0x28')](_0x58f9a2);};}exports['index']=function(_0x4d55ec,_0x6b4a9f){var _0x3b3963={},_0x4352e4={},_0x37997a={'count':0x0,'rows':[]};var _0x10a147=_['map'](db[_0x7d6a('0x29')][_0x7d6a('0x2a')],function(_0xf94ad){return{'name':_0xf94ad[_0x7d6a('0x2b')],'type':_0xf94ad[_0x7d6a('0x2c')][_0x7d6a('0x2d')]};});_0x4352e4[_0x7d6a('0x2e')]=_[_0x7d6a('0x2f')](_0x10a147,_0x7d6a('0x27'));_0x4352e4[_0x7d6a('0x30')]=_['keys'](_0x4d55ec['query']);_0x4352e4['filters']=_[_0x7d6a('0x31')](_0x4352e4[_0x7d6a('0x2e')],_0x4352e4[_0x7d6a('0x30')]);_0x3b3963[_0x7d6a('0x32')]=_[_0x7d6a('0x31')](_0x4352e4[_0x7d6a('0x2e')],qs[_0x7d6a('0x33')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x33')]));_0x3b3963['attributes']=_0x3b3963[_0x7d6a('0x32')][_0x7d6a('0x34')]?_0x3b3963[_0x7d6a('0x32')]:_0x4352e4[_0x7d6a('0x2e')];if(!_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x35')](_0x7d6a('0x36'))){_0x3b3963[_0x7d6a('0x1e')]=qs[_0x7d6a('0x1e')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x1e')]);_0x3b3963[_0x7d6a('0x1c')]=qs[_0x7d6a('0x1c')](_0x4d55ec['query'][_0x7d6a('0x1c')]);}_0x3b3963[_0x7d6a('0x37')]=qs[_0x7d6a('0x38')](_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x38')]);_0x3b3963[_0x7d6a('0x39')]=qs[_0x7d6a('0x3a')](_['pick'](_0x4d55ec[_0x7d6a('0x30')],_0x4352e4[_0x7d6a('0x3a')]),_0x10a147);if(_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x3b')]){_0x3b3963[_0x7d6a('0x39')]=_['merge'](_0x3b3963[_0x7d6a('0x39')],{'$or':_[_0x7d6a('0x2f')](_0x10a147,function(_0x44e23a){if(_0x44e23a[_0x7d6a('0x2c')]!=='VIRTUAL'){var _0x1044da={};_0x1044da[_0x44e23a['name']]={'$like':'%'+_0x4d55ec[_0x7d6a('0x30')][_0x7d6a('0x3b')]+'%'};return _0x1044da;}})});}_0x3b3963=_['merge']({},_0x3b3963,_0x4d55ec[_0x7d6a('0x3c')]);var _0x564e30={'where':_0x3b3963[_0x7d6a('0x39')]};return db[_0x7d6a('0x29')]['count'](_0x564e30)[_0x7d6a('0x3d')](function(_0x20e368){_0x37997a[_0x7d6a('0x1f')]=_0x20e368;if(_0x4d55ec['query']['includeAll']){_0x3b3963[_0x7d6a('0x3e')]=[{'all':!![]}];}return db[_0x7d6a('0x29')]['findAll'](_0x3b3963);})[_0x7d6a('0x3d')](function(_0x4feaed){_0x37997a['rows']=_0x4feaed;return _0x37997a;})[_0x7d6a('0x3d')](respondWithFilteredResult(_0x6b4a9f,_0x3b3963))['catch'](handleError(_0x6b4a9f,null));};exports[_0x7d6a('0x3f')]=function(_0x541a38,_0x37ee38){var _0x38febc={'raw':![],'where':{'id':_0x541a38[_0x7d6a('0x40')]['id']}},_0x5d21a8={};_0x5d21a8['model']=_[_0x7d6a('0x41')](db[_0x7d6a('0x29')][_0x7d6a('0x2a')]);_0x5d21a8[_0x7d6a('0x30')]=_[_0x7d6a('0x41')](_0x541a38['query']);_0x5d21a8[_0x7d6a('0x3a')]=_[_0x7d6a('0x31')](_0x5d21a8[_0x7d6a('0x2e')],_0x5d21a8[_0x7d6a('0x30')]);_0x38febc['attributes']=_[_0x7d6a('0x31')](_0x5d21a8['model'],qs[_0x7d6a('0x33')](_0x541a38[_0x7d6a('0x30')][_0x7d6a('0x33')]));_0x38febc[_0x7d6a('0x32')]=_0x38febc[_0x7d6a('0x32')][_0x7d6a('0x34')]?_0x38febc[_0x7d6a('0x32')]:_0x5d21a8[_0x7d6a('0x2e')];if(_0x541a38[_0x7d6a('0x30')]['includeAll']){_0x38febc[_0x7d6a('0x3e')]=[{'all':!![]}];}_0x38febc=_[_0x7d6a('0x42')]({},_0x38febc,_0x541a38[_0x7d6a('0x3c')]);return db[_0x7d6a('0x29')][_0x7d6a('0x43')](_0x38febc)[_0x7d6a('0x3d')](handleEntityNotFound(_0x37ee38,null))[_0x7d6a('0x3d')](respondWithResult(_0x37ee38,null))[_0x7d6a('0x44')](handleError(_0x37ee38,null));};exports[_0x7d6a('0x45')]=function(_0x5d3fd1,_0x40a482){return db[_0x7d6a('0x29')][_0x7d6a('0x45')](_0x5d3fd1['body'],{})[_0x7d6a('0x3d')](respondWithResult(_0x40a482,0xc9))['catch'](handleError(_0x40a482,null));};exports[_0x7d6a('0x46')]=function(_0x484e64,_0x1fd0d0){return db['AnalyticFieldReport']['bulkCreate'](_0x484e64[_0x7d6a('0x47')],{'raw':![],'individualHooks':!![]})[_0x7d6a('0x3d')](respondWithResult(_0x1fd0d0,0xc9))[_0x7d6a('0x44')](handleError(_0x1fd0d0,null));};exports[_0x7d6a('0x24')]=function(_0x111c46,_0x1cf51f){if(_0x111c46[_0x7d6a('0x47')]['id']){delete _0x111c46[_0x7d6a('0x47')]['id'];}return db['AnalyticFieldReport'][_0x7d6a('0x43')]({'where':{'id':_0x111c46[_0x7d6a('0x40')]['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x1cf51f,null))[_0x7d6a('0x3d')](saveUpdates(_0x111c46[_0x7d6a('0x47')],null))['then'](respondWithResult(_0x1cf51f,null))[_0x7d6a('0x44')](handleError(_0x1cf51f,null));};exports[_0x7d6a('0x25')]=function(_0x535947,_0x4aecaf){return db[_0x7d6a('0x29')][_0x7d6a('0x43')]({'where':{'id':_0x535947['params']['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x4aecaf,null))['then'](removeEntity(_0x4aecaf,null))['catch'](handleError(_0x4aecaf,null));};exports[_0x7d6a('0x48')]=function(_0x1fad46,_0x1c82d9){return db[_0x7d6a('0x29')][_0x7d6a('0x25')]({'where':{'id':_0x1fad46['query'][_0x7d6a('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x7d6a('0x3d')](respondWithResult(_0x1c82d9,0xcc))[_0x7d6a('0x44')](handleError(_0x1c82d9,null));};exports['addFields']=function(_0x2e822d,_0x95e732,_0x223cea){return db[_0x7d6a('0x4a')][_0x7d6a('0x4b')]({'where':{'id':_0x2e822d[_0x7d6a('0x40')]['id']}})[_0x7d6a('0x3d')](handleEntityNotFound(_0x95e732,null))['then'](function(_0x3c0425){if(_0x3c0425){return db[_0x7d6a('0x4c')][_0x7d6a('0x4d')](function(_0x184244){return db[_0x7d6a('0x29')][_0x7d6a('0x25')]({'where':{'CustomReportId':_0x2e822d[_0x7d6a('0x40')]['id']},'transaction':_0x184244})[_0x7d6a('0x3d')](function(_0x511135){var _0x45aee5=_[_0x7d6a('0x2f')](_0x2e822d[_0x7d6a('0x47')],function(_0x52ef2e){delete _0x52ef2e['id'];_0x52ef2e[_0x7d6a('0x4e')]=_0x2e822d[_0x7d6a('0x40')]['id'];return _0x52ef2e;});return db[_0x7d6a('0x29')][_0x7d6a('0x46')](_0x45aee5,{'transaction':_0x184244});});})['then'](function(){return db[_0x7d6a('0x29')]['findAll']({'where':{'CustomReportId':_0x2e822d['params']['id']}});});}})[_0x7d6a('0x3d')](respondWithResult(_0x95e732,null))['catch'](handleError(_0x95e732,null));}; \ No newline at end of file +var _0xf184=['findAll','rows','catch','show','params','AnalyticFieldReport','rawAttributes','length','include','find','create','body','bulkCreate','update','AnalyticCustomReport','sequelize','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf184,0xaf));var _0x4f18=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xf184[_0xcfc44];return _0x307a25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f18('0x0'));var zipdir=require(_0x4f18('0x1'));var jsonpatch=require(_0x4f18('0x2'));var rp=require(_0x4f18('0x3'));var moment=require(_0x4f18('0x4'));var BPromise=require(_0x4f18('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f18('0x6'));var sox=require(_0x4f18('0x7'));var csv=require(_0x4f18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f18('0x9'));var crypto=require(_0x4f18('0xa'));var jsforce=require(_0x4f18('0xb'));var deskjs=require(_0x4f18('0xc'));var toCsv=require(_0x4f18('0x8'));var querystring=require(_0x4f18('0xd'));var Papa=require(_0x4f18('0xe'));var Redis=require(_0x4f18('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f18('0x10'));var hardwareService=require(_0x4f18('0x11'));var logger=require(_0x4f18('0x12'))(_0x4f18('0x13'));var utils=require(_0x4f18('0x14'));var config=require(_0x4f18('0x15'));var licenseUtil=require(_0x4f18('0x16'));var db=require(_0x4f18('0x17'))['db'];function respondWithStatusCode(_0x5211b2,_0x13b209){_0x13b209=_0x13b209||0xcc;return function(_0x18d6b1){if(_0x18d6b1){return _0x5211b2[_0x4f18('0x18')](_0x13b209);}return _0x5211b2[_0x4f18('0x19')](_0x13b209)[_0x4f18('0x1a')]();};}function respondWithResult(_0xb51ea,_0x36b122){_0x36b122=_0x36b122||0xc8;return function(_0x2e70a3){if(_0x2e70a3){return _0xb51ea['status'](_0x36b122)[_0x4f18('0x1b')](_0x2e70a3);}};}function respondWithFilteredResult(_0x437fd4,_0x5b122e){return function(_0x21f50a){if(_0x21f50a){var _0x5ae289=typeof _0x5b122e['offset']===_0x4f18('0x1c')&&typeof _0x5b122e[_0x4f18('0x1d')]===_0x4f18('0x1c');var _0x2e6b0e=_0x21f50a[_0x4f18('0x1e')];var _0x273fa8=_0x5ae289?0x0:_0x5b122e['offset'];var _0x8ec518=_0x5ae289?_0x21f50a[_0x4f18('0x1e')]:_0x5b122e['offset']+_0x5b122e['limit'];var _0x567066;if(_0x8ec518>=_0x2e6b0e){_0x8ec518=_0x2e6b0e;_0x567066=0xc8;}else{_0x567066=0xce;}_0x437fd4['status'](_0x567066);return _0x437fd4[_0x4f18('0x1f')]('Content-Range',_0x273fa8+'-'+_0x8ec518+'/'+_0x2e6b0e)[_0x4f18('0x1b')](_0x21f50a);}return null;};}function patchUpdates(_0x2f655c){return function(_0x3c71f3){try{jsonpatch[_0x4f18('0x20')](_0x3c71f3,_0x2f655c,!![]);}catch(_0x2be212){return BPromise[_0x4f18('0x21')](_0x2be212);}return _0x3c71f3[_0x4f18('0x22')]();};}function saveUpdates(_0x44b683,_0x48c599){return function(_0x4b7c7c){if(_0x4b7c7c){return _0x4b7c7c['update'](_0x44b683)['then'](function(_0x2b80f5){return _0x2b80f5;});}return null;};}function removeEntity(_0x1cf8df,_0x3cda5c){return function(_0x7c0992){if(_0x7c0992){return _0x7c0992[_0x4f18('0x23')]()[_0x4f18('0x24')](function(){_0x1cf8df[_0x4f18('0x19')](0xcc)[_0x4f18('0x1a')]();});}};}function handleEntityNotFound(_0x3b8675,_0x487b57){return function(_0x47e0e6){if(!_0x47e0e6){_0x3b8675['sendStatus'](0x194);}return _0x47e0e6;};}function handleError(_0x405a05,_0x1d1df5){_0x1d1df5=_0x1d1df5||0x1f4;return function(_0x241723){logger[_0x4f18('0x25')](_0x241723[_0x4f18('0x26')]);if(_0x241723[_0x4f18('0x27')]){delete _0x241723[_0x4f18('0x27')];}_0x405a05['status'](_0x1d1df5)['send'](_0x241723);};}exports[_0x4f18('0x28')]=function(_0x562049,_0x595614){var _0x244083={},_0x551124={},_0x193a40={'count':0x0,'rows':[]};var _0x2319f1=_[_0x4f18('0x29')](db['AnalyticFieldReport']['rawAttributes'],function(_0x2deeb4){return{'name':_0x2deeb4[_0x4f18('0x2a')],'type':_0x2deeb4['type'][_0x4f18('0x2b')]};});_0x551124['model']=_[_0x4f18('0x29')](_0x2319f1,_0x4f18('0x27'));_0x551124[_0x4f18('0x2c')]=_[_0x4f18('0x2d')](_0x562049[_0x4f18('0x2c')]);_0x551124[_0x4f18('0x2e')]=_[_0x4f18('0x2f')](_0x551124[_0x4f18('0x30')],_0x551124[_0x4f18('0x2c')]);_0x244083[_0x4f18('0x31')]=_[_0x4f18('0x2f')](_0x551124[_0x4f18('0x30')],qs[_0x4f18('0x32')](_0x562049['query'][_0x4f18('0x32')]));_0x244083[_0x4f18('0x31')]=_0x244083[_0x4f18('0x31')]['length']?_0x244083[_0x4f18('0x31')]:_0x551124[_0x4f18('0x30')];if(!_0x562049[_0x4f18('0x2c')][_0x4f18('0x33')](_0x4f18('0x34'))){_0x244083[_0x4f18('0x1d')]=qs[_0x4f18('0x1d')](_0x562049[_0x4f18('0x2c')]['limit']);_0x244083['offset']=qs[_0x4f18('0x35')](_0x562049[_0x4f18('0x2c')]['offset']);}_0x244083[_0x4f18('0x36')]=qs['sort'](_0x562049[_0x4f18('0x2c')]['sort']);_0x244083['where']=qs[_0x4f18('0x2e')](_['pick'](_0x562049[_0x4f18('0x2c')],_0x551124[_0x4f18('0x2e')]),_0x2319f1);if(_0x562049[_0x4f18('0x2c')][_0x4f18('0x37')]){_0x244083[_0x4f18('0x38')]=_[_0x4f18('0x39')](_0x244083[_0x4f18('0x38')],{'$or':_[_0x4f18('0x29')](_0x2319f1,function(_0x223fda){if(_0x223fda[_0x4f18('0x3a')]!==_0x4f18('0x3b')){var _0x1903ea={};_0x1903ea[_0x223fda['name']]={'$like':'%'+_0x562049[_0x4f18('0x2c')][_0x4f18('0x37')]+'%'};return _0x1903ea;}})});}_0x244083=_[_0x4f18('0x39')]({},_0x244083,_0x562049[_0x4f18('0x3c')]);var _0x40d641={'where':_0x244083[_0x4f18('0x38')]};return db['AnalyticFieldReport'][_0x4f18('0x1e')](_0x40d641)[_0x4f18('0x24')](function(_0x424a0a){_0x193a40[_0x4f18('0x1e')]=_0x424a0a;if(_0x562049[_0x4f18('0x2c')][_0x4f18('0x3d')]){_0x244083['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4f18('0x3e')](_0x244083);})[_0x4f18('0x24')](function(_0x3259fd){_0x193a40[_0x4f18('0x3f')]=_0x3259fd;return _0x193a40;})['then'](respondWithFilteredResult(_0x595614,_0x244083))[_0x4f18('0x40')](handleError(_0x595614,null));};exports[_0x4f18('0x41')]=function(_0x1263f5,_0x31fa9e){var _0xfd1ea={'raw':![],'where':{'id':_0x1263f5[_0x4f18('0x42')]['id']}},_0x1919b4={};_0x1919b4[_0x4f18('0x30')]=_[_0x4f18('0x2d')](db[_0x4f18('0x43')][_0x4f18('0x44')]);_0x1919b4['query']=_['keys'](_0x1263f5[_0x4f18('0x2c')]);_0x1919b4[_0x4f18('0x2e')]=_[_0x4f18('0x2f')](_0x1919b4['model'],_0x1919b4[_0x4f18('0x2c')]);_0xfd1ea[_0x4f18('0x31')]=_[_0x4f18('0x2f')](_0x1919b4[_0x4f18('0x30')],qs[_0x4f18('0x32')](_0x1263f5[_0x4f18('0x2c')][_0x4f18('0x32')]));_0xfd1ea[_0x4f18('0x31')]=_0xfd1ea[_0x4f18('0x31')][_0x4f18('0x45')]?_0xfd1ea[_0x4f18('0x31')]:_0x1919b4[_0x4f18('0x30')];if(_0x1263f5[_0x4f18('0x2c')][_0x4f18('0x3d')]){_0xfd1ea[_0x4f18('0x46')]=[{'all':!![]}];}_0xfd1ea=_['merge']({},_0xfd1ea,_0x1263f5[_0x4f18('0x3c')]);return db['AnalyticFieldReport'][_0x4f18('0x47')](_0xfd1ea)[_0x4f18('0x24')](handleEntityNotFound(_0x31fa9e,null))[_0x4f18('0x24')](respondWithResult(_0x31fa9e,null))[_0x4f18('0x40')](handleError(_0x31fa9e,null));};exports[_0x4f18('0x48')]=function(_0x4d081e,_0x22afcd){return db[_0x4f18('0x43')][_0x4f18('0x48')](_0x4d081e[_0x4f18('0x49')],{})[_0x4f18('0x24')](respondWithResult(_0x22afcd,0xc9))['catch'](handleError(_0x22afcd,null));};exports[_0x4f18('0x4a')]=function(_0x2f3154,_0x1ab203){return db[_0x4f18('0x43')][_0x4f18('0x4a')](_0x2f3154[_0x4f18('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1ab203,0xc9))[_0x4f18('0x40')](handleError(_0x1ab203,null));};exports[_0x4f18('0x4b')]=function(_0xb2f796,_0x74611a){if(_0xb2f796[_0x4f18('0x49')]['id']){delete _0xb2f796[_0x4f18('0x49')]['id'];}return db[_0x4f18('0x43')]['find']({'where':{'id':_0xb2f796[_0x4f18('0x42')]['id']}})[_0x4f18('0x24')](handleEntityNotFound(_0x74611a,null))['then'](saveUpdates(_0xb2f796[_0x4f18('0x49')],null))[_0x4f18('0x24')](respondWithResult(_0x74611a,null))['catch'](handleError(_0x74611a,null));};exports[_0x4f18('0x23')]=function(_0x285e5f,_0x6e4de3){return db[_0x4f18('0x43')][_0x4f18('0x47')]({'where':{'id':_0x285e5f[_0x4f18('0x42')]['id']}})[_0x4f18('0x24')](handleEntityNotFound(_0x6e4de3,null))[_0x4f18('0x24')](removeEntity(_0x6e4de3,null))[_0x4f18('0x40')](handleError(_0x6e4de3,null));};exports['bulkDestroy']=function(_0x13b40b,_0x223dcb){return db[_0x4f18('0x43')][_0x4f18('0x23')]({'where':{'id':_0x13b40b[_0x4f18('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x4f18('0x24')](respondWithResult(_0x223dcb,0xcc))['catch'](handleError(_0x223dcb,null));};exports['addFields']=function(_0x297d27,_0xd94029,_0x33faa3){return db[_0x4f18('0x4c')]['findOne']({'where':{'id':_0x297d27[_0x4f18('0x42')]['id']}})[_0x4f18('0x24')](handleEntityNotFound(_0xd94029,null))[_0x4f18('0x24')](function(_0x194b19){if(_0x194b19){return db[_0x4f18('0x4d')][_0x4f18('0x4e')](function(_0x2b5db4){return db[_0x4f18('0x43')]['destroy']({'where':{'CustomReportId':_0x297d27['params']['id']},'transaction':_0x2b5db4})[_0x4f18('0x24')](function(_0x568b62){var _0x3c7846=_[_0x4f18('0x29')](_0x297d27[_0x4f18('0x49')],function(_0x2d9471){delete _0x2d9471['id'];_0x2d9471['CustomReportId']=_0x297d27[_0x4f18('0x42')]['id'];return _0x2d9471;});return db[_0x4f18('0x43')][_0x4f18('0x4a')](_0x3c7846,{'transaction':_0x2b5db4});});})[_0x4f18('0x24')](function(){return db[_0x4f18('0x43')][_0x4f18('0x3e')]({'where':{'CustomReportId':_0x297d27[_0x4f18('0x42')]['id']}});});}})['then'](respondWithResult(_0xd94029,null))['catch'](handleError(_0xd94029,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2066901..24cc9c3 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 _0xe706=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xe706,0x1c6));var _0x6e70=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0xe706[_0xef66ed];return _0xa14f66;};'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(_0x462287,_0x393afd){return _0x462287[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18e1=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x18e1,0xc4));var _0x118e=function(_0x4c0db0,_0x19e7f9){_0x4c0db0=_0x4c0db0-0x0;var _0x31d888=_0x18e1[_0x4c0db0];return _0x31d888;};'use strict';var _=require(_0x118e('0x0'));var util=require(_0x118e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x118e('0x2'));var BPromise=require(_0x118e('0x3'));var rp=require(_0x118e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x118e('0x5'));var config=require(_0x118e('0x6'));var attributes=require(_0x118e('0x7'));module[_0x118e('0x8')]=function(_0x25297f,_0x1e663c){return _0x25297f[_0x118e('0x9')](_0x118e('0xa'),attributes,{'tableName':_0x118e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3b15179..7763890 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 _0x07e2=['request','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x187d1f,_0x2c09c2){var _0x3556e5=function(_0x5d9095){while(--_0x5d9095){_0x187d1f['push'](_0x187d1f['shift']());}};_0x3556e5(++_0x2c09c2);}(_0x07e2,0x131));var _0x207e=function(_0x381781,_0x35257f){_0x381781=_0x381781-0x0;var _0x540ba0=_0x07e2[_0x381781];return _0x540ba0;};'use strict';var _=require('lodash');var util=require(_0x207e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x207e('0x1'));var fs=require('fs');var Redis=require(_0x207e('0x2'));var db=require(_0x207e('0x3'))['db'];var utils=require(_0x207e('0x4'));var logger=require(_0x207e('0x5'))(_0x207e('0x6'));var config=require(_0x207e('0x7'));var jayson=require(_0x207e('0x8'));var client=jayson[_0x207e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ab7ee,_0x5b1b58,_0x3305fa){return new BPromise(function(_0x4e20ac,_0x196a6b){return client[_0x207e('0xa')](_0x2ab7ee,_0x3305fa)['then'](function(_0x5e9eae){logger[_0x207e('0xb')](_0x207e('0xc'),_0x5b1b58,'request\x20sent');logger['debug'](_0x207e('0xd'),_0x5b1b58,'request\x20sent',JSON[_0x207e('0xe')](_0x5e9eae));if(_0x5e9eae[_0x207e('0xf')]){if(_0x5e9eae['error'][_0x207e('0x10')]===0x1f4){logger[_0x207e('0xf')](_0x207e('0xc'),_0x5b1b58,_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);return _0x196a6b(_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);}logger[_0x207e('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5b1b58,_0x5e9eae['error'][_0x207e('0x11')]);return _0x4e20ac(_0x5e9eae[_0x207e('0xf')][_0x207e('0x11')]);}else{logger['info'](_0x207e('0xc'),_0x5b1b58,_0x207e('0x12'));_0x4e20ac(_0x5e9eae[_0x207e('0x13')]['message']);}})[_0x207e('0x14')](function(_0x108281){logger[_0x207e('0xf')](_0x207e('0xc'),_0x5b1b58,_0x108281);_0x196a6b(_0x108281);});});} \ No newline at end of file +var _0x3e68=['AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3cb7a1,_0x37820b){var _0x55f38b=function(_0x3c717e){while(--_0x3c717e){_0x3cb7a1['push'](_0x3cb7a1['shift']());}};_0x55f38b(++_0x37820b);}(_0x3e68,0x82));var _0x83e6=function(_0x3bfa7a,_0x38d6f9){_0x3bfa7a=_0x3bfa7a-0x0;var _0x5afc30=_0x3e68[_0x3bfa7a];return _0x5afc30;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var moment=require(_0x83e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x83e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e6('0x4'))(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var jayson=require(_0x83e6('0x7'));var client=jayson[_0x83e6('0x8')][_0x83e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d4309,_0x3b48b7,_0x4b2ac7){return new BPromise(function(_0x220aee,_0x1c80b2){return client[_0x83e6('0xa')](_0x4d4309,_0x4b2ac7)['then'](function(_0x2a0d16){logger[_0x83e6('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b48b7,'request\x20sent');logger[_0x83e6('0xc')](_0x83e6('0xd'),_0x3b48b7,_0x83e6('0xe'),JSON[_0x83e6('0xf')](_0x2a0d16));if(_0x2a0d16[_0x83e6('0x10')]){if(_0x2a0d16[_0x83e6('0x10')]['code']===0x1f4){logger[_0x83e6('0x10')](_0x83e6('0x11'),_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x1c80b2(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}logger[_0x83e6('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x220aee(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}else{logger[_0x83e6('0xb')](_0x83e6('0x11'),_0x3b48b7,'request\x20sent');_0x220aee(_0x2a0d16[_0x83e6('0x13')][_0x83e6('0x12')]);}})[_0x83e6('0x14')](function(_0x5f0741){logger[_0x83e6('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b48b7,_0x5f0741);_0x1c80b2(_0x5f0741);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3e4322f..454f0fc 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(_0x2c10d1,_0x9a1e2b){var _0x119b4a=function(_0xcee1a5){while(--_0xcee1a5){_0x2c10d1['push'](_0x2c10d1['shift']());}};_0x119b4a(++_0x9a1e2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x310d9e,_0x885baa){var _0x57551c=function(_0xe1b1de){while(--_0xe1b1de){_0x310d9e['push'](_0x310d9e['shift']());}};_0x57551c(++_0x885baa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 2b827da..adb4215 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 _0xb98f=['STRING','name','sequelize','exports'];(function(_0x330db1,_0x35fc39){var _0xe113f4=function(_0x422608){while(--_0x422608){_0x330db1['push'](_0x330db1['shift']());}};_0xe113f4(++_0x35fc39);}(_0xb98f,0xce));var _0xfb98=function(_0x2790cf,_0x3f8b07){_0x2790cf=_0x2790cf-0x0;var _0xc19833=_0xb98f[_0x2790cf];return _0xc19833;};'use strict';var Sequelize=require(_0xfb98('0x0'));module[_0xfb98('0x1')]={'name':{'type':Sequelize[_0xfb98('0x2')],'allowNull':![],'unique':_0xfb98('0x3')},'table':{'type':Sequelize[_0xfb98('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4bde=['TEXT','sequelize','exports','STRING'];(function(_0x3c88bf,_0x5e5bf9){var _0x53036f=function(_0x2dc8b7){while(--_0x2dc8b7){_0x3c88bf['push'](_0x3c88bf['shift']());}};_0x53036f(++_0x5e5bf9);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x2bcfc7,_0x32364e){_0x2bcfc7=_0x2bcfc7-0x0;var _0xf94493=_0x4bde[_0x2bcfc7];return _0xf94493;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'name':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe4bd('0x2')]},'metric':{'type':Sequelize[_0xe4bd('0x3')]},'description':{'type':Sequelize[_0xe4bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 787601f..d4aec7e 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x3a2bb7,_0x4ebdce){var _0x4f5f21=function(_0x455d71){while(--_0x455d71){_0x3a2bb7['push'](_0x3a2bb7['shift']());}};_0x4f5f21(++_0x4ebdce);}(_0xe5b3,0x133));var _0x3e5b=function(_0x31b7d7,_0x3de9ed){_0x31b7d7=_0x31b7d7-0x0;var _0x3a376e=_0xe5b3[_0x31b7d7];return _0x3a376e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5cad3b,_0x38872f){var _0x42f44e=function(_0x3bd146){while(--_0x3bd146){_0x5cad3b['push'](_0x5cad3b['shift']());}};_0x42f44e(++_0x38872f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xf2ca[_0x419550];return _0x55f9ef;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 47c6e2a..e238ead 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 _0x8838=['./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x148e7c,_0x433004){var _0x59da04=function(_0x20d6a6){while(--_0x20d6a6){_0x148e7c['push'](_0x148e7c['shift']());}};_0x59da04(++_0x433004);}(_0x8838,0x90));var _0x8883=function(_0x3f246b,_0x1c8b9a){_0x3f246b=_0x3f246b-0x0;var _0x1a7b27=_0x8838[_0x3f246b];return _0x1a7b27;};'use strict';var _=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var logger=require(_0x8883('0x2'))(_0x8883('0x3'));var moment=require(_0x8883('0x4'));var BPromise=require(_0x8883('0x5'));var rp=require(_0x8883('0x6'));var fs=require('fs');var path=require(_0x8883('0x7'));var rimraf=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var attributes=require(_0x8883('0xa'));module[_0x8883('0xb')]=function(_0x5c894f,_0x5061d6){return _0x5c894f[_0x8883('0xc')]('AnalyticMetric',attributes,{'tableName':_0x8883('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1134=['AnalyticMetric','analytics_metrics','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x1fa3d3,_0x42a2e0){var _0x51a3b5=function(_0x54a475){while(--_0x54a475){_0x1fa3d3['push'](_0x1fa3d3['shift']());}};_0x51a3b5(++_0x42a2e0);}(_0x1134,0x19c));var _0x4113=function(_0x2585db,_0xf10c35){_0x2585db=_0x2585db-0x0;var _0x67fe48=_0x1134[_0x2585db];return _0x67fe48;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var logger=require('../../config/logger')(_0x4113('0x2'));var moment=require(_0x4113('0x3'));var BPromise=require('bluebird');var rp=require(_0x4113('0x4'));var fs=require('fs');var path=require(_0x4113('0x5'));var rimraf=require('rimraf');var config=require(_0x4113('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x4113('0x7')]=function(_0x499091,_0x39ca01){return _0x499091['define'](_0x4113('0x8'),attributes,{'tableName':_0x4113('0x9'),'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 e36926c..8b3ad6d 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 _0x7da8=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b4f44,_0x7cc184){var _0xaaebe3=function(_0x11f155){while(--_0x11f155){_0x2b4f44['push'](_0x2b4f44['shift']());}};_0xaaebe3(++_0x7cc184);}(_0x7da8,0x164));var _0x87da=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7da8[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x87da('0x0'));var util=require(_0x87da('0x1'));var moment=require(_0x87da('0x2'));var BPromise=require('bluebird');var rs=require(_0x87da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87da('0x4'))['db'];var utils=require(_0x87da('0x5'));var logger=require(_0x87da('0x6'))(_0x87da('0x7'));var config=require(_0x87da('0x8'));var jayson=require(_0x87da('0x9'));var client=jayson[_0x87da('0xa')][_0x87da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36856c,_0x20e780,_0x2fd416){return new BPromise(function(_0x3096bb,_0x31b7f2){return client['request'](_0x36856c,_0x2fd416)[_0x87da('0xc')](function(_0x5290ea){logger[_0x87da('0xd')](_0x87da('0xe'),_0x20e780,_0x87da('0xf'));logger[_0x87da('0x10')](_0x87da('0x11'),_0x20e780,_0x87da('0xf'),JSON[_0x87da('0x12')](_0x5290ea));if(_0x5290ea[_0x87da('0x13')]){if(_0x5290ea[_0x87da('0x13')][_0x87da('0x14')]===0x1f4){logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x5290ea['error'][_0x87da('0x15')]);return _0x31b7f2(_0x5290ea[_0x87da('0x13')][_0x87da('0x15')]);}logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x5290ea['error'][_0x87da('0x15')]);return _0x3096bb(_0x5290ea[_0x87da('0x13')][_0x87da('0x15')]);}else{logger[_0x87da('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x20e780,_0x87da('0xf'));_0x3096bb(_0x5290ea['result']['message']);}})[_0x87da('0x16')](function(_0x233834){logger[_0x87da('0x13')](_0x87da('0xe'),_0x20e780,_0x233834);_0x31b7f2(_0x233834);});});} \ No newline at end of file +var _0xe78b=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x243c9c,_0x3dbac6){var _0x25d5e9=function(_0x1b71dd){while(--_0x1b71dd){_0x243c9c['push'](_0x243c9c['shift']());}};_0x25d5e9(++_0x3dbac6);}(_0xe78b,0x1a8));var _0xbe78=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0xe78b[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0xbe78('0x0'));var util=require(_0xbe78('0x1'));var moment=require(_0xbe78('0x2'));var BPromise=require(_0xbe78('0x3'));var rs=require(_0xbe78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe78('0x5'))['db'];var utils=require(_0xbe78('0x6'));var logger=require(_0xbe78('0x7'))(_0xbe78('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe78('0x9')][_0xbe78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d8118,_0x4f200f,_0x3908b7){return new BPromise(function(_0x117399,_0x2f7baa){return client[_0xbe78('0xb')](_0x4d8118,_0x3908b7)[_0xbe78('0xc')](function(_0x288a39){logger[_0xbe78('0xd')](_0xbe78('0xe'),_0x4f200f,_0xbe78('0xf'));logger[_0xbe78('0x10')](_0xbe78('0x11'),_0x4f200f,_0xbe78('0xf'),JSON[_0xbe78('0x12')](_0x288a39));if(_0x288a39[_0xbe78('0x13')]){if(_0x288a39[_0xbe78('0x13')]['code']===0x1f4){logger[_0xbe78('0x13')](_0xbe78('0xe'),_0x4f200f,_0x288a39[_0xbe78('0x13')][_0xbe78('0x14')]);return _0x2f7baa(_0x288a39[_0xbe78('0x13')][_0xbe78('0x14')]);}logger[_0xbe78('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x4f200f,_0x288a39[_0xbe78('0x13')][_0xbe78('0x14')]);return _0x117399(_0x288a39[_0xbe78('0x13')]['message']);}else{logger[_0xbe78('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x4f200f,_0xbe78('0xf'));_0x117399(_0x288a39['result'][_0xbe78('0x14')]);}})[_0xbe78('0x15')](function(_0x45f06d){logger['error'](_0xbe78('0xe'),_0x4f200f,_0x45f06d);_0x2f7baa(_0x45f06d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f5b1bf6..13a06b0 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf98=['isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf98,0xcf));var _0x8df9=function(_0x1cc060,_0x1afbdc){_0x1cc060=_0x1cc060-0x0;var _0x5c7e10=_0xdf98[_0x1cc060];return _0x5c7e10;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8df9('0xd')]);router['put'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0xf')](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);module[_0x8df9('0x11')]=router; \ No newline at end of file +var _0x6f7b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f7b,0x168));var _0xb6f7=function(_0x329763,_0x5a7592){_0x329763=_0x329763-0x0;var _0x4bc4f4=_0x6f7b[_0x329763];return _0x4bc4f4;};'use strict';var multer=require('multer');var util=require(_0xb6f7('0x0'));var path=require(_0xb6f7('0x1'));var timeout=require(_0xb6f7('0x2'));var express=require(_0xb6f7('0x3'));var router=express[_0xb6f7('0x4')]();var fs_extra=require(_0xb6f7('0x5'));var auth=require(_0xb6f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb6f7('0x7'));var controller=require('./analyticMetric.controller');router[_0xb6f7('0x8')]('/',auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xa')]);router[_0xb6f7('0x8')]('/:id',auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xb')]);router[_0xb6f7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb6f7('0xd'),auth[_0xb6f7('0x9')](),controller[_0xb6f7('0xe')]);router[_0xb6f7('0xf')](_0xb6f7('0xd'),auth[_0xb6f7('0x9')](),controller[_0xb6f7('0x10')]);module[_0xb6f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 161ef42..9c216f7 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 _0xb778=['sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb778,0x1c5));var _0x8b77=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xb778[_0x143a91];return _0x1906f5;};'use strict';var Sequelize=require(_0x8b77('0x0'));module[_0x8b77('0x1')]={'tree':{'type':Sequelize[_0x8b77('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x53dd=['sequelize','exports','TEXT'];(function(_0x5467e6,_0x284a76){var _0x57cd42=function(_0x301493){while(--_0x301493){_0x5467e6['push'](_0x5467e6['shift']());}};_0x57cd42(++_0x284a76);}(_0x53dd,0x135));var _0xd53d=function(_0x2cec39,_0x1893aa){_0x2cec39=_0x2cec39-0x0;var _0x3a4ea6=_0x53dd[_0x2cec39];return _0x3a4ea6;};'use strict';var Sequelize=require(_0xd53d('0x0'));module[_0xd53d('0x1')]={'tree':{'type':Sequelize[_0xd53d('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 99d4b29..4da2363 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 _0x21ec=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes'];(function(_0x41c4c5,_0x46953c){var _0x3bd4ef=function(_0x2fd690){while(--_0x2fd690){_0x41c4c5['push'](_0x41c4c5['shift']());}};_0x3bd4ef(++_0x46953c);}(_0x21ec,0xb2));var _0xc21e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x21ec[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc21e('0x0'));var zipdir=require(_0xc21e('0x1'));var jsonpatch=require(_0xc21e('0x2'));var rp=require('request-promise');var moment=require(_0xc21e('0x3'));var BPromise=require(_0xc21e('0x4'));var Mustache=require(_0xc21e('0x5'));var util=require(_0xc21e('0x6'));var path=require(_0xc21e('0x7'));var sox=require(_0xc21e('0x8'));var csv=require(_0xc21e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc21e('0xa'));var _=require(_0xc21e('0xb'));var squel=require(_0xc21e('0xc'));var crypto=require(_0xc21e('0xd'));var jsforce=require(_0xc21e('0xe'));var deskjs=require(_0xc21e('0xf'));var toCsv=require(_0xc21e('0x9'));var querystring=require(_0xc21e('0x10'));var Papa=require('papaparse');var Redis=require(_0xc21e('0x11'));var authService=require(_0xc21e('0x12'));var qs=require(_0xc21e('0x13'));var as=require(_0xc21e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21e('0x15'))(_0xc21e('0x16'));var utils=require(_0xc21e('0x17'));var config=require(_0xc21e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc21e('0x19'))['db'];function respondWithStatusCode(_0x33eb3f,_0x6af8c9){_0x6af8c9=_0x6af8c9||0xcc;return function(_0x16401c){if(_0x16401c){return _0x33eb3f[_0xc21e('0x1a')](_0x6af8c9);}return _0x33eb3f['status'](_0x6af8c9)[_0xc21e('0x1b')]();};}function respondWithResult(_0xc3f443,_0x18213b){_0x18213b=_0x18213b||0xc8;return function(_0x3f234a){if(_0x3f234a){return _0xc3f443[_0xc21e('0x1c')](_0x18213b)['json'](_0x3f234a);}};}function respondWithFilteredResult(_0xfaddb2,_0x4fbed5){return function(_0xefd430){if(_0xefd430){var _0x4da0eb=typeof _0x4fbed5[_0xc21e('0x1d')]===_0xc21e('0x1e')&&typeof _0x4fbed5[_0xc21e('0x1f')]===_0xc21e('0x1e');var _0x59d5c7=_0xefd430['count'];var _0xd092df=_0x4da0eb?0x0:_0x4fbed5[_0xc21e('0x1d')];var _0x3a51aa=_0x4da0eb?_0xefd430[_0xc21e('0x20')]:_0x4fbed5['offset']+_0x4fbed5[_0xc21e('0x1f')];var _0x39249b;if(_0x3a51aa>=_0x59d5c7){_0x3a51aa=_0x59d5c7;_0x39249b=0xc8;}else{_0x39249b=0xce;}_0xfaddb2['status'](_0x39249b);return _0xfaddb2[_0xc21e('0x21')](_0xc21e('0x22'),_0xd092df+'-'+_0x3a51aa+'/'+_0x59d5c7)['json'](_0xefd430);}return null;};}function patchUpdates(_0x229102){return function(_0x14cd3f){try{jsonpatch[_0xc21e('0x23')](_0x14cd3f,_0x229102,!![]);}catch(_0x554534){return BPromise[_0xc21e('0x24')](_0x554534);}return _0x14cd3f[_0xc21e('0x25')]();};}function saveUpdates(_0xe0c810,_0x3c44bc){return function(_0x4af573){if(_0x4af573){return _0x4af573['update'](_0xe0c810)[_0xc21e('0x26')](function(_0x108f40){return _0x108f40;});}return null;};}function removeEntity(_0x1d675d,_0x4dec2d){return function(_0x828324){if(_0x828324){return _0x828324[_0xc21e('0x27')]()['then'](function(){_0x1d675d[_0xc21e('0x1c')](0xcc)[_0xc21e('0x1b')]();});}};}function handleEntityNotFound(_0x12cddf,_0x385ce3){return function(_0x178400){if(!_0x178400){_0x12cddf[_0xc21e('0x1a')](0x194);}return _0x178400;};}function handleError(_0x273bfe,_0x4416e4){_0x4416e4=_0x4416e4||0x1f4;return function(_0x2ff2c8){logger[_0xc21e('0x28')](_0x2ff2c8[_0xc21e('0x29')]);if(_0x2ff2c8[_0xc21e('0x2a')]){delete _0x2ff2c8[_0xc21e('0x2a')];}_0x273bfe[_0xc21e('0x1c')](_0x4416e4)[_0xc21e('0x2b')](_0x2ff2c8);};}exports[_0xc21e('0x2c')]=function(_0x97f908,_0x123752){var _0x500443={},_0x30ec49={},_0x19efe3={'count':0x0,'rows':[]};var _0x48a812=_[_0xc21e('0x2d')](db[_0xc21e('0x2e')][_0xc21e('0x2f')],function(_0x81650b){return{'name':_0x81650b[_0xc21e('0x30')],'type':_0x81650b['type'][_0xc21e('0x31')]};});_0x30ec49['model']=_[_0xc21e('0x2d')](_0x48a812,_0xc21e('0x2a'));_0x30ec49[_0xc21e('0x32')]=_[_0xc21e('0x33')](_0x97f908[_0xc21e('0x32')]);_0x30ec49[_0xc21e('0x34')]=_[_0xc21e('0x35')](_0x30ec49[_0xc21e('0x36')],_0x30ec49[_0xc21e('0x32')]);_0x500443[_0xc21e('0x37')]=_[_0xc21e('0x35')](_0x30ec49[_0xc21e('0x36')],qs['fields'](_0x97f908[_0xc21e('0x32')][_0xc21e('0x38')]));_0x500443[_0xc21e('0x37')]=_0x500443[_0xc21e('0x37')][_0xc21e('0x39')]?_0x500443[_0xc21e('0x37')]:_0x30ec49['model'];if(!_0x97f908[_0xc21e('0x32')][_0xc21e('0x3a')](_0xc21e('0x3b'))){_0x500443[_0xc21e('0x1f')]=qs[_0xc21e('0x1f')](_0x97f908[_0xc21e('0x32')][_0xc21e('0x1f')]);_0x500443[_0xc21e('0x1d')]=qs[_0xc21e('0x1d')](_0x97f908[_0xc21e('0x32')]['offset']);}_0x500443[_0xc21e('0x3c')]=qs['sort'](_0x97f908[_0xc21e('0x32')][_0xc21e('0x3d')]);_0x500443[_0xc21e('0x3e')]=qs['filters'](_[_0xc21e('0x3f')](_0x97f908[_0xc21e('0x32')],_0x30ec49[_0xc21e('0x34')]),_0x48a812);if(_0x97f908[_0xc21e('0x32')][_0xc21e('0x40')]){_0x500443[_0xc21e('0x3e')]=_[_0xc21e('0x41')](_0x500443[_0xc21e('0x3e')],{'$or':_[_0xc21e('0x2d')](_0x48a812,function(_0x9f6baf){if(_0x9f6baf[_0xc21e('0x42')]!==_0xc21e('0x43')){var _0x4cecfe={};_0x4cecfe[_0x9f6baf[_0xc21e('0x2a')]]={'$like':'%'+_0x97f908['query'][_0xc21e('0x40')]+'%'};return _0x4cecfe;}})});}_0x500443=_[_0xc21e('0x41')]({},_0x500443,_0x97f908[_0xc21e('0x44')]);var _0x57a598={'where':_0x500443[_0xc21e('0x3e')]};return db[_0xc21e('0x2e')]['count'](_0x57a598)['then'](function(_0x51c204){_0x19efe3[_0xc21e('0x20')]=_0x51c204;if(_0x97f908[_0xc21e('0x32')][_0xc21e('0x45')]){_0x500443[_0xc21e('0x46')]=[{'all':!![]}];}return db[_0xc21e('0x2e')]['findAll'](_0x500443);})[_0xc21e('0x26')](function(_0x3f07af){_0x19efe3[_0xc21e('0x47')]=_0x3f07af;return _0x19efe3;})['then'](respondWithFilteredResult(_0x123752,_0x500443))[_0xc21e('0x48')](handleError(_0x123752,null));};exports[_0xc21e('0x49')]=function(_0x52f509,_0x3f8daa){var _0x2a5581={'raw':!![],'where':{'id':_0x52f509[_0xc21e('0x4a')]['id']}},_0x275500={};_0x275500['model']=_['keys'](db['AnalyticTreeReport'][_0xc21e('0x2f')]);_0x275500[_0xc21e('0x32')]=_[_0xc21e('0x33')](_0x52f509[_0xc21e('0x32')]);_0x275500[_0xc21e('0x34')]=_[_0xc21e('0x35')](_0x275500[_0xc21e('0x36')],_0x275500[_0xc21e('0x32')]);_0x2a5581['attributes']=_[_0xc21e('0x35')](_0x275500['model'],qs[_0xc21e('0x38')](_0x52f509['query'][_0xc21e('0x38')]));_0x2a5581['attributes']=_0x2a5581[_0xc21e('0x37')][_0xc21e('0x39')]?_0x2a5581[_0xc21e('0x37')]:_0x275500[_0xc21e('0x36')];if(_0x52f509[_0xc21e('0x32')][_0xc21e('0x45')]){_0x2a5581[_0xc21e('0x46')]=[{'all':!![]}];}_0x2a5581=_[_0xc21e('0x41')]({},_0x2a5581,_0x52f509['options']);return db[_0xc21e('0x2e')][_0xc21e('0x4b')](_0x2a5581)[_0xc21e('0x26')](handleEntityNotFound(_0x3f8daa,null))[_0xc21e('0x26')](respondWithResult(_0x3f8daa,null))['catch'](handleError(_0x3f8daa,null));};exports[_0xc21e('0x4c')]=function(_0x507ee9,_0x3a59ad){return db['AnalyticTreeReport'][_0xc21e('0x4c')](_0x507ee9['body'],{})[_0xc21e('0x26')](respondWithResult(_0x3a59ad,0xc9))[_0xc21e('0x48')](handleError(_0x3a59ad,null));};exports['update']=function(_0x1c4707,_0x29fac4){if(_0x1c4707['body']['id']){delete _0x1c4707[_0xc21e('0x4d')]['id'];}return db[_0xc21e('0x2e')]['find']({'where':{'id':_0x1c4707[_0xc21e('0x4a')]['id']}})[_0xc21e('0x26')](handleEntityNotFound(_0x29fac4,null))['then'](saveUpdates(_0x1c4707['body'],null))[_0xc21e('0x26')](respondWithResult(_0x29fac4,null))[_0xc21e('0x48')](handleError(_0x29fac4,null));};exports['destroy']=function(_0x5dafce,_0x32a6c8){return db['AnalyticTreeReport'][_0xc21e('0x4b')]({'where':{'id':_0x5dafce['params']['id']}})[_0xc21e('0x26')](handleEntityNotFound(_0x32a6c8,null))[_0xc21e('0x26')](removeEntity(_0x32a6c8,null))[_0xc21e('0x48')](handleError(_0x32a6c8,null));}; \ No newline at end of file +var _0xfaa0=['type','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xfaa0,0x148));var _0x0faa=function(_0x16eb1d,_0x12f770){_0x16eb1d=_0x16eb1d-0x0;var _0x5ed3fc=_0xfaa0[_0x16eb1d];return _0x5ed3fc;};'use strict';var emlformat=require(_0x0faa('0x0'));var rimraf=require(_0x0faa('0x1'));var zipdir=require(_0x0faa('0x2'));var jsonpatch=require(_0x0faa('0x3'));var rp=require(_0x0faa('0x4'));var moment=require(_0x0faa('0x5'));var BPromise=require(_0x0faa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0faa('0x7'));var csv=require(_0x0faa('0x8'));var ejs=require(_0x0faa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0faa('0xa'));var squel=require(_0x0faa('0xb'));var crypto=require('crypto');var jsforce=require(_0x0faa('0xc'));var deskjs=require(_0x0faa('0xd'));var toCsv=require(_0x0faa('0x8'));var querystring=require(_0x0faa('0xe'));var Papa=require(_0x0faa('0xf'));var Redis=require(_0x0faa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0faa('0x11'));var as=require(_0x0faa('0x12'));var hardwareService=require(_0x0faa('0x13'));var logger=require(_0x0faa('0x14'))(_0x0faa('0x15'));var utils=require(_0x0faa('0x16'));var config=require(_0x0faa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd86b,_0x3596b2){_0x3596b2=_0x3596b2||0xcc;return function(_0x6b4a30){if(_0x6b4a30){return _0x4dd86b['sendStatus'](_0x3596b2);}return _0x4dd86b[_0x0faa('0x18')](_0x3596b2)[_0x0faa('0x19')]();};}function respondWithResult(_0x19456c,_0x2aebc3){_0x2aebc3=_0x2aebc3||0xc8;return function(_0x12b560){if(_0x12b560){return _0x19456c[_0x0faa('0x18')](_0x2aebc3)['json'](_0x12b560);}};}function respondWithFilteredResult(_0x2ddc57,_0x3108c5){return function(_0x55c53e){if(_0x55c53e){var _0x5d4d7b=typeof _0x3108c5['offset']===_0x0faa('0x1a')&&typeof _0x3108c5[_0x0faa('0x1b')]===_0x0faa('0x1a');var _0xbec9be=_0x55c53e['count'];var _0x1f4414=_0x5d4d7b?0x0:_0x3108c5['offset'];var _0x5eaff=_0x5d4d7b?_0x55c53e[_0x0faa('0x1c')]:_0x3108c5['offset']+_0x3108c5[_0x0faa('0x1b')];var _0x316106;if(_0x5eaff>=_0xbec9be){_0x5eaff=_0xbec9be;_0x316106=0xc8;}else{_0x316106=0xce;}_0x2ddc57[_0x0faa('0x18')](_0x316106);return _0x2ddc57[_0x0faa('0x1d')](_0x0faa('0x1e'),_0x1f4414+'-'+_0x5eaff+'/'+_0xbec9be)[_0x0faa('0x1f')](_0x55c53e);}return null;};}function patchUpdates(_0x1acc38){return function(_0x547c2e){try{jsonpatch[_0x0faa('0x20')](_0x547c2e,_0x1acc38,!![]);}catch(_0x182fdc){return BPromise[_0x0faa('0x21')](_0x182fdc);}return _0x547c2e[_0x0faa('0x22')]();};}function saveUpdates(_0x1ae08e,_0x1552ca){return function(_0x22fc55){if(_0x22fc55){return _0x22fc55[_0x0faa('0x23')](_0x1ae08e)[_0x0faa('0x24')](function(_0x5512f9){return _0x5512f9;});}return null;};}function removeEntity(_0x1525aa,_0x1f881d){return function(_0x28cb16){if(_0x28cb16){return _0x28cb16[_0x0faa('0x25')]()[_0x0faa('0x24')](function(){_0x1525aa[_0x0faa('0x18')](0xcc)[_0x0faa('0x19')]();});}};}function handleEntityNotFound(_0x3c0af9,_0x4ab961){return function(_0x16b180){if(!_0x16b180){_0x3c0af9[_0x0faa('0x26')](0x194);}return _0x16b180;};}function handleError(_0x1ca407,_0x4a168c){_0x4a168c=_0x4a168c||0x1f4;return function(_0x14f0ed){logger[_0x0faa('0x27')](_0x14f0ed[_0x0faa('0x28')]);if(_0x14f0ed[_0x0faa('0x29')]){delete _0x14f0ed[_0x0faa('0x29')];}_0x1ca407[_0x0faa('0x18')](_0x4a168c)[_0x0faa('0x2a')](_0x14f0ed);};}exports[_0x0faa('0x2b')]=function(_0x50f38e,_0x1c55c6){var _0x4c69e4={},_0x1af57f={},_0x481f9b={'count':0x0,'rows':[]};var _0x41370d=_['map'](db[_0x0faa('0x2c')][_0x0faa('0x2d')],function(_0x1df311){return{'name':_0x1df311[_0x0faa('0x2e')],'type':_0x1df311[_0x0faa('0x2f')]['key']};});_0x1af57f['model']=_[_0x0faa('0x30')](_0x41370d,_0x0faa('0x29'));_0x1af57f['query']=_['keys'](_0x50f38e[_0x0faa('0x31')]);_0x1af57f[_0x0faa('0x32')]=_['intersection'](_0x1af57f[_0x0faa('0x33')],_0x1af57f[_0x0faa('0x31')]);_0x4c69e4[_0x0faa('0x34')]=_[_0x0faa('0x35')](_0x1af57f[_0x0faa('0x33')],qs[_0x0faa('0x36')](_0x50f38e['query'][_0x0faa('0x36')]));_0x4c69e4[_0x0faa('0x34')]=_0x4c69e4[_0x0faa('0x34')]['length']?_0x4c69e4[_0x0faa('0x34')]:_0x1af57f['model'];if(!_0x50f38e[_0x0faa('0x31')][_0x0faa('0x37')](_0x0faa('0x38'))){_0x4c69e4[_0x0faa('0x1b')]=qs[_0x0faa('0x1b')](_0x50f38e['query'][_0x0faa('0x1b')]);_0x4c69e4[_0x0faa('0x39')]=qs[_0x0faa('0x39')](_0x50f38e[_0x0faa('0x31')]['offset']);}_0x4c69e4[_0x0faa('0x3a')]=qs[_0x0faa('0x3b')](_0x50f38e[_0x0faa('0x31')]['sort']);_0x4c69e4[_0x0faa('0x3c')]=qs['filters'](_['pick'](_0x50f38e[_0x0faa('0x31')],_0x1af57f['filters']),_0x41370d);if(_0x50f38e[_0x0faa('0x31')][_0x0faa('0x3d')]){_0x4c69e4[_0x0faa('0x3c')]=_[_0x0faa('0x3e')](_0x4c69e4[_0x0faa('0x3c')],{'$or':_['map'](_0x41370d,function(_0x2be864){if(_0x2be864[_0x0faa('0x2f')]!==_0x0faa('0x3f')){var _0x126e68={};_0x126e68[_0x2be864[_0x0faa('0x29')]]={'$like':'%'+_0x50f38e[_0x0faa('0x31')][_0x0faa('0x3d')]+'%'};return _0x126e68;}})});}_0x4c69e4=_[_0x0faa('0x3e')]({},_0x4c69e4,_0x50f38e[_0x0faa('0x40')]);var _0x3a8597={'where':_0x4c69e4['where']};return db[_0x0faa('0x2c')][_0x0faa('0x1c')](_0x3a8597)[_0x0faa('0x24')](function(_0x424a85){_0x481f9b[_0x0faa('0x1c')]=_0x424a85;if(_0x50f38e[_0x0faa('0x31')][_0x0faa('0x41')]){_0x4c69e4[_0x0faa('0x42')]=[{'all':!![]}];}return db[_0x0faa('0x2c')][_0x0faa('0x43')](_0x4c69e4);})[_0x0faa('0x24')](function(_0x21ba07){_0x481f9b[_0x0faa('0x44')]=_0x21ba07;return _0x481f9b;})['then'](respondWithFilteredResult(_0x1c55c6,_0x4c69e4))[_0x0faa('0x45')](handleError(_0x1c55c6,null));};exports['show']=function(_0xe26019,_0x32ffaf){var _0x3dbd61={'raw':!![],'where':{'id':_0xe26019[_0x0faa('0x46')]['id']}},_0x1fd3ec={};_0x1fd3ec['model']=_['keys'](db[_0x0faa('0x2c')]['rawAttributes']);_0x1fd3ec[_0x0faa('0x31')]=_[_0x0faa('0x47')](_0xe26019[_0x0faa('0x31')]);_0x1fd3ec[_0x0faa('0x32')]=_['intersection'](_0x1fd3ec['model'],_0x1fd3ec['query']);_0x3dbd61[_0x0faa('0x34')]=_[_0x0faa('0x35')](_0x1fd3ec[_0x0faa('0x33')],qs['fields'](_0xe26019['query']['fields']));_0x3dbd61[_0x0faa('0x34')]=_0x3dbd61[_0x0faa('0x34')]['length']?_0x3dbd61[_0x0faa('0x34')]:_0x1fd3ec[_0x0faa('0x33')];if(_0xe26019[_0x0faa('0x31')][_0x0faa('0x41')]){_0x3dbd61[_0x0faa('0x42')]=[{'all':!![]}];}_0x3dbd61=_[_0x0faa('0x3e')]({},_0x3dbd61,_0xe26019['options']);return db['AnalyticTreeReport'][_0x0faa('0x48')](_0x3dbd61)[_0x0faa('0x24')](handleEntityNotFound(_0x32ffaf,null))[_0x0faa('0x24')](respondWithResult(_0x32ffaf,null))[_0x0faa('0x45')](handleError(_0x32ffaf,null));};exports[_0x0faa('0x49')]=function(_0xfb3f3d,_0x44ff5e){return db[_0x0faa('0x2c')][_0x0faa('0x49')](_0xfb3f3d[_0x0faa('0x4a')],{})[_0x0faa('0x24')](respondWithResult(_0x44ff5e,0xc9))[_0x0faa('0x45')](handleError(_0x44ff5e,null));};exports[_0x0faa('0x23')]=function(_0x40d870,_0x187064){if(_0x40d870['body']['id']){delete _0x40d870['body']['id'];}return db[_0x0faa('0x2c')][_0x0faa('0x48')]({'where':{'id':_0x40d870['params']['id']}})[_0x0faa('0x24')](handleEntityNotFound(_0x187064,null))['then'](saveUpdates(_0x40d870[_0x0faa('0x4a')],null))[_0x0faa('0x24')](respondWithResult(_0x187064,null))[_0x0faa('0x45')](handleError(_0x187064,null));};exports[_0x0faa('0x25')]=function(_0x29bfc4,_0x36ec95){return db[_0x0faa('0x2c')][_0x0faa('0x48')]({'where':{'id':_0x29bfc4[_0x0faa('0x46')]['id']}})['then'](handleEntityNotFound(_0x36ec95,null))[_0x0faa('0x24')](removeEntity(_0x36ec95,null))[_0x0faa('0x45')](handleError(_0x36ec95,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a9f9b12..adfc100 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 _0xe2e2=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','bluebird'];(function(_0x62ee48,_0x383ffc){var _0x39df44=function(_0x337e10){while(--_0x337e10){_0x62ee48['push'](_0x62ee48['shift']());}};_0x39df44(++_0x383ffc);}(_0xe2e2,0x17b));var _0x2e2e=function(_0x199c55,_0x167d19){_0x199c55=_0x199c55-0x0;var _0x592b02=_0xe2e2[_0x199c55];return _0x592b02;};'use strict';var _=require(_0x2e2e('0x0'));var util=require(_0x2e2e('0x1'));var logger=require(_0x2e2e('0x2'))(_0x2e2e('0x3'));var moment=require('moment');var BPromise=require(_0x2e2e('0x4'));var rp=require(_0x2e2e('0x5'));var fs=require('fs');var path=require(_0x2e2e('0x6'));var rimraf=require(_0x2e2e('0x7'));var config=require(_0x2e2e('0x8'));var attributes=require(_0x2e2e('0x9'));module[_0x2e2e('0xa')]=function(_0x2b76ad,_0x43d5f4){return _0x2b76ad['define']('AnalyticTreeReport',attributes,{'tableName':_0x2e2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88a0=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x88a0,0x89));var _0x088a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x88a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x088a('0x0'));var util=require(_0x088a('0x1'));var logger=require(_0x088a('0x2'))(_0x088a('0x3'));var moment=require(_0x088a('0x4'));var BPromise=require(_0x088a('0x5'));var rp=require(_0x088a('0x6'));var fs=require('fs');var path=require(_0x088a('0x7'));var rimraf=require(_0x088a('0x8'));var config=require(_0x088a('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0x088a('0xa')]=function(_0x3dc2f,_0x131d80){return _0x3dc2f[_0x088a('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0x088a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 47942dc..e8b86bc 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(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xadb5,0xad));var _0x5adb=function(_0x39f212,_0x26826d){_0x39f212=_0x39f212-0x0;var _0x57fd33=_0xadb5[_0x39f212];return _0x57fd33;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x22a53f,_0x135849){var _0x507733=function(_0xb0b5c){while(--_0xb0b5c){_0x22a53f['push'](_0x22a53f['shift']());}};_0x507733(++_0x135849);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2826c6,_0x481561){_0x2826c6=_0x2826c6-0x0;var _0x2f1996=_0x5f2f[_0x2826c6];return _0x2f1996;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e5163c4..39a40b1 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 _0x1d6d=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x290f7a,_0x45e5a6){var _0x8292c4=function(_0xb7d9f4){while(--_0xb7d9f4){_0x290f7a['push'](_0x290f7a['shift']());}};_0x8292c4(++_0x45e5a6);}(_0x1d6d,0xf8));var _0xd1d6=function(_0x7910d0,_0x171616){_0x7910d0=_0x7910d0-0x0;var _0x50c58b=_0x1d6d[_0x7910d0];return _0x50c58b;};'use strict';var multer=require(_0xd1d6('0x0'));var util=require(_0xd1d6('0x1'));var path=require('path');var timeout=require(_0xd1d6('0x2'));var express=require(_0xd1d6('0x3'));var router=express['Router']();var fs_extra=require(_0xd1d6('0x4'));var auth=require(_0xd1d6('0x5'));var interaction=require(_0xd1d6('0x6'));var config=require(_0xd1d6('0x7'));var controller=require(_0xd1d6('0x8'));router[_0xd1d6('0x9')]('/',auth[_0xd1d6('0xa')](),controller[_0xd1d6('0xb')]);router[_0xd1d6('0x9')](_0xd1d6('0xc'),auth['isAuthenticated'](),controller[_0xd1d6('0xd')]);router[_0xd1d6('0xe')]('/',auth['isAuthenticated'](),controller[_0xd1d6('0xf')]);router['put'](_0xd1d6('0xc'),auth[_0xd1d6('0xa')](),controller[_0xd1d6('0x10')]);router[_0xd1d6('0x11')](_0xd1d6('0xc'),auth[_0xd1d6('0xa')](),controller[_0xd1d6('0x12')]);module[_0xd1d6('0x13')]=router; \ No newline at end of file +var _0x0a19=['create','put','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x31ddba,_0x28ec26){var _0x3f014c=function(_0x24aa10){while(--_0x24aa10){_0x31ddba['push'](_0x31ddba['shift']());}};_0x3f014c(++_0x28ec26);}(_0x0a19,0xed));var _0x90a1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x0a19[_0x5f309e];return _0x487b5e;};'use strict';var multer=require('multer');var util=require(_0x90a1('0x0'));var path=require('path');var timeout=require(_0x90a1('0x1'));var express=require('express');var router=express[_0x90a1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x90a1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x90a1('0x4'));var controller=require('./analyticTreeReport.controller');router[_0x90a1('0x5')]('/',auth[_0x90a1('0x6')](),controller[_0x90a1('0x7')]);router['get'](_0x90a1('0x8'),auth[_0x90a1('0x6')](),controller[_0x90a1('0x9')]);router['post']('/',auth[_0x90a1('0x6')](),controller[_0x90a1('0xa')]);router[_0x90a1('0xb')](_0x90a1('0x8'),auth[_0x90a1('0x6')](),controller['update']);router['delete'](_0x90a1('0x8'),auth[_0x90a1('0x6')](),controller[_0x90a1('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 22acda8..a109e16 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 _0x8743=['exports','STRING','sequelize'];(function(_0x4ba3c4,_0x24842d){var _0x2b6605=function(_0xc2698f){while(--_0xc2698f){_0x4ba3c4['push'](_0x4ba3c4['shift']());}};_0x2b6605(++_0x24842d);}(_0x8743,0x7a));var _0x3874=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8743[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'name':{'type':Sequelize[_0x3874('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3874('0x2')]}}; \ No newline at end of file +var _0x4fde=['STRING','sequelize','exports'];(function(_0x47b8b9,_0x49c17a){var _0x1cc8e6=function(_0x4c7689){while(--_0x4c7689){_0x47b8b9['push'](_0x47b8b9['shift']());}};_0x1cc8e6(++_0x49c17a);}(_0x4fde,0x19f));var _0xe4fd=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x4fde[_0x5ecadc];return _0x565037;};'use strict';var Sequelize=require(_0xe4fd('0x0'));module[_0xe4fd('0x1')]={'name':{'type':Sequelize[_0xe4fd('0x2')]},'basename':{'type':Sequelize[_0xe4fd('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 a092102..c5cf6ef 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 _0x9512=['where','merge','filter','includeAll','include','findAll','rows','catch','length','options','find','clone','params','get','omit','updatedAt','body','createdAt','update','file','originalname','basename','create','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','error','name','index','Attachment','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x52740f,_0x343961){var _0x1cbe11=function(_0x376976){while(--_0x376976){_0x52740f['push'](_0x52740f['shift']());}};_0x1cbe11(++_0x343961);}(_0x9512,0x10c));var _0x2951=function(_0x36f2b2,_0x4dea08){_0x36f2b2=_0x36f2b2-0x0;var _0x4a0f99=_0x9512[_0x36f2b2];return _0x4a0f99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2951('0x0'));var zipdir=require(_0x2951('0x1'));var jsonpatch=require(_0x2951('0x2'));var rp=require(_0x2951('0x3'));var moment=require(_0x2951('0x4'));var BPromise=require(_0x2951('0x5'));var Mustache=require('mustache');var util=require(_0x2951('0x6'));var path=require(_0x2951('0x7'));var sox=require('sox');var csv=require(_0x2951('0x8'));var ejs=require(_0x2951('0x9'));var fs=require('fs');var fs_extra=require(_0x2951('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2951('0xb'));var deskjs=require(_0x2951('0xc'));var toCsv=require(_0x2951('0x8'));var querystring=require(_0x2951('0xd'));var Papa=require(_0x2951('0xe'));var Redis=require('ioredis');var authService=require(_0x2951('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2951('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2951('0x11'));var utils=require(_0x2951('0x12'));var config=require(_0x2951('0x13'));var licenseUtil=require(_0x2951('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5817fc,_0x49789f){_0x49789f=_0x49789f||0xcc;return function(_0x5b6ad4){if(_0x5b6ad4){return _0x5817fc[_0x2951('0x15')](_0x49789f);}return _0x5817fc[_0x2951('0x16')](_0x49789f)['end']();};}function respondWithResult(_0x4dd42b,_0x223a4d){_0x223a4d=_0x223a4d||0xc8;return function(_0x5b8789){if(_0x5b8789){return _0x4dd42b[_0x2951('0x16')](_0x223a4d)['json'](_0x5b8789);}};}function respondWithFilteredResult(_0x4c25cf,_0x2afc1e){return function(_0xae8f20){if(_0xae8f20){var _0x19d85f=typeof _0x2afc1e[_0x2951('0x17')]===_0x2951('0x18')&&typeof _0x2afc1e['limit']===_0x2951('0x18');var _0x9f560d=_0xae8f20[_0x2951('0x19')];var _0x13141a=_0x19d85f?0x0:_0x2afc1e[_0x2951('0x17')];var _0x575da8=_0x19d85f?_0xae8f20[_0x2951('0x19')]:_0x2afc1e[_0x2951('0x17')]+_0x2afc1e[_0x2951('0x1a')];var _0x152ade;if(_0x575da8>=_0x9f560d){_0x575da8=_0x9f560d;_0x152ade=0xc8;}else{_0x152ade=0xce;}_0x4c25cf[_0x2951('0x16')](_0x152ade);return _0x4c25cf[_0x2951('0x1b')](_0x2951('0x1c'),_0x13141a+'-'+_0x575da8+'/'+_0x9f560d)['json'](_0xae8f20);}return null;};}function patchUpdates(_0x4efadd){return function(_0x21f03c){try{jsonpatch[_0x2951('0x1d')](_0x21f03c,_0x4efadd,!![]);}catch(_0xafa8b9){return BPromise['reject'](_0xafa8b9);}return _0x21f03c[_0x2951('0x1e')]();};}function saveUpdates(_0x215e15,_0x2973e8){return function(_0x1e7234){if(_0x1e7234){return _0x1e7234['update'](_0x215e15)[_0x2951('0x1f')](function(_0x3e5e3d){return _0x3e5e3d;});}return null;};}function removeEntity(_0x491411,_0x4e4936){return function(_0x794f5){if(_0x794f5){return _0x794f5[_0x2951('0x20')]()[_0x2951('0x1f')](function(){_0x491411[_0x2951('0x16')](0xcc)[_0x2951('0x21')]();});}};}function handleEntityNotFound(_0x2acf63,_0x3af701){return function(_0x5c4987){if(!_0x5c4987){_0x2acf63[_0x2951('0x15')](0x194);}return _0x5c4987;};}function handleError(_0x10fefd,_0x5204f3){_0x5204f3=_0x5204f3||0x1f4;return function(_0x55e129){logger[_0x2951('0x22')](_0x55e129['stack']);if(_0x55e129[_0x2951('0x23')]){delete _0x55e129[_0x2951('0x23')];}_0x10fefd['status'](_0x5204f3)['send'](_0x55e129);};}exports[_0x2951('0x24')]=function(_0x3f2e74,_0x124c8b){var _0x3f936e={},_0x258be7={},_0x30fd2a={'count':0x0,'rows':[]};var _0x12c2f9=_['map'](db[_0x2951('0x25')][_0x2951('0x26')],function(_0x469270){return{'name':_0x469270[_0x2951('0x27')],'type':_0x469270[_0x2951('0x28')][_0x2951('0x29')]};});_0x258be7[_0x2951('0x2a')]=_[_0x2951('0x2b')](_0x12c2f9,'name');_0x258be7['query']=_[_0x2951('0x2c')](_0x3f2e74[_0x2951('0x2d')]);_0x258be7[_0x2951('0x2e')]=_[_0x2951('0x2f')](_0x258be7[_0x2951('0x2a')],_0x258be7[_0x2951('0x2d')]);_0x3f936e[_0x2951('0x30')]=_[_0x2951('0x2f')](_0x258be7['model'],qs[_0x2951('0x31')](_0x3f2e74[_0x2951('0x2d')][_0x2951('0x31')]));_0x3f936e[_0x2951('0x30')]=_0x3f936e[_0x2951('0x30')]['length']?_0x3f936e[_0x2951('0x30')]:_0x258be7['model'];if(!_0x3f2e74['query'][_0x2951('0x32')]('nolimit')){_0x3f936e[_0x2951('0x1a')]=qs[_0x2951('0x1a')](_0x3f2e74[_0x2951('0x2d')]['limit']);_0x3f936e[_0x2951('0x17')]=qs['offset'](_0x3f2e74[_0x2951('0x2d')]['offset']);}_0x3f936e['order']=qs[_0x2951('0x33')](_0x3f2e74[_0x2951('0x2d')][_0x2951('0x33')]);_0x3f936e[_0x2951('0x34')]=qs[_0x2951('0x2e')](_['pick'](_0x3f2e74[_0x2951('0x2d')],_0x258be7['filters']),_0x12c2f9);if(_0x3f2e74['query']['filter']){_0x3f936e[_0x2951('0x34')]=_[_0x2951('0x35')](_0x3f936e['where'],{'$or':_[_0x2951('0x2b')](_0x12c2f9,function(_0x5f2dd3){if(_0x5f2dd3[_0x2951('0x28')]!=='VIRTUAL'){var _0x565832={};_0x565832[_0x5f2dd3[_0x2951('0x23')]]={'$like':'%'+_0x3f2e74[_0x2951('0x2d')][_0x2951('0x36')]+'%'};return _0x565832;}})});}_0x3f936e=_['merge']({},_0x3f936e,_0x3f2e74['options']);var _0x19b3f9={'where':_0x3f936e['where']};return db[_0x2951('0x25')][_0x2951('0x19')](_0x19b3f9)[_0x2951('0x1f')](function(_0xfb67dc){_0x30fd2a[_0x2951('0x19')]=_0xfb67dc;if(_0x3f2e74[_0x2951('0x2d')][_0x2951('0x37')]){_0x3f936e[_0x2951('0x38')]=[{'all':!![]}];}return db[_0x2951('0x25')][_0x2951('0x39')](_0x3f936e);})[_0x2951('0x1f')](function(_0x55ccab){_0x30fd2a[_0x2951('0x3a')]=_0x55ccab;return _0x30fd2a;})[_0x2951('0x1f')](respondWithFilteredResult(_0x124c8b,_0x3f936e))[_0x2951('0x3b')](handleError(_0x124c8b,null));};exports['show']=function(_0x24fc13,_0x30b045){var _0x2fb0a4={'raw':!![],'where':{'id':_0x24fc13['params']['id']}},_0x569772={};_0x569772[_0x2951('0x2a')]=_['keys'](db[_0x2951('0x25')][_0x2951('0x26')]);_0x569772[_0x2951('0x2d')]=_['keys'](_0x24fc13[_0x2951('0x2d')]);_0x569772[_0x2951('0x2e')]=_[_0x2951('0x2f')](_0x569772['model'],_0x569772['query']);_0x2fb0a4[_0x2951('0x30')]=_[_0x2951('0x2f')](_0x569772['model'],qs[_0x2951('0x31')](_0x24fc13[_0x2951('0x2d')][_0x2951('0x31')]));_0x2fb0a4[_0x2951('0x30')]=_0x2fb0a4[_0x2951('0x30')][_0x2951('0x3c')]?_0x2fb0a4[_0x2951('0x30')]:_0x569772[_0x2951('0x2a')];if(_0x24fc13[_0x2951('0x2d')][_0x2951('0x37')]){_0x2fb0a4[_0x2951('0x38')]=[{'all':!![]}];}_0x2fb0a4=_[_0x2951('0x35')]({},_0x2fb0a4,_0x24fc13[_0x2951('0x3d')]);return db[_0x2951('0x25')][_0x2951('0x3e')](_0x2fb0a4)[_0x2951('0x1f')](handleEntityNotFound(_0x30b045,null))[_0x2951('0x1f')](respondWithResult(_0x30b045,null))['catch'](handleError(_0x30b045,null));};exports[_0x2951('0x3f')]=function(_0x2917c1,_0x504aa6){var _0x4af606={'where':{'id':_0x2917c1[_0x2951('0x40')]['id']}},_0x54972a={};_0x54972a[_0x2951('0x2a')]=_[_0x2951('0x2c')](db[_0x2951('0x25')][_0x2951('0x26')]);_0x4af606['attributes']=_[_0x2951('0x2f')](_0x54972a[_0x2951('0x2a')],qs['fields'](_0x2917c1['query'][_0x2951('0x31')]));_0x4af606[_0x2951('0x30')]=_0x4af606['attributes']['length']?_0x4af606['attributes']:_0x54972a['model'];if(_0x2917c1[_0x2951('0x2d')][_0x2951('0x37')]){_0x4af606['include']=[{'all':!![]}];}_0x4af606=_['merge']({},_0x4af606,_0x2917c1['options']);return db[_0x2951('0x25')][_0x2951('0x3e')](_0x4af606)[_0x2951('0x1f')](handleEntityNotFound(_0x504aa6,null))[_0x2951('0x1f')](function(_0x3a0d3e){if(_0x3a0d3e){var _0x420b6=_0x3a0d3e[_0x2951('0x41')]({'plain':!![]});_0x420b6=qs[_0x2951('0x42')](_0x420b6,['id','createdAt',_0x2951('0x43')]);_0x2917c1[_0x2951('0x44')]=_[_0x2951('0x42')](_0x2917c1[_0x2951('0x44')],['id',_0x2951('0x45'),_0x2951('0x43')]);return db[_0x2951('0x25')]['create'](_[_0x2951('0x35')](_0x420b6,_0x2917c1[_0x2951('0x44')]),{'include':_0x2917c1[_0x2951('0x2d')][_0x2951('0x37')]?[{'all':!![]}]:undefined});}})[_0x2951('0x1f')](respondWithResult(_0x504aa6,0xc9))['catch'](handleError(_0x504aa6,null));};exports[_0x2951('0x46')]=function(_0x1657fb,_0x3a86ff){if(_0x1657fb[_0x2951('0x44')]['id']){delete _0x1657fb[_0x2951('0x44')]['id'];}return db[_0x2951('0x25')]['find']({'where':{'id':_0x1657fb[_0x2951('0x40')]['id']}})[_0x2951('0x1f')](handleEntityNotFound(_0x3a86ff,null))[_0x2951('0x1f')](saveUpdates(_0x1657fb[_0x2951('0x44')],null))['then'](respondWithResult(_0x3a86ff,null))[_0x2951('0x3b')](handleError(_0x3a86ff,null));};exports[_0x2951('0x20')]=function(_0x3c675,_0x49a66e){return db[_0x2951('0x25')][_0x2951('0x3e')]({'where':{'id':_0x3c675['params']['id']}})['then'](handleEntityNotFound(_0x49a66e,null))['then'](removeEntity(_0x49a66e,null))[_0x2951('0x3b')](handleError(_0x49a66e,null));};exports['create']=function(_0x399132,_0x2e563c,_0x326b43){_0x399132[_0x2951('0x44')][_0x2951('0x23')]=_0x399132[_0x2951('0x47')][_0x2951('0x48')];_0x399132['body'][_0x2951('0x49')]=_0x399132[_0x2951('0x47')]['filename'];_0x399132[_0x2951('0x44')]['type']=_0x399132[_0x2951('0x47')]['mimetype'];return db[_0x2951('0x25')][_0x2951('0x4a')](_0x399132['body'])[_0x2951('0x1f')](respondWithResult(_0x2e563c,0xc9))[_0x2951('0x3b')](handleError(_0x2e563c,null));};exports[_0x2951('0x4b')]=function(_0x4745bf,_0x1937ca,_0xd070ce){return db[_0x2951('0x25')][_0x2951('0x4c')]({'where':{'id':_0x4745bf['params']['id']},'raw':!![]})[_0x2951('0x1f')](handleEntityNotFound(_0x1937ca,null))[_0x2951('0x1f')](function(_0x520998){if(_0x520998){var _0x37d85f=_0x520998[_0x2951('0x4d')]!==null;var _0x3e778e=path['join'](config['root'],_0x2951('0x4e'));if(_0x37d85f){_0x3e778e=path[_0x2951('0x4f')](_0x3e778e,'offline-chat/');}var _0x49ceb4=path[_0x2951('0x4f')](_0x3e778e,_0x520998[_0x2951('0x49')]);return _0x1937ca['download'](_0x49ceb4);}})[_0x2951('0x3b')](handleError(_0x1937ca,null));}; \ No newline at end of file +var _0xd33f=['path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range','json','reject','save','update','destroy','error','stack','name','index','map','Attachment','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','then','findAll','rows','catch','rawAttributes','keys','includeAll','include','find','clone','params','get','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','ChatOfflineMessageId','root','join','offline-chat/','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x3c0569,_0x11da9f){var _0x142524=function(_0x59a41e){while(--_0x59a41e){_0x3c0569['push'](_0x3c0569['shift']());}};_0x142524(++_0x11da9f);}(_0xd33f,0x1f2));var _0xfd33=function(_0x461250,_0x5ea58e){_0x461250=_0x461250-0x0;var _0x1eb54e=_0xd33f[_0x461250];return _0x1eb54e;};'use strict';var emlformat=require(_0xfd33('0x0'));var rimraf=require(_0xfd33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd33('0x2'));var rp=require('request-promise');var moment=require(_0xfd33('0x3'));var BPromise=require(_0xfd33('0x4'));var Mustache=require('mustache');var util=require(_0xfd33('0x5'));var path=require(_0xfd33('0x6'));var sox=require(_0xfd33('0x7'));var csv=require('to-csv');var ejs=require(_0xfd33('0x8'));var fs=require('fs');var fs_extra=require(_0xfd33('0x9'));var _=require(_0xfd33('0xa'));var squel=require(_0xfd33('0xb'));var crypto=require('crypto');var jsforce=require(_0xfd33('0xc'));var deskjs=require(_0xfd33('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfd33('0xe'));var Papa=require(_0xfd33('0xf'));var Redis=require('ioredis');var authService=require(_0xfd33('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd33('0x11'));var logger=require(_0xfd33('0x12'))('api');var utils=require(_0xfd33('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd33('0x14'));var db=require(_0xfd33('0x15'))['db'];function respondWithStatusCode(_0xd85b6a,_0x371b0a){_0x371b0a=_0x371b0a||0xcc;return function(_0x4ec43f){if(_0x4ec43f){return _0xd85b6a[_0xfd33('0x16')](_0x371b0a);}return _0xd85b6a['status'](_0x371b0a)[_0xfd33('0x17')]();};}function respondWithResult(_0x2aaa7c,_0x4ecbac){_0x4ecbac=_0x4ecbac||0xc8;return function(_0x1bd94a){if(_0x1bd94a){return _0x2aaa7c[_0xfd33('0x18')](_0x4ecbac)['json'](_0x1bd94a);}};}function respondWithFilteredResult(_0x40c6a3,_0x19c547){return function(_0x452873){if(_0x452873){var _0x5cc1a1=typeof _0x19c547[_0xfd33('0x19')]===_0xfd33('0x1a')&&typeof _0x19c547['limit']===_0xfd33('0x1a');var _0x1cf7c3=_0x452873['count'];var _0x17ebcb=_0x5cc1a1?0x0:_0x19c547[_0xfd33('0x19')];var _0x3ba000=_0x5cc1a1?_0x452873[_0xfd33('0x1b')]:_0x19c547[_0xfd33('0x19')]+_0x19c547['limit'];var _0x56e523;if(_0x3ba000>=_0x1cf7c3){_0x3ba000=_0x1cf7c3;_0x56e523=0xc8;}else{_0x56e523=0xce;}_0x40c6a3[_0xfd33('0x18')](_0x56e523);return _0x40c6a3['set'](_0xfd33('0x1c'),_0x17ebcb+'-'+_0x3ba000+'/'+_0x1cf7c3)[_0xfd33('0x1d')](_0x452873);}return null;};}function patchUpdates(_0x50935c){return function(_0x355e7b){try{jsonpatch['apply'](_0x355e7b,_0x50935c,!![]);}catch(_0x154234){return BPromise[_0xfd33('0x1e')](_0x154234);}return _0x355e7b[_0xfd33('0x1f')]();};}function saveUpdates(_0x47bcf5,_0x434d83){return function(_0x3820f4){if(_0x3820f4){return _0x3820f4[_0xfd33('0x20')](_0x47bcf5)['then'](function(_0x4f4282){return _0x4f4282;});}return null;};}function removeEntity(_0x5c1bc7,_0x45b3d5){return function(_0x4cb835){if(_0x4cb835){return _0x4cb835[_0xfd33('0x21')]()['then'](function(){_0x5c1bc7[_0xfd33('0x18')](0xcc)[_0xfd33('0x17')]();});}};}function handleEntityNotFound(_0x2bcdbc,_0x171d70){return function(_0x125999){if(!_0x125999){_0x2bcdbc[_0xfd33('0x16')](0x194);}return _0x125999;};}function handleError(_0x4805eb,_0x24289b){_0x24289b=_0x24289b||0x1f4;return function(_0x273896){logger[_0xfd33('0x22')](_0x273896[_0xfd33('0x23')]);if(_0x273896[_0xfd33('0x24')]){delete _0x273896[_0xfd33('0x24')];}_0x4805eb[_0xfd33('0x18')](_0x24289b)['send'](_0x273896);};}exports[_0xfd33('0x25')]=function(_0x9ea675,_0x50211e){var _0xc63941={},_0x13cc76={},_0x36fe2a={'count':0x0,'rows':[]};var _0x47b641=_[_0xfd33('0x26')](db[_0xfd33('0x27')]['rawAttributes'],function(_0x2b0a32){return{'name':_0x2b0a32[_0xfd33('0x28')],'type':_0x2b0a32[_0xfd33('0x29')][_0xfd33('0x2a')]};});_0x13cc76['model']=_[_0xfd33('0x26')](_0x47b641,'name');_0x13cc76[_0xfd33('0x2b')]=_['keys'](_0x9ea675[_0xfd33('0x2b')]);_0x13cc76[_0xfd33('0x2c')]=_[_0xfd33('0x2d')](_0x13cc76[_0xfd33('0x2e')],_0x13cc76[_0xfd33('0x2b')]);_0xc63941[_0xfd33('0x2f')]=_['intersection'](_0x13cc76[_0xfd33('0x2e')],qs[_0xfd33('0x30')](_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x30')]));_0xc63941[_0xfd33('0x2f')]=_0xc63941[_0xfd33('0x2f')][_0xfd33('0x31')]?_0xc63941[_0xfd33('0x2f')]:_0x13cc76[_0xfd33('0x2e')];if(!_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x32')](_0xfd33('0x33'))){_0xc63941[_0xfd33('0x34')]=qs[_0xfd33('0x34')](_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x34')]);_0xc63941[_0xfd33('0x19')]=qs[_0xfd33('0x19')](_0x9ea675['query']['offset']);}_0xc63941['order']=qs[_0xfd33('0x35')](_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x35')]);_0xc63941[_0xfd33('0x36')]=qs[_0xfd33('0x2c')](_[_0xfd33('0x37')](_0x9ea675[_0xfd33('0x2b')],_0x13cc76[_0xfd33('0x2c')]),_0x47b641);if(_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x38')]){_0xc63941[_0xfd33('0x36')]=_[_0xfd33('0x39')](_0xc63941[_0xfd33('0x36')],{'$or':_[_0xfd33('0x26')](_0x47b641,function(_0x23e096){if(_0x23e096[_0xfd33('0x29')]!=='VIRTUAL'){var _0x1782b3={};_0x1782b3[_0x23e096[_0xfd33('0x24')]]={'$like':'%'+_0x9ea675[_0xfd33('0x2b')][_0xfd33('0x38')]+'%'};return _0x1782b3;}})});}_0xc63941=_[_0xfd33('0x39')]({},_0xc63941,_0x9ea675[_0xfd33('0x3a')]);var _0x53ce88={'where':_0xc63941['where']};return db[_0xfd33('0x27')]['count'](_0x53ce88)[_0xfd33('0x3b')](function(_0x2f055c){_0x36fe2a[_0xfd33('0x1b')]=_0x2f055c;if(_0x9ea675['query']['includeAll']){_0xc63941['include']=[{'all':!![]}];}return db[_0xfd33('0x27')][_0xfd33('0x3c')](_0xc63941);})[_0xfd33('0x3b')](function(_0x5d9859){_0x36fe2a[_0xfd33('0x3d')]=_0x5d9859;return _0x36fe2a;})[_0xfd33('0x3b')](respondWithFilteredResult(_0x50211e,_0xc63941))[_0xfd33('0x3e')](handleError(_0x50211e,null));};exports['show']=function(_0x937ad3,_0x47cef1){var _0x983b8a={'raw':!![],'where':{'id':_0x937ad3['params']['id']}},_0x294cfc={};_0x294cfc[_0xfd33('0x2e')]=_['keys'](db[_0xfd33('0x27')][_0xfd33('0x3f')]);_0x294cfc[_0xfd33('0x2b')]=_[_0xfd33('0x40')](_0x937ad3['query']);_0x294cfc[_0xfd33('0x2c')]=_[_0xfd33('0x2d')](_0x294cfc[_0xfd33('0x2e')],_0x294cfc[_0xfd33('0x2b')]);_0x983b8a[_0xfd33('0x2f')]=_[_0xfd33('0x2d')](_0x294cfc[_0xfd33('0x2e')],qs[_0xfd33('0x30')](_0x937ad3[_0xfd33('0x2b')][_0xfd33('0x30')]));_0x983b8a[_0xfd33('0x2f')]=_0x983b8a['attributes'][_0xfd33('0x31')]?_0x983b8a['attributes']:_0x294cfc[_0xfd33('0x2e')];if(_0x937ad3[_0xfd33('0x2b')][_0xfd33('0x41')]){_0x983b8a[_0xfd33('0x42')]=[{'all':!![]}];}_0x983b8a=_[_0xfd33('0x39')]({},_0x983b8a,_0x937ad3[_0xfd33('0x3a')]);return db[_0xfd33('0x27')][_0xfd33('0x43')](_0x983b8a)[_0xfd33('0x3b')](handleEntityNotFound(_0x47cef1,null))[_0xfd33('0x3b')](respondWithResult(_0x47cef1,null))[_0xfd33('0x3e')](handleError(_0x47cef1,null));};exports[_0xfd33('0x44')]=function(_0xfeeb57,_0x108966){var _0x7e5b61={'where':{'id':_0xfeeb57[_0xfd33('0x45')]['id']}},_0x4a7c9f={};_0x4a7c9f[_0xfd33('0x2e')]=_[_0xfd33('0x40')](db[_0xfd33('0x27')]['rawAttributes']);_0x7e5b61[_0xfd33('0x2f')]=_[_0xfd33('0x2d')](_0x4a7c9f[_0xfd33('0x2e')],qs[_0xfd33('0x30')](_0xfeeb57[_0xfd33('0x2b')]['fields']));_0x7e5b61['attributes']=_0x7e5b61['attributes']['length']?_0x7e5b61[_0xfd33('0x2f')]:_0x4a7c9f['model'];if(_0xfeeb57[_0xfd33('0x2b')][_0xfd33('0x41')]){_0x7e5b61['include']=[{'all':!![]}];}_0x7e5b61=_[_0xfd33('0x39')]({},_0x7e5b61,_0xfeeb57['options']);return db[_0xfd33('0x27')]['find'](_0x7e5b61)['then'](handleEntityNotFound(_0x108966,null))[_0xfd33('0x3b')](function(_0x290eba){if(_0x290eba){var _0x2acc10=_0x290eba[_0xfd33('0x46')]({'plain':!![]});_0x2acc10=qs['omit'](_0x2acc10,['id',_0xfd33('0x47'),_0xfd33('0x48')]);_0xfeeb57['body']=_['omit'](_0xfeeb57[_0xfd33('0x49')],['id',_0xfd33('0x47'),'updatedAt']);return db[_0xfd33('0x27')]['create'](_[_0xfd33('0x39')](_0x2acc10,_0xfeeb57[_0xfd33('0x49')]),{'include':_0xfeeb57[_0xfd33('0x2b')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xfd33('0x3b')](respondWithResult(_0x108966,0xc9))[_0xfd33('0x3e')](handleError(_0x108966,null));};exports['update']=function(_0x491b1c,_0x4ca087){if(_0x491b1c[_0xfd33('0x49')]['id']){delete _0x491b1c[_0xfd33('0x49')]['id'];}return db[_0xfd33('0x27')][_0xfd33('0x43')]({'where':{'id':_0x491b1c[_0xfd33('0x45')]['id']}})[_0xfd33('0x3b')](handleEntityNotFound(_0x4ca087,null))[_0xfd33('0x3b')](saveUpdates(_0x491b1c[_0xfd33('0x49')],null))[_0xfd33('0x3b')](respondWithResult(_0x4ca087,null))['catch'](handleError(_0x4ca087,null));};exports[_0xfd33('0x21')]=function(_0x5e1484,_0xd38f93){return db[_0xfd33('0x27')][_0xfd33('0x43')]({'where':{'id':_0x5e1484[_0xfd33('0x45')]['id']}})['then'](handleEntityNotFound(_0xd38f93,null))[_0xfd33('0x3b')](removeEntity(_0xd38f93,null))[_0xfd33('0x3e')](handleError(_0xd38f93,null));};exports[_0xfd33('0x4a')]=function(_0xfea2b7,_0x229620,_0x1d73e5){_0xfea2b7['body']['name']=_0xfea2b7[_0xfd33('0x4b')]['originalname'];_0xfea2b7['body'][_0xfd33('0x4c')]=_0xfea2b7['file'][_0xfd33('0x4d')];_0xfea2b7[_0xfd33('0x49')]['type']=_0xfea2b7['file'][_0xfd33('0x4e')];return db['Attachment'][_0xfd33('0x4a')](_0xfea2b7['body'])[_0xfd33('0x3b')](respondWithResult(_0x229620,0xc9))[_0xfd33('0x3e')](handleError(_0x229620,null));};exports[_0xfd33('0x4f')]=function(_0x1c9a7e,_0x5beff9,_0x5db0e0){return db[_0xfd33('0x27')]['findOne']({'where':{'id':_0x1c9a7e[_0xfd33('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5beff9,null))[_0xfd33('0x3b')](function(_0x50c88d){if(_0x50c88d){var _0x5c0430=_0x50c88d[_0xfd33('0x50')]!==null;var _0x1bb1e2=path['join'](config[_0xfd33('0x51')],'server/files/attachments/');if(_0x5c0430){_0x1bb1e2=path[_0xfd33('0x52')](_0x1bb1e2,_0xfd33('0x53'));}var _0x13c425=path['join'](_0x1bb1e2,_0x50c88d[_0xfd33('0x4c')]);return _0x5beff9[_0xfd33('0x4f')](_0x13c425);}})[_0xfd33('0x3e')](handleError(_0x5beff9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8e5eb5a..7e187d7 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 _0x4db4=['../../config/logger','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','attachments','lodash','util'];(function(_0x11973d,_0x68c443){var _0x2875e3=function(_0x597cda){while(--_0x597cda){_0x11973d['push'](_0x11973d['shift']());}};_0x2875e3(++_0x68c443);}(_0x4db4,0x120));var _0x44db=function(_0x290cd2,_0x3c81cc){_0x290cd2=_0x290cd2-0x0;var _0x572a5d=_0x4db4[_0x290cd2];return _0x572a5d;};'use strict';var _=require(_0x44db('0x0'));var util=require(_0x44db('0x1'));var logger=require(_0x44db('0x2'))('api');var moment=require('moment');var BPromise=require(_0x44db('0x3'));var rp=require(_0x44db('0x4'));var fs=require('fs');var path=require(_0x44db('0x5'));var rimraf=require('rimraf');var config=require(_0x44db('0x6'));var attributes=require(_0x44db('0x7'));module[_0x44db('0x8')]=function(_0x5cebe8,_0x1892ce){return _0x5cebe8['define']('Attachment',attributes,{'tableName':_0x44db('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8867=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','Attachment','attachments','lodash','util'];(function(_0x1475f6,_0x723bfb){var _0x24afd0=function(_0x4b71d8){while(--_0x4b71d8){_0x1475f6['push'](_0x1475f6['shift']());}};_0x24afd0(++_0x723bfb);}(_0x8867,0x106));var _0x7886=function(_0x2020ea,_0x26fc4f){_0x2020ea=_0x2020ea-0x0;var _0x3657fe=_0x8867[_0x2020ea];return _0x3657fe;};'use strict';var _=require(_0x7886('0x0'));var util=require(_0x7886('0x1'));var logger=require(_0x7886('0x2'))(_0x7886('0x3'));var moment=require(_0x7886('0x4'));var BPromise=require(_0x7886('0x5'));var rp=require(_0x7886('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7886('0x7'));var config=require(_0x7886('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0x320ad2,_0x509a27){return _0x320ad2['define'](_0x7886('0x9'),attributes,{'tableName':_0x7886('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 0d01780..e4e9010 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 _0x9567=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateAttachment','create','options','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x16f143,_0x813860){var _0x1fff62=function(_0x39edce){while(--_0x39edce){_0x16f143['push'](_0x16f143['shift']());}};_0x1fff62(++_0x813860);}(_0x9567,0xdc));var _0x7956=function(_0x227c3a,_0x44efb){_0x227c3a=_0x227c3a-0x0;var _0x1535e8=_0x9567[_0x227c3a];return _0x1535e8;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Attachment,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['Attachment'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateAttachment',_0x5e6b90);logger[_0x7956('0xd')]('CreateAttachment',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});}; \ No newline at end of file +var _0x3e25=['request\x20sent','debug','code','error','message','CreateAttachment','Attachment','body','raw','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x4a4668,_0x5d41a1){var _0x3480b6=function(_0x379774){while(--_0x379774){_0x4a4668['push'](_0x4a4668['shift']());}};_0x3480b6(++_0x5d41a1);}(_0x3e25,0x14f));var _0x53e2=function(_0x58afd6,_0x2718ca){_0x58afd6=_0x58afd6-0x0;var _0x325675=_0x3e25[_0x58afd6];return _0x325675;};'use strict';var _=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var moment=require(_0x53e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x53e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53e2('0x5'))(_0x53e2('0x6'));var config=require(_0x53e2('0x7'));var jayson=require(_0x53e2('0x8'));var client=jayson[_0x53e2('0x9')][_0x53e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1905b4,_0x31c0fa,_0x431bee){return new BPromise(function(_0x1be9ef,_0xf13761){return client[_0x53e2('0xb')](_0x1905b4,_0x431bee)[_0x53e2('0xc')](function(_0x1570dc){logger[_0x53e2('0xd')](_0x53e2('0xe'),_0x31c0fa,_0x53e2('0xf'));logger[_0x53e2('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x31c0fa,_0x53e2('0xf'),JSON['stringify'](_0x1570dc));if(_0x1570dc['error']){if(_0x1570dc['error'][_0x53e2('0x11')]===0x1f4){logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);return _0xf13761(_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);}logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x1570dc['error'][_0x53e2('0x13')]);return _0x1be9ef(_0x1570dc[_0x53e2('0x12')][_0x53e2('0x13')]);}else{logger[_0x53e2('0xd')](_0x53e2('0xe'),_0x31c0fa,_0x53e2('0xf'));_0x1be9ef(_0x1570dc['result'][_0x53e2('0x13')]);}})['catch'](function(_0x33b1cb){logger[_0x53e2('0x12')](_0x53e2('0xe'),_0x31c0fa,_0x33b1cb);_0xf13761(_0x33b1cb);});});}exports[_0x53e2('0x14')]=function(_0x52bae6){var _0x4213d0=this;return new Promise(function(_0x323e53,_0x4f313a){return db[_0x53e2('0x15')]['create'](_0x52bae6[_0x53e2('0x16')],{'raw':_0x52bae6['options']?_0x52bae6['options'][_0x53e2('0x17')]===undefined?!![]:![]:!![]})[_0x53e2('0xc')](function(_0x3454c9){logger[_0x53e2('0xd')]('CreateAttachment',_0x52bae6);logger[_0x53e2('0x10')](_0x53e2('0x14'),_0x52bae6,JSON['stringify'](_0x3454c9));_0x323e53(_0x3454c9);})[_0x53e2('0x18')](function(_0x51be71){logger[_0x53e2('0x12')](_0x53e2('0x14'),_0x51be71['message'],_0x52bae6);_0x4f313a(_0x4213d0[_0x53e2('0x12')](0x1f4,_0x51be71[_0x53e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6badcea..e5d1b43 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x5dcca0,_0x2e3385){var _0x522285=function(_0x1f36e0){while(--_0x1f36e0){_0x5dcca0['push'](_0x5dcca0['shift']());}};_0x522285(++_0x2e3385);}(_0xadb5,0xad));var _0x5adb=function(_0x5b45d9,_0x5cd565){_0x5b45d9=_0x5b45d9-0x0;var _0x13f65f=_0xadb5[_0x5b45d9];return _0x13f65f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _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(_0x4557b4,_0x753ab5){var _0x1a71a1=function(_0x3733d9){while(--_0x3733d9){_0x4557b4['push'](_0x4557b4['shift']());}};_0x1a71a1(++_0x753ab5);}(_0xb10b,0x12a));var _0xbb10=function(_0x141908,_0x4e61dc){_0x141908=_0x141908-0x0;var _0x37e9c9=_0xb10b[_0x141908];return _0x37e9c9;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 39d5733..93a5643 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 _0xa894=['disabled','online','admin','user','agent','then','blockDuration','blockedAt','add','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','passport','passport-local','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa894,0x1d6));var _0x4a89=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0xa894[_0x5d8987];return _0x2997eb;};'use strict';var passport=require(_0x4a89('0x0'));var LocalStrategy=require(_0x4a89('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x4a89('0x2'));var BPromise=require(_0x4a89('0x3'));var util=require(_0x4a89('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x4a89('0x5'));var utils=require(_0x4a89('0x6'));var config=require(_0x4a89('0x7'));var logger=require('../../config/logger')(_0x4a89('0x8'));function isActiveDirectoryConfigured(_0xe7bb63){var _0x7ddb6c=![];if(typeof _0xe7bb63[_0x4a89('0x9')]!==_0x4a89('0xa')){_0x7ddb6c=_0xe7bb63[_0x4a89('0x9')][_0x4a89('0xb')]&&_0xe7bb63[_0x4a89('0x9')]['url']&&_0xe7bb63['activedirectory'][_0x4a89('0xc')];}return _0x7ddb6c;}function adAuthenticate(_0x72d745,_0x1d21eb,_0xe47002){return new BPromise(function(_0x562940,_0x3b429f){try{var _0x109180=new ActiveDirectory(_0x72d745);_0x109180['authenticate'](_0x1d21eb,_0xe47002,function(_0x26cc65,_0x5530d3){if(_0x26cc65){logger[_0x4a89('0xd')](_0x4a89('0xe'),_0x1d21eb,util[_0x4a89('0xf')](_0x26cc65,{'showHidden':![],'depth':null}));_0x3b429f(_0x4a89('0x10'));}else if(!_0x5530d3){logger[_0x4a89('0xd')](_0x4a89('0x11'),_0x1d21eb);_0x3b429f(_0x4a89('0x10'));}else{_0x562940(_0x5530d3);}});}catch(_0x4b1c63){_0x3b429f(_0x4b1c63);}});}function ActiveDirectoryAuthenticate(_0x4a147a,_0x1daf5e,_0x3c48d7,_0x34858c){var _0x1a2b83,_0x1f2762;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4a89('0x12'),_0x1daf5e);return _0x34858c(null,![],{'message':_0x4a89('0x10')});}return db['Setting'][_0x4a89('0x13')]({'where':{'id':0x1},'attributes':[_0x4a89('0x14'),'blockDuration'],'raw':!![]})['then'](function(_0x1c6e23){_0x1a2b83=_0x1c6e23;if(!_0x1a2b83[_0x4a89('0x14')]){logger[_0x4a89('0xd')](_0x4a89('0x15'),_0x1daf5e);throw new Error(_0x4a89('0x10'));}return _0x4a147a[_0x4a89('0x13')]({'attributes':['id',_0x4a89('0x16'),_0x4a89('0x17'),_0x4a89('0x18'),'role',_0x4a89('0x19'),'blocked','blockedAt',_0x4a89('0x1a')],'where':{'name':_0x1daf5e,'role':{'$or':[_0x4a89('0x1b'),_0x4a89('0x1c'),_0x4a89('0x1d')]},'adSsoEnabled':!![]}});})['then'](function(_0x1c1261){if(!_0x1c1261||_0x1c1261&&_0x1c1261[_0x4a89('0x16')]!==_0x1daf5e){throw new Error(_0x4a89('0x10'));}_0x1f2762=_0x1c1261;var _0x561185=_0x1f2762['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x4a89('0x9')],_0x561185,_0x3c48d7);})[_0x4a89('0x1e')](function(_0x53eb09){if(_0x1f2762[_0x4a89('0x19')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1a2b83[_0x4a89('0x1f')]>0x0){if(_0x1f2762['blocked']){if(moment(_0x1f2762[_0x4a89('0x20')])[_0x4a89('0x21')](_0x1a2b83[_0x4a89('0x1f')],'minutes')>moment()){throw new Error(_0x4a89('0x10'));}return utils['clearBlockUser'](_0x1f2762,0x0,![],null)[_0x4a89('0x1e')](function(){return utils[_0x4a89('0x22')](_0x1f2762);})[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}else{return utils[_0x4a89('0x22')](_0x1f2762)[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}}else{return utils[_0x4a89('0x22')](_0x1f2762)[_0x4a89('0x1e')](function(){return _0x34858c(null,_0x1f2762);});}})[_0x4a89('0x23')](function(_0x3c8089){return _0x34858c(null,![],_0x3c8089);});}function handleError(_0x42c465,_0x36e2d8,_0x17c0aa){return _0x42c465[_0x4a89('0x24')](_0x36e2d8||0x1f4)[_0x4a89('0x25')]({'message':_0x17c0aa?_0x17c0aa[_0x4a89('0x26')]||_0x17c0aa:''});}exports[_0x4a89('0x27')]=function(_0x59f5ea,_0x4118aa,_0x554e12){passport[_0x4a89('0x28')](_0x4a89('0x29'),function(_0x47045c,_0x23b700,_0x3a40db){var _0x3b5efd=_0x47045c||_0x3a40db;if(_0x3b5efd){return handleError(_0x4118aa,0x191,_0x3b5efd);}if(!_0x23b700){return handleError(_0x4118aa,0x194,{'message':_0x4a89('0x2a')});}else{var _0x55c65a={'payload':{'id':_0x23b700['id'],'role':_0x23b700[_0x4a89('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0x4a89('0x2c')](_0x55c65a)[_0x4a89('0x1e')](function(_0x5ae2ac){_0x4118aa['json']({'id':_0x23b700['id'],'token':_0x5ae2ac,'statusCall':'','isAlreadyLogged':_0x23b700[_0x4a89('0x1a')]});});}})(_0x59f5ea,_0x4118aa,_0x554e12);};passport['use'](_0x4a89('0x29'),new LocalStrategy({'usernameField':_0x4a89('0x16'),'passwordField':_0x4a89('0x17')},function(_0xfd9a69,_0x4a8881,_0xd3885d){return ActiveDirectoryAuthenticate(db['User'],_0xfd9a69,_0x4a8881,_0xd3885d);})); \ No newline at end of file +var _0x5e6f=['../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blocked','online','admin','user','agent','name','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','activedirectory2','../../components/auth/service','../../config/utils','../../config/environment'];(function(_0x142489,_0x48a802){var _0x2b3536=function(_0x458be4){while(--_0x458be4){_0x142489['push'](_0x142489['shift']());}};_0x2b3536(++_0x48a802);}(_0x5e6f,0x1c5));var _0xf5e6=function(_0x533bf7,_0x29485b){_0x533bf7=_0x533bf7-0x0;var _0x9e4c57=_0x5e6f[_0x533bf7];return _0x9e4c57;};'use strict';var passport=require(_0xf5e6('0x0'));var LocalStrategy=require(_0xf5e6('0x1'))[_0xf5e6('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xf5e6('0x3'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xf5e6('0x4'));var utils=require(_0xf5e6('0x5'));var config=require(_0xf5e6('0x6'));var logger=require(_0xf5e6('0x7'))('api');function isActiveDirectoryConfigured(_0x4c927a){var _0x177201=![];if(typeof _0x4c927a[_0xf5e6('0x8')]!==_0xf5e6('0x9')){_0x177201=_0x4c927a[_0xf5e6('0x8')][_0xf5e6('0xa')]&&_0x4c927a[_0xf5e6('0x8')][_0xf5e6('0xb')]&&_0x4c927a[_0xf5e6('0x8')][_0xf5e6('0xc')];}return _0x177201;}function adAuthenticate(_0x2c4443,_0x3f038f,_0x38d06c){return new BPromise(function(_0x59929f,_0x5c2936){try{var _0x5d1872=new ActiveDirectory(_0x2c4443);_0x5d1872[_0xf5e6('0xd')](_0x3f038f,_0x38d06c,function(_0x1f1ae9,_0x57b863){if(_0x1f1ae9){logger['error'](_0xf5e6('0xe'),_0x3f038f,util[_0xf5e6('0xf')](_0x1f1ae9,{'showHidden':![],'depth':null}));_0x5c2936(_0xf5e6('0x10'));}else if(!_0x57b863){logger[_0xf5e6('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3f038f);_0x5c2936('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x59929f(_0x57b863);}});}catch(_0x545a9a){_0x5c2936(_0x545a9a);}});}function ActiveDirectoryAuthenticate(_0x56032c,_0x37620f,_0x3a1f36,_0x429513){var _0x41168e,_0x3fd92b;if(!isActiveDirectoryConfigured(config)){logger[_0xf5e6('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x37620f);return _0x429513(null,![],{'message':_0xf5e6('0x10')});}return db[_0xf5e6('0x12')][_0xf5e6('0x13')]({'where':{'id':0x1},'attributes':[_0xf5e6('0x14'),'blockDuration'],'raw':!![]})[_0xf5e6('0x15')](function(_0x3286a0){_0x41168e=_0x3286a0;if(!_0x41168e['adSsoEnabled']){logger['error'](_0xf5e6('0x16'),_0x37620f);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x56032c[_0xf5e6('0x13')]({'attributes':['id','name',_0xf5e6('0x17'),'salt',_0xf5e6('0x18'),_0xf5e6('0x19'),_0xf5e6('0x1a'),'blockedAt',_0xf5e6('0x1b')],'where':{'name':_0x37620f,'role':{'$or':[_0xf5e6('0x1c'),_0xf5e6('0x1d'),_0xf5e6('0x1e')]},'adSsoEnabled':!![]}});})[_0xf5e6('0x15')](function(_0x23b99e){if(!_0x23b99e||_0x23b99e&&_0x23b99e['name']!==_0x37620f){throw new Error(_0xf5e6('0x10'));}_0x3fd92b=_0x23b99e;var _0x337767=_0x3fd92b[_0xf5e6('0x1f')]+'@'+config[_0xf5e6('0x8')][_0xf5e6('0xc')];return adAuthenticate(config[_0xf5e6('0x8')],_0x337767,_0x3a1f36);})[_0xf5e6('0x15')](function(_0x22fcb7){if(_0x3fd92b['disabled']){throw new Error(_0xf5e6('0x10'));}if(_0x41168e[_0xf5e6('0x20')]>0x0){if(_0x3fd92b['blocked']){if(moment(_0x3fd92b[_0xf5e6('0x21')])[_0xf5e6('0x22')](_0x41168e['blockDuration'],_0xf5e6('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xf5e6('0x24')](_0x3fd92b,0x0,![],null)[_0xf5e6('0x15')](function(){return utils[_0xf5e6('0x25')](_0x3fd92b);})[_0xf5e6('0x15')](function(){return _0x429513(null,_0x3fd92b);});}else{return utils[_0xf5e6('0x25')](_0x3fd92b)[_0xf5e6('0x15')](function(){return _0x429513(null,_0x3fd92b);});}}else{return utils[_0xf5e6('0x25')](_0x3fd92b)[_0xf5e6('0x15')](function(){return _0x429513(null,_0x3fd92b);});}})['catch'](function(_0x318f95){return _0x429513(null,![],_0x318f95);});}function handleError(_0x9a6dd,_0x7d6550,_0x236519){return _0x9a6dd['status'](_0x7d6550||0x1f4)[_0xf5e6('0x26')]({'message':_0x236519?_0x236519['message']||_0x236519:''});}exports[_0xf5e6('0x27')]=function(_0x3d5730,_0x476ed1,_0x408e02){passport[_0xf5e6('0xd')](_0xf5e6('0x28'),function(_0x45bc92,_0x513df2,_0x44d453){var _0x4a08b4=_0x45bc92||_0x44d453;if(_0x4a08b4){return handleError(_0x476ed1,0x191,_0x4a08b4);}if(!_0x513df2){return handleError(_0x476ed1,0x194,{'message':_0xf5e6('0x29')});}else{var _0x4a5ad9={'payload':{'id':_0x513df2['id'],'role':_0x513df2[_0xf5e6('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0xf5e6('0x2a')](_0x4a5ad9)['then'](function(_0x50e503){_0x476ed1[_0xf5e6('0x2b')]({'id':_0x513df2['id'],'token':_0x50e503,'statusCall':'','isAlreadyLogged':_0x513df2[_0xf5e6('0x1b')]});});}})(_0x3d5730,_0x476ed1,_0x408e02);};passport[_0xf5e6('0x2c')](_0xf5e6('0x28'),new LocalStrategy({'usernameField':_0xf5e6('0x1f'),'passwordField':'password'},function(_0x15d7c0,_0x93c0d4,_0x4a5148){return ActiveDirectoryAuthenticate(db[_0xf5e6('0x2d')],_0x15d7c0,_0x93c0d4,_0x4a5148);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 55b722b..63d74bd 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 _0x3d29=['login','exports','express'];(function(_0x472208,_0x142120){var _0x26926d=function(_0x17d12e){while(--_0x17d12e){_0x472208['push'](_0x472208['shift']());}};_0x26926d(++_0x142120);}(_0x3d29,0x68));var _0x93d2=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3d29[_0x4d8ed9];return _0x1e2140;};'use strict';var express=require(_0x93d2('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x93d2('0x1')]);module[_0x93d2('0x2')]=router; \ No newline at end of file +var _0x14ff=['./authActiveDirectory.controller','post','login','express','Router'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x14ff,0xda));var _0xf14f=function(_0x14be9a,_0x529fdc){_0x14be9a=_0x14be9a-0x0;var _0x50c9a8=_0x14ff[_0x14be9a];return _0x50c9a8;};'use strict';var express=require(_0xf14f('0x0'));var router=express[_0xf14f('0x1')]();var controller=require(_0xf14f('0x2'));router[_0xf14f('0x3')]('/',controller[_0xf14f('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5405914..cd24671 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7a54,0x106));var _0x47a5=function(_0x52f901,_0x53f194){_0x52f901=_0x52f901-0x0;var _0x4da813=_0x7a54[_0x52f901];return _0x4da813;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x5c641d,_0x5bf77b){var _0x160883=function(_0x4895d7){while(--_0x4895d7){_0x5c641d['push'](_0x5c641d['shift']());}};_0x160883(++_0x5bf77b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0cc4903..c1b4876 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 _0x843f=['exports','passport','Router','../user/user.controller.js','../../components/auth/service','get','isMiddleware','login'];(function(_0x325c4f,_0x5800b4){var _0x431098=function(_0x5be070){while(--_0x5be070){_0x325c4f['push'](_0x325c4f['shift']());}};_0x431098(++_0x5800b4);}(_0x843f,0xd1));var _0xf843=function(_0x14b37c,_0x27d104){_0x14b37c=_0x14b37c-0x0;var _0xc0bc8f=_0x843f[_0x14b37c];return _0xc0bc8f;};'use strict';var express=require('express');var passport=require(_0xf843('0x0'));var router=express[_0xf843('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xf843('0x2'));var authService=require(_0xf843('0x3'));router['get']('/',controller['login']);router[_0xf843('0x4')]('/callback',controller['callback'],authService[_0xf843('0x5')],userController[_0xf843('0x6')],authService['setTokenCookie']);module[_0xf843('0x7')]=router; \ No newline at end of file +var _0x692a=['../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x1ccd8a,_0x5bf417){var _0x5a69d8=function(_0x336fdb){while(--_0x336fdb){_0x1ccd8a['push'](_0x1ccd8a['shift']());}};_0x5a69d8(++_0x5bf417);}(_0x692a,0x12a));var _0xa692=function(_0x14bec0,_0x53acde){_0x14bec0=_0x14bec0-0x0;var _0x23bdd7=_0x692a[_0x14bec0];return _0x23bdd7;};'use strict';var express=require(_0xa692('0x0'));var passport=require(_0xa692('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xa692('0x2'));var authService=require(_0xa692('0x3'));router['get']('/',controller['login']);router[_0xa692('0x4')](_0xa692('0x5'),controller[_0xa692('0x6')],authService[_0xa692('0x7')],userController['login'],authService[_0xa692('0x8')]);module[_0xa692('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index be842cd..c2d6712 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 _0x98fa=['status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','find','This\x20email\x20is\x20not\x20registered.','disabled','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','blockDuration','password','salt','role','blocked','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','clearBlockUser','then','blockedAt','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify'];(function(_0x57f3bf,_0x1ec33e){var _0x45176f=function(_0x144ee6){while(--_0x144ee6){_0x57f3bf['push'](_0x57f3bf['shift']());}};_0x45176f(++_0x1ec33e);}(_0x98fa,0xd1));var _0xa98f=function(_0x496377,_0x3a68a4){_0x496377=_0x496377-0x0;var _0x151575=_0x98fa[_0x496377];return _0x151575;};'use strict';var util=require(_0xa98f('0x0'));var passport=require('passport');var LocalStrategy=require(_0xa98f('0x1'))['Strategy'];var jayson=require(_0xa98f('0x2'));var _=require(_0xa98f('0x3'));var rs=require(_0xa98f('0x4'));var moment=require(_0xa98f('0x5'));var db=require(_0xa98f('0x6'))['db'];var authService=require(_0xa98f('0x7'));var utils=require(_0xa98f('0x8'));var client=jayson['client'][_0xa98f('0x9')]({'port':0x232b});function localAuthenticate(_0x693c05,_0x3d90ac,_0x3ba300,_0x1d74e4){var _0x563fcb,_0x2e5fd5;return db['Setting'][_0xa98f('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa98f('0xb')],'raw':!![]})['then'](function(_0x561ad1){_0x563fcb=_0x561ad1;return _0x693c05[_0xa98f('0xa')]({'attributes':['id','name',_0xa98f('0xc'),_0xa98f('0xd'),_0xa98f('0xe'),'disabled',_0xa98f('0xf'),'blockedAt',_0xa98f('0x10')],'where':{'name':_0x3d90ac,'role':{'$or':[_0xa98f('0x11'),_0xa98f('0x12'),_0xa98f('0x13')]}}});})['then'](function(_0x32cf46){if(!_0x32cf46||_0x32cf46&&_0x32cf46[_0xa98f('0x14')]!==_0x3d90ac){throw new Error(_0xa98f('0x15'));}else{_0x2e5fd5=_0x32cf46;return _0x2e5fd5;}})['then'](function(){_0x2e5fd5['authenticate'](_0x3ba300,function(_0x2253af,_0x1e4a65){var _0x2c988a=_0x2e5fd5[_0xa98f('0x10')]+0x1;if(_0x2253af){return _0x1d74e4(_0x2253af);}else if(!_0x1e4a65){if(_0x2e5fd5['disabled']){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else if(_0x563fcb[_0xa98f('0x16')]>0x0){if(_0x2e5fd5[_0xa98f('0xf')]){if(_0x563fcb[_0xa98f('0xb')]>0x0){if(moment(_0x2e5fd5['blockedAt'])[_0xa98f('0x17')](_0x563fcb['blockDuration'],'minutes')>moment()){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,_0x2c988a,![],null)[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}}else{if(_0x2c988a>=_0x563fcb[_0xa98f('0x16')]){return utils['clearBlockUser'](_0x2e5fd5,0x0,!![],moment())[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,_0x2c988a,![],null)[_0xa98f('0x19')](function(){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});});}}}else{return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2e5fd5['disabled']){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else if(_0x563fcb[_0xa98f('0x16')]>0x0){if(_0x2e5fd5['blocked']){if(_0x563fcb[_0xa98f('0xb')]>0x0){if(moment(_0x2e5fd5[_0xa98f('0x1a')])[_0xa98f('0x17')](_0x563fcb[_0xa98f('0xb')],_0xa98f('0x1b'))>moment()){return _0x1d74e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa98f('0x18')](_0x2e5fd5,0x0,![],null)[_0xa98f('0x19')](function(){return utils['getLicense'](_0x2e5fd5);})['then'](function(){return _0x1d74e4(null,_0x2e5fd5);});}}else{return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}}else{return utils[_0xa98f('0x18')](_0x2e5fd5,0x0,![],null)[_0xa98f('0x19')](function(){return utils[_0xa98f('0x1c')](_0x2e5fd5);})[_0xa98f('0x19')](function(){return _0x1d74e4(null,_0x2e5fd5);})[_0xa98f('0x1d')](function(_0xa819f1){return _0x1d74e4(null,![],_0xa819f1);});}}else{if(_0x2e5fd5[_0xa98f('0xf')]){return _0x1d74e4(null,![],{'message':_0xa98f('0x15')});}else{return utils[_0xa98f('0x1c')](_0x2e5fd5)['then'](function(){return _0x1d74e4(null,_0x2e5fd5);});}}}});})['catch'](function(_0x3343d3){return _0x1d74e4(null,![],_0x3343d3);});}function sendServiceMail(_0xd77ee9){return db[_0xa98f('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xa98f('0x1f')],'include':[{'model':db[_0xa98f('0x20')],'as':_0xa98f('0x21'),'include':[{'model':db['CloudProvider'],'as':_0xa98f('0x22')}]}]})['then'](function(_0x111d87){if(!_0x111d87){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x10ef82=_0x111d87['getSmtpOptions']();var _0x2b552b={'account':_0x10ef82,'message':_['merge']({'from':util[_0xa98f('0x23')](_0xa98f('0x24'),_0x111d87[_0xa98f('0x14')],_0x111d87[_0xa98f('0x1f')]||_0x111d87[_0xa98f('0x21')][_0xa98f('0x12')])},_0xd77ee9)};return client[_0xa98f('0x25')](_0xa98f('0x26'),_0x2b552b);})[_0xa98f('0x19')](function(_0x3326a9){if(_0x3326a9[_0xa98f('0x27')]){throw new Error(util[_0xa98f('0x23')](_0xa98f('0x28'),_0x3326a9[_0xa98f('0x27')][_0xa98f('0x29')]||JSON[_0xa98f('0x2a')](_0x3326a9['error'])));}return!![];});}function handleError(_0x29edb6,_0x38f091,_0x4399d4){return _0x29edb6[_0xa98f('0x2b')](_0x38f091||0x1f4)[_0xa98f('0x2c')]({'message':_0x4399d4?_0x4399d4[_0xa98f('0x29')]||_0x4399d4:''});}exports[_0xa98f('0x2d')]=function(_0x2589fc,_0x46e317,_0x2b186d){passport[_0xa98f('0x2e')](_0xa98f('0x2f'),function(_0x5c8298,_0x10e057,_0x39a838){var _0x9571ae=_0x5c8298||_0x39a838;if(_0x9571ae){return handleError(_0x46e317,0x191,_0x9571ae);}if(!_0x10e057){return handleError(_0x46e317,0x194,{'message':_0xa98f('0x30')});}else{var _0x59d3f1={'payload':{'id':_0x10e057['id'],'role':_0x10e057[_0xa98f('0xe')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x59d3f1)[_0xa98f('0x19')](function(_0x48eed1){_0x46e317[_0xa98f('0x31')]({'id':_0x10e057['id'],'token':_0x48eed1,'statusCall':'','isAlreadyLogged':_0x10e057[_0xa98f('0x32')]});});}})(_0x2589fc,_0x46e317,_0x2b186d);};exports['forgot']=function(_0x3ef97c,_0x4511a7){if(!_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')]){return handleError(_0x4511a7,0x1f4,{'message':_0xa98f('0x34')});}var _0x36988c=rs['generate']();_0x3ef97c[_0xa98f('0x33')]['email']=_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')][_0xa98f('0x35')]()[_0xa98f('0x36')]();var _0x3a6871;return db[_0xa98f('0x37')][_0xa98f('0xa')]({'where':{'id':0x1},'attributes':[_0xa98f('0x16'),_0xa98f('0xb')],'raw':!![]})[_0xa98f('0x19')](function(_0xa32c63){_0x3a6871=_0xa32c63;return db[_0xa98f('0x38')][_0xa98f('0x39')]({'where':{'email':_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')]}});})[_0xa98f('0x19')](function(_0x3dc207){if(!_0x3dc207){throw new Error(_0xa98f('0x3a'));}if(_0x3dc207[_0xa98f('0x3b')]){throw new Error(_0xa98f('0x3c'));}if(_0x3dc207[_0xa98f('0xf')]){if(moment(_0x3dc207['blockedAt'])[_0xa98f('0x17')](_0x3a6871[_0xa98f('0xb')],'minutes')>moment()){throw new Error(_0xa98f('0x3d'));}else{_0x3dc207[_0xa98f('0xf')]=![];_0x3dc207['blockedAt']=null;}}_0x3dc207[_0xa98f('0x3e')]=_0x36988c;_0x3dc207[_0xa98f('0x3f')]=Date[_0xa98f('0x40')]()+0x36ee80;return _0x3dc207[_0xa98f('0x41')]();})['then'](function(){return sendServiceMail({'to':_0x3ef97c[_0xa98f('0x33')][_0xa98f('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xa98f('0x42')+_0xa98f('0x43')+'https://'+_0x3ef97c[_0xa98f('0x44')][_0xa98f('0x45')]+_0xa98f('0x46')+_0x36988c+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xa98f('0x19')](function(){_0x4511a7[_0xa98f('0x2b')](0xc8)[_0xa98f('0x2c')]({'message':_0xa98f('0x47')});})[_0xa98f('0x1d')](function(_0x5e017d){return handleError(_0x4511a7,0x1f4,_0x5e017d);});};exports[_0xa98f('0x48')]=function(_0x384c53,_0x111559){return db[_0xa98f('0x38')][_0xa98f('0x39')]({'where':{'resetPasswordToken':_0x384c53[_0xa98f('0x49')][_0xa98f('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xa98f('0x40')]()}}})[_0xa98f('0x19')](function(_0x3aab11){if(!_0x3aab11){throw new Error(_0xa98f('0x4b'));}return db[_0xa98f('0x37')]['findOne']({'attributes':['id',_0xa98f('0x4c'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa98f('0x19')](function(_0x1cd747){if(_0x1cd747[_0xa98f('0x4c')])authService[_0xa98f('0x4d')](_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')]);if(!_0x1cd747[_0xa98f('0x4e')]||!_0x3aab11['previousPasswords'])return _0x3aab11;authService[_0xa98f('0x4f')](_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')],_0x3aab11[_0xa98f('0x50')],_0x1cd747[_0xa98f('0x51')]);return _0x3aab11;})[_0xa98f('0x19')](function(){_0x3aab11[_0xa98f('0xc')]=_0x384c53[_0xa98f('0x33')][_0xa98f('0xc')];_0x3aab11[_0xa98f('0x3e')]=null;_0x3aab11[_0xa98f('0x3f')]=null;return _0x3aab11[_0xa98f('0x41')]();});})[_0xa98f('0x19')](function(){_0x111559['status'](0xc8)['send']({'message':_0xa98f('0x52')});})[_0xa98f('0x1d')](function(_0x2e4f4a){return handleError(_0x111559,0x1f4,_0x2e4f4a);});};passport[_0xa98f('0x53')](_0xa98f('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x16c9b2,_0x560ab5,_0x5030f5){return localAuthenticate(db['User'],_0x16c9b2,_0x560ab5,_0x5030f5);})); \ No newline at end of file +var _0xebcc=['loginAttempts','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','CloudProvider','getSmtpOptions','format','request','SendMail','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt'];(function(_0x55c935,_0x48869a){var _0x979205=function(_0x39b955){while(--_0x39b955){_0x55c935['push'](_0x55c935['shift']());}};_0x979205(++_0x48869a);}(_0xebcc,0x89));var _0xcebc=function(_0x34895d,_0x58eaab){_0x34895d=_0x34895d-0x0;var _0x29ce5b=_0xebcc[_0x34895d];return _0x29ce5b;};'use strict';var util=require(_0xcebc('0x0'));var passport=require(_0xcebc('0x1'));var LocalStrategy=require(_0xcebc('0x2'))[_0xcebc('0x3')];var jayson=require(_0xcebc('0x4'));var _=require('lodash');var rs=require(_0xcebc('0x5'));var moment=require('moment');var db=require(_0xcebc('0x6'))['db'];var authService=require(_0xcebc('0x7'));var utils=require(_0xcebc('0x8'));var client=jayson['client'][_0xcebc('0x9')]({'port':0x232b});function localAuthenticate(_0x10d584,_0x437a6e,_0x27fa42,_0xb68606){var _0x56b8fc,_0x15bb9f;return db[_0xcebc('0xa')][_0xcebc('0xb')]({'where':{'id':0x1},'attributes':[_0xcebc('0xc'),_0xcebc('0xd')],'raw':!![]})[_0xcebc('0xe')](function(_0x4faa23){_0x56b8fc=_0x4faa23;return _0x10d584[_0xcebc('0xb')]({'attributes':['id','name',_0xcebc('0xf'),_0xcebc('0x10'),_0xcebc('0x11'),_0xcebc('0x12'),_0xcebc('0x13'),_0xcebc('0x14'),_0xcebc('0x15')],'where':{'name':_0x437a6e,'role':{'$or':['admin',_0xcebc('0x16'),_0xcebc('0x17')]}}});})[_0xcebc('0xe')](function(_0x598057){if(!_0x598057||_0x598057&&_0x598057[_0xcebc('0x18')]!==_0x437a6e){throw new Error(_0xcebc('0x19'));}else{_0x15bb9f=_0x598057;return _0x15bb9f;}})[_0xcebc('0xe')](function(){_0x15bb9f[_0xcebc('0x1a')](_0x27fa42,function(_0x130899,_0x58b074){var _0x54b4bd=_0x15bb9f[_0xcebc('0x15')]+0x1;if(_0x130899){return _0xb68606(_0x130899);}else if(!_0x58b074){if(_0x15bb9f[_0xcebc('0x12')]){return _0xb68606(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x56b8fc['allowedLoginAttempts']>0x0){if(_0x15bb9f[_0xcebc('0x13')]){if(_0x56b8fc[_0xcebc('0xd')]>0x0){if(moment(_0x15bb9f[_0xcebc('0x14')])[_0xcebc('0x1b')](_0x56b8fc[_0xcebc('0xd')],_0xcebc('0x1c'))>moment()){return _0xb68606(null,![],{'message':_0xcebc('0x19')});}else{return utils[_0xcebc('0x1d')](_0x15bb9f,_0x54b4bd,![],null)[_0xcebc('0xe')](function(){return _0xb68606(null,![],{'message':_0xcebc('0x19')});});}}else{return _0xb68606(null,![],{'message':_0xcebc('0x19')});}}else{if(_0x54b4bd>=_0x56b8fc[_0xcebc('0xc')]){return utils[_0xcebc('0x1d')](_0x15bb9f,0x0,!![],moment())['then'](function(){return _0xb68606(null,![],{'message':_0xcebc('0x19')});});}else{return utils[_0xcebc('0x1d')](_0x15bb9f,_0x54b4bd,![],null)[_0xcebc('0xe')](function(){return _0xb68606(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xb68606(null,![],{'message':_0xcebc('0x19')});}}else{if(_0x15bb9f['disabled']){return _0xb68606(null,![],{'message':_0xcebc('0x19')});}else if(_0x56b8fc[_0xcebc('0xc')]>0x0){if(_0x15bb9f[_0xcebc('0x13')]){if(_0x56b8fc[_0xcebc('0xd')]>0x0){if(moment(_0x15bb9f[_0xcebc('0x14')])[_0xcebc('0x1b')](_0x56b8fc[_0xcebc('0xd')],'minutes')>moment()){return _0xb68606(null,![],{'message':_0xcebc('0x19')});}else{return utils[_0xcebc('0x1d')](_0x15bb9f,0x0,![],null)[_0xcebc('0xe')](function(){return utils['getLicense'](_0x15bb9f);})[_0xcebc('0xe')](function(){return _0xb68606(null,_0x15bb9f);});}}else{return _0xb68606(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xcebc('0x1d')](_0x15bb9f,0x0,![],null)[_0xcebc('0xe')](function(){return utils[_0xcebc('0x1e')](_0x15bb9f);})[_0xcebc('0xe')](function(){return _0xb68606(null,_0x15bb9f);})[_0xcebc('0x1f')](function(_0x515ec9){return _0xb68606(null,![],_0x515ec9);});}}else{if(_0x15bb9f[_0xcebc('0x13')]){return _0xb68606(null,![],{'message':_0xcebc('0x19')});}else{return utils[_0xcebc('0x1e')](_0x15bb9f)['then'](function(){return _0xb68606(null,_0x15bb9f);});}}}});})[_0xcebc('0x1f')](function(_0x571439){return _0xb68606(null,![],_0x571439);});}function sendServiceMail(_0x44497a){return db['MailAccount'][_0xcebc('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xcebc('0x21')],'include':[{'model':db['MailServerOut'],'as':_0xcebc('0x22'),'include':[{'model':db[_0xcebc('0x23')],'as':_0xcebc('0x23')}]}]})[_0xcebc('0xe')](function(_0x4fbf0b){if(!_0x4fbf0b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x35e1e2=_0x4fbf0b[_0xcebc('0x24')]();var _0x4f7e73={'account':_0x35e1e2,'message':_['merge']({'from':util[_0xcebc('0x25')]('\x22%s\x22\x20<%s>',_0x4fbf0b[_0xcebc('0x18')],_0x4fbf0b[_0xcebc('0x21')]||_0x4fbf0b[_0xcebc('0x22')][_0xcebc('0x16')])},_0x44497a)};return client[_0xcebc('0x26')](_0xcebc('0x27'),_0x4f7e73);})[_0xcebc('0xe')](function(_0x34437b){if(_0x34437b[_0xcebc('0x28')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x34437b[_0xcebc('0x28')][_0xcebc('0x29')]||JSON[_0xcebc('0x2a')](_0x34437b['error'])));}return!![];});}function handleError(_0x438a59,_0x4074eb,_0x332132){return _0x438a59[_0xcebc('0x2b')](_0x4074eb||0x1f4)[_0xcebc('0x2c')]({'message':_0x332132?_0x332132[_0xcebc('0x29')]||_0x332132:''});}exports[_0xcebc('0x2d')]=function(_0x2f3dc0,_0x4c81f2,_0x8356c2){passport[_0xcebc('0x1a')](_0xcebc('0x2e'),function(_0x4cad63,_0x24d1d5,_0x3a0ecf){var _0x1c364e=_0x4cad63||_0x3a0ecf;if(_0x1c364e){return handleError(_0x4c81f2,0x191,_0x1c364e);}if(!_0x24d1d5){return handleError(_0x4c81f2,0x194,{'message':_0xcebc('0x2f')});}else{var _0x1c5e3a={'payload':{'id':_0x24d1d5['id'],'role':_0x24d1d5[_0xcebc('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xcebc('0x30')](_0x1c5e3a)[_0xcebc('0xe')](function(_0x4a5767){_0x4c81f2[_0xcebc('0x31')]({'id':_0x24d1d5['id'],'token':_0x4a5767,'statusCall':'','isAlreadyLogged':_0x24d1d5[_0xcebc('0x32')]});});}})(_0x2f3dc0,_0x4c81f2,_0x8356c2);};exports['forgot']=function(_0x5b6977,_0x4d7c02){if(!_0x5b6977[_0xcebc('0x33')][_0xcebc('0x21')]){return handleError(_0x4d7c02,0x1f4,{'message':_0xcebc('0x34')});}var _0x4be65f=rs['generate']();_0x5b6977[_0xcebc('0x33')][_0xcebc('0x21')]=_0x5b6977[_0xcebc('0x33')][_0xcebc('0x21')]['trim']()['toLowerCase']();var _0x42d7e7;return db['Setting'][_0xcebc('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x1565ca){_0x42d7e7=_0x1565ca;return db[_0xcebc('0x35')]['find']({'where':{'email':_0x5b6977[_0xcebc('0x33')][_0xcebc('0x21')]}});})[_0xcebc('0xe')](function(_0x2087b5){if(!_0x2087b5){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2087b5[_0xcebc('0x12')]){throw new Error(_0xcebc('0x36'));}if(_0x2087b5[_0xcebc('0x13')]){if(moment(_0x2087b5['blockedAt'])[_0xcebc('0x1b')](_0x42d7e7[_0xcebc('0xd')],_0xcebc('0x1c'))>moment()){throw new Error(_0xcebc('0x37'));}else{_0x2087b5['blocked']=![];_0x2087b5[_0xcebc('0x14')]=null;}}_0x2087b5[_0xcebc('0x38')]=_0x4be65f;_0x2087b5[_0xcebc('0x39')]=Date['now']()+0x36ee80;return _0x2087b5['save']();})['then'](function(){return sendServiceMail({'to':_0x5b6977[_0xcebc('0x33')][_0xcebc('0x21')],'subject':_0xcebc('0x3a'),'text':_0xcebc('0x3b')+_0xcebc('0x3c')+_0xcebc('0x3d')+_0x5b6977[_0xcebc('0x3e')][_0xcebc('0x3f')]+_0xcebc('0x40')+_0x4be65f+'\x0a\x0a'+_0xcebc('0x41')});})[_0xcebc('0xe')](function(){_0x4d7c02[_0xcebc('0x2b')](0xc8)['send']({'message':_0xcebc('0x42')});})[_0xcebc('0x1f')](function(_0x1bc1e7){return handleError(_0x4d7c02,0x1f4,_0x1bc1e7);});};exports[_0xcebc('0x43')]=function(_0x519b32,_0x2e6bfd){return db[_0xcebc('0x35')][_0xcebc('0x20')]({'where':{'resetPasswordToken':_0x519b32[_0xcebc('0x44')][_0xcebc('0x45')],'resetPasswordExpires':{'$gt':Date[_0xcebc('0x46')]()}}})[_0xcebc('0xe')](function(_0x42b1ef){if(!_0x42b1ef){throw new Error(_0xcebc('0x47'));}return db[_0xcebc('0xa')][_0xcebc('0xb')]({'attributes':['id',_0xcebc('0x48'),_0xcebc('0x49'),_0xcebc('0x4a')]})['then'](function(_0x3f3c40){if(_0x3f3c40['securePassword'])authService[_0xcebc('0x4b')](_0x519b32[_0xcebc('0x33')][_0xcebc('0xf')]);if(!_0x3f3c40[_0xcebc('0x49')]||!_0x42b1ef[_0xcebc('0x4c')])return _0x42b1ef;authService['validatePasswordHistory'](_0x519b32['body'][_0xcebc('0xf')],_0x42b1ef[_0xcebc('0x4c')],_0x3f3c40[_0xcebc('0x4a')]);return _0x42b1ef;})[_0xcebc('0xe')](function(){_0x42b1ef[_0xcebc('0xf')]=_0x519b32[_0xcebc('0x33')][_0xcebc('0xf')];_0x42b1ef[_0xcebc('0x38')]=null;_0x42b1ef[_0xcebc('0x39')]=null;return _0x42b1ef['save']();});})['then'](function(){_0x2e6bfd[_0xcebc('0x2b')](0xc8)[_0xcebc('0x2c')]({'message':_0xcebc('0x4d')});})[_0xcebc('0x1f')](function(_0x122753){return handleError(_0x2e6bfd,0x1f4,_0x122753);});};passport[_0xcebc('0x4e')](_0xcebc('0x2e'),new LocalStrategy({'usernameField':_0xcebc('0x18'),'passwordField':_0xcebc('0xf')},function(_0x4b0023,_0x2f25f6,_0x168f95){return localAuthenticate(db[_0xcebc('0x35')],_0x4b0023,_0x2f25f6,_0x168f95);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7b58a62..fb441c0 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 _0xc977=['exports','Router','/forgot','forgot','/reset/:token','reset'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xc977,0xc7));var _0x7c97=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc977[_0x5ddb1c];return _0x354adc;};'use strict';var express=require('express');var router=express[_0x7c97('0x0')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router['post'](_0x7c97('0x1'),controller[_0x7c97('0x2')]);router['post'](_0x7c97('0x3'),controller[_0x7c97('0x4')]);module[_0x7c97('0x5')]=router; \ No newline at end of file +var _0x984a=['login','/forgot','forgot','/reset/:token','exports','./authLocal.controller','post'];(function(_0x2d93b6,_0x51e677){var _0x464144=function(_0x14c633){while(--_0x14c633){_0x2d93b6['push'](_0x2d93b6['shift']());}};_0x464144(++_0x51e677);}(_0x984a,0x155));var _0xa984=function(_0x2c7e83,_0x336b96){_0x2c7e83=_0x2c7e83-0x0;var _0x5b3e65=_0x984a[_0x2c7e83];return _0x5b3e65;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa984('0x0'));router[_0xa984('0x1')]('/',controller[_0xa984('0x2')]);router[_0xa984('0x1')](_0xa984('0x3'),controller[_0xa984('0x4')]);router['post'](_0xa984('0x5'),controller['reset']);module[_0xa984('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 3fc6dcd..861a77e 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 _0xdd26=['BOOLEAN','STRING'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xdd26,0xe9));var _0x6dd2=function(_0x58ef84,_0x3ecc29){_0x58ef84=_0x58ef84-0x0;var _0x17c84a=_0xdd26[_0x58ef84];return _0x17c84a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6dd2('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6dd2('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x8c1d=['STRING','INTEGER','exports'];(function(_0x320308,_0x25bdb1){var _0x379420=function(_0x8e30d){while(--_0x8e30d){_0x320308['push'](_0x320308['shift']());}};_0x379420(++_0x25bdb1);}(_0x8c1d,0xc2));var _0xd8c1=function(_0x567530,_0x24e025){_0x567530=_0x567530-0x0;var _0x24b9cd=_0x8c1d[_0x567530];return _0x24b9cd;};'use strict';var Sequelize=require('sequelize');module[_0xd8c1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8c1('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd8c1('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 fcbfad9..3b3570f 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 _0x2a29=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','name','send','map','Automation','fieldName','type','key','model','query','filters','attributes','intersection','fields','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','destroy','addConditions','Condition','ids','getConditions','findOne','rawAttributes','order','nolimit','addActions','Action','omit','getActions','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1c0870,_0xb3e682){var _0x454576=function(_0x545ab5){while(--_0x545ab5){_0x1c0870['push'](_0x1c0870['shift']());}};_0x454576(++_0xb3e682);}(_0x2a29,0x186));var _0x92a2=function(_0x48448d,_0x8acc8c){_0x48448d=_0x48448d-0x0;var _0x2c704e=_0x2a29[_0x48448d];return _0x2c704e;};'use strict';var emlformat=require(_0x92a2('0x0'));var rimraf=require(_0x92a2('0x1'));var zipdir=require(_0x92a2('0x2'));var jsonpatch=require(_0x92a2('0x3'));var rp=require('request-promise');var moment=require(_0x92a2('0x4'));var BPromise=require(_0x92a2('0x5'));var Mustache=require('mustache');var util=require(_0x92a2('0x6'));var path=require(_0x92a2('0x7'));var sox=require(_0x92a2('0x8'));var csv=require('to-csv');var ejs=require(_0x92a2('0x9'));var fs=require('fs');var fs_extra=require(_0x92a2('0xa'));var _=require(_0x92a2('0xb'));var squel=require(_0x92a2('0xc'));var crypto=require(_0x92a2('0xd'));var jsforce=require(_0x92a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x92a2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x92a2('0x10'));var authService=require(_0x92a2('0x11'));var qs=require(_0x92a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x92a2('0x13'))(_0x92a2('0x14'));var utils=require('../../config/utils');var config=require(_0x92a2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x92a2('0x16'))['db'];function respondWithStatusCode(_0x2548cf,_0x16237d){_0x16237d=_0x16237d||0xcc;return function(_0x341966){if(_0x341966){return _0x2548cf[_0x92a2('0x17')](_0x16237d);}return _0x2548cf[_0x92a2('0x18')](_0x16237d)[_0x92a2('0x19')]();};}function respondWithResult(_0x17a794,_0x129d48){_0x129d48=_0x129d48||0xc8;return function(_0x170fa9){if(_0x170fa9){return _0x17a794['status'](_0x129d48)[_0x92a2('0x1a')](_0x170fa9);}};}function respondWithFilteredResult(_0x12ebfe,_0x531a2e){return function(_0x1a9874){if(_0x1a9874){var _0x17dcd9=typeof _0x531a2e[_0x92a2('0x1b')]===_0x92a2('0x1c')&&typeof _0x531a2e[_0x92a2('0x1d')]==='undefined';var _0x42cd6f=_0x1a9874[_0x92a2('0x1e')];var _0x5bb1f6=_0x17dcd9?0x0:_0x531a2e['offset'];var _0x4dfbe7=_0x17dcd9?_0x1a9874[_0x92a2('0x1e')]:_0x531a2e['offset']+_0x531a2e[_0x92a2('0x1d')];var _0x16dd0b;if(_0x4dfbe7>=_0x42cd6f){_0x4dfbe7=_0x42cd6f;_0x16dd0b=0xc8;}else{_0x16dd0b=0xce;}_0x12ebfe[_0x92a2('0x18')](_0x16dd0b);return _0x12ebfe[_0x92a2('0x1f')]('Content-Range',_0x5bb1f6+'-'+_0x4dfbe7+'/'+_0x42cd6f)[_0x92a2('0x1a')](_0x1a9874);}return null;};}function patchUpdates(_0x5da773){return function(_0x22e518){try{jsonpatch[_0x92a2('0x20')](_0x22e518,_0x5da773,!![]);}catch(_0x453d19){return BPromise[_0x92a2('0x21')](_0x453d19);}return _0x22e518[_0x92a2('0x22')]();};}function saveUpdates(_0x36eadc,_0x4f67e4){return function(_0x1a7d71){if(_0x1a7d71){return _0x1a7d71['update'](_0x36eadc)['then'](function(_0x481aa4){return _0x481aa4;});}return null;};}function removeEntity(_0x733a1a,_0x50b608){return function(_0x4bed8a){if(_0x4bed8a){return _0x4bed8a['destroy']()[_0x92a2('0x23')](function(){_0x733a1a[_0x92a2('0x18')](0xcc)[_0x92a2('0x19')]();});}};}function handleEntityNotFound(_0x67dac0,_0x3b97eb){return function(_0x4b0da8){if(!_0x4b0da8){_0x67dac0[_0x92a2('0x17')](0x194);}return _0x4b0da8;};}function handleError(_0x17ae42,_0x5e7029){_0x5e7029=_0x5e7029||0x1f4;return function(_0x11a2e5){logger['error'](_0x11a2e5['stack']);if(_0x11a2e5[_0x92a2('0x24')]){delete _0x11a2e5['name'];}_0x17ae42[_0x92a2('0x18')](_0x5e7029)[_0x92a2('0x25')](_0x11a2e5);};}exports['index']=function(_0x2fb042,_0xf93242){var _0xdcbcfa={},_0x31e9d8={},_0x35a559={'count':0x0,'rows':[]};var _0x2dcae6=_[_0x92a2('0x26')](db[_0x92a2('0x27')]['rawAttributes'],function(_0x475da0){return{'name':_0x475da0[_0x92a2('0x28')],'type':_0x475da0[_0x92a2('0x29')][_0x92a2('0x2a')]};});_0x31e9d8[_0x92a2('0x2b')]=_[_0x92a2('0x26')](_0x2dcae6,_0x92a2('0x24'));_0x31e9d8[_0x92a2('0x2c')]=_['keys'](_0x2fb042[_0x92a2('0x2c')]);_0x31e9d8[_0x92a2('0x2d')]=_['intersection'](_0x31e9d8['model'],_0x31e9d8[_0x92a2('0x2c')]);_0xdcbcfa[_0x92a2('0x2e')]=_[_0x92a2('0x2f')](_0x31e9d8[_0x92a2('0x2b')],qs[_0x92a2('0x30')](_0x2fb042['query'][_0x92a2('0x30')]));_0xdcbcfa[_0x92a2('0x2e')]=_0xdcbcfa[_0x92a2('0x2e')]['length']?_0xdcbcfa['attributes']:_0x31e9d8[_0x92a2('0x2b')];if(!_0x2fb042[_0x92a2('0x2c')]['hasOwnProperty']('nolimit')){_0xdcbcfa[_0x92a2('0x1d')]=qs[_0x92a2('0x1d')](_0x2fb042[_0x92a2('0x2c')][_0x92a2('0x1d')]);_0xdcbcfa['offset']=qs[_0x92a2('0x1b')](_0x2fb042['query'][_0x92a2('0x1b')]);}_0xdcbcfa['order']=qs['sort'](_0x2fb042[_0x92a2('0x2c')][_0x92a2('0x31')]);_0xdcbcfa[_0x92a2('0x32')]=qs['filters'](_['pick'](_0x2fb042[_0x92a2('0x2c')],_0x31e9d8[_0x92a2('0x2d')]),_0x2dcae6);if(_0x2fb042['query'][_0x92a2('0x33')]){_0xdcbcfa[_0x92a2('0x32')]=_[_0x92a2('0x34')](_0xdcbcfa[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x2dcae6,function(_0x5e3c31){if(_0x5e3c31[_0x92a2('0x29')]!==_0x92a2('0x35')){var _0x53f6b6={};_0x53f6b6[_0x5e3c31['name']]={'$like':'%'+_0x2fb042['query']['filter']+'%'};return _0x53f6b6;}})});}_0xdcbcfa=_[_0x92a2('0x34')]({},_0xdcbcfa,_0x2fb042[_0x92a2('0x36')]);var _0x4b1667={'where':_0xdcbcfa['where']};return db[_0x92a2('0x27')]['count'](_0x4b1667)[_0x92a2('0x23')](function(_0x1dd14f){_0x35a559[_0x92a2('0x1e')]=_0x1dd14f;if(_0x2fb042[_0x92a2('0x2c')]['includeAll']){_0xdcbcfa[_0x92a2('0x37')]=[{'all':!![]}];}return db['Automation'][_0x92a2('0x38')](_0xdcbcfa);})[_0x92a2('0x23')](function(_0x281598){_0x35a559[_0x92a2('0x39')]=_0x281598;return _0x35a559;})[_0x92a2('0x23')](respondWithFilteredResult(_0xf93242,_0xdcbcfa))['catch'](handleError(_0xf93242,null));};exports[_0x92a2('0x3a')]=function(_0x473da5,_0x322ef1){var _0x43629b={'raw':![],'where':{'id':_0x473da5[_0x92a2('0x3b')]['id']}},_0x3822ee={};_0x3822ee[_0x92a2('0x2b')]=_[_0x92a2('0x3c')](db[_0x92a2('0x27')]['rawAttributes']);_0x3822ee[_0x92a2('0x2c')]=_[_0x92a2('0x3c')](_0x473da5[_0x92a2('0x2c')]);_0x3822ee[_0x92a2('0x2d')]=_[_0x92a2('0x2f')](_0x3822ee['model'],_0x3822ee[_0x92a2('0x2c')]);_0x43629b['attributes']=_['intersection'](_0x3822ee['model'],qs[_0x92a2('0x30')](_0x473da5[_0x92a2('0x2c')]['fields']));_0x43629b[_0x92a2('0x2e')]=_0x43629b[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x43629b[_0x92a2('0x2e')]:_0x3822ee['model'];if(_0x473da5[_0x92a2('0x2c')]['includeAll']){_0x43629b['include']=[{'all':!![]}];}_0x43629b=_[_0x92a2('0x34')]({},_0x43629b,_0x473da5[_0x92a2('0x36')]);return db[_0x92a2('0x27')][_0x92a2('0x3e')](_0x43629b)[_0x92a2('0x23')](handleEntityNotFound(_0x322ef1,null))['then'](respondWithResult(_0x322ef1,null))[_0x92a2('0x3f')](handleError(_0x322ef1,null));};exports[_0x92a2('0x40')]=function(_0x2a3311,_0x524ba1){return db[_0x92a2('0x27')][_0x92a2('0x40')](_0x2a3311[_0x92a2('0x41')],{})['then'](respondWithResult(_0x524ba1,0xc9))['catch'](handleError(_0x524ba1,null));};exports[_0x92a2('0x42')]=function(_0x2264b8,_0x2346ab){if(_0x2264b8[_0x92a2('0x41')]['id']){delete _0x2264b8['body']['id'];}return db[_0x92a2('0x27')]['find']({'where':{'id':_0x2264b8[_0x92a2('0x3b')]['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x2346ab,null))[_0x92a2('0x23')](saveUpdates(_0x2264b8['body'],null))[_0x92a2('0x23')](respondWithResult(_0x2346ab,null))['catch'](handleError(_0x2346ab,null));};exports[_0x92a2('0x43')]=function(_0x3b6dc4,_0x218b13){return db[_0x92a2('0x27')][_0x92a2('0x3e')]({'where':{'id':_0x3b6dc4['params']['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x218b13,null))[_0x92a2('0x23')](removeEntity(_0x218b13,null))['catch'](handleError(_0x218b13,null));};exports[_0x92a2('0x44')]=function(_0x1f53f3,_0x3f8d2e,_0x3b0546){return db[_0x92a2('0x45')][_0x92a2('0x3e')]({'where':{'id':_0x1f53f3['params']['id']}})['then'](handleEntityNotFound(_0x3f8d2e,null))['then'](function(_0x46bb80){if(_0x46bb80){return _0x46bb80[_0x92a2('0x44')](_0x1f53f3[_0x92a2('0x41')][_0x92a2('0x46')],_['omit'](_0x1f53f3[_0x92a2('0x41')],[_0x92a2('0x46'),'id'])||{});}})[_0x92a2('0x23')](respondWithResult(_0x3f8d2e,null))['catch'](handleError(_0x3f8d2e,null));};exports[_0x92a2('0x47')]=function(_0x190051,_0x29ef67,_0x1c2e39){var _0x5083ab={};var _0xc492ba={};var _0x6f0f23;var _0x5ecf79;return db['Automation'][_0x92a2('0x48')]({'where':{'id':_0x190051['params']['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x29ef67,null))[_0x92a2('0x23')](function(_0x2bf2a4){if(_0x2bf2a4){_0x6f0f23=_0x2bf2a4;_0xc492ba[_0x92a2('0x2b')]=_['keys'](db[_0x92a2('0x45')][_0x92a2('0x49')]);_0xc492ba[_0x92a2('0x2c')]=_[_0x92a2('0x3c')](_0x190051[_0x92a2('0x2c')]);_0xc492ba[_0x92a2('0x2d')]=_[_0x92a2('0x2f')](_0xc492ba[_0x92a2('0x2b')],_0xc492ba[_0x92a2('0x2c')]);_0x5083ab[_0x92a2('0x2e')]=_[_0x92a2('0x2f')](_0xc492ba[_0x92a2('0x2b')],qs[_0x92a2('0x30')](_0x190051[_0x92a2('0x2c')][_0x92a2('0x30')]));_0x5083ab['attributes']=_0x5083ab[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x5083ab[_0x92a2('0x2e')]:_0xc492ba[_0x92a2('0x2b')];_0x5083ab[_0x92a2('0x4a')]=qs[_0x92a2('0x31')](_0x190051[_0x92a2('0x2c')][_0x92a2('0x31')]);_0x5083ab[_0x92a2('0x32')]=qs[_0x92a2('0x2d')](_['pick'](_0x190051[_0x92a2('0x2c')],_0xc492ba[_0x92a2('0x2d')]));if(_0x190051[_0x92a2('0x2c')]['filter']){_0x5083ab[_0x92a2('0x32')]=_[_0x92a2('0x34')](_0x5083ab[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x5083ab['attributes'],function(_0x402944){var _0x28a61e={};_0x28a61e[_0x402944]={'$like':'%'+_0x190051[_0x92a2('0x2c')][_0x92a2('0x33')]+'%'};return _0x28a61e;})});}_0x5083ab=_[_0x92a2('0x34')]({},_0x5083ab,_0x190051[_0x92a2('0x36')]);return _0x6f0f23[_0x92a2('0x47')](_0x5083ab);}})['then'](function(_0x14ef81){if(_0x14ef81){_0x5ecf79=_0x14ef81['length'];if(!_0x190051['query']['hasOwnProperty'](_0x92a2('0x4b'))){_0x5083ab[_0x92a2('0x1d')]=qs['limit'](_0x190051['query']['limit']);_0x5083ab[_0x92a2('0x1b')]=qs[_0x92a2('0x1b')](_0x190051['query'][_0x92a2('0x1b')]);}return _0x6f0f23[_0x92a2('0x47')](_0x5083ab);}})[_0x92a2('0x23')](function(_0xd969d8){if(_0xd969d8){return _0xd969d8?{'count':_0x5ecf79,'rows':_0xd969d8}:null;}})['then'](respondWithResult(_0x29ef67,null))[_0x92a2('0x3f')](handleError(_0x29ef67,null));};exports[_0x92a2('0x4c')]=function(_0xd48d79,_0x1a4d64,_0x47eca0){return db[_0x92a2('0x4d')][_0x92a2('0x3e')]({'where':{'id':_0xd48d79[_0x92a2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1a4d64,null))[_0x92a2('0x23')](function(_0x3ab2bf){if(_0x3ab2bf){return _0x3ab2bf[_0x92a2('0x4c')](_0xd48d79[_0x92a2('0x41')][_0x92a2('0x46')],_[_0x92a2('0x4e')](_0xd48d79[_0x92a2('0x41')],[_0x92a2('0x46'),'id'])||{});}})[_0x92a2('0x23')](respondWithResult(_0x1a4d64,null))[_0x92a2('0x3f')](handleError(_0x1a4d64,null));};exports[_0x92a2('0x4f')]=function(_0xbbd858,_0x50f3f0,_0x193e98){var _0x28f631={};var _0x418693={};var _0x30c6de;var _0x3a4d2d;return db[_0x92a2('0x27')][_0x92a2('0x48')]({'where':{'id':_0xbbd858[_0x92a2('0x3b')]['id']}})[_0x92a2('0x23')](handleEntityNotFound(_0x50f3f0,null))[_0x92a2('0x23')](function(_0x49c049){if(_0x49c049){_0x30c6de=_0x49c049;_0x418693[_0x92a2('0x2b')]=_[_0x92a2('0x3c')](db[_0x92a2('0x4d')][_0x92a2('0x49')]);_0x418693[_0x92a2('0x2c')]=_['keys'](_0xbbd858[_0x92a2('0x2c')]);_0x418693[_0x92a2('0x2d')]=_['intersection'](_0x418693[_0x92a2('0x2b')],_0x418693[_0x92a2('0x2c')]);_0x28f631['attributes']=_[_0x92a2('0x2f')](_0x418693[_0x92a2('0x2b')],qs['fields'](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x30')]));_0x28f631[_0x92a2('0x2e')]=_0x28f631[_0x92a2('0x2e')][_0x92a2('0x3d')]?_0x28f631['attributes']:_0x418693[_0x92a2('0x2b')];_0x28f631[_0x92a2('0x4a')]=qs['sort'](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x31')]);_0x28f631['where']=qs[_0x92a2('0x2d')](_[_0x92a2('0x50')](_0xbbd858['query'],_0x418693[_0x92a2('0x2d')]));if(_0xbbd858[_0x92a2('0x2c')]['filter']){_0x28f631['where']=_[_0x92a2('0x34')](_0x28f631[_0x92a2('0x32')],{'$or':_[_0x92a2('0x26')](_0x28f631['attributes'],function(_0x2ff43c){var _0x27ed01={};_0x27ed01[_0x2ff43c]={'$like':'%'+_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x33')]+'%'};return _0x27ed01;})});}_0x28f631=_['merge']({},_0x28f631,_0xbbd858['options']);return _0x30c6de['getActions'](_0x28f631);}})[_0x92a2('0x23')](function(_0x25a4cb){if(_0x25a4cb){_0x3a4d2d=_0x25a4cb['length'];if(!_0xbbd858['query']['hasOwnProperty'](_0x92a2('0x4b'))){_0x28f631[_0x92a2('0x1d')]=qs[_0x92a2('0x1d')](_0xbbd858[_0x92a2('0x2c')][_0x92a2('0x1d')]);_0x28f631[_0x92a2('0x1b')]=qs[_0x92a2('0x1b')](_0xbbd858[_0x92a2('0x2c')]['offset']);}return _0x30c6de[_0x92a2('0x4f')](_0x28f631);}})[_0x92a2('0x23')](function(_0x1793e3){if(_0x1793e3){return _0x1793e3?{'count':_0x3a4d2d,'rows':_0x1793e3}:null;}})['then'](respondWithResult(_0x50f3f0,null))[_0x92a2('0x3f')](handleError(_0x50f3f0,null));}; \ No newline at end of file +var _0x5b8f=['params','length','options','find','create','body','addConditions','Condition','omit','getConditions','findOne','sort','Action','addActions','ids','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','Automation','include','findAll','rows','catch','show'];(function(_0x1900a3,_0x5c9e62){var _0x434e6e=function(_0x36ee8e){while(--_0x36ee8e){_0x1900a3['push'](_0x1900a3['shift']());}};_0x434e6e(++_0x5c9e62);}(_0x5b8f,0x1b9));var _0xf5b8=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0x5b8f[_0x547af];return _0x22f7f4;};'use strict';var emlformat=require(_0xf5b8('0x0'));var rimraf=require(_0xf5b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5b8('0x2'));var rp=require(_0xf5b8('0x3'));var moment=require('moment');var BPromise=require(_0xf5b8('0x4'));var Mustache=require(_0xf5b8('0x5'));var util=require(_0xf5b8('0x6'));var path=require(_0xf5b8('0x7'));var sox=require(_0xf5b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5b8('0x9'));var _=require(_0xf5b8('0xa'));var squel=require(_0xf5b8('0xb'));var crypto=require(_0xf5b8('0xc'));var jsforce=require(_0xf5b8('0xd'));var deskjs=require(_0xf5b8('0xe'));var toCsv=require(_0xf5b8('0xf'));var querystring=require(_0xf5b8('0x10'));var Papa=require(_0xf5b8('0x11'));var Redis=require(_0xf5b8('0x12'));var authService=require(_0xf5b8('0x13'));var qs=require(_0xf5b8('0x14'));var as=require(_0xf5b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5b8('0x16'))(_0xf5b8('0x17'));var utils=require('../../config/utils');var config=require(_0xf5b8('0x18'));var licenseUtil=require(_0xf5b8('0x19'));var db=require(_0xf5b8('0x1a'))['db'];function respondWithStatusCode(_0x17754e,_0x466168){_0x466168=_0x466168||0xcc;return function(_0x3585de){if(_0x3585de){return _0x17754e[_0xf5b8('0x1b')](_0x466168);}return _0x17754e['status'](_0x466168)[_0xf5b8('0x1c')]();};}function respondWithResult(_0x49055b,_0x2ed5f4){_0x2ed5f4=_0x2ed5f4||0xc8;return function(_0x5bbbbd){if(_0x5bbbbd){return _0x49055b[_0xf5b8('0x1d')](_0x2ed5f4)[_0xf5b8('0x1e')](_0x5bbbbd);}};}function respondWithFilteredResult(_0x5b8214,_0x56a6e6){return function(_0x2aa97c){if(_0x2aa97c){var _0xc06d8e=typeof _0x56a6e6[_0xf5b8('0x1f')]===_0xf5b8('0x20')&&typeof _0x56a6e6[_0xf5b8('0x21')]==='undefined';var _0x2644e3=_0x2aa97c[_0xf5b8('0x22')];var _0x1dc536=_0xc06d8e?0x0:_0x56a6e6[_0xf5b8('0x1f')];var _0x6c57a5=_0xc06d8e?_0x2aa97c['count']:_0x56a6e6['offset']+_0x56a6e6['limit'];var _0xb7ad78;if(_0x6c57a5>=_0x2644e3){_0x6c57a5=_0x2644e3;_0xb7ad78=0xc8;}else{_0xb7ad78=0xce;}_0x5b8214[_0xf5b8('0x1d')](_0xb7ad78);return _0x5b8214['set'](_0xf5b8('0x23'),_0x1dc536+'-'+_0x6c57a5+'/'+_0x2644e3)['json'](_0x2aa97c);}return null;};}function patchUpdates(_0x30e5c9){return function(_0x1fe88b){try{jsonpatch[_0xf5b8('0x24')](_0x1fe88b,_0x30e5c9,!![]);}catch(_0x524b5b){return BPromise['reject'](_0x524b5b);}return _0x1fe88b[_0xf5b8('0x25')]();};}function saveUpdates(_0x6c9f71,_0x277b24){return function(_0x530cf4){if(_0x530cf4){return _0x530cf4[_0xf5b8('0x26')](_0x6c9f71)[_0xf5b8('0x27')](function(_0x110881){return _0x110881;});}return null;};}function removeEntity(_0x2f6fac,_0x51b9c9){return function(_0x4ef333){if(_0x4ef333){return _0x4ef333[_0xf5b8('0x28')]()[_0xf5b8('0x27')](function(){_0x2f6fac[_0xf5b8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d63cb,_0x252040){return function(_0x2349e8){if(!_0x2349e8){_0x4d63cb[_0xf5b8('0x1b')](0x194);}return _0x2349e8;};}function handleError(_0xc03de5,_0x36888e){_0x36888e=_0x36888e||0x1f4;return function(_0x54ff0e){logger['error'](_0x54ff0e['stack']);if(_0x54ff0e[_0xf5b8('0x29')]){delete _0x54ff0e[_0xf5b8('0x29')];}_0xc03de5['status'](_0x36888e)[_0xf5b8('0x2a')](_0x54ff0e);};}exports['index']=function(_0x29f8b0,_0x491689){var _0xf99c95={},_0xa30be1={},_0x42a3aa={'count':0x0,'rows':[]};var _0x16e142=_[_0xf5b8('0x2b')](db['Automation'][_0xf5b8('0x2c')],function(_0x23ba72){return{'name':_0x23ba72[_0xf5b8('0x2d')],'type':_0x23ba72['type'][_0xf5b8('0x2e')]};});_0xa30be1[_0xf5b8('0x2f')]=_[_0xf5b8('0x2b')](_0x16e142,'name');_0xa30be1[_0xf5b8('0x30')]=_[_0xf5b8('0x31')](_0x29f8b0[_0xf5b8('0x30')]);_0xa30be1[_0xf5b8('0x32')]=_['intersection'](_0xa30be1[_0xf5b8('0x2f')],_0xa30be1[_0xf5b8('0x30')]);_0xf99c95[_0xf5b8('0x33')]=_[_0xf5b8('0x34')](_0xa30be1[_0xf5b8('0x2f')],qs[_0xf5b8('0x35')](_0x29f8b0[_0xf5b8('0x30')][_0xf5b8('0x35')]));_0xf99c95['attributes']=_0xf99c95[_0xf5b8('0x33')]['length']?_0xf99c95[_0xf5b8('0x33')]:_0xa30be1[_0xf5b8('0x2f')];if(!_0x29f8b0[_0xf5b8('0x30')][_0xf5b8('0x36')](_0xf5b8('0x37'))){_0xf99c95[_0xf5b8('0x21')]=qs['limit'](_0x29f8b0[_0xf5b8('0x30')][_0xf5b8('0x21')]);_0xf99c95['offset']=qs[_0xf5b8('0x1f')](_0x29f8b0[_0xf5b8('0x30')]['offset']);}_0xf99c95[_0xf5b8('0x38')]=qs['sort'](_0x29f8b0[_0xf5b8('0x30')]['sort']);_0xf99c95[_0xf5b8('0x39')]=qs[_0xf5b8('0x32')](_[_0xf5b8('0x3a')](_0x29f8b0['query'],_0xa30be1[_0xf5b8('0x32')]),_0x16e142);if(_0x29f8b0[_0xf5b8('0x30')][_0xf5b8('0x3b')]){_0xf99c95[_0xf5b8('0x39')]=_['merge'](_0xf99c95[_0xf5b8('0x39')],{'$or':_[_0xf5b8('0x2b')](_0x16e142,function(_0x3a6696){if(_0x3a6696[_0xf5b8('0x3c')]!==_0xf5b8('0x3d')){var _0x3148d3={};_0x3148d3[_0x3a6696[_0xf5b8('0x29')]]={'$like':'%'+_0x29f8b0['query'][_0xf5b8('0x3b')]+'%'};return _0x3148d3;}})});}_0xf99c95=_[_0xf5b8('0x3e')]({},_0xf99c95,_0x29f8b0['options']);var _0x26317f={'where':_0xf99c95[_0xf5b8('0x39')]};return db[_0xf5b8('0x3f')][_0xf5b8('0x22')](_0x26317f)[_0xf5b8('0x27')](function(_0x457572){_0x42a3aa['count']=_0x457572;if(_0x29f8b0[_0xf5b8('0x30')]['includeAll']){_0xf99c95[_0xf5b8('0x40')]=[{'all':!![]}];}return db[_0xf5b8('0x3f')][_0xf5b8('0x41')](_0xf99c95);})[_0xf5b8('0x27')](function(_0x1eb439){_0x42a3aa[_0xf5b8('0x42')]=_0x1eb439;return _0x42a3aa;})[_0xf5b8('0x27')](respondWithFilteredResult(_0x491689,_0xf99c95))[_0xf5b8('0x43')](handleError(_0x491689,null));};exports[_0xf5b8('0x44')]=function(_0x2d218c,_0x4b3b75){var _0x233c5a={'raw':![],'where':{'id':_0x2d218c[_0xf5b8('0x45')]['id']}},_0x47cfc3={};_0x47cfc3[_0xf5b8('0x2f')]=_[_0xf5b8('0x31')](db[_0xf5b8('0x3f')]['rawAttributes']);_0x47cfc3[_0xf5b8('0x30')]=_[_0xf5b8('0x31')](_0x2d218c[_0xf5b8('0x30')]);_0x47cfc3['filters']=_[_0xf5b8('0x34')](_0x47cfc3['model'],_0x47cfc3[_0xf5b8('0x30')]);_0x233c5a['attributes']=_[_0xf5b8('0x34')](_0x47cfc3[_0xf5b8('0x2f')],qs[_0xf5b8('0x35')](_0x2d218c['query']['fields']));_0x233c5a['attributes']=_0x233c5a[_0xf5b8('0x33')][_0xf5b8('0x46')]?_0x233c5a[_0xf5b8('0x33')]:_0x47cfc3['model'];if(_0x2d218c[_0xf5b8('0x30')]['includeAll']){_0x233c5a[_0xf5b8('0x40')]=[{'all':!![]}];}_0x233c5a=_['merge']({},_0x233c5a,_0x2d218c[_0xf5b8('0x47')]);return db[_0xf5b8('0x3f')][_0xf5b8('0x48')](_0x233c5a)[_0xf5b8('0x27')](handleEntityNotFound(_0x4b3b75,null))[_0xf5b8('0x27')](respondWithResult(_0x4b3b75,null))[_0xf5b8('0x43')](handleError(_0x4b3b75,null));};exports[_0xf5b8('0x49')]=function(_0x1e9a62,_0x158bd5){return db[_0xf5b8('0x3f')][_0xf5b8('0x49')](_0x1e9a62[_0xf5b8('0x4a')],{})['then'](respondWithResult(_0x158bd5,0xc9))[_0xf5b8('0x43')](handleError(_0x158bd5,null));};exports[_0xf5b8('0x26')]=function(_0x52c9b8,_0x58c7c1){if(_0x52c9b8[_0xf5b8('0x4a')]['id']){delete _0x52c9b8['body']['id'];}return db[_0xf5b8('0x3f')][_0xf5b8('0x48')]({'where':{'id':_0x52c9b8[_0xf5b8('0x45')]['id']}})[_0xf5b8('0x27')](handleEntityNotFound(_0x58c7c1,null))[_0xf5b8('0x27')](saveUpdates(_0x52c9b8[_0xf5b8('0x4a')],null))[_0xf5b8('0x27')](respondWithResult(_0x58c7c1,null))['catch'](handleError(_0x58c7c1,null));};exports[_0xf5b8('0x28')]=function(_0x4ba7bf,_0x12bc73){return db['Automation'][_0xf5b8('0x48')]({'where':{'id':_0x4ba7bf[_0xf5b8('0x45')]['id']}})[_0xf5b8('0x27')](handleEntityNotFound(_0x12bc73,null))[_0xf5b8('0x27')](removeEntity(_0x12bc73,null))[_0xf5b8('0x43')](handleError(_0x12bc73,null));};exports[_0xf5b8('0x4b')]=function(_0x138757,_0x393259,_0x1781a4){return db[_0xf5b8('0x4c')][_0xf5b8('0x48')]({'where':{'id':_0x138757[_0xf5b8('0x45')]['id']}})['then'](handleEntityNotFound(_0x393259,null))[_0xf5b8('0x27')](function(_0x2b1f28){if(_0x2b1f28){return _0x2b1f28[_0xf5b8('0x4b')](_0x138757[_0xf5b8('0x4a')]['ids'],_[_0xf5b8('0x4d')](_0x138757[_0xf5b8('0x4a')],['ids','id'])||{});}})[_0xf5b8('0x27')](respondWithResult(_0x393259,null))[_0xf5b8('0x43')](handleError(_0x393259,null));};exports[_0xf5b8('0x4e')]=function(_0x3a9255,_0x1838e0,_0x579466){var _0x568da7={};var _0x277d0c={};var _0x50b567;var _0x4c8984;return db[_0xf5b8('0x3f')][_0xf5b8('0x4f')]({'where':{'id':_0x3a9255['params']['id']}})[_0xf5b8('0x27')](handleEntityNotFound(_0x1838e0,null))[_0xf5b8('0x27')](function(_0x2cb38c){if(_0x2cb38c){_0x50b567=_0x2cb38c;_0x277d0c[_0xf5b8('0x2f')]=_[_0xf5b8('0x31')](db[_0xf5b8('0x4c')][_0xf5b8('0x2c')]);_0x277d0c[_0xf5b8('0x30')]=_[_0xf5b8('0x31')](_0x3a9255[_0xf5b8('0x30')]);_0x277d0c['filters']=_[_0xf5b8('0x34')](_0x277d0c[_0xf5b8('0x2f')],_0x277d0c[_0xf5b8('0x30')]);_0x568da7[_0xf5b8('0x33')]=_[_0xf5b8('0x34')](_0x277d0c[_0xf5b8('0x2f')],qs[_0xf5b8('0x35')](_0x3a9255[_0xf5b8('0x30')][_0xf5b8('0x35')]));_0x568da7['attributes']=_0x568da7[_0xf5b8('0x33')][_0xf5b8('0x46')]?_0x568da7[_0xf5b8('0x33')]:_0x277d0c[_0xf5b8('0x2f')];_0x568da7[_0xf5b8('0x38')]=qs[_0xf5b8('0x50')](_0x3a9255[_0xf5b8('0x30')]['sort']);_0x568da7[_0xf5b8('0x39')]=qs['filters'](_['pick'](_0x3a9255[_0xf5b8('0x30')],_0x277d0c[_0xf5b8('0x32')]));if(_0x3a9255['query'][_0xf5b8('0x3b')]){_0x568da7[_0xf5b8('0x39')]=_['merge'](_0x568da7[_0xf5b8('0x39')],{'$or':_[_0xf5b8('0x2b')](_0x568da7[_0xf5b8('0x33')],function(_0x16e1d7){var _0x3d88b8={};_0x3d88b8[_0x16e1d7]={'$like':'%'+_0x3a9255[_0xf5b8('0x30')][_0xf5b8('0x3b')]+'%'};return _0x3d88b8;})});}_0x568da7=_[_0xf5b8('0x3e')]({},_0x568da7,_0x3a9255[_0xf5b8('0x47')]);return _0x50b567[_0xf5b8('0x4e')](_0x568da7);}})[_0xf5b8('0x27')](function(_0x24e125){if(_0x24e125){_0x4c8984=_0x24e125[_0xf5b8('0x46')];if(!_0x3a9255[_0xf5b8('0x30')][_0xf5b8('0x36')]('nolimit')){_0x568da7['limit']=qs['limit'](_0x3a9255['query'][_0xf5b8('0x21')]);_0x568da7[_0xf5b8('0x1f')]=qs['offset'](_0x3a9255['query'][_0xf5b8('0x1f')]);}return _0x50b567[_0xf5b8('0x4e')](_0x568da7);}})[_0xf5b8('0x27')](function(_0x315fbe){if(_0x315fbe){return _0x315fbe?{'count':_0x4c8984,'rows':_0x315fbe}:null;}})[_0xf5b8('0x27')](respondWithResult(_0x1838e0,null))[_0xf5b8('0x43')](handleError(_0x1838e0,null));};exports['addActions']=function(_0xbc33bc,_0x28bff0,_0x316a65){return db[_0xf5b8('0x51')][_0xf5b8('0x48')]({'where':{'id':_0xbc33bc[_0xf5b8('0x45')]['id']}})[_0xf5b8('0x27')](handleEntityNotFound(_0x28bff0,null))[_0xf5b8('0x27')](function(_0x501059){if(_0x501059){return _0x501059[_0xf5b8('0x52')](_0xbc33bc['body'][_0xf5b8('0x53')],_[_0xf5b8('0x4d')](_0xbc33bc[_0xf5b8('0x4a')],[_0xf5b8('0x53'),'id'])||{});}})[_0xf5b8('0x27')](respondWithResult(_0x28bff0,null))[_0xf5b8('0x43')](handleError(_0x28bff0,null));};exports[_0xf5b8('0x54')]=function(_0x384b6e,_0x26cd01,_0x3512e2){var _0xad9704={};var _0x1d79f0={};var _0xf65ddf;var _0x401916;return db[_0xf5b8('0x3f')][_0xf5b8('0x4f')]({'where':{'id':_0x384b6e['params']['id']}})[_0xf5b8('0x27')](handleEntityNotFound(_0x26cd01,null))[_0xf5b8('0x27')](function(_0xa9afd8){if(_0xa9afd8){_0xf65ddf=_0xa9afd8;_0x1d79f0[_0xf5b8('0x2f')]=_[_0xf5b8('0x31')](db[_0xf5b8('0x51')][_0xf5b8('0x2c')]);_0x1d79f0[_0xf5b8('0x30')]=_[_0xf5b8('0x31')](_0x384b6e[_0xf5b8('0x30')]);_0x1d79f0['filters']=_['intersection'](_0x1d79f0['model'],_0x1d79f0[_0xf5b8('0x30')]);_0xad9704[_0xf5b8('0x33')]=_['intersection'](_0x1d79f0[_0xf5b8('0x2f')],qs[_0xf5b8('0x35')](_0x384b6e['query'][_0xf5b8('0x35')]));_0xad9704[_0xf5b8('0x33')]=_0xad9704[_0xf5b8('0x33')][_0xf5b8('0x46')]?_0xad9704['attributes']:_0x1d79f0[_0xf5b8('0x2f')];_0xad9704['order']=qs[_0xf5b8('0x50')](_0x384b6e[_0xf5b8('0x30')][_0xf5b8('0x50')]);_0xad9704[_0xf5b8('0x39')]=qs[_0xf5b8('0x32')](_[_0xf5b8('0x3a')](_0x384b6e[_0xf5b8('0x30')],_0x1d79f0['filters']));if(_0x384b6e[_0xf5b8('0x30')][_0xf5b8('0x3b')]){_0xad9704[_0xf5b8('0x39')]=_[_0xf5b8('0x3e')](_0xad9704[_0xf5b8('0x39')],{'$or':_[_0xf5b8('0x2b')](_0xad9704[_0xf5b8('0x33')],function(_0x5c1dc3){var _0x4acd32={};_0x4acd32[_0x5c1dc3]={'$like':'%'+_0x384b6e[_0xf5b8('0x30')][_0xf5b8('0x3b')]+'%'};return _0x4acd32;})});}_0xad9704=_[_0xf5b8('0x3e')]({},_0xad9704,_0x384b6e['options']);return _0xf65ddf['getActions'](_0xad9704);}})[_0xf5b8('0x27')](function(_0x58212d){if(_0x58212d){_0x401916=_0x58212d[_0xf5b8('0x46')];if(!_0x384b6e[_0xf5b8('0x30')][_0xf5b8('0x36')](_0xf5b8('0x37'))){_0xad9704[_0xf5b8('0x21')]=qs[_0xf5b8('0x21')](_0x384b6e[_0xf5b8('0x30')]['limit']);_0xad9704[_0xf5b8('0x1f')]=qs[_0xf5b8('0x1f')](_0x384b6e[_0xf5b8('0x30')]['offset']);}return _0xf65ddf['getActions'](_0xad9704);}})[_0xf5b8('0x27')](function(_0x1a31ef){if(_0x1a31ef){return _0x1a31ef?{'count':_0x401916,'rows':_0x1a31ef}:null;}})['then'](respondWithResult(_0x26cd01,null))[_0xf5b8('0x43')](handleError(_0x26cd01,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index de4162f..ea4b784 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 _0x3f24=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x537662,_0x3f1da7){var _0x3bbccf=function(_0x523247){while(--_0x523247){_0x537662['push'](_0x537662['shift']());}};_0x3bbccf(++_0x3f1da7);}(_0x3f24,0x1a2));var _0x43f2=function(_0x5ed0a7,_0x2dc03a){_0x5ed0a7=_0x5ed0a7-0x0;var _0x8378c5=_0x3f24[_0x5ed0a7];return _0x8378c5;};'use strict';var _=require(_0x43f2('0x0'));var util=require(_0x43f2('0x1'));var logger=require(_0x43f2('0x2'))('api');var moment=require(_0x43f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x43f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43f2('0x5'));var config=require(_0x43f2('0x6'));var attributes=require('./automation.attributes');module[_0x43f2('0x7')]=function(_0x2d9e02,_0xbaf19e){return _0x2d9e02[_0x43f2('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb187=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','define','Automation','tools_automations'];(function(_0x273e70,_0x2971ab){var _0x2cf818=function(_0x3ef2d1){while(--_0x3ef2d1){_0x273e70['push'](_0x273e70['shift']());}};_0x2cf818(++_0x2971ab);}(_0xb187,0x179));var _0x7b18=function(_0x14082b,_0x3672d6){_0x14082b=_0x14082b-0x0;var _0x53a93d=_0xb187[_0x14082b];return _0x53a93d;};'use strict';var _=require(_0x7b18('0x0'));var util=require(_0x7b18('0x1'));var logger=require(_0x7b18('0x2'))(_0x7b18('0x3'));var moment=require(_0x7b18('0x4'));var BPromise=require(_0x7b18('0x5'));var rp=require(_0x7b18('0x6'));var fs=require('fs');var path=require(_0x7b18('0x7'));var rimraf=require(_0x7b18('0x8'));var config=require('../../config/environment');var attributes=require(_0x7b18('0x9'));module['exports']=function(_0x4eabbb,_0xb62d13){return _0x4eabbb[_0x7b18('0xa')](_0x7b18('0xb'),attributes,{'tableName':_0x7b18('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 43be275..e9f4bda 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 _0x117c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','bluebird'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x117c,0x71));var _0xc117=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0x117c[_0x41b29e];return _0xacd517;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc117('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc117('0x1'))['db'];var utils=require(_0xc117('0x2'));var logger=require(_0xc117('0x3'))(_0xc117('0x4'));var config=require(_0xc117('0x5'));var jayson=require(_0xc117('0x6'));var client=jayson['client'][_0xc117('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x389734,_0x48efbb,_0x181a70){return new BPromise(function(_0x56c9bd,_0x451447){return client[_0xc117('0x8')](_0x389734,_0x181a70)[_0xc117('0x9')](function(_0x39e33f){logger[_0xc117('0xa')]('Automation,\x20%s,\x20%s',_0x48efbb,_0xc117('0xb'));logger['debug'](_0xc117('0xc'),_0x48efbb,'request\x20sent',JSON[_0xc117('0xd')](_0x39e33f));if(_0x39e33f[_0xc117('0xe')]){if(_0x39e33f['error'][_0xc117('0xf')]===0x1f4){logger['error'](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x451447(_0x39e33f[_0xc117('0xe')]['message']);}logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x56c9bd(_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);}else{logger[_0xc117('0xa')](_0xc117('0x10'),_0x48efbb,_0xc117('0xb'));_0x56c9bd(_0x39e33f['result']['message']);}})[_0xc117('0x12')](function(_0x241ee7){logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x241ee7);_0x451447(_0x241ee7);});});} \ No newline at end of file +var _0x0e56=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x0e56,0xf5));var _0x60e5=function(_0x3f52d9,_0x1d748c){_0x3f52d9=_0x3f52d9-0x0;var _0x21e01f=_0x0e56[_0x3f52d9];return _0x21e01f;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0d6aa4f..de7c861 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 _0xef1c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','create','/:id/actions','put','/:id','exports','multer','util','connect-timeout','express'];(function(_0x18bebd,_0x32f07a){var _0x42524b=function(_0x2db8d2){while(--_0x2db8d2){_0x18bebd['push'](_0x18bebd['shift']());}};_0x42524b(++_0x32f07a);}(_0xef1c,0x176));var _0xcef1=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xef1c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xcef1('0x0'));var util=require(_0xcef1('0x1'));var path=require('path');var timeout=require(_0xcef1('0x2'));var express=require(_0xcef1('0x3'));var router=express[_0xcef1('0x4')]();var fs_extra=require(_0xcef1('0x5'));var auth=require(_0xcef1('0x6'));var interaction=require(_0xcef1('0x7'));var config=require('../../config/environment');var controller=require(_0xcef1('0x8'));router[_0xcef1('0x9')]('/',auth[_0xcef1('0xa')](),controller['index']);router[_0xcef1('0x9')]('/:id',auth[_0xcef1('0xa')](),controller[_0xcef1('0xb')]);router[_0xcef1('0x9')](_0xcef1('0xc'),auth['isAuthenticated'](),controller[_0xcef1('0xd')]);router[_0xcef1('0x9')]('/:id/actions',auth[_0xcef1('0xa')](),controller[_0xcef1('0xe')]);router[_0xcef1('0xf')]('/',auth['isAuthenticated'](),controller[_0xcef1('0x10')]);router['post']('/:id/conditions',auth[_0xcef1('0xa')](),controller['addConditions']);router[_0xcef1('0xf')](_0xcef1('0x11'),auth[_0xcef1('0xa')](),controller['addActions']);router[_0xcef1('0x12')](_0xcef1('0x13'),auth[_0xcef1('0xa')](),controller['update']);router['delete'](_0xcef1('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xcef1('0x14')]=router; \ No newline at end of file +var _0xd7f0=['update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put'];(function(_0x5a9f02,_0x2cb596){var _0x79f3a1=function(_0x9fdf9d){while(--_0x9fdf9d){_0x5a9f02['push'](_0x5a9f02['shift']());}};_0x79f3a1(++_0x2cb596);}(_0xd7f0,0x145));var _0x0d7f=function(_0x543afc,_0x70c9b6){_0x543afc=_0x543afc-0x0;var _0x588f2a=_0xd7f0[_0x543afc];return _0x588f2a;};'use strict';var multer=require(_0x0d7f('0x0'));var util=require(_0x0d7f('0x1'));var path=require(_0x0d7f('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d7f('0x3'));var router=express['Router']();var fs_extra=require(_0x0d7f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0d7f('0x5'));var config=require(_0x0d7f('0x6'));var controller=require(_0x0d7f('0x7'));router[_0x0d7f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0d7f('0x9'),auth[_0x0d7f('0xa')](),controller[_0x0d7f('0xb')]);router[_0x0d7f('0x8')]('/:id/conditions',auth[_0x0d7f('0xa')](),controller[_0x0d7f('0xc')]);router[_0x0d7f('0x8')](_0x0d7f('0xd'),auth['isAuthenticated'](),controller[_0x0d7f('0xe')]);router[_0x0d7f('0xf')]('/',auth[_0x0d7f('0xa')](),controller[_0x0d7f('0x10')]);router[_0x0d7f('0xf')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x0d7f('0x11')]);router[_0x0d7f('0xf')](_0x0d7f('0xd'),auth['isAuthenticated'](),controller[_0x0d7f('0x12')]);router[_0x0d7f('0x13')]('/:id',auth[_0x0d7f('0xa')](),controller[_0x0d7f('0x14')]);router[_0x0d7f('0x15')](_0x0d7f('0x9'),auth['isAuthenticated'](),controller[_0x0d7f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index eca8936..c343192 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 _0xc06d=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','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','exports','STRING','name','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc06d,0x15a));var _0xdc06=function(_0x5bc37f,_0x50debd){_0x5bc37f=_0x5bc37f-0x0;var _0x583e6d=_0xc06d[_0x5bc37f];return _0x583e6d;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'name':{'type':Sequelize[_0xdc06('0x2')],'unique':_0xdc06('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdc06('0x4')),'allowNull':![],'defaultValue':_0xdc06('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdc06('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xdc06('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdc06('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'comment':_0xdc06('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xdc06('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdc06('0x2')],'defaultValue':_0xdc06('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xdc06('0xe')](_0xdc06('0xf'),'never',_0xdc06('0x10')),'defaultValue':_0xdc06('0xf')},'dialAMDActive':{'type':Sequelize[_0xdc06('0x11')],'defaultValue':0x0,'comment':_0xdc06('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdc06('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xdc06('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdc06('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdc06('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdc06('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdc06('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xdc06('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdc06('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdc06('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdc06('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdc06('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdc06('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdc06('0x8')](0x9)[_0xdc06('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdc06('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdc06('0xe')](_0xdc06('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdc06('0x1d')},'dialCutDigit':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdc06('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdc06('0x8')](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdc06('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdc06('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdc06('0x8')](0x5)[_0xdc06('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdc06('0x28')}}; \ No newline at end of file +var _0xb607=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x3661f0,_0x57c3f9){var _0x5a9cbd=function(_0x473393){while(--_0x473393){_0x3661f0['push'](_0x3661f0['shift']());}};_0x5a9cbd(++_0x57c3f9);}(_0xb607,0x178));var _0x7b60=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb607[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require('sequelize');module[_0x7b60('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7b60('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7b60('0x2')](_0x7b60('0x3')),'allowNull':![],'defaultValue':_0x7b60('0x3')},'description':{'type':Sequelize[_0x7b60('0x4')]},'active':{'type':Sequelize[_0x7b60('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x7b60('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7b60('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7b60('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7b60('0x8')](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'comment':_0x7b60('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7b60('0x8')](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7b60('0xf')},'dialTimezone':{'type':Sequelize[_0x7b60('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7b60('0x4')],'defaultValue':_0x7b60('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x7b60('0x2')](_0x7b60('0x11'),_0x7b60('0x12'),'onlyIfOpen'),'defaultValue':_0x7b60('0x11')},'dialAMDActive':{'type':Sequelize[_0x7b60('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7b60('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7b60('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7b60('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7b60('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7b60('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7b60('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7b60('0x8')](0x9)[_0x7b60('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7b60('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7b60('0x2')](_0x7b60('0x19'),_0x7b60('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x7b60('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x7b60('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7b60('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7b60('0x8')](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7b60('0x8')](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7b60('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7b60('0x8')](0x3)[_0x7b60('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7b60('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7b60('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7b60('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index df456d7..ff3e79d 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 _0xf485=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','Campaign','includeAll','findAll','rows','show','params','fields','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','user','userProfileId','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','ListId\x20=\x20?','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x1722ea,_0x4244ec){var _0x267aa0=function(_0x22cbe3){while(--_0x22cbe3){_0x1722ea['push'](_0x1722ea['shift']());}};_0x267aa0(++_0x4244ec);}(_0xf485,0x1af));var _0x5f48=function(_0x1a4b58,_0x3c8c4a){_0x1a4b58=_0x1a4b58-0x0;var _0x16e54a=_0xf485[_0x1a4b58];return _0x16e54a;};'use strict';var emlformat=require(_0x5f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f48('0x2'));var moment=require(_0x5f48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5f48('0x4'));var util=require(_0x5f48('0x5'));var path=require(_0x5f48('0x6'));var sox=require('sox');var csv=require(_0x5f48('0x7'));var ejs=require(_0x5f48('0x8'));var fs=require('fs');var fs_extra=require(_0x5f48('0x9'));var _=require(_0x5f48('0xa'));var squel=require(_0x5f48('0xb'));var crypto=require(_0x5f48('0xc'));var jsforce=require(_0x5f48('0xd'));var deskjs=require(_0x5f48('0xe'));var toCsv=require(_0x5f48('0x7'));var querystring=require('querystring');var Papa=require(_0x5f48('0xf'));var Redis=require(_0x5f48('0x10'));var authService=require(_0x5f48('0x11'));var qs=require(_0x5f48('0x12'));var as=require(_0x5f48('0x13'));var hardwareService=require(_0x5f48('0x14'));var logger=require(_0x5f48('0x15'))('api');var utils=require(_0x5f48('0x16'));var config=require(_0x5f48('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f48('0x18'))['db'];function respondWithStatusCode(_0x3464d3,_0x1f491d){_0x1f491d=_0x1f491d||0xcc;return function(_0x3e634f){if(_0x3e634f){return _0x3464d3[_0x5f48('0x19')](_0x1f491d);}return _0x3464d3['status'](_0x1f491d)['end']();};}function respondWithResult(_0x36a908,_0x16baa0){_0x16baa0=_0x16baa0||0xc8;return function(_0x1a1183){if(_0x1a1183){return _0x36a908[_0x5f48('0x1a')](_0x16baa0)[_0x5f48('0x1b')](_0x1a1183);}};}function respondWithFilteredResult(_0x470562,_0x474620){return function(_0x26ff72){if(_0x26ff72){var _0x49127f=typeof _0x474620[_0x5f48('0x1c')]===_0x5f48('0x1d')&&typeof _0x474620[_0x5f48('0x1e')]===_0x5f48('0x1d');var _0x324f0e=_0x26ff72['count'];var _0x1d6054=_0x49127f?0x0:_0x474620[_0x5f48('0x1c')];var _0x36896c=_0x49127f?_0x26ff72[_0x5f48('0x1f')]:_0x474620[_0x5f48('0x1c')]+_0x474620['limit'];var _0x636218;if(_0x36896c>=_0x324f0e){_0x36896c=_0x324f0e;_0x636218=0xc8;}else{_0x636218=0xce;}_0x470562[_0x5f48('0x1a')](_0x636218);return _0x470562[_0x5f48('0x20')](_0x5f48('0x21'),_0x1d6054+'-'+_0x36896c+'/'+_0x324f0e)[_0x5f48('0x1b')](_0x26ff72);}return null;};}function patchUpdates(_0x1c0e83){return function(_0x13545d){try{jsonpatch[_0x5f48('0x22')](_0x13545d,_0x1c0e83,!![]);}catch(_0x495e94){return BPromise['reject'](_0x495e94);}return _0x13545d[_0x5f48('0x23')]();};}function saveUpdates(_0x30b10b,_0x535830){return function(_0x40ab87){if(_0x40ab87){return _0x40ab87[_0x5f48('0x24')](_0x30b10b)['then'](function(_0x33dec5){return _0x33dec5;});}return null;};}function removeEntity(_0x58487b,_0x205ad3){return function(_0x315b72){if(_0x315b72){return _0x315b72[_0x5f48('0x25')]()['then'](function(){var _0x48520f=_0x315b72[_0x5f48('0x26')]({'plain':!![]});var _0x22c0a9='IvrCampaigns';return db['UserProfileResource'][_0x5f48('0x25')]({'where':{'type':_0x22c0a9,'resourceId':_0x48520f['id']}})['then'](function(){return _0x315b72;});})[_0x5f48('0x27')](function(){_0x58487b[_0x5f48('0x1a')](0xcc)[_0x5f48('0x28')]();});}};}function handleEntityNotFound(_0xe03d5,_0x12d509){return function(_0x12009d){if(!_0x12009d){_0xe03d5[_0x5f48('0x19')](0x194);}return _0x12009d;};}function handleError(_0x2831c8,_0x16a0cd){_0x16a0cd=_0x16a0cd||0x1f4;return function(_0x4731ab){logger[_0x5f48('0x29')](_0x4731ab[_0x5f48('0x2a')]);if(_0x4731ab[_0x5f48('0x2b')]){delete _0x4731ab[_0x5f48('0x2b')];}_0x2831c8['status'](_0x16a0cd)[_0x5f48('0x2c')](_0x4731ab);};}exports[_0x5f48('0x2d')]=function(_0x30e440,_0x4c10fb){var _0x46b41f={},_0x444e9c={},_0x1a244a={'count':0x0,'rows':[]};var _0x467696=_[_0x5f48('0x2e')](db['Campaign'][_0x5f48('0x2f')],function(_0x49816f){return{'name':_0x49816f[_0x5f48('0x30')],'type':_0x49816f[_0x5f48('0x31')][_0x5f48('0x32')]};});_0x444e9c[_0x5f48('0x33')]=_[_0x5f48('0x2e')](_0x467696,_0x5f48('0x2b'));_0x444e9c[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x30e440[_0x5f48('0x34')]);_0x444e9c[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x444e9c[_0x5f48('0x33')],_0x444e9c['query']);_0x46b41f[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x444e9c[_0x5f48('0x33')],qs['fields'](_0x30e440[_0x5f48('0x34')]['fields']));_0x46b41f[_0x5f48('0x38')]=_0x46b41f[_0x5f48('0x38')][_0x5f48('0x39')]?_0x46b41f[_0x5f48('0x38')]:_0x444e9c[_0x5f48('0x33')];if(!_0x30e440[_0x5f48('0x34')]['hasOwnProperty']('nolimit')){_0x46b41f['limit']=qs[_0x5f48('0x1e')](_0x30e440[_0x5f48('0x34')]['limit']);_0x46b41f[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x30e440[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x46b41f[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x30e440[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x46b41f[_0x5f48('0x3c')]=qs['filters'](_['pick'](_0x30e440['query'],_0x444e9c[_0x5f48('0x36')]),_0x467696);if(_0x30e440[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x46b41f[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x46b41f['where'],{'$or':_[_0x5f48('0x2e')](_0x467696,function(_0x153267){if(_0x153267[_0x5f48('0x31')]!==_0x5f48('0x3f')){var _0x310af6={};_0x310af6[_0x153267[_0x5f48('0x2b')]]={'$like':'%'+_0x30e440[_0x5f48('0x34')]['filter']+'%'};return _0x310af6;}})});}_0x46b41f=_[_0x5f48('0x3e')]({},_0x46b41f,_0x30e440[_0x5f48('0x40')]);var _0x6c84e1={'where':_0x46b41f[_0x5f48('0x3c')]};return db[_0x5f48('0x41')]['count'](_0x6c84e1)['then'](function(_0x437f44){_0x1a244a[_0x5f48('0x1f')]=_0x437f44;if(_0x30e440['query'][_0x5f48('0x42')]){_0x46b41f['include']=[{'all':!![]}];}return db[_0x5f48('0x41')][_0x5f48('0x43')](_0x46b41f);})['then'](function(_0x1baa73){_0x1a244a[_0x5f48('0x44')]=_0x1baa73;return _0x1a244a;})['then'](respondWithFilteredResult(_0x4c10fb,_0x46b41f))['catch'](handleError(_0x4c10fb,null));};exports[_0x5f48('0x45')]=function(_0x3e955c,_0x244d96){var _0x403a24={'raw':![],'where':{'id':_0x3e955c[_0x5f48('0x46')]['id']}},_0x260fb8={};_0x260fb8[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x41')][_0x5f48('0x2f')]);_0x260fb8[_0x5f48('0x34')]=_['keys'](_0x3e955c[_0x5f48('0x34')]);_0x260fb8[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x260fb8[_0x5f48('0x33')],_0x260fb8['query']);_0x403a24[_0x5f48('0x38')]=_['intersection'](_0x260fb8[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x3e955c['query'][_0x5f48('0x47')]));_0x403a24[_0x5f48('0x38')]=_0x403a24[_0x5f48('0x38')][_0x5f48('0x39')]?_0x403a24['attributes']:_0x260fb8[_0x5f48('0x33')];if(_0x3e955c[_0x5f48('0x34')][_0x5f48('0x42')]){_0x403a24[_0x5f48('0x48')]=[{'all':!![]}];}_0x403a24=_[_0x5f48('0x3e')]({},_0x403a24,_0x3e955c[_0x5f48('0x40')]);return db[_0x5f48('0x41')][_0x5f48('0x49')](_0x403a24)[_0x5f48('0x27')](handleEntityNotFound(_0x244d96,null))['then'](respondWithResult(_0x244d96,null))[_0x5f48('0x4a')](handleError(_0x244d96,null));};exports[_0x5f48('0x4b')]=function(_0x34132d,_0x2f813a){return db['Campaign'][_0x5f48('0x4b')](_0x34132d[_0x5f48('0x4c')],{})['then'](function(_0xc23d59){var _0x101015=_0x34132d['user'][_0x5f48('0x26')]({'plain':!![]});if(!_0x101015)throw new Error(_0x5f48('0x4d'));if(_0x101015[_0x5f48('0x4e')]==='user'){var _0x5f3b1f=_0xc23d59['get']({'plain':!![]});var _0x55afb4=_0x5f48('0x4f');return db[_0x5f48('0x50')][_0x5f48('0x49')]({'where':{'name':_0x55afb4,'userProfileId':_0x101015['userProfileId']},'raw':!![]})[_0x5f48('0x27')](function(_0x50fae9){if(_0x50fae9&&_0x50fae9[_0x5f48('0x51')]===0x0){return db[_0x5f48('0x52')][_0x5f48('0x4b')]({'name':_0x5f3b1f['name'],'resourceId':_0x5f3b1f['id'],'type':_0x50fae9[_0x5f48('0x2b')],'sectionId':_0x50fae9['id']},{})[_0x5f48('0x27')](function(){return _0xc23d59;});}else{return _0xc23d59;}})[_0x5f48('0x4a')](function(_0x22302c){logger[_0x5f48('0x29')](_0x5f48('0x53'),_0x22302c);throw _0x22302c;});}return _0xc23d59;})[_0x5f48('0x27')](respondWithResult(_0x2f813a,0xc9))[_0x5f48('0x4a')](handleError(_0x2f813a,null));};exports[_0x5f48('0x54')]=function(_0x1a9ebf,_0x2015cb){var _0x45c74a={'where':{'id':_0x1a9ebf['params']['id']}},_0x4ff63e={};_0x4ff63e[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x41')][_0x5f48('0x2f')]);_0x45c74a[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x4ff63e['model'],qs[_0x5f48('0x47')](_0x1a9ebf[_0x5f48('0x34')]['fields']));_0x45c74a['attributes']=_0x45c74a['attributes'][_0x5f48('0x39')]?_0x45c74a[_0x5f48('0x38')]:_0x4ff63e[_0x5f48('0x33')];if(_0x1a9ebf['query'][_0x5f48('0x42')]){_0x45c74a[_0x5f48('0x48')]=[{'all':!![]}];}_0x45c74a=_[_0x5f48('0x3e')]({},_0x45c74a,_0x1a9ebf[_0x5f48('0x40')]);return db[_0x5f48('0x41')][_0x5f48('0x49')](_0x45c74a)[_0x5f48('0x27')](handleEntityNotFound(_0x2015cb,null))[_0x5f48('0x27')](function(_0x4276b8){if(_0x4276b8){var _0x39f162=_0x4276b8[_0x5f48('0x26')]({'plain':!![]});_0x39f162=qs[_0x5f48('0x55')](_0x39f162,['id','createdAt',_0x5f48('0x56')]);_0x1a9ebf[_0x5f48('0x4c')]=_[_0x5f48('0x55')](_0x1a9ebf[_0x5f48('0x4c')],['id',_0x5f48('0x57'),'updatedAt']);return db[_0x5f48('0x41')]['create'](_[_0x5f48('0x3e')](_0x39f162,_0x1a9ebf['body']),{'include':_0x1a9ebf['query'][_0x5f48('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x284bf8){var _0x17e5ee=_0x1a9ebf[_0x5f48('0x58')]['get']({'plain':!![]});if(!_0x17e5ee)throw new Error(_0x5f48('0x4d'));if(_0x17e5ee[_0x5f48('0x4e')]===_0x5f48('0x58')){var _0x21c051=_0x284bf8[_0x5f48('0x26')]({'plain':!![]});var _0x51365b=_0x5f48('0x4f');return db[_0x5f48('0x50')]['find']({'where':{'name':_0x51365b,'userProfileId':_0x17e5ee[_0x5f48('0x59')]},'raw':!![]})[_0x5f48('0x27')](function(_0x340b7e){if(_0x340b7e&&_0x340b7e[_0x5f48('0x51')]===0x0){return db[_0x5f48('0x52')][_0x5f48('0x4b')]({'name':_0x21c051[_0x5f48('0x2b')],'resourceId':_0x21c051['id'],'type':_0x340b7e[_0x5f48('0x2b')],'sectionId':_0x340b7e['id']},{})[_0x5f48('0x27')](function(){return _0x284bf8;});}else{return _0x284bf8;}})[_0x5f48('0x4a')](function(_0x57a38c){logger[_0x5f48('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57a38c);throw _0x57a38c;});}return _0x284bf8;});}})[_0x5f48('0x27')](respondWithResult(_0x2015cb,0xc9))[_0x5f48('0x4a')](handleError(_0x2015cb,null));};exports[_0x5f48('0x24')]=function(_0x4713b1,_0x340988){if(_0x4713b1['body']['id']){delete _0x4713b1[_0x5f48('0x4c')]['id'];}return db[_0x5f48('0x41')]['find']({'where':{'id':_0x4713b1[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x340988,null))[_0x5f48('0x27')](saveUpdates(_0x4713b1[_0x5f48('0x4c')],null))[_0x5f48('0x27')](respondWithResult(_0x340988,null))['catch'](handleError(_0x340988,null));};exports[_0x5f48('0x25')]=function(_0x16828b,_0x4775da){return db['Campaign'][_0x5f48('0x49')]({'where':{'id':_0x16828b[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x4775da,null))[_0x5f48('0x27')](removeEntity(_0x4775da,null))[_0x5f48('0x4a')](handleError(_0x4775da,null));};exports['getHoppers']=function(_0x317077,_0x887605,_0x651cfc){var _0xd7d61c={'raw':!![],'where':{}};var _0x450b3b={};var _0x4a264f={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x317077[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x887605,null))['then'](function(_0x5c78bb){if(_0x5c78bb){_0x450b3b[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x5b')]['rawAttributes']);_0x450b3b[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x317077[_0x5f48('0x34')]);_0x450b3b[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x450b3b[_0x5f48('0x33')],_0x450b3b[_0x5f48('0x34')]);_0xd7d61c[_0x5f48('0x38')]=_['intersection'](_0x450b3b[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x317077[_0x5f48('0x34')]['fields']));_0xd7d61c[_0x5f48('0x38')]=_0xd7d61c[_0x5f48('0x38')][_0x5f48('0x39')]?_0xd7d61c[_0x5f48('0x38')]:_0x450b3b['model'];if(!_0x317077[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0xd7d61c[_0x5f48('0x1e')]=qs['limit'](_0x317077[_0x5f48('0x34')][_0x5f48('0x1e')]);_0xd7d61c[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x317077[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0xd7d61c[_0x5f48('0x3a')]=qs['sort'](_0x317077[_0x5f48('0x34')][_0x5f48('0x3b')]);_0xd7d61c[_0x5f48('0x3c')]=qs['filters'](_[_0x5f48('0x5e')](_0x317077[_0x5f48('0x34')],_0x450b3b[_0x5f48('0x36')]));_0xd7d61c[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x5c78bb['id'];if(_0x317077[_0x5f48('0x34')][_0x5f48('0x3d')]){_0xd7d61c['where']=_[_0x5f48('0x3e')](_0xd7d61c[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0xd7d61c[_0x5f48('0x38')],function(_0x4b9deb){var _0x2d9b23={};_0x2d9b23[_0x4b9deb]={'$like':'%'+_0x317077[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x2d9b23;})});}_0xd7d61c=_[_0x5f48('0x3e')]({},_0xd7d61c,_0x317077[_0x5f48('0x40')]);return db[_0x5f48('0x5b')][_0x5f48('0x1f')]({'where':_0xd7d61c[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x4a5295){_0x4a264f[_0x5f48('0x1f')]=_0x4a5295;if(_0x317077[_0x5f48('0x34')][_0x5f48('0x42')]){_0xd7d61c[_0x5f48('0x48')]=[{'all':!![]}];}return db[_0x5f48('0x5b')][_0x5f48('0x43')](_0xd7d61c);})[_0x5f48('0x27')](function(_0x3f2a3e){_0x4a264f[_0x5f48('0x44')]=_0x3f2a3e;return _0x4a264f;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x887605,_0xd7d61c))['catch'](handleError(_0x887605,null));};exports[_0x5f48('0x60')]=function(_0x9aeb44,_0x2a7222,_0x29632b){var _0x3a601f={'raw':!![],'where':{}};var _0x2d6705={};var _0x2c39ea={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x9aeb44[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a7222,null))['then'](function(_0x183e70){if(_0x183e70){_0x2d6705[_0x5f48('0x33')]=_[_0x5f48('0x35')](db['CmHopperHistory'][_0x5f48('0x2f')]);_0x2d6705[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x9aeb44['query']);_0x2d6705[_0x5f48('0x36')]=_['intersection'](_0x2d6705[_0x5f48('0x33')],_0x2d6705['query']);_0x3a601f[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x2d6705[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x47')]));_0x3a601f['attributes']=_0x3a601f['attributes'][_0x5f48('0x39')]?_0x3a601f['attributes']:_0x2d6705['model'];if(!_0x9aeb44[_0x5f48('0x34')]['hasOwnProperty'](_0x5f48('0x5d'))){_0x3a601f[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x3a601f[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x9aeb44['query']['offset']);}_0x3a601f[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x9aeb44['query'][_0x5f48('0x3b')]);_0x3a601f[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x9aeb44['query'],_0x2d6705[_0x5f48('0x36')]));_0x3a601f[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x183e70['id'];if(_0x9aeb44['query']['filter']){_0x3a601f[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x3a601f[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x3a601f[_0x5f48('0x38')],function(_0x254d4b){var _0xce22a7={};_0xce22a7[_0x254d4b]={'$like':'%'+_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0xce22a7;})});}_0x3a601f=_[_0x5f48('0x3e')]({},_0x3a601f,_0x9aeb44[_0x5f48('0x40')]);return db[_0x5f48('0x61')][_0x5f48('0x1f')]({'where':_0x3a601f['where']})['then'](function(_0x243918){_0x2c39ea[_0x5f48('0x1f')]=_0x243918;if(_0x9aeb44[_0x5f48('0x34')][_0x5f48('0x42')]){_0x3a601f['include']=[{'all':!![]}];}return db[_0x5f48('0x61')][_0x5f48('0x43')](_0x3a601f);})[_0x5f48('0x27')](function(_0x43b1db){_0x2c39ea['rows']=_0x43b1db;return _0x2c39ea;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x2a7222,_0x3a601f))[_0x5f48('0x4a')](handleError(_0x2a7222,null));};exports[_0x5f48('0x62')]=function(_0x269fa0,_0x6416b7,_0x1e2e81){var _0x316215={'raw':!![],'where':{}};var _0x358764={};var _0x3bf41d={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x269fa0[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x6416b7,null))['then'](function(_0x2baf1d){if(_0x2baf1d){_0x358764[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x63')][_0x5f48('0x2f')]);_0x358764[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x269fa0[_0x5f48('0x34')]);_0x358764['filters']=_['intersection'](_0x358764[_0x5f48('0x33')],_0x358764[_0x5f48('0x34')]);_0x316215[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x358764['model'],qs[_0x5f48('0x47')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x47')]));_0x316215[_0x5f48('0x38')]=_0x316215[_0x5f48('0x38')][_0x5f48('0x39')]?_0x316215[_0x5f48('0x38')]:_0x358764['model'];if(!_0x269fa0[_0x5f48('0x34')][_0x5f48('0x5c')]('nolimit')){_0x316215['limit']=qs[_0x5f48('0x1e')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x316215[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x269fa0[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x316215['order']=qs[_0x5f48('0x3b')](_0x269fa0['query'][_0x5f48('0x3b')]);_0x316215[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_['pick'](_0x269fa0[_0x5f48('0x34')],_0x358764[_0x5f48('0x36')]));_0x316215[_0x5f48('0x3c')][_0x5f48('0x5f')]=_0x2baf1d['id'];if(_0x269fa0[_0x5f48('0x34')]['filter']){_0x316215[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x316215[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x316215[_0x5f48('0x38')],function(_0x5ad8de){var _0x59b219={};_0x59b219[_0x5ad8de]={'$like':'%'+_0x269fa0[_0x5f48('0x34')]['filter']+'%'};return _0x59b219;})});}_0x316215=_[_0x5f48('0x3e')]({},_0x316215,_0x269fa0[_0x5f48('0x40')]);return db[_0x5f48('0x63')][_0x5f48('0x1f')]({'where':_0x316215[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x2c892d){_0x3bf41d[_0x5f48('0x1f')]=_0x2c892d;if(_0x269fa0[_0x5f48('0x34')][_0x5f48('0x42')]){_0x316215[_0x5f48('0x48')]=[{'all':!![]}];}return db[_0x5f48('0x63')]['findAll'](_0x316215);})[_0x5f48('0x27')](function(_0x5cfc8a){_0x3bf41d[_0x5f48('0x44')]=_0x5cfc8a;return _0x3bf41d;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x6416b7,_0x316215))[_0x5f48('0x4a')](handleError(_0x6416b7,null));};exports[_0x5f48('0x64')]=function(_0x23f027,_0x29f7f7,_0x56ac1e){var _0x924551={'raw':!![],'where':{}};var _0x2223c1={};var _0x24913b={'count':0x0,'rows':[]};return db[_0x5f48('0x41')][_0x5f48('0x5a')]({'where':{'id':_0x23f027['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x29f7f7,null))[_0x5f48('0x27')](function(_0xe21563){if(_0xe21563){_0x2223c1[_0x5f48('0x33')]=_['keys'](db[_0x5f48('0x65')][_0x5f48('0x2f')]);_0x2223c1[_0x5f48('0x34')]=_['keys'](_0x23f027['query']);_0x2223c1[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x2223c1[_0x5f48('0x33')],_0x2223c1[_0x5f48('0x34')]);_0x924551[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x2223c1['model'],qs[_0x5f48('0x47')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x47')]));_0x924551[_0x5f48('0x38')]=_0x924551['attributes']['length']?_0x924551[_0x5f48('0x38')]:_0x2223c1['model'];if(!_0x23f027[_0x5f48('0x34')]['hasOwnProperty'](_0x5f48('0x5d'))){_0x924551['limit']=qs[_0x5f48('0x1e')](_0x23f027['query']['limit']);_0x924551[_0x5f48('0x1c')]=qs[_0x5f48('0x1c')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x1c')]);}_0x924551[_0x5f48('0x3a')]=qs[_0x5f48('0x3b')](_0x23f027[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x924551[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x23f027[_0x5f48('0x34')],_0x2223c1['filters']));_0x924551['where'][_0x5f48('0x5f')]=_0xe21563['id'];if(_0x23f027[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x924551[_0x5f48('0x3c')]=_[_0x5f48('0x3e')](_0x924551[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x924551[_0x5f48('0x38')],function(_0x4fb9da){var _0x374e28={};_0x374e28[_0x4fb9da]={'$like':'%'+_0x23f027['query'][_0x5f48('0x3d')]+'%'};return _0x374e28;})});}_0x924551=_[_0x5f48('0x3e')]({},_0x924551,_0x23f027[_0x5f48('0x40')]);return db[_0x5f48('0x65')][_0x5f48('0x1f')]({'where':_0x924551[_0x5f48('0x3c')]})[_0x5f48('0x27')](function(_0x12e9ce){_0x24913b[_0x5f48('0x1f')]=_0x12e9ce;if(_0x23f027[_0x5f48('0x34')][_0x5f48('0x42')]){_0x924551['include']=[{'all':!![]}];}return db[_0x5f48('0x65')][_0x5f48('0x43')](_0x924551);})[_0x5f48('0x27')](function(_0x30966a){_0x24913b[_0x5f48('0x44')]=_0x30966a;return _0x24913b;});}})[_0x5f48('0x27')](respondWithFilteredResult(_0x29f7f7,_0x924551))[_0x5f48('0x4a')](handleError(_0x29f7f7,null));};exports[_0x5f48('0x66')]=function(_0x54aa13,_0x3e67e4,_0x325ee8){var _0x4d4d44={};var _0x1c0bc5={};var _0x169d7e;var _0x40d1af;return db[_0x5f48('0x41')]['findOne']({'where':{'id':_0x54aa13[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x3e67e4,null))[_0x5f48('0x27')](function(_0x1d3323){if(_0x1d3323){_0x169d7e=_0x1d3323;_0x1c0bc5[_0x5f48('0x33')]=_[_0x5f48('0x35')](db[_0x5f48('0x67')][_0x5f48('0x2f')]);_0x1c0bc5['query']=_[_0x5f48('0x35')](_0x54aa13[_0x5f48('0x34')]);_0x1c0bc5[_0x5f48('0x36')]=_['intersection'](_0x1c0bc5[_0x5f48('0x33')],_0x1c0bc5[_0x5f48('0x34')]);_0x4d4d44[_0x5f48('0x38')]=_[_0x5f48('0x37')](_0x1c0bc5[_0x5f48('0x33')],qs['fields'](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x47')]));_0x4d4d44[_0x5f48('0x38')]=_0x4d4d44[_0x5f48('0x38')][_0x5f48('0x39')]?_0x4d4d44[_0x5f48('0x38')]:_0x1c0bc5[_0x5f48('0x33')];_0x4d4d44['order']=qs[_0x5f48('0x3b')](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3b')]);_0x4d4d44[_0x5f48('0x3c')]=qs[_0x5f48('0x36')](_[_0x5f48('0x5e')](_0x54aa13['query'],_0x1c0bc5[_0x5f48('0x36')]));if(_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3d')]){_0x4d4d44['where']=_[_0x5f48('0x3e')](_0x4d4d44[_0x5f48('0x3c')],{'$or':_['map'](_0x4d4d44[_0x5f48('0x38')],function(_0x480b31){var _0x38d8a4={};_0x38d8a4[_0x480b31]={'$like':'%'+_0x54aa13[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x38d8a4;})});}_0x4d4d44=_[_0x5f48('0x3e')]({},_0x4d4d44,_0x54aa13[_0x5f48('0x40')]);return _0x169d7e[_0x5f48('0x66')](_0x4d4d44);}})['then'](function(_0x1f9cfb){if(_0x1f9cfb){_0x40d1af=_0x1f9cfb[_0x5f48('0x39')];if(!_0x54aa13[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0x4d4d44[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x54aa13[_0x5f48('0x34')][_0x5f48('0x1e')]);_0x4d4d44['offset']=qs[_0x5f48('0x1c')](_0x54aa13['query'][_0x5f48('0x1c')]);}return _0x169d7e[_0x5f48('0x66')](_0x4d4d44);}})[_0x5f48('0x27')](function(_0x49665b){if(_0x49665b){return _0x49665b?{'count':_0x40d1af,'rows':_0x49665b}:null;}})[_0x5f48('0x27')](respondWithResult(_0x3e67e4,null))[_0x5f48('0x4a')](handleError(_0x3e67e4,null));};exports['addLists']=function(_0x55b681,_0x485357,_0xd6e51c){var _0x1a8a8d,_0x4b7bd2;var _0x4f0e39=[];var _0x25ddc7=moment()[_0x5f48('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5f48('0x41')]['find']({'where':{'id':_0x55b681[_0x5f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x485357,null))[_0x5f48('0x27')](function(_0x1f7ad3){if(_0x1f7ad3){_0x4b7bd2=_0x1f7ad3;return _0x1f7ad3[_0x5f48('0x69')](_0x55b681[_0x5f48('0x4c')]['ids'],_[_0x5f48('0x55')](_0x55b681[_0x5f48('0x4c')],[_0x5f48('0x6a'),'id'])||{});}return null;})[_0x5f48('0x6b')](function(_0x21ed50){var _0xb53a6d;var _0xa9518d;_0x1a8a8d=_0x21ed50||[];var _0x56c9e7=[];if(_0x21ed50){for(var _0x5d25e2=0x0;_0x5d25e2<_0x21ed50[_0x5f48('0x39')];_0x5d25e2+=0x1){var _0xf32f12=_0x21ed50[_0x5d25e2][_0x5f48('0x26')]({'plain':!![]});_0x4b7bd2['dialCheckDuplicateType']=_0x55b681[_0x5f48('0x4c')]['dialCheckDuplicateType']?_0x55b681['body']['dialCheckDuplicateType']:_0x4b7bd2['dialCheckDuplicateType'];switch(_0x4b7bd2[_0x5f48('0x6c')]){case _0x5f48('0x6d'):_0xb53a6d=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')](_0x5f48('0x70'))[_0x5f48('0x71')](['phone',_0x5f48('0x72'),_0x5f48('0x73'),_0x5f48('0x74'),'CampaignId',_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),_0x5f48('0x77'))[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))['field']('id',_0x5f48('0x73'))[_0x5f48('0x76')](_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')](),_0x5f48('0x74'))[_0x5f48('0x76')](_0x55b681[_0x5f48('0x46')]['id']['toString'](),_0x5f48('0x5f'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27','createdAt')['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))['where']('deletedAt\x20IS\x20NULL')[_0x5f48('0x3c')]('ListId\x20=\x20?',_0xf32f12['CmListId'][_0x5f48('0x7a')]())[_0x5f48('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x5f48('0x3c')](_0x5f48('0x7d'),squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x7e'))[_0x5f48('0x7b')](_0x5f48('0x7f'))[_0x5f48('0x3c')]('CampaignId\x20=\x20?',_0x55b681[_0x5f48('0x46')]['id']['toString']()))[_0x5f48('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5f48('0x76')](_0x5f48('0x80'))[_0x5f48('0x7b')](_0x5f48('0x70'))['where'](_0x5f48('0x81'),_0x55b681[_0x5f48('0x46')]['id']['toString']())))[_0x5f48('0x7a')]();break;case'onlyIfOpen':_0xb53a6d=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')]('cm_hopper')[_0x5f48('0x71')]([_0x5f48('0x77'),'scheduledAt',_0x5f48('0x73'),_0x5f48('0x74'),'CampaignId',_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),'phone')[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))['field']('id',_0x5f48('0x73'))['field'](_0xf32f12[_0x5f48('0x79')]['toString'](),_0x5f48('0x74'))[_0x5f48('0x76')](_0x55b681[_0x5f48('0x46')]['id']['toString'](),_0x5f48('0x5f'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))[_0x5f48('0x3c')](_0x5f48('0x82'))[_0x5f48('0x3c')]('ListId\x20=\x20?',_0xf32f12['CmListId']['toString']())['where'](_0x5f48('0x83'))[_0x5f48('0x3c')](_0x5f48('0x7d'),squel[_0x5f48('0x75')]()[_0x5f48('0x76')]('COALESCE(phone,\x27\x27)')[_0x5f48('0x7b')](_0x5f48('0x70'))['where'](_0x5f48('0x81'),_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')]())))['toString']();break;default:_0xb53a6d=squel['insert']()['into'](_0x5f48('0x70'))[_0x5f48('0x71')]([_0x5f48('0x77'),_0x5f48('0x72'),_0x5f48('0x73'),'ListId',_0x5f48('0x5f'),'createdAt',_0x5f48('0x56')],squel[_0x5f48('0x75')]()['field']('phone',_0x5f48('0x77'))[_0x5f48('0x76')]('NOW()',_0x5f48('0x72'))[_0x5f48('0x76')]('id','ContactId')[_0x5f48('0x76')](_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')](),_0x5f48('0x74'))['field'](_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')](),_0x5f48('0x5f'))['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x56'))[_0x5f48('0x7b')]('cm_contacts')[_0x5f48('0x3c')](_0x5f48('0x82'))['where']('ListId\x20=\x20?',_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')]())[_0x5f48('0x3c')](_0x5f48('0x83')))[_0x5f48('0x7a')]();}_0xa9518d=squel['insert']()[_0x5f48('0x6f')]('cm_hopper_additional_phones')[_0x5f48('0x71')]([_0x5f48('0x84'),_0x5f48('0x72'),_0x5f48('0x77'),_0x5f48('0x85'),_0x5f48('0x57'),_0x5f48('0x56')],squel['select']()['field']('h.id','id')[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x72'))[_0x5f48('0x76')](_0x5f48('0x86'),_0x5f48('0x77'))[_0x5f48('0x76')](_0x5f48('0x87'),'OrderBy')['field']('\x27'+_0x25ddc7+'\x27',_0x5f48('0x57'))[_0x5f48('0x76')]('\x27'+_0x25ddc7+'\x27','updatedAt')[_0x5f48('0x7b')](_0x5f48('0x88'),'ci')[_0x5f48('0x89')](_0x5f48('0x70'),'h',_0x5f48('0x8a'))[_0x5f48('0x3c')]('h.ListId\x20=\x20?',_0xf32f12[_0x5f48('0x79')][_0x5f48('0x7a')]())[_0x5f48('0x3c')](_0x5f48('0x8b'),_0x55b681[_0x5f48('0x46')]['id'][_0x5f48('0x7a')]())['where'](_0x5f48('0x8c'),_0x25ddc7))[_0x5f48('0x7a')]();_0x56c9e7['push'](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0xb53a6d));_0x4f0e39[_0x5f48('0x8e')](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0xa9518d));}return BPromise['all'](_0x56c9e7);}})[_0x5f48('0x27')](function(){return BPromise[_0x5f48('0x8f')](_0x4f0e39);})['then'](function(){return _0x1a8a8d;})[_0x5f48('0x27')](respondWithResult(_0x485357,null))[_0x5f48('0x4a')](handleError(_0x485357,null));};exports['removeLists']=function(_0x1794a1,_0x111563,_0x8ca4d8){return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x1794a1[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x111563,null))[_0x5f48('0x27')](function(_0x4b4ae3){if(_0x4b4ae3){return _0x4b4ae3[_0x5f48('0x90')](_0x1794a1[_0x5f48('0x34')][_0x5f48('0x6a')]);}})['then'](function(_0xf9286d){if(_0xf9286d){return db[_0x5f48('0x5b')]['destroy']({'where':{'ListId':_0x1794a1['query'][_0x5f48('0x6a')],'CampaignId':_0x1794a1[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](function(){return _0xf9286d;});}})[_0x5f48('0x27')](respondWithStatusCode(_0x111563,null))['catch'](handleError(_0x111563,null));};exports[_0x5f48('0x91')]=function(_0x397336,_0x143415,_0x5831ad){var _0x230f56={};var _0x124c74={};var _0x39e373;var _0xbb6661;return db['Campaign'][_0x5f48('0x5a')]({'where':{'id':_0x397336['params']['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x143415,null))['then'](function(_0x2ce105){if(_0x2ce105){_0x39e373=_0x2ce105;_0x124c74[_0x5f48('0x33')]=_[_0x5f48('0x35')](db['CmList'][_0x5f48('0x2f')]);_0x124c74[_0x5f48('0x34')]=_[_0x5f48('0x35')](_0x397336[_0x5f48('0x34')]);_0x124c74[_0x5f48('0x36')]=_[_0x5f48('0x37')](_0x124c74['model'],_0x124c74['query']);_0x230f56[_0x5f48('0x38')]=_['intersection'](_0x124c74[_0x5f48('0x33')],qs[_0x5f48('0x47')](_0x397336[_0x5f48('0x34')][_0x5f48('0x47')]));_0x230f56[_0x5f48('0x38')]=_0x230f56[_0x5f48('0x38')][_0x5f48('0x39')]?_0x230f56['attributes']:_0x124c74[_0x5f48('0x33')];_0x230f56[_0x5f48('0x3a')]=qs['sort'](_0x397336['query'][_0x5f48('0x3b')]);_0x230f56[_0x5f48('0x3c')]=qs['filters'](_[_0x5f48('0x5e')](_0x397336[_0x5f48('0x34')],_0x124c74[_0x5f48('0x36')]));if(_0x397336['query']['filter']){_0x230f56['where']=_[_0x5f48('0x3e')](_0x230f56[_0x5f48('0x3c')],{'$or':_[_0x5f48('0x2e')](_0x230f56[_0x5f48('0x38')],function(_0x453a76){var _0x3952e8={};_0x3952e8[_0x453a76]={'$like':'%'+_0x397336[_0x5f48('0x34')][_0x5f48('0x3d')]+'%'};return _0x3952e8;})});}_0x230f56=_[_0x5f48('0x3e')]({},_0x230f56,_0x397336['options']);return _0x39e373['getBlackLists'](_0x230f56);}})[_0x5f48('0x27')](function(_0x187957){if(_0x187957){_0xbb6661=_0x187957[_0x5f48('0x39')];if(!_0x397336[_0x5f48('0x34')][_0x5f48('0x5c')](_0x5f48('0x5d'))){_0x230f56[_0x5f48('0x1e')]=qs[_0x5f48('0x1e')](_0x397336[_0x5f48('0x34')]['limit']);_0x230f56[_0x5f48('0x1c')]=qs['offset'](_0x397336[_0x5f48('0x34')][_0x5f48('0x1c')]);}return _0x39e373[_0x5f48('0x91')](_0x230f56);}})['then'](function(_0x3387de){if(_0x3387de){return _0x3387de?{'count':_0xbb6661,'rows':_0x3387de}:null;}})[_0x5f48('0x27')](respondWithResult(_0x143415,null))[_0x5f48('0x4a')](handleError(_0x143415,null));};exports[_0x5f48('0x92')]=function(_0x5a727c,_0x50b2d3,_0x42d932){var _0x5e2def,_0x47d9a6;var _0x3e62e0=[];var _0x519a86=moment()[_0x5f48('0x68')](_0x5f48('0x93'));return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x5a727c[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x50b2d3,null))[_0x5f48('0x27')](function(_0x31f1a3){if(_0x31f1a3){_0x47d9a6=_0x31f1a3;return _0x31f1a3[_0x5f48('0x92')](_0x5a727c[_0x5f48('0x4c')][_0x5f48('0x6a')],_[_0x5f48('0x55')](_0x5a727c[_0x5f48('0x4c')],[_0x5f48('0x6a'),'id'])||{});}return null;})[_0x5f48('0x6b')](function(_0x24cea8){var _0x4e6102;var _0x1bec6e;_0x5e2def=_0x24cea8||[];var _0x539668=[];if(_0x24cea8){for(var _0x2addc5=0x0;_0x2addc5<_0x24cea8['length'];_0x2addc5+=0x1){var _0x51d212=_0x24cea8[_0x2addc5][_0x5f48('0x26')]({'plain':!![]});_0x4e6102=squel[_0x5f48('0x6e')]()[_0x5f48('0x6f')]('cm_hopper_black')[_0x5f48('0x71')]([_0x5f48('0x77'),_0x5f48('0x73'),'ListId',_0x5f48('0x5f'),_0x5f48('0x57'),_0x5f48('0x56')],squel[_0x5f48('0x75')]()[_0x5f48('0x76')](_0x5f48('0x77'),_0x5f48('0x77'))[_0x5f48('0x76')]('id',_0x5f48('0x73'))['field'](_0x51d212[_0x5f48('0x79')][_0x5f48('0x7a')](),'ListId')[_0x5f48('0x76')](_0x5a727c[_0x5f48('0x46')]['id'][_0x5f48('0x7a')](),_0x5f48('0x5f'))[_0x5f48('0x76')](_0x5f48('0x78'),_0x5f48('0x57'))[_0x5f48('0x76')]('NOW()',_0x5f48('0x56'))[_0x5f48('0x7b')](_0x5f48('0x7c'))[_0x5f48('0x3c')]('deletedAt\x20IS\x20NULL')[_0x5f48('0x3c')](_0x5f48('0x94'),_0x51d212['CmListId'][_0x5f48('0x7a')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5f48('0x7a')]();_0x539668[_0x5f48('0x8e')](db[_0x5f48('0x8d')][_0x5f48('0x34')](_0x4e6102));}return BPromise['all'](_0x539668);}})[_0x5f48('0x27')](function(){return _0x5e2def;})[_0x5f48('0x27')](respondWithResult(_0x50b2d3,null))[_0x5f48('0x4a')](handleError(_0x50b2d3,null));};exports['removeBlackLists']=function(_0x47abc4,_0x2945da,_0x37f4fb){return db[_0x5f48('0x41')][_0x5f48('0x49')]({'where':{'id':_0x47abc4[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](handleEntityNotFound(_0x2945da,null))[_0x5f48('0x27')](function(_0x1f3535){if(_0x1f3535){return _0x1f3535['removeBlackLists'](_0x47abc4[_0x5f48('0x34')][_0x5f48('0x6a')]);}})[_0x5f48('0x27')](function(_0x37522e){if(_0x37522e){return db['CmHopperBlack'][_0x5f48('0x25')]({'where':{'ListId':_0x47abc4['query'][_0x5f48('0x6a')],'CampaignId':_0x47abc4[_0x5f48('0x46')]['id']}})[_0x5f48('0x27')](function(){return _0x37522e;});}})[_0x5f48('0x27')](respondWithStatusCode(_0x2945da,null))[_0x5f48('0x4a')](handleError(_0x2945da,null));}; \ No newline at end of file +var _0x0f73=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','all','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Campaign','includeAll','include','rows','catch','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0f73,0x146));var _0x30f7=function(_0x1edfdc,_0x289142){_0x1edfdc=_0x1edfdc-0x0;var _0x10a4f8=_0x0f73[_0x1edfdc];return _0x10a4f8;};'use strict';var emlformat=require(_0x30f7('0x0'));var rimraf=require(_0x30f7('0x1'));var zipdir=require(_0x30f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x30f7('0x3'));var BPromise=require(_0x30f7('0x4'));var Mustache=require(_0x30f7('0x5'));var util=require(_0x30f7('0x6'));var path=require(_0x30f7('0x7'));var sox=require('sox');var csv=require(_0x30f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30f7('0x9'));var squel=require(_0x30f7('0xa'));var crypto=require(_0x30f7('0xb'));var jsforce=require(_0x30f7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x30f7('0x8'));var querystring=require(_0x30f7('0xd'));var Papa=require('papaparse');var Redis=require(_0x30f7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30f7('0xf'));var hardwareService=require(_0x30f7('0x10'));var logger=require(_0x30f7('0x11'))(_0x30f7('0x12'));var utils=require('../../config/utils');var config=require(_0x30f7('0x13'));var licenseUtil=require(_0x30f7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x121af8,_0x7b4cd1){_0x7b4cd1=_0x7b4cd1||0xcc;return function(_0xb9752c){if(_0xb9752c){return _0x121af8['sendStatus'](_0x7b4cd1);}return _0x121af8[_0x30f7('0x15')](_0x7b4cd1)[_0x30f7('0x16')]();};}function respondWithResult(_0x5155bd,_0x1ad086){_0x1ad086=_0x1ad086||0xc8;return function(_0xfc31c5){if(_0xfc31c5){return _0x5155bd[_0x30f7('0x15')](_0x1ad086)[_0x30f7('0x17')](_0xfc31c5);}};}function respondWithFilteredResult(_0x2b5a47,_0x579e7a){return function(_0x49fccb){if(_0x49fccb){var _0x401f9e=typeof _0x579e7a[_0x30f7('0x18')]===_0x30f7('0x19')&&typeof _0x579e7a[_0x30f7('0x1a')]==='undefined';var _0x2681d7=_0x49fccb[_0x30f7('0x1b')];var _0x1efb71=_0x401f9e?0x0:_0x579e7a[_0x30f7('0x18')];var _0x1e7777=_0x401f9e?_0x49fccb[_0x30f7('0x1b')]:_0x579e7a[_0x30f7('0x18')]+_0x579e7a[_0x30f7('0x1a')];var _0x1d6f46;if(_0x1e7777>=_0x2681d7){_0x1e7777=_0x2681d7;_0x1d6f46=0xc8;}else{_0x1d6f46=0xce;}_0x2b5a47['status'](_0x1d6f46);return _0x2b5a47[_0x30f7('0x1c')](_0x30f7('0x1d'),_0x1efb71+'-'+_0x1e7777+'/'+_0x2681d7)[_0x30f7('0x17')](_0x49fccb);}return null;};}function patchUpdates(_0x12cdf1){return function(_0x37d7d5){try{jsonpatch[_0x30f7('0x1e')](_0x37d7d5,_0x12cdf1,!![]);}catch(_0x5745d7){return BPromise[_0x30f7('0x1f')](_0x5745d7);}return _0x37d7d5[_0x30f7('0x20')]();};}function saveUpdates(_0x571f7e,_0x570d52){return function(_0x12d3f2){if(_0x12d3f2){return _0x12d3f2['update'](_0x571f7e)['then'](function(_0x4c6009){return _0x4c6009;});}return null;};}function removeEntity(_0x1bfc45,_0x261116){return function(_0x4c686d){if(_0x4c686d){return _0x4c686d['destroy']()[_0x30f7('0x21')](function(){var _0x86b4f8=_0x4c686d['get']({'plain':!![]});var _0x393d2f=_0x30f7('0x22');return db[_0x30f7('0x23')]['destroy']({'where':{'type':_0x393d2f,'resourceId':_0x86b4f8['id']}})[_0x30f7('0x21')](function(){return _0x4c686d;});})[_0x30f7('0x21')](function(){_0x1bfc45['status'](0xcc)[_0x30f7('0x16')]();});}};}function handleEntityNotFound(_0x3a8207,_0x5de116){return function(_0x23d3ae){if(!_0x23d3ae){_0x3a8207[_0x30f7('0x24')](0x194);}return _0x23d3ae;};}function handleError(_0x4b5d75,_0x3cd23f){_0x3cd23f=_0x3cd23f||0x1f4;return function(_0x591773){logger[_0x30f7('0x25')](_0x591773[_0x30f7('0x26')]);if(_0x591773[_0x30f7('0x27')]){delete _0x591773[_0x30f7('0x27')];}_0x4b5d75[_0x30f7('0x15')](_0x3cd23f)[_0x30f7('0x28')](_0x591773);};}exports[_0x30f7('0x29')]=function(_0x29bec2,_0x28daf5){var _0x3e26f3={},_0x4f16ab={},_0x7a869a={'count':0x0,'rows':[]};var _0x4fb3bb=_[_0x30f7('0x2a')](db['Campaign'][_0x30f7('0x2b')],function(_0x3e6db7){return{'name':_0x3e6db7[_0x30f7('0x2c')],'type':_0x3e6db7[_0x30f7('0x2d')]['key']};});_0x4f16ab['model']=_[_0x30f7('0x2a')](_0x4fb3bb,_0x30f7('0x27'));_0x4f16ab[_0x30f7('0x2e')]=_[_0x30f7('0x2f')](_0x29bec2['query']);_0x4f16ab[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x4f16ab[_0x30f7('0x32')],_0x4f16ab[_0x30f7('0x2e')]);_0x3e26f3[_0x30f7('0x33')]=_[_0x30f7('0x31')](_0x4f16ab[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x29bec2[_0x30f7('0x2e')]['fields']));_0x3e26f3[_0x30f7('0x33')]=_0x3e26f3[_0x30f7('0x33')][_0x30f7('0x35')]?_0x3e26f3[_0x30f7('0x33')]:_0x4f16ab['model'];if(!_0x29bec2[_0x30f7('0x2e')][_0x30f7('0x36')](_0x30f7('0x37'))){_0x3e26f3['limit']=qs[_0x30f7('0x1a')](_0x29bec2[_0x30f7('0x2e')][_0x30f7('0x1a')]);_0x3e26f3[_0x30f7('0x18')]=qs[_0x30f7('0x18')](_0x29bec2[_0x30f7('0x2e')][_0x30f7('0x18')]);}_0x3e26f3[_0x30f7('0x38')]=qs['sort'](_0x29bec2[_0x30f7('0x2e')][_0x30f7('0x39')]);_0x3e26f3['where']=qs[_0x30f7('0x30')](_[_0x30f7('0x3a')](_0x29bec2[_0x30f7('0x2e')],_0x4f16ab[_0x30f7('0x30')]),_0x4fb3bb);if(_0x29bec2[_0x30f7('0x2e')][_0x30f7('0x3b')]){_0x3e26f3[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x3e26f3[_0x30f7('0x3c')],{'$or':_[_0x30f7('0x2a')](_0x4fb3bb,function(_0x1edc3b){if(_0x1edc3b[_0x30f7('0x2d')]!==_0x30f7('0x3e')){var _0xb025bc={};_0xb025bc[_0x1edc3b[_0x30f7('0x27')]]={'$like':'%'+_0x29bec2['query'][_0x30f7('0x3b')]+'%'};return _0xb025bc;}})});}_0x3e26f3=_['merge']({},_0x3e26f3,_0x29bec2['options']);var _0x57795c={'where':_0x3e26f3[_0x30f7('0x3c')]};return db[_0x30f7('0x3f')][_0x30f7('0x1b')](_0x57795c)[_0x30f7('0x21')](function(_0x46b098){_0x7a869a[_0x30f7('0x1b')]=_0x46b098;if(_0x29bec2['query'][_0x30f7('0x40')]){_0x3e26f3[_0x30f7('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x3e26f3);})['then'](function(_0x5194c7){_0x7a869a[_0x30f7('0x42')]=_0x5194c7;return _0x7a869a;})['then'](respondWithFilteredResult(_0x28daf5,_0x3e26f3))[_0x30f7('0x43')](handleError(_0x28daf5,null));};exports[_0x30f7('0x44')]=function(_0xb3bcc5,_0x554a13){var _0x1afce1={'raw':![],'where':{'id':_0xb3bcc5[_0x30f7('0x45')]['id']}},_0x388484={};_0x388484[_0x30f7('0x32')]=_[_0x30f7('0x2f')](db[_0x30f7('0x3f')]['rawAttributes']);_0x388484['query']=_[_0x30f7('0x2f')](_0xb3bcc5[_0x30f7('0x2e')]);_0x388484[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x388484['model'],_0x388484[_0x30f7('0x2e')]);_0x1afce1[_0x30f7('0x33')]=_[_0x30f7('0x31')](_0x388484['model'],qs['fields'](_0xb3bcc5[_0x30f7('0x2e')][_0x30f7('0x34')]));_0x1afce1['attributes']=_0x1afce1[_0x30f7('0x33')]['length']?_0x1afce1[_0x30f7('0x33')]:_0x388484[_0x30f7('0x32')];if(_0xb3bcc5[_0x30f7('0x2e')][_0x30f7('0x40')]){_0x1afce1[_0x30f7('0x41')]=[{'all':!![]}];}_0x1afce1=_[_0x30f7('0x3d')]({},_0x1afce1,_0xb3bcc5[_0x30f7('0x46')]);return db[_0x30f7('0x3f')][_0x30f7('0x47')](_0x1afce1)[_0x30f7('0x21')](handleEntityNotFound(_0x554a13,null))[_0x30f7('0x21')](respondWithResult(_0x554a13,null))[_0x30f7('0x43')](handleError(_0x554a13,null));};exports[_0x30f7('0x48')]=function(_0x3a18b9,_0x1c18af){return db[_0x30f7('0x3f')][_0x30f7('0x48')](_0x3a18b9[_0x30f7('0x49')],{})[_0x30f7('0x21')](function(_0x1c914f){var _0x1b99df=_0x3a18b9['user'][_0x30f7('0x4a')]({'plain':!![]});if(!_0x1b99df)throw new Error(_0x30f7('0x4b'));if(_0x1b99df[_0x30f7('0x4c')]===_0x30f7('0x4d')){var _0x1bc348=_0x1c914f[_0x30f7('0x4a')]({'plain':!![]});var _0x26377e=_0x30f7('0x22');return db[_0x30f7('0x4e')][_0x30f7('0x47')]({'where':{'name':_0x26377e,'userProfileId':_0x1b99df[_0x30f7('0x4f')]},'raw':!![]})[_0x30f7('0x21')](function(_0x5e5207){if(_0x5e5207&&_0x5e5207[_0x30f7('0x50')]===0x0){return db['UserProfileResource'][_0x30f7('0x48')]({'name':_0x1bc348[_0x30f7('0x27')],'resourceId':_0x1bc348['id'],'type':_0x5e5207[_0x30f7('0x27')],'sectionId':_0x5e5207['id']},{})['then'](function(){return _0x1c914f;});}else{return _0x1c914f;}})[_0x30f7('0x43')](function(_0x9fc9f){logger[_0x30f7('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9fc9f);throw _0x9fc9f;});}return _0x1c914f;})['then'](respondWithResult(_0x1c18af,0xc9))[_0x30f7('0x43')](handleError(_0x1c18af,null));};exports[_0x30f7('0x51')]=function(_0x5d023f,_0x5c00f2){var _0x406b8b={'where':{'id':_0x5d023f['params']['id']}},_0x14660d={};_0x14660d[_0x30f7('0x32')]=_[_0x30f7('0x2f')](db[_0x30f7('0x3f')][_0x30f7('0x2b')]);_0x406b8b[_0x30f7('0x33')]=_[_0x30f7('0x31')](_0x14660d[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x5d023f[_0x30f7('0x2e')][_0x30f7('0x34')]));_0x406b8b['attributes']=_0x406b8b[_0x30f7('0x33')]['length']?_0x406b8b[_0x30f7('0x33')]:_0x14660d[_0x30f7('0x32')];if(_0x5d023f[_0x30f7('0x2e')][_0x30f7('0x40')]){_0x406b8b[_0x30f7('0x41')]=[{'all':!![]}];}_0x406b8b=_[_0x30f7('0x3d')]({},_0x406b8b,_0x5d023f['options']);return db[_0x30f7('0x3f')][_0x30f7('0x47')](_0x406b8b)['then'](handleEntityNotFound(_0x5c00f2,null))['then'](function(_0x1a9a55){if(_0x1a9a55){var _0x38c670=_0x1a9a55[_0x30f7('0x4a')]({'plain':!![]});_0x38c670=qs[_0x30f7('0x52')](_0x38c670,['id',_0x30f7('0x53'),_0x30f7('0x54')]);_0x5d023f[_0x30f7('0x49')]=_[_0x30f7('0x52')](_0x5d023f[_0x30f7('0x49')],['id',_0x30f7('0x53'),_0x30f7('0x54')]);return db[_0x30f7('0x3f')][_0x30f7('0x48')](_[_0x30f7('0x3d')](_0x38c670,_0x5d023f[_0x30f7('0x49')]),{'include':_0x5d023f[_0x30f7('0x2e')][_0x30f7('0x40')]?[{'all':!![]}]:undefined})[_0x30f7('0x21')](function(_0x72f8e){var _0x3e25c4=_0x5d023f['user'][_0x30f7('0x4a')]({'plain':!![]});if(!_0x3e25c4)throw new Error(_0x30f7('0x4b'));if(_0x3e25c4[_0x30f7('0x4c')]===_0x30f7('0x4d')){var _0x4cb28e=_0x72f8e['get']({'plain':!![]});var _0x1f933c='IvrCampaigns';return db[_0x30f7('0x4e')][_0x30f7('0x47')]({'where':{'name':_0x1f933c,'userProfileId':_0x3e25c4[_0x30f7('0x4f')]},'raw':!![]})['then'](function(_0x371d8c){if(_0x371d8c&&_0x371d8c['autoAssociation']===0x0){return db[_0x30f7('0x23')][_0x30f7('0x48')]({'name':_0x4cb28e[_0x30f7('0x27')],'resourceId':_0x4cb28e['id'],'type':_0x371d8c['name'],'sectionId':_0x371d8c['id']},{})[_0x30f7('0x21')](function(){return _0x72f8e;});}else{return _0x72f8e;}})[_0x30f7('0x43')](function(_0x473723){logger[_0x30f7('0x25')](_0x30f7('0x55'),_0x473723);throw _0x473723;});}return _0x72f8e;});}})[_0x30f7('0x21')](respondWithResult(_0x5c00f2,0xc9))['catch'](handleError(_0x5c00f2,null));};exports[_0x30f7('0x56')]=function(_0x2cd21a,_0x4e32f4){if(_0x2cd21a[_0x30f7('0x49')]['id']){delete _0x2cd21a[_0x30f7('0x49')]['id'];}return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x2cd21a[_0x30f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e32f4,null))[_0x30f7('0x21')](saveUpdates(_0x2cd21a[_0x30f7('0x49')],null))['then'](respondWithResult(_0x4e32f4,null))[_0x30f7('0x43')](handleError(_0x4e32f4,null));};exports[_0x30f7('0x57')]=function(_0x236b4a,_0x4f744f){return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x236b4a[_0x30f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f744f,null))[_0x30f7('0x21')](removeEntity(_0x4f744f,null))[_0x30f7('0x43')](handleError(_0x4f744f,null));};exports[_0x30f7('0x58')]=function(_0x4872fb,_0x2f3ed6,_0xd9dadd){var _0x3447dc={'raw':!![],'where':{}};var _0x5aaa24={};var _0x49d879={'count':0x0,'rows':[]};return db[_0x30f7('0x3f')][_0x30f7('0x59')]({'where':{'id':_0x4872fb[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x2f3ed6,null))[_0x30f7('0x21')](function(_0xa8f9f4){if(_0xa8f9f4){_0x5aaa24[_0x30f7('0x32')]=_[_0x30f7('0x2f')](db[_0x30f7('0x5a')][_0x30f7('0x2b')]);_0x5aaa24['query']=_['keys'](_0x4872fb[_0x30f7('0x2e')]);_0x5aaa24[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x5aaa24['model'],_0x5aaa24[_0x30f7('0x2e')]);_0x3447dc[_0x30f7('0x33')]=_[_0x30f7('0x31')](_0x5aaa24['model'],qs[_0x30f7('0x34')](_0x4872fb[_0x30f7('0x2e')]['fields']));_0x3447dc['attributes']=_0x3447dc[_0x30f7('0x33')][_0x30f7('0x35')]?_0x3447dc[_0x30f7('0x33')]:_0x5aaa24[_0x30f7('0x32')];if(!_0x4872fb['query'][_0x30f7('0x36')]('nolimit')){_0x3447dc[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x4872fb[_0x30f7('0x2e')]['limit']);_0x3447dc[_0x30f7('0x18')]=qs[_0x30f7('0x18')](_0x4872fb['query'][_0x30f7('0x18')]);}_0x3447dc['order']=qs['sort'](_0x4872fb[_0x30f7('0x2e')][_0x30f7('0x39')]);_0x3447dc[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_['pick'](_0x4872fb['query'],_0x5aaa24['filters']));_0x3447dc[_0x30f7('0x3c')][_0x30f7('0x5b')]=_0xa8f9f4['id'];if(_0x4872fb[_0x30f7('0x2e')][_0x30f7('0x3b')]){_0x3447dc['where']=_[_0x30f7('0x3d')](_0x3447dc[_0x30f7('0x3c')],{'$or':_['map'](_0x3447dc[_0x30f7('0x33')],function(_0x5d22a6){var _0x4fc748={};_0x4fc748[_0x5d22a6]={'$like':'%'+_0x4872fb[_0x30f7('0x2e')][_0x30f7('0x3b')]+'%'};return _0x4fc748;})});}_0x3447dc=_[_0x30f7('0x3d')]({},_0x3447dc,_0x4872fb[_0x30f7('0x46')]);return db[_0x30f7('0x5a')]['count']({'where':_0x3447dc['where']})[_0x30f7('0x21')](function(_0x5931be){_0x49d879[_0x30f7('0x1b')]=_0x5931be;if(_0x4872fb[_0x30f7('0x2e')]['includeAll']){_0x3447dc[_0x30f7('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x30f7('0x5c')](_0x3447dc);})[_0x30f7('0x21')](function(_0xb10ecc){_0x49d879[_0x30f7('0x42')]=_0xb10ecc;return _0x49d879;});}})['then'](respondWithFilteredResult(_0x2f3ed6,_0x3447dc))[_0x30f7('0x43')](handleError(_0x2f3ed6,null));};exports[_0x30f7('0x5d')]=function(_0x1c0584,_0x40416b,_0x3b8c17){var _0x4e62e8={'raw':!![],'where':{}};var _0x274b56={};var _0x5b5d14={'count':0x0,'rows':[]};return db[_0x30f7('0x3f')][_0x30f7('0x59')]({'where':{'id':_0x1c0584[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x40416b,null))[_0x30f7('0x21')](function(_0x5bcc8b){if(_0x5bcc8b){_0x274b56[_0x30f7('0x32')]=_['keys'](db['CmHopperHistory'][_0x30f7('0x2b')]);_0x274b56['query']=_[_0x30f7('0x2f')](_0x1c0584[_0x30f7('0x2e')]);_0x274b56[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x274b56[_0x30f7('0x32')],_0x274b56['query']);_0x4e62e8['attributes']=_[_0x30f7('0x31')](_0x274b56[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x1c0584[_0x30f7('0x2e')][_0x30f7('0x34')]));_0x4e62e8[_0x30f7('0x33')]=_0x4e62e8[_0x30f7('0x33')]['length']?_0x4e62e8[_0x30f7('0x33')]:_0x274b56[_0x30f7('0x32')];if(!_0x1c0584[_0x30f7('0x2e')][_0x30f7('0x36')]('nolimit')){_0x4e62e8[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x1c0584[_0x30f7('0x2e')]['limit']);_0x4e62e8['offset']=qs[_0x30f7('0x18')](_0x1c0584[_0x30f7('0x2e')]['offset']);}_0x4e62e8[_0x30f7('0x38')]=qs['sort'](_0x1c0584[_0x30f7('0x2e')][_0x30f7('0x39')]);_0x4e62e8[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_['pick'](_0x1c0584[_0x30f7('0x2e')],_0x274b56['filters']));_0x4e62e8['where']['CampaignId']=_0x5bcc8b['id'];if(_0x1c0584[_0x30f7('0x2e')][_0x30f7('0x3b')]){_0x4e62e8[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x4e62e8[_0x30f7('0x3c')],{'$or':_[_0x30f7('0x2a')](_0x4e62e8[_0x30f7('0x33')],function(_0x1c6695){var _0xf9ea30={};_0xf9ea30[_0x1c6695]={'$like':'%'+_0x1c0584[_0x30f7('0x2e')]['filter']+'%'};return _0xf9ea30;})});}_0x4e62e8=_[_0x30f7('0x3d')]({},_0x4e62e8,_0x1c0584[_0x30f7('0x46')]);return db[_0x30f7('0x5e')]['count']({'where':_0x4e62e8['where']})['then'](function(_0x3b7023){_0x5b5d14[_0x30f7('0x1b')]=_0x3b7023;if(_0x1c0584['query'][_0x30f7('0x40')]){_0x4e62e8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x30f7('0x5c')](_0x4e62e8);})['then'](function(_0xda4da9){_0x5b5d14[_0x30f7('0x42')]=_0xda4da9;return _0x5b5d14;});}})[_0x30f7('0x21')](respondWithFilteredResult(_0x40416b,_0x4e62e8))[_0x30f7('0x43')](handleError(_0x40416b,null));};exports[_0x30f7('0x5f')]=function(_0x15240f,_0x38e3d2,_0x23f9b0){var _0x29f50d={'raw':!![],'where':{}};var _0x371559={};var _0x491a22={'count':0x0,'rows':[]};return db[_0x30f7('0x3f')][_0x30f7('0x59')]({'where':{'id':_0x15240f[_0x30f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x38e3d2,null))[_0x30f7('0x21')](function(_0x3acc6e){if(_0x3acc6e){_0x371559[_0x30f7('0x32')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x371559[_0x30f7('0x2e')]=_[_0x30f7('0x2f')](_0x15240f[_0x30f7('0x2e')]);_0x371559['filters']=_[_0x30f7('0x31')](_0x371559[_0x30f7('0x32')],_0x371559[_0x30f7('0x2e')]);_0x29f50d['attributes']=_['intersection'](_0x371559[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x15240f[_0x30f7('0x2e')]['fields']));_0x29f50d[_0x30f7('0x33')]=_0x29f50d[_0x30f7('0x33')]['length']?_0x29f50d[_0x30f7('0x33')]:_0x371559['model'];if(!_0x15240f[_0x30f7('0x2e')][_0x30f7('0x36')](_0x30f7('0x37'))){_0x29f50d[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x15240f[_0x30f7('0x2e')][_0x30f7('0x1a')]);_0x29f50d[_0x30f7('0x18')]=qs[_0x30f7('0x18')](_0x15240f[_0x30f7('0x2e')][_0x30f7('0x18')]);}_0x29f50d[_0x30f7('0x38')]=qs[_0x30f7('0x39')](_0x15240f['query'][_0x30f7('0x39')]);_0x29f50d[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_[_0x30f7('0x3a')](_0x15240f[_0x30f7('0x2e')],_0x371559[_0x30f7('0x30')]));_0x29f50d[_0x30f7('0x3c')][_0x30f7('0x5b')]=_0x3acc6e['id'];if(_0x15240f['query'][_0x30f7('0x3b')]){_0x29f50d[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x29f50d[_0x30f7('0x3c')],{'$or':_[_0x30f7('0x2a')](_0x29f50d['attributes'],function(_0x3be212){var _0x5b8bbb={};_0x5b8bbb[_0x3be212]={'$like':'%'+_0x15240f[_0x30f7('0x2e')]['filter']+'%'};return _0x5b8bbb;})});}_0x29f50d=_[_0x30f7('0x3d')]({},_0x29f50d,_0x15240f[_0x30f7('0x46')]);return db[_0x30f7('0x60')]['count']({'where':_0x29f50d[_0x30f7('0x3c')]})[_0x30f7('0x21')](function(_0x298ee6){_0x491a22[_0x30f7('0x1b')]=_0x298ee6;if(_0x15240f['query'][_0x30f7('0x40')]){_0x29f50d[_0x30f7('0x41')]=[{'all':!![]}];}return db[_0x30f7('0x60')][_0x30f7('0x5c')](_0x29f50d);})[_0x30f7('0x21')](function(_0x57cc2e){_0x491a22[_0x30f7('0x42')]=_0x57cc2e;return _0x491a22;});}})[_0x30f7('0x21')](respondWithFilteredResult(_0x38e3d2,_0x29f50d))['catch'](handleError(_0x38e3d2,null));};exports['getHopperBlacks']=function(_0x549d0d,_0x56a52a,_0xf6e2b5){var _0x2152bd={'raw':!![],'where':{}};var _0x26def3={};var _0x1c326c={'count':0x0,'rows':[]};return db[_0x30f7('0x3f')][_0x30f7('0x59')]({'where':{'id':_0x549d0d[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x56a52a,null))[_0x30f7('0x21')](function(_0x866e68){if(_0x866e68){_0x26def3[_0x30f7('0x32')]=_['keys'](db['CmHopperBlack'][_0x30f7('0x2b')]);_0x26def3[_0x30f7('0x2e')]=_[_0x30f7('0x2f')](_0x549d0d['query']);_0x26def3['filters']=_['intersection'](_0x26def3['model'],_0x26def3['query']);_0x2152bd[_0x30f7('0x33')]=_[_0x30f7('0x31')](_0x26def3[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x549d0d[_0x30f7('0x2e')][_0x30f7('0x34')]));_0x2152bd[_0x30f7('0x33')]=_0x2152bd[_0x30f7('0x33')][_0x30f7('0x35')]?_0x2152bd[_0x30f7('0x33')]:_0x26def3['model'];if(!_0x549d0d['query']['hasOwnProperty'](_0x30f7('0x37'))){_0x2152bd[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x549d0d[_0x30f7('0x2e')][_0x30f7('0x1a')]);_0x2152bd[_0x30f7('0x18')]=qs['offset'](_0x549d0d[_0x30f7('0x2e')][_0x30f7('0x18')]);}_0x2152bd[_0x30f7('0x38')]=qs[_0x30f7('0x39')](_0x549d0d[_0x30f7('0x2e')]['sort']);_0x2152bd[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_['pick'](_0x549d0d[_0x30f7('0x2e')],_0x26def3[_0x30f7('0x30')]));_0x2152bd['where'][_0x30f7('0x5b')]=_0x866e68['id'];if(_0x549d0d['query'][_0x30f7('0x3b')]){_0x2152bd[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x2152bd[_0x30f7('0x3c')],{'$or':_[_0x30f7('0x2a')](_0x2152bd[_0x30f7('0x33')],function(_0x133b9c){var _0x5c235a={};_0x5c235a[_0x133b9c]={'$like':'%'+_0x549d0d[_0x30f7('0x2e')][_0x30f7('0x3b')]+'%'};return _0x5c235a;})});}_0x2152bd=_[_0x30f7('0x3d')]({},_0x2152bd,_0x549d0d[_0x30f7('0x46')]);return db['CmHopperBlack']['count']({'where':_0x2152bd['where']})[_0x30f7('0x21')](function(_0x2a0c99){_0x1c326c['count']=_0x2a0c99;if(_0x549d0d['query'][_0x30f7('0x40')]){_0x2152bd[_0x30f7('0x41')]=[{'all':!![]}];}return db[_0x30f7('0x61')][_0x30f7('0x5c')](_0x2152bd);})[_0x30f7('0x21')](function(_0x35f3e4){_0x1c326c[_0x30f7('0x42')]=_0x35f3e4;return _0x1c326c;});}})['then'](respondWithFilteredResult(_0x56a52a,_0x2152bd))[_0x30f7('0x43')](handleError(_0x56a52a,null));};exports[_0x30f7('0x62')]=function(_0x592f33,_0x13a5e8,_0x3a1aa9){var _0x12e3e0={};var _0x2f0dc4={};var _0x4c0377;var _0x288806;return db[_0x30f7('0x3f')]['findOne']({'where':{'id':_0x592f33[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x13a5e8,null))['then'](function(_0x30befa){if(_0x30befa){_0x4c0377=_0x30befa;_0x2f0dc4['model']=_[_0x30f7('0x2f')](db[_0x30f7('0x63')]['rawAttributes']);_0x2f0dc4[_0x30f7('0x2e')]=_['keys'](_0x592f33['query']);_0x2f0dc4[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x2f0dc4['model'],_0x2f0dc4[_0x30f7('0x2e')]);_0x12e3e0[_0x30f7('0x33')]=_['intersection'](_0x2f0dc4[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x592f33[_0x30f7('0x2e')][_0x30f7('0x34')]));_0x12e3e0[_0x30f7('0x33')]=_0x12e3e0[_0x30f7('0x33')]['length']?_0x12e3e0['attributes']:_0x2f0dc4[_0x30f7('0x32')];_0x12e3e0['order']=qs[_0x30f7('0x39')](_0x592f33[_0x30f7('0x2e')][_0x30f7('0x39')]);_0x12e3e0[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_['pick'](_0x592f33['query'],_0x2f0dc4[_0x30f7('0x30')]));if(_0x592f33['query'][_0x30f7('0x3b')]){_0x12e3e0[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x12e3e0[_0x30f7('0x3c')],{'$or':_[_0x30f7('0x2a')](_0x12e3e0[_0x30f7('0x33')],function(_0x2977d9){var _0x3b02d6={};_0x3b02d6[_0x2977d9]={'$like':'%'+_0x592f33['query']['filter']+'%'};return _0x3b02d6;})});}_0x12e3e0=_[_0x30f7('0x3d')]({},_0x12e3e0,_0x592f33[_0x30f7('0x46')]);return _0x4c0377[_0x30f7('0x62')](_0x12e3e0);}})['then'](function(_0x4bec45){if(_0x4bec45){_0x288806=_0x4bec45['length'];if(!_0x592f33[_0x30f7('0x2e')][_0x30f7('0x36')]('nolimit')){_0x12e3e0[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x592f33['query'][_0x30f7('0x1a')]);_0x12e3e0[_0x30f7('0x18')]=qs['offset'](_0x592f33[_0x30f7('0x2e')][_0x30f7('0x18')]);}return _0x4c0377['getLists'](_0x12e3e0);}})['then'](function(_0x4b317d){if(_0x4b317d){return _0x4b317d?{'count':_0x288806,'rows':_0x4b317d}:null;}})['then'](respondWithResult(_0x13a5e8,null))[_0x30f7('0x43')](handleError(_0x13a5e8,null));};exports['addLists']=function(_0x4100fb,_0x374007,_0x5f5759){var _0x1cb497,_0x2e3048;var _0xf33f57=[];var _0x274a7f=moment()[_0x30f7('0x64')](_0x30f7('0x65'));return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x4100fb[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x374007,null))[_0x30f7('0x21')](function(_0x2557ab){if(_0x2557ab){_0x2e3048=_0x2557ab;return _0x2557ab[_0x30f7('0x66')](_0x4100fb[_0x30f7('0x49')][_0x30f7('0x67')],_[_0x30f7('0x52')](_0x4100fb['body'],[_0x30f7('0x67'),'id'])||{});}return null;})['spread'](function(_0xfb15c2){var _0x3e914d;var _0x3cc1b2;_0x1cb497=_0xfb15c2||[];var _0x1817f8=[];if(_0xfb15c2){for(var _0x4e1c33=0x0;_0x4e1c33<_0xfb15c2[_0x30f7('0x35')];_0x4e1c33+=0x1){var _0x1e316c=_0xfb15c2[_0x4e1c33][_0x30f7('0x4a')]({'plain':!![]});_0x2e3048[_0x30f7('0x68')]=_0x4100fb['body'][_0x30f7('0x68')]?_0x4100fb[_0x30f7('0x49')][_0x30f7('0x68')]:_0x2e3048['dialCheckDuplicateType'];switch(_0x2e3048[_0x30f7('0x68')]){case _0x30f7('0x69'):_0x3e914d=squel['insert']()[_0x30f7('0x6a')](_0x30f7('0x6b'))[_0x30f7('0x6c')]([_0x30f7('0x6d'),_0x30f7('0x6e'),_0x30f7('0x6f'),_0x30f7('0x70'),_0x30f7('0x5b'),_0x30f7('0x53'),_0x30f7('0x54')],squel[_0x30f7('0x71')]()[_0x30f7('0x72')](_0x30f7('0x6d'),_0x30f7('0x6d'))[_0x30f7('0x72')](_0x30f7('0x73'),_0x30f7('0x6e'))[_0x30f7('0x72')]('id',_0x30f7('0x6f'))[_0x30f7('0x72')](_0x1e316c[_0x30f7('0x74')][_0x30f7('0x75')](),_0x30f7('0x70'))[_0x30f7('0x72')](_0x4100fb[_0x30f7('0x45')]['id'][_0x30f7('0x75')](),'CampaignId')[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x53'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x54'))[_0x30f7('0x76')](_0x30f7('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0x30f7('0x3c')]('ListId\x20=\x20?',_0x1e316c[_0x30f7('0x74')]['toString']())[_0x30f7('0x3c')](_0x30f7('0x78'))[_0x30f7('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x30f7('0x71')]()[_0x30f7('0x72')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x30f7('0x3c')](_0x30f7('0x79'),_0x4100fb['params']['id']['toString']()))[_0x30f7('0x3c')](_0x30f7('0x7a'),squel[_0x30f7('0x71')]()[_0x30f7('0x72')](_0x30f7('0x7b'))[_0x30f7('0x76')]('cm_hopper')[_0x30f7('0x3c')](_0x30f7('0x79'),_0x4100fb[_0x30f7('0x45')]['id'][_0x30f7('0x75')]())))['toString']();break;case _0x30f7('0x7c'):_0x3e914d=squel[_0x30f7('0x7d')]()[_0x30f7('0x6a')]('cm_hopper')[_0x30f7('0x6c')]([_0x30f7('0x6d'),_0x30f7('0x6e'),_0x30f7('0x6f'),_0x30f7('0x70'),_0x30f7('0x5b'),_0x30f7('0x53'),_0x30f7('0x54')],squel['select']()[_0x30f7('0x72')](_0x30f7('0x6d'),_0x30f7('0x6d'))[_0x30f7('0x72')](_0x30f7('0x73'),_0x30f7('0x6e'))['field']('id',_0x30f7('0x6f'))['field'](_0x1e316c['CmListId'][_0x30f7('0x75')](),_0x30f7('0x70'))[_0x30f7('0x72')](_0x4100fb[_0x30f7('0x45')]['id'][_0x30f7('0x75')](),_0x30f7('0x5b'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x53'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x54'))[_0x30f7('0x76')](_0x30f7('0x77'))[_0x30f7('0x3c')](_0x30f7('0x7e'))[_0x30f7('0x3c')](_0x30f7('0x7f'),_0x1e316c[_0x30f7('0x74')][_0x30f7('0x75')]())[_0x30f7('0x3c')](_0x30f7('0x78'))[_0x30f7('0x3c')](_0x30f7('0x7a'),squel['select']()['field'](_0x30f7('0x7b'))[_0x30f7('0x76')](_0x30f7('0x6b'))['where']('CampaignId\x20=\x20?',_0x4100fb[_0x30f7('0x45')]['id'][_0x30f7('0x75')]())))[_0x30f7('0x75')]();break;default:_0x3e914d=squel[_0x30f7('0x7d')]()[_0x30f7('0x6a')](_0x30f7('0x6b'))[_0x30f7('0x6c')]([_0x30f7('0x6d'),'scheduledAt','ContactId',_0x30f7('0x70'),_0x30f7('0x5b'),'createdAt',_0x30f7('0x54')],squel[_0x30f7('0x71')]()[_0x30f7('0x72')](_0x30f7('0x6d'),_0x30f7('0x6d'))['field']('NOW()',_0x30f7('0x6e'))['field']('id',_0x30f7('0x6f'))['field'](_0x1e316c['CmListId'][_0x30f7('0x75')](),'ListId')[_0x30f7('0x72')](_0x4100fb[_0x30f7('0x45')]['id'][_0x30f7('0x75')](),_0x30f7('0x5b'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x53'))['field']('\x27'+_0x274a7f+'\x27',_0x30f7('0x54'))[_0x30f7('0x76')](_0x30f7('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0x30f7('0x3c')](_0x30f7('0x7f'),_0x1e316c['CmListId']['toString']())[_0x30f7('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x30f7('0x75')]();}_0x3cc1b2=squel[_0x30f7('0x7d')]()['into'](_0x30f7('0x80'))[_0x30f7('0x6c')]([_0x30f7('0x81'),_0x30f7('0x6e'),_0x30f7('0x6d'),_0x30f7('0x82'),_0x30f7('0x53'),_0x30f7('0x54')],squel[_0x30f7('0x71')]()[_0x30f7('0x72')]('h.id','id')['field']('NOW()',_0x30f7('0x6e'))[_0x30f7('0x72')](_0x30f7('0x83'),_0x30f7('0x6d'))['field']('ci.OrderBY',_0x30f7('0x82'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x53'))[_0x30f7('0x72')]('\x27'+_0x274a7f+'\x27',_0x30f7('0x54'))[_0x30f7('0x76')]('cm_contact_has_items','ci')['join'](_0x30f7('0x6b'),'h',_0x30f7('0x84'))[_0x30f7('0x3c')](_0x30f7('0x85'),_0x1e316c[_0x30f7('0x74')][_0x30f7('0x75')]())[_0x30f7('0x3c')](_0x30f7('0x86'),_0x4100fb['params']['id']['toString']())[_0x30f7('0x3c')](_0x30f7('0x87'),_0x274a7f))[_0x30f7('0x75')]();_0x1817f8[_0x30f7('0x88')](db['sequelize'][_0x30f7('0x2e')](_0x3e914d));_0xf33f57[_0x30f7('0x88')](db[_0x30f7('0x89')]['query'](_0x3cc1b2));}return BPromise['all'](_0x1817f8);}})[_0x30f7('0x21')](function(){return BPromise['all'](_0xf33f57);})['then'](function(){return _0x1cb497;})[_0x30f7('0x21')](respondWithResult(_0x374007,null))[_0x30f7('0x43')](handleError(_0x374007,null));};exports[_0x30f7('0x8a')]=function(_0x2214f2,_0x484904,_0xd03bab){return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x2214f2['params']['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x484904,null))['then'](function(_0x23496c){if(_0x23496c){return _0x23496c['removeLists'](_0x2214f2[_0x30f7('0x2e')]['ids']);}})[_0x30f7('0x21')](function(_0x54994d){if(_0x54994d){return db[_0x30f7('0x5a')][_0x30f7('0x57')]({'where':{'ListId':_0x2214f2[_0x30f7('0x2e')][_0x30f7('0x67')],'CampaignId':_0x2214f2[_0x30f7('0x45')]['id']}})['then'](function(){return _0x54994d;});}})['then'](respondWithStatusCode(_0x484904,null))[_0x30f7('0x43')](handleError(_0x484904,null));};exports[_0x30f7('0x8b')]=function(_0x373a2c,_0x53eb51,_0xb540f3){var _0x4dace9={};var _0x3e01f4={};var _0x663a6c;var _0x23fddc;return db[_0x30f7('0x3f')]['findOne']({'where':{'id':_0x373a2c[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x53eb51,null))[_0x30f7('0x21')](function(_0x332f89){if(_0x332f89){_0x663a6c=_0x332f89;_0x3e01f4[_0x30f7('0x32')]=_['keys'](db[_0x30f7('0x63')][_0x30f7('0x2b')]);_0x3e01f4[_0x30f7('0x2e')]=_[_0x30f7('0x2f')](_0x373a2c['query']);_0x3e01f4[_0x30f7('0x30')]=_[_0x30f7('0x31')](_0x3e01f4[_0x30f7('0x32')],_0x3e01f4[_0x30f7('0x2e')]);_0x4dace9['attributes']=_[_0x30f7('0x31')](_0x3e01f4[_0x30f7('0x32')],qs[_0x30f7('0x34')](_0x373a2c['query'][_0x30f7('0x34')]));_0x4dace9[_0x30f7('0x33')]=_0x4dace9[_0x30f7('0x33')][_0x30f7('0x35')]?_0x4dace9['attributes']:_0x3e01f4[_0x30f7('0x32')];_0x4dace9[_0x30f7('0x38')]=qs[_0x30f7('0x39')](_0x373a2c[_0x30f7('0x2e')][_0x30f7('0x39')]);_0x4dace9[_0x30f7('0x3c')]=qs[_0x30f7('0x30')](_['pick'](_0x373a2c['query'],_0x3e01f4['filters']));if(_0x373a2c[_0x30f7('0x2e')][_0x30f7('0x3b')]){_0x4dace9[_0x30f7('0x3c')]=_[_0x30f7('0x3d')](_0x4dace9['where'],{'$or':_['map'](_0x4dace9[_0x30f7('0x33')],function(_0x1173e1){var _0x29593f={};_0x29593f[_0x1173e1]={'$like':'%'+_0x373a2c['query'][_0x30f7('0x3b')]+'%'};return _0x29593f;})});}_0x4dace9=_[_0x30f7('0x3d')]({},_0x4dace9,_0x373a2c[_0x30f7('0x46')]);return _0x663a6c[_0x30f7('0x8b')](_0x4dace9);}})[_0x30f7('0x21')](function(_0x1971a5){if(_0x1971a5){_0x23fddc=_0x1971a5[_0x30f7('0x35')];if(!_0x373a2c[_0x30f7('0x2e')][_0x30f7('0x36')](_0x30f7('0x37'))){_0x4dace9[_0x30f7('0x1a')]=qs[_0x30f7('0x1a')](_0x373a2c['query'][_0x30f7('0x1a')]);_0x4dace9['offset']=qs['offset'](_0x373a2c[_0x30f7('0x2e')][_0x30f7('0x18')]);}return _0x663a6c[_0x30f7('0x8b')](_0x4dace9);}})['then'](function(_0x39756f){if(_0x39756f){return _0x39756f?{'count':_0x23fddc,'rows':_0x39756f}:null;}})[_0x30f7('0x21')](respondWithResult(_0x53eb51,null))[_0x30f7('0x43')](handleError(_0x53eb51,null));};exports['addBlackLists']=function(_0x574882,_0x33ced6,_0x5d38f1){var _0x21461f,_0x5321fb;var _0x182a65=[];var _0x5905f0=moment()[_0x30f7('0x64')](_0x30f7('0x65'));return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x574882['params']['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x33ced6,null))['then'](function(_0x36b029){if(_0x36b029){_0x5321fb=_0x36b029;return _0x36b029[_0x30f7('0x8c')](_0x574882[_0x30f7('0x49')][_0x30f7('0x67')],_[_0x30f7('0x52')](_0x574882[_0x30f7('0x49')],['ids','id'])||{});}return null;})[_0x30f7('0x8d')](function(_0x157d2b){var _0x1ae1b4;var _0xdc63cc;_0x21461f=_0x157d2b||[];var _0xddea02=[];if(_0x157d2b){for(var _0x21b41a=0x0;_0x21b41a<_0x157d2b[_0x30f7('0x35')];_0x21b41a+=0x1){var _0xc87f16=_0x157d2b[_0x21b41a][_0x30f7('0x4a')]({'plain':!![]});_0x1ae1b4=squel[_0x30f7('0x7d')]()[_0x30f7('0x6a')]('cm_hopper_black')['fromQuery']([_0x30f7('0x6d'),'ContactId','ListId','CampaignId',_0x30f7('0x53'),'updatedAt'],squel[_0x30f7('0x71')]()[_0x30f7('0x72')](_0x30f7('0x6d'),'phone')['field']('id',_0x30f7('0x6f'))[_0x30f7('0x72')](_0xc87f16['CmListId'][_0x30f7('0x75')](),_0x30f7('0x70'))['field'](_0x574882[_0x30f7('0x45')]['id'][_0x30f7('0x75')](),'CampaignId')[_0x30f7('0x72')](_0x30f7('0x73'),_0x30f7('0x53'))[_0x30f7('0x72')](_0x30f7('0x73'),'updatedAt')['from']('cm_contacts')[_0x30f7('0x3c')](_0x30f7('0x7e'))[_0x30f7('0x3c')](_0x30f7('0x7f'),_0xc87f16[_0x30f7('0x74')]['toString']())[_0x30f7('0x3c')](_0x30f7('0x78')))[_0x30f7('0x75')]();_0xddea02['push'](db[_0x30f7('0x89')]['query'](_0x1ae1b4));}return BPromise[_0x30f7('0x8e')](_0xddea02);}})['then'](function(){return _0x21461f;})[_0x30f7('0x21')](respondWithResult(_0x33ced6,null))[_0x30f7('0x43')](handleError(_0x33ced6,null));};exports[_0x30f7('0x8f')]=function(_0x5e7d90,_0xe68149,_0x3b7114){return db[_0x30f7('0x3f')][_0x30f7('0x47')]({'where':{'id':_0x5e7d90[_0x30f7('0x45')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0xe68149,null))['then'](function(_0x1fef60){if(_0x1fef60){return _0x1fef60[_0x30f7('0x8f')](_0x5e7d90[_0x30f7('0x2e')]['ids']);}})[_0x30f7('0x21')](function(_0x229180){if(_0x229180){return db['CmHopperBlack'][_0x30f7('0x57')]({'where':{'ListId':_0x5e7d90['query'][_0x30f7('0x67')],'CampaignId':_0x5e7d90['params']['id']}})[_0x30f7('0x21')](function(){return _0x229180;});}})[_0x30f7('0x21')](respondWithStatusCode(_0xe68149,null))[_0x30f7('0x43')](handleError(_0xe68149,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9b86841..e8dfa54 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(_0x4b2a90,_0x27f5ea){var _0x30bee3=function(_0x30fd3e){while(--_0x30fd3e){_0x4b2a90['push'](_0x4b2a90['shift']());}};_0x30bee3(++_0x27f5ea);}(_0x7a54,0x106));var _0x47a5=function(_0x52996c,_0x28d50d){_0x52996c=_0x52996c-0x0;var _0x2e0201=_0x7a54[_0x52996c];return _0x2e0201;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8b04a52..9284444 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 _0x44f8=['raw','where','attributes','limit','include','map','model','then','GetCampaign','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Campaign,\x20%s,\x20%s','message','result','catch','options'];(function(_0x1e5246,_0x376043){var _0xf4d359=function(_0x5f4eb9){while(--_0x5f4eb9){_0x1e5246['push'](_0x1e5246['shift']());}};_0xf4d359(++_0x376043);}(_0x44f8,0x1de));var _0x844f=function(_0x500a6f,_0xa7042e){_0x500a6f=_0x500a6f-0x0;var _0x1093cc=_0x44f8[_0x500a6f];return _0x1093cc;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Campaign,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['GetCampaign']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['Campaign']['findAll']({'raw':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x10')]===undefined?!![]:![]:!![],'where':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x11')]||null:null,'attributes':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x12')]||null:null,'limit':_0x1f96d0['options']?_0x1f96d0['options'][_0x844f('0x13')]||null:null,'include':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x14')]?_[_0x844f('0x15')](_0x1f96d0['options'][_0x844f('0x14')],function(_0x4bd66d){return{'model':db[_0x4bd66d[_0x844f('0x16')]],'as':_0x4bd66d['as'],'attributes':_0x4bd66d['attributes'],'include':_0x4bd66d[_0x844f('0x14')]?_[_0x844f('0x15')](_0x4bd66d[_0x844f('0x14')],function(_0x7dc0c9){return{'model':db[_0x7dc0c9[_0x844f('0x16')]],'as':_0x7dc0c9['as'],'attributes':_0x7dc0c9[_0x844f('0x12')],'include':_0x7dc0c9[_0x844f('0x14')]?_['map'](_0x7dc0c9[_0x844f('0x14')],function(_0x16d7ad){return{'model':db[_0x16d7ad[_0x844f('0x16')]],'as':_0x16d7ad['as'],'attributes':_0x16d7ad[_0x844f('0x12')]};}):[]};}):[]};}):[]:[]})[_0x844f('0x17')](function(_0x29d224){logger['info'](_0x844f('0x18'),_0x1f96d0);logger[_0x844f('0x19')](_0x844f('0x18'),_0x1f96d0,JSON['stringify'](_0x29d224));_0x5cc55c(_0x29d224);})['catch'](function(_0x1e243c){logger[_0x844f('0xa')](_0x844f('0x18'),_0x1e243c['message'],_0x1f96d0);_0x24e386(_0x2cca8e[_0x844f('0xa')](0x1f4,_0x1e243c['message']));});});}; \ No newline at end of file +var _0x639a=['then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','options','raw','limit','map','include','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x639a,0xec));var _0xa639=function(_0x23f58b,_0x16c2c4){_0x23f58b=_0x23f58b-0x0;var _0x494e3a=_0x639a[_0x23f58b];return _0x494e3a;};'use strict';var _=require('lodash');var util=require(_0xa639('0x0'));var moment=require(_0xa639('0x1'));var BPromise=require(_0xa639('0x2'));var rs=require(_0xa639('0x3'));var fs=require('fs');var Redis=require(_0xa639('0x4'));var db=require(_0xa639('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa639('0x6'))(_0xa639('0x7'));var config=require(_0xa639('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa639('0x9')][_0xa639('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29d2e4,_0x4223f6,_0x4c4ebf){return new BPromise(function(_0xfb7f17,_0x3ec583){return client[_0xa639('0xb')](_0x29d2e4,_0x4c4ebf)[_0xa639('0xc')](function(_0x324365){logger[_0xa639('0xd')](_0xa639('0xe'),_0x4223f6,_0xa639('0xf'));logger[_0xa639('0x10')](_0xa639('0x11'),_0x4223f6,_0xa639('0xf'),JSON[_0xa639('0x12')](_0x324365));if(_0x324365[_0xa639('0x13')]){if(_0x324365[_0xa639('0x13')]['code']===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x4223f6,_0x324365[_0xa639('0x13')][_0xa639('0x14')]);return _0x3ec583(_0x324365['error']['message']);}logger[_0xa639('0x13')](_0xa639('0xe'),_0x4223f6,_0x324365['error'][_0xa639('0x14')]);return _0xfb7f17(_0x324365[_0xa639('0x13')][_0xa639('0x14')]);}else{logger['info'](_0xa639('0xe'),_0x4223f6,_0xa639('0xf'));_0xfb7f17(_0x324365[_0xa639('0x15')][_0xa639('0x14')]);}})[_0xa639('0x16')](function(_0x5924bd){logger[_0xa639('0x13')]('Campaign,\x20%s,\x20%s',_0x4223f6,_0x5924bd);_0x3ec583(_0x5924bd);});});}exports[_0xa639('0x17')]=function(_0x2e23a9){var _0xbd8a9=this;return new Promise(function(_0x229545,_0x3a8ee9){return db['Campaign']['findAll']({'raw':_0x2e23a9[_0xa639('0x18')]?_0x2e23a9[_0xa639('0x18')][_0xa639('0x19')]===undefined?!![]:![]:!![],'where':_0x2e23a9[_0xa639('0x18')]?_0x2e23a9[_0xa639('0x18')]['where']||null:null,'attributes':_0x2e23a9['options']?_0x2e23a9[_0xa639('0x18')]['attributes']||null:null,'limit':_0x2e23a9['options']?_0x2e23a9['options'][_0xa639('0x1a')]||null:null,'include':_0x2e23a9[_0xa639('0x18')]?_0x2e23a9[_0xa639('0x18')]['include']?_[_0xa639('0x1b')](_0x2e23a9['options'][_0xa639('0x1c')],function(_0x351a33){return{'model':db[_0x351a33['model']],'as':_0x351a33['as'],'attributes':_0x351a33['attributes'],'include':_0x351a33['include']?_[_0xa639('0x1b')](_0x351a33['include'],function(_0x42b5d8){return{'model':db[_0x42b5d8[_0xa639('0x1d')]],'as':_0x42b5d8['as'],'attributes':_0x42b5d8[_0xa639('0x1e')],'include':_0x42b5d8[_0xa639('0x1c')]?_['map'](_0x42b5d8[_0xa639('0x1c')],function(_0x1a0d4e){return{'model':db[_0x1a0d4e[_0xa639('0x1d')]],'as':_0x1a0d4e['as'],'attributes':_0x1a0d4e[_0xa639('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa639('0xc')](function(_0x398055){logger[_0xa639('0xd')](_0xa639('0x17'),_0x2e23a9);logger[_0xa639('0x10')](_0xa639('0x17'),_0x2e23a9,JSON['stringify'](_0x398055));_0x229545(_0x398055);})[_0xa639('0x16')](function(_0x38ff11){logger[_0xa639('0x13')](_0xa639('0x17'),_0x38ff11[_0xa639('0x14')],_0x2e23a9);_0x3a8ee9(_0xbd8a9['error'](0x1f4,_0x38ff11[_0xa639('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a9414be..f811e68 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 _0xdeaf=['/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','removeLists','multer','util','path','Router','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','create','/:id/clone','clone'];(function(_0x316a66,_0x445ebc){var _0x100b8e=function(_0x25e5b8){while(--_0x25e5b8){_0x316a66['push'](_0x316a66['shift']());}};_0x100b8e(++_0x445ebc);}(_0xdeaf,0x19e));var _0xfdea=function(_0x24de71,_0x3af991){_0x24de71=_0x24de71-0x0;var _0x4d0303=_0xdeaf[_0x24de71];return _0x4d0303;};'use strict';var multer=require(_0xfdea('0x0'));var util=require(_0xfdea('0x1'));var path=require(_0xfdea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfdea('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfdea('0x4'));router[_0xfdea('0x5')]('/',auth[_0xfdea('0x6')](),controller[_0xfdea('0x7')]);router['get'](_0xfdea('0x8'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x9')]);router[_0xfdea('0x5')]('/:id/hoppers',auth[_0xfdea('0x6')](),controller['getHoppers']);router[_0xfdea('0x5')](_0xfdea('0xa'),auth[_0xfdea('0x6')](),controller[_0xfdea('0xb')]);router[_0xfdea('0x5')](_0xfdea('0xc'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xfdea('0x5')](_0xfdea('0xd'),auth[_0xfdea('0x6')](),controller[_0xfdea('0xe')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xfdea('0xf')]);router['get']('/:id/blacklists',auth[_0xfdea('0x6')](),controller[_0xfdea('0x10')]);router[_0xfdea('0x11')]('/',auth[_0xfdea('0x6')](),controller[_0xfdea('0x12')]);router[_0xfdea('0x11')](_0xfdea('0x13'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x14')]);router[_0xfdea('0x11')](_0xfdea('0x15'),auth['isAuthenticated'](),controller[_0xfdea('0x16')]);router[_0xfdea('0x11')](_0xfdea('0x17'),auth[_0xfdea('0x6')](),controller[_0xfdea('0x18')]);router[_0xfdea('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xfdea('0x1a')]);router[_0xfdea('0x1b')](_0xfdea('0x8'),auth[_0xfdea('0x6')](),controller['destroy']);router[_0xfdea('0x1b')](_0xfdea('0x15'),auth['isAuthenticated'](),controller[_0xfdea('0x1c')]);router[_0xfdea('0x1b')](_0xfdea('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x0e85=['multer','util','connect-timeout','express','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','/:id/lists','addBlackLists','put','update','destroy','delete','removeLists','exports'];(function(_0x1c4efc,_0x3c921d){var _0x54d8de=function(_0x9e4173){while(--_0x9e4173){_0x1c4efc['push'](_0x1c4efc['shift']());}};_0x54d8de(++_0x3c921d);}(_0x0e85,0x7c));var _0x50e8=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x0e85[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['getHoppers']);router[_0x50e8('0x6')](_0x50e8('0xc'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0x6')](_0x50e8('0xe'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router['get']('/:id/hopper_black',auth[_0x50e8('0x7')](),controller[_0x50e8('0x10')]);router['get']('/:id/lists',auth[_0x50e8('0x7')](),controller[_0x50e8('0x11')]);router[_0x50e8('0x6')](_0x50e8('0x12'),auth['isAuthenticated'](),controller[_0x50e8('0x13')]);router[_0x50e8('0x14')]('/',auth[_0x50e8('0x7')](),controller['create']);router['post'](_0x50e8('0x15'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x16')]);router[_0x50e8('0x14')](_0x50e8('0x17'),auth[_0x50e8('0x7')](),controller['addLists']);router['post'](_0x50e8('0x12'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x18')]);router[_0x50e8('0x19')](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x1a')]);router['delete'](_0x50e8('0x9'),auth['isAuthenticated'](),controller[_0x50e8('0x1b')]);router[_0x50e8('0x1c')](_0x50e8('0x17'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x1d')]);router['delete'](_0x50e8('0x12'),auth[_0x50e8('0x7')](),controller['removeBlackLists']);module[_0x50e8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1c4d89f..8a06101 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 _0xbaa1=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x1e3116,_0x3b2e5c){var _0x3a5501=function(_0x51b726){while(--_0x51b726){_0x1e3116['push'](_0x1e3116['shift']());}};_0x3a5501(++_0x3b2e5c);}(_0xbaa1,0x168));var _0x1baa=function(_0x5d9447,_0x642173){_0x5d9447=_0x5d9447-0x0;var _0x11bae2=_0xbaa1[_0x5d9447];return _0x11bae2;};'use strict';var Sequelize=require(_0x1baa('0x0'));module[_0x1baa('0x1')]={'key':{'type':Sequelize[_0x1baa('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x1baa('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x1baa('0x2')]},'name':{'type':Sequelize[_0x1baa('0x4')],'get':function(){return this[_0x1baa('0x5')]('key');}}}; \ No newline at end of file +var _0x2788=['STRING','TEXT','getDataValue','key'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x2788,0x138));var _0x8278=function(_0x3ab2ce,_0xfe27ec){_0x3ab2ce=_0x3ab2ce-0x0;var _0x35c612=_0x2788[_0x3ab2ce];return _0x35c612;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x8278('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x8278('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8278('0x0')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8278('0x2')](_0x8278('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1eba068..f864fbb 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 _0x4fe9=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','include','CannedAnswer','rows','params','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','UserProfileResource','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x486512,_0x1c4f06){var _0x48e24a=function(_0x18570c){while(--_0x18570c){_0x486512['push'](_0x486512['shift']());}};_0x48e24a(++_0x1c4f06);}(_0x4fe9,0x132));var _0x94fe=function(_0x4dde9f,_0x2de95f){_0x4dde9f=_0x4dde9f-0x0;var _0x429e11=_0x4fe9[_0x4dde9f];return _0x429e11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94fe('0x0'));var zipdir=require(_0x94fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94fe('0x2'));var moment=require(_0x94fe('0x3'));var BPromise=require(_0x94fe('0x4'));var Mustache=require(_0x94fe('0x5'));var util=require(_0x94fe('0x6'));var path=require('path');var sox=require(_0x94fe('0x7'));var csv=require(_0x94fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94fe('0x9'));var squel=require('squel');var crypto=require(_0x94fe('0xa'));var jsforce=require(_0x94fe('0xb'));var deskjs=require(_0x94fe('0xc'));var toCsv=require(_0x94fe('0x8'));var querystring=require(_0x94fe('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x94fe('0xe'));var as=require(_0x94fe('0xf'));var hardwareService=require(_0x94fe('0x10'));var logger=require('../../config/logger')(_0x94fe('0x11'));var utils=require(_0x94fe('0x12'));var config=require(_0x94fe('0x13'));var licenseUtil=require(_0x94fe('0x14'));var db=require(_0x94fe('0x15'))['db'];function respondWithStatusCode(_0x1fcf80,_0x5a57c1){_0x5a57c1=_0x5a57c1||0xcc;return function(_0x43507d){if(_0x43507d){return _0x1fcf80[_0x94fe('0x16')](_0x5a57c1);}return _0x1fcf80[_0x94fe('0x17')](_0x5a57c1)['end']();};}function respondWithResult(_0x379a8a,_0x86a93e){_0x86a93e=_0x86a93e||0xc8;return function(_0x15c5fd){if(_0x15c5fd){return _0x379a8a[_0x94fe('0x17')](_0x86a93e)[_0x94fe('0x18')](_0x15c5fd);}};}function respondWithFilteredResult(_0x74906b,_0x46c917){return function(_0x45f4ef){if(_0x45f4ef){var _0x32aafa=typeof _0x46c917['offset']==='undefined'&&typeof _0x46c917[_0x94fe('0x19')]===_0x94fe('0x1a');var _0x18f2cc=_0x45f4ef[_0x94fe('0x1b')];var _0x3a6c90=_0x32aafa?0x0:_0x46c917[_0x94fe('0x1c')];var _0x47014c=_0x32aafa?_0x45f4ef[_0x94fe('0x1b')]:_0x46c917[_0x94fe('0x1c')]+_0x46c917[_0x94fe('0x19')];var _0x74352b;if(_0x47014c>=_0x18f2cc){_0x47014c=_0x18f2cc;_0x74352b=0xc8;}else{_0x74352b=0xce;}_0x74906b[_0x94fe('0x17')](_0x74352b);return _0x74906b['set']('Content-Range',_0x3a6c90+'-'+_0x47014c+'/'+_0x18f2cc)[_0x94fe('0x18')](_0x45f4ef);}return null;};}function patchUpdates(_0x4ceedd){return function(_0x51248f){try{jsonpatch[_0x94fe('0x1d')](_0x51248f,_0x4ceedd,!![]);}catch(_0x44a9a3){return BPromise[_0x94fe('0x1e')](_0x44a9a3);}return _0x51248f[_0x94fe('0x1f')]();};}function saveUpdates(_0x4e2047,_0x3df344){return function(_0x297a22){if(_0x297a22){return _0x297a22[_0x94fe('0x20')](_0x4e2047)['then'](function(_0x2374b5){return _0x2374b5;});}return null;};}function removeEntity(_0x251418,_0x1e86bc){return function(_0x4238a0){if(_0x4238a0){return _0x4238a0['destroy']()[_0x94fe('0x21')](function(){var _0x12d173=_0x4238a0['get']({'plain':!![]});var _0x99bc5b='CannedAnswers';return db['UserProfileResource'][_0x94fe('0x22')]({'where':{'type':_0x99bc5b,'resourceId':_0x12d173['id']}})[_0x94fe('0x21')](function(){return _0x4238a0;});})[_0x94fe('0x21')](function(){_0x251418[_0x94fe('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x135d15,_0x15dcfe){return function(_0x501aec){if(!_0x501aec){_0x135d15[_0x94fe('0x16')](0x194);}return _0x501aec;};}function handleError(_0x238e49,_0x4864ab){_0x4864ab=_0x4864ab||0x1f4;return function(_0x298435){logger[_0x94fe('0x23')](_0x298435[_0x94fe('0x24')]);if(_0x298435['name']){delete _0x298435[_0x94fe('0x25')];}_0x238e49[_0x94fe('0x17')](_0x4864ab)[_0x94fe('0x26')](_0x298435);};}exports[_0x94fe('0x27')]=function(_0x55ad86,_0x197f3a){var _0x7df08b={},_0x577011={},_0x10640d={'count':0x0,'rows':[]};var _0x18b783=_[_0x94fe('0x28')](db['CannedAnswer'][_0x94fe('0x29')],function(_0xbb7b08){return{'name':_0xbb7b08[_0x94fe('0x2a')],'type':_0xbb7b08[_0x94fe('0x2b')][_0x94fe('0x2c')]};});_0x577011[_0x94fe('0x2d')]=_['map'](_0x18b783,'name');_0x577011['query']=_[_0x94fe('0x2e')](_0x55ad86[_0x94fe('0x2f')]);_0x577011[_0x94fe('0x30')]=_[_0x94fe('0x31')](_0x577011[_0x94fe('0x2d')],_0x577011['query']);_0x7df08b[_0x94fe('0x32')]=_[_0x94fe('0x31')](_0x577011[_0x94fe('0x2d')],qs[_0x94fe('0x33')](_0x55ad86['query'][_0x94fe('0x33')]));_0x7df08b[_0x94fe('0x32')]=_0x7df08b['attributes'][_0x94fe('0x34')]?_0x7df08b[_0x94fe('0x32')]:_0x577011['model'];if(!_0x55ad86[_0x94fe('0x2f')]['hasOwnProperty']('nolimit')){_0x7df08b[_0x94fe('0x19')]=qs[_0x94fe('0x19')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x19')]);_0x7df08b[_0x94fe('0x1c')]=qs[_0x94fe('0x1c')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x1c')]);}_0x7df08b[_0x94fe('0x35')]=qs[_0x94fe('0x36')](_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x36')]);_0x7df08b[_0x94fe('0x37')]=qs[_0x94fe('0x30')](_['pick'](_0x55ad86[_0x94fe('0x2f')],_0x577011[_0x94fe('0x30')]),_0x18b783);if(_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x38')]){_0x7df08b['where']=_[_0x94fe('0x39')](_0x7df08b['where'],{'$or':[{'key':{'$like':'%'+_0x55ad86['query'][_0x94fe('0x38')]+'%'}},{'value':{'$like':'%'+_0x55ad86[_0x94fe('0x2f')][_0x94fe('0x38')]+'%'}}]});}_0x7df08b=_[_0x94fe('0x39')]({},_0x7df08b,_0x55ad86[_0x94fe('0x3a')]);var _0x1ed0ce={'where':_0x7df08b[_0x94fe('0x37')]};return db['CannedAnswer']['count'](_0x1ed0ce)[_0x94fe('0x21')](function(_0x5c84db){_0x10640d[_0x94fe('0x1b')]=_0x5c84db;if(_0x55ad86[_0x94fe('0x2f')]['includeAll']){_0x7df08b[_0x94fe('0x3b')]=[{'all':!![]}];}return db[_0x94fe('0x3c')]['findAll'](_0x7df08b);})[_0x94fe('0x21')](function(_0x152b07){_0x10640d[_0x94fe('0x3d')]=_0x152b07;return _0x10640d;})[_0x94fe('0x21')](respondWithFilteredResult(_0x197f3a,_0x7df08b))['catch'](handleError(_0x197f3a,null));};exports['show']=function(_0x188e21,_0xfce685){var _0x1b42e3={'raw':!![],'where':{'id':_0x188e21[_0x94fe('0x3e')]['id']}},_0x483fb9={};_0x483fb9[_0x94fe('0x2d')]=_[_0x94fe('0x2e')](db[_0x94fe('0x3c')][_0x94fe('0x29')]);_0x483fb9[_0x94fe('0x2f')]=_[_0x94fe('0x2e')](_0x188e21['query']);_0x483fb9['filters']=_[_0x94fe('0x31')](_0x483fb9['model'],_0x483fb9[_0x94fe('0x2f')]);_0x1b42e3['attributes']=_['intersection'](_0x483fb9['model'],qs[_0x94fe('0x33')](_0x188e21[_0x94fe('0x2f')][_0x94fe('0x33')]));_0x1b42e3[_0x94fe('0x32')]=_0x1b42e3[_0x94fe('0x32')]['length']?_0x1b42e3[_0x94fe('0x32')]:_0x483fb9[_0x94fe('0x2d')];if(_0x188e21[_0x94fe('0x2f')]['includeAll']){_0x1b42e3[_0x94fe('0x3b')]=[{'all':!![]}];}_0x1b42e3=_[_0x94fe('0x39')]({},_0x1b42e3,_0x188e21[_0x94fe('0x3a')]);return db['CannedAnswer'][_0x94fe('0x3f')](_0x1b42e3)[_0x94fe('0x21')](handleEntityNotFound(_0xfce685,null))[_0x94fe('0x21')](respondWithResult(_0xfce685,null))['catch'](handleError(_0xfce685,null));};exports[_0x94fe('0x20')]=function(_0x571be7,_0x486eac){if(_0x571be7[_0x94fe('0x40')]['id']){delete _0x571be7[_0x94fe('0x40')]['id'];}return db['CannedAnswer'][_0x94fe('0x3f')]({'where':{'id':_0x571be7[_0x94fe('0x3e')]['id']}})[_0x94fe('0x21')](handleEntityNotFound(_0x486eac,null))[_0x94fe('0x21')](saveUpdates(_0x571be7[_0x94fe('0x40')],null))[_0x94fe('0x21')](respondWithResult(_0x486eac,null))[_0x94fe('0x41')](handleError(_0x486eac,null));};exports[_0x94fe('0x22')]=function(_0x2fd648,_0x2f1c6b){return db[_0x94fe('0x3c')]['find']({'where':{'id':_0x2fd648['params']['id']}})[_0x94fe('0x21')](handleEntityNotFound(_0x2f1c6b,null))[_0x94fe('0x21')](removeEntity(_0x2f1c6b,null))[_0x94fe('0x41')](handleError(_0x2f1c6b,null));};exports[_0x94fe('0x42')]=function(_0xcd7d4,_0x476e59){var _0x4b74fe={'key':_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x2c')]};if(_0xcd7d4['body'][_0x94fe('0x43')]){_0x4b74fe['MailAccountId']=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x43')];}else if(_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x44')]){_0x4b74fe[_0x94fe('0x44')]=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x44')];}else if(_0xcd7d4[_0x94fe('0x40')]['OpenchannelAccountId']){_0x4b74fe['OpenchannelAccountId']=_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x45')];}else if(_0xcd7d4[_0x94fe('0x40')][_0x94fe('0x46')]){_0x4b74fe[_0x94fe('0x46')]=_0xcd7d4[_0x94fe('0x40')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x4b74fe})[_0x94fe('0x21')](function(_0x10d72a){if(_0x10d72a){throw new db[(_0x94fe('0x47'))]['ValidationError'](_0x94fe('0x48'));}return db[_0x94fe('0x3c')][_0x94fe('0x42')](_0xcd7d4[_0x94fe('0x40')]);})['then'](function(_0x473ac9){var _0x35f7e4=_0xcd7d4[_0x94fe('0x49')][_0x94fe('0x4a')]({'plain':!![]});if(!_0x35f7e4)throw new Error(_0x94fe('0x4b'));if(_0x35f7e4[_0x94fe('0x4c')]===_0x94fe('0x49')){var _0x17fe6a=_0x473ac9[_0x94fe('0x4a')]({'plain':!![]});return db[_0x94fe('0x4d')][_0x94fe('0x3f')]({'where':{'name':_0x94fe('0x4e'),'userProfileId':_0x35f7e4['userProfileId']},'raw':!![]})['then'](function(_0x5626e5){if(_0x5626e5&&_0x5626e5[_0x94fe('0x4f')]===0x0){return db[_0x94fe('0x50')][_0x94fe('0x42')]({'name':_0x17fe6a[_0x94fe('0x25')],'resourceId':_0x17fe6a['id'],'type':_0x5626e5['name'],'sectionId':_0x5626e5['id']},{})[_0x94fe('0x21')](function(){return _0x473ac9;});}else{return _0x473ac9;}})[_0x94fe('0x41')](function(_0x1b2bdb){logger[_0x94fe('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b2bdb);throw _0x1b2bdb;});}return _0x473ac9;})[_0x94fe('0x21')](respondWithResult(_0x476e59,0xc9))[_0x94fe('0x41')](handleError(_0x476e59,null));}; \ No newline at end of file +var _0xfe1d=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','intersection','fields','include','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','Content-Range','reject','save','update','then','CannedAnswers','destroy','error','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','model'];(function(_0x3bbe4e,_0x21cb7f){var _0x522321=function(_0x46026c){while(--_0x46026c){_0x3bbe4e['push'](_0x3bbe4e['shift']());}};_0x522321(++_0x21cb7f);}(_0xfe1d,0x12f));var _0xdfe1=function(_0x13d3d0,_0x2a8b82){_0x13d3d0=_0x13d3d0-0x0;var _0x5200d9=_0xfe1d[_0x13d3d0];return _0x5200d9;};'use strict';var emlformat=require(_0xdfe1('0x0'));var rimraf=require(_0xdfe1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfe1('0x2'));var rp=require(_0xdfe1('0x3'));var moment=require(_0xdfe1('0x4'));var BPromise=require(_0xdfe1('0x5'));var Mustache=require(_0xdfe1('0x6'));var util=require(_0xdfe1('0x7'));var path=require(_0xdfe1('0x8'));var sox=require(_0xdfe1('0x9'));var csv=require('to-csv');var ejs=require(_0xdfe1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfe1('0xb'));var squel=require(_0xdfe1('0xc'));var crypto=require('crypto');var jsforce=require(_0xdfe1('0xd'));var deskjs=require(_0xdfe1('0xe'));var toCsv=require(_0xdfe1('0xf'));var querystring=require('querystring');var Papa=require(_0xdfe1('0x10'));var Redis=require(_0xdfe1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdfe1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfe1('0x13'));var logger=require(_0xdfe1('0x14'))(_0xdfe1('0x15'));var utils=require('../../config/utils');var config=require(_0xdfe1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x926acb,_0x5c93af){_0x5c93af=_0x5c93af||0xcc;return function(_0x2fca38){if(_0x2fca38){return _0x926acb[_0xdfe1('0x17')](_0x5c93af);}return _0x926acb[_0xdfe1('0x18')](_0x5c93af)[_0xdfe1('0x19')]();};}function respondWithResult(_0x41d522,_0x3c95b5){_0x3c95b5=_0x3c95b5||0xc8;return function(_0x16d11f){if(_0x16d11f){return _0x41d522['status'](_0x3c95b5)[_0xdfe1('0x1a')](_0x16d11f);}};}function respondWithFilteredResult(_0x55b76a,_0x44a036){return function(_0x1e4209){if(_0x1e4209){var _0x4429d2=typeof _0x44a036['offset']===_0xdfe1('0x1b')&&typeof _0x44a036[_0xdfe1('0x1c')]===_0xdfe1('0x1b');var _0x4237af=_0x1e4209['count'];var _0x3820f2=_0x4429d2?0x0:_0x44a036[_0xdfe1('0x1d')];var _0x57e9c8=_0x4429d2?_0x1e4209['count']:_0x44a036['offset']+_0x44a036[_0xdfe1('0x1c')];var _0x358639;if(_0x57e9c8>=_0x4237af){_0x57e9c8=_0x4237af;_0x358639=0xc8;}else{_0x358639=0xce;}_0x55b76a['status'](_0x358639);return _0x55b76a['set'](_0xdfe1('0x1e'),_0x3820f2+'-'+_0x57e9c8+'/'+_0x4237af)[_0xdfe1('0x1a')](_0x1e4209);}return null;};}function patchUpdates(_0x3bfd9d){return function(_0x3938dd){try{jsonpatch['apply'](_0x3938dd,_0x3bfd9d,!![]);}catch(_0x12b33b){return BPromise[_0xdfe1('0x1f')](_0x12b33b);}return _0x3938dd[_0xdfe1('0x20')]();};}function saveUpdates(_0x53a5c4,_0x5ac642){return function(_0x998265){if(_0x998265){return _0x998265[_0xdfe1('0x21')](_0x53a5c4)[_0xdfe1('0x22')](function(_0x5214d6){return _0x5214d6;});}return null;};}function removeEntity(_0x4e72e9,_0x530ee1){return function(_0xd86e87){if(_0xd86e87){return _0xd86e87['destroy']()[_0xdfe1('0x22')](function(){var _0x3a0ce3=_0xd86e87['get']({'plain':!![]});var _0x11436d=_0xdfe1('0x23');return db['UserProfileResource'][_0xdfe1('0x24')]({'where':{'type':_0x11436d,'resourceId':_0x3a0ce3['id']}})['then'](function(){return _0xd86e87;});})[_0xdfe1('0x22')](function(){_0x4e72e9[_0xdfe1('0x18')](0xcc)[_0xdfe1('0x19')]();});}};}function handleEntityNotFound(_0x21d98f,_0x1f2b01){return function(_0x23372e){if(!_0x23372e){_0x21d98f[_0xdfe1('0x17')](0x194);}return _0x23372e;};}function handleError(_0x46761b,_0x4ec39b){_0x4ec39b=_0x4ec39b||0x1f4;return function(_0x4e54f1){logger[_0xdfe1('0x25')](_0x4e54f1['stack']);if(_0x4e54f1['name']){delete _0x4e54f1[_0xdfe1('0x26')];}_0x46761b[_0xdfe1('0x18')](_0x4ec39b)['send'](_0x4e54f1);};}exports[_0xdfe1('0x27')]=function(_0x311a42,_0x14a40e){var _0x61f218={},_0x592f66={},_0x444cd8={'count':0x0,'rows':[]};var _0x3edae6=_[_0xdfe1('0x28')](db[_0xdfe1('0x29')][_0xdfe1('0x2a')],function(_0x40df8e){return{'name':_0x40df8e[_0xdfe1('0x2b')],'type':_0x40df8e[_0xdfe1('0x2c')][_0xdfe1('0x2d')]};});_0x592f66['model']=_[_0xdfe1('0x28')](_0x3edae6,_0xdfe1('0x26'));_0x592f66[_0xdfe1('0x2e')]=_[_0xdfe1('0x2f')](_0x311a42['query']);_0x592f66['filters']=_['intersection'](_0x592f66[_0xdfe1('0x30')],_0x592f66['query']);_0x61f218['attributes']=_['intersection'](_0x592f66['model'],qs['fields'](_0x311a42[_0xdfe1('0x2e')]['fields']));_0x61f218['attributes']=_0x61f218[_0xdfe1('0x31')][_0xdfe1('0x32')]?_0x61f218['attributes']:_0x592f66[_0xdfe1('0x30')];if(!_0x311a42[_0xdfe1('0x2e')][_0xdfe1('0x33')](_0xdfe1('0x34'))){_0x61f218[_0xdfe1('0x1c')]=qs[_0xdfe1('0x1c')](_0x311a42[_0xdfe1('0x2e')][_0xdfe1('0x1c')]);_0x61f218[_0xdfe1('0x1d')]=qs['offset'](_0x311a42[_0xdfe1('0x2e')][_0xdfe1('0x1d')]);}_0x61f218[_0xdfe1('0x35')]=qs[_0xdfe1('0x36')](_0x311a42[_0xdfe1('0x2e')]['sort']);_0x61f218[_0xdfe1('0x37')]=qs[_0xdfe1('0x38')](_[_0xdfe1('0x39')](_0x311a42[_0xdfe1('0x2e')],_0x592f66['filters']),_0x3edae6);if(_0x311a42[_0xdfe1('0x2e')][_0xdfe1('0x3a')]){_0x61f218['where']=_[_0xdfe1('0x3b')](_0x61f218['where'],{'$or':[{'key':{'$like':'%'+_0x311a42[_0xdfe1('0x2e')][_0xdfe1('0x3a')]+'%'}},{'value':{'$like':'%'+_0x311a42['query'][_0xdfe1('0x3a')]+'%'}}]});}_0x61f218=_[_0xdfe1('0x3b')]({},_0x61f218,_0x311a42[_0xdfe1('0x3c')]);var _0x4d36f5={'where':_0x61f218[_0xdfe1('0x37')]};return db[_0xdfe1('0x29')][_0xdfe1('0x3d')](_0x4d36f5)[_0xdfe1('0x22')](function(_0x1a4d25){_0x444cd8[_0xdfe1('0x3d')]=_0x1a4d25;if(_0x311a42['query'][_0xdfe1('0x3e')]){_0x61f218['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xdfe1('0x3f')](_0x61f218);})['then'](function(_0x4a318b){_0x444cd8[_0xdfe1('0x40')]=_0x4a318b;return _0x444cd8;})['then'](respondWithFilteredResult(_0x14a40e,_0x61f218))['catch'](handleError(_0x14a40e,null));};exports[_0xdfe1('0x41')]=function(_0x3764b9,_0x520962){var _0x3cb9ee={'raw':!![],'where':{'id':_0x3764b9[_0xdfe1('0x42')]['id']}},_0x2e712a={};_0x2e712a[_0xdfe1('0x30')]=_[_0xdfe1('0x2f')](db[_0xdfe1('0x29')][_0xdfe1('0x2a')]);_0x2e712a['query']=_[_0xdfe1('0x2f')](_0x3764b9[_0xdfe1('0x2e')]);_0x2e712a[_0xdfe1('0x38')]=_[_0xdfe1('0x43')](_0x2e712a[_0xdfe1('0x30')],_0x2e712a[_0xdfe1('0x2e')]);_0x3cb9ee[_0xdfe1('0x31')]=_['intersection'](_0x2e712a[_0xdfe1('0x30')],qs[_0xdfe1('0x44')](_0x3764b9[_0xdfe1('0x2e')][_0xdfe1('0x44')]));_0x3cb9ee[_0xdfe1('0x31')]=_0x3cb9ee[_0xdfe1('0x31')]['length']?_0x3cb9ee[_0xdfe1('0x31')]:_0x2e712a[_0xdfe1('0x30')];if(_0x3764b9[_0xdfe1('0x2e')][_0xdfe1('0x3e')]){_0x3cb9ee[_0xdfe1('0x45')]=[{'all':!![]}];}_0x3cb9ee=_[_0xdfe1('0x3b')]({},_0x3cb9ee,_0x3764b9['options']);return db['CannedAnswer']['find'](_0x3cb9ee)[_0xdfe1('0x22')](handleEntityNotFound(_0x520962,null))[_0xdfe1('0x22')](respondWithResult(_0x520962,null))[_0xdfe1('0x46')](handleError(_0x520962,null));};exports['update']=function(_0x5d1f5f,_0x4db394){if(_0x5d1f5f[_0xdfe1('0x47')]['id']){delete _0x5d1f5f[_0xdfe1('0x47')]['id'];}return db[_0xdfe1('0x29')][_0xdfe1('0x48')]({'where':{'id':_0x5d1f5f[_0xdfe1('0x42')]['id']}})[_0xdfe1('0x22')](handleEntityNotFound(_0x4db394,null))['then'](saveUpdates(_0x5d1f5f[_0xdfe1('0x47')],null))[_0xdfe1('0x22')](respondWithResult(_0x4db394,null))[_0xdfe1('0x46')](handleError(_0x4db394,null));};exports[_0xdfe1('0x24')]=function(_0x3cf9ca,_0x5e937a){return db['CannedAnswer'][_0xdfe1('0x48')]({'where':{'id':_0x3cf9ca[_0xdfe1('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e937a,null))[_0xdfe1('0x22')](removeEntity(_0x5e937a,null))[_0xdfe1('0x46')](handleError(_0x5e937a,null));};exports[_0xdfe1('0x49')]=function(_0x28a0e4,_0x2c7944){var _0x266e5b={'key':_0x28a0e4[_0xdfe1('0x47')]['key']};if(_0x28a0e4[_0xdfe1('0x47')]['MailAccountId']){_0x266e5b['MailAccountId']=_0x28a0e4[_0xdfe1('0x47')][_0xdfe1('0x4a')];}else if(_0x28a0e4[_0xdfe1('0x47')][_0xdfe1('0x4b')]){_0x266e5b[_0xdfe1('0x4b')]=_0x28a0e4[_0xdfe1('0x47')][_0xdfe1('0x4b')];}else if(_0x28a0e4[_0xdfe1('0x47')]['OpenchannelAccountId']){_0x266e5b[_0xdfe1('0x4c')]=_0x28a0e4['body'][_0xdfe1('0x4c')];}else if(_0x28a0e4['body']['ChatWebsiteId']){_0x266e5b[_0xdfe1('0x4d')]=_0x28a0e4[_0xdfe1('0x47')][_0xdfe1('0x4d')];}return db['CannedAnswer'][_0xdfe1('0x48')]({'where':_0x266e5b})[_0xdfe1('0x22')](function(_0x5d84cc){if(_0x5d84cc){throw new db[(_0xdfe1('0x4e'))][(_0xdfe1('0x4f'))](_0xdfe1('0x50'));}return db[_0xdfe1('0x29')][_0xdfe1('0x49')](_0x28a0e4[_0xdfe1('0x47')]);})[_0xdfe1('0x22')](function(_0x4fa324){var _0x36f86d=_0x28a0e4[_0xdfe1('0x51')][_0xdfe1('0x52')]({'plain':!![]});if(!_0x36f86d)throw new Error(_0xdfe1('0x53'));if(_0x36f86d[_0xdfe1('0x54')]===_0xdfe1('0x51')){var _0x1de33b=_0x4fa324[_0xdfe1('0x52')]({'plain':!![]});return db['UserProfileSection'][_0xdfe1('0x48')]({'where':{'name':_0xdfe1('0x23'),'userProfileId':_0x36f86d[_0xdfe1('0x55')]},'raw':!![]})[_0xdfe1('0x22')](function(_0x124967){if(_0x124967&&_0x124967['autoAssociation']===0x0){return db[_0xdfe1('0x56')][_0xdfe1('0x49')]({'name':_0x1de33b['name'],'resourceId':_0x1de33b['id'],'type':_0x124967[_0xdfe1('0x26')],'sectionId':_0x124967['id']},{})[_0xdfe1('0x22')](function(){return _0x4fa324;});}else{return _0x4fa324;}})[_0xdfe1('0x46')](function(_0x2a04e8){logger[_0xdfe1('0x25')](_0xdfe1('0x57'),_0x2a04e8);throw _0x2a04e8;});}return _0x4fa324;})[_0xdfe1('0x22')](respondWithResult(_0x2c7944,0xc9))[_0xdfe1('0x46')](handleError(_0x2c7944,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f3841af..2af57f6 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 _0x7061=['bluebird','request-promise','path','tools_canned_answers','lodash','util','api'];(function(_0x50cb00,_0x1499ef){var _0xd62f39=function(_0x1669fc){while(--_0x1669fc){_0x50cb00['push'](_0x50cb00['shift']());}};_0xd62f39(++_0x1499ef);}(_0x7061,0xac));var _0x1706=function(_0x4f6f04,_0x461ec4){_0x4f6f04=_0x4f6f04-0x0;var _0x311a20=_0x7061[_0x4f6f04];return _0x311a20;};'use strict';var _=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var logger=require('../../config/logger')(_0x1706('0x2'));var moment=require('moment');var BPromise=require(_0x1706('0x3'));var rp=require(_0x1706('0x4'));var fs=require('fs');var path=require(_0x1706('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x5afb73,_0x5740a6){return _0x5afb73['define']('CannedAnswer',attributes,{'tableName':_0x1706('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x405f=['exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes'];(function(_0x458074,_0x56f600){var _0x3532d6=function(_0x54324b){while(--_0x54324b){_0x458074['push'](_0x458074['shift']());}};_0x3532d6(++_0x56f600);}(_0x405f,0x17e));var _0xf405=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x405f[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0xf405('0x0'));var logger=require(_0xf405('0x1'))(_0xf405('0x2'));var moment=require(_0xf405('0x3'));var BPromise=require(_0xf405('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf405('0x5'));var rimraf=require('rimraf');var config=require(_0xf405('0x6'));var attributes=require(_0xf405('0x7'));module[_0xf405('0x8')]=function(_0x223041,_0x12ccce){return _0x223041[_0xf405('0x9')](_0xf405('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf405('0xb'),'collate':_0xf405('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 426645a..6ad1eb4 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(_0x5e729d,_0x254376){var _0x4efc38=function(_0x3a5a49){while(--_0x3a5a49){_0x5e729d['push'](_0x5e729d['shift']());}};_0x4efc38(++_0x254376);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x3e086c,_0x41f9a0){var _0x259655=function(_0x26f5d6){while(--_0x26f5d6){_0x3e086c['push'](_0x3e086c['shift']());}};_0x259655(++_0x41f9a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 f7cc97b..032b9ca 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 _0xd286=['../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','/:id','post','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd286,0x181));var _0x6d28=function(_0x5ea3f6,_0x595373){_0x5ea3f6=_0x5ea3f6-0x0;var _0x3fc5a2=_0xd286[_0x5ea3f6];return _0x3fc5a2;};'use strict';var multer=require(_0x6d28('0x0'));var util=require(_0x6d28('0x1'));var path=require(_0x6d28('0x2'));var timeout=require(_0x6d28('0x3'));var express=require(_0x6d28('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d28('0x5'));var config=require('../../config/environment');var controller=require(_0x6d28('0x6'));router['get']('/',auth[_0x6d28('0x7')](),controller['index']);router['get'](_0x6d28('0x8'),auth[_0x6d28('0x7')](),controller['show']);router[_0x6d28('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x6d28('0x7')](),controller['update']);router[_0x6d28('0xa')](_0x6d28('0x8'),auth[_0x6d28('0x7')](),controller[_0x6d28('0xb')]);module[_0x6d28('0xc')]=router; \ No newline at end of file +var _0x59db=['../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x103dbc,_0x492787){var _0x2a2772=function(_0x56f1ce){while(--_0x56f1ce){_0x103dbc['push'](_0x103dbc['shift']());}};_0x2a2772(++_0x492787);}(_0x59db,0x109));var _0xb59d=function(_0x2757db,_0x464403){_0x2757db=_0x2757db-0x0;var _0x38e694=_0x59db[_0x2757db];return _0x38e694;};'use strict';var multer=require(_0xb59d('0x0'));var util=require(_0xb59d('0x1'));var path=require(_0xb59d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb59d('0x3'));var router=express[_0xb59d('0x4')]();var fs_extra=require(_0xb59d('0x5'));var auth=require(_0xb59d('0x6'));var interaction=require(_0xb59d('0x7'));var config=require(_0xb59d('0x8'));var controller=require(_0xb59d('0x9'));router[_0xb59d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb59d('0xa')](_0xb59d('0xb'),auth[_0xb59d('0xc')](),controller[_0xb59d('0xd')]);router[_0xb59d('0xe')]('/',auth[_0xb59d('0xc')](),controller[_0xb59d('0xf')]);router[_0xb59d('0x10')](_0xb59d('0xb'),auth[_0xb59d('0xc')](),controller[_0xb59d('0x11')]);router[_0xb59d('0x12')](_0xb59d('0xb'),auth['isAuthenticated'](),controller[_0xb59d('0x13')]);module[_0xb59d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 3b72dd6..e3aa3ef 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 _0xf296=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4cbfbc,_0x3165d4){var _0x11b285=function(_0x4c5948){while(--_0x4c5948){_0x4cbfbc['push'](_0x4cbfbc['shift']());}};_0x11b285(++_0x3165d4);}(_0xf296,0x94));var _0x6f29=function(_0x614dc5,_0x3dd98e){_0x614dc5=_0x614dc5-0x0;var _0x571e07=_0xf296[_0x614dc5];return _0x571e07;};'use strict';var Sequelize=require(_0x6f29('0x0'));module[_0x6f29('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6f29('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x6f29('0x3')]},'dcontext':{'type':Sequelize[_0x6f29('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6f29('0x3')]},'lastapp':{'type':Sequelize[_0x6f29('0x3')]},'lastdata':{'type':Sequelize[_0x6f29('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6f29('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6f29('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6f29('0x3')]},'userfield':{'type':Sequelize[_0x6f29('0x3')]},'uniqueid':{'type':Sequelize[_0x6f29('0x3')]},'linkedid':{'type':Sequelize[_0x6f29('0x3')]},'sequence':{'type':Sequelize[_0x6f29('0x3')]},'peeraccount':{'type':Sequelize[_0x6f29('0x3')]},'type':{'type':Sequelize[_0x6f29('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd691=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0xd691,0xe6));var _0x1d69=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0xd691[_0x537c37];return _0x241f84;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'calldate':{'type':Sequelize[_0x1d69('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x1d69('0x3')]},'src':{'type':Sequelize[_0x1d69('0x3')]},'dst':{'type':Sequelize[_0x1d69('0x3')]},'dcontext':{'type':Sequelize[_0x1d69('0x3')]},'channel':{'type':Sequelize[_0x1d69('0x3')]},'dstchannel':{'type':Sequelize[_0x1d69('0x3')]},'lastapp':{'type':Sequelize[_0x1d69('0x3')]},'lastdata':{'type':Sequelize[_0x1d69('0x3')]},'duration':{'type':Sequelize[_0x1d69('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1d69('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1d69('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1d69('0x3')]},'linkedid':{'type':Sequelize[_0x1d69('0x3')]},'sequence':{'type':Sequelize[_0x1d69('0x3')]},'peeraccount':{'type':Sequelize[_0x1d69('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x1d69('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3823693..00fe6cd 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 _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x62c646,_0xa08641){var _0x2385f3=function(_0x45b92b){while(--_0x45b92b){_0x62c646['push'](_0x62c646['shift']());}};_0x2385f3(++_0xa08641);}(_0xa751,0x175));var _0x1a75=function(_0x5b10f5,_0x47493e){_0x5b10f5=_0x5b10f5-0x0;var _0x1b5d6a=_0xa751[_0x5b10f5];return _0x1b5d6a;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['Cdr'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));}; \ No newline at end of file +var _0x4ab0=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','Cdr','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs'];(function(_0x3f20e2,_0x451d47){var _0xe1d9a=function(_0x3d8b48){while(--_0x3d8b48){_0x3f20e2['push'](_0x3f20e2['shift']());}};_0xe1d9a(++_0x451d47);}(_0x4ab0,0xd5));var _0x04ab=function(_0x1e17b3,_0x2e12e4){_0x1e17b3=_0x1e17b3-0x0;var _0x509cd0=_0x4ab0[_0x1e17b3];return _0x509cd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['index']=function(_0x404eae,_0x30db64){var _0x2e069d={},_0x3c25fb={},_0x12385b={'count':0x0,'rows':[]};var _0x5596fc=_['map'](db[_0x04ab('0x29')][_0x04ab('0x2a')],function(_0x28e77b){return{'name':_0x28e77b[_0x04ab('0x2b')],'type':_0x28e77b[_0x04ab('0x2c')][_0x04ab('0x2d')]};});_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x5596fc,_0x04ab('0x27'));_0x3c25fb[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x404eae[_0x04ab('0x30')]);_0x3c25fb[_0x04ab('0x32')]=_['intersection'](_0x3c25fb[_0x04ab('0x2e')],_0x3c25fb[_0x04ab('0x30')]);_0x2e069d['attributes']=_[_0x04ab('0x33')](_0x3c25fb[_0x04ab('0x2e')],qs['fields'](_0x404eae[_0x04ab('0x30')][_0x04ab('0x34')]));_0x2e069d['attributes']=_0x2e069d[_0x04ab('0x35')][_0x04ab('0x36')]?_0x2e069d[_0x04ab('0x35')]:_0x3c25fb[_0x04ab('0x2e')];if(!_0x404eae[_0x04ab('0x30')][_0x04ab('0x37')]('nolimit')){_0x2e069d[_0x04ab('0x1c')]=qs[_0x04ab('0x1c')](_0x404eae[_0x04ab('0x30')]['limit']);_0x2e069d[_0x04ab('0x1a')]=qs['offset'](_0x404eae['query'][_0x04ab('0x1a')]);}_0x2e069d[_0x04ab('0x38')]=qs['sort'](_0x404eae[_0x04ab('0x30')]['sort']);_0x2e069d[_0x04ab('0x39')]=qs[_0x04ab('0x32')](_[_0x04ab('0x3a')](_0x404eae[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x32')]),_0x5596fc);if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3b')]){_0x2e069d[_0x04ab('0x39')]=_[_0x04ab('0x3c')](_0x2e069d[_0x04ab('0x39')],{'$or':_[_0x04ab('0x2f')](_0x5596fc,function(_0x3f145){if(_0x3f145['type']!==_0x04ab('0x3d')){var _0x14756a={};_0x14756a[_0x3f145['name']]={'$like':'%'+_0x404eae['query'][_0x04ab('0x3b')]+'%'};return _0x14756a;}})});}_0x2e069d=_[_0x04ab('0x3c')]({},_0x2e069d,_0x404eae[_0x04ab('0x3e')]);var _0x4327b9={'where':_0x2e069d['where']};return db[_0x04ab('0x29')][_0x04ab('0x1d')](_0x4327b9)[_0x04ab('0x23')](function(_0x244acf){_0x12385b['count']=_0x244acf;if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x2e069d[_0x04ab('0x40')]=[{'all':!![]}];}return db[_0x04ab('0x29')][_0x04ab('0x41')](_0x2e069d);})[_0x04ab('0x23')](function(_0x20b8cc){_0x12385b[_0x04ab('0x42')]=_0x20b8cc;return _0x12385b;})['then'](respondWithFilteredResult(_0x30db64,_0x2e069d))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x43')]=function(_0x4c8cb0,_0x8a93c2){var _0x46a7c5={'raw':!![],'where':{'id':_0x4c8cb0['params']['id']}},_0x3c27ee={};_0x3c27ee[_0x04ab('0x2e')]=_[_0x04ab('0x31')](db[_0x04ab('0x29')]['rawAttributes']);_0x3c27ee[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x4c8cb0[_0x04ab('0x30')]);_0x3c27ee[_0x04ab('0x32')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],_0x3c27ee[_0x04ab('0x30')]);_0x46a7c5[_0x04ab('0x35')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],qs['fields'](_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x34')]));_0x46a7c5[_0x04ab('0x35')]=_0x46a7c5[_0x04ab('0x35')][_0x04ab('0x36')]?_0x46a7c5[_0x04ab('0x35')]:_0x3c27ee['model'];if(_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x46a7c5[_0x04ab('0x40')]=[{'all':!![]}];}_0x46a7c5=_[_0x04ab('0x3c')]({},_0x46a7c5,_0x4c8cb0['options']);return db[_0x04ab('0x29')][_0x04ab('0x44')](_0x46a7c5)[_0x04ab('0x23')](handleEntityNotFound(_0x8a93c2,null))[_0x04ab('0x23')](respondWithResult(_0x8a93c2,null))[_0x04ab('0x45')](handleError(_0x8a93c2,null));};exports['create']=function(_0x326621,_0x15b995){return db['Cdr']['create'](_0x326621[_0x04ab('0x46')],{})[_0x04ab('0x23')](respondWithResult(_0x15b995,0xc9))[_0x04ab('0x45')](handleError(_0x15b995,null));};exports[_0x04ab('0x47')]=function(_0x1c4aa2,_0x3a9056){if(_0x1c4aa2[_0x04ab('0x46')]['id']){delete _0x1c4aa2['body']['id'];}return db[_0x04ab('0x29')][_0x04ab('0x44')]({'where':{'id':_0x1c4aa2[_0x04ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a9056,null))[_0x04ab('0x23')](saveUpdates(_0x1c4aa2[_0x04ab('0x46')],null))['then'](respondWithResult(_0x3a9056,null))[_0x04ab('0x45')](handleError(_0x3a9056,null));};exports['destroy']=function(_0xc9db25,_0x4bc4f6){return db[_0x04ab('0x29')]['find']({'where':{'id':_0xc9db25['params']['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x4bc4f6,null))[_0x04ab('0x23')](removeEntity(_0x4bc4f6,null))[_0x04ab('0x45')](handleError(_0x4bc4f6,null));};exports['describe']=function(_0x53f63a,_0x5ed30e){return db[_0x04ab('0x29')][_0x04ab('0x49')]()['then'](respondWithResult(_0x5ed30e,null))[_0x04ab('0x45')](handleError(_0x5ed30e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index bca49f9..4df1791 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3d2532,_0x2936dc){var _0x1405ce=function(_0x3201d9){while(--_0x3201d9){_0x3d2532['push'](_0x3d2532['shift']());}};_0x1405ce(++_0x2936dc);}(_0x7a54,0x106));var _0x47a5=function(_0xa99e80,_0x1aea8f){_0xa99e80=_0xa99e80-0x0;var _0x5225d6=_0x7a54[_0xa99e80];return _0x5225d6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4d82b3,_0xfe6f5f){var _0x23ea02=function(_0x462b20){while(--_0x462b20){_0x4d82b3['push'](_0x4d82b3['shift']());}};_0x23ea02(++_0xfe6f5f);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 29fa434..30068d7 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 _0x2d9c=['http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x46ae81,_0x16cd38){var _0x5013ca=function(_0x2ad2d2){while(--_0x2ad2d2){_0x46ae81['push'](_0x46ae81['shift']());}};_0x5013ca(++_0x16cd38);}(_0x2d9c,0x185));var _0xc2d9=function(_0x13398d,_0x1a918a){_0x13398d=_0x13398d-0x0;var _0x306118=_0x2d9c[_0x13398d];return _0x306118;};'use strict';var _=require('lodash');var util=require(_0xc2d9('0x0'));var moment=require('moment');var BPromise=require(_0xc2d9('0x1'));var rs=require(_0xc2d9('0x2'));var fs=require('fs');var Redis=require(_0xc2d9('0x3'));var db=require(_0xc2d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2d9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2d9('0x6')][_0xc2d9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e7512,_0x41e810,_0x510655){return new BPromise(function(_0x9063eb,_0x58ea19){return client[_0xc2d9('0x8')](_0x2e7512,_0x510655)[_0xc2d9('0x9')](function(_0x55750e){logger[_0xc2d9('0xa')]('Cdr,\x20%s,\x20%s',_0x41e810,_0xc2d9('0xb'));logger['debug'](_0xc2d9('0xc'),_0x41e810,_0xc2d9('0xb'),JSON[_0xc2d9('0xd')](_0x55750e));if(_0x55750e[_0xc2d9('0xe')]){if(_0x55750e[_0xc2d9('0xe')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x41e810,_0x55750e[_0xc2d9('0xe')]['message']);return _0x58ea19(_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);}logger[_0xc2d9('0xe')](_0xc2d9('0x10'),_0x41e810,_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);return _0x9063eb(_0x55750e[_0xc2d9('0xe')][_0xc2d9('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x41e810,'request\x20sent');_0x9063eb(_0x55750e['result'][_0xc2d9('0xf')]);}})[_0xc2d9('0x11')](function(_0x1f728a){logger['error'](_0xc2d9('0x10'),_0x41e810,_0x1f728a);_0x58ea19(_0x1f728a);});});} \ No newline at end of file +var _0x4e6d=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3457cd,_0xd5c5c6){var _0x52f8ca=function(_0x474d86){while(--_0x474d86){_0x3457cd['push'](_0x3457cd['shift']());}};_0x52f8ca(++_0xd5c5c6);}(_0x4e6d,0x90));var _0xd4e6=function(_0x3a7e42,_0x58e47d){_0x3a7e42=_0x3a7e42-0x0;var _0x7122b7=_0x4e6d[_0x3a7e42];return _0x7122b7;};'use strict';var _=require(_0xd4e6('0x0'));var util=require('util');var moment=require(_0xd4e6('0x1'));var BPromise=require(_0xd4e6('0x2'));var rs=require(_0xd4e6('0x3'));var fs=require('fs');var Redis=require(_0xd4e6('0x4'));var db=require(_0xd4e6('0x5'))['db'];var utils=require(_0xd4e6('0x6'));var logger=require(_0xd4e6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4e6('0x8')][_0xd4e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f5321,_0x2dec7c,_0x1429f8){return new BPromise(function(_0x2f57b3,_0x46c200){return client['request'](_0x5f5321,_0x1429f8)[_0xd4e6('0xa')](function(_0x47144d){logger[_0xd4e6('0xb')](_0xd4e6('0xc'),_0x2dec7c,_0xd4e6('0xd'));logger['debug'](_0xd4e6('0xe'),_0x2dec7c,_0xd4e6('0xd'),JSON[_0xd4e6('0xf')](_0x47144d));if(_0x47144d[_0xd4e6('0x10')]){if(_0x47144d[_0xd4e6('0x10')][_0xd4e6('0x11')]===0x1f4){logger[_0xd4e6('0x10')](_0xd4e6('0xc'),_0x2dec7c,_0x47144d[_0xd4e6('0x10')][_0xd4e6('0x12')]);return _0x46c200(_0x47144d[_0xd4e6('0x10')][_0xd4e6('0x12')]);}logger[_0xd4e6('0x10')]('Cdr,\x20%s,\x20%s',_0x2dec7c,_0x47144d[_0xd4e6('0x10')][_0xd4e6('0x12')]);return _0x2f57b3(_0x47144d[_0xd4e6('0x10')][_0xd4e6('0x12')]);}else{logger[_0xd4e6('0xb')](_0xd4e6('0xc'),_0x2dec7c,'request\x20sent');_0x2f57b3(_0x47144d['result'][_0xd4e6('0x12')]);}})[_0xd4e6('0x13')](function(_0x495f8d){logger['error'](_0xd4e6('0xc'),_0x2dec7c,_0x495f8d);_0x46c200(_0x495f8d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f0d60a7..abee037 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x33677a,_0x2db401){var _0x5ce448=function(_0x464efe){while(--_0x464efe){_0x33677a['push'](_0x33677a['shift']());}};_0x5ce448(++_0x2db401);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e712f,_0x60d75f){_0x2e712f=_0x2e712f-0x0;var _0x2fb152=_0xb10b[_0x2e712f];return _0x2fb152;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6bc1653..af0c9fb 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 _0xa036=['*,*,*,*','exports','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa036,0x101));var _0x6a03=function(_0x305d3f,_0x5b9f83){_0x305d3f=_0x305d3f-0x0;var _0x438449=_0xa036[_0x305d3f];return _0x438449;};'use strict';var Sequelize=require('sequelize');module[_0x6a03('0x0')]={'priority':{'type':Sequelize[_0x6a03('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6a03('0x2')]},'interval':{'type':Sequelize[_0x6a03('0x2')],'defaultValue':_0x6a03('0x3')}}; \ No newline at end of file +var _0x03fc=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x5e2320,_0x245774){var _0x254ea9=function(_0x3ab1ae){while(--_0x3ab1ae){_0x5e2320['push'](_0x5e2320['shift']());}};_0x254ea9(++_0x245774);}(_0x03fc,0x92));var _0xc03f=function(_0x7222a7,_0x1e6b39){_0x7222a7=_0x7222a7-0x0;var _0x51f226=_0x03fc[_0x7222a7];return _0x51f226;};'use strict';var Sequelize=require(_0xc03f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc03f('0x1')],'allowNull':![],'defaultValue':_0xc03f('0x2')},'appdata':{'type':Sequelize[_0xc03f('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc03f('0x1')],'defaultValue':_0xc03f('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 91b2b96..6a486b4 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 _0x18e0=['moment','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','include','merge','options','find','catch','body','rimraf','fast-json-patch','request-promise'];(function(_0x4c1303,_0x4efd70){var _0x2b6af4=function(_0x52ab13){while(--_0x52ab13){_0x4c1303['push'](_0x4c1303['shift']());}};_0x2b6af4(++_0x4efd70);}(_0x18e0,0xa2));var _0x018e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x18e0[_0x2080a3];return _0x8d7d17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x018e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x018e('0x1'));var rp=require(_0x018e('0x2'));var moment=require(_0x018e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x018e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x018e('0x5'));var csv=require(_0x018e('0x6'));var ejs=require(_0x018e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x018e('0x8'));var crypto=require(_0x018e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x018e('0xa'));var toCsv=require(_0x018e('0x6'));var querystring=require(_0x018e('0xb'));var Papa=require(_0x018e('0xc'));var Redis=require(_0x018e('0xd'));var authService=require(_0x018e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x018e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x018e('0x10'));var config=require(_0x018e('0x11'));var licenseUtil=require(_0x018e('0x12'));var db=require(_0x018e('0x13'))['db'];function respondWithStatusCode(_0x167572,_0xd16776){_0xd16776=_0xd16776||0xcc;return function(_0xc940bb){if(_0xc940bb){return _0x167572[_0x018e('0x14')](_0xd16776);}return _0x167572[_0x018e('0x15')](_0xd16776)['end']();};}function respondWithResult(_0xec531a,_0x3b1e5e){_0x3b1e5e=_0x3b1e5e||0xc8;return function(_0x2d6aa0){if(_0x2d6aa0){return _0xec531a[_0x018e('0x15')](_0x3b1e5e)[_0x018e('0x16')](_0x2d6aa0);}};}function respondWithFilteredResult(_0x5bfd6e,_0x275c21){return function(_0x142f1e){if(_0x142f1e){var _0x41cbd8=typeof _0x275c21[_0x018e('0x17')]==='undefined'&&typeof _0x275c21[_0x018e('0x18')]===_0x018e('0x19');var _0x4d46aa=_0x142f1e[_0x018e('0x1a')];var _0x237ba1=_0x41cbd8?0x0:_0x275c21[_0x018e('0x17')];var _0xdf15f8=_0x41cbd8?_0x142f1e[_0x018e('0x1a')]:_0x275c21['offset']+_0x275c21[_0x018e('0x18')];var _0x421942;if(_0xdf15f8>=_0x4d46aa){_0xdf15f8=_0x4d46aa;_0x421942=0xc8;}else{_0x421942=0xce;}_0x5bfd6e[_0x018e('0x15')](_0x421942);return _0x5bfd6e[_0x018e('0x1b')](_0x018e('0x1c'),_0x237ba1+'-'+_0xdf15f8+'/'+_0x4d46aa)[_0x018e('0x16')](_0x142f1e);}return null;};}function patchUpdates(_0x15c3fa){return function(_0x4f59e7){try{jsonpatch[_0x018e('0x1d')](_0x4f59e7,_0x15c3fa,!![]);}catch(_0x213989){return BPromise[_0x018e('0x1e')](_0x213989);}return _0x4f59e7[_0x018e('0x1f')]();};}function saveUpdates(_0x23ef86,_0x5d9fef){return function(_0x5cffe9){if(_0x5cffe9){return _0x5cffe9[_0x018e('0x20')](_0x23ef86)[_0x018e('0x21')](function(_0x2c813e){return _0x2c813e;});}return null;};}function removeEntity(_0x1e3106,_0x2ef801){return function(_0x198b0b){if(_0x198b0b){return _0x198b0b[_0x018e('0x22')]()[_0x018e('0x21')](function(){_0x1e3106[_0x018e('0x15')](0xcc)[_0x018e('0x23')]();});}};}function handleEntityNotFound(_0x35f9a3,_0x7596f4){return function(_0x4e7d9a){if(!_0x4e7d9a){_0x35f9a3[_0x018e('0x14')](0x194);}return _0x4e7d9a;};}function handleError(_0x289931,_0x176822){_0x176822=_0x176822||0x1f4;return function(_0x344e2b){logger[_0x018e('0x24')](_0x344e2b[_0x018e('0x25')]);if(_0x344e2b[_0x018e('0x26')]){delete _0x344e2b[_0x018e('0x26')];}_0x289931[_0x018e('0x15')](_0x176822)[_0x018e('0x27')](_0x344e2b);};}exports['show']=function(_0x29455a,_0x1a4726){var _0x4af339={'raw':!![],'where':{'id':_0x29455a[_0x018e('0x28')]['id']}},_0xac43bc={};_0xac43bc[_0x018e('0x29')]=_[_0x018e('0x2a')](db[_0x018e('0x2b')][_0x018e('0x2c')]);_0xac43bc['query']=_[_0x018e('0x2a')](_0x29455a[_0x018e('0x2d')]);_0xac43bc['filters']=_[_0x018e('0x2e')](_0xac43bc[_0x018e('0x29')],_0xac43bc[_0x018e('0x2d')]);_0x4af339[_0x018e('0x2f')]=_[_0x018e('0x2e')](_0xac43bc['model'],qs[_0x018e('0x30')](_0x29455a[_0x018e('0x2d')][_0x018e('0x30')]));_0x4af339['attributes']=_0x4af339[_0x018e('0x2f')]['length']?_0x4af339[_0x018e('0x2f')]:_0xac43bc[_0x018e('0x29')];if(_0x29455a['query']['includeAll']){_0x4af339[_0x018e('0x31')]=[{'all':!![]}];}_0x4af339=_[_0x018e('0x32')]({},_0x4af339,_0x29455a[_0x018e('0x33')]);return db[_0x018e('0x2b')][_0x018e('0x34')](_0x4af339)['then'](handleEntityNotFound(_0x1a4726,null))[_0x018e('0x21')](respondWithResult(_0x1a4726,null))[_0x018e('0x35')](handleError(_0x1a4726,null));};exports[_0x018e('0x20')]=function(_0x55dbda,_0x5a2741){if(_0x55dbda[_0x018e('0x36')]['id']){delete _0x55dbda[_0x018e('0x36')]['id'];}return db[_0x018e('0x2b')][_0x018e('0x34')]({'where':{'id':_0x55dbda[_0x018e('0x28')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x5a2741,null))['then'](saveUpdates(_0x55dbda[_0x018e('0x36')],null))[_0x018e('0x21')](respondWithResult(_0x5a2741,null))['catch'](handleError(_0x5a2741,null));};exports['destroy']=function(_0x5c34c9,_0x3b6e6a){return db[_0x018e('0x2b')][_0x018e('0x34')]({'where':{'id':_0x5c34c9[_0x018e('0x28')]['id']}})[_0x018e('0x21')](handleEntityNotFound(_0x3b6e6a,null))['then'](removeEntity(_0x3b6e6a,null))[_0x018e('0x35')](handleError(_0x3b6e6a,null));}; \ No newline at end of file +var _0x3a79=['../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','error','stack','name','show','model','keys','ChatApplication','query','filters','intersection','fields','attributes','includeAll','include','options','catch','body','find','params','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'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x3a79,0xca));var _0x93a7=function(_0x2787a4,_0x2147a1){_0x2787a4=_0x2787a4-0x0;var _0x472e77=_0x3a79[_0x2787a4];return _0x472e77;};'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(){_0x198b82[_0x93a7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xafae92,_0x1b64ec){return function(_0x5a14f2){if(!_0x5a14f2){_0xafae92[_0x93a7('0x17')](0x194);}return _0x5a14f2;};}function handleError(_0x4e72b4,_0x2c4ed7){_0x2c4ed7=_0x2c4ed7||0x1f4;return function(_0x14f413){logger[_0x93a7('0x25')](_0x14f413[_0x93a7('0x26')]);if(_0x14f413['name']){delete _0x14f413[_0x93a7('0x27')];}_0x4e72b4['status'](_0x2c4ed7)['send'](_0x14f413);};}exports[_0x93a7('0x28')]=function(_0x44c6da,_0x15e30f){var _0x3f5448={'raw':!![],'where':{'id':_0x44c6da['params']['id']}},_0x1fad6e={};_0x1fad6e[_0x93a7('0x29')]=_[_0x93a7('0x2a')](db[_0x93a7('0x2b')]['rawAttributes']);_0x1fad6e['query']=_['keys'](_0x44c6da[_0x93a7('0x2c')]);_0x1fad6e[_0x93a7('0x2d')]=_[_0x93a7('0x2e')](_0x1fad6e['model'],_0x1fad6e[_0x93a7('0x2c')]);_0x3f5448['attributes']=_['intersection'](_0x1fad6e['model'],qs[_0x93a7('0x2f')](_0x44c6da['query'][_0x93a7('0x2f')]));_0x3f5448[_0x93a7('0x30')]=_0x3f5448['attributes']['length']?_0x3f5448['attributes']:_0x1fad6e[_0x93a7('0x29')];if(_0x44c6da[_0x93a7('0x2c')][_0x93a7('0x31')]){_0x3f5448[_0x93a7('0x32')]=[{'all':!![]}];}_0x3f5448=_['merge']({},_0x3f5448,_0x44c6da[_0x93a7('0x33')]);return db[_0x93a7('0x2b')]['find'](_0x3f5448)['then'](handleEntityNotFound(_0x15e30f,null))[_0x93a7('0x24')](respondWithResult(_0x15e30f,null))[_0x93a7('0x34')](handleError(_0x15e30f,null));};exports[_0x93a7('0x23')]=function(_0x2d4723,_0xa3bb5f){if(_0x2d4723[_0x93a7('0x35')]['id']){delete _0x2d4723[_0x93a7('0x35')]['id'];}return db['ChatApplication'][_0x93a7('0x36')]({'where':{'id':_0x2d4723[_0x93a7('0x37')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0xa3bb5f,null))[_0x93a7('0x24')](saveUpdates(_0x2d4723[_0x93a7('0x35')],null))[_0x93a7('0x24')](respondWithResult(_0xa3bb5f,null))[_0x93a7('0x34')](handleError(_0xa3bb5f,null));};exports['destroy']=function(_0x53c540,_0x7e980d){return db[_0x93a7('0x2b')][_0x93a7('0x36')]({'where':{'id':_0x53c540[_0x93a7('0x37')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0x7e980d,null))['then'](removeEntity(_0x7e980d,null))[_0x93a7('0x34')](handleError(_0x7e980d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 071b405..73b9ac3 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 _0xc792=['exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes'];(function(_0x550f8a,_0x1c97d5){var _0x20a27b=function(_0x5ce662){while(--_0x5ce662){_0x550f8a['push'](_0x550f8a['shift']());}};_0x20a27b(++_0x1c97d5);}(_0xc792,0x1e5));var _0x2c79=function(_0x1ee4d6,_0x26a81d){_0x1ee4d6=_0x1ee4d6-0x0;var _0x2cb60e=_0xc792[_0x1ee4d6];return _0x2cb60e;};'use strict';var _=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var logger=require(_0x2c79('0x2'))(_0x2c79('0x3'));var moment=require(_0x2c79('0x4'));var BPromise=require(_0x2c79('0x5'));var rp=require(_0x2c79('0x6'));var fs=require('fs');var path=require(_0x2c79('0x7'));var rimraf=require(_0x2c79('0x8'));var config=require('../../config/environment');var attributes=require(_0x2c79('0x9'));module[_0x2c79('0xa')]=function(_0x4d031c,_0x490807){return _0x4d031c[_0x2c79('0xb')](_0x2c79('0xc'),attributes,{'tableName':_0x2c79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c79('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdb1a=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4'];(function(_0x8b86af,_0x4625f0){var _0x30a906=function(_0x387e1a){while(--_0x387e1a){_0x8b86af['push'](_0x8b86af['shift']());}};_0x30a906(++_0x4625f0);}(_0xdb1a,0x1bc));var _0xadb1=function(_0x35a90c,_0x3c80d8){_0x35a90c=_0x35a90c-0x0;var _0xecd5e8=_0xdb1a[_0x35a90c];return _0xecd5e8;};'use strict';var _=require('lodash');var util=require(_0xadb1('0x0'));var logger=require(_0xadb1('0x1'))(_0xadb1('0x2'));var moment=require('moment');var BPromise=require(_0xadb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadb1('0x4'));var rimraf=require(_0xadb1('0x5'));var config=require(_0xadb1('0x6'));var attributes=require(_0xadb1('0x7'));module[_0xadb1('0x8')]=function(_0x23c197,_0x3e05da){return _0x23c197[_0xadb1('0x9')]('ChatApplication',attributes,{'tableName':_0xadb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xadb1('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2e8362a..bded83a 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 _0x00f8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4b32d5,_0x54b694){var _0x230836=function(_0x3e313d){while(--_0x3e313d){_0x4b32d5['push'](_0x4b32d5['shift']());}};_0x230836(++_0x54b694);}(_0x00f8,0x1b9));var _0x800f=function(_0x14562a,_0x4d3bed){_0x14562a=_0x14562a-0x0;var _0x1d1f9a=_0x00f8[_0x14562a];return _0x1d1f9a;};'use strict';var _=require('lodash');var util=require(_0x800f('0x0'));var moment=require(_0x800f('0x1'));var BPromise=require(_0x800f('0x2'));var rs=require(_0x800f('0x3'));var fs=require('fs');var Redis=require(_0x800f('0x4'));var db=require(_0x800f('0x5'))['db'];var utils=require(_0x800f('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x800f('0x7'));var client=jayson[_0x800f('0x8')][_0x800f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24fd2d,_0x2bb7af,_0x4d20fd){return new BPromise(function(_0xb6f69f,_0x1e3acc){return client[_0x800f('0xa')](_0x24fd2d,_0x4d20fd)[_0x800f('0xb')](function(_0x430d1e){logger['info'](_0x800f('0xc'),_0x2bb7af,_0x800f('0xd'));logger['debug'](_0x800f('0xe'),_0x2bb7af,_0x800f('0xd'),JSON[_0x800f('0xf')](_0x430d1e));if(_0x430d1e['error']){if(_0x430d1e[_0x800f('0x10')][_0x800f('0x11')]===0x1f4){logger[_0x800f('0x10')](_0x800f('0xc'),_0x2bb7af,_0x430d1e[_0x800f('0x10')][_0x800f('0x12')]);return _0x1e3acc(_0x430d1e[_0x800f('0x10')][_0x800f('0x12')]);}logger['error'](_0x800f('0xc'),_0x2bb7af,_0x430d1e[_0x800f('0x10')]['message']);return _0xb6f69f(_0x430d1e[_0x800f('0x10')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x2bb7af,'request\x20sent');_0xb6f69f(_0x430d1e[_0x800f('0x13')][_0x800f('0x12')]);}})[_0x800f('0x14')](function(_0x15a7d1){logger['error'](_0x800f('0xc'),_0x2bb7af,_0x15a7d1);_0x1e3acc(_0x15a7d1);});});} \ No newline at end of file +var _0x0839=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2fbfe9,_0xc34d85){var _0x2835f2=function(_0x4e93f9){while(--_0x4e93f9){_0x2fbfe9['push'](_0x2fbfe9['shift']());}};_0x2835f2(++_0xc34d85);}(_0x0839,0x72));var _0x9083=function(_0x59bb97,_0x16f112){_0x59bb97=_0x59bb97-0x0;var _0x3a4c48=_0x0839[_0x59bb97];return _0x3a4c48;};'use strict';var _=require(_0x9083('0x0'));var util=require(_0x9083('0x1'));var moment=require('moment');var BPromise=require(_0x9083('0x2'));var rs=require(_0x9083('0x3'));var fs=require('fs');var Redis=require(_0x9083('0x4'));var db=require(_0x9083('0x5'))['db'];var utils=require(_0x9083('0x6'));var logger=require(_0x9083('0x7'))('rpc');var config=require(_0x9083('0x8'));var jayson=require(_0x9083('0x9'));var client=jayson[_0x9083('0xa')][_0x9083('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fcc5e,_0xefb2a0,_0x379cbc){return new BPromise(function(_0x45df06,_0x3925ff){return client[_0x9083('0xc')](_0x1fcc5e,_0x379cbc)[_0x9083('0xd')](function(_0x32545d){logger['info'](_0x9083('0xe'),_0xefb2a0,'request\x20sent');logger[_0x9083('0xf')](_0x9083('0x10'),_0xefb2a0,_0x9083('0x11'),JSON[_0x9083('0x12')](_0x32545d));if(_0x32545d[_0x9083('0x13')]){if(_0x32545d[_0x9083('0x13')][_0x9083('0x14')]===0x1f4){logger[_0x9083('0x13')](_0x9083('0xe'),_0xefb2a0,_0x32545d[_0x9083('0x13')][_0x9083('0x15')]);return _0x3925ff(_0x32545d[_0x9083('0x13')][_0x9083('0x15')]);}logger[_0x9083('0x13')](_0x9083('0xe'),_0xefb2a0,_0x32545d[_0x9083('0x13')][_0x9083('0x15')]);return _0x45df06(_0x32545d[_0x9083('0x13')][_0x9083('0x15')]);}else{logger['info'](_0x9083('0xe'),_0xefb2a0,_0x9083('0x11'));_0x45df06(_0x32545d[_0x9083('0x16')][_0x9083('0x15')]);}})[_0x9083('0x17')](function(_0x3ffc67){logger['error'](_0x9083('0xe'),_0xefb2a0,_0x3ffc67);_0x3925ff(_0x3ffc67);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 709bec9..521cc28 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 _0xc2f7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','multer','path','express'];(function(_0x3da4e1,_0x9644d1){var _0x16c20d=function(_0x13c9b4){while(--_0x13c9b4){_0x3da4e1['push'](_0x3da4e1['shift']());}};_0x16c20d(++_0x9644d1);}(_0xc2f7,0xde));var _0x7c2f=function(_0x271883,_0x44642b){_0x271883=_0x271883-0x0;var _0x351f9e=_0xc2f7[_0x271883];return _0x351f9e;};'use strict';var multer=require(_0x7c2f('0x0'));var util=require('util');var path=require(_0x7c2f('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c2f('0x2'));var router=express[_0x7c2f('0x3')]();var fs_extra=require(_0x7c2f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c2f('0x5'));var config=require(_0x7c2f('0x6'));var controller=require(_0x7c2f('0x7'));router[_0x7c2f('0x8')]('/:id',auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xa')]);router[_0x7c2f('0xb')](_0x7c2f('0xc'),auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xd')]);router['delete'](_0x7c2f('0xc'),auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5d7c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x5d7c,0x173));var _0xc5d7=function(_0x3e8ad4,_0x1bdf83){_0x3e8ad4=_0x3e8ad4-0x0;var _0x141d93=_0x5d7c[_0x3e8ad4];return _0x141d93;};'use strict';var multer=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var path=require(_0xc5d7('0x2'));var timeout=require(_0xc5d7('0x3'));var express=require(_0xc5d7('0x4'));var router=express[_0xc5d7('0x5')]();var fs_extra=require(_0xc5d7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc5d7('0x7'));var config=require(_0xc5d7('0x8'));var controller=require('./chatApplication.controller');router['get']('/:id',auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xa')]);router[_0xc5d7('0xb')](_0xc5d7('0xc'),auth[_0xc5d7('0x9')](),controller[_0xc5d7('0xd')]);router[_0xc5d7('0xe')](_0xc5d7('0xc'),auth['isAuthenticated'](),controller[_0xc5d7('0xf')]);module[_0xc5d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e86fa24..0e905c3 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 _0x14c2=['sequelize','STRING','BOOLEAN'];(function(_0x43cfab,_0x543a2c){var _0x2477fe=function(_0x5be5d9){while(--_0x5be5d9){_0x43cfab['push'](_0x43cfab['shift']());}};_0x2477fe(++_0x543a2c);}(_0x14c2,0x180));var _0x214c=function(_0x15fa1e,_0x5fb00e){_0x15fa1e=_0x15fa1e-0x0;var _0x244e23=_0x14c2[_0x15fa1e];return _0x244e23;};'use strict';var Sequelize=require(_0x214c('0x0'));module['exports']={'name':{'type':Sequelize[_0x214c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x214c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfb93=['sequelize','exports','STRING'];(function(_0x16a2db,_0x309864){var _0xa49c6e=function(_0x261142){while(--_0x261142){_0x16a2db['push'](_0x16a2db['shift']());}};_0xa49c6e(++_0x309864);}(_0xfb93,0x111));var _0x3fb9=function(_0x10bf40,_0x16afab){_0x10bf40=_0x10bf40-0x0;var _0xaf8a14=_0xfb93[_0x10bf40];return _0xaf8a14;};'use strict';var Sequelize=require(_0x3fb9('0x0'));module[_0x3fb9('0x1')]={'name':{'type':Sequelize[_0x3fb9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3fb9('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index fc14794..7eb4e18 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 _0x2f69=['ids','getMembers','User','removeMembers','addMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','ChatInternalMessage','addMembers','omit'];(function(_0x4b84df,_0x347dad){var _0x4ffcd5=function(_0x20ddab){while(--_0x20ddab){_0x4b84df['push'](_0x4b84df['shift']());}};_0x4ffcd5(++_0x347dad);}(_0x2f69,0x12e));var _0x92f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f69[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x92f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92f6('0x1'));var jsonpatch=require(_0x92f6('0x2'));var rp=require('request-promise');var moment=require(_0x92f6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x92f6('0x4'));var util=require(_0x92f6('0x5'));var path=require(_0x92f6('0x6'));var sox=require(_0x92f6('0x7'));var csv=require(_0x92f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f6('0x9'));var _=require(_0x92f6('0xa'));var squel=require(_0x92f6('0xb'));var crypto=require(_0x92f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92f6('0xd'));var toCsv=require(_0x92f6('0x8'));var querystring=require(_0x92f6('0xe'));var Papa=require(_0x92f6('0xf'));var Redis=require(_0x92f6('0x10'));var authService=require(_0x92f6('0x11'));var qs=require(_0x92f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92f6('0x13'));var logger=require(_0x92f6('0x14'))(_0x92f6('0x15'));var utils=require(_0x92f6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x92f6('0x17'));var db=require(_0x92f6('0x18'))['db'];config[_0x92f6('0x19')]=_['defaults'](config[_0x92f6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x92f6('0x1a'))(new Redis(config[_0x92f6('0x19')]));require(_0x92f6('0x1b'))[_0x92f6('0x1c')](socket);function respondWithStatusCode(_0x29225a,_0x1ddee1){_0x1ddee1=_0x1ddee1||0xcc;return function(_0x1c05ca){if(_0x1c05ca){return _0x29225a[_0x92f6('0x1d')](_0x1ddee1);}return _0x29225a[_0x92f6('0x1e')](_0x1ddee1)[_0x92f6('0x1f')]();};}function respondWithResult(_0x41ae14,_0x3aebf2){_0x3aebf2=_0x3aebf2||0xc8;return function(_0x502051){if(_0x502051){return _0x41ae14['status'](_0x3aebf2)['json'](_0x502051);}};}function respondWithFilteredResult(_0x328b43,_0x3d207a){return function(_0x3e4029){if(_0x3e4029){var _0x14d287=typeof _0x3d207a[_0x92f6('0x20')]===_0x92f6('0x21')&&typeof _0x3d207a[_0x92f6('0x22')]===_0x92f6('0x21');var _0x1d5993=_0x3e4029[_0x92f6('0x23')];var _0x1ab723=_0x14d287?0x0:_0x3d207a['offset'];var _0x4718fa=_0x14d287?_0x3e4029[_0x92f6('0x23')]:_0x3d207a[_0x92f6('0x20')]+_0x3d207a[_0x92f6('0x22')];var _0xac1ed1;if(_0x4718fa>=_0x1d5993){_0x4718fa=_0x1d5993;_0xac1ed1=0xc8;}else{_0xac1ed1=0xce;}_0x328b43[_0x92f6('0x1e')](_0xac1ed1);return _0x328b43[_0x92f6('0x24')](_0x92f6('0x25'),_0x1ab723+'-'+_0x4718fa+'/'+_0x1d5993)[_0x92f6('0x26')](_0x3e4029);}return null;};}function patchUpdates(_0xe7fbbc){return function(_0x8f8d8b){try{jsonpatch[_0x92f6('0x27')](_0x8f8d8b,_0xe7fbbc,!![]);}catch(_0x37dd44){return BPromise['reject'](_0x37dd44);}return _0x8f8d8b['save']();};}function saveUpdates(_0x131489,_0x58f514){return function(_0x336c22){if(_0x336c22){return _0x336c22[_0x92f6('0x28')](_0x131489)[_0x92f6('0x29')](function(_0x29b117){return _0x29b117;});}return null;};}function removeEntity(_0x1a3130,_0x547f7f){return function(_0x2047a6){if(_0x2047a6){return _0x2047a6[_0x92f6('0x2a')]()[_0x92f6('0x29')](function(){_0x1a3130[_0x92f6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42fdd1,_0x583a71){return function(_0x2f63aa){if(!_0x2f63aa){_0x42fdd1['sendStatus'](0x194);}return _0x2f63aa;};}function handleError(_0x4e8fa2,_0x2008db){_0x2008db=_0x2008db||0x1f4;return function(_0x4f174e){logger[_0x92f6('0x2b')](_0x4f174e[_0x92f6('0x2c')]);if(_0x4f174e[_0x92f6('0x2d')]){delete _0x4f174e['name'];}_0x4e8fa2[_0x92f6('0x1e')](_0x2008db)[_0x92f6('0x2e')](_0x4f174e);};}exports[_0x92f6('0x2f')]=function(_0x1e953b,_0x228ef7){var _0x2652d5={},_0x1fdf80={},_0x5f30e8={'count':0x0,'rows':[]};var _0x18c1ff=_[_0x92f6('0x30')](db[_0x92f6('0x31')]['rawAttributes'],function(_0x39c054){return{'name':_0x39c054[_0x92f6('0x32')],'type':_0x39c054[_0x92f6('0x33')][_0x92f6('0x34')]};});_0x1fdf80[_0x92f6('0x35')]=_['map'](_0x18c1ff,_0x92f6('0x2d'));_0x1fdf80[_0x92f6('0x36')]=_[_0x92f6('0x37')](_0x1e953b[_0x92f6('0x36')]);_0x1fdf80[_0x92f6('0x38')]=_[_0x92f6('0x39')](_0x1fdf80[_0x92f6('0x35')],_0x1fdf80['query']);_0x2652d5['attributes']=_[_0x92f6('0x39')](_0x1fdf80[_0x92f6('0x35')],qs['fields'](_0x1e953b['query']['fields']));_0x2652d5[_0x92f6('0x3a')]=_0x2652d5[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x2652d5[_0x92f6('0x3a')]:_0x1fdf80['model'];if(!_0x1e953b[_0x92f6('0x36')][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0x2652d5[_0x92f6('0x22')]=qs['limit'](_0x1e953b[_0x92f6('0x36')][_0x92f6('0x22')]);_0x2652d5[_0x92f6('0x20')]=qs['offset'](_0x1e953b['query']['offset']);}_0x2652d5[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0x1e953b[_0x92f6('0x36')]['sort']);_0x2652d5[_0x92f6('0x40')]=qs['filters'](_[_0x92f6('0x41')](_0x1e953b[_0x92f6('0x36')],_0x1fdf80['filters']),_0x18c1ff);if(_0x1e953b[_0x92f6('0x36')][_0x92f6('0x42')]){_0x2652d5[_0x92f6('0x40')]=_[_0x92f6('0x43')](_0x2652d5[_0x92f6('0x40')],{'$or':_[_0x92f6('0x30')](_0x18c1ff,function(_0xe417f3){if(_0xe417f3['type']!==_0x92f6('0x44')){var _0x59d319={};_0x59d319[_0xe417f3[_0x92f6('0x2d')]]={'$like':'%'+_0x1e953b[_0x92f6('0x36')]['filter']+'%'};return _0x59d319;}})});}_0x2652d5=_['merge']({},_0x2652d5,_0x1e953b[_0x92f6('0x45')]);var _0x2325fc={'where':_0x2652d5[_0x92f6('0x40')]};return db[_0x92f6('0x31')]['count'](_0x2325fc)[_0x92f6('0x29')](function(_0xa11f60){_0x5f30e8[_0x92f6('0x23')]=_0xa11f60;if(_0x1e953b[_0x92f6('0x36')][_0x92f6('0x46')]){_0x2652d5[_0x92f6('0x47')]=[{'all':!![]}];}return db[_0x92f6('0x31')][_0x92f6('0x48')](_0x2652d5);})['then'](function(_0x3d99c5){_0x5f30e8[_0x92f6('0x49')]=_0x3d99c5;return _0x5f30e8;})[_0x92f6('0x29')](respondWithFilteredResult(_0x228ef7,_0x2652d5))[_0x92f6('0x4a')](handleError(_0x228ef7,null));};exports[_0x92f6('0x4b')]=function(_0x405df9,_0x5f5334){var _0x48aee0={'raw':!![],'where':{'id':_0x405df9[_0x92f6('0x4c')]['id']}},_0x345e27={};_0x345e27['model']=_[_0x92f6('0x37')](db['ChatGroup'][_0x92f6('0x4d')]);_0x345e27[_0x92f6('0x36')]=_['keys'](_0x405df9[_0x92f6('0x36')]);_0x345e27['filters']=_[_0x92f6('0x39')](_0x345e27['model'],_0x345e27[_0x92f6('0x36')]);_0x48aee0[_0x92f6('0x3a')]=_['intersection'](_0x345e27['model'],qs[_0x92f6('0x4e')](_0x405df9['query'][_0x92f6('0x4e')]));_0x48aee0[_0x92f6('0x3a')]=_0x48aee0[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x48aee0[_0x92f6('0x3a')]:_0x345e27[_0x92f6('0x35')];if(_0x405df9[_0x92f6('0x36')][_0x92f6('0x46')]){_0x48aee0[_0x92f6('0x47')]=[{'all':!![]}];}_0x48aee0=_[_0x92f6('0x43')]({},_0x48aee0,_0x405df9['options']);return db[_0x92f6('0x31')][_0x92f6('0x4f')](_0x48aee0)['then'](handleEntityNotFound(_0x5f5334,null))[_0x92f6('0x29')](respondWithResult(_0x5f5334,null))[_0x92f6('0x4a')](handleError(_0x5f5334,null));};exports[_0x92f6('0x50')]=function(_0x3056fa,_0x5dc85c){return db['ChatGroup']['create'](_0x3056fa[_0x92f6('0x51')],{})[_0x92f6('0x29')](respondWithResult(_0x5dc85c,0xc9))[_0x92f6('0x4a')](handleError(_0x5dc85c,null));};exports[_0x92f6('0x28')]=function(_0x15706b,_0x1fca15){if(_0x15706b[_0x92f6('0x51')]['id']){delete _0x15706b['body']['id'];}return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x15706b[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x1fca15,null))[_0x92f6('0x29')](saveUpdates(_0x15706b['body'],null))[_0x92f6('0x29')](respondWithResult(_0x1fca15,null))[_0x92f6('0x4a')](handleError(_0x1fca15,null));};exports[_0x92f6('0x2a')]=function(_0x179d2e,_0x3d50d7){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x179d2e['params']['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x3d50d7,null))[_0x92f6('0x29')](removeEntity(_0x3d50d7,null))['catch'](handleError(_0x3d50d7,null));};exports[_0x92f6('0x52')]=function(_0x330964,_0x42ca91){return db[_0x92f6('0x31')][_0x92f6('0x52')]()[_0x92f6('0x29')](respondWithResult(_0x42ca91,null))[_0x92f6('0x4a')](handleError(_0x42ca91,null));};exports['getUnread']=function(_0x12d33d,_0x220c19,_0xbb0267){return db[_0x92f6('0x53')][_0x92f6('0x23')]({'where':{'ChatGroupId':_0x12d33d[_0x92f6('0x4c')]['id'],'ToId':_0x12d33d['user']['id'],'read':![]}})[_0x92f6('0x29')](function(_0x43e1a0){return{'id':_['toInteger'](_0x12d33d[_0x92f6('0x4c')]['id']),'count':_0x43e1a0};})[_0x92f6('0x29')](respondWithResult(_0x220c19,null))[_0x92f6('0x4a')](handleError(_0x220c19,null));};exports[_0x92f6('0x54')]=function(_0x2dedb5,_0x3a9492,_0x460650){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x2dedb5[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x3a9492,null))['then'](function(_0x53b46f){if(_0x53b46f){return _0x53b46f[_0x92f6('0x54')](_0x2dedb5[_0x92f6('0x51')]['ids'],_[_0x92f6('0x55')](_0x2dedb5[_0x92f6('0x51')],[_0x92f6('0x56'),'id'])||{});}})[_0x92f6('0x29')](respondWithResult(_0x3a9492,null))[_0x92f6('0x4a')](handleError(_0x3a9492,null));};exports[_0x92f6('0x57')]=function(_0x2be1d4,_0x5880cc,_0x4fc6b3){var _0x5b03d3={};var _0x2d7168={};var _0x5ecbd0;var _0x12ffb3;return db['ChatGroup']['findOne']({'where':{'id':_0x2be1d4['params']['id']}})['then'](handleEntityNotFound(_0x5880cc,null))[_0x92f6('0x29')](function(_0x213701){if(_0x213701){_0x5ecbd0=_0x213701;_0x2d7168[_0x92f6('0x35')]=_['keys'](db[_0x92f6('0x58')]['rawAttributes']);_0x2d7168['query']=_[_0x92f6('0x37')](_0x2be1d4[_0x92f6('0x36')]);_0x2d7168['filters']=_['intersection'](_0x2d7168[_0x92f6('0x35')],_0x2d7168['query']);_0x5b03d3[_0x92f6('0x3a')]=_['intersection'](_0x2d7168[_0x92f6('0x35')],qs[_0x92f6('0x4e')](_0x2be1d4['query'][_0x92f6('0x4e')]));_0x5b03d3[_0x92f6('0x3a')]=_0x5b03d3[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0x5b03d3['attributes']:_0x2d7168[_0x92f6('0x35')];_0x5b03d3[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0x2be1d4[_0x92f6('0x36')][_0x92f6('0x3f')]);_0x5b03d3[_0x92f6('0x40')]=qs[_0x92f6('0x38')](_[_0x92f6('0x41')](_0x2be1d4[_0x92f6('0x36')],_0x2d7168[_0x92f6('0x38')]));if(_0x2be1d4[_0x92f6('0x36')]['filter']){_0x5b03d3[_0x92f6('0x40')]=_[_0x92f6('0x43')](_0x5b03d3['where'],{'$or':_[_0x92f6('0x30')](_0x5b03d3[_0x92f6('0x3a')],function(_0xdb8030){var _0x5e8e90={};_0x5e8e90[_0xdb8030]={'$like':'%'+_0x2be1d4['query']['filter']+'%'};return _0x5e8e90;})});}_0x5b03d3=_[_0x92f6('0x43')]({},_0x5b03d3,_0x2be1d4[_0x92f6('0x45')]);return _0x5ecbd0[_0x92f6('0x57')](_0x5b03d3);}})['then'](function(_0x51ad99){if(_0x51ad99){_0x12ffb3=_0x51ad99[_0x92f6('0x3b')];if(!_0x2be1d4['query'][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0x5b03d3['limit']=qs[_0x92f6('0x22')](_0x2be1d4[_0x92f6('0x36')]['limit']);_0x5b03d3[_0x92f6('0x20')]=qs[_0x92f6('0x20')](_0x2be1d4[_0x92f6('0x36')][_0x92f6('0x20')]);}return _0x5ecbd0[_0x92f6('0x57')](_0x5b03d3);}})['then'](function(_0x5ee27c){if(_0x5ee27c){return _0x5ee27c?{'count':_0x12ffb3,'rows':_0x5ee27c}:null;}})[_0x92f6('0x29')](respondWithResult(_0x5880cc,null))[_0x92f6('0x4a')](handleError(_0x5880cc,null));};exports[_0x92f6('0x59')]=function(_0x1a5232,_0x974605,_0x584e36){return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x1a5232[_0x92f6('0x4c')]['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0x974605,null))[_0x92f6('0x29')](function(_0x3b1119){if(_0x3b1119){return _0x3b1119[_0x92f6('0x59')](_0x1a5232[_0x92f6('0x36')][_0x92f6('0x56')]);}})['then'](respondWithStatusCode(_0x974605,null))[_0x92f6('0x4a')](handleError(_0x974605,null));};exports[_0x92f6('0x5a')]=function(_0x480b8b,_0xa611b0,_0x59d581){if(_0x480b8b['body']['id']){delete _0x480b8b[_0x92f6('0x51')]['id'];}return db[_0x92f6('0x31')][_0x92f6('0x4f')]({'where':{'id':_0x480b8b['params']['id']}})[_0x92f6('0x29')](handleEntityNotFound(_0xa611b0,null))[_0x92f6('0x29')](function(_0x5b5f53){if(_0x5b5f53){_0x480b8b[_0x92f6('0x51')]['ChatGroupId']=_0x5b5f53['id'];return db[_0x92f6('0x53')][_0x92f6('0x50')](_0x480b8b[_0x92f6('0x51')]);}})[_0x92f6('0x29')](respondWithResult(_0xa611b0,null))[_0x92f6('0x4a')](handleError(_0xa611b0,null));};exports[_0x92f6('0x5b')]=function(_0xd43cfa,_0x3782ed,_0x29605f){var _0xb7ec90={};var _0x37eca3={};var _0x42d19c;var _0x604835;return db[_0x92f6('0x31')][_0x92f6('0x5c')]({'where':{'id':_0xd43cfa[_0x92f6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3782ed,null))['then'](function(_0x510bc0){if(_0x510bc0){_0x42d19c=_0x510bc0;_0x37eca3[_0x92f6('0x35')]=_[_0x92f6('0x37')](db[_0x92f6('0x53')][_0x92f6('0x4d')]);_0x37eca3[_0x92f6('0x36')]=_['keys'](_0xd43cfa[_0x92f6('0x36')]);_0x37eca3[_0x92f6('0x38')]=_['intersection'](_0x37eca3['model'],_0x37eca3['query']);_0xb7ec90[_0x92f6('0x3a')]=_[_0x92f6('0x39')](_0x37eca3[_0x92f6('0x35')],qs['fields'](_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x4e')]));_0xb7ec90[_0x92f6('0x3a')]=_0xb7ec90[_0x92f6('0x3a')][_0x92f6('0x3b')]?_0xb7ec90[_0x92f6('0x3a')]:_0x37eca3[_0x92f6('0x35')];_0xb7ec90[_0x92f6('0x3e')]=qs[_0x92f6('0x3f')](_0xd43cfa[_0x92f6('0x36')]['sort']);_0xb7ec90[_0x92f6('0x40')]=qs[_0x92f6('0x38')](_[_0x92f6('0x41')](_0xd43cfa[_0x92f6('0x36')],_0x37eca3[_0x92f6('0x38')]));if(_0xd43cfa['query'][_0x92f6('0x42')]){_0xb7ec90[_0x92f6('0x40')]=_['merge'](_0xb7ec90[_0x92f6('0x40')],{'$or':_[_0x92f6('0x30')](_0xb7ec90[_0x92f6('0x3a')],function(_0x51e91d){var _0x26629b={};_0x26629b[_0x51e91d]={'$like':'%'+_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x42')]+'%'};return _0x26629b;})});}if(_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x5d')]){var _0x1b22ac=_0xd43cfa['query'][_0x92f6('0x5d')][_0x92f6('0x5e')](',');var _0x57f0b9={};_0x57f0b9[_0x1b22ac[0x0]]={'$gte':moment(_0x1b22ac[0x1])[_0x92f6('0x5f')](_0x92f6('0x60'))};_0xb7ec90[_0x92f6('0x40')]=_['merge'](_0xb7ec90['where'],_0x57f0b9);}_0xb7ec90=_['merge']({},_0xb7ec90,_0xd43cfa[_0x92f6('0x45')]);return _0x42d19c[_0x92f6('0x5b')](_0xb7ec90);}})[_0x92f6('0x29')](function(_0x48f867){if(_0x48f867){_0x604835=_0x48f867[_0x92f6('0x3b')];if(!_0xd43cfa['query'][_0x92f6('0x3c')](_0x92f6('0x3d'))){_0xb7ec90[_0x92f6('0x22')]=qs[_0x92f6('0x22')](_0xd43cfa[_0x92f6('0x36')]['limit']);_0xb7ec90[_0x92f6('0x20')]=qs[_0x92f6('0x20')](_0xd43cfa[_0x92f6('0x36')][_0x92f6('0x20')]);}return _0x42d19c[_0x92f6('0x5b')](_0xb7ec90);}})[_0x92f6('0x29')](function(_0x3e89c4){if(_0x3e89c4){return _0x3e89c4?{'count':_0x604835,'rows':_0x3e89c4}:null;}})[_0x92f6('0x29')](respondWithResult(_0x3782ed,null))[_0x92f6('0x4a')](handleError(_0x3782ed,null));}; \ No newline at end of file +var _0xabdf=['bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','limit','count','json','reject','save','update','then','destroy','name','send','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','include','create','body','params','find','describe','getUnread','user','addMembers','ids','getMembers','User','pick','removeMembers','addMessage','ChatInternalMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x307ce2,_0x41a7b3){var _0x24006e=function(_0x18622e){while(--_0x18622e){_0x307ce2['push'](_0x307ce2['shift']());}};_0x24006e(++_0x41a7b3);}(_0xabdf,0xb8));var _0xfabd=function(_0x4e7ee0,_0x25eb02){_0x4e7ee0=_0x4e7ee0-0x0;var _0x509369=_0xabdf[_0x4e7ee0];return _0x509369;};'use strict';var emlformat=require(_0xfabd('0x0'));var rimraf=require(_0xfabd('0x1'));var zipdir=require(_0xfabd('0x2'));var jsonpatch=require(_0xfabd('0x3'));var rp=require(_0xfabd('0x4'));var moment=require(_0xfabd('0x5'));var BPromise=require(_0xfabd('0x6'));var Mustache=require(_0xfabd('0x7'));var util=require(_0xfabd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfabd('0x9'));var ejs=require(_0xfabd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfabd('0xb'));var squel=require(_0xfabd('0xc'));var crypto=require(_0xfabd('0xd'));var jsforce=require(_0xfabd('0xe'));var deskjs=require(_0xfabd('0xf'));var toCsv=require(_0xfabd('0x9'));var querystring=require(_0xfabd('0x10'));var Papa=require(_0xfabd('0x11'));var Redis=require(_0xfabd('0x12'));var authService=require(_0xfabd('0x13'));var qs=require(_0xfabd('0x14'));var as=require(_0xfabd('0x15'));var hardwareService=require(_0xfabd('0x16'));var logger=require(_0xfabd('0x17'))('api');var utils=require(_0xfabd('0x18'));var config=require(_0xfabd('0x19'));var licenseUtil=require(_0xfabd('0x1a'));var db=require(_0xfabd('0x1b'))['db'];config[_0xfabd('0x1c')]=_[_0xfabd('0x1d')](config[_0xfabd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xfabd('0x1e'))(new Redis(config[_0xfabd('0x1c')]));require(_0xfabd('0x1f'))[_0xfabd('0x20')](socket);function respondWithStatusCode(_0x5ecca9,_0x275fc3){_0x275fc3=_0x275fc3||0xcc;return function(_0x478231){if(_0x478231){return _0x5ecca9[_0xfabd('0x21')](_0x275fc3);}return _0x5ecca9['status'](_0x275fc3)[_0xfabd('0x22')]();};}function respondWithResult(_0x3720d9,_0x3dab1b){_0x3dab1b=_0x3dab1b||0xc8;return function(_0x40f24e){if(_0x40f24e){return _0x3720d9[_0xfabd('0x23')](_0x3dab1b)['json'](_0x40f24e);}};}function respondWithFilteredResult(_0x38cf63,_0x3dfb66){return function(_0x2e905b){if(_0x2e905b){var _0x1c1508=typeof _0x3dfb66[_0xfabd('0x24')]===_0xfabd('0x25')&&typeof _0x3dfb66[_0xfabd('0x26')]==='undefined';var _0x55e6fe=_0x2e905b[_0xfabd('0x27')];var _0x30a6bc=_0x1c1508?0x0:_0x3dfb66['offset'];var _0x3bca59=_0x1c1508?_0x2e905b[_0xfabd('0x27')]:_0x3dfb66[_0xfabd('0x24')]+_0x3dfb66['limit'];var _0x128c7d;if(_0x3bca59>=_0x55e6fe){_0x3bca59=_0x55e6fe;_0x128c7d=0xc8;}else{_0x128c7d=0xce;}_0x38cf63[_0xfabd('0x23')](_0x128c7d);return _0x38cf63['set']('Content-Range',_0x30a6bc+'-'+_0x3bca59+'/'+_0x55e6fe)[_0xfabd('0x28')](_0x2e905b);}return null;};}function patchUpdates(_0x288b04){return function(_0x215a39){try{jsonpatch['apply'](_0x215a39,_0x288b04,!![]);}catch(_0x5838cb){return BPromise[_0xfabd('0x29')](_0x5838cb);}return _0x215a39[_0xfabd('0x2a')]();};}function saveUpdates(_0x255894,_0x267440){return function(_0x46ee15){if(_0x46ee15){return _0x46ee15[_0xfabd('0x2b')](_0x255894)[_0xfabd('0x2c')](function(_0x502bdd){return _0x502bdd;});}return null;};}function removeEntity(_0x47c727,_0x9ebbc0){return function(_0x13d50d){if(_0x13d50d){return _0x13d50d[_0xfabd('0x2d')]()[_0xfabd('0x2c')](function(){_0x47c727['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2ffd,_0x1cebff){return function(_0x5671c2){if(!_0x5671c2){_0x1c2ffd[_0xfabd('0x21')](0x194);}return _0x5671c2;};}function handleError(_0x3d4eee,_0x50fd34){_0x50fd34=_0x50fd34||0x1f4;return function(_0x58333d){logger['error'](_0x58333d['stack']);if(_0x58333d[_0xfabd('0x2e')]){delete _0x58333d[_0xfabd('0x2e')];}_0x3d4eee['status'](_0x50fd34)[_0xfabd('0x2f')](_0x58333d);};}exports['index']=function(_0xc4efa2,_0x3d2d50){var _0x4060b7={},_0xe5a749={},_0x33bf00={'count':0x0,'rows':[]};var _0x23a1c0=_['map'](db[_0xfabd('0x30')][_0xfabd('0x31')],function(_0x560e11){return{'name':_0x560e11[_0xfabd('0x32')],'type':_0x560e11['type'][_0xfabd('0x33')]};});_0xe5a749[_0xfabd('0x34')]=_[_0xfabd('0x35')](_0x23a1c0,_0xfabd('0x2e'));_0xe5a749[_0xfabd('0x36')]=_[_0xfabd('0x37')](_0xc4efa2[_0xfabd('0x36')]);_0xe5a749[_0xfabd('0x38')]=_[_0xfabd('0x39')](_0xe5a749[_0xfabd('0x34')],_0xe5a749[_0xfabd('0x36')]);_0x4060b7[_0xfabd('0x3a')]=_[_0xfabd('0x39')](_0xe5a749[_0xfabd('0x34')],qs['fields'](_0xc4efa2[_0xfabd('0x36')][_0xfabd('0x3b')]));_0x4060b7['attributes']=_0x4060b7[_0xfabd('0x3a')][_0xfabd('0x3c')]?_0x4060b7[_0xfabd('0x3a')]:_0xe5a749[_0xfabd('0x34')];if(!_0xc4efa2[_0xfabd('0x36')][_0xfabd('0x3d')](_0xfabd('0x3e'))){_0x4060b7[_0xfabd('0x26')]=qs[_0xfabd('0x26')](_0xc4efa2['query'][_0xfabd('0x26')]);_0x4060b7[_0xfabd('0x24')]=qs[_0xfabd('0x24')](_0xc4efa2[_0xfabd('0x36')][_0xfabd('0x24')]);}_0x4060b7['order']=qs['sort'](_0xc4efa2[_0xfabd('0x36')][_0xfabd('0x3f')]);_0x4060b7[_0xfabd('0x40')]=qs['filters'](_['pick'](_0xc4efa2[_0xfabd('0x36')],_0xe5a749[_0xfabd('0x38')]),_0x23a1c0);if(_0xc4efa2[_0xfabd('0x36')]['filter']){_0x4060b7[_0xfabd('0x40')]=_[_0xfabd('0x41')](_0x4060b7[_0xfabd('0x40')],{'$or':_[_0xfabd('0x35')](_0x23a1c0,function(_0x175202){if(_0x175202[_0xfabd('0x42')]!==_0xfabd('0x43')){var _0x30c57f={};_0x30c57f[_0x175202[_0xfabd('0x2e')]]={'$like':'%'+_0xc4efa2['query'][_0xfabd('0x44')]+'%'};return _0x30c57f;}})});}_0x4060b7=_[_0xfabd('0x41')]({},_0x4060b7,_0xc4efa2[_0xfabd('0x45')]);var _0x87f218={'where':_0x4060b7[_0xfabd('0x40')]};return db[_0xfabd('0x30')][_0xfabd('0x27')](_0x87f218)[_0xfabd('0x2c')](function(_0x5e5044){_0x33bf00['count']=_0x5e5044;if(_0xc4efa2[_0xfabd('0x36')][_0xfabd('0x46')]){_0x4060b7['include']=[{'all':!![]}];}return db[_0xfabd('0x30')][_0xfabd('0x47')](_0x4060b7);})['then'](function(_0x3845f9){_0x33bf00['rows']=_0x3845f9;return _0x33bf00;})['then'](respondWithFilteredResult(_0x3d2d50,_0x4060b7))[_0xfabd('0x48')](handleError(_0x3d2d50,null));};exports[_0xfabd('0x49')]=function(_0x374bfc,_0x4b6a66){var _0xabaf8f={'raw':!![],'where':{'id':_0x374bfc['params']['id']}},_0x4b0a60={};_0x4b0a60['model']=_['keys'](db[_0xfabd('0x30')][_0xfabd('0x31')]);_0x4b0a60[_0xfabd('0x36')]=_[_0xfabd('0x37')](_0x374bfc[_0xfabd('0x36')]);_0x4b0a60[_0xfabd('0x38')]=_[_0xfabd('0x39')](_0x4b0a60[_0xfabd('0x34')],_0x4b0a60[_0xfabd('0x36')]);_0xabaf8f[_0xfabd('0x3a')]=_['intersection'](_0x4b0a60[_0xfabd('0x34')],qs[_0xfabd('0x3b')](_0x374bfc['query'][_0xfabd('0x3b')]));_0xabaf8f[_0xfabd('0x3a')]=_0xabaf8f['attributes'][_0xfabd('0x3c')]?_0xabaf8f[_0xfabd('0x3a')]:_0x4b0a60[_0xfabd('0x34')];if(_0x374bfc[_0xfabd('0x36')][_0xfabd('0x46')]){_0xabaf8f[_0xfabd('0x4a')]=[{'all':!![]}];}_0xabaf8f=_[_0xfabd('0x41')]({},_0xabaf8f,_0x374bfc['options']);return db[_0xfabd('0x30')]['find'](_0xabaf8f)[_0xfabd('0x2c')](handleEntityNotFound(_0x4b6a66,null))[_0xfabd('0x2c')](respondWithResult(_0x4b6a66,null))[_0xfabd('0x48')](handleError(_0x4b6a66,null));};exports[_0xfabd('0x4b')]=function(_0x147355,_0x147b85){return db[_0xfabd('0x30')][_0xfabd('0x4b')](_0x147355[_0xfabd('0x4c')],{})[_0xfabd('0x2c')](respondWithResult(_0x147b85,0xc9))[_0xfabd('0x48')](handleError(_0x147b85,null));};exports['update']=function(_0x23f838,_0x4a6e16){if(_0x23f838[_0xfabd('0x4c')]['id']){delete _0x23f838[_0xfabd('0x4c')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x23f838[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x4a6e16,null))[_0xfabd('0x2c')](saveUpdates(_0x23f838[_0xfabd('0x4c')],null))['then'](respondWithResult(_0x4a6e16,null))[_0xfabd('0x48')](handleError(_0x4a6e16,null));};exports['destroy']=function(_0x4f8feb,_0x260ac3){return db[_0xfabd('0x30')][_0xfabd('0x4e')]({'where':{'id':_0x4f8feb[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x260ac3,null))['then'](removeEntity(_0x260ac3,null))['catch'](handleError(_0x260ac3,null));};exports[_0xfabd('0x4f')]=function(_0x20518a,_0x547adc){return db[_0xfabd('0x30')][_0xfabd('0x4f')]()[_0xfabd('0x2c')](respondWithResult(_0x547adc,null))['catch'](handleError(_0x547adc,null));};exports[_0xfabd('0x50')]=function(_0x18c1f1,_0x5f4339,_0x5da0c3){return db['ChatInternalMessage'][_0xfabd('0x27')]({'where':{'ChatGroupId':_0x18c1f1[_0xfabd('0x4d')]['id'],'ToId':_0x18c1f1[_0xfabd('0x51')]['id'],'read':![]}})[_0xfabd('0x2c')](function(_0x3210dc){return{'id':_['toInteger'](_0x18c1f1[_0xfabd('0x4d')]['id']),'count':_0x3210dc};})[_0xfabd('0x2c')](respondWithResult(_0x5f4339,null))[_0xfabd('0x48')](handleError(_0x5f4339,null));};exports[_0xfabd('0x52')]=function(_0xd737c6,_0x5aa27d,_0x493d37){return db[_0xfabd('0x30')][_0xfabd('0x4e')]({'where':{'id':_0xd737c6[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x5aa27d,null))[_0xfabd('0x2c')](function(_0x394bfb){if(_0x394bfb){return _0x394bfb[_0xfabd('0x52')](_0xd737c6[_0xfabd('0x4c')][_0xfabd('0x53')],_['omit'](_0xd737c6[_0xfabd('0x4c')],[_0xfabd('0x53'),'id'])||{});}})[_0xfabd('0x2c')](respondWithResult(_0x5aa27d,null))[_0xfabd('0x48')](handleError(_0x5aa27d,null));};exports[_0xfabd('0x54')]=function(_0x95dc79,_0x166399,_0x40b6a6){var _0x5136f7={};var _0x58802b={};var _0x116e45;var _0x1b4b02;return db[_0xfabd('0x30')]['findOne']({'where':{'id':_0x95dc79[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x166399,null))[_0xfabd('0x2c')](function(_0x10e6fd){if(_0x10e6fd){_0x116e45=_0x10e6fd;_0x58802b[_0xfabd('0x34')]=_[_0xfabd('0x37')](db[_0xfabd('0x55')][_0xfabd('0x31')]);_0x58802b[_0xfabd('0x36')]=_[_0xfabd('0x37')](_0x95dc79[_0xfabd('0x36')]);_0x58802b['filters']=_['intersection'](_0x58802b[_0xfabd('0x34')],_0x58802b[_0xfabd('0x36')]);_0x5136f7['attributes']=_[_0xfabd('0x39')](_0x58802b[_0xfabd('0x34')],qs[_0xfabd('0x3b')](_0x95dc79[_0xfabd('0x36')]['fields']));_0x5136f7[_0xfabd('0x3a')]=_0x5136f7[_0xfabd('0x3a')][_0xfabd('0x3c')]?_0x5136f7[_0xfabd('0x3a')]:_0x58802b['model'];_0x5136f7['order']=qs[_0xfabd('0x3f')](_0x95dc79[_0xfabd('0x36')][_0xfabd('0x3f')]);_0x5136f7[_0xfabd('0x40')]=qs[_0xfabd('0x38')](_[_0xfabd('0x56')](_0x95dc79[_0xfabd('0x36')],_0x58802b[_0xfabd('0x38')]));if(_0x95dc79[_0xfabd('0x36')]['filter']){_0x5136f7[_0xfabd('0x40')]=_[_0xfabd('0x41')](_0x5136f7[_0xfabd('0x40')],{'$or':_[_0xfabd('0x35')](_0x5136f7[_0xfabd('0x3a')],function(_0x3655a6){var _0x261e70={};_0x261e70[_0x3655a6]={'$like':'%'+_0x95dc79[_0xfabd('0x36')][_0xfabd('0x44')]+'%'};return _0x261e70;})});}_0x5136f7=_[_0xfabd('0x41')]({},_0x5136f7,_0x95dc79[_0xfabd('0x45')]);return _0x116e45[_0xfabd('0x54')](_0x5136f7);}})['then'](function(_0x37755b){if(_0x37755b){_0x1b4b02=_0x37755b[_0xfabd('0x3c')];if(!_0x95dc79[_0xfabd('0x36')][_0xfabd('0x3d')](_0xfabd('0x3e'))){_0x5136f7[_0xfabd('0x26')]=qs[_0xfabd('0x26')](_0x95dc79[_0xfabd('0x36')][_0xfabd('0x26')]);_0x5136f7[_0xfabd('0x24')]=qs['offset'](_0x95dc79[_0xfabd('0x36')][_0xfabd('0x24')]);}return _0x116e45[_0xfabd('0x54')](_0x5136f7);}})[_0xfabd('0x2c')](function(_0x30f865){if(_0x30f865){return _0x30f865?{'count':_0x1b4b02,'rows':_0x30f865}:null;}})['then'](respondWithResult(_0x166399,null))['catch'](handleError(_0x166399,null));};exports[_0xfabd('0x57')]=function(_0x3d2d7f,_0x5c6317,_0x3d1970){return db['ChatGroup'][_0xfabd('0x4e')]({'where':{'id':_0x3d2d7f[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x5c6317,null))[_0xfabd('0x2c')](function(_0xe0902b){if(_0xe0902b){return _0xe0902b[_0xfabd('0x57')](_0x3d2d7f['query'][_0xfabd('0x53')]);}})['then'](respondWithStatusCode(_0x5c6317,null))['catch'](handleError(_0x5c6317,null));};exports[_0xfabd('0x58')]=function(_0x59a9ee,_0x7eee3,_0x413885){if(_0x59a9ee['body']['id']){delete _0x59a9ee[_0xfabd('0x4c')]['id'];}return db[_0xfabd('0x30')][_0xfabd('0x4e')]({'where':{'id':_0x59a9ee[_0xfabd('0x4d')]['id']}})[_0xfabd('0x2c')](handleEntityNotFound(_0x7eee3,null))[_0xfabd('0x2c')](function(_0x32c311){if(_0x32c311){_0x59a9ee[_0xfabd('0x4c')]['ChatGroupId']=_0x32c311['id'];return db[_0xfabd('0x59')]['create'](_0x59a9ee[_0xfabd('0x4c')]);}})[_0xfabd('0x2c')](respondWithResult(_0x7eee3,null))[_0xfabd('0x48')](handleError(_0x7eee3,null));};exports[_0xfabd('0x5a')]=function(_0x3e93b1,_0x4d2089,_0x5be56f){var _0x115a36={};var _0x416823={};var _0x4dd66d;var _0x3621cf;return db[_0xfabd('0x30')][_0xfabd('0x5b')]({'where':{'id':_0x3e93b1[_0xfabd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4d2089,null))['then'](function(_0x818d54){if(_0x818d54){_0x4dd66d=_0x818d54;_0x416823[_0xfabd('0x34')]=_[_0xfabd('0x37')](db[_0xfabd('0x59')][_0xfabd('0x31')]);_0x416823[_0xfabd('0x36')]=_[_0xfabd('0x37')](_0x3e93b1[_0xfabd('0x36')]);_0x416823['filters']=_[_0xfabd('0x39')](_0x416823[_0xfabd('0x34')],_0x416823[_0xfabd('0x36')]);_0x115a36['attributes']=_[_0xfabd('0x39')](_0x416823[_0xfabd('0x34')],qs[_0xfabd('0x3b')](_0x3e93b1[_0xfabd('0x36')][_0xfabd('0x3b')]));_0x115a36[_0xfabd('0x3a')]=_0x115a36[_0xfabd('0x3a')]['length']?_0x115a36[_0xfabd('0x3a')]:_0x416823[_0xfabd('0x34')];_0x115a36['order']=qs['sort'](_0x3e93b1[_0xfabd('0x36')][_0xfabd('0x3f')]);_0x115a36['where']=qs[_0xfabd('0x38')](_['pick'](_0x3e93b1[_0xfabd('0x36')],_0x416823[_0xfabd('0x38')]));if(_0x3e93b1['query']['filter']){_0x115a36[_0xfabd('0x40')]=_[_0xfabd('0x41')](_0x115a36[_0xfabd('0x40')],{'$or':_[_0xfabd('0x35')](_0x115a36['attributes'],function(_0x167583){var _0x327949={};_0x327949[_0x167583]={'$like':'%'+_0x3e93b1['query']['filter']+'%'};return _0x327949;})});}if(_0x3e93b1[_0xfabd('0x36')][_0xfabd('0x5c')]){var _0x5307a9=_0x3e93b1[_0xfabd('0x36')][_0xfabd('0x5c')]['split'](',');var _0x1e4a0f={};_0x1e4a0f[_0x5307a9[0x0]]={'$gte':moment(_0x5307a9[0x1])[_0xfabd('0x5d')](_0xfabd('0x5e'))};_0x115a36[_0xfabd('0x40')]=_[_0xfabd('0x41')](_0x115a36[_0xfabd('0x40')],_0x1e4a0f);}_0x115a36=_[_0xfabd('0x41')]({},_0x115a36,_0x3e93b1['options']);return _0x4dd66d[_0xfabd('0x5a')](_0x115a36);}})[_0xfabd('0x2c')](function(_0x51e03e){if(_0x51e03e){_0x3621cf=_0x51e03e['length'];if(!_0x3e93b1[_0xfabd('0x36')][_0xfabd('0x3d')](_0xfabd('0x3e'))){_0x115a36[_0xfabd('0x26')]=qs[_0xfabd('0x26')](_0x3e93b1[_0xfabd('0x36')]['limit']);_0x115a36['offset']=qs[_0xfabd('0x24')](_0x3e93b1['query'][_0xfabd('0x24')]);}return _0x4dd66d['getMessages'](_0x115a36);}})[_0xfabd('0x2c')](function(_0x101a8d){if(_0x101a8d){return _0x101a8d?{'count':_0x3621cf,'rows':_0x101a8d}:null;}})[_0xfabd('0x2c')](respondWithResult(_0x4d2089,null))[_0xfabd('0x48')](handleError(_0x4d2089,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c2c7488..f85c3a6 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 _0x649e=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook'];(function(_0xbc902c,_0x1af01b){var _0x5e71e8=function(_0xfdf65b){while(--_0xfdf65b){_0xbc902c['push'](_0xbc902c['shift']());}};_0x5e71e8(++_0x1af01b);}(_0x649e,0xdd));var _0xe649=function(_0x7dec21,_0x84f83c){_0x7dec21=_0x7dec21-0x0;var _0x1b4761=_0x649e[_0x7dec21];return _0x1b4761;};'use strict';var EventEmitter=require(_0xe649('0x0'));var ChatGroup=require(_0xe649('0x1'))['db'][_0xe649('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe649('0x3')](0x0);var events={'afterCreate':_0xe649('0x4'),'afterUpdate':_0xe649('0x5'),'afterDestroy':_0xe649('0x6')};function emitEvent(_0x1b7d70){return function(_0x173b41,_0x4e9760,_0x371318){ChatGroupEvents[_0xe649('0x7')](_0x1b7d70+':'+_0x173b41['id'],_0x173b41);ChatGroupEvents[_0xe649('0x7')](_0x1b7d70,_0x173b41);_0x371318(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe649('0x8')](e,emitEvent(event));}}module[_0xe649('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x9fc3=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9fc3,0xcb));var _0x39fc=function(_0x1e1211,_0x389149){_0x1e1211=_0x1e1211-0x0;var _0x2b83f3=_0x9fc3[_0x1e1211];return _0x2b83f3;};'use strict';var EventEmitter=require(_0x39fc('0x0'));var ChatGroup=require(_0x39fc('0x1'))['db'][_0x39fc('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x39fc('0x3')](0x0);var events={'afterCreate':_0x39fc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x127ae8){return function(_0xe79d81,_0x59808d,_0x31e51b){ChatGroupEvents[_0x39fc('0x5')](_0x127ae8+':'+_0xe79d81['id'],_0xe79d81);ChatGroupEvents[_0x39fc('0x5')](_0x127ae8,_0xe79d81);_0x31e51b(null);};}for(var e in events){if(events[_0x39fc('0x6')](e)){var event=events[e];ChatGroup[_0x39fc('0x7')](e,emitEvent(event));}}module[_0x39fc('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 71d507a..d7615b9 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 _0x2f20=['define','ChatGroup','chat_groups','util','moment','bluebird','rimraf','./chatGroup.attributes'];(function(_0x49136d,_0x3f6127){var _0x40d292=function(_0x3e299c){while(--_0x3e299c){_0x49136d['push'](_0x49136d['shift']());}};_0x40d292(++_0x3f6127);}(_0x2f20,0x6b));var _0x02f2=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x2f20[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x02f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x02f2('0x1'));var BPromise=require(_0x02f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x02f2('0x3'));var config=require('../../config/environment');var attributes=require(_0x02f2('0x4'));module['exports']=function(_0x15707d,_0xd4325){return _0x15707d[_0x02f2('0x5')](_0x02f2('0x6'),attributes,{'tableName':_0x02f2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd152=['rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','request-promise','path'];(function(_0x5ba296,_0x10f5e5){var _0x547e00=function(_0x3aa5ae){while(--_0x3aa5ae){_0x5ba296['push'](_0x5ba296['shift']());}};_0x547e00(++_0x10f5e5);}(_0xd152,0x1be));var _0x2d15=function(_0x16d7c6,_0x4338a4){_0x16d7c6=_0x16d7c6-0x0;var _0x2838ac=_0xd152[_0x16d7c6];return _0x2838ac;};'use strict';var _=require(_0x2d15('0x0'));var util=require('util');var logger=require(_0x2d15('0x1'))(_0x2d15('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d15('0x3'));var fs=require('fs');var path=require(_0x2d15('0x4'));var rimraf=require(_0x2d15('0x5'));var config=require(_0x2d15('0x6'));var attributes=require(_0x2d15('0x7'));module['exports']=function(_0x303ebc,_0xe3ae2c){return _0x303ebc[_0x2d15('0x8')](_0x2d15('0x9'),attributes,{'tableName':_0x2d15('0xa'),'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 d5b80bb..80d681b 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 _0xf0db=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0xf0db,0x12b));var _0xbf0d=function(_0xcba257,_0x510ba6){_0xcba257=_0xcba257-0x0;var _0x437e65=_0xf0db[_0xcba257];return _0x437e65;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var moment=require('moment');var BPromise=require(_0xbf0d('0x2'));var rs=require(_0xbf0d('0x3'));var fs=require('fs');var Redis=require(_0xbf0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf0d('0x5'));var logger=require(_0xbf0d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbf0d('0x7'));var client=jayson[_0xbf0d('0x8')][_0xbf0d('0x9')]({'port':0x232a});config[_0xbf0d('0xa')]=_['defaults'](config[_0xbf0d('0xa')],{'host':_0xbf0d('0xb'),'port':0x18eb});var socket=require(_0xbf0d('0xc'))(new Redis(config[_0xbf0d('0xa')]));require(_0xbf0d('0xd'))[_0xbf0d('0xe')](socket);function respondWithRpcPromise(_0x154401,_0xb7715f,_0x55cb8f){return new BPromise(function(_0x5a28a3,_0x170113){return client[_0xbf0d('0xf')](_0x154401,_0x55cb8f)[_0xbf0d('0x10')](function(_0x290a56){logger[_0xbf0d('0x11')](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));logger[_0xbf0d('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xb7715f,_0xbf0d('0x13'),JSON[_0xbf0d('0x15')](_0x290a56));if(_0x290a56['error']){if(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x17')]===0x1f4){logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x170113(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x5a28a3(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}else{logger['info'](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));_0x5a28a3(_0x290a56[_0xbf0d('0x19')][_0xbf0d('0x18')]);}})[_0xbf0d('0x1a')](function(_0x35166e){logger[_0xbf0d('0x16')]('ChatGroup,\x20%s,\x20%s',_0xb7715f,_0x35166e);_0x170113(_0x35166e);});});} \ No newline at end of file +var _0x2123=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','register','request','then'];(function(_0xbc8ef0,_0x1b6933){var _0x53cf0e=function(_0x281982){while(--_0x281982){_0xbc8ef0['push'](_0xbc8ef0['shift']());}};_0x53cf0e(++_0x1b6933);}(_0x2123,0x190));var _0x3212=function(_0x29a1e9,_0xd2ea28){_0x29a1e9=_0x29a1e9-0x0;var _0x224e7f=_0x2123[_0x29a1e9];return _0x224e7f;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));var BPromise=require(_0x3212('0x3'));var rs=require(_0x3212('0x4'));var fs=require('fs');var Redis=require(_0x3212('0x5'));var db=require(_0x3212('0x6'))['db'];var utils=require(_0x3212('0x7'));var logger=require(_0x3212('0x8'))(_0x3212('0x9'));var config=require(_0x3212('0xa'));var jayson=require(_0x3212('0xb'));var client=jayson['client'][_0x3212('0xc')]({'port':0x232a});config[_0x3212('0xd')]=_[_0x3212('0xe')](config['redis'],{'host':_0x3212('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3212('0xd')]));require(_0x3212('0x10'))[_0x3212('0x11')](socket);function respondWithRpcPromise(_0x1db498,_0x54f331,_0x4a46c2){return new BPromise(function(_0x3a1f28,_0xf166c2){return client[_0x3212('0x12')](_0x1db498,_0x4a46c2)[_0x3212('0x13')](function(_0x9c01c3){logger[_0x3212('0x14')](_0x3212('0x15'),_0x54f331,_0x3212('0x16'));logger[_0x3212('0x17')](_0x3212('0x18'),_0x54f331,_0x3212('0x16'),JSON[_0x3212('0x19')](_0x9c01c3));if(_0x9c01c3[_0x3212('0x1a')]){if(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1b')]===0x1f4){logger[_0x3212('0x1a')](_0x3212('0x15'),_0x54f331,_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);return _0xf166c2(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);}logger[_0x3212('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x54f331,_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);return _0x3a1f28(_0x9c01c3[_0x3212('0x1a')][_0x3212('0x1c')]);}else{logger[_0x3212('0x14')](_0x3212('0x15'),_0x54f331,_0x3212('0x16'));_0x3a1f28(_0x9c01c3['result']['message']);}})[_0x3212('0x1d')](function(_0x49f5c2){logger[_0x3212('0x1a')](_0x3212('0x15'),_0x54f331,_0x49f5c2);_0xf166c2(_0x49f5c2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8187890..0be02eb 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 _0x88c6=['chatGroup:','./chatGroup.events','save','update','emit','length'];(function(_0x23dbc3,_0x22d7ae){var _0x5cb9db=function(_0x2cddf7){while(--_0x2cddf7){_0x23dbc3['push'](_0x23dbc3['shift']());}};_0x5cb9db(++_0x22d7ae);}(_0x88c6,0x121));var _0x688c=function(_0x5d67be,_0x73cb7){_0x5d67be=_0x5d67be-0x0;var _0x4ce27a=_0x88c6[_0x5d67be];return _0x4ce27a;};'use strict';var ChatGroupEvents=require(_0x688c('0x0'));var events=[_0x688c('0x1'),'remove',_0x688c('0x2')];function createListener(_0x28e51d,_0x49dfed){return function(_0x1a0d63){_0x49dfed[_0x688c('0x3')](_0x28e51d,_0x1a0d63);};}function removeListener(_0x5b0225,_0x6b40af){return function(){ChatGroupEvents['removeListener'](_0x5b0225,_0x6b40af);};}exports['register']=function(_0x21f689){for(var _0xbb7e41=0x0,_0x3b6140=events[_0x688c('0x4')];_0xbb7e41<_0x3b6140;_0xbb7e41++){var _0x9c2932=events[_0xbb7e41];var _0x426bb8=createListener(_0x688c('0x5')+_0x9c2932,_0x21f689);ChatGroupEvents['on'](_0x9c2932,_0x426bb8);}}; \ No newline at end of file +var _0x5e63=['emit','removeListener','register','chatGroup:','./chatGroup.events','remove','update'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x5e63,0x82));var _0x35e6=function(_0x404d14,_0x57e3c3){_0x404d14=_0x404d14-0x0;var _0x134ef5=_0x5e63[_0x404d14];return _0x134ef5;};'use strict';var ChatGroupEvents=require(_0x35e6('0x0'));var events=['save',_0x35e6('0x1'),_0x35e6('0x2')];function createListener(_0x54eac2,_0x46a84b){return function(_0x40cf76){_0x46a84b[_0x35e6('0x3')](_0x54eac2,_0x40cf76);};}function removeListener(_0x2531ae,_0x55b3fa){return function(){ChatGroupEvents[_0x35e6('0x4')](_0x2531ae,_0x55b3fa);};}exports[_0x35e6('0x5')]=function(_0x19617c){for(var _0x2c4833=0x0,_0x4796f1=events['length'];_0x2c4833<_0x4796f1;_0x2c4833++){var _0x23f3a1=events[_0x2c4833];var _0x243fee=createListener(_0x35e6('0x6')+_0x23f3a1,_0x19617c);ChatGroupEvents['on'](_0x23f3a1,_0x243fee);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e9199ce..2c02d70 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 _0xfc14=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','update','delete','removeMembers','multer'];(function(_0x1e2aae,_0x2349e3){var _0x4d8a43=function(_0x305d4c){while(--_0x305d4c){_0x1e2aae['push'](_0x1e2aae['shift']());}};_0x4d8a43(++_0x2349e3);}(_0xfc14,0x8b));var _0x4fc1=function(_0x1a59ba,_0x2b4ec3){_0x1a59ba=_0x1a59ba-0x0;var _0x3b11bb=_0xfc14[_0x1a59ba];return _0x3b11bb;};'use strict';var multer=require(_0x4fc1('0x0'));var util=require('util');var path=require(_0x4fc1('0x1'));var timeout=require(_0x4fc1('0x2'));var express=require(_0x4fc1('0x3'));var router=express[_0x4fc1('0x4')]();var fs_extra=require(_0x4fc1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4fc1('0x6'));var config=require(_0x4fc1('0x7'));var controller=require(_0x4fc1('0x8'));router[_0x4fc1('0x9')]('/',auth['isAuthenticated'](),controller[_0x4fc1('0xa')]);router[_0x4fc1('0x9')](_0x4fc1('0xb'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0xd')]);router['get'](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0xf')]);router[_0x4fc1('0x9')](_0x4fc1('0x10'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x11')]);router[_0x4fc1('0x9')](_0x4fc1('0x12'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x13')]);router[_0x4fc1('0x9')](_0x4fc1('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0x4fc1('0x15')]('/',auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x16')]);router[_0x4fc1('0x15')](_0x4fc1('0x12'),auth['isAuthenticated'](),controller[_0x4fc1('0x17')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x4fc1('0x18')]);router['put'](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x19')]);router[_0x4fc1('0x1a')](_0x4fc1('0xe'),auth[_0x4fc1('0xc')](),controller['destroy']);router['delete']('/:id/members',auth[_0x4fc1('0xc')](),controller[_0x4fc1('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x57a5=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','destroy','delete','removeMembers','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x57a5,0x1e6));var _0x557a=function(_0x3d486f,_0x13af81){_0x3d486f=_0x3d486f-0x0;var _0x3af020=_0x57a5[_0x3d486f];return _0x3af020;};'use strict';var multer=require(_0x557a('0x0'));var util=require(_0x557a('0x1'));var path=require(_0x557a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x557a('0x3')]();var fs_extra=require(_0x557a('0x4'));var auth=require(_0x557a('0x5'));var interaction=require(_0x557a('0x6'));var config=require(_0x557a('0x7'));var controller=require(_0x557a('0x8'));router[_0x557a('0x9')]('/',auth[_0x557a('0xa')](),controller[_0x557a('0xb')]);router['get'](_0x557a('0xc'),auth[_0x557a('0xa')](),controller[_0x557a('0xd')]);router[_0x557a('0x9')](_0x557a('0xe'),auth[_0x557a('0xa')](),controller['show']);router['get'](_0x557a('0xf'),auth['isAuthenticated'](),controller[_0x557a('0x10')]);router[_0x557a('0x9')](_0x557a('0x11'),auth[_0x557a('0xa')](),controller[_0x557a('0x12')]);router[_0x557a('0x9')](_0x557a('0x13'),auth[_0x557a('0xa')](),controller['getMessages']);router[_0x557a('0x14')]('/',auth[_0x557a('0xa')](),controller[_0x557a('0x15')]);router[_0x557a('0x14')](_0x557a('0x11'),auth[_0x557a('0xa')](),controller[_0x557a('0x16')]);router['post']('/:id/messages',auth[_0x557a('0xa')](),controller[_0x557a('0x17')]);router[_0x557a('0x18')](_0x557a('0xe'),auth[_0x557a('0xa')](),controller[_0x557a('0x19')]);router['delete'](_0x557a('0xe'),auth[_0x557a('0xa')](),controller[_0x557a('0x1a')]);router[_0x557a('0x1b')](_0x557a('0x11'),auth[_0x557a('0xa')](),controller[_0x557a('0x1c')]);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 f3e3c40..010ee2f 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 _0x05b6=['thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x4bb12b,_0x5697df){var _0x2baa7c=function(_0x2e7f4e){while(--_0x2e7f4e){_0x4bb12b['push'](_0x4bb12b['shift']());}};_0x2baa7c(++_0x5697df);}(_0x05b6,0x74));var _0x605b=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0x05b6[_0x2eac4f];return _0x58f73b;};'use strict';var Sequelize=require(_0x605b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x605b('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x605b('0x2')]},'ratingType':{'type':Sequelize[_0x605b('0x3')](_0x605b('0x4'),_0x605b('0x5')),'defaultValue':_0x605b('0x4')},'ratingMessage':{'type':Sequelize[_0x605b('0x6')]},'pathTranscript':{'type':Sequelize[_0x605b('0x6')]},'mailTranscript':{'type':Sequelize[_0x605b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x605b('0x8')]},'disposition':{'type':Sequelize[_0x605b('0x7')]},'secondDisposition':{'type':Sequelize[_0x605b('0x7')]},'thirdDisposition':{'type':Sequelize[_0x605b('0x7')]},'note':{'type':Sequelize[_0x605b('0x7')]},'browserName':{'type':Sequelize[_0x605b('0x7')]},'browserVersion':{'type':Sequelize[_0x605b('0x7')]},'osName':{'type':Sequelize[_0x605b('0x7')]},'osVersion':{'type':Sequelize[_0x605b('0x7')]},'deviceModel':{'type':Sequelize[_0x605b('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x605b('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x605b('0x9'))},'read1stAt':{'type':Sequelize[_0x605b('0x8')]},'lastMsgAt':{'type':Sequelize[_0x605b('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x605b('0x3')]('in',_0x605b('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x605b('0x7')]},'customerPort':{'type':Sequelize[_0x605b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x605b('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x605b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0102=['TEXT','long','out','exports','BOOLEAN','INTEGER','ENUM','STRING','DATE'];(function(_0x3bed75,_0x2f400f){var _0x2e4147=function(_0x380079){while(--_0x380079){_0x3bed75['push'](_0x3bed75['shift']());}};_0x2e4147(++_0x2f400f);}(_0x0102,0x186));var _0x2010=function(_0xa88fb3,_0x2fd1d2){_0xa88fb3=_0xa88fb3-0x0;var _0x35270a=_0x0102[_0xa88fb3];return _0x35270a;};'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 diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 79a3618..549faa8 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 _0x67be=['localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','name','render','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','filters','intersection','fields','attributes','includeAll','include','merge','options','create','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','follow','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','attachmentDownload','closed','Attachment','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ContactId','length','format','%s%d','agentAlias','System','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','hasOwnProperty','sort','where','pick','ChatInteractionId','filter','$gte','rows','getMyMessages','order','includeAgent','push','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','toString','server','tmp','transcript-%d-%s.zip','firstName','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','defaults','redis'];(function(_0x597fc3,_0x39517c){var _0x2235f4=function(_0x2596f2){while(--_0x2596f2){_0x597fc3['push'](_0x597fc3['shift']());}};_0x2235f4(++_0x39517c);}(_0x67be,0x18a));var _0xe67b=function(_0x40ceb1,_0x970175){_0x40ceb1=_0x40ceb1-0x0;var _0x264e28=_0x67be[_0x40ceb1];return _0x264e28;};'use strict';var rimraf=require(_0xe67b('0x0'));var zipdir=require(_0xe67b('0x1'));var rp=require(_0xe67b('0x2'));var moment=require(_0xe67b('0x3'));var BPromise=require(_0xe67b('0x4'));var Mustache=require(_0xe67b('0x5'));var util=require('util');var path=require(_0xe67b('0x6'));var ejs=require(_0xe67b('0x7'));var fs=require('fs');var _=require(_0xe67b('0x8'));var Redis=require(_0xe67b('0x9'));var interaction=require(_0xe67b('0xa'));var qs=require(_0xe67b('0xb'));var pdf=require(_0xe67b('0xc'));var logger=require('../../config/logger')(_0xe67b('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe67b('0xe')](config[_0xe67b('0xf')],{'host':_0xe67b('0x10'),'port':0x18eb});var socket=require(_0xe67b('0x11'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xe67b('0x12')](socket);var jayson=require(_0xe67b('0x13'));var client=jayson['client'][_0xe67b('0x14')]({'port':0x232b});var client9004=jayson[_0xe67b('0x15')][_0xe67b('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x4f9b01,_0x23764d,_0x31b5d2,_0x21eea5){return new BPromise(function(_0x474714,_0x205609){var _0x3da1fd=_0x21eea5||client;return _0x3da1fd[_0xe67b('0x16')](_0x4f9b01,_0x31b5d2)[_0xe67b('0x17')](function(_0x23a583){logger[_0xe67b('0x18')](_0xe67b('0x19'),_0x23764d,_0xe67b('0x1a'));logger[_0xe67b('0x1b')](_0xe67b('0x1c'),_0x23764d,_0xe67b('0x1a'),JSON[_0xe67b('0x1d')](_0x23a583));if(_0x23a583[_0xe67b('0x1e')]){if(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x1f')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x23764d,_0x23a583['error'][_0xe67b('0x20')]);return _0x205609(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);}logger[_0xe67b('0x1e')](_0xe67b('0x19'),_0x23764d,_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);return _0x474714(_0x23a583[_0xe67b('0x1e')][_0xe67b('0x20')]);}else{logger[_0xe67b('0x18')](_0xe67b('0x19'),_0x23764d,_0xe67b('0x1a'));_0x474714(_0x23a583[_0xe67b('0x21')]['message']);}})[_0xe67b('0x22')](function(_0x124e97){logger[_0xe67b('0x1e')](_0xe67b('0x19'),_0x23764d,_0x124e97);_0x205609(_0x124e97);});});}function respondWithStatusCode(_0x4f0f4b,_0x307518){_0x307518=_0x307518||0xcc;return function(_0x5dca44){if(_0x5dca44){return _0x4f0f4b[_0xe67b('0x23')](_0x307518);}return _0x4f0f4b[_0xe67b('0x24')](_0x307518)[_0xe67b('0x25')]();};}function respondWithResult(_0x5d787b,_0x41e571){_0x41e571=_0x41e571||0xc8;return function(_0x4474e7){if(_0x4474e7){return _0x5d787b['status'](_0x41e571)[_0xe67b('0x26')](_0x4474e7);}};}function respondWithFilteredResult(_0x324cad,_0x1c161f){return function(_0x1ce67f){if(_0x1ce67f){var _0x3ca2a0=typeof _0x1c161f[_0xe67b('0x27')]===_0xe67b('0x28')&&typeof _0x1c161f[_0xe67b('0x29')]===_0xe67b('0x28');var _0x2e6b28=_0x1ce67f[_0xe67b('0x2a')];var _0x241ac4=_0x3ca2a0?0x0:_0x1c161f[_0xe67b('0x27')];var _0x4886cf=_0x3ca2a0?_0x1ce67f[_0xe67b('0x2a')]:_0x1c161f[_0xe67b('0x27')]+_0x1c161f[_0xe67b('0x29')];var _0x856f25;if(_0x4886cf>=_0x2e6b28){_0x4886cf=_0x2e6b28;_0x856f25=0xc8;}else{_0x856f25=0xce;}_0x324cad['status'](_0x856f25);return _0x324cad[_0xe67b('0x2b')](_0xe67b('0x2c'),_0x241ac4+'-'+_0x4886cf+'/'+_0x2e6b28)[_0xe67b('0x26')](_0x1ce67f);}return null;};}function saveUpdates(_0x56b088){return function(_0x1f56fa){if(_0x1f56fa){return _0x1f56fa[_0xe67b('0x2d')](_0x56b088)['then'](function(_0x36d272){return _0x36d272;});}return null;};}function removeEntity(_0x106019){return function(_0x65a1aa){if(_0x65a1aa){return _0x65a1aa['destroy']()[_0xe67b('0x17')](function(){_0x106019[_0xe67b('0x24')](0xcc)[_0xe67b('0x25')]();});}};}function handleEntityNotFound(_0x3125f4){return function(_0x140633){if(!_0x140633){_0x3125f4[_0xe67b('0x23')](0x194);}return _0x140633;};}function handleError(_0x2bf3a7,_0x437b52){_0x437b52=_0x437b52||0x1f4;return function(_0x5dce04){logger[_0xe67b('0x1e')](_0x5dce04['stack']);if(_0x5dce04[_0xe67b('0x2e')]){delete _0x5dce04[_0xe67b('0x2e')];}_0x2bf3a7[_0xe67b('0x24')](_0x437b52)['send'](_0x5dce04);};}function getMustacheRender(_0x4994de,_0x165ce7){return Mustache[_0xe67b('0x2f')](_0x4994de,_['merge'](_0x165ce7[_0xe67b('0x30')],{'contact':_0x165ce7[_0xe67b('0x31')],'message':_0x165ce7[_0xe67b('0x20')],'agent':_0x165ce7[_0xe67b('0x32')],'interaction':_0x165ce7[_0xe67b('0x33')],'account':_0x165ce7[_0xe67b('0x34')]}))||'';}exports[_0xe67b('0x35')]=function(_0x30d40e,_0x2f406d){var _0x99a097={};var _0x9bd45a=_[_0xe67b('0x36')](db[_0xe67b('0x37')][_0xe67b('0x38')],function(_0x56bdcc){return{'name':_0x56bdcc[_0xe67b('0x39')],'type':_0x56bdcc[_0xe67b('0x3a')][_0xe67b('0x3b')]};});_0x99a097=qs[_0xe67b('0x3c')](_0x9bd45a,_0x30d40e);return interaction[_0xe67b('0x3d')](_0xe67b('0x3e'),_0x30d40e[_0xe67b('0x3f')],_0x30d40e[_0xe67b('0x40')],_0x99a097,_0x9bd45a)[_0xe67b('0x17')](respondWithFilteredResult(_0x2f406d,_0x99a097))[_0xe67b('0x22')](handleError(_0x2f406d,null));};exports[_0xe67b('0x41')]=function(_0x3f8447,_0x458bd1){var _0x531932={'raw':![],'where':{'id':_0x3f8447[_0xe67b('0x42')]['id']}},_0x5a2018={};_0x5a2018[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x37')]['rawAttributes']);_0x5a2018['query']=_[_0xe67b('0x44')](_0x3f8447[_0xe67b('0x3f')]);_0x5a2018[_0xe67b('0x45')]=_[_0xe67b('0x46')](_0x5a2018['model'],_0x5a2018[_0xe67b('0x3f')]);_0x531932['attributes']=_['intersection'](_0x5a2018[_0xe67b('0x43')],qs[_0xe67b('0x47')](_0x3f8447[_0xe67b('0x3f')]['fields']));_0x531932[_0xe67b('0x48')]=_0x531932[_0xe67b('0x48')]['length']?_0x531932['attributes']:_0x5a2018[_0xe67b('0x43')];if(_0x3f8447[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x531932[_0xe67b('0x4a')]=[{'all':!![]}];}_0x531932=_[_0xe67b('0x4b')]({},_0x531932,_0x3f8447[_0xe67b('0x4c')]);return db['ChatInteraction']['find'](_0x531932)[_0xe67b('0x17')](handleEntityNotFound(_0x458bd1,null))[_0xe67b('0x17')](respondWithResult(_0x458bd1,null))[_0xe67b('0x22')](handleError(_0x458bd1,null));};exports[_0xe67b('0x4d')]=function(_0x38a67d,_0x29c6f8){return db['ChatInteraction'][_0xe67b('0x4d')](_0x38a67d[_0xe67b('0x30')],{})['then'](respondWithResult(_0x29c6f8,0xc9))['catch'](handleError(_0x29c6f8,null));};exports[_0xe67b('0x2d')]=function(_0x2b1dcb,_0x480197){if(_0x2b1dcb['body']['id']){delete _0x2b1dcb['body']['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x2b1dcb['params']['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x480197,null))[_0xe67b('0x17')](saveUpdates(_0x2b1dcb[_0xe67b('0x30')],null))['then'](respondWithResult(_0x480197,null))[_0xe67b('0x22')](handleError(_0x480197,null));};exports[_0xe67b('0x4f')]=function(_0x1a6f03,_0x434e03){return db[_0xe67b('0x37')]['find']({'where':{'id':_0x1a6f03[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x434e03,null))[_0xe67b('0x17')](removeEntity(_0x434e03,null))[_0xe67b('0x22')](handleError(_0x434e03,null));};exports[_0xe67b('0x50')]=function(_0x2e6c0b,_0x27c729){return db[_0xe67b('0x37')][_0xe67b('0x50')]()[_0xe67b('0x17')](respondWithResult(_0x27c729,null))[_0xe67b('0x22')](handleError(_0x27c729,null));};exports[_0xe67b('0x51')]=function(_0x4c5255,_0x1672f7){var _0x22f0c8=_0x4c5255[_0xe67b('0x42')]['id'];var _0x2630f4;var _0x56e46c;var _0x770eed;return db['ChatInteraction'][_0xe67b('0x52')]({'where':{'id':_0x22f0c8}})[_0xe67b('0x17')](function(_0x57529f){_0x2630f4=_0x57529f;return db[_0xe67b('0x53')][_0xe67b('0x52')]({'where':{'id':_0x57529f[_0xe67b('0x54')]},'attributes':['id',_0xe67b('0x55'),_0xe67b('0x56'),_0xe67b('0x57'),_0xe67b('0x58'),_0xe67b('0x59')],'raw':!![]});})[_0xe67b('0x17')](function(_0x2657dc){if(_0x2657dc&&_0x2657dc[_0xe67b('0x55')]&&_0x2657dc[_0xe67b('0x56')]){_0x56e46c=_0x2657dc;var _0x3301a1={'interaction':{'id':_0x22f0c8},'agent':{'id':_0x4c5255[_0xe67b('0x40')]['id'],'name':_0x4c5255[_0xe67b('0x40')][_0xe67b('0x2e')],'fullname':_0x4c5255[_0xe67b('0x40')][_0xe67b('0x5a')],'email':_0x4c5255[_0xe67b('0x40')]['email']},'contact':_0x4c5255['body'][_0xe67b('0x31')],'account':_0x4c5255['body'][_0xe67b('0x34')]};var _0x14f37a={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2657dc[_0xe67b('0x55')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4c5255[_0xe67b('0x40')][_0xe67b('0x5b')]],'buttons':null,'topic':_0x56e46c[_0xe67b('0x57')],'note':_['isNull'](_0x56e46c[_0xe67b('0x58')])?null:getMustacheRender(_0x56e46c['vidaooNote'],_0x3301a1),'metadata':null},'redirect':_0xe67b('0x5c'),'json':!![]};try{if(!_[_0xe67b('0x5d')](_0x56e46c[_0xe67b('0x59')])){var _0x4491b8=getMustacheRender(_0x56e46c[_0xe67b('0x59')],_0x3301a1);var _0x443709=JSON[_0xe67b('0x5e')](_0x4491b8);_0x14f37a['body'][_0xe67b('0x5f')]=_0x443709;}}catch(_0x372eaf){throw new db[(_0xe67b('0x60'))][(_0xe67b('0x61'))](_0xe67b('0x62'));}return rp(_0x14f37a);}else{throw new db[(_0xe67b('0x60'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe67b('0x17')](function(_0xf21b79){_0x770eed=_0xf21b79;if(_0x770eed['id']){var _0x2c3a01={'body':_0x770eed[_0xe67b('0x63')],'ChatWebsiteId':_0x56e46c['id'],'ChatInteractionId':_0x2630f4['id'],'direction':_0xe67b('0x64'),'UserId':_0x4c5255[_0xe67b('0x40')]['id']};return db['ChatMessage'][_0xe67b('0x4d')](_0x2c3a01,{});}else{throw new db[(_0xe67b('0x60'))][(_0xe67b('0x61'))](_0xe67b('0x65'));}})[_0xe67b('0x17')](function(){return _0x2630f4[_0xe67b('0x66')]({'vidaooSessionId':_0x770eed['id']});})[_0xe67b('0x17')](respondWithResult(_0x1672f7,null))[_0xe67b('0x22')](handleError(_0x1672f7,null));};exports['customUpdate']=function(_0x227d1f,_0x4fbfef){if(_0x227d1f[_0xe67b('0x30')]['id']){delete _0x227d1f[_0xe67b('0x30')]['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x227d1f['params']['id']},'include':[{'model':db[_0xe67b('0x67')],'as':_0xe67b('0x68')}]})[_0xe67b('0x17')](handleEntityNotFound(_0x4fbfef,null))[_0xe67b('0x17')](saveUpdates(_0x227d1f['body'],null))['then'](respondWithResult(_0x4fbfef,null))[_0xe67b('0x22')](handleError(_0x4fbfef,null));};exports['abandon']=function(_0x590270,_0x1267c3){if(_0x590270[_0xe67b('0x30')]['id']){delete _0x590270[_0xe67b('0x30')]['id'];}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x590270[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](function(_0x40af89){if(!_0x40af89){logger[_0xe67b('0x1e')](_0xe67b('0x69'),'abandon',0x194,_0xe67b('0x6a'));_0x1267c3[_0xe67b('0x23')](0x194);}else{if(_0x40af89[_0xe67b('0x6b')]){throw new db['Sequelize'][(_0xe67b('0x61'))](_0xe67b('0x6c'));}}return _0x40af89;})[_0xe67b('0x17')](function(_0x2a71aa){if(_0x2a71aa){return _0x2a71aa[_0xe67b('0x2d')]({'closed':_0x590270[_0xe67b('0x30')]['closed'],'disposition':_0x590270[_0xe67b('0x30')][_0xe67b('0x6d')]})[_0xe67b('0x17')](function(_0xe2534c){return _0xe2534c;});}})[_0xe67b('0x17')](function(){return respondWithRpcPromise(_0xe67b('0x6e'),_0xe67b('0x6f'),_0x590270[_0xe67b('0x30')],client9004);})['then'](respondWithResult(_0x1267c3,null))['catch'](handleError(_0x1267c3,null));};exports[_0xe67b('0x70')]=function(_0x45a10f,_0x312377){_0x45a10f[_0xe67b('0x30')][_0xe67b('0x2e')]=_0x45a10f[_0xe67b('0x71')][_0xe67b('0x72')];_0x45a10f[_0xe67b('0x30')][_0xe67b('0x73')]=_0x45a10f['file']['filename'];_0x45a10f[_0xe67b('0x30')]['type']=_0x45a10f[_0xe67b('0x71')]['mimetype'];return db['Attachment']['create'](_0x45a10f[_0xe67b('0x30')])[_0xe67b('0x17')](respondWithResult(_0x312377,0xc9))['catch'](handleError(_0x312377,null));};exports[_0xe67b('0x74')]=function(_0x23723d,_0x3c8eaa){return db[_0xe67b('0x37')][_0xe67b('0x52')]({'where':{'id':_0x23723d[_0xe67b('0x42')]['id']},'raw':!![]})[_0xe67b('0x17')](handleEntityNotFound(_0x3c8eaa,null))['then'](function(_0x19dafc){if(_0x19dafc){if(_0x19dafc[_0xe67b('0x75')]){return _0x3c8eaa[_0xe67b('0x24')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xe67b('0x76')][_0xe67b('0x52')]({'where':{'id':_0x23723d[_0xe67b('0x3f')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x3c8eaa,null));}})[_0xe67b('0x17')](function(_0x45d39f){if(_0x45d39f){var _0x5f4f56=_0x45d39f[_0xe67b('0x77')]!==null;var _0x50c8cb=path[_0xe67b('0x78')](config['root'],'server/files/attachments/');if(_0x5f4f56){_0x50c8cb=path[_0xe67b('0x78')](_0x50c8cb,_0xe67b('0x79'));}var _0xab5acd=path[_0xe67b('0x78')](_0x50c8cb,_0x45d39f[_0xe67b('0x73')]);return _0x3c8eaa[_0xe67b('0x7a')](_0xab5acd);}})[_0xe67b('0x22')](handleError(_0x3c8eaa,null));};exports[_0xe67b('0x7b')]=function(_0x16d8b7,_0x87bc10){var _0x516450=null;var _0x72bba3=null;var _0x43d47c=null;if(_0x16d8b7['body']['id']){delete _0x16d8b7[_0xe67b('0x30')]['id'];}if(_0x16d8b7[_0xe67b('0x30')][_0xe67b('0x7c')]){_0x43d47c=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],'server/files/chat/upload/',util['format'](_0xe67b('0x7e'),Date[_0xe67b('0x7f')]()));_0x16d8b7['body'][_0xe67b('0x80')]=_0x43d47c;}return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x16d8b7[_0xe67b('0x42')]['id']},'include':[{'model':db[_0xe67b('0x81')],'as':_0xe67b('0x82'),'include':[{'model':db['User'],'as':_0xe67b('0x83')}]}]})[_0xe67b('0x17')](handleEntityNotFound(_0x87bc10,null))[_0xe67b('0x17')](saveUpdates(_0x16d8b7[_0xe67b('0x30')],null))[_0xe67b('0x17')](function(_0x1a348c){if(_0x1a348c){_0x516450=_0x1a348c;return db['ChatWebsite'][_0xe67b('0x4e')]({'where':{'id':_0x516450[_0xe67b('0x54')]}});}})[_0xe67b('0x17')](function(_0x482fd4){if(_0x482fd4){_0x72bba3=_0x482fd4;return db['CmContact'][_0xe67b('0x4e')]({'where':{'id':_0x516450[_0xe67b('0x84')]}});}})[_0xe67b('0x17')](function(_0x4106c7){if(_0x4106c7){if(_0x43d47c){var _0x373f13=null;for(var _0x11a004=0x1;_0x11a004<_0x516450['Messages'][_0xe67b('0x85')];++_0x11a004){_0x373f13=_0x516450[_0xe67b('0x82')][_0x11a004];var _0x5a15f2=_0x373f13['UserId']?util[_0xe67b('0x86')](_0xe67b('0x87'),_0x72bba3[_0xe67b('0x88')],_0x373f13[_0xe67b('0x6b')]):_0xe67b('0x89');var _0x5becfb=_0x16d8b7[_0xe67b('0x30')]['customer']||util[_0xe67b('0x86')](_0xe67b('0x87'),'Visitor',_0x373f13[_0xe67b('0x84')]);switch(_0x72bba3[_0xe67b('0x8a')]){case'website_alias':_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?util[_0xe67b('0x86')]('%s%d',_0x72bba3['agentAlias'],_0x373f13[_0xe67b('0x6b')]):_0xe67b('0x89');break;case _0xe67b('0x8b'):_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?_0x373f13[_0xe67b('0x83')][_0xe67b('0x8c')]||_0x373f13['User'][_0xe67b('0x5a')]:_0xe67b('0x89');break;case'agent_fullname':_0x5a15f2=_0x373f13['UserId']?_0x373f13[_0xe67b('0x83')][_0xe67b('0x5a')]:'System';break;default:_0x5a15f2=_0x373f13[_0xe67b('0x6b')]?util[_0xe67b('0x86')]('%s%d',_0x72bba3[_0xe67b('0x88')],_0x373f13['UserId']):'System';}var _0x1d06c6=util['format'](_0xe67b('0x8d'),moment(_0x373f13[_0xe67b('0x8e')])[_0xe67b('0x86')](_0xe67b('0x8f')),_0x373f13[_0xe67b('0x90')]==='in'?_0x5becfb:_0x5a15f2,_0x373f13[_0xe67b('0x30')]);if(!_0x373f13[_0xe67b('0x91')]){fs[_0xe67b('0x92')](_0x43d47c,_0x1d06c6);}}return db[_0xe67b('0x93')][_0xe67b('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0xe67b('0x94')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe67b('0x95')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x3b8902){if(!_0x3b8902||!_0x3b8902[_0xe67b('0x96')]||!_0x16d8b7[_0xe67b('0x30')])return _0x516450;var _0x42ef75=_0x3b8902[_0xe67b('0x97')]();return respondWithRpcPromise(_0xe67b('0x98'),'sendMail',{'account':_0x42ef75,'message':{'from':util[_0xe67b('0x86')]('\x22%s\x22\x20<%s>',_0x3b8902[_0xe67b('0x2e')],_0x3b8902[_0xe67b('0x5b')]||_0x3b8902['Smtp'][_0xe67b('0x40')]),'to':_0x16d8b7[_0xe67b('0x30')]['mailTranscript'],'subject':_0xe67b('0x99'),'text':util[_0xe67b('0x86')](_0xe67b('0x9a'),_0x16d8b7['body'][_0xe67b('0x7c')]),'attachments':[{'path':_0x43d47c}]}})[_0xe67b('0x17')](function(){return _0x516450;})[_0xe67b('0x22')](function(_0x25c78b){logger[_0xe67b('0x1e')](_0x25c78b);});})[_0xe67b('0x17')](respondWithStatusCode(_0x87bc10,0xc8))[_0xe67b('0x22')](handleError(_0x87bc10,null));};exports[_0xe67b('0x9b')]=function(_0x55ec55,_0x48a002){return db[_0xe67b('0x81')][_0xe67b('0x4e')]({'where':{'id':_0x55ec55[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x48a002,null))[_0xe67b('0x17')](function(_0x59b165){if(_0x59b165){return _0x59b165[_0xe67b('0x9b')](_0x55ec55[_0xe67b('0x30')]['ids'],_[_0xe67b('0x9c')](_0x55ec55['body'],[_0xe67b('0x9d'),'id'])||{});}})[_0xe67b('0x17')](respondWithResult(_0x48a002,null))['catch'](handleError(_0x48a002,null));};exports[_0xe67b('0x9e')]=function(_0x1be6ed,_0x44f236){var _0x4a304e={'raw':![],'where':{}};var _0x5c959f={};var _0x32fb0b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe67b('0x52')]({'where':{'id':_0x1be6ed['params']['id']}})['then'](handleEntityNotFound(_0x44f236,null))['then'](function(_0x41a12e){if(_0x41a12e){_0x5c959f[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x81')][_0xe67b('0x38')]);_0x5c959f[_0xe67b('0x3f')]=_[_0xe67b('0x44')](_0x1be6ed[_0xe67b('0x3f')]);_0x5c959f['filters']=_[_0xe67b('0x46')](_0x5c959f[_0xe67b('0x43')],_0x5c959f['query']);_0x4a304e[_0xe67b('0x48')]=_['intersection'](_0x5c959f['model'],qs['fields'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x47')]));_0x4a304e[_0xe67b('0x48')]=_0x4a304e[_0xe67b('0x48')][_0xe67b('0x85')]?_0x4a304e[_0xe67b('0x48')]:_0x5c959f[_0xe67b('0x43')];if(!_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x9f')]('nolimit')){_0x4a304e[_0xe67b('0x29')]=qs['limit'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x29')]);_0x4a304e[_0xe67b('0x27')]=qs['offset'](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x27')]);}_0x4a304e['order']=qs[_0xe67b('0xa0')](_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa0')]);_0x4a304e[_0xe67b('0xa1')]=qs[_0xe67b('0x45')](_[_0xe67b('0xa2')](_0x1be6ed[_0xe67b('0x3f')],_0x5c959f[_0xe67b('0x45')]));_0x4a304e[_0xe67b('0xa1')][_0xe67b('0xa3')]=_0x41a12e['id'];if(_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa4')]){_0x4a304e[_0xe67b('0xa1')]=_[_0xe67b('0x4b')](_0x4a304e[_0xe67b('0xa1')],{'$or':_[_0xe67b('0x36')](_0x4a304e[_0xe67b('0x48')],function(_0x595ffd){var _0x351d7f={};_0x351d7f[_0x595ffd]={'$like':'%'+_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0xa4')]+'%'};return _0x351d7f;})});}if(_0x1be6ed[_0xe67b('0x3f')]['$gte']){var _0x3f5218=_0x1be6ed['query'][_0xe67b('0xa5')]['split'](',');var _0x5d1164={};_0x5d1164[_0x3f5218[0x0]]={'$gte':moment(_0x3f5218[0x1])[_0xe67b('0x86')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4a304e[_0xe67b('0xa1')]=_['merge'](_0x4a304e['where'],_0x5d1164);}_0x4a304e=_[_0xe67b('0x4b')]({},_0x4a304e,_0x1be6ed[_0xe67b('0x4c')]);return db[_0xe67b('0x81')][_0xe67b('0x2a')]({'where':_0x4a304e[_0xe67b('0xa1')]})[_0xe67b('0x17')](function(_0x41d5ec){_0x32fb0b[_0xe67b('0x2a')]=_0x41d5ec;if(_0x1be6ed[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x4a304e[_0xe67b('0x4a')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4a304e);})['then'](function(_0x5a092b){_0x32fb0b[_0xe67b('0xa6')]=_0x5a092b;return _0x32fb0b;});}})[_0xe67b('0x17')](respondWithFilteredResult(_0x44f236,_0x4a304e))[_0xe67b('0x22')](handleError(_0x44f236,null));};exports[_0xe67b('0xa7')]=function(_0x1f823d,_0x134851){var _0x3cbb89={'where':{}},_0x26d1ab={},_0x7b3cbd={'count':0x0,'rows':[]};return db[_0xe67b('0x37')]['findOne']({'where':{'id':_0x1f823d[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x134851,null))[_0xe67b('0x17')](function(_0x266450){if(_0x266450){_0x26d1ab[_0xe67b('0x43')]=_[_0xe67b('0x44')](db[_0xe67b('0x81')][_0xe67b('0x38')]);_0x26d1ab[_0xe67b('0x3f')]=_[_0xe67b('0x44')](_0x1f823d['query']);_0x26d1ab['filters']=_[_0xe67b('0x46')](_0x26d1ab[_0xe67b('0x43')],_0x26d1ab[_0xe67b('0x3f')]);_0x3cbb89[_0xe67b('0x48')]=_['intersection'](_0x26d1ab[_0xe67b('0x43')],qs[_0xe67b('0x47')](_0x1f823d[_0xe67b('0x3f')]['fields']));_0x3cbb89['attributes']=_0x3cbb89['attributes'][_0xe67b('0x85')]?_0x3cbb89['attributes']:_0x26d1ab['model'];if(!_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x9f')]('nolimit')){_0x3cbb89[_0xe67b('0x29')]=qs[_0xe67b('0x29')](_0x1f823d[_0xe67b('0x3f')]['limit']);_0x3cbb89[_0xe67b('0x27')]=qs[_0xe67b('0x27')](_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x27')]);}_0x3cbb89[_0xe67b('0xa8')]=qs[_0xe67b('0xa0')](_0x1f823d[_0xe67b('0x3f')][_0xe67b('0xa0')]);_0x3cbb89[_0xe67b('0xa1')]=qs[_0xe67b('0x45')](_[_0xe67b('0xa2')](_0x1f823d['query'],_0x26d1ab[_0xe67b('0x45')]));_0x3cbb89[_0xe67b('0xa1')][_0xe67b('0xa3')]=_0x266450['id'];if(_0x1f823d[_0xe67b('0x3f')][_0xe67b('0xa4')]){_0x3cbb89[_0xe67b('0xa1')]=_[_0xe67b('0x4b')](_0x3cbb89[_0xe67b('0xa1')],{'$or':_[_0xe67b('0x36')](_0x3cbb89[_0xe67b('0x48')],function(_0x5b7119){var _0x1eb116={};_0x1eb116[_0x5b7119]={'$like':'%'+_0x1f823d['query'][_0xe67b('0xa4')]+'%'};return _0x1eb116;})});}_0x3cbb89['where']['secret']=![];if(_0x1f823d[_0xe67b('0x3f')]['id']){_0x3cbb89[_0xe67b('0xa1')]['id']={'$gt':_0x1f823d[_0xe67b('0x3f')]['id']};}_0x3cbb89=_[_0xe67b('0x4b')]({},_0x3cbb89,_0x1f823d[_0xe67b('0x4c')]);return db[_0xe67b('0x81')][_0xe67b('0x2a')]({'where':_0x3cbb89[_0xe67b('0xa1')]})[_0xe67b('0x17')](function(_0x398d14){_0x7b3cbd['count']=_0x398d14;_0x3cbb89[_0xe67b('0x4a')]=[];if(_0x1f823d['query'][_0xe67b('0xa9')]){_0x3cbb89[_0xe67b('0x4a')][_0xe67b('0xaa')]({'model':db['User'],'as':_0xe67b('0x83'),'attributes':['id','fullname',_0xe67b('0x8c')]});}if(_0x1f823d[_0xe67b('0x3f')][_0xe67b('0x49')]){_0x3cbb89[_0xe67b('0x4a')]=[{'all':!![]}];}return db[_0xe67b('0x81')][_0xe67b('0x3d')](_0x3cbb89);})['then'](function(_0xf1502e){_0x7b3cbd[_0xe67b('0xa6')]=_0xf1502e;return _0x7b3cbd;});}})['then'](respondWithFilteredResult(_0x134851,_0x3cbb89))[_0xe67b('0x22')](handleError(_0x134851,null));};exports[_0xe67b('0xab')]=function(_0x158724,_0x5ef299){return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x158724[_0xe67b('0x42')]['id']}})[_0xe67b('0x17')](handleEntityNotFound(_0x5ef299,null))[_0xe67b('0x17')](function(_0x5d25df){if(_0x5d25df){return _0x5d25df[_0xe67b('0xac')](_0x158724[_0xe67b('0x30')][_0xe67b('0x9d')],_[_0xe67b('0x9c')](_0x158724[_0xe67b('0x30')],[_0xe67b('0x9d'),'id'])||{})[_0xe67b('0xad')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe67b('0x2e'),_0xe67b('0xae')],'where':{'id':_0x158724[_0xe67b('0x30')]['ids']}});})[_0xe67b('0x17')](function(_0x385e6a){socket[_0xe67b('0xaf')](_0xe67b('0xb0'),{'id':Number(_0x158724[_0xe67b('0x42')]['id']),'tags':_0x385e6a||[]});return{'id':Number(_0x158724['params']['id']),'tags':_0x385e6a||[]};});}})['then'](respondWithResult(_0x5ef299,null))[_0xe67b('0x22')](handleError(_0x5ef299,null));};exports[_0xe67b('0xb1')]=function(_0x4ef5dd,_0x2f0e4b){return db['ChatInteraction'][_0xe67b('0x4e')]({'where':{'id':_0x4ef5dd[_0xe67b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f0e4b,null))[_0xe67b('0x17')](function(_0x51423c){if(_0x51423c){return _0x51423c[_0xe67b('0xb1')](_0x4ef5dd['query'][_0xe67b('0x9d')]);}})[_0xe67b('0x17')](respondWithStatusCode(_0x2f0e4b,null))[_0xe67b('0x22')](handleError(_0x2f0e4b,null));};exports[_0xe67b('0x7a')]=function(_0x3ecc1c,_0x1dcdee){var _0x465ee9=moment()['unix']()[_0xe67b('0xb2')]();var _0x50f55e=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),'files',_0xe67b('0xb4'));var _0x1deb01=path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),'files','attachments');var _0x136dc8=path[_0xe67b('0x78')](_0x50f55e,_0x465ee9);var _0x3802d7=util['format'](_0xe67b('0xb5'),_0x3ecc1c[_0xe67b('0x42')]['id'],_0x465ee9);var _0x5d3803=path[_0xe67b('0x78')](_0x50f55e,_0x3802d7);var _0x42a771=[];_0x42a771['push']({'model':db[_0xe67b('0x83')],'as':_0xe67b('0x83'),'attributes':['id',_0xe67b('0x5a')],'raw':!![]});_0x42a771[_0xe67b('0xaa')]({'model':db[_0xe67b('0x67')],'as':_0xe67b('0x68'),'attributes':['id',_0xe67b('0xb6'),'lastName'],'raw':!![]});if(_0x3ecc1c[_0xe67b('0x3f')]['attachments']){_0x42a771[_0xe67b('0xaa')]({'model':db[_0xe67b('0x76')],'as':'Attachment','raw':!![]});}var _0x4cb3e1=[{'model':db[_0xe67b('0x81')],'as':_0xe67b('0x82'),'attributes':['id',_0xe67b('0x30'),_0xe67b('0x8e'),_0xe67b('0x90'),_0xe67b('0x91'),_0xe67b('0xb7')],'include':_0x42a771}];_0x4cb3e1[_0xe67b('0xaa')]({'model':db['ChatWebsite'],'as':_0xe67b('0xb8'),'attributes':['id','name']});_0x4cb3e1[_0xe67b('0xaa')]({'model':db[_0xe67b('0x83')],'as':_0xe67b('0xb9'),'attributes':['id',_0xe67b('0x5a')]});return db[_0xe67b('0x37')][_0xe67b('0x4e')]({'where':{'id':_0x3ecc1c[_0xe67b('0x42')]['id']},'include':_0x4cb3e1})[_0xe67b('0x17')](handleEntityNotFound(_0x1dcdee,null))[_0xe67b('0x17')](function(_0x4cc105){if(_0x4cc105){var _0x2d89f1=_0x4cc105[_0xe67b('0xba')]({'plain':!![]});fs[_0xe67b('0xbb')](_0x136dc8);var _0x11f602={'channel':_0xe67b('0xbc'),'account':_0x2d89f1[_0xe67b('0xb8')][_0xe67b('0x2e')],'agent':_0x2d89f1[_0xe67b('0xb9')]?_0x2d89f1[_0xe67b('0xb9')][_0xe67b('0x5a')]:_0xe67b('0xbd'),'createdAt':moment(_0x2d89f1[_0xe67b('0x8e')])[_0xe67b('0x86')](_0xe67b('0xbe'))[_0xe67b('0xb2')](),'closedAt':_0x2d89f1[_0xe67b('0x75')]?moment(_0x2d89f1['closedAt'])[_0xe67b('0x86')](_0xe67b('0xbe'))['toString']():'','disposition':_0x2d89f1[_0xe67b('0x6d')],'chatInfo':{'browser':_0x2d89f1[_0xe67b('0xbf')],'os':_0x2d89f1[_0xe67b('0xc0')],'referer':_0x2d89f1[_0xe67b('0xc1')],'customerIp':_0x2d89f1['customerIp'],'customerPort':_0x2d89f1['customerPort']?_0x2d89f1[_0xe67b('0xc2')]:_0xe67b('0xbd')},'messages':_(_0x2d89f1[_0xe67b('0x82')])[_0xe67b('0xc3')]()[_0xe67b('0xa4')]({'secret':![]})['map'](function(_0x35daac){if(_0x35daac[_0xe67b('0x76')]){var _0x37fceb=path['join'](_0x1deb01,_0x35daac['Attachment'][_0xe67b('0x73')]);if(fs[_0xe67b('0xc4')](_0x37fceb)){fs['createReadStream'](_0x37fceb)['pipe'](fs[_0xe67b('0xc5')](path[_0xe67b('0x78')](_0x136dc8,_0x35daac['Attachment'][_0xe67b('0x73')])));}}return{'date':moment(_0x35daac['createdAt'])[_0xe67b('0x86')](_0xe67b('0xbe'))[_0xe67b('0xb2')](),'sender':_0x35daac['direction']===_0xe67b('0x64')?_0x35daac[_0xe67b('0x83')]?_0x35daac['User'][_0xe67b('0x5a')]:_0xe67b('0x89'):_0x35daac[_0xe67b('0x68')][_0xe67b('0xb6')]+(_0x35daac[_0xe67b('0x68')][_0xe67b('0xc6')]?'\x20'+_0x35daac[_0xe67b('0x68')][_0xe67b('0xc6')]:''),'body':_0x35daac[_0xe67b('0x76')]?_0x35daac['Attachment'][_0xe67b('0x73')]:_0x35daac['body'],'direction':_0x35daac[_0xe67b('0x90')]===_0xe67b('0x64')?'A':'C','secret':_0x35daac[_0xe67b('0x91')],'read':_0x35daac[_0xe67b('0xb7')],'attachment':_0x35daac[_0xe67b('0x76')]};})[_0xe67b('0xc7')]()};return ejs[_0xe67b('0xc8')](path[_0xe67b('0x78')](config[_0xe67b('0x7d')],_0xe67b('0xb3'),_0xe67b('0xc9'),_0xe67b('0xca')),{'interaction':_0x11f602})['then'](function(_0x4a2296){var _0xa60784=path[_0xe67b('0x78')](_0x136dc8,_0xe67b('0xcb')+_0x2d89f1['id']+'-'+_0x465ee9+_0xe67b('0xcc'));var _0x4dfcfe={'path':_0xa60784,'channel':'Chat','interactionId':_0x2d89f1['id']};return pdf['createPdfFromHTML'](_0x4a2296,_0x4dfcfe);})[_0xe67b('0x17')](function(){return new Promise(function(_0x4aac29,_0x51044f){zipdir(_0x136dc8,{'saveTo':_0x5d3803},function(_0x355e54,_0x26dafc){if(_0x355e54)return _0x51044f(_0x355e54);return _0x4aac29(_0x26dafc);});})[_0xe67b('0x17')](function(){return new BPromise(function(_0x5607ed,_0x17da85){rimraf(_0x136dc8,function(_0x2506a8){if(_0x2506a8)_0x17da85(_0x2506a8);return _0x5607ed();});});})[_0xe67b('0x17')](function(){return _0x1dcdee[_0xe67b('0x7a')](_0x5d3803,_0x3802d7,function(_0xa0cc4a){if(_0xa0cc4a){logger[_0xe67b('0x1e')]('err',_0xa0cc4a);}else{fs['unlinkSync'](_0x5d3803);}});});});}else{return _0x1dcdee[_0xe67b('0x23')](0xc8);}})[_0xe67b('0x22')](handleError(_0x1dcdee,null));}; \ No newline at end of file +var _0x72ec=['toString','browserName','osName','referer','customerIp','customerPort','tail','pipe','createWriteStream','value','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','update','then','destroy','name','send','render','body','contact','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','params','query','intersection','attributes','model','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','follow','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','closed','disposition','originalname','basename','file','filename','Attachment','attachmentDownload','json','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','User','CmContact','ContactId','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Smtp','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','keys','filters','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','getMyMessages','order','includeAgent','push','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x72ec,0x1c4));var _0xc72e=function(_0x2866c7,_0x197fdd){_0x2866c7=_0x2866c7-0x0;var _0x3c5db2=_0x72ec[_0x2866c7];return _0x3c5db2;};'use strict';var rimraf=require(_0xc72e('0x0'));var zipdir=require(_0xc72e('0x1'));var rp=require(_0xc72e('0x2'));var moment=require(_0xc72e('0x3'));var BPromise=require(_0xc72e('0x4'));var Mustache=require(_0xc72e('0x5'));var util=require(_0xc72e('0x6'));var path=require(_0xc72e('0x7'));var ejs=require(_0xc72e('0x8'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xc72e('0x9'));var pdf=require(_0xc72e('0xa'));var logger=require('../../config/logger')(_0xc72e('0xb'));var config=require(_0xc72e('0xc'));var db=require(_0xc72e('0xd'))['db'];config['redis']=_[_0xc72e('0xe')](config[_0xc72e('0xf')],{'host':_0xc72e('0x10'),'port':0x18eb});var socket=require(_0xc72e('0x11'))(new Redis(config[_0xc72e('0xf')]));require(_0xc72e('0x12'))[_0xc72e('0x13')](socket);var jayson=require(_0xc72e('0x14'));var client=jayson[_0xc72e('0x15')][_0xc72e('0x16')]({'port':0x232b});var client9004=jayson[_0xc72e('0x15')][_0xc72e('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x3b8f46,_0x5c8fec,_0x3ed9c4,_0x34499c){return new BPromise(function(_0x1560a7,_0x54668e){var _0x1a006c=_0x34499c||client;return _0x1a006c[_0xc72e('0x17')](_0x3b8f46,_0x3ed9c4)['then'](function(_0x439d35){logger[_0xc72e('0x18')](_0xc72e('0x19'),_0x5c8fec,_0xc72e('0x1a'));logger[_0xc72e('0x1b')](_0xc72e('0x1c'),_0x5c8fec,_0xc72e('0x1a'),JSON[_0xc72e('0x1d')](_0x439d35));if(_0x439d35[_0xc72e('0x1e')]){if(_0x439d35[_0xc72e('0x1e')][_0xc72e('0x1f')]===0x1f4){logger[_0xc72e('0x1e')](_0xc72e('0x19'),_0x5c8fec,_0x439d35[_0xc72e('0x1e')]['message']);return _0x54668e(_0x439d35[_0xc72e('0x1e')][_0xc72e('0x20')]);}logger[_0xc72e('0x1e')](_0xc72e('0x19'),_0x5c8fec,_0x439d35[_0xc72e('0x1e')][_0xc72e('0x20')]);return _0x1560a7(_0x439d35['error'][_0xc72e('0x20')]);}else{logger[_0xc72e('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5c8fec,_0xc72e('0x1a'));_0x1560a7(_0x439d35[_0xc72e('0x21')][_0xc72e('0x20')]);}})[_0xc72e('0x22')](function(_0x3132f2){logger[_0xc72e('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x5c8fec,_0x3132f2);_0x54668e(_0x3132f2);});});}function respondWithStatusCode(_0x5d98cf,_0x39b416){_0x39b416=_0x39b416||0xcc;return function(_0x5e838b){if(_0x5e838b){return _0x5d98cf[_0xc72e('0x23')](_0x39b416);}return _0x5d98cf[_0xc72e('0x24')](_0x39b416)[_0xc72e('0x25')]();};}function respondWithResult(_0x59bc30,_0x47b79e){_0x47b79e=_0x47b79e||0xc8;return function(_0x4f1bdd){if(_0x4f1bdd){return _0x59bc30[_0xc72e('0x24')](_0x47b79e)['json'](_0x4f1bdd);}};}function respondWithFilteredResult(_0x25a8f1,_0x42bdce){return function(_0x39c854){if(_0x39c854){var _0x14b9aa=typeof _0x42bdce[_0xc72e('0x26')]===_0xc72e('0x27')&&typeof _0x42bdce[_0xc72e('0x28')]===_0xc72e('0x27');var _0x452f49=_0x39c854[_0xc72e('0x29')];var _0x5e7c54=_0x14b9aa?0x0:_0x42bdce[_0xc72e('0x26')];var _0x371d6c=_0x14b9aa?_0x39c854[_0xc72e('0x29')]:_0x42bdce[_0xc72e('0x26')]+_0x42bdce[_0xc72e('0x28')];var _0x16eed9;if(_0x371d6c>=_0x452f49){_0x371d6c=_0x452f49;_0x16eed9=0xc8;}else{_0x16eed9=0xce;}_0x25a8f1[_0xc72e('0x24')](_0x16eed9);return _0x25a8f1[_0xc72e('0x2a')]('Content-Range',_0x5e7c54+'-'+_0x371d6c+'/'+_0x452f49)['json'](_0x39c854);}return null;};}function saveUpdates(_0x5e6975){return function(_0x52712f){if(_0x52712f){return _0x52712f[_0xc72e('0x2b')](_0x5e6975)[_0xc72e('0x2c')](function(_0x18a1f5){return _0x18a1f5;});}return null;};}function removeEntity(_0x279bc1){return function(_0xfbc08f){if(_0xfbc08f){return _0xfbc08f[_0xc72e('0x2d')]()[_0xc72e('0x2c')](function(){_0x279bc1[_0xc72e('0x24')](0xcc)[_0xc72e('0x25')]();});}};}function handleEntityNotFound(_0x182af9){return function(_0x46a21b){if(!_0x46a21b){_0x182af9[_0xc72e('0x23')](0x194);}return _0x46a21b;};}function handleError(_0x38884c,_0x248c3d){_0x248c3d=_0x248c3d||0x1f4;return function(_0x3c76c6){logger[_0xc72e('0x1e')](_0x3c76c6['stack']);if(_0x3c76c6[_0xc72e('0x2e')]){delete _0x3c76c6[_0xc72e('0x2e')];}_0x38884c['status'](_0x248c3d)[_0xc72e('0x2f')](_0x3c76c6);};}function getMustacheRender(_0x212638,_0x1484c4){return Mustache[_0xc72e('0x30')](_0x212638,_['merge'](_0x1484c4[_0xc72e('0x31')],{'contact':_0x1484c4[_0xc72e('0x32')],'message':_0x1484c4[_0xc72e('0x20')],'agent':_0x1484c4['agent'],'interaction':_0x1484c4[_0xc72e('0x33')],'account':_0x1484c4['account']}))||'';}exports[_0xc72e('0x34')]=function(_0x5c9457,_0x2f58c1){var _0x128f8d={};var _0x5b69ae=_[_0xc72e('0x35')](db[_0xc72e('0x36')][_0xc72e('0x37')],function(_0x468fcb){return{'name':_0x468fcb[_0xc72e('0x38')],'type':_0x468fcb[_0xc72e('0x39')][_0xc72e('0x3a')]};});_0x128f8d=qs[_0xc72e('0x3b')](_0x5b69ae,_0x5c9457);return interaction[_0xc72e('0x3c')](_0xc72e('0x3d'),_0x5c9457['query'],_0x5c9457[_0xc72e('0x3e')],_0x128f8d,_0x5b69ae)[_0xc72e('0x2c')](respondWithFilteredResult(_0x2f58c1,_0x128f8d))[_0xc72e('0x22')](handleError(_0x2f58c1,null));};exports[_0xc72e('0x3f')]=function(_0x317495,_0x3f771f){var _0x487858={'raw':![],'where':{'id':_0x317495[_0xc72e('0x40')]['id']}},_0x446bb1={};_0x446bb1['model']=_['keys'](db['ChatInteraction']['rawAttributes']);_0x446bb1[_0xc72e('0x41')]=_['keys'](_0x317495['query']);_0x446bb1['filters']=_[_0xc72e('0x42')](_0x446bb1['model'],_0x446bb1['query']);_0x487858[_0xc72e('0x43')]=_[_0xc72e('0x42')](_0x446bb1[_0xc72e('0x44')],qs[_0xc72e('0x45')](_0x317495[_0xc72e('0x41')][_0xc72e('0x45')]));_0x487858[_0xc72e('0x43')]=_0x487858[_0xc72e('0x43')][_0xc72e('0x46')]?_0x487858[_0xc72e('0x43')]:_0x446bb1[_0xc72e('0x44')];if(_0x317495[_0xc72e('0x41')][_0xc72e('0x47')]){_0x487858[_0xc72e('0x48')]=[{'all':!![]}];}_0x487858=_['merge']({},_0x487858,_0x317495[_0xc72e('0x49')]);return db[_0xc72e('0x36')][_0xc72e('0x4a')](_0x487858)[_0xc72e('0x2c')](handleEntityNotFound(_0x3f771f,null))[_0xc72e('0x2c')](respondWithResult(_0x3f771f,null))[_0xc72e('0x22')](handleError(_0x3f771f,null));};exports[_0xc72e('0x4b')]=function(_0x1d1b8e,_0x478343){return db[_0xc72e('0x36')][_0xc72e('0x4b')](_0x1d1b8e[_0xc72e('0x31')],{})['then'](respondWithResult(_0x478343,0xc9))['catch'](handleError(_0x478343,null));};exports['update']=function(_0x1bc532,_0x2d81b6){if(_0x1bc532[_0xc72e('0x31')]['id']){delete _0x1bc532[_0xc72e('0x31')]['id'];}return db[_0xc72e('0x36')][_0xc72e('0x4a')]({'where':{'id':_0x1bc532[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x2d81b6,null))[_0xc72e('0x2c')](saveUpdates(_0x1bc532[_0xc72e('0x31')],null))[_0xc72e('0x2c')](respondWithResult(_0x2d81b6,null))[_0xc72e('0x22')](handleError(_0x2d81b6,null));};exports[_0xc72e('0x2d')]=function(_0x14ffb1,_0x42d258){return db['ChatInteraction'][_0xc72e('0x4a')]({'where':{'id':_0x14ffb1[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x42d258,null))['then'](removeEntity(_0x42d258,null))['catch'](handleError(_0x42d258,null));};exports[_0xc72e('0x4c')]=function(_0x4017d9,_0x39f99e){return db[_0xc72e('0x36')][_0xc72e('0x4c')]()[_0xc72e('0x2c')](respondWithResult(_0x39f99e,null))[_0xc72e('0x22')](handleError(_0x39f99e,null));};exports[_0xc72e('0x4d')]=function(_0x54532b,_0x209aca){var _0x58dacd=_0x54532b[_0xc72e('0x40')]['id'];var _0x1b1c83;var _0x3f8a27;var _0x13c262;return db['ChatInteraction'][_0xc72e('0x4e')]({'where':{'id':_0x58dacd}})[_0xc72e('0x2c')](function(_0x270873){_0x1b1c83=_0x270873;return db[_0xc72e('0x4f')]['findOne']({'where':{'id':_0x270873[_0xc72e('0x50')]},'attributes':['id',_0xc72e('0x51'),_0xc72e('0x52'),'vidaooTopic',_0xc72e('0x53'),_0xc72e('0x54')],'raw':!![]});})['then'](function(_0x16f531){if(_0x16f531&&_0x16f531[_0xc72e('0x51')]&&_0x16f531[_0xc72e('0x52')]){_0x3f8a27=_0x16f531;var _0x2d10e0={'interaction':{'id':_0x58dacd},'agent':{'id':_0x54532b[_0xc72e('0x3e')]['id'],'name':_0x54532b[_0xc72e('0x3e')]['name'],'fullname':_0x54532b[_0xc72e('0x3e')][_0xc72e('0x55')],'email':_0x54532b[_0xc72e('0x3e')]['email']},'contact':_0x54532b[_0xc72e('0x31')]['contact'],'account':_0x54532b[_0xc72e('0x31')]['account']};var _0x1baee0={'rejectUnauthorized':![],'method':'POST','url':_0xc72e('0x56'),'headers':{'X-APIKEY':_0x16f531[_0xc72e('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x54532b['user'][_0xc72e('0x57')]],'buttons':null,'topic':_0x3f8a27[_0xc72e('0x58')],'note':_['isNull'](_0x3f8a27['vidaooNote'])?null:getMustacheRender(_0x3f8a27['vidaooNote'],_0x2d10e0),'metadata':null},'redirect':_0xc72e('0x59'),'json':!![]};try{if(!_['isNull'](_0x3f8a27['vidaooMetadata'])){var _0x3e44e4=getMustacheRender(_0x3f8a27[_0xc72e('0x54')],_0x2d10e0);var _0x5b9e64=JSON[_0xc72e('0x5a')](_0x3e44e4);_0x1baee0[_0xc72e('0x31')]['metadata']=_0x5b9e64;}}catch(_0x2a4c1d){throw new db['Sequelize'][(_0xc72e('0x5b'))](_0xc72e('0x5c'));}return rp(_0x1baee0);}else{throw new db[(_0xc72e('0x5d'))][(_0xc72e('0x5b'))](_0xc72e('0x5e'));}})[_0xc72e('0x2c')](function(_0x468810){_0x13c262=_0x468810;if(_0x13c262['id']){var _0x36e83={'body':_0x13c262[_0xc72e('0x5f')],'ChatWebsiteId':_0x3f8a27['id'],'ChatInteractionId':_0x1b1c83['id'],'direction':_0xc72e('0x60'),'UserId':_0x54532b[_0xc72e('0x3e')]['id']};return db['ChatMessage']['create'](_0x36e83,{});}else{throw new db[(_0xc72e('0x5d'))][(_0xc72e('0x5b'))](_0xc72e('0x61'));}})[_0xc72e('0x2c')](function(){return _0x1b1c83[_0xc72e('0x62')]({'vidaooSessionId':_0x13c262['id']});})[_0xc72e('0x2c')](respondWithResult(_0x209aca,null))[_0xc72e('0x22')](handleError(_0x209aca,null));};exports[_0xc72e('0x63')]=function(_0x120077,_0x1f8974){if(_0x120077[_0xc72e('0x31')]['id']){delete _0x120077[_0xc72e('0x31')]['id'];}return db[_0xc72e('0x36')][_0xc72e('0x4a')]({'where':{'id':_0x120077[_0xc72e('0x40')]['id']},'include':[{'model':db['CmContact'],'as':_0xc72e('0x64')}]})[_0xc72e('0x2c')](handleEntityNotFound(_0x1f8974,null))[_0xc72e('0x2c')](saveUpdates(_0x120077['body'],null))['then'](respondWithResult(_0x1f8974,null))[_0xc72e('0x22')](handleError(_0x1f8974,null));};exports['abandon']=function(_0x130aa4,_0x43826e){if(_0x130aa4[_0xc72e('0x31')]['id']){delete _0x130aa4[_0xc72e('0x31')]['id'];}return db['ChatInteraction'][_0xc72e('0x4a')]({'where':{'id':_0x130aa4[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](function(_0x488eb9){if(!_0x488eb9){logger['error'](_0xc72e('0x65'),_0xc72e('0x66'),0x194,'entity\x20not\x20found');_0x43826e['sendStatus'](0x194);}else{if(_0x488eb9[_0xc72e('0x67')]){throw new db['Sequelize'][(_0xc72e('0x5b'))](_0xc72e('0x68'));}}return _0x488eb9;})[_0xc72e('0x2c')](function(_0x51d901){if(_0x51d901){return _0x51d901[_0xc72e('0x2b')]({'closed':_0x130aa4[_0xc72e('0x31')][_0xc72e('0x69')],'disposition':_0x130aa4['body'][_0xc72e('0x6a')]})[_0xc72e('0x2c')](function(_0x4a73e2){return _0x4a73e2;});}})[_0xc72e('0x2c')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x130aa4[_0xc72e('0x31')],client9004);})[_0xc72e('0x2c')](respondWithResult(_0x43826e,null))[_0xc72e('0x22')](handleError(_0x43826e,null));};exports['attachmentUpload']=function(_0x18df6d,_0x1f65ef){_0x18df6d[_0xc72e('0x31')][_0xc72e('0x2e')]=_0x18df6d['file'][_0xc72e('0x6b')];_0x18df6d[_0xc72e('0x31')][_0xc72e('0x6c')]=_0x18df6d[_0xc72e('0x6d')][_0xc72e('0x6e')];_0x18df6d['body'][_0xc72e('0x39')]=_0x18df6d['file']['mimetype'];return db[_0xc72e('0x6f')][_0xc72e('0x4b')](_0x18df6d[_0xc72e('0x31')])[_0xc72e('0x2c')](respondWithResult(_0x1f65ef,0xc9))['catch'](handleError(_0x1f65ef,null));};exports[_0xc72e('0x70')]=function(_0x30af95,_0x2126ef){return db[_0xc72e('0x36')]['findOne']({'where':{'id':_0x30af95[_0xc72e('0x40')]['id']},'raw':!![]})[_0xc72e('0x2c')](handleEntityNotFound(_0x2126ef,null))[_0xc72e('0x2c')](function(_0xf85fa){if(_0xf85fa){if(_0xf85fa[_0xc72e('0x69')]){return _0x2126ef[_0xc72e('0x24')](0x193)[_0xc72e('0x71')]({'status':0x193,'message':'Unauthorized'});}return db[_0xc72e('0x6f')][_0xc72e('0x4e')]({'where':{'id':_0x30af95[_0xc72e('0x41')][_0xc72e('0x72')]},'raw':!![]})[_0xc72e('0x2c')](handleEntityNotFound(_0x2126ef,null));}})[_0xc72e('0x2c')](function(_0x22f548){if(_0x22f548){var _0x4d4368=_0x22f548[_0xc72e('0x73')]!==null;var _0x36f0b5=path[_0xc72e('0x74')](config['root'],_0xc72e('0x75'));if(_0x4d4368){_0x36f0b5=path[_0xc72e('0x74')](_0x36f0b5,_0xc72e('0x76'));}var _0xf34b1d=path[_0xc72e('0x74')](_0x36f0b5,_0x22f548['basename']);return _0x2126ef['download'](_0xf34b1d);}})[_0xc72e('0x22')](handleError(_0x2126ef,null));};exports['close']=function(_0x37ad98,_0x5ef2f1){var _0x443cd7=null;var _0x204e86=null;var _0x4c32f6=null;if(_0x37ad98[_0xc72e('0x31')]['id']){delete _0x37ad98['body']['id'];}if(_0x37ad98['body']['mailTranscript']){_0x4c32f6=path[_0xc72e('0x74')](config[_0xc72e('0x77')],_0xc72e('0x78'),util['format'](_0xc72e('0x79'),Date[_0xc72e('0x7a')]()));_0x37ad98['body'][_0xc72e('0x7b')]=_0x4c32f6;}return db['ChatInteraction']['find']({'where':{'id':_0x37ad98[_0xc72e('0x40')]['id']},'include':[{'model':db[_0xc72e('0x7c')],'as':'Messages','include':[{'model':db[_0xc72e('0x7d')],'as':'User'}]}]})[_0xc72e('0x2c')](handleEntityNotFound(_0x5ef2f1,null))['then'](saveUpdates(_0x37ad98['body'],null))[_0xc72e('0x2c')](function(_0x386296){if(_0x386296){_0x443cd7=_0x386296;return db['ChatWebsite']['find']({'where':{'id':_0x443cd7[_0xc72e('0x50')]}});}})[_0xc72e('0x2c')](function(_0x42b8c4){if(_0x42b8c4){_0x204e86=_0x42b8c4;return db[_0xc72e('0x7e')]['find']({'where':{'id':_0x443cd7[_0xc72e('0x7f')]}});}})[_0xc72e('0x2c')](function(_0x42d79a){if(_0x42d79a){if(_0x4c32f6){var _0xe707c6=null;for(var _0x424b92=0x1;_0x424b92<_0x443cd7[_0xc72e('0x80')][_0xc72e('0x46')];++_0x424b92){_0xe707c6=_0x443cd7[_0xc72e('0x80')][_0x424b92];var _0x311b3a=_0xe707c6[_0xc72e('0x67')]?util[_0xc72e('0x81')](_0xc72e('0x82'),_0x204e86[_0xc72e('0x83')],_0xe707c6['UserId']):_0xc72e('0x84');var _0x28697d=_0x37ad98[_0xc72e('0x31')][_0xc72e('0x85')]||util['format'](_0xc72e('0x82'),_0xc72e('0x86'),_0xe707c6[_0xc72e('0x7f')]);switch(_0x204e86[_0xc72e('0x87')]){case _0xc72e('0x88'):_0x311b3a=_0xe707c6[_0xc72e('0x67')]?util[_0xc72e('0x81')](_0xc72e('0x82'),_0x204e86[_0xc72e('0x83')],_0xe707c6[_0xc72e('0x67')]):_0xc72e('0x84');break;case _0xc72e('0x89'):_0x311b3a=_0xe707c6[_0xc72e('0x67')]?_0xe707c6['User'][_0xc72e('0x8a')]||_0xe707c6[_0xc72e('0x7d')]['fullname']:'System';break;case _0xc72e('0x8b'):_0x311b3a=_0xe707c6[_0xc72e('0x67')]?_0xe707c6[_0xc72e('0x7d')]['fullname']:'System';break;default:_0x311b3a=_0xe707c6[_0xc72e('0x67')]?util[_0xc72e('0x81')](_0xc72e('0x82'),_0x204e86[_0xc72e('0x83')],_0xe707c6[_0xc72e('0x67')]):_0xc72e('0x84');}var _0x561cb8=util['format'](_0xc72e('0x8c'),moment(_0xe707c6[_0xc72e('0x8d')])[_0xc72e('0x81')](_0xc72e('0x8e')),_0xe707c6[_0xc72e('0x8f')]==='in'?_0x28697d:_0x311b3a,_0xe707c6[_0xc72e('0x31')]);if(!_0xe707c6[_0xc72e('0x90')]){fs[_0xc72e('0x91')](_0x4c32f6,_0x561cb8);}}return db[_0xc72e('0x92')][_0xc72e('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0xc72e('0x93')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc72e('0x94')],'as':_0xc72e('0x94'),'raw':!![]}]}]});}}})[_0xc72e('0x2c')](function(_0x2fed86){if(!_0x2fed86||!_0x2fed86['Smtp']||!_0x37ad98['body'])return _0x443cd7;var _0x1ced5e=_0x2fed86[_0xc72e('0x95')]();return respondWithRpcPromise(_0xc72e('0x96'),_0xc72e('0x97'),{'account':_0x1ced5e,'message':{'from':util['format'](_0xc72e('0x98'),_0x2fed86[_0xc72e('0x2e')],_0x2fed86[_0xc72e('0x57')]||_0x2fed86[_0xc72e('0x99')][_0xc72e('0x3e')]),'to':_0x37ad98[_0xc72e('0x31')][_0xc72e('0x9a')],'subject':_0xc72e('0x9b'),'text':util[_0xc72e('0x81')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x37ad98['body'][_0xc72e('0x9a')]),'attachments':[{'path':_0x4c32f6}]}})[_0xc72e('0x2c')](function(){return _0x443cd7;})[_0xc72e('0x22')](function(_0x517976){logger['error'](_0x517976);});})['then'](respondWithStatusCode(_0x5ef2f1,0xc8))['catch'](handleError(_0x5ef2f1,null));};exports['addMessage']=function(_0x4ec23c,_0x283802){return db['ChatMessage'][_0xc72e('0x4a')]({'where':{'id':_0x4ec23c[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x283802,null))['then'](function(_0x5ced47){if(_0x5ced47){return _0x5ced47[_0xc72e('0x9c')](_0x4ec23c[_0xc72e('0x31')][_0xc72e('0x9d')],_[_0xc72e('0x9e')](_0x4ec23c[_0xc72e('0x31')],[_0xc72e('0x9d'),'id'])||{});}})[_0xc72e('0x2c')](respondWithResult(_0x283802,null))['catch'](handleError(_0x283802,null));};exports['getMessages']=function(_0x521c65,_0x14a9db){var _0x337228={'raw':![],'where':{}};var _0x5041d4={};var _0xa562df={'count':0x0,'rows':[]};return db[_0xc72e('0x36')][_0xc72e('0x4e')]({'where':{'id':_0x521c65[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x14a9db,null))[_0xc72e('0x2c')](function(_0x1a6363){if(_0x1a6363){_0x5041d4['model']=_[_0xc72e('0x9f')](db['ChatMessage'][_0xc72e('0x37')]);_0x5041d4[_0xc72e('0x41')]=_['keys'](_0x521c65[_0xc72e('0x41')]);_0x5041d4[_0xc72e('0xa0')]=_[_0xc72e('0x42')](_0x5041d4[_0xc72e('0x44')],_0x5041d4['query']);_0x337228[_0xc72e('0x43')]=_[_0xc72e('0x42')](_0x5041d4[_0xc72e('0x44')],qs['fields'](_0x521c65[_0xc72e('0x41')][_0xc72e('0x45')]));_0x337228[_0xc72e('0x43')]=_0x337228[_0xc72e('0x43')][_0xc72e('0x46')]?_0x337228[_0xc72e('0x43')]:_0x5041d4['model'];if(!_0x521c65['query'][_0xc72e('0xa1')](_0xc72e('0xa2'))){_0x337228[_0xc72e('0x28')]=qs[_0xc72e('0x28')](_0x521c65['query']['limit']);_0x337228[_0xc72e('0x26')]=qs[_0xc72e('0x26')](_0x521c65[_0xc72e('0x41')]['offset']);}_0x337228['order']=qs['sort'](_0x521c65[_0xc72e('0x41')][_0xc72e('0xa3')]);_0x337228[_0xc72e('0xa4')]=qs[_0xc72e('0xa0')](_[_0xc72e('0xa5')](_0x521c65['query'],_0x5041d4[_0xc72e('0xa0')]));_0x337228[_0xc72e('0xa4')][_0xc72e('0xa6')]=_0x1a6363['id'];if(_0x521c65[_0xc72e('0x41')][_0xc72e('0xa7')]){_0x337228['where']=_['merge'](_0x337228[_0xc72e('0xa4')],{'$or':_['map'](_0x337228[_0xc72e('0x43')],function(_0x541f81){var _0x50090c={};_0x50090c[_0x541f81]={'$like':'%'+_0x521c65['query']['filter']+'%'};return _0x50090c;})});}if(_0x521c65[_0xc72e('0x41')][_0xc72e('0xa8')]){var _0x5eadc1=_0x521c65['query'][_0xc72e('0xa8')][_0xc72e('0xa9')](',');var _0x4801dc={};_0x4801dc[_0x5eadc1[0x0]]={'$gte':moment(_0x5eadc1[0x1])['format'](_0xc72e('0xaa'))};_0x337228[_0xc72e('0xa4')]=_['merge'](_0x337228[_0xc72e('0xa4')],_0x4801dc);}_0x337228=_[_0xc72e('0xab')]({},_0x337228,_0x521c65['options']);return db['ChatMessage'][_0xc72e('0x29')]({'where':_0x337228[_0xc72e('0xa4')]})[_0xc72e('0x2c')](function(_0x2ac4c3){_0xa562df[_0xc72e('0x29')]=_0x2ac4c3;if(_0x521c65[_0xc72e('0x41')]['includeAll']){_0x337228[_0xc72e('0x48')]=[{'all':!![]}];}return db[_0xc72e('0x7c')][_0xc72e('0x3c')](_0x337228);})[_0xc72e('0x2c')](function(_0x475732){_0xa562df[_0xc72e('0xac')]=_0x475732;return _0xa562df;});}})['then'](respondWithFilteredResult(_0x14a9db,_0x337228))['catch'](handleError(_0x14a9db,null));};exports[_0xc72e('0xad')]=function(_0x78c2ca,_0x16125){var _0x538e90={'where':{}},_0x2bbabc={},_0x1f0293={'count':0x0,'rows':[]};return db[_0xc72e('0x36')][_0xc72e('0x4e')]({'where':{'id':_0x78c2ca[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x16125,null))[_0xc72e('0x2c')](function(_0x594c5a){if(_0x594c5a){_0x2bbabc['model']=_[_0xc72e('0x9f')](db[_0xc72e('0x7c')][_0xc72e('0x37')]);_0x2bbabc['query']=_['keys'](_0x78c2ca[_0xc72e('0x41')]);_0x2bbabc['filters']=_[_0xc72e('0x42')](_0x2bbabc[_0xc72e('0x44')],_0x2bbabc['query']);_0x538e90[_0xc72e('0x43')]=_[_0xc72e('0x42')](_0x2bbabc[_0xc72e('0x44')],qs['fields'](_0x78c2ca[_0xc72e('0x41')][_0xc72e('0x45')]));_0x538e90['attributes']=_0x538e90[_0xc72e('0x43')][_0xc72e('0x46')]?_0x538e90['attributes']:_0x2bbabc[_0xc72e('0x44')];if(!_0x78c2ca[_0xc72e('0x41')][_0xc72e('0xa1')](_0xc72e('0xa2'))){_0x538e90[_0xc72e('0x28')]=qs['limit'](_0x78c2ca['query'][_0xc72e('0x28')]);_0x538e90[_0xc72e('0x26')]=qs[_0xc72e('0x26')](_0x78c2ca[_0xc72e('0x41')][_0xc72e('0x26')]);}_0x538e90[_0xc72e('0xae')]=qs[_0xc72e('0xa3')](_0x78c2ca[_0xc72e('0x41')]['sort']);_0x538e90[_0xc72e('0xa4')]=qs['filters'](_[_0xc72e('0xa5')](_0x78c2ca[_0xc72e('0x41')],_0x2bbabc[_0xc72e('0xa0')]));_0x538e90[_0xc72e('0xa4')][_0xc72e('0xa6')]=_0x594c5a['id'];if(_0x78c2ca['query'][_0xc72e('0xa7')]){_0x538e90[_0xc72e('0xa4')]=_[_0xc72e('0xab')](_0x538e90['where'],{'$or':_[_0xc72e('0x35')](_0x538e90[_0xc72e('0x43')],function(_0x592f95){var _0x104c11={};_0x104c11[_0x592f95]={'$like':'%'+_0x78c2ca[_0xc72e('0x41')]['filter']+'%'};return _0x104c11;})});}_0x538e90['where'][_0xc72e('0x90')]=![];if(_0x78c2ca['query']['id']){_0x538e90[_0xc72e('0xa4')]['id']={'$gt':_0x78c2ca[_0xc72e('0x41')]['id']};}_0x538e90=_[_0xc72e('0xab')]({},_0x538e90,_0x78c2ca['options']);return db[_0xc72e('0x7c')][_0xc72e('0x29')]({'where':_0x538e90['where']})[_0xc72e('0x2c')](function(_0x310e58){_0x1f0293[_0xc72e('0x29')]=_0x310e58;_0x538e90['include']=[];if(_0x78c2ca[_0xc72e('0x41')][_0xc72e('0xaf')]){_0x538e90['include'][_0xc72e('0xb0')]({'model':db['User'],'as':_0xc72e('0x7d'),'attributes':['id',_0xc72e('0x55'),_0xc72e('0x8a')]});}if(_0x78c2ca[_0xc72e('0x41')][_0xc72e('0x47')]){_0x538e90[_0xc72e('0x48')]=[{'all':!![]}];}return db[_0xc72e('0x7c')][_0xc72e('0x3c')](_0x538e90);})['then'](function(_0x59fa38){_0x1f0293['rows']=_0x59fa38;return _0x1f0293;});}})['then'](respondWithFilteredResult(_0x16125,_0x538e90))['catch'](handleError(_0x16125,null));};exports[_0xc72e('0xb1')]=function(_0x335d37,_0x36f961){return db[_0xc72e('0x36')][_0xc72e('0x4a')]({'where':{'id':_0x335d37[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x36f961,null))[_0xc72e('0x2c')](function(_0x350016){if(_0x350016){return _0x350016[_0xc72e('0xb2')](_0x335d37[_0xc72e('0x31')][_0xc72e('0x9d')],_[_0xc72e('0x9e')](_0x335d37[_0xc72e('0x31')],[_0xc72e('0x9d'),'id'])||{})[_0xc72e('0xb3')](function(){return db[_0xc72e('0xb4')]['findAll']({'attributes':['id',_0xc72e('0x2e'),_0xc72e('0xb5')],'where':{'id':_0x335d37[_0xc72e('0x31')][_0xc72e('0x9d')]}});})[_0xc72e('0x2c')](function(_0xba54c7){socket[_0xc72e('0xb6')](_0xc72e('0xb7'),{'id':Number(_0x335d37[_0xc72e('0x40')]['id']),'tags':_0xba54c7||[]});return{'id':Number(_0x335d37[_0xc72e('0x40')]['id']),'tags':_0xba54c7||[]};});}})[_0xc72e('0x2c')](respondWithResult(_0x36f961,null))[_0xc72e('0x22')](handleError(_0x36f961,null));};exports['removeTags']=function(_0x1f1d3f,_0x354a25){return db[_0xc72e('0x36')][_0xc72e('0x4a')]({'where':{'id':_0x1f1d3f[_0xc72e('0x40')]['id']}})[_0xc72e('0x2c')](handleEntityNotFound(_0x354a25,null))[_0xc72e('0x2c')](function(_0x47c653){if(_0x47c653){return _0x47c653[_0xc72e('0xb8')](_0x1f1d3f[_0xc72e('0x41')][_0xc72e('0x9d')]);}})['then'](respondWithStatusCode(_0x354a25,null))['catch'](handleError(_0x354a25,null));};exports[_0xc72e('0xb9')]=function(_0x28f8fe,_0x1133f2){var _0x163024=moment()[_0xc72e('0xba')]()['toString']();var _0x2ea989=path['join'](config[_0xc72e('0x77')],_0xc72e('0xbb'),_0xc72e('0xbc'),_0xc72e('0xbd'));var _0x1b8186=path['join'](config[_0xc72e('0x77')],_0xc72e('0xbb'),_0xc72e('0xbc'),_0xc72e('0xbe'));var _0x2a2962=path[_0xc72e('0x74')](_0x2ea989,_0x163024);var _0x1eb7ec=util[_0xc72e('0x81')]('transcript-%d-%s.zip',_0x28f8fe[_0xc72e('0x40')]['id'],_0x163024);var _0x1824cb=path['join'](_0x2ea989,_0x1eb7ec);var _0x3869fb=[];_0x3869fb[_0xc72e('0xb0')]({'model':db['User'],'as':_0xc72e('0x7d'),'attributes':['id',_0xc72e('0x55')],'raw':!![]});_0x3869fb[_0xc72e('0xb0')]({'model':db[_0xc72e('0x7e')],'as':_0xc72e('0x64'),'attributes':['id',_0xc72e('0xbf'),_0xc72e('0xc0')],'raw':!![]});if(_0x28f8fe[_0xc72e('0x41')][_0xc72e('0xbe')]){_0x3869fb[_0xc72e('0xb0')]({'model':db[_0xc72e('0x6f')],'as':_0xc72e('0x6f'),'raw':!![]});}var _0x7d3c8a=[{'model':db[_0xc72e('0x7c')],'as':_0xc72e('0x80'),'attributes':['id',_0xc72e('0x31'),_0xc72e('0x8d'),'direction',_0xc72e('0x90'),_0xc72e('0xc1')],'include':_0x3869fb}];_0x7d3c8a[_0xc72e('0xb0')]({'model':db[_0xc72e('0x4f')],'as':_0xc72e('0xc2'),'attributes':['id',_0xc72e('0x2e')]});_0x7d3c8a[_0xc72e('0xb0')]({'model':db['User'],'as':_0xc72e('0xc3'),'attributes':['id','fullname']});return db[_0xc72e('0x36')][_0xc72e('0x4a')]({'where':{'id':_0x28f8fe[_0xc72e('0x40')]['id']},'include':_0x7d3c8a})[_0xc72e('0x2c')](handleEntityNotFound(_0x1133f2,null))['then'](function(_0x3f5967){if(_0x3f5967){var _0x36ca76=_0x3f5967[_0xc72e('0xc4')]({'plain':!![]});fs[_0xc72e('0xc5')](_0x2a2962);var _0x1b8a73={'channel':'Chat','account':_0x36ca76[_0xc72e('0xc2')][_0xc72e('0x2e')],'agent':_0x36ca76[_0xc72e('0xc3')]?_0x36ca76['Owner'][_0xc72e('0x55')]:_0xc72e('0xc6'),'createdAt':moment(_0x36ca76[_0xc72e('0x8d')])[_0xc72e('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc72e('0xc7')](),'closedAt':_0x36ca76['closed']?moment(_0x36ca76['closedAt'])[_0xc72e('0x81')](_0xc72e('0xaa'))[_0xc72e('0xc7')]():'','disposition':_0x36ca76['disposition'],'chatInfo':{'browser':_0x36ca76[_0xc72e('0xc8')],'os':_0x36ca76[_0xc72e('0xc9')],'referer':_0x36ca76[_0xc72e('0xca')],'customerIp':_0x36ca76[_0xc72e('0xcb')],'customerPort':_0x36ca76[_0xc72e('0xcc')]?_0x36ca76[_0xc72e('0xcc')]:_0xc72e('0xc6')},'messages':_(_0x36ca76['Messages'])[_0xc72e('0xcd')]()[_0xc72e('0xa7')]({'secret':![]})[_0xc72e('0x35')](function(_0x7f8130){if(_0x7f8130[_0xc72e('0x6f')]){var _0x18aa85=path['join'](_0x1b8186,_0x7f8130['Attachment']['basename']);if(fs['existsSync'](_0x18aa85)){fs['createReadStream'](_0x18aa85)[_0xc72e('0xce')](fs[_0xc72e('0xcf')](path['join'](_0x2a2962,_0x7f8130['Attachment'][_0xc72e('0x6c')])));}}return{'date':moment(_0x7f8130['createdAt'])[_0xc72e('0x81')](_0xc72e('0xaa'))[_0xc72e('0xc7')](),'sender':_0x7f8130[_0xc72e('0x8f')]===_0xc72e('0x60')?_0x7f8130[_0xc72e('0x7d')]?_0x7f8130[_0xc72e('0x7d')]['fullname']:'System':_0x7f8130[_0xc72e('0x64')][_0xc72e('0xbf')]+(_0x7f8130[_0xc72e('0x64')][_0xc72e('0xc0')]?'\x20'+_0x7f8130[_0xc72e('0x64')][_0xc72e('0xc0')]:''),'body':_0x7f8130[_0xc72e('0x6f')]?_0x7f8130[_0xc72e('0x6f')]['basename']:_0x7f8130[_0xc72e('0x31')],'direction':_0x7f8130[_0xc72e('0x8f')]==='out'?'A':'C','secret':_0x7f8130['secret'],'read':_0x7f8130['read'],'attachment':_0x7f8130[_0xc72e('0x6f')]};})[_0xc72e('0xd0')]()};return ejs['renderFile'](path[_0xc72e('0x74')](config['root'],_0xc72e('0xbb'),_0xc72e('0xd1'),_0xc72e('0xd2')),{'interaction':_0x1b8a73})[_0xc72e('0x2c')](function(_0x2cc4a7){var _0x1c26e4=path['join'](_0x2a2962,_0xc72e('0xd3')+_0x36ca76['id']+'-'+_0x163024+_0xc72e('0xd4'));var _0x13df14={'path':_0x1c26e4,'channel':_0xc72e('0xd5'),'interactionId':_0x36ca76['id']};return pdf[_0xc72e('0xd6')](_0x2cc4a7,_0x13df14);})[_0xc72e('0x2c')](function(){return new Promise(function(_0x18a7b6,_0x37970b){zipdir(_0x2a2962,{'saveTo':_0x1824cb},function(_0x590356,_0x4eecf2){if(_0x590356)return _0x37970b(_0x590356);return _0x18a7b6(_0x4eecf2);});})['then'](function(){return new BPromise(function(_0x126b74,_0x3ac68c){rimraf(_0x2a2962,function(_0x1e863f){if(_0x1e863f)_0x3ac68c(_0x1e863f);return _0x126b74();});});})[_0xc72e('0x2c')](function(){return _0x1133f2[_0xc72e('0xb9')](_0x1824cb,_0x1eb7ec,function(_0x31aa74){if(_0x31aa74){logger[_0xc72e('0x1e')](_0xc72e('0xd7'),_0x31aa74);}else{fs[_0xc72e('0xd8')](_0x1824cb);}});});});}else{return _0x1133f2[_0xc72e('0x23')](0xc8);}})[_0xc72e('0x22')](handleError(_0x1133f2,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 42191ca..07c8e16 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 _0x7d05=['hook','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1ac393,_0x52793d){var _0x2b54b2=function(_0x3e4bf0){while(--_0x3e4bf0){_0x1ac393['push'](_0x1ac393['shift']());}};_0x2b54b2(++_0x52793d);}(_0x7d05,0x1d1));var _0x57d0=function(_0x4d75a1,_0x45002a){_0x4d75a1=_0x4d75a1-0x0;var _0x18f98b=_0x7d05[_0x4d75a1];return _0x18f98b;};'use strict';var EventEmitter=require(_0x57d0('0x0'));var ChatInteraction=require(_0x57d0('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x57d0('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x57d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x57d0('0x4'),'afterDestroy':_0x57d0('0x5')};function emitEvent(_0x30f090){return function(_0xf12a98,_0x4abb2a,_0x57b082){_0xf12a98['getUsers']({'attributes':['id'],'raw':!![]})[_0x57d0('0x6')](function(_0x3e8c72){_0xf12a98[_0x57d0('0x7')](_0x57d0('0x8'),_0x3e8c72[_0x57d0('0x9')](function(_0x569f46){return{'id':_0x569f46['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xf12a98['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d0('0x6')](function(_0x49cbca){_0xf12a98[_0x57d0('0x7')](_0x57d0('0xa'),_0x49cbca[_0x57d0('0xb')]);ChatInteractionEvents[_0x57d0('0xc')](_0x30f090+':'+_0xf12a98['id'],_0xf12a98);ChatInteractionEvents['emit'](_0x30f090,_0xf12a98);_0x57b082(null);})[_0x57d0('0xd')](_0x57b082(null));};}for(var e in events){if(events[_0x57d0('0xe')](e)){var event=events[e];ChatInteraction[_0x57d0('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x91b9=['exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x264dec,_0x590e22){var _0x2f12f5=function(_0x3d516d){while(--_0x3d516d){_0x264dec['push'](_0x264dec['shift']());}};_0x2f12f5(++_0x590e22);}(_0x91b9,0x11e));var _0x991b=function(_0x3e3aca,_0xfb5e0b){_0x3e3aca=_0x3e3aca-0x0;var _0x5d1fdb=_0x91b9[_0x3e3aca];return _0x5d1fdb;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x991b('0x0'))['db'][_0x991b('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x991b('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x991b('0x3')](0x0);var events={'afterCreate':_0x991b('0x4'),'afterUpdate':_0x991b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x32235a){return function(_0x229dd6,_0x3f6d00,_0x5b62ed){_0x229dd6['getUsers']({'attributes':['id'],'raw':!![]})[_0x991b('0x6')](function(_0x11f56e){_0x229dd6[_0x991b('0x7')](_0x991b('0x8'),_0x11f56e[_0x991b('0x9')](function(_0x167dbf){return{'id':_0x167dbf['id']};}));return ChatMessage[_0x991b('0xa')]({'where':{'ChatInteractionId':_0x229dd6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x991b('0x6')](function(_0x18a194){_0x229dd6[_0x991b('0x7')](_0x991b('0xb'),_0x18a194['length']);ChatInteractionEvents[_0x991b('0xc')](_0x32235a+':'+_0x229dd6['id'],_0x229dd6);ChatInteractionEvents[_0x991b('0xc')](_0x32235a,_0x229dd6);_0x5b62ed(null);})[_0x991b('0xd')](_0x5b62ed(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x991b('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 03cdcf6..c11e7f6 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 _0x3fa1=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','format'];(function(_0x44f12f,_0x3f3957){var _0x34d474=function(_0x368f02){while(--_0x368f02){_0x44f12f['push'](_0x44f12f['shift']());}};_0x34d474(++_0x3f3957);}(_0x3fa1,0x157));var _0x13fa=function(_0x12cb90,_0xdab1f9){_0x12cb90=_0x12cb90-0x0;var _0x952309=_0x3fa1[_0x12cb90];return _0x952309;};'use strict';var _=require(_0x13fa('0x0'));var util=require(_0x13fa('0x1'));var logger=require(_0x13fa('0x2'))(_0x13fa('0x3'));var moment=require(_0x13fa('0x4'));var BPromise=require('bluebird');var rp=require(_0x13fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13fa('0x6'));var config=require(_0x13fa('0x7'));var attributes=require(_0x13fa('0x8'));module[_0x13fa('0x9')]=function(_0x3fb8e7,_0x53ba1b){return _0x3fb8e7[_0x13fa('0xa')](_0x13fa('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56d61e,_0x388311,_0x1d1fa4){if(_0x56d61e[_0x13fa('0xc')]('closed')){_0x56d61e['closedAt']=moment()[_0x13fa('0xd')](_0x13fa('0xe'));}_0x1d1fa4(null,_0x56d61e);}},'charset':_0x13fa('0xf'),'collate':_0x13fa('0x10')});}; \ No newline at end of file +var _0x763b=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed'];(function(_0x3f6a3f,_0x18b175){var _0x56dd76=function(_0xc1868a){while(--_0xc1868a){_0x3f6a3f['push'](_0x3f6a3f['shift']());}};_0x56dd76(++_0x18b175);}(_0x763b,0x16a));var _0xb763=function(_0x37b775,_0x23e4ce){_0x37b775=_0x37b775-0x0;var _0x294c0c=_0x763b[_0x37b775];return _0x294c0c;};'use strict';var _=require('lodash');var util=require(_0xb763('0x0'));var logger=require(_0xb763('0x1'))('api');var moment=require(_0xb763('0x2'));var BPromise=require('bluebird');var rp=require(_0xb763('0x3'));var fs=require('fs');var path=require(_0xb763('0x4'));var rimraf=require(_0xb763('0x5'));var config=require(_0xb763('0x6'));var attributes=require(_0xb763('0x7'));module[_0xb763('0x8')]=function(_0x4f0829,_0x2e6a99){return _0x4f0829[_0xb763('0x9')](_0xb763('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14bcd5,_0x527a0f,_0x35a6a0){if(_0x14bcd5[_0xb763('0xb')]('closed')){_0x14bcd5[_0xb763('0xc')]=moment()[_0xb763('0xd')](_0xb763('0xe'));}_0x35a6a0(null,_0x14bcd5);}},'charset':_0xb763('0xf'),'collate':_0xb763('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 476915d..0ec0c69 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 _0xfba1=['info','catch','UpdateChatInteraction','update','options','raw','where','attributes','limit','then','stringify','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfba1,0xa2));var _0x1fba=function(_0x2063de,_0x286428){_0x2063de=_0x2063de-0x0;var _0x43343c=_0xfba1[_0x2063de];return _0x43343c;};'use strict';var _=require(_0x1fba('0x0'));var util=require('util');var moment=require(_0x1fba('0x1'));var BPromise=require('bluebird');var rs=require(_0x1fba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fba('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1fba('0x4'));var config=require(_0x1fba('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1fba('0x6')]['http']({'port':0x232a});config[_0x1fba('0x7')]=_[_0x1fba('0x8')](config[_0x1fba('0x7')],{'host':_0x1fba('0x9'),'port':0x18eb});var socket=require(_0x1fba('0xa'))(new Redis(config[_0x1fba('0x7')]));require('./chatInteraction.socket')[_0x1fba('0xb')](socket);function respondWithRpcPromise(_0x8e64ef,_0x3a3a63,_0xd6987b){return new BPromise(function(_0xabba60,_0x4f36bc){return client['request'](_0x8e64ef,_0xd6987b)['then'](function(_0x1e9b5b){logger['info'](_0x1fba('0xc'),_0x3a3a63,_0x1fba('0xd'));logger[_0x1fba('0xe')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3a3a63,_0x1fba('0xd'),JSON['stringify'](_0x1e9b5b));if(_0x1e9b5b[_0x1fba('0xf')]){if(_0x1e9b5b['error'][_0x1fba('0x10')]===0x1f4){logger['error'](_0x1fba('0xc'),_0x3a3a63,_0x1e9b5b[_0x1fba('0xf')]['message']);return _0x4f36bc(_0x1e9b5b['error']['message']);}logger[_0x1fba('0xf')](_0x1fba('0xc'),_0x3a3a63,_0x1e9b5b[_0x1fba('0xf')][_0x1fba('0x11')]);return _0xabba60(_0x1e9b5b[_0x1fba('0xf')][_0x1fba('0x11')]);}else{logger[_0x1fba('0x12')](_0x1fba('0xc'),_0x3a3a63,_0x1fba('0xd'));_0xabba60(_0x1e9b5b['result'][_0x1fba('0x11')]);}})[_0x1fba('0x13')](function(_0x31b2fb){logger[_0x1fba('0xf')](_0x1fba('0xc'),_0x3a3a63,_0x31b2fb);_0x4f36bc(_0x31b2fb);});});}exports[_0x1fba('0x14')]=function(_0x30aaa8){var _0x366159=this;return new Promise(function(_0x43fa42,_0x19a412){return db['ChatInteraction'][_0x1fba('0x15')](_0x30aaa8['body'],{'raw':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x18')]||null:null,'attributes':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8['options'][_0x1fba('0x19')]||null:null,'limit':_0x30aaa8[_0x1fba('0x16')]?_0x30aaa8[_0x1fba('0x16')][_0x1fba('0x1a')]||null:null})[_0x1fba('0x1b')](function(_0x6bad22){logger[_0x1fba('0x12')]('UpdateChatInteraction',_0x30aaa8);logger['debug'](_0x1fba('0x14'),_0x30aaa8,JSON[_0x1fba('0x1c')](_0x6bad22));_0x43fa42(_0x6bad22);})[_0x1fba('0x13')](function(_0x47ab48){logger[_0x1fba('0xf')](_0x1fba('0x14'),_0x47ab48[_0x1fba('0x11')],_0x30aaa8);_0x19a412(_0x366159[_0x1fba('0xf')](0x1f4,_0x47ab48[_0x1fba('0x11')]));});});};exports['AddTagsToChatInteraction']=function(_0x392460){return new Promise(function(_0x16f9ec,_0x5008de){return db[_0x1fba('0x1d')][_0x1fba('0x1e')]({'where':_0x392460[_0x1fba('0x16')]?_0x392460[_0x1fba('0x16')][_0x1fba('0x18')]||null:null})[_0x1fba('0x1b')](function(_0x3db7a9){if(_0x3db7a9){return _0x3db7a9[_0x1fba('0x1f')](_0x392460['body'][_0x1fba('0x20')],_[_0x1fba('0x21')](_0x392460['body'],[_0x1fba('0x20'),'id'])||{});}})[_0x1fba('0x22')](function(_0x3ddc72){logger[_0x1fba('0x12')]('AddTags',_0x392460);logger[_0x1fba('0xe')]('AddTags',_0x392460,JSON['stringify'](_0x3ddc72));_0x16f9ec(_0x3ddc72);})[_0x1fba('0x13')](function(_0x2211dd){logger[_0x1fba('0xf')](_0x1fba('0x23'),_0x2211dd['message'],_0x392460);_0x5008de(_this[_0x1fba('0xf')](0x1f4,_0x2211dd[_0x1fba('0x11')]));});});}; \ No newline at end of file +var _0xc38b=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateChatInteraction','body','options','raw','attributes','then','stringify','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x8f8ec1,_0x528d07){var _0x4b597f=function(_0x1ae59a){while(--_0x1ae59a){_0x8f8ec1['push'](_0x8f8ec1['shift']());}};_0x4b597f(++_0x528d07);}(_0xc38b,0x117));var _0xbc38=function(_0xc76abe,_0x591c5f){_0xc76abe=_0xc76abe-0x0;var _0x357205=_0xc38b[_0xc76abe];return _0x357205;};'use strict';var _=require(_0xbc38('0x0'));var util=require(_0xbc38('0x1'));var moment=require(_0xbc38('0x2'));var BPromise=require(_0xbc38('0x3'));var rs=require(_0xbc38('0x4'));var fs=require('fs');var Redis=require(_0xbc38('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc38('0x6'));var logger=require('../../config/logger')(_0xbc38('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc38('0x8'));var client=jayson['client'][_0xbc38('0x9')]({'port':0x232a});config[_0xbc38('0xa')]=_[_0xbc38('0xb')](config[_0xbc38('0xa')],{'host':_0xbc38('0xc'),'port':0x18eb});var socket=require(_0xbc38('0xd'))(new Redis(config[_0xbc38('0xa')]));require(_0xbc38('0xe'))[_0xbc38('0xf')](socket);function respondWithRpcPromise(_0x3420f7,_0x631b01,_0x4d2fae){return new BPromise(function(_0x33a721,_0x4fd634){return client[_0xbc38('0x10')](_0x3420f7,_0x4d2fae)['then'](function(_0x58e559){logger[_0xbc38('0x11')](_0xbc38('0x12'),_0x631b01,_0xbc38('0x13'));logger[_0xbc38('0x14')](_0xbc38('0x15'),_0x631b01,'request\x20sent',JSON['stringify'](_0x58e559));if(_0x58e559[_0xbc38('0x16')]){if(_0x58e559[_0xbc38('0x16')][_0xbc38('0x17')]===0x1f4){logger[_0xbc38('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x631b01,_0x58e559['error']['message']);return _0x4fd634(_0x58e559[_0xbc38('0x16')][_0xbc38('0x18')]);}logger[_0xbc38('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x631b01,_0x58e559['error'][_0xbc38('0x18')]);return _0x33a721(_0x58e559[_0xbc38('0x16')][_0xbc38('0x18')]);}else{logger[_0xbc38('0x11')](_0xbc38('0x12'),_0x631b01,_0xbc38('0x13'));_0x33a721(_0x58e559['result']['message']);}})[_0xbc38('0x19')](function(_0x14cba6){logger[_0xbc38('0x16')](_0xbc38('0x12'),_0x631b01,_0x14cba6);_0x4fd634(_0x14cba6);});});}exports[_0xbc38('0x1a')]=function(_0x535cd4){var _0x4a409a=this;return new Promise(function(_0xa9faf9,_0x467eb4){return db['ChatInteraction']['update'](_0x535cd4[_0xbc38('0x1b')],{'raw':_0x535cd4[_0xbc38('0x1c')]?_0x535cd4['options'][_0xbc38('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535cd4[_0xbc38('0x1c')]?_0x535cd4['options']['where']||null:null,'attributes':_0x535cd4['options']?_0x535cd4[_0xbc38('0x1c')][_0xbc38('0x1e')]||null:null,'limit':_0x535cd4[_0xbc38('0x1c')]?_0x535cd4[_0xbc38('0x1c')]['limit']||null:null})[_0xbc38('0x1f')](function(_0x5cede0){logger['info']('UpdateChatInteraction',_0x535cd4);logger[_0xbc38('0x14')]('UpdateChatInteraction',_0x535cd4,JSON[_0xbc38('0x20')](_0x5cede0));_0xa9faf9(_0x5cede0);})['catch'](function(_0x696135){logger['error'](_0xbc38('0x1a'),_0x696135[_0xbc38('0x18')],_0x535cd4);_0x467eb4(_0x4a409a['error'](0x1f4,_0x696135[_0xbc38('0x18')]));});});};exports[_0xbc38('0x21')]=function(_0x4c421d){return new Promise(function(_0x1062f6,_0x11ca8f){return db['ChatInteraction'][_0xbc38('0x22')]({'where':_0x4c421d[_0xbc38('0x1c')]?_0x4c421d['options'][_0xbc38('0x23')]||null:null})[_0xbc38('0x1f')](function(_0x2729c4){if(_0x2729c4){return _0x2729c4[_0xbc38('0x24')](_0x4c421d[_0xbc38('0x1b')][_0xbc38('0x25')],_[_0xbc38('0x26')](_0x4c421d[_0xbc38('0x1b')],['ids','id'])||{});}})[_0xbc38('0x27')](function(_0x1f0e8b){logger['info']('AddTags',_0x4c421d);logger[_0xbc38('0x14')](_0xbc38('0x28'),_0x4c421d,JSON['stringify'](_0x1f0e8b));_0x1062f6(_0x1f0e8b);})[_0xbc38('0x19')](function(_0x151d68){logger[_0xbc38('0x16')](_0xbc38('0x28'),_0x151d68[_0xbc38('0x18')],_0x4c421d);_0x11ca8f(_this[_0xbc38('0x16')](0x1f4,_0x151d68[_0xbc38('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 51acad3..9fa8250 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 _0x3094=['chatInteraction:','save','remove','update','emit','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3094,0x86));var _0x4309=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3094[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4309('0x0'),_0x4309('0x1'),_0x4309('0x2')];function createListener(_0x56a160,_0x1e0048){return function(_0x50d54a){_0x1e0048[_0x4309('0x3')](_0x56a160,_0x50d54a);};}function removeListener(_0x101588,_0x297793){return function(){ChatInteractionEvents['removeListener'](_0x101588,_0x297793);};}exports[_0x4309('0x4')]=function(_0x43c338){for(var _0x5da01b=0x0,_0x3567d1=events[_0x4309('0x5')];_0x5da01b<_0x3567d1;_0x5da01b++){var _0x3b143f=events[_0x5da01b];var _0x5a19f6=createListener(_0x4309('0x6')+_0x3b143f,_0x43c338);ChatInteractionEvents['on'](_0x3b143f,_0x5a19f6);}}; \ No newline at end of file +var _0xd164=['emit','register','length','chatInteraction:','save','remove','update'];(function(_0x12ce17,_0xf357c4){var _0x297ca7=function(_0x7e9da){while(--_0x7e9da){_0x12ce17['push'](_0x12ce17['shift']());}};_0x297ca7(++_0xf357c4);}(_0xd164,0x9e));var _0x4d16=function(_0x98e357,_0x277878){_0x98e357=_0x98e357-0x0;var _0x294235=_0xd164[_0x98e357];return _0x294235;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4d16('0x0'),_0x4d16('0x1'),_0x4d16('0x2')];function createListener(_0x4ce4b3,_0x4f9f43){return function(_0x42d8c8){_0x4f9f43[_0x4d16('0x3')](_0x4ce4b3,_0x42d8c8);};}function removeListener(_0x581ae6,_0xf13764){return function(){ChatInteractionEvents['removeListener'](_0x581ae6,_0xf13764);};}exports[_0x4d16('0x4')]=function(_0x1f7c27){for(var _0x49bd1e=0x0,_0x5d373c=events[_0x4d16('0x5')];_0x49bd1e<_0x5d373c;_0x49bd1e++){var _0x3b076c=events[_0x49bd1e];var _0x1d57e3=createListener(_0x4d16('0x6')+_0x3b076c,_0x1f7c27);ChatInteractionEvents['on'](_0x3b076c,_0x1d57e3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0963a31..1dde760 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 _0xf43a=['/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','isChatInteractionAuthorized','addMessage','/:id/tags','chat','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','/:id','tracked','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages'];(function(_0x44f16a,_0x43f134){var _0x2cc20f=function(_0x1e851c){while(--_0x1e851c){_0x44f16a['push'](_0x44f16a['shift']());}};_0x2cc20f(++_0x43f134);}(_0xf43a,0xc1));var _0xaf43=function(_0x4fab70,_0x520a86){_0x4fab70=_0x4fab70-0x0;var _0x322528=_0xf43a[_0x4fab70];return _0x322528;};'use strict';var multer=require('multer');var util=require(_0xaf43('0x0'));var path=require(_0xaf43('0x1'));var timeout=require(_0xaf43('0x2'));var express=require(_0xaf43('0x3'));var router=express[_0xaf43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf43('0x5'));var interaction=require(_0xaf43('0x6'));var config=require(_0xaf43('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaf43('0x8')]);router[_0xaf43('0x9')](_0xaf43('0xa'),auth[_0xaf43('0xb')](),controller[_0xaf43('0xc')]);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0xaf43('0xd')]);router[_0xaf43('0x9')](_0xaf43('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xaf43('0xf')]);router[_0xaf43('0x9')](_0xaf43('0x10'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x11')]);router[_0xaf43('0x9')](_0xaf43('0x12'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0xaf43('0x13'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x14')]);router['post']('/',auth[_0xaf43('0xb')](),controller['create']);router[_0xaf43('0x15')](_0xaf43('0x16'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x17')]);var upload=multer({'storage':multer[_0xaf43('0x18')]({'destination':function(_0x49e88b,_0x36a117,_0x5d686e){_0x5d686e(null,path[_0xaf43('0x19')](config[_0xaf43('0x1a')],_0xaf43('0x1b')));},'filename':function(_0x24091b,_0x550a38,_0x1cdd9d){_0x1cdd9d(null,util[_0xaf43('0x1c')](_0xaf43('0x1d'),Date[_0xaf43('0x1e')](),_0x550a38[_0xaf43('0x1f')][_0xaf43('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaf43('0x15')](_0xaf43('0x21'),upload['single'](_0xaf43('0x22')),controller['attachmentUpload']);router[_0xaf43('0x15')](_0xaf43('0x10'),auth[_0xaf43('0x23')](),controller[_0xaf43('0x24')]);router[_0xaf43('0x15')](_0xaf43('0x25'),auth[_0xaf43('0xb')](),interaction['tracked'](_0xaf43('0x26'),'chatinteraction:addtags'),controller[_0xaf43('0x27')]);router[_0xaf43('0x28')]('/:id',auth[_0xaf43('0xb')](),interaction['tracked'](_0xaf43('0x26'),_0xaf43('0x29')),controller['update']);router['put'](_0xaf43('0x2a'),controller[_0xaf43('0x2b')]);router['put'](_0xaf43('0x2c'),auth[_0xaf43('0x23')](),controller[_0xaf43('0x2d')]);router[_0xaf43('0x28')](_0xaf43('0x2e'),controller['close']);router[_0xaf43('0x2f')](_0xaf43('0x30'),auth[_0xaf43('0xb')](),interaction[_0xaf43('0x31')](_0xaf43('0x26'),'chatinteraction:destroy'),controller[_0xaf43('0x32')]);router[_0xaf43('0x2f')](_0xaf43('0x25'),auth[_0xaf43('0xb')](),controller[_0xaf43('0x33')]);module[_0xaf43('0x34')]=router; \ No newline at end of file +var _0x2172=['./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','isAuthenticated','getMyMessages','download','create','createVidaooSession','join','root','format','%s-%s','now','originalname','post','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','update','put','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52e753,_0x2530b7){var _0x5ba199=function(_0x1560fe){while(--_0x1560fe){_0x52e753['push'](_0x52e753['shift']());}};_0x5ba199(++_0x2530b7);}(_0x2172,0x135));var _0x2217=function(_0x22faa8,_0x4c7e08){_0x22faa8=_0x22faa8-0x0;var _0x3ab8b5=_0x2172[_0x22faa8];return _0x3ab8b5;};'use strict';var multer=require(_0x2217('0x0'));var util=require(_0x2217('0x1'));var path=require('path');var timeout=require(_0x2217('0x2'));var express=require(_0x2217('0x3'));var router=express[_0x2217('0x4')]();var fs_extra=require(_0x2217('0x5'));var auth=require(_0x2217('0x6'));var interaction=require(_0x2217('0x7'));var config=require(_0x2217('0x8'));var controller=require(_0x2217('0x9'));router[_0x2217('0xa')]('/',auth['isAuthenticated'](),controller[_0x2217('0xb')]);router[_0x2217('0xa')](_0x2217('0xc'),auth['isAuthenticated'](),controller[_0x2217('0xd')]);router[_0x2217('0xa')](_0x2217('0xe'),auth[_0x2217('0xf')](),controller[_0x2217('0x10')]);router[_0x2217('0xa')](_0x2217('0x11'),auth[_0x2217('0xf')](),controller[_0x2217('0x12')]);router[_0x2217('0xa')](_0x2217('0x13'),auth[_0x2217('0x14')](),controller['getMessages']);router[_0x2217('0xa')]('/:id/my_messages',auth[_0x2217('0xf')](),controller[_0x2217('0x15')]);router['get']('/:id/download',auth[_0x2217('0x14')](),controller[_0x2217('0x16')]);router['post']('/',auth[_0x2217('0x14')](),controller[_0x2217('0x17')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x2217('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f3e43,_0x1cff97,_0x2520a0){_0x2520a0(null,path[_0x2217('0x19')](config[_0x2217('0x1a')],'server/files/attachments/'));},'filename':function(_0x234981,_0x1a913e,_0x4b039e){_0x4b039e(null,util[_0x2217('0x1b')](_0x2217('0x1c'),Date[_0x2217('0x1d')](),_0x1a913e[_0x2217('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2217('0x1f')](_0x2217('0x20'),upload[_0x2217('0x21')](_0x2217('0x22')),controller[_0x2217('0x23')]);router[_0x2217('0x1f')](_0x2217('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x2217('0x24')]);router[_0x2217('0x1f')](_0x2217('0x25'),auth[_0x2217('0x14')](),interaction[_0x2217('0x26')](_0x2217('0x27'),_0x2217('0x28')),controller[_0x2217('0x29')]);router['put'](_0x2217('0xe'),auth[_0x2217('0x14')](),interaction[_0x2217('0x26')](_0x2217('0x27'),'chatinteraction:update'),controller[_0x2217('0x2a')]);router[_0x2217('0x2b')]('/:id/custom_update',controller[_0x2217('0x2c')]);router['put'](_0x2217('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x2217('0x2e')]);router[_0x2217('0x2b')]('/:id/close',controller[_0x2217('0x2f')]);router[_0x2217('0x30')]('/:id',auth[_0x2217('0x14')](),interaction['tracked'](_0x2217('0x27'),_0x2217('0x31')),controller[_0x2217('0x32')]);router[_0x2217('0x30')](_0x2217('0x25'),auth[_0x2217('0x14')](),controller[_0x2217('0x33')]);module[_0x2217('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ff727dc..2c33501 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 _0x20c3=['sequelize','exports','INTEGER'];(function(_0x41aa24,_0xe3bb56){var _0x3a758a=function(_0x2d00e2){while(--_0x2d00e2){_0x41aa24['push'](_0x41aa24['shift']());}};_0x3a758a(++_0xe3bb56);}(_0x20c3,0x189));var _0x320c=function(_0x5d51d2,_0x286a78){_0x5d51d2=_0x5d51d2-0x0;var _0x2c63f1=_0x20c3[_0x5d51d2];return _0x2c63f1;};'use strict';var Sequelize=require(_0x320c('0x0'));module[_0x320c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x320c('0x2')]}}; \ No newline at end of file +var _0x783f=['exports','medium','BOOLEAN','sequelize'];(function(_0x34ba87,_0x15bf07){var _0x4cfc86=function(_0x34d7e0){while(--_0x34d7e0){_0x34ba87['push'](_0x34ba87['shift']());}};_0x4cfc86(++_0x15bf07);}(_0x783f,0xd3));var _0xf783=function(_0x5b1050,_0x3bfd6b){_0x5b1050=_0x5b1050-0x0;var _0x24f8e0=_0x783f[_0x5b1050];return _0x24f8e0;};'use strict';var Sequelize=require(_0xf783('0x0'));module[_0xf783('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf783('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf783('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 98ceffb..a00ddaa 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 _0x9f12=['error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','where','pick','map','filter','merge','options','count','includeAll','include','catch','show','params','intersection','find','create','body','get','createdAt','lastMessage','lastMessageAt','format','getUsers','findAll','agent','admin','user','fullname','userpic','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','sendStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f12,0x17a));var _0x29f1=function(_0x27671f,_0x449b6a){_0x27671f=_0x27671f-0x0;var _0x523bbf=_0x9f12[_0x27671f];return _0x523bbf;};'use strict';var emlformat=require(_0x29f1('0x0'));var rimraf=require(_0x29f1('0x1'));var zipdir=require(_0x29f1('0x2'));var jsonpatch=require(_0x29f1('0x3'));var rp=require(_0x29f1('0x4'));var moment=require(_0x29f1('0x5'));var BPromise=require(_0x29f1('0x6'));var Mustache=require(_0x29f1('0x7'));var util=require(_0x29f1('0x8'));var path=require(_0x29f1('0x9'));var sox=require(_0x29f1('0xa'));var csv=require(_0x29f1('0xb'));var ejs=require(_0x29f1('0xc'));var fs=require('fs');var fs_extra=require(_0x29f1('0xd'));var _=require(_0x29f1('0xe'));var squel=require('squel');var crypto=require(_0x29f1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x29f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x29f1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x29f1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f1('0x13'));var logger=require('../../config/logger')(_0x29f1('0x14'));var utils=require(_0x29f1('0x15'));var config=require(_0x29f1('0x16'));var licenseUtil=require(_0x29f1('0x17'));var db=require(_0x29f1('0x18'))['db'];config[_0x29f1('0x19')]=_[_0x29f1('0x1a')](config[_0x29f1('0x19')],{'host':_0x29f1('0x1b'),'port':0x18eb});var socket=require(_0x29f1('0x1c'))(new Redis(config[_0x29f1('0x19')]));require('./chatInternalMessage.socket')[_0x29f1('0x1d')](socket);function respondWithStatusCode(_0x7c5689,_0x15da5e){_0x15da5e=_0x15da5e||0xcc;return function(_0x443a7a){if(_0x443a7a){return _0x7c5689['sendStatus'](_0x15da5e);}return _0x7c5689[_0x29f1('0x1e')](_0x15da5e)[_0x29f1('0x1f')]();};}function respondWithResult(_0x343a37,_0x245ee0){_0x245ee0=_0x245ee0||0xc8;return function(_0x4baa6a){if(_0x4baa6a){return _0x343a37['status'](_0x245ee0)[_0x29f1('0x20')](_0x4baa6a);}};}function respondWithFilteredResult(_0x4d105d,_0x372150){return function(_0x3254bc){if(_0x3254bc){var _0xaa4e4a=typeof _0x372150[_0x29f1('0x21')]===_0x29f1('0x22')&&typeof _0x372150[_0x29f1('0x23')]===_0x29f1('0x22');var _0x35aeec=_0x3254bc['count'];var _0x4cf485=_0xaa4e4a?0x0:_0x372150['offset'];var _0x1145de=_0xaa4e4a?_0x3254bc['count']:_0x372150[_0x29f1('0x21')]+_0x372150['limit'];var _0x27f285;if(_0x1145de>=_0x35aeec){_0x1145de=_0x35aeec;_0x27f285=0xc8;}else{_0x27f285=0xce;}_0x4d105d[_0x29f1('0x1e')](_0x27f285);return _0x4d105d[_0x29f1('0x24')](_0x29f1('0x25'),_0x4cf485+'-'+_0x1145de+'/'+_0x35aeec)['json'](_0x3254bc);}return null;};}function patchUpdates(_0x2cf7bc){return function(_0x49c954){try{jsonpatch['apply'](_0x49c954,_0x2cf7bc,!![]);}catch(_0x525281){return BPromise['reject'](_0x525281);}return _0x49c954['save']();};}function saveUpdates(_0xc98c27,_0x14f171){return function(_0xe75ebc){if(_0xe75ebc){return _0xe75ebc[_0x29f1('0x26')](_0xc98c27)['then'](function(_0x30f253){return _0x30f253;});}return null;};}function removeEntity(_0x314994,_0x377f71){return function(_0xadc58c){if(_0xadc58c){return _0xadc58c[_0x29f1('0x27')]()[_0x29f1('0x28')](function(){_0x314994[_0x29f1('0x1e')](0xcc)[_0x29f1('0x1f')]();});}};}function handleEntityNotFound(_0x15a4ba,_0x9c97c3){return function(_0x5b3bf4){if(!_0x5b3bf4){_0x15a4ba[_0x29f1('0x29')](0x194);}return _0x5b3bf4;};}function handleError(_0x36f687,_0x2808fc){_0x2808fc=_0x2808fc||0x1f4;return function(_0x3dd314){logger[_0x29f1('0x2a')](_0x3dd314[_0x29f1('0x2b')]);if(_0x3dd314[_0x29f1('0x2c')]){delete _0x3dd314[_0x29f1('0x2c')];}_0x36f687[_0x29f1('0x1e')](_0x2808fc)[_0x29f1('0x2d')](_0x3dd314);};}exports['index']=function(_0x5bab33,_0x26825e){var _0xdc1ebf={},_0x3afed4={},_0x93d8bb={'count':0x0,'rows':[]};var _0x46fcf9=_['map'](db[_0x29f1('0x2e')][_0x29f1('0x2f')],function(_0x457e4e){return{'name':_0x457e4e[_0x29f1('0x30')],'type':_0x457e4e[_0x29f1('0x31')]['key']};});_0x3afed4[_0x29f1('0x32')]=_['map'](_0x46fcf9,_0x29f1('0x2c'));_0x3afed4[_0x29f1('0x33')]=_[_0x29f1('0x34')](_0x5bab33[_0x29f1('0x33')]);_0x3afed4[_0x29f1('0x35')]=_['intersection'](_0x3afed4[_0x29f1('0x32')],_0x3afed4[_0x29f1('0x33')]);_0xdc1ebf[_0x29f1('0x36')]=_['intersection'](_0x3afed4[_0x29f1('0x32')],qs[_0x29f1('0x37')](_0x5bab33[_0x29f1('0x33')][_0x29f1('0x37')]));_0xdc1ebf[_0x29f1('0x36')]=_0xdc1ebf[_0x29f1('0x36')][_0x29f1('0x38')]?_0xdc1ebf[_0x29f1('0x36')]:_0x3afed4[_0x29f1('0x32')];if(!_0x5bab33[_0x29f1('0x33')][_0x29f1('0x39')]('nolimit')){_0xdc1ebf['limit']=qs[_0x29f1('0x23')](_0x5bab33['query'][_0x29f1('0x23')]);_0xdc1ebf[_0x29f1('0x21')]=qs[_0x29f1('0x21')](_0x5bab33[_0x29f1('0x33')][_0x29f1('0x21')]);}_0xdc1ebf[_0x29f1('0x3a')]=qs['sort'](_0x5bab33['query']['sort']);_0xdc1ebf[_0x29f1('0x3b')]=qs[_0x29f1('0x35')](_[_0x29f1('0x3c')](_0x5bab33[_0x29f1('0x33')],_0x3afed4[_0x29f1('0x35')]),_0x46fcf9);if(_0x5bab33['query']['filter']){_0xdc1ebf[_0x29f1('0x3b')]=_['merge'](_0xdc1ebf[_0x29f1('0x3b')],{'$or':_[_0x29f1('0x3d')](_0x46fcf9,function(_0x4304e9){if(_0x4304e9[_0x29f1('0x31')]!=='VIRTUAL'){var _0x8f4057={};_0x8f4057[_0x4304e9['name']]={'$like':'%'+_0x5bab33[_0x29f1('0x33')][_0x29f1('0x3e')]+'%'};return _0x8f4057;}})});}_0xdc1ebf=_[_0x29f1('0x3f')]({},_0xdc1ebf,_0x5bab33[_0x29f1('0x40')]);var _0x15a4a2={'where':_0xdc1ebf[_0x29f1('0x3b')]};return db[_0x29f1('0x2e')][_0x29f1('0x41')](_0x15a4a2)['then'](function(_0x45f571){_0x93d8bb['count']=_0x45f571;if(_0x5bab33[_0x29f1('0x33')][_0x29f1('0x42')]){_0xdc1ebf[_0x29f1('0x43')]=[{'all':!![]}];}return db[_0x29f1('0x2e')]['findAll'](_0xdc1ebf);})[_0x29f1('0x28')](function(_0x536ebd){_0x93d8bb['rows']=_0x536ebd;return _0x93d8bb;})[_0x29f1('0x28')](respondWithFilteredResult(_0x26825e,_0xdc1ebf))[_0x29f1('0x44')](handleError(_0x26825e,null));};exports[_0x29f1('0x45')]=function(_0x38f7d8,_0xc4f756){var _0x51dcc1={'raw':!![],'where':{'id':_0x38f7d8[_0x29f1('0x46')]['id']}},_0x428111={};_0x428111[_0x29f1('0x32')]=_[_0x29f1('0x34')](db[_0x29f1('0x2e')][_0x29f1('0x2f')]);_0x428111[_0x29f1('0x33')]=_[_0x29f1('0x34')](_0x38f7d8[_0x29f1('0x33')]);_0x428111['filters']=_[_0x29f1('0x47')](_0x428111[_0x29f1('0x32')],_0x428111[_0x29f1('0x33')]);_0x51dcc1[_0x29f1('0x36')]=_[_0x29f1('0x47')](_0x428111[_0x29f1('0x32')],qs[_0x29f1('0x37')](_0x38f7d8['query'][_0x29f1('0x37')]));_0x51dcc1[_0x29f1('0x36')]=_0x51dcc1[_0x29f1('0x36')][_0x29f1('0x38')]?_0x51dcc1['attributes']:_0x428111[_0x29f1('0x32')];if(_0x38f7d8[_0x29f1('0x33')][_0x29f1('0x42')]){_0x51dcc1['include']=[{'all':!![]}];}_0x51dcc1=_['merge']({},_0x51dcc1,_0x38f7d8[_0x29f1('0x40')]);return db[_0x29f1('0x2e')][_0x29f1('0x48')](_0x51dcc1)[_0x29f1('0x28')](handleEntityNotFound(_0xc4f756,null))[_0x29f1('0x28')](respondWithResult(_0xc4f756,null))[_0x29f1('0x44')](handleError(_0xc4f756,null));};exports[_0x29f1('0x49')]=function(_0xd49b63,_0x180c13){return db['ChatInternalMessage'][_0x29f1('0x49')](_0xd49b63[_0x29f1('0x4a')],{})[_0x29f1('0x28')](respondWithResult(_0x180c13,0xc9))['catch'](handleError(_0x180c13,null));};exports[_0x29f1('0x26')]=function(_0x305cee,_0x1c102b){if(_0x305cee['body']['id']){delete _0x305cee['body']['id'];}return db[_0x29f1('0x2e')]['find']({'where':{'id':_0x305cee[_0x29f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c102b,null))['then'](saveUpdates(_0x305cee[_0x29f1('0x4a')],null))[_0x29f1('0x28')](respondWithResult(_0x1c102b,null))[_0x29f1('0x44')](handleError(_0x1c102b,null));};exports[_0x29f1('0x27')]=function(_0x18dc55,_0x4fdfcf){return db[_0x29f1('0x2e')]['find']({'where':{'id':_0x18dc55[_0x29f1('0x46')]['id']}})[_0x29f1('0x28')](handleEntityNotFound(_0x4fdfcf,null))[_0x29f1('0x28')](removeEntity(_0x4fdfcf,null))[_0x29f1('0x44')](handleError(_0x4fdfcf,null));};exports['describe']=function(_0x49e4c1,_0xbb8349){return db[_0x29f1('0x2e')]['describe']()[_0x29f1('0x28')](respondWithResult(_0xbb8349,null))['catch'](handleError(_0xbb8349,null));};function wrapUser(_0x1f1209){return function(_0x52650f){var _0x107c90=_0x1f1209[_0x29f1('0x4b')]({'plain':!![]});_0x107c90['messages']=[];if(_0x52650f){_0x107c90['lastMessageAt']=_0x52650f[_0x29f1('0x4c')];_0x107c90[_0x29f1('0x4d')]=_0x52650f;}else{_0x107c90[_0x29f1('0x4e')]=moment(0x0)[_0x29f1('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x107c90[_0x29f1('0x4d')]={};}return _0x107c90;};}exports[_0x29f1('0x50')]=function(_0x9aba43,_0x61e3bd,_0x48f020){var _0x55dee4=[];return db['User'][_0x29f1('0x51')]({'where':{'role':[_0x29f1('0x52'),_0x29f1('0x53'),_0x29f1('0x54')]},'attributes':['id',_0x29f1('0x55'),_0x29f1('0x2c'),'role',_0x29f1('0x56'),_0x29f1('0x57'),_0x29f1('0x58'),'lastLoginAt','allowmessenger',_0x29f1('0x59')],'order':qs['sort'](_0x29f1('0x5a')),'include':[{'model':db[_0x29f1('0x5b')],'as':_0x29f1('0x5c'),'attributes':['id',_0x29f1('0x2c'),_0x29f1('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x52b81e){if(_0x52b81e){var _0x29a663=_0x9aba43['user'][_0x29f1('0x4b')]({'plain':!![]});if(!_0x29a663)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29a663[_0x29f1('0x5d')]===_0x29f1('0x54')){return db['UserProfileSection'][_0x29f1('0x48')]({'where':{'name':_0x29f1('0x5e'),'userProfileId':_0x29a663['userProfileId']},'raw':!![]})[_0x29f1('0x28')](function(_0x5296cb){if(_0x5296cb){if(_0x5296cb[_0x29f1('0x5f')]===0x0){return db[_0x29f1('0x60')]['findAll']({'where':{'sectionId':_0x5296cb['id']},'raw':!![]})[_0x29f1('0x28')](function(_0x36542f){var _0x14b3a4=[];if(_[_0x29f1('0x61')](_0x36542f)){_0x14b3a4=_[_0x29f1('0x3e')](_0x52b81e,function(_0x2a0fa2){if(_0x2a0fa2[_0x29f1('0x5d')]!=='agent'){return _0x2a0fa2;}});return _0x14b3a4;}else{for(var _0x1946f3=0x0;_0x1946f3<_0x52b81e[_0x29f1('0x38')];_0x1946f3++){var _0x41b4f3=_0x52b81e[_0x1946f3];if(_0x41b4f3[_0x29f1('0x5d')]===_0x29f1('0x52')){var _0x52f4b2=_['find'](_0x36542f,function(_0x1a6124){return _0x1a6124[_0x29f1('0x62')]===_0x41b4f3['id'];});if(_0x52f4b2)_0x14b3a4[_0x29f1('0x63')](_0x41b4f3);}else{_0x14b3a4[_0x29f1('0x63')](_0x41b4f3);}}return _0x14b3a4;}});}else{return _0x52b81e;}}else{var _0xe11e19=_['filter'](_0x52b81e,function(_0x2f2b46){if(_0x2f2b46[_0x29f1('0x5d')]!==_0x29f1('0x52')){return _0x2f2b46;}});return _0xe11e19;}});}else{return _0x52b81e;}}})['then'](function(_0x507c4e){var _0x156041=[];if(_0x507c4e){_0x55dee4=_0x507c4e;for(var _0x27b647=0x0;_0x27b647<_0x507c4e[_0x29f1('0x38')];_0x27b647+=0x1){_0x55dee4[_0x27b647][_0x29f1('0x64')]=[];_0x156041[_0x29f1('0x63')](db[_0x29f1('0x2e')][_0x29f1('0x48')]({'where':{'FromId':[_0x9aba43[_0x29f1('0x54')]['id'],_0x507c4e[_0x27b647]['id']],'ToId':[_0x9aba43[_0x29f1('0x54')]['id'],_0x507c4e[_0x27b647]['id']],'ChatGroupId':null},'attributes':['id',_0x29f1('0x4c'),'FromId',_0x29f1('0x65'),_0x29f1('0x66'),_0x29f1('0x4a')],'order':qs['sort'](_0x29f1('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x29f1('0x28')](wrapUser(_0x507c4e[_0x27b647])));}return BPromise[_0x29f1('0x68')](_0x156041);}return[];})[_0x29f1('0x28')](function(_0x20037d){return{'rows':_0x20037d,'count':_0x20037d['length']};})['then'](respondWithResult(_0x61e3bd,null))[_0x29f1('0x44')](handleError(_0x61e3bd,null));}; \ No newline at end of file +var _0x4f06=['keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','get','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','createdAt','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x45dbe8,_0x28b94b){var _0x1a10d0=function(_0xf363bf){while(--_0xf363bf){_0x45dbe8['push'](_0x45dbe8['shift']());}};_0x1a10d0(++_0x28b94b);}(_0x4f06,0x11a));var _0x64f0=function(_0x4006aa,_0x4c5d79){_0x4006aa=_0x4006aa-0x0;var _0x2da188=_0x4f06[_0x4006aa];return _0x2da188;};'use strict';var emlformat=require(_0x64f0('0x0'));var rimraf=require(_0x64f0('0x1'));var zipdir=require(_0x64f0('0x2'));var jsonpatch=require(_0x64f0('0x3'));var rp=require(_0x64f0('0x4'));var moment=require('moment');var BPromise=require(_0x64f0('0x5'));var Mustache=require('mustache');var util=require(_0x64f0('0x6'));var path=require(_0x64f0('0x7'));var sox=require(_0x64f0('0x8'));var csv=require(_0x64f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64f0('0xa'));var squel=require(_0x64f0('0xb'));var crypto=require(_0x64f0('0xc'));var jsforce=require(_0x64f0('0xd'));var deskjs=require(_0x64f0('0xe'));var toCsv=require(_0x64f0('0x9'));var querystring=require(_0x64f0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x64f0('0x10'));var qs=require(_0x64f0('0x11'));var as=require(_0x64f0('0x12'));var hardwareService=require(_0x64f0('0x13'));var logger=require(_0x64f0('0x14'))(_0x64f0('0x15'));var utils=require(_0x64f0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64f0('0x17'))['db'];config[_0x64f0('0x18')]=_[_0x64f0('0x19')](config['redis'],{'host':_0x64f0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x64f0('0x1b'))[_0x64f0('0x1c')](socket);function respondWithStatusCode(_0x319b18,_0x42b754){_0x42b754=_0x42b754||0xcc;return function(_0xcf0e3b){if(_0xcf0e3b){return _0x319b18[_0x64f0('0x1d')](_0x42b754);}return _0x319b18[_0x64f0('0x1e')](_0x42b754)['end']();};}function respondWithResult(_0x16958f,_0x2e040a){_0x2e040a=_0x2e040a||0xc8;return function(_0x409fb1){if(_0x409fb1){return _0x16958f[_0x64f0('0x1e')](_0x2e040a)['json'](_0x409fb1);}};}function respondWithFilteredResult(_0x40a444,_0x158677){return function(_0x148428){if(_0x148428){var _0x343b3c=typeof _0x158677[_0x64f0('0x1f')]===_0x64f0('0x20')&&typeof _0x158677[_0x64f0('0x21')]===_0x64f0('0x20');var _0x2ff68a=_0x148428[_0x64f0('0x22')];var _0x2ccb2d=_0x343b3c?0x0:_0x158677[_0x64f0('0x1f')];var _0x2fd67a=_0x343b3c?_0x148428['count']:_0x158677['offset']+_0x158677['limit'];var _0x1ff527;if(_0x2fd67a>=_0x2ff68a){_0x2fd67a=_0x2ff68a;_0x1ff527=0xc8;}else{_0x1ff527=0xce;}_0x40a444[_0x64f0('0x1e')](_0x1ff527);return _0x40a444[_0x64f0('0x23')](_0x64f0('0x24'),_0x2ccb2d+'-'+_0x2fd67a+'/'+_0x2ff68a)['json'](_0x148428);}return null;};}function patchUpdates(_0x34177d){return function(_0x2fcfc1){try{jsonpatch[_0x64f0('0x25')](_0x2fcfc1,_0x34177d,!![]);}catch(_0x5c7dd1){return BPromise['reject'](_0x5c7dd1);}return _0x2fcfc1['save']();};}function saveUpdates(_0x394c6b,_0x2ba6aa){return function(_0x1e3638){if(_0x1e3638){return _0x1e3638['update'](_0x394c6b)[_0x64f0('0x26')](function(_0x24b9cc){return _0x24b9cc;});}return null;};}function removeEntity(_0x5a1105,_0x4b591e){return function(_0x52cd54){if(_0x52cd54){return _0x52cd54[_0x64f0('0x27')]()[_0x64f0('0x26')](function(){_0x5a1105[_0x64f0('0x1e')](0xcc)[_0x64f0('0x28')]();});}};}function handleEntityNotFound(_0x2b7ba9,_0x136c29){return function(_0x3e18cf){if(!_0x3e18cf){_0x2b7ba9[_0x64f0('0x1d')](0x194);}return _0x3e18cf;};}function handleError(_0x323fb3,_0x34dfaa){_0x34dfaa=_0x34dfaa||0x1f4;return function(_0x281a03){logger[_0x64f0('0x29')](_0x281a03['stack']);if(_0x281a03[_0x64f0('0x2a')]){delete _0x281a03[_0x64f0('0x2a')];}_0x323fb3[_0x64f0('0x1e')](_0x34dfaa)[_0x64f0('0x2b')](_0x281a03);};}exports['index']=function(_0x39d50f,_0xa9ac0a){var _0x5bdda0={},_0x5d268f={},_0xd04711={'count':0x0,'rows':[]};var _0x14ca84=_[_0x64f0('0x2c')](db['ChatInternalMessage'][_0x64f0('0x2d')],function(_0x1d1f76){return{'name':_0x1d1f76[_0x64f0('0x2e')],'type':_0x1d1f76[_0x64f0('0x2f')][_0x64f0('0x30')]};});_0x5d268f[_0x64f0('0x31')]=_[_0x64f0('0x2c')](_0x14ca84,'name');_0x5d268f[_0x64f0('0x32')]=_[_0x64f0('0x33')](_0x39d50f['query']);_0x5d268f['filters']=_[_0x64f0('0x34')](_0x5d268f['model'],_0x5d268f[_0x64f0('0x32')]);_0x5bdda0[_0x64f0('0x35')]=_[_0x64f0('0x34')](_0x5d268f[_0x64f0('0x31')],qs[_0x64f0('0x36')](_0x39d50f[_0x64f0('0x32')][_0x64f0('0x36')]));_0x5bdda0['attributes']=_0x5bdda0[_0x64f0('0x35')][_0x64f0('0x37')]?_0x5bdda0[_0x64f0('0x35')]:_0x5d268f[_0x64f0('0x31')];if(!_0x39d50f[_0x64f0('0x32')]['hasOwnProperty']('nolimit')){_0x5bdda0['limit']=qs[_0x64f0('0x21')](_0x39d50f[_0x64f0('0x32')][_0x64f0('0x21')]);_0x5bdda0['offset']=qs['offset'](_0x39d50f['query'][_0x64f0('0x1f')]);}_0x5bdda0[_0x64f0('0x38')]=qs[_0x64f0('0x39')](_0x39d50f[_0x64f0('0x32')][_0x64f0('0x39')]);_0x5bdda0[_0x64f0('0x3a')]=qs[_0x64f0('0x3b')](_[_0x64f0('0x3c')](_0x39d50f[_0x64f0('0x32')],_0x5d268f[_0x64f0('0x3b')]),_0x14ca84);if(_0x39d50f[_0x64f0('0x32')][_0x64f0('0x3d')]){_0x5bdda0[_0x64f0('0x3a')]=_[_0x64f0('0x3e')](_0x5bdda0[_0x64f0('0x3a')],{'$or':_[_0x64f0('0x2c')](_0x14ca84,function(_0xff02e3){if(_0xff02e3[_0x64f0('0x2f')]!==_0x64f0('0x3f')){var _0x48ba8c={};_0x48ba8c[_0xff02e3[_0x64f0('0x2a')]]={'$like':'%'+_0x39d50f['query'][_0x64f0('0x3d')]+'%'};return _0x48ba8c;}})});}_0x5bdda0=_[_0x64f0('0x3e')]({},_0x5bdda0,_0x39d50f[_0x64f0('0x40')]);var _0x319aef={'where':_0x5bdda0[_0x64f0('0x3a')]};return db[_0x64f0('0x41')][_0x64f0('0x22')](_0x319aef)[_0x64f0('0x26')](function(_0x5b3829){_0xd04711[_0x64f0('0x22')]=_0x5b3829;if(_0x39d50f[_0x64f0('0x32')][_0x64f0('0x42')]){_0x5bdda0[_0x64f0('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x64f0('0x44')](_0x5bdda0);})[_0x64f0('0x26')](function(_0x1f1358){_0xd04711[_0x64f0('0x45')]=_0x1f1358;return _0xd04711;})[_0x64f0('0x26')](respondWithFilteredResult(_0xa9ac0a,_0x5bdda0))[_0x64f0('0x46')](handleError(_0xa9ac0a,null));};exports[_0x64f0('0x47')]=function(_0x2e80df,_0x4414d4){var _0x5529d4={'raw':!![],'where':{'id':_0x2e80df[_0x64f0('0x48')]['id']}},_0x567f12={};_0x567f12[_0x64f0('0x31')]=_[_0x64f0('0x33')](db[_0x64f0('0x41')][_0x64f0('0x2d')]);_0x567f12[_0x64f0('0x32')]=_[_0x64f0('0x33')](_0x2e80df[_0x64f0('0x32')]);_0x567f12['filters']=_[_0x64f0('0x34')](_0x567f12['model'],_0x567f12[_0x64f0('0x32')]);_0x5529d4[_0x64f0('0x35')]=_[_0x64f0('0x34')](_0x567f12['model'],qs[_0x64f0('0x36')](_0x2e80df['query'][_0x64f0('0x36')]));_0x5529d4[_0x64f0('0x35')]=_0x5529d4['attributes']['length']?_0x5529d4[_0x64f0('0x35')]:_0x567f12[_0x64f0('0x31')];if(_0x2e80df[_0x64f0('0x32')][_0x64f0('0x42')]){_0x5529d4[_0x64f0('0x43')]=[{'all':!![]}];}_0x5529d4=_['merge']({},_0x5529d4,_0x2e80df['options']);return db[_0x64f0('0x41')]['find'](_0x5529d4)[_0x64f0('0x26')](handleEntityNotFound(_0x4414d4,null))[_0x64f0('0x26')](respondWithResult(_0x4414d4,null))[_0x64f0('0x46')](handleError(_0x4414d4,null));};exports[_0x64f0('0x49')]=function(_0x33aaaf,_0x79b489){return db[_0x64f0('0x41')][_0x64f0('0x49')](_0x33aaaf[_0x64f0('0x4a')],{})[_0x64f0('0x26')](respondWithResult(_0x79b489,0xc9))[_0x64f0('0x46')](handleError(_0x79b489,null));};exports['update']=function(_0x221fca,_0x162d12){if(_0x221fca[_0x64f0('0x4a')]['id']){delete _0x221fca[_0x64f0('0x4a')]['id'];}return db[_0x64f0('0x41')][_0x64f0('0x4b')]({'where':{'id':_0x221fca[_0x64f0('0x48')]['id']}})[_0x64f0('0x26')](handleEntityNotFound(_0x162d12,null))[_0x64f0('0x26')](saveUpdates(_0x221fca[_0x64f0('0x4a')],null))[_0x64f0('0x26')](respondWithResult(_0x162d12,null))['catch'](handleError(_0x162d12,null));};exports[_0x64f0('0x27')]=function(_0x25c27a,_0x321031){return db[_0x64f0('0x41')][_0x64f0('0x4b')]({'where':{'id':_0x25c27a[_0x64f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x321031,null))[_0x64f0('0x26')](removeEntity(_0x321031,null))[_0x64f0('0x46')](handleError(_0x321031,null));};exports[_0x64f0('0x4c')]=function(_0x4f8884,_0x1b25e0){return db[_0x64f0('0x41')]['describe']()['then'](respondWithResult(_0x1b25e0,null))[_0x64f0('0x46')](handleError(_0x1b25e0,null));};function wrapUser(_0x20e3ee){return function(_0x29f0f4){var _0xf4cdc3=_0x20e3ee[_0x64f0('0x4d')]({'plain':!![]});_0xf4cdc3[_0x64f0('0x4e')]=[];if(_0x29f0f4){_0xf4cdc3['lastMessageAt']=_0x29f0f4['createdAt'];_0xf4cdc3[_0x64f0('0x4f')]=_0x29f0f4;}else{_0xf4cdc3[_0x64f0('0x50')]=moment(0x0)[_0x64f0('0x51')](_0x64f0('0x52'));_0xf4cdc3[_0x64f0('0x4f')]={};}return _0xf4cdc3;};}exports[_0x64f0('0x53')]=function(_0x4a7a93,_0xff13a,_0x598977){var _0x3424ae=[];return db[_0x64f0('0x54')]['findAll']({'where':{'role':['agent',_0x64f0('0x55'),_0x64f0('0x56')]},'attributes':['id',_0x64f0('0x57'),'name','role',_0x64f0('0x58'),'internal',_0x64f0('0x59'),_0x64f0('0x5a'),_0x64f0('0x5b'),_0x64f0('0x5c')],'order':qs['sort'](_0x64f0('0x5d')),'include':[{'model':db[_0x64f0('0x5e')],'as':_0x64f0('0x5f'),'attributes':['id','name',_0x64f0('0x2f')],'through':{'attributes':[]}}]})[_0x64f0('0x26')](function(_0x33ebee){if(_0x33ebee){var _0x12e256=_0x4a7a93[_0x64f0('0x56')][_0x64f0('0x4d')]({'plain':!![]});if(!_0x12e256)throw new Error(_0x64f0('0x60'));if(_0x12e256[_0x64f0('0x61')]==='user'){return db[_0x64f0('0x62')][_0x64f0('0x4b')]({'where':{'name':'Agents','userProfileId':_0x12e256[_0x64f0('0x63')]},'raw':!![]})[_0x64f0('0x26')](function(_0x869f61){if(_0x869f61){if(_0x869f61[_0x64f0('0x64')]===0x0){return db[_0x64f0('0x65')][_0x64f0('0x44')]({'where':{'sectionId':_0x869f61['id']},'raw':!![]})[_0x64f0('0x26')](function(_0x23c1f6){var _0xed973f=[];if(_[_0x64f0('0x66')](_0x23c1f6)){_0xed973f=_[_0x64f0('0x3d')](_0x33ebee,function(_0x133656){if(_0x133656[_0x64f0('0x61')]!=='agent'){return _0x133656;}});return _0xed973f;}else{for(var _0x1ca818=0x0;_0x1ca818<_0x33ebee[_0x64f0('0x37')];_0x1ca818++){var _0x2fde4c=_0x33ebee[_0x1ca818];if(_0x2fde4c['role']===_0x64f0('0x67')){var _0x25afef=_['find'](_0x23c1f6,function(_0x4c5106){return _0x4c5106[_0x64f0('0x68')]===_0x2fde4c['id'];});if(_0x25afef)_0xed973f['push'](_0x2fde4c);}else{_0xed973f[_0x64f0('0x69')](_0x2fde4c);}}return _0xed973f;}});}else{return _0x33ebee;}}else{var _0x3b85fa=_[_0x64f0('0x3d')](_0x33ebee,function(_0x2b9ace){if(_0x2b9ace[_0x64f0('0x61')]!==_0x64f0('0x67')){return _0x2b9ace;}});return _0x3b85fa;}});}else{return _0x33ebee;}}})['then'](function(_0x113cb5){var _0x2e3f3d=[];if(_0x113cb5){_0x3424ae=_0x113cb5;for(var _0x45105e=0x0;_0x45105e<_0x113cb5[_0x64f0('0x37')];_0x45105e+=0x1){_0x3424ae[_0x45105e][_0x64f0('0x4e')]=[];_0x2e3f3d[_0x64f0('0x69')](db[_0x64f0('0x41')][_0x64f0('0x4b')]({'where':{'FromId':[_0x4a7a93[_0x64f0('0x56')]['id'],_0x113cb5[_0x45105e]['id']],'ToId':[_0x4a7a93[_0x64f0('0x56')]['id'],_0x113cb5[_0x45105e]['id']],'ChatGroupId':null},'attributes':['id',_0x64f0('0x6a'),_0x64f0('0x6b'),_0x64f0('0x6c'),_0x64f0('0x6d'),_0x64f0('0x4a')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x113cb5[_0x45105e])));}return BPromise[_0x64f0('0x6e')](_0x2e3f3d);}return[];})[_0x64f0('0x26')](function(_0x4c938b){return{'rows':_0x4c938b,'count':_0x4c938b[_0x64f0('0x37')]};})[_0x64f0('0x26')](respondWithResult(_0xff13a,null))['catch'](handleError(_0xff13a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3aacfc2..cd4636f 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 _0x083f=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4e6cfc,_0x524247){var _0x2806bb=function(_0x23c863){while(--_0x23c863){_0x4e6cfc['push'](_0x4e6cfc['shift']());}};_0x2806bb(++_0x524247);}(_0x083f,0xd1));var _0xf083=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x083f[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xf083('0x0'));var ChatInternalMessage=require(_0xf083('0x1'))['db'][_0xf083('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf083('0x3')](0x0);var events={'afterCreate':_0xf083('0x4'),'afterUpdate':_0xf083('0x5'),'afterDestroy':_0xf083('0x6')};function emitEvent(_0x38f7e6){return function(_0x374f86,_0x1e47dd,_0x338bb0){ChatInternalMessageEvents[_0xf083('0x7')](_0x38f7e6+':'+_0x374f86['id'],_0x374f86);ChatInternalMessageEvents[_0xf083('0x7')](_0x38f7e6,_0x374f86);_0x338bb0(null);};}for(var e in events){if(events[_0xf083('0x8')](e)){var event=events[e];ChatInternalMessage[_0xf083('0x9')](e,emitEvent(event));}}module[_0xf083('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xf894=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0xf894,0xfd));var _0x4f89=function(_0x26d67c,_0x2a0d3d){_0x26d67c=_0x26d67c-0x0;var _0x143f3c=_0xf894[_0x26d67c];return _0x143f3c;};'use strict';var EventEmitter=require(_0x4f89('0x0'));var ChatInternalMessage=require(_0x4f89('0x1'))['db'][_0x4f89('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4f89('0x3')](0x0);var events={'afterCreate':_0x4f89('0x4'),'afterUpdate':_0x4f89('0x5'),'afterDestroy':_0x4f89('0x6')};function emitEvent(_0x1bfd64){return function(_0x2c2f5a,_0x297f74,_0x2f2d59){ChatInternalMessageEvents[_0x4f89('0x7')](_0x1bfd64+':'+_0x2c2f5a['id'],_0x2c2f5a);ChatInternalMessageEvents[_0x4f89('0x7')](_0x1bfd64,_0x2c2f5a);_0x2f2d59(null);};}for(var e in events){if(events[_0x4f89('0x8')](e)){var event=events[e];ChatInternalMessage[_0x4f89('0x9')](e,emitEvent(event));}}module[_0x4f89('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 94b8ebd..5117ec5 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 _0x4ef5=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','chat_internal_messages'];(function(_0x1dc029,_0x40ea99){var _0x1fdaa3=function(_0x37de31){while(--_0x37de31){_0x1dc029['push'](_0x1dc029['shift']());}};_0x1fdaa3(++_0x40ea99);}(_0x4ef5,0x109));var _0x54ef=function(_0x1ec7b3,_0x14211c){_0x1ec7b3=_0x1ec7b3-0x0;var _0x315f31=_0x4ef5[_0x1ec7b3];return _0x315f31;};'use strict';var _=require(_0x54ef('0x0'));var util=require(_0x54ef('0x1'));var logger=require(_0x54ef('0x2'))(_0x54ef('0x3'));var moment=require('moment');var BPromise=require(_0x54ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54ef('0x5'));var config=require(_0x54ef('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x54ef('0x7')]=function(_0x39002b,_0x48e90e){return _0x39002b[_0x54ef('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x54ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x54ef('0xa')});}; \ No newline at end of file +var _0xacf8=['request-promise','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x13a09a,_0x1abff5){var _0x499838=function(_0x292a9b){while(--_0x292a9b){_0x13a09a['push'](_0x13a09a['shift']());}};_0x499838(++_0x1abff5);}(_0xacf8,0xe5));var _0x8acf=function(_0x35a384,_0x1e102e){_0x35a384=_0x35a384-0x0;var _0x3d6e8e=_0xacf8[_0x35a384];return _0x3d6e8e;};'use strict';var _=require(_0x8acf('0x0'));var util=require(_0x8acf('0x1'));var logger=require('../../config/logger')(_0x8acf('0x2'));var moment=require(_0x8acf('0x3'));var BPromise=require(_0x8acf('0x4'));var rp=require(_0x8acf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8acf('0x6'));var attributes=require(_0x8acf('0x7'));module['exports']=function(_0x313306,_0x317d00){return _0x313306[_0x8acf('0x8')](_0x8acf('0x9'),attributes,{'tableName':_0x8acf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8acf('0xb'),'collate':_0x8acf('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9aa93dc..32cb4d4 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 _0xfafd=['then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x1ff17d,_0x375a19){var _0xf4280f=function(_0x5b0e52){while(--_0x5b0e52){_0x1ff17d['push'](_0x1ff17d['shift']());}};_0xf4280f(++_0x375a19);}(_0xfafd,0xcc));var _0xdfaf=function(_0x10a841,_0x587cf2){_0x10a841=_0x10a841-0x0;var _0xbbfbb0=_0xfafd[_0x10a841];return _0xbbfbb0;};'use strict';var _=require('lodash');var util=require(_0xdfaf('0x0'));var moment=require(_0xdfaf('0x1'));var BPromise=require(_0xdfaf('0x2'));var rs=require(_0xdfaf('0x3'));var fs=require('fs');var Redis=require(_0xdfaf('0x4'));var db=require(_0xdfaf('0x5'))['db'];var utils=require(_0xdfaf('0x6'));var logger=require(_0xdfaf('0x7'))(_0xdfaf('0x8'));var config=require(_0xdfaf('0x9'));var jayson=require(_0xdfaf('0xa'));var client=jayson[_0xdfaf('0xb')][_0xdfaf('0xc')]({'port':0x232a});config[_0xdfaf('0xd')]=_[_0xdfaf('0xe')](config['redis'],{'host':_0xdfaf('0xf'),'port':0x18eb});var socket=require(_0xdfaf('0x10'))(new Redis(config[_0xdfaf('0xd')]));require(_0xdfaf('0x11'))[_0xdfaf('0x12')](socket);function respondWithRpcPromise(_0x23712a,_0x466923,_0x26fd47){return new BPromise(function(_0x5092d6,_0x3747ce){return client[_0xdfaf('0x13')](_0x23712a,_0x26fd47)[_0xdfaf('0x14')](function(_0x42ea9f){logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,_0xdfaf('0x16'));logger[_0xdfaf('0x17')](_0xdfaf('0x18'),_0x466923,_0xdfaf('0x16'),JSON[_0xdfaf('0x19')](_0x42ea9f));if(_0x42ea9f[_0xdfaf('0x1a')]){if(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1b')]===0x1f4){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x42ea9f['error'][_0xdfaf('0x1d')]);return _0x3747ce(_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);}logger['error'](_0xdfaf('0x1c'),_0x466923,_0x42ea9f[_0xdfaf('0x1a')][_0xdfaf('0x1d')]);return _0x5092d6(_0x42ea9f['error']['message']);}else{logger[_0xdfaf('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x466923,'request\x20sent');_0x5092d6(_0x42ea9f[_0xdfaf('0x1e')][_0xdfaf('0x1d')]);}})[_0xdfaf('0x1f')](function(_0x120e5d){logger[_0xdfaf('0x1a')](_0xdfaf('0x1c'),_0x466923,_0x120e5d);_0x3747ce(_0x120e5d);});});} \ No newline at end of file +var _0x98ac=['stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x98ac,0x1d1));var _0xc98a=function(_0x9ba64a,_0x4943c3){_0x9ba64a=_0x9ba64a-0x0;var _0x121ec8=_0x98ac[_0x9ba64a];return _0x121ec8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc98a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc98a('0x1'));var db=require(_0xc98a('0x2'))['db'];var utils=require(_0xc98a('0x3'));var logger=require(_0xc98a('0x4'))(_0xc98a('0x5'));var config=require('../../config/environment');var jayson=require(_0xc98a('0x6'));var client=jayson[_0xc98a('0x7')]['http']({'port':0x232a});config[_0xc98a('0x8')]=_[_0xc98a('0x9')](config[_0xc98a('0x8')],{'host':_0xc98a('0xa'),'port':0x18eb});var socket=require(_0xc98a('0xb'))(new Redis(config[_0xc98a('0x8')]));require(_0xc98a('0xc'))['register'](socket);function respondWithRpcPromise(_0x4f7cdd,_0x53f259,_0x3c042b){return new BPromise(function(_0x43a7ba,_0x90b582){return client['request'](_0x4f7cdd,_0x3c042b)['then'](function(_0x9920){logger[_0xc98a('0xd')](_0xc98a('0xe'),_0x53f259,_0xc98a('0xf'));logger[_0xc98a('0x10')](_0xc98a('0x11'),_0x53f259,_0xc98a('0xf'),JSON[_0xc98a('0x12')](_0x9920));if(_0x9920[_0xc98a('0x13')]){if(_0x9920['error'][_0xc98a('0x14')]===0x1f4){logger[_0xc98a('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x53f259,_0x9920[_0xc98a('0x13')][_0xc98a('0x15')]);return _0x90b582(_0x9920[_0xc98a('0x13')]['message']);}logger[_0xc98a('0x13')](_0xc98a('0xe'),_0x53f259,_0x9920[_0xc98a('0x13')][_0xc98a('0x15')]);return _0x43a7ba(_0x9920['error'][_0xc98a('0x15')]);}else{logger[_0xc98a('0xd')](_0xc98a('0xe'),_0x53f259,'request\x20sent');_0x43a7ba(_0x9920['result']['message']);}})[_0xc98a('0x16')](function(_0x1e8b99){logger[_0xc98a('0x13')](_0xc98a('0xe'),_0x53f259,_0x1e8b99);_0x90b582(_0x1e8b99);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7e95ad5..216c9de 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 _0xbf03=['emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x293274,_0x1f9041){var _0x21730e=function(_0x56fc27){while(--_0x56fc27){_0x293274['push'](_0x293274['shift']());}};_0x21730e(++_0x1f9041);}(_0xbf03,0x66));var _0x3bf0=function(_0x196822,_0x3658d1){_0x196822=_0x196822-0x0;var _0x14338a=_0xbf03[_0x196822];return _0x14338a;};'use strict';var ChatInternalMessageEvents=require(_0x3bf0('0x0'));var events=[_0x3bf0('0x1'),_0x3bf0('0x2'),'update'];function createListener(_0x3b9e90,_0x3a7d5b){return function(_0x4b47f6){_0x3a7d5b[_0x3bf0('0x3')](_0x3b9e90,_0x4b47f6);};}function removeListener(_0x43da41,_0x95db4){return function(){ChatInternalMessageEvents[_0x3bf0('0x4')](_0x43da41,_0x95db4);};}exports['register']=function(_0x5e1e24){for(var _0x23329e=0x0,_0x3fbd24=events[_0x3bf0('0x5')];_0x23329e<_0x3fbd24;_0x23329e++){var _0x1cd001=events[_0x23329e];var _0x4457b2=createListener(_0x3bf0('0x6')+_0x1cd001,_0x5e1e24);ChatInternalMessageEvents['on'](_0x1cd001,_0x4457b2);}}; \ No newline at end of file +var _0x482a=['chatInternalMessage:','save','remove','update','emit','removeListener','length'];(function(_0x4be634,_0x2b1a67){var _0x2df900=function(_0x4fabea){while(--_0x4fabea){_0x4be634['push'](_0x4be634['shift']());}};_0x2df900(++_0x2b1a67);}(_0x482a,0xcc));var _0xa482=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x482a[_0x4a53d];return _0x27410e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xa482('0x0'),_0xa482('0x1'),_0xa482('0x2')];function createListener(_0x355e47,_0x7ecf7b){return function(_0x4e1c69){_0x7ecf7b[_0xa482('0x3')](_0x355e47,_0x4e1c69);};}function removeListener(_0x23f991,_0x3342d3){return function(){ChatInternalMessageEvents[_0xa482('0x4')](_0x23f991,_0x3342d3);};}exports['register']=function(_0x5350d6){for(var _0x34056c=0x0,_0x7b5904=events[_0xa482('0x5')];_0x34056c<_0x7b5904;_0x34056c++){var _0x35aa30=events[_0x34056c];var _0x37ef5c=createListener(_0xa482('0x6')+_0x35aa30,_0x5350d6);ChatInternalMessageEvents['on'](_0x35aa30,_0x37ef5c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1a31e5d..d58a8b6 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 _0xf061=['get','isAuthenticated','index','/describe','describe','/:id','post','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf061,0x1a7));var _0x1f06=function(_0x1949eb,_0x4a899d){_0x1949eb=_0x1949eb-0x0;var _0x496bdd=_0xf061[_0x1949eb];return _0x496bdd;};'use strict';var multer=require(_0x1f06('0x0'));var util=require(_0x1f06('0x1'));var path=require(_0x1f06('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f06('0x3'));var router=express[_0x1f06('0x4')]();var fs_extra=require(_0x1f06('0x5'));var auth=require(_0x1f06('0x6'));var interaction=require(_0x1f06('0x7'));var config=require(_0x1f06('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x1f06('0x9')]('/',auth[_0x1f06('0xa')](),controller[_0x1f06('0xb')]);router[_0x1f06('0x9')](_0x1f06('0xc'),auth['isAuthenticated'](),controller[_0x1f06('0xd')]);router[_0x1f06('0x9')]('/users',auth[_0x1f06('0xa')](),controller['getUsers']);router[_0x1f06('0x9')](_0x1f06('0xe'),auth[_0x1f06('0xa')](),controller['show']);router[_0x1f06('0xf')]('/',auth[_0x1f06('0xa')](),controller['create']);router['put']('/:id',controller['update']);router[_0x1f06('0x10')](_0x1f06('0xe'),auth[_0x1f06('0xa')](),controller[_0x1f06('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4c1b=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','describe','get','/users','getUsers','/:id'];(function(_0x598ec6,_0x17113e){var _0x54de2d=function(_0x11889e){while(--_0x11889e){_0x598ec6['push'](_0x598ec6['shift']());}};_0x54de2d(++_0x17113e);}(_0x4c1b,0x1c8));var _0xb4c1=function(_0x14fbf9,_0x34e93d){_0x14fbf9=_0x14fbf9-0x0;var _0x11197b=_0x4c1b[_0x14fbf9];return _0x11197b;};'use strict';var multer=require(_0xb4c1('0x0'));var util=require(_0xb4c1('0x1'));var path=require(_0xb4c1('0x2'));var timeout=require(_0xb4c1('0x3'));var express=require(_0xb4c1('0x4'));var router=express[_0xb4c1('0x5')]();var fs_extra=require(_0xb4c1('0x6'));var auth=require(_0xb4c1('0x7'));var interaction=require(_0xb4c1('0x8'));var config=require(_0xb4c1('0x9'));var controller=require(_0xb4c1('0xa'));router['get']('/',auth[_0xb4c1('0xb')](),controller[_0xb4c1('0xc')]);router['get'](_0xb4c1('0xd'),auth[_0xb4c1('0xb')](),controller[_0xb4c1('0xe')]);router[_0xb4c1('0xf')](_0xb4c1('0x10'),auth[_0xb4c1('0xb')](),controller[_0xb4c1('0x11')]);router['get'](_0xb4c1('0x12'),auth[_0xb4c1('0xb')](),controller['show']);router[_0xb4c1('0x13')]('/',auth[_0xb4c1('0xb')](),controller[_0xb4c1('0x14')]);router['put'](_0xb4c1('0x12'),controller[_0xb4c1('0x15')]);router[_0xb4c1('0x16')](_0xb4c1('0x12'),auth['isAuthenticated'](),controller[_0xb4c1('0x17')]);module[_0xb4c1('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 09e4e54..769b93b 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 _0x73a1=['medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x73a1,0x161));var _0x173a=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x73a1[_0x40dd56];return _0x4f850f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x173a('0x0')](_0x173a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x173a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x173a('0x3')]('in',_0x173a('0x4')),'defaultValue':_0x173a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x173a('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file +var _0xe5fb=['medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe5fb,0xce));var _0xbe5f=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xe5fb[_0x3c51d4];return _0x53c45f;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbe5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbe5f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbe5f('0x4')),'defaultValue':_0xbe5f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbe5f('0x5')]},'providerName':{'type':Sequelize[_0xbe5f('0x6')]},'providerResponse':{'type':Sequelize[_0xbe5f('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fd88129..f0356d5 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 _0x8972=['reject','then','destroy','end','sendStatus','stack','name','index','map','ChatMessage','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','update','body','describe','chat-interactions','accept','chat','read','format','user','agent','UserId','get','ChatInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','internal','channel','motionChannel','event','EventManager','parse','formData','ChatInteractionId','RejectMessage','rejectMessage','Sequelize','contact','fullname','email','interface','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x52a80a,_0x1442d1){var _0x500083=function(_0xf0454a){while(--_0xf0454a){_0x52a80a['push'](_0x52a80a['shift']());}};_0x500083(++_0x1442d1);}(_0x8972,0xd8));var _0x2897=function(_0x2039ef,_0x51e049){_0x2039ef=_0x2039ef-0x0;var _0x1012c7=_0x8972[_0x2039ef];return _0x1012c7;};'use strict';var emlformat=require(_0x2897('0x0'));var rimraf=require(_0x2897('0x1'));var zipdir=require(_0x2897('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2897('0x3'));var moment=require(_0x2897('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2897('0x5'));var util=require(_0x2897('0x6'));var path=require(_0x2897('0x7'));var sox=require(_0x2897('0x8'));var csv=require(_0x2897('0x9'));var ejs=require(_0x2897('0xa'));var fs=require('fs');var fs_extra=require(_0x2897('0xb'));var _=require(_0x2897('0xc'));var squel=require(_0x2897('0xd'));var crypto=require(_0x2897('0xe'));var jsforce=require(_0x2897('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2897('0x10'));var Papa=require('papaparse');var Redis=require(_0x2897('0x11'));var authService=require(_0x2897('0x12'));var qs=require(_0x2897('0x13'));var as=require(_0x2897('0x14'));var hardwareService=require(_0x2897('0x15'));var logger=require(_0x2897('0x16'))(_0x2897('0x17'));var utils=require('../../config/utils');var config=require(_0x2897('0x18'));var licenseUtil=require(_0x2897('0x19'));var db=require(_0x2897('0x1a'))['db'];config[_0x2897('0x1b')]=_[_0x2897('0x1c')](config['redis'],{'host':_0x2897('0x1d'),'port':0x18eb});var socket=require(_0x2897('0x1e'))(new Redis(config[_0x2897('0x1b')]));require(_0x2897('0x1f'))[_0x2897('0x20')](socket);var jayson=require(_0x2897('0x21'));var client=jayson['client'][_0x2897('0x22')]({'port':0x232c});var client9002=jayson[_0x2897('0x23')][_0x2897('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x22e07c,_0x3eedaf,_0x3cb4e9,_0x48aeed){return new BPromise(function(_0x33d48d,_0x1437cf){var _0x30215c=_0x48aeed||client;return _0x30215c['request'](_0x22e07c,_0x3cb4e9)['then'](function(_0x1c93a8){logger[_0x2897('0x24')](_0x2897('0x25'),_0x3eedaf,_0x2897('0x26'));logger[_0x2897('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3eedaf,'request\x20sent',JSON[_0x2897('0x28')](_0x1c93a8));if(_0x1c93a8[_0x2897('0x29')]){if(_0x1c93a8['error'][_0x2897('0x2a')]===0x1f4){logger[_0x2897('0x29')]('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x1c93a8[_0x2897('0x29')]['message']);return _0x1437cf(_0x1c93a8[_0x2897('0x29')][_0x2897('0x2b')]);}logger[_0x2897('0x29')](_0x2897('0x25'),_0x3eedaf,_0x1c93a8['error'][_0x2897('0x2b')]);return _0x33d48d(_0x1c93a8['error'][_0x2897('0x2b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x2897('0x26'));_0x33d48d(_0x1c93a8[_0x2897('0x2c')][_0x2897('0x2b')]);}})[_0x2897('0x2d')](function(_0x4857ff){logger[_0x2897('0x29')]('ChatMessage,\x20%s,\x20%s',_0x3eedaf,_0x4857ff);_0x1437cf(_0x4857ff);});});}function respondWithStatusCode(_0x5e25e9,_0x4e62ac){_0x4e62ac=_0x4e62ac||0xcc;return function(_0x37a20e){if(_0x37a20e){return _0x5e25e9['sendStatus'](_0x4e62ac);}return _0x5e25e9[_0x2897('0x2e')](_0x4e62ac)['end']();};}function respondWithResult(_0x5ed7b5,_0x50d045){_0x50d045=_0x50d045||0xc8;return function(_0x4f8c12){if(_0x4f8c12){return _0x5ed7b5[_0x2897('0x2e')](_0x50d045)[_0x2897('0x2f')](_0x4f8c12);}};}function respondWithFilteredResult(_0x942599,_0x84bc74){return function(_0x3bb17d){if(_0x3bb17d){var _0x8c4c32=typeof _0x84bc74[_0x2897('0x30')]===_0x2897('0x31')&&typeof _0x84bc74[_0x2897('0x32')]===_0x2897('0x31');var _0x1680be=_0x3bb17d[_0x2897('0x33')];var _0x41c6b9=_0x8c4c32?0x0:_0x84bc74[_0x2897('0x30')];var _0x4b9e54=_0x8c4c32?_0x3bb17d['count']:_0x84bc74[_0x2897('0x30')]+_0x84bc74[_0x2897('0x32')];var _0x13d7ec;if(_0x4b9e54>=_0x1680be){_0x4b9e54=_0x1680be;_0x13d7ec=0xc8;}else{_0x13d7ec=0xce;}_0x942599[_0x2897('0x2e')](_0x13d7ec);return _0x942599[_0x2897('0x34')](_0x2897('0x35'),_0x41c6b9+'-'+_0x4b9e54+'/'+_0x1680be)[_0x2897('0x2f')](_0x3bb17d);}return null;};}function patchUpdates(_0x5d1623){return function(_0x3a0049){try{jsonpatch['apply'](_0x3a0049,_0x5d1623,!![]);}catch(_0x27f033){return BPromise[_0x2897('0x36')](_0x27f033);}return _0x3a0049['save']();};}function saveUpdates(_0x4aba66,_0x134177){return function(_0x329dd2){if(_0x329dd2){return _0x329dd2['update'](_0x4aba66)[_0x2897('0x37')](function(_0x12f023){return _0x12f023;});}return null;};}function removeEntity(_0x407523,_0x4ec2a6){return function(_0x4a7a4e){if(_0x4a7a4e){return _0x4a7a4e[_0x2897('0x38')]()[_0x2897('0x37')](function(){_0x407523['status'](0xcc)[_0x2897('0x39')]();});}};}function handleEntityNotFound(_0x42f789,_0x4408d6){return function(_0x26bff9){if(!_0x26bff9){_0x42f789[_0x2897('0x3a')](0x194);}return _0x26bff9;};}function handleError(_0x1eb0e6,_0x3d8632){_0x3d8632=_0x3d8632||0x1f4;return function(_0x13ec7c){logger[_0x2897('0x29')](_0x13ec7c[_0x2897('0x3b')]);if(_0x13ec7c[_0x2897('0x3c')]){delete _0x13ec7c[_0x2897('0x3c')];}_0x1eb0e6['status'](_0x3d8632)['send'](_0x13ec7c);};}exports[_0x2897('0x3d')]=function(_0x1957e3,_0x457009){var _0x3d1ecb={},_0x30b6ec={},_0x3eea82={'count':0x0,'rows':[]};var _0x11c9a7=_[_0x2897('0x3e')](db[_0x2897('0x3f')]['rawAttributes'],function(_0x5ded23){return{'name':_0x5ded23['fieldName'],'type':_0x5ded23[_0x2897('0x40')][_0x2897('0x41')]};});_0x30b6ec[_0x2897('0x42')]=_[_0x2897('0x3e')](_0x11c9a7,_0x2897('0x3c'));_0x30b6ec['query']=_[_0x2897('0x43')](_0x1957e3[_0x2897('0x44')]);_0x30b6ec[_0x2897('0x45')]=_[_0x2897('0x46')](_0x30b6ec[_0x2897('0x42')],_0x30b6ec[_0x2897('0x44')]);_0x3d1ecb[_0x2897('0x47')]=_['intersection'](_0x30b6ec[_0x2897('0x42')],qs[_0x2897('0x48')](_0x1957e3[_0x2897('0x44')]['fields']));_0x3d1ecb[_0x2897('0x47')]=_0x3d1ecb['attributes']['length']?_0x3d1ecb[_0x2897('0x47')]:_0x30b6ec['model'];if(!_0x1957e3[_0x2897('0x44')][_0x2897('0x49')](_0x2897('0x4a'))){_0x3d1ecb[_0x2897('0x32')]=qs['limit'](_0x1957e3[_0x2897('0x44')][_0x2897('0x32')]);_0x3d1ecb[_0x2897('0x30')]=qs[_0x2897('0x30')](_0x1957e3['query'][_0x2897('0x30')]);}_0x3d1ecb[_0x2897('0x4b')]=qs[_0x2897('0x4c')](_0x1957e3[_0x2897('0x44')][_0x2897('0x4c')]);_0x3d1ecb[_0x2897('0x4d')]=qs[_0x2897('0x45')](_[_0x2897('0x4e')](_0x1957e3[_0x2897('0x44')],_0x30b6ec[_0x2897('0x45')]),_0x11c9a7);if(_0x1957e3[_0x2897('0x44')][_0x2897('0x4f')]){_0x3d1ecb['where']=_[_0x2897('0x50')](_0x3d1ecb[_0x2897('0x4d')],{'$or':_['map'](_0x11c9a7,function(_0x241830){if(_0x241830[_0x2897('0x40')]!==_0x2897('0x51')){var _0x1d4e4f={};_0x1d4e4f[_0x241830['name']]={'$like':'%'+_0x1957e3['query'][_0x2897('0x4f')]+'%'};return _0x1d4e4f;}})});}_0x3d1ecb=_[_0x2897('0x50')]({},_0x3d1ecb,_0x1957e3['options']);var _0x51e972={'where':_0x3d1ecb[_0x2897('0x4d')]};return db[_0x2897('0x3f')]['count'](_0x51e972)[_0x2897('0x37')](function(_0x18397a){_0x3eea82['count']=_0x18397a;if(_0x1957e3[_0x2897('0x44')][_0x2897('0x52')]){_0x3d1ecb[_0x2897('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0x2897('0x54')](_0x3d1ecb);})[_0x2897('0x37')](function(_0x4ae4aa){_0x3eea82[_0x2897('0x55')]=_0x4ae4aa;return _0x3eea82;})['then'](respondWithFilteredResult(_0x457009,_0x3d1ecb))[_0x2897('0x2d')](handleError(_0x457009,null));};exports[_0x2897('0x56')]=function(_0x4dc412,_0x1820ed){var _0x4582e3={'raw':!![],'where':{'id':_0x4dc412[_0x2897('0x57')]['id']}},_0x1d6610={};_0x1d6610[_0x2897('0x42')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x1d6610[_0x2897('0x44')]=_[_0x2897('0x43')](_0x4dc412['query']);_0x1d6610[_0x2897('0x45')]=_[_0x2897('0x46')](_0x1d6610['model'],_0x1d6610[_0x2897('0x44')]);_0x4582e3[_0x2897('0x47')]=_[_0x2897('0x46')](_0x1d6610['model'],qs[_0x2897('0x48')](_0x4dc412['query'][_0x2897('0x48')]));_0x4582e3[_0x2897('0x47')]=_0x4582e3['attributes'][_0x2897('0x58')]?_0x4582e3[_0x2897('0x47')]:_0x1d6610[_0x2897('0x42')];if(_0x4dc412[_0x2897('0x44')][_0x2897('0x52')]){_0x4582e3[_0x2897('0x53')]=[{'all':!![]}];}_0x4582e3=_[_0x2897('0x50')]({},_0x4582e3,_0x4dc412[_0x2897('0x59')]);return db['ChatMessage'][_0x2897('0x5a')](_0x4582e3)[_0x2897('0x37')](handleEntityNotFound(_0x1820ed,null))[_0x2897('0x37')](respondWithResult(_0x1820ed,null))[_0x2897('0x2d')](handleError(_0x1820ed,null));};exports[_0x2897('0x5b')]=function(_0x48b038,_0x24dc97){return db[_0x2897('0x3f')]['create'](_0x48b038['body'],{})[_0x2897('0x37')](respondWithResult(_0x24dc97,0xc9))['catch'](handleError(_0x24dc97,null));};exports[_0x2897('0x5c')]=function(_0x4d8af6,_0xc43214){if(_0x4d8af6[_0x2897('0x5d')]['id']){delete _0x4d8af6['body']['id'];}return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x4d8af6[_0x2897('0x57')]['id']}})[_0x2897('0x37')](handleEntityNotFound(_0xc43214,null))['then'](saveUpdates(_0x4d8af6[_0x2897('0x5d')],null))['then'](respondWithResult(_0xc43214,null))[_0x2897('0x2d')](handleError(_0xc43214,null));};exports[_0x2897('0x38')]=function(_0x3eb982,_0x1ef863){return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x3eb982['params']['id']}})[_0x2897('0x37')](handleEntityNotFound(_0x1ef863,null))[_0x2897('0x37')](removeEntity(_0x1ef863,null))[_0x2897('0x2d')](handleError(_0x1ef863,null));};exports[_0x2897('0x5e')]=function(_0x5cf38d,_0x32b310){return db[_0x2897('0x3f')][_0x2897('0x5e')]()[_0x2897('0x37')](respondWithResult(_0x32b310,null))[_0x2897('0x2d')](handleError(_0x32b310,null));};var interaction_log=require('../../config/logger')(_0x2897('0x5f'));exports[_0x2897('0x60')]=function(_0x310468,_0x557062,_0x323c91){var _0x2bbd48={'agent':{},'channel':_0x2897('0x61')};if(_0x310468[_0x2897('0x5d')]['id']){delete _0x310468['body']['id'];}_0x310468['body'][_0x2897('0x62')]=!![];_0x310468[_0x2897('0x5d')]['readAt']=moment()[_0x2897('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x310468['body']['UserId']=_0x310468['body']['UserId']||_0x310468[_0x2897('0x64')]['id'];_0x2bbd48[_0x2897('0x65')]['id']=_0x310468[_0x2897('0x5d')][_0x2897('0x66')];return db[_0x2897('0x3f')][_0x2897('0x5a')]({'where':{'id':_0x310468[_0x2897('0x57')]['id'],'UserId':null}})[_0x2897('0x37')](handleEntityNotFound(_0x557062,null))['then'](saveUpdates(_0x310468['body'],null))['then'](function(_0xe4545e){if(_0xe4545e){_0x2bbd48[_0x2897('0x2b')]=_0xe4545e[_0x2897('0x67')]({'plain':!![]});return db[_0x2897('0x68')][_0x2897('0x5a')]({'where':{'id':_0xe4545e['ChatInteractionId']}});}return null;})[_0x2897('0x37')](handleEntityNotFound(_0x557062,null))[_0x2897('0x37')](function(_0x35611c){if(_0x35611c){return _0x35611c[_0x2897('0x5c')]({'UserId':_0x310468[_0x2897('0x5d')][_0x2897('0x66')],'read1stAt':_['isNil'](_0x35611c[_0x2897('0x69')])?moment()[_0x2897('0x63')](_0x2897('0x6a')):undefined});}return null;})[_0x2897('0x37')](function(_0xd3c701){if(_0xd3c701){_0x2bbd48[_0x2897('0x6b')]=_0xd3c701[_0x2897('0x67')]({'plain':!![]});interaction_log['info'](_0x2897('0x6c'),_0x310468[_0x2897('0x64')]['id'],_0x310468[_0x2897('0x64')][_0x2897('0x3c')],_0x310468['user'][_0x2897('0x6d')],_0x2bbd48[_0x2897('0x6b')]['id'],_0x310468[_0x2897('0x5d')]?JSON[_0x2897('0x28')](_0x310468[_0x2897('0x5d')]):_0x2897('0x6e'));return respondWithRpcPromise(_0x2897('0x6f'),'acceptMessage',_0x2bbd48);}return null;})[_0x2897('0x37')](function(_0x576e13){var _0x448277=_0x2897('0x70')+_0x576e13['message'][_0x2897('0x71')];return db[_0x2897('0x72')][_0x2897('0x44')](_0x448277,{'type':db['Sequelize'][_0x2897('0x73')][_0x2897('0x74')],'raw':!![]})['then'](function(_0x9ab4c6){return _0x9ab4c6;});})[_0x2897('0x37')](function(_0x31323b){if(_0x31323b){_0x2bbd48[_0x2897('0x2b')]['contact']=_0x31323b[0x0];if(!_0x310468['body'][_0x2897('0x66')])return;return db[_0x2897('0x75')]['find']({'where':{'id':_0x310468[_0x2897('0x5d')][_0x2897('0x66')],'role':_0x2897('0x65')},'attributes':['id',_0x2897('0x3c'),'fullname','email',_0x2897('0x76')],'raw':!![]});}return null;})['then'](function(_0xc8d8b8){if(!_0xc8d8b8)return null;_0x2bbd48[_0x2897('0x2b')][_0x2897('0x65')]=_0xc8d8b8;return _0x2bbd48;})['then'](function(_0x74a973){if(_0x74a973){if(_0x310468['body']['manual']){_0x2bbd48[_0x2897('0x2b')]['interface']=util['format']('SIP/%s',_0x310468[_0x2897('0x64')][_0x2897('0x3c')]);_0x2bbd48[_0x2897('0x2b')][_0x2897('0x77')]=_0x2bbd48[_0x2897('0x77')];_0x2bbd48['message'][_0x2897('0x78')]=_0x2bbd48[_0x2897('0x77')];_0x2bbd48[_0x2897('0x2b')][_0x2897('0x79')]=_0x2897('0x60');return respondWithRpcPromise(_0x2897('0x7a'),_0x2897('0x7a'),{'event':'acceptmessage','message':_[_0x2897('0x50')](_0x2bbd48['message'],JSON[_0x2897('0x7b')](_0x2bbd48[_0x2897('0x6b')][_0x2897('0x7c')]))},client9002)[_0x2897('0x37')](function(){return _0x2bbd48;});}return _0x2bbd48;}return null;})[_0x2897('0x37')](respondWithResult(_0x557062,null))[_0x2897('0x2d')](handleError(_0x557062,null));};var interaction_log=require('../../config/logger')(_0x2897('0x5f'));exports['reject']=function(_0x3c2746,_0x8e76a1,_0x192faa){var _0x4d8670={'agent':{},'channel':_0x2897('0x61')};if(_0x3c2746[_0x2897('0x5d')]['id']){delete _0x3c2746[_0x2897('0x5d')]['id'];}_0x3c2746[_0x2897('0x5d')][_0x2897('0x66')]=_0x3c2746[_0x2897('0x5d')]['UserId']||_0x3c2746['user']['id'];_0x4d8670[_0x2897('0x65')]['id']=_0x3c2746[_0x2897('0x5d')][_0x2897('0x66')];return db['ChatMessage'][_0x2897('0x5a')]({'where':{'id':_0x3c2746[_0x2897('0x57')]['id'],'UserId':null}})[_0x2897('0x37')](handleEntityNotFound(_0x8e76a1,null))[_0x2897('0x37')](function(_0x2dc7d5){if(_0x2dc7d5){_0x4d8670[_0x2897('0x2b')]=_0x2dc7d5[_0x2897('0x67')]({'plain':!![]});return db[_0x2897('0x68')][_0x2897('0x5a')]({'where':{'id':_0x2dc7d5[_0x2897('0x7d')]}});}return null;})[_0x2897('0x37')](handleEntityNotFound(_0x8e76a1,null))['then'](function(_0x5bdb7c){if(_0x5bdb7c){_0x4d8670[_0x2897('0x6b')]=_0x5bdb7c[_0x2897('0x67')]({'plain':!![]});interaction_log[_0x2897('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c2746[_0x2897('0x64')]['id'],_0x3c2746[_0x2897('0x64')][_0x2897('0x3c')],_0x3c2746[_0x2897('0x64')]['role'],_0x4d8670[_0x2897('0x6b')]['id'],_0x3c2746[_0x2897('0x5d')]?JSON[_0x2897('0x28')](_0x3c2746['body']):_0x2897('0x6e'));return respondWithRpcPromise(_0x2897('0x7e'),_0x2897('0x7f'),_0x4d8670);}return null;})['then'](function(_0x2fdcc6){var _0x343092=_0x2897('0x70')+_0x2fdcc6[_0x2897('0x2b')]['ContactId'];return db[_0x2897('0x72')]['query'](_0x343092,{'type':db[_0x2897('0x80')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2897('0x37')](function(_0x3dde02){return _0x3dde02;});})[_0x2897('0x37')](function(_0x39a2dd){if(_0x39a2dd){_0x4d8670[_0x2897('0x2b')][_0x2897('0x81')]=_0x39a2dd[0x0];if(!_0x3c2746['body']['UserId'])return;return db[_0x2897('0x75')][_0x2897('0x5a')]({'where':{'id':_0x3c2746['body']['UserId'],'role':_0x2897('0x65')},'attributes':['id',_0x2897('0x3c'),_0x2897('0x82'),_0x2897('0x83'),_0x2897('0x76')],'raw':!![]});}return null;})[_0x2897('0x37')](function(_0x2eb32b){if(!_0x2eb32b)return null;_0x4d8670[_0x2897('0x2b')]['agent']=_0x2eb32b;return _0x4d8670;})['then'](function(_0x325356){if(_0x325356){_0x325356['message'][_0x2897('0x84')]=util[_0x2897('0x63')](_0x2897('0x85'),_0x3c2746[_0x2897('0x64')][_0x2897('0x3c')]);_0x325356[_0x2897('0x2b')][_0x2897('0x77')]=_0x4d8670[_0x2897('0x77')];_0x325356[_0x2897('0x2b')]['motionChannel']=_0x4d8670[_0x2897('0x77')];_0x325356[_0x2897('0x2b')]['event']=_0x2897('0x36');respondWithRpcPromise(_0x2897('0x7a'),_0x2897('0x7a'),{'event':_0x2897('0x86'),'message':_[_0x2897('0x50')](_0x4d8670[_0x2897('0x2b')],JSON[_0x2897('0x7b')](_0x4d8670[_0x2897('0x6b')][_0x2897('0x7c')]))},client9002);return _0x4d8670;}return null;})['then'](respondWithResult(_0x8e76a1,null))[_0x2897('0x2d')](handleError(_0x8e76a1,null));}; \ No newline at end of file +var _0x399e=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','create','body','find','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','rejectMessage','internal','interface','format','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x26aa2a,_0x43643d){var _0x14121a=function(_0x27fdd0){while(--_0x27fdd0){_0x26aa2a['push'](_0x26aa2a['shift']());}};_0x14121a(++_0x43643d);}(_0x399e,0x106));var _0xe399=function(_0x32abb9,_0x5f0d36){_0x32abb9=_0x32abb9-0x0;var _0xbaa5f5=_0x399e[_0x32abb9];return _0xbaa5f5;};'use strict';var emlformat=require(_0xe399('0x0'));var rimraf=require(_0xe399('0x1'));var zipdir=require(_0xe399('0x2'));var jsonpatch=require(_0xe399('0x3'));var rp=require(_0xe399('0x4'));var moment=require(_0xe399('0x5'));var BPromise=require(_0xe399('0x6'));var Mustache=require(_0xe399('0x7'));var util=require(_0xe399('0x8'));var path=require(_0xe399('0x9'));var sox=require(_0xe399('0xa'));var csv=require('to-csv');var ejs=require(_0xe399('0xb'));var fs=require('fs');var fs_extra=require(_0xe399('0xc'));var _=require(_0xe399('0xd'));var squel=require(_0xe399('0xe'));var crypto=require(_0xe399('0xf'));var jsforce=require(_0xe399('0x10'));var deskjs=require(_0xe399('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe399('0x12'));var Papa=require(_0xe399('0x13'));var Redis=require('ioredis');var authService=require(_0xe399('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe399('0x15'));var hardwareService=require(_0xe399('0x16'));var logger=require(_0xe399('0x17'))(_0xe399('0x18'));var utils=require(_0xe399('0x19'));var config=require(_0xe399('0x1a'));var licenseUtil=require(_0xe399('0x1b'));var db=require(_0xe399('0x1c'))['db'];config[_0xe399('0x1d')]=_[_0xe399('0x1e')](config[_0xe399('0x1d')],{'host':_0xe399('0x1f'),'port':0x18eb});var socket=require(_0xe399('0x20'))(new Redis(config[_0xe399('0x1d')]));require(_0xe399('0x21'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe399('0x22')][_0xe399('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xe399('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xdcc869,_0xd5ab09,_0x5b3926,_0x1c38c5){return new BPromise(function(_0xf03f5e,_0x7a0ad8){var _0x280629=_0x1c38c5||client;return _0x280629[_0xe399('0x24')](_0xdcc869,_0x5b3926)[_0xe399('0x25')](function(_0x2da7d2){logger[_0xe399('0x26')](_0xe399('0x27'),_0xd5ab09,_0xe399('0x28'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xd5ab09,_0xe399('0x28'),JSON[_0xe399('0x29')](_0x2da7d2));if(_0x2da7d2['error']){if(_0x2da7d2['error'][_0xe399('0x2a')]===0x1f4){logger[_0xe399('0x2b')](_0xe399('0x27'),_0xd5ab09,_0x2da7d2[_0xe399('0x2b')]['message']);return _0x7a0ad8(_0x2da7d2['error'][_0xe399('0x2c')]);}logger[_0xe399('0x2b')](_0xe399('0x27'),_0xd5ab09,_0x2da7d2[_0xe399('0x2b')][_0xe399('0x2c')]);return _0xf03f5e(_0x2da7d2['error'][_0xe399('0x2c')]);}else{logger[_0xe399('0x26')]('ChatMessage,\x20%s,\x20%s',_0xd5ab09,_0xe399('0x28'));_0xf03f5e(_0x2da7d2[_0xe399('0x2d')][_0xe399('0x2c')]);}})['catch'](function(_0x45b731){logger[_0xe399('0x2b')](_0xe399('0x27'),_0xd5ab09,_0x45b731);_0x7a0ad8(_0x45b731);});});}function respondWithStatusCode(_0x38dba4,_0x5f5988){_0x5f5988=_0x5f5988||0xcc;return function(_0x36a743){if(_0x36a743){return _0x38dba4['sendStatus'](_0x5f5988);}return _0x38dba4[_0xe399('0x2e')](_0x5f5988)[_0xe399('0x2f')]();};}function respondWithResult(_0x2e7a8a,_0x225d4e){_0x225d4e=_0x225d4e||0xc8;return function(_0x38df42){if(_0x38df42){return _0x2e7a8a[_0xe399('0x2e')](_0x225d4e)[_0xe399('0x30')](_0x38df42);}};}function respondWithFilteredResult(_0x121824,_0x3aad2a){return function(_0x315aae){if(_0x315aae){var _0x54e532=typeof _0x3aad2a[_0xe399('0x31')]===_0xe399('0x32')&&typeof _0x3aad2a[_0xe399('0x33')]===_0xe399('0x32');var _0x1708bc=_0x315aae['count'];var _0x4a8ede=_0x54e532?0x0:_0x3aad2a[_0xe399('0x31')];var _0x45e9e8=_0x54e532?_0x315aae[_0xe399('0x34')]:_0x3aad2a[_0xe399('0x31')]+_0x3aad2a['limit'];var _0x2b8567;if(_0x45e9e8>=_0x1708bc){_0x45e9e8=_0x1708bc;_0x2b8567=0xc8;}else{_0x2b8567=0xce;}_0x121824[_0xe399('0x2e')](_0x2b8567);return _0x121824[_0xe399('0x35')](_0xe399('0x36'),_0x4a8ede+'-'+_0x45e9e8+'/'+_0x1708bc)[_0xe399('0x30')](_0x315aae);}return null;};}function patchUpdates(_0x253ea4){return function(_0x50e66f){try{jsonpatch[_0xe399('0x37')](_0x50e66f,_0x253ea4,!![]);}catch(_0x933cbb){return BPromise[_0xe399('0x38')](_0x933cbb);}return _0x50e66f[_0xe399('0x39')]();};}function saveUpdates(_0x510b05,_0x2eff9a){return function(_0x910917){if(_0x910917){return _0x910917[_0xe399('0x3a')](_0x510b05)['then'](function(_0x150882){return _0x150882;});}return null;};}function removeEntity(_0x217fb6,_0x5418c9){return function(_0x304b69){if(_0x304b69){return _0x304b69[_0xe399('0x3b')]()[_0xe399('0x25')](function(){_0x217fb6['status'](0xcc)[_0xe399('0x2f')]();});}};}function handleEntityNotFound(_0x56cafd,_0x35bdb4){return function(_0x4fbb5c){if(!_0x4fbb5c){_0x56cafd['sendStatus'](0x194);}return _0x4fbb5c;};}function handleError(_0x2e1f9b,_0x4e6be1){_0x4e6be1=_0x4e6be1||0x1f4;return function(_0x1747d1){logger[_0xe399('0x2b')](_0x1747d1[_0xe399('0x3c')]);if(_0x1747d1[_0xe399('0x3d')]){delete _0x1747d1[_0xe399('0x3d')];}_0x2e1f9b[_0xe399('0x2e')](_0x4e6be1)[_0xe399('0x3e')](_0x1747d1);};}exports[_0xe399('0x3f')]=function(_0xd7e94,_0x5521e1){var _0x19b3ea={},_0x4a6740={},_0x367ddc={'count':0x0,'rows':[]};var _0xa6aa2b=_[_0xe399('0x40')](db[_0xe399('0x41')][_0xe399('0x42')],function(_0x4f2b42){return{'name':_0x4f2b42['fieldName'],'type':_0x4f2b42[_0xe399('0x43')][_0xe399('0x44')]};});_0x4a6740[_0xe399('0x45')]=_['map'](_0xa6aa2b,_0xe399('0x3d'));_0x4a6740[_0xe399('0x46')]=_[_0xe399('0x47')](_0xd7e94['query']);_0x4a6740[_0xe399('0x48')]=_[_0xe399('0x49')](_0x4a6740[_0xe399('0x45')],_0x4a6740[_0xe399('0x46')]);_0x19b3ea[_0xe399('0x4a')]=_[_0xe399('0x49')](_0x4a6740['model'],qs[_0xe399('0x4b')](_0xd7e94[_0xe399('0x46')][_0xe399('0x4b')]));_0x19b3ea[_0xe399('0x4a')]=_0x19b3ea['attributes'][_0xe399('0x4c')]?_0x19b3ea[_0xe399('0x4a')]:_0x4a6740[_0xe399('0x45')];if(!_0xd7e94[_0xe399('0x46')][_0xe399('0x4d')](_0xe399('0x4e'))){_0x19b3ea[_0xe399('0x33')]=qs['limit'](_0xd7e94[_0xe399('0x46')][_0xe399('0x33')]);_0x19b3ea['offset']=qs[_0xe399('0x31')](_0xd7e94['query'][_0xe399('0x31')]);}_0x19b3ea['order']=qs['sort'](_0xd7e94[_0xe399('0x46')][_0xe399('0x4f')]);_0x19b3ea['where']=qs[_0xe399('0x48')](_['pick'](_0xd7e94[_0xe399('0x46')],_0x4a6740['filters']),_0xa6aa2b);if(_0xd7e94[_0xe399('0x46')][_0xe399('0x50')]){_0x19b3ea['where']=_['merge'](_0x19b3ea[_0xe399('0x51')],{'$or':_['map'](_0xa6aa2b,function(_0x30bbd9){if(_0x30bbd9[_0xe399('0x43')]!==_0xe399('0x52')){var _0x49e6e3={};_0x49e6e3[_0x30bbd9['name']]={'$like':'%'+_0xd7e94[_0xe399('0x46')][_0xe399('0x50')]+'%'};return _0x49e6e3;}})});}_0x19b3ea=_['merge']({},_0x19b3ea,_0xd7e94['options']);var _0x552d50={'where':_0x19b3ea[_0xe399('0x51')]};return db[_0xe399('0x41')][_0xe399('0x34')](_0x552d50)[_0xe399('0x25')](function(_0x9446fb){_0x367ddc[_0xe399('0x34')]=_0x9446fb;if(_0xd7e94['query'][_0xe399('0x53')]){_0x19b3ea['include']=[{'all':!![]}];}return db[_0xe399('0x41')][_0xe399('0x54')](_0x19b3ea);})[_0xe399('0x25')](function(_0x48db6f){_0x367ddc[_0xe399('0x55')]=_0x48db6f;return _0x367ddc;})[_0xe399('0x25')](respondWithFilteredResult(_0x5521e1,_0x19b3ea))[_0xe399('0x56')](handleError(_0x5521e1,null));};exports[_0xe399('0x57')]=function(_0xcd78cb,_0x22e4dc){var _0x1284ed={'raw':!![],'where':{'id':_0xcd78cb[_0xe399('0x58')]['id']}},_0x4887a3={};_0x4887a3[_0xe399('0x45')]=_[_0xe399('0x47')](db[_0xe399('0x41')]['rawAttributes']);_0x4887a3[_0xe399('0x46')]=_['keys'](_0xcd78cb[_0xe399('0x46')]);_0x4887a3[_0xe399('0x48')]=_[_0xe399('0x49')](_0x4887a3[_0xe399('0x45')],_0x4887a3['query']);_0x1284ed[_0xe399('0x4a')]=_['intersection'](_0x4887a3[_0xe399('0x45')],qs[_0xe399('0x4b')](_0xcd78cb[_0xe399('0x46')][_0xe399('0x4b')]));_0x1284ed[_0xe399('0x4a')]=_0x1284ed[_0xe399('0x4a')][_0xe399('0x4c')]?_0x1284ed['attributes']:_0x4887a3['model'];if(_0xcd78cb[_0xe399('0x46')][_0xe399('0x53')]){_0x1284ed[_0xe399('0x59')]=[{'all':!![]}];}_0x1284ed=_[_0xe399('0x5a')]({},_0x1284ed,_0xcd78cb[_0xe399('0x5b')]);return db[_0xe399('0x41')]['find'](_0x1284ed)[_0xe399('0x25')](handleEntityNotFound(_0x22e4dc,null))[_0xe399('0x25')](respondWithResult(_0x22e4dc,null))['catch'](handleError(_0x22e4dc,null));};exports[_0xe399('0x5c')]=function(_0x1dc7cb,_0x4300a9){return db[_0xe399('0x41')][_0xe399('0x5c')](_0x1dc7cb[_0xe399('0x5d')],{})['then'](respondWithResult(_0x4300a9,0xc9))['catch'](handleError(_0x4300a9,null));};exports[_0xe399('0x3a')]=function(_0x2ede9e,_0x502080){if(_0x2ede9e[_0xe399('0x5d')]['id']){delete _0x2ede9e[_0xe399('0x5d')]['id'];}return db['ChatMessage'][_0xe399('0x5e')]({'where':{'id':_0x2ede9e['params']['id']}})[_0xe399('0x25')](handleEntityNotFound(_0x502080,null))[_0xe399('0x25')](saveUpdates(_0x2ede9e[_0xe399('0x5d')],null))[_0xe399('0x25')](respondWithResult(_0x502080,null))[_0xe399('0x56')](handleError(_0x502080,null));};exports[_0xe399('0x3b')]=function(_0x406923,_0x28fbae){return db[_0xe399('0x41')][_0xe399('0x5e')]({'where':{'id':_0x406923[_0xe399('0x58')]['id']}})[_0xe399('0x25')](handleEntityNotFound(_0x28fbae,null))['then'](removeEntity(_0x28fbae,null))[_0xe399('0x56')](handleError(_0x28fbae,null));};exports[_0xe399('0x5f')]=function(_0x38ad8b,_0x1f847b){return db[_0xe399('0x41')]['describe']()[_0xe399('0x25')](respondWithResult(_0x1f847b,null))[_0xe399('0x56')](handleError(_0x1f847b,null));};var interaction_log=require('../../config/logger')(_0xe399('0x60'));exports[_0xe399('0x61')]=function(_0x5596e2,_0x111b42,_0x5d5ab4){var _0x3c2986={'agent':{},'channel':_0xe399('0x62')};if(_0x5596e2[_0xe399('0x5d')]['id']){delete _0x5596e2[_0xe399('0x5d')]['id'];}_0x5596e2['body'][_0xe399('0x63')]=!![];_0x5596e2[_0xe399('0x5d')][_0xe399('0x64')]=moment()['format'](_0xe399('0x65'));_0x5596e2[_0xe399('0x5d')][_0xe399('0x66')]=_0x5596e2[_0xe399('0x5d')][_0xe399('0x66')]||_0x5596e2[_0xe399('0x67')]['id'];_0x3c2986['agent']['id']=_0x5596e2[_0xe399('0x5d')][_0xe399('0x66')];return db[_0xe399('0x41')][_0xe399('0x5e')]({'where':{'id':_0x5596e2[_0xe399('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x111b42,null))[_0xe399('0x25')](saveUpdates(_0x5596e2['body'],null))[_0xe399('0x25')](function(_0x4b4aa4){if(_0x4b4aa4){_0x3c2986['message']=_0x4b4aa4[_0xe399('0x68')]({'plain':!![]});return db[_0xe399('0x69')]['find']({'where':{'id':_0x4b4aa4[_0xe399('0x6a')]}});}return null;})[_0xe399('0x25')](handleEntityNotFound(_0x111b42,null))['then'](function(_0x3e8d72){if(_0x3e8d72){return _0x3e8d72['update']({'UserId':_0x5596e2[_0xe399('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x3e8d72[_0xe399('0x6b')])?moment()['format'](_0xe399('0x65')):undefined});}return null;})[_0xe399('0x25')](function(_0xff632a){if(_0xff632a){_0x3c2986[_0xe399('0x6c')]=_0xff632a[_0xe399('0x68')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5596e2[_0xe399('0x67')]['id'],_0x5596e2[_0xe399('0x67')][_0xe399('0x3d')],_0x5596e2[_0xe399('0x67')][_0xe399('0x6d')],_0x3c2986[_0xe399('0x6c')]['id'],_0x5596e2[_0xe399('0x5d')]?JSON[_0xe399('0x29')](_0x5596e2['body']):_0xe399('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3c2986);}return null;})['then'](function(_0x41b55b){var _0x5ea985=_0xe399('0x6f')+_0x41b55b[_0xe399('0x2c')][_0xe399('0x70')];return db[_0xe399('0x71')][_0xe399('0x46')](_0x5ea985,{'type':db[_0xe399('0x72')][_0xe399('0x73')][_0xe399('0x74')],'raw':!![]})[_0xe399('0x25')](function(_0x3f2662){return _0x3f2662;});})[_0xe399('0x25')](function(_0x2279bf){if(_0x2279bf){_0x3c2986[_0xe399('0x2c')][_0xe399('0x75')]=_0x2279bf[0x0];if(!_0x5596e2[_0xe399('0x5d')][_0xe399('0x66')])return;return db[_0xe399('0x76')]['find']({'where':{'id':_0x5596e2[_0xe399('0x5d')][_0xe399('0x66')],'role':_0xe399('0x77')},'attributes':['id',_0xe399('0x3d'),_0xe399('0x78'),_0xe399('0x79'),'internal'],'raw':!![]});}return null;})[_0xe399('0x25')](function(_0x4f9039){if(!_0x4f9039)return null;_0x3c2986[_0xe399('0x2c')][_0xe399('0x77')]=_0x4f9039;return _0x3c2986;})[_0xe399('0x25')](function(_0x5aa129){if(_0x5aa129){if(_0x5596e2['body'][_0xe399('0x7a')]){_0x3c2986[_0xe399('0x2c')]['interface']=util['format'](_0xe399('0x7b'),_0x5596e2[_0xe399('0x67')]['name']);_0x3c2986['message'][_0xe399('0x7c')]=_0x3c2986['channel'];_0x3c2986[_0xe399('0x2c')][_0xe399('0x7d')]=_0x3c2986['channel'];_0x3c2986[_0xe399('0x2c')][_0xe399('0x7e')]=_0xe399('0x61');return respondWithRpcPromise(_0xe399('0x7f'),_0xe399('0x7f'),{'event':_0xe399('0x80'),'message':_[_0xe399('0x5a')](_0x3c2986[_0xe399('0x2c')],JSON[_0xe399('0x81')](_0x3c2986[_0xe399('0x6c')][_0xe399('0x82')]))},client9002)[_0xe399('0x25')](function(){return _0x3c2986;});}return _0x3c2986;}return null;})[_0xe399('0x25')](respondWithResult(_0x111b42,null))[_0xe399('0x56')](handleError(_0x111b42,null));};var interaction_log=require('../../config/logger')(_0xe399('0x60'));exports[_0xe399('0x38')]=function(_0x3d7fab,_0x15ee6e,_0x4fab9d){var _0x325cfc={'agent':{},'channel':_0xe399('0x62')};if(_0x3d7fab[_0xe399('0x5d')]['id']){delete _0x3d7fab[_0xe399('0x5d')]['id'];}_0x3d7fab[_0xe399('0x5d')][_0xe399('0x66')]=_0x3d7fab[_0xe399('0x5d')]['UserId']||_0x3d7fab['user']['id'];_0x325cfc[_0xe399('0x77')]['id']=_0x3d7fab[_0xe399('0x5d')][_0xe399('0x66')];return db[_0xe399('0x41')]['find']({'where':{'id':_0x3d7fab[_0xe399('0x58')]['id'],'UserId':null}})[_0xe399('0x25')](handleEntityNotFound(_0x15ee6e,null))[_0xe399('0x25')](function(_0x53af5d){if(_0x53af5d){_0x325cfc[_0xe399('0x2c')]=_0x53af5d[_0xe399('0x68')]({'plain':!![]});return db[_0xe399('0x69')][_0xe399('0x5e')]({'where':{'id':_0x53af5d['ChatInteractionId']}});}return null;})[_0xe399('0x25')](handleEntityNotFound(_0x15ee6e,null))[_0xe399('0x25')](function(_0x5c65a7){if(_0x5c65a7){_0x325cfc[_0xe399('0x6c')]=_0x5c65a7[_0xe399('0x68')]({'plain':!![]});interaction_log[_0xe399('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d7fab[_0xe399('0x67')]['id'],_0x3d7fab[_0xe399('0x67')][_0xe399('0x3d')],_0x3d7fab[_0xe399('0x67')][_0xe399('0x6d')],_0x325cfc[_0xe399('0x6c')]['id'],_0x3d7fab[_0xe399('0x5d')]?JSON[_0xe399('0x29')](_0x3d7fab[_0xe399('0x5d')]):_0xe399('0x6e'));return respondWithRpcPromise('RejectMessage',_0xe399('0x83'),_0x325cfc);}return null;})['then'](function(_0x1499ab){var _0x42085d=_0xe399('0x6f')+_0x1499ab[_0xe399('0x2c')][_0xe399('0x70')];return db['sequelize'][_0xe399('0x46')](_0x42085d,{'type':db[_0xe399('0x72')][_0xe399('0x73')][_0xe399('0x74')],'raw':!![]})[_0xe399('0x25')](function(_0x312274){return _0x312274;});})[_0xe399('0x25')](function(_0x30aab2){if(_0x30aab2){_0x325cfc[_0xe399('0x2c')]['contact']=_0x30aab2[0x0];if(!_0x3d7fab[_0xe399('0x5d')][_0xe399('0x66')])return;return db['User'][_0xe399('0x5e')]({'where':{'id':_0x3d7fab[_0xe399('0x5d')][_0xe399('0x66')],'role':'agent'},'attributes':['id',_0xe399('0x3d'),_0xe399('0x78'),_0xe399('0x79'),_0xe399('0x84')],'raw':!![]});}return null;})['then'](function(_0x4b8c04){if(!_0x4b8c04)return null;_0x325cfc[_0xe399('0x2c')][_0xe399('0x77')]=_0x4b8c04;return _0x325cfc;})[_0xe399('0x25')](function(_0x4486a3){if(_0x4486a3){_0x4486a3['message'][_0xe399('0x85')]=util[_0xe399('0x86')](_0xe399('0x7b'),_0x3d7fab[_0xe399('0x67')]['name']);_0x4486a3[_0xe399('0x2c')][_0xe399('0x7c')]=_0x325cfc[_0xe399('0x7c')];_0x4486a3[_0xe399('0x2c')][_0xe399('0x7d')]=_0x325cfc[_0xe399('0x7c')];_0x4486a3[_0xe399('0x2c')][_0xe399('0x7e')]=_0xe399('0x38');respondWithRpcPromise('EventManager','EventManager',{'event':_0xe399('0x87'),'message':_[_0xe399('0x5a')](_0x325cfc[_0xe399('0x2c')],JSON['parse'](_0x325cfc['interaction'][_0xe399('0x82')]))},client9002);return _0x325cfc;}return null;})[_0xe399('0x25')](respondWithResult(_0x15ee6e,null))['catch'](handleError(_0x15ee6e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 82fc616..ccb1813 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 _0xbf87=['save','update','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xa71904,_0x21363f){var _0x507060=function(_0x4ac794){while(--_0x4ac794){_0xa71904['push'](_0xa71904['shift']());}};_0x507060(++_0x21363f);}(_0xbf87,0x11d));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x7bf8('0x0'));var ChatMessage=require(_0x7bf8('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7bf8('0x2')](0x0);var events={'afterCreate':_0x7bf8('0x3'),'afterUpdate':_0x7bf8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52b631){return function(_0x534fe5,_0x4ce692,_0x54ce0f){ChatMessageEvents['emit'](_0x52b631+':'+_0x534fe5['id'],_0x534fe5);ChatMessageEvents[_0x7bf8('0x5')](_0x52b631,_0x534fe5);_0x54ce0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7bf8('0x6')](e,emitEvent(event));}}module[_0x7bf8('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xd676=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x33e4dd,_0x3413a2){var _0x4b0e75=function(_0x7c957){while(--_0x7c957){_0x33e4dd['push'](_0x33e4dd['shift']());}};_0x4b0e75(++_0x3413a2);}(_0xd676,0x1c8));var _0x6d67=function(_0x466c42,_0x17d7c1){_0x466c42=_0x466c42-0x0;var _0x2a833f=_0xd676[_0x466c42];return _0x2a833f;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6d67('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6d67('0x1')](0x0);var events={'afterCreate':_0x6d67('0x2'),'afterUpdate':_0x6d67('0x3'),'afterDestroy':_0x6d67('0x4')};function emitEvent(_0x12ef7d){return function(_0x35493b,_0x272f05,_0x42ca14){ChatMessageEvents[_0x6d67('0x5')](_0x12ef7d+':'+_0x35493b['id'],_0x35493b);ChatMessageEvents['emit'](_0x12ef7d,_0x35493b);_0x42ca14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x6d67('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9dcb873..4ed2471 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 _0xef45=['catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update'];(function(_0x4c9e04,_0x1f12e1){var _0x391e86=function(_0x57f7ae){while(--_0x57f7ae){_0x4c9e04['push'](_0x4c9e04['shift']());}};_0x391e86(++_0x1f12e1);}(_0xef45,0xe3));var _0x5ef4=function(_0x3ee0e1,_0x3193b1){_0x3ee0e1=_0x3ee0e1-0x0;var _0x42be7b=_0xef45[_0x3ee0e1];return _0x42be7b;};'use strict';var _=require(_0x5ef4('0x0'));var util=require(_0x5ef4('0x1'));var logger=require(_0x5ef4('0x2'))(_0x5ef4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ef4('0x4'));var rimraf=require(_0x5ef4('0x5'));var config=require(_0x5ef4('0x6'));var attributes=require('./chatMessage.attributes');module[_0x5ef4('0x7')]=function(_0x3bd46c,_0x95d6d9){return _0x3bd46c[_0x5ef4('0x8')]('ChatMessage',attributes,{'tableName':_0x5ef4('0x9'),'paranoid':![],'indexes':[{'name':_0x5ef4('0xa'),'fields':[_0x5ef4('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14ee1f,_0x45ada7,_0x3142d1){var _0x407eff=_0x3bd46c[_0x5ef4('0xc')];var _0x4b17f1=_0x14ee1f[_0x5ef4('0xd')]({'plain':!![]});if(_0x4b17f1[_0x5ef4('0xe')][_0x5ef4('0xf')]()==='in'||_0x4b17f1[_0x5ef4('0xe')]['toLowerCase']()===_0x5ef4('0x10')&&!_0x4b17f1[_0x5ef4('0x11')]&&!_[_0x5ef4('0x12')](_0x4b17f1[_0x5ef4('0x13')])){_0x407eff[_0x5ef4('0x14')][_0x5ef4('0x15')]({'where':{'id':_0x4b17f1[_0x5ef4('0x16')]}})[_0x5ef4('0x17')](function(_0x107dd6){if(_0x107dd6){_0x107dd6[_0x5ef4('0x18')]({'lastMsgAt':_0x4b17f1['createdAt'],'lastMsgDirection':_0x4b17f1[_0x5ef4('0xe')]['toLowerCase']()});}})[_0x5ef4('0x19')](function(_0x4b87f7){console[_0x5ef4('0x1a')](_0x4b87f7);});}_0x3142d1();}},'charset':'utf8mb4','collate':_0x5ef4('0x1b')});}; \ No newline at end of file +var _0xdd92=['FULLTEXT','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0xdd92,0x188));var _0x2dd9=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xdd92[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x2dd9('0x0'));var util=require(_0x2dd9('0x1'));var logger=require(_0x2dd9('0x2'))(_0x2dd9('0x3'));var moment=require('moment');var BPromise=require(_0x2dd9('0x4'));var rp=require(_0x2dd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dd9('0x6'));var config=require('../../config/environment');var attributes=require(_0x2dd9('0x7'));module[_0x2dd9('0x8')]=function(_0x2a394f,_0x2a0348){return _0x2a394f['define'](_0x2dd9('0x9'),attributes,{'tableName':_0x2dd9('0xa'),'paranoid':![],'indexes':[{'name':_0x2dd9('0xb'),'fields':[_0x2dd9('0xc')],'type':_0x2dd9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x243d91,_0x2b34ee,_0x2606ad){var _0x37b0b7=_0x2a394f['models'];var _0x2882ed=_0x243d91['get']({'plain':!![]});if(_0x2882ed[_0x2dd9('0xe')][_0x2dd9('0xf')]()==='in'||_0x2882ed[_0x2dd9('0xe')][_0x2dd9('0xf')]()===_0x2dd9('0x10')&&!_0x2882ed[_0x2dd9('0x11')]&&!_['isNil'](_0x2882ed[_0x2dd9('0x12')])){_0x37b0b7[_0x2dd9('0x13')][_0x2dd9('0x14')]({'where':{'id':_0x2882ed[_0x2dd9('0x15')]}})['then'](function(_0x347402){if(_0x347402){_0x347402[_0x2dd9('0x16')]({'lastMsgAt':_0x2882ed['createdAt'],'lastMsgDirection':_0x2882ed[_0x2dd9('0xe')][_0x2dd9('0xf')]()});}})[_0x2dd9('0x17')](function(_0x31b1bd){console[_0x2dd9('0x18')](_0x31b1bd);});}_0x2606ad();}},'charset':_0x2dd9('0x19'),'collate':_0x2dd9('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bc3c617..9ee6fcc 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 _0x69d1=['request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x2649aa,_0x34c0c3){var _0x3cde1c=function(_0x5059d3){while(--_0x5059d3){_0x2649aa['push'](_0x2649aa['shift']());}};_0x3cde1c(++_0x34c0c3);}(_0x69d1,0xdd));var _0x169d=function(_0x13485b,_0x29fb3e){_0x13485b=_0x13485b-0x0;var _0x4ae5e8=_0x69d1[_0x13485b];return _0x4ae5e8;};'use strict';var _=require('lodash');var util=require(_0x169d('0x0'));var moment=require(_0x169d('0x1'));var BPromise=require(_0x169d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x169d('0x4'));var logger=require(_0x169d('0x5'))(_0x169d('0x6'));var config=require(_0x169d('0x7'));var jayson=require(_0x169d('0x8'));var client=jayson[_0x169d('0x9')][_0x169d('0xa')]({'port':0x232a});config['redis']=_[_0x169d('0xb')](config[_0x169d('0xc')],{'host':_0x169d('0xd'),'port':0x18eb});var socket=require(_0x169d('0xe'))(new Redis(config[_0x169d('0xc')]));require(_0x169d('0xf'))[_0x169d('0x10')](socket);function respondWithRpcPromise(_0x617d66,_0x2dc570,_0x247e69){return new BPromise(function(_0x38010a,_0x41f85d){return client[_0x169d('0x11')](_0x617d66,_0x247e69)[_0x169d('0x12')](function(_0x13676d){logger[_0x169d('0x13')](_0x169d('0x14'),_0x2dc570,_0x169d('0x15'));logger[_0x169d('0x16')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2dc570,'request\x20sent',JSON['stringify'](_0x13676d));if(_0x13676d[_0x169d('0x17')]){if(_0x13676d[_0x169d('0x17')][_0x169d('0x18')]===0x1f4){logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);return _0x41f85d(_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);}logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);return _0x38010a(_0x13676d[_0x169d('0x17')][_0x169d('0x19')]);}else{logger['info'](_0x169d('0x14'),_0x2dc570,'request\x20sent');_0x38010a(_0x13676d[_0x169d('0x1a')][_0x169d('0x19')]);}})[_0x169d('0x1b')](function(_0x957cfc){logger[_0x169d('0x17')](_0x169d('0x14'),_0x2dc570,_0x957cfc);_0x41f85d(_0x957cfc);});});}exports[_0x169d('0x1c')]=function(_0x47bf84){var _0x5626fe=this;return new Promise(function(_0x43f537,_0x484889){return db[_0x169d('0x1d')][_0x169d('0x1e')](_0x47bf84['body'],{'raw':_0x47bf84['options']?_0x47bf84[_0x169d('0x1f')][_0x169d('0x20')]===undefined?!![]:![]:!![]})[_0x169d('0x12')](function(_0x118d17){logger[_0x169d('0x13')](_0x169d('0x1c'),_0x47bf84);logger[_0x169d('0x16')](_0x169d('0x1c'),_0x47bf84,JSON[_0x169d('0x21')](_0x118d17));_0x43f537(_0x118d17);})[_0x169d('0x1b')](function(_0x491565){logger[_0x169d('0x17')](_0x169d('0x1c'),_0x491565[_0x169d('0x19')],_0x47bf84);_0x484889(_0x5626fe[_0x169d('0x17')](0x1f4,_0x491565[_0x169d('0x19')]));});});}; \ No newline at end of file +var _0x9a43=['catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x32ce1d,_0x172de1){var _0x373712=function(_0x33fc6c){while(--_0x33fc6c){_0x32ce1d['push'](_0x32ce1d['shift']());}};_0x373712(++_0x172de1);}(_0x9a43,0x143));var _0x39a4=function(_0x198247,_0x491c12){_0x198247=_0x198247-0x0;var _0x2b18bc=_0x9a43[_0x198247];return _0x2b18bc;};'use strict';var _=require(_0x39a4('0x0'));var util=require(_0x39a4('0x1'));var moment=require(_0x39a4('0x2'));var BPromise=require(_0x39a4('0x3'));var rs=require(_0x39a4('0x4'));var fs=require('fs');var Redis=require(_0x39a4('0x5'));var db=require(_0x39a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x39a4('0x7'))(_0x39a4('0x8'));var config=require(_0x39a4('0x9'));var jayson=require(_0x39a4('0xa'));var client=jayson[_0x39a4('0xb')]['http']({'port':0x232a});config['redis']=_[_0x39a4('0xc')](config['redis'],{'host':_0x39a4('0xd'),'port':0x18eb});var socket=require(_0x39a4('0xe'))(new Redis(config[_0x39a4('0xf')]));require(_0x39a4('0x10'))[_0x39a4('0x11')](socket);function respondWithRpcPromise(_0x4278f0,_0x8f248e,_0x5935f5){return new BPromise(function(_0x55f2e2,_0x58408f){return client['request'](_0x4278f0,_0x5935f5)['then'](function(_0x35e1fd){logger['info'](_0x39a4('0x12'),_0x8f248e,'request\x20sent');logger[_0x39a4('0x13')](_0x39a4('0x14'),_0x8f248e,_0x39a4('0x15'),JSON[_0x39a4('0x16')](_0x35e1fd));if(_0x35e1fd[_0x39a4('0x17')]){if(_0x35e1fd['error']['code']===0x1f4){logger[_0x39a4('0x17')](_0x39a4('0x12'),_0x8f248e,_0x35e1fd[_0x39a4('0x17')]['message']);return _0x58408f(_0x35e1fd[_0x39a4('0x17')][_0x39a4('0x18')]);}logger[_0x39a4('0x17')](_0x39a4('0x12'),_0x8f248e,_0x35e1fd['error'][_0x39a4('0x18')]);return _0x55f2e2(_0x35e1fd[_0x39a4('0x17')][_0x39a4('0x18')]);}else{logger[_0x39a4('0x19')](_0x39a4('0x12'),_0x8f248e,_0x39a4('0x15'));_0x55f2e2(_0x35e1fd[_0x39a4('0x1a')][_0x39a4('0x18')]);}})[_0x39a4('0x1b')](function(_0x4590f7){logger[_0x39a4('0x17')](_0x39a4('0x12'),_0x8f248e,_0x4590f7);_0x58408f(_0x4590f7);});});}exports[_0x39a4('0x1c')]=function(_0x403d57){var _0x469bd1=this;return new Promise(function(_0x2d6d21,_0x4b0b75){return db[_0x39a4('0x1d')][_0x39a4('0x1e')](_0x403d57[_0x39a4('0x1f')],{'raw':_0x403d57[_0x39a4('0x20')]?_0x403d57[_0x39a4('0x20')][_0x39a4('0x21')]===undefined?!![]:![]:!![]})[_0x39a4('0x22')](function(_0xe3d07b){logger[_0x39a4('0x19')](_0x39a4('0x1c'),_0x403d57);logger[_0x39a4('0x13')](_0x39a4('0x1c'),_0x403d57,JSON[_0x39a4('0x16')](_0xe3d07b));_0x2d6d21(_0xe3d07b);})[_0x39a4('0x1b')](function(_0x17490f){logger[_0x39a4('0x17')](_0x39a4('0x1c'),_0x17490f[_0x39a4('0x18')],_0x403d57);_0x4b0b75(_0x469bd1[_0x39a4('0x17')](0x1f4,_0x17490f[_0x39a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index fc1562e..53edce6 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 _0x56e7=['emit','removeListener','length','save','remove'];(function(_0x35d4e4,_0x19ea70){var _0x520d8a=function(_0x5455ed){while(--_0x5455ed){_0x35d4e4['push'](_0x35d4e4['shift']());}};_0x520d8a(++_0x19ea70);}(_0x56e7,0x7b));var _0x756e=function(_0x28efa0,_0x481587){_0x28efa0=_0x28efa0-0x0;var _0x110f72=_0x56e7[_0x28efa0];return _0x110f72;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x756e('0x0'),_0x756e('0x1'),'update'];function createListener(_0x2eadee,_0x3efe5c){return function(_0x46a672){_0x3efe5c[_0x756e('0x2')](_0x2eadee,_0x46a672);};}function removeListener(_0x11ce5f,_0x38546a){return function(){ChatMessageEvents[_0x756e('0x3')](_0x11ce5f,_0x38546a);};}exports['register']=function(_0x3b3b8f){for(var _0x404189=0x0,_0x26519d=events[_0x756e('0x4')];_0x404189<_0x26519d;_0x404189++){var _0x5c8589=events[_0x404189];var _0x1c6a22=createListener('chatMessage:'+_0x5c8589,_0x3b3b8f);ChatMessageEvents['on'](_0x5c8589,_0x1c6a22);}}; \ No newline at end of file +var _0x91c6=['removeListener','register','chatMessage:','./chatMessage.events','update','emit'];(function(_0x584bc4,_0x526008){var _0x2c231c=function(_0xf9a356){while(--_0xf9a356){_0x584bc4['push'](_0x584bc4['shift']());}};_0x2c231c(++_0x526008);}(_0x91c6,0xf9));var _0x691c=function(_0x59b6ff,_0x348bf4){_0x59b6ff=_0x59b6ff-0x0;var _0x28e00b=_0x91c6[_0x59b6ff];return _0x28e00b;};'use strict';var ChatMessageEvents=require(_0x691c('0x0'));var events=['save','remove',_0x691c('0x1')];function createListener(_0x20c69c,_0xafe4d5){return function(_0xa59a0a){_0xafe4d5[_0x691c('0x2')](_0x20c69c,_0xa59a0a);};}function removeListener(_0x4944ce,_0xa14528){return function(){ChatMessageEvents[_0x691c('0x3')](_0x4944ce,_0xa14528);};}exports[_0x691c('0x4')]=function(_0x1b2e82){for(var _0x3dddf8=0x0,_0x29876a=events['length'];_0x3dddf8<_0x29876a;_0x3dddf8++){var _0x93b7b0=events[_0x3dddf8];var _0x40629a=createListener(_0x691c('0x5')+_0x93b7b0,_0x1b2e82);ChatMessageEvents['on'](_0x93b7b0,_0x40629a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4537fb9..1052830 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 _0x74e7=['post','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5b5868,_0x5215e2){var _0x2decaa=function(_0x1ffbcc){while(--_0x1ffbcc){_0x5b5868['push'](_0x5b5868['shift']());}};_0x2decaa(++_0x5215e2);}(_0x74e7,0x1d6));var _0x774e=function(_0x54bb8c,_0x1b3e97){_0x54bb8c=_0x54bb8c-0x0;var _0x18ccc0=_0x74e7[_0x54bb8c];return _0x18ccc0;};'use strict';var multer=require(_0x774e('0x0'));var util=require(_0x774e('0x1'));var path=require(_0x774e('0x2'));var timeout=require('connect-timeout');var express=require(_0x774e('0x3'));var router=express['Router']();var fs_extra=require(_0x774e('0x4'));var auth=require(_0x774e('0x5'));var interaction=require(_0x774e('0x6'));var config=require('../../config/environment');var controller=require(_0x774e('0x7'));router[_0x774e('0x8')]('/',auth[_0x774e('0x9')](),controller[_0x774e('0xa')]);router[_0x774e('0x8')](_0x774e('0xb'),auth[_0x774e('0x9')](),controller['describe']);router[_0x774e('0x8')](_0x774e('0xc'),auth[_0x774e('0x9')](),controller[_0x774e('0xd')]);router[_0x774e('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('chat','chatmessage:create'),controller[_0x774e('0xf')]);router[_0x774e('0x10')]('/:id',controller[_0x774e('0x11')]);router[_0x774e('0x10')](_0x774e('0x12'),auth[_0x774e('0x9')](),controller[_0x774e('0x13')]);router[_0x774e('0x10')](_0x774e('0x14'),auth[_0x774e('0x9')](),controller[_0x774e('0x15')]);router['delete'](_0x774e('0xc'),auth[_0x774e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd046=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x1dcbbb,_0x5e0394){var _0x19d5d6=function(_0x57d24f){while(--_0x57d24f){_0x1dcbbb['push'](_0x1dcbbb['shift']());}};_0x19d5d6(++_0x5e0394);}(_0xd046,0xfb));var _0x6d04=function(_0x3162dc,_0x22e8ef){_0x3162dc=_0x3162dc-0x0;var _0x23183a=_0xd046[_0x3162dc];return _0x23183a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d04('0x0'));var timeout=require('connect-timeout');var express=require(_0x6d04('0x1'));var router=express['Router']();var fs_extra=require(_0x6d04('0x2'));var auth=require(_0x6d04('0x3'));var interaction=require(_0x6d04('0x4'));var config=require(_0x6d04('0x5'));var controller=require('./chatMessage.controller');router[_0x6d04('0x6')]('/',auth['isAuthenticated'](),controller[_0x6d04('0x7')]);router[_0x6d04('0x6')]('/describe',auth[_0x6d04('0x8')](),controller[_0x6d04('0x9')]);router['get'](_0x6d04('0xa'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xb')]);router[_0x6d04('0xc')]('/',auth['isAuthenticated'](),interaction[_0x6d04('0xd')](_0x6d04('0xe'),_0x6d04('0xf')),controller[_0x6d04('0x10')]);router[_0x6d04('0x11')](_0x6d04('0xa'),controller[_0x6d04('0x12')]);router[_0x6d04('0x11')](_0x6d04('0x13'),auth[_0x6d04('0x8')](),controller[_0x6d04('0x14')]);router['put'](_0x6d04('0x15'),auth[_0x6d04('0x8')](),controller[_0x6d04('0x16')]);router[_0x6d04('0x17')](_0x6d04('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 351f5a5..017effd 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x28b29a,_0x2db6d4){var _0x306ac1=function(_0x4e005d){while(--_0x4e005d){_0x28b29a['push'](_0x28b29a['shift']());}};_0x306ac1(++_0x2db6d4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21a2e1,_0x548682){_0x21a2e1=_0x21a2e1-0x0;var _0x4f15e1=_0x5f2f[_0x21a2e1];return _0x4f15e1;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x4cbe5e,_0x29f27d){var _0x57cc37=function(_0x78debe){while(--_0x78debe){_0x4cbe5e['push'](_0x4cbe5e['shift']());}};_0x57cc37(++_0x29f27d);}(_0xadb5,0xad));var _0x5adb=function(_0x4d8e02,_0x806390){_0x4d8e02=_0x4d8e02-0x0;var _0x1b567e=_0xadb5[_0x4d8e02];return _0x1b567e;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 15c380c..45286d9 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(_0x3a4de8,_0x823276){var _0x4ca5a8=function(_0x883b7e){while(--_0x883b7e){_0x3a4de8['push'](_0x3a4de8['shift']());}};_0x4ca5a8(++_0x823276);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7a54,0x106));var _0x47a5=function(_0x223d21,_0x1099ef){_0x223d21=_0x223d21-0x0;var _0x290052=_0x7a54[_0x223d21];return _0x290052;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 16da497..6b515f8 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 _0x00f0=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x48e49c,_0x18f577){var _0x4e0448=function(_0x5661e4){while(--_0x5661e4){_0x48e49c['push'](_0x48e49c['shift']());}};_0x4e0448(++_0x18f577);}(_0x00f0,0xec));var _0x000f=function(_0x4ae70d,_0x2f2082){_0x4ae70d=_0x4ae70d-0x0;var _0x446f8b=_0x00f0[_0x4ae70d];return _0x446f8b;};'use strict';var EventEmitter=require(_0x000f('0x0'));var ChatOfflineMessage=require(_0x000f('0x1'))['db'][_0x000f('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x000f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x000f('0x4')};function emitEvent(_0x4c8ce1){return function(_0x3cd8ed,_0x53989d,_0x3a0613){ChatOfflineMessageEvents[_0x000f('0x5')](_0x4c8ce1+':'+_0x3cd8ed['id'],_0x3cd8ed);ChatOfflineMessageEvents['emit'](_0x4c8ce1,_0x3cd8ed);_0x3a0613(null);};}for(var e in events){if(events[_0x000f('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x000f('0x7')](e,emitEvent(event));}}module[_0x000f('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4579=['update','remove','emit','hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x5a85a6,_0x11738d){var _0x1cc0cc=function(_0x203be9){while(--_0x203be9){_0x5a85a6['push'](_0x5a85a6['shift']());}};_0x1cc0cc(++_0x11738d);}(_0x4579,0x164));var _0x9457=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4579[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x9457('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x9457('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9457('0x2')](0x0);var events={'afterCreate':_0x9457('0x3'),'afterUpdate':_0x9457('0x4'),'afterDestroy':_0x9457('0x5')};function emitEvent(_0x39816c){return function(_0x11d530,_0x137554,_0x3fae20){ChatOfflineMessageEvents[_0x9457('0x6')](_0x39816c+':'+_0x11d530['id'],_0x11d530);ChatOfflineMessageEvents['emit'](_0x39816c,_0x11d530);_0x3fae20(null);};}for(var e in events){if(events[_0x9457('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x9457('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 6905caa..22aac89 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 _0xda44=['chat_offline_messages','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x2e9f28,_0x18a89e){var _0x248a5d=function(_0x188ba1){while(--_0x188ba1){_0x2e9f28['push'](_0x2e9f28['shift']());}};_0x248a5d(++_0x18a89e);}(_0xda44,0x13c));var _0x4da4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xda44[_0x2ec461];return _0x28603d;};'use strict';var attributes=require(_0x4da4('0x0'));module[_0x4da4('0x1')]=function(_0x2e07ba){return _0x2e07ba[_0x4da4('0x2')](_0x4da4('0x3'),attributes,{'tableName':_0x4da4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe244=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe244,0xf8));var _0x4e24=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe244[_0x13e741];return _0x3f8bb3;};'use strict';var attributes=require(_0x4e24('0x0'));module[_0x4e24('0x1')]=function(_0x41f19d){return _0x41f19d[_0x4e24('0x2')](_0x4e24('0x3'),attributes,{'tableName':_0x4e24('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4e24('0x5'),'collate':_0x4e24('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 472974e..b5094ca 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 _0xb9d5=['../../config/environment','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x51fb2f,_0x37f004){var _0x40be65=function(_0x296aaa){while(--_0x296aaa){_0x51fb2f['push'](_0x51fb2f['shift']());}};_0x40be65(++_0x37f004);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x4fd3d3,_0x3f34ff){_0x4fd3d3=_0x4fd3d3-0x0;var _0x36e697=_0xb9d5[_0x4fd3d3];return _0x36e697;};'use strict';var _=require('lodash');var util=require(_0x5b9d('0x0'));var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b9d('0x3'))['db'];var utils=require(_0x5b9d('0x4'));var logger=require(_0x5b9d('0x5'))(_0x5b9d('0x6'));var config=require(_0x5b9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b9d('0x8')][_0x5b9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c89ce,_0x35bde3,_0x300797){return new BPromise(function(_0x546207,_0x2fb79c){return client['request'](_0x9c89ce,_0x300797)[_0x5b9d('0xa')](function(_0x35c60b){logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));logger['debug'](_0x5b9d('0xe'),_0x35bde3,_0x5b9d('0xd'),JSON[_0x5b9d('0xf')](_0x35c60b));if(_0x35c60b['error']){if(_0x35c60b['error'][_0x5b9d('0x10')]===0x1f4){logger[_0x5b9d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x35bde3,_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);return _0x2fb79c(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}logger[_0x5b9d('0x11')](_0x5b9d('0xc'),_0x35bde3,_0x35c60b[_0x5b9d('0x11')]['message']);return _0x546207(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}else{logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));_0x546207(_0x35c60b[_0x5b9d('0x13')][_0x5b9d('0x12')]);}})[_0x5b9d('0x14')](function(_0xea2730){logger['error'](_0x5b9d('0xc'),_0x35bde3,_0xea2730);_0x2fb79c(_0xea2730);});});} \ No newline at end of file +var _0xa992=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3ec521,_0x53acdd){var _0x594e4b=function(_0x5baea7){while(--_0x5baea7){_0x3ec521['push'](_0x3ec521['shift']());}};_0x594e4b(++_0x53acdd);}(_0xa992,0x18c));var _0x2a99=function(_0x1ad28d,_0x338468){_0x1ad28d=_0x1ad28d-0x0;var _0x3327ef=_0xa992[_0x1ad28d];return _0x3327ef;};'use strict';var _=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var moment=require(_0x2a99('0x2'));var BPromise=require(_0x2a99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a99('0x4'));var db=require(_0x2a99('0x5'))['db'];var utils=require(_0x2a99('0x6'));var logger=require(_0x2a99('0x7'))(_0x2a99('0x8'));var config=require(_0x2a99('0x9'));var jayson=require(_0x2a99('0xa'));var client=jayson[_0x2a99('0xb')][_0x2a99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9325b0,_0x483fb7,_0x365583){return new BPromise(function(_0x3b6f29,_0x3edcfc){return client[_0x2a99('0xd')](_0x9325b0,_0x365583)[_0x2a99('0xe')](function(_0x243164){logger[_0x2a99('0xf')](_0x2a99('0x10'),_0x483fb7,_0x2a99('0x11'));logger[_0x2a99('0x12')](_0x2a99('0x13'),_0x483fb7,'request\x20sent',JSON['stringify'](_0x243164));if(_0x243164[_0x2a99('0x14')]){if(_0x243164[_0x2a99('0x14')][_0x2a99('0x15')]===0x1f4){logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x243164[_0x2a99('0x14')]['message']);return _0x3edcfc(_0x243164[_0x2a99('0x14')][_0x2a99('0x16')]);}logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x243164[_0x2a99('0x14')]['message']);return _0x3b6f29(_0x243164[_0x2a99('0x14')]['message']);}else{logger['info'](_0x2a99('0x10'),_0x483fb7,_0x2a99('0x11'));_0x3b6f29(_0x243164[_0x2a99('0x17')]['message']);}})['catch'](function(_0x55d1f0){logger[_0x2a99('0x14')](_0x2a99('0x10'),_0x483fb7,_0x55d1f0);_0x3edcfc(_0x55d1f0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 99c2f4a..1af099b 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 _0xd5a4=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0xd5a4,0xb8));var _0x4d5a=function(_0x468c2a,_0x4a1ca7){_0x468c2a=_0x468c2a-0x0;var _0x2c7fee=_0xd5a4[_0x468c2a];return _0x2c7fee;};'use strict';var multer=require(_0x4d5a('0x0'));var util=require(_0x4d5a('0x1'));var path=require('path');var timeout=require(_0x4d5a('0x2'));var express=require(_0x4d5a('0x3'));var router=express[_0x4d5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d5a('0x6'));var controller=require(_0x4d5a('0x7'));router[_0x4d5a('0x8')]('/',auth[_0x4d5a('0x9')](),controller[_0x4d5a('0xa')]);router['get']('/describe',auth[_0x4d5a('0x9')](),controller[_0x4d5a('0xb')]);router[_0x4d5a('0x8')](_0x4d5a('0xc'),auth['isAuthenticated'](),controller[_0x4d5a('0xd')]);router[_0x4d5a('0xe')]('/',auth[_0x4d5a('0x9')](),controller['create']);router[_0x4d5a('0xf')](_0x4d5a('0xc'),auth[_0x4d5a('0x9')](),controller[_0x4d5a('0x10')]);router['delete'](_0x4d5a('0xc'),auth[_0x4d5a('0x9')](),controller[_0x4d5a('0x11')]);module[_0x4d5a('0x12')]=router; \ No newline at end of file +var _0xc062=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xc062,0x1c9));var _0x2c06=function(_0x266c25,_0x58bbff){_0x266c25=_0x266c25-0x0;var _0x500041=_0xc062[_0x266c25];return _0x500041;};'use strict';var multer=require('multer');var util=require(_0x2c06('0x0'));var path=require(_0x2c06('0x1'));var timeout=require(_0x2c06('0x2'));var express=require(_0x2c06('0x3'));var router=express[_0x2c06('0x4')]();var fs_extra=require(_0x2c06('0x5'));var auth=require(_0x2c06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c06('0x7'));var controller=require(_0x2c06('0x8'));router[_0x2c06('0x9')]('/',auth[_0x2c06('0xa')](),controller[_0x2c06('0xb')]);router[_0x2c06('0x9')](_0x2c06('0xc'),auth[_0x2c06('0xa')](),controller[_0x2c06('0xd')]);router[_0x2c06('0x9')](_0x2c06('0xe'),auth[_0x2c06('0xa')](),controller[_0x2c06('0xf')]);router[_0x2c06('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2c06('0xe'),auth[_0x2c06('0xa')](),controller[_0x2c06('0x11')]);router['delete']('/:id',auth[_0x2c06('0xa')](),controller['destroy']);module[_0x2c06('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ceec771..5441d83 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 _0xe0ed=['sequelize','exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x49d30a,_0xa737c2){var _0x6a6025=function(_0x38ee16){while(--_0x38ee16){_0x49d30a['push'](_0x49d30a['shift']());}};_0x6a6025(++_0xa737c2);}(_0xe0ed,0x1ab));var _0xde0e=function(_0x1258f9,_0x5dc8f3){_0x1258f9=_0x1258f9-0x0;var _0x1f8a78=_0xe0ed[_0x1258f9];return _0x1f8a78;};'use strict';var Sequelize=require(_0xde0e('0x0'));module[_0xde0e('0x1')]={'name':{'type':Sequelize[_0xde0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xde0e('0x3')](_0xde0e('0x4'),_0xde0e('0x5')),'defaultValue':_0xde0e('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xde0e('0x6')]}}; \ No newline at end of file +var _0xc00b=['INTEGER','sequelize','ENUM','STRING'];(function(_0x2b463b,_0x3cbff7){var _0x5d527a=function(_0x25cac3){while(--_0x25cac3){_0x2b463b['push'](_0x2b463b['shift']());}};_0x5d527a(++_0x3cbff7);}(_0xc00b,0x105));var _0xbc00=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xc00b[_0x4cc492];return _0x1f36b9;};'use strict';var Sequelize=require(_0xbc00('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbc00('0x1')]('mouseOver','timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xbc00('0x2')]},'timeout':{'type':Sequelize[_0xbc00('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fcd9b0a..1610946 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 _0x777f=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','ChatProactiveAction','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1aa66f,_0x275c62){var _0xda3e71=function(_0x2b09d3){while(--_0x2b09d3){_0x1aa66f['push'](_0x1aa66f['shift']());}};_0xda3e71(++_0x275c62);}(_0x777f,0x9f));var _0xf777=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x777f[_0x326e79];return _0x37eb89;};'use strict';var emlformat=require(_0xf777('0x0'));var rimraf=require(_0xf777('0x1'));var zipdir=require(_0xf777('0x2'));var jsonpatch=require(_0xf777('0x3'));var rp=require(_0xf777('0x4'));var moment=require(_0xf777('0x5'));var BPromise=require(_0xf777('0x6'));var Mustache=require(_0xf777('0x7'));var util=require('util');var path=require(_0xf777('0x8'));var sox=require(_0xf777('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf777('0xa'));var squel=require(_0xf777('0xb'));var crypto=require(_0xf777('0xc'));var jsforce=require(_0xf777('0xd'));var deskjs=require(_0xf777('0xe'));var toCsv=require(_0xf777('0xf'));var querystring=require(_0xf777('0x10'));var Papa=require(_0xf777('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf777('0x12'));var hardwareService=require(_0xf777('0x13'));var logger=require('../../config/logger')(_0xf777('0x14'));var utils=require(_0xf777('0x15'));var config=require(_0xf777('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf777('0x17'))['db'];function respondWithStatusCode(_0x43c032,_0x5d7c2b){_0x5d7c2b=_0x5d7c2b||0xcc;return function(_0x1c8c65){if(_0x1c8c65){return _0x43c032[_0xf777('0x18')](_0x5d7c2b);}return _0x43c032[_0xf777('0x19')](_0x5d7c2b)[_0xf777('0x1a')]();};}function respondWithResult(_0x4d2173,_0x52e5a1){_0x52e5a1=_0x52e5a1||0xc8;return function(_0x8a1436){if(_0x8a1436){return _0x4d2173['status'](_0x52e5a1)[_0xf777('0x1b')](_0x8a1436);}};}function respondWithFilteredResult(_0x18aa74,_0x182c00){return function(_0x5780f5){if(_0x5780f5){var _0x3ecaa5=typeof _0x182c00[_0xf777('0x1c')]===_0xf777('0x1d')&&typeof _0x182c00[_0xf777('0x1e')]===_0xf777('0x1d');var _0xb3908a=_0x5780f5[_0xf777('0x1f')];var _0x3e0ba3=_0x3ecaa5?0x0:_0x182c00[_0xf777('0x1c')];var _0x126f72=_0x3ecaa5?_0x5780f5[_0xf777('0x1f')]:_0x182c00['offset']+_0x182c00[_0xf777('0x1e')];var _0x4e0edb;if(_0x126f72>=_0xb3908a){_0x126f72=_0xb3908a;_0x4e0edb=0xc8;}else{_0x4e0edb=0xce;}_0x18aa74[_0xf777('0x19')](_0x4e0edb);return _0x18aa74['set'](_0xf777('0x20'),_0x3e0ba3+'-'+_0x126f72+'/'+_0xb3908a)['json'](_0x5780f5);}return null;};}function patchUpdates(_0x4c6d39){return function(_0x3b4b0e){try{jsonpatch[_0xf777('0x21')](_0x3b4b0e,_0x4c6d39,!![]);}catch(_0x4e370b){return BPromise[_0xf777('0x22')](_0x4e370b);}return _0x3b4b0e[_0xf777('0x23')]();};}function saveUpdates(_0x50bddb,_0x55c56a){return function(_0x54bdf8){if(_0x54bdf8){return _0x54bdf8[_0xf777('0x24')](_0x50bddb)[_0xf777('0x25')](function(_0x527305){return _0x527305;});}return null;};}function removeEntity(_0x57d2b4,_0x43384d){return function(_0x5a0a3f){if(_0x5a0a3f){return _0x5a0a3f[_0xf777('0x26')]()['then'](function(){_0x57d2b4[_0xf777('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd176,_0x2a1c7f){return function(_0x4d4296){if(!_0x4d4296){_0x4fd176[_0xf777('0x18')](0x194);}return _0x4d4296;};}function handleError(_0x48a961,_0x130461){_0x130461=_0x130461||0x1f4;return function(_0x1a1d74){logger[_0xf777('0x27')](_0x1a1d74[_0xf777('0x28')]);if(_0x1a1d74[_0xf777('0x29')]){delete _0x1a1d74[_0xf777('0x29')];}_0x48a961['status'](_0x130461)[_0xf777('0x2a')](_0x1a1d74);};}exports[_0xf777('0x2b')]=function(_0x13b2a8,_0x4f38f2){var _0x4f6933={'raw':!![],'where':{'id':_0x13b2a8['params']['id']}},_0x451e21={};_0x451e21[_0xf777('0x2c')]=_['keys'](db[_0xf777('0x2d')]['rawAttributes']);_0x451e21[_0xf777('0x2e')]=_[_0xf777('0x2f')](_0x13b2a8[_0xf777('0x2e')]);_0x451e21[_0xf777('0x30')]=_[_0xf777('0x31')](_0x451e21[_0xf777('0x2c')],_0x451e21['query']);_0x4f6933[_0xf777('0x32')]=_[_0xf777('0x31')](_0x451e21[_0xf777('0x2c')],qs[_0xf777('0x33')](_0x13b2a8[_0xf777('0x2e')][_0xf777('0x33')]));_0x4f6933[_0xf777('0x32')]=_0x4f6933['attributes'][_0xf777('0x34')]?_0x4f6933[_0xf777('0x32')]:_0x451e21[_0xf777('0x2c')];if(_0x13b2a8[_0xf777('0x2e')][_0xf777('0x35')]){_0x4f6933[_0xf777('0x36')]=[{'all':!![]}];}_0x4f6933=_['merge']({},_0x4f6933,_0x13b2a8[_0xf777('0x37')]);return db[_0xf777('0x2d')][_0xf777('0x38')](_0x4f6933)[_0xf777('0x25')](handleEntityNotFound(_0x4f38f2,null))[_0xf777('0x25')](respondWithResult(_0x4f38f2,null))[_0xf777('0x39')](handleError(_0x4f38f2,null));};exports[_0xf777('0x3a')]=function(_0x88cbc8,_0x49c864){return db[_0xf777('0x2d')][_0xf777('0x3a')](_0x88cbc8[_0xf777('0x3b')],{})[_0xf777('0x25')](respondWithResult(_0x49c864,0xc9))['catch'](handleError(_0x49c864,null));};exports[_0xf777('0x24')]=function(_0x5c5a43,_0x377c85){if(_0x5c5a43[_0xf777('0x3b')]['id']){delete _0x5c5a43[_0xf777('0x3b')]['id'];}return db[_0xf777('0x2d')]['find']({'where':{'id':_0x5c5a43['params']['id']}})[_0xf777('0x25')](handleEntityNotFound(_0x377c85,null))[_0xf777('0x25')](saveUpdates(_0x5c5a43[_0xf777('0x3b')],null))[_0xf777('0x25')](respondWithResult(_0x377c85,null))['catch'](handleError(_0x377c85,null));};exports[_0xf777('0x26')]=function(_0x47e847,_0x5f4757){return db[_0xf777('0x2d')][_0xf777('0x38')]({'where':{'id':_0x47e847['params']['id']}})[_0xf777('0x25')](handleEntityNotFound(_0x5f4757,null))[_0xf777('0x25')](removeEntity(_0x5f4757,null))['catch'](handleError(_0x5f4757,null));}; \ No newline at end of file +var _0x254a=['offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x254a,0x138));var _0xa254=function(_0x5d289a,_0x352880){_0x5d289a=_0x5d289a-0x0;var _0x14bd5f=_0x254a[_0x5d289a];return _0x14bd5f;};'use strict';var emlformat=require(_0xa254('0x0'));var rimraf=require(_0xa254('0x1'));var zipdir=require(_0xa254('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa254('0x3'));var moment=require(_0xa254('0x4'));var BPromise=require(_0xa254('0x5'));var Mustache=require(_0xa254('0x6'));var util=require('util');var path=require(_0xa254('0x7'));var sox=require('sox');var csv=require(_0xa254('0x8'));var ejs=require(_0xa254('0x9'));var fs=require('fs');var fs_extra=require(_0xa254('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa254('0xb'));var jsforce=require(_0xa254('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa254('0x8'));var querystring=require('querystring');var Papa=require(_0xa254('0xd'));var Redis=require(_0xa254('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa254('0xf'));var hardwareService=require(_0xa254('0x10'));var logger=require(_0xa254('0x11'))(_0xa254('0x12'));var utils=require(_0xa254('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa254('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a2b59,_0x264548){_0x264548=_0x264548||0xcc;return function(_0x1e3cf8){if(_0x1e3cf8){return _0x4a2b59['sendStatus'](_0x264548);}return _0x4a2b59[_0xa254('0x15')](_0x264548)[_0xa254('0x16')]();};}function respondWithResult(_0x3f6cc5,_0x1d8ee5){_0x1d8ee5=_0x1d8ee5||0xc8;return function(_0x276480){if(_0x276480){return _0x3f6cc5['status'](_0x1d8ee5)[_0xa254('0x17')](_0x276480);}};}function respondWithFilteredResult(_0x1af363,_0x7532b7){return function(_0x24bd0f){if(_0x24bd0f){var _0x37586e=typeof _0x7532b7[_0xa254('0x18')]===_0xa254('0x19')&&typeof _0x7532b7[_0xa254('0x1a')]===_0xa254('0x19');var _0x5b5de4=_0x24bd0f['count'];var _0x4a249f=_0x37586e?0x0:_0x7532b7[_0xa254('0x18')];var _0x2dcf3a=_0x37586e?_0x24bd0f[_0xa254('0x1b')]:_0x7532b7[_0xa254('0x18')]+_0x7532b7[_0xa254('0x1a')];var _0x1b7773;if(_0x2dcf3a>=_0x5b5de4){_0x2dcf3a=_0x5b5de4;_0x1b7773=0xc8;}else{_0x1b7773=0xce;}_0x1af363[_0xa254('0x15')](_0x1b7773);return _0x1af363['set'](_0xa254('0x1c'),_0x4a249f+'-'+_0x2dcf3a+'/'+_0x5b5de4)['json'](_0x24bd0f);}return null;};}function patchUpdates(_0x338359){return function(_0x2b8645){try{jsonpatch['apply'](_0x2b8645,_0x338359,!![]);}catch(_0x3a1927){return BPromise[_0xa254('0x1d')](_0x3a1927);}return _0x2b8645['save']();};}function saveUpdates(_0x5d8bcc,_0x34c7c4){return function(_0xba5a72){if(_0xba5a72){return _0xba5a72[_0xa254('0x1e')](_0x5d8bcc)['then'](function(_0x2ab840){return _0x2ab840;});}return null;};}function removeEntity(_0x4443e7,_0x446ba9){return function(_0x597291){if(_0x597291){return _0x597291['destroy']()[_0xa254('0x1f')](function(){_0x4443e7[_0xa254('0x15')](0xcc)[_0xa254('0x16')]();});}};}function handleEntityNotFound(_0x413016,_0x54356f){return function(_0x3672c2){if(!_0x3672c2){_0x413016[_0xa254('0x20')](0x194);}return _0x3672c2;};}function handleError(_0x156612,_0x31201b){_0x31201b=_0x31201b||0x1f4;return function(_0x3e3041){logger[_0xa254('0x21')](_0x3e3041[_0xa254('0x22')]);if(_0x3e3041[_0xa254('0x23')]){delete _0x3e3041[_0xa254('0x23')];}_0x156612['status'](_0x31201b)[_0xa254('0x24')](_0x3e3041);};}exports[_0xa254('0x25')]=function(_0x1c9a9b,_0x135cf3){var _0x627344={'raw':!![],'where':{'id':_0x1c9a9b[_0xa254('0x26')]['id']}},_0x5c9e28={};_0x5c9e28[_0xa254('0x27')]=_[_0xa254('0x28')](db[_0xa254('0x29')]['rawAttributes']);_0x5c9e28[_0xa254('0x2a')]=_[_0xa254('0x28')](_0x1c9a9b[_0xa254('0x2a')]);_0x5c9e28[_0xa254('0x2b')]=_[_0xa254('0x2c')](_0x5c9e28[_0xa254('0x27')],_0x5c9e28[_0xa254('0x2a')]);_0x627344[_0xa254('0x2d')]=_['intersection'](_0x5c9e28[_0xa254('0x27')],qs[_0xa254('0x2e')](_0x1c9a9b[_0xa254('0x2a')][_0xa254('0x2e')]));_0x627344['attributes']=_0x627344[_0xa254('0x2d')][_0xa254('0x2f')]?_0x627344[_0xa254('0x2d')]:_0x5c9e28['model'];if(_0x1c9a9b[_0xa254('0x2a')][_0xa254('0x30')]){_0x627344[_0xa254('0x31')]=[{'all':!![]}];}_0x627344=_['merge']({},_0x627344,_0x1c9a9b[_0xa254('0x32')]);return db[_0xa254('0x29')][_0xa254('0x33')](_0x627344)[_0xa254('0x1f')](handleEntityNotFound(_0x135cf3,null))[_0xa254('0x1f')](respondWithResult(_0x135cf3,null))[_0xa254('0x34')](handleError(_0x135cf3,null));};exports[_0xa254('0x35')]=function(_0x26bfd6,_0x172d0d){return db['ChatProactiveAction']['create'](_0x26bfd6[_0xa254('0x36')],{})[_0xa254('0x1f')](respondWithResult(_0x172d0d,0xc9))['catch'](handleError(_0x172d0d,null));};exports[_0xa254('0x1e')]=function(_0x49c956,_0x5d1cd0){if(_0x49c956[_0xa254('0x36')]['id']){delete _0x49c956[_0xa254('0x36')]['id'];}return db[_0xa254('0x29')][_0xa254('0x33')]({'where':{'id':_0x49c956['params']['id']}})[_0xa254('0x1f')](handleEntityNotFound(_0x5d1cd0,null))[_0xa254('0x1f')](saveUpdates(_0x49c956[_0xa254('0x36')],null))[_0xa254('0x1f')](respondWithResult(_0x5d1cd0,null))[_0xa254('0x34')](handleError(_0x5d1cd0,null));};exports[_0xa254('0x37')]=function(_0x3cc843,_0x120195){return db[_0xa254('0x29')][_0xa254('0x33')]({'where':{'id':_0x3cc843[_0xa254('0x26')]['id']}})[_0xa254('0x1f')](handleEntityNotFound(_0x120195,null))[_0xa254('0x1f')](removeEntity(_0x120195,null))['catch'](handleError(_0x120195,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 16f788b..3960038 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 _0xd6ac=['moment','bluebird','request-promise','rimraf','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0xd6ac,0x16f));var _0xcd6a=function(_0x555d51,_0x534544){_0x555d51=_0x555d51-0x0;var _0x2552f8=_0xd6ac[_0x555d51];return _0x2552f8;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var logger=require(_0xcd6a('0x2'))('api');var moment=require(_0xcd6a('0x3'));var BPromise=require(_0xcd6a('0x4'));var rp=require(_0xcd6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd6a('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x55f2db,_0x294007){return _0x55f2db[_0xcd6a('0x7')](_0xcd6a('0x8'),attributes,{'tableName':_0xcd6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42c9=['moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x9b227d,_0x410c63){var _0x4215dd=function(_0x4da3fd){while(--_0x4da3fd){_0x9b227d['push'](_0x9b227d['shift']());}};_0x4215dd(++_0x410c63);}(_0x42c9,0xcc));var _0x942c=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x42c9[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0x942c('0x0'));var util=require(_0x942c('0x1'));var logger=require(_0x942c('0x2'))(_0x942c('0x3'));var moment=require(_0x942c('0x4'));var BPromise=require(_0x942c('0x5'));var rp=require(_0x942c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x942c('0x7'));var config=require('../../config/environment');var attributes=require(_0x942c('0x8'));module[_0x942c('0x9')]=function(_0x46bac6,_0x480115){return _0x46bac6[_0x942c('0xa')](_0x942c('0xb'),attributes,{'tableName':_0x942c('0xc'),'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 45f0a7f..87c1a5f 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 _0xf05e=['rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1da6a8,_0x2d5fcf){var _0x388f23=function(_0x1eca61){while(--_0x1eca61){_0x1da6a8['push'](_0x1da6a8['shift']());}};_0x388f23(++_0x2d5fcf);}(_0xf05e,0x179));var _0xef05=function(_0x59bd3b,_0x53eff9){_0x59bd3b=_0x59bd3b-0x0;var _0x586c53=_0xf05e[_0x59bd3b];return _0x586c53;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var moment=require(_0xef05('0x2'));var BPromise=require(_0xef05('0x3'));var rs=require(_0xef05('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef05('0x5'))['db'];var utils=require(_0xef05('0x6'));var logger=require('../../config/logger')(_0xef05('0x7'));var config=require(_0xef05('0x8'));var jayson=require(_0xef05('0x9'));var client=jayson['client'][_0xef05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530739,_0x48420f,_0x2a4c96){return new BPromise(function(_0x10a0c9,_0x275493){return client[_0xef05('0xb')](_0x530739,_0x2a4c96)[_0xef05('0xc')](function(_0x62743a){logger[_0xef05('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x48420f,'request\x20sent');logger[_0xef05('0xe')](_0xef05('0xf'),_0x48420f,'request\x20sent',JSON[_0xef05('0x10')](_0x62743a));if(_0x62743a[_0xef05('0x11')]){if(_0x62743a[_0xef05('0x11')][_0xef05('0x12')]===0x1f4){logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);return _0x275493(_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);}logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x62743a[_0xef05('0x11')]['message']);return _0x10a0c9(_0x62743a[_0xef05('0x11')][_0xef05('0x14')]);}else{logger[_0xef05('0xd')](_0xef05('0x13'),_0x48420f,_0xef05('0x15'));_0x10a0c9(_0x62743a[_0xef05('0x16')][_0xef05('0x14')]);}})[_0xef05('0x17')](function(_0x44e9b6){logger[_0xef05('0x11')](_0xef05('0x13'),_0x48420f,_0x44e9b6);_0x275493(_0x44e9b6);});});} \ No newline at end of file +var _0xc186=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0xc186,0xed));var _0x6c18=function(_0x66dbff,_0x5f03ab){_0x66dbff=_0x66dbff-0x0;var _0x2c3d2d=_0xc186[_0x66dbff];return _0x2c3d2d;};'use strict';var _=require(_0x6c18('0x0'));var util=require(_0x6c18('0x1'));var moment=require(_0x6c18('0x2'));var BPromise=require(_0x6c18('0x3'));var rs=require(_0x6c18('0x4'));var fs=require('fs');var Redis=require(_0x6c18('0x5'));var db=require(_0x6c18('0x6'))['db'];var utils=require(_0x6c18('0x7'));var logger=require(_0x6c18('0x8'))(_0x6c18('0x9'));var config=require(_0x6c18('0xa'));var jayson=require(_0x6c18('0xb'));var client=jayson[_0x6c18('0xc')][_0x6c18('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33b18e,_0x55d0dc,_0x51a71e){return new BPromise(function(_0x24bafc,_0x39d3a1){return client['request'](_0x33b18e,_0x51a71e)['then'](function(_0xba9893){logger[_0x6c18('0xe')](_0x6c18('0xf'),_0x55d0dc,'request\x20sent');logger[_0x6c18('0x10')](_0x6c18('0x11'),_0x55d0dc,_0x6c18('0x12'),JSON['stringify'](_0xba9893));if(_0xba9893[_0x6c18('0x13')]){if(_0xba9893[_0x6c18('0x13')][_0x6c18('0x14')]===0x1f4){logger[_0x6c18('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x55d0dc,_0xba9893['error']['message']);return _0x39d3a1(_0xba9893[_0x6c18('0x13')][_0x6c18('0x15')]);}logger[_0x6c18('0x13')](_0x6c18('0xf'),_0x55d0dc,_0xba9893[_0x6c18('0x13')][_0x6c18('0x15')]);return _0x24bafc(_0xba9893[_0x6c18('0x13')][_0x6c18('0x15')]);}else{logger[_0x6c18('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x55d0dc,_0x6c18('0x12'));_0x24bafc(_0xba9893[_0x6c18('0x16')][_0x6c18('0x15')]);}})[_0x6c18('0x17')](function(_0x3905e6){logger[_0x6c18('0x13')](_0x6c18('0xf'),_0x55d0dc,_0x3905e6);_0x39d3a1(_0x3905e6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 17e15fd..840ac93 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18a085,_0x2b4a77){var _0x59b09e=function(_0x4dda9d){while(--_0x4dda9d){_0x18a085['push'](_0x18a085['shift']());}};_0x59b09e(++_0x2b4a77);}(_0x326f,0xd1));var _0xf326=function(_0x198171,_0x56c7ce){_0x198171=_0x198171-0x0;var _0x5c8c45=_0x326f[_0x198171];return _0x5c8c45;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x5482af,_0xd50828){var _0x22ea20=function(_0x5b2d6b){while(--_0x5b2d6b){_0x5482af['push'](_0x5482af['shift']());}};_0x22ea20(++_0xd50828);}(_0x1cb9,0x14e));var _0x91cb=function(_0x266408,_0x354f84){_0x266408=_0x266408-0x0;var _0x58930b=_0x1cb9[_0x266408];return _0x58930b;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('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 f7b80e6..2d8f383 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 _0x59b5=['rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x2f0a2c,_0x56b573){var _0x146f78=function(_0x10fcc4){while(--_0x10fcc4){_0x2f0a2c['push'](_0x2f0a2c['shift']());}};_0x146f78(++_0x56b573);}(_0x59b5,0xd3));var _0x559b=function(_0x33d93d,_0xe170b3){_0x33d93d=_0x33d93d-0x0;var _0x2e4150=_0x59b5[_0x33d93d];return _0x2e4150;};'use strict';var Sequelize=require('sequelize');module[_0x559b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x559b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x559b('0x2')]},'timeout':{'type':Sequelize[_0x559b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x559b('0x4')](_0x559b('0x5'),_0x559b('0x6'),_0x559b('0x7'))}}; \ No newline at end of file +var _0x65ba=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3e5411,_0x9b2e68){var _0x537c05=function(_0x1b1cf9){while(--_0x1b1cf9){_0x3e5411['push'](_0x3e5411['shift']());}};_0x537c05(++_0x9b2e68);}(_0x65ba,0xa2));var _0xa65b=function(_0x381ec0,_0x374714){_0x381ec0=_0x381ec0-0x0;var _0x25604c=_0x65ba[_0x381ec0];return _0x25604c;};'use strict';var Sequelize=require(_0xa65b('0x0'));module[_0xa65b('0x1')]={'name':{'type':Sequelize[_0xa65b('0x2')],'unique':_0xa65b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa65b('0x2')]},'timeout':{'type':Sequelize[_0xa65b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa65b('0x5')](_0xa65b('0x6'),_0xa65b('0x7'),_0xa65b('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3e716ae..95d15ce 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 _0x33f8=['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/environment','../../mysqldb','defaults','redis','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','nolimit','options','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','flatMap','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','select','from','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','omit','spread','isArray','getAgents','findOne','rimraf','zip-dir','request-promise','bluebird'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x33f8,0x128));var _0x833f=function(_0x3895ac,_0x4c29ed){_0x3895ac=_0x3895ac-0x0;var _0x45d22b=_0x33f8[_0x3895ac];return _0x45d22b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x833f('0x0'));var zipdir=require(_0x833f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x833f('0x2'));var moment=require('moment');var BPromise=require(_0x833f('0x3'));var Mustache=require(_0x833f('0x4'));var util=require(_0x833f('0x5'));var path=require(_0x833f('0x6'));var sox=require(_0x833f('0x7'));var csv=require(_0x833f('0x8'));var ejs=require(_0x833f('0x9'));var fs=require('fs');var fs_extra=require(_0x833f('0xa'));var _=require(_0x833f('0xb'));var squel=require('squel');var crypto=require(_0x833f('0xc'));var jsforce=require(_0x833f('0xd'));var deskjs=require(_0x833f('0xe'));var toCsv=require(_0x833f('0x8'));var querystring=require(_0x833f('0xf'));var Papa=require(_0x833f('0x10'));var Redis=require(_0x833f('0x11'));var authService=require(_0x833f('0x12'));var qs=require(_0x833f('0x13'));var as=require(_0x833f('0x14'));var hardwareService=require(_0x833f('0x15'));var logger=require(_0x833f('0x16'))(_0x833f('0x17'));var utils=require('../../config/utils');var config=require(_0x833f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x833f('0x19'))['db'];config['redis']=_[_0x833f('0x1a')](config[_0x833f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x833f('0x1c'))[_0x833f('0x1d')](socket);var jayson=require(_0x833f('0x1e'));var client=jayson[_0x833f('0x1f')][_0x833f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x369e30,_0x378873,_0x4cdb51,_0x29c337){return new BPromise(function(_0x42656b,_0x160427){var _0x11ae67=_0x29c337||client;return _0x11ae67[_0x833f('0x21')](_0x369e30,_0x4cdb51)[_0x833f('0x22')](function(_0xdded16){logger[_0x833f('0x23')](_0x833f('0x24'),_0x378873,_0x833f('0x25'));logger[_0x833f('0x26')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x378873,'request\x20sent',JSON['stringify'](_0xdded16));if(_0xdded16[_0x833f('0x27')]){if(_0xdded16[_0x833f('0x27')][_0x833f('0x28')]===0x1f4){logger[_0x833f('0x27')](_0x833f('0x24'),_0x378873,_0xdded16[_0x833f('0x27')]['message']);return _0x160427(_0xdded16[_0x833f('0x27')][_0x833f('0x29')]);}logger['error'](_0x833f('0x24'),_0x378873,_0xdded16['error']['message']);return _0x42656b(_0xdded16[_0x833f('0x27')][_0x833f('0x29')]);}else{logger[_0x833f('0x23')](_0x833f('0x24'),_0x378873,'request\x20sent');_0x42656b(_0xdded16[_0x833f('0x2a')][_0x833f('0x29')]);}})[_0x833f('0x2b')](function(_0x358fc5){logger[_0x833f('0x27')]('ChatQueue,\x20%s,\x20%s',_0x378873,_0x358fc5);_0x160427(_0x358fc5);});});}function respondWithStatusCode(_0x1ee33e,_0xb2de93){_0xb2de93=_0xb2de93||0xcc;return function(_0x5c3d3f){if(_0x5c3d3f){return _0x1ee33e[_0x833f('0x2c')](_0xb2de93);}return _0x1ee33e[_0x833f('0x2d')](_0xb2de93)[_0x833f('0x2e')]();};}function respondWithResult(_0x929af3,_0x457f4a){_0x457f4a=_0x457f4a||0xc8;return function(_0x3e784f){if(_0x3e784f){return _0x929af3[_0x833f('0x2d')](_0x457f4a)[_0x833f('0x2f')](_0x3e784f);}};}function respondWithFilteredResult(_0x46dec0,_0x371bc9){return function(_0x3ca96e){if(_0x3ca96e){var _0x16e017=typeof _0x371bc9[_0x833f('0x30')]==='undefined'&&typeof _0x371bc9[_0x833f('0x31')]===_0x833f('0x32');var _0x4eeef1=_0x3ca96e[_0x833f('0x33')];var _0x4fcb30=_0x16e017?0x0:_0x371bc9[_0x833f('0x30')];var _0x1a5d54=_0x16e017?_0x3ca96e['count']:_0x371bc9[_0x833f('0x30')]+_0x371bc9['limit'];var _0x496f96;if(_0x1a5d54>=_0x4eeef1){_0x1a5d54=_0x4eeef1;_0x496f96=0xc8;}else{_0x496f96=0xce;}_0x46dec0[_0x833f('0x2d')](_0x496f96);return _0x46dec0[_0x833f('0x34')](_0x833f('0x35'),_0x4fcb30+'-'+_0x1a5d54+'/'+_0x4eeef1)[_0x833f('0x2f')](_0x3ca96e);}return null;};}function patchUpdates(_0x4b1edd){return function(_0x14a080){try{jsonpatch['apply'](_0x14a080,_0x4b1edd,!![]);}catch(_0x5a60bc){return BPromise[_0x833f('0x36')](_0x5a60bc);}return _0x14a080[_0x833f('0x37')]();};}function saveUpdates(_0x328e8,_0x141afd){return function(_0x743331){if(_0x743331){return _0x743331[_0x833f('0x38')](_0x328e8)['then'](function(_0x2bf7e5){return _0x2bf7e5;});}return null;};}function removeEntity(_0x4f9613,_0xde4caf){return function(_0x3fe938){if(_0x3fe938){return _0x3fe938[_0x833f('0x39')]()['then'](function(){var _0x173147=_0x3fe938[_0x833f('0x3a')]({'plain':!![]});var _0x48b8d3=_0x833f('0x3b');return db[_0x833f('0x3c')]['destroy']({'where':{'type':_0x48b8d3,'resourceId':_0x173147['id']}})[_0x833f('0x22')](function(){return _0x3fe938;});})[_0x833f('0x22')](function(){_0x4f9613[_0x833f('0x2d')](0xcc)[_0x833f('0x2e')]();});}};}function handleEntityNotFound(_0x55d407,_0x2466e2){return function(_0xe72fed){if(!_0xe72fed){_0x55d407[_0x833f('0x2c')](0x194);}return _0xe72fed;};}function handleError(_0x163113,_0x3eca5a){_0x3eca5a=_0x3eca5a||0x1f4;return function(_0xa86577){logger[_0x833f('0x27')](_0xa86577[_0x833f('0x3d')]);if(_0xa86577[_0x833f('0x3e')]){delete _0xa86577['name'];}_0x163113[_0x833f('0x2d')](_0x3eca5a)[_0x833f('0x3f')](_0xa86577);};}exports[_0x833f('0x40')]=function(_0x1999b7,_0x1ab48){var _0x3ff367={},_0x5d720f={},_0x35c78d={'count':0x0,'rows':[]};var _0x21e10b=_[_0x833f('0x41')](db[_0x833f('0x42')]['rawAttributes'],function(_0x6c9b2){return{'name':_0x6c9b2['fieldName'],'type':_0x6c9b2[_0x833f('0x43')][_0x833f('0x44')]};});_0x5d720f[_0x833f('0x45')]=_['map'](_0x21e10b,_0x833f('0x3e'));_0x5d720f['query']=_[_0x833f('0x46')](_0x1999b7['query']);_0x5d720f[_0x833f('0x47')]=_[_0x833f('0x48')](_0x5d720f[_0x833f('0x45')],_0x5d720f[_0x833f('0x49')]);_0x3ff367['attributes']=_[_0x833f('0x48')](_0x5d720f[_0x833f('0x45')],qs['fields'](_0x1999b7[_0x833f('0x49')]['fields']));_0x3ff367[_0x833f('0x4a')]=_0x3ff367[_0x833f('0x4a')][_0x833f('0x4b')]?_0x3ff367[_0x833f('0x4a')]:_0x5d720f[_0x833f('0x45')];if(!_0x1999b7[_0x833f('0x49')][_0x833f('0x4c')]('nolimit')){_0x3ff367[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x1999b7[_0x833f('0x49')][_0x833f('0x31')]);_0x3ff367[_0x833f('0x30')]=qs['offset'](_0x1999b7[_0x833f('0x49')][_0x833f('0x30')]);}_0x3ff367[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x1999b7[_0x833f('0x49')][_0x833f('0x4e')]);_0x3ff367['where']=qs[_0x833f('0x47')](_[_0x833f('0x4f')](_0x1999b7['query'],_0x5d720f['filters']),_0x21e10b);if(_0x1999b7[_0x833f('0x49')][_0x833f('0x50')]){_0x3ff367[_0x833f('0x51')]=_[_0x833f('0x52')](_0x3ff367[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x21e10b,function(_0x302a9f){if(_0x302a9f[_0x833f('0x43')]!==_0x833f('0x53')){var _0x5a5fb1={};_0x5a5fb1[_0x302a9f[_0x833f('0x3e')]]={'$like':'%'+_0x1999b7[_0x833f('0x49')][_0x833f('0x50')]+'%'};return _0x5a5fb1;}})});}_0x3ff367=_['merge']({},_0x3ff367,_0x1999b7['options']);var _0x36c2e3={'where':_0x3ff367[_0x833f('0x51')]};return db['ChatQueue'][_0x833f('0x33')](_0x36c2e3)['then'](function(_0xa2e161){_0x35c78d[_0x833f('0x33')]=_0xa2e161;if(_0x1999b7[_0x833f('0x49')][_0x833f('0x54')]){_0x3ff367[_0x833f('0x55')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3ff367);})['then'](function(_0x4a1a90){_0x35c78d[_0x833f('0x56')]=_0x4a1a90;return _0x35c78d;})['then'](respondWithFilteredResult(_0x1ab48,_0x3ff367))[_0x833f('0x2b')](handleError(_0x1ab48,null));};exports[_0x833f('0x57')]=function(_0x1332eb,_0x2962a7){var _0x479a31={'raw':!![],'where':{'id':_0x1332eb[_0x833f('0x58')]['id']}},_0x2830fc={};_0x2830fc[_0x833f('0x45')]=_[_0x833f('0x46')](db['ChatQueue'][_0x833f('0x59')]);_0x2830fc[_0x833f('0x49')]=_[_0x833f('0x46')](_0x1332eb[_0x833f('0x49')]);_0x2830fc['filters']=_[_0x833f('0x48')](_0x2830fc['model'],_0x2830fc['query']);_0x479a31[_0x833f('0x4a')]=_['intersection'](_0x2830fc[_0x833f('0x45')],qs[_0x833f('0x5a')](_0x1332eb[_0x833f('0x49')][_0x833f('0x5a')]));_0x479a31[_0x833f('0x4a')]=_0x479a31[_0x833f('0x4a')][_0x833f('0x4b')]?_0x479a31[_0x833f('0x4a')]:_0x2830fc['model'];if(_0x1332eb[_0x833f('0x49')][_0x833f('0x54')]){_0x479a31['include']=[{'all':!![]}];}_0x479a31=_[_0x833f('0x52')]({},_0x479a31,_0x1332eb['options']);return db[_0x833f('0x42')][_0x833f('0x5b')](_0x479a31)[_0x833f('0x22')](handleEntityNotFound(_0x2962a7,null))['then'](respondWithResult(_0x2962a7,null))['catch'](handleError(_0x2962a7,null));};exports[_0x833f('0x5c')]=function(_0xc7245f,_0x2d425f){return db['ChatQueue']['create'](_0xc7245f[_0x833f('0x5d')],{})[_0x833f('0x22')](function(_0x31a713){var _0x60fc28=_0xc7245f['user'][_0x833f('0x3a')]({'plain':!![]});if(!_0x60fc28)throw new Error(_0x833f('0x5e'));if(_0x60fc28[_0x833f('0x5f')]===_0x833f('0x60')){var _0x4afaf2=_0x31a713[_0x833f('0x3a')]({'plain':!![]});var _0x27ef77=_0x833f('0x3b');return db['UserProfileSection'][_0x833f('0x5b')]({'where':{'name':_0x27ef77,'userProfileId':_0x60fc28['userProfileId']},'raw':!![]})[_0x833f('0x22')](function(_0x2d57b1){if(_0x2d57b1&&_0x2d57b1[_0x833f('0x61')]===0x0){return db[_0x833f('0x3c')][_0x833f('0x5c')]({'name':_0x4afaf2[_0x833f('0x3e')],'resourceId':_0x4afaf2['id'],'type':_0x2d57b1['name'],'sectionId':_0x2d57b1['id']},{})['then'](function(){return _0x31a713;});}else{return _0x31a713;}})['catch'](function(_0x1ca025){logger[_0x833f('0x27')](_0x833f('0x62'),_0x1ca025);throw _0x1ca025;});}return _0x31a713;})[_0x833f('0x22')](respondWithResult(_0x2d425f,0xc9))[_0x833f('0x2b')](handleError(_0x2d425f,null));};exports['update']=function(_0x3fad18,_0x3e6b6f){if(_0x3fad18[_0x833f('0x5d')]['id']){delete _0x3fad18[_0x833f('0x5d')]['id'];}return db[_0x833f('0x42')]['find']({'where':{'id':_0x3fad18['params']['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x3e6b6f,null))[_0x833f('0x22')](saveUpdates(_0x3fad18['body'],null))[_0x833f('0x22')](respondWithResult(_0x3e6b6f,null))[_0x833f('0x2b')](handleError(_0x3e6b6f,null));};exports[_0x833f('0x39')]=function(_0x4cea1e,_0x5301b8){return db[_0x833f('0x42')][_0x833f('0x5b')]({'where':{'id':_0x4cea1e[_0x833f('0x58')]['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x5301b8,null))[_0x833f('0x22')](removeEntity(_0x5301b8,null))['catch'](handleError(_0x5301b8,null));};exports[_0x833f('0x63')]=function(_0x56e9b9,_0xfe8750){return db['ChatQueue'][_0x833f('0x63')]()[_0x833f('0x22')](respondWithResult(_0xfe8750,null))[_0x833f('0x2b')](handleError(_0xfe8750,null));};exports[_0x833f('0x64')]=function(_0x5b9df8,_0x575177,_0x1e45b7){var _0x1a3482={'raw':!![],'where':{}},_0xa513b9={},_0x2da040;return db[_0x833f('0x42')]['findOne']({'where':{'id':_0x5b9df8['params']['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x575177,null))['then'](function(_0x30f939){if(_0x30f939){_0x2da040=_0x30f939['get']({'plain':!![]});_0xa513b9[_0x833f('0x45')]=_[_0x833f('0x46')](db[_0x833f('0x65')]['rawAttributes']);_0xa513b9[_0x833f('0x49')]=_['keys'](_0x5b9df8[_0x833f('0x49')]);_0xa513b9[_0x833f('0x47')]=_[_0x833f('0x48')](_0xa513b9[_0x833f('0x45')],_0xa513b9[_0x833f('0x49')]);_0x1a3482[_0x833f('0x4a')]=_[_0x833f('0x48')](_0xa513b9['model'],qs['fields'](_0x5b9df8[_0x833f('0x49')][_0x833f('0x5a')]));_0x1a3482[_0x833f('0x4a')]=_0x1a3482[_0x833f('0x4a')]['length']?_0x1a3482['attributes']:_0xa513b9['model'];if(!_0x5b9df8[_0x833f('0x49')]['hasOwnProperty'](_0x833f('0x66'))){_0x1a3482[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x5b9df8[_0x833f('0x49')][_0x833f('0x31')]);_0x1a3482[_0x833f('0x30')]=qs['offset'](_0x5b9df8[_0x833f('0x49')][_0x833f('0x30')]);}_0x1a3482[_0x833f('0x4d')]=qs['sort'](_0x5b9df8[_0x833f('0x49')]['sort']);_0x1a3482[_0x833f('0x51')]=qs[_0x833f('0x47')](_[_0x833f('0x4f')](_0x5b9df8['query'],_0xa513b9[_0x833f('0x47')]));_0x1a3482[_0x833f('0x51')]['ChatQueueId']=_0x30f939['id'];if(_0x5b9df8['query']['filter']){_0x1a3482[_0x833f('0x51')]=_[_0x833f('0x52')](_0x1a3482[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x1a3482[_0x833f('0x4a')],function(_0x7e1551){var _0x3f9e9e={};_0x3f9e9e[_0x7e1551]={'$like':'%'+_0x5b9df8[_0x833f('0x49')][_0x833f('0x50')]+'%'};return _0x3f9e9e;})});}_0x1a3482=_[_0x833f('0x52')]({},_0x1a3482,_0x5b9df8[_0x833f('0x67')]);return db[_0x833f('0x65')][_0x833f('0x68')](_0x1a3482);}})['then'](function(_0x9df97a){if(_0x9df97a){return db[_0x833f('0x69')][_0x833f('0x6a')]({'where':{'id':_[_0x833f('0x41')](_0x9df97a,_0x833f('0x6b')),'role':_0x833f('0x6c')},'attributes':['id',_0x833f('0x3e'),_0x833f('0x6d'),'updatedAt',_0x833f('0x6e')]});}})[_0x833f('0x22')](function(_0x5b55b0){if(_0x5b55b0){return{'count':_0x5b55b0['count'],'rows':_[_0x833f('0x41')](_0x5b55b0[_0x833f('0x56')],function(_0x312294){return{'membername':_0x312294[_0x833f('0x3e')],'UserId':_0x312294['id'],'queue_name':_0x2da040[_0x833f('0x3e')],'ChatQueueId':_0x2da040['id'],'interface':util['format'](_0x833f('0x6f'),_0x833f('0x70'),_0x312294[_0x833f('0x3e')]),'penalty':0x0,'paused':_0x312294[_0x833f('0x6d')],'createdAt':_0x312294[_0x833f('0x6e')],'updatedAt':_0x312294[_0x833f('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x833f('0x22')](respondWithFilteredResult(_0x575177,_0x1a3482))[_0x833f('0x2b')](handleError(_0x575177,null));};exports['getTeams']=function(_0x2ba614,_0x3b915b,_0x4fa39f){var _0x55facb={};var _0x39a375={};var _0x2f3f9b;var _0xdc9983;return db['ChatQueue']['findOne']({'where':{'id':_0x2ba614[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b915b,null))[_0x833f('0x22')](function(_0x4c3931){if(_0x4c3931){_0x2f3f9b=_0x4c3931;_0x39a375['model']=_[_0x833f('0x46')](db['Team'][_0x833f('0x59')]);_0x39a375[_0x833f('0x49')]=_[_0x833f('0x46')](_0x2ba614[_0x833f('0x49')]);_0x39a375['filters']=_[_0x833f('0x48')](_0x39a375[_0x833f('0x45')],_0x39a375['query']);_0x55facb[_0x833f('0x4a')]=_[_0x833f('0x48')](_0x39a375['model'],qs[_0x833f('0x5a')](_0x2ba614['query'][_0x833f('0x5a')]));_0x55facb[_0x833f('0x4a')]=_0x55facb[_0x833f('0x4a')][_0x833f('0x4b')]?_0x55facb[_0x833f('0x4a')]:_0x39a375[_0x833f('0x45')];_0x55facb[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x2ba614[_0x833f('0x49')]['sort']);_0x55facb[_0x833f('0x51')]=qs[_0x833f('0x47')](_['pick'](_0x2ba614[_0x833f('0x49')],_0x39a375[_0x833f('0x47')]));if(_0x2ba614[_0x833f('0x49')][_0x833f('0x50')]){_0x55facb['where']=_['merge'](_0x55facb[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x55facb[_0x833f('0x4a')],function(_0x417d6c){var _0x2670d4={};_0x2670d4[_0x417d6c]={'$like':'%'+_0x2ba614['query'][_0x833f('0x50')]+'%'};return _0x2670d4;})});}_0x55facb=_[_0x833f('0x52')]({},_0x55facb,_0x2ba614[_0x833f('0x67')]);return _0x2f3f9b[_0x833f('0x72')](_0x55facb);}})[_0x833f('0x22')](function(_0x2730e1){if(_0x2730e1){_0xdc9983=_0x2730e1[_0x833f('0x4b')];if(!_0x2ba614['query']['hasOwnProperty'](_0x833f('0x66'))){_0x55facb[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x2ba614['query'][_0x833f('0x31')]);_0x55facb[_0x833f('0x30')]=qs[_0x833f('0x30')](_0x2ba614['query'][_0x833f('0x30')]);}return _0x2f3f9b['getTeams'](_0x55facb);}})[_0x833f('0x22')](function(_0x1f1ba4){if(_0x1f1ba4){return _0x1f1ba4?{'count':_0xdc9983,'rows':_0x1f1ba4}:null;}})[_0x833f('0x22')](respondWithResult(_0x3b915b,null))['catch'](handleError(_0x3b915b,null));};exports[_0x833f('0x73')]=function(_0x38fb8d,_0x18cafc,_0x16b3b6){var _0x32fa2a=_0x38fb8d[_0x833f('0x5d')][_0x833f('0x74')];return db[_0x833f('0x75')][_0x833f('0x68')]({'where':{'id':_0x32fa2a},'attributes':['id'],'include':[{'model':db[_0x833f('0x69')],'as':_0x833f('0x76'),'attributes':['id',_0x833f('0x3e'),'online','voicePause','interface'],'raw':!![]}]})[_0x833f('0x22')](function(_0x3bb754){if(_0x3bb754){var _0x4fb225=_[_0x833f('0x77')](_0x3bb754,function(_0x3701a0){var _0x36b025=_0x3701a0[_0x833f('0x3a')]({'plain':!![]});return _0x36b025[_0x833f('0x76')];});return db['ChatQueue'][_0x833f('0x5b')]({'where':{'id':_0x38fb8d[_0x833f('0x58')]['id']}})[_0x833f('0x22')](function(_0x3ce590){return db[_0x833f('0x78')][_0x833f('0x79')](function(_0x4820ec){return _0x3ce590[_0x833f('0x73')](_0x32fa2a,{'transaction':_0x4820ec})['then'](function(){return BPromise[_0x833f('0x7a')](_0x4fb225,function(_0x12a21d){return db[_0x833f('0x65')]['findOrCreate']({'where':{'UserId':_0x12a21d['id'],'ChatQueueId':_0x38fb8d[_0x833f('0x58')]['id']},'transaction':_0x4820ec});});})['then'](function(){_0x4fb225[_0x833f('0x7b')](function(_0x2684bc){socket['emit'](_0x833f('0x7c'),{'UserId':_0x2684bc['id'],'ChatQueueId':_0x3ce590['id']});});});});});}})[_0x833f('0x22')](respondWithStatusCode(_0x18cafc,null))[_0x833f('0x2b')](handleError(_0x18cafc,null));};exports[_0x833f('0x7d')]=function(_0x516804,_0x35baf4,_0x5ee896){return db[_0x833f('0x75')][_0x833f('0x68')]({'where':{'id':_0x516804[_0x833f('0x49')]['ids']},'attributes':['id'],'include':[{'model':db[_0x833f('0x69')],'as':_0x833f('0x76'),'attributes':['id'],'raw':!![]}]})[_0x833f('0x22')](handleEntityNotFound(_0x35baf4,null))[_0x833f('0x22')](function(_0x73a1ef){var _0x1c9019=_[_0x833f('0x41')](_0x73a1ef,'id');var _0xaf45ae=[];var _0x860f8a=[];var _0x5d9124=squel[_0x833f('0x7e')]();_0x5d9124['field']('tq.TeamId')[_0x833f('0x7f')]('team_has_chat_queues','tq')[_0x833f('0x80')](_0x833f('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x833f('0x82'),_0x516804['params']['id']);for(var _0x27bc3e=0x0;_0x27bc3e<_0x73a1ef[_0x833f('0x4b')];_0x27bc3e+=0x1){let _0x271b07=_0x73a1ef[_0x27bc3e];for(var _0x33240d=0x0;_0x33240d<_0x271b07[_0x833f('0x76')]['length'];_0x33240d+=0x1){let _0x6c4f16=_0x271b07[_0x833f('0x76')][_0x33240d];var _0x39051a=_0x5d9124[_0x833f('0x83')]();_0x39051a['where'](_0x833f('0x84'),_0x6c4f16['id']);_0x860f8a['push'](db[_0x833f('0x78')][_0x833f('0x49')](_0x39051a[_0x833f('0x85')](),{'type':db[_0x833f('0x78')][_0x833f('0x86')][_0x833f('0x87')]})[_0x833f('0x22')](function(_0x776e80){if(_0x776e80['length']===0x1){return _0x6c4f16['id'];}else{var _0x1a7358=_[_0x833f('0x88')](_['map'](_0x776e80,'TeamId'),function(_0x568308){return _[_0x833f('0x89')](_0x1c9019,_0x568308);});if(_0x1a7358){return _0x6c4f16['id'];}}}));}}return BPromise[_0x833f('0x8a')](_0x860f8a)['then'](function(_0x69fff9){_0xaf45ae=_(_0xaf45ae)['union'](_0x69fff9)[_0x833f('0x8b')]()[_0x833f('0x8c')]();return db[_0x833f('0x42')][_0x833f('0x5b')]({'where':{'id':_0x516804['params']['id']}})['then'](function(_0x289d97){return db['sequelize'][_0x833f('0x79')](function(_0x5636c9){return _0x289d97[_0x833f('0x7d')](_0x516804['query'][_0x833f('0x74')],{'transaction':_0x5636c9})[_0x833f('0x22')](function(){if(!_[_0x833f('0x8d')](_0xaf45ae)){return _0x289d97[_0x833f('0x8e')](_0xaf45ae,{'transaction':_0x5636c9});}})[_0x833f('0x22')](function(){_0xaf45ae[_0x833f('0x7b')](function(_0x412836){socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':_0x412836,'ChatQueueId':_0x289d97['id']});});});});});});})['then'](respondWithStatusCode(_0x35baf4,null))[_0x833f('0x2b')](handleError(_0x35baf4,null));};exports['addAgents']=function(_0x213226,_0x4ae801,_0x24d02f){return db['ChatQueue'][_0x833f('0x5b')]({'where':{'id':_0x213226[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ae801,null))[_0x833f('0x22')](function(_0x27a069){if(_0x27a069){return _0x27a069['addAgents'](_0x213226['body'][_0x833f('0x74')],_[_0x833f('0x91')](_0x213226[_0x833f('0x5d')],[_0x833f('0x74'),'id'])||{})[_0x833f('0x92')](function(_0x586292){for(var _0x4f863c=0x0;_0x4f863c<_0x213226[_0x833f('0x5d')][_0x833f('0x74')][_0x833f('0x4b')];_0x4f863c+=0x1){socket[_0x833f('0x8f')](_0x833f('0x7c'),{'UserId':Number(_0x213226[_0x833f('0x5d')][_0x833f('0x74')][_0x4f863c]),'ChatQueueId':Number(_0x213226[_0x833f('0x58')]['id'])});}return _0x586292;});}})[_0x833f('0x22')](respondWithResult(_0x4ae801,null))[_0x833f('0x2b')](handleError(_0x4ae801,null));};exports[_0x833f('0x8e')]=function(_0x63d2ef,_0x1e5d35,_0x1aab87){return db['ChatQueue']['find']({'where':{'id':_0x63d2ef[_0x833f('0x58')]['id']}})[_0x833f('0x22')](handleEntityNotFound(_0x1e5d35,null))[_0x833f('0x22')](function(_0x5548ad){if(_0x5548ad){return _0x5548ad[_0x833f('0x8e')](_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')])[_0x833f('0x22')](function(){if(_[_0x833f('0x93')](_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')])){for(var _0x59f60b=0x0;_0x59f60b<_0x63d2ef[_0x833f('0x49')][_0x833f('0x74')]['length'];_0x59f60b+=0x1){socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':Number(_0x63d2ef['query']['ids'][_0x59f60b]),'ChatQueueId':Number(_0x63d2ef['params']['id'])});}}else{socket[_0x833f('0x8f')](_0x833f('0x90'),{'UserId':Number(_0x63d2ef[_0x833f('0x49')]['ids']),'ChatQueueId':Number(_0x63d2ef[_0x833f('0x58')]['id'])});}});}})[_0x833f('0x22')](respondWithStatusCode(_0x1e5d35,null))[_0x833f('0x2b')](handleError(_0x1e5d35,null));};exports[_0x833f('0x94')]=function(_0x39573a,_0x1ec9a0,_0x196608){var _0x527fe1={};var _0x32dd4f={};var _0x2906a4;var _0x4358fa;return db[_0x833f('0x42')][_0x833f('0x95')]({'where':{'id':_0x39573a[_0x833f('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ec9a0,null))[_0x833f('0x22')](function(_0x55f696){if(_0x55f696){_0x2906a4=_0x55f696;_0x32dd4f[_0x833f('0x45')]=_['keys'](db['User'][_0x833f('0x59')]);_0x32dd4f[_0x833f('0x49')]=_[_0x833f('0x46')](_0x39573a[_0x833f('0x49')]);_0x32dd4f[_0x833f('0x47')]=_[_0x833f('0x48')](_0x32dd4f[_0x833f('0x45')],_0x32dd4f[_0x833f('0x49')]);_0x527fe1[_0x833f('0x4a')]=_[_0x833f('0x48')](_0x32dd4f[_0x833f('0x45')],qs[_0x833f('0x5a')](_0x39573a[_0x833f('0x49')][_0x833f('0x5a')]));_0x527fe1[_0x833f('0x4a')]=_0x527fe1[_0x833f('0x4a')][_0x833f('0x4b')]?_0x527fe1[_0x833f('0x4a')]:_0x32dd4f['model'];_0x527fe1[_0x833f('0x4d')]=qs[_0x833f('0x4e')](_0x39573a[_0x833f('0x49')][_0x833f('0x4e')]);_0x527fe1[_0x833f('0x51')]=qs[_0x833f('0x47')](_['pick'](_0x39573a['query'],_0x32dd4f[_0x833f('0x47')]));if(_0x39573a[_0x833f('0x49')][_0x833f('0x50')]){_0x527fe1[_0x833f('0x51')]=_['merge'](_0x527fe1[_0x833f('0x51')],{'$or':_[_0x833f('0x41')](_0x527fe1[_0x833f('0x4a')],function(_0x5d1860){var _0x2285e5={};_0x2285e5[_0x5d1860]={'$like':'%'+_0x39573a['query'][_0x833f('0x50')]+'%'};return _0x2285e5;})});}_0x527fe1=_[_0x833f('0x52')]({},_0x527fe1,_0x39573a['options']);return _0x2906a4[_0x833f('0x94')](_0x527fe1);}})[_0x833f('0x22')](function(_0x3a56ff){if(_0x3a56ff){_0x4358fa=_0x3a56ff[_0x833f('0x4b')];if(!_0x39573a['query'][_0x833f('0x4c')](_0x833f('0x66'))){_0x527fe1[_0x833f('0x31')]=qs[_0x833f('0x31')](_0x39573a[_0x833f('0x49')]['limit']);_0x527fe1[_0x833f('0x30')]=qs[_0x833f('0x30')](_0x39573a[_0x833f('0x49')][_0x833f('0x30')]);}return _0x2906a4['getAgents'](_0x527fe1);}})[_0x833f('0x22')](function(_0x616653){if(_0x616653){return _0x616653?{'count':_0x4358fa,'rows':_0x616653}:null;}})[_0x833f('0x22')](respondWithResult(_0x1ec9a0,null))['catch'](handleError(_0x1ec9a0,null));}; \ No newline at end of file +var _0x55f9=['../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','send','ChatQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','include','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','order','sort','findAndCountAll','map','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','online','interface','transaction','each','emit','findAll','ids','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','forEach','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x773bcd,_0x2b62cb){var _0x2b7aa4=function(_0x18e03a){while(--_0x18e03a){_0x773bcd['push'](_0x773bcd['shift']());}};_0x2b7aa4(++_0x2b62cb);}(_0x55f9,0x1ac));var _0x955f=function(_0x34a8ff,_0x292285){_0x34a8ff=_0x34a8ff-0x0;var _0x2f261b=_0x55f9[_0x34a8ff];return _0x2f261b;};'use strict';var emlformat=require(_0x955f('0x0'));var rimraf=require(_0x955f('0x1'));var zipdir=require(_0x955f('0x2'));var jsonpatch=require(_0x955f('0x3'));var rp=require(_0x955f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x955f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x955f('0x6'));var csv=require(_0x955f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x955f('0x8'));var _=require('lodash');var squel=require(_0x955f('0x9'));var crypto=require(_0x955f('0xa'));var jsforce=require(_0x955f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x955f('0xc'));var Papa=require(_0x955f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x955f('0xe'));var as=require(_0x955f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x955f('0x10'))(_0x955f('0x11'));var utils=require('../../config/utils');var config=require(_0x955f('0x12'));var licenseUtil=require(_0x955f('0x13'));var db=require(_0x955f('0x14'))['db'];config[_0x955f('0x15')]=_[_0x955f('0x16')](config[_0x955f('0x15')],{'host':_0x955f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x955f('0x15')]));require(_0x955f('0x18'))[_0x955f('0x19')](socket);var jayson=require(_0x955f('0x1a'));var client=jayson[_0x955f('0x1b')][_0x955f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2cbffa,_0x4ed350,_0x5394e8,_0x10fa22){return new BPromise(function(_0x2bc214,_0xe77d9d){var _0x7a1d5c=_0x10fa22||client;return _0x7a1d5c[_0x955f('0x1d')](_0x2cbffa,_0x5394e8)[_0x955f('0x1e')](function(_0x671d27){logger[_0x955f('0x1f')](_0x955f('0x20'),_0x4ed350,'request\x20sent');logger['debug'](_0x955f('0x21'),_0x4ed350,_0x955f('0x22'),JSON[_0x955f('0x23')](_0x671d27));if(_0x671d27[_0x955f('0x24')]){if(_0x671d27[_0x955f('0x24')][_0x955f('0x25')]===0x1f4){logger[_0x955f('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4ed350,_0x671d27[_0x955f('0x24')][_0x955f('0x26')]);return _0xe77d9d(_0x671d27[_0x955f('0x24')]['message']);}logger[_0x955f('0x24')](_0x955f('0x20'),_0x4ed350,_0x671d27[_0x955f('0x24')][_0x955f('0x26')]);return _0x2bc214(_0x671d27[_0x955f('0x24')]['message']);}else{logger[_0x955f('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x4ed350,_0x955f('0x22'));_0x2bc214(_0x671d27['result'][_0x955f('0x26')]);}})[_0x955f('0x27')](function(_0x508c09){logger[_0x955f('0x24')](_0x955f('0x20'),_0x4ed350,_0x508c09);_0xe77d9d(_0x508c09);});});}function respondWithStatusCode(_0x149da7,_0xe1405a){_0xe1405a=_0xe1405a||0xcc;return function(_0x3d4d5b){if(_0x3d4d5b){return _0x149da7[_0x955f('0x28')](_0xe1405a);}return _0x149da7[_0x955f('0x29')](_0xe1405a)[_0x955f('0x2a')]();};}function respondWithResult(_0x1d95f2,_0x38b6d9){_0x38b6d9=_0x38b6d9||0xc8;return function(_0x556b7c){if(_0x556b7c){return _0x1d95f2[_0x955f('0x29')](_0x38b6d9)[_0x955f('0x2b')](_0x556b7c);}};}function respondWithFilteredResult(_0x39bf29,_0xa077f){return function(_0x53bb6a){if(_0x53bb6a){var _0x23f819=typeof _0xa077f[_0x955f('0x2c')]==='undefined'&&typeof _0xa077f['limit']==='undefined';var _0x45b2f5=_0x53bb6a[_0x955f('0x2d')];var _0x195b51=_0x23f819?0x0:_0xa077f['offset'];var _0x2f90c7=_0x23f819?_0x53bb6a[_0x955f('0x2d')]:_0xa077f[_0x955f('0x2c')]+_0xa077f[_0x955f('0x2e')];var _0x4775f7;if(_0x2f90c7>=_0x45b2f5){_0x2f90c7=_0x45b2f5;_0x4775f7=0xc8;}else{_0x4775f7=0xce;}_0x39bf29[_0x955f('0x29')](_0x4775f7);return _0x39bf29[_0x955f('0x2f')](_0x955f('0x30'),_0x195b51+'-'+_0x2f90c7+'/'+_0x45b2f5)['json'](_0x53bb6a);}return null;};}function patchUpdates(_0x2272ce){return function(_0x42f74e){try{jsonpatch[_0x955f('0x31')](_0x42f74e,_0x2272ce,!![]);}catch(_0x158471){return BPromise[_0x955f('0x32')](_0x158471);}return _0x42f74e[_0x955f('0x33')]();};}function saveUpdates(_0x15a775,_0x47e7f5){return function(_0x8fa94f){if(_0x8fa94f){return _0x8fa94f[_0x955f('0x34')](_0x15a775)['then'](function(_0x448f5a){return _0x448f5a;});}return null;};}function removeEntity(_0x2804d9,_0x3671c4){return function(_0x5149f6){if(_0x5149f6){return _0x5149f6[_0x955f('0x35')]()['then'](function(){var _0x32fab3=_0x5149f6[_0x955f('0x36')]({'plain':!![]});var _0x2e9a09=_0x955f('0x37');return db[_0x955f('0x38')]['destroy']({'where':{'type':_0x2e9a09,'resourceId':_0x32fab3['id']}})['then'](function(){return _0x5149f6;});})[_0x955f('0x1e')](function(){_0x2804d9[_0x955f('0x29')](0xcc)[_0x955f('0x2a')]();});}};}function handleEntityNotFound(_0x2178e9,_0x1be590){return function(_0x5c253f){if(!_0x5c253f){_0x2178e9[_0x955f('0x28')](0x194);}return _0x5c253f;};}function handleError(_0x45bfa3,_0x57a177){_0x57a177=_0x57a177||0x1f4;return function(_0x3a5733){logger[_0x955f('0x24')](_0x3a5733['stack']);if(_0x3a5733['name']){delete _0x3a5733[_0x955f('0x39')];}_0x45bfa3['status'](_0x57a177)[_0x955f('0x3a')](_0x3a5733);};}exports['index']=function(_0x572709,_0x173245){var _0x36f583={},_0x500071={},_0x1ec402={'count':0x0,'rows':[]};var _0x3b36a3=_['map'](db[_0x955f('0x3b')][_0x955f('0x3c')],function(_0x212101){return{'name':_0x212101['fieldName'],'type':_0x212101[_0x955f('0x3d')][_0x955f('0x3e')]};});_0x500071[_0x955f('0x3f')]=_['map'](_0x3b36a3,_0x955f('0x39'));_0x500071['query']=_[_0x955f('0x40')](_0x572709[_0x955f('0x41')]);_0x500071[_0x955f('0x42')]=_[_0x955f('0x43')](_0x500071[_0x955f('0x3f')],_0x500071[_0x955f('0x41')]);_0x36f583[_0x955f('0x44')]=_[_0x955f('0x43')](_0x500071[_0x955f('0x3f')],qs[_0x955f('0x45')](_0x572709[_0x955f('0x41')][_0x955f('0x45')]));_0x36f583[_0x955f('0x44')]=_0x36f583[_0x955f('0x44')][_0x955f('0x46')]?_0x36f583['attributes']:_0x500071[_0x955f('0x3f')];if(!_0x572709[_0x955f('0x41')][_0x955f('0x47')](_0x955f('0x48'))){_0x36f583[_0x955f('0x2e')]=qs['limit'](_0x572709[_0x955f('0x41')][_0x955f('0x2e')]);_0x36f583['offset']=qs[_0x955f('0x2c')](_0x572709[_0x955f('0x41')]['offset']);}_0x36f583['order']=qs['sort'](_0x572709[_0x955f('0x41')]['sort']);_0x36f583[_0x955f('0x49')]=qs[_0x955f('0x42')](_[_0x955f('0x4a')](_0x572709[_0x955f('0x41')],_0x500071['filters']),_0x3b36a3);if(_0x572709['query'][_0x955f('0x4b')]){_0x36f583[_0x955f('0x49')]=_['merge'](_0x36f583[_0x955f('0x49')],{'$or':_['map'](_0x3b36a3,function(_0x370a05){if(_0x370a05[_0x955f('0x3d')]!==_0x955f('0x4c')){var _0x1f84e9={};_0x1f84e9[_0x370a05[_0x955f('0x39')]]={'$like':'%'+_0x572709['query'][_0x955f('0x4b')]+'%'};return _0x1f84e9;}})});}_0x36f583=_[_0x955f('0x4d')]({},_0x36f583,_0x572709[_0x955f('0x4e')]);var _0x1020a3={'where':_0x36f583[_0x955f('0x49')]};return db['ChatQueue'][_0x955f('0x2d')](_0x1020a3)['then'](function(_0x2fb0f0){_0x1ec402['count']=_0x2fb0f0;if(_0x572709['query']['includeAll']){_0x36f583[_0x955f('0x4f')]=[{'all':!![]}];}return db[_0x955f('0x3b')]['findAll'](_0x36f583);})[_0x955f('0x1e')](function(_0x2d31cd){_0x1ec402[_0x955f('0x50')]=_0x2d31cd;return _0x1ec402;})['then'](respondWithFilteredResult(_0x173245,_0x36f583))[_0x955f('0x27')](handleError(_0x173245,null));};exports[_0x955f('0x51')]=function(_0x4636fc,_0x2b5b84){var _0x4df974={'raw':!![],'where':{'id':_0x4636fc['params']['id']}},_0x35bdef={};_0x35bdef['model']=_['keys'](db[_0x955f('0x3b')]['rawAttributes']);_0x35bdef[_0x955f('0x41')]=_[_0x955f('0x40')](_0x4636fc[_0x955f('0x41')]);_0x35bdef[_0x955f('0x42')]=_[_0x955f('0x43')](_0x35bdef['model'],_0x35bdef[_0x955f('0x41')]);_0x4df974['attributes']=_[_0x955f('0x43')](_0x35bdef[_0x955f('0x3f')],qs['fields'](_0x4636fc[_0x955f('0x41')][_0x955f('0x45')]));_0x4df974['attributes']=_0x4df974[_0x955f('0x44')][_0x955f('0x46')]?_0x4df974[_0x955f('0x44')]:_0x35bdef[_0x955f('0x3f')];if(_0x4636fc[_0x955f('0x41')][_0x955f('0x52')]){_0x4df974[_0x955f('0x4f')]=[{'all':!![]}];}_0x4df974=_['merge']({},_0x4df974,_0x4636fc['options']);return db[_0x955f('0x3b')][_0x955f('0x53')](_0x4df974)[_0x955f('0x1e')](handleEntityNotFound(_0x2b5b84,null))['then'](respondWithResult(_0x2b5b84,null))[_0x955f('0x27')](handleError(_0x2b5b84,null));};exports[_0x955f('0x54')]=function(_0xf75cde,_0x6f83cd){return db[_0x955f('0x3b')]['create'](_0xf75cde[_0x955f('0x55')],{})['then'](function(_0x1768bc){var _0xbf00c6=_0xf75cde[_0x955f('0x56')][_0x955f('0x36')]({'plain':!![]});if(!_0xbf00c6)throw new Error(_0x955f('0x57'));if(_0xbf00c6[_0x955f('0x58')]===_0x955f('0x56')){var _0x30921d=_0x1768bc[_0x955f('0x36')]({'plain':!![]});var _0x5b1ab1=_0x955f('0x37');return db['UserProfileSection'][_0x955f('0x53')]({'where':{'name':_0x5b1ab1,'userProfileId':_0xbf00c6[_0x955f('0x59')]},'raw':!![]})[_0x955f('0x1e')](function(_0x3a3236){if(_0x3a3236&&_0x3a3236[_0x955f('0x5a')]===0x0){return db[_0x955f('0x38')]['create']({'name':_0x30921d[_0x955f('0x39')],'resourceId':_0x30921d['id'],'type':_0x3a3236['name'],'sectionId':_0x3a3236['id']},{})['then'](function(){return _0x1768bc;});}else{return _0x1768bc;}})['catch'](function(_0x6a206){logger['error'](_0x955f('0x5b'),_0x6a206);throw _0x6a206;});}return _0x1768bc;})[_0x955f('0x1e')](respondWithResult(_0x6f83cd,0xc9))[_0x955f('0x27')](handleError(_0x6f83cd,null));};exports['update']=function(_0x259968,_0xef18b0){if(_0x259968[_0x955f('0x55')]['id']){delete _0x259968['body']['id'];}return db[_0x955f('0x3b')][_0x955f('0x53')]({'where':{'id':_0x259968['params']['id']}})[_0x955f('0x1e')](handleEntityNotFound(_0xef18b0,null))[_0x955f('0x1e')](saveUpdates(_0x259968[_0x955f('0x55')],null))[_0x955f('0x1e')](respondWithResult(_0xef18b0,null))[_0x955f('0x27')](handleError(_0xef18b0,null));};exports['destroy']=function(_0x478f95,_0x40a872){return db[_0x955f('0x3b')][_0x955f('0x53')]({'where':{'id':_0x478f95[_0x955f('0x5c')]['id']}})[_0x955f('0x1e')](handleEntityNotFound(_0x40a872,null))[_0x955f('0x1e')](removeEntity(_0x40a872,null))[_0x955f('0x27')](handleError(_0x40a872,null));};exports[_0x955f('0x5d')]=function(_0x42aefb,_0x4af126){return db[_0x955f('0x3b')][_0x955f('0x5d')]()[_0x955f('0x1e')](respondWithResult(_0x4af126,null))['catch'](handleError(_0x4af126,null));};exports[_0x955f('0x5e')]=function(_0x338861,_0x4a4011,_0x4bf39e){var _0x4af425={'raw':!![],'where':{}},_0x40cb0d={},_0x7fe68b;return db[_0x955f('0x3b')][_0x955f('0x5f')]({'where':{'id':_0x338861['params']['id']}})['then'](handleEntityNotFound(_0x4a4011,null))['then'](function(_0x2ca2f0){if(_0x2ca2f0){_0x7fe68b=_0x2ca2f0[_0x955f('0x36')]({'plain':!![]});_0x40cb0d[_0x955f('0x3f')]=_[_0x955f('0x40')](db[_0x955f('0x60')][_0x955f('0x3c')]);_0x40cb0d[_0x955f('0x41')]=_['keys'](_0x338861[_0x955f('0x41')]);_0x40cb0d[_0x955f('0x42')]=_[_0x955f('0x43')](_0x40cb0d['model'],_0x40cb0d[_0x955f('0x41')]);_0x4af425[_0x955f('0x44')]=_[_0x955f('0x43')](_0x40cb0d[_0x955f('0x3f')],qs[_0x955f('0x45')](_0x338861[_0x955f('0x41')][_0x955f('0x45')]));_0x4af425[_0x955f('0x44')]=_0x4af425[_0x955f('0x44')][_0x955f('0x46')]?_0x4af425[_0x955f('0x44')]:_0x40cb0d[_0x955f('0x3f')];if(!_0x338861[_0x955f('0x41')][_0x955f('0x47')](_0x955f('0x48'))){_0x4af425['limit']=qs[_0x955f('0x2e')](_0x338861['query'][_0x955f('0x2e')]);_0x4af425[_0x955f('0x2c')]=qs[_0x955f('0x2c')](_0x338861[_0x955f('0x41')][_0x955f('0x2c')]);}_0x4af425[_0x955f('0x61')]=qs[_0x955f('0x62')](_0x338861[_0x955f('0x41')][_0x955f('0x62')]);_0x4af425[_0x955f('0x49')]=qs[_0x955f('0x42')](_['pick'](_0x338861['query'],_0x40cb0d[_0x955f('0x42')]));_0x4af425[_0x955f('0x49')]['ChatQueueId']=_0x2ca2f0['id'];if(_0x338861[_0x955f('0x41')][_0x955f('0x4b')]){_0x4af425[_0x955f('0x49')]=_[_0x955f('0x4d')](_0x4af425['where'],{'$or':_['map'](_0x4af425[_0x955f('0x44')],function(_0x54cc83){var _0x414325={};_0x414325[_0x54cc83]={'$like':'%'+_0x338861[_0x955f('0x41')][_0x955f('0x4b')]+'%'};return _0x414325;})});}_0x4af425=_['merge']({},_0x4af425,_0x338861[_0x955f('0x4e')]);return db['UserChatQueue']['findAll'](_0x4af425);}})['then'](function(_0x5b1c13){if(_0x5b1c13){return db['User'][_0x955f('0x63')]({'where':{'id':_[_0x955f('0x64')](_0x5b1c13,_0x955f('0x65')),'role':_0x955f('0x66')},'attributes':['id',_0x955f('0x39'),_0x955f('0x67'),_0x955f('0x68'),_0x955f('0x69')]});}})[_0x955f('0x1e')](function(_0x36a08a){if(_0x36a08a){return{'count':_0x36a08a['count'],'rows':_['map'](_0x36a08a['rows'],function(_0x2b5b47){return{'membername':_0x2b5b47[_0x955f('0x39')],'UserId':_0x2b5b47['id'],'queue_name':_0x7fe68b[_0x955f('0x39')],'ChatQueueId':_0x7fe68b['id'],'interface':util[_0x955f('0x6a')](_0x955f('0x6b'),_0x955f('0x6c'),_0x2b5b47[_0x955f('0x39')]),'penalty':0x0,'paused':_0x2b5b47['chatPause'],'createdAt':_0x2b5b47[_0x955f('0x69')],'updatedAt':_0x2b5b47[_0x955f('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x955f('0x1e')](respondWithFilteredResult(_0x4a4011,_0x4af425))['catch'](handleError(_0x4a4011,null));};exports['getTeams']=function(_0x4f5e2f,_0x4a5616,_0x3f5bf3){var _0x5cb86e={};var _0x4ce82a={};var _0x5aff62;var _0x5eaa42;return db[_0x955f('0x3b')][_0x955f('0x5f')]({'where':{'id':_0x4f5e2f[_0x955f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a5616,null))[_0x955f('0x1e')](function(_0x483d11){if(_0x483d11){_0x5aff62=_0x483d11;_0x4ce82a[_0x955f('0x3f')]=_['keys'](db[_0x955f('0x6d')][_0x955f('0x3c')]);_0x4ce82a[_0x955f('0x41')]=_['keys'](_0x4f5e2f[_0x955f('0x41')]);_0x4ce82a[_0x955f('0x42')]=_[_0x955f('0x43')](_0x4ce82a[_0x955f('0x3f')],_0x4ce82a[_0x955f('0x41')]);_0x5cb86e[_0x955f('0x44')]=_[_0x955f('0x43')](_0x4ce82a[_0x955f('0x3f')],qs['fields'](_0x4f5e2f[_0x955f('0x41')][_0x955f('0x45')]));_0x5cb86e[_0x955f('0x44')]=_0x5cb86e['attributes'][_0x955f('0x46')]?_0x5cb86e['attributes']:_0x4ce82a[_0x955f('0x3f')];_0x5cb86e[_0x955f('0x61')]=qs[_0x955f('0x62')](_0x4f5e2f[_0x955f('0x41')]['sort']);_0x5cb86e['where']=qs[_0x955f('0x42')](_['pick'](_0x4f5e2f[_0x955f('0x41')],_0x4ce82a[_0x955f('0x42')]));if(_0x4f5e2f[_0x955f('0x41')]['filter']){_0x5cb86e[_0x955f('0x49')]=_[_0x955f('0x4d')](_0x5cb86e[_0x955f('0x49')],{'$or':_[_0x955f('0x64')](_0x5cb86e[_0x955f('0x44')],function(_0x5d1fcb){var _0x18c256={};_0x18c256[_0x5d1fcb]={'$like':'%'+_0x4f5e2f[_0x955f('0x41')][_0x955f('0x4b')]+'%'};return _0x18c256;})});}_0x5cb86e=_['merge']({},_0x5cb86e,_0x4f5e2f[_0x955f('0x4e')]);return _0x5aff62[_0x955f('0x6e')](_0x5cb86e);}})['then'](function(_0x2fc133){if(_0x2fc133){_0x5eaa42=_0x2fc133['length'];if(!_0x4f5e2f['query'][_0x955f('0x47')](_0x955f('0x48'))){_0x5cb86e[_0x955f('0x2e')]=qs[_0x955f('0x2e')](_0x4f5e2f[_0x955f('0x41')][_0x955f('0x2e')]);_0x5cb86e[_0x955f('0x2c')]=qs[_0x955f('0x2c')](_0x4f5e2f[_0x955f('0x41')]['offset']);}return _0x5aff62['getTeams'](_0x5cb86e);}})['then'](function(_0x3f158b){if(_0x3f158b){return _0x3f158b?{'count':_0x5eaa42,'rows':_0x3f158b}:null;}})['then'](respondWithResult(_0x4a5616,null))[_0x955f('0x27')](handleError(_0x4a5616,null));};exports[_0x955f('0x6f')]=function(_0x5ebe0a,_0x3e34ea,_0x587448){var _0x58696d=_0x5ebe0a[_0x955f('0x55')]['ids'];return db[_0x955f('0x6d')]['findAll']({'where':{'id':_0x58696d},'attributes':['id'],'include':[{'model':db[_0x955f('0x70')],'as':_0x955f('0x71'),'attributes':['id',_0x955f('0x39'),_0x955f('0x72'),'voicePause',_0x955f('0x73')],'raw':!![]}]})[_0x955f('0x1e')](function(_0x2ba31b){if(_0x2ba31b){var _0x19d694=_['flatMap'](_0x2ba31b,function(_0x1ffd95){var _0x19e6d7=_0x1ffd95[_0x955f('0x36')]({'plain':!![]});return _0x19e6d7[_0x955f('0x71')];});return db[_0x955f('0x3b')][_0x955f('0x53')]({'where':{'id':_0x5ebe0a[_0x955f('0x5c')]['id']}})['then'](function(_0x3e712d){return db['sequelize'][_0x955f('0x74')](function(_0xacdb66){return _0x3e712d[_0x955f('0x6f')](_0x58696d,{'transaction':_0xacdb66})[_0x955f('0x1e')](function(){return BPromise[_0x955f('0x75')](_0x19d694,function(_0x3690b8){return db[_0x955f('0x60')]['findOrCreate']({'where':{'UserId':_0x3690b8['id'],'ChatQueueId':_0x5ebe0a['params']['id']},'transaction':_0xacdb66});});})[_0x955f('0x1e')](function(){_0x19d694['forEach'](function(_0x578151){socket[_0x955f('0x76')]('userChatQueue:save',{'UserId':_0x578151['id'],'ChatQueueId':_0x3e712d['id']});});});});});}})[_0x955f('0x1e')](respondWithStatusCode(_0x3e34ea,null))[_0x955f('0x27')](handleError(_0x3e34ea,null));};exports['removeTeams']=function(_0x12aaa1,_0x2ddbd7,_0x2e8d7c){return db['Team'][_0x955f('0x77')]({'where':{'id':_0x12aaa1[_0x955f('0x41')][_0x955f('0x78')]},'attributes':['id'],'include':[{'model':db[_0x955f('0x70')],'as':_0x955f('0x71'),'attributes':['id'],'raw':!![]}]})[_0x955f('0x1e')](handleEntityNotFound(_0x2ddbd7,null))['then'](function(_0x540a4d){var _0x513600=_[_0x955f('0x64')](_0x540a4d,'id');var _0x18c92e=[];var _0x2d2e36=[];var _0x18861d=squel['select']();_0x18861d[_0x955f('0x79')](_0x955f('0x7a'))['from'](_0x955f('0x7b'),'tq')[_0x955f('0x7c')](_0x955f('0x7d'),'ut',_0x955f('0x7e'))['where'](_0x955f('0x7f'),_0x12aaa1['params']['id']);for(var _0x5257d2=0x0;_0x5257d2<_0x540a4d[_0x955f('0x46')];_0x5257d2+=0x1){let _0x2ed63c=_0x540a4d[_0x5257d2];for(var _0x1c8b68=0x0;_0x1c8b68<_0x2ed63c[_0x955f('0x71')][_0x955f('0x46')];_0x1c8b68+=0x1){let _0x3bb59c=_0x2ed63c[_0x955f('0x71')][_0x1c8b68];var _0x522554=_0x18861d[_0x955f('0x80')]();_0x522554[_0x955f('0x49')](_0x955f('0x81'),_0x3bb59c['id']);_0x2d2e36[_0x955f('0x82')](db[_0x955f('0x83')][_0x955f('0x41')](_0x522554[_0x955f('0x84')](),{'type':db[_0x955f('0x83')][_0x955f('0x85')][_0x955f('0x86')]})[_0x955f('0x1e')](function(_0x16c651){if(_0x16c651[_0x955f('0x46')]===0x1){return _0x3bb59c['id'];}else{var _0x28df5c=_[_0x955f('0x87')](_[_0x955f('0x64')](_0x16c651,_0x955f('0x88')),function(_0x1106a3){return _[_0x955f('0x89')](_0x513600,_0x1106a3);});if(_0x28df5c){return _0x3bb59c['id'];}}}));}}return BPromise[_0x955f('0x8a')](_0x2d2e36)['then'](function(_0x87a31c){_0x18c92e=_(_0x18c92e)['union'](_0x87a31c)[_0x955f('0x8b')]()[_0x955f('0x8c')]();return db[_0x955f('0x3b')][_0x955f('0x53')]({'where':{'id':_0x12aaa1[_0x955f('0x5c')]['id']}})[_0x955f('0x1e')](function(_0x4d395d){return db[_0x955f('0x83')][_0x955f('0x74')](function(_0x43745f){return _0x4d395d[_0x955f('0x8d')](_0x12aaa1[_0x955f('0x41')][_0x955f('0x78')],{'transaction':_0x43745f})['then'](function(){if(!_['isEmpty'](_0x18c92e)){return _0x4d395d[_0x955f('0x8e')](_0x18c92e,{'transaction':_0x43745f});}})[_0x955f('0x1e')](function(){_0x18c92e[_0x955f('0x8f')](function(_0x5dac32){socket[_0x955f('0x76')](_0x955f('0x90'),{'UserId':_0x5dac32,'ChatQueueId':_0x4d395d['id']});});});});});});})[_0x955f('0x1e')](respondWithStatusCode(_0x2ddbd7,null))['catch'](handleError(_0x2ddbd7,null));};exports[_0x955f('0x91')]=function(_0x492dd5,_0x28ccee,_0x100a21){return db['ChatQueue']['find']({'where':{'id':_0x492dd5[_0x955f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x28ccee,null))[_0x955f('0x1e')](function(_0x330c08){if(_0x330c08){return _0x330c08[_0x955f('0x91')](_0x492dd5['body'][_0x955f('0x78')],_[_0x955f('0x92')](_0x492dd5[_0x955f('0x55')],[_0x955f('0x78'),'id'])||{})['spread'](function(_0x920f2c){for(var _0x1599d4=0x0;_0x1599d4<_0x492dd5[_0x955f('0x55')][_0x955f('0x78')]['length'];_0x1599d4+=0x1){socket[_0x955f('0x76')]('userChatQueue:save',{'UserId':Number(_0x492dd5['body'][_0x955f('0x78')][_0x1599d4]),'ChatQueueId':Number(_0x492dd5['params']['id'])});}return _0x920f2c;});}})['then'](respondWithResult(_0x28ccee,null))[_0x955f('0x27')](handleError(_0x28ccee,null));};exports['removeAgents']=function(_0x52dddb,_0xa5f901,_0x3bf21d){return db['ChatQueue'][_0x955f('0x53')]({'where':{'id':_0x52dddb[_0x955f('0x5c')]['id']}})[_0x955f('0x1e')](handleEntityNotFound(_0xa5f901,null))[_0x955f('0x1e')](function(_0x102779){if(_0x102779){return _0x102779[_0x955f('0x8e')](_0x52dddb[_0x955f('0x41')]['ids'])[_0x955f('0x1e')](function(){if(_[_0x955f('0x93')](_0x52dddb['query'][_0x955f('0x78')])){for(var _0x1c1e80=0x0;_0x1c1e80<_0x52dddb[_0x955f('0x41')]['ids'][_0x955f('0x46')];_0x1c1e80+=0x1){socket[_0x955f('0x76')](_0x955f('0x90'),{'UserId':Number(_0x52dddb['query'][_0x955f('0x78')][_0x1c1e80]),'ChatQueueId':Number(_0x52dddb[_0x955f('0x5c')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x52dddb[_0x955f('0x41')][_0x955f('0x78')]),'ChatQueueId':Number(_0x52dddb['params']['id'])});}});}})[_0x955f('0x1e')](respondWithStatusCode(_0xa5f901,null))['catch'](handleError(_0xa5f901,null));};exports[_0x955f('0x94')]=function(_0x1ebdd2,_0x6ec805,_0xb4cfa7){var _0x3f1e86={};var _0x158d82={};var _0x13c73b;var _0x1ca99e;return db['ChatQueue'][_0x955f('0x5f')]({'where':{'id':_0x1ebdd2[_0x955f('0x5c')]['id']}})[_0x955f('0x1e')](handleEntityNotFound(_0x6ec805,null))['then'](function(_0x208e1a){if(_0x208e1a){_0x13c73b=_0x208e1a;_0x158d82[_0x955f('0x3f')]=_['keys'](db[_0x955f('0x70')]['rawAttributes']);_0x158d82[_0x955f('0x41')]=_[_0x955f('0x40')](_0x1ebdd2['query']);_0x158d82[_0x955f('0x42')]=_[_0x955f('0x43')](_0x158d82[_0x955f('0x3f')],_0x158d82[_0x955f('0x41')]);_0x3f1e86['attributes']=_['intersection'](_0x158d82['model'],qs['fields'](_0x1ebdd2[_0x955f('0x41')][_0x955f('0x45')]));_0x3f1e86[_0x955f('0x44')]=_0x3f1e86[_0x955f('0x44')][_0x955f('0x46')]?_0x3f1e86[_0x955f('0x44')]:_0x158d82[_0x955f('0x3f')];_0x3f1e86[_0x955f('0x61')]=qs[_0x955f('0x62')](_0x1ebdd2[_0x955f('0x41')]['sort']);_0x3f1e86[_0x955f('0x49')]=qs[_0x955f('0x42')](_[_0x955f('0x4a')](_0x1ebdd2[_0x955f('0x41')],_0x158d82[_0x955f('0x42')]));if(_0x1ebdd2[_0x955f('0x41')][_0x955f('0x4b')]){_0x3f1e86['where']=_['merge'](_0x3f1e86[_0x955f('0x49')],{'$or':_['map'](_0x3f1e86['attributes'],function(_0x70da88){var _0x411d20={};_0x411d20[_0x70da88]={'$like':'%'+_0x1ebdd2[_0x955f('0x41')]['filter']+'%'};return _0x411d20;})});}_0x3f1e86=_[_0x955f('0x4d')]({},_0x3f1e86,_0x1ebdd2[_0x955f('0x4e')]);return _0x13c73b[_0x955f('0x94')](_0x3f1e86);}})['then'](function(_0x41b883){if(_0x41b883){_0x1ca99e=_0x41b883[_0x955f('0x46')];if(!_0x1ebdd2[_0x955f('0x41')][_0x955f('0x47')]('nolimit')){_0x3f1e86[_0x955f('0x2e')]=qs[_0x955f('0x2e')](_0x1ebdd2[_0x955f('0x41')][_0x955f('0x2e')]);_0x3f1e86[_0x955f('0x2c')]=qs['offset'](_0x1ebdd2['query'][_0x955f('0x2c')]);}return _0x13c73b['getAgents'](_0x3f1e86);}})[_0x955f('0x1e')](function(_0x47de3e){if(_0x47de3e){return _0x47de3e?{'count':_0x1ca99e,'rows':_0x47de3e}:null;}})[_0x955f('0x1e')](respondWithResult(_0x6ec805,null))[_0x955f('0x27')](handleError(_0x6ec805,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8033992..244d197 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 _0x74a3=['hasOwnProperty','exports','events','../../mysqldb','ChatQueue','save','update','remove','emit'];(function(_0x2ce44f,_0x446221){var _0x1c1495=function(_0x53857b){while(--_0x53857b){_0x2ce44f['push'](_0x2ce44f['shift']());}};_0x1c1495(++_0x446221);}(_0x74a3,0x1b2));var _0x374a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x74a3[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x374a('0x0'));var ChatQueue=require(_0x374a('0x1'))['db'][_0x374a('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x374a('0x3'),'afterUpdate':_0x374a('0x4'),'afterDestroy':_0x374a('0x5')};function emitEvent(_0x33a53f){return function(_0x48d0c6,_0x5138f7,_0x1fd0c5){ChatQueueEvents[_0x374a('0x6')](_0x33a53f+':'+_0x48d0c6['id'],_0x48d0c6);ChatQueueEvents[_0x374a('0x6')](_0x33a53f,_0x48d0c6);_0x1fd0c5(null);};}for(var e in events){if(events[_0x374a('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x374a('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xcefb=['ChatQueue','save','remove','emit','hook','events','../../mysqldb'];(function(_0x348c92,_0x3605af){var _0x1a8ef8=function(_0x3b16dd){while(--_0x3b16dd){_0x348c92['push'](_0x348c92['shift']());}};_0x1a8ef8(++_0x3605af);}(_0xcefb,0xfa));var _0xbcef=function(_0x418b55,_0x460d11){_0x418b55=_0x418b55-0x0;var _0x4a05c7=_0xcefb[_0x418b55];return _0x4a05c7;};'use strict';var EventEmitter=require(_0xbcef('0x0'));var ChatQueue=require(_0xbcef('0x1'))['db'][_0xbcef('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcef('0x3'),'afterUpdate':'update','afterDestroy':_0xbcef('0x4')};function emitEvent(_0x22f518){return function(_0x34f0bf,_0x452873,_0x2b6032){ChatQueueEvents[_0xbcef('0x5')](_0x22f518+':'+_0x34f0bf['id'],_0x34f0bf);ChatQueueEvents[_0xbcef('0x5')](_0x22f518,_0x34f0bf);_0x2b6032(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xbcef('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f2e083d..8548e08 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 _0xb801=['request-promise','path','exports','chat_queues','lodash','../../config/logger','api','moment'];(function(_0x49f79b,_0x17fdcb){var _0x2d7f34=function(_0x5062d8){while(--_0x5062d8){_0x49f79b['push'](_0x49f79b['shift']());}};_0x2d7f34(++_0x17fdcb);}(_0xb801,0x11c));var _0x1b80=function(_0x1f28a6,_0x11d1a4){_0x1f28a6=_0x1f28a6-0x0;var _0x444b21=_0xb801[_0x1f28a6];return _0x444b21;};'use strict';var _=require(_0x1b80('0x0'));var util=require('util');var logger=require(_0x1b80('0x1'))(_0x1b80('0x2'));var moment=require(_0x1b80('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b80('0x4'));var fs=require('fs');var path=require(_0x1b80('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x1b80('0x6')]=function(_0x47e1be,_0x270505){return _0x47e1be['define']('ChatQueue',attributes,{'tableName':_0x1b80('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3707=['exports','define','ChatQueue','chat_queues','lodash','util','moment','path','../../config/environment','./chatQueue.attributes'];(function(_0x4ed5e0,_0x51cc17){var _0x3d9ff0=function(_0x767297){while(--_0x767297){_0x4ed5e0['push'](_0x4ed5e0['shift']());}};_0x3d9ff0(++_0x51cc17);}(_0x3707,0x144));var _0x7370=function(_0x211baa,_0x579a69){_0x211baa=_0x211baa-0x0;var _0x4a66e4=_0x3707[_0x211baa];return _0x4a66e4;};'use strict';var _=require(_0x7370('0x0'));var util=require(_0x7370('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7370('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7370('0x3'));var rimraf=require('rimraf');var config=require(_0x7370('0x4'));var attributes=require(_0x7370('0x5'));module[_0x7370('0x6')]=function(_0x2f1ff5,_0x14215a){return _0x2f1ff5[_0x7370('0x7')](_0x7370('0x8'),attributes,{'tableName':_0x7370('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 6234d43..2f1de64 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 _0x6f2f=['model','attributes','then','ShowChatQueue','find','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','raw','where','include','map'];(function(_0x1fe978,_0x5e1d74){var _0x13b233=function(_0x2dc5d8){while(--_0x2dc5d8){_0x1fe978['push'](_0x1fe978['shift']());}};_0x13b233(++_0x5e1d74);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x6f2f[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('ChatQueue,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});}exports[_0xf6f2('0x19')]=function(_0x544f71){var _0x145a7e=this;return new Promise(function(_0xe01b4d,_0x312429){return db[_0xf6f2('0x1a')]['findAll']({'raw':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1c')]===undefined?!![]:![]:!![],'where':_0x544f71[_0xf6f2('0x1b')]?_0x544f71['options'][_0xf6f2('0x1d')]||null:null,'attributes':_0x544f71['options']?_0x544f71[_0xf6f2('0x1b')]['attributes']||null:null,'limit':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')]['limit']||null:null,'include':_0x544f71[_0xf6f2('0x1b')]?_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0x544f71[_0xf6f2('0x1b')][_0xf6f2('0x1e')],function(_0x3304ec){return{'model':db[_0x3304ec[_0xf6f2('0x20')]],'as':_0x3304ec['as'],'attributes':_0x3304ec['attributes'],'include':_0x3304ec[_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0x3304ec[_0xf6f2('0x1e')],function(_0xf0f188){return{'model':db[_0xf0f188[_0xf6f2('0x20')]],'as':_0xf0f188['as'],'attributes':_0xf0f188[_0xf6f2('0x21')],'include':_0xf0f188[_0xf6f2('0x1e')]?_[_0xf6f2('0x1f')](_0xf0f188[_0xf6f2('0x1e')],function(_0x40243e){return{'model':db[_0x40243e[_0xf6f2('0x20')]],'as':_0x40243e['as'],'attributes':_0x40243e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6f2('0x22')](function(_0x26c4dc){logger[_0xf6f2('0x16')](_0xf6f2('0x19'),_0x544f71);logger[_0xf6f2('0x10')](_0xf6f2('0x19'),_0x544f71,JSON[_0xf6f2('0x12')](_0x26c4dc));_0xe01b4d(_0x26c4dc);})[_0xf6f2('0x18')](function(_0x6a077c){logger[_0xf6f2('0x13')](_0xf6f2('0x19'),_0x6a077c[_0xf6f2('0x15')],_0x544f71);_0x312429(_0x145a7e['error'](0x1f4,_0x6a077c[_0xf6f2('0x15')]));});});};exports[_0xf6f2('0x23')]=function(_0x2fc531){var _0x1863d9=this;return new Promise(function(_0x3aec2c,_0x3a421f){return db[_0xf6f2('0x1a')][_0xf6f2('0x24')]({'raw':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531[_0xf6f2('0x1b')][_0xf6f2('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531[_0xf6f2('0x1b')]['where']||null:null,'attributes':_0x2fc531['options']?_0x2fc531['options'][_0xf6f2('0x21')]||null:null,'include':_0x2fc531[_0xf6f2('0x1b')]?_0x2fc531['options']['include']?_[_0xf6f2('0x1f')](_0x2fc531[_0xf6f2('0x1b')][_0xf6f2('0x1e')],function(_0x9bf3e0){return{'model':db[_0x9bf3e0[_0xf6f2('0x20')]],'as':_0x9bf3e0['as'],'attributes':_0x9bf3e0[_0xf6f2('0x21')],'include':_0x9bf3e0['include']?_[_0xf6f2('0x1f')](_0x9bf3e0['include'],function(_0x33139f){return{'model':db[_0x33139f[_0xf6f2('0x20')]],'as':_0x33139f['as'],'attributes':_0x33139f[_0xf6f2('0x21')],'include':_0x33139f[_0xf6f2('0x1e')]?_['map'](_0x33139f[_0xf6f2('0x1e')],function(_0x311a37){return{'model':db[_0x311a37[_0xf6f2('0x20')]],'as':_0x311a37['as'],'attributes':_0x311a37['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6f2('0x22')](function(_0x213923){logger[_0xf6f2('0x16')]('ShowChatQueue',_0x2fc531);logger[_0xf6f2('0x10')]('ShowChatQueue',_0x2fc531,JSON[_0xf6f2('0x12')](_0x213923));_0x3aec2c(_0x213923);})[_0xf6f2('0x18')](function(_0x2ed69c){logger['error'](_0xf6f2('0x23'),_0x2ed69c[_0xf6f2('0x15')],_0x2fc531);_0x3a421f(_0x1863d9[_0xf6f2('0x13')](0x1f4,_0x2ed69c[_0xf6f2('0x15')]));});});}; \ No newline at end of file +var _0x843e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','model','attributes','catch','ShowChatQueue','find','raw'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x843e,0xcd));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe843('0x0'));var util=require(_0xe843('0x1'));var moment=require(_0xe843('0x2'));var BPromise=require(_0xe843('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe843('0x4'));var db=require(_0xe843('0x5'))['db'];var utils=require(_0xe843('0x6'));var logger=require(_0xe843('0x7'))(_0xe843('0x8'));var config=require(_0xe843('0x9'));var jayson=require(_0xe843('0xa'));var client=jayson['client'][_0xe843('0xb')]({'port':0x232a});config[_0xe843('0xc')]=_['defaults'](config[_0xe843('0xc')],{'host':_0xe843('0xd'),'port':0x18eb});var socket=require(_0xe843('0xe'))(new Redis(config[_0xe843('0xc')]));require(_0xe843('0xf'))[_0xe843('0x10')](socket);function respondWithRpcPromise(_0x443de9,_0xcd811a,_0x3b9cba){return new BPromise(function(_0xa0f3b0,_0x1c42f7){return client[_0xe843('0x11')](_0x443de9,_0x3b9cba)[_0xe843('0x12')](function(_0x1101cc){logger[_0xe843('0x13')](_0xe843('0x14'),_0xcd811a,_0xe843('0x15'));logger[_0xe843('0x16')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xcd811a,_0xe843('0x15'),JSON[_0xe843('0x17')](_0x1101cc));if(_0x1101cc[_0xe843('0x18')]){if(_0x1101cc[_0xe843('0x18')]['code']===0x1f4){logger[_0xe843('0x18')](_0xe843('0x14'),_0xcd811a,_0x1101cc[_0xe843('0x18')]['message']);return _0x1c42f7(_0x1101cc[_0xe843('0x18')]['message']);}logger['error'](_0xe843('0x14'),_0xcd811a,_0x1101cc[_0xe843('0x18')][_0xe843('0x19')]);return _0xa0f3b0(_0x1101cc[_0xe843('0x18')][_0xe843('0x19')]);}else{logger[_0xe843('0x13')](_0xe843('0x14'),_0xcd811a,_0xe843('0x15'));_0xa0f3b0(_0x1101cc[_0xe843('0x1a')]['message']);}})['catch'](function(_0x4a6c41){logger[_0xe843('0x18')]('ChatQueue,\x20%s,\x20%s',_0xcd811a,_0x4a6c41);_0x1c42f7(_0x4a6c41);});});}exports[_0xe843('0x1b')]=function(_0x216f8e){var _0x5a188b=this;return new Promise(function(_0x3012f9,_0x37bc5f){return db[_0xe843('0x1c')][_0xe843('0x1d')]({'raw':_0x216f8e[_0xe843('0x1e')]?_0x216f8e[_0xe843('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x216f8e[_0xe843('0x1e')]?_0x216f8e[_0xe843('0x1e')][_0xe843('0x1f')]||null:null,'attributes':_0x216f8e[_0xe843('0x1e')]?_0x216f8e['options']['attributes']||null:null,'limit':_0x216f8e['options']?_0x216f8e[_0xe843('0x1e')][_0xe843('0x20')]||null:null,'include':_0x216f8e[_0xe843('0x1e')]?_0x216f8e[_0xe843('0x1e')][_0xe843('0x21')]?_[_0xe843('0x22')](_0x216f8e[_0xe843('0x1e')][_0xe843('0x21')],function(_0x24faee){return{'model':db[_0x24faee[_0xe843('0x23')]],'as':_0x24faee['as'],'attributes':_0x24faee[_0xe843('0x24')],'include':_0x24faee[_0xe843('0x21')]?_['map'](_0x24faee[_0xe843('0x21')],function(_0x1bc911){return{'model':db[_0x1bc911['model']],'as':_0x1bc911['as'],'attributes':_0x1bc911['attributes'],'include':_0x1bc911[_0xe843('0x21')]?_[_0xe843('0x22')](_0x1bc911['include'],function(_0x24f049){return{'model':db[_0x24f049[_0xe843('0x23')]],'as':_0x24f049['as'],'attributes':_0x24f049['attributes']};}):[]};}):[]};}):[]:[]})[_0xe843('0x12')](function(_0x2d75ae){logger[_0xe843('0x13')]('GetChatQueue',_0x216f8e);logger[_0xe843('0x16')](_0xe843('0x1b'),_0x216f8e,JSON[_0xe843('0x17')](_0x2d75ae));_0x3012f9(_0x2d75ae);})[_0xe843('0x25')](function(_0x1a3cca){logger[_0xe843('0x18')](_0xe843('0x1b'),_0x1a3cca['message'],_0x216f8e);_0x37bc5f(_0x5a188b['error'](0x1f4,_0x1a3cca['message']));});});};exports[_0xe843('0x26')]=function(_0x5a6c7b){var _0x682881=this;return new Promise(function(_0x3cb064,_0x246aa4){return db['ChatQueue'][_0xe843('0x27')]({'raw':_0x5a6c7b[_0xe843('0x1e')]?_0x5a6c7b[_0xe843('0x1e')][_0xe843('0x28')]===undefined?!![]:![]:!![],'where':_0x5a6c7b[_0xe843('0x1e')]?_0x5a6c7b[_0xe843('0x1e')][_0xe843('0x1f')]||null:null,'attributes':_0x5a6c7b[_0xe843('0x1e')]?_0x5a6c7b[_0xe843('0x1e')]['attributes']||null:null,'include':_0x5a6c7b['options']?_0x5a6c7b[_0xe843('0x1e')][_0xe843('0x21')]?_[_0xe843('0x22')](_0x5a6c7b[_0xe843('0x1e')][_0xe843('0x21')],function(_0x303d6c){return{'model':db[_0x303d6c['model']],'as':_0x303d6c['as'],'attributes':_0x303d6c[_0xe843('0x24')],'include':_0x303d6c['include']?_['map'](_0x303d6c[_0xe843('0x21')],function(_0x128f7d){return{'model':db[_0x128f7d[_0xe843('0x23')]],'as':_0x128f7d['as'],'attributes':_0x128f7d[_0xe843('0x24')],'include':_0x128f7d[_0xe843('0x21')]?_[_0xe843('0x22')](_0x128f7d[_0xe843('0x21')],function(_0x3bab5d){return{'model':db[_0x3bab5d[_0xe843('0x23')]],'as':_0x3bab5d['as'],'attributes':_0x3bab5d[_0xe843('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe843('0x12')](function(_0x401d4b){logger[_0xe843('0x13')](_0xe843('0x26'),_0x5a6c7b);logger[_0xe843('0x16')](_0xe843('0x26'),_0x5a6c7b,JSON['stringify'](_0x401d4b));_0x3cb064(_0x401d4b);})[_0xe843('0x25')](function(_0xc1989b){logger['error'](_0xe843('0x26'),_0xc1989b['message'],_0x5a6c7b);_0x246aa4(_0x682881['error'](0x1f4,_0xc1989b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8046db2..f2a26f9 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(_0x542549,_0x466258){var _0x39693b=function(_0x430e25){while(--_0x430e25){_0x542549['push'](_0x542549['shift']());}};_0x39693b(++_0x466258);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'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 _0xc978=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x2c2dc3,_0x3f4379){var _0x515de4=function(_0x496fb2){while(--_0x496fb2){_0x2c2dc3['push'](_0x2c2dc3['shift']());}};_0x515de4(++_0x3f4379);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var ChatQueueEvents=require(_0x8c97('0x0'));var events=[_0x8c97('0x1'),_0x8c97('0x2'),_0x8c97('0x3')];function createListener(_0x371c48,_0x44d4ea){return function(_0x5ef47d){_0x44d4ea[_0x8c97('0x4')](_0x371c48,_0x5ef47d);};}function removeListener(_0x23c28d,_0x3ad972){return function(){ChatQueueEvents[_0x8c97('0x5')](_0x23c28d,_0x3ad972);};}exports[_0x8c97('0x6')]=function(_0x2a9434){for(var _0xabd146=0x0,_0x524196=events[_0x8c97('0x7')];_0xabd146<_0x524196;_0xabd146++){var _0x1b5864=events[_0xabd146];var _0x332cd1=createListener(_0x8c97('0x8')+_0x1b5864,_0x2a9434);ChatQueueEvents['on'](_0x1b5864,_0x332cd1);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7719bbb..1280a80 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(_0x37d00f,_0x554792){var _0xfece47=function(_0x231088){while(--_0x231088){_0x37d00f['push'](_0x37d00f['shift']());}};_0xfece47(++_0x554792);}(_0xe14b,0x93));var _0xbe14=function(_0x142ed6,_0x3f2137){_0x142ed6=_0x142ed6-0x0;var _0x38f5f6=_0xe14b[_0x142ed6];return _0x38f5f6;};'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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x333f73,_0x1fa4b8){var _0x1c8d77=function(_0xb665cb){while(--_0xb665cb){_0x333f73['push'](_0x333f73['shift']());}};_0x1c8d77(++_0x1fa4b8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 47617ef..0cf9055 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 _0x50a9=['moment','sequelize','exports','STRING','DATE'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x50a9,0x11d));var _0x950a=function(_0x411f8f,_0x11a2a2){_0x411f8f=_0x411f8f-0x0;var _0x5954f8=_0x50a9[_0x411f8f];return _0x5954f8;};'use strict';var moment=require(_0x950a('0x0'));var Sequelize=require(_0x950a('0x1'));module[_0x950a('0x2')]={'uniqueid':{'type':Sequelize[_0x950a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x950a('0x3')]},'joinAt':{'type':Sequelize[_0x950a('0x4')]},'leaveAt':{'type':Sequelize[_0x950a('0x4')]},'acceptAt':{'type':Sequelize[_0x950a('0x4')]},'exitAt':{'type':Sequelize[_0x950a('0x4')]},'reason':{'type':Sequelize[_0x950a('0x3')]}}; \ No newline at end of file +var _0x6b6d=['sequelize','exports','STRING','DATE','moment'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x6b6d[_0x355ce8];return _0x1db8b8;};'use strict';var moment=require(_0xd6b6('0x0'));var Sequelize=require(_0xd6b6('0x1'));module[_0xd6b6('0x2')]={'uniqueid':{'type':Sequelize[_0xd6b6('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd6b6('0x4')]},'leaveAt':{'type':Sequelize[_0xd6b6('0x4')]},'acceptAt':{'type':Sequelize[_0xd6b6('0x4')]},'exitAt':{'type':Sequelize[_0xd6b6('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6c7ae46..9af60d7 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 _0x4351=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x190f52,_0x2927eb){var _0x4dc4c7=function(_0xaa6bf){while(--_0xaa6bf){_0x190f52['push'](_0x190f52['shift']());}};_0x4dc4c7(++_0x2927eb);}(_0x4351,0x1b5));var _0x1435=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4351[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x1435('0x0'));var rimraf=require(_0x1435('0x1'));var zipdir=require(_0x1435('0x2'));var jsonpatch=require(_0x1435('0x3'));var rp=require(_0x1435('0x4'));var moment=require(_0x1435('0x5'));var BPromise=require(_0x1435('0x6'));var Mustache=require(_0x1435('0x7'));var util=require(_0x1435('0x8'));var path=require(_0x1435('0x9'));var sox=require(_0x1435('0xa'));var csv=require(_0x1435('0xb'));var ejs=require(_0x1435('0xc'));var fs=require('fs');var fs_extra=require(_0x1435('0xd'));var _=require(_0x1435('0xe'));var squel=require('squel');var crypto=require(_0x1435('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1435('0xb'));var querystring=require(_0x1435('0x10'));var Papa=require(_0x1435('0x11'));var Redis=require(_0x1435('0x12'));var authService=require(_0x1435('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1435('0x14'));var hardwareService=require(_0x1435('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1435('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1435('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1632ac,_0x5137c0){_0x5137c0=_0x5137c0||0xcc;return function(_0x47daf0){if(_0x47daf0){return _0x1632ac['sendStatus'](_0x5137c0);}return _0x1632ac[_0x1435('0x18')](_0x5137c0)[_0x1435('0x19')]();};}function respondWithResult(_0x243669,_0x4a80bc){_0x4a80bc=_0x4a80bc||0xc8;return function(_0x4a52ba){if(_0x4a52ba){return _0x243669[_0x1435('0x18')](_0x4a80bc)['json'](_0x4a52ba);}};}function respondWithFilteredResult(_0x39405c,_0x3f0b08){return function(_0x1f5fc3){if(_0x1f5fc3){var _0x202744=typeof _0x3f0b08[_0x1435('0x1a')]===_0x1435('0x1b')&&typeof _0x3f0b08[_0x1435('0x1c')]===_0x1435('0x1b');var _0x2c1a6b=_0x1f5fc3[_0x1435('0x1d')];var _0x430367=_0x202744?0x0:_0x3f0b08[_0x1435('0x1a')];var _0x68f503=_0x202744?_0x1f5fc3[_0x1435('0x1d')]:_0x3f0b08[_0x1435('0x1a')]+_0x3f0b08['limit'];var _0x26da28;if(_0x68f503>=_0x2c1a6b){_0x68f503=_0x2c1a6b;_0x26da28=0xc8;}else{_0x26da28=0xce;}_0x39405c[_0x1435('0x18')](_0x26da28);return _0x39405c['set'](_0x1435('0x1e'),_0x430367+'-'+_0x68f503+'/'+_0x2c1a6b)['json'](_0x1f5fc3);}return null;};}function patchUpdates(_0x15d7c0){return function(_0x2a72aa){try{jsonpatch[_0x1435('0x1f')](_0x2a72aa,_0x15d7c0,!![]);}catch(_0x28bc0a){return BPromise[_0x1435('0x20')](_0x28bc0a);}return _0x2a72aa[_0x1435('0x21')]();};}function saveUpdates(_0x543209,_0x17ed76){return function(_0x437f61){if(_0x437f61){return _0x437f61[_0x1435('0x22')](_0x543209)[_0x1435('0x23')](function(_0x57a94f){return _0x57a94f;});}return null;};}function removeEntity(_0x1b6259,_0x302831){return function(_0xab77fa){if(_0xab77fa){return _0xab77fa[_0x1435('0x24')]()[_0x1435('0x23')](function(){_0x1b6259[_0x1435('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523792,_0x22241f){return function(_0x2b4828){if(!_0x2b4828){_0x523792[_0x1435('0x25')](0x194);}return _0x2b4828;};}function handleError(_0x4f86f0,_0x42599d){_0x42599d=_0x42599d||0x1f4;return function(_0x25cf29){logger[_0x1435('0x26')](_0x25cf29[_0x1435('0x27')]);if(_0x25cf29[_0x1435('0x28')]){delete _0x25cf29['name'];}_0x4f86f0[_0x1435('0x18')](_0x42599d)[_0x1435('0x29')](_0x25cf29);};}exports[_0x1435('0x2a')]=function(_0x453d68,_0x1c3b7e){var _0x108c25={},_0x2e0e72={},_0x57a02f={'count':0x0,'rows':[]};var _0x31ab10=_[_0x1435('0x2b')](db[_0x1435('0x2c')][_0x1435('0x2d')],function(_0x297edf){return{'name':_0x297edf['fieldName'],'type':_0x297edf[_0x1435('0x2e')][_0x1435('0x2f')]};});_0x2e0e72[_0x1435('0x30')]=_[_0x1435('0x2b')](_0x31ab10,'name');_0x2e0e72[_0x1435('0x31')]=_[_0x1435('0x32')](_0x453d68['query']);_0x2e0e72[_0x1435('0x33')]=_['intersection'](_0x2e0e72[_0x1435('0x30')],_0x2e0e72[_0x1435('0x31')]);_0x108c25['attributes']=_[_0x1435('0x34')](_0x2e0e72[_0x1435('0x30')],qs['fields'](_0x453d68['query']['fields']));_0x108c25[_0x1435('0x35')]=_0x108c25['attributes'][_0x1435('0x36')]?_0x108c25['attributes']:_0x2e0e72[_0x1435('0x30')];if(!_0x453d68['query'][_0x1435('0x37')](_0x1435('0x38'))){_0x108c25[_0x1435('0x1c')]=qs[_0x1435('0x1c')](_0x453d68[_0x1435('0x31')][_0x1435('0x1c')]);_0x108c25['offset']=qs[_0x1435('0x1a')](_0x453d68[_0x1435('0x31')][_0x1435('0x1a')]);}_0x108c25[_0x1435('0x39')]=qs[_0x1435('0x3a')](_0x453d68['query'][_0x1435('0x3a')]);_0x108c25['where']=qs[_0x1435('0x33')](_[_0x1435('0x3b')](_0x453d68['query'],_0x2e0e72[_0x1435('0x33')]),_0x31ab10);if(_0x453d68[_0x1435('0x31')][_0x1435('0x3c')]){_0x108c25[_0x1435('0x3d')]=_[_0x1435('0x3e')](_0x108c25[_0x1435('0x3d')],{'$or':_[_0x1435('0x2b')](_0x31ab10,function(_0x176dbd){if(_0x176dbd[_0x1435('0x2e')]!==_0x1435('0x3f')){var _0x3ecac4={};_0x3ecac4[_0x176dbd[_0x1435('0x28')]]={'$like':'%'+_0x453d68['query'][_0x1435('0x3c')]+'%'};return _0x3ecac4;}})});}_0x108c25=_['merge']({},_0x108c25,_0x453d68[_0x1435('0x40')]);var _0x5b24ab={'where':_0x108c25[_0x1435('0x3d')]};return db['ChatQueueReport'][_0x1435('0x1d')](_0x5b24ab)['then'](function(_0x36bc74){_0x57a02f[_0x1435('0x1d')]=_0x36bc74;if(_0x453d68[_0x1435('0x31')]['includeAll']){_0x108c25[_0x1435('0x41')]=[{'all':!![]}];}return db[_0x1435('0x2c')][_0x1435('0x42')](_0x108c25);})['then'](function(_0x1d6417){_0x57a02f[_0x1435('0x43')]=_0x1d6417;return _0x57a02f;})['then'](respondWithFilteredResult(_0x1c3b7e,_0x108c25))['catch'](handleError(_0x1c3b7e,null));};exports[_0x1435('0x44')]=function(_0x40e9eb,_0x2dd1f5){var _0x5986f8={'raw':!![],'where':{'id':_0x40e9eb[_0x1435('0x45')]['id']}},_0x4e5d0a={};_0x4e5d0a['model']=_[_0x1435('0x32')](db['ChatQueueReport'][_0x1435('0x2d')]);_0x4e5d0a['query']=_[_0x1435('0x32')](_0x40e9eb['query']);_0x4e5d0a[_0x1435('0x33')]=_['intersection'](_0x4e5d0a[_0x1435('0x30')],_0x4e5d0a[_0x1435('0x31')]);_0x5986f8['attributes']=_[_0x1435('0x34')](_0x4e5d0a['model'],qs[_0x1435('0x46')](_0x40e9eb[_0x1435('0x31')][_0x1435('0x46')]));_0x5986f8['attributes']=_0x5986f8[_0x1435('0x35')][_0x1435('0x36')]?_0x5986f8['attributes']:_0x4e5d0a[_0x1435('0x30')];if(_0x40e9eb[_0x1435('0x31')]['includeAll']){_0x5986f8[_0x1435('0x41')]=[{'all':!![]}];}_0x5986f8=_[_0x1435('0x3e')]({},_0x5986f8,_0x40e9eb['options']);return db[_0x1435('0x2c')][_0x1435('0x47')](_0x5986f8)['then'](handleEntityNotFound(_0x2dd1f5,null))[_0x1435('0x23')](respondWithResult(_0x2dd1f5,null))[_0x1435('0x48')](handleError(_0x2dd1f5,null));};exports[_0x1435('0x49')]=function(_0x4b254e,_0x57b5d4){return db[_0x1435('0x2c')]['create'](_0x4b254e[_0x1435('0x4a')],{})['then'](respondWithResult(_0x57b5d4,0xc9))[_0x1435('0x48')](handleError(_0x57b5d4,null));};exports[_0x1435('0x22')]=function(_0x1f8899,_0x148862){if(_0x1f8899[_0x1435('0x4a')]['id']){delete _0x1f8899[_0x1435('0x4a')]['id'];}return db[_0x1435('0x2c')]['find']({'where':{'id':_0x1f8899[_0x1435('0x45')]['id']}})[_0x1435('0x23')](handleEntityNotFound(_0x148862,null))[_0x1435('0x23')](saveUpdates(_0x1f8899['body'],null))[_0x1435('0x23')](respondWithResult(_0x148862,null))[_0x1435('0x48')](handleError(_0x148862,null));};exports[_0x1435('0x24')]=function(_0x24c5d0,_0x118c06){return db[_0x1435('0x2c')][_0x1435('0x47')]({'where':{'id':_0x24c5d0[_0x1435('0x45')]['id']}})['then'](handleEntityNotFound(_0x118c06,null))[_0x1435('0x23')](removeEntity(_0x118c06,null))[_0x1435('0x48')](handleError(_0x118c06,null));};exports[_0x1435('0x4b')]=function(_0x4244e1,_0x5953ce){return db['ChatQueueReport'][_0x1435('0x4b')]()[_0x1435('0x23')](respondWithResult(_0x5953ce,null))[_0x1435('0x48')](handleError(_0x5953ce,null));}; \ No newline at end of file +var _0x77f7=['name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1c7020,_0x3723f9){var _0x22e4d6=function(_0x46c55b){while(--_0x46c55b){_0x1c7020['push'](_0x1c7020['shift']());}};_0x22e4d6(++_0x3723f9);}(_0x77f7,0xbd));var _0x777f=function(_0x3b3505,_0x1ae8af){_0x3b3505=_0x3b3505-0x0;var _0x252a6f=_0x77f7[_0x3b3505];return _0x252a6f;};'use strict';var emlformat=require(_0x777f('0x0'));var rimraf=require(_0x777f('0x1'));var zipdir=require(_0x777f('0x2'));var jsonpatch=require(_0x777f('0x3'));var rp=require(_0x777f('0x4'));var moment=require(_0x777f('0x5'));var BPromise=require(_0x777f('0x6'));var Mustache=require(_0x777f('0x7'));var util=require(_0x777f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x777f('0x9'));var ejs=require(_0x777f('0xa'));var fs=require('fs');var fs_extra=require(_0x777f('0xb'));var _=require(_0x777f('0xc'));var squel=require(_0x777f('0xd'));var crypto=require(_0x777f('0xe'));var jsforce=require(_0x777f('0xf'));var deskjs=require(_0x777f('0x10'));var toCsv=require(_0x777f('0x9'));var querystring=require(_0x777f('0x11'));var Papa=require('papaparse');var Redis=require(_0x777f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x777f('0x13'));var as=require(_0x777f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x777f('0x15'))(_0x777f('0x16'));var utils=require(_0x777f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x777f('0x18'));var db=require(_0x777f('0x19'))['db'];function respondWithStatusCode(_0x285bf7,_0x30f31b){_0x30f31b=_0x30f31b||0xcc;return function(_0xee481c){if(_0xee481c){return _0x285bf7[_0x777f('0x1a')](_0x30f31b);}return _0x285bf7['status'](_0x30f31b)[_0x777f('0x1b')]();};}function respondWithResult(_0x2cef15,_0x5468c0){_0x5468c0=_0x5468c0||0xc8;return function(_0x36652d){if(_0x36652d){return _0x2cef15[_0x777f('0x1c')](_0x5468c0)[_0x777f('0x1d')](_0x36652d);}};}function respondWithFilteredResult(_0x43d45a,_0xf4d60b){return function(_0x217e98){if(_0x217e98){var _0x41855a=typeof _0xf4d60b['offset']===_0x777f('0x1e')&&typeof _0xf4d60b[_0x777f('0x1f')]===_0x777f('0x1e');var _0x1ef1c5=_0x217e98[_0x777f('0x20')];var _0x3aeb58=_0x41855a?0x0:_0xf4d60b[_0x777f('0x21')];var _0x4e1153=_0x41855a?_0x217e98['count']:_0xf4d60b[_0x777f('0x21')]+_0xf4d60b[_0x777f('0x1f')];var _0x31f786;if(_0x4e1153>=_0x1ef1c5){_0x4e1153=_0x1ef1c5;_0x31f786=0xc8;}else{_0x31f786=0xce;}_0x43d45a[_0x777f('0x1c')](_0x31f786);return _0x43d45a[_0x777f('0x22')](_0x777f('0x23'),_0x3aeb58+'-'+_0x4e1153+'/'+_0x1ef1c5)[_0x777f('0x1d')](_0x217e98);}return null;};}function patchUpdates(_0x143f3d){return function(_0x5d31f1){try{jsonpatch[_0x777f('0x24')](_0x5d31f1,_0x143f3d,!![]);}catch(_0x5637d0){return BPromise[_0x777f('0x25')](_0x5637d0);}return _0x5d31f1[_0x777f('0x26')]();};}function saveUpdates(_0x1cc281,_0x38e32f){return function(_0x3a0c1d){if(_0x3a0c1d){return _0x3a0c1d[_0x777f('0x27')](_0x1cc281)[_0x777f('0x28')](function(_0x5732c6){return _0x5732c6;});}return null;};}function removeEntity(_0x780490,_0x17f1ed){return function(_0x5089ba){if(_0x5089ba){return _0x5089ba[_0x777f('0x29')]()['then'](function(){_0x780490[_0x777f('0x1c')](0xcc)[_0x777f('0x1b')]();});}};}function handleEntityNotFound(_0x109a8e,_0x3fe93d){return function(_0x43a7c1){if(!_0x43a7c1){_0x109a8e[_0x777f('0x1a')](0x194);}return _0x43a7c1;};}function handleError(_0x2c9edc,_0x1c0984){_0x1c0984=_0x1c0984||0x1f4;return function(_0x104b86){logger['error'](_0x104b86['stack']);if(_0x104b86[_0x777f('0x2a')]){delete _0x104b86[_0x777f('0x2a')];}_0x2c9edc[_0x777f('0x1c')](_0x1c0984)[_0x777f('0x2b')](_0x104b86);};}exports[_0x777f('0x2c')]=function(_0x32007e,_0x221dda){var _0x5b0504={},_0x2ebed8={},_0x3940cb={'count':0x0,'rows':[]};var _0x5b78b8=_[_0x777f('0x2d')](db[_0x777f('0x2e')]['rawAttributes'],function(_0x502924){return{'name':_0x502924[_0x777f('0x2f')],'type':_0x502924[_0x777f('0x30')][_0x777f('0x31')]};});_0x2ebed8[_0x777f('0x32')]=_[_0x777f('0x2d')](_0x5b78b8,_0x777f('0x2a'));_0x2ebed8[_0x777f('0x33')]=_[_0x777f('0x34')](_0x32007e[_0x777f('0x33')]);_0x2ebed8[_0x777f('0x35')]=_['intersection'](_0x2ebed8[_0x777f('0x32')],_0x2ebed8[_0x777f('0x33')]);_0x5b0504[_0x777f('0x36')]=_[_0x777f('0x37')](_0x2ebed8[_0x777f('0x32')],qs[_0x777f('0x38')](_0x32007e['query'][_0x777f('0x38')]));_0x5b0504[_0x777f('0x36')]=_0x5b0504['attributes'][_0x777f('0x39')]?_0x5b0504['attributes']:_0x2ebed8['model'];if(!_0x32007e[_0x777f('0x33')][_0x777f('0x3a')](_0x777f('0x3b'))){_0x5b0504[_0x777f('0x1f')]=qs[_0x777f('0x1f')](_0x32007e[_0x777f('0x33')][_0x777f('0x1f')]);_0x5b0504[_0x777f('0x21')]=qs['offset'](_0x32007e['query'][_0x777f('0x21')]);}_0x5b0504[_0x777f('0x3c')]=qs[_0x777f('0x3d')](_0x32007e[_0x777f('0x33')][_0x777f('0x3d')]);_0x5b0504[_0x777f('0x3e')]=qs[_0x777f('0x35')](_[_0x777f('0x3f')](_0x32007e['query'],_0x2ebed8[_0x777f('0x35')]),_0x5b78b8);if(_0x32007e[_0x777f('0x33')][_0x777f('0x40')]){_0x5b0504[_0x777f('0x3e')]=_[_0x777f('0x41')](_0x5b0504[_0x777f('0x3e')],{'$or':_[_0x777f('0x2d')](_0x5b78b8,function(_0x1f32ad){if(_0x1f32ad['type']!=='VIRTUAL'){var _0x19795e={};_0x19795e[_0x1f32ad['name']]={'$like':'%'+_0x32007e[_0x777f('0x33')][_0x777f('0x40')]+'%'};return _0x19795e;}})});}_0x5b0504=_[_0x777f('0x41')]({},_0x5b0504,_0x32007e[_0x777f('0x42')]);var _0x2727d0={'where':_0x5b0504['where']};return db[_0x777f('0x2e')][_0x777f('0x20')](_0x2727d0)[_0x777f('0x28')](function(_0x3a5d34){_0x3940cb[_0x777f('0x20')]=_0x3a5d34;if(_0x32007e['query'][_0x777f('0x43')]){_0x5b0504[_0x777f('0x44')]=[{'all':!![]}];}return db[_0x777f('0x2e')][_0x777f('0x45')](_0x5b0504);})[_0x777f('0x28')](function(_0x43e53d){_0x3940cb[_0x777f('0x46')]=_0x43e53d;return _0x3940cb;})[_0x777f('0x28')](respondWithFilteredResult(_0x221dda,_0x5b0504))['catch'](handleError(_0x221dda,null));};exports['show']=function(_0x2924e9,_0x4a4eb6){var _0x5ac30a={'raw':!![],'where':{'id':_0x2924e9[_0x777f('0x47')]['id']}},_0xdfb525={};_0xdfb525[_0x777f('0x32')]=_['keys'](db['ChatQueueReport'][_0x777f('0x48')]);_0xdfb525[_0x777f('0x33')]=_[_0x777f('0x34')](_0x2924e9[_0x777f('0x33')]);_0xdfb525['filters']=_[_0x777f('0x37')](_0xdfb525[_0x777f('0x32')],_0xdfb525[_0x777f('0x33')]);_0x5ac30a[_0x777f('0x36')]=_[_0x777f('0x37')](_0xdfb525[_0x777f('0x32')],qs[_0x777f('0x38')](_0x2924e9[_0x777f('0x33')][_0x777f('0x38')]));_0x5ac30a[_0x777f('0x36')]=_0x5ac30a[_0x777f('0x36')][_0x777f('0x39')]?_0x5ac30a[_0x777f('0x36')]:_0xdfb525[_0x777f('0x32')];if(_0x2924e9[_0x777f('0x33')]['includeAll']){_0x5ac30a[_0x777f('0x44')]=[{'all':!![]}];}_0x5ac30a=_[_0x777f('0x41')]({},_0x5ac30a,_0x2924e9[_0x777f('0x42')]);return db[_0x777f('0x2e')]['find'](_0x5ac30a)[_0x777f('0x28')](handleEntityNotFound(_0x4a4eb6,null))[_0x777f('0x28')](respondWithResult(_0x4a4eb6,null))[_0x777f('0x49')](handleError(_0x4a4eb6,null));};exports['create']=function(_0x486664,_0x364d41){return db['ChatQueueReport']['create'](_0x486664[_0x777f('0x4a')],{})[_0x777f('0x28')](respondWithResult(_0x364d41,0xc9))[_0x777f('0x49')](handleError(_0x364d41,null));};exports[_0x777f('0x27')]=function(_0x3ba76d,_0x45ea24){if(_0x3ba76d[_0x777f('0x4a')]['id']){delete _0x3ba76d[_0x777f('0x4a')]['id'];}return db['ChatQueueReport'][_0x777f('0x4b')]({'where':{'id':_0x3ba76d[_0x777f('0x47')]['id']}})[_0x777f('0x28')](handleEntityNotFound(_0x45ea24,null))[_0x777f('0x28')](saveUpdates(_0x3ba76d[_0x777f('0x4a')],null))[_0x777f('0x28')](respondWithResult(_0x45ea24,null))[_0x777f('0x49')](handleError(_0x45ea24,null));};exports[_0x777f('0x29')]=function(_0x124fc5,_0x145cbb){return db[_0x777f('0x2e')][_0x777f('0x4b')]({'where':{'id':_0x124fc5[_0x777f('0x47')]['id']}})[_0x777f('0x28')](handleEntityNotFound(_0x145cbb,null))[_0x777f('0x28')](removeEntity(_0x145cbb,null))[_0x777f('0x49')](handleError(_0x145cbb,null));};exports[_0x777f('0x4c')]=function(_0x4d9f46,_0x126b50){return db['ChatQueueReport'][_0x777f('0x4c')]()[_0x777f('0x28')](respondWithResult(_0x126b50,null))[_0x777f('0x49')](handleError(_0x126b50,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index efea479..3f10012 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x5dc123,_0x1a7217){var _0xd98e38=function(_0x1332aa){while(--_0x1332aa){_0x5dc123['push'](_0x5dc123['shift']());}};_0xd98e38(++_0x1a7217);}(_0xe706,0xa3));var _0x6e70=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0xe706[_0x6d394d];return _0x1f0621;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x223f38,_0x4ece37){var _0x4f18b7=function(_0x502d2c){while(--_0x502d2c){_0x223f38['push'](_0x223f38['shift']());}};_0x4f18b7(++_0x4ece37);}(_0xe706,0xa3));var _0x6e70=function(_0x67098f,_0x55e2d0){_0x67098f=_0x67098f-0x0;var _0x4cf120=_0xe706[_0x67098f];return _0x4cf120;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 23f4b5d..00f510b 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 _0xf097=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body','where','attributes','limit','lodash','util','moment'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0xf097,0x66));var _0x7f09=function(_0x541e51,_0x3b4a2c){_0x541e51=_0x541e51-0x0;var _0x4cc19e=_0xf097[_0x541e51];return _0x4cc19e;};'use strict';var _=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var moment=require(_0x7f09('0x2'));var BPromise=require(_0x7f09('0x3'));var rs=require(_0x7f09('0x4'));var fs=require('fs');var Redis=require(_0x7f09('0x5'));var db=require(_0x7f09('0x6'))['db'];var utils=require(_0x7f09('0x7'));var logger=require(_0x7f09('0x8'))(_0x7f09('0x9'));var config=require('../../config/environment');var jayson=require(_0x7f09('0xa'));var client=jayson[_0x7f09('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364e42,_0x6d7627,_0x1a60cf){return new BPromise(function(_0xebfeae,_0x3336ba){return client[_0x7f09('0xc')](_0x364e42,_0x1a60cf)['then'](function(_0x4f845f){logger[_0x7f09('0xd')](_0x7f09('0xe'),_0x6d7627,'request\x20sent');logger[_0x7f09('0xf')](_0x7f09('0x10'),_0x6d7627,_0x7f09('0x11'),JSON[_0x7f09('0x12')](_0x4f845f));if(_0x4f845f[_0x7f09('0x13')]){if(_0x4f845f[_0x7f09('0x13')]['code']===0x1f4){logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x4f845f[_0x7f09('0x13')][_0x7f09('0x14')]);return _0x3336ba(_0x4f845f['error']['message']);}logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x4f845f['error']['message']);return _0xebfeae(_0x4f845f[_0x7f09('0x13')][_0x7f09('0x14')]);}else{logger[_0x7f09('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x6d7627,_0x7f09('0x11'));_0xebfeae(_0x4f845f[_0x7f09('0x15')][_0x7f09('0x14')]);}})[_0x7f09('0x16')](function(_0x32b561){logger[_0x7f09('0x13')](_0x7f09('0xe'),_0x6d7627,_0x32b561);_0x3336ba(_0x32b561);});});}exports[_0x7f09('0x17')]=function(_0x25ba41){var _0x420401=this;return new Promise(function(_0x4a4bcb,_0x1b5427){return db[_0x7f09('0x18')][_0x7f09('0x19')](_0x25ba41['body'],{'raw':_0x25ba41[_0x7f09('0x1a')]?_0x25ba41[_0x7f09('0x1a')][_0x7f09('0x1b')]===undefined?!![]:![]:!![]})[_0x7f09('0x1c')](function(_0x5e59e5){logger[_0x7f09('0xd')]('CreateChatQueueReport',_0x25ba41);logger['debug'](_0x7f09('0x17'),_0x25ba41,JSON[_0x7f09('0x12')](_0x5e59e5));_0x4a4bcb(_0x5e59e5);})[_0x7f09('0x16')](function(_0x916963){logger[_0x7f09('0x13')](_0x7f09('0x17'),_0x916963[_0x7f09('0x14')],_0x25ba41);_0x1b5427(_0x420401[_0x7f09('0x13')](0x1f4,_0x916963[_0x7f09('0x14')]));});});};exports[_0x7f09('0x1d')]=function(_0x225299){var _0x101640=this;return new Promise(function(_0x5bfd73,_0x2c40cf){return db[_0x7f09('0x18')][_0x7f09('0x1e')](_0x225299[_0x7f09('0x1f')],{'raw':_0x225299[_0x7f09('0x1a')]?_0x225299['options'][_0x7f09('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225299[_0x7f09('0x1a')]?_0x225299[_0x7f09('0x1a')][_0x7f09('0x20')]||null:null,'attributes':_0x225299['options']?_0x225299[_0x7f09('0x1a')][_0x7f09('0x21')]||null:null,'limit':_0x225299[_0x7f09('0x1a')]?_0x225299['options'][_0x7f09('0x22')]||null:null})[_0x7f09('0x1c')](function(_0x4d2d93){logger[_0x7f09('0xd')](_0x7f09('0x1d'),_0x225299);logger[_0x7f09('0xf')](_0x7f09('0x1d'),_0x225299,JSON[_0x7f09('0x12')](_0x4d2d93));_0x5bfd73(_0x4d2d93);})[_0x7f09('0x16')](function(_0x2af662){logger[_0x7f09('0x13')](_0x7f09('0x1d'),_0x2af662[_0x7f09('0x14')],_0x225299);_0x2c40cf(_0x101640['error'](0x1f4,_0x2af662[_0x7f09('0x14')]));});});}; \ No newline at end of file +var _0xa30e=['CreateChatQueueReport','ChatQueueReport','body','options','raw','update','attributes','UpdateChatQueueReport','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x28732e,_0x19dd8b){var _0x163b44=function(_0x1cf8fa){while(--_0x1cf8fa){_0x28732e['push'](_0x28732e['shift']());}};_0x163b44(++_0x19dd8b);}(_0xa30e,0x117));var _0xea30=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0xa30e[_0x533110];return _0xc3c866;};'use strict';var _=require(_0xea30('0x0'));var util=require(_0xea30('0x1'));var moment=require(_0xea30('0x2'));var BPromise=require(_0xea30('0x3'));var rs=require(_0xea30('0x4'));var fs=require('fs');var Redis=require(_0xea30('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea30('0x6'));var config=require(_0xea30('0x7'));var jayson=require(_0xea30('0x8'));var client=jayson['client'][_0xea30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e178,_0x10c36f,_0x32320b){return new BPromise(function(_0x1c5d00,_0xc7858e){return client[_0xea30('0xa')](_0x33e178,_0x32320b)[_0xea30('0xb')](function(_0x4192e9){logger[_0xea30('0xc')](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x10c36f,_0xea30('0xe'),JSON[_0xea30('0xf')](_0x4192e9));if(_0x4192e9[_0xea30('0x10')]){if(_0x4192e9[_0xea30('0x10')][_0xea30('0x11')]===0x1f4){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);return _0xc7858e(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x4192e9['error'][_0xea30('0x12')]);return _0x1c5d00(_0x4192e9[_0xea30('0x10')][_0xea30('0x12')]);}else{logger['info'](_0xea30('0xd'),_0x10c36f,_0xea30('0xe'));_0x1c5d00(_0x4192e9[_0xea30('0x13')][_0xea30('0x12')]);}})[_0xea30('0x14')](function(_0x36212e){logger[_0xea30('0x10')](_0xea30('0xd'),_0x10c36f,_0x36212e);_0xc7858e(_0x36212e);});});}exports[_0xea30('0x15')]=function(_0x2e7504){var _0x2bca4d=this;return new Promise(function(_0x225bb7,_0x3054fa){return db[_0xea30('0x16')]['create'](_0x2e7504[_0xea30('0x17')],{'raw':_0x2e7504[_0xea30('0x18')]?_0x2e7504[_0xea30('0x18')][_0xea30('0x19')]===undefined?!![]:![]:!![]})[_0xea30('0xb')](function(_0x2c3cc0){logger[_0xea30('0xc')](_0xea30('0x15'),_0x2e7504);logger['debug'](_0xea30('0x15'),_0x2e7504,JSON['stringify'](_0x2c3cc0));_0x225bb7(_0x2c3cc0);})['catch'](function(_0x50951f){logger[_0xea30('0x10')](_0xea30('0x15'),_0x50951f[_0xea30('0x12')],_0x2e7504);_0x3054fa(_0x2bca4d[_0xea30('0x10')](0x1f4,_0x50951f[_0xea30('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x74ceb1){var _0xf974=this;return new Promise(function(_0x3cd813,_0x2b7805){return db[_0xea30('0x16')][_0xea30('0x1a')](_0x74ceb1[_0xea30('0x17')],{'raw':_0x74ceb1['options']?_0x74ceb1['options'][_0xea30('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x74ceb1[_0xea30('0x18')]?_0x74ceb1[_0xea30('0x18')]['where']||null:null,'attributes':_0x74ceb1[_0xea30('0x18')]?_0x74ceb1[_0xea30('0x18')][_0xea30('0x1b')]||null:null,'limit':_0x74ceb1[_0xea30('0x18')]?_0x74ceb1['options']['limit']||null:null})[_0xea30('0xb')](function(_0x144aaa){logger[_0xea30('0xc')](_0xea30('0x1c'),_0x74ceb1);logger[_0xea30('0x1d')](_0xea30('0x1c'),_0x74ceb1,JSON['stringify'](_0x144aaa));_0x3cd813(_0x144aaa);})[_0xea30('0x14')](function(_0xdcf47e){logger[_0xea30('0x10')](_0xea30('0x1c'),_0xdcf47e[_0xea30('0x12')],_0x74ceb1);_0x2b7805(_0xf974[_0xea30('0x10')](0x1f4,_0xdcf47e[_0xea30('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7d19663..4e74e4b 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 _0x7571=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatQueueReport.controller','isAuthenticated','get','/describe','show','post'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7571,0x1a8));var _0x1757=function(_0x267c41,_0x244bd2){_0x267c41=_0x267c41-0x0;var _0x160aaf=_0x7571[_0x267c41];return _0x160aaf;};'use strict';var multer=require(_0x1757('0x0'));var util=require(_0x1757('0x1'));var path=require(_0x1757('0x2'));var timeout=require(_0x1757('0x3'));var express=require(_0x1757('0x4'));var router=express['Router']();var fs_extra=require(_0x1757('0x5'));var auth=require(_0x1757('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1757('0x7'));router['get']('/',auth[_0x1757('0x8')](),controller['index']);router[_0x1757('0x9')](_0x1757('0xa'),auth[_0x1757('0x8')](),controller['describe']);router[_0x1757('0x9')]('/:id',auth[_0x1757('0x8')](),controller[_0x1757('0xb')]);router[_0x1757('0xc')]('/',auth['isAuthenticated'](),controller[_0x1757('0xd')]);router[_0x1757('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1757('0xf')]);router[_0x1757('0x10')]('/:id',auth[_0x1757('0x8')](),controller[_0x1757('0x11')]);module[_0x1757('0x12')]=router; \ No newline at end of file +var _0x49d5=['express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x3c083b,_0x549e68){var _0x1c4f50=function(_0x49f5aa){while(--_0x49f5aa){_0x3c083b['push'](_0x3c083b['shift']());}};_0x1c4f50(++_0x549e68);}(_0x49d5,0x1dd));var _0x549d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x49d5[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x549d('0x0'));var util=require(_0x549d('0x1'));var path=require(_0x549d('0x2'));var timeout=require('connect-timeout');var express=require(_0x549d('0x3'));var router=express[_0x549d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x549d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x549d('0x6'));var controller=require(_0x549d('0x7'));router[_0x549d('0x8')]('/',auth[_0x549d('0x9')](),controller[_0x549d('0xa')]);router['get'](_0x549d('0xb'),auth['isAuthenticated'](),controller[_0x549d('0xc')]);router['get'](_0x549d('0xd'),auth['isAuthenticated'](),controller[_0x549d('0xe')]);router[_0x549d('0xf')]('/',auth[_0x549d('0x9')](),controller[_0x549d('0x10')]);router[_0x549d('0x11')](_0x549d('0xd'),auth[_0x549d('0x9')](),controller['update']);router['delete'](_0x549d('0xd'),auth[_0x549d('0x9')](),controller[_0x549d('0x12')]);module[_0x549d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0356e48..a653bf0 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(_0x1004fa,_0x21747f){var _0x4b53f2=function(_0x5120cb){while(--_0x5120cb){_0x1004fa['push'](_0x1004fa['shift']());}};_0x4b53f2(++_0x21747f);}(_0x70e0,0x17b));var _0x070e=function(_0x309995,_0xa5e701){_0x309995=_0x309995-0x0;var _0x1453f7=_0x70e0[_0x309995];return _0x1453f7;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x34e8,0x12c));var _0x834e=function(_0x44ce95,_0x57bcbf){_0x44ce95=_0x44ce95-0x0;var _0x276954=_0x34e8[_0x44ce95];return _0x276954;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b207343..b797fde 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 _0x4ea8=['count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit'];(function(_0x2648d5,_0x59d362){var _0x47abda=function(_0x4ed58a){while(--_0x4ed58a){_0x2648d5['push'](_0x2648d5['shift']());}};_0x47abda(++_0x59d362);}(_0x4ea8,0xc0));var _0x84ea=function(_0x536442,_0x18e920){_0x536442=_0x536442-0x0;var _0x82516e=_0x4ea8[_0x536442];return _0x82516e;};'use strict';var emlformat=require(_0x84ea('0x0'));var rimraf=require(_0x84ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84ea('0x3'));var util=require(_0x84ea('0x4'));var path=require('path');var sox=require(_0x84ea('0x5'));var csv=require(_0x84ea('0x6'));var ejs=require(_0x84ea('0x7'));var fs=require('fs');var fs_extra=require(_0x84ea('0x8'));var _=require('lodash');var squel=require(_0x84ea('0x9'));var crypto=require(_0x84ea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x84ea('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84ea('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ea('0xd'));var logger=require(_0x84ea('0xe'))(_0x84ea('0xf'));var utils=require(_0x84ea('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x84ea('0x11'));var db=require(_0x84ea('0x12'))['db'];function respondWithStatusCode(_0x2fdf8b,_0x3b0887){_0x3b0887=_0x3b0887||0xcc;return function(_0x5b6140){if(_0x5b6140){return _0x2fdf8b['sendStatus'](_0x3b0887);}return _0x2fdf8b[_0x84ea('0x13')](_0x3b0887)[_0x84ea('0x14')]();};}function respondWithResult(_0x2950a8,_0x81ff83){_0x81ff83=_0x81ff83||0xc8;return function(_0x25d628){if(_0x25d628){return _0x2950a8[_0x84ea('0x13')](_0x81ff83)[_0x84ea('0x15')](_0x25d628);}};}function respondWithFilteredResult(_0x5b957e,_0x429762){return function(_0xcfc6e9){if(_0xcfc6e9){var _0x16bef9=typeof _0x429762['offset']===_0x84ea('0x16')&&typeof _0x429762[_0x84ea('0x17')]===_0x84ea('0x16');var _0x21fe37=_0xcfc6e9['count'];var _0x57ec5b=_0x16bef9?0x0:_0x429762['offset'];var _0x2cbef5=_0x16bef9?_0xcfc6e9[_0x84ea('0x18')]:_0x429762[_0x84ea('0x19')]+_0x429762[_0x84ea('0x17')];var _0x133d78;if(_0x2cbef5>=_0x21fe37){_0x2cbef5=_0x21fe37;_0x133d78=0xc8;}else{_0x133d78=0xce;}_0x5b957e['status'](_0x133d78);return _0x5b957e['set'](_0x84ea('0x1a'),_0x57ec5b+'-'+_0x2cbef5+'/'+_0x21fe37)[_0x84ea('0x15')](_0xcfc6e9);}return null;};}function patchUpdates(_0x5824d7){return function(_0x25794f){try{jsonpatch[_0x84ea('0x1b')](_0x25794f,_0x5824d7,!![]);}catch(_0x1fc551){return BPromise[_0x84ea('0x1c')](_0x1fc551);}return _0x25794f['save']();};}function saveUpdates(_0x2d9a40,_0x5466e7){return function(_0x5b0a99){if(_0x5b0a99){return _0x5b0a99[_0x84ea('0x1d')](_0x2d9a40)[_0x84ea('0x1e')](function(_0x52f558){return _0x52f558;});}return null;};}function removeEntity(_0x18d567,_0x8adc39){return function(_0x456f0f){if(_0x456f0f){return _0x456f0f[_0x84ea('0x1f')]()[_0x84ea('0x1e')](function(){_0x18d567[_0x84ea('0x13')](0xcc)[_0x84ea('0x14')]();});}};}function handleEntityNotFound(_0x22dd92,_0x14a25c){return function(_0x1c3064){if(!_0x1c3064){_0x22dd92[_0x84ea('0x20')](0x194);}return _0x1c3064;};}function handleError(_0x222f0c,_0x1cb911){_0x1cb911=_0x1cb911||0x1f4;return function(_0x253c51){logger[_0x84ea('0x21')](_0x253c51[_0x84ea('0x22')]);if(_0x253c51['name']){delete _0x253c51['name'];}_0x222f0c[_0x84ea('0x13')](_0x1cb911)[_0x84ea('0x23')](_0x253c51);};}exports[_0x84ea('0x24')]=function(_0x26ed33,_0x173fd9){var _0x342fed={},_0x5aba3f={},_0x30e78c={'count':0x0,'rows':[]};var _0x28774d=_[_0x84ea('0x25')](db['ChatTransferReport'][_0x84ea('0x26')],function(_0x11ebd0){return{'name':_0x11ebd0[_0x84ea('0x27')],'type':_0x11ebd0['type'][_0x84ea('0x28')]};});_0x5aba3f[_0x84ea('0x29')]=_[_0x84ea('0x25')](_0x28774d,_0x84ea('0x2a'));_0x5aba3f[_0x84ea('0x2b')]=_['keys'](_0x26ed33[_0x84ea('0x2b')]);_0x5aba3f[_0x84ea('0x2c')]=_[_0x84ea('0x2d')](_0x5aba3f[_0x84ea('0x29')],_0x5aba3f['query']);_0x342fed[_0x84ea('0x2e')]=_[_0x84ea('0x2d')](_0x5aba3f[_0x84ea('0x29')],qs[_0x84ea('0x2f')](_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x2f')]));_0x342fed[_0x84ea('0x2e')]=_0x342fed[_0x84ea('0x2e')]['length']?_0x342fed['attributes']:_0x5aba3f[_0x84ea('0x29')];if(!_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x30')](_0x84ea('0x31'))){_0x342fed[_0x84ea('0x17')]=qs[_0x84ea('0x17')](_0x26ed33[_0x84ea('0x2b')]['limit']);_0x342fed[_0x84ea('0x19')]=qs[_0x84ea('0x19')](_0x26ed33['query'][_0x84ea('0x19')]);}_0x342fed[_0x84ea('0x32')]=qs[_0x84ea('0x33')](_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x33')]);_0x342fed[_0x84ea('0x34')]=qs['filters'](_[_0x84ea('0x35')](_0x26ed33['query'],_0x5aba3f['filters']),_0x28774d);if(_0x26ed33['query'][_0x84ea('0x36')]){_0x342fed['where']=_['merge'](_0x342fed[_0x84ea('0x34')],{'$or':_[_0x84ea('0x25')](_0x28774d,function(_0xd1fdd7){if(_0xd1fdd7[_0x84ea('0x37')]!==_0x84ea('0x38')){var _0x5cbebc={};_0x5cbebc[_0xd1fdd7[_0x84ea('0x2a')]]={'$like':'%'+_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x36')]+'%'};return _0x5cbebc;}})});}_0x342fed=_['merge']({},_0x342fed,_0x26ed33[_0x84ea('0x39')]);var _0x5c3f07={'where':_0x342fed['where']};return db[_0x84ea('0x3a')][_0x84ea('0x18')](_0x5c3f07)['then'](function(_0x56f213){_0x30e78c[_0x84ea('0x18')]=_0x56f213;if(_0x26ed33[_0x84ea('0x2b')][_0x84ea('0x3b')]){_0x342fed[_0x84ea('0x3c')]=[{'all':!![]}];}return db[_0x84ea('0x3a')][_0x84ea('0x3d')](_0x342fed);})[_0x84ea('0x1e')](function(_0x49a19c){_0x30e78c[_0x84ea('0x3e')]=_0x49a19c;return _0x30e78c;})[_0x84ea('0x1e')](respondWithFilteredResult(_0x173fd9,_0x342fed))[_0x84ea('0x3f')](handleError(_0x173fd9,null));};exports[_0x84ea('0x40')]=function(_0x5c9ff9,_0x1b5e4e){var _0x4f5542={'raw':!![],'where':{'id':_0x5c9ff9['params']['id']}},_0x4863a3={};_0x4863a3[_0x84ea('0x29')]=_['keys'](db[_0x84ea('0x3a')][_0x84ea('0x26')]);_0x4863a3[_0x84ea('0x2b')]=_[_0x84ea('0x41')](_0x5c9ff9[_0x84ea('0x2b')]);_0x4863a3[_0x84ea('0x2c')]=_[_0x84ea('0x2d')](_0x4863a3['model'],_0x4863a3['query']);_0x4f5542[_0x84ea('0x2e')]=_[_0x84ea('0x2d')](_0x4863a3[_0x84ea('0x29')],qs['fields'](_0x5c9ff9['query']['fields']));_0x4f5542['attributes']=_0x4f5542[_0x84ea('0x2e')]['length']?_0x4f5542[_0x84ea('0x2e')]:_0x4863a3[_0x84ea('0x29')];if(_0x5c9ff9['query'][_0x84ea('0x3b')]){_0x4f5542[_0x84ea('0x3c')]=[{'all':!![]}];}_0x4f5542=_[_0x84ea('0x42')]({},_0x4f5542,_0x5c9ff9[_0x84ea('0x39')]);return db[_0x84ea('0x3a')][_0x84ea('0x43')](_0x4f5542)[_0x84ea('0x1e')](handleEntityNotFound(_0x1b5e4e,null))['then'](respondWithResult(_0x1b5e4e,null))[_0x84ea('0x3f')](handleError(_0x1b5e4e,null));};exports[_0x84ea('0x44')]=function(_0x455a97,_0x291320){return db[_0x84ea('0x3a')][_0x84ea('0x44')](_0x455a97[_0x84ea('0x45')],{})[_0x84ea('0x1e')](respondWithResult(_0x291320,0xc9))[_0x84ea('0x3f')](handleError(_0x291320,null));};exports[_0x84ea('0x1d')]=function(_0x49df49,_0xe237c7){if(_0x49df49['body']['id']){delete _0x49df49[_0x84ea('0x45')]['id'];}return db[_0x84ea('0x3a')][_0x84ea('0x43')]({'where':{'id':_0x49df49['params']['id']}})[_0x84ea('0x1e')](handleEntityNotFound(_0xe237c7,null))[_0x84ea('0x1e')](saveUpdates(_0x49df49[_0x84ea('0x45')],null))[_0x84ea('0x1e')](respondWithResult(_0xe237c7,null))[_0x84ea('0x3f')](handleError(_0xe237c7,null));};exports[_0x84ea('0x1f')]=function(_0x272d84,_0x2f1ac4){return db[_0x84ea('0x3a')]['find']({'where':{'id':_0x272d84[_0x84ea('0x46')]['id']}})[_0x84ea('0x1e')](handleEntityNotFound(_0x2f1ac4,null))[_0x84ea('0x1e')](removeEntity(_0x2f1ac4,null))['catch'](handleError(_0x2f1ac4,null));};exports[_0x84ea('0x47')]=function(_0x3e25ed,_0x1a68b0){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x1a68b0,null))[_0x84ea('0x3f')](handleError(_0x1a68b0,null));}; \ No newline at end of file +var _0xcaa8=['status','set','json','apply','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xcaa8,0xc3));var _0x8caa=function(_0x2c668d,_0x54b0a3){_0x2c668d=_0x2c668d-0x0;var _0x4e180c=_0xcaa8[_0x2c668d];return _0x4e180c;};'use strict';var emlformat=require(_0x8caa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8caa('0x1'));var jsonpatch=require(_0x8caa('0x2'));var rp=require(_0x8caa('0x3'));var moment=require(_0x8caa('0x4'));var BPromise=require(_0x8caa('0x5'));var Mustache=require(_0x8caa('0x6'));var util=require(_0x8caa('0x7'));var path=require(_0x8caa('0x8'));var sox=require('sox');var csv=require(_0x8caa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8caa('0xa'));var _=require(_0x8caa('0xb'));var squel=require('squel');var crypto=require(_0x8caa('0xc'));var jsforce=require(_0x8caa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8caa('0x9'));var querystring=require(_0x8caa('0xe'));var Papa=require(_0x8caa('0xf'));var Redis=require(_0x8caa('0x10'));var authService=require(_0x8caa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8caa('0x12'));var hardwareService=require(_0x8caa('0x13'));var logger=require('../../config/logger')(_0x8caa('0x14'));var utils=require(_0x8caa('0x15'));var config=require(_0x8caa('0x16'));var licenseUtil=require(_0x8caa('0x17'));var db=require(_0x8caa('0x18'))['db'];function respondWithStatusCode(_0x3eddd2,_0x53d063){_0x53d063=_0x53d063||0xcc;return function(_0x19caf2){if(_0x19caf2){return _0x3eddd2['sendStatus'](_0x53d063);}return _0x3eddd2['status'](_0x53d063)[_0x8caa('0x19')]();};}function respondWithResult(_0x54ace6,_0x2fbb5b){_0x2fbb5b=_0x2fbb5b||0xc8;return function(_0x1e2564){if(_0x1e2564){return _0x54ace6['status'](_0x2fbb5b)['json'](_0x1e2564);}};}function respondWithFilteredResult(_0x35ba56,_0x23792b){return function(_0x56ce25){if(_0x56ce25){var _0x446133=typeof _0x23792b[_0x8caa('0x1a')]===_0x8caa('0x1b')&&typeof _0x23792b[_0x8caa('0x1c')]===_0x8caa('0x1b');var _0x24cead=_0x56ce25['count'];var _0x30e161=_0x446133?0x0:_0x23792b[_0x8caa('0x1a')];var _0x790e0f=_0x446133?_0x56ce25[_0x8caa('0x1d')]:_0x23792b[_0x8caa('0x1a')]+_0x23792b[_0x8caa('0x1c')];var _0x17f670;if(_0x790e0f>=_0x24cead){_0x790e0f=_0x24cead;_0x17f670=0xc8;}else{_0x17f670=0xce;}_0x35ba56[_0x8caa('0x1e')](_0x17f670);return _0x35ba56[_0x8caa('0x1f')]('Content-Range',_0x30e161+'-'+_0x790e0f+'/'+_0x24cead)[_0x8caa('0x20')](_0x56ce25);}return null;};}function patchUpdates(_0x167f98){return function(_0x57ae58){try{jsonpatch[_0x8caa('0x21')](_0x57ae58,_0x167f98,!![]);}catch(_0x2ebe7c){return BPromise['reject'](_0x2ebe7c);}return _0x57ae58[_0x8caa('0x22')]();};}function saveUpdates(_0x168586,_0x14f2a3){return function(_0x128992){if(_0x128992){return _0x128992[_0x8caa('0x23')](_0x168586)[_0x8caa('0x24')](function(_0x39877a){return _0x39877a;});}return null;};}function removeEntity(_0x4ed6ce,_0x149245){return function(_0x372dfb){if(_0x372dfb){return _0x372dfb[_0x8caa('0x25')]()[_0x8caa('0x24')](function(){_0x4ed6ce[_0x8caa('0x1e')](0xcc)[_0x8caa('0x19')]();});}};}function handleEntityNotFound(_0x5ca7cc,_0x8a69ed){return function(_0x2fa259){if(!_0x2fa259){_0x5ca7cc['sendStatus'](0x194);}return _0x2fa259;};}function handleError(_0x4daf5e,_0x289ae1){_0x289ae1=_0x289ae1||0x1f4;return function(_0x2cf8b1){logger['error'](_0x2cf8b1[_0x8caa('0x26')]);if(_0x2cf8b1[_0x8caa('0x27')]){delete _0x2cf8b1[_0x8caa('0x27')];}_0x4daf5e[_0x8caa('0x1e')](_0x289ae1)[_0x8caa('0x28')](_0x2cf8b1);};}exports[_0x8caa('0x29')]=function(_0x2a634f,_0x3c2082){var _0x475ba8={},_0x489064={},_0x6892ec={'count':0x0,'rows':[]};var _0x1d9930=_[_0x8caa('0x2a')](db[_0x8caa('0x2b')][_0x8caa('0x2c')],function(_0x3a6149){return{'name':_0x3a6149['fieldName'],'type':_0x3a6149[_0x8caa('0x2d')][_0x8caa('0x2e')]};});_0x489064[_0x8caa('0x2f')]=_[_0x8caa('0x2a')](_0x1d9930,'name');_0x489064['query']=_[_0x8caa('0x30')](_0x2a634f[_0x8caa('0x31')]);_0x489064['filters']=_[_0x8caa('0x32')](_0x489064[_0x8caa('0x2f')],_0x489064['query']);_0x475ba8['attributes']=_[_0x8caa('0x32')](_0x489064[_0x8caa('0x2f')],qs[_0x8caa('0x33')](_0x2a634f['query']['fields']));_0x475ba8[_0x8caa('0x34')]=_0x475ba8['attributes'][_0x8caa('0x35')]?_0x475ba8[_0x8caa('0x34')]:_0x489064[_0x8caa('0x2f')];if(!_0x2a634f['query'][_0x8caa('0x36')]('nolimit')){_0x475ba8[_0x8caa('0x1c')]=qs[_0x8caa('0x1c')](_0x2a634f[_0x8caa('0x31')][_0x8caa('0x1c')]);_0x475ba8[_0x8caa('0x1a')]=qs['offset'](_0x2a634f[_0x8caa('0x31')][_0x8caa('0x1a')]);}_0x475ba8[_0x8caa('0x37')]=qs[_0x8caa('0x38')](_0x2a634f[_0x8caa('0x31')][_0x8caa('0x38')]);_0x475ba8[_0x8caa('0x39')]=qs[_0x8caa('0x3a')](_[_0x8caa('0x3b')](_0x2a634f['query'],_0x489064['filters']),_0x1d9930);if(_0x2a634f[_0x8caa('0x31')]['filter']){_0x475ba8['where']=_['merge'](_0x475ba8[_0x8caa('0x39')],{'$or':_['map'](_0x1d9930,function(_0x33cc8c){if(_0x33cc8c[_0x8caa('0x2d')]!==_0x8caa('0x3c')){var _0x26a6fc={};_0x26a6fc[_0x33cc8c['name']]={'$like':'%'+_0x2a634f['query'][_0x8caa('0x3d')]+'%'};return _0x26a6fc;}})});}_0x475ba8=_[_0x8caa('0x3e')]({},_0x475ba8,_0x2a634f['options']);var _0x5895a1={'where':_0x475ba8[_0x8caa('0x39')]};return db[_0x8caa('0x2b')][_0x8caa('0x1d')](_0x5895a1)[_0x8caa('0x24')](function(_0xe64d6f){_0x6892ec[_0x8caa('0x1d')]=_0xe64d6f;if(_0x2a634f[_0x8caa('0x31')][_0x8caa('0x3f')]){_0x475ba8[_0x8caa('0x40')]=[{'all':!![]}];}return db[_0x8caa('0x2b')][_0x8caa('0x41')](_0x475ba8);})[_0x8caa('0x24')](function(_0x3ae3ae){_0x6892ec[_0x8caa('0x42')]=_0x3ae3ae;return _0x6892ec;})[_0x8caa('0x24')](respondWithFilteredResult(_0x3c2082,_0x475ba8))['catch'](handleError(_0x3c2082,null));};exports[_0x8caa('0x43')]=function(_0x3a8a7e,_0x51618d){var _0x29f264={'raw':!![],'where':{'id':_0x3a8a7e['params']['id']}},_0x2a726b={};_0x2a726b[_0x8caa('0x2f')]=_[_0x8caa('0x30')](db[_0x8caa('0x2b')][_0x8caa('0x2c')]);_0x2a726b[_0x8caa('0x31')]=_['keys'](_0x3a8a7e[_0x8caa('0x31')]);_0x2a726b[_0x8caa('0x3a')]=_[_0x8caa('0x32')](_0x2a726b[_0x8caa('0x2f')],_0x2a726b[_0x8caa('0x31')]);_0x29f264[_0x8caa('0x34')]=_['intersection'](_0x2a726b[_0x8caa('0x2f')],qs[_0x8caa('0x33')](_0x3a8a7e[_0x8caa('0x31')][_0x8caa('0x33')]));_0x29f264['attributes']=_0x29f264[_0x8caa('0x34')]['length']?_0x29f264[_0x8caa('0x34')]:_0x2a726b[_0x8caa('0x2f')];if(_0x3a8a7e['query']['includeAll']){_0x29f264[_0x8caa('0x40')]=[{'all':!![]}];}_0x29f264=_[_0x8caa('0x3e')]({},_0x29f264,_0x3a8a7e[_0x8caa('0x44')]);return db[_0x8caa('0x2b')][_0x8caa('0x45')](_0x29f264)[_0x8caa('0x24')](handleEntityNotFound(_0x51618d,null))[_0x8caa('0x24')](respondWithResult(_0x51618d,null))[_0x8caa('0x46')](handleError(_0x51618d,null));};exports[_0x8caa('0x47')]=function(_0x5cb9f9,_0x547b34){return db[_0x8caa('0x2b')][_0x8caa('0x47')](_0x5cb9f9[_0x8caa('0x48')],{})[_0x8caa('0x24')](respondWithResult(_0x547b34,0xc9))[_0x8caa('0x46')](handleError(_0x547b34,null));};exports[_0x8caa('0x23')]=function(_0x59ef12,_0x577ecb){if(_0x59ef12[_0x8caa('0x48')]['id']){delete _0x59ef12[_0x8caa('0x48')]['id'];}return db[_0x8caa('0x2b')]['find']({'where':{'id':_0x59ef12[_0x8caa('0x49')]['id']}})[_0x8caa('0x24')](handleEntityNotFound(_0x577ecb,null))['then'](saveUpdates(_0x59ef12[_0x8caa('0x48')],null))[_0x8caa('0x24')](respondWithResult(_0x577ecb,null))['catch'](handleError(_0x577ecb,null));};exports[_0x8caa('0x25')]=function(_0x18196f,_0x12d915){return db[_0x8caa('0x2b')]['find']({'where':{'id':_0x18196f[_0x8caa('0x49')]['id']}})['then'](handleEntityNotFound(_0x12d915,null))[_0x8caa('0x24')](removeEntity(_0x12d915,null))[_0x8caa('0x46')](handleError(_0x12d915,null));};exports[_0x8caa('0x4a')]=function(_0x2c4b1b,_0x16643d){return db[_0x8caa('0x2b')][_0x8caa('0x4a')]()[_0x8caa('0x24')](respondWithResult(_0x16643d,null))[_0x8caa('0x46')](handleError(_0x16643d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index f86abab..7e77e58 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 _0xa1be=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xa1be,0x128));var _0xea1b=function(_0x3c6aa0,_0x280f28){_0x3c6aa0=_0x3c6aa0-0x0;var _0x4b58c6=_0xa1be[_0x3c6aa0];return _0x4b58c6;};'use strict';var _=require(_0xea1b('0x0'));var util=require('util');var logger=require(_0xea1b('0x1'))('api');var moment=require(_0xea1b('0x2'));var BPromise=require(_0xea1b('0x3'));var rp=require(_0xea1b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea1b('0x5'));var attributes=require(_0xea1b('0x6'));module[_0xea1b('0x7')]=function(_0x5f0423,_0x364c82){return _0x5f0423[_0xea1b('0x8')](_0xea1b('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xea1b('0xa'),'fields':[_0xea1b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7056=['report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x2aeaf9,_0x5040be){var _0x38b16c=function(_0x47ef5a){while(--_0x47ef5a){_0x2aeaf9['push'](_0x2aeaf9['shift']());}};_0x38b16c(++_0x5040be);}(_0x7056,0x1b1));var _0x6705=function(_0x2dc7b7,_0x385139){_0x2dc7b7=_0x2dc7b7-0x0;var _0x12f248=_0x7056[_0x2dc7b7];return _0x12f248;};'use strict';var _=require(_0x6705('0x0'));var util=require(_0x6705('0x1'));var logger=require(_0x6705('0x2'))(_0x6705('0x3'));var moment=require(_0x6705('0x4'));var BPromise=require(_0x6705('0x5'));var rp=require(_0x6705('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6705('0x7'));var attributes=require(_0x6705('0x8'));module[_0x6705('0x9')]=function(_0x5e24ac,_0x5a1044){return _0x5e24ac[_0x6705('0xa')]('ChatTransferReport',attributes,{'tableName':_0x6705('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 2dc1624..7dc2803 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 _0xa4e3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa4e3,0x103));var _0x3a4e=function(_0x2ea92f,_0x1b4f22){_0x2ea92f=_0x2ea92f-0x0;var _0x5529ee=_0xa4e3[_0x2ea92f];return _0x5529ee;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require('moment');var BPromise=require(_0x3a4e('0x2'));var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a4e('0x4'))['db'];var utils=require(_0x3a4e('0x5'));var logger=require(_0x3a4e('0x6'))('rpc');var config=require(_0x3a4e('0x7'));var jayson=require(_0x3a4e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea0e0,_0x39af53,_0x27e9e5){return new BPromise(function(_0x127cf0,_0x194d21){return client[_0x3a4e('0x9')](_0x4ea0e0,_0x27e9e5)[_0x3a4e('0xa')](function(_0x32200c){logger[_0x3a4e('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x39af53,_0x3a4e('0xc'));logger[_0x3a4e('0xd')](_0x3a4e('0xe'),_0x39af53,_0x3a4e('0xc'),JSON[_0x3a4e('0xf')](_0x32200c));if(_0x32200c[_0x3a4e('0x10')]){if(_0x32200c['error'][_0x3a4e('0x11')]===0x1f4){logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);return _0x194d21(_0x32200c['error']['message']);}logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);return _0x127cf0(_0x32200c[_0x3a4e('0x10')][_0x3a4e('0x13')]);}else{logger['info'](_0x3a4e('0x12'),_0x39af53,'request\x20sent');_0x127cf0(_0x32200c[_0x3a4e('0x14')][_0x3a4e('0x13')]);}})[_0x3a4e('0x15')](function(_0x5c8ceb){logger[_0x3a4e('0x10')](_0x3a4e('0x12'),_0x39af53,_0x5c8ceb);_0x194d21(_0x5c8ceb);});});} \ No newline at end of file +var _0xdc8e=['error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x7bff4f,_0x45ce80){var _0x3c6a26=function(_0x562f84){while(--_0x562f84){_0x7bff4f['push'](_0x7bff4f['shift']());}};_0x3c6a26(++_0x45ce80);}(_0xdc8e,0x107));var _0xedc8=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0xdc8e[_0x1bb6aa];return _0x2ef28e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xedc8('0x0'));var BPromise=require(_0xedc8('0x1'));var rs=require(_0xedc8('0x2'));var fs=require('fs');var Redis=require(_0xedc8('0x3'));var db=require(_0xedc8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xedc8('0x5'))('rpc');var config=require(_0xedc8('0x6'));var jayson=require(_0xedc8('0x7'));var client=jayson[_0xedc8('0x8')][_0xedc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301278,_0x22fed0,_0x3aca3c){return new BPromise(function(_0x585c5f,_0x552326){return client[_0xedc8('0xa')](_0x301278,_0x3aca3c)[_0xedc8('0xb')](function(_0xdc7113){logger[_0xedc8('0xc')](_0xedc8('0xd'),_0x22fed0,'request\x20sent');logger[_0xedc8('0xe')](_0xedc8('0xf'),_0x22fed0,_0xedc8('0x10'),JSON['stringify'](_0xdc7113));if(_0xdc7113[_0xedc8('0x11')]){if(_0xdc7113[_0xedc8('0x11')]['code']===0x1f4){logger[_0xedc8('0x11')](_0xedc8('0xd'),_0x22fed0,_0xdc7113['error'][_0xedc8('0x12')]);return _0x552326(_0xdc7113[_0xedc8('0x11')]['message']);}logger[_0xedc8('0x11')](_0xedc8('0xd'),_0x22fed0,_0xdc7113[_0xedc8('0x11')][_0xedc8('0x12')]);return _0x585c5f(_0xdc7113[_0xedc8('0x11')][_0xedc8('0x12')]);}else{logger[_0xedc8('0xc')](_0xedc8('0xd'),_0x22fed0,_0xedc8('0x10'));_0x585c5f(_0xdc7113[_0xedc8('0x13')][_0xedc8('0x12')]);}})['catch'](function(_0x10e5aa){logger['error'](_0xedc8('0xd'),_0x22fed0,_0x10e5aa);_0x552326(_0x10e5aa);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index be68b54..9969a17 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 _0x7bc8=['destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete'];(function(_0x1dce89,_0x5cae59){var _0x5415b4=function(_0x3441b1){while(--_0x3441b1){_0x1dce89['push'](_0x1dce89['shift']());}};_0x5415b4(++_0x5cae59);}(_0x7bc8,0x92));var _0x87bc=function(_0x3bc0da,_0x81d03d){_0x3bc0da=_0x3bc0da-0x0;var _0x5a2547=_0x7bc8[_0x3bc0da];return _0x5a2547;};'use strict';var multer=require(_0x87bc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x87bc('0x1'));var express=require('express');var router=express[_0x87bc('0x2')]();var fs_extra=require(_0x87bc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x87bc('0x4'));var config=require(_0x87bc('0x5'));var controller=require(_0x87bc('0x6'));router[_0x87bc('0x7')]('/',auth[_0x87bc('0x8')](),controller[_0x87bc('0x9')]);router[_0x87bc('0x7')](_0x87bc('0xa'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xb')]);router[_0x87bc('0x7')](_0x87bc('0xc'),auth[_0x87bc('0x8')](),controller['show']);router['post']('/',auth[_0x87bc('0x8')](),controller['create']);router[_0x87bc('0xd')](_0x87bc('0xc'),auth[_0x87bc('0x8')](),controller[_0x87bc('0xe')]);router[_0x87bc('0xf')](_0x87bc('0xc'),auth['isAuthenticated'](),controller[_0x87bc('0x10')]);module[_0x87bc('0x11')]=router; \ No newline at end of file +var _0x2931=['describe','get','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x51494f,_0x305632){var _0x303914=function(_0x50782a){while(--_0x50782a){_0x51494f['push'](_0x51494f['shift']());}};_0x303914(++_0x305632);}(_0x2931,0x171));var _0x1293=function(_0x119c52,_0x3e6189){_0x119c52=_0x119c52-0x0;var _0x547a4e=_0x2931[_0x119c52];return _0x547a4e;};'use strict';var multer=require('multer');var util=require(_0x1293('0x0'));var path=require(_0x1293('0x1'));var timeout=require(_0x1293('0x2'));var express=require(_0x1293('0x3'));var router=express[_0x1293('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1293('0x5'));var interaction=require(_0x1293('0x6'));var config=require(_0x1293('0x7'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x1293('0x8')](),controller[_0x1293('0x9')]);router['get'](_0x1293('0xa'),auth['isAuthenticated'](),controller[_0x1293('0xb')]);router[_0x1293('0xc')](_0x1293('0xd'),auth[_0x1293('0x8')](),controller[_0x1293('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1293('0xf')]);router[_0x1293('0x10')](_0x1293('0xd'),auth[_0x1293('0x8')](),controller['update']);router[_0x1293('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1293('0x12')]);module[_0x1293('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 8a7e7e4..7337ff0 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 _0x702d=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x702d,0x147));var _0xd702=function(_0x4be77c,_0x465d29){_0x4be77c=_0x4be77c-0x0;var _0x1ddbe0=_0x702d[_0x4be77c];return _0x1ddbe0;};'use strict';var Sequelize=require(_0xd702('0x0'));var rs=require(_0xd702('0x1'));module[_0xd702('0x2')]={'name':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xd702('0x3')]},'mapKey':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x4')},'mapKeyOffline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x5')},'customerAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd702('0x3')]},'animation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd702('0x9')](_0xd702('0xa'),_0xd702('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xc')},'start_chat_button':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'header_offline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xf')},'download_transcript':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd702('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x13')},'placeholderMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'skipMessageButton':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'conditionAgreement':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xd702('0x16'),_0xd702('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xd702('0x19'),'helpText':''}},{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xd702('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x1c'))?JSON[_0xd702('0x1d')](this[_0xd702('0x1b')](_0xd702('0x1c'))):{};},'set':function(_0x94c58d){return this[_0xd702('0x1e')](_0xd702('0x1c'),JSON['stringify'](_0x94c58d));}},'offlineForm':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd702('0x4'),'type':_0xd702('0x4')},'variable':null},{'type':_0xd702('0x1f'),'config':{'placeholder':_0xd702('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x21'))?JSON['parse'](this[_0xd702('0x1b')](_0xd702('0x21'))):{};},'set':function(_0xffdb54){return this[_0xd702('0x1e')]('offlineForm',JSON[_0xd702('0x18')](_0xffdb54));}},'token':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return rs[_0xd702('0x22')]();}},'autoclose':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd702('0x3')]},'forwardOffline':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd702('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x24')},'offlineMessageBody':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'sendUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd702('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd702('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return _0xd702('0x25');}},'notificationSound':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x27')},'verticalAlignment':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x28')},'defaultTitle':{'type':Sequelize[_0xd702('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x29')},'systemAvatar':{'type':Sequelize[_0xd702('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd702('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd702('0x2b'),'set':function(_0x239bec){if(!_0x239bec)this[_0xd702('0x1e')](_0xd702('0x2c'),null);this[_0xd702('0x1e')](_0xd702('0x2d'),_0x239bec);}},'vidaooEscalation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd702('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd702('0x2e')},'vidaooNote':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return _0xd702('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xd702('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6c76=['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.','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm'];(function(_0x2a9911,_0x36e22f){var _0x57d2a5=function(_0x5c564e){while(--_0x5c564e){_0x2a9911['push'](_0x2a9911['shift']());}};_0x57d2a5(++_0x36e22f);}(_0x6c76,0x184));var _0x66c7=function(_0x5058e0,_0x178c5a){_0x5058e0=_0x5058e0-0x0;var _0x5a863d=_0x6c76[_0x5058e0];return _0x5a863d;};'use strict';var Sequelize=require(_0x66c7('0x0'));var rs=require(_0x66c7('0x1'));module[_0x66c7('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'unique':_0x66c7('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x66c7('0x5')},'mapKeyOffline':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'defaultValue':_0x66c7('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'defaultValue':_0x66c7('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x66c7('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x66c7('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x66c7('0x9')](_0x66c7('0xa'),_0x66c7('0xb')),'defaultValue':_0x66c7('0xa')},'header_online':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0xc')},'start_chat_button':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0xd')},'header_offline':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0xe')},'download_transcript':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x66c7('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x12')},'noteTitle':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x66c7('0x13')},'closingMessageButton':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x66c7('0x14')},'conditionAgreement':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x66c7('0x15')},'ratingType':{'type':Sequelize[_0x66c7('0x9')](_0x66c7('0x16'),_0x66c7('0x17')),'defaultValue':_0x66c7('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x66c7('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x66c7('0x18')]({'items':[{'type':_0x66c7('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x66c7('0x1a'),'required':!![]},'props':{'title':_0x66c7('0x1b'),'helpText':''}},{'type':_0x66c7('0x19'),'props':{'title':_0x66c7('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x66c7('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x66c7('0x1c')]('onlineForm')?JSON[_0x66c7('0x1d')](this[_0x66c7('0x1c')](_0x66c7('0x1e'))):{};},'set':function(_0x2ef6a2){return this[_0x66c7('0x1f')]('onlineForm',JSON['stringify'](_0x2ef6a2));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x66c7('0x18')]({'items':[{'type':_0x66c7('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x66c7('0x5'),'type':_0x66c7('0x5')},'variable':null},{'type':_0x66c7('0x20'),'config':{'placeholder':_0x66c7('0x21')},'props':{'title':_0x66c7('0x21'),'helpText':_0x66c7('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x66c7('0x23'))?JSON[_0x66c7('0x1d')](this[_0x66c7('0x1c')](_0x66c7('0x23'))):{};},'set':function(_0x2042ea){return this['setDataValue'](_0x66c7('0x23'),JSON['stringify'](_0x2042ea));}},'token':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x66c7('0x3')]},'forwardOffline':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x66c7('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x25')},'offlineMessageBody':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x27')},'skipUnmanaged':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x14')},'sendUnmanaged':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x66c7('0x28')]},'showAgentAvatar':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x66c7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x66c7('0x28')],'defaultValue':function(){return _0x66c7('0x29');}},'notificationSound':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x66c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x2b')},'verticalAlignment':{'type':Sequelize[_0x66c7('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x2c')},'messagesAlignment':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x66c7('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':_0x66c7('0x2e')},'systemAvatar':{'type':Sequelize[_0x66c7('0x28')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x66c7('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![],'comment':_0x66c7('0x30'),'set':function(_0x14d59c){if(!_0x14d59c)this[_0x66c7('0x1f')](_0x66c7('0x31'),null);this[_0x66c7('0x1f')](_0x66c7('0x32'),_0x14d59c);}},'vidaooEscalation':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x66c7('0x3')],'allowNull':![],'defaultValue':_0x66c7('0x33')},'vidaooNote':{'type':Sequelize[_0x66c7('0x3')],'defaultValue':function(){return _0x66c7('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x66c7('0x28')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x66c7('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x66c7('0x28')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e0c0224..2db93eb 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 _0xa70f=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Applications','account','applications','list','orderBy','asc','Contacts','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','interaction','ChatInteraction','spread','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','toPairsIn','mapValues','subjectOffline','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','stringify','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','color_button','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','../../mysqldb','defaults','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','sendStatus','name','send','index','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','show','Pause','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','nolimit','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from'];(function(_0x4b2d64,_0x202ded){var _0x16b037=function(_0x111fa2){while(--_0x111fa2){_0x4b2d64['push'](_0x4b2d64['shift']());}};_0x16b037(++_0x202ded);}(_0xa70f,0xa6));var _0xfa70=function(_0x1cddf6,_0x27b840){_0x1cddf6=_0x1cddf6-0x0;var _0x54ee23=_0xa70f[_0x1cddf6];return _0x54ee23;};'use strict';var BPromise=require(_0xfa70('0x0'));var Mustache=require(_0xfa70('0x1'));var util=require('util');var path=require(_0xfa70('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa70('0x3'));var _=require(_0xfa70('0x4'));var querystring=require('querystring');var Redis=require(_0xfa70('0x5'));var qs=require(_0xfa70('0x6'));var logger=require(_0xfa70('0x7'))('api');var config=require(_0xfa70('0x8'));var url=require(_0xfa70('0x9'));var db=require(_0xfa70('0xa'))['db'];config['redis']=_[_0xfa70('0xb')](config[_0xfa70('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa70('0xc')]));require(_0xfa70('0xd'))[_0xfa70('0xe')](socket);var htmlToText=require(_0xfa70('0xf'));var jayson=require(_0xfa70('0x10'));var client=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x232c});var client9002=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x232a});var client9003=jayson['client'][_0xfa70('0x12')]({'port':0x232b});var client9001=jayson[_0xfa70('0x11')][_0xfa70('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x4bf1c8,_0x929163,_0x3f8f61,_0x430401){return new BPromise(function(_0x185029,_0x50bcb2){var _0x57a8dc=_0x430401||client;return _0x57a8dc['request'](_0x4bf1c8,_0x3f8f61)['then'](function(_0x58da67){logger[_0xfa70('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x929163,_0xfa70('0x14'));logger[_0xfa70('0x15')](_0xfa70('0x16'),_0x929163,_0xfa70('0x14'),JSON['stringify'](_0x58da67));if(_0x58da67[_0xfa70('0x17')]){if(_0x58da67['error'][_0xfa70('0x18')]===0x1f4){logger[_0xfa70('0x17')](_0xfa70('0x19'),_0x929163,_0x58da67['error'][_0xfa70('0x1a')]);return _0x50bcb2(_0x58da67[_0xfa70('0x17')]['message']);}logger[_0xfa70('0x17')](_0xfa70('0x19'),_0x929163,_0x58da67[_0xfa70('0x17')][_0xfa70('0x1a')]);return _0x185029(_0x58da67[_0xfa70('0x17')][_0xfa70('0x1a')]);}else{logger['info'](_0xfa70('0x19'),_0x929163,_0xfa70('0x14'));_0x185029(_0x58da67[_0xfa70('0x1b')][_0xfa70('0x1a')]);}})[_0xfa70('0x1c')](function(_0x3544ac){logger[_0xfa70('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x929163,_0x3544ac);_0x50bcb2(_0x3544ac);});});}function respondWithStatusCode(_0x2998ed,_0x3b4196){_0x3b4196=_0x3b4196||0xcc;return function(_0x58d56d){if(_0x58d56d){return _0x2998ed['sendStatus'](_0x3b4196);}return _0x2998ed[_0xfa70('0x1d')](_0x3b4196)[_0xfa70('0x1e')]();};}function respondWithResult(_0x2b56bc,_0x78c835){_0x78c835=_0x78c835||0xc8;return function(_0x46f8c1){if(_0x46f8c1){return _0x2b56bc[_0xfa70('0x1d')](_0x78c835)[_0xfa70('0x1f')](_0x46f8c1);}};}function respondWithFilteredResult(_0x19d1f5,_0x25307f){return function(_0x11ccac){if(_0x11ccac){var _0x46a54b=typeof _0x25307f[_0xfa70('0x20')]===_0xfa70('0x21')&&typeof _0x25307f[_0xfa70('0x22')]===_0xfa70('0x21');var _0x113ece=_0x11ccac[_0xfa70('0x23')];var _0x414f9a=_0x46a54b?0x0:_0x25307f[_0xfa70('0x20')];var _0x48b443=_0x46a54b?_0x11ccac[_0xfa70('0x23')]:_0x25307f[_0xfa70('0x20')]+_0x25307f[_0xfa70('0x22')];var _0x103fd2;if(_0x48b443>=_0x113ece){_0x48b443=_0x113ece;_0x103fd2=0xc8;}else{_0x103fd2=0xce;}_0x19d1f5['status'](_0x103fd2);return _0x19d1f5[_0xfa70('0x24')]('Content-Range',_0x414f9a+'-'+_0x48b443+'/'+_0x113ece)[_0xfa70('0x1f')](_0x11ccac);}return null;};}function saveUpdates(_0x13f95c){return function(_0x3c7eef){if(_0x3c7eef){return _0x3c7eef[_0xfa70('0x25')](_0x13f95c)[_0xfa70('0x26')](function(_0x37550e){return _0x37550e;});}return null;};}function removeEntity(_0x48cc89){return function(_0x59eeb6){if(_0x59eeb6){return _0x59eeb6[_0xfa70('0x27')]()[_0xfa70('0x26')](function(){var _0x202443=_0x59eeb6[_0xfa70('0x28')]({'plain':!![]});var _0x5beb2b='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x5beb2b,'resourceId':_0x202443['id']}})[_0xfa70('0x26')](function(){return _0x59eeb6;});})[_0xfa70('0x26')](function(){_0x48cc89[_0xfa70('0x1d')](0xcc)[_0xfa70('0x1e')]();});}};}function handleEntityNotFound(_0x5d9a72){return function(_0x3286d3){if(!_0x3286d3){_0x5d9a72[_0xfa70('0x29')](0x194);}return _0x3286d3;};}function handleError(_0x288ebc,_0x4b03f3){_0x4b03f3=_0x4b03f3||0x1f4;return function(_0x950669){logger[_0xfa70('0x17')](_0x950669['stack']);if(_0x950669[_0xfa70('0x2a')]){delete _0x950669[_0xfa70('0x2a')];}_0x288ebc[_0xfa70('0x1d')](_0x4b03f3)[_0xfa70('0x2b')](_0x950669);};}exports[_0xfa70('0x2c')]=function(_0x2fb66f,_0x536d5f){var _0x50d89e={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5387f3={},_0x112306={'count':0x0,'rows':[]};var _0x19d3d7=_[_0xfa70('0x2d')](db[_0xfa70('0x2e')][_0xfa70('0x2f')],function(_0x964668){return{'name':_0x964668[_0xfa70('0x30')],'type':_0x964668['type'][_0xfa70('0x31')]};});_0x5387f3[_0xfa70('0x32')]=_[_0xfa70('0x2d')](_0x19d3d7,_0xfa70('0x2a'));_0x5387f3[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x2fb66f[_0xfa70('0x33')]);_0x5387f3['filters']=_[_0xfa70('0x35')](_0x5387f3[_0xfa70('0x32')],_0x5387f3[_0xfa70('0x33')]);_0x50d89e['attributes']=_[_0xfa70('0x35')](_0x5387f3[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x36')]));_0x50d89e[_0xfa70('0x37')]=_0x50d89e[_0xfa70('0x37')][_0xfa70('0x38')]?_0x50d89e[_0xfa70('0x37')]:_0x5387f3[_0xfa70('0x32')];if(!_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x39')]('nolimit')){_0x50d89e[_0xfa70('0x22')]=qs['limit'](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x22')]);_0x50d89e[_0xfa70('0x20')]=qs['offset'](_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x20')]);}_0x50d89e[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x2fb66f[_0xfa70('0x33')]['sort']);_0x50d89e[_0xfa70('0x3c')]=qs['filters'](_[_0xfa70('0x3d')](_0x2fb66f[_0xfa70('0x33')],_0x5387f3[_0xfa70('0x3e')]),_0x19d3d7);if(_0x2fb66f[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x50d89e[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x50d89e[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x19d3d7,function(_0x481293){if(_0x481293['type']!==_0xfa70('0x41')){var _0x5dea56={};_0x5dea56[_0x481293['name']]={'$like':'%'+_0x2fb66f['query'][_0xfa70('0x3f')]+'%'};return _0x5dea56;}})});}_0x50d89e=_['merge']({},_0x50d89e,_0x2fb66f[_0xfa70('0x42')]);var _0x88ae20={'where':_0x50d89e[_0xfa70('0x3c')]};return db[_0xfa70('0x2e')][_0xfa70('0x23')](_0x88ae20)[_0xfa70('0x26')](function(_0x4de4fa){_0x112306[_0xfa70('0x23')]=_0x4de4fa;if(_0x2fb66f[_0xfa70('0x33')]['includeAll']){_0x50d89e[_0xfa70('0x43')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x50d89e);})[_0xfa70('0x26')](function(_0x14392a){_0x112306[_0xfa70('0x44')]=_0x14392a;return _0x112306;})[_0xfa70('0x26')](respondWithFilteredResult(_0x536d5f,_0x50d89e))[_0xfa70('0x1c')](handleError(_0x536d5f,null));};exports[_0xfa70('0x45')]=function(_0xd533a9,_0x27ff75){var _0x2a88d0={'raw':![],'where':{'id':_0xd533a9['params']['id']},'include':[{'model':db[_0xfa70('0x46')],'as':_0xfa70('0x47')}]},_0x325e1b={};_0x325e1b[_0xfa70('0x32')]=_[_0xfa70('0x34')](db['ChatWebsite'][_0xfa70('0x2f')]);_0x325e1b['query']=_[_0xfa70('0x34')](_0xd533a9['query']);_0x325e1b[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x325e1b[_0xfa70('0x32')],_0x325e1b[_0xfa70('0x33')]);_0x2a88d0[_0xfa70('0x37')]=_['intersection'](_0x325e1b['model'],qs[_0xfa70('0x36')](_0xd533a9['query'][_0xfa70('0x36')]));_0x2a88d0[_0xfa70('0x37')]=_0x2a88d0['attributes'][_0xfa70('0x38')]?_0x2a88d0[_0xfa70('0x37')]:_0x325e1b[_0xfa70('0x32')];if(_0xd533a9[_0xfa70('0x33')][_0xfa70('0x48')]){_0x2a88d0[_0xfa70('0x43')]=[{'all':!![]}];}_0x2a88d0=_[_0xfa70('0x40')]({},_0x2a88d0,_0xd533a9[_0xfa70('0x42')]);return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x2a88d0)[_0xfa70('0x26')](handleEntityNotFound(_0x27ff75,null))[_0xfa70('0x26')](respondWithResult(_0x27ff75,null))[_0xfa70('0x1c')](handleError(_0x27ff75,null));};exports['create']=function(_0x3ec32b,_0x58ca02){return db[_0xfa70('0x2e')][_0xfa70('0x4a')](_0x3ec32b[_0xfa70('0x4b')],{})['then'](function(_0x215627){var _0x1ce21e=_0x3ec32b[_0xfa70('0x4c')]['get']({'plain':!![]});if(!_0x1ce21e)throw new Error(_0xfa70('0x4d'));if(_0x1ce21e[_0xfa70('0x4e')]===_0xfa70('0x4c')){var _0x15765f=_0x215627[_0xfa70('0x28')]({'plain':!![]});var _0x18a8e1=_0xfa70('0x4f');return db[_0xfa70('0x50')][_0xfa70('0x49')]({'where':{'name':_0x18a8e1,'userProfileId':_0x1ce21e[_0xfa70('0x51')]},'raw':!![]})[_0xfa70('0x26')](function(_0x4b9a84){if(_0x4b9a84&&_0x4b9a84['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x15765f[_0xfa70('0x2a')],'resourceId':_0x15765f['id'],'type':_0x4b9a84['name'],'sectionId':_0x4b9a84['id']},{})['then'](function(){return _0x215627;});}else{return _0x215627;}})[_0xfa70('0x1c')](function(_0x117e19){logger[_0xfa70('0x17')](_0xfa70('0x52'),_0x117e19);throw _0x117e19;});}return _0x215627;})[_0xfa70('0x26')](respondWithResult(_0x58ca02,0xc9))[_0xfa70('0x1c')](handleError(_0x58ca02,null));};exports[_0xfa70('0x25')]=function(_0xc0ccee,_0x969ed1){if(_0xc0ccee['body']['id']){delete _0xc0ccee[_0xfa70('0x4b')]['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0xc0ccee['params']['id']},'include':[{'model':db[_0xfa70('0x46')],'as':'mandatoryDispositionPause'}]})[_0xfa70('0x26')](handleEntityNotFound(_0x969ed1,null))['then'](saveUpdates(_0xc0ccee[_0xfa70('0x4b')],null))['then'](respondWithResult(_0x969ed1,null))['catch'](handleError(_0x969ed1,null));};exports[_0xfa70('0x27')]=function(_0x3dfc85,_0x1848d8){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x3dfc85[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x1848d8,null))[_0xfa70('0x26')](removeEntity(_0x1848d8,null))[_0xfa70('0x1c')](handleError(_0x1848d8,null));};exports[_0xfa70('0x54')]=function(_0x182f58,_0x796bf9){return db[_0xfa70('0x2e')]['describe']()[_0xfa70('0x26')](respondWithResult(_0x796bf9,null))[_0xfa70('0x1c')](handleError(_0x796bf9,null));};exports[_0xfa70('0x55')]=function(_0x44308e,_0xa8a502){if(_0x44308e[_0xfa70('0x4b')]['id']){delete _0x44308e['body']['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x44308e['params']['id']}})['then'](handleEntityNotFound(_0xa8a502,null))[_0xfa70('0x26')](function(_0x5f35e7){if(_0x5f35e7){_0x44308e['body'][_0xfa70('0x56')]=_0x5f35e7['id'];return db['Disposition'][_0xfa70('0x4a')](_0x44308e[_0xfa70('0x4b')]);}})[_0xfa70('0x26')](respondWithResult(_0xa8a502,null))['catch'](handleError(_0xa8a502,null));};exports[_0xfa70('0x57')]=function(_0x2854c0,_0x5ba27e){var _0x315713={'raw':![],'where':{}};var _0x256f1d={};var _0x51dc0e={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x2854c0[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5ba27e,null))[_0xfa70('0x26')](function(_0x2c9a66){if(_0x2c9a66){_0x256f1d[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x58')][_0xfa70('0x2f')]);_0x256f1d[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x2854c0['query']);_0x256f1d[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x256f1d[_0xfa70('0x32')],_0x256f1d[_0xfa70('0x33')]);_0x315713[_0xfa70('0x37')]=_['intersection'](_0x256f1d[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x2854c0[_0xfa70('0x33')][_0xfa70('0x36')]));_0x315713[_0xfa70('0x37')]=_0x315713['attributes'][_0xfa70('0x38')]?_0x315713[_0xfa70('0x37')]:_0x256f1d[_0xfa70('0x32')];if(!_0x2854c0['query'][_0xfa70('0x39')]('nolimit')){_0x315713['limit']=qs[_0xfa70('0x22')](_0x2854c0[_0xfa70('0x33')][_0xfa70('0x22')]);_0x315713['offset']=qs[_0xfa70('0x20')](_0x2854c0[_0xfa70('0x33')]['offset']);}_0x315713[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x2854c0[_0xfa70('0x33')]['sort']);_0x315713[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x2854c0['query'],_0x256f1d['filters']));_0x315713['where']['ChatWebsiteId']=_0x2c9a66['id'];if(_0x2854c0[_0xfa70('0x33')]['filter']){_0x315713[_0xfa70('0x3c')]=_['merge'](_0x315713[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x315713[_0xfa70('0x37')],function(_0x51711e){var _0x1e2164={};_0x1e2164[_0x51711e]={'$like':'%'+_0x2854c0[_0xfa70('0x33')]['filter']+'%'};return _0x1e2164;})});}_0x315713=_[_0xfa70('0x40')]({},_0x315713,_0x2854c0[_0xfa70('0x42')]);return db['Disposition'][_0xfa70('0x23')]({'where':_0x315713['where']})[_0xfa70('0x26')](function(_0x2042e4){_0x51dc0e[_0xfa70('0x23')]=_0x2042e4;if(_0x2854c0[_0xfa70('0x33')][_0xfa70('0x48')]){_0x315713['include']=[{'all':!![]}];}return db[_0xfa70('0x58')][_0xfa70('0x59')](_0x315713);})[_0xfa70('0x26')](function(_0x2cdfb5){_0x51dc0e[_0xfa70('0x44')]=_0x2cdfb5;return _0x51dc0e;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x5ba27e,_0x315713))['catch'](handleError(_0x5ba27e,null));};exports['removeDispositions']=function(_0x5d7620,_0x4f78b6){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x5d7620[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f78b6,null))[_0xfa70('0x26')](function(_0x125082){if(_0x125082){return _0x125082[_0xfa70('0x5a')](_0x5d7620[_0xfa70('0x33')][_0xfa70('0x5b')]);}})[_0xfa70('0x26')](respondWithStatusCode(_0x4f78b6,null))[_0xfa70('0x1c')](handleError(_0x4f78b6,null));};exports['addAnswer']=function(_0x4f98b7,_0x40b4b6){if(_0x4f98b7['body']['id']){delete _0x4f98b7[_0xfa70('0x4b')]['id'];}return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4f98b7[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x40b4b6,null))[_0xfa70('0x26')](function(_0x596d1b){if(_0x596d1b){_0x4f98b7[_0xfa70('0x4b')][_0xfa70('0x56')]=_0x596d1b['id'];return db['CannedAnswer'][_0xfa70('0x4a')](_0x4f98b7['body']);}})[_0xfa70('0x26')](respondWithResult(_0x40b4b6,null))[_0xfa70('0x1c')](handleError(_0x40b4b6,null));};exports[_0xfa70('0x5c')]=function(_0x49dca1,_0x3619c5){var _0x483e67={'raw':![],'where':{}};var _0x4bb3f1={};var _0x3732d5={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x49dca1[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x3619c5,null))[_0xfa70('0x26')](function(_0x45bd75){if(_0x45bd75){_0x4bb3f1[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x5e')]['rawAttributes']);_0x4bb3f1[_0xfa70('0x33')]=_['keys'](_0x49dca1[_0xfa70('0x33')]);_0x4bb3f1[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x4bb3f1[_0xfa70('0x32')],_0x4bb3f1[_0xfa70('0x33')]);_0x483e67['attributes']=_[_0xfa70('0x35')](_0x4bb3f1['model'],qs[_0xfa70('0x36')](_0x49dca1[_0xfa70('0x33')][_0xfa70('0x36')]));_0x483e67[_0xfa70('0x37')]=_0x483e67[_0xfa70('0x37')][_0xfa70('0x38')]?_0x483e67[_0xfa70('0x37')]:_0x4bb3f1[_0xfa70('0x32')];if(!_0x49dca1['query']['hasOwnProperty'](_0xfa70('0x5f'))){_0x483e67[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x49dca1[_0xfa70('0x33')][_0xfa70('0x22')]);_0x483e67['offset']=qs[_0xfa70('0x20')](_0x49dca1['query'][_0xfa70('0x20')]);}_0x483e67[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x49dca1[_0xfa70('0x33')]['sort']);_0x483e67['where']=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x49dca1[_0xfa70('0x33')],_0x4bb3f1['filters']));_0x483e67[_0xfa70('0x3c')][_0xfa70('0x56')]=_0x45bd75['id'];if(_0x49dca1[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x483e67[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x483e67[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x483e67[_0xfa70('0x37')],function(_0x47f56d){var _0x5d3361={};_0x5d3361[_0x47f56d]={'$like':'%'+_0x49dca1[_0xfa70('0x33')]['filter']+'%'};return _0x5d3361;})});}_0x483e67=_[_0xfa70('0x40')]({},_0x483e67,_0x49dca1[_0xfa70('0x42')]);return db['CannedAnswer']['count']({'where':_0x483e67['where']})[_0xfa70('0x26')](function(_0x2e9e47){_0x3732d5[_0xfa70('0x23')]=_0x2e9e47;if(_0x49dca1[_0xfa70('0x33')][_0xfa70('0x48')]){_0x483e67[_0xfa70('0x43')]=[{'all':!![]}];}return db[_0xfa70('0x5e')][_0xfa70('0x59')](_0x483e67);})[_0xfa70('0x26')](function(_0x207b27){_0x3732d5[_0xfa70('0x44')]=_0x207b27;return _0x3732d5;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x3619c5,_0x483e67))[_0xfa70('0x1c')](handleError(_0x3619c5,null));};exports[_0xfa70('0x60')]=function(_0x5524e2,_0x46a48c){return db[_0xfa70('0x2e')]['find']({'where':{'id':_0x5524e2['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x46a48c,null))[_0xfa70('0x26')](function(_0x3b6b9a){if(_0x3b6b9a){return _0x3b6b9a[_0xfa70('0x60')](_0x5524e2[_0xfa70('0x33')][_0xfa70('0x5b')]);}})[_0xfa70('0x26')](respondWithStatusCode(_0x46a48c,null))[_0xfa70('0x1c')](handleError(_0x46a48c,null));};exports[_0xfa70('0x61')]=function(_0x4aa72b,_0x37b35f){_0x4aa72b[_0xfa70('0x4b')][_0xfa70('0x62')]=_0x4aa72b['file'][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4aa72b['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x37b35f,null))['then'](saveUpdates(_0x4aa72b[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x37b35f,null))[_0xfa70('0x1c')](handleError(_0x37b35f,null));};exports[_0xfa70('0x64')]=function(_0x16136d,_0x3625b9){_0x16136d[_0xfa70('0x4b')][_0xfa70('0x65')]=_0x16136d['file'][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x16136d[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x3625b9,null))['then'](saveUpdates(_0x16136d['body'],null))[_0xfa70('0x26')](respondWithResult(_0x3625b9,null))[_0xfa70('0x1c')](handleError(_0x3625b9,null));};exports[_0xfa70('0x66')]=function(_0x4cadf0,_0x93a349){_0x4cadf0[_0xfa70('0x4b')][_0xfa70('0x67')]=_0x4cadf0[_0xfa70('0x68')][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4cadf0[_0xfa70('0x53')]['id']}})['then'](handleEntityNotFound(_0x93a349,null))['then'](saveUpdates(_0x4cadf0[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x93a349,null))['catch'](handleError(_0x93a349,null));};exports[_0xfa70('0x69')]=function(_0x2ff938,_0x2d3ef3){_0x2ff938['body']['systemAvatar']=_0x2ff938[_0xfa70('0x68')][_0xfa70('0x63')];return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x2ff938[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x2d3ef3,null))[_0xfa70('0x26')](saveUpdates(_0x2ff938[_0xfa70('0x4b')],null))[_0xfa70('0x26')](respondWithResult(_0x2d3ef3,null))['catch'](handleError(_0x2d3ef3,null));};exports['getLogo']=function(_0x237ce4,_0x497945){var _0x178143=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x6c'));var _0xdc557f={'where':{'id':_0x237ce4['params']['id']},'attributes':['id',_0xfa70('0x62')],'raw':!![]};var _0x468041=![];return require(_0xfa70('0x6d'))['getLicense']()[_0xfa70('0x26')](function(_0xb3567d){if(_0xb3567d){_0x468041=_0xb3567d[_0xfa70('0x6e')];}})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')]['find'](_0xdc557f);})['then'](handleEntityNotFound(_0x497945,null))[_0xfa70('0x26')](function(_0x101d61){if(_0x101d61){if(!_['isNil'](_0x101d61['sitepic'])){if(fs[_0xfa70('0x6f')](path[_0xfa70('0x6a')](config['root'],_0xfa70('0x70'),_0x101d61[_0xfa70('0x62')]))&&_0x468041){_0x178143=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x70'),_0x101d61[_0xfa70('0x62')]);}}return _0x497945[_0xfa70('0x71')](_0x178143);}})[_0xfa70('0x1c')](handleError(_0x497945,null));};exports[_0xfa70('0x72')]=function(_0x394f15,_0x2c0c7c){var _0x2da734=path[_0xfa70('0x6a')](config['root'],_0xfa70('0x73'));var _0x4e146b={'where':{'id':_0x394f15[_0xfa70('0x53')]['id']},'attributes':['id',_0xfa70('0x65')],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x4e146b)[_0xfa70('0x26')](handleEntityNotFound(_0x2c0c7c,null))[_0xfa70('0x26')](function(_0x701ef9){if(_0x701ef9){if(!_[_0xfa70('0x74')](_0x701ef9[_0xfa70('0x65')])){if(fs[_0xfa70('0x6f')](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x701ef9['agentAvatar']))){_0x2da734=path[_0xfa70('0x6a')](config['root'],'server/files/images/avatars/',_0x701ef9[_0xfa70('0x65')]);}}return _0x2c0c7c['download'](_0x2da734);}})[_0xfa70('0x1c')](handleError(_0x2c0c7c,null));};exports[_0xfa70('0x76')]=function(_0x356342,_0x5ea107){var _0x59fcc4=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x77'));var _0x3123d7={'where':{'id':_0x356342[_0xfa70('0x53')]['id']},'attributes':['id',_0xfa70('0x67'),_0xfa70('0x78')],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x3123d7)[_0xfa70('0x26')](handleEntityNotFound(_0x5ea107,null))[_0xfa70('0x26')](function(_0x3fc015){if(_0x3fc015){if(!_[_0xfa70('0x74')](_0x3fc015[_0xfa70('0x67')])){if(fs[_0xfa70('0x6f')](path['join'](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x3fc015[_0xfa70('0x67')]))&&_0x3fc015[_0xfa70('0x78')]){_0x59fcc4=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],'server/files/images/avatars/',_0x3fc015[_0xfa70('0x67')]);}}return _0x5ea107['download'](_0x59fcc4);}})['catch'](handleError(_0x5ea107,null));};exports[_0xfa70('0x79')]=function(_0x3a8477,_0x5f4f89){var _0x568a4b=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x7a'));var _0x580d3b={'where':{'id':_0x3a8477[_0xfa70('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xfa70('0x2e')][_0xfa70('0x49')](_0x580d3b)[_0xfa70('0x26')](handleEntityNotFound(_0x5f4f89,null))[_0xfa70('0x26')](function(_0x5403cd){if(_0x5403cd){if(!_[_0xfa70('0x74')](_0x5403cd[_0xfa70('0x7b')])){if(fs['existsSync'](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0x75'),_0x5403cd[_0xfa70('0x7b')]))){_0x568a4b=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],'server/files/images/avatars/',_0x5403cd[_0xfa70('0x7b')]);}}return _0x5f4f89[_0xfa70('0x71')](_0x568a4b);}})[_0xfa70('0x1c')](handleError(_0x5f4f89,null));};exports['notify']=function(_0x4d1789,_0x475e49){var _0xb589=require(_0xfa70('0x7c'));var _0x58bd7b=new _0xb589();var _0x2faa7d=_0x58bd7b[_0xfa70('0x7d')](_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x7f')])[_0xfa70('0x80')]();var _0x3f6c27={'body':_0x4d1789[_0xfa70('0x4b')],'channel':_0xfa70('0x81')};var _0x2872a4=[];var _0x75b8db=[];var _0x28c0fb={};var _0x510350=![];return db[_0xfa70('0x82')][_0xfa70('0x54')]()[_0xfa70('0x26')](function(_0x421a7a){if(!_0x421a7a){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x85'));}_0x2872a4=_['difference'](_[_0xfa70('0x34')](_0x421a7a),[_0xfa70('0x86'),_0xfa70('0x87')]);_0x75b8db=_[_0xfa70('0x88')](_[_0xfa70('0x34')](_0x421a7a),[_0xfa70('0x86'),'updatedAt',_0xfa70('0x89'),_0xfa70('0x8a')]);if(_0x4d1789[_0xfa70('0x4b')]['id']){delete _0x4d1789['body']['id'];}if(_['isNil'](_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))]('from\x20is\x20mandatory');}if(_[_0xfa70('0x74')](_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x4b')])||_0x4d1789['body'][_0xfa70('0x4b')]===''){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8c'));}if(_[_0xfa70('0x74')](_0x4d1789['body'][_0xfa70('0x8d')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x75b8db);}if(!_[_0xfa70('0x8e')](_0x75b8db,_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8d')])){throw new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8f')+_0x75b8db);}_0x28c0fb[_0x4d1789[_0xfa70('0x4b')]['mapKey']]=_0x4d1789[_0xfa70('0x4b')]['from'];})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x4d1789['params']['id']},'include':[{'model':db[_0xfa70('0x90')],'as':_0xfa70('0x91'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x28c0fb,'limit':0x1,'order':[[_0xfa70('0x87'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xfa70('0x92')}]});})['then'](handleEntityNotFound(_0x475e49,null))[_0xfa70('0x26')](function(_0x326883){if(_0x326883&&_0x326883[_0xfa70('0x91')]){_0x3f6c27[_0xfa70('0x93')]=_0x326883;_0x3f6c27[_0xfa70('0x94')]=_0x326883['Applications'];_0x3f6c27[_0xfa70('0x95')]=_0x326883[_0xfa70('0x91')];_0x3f6c27[_0xfa70('0x94')]=_[_0xfa70('0x96')](_0x3f6c27[_0xfa70('0x94')],['priority'],[_0xfa70('0x97')]);if(_0x3f6c27['account'][_0xfa70('0x92')]){delete _0x3f6c27['account'][_0xfa70('0x92')];}if(_0x3f6c27[_0xfa70('0x93')]['List']&&_0x3f6c27[_0xfa70('0x93')][_0xfa70('0x91')][_0xfa70('0x98')][_0xfa70('0x38')]){return _0x3f6c27[_0xfa70('0x93')]['List'][_0xfa70('0x98')][0x0];}var _0x29e438=_[_0xfa70('0xb')](_0x4d1789[_0xfa70('0x4b')],{'firstName':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')],'ListId':_0x326883['ListId']});_0x29e438[_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8d')]]=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x8b')];return db[_0xfa70('0x82')][_0xfa70('0x4a')](_0x29e438,{'fields':_0x2872a4,'raw':!![]});}})[_0xfa70('0x26')](handleEntityNotFound(_0x475e49,null))[_0xfa70('0x26')](function(_0x590cd0){_0x3f6c27[_0xfa70('0x99')]=_0x590cd0;var _0x43c826=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x9a')];if(_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9b')]){_0x43c826=_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9b')];}else if(_0x4d1789['headers']['x-forwarded-for']){_0x43c826=_[_0xfa70('0x9c')](_0x4d1789[_0xfa70('0x7e')][_0xfa70('0x9d')][_0xfa70('0x9e')](','));}if(_0x590cd0){var _0x27fcc6={'ContactId':_0x590cd0['id'],'ChatWebsiteId':_0x4d1789['params']['id'],'from':(_0x590cd0[_0xfa70('0x9f')]||'')+'\x20'+(_0x590cd0[_0xfa70('0xa0')]||''),'customerIp':_0x43c826,'customerPort':_0x4d1789[_0xfa70('0x7e')][_0xfa70('0xa1')]?_0x4d1789['headers'][_0xfa70('0xa1')]:null,'referer':_0x4d1789['body'][_0xfa70('0xa2')],'browserName':_0x2faa7d['browser']['name']&&_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]?util[_0xfa70('0xa5')](_0xfa70('0xa6'),_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0x2a')],_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]):_0xfa70('0xa7'),'browserVersion':_0x2faa7d[_0xfa70('0xa3')][_0xfa70('0xa4')]||_0xfa70('0xa7'),'osName':util['format'](_0xfa70('0xa6'),_0x2faa7d['os'][_0xfa70('0x2a')],_0x2faa7d['os'][_0xfa70('0xa4')]),'osVersion':_0x2faa7d['os'][_0xfa70('0xa4')],'deviceModel':_0x2faa7d[_0xfa70('0xa8')]['model']&&_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')]?util[_0xfa70('0xa5')](_0xfa70('0xaa'),_0x2faa7d['device']['model'],_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')],_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xab')]):null,'deviceVendor':_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xa9')],'deviceType':_0x2faa7d[_0xfa70('0xa8')][_0xfa70('0xab')],'formData':JSON['stringify'](_0x4d1789[_0xfa70('0x4b')])};var _0x2ef4b1={'ChatWebsiteId':_0x4d1789[_0xfa70('0x53')]['id'],'closed':![]};if(_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]){_0x2ef4b1[_0xfa70('0xac')]=_0x4d1789['body']['threadId'];return db['ChatInteraction'][_0xfa70('0x49')]({'where':_0x2ef4b1})[_0xfa70('0x26')](function(_0x5e33f2){if(_0x5e33f2){return[_0x5e33f2,![]];}_0x27fcc6[_0xfa70('0xac')]=_0x4d1789['body']['threadId'];_0x27fcc6[_0xfa70('0xad')]=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xad')];return db['ChatInteraction'][_0xfa70('0x4a')](_0x27fcc6)[_0xfa70('0x26')](function(_0xc3c3b8){return[_0xc3c3b8,!![]];});});}_0x2ef4b1['ContactId']=_0x590cd0['id'];if(_0x4d1789['body'][_0xfa70('0xae')]&&_0x4d1789['body']['interaction']['id']){_0x2ef4b1['id']=_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xae')]['id'];return db[_0xfa70('0xaf')][_0xfa70('0x49')]({'where':_0x2ef4b1})[_0xfa70('0x26')](function(_0x9373f2){if(_0x9373f2){return[_0x9373f2,![]];}return db['ChatInteraction']['create'](_0x27fcc6)['then'](function(_0x2ad53a){return[_0x2ad53a,!![]];});});}return db[_0xfa70('0xaf')]['create'](_0x27fcc6)[_0xfa70('0x26')](function(_0xa94a88){return[_0xa94a88,!![]];});}})[_0xfa70('0xb0')](function(_0x4d15a0,_0x56c9cc){if(_0x4d15a0){_0x510350=_0x56c9cc;if(!_0x56c9cc){var _0x5bf7fd={'from':(_0x3f6c27[_0xfa70('0x99')]['firstName']||'')+'\x20'+(_0x3f6c27[_0xfa70('0x99')][_0xfa70('0xa0')]||'')};if(_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]&&_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xb1')]&&_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xac')]!=_0x4d1789['body'][_0xfa70('0xb1')]){_0x5bf7fd[_0xfa70('0xac')]=_0x4d1789[_0xfa70('0x4b')]['messageId'];}return _0x4d15a0[_0xfa70('0x25')](_0x5bf7fd);}else{return _0x4d15a0;}}})[_0xfa70('0x26')](function(_0x3b80d6){_0x3f6c27[_0xfa70('0xae')]=_0x3b80d6[_0xfa70('0x28')]({'plain':!![]});_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb2')]=_0x510350;if(_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb2')]){if(_0x3f6c27[_0xfa70('0x93')]['autoclose']){_0x3f6c27[_0xfa70('0x94')][_0xfa70('0xb3')]({'id':0x0,'priority':_0x3f6c27['applications']['length']+0x1,'app':'close','appdata':_0xfa70('0xb4'),'interval':_0xfa70('0xb5')});}}return db[_0xfa70('0xb6')]['create']({'body':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0x4b')],'ChatWebsiteId':_0x4d1789['params']['id'],'ChatInteractionId':_0x3b80d6['id'],'direction':'in','ContactId':_0x3f6c27['contact']['id'],'AttachmentId':_0x4d1789[_0xfa70('0x4b')][_0xfa70('0xb7')]});})[_0xfa70('0x26')](function(_0x470608){_0x3f6c27[_0xfa70('0x1a')]=_0x470608;if(_0x3f6c27[_0xfa70('0xae')][_0xfa70('0xb8')]){return db[_0xfa70('0xb9')][_0xfa70('0x49')]({'attributes':['id',_0xfa70('0x2a')],'where':{'id':_0x3f6c27[_0xfa70('0xae')]['UserId']}})[_0xfa70('0x26')](function(_0x455f7f){if(_0x455f7f){_0x3f6c27['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x455f7f[_0xfa70('0x2a')]+','+(_0x3f6c27[_0xfa70('0x93')][_0xfa70('0xba')]||0xa),'interval':_0xfa70('0xb5')});_0x3f6c27['forcedOwnership']=!![];}return respondWithRpcPromise(_0xfa70('0xbb'),_0xfa70('0xbc'),_0x3f6c27);});}return respondWithRpcPromise('Start',_0xfa70('0xbc'),_0x3f6c27);})['then'](function(_0x517a2a){respondWithRpcPromise(_0xfa70('0xbd'),_0xfa70('0xbd'),{'event':_0xfa70('0xbe'),'message':_0x517a2a},client9002);return _0x517a2a;})[_0xfa70('0x26')](respondWithResult(_0x475e49,null))[_0xfa70('0x1c')](handleError(_0x475e49,null));};exports[_0xfa70('0xbf')]=function(_0x3cb410,_0x4d85ae){var _0x1efda4,_0x124083,_0x1bf8f6;var _0x3333b2=[];var _0x1bef11={};var _0x3cfc60=_0x3cb410['files']||[];var _0x1e49d5=[];var _0x4bd01f;return db[_0xfa70('0x82')][_0xfa70('0x54')]()['then'](function(_0x267248){if(!_0x267248){throw new db['Sequelize'][(_0xfa70('0x84'))](_0xfa70('0x85'));}_0x3333b2=_[_0xfa70('0x88')](_[_0xfa70('0x34')](_0x267248),[_0xfa70('0x86'),_0xfa70('0x87'),'CompanyId','ListId']);if(_0x3cb410[_0xfa70('0x4b')]['id']){delete _0x3cb410['body']['id'];}if(_[_0xfa70('0x74')](_0x3cb410[_0xfa70('0x4b')]['from'])){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0xc0')));}if(_[_0xfa70('0x74')](_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x4b')])||_0x3cb410['body'][_0xfa70('0x4b')]===''){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0x8c')));}if(_['isNil'](_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')])){throw _0x4d85ae[_0xfa70('0x1d')](0x1f4)['send'](new db['Sequelize'][(_0xfa70('0x84'))](_0xfa70('0xc2')+_0x3333b2));}if(!_[_0xfa70('0x8e')](_0x3333b2,_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')])){throw _0x4d85ae['status'](0x1f4)[_0xfa70('0x2b')](new db[(_0xfa70('0x83'))][(_0xfa70('0x84'))](_0xfa70('0xc3')+_0x3333b2));}_0x1bef11[_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')]]=_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')];})[_0xfa70('0x26')](function(){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0x3cb410[_0xfa70('0x53')]['id']},'include':[{'model':db[_0xfa70('0x90')],'as':_0xfa70('0x91')},{'model':db[_0xfa70('0xc4')],'as':_0xfa70('0xc4')}]});})['then'](handleEntityNotFound(_0x4d85ae,null))[_0xfa70('0x26')](function(_0x1def23){if(_0x1def23&&_0x1def23['List']){_0x124083=_0x1def23;var _0x3bb6c8=_[_0xfa70('0xb')](_0x3cb410[_0xfa70('0x4b')],{'firstName':_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')],'phone':_0x3cb410[_0xfa70('0x4b')]['from'],'ListId':_0x1def23[_0xfa70('0x8a')]});_0x3bb6c8[_0x3cb410[_0xfa70('0x4b')][_0xfa70('0xc1')]]=_0x3cb410[_0xfa70('0x4b')][_0xfa70('0x8b')];return db['CmContact'][_0xfa70('0xc5')]({'where':_0x1bef11,'defaults':_0x3bb6c8});}})[_0xfa70('0xb0')](function(_0x571e68){if(_0x571e68){_0x1bf8f6=_0x571e68;var _0x1d044c=fs[_0xfa70('0xc6')](path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0xc7')),_0xfa70('0xc8'));var _0x3028e8=ejs[_0xfa70('0xc9')](_0x1d044c,{'body':_[_0xfa70('0xca')](_0x3cb410['body']['body']),'bodyTitle':_0x124083[_0xfa70('0xcb')]});return db[_0xfa70('0xcc')][_0xfa70('0x4a')]({'body':_0x3028e8,'plainBody':htmlToText[_0xfa70('0xcd')](_0x3028e8),'ContactId':_0x571e68['id'],'ChatWebsiteId':_0x124083['id']});}})[_0xfa70('0x26')](function(_0x4dc5a5){_0x4bd01f=_0x4dc5a5;if(_0x3cfc60['length']){var _0x32bc77=_0x3cfc60['map'](function(_0x35354c){return{'name':_0x35354c[_0xfa70('0xce')],'basename':_0x35354c[_0xfa70('0x63')],'type':_0x35354c[_0xfa70('0xcf')],'ChatOfflineMessageId':_0x4dc5a5['id']};});_0x1e49d5=_0x32bc77[_0xfa70('0x2d')](_0x1703bc=>{var _0x2bc913={'filename':_0x1703bc[_0xfa70('0x2a')],'path':path[_0xfa70('0x6a')](config['root'],_0xfa70('0xd0'),_0xfa70('0xd1'),'attachments','offline-chat',_0x1703bc[_0xfa70('0xd2')])};return _0x2bc913;});if(!_0x124083[_0xfa70('0xd3')]){return db[_0xfa70('0xd4')][_0xfa70('0xd5')](function(_0x17aedd){return db['Attachment'][_0xfa70('0xd6')](_0x32bc77,{'transaction':_0x17aedd});});}}})[_0xfa70('0x26')](function(){if(_0x4bd01f){_0x1efda4=_0x4bd01f;return db[_0xfa70('0xc4')][_0xfa70('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xfa70('0xd7')],'as':_0xfa70('0xd8'),'raw':!![],'include':[{'model':db[_0xfa70('0xd9')],'as':_0xfa70('0xd9'),'raw':!![]}]}]});}})[_0xfa70('0x26')](function(_0x165db6){if(_0x165db6&&_0x165db6[_0xfa70('0xd8')]&&_0x124083['forwardOffline']&&_0x124083['forwardOfflineAddress']){var _0x4bb0df=_0x165db6['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xfa70('0xda'),{'account':_0x4bb0df,'message':{'from':util[_0xfa70('0xa5')](_0xfa70('0xdb'),_0x165db6[_0xfa70('0x2a')],_0x165db6['email']||_0x165db6[_0xfa70('0xd8')][_0xfa70('0x4c')]),'to':_0x124083[_0xfa70('0xdc')],'subject':_0x124083[_0xfa70('0xdd')],'html':_0x1efda4[_0xfa70('0x4b')],'attachments':_0x1e49d5}},client9003)[_0xfa70('0x26')](function(){return _0x1efda4;})[_0xfa70('0x1c')](function(_0x1a62e6){logger['error'](_0x1a62e6);});}})[_0xfa70('0x26')](function(){if(_0x124083&&_0x124083['openNewInteraction']&&_0x124083['MailAccountId']){var _0x13cbdb=[];if(_0x3cfc60[_0xfa70('0x38')]){_0x13cbdb=_0x3cfc60['map'](function(_0x286ccf){return{'name':_0x286ccf[_0xfa70('0xce')],'basename':_0x286ccf[_0xfa70('0x63')],'type':_0x286ccf[_0xfa70('0xcf')],'ChatOfflineMessageId':_0x4bd01f['id']};});}var _0x290641;if(!_['isNil'](_0x124083['subjectOffline'])){var _0x36a04=_[_0xfa70('0x2d')](_0x3cb410['body'],function(_0x3fa3c1){return _0x3fa3c1;});var _0x24cad0=_[_0xfa70('0xde')](_0x36a04)[0x0];var _0x2f7306=_[_0xfa70('0xdf')](_0x24cad0,function(_0x26ff6f){return _0x26ff6f;});_0x290641=_0x2f7306[0x1][_0x124083[_0xfa70('0xe0')]];}var _0x11a8e9={'from':_0x1bf8f6[_0xfa70('0xe1')],'firstName':_0x1bf8f6[_0xfa70('0x9f')],'lastName':_0x1bf8f6[_0xfa70('0xa0')],'mapKey':_0xfa70('0xe1'),'message':{'from':_0x1bf8f6[_0xfa70('0xe1')],'to':_0x124083['MailAccount'][_0xfa70('0xe1')],'cc':'','subject':_[_0xfa70('0x74')](_0x290641)?_0x124083[_0xfa70('0xdd')]:_0x290641,'messageId':'','sentAt':new Date(),'attach':_0x13cbdb[_0xfa70('0x38')],'attachments':_0x13cbdb,'originChannel':_0xfa70('0xe2'),'ChatWebsiteId':_0x124083['id'],'ChatOfflineMessageId':_0x1efda4['id'],'originTo':_0x124083['MailAccount'][_0xfa70('0xe1')]},'body':_0x1efda4['body']};var _0x53e87d={'account':{'id':_0x124083[_0xfa70('0xe3')]},'body':_0x11a8e9,'log':_0xfa70('0xe4')};return respondWithRpcPromise(_0xfa70('0xe4'),_0xfa70('0xe5'),_0x53e87d,client9001)['then'](function(){return _0x1efda4;})[_0xfa70('0x1c')](function(_0x47078b){logger[_0xfa70('0x17')](_0x47078b);});}return;})[_0xfa70('0x26')](function(){if(_0x1efda4){return _0x1efda4;}})['then'](respondWithResult(_0x4d85ae,null))[_0xfa70('0x1c')](function(_0x314826){logger[_0xfa70('0x17')](_0xfa70('0x1c'),_0x314826);for(var _0x3558b1 of _0x3cfc60){var _0x3fd132=path[_0xfa70('0x6a')](config[_0xfa70('0x6b')],_0xfa70('0xd0'),_0xfa70('0xd1'),'attachments',_0xfa70('0xe6'),_0x3558b1[_0xfa70('0x63')]);fs_extra[_0xfa70('0xe7')](_0x3fd132)[_0xfa70('0x1c')](function(_0x19f0a5){logger[_0xfa70('0x17')](_0xfa70('0xe8'),_0x3fd132,_0x19f0a5);});}});};exports[_0xfa70('0xe9')]=function(_0x3ad0c5,_0x5a32f8){return db[_0xfa70('0xaf')]['find']({'where':{'id':_0x3ad0c5[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5a32f8,null))['then'](function(_0x479453){if(_0x479453){return _0x479453['addInteraction'](_0x3ad0c5[_0xfa70('0x4b')][_0xfa70('0x5b')],_[_0xfa70('0xea')](_0x3ad0c5[_0xfa70('0x4b')],[_0xfa70('0x5b'),'id'])||{});}})[_0xfa70('0x26')](respondWithResult(_0x5a32f8,null))[_0xfa70('0x1c')](handleError(_0x5a32f8,null));};exports[_0xfa70('0xeb')]=function(_0x507bc1,_0x5479a4){var _0x17b586={'raw':![],'where':{}};var _0x2f697c={};var _0x559225={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x507bc1[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5479a4,null))['then'](function(_0x1354a1){if(_0x1354a1){_0x2f697c[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0xaf')][_0xfa70('0x2f')]);_0x2f697c['query']=_[_0xfa70('0x34')](_0x507bc1[_0xfa70('0x33')]);_0x2f697c[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x2f697c[_0xfa70('0x32')],_0x2f697c[_0xfa70('0x33')]);_0x17b586[_0xfa70('0x37')]=_[_0xfa70('0x35')](_0x2f697c[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x507bc1[_0xfa70('0x33')]['fields']));_0x17b586[_0xfa70('0x37')]=_0x17b586[_0xfa70('0x37')][_0xfa70('0x38')]?_0x17b586['attributes']:_0x2f697c[_0xfa70('0x32')];if(!_0x507bc1[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x17b586['limit']=qs[_0xfa70('0x22')](_0x507bc1[_0xfa70('0x33')]['limit']);_0x17b586['offset']=qs['offset'](_0x507bc1['query'][_0xfa70('0x20')]);}_0x17b586[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x17b586[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x507bc1[_0xfa70('0x33')],_0x2f697c[_0xfa70('0x3e')]));_0x17b586['where'][_0xfa70('0x56')]=_0x1354a1['id'];if(_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x17b586['where']=_['merge'](_0x17b586[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x17b586['attributes'],function(_0x594226){var _0x398cee={};_0x398cee[_0x594226]={'$like':'%'+_0x507bc1[_0xfa70('0x33')][_0xfa70('0x3f')]+'%'};return _0x398cee;})});}_0x17b586=_[_0xfa70('0x40')]({},_0x17b586,_0x507bc1[_0xfa70('0x42')]);return db[_0xfa70('0xaf')][_0xfa70('0x23')]({'where':_0x17b586[_0xfa70('0x3c')]})[_0xfa70('0x26')](function(_0x3ef1f1){_0x559225[_0xfa70('0x23')]=_0x3ef1f1;if(_0x507bc1['query'][_0xfa70('0x48')]){_0x17b586['include']=[{'model':db[_0xfa70('0x82')],'as':_0xfa70('0xec'),'required':![]},{'model':db[_0xfa70('0xb9')],'as':_0xfa70('0xed'),'attributes':['name',_0xfa70('0xee'),'internal'],'required':![]},{'model':db[_0xfa70('0xef')],'as':_0xfa70('0xf0'),'attributes':['id',_0xfa70('0x2a'),_0xfa70('0xf1')],'where':_0x507bc1[_0xfa70('0x33')][_0xfa70('0xf2')]?{'id':_0x507bc1['query'][_0xfa70('0xf2')]}:undefined,'required':_0x507bc1['query']['tag']?!![]:![]}];}return db[_0xfa70('0xaf')][_0xfa70('0x59')](_0x17b586);})[_0xfa70('0x26')](function(_0x303beb){_0x559225['rows']=_0x303beb;return _0x559225;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x5479a4,_0x17b586))[_0xfa70('0x1c')](handleError(_0x5479a4,null));};function iftimePromise(_0x9e9f99,_0x1d0e9d){return respondWithRpcPromise(_0xfa70('0xf3'),_0xfa70('0xf4'),{'command':_0x1d0e9d[_0xfa70('0xf5')]?util[_0xfa70('0xa5')](_0xfa70('0xf6'),_0x9e9f99[_0xfa70('0xf7')],_0x1d0e9d[_0xfa70('0xf5')]):util[_0xfa70('0xa5')]('iftime\x20%s',_0x9e9f99[_0xfa70('0xf7')])},client9002)[_0xfa70('0x26')](function(_0x2be633){var _0x4fbad2=_0x2be633&&_0x2be633[_0xfa70('0xf8')](_0xfa70('0xf9'))>=0x0?!![]:![];logger[_0xfa70('0x13')](_0xfa70('0xfa'),_0x1d0e9d['id'],_0x9e9f99['id'],_0x9e9f99[_0xfa70('0xf7')],_0x4fbad2?_0xfa70('0xfb'):_0xfa70('0xfc'),_0x1d0e9d[_0xfa70('0xf5')]?_0x1d0e9d[_0xfa70('0xf5')]:_0xfa70('0xfd'));return _0x4fbad2;})[_0xfa70('0x1c')](function(_0x546bc9){logger[_0xfa70('0x17')](_0xfa70('0xfa'),_0x1d0e9d['id'],_0x9e9f99['id'],_0x9e9f99['interval'],util['inspect'](_0x546bc9,{'showHidden':![],'depth':null}),_0x1d0e9d[_0xfa70('0xf5')]?_0x1d0e9d[_0xfa70('0xf5')]:_0xfa70('0xfd'));return![];});}exports[_0xfa70('0xf4')]=function(_0x5d040a,_0x8a6a34){var _0x527efc=0x0;var _0x358579=0x0;var _0xd1827f=![];var _0x15f198;var _0x368ba8;return db['ChatWebsite'][_0xfa70('0x49')]({'where':{'id':_0x5d040a['params']['id']},'include':[{'model':db[_0xfa70('0xfe')],'as':_0xfa70('0xfe'),'include':[{'model':db[_0xfa70('0xfe')],'as':_0xfa70('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xfa70('0x26')](handleEntityNotFound(_0x8a6a34,null))[_0xfa70('0x26')](function(_0x2ff5ba){if(_0x2ff5ba){_0x15f198=_0x2ff5ba;return _0x2ff5ba[_0xfa70('0x100')]({'raw':!![]});}})['then'](function(_0x47d246){if(_0x15f198){if(_0x47d246){_0x368ba8=_0x47d246;}}return require(_0xfa70('0x6d'))[_0xfa70('0x101')]();})[_0xfa70('0x26')](function(_0x317dca){if(_0x317dca){_0x358579=_0x317dca[_0xfa70('0x102')];_0xd1827f=_0x317dca[_0xfa70('0x6e')];}})[_0xfa70('0x26')](function(){return db[_0xfa70('0xaf')]['count']({'where':{'closed':![]}});})['then'](function(_0x23cae4){_0x527efc=_0x23cae4;if(_0x358579&&_0x23cae4>_0x358579){return db['License'][_0xfa70('0x5d')]({'where':{'id':0x1}})[_0xfa70('0x26')](function(_0x5afae7){if(_0x5afae7){_0x5afae7[_0xfa70('0x103')](_0xfa70('0x104'));}});}})['then'](function(){if(_0x15f198[_0xfa70('0xfe')]&&_0x15f198[_0xfa70('0xfe')]['Intervals']){var _0x31ff0f=[];for(var _0x37d4d2=0x0;_0x37d4d2<_0x15f198[_0xfa70('0xfe')]['Intervals'][_0xfa70('0x38')];_0x37d4d2++){var _0x1531f4=_0x15f198[_0xfa70('0xfe')][_0xfa70('0xff')][_0x37d4d2][_0xfa70('0x28')]({'plain':!![]});_0x31ff0f[_0xfa70('0xb3')](iftimePromise(_0x1531f4,_0x15f198));}return BPromise[_0xfa70('0x105')](_0x31ff0f)['then'](function(_0x2d97d9){return _[_0xfa70('0x106')](_0x2d97d9);});}else{return!![];}})['then'](function(_0x41cd40){var _0x2e436b=fs['readFileSync'](path[_0xfa70('0x6a')](config['root'],_0xfa70('0x107')),_0xfa70('0xc8'));var _0x92670e=new url[(_0xfa70('0x108'))](_0x15f198[_0xfa70('0x109')])[_0xfa70('0x10a')];var _0x16743c=_0xfa70('0x10b');var _0x6c439e=![];var _0x45cfc3={'chatVersion':_0x16743c,'chatWebsiteAddressOrigin':_0x92670e,'remote':_0x15f198[_0xfa70('0x10c')],'query':querystring[_0xfa70('0x10d')](_[_0xfa70('0x40')](_0x15f198[_0xfa70('0x28')]({'plain':!![]}),{'customerIp':_0x5d040a['headers'][_0xfa70('0x9d')]||_0x5d040a[_0xfa70('0x7e')][_0xfa70('0x10e')]||_0x5d040a[_0xfa70('0x10f')][_0xfa70('0x110')]||_0x5d040a['ip'],'referer':_0x5d040a[_0xfa70('0x7e')][_0xfa70('0xa2')],'openedInteractions':_0x527efc,'maxInteractions':_0x358579,'virtual':_0xd1827f[_0xfa70('0x102')],'online':_0x41cd40,'custom':_0xd1827f}))['replace'](/'/g,'\x5c\x27')};_0x8a6a34[_0xfa70('0x2b')](ejs[_0xfa70('0xc9')](Mustache[_0xfa70('0xc9')](_0x2e436b,_0x45cfc3),{'proactiveActions':_0x368ba8,'alignment':_0x15f198[_0xfa70('0x111')],'verticalAlignment':_0x15f198[_0xfa70('0x112')],'div_color':_0x15f198[_0xfa70('0xf1')],'labelText':_0x15f198[_0xfa70('0x113')],'text_color':_0x15f198[_0xfa70('0x114')],'text_button_color':_0x15f198['textButtonColor'],'button_color':_0x15f198[_0xfa70('0x115')],'background_color':_0x15f198['backgroundColor'],'hideWhenOffline':_0x15f198['hideWhenOffline'],'intervalId':_0x15f198[_0xfa70('0x116')],'isDevelopment':_0x6c439e,'chatVersion':_0x16743c}));})['catch'](handleError(_0x8a6a34,null));};exports[_0xfa70('0x117')]=function(_0x10b327,_0xf03ac0){var _0x1e64cd=_0x10b327[_0xfa70('0x53')]['id'];var _0x13abfb=_0x10b327[_0xfa70('0x4b')];var _0x44bf2e=0xc8;var _0x1a599d=null;return db[_0xfa70('0xd4')][_0xfa70('0xd5')]({'isolationLevel':db[_0xfa70('0xd4')][_0xfa70('0x118')][_0xfa70('0x119')][_0xfa70('0x11a')]},function(_0x1097cc){return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x1e64cd},'transaction':_0x1097cc})[_0xfa70('0x26')](function(_0x33f475){if(_0x33f475){return db['ChatApplication'][_0xfa70('0x27')]({'where':{'ChatWebsiteId':_0x1e64cd},'transaction':_0x1097cc})[_0xfa70('0x26')](function(){var _0x3164d2=_[_0xfa70('0x2d')](_0x13abfb,function(_0x40a8b6){_0x40a8b6[_0xfa70('0x56')]=_0x1e64cd;return _0x40a8b6;});return db[_0xfa70('0x11b')][_0xfa70('0xd6')](_0x3164d2,{'transaction':_0x1097cc});});}else{_0x44bf2e=0x194;_0x1a599d=[];}});})[_0xfa70('0x26')](function(){if(_0x44bf2e!==0x194){return db[_0xfa70('0x11b')][_0xfa70('0x11c')]({'where':{'ChatWebsiteId':_0x1e64cd},'order':_0xfa70('0x11d')})[_0xfa70('0x26')](function(_0x1d5405){_0x1a599d=_0x1d5405;});}})[_0xfa70('0x1c')](function(_0x4f48c5){_0x44bf2e=0x1f4;logger[_0xfa70('0x17')](_0x4f48c5['stack']);if(_0x4f48c5[_0xfa70('0x2a')]){delete _0x4f48c5[_0xfa70('0x2a')];}_0x1a599d=_0x4f48c5;})[_0xfa70('0x11e')](function(){if(_0x1a599d===null){_0xf03ac0[_0xfa70('0x29')](_0x44bf2e);}else{if(_0x44bf2e===0x1f4){_0xf03ac0[_0xfa70('0x1d')](_0x44bf2e)[_0xfa70('0x2b')](_0x1a599d);}else{_0xf03ac0['status'](_0x44bf2e)[_0xfa70('0x1f')](_0x1a599d);}}});};exports[_0xfa70('0x11f')]=function(_0x3516ca,_0x2be032){var _0x374801={};var _0x5a39c9={};var _0x24b58c;var _0x23dce1;return db[_0xfa70('0x2e')]['findOne']({'where':{'id':_0x3516ca[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x2be032,null))[_0xfa70('0x26')](function(_0x266c0b){if(_0x266c0b){_0x24b58c=_0x266c0b;_0x5a39c9[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x11b')][_0xfa70('0x2f')]);_0x5a39c9[_0xfa70('0x33')]=_['keys'](_0x3516ca['query']);_0x5a39c9[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x5a39c9['model'],_0x5a39c9[_0xfa70('0x33')]);_0x374801[_0xfa70('0x37')]=_[_0xfa70('0x35')](_0x5a39c9[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x3516ca['query'][_0xfa70('0x36')]));_0x374801[_0xfa70('0x37')]=_0x374801[_0xfa70('0x37')]['length']?_0x374801['attributes']:_0x5a39c9['model'];_0x374801[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x3516ca[_0xfa70('0x33')]['sort']);_0x374801[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x3516ca[_0xfa70('0x33')],_0x5a39c9[_0xfa70('0x3e')]));if(_0x3516ca[_0xfa70('0x33')][_0xfa70('0x3f')]){_0x374801[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x374801[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x374801[_0xfa70('0x37')],function(_0x37a8ee){var _0x231dd4={};_0x231dd4[_0x37a8ee]={'$like':'%'+_0x3516ca['query'][_0xfa70('0x3f')]+'%'};return _0x231dd4;})});}_0x374801=_[_0xfa70('0x40')]({},_0x374801,_0x3516ca['options']);return _0x24b58c[_0xfa70('0x11f')](_0x374801);}})[_0xfa70('0x26')](function(_0x4b651c){if(_0x4b651c){_0x23dce1=_0x4b651c[_0xfa70('0x38')];if(!_0x3516ca[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x374801[_0xfa70('0x22')]=qs['limit'](_0x3516ca[_0xfa70('0x33')][_0xfa70('0x22')]);_0x374801[_0xfa70('0x20')]=qs['offset'](_0x3516ca[_0xfa70('0x33')]['offset']);}return _0x24b58c['getApplications'](_0x374801);}})[_0xfa70('0x26')](function(_0x246d20){if(_0x246d20){return _0x246d20?{'count':_0x23dce1,'rows':_0x246d20}:null;}})['then'](respondWithResult(_0x2be032,null))[_0xfa70('0x1c')](handleError(_0x2be032,null));};exports[_0xfa70('0x120')]=function(_0x444e2a,_0x5ec26b){return db[_0xfa70('0x121')][_0xfa70('0x49')]({'where':{'id':_0x444e2a['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5ec26b,null))[_0xfa70('0x26')](function(_0x10d4d7){if(_0x10d4d7){return _0x10d4d7[_0xfa70('0x120')](_0x444e2a['body']['ids'],_['omit'](_0x444e2a[_0xfa70('0x4b')],['ids','id'])||{});}})[_0xfa70('0x26')](respondWithResult(_0x5ec26b,null))[_0xfa70('0x1c')](handleError(_0x5ec26b,null));};exports[_0xfa70('0x100')]=function(_0x1cf8d2,_0x38378b){var _0x2f1159={};var _0x12f808={};var _0x483a4d;var _0x1851c4;return db['ChatWebsite'][_0xfa70('0x5d')]({'where':{'id':_0x1cf8d2['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x38378b,null))['then'](function(_0x70f27a){if(_0x70f27a){_0x483a4d=_0x70f27a;_0x12f808[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0x122')][_0xfa70('0x2f')]);_0x12f808[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x1cf8d2[_0xfa70('0x33')]);_0x12f808[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x12f808[_0xfa70('0x32')],_0x12f808['query']);_0x2f1159['attributes']=_[_0xfa70('0x35')](_0x12f808[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x36')]));_0x2f1159['attributes']=_0x2f1159[_0xfa70('0x37')][_0xfa70('0x38')]?_0x2f1159['attributes']:_0x12f808[_0xfa70('0x32')];_0x2f1159[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x2f1159[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x1cf8d2[_0xfa70('0x33')],_0x12f808[_0xfa70('0x3e')]));if(_0x1cf8d2[_0xfa70('0x33')]['filter']){_0x2f1159['where']=_['merge'](_0x2f1159[_0xfa70('0x3c')],{'$or':_['map'](_0x2f1159['attributes'],function(_0x39c25f){var _0x414e08={};_0x414e08[_0x39c25f]={'$like':'%'+_0x1cf8d2[_0xfa70('0x33')]['filter']+'%'};return _0x414e08;})});}_0x2f1159=_[_0xfa70('0x40')]({},_0x2f1159,_0x1cf8d2[_0xfa70('0x42')]);return _0x483a4d['getProactiveActions'](_0x2f1159);}})[_0xfa70('0x26')](function(_0x257978){if(_0x257978){_0x1851c4=_0x257978['length'];if(!_0x1cf8d2['query'][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x2f1159[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x1cf8d2['query'][_0xfa70('0x22')]);_0x2f1159[_0xfa70('0x20')]=qs[_0xfa70('0x20')](_0x1cf8d2[_0xfa70('0x33')][_0xfa70('0x20')]);}return _0x483a4d[_0xfa70('0x100')](_0x2f1159);}})[_0xfa70('0x26')](function(_0x33c404){if(_0x33c404){return _0x33c404?{'count':_0x1851c4,'rows':_0x33c404}:null;}})[_0xfa70('0x26')](respondWithResult(_0x38378b,null))['catch'](handleError(_0x38378b,null));};exports[_0xfa70('0x123')]=function(_0x427ef8,_0x4c0a75){var _0x25bae3=_0x427ef8['query'][_0xfa70('0x124')]==='false'?_0xfa70('0x125'):_0xfa70('0x126');return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'attributes':['id',_0x25bae3],'where':{'id':_0x427ef8[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x4c0a75,null))[_0xfa70('0x26')](function(_0x59c5b8){if(_0x59c5b8){var _0x18985b=_0x59c5b8[_0x25bae3];var _0x1c184a=_0x18985b&&_0x18985b[_0xfa70('0x127')]?_0x18985b[_0xfa70('0x127')]:[];_0x4c0a75[_0xfa70('0x2b')]({'fromKey':_[_0xfa70('0x74')](_0x18985b[_0xfa70('0x128')])?undefined:_0x18985b[_0xfa70('0x128')],'count':_0x1c184a[_0xfa70('0x38')],'rows':_0x1c184a});}})['catch'](handleError(_0x4c0a75,null));};exports[_0xfa70('0x129')]=function(_0x1a90d1,_0x214792){var _0x529929={'raw':![],'where':{}};var _0x607581={};var _0x5f3d69={'count':0x0,'rows':[]};return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x1a90d1['params']['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x214792,null))['then'](function(_0x223185){if(_0x223185){_0x607581['model']=_[_0xfa70('0x34')](db[_0xfa70('0xcc')][_0xfa70('0x2f')]);_0x607581[_0xfa70('0x33')]=_['keys'](_0x1a90d1[_0xfa70('0x33')]);_0x607581['filters']=_['intersection'](_0x607581[_0xfa70('0x32')],_0x607581[_0xfa70('0x33')]);_0x529929[_0xfa70('0x37')]=_['intersection'](_0x607581['model'],qs[_0xfa70('0x36')](_0x1a90d1['query'][_0xfa70('0x36')]));_0x529929[_0xfa70('0x37')]=_0x529929[_0xfa70('0x37')][_0xfa70('0x38')]?_0x529929[_0xfa70('0x37')]:_0x607581[_0xfa70('0x32')];if(!_0x1a90d1[_0xfa70('0x33')][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x529929[_0xfa70('0x22')]=qs[_0xfa70('0x22')](_0x1a90d1['query'][_0xfa70('0x22')]);_0x529929[_0xfa70('0x20')]=qs[_0xfa70('0x20')](_0x1a90d1['query'][_0xfa70('0x20')]);}_0x529929[_0xfa70('0x3a')]=qs[_0xfa70('0x3b')](_0x1a90d1['query'][_0xfa70('0x3b')]);_0x529929[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_['pick'](_0x1a90d1[_0xfa70('0x33')],_0x607581[_0xfa70('0x3e')]));_0x529929[_0xfa70('0x3c')][_0xfa70('0x56')]=_0x223185['id'];if(_0x1a90d1['query'][_0xfa70('0x3f')]){_0x529929[_0xfa70('0x3c')]=_[_0xfa70('0x40')](_0x529929[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x529929['attributes'],function(_0x55b6ab){var _0x5e4e2b={};_0x5e4e2b[_0x55b6ab]={'$like':'%'+_0x1a90d1[_0xfa70('0x33')]['filter']+'%'};return _0x5e4e2b;})});}_0x529929=_[_0xfa70('0x40')]({},_0x529929,_0x1a90d1[_0xfa70('0x42')]);return db[_0xfa70('0xcc')][_0xfa70('0x23')]({'where':_0x529929[_0xfa70('0x3c')]})['then'](function(_0x5d455d){_0x5f3d69[_0xfa70('0x23')]=_0x5d455d;if(_0x1a90d1[_0xfa70('0x33')]['includeAll']){_0x529929[_0xfa70('0x43')]=[{'all':!![]}];}else{_0x529929[_0xfa70('0x43')]=[{'model':db[_0xfa70('0x82')],'as':'Contact','required':![]},{'model':db[_0xfa70('0x12a')],'as':'Attachments','required':![]}];}return db[_0xfa70('0xcc')]['findAll'](_0x529929);})[_0xfa70('0x26')](function(_0x36c336){_0x5f3d69[_0xfa70('0x44')]=_0x36c336;return _0x5f3d69;});}})[_0xfa70('0x26')](respondWithFilteredResult(_0x214792,_0x529929))['catch'](handleError(_0x214792,null));};exports[_0xfa70('0x12b')]=function(_0xcce62c,_0x42e3ad){return db[_0xfa70('0x2e')][_0xfa70('0x49')]({'where':{'id':_0xcce62c[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x42e3ad,null))[_0xfa70('0x26')](function(_0x126c06){if(_0x126c06){return _0x126c06[_0xfa70('0x12b')](_0xcce62c['body'][_0xfa70('0x5b')],_[_0xfa70('0xea')](_0xcce62c[_0xfa70('0x4b')],['ids','id'])||{})[_0xfa70('0xb0')](function(_0x365984){for(var _0x35ee1c=0x0;_0x35ee1c<_0xcce62c['body'][_0xfa70('0x5b')][_0xfa70('0x38')];_0x35ee1c+=0x1){socket[_0xfa70('0x12c')](_0xfa70('0x12d'),{'UserId':Number(_0xcce62c['body'][_0xfa70('0x5b')][_0x35ee1c]),'ChatWebsiteId':Number(_0xcce62c[_0xfa70('0x53')]['id'])});}return _0x365984;});}})['then'](respondWithResult(_0x42e3ad,null))[_0xfa70('0x1c')](handleError(_0x42e3ad,null));};exports[_0xfa70('0x12e')]=function(_0x640da1,_0x5defd9){return db[_0xfa70('0x2e')]['find']({'where':{'id':_0x640da1[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x5defd9,null))[_0xfa70('0x26')](function(_0x3b4663){if(_0x3b4663){return _0x3b4663['removeAgents'](_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')])[_0xfa70('0x26')](function(){if(_[_0xfa70('0x12f')](_0x640da1['query'][_0xfa70('0x5b')])){for(var _0x14be27=0x0;_0x14be27<_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')][_0xfa70('0x38')];_0x14be27+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x640da1['query']['ids'][_0x14be27]),'ChatWebsiteId':Number(_0x640da1[_0xfa70('0x53')]['id'])});}}else{socket[_0xfa70('0x12c')](_0xfa70('0x130'),{'UserId':Number(_0x640da1[_0xfa70('0x33')][_0xfa70('0x5b')]),'ChatWebsiteId':Number(_0x640da1[_0xfa70('0x53')]['id'])});}});}})[_0xfa70('0x26')](respondWithStatusCode(_0x5defd9,null))['catch'](handleError(_0x5defd9,null));};exports[_0xfa70('0x131')]=function(_0x44975d,_0x20c7aa){var _0x1d23bd={};var _0x467df8={};var _0x3869b3;var _0x3107a4;return db[_0xfa70('0x2e')][_0xfa70('0x5d')]({'where':{'id':_0x44975d[_0xfa70('0x53')]['id']}})[_0xfa70('0x26')](handleEntityNotFound(_0x20c7aa,null))[_0xfa70('0x26')](function(_0x38c149){if(_0x38c149){_0x3869b3=_0x38c149;_0x467df8[_0xfa70('0x32')]=_[_0xfa70('0x34')](db[_0xfa70('0xb9')]['rawAttributes']);_0x467df8[_0xfa70('0x33')]=_[_0xfa70('0x34')](_0x44975d['query']);_0x467df8[_0xfa70('0x3e')]=_[_0xfa70('0x35')](_0x467df8[_0xfa70('0x32')],_0x467df8[_0xfa70('0x33')]);_0x1d23bd['attributes']=_['intersection'](_0x467df8[_0xfa70('0x32')],qs[_0xfa70('0x36')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x36')]));_0x1d23bd[_0xfa70('0x37')]=_0x1d23bd[_0xfa70('0x37')][_0xfa70('0x38')]?_0x1d23bd[_0xfa70('0x37')]:_0x467df8[_0xfa70('0x32')];_0x1d23bd['order']=qs[_0xfa70('0x3b')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x3b')]);_0x1d23bd[_0xfa70('0x3c')]=qs[_0xfa70('0x3e')](_[_0xfa70('0x3d')](_0x44975d[_0xfa70('0x33')],_0x467df8[_0xfa70('0x3e')]));if(_0x44975d['query'][_0xfa70('0x3f')]){_0x1d23bd[_0xfa70('0x3c')]=_['merge'](_0x1d23bd[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x2d')](_0x1d23bd['attributes'],function(_0x105cf8){var _0x27469c={};_0x27469c[_0x105cf8]={'$like':'%'+_0x44975d[_0xfa70('0x33')]['filter']+'%'};return _0x27469c;})});}_0x1d23bd=_[_0xfa70('0x40')]({},_0x1d23bd,_0x44975d[_0xfa70('0x42')]);return _0x3869b3['getAgents'](_0x1d23bd);}})['then'](function(_0x38973c){if(_0x38973c){_0x3107a4=_0x38973c[_0xfa70('0x38')];if(!_0x44975d['query'][_0xfa70('0x39')](_0xfa70('0x5f'))){_0x1d23bd['limit']=qs[_0xfa70('0x22')](_0x44975d[_0xfa70('0x33')][_0xfa70('0x22')]);_0x1d23bd[_0xfa70('0x20')]=qs['offset'](_0x44975d[_0xfa70('0x33')][_0xfa70('0x20')]);}return _0x3869b3[_0xfa70('0x131')](_0x1d23bd);}})[_0xfa70('0x26')](function(_0xc2610e){if(_0xc2610e){return _0xc2610e?{'count':_0x3107a4,'rows':_0xc2610e}:null;}})['then'](respondWithResult(_0x20c7aa,null))[_0xfa70('0x1c')](handleError(_0x20c7aa,null));}; \ No newline at end of file +var _0x9950=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','priority','asc','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','all','server/files/chat/iframe.ejs','URL','address','origin','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','items','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','url','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','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','end','json','offset','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit'];(function(_0x2cb998,_0x5c33aa){var _0x450c3e=function(_0x564336){while(--_0x564336){_0x2cb998['push'](_0x2cb998['shift']());}};_0x450c3e(++_0x5c33aa);}(_0x9950,0xf8));var _0x0995=function(_0x5b2bf2,_0x184783){_0x5b2bf2=_0x5b2bf2-0x0;var _0xbff45b=_0x9950[_0x5b2bf2];return _0xbff45b;};'use strict';var BPromise=require(_0x0995('0x0'));var Mustache=require('mustache');var util=require(_0x0995('0x1'));var path=require('path');var ejs=require(_0x0995('0x2'));var fs=require('fs');var fs_extra=require(_0x0995('0x3'));var _=require('lodash');var querystring=require(_0x0995('0x4'));var Redis=require(_0x0995('0x5'));var qs=require(_0x0995('0x6'));var logger=require(_0x0995('0x7'))('api');var config=require(_0x0995('0x8'));var url=require(_0x0995('0x9'));var db=require(_0x0995('0xa'))['db'];config['redis']=_[_0x0995('0xb')](config[_0x0995('0xc')],{'host':_0x0995('0xd'),'port':0x18eb});var socket=require(_0x0995('0xe'))(new Redis(config[_0x0995('0xc')]));require(_0x0995('0xf'))[_0x0995('0x10')](socket);var htmlToText=require(_0x0995('0x11'));var jayson=require(_0x0995('0x12'));var client=jayson['client'][_0x0995('0x13')]({'port':0x232c});var client9002=jayson[_0x0995('0x14')][_0x0995('0x13')]({'port':0x232a});var client9003=jayson[_0x0995('0x14')][_0x0995('0x13')]({'port':0x232b});var client9001=jayson[_0x0995('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x505ca3,_0x5e154f,_0x4deea5,_0x6e5489){return new BPromise(function(_0x3bdf3b,_0x643be6){var _0x19ce9d=_0x6e5489||client;return _0x19ce9d[_0x0995('0x15')](_0x505ca3,_0x4deea5)[_0x0995('0x16')](function(_0x2c6ef6){logger[_0x0995('0x17')](_0x0995('0x18'),_0x5e154f,_0x0995('0x19'));logger[_0x0995('0x1a')](_0x0995('0x1b'),_0x5e154f,'request\x20sent',JSON['stringify'](_0x2c6ef6));if(_0x2c6ef6['error']){if(_0x2c6ef6[_0x0995('0x1c')][_0x0995('0x1d')]===0x1f4){logger[_0x0995('0x1c')](_0x0995('0x18'),_0x5e154f,_0x2c6ef6[_0x0995('0x1c')][_0x0995('0x1e')]);return _0x643be6(_0x2c6ef6[_0x0995('0x1c')][_0x0995('0x1e')]);}logger[_0x0995('0x1c')](_0x0995('0x18'),_0x5e154f,_0x2c6ef6['error'][_0x0995('0x1e')]);return _0x3bdf3b(_0x2c6ef6[_0x0995('0x1c')]['message']);}else{logger[_0x0995('0x17')](_0x0995('0x18'),_0x5e154f,_0x0995('0x19'));_0x3bdf3b(_0x2c6ef6[_0x0995('0x1f')][_0x0995('0x1e')]);}})[_0x0995('0x20')](function(_0x4c81dd){logger[_0x0995('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5e154f,_0x4c81dd);_0x643be6(_0x4c81dd);});});}function respondWithStatusCode(_0x84f7f1,_0x5acb7a){_0x5acb7a=_0x5acb7a||0xcc;return function(_0x108d25){if(_0x108d25){return _0x84f7f1[_0x0995('0x21')](_0x5acb7a);}return _0x84f7f1[_0x0995('0x22')](_0x5acb7a)[_0x0995('0x23')]();};}function respondWithResult(_0x47921c,_0x5f2ffd){_0x5f2ffd=_0x5f2ffd||0xc8;return function(_0x348010){if(_0x348010){return _0x47921c[_0x0995('0x22')](_0x5f2ffd)[_0x0995('0x24')](_0x348010);}};}function respondWithFilteredResult(_0x3ffcb1,_0x56d947){return function(_0x15f280){if(_0x15f280){var _0x14577b=typeof _0x56d947[_0x0995('0x25')]==='undefined'&&typeof _0x56d947[_0x0995('0x26')]==='undefined';var _0x220377=_0x15f280[_0x0995('0x27')];var _0x26d6e3=_0x14577b?0x0:_0x56d947['offset'];var _0x49a3fa=_0x14577b?_0x15f280[_0x0995('0x27')]:_0x56d947[_0x0995('0x25')]+_0x56d947[_0x0995('0x26')];var _0x2be15a;if(_0x49a3fa>=_0x220377){_0x49a3fa=_0x220377;_0x2be15a=0xc8;}else{_0x2be15a=0xce;}_0x3ffcb1[_0x0995('0x22')](_0x2be15a);return _0x3ffcb1[_0x0995('0x28')](_0x0995('0x29'),_0x26d6e3+'-'+_0x49a3fa+'/'+_0x220377)['json'](_0x15f280);}return null;};}function saveUpdates(_0x5de0ad){return function(_0x3fb40b){if(_0x3fb40b){return _0x3fb40b[_0x0995('0x2a')](_0x5de0ad)[_0x0995('0x16')](function(_0x19db93){return _0x19db93;});}return null;};}function removeEntity(_0x400264){return function(_0x200edd){if(_0x200edd){return _0x200edd[_0x0995('0x2b')]()['then'](function(){var _0xa6a806=_0x200edd[_0x0995('0x2c')]({'plain':!![]});var _0x2c098e=_0x0995('0x2d');return db['UserProfileResource'][_0x0995('0x2b')]({'where':{'type':_0x2c098e,'resourceId':_0xa6a806['id']}})[_0x0995('0x16')](function(){return _0x200edd;});})[_0x0995('0x16')](function(){_0x400264[_0x0995('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f486b){return function(_0x3520f3){if(!_0x3520f3){_0x3f486b[_0x0995('0x21')](0x194);}return _0x3520f3;};}function handleError(_0x3c5ef3,_0x381d58){_0x381d58=_0x381d58||0x1f4;return function(_0x5518ae){logger[_0x0995('0x1c')](_0x5518ae[_0x0995('0x2e')]);if(_0x5518ae[_0x0995('0x2f')]){delete _0x5518ae['name'];}_0x3c5ef3['status'](_0x381d58)[_0x0995('0x30')](_0x5518ae);};}exports[_0x0995('0x31')]=function(_0x317b58,_0x305ca3){var _0x4cccff={'include':[{'model':db['Pause'],'as':_0x0995('0x32')}]},_0x2b8479={},_0x24546a={'count':0x0,'rows':[]};var _0x27f05b=_[_0x0995('0x33')](db[_0x0995('0x34')][_0x0995('0x35')],function(_0x534c46){return{'name':_0x534c46[_0x0995('0x36')],'type':_0x534c46[_0x0995('0x37')][_0x0995('0x38')]};});_0x2b8479[_0x0995('0x39')]=_[_0x0995('0x33')](_0x27f05b,_0x0995('0x2f'));_0x2b8479['query']=_[_0x0995('0x3a')](_0x317b58['query']);_0x2b8479[_0x0995('0x3b')]=_[_0x0995('0x3c')](_0x2b8479[_0x0995('0x39')],_0x2b8479[_0x0995('0x3d')]);_0x4cccff['attributes']=_[_0x0995('0x3c')](_0x2b8479['model'],qs[_0x0995('0x3e')](_0x317b58[_0x0995('0x3d')]['fields']));_0x4cccff[_0x0995('0x3f')]=_0x4cccff[_0x0995('0x3f')]['length']?_0x4cccff[_0x0995('0x3f')]:_0x2b8479[_0x0995('0x39')];if(!_0x317b58['query'][_0x0995('0x40')](_0x0995('0x41'))){_0x4cccff['limit']=qs['limit'](_0x317b58[_0x0995('0x3d')][_0x0995('0x26')]);_0x4cccff[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x317b58[_0x0995('0x3d')][_0x0995('0x25')]);}_0x4cccff[_0x0995('0x42')]=qs[_0x0995('0x43')](_0x317b58[_0x0995('0x3d')][_0x0995('0x43')]);_0x4cccff[_0x0995('0x44')]=qs[_0x0995('0x3b')](_[_0x0995('0x45')](_0x317b58[_0x0995('0x3d')],_0x2b8479[_0x0995('0x3b')]),_0x27f05b);if(_0x317b58[_0x0995('0x3d')][_0x0995('0x46')]){_0x4cccff['where']=_['merge'](_0x4cccff[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x27f05b,function(_0x3ee820){if(_0x3ee820[_0x0995('0x37')]!==_0x0995('0x47')){var _0x505837={};_0x505837[_0x3ee820[_0x0995('0x2f')]]={'$like':'%'+_0x317b58[_0x0995('0x3d')][_0x0995('0x46')]+'%'};return _0x505837;}})});}_0x4cccff=_[_0x0995('0x48')]({},_0x4cccff,_0x317b58[_0x0995('0x49')]);var _0x4ba46e={'where':_0x4cccff[_0x0995('0x44')]};return db[_0x0995('0x34')][_0x0995('0x27')](_0x4ba46e)[_0x0995('0x16')](function(_0x48465f){_0x24546a[_0x0995('0x27')]=_0x48465f;if(_0x317b58['query'][_0x0995('0x4a')]){_0x4cccff[_0x0995('0x4b')]=[{'all':!![]}];}return db[_0x0995('0x34')][_0x0995('0x4c')](_0x4cccff);})[_0x0995('0x16')](function(_0x2c6ef7){_0x24546a[_0x0995('0x4d')]=_0x2c6ef7;return _0x24546a;})[_0x0995('0x16')](respondWithFilteredResult(_0x305ca3,_0x4cccff))[_0x0995('0x20')](handleError(_0x305ca3,null));};exports[_0x0995('0x4e')]=function(_0x594a60,_0x3dca5b){var _0x1018a7={'raw':![],'where':{'id':_0x594a60[_0x0995('0x4f')]['id']},'include':[{'model':db[_0x0995('0x50')],'as':'mandatoryDispositionPause'}]},_0x237325={};_0x237325[_0x0995('0x39')]=_[_0x0995('0x3a')](db[_0x0995('0x34')][_0x0995('0x35')]);_0x237325[_0x0995('0x3d')]=_[_0x0995('0x3a')](_0x594a60[_0x0995('0x3d')]);_0x237325[_0x0995('0x3b')]=_[_0x0995('0x3c')](_0x237325[_0x0995('0x39')],_0x237325['query']);_0x1018a7['attributes']=_[_0x0995('0x3c')](_0x237325[_0x0995('0x39')],qs[_0x0995('0x3e')](_0x594a60[_0x0995('0x3d')][_0x0995('0x3e')]));_0x1018a7[_0x0995('0x3f')]=_0x1018a7['attributes'][_0x0995('0x51')]?_0x1018a7[_0x0995('0x3f')]:_0x237325[_0x0995('0x39')];if(_0x594a60[_0x0995('0x3d')][_0x0995('0x4a')]){_0x1018a7[_0x0995('0x4b')]=[{'all':!![]}];}_0x1018a7=_['merge']({},_0x1018a7,_0x594a60[_0x0995('0x49')]);return db['ChatWebsite'][_0x0995('0x52')](_0x1018a7)[_0x0995('0x16')](handleEntityNotFound(_0x3dca5b,null))[_0x0995('0x16')](respondWithResult(_0x3dca5b,null))[_0x0995('0x20')](handleError(_0x3dca5b,null));};exports[_0x0995('0x53')]=function(_0x2373d3,_0x19d94c){return db[_0x0995('0x34')][_0x0995('0x53')](_0x2373d3[_0x0995('0x54')],{})[_0x0995('0x16')](function(_0x41b103){var _0x237f8e=_0x2373d3[_0x0995('0x55')]['get']({'plain':!![]});if(!_0x237f8e)throw new Error(_0x0995('0x56'));if(_0x237f8e[_0x0995('0x57')]==='user'){var _0x3c2fe6=_0x41b103['get']({'plain':!![]});var _0x25b142=_0x0995('0x2d');return db[_0x0995('0x58')][_0x0995('0x52')]({'where':{'name':_0x25b142,'userProfileId':_0x237f8e[_0x0995('0x59')]},'raw':!![]})[_0x0995('0x16')](function(_0x5effb4){if(_0x5effb4&&_0x5effb4[_0x0995('0x5a')]===0x0){return db[_0x0995('0x5b')][_0x0995('0x53')]({'name':_0x3c2fe6[_0x0995('0x2f')],'resourceId':_0x3c2fe6['id'],'type':_0x5effb4[_0x0995('0x2f')],'sectionId':_0x5effb4['id']},{})[_0x0995('0x16')](function(){return _0x41b103;});}else{return _0x41b103;}})[_0x0995('0x20')](function(_0x35044b){logger['error'](_0x0995('0x5c'),_0x35044b);throw _0x35044b;});}return _0x41b103;})[_0x0995('0x16')](respondWithResult(_0x19d94c,0xc9))[_0x0995('0x20')](handleError(_0x19d94c,null));};exports[_0x0995('0x2a')]=function(_0x1cc08c,_0x447802){if(_0x1cc08c[_0x0995('0x54')]['id']){delete _0x1cc08c[_0x0995('0x54')]['id'];}return db[_0x0995('0x34')]['find']({'where':{'id':_0x1cc08c[_0x0995('0x4f')]['id']},'include':[{'model':db[_0x0995('0x50')],'as':_0x0995('0x32')}]})[_0x0995('0x16')](handleEntityNotFound(_0x447802,null))[_0x0995('0x16')](saveUpdates(_0x1cc08c[_0x0995('0x54')],null))[_0x0995('0x16')](respondWithResult(_0x447802,null))[_0x0995('0x20')](handleError(_0x447802,null));};exports[_0x0995('0x2b')]=function(_0x41b301,_0x222bde){return db['ChatWebsite'][_0x0995('0x52')]({'where':{'id':_0x41b301['params']['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x222bde,null))[_0x0995('0x16')](removeEntity(_0x222bde,null))['catch'](handleError(_0x222bde,null));};exports[_0x0995('0x5d')]=function(_0x320dfc,_0x3e0f77){return db[_0x0995('0x34')]['describe']()[_0x0995('0x16')](respondWithResult(_0x3e0f77,null))['catch'](handleError(_0x3e0f77,null));};exports[_0x0995('0x5e')]=function(_0x3c3a3e,_0x4bfb98){if(_0x3c3a3e['body']['id']){delete _0x3c3a3e['body']['id'];}return db[_0x0995('0x34')]['find']({'where':{'id':_0x3c3a3e[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x4bfb98,null))[_0x0995('0x16')](function(_0x19d4ee){if(_0x19d4ee){_0x3c3a3e['body'][_0x0995('0x5f')]=_0x19d4ee['id'];return db[_0x0995('0x60')][_0x0995('0x53')](_0x3c3a3e[_0x0995('0x54')]);}})[_0x0995('0x16')](respondWithResult(_0x4bfb98,null))['catch'](handleError(_0x4bfb98,null));};exports['getDispositions']=function(_0x38f5bb,_0x45872d){var _0x46b1de={'raw':![],'where':{}};var _0x54b7d7={};var _0x53bba2={'count':0x0,'rows':[]};return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x38f5bb[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x45872d,null))['then'](function(_0x55e6c2){if(_0x55e6c2){_0x54b7d7[_0x0995('0x39')]=_['keys'](db[_0x0995('0x60')][_0x0995('0x35')]);_0x54b7d7[_0x0995('0x3d')]=_[_0x0995('0x3a')](_0x38f5bb[_0x0995('0x3d')]);_0x54b7d7[_0x0995('0x3b')]=_['intersection'](_0x54b7d7[_0x0995('0x39')],_0x54b7d7[_0x0995('0x3d')]);_0x46b1de[_0x0995('0x3f')]=_['intersection'](_0x54b7d7[_0x0995('0x39')],qs[_0x0995('0x3e')](_0x38f5bb[_0x0995('0x3d')]['fields']));_0x46b1de[_0x0995('0x3f')]=_0x46b1de[_0x0995('0x3f')][_0x0995('0x51')]?_0x46b1de[_0x0995('0x3f')]:_0x54b7d7[_0x0995('0x39')];if(!_0x38f5bb[_0x0995('0x3d')][_0x0995('0x40')](_0x0995('0x41'))){_0x46b1de[_0x0995('0x26')]=qs[_0x0995('0x26')](_0x38f5bb[_0x0995('0x3d')][_0x0995('0x26')]);_0x46b1de[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x38f5bb['query'][_0x0995('0x25')]);}_0x46b1de['order']=qs[_0x0995('0x43')](_0x38f5bb[_0x0995('0x3d')][_0x0995('0x43')]);_0x46b1de[_0x0995('0x44')]=qs[_0x0995('0x3b')](_[_0x0995('0x45')](_0x38f5bb[_0x0995('0x3d')],_0x54b7d7['filters']));_0x46b1de[_0x0995('0x44')]['ChatWebsiteId']=_0x55e6c2['id'];if(_0x38f5bb['query'][_0x0995('0x46')]){_0x46b1de[_0x0995('0x44')]=_['merge'](_0x46b1de[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x46b1de[_0x0995('0x3f')],function(_0xc66e13){var _0xea61a={};_0xea61a[_0xc66e13]={'$like':'%'+_0x38f5bb[_0x0995('0x3d')]['filter']+'%'};return _0xea61a;})});}_0x46b1de=_['merge']({},_0x46b1de,_0x38f5bb[_0x0995('0x49')]);return db['Disposition'][_0x0995('0x27')]({'where':_0x46b1de['where']})['then'](function(_0x77daf9){_0x53bba2[_0x0995('0x27')]=_0x77daf9;if(_0x38f5bb[_0x0995('0x3d')][_0x0995('0x4a')]){_0x46b1de[_0x0995('0x4b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x46b1de);})[_0x0995('0x16')](function(_0x4bfca1){_0x53bba2[_0x0995('0x4d')]=_0x4bfca1;return _0x53bba2;});}})[_0x0995('0x16')](respondWithFilteredResult(_0x45872d,_0x46b1de))[_0x0995('0x20')](handleError(_0x45872d,null));};exports[_0x0995('0x62')]=function(_0x327d4,_0x16a93){return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x327d4['params']['id']}})['then'](handleEntityNotFound(_0x16a93,null))[_0x0995('0x16')](function(_0xa6b847){if(_0xa6b847){return _0xa6b847[_0x0995('0x62')](_0x327d4[_0x0995('0x3d')][_0x0995('0x63')]);}})[_0x0995('0x16')](respondWithStatusCode(_0x16a93,null))[_0x0995('0x20')](handleError(_0x16a93,null));};exports[_0x0995('0x64')]=function(_0x4e86fe,_0x17b7e2){if(_0x4e86fe[_0x0995('0x54')]['id']){delete _0x4e86fe[_0x0995('0x54')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4e86fe[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x17b7e2,null))[_0x0995('0x16')](function(_0x5434b9){if(_0x5434b9){_0x4e86fe[_0x0995('0x54')]['ChatWebsiteId']=_0x5434b9['id'];return db[_0x0995('0x65')]['create'](_0x4e86fe[_0x0995('0x54')]);}})[_0x0995('0x16')](respondWithResult(_0x17b7e2,null))[_0x0995('0x20')](handleError(_0x17b7e2,null));};exports[_0x0995('0x66')]=function(_0x314c51,_0xf29715){var _0x25c44c={'raw':![],'where':{}};var _0x1e116f={};var _0x43cbaf={'count':0x0,'rows':[]};return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x314c51[_0x0995('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf29715,null))[_0x0995('0x16')](function(_0x11a9c4){if(_0x11a9c4){_0x1e116f['model']=_[_0x0995('0x3a')](db[_0x0995('0x65')][_0x0995('0x35')]);_0x1e116f[_0x0995('0x3d')]=_['keys'](_0x314c51[_0x0995('0x3d')]);_0x1e116f[_0x0995('0x3b')]=_[_0x0995('0x3c')](_0x1e116f[_0x0995('0x39')],_0x1e116f[_0x0995('0x3d')]);_0x25c44c[_0x0995('0x3f')]=_[_0x0995('0x3c')](_0x1e116f[_0x0995('0x39')],qs['fields'](_0x314c51[_0x0995('0x3d')][_0x0995('0x3e')]));_0x25c44c['attributes']=_0x25c44c[_0x0995('0x3f')][_0x0995('0x51')]?_0x25c44c['attributes']:_0x1e116f['model'];if(!_0x314c51[_0x0995('0x3d')]['hasOwnProperty'](_0x0995('0x41'))){_0x25c44c['limit']=qs[_0x0995('0x26')](_0x314c51['query'][_0x0995('0x26')]);_0x25c44c[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x314c51[_0x0995('0x3d')][_0x0995('0x25')]);}_0x25c44c[_0x0995('0x42')]=qs[_0x0995('0x43')](_0x314c51[_0x0995('0x3d')]['sort']);_0x25c44c[_0x0995('0x44')]=qs['filters'](_[_0x0995('0x45')](_0x314c51['query'],_0x1e116f['filters']));_0x25c44c[_0x0995('0x44')][_0x0995('0x5f')]=_0x11a9c4['id'];if(_0x314c51[_0x0995('0x3d')][_0x0995('0x46')]){_0x25c44c[_0x0995('0x44')]=_[_0x0995('0x48')](_0x25c44c[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x25c44c[_0x0995('0x3f')],function(_0x1a322b){var _0x233ccb={};_0x233ccb[_0x1a322b]={'$like':'%'+_0x314c51['query'][_0x0995('0x46')]+'%'};return _0x233ccb;})});}_0x25c44c=_['merge']({},_0x25c44c,_0x314c51[_0x0995('0x49')]);return db[_0x0995('0x65')][_0x0995('0x27')]({'where':_0x25c44c[_0x0995('0x44')]})[_0x0995('0x16')](function(_0x4c09bf){_0x43cbaf[_0x0995('0x27')]=_0x4c09bf;if(_0x314c51[_0x0995('0x3d')][_0x0995('0x4a')]){_0x25c44c[_0x0995('0x4b')]=[{'all':!![]}];}return db[_0x0995('0x65')][_0x0995('0x4c')](_0x25c44c);})[_0x0995('0x16')](function(_0x603637){_0x43cbaf[_0x0995('0x4d')]=_0x603637;return _0x43cbaf;});}})[_0x0995('0x16')](respondWithFilteredResult(_0xf29715,_0x25c44c))[_0x0995('0x20')](handleError(_0xf29715,null));};exports[_0x0995('0x67')]=function(_0x84db20,_0x1b373e){return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x84db20[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x1b373e,null))[_0x0995('0x16')](function(_0x309909){if(_0x309909){return _0x309909[_0x0995('0x67')](_0x84db20[_0x0995('0x3d')][_0x0995('0x63')]);}})[_0x0995('0x16')](respondWithStatusCode(_0x1b373e,null))[_0x0995('0x20')](handleError(_0x1b373e,null));};exports[_0x0995('0x68')]=function(_0x719b84,_0x19e8ba){_0x719b84['body'][_0x0995('0x69')]=_0x719b84[_0x0995('0x6a')]['filename'];return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x719b84['params']['id']}})['then'](handleEntityNotFound(_0x19e8ba,null))[_0x0995('0x16')](saveUpdates(_0x719b84[_0x0995('0x54')],null))['then'](respondWithResult(_0x19e8ba,null))[_0x0995('0x20')](handleError(_0x19e8ba,null));};exports[_0x0995('0x6b')]=function(_0x117b55,_0xf898f4){_0x117b55[_0x0995('0x54')][_0x0995('0x6c')]=_0x117b55[_0x0995('0x6a')][_0x0995('0x6d')];return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x117b55[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0xf898f4,null))[_0x0995('0x16')](saveUpdates(_0x117b55[_0x0995('0x54')],null))[_0x0995('0x16')](respondWithResult(_0xf898f4,null))[_0x0995('0x20')](handleError(_0xf898f4,null));};exports['addCustomerAvatar']=function(_0x40ccf7,_0x2846a9){_0x40ccf7['body'][_0x0995('0x6e')]=_0x40ccf7[_0x0995('0x6a')]['filename'];return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x40ccf7[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x2846a9,null))[_0x0995('0x16')](saveUpdates(_0x40ccf7['body'],null))[_0x0995('0x16')](respondWithResult(_0x2846a9,null))[_0x0995('0x20')](handleError(_0x2846a9,null));};exports[_0x0995('0x6f')]=function(_0xe48eb3,_0x381bf4){_0xe48eb3[_0x0995('0x54')][_0x0995('0x70')]=_0xe48eb3[_0x0995('0x6a')]['filename'];return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0xe48eb3[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x381bf4,null))[_0x0995('0x16')](saveUpdates(_0xe48eb3['body'],null))[_0x0995('0x16')](respondWithResult(_0x381bf4,null))[_0x0995('0x20')](handleError(_0x381bf4,null));};exports[_0x0995('0x71')]=function(_0x2fff47,_0x496b8f){var _0x33a09a=path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x74'));var _0xa19a33={'where':{'id':_0x2fff47[_0x0995('0x4f')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2f6458=![];return require(_0x0995('0x75'))[_0x0995('0x76')]()['then'](function(_0x652703){if(_0x652703){_0x2f6458=_0x652703['custom'];}})[_0x0995('0x16')](function(){return db[_0x0995('0x34')][_0x0995('0x52')](_0xa19a33);})[_0x0995('0x16')](handleEntityNotFound(_0x496b8f,null))[_0x0995('0x16')](function(_0xcb7400){if(_0xcb7400){if(!_[_0x0995('0x77')](_0xcb7400[_0x0995('0x69')])){if(fs['existsSync'](path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x78'),_0xcb7400[_0x0995('0x69')]))&&_0x2f6458){_0x33a09a=path[_0x0995('0x72')](config[_0x0995('0x73')],'server/files/images/logos/',_0xcb7400['sitepic']);}}return _0x496b8f[_0x0995('0x79')](_0x33a09a);}})[_0x0995('0x20')](handleError(_0x496b8f,null));};exports[_0x0995('0x7a')]=function(_0x31434d,_0x230247){var _0x45df16=path['join'](config[_0x0995('0x73')],_0x0995('0x7b'));var _0x4795b6={'where':{'id':_0x31434d[_0x0995('0x4f')]['id']},'attributes':['id',_0x0995('0x6c')],'raw':!![]};return db[_0x0995('0x34')][_0x0995('0x52')](_0x4795b6)[_0x0995('0x16')](handleEntityNotFound(_0x230247,null))[_0x0995('0x16')](function(_0x4f8118){if(_0x4f8118){if(!_[_0x0995('0x77')](_0x4f8118['agentAvatar'])){if(fs[_0x0995('0x7c')](path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x7d'),_0x4f8118[_0x0995('0x6c')]))){_0x45df16=path[_0x0995('0x72')](config[_0x0995('0x73')],'server/files/images/avatars/',_0x4f8118[_0x0995('0x6c')]);}}return _0x230247[_0x0995('0x79')](_0x45df16);}})['catch'](handleError(_0x230247,null));};exports[_0x0995('0x7e')]=function(_0x4583f0,_0x503556){var _0x19908c=path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x7f'));var _0x3b2029={'where':{'id':_0x4583f0[_0x0995('0x4f')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x0995('0x52')](_0x3b2029)[_0x0995('0x16')](handleEntityNotFound(_0x503556,null))[_0x0995('0x16')](function(_0x2418b0){if(_0x2418b0){if(!_['isNil'](_0x2418b0[_0x0995('0x6e')])){if(fs[_0x0995('0x7c')](path['join'](config[_0x0995('0x73')],_0x0995('0x7d'),_0x2418b0[_0x0995('0x6e')]))&&_0x2418b0[_0x0995('0x80')]){_0x19908c=path[_0x0995('0x72')](config[_0x0995('0x73')],'server/files/images/avatars/',_0x2418b0['customerAvatar']);}}return _0x503556[_0x0995('0x79')](_0x19908c);}})[_0x0995('0x20')](handleError(_0x503556,null));};exports[_0x0995('0x81')]=function(_0x50f258,_0x40fa93){var _0x430e4b=path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x82'));var _0x3db31f={'where':{'id':_0x50f258[_0x0995('0x4f')]['id']},'attributes':['id',_0x0995('0x70')],'raw':!![]};return db[_0x0995('0x34')][_0x0995('0x52')](_0x3db31f)[_0x0995('0x16')](handleEntityNotFound(_0x40fa93,null))[_0x0995('0x16')](function(_0x301761){if(_0x301761){if(!_[_0x0995('0x77')](_0x301761[_0x0995('0x70')])){if(fs[_0x0995('0x7c')](path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x7d'),_0x301761[_0x0995('0x70')]))){_0x430e4b=path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x7d'),_0x301761['systemAvatar']);}}return _0x40fa93[_0x0995('0x79')](_0x430e4b);}})['catch'](handleError(_0x40fa93,null));};exports[_0x0995('0x83')]=function(_0x488c95,_0x1fa5e3){var _0x152c80=require(_0x0995('0x84'));var _0x3b89d3=new _0x152c80();var _0x1310e8=_0x3b89d3[_0x0995('0x85')](_0x488c95['headers'][_0x0995('0x86')])[_0x0995('0x87')]();var _0x40dc48={'body':_0x488c95[_0x0995('0x54')],'channel':_0x0995('0x88')};var _0x52477b=[];var _0x3cac0f=[];var _0x482f59={};var _0x16620a=![];return db[_0x0995('0x89')][_0x0995('0x5d')]()['then'](function(_0x380972){if(!_0x380972){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))](_0x0995('0x8c'));}_0x52477b=_[_0x0995('0x8d')](_['keys'](_0x380972),[_0x0995('0x8e'),_0x0995('0x8f')]);_0x3cac0f=_['difference'](_[_0x0995('0x3a')](_0x380972),[_0x0995('0x8e'),_0x0995('0x8f'),'CompanyId','ListId']);if(_0x488c95[_0x0995('0x54')]['id']){delete _0x488c95[_0x0995('0x54')]['id'];}if(_[_0x0995('0x77')](_0x488c95[_0x0995('0x54')][_0x0995('0x90')])){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))]('from\x20is\x20mandatory');}if(_[_0x0995('0x77')](_0x488c95[_0x0995('0x54')][_0x0995('0x54')])||_0x488c95[_0x0995('0x54')][_0x0995('0x54')]===''){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x488c95[_0x0995('0x54')][_0x0995('0x91')])){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))](_0x0995('0x92')+_0x3cac0f);}if(!_[_0x0995('0x93')](_0x3cac0f,_0x488c95[_0x0995('0x54')][_0x0995('0x91')])){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cac0f);}_0x482f59[_0x488c95[_0x0995('0x54')][_0x0995('0x91')]]=_0x488c95[_0x0995('0x54')]['from'];})[_0x0995('0x16')](function(){return db[_0x0995('0x34')]['find']({'where':{'id':_0x488c95['params']['id']},'include':[{'model':db[_0x0995('0x94')],'as':_0x0995('0x95'),'include':[{'model':db['CmContact'],'as':_0x0995('0x96'),'where':_0x482f59,'limit':0x1,'order':[['updatedAt',_0x0995('0x97')]]}]},{'model':db[_0x0995('0x98')],'as':_0x0995('0x99')}]});})[_0x0995('0x16')](handleEntityNotFound(_0x1fa5e3,null))[_0x0995('0x16')](function(_0x1b56a5){if(_0x1b56a5&&_0x1b56a5[_0x0995('0x95')]){_0x40dc48[_0x0995('0x9a')]=_0x1b56a5;_0x40dc48['applications']=_0x1b56a5[_0x0995('0x99')];_0x40dc48['list']=_0x1b56a5[_0x0995('0x95')];_0x40dc48['applications']=_['orderBy'](_0x40dc48[_0x0995('0x9b')],[_0x0995('0x9c')],[_0x0995('0x9d')]);if(_0x40dc48[_0x0995('0x9a')][_0x0995('0x99')]){delete _0x40dc48['account'][_0x0995('0x99')];}if(_0x40dc48[_0x0995('0x9a')]['List']&&_0x40dc48[_0x0995('0x9a')]['List'][_0x0995('0x96')]['length']){return _0x40dc48['account']['List'][_0x0995('0x96')][0x0];}var _0x44d2a4=_[_0x0995('0xb')](_0x488c95[_0x0995('0x54')],{'firstName':_0x488c95['body']['from'],'ListId':_0x1b56a5[_0x0995('0x9e')]});_0x44d2a4[_0x488c95['body']['mapKey']]=_0x488c95[_0x0995('0x54')][_0x0995('0x90')];return db[_0x0995('0x89')][_0x0995('0x53')](_0x44d2a4,{'fields':_0x52477b,'raw':!![]});}})['then'](handleEntityNotFound(_0x1fa5e3,null))[_0x0995('0x16')](function(_0x4310c8){_0x40dc48[_0x0995('0x9f')]=_0x4310c8;var _0x9ae2a0=_0x488c95['body'][_0x0995('0xa0')];if(_0x488c95[_0x0995('0xa1')][_0x0995('0xa2')]){_0x9ae2a0=_0x488c95['headers']['cf-connecting-ip'];}else if(_0x488c95['headers'][_0x0995('0xa3')]){_0x9ae2a0=_[_0x0995('0xa4')](_0x488c95[_0x0995('0xa1')]['x-forwarded-for'][_0x0995('0xa5')](','));}if(_0x4310c8){var _0x9f2a71={'ContactId':_0x4310c8['id'],'ChatWebsiteId':_0x488c95[_0x0995('0x4f')]['id'],'from':(_0x4310c8[_0x0995('0xa6')]||'')+'\x20'+(_0x4310c8[_0x0995('0xa7')]||''),'customerIp':_0x9ae2a0,'customerPort':_0x488c95[_0x0995('0xa1')]['x-real-port']?_0x488c95[_0x0995('0xa1')][_0x0995('0xa8')]:null,'referer':_0x488c95[_0x0995('0x54')][_0x0995('0xa9')],'browserName':_0x1310e8[_0x0995('0xaa')][_0x0995('0x2f')]&&_0x1310e8[_0x0995('0xaa')][_0x0995('0xab')]?util[_0x0995('0xac')](_0x0995('0xad'),_0x1310e8[_0x0995('0xaa')][_0x0995('0x2f')],_0x1310e8[_0x0995('0xaa')][_0x0995('0xab')]):_0x0995('0xae'),'browserVersion':_0x1310e8[_0x0995('0xaa')][_0x0995('0xab')]||'unknown','osName':util['format'](_0x0995('0xad'),_0x1310e8['os'][_0x0995('0x2f')],_0x1310e8['os'][_0x0995('0xab')]),'osVersion':_0x1310e8['os']['version'],'deviceModel':_0x1310e8[_0x0995('0xaf')][_0x0995('0x39')]&&_0x1310e8['device'][_0x0995('0xb0')]?util[_0x0995('0xac')](_0x0995('0xb1'),_0x1310e8[_0x0995('0xaf')][_0x0995('0x39')],_0x1310e8['device']['vendor'],_0x1310e8['device'][_0x0995('0x37')]):null,'deviceVendor':_0x1310e8[_0x0995('0xaf')]['vendor'],'deviceType':_0x1310e8['device']['type'],'formData':JSON[_0x0995('0xb2')](_0x488c95[_0x0995('0x54')])};var _0x399870={'ChatWebsiteId':_0x488c95[_0x0995('0x4f')]['id'],'closed':![]};if(_0x488c95[_0x0995('0x54')][_0x0995('0xb3')]){_0x399870[_0x0995('0xb3')]=_0x488c95[_0x0995('0x54')]['threadId'];return db[_0x0995('0xb4')][_0x0995('0x52')]({'where':_0x399870})['then'](function(_0x4734ec){if(_0x4734ec){return[_0x4734ec,![]];}_0x9f2a71['threadId']=_0x488c95[_0x0995('0x54')][_0x0995('0xb3')];_0x9f2a71[_0x0995('0xb5')]=_0x488c95[_0x0995('0x54')]['externalUrl'];return db[_0x0995('0xb4')][_0x0995('0x53')](_0x9f2a71)[_0x0995('0x16')](function(_0x244380){return[_0x244380,!![]];});});}_0x399870[_0x0995('0xb6')]=_0x4310c8['id'];if(_0x488c95[_0x0995('0x54')]['interaction']&&_0x488c95[_0x0995('0x54')]['interaction']['id']){_0x399870['id']=_0x488c95[_0x0995('0x54')]['interaction']['id'];return db[_0x0995('0xb4')]['find']({'where':_0x399870})[_0x0995('0x16')](function(_0x21c255){if(_0x21c255){return[_0x21c255,![]];}return db[_0x0995('0xb4')][_0x0995('0x53')](_0x9f2a71)['then'](function(_0x4f448c){return[_0x4f448c,!![]];});});}return db[_0x0995('0xb4')][_0x0995('0x53')](_0x9f2a71)[_0x0995('0x16')](function(_0x4c05ba){return[_0x4c05ba,!![]];});}})[_0x0995('0xb7')](function(_0x5d73c6,_0x449498){if(_0x5d73c6){_0x16620a=_0x449498;if(!_0x449498){var _0x151679={'from':(_0x40dc48[_0x0995('0x9f')]['firstName']||'')+'\x20'+(_0x40dc48[_0x0995('0x9f')][_0x0995('0xa7')]||'')};if(_0x488c95[_0x0995('0x54')][_0x0995('0xb3')]&&_0x488c95[_0x0995('0x54')]['messageId']&&_0x488c95[_0x0995('0x54')][_0x0995('0xb3')]!=_0x488c95['body'][_0x0995('0xb8')]){_0x151679[_0x0995('0xb3')]=_0x488c95['body'][_0x0995('0xb8')];}return _0x5d73c6['update'](_0x151679);}else{return _0x5d73c6;}}})[_0x0995('0x16')](function(_0x6ce0d1){_0x40dc48['interaction']=_0x6ce0d1[_0x0995('0x2c')]({'plain':!![]});_0x40dc48[_0x0995('0xb9')][_0x0995('0xba')]=_0x16620a;if(_0x40dc48['interaction']['created']){if(_0x40dc48['account']['autoclose']){_0x40dc48[_0x0995('0x9b')][_0x0995('0xbb')]({'id':0x0,'priority':_0x40dc48[_0x0995('0x9b')][_0x0995('0x51')]+0x1,'app':_0x0995('0xbc'),'appdata':_0x0995('0xbd'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x0995('0x53')]({'body':_0x488c95[_0x0995('0x54')][_0x0995('0x54')],'ChatWebsiteId':_0x488c95[_0x0995('0x4f')]['id'],'ChatInteractionId':_0x6ce0d1['id'],'direction':'in','ContactId':_0x40dc48[_0x0995('0x9f')]['id'],'AttachmentId':_0x488c95['body']['AttachmentId']});})[_0x0995('0x16')](function(_0xb0953e){_0x40dc48['message']=_0xb0953e;if(_0x40dc48['interaction'][_0x0995('0xbe')]){return db[_0x0995('0xbf')][_0x0995('0x52')]({'attributes':['id','name'],'where':{'id':_0x40dc48[_0x0995('0xb9')][_0x0995('0xbe')]}})[_0x0995('0x16')](function(_0x5a3606){if(_0x5a3606){_0x40dc48[_0x0995('0x9b')][_0x0995('0xc0')]({'id':0x0,'priority':0x0,'app':_0x0995('0xc1'),'appdata':_0x5a3606['name']+','+(_0x40dc48[_0x0995('0x9a')][_0x0995('0xc2')]||0xa),'interval':'*,*,*,*'});_0x40dc48[_0x0995('0xc3')]=!![];}return respondWithRpcPromise(_0x0995('0xc4'),'startRouting',_0x40dc48);});}return respondWithRpcPromise(_0x0995('0xc4'),_0x0995('0xc5'),_0x40dc48);})[_0x0995('0x16')](function(_0x443d23){respondWithRpcPromise(_0x0995('0xc6'),_0x0995('0xc6'),{'event':'notify','message':_0x443d23},client9002);return _0x443d23;})[_0x0995('0x16')](respondWithResult(_0x1fa5e3,null))[_0x0995('0x20')](handleError(_0x1fa5e3,null));};exports[_0x0995('0xc7')]=function(_0x3f021,_0x439a0e){var _0x44d02f,_0x505e47,_0x51f60d;var _0x5a6b3c=[];var _0x491704={};var _0x1eaa0a=_0x3f021[_0x0995('0xc8')]||[];var _0x562a5c=[];var _0x5ad9f1;return db['CmContact'][_0x0995('0x5d')]()[_0x0995('0x16')](function(_0x31dc3c){if(!_0x31dc3c){throw new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))]('no\x20available\x20attributes');}_0x5a6b3c=_[_0x0995('0x8d')](_[_0x0995('0x3a')](_0x31dc3c),[_0x0995('0x8e'),_0x0995('0x8f'),_0x0995('0xc9'),_0x0995('0x9e')]);if(_0x3f021[_0x0995('0x54')]['id']){delete _0x3f021[_0x0995('0x54')]['id'];}if(_[_0x0995('0x77')](_0x3f021[_0x0995('0x54')][_0x0995('0x90')])){throw _0x439a0e[_0x0995('0x22')](0x1f4)[_0x0995('0x30')](new db['Sequelize']['ValidationError'](_0x0995('0xca')));}if(_['isNil'](_0x3f021[_0x0995('0x54')][_0x0995('0x54')])||_0x3f021['body']['body']===''){throw _0x439a0e['status'](0x1f4)['send'](new db['Sequelize'][(_0x0995('0x8b'))](_0x0995('0xcb')));}if(_[_0x0995('0x77')](_0x3f021[_0x0995('0x54')][_0x0995('0xcc')])){throw _0x439a0e[_0x0995('0x22')](0x1f4)[_0x0995('0x30')](new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))](_0x0995('0xcd')+_0x5a6b3c));}if(!_[_0x0995('0x93')](_0x5a6b3c,_0x3f021[_0x0995('0x54')]['mapKeyOffline'])){throw _0x439a0e[_0x0995('0x22')](0x1f4)[_0x0995('0x30')](new db[(_0x0995('0x8a'))][(_0x0995('0x8b'))](_0x0995('0xce')+_0x5a6b3c));}_0x491704[_0x3f021[_0x0995('0x54')][_0x0995('0xcc')]]=_0x3f021[_0x0995('0x54')][_0x0995('0x90')];})[_0x0995('0x16')](function(){return db['ChatWebsite'][_0x0995('0x52')]({'where':{'id':_0x3f021['params']['id']},'include':[{'model':db['CmList'],'as':_0x0995('0x95')},{'model':db[_0x0995('0xcf')],'as':_0x0995('0xcf')}]});})['then'](handleEntityNotFound(_0x439a0e,null))[_0x0995('0x16')](function(_0x5a0b7d){if(_0x5a0b7d&&_0x5a0b7d[_0x0995('0x95')]){_0x505e47=_0x5a0b7d;var _0x28cfd1=_[_0x0995('0xb')](_0x3f021[_0x0995('0x54')],{'firstName':_0x3f021['body'][_0x0995('0x90')],'phone':_0x3f021['body'][_0x0995('0x90')],'ListId':_0x5a0b7d[_0x0995('0x9e')]});_0x28cfd1[_0x3f021[_0x0995('0x54')]['mapKeyOffline']]=_0x3f021['body'][_0x0995('0x90')];return db[_0x0995('0x89')][_0x0995('0xd0')]({'where':_0x491704,'defaults':_0x28cfd1});}})['spread'](function(_0x2ad27e){if(_0x2ad27e){_0x51f60d=_0x2ad27e;var _0x2aee0c=fs[_0x0995('0xd1')](path['join'](config['root'],_0x0995('0xd2')),_0x0995('0xd3'));var _0x198387=ejs[_0x0995('0xd4')](_0x2aee0c,{'body':_[_0x0995('0xd5')](_0x3f021[_0x0995('0x54')][_0x0995('0x54')]),'bodyTitle':_0x505e47[_0x0995('0xd6')]});return db[_0x0995('0xd7')][_0x0995('0x53')]({'body':_0x198387,'plainBody':htmlToText['fromString'](_0x198387),'ContactId':_0x2ad27e['id'],'ChatWebsiteId':_0x505e47['id']});}})[_0x0995('0x16')](function(_0x41438f){_0x5ad9f1=_0x41438f;if(_0x1eaa0a[_0x0995('0x51')]){var _0x9f5865=_0x1eaa0a[_0x0995('0x33')](function(_0x32fed7){return{'name':_0x32fed7[_0x0995('0xd8')],'basename':_0x32fed7[_0x0995('0x6d')],'type':_0x32fed7[_0x0995('0xd9')],'ChatOfflineMessageId':_0x41438f['id']};});_0x562a5c=_0x9f5865[_0x0995('0x33')](_0x377a07=>{var _0x31adc3={'filename':_0x377a07['name'],'path':path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0xda'),_0x0995('0xc8'),_0x0995('0xdb'),_0x0995('0xdc'),_0x377a07[_0x0995('0xdd')])};return _0x31adc3;});if(!_0x505e47[_0x0995('0xde')]){return db[_0x0995('0xdf')]['transaction'](function(_0xa81b73){return db[_0x0995('0xe0')]['bulkCreate'](_0x9f5865,{'transaction':_0xa81b73});});}}})[_0x0995('0x16')](function(){if(_0x5ad9f1){_0x44d02f=_0x5ad9f1;return db[_0x0995('0xcf')][_0x0995('0x61')]({'where':{'service':!![]},'include':[{'model':db[_0x0995('0xe1')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0995('0xe2'),'raw':!![]}]}]});}})[_0x0995('0x16')](function(_0x258932){if(_0x258932&&_0x258932[_0x0995('0xe3')]&&_0x505e47[_0x0995('0xe4')]&&_0x505e47[_0x0995('0xe5')]){var _0x4f6e41=_0x258932[_0x0995('0xe6')]();return respondWithRpcPromise('SendMail',_0x0995('0xe7'),{'account':_0x4f6e41,'message':{'from':util[_0x0995('0xac')](_0x0995('0xe8'),_0x258932[_0x0995('0x2f')],_0x258932[_0x0995('0xe9')]||_0x258932[_0x0995('0xe3')]['user']),'to':_0x505e47[_0x0995('0xe5')],'subject':_0x505e47[_0x0995('0xea')],'html':_0x44d02f[_0x0995('0x54')],'attachments':_0x562a5c}},client9003)[_0x0995('0x16')](function(){return _0x44d02f;})['catch'](function(_0x1c3abf){logger[_0x0995('0x1c')](_0x1c3abf);});}})[_0x0995('0x16')](function(){if(_0x505e47&&_0x505e47[_0x0995('0xde')]&&_0x505e47[_0x0995('0xeb')]){var _0x59a52a=[];if(_0x1eaa0a[_0x0995('0x51')]){_0x59a52a=_0x1eaa0a[_0x0995('0x33')](function(_0x3c12e7){return{'name':_0x3c12e7['originalname'],'basename':_0x3c12e7['filename'],'type':_0x3c12e7[_0x0995('0xd9')],'ChatOfflineMessageId':_0x5ad9f1['id']};});}var _0x7f0308;if(!_['isNil'](_0x505e47[_0x0995('0xec')])){var _0x65d8e4=_[_0x0995('0x33')](_0x3f021[_0x0995('0x54')],function(_0x4133ca){return _0x4133ca;});var _0x45733e=_[_0x0995('0xed')](_0x65d8e4)[0x0];var _0x3bc86f=_['mapValues'](_0x45733e,function(_0x232b54){return _0x232b54;});_0x7f0308=_0x3bc86f[0x1][_0x505e47[_0x0995('0xec')]];}var _0x4df270={'from':_0x51f60d[_0x0995('0xe9')],'firstName':_0x51f60d['firstName'],'lastName':_0x51f60d['lastName'],'mapKey':_0x0995('0xe9'),'message':{'from':_0x51f60d[_0x0995('0xe9')],'to':_0x505e47['MailAccount'][_0x0995('0xe9')],'cc':'','subject':_[_0x0995('0x77')](_0x7f0308)?_0x505e47['offlineMessageSubject']:_0x7f0308,'messageId':'','sentAt':new Date(),'attach':_0x59a52a[_0x0995('0x51')],'attachments':_0x59a52a,'originChannel':_0x0995('0xee'),'ChatWebsiteId':_0x505e47['id'],'ChatOfflineMessageId':_0x44d02f['id'],'originTo':_0x505e47[_0x0995('0xcf')][_0x0995('0xe9')]},'body':_0x44d02f[_0x0995('0x54')]};var _0x7ad903={'account':{'id':_0x505e47[_0x0995('0xeb')]},'body':_0x4df270,'log':_0x0995('0xef')};return respondWithRpcPromise(_0x0995('0xef'),'notifyMail',_0x7ad903,client9001)[_0x0995('0x16')](function(){return _0x44d02f;})['catch'](function(_0x25a768){logger[_0x0995('0x1c')](_0x25a768);});}return;})[_0x0995('0x16')](function(){if(_0x44d02f){return _0x44d02f;}})[_0x0995('0x16')](respondWithResult(_0x439a0e,null))[_0x0995('0x20')](function(_0x4a8ae6){logger[_0x0995('0x1c')](_0x0995('0x20'),_0x4a8ae6);for(var _0x3c0f15 of _0x1eaa0a){var _0x39b7ef=path['join'](config['root'],_0x0995('0xda'),_0x0995('0xc8'),'attachments',_0x0995('0xdc'),_0x3c0f15[_0x0995('0x6d')]);fs_extra[_0x0995('0xf0')](_0x39b7ef)[_0x0995('0x20')](function(_0x514bc2){logger['error'](_0x0995('0xf1'),_0x39b7ef,_0x514bc2);});}});};exports[_0x0995('0xf2')]=function(_0x1000e7,_0x455100){return db[_0x0995('0xb4')][_0x0995('0x52')]({'where':{'id':_0x1000e7['params']['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x455100,null))[_0x0995('0x16')](function(_0x52e165){if(_0x52e165){return _0x52e165[_0x0995('0xf2')](_0x1000e7[_0x0995('0x54')][_0x0995('0x63')],_[_0x0995('0xf3')](_0x1000e7[_0x0995('0x54')],[_0x0995('0x63'),'id'])||{});}})[_0x0995('0x16')](respondWithResult(_0x455100,null))['catch'](handleError(_0x455100,null));};exports[_0x0995('0xf4')]=function(_0x4c0a25,_0x5a97bf){var _0x158eef={'raw':![],'where':{}};var _0x852fbd={};var _0xf5d0d1={'count':0x0,'rows':[]};return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x4c0a25[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x5a97bf,null))[_0x0995('0x16')](function(_0xb8d74f){if(_0xb8d74f){_0x852fbd[_0x0995('0x39')]=_[_0x0995('0x3a')](db[_0x0995('0xb4')][_0x0995('0x35')]);_0x852fbd[_0x0995('0x3d')]=_['keys'](_0x4c0a25[_0x0995('0x3d')]);_0x852fbd['filters']=_[_0x0995('0x3c')](_0x852fbd[_0x0995('0x39')],_0x852fbd[_0x0995('0x3d')]);_0x158eef[_0x0995('0x3f')]=_[_0x0995('0x3c')](_0x852fbd['model'],qs[_0x0995('0x3e')](_0x4c0a25['query'][_0x0995('0x3e')]));_0x158eef[_0x0995('0x3f')]=_0x158eef['attributes'][_0x0995('0x51')]?_0x158eef['attributes']:_0x852fbd['model'];if(!_0x4c0a25['query'][_0x0995('0x40')](_0x0995('0x41'))){_0x158eef[_0x0995('0x26')]=qs[_0x0995('0x26')](_0x4c0a25[_0x0995('0x3d')][_0x0995('0x26')]);_0x158eef[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x4c0a25[_0x0995('0x3d')][_0x0995('0x25')]);}_0x158eef[_0x0995('0x42')]=qs[_0x0995('0x43')](_0x4c0a25[_0x0995('0x3d')][_0x0995('0x43')]);_0x158eef[_0x0995('0x44')]=qs['filters'](_[_0x0995('0x45')](_0x4c0a25['query'],_0x852fbd['filters']));_0x158eef[_0x0995('0x44')]['ChatWebsiteId']=_0xb8d74f['id'];if(_0x4c0a25[_0x0995('0x3d')]['filter']){_0x158eef[_0x0995('0x44')]=_[_0x0995('0x48')](_0x158eef[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x158eef[_0x0995('0x3f')],function(_0x47ba4a){var _0x28c8d0={};_0x28c8d0[_0x47ba4a]={'$like':'%'+_0x4c0a25[_0x0995('0x3d')]['filter']+'%'};return _0x28c8d0;})});}_0x158eef=_[_0x0995('0x48')]({},_0x158eef,_0x4c0a25[_0x0995('0x49')]);return db[_0x0995('0xb4')][_0x0995('0x27')]({'where':_0x158eef[_0x0995('0x44')]})[_0x0995('0x16')](function(_0x2c1b08){_0xf5d0d1[_0x0995('0x27')]=_0x2c1b08;if(_0x4c0a25['query'][_0x0995('0x4a')]){_0x158eef['include']=[{'model':db[_0x0995('0x89')],'as':_0x0995('0xf5'),'required':![]},{'model':db[_0x0995('0xbf')],'as':_0x0995('0xf6'),'attributes':[_0x0995('0x2f'),'fullname',_0x0995('0xf7')],'required':![]},{'model':db[_0x0995('0xf8')],'as':_0x0995('0xf9'),'attributes':['id',_0x0995('0x2f'),_0x0995('0xfa')],'where':_0x4c0a25['query'][_0x0995('0xfb')]?{'id':_0x4c0a25[_0x0995('0x3d')]['tag']}:undefined,'required':_0x4c0a25[_0x0995('0x3d')]['tag']?!![]:![]}];}return db[_0x0995('0xb4')]['findAll'](_0x158eef);})[_0x0995('0x16')](function(_0x2d70b2){_0xf5d0d1[_0x0995('0x4d')]=_0x2d70b2;return _0xf5d0d1;});}})[_0x0995('0x16')](respondWithFilteredResult(_0x5a97bf,_0x158eef))[_0x0995('0x20')](handleError(_0x5a97bf,null));};function iftimePromise(_0x4ed0d0,_0x30f9f6){return respondWithRpcPromise(_0x0995('0xfc'),'getSnippet',{'command':_0x30f9f6['timezone']?util['format'](_0x0995('0xfd'),_0x4ed0d0[_0x0995('0xfe')],_0x30f9f6['timezone']):util[_0x0995('0xac')](_0x0995('0xff'),_0x4ed0d0['interval'])},client9002)[_0x0995('0x16')](function(_0x51dbd5){var _0x49b3a1=_0x51dbd5&&_0x51dbd5[_0x0995('0x100')](_0x0995('0x101'))>=0x0?!![]:![];logger[_0x0995('0x17')](_0x0995('0x102'),_0x30f9f6['id'],_0x4ed0d0['id'],_0x4ed0d0['interval'],_0x49b3a1?_0x0995('0x103'):_0x0995('0x104'),_0x30f9f6[_0x0995('0x105')]?_0x30f9f6['timezone']:'No\x20timezone');return _0x49b3a1;})[_0x0995('0x20')](function(_0x3f71c2){logger[_0x0995('0x1c')](_0x0995('0x102'),_0x30f9f6['id'],_0x4ed0d0['id'],_0x4ed0d0[_0x0995('0xfe')],util[_0x0995('0x106')](_0x3f71c2,{'showHidden':![],'depth':null}),_0x30f9f6[_0x0995('0x105')]?_0x30f9f6[_0x0995('0x105')]:'No\x20timezone');return![];});}exports[_0x0995('0x107')]=function(_0x588c6d,_0x16acfd){var _0x4d9176=0x0;var _0x2360d5=0x0;var _0x3ff34e=![];var _0x47d801;var _0x3058c5;return db[_0x0995('0x34')]['find']({'where':{'id':_0x588c6d['params']['id']},'include':[{'model':db['Interval'],'as':_0x0995('0x108'),'include':[{'model':db[_0x0995('0x108')],'as':_0x0995('0x109'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x0995('0x16')](handleEntityNotFound(_0x16acfd,null))[_0x0995('0x16')](function(_0x4b6198){if(_0x4b6198){_0x47d801=_0x4b6198;return _0x4b6198[_0x0995('0x10a')]({'raw':!![]});}})['then'](function(_0x2e3849){if(_0x47d801){if(_0x2e3849){_0x3058c5=_0x2e3849;}}return require('../../config/license/util')['getLicense']();})[_0x0995('0x16')](function(_0x4e5762){if(_0x4e5762){_0x2360d5=_0x4e5762[_0x0995('0x10b')];_0x3ff34e=_0x4e5762[_0x0995('0x10c')];}})['then'](function(){return db[_0x0995('0xb4')][_0x0995('0x27')]({'where':{'closed':![]}});})['then'](function(_0x15f1a8){_0x4d9176=_0x15f1a8;if(_0x2360d5&&_0x15f1a8>_0x2360d5){return db[_0x0995('0x10d')][_0x0995('0x61')]({'where':{'id':0x1}})['then'](function(_0x5852ed){if(_0x5852ed){_0x5852ed[_0x0995('0x10e')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x47d801['Interval']&&_0x47d801[_0x0995('0x108')][_0x0995('0x109')]){var _0x34dc27=[];for(var _0x53a6b8=0x0;_0x53a6b8<_0x47d801['Interval']['Intervals'][_0x0995('0x51')];_0x53a6b8++){var _0x39dff7=_0x47d801[_0x0995('0x108')][_0x0995('0x109')][_0x53a6b8][_0x0995('0x2c')]({'plain':!![]});_0x34dc27[_0x0995('0xbb')](iftimePromise(_0x39dff7,_0x47d801));}return BPromise[_0x0995('0x10f')](_0x34dc27)[_0x0995('0x16')](function(_0x560f7e){return _['some'](_0x560f7e);});}else{return!![];}})[_0x0995('0x16')](function(_0x13fa23){var _0x332fb4=fs['readFileSync'](path[_0x0995('0x72')](config[_0x0995('0x73')],_0x0995('0x110')),'utf8');var _0x4b8035=new url[(_0x0995('0x111'))](_0x47d801[_0x0995('0x112')])[_0x0995('0x113')];var _0x5258a8='3.1.0';var _0x414f37=![];var _0x335f57={'chatVersion':_0x5258a8,'chatWebsiteAddressOrigin':_0x4b8035,'remote':_0x47d801[_0x0995('0x114')],'query':querystring[_0x0995('0xb2')](_['merge'](_0x47d801['get']({'plain':!![]}),{'customerIp':_0x588c6d[_0x0995('0xa1')][_0x0995('0xa3')]||_0x588c6d[_0x0995('0xa1')][_0x0995('0x115')]||_0x588c6d[_0x0995('0x116')][_0x0995('0x117')]||_0x588c6d['ip'],'referer':_0x588c6d[_0x0995('0xa1')][_0x0995('0xa9')],'openedInteractions':_0x4d9176,'maxInteractions':_0x2360d5,'virtual':_0x3ff34e['virtual'],'online':_0x13fa23,'custom':_0x3ff34e}))[_0x0995('0x118')](/'/g,'\x5c\x27')};_0x16acfd[_0x0995('0x30')](ejs[_0x0995('0xd4')](Mustache[_0x0995('0xd4')](_0x332fb4,_0x335f57),{'proactiveActions':_0x3058c5,'alignment':_0x47d801['alignment'],'verticalAlignment':_0x47d801[_0x0995('0x119')],'div_color':_0x47d801[_0x0995('0xfa')],'labelText':_0x47d801[_0x0995('0x11a')],'text_color':_0x47d801[_0x0995('0x11b')],'text_button_color':_0x47d801[_0x0995('0x11c')],'button_color':_0x47d801[_0x0995('0x11d')],'background_color':_0x47d801[_0x0995('0x11e')],'hideWhenOffline':_0x47d801[_0x0995('0x11f')],'intervalId':_0x47d801[_0x0995('0x120')],'isDevelopment':_0x414f37,'chatVersion':_0x5258a8}));})[_0x0995('0x20')](handleError(_0x16acfd,null));};exports[_0x0995('0x121')]=function(_0x332480,_0x10f226){var _0x59e108=_0x332480[_0x0995('0x4f')]['id'];var _0x3d6d6a=_0x332480['body'];var _0x6ba879=0xc8;var _0x238846=null;return db[_0x0995('0xdf')][_0x0995('0x122')]({'isolationLevel':db[_0x0995('0xdf')][_0x0995('0x123')][_0x0995('0x124')][_0x0995('0x125')]},function(_0x156ad8){return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x59e108},'transaction':_0x156ad8})[_0x0995('0x16')](function(_0x2a9e03){if(_0x2a9e03){return db[_0x0995('0x98')][_0x0995('0x2b')]({'where':{'ChatWebsiteId':_0x59e108},'transaction':_0x156ad8})['then'](function(){var _0x5528ca=_[_0x0995('0x33')](_0x3d6d6a,function(_0x248e73){_0x248e73[_0x0995('0x5f')]=_0x59e108;return _0x248e73;});return db[_0x0995('0x98')][_0x0995('0x126')](_0x5528ca,{'transaction':_0x156ad8});});}else{_0x6ba879=0x194;_0x238846=[];}});})[_0x0995('0x16')](function(){if(_0x6ba879!==0x194){return db[_0x0995('0x98')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x59e108},'order':_0x0995('0x9c')})[_0x0995('0x16')](function(_0x407176){_0x238846=_0x407176;});}})[_0x0995('0x20')](function(_0xf7784d){_0x6ba879=0x1f4;logger[_0x0995('0x1c')](_0xf7784d[_0x0995('0x2e')]);if(_0xf7784d[_0x0995('0x2f')]){delete _0xf7784d[_0x0995('0x2f')];}_0x238846=_0xf7784d;})[_0x0995('0x127')](function(){if(_0x238846===null){_0x10f226[_0x0995('0x21')](_0x6ba879);}else{if(_0x6ba879===0x1f4){_0x10f226[_0x0995('0x22')](_0x6ba879)[_0x0995('0x30')](_0x238846);}else{_0x10f226[_0x0995('0x22')](_0x6ba879)['json'](_0x238846);}}});};exports[_0x0995('0x128')]=function(_0x6fac62,_0x103cad){var _0x33f484={};var _0x15c682={};var _0x102f1e;var _0x2e4c0e;return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x6fac62[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x103cad,null))[_0x0995('0x16')](function(_0x5c3f97){if(_0x5c3f97){_0x102f1e=_0x5c3f97;_0x15c682[_0x0995('0x39')]=_[_0x0995('0x3a')](db[_0x0995('0x98')][_0x0995('0x35')]);_0x15c682[_0x0995('0x3d')]=_[_0x0995('0x3a')](_0x6fac62['query']);_0x15c682[_0x0995('0x3b')]=_[_0x0995('0x3c')](_0x15c682['model'],_0x15c682[_0x0995('0x3d')]);_0x33f484[_0x0995('0x3f')]=_['intersection'](_0x15c682[_0x0995('0x39')],qs[_0x0995('0x3e')](_0x6fac62['query'][_0x0995('0x3e')]));_0x33f484['attributes']=_0x33f484['attributes'][_0x0995('0x51')]?_0x33f484['attributes']:_0x15c682[_0x0995('0x39')];_0x33f484[_0x0995('0x42')]=qs[_0x0995('0x43')](_0x6fac62['query'][_0x0995('0x43')]);_0x33f484[_0x0995('0x44')]=qs[_0x0995('0x3b')](_[_0x0995('0x45')](_0x6fac62['query'],_0x15c682[_0x0995('0x3b')]));if(_0x6fac62[_0x0995('0x3d')][_0x0995('0x46')]){_0x33f484[_0x0995('0x44')]=_['merge'](_0x33f484[_0x0995('0x44')],{'$or':_['map'](_0x33f484['attributes'],function(_0x1336c0){var _0xcd4eb9={};_0xcd4eb9[_0x1336c0]={'$like':'%'+_0x6fac62[_0x0995('0x3d')][_0x0995('0x46')]+'%'};return _0xcd4eb9;})});}_0x33f484=_[_0x0995('0x48')]({},_0x33f484,_0x6fac62[_0x0995('0x49')]);return _0x102f1e[_0x0995('0x128')](_0x33f484);}})['then'](function(_0x3e2ec9){if(_0x3e2ec9){_0x2e4c0e=_0x3e2ec9[_0x0995('0x51')];if(!_0x6fac62['query']['hasOwnProperty'](_0x0995('0x41'))){_0x33f484[_0x0995('0x26')]=qs[_0x0995('0x26')](_0x6fac62[_0x0995('0x3d')][_0x0995('0x26')]);_0x33f484[_0x0995('0x25')]=qs['offset'](_0x6fac62['query'][_0x0995('0x25')]);}return _0x102f1e[_0x0995('0x128')](_0x33f484);}})['then'](function(_0x523ef7){if(_0x523ef7){return _0x523ef7?{'count':_0x2e4c0e,'rows':_0x523ef7}:null;}})[_0x0995('0x16')](respondWithResult(_0x103cad,null))[_0x0995('0x20')](handleError(_0x103cad,null));};exports[_0x0995('0x129')]=function(_0xdce544,_0x2bdc11){return db[_0x0995('0x12a')][_0x0995('0x52')]({'where':{'id':_0xdce544['params']['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x2bdc11,null))[_0x0995('0x16')](function(_0x5e44ff){if(_0x5e44ff){return _0x5e44ff['addProactiveActions'](_0xdce544[_0x0995('0x54')]['ids'],_['omit'](_0xdce544[_0x0995('0x54')],[_0x0995('0x63'),'id'])||{});}})['then'](respondWithResult(_0x2bdc11,null))[_0x0995('0x20')](handleError(_0x2bdc11,null));};exports[_0x0995('0x10a')]=function(_0x5108a7,_0x20f052){var _0x1316cc={};var _0xa3bc90={};var _0x474ba7;var _0x1978a6;return db['ChatWebsite']['findOne']({'where':{'id':_0x5108a7['params']['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x20f052,null))['then'](function(_0x675447){if(_0x675447){_0x474ba7=_0x675447;_0xa3bc90[_0x0995('0x39')]=_[_0x0995('0x3a')](db[_0x0995('0x12b')]['rawAttributes']);_0xa3bc90['query']=_['keys'](_0x5108a7[_0x0995('0x3d')]);_0xa3bc90[_0x0995('0x3b')]=_['intersection'](_0xa3bc90[_0x0995('0x39')],_0xa3bc90[_0x0995('0x3d')]);_0x1316cc[_0x0995('0x3f')]=_[_0x0995('0x3c')](_0xa3bc90[_0x0995('0x39')],qs[_0x0995('0x3e')](_0x5108a7[_0x0995('0x3d')][_0x0995('0x3e')]));_0x1316cc[_0x0995('0x3f')]=_0x1316cc[_0x0995('0x3f')][_0x0995('0x51')]?_0x1316cc[_0x0995('0x3f')]:_0xa3bc90[_0x0995('0x39')];_0x1316cc['order']=qs['sort'](_0x5108a7[_0x0995('0x3d')]['sort']);_0x1316cc['where']=qs[_0x0995('0x3b')](_['pick'](_0x5108a7[_0x0995('0x3d')],_0xa3bc90[_0x0995('0x3b')]));if(_0x5108a7[_0x0995('0x3d')][_0x0995('0x46')]){_0x1316cc[_0x0995('0x44')]=_['merge'](_0x1316cc[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x1316cc[_0x0995('0x3f')],function(_0x2dfe92){var _0x592bd6={};_0x592bd6[_0x2dfe92]={'$like':'%'+_0x5108a7[_0x0995('0x3d')][_0x0995('0x46')]+'%'};return _0x592bd6;})});}_0x1316cc=_[_0x0995('0x48')]({},_0x1316cc,_0x5108a7[_0x0995('0x49')]);return _0x474ba7[_0x0995('0x10a')](_0x1316cc);}})['then'](function(_0xa1fb31){if(_0xa1fb31){_0x1978a6=_0xa1fb31[_0x0995('0x51')];if(!_0x5108a7[_0x0995('0x3d')][_0x0995('0x40')](_0x0995('0x41'))){_0x1316cc[_0x0995('0x26')]=qs['limit'](_0x5108a7['query'][_0x0995('0x26')]);_0x1316cc['offset']=qs[_0x0995('0x25')](_0x5108a7[_0x0995('0x3d')][_0x0995('0x25')]);}return _0x474ba7[_0x0995('0x10a')](_0x1316cc);}})['then'](function(_0x5c2493){if(_0x5c2493){return _0x5c2493?{'count':_0x1978a6,'rows':_0x5c2493}:null;}})[_0x0995('0x16')](respondWithResult(_0x20f052,null))['catch'](handleError(_0x20f052,null));};exports[_0x0995('0x12c')]=function(_0x18e0a5,_0x50b9be){var _0x2b59cb=_0x18e0a5['query'][_0x0995('0x12d')]===_0x0995('0x12e')?_0x0995('0x12f'):'onlineForm';return db['ChatWebsite'][_0x0995('0x52')]({'attributes':['id',_0x2b59cb],'where':{'id':_0x18e0a5[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x50b9be,null))[_0x0995('0x16')](function(_0x422f1f){if(_0x422f1f){var _0x4c91d2=_0x422f1f[_0x2b59cb];var _0x47b224=_0x4c91d2&&_0x4c91d2['items']?_0x4c91d2[_0x0995('0x130')]:[];_0x50b9be[_0x0995('0x30')]({'fromKey':_[_0x0995('0x77')](_0x4c91d2['fromKey'])?undefined:_0x4c91d2['fromKey'],'count':_0x47b224[_0x0995('0x51')],'rows':_0x47b224});}})['catch'](handleError(_0x50b9be,null));};exports[_0x0995('0x131')]=function(_0x7f17e4,_0x9e894){var _0x9c80cc={'raw':![],'where':{}};var _0x462dd7={};var _0x42dbf9={'count':0x0,'rows':[]};return db[_0x0995('0x34')][_0x0995('0x61')]({'where':{'id':_0x7f17e4[_0x0995('0x4f')]['id']}})['then'](handleEntityNotFound(_0x9e894,null))[_0x0995('0x16')](function(_0x5b1bc2){if(_0x5b1bc2){_0x462dd7[_0x0995('0x39')]=_['keys'](db['ChatOfflineMessage'][_0x0995('0x35')]);_0x462dd7[_0x0995('0x3d')]=_[_0x0995('0x3a')](_0x7f17e4[_0x0995('0x3d')]);_0x462dd7['filters']=_[_0x0995('0x3c')](_0x462dd7['model'],_0x462dd7[_0x0995('0x3d')]);_0x9c80cc['attributes']=_[_0x0995('0x3c')](_0x462dd7['model'],qs[_0x0995('0x3e')](_0x7f17e4[_0x0995('0x3d')][_0x0995('0x3e')]));_0x9c80cc[_0x0995('0x3f')]=_0x9c80cc['attributes'][_0x0995('0x51')]?_0x9c80cc[_0x0995('0x3f')]:_0x462dd7[_0x0995('0x39')];if(!_0x7f17e4['query'][_0x0995('0x40')]('nolimit')){_0x9c80cc['limit']=qs[_0x0995('0x26')](_0x7f17e4[_0x0995('0x3d')]['limit']);_0x9c80cc[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x7f17e4[_0x0995('0x3d')][_0x0995('0x25')]);}_0x9c80cc[_0x0995('0x42')]=qs['sort'](_0x7f17e4[_0x0995('0x3d')]['sort']);_0x9c80cc[_0x0995('0x44')]=qs[_0x0995('0x3b')](_[_0x0995('0x45')](_0x7f17e4[_0x0995('0x3d')],_0x462dd7[_0x0995('0x3b')]));_0x9c80cc['where']['ChatWebsiteId']=_0x5b1bc2['id'];if(_0x7f17e4[_0x0995('0x3d')][_0x0995('0x46')]){_0x9c80cc[_0x0995('0x44')]=_[_0x0995('0x48')](_0x9c80cc[_0x0995('0x44')],{'$or':_['map'](_0x9c80cc[_0x0995('0x3f')],function(_0x4e0173){var _0x46296c={};_0x46296c[_0x4e0173]={'$like':'%'+_0x7f17e4[_0x0995('0x3d')][_0x0995('0x46')]+'%'};return _0x46296c;})});}_0x9c80cc=_['merge']({},_0x9c80cc,_0x7f17e4[_0x0995('0x49')]);return db[_0x0995('0xd7')]['count']({'where':_0x9c80cc[_0x0995('0x44')]})['then'](function(_0x456034){_0x42dbf9['count']=_0x456034;if(_0x7f17e4[_0x0995('0x3d')]['includeAll']){_0x9c80cc[_0x0995('0x4b')]=[{'all':!![]}];}else{_0x9c80cc[_0x0995('0x4b')]=[{'model':db[_0x0995('0x89')],'as':'Contact','required':![]},{'model':db[_0x0995('0xe0')],'as':_0x0995('0x132'),'required':![]}];}return db['ChatOfflineMessage'][_0x0995('0x4c')](_0x9c80cc);})['then'](function(_0x5e5485){_0x42dbf9[_0x0995('0x4d')]=_0x5e5485;return _0x42dbf9;});}})[_0x0995('0x16')](respondWithFilteredResult(_0x9e894,_0x9c80cc))[_0x0995('0x20')](handleError(_0x9e894,null));};exports[_0x0995('0x133')]=function(_0xa2803d,_0x52df84){return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0xa2803d[_0x0995('0x4f')]['id']}})[_0x0995('0x16')](handleEntityNotFound(_0x52df84,null))[_0x0995('0x16')](function(_0x4ec866){if(_0x4ec866){return _0x4ec866[_0x0995('0x133')](_0xa2803d[_0x0995('0x54')]['ids'],_[_0x0995('0xf3')](_0xa2803d[_0x0995('0x54')],['ids','id'])||{})[_0x0995('0xb7')](function(_0x3b1200){for(var _0x267437=0x0;_0x267437<_0xa2803d[_0x0995('0x54')]['ids'][_0x0995('0x51')];_0x267437+=0x1){socket['emit'](_0x0995('0x134'),{'UserId':Number(_0xa2803d[_0x0995('0x54')][_0x0995('0x63')][_0x267437]),'ChatWebsiteId':Number(_0xa2803d[_0x0995('0x4f')]['id'])});}return _0x3b1200;});}})[_0x0995('0x16')](respondWithResult(_0x52df84,null))[_0x0995('0x20')](handleError(_0x52df84,null));};exports[_0x0995('0x135')]=function(_0x502598,_0x5ae5b5){return db[_0x0995('0x34')][_0x0995('0x52')]({'where':{'id':_0x502598['params']['id']}})['then'](handleEntityNotFound(_0x5ae5b5,null))['then'](function(_0x1a9ceb){if(_0x1a9ceb){return _0x1a9ceb[_0x0995('0x135')](_0x502598[_0x0995('0x3d')][_0x0995('0x63')])[_0x0995('0x16')](function(){if(_[_0x0995('0x136')](_0x502598[_0x0995('0x3d')][_0x0995('0x63')])){for(var _0x26f41c=0x0;_0x26f41c<_0x502598['query'][_0x0995('0x63')][_0x0995('0x51')];_0x26f41c+=0x1){socket[_0x0995('0x137')](_0x0995('0x138'),{'UserId':Number(_0x502598[_0x0995('0x3d')][_0x0995('0x63')][_0x26f41c]),'ChatWebsiteId':Number(_0x502598['params']['id'])});}}else{socket[_0x0995('0x137')]('userChatWebsite:remove',{'UserId':Number(_0x502598[_0x0995('0x3d')][_0x0995('0x63')]),'ChatWebsiteId':Number(_0x502598['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5ae5b5,null))[_0x0995('0x20')](handleError(_0x5ae5b5,null));};exports[_0x0995('0x139')]=function(_0x15c4df,_0x5ea3d0){var _0x3b2363={};var _0x2c7ce6={};var _0x306b91;var _0x1f876e;return db[_0x0995('0x34')]['findOne']({'where':{'id':_0x15c4df[_0x0995('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ea3d0,null))[_0x0995('0x16')](function(_0x203989){if(_0x203989){_0x306b91=_0x203989;_0x2c7ce6[_0x0995('0x39')]=_['keys'](db[_0x0995('0xbf')][_0x0995('0x35')]);_0x2c7ce6[_0x0995('0x3d')]=_[_0x0995('0x3a')](_0x15c4df[_0x0995('0x3d')]);_0x2c7ce6[_0x0995('0x3b')]=_[_0x0995('0x3c')](_0x2c7ce6[_0x0995('0x39')],_0x2c7ce6[_0x0995('0x3d')]);_0x3b2363[_0x0995('0x3f')]=_[_0x0995('0x3c')](_0x2c7ce6['model'],qs['fields'](_0x15c4df[_0x0995('0x3d')]['fields']));_0x3b2363[_0x0995('0x3f')]=_0x3b2363[_0x0995('0x3f')][_0x0995('0x51')]?_0x3b2363[_0x0995('0x3f')]:_0x2c7ce6[_0x0995('0x39')];_0x3b2363[_0x0995('0x42')]=qs[_0x0995('0x43')](_0x15c4df[_0x0995('0x3d')][_0x0995('0x43')]);_0x3b2363['where']=qs[_0x0995('0x3b')](_[_0x0995('0x45')](_0x15c4df[_0x0995('0x3d')],_0x2c7ce6['filters']));if(_0x15c4df[_0x0995('0x3d')][_0x0995('0x46')]){_0x3b2363[_0x0995('0x44')]=_[_0x0995('0x48')](_0x3b2363[_0x0995('0x44')],{'$or':_[_0x0995('0x33')](_0x3b2363[_0x0995('0x3f')],function(_0x54e2fb){var _0x2ff482={};_0x2ff482[_0x54e2fb]={'$like':'%'+_0x15c4df[_0x0995('0x3d')][_0x0995('0x46')]+'%'};return _0x2ff482;})});}_0x3b2363=_['merge']({},_0x3b2363,_0x15c4df[_0x0995('0x49')]);return _0x306b91[_0x0995('0x139')](_0x3b2363);}})[_0x0995('0x16')](function(_0x54d287){if(_0x54d287){_0x1f876e=_0x54d287[_0x0995('0x51')];if(!_0x15c4df[_0x0995('0x3d')]['hasOwnProperty'](_0x0995('0x41'))){_0x3b2363[_0x0995('0x26')]=qs[_0x0995('0x26')](_0x15c4df[_0x0995('0x3d')][_0x0995('0x26')]);_0x3b2363[_0x0995('0x25')]=qs[_0x0995('0x25')](_0x15c4df['query'][_0x0995('0x25')]);}return _0x306b91[_0x0995('0x139')](_0x3b2363);}})[_0x0995('0x16')](function(_0x3e9de9){if(_0x3e9de9){return _0x3e9de9?{'count':_0x1f876e,'rows':_0x3e9de9}:null;}})[_0x0995('0x16')](respondWithResult(_0x5ea3d0,null))[_0x0995('0x20')](handleError(_0x5ea3d0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d7d42c5..c262e8f 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 _0xcf1c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1f993a,_0x2391e8){var _0x49d756=function(_0xf15d56){while(--_0xf15d56){_0x1f993a['push'](_0x1f993a['shift']());}};_0x49d756(++_0x2391e8);}(_0xcf1c,0x18d));var _0xccf1=function(_0x458f09,_0xf2ee90){_0x458f09=_0x458f09-0x0;var _0x1ca565=_0xcf1c[_0x458f09];return _0x1ca565;};'use strict';var EventEmitter=require(_0xccf1('0x0'));var ChatWebsite=require(_0xccf1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xccf1('0x2')](0x0);var events={'afterCreate':_0xccf1('0x3'),'afterUpdate':_0xccf1('0x4'),'afterDestroy':_0xccf1('0x5')};function emitEvent(_0x5670d0){return function(_0x5d3e85,_0x509c8d,_0x301b38){ChatWebsiteEvents['emit'](_0x5670d0+':'+_0x5d3e85['id'],_0x5d3e85);ChatWebsiteEvents[_0xccf1('0x6')](_0x5670d0,_0x5d3e85);_0x301b38(null);};}for(var e in events){if(events[_0xccf1('0x7')](e)){var event=events[e];ChatWebsite[_0xccf1('0x8')](e,emitEvent(event));}}module[_0xccf1('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x32ff=['hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x32ff,0xc7));var _0xf32f=function(_0x1f3a3a,_0x2acf29){_0x1f3a3a=_0x1f3a3a-0x0;var _0x5e1a4c=_0x32ff[_0x1f3a3a];return _0x5e1a4c;};'use strict';var EventEmitter=require(_0xf32f('0x0'));var ChatWebsite=require(_0xf32f('0x1'))['db'][_0xf32f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf32f('0x3')](0x0);var events={'afterCreate':_0xf32f('0x4'),'afterUpdate':_0xf32f('0x5'),'afterDestroy':_0xf32f('0x6')};function emitEvent(_0x3ee77b){return function(_0x1f96f0,_0x397240,_0x1f6ca4){ChatWebsiteEvents[_0xf32f('0x7')](_0x3ee77b+':'+_0x1f96f0['id'],_0x1f96f0);ChatWebsiteEvents[_0xf32f('0x7')](_0x3ee77b,_0x1f96f0);_0x1f6ca4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xf32f('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 c4e018d..420f1b3 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 _0x5061=['lodash','util','../../config/logger','api','moment','path','rimraf','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x1b4a2c,_0x3fc60b){var _0x40a60e=function(_0xf9feb){while(--_0xf9feb){_0x1b4a2c['push'](_0x1b4a2c['shift']());}};_0x40a60e(++_0x3fc60b);}(_0x5061,0x176));var _0x1506=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x5061[_0x4d9bb2];return _0x3179fe;};'use strict';var _=require(_0x1506('0x0'));var util=require(_0x1506('0x1'));var logger=require(_0x1506('0x2'))(_0x1506('0x3'));var moment=require(_0x1506('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1506('0x5'));var rimraf=require(_0x1506('0x6'));var config=require('../../config/environment');var attributes=require(_0x1506('0x7'));module['exports']=function(_0x371fb7,_0x6836cd){return _0x371fb7[_0x1506('0x8')](_0x1506('0x9'),attributes,{'tableName':_0x1506('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af0=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise','path'];(function(_0x375634,_0x15d810){var _0x3f002d=function(_0x376bd3){while(--_0x376bd3){_0x375634['push'](_0x375634['shift']());}};_0x3f002d(++_0x15d810);}(_0x4af0,0x10b));var _0x04af=function(_0x54ce00,_0x2ca0da){_0x54ce00=_0x54ce00-0x0;var _0x2b4520=_0x4af0[_0x54ce00];return _0x2b4520;};'use strict';var _=require(_0x04af('0x0'));var util=require(_0x04af('0x1'));var logger=require('../../config/logger')(_0x04af('0x2'));var moment=require('moment');var BPromise=require(_0x04af('0x3'));var rp=require(_0x04af('0x4'));var fs=require('fs');var path=require(_0x04af('0x5'));var rimraf=require(_0x04af('0x6'));var config=require(_0x04af('0x7'));var attributes=require(_0x04af('0x8'));module[_0x04af('0x9')]=function(_0x194364,_0x1ad62d){return _0x194364[_0x04af('0xa')](_0x04af('0xb'),attributes,{'tableName':_0x04af('0xc'),'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 77d4696..dc0250a 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 _0xe168=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0xe168,0xce));var _0x8e16=function(_0x35f511,_0x4b60ff){_0x35f511=_0x35f511-0x0;var _0x33d91b=_0xe168[_0x35f511];return _0x33d91b;};'use strict';var _=require(_0x8e16('0x0'));var util=require(_0x8e16('0x1'));var moment=require(_0x8e16('0x2'));var BPromise=require(_0x8e16('0x3'));var rs=require(_0x8e16('0x4'));var fs=require('fs');var Redis=require(_0x8e16('0x5'));var db=require(_0x8e16('0x6'))['db'];var utils=require(_0x8e16('0x7'));var logger=require(_0x8e16('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e16('0x9'));var client=jayson[_0x8e16('0xa')][_0x8e16('0xb')]({'port':0x232a});config[_0x8e16('0xc')]=_[_0x8e16('0xd')](config[_0x8e16('0xc')],{'host':_0x8e16('0xe'),'port':0x18eb});var socket=require(_0x8e16('0xf'))(new Redis(config[_0x8e16('0xc')]));require(_0x8e16('0x10'))[_0x8e16('0x11')](socket);function respondWithRpcPromise(_0x339bc2,_0x5b1e8e,_0x2c5a1e){return new BPromise(function(_0x7ede4b,_0x20d19b){return client[_0x8e16('0x12')](_0x339bc2,_0x2c5a1e)[_0x8e16('0x13')](function(_0x122024){logger[_0x8e16('0x14')](_0x8e16('0x15'),_0x5b1e8e,_0x8e16('0x16'));logger['debug'](_0x8e16('0x17'),_0x5b1e8e,_0x8e16('0x16'),JSON[_0x8e16('0x18')](_0x122024));if(_0x122024[_0x8e16('0x19')]){if(_0x122024['error'][_0x8e16('0x1a')]===0x1f4){logger[_0x8e16('0x19')](_0x8e16('0x15'),_0x5b1e8e,_0x122024['error'][_0x8e16('0x1b')]);return _0x20d19b(_0x122024[_0x8e16('0x19')][_0x8e16('0x1b')]);}logger[_0x8e16('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5b1e8e,_0x122024[_0x8e16('0x19')][_0x8e16('0x1b')]);return _0x7ede4b(_0x122024[_0x8e16('0x19')]['message']);}else{logger[_0x8e16('0x14')](_0x8e16('0x15'),_0x5b1e8e,'request\x20sent');_0x7ede4b(_0x122024['result']['message']);}})[_0x8e16('0x1c')](function(_0x4a02f5){logger[_0x8e16('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5b1e8e,_0x4a02f5);_0x20d19b(_0x4a02f5);});});} \ No newline at end of file +var _0x3f0b=['ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatWebsite.socket','register','request'];(function(_0x13f2eb,_0x5d9979){var _0x3cb363=function(_0x57bc20){while(--_0x57bc20){_0x13f2eb['push'](_0x13f2eb['shift']());}};_0x3cb363(++_0x5d9979);}(_0x3f0b,0xd9));var _0xb3f0=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x3f0b[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xb3f0('0x0'));var util=require(_0xb3f0('0x1'));var moment=require('moment');var BPromise=require(_0xb3f0('0x2'));var rs=require(_0xb3f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f0('0x4'))['db'];var utils=require(_0xb3f0('0x5'));var logger=require(_0xb3f0('0x6'))(_0xb3f0('0x7'));var config=require(_0xb3f0('0x8'));var jayson=require(_0xb3f0('0x9'));var client=jayson[_0xb3f0('0xa')][_0xb3f0('0xb')]({'port':0x232a});config[_0xb3f0('0xc')]=_['defaults'](config[_0xb3f0('0xc')],{'host':_0xb3f0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3f0('0xc')]));require(_0xb3f0('0xe'))[_0xb3f0('0xf')](socket);function respondWithRpcPromise(_0x594794,_0x5eff4d,_0x53d69f){return new BPromise(function(_0xc5b5aa,_0x51532a){return client[_0xb3f0('0x10')](_0x594794,_0x53d69f)['then'](function(_0xd7783a){logger['info'](_0xb3f0('0x11'),_0x5eff4d,_0xb3f0('0x12'));logger[_0xb3f0('0x13')](_0xb3f0('0x14'),_0x5eff4d,'request\x20sent',JSON[_0xb3f0('0x15')](_0xd7783a));if(_0xd7783a[_0xb3f0('0x16')]){if(_0xd7783a[_0xb3f0('0x16')][_0xb3f0('0x17')]===0x1f4){logger[_0xb3f0('0x16')](_0xb3f0('0x11'),_0x5eff4d,_0xd7783a[_0xb3f0('0x16')][_0xb3f0('0x18')]);return _0x51532a(_0xd7783a['error'][_0xb3f0('0x18')]);}logger[_0xb3f0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x5eff4d,_0xd7783a['error'][_0xb3f0('0x18')]);return _0xc5b5aa(_0xd7783a[_0xb3f0('0x16')]['message']);}else{logger['info'](_0xb3f0('0x11'),_0x5eff4d,_0xb3f0('0x12'));_0xc5b5aa(_0xd7783a['result'][_0xb3f0('0x18')]);}})[_0xb3f0('0x19')](function(_0x304f24){logger[_0xb3f0('0x16')](_0xb3f0('0x11'),_0x5eff4d,_0x304f24);_0x51532a(_0x304f24);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4211eaa..9866659 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 _0xf698=['length','chatWebsite:','./chatWebsite.events','update','removeListener','register'];(function(_0x3c3eb7,_0x55343d){var _0x108733=function(_0x5bd6f6){while(--_0x5bd6f6){_0x3c3eb7['push'](_0x3c3eb7['shift']());}};_0x108733(++_0x55343d);}(_0xf698,0x14c));var _0x8f69=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0xf698[_0x296897];return _0x2b44ab;};'use strict';var ChatWebsiteEvents=require(_0x8f69('0x0'));var events=['save','remove',_0x8f69('0x1')];function createListener(_0x354452,_0x12fc41){return function(_0x21c3c7){_0x12fc41['emit'](_0x354452,_0x21c3c7);};}function removeListener(_0x305bf1,_0x53824c){return function(){ChatWebsiteEvents[_0x8f69('0x2')](_0x305bf1,_0x53824c);};}exports[_0x8f69('0x3')]=function(_0x3f3f2b){for(var _0x86e8bf=0x0,_0x3f2c1e=events[_0x8f69('0x4')];_0x86e8bf<_0x3f2c1e;_0x86e8bf++){var _0x99e4c4=events[_0x86e8bf];var _0x93054e=createListener(_0x8f69('0x5')+_0x99e4c4,_0x3f3f2b);ChatWebsiteEvents['on'](_0x99e4c4,_0x93054e);}}; \ No newline at end of file +var _0x9c14=['register','length','./chatWebsite.events','emit'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x9c14,0x9a));var _0x49c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c14[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x49c1('0x0'));var events=['save','remove','update'];function createListener(_0xe4c38c,_0x57ba46){return function(_0xb78712){_0x57ba46[_0x49c1('0x1')](_0xe4c38c,_0xb78712);};}function removeListener(_0x47e4e3,_0x7da2da){return function(){ChatWebsiteEvents['removeListener'](_0x47e4e3,_0x7da2da);};}exports[_0x49c1('0x2')]=function(_0x4edc50){for(var _0x5e4c5f=0x0,_0x1ec5d3=events[_0x49c1('0x3')];_0x5e4c5f<_0x1ec5d3;_0x5e4c5f++){var _0x57df45=events[_0x5e4c5f];var _0x58c979=createListener('chatWebsite:'+_0x57df45,_0x4edc50);ChatWebsiteEvents['on'](_0x57df45,_0x58c979);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 38b1dad..18fbf89 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 _0xbc45=['removeAnswers','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','post','create','addAnswer','diskStorage','root','format','%s-%s','now','/:id/logo','single','addLogo','join','server/files/images/avatars/','originalname','file','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','update','destroy','removeDispositions','delete'];(function(_0x2e8f90,_0x830dd9){var _0x584090=function(_0x53bd1c){while(--_0x53bd1c){_0x2e8f90['push'](_0x2e8f90['shift']());}};_0x584090(++_0x830dd9);}(_0xbc45,0x160));var _0x5bc4=function(_0x45bd77,_0x594e75){_0x45bd77=_0x45bd77-0x0;var _0x5c26ed=_0xbc45[_0x45bd77];return _0x5c26ed;};'use strict';var multer=require(_0x5bc4('0x0'));var util=require(_0x5bc4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5bc4('0x2'));var router=express['Router']();var fs_extra=require(_0x5bc4('0x3'));var auth=require(_0x5bc4('0x4'));var interaction=require(_0x5bc4('0x5'));var config=require(_0x5bc4('0x6'));var controller=require(_0x5bc4('0x7'));router[_0x5bc4('0x8')]('/',auth[_0x5bc4('0x9')](),controller['index']);router[_0x5bc4('0x8')](_0x5bc4('0xa'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xb')]);router['get'](_0x5bc4('0xc'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xd')]);router['get'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0xf')]);router[_0x5bc4('0x8')](_0x5bc4('0x10'),auth[_0x5bc4('0x9')](),controller['getAnswers']);router[_0x5bc4('0x8')]('/:id/logo',controller[_0x5bc4('0x11')]);router[_0x5bc4('0x8')](_0x5bc4('0x12'),controller['getAvatar']);router['get'](_0x5bc4('0x13'),controller[_0x5bc4('0x14')]);router[_0x5bc4('0x8')]('/:id/system_avatar',controller[_0x5bc4('0x15')]);router[_0x5bc4('0x8')](_0x5bc4('0x16'),auth[_0x5bc4('0x9')](),controller['getInteractions']);router[_0x5bc4('0x8')](_0x5bc4('0x17'),controller[_0x5bc4('0x18')]);router['get'](_0x5bc4('0x19'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1a')]);router[_0x5bc4('0x8')](_0x5bc4('0x1b'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1c')]);router[_0x5bc4('0x8')](_0x5bc4('0x1d'),controller['getFields']);router[_0x5bc4('0x8')](_0x5bc4('0x1e'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x1f')]);router['get']('/:id/users',auth[_0x5bc4('0x9')](),controller['getAgents']);router[_0x5bc4('0x20')]('/',auth['isAuthenticated'](),controller[_0x5bc4('0x21')]);router['post'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller['addDisposition']);router[_0x5bc4('0x20')]('/:id/canned_answers',auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x22')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0xc11f64,_0x351926,_0x1d54fe){_0x1d54fe(null,path['join'](config[_0x5bc4('0x24')],'server/files/images/logos/'));},'filename':function(_0x4834b3,_0x58e61b,_0x4ac44f){_0x4ac44f(null,util[_0x5bc4('0x25')](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x58e61b['originalname']));}})});router[_0x5bc4('0x20')](_0x5bc4('0x28'),upload[_0x5bc4('0x29')]('file'),controller[_0x5bc4('0x2a')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x19ef05,_0x5674dd,_0x4b7c72){_0x4b7c72(null,path[_0x5bc4('0x2b')](config['root'],_0x5bc4('0x2c')));},'filename':function(_0x1f47e4,_0x406aa2,_0xe0d6c2){_0xe0d6c2(null,util['format'](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x406aa2[_0x5bc4('0x2d')]));}})});router[_0x5bc4('0x20')](_0x5bc4('0x12'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x2f')]);var upload=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x294823,_0x391eba,_0x36b5f9){_0x36b5f9(null,path['join'](config[_0x5bc4('0x24')],_0x5bc4('0x2c')));},'filename':function(_0x22b021,_0x4290db,_0xaaf582){_0xaaf582(null,util['format'](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x4290db['originalname']));}})});router['post'](_0x5bc4('0x13'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e3d96,_0x23ee16,_0x27d8bb){_0x27d8bb(null,path[_0x5bc4('0x2b')](config[_0x5bc4('0x24')],_0x5bc4('0x2c')));},'filename':function(_0x3126df,_0x30e5c7,_0x13c02f){_0x13c02f(null,util[_0x5bc4('0x25')](_0x5bc4('0x26'),Date[_0x5bc4('0x27')](),_0x30e5c7[_0x5bc4('0x2d')]));}})});router[_0x5bc4('0x20')](_0x5bc4('0x31'),upload[_0x5bc4('0x29')](_0x5bc4('0x2e')),controller[_0x5bc4('0x32')]);router['post'](_0x5bc4('0x33'),controller[_0x5bc4('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5bc4('0x23')]({'destination':function(_0x7e9fe5,_0x384541,_0x31d1a0){const _0x2b0118=path['join'](config[_0x5bc4('0x24')],_0x5bc4('0x35'),'attachments',_0x5bc4('0x36'));fs_extra['ensureDir'](_0x2b0118,function(){_0x31d1a0(null,_0x2b0118);});},'filename':function(_0x4e0ce4,_0xa95f03,_0x5c5e55){const _0x14fe0c=_0xa95f03[_0x5bc4('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x34d871=path[_0x5bc4('0x37')](_0x14fe0c);const _0x1a0a2f=Date[_0x5bc4('0x27')]()+'-'+_0x14fe0c['replace'](_0x34d871,'')+_0x34d871;_0x5c5e55(null,_0x1a0a2f);}})});router['post'](_0x5bc4('0x38'),offlineUploadMulter[_0x5bc4('0x39')](),controller[_0x5bc4('0x3a')]);router[_0x5bc4('0x20')](_0x5bc4('0x16'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x3b')]);router[_0x5bc4('0x20')](_0x5bc4('0x19'),auth[_0x5bc4('0x9')](),controller['addApplications']);router['post'](_0x5bc4('0x1b'),auth['isAuthenticated'](),controller[_0x5bc4('0x3c')]);router[_0x5bc4('0x20')](_0x5bc4('0x3d'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x3e')]);router[_0x5bc4('0x3f')]('/:id',auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x40')]);router['delete'](_0x5bc4('0xc'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x41')]);router['delete'](_0x5bc4('0xe'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x42')]);router[_0x5bc4('0x43')](_0x5bc4('0x10'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x44')]);router[_0x5bc4('0x43')](_0x5bc4('0x3d'),auth[_0x5bc4('0x9')](),controller[_0x5bc4('0x45')]);module['exports']=router; \ No newline at end of file +var _0x1a92=['addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','/:id/users','addAgents','put','update','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','create','post','addDisposition'];(function(_0x55c9e3,_0x3f01ee){var _0x1c8872=function(_0x384ea5){while(--_0x384ea5){_0x55c9e3['push'](_0x55c9e3['shift']());}};_0x1c8872(++_0x3f01ee);}(_0x1a92,0xac));var _0x21a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a92[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x21a9('0x0'));var path=require(_0x21a9('0x1'));var timeout=require(_0x21a9('0x2'));var express=require(_0x21a9('0x3'));var router=express[_0x21a9('0x4')]();var fs_extra=require(_0x21a9('0x5'));var auth=require(_0x21a9('0x6'));var interaction=require(_0x21a9('0x7'));var config=require(_0x21a9('0x8'));var controller=require(_0x21a9('0x9'));router[_0x21a9('0xa')]('/',auth[_0x21a9('0xb')](),controller[_0x21a9('0xc')]);router[_0x21a9('0xa')]('/describe',auth[_0x21a9('0xb')](),controller['describe']);router[_0x21a9('0xa')](_0x21a9('0xd'),auth[_0x21a9('0xb')](),controller['show']);router[_0x21a9('0xa')](_0x21a9('0xe'),auth['isAuthenticated'](),controller[_0x21a9('0xf')]);router[_0x21a9('0xa')](_0x21a9('0x10'),auth[_0x21a9('0xb')](),controller['getAnswers']);router[_0x21a9('0xa')](_0x21a9('0x11'),controller[_0x21a9('0x12')]);router[_0x21a9('0xa')]('/:id/avatar',controller[_0x21a9('0x13')]);router[_0x21a9('0xa')](_0x21a9('0x14'),controller[_0x21a9('0x15')]);router[_0x21a9('0xa')](_0x21a9('0x16'),controller[_0x21a9('0x17')]);router[_0x21a9('0xa')](_0x21a9('0x18'),auth[_0x21a9('0xb')](),controller['getInteractions']);router[_0x21a9('0xa')](_0x21a9('0x19'),controller[_0x21a9('0x1a')]);router[_0x21a9('0xa')](_0x21a9('0x1b'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x1c')]);router['get'](_0x21a9('0x1d'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x1e')]);router[_0x21a9('0xa')](_0x21a9('0x1f'),controller[_0x21a9('0x20')]);router[_0x21a9('0xa')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x21a9('0x21')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x21a9('0x22')]);router['post']('/',auth[_0x21a9('0xb')](),controller[_0x21a9('0x23')]);router[_0x21a9('0x24')]('/:id/dispositions',auth[_0x21a9('0xb')](),controller[_0x21a9('0x25')]);router[_0x21a9('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x21a9('0x26')]);var upload=multer({'storage':multer[_0x21a9('0x27')]({'destination':function(_0x4d649b,_0x4bae25,_0x6def69){_0x6def69(null,path[_0x21a9('0x28')](config[_0x21a9('0x29')],_0x21a9('0x2a')));},'filename':function(_0x3f9551,_0x37a81a,_0x5e1e07){_0x5e1e07(null,util[_0x21a9('0x2b')](_0x21a9('0x2c'),Date[_0x21a9('0x2d')](),_0x37a81a[_0x21a9('0x2e')]));}})});router[_0x21a9('0x24')](_0x21a9('0x11'),upload[_0x21a9('0x2f')](_0x21a9('0x30')),controller[_0x21a9('0x31')]);var upload=multer({'storage':multer[_0x21a9('0x27')]({'destination':function(_0x1dace2,_0x4a9850,_0x440056){_0x440056(null,path[_0x21a9('0x28')](config['root'],_0x21a9('0x32')));},'filename':function(_0x40eaac,_0x182b63,_0xa36698){_0xa36698(null,util[_0x21a9('0x2b')]('%s-%s',Date[_0x21a9('0x2d')](),_0x182b63[_0x21a9('0x2e')]));}})});router[_0x21a9('0x24')]('/:id/avatar',upload[_0x21a9('0x2f')](_0x21a9('0x30')),controller[_0x21a9('0x33')]);var upload=multer({'storage':multer[_0x21a9('0x27')]({'destination':function(_0x40c90a,_0x34572a,_0x7d8c0e){_0x7d8c0e(null,path[_0x21a9('0x28')](config[_0x21a9('0x29')],_0x21a9('0x32')));},'filename':function(_0x130892,_0x343d61,_0x17291d){_0x17291d(null,util[_0x21a9('0x2b')](_0x21a9('0x2c'),Date[_0x21a9('0x2d')](),_0x343d61[_0x21a9('0x2e')]));}})});router[_0x21a9('0x24')](_0x21a9('0x14'),upload[_0x21a9('0x2f')](_0x21a9('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x21a9('0x27')]({'destination':function(_0x51993c,_0x3102ed,_0x4b550e){_0x4b550e(null,path[_0x21a9('0x28')](config[_0x21a9('0x29')],_0x21a9('0x32')));},'filename':function(_0x122263,_0x2ac2f0,_0x47a1f2){_0x47a1f2(null,util[_0x21a9('0x2b')](_0x21a9('0x2c'),Date[_0x21a9('0x2d')](),_0x2ac2f0[_0x21a9('0x2e')]));}})});router[_0x21a9('0x24')](_0x21a9('0x16'),upload[_0x21a9('0x2f')](_0x21a9('0x30')),controller['addSystemAvatar']);router[_0x21a9('0x24')](_0x21a9('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x61c50f,_0x2d87d1,_0x2da8ae){const _0x44c264=path[_0x21a9('0x28')](config[_0x21a9('0x29')],_0x21a9('0x35'),'attachments',_0x21a9('0x36'));fs_extra[_0x21a9('0x37')](_0x44c264,function(){_0x2da8ae(null,_0x44c264);});},'filename':function(_0x38f371,_0x22f6dd,_0x202282){const _0x58cc3a=_0x22f6dd['originalname'][_0x21a9('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x45e232=path[_0x21a9('0x39')](_0x58cc3a);const _0x383f1e=Date['now']()+'-'+_0x58cc3a[_0x21a9('0x38')](_0x45e232,'')+_0x45e232;_0x202282(null,_0x383f1e);}})});router[_0x21a9('0x24')](_0x21a9('0x3a'),offlineUploadMulter[_0x21a9('0x3b')](),controller['offline']);router[_0x21a9('0x24')](_0x21a9('0x18'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x3c')]);router['post'](_0x21a9('0x1b'),auth['isAuthenticated'](),controller[_0x21a9('0x3d')]);router[_0x21a9('0x24')](_0x21a9('0x1d'),auth[_0x21a9('0xb')](),controller['addProactiveActions']);router[_0x21a9('0x24')](_0x21a9('0x3e'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x3f')]);router[_0x21a9('0x40')]('/:id',auth[_0x21a9('0xb')](),controller[_0x21a9('0x41')]);router['delete'](_0x21a9('0xd'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x42')]);router[_0x21a9('0x43')]('/:id/dispositions',auth[_0x21a9('0xb')](),controller['removeDispositions']);router[_0x21a9('0x43')](_0x21a9('0x10'),auth[_0x21a9('0xb')](),controller['removeAnswers']);router[_0x21a9('0x43')](_0x21a9('0x3e'),auth[_0x21a9('0xb')](),controller[_0x21a9('0x44')]);module[_0x21a9('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d91ac46..ee5b2b7 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 _0xab90=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','express','../components/auth/service','env','production','app'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab90,0x175));var _0x0ab9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xab90[_0x8c43de];return _0xa6591b;};var beaverLogger=require('beaver-logger/server');var express=require(_0x0ab9('0x0'));var auth=require(_0x0ab9('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x0ab9('0x2')]===_0x0ab9('0x3')||![];function clientSideLogs(_0x1593ed,_0x4f5c57,_0x3adf12){var _0x36b1aa=_0x1593ed[_0x0ab9('0x4')]['get']('client-side-logger');if(!_0x36b1aa){throw new Error(_0x0ab9('0x5'));}return beaverLogger[_0x0ab9('0x6')]({'uri':'/client-logs','logger':_0x36b1aa,'enableCors':!isProduction})(_0x1593ed,_0x4f5c57,_0x3adf12);}router['use'](auth[_0x0ab9('0x7')](),clientSideLogs);module[_0x0ab9('0x8')]=router; \ No newline at end of file +var _0x03c9=['expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x387a17,_0x25583b){var _0x4dab7c=function(_0x2ec1f2){while(--_0x2ec1f2){_0x387a17['push'](_0x387a17['shift']());}};_0x4dab7c(++_0x25583b);}(_0x03c9,0x12a));var _0x903c=function(_0x49c90f,_0x3da60e){_0x49c90f=_0x49c90f-0x0;var _0x48e99b=_0x03c9[_0x49c90f];return _0x48e99b;};var beaverLogger=require(_0x903c('0x0'));var express=require(_0x903c('0x1'));var auth=require(_0x903c('0x2'));var config=require(_0x903c('0x3'));var router=express[_0x903c('0x4')]();var isProduction=config[_0x903c('0x5')]==='production'||![];function clientSideLogs(_0x343c27,_0x27bf65,_0x527805){var _0x540c23=_0x343c27[_0x903c('0x6')][_0x903c('0x7')](_0x903c('0x8'));if(!_0x540c23){throw new Error(_0x903c('0x9'));}return beaverLogger[_0x903c('0xa')]({'uri':_0x903c('0xb'),'logger':_0x540c23,'enableCors':!isProduction})(_0x343c27,_0x27bf65,_0x527805);}router[_0x903c('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0x903c('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 09a4ccb..db9375c 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 _0x062b=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','Google','MicrosoftAzure'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x062b,0xe2));var _0xb062=function(_0x51713e,_0x1343f3){_0x51713e=_0x51713e-0x0;var _0x3e3743=_0x062b[_0x51713e];return _0x3e3743;};'use strict';var Sequelize=require(_0xb062('0x0'));module['exports']={'name':{'type':Sequelize[_0xb062('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb062('0x2')]('AmazonAWS',_0xb062('0x3'),_0xb062('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xb062('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xb062('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x5')},'data3':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x6')},'data4':{'type':Sequelize[_0xb062('0x1')],'comment':_0xb062('0x7')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xb062('0x8')],'comment':_0xb062('0x9')},'data7':{'type':Sequelize['TEXT'],'comment':_0xb062('0xa')}}; \ No newline at end of file +var _0x8c9c=['ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c9c,0x83));var _0xc8c9=function(_0x1771aa,_0x59eefb){_0x1771aa=_0x1771aa-0x0;var _0x5f1e82=_0x8c9c[_0x1771aa];return _0x5f1e82;};'use strict';var Sequelize=require('sequelize');module[_0xc8c9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc8c9('0x1')]('AmazonAWS','Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc8c9('0x1')](_0xc8c9('0x2'),_0xc8c9('0x3'))},'data1':{'type':Sequelize['STRING'],'comment':_0xc8c9('0x4')},'data2':{'type':Sequelize[_0xc8c9('0x5')],'comment':_0xc8c9('0x6')},'data3':{'type':Sequelize[_0xc8c9('0x5')],'comment':_0xc8c9('0x7')},'data4':{'type':Sequelize[_0xc8c9('0x5')],'comment':_0xc8c9('0x8')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xc8c9('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc8c9('0x9')],'comment':_0xc8c9('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1eaad2e..7321feb 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 _0xaa51=['findAll','rows','service','MicrosoftAzure','data3','catch','show','params','rawAttributes','merge','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','name','padEnd','index','map','CloudProvider','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','type','VIRTUAL','filter','options','includeAll','include'];(function(_0x892f29,_0x3d4087){var _0x233136=function(_0x4f9e85){while(--_0x4f9e85){_0x892f29['push'](_0x892f29['shift']());}};_0x233136(++_0x3d4087);}(_0xaa51,0x92));var _0x1aa5=function(_0x56798d,_0x4b5937){_0x56798d=_0x56798d-0x0;var _0x2667f7=_0xaa51[_0x56798d];return _0x2667f7;};'use strict';var _=require(_0x1aa5('0x0'));var Redis=require(_0x1aa5('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x1aa5('0x2'));var config=require(_0x1aa5('0x3'));var logger=require(_0x1aa5('0x4'))(_0x1aa5('0x5'));var db=require(_0x1aa5('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x1aa5('0x7')]=_[_0x1aa5('0x8')](config[_0x1aa5('0x7')],{'host':_0x1aa5('0x9'),'port':0x18eb});var socket=require(_0x1aa5('0xa'))(new Redis(config[_0x1aa5('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x13eeb1,_0x2680b4){_0x2680b4=_0x2680b4||0xcc;return function(_0x3f849b){if(_0x3f849b){return _0x13eeb1[_0x1aa5('0xb')](_0x2680b4);}return _0x13eeb1[_0x1aa5('0xc')](_0x2680b4)[_0x1aa5('0xd')]();};}function respondWithResult(_0x49692e,_0xdb91e5){_0xdb91e5=_0xdb91e5||0xc8;return function(_0x3096aa){if(_0x3096aa){return _0x49692e[_0x1aa5('0xc')](_0xdb91e5)[_0x1aa5('0xe')](_0x3096aa);}};}function respondWithFilteredResult(_0x2bd5df,_0x1b3c99){return function(_0x4e97b){if(_0x4e97b){var _0x5a822b=typeof _0x1b3c99[_0x1aa5('0xf')]==='undefined'&&typeof _0x1b3c99['limit']===_0x1aa5('0x10');var _0x261b12=_0x4e97b[_0x1aa5('0x11')];var _0x472995=_0x5a822b?0x0:_0x1b3c99[_0x1aa5('0xf')];var _0x51f77c=_0x5a822b?_0x4e97b[_0x1aa5('0x11')]:_0x1b3c99[_0x1aa5('0xf')]+_0x1b3c99[_0x1aa5('0x12')];var _0x83833a;if(_0x51f77c>=_0x261b12){_0x51f77c=_0x261b12;_0x83833a=0xc8;}else{_0x83833a=0xce;}_0x2bd5df[_0x1aa5('0xc')](_0x83833a);return _0x2bd5df[_0x1aa5('0x13')](_0x1aa5('0x14'),_0x472995+'-'+_0x51f77c+'/'+_0x261b12)[_0x1aa5('0xe')](_0x4e97b);}return null;};}function saveUpdates(_0x5a9e26){return function(_0x232ef4){if(_0x232ef4){return _0x232ef4['update'](_0x5a9e26)[_0x1aa5('0x15')](function(_0x2530fd){return _0x2530fd;});}return null;};}function removeEntity(_0x5bdd48){return function(_0xb7757){if(_0xb7757){return _0xb7757[_0x1aa5('0x16')]()['then'](function(){_0x5bdd48['status'](0xcc)[_0x1aa5('0xd')]();});}};}function handleEntityNotFound(_0x309e5a){return function(_0x3b4177){if(!_0x3b4177){_0x309e5a['sendStatus'](0x194);}return _0x3b4177;};}function handleError(_0x478e4d,_0x1b8149){_0x1b8149=_0x1b8149||0x1f4;return function(_0x332066){logger[_0x1aa5('0x17')](_0x332066[_0x1aa5('0x18')]);if(_0x332066[_0x1aa5('0x19')]){delete _0x332066[_0x1aa5('0x19')];}_0x478e4d['status'](_0x1b8149)['send'](_0x332066);};}function maskClientSecret(_0x4b5e6d){return _[_0x1aa5('0x1a')](_0x4b5e6d['slice'](0x0,0x3),0x14,'*');}exports[_0x1aa5('0x1b')]=function(_0x47f587,_0x27672b){var _0x38f618={},_0x229123={},_0x6df553={'count':0x0,'rows':[]};var _0x1292d2=_[_0x1aa5('0x1c')](db[_0x1aa5('0x1d')]['rawAttributes'],function(_0x4f0635){return{'name':_0x4f0635['fieldName'],'type':_0x4f0635['type'][_0x1aa5('0x1e')]};});_0x229123[_0x1aa5('0x1f')]=_[_0x1aa5('0x1c')](_0x1292d2,'name');_0x229123[_0x1aa5('0x20')]=_[_0x1aa5('0x21')](_0x47f587[_0x1aa5('0x20')]);_0x229123['filters']=_[_0x1aa5('0x22')](_0x229123[_0x1aa5('0x1f')],_0x229123['query']);_0x38f618[_0x1aa5('0x23')]=_[_0x1aa5('0x22')](_0x229123[_0x1aa5('0x1f')],qs['fields'](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x24')]));_0x38f618[_0x1aa5('0x23')]=_0x38f618[_0x1aa5('0x23')][_0x1aa5('0x25')]?_0x38f618[_0x1aa5('0x23')]:_0x229123[_0x1aa5('0x1f')];if(!_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x26')]('nolimit')){_0x38f618[_0x1aa5('0x12')]=qs[_0x1aa5('0x12')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x12')]);_0x38f618[_0x1aa5('0xf')]=qs[_0x1aa5('0xf')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0xf')]);}_0x38f618['order']=qs[_0x1aa5('0x27')](_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x27')]);_0x38f618[_0x1aa5('0x28')]=qs[_0x1aa5('0x29')](_['pick'](_0x47f587[_0x1aa5('0x20')],_0x229123[_0x1aa5('0x29')]),_0x1292d2);if(_0x47f587[_0x1aa5('0x20')]['filter']){_0x38f618[_0x1aa5('0x28')]=_['merge'](_0x38f618[_0x1aa5('0x28')],{'$or':_['map'](_0x1292d2,function(_0x53fc6b){if(_0x53fc6b[_0x1aa5('0x2a')]!==_0x1aa5('0x2b')){var _0x54e884={};_0x54e884[_0x53fc6b[_0x1aa5('0x19')]]={'$like':'%'+_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x2c')]+'%'};return _0x54e884;}})});}_0x38f618=_['merge']({},_0x38f618,_0x47f587[_0x1aa5('0x2d')]);var _0x4c12b2={'where':_0x38f618[_0x1aa5('0x28')]};return db[_0x1aa5('0x1d')]['count'](_0x4c12b2)['then'](function(_0x12aafa){_0x6df553[_0x1aa5('0x11')]=_0x12aafa;if(_0x47f587[_0x1aa5('0x20')][_0x1aa5('0x2e')]){_0x38f618[_0x1aa5('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0x1aa5('0x30')](_0x38f618);})[_0x1aa5('0x15')](function(_0x3339e1){_0x6df553[_0x1aa5('0x31')]=_[_0x1aa5('0x1c')](_0x3339e1,function(_0x2db581){if(_0x2db581[_0x1aa5('0x32')]===_0x1aa5('0x33')){var _0x2e543b=encryptor['decryptString'](_0x2db581['data3']);_0x2db581[_0x1aa5('0x34')]=maskClientSecret(_0x2e543b);}return _0x2db581;});return _0x6df553;})[_0x1aa5('0x15')](respondWithFilteredResult(_0x27672b,_0x38f618))[_0x1aa5('0x35')](handleError(_0x27672b,null));};exports[_0x1aa5('0x36')]=function(_0x50f4b2,_0x58cb0f){var _0x15f487={'raw':!![],'where':{'id':_0x50f4b2[_0x1aa5('0x37')]['id']}},_0x552389={};_0x552389[_0x1aa5('0x1f')]=_[_0x1aa5('0x21')](db['CloudProvider'][_0x1aa5('0x38')]);_0x552389[_0x1aa5('0x20')]=_['keys'](_0x50f4b2[_0x1aa5('0x20')]);_0x552389[_0x1aa5('0x29')]=_[_0x1aa5('0x22')](_0x552389['model'],_0x552389[_0x1aa5('0x20')]);_0x15f487['attributes']=_[_0x1aa5('0x22')](_0x552389[_0x1aa5('0x1f')],qs['fields'](_0x50f4b2[_0x1aa5('0x20')]['fields']));_0x15f487['attributes']=_0x15f487[_0x1aa5('0x23')]['length']?_0x15f487['attributes']:_0x552389['model'];if(_0x50f4b2['query']['includeAll']){_0x15f487['include']=[{'all':!![]}];}_0x15f487=_[_0x1aa5('0x39')]({},_0x15f487,_0x50f4b2['options']);return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')](_0x15f487)[_0x1aa5('0x15')](handleEntityNotFound(_0x58cb0f,null))[_0x1aa5('0x15')](function(_0x35af36){if(_0x35af36[_0x1aa5('0x32')]===_0x1aa5('0x33')){var _0x7af12c=encryptor[_0x1aa5('0x3b')](_0x35af36[_0x1aa5('0x34')]);_0x35af36[_0x1aa5('0x34')]=maskClientSecret(_0x7af12c);}return _0x35af36;})[_0x1aa5('0x15')](respondWithResult(_0x58cb0f,null))[_0x1aa5('0x35')](handleError(_0x58cb0f,null));};exports[_0x1aa5('0x3c')]=function(_0xe18710,_0xa0176c){if(!_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x19')])throw new Error(_0x1aa5('0x3e'));if(!_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x32')])throw new Error(_0x1aa5('0x3f'));var _0x3877a7=db['CloudProvider'][_0x1aa5('0x38')][_0x1aa5('0x32')][_0x1aa5('0x40')];if(!_0x3877a7[_0x1aa5('0x41')](_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x32')]))throw new Error(_0x1aa5('0x42')+_0x3877a7['join'](',\x20'));if(_0xe18710[_0x1aa5('0x3d')]['service']===_0x1aa5('0x33')&&_0xe18710['body'][_0x1aa5('0x34')]){_0xe18710[_0x1aa5('0x3d')][_0x1aa5('0x34')]=encryptor[_0x1aa5('0x43')](_0xe18710['body'][_0x1aa5('0x34')]);}return db[_0x1aa5('0x1d')][_0x1aa5('0x3c')](_0xe18710[_0x1aa5('0x3d')],{})[_0x1aa5('0x15')](respondWithResult(_0xa0176c,0xc9))[_0x1aa5('0x35')](handleError(_0xa0176c,null));};exports[_0x1aa5('0x44')]=function(_0x3fc218,_0x33fada){if(_0x3fc218[_0x1aa5('0x3d')]['id']){delete _0x3fc218[_0x1aa5('0x3d')]['id'];}return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')]({'where':{'id':_0x3fc218[_0x1aa5('0x37')]['id']}})[_0x1aa5('0x15')](handleEntityNotFound(_0x33fada,null))[_0x1aa5('0x15')](function(_0xb8caa9){if(_0xb8caa9[_0x1aa5('0x32')]===_0x1aa5('0x33')&&_0x3fc218[_0x1aa5('0x3d')][_0x1aa5('0x34')]){_0x3fc218['body']['data3']=encryptor['encryptString'](_0x3fc218[_0x1aa5('0x3d')][_0x1aa5('0x34')]);}return _0xb8caa9;})['then'](saveUpdates(_0x3fc218[_0x1aa5('0x3d')],null))[_0x1aa5('0x15')](respondWithResult(_0x33fada,null))[_0x1aa5('0x35')](handleError(_0x33fada,null));};exports['destroy']=function(_0x3cf84b,_0x2d0cce){return db[_0x1aa5('0x1d')][_0x1aa5('0x3a')]({'where':{'id':_0x3cf84b[_0x1aa5('0x37')]['id']}})[_0x1aa5('0x15')](handleEntityNotFound(_0x2d0cce,null))[_0x1aa5('0x15')](removeEntity(_0x2d0cce,null))[_0x1aa5('0x35')](handleError(_0x2d0cce,null));};exports[_0x1aa5('0x45')]=function(_0x274ed0,_0x3baf54){return db['CloudProvider'][_0x1aa5('0x46')]({'where':{'id':_0x274ed0['params']['id']},'raw':!![]})['then'](function(_0xec58e7){if(!_0xec58e7)return _0x3baf54[_0x1aa5('0xb')](0x194);return{'url':oauth[_0x1aa5('0x47')](_0xec58e7,_0x274ed0[_0x1aa5('0x48')]['id'])};})[_0x1aa5('0x15')](respondWithResult(_0x3baf54,null))['catch'](handleError(_0x3baf54,null));};exports[_0x1aa5('0x49')]=function(_0x35649a,_0x201ec9){var _0x44088d=_0x35649a['body'];var _0x2ad6a5;var _0x46497e;if(_0x44088d[_0x1aa5('0x17')])throw _0x44088d;redis[_0x1aa5('0x4a')](_0x44088d[_0x1aa5('0x4b')])[_0x1aa5('0x15')](function(_0x1b2a38){if(!_0x1b2a38)throw new Error(_0x1aa5('0x4c'));_0x2ad6a5=JSON[_0x1aa5('0x4d')](_0x1b2a38);var _0x3999d9=Buffer[_0x1aa5('0x4e')](_0x44088d[_0x1aa5('0x4b')],_0x1aa5('0x4f'))[_0x1aa5('0x50')]('ascii');_0x46497e=JSON[_0x1aa5('0x4d')](_0x3999d9);if(!oauth[_0x1aa5('0x51')](_0x44088d[_0x1aa5('0x52')],_0x2ad6a5[_0x1aa5('0x53')]))throw new Error(_0x1aa5('0x54'));redis[_0x1aa5('0x55')](_0x44088d[_0x1aa5('0x4b')]);return oauth[_0x1aa5('0x56')](_0x44088d[_0x1aa5('0x57')],_0x2ad6a5);})[_0x1aa5('0x15')](function(_0x409801){_0x2ad6a5['data5']=_0x409801[_0x1aa5('0x58')];_0x2ad6a5[_0x1aa5('0x59')]=_0x409801[_0x1aa5('0x5a')];return db['CloudProvider'][_0x1aa5('0x44')]({'data5':_0x2ad6a5['data5'],'data6':_0x2ad6a5['data6']},{'where':{'id':_0x2ad6a5['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x2ad6a5);socket['emit']('microsoftAuthorization:success',{'id':_0x46497e['id']});return;})[_0x1aa5('0x15')](respondWithStatusCode(_0x201ec9,null))[_0x1aa5('0x35')](function(_0x1deb53){if(_0x46497e){socket[_0x1aa5('0x5b')](_0x1aa5('0x5c'),{'id':_0x46497e['id']});}if(!_0x2ad6a5){logger[_0x1aa5('0x17')](_0x1aa5('0x5d'),_0x1deb53);return _0x201ec9[_0x1aa5('0xc')](0x1f4)[_0x1aa5('0x5e')](_0x1deb53['message']);}logger[_0x1aa5('0x17')](_0x1aa5('0x5f'),_0x2ad6a5['id'],JSON[_0x1aa5('0x60')](_0x1deb53));});}; \ No newline at end of file +var _0x0149=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','from','state','base64','toString','ascii','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','microsoftAuthorization:success','emit','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit'];(function(_0x5d77d8,_0x359738){var _0x39996f=function(_0x49c571){while(--_0x49c571){_0x5d77d8['push'](_0x5d77d8['shift']());}};_0x39996f(++_0x359738);}(_0x0149,0xec));var _0x9014=function(_0x214aaa,_0x4e5f99){_0x214aaa=_0x214aaa-0x0;var _0x2152fe=_0x0149[_0x214aaa];return _0x2152fe;};'use strict';var _=require(_0x9014('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x9014('0x1'));var logger=require(_0x9014('0x2'))('api');var db=require(_0x9014('0x3'))['db'];var oauth=require(_0x9014('0x4'));config[_0x9014('0x5')]=_['defaults'](config[_0x9014('0x5')],{'host':_0x9014('0x6'),'port':0x18eb});var socket=require(_0x9014('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0x9014('0x5')]);function respondWithStatusCode(_0x36b843,_0x40d6ac){_0x40d6ac=_0x40d6ac||0xcc;return function(_0x4c8617){if(_0x4c8617){return _0x36b843[_0x9014('0x8')](_0x40d6ac);}return _0x36b843[_0x9014('0x9')](_0x40d6ac)[_0x9014('0xa')]();};}function respondWithResult(_0x416aa1,_0x574225){_0x574225=_0x574225||0xc8;return function(_0x48a3be){if(_0x48a3be){return _0x416aa1['status'](_0x574225)[_0x9014('0xb')](_0x48a3be);}};}function respondWithFilteredResult(_0x399604,_0x18cfd5){return function(_0x9277a7){if(_0x9277a7){var _0xedb515=typeof _0x18cfd5[_0x9014('0xc')]===_0x9014('0xd')&&typeof _0x18cfd5[_0x9014('0xe')]===_0x9014('0xd');var _0x3e1898=_0x9277a7[_0x9014('0xf')];var _0x5a768f=_0xedb515?0x0:_0x18cfd5[_0x9014('0xc')];var _0xefee37=_0xedb515?_0x9277a7['count']:_0x18cfd5['offset']+_0x18cfd5[_0x9014('0xe')];var _0x47ea77;if(_0xefee37>=_0x3e1898){_0xefee37=_0x3e1898;_0x47ea77=0xc8;}else{_0x47ea77=0xce;}_0x399604[_0x9014('0x9')](_0x47ea77);return _0x399604[_0x9014('0x10')](_0x9014('0x11'),_0x5a768f+'-'+_0xefee37+'/'+_0x3e1898)[_0x9014('0xb')](_0x9277a7);}return null;};}function saveUpdates(_0x2c0706){return function(_0x494523){if(_0x494523){return _0x494523[_0x9014('0x12')](_0x2c0706)[_0x9014('0x13')](function(_0x40bd76){return _0x40bd76;});}return null;};}function removeEntity(_0x2fe877){return function(_0x1ebcfb){if(_0x1ebcfb){return _0x1ebcfb[_0x9014('0x14')]()[_0x9014('0x13')](function(){_0x2fe877[_0x9014('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x140d02){return function(_0x23f6eb){if(!_0x23f6eb){_0x140d02['sendStatus'](0x194);}return _0x23f6eb;};}function handleError(_0x30a32d,_0x40a86){_0x40a86=_0x40a86||0x1f4;return function(_0x5f4885){logger['error'](_0x5f4885[_0x9014('0x15')]);if(_0x5f4885[_0x9014('0x16')]){delete _0x5f4885[_0x9014('0x16')];}_0x30a32d[_0x9014('0x9')](_0x40a86)[_0x9014('0x17')](_0x5f4885);};}function maskClientSecret(_0xa56b71){return _[_0x9014('0x18')](_0xa56b71[_0x9014('0x19')](0x0,0x3),0x14,'*');}exports[_0x9014('0x1a')]=function(_0x52772b,_0x1cbdac){var _0x1212b4={},_0x5668e2={},_0x427f56={'count':0x0,'rows':[]};var _0x30bcf6=_[_0x9014('0x1b')](db[_0x9014('0x1c')][_0x9014('0x1d')],function(_0x2c8825){return{'name':_0x2c8825[_0x9014('0x1e')],'type':_0x2c8825[_0x9014('0x1f')]['key']};});_0x5668e2['model']=_['map'](_0x30bcf6,_0x9014('0x16'));_0x5668e2[_0x9014('0x20')]=_[_0x9014('0x21')](_0x52772b['query']);_0x5668e2['filters']=_[_0x9014('0x22')](_0x5668e2[_0x9014('0x23')],_0x5668e2[_0x9014('0x20')]);_0x1212b4[_0x9014('0x24')]=_[_0x9014('0x22')](_0x5668e2[_0x9014('0x23')],qs[_0x9014('0x25')](_0x52772b[_0x9014('0x20')][_0x9014('0x25')]));_0x1212b4[_0x9014('0x24')]=_0x1212b4[_0x9014('0x24')][_0x9014('0x26')]?_0x1212b4['attributes']:_0x5668e2[_0x9014('0x23')];if(!_0x52772b[_0x9014('0x20')]['hasOwnProperty'](_0x9014('0x27'))){_0x1212b4[_0x9014('0xe')]=qs['limit'](_0x52772b['query'][_0x9014('0xe')]);_0x1212b4['offset']=qs[_0x9014('0xc')](_0x52772b[_0x9014('0x20')][_0x9014('0xc')]);}_0x1212b4[_0x9014('0x28')]=qs[_0x9014('0x29')](_0x52772b[_0x9014('0x20')]['sort']);_0x1212b4[_0x9014('0x2a')]=qs[_0x9014('0x2b')](_[_0x9014('0x2c')](_0x52772b['query'],_0x5668e2[_0x9014('0x2b')]),_0x30bcf6);if(_0x52772b[_0x9014('0x20')][_0x9014('0x2d')]){_0x1212b4[_0x9014('0x2a')]=_[_0x9014('0x2e')](_0x1212b4[_0x9014('0x2a')],{'$or':_[_0x9014('0x1b')](_0x30bcf6,function(_0x56c269){if(_0x56c269[_0x9014('0x1f')]!==_0x9014('0x2f')){var _0x460a6f={};_0x460a6f[_0x56c269['name']]={'$like':'%'+_0x52772b[_0x9014('0x20')]['filter']+'%'};return _0x460a6f;}})});}_0x1212b4=_[_0x9014('0x2e')]({},_0x1212b4,_0x52772b[_0x9014('0x30')]);var _0x5ca65c={'where':_0x1212b4['where']};return db[_0x9014('0x1c')][_0x9014('0xf')](_0x5ca65c)[_0x9014('0x13')](function(_0x4f86d6){_0x427f56[_0x9014('0xf')]=_0x4f86d6;if(_0x52772b['query'][_0x9014('0x31')]){_0x1212b4[_0x9014('0x32')]=[{'all':!![]}];}return db[_0x9014('0x1c')][_0x9014('0x33')](_0x1212b4);})['then'](function(_0x1520dd){_0x427f56[_0x9014('0x34')]=_['map'](_0x1520dd,function(_0x3cc077){if(_0x3cc077[_0x9014('0x35')]===_0x9014('0x36')){var _0xa28908=encryptor[_0x9014('0x37')](_0x3cc077[_0x9014('0x38')]);_0x3cc077[_0x9014('0x38')]=maskClientSecret(_0xa28908);}return _0x3cc077;});return _0x427f56;})[_0x9014('0x13')](respondWithFilteredResult(_0x1cbdac,_0x1212b4))[_0x9014('0x39')](handleError(_0x1cbdac,null));};exports[_0x9014('0x3a')]=function(_0x57aa09,_0x376223){var _0x4cfa8d={'raw':!![],'where':{'id':_0x57aa09[_0x9014('0x3b')]['id']}},_0x107474={};_0x107474[_0x9014('0x23')]=_['keys'](db[_0x9014('0x1c')][_0x9014('0x1d')]);_0x107474[_0x9014('0x20')]=_[_0x9014('0x21')](_0x57aa09['query']);_0x107474[_0x9014('0x2b')]=_[_0x9014('0x22')](_0x107474['model'],_0x107474[_0x9014('0x20')]);_0x4cfa8d[_0x9014('0x24')]=_[_0x9014('0x22')](_0x107474[_0x9014('0x23')],qs['fields'](_0x57aa09[_0x9014('0x20')]['fields']));_0x4cfa8d['attributes']=_0x4cfa8d[_0x9014('0x24')][_0x9014('0x26')]?_0x4cfa8d['attributes']:_0x107474['model'];if(_0x57aa09[_0x9014('0x20')][_0x9014('0x31')]){_0x4cfa8d[_0x9014('0x32')]=[{'all':!![]}];}_0x4cfa8d=_[_0x9014('0x2e')]({},_0x4cfa8d,_0x57aa09['options']);return db[_0x9014('0x1c')][_0x9014('0x3c')](_0x4cfa8d)[_0x9014('0x13')](handleEntityNotFound(_0x376223,null))['then'](function(_0x57ff58){if(_0x57ff58[_0x9014('0x35')]===_0x9014('0x36')){var _0xd208e7=encryptor['decryptString'](_0x57ff58[_0x9014('0x38')]);_0x57ff58[_0x9014('0x38')]=maskClientSecret(_0xd208e7);}return _0x57ff58;})[_0x9014('0x13')](respondWithResult(_0x376223,null))[_0x9014('0x39')](handleError(_0x376223,null));};exports[_0x9014('0x3d')]=function(_0x1d14dc,_0x53ab43){if(!_0x1d14dc[_0x9014('0x3e')][_0x9014('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1d14dc[_0x9014('0x3e')][_0x9014('0x35')])throw new Error(_0x9014('0x3f'));var _0xf46db2=db['CloudProvider']['rawAttributes'][_0x9014('0x35')][_0x9014('0x40')];if(!_0xf46db2[_0x9014('0x41')](_0x1d14dc[_0x9014('0x3e')]['service']))throw new Error(_0x9014('0x42')+_0xf46db2[_0x9014('0x43')](',\x20'));if(_0x1d14dc[_0x9014('0x3e')][_0x9014('0x35')]===_0x9014('0x36')&&_0x1d14dc[_0x9014('0x3e')][_0x9014('0x38')]){_0x1d14dc[_0x9014('0x3e')][_0x9014('0x38')]=encryptor[_0x9014('0x44')](_0x1d14dc[_0x9014('0x3e')]['data3']);}return db['CloudProvider']['create'](_0x1d14dc[_0x9014('0x3e')],{})['then'](respondWithResult(_0x53ab43,0xc9))[_0x9014('0x39')](handleError(_0x53ab43,null));};exports[_0x9014('0x12')]=function(_0x1a2fcc,_0x4cccac){if(_0x1a2fcc[_0x9014('0x3e')]['id']){delete _0x1a2fcc['body']['id'];}return db[_0x9014('0x1c')][_0x9014('0x3c')]({'where':{'id':_0x1a2fcc[_0x9014('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4cccac,null))[_0x9014('0x13')](function(_0xcb09d3){if(_0xcb09d3[_0x9014('0x35')]===_0x9014('0x36')&&_0x1a2fcc[_0x9014('0x3e')]['data3']){_0x1a2fcc[_0x9014('0x3e')]['data3']=encryptor[_0x9014('0x44')](_0x1a2fcc[_0x9014('0x3e')][_0x9014('0x38')]);}return _0xcb09d3;})[_0x9014('0x13')](saveUpdates(_0x1a2fcc[_0x9014('0x3e')],null))['then'](respondWithResult(_0x4cccac,null))['catch'](handleError(_0x4cccac,null));};exports[_0x9014('0x14')]=function(_0x332820,_0x7cd0a0){return db[_0x9014('0x1c')][_0x9014('0x3c')]({'where':{'id':_0x332820[_0x9014('0x3b')]['id']}})['then'](handleEntityNotFound(_0x7cd0a0,null))[_0x9014('0x13')](removeEntity(_0x7cd0a0,null))[_0x9014('0x39')](handleError(_0x7cd0a0,null));};exports[_0x9014('0x45')]=function(_0x234df2,_0x84db63){return db[_0x9014('0x1c')][_0x9014('0x46')]({'where':{'id':_0x234df2['params']['id']},'raw':!![]})[_0x9014('0x13')](function(_0x28cf76){if(!_0x28cf76)return _0x84db63[_0x9014('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x28cf76,_0x234df2[_0x9014('0x47')]['id'])};})[_0x9014('0x13')](respondWithResult(_0x84db63,null))[_0x9014('0x39')](handleError(_0x84db63,null));};exports[_0x9014('0x48')]=function(_0x32b6ab,_0x5cfe90){var _0x4b8a5b=_0x32b6ab[_0x9014('0x3e')];var _0x44a1c3;var _0x5330ad;if(_0x4b8a5b[_0x9014('0x49')])throw _0x4b8a5b;redis['get'](_0x4b8a5b['state'])['then'](function(_0x5ef190){if(!_0x5ef190)throw new Error('Invalid\x20state\x20parameter');_0x44a1c3=JSON['parse'](_0x5ef190);var _0x1a90ba=Buffer[_0x9014('0x4a')](_0x4b8a5b[_0x9014('0x4b')],_0x9014('0x4c'))[_0x9014('0x4d')](_0x9014('0x4e'));_0x5330ad=JSON[_0x9014('0x4f')](_0x1a90ba);if(!oauth[_0x9014('0x50')](_0x4b8a5b['id_token'],_0x44a1c3['oauth2Claims']))throw new Error(_0x9014('0x51'));redis[_0x9014('0x52')](_0x4b8a5b[_0x9014('0x4b')]);return oauth[_0x9014('0x53')](_0x4b8a5b['code'],_0x44a1c3);})[_0x9014('0x13')](function(_0x457d90){_0x44a1c3[_0x9014('0x54')]=_0x457d90['access_token'];_0x44a1c3[_0x9014('0x55')]=_0x457d90[_0x9014('0x56')];return db['CloudProvider']['update']({'data5':_0x44a1c3['data5'],'data6':_0x44a1c3[_0x9014('0x55')]},{'where':{'id':_0x44a1c3['id']}});})[_0x9014('0x13')](function(){oauth['startRefreshInterval'](_0x44a1c3);socket['emit'](_0x9014('0x57'),{'id':_0x5330ad['id']});return;})[_0x9014('0x13')](respondWithStatusCode(_0x5cfe90,null))['catch'](function(_0x93dd4c){if(_0x5330ad){socket[_0x9014('0x58')]('microsoftAuthorization:error',{'id':_0x5330ad['id']});}if(!_0x44a1c3){logger['error'](_0x9014('0x59'),_0x93dd4c);return _0x5cfe90['status'](0x1f4)['send'](_0x93dd4c['message']);}logger[_0x9014('0x49')](_0x9014('0x5a'),_0x44a1c3['id'],JSON[_0x9014('0x5b')](_0x93dd4c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5e06edb..3de0970 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 _0x6f53=['bluebird','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x53cd94,_0xdb71b0){var _0x1d3b02=function(_0x789d69){while(--_0x789d69){_0x53cd94['push'](_0x53cd94['shift']());}};_0x1d3b02(++_0xdb71b0);}(_0x6f53,0x19f));var _0x36f5=function(_0x31c81b,_0x20f535){_0x31c81b=_0x31c81b-0x0;var _0x371034=_0x6f53[_0x31c81b];return _0x371034;};'use strict';var _=require(_0x36f5('0x0'));var util=require(_0x36f5('0x1'));var logger=require(_0x36f5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36f5('0x4'));var rimraf=require(_0x36f5('0x5'));var config=require('../../config/environment');var attributes=require(_0x36f5('0x6'));module[_0x36f5('0x7')]=function(_0x536c03,_0x3d9bf3){return _0x536c03[_0x36f5('0x8')](_0x36f5('0x9'),attributes,{'tableName':_0x36f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72f5=['CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x5bc347,_0x328f6f){var _0x28622b=function(_0x586dbe){while(--_0x586dbe){_0x5bc347['push'](_0x5bc347['shift']());}};_0x28622b(++_0x328f6f);}(_0x72f5,0x144));var _0x572f=function(_0x135b16,_0x5dc1ce){_0x135b16=_0x135b16-0x0;var _0x33071c=_0x72f5[_0x135b16];return _0x33071c;};'use strict';var _=require(_0x572f('0x0'));var util=require(_0x572f('0x1'));var logger=require(_0x572f('0x2'))('api');var moment=require(_0x572f('0x3'));var BPromise=require(_0x572f('0x4'));var rp=require(_0x572f('0x5'));var fs=require('fs');var path=require(_0x572f('0x6'));var rimraf=require(_0x572f('0x7'));var config=require(_0x572f('0x8'));var attributes=require(_0x572f('0x9'));module[_0x572f('0xa')]=function(_0x2c9383,_0x2c7e4a){return _0x2c9383[_0x572f('0xb')](_0x572f('0xc'),attributes,{'tableName':_0x572f('0xd'),'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 5741dae..12350b1 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 _0x8559=['../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','type','Dynamics365','/.default','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','data1','response_type','join','redirect_uri','data4','form_post','scope','state','nonce','login','key','value','oauth2Claims','replace','oauth2/','decode','payload','iss','issuer','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','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','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor'];(function(_0x218554,_0x2896f4){var _0x3a2bbf=function(_0x106868){while(--_0x106868){_0x218554['push'](_0x218554['shift']());}};_0x3a2bbf(++_0x2896f4);}(_0x8559,0x175));var _0x9855=function(_0xcd47a,_0x100962){_0xcd47a=_0xcd47a-0x0;var _0x4b58dd=_0x8559[_0xcd47a];return _0x4b58dd;};'use strict';var _=require('lodash');var crypto=require(_0x9855('0x0'));var jwt=require(_0x9855('0x1'));var moment=require(_0x9855('0x2'));var Redis=require(_0x9855('0x3'));var rp=require(_0x9855('0x4'));var util=require(_0x9855('0x5'));var encryptor=require(_0x9855('0x6'));var config=require(_0x9855('0x7'));var logger=require(_0x9855('0x8'))(_0x9855('0x9'));var schedule=require(_0x9855('0xa'));var db=require(_0x9855('0xb'))['db'];config[_0x9855('0xc')]=_[_0x9855('0xd')](config[_0x9855('0xc')],{'host':_0x9855('0xe'),'port':0x18eb});var redis=new Redis(config[_0x9855('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x9855('0xf'),_0x9855('0x10'),'offline_access',_0x9855('0x11'),_0x9855('0x12'),_0x9855('0x13')],'Dynamics365':[_0x9855('0x14'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x9855('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4727da){var _0x2d6e66=_[_0x9855('0x16')](AZURE_AUTH_SCOPES[_0x4727da[_0x9855('0x17')]]);if(_0x4727da[_0x9855('0x17')]===_0x9855('0x18'))_0x2d6e66['push'](_0x4727da['data7']+_0x9855('0x19'));return _0x2d6e66['join']('\x20');}function getAccessTokenScope(_0x718a08){if(_0x718a08[_0x9855('0x17')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x718a08[_0x9855('0x17')]===_0x9855('0x18'))return _0x718a08['data7']+_0x9855('0x19');}function generateMicrosoftAuthorizationUrl(_0x28cd68,_0x27afd4){var _0x5b1953=MICROSOFT_AUTH_URL['replace'](_0x9855('0x1a'),_0x28cd68[_0x9855('0x1b')]);var _0xaec9f2=[_0x9855('0x1c'),_0x9855('0x1d')];var _0x17bcfe=Buffer[_0x9855('0x1e')](JSON[_0x9855('0x1f')]({'id':_0x27afd4}))[_0x9855('0x20')](_0x9855('0x21'));var _0x72bc7a=crypto[_0x9855('0x22')](0x10)[_0x9855('0x20')]('hex');var _0x126b20=getAuthorizationScopes(_0x28cd68);var _0x562828=[{'key':'client_id','value':_0x28cd68[_0x9855('0x23')]},{'key':_0x9855('0x24'),'value':encodeURIComponent(_0xaec9f2[_0x9855('0x25')]('\x20'))},{'key':_0x9855('0x26'),'value':_0x28cd68[_0x9855('0x27')]},{'key':'response_mode','value':_0x9855('0x28')},{'key':_0x9855('0x29'),'value':encodeURIComponent(_0x126b20)},{'key':_0x9855('0x2a'),'value':_0x17bcfe},{'key':_0x9855('0x2b'),'value':_0x72bc7a},{'key':'prompt','value':_0x9855('0x2c')}];var _0x577d6a=_0x5b1953+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9855('0x16')](_0x562828,function(_0x1db66c){return _0x1db66c[_0x9855('0x2d')]+'='+_0x1db66c[_0x9855('0x2e')];})[_0x9855('0x25')]('&');_0x28cd68[_0x9855('0x2f')]={'issuer':_0x5b1953[_0x9855('0x30')](_0x9855('0x31'),''),'audience':_0x28cd68[_0x9855('0x23')],'state':_0x17bcfe,'nonce':_0x72bc7a};redis['set'](_0x17bcfe,JSON[_0x9855('0x1f')](_0x28cd68));return _0x577d6a;}function isValidIdToken(_0x805928,_0x310a39){try{var _0x1705e1=jwt[_0x9855('0x32')](_0x805928,{'complete':!![]});var _0x41e902=_0x1705e1[_0x9855('0x33')];if(_0x41e902[_0x9855('0x34')]!==_0x310a39[_0x9855('0x35')])return![];if(_0x41e902[_0x9855('0x36')]!==_0x310a39['audience'])return![];if(_0x41e902[_0x9855('0x2b')]!==_0x310a39[_0x9855('0x2b')])return![];if(moment()['isAfter'](moment[_0x9855('0x37')](_0x41e902[_0x9855('0x38')])))return![];return!![];}catch(_0x40bdd8){throw _0x40bdd8;}}function refreshOauth2MicrosoftAccessToken(_0x3b9936){return Promise[_0x9855('0x39')]()[_0x9855('0x3a')](function(){if(_0x3b9936[_0x9855('0x3b')])return _0x3b9936;return db[_0x9855('0x3c')][_0x9855('0x3d')]({'where':{'id':_0x3b9936['id']},'raw':!![]});})[_0x9855('0x3a')](function(_0x5ef6d3){var _0x11714a={'grant_type':_0x9855('0x3e'),'refresh_token':_0x5ef6d3[_0x9855('0x3f')],'scope':getAccessTokenScope(_0x5ef6d3),'redirect_uri':_0x5ef6d3[_0x9855('0x27')],'client_id':_0x5ef6d3['data1'],'client_secret':encryptor[_0x9855('0x40')](_0x5ef6d3[_0x9855('0x3b')])};var _0xc37255={'method':_0x9855('0x41'),'uri':MICROSOFT_AUTH_URL[_0x9855('0x30')](_0x9855('0x1a'),_0x5ef6d3[_0x9855('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11714a,'json':!![]};return rp(_0xc37255);})[_0x9855('0x3a')](function(_0x526b5e){_0x3b9936[_0x9855('0x42')]=_0x526b5e[_0x9855('0x43')];_0x3b9936[_0x9855('0x3f')]=_0x526b5e[_0x9855('0x3e')];return db[_0x9855('0x3c')]['update']({'data5':_0x3b9936[_0x9855('0x42')],'data6':_0x3b9936[_0x9855('0x3f')]},{'where':{'id':_0x3b9936['id']}});})[_0x9855('0x3a')](function(){return _0x3b9936;})[_0x9855('0x44')](function(_0x3d871e){logger[_0x9855('0x45')](_0x9855('0x46'),_0x3b9936['id'],_0x3d871e);});}function getOauth2MicrosoftAccessToken(_0x15d482,_0x4f5132){var _0x1e4add={'grant_type':'authorization_code','code':_0x15d482,'scope':getAccessTokenScope(_0x4f5132),'redirect_uri':_0x4f5132['data4'],'client_id':_0x4f5132[_0x9855('0x23')],'client_secret':encryptor[_0x9855('0x40')](_0x4f5132[_0x9855('0x3b')])};var _0x284dd2={'method':_0x9855('0x41'),'uri':MICROSOFT_AUTH_URL[_0x9855('0x30')](_0x9855('0x1a'),_0x4f5132[_0x9855('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1e4add,'json':!![]};return rp(_0x284dd2);}function startRefreshInterval(_0x1d2187){var _0x3cae93=schedule[_0x9855('0x47')];if(_0x3cae93[_0x1d2187['id']])clearInterval(_0x3cae93[_0x1d2187['id']]);_0x3cae93[_0x1d2187['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1d2187['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9855('0x47')]=_0x3cae93;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x9855('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9855('0x3a')](function(_0x4cb1c4){var _0x30a2f1=_0x4cb1c4[_0x9855('0x16')](function(_0x496b56){return refreshOauth2MicrosoftAccessToken(_0x496b56)[_0x9855('0x3a')](function(_0x4f1ec9){startRefreshInterval(_0x4f1ec9);});});return Promise[_0x9855('0x49')](_0x30a2f1);})[_0x9855('0x44')](function(_0x3f6f80){var _0x53316f=_0x3f6f80?util[_0x9855('0x4a')](_0x3f6f80,{'showHidden':![],'depth':null}):'';logger[_0x9855('0x45')](_0x9855('0x4b'),_0x53316f);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x380b=['state','nonce','login','key','value','join','oauth2Claims','oauth2/','decode','payload','issuer','aud','audience','isAfter','unix','resolve','data3','CloudProvider','then','refresh_token','data6','data4','decryptString','POST','data2','access_token','update','data5','catch','error','authorization_code','bind','intervals','findAll','all','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','response_type','response_mode','scope'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x380b,0x195));var _0xb380=function(_0x332b6a,_0x974da3){_0x332b6a=_0x332b6a-0x0;var _0x23db9d=_0x380b[_0x332b6a];return _0x23db9d;};'use strict';var _=require(_0xb380('0x0'));var crypto=require(_0xb380('0x1'));var jwt=require(_0xb380('0x2'));var moment=require(_0xb380('0x3'));var Redis=require(_0xb380('0x4'));var rp=require('request-promise');var util=require(_0xb380('0x5'));var encryptor=require(_0xb380('0x6'));var config=require(_0xb380('0x7'));var logger=require(_0xb380('0x8'))('api');var schedule=require(_0xb380('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xb380('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xb380('0xa')]);var MICROSOFT_AUTH_URL=_0xb380('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb380('0xc'),'email',_0xb380('0xd'),_0xb380('0xe'),_0xb380('0xf'),_0xb380('0x10')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xb380('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xb380('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xeb0bf1){var _0x4a4817=_[_0xb380('0x13')](AZURE_AUTH_SCOPES[_0xeb0bf1[_0xb380('0x14')]]);if(_0xeb0bf1['type']===_0xb380('0x15'))_0x4a4817[_0xb380('0x16')](_0xeb0bf1[_0xb380('0x17')]+_0xb380('0x18'));return _0x4a4817['join']('\x20');}function getAccessTokenScope(_0xc0d448){if(_0xc0d448[_0xb380('0x14')]==='Outlook365')return _0xb380('0xe');if(_0xc0d448[_0xb380('0x14')]===_0xb380('0x15'))return _0xc0d448[_0xb380('0x17')]+_0xb380('0x18');}function generateMicrosoftAuthorizationUrl(_0xf63433,_0x42b1b3){var _0xe54671=MICROSOFT_AUTH_URL[_0xb380('0x19')](_0xb380('0x1a'),_0xf63433['data2']);var _0x1bd1a1=[_0xb380('0x1b'),_0xb380('0x1c')];var _0xdef70e=Buffer[_0xb380('0x1d')](JSON[_0xb380('0x1e')]({'id':_0x42b1b3}))[_0xb380('0x1f')](_0xb380('0x20'));var _0xec7e90=crypto[_0xb380('0x21')](0x10)['toString']('hex');var _0x1273bd=getAuthorizationScopes(_0xf63433);var _0x5ba60f=[{'key':_0xb380('0x22'),'value':_0xf63433[_0xb380('0x23')]},{'key':_0xb380('0x24'),'value':encodeURIComponent(_0x1bd1a1['join']('\x20'))},{'key':'redirect_uri','value':_0xf63433['data4']},{'key':_0xb380('0x25'),'value':'form_post'},{'key':_0xb380('0x26'),'value':encodeURIComponent(_0x1273bd)},{'key':_0xb380('0x27'),'value':_0xdef70e},{'key':_0xb380('0x28'),'value':_0xec7e90},{'key':'prompt','value':_0xb380('0x29')}];var _0x1875eb=_0xe54671+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb380('0x13')](_0x5ba60f,function(_0x128947){return _0x128947[_0xb380('0x2a')]+'='+_0x128947[_0xb380('0x2b')];})[_0xb380('0x2c')]('&');_0xf63433[_0xb380('0x2d')]={'issuer':_0xe54671[_0xb380('0x19')](_0xb380('0x2e'),''),'audience':_0xf63433[_0xb380('0x23')],'state':_0xdef70e,'nonce':_0xec7e90};redis['set'](_0xdef70e,JSON[_0xb380('0x1e')](_0xf63433));return _0x1875eb;}function isValidIdToken(_0x18cade,_0xc8980c){try{var _0xb4cbd9=jwt[_0xb380('0x2f')](_0x18cade,{'complete':!![]});var _0x1222f1=_0xb4cbd9[_0xb380('0x30')];if(_0x1222f1['iss']!==_0xc8980c[_0xb380('0x31')])return![];if(_0x1222f1[_0xb380('0x32')]!==_0xc8980c[_0xb380('0x33')])return![];if(_0x1222f1[_0xb380('0x28')]!==_0xc8980c[_0xb380('0x28')])return![];if(moment()[_0xb380('0x34')](moment[_0xb380('0x35')](_0x1222f1['exp'])))return![];return!![];}catch(_0x1d0173){throw _0x1d0173;}}function refreshOauth2MicrosoftAccessToken(_0x263020){return Promise[_0xb380('0x36')]()['then'](function(){if(_0x263020[_0xb380('0x37')])return _0x263020;return db[_0xb380('0x38')]['findOne']({'where':{'id':_0x263020['id']},'raw':!![]});})[_0xb380('0x39')](function(_0x3fcf07){var _0x3cf069={'grant_type':_0xb380('0x3a'),'refresh_token':_0x3fcf07[_0xb380('0x3b')],'scope':getAccessTokenScope(_0x3fcf07),'redirect_uri':_0x3fcf07[_0xb380('0x3c')],'client_id':_0x3fcf07[_0xb380('0x23')],'client_secret':encryptor[_0xb380('0x3d')](_0x3fcf07['data3'])};var _0x3904b2={'method':_0xb380('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xb380('0x19')](_0xb380('0x1a'),_0x3fcf07[_0xb380('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3cf069,'json':!![]};return rp(_0x3904b2);})[_0xb380('0x39')](function(_0x36d0db){_0x263020['data5']=_0x36d0db[_0xb380('0x40')];_0x263020[_0xb380('0x3b')]=_0x36d0db[_0xb380('0x3a')];return db[_0xb380('0x38')][_0xb380('0x41')]({'data5':_0x263020[_0xb380('0x42')],'data6':_0x263020['data6']},{'where':{'id':_0x263020['id']}});})[_0xb380('0x39')](function(){return _0x263020;})[_0xb380('0x43')](function(_0x366d1d){logger[_0xb380('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x263020['id'],_0x366d1d);});}function getOauth2MicrosoftAccessToken(_0x419e74,_0x3bb5ea){var _0x55994a={'grant_type':_0xb380('0x45'),'code':_0x419e74,'scope':getAccessTokenScope(_0x3bb5ea),'redirect_uri':_0x3bb5ea[_0xb380('0x3c')],'client_id':_0x3bb5ea['data1'],'client_secret':encryptor[_0xb380('0x3d')](_0x3bb5ea[_0xb380('0x37')])};var _0x54f2ac={'method':_0xb380('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xb380('0x19')](_0xb380('0x1a'),_0x3bb5ea['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x55994a,'json':!![]};return rp(_0x54f2ac);}function startRefreshInterval(_0x1dcd20){var _0xdde6d3=schedule['intervals'];if(_0xdde6d3[_0x1dcd20['id']])clearInterval(_0xdde6d3[_0x1dcd20['id']]);_0xdde6d3[_0x1dcd20['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb380('0x46')](this,{'id':_0x1dcd20['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb380('0x47')]=_0xdde6d3;}function startAllRefreshIntervals(){return db[_0xb380('0x38')][_0xb380('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb380('0x39')](function(_0x231cb7){var _0x4f6ecb=_0x231cb7['map'](function(_0x2ceb8b){return refreshOauth2MicrosoftAccessToken(_0x2ceb8b)[_0xb380('0x39')](function(_0x6a836d){startRefreshInterval(_0x6a836d);});});return Promise[_0xb380('0x49')](_0x4f6ecb);})['catch'](function(_0x492362){var _0x4165a1=_0x492362?util['inspect'](_0x492362,{'showHidden':![],'depth':null}):'';logger[_0xb380('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4165a1);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 7ec8c3e..8ef7f19 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 _0xccde=['stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0xccde,0x1e1));var _0xeccd=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xccde[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('CloudProvider,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});} \ No newline at end of file +var _0x9ccd=['catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1de14f,_0x3563cb){var _0x512594=function(_0x3d42a5){while(--_0x3d42a5){_0x1de14f['push'](_0x1de14f['shift']());}};_0x512594(++_0x3563cb);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('CloudProvider,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6d23763..fa37162 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x2f09a3,_0x3d2777){_0x2f09a3=_0x2f09a3-0x0;var _0xa63c1c=_0x7a54[_0x2f09a3];return _0xa63c1c;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7a54,0x106));var _0x47a5=function(_0x4fc184,_0x1efea3){_0x4fc184=_0x4fc184-0x0;var _0x9b209b=_0x7a54[_0x4fc184];return _0x9b209b;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index bcea597..abcdf3b 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 _0xfca5=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfca5,0x1cf));var _0x5fca=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xfca5[_0x576266];return _0x18234f;};'use strict';var Sequelize=require(_0x5fca('0x0'));module[_0x5fca('0x1')]={'name':{'type':Sequelize[_0x5fca('0x2')],'unique':_0x5fca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5fca('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5fca('0x2')]},'phone':{'type':Sequelize[_0x5fca('0x2')]},'fax':{'type':Sequelize[_0x5fca('0x2')]},'type':{'type':Sequelize[_0x5fca('0x2')]},'street':{'type':Sequelize[_0x5fca('0x2')]},'postalCode':{'type':Sequelize[_0x5fca('0x2')]},'city':{'type':Sequelize[_0x5fca('0x2')]},'country':{'type':Sequelize[_0x5fca('0x2')]},'email':{'type':Sequelize[_0x5fca('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5fca('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x5fca('0x2')]},'sCity':{'type':Sequelize[_0x5fca('0x2')]},'sCountry':{'type':Sequelize[_0x5fca('0x2')]},'description':{'type':Sequelize[_0x5fca('0x2')]}}; \ No newline at end of file +var _0xfc5b=['name','STRING','sequelize','exports'];(function(_0x48d4a2,_0x5b6c4e){var _0x2befa0=function(_0x1945bb){while(--_0x1945bb){_0x48d4a2['push'](_0x48d4a2['shift']());}};_0x2befa0(++_0x5b6c4e);}(_0xfc5b,0xda));var _0xbfc5=function(_0x328a23,_0x6f9208){_0x328a23=_0x328a23-0x0;var _0x3876a1=_0xfc5b[_0x328a23];return _0x3876a1;};'use strict';var Sequelize=require(_0xbfc5('0x0'));module[_0xbfc5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbfc5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbfc5('0x3')]},'companyId':{'type':Sequelize[_0xbfc5('0x3')]},'website':{'type':Sequelize[_0xbfc5('0x3')]},'phone':{'type':Sequelize[_0xbfc5('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbfc5('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbfc5('0x3')]},'email':{'type':Sequelize[_0xbfc5('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbfc5('0x3')]},'sStreet':{'type':Sequelize[_0xbfc5('0x3')]},'sPostalCode':{'type':Sequelize[_0xbfc5('0x3')]},'sCity':{'type':Sequelize[_0xbfc5('0x3')]},'sCountry':{'type':Sequelize[_0xbfc5('0x3')]},'description':{'type':Sequelize[_0xbfc5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5a81938..6141da6 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 _0x150c=['status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','keys','filters','intersection','model','query','fields','attributes','length','limit','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','include','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','addContacts','CmContact','omit','ids','getContacts','findOne','rawAttributes','map','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x150c,0x9a));var _0xc150=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x150c[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0xc150('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc150('0x1'));var rp=require(_0xc150('0x2'));var moment=require(_0xc150('0x3'));var BPromise=require(_0xc150('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc150('0x5'));var sox=require(_0xc150('0x6'));var csv=require(_0xc150('0x7'));var ejs=require(_0xc150('0x8'));var fs=require('fs');var fs_extra=require(_0xc150('0x9'));var _=require(_0xc150('0xa'));var squel=require(_0xc150('0xb'));var crypto=require(_0xc150('0xc'));var jsforce=require(_0xc150('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc150('0x7'));var querystring=require(_0xc150('0xe'));var Papa=require(_0xc150('0xf'));var Redis=require('ioredis');var authService=require(_0xc150('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc150('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc150('0x12'))(_0xc150('0x13'));var utils=require(_0xc150('0x14'));var config=require(_0xc150('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc150('0x16'))['db'];function respondWithStatusCode(_0x4268f3,_0x3b91a4){_0x3b91a4=_0x3b91a4||0xcc;return function(_0x2bcda4){if(_0x2bcda4){return _0x4268f3[_0xc150('0x17')](_0x3b91a4);}return _0x4268f3[_0xc150('0x18')](_0x3b91a4)[_0xc150('0x19')]();};}function respondWithResult(_0x19e986,_0x4a32d4){_0x4a32d4=_0x4a32d4||0xc8;return function(_0x4a120a){if(_0x4a120a){return _0x19e986[_0xc150('0x18')](_0x4a32d4)[_0xc150('0x1a')](_0x4a120a);}};}function respondWithFilteredResult(_0x440422,_0x5a094a){return function(_0x3d730b){if(_0x3d730b){var _0x3ccefc=typeof _0x5a094a[_0xc150('0x1b')]==='undefined'&&typeof _0x5a094a['limit']===_0xc150('0x1c');var _0x364e0a=_0x3d730b[_0xc150('0x1d')];var _0x1120c9=_0x3ccefc?0x0:_0x5a094a[_0xc150('0x1b')];var _0x302a01=_0x3ccefc?_0x3d730b[_0xc150('0x1d')]:_0x5a094a['offset']+_0x5a094a['limit'];var _0x2f89b2;if(_0x302a01>=_0x364e0a){_0x302a01=_0x364e0a;_0x2f89b2=0xc8;}else{_0x2f89b2=0xce;}_0x440422[_0xc150('0x18')](_0x2f89b2);return _0x440422[_0xc150('0x1e')](_0xc150('0x1f'),_0x1120c9+'-'+_0x302a01+'/'+_0x364e0a)[_0xc150('0x1a')](_0x3d730b);}return null;};}function patchUpdates(_0x2ba0ab){return function(_0xb70a76){try{jsonpatch[_0xc150('0x20')](_0xb70a76,_0x2ba0ab,!![]);}catch(_0x2c43f2){return BPromise[_0xc150('0x21')](_0x2c43f2);}return _0xb70a76['save']();};}function saveUpdates(_0x58162d,_0xeee1d4){return function(_0x55d1e3){if(_0x55d1e3){return _0x55d1e3[_0xc150('0x22')](_0x58162d)[_0xc150('0x23')](function(_0x527b8a){return _0x527b8a;});}return null;};}function removeEntity(_0x210fd5,_0x59059d){return function(_0x289090){if(_0x289090){return _0x289090[_0xc150('0x24')]()[_0xc150('0x23')](function(){var _0x5f4992=_0x289090[_0xc150('0x25')]({'plain':!![]});var _0x453f41='Companies';return db[_0xc150('0x26')][_0xc150('0x24')]({'where':{'type':_0x453f41,'resourceId':_0x5f4992['id']}})[_0xc150('0x23')](function(){return _0x289090;});})[_0xc150('0x23')](function(){_0x210fd5[_0xc150('0x18')](0xcc)[_0xc150('0x19')]();});}};}function handleEntityNotFound(_0x33cd44,_0x5a5a31){return function(_0x489294){if(!_0x489294){_0x33cd44['sendStatus'](0x194);}return _0x489294;};}function handleError(_0x129941,_0x79a54e){_0x79a54e=_0x79a54e||0x1f4;return function(_0x2c198f){logger[_0xc150('0x27')](_0x2c198f[_0xc150('0x28')]);if(_0x2c198f['name']){delete _0x2c198f[_0xc150('0x29')];}_0x129941[_0xc150('0x18')](_0x79a54e)[_0xc150('0x2a')](_0x2c198f);};}exports[_0xc150('0x2b')]=function(_0x1d145b,_0x49fb47){var _0x174ec7={},_0x24760c={},_0x41347a={'count':0x0,'rows':[]};return db[_0xc150('0x2c')][_0xc150('0x2d')]()['then'](function(_0x3efd2c){_0x24760c['model']=_['keys'](_0x3efd2c);_0x24760c['query']=_[_0xc150('0x2e')](_0x1d145b['query']);_0x24760c[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x24760c[_0xc150('0x31')],_0x24760c[_0xc150('0x32')]);_0x174ec7['attributes']=_[_0xc150('0x30')](_0x24760c[_0xc150('0x31')],qs[_0xc150('0x33')](_0x1d145b[_0xc150('0x32')][_0xc150('0x33')]));_0x174ec7[_0xc150('0x34')]=_0x174ec7[_0xc150('0x34')][_0xc150('0x35')]?_0x174ec7[_0xc150('0x34')]:_0x24760c[_0xc150('0x31')];if(!_0x1d145b[_0xc150('0x32')]['hasOwnProperty']('nolimit')){_0x174ec7[_0xc150('0x36')]=qs[_0xc150('0x36')](_0x1d145b[_0xc150('0x32')]['limit']);_0x174ec7[_0xc150('0x1b')]=qs[_0xc150('0x1b')](_0x1d145b[_0xc150('0x32')][_0xc150('0x1b')]);}_0x174ec7[_0xc150('0x37')]=qs[_0xc150('0x38')](_0x1d145b[_0xc150('0x32')][_0xc150('0x38')]);_0x174ec7[_0xc150('0x39')]=qs[_0xc150('0x2f')](_[_0xc150('0x3a')](_0x1d145b['query'],_0x24760c['filters']),_0x3efd2c);if(_0x1d145b[_0xc150('0x32')]['filter']){_0x174ec7[_0xc150('0x39')]=_[_0xc150('0x3b')](_0x174ec7['where'],{'$or':_['map'](_0x174ec7[_0xc150('0x34')],function(_0x514c25){var _0x4c5797={};_0x4c5797[_0x514c25]={'$like':'%'+_0x1d145b[_0xc150('0x32')][_0xc150('0x3c')]+'%'};return _0x4c5797;})});}_0x174ec7=_['merge']({},_0x174ec7,_0x1d145b['options']);var _0xaa3a77={'where':_0x174ec7[_0xc150('0x39')]};return db[_0xc150('0x2c')][_0xc150('0x1d')](_0xaa3a77)[_0xc150('0x23')](function(_0x3ae607){_0x41347a[_0xc150('0x1d')]=_0x3ae607;if(_0x1d145b[_0xc150('0x32')][_0xc150('0x3d')]){_0x174ec7['include']=[{'all':!![]}];}return db[_0xc150('0x2c')][_0xc150('0x3e')](_0x174ec7);})[_0xc150('0x23')](function(_0x4b55fa){_0x41347a[_0xc150('0x3f')]=_0x4b55fa;return _0x41347a;})[_0xc150('0x23')](respondWithFilteredResult(_0x49fb47,_0x174ec7))['catch'](handleError(_0x49fb47,null));})[_0xc150('0x40')](handleError(_0x49fb47,null));};exports[_0xc150('0x41')]=function(_0xfc9d19,_0x4de175){var _0x89406f={'raw':![],'where':{'id':_0xfc9d19[_0xc150('0x42')]['id']}},_0x5c999d={};_0x5c999d[_0xc150('0x31')]=_[_0xc150('0x2e')](db['CmCompany']['rawAttributes']);_0x5c999d['query']=_[_0xc150('0x2e')](_0xfc9d19[_0xc150('0x32')]);_0x5c999d[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x5c999d[_0xc150('0x31')],_0x5c999d[_0xc150('0x32')]);_0x89406f['attributes']=_[_0xc150('0x30')](_0x5c999d[_0xc150('0x31')],qs[_0xc150('0x33')](_0xfc9d19['query'][_0xc150('0x33')]));_0x89406f[_0xc150('0x34')]=_0x89406f[_0xc150('0x34')][_0xc150('0x35')]?_0x89406f[_0xc150('0x34')]:_0x5c999d[_0xc150('0x31')];if(_0xfc9d19['query'][_0xc150('0x3d')]){_0x89406f[_0xc150('0x43')]=[{'all':!![]}];}_0x89406f=_['merge']({},_0x89406f,_0xfc9d19[_0xc150('0x44')]);return db[_0xc150('0x2c')][_0xc150('0x45')](_0x89406f)[_0xc150('0x23')](handleEntityNotFound(_0x4de175,null))[_0xc150('0x23')](respondWithResult(_0x4de175,null))['catch'](handleError(_0x4de175,null));};exports['create']=function(_0x6aa338,_0x2cc21f){return db[_0xc150('0x2c')][_0xc150('0x46')](_0x6aa338[_0xc150('0x47')],{})[_0xc150('0x23')](function(_0x158e9a){var _0x237481=_0x6aa338[_0xc150('0x48')]['get']({'plain':!![]});if(!_0x237481)throw new Error(_0xc150('0x49'));if(_0x237481[_0xc150('0x4a')]===_0xc150('0x48')){var _0x1c94c8=_0x158e9a[_0xc150('0x25')]({'plain':!![]});var _0x570914='Companies';return db[_0xc150('0x4b')][_0xc150('0x45')]({'where':{'name':_0x570914,'userProfileId':_0x237481[_0xc150('0x4c')]},'raw':!![]})[_0xc150('0x23')](function(_0x31aab6){if(_0x31aab6&&_0x31aab6[_0xc150('0x4d')]===0x0){return db[_0xc150('0x26')][_0xc150('0x46')]({'name':_0x1c94c8['name'],'resourceId':_0x1c94c8['id'],'type':_0x31aab6['name'],'sectionId':_0x31aab6['id']},{})[_0xc150('0x23')](function(){return _0x158e9a;});}else{return _0x158e9a;}})[_0xc150('0x40')](function(_0x5d0fc6){logger[_0xc150('0x27')](_0xc150('0x4e'),_0x5d0fc6);throw _0x5d0fc6;});}return _0x158e9a;})[_0xc150('0x23')](respondWithResult(_0x2cc21f,0xc9))['catch'](handleError(_0x2cc21f,null));};exports[_0xc150('0x22')]=function(_0x438bc2,_0x8d33c7){if(_0x438bc2[_0xc150('0x47')]['id']){delete _0x438bc2[_0xc150('0x47')]['id'];}return db['CmCompany'][_0xc150('0x45')]({'where':{'id':_0x438bc2[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x8d33c7,null))[_0xc150('0x23')](saveUpdates(_0x438bc2[_0xc150('0x47')],null))['then'](respondWithResult(_0x8d33c7,null))[_0xc150('0x40')](handleError(_0x8d33c7,null));};exports[_0xc150('0x24')]=function(_0x4c3a0a,_0xfae184){return db[_0xc150('0x2c')][_0xc150('0x45')]({'where':{'id':_0x4c3a0a['params']['id']}})[_0xc150('0x23')](handleEntityNotFound(_0xfae184,null))[_0xc150('0x23')](removeEntity(_0xfae184,null))[_0xc150('0x40')](handleError(_0xfae184,null));};exports[_0xc150('0x2d')]=function(_0x384cb2,_0xc4989e){return db[_0xc150('0x2c')][_0xc150('0x2d')]()[_0xc150('0x23')](respondWithResult(_0xc4989e,null))[_0xc150('0x40')](handleError(_0xc4989e,null));};exports[_0xc150('0x4f')]=function(_0x386a7b,_0x289df6,_0x1e2800){return db[_0xc150('0x50')][_0xc150('0x45')]({'where':{'id':_0x386a7b[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x289df6,null))['then'](function(_0x131839){if(_0x131839){return _0x131839[_0xc150('0x4f')](_0x386a7b[_0xc150('0x47')]['ids'],_[_0xc150('0x51')](_0x386a7b[_0xc150('0x47')],[_0xc150('0x52'),'id'])||{});}})[_0xc150('0x23')](respondWithResult(_0x289df6,null))[_0xc150('0x40')](handleError(_0x289df6,null));};exports[_0xc150('0x53')]=function(_0x26ea57,_0x24cc8d,_0x1a584a){var _0x3a9d41={};var _0x2c8c81={};var _0x503d87;var _0x32bc0b;return db[_0xc150('0x2c')][_0xc150('0x54')]({'where':{'id':_0x26ea57[_0xc150('0x42')]['id']}})[_0xc150('0x23')](handleEntityNotFound(_0x24cc8d,null))[_0xc150('0x23')](function(_0x34cb41){if(_0x34cb41){_0x503d87=_0x34cb41;_0x2c8c81[_0xc150('0x31')]=_[_0xc150('0x2e')](db[_0xc150('0x50')][_0xc150('0x55')]);_0x2c8c81[_0xc150('0x32')]=_[_0xc150('0x2e')](_0x26ea57[_0xc150('0x32')]);_0x2c8c81[_0xc150('0x2f')]=_[_0xc150('0x30')](_0x2c8c81[_0xc150('0x31')],_0x2c8c81['query']);_0x3a9d41[_0xc150('0x34')]=_[_0xc150('0x30')](_0x2c8c81['model'],qs[_0xc150('0x33')](_0x26ea57[_0xc150('0x32')][_0xc150('0x33')]));_0x3a9d41[_0xc150('0x34')]=_0x3a9d41[_0xc150('0x34')][_0xc150('0x35')]?_0x3a9d41[_0xc150('0x34')]:_0x2c8c81[_0xc150('0x31')];_0x3a9d41['order']=qs[_0xc150('0x38')](_0x26ea57['query'][_0xc150('0x38')]);_0x3a9d41[_0xc150('0x39')]=qs[_0xc150('0x2f')](_[_0xc150('0x3a')](_0x26ea57[_0xc150('0x32')],_0x2c8c81['filters']));if(_0x26ea57[_0xc150('0x32')][_0xc150('0x3c')]){_0x3a9d41[_0xc150('0x39')]=_[_0xc150('0x3b')](_0x3a9d41[_0xc150('0x39')],{'$or':_[_0xc150('0x56')](_0x3a9d41[_0xc150('0x34')],function(_0x389b61){var _0x588269={};_0x588269[_0x389b61]={'$like':'%'+_0x26ea57[_0xc150('0x32')][_0xc150('0x3c')]+'%'};return _0x588269;})});}_0x3a9d41=_[_0xc150('0x3b')]({},_0x3a9d41,_0x26ea57[_0xc150('0x44')]);return _0x503d87[_0xc150('0x53')](_0x3a9d41);}})['then'](function(_0x274c22){if(_0x274c22){_0x32bc0b=_0x274c22[_0xc150('0x35')];if(!_0x26ea57['query'][_0xc150('0x57')](_0xc150('0x58'))){_0x3a9d41['limit']=qs[_0xc150('0x36')](_0x26ea57['query'][_0xc150('0x36')]);_0x3a9d41[_0xc150('0x1b')]=qs[_0xc150('0x1b')](_0x26ea57[_0xc150('0x32')][_0xc150('0x1b')]);}return _0x503d87['getContacts'](_0x3a9d41);}})[_0xc150('0x23')](function(_0x5c756a){if(_0x5c756a){return _0x5c756a?{'count':_0x32bc0b,'rows':_0x5c756a}:null;}})[_0xc150('0x23')](respondWithResult(_0x24cc8d,null))[_0xc150('0x40')](handleError(_0x24cc8d,null));}; \ No newline at end of file +var _0x136e=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','CmContact','addContacts','ids','omit','findOne','getContacts','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','describe'];(function(_0x17729d,_0x15e6af){var _0xbbe924=function(_0x4bcd24){while(--_0x4bcd24){_0x17729d['push'](_0x17729d['shift']());}};_0xbbe924(++_0x15e6af);}(_0x136e,0x128));var _0xe136=function(_0x3149bc,_0x24b6b7){_0x3149bc=_0x3149bc-0x0;var _0x325cd1=_0x136e[_0x3149bc];return _0x325cd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe136('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe136('0x1'));var moment=require(_0xe136('0x2'));var BPromise=require(_0xe136('0x3'));var Mustache=require('mustache');var util=require(_0xe136('0x4'));var path=require(_0xe136('0x5'));var sox=require(_0xe136('0x6'));var csv=require(_0xe136('0x7'));var ejs=require(_0xe136('0x8'));var fs=require('fs');var fs_extra=require(_0xe136('0x9'));var _=require(_0xe136('0xa'));var squel=require('squel');var crypto=require(_0xe136('0xb'));var jsforce=require(_0xe136('0xc'));var deskjs=require(_0xe136('0xd'));var toCsv=require(_0xe136('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe136('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe136('0xf'));var as=require(_0xe136('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe136('0x11'))('api');var utils=require(_0xe136('0x12'));var config=require(_0xe136('0x13'));var licenseUtil=require(_0xe136('0x14'));var db=require(_0xe136('0x15'))['db'];function respondWithStatusCode(_0x1346ec,_0x462fcd){_0x462fcd=_0x462fcd||0xcc;return function(_0x469c79){if(_0x469c79){return _0x1346ec[_0xe136('0x16')](_0x462fcd);}return _0x1346ec[_0xe136('0x17')](_0x462fcd)['end']();};}function respondWithResult(_0x1821d7,_0x71ba17){_0x71ba17=_0x71ba17||0xc8;return function(_0x2ad1fa){if(_0x2ad1fa){return _0x1821d7[_0xe136('0x17')](_0x71ba17)[_0xe136('0x18')](_0x2ad1fa);}};}function respondWithFilteredResult(_0x2a26b9,_0xb1da66){return function(_0x5f10e9){if(_0x5f10e9){var _0x256d72=typeof _0xb1da66[_0xe136('0x19')]===_0xe136('0x1a')&&typeof _0xb1da66['limit']===_0xe136('0x1a');var _0x3c95a3=_0x5f10e9[_0xe136('0x1b')];var _0x305434=_0x256d72?0x0:_0xb1da66[_0xe136('0x19')];var _0x411c7a=_0x256d72?_0x5f10e9[_0xe136('0x1b')]:_0xb1da66['offset']+_0xb1da66['limit'];var _0x5e5ebd;if(_0x411c7a>=_0x3c95a3){_0x411c7a=_0x3c95a3;_0x5e5ebd=0xc8;}else{_0x5e5ebd=0xce;}_0x2a26b9[_0xe136('0x17')](_0x5e5ebd);return _0x2a26b9[_0xe136('0x1c')](_0xe136('0x1d'),_0x305434+'-'+_0x411c7a+'/'+_0x3c95a3)[_0xe136('0x18')](_0x5f10e9);}return null;};}function patchUpdates(_0x8cbf28){return function(_0x4dd595){try{jsonpatch['apply'](_0x4dd595,_0x8cbf28,!![]);}catch(_0x3480b1){return BPromise['reject'](_0x3480b1);}return _0x4dd595[_0xe136('0x1e')]();};}function saveUpdates(_0x230183,_0x530338){return function(_0x1500c1){if(_0x1500c1){return _0x1500c1[_0xe136('0x1f')](_0x230183)[_0xe136('0x20')](function(_0x41d372){return _0x41d372;});}return null;};}function removeEntity(_0x384f47,_0x5b44f3){return function(_0x36a62d){if(_0x36a62d){return _0x36a62d[_0xe136('0x21')]()[_0xe136('0x20')](function(){var _0x1f64e7=_0x36a62d[_0xe136('0x22')]({'plain':!![]});var _0x4d64ff=_0xe136('0x23');return db[_0xe136('0x24')]['destroy']({'where':{'type':_0x4d64ff,'resourceId':_0x1f64e7['id']}})[_0xe136('0x20')](function(){return _0x36a62d;});})[_0xe136('0x20')](function(){_0x384f47[_0xe136('0x17')](0xcc)[_0xe136('0x25')]();});}};}function handleEntityNotFound(_0x124161,_0xb81e2b){return function(_0x7e296f){if(!_0x7e296f){_0x124161[_0xe136('0x16')](0x194);}return _0x7e296f;};}function handleError(_0x1bfa3f,_0x1aa8ac){_0x1aa8ac=_0x1aa8ac||0x1f4;return function(_0x2e109c){logger[_0xe136('0x26')](_0x2e109c['stack']);if(_0x2e109c[_0xe136('0x27')]){delete _0x2e109c['name'];}_0x1bfa3f[_0xe136('0x17')](_0x1aa8ac)[_0xe136('0x28')](_0x2e109c);};}exports[_0xe136('0x29')]=function(_0x2193ea,_0x5ae54a){var _0x3d7e50={},_0x2ec526={},_0x2ea180={'count':0x0,'rows':[]};return db[_0xe136('0x2a')][_0xe136('0x2b')]()[_0xe136('0x20')](function(_0x4e56e6){_0x2ec526[_0xe136('0x2c')]=_[_0xe136('0x2d')](_0x4e56e6);_0x2ec526[_0xe136('0x2e')]=_['keys'](_0x2193ea[_0xe136('0x2e')]);_0x2ec526[_0xe136('0x2f')]=_[_0xe136('0x30')](_0x2ec526[_0xe136('0x2c')],_0x2ec526[_0xe136('0x2e')]);_0x3d7e50[_0xe136('0x31')]=_[_0xe136('0x30')](_0x2ec526[_0xe136('0x2c')],qs[_0xe136('0x32')](_0x2193ea[_0xe136('0x2e')][_0xe136('0x32')]));_0x3d7e50[_0xe136('0x31')]=_0x3d7e50['attributes'][_0xe136('0x33')]?_0x3d7e50[_0xe136('0x31')]:_0x2ec526[_0xe136('0x2c')];if(!_0x2193ea['query'][_0xe136('0x34')](_0xe136('0x35'))){_0x3d7e50[_0xe136('0x36')]=qs['limit'](_0x2193ea[_0xe136('0x2e')][_0xe136('0x36')]);_0x3d7e50[_0xe136('0x19')]=qs['offset'](_0x2193ea[_0xe136('0x2e')]['offset']);}_0x3d7e50[_0xe136('0x37')]=qs['sort'](_0x2193ea[_0xe136('0x2e')][_0xe136('0x38')]);_0x3d7e50[_0xe136('0x39')]=qs[_0xe136('0x2f')](_[_0xe136('0x3a')](_0x2193ea[_0xe136('0x2e')],_0x2ec526[_0xe136('0x2f')]),_0x4e56e6);if(_0x2193ea['query'][_0xe136('0x3b')]){_0x3d7e50[_0xe136('0x39')]=_['merge'](_0x3d7e50[_0xe136('0x39')],{'$or':_[_0xe136('0x3c')](_0x3d7e50[_0xe136('0x31')],function(_0xc80bee){var _0xd0adb7={};_0xd0adb7[_0xc80bee]={'$like':'%'+_0x2193ea[_0xe136('0x2e')][_0xe136('0x3b')]+'%'};return _0xd0adb7;})});}_0x3d7e50=_[_0xe136('0x3d')]({},_0x3d7e50,_0x2193ea[_0xe136('0x3e')]);var _0x2eb714={'where':_0x3d7e50['where']};return db['CmCompany']['count'](_0x2eb714)[_0xe136('0x20')](function(_0x1d6749){_0x2ea180[_0xe136('0x1b')]=_0x1d6749;if(_0x2193ea['query']['includeAll']){_0x3d7e50[_0xe136('0x3f')]=[{'all':!![]}];}return db[_0xe136('0x2a')][_0xe136('0x40')](_0x3d7e50);})[_0xe136('0x20')](function(_0x2f7d5a){_0x2ea180[_0xe136('0x41')]=_0x2f7d5a;return _0x2ea180;})[_0xe136('0x20')](respondWithFilteredResult(_0x5ae54a,_0x3d7e50))[_0xe136('0x42')](handleError(_0x5ae54a,null));})[_0xe136('0x42')](handleError(_0x5ae54a,null));};exports[_0xe136('0x43')]=function(_0xd374d1,_0x83a239){var _0x38e038={'raw':![],'where':{'id':_0xd374d1[_0xe136('0x44')]['id']}},_0x5d861f={};_0x5d861f['model']=_['keys'](db['CmCompany'][_0xe136('0x45')]);_0x5d861f[_0xe136('0x2e')]=_[_0xe136('0x2d')](_0xd374d1['query']);_0x5d861f[_0xe136('0x2f')]=_[_0xe136('0x30')](_0x5d861f['model'],_0x5d861f[_0xe136('0x2e')]);_0x38e038[_0xe136('0x31')]=_[_0xe136('0x30')](_0x5d861f[_0xe136('0x2c')],qs[_0xe136('0x32')](_0xd374d1['query'][_0xe136('0x32')]));_0x38e038[_0xe136('0x31')]=_0x38e038[_0xe136('0x31')][_0xe136('0x33')]?_0x38e038[_0xe136('0x31')]:_0x5d861f[_0xe136('0x2c')];if(_0xd374d1['query'][_0xe136('0x46')]){_0x38e038[_0xe136('0x3f')]=[{'all':!![]}];}_0x38e038=_[_0xe136('0x3d')]({},_0x38e038,_0xd374d1[_0xe136('0x3e')]);return db[_0xe136('0x2a')][_0xe136('0x47')](_0x38e038)[_0xe136('0x20')](handleEntityNotFound(_0x83a239,null))['then'](respondWithResult(_0x83a239,null))[_0xe136('0x42')](handleError(_0x83a239,null));};exports[_0xe136('0x48')]=function(_0x539b1c,_0x1f3c22){return db[_0xe136('0x2a')][_0xe136('0x48')](_0x539b1c[_0xe136('0x49')],{})[_0xe136('0x20')](function(_0x27682e){var _0x5668a0=_0x539b1c[_0xe136('0x4a')][_0xe136('0x22')]({'plain':!![]});if(!_0x5668a0)throw new Error(_0xe136('0x4b'));if(_0x5668a0['role']===_0xe136('0x4a')){var _0x27ae08=_0x27682e[_0xe136('0x22')]({'plain':!![]});var _0x58a6fe=_0xe136('0x23');return db[_0xe136('0x4c')][_0xe136('0x47')]({'where':{'name':_0x58a6fe,'userProfileId':_0x5668a0[_0xe136('0x4d')]},'raw':!![]})['then'](function(_0x5cf6aa){if(_0x5cf6aa&&_0x5cf6aa[_0xe136('0x4e')]===0x0){return db[_0xe136('0x24')]['create']({'name':_0x27ae08[_0xe136('0x27')],'resourceId':_0x27ae08['id'],'type':_0x5cf6aa['name'],'sectionId':_0x5cf6aa['id']},{})[_0xe136('0x20')](function(){return _0x27682e;});}else{return _0x27682e;}})[_0xe136('0x42')](function(_0x559abe){logger[_0xe136('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x559abe);throw _0x559abe;});}return _0x27682e;})['then'](respondWithResult(_0x1f3c22,0xc9))['catch'](handleError(_0x1f3c22,null));};exports[_0xe136('0x1f')]=function(_0x50dff8,_0xb251cf){if(_0x50dff8[_0xe136('0x49')]['id']){delete _0x50dff8[_0xe136('0x49')]['id'];}return db[_0xe136('0x2a')][_0xe136('0x47')]({'where':{'id':_0x50dff8['params']['id']}})[_0xe136('0x20')](handleEntityNotFound(_0xb251cf,null))['then'](saveUpdates(_0x50dff8[_0xe136('0x49')],null))[_0xe136('0x20')](respondWithResult(_0xb251cf,null))[_0xe136('0x42')](handleError(_0xb251cf,null));};exports[_0xe136('0x21')]=function(_0xe2ad19,_0x5705d6){return db[_0xe136('0x2a')][_0xe136('0x47')]({'where':{'id':_0xe2ad19[_0xe136('0x44')]['id']}})[_0xe136('0x20')](handleEntityNotFound(_0x5705d6,null))[_0xe136('0x20')](removeEntity(_0x5705d6,null))[_0xe136('0x42')](handleError(_0x5705d6,null));};exports[_0xe136('0x2b')]=function(_0x1b0b6d,_0x10f5a9){return db[_0xe136('0x2a')][_0xe136('0x2b')]()[_0xe136('0x20')](respondWithResult(_0x10f5a9,null))['catch'](handleError(_0x10f5a9,null));};exports['addContacts']=function(_0x34d5b0,_0x4f898b,_0x3491a4){return db[_0xe136('0x4f')][_0xe136('0x47')]({'where':{'id':_0x34d5b0[_0xe136('0x44')]['id']}})[_0xe136('0x20')](handleEntityNotFound(_0x4f898b,null))[_0xe136('0x20')](function(_0x49cd47){if(_0x49cd47){return _0x49cd47[_0xe136('0x50')](_0x34d5b0[_0xe136('0x49')][_0xe136('0x51')],_[_0xe136('0x52')](_0x34d5b0[_0xe136('0x49')],[_0xe136('0x51'),'id'])||{});}})[_0xe136('0x20')](respondWithResult(_0x4f898b,null))[_0xe136('0x42')](handleError(_0x4f898b,null));};exports['getContacts']=function(_0x401ff0,_0x17c57e,_0x382d8c){var _0x594501={};var _0x595518={};var _0x219901;var _0x12af0e;return db['CmCompany'][_0xe136('0x53')]({'where':{'id':_0x401ff0[_0xe136('0x44')]['id']}})[_0xe136('0x20')](handleEntityNotFound(_0x17c57e,null))[_0xe136('0x20')](function(_0x59e0c6){if(_0x59e0c6){_0x219901=_0x59e0c6;_0x595518[_0xe136('0x2c')]=_[_0xe136('0x2d')](db[_0xe136('0x4f')][_0xe136('0x45')]);_0x595518[_0xe136('0x2e')]=_[_0xe136('0x2d')](_0x401ff0['query']);_0x595518['filters']=_['intersection'](_0x595518[_0xe136('0x2c')],_0x595518[_0xe136('0x2e')]);_0x594501[_0xe136('0x31')]=_[_0xe136('0x30')](_0x595518[_0xe136('0x2c')],qs[_0xe136('0x32')](_0x401ff0[_0xe136('0x2e')]['fields']));_0x594501['attributes']=_0x594501['attributes']['length']?_0x594501['attributes']:_0x595518[_0xe136('0x2c')];_0x594501[_0xe136('0x37')]=qs[_0xe136('0x38')](_0x401ff0[_0xe136('0x2e')][_0xe136('0x38')]);_0x594501[_0xe136('0x39')]=qs[_0xe136('0x2f')](_['pick'](_0x401ff0[_0xe136('0x2e')],_0x595518[_0xe136('0x2f')]));if(_0x401ff0[_0xe136('0x2e')][_0xe136('0x3b')]){_0x594501['where']=_[_0xe136('0x3d')](_0x594501[_0xe136('0x39')],{'$or':_['map'](_0x594501[_0xe136('0x31')],function(_0x16bb09){var _0x55b072={};_0x55b072[_0x16bb09]={'$like':'%'+_0x401ff0[_0xe136('0x2e')]['filter']+'%'};return _0x55b072;})});}_0x594501=_['merge']({},_0x594501,_0x401ff0[_0xe136('0x3e')]);return _0x219901[_0xe136('0x54')](_0x594501);}})[_0xe136('0x20')](function(_0x5e9ba0){if(_0x5e9ba0){_0x12af0e=_0x5e9ba0[_0xe136('0x33')];if(!_0x401ff0['query']['hasOwnProperty'](_0xe136('0x35'))){_0x594501[_0xe136('0x36')]=qs[_0xe136('0x36')](_0x401ff0[_0xe136('0x2e')][_0xe136('0x36')]);_0x594501['offset']=qs[_0xe136('0x19')](_0x401ff0['query']['offset']);}return _0x219901[_0xe136('0x54')](_0x594501);}})[_0xe136('0x20')](function(_0x4d6cb8){if(_0x4d6cb8){return _0x4d6cb8?{'count':_0x12af0e,'rows':_0x4d6cb8}:null;}})['then'](respondWithResult(_0x17c57e,null))['catch'](handleError(_0x17c57e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4172182..5919ecc 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 _0x257d=['exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x47878f,_0x48d3bf){var _0x4b05b8=function(_0x3d6597){while(--_0x3d6597){_0x47878f['push'](_0x47878f['shift']());}};_0x4b05b8(++_0x48d3bf);}(_0x257d,0x1b3));var _0xd257=function(_0x498e3f,_0x15bb7d){_0x498e3f=_0x498e3f-0x0;var _0x537c0f=_0x257d[_0x498e3f];return _0x537c0f;};'use strict';var _=require(_0xd257('0x0'));var util=require(_0xd257('0x1'));var logger=require(_0xd257('0x2'))(_0xd257('0x3'));var moment=require(_0xd257('0x4'));var BPromise=require('bluebird');var rp=require(_0xd257('0x5'));var fs=require('fs');var path=require(_0xd257('0x6'));var rimraf=require(_0xd257('0x7'));var config=require('../../config/environment');var attributes=require(_0xd257('0x8'));module[_0xd257('0x9')]=function(_0x420e20,_0x4711fc){return _0x420e20[_0xd257('0xa')]('CmCompany',attributes,{'tableName':_0xd257('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x109d=['api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','lodash'];(function(_0x36f797,_0x351603){var _0x44ba30=function(_0x32eb10){while(--_0x32eb10){_0x36f797['push'](_0x36f797['shift']());}};_0x44ba30(++_0x351603);}(_0x109d,0x194));var _0xd109=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x109d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd109('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd109('0x1'));var moment=require('moment');var BPromise=require(_0xd109('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd109('0x3'));var rimraf=require(_0xd109('0x4'));var config=require(_0xd109('0x5'));var attributes=require(_0xd109('0x6'));module['exports']=function(_0x32b38f,_0x576fc8){return _0x32b38f['define'](_0xd109('0x7'),attributes,{'tableName':_0xd109('0x8'),'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 6a86591..50199d7 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 _0x21c7=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2d0472,_0x2b3088){var _0x46a846=function(_0x209b5b){while(--_0x209b5b){_0x2d0472['push'](_0x2d0472['shift']());}};_0x46a846(++_0x2b3088);}(_0x21c7,0x1a8));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x721c('0x0'));var util=require(_0x721c('0x1'));var moment=require(_0x721c('0x2'));var BPromise=require(_0x721c('0x3'));var rs=require(_0x721c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x721c('0x5'));var logger=require(_0x721c('0x6'))(_0x721c('0x7'));var config=require(_0x721c('0x8'));var jayson=require(_0x721c('0x9'));var client=jayson[_0x721c('0xa')][_0x721c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53a7a6,_0x169b50,_0x33f7a2){return new BPromise(function(_0x5df156,_0x4996bd){return client[_0x721c('0xc')](_0x53a7a6,_0x33f7a2)[_0x721c('0xd')](function(_0x275b0e){logger['info']('CmCompany,\x20%s,\x20%s',_0x169b50,_0x721c('0xe'));logger[_0x721c('0xf')](_0x721c('0x10'),_0x169b50,_0x721c('0xe'),JSON[_0x721c('0x11')](_0x275b0e));if(_0x275b0e[_0x721c('0x12')]){if(_0x275b0e[_0x721c('0x12')][_0x721c('0x13')]===0x1f4){logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x275b0e[_0x721c('0x12')][_0x721c('0x15')]);return _0x4996bd(_0x275b0e['error'][_0x721c('0x15')]);}logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x275b0e[_0x721c('0x12')][_0x721c('0x15')]);return _0x5df156(_0x275b0e[_0x721c('0x12')]['message']);}else{logger[_0x721c('0x16')]('CmCompany,\x20%s,\x20%s',_0x169b50,_0x721c('0xe'));_0x5df156(_0x275b0e[_0x721c('0x17')][_0x721c('0x15')]);}})['catch'](function(_0x2f6c42){logger[_0x721c('0x12')](_0x721c('0x14'),_0x169b50,_0x2f6c42);_0x4996bd(_0x2f6c42);});});} \ No newline at end of file +var _0x7873=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x5bbcb5,_0x3bf21a){var _0x4a676e=function(_0x591373){while(--_0x591373){_0x5bbcb5['push'](_0x5bbcb5['shift']());}};_0x4a676e(++_0x3bf21a);}(_0x7873,0x1e0));var _0x3787=function(_0x354e87,_0x462aee){_0x354e87=_0x354e87-0x0;var _0x426a22=_0x7873[_0x354e87];return _0x426a22;};'use strict';var _=require(_0x3787('0x0'));var util=require(_0x3787('0x1'));var moment=require(_0x3787('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3787('0x3'))['db'];var utils=require(_0x3787('0x4'));var logger=require(_0x3787('0x5'))('rpc');var config=require(_0x3787('0x6'));var jayson=require(_0x3787('0x7'));var client=jayson[_0x3787('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e35bb,_0x22f4bb,_0x473596){return new BPromise(function(_0x475bc4,_0x55e8d0){return client[_0x3787('0x9')](_0x5e35bb,_0x473596)[_0x3787('0xa')](function(_0x219c6e){logger[_0x3787('0xb')]('CmCompany,\x20%s,\x20%s',_0x22f4bb,'request\x20sent');logger[_0x3787('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x22f4bb,_0x3787('0xd'),JSON[_0x3787('0xe')](_0x219c6e));if(_0x219c6e[_0x3787('0xf')]){if(_0x219c6e[_0x3787('0xf')][_0x3787('0x10')]===0x1f4){logger[_0x3787('0xf')](_0x3787('0x11'),_0x22f4bb,_0x219c6e[_0x3787('0xf')][_0x3787('0x12')]);return _0x55e8d0(_0x219c6e[_0x3787('0xf')][_0x3787('0x12')]);}logger['error'](_0x3787('0x11'),_0x22f4bb,_0x219c6e['error'][_0x3787('0x12')]);return _0x475bc4(_0x219c6e[_0x3787('0xf')][_0x3787('0x12')]);}else{logger['info'](_0x3787('0x11'),_0x22f4bb,'request\x20sent');_0x475bc4(_0x219c6e[_0x3787('0x13')][_0x3787('0x12')]);}})[_0x3787('0x14')](function(_0x594d05){logger[_0x3787('0xf')](_0x3787('0x11'),_0x22f4bb,_0x594d05);_0x55e8d0(_0x594d05);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ff0bdb2..23a793c 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 _0x26a2=['../../config/environment','./cmCompany.controller','isAuthenticated','/describe','describe','get','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x26a2,0x125));var _0x226a=function(_0x3b004f,_0x16392b){_0x3b004f=_0x3b004f-0x0;var _0x167b2f=_0x26a2[_0x3b004f];return _0x167b2f;};'use strict';var multer=require(_0x226a('0x0'));var util=require('util');var path=require(_0x226a('0x1'));var timeout=require(_0x226a('0x2'));var express=require('express');var router=express[_0x226a('0x3')]();var fs_extra=require(_0x226a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x226a('0x5'));var config=require(_0x226a('0x6'));var controller=require(_0x226a('0x7'));router['get']('/',auth[_0x226a('0x8')](),controller['index']);router['get'](_0x226a('0x9'),auth[_0x226a('0x8')](),controller[_0x226a('0xa')]);router[_0x226a('0xb')](_0x226a('0xc'),auth[_0x226a('0x8')](),controller['show']);router[_0x226a('0xb')](_0x226a('0xd'),auth[_0x226a('0x8')](),controller[_0x226a('0xe')]);router[_0x226a('0xf')]('/',auth[_0x226a('0x8')](),controller[_0x226a('0x10')]);router[_0x226a('0xf')](_0x226a('0xd'),auth[_0x226a('0x8')](),controller[_0x226a('0x11')]);router[_0x226a('0x12')](_0x226a('0xc'),auth['isAuthenticated'](),controller[_0x226a('0x13')]);router[_0x226a('0x14')](_0x226a('0xc'),auth['isAuthenticated'](),controller[_0x226a('0x15')]);module[_0x226a('0x16')]=router; \ No newline at end of file +var _0xb66c=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','show','getContacts','post','create','/:id/contacts','addContacts','/:id','update','delete'];(function(_0x2d8c50,_0x55e568){var _0x45d22e=function(_0x2a779e){while(--_0x2a779e){_0x2d8c50['push'](_0x2d8c50['shift']());}};_0x45d22e(++_0x55e568);}(_0xb66c,0x154));var _0xcb66=function(_0x53cf3d,_0x350d64){_0x53cf3d=_0x53cf3d-0x0;var _0x353872=_0xb66c[_0x53cf3d];return _0x353872;};'use strict';var multer=require(_0xcb66('0x0'));var util=require(_0xcb66('0x1'));var path=require(_0xcb66('0x2'));var timeout=require(_0xcb66('0x3'));var express=require(_0xcb66('0x4'));var router=express[_0xcb66('0x5')]();var fs_extra=require(_0xcb66('0x6'));var auth=require(_0xcb66('0x7'));var interaction=require(_0xcb66('0x8'));var config=require(_0xcb66('0x9'));var controller=require(_0xcb66('0xa'));router[_0xcb66('0xb')]('/',auth[_0xcb66('0xc')](),controller[_0xcb66('0xd')]);router[_0xcb66('0xb')](_0xcb66('0xe'),auth[_0xcb66('0xc')](),controller['describe']);router[_0xcb66('0xb')]('/:id',auth[_0xcb66('0xc')](),controller[_0xcb66('0xf')]);router[_0xcb66('0xb')]('/:id/contacts',auth[_0xcb66('0xc')](),controller[_0xcb66('0x10')]);router[_0xcb66('0x11')]('/',auth[_0xcb66('0xc')](),controller[_0xcb66('0x12')]);router[_0xcb66('0x11')](_0xcb66('0x13'),auth[_0xcb66('0xc')](),controller[_0xcb66('0x14')]);router['put'](_0xcb66('0x15'),auth[_0xcb66('0xc')](),controller[_0xcb66('0x16')]);router[_0xcb66('0x17')](_0xcb66('0x15'),auth[_0xcb66('0xc')](),controller[_0xcb66('0x18')]);module[_0xcb66('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0c4b2e0..1c5f067 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 _0x49c8=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x49c8,0x7f));var _0x849c=function(_0x1f7fd5,_0x16dbb3){_0x1f7fd5=_0x1f7fd5-0x0;var _0x429402=_0x49c8[_0x1f7fd5];return _0x429402;};'use strict';var _=require(_0x849c('0x0'));var Sequelize=require(_0x849c('0x1'));module[_0x849c('0x2')]={'firstName':{'type':Sequelize[_0x849c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x849c('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x849c('0x3')]},'city':{'type':Sequelize[_0x849c('0x3')]},'country':{'type':Sequelize[_0x849c('0x3')]},'dateOfBirth':{'type':Sequelize[_0x849c('0x3')]},'description':{'type':Sequelize[_0x849c('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x849c('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x849c('0x3')]},'url':{'type':Sequelize[_0x849c('0x3')]},'facebook':{'type':Sequelize[_0x849c('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x849c('0x3')]},'skype':{'type':Sequelize[_0x849c('0x3')]},'teams':{'type':Sequelize[_0x849c('0x3')]},'viber':{'type':Sequelize[_0x849c('0x3')]},'line':{'type':Sequelize[_0x849c('0x3')]},'wechat':{'type':Sequelize[_0x849c('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x849c('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x849c('0x3')]},'priority':{'type':Sequelize[_0x849c('0x5')](0x2)[_0x849c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x849c('0x7')],'defaultValue':Sequelize[_0x849c('0x8')]},'dialTimezone':{'type':Sequelize[_0x849c('0x3')]},'utcOffset':{'type':Sequelize[_0x849c('0x5')]}}; \ No newline at end of file +var _0x6eee=['UNSIGNED','lodash','exports','STRING','TEXT','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6eee,0x1db));var _0xe6ee=function(_0xd35f04,_0x5d47a7){_0xd35f04=_0xd35f04-0x0;var _0x2ca54d=_0x6eee[_0xd35f04];return _0x2ca54d;};'use strict';var _=require(_0xe6ee('0x0'));var Sequelize=require('sequelize');module[_0xe6ee('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe6ee('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xe6ee('0x2')]},'city':{'type':Sequelize[_0xe6ee('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe6ee('0x2')]},'description':{'type':Sequelize[_0xe6ee('0x3')]},'phone':{'type':Sequelize[_0xe6ee('0x2')]},'mobile':{'type':Sequelize[_0xe6ee('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe6ee('0x2')]},'url':{'type':Sequelize[_0xe6ee('0x2')]},'facebook':{'type':Sequelize[_0xe6ee('0x2')]},'fb_data':{'type':Sequelize[_0xe6ee('0x2')]},'twitter':{'type':Sequelize[_0xe6ee('0x2')]},'skype':{'type':Sequelize[_0xe6ee('0x2')]},'teams':{'type':Sequelize[_0xe6ee('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe6ee('0x2')]},'wechat':{'type':Sequelize[_0xe6ee('0x2')]},'telegram':{'type':Sequelize[_0xe6ee('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe6ee('0x4')](0x2)[_0xe6ee('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xe6ee('0x2')]},'utcOffset':{'type':Sequelize[_0xe6ee('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 887f4cb..6353d1d 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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 65cfe22..e2b1832 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 _0x67cf=['save','update','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x387843,_0x4fd57c){var _0x345fd1=function(_0x47bbbc){while(--_0x47bbbc){_0x387843['push'](_0x387843['shift']());}};_0x345fd1(++_0x4fd57c);}(_0x67cf,0x1ed));var _0xf67c=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x67cf[_0xac56ce];return _0x5105e1;};'use strict';var EventEmitter=require(_0xf67c('0x0'));var CmContact=require(_0xf67c('0x1'))['db'][_0xf67c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf67c('0x3')](0x0);var events={'afterCreate':_0xf67c('0x4'),'afterUpdate':_0xf67c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x364bb3){return function(_0x2a485b,_0x1a97a7,_0x14a95a){CmContactEvents['emit'](_0x364bb3+':'+_0x2a485b['id'],_0x2a485b);CmContactEvents['emit'](_0x364bb3,_0x2a485b);_0x14a95a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf67c('0x6')]=CmContactEvents; \ No newline at end of file +var _0xf56f=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','save','update'];(function(_0x235987,_0x3b9255){var _0x16b95a=function(_0x45c432){while(--_0x45c432){_0x235987['push'](_0x235987['shift']());}};_0x16b95a(++_0x3b9255);}(_0xf56f,0x13c));var _0xff56=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xf56f[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xff56('0x0'))['db'][_0xff56('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff56('0x2'),'afterUpdate':_0xff56('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d9a61){return function(_0x3895ac,_0x390ea9,_0x3b6525){CmContactEvents[_0xff56('0x4')](_0x3d9a61+':'+_0x3895ac['id'],_0x3895ac);CmContactEvents[_0xff56('0x4')](_0x3d9a61,_0x3895ac);_0x3b6525(null);};}for(var e in events){if(events[_0xff56('0x5')](e)){var event=events[e];CmContact[_0xff56('0x6')](e,emitEvent(event));}}module[_0xff56('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index f924ac8..5d8685a 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 _0x0d9c=['FULLTEXT','utf8mb4_unicode_ci','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','findOne','isNil','dialTimezone','timezones','utcOffset','add','minutes','ret','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','CmHopper','create','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','get','CmHopperBlack','cmContact,\x20%s,\x20%s','message','findAll','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email'];(function(_0x239055,_0xb8da40){var _0x432cc2=function(_0x4cddf1){while(--_0x4cddf1){_0x239055['push'](_0x239055['shift']());}};_0x432cc2(++_0xb8da40);}(_0x0d9c,0x81));var _0xc0d9=function(_0x1d997f,_0x259b5a){_0x1d997f=_0x1d997f-0x0;var _0x307704=_0x0d9c[_0x1d997f];return _0x307704;};'use strict';var _=require(_0xc0d9('0x0'));var util=require(_0xc0d9('0x1'));var logger=require(_0xc0d9('0x2'))('api');var moment=require(_0xc0d9('0x3'));var BPromise=require(_0xc0d9('0x4'));var rp=require(_0xc0d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d9('0x6'));var config=require(_0xc0d9('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0xc0d9('0x8'));module[_0xc0d9('0x9')]=function(_0x3f0cc0,_0x2a792b){return _0x3f0cc0[_0xc0d9('0xa')](_0xc0d9('0xb'),attributes,{'tableName':_0xc0d9('0xc'),'paranoid':!![],'indexes':[{'name':_0xc0d9('0xd'),'fields':[_0xc0d9('0xd')]},{'name':_0xc0d9('0xe'),'fields':[_0xc0d9('0xf'),_0xc0d9('0x10'),'phone','mobile',_0xc0d9('0x11'),_0xc0d9('0x12')],'type':_0xc0d9('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xc0d9('0x14'),'hooks':{'afterCreate':function(_0x335128,_0x37d5f6,_0x1c3ef6){var _0x20ba51=_0x3f0cc0['models'];var _0x2a9f36=_0x335128['get']({'plain':!![]});function _0x4c7ee0(){return function(_0x719e7){logger[_0xc0d9('0x15')](_0xc0d9('0x16'),_0xc0d9('0x17'),util['inspect'](_0x719e7,{'showHidden':![],'depth':null}));};}function _0x3820fa(_0x31f851,_0x567081){var _0x42137a=_0x567081[_0xc0d9('0x18')]?_0x567081['scheduledat']:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a'));return new BPromise(function(_0x1af6fa,_0x3a8c1e){if(_['isNil'](_0x567081['dialTimezone'])){_0x1af6fa({'ret':_0x42137a});}else{_0x20ba51[_0xc0d9('0x1b')][_0xc0d9('0x1c')]({'where':{'id':_0x31f851['id']}})['then'](function(_0x258126){if(!_[_0xc0d9('0x1d')](_0x258126)){var _0x17828a=_0x258126[_0xc0d9('0x1e')];if(!_['isNil'](_0x17828a)){var _0x590033=shared[_0xc0d9('0x1f')];var _0x19a9b6=_0x590033[_0x17828a];var _0x3509e7=_0x590033[_0x567081[_0xc0d9('0x1e')]];if(!_[_0xc0d9('0x1d')](_0x19a9b6)&&!_['isNil'](_0x3509e7)){var _0x135b8d=_0x19a9b6[_0xc0d9('0x20')]-_0x3509e7[_0xc0d9('0x20')];_0x42137a=_0x567081['scheduledat']?_0x567081[_0xc0d9('0x18')]:moment();var _0xe2ef5c=moment(_0x42137a)[_0xc0d9('0x21')](_0x135b8d,_0xc0d9('0x22'));_0x1af6fa({'ret':_0xe2ef5c[_0xc0d9('0x19')](_0xc0d9('0x1a'))});}else _0x1af6fa({'ret':_0x42137a});}else _0x1af6fa({'ret':_0x42137a});}else{_0x1af6fa({'ret':_0x42137a});}});}});return 0xa;}var _0x1b40e2=function(_0x28b2ad){return new BPromise(function(_0xc60604,_0x5267e2){_0x3820fa(_0x28b2ad,_0x2a9f36)['then'](function(_0x3b47b9){_0x2a9f36[_0xc0d9('0x18')]=_0x3b47b9[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x28b2ad['id']}})[_0xc0d9('0x24')](function(_0x49b068){if(!_[_0xc0d9('0x1d')](_0x49b068)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2a9f36['phone']+_0xc0d9('0x25')+_0x28b2ad['id']);}return _0x20ba51['CmHopper']['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36['callbackUniqueid']?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()['format'](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x28b2ad['id']});})[_0xc0d9('0x29')](function(_0x1a99d5){_0x5267e2(_0x1a99d5);});});});};var _0x291f7=function(_0x496db9){return new BPromise(function(_0x55aa21,_0x15ca45){_0x3820fa(_0x496db9,_0x2a9f36)[_0xc0d9('0x24')](function(_0x5b4857){_0x2a9f36[_0xc0d9('0x18')]=_0x5b4857[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x496db9['id']}})[_0xc0d9('0x24')](function(_0x422404){if(!_['isNil'](_0x422404)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x2b')+_0x496db9['id']);}return _0x20ba51[_0xc0d9('0x2c')][_0xc0d9('0x1c')]({'where':{'calleridnum':_0x2a9f36[_0xc0d9('0xd')],'VoiceQueueId':_0x496db9['id']}});})['then'](function(_0x4ed4b5){if(!_['isNil'](_0x4ed4b5)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2a9f36['phone']+_0xc0d9('0x2d')+_0x496db9['id']);}return _0x20ba51[_0xc0d9('0x2e')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36['callbackUniqueid']:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x496db9['id']});})[_0xc0d9('0x29')](function(_0x27b20c){_0x15ca45(_0x27b20c);});});});};function _0x5f4fce(){return function(_0x46fc5e){logger[_0xc0d9('0x15')](_0xc0d9('0x16'),'afterCreate',util[_0xc0d9('0x30')](_0x46fc5e,{'showHidden':![],'depth':null}));};}function _0x2c9518(_0x536b27,_0x33a591){var _0x4c226c=_0x33a591[_0xc0d9('0x18')]?_0x33a591[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a'));return new BPromise(function(_0x3207ad,_0x404a7a){if(_[_0xc0d9('0x1d')](_0x33a591[_0xc0d9('0x1e')])){_0x3207ad({'ret':_0x4c226c});}else{_0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x1c')]({'where':{'id':_0x536b27['id']}})['then'](function(_0x1a545b){if(!_[_0xc0d9('0x1d')](_0x1a545b)){var _0x17749d=_0x1a545b[_0xc0d9('0x1e')];if(!_['isNil'](_0x17749d)){var _0x478e97=shared[_0xc0d9('0x1f')];var _0x2ede0f=_0x478e97[_0x17749d];var _0x2b3886=_0x478e97[_0x33a591[_0xc0d9('0x1e')]];if(!_['isNil'](_0x2ede0f)&&!_[_0xc0d9('0x1d')](_0x2b3886)){var _0x2c93b7=_0x2ede0f[_0xc0d9('0x20')]-_0x2b3886[_0xc0d9('0x20')];_0x4c226c=_0x33a591[_0xc0d9('0x18')]?_0x33a591[_0xc0d9('0x18')]:moment();var _0x327692=moment(_0x4c226c)[_0xc0d9('0x21')](_0x2c93b7,'minutes');_0x3207ad({'ret':_0x327692['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3207ad({'ret':_0x4c226c});}else _0x3207ad({'ret':_0x4c226c});}else{_0x3207ad({'ret':_0x4c226c});}});}});return 0xa;}var _0xbaf511=function(_0x16751d){return new BPromise(function(_0x336d89,_0x4a0a6e){_0x2c9518(_0x16751d,_0x2a9f36)['then'](function(_0x2389de){_0x2a9f36[_0xc0d9('0x18')]=_0x2389de[_0xc0d9('0x23')];_0x20ba51[_0xc0d9('0x2e')]['findOne']({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x16751d['id']}})[_0xc0d9('0x24')](function(_0x593c65){if(!_['isNil'](_0x593c65)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x32')+_0x16751d['id']);}return _0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36['ListId'],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x16751d['id']});})['catch'](function(_0x2c03dd){_0x4a0a6e(_0x2c03dd);});});});};var _0x2a149a=function(_0x40834a){return new BPromise(function(_0x37557f,_0x48b914){_0x2c9518(_0x40834a,_0x2a9f36)[_0xc0d9('0x24')](function(_0x7b217c){_0x2a9f36[_0xc0d9('0x18')]=_0x7b217c[_0xc0d9('0x23')];_0x20ba51['CmHopper'][_0xc0d9('0x1c')]({'where':{'phone':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x40834a['id']}})[_0xc0d9('0x24')](function(_0x23249){if(!_['isNil'](_0x23249)){throw new Error(_0xc0d9('0x2a')+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x33')+_0x40834a['id']);}return _0x20ba51['CmHopperFinal'][_0xc0d9('0x1c')]({'where':{'calleridnum':_0x2a9f36[_0xc0d9('0xd')],'CampaignId':_0x40834a['id']}});})[_0xc0d9('0x24')](function(_0x5b1207){if(!_[_0xc0d9('0x1d')](_0x5b1207)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2a9f36[_0xc0d9('0xd')]+_0xc0d9('0x34')+_0x40834a['id']);}return _0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36['phone'],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()['format'](_0xc0d9('0x1a')),'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36['callbackUniqueid']?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x40834a['id']});})[_0xc0d9('0x29')](function(_0x1d4aa9){_0x48b914(_0x1d4aa9);});});});};if(_0x2a9f36['ListId']){_0x20ba51[_0xc0d9('0x1b')]['findAll']({'where':{'type':_0xc0d9('0x35')},'attributes':['id',_0xc0d9('0x36'),_0xc0d9('0x1e')],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x38'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})['then'](function(_0x40d321){if(_0x40d321){var _0x4922f6=[];for(var _0x4a2ca9=0x0,_0x1093d0;_0x4a2ca9<_0x40d321[_0xc0d9('0x39')];_0x4a2ca9+=0x1){_0x1093d0=_0x40d321[_0x4a2ca9]['get']({'plain':!![]});switch(_0x1093d0[_0xc0d9('0x36')]){case _0xc0d9('0x3a'):_0x291f7(_0x1093d0)[_0xc0d9('0x29')](_0x4c7ee0());break;case'onlyIfOpen':_0x1b40e2(_0x1093d0)[_0xc0d9('0x29')](_0x4c7ee0());break;default:_0x2c9518(_0x1093d0,_0x2a9f36)[_0xc0d9('0x24')](function(_0x24da6b){_0x2a9f36[_0xc0d9('0x18')]=_0x24da6b['ret'];_0x20ba51[_0xc0d9('0x2e')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()['format'](_0xc0d9('0x1a')),'priority':_0x2a9f36['priority']?_0x2a9f36[_0xc0d9('0x27')]:0x2,'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36[_0xc0d9('0x28')]?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36['callbackUniqueid']?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'VoiceQueueId':_0x1093d0['id']})[_0xc0d9('0x29')](_0x4c7ee0());});}}}})[_0xc0d9('0x24')](function(){return _0x20ba51[_0xc0d9('0x1b')]['findAll']({'where':{'type':_0xc0d9('0x35')},'attributes':['id'],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x3b'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})[_0xc0d9('0x24')](function(_0x3ba58e){if(_0x3ba58e){var _0x47c784=[];for(var _0x2d195f=0x0,_0x322a67;_0x2d195f<_0x3ba58e[_0xc0d9('0x39')];_0x2d195f+=0x1){_0x322a67=_0x3ba58e[_0x2d195f][_0xc0d9('0x3c')]({'plain':!![]});_0x20ba51[_0xc0d9('0x3d')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'VoiceQueueId':_0x322a67['id']})[_0xc0d9('0x29')](function(_0x1fca56){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x1fca56[_0xc0d9('0x3f')]);});}}});})[_0xc0d9('0x24')](function(){return _0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x40')]({'attributes':['id',_0xc0d9('0x36'),'dialTimezone'],'include':[{'model':_0x20ba51['CmList'],'as':_0xc0d9('0x38'),'where':{'id':_0x2a9f36[_0xc0d9('0x26')]}}]})[_0xc0d9('0x24')](function(_0x34ae11){if(_0x34ae11){var _0x269212=[];for(var _0x46085b=0x0,_0x4563b9;_0x46085b<_0x34ae11['length'];_0x46085b+=0x1){_0x4563b9=_0x34ae11[_0x46085b][_0xc0d9('0x3c')]({'plain':!![]});switch(_0x4563b9['dialCheckDuplicateType']){case _0xc0d9('0x3a'):_0x2a149a(_0x4563b9)[_0xc0d9('0x29')](_0x5f4fce());break;case'onlyIfOpen':_0xbaf511(_0x4563b9)[_0xc0d9('0x29')](_0x5f4fce());break;default:_0x20ba51[_0xc0d9('0x2e')]['create']({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36['ListId'],'scheduledat':_0x2a9f36[_0xc0d9('0x18')]?_0x2a9f36[_0xc0d9('0x18')]:moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')),'priority':_0x2a9f36[_0xc0d9('0x27')]?_0x2a9f36[_0xc0d9('0x27')]:0x2,'callback':_0x2a9f36[_0xc0d9('0x28')]?!![]:![],'callbackuniqueid':_0x2a9f36['callbackUniqueid']?_0x2a9f36[_0xc0d9('0x28')]:undefined,'callbackat':_0x2a9f36[_0xc0d9('0x28')]?moment()[_0xc0d9('0x19')](_0xc0d9('0x1a')):undefined,'CampaignId':_0x4563b9['id']})[_0xc0d9('0x29')](_0x5f4fce());}}}});})['then'](function(){return _0x20ba51[_0xc0d9('0x31')][_0xc0d9('0x40')]({'attributes':['id'],'include':[{'model':_0x20ba51[_0xc0d9('0x37')],'as':_0xc0d9('0x3b'),'where':{'id':_0x2a9f36['ListId']}}]})[_0xc0d9('0x24')](function(_0x331b6f){if(_0x331b6f){var _0x265b92=[];for(var _0x2d6239=0x0,_0xf2054;_0x2d6239<_0x331b6f[_0xc0d9('0x39')];_0x2d6239+=0x1){_0xf2054=_0x331b6f[_0x2d6239][_0xc0d9('0x3c')]({'plain':!![]});_0x20ba51[_0xc0d9('0x3d')][_0xc0d9('0x2f')]({'phone':_0x2a9f36[_0xc0d9('0xd')],'ContactId':_0x2a9f36['id'],'ListId':_0x2a9f36[_0xc0d9('0x26')],'CampaignId':_0xf2054['id']})['catch'](function(_0x91ed3d){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x91ed3d[_0xc0d9('0x3f')]);});}}});})[_0xc0d9('0x24')](function(){_0x1c3ef6();})[_0xc0d9('0x29')](function(_0x27f0ba){logger[_0xc0d9('0x15')](_0xc0d9('0x3e'),_0xc0d9('0x17'),_0x27f0ba['message']);_0x1c3ef6(_0x27f0ba);});}else{_0x1c3ef6(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x55227e,_0x108a1a,_0x31cd0e){var _0x2a36d3=_0x3f0cc0[_0xc0d9('0x41')];var _0x202598=_0x55227e[_0xc0d9('0x3c')]({'plain':!![]});return _0x2a36d3['CmHopper'][_0xc0d9('0x40')]({'raw':!![],'where':{'ListId':_0x202598[_0xc0d9('0x26')],'ContactId':_0x202598['id']}})[_0xc0d9('0x24')](function(_0x5663d6){if(!_[_0xc0d9('0x42')](_0x5663d6)){var _0xe9b978=[];for(var _0x2462ca=0x0;_0x2462ca<_0x5663d6[_0xc0d9('0x39')];_0x2462ca+=0x1){var _0x18bb42=_0x2a36d3['CmHopper'][_0xc0d9('0x43')]({'where':{'ListId':_0x5663d6[_0x2462ca]['ListId'],'ContactId':_0x5663d6[_0x2462ca][_0xc0d9('0x44')],'VoiceQueueId':_0x5663d6[_0x2462ca][_0xc0d9('0x45')],'CampaignId':_0x5663d6[_0x2462ca][_0xc0d9('0x46')]}});_0xe9b978['push'](_0x18bb42);}return BPromise[_0xc0d9('0x47')](_0xe9b978);}})['then'](function(_0x4c8062){logger[_0xc0d9('0x48')](_0xc0d9('0x49'),util[_0xc0d9('0x30')](_0x4c8062,{'showHidden':![],'depth':null}));_0x31cd0e();})[_0xc0d9('0x29')](function(_0x3a4cbd){logger[_0xc0d9('0x15')]('[CmContact][afterDestroy][Error]',util[_0xc0d9('0x30')](_0x3a4cbd,{'showHidden':![],'depth':null}));_0x31cd0e(_0x3a4cbd);});}}});}; \ No newline at end of file +var _0x7a7b=['destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','timezones','utcOffset','add','minutes','then','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','cmContact,\x20afterCreate\x20','\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','outbound','dialCheckDuplicateType','CmList','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','length','Campaign','List\x20not\x20found','isEmpty'];(function(_0x579785,_0x10282a){var _0x38965c=function(_0x51dd18){while(--_0x51dd18){_0x579785['push'](_0x579785['shift']());}};_0x38965c(++_0x10282a);}(_0x7a7b,0x138));var _0xb7a7=function(_0x10f875,_0x51f8cf){_0x10f875=_0x10f875-0x0;var _0x3accfa=_0x7a7b[_0x10f875];return _0x3accfa;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var logger=require(_0xb7a7('0x2'))(_0xb7a7('0x3'));var moment=require(_0xb7a7('0x4'));var BPromise=require(_0xb7a7('0x5'));var rp=require(_0xb7a7('0x6'));var fs=require('fs');var path=require(_0xb7a7('0x7'));var rimraf=require('rimraf');var config=require(_0xb7a7('0x8'));var shared=require(_0xb7a7('0x9'));var attributes=require('./cmContact.attributes');module[_0xb7a7('0xa')]=function(_0x398ecc,_0x2826cb){return _0x398ecc[_0xb7a7('0xb')](_0xb7a7('0xc'),attributes,{'tableName':_0xb7a7('0xd'),'paranoid':!![],'indexes':[{'name':_0xb7a7('0xe'),'fields':[_0xb7a7('0xe')]},{'name':'fti_cm_contacts','fields':[_0xb7a7('0xf'),'lastName',_0xb7a7('0xe'),_0xb7a7('0x10'),_0xb7a7('0x11'),_0xb7a7('0x12')],'type':_0xb7a7('0x13')}],'timestamps':!![],'charset':_0xb7a7('0x14'),'collate':_0xb7a7('0x15'),'hooks':{'afterCreate':function(_0x379e9a,_0x31173a,_0x253610){var _0x1c246f=_0x398ecc['models'];var _0x19b37e=_0x379e9a[_0xb7a7('0x16')]({'plain':!![]});function _0x5b130a(){return function(_0x11ec07){logger[_0xb7a7('0x17')](_0xb7a7('0x18'),_0xb7a7('0x19'),util['inspect'](_0x11ec07,{'showHidden':![],'depth':null}));};}function _0x39632b(_0x26ed00,_0xd56543){var _0x50442b=_0xd56543['scheduledat']?_0xd56543[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c'));return new BPromise(function(_0x3b514f,_0x136745){if(_[_0xb7a7('0x1d')](_0xd56543[_0xb7a7('0x1e')])){_0x3b514f({'ret':_0x50442b});}else{_0x1c246f['VoiceQueue'][_0xb7a7('0x1f')]({'where':{'id':_0x26ed00['id']}})['then'](function(_0x390fbc){if(!_[_0xb7a7('0x1d')](_0x390fbc)){var _0x437406=_0x390fbc['dialTimezone'];if(!_[_0xb7a7('0x1d')](_0x437406)){var _0x57f35b=shared[_0xb7a7('0x20')];var _0x5561a6=_0x57f35b[_0x437406];var _0x5e7477=_0x57f35b[_0xd56543[_0xb7a7('0x1e')]];if(!_['isNil'](_0x5561a6)&&!_[_0xb7a7('0x1d')](_0x5e7477)){var _0x74da69=_0x5561a6[_0xb7a7('0x21')]-_0x5e7477[_0xb7a7('0x21')];_0x50442b=_0xd56543[_0xb7a7('0x1a')]?_0xd56543[_0xb7a7('0x1a')]:moment();var _0x4c8e04=moment(_0x50442b)[_0xb7a7('0x22')](_0x74da69,_0xb7a7('0x23'));_0x3b514f({'ret':_0x4c8e04[_0xb7a7('0x1b')](_0xb7a7('0x1c'))});}else _0x3b514f({'ret':_0x50442b});}else _0x3b514f({'ret':_0x50442b});}else{_0x3b514f({'ret':_0x50442b});}});}});return 0xa;}var _0x13afbd=function(_0x3c667f){return new BPromise(function(_0x31ea38,_0x24ddf8){_0x39632b(_0x3c667f,_0x19b37e)[_0xb7a7('0x24')](function(_0x4c547a){_0x19b37e['scheduledat']=_0x4c547a[_0xb7a7('0x25')];_0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x1f')]({'where':{'phone':_0x19b37e[_0xb7a7('0xe')],'VoiceQueueId':_0x3c667f['id']}})[_0xb7a7('0x24')](function(_0x4afc1f){if(!_[_0xb7a7('0x1d')](_0x4afc1f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x19b37e['phone']+_0xb7a7('0x27')+_0x3c667f['id']);}return _0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x28')]({'phone':_0x19b37e[_0xb7a7('0xe')],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'priority':_0x19b37e[_0xb7a7('0x2a')]?_0x19b37e[_0xb7a7('0x2a')]:0x2,'scheduledat':_0x19b37e[_0xb7a7('0x1a')]?_0x19b37e[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x19b37e[_0xb7a7('0x2b')]?!![]:![],'callbackuniqueid':_0x19b37e[_0xb7a7('0x2b')]?_0x19b37e['callbackUniqueid']:undefined,'callbackat':_0x19b37e['callbackUniqueid']?moment()['format'](_0xb7a7('0x1c')):undefined,'VoiceQueueId':_0x3c667f['id']});})[_0xb7a7('0x2c')](function(_0x193f6c){_0x24ddf8(_0x193f6c);});});});};var _0x31d1dd=function(_0x5874cd){return new BPromise(function(_0x52986a,_0x789e55){_0x39632b(_0x5874cd,_0x19b37e)[_0xb7a7('0x24')](function(_0x48c5f3){_0x19b37e['scheduledat']=_0x48c5f3['ret'];_0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x1f')]({'where':{'phone':_0x19b37e['phone'],'VoiceQueueId':_0x5874cd['id']}})['then'](function(_0x23766d){if(!_[_0xb7a7('0x1d')](_0x23766d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x19b37e[_0xb7a7('0xe')]+_0xb7a7('0x2d')+_0x5874cd['id']);}return _0x1c246f[_0xb7a7('0x2e')][_0xb7a7('0x1f')]({'where':{'calleridnum':_0x19b37e['phone'],'VoiceQueueId':_0x5874cd['id']}});})[_0xb7a7('0x24')](function(_0x3fa5ba){if(!_[_0xb7a7('0x1d')](_0x3fa5ba)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x19b37e['phone']+_0xb7a7('0x2f')+_0x5874cd['id']);}return _0x1c246f[_0xb7a7('0x26')]['create']({'phone':_0x19b37e['phone'],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'priority':_0x19b37e[_0xb7a7('0x2a')]?_0x19b37e[_0xb7a7('0x2a')]:0x2,'scheduledat':_0x19b37e['scheduledat']?_0x19b37e[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')),'callback':_0x19b37e[_0xb7a7('0x2b')]?!![]:![],'callbackuniqueid':_0x19b37e[_0xb7a7('0x2b')]?_0x19b37e[_0xb7a7('0x2b')]:undefined,'callbackat':_0x19b37e[_0xb7a7('0x2b')]?moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')):undefined,'VoiceQueueId':_0x5874cd['id']});})[_0xb7a7('0x2c')](function(_0x23869a){_0x789e55(_0x23869a);});});});};function _0x984c88(){return function(_0x1824b1){logger[_0xb7a7('0x17')](_0xb7a7('0x18'),_0xb7a7('0x19'),util[_0xb7a7('0x30')](_0x1824b1,{'showHidden':![],'depth':null}));};}function _0x568aa3(_0x4b1180,_0x122f7d){var _0x1b340c=_0x122f7d[_0xb7a7('0x1a')]?_0x122f7d['scheduledat']:moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c'));return new BPromise(function(_0x352cb0,_0x17bf59){if(_[_0xb7a7('0x1d')](_0x122f7d[_0xb7a7('0x1e')])){_0x352cb0({'ret':_0x1b340c});}else{_0x1c246f['Campaign']['findOne']({'where':{'id':_0x4b1180['id']}})['then'](function(_0x3f5d09){if(!_[_0xb7a7('0x1d')](_0x3f5d09)){var _0x315ef6=_0x3f5d09[_0xb7a7('0x1e')];if(!_[_0xb7a7('0x1d')](_0x315ef6)){var _0x55966c=shared[_0xb7a7('0x20')];var _0x942cb2=_0x55966c[_0x315ef6];var _0x5c2773=_0x55966c[_0x122f7d[_0xb7a7('0x1e')]];if(!_[_0xb7a7('0x1d')](_0x942cb2)&&!_[_0xb7a7('0x1d')](_0x5c2773)){var _0x15b1c0=_0x942cb2[_0xb7a7('0x21')]-_0x5c2773[_0xb7a7('0x21')];_0x1b340c=_0x122f7d[_0xb7a7('0x1a')]?_0x122f7d[_0xb7a7('0x1a')]:moment();var _0x260300=moment(_0x1b340c)[_0xb7a7('0x22')](_0x15b1c0,'minutes');_0x352cb0({'ret':_0x260300[_0xb7a7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x352cb0({'ret':_0x1b340c});}else _0x352cb0({'ret':_0x1b340c});}else{_0x352cb0({'ret':_0x1b340c});}});}});return 0xa;}var _0x1c4990=function(_0x100cd8){return new BPromise(function(_0x2fddc0,_0x338ef8){_0x568aa3(_0x100cd8,_0x19b37e)[_0xb7a7('0x24')](function(_0x142067){_0x19b37e['scheduledat']=_0x142067[_0xb7a7('0x25')];_0x1c246f['CmHopper'][_0xb7a7('0x1f')]({'where':{'phone':_0x19b37e[_0xb7a7('0xe')],'CampaignId':_0x100cd8['id']}})[_0xb7a7('0x24')](function(_0x30e138){if(!_['isNil'](_0x30e138)){throw new Error(_0xb7a7('0x31')+_0x19b37e[_0xb7a7('0xe')]+_0xb7a7('0x32')+_0x100cd8['id']);}return _0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x28')]({'phone':_0x19b37e[_0xb7a7('0xe')],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'priority':_0x19b37e['priority']?_0x19b37e[_0xb7a7('0x2a')]:0x2,'scheduledat':_0x19b37e[_0xb7a7('0x1a')]?_0x19b37e[_0xb7a7('0x1a')]:moment()['format'](_0xb7a7('0x1c')),'callback':_0x19b37e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x19b37e['callbackUniqueid']?_0x19b37e[_0xb7a7('0x2b')]:undefined,'callbackat':_0x19b37e[_0xb7a7('0x2b')]?moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')):undefined,'CampaignId':_0x100cd8['id']});})['catch'](function(_0x47d17d){_0x338ef8(_0x47d17d);});});});};var _0x49ca79=function(_0x536f74){return new BPromise(function(_0x3aea2f,_0x4ebe94){_0x568aa3(_0x536f74,_0x19b37e)['then'](function(_0x55fa46){_0x19b37e[_0xb7a7('0x1a')]=_0x55fa46[_0xb7a7('0x25')];_0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x1f')]({'where':{'phone':_0x19b37e[_0xb7a7('0xe')],'CampaignId':_0x536f74['id']}})[_0xb7a7('0x24')](function(_0x24cf7e){if(!_['isNil'](_0x24cf7e)){throw new Error(_0xb7a7('0x31')+_0x19b37e[_0xb7a7('0xe')]+_0xb7a7('0x33')+_0x536f74['id']);}return _0x1c246f['CmHopperFinal'][_0xb7a7('0x1f')]({'where':{'calleridnum':_0x19b37e[_0xb7a7('0xe')],'CampaignId':_0x536f74['id']}});})[_0xb7a7('0x24')](function(_0x42e649){if(!_[_0xb7a7('0x1d')](_0x42e649)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x19b37e[_0xb7a7('0xe')]+_0xb7a7('0x34')+_0x536f74['id']);}return _0x1c246f[_0xb7a7('0x26')][_0xb7a7('0x28')]({'phone':_0x19b37e[_0xb7a7('0xe')],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'priority':_0x19b37e['priority']?_0x19b37e['priority']:0x2,'scheduledat':_0x19b37e[_0xb7a7('0x1a')]?_0x19b37e[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')),'callback':_0x19b37e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x19b37e[_0xb7a7('0x2b')]?_0x19b37e[_0xb7a7('0x2b')]:undefined,'callbackat':_0x19b37e[_0xb7a7('0x2b')]?moment()[_0xb7a7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x536f74['id']});})['catch'](function(_0x3a68ec){_0x4ebe94(_0x3a68ec);});});});};if(_0x19b37e['ListId']){_0x1c246f[_0xb7a7('0x35')][_0xb7a7('0x36')]({'where':{'type':_0xb7a7('0x37')},'attributes':['id',_0xb7a7('0x38'),_0xb7a7('0x1e')],'include':[{'model':_0x1c246f[_0xb7a7('0x39')],'as':'Lists','where':{'id':_0x19b37e[_0xb7a7('0x29')]}}]})[_0xb7a7('0x24')](function(_0x5266e1){if(_0x5266e1){var _0x42aa44=[];for(var _0x5570a1=0x0,_0x3bd549;_0x5570a1<_0x5266e1['length'];_0x5570a1+=0x1){_0x3bd549=_0x5266e1[_0x5570a1][_0xb7a7('0x16')]({'plain':!![]});switch(_0x3bd549[_0xb7a7('0x38')]){case _0xb7a7('0x3a'):_0x31d1dd(_0x3bd549)['catch'](_0x5b130a());break;case _0xb7a7('0x3b'):_0x13afbd(_0x3bd549)['catch'](_0x5b130a());break;default:_0x568aa3(_0x3bd549,_0x19b37e)['then'](function(_0x165d2e){_0x19b37e[_0xb7a7('0x1a')]=_0x165d2e['ret'];_0x1c246f['CmHopper'][_0xb7a7('0x28')]({'phone':_0x19b37e['phone'],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e['ListId'],'scheduledat':_0x19b37e[_0xb7a7('0x1a')]?_0x19b37e[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x19b37e[_0xb7a7('0x2a')]?_0x19b37e[_0xb7a7('0x2a')]:0x2,'callback':_0x19b37e[_0xb7a7('0x2b')]?!![]:![],'callbackuniqueid':_0x19b37e[_0xb7a7('0x2b')]?_0x19b37e[_0xb7a7('0x2b')]:undefined,'callbackat':_0x19b37e[_0xb7a7('0x2b')]?moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')):undefined,'VoiceQueueId':_0x3bd549['id']})[_0xb7a7('0x2c')](_0x5b130a());});}}}})[_0xb7a7('0x24')](function(){return _0x1c246f['VoiceQueue'][_0xb7a7('0x36')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1c246f[_0xb7a7('0x39')],'as':_0xb7a7('0x3c'),'where':{'id':_0x19b37e['ListId']}}]})['then'](function(_0x13426e){if(_0x13426e){var _0x393ebf=[];for(var _0x158a6b=0x0,_0x193780;_0x158a6b<_0x13426e['length'];_0x158a6b+=0x1){_0x193780=_0x13426e[_0x158a6b][_0xb7a7('0x16')]({'plain':!![]});_0x1c246f[_0xb7a7('0x3d')][_0xb7a7('0x28')]({'phone':_0x19b37e[_0xb7a7('0xe')],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'VoiceQueueId':_0x193780['id']})[_0xb7a7('0x2c')](function(_0x1ef9d9){logger[_0xb7a7('0x17')](_0xb7a7('0x3e'),_0xb7a7('0x19'),_0x1ef9d9[_0xb7a7('0x3f')]);});}}});})[_0xb7a7('0x24')](function(){return _0x1c246f['Campaign']['findAll']({'attributes':['id',_0xb7a7('0x38'),_0xb7a7('0x1e')],'include':[{'model':_0x1c246f[_0xb7a7('0x39')],'as':'Lists','where':{'id':_0x19b37e[_0xb7a7('0x29')]}}]})['then'](function(_0x2e35d7){if(_0x2e35d7){var _0x116d86=[];for(var _0x32545e=0x0,_0x19d104;_0x32545e<_0x2e35d7[_0xb7a7('0x40')];_0x32545e+=0x1){_0x19d104=_0x2e35d7[_0x32545e][_0xb7a7('0x16')]({'plain':!![]});switch(_0x19d104[_0xb7a7('0x38')]){case _0xb7a7('0x3a'):_0x49ca79(_0x19d104)[_0xb7a7('0x2c')](_0x984c88());break;case _0xb7a7('0x3b'):_0x1c4990(_0x19d104)['catch'](_0x984c88());break;default:_0x1c246f['CmHopper'][_0xb7a7('0x28')]({'phone':_0x19b37e['phone'],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e[_0xb7a7('0x29')],'scheduledat':_0x19b37e['scheduledat']?_0x19b37e[_0xb7a7('0x1a')]:moment()[_0xb7a7('0x1b')](_0xb7a7('0x1c')),'priority':_0x19b37e[_0xb7a7('0x2a')]?_0x19b37e[_0xb7a7('0x2a')]:0x2,'callback':_0x19b37e[_0xb7a7('0x2b')]?!![]:![],'callbackuniqueid':_0x19b37e[_0xb7a7('0x2b')]?_0x19b37e[_0xb7a7('0x2b')]:undefined,'callbackat':_0x19b37e[_0xb7a7('0x2b')]?moment()[_0xb7a7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x19d104['id']})['catch'](_0x984c88());}}}});})[_0xb7a7('0x24')](function(){return _0x1c246f[_0xb7a7('0x41')][_0xb7a7('0x36')]({'attributes':['id'],'include':[{'model':_0x1c246f[_0xb7a7('0x39')],'as':_0xb7a7('0x3c'),'where':{'id':_0x19b37e['ListId']}}]})[_0xb7a7('0x24')](function(_0x2bb5e9){if(_0x2bb5e9){var _0x32ee3c=[];for(var _0x577ac1=0x0,_0x7d9fe3;_0x577ac1<_0x2bb5e9[_0xb7a7('0x40')];_0x577ac1+=0x1){_0x7d9fe3=_0x2bb5e9[_0x577ac1][_0xb7a7('0x16')]({'plain':!![]});_0x1c246f[_0xb7a7('0x3d')][_0xb7a7('0x28')]({'phone':_0x19b37e[_0xb7a7('0xe')],'ContactId':_0x19b37e['id'],'ListId':_0x19b37e['ListId'],'CampaignId':_0x7d9fe3['id']})[_0xb7a7('0x2c')](function(_0x3cd29d){logger[_0xb7a7('0x17')](_0xb7a7('0x3e'),_0xb7a7('0x19'),_0x3cd29d[_0xb7a7('0x3f')]);});}}});})[_0xb7a7('0x24')](function(){_0x253610();})[_0xb7a7('0x2c')](function(_0x88741b){logger[_0xb7a7('0x17')](_0xb7a7('0x3e'),_0xb7a7('0x19'),_0x88741b['message']);_0x253610(_0x88741b);});}else{_0x253610(new Error(_0xb7a7('0x42')));}},'afterDestroy':function(_0x565918,_0x3180a4,_0x57dc79){var _0x40ef40=_0x398ecc['models'];var _0xb6a1a5=_0x565918[_0xb7a7('0x16')]({'plain':!![]});return _0x40ef40[_0xb7a7('0x26')][_0xb7a7('0x36')]({'raw':!![],'where':{'ListId':_0xb6a1a5[_0xb7a7('0x29')],'ContactId':_0xb6a1a5['id']}})[_0xb7a7('0x24')](function(_0x4d7b0a){if(!_[_0xb7a7('0x43')](_0x4d7b0a)){var _0x2a0fe6=[];for(var _0x2662a5=0x0;_0x2662a5<_0x4d7b0a[_0xb7a7('0x40')];_0x2662a5+=0x1){var _0xcf0ed9=_0x40ef40[_0xb7a7('0x26')][_0xb7a7('0x44')]({'where':{'ListId':_0x4d7b0a[_0x2662a5][_0xb7a7('0x29')],'ContactId':_0x4d7b0a[_0x2662a5][_0xb7a7('0x45')],'VoiceQueueId':_0x4d7b0a[_0x2662a5][_0xb7a7('0x46')],'CampaignId':_0x4d7b0a[_0x2662a5][_0xb7a7('0x47')]}});_0x2a0fe6[_0xb7a7('0x48')](_0xcf0ed9);}return BPromise['all'](_0x2a0fe6);}})[_0xb7a7('0x24')](function(_0x1f4625){logger[_0xb7a7('0x49')](_0xb7a7('0x4a'),util[_0xb7a7('0x30')](_0x1f4625,{'showHidden':![],'depth':null}));_0x57dc79();})['catch'](function(_0x2756a8){logger[_0xb7a7('0x17')](_0xb7a7('0x4b'),util[_0xb7a7('0x30')](_0x2756a8,{'showHidden':![],'depth':null}));_0x57dc79(_0x2756a8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 8234d20..e8842ad 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(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0xedb321,_0x2c833e){var _0x189cf5=function(_0x12ccf4){while(--_0x12ccf4){_0xedb321['push'](_0xedb321['shift']());}};_0x189cf5(++_0x2c833e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 8517455..1dc5865 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 _0x851e=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0xbd3669,_0x329b70){var _0x34f750=function(_0x2a3eb5){while(--_0x2a3eb5){_0xbd3669['push'](_0xbd3669['shift']());}};_0x34f750(++_0x329b70);}(_0x851e,0x1e8));var _0xe851=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x851e[_0x2fe959];return _0x2f6ace;};'use strict';var Sequelize=require(_0xe851('0x0'));module[_0xe851('0x1')]={'CmContactId':{'type':Sequelize[_0xe851('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe851('0x3')],'defaultValue':_0xe851('0x4')},'OrderBy':{'type':Sequelize[_0xe851('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xe851('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x84e1=['sequelize','exports','INTEGER','STRING'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x84e1,0x1dc));var _0x184e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x84e1[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x184e('0x0'));module[_0x184e('0x1')]={'CmContactId':{'type':Sequelize[_0x184e('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x184e('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x184e('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x184e('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x184e('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x184e('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 4b18d73..b50fdbf 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 _0x9e81=['includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','sendStatus','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','findAll','rows','catch','show'];(function(_0x1128cd,_0x3391de){var _0x3b46d8=function(_0x378fd5){while(--_0x378fd5){_0x1128cd['push'](_0x1128cd['shift']());}};_0x3b46d8(++_0x3391de);}(_0x9e81,0x10d));var _0x19e8=function(_0x202438,_0x21f696){_0x202438=_0x202438-0x0;var _0x43a7f1=_0x9e81[_0x202438];return _0x43a7f1;};'use strict';var emlformat=require(_0x19e8('0x0'));var rimraf=require(_0x19e8('0x1'));var zipdir=require(_0x19e8('0x2'));var jsonpatch=require(_0x19e8('0x3'));var rp=require(_0x19e8('0x4'));var moment=require(_0x19e8('0x5'));var BPromise=require(_0x19e8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x19e8('0x7'));var sox=require(_0x19e8('0x8'));var csv=require(_0x19e8('0x9'));var ejs=require(_0x19e8('0xa'));var fs=require('fs');var fs_extra=require(_0x19e8('0xb'));var _=require(_0x19e8('0xc'));var squel=require(_0x19e8('0xd'));var crypto=require('crypto');var jsforce=require(_0x19e8('0xe'));var deskjs=require(_0x19e8('0xf'));var toCsv=require(_0x19e8('0x9'));var querystring=require('querystring');var Papa=require(_0x19e8('0x10'));var Redis=require(_0x19e8('0x11'));var authService=require(_0x19e8('0x12'));var qs=require(_0x19e8('0x13'));var as=require(_0x19e8('0x14'));var hardwareService=require(_0x19e8('0x15'));var logger=require('../../config/logger')(_0x19e8('0x16'));var utils=require(_0x19e8('0x17'));var config=require(_0x19e8('0x18'));var licenseUtil=require(_0x19e8('0x19'));var db=require(_0x19e8('0x1a'))['db'];function respondWithStatusCode(_0x4b0c9d,_0x4c84f5){_0x4c84f5=_0x4c84f5||0xcc;return function(_0x473fe9){if(_0x473fe9){return _0x4b0c9d['sendStatus'](_0x4c84f5);}return _0x4b0c9d['status'](_0x4c84f5)[_0x19e8('0x1b')]();};}function respondWithResult(_0x3e53ee,_0x282a36){_0x282a36=_0x282a36||0xc8;return function(_0x3b4af1){if(_0x3b4af1){return _0x3e53ee[_0x19e8('0x1c')](_0x282a36)[_0x19e8('0x1d')](_0x3b4af1);}};}function respondWithFilteredResult(_0x3787d7,_0x453d8f){return function(_0x4c2074){if(_0x4c2074){var _0x537098=typeof _0x453d8f[_0x19e8('0x1e')]==='undefined'&&typeof _0x453d8f['limit']===_0x19e8('0x1f');var _0x51638b=_0x4c2074[_0x19e8('0x20')];var _0x515128=_0x537098?0x0:_0x453d8f[_0x19e8('0x1e')];var _0x1620ba=_0x537098?_0x4c2074[_0x19e8('0x20')]:_0x453d8f[_0x19e8('0x1e')]+_0x453d8f[_0x19e8('0x21')];var _0x2456db;if(_0x1620ba>=_0x51638b){_0x1620ba=_0x51638b;_0x2456db=0xc8;}else{_0x2456db=0xce;}_0x3787d7[_0x19e8('0x1c')](_0x2456db);return _0x3787d7[_0x19e8('0x22')](_0x19e8('0x23'),_0x515128+'-'+_0x1620ba+'/'+_0x51638b)[_0x19e8('0x1d')](_0x4c2074);}return null;};}function patchUpdates(_0x31564f){return function(_0xc03156){try{jsonpatch[_0x19e8('0x24')](_0xc03156,_0x31564f,!![]);}catch(_0x274e4c){return BPromise[_0x19e8('0x25')](_0x274e4c);}return _0xc03156[_0x19e8('0x26')]();};}function saveUpdates(_0x3f37c7,_0xd5e181){return function(_0x3b1ede){if(_0x3b1ede){return _0x3b1ede[_0x19e8('0x27')](_0x3f37c7)[_0x19e8('0x28')](function(_0x153bfd){return _0x153bfd;});}return null;};}function removeEntity(_0x2a33d0,_0x5f185b){return function(_0x423938){if(_0x423938){return _0x423938[_0x19e8('0x29')]()['then'](function(){var _0x220632=_0x423938[_0x19e8('0x2a')]({'plain':!![]});var _0x234de3=_0x19e8('0x2b');return db['UserProfileResource'][_0x19e8('0x29')]({'where':{'type':_0x234de3,'resourceId':_0x220632['id']}})['then'](function(){return _0x423938;});})[_0x19e8('0x28')](function(){_0x2a33d0[_0x19e8('0x1c')](0xcc)[_0x19e8('0x1b')]();});}};}function handleEntityNotFound(_0x535b1a,_0xef2b04){return function(_0x5c40de){if(!_0x5c40de){_0x535b1a[_0x19e8('0x2c')](0x194);}return _0x5c40de;};}function handleError(_0x345d14,_0x4c67e2){_0x4c67e2=_0x4c67e2||0x1f4;return function(_0x1a9ab7){logger[_0x19e8('0x2d')](_0x1a9ab7[_0x19e8('0x2e')]);if(_0x1a9ab7[_0x19e8('0x2f')]){delete _0x1a9ab7[_0x19e8('0x2f')];}_0x345d14[_0x19e8('0x1c')](_0x4c67e2)[_0x19e8('0x30')](_0x1a9ab7);};}exports['index']=function(_0x3ec2ff,_0x2614dd){var _0x2a70fe={},_0x369ed6={},_0x2ea0ff={'count':0x0,'rows':[]};var _0x5a9756=_[_0x19e8('0x31')](db[_0x19e8('0x32')][_0x19e8('0x33')],function(_0x53f738){return{'name':_0x53f738[_0x19e8('0x34')],'type':_0x53f738[_0x19e8('0x35')]['key']};});_0x369ed6[_0x19e8('0x36')]=_[_0x19e8('0x31')](_0x5a9756,_0x19e8('0x2f'));_0x369ed6[_0x19e8('0x37')]=_[_0x19e8('0x38')](_0x3ec2ff[_0x19e8('0x37')]);_0x369ed6['filters']=_[_0x19e8('0x39')](_0x369ed6[_0x19e8('0x36')],_0x369ed6[_0x19e8('0x37')]);_0x2a70fe[_0x19e8('0x3a')]=_[_0x19e8('0x39')](_0x369ed6['model'],qs[_0x19e8('0x3b')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x3b')]));_0x2a70fe[_0x19e8('0x3a')]=_0x2a70fe[_0x19e8('0x3a')][_0x19e8('0x3c')]?_0x2a70fe[_0x19e8('0x3a')]:_0x369ed6[_0x19e8('0x36')];if(!_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x3d')](_0x19e8('0x3e'))){_0x2a70fe['limit']=qs[_0x19e8('0x21')](_0x3ec2ff[_0x19e8('0x37')]['limit']);_0x2a70fe[_0x19e8('0x1e')]=qs[_0x19e8('0x1e')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x1e')]);}_0x2a70fe[_0x19e8('0x3f')]=qs[_0x19e8('0x40')](_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x40')]);_0x2a70fe[_0x19e8('0x41')]=qs[_0x19e8('0x42')](_[_0x19e8('0x43')](_0x3ec2ff[_0x19e8('0x37')],_0x369ed6[_0x19e8('0x42')]),_0x5a9756);if(_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x44')]){_0x2a70fe[_0x19e8('0x41')]=_['merge'](_0x2a70fe['where'],{'$or':_[_0x19e8('0x31')](_0x5a9756,function(_0x1b8501){if(_0x1b8501[_0x19e8('0x35')]!==_0x19e8('0x45')){var _0x394e08={};_0x394e08[_0x1b8501['name']]={'$like':'%'+_0x3ec2ff[_0x19e8('0x37')][_0x19e8('0x44')]+'%'};return _0x394e08;}})});}_0x2a70fe=_['merge']({},_0x2a70fe,_0x3ec2ff[_0x19e8('0x46')]);var _0x3dd7c1={'where':_0x2a70fe[_0x19e8('0x41')]};return db['CmContactHasItem']['count'](_0x3dd7c1)[_0x19e8('0x28')](function(_0x103302){_0x2ea0ff[_0x19e8('0x20')]=_0x103302;if(_0x3ec2ff[_0x19e8('0x37')]['includeAll']){_0x2a70fe['include']=[{'all':!![]}];}return db[_0x19e8('0x32')][_0x19e8('0x47')](_0x2a70fe);})[_0x19e8('0x28')](function(_0x2136b3){_0x2ea0ff[_0x19e8('0x48')]=_0x2136b3;return _0x2ea0ff;})['then'](respondWithFilteredResult(_0x2614dd,_0x2a70fe))[_0x19e8('0x49')](handleError(_0x2614dd,null));};exports[_0x19e8('0x4a')]=function(_0x5ec1ca,_0x8d34aa){var _0x5aff19={'raw':!![],'where':{'id':_0x5ec1ca['params']['id']}},_0x4173f0={};_0x4173f0[_0x19e8('0x36')]=_[_0x19e8('0x38')](db['CmContactHasItem'][_0x19e8('0x33')]);_0x4173f0[_0x19e8('0x37')]=_[_0x19e8('0x38')](_0x5ec1ca[_0x19e8('0x37')]);_0x4173f0[_0x19e8('0x42')]=_['intersection'](_0x4173f0[_0x19e8('0x36')],_0x4173f0['query']);_0x5aff19[_0x19e8('0x3a')]=_[_0x19e8('0x39')](_0x4173f0['model'],qs['fields'](_0x5ec1ca[_0x19e8('0x37')][_0x19e8('0x3b')]));_0x5aff19[_0x19e8('0x3a')]=_0x5aff19['attributes']['length']?_0x5aff19[_0x19e8('0x3a')]:_0x4173f0[_0x19e8('0x36')];if(_0x5ec1ca[_0x19e8('0x37')][_0x19e8('0x4b')]){_0x5aff19['include']=[{'all':!![]}];}_0x5aff19=_[_0x19e8('0x4c')]({},_0x5aff19,_0x5ec1ca['options']);return db[_0x19e8('0x32')]['find'](_0x5aff19)[_0x19e8('0x28')](handleEntityNotFound(_0x8d34aa,null))[_0x19e8('0x28')](respondWithResult(_0x8d34aa,null))['catch'](handleError(_0x8d34aa,null));};exports[_0x19e8('0x4d')]=function(_0x23a7e2,_0x591217){return db['CmContactHasItem']['create'](_0x23a7e2[_0x19e8('0x4e')],{})[_0x19e8('0x28')](function(_0x5d229d){var _0x1869ff=_0x23a7e2[_0x19e8('0x4f')][_0x19e8('0x2a')]({'plain':!![]});if(!_0x1869ff)throw new Error(_0x19e8('0x50'));if(_0x1869ff['role']===_0x19e8('0x4f')){var _0x52e568=_0x5d229d[_0x19e8('0x2a')]({'plain':!![]});var _0x256da4=_0x19e8('0x2b');return db[_0x19e8('0x51')]['find']({'where':{'name':_0x256da4,'userProfileId':_0x1869ff['userProfileId']},'raw':!![]})[_0x19e8('0x28')](function(_0x842d08){if(_0x842d08&&_0x842d08[_0x19e8('0x52')]===0x0){return db[_0x19e8('0x53')][_0x19e8('0x4d')]({'name':_0x52e568[_0x19e8('0x2f')],'resourceId':_0x52e568['id'],'type':_0x842d08[_0x19e8('0x2f')],'sectionId':_0x842d08['id']},{})[_0x19e8('0x28')](function(){return _0x5d229d;});}else{return _0x5d229d;}})['catch'](function(_0x2491bb){logger[_0x19e8('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2491bb);throw _0x2491bb;});}return _0x5d229d;})[_0x19e8('0x28')](respondWithResult(_0x591217,0xc9))[_0x19e8('0x49')](handleError(_0x591217,null));};exports[_0x19e8('0x27')]=function(_0x4094b6,_0x5f122d){if(_0x4094b6[_0x19e8('0x4e')]['id']){delete _0x4094b6[_0x19e8('0x4e')]['id'];}return db['CmContactHasItem'][_0x19e8('0x54')]({'where':{'id':_0x4094b6[_0x19e8('0x55')]['id']}})[_0x19e8('0x28')](handleEntityNotFound(_0x5f122d,null))[_0x19e8('0x28')](saveUpdates(_0x4094b6[_0x19e8('0x4e')],null))[_0x19e8('0x28')](respondWithResult(_0x5f122d,null))[_0x19e8('0x49')](handleError(_0x5f122d,null));};exports[_0x19e8('0x29')]=function(_0x59891d,_0x169f3d){return db[_0x19e8('0x32')]['find']({'where':{'id':_0x59891d['params']['id']}})[_0x19e8('0x28')](handleEntityNotFound(_0x169f3d,null))[_0x19e8('0x28')](removeEntity(_0x169f3d,null))['catch'](handleError(_0x169f3d,null));}; \ No newline at end of file +var _0x02b5=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','update','then','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','keys','filters','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','params','length','includeAll','include'];(function(_0x1b9b16,_0x2b1aa3){var _0x2b2cc7=function(_0x4e7029){while(--_0x4e7029){_0x1b9b16['push'](_0x1b9b16['shift']());}};_0x2b2cc7(++_0x2b1aa3);}(_0x02b5,0x105));var _0x502b=function(_0x45184b,_0x1a5167){_0x45184b=_0x45184b-0x0;var _0x125b08=_0x02b5[_0x45184b];return _0x125b08;};'use strict';var emlformat=require(_0x502b('0x0'));var rimraf=require(_0x502b('0x1'));var zipdir=require(_0x502b('0x2'));var jsonpatch=require(_0x502b('0x3'));var rp=require(_0x502b('0x4'));var moment=require(_0x502b('0x5'));var BPromise=require(_0x502b('0x6'));var Mustache=require(_0x502b('0x7'));var util=require(_0x502b('0x8'));var path=require(_0x502b('0x9'));var sox=require(_0x502b('0xa'));var csv=require(_0x502b('0xb'));var ejs=require(_0x502b('0xc'));var fs=require('fs');var fs_extra=require(_0x502b('0xd'));var _=require(_0x502b('0xe'));var squel=require('squel');var crypto=require(_0x502b('0xf'));var jsforce=require(_0x502b('0x10'));var deskjs=require(_0x502b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x502b('0x12'));var Redis=require(_0x502b('0x13'));var authService=require(_0x502b('0x14'));var qs=require(_0x502b('0x15'));var as=require(_0x502b('0x16'));var hardwareService=require(_0x502b('0x17'));var logger=require(_0x502b('0x18'))('api');var utils=require(_0x502b('0x19'));var config=require(_0x502b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x502b('0x1b'))['db'];function respondWithStatusCode(_0x11bdfa,_0x2ba6ec){_0x2ba6ec=_0x2ba6ec||0xcc;return function(_0x184eec){if(_0x184eec){return _0x11bdfa[_0x502b('0x1c')](_0x2ba6ec);}return _0x11bdfa['status'](_0x2ba6ec)[_0x502b('0x1d')]();};}function respondWithResult(_0xbd0ccc,_0x2e51e6){_0x2e51e6=_0x2e51e6||0xc8;return function(_0x1f6492){if(_0x1f6492){return _0xbd0ccc[_0x502b('0x1e')](_0x2e51e6)['json'](_0x1f6492);}};}function respondWithFilteredResult(_0x4021a0,_0x4f0a1a){return function(_0x2f3899){if(_0x2f3899){var _0x4d6a2b=typeof _0x4f0a1a[_0x502b('0x1f')]===_0x502b('0x20')&&typeof _0x4f0a1a['limit']===_0x502b('0x20');var _0x530ee0=_0x2f3899[_0x502b('0x21')];var _0x5f11e4=_0x4d6a2b?0x0:_0x4f0a1a[_0x502b('0x1f')];var _0x562763=_0x4d6a2b?_0x2f3899['count']:_0x4f0a1a['offset']+_0x4f0a1a['limit'];var _0x5a8803;if(_0x562763>=_0x530ee0){_0x562763=_0x530ee0;_0x5a8803=0xc8;}else{_0x5a8803=0xce;}_0x4021a0[_0x502b('0x1e')](_0x5a8803);return _0x4021a0[_0x502b('0x22')]('Content-Range',_0x5f11e4+'-'+_0x562763+'/'+_0x530ee0)[_0x502b('0x23')](_0x2f3899);}return null;};}function patchUpdates(_0x16e716){return function(_0x5e90d5){try{jsonpatch[_0x502b('0x24')](_0x5e90d5,_0x16e716,!![]);}catch(_0x58e7a9){return BPromise['reject'](_0x58e7a9);}return _0x5e90d5['save']();};}function saveUpdates(_0x5af8ad,_0x25a06b){return function(_0x2e48f2){if(_0x2e48f2){return _0x2e48f2[_0x502b('0x25')](_0x5af8ad)['then'](function(_0x5c8aa1){return _0x5c8aa1;});}return null;};}function removeEntity(_0x4a5c3d,_0x623494){return function(_0x17e720){if(_0x17e720){return _0x17e720['destroy']()[_0x502b('0x26')](function(){var _0x5d4fa0=_0x17e720['get']({'plain':!![]});var _0x22aacf=_0x502b('0x27');return db[_0x502b('0x28')][_0x502b('0x29')]({'where':{'type':_0x22aacf,'resourceId':_0x5d4fa0['id']}})[_0x502b('0x26')](function(){return _0x17e720;});})[_0x502b('0x26')](function(){_0x4a5c3d[_0x502b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d86d,_0x292dbb){return function(_0xd83dc7){if(!_0xd83dc7){_0x41d86d[_0x502b('0x1c')](0x194);}return _0xd83dc7;};}function handleError(_0x332271,_0x333b35){_0x333b35=_0x333b35||0x1f4;return function(_0x3815b8){logger[_0x502b('0x2a')](_0x3815b8[_0x502b('0x2b')]);if(_0x3815b8[_0x502b('0x2c')]){delete _0x3815b8[_0x502b('0x2c')];}_0x332271[_0x502b('0x1e')](_0x333b35)[_0x502b('0x2d')](_0x3815b8);};}exports[_0x502b('0x2e')]=function(_0x244deb,_0x5bece9){var _0x5e45e4={},_0x54dab0={},_0x53ac15={'count':0x0,'rows':[]};var _0x567109=_[_0x502b('0x2f')](db[_0x502b('0x30')][_0x502b('0x31')],function(_0x397662){return{'name':_0x397662['fieldName'],'type':_0x397662[_0x502b('0x32')][_0x502b('0x33')]};});_0x54dab0[_0x502b('0x34')]=_[_0x502b('0x2f')](_0x567109,_0x502b('0x2c'));_0x54dab0['query']=_[_0x502b('0x35')](_0x244deb['query']);_0x54dab0[_0x502b('0x36')]=_['intersection'](_0x54dab0['model'],_0x54dab0[_0x502b('0x37')]);_0x5e45e4['attributes']=_[_0x502b('0x38')](_0x54dab0['model'],qs[_0x502b('0x39')](_0x244deb[_0x502b('0x37')][_0x502b('0x39')]));_0x5e45e4[_0x502b('0x3a')]=_0x5e45e4[_0x502b('0x3a')]['length']?_0x5e45e4['attributes']:_0x54dab0[_0x502b('0x34')];if(!_0x244deb[_0x502b('0x37')][_0x502b('0x3b')](_0x502b('0x3c'))){_0x5e45e4['limit']=qs[_0x502b('0x3d')](_0x244deb[_0x502b('0x37')][_0x502b('0x3d')]);_0x5e45e4[_0x502b('0x1f')]=qs[_0x502b('0x1f')](_0x244deb[_0x502b('0x37')][_0x502b('0x1f')]);}_0x5e45e4[_0x502b('0x3e')]=qs['sort'](_0x244deb['query'][_0x502b('0x3f')]);_0x5e45e4[_0x502b('0x40')]=qs[_0x502b('0x36')](_['pick'](_0x244deb[_0x502b('0x37')],_0x54dab0[_0x502b('0x36')]),_0x567109);if(_0x244deb[_0x502b('0x37')][_0x502b('0x41')]){_0x5e45e4[_0x502b('0x40')]=_[_0x502b('0x42')](_0x5e45e4[_0x502b('0x40')],{'$or':_[_0x502b('0x2f')](_0x567109,function(_0x427a08){if(_0x427a08[_0x502b('0x32')]!==_0x502b('0x43')){var _0x565ee5={};_0x565ee5[_0x427a08[_0x502b('0x2c')]]={'$like':'%'+_0x244deb[_0x502b('0x37')][_0x502b('0x41')]+'%'};return _0x565ee5;}})});}_0x5e45e4=_[_0x502b('0x42')]({},_0x5e45e4,_0x244deb[_0x502b('0x44')]);var _0x28c99b={'where':_0x5e45e4[_0x502b('0x40')]};return db[_0x502b('0x30')]['count'](_0x28c99b)[_0x502b('0x26')](function(_0x2e1a73){_0x53ac15[_0x502b('0x21')]=_0x2e1a73;if(_0x244deb[_0x502b('0x37')]['includeAll']){_0x5e45e4['include']=[{'all':!![]}];}return db[_0x502b('0x30')]['findAll'](_0x5e45e4);})['then'](function(_0x52ee17){_0x53ac15[_0x502b('0x45')]=_0x52ee17;return _0x53ac15;})[_0x502b('0x26')](respondWithFilteredResult(_0x5bece9,_0x5e45e4))[_0x502b('0x46')](handleError(_0x5bece9,null));};exports['show']=function(_0x514bc1,_0x477941){var _0x4232a5={'raw':!![],'where':{'id':_0x514bc1[_0x502b('0x47')]['id']}},_0x299d3d={};_0x299d3d[_0x502b('0x34')]=_['keys'](db[_0x502b('0x30')]['rawAttributes']);_0x299d3d[_0x502b('0x37')]=_[_0x502b('0x35')](_0x514bc1[_0x502b('0x37')]);_0x299d3d['filters']=_[_0x502b('0x38')](_0x299d3d[_0x502b('0x34')],_0x299d3d[_0x502b('0x37')]);_0x4232a5['attributes']=_['intersection'](_0x299d3d[_0x502b('0x34')],qs[_0x502b('0x39')](_0x514bc1[_0x502b('0x37')][_0x502b('0x39')]));_0x4232a5[_0x502b('0x3a')]=_0x4232a5[_0x502b('0x3a')][_0x502b('0x48')]?_0x4232a5[_0x502b('0x3a')]:_0x299d3d[_0x502b('0x34')];if(_0x514bc1[_0x502b('0x37')][_0x502b('0x49')]){_0x4232a5[_0x502b('0x4a')]=[{'all':!![]}];}_0x4232a5=_[_0x502b('0x42')]({},_0x4232a5,_0x514bc1[_0x502b('0x44')]);return db['CmContactHasItem']['find'](_0x4232a5)[_0x502b('0x26')](handleEntityNotFound(_0x477941,null))[_0x502b('0x26')](respondWithResult(_0x477941,null))['catch'](handleError(_0x477941,null));};exports[_0x502b('0x4b')]=function(_0x29e279,_0x1f17c7){return db[_0x502b('0x30')]['create'](_0x29e279[_0x502b('0x4c')],{})[_0x502b('0x26')](function(_0x332816){var _0x82d08b=_0x29e279[_0x502b('0x4d')][_0x502b('0x4e')]({'plain':!![]});if(!_0x82d08b)throw new Error(_0x502b('0x4f'));if(_0x82d08b[_0x502b('0x50')]===_0x502b('0x4d')){var _0x36c17f=_0x332816[_0x502b('0x4e')]({'plain':!![]});var _0x4a4253='CmContactHasItems';return db[_0x502b('0x51')][_0x502b('0x52')]({'where':{'name':_0x4a4253,'userProfileId':_0x82d08b['userProfileId']},'raw':!![]})[_0x502b('0x26')](function(_0x40db5d){if(_0x40db5d&&_0x40db5d['autoAssociation']===0x0){return db[_0x502b('0x28')][_0x502b('0x4b')]({'name':_0x36c17f[_0x502b('0x2c')],'resourceId':_0x36c17f['id'],'type':_0x40db5d[_0x502b('0x2c')],'sectionId':_0x40db5d['id']},{})[_0x502b('0x26')](function(){return _0x332816;});}else{return _0x332816;}})[_0x502b('0x46')](function(_0x4f5611){logger[_0x502b('0x2a')](_0x502b('0x53'),_0x4f5611);throw _0x4f5611;});}return _0x332816;})['then'](respondWithResult(_0x1f17c7,0xc9))[_0x502b('0x46')](handleError(_0x1f17c7,null));};exports[_0x502b('0x25')]=function(_0x19ca41,_0x51dcf3){if(_0x19ca41['body']['id']){delete _0x19ca41['body']['id'];}return db[_0x502b('0x30')][_0x502b('0x52')]({'where':{'id':_0x19ca41['params']['id']}})['then'](handleEntityNotFound(_0x51dcf3,null))[_0x502b('0x26')](saveUpdates(_0x19ca41[_0x502b('0x4c')],null))['then'](respondWithResult(_0x51dcf3,null))[_0x502b('0x46')](handleError(_0x51dcf3,null));};exports[_0x502b('0x29')]=function(_0x40e455,_0x53b9c8){return db['CmContactHasItem']['find']({'where':{'id':_0x40e455[_0x502b('0x47')]['id']}})[_0x502b('0x26')](handleEntityNotFound(_0x53b9c8,null))[_0x502b('0x26')](removeEntity(_0x53b9c8,null))[_0x502b('0x46')](handleError(_0x53b9c8,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 644bd7a..0c8afac 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 _0xbcd6=['define','cm_contact_has_items','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xbcd6,0x70));var _0x6bcd=function(_0xeebc72,_0x38d608){_0xeebc72=_0xeebc72-0x0;var _0x4d6857=_0xbcd6[_0xeebc72];return _0x4d6857;};'use strict';var _=require('lodash');var util=require(_0x6bcd('0x0'));var logger=require(_0x6bcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6bcd('0x2'));var rp=require(_0x6bcd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bcd('0x4'));var config=require(_0x6bcd('0x5'));var attributes=require(_0x6bcd('0x6'));module[_0x6bcd('0x7')]=function(_0x37a995,_0x181d82){return _0x37a995[_0x6bcd('0x8')]('CmContactHasItem',attributes,{'tableName':_0x6bcd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2817=['../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x2817,0x149));var _0x7281=function(_0x3c3dbf,_0x212c58){_0x3c3dbf=_0x3c3dbf-0x0;var _0xe989d1=_0x2817[_0x3c3dbf];return _0xe989d1;};'use strict';var _=require(_0x7281('0x0'));var util=require(_0x7281('0x1'));var logger=require(_0x7281('0x2'))(_0x7281('0x3'));var moment=require('moment');var BPromise=require(_0x7281('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7281('0x5'));var rimraf=require(_0x7281('0x6'));var config=require(_0x7281('0x7'));var attributes=require(_0x7281('0x8'));module[_0x7281('0x9')]=function(_0x22bdbf,_0x33790c){return _0x22bdbf[_0x7281('0xa')](_0x7281('0xb'),attributes,{'tableName':'cm_contact_has_items','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 c068736..f017dd1 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 _0x850b=['debug','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x850b,0x84));var _0xb850=function(_0x19c64d,_0x5882d8){_0x19c64d=_0x19c64d-0x0;var _0x38430d=_0x850b[_0x19c64d];return _0x38430d;};'use strict';var _=require(_0xb850('0x0'));var util=require(_0xb850('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb850('0x2'));var fs=require('fs');var Redis=require(_0xb850('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb850('0x4'));var logger=require(_0xb850('0x5'))(_0xb850('0x6'));var config=require(_0xb850('0x7'));var jayson=require(_0xb850('0x8'));var client=jayson[_0xb850('0x9')][_0xb850('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce374,_0x5dca0d,_0x427be1){return new BPromise(function(_0x171d76,_0xffa52){return client[_0xb850('0xb')](_0x1ce374,_0x427be1)[_0xb850('0xc')](function(_0x4d588f){logger[_0xb850('0xd')](_0xb850('0xe'),_0x5dca0d,'request\x20sent');logger[_0xb850('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5dca0d,_0xb850('0x10'),JSON[_0xb850('0x11')](_0x4d588f));if(_0x4d588f[_0xb850('0x12')]){if(_0x4d588f[_0xb850('0x12')]['code']===0x1f4){logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);return _0xffa52(_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);}logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0x4d588f[_0xb850('0x12')][_0xb850('0x13')]);return _0x171d76(_0x4d588f['error'][_0xb850('0x13')]);}else{logger['info'](_0xb850('0xe'),_0x5dca0d,_0xb850('0x10'));_0x171d76(_0x4d588f['result'][_0xb850('0x13')]);}})[_0xb850('0x14')](function(_0xe339b4){logger[_0xb850('0x12')](_0xb850('0xe'),_0x5dca0d,_0xe339b4);_0xffa52(_0xe339b4);});});} \ No newline at end of file +var _0x07ec=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x07ec,0x69));var _0xc07e=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0x07ec[_0x4b4277];return _0x1ff405;};'use strict';var _=require(_0xc07e('0x0'));var util=require(_0xc07e('0x1'));var moment=require(_0xc07e('0x2'));var BPromise=require(_0xc07e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc07e('0x4'));var db=require(_0xc07e('0x5'))['db'];var utils=require(_0xc07e('0x6'));var logger=require(_0xc07e('0x7'))('rpc');var config=require(_0xc07e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc07e('0x9')][_0xc07e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6adf9,_0x93a86c,_0x4019a2){return new BPromise(function(_0x35c615,_0x3383f5){return client['request'](_0x6adf9,_0x4019a2)[_0xc07e('0xb')](function(_0xafa3b2){logger[_0xc07e('0xc')](_0xc07e('0xd'),_0x93a86c,_0xc07e('0xe'));logger['debug'](_0xc07e('0xf'),_0x93a86c,'request\x20sent',JSON[_0xc07e('0x10')](_0xafa3b2));if(_0xafa3b2[_0xc07e('0x11')]){if(_0xafa3b2[_0xc07e('0x11')]['code']===0x1f4){logger[_0xc07e('0x11')](_0xc07e('0xd'),_0x93a86c,_0xafa3b2[_0xc07e('0x11')][_0xc07e('0x12')]);return _0x3383f5(_0xafa3b2[_0xc07e('0x11')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x93a86c,_0xafa3b2[_0xc07e('0x11')]['message']);return _0x35c615(_0xafa3b2['error'][_0xc07e('0x12')]);}else{logger[_0xc07e('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x93a86c,_0xc07e('0xe'));_0x35c615(_0xafa3b2['result'][_0xc07e('0x12')]);}})[_0xc07e('0x13')](function(_0x5e6514){logger[_0xc07e('0x11')](_0xc07e('0xd'),_0x93a86c,_0x5e6514);_0x3383f5(_0x5e6514);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5f4638d..7e93964 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 _0xd4ca=['update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x33d73d,_0x33a4ab){var _0x1d8fd0=function(_0xec3916){while(--_0xec3916){_0x33d73d['push'](_0x33d73d['shift']());}};_0x1d8fd0(++_0x33a4ab);}(_0xd4ca,0x19b));var _0xad4c=function(_0x3dd1f7,_0x141a06){_0x3dd1f7=_0x3dd1f7-0x0;var _0x2c8493=_0xd4ca[_0x3dd1f7];return _0x2c8493;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xad4c('0x0'));var express=require(_0xad4c('0x1'));var router=express[_0xad4c('0x2')]();var fs_extra=require(_0xad4c('0x3'));var auth=require(_0xad4c('0x4'));var interaction=require(_0xad4c('0x5'));var config=require(_0xad4c('0x6'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0xad4c('0x7')](),controller[_0xad4c('0x8')]);router[_0xad4c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad4c('0xa')]);router['post']('/',auth[_0xad4c('0x7')](),controller[_0xad4c('0xb')]);router[_0xad4c('0xc')](_0xad4c('0xd'),auth[_0xad4c('0x7')](),controller[_0xad4c('0xe')]);router[_0xad4c('0xf')](_0xad4c('0xd'),auth[_0xad4c('0x7')](),controller['destroy']);module[_0xad4c('0x10')]=router; \ No newline at end of file +var _0x319e=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','post','create'];(function(_0x542d6b,_0x1615bd){var _0x22d616=function(_0x1db71f){while(--_0x1db71f){_0x542d6b['push'](_0x542d6b['shift']());}};_0x22d616(++_0x1615bd);}(_0x319e,0x124));var _0xe319=function(_0x3bd9bc,_0x245c33){_0x3bd9bc=_0x3bd9bc-0x0;var _0x569ed8=_0x319e[_0x3bd9bc];return _0x569ed8;};'use strict';var multer=require('multer');var util=require(_0xe319('0x0'));var path=require(_0xe319('0x1'));var timeout=require(_0xe319('0x2'));var express=require(_0xe319('0x3'));var router=express[_0xe319('0x4')]();var fs_extra=require(_0xe319('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe319('0x6'));var config=require(_0xe319('0x7'));var controller=require(_0xe319('0x8'));router[_0xe319('0x9')]('/',auth[_0xe319('0xa')](),controller['index']);router[_0xe319('0x9')](_0xe319('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe319('0xc')]('/',auth[_0xe319('0xa')](),controller[_0xe319('0xd')]);router['put'](_0xe319('0xb'),auth['isAuthenticated'](),controller[_0xe319('0xe')]);router[_0xe319('0xf')](_0xe319('0xb'),auth[_0xe319('0xa')](),controller['destroy']);module[_0xe319('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 6695eaf..99a982c 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 _0x4c79=['values','isArray','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse'];(function(_0x12a758,_0x471242){var _0x2b709a=function(_0x5eb311){while(--_0x5eb311){_0x12a758['push'](_0x12a758['shift']());}};_0x2b709a(++_0x471242);}(_0x4c79,0x174));var _0x94c7=function(_0x494e72,_0x5f1178){_0x494e72=_0x494e72-0x0;var _0x2d3947=_0x4c79[_0x494e72];return _0x2d3947;};'use strict';var Sequelize=require(_0x94c7('0x0'));var _=require(_0x94c7('0x1'));module['exports']={'name':{'type':Sequelize[_0x94c7('0x2')],'get':function(_0x5997a0){return this[_0x94c7('0x3')](_0x94c7('0x4'));}},'alias':{'type':Sequelize[_0x94c7('0x5')],'allowNull':![],'set':function(_0x414606){this[_0x94c7('0x6')](_0x94c7('0x4'),_0x414606?_0x414606:this['getDataValue'](_0x94c7('0x7')));}},'type':{'type':Sequelize[_0x94c7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x94c7('0x8')](_0x94c7('0x9')),'get':function(){if(this[_0x94c7('0x3')]('type')===_0x94c7('0xa')){return JSON[_0x94c7('0xb')](this[_0x94c7('0x3')](_0x94c7('0xc')));}else{return this[_0x94c7('0x3')]('values');}},'set':function(_0x164df6){if(Array[_0x94c7('0xd')](_0x164df6)){this[_0x94c7('0x6')](_0x94c7('0xc'),JSON['stringify'](_0x164df6));}else{this[_0x94c7('0x6')](_0x94c7('0xc'),_0x164df6);}}},'required':{'type':Sequelize[_0x94c7('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x94c7('0xf')]('voice')}}; \ No newline at end of file +var _0xc27b=['BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify'];(function(_0xf7b425,_0x4e8416){var _0x2a16ba=function(_0x3a600b){while(--_0x3a600b){_0xf7b425['push'](_0xf7b425['shift']());}};_0x2a16ba(++_0x4e8416);}(_0xc27b,0xbc));var _0xbc27=function(_0x13ad11,_0x42e3ce){_0x13ad11=_0x13ad11-0x0;var _0x43eebc=_0xc27b[_0x13ad11];return _0x43eebc;};'use strict';var Sequelize=require('sequelize');var _=require(_0xbc27('0x0'));module[_0xbc27('0x1')]={'name':{'type':Sequelize[_0xbc27('0x2')],'get':function(_0x29f7d4){return this[_0xbc27('0x3')](_0xbc27('0x4'));}},'alias':{'type':Sequelize[_0xbc27('0x5')],'allowNull':![],'set':function(_0x98dbb0){this[_0xbc27('0x6')](_0xbc27('0x4'),_0x98dbb0?_0x98dbb0:this[_0xbc27('0x3')](_0xbc27('0x7')));}},'type':{'type':Sequelize[_0xbc27('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xbc27('0x8')](_0xbc27('0x9')),'get':function(){if(this['getDataValue'](_0xbc27('0xa'))===_0xbc27('0xb')){return JSON[_0xbc27('0xc')](this[_0xbc27('0x3')]('values'));}else{return this[_0xbc27('0x3')](_0xbc27('0xd'));}},'set':function(_0x30d5b8){if(Array[_0xbc27('0xe')](_0x30d5b8)){this['setDataValue']('values',JSON[_0xbc27('0xf')](_0x30d5b8));}else{this[_0xbc27('0x6')](_0xbc27('0xd'),_0x30d5b8);}}},'required':{'type':Sequelize[_0xbc27('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xbc27('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6cd2a58..cc65db5 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 _0x86a1=['ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','differenceBy','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','body','sequelize','transaction','TEXT','number','Sequelize','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x2ac1de,_0x5c3667){var _0x2e7b43=function(_0x3afbc5){while(--_0x3afbc5){_0x2ac1de['push'](_0x2ac1de['shift']());}};_0x2e7b43(++_0x5c3667);}(_0x86a1,0x15e));var _0x186a=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x86a1[_0x587ba2];return _0x50ec73;};'use strict';var emlformat=require(_0x186a('0x0'));var rimraf=require(_0x186a('0x1'));var zipdir=require(_0x186a('0x2'));var jsonpatch=require(_0x186a('0x3'));var rp=require(_0x186a('0x4'));var moment=require(_0x186a('0x5'));var BPromise=require(_0x186a('0x6'));var Mustache=require(_0x186a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x186a('0x8'));var csv=require(_0x186a('0x9'));var ejs=require(_0x186a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x186a('0xb'));var squel=require(_0x186a('0xc'));var crypto=require('crypto');var jsforce=require(_0x186a('0xd'));var deskjs=require(_0x186a('0xe'));var toCsv=require(_0x186a('0x9'));var querystring=require('querystring');var Papa=require(_0x186a('0xf'));var Redis=require(_0x186a('0x10'));var authService=require(_0x186a('0x11'));var qs=require(_0x186a('0x12'));var as=require(_0x186a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x186a('0x14'))(_0x186a('0x15'));var utils=require(_0x186a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x186a('0x17'));var db=require(_0x186a('0x18'))['db'];function respondWithStatusCode(_0x259827,_0x22afce){_0x22afce=_0x22afce||0xcc;return function(_0x535858){if(_0x535858){return _0x259827['sendStatus'](_0x22afce);}return _0x259827['status'](_0x22afce)[_0x186a('0x19')]();};}function respondWithResult(_0x62be28,_0x74cfd4){_0x74cfd4=_0x74cfd4||0xc8;return function(_0x579c2e){if(_0x579c2e){return _0x62be28[_0x186a('0x1a')](_0x74cfd4)[_0x186a('0x1b')](_0x579c2e);}};}function respondWithFilteredResult(_0x253e56,_0x429779){return function(_0x8dfcb3){if(_0x8dfcb3){var _0xf26a47=typeof _0x429779[_0x186a('0x1c')]===_0x186a('0x1d')&&typeof _0x429779[_0x186a('0x1e')]==='undefined';var _0x20d960=_0x8dfcb3['count'];var _0x31bce8=_0xf26a47?0x0:_0x429779['offset'];var _0x49f598=_0xf26a47?_0x8dfcb3['count']:_0x429779['offset']+_0x429779['limit'];var _0x520794;if(_0x49f598>=_0x20d960){_0x49f598=_0x20d960;_0x520794=0xc8;}else{_0x520794=0xce;}_0x253e56['status'](_0x520794);return _0x253e56[_0x186a('0x1f')](_0x186a('0x20'),_0x31bce8+'-'+_0x49f598+'/'+_0x20d960)[_0x186a('0x1b')](_0x8dfcb3);}return null;};}function patchUpdates(_0x49871f){return function(_0x258d15){try{jsonpatch[_0x186a('0x21')](_0x258d15,_0x49871f,!![]);}catch(_0xd58868){return BPromise[_0x186a('0x22')](_0xd58868);}return _0x258d15[_0x186a('0x23')]();};}function saveUpdates(_0x12d80d,_0x5c660d){return function(_0x26ce57){if(_0x26ce57){return _0x26ce57[_0x186a('0x24')](_0x12d80d)['then'](function(_0xc07068){return _0xc07068;});}return null;};}function removeEntity(_0x11e1e1,_0x4c06c8){return function(_0x57a57f){if(_0x57a57f){return _0x57a57f[_0x186a('0x25')]()[_0x186a('0x26')](function(){_0x11e1e1[_0x186a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d6c8,_0x41113d){return function(_0x135fab){if(!_0x135fab){_0x11d6c8[_0x186a('0x27')](0x194);}return _0x135fab;};}function handleError(_0x7bcc26,_0x259d08){_0x259d08=_0x259d08||0x1f4;return function(_0x20e729){logger[_0x186a('0x28')](_0x20e729[_0x186a('0x29')]);if(_0x20e729['name']){delete _0x20e729[_0x186a('0x2a')];}_0x7bcc26[_0x186a('0x1a')](_0x259d08)[_0x186a('0x2b')](_0x20e729);};}exports[_0x186a('0x2c')]=function(_0x146b4a,_0x267206){var _0x79835b={},_0x10ef69={},_0x550396={'count':0x0,'rows':[]};var _0x1053bb=_[_0x186a('0x2d')](db[_0x186a('0x2e')]['rawAttributes'],function(_0x2056c4){return{'name':_0x2056c4[_0x186a('0x2f')],'type':_0x2056c4[_0x186a('0x30')][_0x186a('0x31')]};});_0x10ef69['model']=_[_0x186a('0x32')](_[_0x186a('0x2d')](_0x1053bb,_0x186a('0x2a')),['name']);_0x10ef69[_0x186a('0x33')]=_['keys'](_0x146b4a[_0x186a('0x33')]);_0x10ef69['filters']=_[_0x186a('0x34')](_0x10ef69[_0x186a('0x35')],_0x10ef69[_0x186a('0x33')]);_0x79835b[_0x186a('0x36')]=_[_0x186a('0x34')](_0x10ef69[_0x186a('0x35')],qs[_0x186a('0x37')](_0x146b4a[_0x186a('0x33')]['fields']));_0x79835b[_0x186a('0x36')]=_0x79835b[_0x186a('0x36')]['length']?_0x79835b['attributes']:_0x10ef69[_0x186a('0x35')];if(!_0x146b4a[_0x186a('0x33')][_0x186a('0x38')](_0x186a('0x39'))){_0x79835b[_0x186a('0x1e')]=qs[_0x186a('0x1e')](_0x146b4a[_0x186a('0x33')][_0x186a('0x1e')]);_0x79835b[_0x186a('0x1c')]=qs[_0x186a('0x1c')](_0x146b4a[_0x186a('0x33')][_0x186a('0x1c')]);}_0x79835b[_0x186a('0x3a')]=qs[_0x186a('0x3b')](_0x146b4a[_0x186a('0x33')][_0x186a('0x3b')]);_0x79835b[_0x186a('0x3c')]=qs[_0x186a('0x3d')](_[_0x186a('0x3e')](_0x146b4a[_0x186a('0x33')],_0x10ef69[_0x186a('0x3d')]),_0x1053bb);if(_0x146b4a[_0x186a('0x33')][_0x186a('0x3f')]){_0x79835b[_0x186a('0x3c')]=_[_0x186a('0x40')](_0x79835b[_0x186a('0x3c')],{'$or':_[_0x186a('0x2d')](_0x1053bb,function(_0x2210e6){if(_0x2210e6[_0x186a('0x30')]!==_0x186a('0x41')){var _0x2c0e9c={};_0x2c0e9c[_0x2210e6[_0x186a('0x2a')]]={'$like':'%'+_0x146b4a[_0x186a('0x33')][_0x186a('0x3f')]+'%'};return _0x2c0e9c;}})});}_0x79835b=_[_0x186a('0x40')]({},_0x79835b,_0x146b4a[_0x186a('0x42')]);var _0xdaf15c={'where':_0x79835b['where']};return db[_0x186a('0x2e')]['count'](_0xdaf15c)[_0x186a('0x26')](function(_0x3a0f43){_0x550396[_0x186a('0x43')]=_0x3a0f43;if(_0x146b4a[_0x186a('0x33')]['includeAll']){_0x79835b['include']=[{'all':!![]}];}return db[_0x186a('0x2e')][_0x186a('0x44')](_0x79835b);})[_0x186a('0x26')](function(_0x47eca0){_0x550396[_0x186a('0x45')]=_0x47eca0;return _0x550396;})['then'](respondWithFilteredResult(_0x267206,_0x79835b))[_0x186a('0x46')](handleError(_0x267206,null));};exports[_0x186a('0x47')]=function(_0x158dc6,_0x5de12d){var _0x171f46={'raw':!![],'where':{'id':_0x158dc6[_0x186a('0x48')]['id']}},_0x513543={};_0x513543[_0x186a('0x35')]=_[_0x186a('0x49')](db[_0x186a('0x2e')][_0x186a('0x4a')]);_0x513543[_0x186a('0x33')]=_[_0x186a('0x49')](_0x158dc6['query']);_0x513543[_0x186a('0x3d')]=_[_0x186a('0x34')](_0x513543[_0x186a('0x35')],_0x513543['query']);_0x171f46[_0x186a('0x36')]=_[_0x186a('0x34')](_0x513543[_0x186a('0x35')],qs['fields'](_0x158dc6[_0x186a('0x33')][_0x186a('0x37')]));_0x171f46[_0x186a('0x36')]=_0x171f46[_0x186a('0x36')][_0x186a('0x4b')]?_0x171f46[_0x186a('0x36')]:_0x513543[_0x186a('0x35')];if(_0x158dc6[_0x186a('0x33')][_0x186a('0x4c')]){_0x171f46['include']=[{'all':!![]}];}_0x171f46=_[_0x186a('0x40')]({},_0x171f46,_0x158dc6[_0x186a('0x42')]);return db[_0x186a('0x2e')][_0x186a('0x4d')](_0x171f46)[_0x186a('0x26')](handleEntityNotFound(_0x5de12d,null))['then'](respondWithResult(_0x5de12d,null))['catch'](handleError(_0x5de12d,null));};exports[_0x186a('0x24')]=function(_0x1f37a2,_0x5d8319){if(_0x1f37a2['body']['id']){delete _0x1f37a2[_0x186a('0x4e')]['id'];}return db['CmCustomField'][_0x186a('0x4d')]({'where':{'id':_0x1f37a2[_0x186a('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d8319,null))[_0x186a('0x26')](saveUpdates(_0x1f37a2['body'],null))[_0x186a('0x26')](respondWithResult(_0x5d8319,null))['catch'](handleError(_0x5d8319,null));};exports[_0x186a('0x25')]=function(_0x202ceb,_0x49232f){return db[_0x186a('0x2e')][_0x186a('0x4d')]({'where':{'id':_0x202ceb[_0x186a('0x48')]['id']}})[_0x186a('0x26')](handleEntityNotFound(_0x49232f,null))[_0x186a('0x26')](removeEntity(_0x49232f,null))[_0x186a('0x46')](handleError(_0x49232f,null));};exports['create']=function(_0x4a8ed0,_0x27311a){var _0x75f20a;return db[_0x186a('0x4f')][_0x186a('0x50')](function(_0x4895a3){return db['CmCustomField']['create'](_0x4a8ed0[_0x186a('0x4e')],{'transaction':_0x4895a3})[_0x186a('0x26')](function(_0x25c0fa){_0x75f20a=_0x25c0fa;var _0xcbd95b={'type':db['Sequelize'][_0x186a('0x51')],'transaction':_0x4895a3};switch(_0x4a8ed0[_0x186a('0x4e')][_0x186a('0x30')]){case'text':_0xcbd95b[_0x186a('0x30')]=db['Sequelize']['TEXT'];break;case _0x186a('0x52'):_0xcbd95b[_0x186a('0x30')]=db[_0x186a('0x53')]['INTEGER'];break;case _0x186a('0x54'):_0xcbd95b[_0x186a('0x30')]=db[_0x186a('0x53')][_0x186a('0x55')];_0xcbd95b['defaultValue']=![];break;default:}return db[_0x186a('0x4f')][_0x186a('0x56')][_0x186a('0x57')]('cm_contacts',util[_0x186a('0x58')](_0x186a('0x59'),_0x75f20a['id']),_0xcbd95b);})[_0x186a('0x26')](function(){return _0x75f20a;});})['then'](respondWithResult(_0x27311a,0xc9))[_0x186a('0x46')](handleError(_0x27311a,null));}; \ No newline at end of file +var _0xc0e1=['catch','show','params','find','body','sequelize','transaction','create','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','CmCustomField','includeAll','include','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0e1,0x6a));var _0x1c0e=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xc0e1[_0x5f49c0];return _0x5ab653;};'use strict';var emlformat=require(_0x1c0e('0x0'));var rimraf=require(_0x1c0e('0x1'));var zipdir=require(_0x1c0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1c0e('0x3'));var Mustache=require(_0x1c0e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1c0e('0x5'));var csv=require(_0x1c0e('0x6'));var ejs=require(_0x1c0e('0x7'));var fs=require('fs');var fs_extra=require(_0x1c0e('0x8'));var _=require(_0x1c0e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1c0e('0xa'));var toCsv=require(_0x1c0e('0x6'));var querystring=require(_0x1c0e('0xb'));var Papa=require(_0x1c0e('0xc'));var Redis=require('ioredis');var authService=require(_0x1c0e('0xd'));var qs=require(_0x1c0e('0xe'));var as=require(_0x1c0e('0xf'));var hardwareService=require(_0x1c0e('0x10'));var logger=require(_0x1c0e('0x11'))(_0x1c0e('0x12'));var utils=require(_0x1c0e('0x13'));var config=require(_0x1c0e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5399ad,_0x26d2f2){_0x26d2f2=_0x26d2f2||0xcc;return function(_0xb41d20){if(_0xb41d20){return _0x5399ad[_0x1c0e('0x15')](_0x26d2f2);}return _0x5399ad[_0x1c0e('0x16')](_0x26d2f2)[_0x1c0e('0x17')]();};}function respondWithResult(_0x516b04,_0x156a95){_0x156a95=_0x156a95||0xc8;return function(_0x36c510){if(_0x36c510){return _0x516b04[_0x1c0e('0x16')](_0x156a95)['json'](_0x36c510);}};}function respondWithFilteredResult(_0x4910d1,_0x42ef2f){return function(_0x3c4be1){if(_0x3c4be1){var _0x5779f8=typeof _0x42ef2f[_0x1c0e('0x18')]==='undefined'&&typeof _0x42ef2f[_0x1c0e('0x19')]===_0x1c0e('0x1a');var _0x235160=_0x3c4be1['count'];var _0x304870=_0x5779f8?0x0:_0x42ef2f[_0x1c0e('0x18')];var _0x119c2e=_0x5779f8?_0x3c4be1[_0x1c0e('0x1b')]:_0x42ef2f[_0x1c0e('0x18')]+_0x42ef2f[_0x1c0e('0x19')];var _0x23151f;if(_0x119c2e>=_0x235160){_0x119c2e=_0x235160;_0x23151f=0xc8;}else{_0x23151f=0xce;}_0x4910d1['status'](_0x23151f);return _0x4910d1[_0x1c0e('0x1c')]('Content-Range',_0x304870+'-'+_0x119c2e+'/'+_0x235160)[_0x1c0e('0x1d')](_0x3c4be1);}return null;};}function patchUpdates(_0x4c690a){return function(_0x57ff93){try{jsonpatch[_0x1c0e('0x1e')](_0x57ff93,_0x4c690a,!![]);}catch(_0x232950){return BPromise['reject'](_0x232950);}return _0x57ff93[_0x1c0e('0x1f')]();};}function saveUpdates(_0x36aad2,_0x56cf9a){return function(_0x2b5c5f){if(_0x2b5c5f){return _0x2b5c5f[_0x1c0e('0x20')](_0x36aad2)['then'](function(_0x2fe2d0){return _0x2fe2d0;});}return null;};}function removeEntity(_0x4016ca,_0x298dac){return function(_0x298e43){if(_0x298e43){return _0x298e43[_0x1c0e('0x21')]()[_0x1c0e('0x22')](function(){_0x4016ca[_0x1c0e('0x16')](0xcc)[_0x1c0e('0x17')]();});}};}function handleEntityNotFound(_0x5d9f1c,_0x3c19ec){return function(_0x28ff28){if(!_0x28ff28){_0x5d9f1c[_0x1c0e('0x15')](0x194);}return _0x28ff28;};}function handleError(_0x4151fe,_0x1cddfe){_0x1cddfe=_0x1cddfe||0x1f4;return function(_0x476751){logger[_0x1c0e('0x23')](_0x476751[_0x1c0e('0x24')]);if(_0x476751['name']){delete _0x476751[_0x1c0e('0x25')];}_0x4151fe[_0x1c0e('0x16')](_0x1cddfe)[_0x1c0e('0x26')](_0x476751);};}exports[_0x1c0e('0x27')]=function(_0x27fc1f,_0x57304b){var _0x49d4bc={},_0x37bd9a={},_0x13f6f1={'count':0x0,'rows':[]};var _0x79c303=_[_0x1c0e('0x28')](db['CmCustomField'][_0x1c0e('0x29')],function(_0x16b280){return{'name':_0x16b280[_0x1c0e('0x2a')],'type':_0x16b280[_0x1c0e('0x2b')][_0x1c0e('0x2c')]};});_0x37bd9a[_0x1c0e('0x2d')]=_[_0x1c0e('0x2e')](_[_0x1c0e('0x28')](_0x79c303,_0x1c0e('0x25')),[_0x1c0e('0x25')]);_0x37bd9a[_0x1c0e('0x2f')]=_[_0x1c0e('0x30')](_0x27fc1f[_0x1c0e('0x2f')]);_0x37bd9a[_0x1c0e('0x31')]=_[_0x1c0e('0x32')](_0x37bd9a['model'],_0x37bd9a[_0x1c0e('0x2f')]);_0x49d4bc[_0x1c0e('0x33')]=_['intersection'](_0x37bd9a[_0x1c0e('0x2d')],qs[_0x1c0e('0x34')](_0x27fc1f[_0x1c0e('0x2f')]['fields']));_0x49d4bc[_0x1c0e('0x33')]=_0x49d4bc['attributes'][_0x1c0e('0x35')]?_0x49d4bc['attributes']:_0x37bd9a['model'];if(!_0x27fc1f[_0x1c0e('0x2f')][_0x1c0e('0x36')](_0x1c0e('0x37'))){_0x49d4bc[_0x1c0e('0x19')]=qs[_0x1c0e('0x19')](_0x27fc1f[_0x1c0e('0x2f')][_0x1c0e('0x19')]);_0x49d4bc['offset']=qs['offset'](_0x27fc1f['query'][_0x1c0e('0x18')]);}_0x49d4bc[_0x1c0e('0x38')]=qs['sort'](_0x27fc1f['query'][_0x1c0e('0x39')]);_0x49d4bc['where']=qs[_0x1c0e('0x31')](_[_0x1c0e('0x3a')](_0x27fc1f[_0x1c0e('0x2f')],_0x37bd9a[_0x1c0e('0x31')]),_0x79c303);if(_0x27fc1f[_0x1c0e('0x2f')]['filter']){_0x49d4bc[_0x1c0e('0x3b')]=_['merge'](_0x49d4bc[_0x1c0e('0x3b')],{'$or':_['map'](_0x79c303,function(_0x3d26ce){if(_0x3d26ce[_0x1c0e('0x2b')]!==_0x1c0e('0x3c')){var _0x4cba9e={};_0x4cba9e[_0x3d26ce['name']]={'$like':'%'+_0x27fc1f['query'][_0x1c0e('0x3d')]+'%'};return _0x4cba9e;}})});}_0x49d4bc=_[_0x1c0e('0x3e')]({},_0x49d4bc,_0x27fc1f[_0x1c0e('0x3f')]);var _0x45df6d={'where':_0x49d4bc[_0x1c0e('0x3b')]};return db[_0x1c0e('0x40')]['count'](_0x45df6d)[_0x1c0e('0x22')](function(_0x1a1aa7){_0x13f6f1[_0x1c0e('0x1b')]=_0x1a1aa7;if(_0x27fc1f[_0x1c0e('0x2f')][_0x1c0e('0x41')]){_0x49d4bc[_0x1c0e('0x42')]=[{'all':!![]}];}return db[_0x1c0e('0x40')]['findAll'](_0x49d4bc);})[_0x1c0e('0x22')](function(_0x5d4296){_0x13f6f1[_0x1c0e('0x43')]=_0x5d4296;return _0x13f6f1;})[_0x1c0e('0x22')](respondWithFilteredResult(_0x57304b,_0x49d4bc))[_0x1c0e('0x44')](handleError(_0x57304b,null));};exports[_0x1c0e('0x45')]=function(_0x2bef5c,_0x2cf709){var _0x5a32f3={'raw':!![],'where':{'id':_0x2bef5c[_0x1c0e('0x46')]['id']}},_0x334a3e={};_0x334a3e[_0x1c0e('0x2d')]=_[_0x1c0e('0x30')](db[_0x1c0e('0x40')][_0x1c0e('0x29')]);_0x334a3e[_0x1c0e('0x2f')]=_['keys'](_0x2bef5c['query']);_0x334a3e['filters']=_[_0x1c0e('0x32')](_0x334a3e['model'],_0x334a3e[_0x1c0e('0x2f')]);_0x5a32f3[_0x1c0e('0x33')]=_[_0x1c0e('0x32')](_0x334a3e[_0x1c0e('0x2d')],qs[_0x1c0e('0x34')](_0x2bef5c[_0x1c0e('0x2f')][_0x1c0e('0x34')]));_0x5a32f3[_0x1c0e('0x33')]=_0x5a32f3[_0x1c0e('0x33')][_0x1c0e('0x35')]?_0x5a32f3[_0x1c0e('0x33')]:_0x334a3e[_0x1c0e('0x2d')];if(_0x2bef5c[_0x1c0e('0x2f')][_0x1c0e('0x41')]){_0x5a32f3[_0x1c0e('0x42')]=[{'all':!![]}];}_0x5a32f3=_[_0x1c0e('0x3e')]({},_0x5a32f3,_0x2bef5c[_0x1c0e('0x3f')]);return db[_0x1c0e('0x40')][_0x1c0e('0x47')](_0x5a32f3)['then'](handleEntityNotFound(_0x2cf709,null))[_0x1c0e('0x22')](respondWithResult(_0x2cf709,null))[_0x1c0e('0x44')](handleError(_0x2cf709,null));};exports['update']=function(_0x5e5fd5,_0x485c8d){if(_0x5e5fd5[_0x1c0e('0x48')]['id']){delete _0x5e5fd5[_0x1c0e('0x48')]['id'];}return db[_0x1c0e('0x40')][_0x1c0e('0x47')]({'where':{'id':_0x5e5fd5['params']['id']}})[_0x1c0e('0x22')](handleEntityNotFound(_0x485c8d,null))[_0x1c0e('0x22')](saveUpdates(_0x5e5fd5['body'],null))[_0x1c0e('0x22')](respondWithResult(_0x485c8d,null))['catch'](handleError(_0x485c8d,null));};exports[_0x1c0e('0x21')]=function(_0x379bb3,_0x1dae30){return db[_0x1c0e('0x40')][_0x1c0e('0x47')]({'where':{'id':_0x379bb3[_0x1c0e('0x46')]['id']}})[_0x1c0e('0x22')](handleEntityNotFound(_0x1dae30,null))[_0x1c0e('0x22')](removeEntity(_0x1dae30,null))[_0x1c0e('0x44')](handleError(_0x1dae30,null));};exports['create']=function(_0x3c3a09,_0x3e99e6){var _0x2332bd;return db[_0x1c0e('0x49')][_0x1c0e('0x4a')](function(_0x3f3d82){return db['CmCustomField'][_0x1c0e('0x4b')](_0x3c3a09[_0x1c0e('0x48')],{'transaction':_0x3f3d82})['then'](function(_0x16aa30){_0x2332bd=_0x16aa30;var _0x250d1b={'type':db['Sequelize'][_0x1c0e('0x4c')],'transaction':_0x3f3d82};switch(_0x3c3a09[_0x1c0e('0x48')]['type']){case _0x1c0e('0x4d'):_0x250d1b[_0x1c0e('0x2b')]=db[_0x1c0e('0x4e')]['TEXT'];break;case _0x1c0e('0x4f'):_0x250d1b[_0x1c0e('0x2b')]=db[_0x1c0e('0x4e')][_0x1c0e('0x50')];break;case _0x1c0e('0x51'):_0x250d1b[_0x1c0e('0x2b')]=db[_0x1c0e('0x4e')]['BOOLEAN'];_0x250d1b[_0x1c0e('0x52')]=![];break;default:}return db[_0x1c0e('0x49')][_0x1c0e('0x53')][_0x1c0e('0x54')]('cm_contacts',util[_0x1c0e('0x55')](_0x1c0e('0x56'),_0x2332bd['id']),_0x250d1b);})[_0x1c0e('0x22')](function(){return _0x2332bd;});})[_0x1c0e('0x22')](respondWithResult(_0x3e99e6,0xc9))[_0x1c0e('0x44')](handleError(_0x3e99e6,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7a67225..77e16b8 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 _0x6400=['path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6400,0x118));var _0x0640=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0x6400[_0xe7a99e];return _0x3bef5c;};'use strict';var _=require(_0x0640('0x0'));var util=require(_0x0640('0x1'));var logger=require(_0x0640('0x2'))(_0x0640('0x3'));var moment=require('moment');var BPromise=require(_0x0640('0x4'));var rp=require(_0x0640('0x5'));var fs=require('fs');var path=require(_0x0640('0x6'));var rimraf=require('rimraf');var config=require(_0x0640('0x7'));var attributes=require(_0x0640('0x8'));module[_0x0640('0x9')]=function(_0x568f7d,_0x725017){return _0x568f7d[_0x0640('0xa')](_0x0640('0xb'),attributes,{'tableName':_0x0640('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de8=['../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x56a8b5,_0x1fa8bb){var _0x948fd=function(_0x495f69){while(--_0x495f69){_0x56a8b5['push'](_0x56a8b5['shift']());}};_0x948fd(++_0x1fa8bb);}(_0x1de8,0x125));var _0x81de=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x1de8[_0x4c184d];return _0x23d997;};'use strict';var _=require(_0x81de('0x0'));var util=require('util');var logger=require(_0x81de('0x1'))(_0x81de('0x2'));var moment=require(_0x81de('0x3'));var BPromise=require(_0x81de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81de('0x5'));var rimraf=require(_0x81de('0x6'));var config=require(_0x81de('0x7'));var attributes=require(_0x81de('0x8'));module[_0x81de('0x9')]=function(_0x3a3e97,_0x39b822){return _0x3a3e97[_0x81de('0xa')]('CmCustomField',attributes,{'tableName':_0x81de('0xb'),'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 f6806b0..afab365 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 _0xea95=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xea95,0x1c4));var _0x5ea9=function(_0x412033,_0xf06537){_0x412033=_0x412033-0x0;var _0x45f313=_0xea95[_0x412033];return _0x45f313;};'use strict';var _=require(_0x5ea9('0x0'));var util=require('util');var moment=require(_0x5ea9('0x1'));var BPromise=require(_0x5ea9('0x2'));var rs=require(_0x5ea9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ea9('0x4'))['db'];var utils=require(_0x5ea9('0x5'));var logger=require(_0x5ea9('0x6'))(_0x5ea9('0x7'));var config=require(_0x5ea9('0x8'));var jayson=require(_0x5ea9('0x9'));var client=jayson[_0x5ea9('0xa')][_0x5ea9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f11c5,_0x56c782,_0x167d66){return new BPromise(function(_0x21e3a4,_0x3ef146){return client[_0x5ea9('0xc')](_0x4f11c5,_0x167d66)['then'](function(_0x28185e){logger['info']('CmCustomField,\x20%s,\x20%s',_0x56c782,'request\x20sent');logger[_0x5ea9('0xd')](_0x5ea9('0xe'),_0x56c782,_0x5ea9('0xf'),JSON[_0x5ea9('0x10')](_0x28185e));if(_0x28185e[_0x5ea9('0x11')]){if(_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x12')]===0x1f4){logger[_0x5ea9('0x11')](_0x5ea9('0x13'),_0x56c782,_0x28185e['error'][_0x5ea9('0x14')]);return _0x3ef146(_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x14')]);}logger[_0x5ea9('0x11')]('CmCustomField,\x20%s,\x20%s',_0x56c782,_0x28185e[_0x5ea9('0x11')][_0x5ea9('0x14')]);return _0x21e3a4(_0x28185e[_0x5ea9('0x11')]['message']);}else{logger[_0x5ea9('0x15')](_0x5ea9('0x13'),_0x56c782,_0x5ea9('0xf'));_0x21e3a4(_0x28185e[_0x5ea9('0x16')][_0x5ea9('0x14')]);}})[_0x5ea9('0x17')](function(_0x41d259){logger[_0x5ea9('0x11')]('CmCustomField,\x20%s,\x20%s',_0x56c782,_0x41d259);_0x3ef146(_0x41d259);});});} \ No newline at end of file +var _0x59e9=['error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e56d0,_0x243be2){var _0x16c4c6=function(_0x303fe4){while(--_0x303fe4){_0x2e56d0['push'](_0x2e56d0['shift']());}};_0x16c4c6(++_0x243be2);}(_0x59e9,0x15c));var _0x959e=function(_0x175c83,_0x4b51d){_0x175c83=_0x175c83-0x0;var _0x20c4a6=_0x59e9[_0x175c83];return _0x20c4a6;};'use strict';var _=require(_0x959e('0x0'));var util=require('util');var moment=require(_0x959e('0x1'));var BPromise=require(_0x959e('0x2'));var rs=require(_0x959e('0x3'));var fs=require('fs');var Redis=require(_0x959e('0x4'));var db=require(_0x959e('0x5'))['db'];var utils=require(_0x959e('0x6'));var logger=require(_0x959e('0x7'))(_0x959e('0x8'));var config=require(_0x959e('0x9'));var jayson=require(_0x959e('0xa'));var client=jayson['client'][_0x959e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf79f3f,_0x4822d4,_0x4b3048){return new BPromise(function(_0x2fa70e,_0x164353){return client[_0x959e('0xc')](_0xf79f3f,_0x4b3048)[_0x959e('0xd')](function(_0x388e52){logger[_0x959e('0xe')](_0x959e('0xf'),_0x4822d4,_0x959e('0x10'));logger[_0x959e('0x11')](_0x959e('0x12'),_0x4822d4,'request\x20sent',JSON[_0x959e('0x13')](_0x388e52));if(_0x388e52[_0x959e('0x14')]){if(_0x388e52[_0x959e('0x14')]['code']===0x1f4){logger[_0x959e('0x14')](_0x959e('0xf'),_0x4822d4,_0x388e52['error']['message']);return _0x164353(_0x388e52[_0x959e('0x14')]['message']);}logger[_0x959e('0x14')](_0x959e('0xf'),_0x4822d4,_0x388e52[_0x959e('0x14')][_0x959e('0x15')]);return _0x2fa70e(_0x388e52['error'][_0x959e('0x15')]);}else{logger[_0x959e('0xe')](_0x959e('0xf'),_0x4822d4,_0x959e('0x10'));_0x2fa70e(_0x388e52[_0x959e('0x16')][_0x959e('0x15')]);}})['catch'](function(_0x2153d4){logger[_0x959e('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4822d4,_0x2153d4);_0x164353(_0x2153d4);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bffe4b9..893e146 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 _0x061c=['../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x061c,0xc0));var _0xc061=function(_0x1abeaf,_0x30f90f){_0x1abeaf=_0x1abeaf-0x0;var _0x247849=_0x061c[_0x1abeaf];return _0x247849;};'use strict';var multer=require(_0xc061('0x0'));var util=require(_0xc061('0x1'));var path=require(_0xc061('0x2'));var timeout=require(_0xc061('0x3'));var express=require(_0xc061('0x4'));var router=express[_0xc061('0x5')]();var fs_extra=require(_0xc061('0x6'));var auth=require(_0xc061('0x7'));var interaction=require(_0xc061('0x8'));var config=require('../../config/environment');var controller=require(_0xc061('0x9'));router['get']('/',auth[_0xc061('0xa')](),controller[_0xc061('0xb')]);router[_0xc061('0xc')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller[_0xc061('0xe')]);router[_0xc061('0xf')]('/',auth[_0xc061('0xa')](),controller[_0xc061('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc061('0x11')]);router[_0xc061('0x12')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller['destroy']);module[_0xc061('0x13')]=router; \ No newline at end of file +var _0x9fc5=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete'];(function(_0x46ca03,_0xc0639c){var _0x4fd831=function(_0x445a4c){while(--_0x445a4c){_0x46ca03['push'](_0x46ca03['shift']());}};_0x4fd831(++_0xc0639c);}(_0x9fc5,0xb6));var _0x59fc=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0x9fc5[_0x380e75];return _0x444d96;};'use strict';var multer=require('multer');var util=require(_0x59fc('0x0'));var path=require(_0x59fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x59fc('0x2'));var router=express[_0x59fc('0x3')]();var fs_extra=require(_0x59fc('0x4'));var auth=require(_0x59fc('0x5'));var interaction=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var controller=require(_0x59fc('0x8'));router[_0x59fc('0x9')]('/',auth['isAuthenticated'](),controller[_0x59fc('0xa')]);router[_0x59fc('0x9')](_0x59fc('0xb'),auth['isAuthenticated'](),controller[_0x59fc('0xc')]);router[_0x59fc('0xd')]('/',auth[_0x59fc('0xe')](),controller[_0x59fc('0xf')]);router[_0x59fc('0x10')](_0x59fc('0xb'),auth[_0x59fc('0xe')](),controller['update']);router[_0x59fc('0x11')](_0x59fc('0xb'),auth[_0x59fc('0xe')](),controller[_0x59fc('0x12')]);module[_0x59fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 09f6975..9638c34 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 _0x9b55=['exports','STRING','BOOLEAN','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0x390335,_0x36d2e3){var _0x913dec=function(_0x226cdd){while(--_0x226cdd){_0x390335['push'](_0x390335['shift']());}};_0x913dec(++_0x36d2e3);}(_0x9b55,0x14f));var _0x59b5=function(_0x2307d,_0x4e8a40){_0x2307d=_0x2307d-0x0;var _0x3a4cfd=_0x9b55[_0x2307d];return _0x3a4cfd;};'use strict';var moment=require(_0x59b5('0x0'));var Sequelize=require('sequelize');module[_0x59b5('0x1')]={'phone':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59b5('0x5')]},'priority':{'type':Sequelize[_0x59b5('0x4')](0x2)[_0x59b5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x59b5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'ListId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'UserId':{'type':Sequelize[_0x59b5('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x59b5('0x4')],'unique':_0x59b5('0x7')},'CampaignId':{'type':Sequelize[_0x59b5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x59b5('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x59b5('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x59b5('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xd4dd=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xd4dd,0xb1));var _0xdd4d=function(_0x3d23eb,_0x59362b){_0x3d23eb=_0x3d23eb-0x0;var _0x58ece8=_0xd4dd[_0x3d23eb];return _0x58ece8;};'use strict';var moment=require(_0xdd4d('0x0'));var Sequelize=require(_0xdd4d('0x1'));module['exports']={'phone':{'type':Sequelize[_0xdd4d('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xdd4d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xdd4d('0x4')],'defaultValue':moment()[_0xdd4d('0x5')](_0xdd4d('0x6'))},'countbusyretry':{'type':Sequelize[_0xdd4d('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd4d('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdd4d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd4d('0x4')]},'priority':{'type':Sequelize[_0xdd4d('0x7')](0x2)[_0xdd4d('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdd4d('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdd4d('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xdd4d('0x7')],'unique':_0xdd4d('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd4d('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdd4d('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdd4d('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xdd4d('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdd4d('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ce597a8..7385dca 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 _0x207c=['show','includeAll','create','body','find','params','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','CmCompany','CmList','List','dialActive','findOne','LOCK','Contact','Company','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','undefined','limit','count','offset','set','json','update','then','sendStatus','name','status','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$iLike','$notILike','$like','$overlap','$contains','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x23bb20,_0x3ee15d){var _0x1283af=function(_0x35c344){while(--_0x35c344){_0x23bb20['push'](_0x23bb20['shift']());}};_0x1283af(++_0x3ee15d);}(_0x207c,0x1e8));var _0xc207=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0x207c[_0x54cef6];return _0x39aacf;};'use strict';var moment=require('moment');var _=require(_0xc207('0x0'));var qs=require(_0xc207('0x1'));var logger=require(_0xc207('0x2'))(_0xc207('0x3'));var shared=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];function respondWithResult(_0x1dd107,_0x4b9daa){_0x4b9daa=_0x4b9daa||0xc8;return function(_0x38ff02){if(_0x38ff02){return _0x1dd107['status'](_0x4b9daa)['json'](_0x38ff02);}};}function respondWithFilteredResult(_0x55023e,_0xc88789){return function(_0x314561){if(_0x314561){var _0x3395e4=typeof _0xc88789['offset']===_0xc207('0x6')&&typeof _0xc88789[_0xc207('0x7')]===_0xc207('0x6');var _0x4e10e8=_0x314561[_0xc207('0x8')];var _0x817576=_0x3395e4?0x0:_0xc88789[_0xc207('0x9')];var _0x13ec41=_0x3395e4?_0x314561[_0xc207('0x8')]:_0xc88789[_0xc207('0x9')]+_0xc88789['limit'];var _0x574425;if(_0x13ec41>=_0x4e10e8){_0x13ec41=_0x4e10e8;_0x574425=0xc8;}else{_0x574425=0xce;}_0x55023e['status'](_0x574425);return _0x55023e[_0xc207('0xa')]('Content-Range',_0x817576+'-'+_0x13ec41+'/'+_0x4e10e8)[_0xc207('0xb')](_0x314561);}return null;};}function saveUpdates(_0x2782ce,_0x59d401){return function(_0x3e1108){if(_0x3e1108){return _0x3e1108[_0xc207('0xc')](_0x2782ce)[_0xc207('0xd')](function(_0x32acbf){return _0x32acbf;});}return null;};}function handleEntityNotFound(_0xe993a0,_0x51e967){return function(_0xc62672){if(!_0xc62672){_0xe993a0[_0xc207('0xe')](0x194);}return _0xc62672;};}function handleError(_0x274bbd,_0x4031ad){_0x4031ad=_0x4031ad||0x1f4;return function(_0x4ef6c4){logger['error'](_0x4ef6c4['stack']);if(_0x4ef6c4[_0xc207('0xf')]){delete _0x4ef6c4[_0xc207('0xf')];}_0x274bbd[_0xc207('0x10')](_0x4031ad)[_0xc207('0x11')](_0x4ef6c4);};}exports['index']=function(_0x1bc70c,_0x282595){var _0x217d5e={},_0x5f288e={},_0x4129b8={'count':0x0,'rows':[]};var _0x488cc0=_[_0xc207('0x12')](db[_0xc207('0x13')][_0xc207('0x14')],function(_0x461f6a){return{'name':_0x461f6a[_0xc207('0x15')],'type':_0x461f6a[_0xc207('0x16')][_0xc207('0x17')]};});_0x5f288e[_0xc207('0x18')]=_[_0xc207('0x12')](_0x488cc0,_0xc207('0xf'));_0x5f288e[_0xc207('0x19')]=_[_0xc207('0x1a')](_0x1bc70c[_0xc207('0x19')]);_0x5f288e['filters']=_[_0xc207('0x1b')](_0x5f288e['model'],_0x5f288e[_0xc207('0x19')]);_0x5f288e[_0xc207('0x1c')]=_[_0xc207('0x1d')](_0x5f288e[_0xc207('0x1c')],[_0xc207('0x1e'),_0xc207('0x1f'),_0xc207('0x20'),_0xc207('0x21'),_0xc207('0x22'),_0xc207('0x23'),_0xc207('0x24'),_0xc207('0x25'),_0xc207('0x26'),_0xc207('0x27'),_0xc207('0x28'),'$in',_0xc207('0x29'),'$like','$notLike',_0xc207('0x2a'),_0xc207('0x2b'),_0xc207('0x2c'),_0xc207('0x2d'),_0xc207('0x2e'),'$contained',_0xc207('0x2f')]);_0x217d5e[_0xc207('0x30')]=_[_0xc207('0x1b')](_0x5f288e[_0xc207('0x18')],qs[_0xc207('0x31')](_0x1bc70c[_0xc207('0x19')][_0xc207('0x31')]));_0x217d5e[_0xc207('0x30')]=_0x217d5e[_0xc207('0x30')][_0xc207('0x32')]?_0x217d5e[_0xc207('0x30')]:_0x5f288e[_0xc207('0x18')];if(!_0x1bc70c[_0xc207('0x19')]['hasOwnProperty'](_0xc207('0x33'))){_0x217d5e[_0xc207('0x7')]=qs[_0xc207('0x7')](_0x1bc70c[_0xc207('0x19')][_0xc207('0x7')]);_0x217d5e[_0xc207('0x9')]=qs['offset'](_0x1bc70c[_0xc207('0x19')][_0xc207('0x9')]);}_0x217d5e[_0xc207('0x34')]=qs[_0xc207('0x35')](_0x1bc70c['query'][_0xc207('0x35')]);_0x217d5e[_0xc207('0x36')]=qs[_0xc207('0x1c')](_[_0xc207('0x37')](_0x1bc70c[_0xc207('0x19')],_0x5f288e[_0xc207('0x1c')]),_0x488cc0);if(_0x1bc70c[_0xc207('0x19')][_0xc207('0x38')]){_0x217d5e[_0xc207('0x36')]=_['merge'](_0x217d5e['where'],{'$or':_[_0xc207('0x12')](_0x488cc0,function(_0x2a9701){if(_0x2a9701[_0xc207('0x16')]!==_0xc207('0x39')){var _0x591a7f={};_0x591a7f[_0x2a9701[_0xc207('0xf')]]={'$like':'%'+_0x1bc70c[_0xc207('0x19')][_0xc207('0x38')]+'%'};return _0x591a7f;}})});}_0x217d5e=_[_0xc207('0x3a')]({},_0x217d5e,_0x1bc70c[_0xc207('0x3b')]);var _0x5e3177={'where':_0x217d5e[_0xc207('0x36')]};return db[_0xc207('0x13')]['count'](_0x5e3177)[_0xc207('0xd')](function(_0x49bada){_0x4129b8[_0xc207('0x8')]=_0x49bada;if(_0x1bc70c[_0xc207('0x19')]['includeAll']){_0x217d5e[_0xc207('0x3c')]=[{'all':!![]}];}return db[_0xc207('0x13')][_0xc207('0x3d')](_0x217d5e);})['then'](function(_0x5b3041){_0x4129b8[_0xc207('0x3e')]=_0x5b3041;return _0x4129b8;})[_0xc207('0xd')](respondWithFilteredResult(_0x282595,_0x217d5e))[_0xc207('0x3f')](handleError(_0x282595,null));};exports[_0xc207('0x40')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4={'raw':!![],'where':{'id':_0x4c3e29['params']['id']}},_0x4cce4f={};_0x4cce4f['model']=_[_0xc207('0x1a')](db[_0xc207('0x13')][_0xc207('0x14')]);_0x4cce4f['query']=_[_0xc207('0x1a')](_0x4c3e29[_0xc207('0x19')]);_0x4cce4f[_0xc207('0x1c')]=_[_0xc207('0x1b')](_0x4cce4f['model'],_0x4cce4f[_0xc207('0x19')]);_0x47cdc4[_0xc207('0x30')]=_[_0xc207('0x1b')](_0x4cce4f[_0xc207('0x18')],qs[_0xc207('0x31')](_0x4c3e29['query'][_0xc207('0x31')]));_0x47cdc4[_0xc207('0x30')]=_0x47cdc4[_0xc207('0x30')][_0xc207('0x32')]?_0x47cdc4[_0xc207('0x30')]:_0x4cce4f[_0xc207('0x18')];if(_0x4c3e29[_0xc207('0x19')][_0xc207('0x41')]){_0x47cdc4[_0xc207('0x3c')]=[{'all':!![]}];}_0x47cdc4=_['merge']({},_0x47cdc4,_0x4c3e29[_0xc207('0x3b')]);return db[_0xc207('0x13')]['find'](_0x47cdc4)[_0xc207('0xd')](handleEntityNotFound(_0x3a6f45,null))[_0xc207('0xd')](respondWithResult(_0x3a6f45,null))[_0xc207('0x3f')](handleError(_0x3a6f45,null));};exports[_0xc207('0x42')]=function(_0x3ce5a3,_0x5b663f){return db[_0xc207('0x13')][_0xc207('0x42')](_0x3ce5a3[_0xc207('0x43')],{})['then'](respondWithResult(_0x5b663f,0xc9))[_0xc207('0x3f')](handleError(_0x5b663f,null));};exports[_0xc207('0xc')]=function(_0x2967ad,_0x45536e){if(_0x2967ad['body']['id']){delete _0x2967ad['body']['id'];}return db[_0xc207('0x13')][_0xc207('0x44')]({'where':{'id':_0x2967ad[_0xc207('0x45')]['id']}})[_0xc207('0xd')](handleEntityNotFound(_0x45536e,null))[_0xc207('0xd')](saveUpdates(_0x2967ad[_0xc207('0x43')],null))[_0xc207('0xd')](respondWithResult(_0x45536e,null))[_0xc207('0x3f')](handleError(_0x45536e,null));};exports[_0xc207('0x46')]=function(_0x212552,_0x2afcd1){return db[_0xc207('0x13')]['describe']()['then'](respondWithResult(_0x2afcd1,null))[_0xc207('0x3f')](handleError(_0x2afcd1,null));};exports[_0xc207('0x47')]=function(_0x2468d0,_0x480f12){var _0x2b89e0;var _0x3f712d=_0x2468d0[_0xc207('0x45')]['id'];return db[_0xc207('0x13')]['find']({'where':{'id':_0x2468d0[_0xc207('0x45')]['id']}})['then'](handleEntityNotFound(_0x480f12,null))[_0xc207('0xd')](function(_0x50a504){if(_0x50a504){return _0x50a504['destroy']()[_0xc207('0xd')](function(_0x30f02e){return _0x30f02e;});}})['then'](function(_0x552edd){_0x2b89e0=_0x552edd;if(_0x552edd){if(_0x552edd['VoiceQueueId']||_0x552edd[_0xc207('0x48')]){return db[_0x552edd[_0xc207('0x49')]?_0xc207('0x4a'):_0xc207('0x4b')][_0xc207('0x44')]({'where':{'id':_0x552edd[_0xc207('0x49')]?_0x552edd[_0xc207('0x49')]:_0x552edd[_0xc207('0x48')]},'attributes':['id','name'],'raw':!![]});}}})[_0xc207('0xd')](function(_0x1435a9){var _0x5aedd3={};if(_0x1435a9){_['merge'](_0x5aedd3,_[_0xc207('0x4c')](_0x2b89e0['dataValues'],['createdAt',_0xc207('0x4d'),'id']));_0x5aedd3[_0xc207('0x4e')]=0x15;_0x5aedd3[_0xc207('0x4f')]=_0xc207('0x50');_0x5aedd3[_0xc207('0x51')]=_0x1435a9[_0xc207('0xf')];_0x5aedd3[_0xc207('0x52')]=_0x2468d0[_0xc207('0x53')][_0xc207('0xf')];_0x5aedd3[_0xc207('0x54')]=_0x2468d0[_0xc207('0x53')]['id'];_0x5aedd3['deleted']=!![];_0x5aedd3['deletedat']=moment()[_0xc207('0x55')](_0xc207('0x56'));_0x5aedd3[_0xc207('0x57')]=_0x2b89e0[_0xc207('0x58')];_0x5aedd3[_0xc207('0x59')]=_0x2b89e0[_0xc207('0x49')]?_0xc207('0x5a'):_0xc207('0x5b');return db[_0xc207('0x5c')]['find']({'where':{'id':_0x5aedd3[_0xc207('0x5d')]},'attributes':[_0xc207('0x5e'),_0xc207('0x5f')]})[_0xc207('0xd')](function(_0x569c85){if(!_[_0xc207('0x60')](_0x480f12)&&!_[_0xc207('0x60')](_0x569c85[_0xc207('0x5e')])){_0x5aedd3[_0xc207('0x61')]=_0x569c85[_0xc207('0x5e')];if(!_[_0xc207('0x60')](_0x569c85[_0xc207('0x5f')])){_0x5aedd3['calleridname']+='\x20'+_0x569c85[_0xc207('0x5f')];}}})[_0xc207('0x62')](function(){return db[_0xc207('0x63')][_0xc207('0x42')](_0x5aedd3);});}})['then'](function(_0xc7812){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x3f712d}});})[_0xc207('0xd')](function(){return _0x480f12[_0xc207('0x10')](0xcc)[_0xc207('0x64')]();})[_0xc207('0x3f')](handleError(_0x480f12,null));};exports[_0xc207('0x65')]=function(_0x3b1b4c,_0x35a0d8){var _0x33c372=[];return db[_0xc207('0x5c')][_0xc207('0x46')]()[_0xc207('0xd')](function(_0x2f97bf){_0x33c372=_[_0xc207('0x1a')](_0x2f97bf);return _0x3b1b4c[_0xc207('0x53')][_0xc207('0x66')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc207('0x67')},'attributes':['id','dialOrderByScheduledAt',_0xc207('0x68')],'raw':!![]});})[_0xc207('0xd')](function(_0x2ade23){if(_0x2ade23&&_0x2ade23['length']){return db['sequelize'][_0xc207('0x69')](function(_0x3ac0dd){var _0x2f18a2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc207('0x56'))},'VoiceQueueId':{'$in':_[_0xc207('0x12')](_0x2ade23,'id')},'$or':[{'UserId':null},{'UserId':_0x3b1b4c[_0xc207('0x53')]['id']}]};var _0x4967b4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ade23)['filter']([_0xc207('0x68'),0x0])['map']('id')[_0xc207('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x3b1b4c[_0xc207('0x53')]['id']}]};var _0x3cca53={'$or':[_0x2f18a2,_0x4967b4]};var _0x4b197=[];if(_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6b')]&&_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6b')]==='prev'){if(!_[_0xc207('0x6c')](_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')])){_0x3cca53['id']={'$in':_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')]};}_0x4b197=[[_0xc207('0x6e'),_0xc207('0x6f')],[_0xc207('0x70'),_0x2ade23[0x0][_0xc207('0x71')]===_0xc207('0x6f')?_0xc207('0x72'):'ASC'],db[_0xc207('0x73')][_0xc207('0x74')](_0xc207('0x75')),['id',_0xc207('0x72')]];}else{if(!_['isEmpty'](_0x3b1b4c['body'][_0xc207('0x6d')])){_0x3cca53['id']={'$notIn':_0x3b1b4c[_0xc207('0x43')][_0xc207('0x6d')]};}_0x4b197=[[_0xc207('0x6e'),'DESC'],[_0xc207('0x70'),_0x2ade23[0x0][_0xc207('0x71')]],db[_0xc207('0x73')]['literal'](_0xc207('0x76')),['id',_0xc207('0x6f')]];}return db[_0xc207('0x13')]['findOne']({'attributes':['id',_0xc207('0x77'),'phone',_0xc207('0x78')],'where':_0x3cca53,'order':_0x4b197,'transaction':_0x3ac0dd,'lock':_0x3ac0dd['LOCK'][_0xc207('0x79')],'include':[{'model':db[_0xc207('0x5c')],'as':'Contact','attributes':_0x33c372,'include':[{'model':db[_0xc207('0x7a')],'as':'Company','attributes':['id',_0xc207('0xf')]}]},{'model':db[_0xc207('0x7b')],'as':_0xc207('0x7c'),'attributes':['id',_0xc207('0xf')]},{'model':db[_0xc207('0x4a')],'as':'Queue','attributes':['id','name',_0xc207('0x7d')]}]})[_0xc207('0xd')](function(_0x5320a9){if(_0x5320a9){return _0x5320a9[_0xc207('0xc')]({'UserId':_0x3b1b4c[_0xc207('0x53')]['id']},{'transaction':_0x3ac0dd});}});});}})['then'](handleEntityNotFound(_0x35a0d8,null))[_0xc207('0xd')](respondWithResult(_0x35a0d8,null))[_0xc207('0x3f')](handleError(_0x35a0d8,null));};exports['getPreviewRecall']=function(_0x2f5938,_0x2548bd,_0x3748de){var _0x1d550d=[];var _0x13c415=_0x2f5938[_0xc207('0x45')]['id'];var _0x5be1e7=_0x2f5938['user']['id'];return db[_0xc207('0x5c')][_0xc207('0x46')]()[_0xc207('0xd')](function(_0x15b13d){_0x1d550d=_[_0xc207('0x1a')](_0x15b13d);return db['sequelize'][_0xc207('0x69')](function(_0x4f79b3){const _0x6b1089={'id':_0x13c415};return db[_0xc207('0x13')][_0xc207('0x7e')]({'attributes':['id',_0xc207('0x77'),_0xc207('0x78')],'where':_0x6b1089,'transaction':_0x4f79b3,'lock':_0x4f79b3[_0xc207('0x7f')]['UPDATE'],'include':[{'model':db[_0xc207('0x5c')],'as':_0xc207('0x80'),'attributes':_0x1d550d,'include':[{'model':db['CmCompany'],'as':_0xc207('0x81'),'attributes':['id',_0xc207('0xf')]}]},{'model':db[_0xc207('0x7b')],'as':_0xc207('0x7c'),'attributes':['id',_0xc207('0xf')]},{'model':db[_0xc207('0x4a')],'as':_0xc207('0x82'),'attributes':['id',_0xc207('0xf'),_0xc207('0x7d')]}]})[_0xc207('0xd')](function(_0x473560){if(_0x473560){return _0x473560[_0xc207('0xc')]({'UserId':_0x5be1e7},{'transaction':_0x4f79b3});}});});})[_0xc207('0xd')](handleEntityNotFound(_0x2548bd,null))['then'](respondWithResult(_0x2548bd,null))[_0xc207('0x3f')](handleError(_0x2548bd,null));};exports[_0xc207('0x83')]=function(_0x2f4efd,_0x266e65){return _0x2f4efd['user'][_0xc207('0x66')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc207('0x67')},'attributes':['id'],'raw':!![]})['then'](function(_0x53cb21){if(_0x53cb21&&_0x53cb21[_0xc207('0x32')]){return db[_0xc207('0x13')][_0xc207('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc207('0x55')](_0xc207('0x56'))},'VoiceQueueId':{'$in':_[_0xc207('0x12')](_0x53cb21,'id')},'$or':[{'UserId':null},{'UserId':_0x2f4efd['user']['id']}]}});}return 0x0;})[_0xc207('0xd')](function(_0x503f62){if(!_[_0xc207('0x60')](_0x503f62)&&_[_0xc207('0x84')](_0x503f62)){return _0x266e65[_0xc207('0x10')](0xc8)[_0xc207('0xb')]({'contacts':_0x503f62});}else{logger['error'](_0xc207('0x85'),_0xc207('0x83'),0x194,'entity\x20not\x20found');_0x266e65[_0xc207('0xe')](0x194);}})[_0xc207('0x3f')](handleError(_0x266e65,null));};exports[_0xc207('0x86')]=function(_0x1365f4,_0x5af9f6){var _0xc814f3=shared[_0xc207('0x87')];var _0x2c00fb=[];_[_0xc207('0x12')](_0xc814f3,function(_0x511bd9){_0x2c00fb['push']({'id':_0x511bd9['name'],'name':_0x511bd9['name'],'utcOffset':_0x511bd9[_0xc207('0x88')]});});return _0x5af9f6[_0xc207('0x10')](0xc8)[_0xc207('0xb')]({'tz':_0x2c00fb});};exports[_0xc207('0x89')]=function(_0x504c6b,_0x4f928b){var _0x341c95=shared['timezones'];var _0x50f110={};if(!_[_0xc207('0x60')](_0x341c95[_0x504c6b[_0xc207('0x43')]['id']]))_0x50f110=_0x341c95[_0x504c6b[_0xc207('0x43')]['id']];return _0x4f928b[_0xc207('0x10')](0xc8)[_0xc207('0xb')](_0x50f110);}; \ No newline at end of file +var _0x5178=['pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','List','Queue','dialActive','getPreviewRecall','Company','CmList','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','count','limit','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xffdde3,_0xdbf85){var _0x4bfb5c=function(_0x52398c){while(--_0x52398c){_0xffdde3['push'](_0xffdde3['shift']());}};_0x4bfb5c(++_0xdbf85);}(_0x5178,0x171));var _0x8517=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5178[_0x6131cd];return _0x47e916;};'use strict';var moment=require('moment');var _=require(_0x8517('0x0'));var qs=require(_0x8517('0x1'));var logger=require(_0x8517('0x2'))(_0x8517('0x3'));var shared=require(_0x8517('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x483381,_0x3ed6a5){_0x3ed6a5=_0x3ed6a5||0xc8;return function(_0x221184){if(_0x221184){return _0x483381['status'](_0x3ed6a5)[_0x8517('0x5')](_0x221184);}};}function respondWithFilteredResult(_0x58ed7e,_0x13ba05){return function(_0x45498e){if(_0x45498e){var _0x3615b2=typeof _0x13ba05[_0x8517('0x6')]===_0x8517('0x7')&&typeof _0x13ba05['limit']===_0x8517('0x7');var _0x526e51=_0x45498e['count'];var _0x2d15fa=_0x3615b2?0x0:_0x13ba05[_0x8517('0x6')];var _0x4dac4d=_0x3615b2?_0x45498e[_0x8517('0x8')]:_0x13ba05[_0x8517('0x6')]+_0x13ba05[_0x8517('0x9')];var _0x3be6b0;if(_0x4dac4d>=_0x526e51){_0x4dac4d=_0x526e51;_0x3be6b0=0xc8;}else{_0x3be6b0=0xce;}_0x58ed7e[_0x8517('0xa')](_0x3be6b0);return _0x58ed7e[_0x8517('0xb')](_0x8517('0xc'),_0x2d15fa+'-'+_0x4dac4d+'/'+_0x526e51)[_0x8517('0x5')](_0x45498e);}return null;};}function saveUpdates(_0x4b9768,_0x9c57de){return function(_0x7f429a){if(_0x7f429a){return _0x7f429a[_0x8517('0xd')](_0x4b9768)[_0x8517('0xe')](function(_0x284a05){return _0x284a05;});}return null;};}function handleEntityNotFound(_0x49eba7,_0x385219){return function(_0x19dd9d){if(!_0x19dd9d){_0x49eba7[_0x8517('0xf')](0x194);}return _0x19dd9d;};}function handleError(_0x100280,_0x411d29){_0x411d29=_0x411d29||0x1f4;return function(_0x18a984){logger[_0x8517('0x10')](_0x18a984[_0x8517('0x11')]);if(_0x18a984[_0x8517('0x12')]){delete _0x18a984[_0x8517('0x12')];}_0x100280[_0x8517('0xa')](_0x411d29)[_0x8517('0x13')](_0x18a984);};}exports['index']=function(_0xdfe7fe,_0x100b76){var _0x38e0f3={},_0xf1b53b={},_0x64875e={'count':0x0,'rows':[]};var _0x24ca7e=_[_0x8517('0x14')](db['CmHopper'][_0x8517('0x15')],function(_0x4cd0a5){return{'name':_0x4cd0a5['fieldName'],'type':_0x4cd0a5[_0x8517('0x16')][_0x8517('0x17')]};});_0xf1b53b[_0x8517('0x18')]=_[_0x8517('0x14')](_0x24ca7e,_0x8517('0x12'));_0xf1b53b[_0x8517('0x19')]=_['keys'](_0xdfe7fe['query']);_0xf1b53b[_0x8517('0x1a')]=_[_0x8517('0x1b')](_0xf1b53b[_0x8517('0x18')],_0xf1b53b[_0x8517('0x19')]);_0xf1b53b[_0x8517('0x1a')]=_[_0x8517('0x1c')](_0xf1b53b['filters'],[_0x8517('0x1d'),_0x8517('0x1e'),'$gt',_0x8517('0x1f'),_0x8517('0x20'),_0x8517('0x21'),'$ne',_0x8517('0x22'),'$not',_0x8517('0x23'),_0x8517('0x24'),_0x8517('0x25'),_0x8517('0x26'),_0x8517('0x27'),_0x8517('0x28'),'$iLike',_0x8517('0x29'),'$like',_0x8517('0x2a'),_0x8517('0x2b'),_0x8517('0x2c'),_0x8517('0x2d')]);_0x38e0f3[_0x8517('0x2e')]=_[_0x8517('0x1b')](_0xf1b53b['model'],qs[_0x8517('0x2f')](_0xdfe7fe['query'][_0x8517('0x2f')]));_0x38e0f3[_0x8517('0x2e')]=_0x38e0f3[_0x8517('0x2e')][_0x8517('0x30')]?_0x38e0f3[_0x8517('0x2e')]:_0xf1b53b[_0x8517('0x18')];if(!_0xdfe7fe[_0x8517('0x19')][_0x8517('0x31')](_0x8517('0x32'))){_0x38e0f3['limit']=qs[_0x8517('0x9')](_0xdfe7fe[_0x8517('0x19')][_0x8517('0x9')]);_0x38e0f3['offset']=qs['offset'](_0xdfe7fe['query'][_0x8517('0x6')]);}_0x38e0f3[_0x8517('0x33')]=qs[_0x8517('0x34')](_0xdfe7fe[_0x8517('0x19')][_0x8517('0x34')]);_0x38e0f3[_0x8517('0x35')]=qs['filters'](_[_0x8517('0x36')](_0xdfe7fe[_0x8517('0x19')],_0xf1b53b[_0x8517('0x1a')]),_0x24ca7e);if(_0xdfe7fe['query'][_0x8517('0x37')]){_0x38e0f3['where']=_[_0x8517('0x38')](_0x38e0f3[_0x8517('0x35')],{'$or':_['map'](_0x24ca7e,function(_0x572feb){if(_0x572feb[_0x8517('0x16')]!==_0x8517('0x39')){var _0x2c1292={};_0x2c1292[_0x572feb[_0x8517('0x12')]]={'$like':'%'+_0xdfe7fe['query']['filter']+'%'};return _0x2c1292;}})});}_0x38e0f3=_[_0x8517('0x38')]({},_0x38e0f3,_0xdfe7fe[_0x8517('0x3a')]);var _0x1835ac={'where':_0x38e0f3['where']};return db[_0x8517('0x3b')][_0x8517('0x8')](_0x1835ac)['then'](function(_0x209235){_0x64875e[_0x8517('0x8')]=_0x209235;if(_0xdfe7fe[_0x8517('0x19')][_0x8517('0x3c')]){_0x38e0f3['include']=[{'all':!![]}];}return db[_0x8517('0x3b')][_0x8517('0x3d')](_0x38e0f3);})[_0x8517('0xe')](function(_0x36ff78){_0x64875e[_0x8517('0x3e')]=_0x36ff78;return _0x64875e;})[_0x8517('0xe')](respondWithFilteredResult(_0x100b76,_0x38e0f3))[_0x8517('0x3f')](handleError(_0x100b76,null));};exports[_0x8517('0x40')]=function(_0x3f338a,_0x183310){var _0x475d71={'raw':!![],'where':{'id':_0x3f338a[_0x8517('0x41')]['id']}},_0x42e62f={};_0x42e62f['model']=_['keys'](db[_0x8517('0x3b')][_0x8517('0x15')]);_0x42e62f[_0x8517('0x19')]=_[_0x8517('0x42')](_0x3f338a[_0x8517('0x19')]);_0x42e62f['filters']=_[_0x8517('0x1b')](_0x42e62f[_0x8517('0x18')],_0x42e62f['query']);_0x475d71[_0x8517('0x2e')]=_[_0x8517('0x1b')](_0x42e62f[_0x8517('0x18')],qs[_0x8517('0x2f')](_0x3f338a['query'][_0x8517('0x2f')]));_0x475d71[_0x8517('0x2e')]=_0x475d71['attributes'][_0x8517('0x30')]?_0x475d71[_0x8517('0x2e')]:_0x42e62f[_0x8517('0x18')];if(_0x3f338a['query'][_0x8517('0x3c')]){_0x475d71[_0x8517('0x43')]=[{'all':!![]}];}_0x475d71=_[_0x8517('0x38')]({},_0x475d71,_0x3f338a[_0x8517('0x3a')]);return db[_0x8517('0x3b')][_0x8517('0x44')](_0x475d71)[_0x8517('0xe')](handleEntityNotFound(_0x183310,null))['then'](respondWithResult(_0x183310,null))[_0x8517('0x3f')](handleError(_0x183310,null));};exports[_0x8517('0x45')]=function(_0x5382b2,_0x326323){return db[_0x8517('0x3b')][_0x8517('0x45')](_0x5382b2[_0x8517('0x46')],{})[_0x8517('0xe')](respondWithResult(_0x326323,0xc9))[_0x8517('0x3f')](handleError(_0x326323,null));};exports['update']=function(_0xad2c85,_0x10c07a){if(_0xad2c85[_0x8517('0x46')]['id']){delete _0xad2c85['body']['id'];}return db[_0x8517('0x3b')][_0x8517('0x44')]({'where':{'id':_0xad2c85['params']['id']}})[_0x8517('0xe')](handleEntityNotFound(_0x10c07a,null))[_0x8517('0xe')](saveUpdates(_0xad2c85['body'],null))['then'](respondWithResult(_0x10c07a,null))['catch'](handleError(_0x10c07a,null));};exports[_0x8517('0x47')]=function(_0x250a14,_0x4ec257){return db[_0x8517('0x3b')]['describe']()['then'](respondWithResult(_0x4ec257,null))[_0x8517('0x3f')](handleError(_0x4ec257,null));};exports[_0x8517('0x48')]=function(_0x3c8ecb,_0x6c2607){var _0x580af9;var _0x282601=_0x3c8ecb[_0x8517('0x41')]['id'];return db[_0x8517('0x3b')]['find']({'where':{'id':_0x3c8ecb[_0x8517('0x41')]['id']}})[_0x8517('0xe')](handleEntityNotFound(_0x6c2607,null))[_0x8517('0xe')](function(_0x22321c){if(_0x22321c){return _0x22321c[_0x8517('0x48')]()[_0x8517('0xe')](function(_0x3cccd9){return _0x3cccd9;});}})['then'](function(_0x3a5adb){_0x580af9=_0x3a5adb;if(_0x3a5adb){if(_0x3a5adb['VoiceQueueId']||_0x3a5adb['CampaignId']){return db[_0x3a5adb[_0x8517('0x49')]?_0x8517('0x4a'):_0x8517('0x4b')][_0x8517('0x44')]({'where':{'id':_0x3a5adb['VoiceQueueId']?_0x3a5adb[_0x8517('0x49')]:_0x3a5adb[_0x8517('0x4c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x3bdbb4){var _0x1f5db0={};if(_0x3bdbb4){_[_0x8517('0x38')](_0x1f5db0,_['omit'](_0x580af9[_0x8517('0x4d')],['createdAt',_0x8517('0x4e'),'id']));_0x1f5db0[_0x8517('0x4f')]=0x15;_0x1f5db0[_0x8517('0x50')]=_0x8517('0x51');_0x1f5db0[_0x8517('0x52')]=_0x3bdbb4[_0x8517('0x12')];_0x1f5db0[_0x8517('0x53')]=_0x3c8ecb[_0x8517('0x54')][_0x8517('0x12')];_0x1f5db0['UserId']=_0x3c8ecb['user']['id'];_0x1f5db0[_0x8517('0x51')]=!![];_0x1f5db0[_0x8517('0x55')]=moment()[_0x8517('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f5db0[_0x8517('0x57')]=_0x580af9[_0x8517('0x58')];_0x1f5db0[_0x8517('0x59')]=_0x580af9['VoiceQueueId']?'queue':_0x8517('0x5a');return db[_0x8517('0x5b')][_0x8517('0x44')]({'where':{'id':_0x1f5db0[_0x8517('0x5c')]},'attributes':[_0x8517('0x5d'),_0x8517('0x5e')]})[_0x8517('0xe')](function(_0x123504){if(!_[_0x8517('0x5f')](_0x6c2607)&&!_[_0x8517('0x5f')](_0x123504[_0x8517('0x5d')])){_0x1f5db0[_0x8517('0x60')]=_0x123504[_0x8517('0x5d')];if(!_[_0x8517('0x5f')](_0x123504[_0x8517('0x5e')])){_0x1f5db0[_0x8517('0x60')]+='\x20'+_0x123504['lastName'];}}})[_0x8517('0x61')](function(){return db[_0x8517('0x62')][_0x8517('0x45')](_0x1f5db0);});}})[_0x8517('0xe')](function(_0x1766a0){return db[_0x8517('0x63')][_0x8517('0x48')]({'where':{'CmHopperId':_0x282601}});})['then'](function(){return _0x6c2607[_0x8517('0xa')](0xcc)[_0x8517('0x64')]();})[_0x8517('0x3f')](handleError(_0x6c2607,null));};exports[_0x8517('0x65')]=function(_0x4240d0,_0x57dcb7){var _0x2437d4=[];return db['CmContact'][_0x8517('0x47')]()[_0x8517('0xe')](function(_0x4147cf){_0x2437d4=_[_0x8517('0x42')](_0x4147cf);return _0x4240d0[_0x8517('0x54')]['getVoiceQueues']({'where':{'type':_0x8517('0x66'),'dialActive':!![],'dialMethod':_0x8517('0x67')},'attributes':['id',_0x8517('0x68'),_0x8517('0x69')],'raw':!![]});})['then'](function(_0x4f4b32){if(_0x4f4b32&&_0x4f4b32[_0x8517('0x30')]){return db['sequelize'][_0x8517('0x6a')](function(_0x1c604c){var _0x4962d4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8517('0x56')](_0x8517('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x4f4b32,'id')},'$or':[{'UserId':null},{'UserId':_0x4240d0[_0x8517('0x54')]['id']}]};var _0x2b26f8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4f4b32)[_0x8517('0x37')]([_0x8517('0x69'),0x0])[_0x8517('0x14')]('id')[_0x8517('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x4240d0[_0x8517('0x54')]['id']}]};var _0x3b58b7={'$or':[_0x4962d4,_0x2b26f8]};var _0x4cf0c8=[];if(_0x4240d0[_0x8517('0x46')][_0x8517('0x6d')]&&_0x4240d0[_0x8517('0x46')][_0x8517('0x6d')]==='prev'){if(!_[_0x8517('0x6e')](_0x4240d0['body'][_0x8517('0x6f')])){_0x3b58b7['id']={'$in':_0x4240d0[_0x8517('0x46')][_0x8517('0x6f')]};}_0x4cf0c8=[[_0x8517('0x70'),'ASC'],['scheduledAt',_0x4f4b32[0x0][_0x8517('0x68')]===_0x8517('0x71')?_0x8517('0x72'):_0x8517('0x71')],db['sequelize'][_0x8517('0x73')](_0x8517('0x74')),['id',_0x8517('0x72')]];}else{if(!_[_0x8517('0x6e')](_0x4240d0[_0x8517('0x46')][_0x8517('0x6f')])){_0x3b58b7['id']={'$notIn':_0x4240d0[_0x8517('0x46')][_0x8517('0x6f')]};}_0x4cf0c8=[[_0x8517('0x70'),_0x8517('0x72')],['scheduledAt',_0x4f4b32[0x0][_0x8517('0x68')]],db[_0x8517('0x75')][_0x8517('0x73')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x8517('0x71')]];}return db['CmHopper'][_0x8517('0x76')]({'attributes':['id',_0x8517('0x77'),'phone',_0x8517('0x78')],'where':_0x3b58b7,'order':_0x4cf0c8,'transaction':_0x1c604c,'lock':_0x1c604c[_0x8517('0x79')][_0x8517('0x7a')],'include':[{'model':db[_0x8517('0x5b')],'as':_0x8517('0x7b'),'attributes':_0x2437d4,'include':[{'model':db[_0x8517('0x7c')],'as':'Company','attributes':['id',_0x8517('0x12')]}]},{'model':db['CmList'],'as':_0x8517('0x7d'),'attributes':['id',_0x8517('0x12')]},{'model':db[_0x8517('0x4a')],'as':_0x8517('0x7e'),'attributes':['id','name',_0x8517('0x7f')]}]})[_0x8517('0xe')](function(_0x1a0b02){if(_0x1a0b02){return _0x1a0b02['update']({'UserId':_0x4240d0[_0x8517('0x54')]['id']},{'transaction':_0x1c604c});}});});}})[_0x8517('0xe')](handleEntityNotFound(_0x57dcb7,null))[_0x8517('0xe')](respondWithResult(_0x57dcb7,null))[_0x8517('0x3f')](handleError(_0x57dcb7,null));};exports[_0x8517('0x80')]=function(_0x13de00,_0x1e63d5,_0x495a38){var _0x402b34=[];var _0x533f23=_0x13de00['params']['id'];var _0x3d5687=_0x13de00[_0x8517('0x54')]['id'];return db[_0x8517('0x5b')]['describe']()[_0x8517('0xe')](function(_0x62f8a8){_0x402b34=_['keys'](_0x62f8a8);return db[_0x8517('0x75')]['transaction'](function(_0x57d29b){const _0x43986b={'id':_0x533f23};return db[_0x8517('0x3b')][_0x8517('0x76')]({'attributes':['id',_0x8517('0x77'),_0x8517('0x78')],'where':_0x43986b,'transaction':_0x57d29b,'lock':_0x57d29b['LOCK'][_0x8517('0x7a')],'include':[{'model':db[_0x8517('0x5b')],'as':'Contact','attributes':_0x402b34,'include':[{'model':db['CmCompany'],'as':_0x8517('0x81'),'attributes':['id',_0x8517('0x12')]}]},{'model':db[_0x8517('0x82')],'as':_0x8517('0x7d'),'attributes':['id',_0x8517('0x12')]},{'model':db[_0x8517('0x4a')],'as':'Queue','attributes':['id','name',_0x8517('0x7f')]}]})[_0x8517('0xe')](function(_0x5f53da){if(_0x5f53da){return _0x5f53da[_0x8517('0xd')]({'UserId':_0x3d5687},{'transaction':_0x57d29b});}});});})[_0x8517('0xe')](handleEntityNotFound(_0x1e63d5,null))['then'](respondWithResult(_0x1e63d5,null))[_0x8517('0x3f')](handleError(_0x1e63d5,null));};exports[_0x8517('0x83')]=function(_0x3c1b7e,_0x590a99){return _0x3c1b7e['user'][_0x8517('0x84')]({'where':{'type':_0x8517('0x66'),'dialActive':!![],'dialMethod':_0x8517('0x67')},'attributes':['id'],'raw':!![]})[_0x8517('0xe')](function(_0x8c1dce){if(_0x8c1dce&&_0x8c1dce['length']){return db[_0x8517('0x3b')][_0x8517('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8517('0x6b'))},'VoiceQueueId':{'$in':_[_0x8517('0x14')](_0x8c1dce,'id')},'$or':[{'UserId':null},{'UserId':_0x3c1b7e[_0x8517('0x54')]['id']}]}});}return 0x0;})[_0x8517('0xe')](function(_0xdbc754){if(!_[_0x8517('0x5f')](_0xdbc754)&&_[_0x8517('0x85')](_0xdbc754)){return _0x590a99[_0x8517('0xa')](0xc8)[_0x8517('0x5')]({'contacts':_0xdbc754});}else{logger[_0x8517('0x10')](_0x8517('0x86'),_0x8517('0x83'),0x194,_0x8517('0x87'));_0x590a99[_0x8517('0xf')](0x194);}})[_0x8517('0x3f')](handleError(_0x590a99,null));};exports[_0x8517('0x88')]=function(_0x2985a0,_0x799502){var _0x3a9a21=shared['timezones'];var _0x1c271c=[];_[_0x8517('0x14')](_0x3a9a21,function(_0x41b3ea){_0x1c271c[_0x8517('0x89')]({'id':_0x41b3ea[_0x8517('0x12')],'name':_0x41b3ea[_0x8517('0x12')],'utcOffset':_0x41b3ea[_0x8517('0x8a')]});});return _0x799502['status'](0xc8)[_0x8517('0x5')]({'tz':_0x1c271c});};exports[_0x8517('0x8b')]=function(_0x38add4,_0x2e9ece){var _0x4762d3=shared[_0x8517('0x8c')];var _0x5bb8e9={};if(!_[_0x8517('0x5f')](_0x4762d3[_0x38add4[_0x8517('0x46')]['id']]))_0x5bb8e9=_0x4762d3[_0x38add4[_0x8517('0x46')]['id']];return _0x2e9ece[_0x8517('0xa')](0xc8)[_0x8517('0x5')](_0x5bb8e9);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 110c505..7f5f0ec 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x26d678,_0x273258){_0x26d678=_0x26d678-0x0;var _0x4ad538=_0x687b[_0x26d678];return _0x4ad538;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x3f1241,_0x3d5e1e){var _0x37bd8a=function(_0x23f540){while(--_0x23f540){_0x3f1241['push'](_0x3f1241['shift']());}};_0x37bd8a(++_0x3d5e1e);}(_0x4819,0xcd));var _0x9481=function(_0x2b0b61,_0x170827){_0x2b0b61=_0x2b0b61-0x0;var _0x2ae144=_0x4819[_0x2b0b61];return _0x2ae144;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4d9cca5..3a72d36 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 _0x87cc=['bluebird','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','include','map','model','info','debug','stringify','error','message','ShowCmHopper','find','raw','then','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','all','GetContactRecallMe','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','User','CmList','List','NOW()','util'];(function(_0x36e3ba,_0x1912e8){var _0x7972c7=function(_0x52e712){while(--_0x52e712){_0x36e3ba['push'](_0x36e3ba['shift']());}};_0x7972c7(++_0x1912e8);}(_0x87cc,0xda));var _0xc87c=function(_0x1d6e09,_0x8be519){_0x1d6e09=_0x1d6e09-0x0;var _0x4c6b0e=_0x87cc[_0x1d6e09];return _0x4c6b0e;};'use strict';var _=require('lodash');var util=require(_0xc87c('0x0'));var moment=require('moment');var BPromise=require(_0xc87c('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xc87c('0x2'));exports[_0xc87c('0x3')]=function(_0x3b8c9a){var _0x3a461e=this;return new Promise(function(_0x5a022d,_0x51adfb){return db[_0xc87c('0x4')]['findAll']({'raw':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options'][_0xc87c('0x8')]||null:null,'include':_0x3b8c9a[_0xc87c('0x5')]?_0x3b8c9a['options'][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x3b8c9a[_0xc87c('0x5')][_0xc87c('0x9')],function(_0x162449){return{'model':db[_0x162449[_0xc87c('0xb')]],'as':_0x162449['as'],'attributes':_0x162449[_0xc87c('0x7')],'include':_0x162449[_0xc87c('0x9')]?_['map'](_0x162449[_0xc87c('0x9')],function(_0x2fad20){return{'model':db[_0x2fad20[_0xc87c('0xb')]],'as':_0x2fad20['as'],'attributes':_0x2fad20['attributes'],'include':_0x2fad20[_0xc87c('0x9')]?_['map'](_0x2fad20[_0xc87c('0x9')],function(_0x33a4f5){return{'model':db[_0x33a4f5['model']],'as':_0x33a4f5['as'],'attributes':_0x33a4f5[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24c6ac){logger[_0xc87c('0xc')](_0xc87c('0x3'),_0x3b8c9a);logger[_0xc87c('0xd')]('GetCmHopper',_0x3b8c9a,JSON[_0xc87c('0xe')](_0x24c6ac));_0x5a022d(_0x24c6ac);})['catch'](function(_0x1a8331){logger[_0xc87c('0xf')](_0xc87c('0x3'),_0x1a8331[_0xc87c('0x10')],_0x3b8c9a);_0x51adfb(_0x3a461e['error'](0x1f4,_0x1a8331[_0xc87c('0x10')]));});});};exports[_0xc87c('0x11')]=function(_0x572d37){var _0xe36b81=this;return new Promise(function(_0x2895c9,_0x4636c2){return db['CmHopper'][_0xc87c('0x12')]({'raw':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x572d37[_0xc87c('0x5')]?_0x572d37[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'include':_0x572d37['options']?_0x572d37[_0xc87c('0x5')][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x572d37[_0xc87c('0x5')][_0xc87c('0x9')],function(_0x4af469){return{'model':db[_0x4af469['model']],'as':_0x4af469['as'],'attributes':_0x4af469[_0xc87c('0x7')],'include':_0x4af469[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x4af469[_0xc87c('0x9')],function(_0x59b0b5){return{'model':db[_0x59b0b5[_0xc87c('0xb')]],'as':_0x59b0b5['as'],'attributes':_0x59b0b5['attributes'],'include':_0x59b0b5['include']?_['map'](_0x59b0b5[_0xc87c('0x9')],function(_0x33c943){return{'model':db[_0x33c943[_0xc87c('0xb')]],'as':_0x33c943['as'],'attributes':_0x33c943['attributes']};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x51100c){logger[_0xc87c('0xc')]('ShowCmHopper',_0x572d37);logger[_0xc87c('0xd')](_0xc87c('0x11'),_0x572d37,JSON['stringify'](_0x51100c));_0x2895c9(_0x51100c);})[_0xc87c('0x15')](function(_0x39b1d3){logger[_0xc87c('0xf')](_0xc87c('0x11'),_0x39b1d3[_0xc87c('0x10')],_0x572d37);_0x4636c2(_0xe36b81[_0xc87c('0xf')](0x1f4,_0x39b1d3[_0xc87c('0x10')]));});});};exports[_0xc87c('0x16')]=function(_0x3ef87b){var _0x20f9c8=this;return new Promise(function(_0x163dc0,_0x310327){return db[_0xc87c('0x4')][_0xc87c('0x17')](_0x3ef87b[_0xc87c('0x18')],{'raw':_0x3ef87b['options']?_0x3ef87b[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![]})[_0xc87c('0x14')](function(_0x10fb22){logger[_0xc87c('0xc')](_0xc87c('0x16'),_0x3ef87b);logger[_0xc87c('0xd')](_0xc87c('0x16'),_0x3ef87b,JSON['stringify'](_0x10fb22));_0x163dc0(_0x10fb22);})[_0xc87c('0x15')](function(_0x2868db){logger['error'](_0xc87c('0x16'),_0x2868db[_0xc87c('0x10')],_0x3ef87b);_0x310327(_0x20f9c8['error'](0x1f4,_0x2868db[_0xc87c('0x10')]));});});};exports[_0xc87c('0x19')]=function(_0x4cd105){var _0x40055f=this;return new Promise(function(_0x42f8af,_0x2dbfc7){return db[_0xc87c('0x4')][_0xc87c('0x1a')](_0x4cd105[_0xc87c('0x18')],{'raw':_0x4cd105[_0xc87c('0x5')]?_0x4cd105['options'][_0xc87c('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd105[_0xc87c('0x5')]?_0x4cd105[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x4cd105['options']?_0x4cd105[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x4cd105[_0xc87c('0x5')]?_0x4cd105['options']['limit']||null:null})['then'](function(_0x9278d7){logger[_0xc87c('0xc')](_0xc87c('0x19'),_0x4cd105);logger[_0xc87c('0xc')](_0xc87c('0x1b'),JSON['stringify'](_0x4cd105[_0xc87c('0x5')][_0xc87c('0x6')]),_0x4cd105[_0xc87c('0x18')][_0xc87c('0x1c')]);logger['debug'](_0xc87c('0x19'),_0x4cd105,JSON[_0xc87c('0xe')](_0x9278d7));_0x42f8af(_0x9278d7);})['catch'](function(_0xb0086d){logger[_0xc87c('0xf')](_0xc87c('0x19'),_0xb0086d['message'],_0x4cd105);_0x2dbfc7(_0x40055f[_0xc87c('0xf')](0x1f4,_0xb0086d[_0xc87c('0x10')]));});});};exports[_0xc87c('0x1d')]=function(_0xa0f17d){var _0x793531=this;return new Promise(function(_0x48e31f,_0x3ec907){return db['CmHopper'][_0xc87c('0x1e')]({'where':_0xa0f17d[_0xc87c('0x5')]?_0xa0f17d[_0xc87c('0x5')][_0xc87c('0x6')]||null:null})[_0xc87c('0x14')](function(_0x560e56){logger[_0xc87c('0xc')](_0xc87c('0x1d'),_0xa0f17d);logger[_0xc87c('0xd')](_0xc87c('0x1d'),_0xa0f17d,JSON[_0xc87c('0xe')](_0x560e56));_0x48e31f(_0x560e56);})[_0xc87c('0x15')](function(_0x18e8a9){logger[_0xc87c('0xf')](_0xc87c('0x1d'),_0x18e8a9[_0xc87c('0x10')],_0xa0f17d);_0x3ec907(_0x793531[_0xc87c('0xf')](0x1f4,_0x18e8a9[_0xc87c('0x10')]));});});};exports[_0xc87c('0x1f')]=function(_0xd36aee){var _0x209868=this;return new Promise(function(_0x306ac7,_0x5769ec){return db[_0xc87c('0x20')][_0xc87c('0x21')]()[_0xc87c('0x14')](function(_0x5041fa){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0xe6e241){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'where':_0xd36aee['options']?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0xd36aee[_0xc87c('0x5')]?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0xd36aee['options']?_0xd36aee['options'][_0xc87c('0x8')]||null:null,'order':_0xd36aee[_0xc87c('0x5')]?_0xd36aee[_0xc87c('0x5')][_0xc87c('0x25')]||null:null,'transaction':_0xe6e241,'lock':_0xe6e241[_0xc87c('0x26')][_0xc87c('0x27')],'include':[{'model':db['CmContact'],'as':_0xc87c('0x28'),'attributes':_['keys'](_0x5041fa)},{'model':db['User'],'as':_0xc87c('0x29'),'attributes':['id',_0xc87c('0x2a'),_0xc87c('0x2b')]}]})[_0xc87c('0x14')](function(_0x1b0894){var _0x2da000=[];var _0x493acd=[];for(var _0x52a7c0=0x0;_0x52a7c0<_0x1b0894[_0xc87c('0x2c')];_0x52a7c0+=0x1){var _0x26d7d5=_0x1b0894[_0x52a7c0][_0xc87c('0x2d')];if(_0x26d7d5===null){_0x2da000[_0xc87c('0x2e')](_0x1b0894[_0x52a7c0][_0xc87c('0x1a')](_0xd36aee['body'],{'transaction':_0xe6e241}));}else if(!_0x493acd[_0xc87c('0x2f')](_0x26d7d5)){_0x493acd[_0xc87c('0x2e')](_0x26d7d5);_0x2da000[_0xc87c('0x2e')](_0x1b0894[_0x52a7c0][_0xc87c('0x1a')](_0xd36aee[_0xc87c('0x18')],{'transaction':_0xe6e241}));}}return BPromise['all'](_0x2da000);});})[_0xc87c('0x14')](function(_0x5495f3){logger[_0xc87c('0xc')](_0xc87c('0x1f'),_0xd36aee);if(_0x5495f3[_0xc87c('0x2c')]>0x0){logger[_0xc87c('0xc')](_0xc87c('0x30'),_0x5495f3[0x0][_0xc87c('0x31')]['id'],_0x5495f3[0x0][_0xc87c('0x31')]['ContactId'],_0x5495f3[0x0][_0xc87c('0x31')][_0xc87c('0x1c')]);}logger['debug'](_0xc87c('0x1f'),_0xd36aee,JSON['stringify'](_0x5495f3));_0x306ac7(_0x5495f3);})[_0xc87c('0x15')](function(_0x249b81){logger[_0xc87c('0xf')](_0xc87c('0x1f'),_0x249b81['message'],_0xd36aee);_0x5769ec(_0x209868[_0xc87c('0xf')](0x1f4,_0x249b81[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x32')]=function(_0x483b42){var _0x28fc71=this;return new Promise(function(_0x760fae,_0xb4bf8f){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x52faf5){return db[_0xc87c('0x33')][_0xc87c('0x17')](_0x483b42['body'],{'raw':_0x483b42['options']?_0x483b42[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'transaction':_0x52faf5})[_0xc87c('0x14')](function(){logger[_0xc87c('0xc')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc87c('0xe')](_0x483b42['options'][_0xc87c('0x6')]),_0x483b42[_0xc87c('0x5')][_0xc87c('0x6')][_0xc87c('0x1c')]);return db['CmHopper'][_0xc87c('0x1e')]({'where':_0x483b42[_0xc87c('0x5')]?_0x483b42[_0xc87c('0x5')]['where']||null:null,'transaction':_0x52faf5});});})[_0xc87c('0x14')](function(_0x377c14){logger['info'](_0xc87c('0x32'),_0x483b42);logger['debug'](_0xc87c('0x32'),_0x483b42,JSON['stringify'](_0x377c14));_0x760fae(_0x377c14);})[_0xc87c('0x15')](function(_0x153047){logger[_0xc87c('0xf')](_0xc87c('0x32'),_0x153047[_0xc87c('0x10')],_0x483b42);_0xb4bf8f(_0x28fc71[_0xc87c('0xf')](0x1f4,_0x153047['message']));});});};exports[_0xc87c('0x34')]=function(_0x1dba06){var _0x13dcaa=this;return new Promise(function(_0x1147af,_0x2d4d68){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'raw':_0x1dba06[_0xc87c('0x5')]?_0x1dba06[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x1dba06['options']?_0x1dba06[_0xc87c('0x5')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xc87c('0x35'),db[_0xc87c('0x22')]['fn']('IF',db['sequelize'][_0xc87c('0x36')](_0xc87c('0x37')+util['format'](_0xc87c('0x38'),moment()['format'](_0xc87c('0x39')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xc87c('0x14')](function(_0x40a52f){logger[_0xc87c('0xc')]('CountReScheduled',_0x1dba06);logger[_0xc87c('0xd')](_0xc87c('0x34'),_0x1dba06,JSON[_0xc87c('0xe')](_0x40a52f));_0x1147af(_0x40a52f);})[_0xc87c('0x15')](function(_0x91b977){logger['error'](_0xc87c('0x34'),_0x91b977[_0xc87c('0x10')],_0x1dba06);_0x2d4d68(_0x13dcaa[_0xc87c('0xf')](0x1f4,_0x91b977[_0xc87c('0x10')]));});});};exports['GetContactRecallMe']=function(_0x105438){var _0x189c1d=this;return new Promise(function(_0x23b205,_0x163e89){return db['CmContact'][_0xc87c('0x21')]()[_0xc87c('0x14')](function(){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x30d376){return db['CmHopper']['findAll']({'where':_0x105438['options']?_0x105438[_0xc87c('0x5')][_0xc87c('0x6')]||null:null,'attributes':_0x105438[_0xc87c('0x5')]?_0x105438[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':0x1,'order':_0x105438['options']?_0x105438[_0xc87c('0x5')][_0xc87c('0x25')]||null:null,'group':db[_0xc87c('0x4')][_0xc87c('0x2d')],'transaction':_0x30d376,'lock':_0x30d376[_0xc87c('0x26')][_0xc87c('0x27')],'include':_0x105438[_0xc87c('0x5')]?_0x105438[_0xc87c('0x5')][_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x105438['options'][_0xc87c('0x9')],function(_0x1aaf73){return{'model':db[_0x1aaf73[_0xc87c('0xb')]],'as':_0x1aaf73['as'],'attributes':_0x1aaf73[_0xc87c('0x7')],'include':_0x1aaf73['include']?_[_0xc87c('0xa')](_0x1aaf73[_0xc87c('0x9')],function(_0x5dba8c){return{'model':db[_0x5dba8c[_0xc87c('0xb')]],'as':_0x5dba8c['as'],'attributes':_0x5dba8c[_0xc87c('0x7')],'include':_0x5dba8c[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x5dba8c[_0xc87c('0x9')],function(_0x17ef1b){return{'model':db[_0x17ef1b[_0xc87c('0xb')]],'as':_0x17ef1b['as'],'attributes':_0x17ef1b[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x4e9904){var _0x2f2794=[];for(var _0x5c0e69=0x0;_0x5c0e69<_0x4e9904[_0xc87c('0x2c')];_0x5c0e69+=0x1){_0x2f2794[_0xc87c('0x2e')](_0x4e9904[_0x5c0e69][_0xc87c('0x1a')](_0x105438[_0xc87c('0x18')],{'transaction':_0x30d376}));}return BPromise[_0xc87c('0x3a')](_0x2f2794);});})[_0xc87c('0x14')](function(_0x3ef46f){logger[_0xc87c('0xc')](_0xc87c('0x3b'),_0x105438);logger[_0xc87c('0xd')]('GetContactRecallMe',_0x105438,JSON[_0xc87c('0xe')](_0x3ef46f));_0x23b205(_0x3ef46f);})[_0xc87c('0x15')](function(_0x3f6b7d){logger['error'](_0xc87c('0x3b'),_0x3f6b7d[_0xc87c('0x10')],_0x105438);_0x163e89(_0x189c1d['error'](0x1f4,_0x3f6b7d['message']));});});});};exports['GetCmHopperPreview']=function(_0x212c51){var _0x557e90=this;return new Promise(function(_0x43f182,_0x740e72){db[_0xc87c('0x20')][_0xc87c('0x21')]()[_0xc87c('0x14')](function(_0x14a8d1){return db[_0xc87c('0x4')][_0xc87c('0x24')]({'raw':_0x212c51['options']?_0x212c51[_0xc87c('0x5')][_0xc87c('0x13')]===undefined?!![]:![]:!![],'where':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')]['where']||null:null,'attributes':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')][_0xc87c('0x7')]||null:null,'limit':_0x212c51[_0xc87c('0x5')]?_0x212c51['options']['limit']||null:null,'include':_0x212c51[_0xc87c('0x5')]?_0x212c51[_0xc87c('0x5')][_0xc87c('0x9')]?_['map'](_0x212c51[_0xc87c('0x5')]['include'],function(_0x2b88e6){return{'model':db[_0x2b88e6[_0xc87c('0xb')]],'as':_0x2b88e6['as'],'attributes':_0x2b88e6['as']===_0xc87c('0x28')?_['keys'](_0x14a8d1):_0x2b88e6[_0xc87c('0x7')],'include':_0x2b88e6[_0xc87c('0x9')]?_[_0xc87c('0xa')](_0x2b88e6[_0xc87c('0x9')],function(_0x1f4639){return{'model':db[_0x1f4639[_0xc87c('0xb')]],'as':_0x1f4639['as'],'attributes':_0x1f4639['attributes'],'include':_0x1f4639['include']?_[_0xc87c('0xa')](_0x1f4639[_0xc87c('0x9')],function(_0x3ee4cc){return{'model':db[_0x3ee4cc[_0xc87c('0xb')]],'as':_0x3ee4cc['as'],'attributes':_0x3ee4cc[_0xc87c('0x7')]};}):[]};}):[]};}):[]:[]})[_0xc87c('0x14')](function(_0x214d8c){logger['info'](_0xc87c('0x3'),_0x212c51);logger[_0xc87c('0xd')](_0xc87c('0x3'),_0x212c51,JSON['stringify'](_0x214d8c));_0x43f182(_0x214d8c);})[_0xc87c('0x15')](function(_0x4faa7d){logger['error'](_0xc87c('0x3'),_0x4faa7d[_0xc87c('0x10')],_0x212c51);_0x740e72(_0x557e90['error'](0x1f4,_0x4faa7d[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x3c')]=function(_0x457ab1){var _0x49b91e=this;return new Promise(function(_0x56c940,_0x564d32){return db[_0xc87c('0x20')][_0xc87c('0x3d')]({'raw':!![],'where':{'phone':_0x457ab1[_0xc87c('0x5')][_0xc87c('0x6')][_0xc87c('0x3e')]},'attributes':['id','dialTimezone'],'order':[['id',_0xc87c('0x3f')]]})[_0xc87c('0x14')](function(_0x259009){logger[_0xc87c('0xc')](_0xc87c('0x40'),_0x457ab1);logger[_0xc87c('0xd')](_0xc87c('0x40'),_0x457ab1,JSON[_0xc87c('0xe')](_0x259009));_0x56c940(_0x259009);})[_0xc87c('0x15')](function(_0xfe70a9){logger[_0xc87c('0xf')](_0xc87c('0x40'),_0xfe70a9[_0xc87c('0x10')],_0x457ab1);_0x564d32(_0x49b91e[_0xc87c('0xf')](0x1f4,_0xfe70a9[_0xc87c('0x10')]));});});};exports['ResetActiveCalls']=function(_0x264462){var _0x123431=this;return new Promise(function(_0x235886,_0x3b75d7){return db['sequelize']['transaction'](function(_0x1c4a51){var _0x354423=_0x264462[_0xc87c('0x5')]&&_0x264462[_0xc87c('0x5')][_0xc87c('0x6')]?_0x264462['options'][_0xc87c('0x6')]:{};return db['CmHopper'][_0xc87c('0x1a')](_0x264462['body'],{'where':_0x354423,'transaction':_0x1c4a51})[_0xc87c('0x14')](function(_0x1b9d33){logger[_0xc87c('0xc')]('ResetActiveCalls',_0x264462);logger['debug'](_0xc87c('0x41'),_0x264462,JSON[_0xc87c('0xe')](_0x1b9d33));_0x235886(_0x1b9d33);})[_0xc87c('0x15')](function(_0x5ca052){logger[_0xc87c('0xf')](_0xc87c('0x41'),_0x5ca052[_0xc87c('0x10')],_0x264462);_0x3b75d7(_0x123431[_0xc87c('0xf')](0x1f4,_0x5ca052[_0xc87c('0x10')]));});});});};exports[_0xc87c('0x42')]=function(_0x4a0c29){var _0x252f13=this;var _0xc1093b=_0x4a0c29[_0xc87c('0x18')][_0xc87c('0x6')]['voiceQueueIds'];var _0x535f3a=_0x4a0c29[_0xc87c('0x18')]['where']['interval'];var _0x27cc34=_0x4a0c29['body'][_0xc87c('0x6')][_0xc87c('0x43')];return new Promise(function(_0x18756c,_0x1b01e6){return db['CmHopper'][_0xc87c('0x24')]({'where':{'voiceQueueId':{'$in':_0xc1093b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc87c('0x22')][_0xc87c('0x36')](_0xc87c('0x44')+_0x535f3a+'\x20MINUTE'),'$gt':db[_0xc87c('0x22')][_0xc87c('0x36')]('NOW()')}},'UserId':{'$in':_0x27cc34}},'include':[{'model':db[_0xc87c('0x20')],'as':_0xc87c('0x28')},{'model':db[_0xc87c('0x45')],'as':_0xc87c('0x29'),'attributes':['id','name',_0xc87c('0x2b')]},{'model':db[_0xc87c('0x46')],'as':_0xc87c('0x47')}]})['then'](function(_0x54ac9a){if(_0x54ac9a['length']>0x0){return db[_0xc87c('0x22')][_0xc87c('0x23')](function(_0x1d0181){return db[_0xc87c('0x4')][_0xc87c('0x1a')]({'recallmeNotifiedDate':db[_0xc87c('0x22')]['literal'](_0xc87c('0x48'))},{'where':{'id':{'$in':_[_0xc87c('0xa')](_0x54ac9a,'id')}},'transaction':_0x1d0181})[_0xc87c('0x14')](function(){_0x18756c(_0x54ac9a);})[_0xc87c('0x15')](function(_0x16df33){logger[_0xc87c('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x16df33[_0xc87c('0x10')],_0x4a0c29);_0x1b01e6(_0x252f13[_0xc87c('0xf')](0x1f4,_0x16df33[_0xc87c('0x10')]));});})[_0xc87c('0x15')](function(_0x2c6fec){logger[_0xc87c('0xf')](_0xc87c('0x42'),_0x2c6fec[_0xc87c('0x10')],_0x4a0c29);_0x1b01e6(_0x252f13[_0xc87c('0xf')](0x1f4,_0x2c6fec['message']));});}else{_0x18756c(_0x54ac9a);}});});}; \ No newline at end of file +var _0x521e=['map','info','debug','GetCmHopper','stringify','error','ShowCmHopper','then','catch','message','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','order','LOCK','UPDATE','Contact','keys','User','Agent','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','CountReScheduled','literal','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','describe','all','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','\x20MINUTE','NOW()','name','List','lodash','util','moment','../../mysqldb','../../config/logger','CmHopper','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x310868,_0x15b22d){var _0x5e4350=function(_0x469523){while(--_0x469523){_0x310868['push'](_0x310868['shift']());}};_0x5e4350(++_0x15b22d);}(_0x521e,0xd3));var _0xe521=function(_0x4f81d0,_0x24b71b){_0x4f81d0=_0x4f81d0-0x0;var _0x4739ac=_0x521e[_0x4f81d0];return _0x4739ac;};'use strict';var _=require(_0xe521('0x0'));var util=require(_0xe521('0x1'));var moment=require(_0xe521('0x2'));var BPromise=require('bluebird');var db=require(_0xe521('0x3'))['db'];var logger=require(_0xe521('0x4'))('rpc');exports['GetCmHopper']=function(_0x13aa0d){var _0x331d01=this;return new Promise(function(_0x10f670,_0x492d5b){return db[_0xe521('0x5')][_0xe521('0x6')]({'raw':_0x13aa0d[_0xe521('0x7')]?_0x13aa0d[_0xe521('0x7')][_0xe521('0x8')]===undefined?!![]:![]:!![],'where':_0x13aa0d[_0xe521('0x7')]?_0x13aa0d['options'][_0xe521('0x9')]||null:null,'attributes':_0x13aa0d[_0xe521('0x7')]?_0x13aa0d['options'][_0xe521('0xa')]||null:null,'limit':_0x13aa0d[_0xe521('0x7')]?_0x13aa0d['options'][_0xe521('0xb')]||null:null,'include':_0x13aa0d['options']?_0x13aa0d['options'][_0xe521('0xc')]?_['map'](_0x13aa0d[_0xe521('0x7')][_0xe521('0xc')],function(_0x10077f){return{'model':db[_0x10077f[_0xe521('0xd')]],'as':_0x10077f['as'],'attributes':_0x10077f[_0xe521('0xa')],'include':_0x10077f['include']?_['map'](_0x10077f[_0xe521('0xc')],function(_0x56ca13){return{'model':db[_0x56ca13[_0xe521('0xd')]],'as':_0x56ca13['as'],'attributes':_0x56ca13[_0xe521('0xa')],'include':_0x56ca13[_0xe521('0xc')]?_[_0xe521('0xe')](_0x56ca13[_0xe521('0xc')],function(_0x39ff93){return{'model':db[_0x39ff93[_0xe521('0xd')]],'as':_0x39ff93['as'],'attributes':_0x39ff93['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39e5cc){logger[_0xe521('0xf')]('GetCmHopper',_0x13aa0d);logger[_0xe521('0x10')](_0xe521('0x11'),_0x13aa0d,JSON[_0xe521('0x12')](_0x39e5cc));_0x10f670(_0x39e5cc);})['catch'](function(_0x1d5b58){logger[_0xe521('0x13')](_0xe521('0x11'),_0x1d5b58['message'],_0x13aa0d);_0x492d5b(_0x331d01[_0xe521('0x13')](0x1f4,_0x1d5b58['message']));});});};exports[_0xe521('0x14')]=function(_0x1e7f0c){var _0x5a0ef0=this;return new Promise(function(_0x1f4f11,_0x4cff9d){return db[_0xe521('0x5')]['find']({'raw':_0x1e7f0c['options']?_0x1e7f0c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e7f0c[_0xe521('0x7')]?_0x1e7f0c[_0xe521('0x7')][_0xe521('0x9')]||null:null,'attributes':_0x1e7f0c[_0xe521('0x7')]?_0x1e7f0c['options'][_0xe521('0xa')]||null:null,'include':_0x1e7f0c[_0xe521('0x7')]?_0x1e7f0c[_0xe521('0x7')][_0xe521('0xc')]?_[_0xe521('0xe')](_0x1e7f0c[_0xe521('0x7')][_0xe521('0xc')],function(_0x4b5d6f){return{'model':db[_0x4b5d6f[_0xe521('0xd')]],'as':_0x4b5d6f['as'],'attributes':_0x4b5d6f['attributes'],'include':_0x4b5d6f['include']?_[_0xe521('0xe')](_0x4b5d6f['include'],function(_0x3e46e8){return{'model':db[_0x3e46e8[_0xe521('0xd')]],'as':_0x3e46e8['as'],'attributes':_0x3e46e8[_0xe521('0xa')],'include':_0x3e46e8['include']?_[_0xe521('0xe')](_0x3e46e8[_0xe521('0xc')],function(_0x5d75cf){return{'model':db[_0x5d75cf[_0xe521('0xd')]],'as':_0x5d75cf['as'],'attributes':_0x5d75cf[_0xe521('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe521('0x15')](function(_0x1d15ed){logger[_0xe521('0xf')](_0xe521('0x14'),_0x1e7f0c);logger['debug'](_0xe521('0x14'),_0x1e7f0c,JSON['stringify'](_0x1d15ed));_0x1f4f11(_0x1d15ed);})[_0xe521('0x16')](function(_0x382014){logger[_0xe521('0x13')](_0xe521('0x14'),_0x382014[_0xe521('0x17')],_0x1e7f0c);_0x4cff9d(_0x5a0ef0[_0xe521('0x13')](0x1f4,_0x382014['message']));});});};exports[_0xe521('0x18')]=function(_0x56c8af){var _0x522780=this;return new Promise(function(_0x3c7d4f,_0x408a7e){return db[_0xe521('0x5')][_0xe521('0x19')](_0x56c8af[_0xe521('0x1a')],{'raw':_0x56c8af['options']?_0x56c8af[_0xe521('0x7')][_0xe521('0x8')]===undefined?!![]:![]:!![]})[_0xe521('0x15')](function(_0x2baf8e){logger[_0xe521('0xf')]('CreateCmHopper',_0x56c8af);logger[_0xe521('0x10')](_0xe521('0x18'),_0x56c8af,JSON[_0xe521('0x12')](_0x2baf8e));_0x3c7d4f(_0x2baf8e);})['catch'](function(_0x154244){logger['error']('CreateCmHopper',_0x154244[_0xe521('0x17')],_0x56c8af);_0x408a7e(_0x522780[_0xe521('0x13')](0x1f4,_0x154244[_0xe521('0x17')]));});});};exports[_0xe521('0x1b')]=function(_0x3ee9f1){var _0x29f4a5=this;return new Promise(function(_0x32bf76,_0x4e1aeb){return db[_0xe521('0x5')][_0xe521('0x1c')](_0x3ee9f1[_0xe521('0x1a')],{'raw':_0x3ee9f1[_0xe521('0x7')]?_0x3ee9f1['options'][_0xe521('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee9f1[_0xe521('0x7')]?_0x3ee9f1[_0xe521('0x7')]['where']||null:null,'attributes':_0x3ee9f1[_0xe521('0x7')]?_0x3ee9f1[_0xe521('0x7')][_0xe521('0xa')]||null:null,'limit':_0x3ee9f1[_0xe521('0x7')]?_0x3ee9f1[_0xe521('0x7')][_0xe521('0xb')]||null:null})[_0xe521('0x15')](function(_0x5b12e7){logger['info']('UpdateCmHopper',_0x3ee9f1);logger[_0xe521('0xf')](_0xe521('0x1d'),JSON['stringify'](_0x3ee9f1['options'][_0xe521('0x9')]),_0x3ee9f1['body'][_0xe521('0x1e')]);logger['debug'](_0xe521('0x1b'),_0x3ee9f1,JSON['stringify'](_0x5b12e7));_0x32bf76(_0x5b12e7);})['catch'](function(_0x2c887c){logger[_0xe521('0x13')](_0xe521('0x1b'),_0x2c887c[_0xe521('0x17')],_0x3ee9f1);_0x4e1aeb(_0x29f4a5[_0xe521('0x13')](0x1f4,_0x2c887c['message']));});});};exports[_0xe521('0x1f')]=function(_0x34d990){var _0x11913f=this;return new Promise(function(_0x214862,_0x3e7e21){return db[_0xe521('0x5')][_0xe521('0x20')]({'where':_0x34d990[_0xe521('0x7')]?_0x34d990[_0xe521('0x7')][_0xe521('0x9')]||null:null})[_0xe521('0x15')](function(_0x360cca){logger[_0xe521('0xf')](_0xe521('0x1f'),_0x34d990);logger['debug'](_0xe521('0x1f'),_0x34d990,JSON[_0xe521('0x12')](_0x360cca));_0x214862(_0x360cca);})[_0xe521('0x16')](function(_0x36e6d7){logger[_0xe521('0x13')](_0xe521('0x1f'),_0x36e6d7[_0xe521('0x17')],_0x34d990);_0x3e7e21(_0x11913f[_0xe521('0x13')](0x1f4,_0x36e6d7[_0xe521('0x17')]));});});};exports[_0xe521('0x21')]=function(_0x436ade){var _0x49b571=this;return new Promise(function(_0x375791,_0x11b872){return db[_0xe521('0x22')]['describe']()['then'](function(_0x366fab){return db['sequelize']['transaction'](function(_0x21339a){return db[_0xe521('0x5')][_0xe521('0x6')]({'where':_0x436ade[_0xe521('0x7')]?_0x436ade[_0xe521('0x7')][_0xe521('0x9')]||null:null,'attributes':_0x436ade[_0xe521('0x7')]?_0x436ade['options'][_0xe521('0xa')]||null:null,'limit':_0x436ade['options']?_0x436ade[_0xe521('0x7')]['limit']||null:null,'order':_0x436ade[_0xe521('0x7')]?_0x436ade[_0xe521('0x7')][_0xe521('0x23')]||null:null,'transaction':_0x21339a,'lock':_0x21339a[_0xe521('0x24')][_0xe521('0x25')],'include':[{'model':db['CmContact'],'as':_0xe521('0x26'),'attributes':_[_0xe521('0x27')](_0x366fab)},{'model':db[_0xe521('0x28')],'as':_0xe521('0x29'),'attributes':['id','name','voicePause']}]})[_0xe521('0x15')](function(_0xd2eb2){var _0x4db2d0=[];var _0x4aeba9=[];for(var _0x3c3a24=0x0;_0x3c3a24<_0xd2eb2[_0xe521('0x2a')];_0x3c3a24+=0x1){var _0x4c5f99=_0xd2eb2[_0x3c3a24][_0xe521('0x2b')];if(_0x4c5f99===null){_0x4db2d0[_0xe521('0x2c')](_0xd2eb2[_0x3c3a24][_0xe521('0x1c')](_0x436ade['body'],{'transaction':_0x21339a}));}else if(!_0x4aeba9[_0xe521('0x2d')](_0x4c5f99)){_0x4aeba9['push'](_0x4c5f99);_0x4db2d0[_0xe521('0x2c')](_0xd2eb2[_0x3c3a24][_0xe521('0x1c')](_0x436ade['body'],{'transaction':_0x21339a}));}}return BPromise['all'](_0x4db2d0);});})[_0xe521('0x15')](function(_0x314e26){logger[_0xe521('0xf')](_0xe521('0x21'),_0x436ade);if(_0x314e26[_0xe521('0x2a')]>0x0){logger[_0xe521('0xf')](_0xe521('0x2e'),_0x314e26[0x0][_0xe521('0x2f')]['id'],_0x314e26[0x0][_0xe521('0x2f')][_0xe521('0x30')],_0x314e26[0x0][_0xe521('0x2f')]['active']);}logger[_0xe521('0x10')](_0xe521('0x21'),_0x436ade,JSON[_0xe521('0x12')](_0x314e26));_0x375791(_0x314e26);})[_0xe521('0x16')](function(_0x242191){logger[_0xe521('0x13')](_0xe521('0x21'),_0x242191[_0xe521('0x17')],_0x436ade);_0x11b872(_0x49b571['error'](0x1f4,_0x242191[_0xe521('0x17')]));});});});};exports[_0xe521('0x31')]=function(_0x5b8f42){var _0x5a79fe=this;return new Promise(function(_0x592804,_0x25d3b0){return db[_0xe521('0x32')][_0xe521('0x33')](function(_0x5de8aa){return db[_0xe521('0x34')][_0xe521('0x19')](_0x5b8f42[_0xe521('0x1a')],{'raw':_0x5b8f42[_0xe521('0x7')]?_0x5b8f42[_0xe521('0x7')][_0xe521('0x8')]===undefined?!![]:![]:!![],'transaction':_0x5de8aa})[_0xe521('0x15')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5b8f42[_0xe521('0x7')][_0xe521('0x9')]),_0x5b8f42[_0xe521('0x7')][_0xe521('0x9')][_0xe521('0x1e')]);return db['CmHopper'][_0xe521('0x20')]({'where':_0x5b8f42['options']?_0x5b8f42[_0xe521('0x7')][_0xe521('0x9')]||null:null,'transaction':_0x5de8aa});});})[_0xe521('0x15')](function(_0x3f00c5){logger['info'](_0xe521('0x31'),_0x5b8f42);logger['debug'](_0xe521('0x31'),_0x5b8f42,JSON[_0xe521('0x12')](_0x3f00c5));_0x592804(_0x3f00c5);})[_0xe521('0x16')](function(_0x46bee7){logger['error'](_0xe521('0x31'),_0x46bee7[_0xe521('0x17')],_0x5b8f42);_0x25d3b0(_0x5a79fe[_0xe521('0x13')](0x1f4,_0x46bee7[_0xe521('0x17')]));});});};exports[_0xe521('0x35')]=function(_0x220b9c){var _0x3a4845=this;return new Promise(function(_0x585ba7,_0x454f8c){return db['CmHopper'][_0xe521('0x6')]({'raw':_0x220b9c[_0xe521('0x7')]?_0x220b9c[_0xe521('0x7')][_0xe521('0x8')]===undefined?!![]:![]:!![],'where':_0x220b9c[_0xe521('0x7')]?_0x220b9c[_0xe521('0x7')][_0xe521('0x9')]||null:null,'attributes':[[db[_0xe521('0x32')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe521('0x32')][_0xe521('0x36')]('`scheduledat`\x20>=\x20'+util[_0xe521('0x37')](_0xe521('0x38'),moment()[_0xe521('0x37')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xe521('0x39')]]})['then'](function(_0x129727){logger['info'](_0xe521('0x35'),_0x220b9c);logger[_0xe521('0x10')]('CountReScheduled',_0x220b9c,JSON[_0xe521('0x12')](_0x129727));_0x585ba7(_0x129727);})[_0xe521('0x16')](function(_0x5478ad){logger[_0xe521('0x13')](_0xe521('0x35'),_0x5478ad[_0xe521('0x17')],_0x220b9c);_0x454f8c(_0x3a4845[_0xe521('0x13')](0x1f4,_0x5478ad[_0xe521('0x17')]));});});};exports[_0xe521('0x3a')]=function(_0x3bb664){var _0x3fa3ef=this;return new Promise(function(_0x2e8db6,_0x342060){return db[_0xe521('0x22')][_0xe521('0x3b')]()[_0xe521('0x15')](function(){return db['sequelize'][_0xe521('0x33')](function(_0x2303f3){return db[_0xe521('0x5')][_0xe521('0x6')]({'where':_0x3bb664[_0xe521('0x7')]?_0x3bb664[_0xe521('0x7')][_0xe521('0x9')]||null:null,'attributes':_0x3bb664[_0xe521('0x7')]?_0x3bb664[_0xe521('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x3bb664[_0xe521('0x7')]?_0x3bb664['options'][_0xe521('0x23')]||null:null,'group':db[_0xe521('0x5')][_0xe521('0x2b')],'transaction':_0x2303f3,'lock':_0x2303f3[_0xe521('0x24')][_0xe521('0x25')],'include':_0x3bb664[_0xe521('0x7')]?_0x3bb664[_0xe521('0x7')]['include']?_[_0xe521('0xe')](_0x3bb664[_0xe521('0x7')]['include'],function(_0x12a165){return{'model':db[_0x12a165[_0xe521('0xd')]],'as':_0x12a165['as'],'attributes':_0x12a165[_0xe521('0xa')],'include':_0x12a165[_0xe521('0xc')]?_[_0xe521('0xe')](_0x12a165[_0xe521('0xc')],function(_0x358eac){return{'model':db[_0x358eac[_0xe521('0xd')]],'as':_0x358eac['as'],'attributes':_0x358eac[_0xe521('0xa')],'include':_0x358eac['include']?_[_0xe521('0xe')](_0x358eac[_0xe521('0xc')],function(_0x1acafe){return{'model':db[_0x1acafe[_0xe521('0xd')]],'as':_0x1acafe['as'],'attributes':_0x1acafe[_0xe521('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c817c){var _0xe9d962=[];for(var _0x3758fc=0x0;_0x3758fc<_0x4c817c['length'];_0x3758fc+=0x1){_0xe9d962[_0xe521('0x2c')](_0x4c817c[_0x3758fc][_0xe521('0x1c')](_0x3bb664['body'],{'transaction':_0x2303f3}));}return BPromise[_0xe521('0x3c')](_0xe9d962);});})[_0xe521('0x15')](function(_0x5df1a3){logger[_0xe521('0xf')](_0xe521('0x3a'),_0x3bb664);logger[_0xe521('0x10')](_0xe521('0x3a'),_0x3bb664,JSON[_0xe521('0x12')](_0x5df1a3));_0x2e8db6(_0x5df1a3);})[_0xe521('0x16')](function(_0x5adeb6){logger[_0xe521('0x13')](_0xe521('0x3a'),_0x5adeb6['message'],_0x3bb664);_0x342060(_0x3fa3ef[_0xe521('0x13')](0x1f4,_0x5adeb6[_0xe521('0x17')]));});});});};exports[_0xe521('0x3d')]=function(_0x3066f6){var _0x4d0d4c=this;return new Promise(function(_0x44716c,_0x5b21fb){db[_0xe521('0x22')][_0xe521('0x3b')]()[_0xe521('0x15')](function(_0x361fd8){return db[_0xe521('0x5')][_0xe521('0x6')]({'raw':_0x3066f6['options']?_0x3066f6[_0xe521('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x3066f6[_0xe521('0x7')]?_0x3066f6[_0xe521('0x7')][_0xe521('0x9')]||null:null,'attributes':_0x3066f6[_0xe521('0x7')]?_0x3066f6[_0xe521('0x7')][_0xe521('0xa')]||null:null,'limit':_0x3066f6['options']?_0x3066f6[_0xe521('0x7')]['limit']||null:null,'include':_0x3066f6['options']?_0x3066f6[_0xe521('0x7')]['include']?_['map'](_0x3066f6[_0xe521('0x7')][_0xe521('0xc')],function(_0x59726f){return{'model':db[_0x59726f['model']],'as':_0x59726f['as'],'attributes':_0x59726f['as']==='Contact'?_[_0xe521('0x27')](_0x361fd8):_0x59726f[_0xe521('0xa')],'include':_0x59726f[_0xe521('0xc')]?_['map'](_0x59726f[_0xe521('0xc')],function(_0x4d59d5){return{'model':db[_0x4d59d5['model']],'as':_0x4d59d5['as'],'attributes':_0x4d59d5[_0xe521('0xa')],'include':_0x4d59d5[_0xe521('0xc')]?_['map'](_0x4d59d5[_0xe521('0xc')],function(_0x4fe9d8){return{'model':db[_0x4fe9d8[_0xe521('0xd')]],'as':_0x4fe9d8['as'],'attributes':_0x4fe9d8[_0xe521('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe521('0x15')](function(_0x18ad50){logger[_0xe521('0xf')]('GetCmHopper',_0x3066f6);logger[_0xe521('0x10')](_0xe521('0x11'),_0x3066f6,JSON[_0xe521('0x12')](_0x18ad50));_0x44716c(_0x18ad50);})[_0xe521('0x16')](function(_0x4b3e03){logger[_0xe521('0x13')](_0xe521('0x11'),_0x4b3e03[_0xe521('0x17')],_0x3066f6);_0x5b21fb(_0x4d0d4c[_0xe521('0x13')](0x1f4,_0x4b3e03[_0xe521('0x17')]));});});});};exports[_0xe521('0x3e')]=function(_0x5db214){var _0x2c3cc9=this;return new Promise(function(_0x1dae9b,_0x52e796){return db[_0xe521('0x22')][_0xe521('0x3f')]({'raw':!![],'where':{'phone':_0x5db214[_0xe521('0x7')][_0xe521('0x9')][_0xe521('0x40')]},'attributes':['id',_0xe521('0x41')],'order':[['id',_0xe521('0x42')]]})[_0xe521('0x15')](function(_0x1b5b81){logger[_0xe521('0xf')]('getContactByPhone',_0x5db214);logger[_0xe521('0x10')](_0xe521('0x43'),_0x5db214,JSON[_0xe521('0x12')](_0x1b5b81));_0x1dae9b(_0x1b5b81);})[_0xe521('0x16')](function(_0x59c2b4){logger[_0xe521('0x13')](_0xe521('0x43'),_0x59c2b4[_0xe521('0x17')],_0x5db214);_0x52e796(_0x2c3cc9[_0xe521('0x13')](0x1f4,_0x59c2b4['message']));});});};exports[_0xe521('0x44')]=function(_0x254b8d){var _0x357d31=this;return new Promise(function(_0x42b666,_0x4ca0c3){return db[_0xe521('0x32')][_0xe521('0x33')](function(_0x649175){var _0x1e4fb4=_0x254b8d[_0xe521('0x7')]&&_0x254b8d[_0xe521('0x7')]['where']?_0x254b8d[_0xe521('0x7')][_0xe521('0x9')]:{};return db[_0xe521('0x5')][_0xe521('0x1c')](_0x254b8d[_0xe521('0x1a')],{'where':_0x1e4fb4,'transaction':_0x649175})[_0xe521('0x15')](function(_0x2839c0){logger[_0xe521('0xf')](_0xe521('0x44'),_0x254b8d);logger['debug']('ResetActiveCalls',_0x254b8d,JSON['stringify'](_0x2839c0));_0x42b666(_0x2839c0);})['catch'](function(_0x5c49c2){logger['error'](_0xe521('0x44'),_0x5c49c2[_0xe521('0x17')],_0x254b8d);_0x4ca0c3(_0x357d31[_0xe521('0x13')](0x1f4,_0x5c49c2[_0xe521('0x17')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x13df65){var _0x1ff398=this;var _0x49636c=_0x13df65['body']['where'][_0xe521('0x45')];var _0x403102=_0x13df65[_0xe521('0x1a')][_0xe521('0x9')][_0xe521('0x46')];var _0x4c872a=_0x13df65[_0xe521('0x1a')]['where']['availableAgentsIds'];return new Promise(function(_0x36fcbf,_0x3e1b0e){return db[_0xe521('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x49636c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe521('0x32')][_0xe521('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x403102+_0xe521('0x47')),'$gt':db[_0xe521('0x32')][_0xe521('0x36')](_0xe521('0x48'))}},'UserId':{'$in':_0x4c872a}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db['User'],'as':'Agent','attributes':['id',_0xe521('0x49'),'voicePause']},{'model':db['CmList'],'as':_0xe521('0x4a')}]})['then'](function(_0x42ecda){if(_0x42ecda['length']>0x0){return db[_0xe521('0x32')][_0xe521('0x33')](function(_0x3e7392){return db[_0xe521('0x5')][_0xe521('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0xe521('0x36')](_0xe521('0x48'))},{'where':{'id':{'$in':_['map'](_0x42ecda,'id')}},'transaction':_0x3e7392})[_0xe521('0x15')](function(){_0x36fcbf(_0x42ecda);})['catch'](function(_0xe5fe8d){logger[_0xe521('0x13')]('CmHopperHandlePreviewRecallNotifications',_0xe5fe8d['message'],_0x13df65);_0x3e1b0e(_0x1ff398['error'](0x1f4,_0xe5fe8d[_0xe521('0x17')]));});})[_0xe521('0x16')](function(_0x50ded3){logger[_0xe521('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x50ded3[_0xe521('0x17')],_0x13df65);_0x3e1b0e(_0x1ff398[_0xe521('0x13')](0x1f4,_0x50ded3['message']));});}else{_0x36fcbf(_0x42ecda);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c04d872..c0f638a 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 _0xe496=['/describe','describe','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','destroy','exports','../../components/auth/service','./cmHopper.controller','get','isAuthenticated'];(function(_0x5587ff,_0x29a96e){var _0x1d5d4f=function(_0x13d1ab){while(--_0x13d1ab){_0x5587ff['push'](_0x5587ff['shift']());}};_0x1d5d4f(++_0x29a96e);}(_0xe496,0x1dc));var _0x6e49=function(_0x4aa125,_0x26a805){_0x4aa125=_0x4aa125-0x0;var _0x59f95a=_0xe496[_0x4aa125];return _0x59f95a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6e49('0x0'));var controller=require(_0x6e49('0x1'));router[_0x6e49('0x2')]('/',auth[_0x6e49('0x3')](),controller['index']);router['get'](_0x6e49('0x4'),auth[_0x6e49('0x3')](),controller[_0x6e49('0x5')]);router['get']('/opencontacts',auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x6e49('0x2')](_0x6e49('0x6'),auth['isAuthenticated'](),controller[_0x6e49('0x7')]);router[_0x6e49('0x2')](_0x6e49('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6e49('0x2')](_0x6e49('0x9'),auth[_0x6e49('0x3')](),controller[_0x6e49('0xa')]);router[_0x6e49('0xb')]('/',auth[_0x6e49('0x3')](),controller[_0x6e49('0xc')]);router['post'](_0x6e49('0xd'),auth['isAuthenticated'](),controller[_0x6e49('0xe')]);router[_0x6e49('0xb')]('/timezone',auth[_0x6e49('0x3')](),controller[_0x6e49('0xf')]);router[_0x6e49('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6e49('0x11')]);router['delete'](_0x6e49('0x8'),auth[_0x6e49('0x3')](),controller[_0x6e49('0x12')]);module[_0x6e49('0x13')]=router; \ No newline at end of file +var _0xe3c0=['describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe'];(function(_0x4d76d0,_0xc0ab1c){var _0x2b5066=function(_0x409c4d){while(--_0x409c4d){_0x4d76d0['push'](_0x4d76d0['shift']());}};_0x2b5066(++_0xc0ab1c);}(_0xe3c0,0x165));var _0x0e3c=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe3c0[_0x45e98e];return _0x374dba;};'use strict';var express=require('express');var router=express[_0x0e3c('0x0')]();var auth=require(_0x0e3c('0x1'));var controller=require(_0x0e3c('0x2'));router[_0x0e3c('0x3')]('/',auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x5')]);router[_0x0e3c('0x3')](_0x0e3c('0x6'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x7')]);router[_0x0e3c('0x3')](_0x0e3c('0x8'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x9')]);router[_0x0e3c('0x3')](_0x0e3c('0xa'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0xb')]);router[_0x0e3c('0x3')]('/:id',auth[_0x0e3c('0x4')](),controller[_0x0e3c('0xc')]);router[_0x0e3c('0x3')](_0x0e3c('0xd'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0xe')]);router[_0x0e3c('0xf')]('/',auth[_0x0e3c('0x4')](),controller['create']);router[_0x0e3c('0xf')](_0x0e3c('0x10'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x11')]);router[_0x0e3c('0xf')](_0x0e3c('0x12'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x13')]);router[_0x0e3c('0x14')](_0x0e3c('0x15'),auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x16')]);router[_0x0e3c('0x17')]('/:id',auth[_0x0e3c('0x4')](),controller[_0x0e3c('0x18')]);module[_0x0e3c('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index d34bab9..ee270f6 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 _0x4334=['sequelize','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x4334,0xd1));var _0x4433=function(_0x172d0d,_0x35b35a){_0x172d0d=_0x172d0d-0x0;var _0x5963f2=_0x4334[_0x172d0d];return _0x5963f2;};'use strict';var moment=require(_0x4433('0x0'));var Sequelize=require(_0x4433('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x4433('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4433('0x4')],'defaultValue':moment()[_0x4433('0x5')](_0x4433('0x6'))},'countbusyretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4433('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0a3=['INTEGER','DATE','moment','sequelize','STRING'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xb0a3,0x110));var _0x3b0a=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xb0a3[_0x37d0bc];return _0x170e60;};'use strict';var moment=require(_0x3b0a('0x0'));var Sequelize=require(_0x3b0a('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x3b0a('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3b0a('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3b0a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index bb34595..5fc644a 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 _0xd844=['status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','CmHopperAdditionalPhones','UserProfileResource','then','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xd844,0x1f1));var _0x4d84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd844[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x4d84('0x0'));var rimraf=require(_0x4d84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d84('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d84('0x3'));var Mustache=require(_0x4d84('0x4'));var util=require(_0x4d84('0x5'));var path=require(_0x4d84('0x6'));var sox=require(_0x4d84('0x7'));var csv=require(_0x4d84('0x8'));var ejs=require(_0x4d84('0x9'));var fs=require('fs');var fs_extra=require(_0x4d84('0xa'));var _=require(_0x4d84('0xb'));var squel=require(_0x4d84('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d84('0xd'));var toCsv=require(_0x4d84('0x8'));var querystring=require(_0x4d84('0xe'));var Papa=require(_0x4d84('0xf'));var Redis=require(_0x4d84('0x10'));var authService=require(_0x4d84('0x11'));var qs=require(_0x4d84('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d84('0x13'));var logger=require(_0x4d84('0x14'))(_0x4d84('0x15'));var utils=require(_0x4d84('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4d84('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33ad8e,_0x5c9bec){_0x5c9bec=_0x5c9bec||0xcc;return function(_0x1b3b4c){if(_0x1b3b4c){return _0x33ad8e[_0x4d84('0x18')](_0x5c9bec);}return _0x33ad8e[_0x4d84('0x19')](_0x5c9bec)[_0x4d84('0x1a')]();};}function respondWithResult(_0xe57fe1,_0x484f8a){_0x484f8a=_0x484f8a||0xc8;return function(_0x10ef9a){if(_0x10ef9a){return _0xe57fe1['status'](_0x484f8a)[_0x4d84('0x1b')](_0x10ef9a);}};}function respondWithFilteredResult(_0x32df4c,_0x4dd119){return function(_0x3ad26e){if(_0x3ad26e){var _0x22aefa=typeof _0x4dd119[_0x4d84('0x1c')]===_0x4d84('0x1d')&&typeof _0x4dd119[_0x4d84('0x1e')]===_0x4d84('0x1d');var _0x57be8b=_0x3ad26e['count'];var _0x40fa39=_0x22aefa?0x0:_0x4dd119[_0x4d84('0x1c')];var _0x374ae3=_0x22aefa?_0x3ad26e['count']:_0x4dd119[_0x4d84('0x1c')]+_0x4dd119[_0x4d84('0x1e')];var _0x4e50ba;if(_0x374ae3>=_0x57be8b){_0x374ae3=_0x57be8b;_0x4e50ba=0xc8;}else{_0x4e50ba=0xce;}_0x32df4c[_0x4d84('0x19')](_0x4e50ba);return _0x32df4c[_0x4d84('0x1f')](_0x4d84('0x20'),_0x40fa39+'-'+_0x374ae3+'/'+_0x57be8b)['json'](_0x3ad26e);}return null;};}function patchUpdates(_0x4a21b4){return function(_0x3c569e){try{jsonpatch[_0x4d84('0x21')](_0x3c569e,_0x4a21b4,!![]);}catch(_0x2e5226){return BPromise[_0x4d84('0x22')](_0x2e5226);}return _0x3c569e[_0x4d84('0x23')]();};}function saveUpdates(_0x273ab2,_0x341fd0){return function(_0x2c5872){if(_0x2c5872){return _0x2c5872['update'](_0x273ab2)['then'](function(_0x558516){return _0x558516;});}return null;};}function removeEntity(_0xae5f11,_0x5de66c){return function(_0x2c86d0){if(_0x2c86d0){return _0x2c86d0['destroy']()['then'](function(){var _0x1abe9b=_0x2c86d0['get']({'plain':!![]});var _0x3bc0eb=_0x4d84('0x24');return db[_0x4d84('0x25')]['destroy']({'where':{'type':_0x3bc0eb,'resourceId':_0x1abe9b['id']}})[_0x4d84('0x26')](function(){return _0x2c86d0;});})[_0x4d84('0x26')](function(){_0xae5f11[_0x4d84('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x338d27,_0x2caccf){return function(_0x522298){if(!_0x522298){_0x338d27[_0x4d84('0x18')](0x194);}return _0x522298;};}function handleError(_0x26840f,_0x303e41){_0x303e41=_0x303e41||0x1f4;return function(_0x372243){logger[_0x4d84('0x27')](_0x372243[_0x4d84('0x28')]);if(_0x372243[_0x4d84('0x29')]){delete _0x372243[_0x4d84('0x29')];}_0x26840f[_0x4d84('0x19')](_0x303e41)[_0x4d84('0x2a')](_0x372243);};}exports[_0x4d84('0x2b')]=function(_0x9cd797,_0x509698){var _0x2ec32b={},_0x555bcd={},_0x592795={'count':0x0,'rows':[]};var _0x4b6357=_['map'](db[_0x4d84('0x2c')][_0x4d84('0x2d')],function(_0x3a049b){return{'name':_0x3a049b[_0x4d84('0x2e')],'type':_0x3a049b[_0x4d84('0x2f')][_0x4d84('0x30')]};});_0x555bcd[_0x4d84('0x31')]=_[_0x4d84('0x32')](_0x4b6357,'name');_0x555bcd[_0x4d84('0x33')]=_[_0x4d84('0x34')](_0x9cd797[_0x4d84('0x33')]);_0x555bcd[_0x4d84('0x35')]=_[_0x4d84('0x36')](_0x555bcd[_0x4d84('0x31')],_0x555bcd[_0x4d84('0x33')]);_0x2ec32b[_0x4d84('0x37')]=_[_0x4d84('0x36')](_0x555bcd[_0x4d84('0x31')],qs[_0x4d84('0x38')](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x38')]));_0x2ec32b[_0x4d84('0x37')]=_0x2ec32b['attributes']['length']?_0x2ec32b['attributes']:_0x555bcd[_0x4d84('0x31')];if(!_0x9cd797[_0x4d84('0x33')]['hasOwnProperty'](_0x4d84('0x39'))){_0x2ec32b['limit']=qs[_0x4d84('0x1e')](_0x9cd797[_0x4d84('0x33')]['limit']);_0x2ec32b['offset']=qs['offset'](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x1c')]);}_0x2ec32b[_0x4d84('0x3a')]=qs[_0x4d84('0x3b')](_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3b')]);_0x2ec32b['where']=qs['filters'](_[_0x4d84('0x3c')](_0x9cd797['query'],_0x555bcd[_0x4d84('0x35')]),_0x4b6357);if(_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3d')]){_0x2ec32b[_0x4d84('0x3e')]=_[_0x4d84('0x3f')](_0x2ec32b[_0x4d84('0x3e')],{'$or':_['map'](_0x4b6357,function(_0x381feb){if(_0x381feb[_0x4d84('0x2f')]!==_0x4d84('0x40')){var _0x1d496a={};_0x1d496a[_0x381feb[_0x4d84('0x29')]]={'$like':'%'+_0x9cd797[_0x4d84('0x33')][_0x4d84('0x3d')]+'%'};return _0x1d496a;}})});}_0x2ec32b=_[_0x4d84('0x3f')]({},_0x2ec32b,_0x9cd797[_0x4d84('0x41')]);var _0xdfba4a={'where':_0x2ec32b['where']};return db[_0x4d84('0x2c')][_0x4d84('0x42')](_0xdfba4a)[_0x4d84('0x26')](function(_0x1ad45a){_0x592795[_0x4d84('0x42')]=_0x1ad45a;if(_0x9cd797['query'][_0x4d84('0x43')]){_0x2ec32b[_0x4d84('0x44')]=[{'all':!![]}];}return db[_0x4d84('0x2c')][_0x4d84('0x45')](_0x2ec32b);})[_0x4d84('0x26')](function(_0x301b88){_0x592795[_0x4d84('0x46')]=_0x301b88;return _0x592795;})['then'](respondWithFilteredResult(_0x509698,_0x2ec32b))[_0x4d84('0x47')](handleError(_0x509698,null));};exports['show']=function(_0x5d5613,_0x44ff14){var _0x15e0e9={'raw':!![],'where':{'id':_0x5d5613['params']['id']}},_0x433536={};_0x433536[_0x4d84('0x31')]=_[_0x4d84('0x34')](db['CmHopperAdditionalPhone'][_0x4d84('0x2d')]);_0x433536[_0x4d84('0x33')]=_[_0x4d84('0x34')](_0x5d5613[_0x4d84('0x33')]);_0x433536[_0x4d84('0x35')]=_['intersection'](_0x433536['model'],_0x433536[_0x4d84('0x33')]);_0x15e0e9['attributes']=_['intersection'](_0x433536[_0x4d84('0x31')],qs[_0x4d84('0x38')](_0x5d5613[_0x4d84('0x33')][_0x4d84('0x38')]));_0x15e0e9['attributes']=_0x15e0e9[_0x4d84('0x37')][_0x4d84('0x48')]?_0x15e0e9[_0x4d84('0x37')]:_0x433536[_0x4d84('0x31')];if(_0x5d5613[_0x4d84('0x33')][_0x4d84('0x43')]){_0x15e0e9['include']=[{'all':!![]}];}_0x15e0e9=_['merge']({},_0x15e0e9,_0x5d5613[_0x4d84('0x41')]);return db[_0x4d84('0x2c')][_0x4d84('0x49')](_0x15e0e9)['then'](handleEntityNotFound(_0x44ff14,null))['then'](respondWithResult(_0x44ff14,null))[_0x4d84('0x47')](handleError(_0x44ff14,null));};exports[_0x4d84('0x4a')]=function(_0x6f6801,_0x2f5537){return db[_0x4d84('0x2c')]['create'](_0x6f6801[_0x4d84('0x4b')],{})[_0x4d84('0x26')](function(_0x55cd56){var _0x4f6eb4=_0x6f6801[_0x4d84('0x4c')]['get']({'plain':!![]});if(!_0x4f6eb4)throw new Error(_0x4d84('0x4d'));if(_0x4f6eb4[_0x4d84('0x4e')]===_0x4d84('0x4c')){var _0x4e40a2=_0x55cd56[_0x4d84('0x4f')]({'plain':!![]});var _0x1ebebf='CmHopperAdditionalPhones';return db[_0x4d84('0x50')][_0x4d84('0x49')]({'where':{'name':_0x1ebebf,'userProfileId':_0x4f6eb4[_0x4d84('0x51')]},'raw':!![]})['then'](function(_0x4ab6fa){if(_0x4ab6fa&&_0x4ab6fa[_0x4d84('0x52')]===0x0){return db[_0x4d84('0x25')][_0x4d84('0x4a')]({'name':_0x4e40a2[_0x4d84('0x29')],'resourceId':_0x4e40a2['id'],'type':_0x4ab6fa[_0x4d84('0x29')],'sectionId':_0x4ab6fa['id']},{})[_0x4d84('0x26')](function(){return _0x55cd56;});}else{return _0x55cd56;}})[_0x4d84('0x47')](function(_0x48fa66){logger[_0x4d84('0x27')](_0x4d84('0x53'),_0x48fa66);throw _0x48fa66;});}return _0x55cd56;})[_0x4d84('0x26')](respondWithResult(_0x2f5537,0xc9))['catch'](handleError(_0x2f5537,null));};exports[_0x4d84('0x54')]=function(_0x4d2835,_0x2f539e){if(_0x4d2835[_0x4d84('0x4b')]['id']){delete _0x4d2835[_0x4d84('0x4b')]['id'];}return db[_0x4d84('0x2c')][_0x4d84('0x49')]({'where':{'id':_0x4d2835[_0x4d84('0x55')]['id']}})[_0x4d84('0x26')](handleEntityNotFound(_0x2f539e,null))[_0x4d84('0x26')](saveUpdates(_0x4d2835[_0x4d84('0x4b')],null))[_0x4d84('0x26')](respondWithResult(_0x2f539e,null))[_0x4d84('0x47')](handleError(_0x2f539e,null));};exports[_0x4d84('0x56')]=function(_0x2ddaec,_0x42010a){return db[_0x4d84('0x2c')]['find']({'where':{'id':_0x2ddaec['params']['id']}})['then'](handleEntityNotFound(_0x42010a,null))[_0x4d84('0x26')](removeEntity(_0x42010a,null))[_0x4d84('0x47')](handleError(_0x42010a,null));}; \ No newline at end of file +var _0x606c=['get','CmHopperAdditionalPhones','UserProfileResource','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x606c,0x121));var _0xc606=function(_0x2b49bc,_0x47b636){_0x2b49bc=_0x2b49bc-0x0;var _0x43cc65=_0x606c[_0x2b49bc];return _0x43cc65;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc606('0x0'));var jsonpatch=require(_0xc606('0x1'));var rp=require(_0xc606('0x2'));var moment=require('moment');var BPromise=require(_0xc606('0x3'));var Mustache=require(_0xc606('0x4'));var util=require(_0xc606('0x5'));var path=require('path');var sox=require(_0xc606('0x6'));var csv=require('to-csv');var ejs=require(_0xc606('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc606('0x8'));var squel=require(_0xc606('0x9'));var crypto=require(_0xc606('0xa'));var jsforce=require(_0xc606('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc606('0xc'));var querystring=require(_0xc606('0xd'));var Papa=require(_0xc606('0xe'));var Redis=require('ioredis');var authService=require(_0xc606('0xf'));var qs=require(_0xc606('0x10'));var as=require(_0xc606('0x11'));var hardwareService=require(_0xc606('0x12'));var logger=require(_0xc606('0x13'))(_0xc606('0x14'));var utils=require(_0xc606('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc606('0x16'));var db=require(_0xc606('0x17'))['db'];function respondWithStatusCode(_0x4abb30,_0x4bd822){_0x4bd822=_0x4bd822||0xcc;return function(_0x42c3ff){if(_0x42c3ff){return _0x4abb30[_0xc606('0x18')](_0x4bd822);}return _0x4abb30['status'](_0x4bd822)[_0xc606('0x19')]();};}function respondWithResult(_0x4cc2ce,_0x2621b6){_0x2621b6=_0x2621b6||0xc8;return function(_0x54c6e1){if(_0x54c6e1){return _0x4cc2ce[_0xc606('0x1a')](_0x2621b6)[_0xc606('0x1b')](_0x54c6e1);}};}function respondWithFilteredResult(_0x5a0ffd,_0x3072c1){return function(_0x270a4d){if(_0x270a4d){var _0x1f952c=typeof _0x3072c1[_0xc606('0x1c')]===_0xc606('0x1d')&&typeof _0x3072c1[_0xc606('0x1e')]==='undefined';var _0x4d8ef1=_0x270a4d['count'];var _0x2d25a0=_0x1f952c?0x0:_0x3072c1[_0xc606('0x1c')];var _0x232161=_0x1f952c?_0x270a4d[_0xc606('0x1f')]:_0x3072c1['offset']+_0x3072c1['limit'];var _0x1d3038;if(_0x232161>=_0x4d8ef1){_0x232161=_0x4d8ef1;_0x1d3038=0xc8;}else{_0x1d3038=0xce;}_0x5a0ffd[_0xc606('0x1a')](_0x1d3038);return _0x5a0ffd['set'](_0xc606('0x20'),_0x2d25a0+'-'+_0x232161+'/'+_0x4d8ef1)[_0xc606('0x1b')](_0x270a4d);}return null;};}function patchUpdates(_0x38d327){return function(_0x26958d){try{jsonpatch[_0xc606('0x21')](_0x26958d,_0x38d327,!![]);}catch(_0x29b723){return BPromise[_0xc606('0x22')](_0x29b723);}return _0x26958d[_0xc606('0x23')]();};}function saveUpdates(_0x46d827,_0x5b7463){return function(_0x9ceeb7){if(_0x9ceeb7){return _0x9ceeb7[_0xc606('0x24')](_0x46d827)[_0xc606('0x25')](function(_0x4c8ad8){return _0x4c8ad8;});}return null;};}function removeEntity(_0x201bdd,_0x6a0159){return function(_0x343bf5){if(_0x343bf5){return _0x343bf5[_0xc606('0x26')]()[_0xc606('0x25')](function(){var _0x398a36=_0x343bf5[_0xc606('0x27')]({'plain':!![]});var _0x4c0a0d=_0xc606('0x28');return db[_0xc606('0x29')][_0xc606('0x26')]({'where':{'type':_0x4c0a0d,'resourceId':_0x398a36['id']}})[_0xc606('0x25')](function(){return _0x343bf5;});})[_0xc606('0x25')](function(){_0x201bdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5229d3,_0x3ff9dd){return function(_0x229c6d){if(!_0x229c6d){_0x5229d3[_0xc606('0x18')](0x194);}return _0x229c6d;};}function handleError(_0x525179,_0x5a5673){_0x5a5673=_0x5a5673||0x1f4;return function(_0x5ed7f7){logger['error'](_0x5ed7f7['stack']);if(_0x5ed7f7[_0xc606('0x2a')]){delete _0x5ed7f7[_0xc606('0x2a')];}_0x525179[_0xc606('0x1a')](_0x5a5673)[_0xc606('0x2b')](_0x5ed7f7);};}exports[_0xc606('0x2c')]=function(_0x15555e,_0x5d8f2f){var _0x3a6191={},_0x492635={},_0x16ebae={'count':0x0,'rows':[]};var _0x109ded=_[_0xc606('0x2d')](db[_0xc606('0x2e')][_0xc606('0x2f')],function(_0x3c8e93){return{'name':_0x3c8e93['fieldName'],'type':_0x3c8e93[_0xc606('0x30')][_0xc606('0x31')]};});_0x492635[_0xc606('0x32')]=_[_0xc606('0x2d')](_0x109ded,_0xc606('0x2a'));_0x492635[_0xc606('0x33')]=_[_0xc606('0x34')](_0x15555e[_0xc606('0x33')]);_0x492635[_0xc606('0x35')]=_['intersection'](_0x492635['model'],_0x492635[_0xc606('0x33')]);_0x3a6191['attributes']=_[_0xc606('0x36')](_0x492635['model'],qs[_0xc606('0x37')](_0x15555e['query'][_0xc606('0x37')]));_0x3a6191['attributes']=_0x3a6191[_0xc606('0x38')][_0xc606('0x39')]?_0x3a6191[_0xc606('0x38')]:_0x492635[_0xc606('0x32')];if(!_0x15555e[_0xc606('0x33')][_0xc606('0x3a')](_0xc606('0x3b'))){_0x3a6191['limit']=qs[_0xc606('0x1e')](_0x15555e[_0xc606('0x33')][_0xc606('0x1e')]);_0x3a6191[_0xc606('0x1c')]=qs[_0xc606('0x1c')](_0x15555e['query'][_0xc606('0x1c')]);}_0x3a6191[_0xc606('0x3c')]=qs[_0xc606('0x3d')](_0x15555e[_0xc606('0x33')][_0xc606('0x3d')]);_0x3a6191['where']=qs[_0xc606('0x35')](_[_0xc606('0x3e')](_0x15555e[_0xc606('0x33')],_0x492635[_0xc606('0x35')]),_0x109ded);if(_0x15555e['query']['filter']){_0x3a6191[_0xc606('0x3f')]=_[_0xc606('0x40')](_0x3a6191['where'],{'$or':_['map'](_0x109ded,function(_0x4ac2d9){if(_0x4ac2d9[_0xc606('0x30')]!==_0xc606('0x41')){var _0x245600={};_0x245600[_0x4ac2d9[_0xc606('0x2a')]]={'$like':'%'+_0x15555e[_0xc606('0x33')][_0xc606('0x42')]+'%'};return _0x245600;}})});}_0x3a6191=_[_0xc606('0x40')]({},_0x3a6191,_0x15555e[_0xc606('0x43')]);var _0x508a71={'where':_0x3a6191[_0xc606('0x3f')]};return db[_0xc606('0x2e')]['count'](_0x508a71)[_0xc606('0x25')](function(_0x3dacdc){_0x16ebae['count']=_0x3dacdc;if(_0x15555e[_0xc606('0x33')][_0xc606('0x44')]){_0x3a6191['include']=[{'all':!![]}];}return db[_0xc606('0x2e')][_0xc606('0x45')](_0x3a6191);})[_0xc606('0x25')](function(_0x34732b){_0x16ebae['rows']=_0x34732b;return _0x16ebae;})[_0xc606('0x25')](respondWithFilteredResult(_0x5d8f2f,_0x3a6191))[_0xc606('0x46')](handleError(_0x5d8f2f,null));};exports[_0xc606('0x47')]=function(_0xe1b97f,_0x3054d6){var _0x390b95={'raw':!![],'where':{'id':_0xe1b97f[_0xc606('0x48')]['id']}},_0x22e7f3={};_0x22e7f3[_0xc606('0x32')]=_['keys'](db[_0xc606('0x2e')][_0xc606('0x2f')]);_0x22e7f3[_0xc606('0x33')]=_['keys'](_0xe1b97f[_0xc606('0x33')]);_0x22e7f3['filters']=_['intersection'](_0x22e7f3[_0xc606('0x32')],_0x22e7f3['query']);_0x390b95[_0xc606('0x38')]=_[_0xc606('0x36')](_0x22e7f3[_0xc606('0x32')],qs['fields'](_0xe1b97f[_0xc606('0x33')][_0xc606('0x37')]));_0x390b95[_0xc606('0x38')]=_0x390b95[_0xc606('0x38')][_0xc606('0x39')]?_0x390b95[_0xc606('0x38')]:_0x22e7f3[_0xc606('0x32')];if(_0xe1b97f[_0xc606('0x33')]['includeAll']){_0x390b95[_0xc606('0x49')]=[{'all':!![]}];}_0x390b95=_[_0xc606('0x40')]({},_0x390b95,_0xe1b97f[_0xc606('0x43')]);return db[_0xc606('0x2e')][_0xc606('0x4a')](_0x390b95)[_0xc606('0x25')](handleEntityNotFound(_0x3054d6,null))[_0xc606('0x25')](respondWithResult(_0x3054d6,null))[_0xc606('0x46')](handleError(_0x3054d6,null));};exports[_0xc606('0x4b')]=function(_0x4f0ad5,_0x30030a){return db[_0xc606('0x2e')][_0xc606('0x4b')](_0x4f0ad5[_0xc606('0x4c')],{})['then'](function(_0x291314){var _0x2de730=_0x4f0ad5[_0xc606('0x4d')][_0xc606('0x27')]({'plain':!![]});if(!_0x2de730)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2de730[_0xc606('0x4e')]===_0xc606('0x4d')){var _0x5323d7=_0x291314['get']({'plain':!![]});var _0x33f313=_0xc606('0x28');return db[_0xc606('0x4f')]['find']({'where':{'name':_0x33f313,'userProfileId':_0x2de730['userProfileId']},'raw':!![]})[_0xc606('0x25')](function(_0x3a71d1){if(_0x3a71d1&&_0x3a71d1[_0xc606('0x50')]===0x0){return db[_0xc606('0x29')][_0xc606('0x4b')]({'name':_0x5323d7[_0xc606('0x2a')],'resourceId':_0x5323d7['id'],'type':_0x3a71d1[_0xc606('0x2a')],'sectionId':_0x3a71d1['id']},{})[_0xc606('0x25')](function(){return _0x291314;});}else{return _0x291314;}})[_0xc606('0x46')](function(_0x4b99f9){logger['error'](_0xc606('0x51'),_0x4b99f9);throw _0x4b99f9;});}return _0x291314;})[_0xc606('0x25')](respondWithResult(_0x30030a,0xc9))[_0xc606('0x46')](handleError(_0x30030a,null));};exports[_0xc606('0x24')]=function(_0x1a544a,_0x13d8bf){if(_0x1a544a[_0xc606('0x4c')]['id']){delete _0x1a544a[_0xc606('0x4c')]['id'];}return db[_0xc606('0x2e')][_0xc606('0x4a')]({'where':{'id':_0x1a544a[_0xc606('0x48')]['id']}})[_0xc606('0x25')](handleEntityNotFound(_0x13d8bf,null))[_0xc606('0x25')](saveUpdates(_0x1a544a['body'],null))['then'](respondWithResult(_0x13d8bf,null))['catch'](handleError(_0x13d8bf,null));};exports[_0xc606('0x26')]=function(_0x5052c8,_0x33855c){return db[_0xc606('0x2e')][_0xc606('0x4a')]({'where':{'id':_0x5052c8[_0xc606('0x48')]['id']}})[_0xc606('0x25')](handleEntityNotFound(_0x33855c,null))[_0xc606('0x25')](removeEntity(_0x33855c,null))['catch'](handleError(_0x33855c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 68f4ae9..7e03afa 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 _0xee73=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','cm_hopper_additional_phones','lodash'];(function(_0x334f3b,_0x41b8ee){var _0x5b792e=function(_0x3d850d){while(--_0x3d850d){_0x334f3b['push'](_0x334f3b['shift']());}};_0x5b792e(++_0x41b8ee);}(_0xee73,0x196));var _0x3ee7=function(_0x32659d,_0x58ece9){_0x32659d=_0x32659d-0x0;var _0x10d610=_0xee73[_0x32659d];return _0x10d610;};'use strict';var _=require(_0x3ee7('0x0'));var util=require(_0x3ee7('0x1'));var logger=require(_0x3ee7('0x2'))(_0x3ee7('0x3'));var moment=require(_0x3ee7('0x4'));var BPromise=require(_0x3ee7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ee7('0x6'));var rimraf=require(_0x3ee7('0x7'));var config=require(_0x3ee7('0x8'));var attributes=require(_0x3ee7('0x9'));module['exports']=function(_0x526d2c,_0x226045){return _0x526d2c['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x3ee7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5520=['rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','lodash','util','api','moment','bluebird','path'];(function(_0x91faeb,_0x1e067b){var _0x415778=function(_0x2f0175){while(--_0x2f0175){_0x91faeb['push'](_0x91faeb['shift']());}};_0x415778(++_0x1e067b);}(_0x5520,0x165));var _0x0552=function(_0x533ec3,_0xd62d7d){_0x533ec3=_0x533ec3-0x0;var _0x28d6d8=_0x5520[_0x533ec3];return _0x28d6d8;};'use strict';var _=require(_0x0552('0x0'));var util=require(_0x0552('0x1'));var logger=require('../../config/logger')(_0x0552('0x2'));var moment=require(_0x0552('0x3'));var BPromise=require(_0x0552('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0552('0x5'));var rimraf=require(_0x0552('0x6'));var config=require(_0x0552('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x0552('0x8')]=function(_0x2de367,_0xd8c14a){return _0x2de367[_0x0552('0x9')](_0x0552('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','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 d8b7ea7..5e3ef5b 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 _0x8107=['info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','CmHopper','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','ASC','countmachineretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','field','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x8107,0x109));var _0x7810=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0x8107[_0x1c443f];return _0x4a4a71;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7810('0x0'));var BPromise=require(_0x7810('0x1'));var rs=require(_0x7810('0x2'));var fs=require('fs');var Redis=require(_0x7810('0x3'));var db=require(_0x7810('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7810('0x5'))(_0x7810('0x6'));var config=require(_0x7810('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7810('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e25f2,_0x5b22da,_0x19f6dd){return new BPromise(function(_0x3ee53f,_0x21024f){return client['request'](_0x5e25f2,_0x19f6dd)[_0x7810('0x9')](function(_0x3d0e26){logger[_0x7810('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5b22da,_0x7810('0xb'));logger[_0x7810('0xc')](_0x7810('0xd'),_0x5b22da,_0x7810('0xb'),JSON[_0x7810('0xe')](_0x3d0e26));if(_0x3d0e26[_0x7810('0xf')]){if(_0x3d0e26['error'][_0x7810('0x10')]===0x1f4){logger[_0x7810('0xf')](_0x7810('0x11'),_0x5b22da,_0x3d0e26[_0x7810('0xf')][_0x7810('0x12')]);return _0x21024f(_0x3d0e26[_0x7810('0xf')][_0x7810('0x12')]);}logger['error'](_0x7810('0x11'),_0x5b22da,_0x3d0e26['error'][_0x7810('0x12')]);return _0x3ee53f(_0x3d0e26['error'][_0x7810('0x12')]);}else{logger[_0x7810('0xa')](_0x7810('0x11'),_0x5b22da,_0x7810('0xb'));_0x3ee53f(_0x3d0e26[_0x7810('0x13')][_0x7810('0x12')]);}})[_0x7810('0x14')](function(_0xa1c10e){logger['error'](_0x7810('0x11'),_0x5b22da,_0xa1c10e);_0x21024f(_0xa1c10e);});});}exports['VerifyAdditionalPhones']=function(_0xd55eed){var _0x1607b9=this;return new Promise(function(_0x1fbeed,_0x9d8b85){return db[_0x7810('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0xd55eed[_0x7810('0x16')]['ContactId'],'ListId':_0xd55eed[_0x7810('0x16')][_0x7810('0x17')],'VoiceQueueId':_0xd55eed[_0x7810('0x16')][_0x7810('0x18')]===undefined?null:_0xd55eed[_0x7810('0x16')][_0x7810('0x18')],'CampaignId':_0xd55eed[_0x7810('0x16')]['CampaignId']===undefined?null:_0xd55eed[_0x7810('0x16')][_0x7810('0x19')]}})[_0x7810('0x9')](function(_0x3233db){if(_0x3233db!=null){return db[_0x7810('0x1a')][_0x7810('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3233db['id'],'OrderBy':{'$gt':_0x3233db['OrderBy']}},'order':[[_0x7810('0x1c'),'ASC']]})[_0x7810('0x9')](function(_0x56cce4){var _0x3a29b7=0x0;if(_0x56cce4){if(_0x56cce4[_0x7810('0x1d')]+_0x56cce4[_0x7810('0x1e')]+_0x56cce4[_0x7810('0x1f')]+_0x56cce4[_0x7810('0x20')]+_0x56cce4[_0x7810('0x21')]+_0x56cce4[_0x7810('0x22')]+_0x56cce4['countmachineretry']+_0x56cce4[_0x7810('0x23')]<_0xd55eed[_0x7810('0x24')]['dialGlobalMaxRetry'])_0x3a29b7=0x1;_0x1fbeed({'additional':_0x3a29b7});}else{return db[_0x7810('0x1a')][_0x7810('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3233db['id']},'order':[[_0x7810('0x1c'),_0x7810('0x25')]]})[_0x7810('0x9')](function(_0x26425a){var _0x35edd5=0x0;if(_0x26425a){if(_0x26425a['countbusyretry']+_0x26425a['countcongestionretry']+_0x26425a[_0x7810('0x1f')]+_0x26425a[_0x7810('0x20')]+_0x26425a[_0x7810('0x21')]+_0x26425a[_0x7810('0x22')]+_0x26425a[_0x7810('0x26')]+_0x26425a[_0x7810('0x23')]<_0xd55eed[_0x7810('0x24')][_0x7810('0x27')])_0x35edd5=0x1;_0x1fbeed({'additional':_0x35edd5});}else{_0x1fbeed({'additional':0x0});}})[_0x7810('0x14')](function(_0xabf51d){logger[_0x7810('0xf')]('VerifyAdditionalPhones',_0xabf51d[_0x7810('0x12')]);_0x9d8b85(_0x1607b9[_0x7810('0xf')](0x1f4,_0xabf51d['message']));});}})[_0x7810('0x14')](function(_0x164075){logger['error'](_0x7810('0x28'),_0x164075[_0x7810('0x12')]);_0x9d8b85(_0x1607b9[_0x7810('0xf')](0x1f4,_0x164075['message']));});}else _0x1fbeed({'additional':0x0});});});};exports[_0x7810('0x29')]=function(_0x16d04c){var _0x13cf01=this;return new Promise(function(_0x475a74,_0x287e61){return db[_0x7810('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x16d04c[_0x7810('0x16')][_0x7810('0x2a')],'ListId':_0x16d04c['body'][_0x7810('0x17')],'VoiceQueueId':_0x16d04c[_0x7810('0x16')][_0x7810('0x18')]===undefined?null:_0x16d04c['body'][_0x7810('0x18')],'CampaignId':_0x16d04c[_0x7810('0x16')][_0x7810('0x19')]===undefined?null:_0x16d04c[_0x7810('0x16')][_0x7810('0x19')]}})[_0x7810('0x9')](function(_0x256298){if(_0x256298!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x256298['id'],'OrderBy':{'$gte':_0x256298[_0x7810('0x1c')]}},'order':[[_0x7810('0x1c'),_0x7810('0x25')]]})[_0x7810('0x9')](function(_0x251881){if(_0x251881)return activateAdditionalPhone(_0x256298,_0x16d04c[_0x7810('0x16')],_0x251881,_0x16d04c[_0x7810('0x2b')],_0x16d04c['waitTime'])[_0x7810('0x9')](function(_0x501144){_0x475a74(_0x501144);});else{return db[_0x7810('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x256298['id']},'order':[[_0x7810('0x1c'),'ASC']]})[_0x7810('0x9')](function(_0x37c172){if(_0x37c172)return activateAdditionalPhone(_0x256298,_0x16d04c[_0x7810('0x16')],_0x37c172,_0x16d04c[_0x7810('0x2b')],_0x16d04c[_0x7810('0x2c')])[_0x7810('0x9')](function(_0x151231){_0x475a74(_0x151231);});else{_0x475a74({'id':_0x256298['id'],'phone':''});}})[_0x7810('0x14')](function(_0x3facf6){logger['error'](_0x7810('0x28'),_0x3facf6[_0x7810('0x12')]);_0x287e61(_0x13cf01['error'](0x1f4,_0x3facf6[_0x7810('0x12')]));});}})['catch'](function(_0x5bc8fd){logger[_0x7810('0xf')]('VerifyAdditionalPhones',_0x5bc8fd[_0x7810('0x12')]);_0x287e61(_0x13cf01[_0x7810('0xf')](0x1f4,_0x5bc8fd[_0x7810('0x12')]));});}else _0x475a74(0x1);});});};function activateAdditionalPhone(_0x269fef,_0x6ffa20,_0xfcdd01,_0x58671d,_0x59898f){return new Promise(function(_0x3f15a8,_0x29d56b){var _0x1c9649;if(_[_0x7810('0x2d')](_0xfcdd01['scheduledat'])){_0xfcdd01['scheduledat']=moment();}if(moment()>moment(_0xfcdd01['scheduledat'])){_0x1c9649=moment()[_0x7810('0x2e')](_0x59898f||0x3,_0x7810('0x2f'));}else{if(_0xfcdd01['OrderBy']==0x0){_0x1c9649=moment(_0xfcdd01['scheduledat']);}else{_0x1c9649=moment()['add'](_0x59898f||0x3,_0x7810('0x2f'));}}if(_[_0x7810('0x2d')](_0x1c9649)){_0x1c9649=moment()['add'](_0x59898f||0x3,_0x7810('0x2f'));}var _0x42a0a3={'phone':_0x269fef[_0x7810('0x30')],'active':0x0,'OrderBy':_[_0x7810('0x2d')](_0x269fef[_0x7810('0x1c')])?0x0:_0x269fef['OrderBy'],'scheduledat':moment()[_0x7810('0x2e')](_0x58671d||0x1,_0x7810('0x2f')),'countbusyretry':_0x6ffa20[_0x7810('0x1d')],'countcongestionretry':_0x6ffa20[_0x7810('0x1e')],'countnoanswerretry':_0x6ffa20[_0x7810('0x1f')],'countnosuchnumberretry':_0x6ffa20[_0x7810('0x20')],'countdropretry':_0x6ffa20[_0x7810('0x21')],'countabandonedretry':_0x6ffa20['countabandonedretry'],'countmachineretry':_0x6ffa20[_0x7810('0x26')],'countagentrejectretry':_0x6ffa20[_0x7810('0x23')],'createdAt':_0x6ffa20[_0x7810('0x31')],'updatedAt':_0x6ffa20[_0x7810('0x32')]};var _0x4cc9bb={'CmHopperId':_0x269fef['id'],'phone':_0xfcdd01[_0x7810('0x30')],'active':0x0,'OrderBy':_[_0x7810('0x2d')](_0xfcdd01[_0x7810('0x1c')])?0x0:_0xfcdd01[_0x7810('0x1c')],'scheduledat':_0x1c9649,'countbusyretry':_0xfcdd01[_0x7810('0x1d')],'countcongestionretry':_0xfcdd01[_0x7810('0x1e')],'countnoanswerretry':_0xfcdd01[_0x7810('0x1f')],'countnosuchnumberretry':_0xfcdd01[_0x7810('0x20')],'countdropretry':_0xfcdd01['countdropretry'],'countabandonedretry':_0xfcdd01[_0x7810('0x22')],'countmachineretry':_0xfcdd01[_0x7810('0x26')],'countagentrejectretry':_0xfcdd01['countagentrejectretry'],'createdAt':_0xfcdd01[_0x7810('0x31')],'updatedAt':_0xfcdd01[_0x7810('0x32')]};return db['sequelize']['transaction'](function(_0x5cc4ac){return db[_0x7810('0x1a')]['update'](_0x42a0a3,{'where':{'id':_0xfcdd01['id']}},{'transaction':_0x5cc4ac})['then'](function(){return db[_0x7810('0x15')][_0x7810('0x33')](_0x4cc9bb,{'where':{'id':_0x269fef['id']}},{'transaction':_0x5cc4ac});});})[_0x7810('0x9')](function(_0x342702){_0x3f15a8({'id':_0x269fef['id'],'phone':_0xfcdd01['phone']});})['catch'](function(_0x1ea605){logger[_0x7810('0xf')](_0x7810('0x34'),_0x1ea605['message']);_0x29d56b({'error':_0x1ea605[_0x7810('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x44acec){var _0x405f33=this;return new Promise(function(_0x23d962,_0x149c57){return db[_0x7810('0x15')][_0x7810('0x33')](_0x44acec[_0x7810('0x16')][_0x7810('0x35')],{'where':{'id':_0x44acec[_0x7810('0x16')]['id']}})[_0x7810('0x9')](function(_0x5f556f){_0x23d962(_0x5f556f);})[_0x7810('0x14')](function(_0x407e9e){logger['error'](_0x7810('0x36'),_0x407e9e[_0x7810('0x12')]);_0x149c57(_0x405f33['error'](0x1f4,_0x407e9e[_0x7810('0x12')]));});});}; \ No newline at end of file +var _0x862b=['IncrementPreviewCounters','field','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','minutes','add','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone'];(function(_0x3686ca,_0x3ceb32){var _0x2756c9=function(_0xaada04){while(--_0xaada04){_0x3686ca['push'](_0x3686ca['shift']());}};_0x2756c9(++_0x3ceb32);}(_0x862b,0x18a));var _0xb862=function(_0x522667,_0x65923){_0x522667=_0x522667-0x0;var _0x53bf4e=_0x862b[_0x522667];return _0x53bf4e;};'use strict';var _=require(_0xb862('0x0'));var util=require(_0xb862('0x1'));var moment=require(_0xb862('0x2'));var BPromise=require(_0xb862('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb862('0x4'));var logger=require(_0xb862('0x5'))(_0xb862('0x6'));var config=require(_0xb862('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb862('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2874b2,_0xae7dcd,_0x4faaf2){return new BPromise(function(_0x49f6f2,_0x54ac99){return client[_0xb862('0x9')](_0x2874b2,_0x4faaf2)['then'](function(_0x41d298){logger[_0xb862('0xa')](_0xb862('0xb'),_0xae7dcd,'request\x20sent');logger['debug'](_0xb862('0xc'),_0xae7dcd,_0xb862('0xd'),JSON[_0xb862('0xe')](_0x41d298));if(_0x41d298[_0xb862('0xf')]){if(_0x41d298[_0xb862('0xf')][_0xb862('0x10')]===0x1f4){logger[_0xb862('0xf')](_0xb862('0xb'),_0xae7dcd,_0x41d298[_0xb862('0xf')][_0xb862('0x11')]);return _0x54ac99(_0x41d298[_0xb862('0xf')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xae7dcd,_0x41d298[_0xb862('0xf')][_0xb862('0x11')]);return _0x49f6f2(_0x41d298['error'][_0xb862('0x11')]);}else{logger[_0xb862('0xa')](_0xb862('0xb'),_0xae7dcd,_0xb862('0xd'));_0x49f6f2(_0x41d298[_0xb862('0x12')][_0xb862('0x11')]);}})['catch'](function(_0x2f4720){logger[_0xb862('0xf')](_0xb862('0xb'),_0xae7dcd,_0x2f4720);_0x54ac99(_0x2f4720);});});}exports['VerifyAdditionalPhones']=function(_0x21c3c9){var _0x2e5282=this;return new Promise(function(_0x3b9b93,_0x1cf624){return db[_0xb862('0x13')][_0xb862('0x14')]({'raw':!![],'where':{'ContactId':_0x21c3c9[_0xb862('0x15')][_0xb862('0x16')],'ListId':_0x21c3c9[_0xb862('0x15')]['ListId'],'VoiceQueueId':_0x21c3c9[_0xb862('0x15')][_0xb862('0x17')]===undefined?null:_0x21c3c9['body'][_0xb862('0x17')],'CampaignId':_0x21c3c9['body'][_0xb862('0x18')]===undefined?null:_0x21c3c9[_0xb862('0x15')][_0xb862('0x18')]}})['then'](function(_0xd952e){if(_0xd952e!=null){return db[_0xb862('0x19')][_0xb862('0x14')]({'raw':!![],'where':{'CmHopperId':_0xd952e['id'],'OrderBy':{'$gt':_0xd952e[_0xb862('0x1a')]}},'order':[[_0xb862('0x1a'),_0xb862('0x1b')]]})[_0xb862('0x1c')](function(_0x1e0153){var _0x553098=0x0;if(_0x1e0153){if(_0x1e0153[_0xb862('0x1d')]+_0x1e0153[_0xb862('0x1e')]+_0x1e0153['countnoanswerretry']+_0x1e0153['countnosuchnumberretry']+_0x1e0153[_0xb862('0x1f')]+_0x1e0153['countabandonedretry']+_0x1e0153[_0xb862('0x20')]+_0x1e0153['countagentrejectretry']<_0x21c3c9[_0xb862('0x21')][_0xb862('0x22')])_0x553098=0x1;_0x3b9b93({'additional':_0x553098});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xd952e['id']},'order':[[_0xb862('0x1a'),_0xb862('0x1b')]]})['then'](function(_0x393d7c){var _0x5868a4=0x0;if(_0x393d7c){if(_0x393d7c[_0xb862('0x1d')]+_0x393d7c['countcongestionretry']+_0x393d7c[_0xb862('0x23')]+_0x393d7c[_0xb862('0x24')]+_0x393d7c[_0xb862('0x1f')]+_0x393d7c[_0xb862('0x25')]+_0x393d7c['countmachineretry']+_0x393d7c[_0xb862('0x26')]<_0x21c3c9['entity'][_0xb862('0x22')])_0x5868a4=0x1;_0x3b9b93({'additional':_0x5868a4});}else{_0x3b9b93({'additional':0x0});}})[_0xb862('0x27')](function(_0x3532d3){logger[_0xb862('0xf')]('VerifyAdditionalPhones',_0x3532d3[_0xb862('0x11')]);_0x1cf624(_0x2e5282[_0xb862('0xf')](0x1f4,_0x3532d3['message']));});}})[_0xb862('0x27')](function(_0xa97d2f){logger[_0xb862('0xf')](_0xb862('0x28'),_0xa97d2f[_0xb862('0x11')]);_0x1cf624(_0x2e5282['error'](0x1f4,_0xa97d2f[_0xb862('0x11')]));});}else _0x3b9b93({'additional':0x0});});});};exports[_0xb862('0x29')]=function(_0x4a9d48){var _0x3e631a=this;return new Promise(function(_0x48f036,_0xa3f34d){return db['CmHopper'][_0xb862('0x14')]({'raw':!![],'where':{'ContactId':_0x4a9d48['body']['ContactId'],'ListId':_0x4a9d48[_0xb862('0x15')][_0xb862('0x2a')],'VoiceQueueId':_0x4a9d48[_0xb862('0x15')][_0xb862('0x17')]===undefined?null:_0x4a9d48[_0xb862('0x15')]['VoiceQueueId'],'CampaignId':_0x4a9d48[_0xb862('0x15')]['CampaignId']===undefined?null:_0x4a9d48[_0xb862('0x15')][_0xb862('0x18')]}})['then'](function(_0x5512ab){if(_0x5512ab!=null){return db[_0xb862('0x19')][_0xb862('0x14')]({'raw':!![],'where':{'CmHopperId':_0x5512ab['id'],'OrderBy':{'$gte':_0x5512ab[_0xb862('0x1a')]}},'order':[[_0xb862('0x1a'),_0xb862('0x1b')]]})[_0xb862('0x1c')](function(_0x1edc6c){if(_0x1edc6c)return activateAdditionalPhone(_0x5512ab,_0x4a9d48['body'],_0x1edc6c,_0x4a9d48[_0xb862('0x2b')],_0x4a9d48[_0xb862('0x2c')])[_0xb862('0x1c')](function(_0xc5cfea){_0x48f036(_0xc5cfea);});else{return db[_0xb862('0x19')][_0xb862('0x14')]({'raw':!![],'where':{'CmHopperId':_0x5512ab['id']},'order':[[_0xb862('0x1a'),_0xb862('0x1b')]]})[_0xb862('0x1c')](function(_0x58f22a){if(_0x58f22a)return activateAdditionalPhone(_0x5512ab,_0x4a9d48[_0xb862('0x15')],_0x58f22a,_0x4a9d48['duration'],_0x4a9d48[_0xb862('0x2c')])[_0xb862('0x1c')](function(_0x550686){_0x48f036(_0x550686);});else{_0x48f036({'id':_0x5512ab['id'],'phone':''});}})[_0xb862('0x27')](function(_0x494d0c){logger[_0xb862('0xf')](_0xb862('0x28'),_0x494d0c[_0xb862('0x11')]);_0xa3f34d(_0x3e631a[_0xb862('0xf')](0x1f4,_0x494d0c[_0xb862('0x11')]));});}})[_0xb862('0x27')](function(_0x39d5d9){logger[_0xb862('0xf')](_0xb862('0x28'),_0x39d5d9['message']);_0xa3f34d(_0x3e631a['error'](0x1f4,_0x39d5d9[_0xb862('0x11')]));});}else _0x48f036(0x1);});});};function activateAdditionalPhone(_0x460368,_0x47fa05,_0x17ada0,_0x2dd6fd,_0x117234){return new Promise(function(_0x15f575,_0x4b195c){var _0x5ab0e3;if(_['isNil'](_0x17ada0['scheduledat'])){_0x17ada0[_0xb862('0x2d')]=moment();}if(moment()>moment(_0x17ada0[_0xb862('0x2d')])){_0x5ab0e3=moment()['add'](_0x117234||0x3,_0xb862('0x2e'));}else{if(_0x17ada0[_0xb862('0x1a')]==0x0){_0x5ab0e3=moment(_0x17ada0[_0xb862('0x2d')]);}else{_0x5ab0e3=moment()[_0xb862('0x2f')](_0x117234||0x3,'minutes');}}if(_['isNil'](_0x5ab0e3)){_0x5ab0e3=moment()[_0xb862('0x2f')](_0x117234||0x3,_0xb862('0x2e'));}var _0x5e5a56={'phone':_0x460368[_0xb862('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x460368[_0xb862('0x1a')])?0x0:_0x460368[_0xb862('0x1a')],'scheduledat':moment()[_0xb862('0x2f')](_0x2dd6fd||0x1,_0xb862('0x2e')),'countbusyretry':_0x47fa05[_0xb862('0x1d')],'countcongestionretry':_0x47fa05[_0xb862('0x1e')],'countnoanswerretry':_0x47fa05[_0xb862('0x23')],'countnosuchnumberretry':_0x47fa05[_0xb862('0x24')],'countdropretry':_0x47fa05[_0xb862('0x1f')],'countabandonedretry':_0x47fa05['countabandonedretry'],'countmachineretry':_0x47fa05[_0xb862('0x20')],'countagentrejectretry':_0x47fa05[_0xb862('0x26')],'createdAt':_0x47fa05['createdAt'],'updatedAt':_0x47fa05[_0xb862('0x31')]};var _0x49c0a0={'CmHopperId':_0x460368['id'],'phone':_0x17ada0['phone'],'active':0x0,'OrderBy':_['isNil'](_0x17ada0['OrderBy'])?0x0:_0x17ada0[_0xb862('0x1a')],'scheduledat':_0x5ab0e3,'countbusyretry':_0x17ada0[_0xb862('0x1d')],'countcongestionretry':_0x17ada0['countcongestionretry'],'countnoanswerretry':_0x17ada0[_0xb862('0x23')],'countnosuchnumberretry':_0x17ada0['countnosuchnumberretry'],'countdropretry':_0x17ada0[_0xb862('0x1f')],'countabandonedretry':_0x17ada0[_0xb862('0x25')],'countmachineretry':_0x17ada0['countmachineretry'],'countagentrejectretry':_0x17ada0[_0xb862('0x26')],'createdAt':_0x17ada0['createdAt'],'updatedAt':_0x17ada0[_0xb862('0x31')]};return db[_0xb862('0x32')][_0xb862('0x33')](function(_0x24bd91){return db[_0xb862('0x19')][_0xb862('0x34')](_0x5e5a56,{'where':{'id':_0x17ada0['id']}},{'transaction':_0x24bd91})[_0xb862('0x1c')](function(){return db[_0xb862('0x13')][_0xb862('0x34')](_0x49c0a0,{'where':{'id':_0x460368['id']}},{'transaction':_0x24bd91});});})['then'](function(_0x5f1d6c){_0x15f575({'id':_0x460368['id'],'phone':_0x17ada0[_0xb862('0x30')]});})[_0xb862('0x27')](function(_0x2fcc9a){logger[_0xb862('0xf')](_0xb862('0x35'),_0x2fcc9a[_0xb862('0x11')]);_0x4b195c({'error':_0x2fcc9a[_0xb862('0x11')]});});});}exports[_0xb862('0x36')]=function(_0x44a0a2){var _0x1a8308=this;return new Promise(function(_0x629877,_0x31c771){return db[_0xb862('0x13')][_0xb862('0x34')](_0x44a0a2[_0xb862('0x15')][_0xb862('0x37')],{'where':{'id':_0x44a0a2['body']['id']}})['then'](function(_0x1bb7d0){_0x629877(_0x1bb7d0);})[_0xb862('0x27')](function(_0x313039){logger[_0xb862('0xf')](_0xb862('0x36'),_0x313039[_0xb862('0x11')]);_0x31c771(_0x1a8308['error'](0x1f4,_0x313039[_0xb862('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 74e56d8..9b1dedd 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 _0xe9db=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0xe9db,0xbc));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe9d('0x0'));var util=require(_0xbe9d('0x1'));var path=require(_0xbe9d('0x2'));var timeout=require(_0xbe9d('0x3'));var express=require(_0xbe9d('0x4'));var router=express[_0xbe9d('0x5')]();var fs_extra=require(_0xbe9d('0x6'));var auth=require(_0xbe9d('0x7'));var interaction=require(_0xbe9d('0x8'));var config=require(_0xbe9d('0x9'));var controller=require(_0xbe9d('0xa'));router[_0xbe9d('0xb')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xd')]);router['get'](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0xf')]);router[_0xbe9d('0x10')]('/',auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x11')]);router[_0xbe9d('0x12')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller[_0xbe9d('0x13')]);router[_0xbe9d('0x14')](_0xbe9d('0xe'),auth[_0xbe9d('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x14e9=['get','isAuthenticated','show','create','/:id','delete','multer','util','path','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x307a1a,_0x1a206a){var _0x7148e3=function(_0x4dc1e1){while(--_0x4dc1e1){_0x307a1a['push'](_0x307a1a['shift']());}};_0x7148e3(++_0x1a206a);}(_0x14e9,0x126));var _0x914e=function(_0x4a440b,_0xedaa5b){_0x4a440b=_0x4a440b-0x0;var _0x25c667=_0x14e9[_0x4a440b];return _0x25c667;};'use strict';var multer=require(_0x914e('0x0'));var util=require(_0x914e('0x1'));var path=require(_0x914e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x914e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x914e('0x4'));var controller=require(_0x914e('0x5'));router[_0x914e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x914e('0x6')]('/:id',auth[_0x914e('0x7')](),controller[_0x914e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x914e('0x9')]);router['put'](_0x914e('0xa'),auth[_0x914e('0x7')](),controller['update']);router[_0x914e('0xb')](_0x914e('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4fe5217..4fb1ae8 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 _0xc55e=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0xc55e,0x146));var _0xec55=function(_0x4d6e5f,_0x20bbb1){_0x4d6e5f=_0x4d6e5f-0x0;var _0x5b059c=_0xc55e[_0x4d6e5f];return _0x5b059c;};'use strict';var moment=require(_0xec55('0x0'));var Sequelize=require(_0xec55('0x1'));module[_0xec55('0x2')]={'phone':{'type':Sequelize[_0xec55('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xec55('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xec55('0x4')],'unique':_0xec55('0x5')},'VoiceQueueId':{'type':Sequelize[_0xec55('0x4')],'unique':_0xec55('0x5')}}; \ No newline at end of file +var _0x31f0=['exports','INTEGER','contactListQueue','moment'];(function(_0x2fb7fc,_0x50a284){var _0x1488ea=function(_0x4ef5a1){while(--_0x4ef5a1){_0x2fb7fc['push'](_0x2fb7fc['shift']());}};_0x1488ea(++_0x50a284);}(_0x31f0,0xb7));var _0x031f=function(_0x431fc9,_0x484199){_0x431fc9=_0x431fc9-0x0;var _0x5911ad=_0x31f0[_0x431fc9];return _0x5911ad;};'use strict';var moment=require(_0x031f('0x0'));var Sequelize=require('sequelize');module[_0x031f('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x031f('0x2')],'unique':_0x031f('0x3')},'ListId':{'type':Sequelize[_0x031f('0x2')],'unique':_0x031f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x031f('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c3137da..fc3f476 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 _0x1a62=['filters','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','map','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick'];(function(_0x235340,_0x2a7e4b){var _0x163e1c=function(_0x10c8af){while(--_0x10c8af){_0x235340['push'](_0x235340['shift']());}};_0x163e1c(++_0x2a7e4b);}(_0x1a62,0x176));var _0x21a6=function(_0x193098,_0x53605a){_0x193098=_0x193098-0x0;var _0x396924=_0x1a62[_0x193098];return _0x396924;};'use strict';var emlformat=require(_0x21a6('0x0'));var rimraf=require(_0x21a6('0x1'));var zipdir=require(_0x21a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21a6('0x3'));var moment=require(_0x21a6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21a6('0x5'));var path=require('path');var sox=require(_0x21a6('0x6'));var csv=require(_0x21a6('0x7'));var ejs=require(_0x21a6('0x8'));var fs=require('fs');var fs_extra=require(_0x21a6('0x9'));var _=require(_0x21a6('0xa'));var squel=require('squel');var crypto=require(_0x21a6('0xb'));var jsforce=require(_0x21a6('0xc'));var deskjs=require(_0x21a6('0xd'));var toCsv=require(_0x21a6('0x7'));var querystring=require(_0x21a6('0xe'));var Papa=require(_0x21a6('0xf'));var Redis=require('ioredis');var authService=require(_0x21a6('0x10'));var qs=require(_0x21a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21a6('0x12'));var logger=require(_0x21a6('0x13'))('api');var utils=require(_0x21a6('0x14'));var config=require(_0x21a6('0x15'));var licenseUtil=require(_0x21a6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8200,_0x3eec3f){_0x3eec3f=_0x3eec3f||0xcc;return function(_0x56f64f){if(_0x56f64f){return _0x3b8200[_0x21a6('0x17')](_0x3eec3f);}return _0x3b8200['status'](_0x3eec3f)['end']();};}function respondWithResult(_0x48f3ec,_0x3c57aa){_0x3c57aa=_0x3c57aa||0xc8;return function(_0xc90d31){if(_0xc90d31){return _0x48f3ec[_0x21a6('0x18')](_0x3c57aa)[_0x21a6('0x19')](_0xc90d31);}};}function respondWithFilteredResult(_0xc1c94f,_0x38223f){return function(_0x25d121){if(_0x25d121){var _0x5a43e7=typeof _0x38223f[_0x21a6('0x1a')]===_0x21a6('0x1b')&&typeof _0x38223f[_0x21a6('0x1c')]===_0x21a6('0x1b');var _0x3dca6f=_0x25d121['count'];var _0x256dea=_0x5a43e7?0x0:_0x38223f[_0x21a6('0x1a')];var _0x4814bf=_0x5a43e7?_0x25d121['count']:_0x38223f[_0x21a6('0x1a')]+_0x38223f[_0x21a6('0x1c')];var _0x5e9616;if(_0x4814bf>=_0x3dca6f){_0x4814bf=_0x3dca6f;_0x5e9616=0xc8;}else{_0x5e9616=0xce;}_0xc1c94f[_0x21a6('0x18')](_0x5e9616);return _0xc1c94f[_0x21a6('0x1d')]('Content-Range',_0x256dea+'-'+_0x4814bf+'/'+_0x3dca6f)['json'](_0x25d121);}return null;};}function patchUpdates(_0xf215){return function(_0x1fc028){try{jsonpatch[_0x21a6('0x1e')](_0x1fc028,_0xf215,!![]);}catch(_0x16a9c1){return BPromise[_0x21a6('0x1f')](_0x16a9c1);}return _0x1fc028[_0x21a6('0x20')]();};}function saveUpdates(_0x1ee13,_0x5ac597){return function(_0x225eeb){if(_0x225eeb){return _0x225eeb[_0x21a6('0x21')](_0x1ee13)[_0x21a6('0x22')](function(_0x361527){return _0x361527;});}return null;};}function removeEntity(_0x11b256,_0x5ee275){return function(_0x525ab3){if(_0x525ab3){return _0x525ab3[_0x21a6('0x23')]()[_0x21a6('0x22')](function(){_0x11b256[_0x21a6('0x18')](0xcc)[_0x21a6('0x24')]();});}};}function handleEntityNotFound(_0x357dd4,_0x249e52){return function(_0x9e5776){if(!_0x9e5776){_0x357dd4[_0x21a6('0x17')](0x194);}return _0x9e5776;};}function handleError(_0x3e0337,_0x54ea40){_0x54ea40=_0x54ea40||0x1f4;return function(_0x13a8fa){logger[_0x21a6('0x25')](_0x13a8fa['stack']);if(_0x13a8fa[_0x21a6('0x26')]){delete _0x13a8fa['name'];}_0x3e0337[_0x21a6('0x18')](_0x54ea40)[_0x21a6('0x27')](_0x13a8fa);};}exports[_0x21a6('0x28')]=function(_0x1ab21f,_0x161fe5){var _0x2d9603={},_0x25886c={},_0x10c784={'count':0x0,'rows':[]};var _0x1b00ad=_['map'](db[_0x21a6('0x29')][_0x21a6('0x2a')],function(_0xb0653){return{'name':_0xb0653[_0x21a6('0x2b')],'type':_0xb0653[_0x21a6('0x2c')][_0x21a6('0x2d')]};});_0x25886c['model']=_[_0x21a6('0x2e')](_0x1b00ad,_0x21a6('0x26'));_0x25886c['query']=_[_0x21a6('0x2f')](_0x1ab21f['query']);_0x25886c['filters']=_[_0x21a6('0x30')](_0x25886c[_0x21a6('0x31')],_0x25886c[_0x21a6('0x32')]);_0x2d9603[_0x21a6('0x33')]=_[_0x21a6('0x30')](_0x25886c[_0x21a6('0x31')],qs[_0x21a6('0x34')](_0x1ab21f[_0x21a6('0x32')][_0x21a6('0x34')]));_0x2d9603[_0x21a6('0x33')]=_0x2d9603[_0x21a6('0x33')][_0x21a6('0x35')]?_0x2d9603[_0x21a6('0x33')]:_0x25886c[_0x21a6('0x31')];if(!_0x1ab21f[_0x21a6('0x32')]['hasOwnProperty'](_0x21a6('0x36'))){_0x2d9603[_0x21a6('0x1c')]=qs[_0x21a6('0x1c')](_0x1ab21f[_0x21a6('0x32')]['limit']);_0x2d9603[_0x21a6('0x1a')]=qs[_0x21a6('0x1a')](_0x1ab21f[_0x21a6('0x32')]['offset']);}_0x2d9603[_0x21a6('0x37')]=qs[_0x21a6('0x38')](_0x1ab21f[_0x21a6('0x32')]['sort']);_0x2d9603['where']=qs['filters'](_[_0x21a6('0x39')](_0x1ab21f[_0x21a6('0x32')],_0x25886c[_0x21a6('0x3a')]),_0x1b00ad);if(_0x1ab21f['query']['filter']){_0x2d9603[_0x21a6('0x3b')]=_['merge'](_0x2d9603[_0x21a6('0x3b')],{'$or':_[_0x21a6('0x2e')](_0x1b00ad,function(_0x473f1f){if(_0x473f1f[_0x21a6('0x2c')]!==_0x21a6('0x3c')){var _0x50a022={};_0x50a022[_0x473f1f['name']]={'$like':'%'+_0x1ab21f[_0x21a6('0x32')]['filter']+'%'};return _0x50a022;}})});}_0x2d9603=_['merge']({},_0x2d9603,_0x1ab21f[_0x21a6('0x3d')]);var _0x8bf9c6={'where':_0x2d9603[_0x21a6('0x3b')]};return db[_0x21a6('0x29')]['count'](_0x8bf9c6)[_0x21a6('0x22')](function(_0x13ee44){_0x10c784[_0x21a6('0x3e')]=_0x13ee44;if(_0x1ab21f[_0x21a6('0x32')][_0x21a6('0x3f')]){_0x2d9603[_0x21a6('0x40')]=[{'all':!![]}];}return db[_0x21a6('0x29')][_0x21a6('0x41')](_0x2d9603);})[_0x21a6('0x22')](function(_0xf1325a){_0x10c784['rows']=_0xf1325a;return _0x10c784;})[_0x21a6('0x22')](respondWithFilteredResult(_0x161fe5,_0x2d9603))['catch'](handleError(_0x161fe5,null));};exports[_0x21a6('0x42')]=function(_0x53465c,_0x389421){var _0x2c797f={'raw':!![],'where':{'id':_0x53465c[_0x21a6('0x43')]['id']}},_0x405869={};_0x405869['model']=_[_0x21a6('0x2f')](db[_0x21a6('0x29')][_0x21a6('0x2a')]);_0x405869[_0x21a6('0x32')]=_[_0x21a6('0x2f')](_0x53465c[_0x21a6('0x32')]);_0x405869['filters']=_[_0x21a6('0x30')](_0x405869[_0x21a6('0x31')],_0x405869[_0x21a6('0x32')]);_0x2c797f[_0x21a6('0x33')]=_[_0x21a6('0x30')](_0x405869[_0x21a6('0x31')],qs[_0x21a6('0x34')](_0x53465c[_0x21a6('0x32')][_0x21a6('0x34')]));_0x2c797f[_0x21a6('0x33')]=_0x2c797f[_0x21a6('0x33')][_0x21a6('0x35')]?_0x2c797f[_0x21a6('0x33')]:_0x405869['model'];if(_0x53465c[_0x21a6('0x32')][_0x21a6('0x3f')]){_0x2c797f[_0x21a6('0x40')]=[{'all':!![]}];}_0x2c797f=_['merge']({},_0x2c797f,_0x53465c['options']);return db['CmHopperBlack'][_0x21a6('0x44')](_0x2c797f)[_0x21a6('0x22')](handleEntityNotFound(_0x389421,null))[_0x21a6('0x22')](respondWithResult(_0x389421,null))[_0x21a6('0x45')](handleError(_0x389421,null));};exports[_0x21a6('0x21')]=function(_0x540139,_0x515a32){if(_0x540139['body']['id']){delete _0x540139[_0x21a6('0x46')]['id'];}return db['CmHopperBlack'][_0x21a6('0x44')]({'where':{'id':_0x540139[_0x21a6('0x43')]['id']}})[_0x21a6('0x22')](handleEntityNotFound(_0x515a32,null))[_0x21a6('0x22')](saveUpdates(_0x540139[_0x21a6('0x46')],null))[_0x21a6('0x22')](respondWithResult(_0x515a32,null))[_0x21a6('0x45')](handleError(_0x515a32,null));};exports['destroy']=function(_0x60cd7a,_0x192393){return db['CmHopperBlack'][_0x21a6('0x44')]({'where':{'id':_0x60cd7a[_0x21a6('0x43')]['id']}})[_0x21a6('0x22')](handleEntityNotFound(_0x192393,null))[_0x21a6('0x22')](removeEntity(_0x192393,null))[_0x21a6('0x45')](handleError(_0x192393,null));};exports[_0x21a6('0x47')]=function(_0x278199,_0x4100c3){return db[_0x21a6('0x29')][_0x21a6('0x47')]()['then'](respondWithResult(_0x4100c3,null))[_0x21a6('0x45')](handleError(_0x4100c3,null));}; \ No newline at end of file +var _0x6b1d=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','VIRTUAL','filter','merge','options','where','CmHopperBlack','include','rows','show','includeAll','find','catch','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x36a963,_0x4b18e4){var _0x4a903b=function(_0x3f2442){while(--_0x3f2442){_0x36a963['push'](_0x36a963['shift']());}};_0x4a903b(++_0x4b18e4);}(_0x6b1d,0x16b));var _0xd6b1=function(_0x36c6f8,_0x17cb72){_0x36c6f8=_0x36c6f8-0x0;var _0x240ff0=_0x6b1d[_0x36c6f8];return _0x240ff0;};'use strict';var emlformat=require(_0xd6b1('0x0'));var rimraf=require(_0xd6b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6b1('0x2'));var rp=require(_0xd6b1('0x3'));var moment=require(_0xd6b1('0x4'));var BPromise=require(_0xd6b1('0x5'));var Mustache=require('mustache');var util=require(_0xd6b1('0x6'));var path=require('path');var sox=require(_0xd6b1('0x7'));var csv=require('to-csv');var ejs=require(_0xd6b1('0x8'));var fs=require('fs');var fs_extra=require(_0xd6b1('0x9'));var _=require(_0xd6b1('0xa'));var squel=require(_0xd6b1('0xb'));var crypto=require(_0xd6b1('0xc'));var jsforce=require(_0xd6b1('0xd'));var deskjs=require(_0xd6b1('0xe'));var toCsv=require(_0xd6b1('0xf'));var querystring=require(_0xd6b1('0x10'));var Papa=require(_0xd6b1('0x11'));var Redis=require(_0xd6b1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd6b1('0x13'));var as=require(_0xd6b1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd6b1('0x15'));var config=require(_0xd6b1('0x16'));var licenseUtil=require(_0xd6b1('0x17'));var db=require(_0xd6b1('0x18'))['db'];function respondWithStatusCode(_0x2e7a4a,_0x36b3c9){_0x36b3c9=_0x36b3c9||0xcc;return function(_0x49c3e2){if(_0x49c3e2){return _0x2e7a4a[_0xd6b1('0x19')](_0x36b3c9);}return _0x2e7a4a[_0xd6b1('0x1a')](_0x36b3c9)['end']();};}function respondWithResult(_0x515b18,_0x4fc2d4){_0x4fc2d4=_0x4fc2d4||0xc8;return function(_0x442636){if(_0x442636){return _0x515b18[_0xd6b1('0x1a')](_0x4fc2d4)[_0xd6b1('0x1b')](_0x442636);}};}function respondWithFilteredResult(_0x475705,_0x3c4130){return function(_0x56ca78){if(_0x56ca78){var _0x1edec2=typeof _0x3c4130['offset']===_0xd6b1('0x1c')&&typeof _0x3c4130[_0xd6b1('0x1d')]===_0xd6b1('0x1c');var _0x4afc3a=_0x56ca78['count'];var _0x44fb7b=_0x1edec2?0x0:_0x3c4130[_0xd6b1('0x1e')];var _0x28cd16=_0x1edec2?_0x56ca78[_0xd6b1('0x1f')]:_0x3c4130[_0xd6b1('0x1e')]+_0x3c4130[_0xd6b1('0x1d')];var _0x24e653;if(_0x28cd16>=_0x4afc3a){_0x28cd16=_0x4afc3a;_0x24e653=0xc8;}else{_0x24e653=0xce;}_0x475705[_0xd6b1('0x1a')](_0x24e653);return _0x475705[_0xd6b1('0x20')](_0xd6b1('0x21'),_0x44fb7b+'-'+_0x28cd16+'/'+_0x4afc3a)[_0xd6b1('0x1b')](_0x56ca78);}return null;};}function patchUpdates(_0x35d979){return function(_0x1c8952){try{jsonpatch[_0xd6b1('0x22')](_0x1c8952,_0x35d979,!![]);}catch(_0x4ba384){return BPromise[_0xd6b1('0x23')](_0x4ba384);}return _0x1c8952['save']();};}function saveUpdates(_0x25c6ba,_0x1f0a65){return function(_0x18857c){if(_0x18857c){return _0x18857c[_0xd6b1('0x24')](_0x25c6ba)[_0xd6b1('0x25')](function(_0x7d5083){return _0x7d5083;});}return null;};}function removeEntity(_0x14b8e4,_0x4e8c32){return function(_0x38bb8d){if(_0x38bb8d){return _0x38bb8d[_0xd6b1('0x26')]()[_0xd6b1('0x25')](function(){_0x14b8e4[_0xd6b1('0x1a')](0xcc)[_0xd6b1('0x27')]();});}};}function handleEntityNotFound(_0x3c6348,_0x3236d7){return function(_0x5322d7){if(!_0x5322d7){_0x3c6348[_0xd6b1('0x19')](0x194);}return _0x5322d7;};}function handleError(_0x76d8e7,_0x51466e){_0x51466e=_0x51466e||0x1f4;return function(_0xfa2c9f){logger[_0xd6b1('0x28')](_0xfa2c9f['stack']);if(_0xfa2c9f[_0xd6b1('0x29')]){delete _0xfa2c9f['name'];}_0x76d8e7[_0xd6b1('0x1a')](_0x51466e)['send'](_0xfa2c9f);};}exports[_0xd6b1('0x2a')]=function(_0x4ae892,_0x35dda1){var _0x3509b7={},_0x29b755={},_0x5dc57c={'count':0x0,'rows':[]};var _0x305cd4=_[_0xd6b1('0x2b')](db['CmHopperBlack'][_0xd6b1('0x2c')],function(_0x5c7d0d){return{'name':_0x5c7d0d[_0xd6b1('0x2d')],'type':_0x5c7d0d[_0xd6b1('0x2e')][_0xd6b1('0x2f')]};});_0x29b755[_0xd6b1('0x30')]=_['map'](_0x305cd4,_0xd6b1('0x29'));_0x29b755[_0xd6b1('0x31')]=_[_0xd6b1('0x32')](_0x4ae892[_0xd6b1('0x31')]);_0x29b755['filters']=_[_0xd6b1('0x33')](_0x29b755[_0xd6b1('0x30')],_0x29b755[_0xd6b1('0x31')]);_0x3509b7[_0xd6b1('0x34')]=_[_0xd6b1('0x33')](_0x29b755[_0xd6b1('0x30')],qs[_0xd6b1('0x35')](_0x4ae892[_0xd6b1('0x31')][_0xd6b1('0x35')]));_0x3509b7[_0xd6b1('0x34')]=_0x3509b7[_0xd6b1('0x34')][_0xd6b1('0x36')]?_0x3509b7[_0xd6b1('0x34')]:_0x29b755['model'];if(!_0x4ae892['query'][_0xd6b1('0x37')](_0xd6b1('0x38'))){_0x3509b7[_0xd6b1('0x1d')]=qs['limit'](_0x4ae892['query'][_0xd6b1('0x1d')]);_0x3509b7[_0xd6b1('0x1e')]=qs[_0xd6b1('0x1e')](_0x4ae892[_0xd6b1('0x31')][_0xd6b1('0x1e')]);}_0x3509b7['order']=qs[_0xd6b1('0x39')](_0x4ae892['query'][_0xd6b1('0x39')]);_0x3509b7['where']=qs[_0xd6b1('0x3a')](_[_0xd6b1('0x3b')](_0x4ae892[_0xd6b1('0x31')],_0x29b755[_0xd6b1('0x3a')]),_0x305cd4);if(_0x4ae892[_0xd6b1('0x31')]['filter']){_0x3509b7['where']=_['merge'](_0x3509b7['where'],{'$or':_[_0xd6b1('0x2b')](_0x305cd4,function(_0x364a28){if(_0x364a28[_0xd6b1('0x2e')]!==_0xd6b1('0x3c')){var _0x2f9015={};_0x2f9015[_0x364a28[_0xd6b1('0x29')]]={'$like':'%'+_0x4ae892[_0xd6b1('0x31')][_0xd6b1('0x3d')]+'%'};return _0x2f9015;}})});}_0x3509b7=_[_0xd6b1('0x3e')]({},_0x3509b7,_0x4ae892[_0xd6b1('0x3f')]);var _0x16a371={'where':_0x3509b7[_0xd6b1('0x40')]};return db[_0xd6b1('0x41')][_0xd6b1('0x1f')](_0x16a371)[_0xd6b1('0x25')](function(_0x20a42f){_0x5dc57c['count']=_0x20a42f;if(_0x4ae892[_0xd6b1('0x31')]['includeAll']){_0x3509b7[_0xd6b1('0x42')]=[{'all':!![]}];}return db[_0xd6b1('0x41')]['findAll'](_0x3509b7);})[_0xd6b1('0x25')](function(_0x5d159c){_0x5dc57c[_0xd6b1('0x43')]=_0x5d159c;return _0x5dc57c;})[_0xd6b1('0x25')](respondWithFilteredResult(_0x35dda1,_0x3509b7))['catch'](handleError(_0x35dda1,null));};exports[_0xd6b1('0x44')]=function(_0x3a6ec7,_0x5cd58a){var _0x4bf567={'raw':!![],'where':{'id':_0x3a6ec7['params']['id']}},_0x2ce4be={};_0x2ce4be[_0xd6b1('0x30')]=_['keys'](db[_0xd6b1('0x41')]['rawAttributes']);_0x2ce4be['query']=_[_0xd6b1('0x32')](_0x3a6ec7[_0xd6b1('0x31')]);_0x2ce4be[_0xd6b1('0x3a')]=_[_0xd6b1('0x33')](_0x2ce4be[_0xd6b1('0x30')],_0x2ce4be[_0xd6b1('0x31')]);_0x4bf567['attributes']=_['intersection'](_0x2ce4be[_0xd6b1('0x30')],qs[_0xd6b1('0x35')](_0x3a6ec7[_0xd6b1('0x31')][_0xd6b1('0x35')]));_0x4bf567[_0xd6b1('0x34')]=_0x4bf567[_0xd6b1('0x34')][_0xd6b1('0x36')]?_0x4bf567[_0xd6b1('0x34')]:_0x2ce4be[_0xd6b1('0x30')];if(_0x3a6ec7[_0xd6b1('0x31')][_0xd6b1('0x45')]){_0x4bf567[_0xd6b1('0x42')]=[{'all':!![]}];}_0x4bf567=_[_0xd6b1('0x3e')]({},_0x4bf567,_0x3a6ec7[_0xd6b1('0x3f')]);return db[_0xd6b1('0x41')][_0xd6b1('0x46')](_0x4bf567)[_0xd6b1('0x25')](handleEntityNotFound(_0x5cd58a,null))[_0xd6b1('0x25')](respondWithResult(_0x5cd58a,null))[_0xd6b1('0x47')](handleError(_0x5cd58a,null));};exports['update']=function(_0x36c81b,_0x2e022c){if(_0x36c81b['body']['id']){delete _0x36c81b[_0xd6b1('0x48')]['id'];}return db[_0xd6b1('0x41')]['find']({'where':{'id':_0x36c81b[_0xd6b1('0x49')]['id']}})[_0xd6b1('0x25')](handleEntityNotFound(_0x2e022c,null))[_0xd6b1('0x25')](saveUpdates(_0x36c81b[_0xd6b1('0x48')],null))[_0xd6b1('0x25')](respondWithResult(_0x2e022c,null))[_0xd6b1('0x47')](handleError(_0x2e022c,null));};exports[_0xd6b1('0x26')]=function(_0x41fb5b,_0x4cf227){return db[_0xd6b1('0x41')][_0xd6b1('0x46')]({'where':{'id':_0x41fb5b[_0xd6b1('0x49')]['id']}})[_0xd6b1('0x25')](handleEntityNotFound(_0x4cf227,null))[_0xd6b1('0x25')](removeEntity(_0x4cf227,null))['catch'](handleError(_0x4cf227,null));};exports[_0xd6b1('0x4a')]=function(_0x21163f,_0x74a58a){return db[_0xd6b1('0x41')][_0xd6b1('0x4a')]()[_0xd6b1('0x25')](respondWithResult(_0x74a58a,null))[_0xd6b1('0x47')](handleError(_0x74a58a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 35ab812..ac82a43 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 _0xfe3f=['exports','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x324a41,_0x109a91){var _0x10ad60=function(_0x506e9c){while(--_0x506e9c){_0x324a41['push'](_0x324a41['shift']());}};_0x10ad60(++_0x109a91);}(_0xfe3f,0x9c));var _0xffe3=function(_0x15f51c,_0x32bd75){_0x15f51c=_0x15f51c-0x0;var _0x34149e=_0xfe3f[_0x15f51c];return _0x34149e;};'use strict';var _=require(_0xffe3('0x0'));var util=require(_0xffe3('0x1'));var logger=require(_0xffe3('0x2'))(_0xffe3('0x3'));var moment=require('moment');var BPromise=require(_0xffe3('0x4'));var rp=require(_0xffe3('0x5'));var fs=require('fs');var path=require(_0xffe3('0x6'));var rimraf=require(_0xffe3('0x7'));var config=require(_0xffe3('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0xffe3('0x9')]=function(_0x4519c0,_0x59596e){return _0x4519c0['define'](_0xffe3('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd7f=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','path'];(function(_0xbb7e00,_0x40627b){var _0x122f41=function(_0x4c58e9){while(--_0x4c58e9){_0xbb7e00['push'](_0xbb7e00['shift']());}};_0x122f41(++_0x40627b);}(_0xbd7f,0x118));var _0xfbd7=function(_0x10453e,_0xdc2cc8){_0x10453e=_0x10453e-0x0;var _0x323fd1=_0xbd7f[_0x10453e];return _0x323fd1;};'use strict';var _=require(_0xfbd7('0x0'));var util=require(_0xfbd7('0x1'));var logger=require('../../config/logger')(_0xfbd7('0x2'));var moment=require(_0xfbd7('0x3'));var BPromise=require(_0xfbd7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbd7('0x5'));var rimraf=require(_0xfbd7('0x6'));var config=require(_0xfbd7('0x7'));var attributes=require(_0xfbd7('0x8'));module[_0xfbd7('0x9')]=function(_0x1775d4,_0x2a6efe){return _0x1775d4[_0xfbd7('0xa')](_0xfbd7('0xb'),attributes,{'tableName':_0xfbd7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index ff5b821..e2f6a6b 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 _0x56f6=['body','limit','info','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CmHopperBlack','findAll','options','raw','where','include','map','model','attributes','GetCmHopperBlack','debug','UpdateCmHopperBlack','update'];(function(_0x247ada,_0x1e4bef){var _0x4c15fa=function(_0x16150e){while(--_0x16150e){_0x247ada['push'](_0x247ada['shift']());}};_0x4c15fa(++_0x1e4bef);}(_0x56f6,0x18b));var _0x656f=function(_0x51630e,_0x58b570){_0x51630e=_0x51630e-0x0;var _0x15c758=_0x56f6[_0x51630e];return _0x15c758;};'use strict';var _=require(_0x656f('0x0'));var util=require(_0x656f('0x1'));var moment=require(_0x656f('0x2'));var BPromise=require(_0x656f('0x3'));var rs=require(_0x656f('0x4'));var fs=require('fs');var Redis=require(_0x656f('0x5'));var db=require(_0x656f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x656f('0x7'))('rpc');var config=require(_0x656f('0x8'));var jayson=require(_0x656f('0x9'));var client=jayson['client'][_0x656f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40153e,_0x429150,_0x2070c8){return new BPromise(function(_0x5eae80,_0x5e1967){return client[_0x656f('0xb')](_0x40153e,_0x2070c8)[_0x656f('0xc')](function(_0x47674b){logger['info'](_0x656f('0xd'),_0x429150,'request\x20sent');logger['debug'](_0x656f('0xe'),_0x429150,_0x656f('0xf'),JSON[_0x656f('0x10')](_0x47674b));if(_0x47674b[_0x656f('0x11')]){if(_0x47674b[_0x656f('0x11')][_0x656f('0x12')]===0x1f4){logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x47674b[_0x656f('0x11')][_0x656f('0x13')]);return _0x5e1967(_0x47674b['error'][_0x656f('0x13')]);}logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x47674b[_0x656f('0x11')][_0x656f('0x13')]);return _0x5eae80(_0x47674b['error'][_0x656f('0x13')]);}else{logger['info'](_0x656f('0xd'),_0x429150,_0x656f('0xf'));_0x5eae80(_0x47674b['result']['message']);}})[_0x656f('0x14')](function(_0x487b6b){logger[_0x656f('0x11')](_0x656f('0xd'),_0x429150,_0x487b6b);_0x5e1967(_0x487b6b);});});}exports['GetCmHopperBlack']=function(_0x3f393d){var _0xb72133=this;return new Promise(function(_0x4f5e70,_0x246a9e){return db[_0x656f('0x15')][_0x656f('0x16')]({'raw':_0x3f393d[_0x656f('0x17')]?_0x3f393d[_0x656f('0x17')][_0x656f('0x18')]===undefined?!![]:![]:!![],'where':_0x3f393d[_0x656f('0x17')]?_0x3f393d['options'][_0x656f('0x19')]||null:null,'attributes':_0x3f393d['options']?_0x3f393d[_0x656f('0x17')]['attributes']||null:null,'limit':_0x3f393d['options']?_0x3f393d[_0x656f('0x17')]['limit']||null:null,'include':_0x3f393d[_0x656f('0x17')]?_0x3f393d['options'][_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x3f393d['options'][_0x656f('0x1a')],function(_0x4eda57){return{'model':db[_0x4eda57[_0x656f('0x1c')]],'as':_0x4eda57['as'],'attributes':_0x4eda57[_0x656f('0x1d')],'include':_0x4eda57[_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x4eda57[_0x656f('0x1a')],function(_0x11e623){return{'model':db[_0x11e623[_0x656f('0x1c')]],'as':_0x11e623['as'],'attributes':_0x11e623['attributes'],'include':_0x11e623[_0x656f('0x1a')]?_[_0x656f('0x1b')](_0x11e623['include'],function(_0x3f69be){return{'model':db[_0x3f69be[_0x656f('0x1c')]],'as':_0x3f69be['as'],'attributes':_0x3f69be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25bb54){logger['info'](_0x656f('0x1e'),_0x3f393d);logger[_0x656f('0x1f')]('GetCmHopperBlack',_0x3f393d,JSON['stringify'](_0x25bb54));_0x4f5e70(_0x25bb54);})['catch'](function(_0x49a3fb){logger['error'](_0x656f('0x1e'),_0x49a3fb['message'],_0x3f393d);_0x246a9e(_0xb72133['error'](0x1f4,_0x49a3fb['message']));});});};exports[_0x656f('0x20')]=function(_0x46b589){var _0x3043e0=this;return new Promise(function(_0x26aa77,_0x3d69da){return db[_0x656f('0x15')][_0x656f('0x21')](_0x46b589[_0x656f('0x22')],{'raw':_0x46b589[_0x656f('0x17')]?_0x46b589[_0x656f('0x17')][_0x656f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b589[_0x656f('0x17')]?_0x46b589[_0x656f('0x17')][_0x656f('0x19')]||null:null,'attributes':_0x46b589['options']?_0x46b589['options']['attributes']||null:null,'limit':_0x46b589['options']?_0x46b589[_0x656f('0x17')][_0x656f('0x23')]||null:null})[_0x656f('0xc')](function(_0x33d556){logger[_0x656f('0x24')](_0x656f('0x20'),_0x46b589);logger['debug'](_0x656f('0x20'),_0x46b589,JSON[_0x656f('0x10')](_0x33d556));_0x26aa77(_0x33d556);})[_0x656f('0x14')](function(_0x43ba00){logger[_0x656f('0x11')](_0x656f('0x20'),_0x43ba00[_0x656f('0x13')],_0x46b589);_0x3d69da(_0x3043e0[_0x656f('0x11')](0x1f4,_0x43ba00[_0x656f('0x13')]));});});};exports[_0x656f('0x25')]=function(_0x578b2a){var _0x24edf0=this;return new Promise(function(_0x14aa07,_0x46e4a7){return db['CmHopperBlack'][_0x656f('0x26')]({'where':_0x578b2a[_0x656f('0x17')]?_0x578b2a[_0x656f('0x17')][_0x656f('0x19')]||null:null})['then'](function(_0x31bdb0){logger['info'](_0x656f('0x25'),_0x578b2a);logger[_0x656f('0x1f')]('DestroyCmHopperBlack',_0x578b2a,JSON[_0x656f('0x10')](_0x31bdb0));_0x14aa07(_0x31bdb0);})['catch'](function(_0x58bad7){logger[_0x656f('0x11')](_0x656f('0x25'),_0x58bad7[_0x656f('0x13')],_0x578b2a);_0x46e4a7(_0x24edf0[_0x656f('0x11')](0x1f4,_0x58bad7[_0x656f('0x13')]));});});}; \ No newline at end of file +var _0x8859=['../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','where','info','destroy','DestroyCmHopperBlack','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xcd61d3,_0x4a1a01){var _0x20c324=function(_0x1ff6fc){while(--_0x1ff6fc){_0xcd61d3['push'](_0xcd61d3['shift']());}};_0x20c324(++_0x4a1a01);}(_0x8859,0xf6));var _0x9885=function(_0x4b1af8,_0x4a609b){_0x4b1af8=_0x4b1af8-0x0;var _0x106e22=_0x8859[_0x4b1af8];return _0x106e22;};'use strict';var _=require(_0x9885('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9885('0x1'));var fs=require('fs');var Redis=require(_0x9885('0x2'));var db=require(_0x9885('0x3'))['db'];var utils=require(_0x9885('0x4'));var logger=require(_0x9885('0x5'))('rpc');var config=require(_0x9885('0x6'));var jayson=require(_0x9885('0x7'));var client=jayson[_0x9885('0x8')][_0x9885('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a021e,_0x13b735,_0x4f6147){return new BPromise(function(_0x15c273,_0x29a97d){return client['request'](_0x5a021e,_0x4f6147)[_0x9885('0xa')](function(_0x2cc1f7){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x13b735,_0x9885('0xb'));logger[_0x9885('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x13b735,'request\x20sent',JSON[_0x9885('0xd')](_0x2cc1f7));if(_0x2cc1f7['error']){if(_0x2cc1f7[_0x9885('0xe')][_0x9885('0xf')]===0x1f4){logger['error'](_0x9885('0x10'),_0x13b735,_0x2cc1f7[_0x9885('0xe')][_0x9885('0x11')]);return _0x29a97d(_0x2cc1f7[_0x9885('0xe')][_0x9885('0x11')]);}logger[_0x9885('0xe')](_0x9885('0x10'),_0x13b735,_0x2cc1f7[_0x9885('0xe')]['message']);return _0x15c273(_0x2cc1f7[_0x9885('0xe')][_0x9885('0x11')]);}else{logger['info'](_0x9885('0x10'),_0x13b735,_0x9885('0xb'));_0x15c273(_0x2cc1f7[_0x9885('0x12')][_0x9885('0x11')]);}})[_0x9885('0x13')](function(_0x572871){logger[_0x9885('0xe')](_0x9885('0x10'),_0x13b735,_0x572871);_0x29a97d(_0x572871);});});}exports[_0x9885('0x14')]=function(_0x431bfa){var _0x76aec0=this;return new Promise(function(_0x245a05,_0xb56e76){return db[_0x9885('0x15')]['findAll']({'raw':_0x431bfa[_0x9885('0x16')]?_0x431bfa[_0x9885('0x16')][_0x9885('0x17')]===undefined?!![]:![]:!![],'where':_0x431bfa[_0x9885('0x16')]?_0x431bfa[_0x9885('0x16')]['where']||null:null,'attributes':_0x431bfa[_0x9885('0x16')]?_0x431bfa['options'][_0x9885('0x18')]||null:null,'limit':_0x431bfa[_0x9885('0x16')]?_0x431bfa['options'][_0x9885('0x19')]||null:null,'include':_0x431bfa[_0x9885('0x16')]?_0x431bfa[_0x9885('0x16')][_0x9885('0x1a')]?_['map'](_0x431bfa['options'][_0x9885('0x1a')],function(_0x374a9b){return{'model':db[_0x374a9b[_0x9885('0x1b')]],'as':_0x374a9b['as'],'attributes':_0x374a9b[_0x9885('0x18')],'include':_0x374a9b[_0x9885('0x1a')]?_['map'](_0x374a9b[_0x9885('0x1a')],function(_0x33aff9){return{'model':db[_0x33aff9[_0x9885('0x1b')]],'as':_0x33aff9['as'],'attributes':_0x33aff9[_0x9885('0x18')],'include':_0x33aff9[_0x9885('0x1a')]?_[_0x9885('0x1c')](_0x33aff9[_0x9885('0x1a')],function(_0x16093b){return{'model':db[_0x16093b[_0x9885('0x1b')]],'as':_0x16093b['as'],'attributes':_0x16093b[_0x9885('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9885('0xa')](function(_0x6c2105){logger['info'](_0x9885('0x14'),_0x431bfa);logger[_0x9885('0xc')](_0x9885('0x14'),_0x431bfa,JSON[_0x9885('0xd')](_0x6c2105));_0x245a05(_0x6c2105);})[_0x9885('0x13')](function(_0x396912){logger[_0x9885('0xe')]('GetCmHopperBlack',_0x396912[_0x9885('0x11')],_0x431bfa);_0xb56e76(_0x76aec0[_0x9885('0xe')](0x1f4,_0x396912[_0x9885('0x11')]));});});};exports[_0x9885('0x1d')]=function(_0x3ad10a){var _0x1b7ffe=this;return new Promise(function(_0x5a1805,_0x574609){return db[_0x9885('0x15')][_0x9885('0x1e')](_0x3ad10a[_0x9885('0x1f')],{'raw':_0x3ad10a[_0x9885('0x16')]?_0x3ad10a['options'][_0x9885('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad10a[_0x9885('0x16')]?_0x3ad10a[_0x9885('0x16')][_0x9885('0x20')]||null:null,'attributes':_0x3ad10a[_0x9885('0x16')]?_0x3ad10a[_0x9885('0x16')][_0x9885('0x18')]||null:null,'limit':_0x3ad10a[_0x9885('0x16')]?_0x3ad10a[_0x9885('0x16')][_0x9885('0x19')]||null:null})[_0x9885('0xa')](function(_0x2dde1c){logger[_0x9885('0x21')]('UpdateCmHopperBlack',_0x3ad10a);logger[_0x9885('0xc')]('UpdateCmHopperBlack',_0x3ad10a,JSON[_0x9885('0xd')](_0x2dde1c));_0x5a1805(_0x2dde1c);})[_0x9885('0x13')](function(_0x4a0379){logger[_0x9885('0xe')](_0x9885('0x1d'),_0x4a0379[_0x9885('0x11')],_0x3ad10a);_0x574609(_0x1b7ffe[_0x9885('0xe')](0x1f4,_0x4a0379[_0x9885('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x135e13){var _0x199a4b=this;return new Promise(function(_0x4cb8fe,_0x1713ee){return db['CmHopperBlack'][_0x9885('0x22')]({'where':_0x135e13['options']?_0x135e13['options'][_0x9885('0x20')]||null:null})['then'](function(_0x537d7f){logger[_0x9885('0x21')](_0x9885('0x23'),_0x135e13);logger[_0x9885('0xc')]('DestroyCmHopperBlack',_0x135e13,JSON[_0x9885('0xd')](_0x537d7f));_0x4cb8fe(_0x537d7f);})[_0x9885('0x13')](function(_0x19595b){logger[_0x9885('0xe')](_0x9885('0x23'),_0x19595b['message'],_0x135e13);_0x1713ee(_0x199a4b[_0x9885('0xe')](0x1f4,_0x19595b[_0x9885('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index eecbb84..85ce224 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 _0xabce=['show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x17dfe4,_0x45d2ba){var _0x4d2059=function(_0x5e6d12){while(--_0x5e6d12){_0x17dfe4['push'](_0x17dfe4['shift']());}};_0x4d2059(++_0x45d2ba);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_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('./cmHopperBlack.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('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);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 ba1e74d..8f002d9 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 _0x8fc2=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x3eee78,_0x5acc63){var _0x53a5e5=function(_0x472fb6){while(--_0x472fb6){_0x3eee78['push'](_0x3eee78['shift']());}};_0x53a5e5(++_0x5acc63);}(_0x8fc2,0x14e));var _0x28fc=function(_0x27cf39,_0x8c23da){_0x27cf39=_0x27cf39-0x0;var _0x1e0b21=_0x8fc2[_0x27cf39];return _0x1e0b21;};'use strict';var Sequelize=require(_0x28fc('0x0'));var moment=require(_0x28fc('0x1'));module[_0x28fc('0x2')]={'state':{'type':Sequelize[_0x28fc('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x28fc('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x28fc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x28fc('0x4')]},'calleridnum':{'type':Sequelize[_0x28fc('0x4')]},'calleridname':{'type':Sequelize[_0x28fc('0x4')]},'starttime':{'type':Sequelize[_0x28fc('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x28fc('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x28fc('0x5')]},'ringtime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x28fc('0x4')]},'campaign':{'type':Sequelize[_0x28fc('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x28fc('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x28fc('0x4')]},'dispositionat':{'type':Sequelize[_0x28fc('0x5')],'set':function(_0x33911b){var _0x3af48c=this[_0x28fc('0x6')](_0x28fc('0x7'));if(_0x3af48c&&_0x33911b){this[_0x28fc('0x8')](_0x28fc('0x9'),moment(_0x33911b)[_0x28fc('0xa')](moment(_0x3af48c),_0x28fc('0xb')));}}},'amd':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x28fc('0x5')]},'callback':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x28fc('0x5')]},'deleted':{'type':Sequelize[_0x28fc('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x28fc('0x5')]},'recallme':{'type':Sequelize[_0x28fc('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x28fc('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x28fc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ee8=['DATE','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x33ad1f,_0xfc2fc8){var _0x26ef22=function(_0x58f97c){while(--_0x58f97c){_0x33ad1f['push'](_0x33ad1f['shift']());}};_0x26ef22(++_0xfc2fc8);}(_0x9ee8,0x13c));var _0x89ee=function(_0x4e88df,_0x3c2049){_0x4e88df=_0x4e88df-0x0;var _0x53bc08=_0x9ee8[_0x4e88df];return _0x53bc08;};'use strict';var Sequelize=require(_0x89ee('0x0'));var moment=require('moment');module[_0x89ee('0x1')]={'state':{'type':Sequelize[_0x89ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x89ee('0x3')]},'scheduledat':{'type':Sequelize[_0x89ee('0x4')]},'countbusyretry':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x89ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x89ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0x89ee('0x3')]},'calleridnum':{'type':Sequelize[_0x89ee('0x3')]},'calleridname':{'type':Sequelize[_0x89ee('0x3')]},'starttime':{'type':Sequelize[_0x89ee('0x4')]},'responsetime':{'type':Sequelize[_0x89ee('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x89ee('0x4')]},'ringtime':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x89ee('0x3')]},'campaign':{'type':Sequelize[_0x89ee('0x3')]},'campaigntype':{'type':Sequelize[_0x89ee('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x89ee('0x3')]},'disposition':{'type':Sequelize[_0x89ee('0x3')]},'secondDisposition':{'type':Sequelize[_0x89ee('0x3')]},'thirdDisposition':{'type':Sequelize[_0x89ee('0x3')]},'dispositionat':{'type':Sequelize[_0x89ee('0x4')],'set':function(_0x3b3ec1){var _0x3c923a=this['getDataValue'](_0x89ee('0x5'));if(_0x3c923a&&_0x3b3ec1){this[_0x89ee('0x6')]('followuptime',moment(_0x3b3ec1)[_0x89ee('0x7')](moment(_0x3c923a),_0x89ee('0x8')));}}},'amd':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x89ee('0x4')]},'callback':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x89ee('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x89ee('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x89ee('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x89ee('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x89ee('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 7c402a2..db38777 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 _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x16fba4,_0x5a908e){var _0x21bfe8=function(_0x510dc4){while(--_0x510dc4){_0x16fba4['push'](_0x16fba4['shift']());}};_0x21bfe8(++_0x5a908e);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ca40d,_0x377fec){_0x3ca40d=_0x3ca40d-0x0;var _0x2370ec=_0x2ef3[_0x3ca40d];return _0x2370ec;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CmHopperFinal'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CmHopperFinal'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CmHopperFinal']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x5d17,0x114));var _0x75d1=function(_0x5f5b62,_0x5246f9){_0x5f5b62=_0x5f5b62-0x0;var _0x5adce8=_0x5d17[_0x5f5b62];return _0x5adce8;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2a91363..7144cdf 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 _0x86fb=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x86fb,0x116));var _0xb86f=function(_0x358d34,_0x510caa){_0x358d34=_0x358d34-0x0;var _0x35fe18=_0x86fb[_0x358d34];return _0x35fe18;};'use strict';var _=require(_0xb86f('0x0'));var util=require(_0xb86f('0x1'));var logger=require('../../config/logger')(_0xb86f('0x2'));var moment=require(_0xb86f('0x3'));var BPromise=require(_0xb86f('0x4'));var rp=require(_0xb86f('0x5'));var fs=require('fs');var path=require(_0xb86f('0x6'));var rimraf=require(_0xb86f('0x7'));var config=require(_0xb86f('0x8'));var attributes=require(_0xb86f('0x9'));module[_0xb86f('0xa')]=function(_0x3fc90a,_0x4f5a4e){return _0x3fc90a[_0xb86f('0xb')](_0xb86f('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xb86f('0xd'),'fields':[_0xb86f('0xd')]},{'name':_0xb86f('0xe'),'fields':[_0xb86f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x32c48a,_0x874ea7){var _0xfecc8e=function(_0x279d49){while(--_0x279d49){_0x32c48a['push'](_0x32c48a['shift']());}};_0xfecc8e(++_0x874ea7);}(_0xeb5d,0x9a));var _0xdeb5=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xeb5d[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xdeb5('0x0'));var util=require(_0xdeb5('0x1'));var logger=require(_0xdeb5('0x2'))(_0xdeb5('0x3'));var moment=require(_0xdeb5('0x4'));var BPromise=require(_0xdeb5('0x5'));var rp=require(_0xdeb5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdeb5('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xdeb5('0x8')]=function(_0x4801f2,_0x395a43){return _0x4801f2[_0xdeb5('0x9')](_0xdeb5('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xdeb5('0xb'),'fields':[_0xdeb5('0xb')]},{'name':_0xdeb5('0xc'),'fields':[_0xdeb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6bdf45c..41de347 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x55cf07,_0x56773a){var _0x50c224=function(_0x17ffca){while(--_0x17ffca){_0x55cf07['push'](_0x55cf07['shift']());}};_0x50c224(++_0x56773a);}(_0x7a54,0x106));var _0x47a5=function(_0x5529be,_0x446926){_0x5529be=_0x5529be-0x0;var _0x408068=_0x7a54[_0x5529be];return _0x408068;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x453596,_0x1c3207){var _0xc2e5c4=function(_0x5184cc){while(--_0x5184cc){_0x453596['push'](_0x453596['shift']());}};_0xc2e5c4(++_0x1c3207);}(_0x7a54,0x106));var _0x47a5=function(_0x381b5a,_0x255329){_0x381b5a=_0x381b5a-0x0;var _0x217424=_0x7a54[_0x381b5a];return _0x217424;};'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 7022a2e..1823d7f 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 _0x874d=['/checkContactHopper','put','/:id','update','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x5e1aa5,_0x35d6e9){var _0x2c4704=function(_0x57ae32){while(--_0x57ae32){_0x5e1aa5['push'](_0x5e1aa5['shift']());}};_0x2c4704(++_0x35d6e9);}(_0x874d,0x1e8));var _0xd874=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x874d[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0xd874('0x0'));var path=require(_0xd874('0x1'));var timeout=require(_0xd874('0x2'));var express=require('express');var router=express[_0xd874('0x3')]();var fs_extra=require(_0xd874('0x4'));var auth=require(_0xd874('0x5'));var interaction=require(_0xd874('0x6'));var config=require('../../config/environment');var controller=require(_0xd874('0x7'));router[_0xd874('0x8')]('/',auth[_0xd874('0x9')](),controller[_0xd874('0xa')]);router[_0xd874('0x8')]('/describe',auth[_0xd874('0x9')](),controller[_0xd874('0xb')]);router[_0xd874('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd874('0xc')]);router[_0xd874('0x8')]('/voice/queue/countAttributes/:id',auth[_0xd874('0x9')](),controller[_0xd874('0xd')]);router[_0xd874('0x8')]('/campaign/countAttributes/:id',auth[_0xd874('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xd874('0xe'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd874('0xf')](_0xd874('0x10'),auth[_0xd874('0x9')](),controller[_0xd874('0x11')]);router[_0xd874('0xf')](_0xd874('0x12'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xd874('0x13')](_0xd874('0x14'),auth['isAuthenticated'](),controller[_0xd874('0x15')]);module['exports']=router; \ No newline at end of file +var _0x930b=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x930b,0x106));var _0xb930=function(_0x584bac,_0x4fc772){_0x584bac=_0x584bac-0x0;var _0x149584=_0x930b[_0x584bac];return _0x149584;};'use strict';var multer=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var path=require('path');var timeout=require(_0xb930('0x2'));var express=require(_0xb930('0x3'));var router=express[_0xb930('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb930('0x5'));var config=require(_0xb930('0x6'));var controller=require(_0xb930('0x7'));router['get']('/',auth[_0xb930('0x8')](),controller[_0xb930('0x9')]);router[_0xb930('0xa')]('/describe',auth[_0xb930('0x8')](),controller[_0xb930('0xb')]);router[_0xb930('0xa')](_0xb930('0xc'),auth[_0xb930('0x8')](),controller['show']);router['get'](_0xb930('0xd'),auth['isAuthenticated'](),controller[_0xb930('0xe')]);router[_0xb930('0xa')](_0xb930('0xf'),auth[_0xb930('0x8')](),controller[_0xb930('0x10')]);router[_0xb930('0x11')](_0xb930('0x12'),auth[_0xb930('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xb930('0x13'),auth['isAuthenticated'](),controller[_0xb930('0x14')]);router[_0xb930('0x11')]('/checkContactHopper',auth[_0xb930('0x8')](),controller[_0xb930('0x15')]);router[_0xb930('0x16')](_0xb930('0xc'),auth['isAuthenticated'](),controller[_0xb930('0x17')]);module[_0xb930('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6f48c69..8b0d9fa 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 _0x7880=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x102dda,_0x538136){var _0x33e87c=function(_0x3e74fd){while(--_0x3e74fd){_0x102dda['push'](_0x102dda['shift']());}};_0x33e87c(++_0x538136);}(_0x7880,0x10f));var _0x0788=function(_0x4d9a48,_0x20bc50){_0x4d9a48=_0x4d9a48-0x0;var _0xef464d=_0x7880[_0x4d9a48];return _0xef464d;};'use strict';var Sequelize=require(_0x0788('0x0'));module['exports']={'state':{'type':Sequelize[_0x0788('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0788('0x2')]},'scheduledat':{'type':Sequelize[_0x0788('0x3')]},'countbusyretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0788('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0788('0x2')]},'calleridnum':{'type':Sequelize[_0x0788('0x2')]},'calleridname':{'type':Sequelize[_0x0788('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0788('0x3')]},'answertime':{'type':Sequelize[_0x0788('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0788('0x3')]},'ringtime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0788('0x2')]},'campaign':{'type':Sequelize[_0x0788('0x2')]},'campaigntype':{'type':Sequelize[_0x0788('0x2')]},'membername':{'type':Sequelize[_0x0788('0x2')]},'reason':{'type':Sequelize[_0x0788('0x2')]},'amd':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0788('0x3')]},'recallme':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0788('0x3')]},'edited':{'type':Sequelize[_0x0788('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0788('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd410=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0xca6616,_0x300a48){var _0x3d22e1=function(_0x57ea7f){while(--_0x57ea7f){_0xca6616['push'](_0xca6616['shift']());}};_0x3d22e1(++_0x300a48);}(_0xd410,0xd3));var _0x0d41=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd410[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x0d41('0x0'));module[_0x0d41('0x1')]={'state':{'type':Sequelize[_0x0d41('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0d41('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0d41('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0d41('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0d41('0x3')]},'calleridnum':{'type':Sequelize[_0x0d41('0x3')]},'calleridname':{'type':Sequelize[_0x0d41('0x3')]},'starttime':{'type':Sequelize[_0x0d41('0x4')]},'responsetime':{'type':Sequelize[_0x0d41('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0d41('0x4')]},'ringtime':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0d41('0x3')]},'campaign':{'type':Sequelize[_0x0d41('0x3')]},'campaigntype':{'type':Sequelize[_0x0d41('0x3')]},'membername':{'type':Sequelize[_0x0d41('0x3')]},'reason':{'type':Sequelize[_0x0d41('0x3')]},'amd':{'type':Sequelize[_0x0d41('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0d41('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0d41('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0d41('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0d41('0x4')]},'recallme':{'type':Sequelize[_0x0d41('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0d41('0x4')]},'edited':{'type':Sequelize[_0x0d41('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0d41('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0d41('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 76d01fe..e4f9bf8 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 _0xbf0a=['keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','CmHopperHistory','show','params','include','find','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','query'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xbf0a,0xed));var _0xabf0=function(_0x152b71,_0x525e00){_0x152b71=_0x152b71-0x0;var _0x3d99e7=_0xbf0a[_0x152b71];return _0x3d99e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabf0('0x0'));var zipdir=require(_0xabf0('0x1'));var jsonpatch=require(_0xabf0('0x2'));var rp=require('request-promise');var moment=require(_0xabf0('0x3'));var BPromise=require(_0xabf0('0x4'));var Mustache=require('mustache');var util=require(_0xabf0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xabf0('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabf0('0x7'));var squel=require('squel');var crypto=require(_0xabf0('0x8'));var jsforce=require(_0xabf0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabf0('0xa'));var Redis=require('ioredis');var authService=require(_0xabf0('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xabf0('0xc'));var hardwareService=require(_0xabf0('0xd'));var logger=require(_0xabf0('0xe'))('api');var utils=require(_0xabf0('0xf'));var config=require(_0xabf0('0x10'));var licenseUtil=require(_0xabf0('0x11'));var db=require(_0xabf0('0x12'))['db'];function respondWithStatusCode(_0x151d07,_0x40ad6d){_0x40ad6d=_0x40ad6d||0xcc;return function(_0x4fa30e){if(_0x4fa30e){return _0x151d07[_0xabf0('0x13')](_0x40ad6d);}return _0x151d07[_0xabf0('0x14')](_0x40ad6d)[_0xabf0('0x15')]();};}function respondWithResult(_0x2421e1,_0x2fa983){_0x2fa983=_0x2fa983||0xc8;return function(_0x23827b){if(_0x23827b){return _0x2421e1[_0xabf0('0x14')](_0x2fa983)[_0xabf0('0x16')](_0x23827b);}};}function respondWithFilteredResult(_0x40d7eb,_0x57cbcc){return function(_0x42ee8a){if(_0x42ee8a){var _0x5d2e71=typeof _0x57cbcc[_0xabf0('0x17')]===_0xabf0('0x18')&&typeof _0x57cbcc[_0xabf0('0x19')]===_0xabf0('0x18');var _0x423152=_0x42ee8a[_0xabf0('0x1a')];var _0x25128e=_0x5d2e71?0x0:_0x57cbcc[_0xabf0('0x17')];var _0x4f3173=_0x5d2e71?_0x42ee8a['count']:_0x57cbcc['offset']+_0x57cbcc['limit'];var _0x361671;if(_0x4f3173>=_0x423152){_0x4f3173=_0x423152;_0x361671=0xc8;}else{_0x361671=0xce;}_0x40d7eb[_0xabf0('0x14')](_0x361671);return _0x40d7eb[_0xabf0('0x1b')](_0xabf0('0x1c'),_0x25128e+'-'+_0x4f3173+'/'+_0x423152)[_0xabf0('0x16')](_0x42ee8a);}return null;};}function patchUpdates(_0x375fdf){return function(_0x3d0e4d){try{jsonpatch[_0xabf0('0x1d')](_0x3d0e4d,_0x375fdf,!![]);}catch(_0x21a2ff){return BPromise[_0xabf0('0x1e')](_0x21a2ff);}return _0x3d0e4d[_0xabf0('0x1f')]();};}function saveUpdates(_0x52816e,_0x436222){return function(_0x5ef116){if(_0x5ef116){return _0x5ef116[_0xabf0('0x20')](_0x52816e)[_0xabf0('0x21')](function(_0x30ea26){return _0x30ea26;});}return null;};}function removeEntity(_0x2721b9,_0x299725){return function(_0x3298b2){if(_0x3298b2){return _0x3298b2[_0xabf0('0x22')]()['then'](function(){_0x2721b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd980cb,_0x1c3c3b){return function(_0x5889b8){if(!_0x5889b8){_0xd980cb['sendStatus'](0x194);}return _0x5889b8;};}function handleError(_0x53e609,_0x1a5c9c){_0x1a5c9c=_0x1a5c9c||0x1f4;return function(_0x1662a4){logger[_0xabf0('0x23')](_0x1662a4[_0xabf0('0x24')]);if(_0x1662a4[_0xabf0('0x25')]){delete _0x1662a4['name'];}_0x53e609[_0xabf0('0x14')](_0x1a5c9c)[_0xabf0('0x26')](_0x1662a4);};}exports['index']=function(_0x320280,_0x4c5faf){var _0x499269={},_0x4192a6={},_0x4d4f23={'count':0x0,'rows':[]};var _0x5b84d4=_[_0xabf0('0x27')](db['CmHopperHistory'][_0xabf0('0x28')],function(_0x40340c){return{'name':_0x40340c[_0xabf0('0x29')],'type':_0x40340c['type']['key']};});_0x4192a6['model']=_[_0xabf0('0x27')](_0x5b84d4,_0xabf0('0x25'));_0x4192a6[_0xabf0('0x2a')]=_[_0xabf0('0x2b')](_0x320280['query']);_0x4192a6[_0xabf0('0x2c')]=_[_0xabf0('0x2d')](_0x4192a6['model'],_0x4192a6[_0xabf0('0x2a')]);_0x499269[_0xabf0('0x2e')]=_[_0xabf0('0x2d')](_0x4192a6[_0xabf0('0x2f')],qs[_0xabf0('0x30')](_0x320280[_0xabf0('0x2a')][_0xabf0('0x30')]));_0x499269['attributes']=_0x499269[_0xabf0('0x2e')][_0xabf0('0x31')]?_0x499269['attributes']:_0x4192a6[_0xabf0('0x2f')];if(!_0x320280[_0xabf0('0x2a')][_0xabf0('0x32')](_0xabf0('0x33'))){_0x499269[_0xabf0('0x19')]=qs['limit'](_0x320280[_0xabf0('0x2a')][_0xabf0('0x19')]);_0x499269[_0xabf0('0x17')]=qs[_0xabf0('0x17')](_0x320280[_0xabf0('0x2a')][_0xabf0('0x17')]);}_0x499269[_0xabf0('0x34')]=qs['sort'](_0x320280['query'][_0xabf0('0x35')]);_0x499269['where']=qs[_0xabf0('0x2c')](_[_0xabf0('0x36')](_0x320280['query'],_0x4192a6[_0xabf0('0x2c')]),_0x5b84d4);if(_0x320280[_0xabf0('0x2a')][_0xabf0('0x37')]){_0x499269['where']=_[_0xabf0('0x38')](_0x499269[_0xabf0('0x39')],{'$or':_[_0xabf0('0x27')](_0x5b84d4,function(_0x3884a4){if(_0x3884a4['type']!==_0xabf0('0x3a')){var _0x28c743={};_0x28c743[_0x3884a4['name']]={'$like':'%'+_0x320280[_0xabf0('0x2a')][_0xabf0('0x37')]+'%'};return _0x28c743;}})});}_0x499269=_[_0xabf0('0x38')]({},_0x499269,_0x320280[_0xabf0('0x3b')]);var _0x3b970d={'where':_0x499269['where']};return db['CmHopperHistory'][_0xabf0('0x1a')](_0x3b970d)[_0xabf0('0x21')](function(_0x527274){_0x4d4f23[_0xabf0('0x1a')]=_0x527274;if(_0x320280[_0xabf0('0x2a')][_0xabf0('0x3c')]){_0x499269['include']=[{'all':!![]}];}return db[_0xabf0('0x3d')]['findAll'](_0x499269);})[_0xabf0('0x21')](function(_0x1d52b7){_0x4d4f23['rows']=_0x1d52b7;return _0x4d4f23;})['then'](respondWithFilteredResult(_0x4c5faf,_0x499269))['catch'](handleError(_0x4c5faf,null));};exports[_0xabf0('0x3e')]=function(_0x32888f,_0x25352d){var _0x20d0bc={'raw':!![],'where':{'id':_0x32888f[_0xabf0('0x3f')]['id']}},_0x43093d={};_0x43093d[_0xabf0('0x2f')]=_[_0xabf0('0x2b')](db['CmHopperHistory'][_0xabf0('0x28')]);_0x43093d[_0xabf0('0x2a')]=_[_0xabf0('0x2b')](_0x32888f[_0xabf0('0x2a')]);_0x43093d[_0xabf0('0x2c')]=_[_0xabf0('0x2d')](_0x43093d['model'],_0x43093d[_0xabf0('0x2a')]);_0x20d0bc['attributes']=_[_0xabf0('0x2d')](_0x43093d[_0xabf0('0x2f')],qs[_0xabf0('0x30')](_0x32888f[_0xabf0('0x2a')][_0xabf0('0x30')]));_0x20d0bc[_0xabf0('0x2e')]=_0x20d0bc[_0xabf0('0x2e')]['length']?_0x20d0bc['attributes']:_0x43093d[_0xabf0('0x2f')];if(_0x32888f[_0xabf0('0x2a')]['includeAll']){_0x20d0bc[_0xabf0('0x40')]=[{'all':!![]}];}_0x20d0bc=_['merge']({},_0x20d0bc,_0x32888f[_0xabf0('0x3b')]);return db[_0xabf0('0x3d')][_0xabf0('0x41')](_0x20d0bc)['then'](handleEntityNotFound(_0x25352d,null))[_0xabf0('0x21')](respondWithResult(_0x25352d,null))['catch'](handleError(_0x25352d,null));};exports['create']=function(_0x3bd22e,_0x5bf486){return db[_0xabf0('0x3d')]['create'](_0x3bd22e[_0xabf0('0x42')],{})['then'](respondWithResult(_0x5bf486,0xc9))[_0xabf0('0x43')](handleError(_0x5bf486,null));};exports[_0xabf0('0x44')]=function(_0x3f8226,_0x2ca16c){return db[_0xabf0('0x3d')][_0xabf0('0x44')]()[_0xabf0('0x21')](respondWithResult(_0x2ca16c,null))[_0xabf0('0x43')](handleError(_0x2ca16c,null));};exports[_0xabf0('0x20')]=function(_0x39b111,_0x3a94dc){if(_0x39b111[_0xabf0('0x42')][_0xabf0('0x45')]){delete _0x39b111[_0xabf0('0x42')][_0xabf0('0x45')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x39b111[_0xabf0('0x3f')]['id']}})[_0xabf0('0x21')](handleEntityNotFound(_0x3a94dc,null))[_0xabf0('0x21')](saveUpdates(_0x39b111[_0xabf0('0x42')],null))[_0xabf0('0x21')](respondWithResult(_0x3a94dc,null))[_0xabf0('0x43')](handleError(_0x3a94dc,null));}; \ No newline at end of file +var _0x333b=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','index','CmHopperHistory','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs'];(function(_0x31fb8b,_0x353eff){var _0x3a5417=function(_0x2bfdab){while(--_0x2bfdab){_0x31fb8b['push'](_0x31fb8b['shift']());}};_0x3a5417(++_0x353eff);}(_0x333b,0x1ae));var _0xb333=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x333b[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0xb333('0x0'));var rimraf=require(_0xb333('0x1'));var zipdir=require(_0xb333('0x2'));var jsonpatch=require(_0xb333('0x3'));var rp=require('request-promise');var moment=require(_0xb333('0x4'));var BPromise=require(_0xb333('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb333('0x6'));var csv=require('to-csv');var ejs=require(_0xb333('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb333('0x8'));var squel=require(_0xb333('0x9'));var crypto=require(_0xb333('0xa'));var jsforce=require(_0xb333('0xb'));var deskjs=require(_0xb333('0xc'));var toCsv=require(_0xb333('0xd'));var querystring=require(_0xb333('0xe'));var Papa=require('papaparse');var Redis=require(_0xb333('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb333('0x10'));var as=require(_0xb333('0x11'));var hardwareService=require(_0xb333('0x12'));var logger=require(_0xb333('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb333('0x14'));var licenseUtil=require(_0xb333('0x15'));var db=require(_0xb333('0x16'))['db'];function respondWithStatusCode(_0x266ac7,_0x444e98){_0x444e98=_0x444e98||0xcc;return function(_0x52ca14){if(_0x52ca14){return _0x266ac7['sendStatus'](_0x444e98);}return _0x266ac7[_0xb333('0x17')](_0x444e98)[_0xb333('0x18')]();};}function respondWithResult(_0x509004,_0x3fdd8a){_0x3fdd8a=_0x3fdd8a||0xc8;return function(_0x351c75){if(_0x351c75){return _0x509004[_0xb333('0x17')](_0x3fdd8a)[_0xb333('0x19')](_0x351c75);}};}function respondWithFilteredResult(_0x1dcfb1,_0x13aa11){return function(_0x2ece9d){if(_0x2ece9d){var _0x1fa426=typeof _0x13aa11[_0xb333('0x1a')]==='undefined'&&typeof _0x13aa11[_0xb333('0x1b')]==='undefined';var _0x34e333=_0x2ece9d[_0xb333('0x1c')];var _0x537c19=_0x1fa426?0x0:_0x13aa11[_0xb333('0x1a')];var _0x5d107c=_0x1fa426?_0x2ece9d[_0xb333('0x1c')]:_0x13aa11[_0xb333('0x1a')]+_0x13aa11[_0xb333('0x1b')];var _0x3f18a3;if(_0x5d107c>=_0x34e333){_0x5d107c=_0x34e333;_0x3f18a3=0xc8;}else{_0x3f18a3=0xce;}_0x1dcfb1[_0xb333('0x17')](_0x3f18a3);return _0x1dcfb1[_0xb333('0x1d')](_0xb333('0x1e'),_0x537c19+'-'+_0x5d107c+'/'+_0x34e333)['json'](_0x2ece9d);}return null;};}function patchUpdates(_0x349de2){return function(_0x64851d){try{jsonpatch[_0xb333('0x1f')](_0x64851d,_0x349de2,!![]);}catch(_0x10c909){return BPromise[_0xb333('0x20')](_0x10c909);}return _0x64851d[_0xb333('0x21')]();};}function saveUpdates(_0x15368a,_0x4527c3){return function(_0x4cef34){if(_0x4cef34){return _0x4cef34['update'](_0x15368a)[_0xb333('0x22')](function(_0x3f0bcb){return _0x3f0bcb;});}return null;};}function removeEntity(_0x41f2ec,_0x4f4556){return function(_0x56e7c8){if(_0x56e7c8){return _0x56e7c8['destroy']()[_0xb333('0x22')](function(){_0x41f2ec['status'](0xcc)[_0xb333('0x18')]();});}};}function handleEntityNotFound(_0x2a5774,_0x3feb5c){return function(_0x1a26fa){if(!_0x1a26fa){_0x2a5774[_0xb333('0x23')](0x194);}return _0x1a26fa;};}function handleError(_0xa563ff,_0x47901c){_0x47901c=_0x47901c||0x1f4;return function(_0x535e1e){logger['error'](_0x535e1e[_0xb333('0x24')]);if(_0x535e1e['name']){delete _0x535e1e[_0xb333('0x25')];}_0xa563ff[_0xb333('0x17')](_0x47901c)['send'](_0x535e1e);};}exports[_0xb333('0x26')]=function(_0x26d22e,_0x4169a8){var _0x318d3e={},_0x358146={},_0x39c600={'count':0x0,'rows':[]};var _0x5d3e6d=_['map'](db[_0xb333('0x27')]['rawAttributes'],function(_0x1c91e7){return{'name':_0x1c91e7[_0xb333('0x28')],'type':_0x1c91e7[_0xb333('0x29')][_0xb333('0x2a')]};});_0x358146[_0xb333('0x2b')]=_[_0xb333('0x2c')](_0x5d3e6d,'name');_0x358146[_0xb333('0x2d')]=_[_0xb333('0x2e')](_0x26d22e['query']);_0x358146[_0xb333('0x2f')]=_[_0xb333('0x30')](_0x358146[_0xb333('0x2b')],_0x358146[_0xb333('0x2d')]);_0x318d3e[_0xb333('0x31')]=_['intersection'](_0x358146[_0xb333('0x2b')],qs[_0xb333('0x32')](_0x26d22e[_0xb333('0x2d')][_0xb333('0x32')]));_0x318d3e['attributes']=_0x318d3e[_0xb333('0x31')][_0xb333('0x33')]?_0x318d3e[_0xb333('0x31')]:_0x358146['model'];if(!_0x26d22e[_0xb333('0x2d')][_0xb333('0x34')](_0xb333('0x35'))){_0x318d3e[_0xb333('0x1b')]=qs[_0xb333('0x1b')](_0x26d22e['query']['limit']);_0x318d3e[_0xb333('0x1a')]=qs[_0xb333('0x1a')](_0x26d22e[_0xb333('0x2d')][_0xb333('0x1a')]);}_0x318d3e[_0xb333('0x36')]=qs['sort'](_0x26d22e[_0xb333('0x2d')][_0xb333('0x37')]);_0x318d3e[_0xb333('0x38')]=qs[_0xb333('0x2f')](_[_0xb333('0x39')](_0x26d22e[_0xb333('0x2d')],_0x358146['filters']),_0x5d3e6d);if(_0x26d22e['query'][_0xb333('0x3a')]){_0x318d3e['where']=_[_0xb333('0x3b')](_0x318d3e[_0xb333('0x38')],{'$or':_['map'](_0x5d3e6d,function(_0x2cb6c8){if(_0x2cb6c8['type']!=='VIRTUAL'){var _0x291ce5={};_0x291ce5[_0x2cb6c8[_0xb333('0x25')]]={'$like':'%'+_0x26d22e[_0xb333('0x2d')]['filter']+'%'};return _0x291ce5;}})});}_0x318d3e=_[_0xb333('0x3b')]({},_0x318d3e,_0x26d22e['options']);var _0x258452={'where':_0x318d3e[_0xb333('0x38')]};return db[_0xb333('0x27')]['count'](_0x258452)['then'](function(_0x1122a5){_0x39c600['count']=_0x1122a5;if(_0x26d22e[_0xb333('0x2d')][_0xb333('0x3c')]){_0x318d3e[_0xb333('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb333('0x3e')](_0x318d3e);})['then'](function(_0x107b7d){_0x39c600[_0xb333('0x3f')]=_0x107b7d;return _0x39c600;})['then'](respondWithFilteredResult(_0x4169a8,_0x318d3e))[_0xb333('0x40')](handleError(_0x4169a8,null));};exports['show']=function(_0x35c50f,_0x3dc214){var _0xbadf63={'raw':!![],'where':{'id':_0x35c50f[_0xb333('0x41')]['id']}},_0x2e99ef={};_0x2e99ef[_0xb333('0x2b')]=_['keys'](db[_0xb333('0x27')]['rawAttributes']);_0x2e99ef[_0xb333('0x2d')]=_['keys'](_0x35c50f['query']);_0x2e99ef[_0xb333('0x2f')]=_[_0xb333('0x30')](_0x2e99ef['model'],_0x2e99ef[_0xb333('0x2d')]);_0xbadf63[_0xb333('0x31')]=_[_0xb333('0x30')](_0x2e99ef[_0xb333('0x2b')],qs[_0xb333('0x32')](_0x35c50f[_0xb333('0x2d')]['fields']));_0xbadf63[_0xb333('0x31')]=_0xbadf63[_0xb333('0x31')][_0xb333('0x33')]?_0xbadf63[_0xb333('0x31')]:_0x2e99ef[_0xb333('0x2b')];if(_0x35c50f[_0xb333('0x2d')][_0xb333('0x3c')]){_0xbadf63[_0xb333('0x3d')]=[{'all':!![]}];}_0xbadf63=_[_0xb333('0x3b')]({},_0xbadf63,_0x35c50f[_0xb333('0x42')]);return db[_0xb333('0x27')][_0xb333('0x43')](_0xbadf63)[_0xb333('0x22')](handleEntityNotFound(_0x3dc214,null))['then'](respondWithResult(_0x3dc214,null))[_0xb333('0x40')](handleError(_0x3dc214,null));};exports[_0xb333('0x44')]=function(_0x30bdda,_0x5a2f11){return db[_0xb333('0x27')][_0xb333('0x44')](_0x30bdda[_0xb333('0x45')],{})[_0xb333('0x22')](respondWithResult(_0x5a2f11,0xc9))[_0xb333('0x40')](handleError(_0x5a2f11,null));};exports[_0xb333('0x46')]=function(_0x9d5ac1,_0x185755){return db['CmHopperHistory'][_0xb333('0x46')]()[_0xb333('0x22')](respondWithResult(_0x185755,null))[_0xb333('0x40')](handleError(_0x185755,null));};exports[_0xb333('0x47')]=function(_0x238db4,_0x2fc0bd){if(_0x238db4['body']['uniqueid']){delete _0x238db4[_0xb333('0x45')][_0xb333('0x48')];}return db[_0xb333('0x27')][_0xb333('0x43')]({'where':{'uniqueid':_0x238db4[_0xb333('0x41')]['id']}})[_0xb333('0x22')](handleEntityNotFound(_0x2fc0bd,null))['then'](saveUpdates(_0x238db4['body'],null))[_0xb333('0x22')](respondWithResult(_0x2fc0bd,null))[_0xb333('0x40')](handleError(_0x2fc0bd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e8dfd73..8cc02ec 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 _0x964b=['api','moment','bluebird','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x964b,0x112));var _0xb964=function(_0x2e7b5a,_0xbfed56){_0x2e7b5a=_0x2e7b5a-0x0;var _0x27100d=_0x964b[_0x2e7b5a];return _0x27100d;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xb964('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeca8=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xeca8,0x1f2));var _0x8eca=function(_0x12c7be,_0x468c32){_0x12c7be=_0x12c7be-0x0;var _0x4ac82e=_0xeca8[_0x12c7be];return _0x4ac82e;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var logger=require(_0x8eca('0x2'))(_0x8eca('0x3'));var moment=require(_0x8eca('0x4'));var BPromise=require(_0x8eca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eca('0x6'));var rimraf=require('rimraf');var config=require(_0x8eca('0x7'));var attributes=require(_0x8eca('0x8'));module[_0x8eca('0x9')]=function(_0x599a26,_0x46f257){return _0x599a26[_0x8eca('0xa')](_0x8eca('0xb'),attributes,{'tableName':_0x8eca('0xc'),'paranoid':![],'indexes':[{'name':_0x8eca('0xd'),'fields':[_0x8eca('0xd')]},{'name':'uniqueid','fields':[_0x8eca('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0e61fd4..feb42ba 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 _0x4d41=['request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperHistory,\x20%s,\x20%s','info','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','stringify','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x43b50c,_0x22c826){var _0x480158=function(_0x1bcb35){while(--_0x1bcb35){_0x43b50c['push'](_0x43b50c['shift']());}};_0x480158(++_0x22c826);}(_0x4d41,0x153));var _0x14d4=function(_0xf30651,_0x964c8){_0xf30651=_0xf30651-0x0;var _0x5382a0=_0x4d41[_0xf30651];return _0x5382a0;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d30,_0x586569,_0x5a6cc0){return new BPromise(function(_0x5af0d5,_0x38ad4e){return client[_0x14d4('0xb')](_0x2f7d30,_0x5a6cc0)[_0x14d4('0xc')](function(_0x466286){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x586569,_0x14d4('0xd'));logger[_0x14d4('0xe')](_0x14d4('0xf'),_0x586569,'request\x20sent',JSON['stringify'](_0x466286));if(_0x466286[_0x14d4('0x10')]){if(_0x466286['error'][_0x14d4('0x11')]===0x1f4){logger[_0x14d4('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x38ad4e(_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);}logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x5af0d5(_0x466286[_0x14d4('0x10')]['message']);}else{logger[_0x14d4('0x14')](_0x14d4('0x13'),_0x586569,_0x14d4('0xd'));_0x5af0d5(_0x466286['result'][_0x14d4('0x12')]);}})[_0x14d4('0x15')](function(_0x2eafb9){logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x2eafb9);_0x38ad4e(_0x2eafb9);});});}exports[_0x14d4('0x16')]=function(_0x41901f){var _0xdc4f60=this;return new Promise(function(_0xca0cad,_0xaba73a){return db[_0x14d4('0x17')][_0x14d4('0x18')](_0x41901f['body'],{'raw':_0x41901f[_0x14d4('0x19')]?_0x41901f[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x321f4a){logger['info'](_0x14d4('0x16'),_0x41901f);logger[_0x14d4('0xe')](_0x14d4('0x16'),_0x41901f,JSON[_0x14d4('0x1b')](_0x321f4a));_0xca0cad(_0x321f4a);})[_0x14d4('0x15')](function(_0x51fea0){logger[_0x14d4('0x10')](_0x14d4('0x16'),_0x51fea0[_0x14d4('0x12')],_0x41901f);_0xaba73a(_0xdc4f60['error'](0x1f4,_0x51fea0['message']));});});};exports[_0x14d4('0x1c')]=function(_0x1974cf){var _0x176bdf=this;return new Promise(function(_0x578776,_0x2ffca8){return db[_0x14d4('0x17')]['findAll']({'raw':_0x1974cf[_0x14d4('0x19')]?_0x1974cf[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1974cf[_0x14d4('0x19')]?_0x1974cf['options'][_0x14d4('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x14d4('0x1e')][_0x14d4('0x1f')]('id')),_0x14d4('0x20')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x14d4('0x25')],[db['sequelize']['fn'](_0x14d4('0x26'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x27')))),_0x14d4('0x28')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x26'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x29')))),_0x14d4('0x2a')]]})[_0x14d4('0xc')](function(_0x3a47bd){logger['info'](_0x14d4('0x1c'),_0x1974cf);logger[_0x14d4('0xe')](_0x14d4('0x1c'),_0x1974cf,JSON[_0x14d4('0x1b')](_0x3a47bd));_0x578776(_0x3a47bd);})[_0x14d4('0x15')](function(_0x3c68dc){logger[_0x14d4('0x10')]('AvgHandleTime',_0x3c68dc[_0x14d4('0x12')],_0x1974cf);_0x2ffca8(_0x176bdf[_0x14d4('0x10')](0x1f4,_0x3c68dc[_0x14d4('0x12')]));});});};exports[_0x14d4('0x2b')]=function(_0x3a3578){var _0x10af33=this;return new Promise(function(_0x4fa991,_0x105ba6){return db[_0x14d4('0x17')]['findAll']({'raw':_0x3a3578[_0x14d4('0x19')]?_0x3a3578[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a3578['options']?_0x3a3578[_0x14d4('0x19')]['where']||null:null,'attributes':[[_0x14d4('0x2c'),_0x14d4('0x2d')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x2e')))),_0x14d4('0x2f')],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x30')))),_0x14d4('0x31')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x22')))),_0x14d4('0x32')],[db['sequelize']['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x33')))),'outboundCongestionCallsDay'],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x14d4('0x34')],[db['sequelize']['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x35')))),_0x14d4('0x36')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x37')))),_0x14d4('0x38')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0x14d4('0x39')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x3a')))),_0x14d4('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x3c')))),_0x14d4('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')](_0x14d4('0x3e')))),_0x14d4('0x3f')],[db[_0x14d4('0x1e')]['fn']('COUNT',db[_0x14d4('0x1e')]['fn']('IF',db['sequelize'][_0x14d4('0x21')](_0x14d4('0x40')))),_0x14d4('0x3d')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize']['fn']('IF',db[_0x14d4('0x1e')]['literal'](_0x14d4('0x41')))),'outboundReCallsDay']],'group':[_0x14d4('0x2c')]})[_0x14d4('0xc')](function(_0x5b2c71){logger['info'](_0x14d4('0x2b'),_0x3a3578);logger[_0x14d4('0xe')]('GetVoiceQueueHopperHistory',_0x3a3578,JSON[_0x14d4('0x1b')](_0x5b2c71));_0x4fa991(_0x5b2c71);})['catch'](function(_0x1e1812){logger[_0x14d4('0x10')](_0x14d4('0x2b'),_0x1e1812['message'],_0x3a3578);_0x105ba6(_0x10af33[_0x14d4('0x10')](0x1f4,_0x1e1812[_0x14d4('0x12')]));});});};exports[_0x14d4('0x42')]=function(_0x154a21){var _0x128c2d=this;return new Promise(function(_0x246abc,_0x422090){return db[_0x14d4('0x17')][_0x14d4('0x43')]({'raw':_0x154a21['options']?_0x154a21[_0x14d4('0x19')][_0x14d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x154a21['options']?_0x154a21['options'][_0x14d4('0x1d')]||null:null,'attributes':[[_0x14d4('0x2c'),_0x14d4('0x2d')],[db[_0x14d4('0x1e')]['fn'](_0x14d4('0x23'),db['sequelize'][_0x14d4('0x1f')]('id')),_0x14d4('0x44')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x14d4('0x1e')][_0x14d4('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x14d4('0x45')]],'group':[_0x14d4('0x2c')]})[_0x14d4('0xc')](function(_0x1abebf){logger[_0x14d4('0x14')](_0x14d4('0x42'),_0x154a21);logger[_0x14d4('0xe')](_0x14d4('0x42'),_0x154a21,JSON[_0x14d4('0x1b')](_0x1abebf));_0x246abc(_0x1abebf);})[_0x14d4('0x15')](function(_0x42e113){logger[_0x14d4('0x10')](_0x14d4('0x42'),_0x42e113[_0x14d4('0x12')],_0x154a21);_0x422090(_0x128c2d[_0x14d4('0x10')](0x1f4,_0x42e113[_0x14d4('0x12')]));});});}; \ No newline at end of file +var _0xe739=['options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','stringify','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body'];(function(_0x5f207e,_0x3c8750){var _0x38c525=function(_0x15045a){while(--_0x15045a){_0x5f207e['push'](_0x5f207e['shift']());}};_0x38c525(++_0x3c8750);}(_0xe739,0x105));var _0x9e73=function(_0x3968bd,_0x467d0c){_0x3968bd=_0x3968bd-0x0;var _0x5c7c67=_0xe739[_0x3968bd];return _0x5c7c67;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var moment=require(_0x9e73('0x1'));var BPromise=require(_0x9e73('0x2'));var rs=require(_0x9e73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e73('0x4'))(_0x9e73('0x5'));var config=require(_0x9e73('0x6'));var jayson=require(_0x9e73('0x7'));var client=jayson['client'][_0x9e73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26cb5b,_0xb37872,_0x5e46e7){return new BPromise(function(_0xa49f86,_0x1ee042){return client[_0x9e73('0x9')](_0x26cb5b,_0x5e46e7)[_0x9e73('0xa')](function(_0x14de8a){logger[_0x9e73('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0xb37872,_0x9e73('0xc'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb37872,_0x9e73('0xc'),JSON['stringify'](_0x14de8a));if(_0x14de8a[_0x9e73('0xd')]){if(_0x14de8a[_0x9e73('0xd')][_0x9e73('0xe')]===0x1f4){logger['error'](_0x9e73('0xf'),_0xb37872,_0x14de8a[_0x9e73('0xd')][_0x9e73('0x10')]);return _0x1ee042(_0x14de8a[_0x9e73('0xd')]['message']);}logger[_0x9e73('0xd')](_0x9e73('0xf'),_0xb37872,_0x14de8a[_0x9e73('0xd')]['message']);return _0xa49f86(_0x14de8a[_0x9e73('0xd')][_0x9e73('0x10')]);}else{logger['info'](_0x9e73('0xf'),_0xb37872,_0x9e73('0xc'));_0xa49f86(_0x14de8a[_0x9e73('0x11')]['message']);}})[_0x9e73('0x12')](function(_0x51968a){logger[_0x9e73('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0xb37872,_0x51968a);_0x1ee042(_0x51968a);});});}exports[_0x9e73('0x13')]=function(_0x48b1db){var _0x4dabb2=this;return new Promise(function(_0x419c5b,_0x3944fc){return db[_0x9e73('0x14')][_0x9e73('0x15')](_0x48b1db[_0x9e73('0x16')],{'raw':_0x48b1db[_0x9e73('0x17')]?_0x48b1db[_0x9e73('0x17')][_0x9e73('0x18')]===undefined?!![]:![]:!![]})[_0x9e73('0xa')](function(_0x3f56bf){logger['info'](_0x9e73('0x13'),_0x48b1db);logger['debug'](_0x9e73('0x13'),_0x48b1db,JSON['stringify'](_0x3f56bf));_0x419c5b(_0x3f56bf);})[_0x9e73('0x12')](function(_0x589a5d){logger[_0x9e73('0xd')](_0x9e73('0x13'),_0x589a5d['message'],_0x48b1db);_0x3944fc(_0x4dabb2['error'](0x1f4,_0x589a5d[_0x9e73('0x10')]));});});};exports[_0x9e73('0x19')]=function(_0x256ea1){var _0x257dca=this;return new Promise(function(_0x1214b5,_0x5117af){return db[_0x9e73('0x14')][_0x9e73('0x1a')]({'raw':_0x256ea1['options']?_0x256ea1['options'][_0x9e73('0x18')]===undefined?!![]:![]:!![],'where':_0x256ea1['options']?_0x256ea1['options'][_0x9e73('0x1b')]||null:null,'attributes':[[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db['sequelize'][_0x9e73('0x1e')]('id')),_0x9e73('0x1f')],[db['sequelize']['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x9e73('0x1c')]['fn']('COUNT',db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x22')))),_0x9e73('0x23')],[db['sequelize']['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x9e73('0x24')))),_0x9e73('0x25')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x26'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')]['literal'](_0x9e73('0x27')))),_0x9e73('0x28')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x26'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x29')))),_0x9e73('0x2a')]]})[_0x9e73('0xa')](function(_0x4cf402){logger[_0x9e73('0xb')](_0x9e73('0x19'),_0x256ea1);logger[_0x9e73('0x2b')](_0x9e73('0x19'),_0x256ea1,JSON['stringify'](_0x4cf402));_0x1214b5(_0x4cf402);})[_0x9e73('0x12')](function(_0x3186b0){logger['error']('AvgHandleTime',_0x3186b0[_0x9e73('0x10')],_0x256ea1);_0x5117af(_0x257dca[_0x9e73('0xd')](0x1f4,_0x3186b0[_0x9e73('0x10')]));});});};exports[_0x9e73('0x2c')]=function(_0x14fb70){var _0x430846=this;return new Promise(function(_0x5e6ffe,_0x574a8b){return db['CmHopperHistory'][_0x9e73('0x1a')]({'raw':_0x14fb70[_0x9e73('0x17')]?_0x14fb70[_0x9e73('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x14fb70['options']?_0x14fb70['options'][_0x9e73('0x1b')]||null:null,'attributes':[[_0x9e73('0x2d'),_0x9e73('0x2e')],[db[_0x9e73('0x1c')]['fn']('COUNT',db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x2f')))),_0x9e73('0x30')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')]['literal'](_0x9e73('0x21')))),_0x9e73('0x31')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9e73('0x32')))),_0x9e73('0x33')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x9e73('0x20')](_0x9e73('0x34')))),_0x9e73('0x35')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db['sequelize'][_0x9e73('0x20')](_0x9e73('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db['sequelize']['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9e73('0x37')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x38')))),_0x9e73('0x39')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x3a')))),_0x9e73('0x3b')],[db[_0x9e73('0x1c')]['fn']('COUNT',db[_0x9e73('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x9e73('0x3c')))),_0x9e73('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x3e')))),_0x9e73('0x3f')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x40')))),_0x9e73('0x41')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db['sequelize']['fn']('IF',db[_0x9e73('0x1c')][_0x9e73('0x20')](_0x9e73('0x42')))),_0x9e73('0x3f')],[db[_0x9e73('0x1c')]['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db[_0x9e73('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x9e73('0x2d')]})['then'](function(_0x22f69a){logger['info'](_0x9e73('0x2c'),_0x14fb70);logger['debug'](_0x9e73('0x2c'),_0x14fb70,JSON[_0x9e73('0x43')](_0x22f69a));_0x5e6ffe(_0x22f69a);})[_0x9e73('0x12')](function(_0x43c524){logger[_0x9e73('0xd')](_0x9e73('0x2c'),_0x43c524[_0x9e73('0x10')],_0x14fb70);_0x574a8b(_0x430846['error'](0x1f4,_0x43c524[_0x9e73('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0xe3ee0d){var _0x39aa72=this;return new Promise(function(_0x29b3e1,_0x5d4c99){return db[_0x9e73('0x14')][_0x9e73('0x1a')]({'raw':_0xe3ee0d['options']?_0xe3ee0d[_0x9e73('0x17')][_0x9e73('0x18')]===undefined?!![]:![]:!![],'where':_0xe3ee0d[_0x9e73('0x17')]?_0xe3ee0d[_0x9e73('0x17')][_0x9e73('0x1b')]||null:null,'attributes':[['campaign',_0x9e73('0x2e')],[db[_0x9e73('0x1c')]['fn']('COUNT',db[_0x9e73('0x1c')][_0x9e73('0x1e')]('id')),_0x9e73('0x44')],[db['sequelize']['fn'](_0x9e73('0x1d'),db[_0x9e73('0x1c')]['fn']('IF',db['sequelize'][_0x9e73('0x20')](_0x9e73('0x21')))),_0x9e73('0x45')]],'group':[_0x9e73('0x2d')]})[_0x9e73('0xa')](function(_0x34465a){logger[_0x9e73('0xb')](_0x9e73('0x46'),_0xe3ee0d);logger[_0x9e73('0x2b')](_0x9e73('0x46'),_0xe3ee0d,JSON[_0x9e73('0x43')](_0x34465a));_0x29b3e1(_0x34465a);})[_0x9e73('0x12')](function(_0x4dacf2){logger[_0x9e73('0xd')](_0x9e73('0x46'),_0x4dacf2[_0x9e73('0x10')],_0xe3ee0d);_0x5d4c99(_0x39aa72['error'](0x1f4,_0x4dacf2['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c214176..4a0635c 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 _0xc98a=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/:id','post','create','update'];(function(_0xb9b594,_0x30617b){var _0x3609ba=function(_0x289b4a){while(--_0x289b4a){_0xb9b594['push'](_0xb9b594['shift']());}};_0x3609ba(++_0x30617b);}(_0xc98a,0x71));var _0xac98=function(_0x3e4b98,_0x2ec6b4){_0x3e4b98=_0x3e4b98-0x0;var _0xf2b74b=_0xc98a[_0x3e4b98];return _0xf2b74b;};'use strict';var multer=require(_0xac98('0x0'));var util=require(_0xac98('0x1'));var path=require(_0xac98('0x2'));var timeout=require(_0xac98('0x3'));var express=require('express');var router=express[_0xac98('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac98('0x6'));var controller=require(_0xac98('0x7'));router['get']('/',auth[_0xac98('0x8')](),controller[_0xac98('0x9')]);router[_0xac98('0xa')]('/describe',auth[_0xac98('0x8')](),controller['describe']);router[_0xac98('0xa')](_0xac98('0xb'),auth[_0xac98('0x8')](),controller['show']);router[_0xac98('0xc')]('/',auth[_0xac98('0x8')](),controller[_0xac98('0xd')]);router['put'](_0xac98('0xb'),auth[_0xac98('0x8')](),controller[_0xac98('0xe')]);module[_0xac98('0xf')]=router; \ No newline at end of file +var _0x7e00=['./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x304602,_0x32d265){var _0x586307=function(_0x429307){while(--_0x429307){_0x304602['push'](_0x304602['shift']());}};_0x586307(++_0x32d265);}(_0x7e00,0xb7));var _0x07e0=function(_0x1444fb,_0x89c5e5){_0x1444fb=_0x1444fb-0x0;var _0x417f10=_0x7e00[_0x1444fb];return _0x417f10;};'use strict';var multer=require(_0x07e0('0x0'));var util=require('util');var path=require(_0x07e0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x07e0('0x2')]();var fs_extra=require(_0x07e0('0x3'));var auth=require(_0x07e0('0x4'));var interaction=require(_0x07e0('0x5'));var config=require(_0x07e0('0x6'));var controller=require(_0x07e0('0x7'));router['get']('/',auth[_0x07e0('0x8')](),controller[_0x07e0('0x9')]);router[_0x07e0('0xa')](_0x07e0('0xb'),auth[_0x07e0('0x8')](),controller[_0x07e0('0xc')]);router[_0x07e0('0xa')](_0x07e0('0xd'),auth['isAuthenticated'](),controller[_0x07e0('0xe')]);router[_0x07e0('0xf')]('/',auth['isAuthenticated'](),controller[_0x07e0('0x10')]);router[_0x07e0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x07e0('0x12')]);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 08a896b..aff4892 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 _0xde6c=['STRING','sequelize','exports','name'];(function(_0x32413a,_0x2fbe54){var _0x1439e0=function(_0x108320){while(--_0x108320){_0x32413a['push'](_0x32413a['shift']());}};_0x1439e0(++_0x2fbe54);}(_0xde6c,0x119));var _0xcde6=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0xde6c[_0x21dd50];return _0x1b7d5e;};'use strict';var Sequelize=require(_0xcde6('0x0'));module[_0xcde6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcde6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcde6('0x3')]},'dialPrefix':{'type':Sequelize[_0xcde6('0x3')]}}; \ No newline at end of file +var _0x8ece=['name','sequelize','exports','STRING'];(function(_0x15dfbf,_0x565548){var _0x2d45c9=function(_0x262e29){while(--_0x262e29){_0x15dfbf['push'](_0x15dfbf['shift']());}};_0x2d45c9(++_0x565548);}(_0x8ece,0x195));var _0xe8ec=function(_0x2689b3,_0x544cac){_0x2689b3=_0x2689b3-0x0;var _0x51f32c=_0x8ece[_0x2689b3];return _0x51f32c;};'use strict';var Sequelize=require(_0xe8ec('0x0'));module[_0xe8ec('0x1')]={'name':{'type':Sequelize[_0xe8ec('0x2')],'unique':_0xe8ec('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c582b92..f87a443 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 _0x7a05=['each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','findAll','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','item','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','queryInterface','cf_%s','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','error','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','CmList','fieldName','type','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','params','keys','include','find','catch','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','addDisposition','ListId','Disposition','getDispositions','rawAttributes','removeDispositions','ids','CmContact','describe','tags','isArray','join','push'];(function(_0x2ffbcc,_0x65959){var _0x32be9e=function(_0x226b78){while(--_0x226b78){_0x2ffbcc['push'](_0x2ffbcc['shift']());}};_0x32be9e(++_0x65959);}(_0x7a05,0xdc));var _0x57a0=function(_0x45fa35,_0x315a10){_0x45fa35=_0x45fa35-0x0;var _0x4f6dad=_0x7a05[_0x45fa35];return _0x4f6dad;};'use strict';var emlformat=require(_0x57a0('0x0'));var rimraf=require(_0x57a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57a0('0x2'));var rp=require(_0x57a0('0x3'));var moment=require(_0x57a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57a0('0x5'));var util=require(_0x57a0('0x6'));var path=require(_0x57a0('0x7'));var sox=require(_0x57a0('0x8'));var csv=require(_0x57a0('0x9'));var ejs=require(_0x57a0('0xa'));var fs=require('fs');var fs_extra=require(_0x57a0('0xb'));var _=require(_0x57a0('0xc'));var squel=require(_0x57a0('0xd'));var crypto=require(_0x57a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x57a0('0xf'));var toCsv=require(_0x57a0('0x9'));var querystring=require(_0x57a0('0x10'));var Papa=require(_0x57a0('0x11'));var Redis=require(_0x57a0('0x12'));var authService=require(_0x57a0('0x13'));var qs=require(_0x57a0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57a0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x57a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x57a0('0x17'));var db=require(_0x57a0('0x18'))['db'];var csv_results;config[_0x57a0('0x19')]=_[_0x57a0('0x1a')](config['redis'],{'host':_0x57a0('0x1b'),'port':0x18eb});var socket=require(_0x57a0('0x1c'))(new Redis(config[_0x57a0('0x19')]));require('./cmList.socket')[_0x57a0('0x1d')](socket);function respondWithStatusCode(_0x3bd03b,_0x7d39ce){_0x7d39ce=_0x7d39ce||0xcc;return function(_0x62a088){if(_0x62a088){return _0x3bd03b[_0x57a0('0x1e')](_0x7d39ce);}return _0x3bd03b[_0x57a0('0x1f')](_0x7d39ce)['end']();};}function respondWithResult(_0x5d8329,_0xdf0827){_0xdf0827=_0xdf0827||0xc8;return function(_0x15473a){if(_0x15473a){return _0x5d8329['status'](_0xdf0827)[_0x57a0('0x20')](_0x15473a);}};}function respondWithFilteredResult(_0x4fba3d,_0x32814c){return function(_0x5bda2e){if(_0x5bda2e){var _0x38f49b=typeof _0x32814c[_0x57a0('0x21')]===_0x57a0('0x22')&&typeof _0x32814c[_0x57a0('0x23')]===_0x57a0('0x22');var _0x449f4a=_0x5bda2e[_0x57a0('0x24')];var _0x3f58cd=_0x38f49b?0x0:_0x32814c[_0x57a0('0x21')];var _0x2e9247=_0x38f49b?_0x5bda2e['count']:_0x32814c['offset']+_0x32814c[_0x57a0('0x23')];var _0x5ca2b0;if(_0x2e9247>=_0x449f4a){_0x2e9247=_0x449f4a;_0x5ca2b0=0xc8;}else{_0x5ca2b0=0xce;}_0x4fba3d[_0x57a0('0x1f')](_0x5ca2b0);return _0x4fba3d[_0x57a0('0x25')](_0x57a0('0x26'),_0x3f58cd+'-'+_0x2e9247+'/'+_0x449f4a)[_0x57a0('0x20')](_0x5bda2e);}return null;};}function patchUpdates(_0x143025){return function(_0x2c4598){try{jsonpatch[_0x57a0('0x27')](_0x2c4598,_0x143025,!![]);}catch(_0x5a82d9){return BPromise[_0x57a0('0x28')](_0x5a82d9);}return _0x2c4598['save']();};}function saveUpdates(_0x294128,_0x3fb172){return function(_0x9c99bf){if(_0x9c99bf){return _0x9c99bf['update'](_0x294128)['then'](function(_0x4bd865){return _0x4bd865;});}return null;};}function removeEntity(_0x4ed9db,_0x232501){return function(_0x50d312){if(_0x50d312){return _0x50d312[_0x57a0('0x29')]()[_0x57a0('0x2a')](function(){var _0x3fd2b5=_0x50d312[_0x57a0('0x2b')]({'plain':!![]});var _0xf716f='Lists';return db[_0x57a0('0x2c')][_0x57a0('0x29')]({'where':{'type':_0xf716f,'resourceId':_0x3fd2b5['id']}})['then'](function(){return _0x50d312;});})[_0x57a0('0x2a')](function(){_0x4ed9db[_0x57a0('0x1f')](0xcc)[_0x57a0('0x2d')]();});}};}function handleEntityNotFound(_0x4a0676,_0x5e6228){return function(_0x3fb567){if(!_0x3fb567){_0x4a0676['sendStatus'](0x194);}return _0x3fb567;};}function handleError(_0xf438e8,_0x1e23ad){_0x1e23ad=_0x1e23ad||0x1f4;return function(_0x4cfbf4){logger['error'](_0x4cfbf4[_0x57a0('0x2e')]);if(_0x4cfbf4[_0x57a0('0x2f')]){delete _0x4cfbf4[_0x57a0('0x2f')];}_0xf438e8[_0x57a0('0x1f')](_0x1e23ad)[_0x57a0('0x30')](_0x4cfbf4);};}exports[_0x57a0('0x31')]=function(_0x57aab2,_0x3a789f){var _0x1fea9c={},_0xed9923={},_0x56148c={'count':0x0,'rows':[]};var _0x1476f3=_[_0x57a0('0x32')](db[_0x57a0('0x33')]['rawAttributes'],function(_0x2ef1b9){return{'name':_0x2ef1b9[_0x57a0('0x34')],'type':_0x2ef1b9[_0x57a0('0x35')][_0x57a0('0x36')]};});_0xed9923['model']=_[_0x57a0('0x32')](_0x1476f3,_0x57a0('0x2f'));_0xed9923['query']=_['keys'](_0x57aab2['query']);_0xed9923[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xed9923[_0x57a0('0x39')],_0xed9923[_0x57a0('0x3a')]);_0x1fea9c['attributes']=_[_0x57a0('0x38')](_0xed9923[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x57aab2['query'][_0x57a0('0x3b')]));_0x1fea9c['attributes']=_0x1fea9c[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x1fea9c['attributes']:_0xed9923['model'];if(!_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x1fea9c['limit']=qs['limit'](_0x57aab2['query'][_0x57a0('0x23')]);_0x1fea9c['offset']=qs[_0x57a0('0x21')](_0x57aab2[_0x57a0('0x3a')]['offset']);}_0x1fea9c[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x57aab2[_0x57a0('0x3a')]['sort']);_0x1fea9c[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x57aab2['query'],_0xed9923[_0x57a0('0x37')]),_0x1476f3);if(_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x1fea9c[_0x57a0('0x42')]=_['merge'](_0x1fea9c[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x1476f3,function(_0x417a5e){if(_0x417a5e[_0x57a0('0x35')]!==_0x57a0('0x45')){var _0x63f2a1={};_0x63f2a1[_0x417a5e[_0x57a0('0x2f')]]={'$like':'%'+_0x57aab2[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x63f2a1;}})});}_0x1fea9c=_[_0x57a0('0x46')]({},_0x1fea9c,_0x57aab2[_0x57a0('0x47')]);var _0x156f2d={'where':_0x1fea9c[_0x57a0('0x42')]};return db[_0x57a0('0x33')]['count'](_0x156f2d)['then'](function(_0x32eaa4){_0x56148c[_0x57a0('0x24')]=_0x32eaa4;if(_0x57aab2['query'][_0x57a0('0x48')]){_0x1fea9c['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x1fea9c);})['then'](function(_0xa90c){_0x56148c[_0x57a0('0x49')]=_0xa90c;return _0x56148c;})[_0x57a0('0x2a')](respondWithFilteredResult(_0x3a789f,_0x1fea9c))['catch'](handleError(_0x3a789f,null));};exports['show']=function(_0x52a332,_0x2385bd){var _0x34be71={'raw':![],'where':{'id':_0x52a332[_0x57a0('0x4a')]['id']}},_0xde01e7={};_0xde01e7['model']=_[_0x57a0('0x4b')](db['CmList']['rawAttributes']);_0xde01e7[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x52a332[_0x57a0('0x3a')]);_0xde01e7[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xde01e7['model'],_0xde01e7['query']);_0x34be71[_0x57a0('0x3c')]=_['intersection'](_0xde01e7[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x52a332[_0x57a0('0x3a')]['fields']));_0x34be71[_0x57a0('0x3c')]=_0x34be71[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x34be71[_0x57a0('0x3c')]:_0xde01e7[_0x57a0('0x39')];if(_0x52a332[_0x57a0('0x3a')][_0x57a0('0x48')]){_0x34be71[_0x57a0('0x4c')]=[{'all':!![]}];}_0x34be71=_['merge']({},_0x34be71,_0x52a332[_0x57a0('0x47')]);return db['CmList'][_0x57a0('0x4d')](_0x34be71)[_0x57a0('0x2a')](handleEntityNotFound(_0x2385bd,null))['then'](respondWithResult(_0x2385bd,null))[_0x57a0('0x4e')](handleError(_0x2385bd,null));};exports[_0x57a0('0x4f')]=function(_0x50d17f,_0x4bd6ad){return db[_0x57a0('0x33')][_0x57a0('0x4f')](_0x50d17f[_0x57a0('0x50')],{})[_0x57a0('0x2a')](function(_0x54fdaa){var _0x59b234=_0x50d17f[_0x57a0('0x51')]['get']({'plain':!![]});if(!_0x59b234)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59b234[_0x57a0('0x52')]===_0x57a0('0x51')){var _0x2efb5b=_0x54fdaa[_0x57a0('0x2b')]({'plain':!![]});var _0x3515f7=_0x57a0('0x53');return db[_0x57a0('0x54')][_0x57a0('0x4d')]({'where':{'name':_0x3515f7,'userProfileId':_0x59b234[_0x57a0('0x55')]},'raw':!![]})[_0x57a0('0x2a')](function(_0x353d48){if(_0x353d48&&_0x353d48[_0x57a0('0x56')]===0x0){return db[_0x57a0('0x2c')]['create']({'name':_0x2efb5b['name'],'resourceId':_0x2efb5b['id'],'type':_0x353d48[_0x57a0('0x2f')],'sectionId':_0x353d48['id']},{})[_0x57a0('0x2a')](function(){return _0x54fdaa;});}else{return _0x54fdaa;}})[_0x57a0('0x4e')](function(_0x178225){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178225);throw _0x178225;});}return _0x54fdaa;})[_0x57a0('0x2a')](respondWithResult(_0x4bd6ad,0xc9))[_0x57a0('0x4e')](handleError(_0x4bd6ad,null));};exports['update']=function(_0x2c809e,_0x3d0f6d){if(_0x2c809e['body']['id']){delete _0x2c809e['body']['id'];}return db[_0x57a0('0x33')]['find']({'where':{'id':_0x2c809e['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x3d0f6d,null))[_0x57a0('0x2a')](saveUpdates(_0x2c809e[_0x57a0('0x50')],null))[_0x57a0('0x2a')](respondWithResult(_0x3d0f6d,null))['catch'](handleError(_0x3d0f6d,null));};exports[_0x57a0('0x29')]=function(_0xdbcfa8,_0x22ab88){return db['CmList'][_0x57a0('0x4d')]({'where':{'id':_0xdbcfa8['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x22ab88,null))[_0x57a0('0x2a')](removeEntity(_0x22ab88,null))[_0x57a0('0x4e')](handleError(_0x22ab88,null));};exports['describe']=function(_0xb8c592,_0xf5fe35){return db[_0x57a0('0x33')]['describe']()['then'](respondWithResult(_0xf5fe35,null))[_0x57a0('0x4e')](handleError(_0xf5fe35,null));};exports[_0x57a0('0x57')]=function(_0x2017fc,_0x2296f9,_0x1e838c){if(_0x2017fc[_0x57a0('0x50')]['id']){delete _0x2017fc[_0x57a0('0x50')]['id'];}return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x2017fc[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x2296f9,null))[_0x57a0('0x2a')](function(_0x844489){if(_0x844489){_0x2017fc['body'][_0x57a0('0x58')]=_0x844489['id'];return db[_0x57a0('0x59')]['create'](_0x2017fc[_0x57a0('0x50')]);}})[_0x57a0('0x2a')](respondWithResult(_0x2296f9,null))[_0x57a0('0x4e')](handleError(_0x2296f9,null));};exports[_0x57a0('0x5a')]=function(_0x5cb88f,_0x3da552,_0x5cd8b6){var _0x5ba08f={'raw':![],'where':{}};var _0xa0614={};var _0x2429e5={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x5cb88f[_0x57a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3da552,null))[_0x57a0('0x2a')](function(_0x5259da){if(_0x5259da){_0xa0614['model']=_[_0x57a0('0x4b')](db['Disposition'][_0x57a0('0x5b')]);_0xa0614[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x5cb88f[_0x57a0('0x3a')]);_0xa0614[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0xa0614[_0x57a0('0x39')],_0xa0614['query']);_0x5ba08f[_0x57a0('0x3c')]=_['intersection'](_0xa0614[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x5cb88f['query']['fields']));_0x5ba08f[_0x57a0('0x3c')]=_0x5ba08f[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x5ba08f[_0x57a0('0x3c')]:_0xa0614['model'];if(!_0x5cb88f['query']['hasOwnProperty'](_0x57a0('0x3f'))){_0x5ba08f[_0x57a0('0x23')]=qs[_0x57a0('0x23')](_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x23')]);_0x5ba08f['offset']=qs[_0x57a0('0x21')](_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x21')]);}_0x5ba08f[_0x57a0('0x40')]=qs['sort'](_0x5cb88f['query']['sort']);_0x5ba08f[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_['pick'](_0x5cb88f[_0x57a0('0x3a')],_0xa0614['filters']));_0x5ba08f[_0x57a0('0x42')]['ListId']=_0x5259da['id'];if(_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x5ba08f[_0x57a0('0x42')]=_[_0x57a0('0x46')](_0x5ba08f[_0x57a0('0x42')],{'$or':_['map'](_0x5ba08f[_0x57a0('0x3c')],function(_0x5018d6){var _0x1ace25={};_0x1ace25[_0x5018d6]={'$like':'%'+_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x1ace25;})});}_0x5ba08f=_[_0x57a0('0x46')]({},_0x5ba08f,_0x5cb88f[_0x57a0('0x47')]);return db[_0x57a0('0x59')][_0x57a0('0x24')]({'where':_0x5ba08f['where']})[_0x57a0('0x2a')](function(_0x5740ef){_0x2429e5[_0x57a0('0x24')]=_0x5740ef;if(_0x5cb88f[_0x57a0('0x3a')][_0x57a0('0x48')]){_0x5ba08f[_0x57a0('0x4c')]=[{'all':!![]}];}return db[_0x57a0('0x59')]['findAll'](_0x5ba08f);})['then'](function(_0xb94d02){_0x2429e5[_0x57a0('0x49')]=_0xb94d02;return _0x2429e5;});}})[_0x57a0('0x2a')](respondWithFilteredResult(_0x3da552,_0x5ba08f))[_0x57a0('0x4e')](handleError(_0x3da552,null));};exports['removeDispositions']=function(_0x49b9a9,_0x407187,_0x4c4975){return db['CmList'][_0x57a0('0x4d')]({'where':{'id':_0x49b9a9[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x407187,null))[_0x57a0('0x2a')](function(_0x5bf138){if(_0x5bf138){return _0x5bf138[_0x57a0('0x5c')](_0x49b9a9['query'][_0x57a0('0x5d')]);}})[_0x57a0('0x2a')](respondWithStatusCode(_0x407187,null))['catch'](handleError(_0x407187,null));};exports['addContacts']=function(_0x38276b,_0x1e4aa3,_0x5b3f5f){return db[_0x57a0('0x33')]['find']({'where':{'id':_0x38276b['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x1e4aa3,null))[_0x57a0('0x2a')](function(_0x3b53a2){if(_0x3b53a2){var _0x1c7a02=[];var _0x49f3d3={'success':[],'errors':[]};return db[_0x57a0('0x5e')][_0x57a0('0x5f')]()[_0x57a0('0x2a')](function(_0x3ae198){if(_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]&&_[_0x57a0('0x61')](_0x38276b['body'][_0x57a0('0x60')])){if(_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')][_0x57a0('0x3d')]){_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')][_0x57a0('0x62')](';')+';';}else{_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=null;}}else{_0x38276b[_0x57a0('0x50')][_0x57a0('0x60')]=null;}if(_0x38276b[_0x57a0('0x50')]&&_[_0x57a0('0x61')](_0x38276b['body'])){for(var _0x565133=0x0;_0x565133<_0x38276b[_0x57a0('0x50')][_0x57a0('0x3d')];_0x565133+=0x1){_0x38276b['body'][_0x565133]['ListId']=_0x38276b[_0x57a0('0x4a')]['id'];_0x1c7a02[_0x57a0('0x63')](_0x38276b[_0x57a0('0x50')][_0x565133]);}return BPromise[_0x57a0('0x64')](_0x1c7a02,function(_0x1f0c48){return db['CmContact'][_0x57a0('0x4f')](_[_0x57a0('0x65')](_0x1f0c48,[_0x57a0('0x5d'),'id'])||{},{'fields':_[_0x57a0('0x4b')](_0x3ae198),'raw':!![]})[_0x57a0('0x2a')](function(_0x5755e){_0x49f3d3['success'][_0x57a0('0x63')](_0x5755e[_0x57a0('0x66')]);})[_0x57a0('0x4e')](function(_0x23d66e){_0x49f3d3[_0x57a0('0x67')][_0x57a0('0x63')]({'data':_0x1f0c48,'error':_0x23d66e[_0x57a0('0x68')]});});})['then'](function(_0x439645){return _0x49f3d3;})[_0x57a0('0x4e')](function(_0x3f0cd0){return _0x3f0cd0;});}else{_0x1e4aa3[_0x57a0('0x1f')](0x190)[_0x57a0('0x20')]({'message':_0x57a0('0x69')});}});}})[_0x57a0('0x2a')](respondWithResult(_0x1e4aa3,null))[_0x57a0('0x4e')](handleError(_0x1e4aa3,null));};exports[_0x57a0('0x6a')]=function(_0x2e9576,_0x2786b5,_0x3e3aad){var _0xda2e76;return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x2e9576['params']['id']},'include':[{'model':db[_0x57a0('0x6b')],'as':_0x57a0('0x6c')}]})['then'](handleEntityNotFound(_0x2786b5,null))[_0x57a0('0x2a')](function(_0x3520c3){if(_0x3520c3){_0xda2e76=_0x3520c3;return db[_0x57a0('0x5e')][_0x57a0('0x5b')];}})['then'](function(_0x486db0){if(_0x486db0){var _0x490c1e={};var _0x323b47={};_0x323b47[_0x57a0('0x39')]=_['concat'](_[_0x57a0('0x4b')](_0x486db0),_[_0x57a0('0x32')](_0xda2e76['CustomFields'],function(_0x48fb40){return util[_0x57a0('0x6d')](_0x57a0('0x6e'),_0x48fb40['id']);}));_0x323b47[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x2e9576[_0x57a0('0x3a')]);_0x323b47[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x323b47[_0x57a0('0x39')],_0x323b47[_0x57a0('0x3a')]);_0x490c1e[_0x57a0('0x3c')]=_[_0x57a0('0x38')](_0x323b47[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x3b')]));_0x490c1e[_0x57a0('0x3c')]=_0x490c1e[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x490c1e[_0x57a0('0x3c')]:_0x323b47[_0x57a0('0x39')];if(!_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x490c1e[_0x57a0('0x23')]=qs['limit'](_0x2e9576[_0x57a0('0x3a')]['limit']);_0x490c1e[_0x57a0('0x21')]=qs['offset'](_0x2e9576['query'][_0x57a0('0x21')]);}_0x490c1e['order']=qs[_0x57a0('0x41')](_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x490c1e[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x2e9576[_0x57a0('0x3a')],_0x323b47[_0x57a0('0x37')]));_0x490c1e[_0x57a0('0x6f')]=!![];if(_0x2e9576['query'][_0x57a0('0x44')]){_0x490c1e[_0x57a0('0x42')]=_[_0x57a0('0x46')](_0x490c1e['where'],{'$or':_[_0x57a0('0x32')](_0x490c1e[_0x57a0('0x3c')],function(_0x3aca1d){var _0xe6858a={};_0xe6858a[_0x3aca1d]={'$like':'%'+_0x2e9576[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0xe6858a;})});}_0x490c1e=_[_0x57a0('0x46')]({},_0x490c1e,_0x2e9576[_0x57a0('0x47')]);return _0xda2e76[_0x57a0('0x6a')](_0x490c1e);}})[_0x57a0('0x2a')](respondWithResult(_0x2786b5,null))['catch'](handleError(_0x2786b5,null));};exports[_0x57a0('0x70')]=function(_0x1d2dc5,_0x28e65a,_0xf9612a){var _0x5b2155;var _0x315887;var _0x2dc807;var _0x29166b=_0x1d2dc5[_0x57a0('0x4a')]['id'];csv_results=[];return db[_0x57a0('0x71')][_0x57a0('0x72')]({'attributes':['id',_0x57a0('0x2f')],'raw':!![],'order':['OrderBy']})[_0x57a0('0x2a')](function(_0x23a792){_0x5b2155=_0x23a792;var _0x12fdf1=_['keys'](db[_0x57a0('0x5e')]['rawAttributes']);return db[_0x57a0('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x57a0('0x73')]})['then'](function(_0x167f1c){_0x315887=_0x167f1c;var _0x48866a=squel[_0x57a0('0x74')]()['fields'](_0x12fdf1)[_0x57a0('0x75')](_0x57a0('0x76'),'c')[_0x57a0('0x42')](_0x57a0('0x77'),_0x29166b)[_0x57a0('0x42')]('c.deletedAt\x20is\x20null')[_0x57a0('0x78')]();for(var _0xc418f1=0x0;_0xc418f1<_0x315887[_0x57a0('0x3d')];_0xc418f1++){_0x48866a['field']('c.cf_'+_0x315887[_0xc418f1]['id'],'customField_'+_0x315887[_0xc418f1][_0x57a0('0x73')]);}for(var _0xc418f1=0x0;_0xc418f1<_0x5b2155[_0x57a0('0x3d')];_0xc418f1++){_0x48866a[_0x57a0('0x79')](squel[_0x57a0('0x74')]()[_0x57a0('0x79')](_0x57a0('0x7a'))[_0x57a0('0x75')](_0x57a0('0x7b'))[_0x57a0('0x42')]('ItemTypeId\x20=\x20?',_0x5b2155[_0xc418f1]['id'])['where']('CmContactId\x20=\x20c.id'),_0x57a0('0x7c')+_0x5b2155[_0xc418f1][_0x57a0('0x2f')]);_0x48866a['field'](squel[_0x57a0('0x74')]()[_0x57a0('0x79')](_0x57a0('0x7d'))[_0x57a0('0x75')](_0x57a0('0x7b'))[_0x57a0('0x42')](_0x57a0('0x7e'),_0x5b2155[_0xc418f1]['id'])[_0x57a0('0x42')](_0x57a0('0x7f')),_0x57a0('0x80')+_0x5b2155[_0xc418f1][_0x57a0('0x2f')]);}var _0x4a2949=[];_0x4a2949[_0x57a0('0x63')](_0x48866a[_0x57a0('0x81')]());BPromise['each'](_0x4a2949,handleQuery)['then'](function(_0x4ddb98){handleQuery(_0x48866a[_0x57a0('0x81')]());var _0x1e9513=csv_results[0x0];if(!_[_0x57a0('0x82')](_0x1e9513)){var _0x30760d=toCsv(_0x1e9513);var _0x40bd74=Date[_0x57a0('0x83')]();fs[_0x57a0('0x84')](util['format'](_0x57a0('0x85'),_0x29166b,_0x40bd74),_0x30760d);_0x28e65a[_0x57a0('0x86')](_0x57a0('0x87'),'attachment;\x20filename='+util[_0x57a0('0x6d')]('list_%d_%s.csv',_0x29166b,_0x40bd74));_0x28e65a[_0x57a0('0x86')]('Content-type','text/csv');return _0x28e65a[_0x57a0('0x88')](util[_0x57a0('0x6d')]('/tmp/list_%d_%s.csv',_0x29166b,_0x40bd74));}else{return _0x28e65a[_0x57a0('0x1e')](0xcc);}});});});};exports[_0x57a0('0x89')]=function(_0x4bb321,_0x37356f,_0x19a691){var _0x4931db;delete _0x4bb321[_0x57a0('0x50')]['id'];return db['CmList']['findOne']({'where':{'id':_0x4bb321[_0x57a0('0x4a')]['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x37356f,null))[_0x57a0('0x2a')](function(_0x71f78){if(_0x71f78){return db[_0x57a0('0x8a')][_0x57a0('0x8b')](function(_0x46817b){return db[_0x57a0('0x6b')]['create'](_0x4bb321[_0x57a0('0x50')],{'transaction':_0x46817b})['then'](function(_0x5c6ba4){_0x4931db=_0x5c6ba4;return _0x71f78[_0x57a0('0x8c')](_0x5c6ba4,{'transaction':_0x46817b});})[_0x57a0('0x2a')](function(){var _0x379255={'type':db[_0x57a0('0x8d')]['TEXT'],'transaction':_0x46817b};switch(_0x4bb321[_0x57a0('0x50')][_0x57a0('0x35')]){case _0x57a0('0x8e'):_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')][_0x57a0('0x8f')];break;case'number':_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')][_0x57a0('0x90')];break;case _0x57a0('0x91'):_0x379255[_0x57a0('0x35')]=db[_0x57a0('0x8d')]['BOOLEAN'];_0x379255['defaultValue']=![];break;default:}return db['sequelize'][_0x57a0('0x92')]['addColumn'](_0x57a0('0x76'),util[_0x57a0('0x6d')](_0x57a0('0x93'),_0x4931db['id']),_0x379255);})[_0x57a0('0x2a')](function(){return _0x4931db;});});}})[_0x57a0('0x2a')](respondWithResult(_0x37356f,null))['catch'](handleError(_0x37356f,null));};exports['getCustomFields']=function(_0x21d655,_0x1d1e86,_0x4625cc){var _0x4344c3={};var _0x3e3e8a={};var _0x2353fa;var _0x4fe11e;return db['CmList'][_0x57a0('0x94')]({'where':{'id':_0x21d655['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x1d1e86,null))[_0x57a0('0x2a')](function(_0x241a6b){if(_0x241a6b){_0x2353fa=_0x241a6b;_0x3e3e8a[_0x57a0('0x39')]=_[_0x57a0('0x4b')](db[_0x57a0('0x6b')][_0x57a0('0x5b')]);_0x3e3e8a[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x21d655[_0x57a0('0x3a')]);_0x3e3e8a[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x3e3e8a['model'],_0x3e3e8a['query']);_0x4344c3[_0x57a0('0x3c')]=_[_0x57a0('0x38')](_0x3e3e8a[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x21d655['query'][_0x57a0('0x3b')]));_0x4344c3[_0x57a0('0x3c')]=_0x4344c3[_0x57a0('0x3c')][_0x57a0('0x3d')]?_0x4344c3[_0x57a0('0x3c')]:_0x3e3e8a[_0x57a0('0x39')];_0x4344c3[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x21d655[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x4344c3[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_['pick'](_0x21d655[_0x57a0('0x3a')],_0x3e3e8a[_0x57a0('0x37')]));_0x4344c3['where']=_[_0x57a0('0x46')](_0x4344c3[_0x57a0('0x42')],{'$or':[{'ListId':_0x241a6b['id']},{'ListId':null}]});if(_0x21d655[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x4344c3[_0x57a0('0x42')]=_['merge'](_0x4344c3[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x4344c3[_0x57a0('0x3c')],function(_0xe59cc1){var _0xf61e79={};_0xf61e79[_0xe59cc1]={'$like':'%'+_0x21d655[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0xf61e79;})});}_0x4344c3=_['merge']({},_0x4344c3,_0x21d655[_0x57a0('0x47')]);return db[_0x57a0('0x6b')][_0x57a0('0x95')](_0x4344c3);}})[_0x57a0('0x2a')](respondWithResult(_0x1d1e86,null))[_0x57a0('0x4e')](handleError(_0x1d1e86,null));};exports[_0x57a0('0x96')]=function(_0x5a6937,_0x2c73eb){return db[_0x57a0('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x57a0('0x2a')](handleEntityNotFound(_0x2c73eb,null))['then'](function(_0xaed72b){return _0xaed72b;})[_0x57a0('0x2a')](respondWithResult(_0x2c73eb,null))['catch'](handleError(_0x2c73eb,null));};exports[_0x57a0('0x97')]=function(_0x6266f5,_0x4af89d,_0x3de896){return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x6266f5['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x4af89d,null))[_0x57a0('0x2a')](function(_0xcedd29){if(_0xcedd29){return _0xcedd29[_0x57a0('0x97')](_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')],_[_0x57a0('0x65')](_0x6266f5['body'],[_0x57a0('0x5d'),'id'])||{})[_0x57a0('0x98')](function(_0x299085){for(var _0x82ec48=0x0;_0x82ec48<_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')][_0x57a0('0x3d')];_0x82ec48+=0x1){socket[_0x57a0('0x99')](_0x57a0('0x9a'),{'UserId':Number(_0x6266f5[_0x57a0('0x50')][_0x57a0('0x5d')][_0x82ec48]),'CmListId':Number(_0x6266f5[_0x57a0('0x4a')]['id'])});}return _0x299085;});}})['then'](respondWithResult(_0x4af89d,null))[_0x57a0('0x4e')](handleError(_0x4af89d,null));};exports[_0x57a0('0x9b')]=function(_0x3416d4,_0x47e929,_0x4a8149){return db[_0x57a0('0x33')][_0x57a0('0x4d')]({'where':{'id':_0x3416d4[_0x57a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47e929,null))['then'](function(_0x4d0413){if(_0x4d0413){return _0x4d0413['removeAgents'](_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')])[_0x57a0('0x2a')](function(){if(_[_0x57a0('0x61')](_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')])){for(var _0x13f7cc=0x0;_0x13f7cc<_0x3416d4[_0x57a0('0x3a')]['ids'][_0x57a0('0x3d')];_0x13f7cc+=0x1){socket['emit'](_0x57a0('0x9c'),{'UserId':Number(_0x3416d4[_0x57a0('0x3a')]['ids'][_0x13f7cc]),'CmListId':Number(_0x3416d4[_0x57a0('0x4a')]['id'])});}}else{socket[_0x57a0('0x99')](_0x57a0('0x9c'),{'UserId':Number(_0x3416d4[_0x57a0('0x3a')][_0x57a0('0x5d')]),'CmListId':Number(_0x3416d4[_0x57a0('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x47e929,null))[_0x57a0('0x4e')](handleError(_0x47e929,null));};exports[_0x57a0('0x9d')]=function(_0x133491,_0x18a6e4,_0x29fc5c){var _0x26901d={};var _0x10e333={};var _0xae1e6b;var _0x55b286;return db[_0x57a0('0x33')][_0x57a0('0x94')]({'where':{'id':_0x133491['params']['id']}})[_0x57a0('0x2a')](handleEntityNotFound(_0x18a6e4,null))[_0x57a0('0x2a')](function(_0x3c1b8d){if(_0x3c1b8d){_0xae1e6b=_0x3c1b8d;_0x10e333['model']=_[_0x57a0('0x4b')](db['User'][_0x57a0('0x5b')]);_0x10e333[_0x57a0('0x3a')]=_[_0x57a0('0x4b')](_0x133491[_0x57a0('0x3a')]);_0x10e333[_0x57a0('0x37')]=_[_0x57a0('0x38')](_0x10e333[_0x57a0('0x39')],_0x10e333[_0x57a0('0x3a')]);_0x26901d['attributes']=_[_0x57a0('0x38')](_0x10e333[_0x57a0('0x39')],qs[_0x57a0('0x3b')](_0x133491['query'][_0x57a0('0x3b')]));_0x26901d[_0x57a0('0x3c')]=_0x26901d['attributes'][_0x57a0('0x3d')]?_0x26901d[_0x57a0('0x3c')]:_0x10e333[_0x57a0('0x39')];_0x26901d[_0x57a0('0x40')]=qs[_0x57a0('0x41')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x41')]);_0x26901d[_0x57a0('0x42')]=qs[_0x57a0('0x37')](_[_0x57a0('0x43')](_0x133491[_0x57a0('0x3a')],_0x10e333[_0x57a0('0x37')]));if(_0x133491[_0x57a0('0x3a')][_0x57a0('0x44')]){_0x26901d['where']=_['merge'](_0x26901d[_0x57a0('0x42')],{'$or':_[_0x57a0('0x32')](_0x26901d[_0x57a0('0x3c')],function(_0x245567){var _0x4134d1={};_0x4134d1[_0x245567]={'$like':'%'+_0x133491[_0x57a0('0x3a')][_0x57a0('0x44')]+'%'};return _0x4134d1;})});}_0x26901d=_[_0x57a0('0x46')]({},_0x26901d,_0x133491[_0x57a0('0x47')]);return _0xae1e6b[_0x57a0('0x9d')](_0x26901d);}})[_0x57a0('0x2a')](function(_0x26ff24){if(_0x26ff24){_0x55b286=_0x26ff24[_0x57a0('0x3d')];if(!_0x133491['query'][_0x57a0('0x3e')](_0x57a0('0x3f'))){_0x26901d['limit']=qs[_0x57a0('0x23')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x23')]);_0x26901d[_0x57a0('0x21')]=qs[_0x57a0('0x21')](_0x133491[_0x57a0('0x3a')][_0x57a0('0x21')]);}return _0xae1e6b[_0x57a0('0x9d')](_0x26901d);}})[_0x57a0('0x2a')](function(_0x1ccd5c){if(_0x1ccd5c){return _0x1ccd5c?{'count':_0x55b286,'rows':_0x1ccd5c}:null;}})[_0x57a0('0x2a')](respondWithResult(_0x18a6e4,null))[_0x57a0('0x4e')](handleError(_0x18a6e4,null));};function handleQuery(_0x532ea3){logger[_0x57a0('0x9e')](_0x532ea3);return db[_0x57a0('0x8a')][_0x57a0('0x3a')](_0x532ea3)[_0x57a0('0x98')](function(_0x4c90eb){csv_results[_0x57a0('0x63')](_0x4c90eb);})['catch'](function(_0x2a9bc9){logger[_0x57a0('0x9f')](_0x2a9bc9['message']);});} \ No newline at end of file +var _0x73e2=['sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','status','stack','name','send','map','CmList','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','keys','length','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','findOne','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','ContactItemType','OrderBy','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER'];(function(_0xf84ac8,_0x3a5e0b){var _0x10145f=function(_0x325a01){while(--_0x325a01){_0xf84ac8['push'](_0xf84ac8['shift']());}};_0x10145f(++_0x3a5e0b);}(_0x73e2,0xb4));var _0x273e=function(_0x3fbb07,_0x574bdb){_0x3fbb07=_0x3fbb07-0x0;var _0x8af26e=_0x73e2[_0x3fbb07];return _0x8af26e;};'use strict';var emlformat=require(_0x273e('0x0'));var rimraf=require(_0x273e('0x1'));var zipdir=require(_0x273e('0x2'));var jsonpatch=require(_0x273e('0x3'));var rp=require(_0x273e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x273e('0x5'));var util=require(_0x273e('0x6'));var path=require(_0x273e('0x7'));var sox=require('sox');var csv=require(_0x273e('0x8'));var ejs=require(_0x273e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x273e('0xa'));var jsforce=require(_0x273e('0xb'));var deskjs=require(_0x273e('0xc'));var toCsv=require(_0x273e('0x8'));var querystring=require(_0x273e('0xd'));var Papa=require(_0x273e('0xe'));var Redis=require(_0x273e('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(_0x273e('0x10'))(_0x273e('0x11'));var utils=require(_0x273e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x273e('0x13'));var db=require(_0x273e('0x14'))['db'];var csv_results;config[_0x273e('0x15')]=_[_0x273e('0x16')](config['redis'],{'host':_0x273e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x273e('0x15')]));require(_0x273e('0x18'))[_0x273e('0x19')](socket);function respondWithStatusCode(_0x23b931,_0x5d036d){_0x5d036d=_0x5d036d||0xcc;return function(_0x2544d8){if(_0x2544d8){return _0x23b931[_0x273e('0x1a')](_0x5d036d);}return _0x23b931['status'](_0x5d036d)[_0x273e('0x1b')]();};}function respondWithResult(_0x43bd46,_0x59015e){_0x59015e=_0x59015e||0xc8;return function(_0x85cf4d){if(_0x85cf4d){return _0x43bd46['status'](_0x59015e)['json'](_0x85cf4d);}};}function respondWithFilteredResult(_0x478be1,_0x46bfaa){return function(_0x1722dc){if(_0x1722dc){var _0x4f2c78=typeof _0x46bfaa[_0x273e('0x1c')]===_0x273e('0x1d')&&typeof _0x46bfaa[_0x273e('0x1e')]===_0x273e('0x1d');var _0x5cb050=_0x1722dc[_0x273e('0x1f')];var _0x30e4cc=_0x4f2c78?0x0:_0x46bfaa[_0x273e('0x1c')];var _0xde4951=_0x4f2c78?_0x1722dc[_0x273e('0x1f')]:_0x46bfaa[_0x273e('0x1c')]+_0x46bfaa[_0x273e('0x1e')];var _0x31deb1;if(_0xde4951>=_0x5cb050){_0xde4951=_0x5cb050;_0x31deb1=0xc8;}else{_0x31deb1=0xce;}_0x478be1['status'](_0x31deb1);return _0x478be1[_0x273e('0x20')](_0x273e('0x21'),_0x30e4cc+'-'+_0xde4951+'/'+_0x5cb050)[_0x273e('0x22')](_0x1722dc);}return null;};}function patchUpdates(_0x334e2a){return function(_0x28674e){try{jsonpatch[_0x273e('0x23')](_0x28674e,_0x334e2a,!![]);}catch(_0x5292d7){return BPromise[_0x273e('0x24')](_0x5292d7);}return _0x28674e[_0x273e('0x25')]();};}function saveUpdates(_0x4ee281,_0x5845d5){return function(_0xb1de04){if(_0xb1de04){return _0xb1de04[_0x273e('0x26')](_0x4ee281)[_0x273e('0x27')](function(_0x39cc24){return _0x39cc24;});}return null;};}function removeEntity(_0x822832,_0x468480){return function(_0x3d90c5){if(_0x3d90c5){return _0x3d90c5[_0x273e('0x28')]()[_0x273e('0x27')](function(){var _0x58d845=_0x3d90c5[_0x273e('0x29')]({'plain':!![]});var _0x474de4=_0x273e('0x2a');return db[_0x273e('0x2b')][_0x273e('0x28')]({'where':{'type':_0x474de4,'resourceId':_0x58d845['id']}})[_0x273e('0x27')](function(){return _0x3d90c5;});})['then'](function(){_0x822832[_0x273e('0x2c')](0xcc)[_0x273e('0x1b')]();});}};}function handleEntityNotFound(_0x345dad,_0x1c4a6d){return function(_0x129109){if(!_0x129109){_0x345dad[_0x273e('0x1a')](0x194);}return _0x129109;};}function handleError(_0x3a8756,_0xdc9ca1){_0xdc9ca1=_0xdc9ca1||0x1f4;return function(_0x17049d){logger['error'](_0x17049d[_0x273e('0x2d')]);if(_0x17049d[_0x273e('0x2e')]){delete _0x17049d['name'];}_0x3a8756[_0x273e('0x2c')](_0xdc9ca1)[_0x273e('0x2f')](_0x17049d);};}exports['index']=function(_0x474a3c,_0x14f1ec){var _0x389a5a={},_0x310435={},_0x119a9a={'count':0x0,'rows':[]};var _0x4d7735=_[_0x273e('0x30')](db[_0x273e('0x31')][_0x273e('0x32')],function(_0x2363de){return{'name':_0x2363de['fieldName'],'type':_0x2363de[_0x273e('0x33')][_0x273e('0x34')]};});_0x310435[_0x273e('0x35')]=_['map'](_0x4d7735,'name');_0x310435['query']=_['keys'](_0x474a3c[_0x273e('0x36')]);_0x310435[_0x273e('0x37')]=_[_0x273e('0x38')](_0x310435[_0x273e('0x35')],_0x310435[_0x273e('0x36')]);_0x389a5a['attributes']=_['intersection'](_0x310435[_0x273e('0x35')],qs['fields'](_0x474a3c[_0x273e('0x36')][_0x273e('0x39')]));_0x389a5a[_0x273e('0x3a')]=_0x389a5a['attributes']['length']?_0x389a5a[_0x273e('0x3a')]:_0x310435[_0x273e('0x35')];if(!_0x474a3c[_0x273e('0x36')][_0x273e('0x3b')](_0x273e('0x3c'))){_0x389a5a[_0x273e('0x1e')]=qs['limit'](_0x474a3c[_0x273e('0x36')]['limit']);_0x389a5a[_0x273e('0x1c')]=qs[_0x273e('0x1c')](_0x474a3c[_0x273e('0x36')][_0x273e('0x1c')]);}_0x389a5a[_0x273e('0x3d')]=qs[_0x273e('0x3e')](_0x474a3c[_0x273e('0x36')]['sort']);_0x389a5a['where']=qs[_0x273e('0x37')](_[_0x273e('0x3f')](_0x474a3c[_0x273e('0x36')],_0x310435[_0x273e('0x37')]),_0x4d7735);if(_0x474a3c[_0x273e('0x36')][_0x273e('0x40')]){_0x389a5a[_0x273e('0x41')]=_[_0x273e('0x42')](_0x389a5a[_0x273e('0x41')],{'$or':_[_0x273e('0x30')](_0x4d7735,function(_0x5277ce){if(_0x5277ce[_0x273e('0x33')]!==_0x273e('0x43')){var _0x3cf68b={};_0x3cf68b[_0x5277ce[_0x273e('0x2e')]]={'$like':'%'+_0x474a3c[_0x273e('0x36')][_0x273e('0x40')]+'%'};return _0x3cf68b;}})});}_0x389a5a=_['merge']({},_0x389a5a,_0x474a3c[_0x273e('0x44')]);var _0x162cb0={'where':_0x389a5a[_0x273e('0x41')]};return db[_0x273e('0x31')]['count'](_0x162cb0)[_0x273e('0x27')](function(_0x4cc087){_0x119a9a[_0x273e('0x1f')]=_0x4cc087;if(_0x474a3c['query'][_0x273e('0x45')]){_0x389a5a[_0x273e('0x46')]=[{'all':!![]}];}return db[_0x273e('0x31')]['findAll'](_0x389a5a);})['then'](function(_0x464888){_0x119a9a[_0x273e('0x47')]=_0x464888;return _0x119a9a;})[_0x273e('0x27')](respondWithFilteredResult(_0x14f1ec,_0x389a5a))['catch'](handleError(_0x14f1ec,null));};exports['show']=function(_0x3ce996,_0xd767c5){var _0x4eae28={'raw':![],'where':{'id':_0x3ce996[_0x273e('0x48')]['id']}},_0x4b5a42={};_0x4b5a42[_0x273e('0x35')]=_[_0x273e('0x49')](db[_0x273e('0x31')][_0x273e('0x32')]);_0x4b5a42[_0x273e('0x36')]=_[_0x273e('0x49')](_0x3ce996['query']);_0x4b5a42[_0x273e('0x37')]=_[_0x273e('0x38')](_0x4b5a42[_0x273e('0x35')],_0x4b5a42[_0x273e('0x36')]);_0x4eae28[_0x273e('0x3a')]=_[_0x273e('0x38')](_0x4b5a42[_0x273e('0x35')],qs[_0x273e('0x39')](_0x3ce996['query'][_0x273e('0x39')]));_0x4eae28[_0x273e('0x3a')]=_0x4eae28[_0x273e('0x3a')][_0x273e('0x4a')]?_0x4eae28['attributes']:_0x4b5a42[_0x273e('0x35')];if(_0x3ce996['query'][_0x273e('0x45')]){_0x4eae28['include']=[{'all':!![]}];}_0x4eae28=_[_0x273e('0x42')]({},_0x4eae28,_0x3ce996['options']);return db[_0x273e('0x31')]['find'](_0x4eae28)[_0x273e('0x27')](handleEntityNotFound(_0xd767c5,null))[_0x273e('0x27')](respondWithResult(_0xd767c5,null))[_0x273e('0x4b')](handleError(_0xd767c5,null));};exports['create']=function(_0x26095a,_0x4a6be4){return db[_0x273e('0x31')]['create'](_0x26095a[_0x273e('0x4c')],{})['then'](function(_0x30eecd){var _0x612304=_0x26095a['user']['get']({'plain':!![]});if(!_0x612304)throw new Error(_0x273e('0x4d'));if(_0x612304['role']===_0x273e('0x4e')){var _0x3047c3=_0x30eecd[_0x273e('0x29')]({'plain':!![]});var _0x9367d0=_0x273e('0x2a');return db[_0x273e('0x4f')][_0x273e('0x50')]({'where':{'name':_0x9367d0,'userProfileId':_0x612304[_0x273e('0x51')]},'raw':!![]})[_0x273e('0x27')](function(_0x44b727){if(_0x44b727&&_0x44b727[_0x273e('0x52')]===0x0){return db[_0x273e('0x2b')][_0x273e('0x53')]({'name':_0x3047c3[_0x273e('0x2e')],'resourceId':_0x3047c3['id'],'type':_0x44b727[_0x273e('0x2e')],'sectionId':_0x44b727['id']},{})['then'](function(){return _0x30eecd;});}else{return _0x30eecd;}})['catch'](function(_0x306132){logger[_0x273e('0x54')](_0x273e('0x55'),_0x306132);throw _0x306132;});}return _0x30eecd;})[_0x273e('0x27')](respondWithResult(_0x4a6be4,0xc9))[_0x273e('0x4b')](handleError(_0x4a6be4,null));};exports['update']=function(_0x473281,_0x37c0a8){if(_0x473281[_0x273e('0x4c')]['id']){delete _0x473281['body']['id'];}return db['CmList']['find']({'where':{'id':_0x473281['params']['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x37c0a8,null))[_0x273e('0x27')](saveUpdates(_0x473281[_0x273e('0x4c')],null))[_0x273e('0x27')](respondWithResult(_0x37c0a8,null))[_0x273e('0x4b')](handleError(_0x37c0a8,null));};exports[_0x273e('0x28')]=function(_0x2c2e15,_0x43b355){return db['CmList']['find']({'where':{'id':_0x2c2e15[_0x273e('0x48')]['id']}})['then'](handleEntityNotFound(_0x43b355,null))[_0x273e('0x27')](removeEntity(_0x43b355,null))['catch'](handleError(_0x43b355,null));};exports['describe']=function(_0x33c054,_0x438132){return db[_0x273e('0x31')]['describe']()[_0x273e('0x27')](respondWithResult(_0x438132,null))['catch'](handleError(_0x438132,null));};exports[_0x273e('0x56')]=function(_0x4caf00,_0x4950a2,_0x2a7731){if(_0x4caf00['body']['id']){delete _0x4caf00['body']['id'];}return db['CmList'][_0x273e('0x50')]({'where':{'id':_0x4caf00[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x4950a2,null))[_0x273e('0x27')](function(_0x536c82){if(_0x536c82){_0x4caf00[_0x273e('0x4c')][_0x273e('0x57')]=_0x536c82['id'];return db[_0x273e('0x58')][_0x273e('0x53')](_0x4caf00[_0x273e('0x4c')]);}})['then'](respondWithResult(_0x4950a2,null))[_0x273e('0x4b')](handleError(_0x4950a2,null));};exports['getDispositions']=function(_0x36671c,_0x4a0d02,_0x21704d){var _0x2b0e28={'raw':![],'where':{}};var _0x9dcd89={};var _0x11962d={'count':0x0,'rows':[]};return db[_0x273e('0x31')][_0x273e('0x59')]({'where':{'id':_0x36671c[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x4a0d02,null))['then'](function(_0x472ca0){if(_0x472ca0){_0x9dcd89[_0x273e('0x35')]=_[_0x273e('0x49')](db['Disposition'][_0x273e('0x32')]);_0x9dcd89[_0x273e('0x36')]=_[_0x273e('0x49')](_0x36671c[_0x273e('0x36')]);_0x9dcd89[_0x273e('0x37')]=_[_0x273e('0x38')](_0x9dcd89[_0x273e('0x35')],_0x9dcd89[_0x273e('0x36')]);_0x2b0e28[_0x273e('0x3a')]=_['intersection'](_0x9dcd89[_0x273e('0x35')],qs['fields'](_0x36671c[_0x273e('0x36')][_0x273e('0x39')]));_0x2b0e28['attributes']=_0x2b0e28[_0x273e('0x3a')][_0x273e('0x4a')]?_0x2b0e28[_0x273e('0x3a')]:_0x9dcd89[_0x273e('0x35')];if(!_0x36671c[_0x273e('0x36')][_0x273e('0x3b')](_0x273e('0x3c'))){_0x2b0e28['limit']=qs[_0x273e('0x1e')](_0x36671c['query'][_0x273e('0x1e')]);_0x2b0e28[_0x273e('0x1c')]=qs[_0x273e('0x1c')](_0x36671c['query'][_0x273e('0x1c')]);}_0x2b0e28[_0x273e('0x3d')]=qs[_0x273e('0x3e')](_0x36671c['query'][_0x273e('0x3e')]);_0x2b0e28[_0x273e('0x41')]=qs[_0x273e('0x37')](_[_0x273e('0x3f')](_0x36671c['query'],_0x9dcd89[_0x273e('0x37')]));_0x2b0e28[_0x273e('0x41')][_0x273e('0x57')]=_0x472ca0['id'];if(_0x36671c['query']['filter']){_0x2b0e28[_0x273e('0x41')]=_[_0x273e('0x42')](_0x2b0e28[_0x273e('0x41')],{'$or':_[_0x273e('0x30')](_0x2b0e28[_0x273e('0x3a')],function(_0x1ac4c2){var _0x34fd99={};_0x34fd99[_0x1ac4c2]={'$like':'%'+_0x36671c['query'][_0x273e('0x40')]+'%'};return _0x34fd99;})});}_0x2b0e28=_[_0x273e('0x42')]({},_0x2b0e28,_0x36671c['options']);return db[_0x273e('0x58')]['count']({'where':_0x2b0e28[_0x273e('0x41')]})['then'](function(_0x5d4e07){_0x11962d['count']=_0x5d4e07;if(_0x36671c[_0x273e('0x36')]['includeAll']){_0x2b0e28[_0x273e('0x46')]=[{'all':!![]}];}return db[_0x273e('0x58')][_0x273e('0x5a')](_0x2b0e28);})[_0x273e('0x27')](function(_0xa72ab0){_0x11962d[_0x273e('0x47')]=_0xa72ab0;return _0x11962d;});}})[_0x273e('0x27')](respondWithFilteredResult(_0x4a0d02,_0x2b0e28))['catch'](handleError(_0x4a0d02,null));};exports[_0x273e('0x5b')]=function(_0x3c85fd,_0x22517e,_0x158297){return db[_0x273e('0x31')][_0x273e('0x50')]({'where':{'id':_0x3c85fd[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x22517e,null))[_0x273e('0x27')](function(_0x58028d){if(_0x58028d){return _0x58028d[_0x273e('0x5b')](_0x3c85fd['query'][_0x273e('0x5c')]);}})[_0x273e('0x27')](respondWithStatusCode(_0x22517e,null))['catch'](handleError(_0x22517e,null));};exports[_0x273e('0x5d')]=function(_0x57122e,_0x36e74e,_0xb447f2){return db[_0x273e('0x31')][_0x273e('0x50')]({'where':{'id':_0x57122e[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x36e74e,null))[_0x273e('0x27')](function(_0x165c57){if(_0x165c57){var _0x264df8=[];var _0xcbd130={'success':[],'errors':[]};return db[_0x273e('0x5e')]['describe']()['then'](function(_0x5281b4){if(_0x57122e[_0x273e('0x4c')]['tags']&&_[_0x273e('0x5f')](_0x57122e[_0x273e('0x4c')]['tags'])){if(_0x57122e['body'][_0x273e('0x60')][_0x273e('0x4a')]){_0x57122e[_0x273e('0x4c')]['tags']=_0x57122e[_0x273e('0x4c')]['tags'][_0x273e('0x61')](';')+';';}else{_0x57122e['body'][_0x273e('0x60')]=null;}}else{_0x57122e[_0x273e('0x4c')][_0x273e('0x60')]=null;}if(_0x57122e[_0x273e('0x4c')]&&_[_0x273e('0x5f')](_0x57122e[_0x273e('0x4c')])){for(var _0x692bc7=0x0;_0x692bc7<_0x57122e['body']['length'];_0x692bc7+=0x1){_0x57122e[_0x273e('0x4c')][_0x692bc7]['ListId']=_0x57122e['params']['id'];_0x264df8[_0x273e('0x62')](_0x57122e[_0x273e('0x4c')][_0x692bc7]);}return BPromise[_0x273e('0x63')](_0x264df8,function(_0x58934a){return db['CmContact'][_0x273e('0x53')](_[_0x273e('0x64')](_0x58934a,[_0x273e('0x5c'),'id'])||{},{'fields':_[_0x273e('0x49')](_0x5281b4),'raw':!![]})[_0x273e('0x27')](function(_0x3b8158){_0xcbd130[_0x273e('0x65')][_0x273e('0x62')](_0x3b8158[_0x273e('0x66')]);})[_0x273e('0x4b')](function(_0x1ca764){_0xcbd130[_0x273e('0x67')][_0x273e('0x62')]({'data':_0x58934a,'error':_0x1ca764['message']});});})[_0x273e('0x27')](function(_0x1f33ba){return _0xcbd130;})[_0x273e('0x4b')](function(_0x256569){return _0x256569;});}else{_0x36e74e[_0x273e('0x2c')](0x190)[_0x273e('0x22')]({'message':_0x273e('0x68')});}});}})[_0x273e('0x27')](respondWithResult(_0x36e74e,null))[_0x273e('0x4b')](handleError(_0x36e74e,null));};exports[_0x273e('0x69')]=function(_0x3b3a0a,_0x4f5b16,_0x25222d){var _0x5b6922;return db[_0x273e('0x31')][_0x273e('0x50')]({'where':{'id':_0x3b3a0a[_0x273e('0x48')]['id']},'include':[{'model':db[_0x273e('0x6a')],'as':_0x273e('0x6b')}]})[_0x273e('0x27')](handleEntityNotFound(_0x4f5b16,null))[_0x273e('0x27')](function(_0x44500c){if(_0x44500c){_0x5b6922=_0x44500c;return db[_0x273e('0x5e')][_0x273e('0x32')];}})['then'](function(_0x1aa964){if(_0x1aa964){var _0x5b1a64={};var _0x556eb6={};_0x556eb6[_0x273e('0x35')]=_[_0x273e('0x6c')](_[_0x273e('0x49')](_0x1aa964),_['map'](_0x5b6922[_0x273e('0x6b')],function(_0x27871b){return util[_0x273e('0x6d')](_0x273e('0x6e'),_0x27871b['id']);}));_0x556eb6[_0x273e('0x36')]=_[_0x273e('0x49')](_0x3b3a0a[_0x273e('0x36')]);_0x556eb6[_0x273e('0x37')]=_['intersection'](_0x556eb6[_0x273e('0x35')],_0x556eb6['query']);_0x5b1a64[_0x273e('0x3a')]=_[_0x273e('0x38')](_0x556eb6[_0x273e('0x35')],qs[_0x273e('0x39')](_0x3b3a0a['query'][_0x273e('0x39')]));_0x5b1a64[_0x273e('0x3a')]=_0x5b1a64[_0x273e('0x3a')]['length']?_0x5b1a64[_0x273e('0x3a')]:_0x556eb6[_0x273e('0x35')];if(!_0x3b3a0a['query']['hasOwnProperty'](_0x273e('0x3c'))){_0x5b1a64[_0x273e('0x1e')]=qs[_0x273e('0x1e')](_0x3b3a0a['query'][_0x273e('0x1e')]);_0x5b1a64[_0x273e('0x1c')]=qs[_0x273e('0x1c')](_0x3b3a0a[_0x273e('0x36')][_0x273e('0x1c')]);}_0x5b1a64[_0x273e('0x3d')]=qs[_0x273e('0x3e')](_0x3b3a0a[_0x273e('0x36')]['sort']);_0x5b1a64[_0x273e('0x41')]=qs[_0x273e('0x37')](_[_0x273e('0x3f')](_0x3b3a0a[_0x273e('0x36')],_0x556eb6[_0x273e('0x37')]));_0x5b1a64[_0x273e('0x6f')]=!![];if(_0x3b3a0a['query'][_0x273e('0x40')]){_0x5b1a64[_0x273e('0x41')]=_['merge'](_0x5b1a64[_0x273e('0x41')],{'$or':_[_0x273e('0x30')](_0x5b1a64[_0x273e('0x3a')],function(_0x4667a5){var _0x5c7b11={};_0x5c7b11[_0x4667a5]={'$like':'%'+_0x3b3a0a[_0x273e('0x36')]['filter']+'%'};return _0x5c7b11;})});}_0x5b1a64=_['merge']({},_0x5b1a64,_0x3b3a0a[_0x273e('0x44')]);return _0x5b6922['getContacts'](_0x5b1a64);}})[_0x273e('0x27')](respondWithResult(_0x4f5b16,null))[_0x273e('0x4b')](handleError(_0x4f5b16,null));};exports['getContactsCsv']=function(_0x374ae7,_0x1e6a74,_0x2c6456){var _0x5236c4;var _0x4d0b0b;var _0x89aaa8;var _0x1d7528=_0x374ae7[_0x273e('0x48')]['id'];csv_results=[];return db[_0x273e('0x70')]['findAll']({'attributes':['id',_0x273e('0x2e')],'raw':!![],'order':[_0x273e('0x71')]})[_0x273e('0x27')](function(_0x2c61e4){_0x5236c4=_0x2c61e4;var _0x92de8f=_[_0x273e('0x49')](db[_0x273e('0x5e')][_0x273e('0x32')]);return db[_0x273e('0x6a')][_0x273e('0x5a')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x1815b7){_0x4d0b0b=_0x1815b7;var _0x478d8c=squel['select']()['fields'](_0x92de8f)[_0x273e('0x72')](_0x273e('0x73'),'c')[_0x273e('0x41')]('c.ListId\x20=\x20?',_0x1d7528)[_0x273e('0x41')](_0x273e('0x74'))[_0x273e('0x75')]();for(var _0x48b459=0x0;_0x48b459<_0x4d0b0b['length'];_0x48b459++){_0x478d8c[_0x273e('0x76')](_0x273e('0x77')+_0x4d0b0b[_0x48b459]['id'],_0x273e('0x78')+_0x4d0b0b[_0x48b459][_0x273e('0x79')]);}for(var _0x48b459=0x0;_0x48b459<_0x5236c4[_0x273e('0x4a')];_0x48b459++){_0x478d8c['field'](squel[_0x273e('0x7a')]()['field'](_0x273e('0x7b'))[_0x273e('0x72')](_0x273e('0x7c'))[_0x273e('0x41')](_0x273e('0x7d'),_0x5236c4[_0x48b459]['id'])[_0x273e('0x41')](_0x273e('0x7e')),_0x273e('0x7f')+_0x5236c4[_0x48b459]['name']);_0x478d8c['field'](squel['select']()[_0x273e('0x76')](_0x273e('0x80'))[_0x273e('0x72')](_0x273e('0x7c'))[_0x273e('0x41')](_0x273e('0x7d'),_0x5236c4[_0x48b459]['id'])[_0x273e('0x41')](_0x273e('0x7e')),_0x273e('0x81')+_0x5236c4[_0x48b459][_0x273e('0x2e')]);}var _0x267449=[];_0x267449['push'](_0x478d8c[_0x273e('0x82')]());BPromise['each'](_0x267449,handleQuery)[_0x273e('0x27')](function(_0x57e2e5){handleQuery(_0x478d8c['toString']());var _0x21e45f=csv_results[0x0];if(!_[_0x273e('0x83')](_0x21e45f)){var _0x11884f=toCsv(_0x21e45f);var _0x6c7a1b=Date[_0x273e('0x84')]();fs[_0x273e('0x85')](util[_0x273e('0x6d')](_0x273e('0x86'),_0x1d7528,_0x6c7a1b),_0x11884f);_0x1e6a74[_0x273e('0x87')](_0x273e('0x88'),_0x273e('0x89')+util[_0x273e('0x6d')](_0x273e('0x8a'),_0x1d7528,_0x6c7a1b));_0x1e6a74[_0x273e('0x87')]('Content-type','text/csv');return _0x1e6a74[_0x273e('0x8b')](util['format'](_0x273e('0x86'),_0x1d7528,_0x6c7a1b));}else{return _0x1e6a74[_0x273e('0x1a')](0xcc);}});});});};exports['addCustomField']=function(_0x5eb1d4,_0x242d09,_0xe19430){var _0x29c8d3;delete _0x5eb1d4[_0x273e('0x4c')]['id'];return db[_0x273e('0x31')][_0x273e('0x59')]({'where':{'id':_0x5eb1d4[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x242d09,null))[_0x273e('0x27')](function(_0x582287){if(_0x582287){return db['sequelize'][_0x273e('0x8c')](function(_0x13adf6){return db['CmCustomField']['create'](_0x5eb1d4['body'],{'transaction':_0x13adf6})[_0x273e('0x27')](function(_0x33c2c5){_0x29c8d3=_0x33c2c5;return _0x582287[_0x273e('0x8d')](_0x33c2c5,{'transaction':_0x13adf6});})[_0x273e('0x27')](function(){var _0x1461bd={'type':db[_0x273e('0x8e')][_0x273e('0x8f')],'transaction':_0x13adf6};switch(_0x5eb1d4[_0x273e('0x4c')][_0x273e('0x33')]){case'text':_0x1461bd[_0x273e('0x33')]=db[_0x273e('0x8e')]['TEXT'];break;case _0x273e('0x90'):_0x1461bd[_0x273e('0x33')]=db['Sequelize'][_0x273e('0x91')];break;case'switch':_0x1461bd[_0x273e('0x33')]=db['Sequelize']['BOOLEAN'];_0x1461bd['defaultValue']=![];break;default:}return db[_0x273e('0x92')][_0x273e('0x93')][_0x273e('0x94')](_0x273e('0x73'),util[_0x273e('0x6d')](_0x273e('0x95'),_0x29c8d3['id']),_0x1461bd);})['then'](function(){return _0x29c8d3;});});}})['then'](respondWithResult(_0x242d09,null))['catch'](handleError(_0x242d09,null));};exports[_0x273e('0x96')]=function(_0x5d46d3,_0x261809,_0x5d079e){var _0x94f155={};var _0x53a7b5={};var _0x2284f7;var _0x5722df;return db[_0x273e('0x31')][_0x273e('0x59')]({'where':{'id':_0x5d46d3[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x261809,null))[_0x273e('0x27')](function(_0x49d76b){if(_0x49d76b){_0x2284f7=_0x49d76b;_0x53a7b5[_0x273e('0x35')]=_[_0x273e('0x49')](db[_0x273e('0x6a')]['rawAttributes']);_0x53a7b5['query']=_[_0x273e('0x49')](_0x5d46d3[_0x273e('0x36')]);_0x53a7b5[_0x273e('0x37')]=_[_0x273e('0x38')](_0x53a7b5['model'],_0x53a7b5[_0x273e('0x36')]);_0x94f155['attributes']=_[_0x273e('0x38')](_0x53a7b5[_0x273e('0x35')],qs[_0x273e('0x39')](_0x5d46d3['query'][_0x273e('0x39')]));_0x94f155[_0x273e('0x3a')]=_0x94f155[_0x273e('0x3a')][_0x273e('0x4a')]?_0x94f155['attributes']:_0x53a7b5[_0x273e('0x35')];_0x94f155[_0x273e('0x3d')]=qs[_0x273e('0x3e')](_0x5d46d3[_0x273e('0x36')][_0x273e('0x3e')]);_0x94f155[_0x273e('0x41')]=qs[_0x273e('0x37')](_['pick'](_0x5d46d3[_0x273e('0x36')],_0x53a7b5[_0x273e('0x37')]));_0x94f155[_0x273e('0x41')]=_[_0x273e('0x42')](_0x94f155[_0x273e('0x41')],{'$or':[{'ListId':_0x49d76b['id']},{'ListId':null}]});if(_0x5d46d3['query']['filter']){_0x94f155[_0x273e('0x41')]=_[_0x273e('0x42')](_0x94f155[_0x273e('0x41')],{'$or':_[_0x273e('0x30')](_0x94f155[_0x273e('0x3a')],function(_0x1da02a){var _0x5e41b3={};_0x5e41b3[_0x1da02a]={'$like':'%'+_0x5d46d3[_0x273e('0x36')][_0x273e('0x40')]+'%'};return _0x5e41b3;})});}_0x94f155=_[_0x273e('0x42')]({},_0x94f155,_0x5d46d3['options']);return db[_0x273e('0x6a')][_0x273e('0x97')](_0x94f155);}})['then'](respondWithResult(_0x261809,null))[_0x273e('0x4b')](handleError(_0x261809,null));};exports[_0x273e('0x98')]=function(_0x8affa8,_0xdf76a){return db[_0x273e('0x6a')][_0x273e('0x97')]({'where':{'ListId':null}})[_0x273e('0x27')](handleEntityNotFound(_0xdf76a,null))[_0x273e('0x27')](function(_0x303d5a){return _0x303d5a;})[_0x273e('0x27')](respondWithResult(_0xdf76a,null))['catch'](handleError(_0xdf76a,null));};exports[_0x273e('0x99')]=function(_0x4f431d,_0x337d1b,_0x496d62){return db[_0x273e('0x31')]['find']({'where':{'id':_0x4f431d[_0x273e('0x48')]['id']}})['then'](handleEntityNotFound(_0x337d1b,null))[_0x273e('0x27')](function(_0x555a2e){if(_0x555a2e){return _0x555a2e[_0x273e('0x99')](_0x4f431d['body'][_0x273e('0x5c')],_[_0x273e('0x64')](_0x4f431d[_0x273e('0x4c')],[_0x273e('0x5c'),'id'])||{})[_0x273e('0x9a')](function(_0x59472f){for(var _0x52fcd0=0x0;_0x52fcd0<_0x4f431d[_0x273e('0x4c')][_0x273e('0x5c')][_0x273e('0x4a')];_0x52fcd0+=0x1){socket[_0x273e('0x9b')](_0x273e('0x9c'),{'UserId':Number(_0x4f431d[_0x273e('0x4c')][_0x273e('0x5c')][_0x52fcd0]),'CmListId':Number(_0x4f431d[_0x273e('0x48')]['id'])});}return _0x59472f;});}})[_0x273e('0x27')](respondWithResult(_0x337d1b,null))[_0x273e('0x4b')](handleError(_0x337d1b,null));};exports[_0x273e('0x9d')]=function(_0x1d77f5,_0x502e3e,_0x395609){return db[_0x273e('0x31')][_0x273e('0x50')]({'where':{'id':_0x1d77f5[_0x273e('0x48')]['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x502e3e,null))['then'](function(_0x322400){if(_0x322400){return _0x322400['removeAgents'](_0x1d77f5[_0x273e('0x36')][_0x273e('0x5c')])[_0x273e('0x27')](function(){if(_[_0x273e('0x5f')](_0x1d77f5[_0x273e('0x36')][_0x273e('0x5c')])){for(var _0x56f00b=0x0;_0x56f00b<_0x1d77f5[_0x273e('0x36')][_0x273e('0x5c')][_0x273e('0x4a')];_0x56f00b+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x1d77f5[_0x273e('0x36')][_0x273e('0x5c')][_0x56f00b]),'CmListId':Number(_0x1d77f5[_0x273e('0x48')]['id'])});}}else{socket[_0x273e('0x9b')](_0x273e('0x9e'),{'UserId':Number(_0x1d77f5[_0x273e('0x36')]['ids']),'CmListId':Number(_0x1d77f5[_0x273e('0x48')]['id'])});}});}})[_0x273e('0x27')](respondWithStatusCode(_0x502e3e,null))['catch'](handleError(_0x502e3e,null));};exports[_0x273e('0x9f')]=function(_0x442a8d,_0x5f5107,_0x4442ca){var _0x295371={};var _0x3b511a={};var _0x31741a;var _0x50bcc3;return db['CmList'][_0x273e('0x59')]({'where':{'id':_0x442a8d['params']['id']}})[_0x273e('0x27')](handleEntityNotFound(_0x5f5107,null))[_0x273e('0x27')](function(_0x279dd0){if(_0x279dd0){_0x31741a=_0x279dd0;_0x3b511a[_0x273e('0x35')]=_['keys'](db[_0x273e('0xa0')]['rawAttributes']);_0x3b511a[_0x273e('0x36')]=_[_0x273e('0x49')](_0x442a8d[_0x273e('0x36')]);_0x3b511a[_0x273e('0x37')]=_[_0x273e('0x38')](_0x3b511a[_0x273e('0x35')],_0x3b511a[_0x273e('0x36')]);_0x295371['attributes']=_[_0x273e('0x38')](_0x3b511a[_0x273e('0x35')],qs[_0x273e('0x39')](_0x442a8d[_0x273e('0x36')][_0x273e('0x39')]));_0x295371[_0x273e('0x3a')]=_0x295371[_0x273e('0x3a')]['length']?_0x295371[_0x273e('0x3a')]:_0x3b511a['model'];_0x295371['order']=qs['sort'](_0x442a8d[_0x273e('0x36')]['sort']);_0x295371[_0x273e('0x41')]=qs[_0x273e('0x37')](_[_0x273e('0x3f')](_0x442a8d[_0x273e('0x36')],_0x3b511a[_0x273e('0x37')]));if(_0x442a8d[_0x273e('0x36')]['filter']){_0x295371[_0x273e('0x41')]=_[_0x273e('0x42')](_0x295371[_0x273e('0x41')],{'$or':_[_0x273e('0x30')](_0x295371[_0x273e('0x3a')],function(_0x3b2afc){var _0x40f71b={};_0x40f71b[_0x3b2afc]={'$like':'%'+_0x442a8d[_0x273e('0x36')][_0x273e('0x40')]+'%'};return _0x40f71b;})});}_0x295371=_[_0x273e('0x42')]({},_0x295371,_0x442a8d[_0x273e('0x44')]);return _0x31741a[_0x273e('0x9f')](_0x295371);}})[_0x273e('0x27')](function(_0x42f2c7){if(_0x42f2c7){_0x50bcc3=_0x42f2c7['length'];if(!_0x442a8d[_0x273e('0x36')]['hasOwnProperty'](_0x273e('0x3c'))){_0x295371[_0x273e('0x1e')]=qs[_0x273e('0x1e')](_0x442a8d[_0x273e('0x36')][_0x273e('0x1e')]);_0x295371[_0x273e('0x1c')]=qs[_0x273e('0x1c')](_0x442a8d[_0x273e('0x36')][_0x273e('0x1c')]);}return _0x31741a['getAgents'](_0x295371);}})[_0x273e('0x27')](function(_0x5ddef2){if(_0x5ddef2){return _0x5ddef2?{'count':_0x50bcc3,'rows':_0x5ddef2}:null;}})['then'](respondWithResult(_0x5f5107,null))['catch'](handleError(_0x5f5107,null));};function handleQuery(_0x15d3ce){logger[_0x273e('0xa1')](_0x15d3ce);return db[_0x273e('0x92')]['query'](_0x15d3ce)[_0x273e('0x9a')](function(_0x58ccc4){csv_results[_0x273e('0x62')](_0x58ccc4);})[_0x273e('0x4b')](function(_0x3f41b1){logger['error'](_0x3f41b1[_0x273e('0xa2')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a954383..0cf18cf 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x57d2c7,_0x5de40f){_0x57d2c7=_0x57d2c7-0x0;var _0x21dc54=_0xe14b[_0x57d2c7];return _0x21dc54;};'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(_0x43f4c8,_0x22a037){var _0x3a2e0c=function(_0x182023){while(--_0x182023){_0x43f4c8['push'](_0x43f4c8['shift']());}};_0x3a2e0c(++_0x22a037);}(_0x814b,0x1a2));var _0xb814=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x814b[_0x215e65];return _0xa85842;};'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 6b7b0fb..bcd905a 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 _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0xf2097,_0x156190){var _0x2670a7=function(_0x136937){while(--_0x136937){_0xf2097['push'](_0xf2097['shift']());}};_0x2670a7(++_0x156190);}(_0x6324,0x142));var _0x4632=function(_0x5341d2,_0x2da6d6){_0x5341d2=_0x5341d2-0x0;var _0x3a4d6a=_0x6324[_0x5341d2];return _0x3a4d6a;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x29c525,_0x51a7a7){var _0x58d7ce=function(_0x8c313d){while(--_0x8c313d){_0x29c525['push'](_0x29c525['shift']());}};_0x58d7ce(++_0x51a7a7);}(_0x702d,0x147));var _0xd702=function(_0x46908a,_0x207b61){_0x46908a=_0x46908a-0x0;var _0x257e09=_0x702d[_0x46908a];return _0x257e09;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 50dcdf8..d0992d4 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 _0x02cc=['client','http','redis','localhost','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x265647,_0x4d3f21){var _0x3a9c63=function(_0x53049e){while(--_0x53049e){_0x265647['push'](_0x265647['shift']());}};_0x3a9c63(++_0x4d3f21);}(_0x02cc,0x1b2));var _0xc02c=function(_0x1c6ccb,_0x192033){_0x1c6ccb=_0x1c6ccb-0x0;var _0x27800d=_0x02cc[_0x1c6ccb];return _0x27800d;};'use strict';var _=require(_0xc02c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc02c('0x1'));var rs=require(_0xc02c('0x2'));var fs=require('fs');var Redis=require(_0xc02c('0x3'));var db=require(_0xc02c('0x4'))['db'];var utils=require(_0xc02c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc02c('0x6'));var client=jayson[_0xc02c('0x7')][_0xc02c('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc02c('0x9')],{'host':_0xc02c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc02c('0x9')]));require(_0xc02c('0xb'))[_0xc02c('0xc')](socket);function respondWithRpcPromise(_0xb2bae,_0x235453,_0x40f9c3){return new BPromise(function(_0x5532ba,_0x6eece8){return client['request'](_0xb2bae,_0x40f9c3)[_0xc02c('0xd')](function(_0x37659e){logger[_0xc02c('0xe')](_0xc02c('0xf'),_0x235453,'request\x20sent');logger[_0xc02c('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x235453,'request\x20sent',JSON['stringify'](_0x37659e));if(_0x37659e['error']){if(_0x37659e[_0xc02c('0x11')][_0xc02c('0x12')]===0x1f4){logger[_0xc02c('0x11')]('CmList,\x20%s,\x20%s',_0x235453,_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);return _0x6eece8(_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);}logger[_0xc02c('0x11')](_0xc02c('0xf'),_0x235453,_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);return _0x5532ba(_0x37659e[_0xc02c('0x11')][_0xc02c('0x13')]);}else{logger[_0xc02c('0xe')](_0xc02c('0xf'),_0x235453,'request\x20sent');_0x5532ba(_0x37659e['result'][_0xc02c('0x13')]);}})[_0xc02c('0x14')](function(_0x1957fc){logger[_0xc02c('0x11')](_0xc02c('0xf'),_0x235453,_0x1957fc);_0x6eece8(_0x1957fc);});});} \ No newline at end of file +var _0xfec5=['../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12026f,_0x548662){var _0x2acc68=function(_0x11e392){while(--_0x11e392){_0x12026f['push'](_0x12026f['shift']());}};_0x2acc68(++_0x548662);}(_0xfec5,0xaf));var _0x5fec=function(_0x4e0363,_0x2ebe2e){_0x4e0363=_0x4e0363-0x0;var _0x1c19fe=_0xfec5[_0x4e0363];return _0x1c19fe;};'use strict';var _=require(_0x5fec('0x0'));var util=require('util');var moment=require(_0x5fec('0x1'));var BPromise=require(_0x5fec('0x2'));var rs=require(_0x5fec('0x3'));var fs=require('fs');var Redis=require(_0x5fec('0x4'));var db=require(_0x5fec('0x5'))['db'];var utils=require(_0x5fec('0x6'));var logger=require(_0x5fec('0x7'))(_0x5fec('0x8'));var config=require(_0x5fec('0x9'));var jayson=require(_0x5fec('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5fec('0xb')](config[_0x5fec('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5fec('0xd'))(new Redis(config[_0x5fec('0xc')]));require(_0x5fec('0xe'))['register'](socket);function respondWithRpcPromise(_0xcff592,_0x180ebe,_0x45e5a2){return new BPromise(function(_0x27ac00,_0x24630f){return client[_0x5fec('0xf')](_0xcff592,_0x45e5a2)[_0x5fec('0x10')](function(_0x49c359){logger[_0x5fec('0x11')](_0x5fec('0x12'),_0x180ebe,_0x5fec('0x13'));logger['debug'](_0x5fec('0x14'),_0x180ebe,_0x5fec('0x13'),JSON['stringify'](_0x49c359));if(_0x49c359[_0x5fec('0x15')]){if(_0x49c359['error'][_0x5fec('0x16')]===0x1f4){logger[_0x5fec('0x15')](_0x5fec('0x12'),_0x180ebe,_0x49c359[_0x5fec('0x15')][_0x5fec('0x17')]);return _0x24630f(_0x49c359[_0x5fec('0x15')][_0x5fec('0x17')]);}logger[_0x5fec('0x15')](_0x5fec('0x12'),_0x180ebe,_0x49c359[_0x5fec('0x15')][_0x5fec('0x17')]);return _0x27ac00(_0x49c359[_0x5fec('0x15')][_0x5fec('0x17')]);}else{logger[_0x5fec('0x11')](_0x5fec('0x12'),_0x180ebe,_0x5fec('0x13'));_0x27ac00(_0x49c359[_0x5fec('0x18')]['message']);}})[_0x5fec('0x19')](function(_0x2f1739){logger['error']('CmList,\x20%s,\x20%s',_0x180ebe,_0x2f1739);_0x24630f(_0x2f1739);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4b37e01..06ddcb7 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 _0xea67=['cmList:','./cmList.events','save','remove','update','emit','removeListener','length'];(function(_0x3fa9d0,_0x31e4ac){var _0x5eae8f=function(_0x589abf){while(--_0x589abf){_0x3fa9d0['push'](_0x3fa9d0['shift']());}};_0x5eae8f(++_0x31e4ac);}(_0xea67,0x121));var _0x7ea6=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0xea67[_0x24243b];return _0x1a85ce;};'use strict';var CmListEvents=require(_0x7ea6('0x0'));var events=[_0x7ea6('0x1'),_0x7ea6('0x2'),_0x7ea6('0x3')];function createListener(_0x48ecdc,_0x11727f){return function(_0x2445bd){_0x11727f[_0x7ea6('0x4')](_0x48ecdc,_0x2445bd);};}function removeListener(_0x13b1d3,_0x5b9b05){return function(){CmListEvents[_0x7ea6('0x5')](_0x13b1d3,_0x5b9b05);};}exports['register']=function(_0x339fa7){for(var _0x40402a=0x0,_0x3cc277=events[_0x7ea6('0x6')];_0x40402a<_0x3cc277;_0x40402a++){var _0xdf5bac=events[_0x40402a];var _0x2a4e43=createListener(_0x7ea6('0x7')+_0xdf5bac,_0x339fa7);CmListEvents['on'](_0xdf5bac,_0x2a4e43);}}; \ No newline at end of file +var _0x1ad0=['remove','update','emit','removeListener','cmList:','./cmList.events','save'];(function(_0x65ebbc,_0x3a7b4b){var _0x468d75=function(_0x4c2ad9){while(--_0x4c2ad9){_0x65ebbc['push'](_0x65ebbc['shift']());}};_0x468d75(++_0x3a7b4b);}(_0x1ad0,0x1b0));var _0x01ad=function(_0x260d5b,_0x9df418){_0x260d5b=_0x260d5b-0x0;var _0x18ae84=_0x1ad0[_0x260d5b];return _0x18ae84;};'use strict';var CmListEvents=require(_0x01ad('0x0'));var events=[_0x01ad('0x1'),_0x01ad('0x2'),_0x01ad('0x3')];function createListener(_0x54e02c,_0x3b19a8){return function(_0x455ff7){_0x3b19a8[_0x01ad('0x4')](_0x54e02c,_0x455ff7);};}function removeListener(_0x34c5d6,_0x406057){return function(){CmListEvents[_0x01ad('0x5')](_0x34c5d6,_0x406057);};}exports['register']=function(_0xfaef1){for(var _0x293f2d=0x0,_0x11b546=events['length'];_0x293f2d<_0x11b546;_0x293f2d++){var _0x331887=events[_0x293f2d];var _0x5bf747=createListener(_0x01ad('0x6')+_0x331887,_0xfaef1);CmListEvents['on'](_0x331887,_0x5bf747);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6fc9c6e..010f401 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 _0x6e86=['get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x9fb704,_0x301996){var _0x1d1790=function(_0x504dbd){while(--_0x504dbd){_0x9fb704['push'](_0x9fb704['shift']());}};_0x1d1790(++_0x301996);}(_0x6e86,0xed));var _0x66e8=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x6e86[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require(_0x66e8('0x0'));var util=require('util');var path=require(_0x66e8('0x1'));var timeout=require(_0x66e8('0x2'));var express=require(_0x66e8('0x3'));var router=express['Router']();var fs_extra=require(_0x66e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x66e8('0x5'));var config=require(_0x66e8('0x6'));var controller=require(_0x66e8('0x7'));router[_0x66e8('0x8')]('/',auth[_0x66e8('0x9')](),controller[_0x66e8('0xa')]);router[_0x66e8('0x8')](_0x66e8('0xb'),auth[_0x66e8('0x9')](),controller[_0x66e8('0xc')]);router[_0x66e8('0x8')](_0x66e8('0xd'),auth[_0x66e8('0x9')](),controller[_0x66e8('0xe')]);router[_0x66e8('0x8')](_0x66e8('0xf'),auth['isAuthenticated'](),controller[_0x66e8('0x10')]);router[_0x66e8('0x8')](_0x66e8('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x66e8('0x8')](_0x66e8('0x12'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x13')]);router[_0x66e8('0x8')](_0x66e8('0x14'),auth[_0x66e8('0x9')](),controller['getContactsCsv']);router[_0x66e8('0x8')](_0x66e8('0x15'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x16')]);router[_0x66e8('0x8')](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x18')]);router['post']('/',auth[_0x66e8('0x9')](),controller[_0x66e8('0x19')]);router[_0x66e8('0x1a')](_0x66e8('0x11'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1b')]);router[_0x66e8('0x1a')](_0x66e8('0x12'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1c')]);router[_0x66e8('0x1a')]('/:id/fields',auth['isAuthenticated'](),controller[_0x66e8('0x1d')]);router['post'](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller[_0x66e8('0x1e')]);router[_0x66e8('0x1f')](_0x66e8('0xf'),auth[_0x66e8('0x9')](),controller['update']);router[_0x66e8('0x20')]('/:id',auth[_0x66e8('0x9')](),controller['destroy']);router['delete'](_0x66e8('0x11'),auth['isAuthenticated'](),controller[_0x66e8('0x21')]);router[_0x66e8('0x20')](_0x66e8('0x17'),auth[_0x66e8('0x9')](),controller['removeAgents']);module[_0x66e8('0x22')]=router; \ No newline at end of file +var _0x7aa0=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','/:id','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7aa0,0x1b9));var _0x07aa=function(_0x3a89d2,_0xa68879){_0x3a89d2=_0x3a89d2-0x0;var _0x5488e4=_0x7aa0[_0x3a89d2];return _0x5488e4;};'use strict';var multer=require(_0x07aa('0x0'));var util=require(_0x07aa('0x1'));var path=require(_0x07aa('0x2'));var timeout=require(_0x07aa('0x3'));var express=require(_0x07aa('0x4'));var router=express['Router']();var fs_extra=require(_0x07aa('0x5'));var auth=require(_0x07aa('0x6'));var interaction=require(_0x07aa('0x7'));var config=require(_0x07aa('0x8'));var controller=require(_0x07aa('0x9'));router[_0x07aa('0xa')]('/',auth['isAuthenticated'](),controller[_0x07aa('0xb')]);router[_0x07aa('0xa')](_0x07aa('0xc'),auth[_0x07aa('0xd')](),controller[_0x07aa('0xe')]);router[_0x07aa('0xa')](_0x07aa('0xf'),auth[_0x07aa('0xd')](),controller['getGlobalCustomFields']);router[_0x07aa('0xa')](_0x07aa('0x10'),auth[_0x07aa('0xd')](),controller['show']);router[_0x07aa('0xa')](_0x07aa('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x07aa('0xa')]('/:id/contacts',auth[_0x07aa('0xd')](),controller[_0x07aa('0x12')]);router['get'](_0x07aa('0x13'),auth['isAuthenticated'](),controller[_0x07aa('0x14')]);router[_0x07aa('0xa')]('/:id/fields',auth[_0x07aa('0xd')](),controller['getCustomFields']);router['get'](_0x07aa('0x15'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x16')]);router[_0x07aa('0x17')]('/',auth[_0x07aa('0xd')](),controller['create']);router[_0x07aa('0x17')](_0x07aa('0x11'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x18')]);router[_0x07aa('0x17')](_0x07aa('0x19'),auth['isAuthenticated'](),controller[_0x07aa('0x1a')]);router[_0x07aa('0x17')](_0x07aa('0x1b'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x1c')]);router[_0x07aa('0x17')](_0x07aa('0x15'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x1d')]);router[_0x07aa('0x1e')](_0x07aa('0x10'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x1f')]);router['delete']('/:id',auth[_0x07aa('0xd')](),controller[_0x07aa('0x20')]);router[_0x07aa('0x21')](_0x07aa('0x11'),auth[_0x07aa('0xd')](),controller[_0x07aa('0x22')]);router[_0x07aa('0x21')]('/:id/users',auth[_0x07aa('0xd')](),controller[_0x07aa('0x23')]);module[_0x07aa('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 364f71e..9e75b3b 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 _0x6650=['STRING','exports','VIRTUAL'];(function(_0x457b3d,_0x1d5709){var _0xf55f65=function(_0x33cb05){while(--_0x33cb05){_0x457b3d['push'](_0x457b3d['shift']());}};_0xf55f65(++_0x1d5709);}(_0x6650,0xf4));var _0x0665=function(_0x3007b4,_0x4a2d76){_0x3007b4=_0x3007b4-0x0;var _0x2a976e=_0x6650[_0x3007b4];return _0x2a976e;};'use strict';var Sequelize=require('sequelize');module[_0x0665('0x0')]={'name':{'type':Sequelize[_0x0665('0x1')],'get':function(_0x286784){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0665('0x2')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4398=['VIRTUAL','getDataValue','field','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4398,0xc0));var _0x8439=function(_0x303cfe,_0x278640){_0x303cfe=_0x303cfe-0x0;var _0x54a1d1=_0x4398[_0x303cfe];return _0x54a1d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8439('0x0')],'get':function(_0x17393b){return this[_0x8439('0x1')](_0x8439('0x2'));}},'field':{'type':Sequelize[_0x8439('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 62a1d29..99f1bdc 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2ff6fc,_0x5e6a2d){var _0xad0dea=function(_0x419b7e){while(--_0x419b7e){_0x2ff6fc['push'](_0x2ff6fc['shift']());}};_0xad0dea(++_0x5e6a2d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x46fd66,_0x5a77c9){var _0xb4495c=function(_0x435d1f){while(--_0x435d1f){_0x46fd66['push'](_0x46fd66['shift']());}};_0xb4495c(++_0x5a77c9);}(_0x7a54,0x106));var _0x47a5=function(_0x25ab9a,_0x1fc4f8){_0x25ab9a=_0x25ab9a-0x0;var _0x3b90db=_0x7a54[_0x25ab9a];return _0x3b90db;};'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 6e59587..6209d64 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 _0x4871=['api','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger'];(function(_0x312a89,_0x24f89b){var _0x4f0338=function(_0x218fa2){while(--_0x218fa2){_0x312a89['push'](_0x312a89['shift']());}};_0x4f0338(++_0x24f89b);}(_0x4871,0x1d1));var _0x1487=function(_0x5c9a5a,_0x1cff8c){_0x5c9a5a=_0x5c9a5a-0x0;var _0x5bab92=_0x4871[_0x5c9a5a];return _0x5bab92;};'use strict';var _=require(_0x1487('0x0'));var util=require(_0x1487('0x1'));var logger=require(_0x1487('0x2'))(_0x1487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1487('0x4'));var fs=require('fs');var path=require(_0x1487('0x5'));var rimraf=require(_0x1487('0x6'));var config=require(_0x1487('0x7'));var attributes=require(_0x1487('0x8'));module[_0x1487('0x9')]=function(_0x513d5c,_0x5704d9){return _0x513d5c[_0x1487('0xa')](_0x1487('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39ba=['Condition','tools_conditions','lodash','util','bluebird','request-promise','rimraf','./condition.attributes','exports','define'];(function(_0x1303e7,_0x804a9c){var _0x5312ff=function(_0x537e70){while(--_0x537e70){_0x1303e7['push'](_0x1303e7['shift']());}};_0x5312ff(++_0x804a9c);}(_0x39ba,0xc0));var _0xa39b=function(_0x181c24,_0x48b564){_0x181c24=_0x181c24-0x0;var _0x1850f3=_0x39ba[_0x181c24];return _0x1850f3;};'use strict';var _=require(_0xa39b('0x0'));var util=require(_0xa39b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa39b('0x2'));var rp=require(_0xa39b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa39b('0x4'));var config=require('../../config/environment');var attributes=require(_0xa39b('0x5'));module[_0xa39b('0x6')]=function(_0x19748a,_0x1227f7){return _0x19748a[_0xa39b('0x7')](_0xa39b('0x8'),attributes,{'tableName':_0xa39b('0x9'),'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 959a2d9..da11f72 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 _0x1e8d=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x291843,_0x4d7fac){var _0x3a03fd=function(_0x61268d){while(--_0x61268d){_0x291843['push'](_0x291843['shift']());}};_0x3a03fd(++_0x4d7fac);}(_0x1e8d,0x190));var _0xd1e8=function(_0x1e6b41,_0x33ce88){_0x1e6b41=_0x1e6b41-0x0;var _0x4159f1=_0x1e8d[_0x1e6b41];return _0x4159f1;};'use strict';var _=require(_0xd1e8('0x0'));var util=require(_0xd1e8('0x1'));var moment=require(_0xd1e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1e8('0x4'));var logger=require(_0xd1e8('0x5'))(_0xd1e8('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1e8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2696b2,_0x6d6555,_0x34de51){return new BPromise(function(_0x13d2fa,_0x3d9ba5){return client[_0xd1e8('0x8')](_0x2696b2,_0x34de51)['then'](function(_0x5a08a2){logger[_0xd1e8('0x9')](_0xd1e8('0xa'),_0x6d6555,_0xd1e8('0xb'));logger[_0xd1e8('0xc')](_0xd1e8('0xd'),_0x6d6555,'request\x20sent',JSON[_0xd1e8('0xe')](_0x5a08a2));if(_0x5a08a2[_0xd1e8('0xf')]){if(_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x10')]===0x1f4){logger[_0xd1e8('0xf')](_0xd1e8('0xa'),_0x6d6555,_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);return _0x3d9ba5(_0x5a08a2['error']['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x6d6555,_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);return _0x13d2fa(_0x5a08a2[_0xd1e8('0xf')][_0xd1e8('0x11')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x6d6555,'request\x20sent');_0x13d2fa(_0x5a08a2[_0xd1e8('0x12')][_0xd1e8('0x11')]);}})[_0xd1e8('0x13')](function(_0x29242e){logger[_0xd1e8('0xf')](_0xd1e8('0xa'),_0x6d6555,_0x29242e);_0x3d9ba5(_0x29242e);});});} \ No newline at end of file +var _0x7bc4=['message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x3202ab,_0x4fd6d2){var _0x3fba91=function(_0x2d619b){while(--_0x2d619b){_0x3202ab['push'](_0x3202ab['shift']());}};_0x3fba91(++_0x4fd6d2);}(_0x7bc4,0x17e));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x47bc('0x0'));var util=require(_0x47bc('0x1'));var moment=require(_0x47bc('0x2'));var BPromise=require(_0x47bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47bc('0x4'));var db=require(_0x47bc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x47bc('0x6'));var client=jayson[_0x47bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e796e,_0x75b4a5,_0x23a98f){return new BPromise(function(_0x460c6f,_0x2537b){return client['request'](_0x4e796e,_0x23a98f)[_0x47bc('0x8')](function(_0x2d2c5d){logger[_0x47bc('0x9')](_0x47bc('0xa'),_0x75b4a5,_0x47bc('0xb'));logger[_0x47bc('0xc')](_0x47bc('0xd'),_0x75b4a5,_0x47bc('0xb'),JSON[_0x47bc('0xe')](_0x2d2c5d));if(_0x2d2c5d['error']){if(_0x2d2c5d['error'][_0x47bc('0xf')]===0x1f4){logger['error'](_0x47bc('0xa'),_0x75b4a5,_0x2d2c5d[_0x47bc('0x10')][_0x47bc('0x11')]);return _0x2537b(_0x2d2c5d[_0x47bc('0x10')][_0x47bc('0x11')]);}logger['error']('Condition,\x20%s,\x20%s',_0x75b4a5,_0x2d2c5d['error'][_0x47bc('0x11')]);return _0x460c6f(_0x2d2c5d[_0x47bc('0x10')][_0x47bc('0x11')]);}else{logger['info'](_0x47bc('0xa'),_0x75b4a5,_0x47bc('0xb'));_0x460c6f(_0x2d2c5d['result'][_0x47bc('0x11')]);}})[_0x47bc('0x12')](function(_0x2fe7ad){logger[_0x47bc('0x10')](_0x47bc('0xa'),_0x75b4a5,_0x2fe7ad);_0x2537b(_0x2fe7ad);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index aae9436..adc245c 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 _0x092f=['express','Router','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','multer','util','path','connect-timeout'];(function(_0x17fea7,_0x102927){var _0x3150c3=function(_0x1d6bd0){while(--_0x1d6bd0){_0x17fea7['push'](_0x17fea7['shift']());}};_0x3150c3(++_0x102927);}(_0x092f,0x15b));var _0xf092=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x092f[_0x492535];return _0x256620;};'use strict';var multer=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var path=require(_0xf092('0x2'));var timeout=require(_0xf092('0x3'));var express=require(_0xf092('0x4'));var router=express[_0xf092('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf092('0x6'));var config=require('../../config/environment');var controller=require(_0xf092('0x7'));router[_0xf092('0x8')](_0xf092('0x9'),auth[_0xf092('0xa')](),controller[_0xf092('0xb')]);router[_0xf092('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc930=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','update','/:id','destroy','exports','multer','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc930,0x1b1));var _0x0c93=function(_0x57b484,_0x2272b4){_0x57b484=_0x57b484-0x0;var _0x823cf6=_0xc930[_0x57b484];return _0x823cf6;};'use strict';var multer=require(_0x0c93('0x0'));var util=require(_0x0c93('0x1'));var path=require(_0x0c93('0x2'));var timeout=require(_0x0c93('0x3'));var express=require(_0x0c93('0x4'));var router=express[_0x0c93('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0c93('0x6'));var interaction=require(_0x0c93('0x7'));var config=require(_0x0c93('0x8'));var controller=require(_0x0c93('0x9'));router['put']('/:id',auth[_0x0c93('0xa')](),controller[_0x0c93('0xb')]);router['delete'](_0x0c93('0xc'),auth['isAuthenticated'](),controller[_0x0c93('0xd')]);module[_0x0c93('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 2ba7d58..97a0651 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 _0xee6c=['STRING','sequelize','name','INTEGER'];(function(_0x224347,_0x4e0d3c){var _0x518666=function(_0x31be64){while(--_0x31be64){_0x224347['push'](_0x224347['shift']());}};_0x518666(++_0x4e0d3c);}(_0xee6c,0x139));var _0xcee6=function(_0x33554,_0x271ce4){_0x33554=_0x33554-0x0;var _0x245a00=_0xee6c[_0x33554];return _0x245a00;};'use strict';var Sequelize=require(_0xcee6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcee6('0x1')},'OrderBy':{'type':Sequelize[_0xcee6('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xcee6('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x99c0=['STRING','name','sequelize','exports'];(function(_0x285595,_0x171a9f){var _0x2d1450=function(_0x4a4961){while(--_0x4a4961){_0x285595['push'](_0x285595['shift']());}};_0x2d1450(++_0x171a9f);}(_0x99c0,0xda));var _0x099c=function(_0x30f719,_0x139e36){_0x30f719=_0x30f719-0x0;var _0xd1325f=_0x99c0[_0x30f719];return _0xd1325f;};'use strict';var Sequelize=require(_0x099c('0x0'));module[_0x099c('0x1')]={'name':{'type':Sequelize[_0x099c('0x2')],'allowNull':![],'unique':_0x099c('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x099c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index a0a04d7..b0402ff 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 _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','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','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x2eb042,_0x145afa){var _0x53636a=function(_0x16057c){while(--_0x16057c){_0x2eb042['push'](_0x2eb042['shift']());}};_0x53636a(++_0x145afa);}(_0x6a95,0x1db));var _0x56a9=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x6a95[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file +var _0x36ee=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','stack','index','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4da68b,_0x4479c7){var _0x5ce111=function(_0xbc26f6){while(--_0xbc26f6){_0x4da68b['push'](_0x4da68b['shift']());}};_0x5ce111(++_0x4479c7);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['ContactItemType'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='ContactItemTypes';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['ContactItemType']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](db[_0xe36e('0x54')][_0xe36e('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7c3766[_0xe36e('0x46')]['id']}}))[_0xe36e('0x26')](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9444348..02e1bfb 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 _0x7fbc=['exports','ContactItemType','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x47ce41,_0x1a5136){var _0x342ee1=function(_0x4ddc75){while(--_0x4ddc75){_0x47ce41['push'](_0x47ce41['shift']());}};_0x342ee1(++_0x1a5136);}(_0x7fbc,0xde));var _0xc7fb=function(_0xc67fe1,_0x56c68b){_0xc67fe1=_0xc67fe1-0x0;var _0x215008=_0x7fbc[_0xc67fe1];return _0x215008;};'use strict';var _=require(_0xc7fb('0x0'));var util=require('util');var logger=require(_0xc7fb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc7fb('0x2'));var rp=require(_0xc7fb('0x3'));var fs=require('fs');var path=require(_0xc7fb('0x4'));var rimraf=require(_0xc7fb('0x5'));var config=require(_0xc7fb('0x6'));var attributes=require(_0xc7fb('0x7'));module[_0xc7fb('0x8')]=function(_0x4261c8,_0x126392){return _0x4261c8['define'](_0xc7fb('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x923a=['bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','lodash','api'];(function(_0x58e1b0,_0x64e502){var _0x321c27=function(_0x5df3e0){while(--_0x5df3e0){_0x58e1b0['push'](_0x58e1b0['shift']());}};_0x321c27(++_0x64e502);}(_0x923a,0x116));var _0xa923=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x923a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa923('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa923('0x1'));var moment=require('moment');var BPromise=require(_0xa923('0x2'));var rp=require(_0xa923('0x3'));var fs=require('fs');var path=require(_0xa923('0x4'));var rimraf=require(_0xa923('0x5'));var config=require('../../config/environment');var attributes=require(_0xa923('0x6'));module[_0xa923('0x7')]=function(_0x22231f,_0x1a568a){return _0x22231f[_0xa923('0x8')](_0xa923('0x9'),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 5bb231d..92874f2 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 _0x6a7a=['then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x224fb5,_0x13f5c2){var _0xf5f4b8=function(_0x3b5eb3){while(--_0x3b5eb3){_0x224fb5['push'](_0x224fb5['shift']());}};_0xf5f4b8(++_0x13f5c2);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x5d1e3c,_0x369af4){_0x5d1e3c=_0x5d1e3c-0x0;var _0x37495f=_0x6a7a[_0x5d1e3c];return _0x37495f;};'use strict';var _=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var moment=require(_0xa6a7('0x2'));var BPromise=require(_0xa6a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a7('0x4'));var db=require(_0xa6a7('0x5'))['db'];var utils=require(_0xa6a7('0x6'));var logger=require('../../config/logger')(_0xa6a7('0x7'));var config=require(_0xa6a7('0x8'));var jayson=require(_0xa6a7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x262ea0,_0x4e1991,_0x5b83e7){return new BPromise(function(_0x2ff096,_0xb1109d){return client[_0xa6a7('0xa')](_0x262ea0,_0x5b83e7)[_0xa6a7('0xb')](function(_0x1f2bae){logger[_0xa6a7('0xc')]('ContactItemType,\x20%s,\x20%s',_0x4e1991,'request\x20sent');logger[_0xa6a7('0xd')](_0xa6a7('0xe'),_0x4e1991,_0xa6a7('0xf'),JSON['stringify'](_0x1f2bae));if(_0x1f2bae[_0xa6a7('0x10')]){if(_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x11')]===0x1f4){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0xb1109d(_0x1f2bae['error'][_0xa6a7('0x13')]);}logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);return _0x2ff096(_0x1f2bae[_0xa6a7('0x10')][_0xa6a7('0x13')]);}else{logger[_0xa6a7('0xc')](_0xa6a7('0x12'),_0x4e1991,_0xa6a7('0xf'));_0x2ff096(_0x1f2bae[_0xa6a7('0x14')][_0xa6a7('0x13')]);}})[_0xa6a7('0x15')](function(_0x505b71){logger[_0xa6a7('0x10')](_0xa6a7('0x12'),_0x4e1991,_0x505b71);_0xb1109d(_0x505b71);});});} \ No newline at end of file +var _0x869d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5c6aa1,_0x5792a2){var _0x23b899=function(_0x336149){while(--_0x336149){_0x5c6aa1['push'](_0x5c6aa1['shift']());}};_0x23b899(++_0x5792a2);}(_0x869d,0x11d));var _0xd869=function(_0x425f05,_0x3db28c){_0x425f05=_0x425f05-0x0;var _0x341eed=_0x869d[_0x425f05];return _0x341eed;};'use strict';var _=require(_0xd869('0x0'));var util=require(_0xd869('0x1'));var moment=require(_0xd869('0x2'));var BPromise=require(_0xd869('0x3'));var rs=require(_0xd869('0x4'));var fs=require('fs');var Redis=require(_0xd869('0x5'));var db=require(_0xd869('0x6'))['db'];var utils=require(_0xd869('0x7'));var logger=require(_0xd869('0x8'))(_0xd869('0x9'));var config=require('../../config/environment');var jayson=require(_0xd869('0xa'));var client=jayson[_0xd869('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e23f2,_0x250166,_0x395923){return new BPromise(function(_0x51b3d,_0x200fc9){return client['request'](_0x4e23f2,_0x395923)[_0xd869('0xc')](function(_0xe2506a){logger[_0xd869('0xd')](_0xd869('0xe'),_0x250166,'request\x20sent');logger[_0xd869('0xf')](_0xd869('0x10'),_0x250166,_0xd869('0x11'),JSON[_0xd869('0x12')](_0xe2506a));if(_0xe2506a[_0xd869('0x13')]){if(_0xe2506a[_0xd869('0x13')][_0xd869('0x14')]===0x1f4){logger[_0xd869('0x13')](_0xd869('0xe'),_0x250166,_0xe2506a[_0xd869('0x13')][_0xd869('0x15')]);return _0x200fc9(_0xe2506a['error']['message']);}logger['error'](_0xd869('0xe'),_0x250166,_0xe2506a[_0xd869('0x13')][_0xd869('0x15')]);return _0x51b3d(_0xe2506a[_0xd869('0x13')]['message']);}else{logger[_0xd869('0xd')](_0xd869('0xe'),_0x250166,_0xd869('0x11'));_0x51b3d(_0xe2506a[_0xd869('0x16')][_0xd869('0x15')]);}})[_0xd869('0x17')](function(_0x4d7dc3){logger[_0xd869('0x13')](_0xd869('0xe'),_0x250166,_0x4d7dc3);_0x200fc9(_0x4d7dc3);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index d8524e5..b3a73e5 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 _0xb74d=['index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated'];(function(_0x1c8a17,_0x266d09){var _0x1a2129=function(_0x5e727e){while(--_0x5e727e){_0x1c8a17['push'](_0x1c8a17['shift']());}};_0x1a2129(++_0x266d09);}(_0xb74d,0x69));var _0xdb74=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0xb74d[_0x547e20];return _0x359171;};'use strict';var multer=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var path=require(_0xdb74('0x2'));var timeout=require(_0xdb74('0x3'));var express=require(_0xdb74('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb74('0x5'));var interaction=require(_0xdb74('0x6'));var config=require('../../config/environment');var controller=require(_0xdb74('0x7'));router['get']('/',auth[_0xdb74('0x8')](),controller[_0xdb74('0x9')]);router[_0xdb74('0xa')](_0xdb74('0xb'),auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router[_0xdb74('0xd')]('/',auth[_0xdb74('0x8')](),controller['create']);router[_0xdb74('0xe')](_0xdb74('0xb'),auth[_0xdb74('0x8')](),controller[_0xdb74('0xf')]);router[_0xdb74('0x10')]('/:id',auth[_0xdb74('0x8')](),controller[_0xdb74('0x11')]);module[_0xdb74('0x12')]=router; \ No newline at end of file +var _0xb6c5=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xbacbcd,_0x208c23){var _0x2533a9=function(_0x2d3dfa){while(--_0x2d3dfa){_0xbacbcd['push'](_0xbacbcd['shift']());}};_0x2533a9(++_0x208c23);}(_0xb6c5,0x84));var _0x5b6c=function(_0x29bbf2,_0x346471){_0x29bbf2=_0x29bbf2-0x0;var _0x37fbe1=_0xb6c5[_0x29bbf2];return _0x37fbe1;};'use strict';var multer=require(_0x5b6c('0x0'));var util=require(_0x5b6c('0x1'));var path=require(_0x5b6c('0x2'));var timeout=require(_0x5b6c('0x3'));var express=require(_0x5b6c('0x4'));var router=express[_0x5b6c('0x5')]();var fs_extra=require(_0x5b6c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5b6c('0x7'));var config=require(_0x5b6c('0x8'));var controller=require(_0x5b6c('0x9'));router[_0x5b6c('0xa')]('/',auth[_0x5b6c('0xb')](),controller[_0x5b6c('0xc')]);router[_0x5b6c('0xa')](_0x5b6c('0xd'),auth['isAuthenticated'](),controller[_0x5b6c('0xe')]);router[_0x5b6c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x5b6c('0xb')](),controller[_0x5b6c('0x10')]);router[_0x5b6c('0x11')](_0x5b6c('0xd'),auth[_0x5b6c('0xb')](),controller[_0x5b6c('0x12')]);module[_0x5b6c('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 78ec39c..0253b71 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 _0xbaf0=['name','exports','STRING'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b1b9a92..95309e4 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 _0x0449=['apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','DashboardItem','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0449,0xdf));var _0x9044=function(_0x5dbdb9,_0x2e4412){_0x5dbdb9=_0x5dbdb9-0x0;var _0x44359e=_0x0449[_0x5dbdb9];return _0x44359e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9044('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9044('0x1'));var moment=require(_0x9044('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9044('0x3'));var util=require(_0x9044('0x4'));var path=require(_0x9044('0x5'));var sox=require(_0x9044('0x6'));var csv=require(_0x9044('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9044('0x8'));var squel=require(_0x9044('0x9'));var crypto=require(_0x9044('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9044('0x7'));var querystring=require('querystring');var Papa=require(_0x9044('0xb'));var Redis=require(_0x9044('0xc'));var authService=require(_0x9044('0xd'));var qs=require(_0x9044('0xe'));var as=require(_0x9044('0xf'));var hardwareService=require(_0x9044('0x10'));var logger=require(_0x9044('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9044('0x12'))['db'];config[_0x9044('0x13')]=_[_0x9044('0x14')](config[_0x9044('0x13')],{'host':_0x9044('0x15'),'port':0x18eb});var socket=require(_0x9044('0x16'))(new Redis(config['redis']));require(_0x9044('0x17'))[_0x9044('0x18')](socket);function respondWithStatusCode(_0x38483c,_0x2dab80){_0x2dab80=_0x2dab80||0xcc;return function(_0x1d7433){if(_0x1d7433){return _0x38483c[_0x9044('0x19')](_0x2dab80);}return _0x38483c[_0x9044('0x1a')](_0x2dab80)[_0x9044('0x1b')]();};}function respondWithResult(_0x2f4200,_0x3df5d1){_0x3df5d1=_0x3df5d1||0xc8;return function(_0x53f7b7){if(_0x53f7b7){return _0x2f4200[_0x9044('0x1a')](_0x3df5d1)[_0x9044('0x1c')](_0x53f7b7);}};}function respondWithFilteredResult(_0x14d9be,_0x2214bb){return function(_0x7d711d){if(_0x7d711d){var _0x457d91=typeof _0x2214bb[_0x9044('0x1d')]==='undefined'&&typeof _0x2214bb[_0x9044('0x1e')]===_0x9044('0x1f');var _0x319593=_0x7d711d[_0x9044('0x20')];var _0x2c40e2=_0x457d91?0x0:_0x2214bb[_0x9044('0x1d')];var _0x4b63c1=_0x457d91?_0x7d711d[_0x9044('0x20')]:_0x2214bb[_0x9044('0x1d')]+_0x2214bb[_0x9044('0x1e')];var _0x56b906;if(_0x4b63c1>=_0x319593){_0x4b63c1=_0x319593;_0x56b906=0xc8;}else{_0x56b906=0xce;}_0x14d9be[_0x9044('0x1a')](_0x56b906);return _0x14d9be[_0x9044('0x21')](_0x9044('0x22'),_0x2c40e2+'-'+_0x4b63c1+'/'+_0x319593)[_0x9044('0x1c')](_0x7d711d);}return null;};}function patchUpdates(_0x17b82c){return function(_0x568e16){try{jsonpatch[_0x9044('0x23')](_0x568e16,_0x17b82c,!![]);}catch(_0x5c4aa4){return BPromise[_0x9044('0x24')](_0x5c4aa4);}return _0x568e16[_0x9044('0x25')]();};}function saveUpdates(_0x1c84cb,_0x962f65){return function(_0x59f196){if(_0x59f196){return _0x59f196[_0x9044('0x26')](_0x1c84cb)[_0x9044('0x27')](function(_0x3fbcc5){return _0x3fbcc5;});}return null;};}function removeEntity(_0x36a1b9,_0x50f8b0){return function(_0x4cb5cc){if(_0x4cb5cc){return _0x4cb5cc['destroy']()[_0x9044('0x27')](function(){var _0x77d480=_0x4cb5cc[_0x9044('0x28')]({'plain':!![]});var _0x3e8b30=_0x9044('0x29');return db[_0x9044('0x2a')][_0x9044('0x2b')]({'where':{'type':_0x3e8b30,'resourceId':_0x77d480['id']}})['then'](function(){return _0x4cb5cc;});})[_0x9044('0x27')](function(){_0x36a1b9[_0x9044('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bcd70,_0x102275){return function(_0x117abc){if(!_0x117abc){_0x4bcd70['sendStatus'](0x194);}return _0x117abc;};}function handleError(_0x282e79,_0x18141a){_0x18141a=_0x18141a||0x1f4;return function(_0x5d5f1c){logger[_0x9044('0x2c')](_0x5d5f1c[_0x9044('0x2d')]);if(_0x5d5f1c[_0x9044('0x2e')]){delete _0x5d5f1c[_0x9044('0x2e')];}_0x282e79[_0x9044('0x1a')](_0x18141a)[_0x9044('0x2f')](_0x5d5f1c);};}exports[_0x9044('0x30')]=function(_0x3579e3,_0x193a29){var _0x19b616={},_0x2cc5ee={},_0x573073={'count':0x0,'rows':[]};var _0x54487d=_['map'](db['Dashboard'][_0x9044('0x31')],function(_0x25494f){return{'name':_0x25494f[_0x9044('0x32')],'type':_0x25494f[_0x9044('0x33')]['key']};});_0x2cc5ee[_0x9044('0x34')]=_[_0x9044('0x35')](_0x54487d,_0x9044('0x2e'));_0x2cc5ee[_0x9044('0x36')]=_['keys'](_0x3579e3[_0x9044('0x36')]);_0x2cc5ee[_0x9044('0x37')]=_[_0x9044('0x38')](_0x2cc5ee[_0x9044('0x34')],_0x2cc5ee[_0x9044('0x36')]);_0x19b616['attributes']=_['intersection'](_0x2cc5ee[_0x9044('0x34')],qs['fields'](_0x3579e3['query'][_0x9044('0x39')]));_0x19b616[_0x9044('0x3a')]=_0x19b616[_0x9044('0x3a')][_0x9044('0x3b')]?_0x19b616['attributes']:_0x2cc5ee['model'];if(!_0x3579e3[_0x9044('0x36')][_0x9044('0x3c')](_0x9044('0x3d'))){_0x19b616[_0x9044('0x1e')]=qs[_0x9044('0x1e')](_0x3579e3['query'][_0x9044('0x1e')]);_0x19b616['offset']=qs[_0x9044('0x1d')](_0x3579e3['query'][_0x9044('0x1d')]);}_0x19b616[_0x9044('0x3e')]=qs[_0x9044('0x3f')](_0x3579e3[_0x9044('0x36')][_0x9044('0x3f')]);_0x19b616[_0x9044('0x40')]=qs[_0x9044('0x37')](_[_0x9044('0x41')](_0x3579e3[_0x9044('0x36')],_0x2cc5ee['filters']),_0x54487d);if(_0x3579e3[_0x9044('0x36')]['filter']){_0x19b616[_0x9044('0x40')]=_[_0x9044('0x42')](_0x19b616[_0x9044('0x40')],{'$or':_[_0x9044('0x35')](_0x54487d,function(_0x2425ca){if(_0x2425ca[_0x9044('0x33')]!==_0x9044('0x43')){var _0x5c6ce4={};_0x5c6ce4[_0x2425ca['name']]={'$like':'%'+_0x3579e3[_0x9044('0x36')][_0x9044('0x44')]+'%'};return _0x5c6ce4;}})});}_0x19b616=_[_0x9044('0x42')]({},_0x19b616,_0x3579e3[_0x9044('0x45')]);var _0x37cede={'where':_0x19b616[_0x9044('0x40')]};return db[_0x9044('0x46')][_0x9044('0x20')](_0x37cede)[_0x9044('0x27')](function(_0x1b64ea){_0x573073[_0x9044('0x20')]=_0x1b64ea;if(_0x3579e3[_0x9044('0x36')][_0x9044('0x47')]){_0x19b616[_0x9044('0x48')]=[{'all':!![]}];}return db[_0x9044('0x46')][_0x9044('0x49')](_0x19b616);})[_0x9044('0x27')](function(_0x1c3bb9){_0x573073[_0x9044('0x4a')]=_0x1c3bb9;return _0x573073;})[_0x9044('0x27')](respondWithFilteredResult(_0x193a29,_0x19b616))['catch'](handleError(_0x193a29,null));};exports[_0x9044('0x4b')]=function(_0x138af6,_0x40b524){var _0x62bbbf={'raw':![],'where':{'id':_0x138af6[_0x9044('0x4c')]['id']}},_0x2c5390={};_0x2c5390[_0x9044('0x34')]=_[_0x9044('0x4d')](db[_0x9044('0x46')][_0x9044('0x31')]);_0x2c5390[_0x9044('0x36')]=_[_0x9044('0x4d')](_0x138af6[_0x9044('0x36')]);_0x2c5390['filters']=_['intersection'](_0x2c5390[_0x9044('0x34')],_0x2c5390['query']);_0x62bbbf[_0x9044('0x3a')]=_[_0x9044('0x38')](_0x2c5390[_0x9044('0x34')],qs[_0x9044('0x39')](_0x138af6['query'][_0x9044('0x39')]));_0x62bbbf[_0x9044('0x3a')]=_0x62bbbf[_0x9044('0x3a')][_0x9044('0x3b')]?_0x62bbbf[_0x9044('0x3a')]:_0x2c5390['model'];if(_0x138af6['query'][_0x9044('0x47')]){_0x62bbbf['include']=[{'all':!![]}];}_0x62bbbf=_[_0x9044('0x42')]({},_0x62bbbf,_0x138af6[_0x9044('0x45')]);return db[_0x9044('0x46')][_0x9044('0x4e')](_0x62bbbf)[_0x9044('0x27')](handleEntityNotFound(_0x40b524,null))['then'](respondWithResult(_0x40b524,null))[_0x9044('0x4f')](handleError(_0x40b524,null));};exports[_0x9044('0x50')]=function(_0x420557,_0x3d30dd){return db['Dashboard'][_0x9044('0x50')](_0x420557[_0x9044('0x51')],{})['then'](function(_0x2e1e55){var _0x5c083b=_0x420557[_0x9044('0x52')][_0x9044('0x28')]({'plain':!![]});if(!_0x5c083b)throw new Error(_0x9044('0x53'));if(_0x5c083b[_0x9044('0x54')]===_0x9044('0x52')){var _0x3e8d66=_0x2e1e55[_0x9044('0x28')]({'plain':!![]});var _0x1de9f8=_0x9044('0x29');return db[_0x9044('0x55')][_0x9044('0x4e')]({'where':{'name':_0x1de9f8,'userProfileId':_0x5c083b['userProfileId']},'raw':!![]})[_0x9044('0x27')](function(_0x136479){if(_0x136479&&_0x136479[_0x9044('0x56')]===0x0){return db[_0x9044('0x2a')][_0x9044('0x50')]({'name':_0x3e8d66[_0x9044('0x2e')],'resourceId':_0x3e8d66['id'],'type':_0x136479[_0x9044('0x2e')],'sectionId':_0x136479['id']},{})[_0x9044('0x27')](function(){return _0x2e1e55;});}else{return _0x2e1e55;}})[_0x9044('0x4f')](function(_0x209bd7){logger[_0x9044('0x2c')](_0x9044('0x57'),_0x209bd7);throw _0x209bd7;});}return _0x2e1e55;})[_0x9044('0x27')](respondWithResult(_0x3d30dd,0xc9))['catch'](handleError(_0x3d30dd,null));};exports[_0x9044('0x58')]=function(_0x290cc5,_0x442f46){var _0x384ca8={'where':{'id':_0x290cc5[_0x9044('0x4c')]['id']}},_0x32e5c1={};_0x32e5c1[_0x9044('0x34')]=_[_0x9044('0x4d')](db['Dashboard']['rawAttributes']);_0x384ca8[_0x9044('0x3a')]=_['intersection'](_0x32e5c1[_0x9044('0x34')],qs['fields'](_0x290cc5[_0x9044('0x36')][_0x9044('0x39')]));_0x384ca8[_0x9044('0x3a')]=_0x384ca8[_0x9044('0x3a')][_0x9044('0x3b')]?_0x384ca8[_0x9044('0x3a')]:_0x32e5c1['model'];if(_0x290cc5[_0x9044('0x36')]['includeAll']){_0x384ca8[_0x9044('0x48')]=[{'all':!![]}];}_0x384ca8=_[_0x9044('0x42')]({},_0x384ca8,_0x290cc5['options']);return db[_0x9044('0x46')][_0x9044('0x4e')](_0x384ca8)['then'](handleEntityNotFound(_0x442f46,null))[_0x9044('0x27')](function(_0xf4447d){if(_0xf4447d){var _0x5be2ed=_0xf4447d['get']({'plain':!![]});_0x5be2ed=qs[_0x9044('0x59')](_0x5be2ed,['id','createdAt','updatedAt']);_0x290cc5['body']=_[_0x9044('0x59')](_0x290cc5[_0x9044('0x51')],['id',_0x9044('0x5a'),_0x9044('0x5b')]);return db[_0x9044('0x46')]['create'](_[_0x9044('0x42')](_0x5be2ed,_0x290cc5[_0x9044('0x51')]),{'include':_0x290cc5[_0x9044('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x9044('0x27')](function(_0x4331b3){var _0x5a70f9=_0x290cc5['user'][_0x9044('0x28')]({'plain':!![]});if(!_0x5a70f9)throw new Error(_0x9044('0x53'));if(_0x5a70f9[_0x9044('0x54')]===_0x9044('0x52')){var _0x1d8b42=_0x4331b3['get']({'plain':!![]});var _0x51d2a4='CustomDashboards';return db[_0x9044('0x55')][_0x9044('0x4e')]({'where':{'name':_0x51d2a4,'userProfileId':_0x5a70f9[_0x9044('0x5c')]},'raw':!![]})[_0x9044('0x27')](function(_0x2e98fb){if(_0x2e98fb&&_0x2e98fb['autoAssociation']===0x0){return db[_0x9044('0x2a')][_0x9044('0x50')]({'name':_0x1d8b42[_0x9044('0x2e')],'resourceId':_0x1d8b42['id'],'type':_0x2e98fb['name'],'sectionId':_0x2e98fb['id']},{})[_0x9044('0x27')](function(){return _0x4331b3;});}else{return _0x4331b3;}})[_0x9044('0x4f')](function(_0x51c76c){logger[_0x9044('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51c76c);throw _0x51c76c;});}return _0x4331b3;});}})['then'](respondWithResult(_0x442f46,0xc9))[_0x9044('0x4f')](handleError(_0x442f46,null));};exports[_0x9044('0x26')]=function(_0xe32c80,_0x5833be){if(_0xe32c80[_0x9044('0x51')]['id']){delete _0xe32c80[_0x9044('0x51')]['id'];}return db[_0x9044('0x46')]['find']({'where':{'id':_0xe32c80[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x5833be,null))[_0x9044('0x27')](saveUpdates(_0xe32c80[_0x9044('0x51')],null))['then'](respondWithResult(_0x5833be,null))[_0x9044('0x4f')](handleError(_0x5833be,null));};exports[_0x9044('0x2b')]=function(_0x42dfde,_0x312160){return db[_0x9044('0x46')][_0x9044('0x4e')]({'where':{'id':_0x42dfde[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x312160,null))[_0x9044('0x27')](removeEntity(_0x312160,null))[_0x9044('0x4f')](handleError(_0x312160,null));};function widgetAttributes(_0x3f1ade){try{switch(_0x3f1ade['type']){case _0x9044('0x5d'):return[{'name':'attrUrl','value':_0x3f1ade[_0x9044('0x5e')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||_0x9044('0x60')}];case _0x9044('0x61'):return[{'name':_0x9044('0x62'),'value':_0x3f1ade['attrPath']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||''}];case _0x9044('0x63'):return[{'name':'attrHourFormat','value':_0x3f1ade[_0x9044('0x64')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0][_0x9044('0x65')]:undefined)||'HH:mm:ss'},{'name':_0x9044('0x66'),'value':_0x3f1ade[_0x9044('0x66')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade[_0x9044('0x5f')][0x1][_0x9044('0x65')]:undefined)||'0.00'},{'name':_0x9044('0x67'),'value':_0x3f1ade[_0x9044('0x67')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x2]?_0x3f1ade['attrs'][0x2][_0x9044('0x65')]:undefined)||0xc}];case'counter':return[{'name':_0x9044('0x68'),'value':_0x3f1ade['attrMetric']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade['attrs'][0x0][_0x9044('0x65')]:undefined)||_0x9044('0x69')},{'name':_0x9044('0x6a'),'value':_0x3f1ade[_0x9044('0x6a')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade['attrs'][0x1][_0x9044('0x65')]:undefined)||[]},{'name':_0x9044('0x67'),'value':_0x3f1ade[_0x9044('0x67')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x2]?_0x3f1ade[_0x9044('0x5f')][0x2][_0x9044('0x65')]:undefined)||0x14},{'name':_0x9044('0x6b'),'value':_0x3f1ade[_0x9044('0x6b')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x3]?_0x3f1ade[_0x9044('0x5f')][0x3][_0x9044('0x65')]:undefined)||_0x9044('0x6c')},{'name':_0x9044('0x6d'),'value':_0x3f1ade[_0x9044('0x6d')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x4]?_0x3f1ade[_0x9044('0x5f')][0x4][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6e'),'value':_0x3f1ade['attrFaxAccounts']||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x5]?_0x3f1ade[_0x9044('0x5f')][0x5][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6f'),'value':_0x3f1ade[_0x9044('0x6f')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x6]?_0x3f1ade[_0x9044('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3f1ade['attrOpenchannelAccounts']||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x7]?_0x3f1ade[_0x9044('0x5f')][0x7][_0x9044('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3f1ade[_0x9044('0x70')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x8]?_0x3f1ade[_0x9044('0x5f')][0x8][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x71'),'value':_0x3f1ade[_0x9044('0x71')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x9]?_0x3f1ade[_0x9044('0x5f')][0x9]['value']:undefined)||''}];case _0x9044('0x72'):case _0x9044('0x73'):return[{'name':_0x9044('0x74'),'value':_0x3f1ade[_0x9044('0x74')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0]['value']:undefined)||_0x9044('0x69')},{'name':_0x9044('0x75'),'value':_0x3f1ade[_0x9044('0x75')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x1]?_0x3f1ade['attrs'][0x1][_0x9044('0x65')]:undefined)||null},{'name':_0x9044('0x76'),'value':_0x3f1ade[_0x9044('0x76')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x2]?_0x3f1ade[_0x9044('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3f1ade[_0x9044('0x6a')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x3]?_0x3f1ade[_0x9044('0x5f')][0x3][_0x9044('0x65')]:undefined)||[]},{'name':_0x9044('0x6b'),'value':_0x3f1ade[_0x9044('0x6b')]||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x4]?_0x3f1ade[_0x9044('0x5f')][0x4]['value']:undefined)||_0x9044('0x6c')},{'name':'attrEmailAccounts','value':_0x3f1ade[_0x9044('0x6d')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x5]?_0x3f1ade[_0x9044('0x5f')][0x5][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6e'),'value':_0x3f1ade[_0x9044('0x6e')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x6]?_0x3f1ade[_0x9044('0x5f')][0x6][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x6f'),'value':_0x3f1ade[_0x9044('0x6f')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x7]?_0x3f1ade[_0x9044('0x5f')][0x7][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x77'),'value':_0x3f1ade[_0x9044('0x77')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x8]?_0x3f1ade[_0x9044('0x5f')][0x8][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x70'),'value':_0x3f1ade['attrWhatsappAccounts']||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade[_0x9044('0x5f')][0x9]?_0x3f1ade[_0x9044('0x5f')][0x9][_0x9044('0x65')]:undefined)||''},{'name':_0x9044('0x71'),'value':_0x3f1ade[_0x9044('0x71')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0xa]?_0x3f1ade[_0x9044('0x5f')][0xa][_0x9044('0x65')]:undefined)||''}];case _0x9044('0x78'):return[{'name':'attrReport','type':_0x3f1ade[_0x9044('0x79')]||(_0x3f1ade['attrs']&&_0x3f1ade['attrs'][0x0]?_0x3f1ade[_0x9044('0x5f')][0x0][_0x9044('0x33')]:undefined)||null,'value':_0x3f1ade[_0x9044('0x7a')]||(_0x3f1ade['attrs']&&_0x3f1ade[_0x9044('0x5f')][0x0]?_0x3f1ade['attrs'][0x0][_0x9044('0x65')]:undefined)||null},{'name':_0x9044('0x7b'),'value':_0x3f1ade[_0x9044('0x7b')]||(_0x3f1ade[_0x9044('0x5f')]&&_0x3f1ade['attrs'][0x1]?_0x3f1ade[_0x9044('0x5f')][0x1][_0x9044('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x52c1fc){logger['error'](_0x9044('0x7c'),JSON[_0x9044('0x7d')](_0x52c1fc));return[];}}exports[_0x9044('0x7e')]=function(_0x243b6c,_0x4750d4,_0x46b5c6){if(_0x243b6c['body']['id']){delete _0x243b6c[_0x9044('0x51')]['id'];}return db[_0x9044('0x46')]['find']({'where':{'id':_0x243b6c['params']['id']}})['then'](handleEntityNotFound(_0x4750d4,null))[_0x9044('0x27')](function(_0x44a62a){if(_0x44a62a){_0x243b6c[_0x9044('0x51')]['DashboardId']=_0x44a62a['id'];_0x243b6c[_0x9044('0x51')][_0x9044('0x5f')]=widgetAttributes(_0x243b6c[_0x9044('0x51')]);return db['DashboardItem'][_0x9044('0x50')](_0x243b6c['body']);}})[_0x9044('0x27')](respondWithResult(_0x4750d4,null))[_0x9044('0x4f')](handleError(_0x4750d4,null));};exports[_0x9044('0x7f')]=function(_0x23559b,_0x1b61b1,_0x530809){var _0xf61c0e={};var _0x5617d2={};var _0x38f35d;var _0x2c5b8a;return db[_0x9044('0x46')]['findOne']({'where':{'id':_0x23559b[_0x9044('0x4c')]['id']}})[_0x9044('0x27')](handleEntityNotFound(_0x1b61b1,null))['then'](function(_0xe96e5d){if(_0xe96e5d){_0x38f35d=_0xe96e5d;_0x5617d2[_0x9044('0x34')]=_[_0x9044('0x4d')](db[_0x9044('0x80')][_0x9044('0x31')]);_0x5617d2[_0x9044('0x36')]=_['keys'](_0x23559b[_0x9044('0x36')]);_0x5617d2[_0x9044('0x37')]=_[_0x9044('0x38')](_0x5617d2[_0x9044('0x34')],_0x5617d2[_0x9044('0x36')]);_0xf61c0e['attributes']=_['intersection'](_0x5617d2[_0x9044('0x34')],qs['fields'](_0x23559b[_0x9044('0x36')][_0x9044('0x39')]));_0xf61c0e[_0x9044('0x3a')]=_0xf61c0e[_0x9044('0x3a')][_0x9044('0x3b')]?_0xf61c0e['attributes']:_0x5617d2[_0x9044('0x34')];_0xf61c0e[_0x9044('0x3e')]=qs[_0x9044('0x3f')](_0x23559b[_0x9044('0x36')][_0x9044('0x3f')]);_0xf61c0e[_0x9044('0x40')]=qs[_0x9044('0x37')](_[_0x9044('0x41')](_0x23559b['query'],_0x5617d2[_0x9044('0x37')]));if(_0x23559b['query'][_0x9044('0x44')]){_0xf61c0e[_0x9044('0x40')]=_[_0x9044('0x42')](_0xf61c0e[_0x9044('0x40')],{'$or':_['map'](_0xf61c0e[_0x9044('0x3a')],function(_0x2957f3){var _0x334375={};_0x334375[_0x2957f3]={'$like':'%'+_0x23559b[_0x9044('0x36')]['filter']+'%'};return _0x334375;})});}_0xf61c0e=_[_0x9044('0x42')]({},_0xf61c0e,_0x23559b[_0x9044('0x45')]);return _0x38f35d[_0x9044('0x7f')](_0xf61c0e);}})[_0x9044('0x27')](function(_0xfc6b57){if(_0xfc6b57){_0x2c5b8a=_0xfc6b57[_0x9044('0x3b')];if(!_0x23559b[_0x9044('0x36')][_0x9044('0x3c')]('nolimit')){_0xf61c0e[_0x9044('0x1e')]=qs[_0x9044('0x1e')](_0x23559b['query'][_0x9044('0x1e')]);_0xf61c0e[_0x9044('0x1d')]=qs[_0x9044('0x1d')](_0x23559b[_0x9044('0x36')]['offset']);}return _0x38f35d[_0x9044('0x7f')](_0xf61c0e);}})['then'](function(_0x2afe10){if(_0x2afe10){return _0x2afe10?{'count':_0x2c5b8a,'rows':_0x2afe10}:null;}})[_0x9044('0x27')](respondWithResult(_0x1b61b1,null))[_0x9044('0x4f')](handleError(_0x1b61b1,null));}; \ No newline at end of file +var _0x3615=['attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','then','UserProfileResource','destroy','stack','name','send','Dashboard','rawAttributes','fieldName','type','map','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','body','updatedAt','UserProfileSection','update','iframe','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x4eac87,_0xb2f8c0){var _0x773cc6=function(_0x1bac9b){while(--_0x1bac9b){_0x4eac87['push'](_0x4eac87['shift']());}};_0x773cc6(++_0xb2f8c0);}(_0x3615,0x19a));var _0x5361=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3615[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x5361('0x0'));var rimraf=require(_0x5361('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5361('0x2'));var rp=require(_0x5361('0x3'));var moment=require(_0x5361('0x4'));var BPromise=require(_0x5361('0x5'));var Mustache=require(_0x5361('0x6'));var util=require(_0x5361('0x7'));var path=require(_0x5361('0x8'));var sox=require('sox');var csv=require(_0x5361('0x9'));var ejs=require(_0x5361('0xa'));var fs=require('fs');var fs_extra=require(_0x5361('0xb'));var _=require(_0x5361('0xc'));var squel=require(_0x5361('0xd'));var crypto=require(_0x5361('0xe'));var jsforce=require(_0x5361('0xf'));var deskjs=require(_0x5361('0x10'));var toCsv=require(_0x5361('0x9'));var querystring=require(_0x5361('0x11'));var Papa=require(_0x5361('0x12'));var Redis=require(_0x5361('0x13'));var authService=require(_0x5361('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5361('0x15'));var logger=require(_0x5361('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5361('0x17'));var licenseUtil=require(_0x5361('0x18'));var db=require('../../mysqldb')['db'];config[_0x5361('0x19')]=_[_0x5361('0x1a')](config[_0x5361('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5361('0x1b'))(new Redis(config[_0x5361('0x19')]));require(_0x5361('0x1c'))['register'](socket);function respondWithStatusCode(_0x2dd1c7,_0x1f61c8){_0x1f61c8=_0x1f61c8||0xcc;return function(_0x1f6b0f){if(_0x1f6b0f){return _0x2dd1c7[_0x5361('0x1d')](_0x1f61c8);}return _0x2dd1c7[_0x5361('0x1e')](_0x1f61c8)[_0x5361('0x1f')]();};}function respondWithResult(_0x5c98f5,_0x52cf0f){_0x52cf0f=_0x52cf0f||0xc8;return function(_0x25224a){if(_0x25224a){return _0x5c98f5[_0x5361('0x1e')](_0x52cf0f)[_0x5361('0x20')](_0x25224a);}};}function respondWithFilteredResult(_0x4e77a8,_0x33a8ca){return function(_0x52f062){if(_0x52f062){var _0x3a4b7a=typeof _0x33a8ca['offset']===_0x5361('0x21')&&typeof _0x33a8ca['limit']===_0x5361('0x21');var _0x2331c0=_0x52f062[_0x5361('0x22')];var _0x3fe068=_0x3a4b7a?0x0:_0x33a8ca[_0x5361('0x23')];var _0xc05cfe=_0x3a4b7a?_0x52f062[_0x5361('0x22')]:_0x33a8ca[_0x5361('0x23')]+_0x33a8ca[_0x5361('0x24')];var _0x20dae0;if(_0xc05cfe>=_0x2331c0){_0xc05cfe=_0x2331c0;_0x20dae0=0xc8;}else{_0x20dae0=0xce;}_0x4e77a8['status'](_0x20dae0);return _0x4e77a8['set']('Content-Range',_0x3fe068+'-'+_0xc05cfe+'/'+_0x2331c0)[_0x5361('0x20')](_0x52f062);}return null;};}function patchUpdates(_0x1382d3){return function(_0x5045e8){try{jsonpatch[_0x5361('0x25')](_0x5045e8,_0x1382d3,!![]);}catch(_0x3f5aa3){return BPromise[_0x5361('0x26')](_0x3f5aa3);}return _0x5045e8[_0x5361('0x27')]();};}function saveUpdates(_0x155819,_0x17adee){return function(_0x3b29f6){if(_0x3b29f6){return _0x3b29f6['update'](_0x155819)[_0x5361('0x28')](function(_0xea9ef6){return _0xea9ef6;});}return null;};}function removeEntity(_0x39206d,_0x53cde2){return function(_0x17ca71){if(_0x17ca71){return _0x17ca71['destroy']()[_0x5361('0x28')](function(){var _0xff7cd=_0x17ca71['get']({'plain':!![]});var _0x17774a='CustomDashboards';return db[_0x5361('0x29')][_0x5361('0x2a')]({'where':{'type':_0x17774a,'resourceId':_0xff7cd['id']}})[_0x5361('0x28')](function(){return _0x17ca71;});})['then'](function(){_0x39206d[_0x5361('0x1e')](0xcc)[_0x5361('0x1f')]();});}};}function handleEntityNotFound(_0x44df56,_0x282e22){return function(_0x288bcb){if(!_0x288bcb){_0x44df56[_0x5361('0x1d')](0x194);}return _0x288bcb;};}function handleError(_0x5d7635,_0x169cd7){_0x169cd7=_0x169cd7||0x1f4;return function(_0x462539){logger['error'](_0x462539[_0x5361('0x2b')]);if(_0x462539[_0x5361('0x2c')]){delete _0x462539[_0x5361('0x2c')];}_0x5d7635[_0x5361('0x1e')](_0x169cd7)[_0x5361('0x2d')](_0x462539);};}exports['index']=function(_0x28008f,_0x4a90fd){var _0x3dc176={},_0x78bfe6={},_0x5a1e3e={'count':0x0,'rows':[]};var _0x201939=_['map'](db[_0x5361('0x2e')][_0x5361('0x2f')],function(_0x2ab54d){return{'name':_0x2ab54d[_0x5361('0x30')],'type':_0x2ab54d[_0x5361('0x31')]['key']};});_0x78bfe6['model']=_[_0x5361('0x32')](_0x201939,_0x5361('0x2c'));_0x78bfe6[_0x5361('0x33')]=_['keys'](_0x28008f[_0x5361('0x33')]);_0x78bfe6['filters']=_[_0x5361('0x34')](_0x78bfe6[_0x5361('0x35')],_0x78bfe6[_0x5361('0x33')]);_0x3dc176[_0x5361('0x36')]=_[_0x5361('0x34')](_0x78bfe6['model'],qs[_0x5361('0x37')](_0x28008f[_0x5361('0x33')]['fields']));_0x3dc176[_0x5361('0x36')]=_0x3dc176[_0x5361('0x36')]['length']?_0x3dc176['attributes']:_0x78bfe6['model'];if(!_0x28008f[_0x5361('0x33')][_0x5361('0x38')]('nolimit')){_0x3dc176[_0x5361('0x24')]=qs[_0x5361('0x24')](_0x28008f[_0x5361('0x33')][_0x5361('0x24')]);_0x3dc176[_0x5361('0x23')]=qs[_0x5361('0x23')](_0x28008f[_0x5361('0x33')][_0x5361('0x23')]);}_0x3dc176[_0x5361('0x39')]=qs[_0x5361('0x3a')](_0x28008f[_0x5361('0x33')][_0x5361('0x3a')]);_0x3dc176['where']=qs[_0x5361('0x3b')](_[_0x5361('0x3c')](_0x28008f[_0x5361('0x33')],_0x78bfe6[_0x5361('0x3b')]),_0x201939);if(_0x28008f[_0x5361('0x33')][_0x5361('0x3d')]){_0x3dc176[_0x5361('0x3e')]=_[_0x5361('0x3f')](_0x3dc176[_0x5361('0x3e')],{'$or':_[_0x5361('0x32')](_0x201939,function(_0x27a372){if(_0x27a372['type']!==_0x5361('0x40')){var _0x874d58={};_0x874d58[_0x27a372[_0x5361('0x2c')]]={'$like':'%'+_0x28008f[_0x5361('0x33')][_0x5361('0x3d')]+'%'};return _0x874d58;}})});}_0x3dc176=_[_0x5361('0x3f')]({},_0x3dc176,_0x28008f[_0x5361('0x41')]);var _0x5aa8f6={'where':_0x3dc176[_0x5361('0x3e')]};return db[_0x5361('0x2e')]['count'](_0x5aa8f6)[_0x5361('0x28')](function(_0x250569){_0x5a1e3e[_0x5361('0x22')]=_0x250569;if(_0x28008f['query'][_0x5361('0x42')]){_0x3dc176[_0x5361('0x43')]=[{'all':!![]}];}return db['Dashboard'][_0x5361('0x44')](_0x3dc176);})['then'](function(_0x4d1bb0){_0x5a1e3e[_0x5361('0x45')]=_0x4d1bb0;return _0x5a1e3e;})[_0x5361('0x28')](respondWithFilteredResult(_0x4a90fd,_0x3dc176))[_0x5361('0x46')](handleError(_0x4a90fd,null));};exports[_0x5361('0x47')]=function(_0x12b859,_0x4b9514){var _0x22656d={'raw':![],'where':{'id':_0x12b859[_0x5361('0x48')]['id']}},_0x207dc8={};_0x207dc8[_0x5361('0x35')]=_[_0x5361('0x49')](db['Dashboard']['rawAttributes']);_0x207dc8[_0x5361('0x33')]=_[_0x5361('0x49')](_0x12b859[_0x5361('0x33')]);_0x207dc8[_0x5361('0x3b')]=_[_0x5361('0x34')](_0x207dc8[_0x5361('0x35')],_0x207dc8['query']);_0x22656d[_0x5361('0x36')]=_[_0x5361('0x34')](_0x207dc8[_0x5361('0x35')],qs[_0x5361('0x37')](_0x12b859[_0x5361('0x33')][_0x5361('0x37')]));_0x22656d[_0x5361('0x36')]=_0x22656d[_0x5361('0x36')][_0x5361('0x4a')]?_0x22656d[_0x5361('0x36')]:_0x207dc8[_0x5361('0x35')];if(_0x12b859['query']['includeAll']){_0x22656d[_0x5361('0x43')]=[{'all':!![]}];}_0x22656d=_[_0x5361('0x3f')]({},_0x22656d,_0x12b859[_0x5361('0x41')]);return db[_0x5361('0x2e')]['find'](_0x22656d)[_0x5361('0x28')](handleEntityNotFound(_0x4b9514,null))[_0x5361('0x28')](respondWithResult(_0x4b9514,null))[_0x5361('0x46')](handleError(_0x4b9514,null));};exports[_0x5361('0x4b')]=function(_0x57155d,_0x39e22f){return db[_0x5361('0x2e')][_0x5361('0x4b')](_0x57155d['body'],{})['then'](function(_0x1b1c09){var _0x369131=_0x57155d[_0x5361('0x4c')][_0x5361('0x4d')]({'plain':!![]});if(!_0x369131)throw new Error(_0x5361('0x4e'));if(_0x369131[_0x5361('0x4f')]===_0x5361('0x4c')){var _0x658d4=_0x1b1c09['get']({'plain':!![]});var _0x364c78='CustomDashboards';return db['UserProfileSection'][_0x5361('0x50')]({'where':{'name':_0x364c78,'userProfileId':_0x369131[_0x5361('0x51')]},'raw':!![]})[_0x5361('0x28')](function(_0x47c9d2){if(_0x47c9d2&&_0x47c9d2[_0x5361('0x52')]===0x0){return db[_0x5361('0x29')][_0x5361('0x4b')]({'name':_0x658d4['name'],'resourceId':_0x658d4['id'],'type':_0x47c9d2[_0x5361('0x2c')],'sectionId':_0x47c9d2['id']},{})[_0x5361('0x28')](function(){return _0x1b1c09;});}else{return _0x1b1c09;}})['catch'](function(_0x8f36c5){logger[_0x5361('0x53')](_0x5361('0x54'),_0x8f36c5);throw _0x8f36c5;});}return _0x1b1c09;})[_0x5361('0x28')](respondWithResult(_0x39e22f,0xc9))[_0x5361('0x46')](handleError(_0x39e22f,null));};exports['clone']=function(_0x61cd5,_0x2f0ad0){var _0x4677dd={'where':{'id':_0x61cd5[_0x5361('0x48')]['id']}},_0x4ad4d3={};_0x4ad4d3['model']=_[_0x5361('0x49')](db[_0x5361('0x2e')][_0x5361('0x2f')]);_0x4677dd[_0x5361('0x36')]=_[_0x5361('0x34')](_0x4ad4d3[_0x5361('0x35')],qs['fields'](_0x61cd5[_0x5361('0x33')][_0x5361('0x37')]));_0x4677dd[_0x5361('0x36')]=_0x4677dd[_0x5361('0x36')][_0x5361('0x4a')]?_0x4677dd['attributes']:_0x4ad4d3[_0x5361('0x35')];if(_0x61cd5[_0x5361('0x33')][_0x5361('0x42')]){_0x4677dd['include']=[{'all':!![]}];}_0x4677dd=_[_0x5361('0x3f')]({},_0x4677dd,_0x61cd5['options']);return db[_0x5361('0x2e')][_0x5361('0x50')](_0x4677dd)[_0x5361('0x28')](handleEntityNotFound(_0x2f0ad0,null))[_0x5361('0x28')](function(_0x3f66c2){if(_0x3f66c2){var _0x1c7c47=_0x3f66c2[_0x5361('0x4d')]({'plain':!![]});_0x1c7c47=qs[_0x5361('0x55')](_0x1c7c47,['id',_0x5361('0x56'),'updatedAt']);_0x61cd5[_0x5361('0x57')]=_[_0x5361('0x55')](_0x61cd5[_0x5361('0x57')],['id',_0x5361('0x56'),_0x5361('0x58')]);return db[_0x5361('0x2e')][_0x5361('0x4b')](_[_0x5361('0x3f')](_0x1c7c47,_0x61cd5[_0x5361('0x57')]),{'include':_0x61cd5[_0x5361('0x33')][_0x5361('0x42')]?[{'all':!![]}]:undefined})[_0x5361('0x28')](function(_0x3d9bf){var _0x28b4ac=_0x61cd5[_0x5361('0x4c')][_0x5361('0x4d')]({'plain':!![]});if(!_0x28b4ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28b4ac[_0x5361('0x4f')]===_0x5361('0x4c')){var _0x2a2399=_0x3d9bf['get']({'plain':!![]});var _0x7ea93b='CustomDashboards';return db[_0x5361('0x59')][_0x5361('0x50')]({'where':{'name':_0x7ea93b,'userProfileId':_0x28b4ac[_0x5361('0x51')]},'raw':!![]})[_0x5361('0x28')](function(_0x38e5a9){if(_0x38e5a9&&_0x38e5a9[_0x5361('0x52')]===0x0){return db[_0x5361('0x29')][_0x5361('0x4b')]({'name':_0x2a2399[_0x5361('0x2c')],'resourceId':_0x2a2399['id'],'type':_0x38e5a9[_0x5361('0x2c')],'sectionId':_0x38e5a9['id']},{})[_0x5361('0x28')](function(){return _0x3d9bf;});}else{return _0x3d9bf;}})['catch'](function(_0x2c479d){logger[_0x5361('0x53')](_0x5361('0x54'),_0x2c479d);throw _0x2c479d;});}return _0x3d9bf;});}})[_0x5361('0x28')](respondWithResult(_0x2f0ad0,0xc9))[_0x5361('0x46')](handleError(_0x2f0ad0,null));};exports[_0x5361('0x5a')]=function(_0x33c590,_0xd2e05){if(_0x33c590[_0x5361('0x57')]['id']){delete _0x33c590[_0x5361('0x57')]['id'];}return db[_0x5361('0x2e')][_0x5361('0x50')]({'where':{'id':_0x33c590[_0x5361('0x48')]['id']}})[_0x5361('0x28')](handleEntityNotFound(_0xd2e05,null))[_0x5361('0x28')](saveUpdates(_0x33c590[_0x5361('0x57')],null))['then'](respondWithResult(_0xd2e05,null))[_0x5361('0x46')](handleError(_0xd2e05,null));};exports['destroy']=function(_0xb522c3,_0x3dd1e8){return db[_0x5361('0x2e')]['find']({'where':{'id':_0xb522c3[_0x5361('0x48')]['id']}})['then'](handleEntityNotFound(_0x3dd1e8,null))[_0x5361('0x28')](removeEntity(_0x3dd1e8,null))[_0x5361('0x46')](handleError(_0x3dd1e8,null));};function widgetAttributes(_0x4dd7bd){try{switch(_0x4dd7bd['type']){case _0x5361('0x5b'):return[{'name':_0x5361('0x5c'),'value':_0x4dd7bd[_0x5361('0x5c')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd['attrs'][0x0][_0x5361('0x5e')]:undefined)||_0x5361('0x5f')}];case _0x5361('0x60'):return[{'name':_0x5361('0x61'),'value':_0x4dd7bd[_0x5361('0x61')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd[_0x5361('0x5d')][0x0][_0x5361('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x5361('0x62'),'value':_0x4dd7bd[_0x5361('0x62')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd['attrs'][0x0]?_0x4dd7bd[_0x5361('0x5d')][0x0]['value']:undefined)||_0x5361('0x63')},{'name':'attrTimezone','value':_0x4dd7bd[_0x5361('0x64')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x1]?_0x4dd7bd[_0x5361('0x5d')][0x1][_0x5361('0x5e')]:undefined)||_0x5361('0x65')},{'name':'attrFontSize','value':_0x4dd7bd['attrFontSize']||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x2]?_0x4dd7bd[_0x5361('0x5d')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x5361('0x66'),'value':_0x4dd7bd[_0x5361('0x66')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd[_0x5361('0x5d')][0x0][_0x5361('0x5e')]:undefined)||_0x5361('0x67')},{'name':_0x5361('0x68'),'value':_0x4dd7bd[_0x5361('0x68')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x1]?_0x4dd7bd['attrs'][0x1][_0x5361('0x5e')]:undefined)||[]},{'name':_0x5361('0x69'),'value':_0x4dd7bd[_0x5361('0x69')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x2]?_0x4dd7bd['attrs'][0x2][_0x5361('0x5e')]:undefined)||0x14},{'name':_0x5361('0x6a'),'value':_0x4dd7bd[_0x5361('0x6a')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd['attrs'][0x3]?_0x4dd7bd[_0x5361('0x5d')][0x3][_0x5361('0x5e')]:undefined)||_0x5361('0x6b')},{'name':_0x5361('0x6c'),'value':_0x4dd7bd[_0x5361('0x6c')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd['attrs'][0x4]?_0x4dd7bd[_0x5361('0x5d')][0x4][_0x5361('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4dd7bd[_0x5361('0x6d')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x5]?_0x4dd7bd['attrs'][0x5][_0x5361('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4dd7bd[_0x5361('0x6e')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x6]?_0x4dd7bd[_0x5361('0x5d')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4dd7bd[_0x5361('0x6f')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x7]?_0x4dd7bd[_0x5361('0x5d')][0x7][_0x5361('0x5e')]:undefined)||''},{'name':_0x5361('0x70'),'value':_0x4dd7bd[_0x5361('0x70')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd['attrs'][0x8]?_0x4dd7bd[_0x5361('0x5d')][0x8]['value']:undefined)||''},{'name':_0x5361('0x71'),'value':_0x4dd7bd[_0x5361('0x71')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x9]?_0x4dd7bd[_0x5361('0x5d')][0x9][_0x5361('0x5e')]:undefined)||''}];case'multibar-chart':case _0x5361('0x72'):return[{'name':_0x5361('0x73'),'value':_0x4dd7bd[_0x5361('0x73')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd[_0x5361('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0x5361('0x74'),'value':_0x4dd7bd[_0x5361('0x74')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x1]?_0x4dd7bd[_0x5361('0x5d')][0x1][_0x5361('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x4dd7bd['attrSerie3']||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x2]?_0x4dd7bd[_0x5361('0x5d')][0x2][_0x5361('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4dd7bd[_0x5361('0x68')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd['attrs'][0x3]?_0x4dd7bd[_0x5361('0x5d')][0x3][_0x5361('0x5e')]:undefined)||[]},{'name':_0x5361('0x6a'),'value':_0x4dd7bd[_0x5361('0x6a')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x4]?_0x4dd7bd[_0x5361('0x5d')][0x4][_0x5361('0x5e')]:undefined)||_0x5361('0x6b')},{'name':_0x5361('0x6c'),'value':_0x4dd7bd['attrEmailAccounts']||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x5]?_0x4dd7bd[_0x5361('0x5d')][0x5][_0x5361('0x5e')]:undefined)||''},{'name':_0x5361('0x6d'),'value':_0x4dd7bd[_0x5361('0x6d')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x6]?_0x4dd7bd[_0x5361('0x5d')][0x6]['value']:undefined)||''},{'name':_0x5361('0x6e'),'value':_0x4dd7bd[_0x5361('0x6e')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x7]?_0x4dd7bd[_0x5361('0x5d')][0x7]['value']:undefined)||''},{'name':_0x5361('0x6f'),'value':_0x4dd7bd[_0x5361('0x6f')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x8]?_0x4dd7bd['attrs'][0x8][_0x5361('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4dd7bd[_0x5361('0x70')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x9]?_0x4dd7bd[_0x5361('0x5d')][0x9]['value']:undefined)||''},{'name':_0x5361('0x71'),'value':_0x4dd7bd[_0x5361('0x71')]||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0xa]?_0x4dd7bd['attrs'][0xa][_0x5361('0x5e')]:undefined)||''}];case _0x5361('0x75'):return[{'name':_0x5361('0x76'),'type':_0x4dd7bd['reportType']||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd['attrs'][0x0][_0x5361('0x31')]:undefined)||null,'value':_0x4dd7bd['attrReport']||(_0x4dd7bd[_0x5361('0x5d')]&&_0x4dd7bd[_0x5361('0x5d')][0x0]?_0x4dd7bd[_0x5361('0x5d')][0x0][_0x5361('0x5e')]:undefined)||null},{'name':_0x5361('0x77'),'value':_0x4dd7bd[_0x5361('0x77')]||(_0x4dd7bd['attrs']&&_0x4dd7bd[_0x5361('0x5d')][0x1]?_0x4dd7bd[_0x5361('0x5d')][0x1][_0x5361('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x3b7552){logger['error'](_0x5361('0x78'),JSON[_0x5361('0x79')](_0x3b7552));return[];}}exports[_0x5361('0x7a')]=function(_0x1fd992,_0x967c81,_0x38bee6){if(_0x1fd992[_0x5361('0x57')]['id']){delete _0x1fd992[_0x5361('0x57')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1fd992['params']['id']}})['then'](handleEntityNotFound(_0x967c81,null))[_0x5361('0x28')](function(_0x5593d2){if(_0x5593d2){_0x1fd992[_0x5361('0x57')][_0x5361('0x7b')]=_0x5593d2['id'];_0x1fd992[_0x5361('0x57')][_0x5361('0x5d')]=widgetAttributes(_0x1fd992[_0x5361('0x57')]);return db[_0x5361('0x7c')][_0x5361('0x4b')](_0x1fd992[_0x5361('0x57')]);}})[_0x5361('0x28')](respondWithResult(_0x967c81,null))[_0x5361('0x46')](handleError(_0x967c81,null));};exports[_0x5361('0x7d')]=function(_0x3b05c8,_0x1c57c6,_0x53d5b7){var _0x138d61={};var _0x5bbc82={};var _0x509cf4;var _0x117c84;return db[_0x5361('0x2e')]['findOne']({'where':{'id':_0x3b05c8[_0x5361('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c57c6,null))[_0x5361('0x28')](function(_0xf19ff6){if(_0xf19ff6){_0x509cf4=_0xf19ff6;_0x5bbc82[_0x5361('0x35')]=_[_0x5361('0x49')](db['DashboardItem'][_0x5361('0x2f')]);_0x5bbc82[_0x5361('0x33')]=_['keys'](_0x3b05c8[_0x5361('0x33')]);_0x5bbc82[_0x5361('0x3b')]=_['intersection'](_0x5bbc82[_0x5361('0x35')],_0x5bbc82[_0x5361('0x33')]);_0x138d61[_0x5361('0x36')]=_[_0x5361('0x34')](_0x5bbc82['model'],qs['fields'](_0x3b05c8['query'][_0x5361('0x37')]));_0x138d61[_0x5361('0x36')]=_0x138d61['attributes'][_0x5361('0x4a')]?_0x138d61[_0x5361('0x36')]:_0x5bbc82['model'];_0x138d61[_0x5361('0x39')]=qs[_0x5361('0x3a')](_0x3b05c8[_0x5361('0x33')][_0x5361('0x3a')]);_0x138d61['where']=qs[_0x5361('0x3b')](_['pick'](_0x3b05c8[_0x5361('0x33')],_0x5bbc82[_0x5361('0x3b')]));if(_0x3b05c8[_0x5361('0x33')]['filter']){_0x138d61[_0x5361('0x3e')]=_[_0x5361('0x3f')](_0x138d61[_0x5361('0x3e')],{'$or':_[_0x5361('0x32')](_0x138d61[_0x5361('0x36')],function(_0x1e2b96){var _0x41a98c={};_0x41a98c[_0x1e2b96]={'$like':'%'+_0x3b05c8[_0x5361('0x33')][_0x5361('0x3d')]+'%'};return _0x41a98c;})});}_0x138d61=_['merge']({},_0x138d61,_0x3b05c8['options']);return _0x509cf4['getItems'](_0x138d61);}})[_0x5361('0x28')](function(_0x584452){if(_0x584452){_0x117c84=_0x584452[_0x5361('0x4a')];if(!_0x3b05c8[_0x5361('0x33')]['hasOwnProperty'](_0x5361('0x7e'))){_0x138d61[_0x5361('0x24')]=qs[_0x5361('0x24')](_0x3b05c8[_0x5361('0x33')][_0x5361('0x24')]);_0x138d61[_0x5361('0x23')]=qs[_0x5361('0x23')](_0x3b05c8[_0x5361('0x33')]['offset']);}return _0x509cf4['getItems'](_0x138d61);}})['then'](function(_0x4a860a){if(_0x4a860a){return _0x4a860a?{'count':_0x117c84,'rows':_0x4a860a}:null;}})[_0x5361('0x28')](respondWithResult(_0x1c57c6,null))[_0x5361('0x46')](handleError(_0x1c57c6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 85e8a94..0670f3a 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 _0xda28=['exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2906c4,_0x388039){var _0x96c290=function(_0x40ead1){while(--_0x40ead1){_0x2906c4['push'](_0x2906c4['shift']());}};_0x96c290(++_0x388039);}(_0xda28,0xfd));var _0x8da2=function(_0x47f058,_0xfb559a){_0x47f058=_0x47f058-0x0;var _0x4f20f6=_0xda28[_0x47f058];return _0x4f20f6;};'use strict';var EventEmitter=require(_0x8da2('0x0'));var Dashboard=require(_0x8da2('0x1'))['db'][_0x8da2('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8da2('0x3')](0x0);var events={'afterCreate':_0x8da2('0x4'),'afterUpdate':'update','afterDestroy':_0x8da2('0x5')};function emitEvent(_0x2b62d4){return function(_0x42eb1a,_0x142292,_0x20008f){DashboardEvents[_0x8da2('0x6')](_0x2b62d4+':'+_0x42eb1a['id'],_0x42eb1a);DashboardEvents['emit'](_0x2b62d4,_0x42eb1a);_0x20008f(null);};}for(var e in events){if(events[_0x8da2('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x8da2('0x8')]=DashboardEvents; \ No newline at end of file +var _0x2eec=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2eec,0xe6));var _0xc2ee=function(_0x1d6ba1,_0x101589){_0x1d6ba1=_0x1d6ba1-0x0;var _0x29e0e1=_0x2eec[_0x1d6ba1];return _0x29e0e1;};'use strict';var EventEmitter=require(_0xc2ee('0x0'));var Dashboard=require(_0xc2ee('0x1'))['db'][_0xc2ee('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc2ee('0x3')](0x0);var events={'afterCreate':_0xc2ee('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35ae58){return function(_0x34844e,_0x4e17e7,_0x5e2ee6){DashboardEvents[_0xc2ee('0x5')](_0x35ae58+':'+_0x34844e['id'],_0x34844e);DashboardEvents[_0xc2ee('0x5')](_0x35ae58,_0x34844e);_0x5e2ee6(null);};}for(var e in events){if(events[_0xc2ee('0x6')](e)){var event=events[e];Dashboard[_0xc2ee('0x7')](e,emitEvent(event));}}module[_0xc2ee('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 1b9b705..e8e42e0 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 _0x0762=['rimraf','../../config/environment','exports','define','Dashboard','lodash','api','moment','bluebird','request-promise'];(function(_0x202610,_0x4981fe){var _0x5899ea=function(_0x192e0d){while(--_0x192e0d){_0x202610['push'](_0x202610['shift']());}};_0x5899ea(++_0x4981fe);}(_0x0762,0x1d1));var _0x2076=function(_0x4201de,_0x43ac07){_0x4201de=_0x4201de-0x0;var _0x3fef97=_0x0762[_0x4201de];return _0x3fef97;};'use strict';var _=require(_0x2076('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2076('0x1'));var moment=require(_0x2076('0x2'));var BPromise=require(_0x2076('0x3'));var rp=require(_0x2076('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2076('0x5'));var config=require(_0x2076('0x6'));var attributes=require('./dashboard.attributes');module[_0x2076('0x7')]=function(_0x1b0826,_0x23e7f4){return _0x1b0826[_0x2076('0x8')](_0x2076('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7cb=['bluebird','path','rimraf','../../config/environment','exports','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xb7cb,0x157));var _0xbb7c=function(_0x23eb8c,_0x5618e8){_0x23eb8c=_0x23eb8c-0x0;var _0x4978ba=_0xb7cb[_0x23eb8c];return _0x4978ba;};'use strict';var _=require(_0xbb7c('0x0'));var util=require(_0xbb7c('0x1'));var logger=require(_0xbb7c('0x2'))(_0xbb7c('0x3'));var moment=require(_0xbb7c('0x4'));var BPromise=require(_0xbb7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb7c('0x6'));var rimraf=require(_0xbb7c('0x7'));var config=require(_0xbb7c('0x8'));var attributes=require('./dashboard.attributes');module[_0xbb7c('0x9')]=function(_0x11a8ba,_0x34e984){return _0x11a8ba['define'](_0xbb7c('0xa'),attributes,{'tableName':_0xbb7c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 675d62b..7644e15 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 _0x4cce=['jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x55e2f2,_0x4cf5fe){var _0x2dd912=function(_0x2d10f8){while(--_0x2d10f8){_0x55e2f2['push'](_0x55e2f2['shift']());}};_0x2dd912(++_0x4cf5fe);}(_0x4cce,0xc2));var _0xe4cc=function(_0x24cd4a,_0x4c0661){_0x24cd4a=_0x24cd4a-0x0;var _0x3101d5=_0x4cce[_0x24cd4a];return _0x3101d5;};'use strict';var _=require('lodash');var util=require(_0xe4cc('0x0'));var moment=require(_0xe4cc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4cc('0x2'))['db'];var utils=require(_0xe4cc('0x3'));var logger=require('../../config/logger')(_0xe4cc('0x4'));var config=require(_0xe4cc('0x5'));var jayson=require(_0xe4cc('0x6'));var client=jayson['client'][_0xe4cc('0x7')]({'port':0x232a});config[_0xe4cc('0x8')]=_['defaults'](config[_0xe4cc('0x8')],{'host':_0xe4cc('0x9'),'port':0x18eb});var socket=require(_0xe4cc('0xa'))(new Redis(config[_0xe4cc('0x8')]));require(_0xe4cc('0xb'))[_0xe4cc('0xc')](socket);function respondWithRpcPromise(_0x1f9353,_0x558dda,_0x4ee83e){return new BPromise(function(_0x24941b,_0x757cc1){return client['request'](_0x1f9353,_0x4ee83e)[_0xe4cc('0xd')](function(_0x383879){logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x558dda,_0xe4cc('0x10'));logger[_0xe4cc('0x11')](_0xe4cc('0x12'),_0x558dda,_0xe4cc('0x10'),JSON[_0xe4cc('0x13')](_0x383879));if(_0x383879[_0xe4cc('0x14')]){if(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x15')]===0x1f4){logger[_0xe4cc('0x14')](_0xe4cc('0xf'),_0x558dda,_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);return _0x757cc1(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);}logger[_0xe4cc('0x14')](_0xe4cc('0xf'),_0x558dda,_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);return _0x24941b(_0x383879[_0xe4cc('0x14')][_0xe4cc('0x16')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x558dda,_0xe4cc('0x10'));_0x24941b(_0x383879[_0xe4cc('0x17')]['message']);}})[_0xe4cc('0x18')](function(_0x54727b){logger['error'](_0xe4cc('0xf'),_0x558dda,_0x54727b);_0x757cc1(_0x54727b);});});} \ No newline at end of file +var _0x0644=['message','error','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x0644,0x1c6));var _0x4064=function(_0x4389a0,_0x47b86e){_0x4389a0=_0x4389a0-0x0;var _0x248def=_0x0644[_0x4389a0];return _0x248def;};'use strict';var _=require(_0x4064('0x0'));var util=require(_0x4064('0x1'));var moment=require(_0x4064('0x2'));var BPromise=require(_0x4064('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4064('0x4'));var db=require(_0x4064('0x5'))['db'];var utils=require(_0x4064('0x6'));var logger=require(_0x4064('0x7'))(_0x4064('0x8'));var config=require(_0x4064('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4064('0xa')]=_[_0x4064('0xb')](config[_0x4064('0xa')],{'host':_0x4064('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4064('0xd'))['register'](socket);function respondWithRpcPromise(_0x5923e6,_0x41612f,_0x34e38a){return new BPromise(function(_0x129414,_0x4f7c40){return client[_0x4064('0xe')](_0x5923e6,_0x34e38a)[_0x4064('0xf')](function(_0x5eeb14){logger[_0x4064('0x10')](_0x4064('0x11'),_0x41612f,_0x4064('0x12'));logger[_0x4064('0x13')](_0x4064('0x14'),_0x41612f,_0x4064('0x12'),JSON['stringify'](_0x5eeb14));if(_0x5eeb14['error']){if(_0x5eeb14['error']['code']===0x1f4){logger['error'](_0x4064('0x11'),_0x41612f,_0x5eeb14['error'][_0x4064('0x15')]);return _0x4f7c40(_0x5eeb14[_0x4064('0x16')][_0x4064('0x15')]);}logger[_0x4064('0x16')]('Dashboard,\x20%s,\x20%s',_0x41612f,_0x5eeb14[_0x4064('0x16')]['message']);return _0x129414(_0x5eeb14['error']['message']);}else{logger['info'](_0x4064('0x11'),_0x41612f,'request\x20sent');_0x129414(_0x5eeb14[_0x4064('0x17')][_0x4064('0x15')]);}})[_0x4064('0x18')](function(_0x254da2){logger[_0x4064('0x16')](_0x4064('0x11'),_0x41612f,_0x254da2);_0x4f7c40(_0x254da2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 74a1731..e64a643 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 _0xf940=['dashboard:','./dashboard.events','save','remove','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf940,0xda));var _0x0f94=function(_0x59e174,_0x43a286){_0x59e174=_0x59e174-0x0;var _0x2d581f=_0xf940[_0x59e174];return _0x2d581f;};'use strict';var DashboardEvents=require(_0x0f94('0x0'));var events=[_0x0f94('0x1'),_0x0f94('0x2'),'update'];function createListener(_0x14bf7e,_0x21cad9){return function(_0x36f4f4){_0x21cad9['emit'](_0x14bf7e,_0x36f4f4);};}function removeListener(_0xdee1cb,_0x2fa412){return function(){DashboardEvents[_0x0f94('0x3')](_0xdee1cb,_0x2fa412);};}exports[_0x0f94('0x4')]=function(_0x57e3d9){for(var _0x699d44=0x0,_0x46d75f=events[_0x0f94('0x5')];_0x699d44<_0x46d75f;_0x699d44++){var _0x286915=events[_0x699d44];var _0x5427bf=createListener(_0x0f94('0x6')+_0x286915,_0x57e3d9);DashboardEvents['on'](_0x286915,_0x5427bf);}}; \ No newline at end of file +var _0xe9f5=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0x4348a0,_0x465533){var _0x39fcfb=function(_0x2f227a){while(--_0x2f227a){_0x4348a0['push'](_0x4348a0['shift']());}};_0x39fcfb(++_0x465533);}(_0xe9f5,0x80));var _0x5e9f=function(_0x2c54c0,_0x187cb3){_0x2c54c0=_0x2c54c0-0x0;var _0x34980f=_0xe9f5[_0x2c54c0];return _0x34980f;};'use strict';var DashboardEvents=require(_0x5e9f('0x0'));var events=[_0x5e9f('0x1'),_0x5e9f('0x2'),_0x5e9f('0x3')];function createListener(_0x825533,_0x42c84b){return function(_0xea638c){_0x42c84b[_0x5e9f('0x4')](_0x825533,_0xea638c);};}function removeListener(_0x26e7e4,_0xbf01ae){return function(){DashboardEvents[_0x5e9f('0x5')](_0x26e7e4,_0xbf01ae);};}exports['register']=function(_0x4fe09b){for(var _0x3e9b43=0x0,_0x2c1b75=events[_0x5e9f('0x6')];_0x3e9b43<_0x2c1b75;_0x3e9b43++){var _0x4c0ea8=events[_0x3e9b43];var _0x194f2d=createListener(_0x5e9f('0x7')+_0x4c0ea8,_0x4fe09b);DashboardEvents['on'](_0x4c0ea8,_0x194f2d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index effdb75..09d162a 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 _0x3424=['index','isAuthenticated','post','clone','/:id/items','addItem','put','/:id','update','delete','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x15b6b7,_0x288130){var _0x475b67=function(_0x5973c1){while(--_0x5973c1){_0x15b6b7['push'](_0x15b6b7['shift']());}};_0x475b67(++_0x288130);}(_0x3424,0x1a9));var _0x4342=function(_0x119125,_0x527dd7){_0x119125=_0x119125-0x0;var _0x5e1955=_0x3424[_0x119125];return _0x5e1955;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4342('0x0'));var timeout=require(_0x4342('0x1'));var express=require(_0x4342('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4342('0x3'));var config=require(_0x4342('0x4'));var controller=require(_0x4342('0x5'));router[_0x4342('0x6')]('/',auth['isAuthenticated'](),controller[_0x4342('0x7')]);router[_0x4342('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4342('0x6')]('/:id/items',auth[_0x4342('0x8')](),controller['getItems']);router[_0x4342('0x9')]('/',auth[_0x4342('0x8')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x4342('0xa')]);router['post'](_0x4342('0xb'),auth[_0x4342('0x8')](),controller[_0x4342('0xc')]);router[_0x4342('0xd')](_0x4342('0xe'),auth['isAuthenticated'](),controller[_0x4342('0xf')]);router[_0x4342('0x10')](_0x4342('0xe'),auth[_0x4342('0x8')](),controller[_0x4342('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe5af=['connect-timeout','express','Router','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','update','delete','destroy','exports','util','path'];(function(_0x22352b,_0x255c1c){var _0x16afee=function(_0x5e2ee2){while(--_0x5e2ee2){_0x22352b['push'](_0x22352b['shift']());}};_0x16afee(++_0x255c1c);}(_0xe5af,0x15e));var _0xfe5a=function(_0x3c0e71,_0x2e0c4f){_0x3c0e71=_0x3c0e71-0x0;var _0x581619=_0xe5af[_0x3c0e71];return _0x581619;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require(_0xfe5a('0x2'));var express=require(_0xfe5a('0x3'));var router=express[_0xfe5a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe5a('0x5'));var controller=require(_0xfe5a('0x6'));router[_0xfe5a('0x7')]('/',auth[_0xfe5a('0x8')](),controller[_0xfe5a('0x9')]);router[_0xfe5a('0x7')](_0xfe5a('0xa'),auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xb')]);router['get'](_0xfe5a('0xc'),auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xd')]);router[_0xfe5a('0xe')]('/',auth[_0xfe5a('0x8')](),controller[_0xfe5a('0xf')]);router[_0xfe5a('0xe')](_0xfe5a('0x10'),auth[_0xfe5a('0x8')](),controller['clone']);router[_0xfe5a('0xe')](_0xfe5a('0xc'),auth[_0xfe5a('0x8')](),controller[_0xfe5a('0x11')]);router['put']('/:id',auth[_0xfe5a('0x8')](),controller[_0xfe5a('0x12')]);router[_0xfe5a('0x13')](_0xfe5a('0xa'),auth['isAuthenticated'](),controller[_0xfe5a('0x14')]);module[_0xfe5a('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 9852396..9d6f5f4 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 _0x687b=['sequelize','squel','lodash','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3'];(function(_0x4e469e,_0x2e2a71){var _0x1eba64=function(_0x2d5f38){while(--_0x2d5f38){_0x4e469e['push'](_0x4e469e['shift']());}};_0x1eba64(++_0x2e2a71);}(_0x687b,0x14a));var _0xb687=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0x687b[_0x5a4a1e];return _0x13b91d;};'use strict';var Sequelize=require(_0xb687('0x0'));var squel=require(_0xb687('0x1'));var _=require(_0xb687('0x2'));module[_0xb687('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5')),'get':function(){try{return JSON[_0xb687('0x6')](this[_0xb687('0x7')](_0xb687('0x8')));}catch(_0x194c55){return[];}},'set':function(_0x16ccf3){try{this[_0xb687('0x9')](_0xb687('0x8'),JSON[_0xb687('0xa')](_0x16ccf3));}catch(_0x48942b){this[_0xb687('0x9')](_0xb687('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb687('0xb')]},'col':{'type':Sequelize[_0xb687('0xb')]},'background':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb687('0xc')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x1967,0x173));var _0x7196=function(_0x550376,_0x130ef6){_0x550376=_0x550376-0x0;var _0xcc4209=_0x1967[_0x550376];return _0xcc4209;};'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 0d51d7c..d2a22f2 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 _0xcddb=['save','update','then','destroy','status','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x341c58,_0x5b80f7){var _0x524f0e=function(_0x3a7c21){while(--_0x3a7c21){_0x341c58['push'](_0x341c58['shift']());}};_0x524f0e(++_0x5b80f7);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x6ef878,_0x601b3c){_0x6ef878=_0x6ef878-0x0;var _0x3b6dc6=_0xcddb[_0x6ef878];return _0x3b6dc6;};'use strict';var emlformat=require(_0xbcdd('0x0'));var rimraf=require(_0xbcdd('0x1'));var zipdir=require(_0xbcdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbcdd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbcdd('0x4'));var util=require(_0xbcdd('0x5'));var path=require(_0xbcdd('0x6'));var sox=require(_0xbcdd('0x7'));var csv=require('to-csv');var ejs=require(_0xbcdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcdd('0x9'));var squel=require(_0xbcdd('0xa'));var crypto=require('crypto');var jsforce=require(_0xbcdd('0xb'));var deskjs=require(_0xbcdd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcdd('0xd'));var Redis=require(_0xbcdd('0xe'));var authService=require(_0xbcdd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbcdd('0x10'));var hardwareService=require(_0xbcdd('0x11'));var logger=require(_0xbcdd('0x12'))(_0xbcdd('0x13'));var utils=require('../../config/utils');var config=require(_0xbcdd('0x14'));var licenseUtil=require(_0xbcdd('0x15'));var db=require('../../mysqldb')['db'];config[_0xbcdd('0x16')]=_[_0xbcdd('0x17')](config['redis'],{'host':_0xbcdd('0x18'),'port':0x18eb});var socket=require(_0xbcdd('0x19'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xbcdd('0x1a')](socket);function respondWithStatusCode(_0x34e4cb,_0x22b66c){_0x22b66c=_0x22b66c||0xcc;return function(_0x12f57c){if(_0x12f57c){return _0x34e4cb[_0xbcdd('0x1b')](_0x22b66c);}return _0x34e4cb['status'](_0x22b66c)[_0xbcdd('0x1c')]();};}function respondWithResult(_0x408055,_0x4e2342){_0x4e2342=_0x4e2342||0xc8;return function(_0x1f077e){if(_0x1f077e){return _0x408055['status'](_0x4e2342)[_0xbcdd('0x1d')](_0x1f077e);}};}function respondWithFilteredResult(_0x2e7eeb,_0x177cc5){return function(_0x47ae02){if(_0x47ae02){var _0x1b27cb=typeof _0x177cc5[_0xbcdd('0x1e')]===_0xbcdd('0x1f')&&typeof _0x177cc5[_0xbcdd('0x20')]===_0xbcdd('0x1f');var _0x5ad171=_0x47ae02[_0xbcdd('0x21')];var _0x3396bb=_0x1b27cb?0x0:_0x177cc5[_0xbcdd('0x1e')];var _0x1477f1=_0x1b27cb?_0x47ae02[_0xbcdd('0x21')]:_0x177cc5[_0xbcdd('0x1e')]+_0x177cc5['limit'];var _0x224a84;if(_0x1477f1>=_0x5ad171){_0x1477f1=_0x5ad171;_0x224a84=0xc8;}else{_0x224a84=0xce;}_0x2e7eeb['status'](_0x224a84);return _0x2e7eeb[_0xbcdd('0x22')](_0xbcdd('0x23'),_0x3396bb+'-'+_0x1477f1+'/'+_0x5ad171)[_0xbcdd('0x1d')](_0x47ae02);}return null;};}function patchUpdates(_0x23bbd5){return function(_0x5a891b){try{jsonpatch[_0xbcdd('0x24')](_0x5a891b,_0x23bbd5,!![]);}catch(_0x2cd0dd){return BPromise[_0xbcdd('0x25')](_0x2cd0dd);}return _0x5a891b[_0xbcdd('0x26')]();};}function saveUpdates(_0x527e71,_0x155e28){return function(_0x2f85af){if(_0x2f85af){return _0x2f85af[_0xbcdd('0x27')](_0x527e71)[_0xbcdd('0x28')](function(_0x3cfd0f){return _0x3cfd0f;});}return null;};}function removeEntity(_0x5441a9,_0x1f334d){return function(_0x15671c){if(_0x15671c){return _0x15671c[_0xbcdd('0x29')]()[_0xbcdd('0x28')](function(){_0x5441a9[_0xbcdd('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340fc0,_0x5f2c82){return function(_0x58cc33){if(!_0x58cc33){_0x340fc0[_0xbcdd('0x1b')](0x194);}return _0x58cc33;};}function handleError(_0x179db9,_0x3a804c){_0x3a804c=_0x3a804c||0x1f4;return function(_0x18b13b){logger[_0xbcdd('0x2b')](_0x18b13b['stack']);if(_0x18b13b[_0xbcdd('0x2c')]){delete _0x18b13b['name'];}_0x179db9['status'](_0x3a804c)[_0xbcdd('0x2d')](_0x18b13b);};}exports[_0xbcdd('0x2e')]=function(_0x5bdb8a,_0x2dc944){var _0x561fb4={'raw':![],'where':{'id':_0x5bdb8a[_0xbcdd('0x2f')]['id']}},_0x3cdcb3={};_0x3cdcb3[_0xbcdd('0x30')]=_[_0xbcdd('0x31')](db[_0xbcdd('0x32')][_0xbcdd('0x33')]);_0x3cdcb3[_0xbcdd('0x34')]=_['keys'](_0x5bdb8a[_0xbcdd('0x34')]);_0x3cdcb3[_0xbcdd('0x35')]=_['intersection'](_0x3cdcb3['model'],_0x3cdcb3[_0xbcdd('0x34')]);_0x561fb4[_0xbcdd('0x36')]=_['intersection'](_0x3cdcb3[_0xbcdd('0x30')],qs['fields'](_0x5bdb8a[_0xbcdd('0x34')]['fields']));_0x561fb4[_0xbcdd('0x36')]=_0x561fb4['attributes'][_0xbcdd('0x37')]?_0x561fb4[_0xbcdd('0x36')]:_0x3cdcb3['model'];if(_0x5bdb8a[_0xbcdd('0x34')][_0xbcdd('0x38')]){_0x561fb4[_0xbcdd('0x39')]=[{'all':!![]}];}_0x561fb4=_[_0xbcdd('0x3a')]({},_0x561fb4,_0x5bdb8a[_0xbcdd('0x3b')]);return db['DashboardItem'][_0xbcdd('0x3c')](_0x561fb4)['then'](handleEntityNotFound(_0x2dc944,null))[_0xbcdd('0x28')](respondWithResult(_0x2dc944,null))[_0xbcdd('0x3d')](handleError(_0x2dc944,null));};exports['destroy']=function(_0x5e136d,_0x9e45b4){return db['DashboardItem'][_0xbcdd('0x3c')]({'where':{'id':_0x5e136d[_0xbcdd('0x2f')]['id']}})[_0xbcdd('0x28')](handleEntityNotFound(_0x9e45b4,null))['then'](removeEntity(_0x9e45b4,null))[_0xbcdd('0x3d')](handleError(_0x9e45b4,null));};function widgetAttributes(_0x1ae6c7){try{switch(_0x1ae6c7[_0xbcdd('0x3e')]){case _0xbcdd('0x3f'):return[{'name':_0xbcdd('0x40'),'value':_0x1ae6c7[_0xbcdd('0x40')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x43')}];case _0xbcdd('0x44'):return[{'name':'attrPath','value':_0x1ae6c7[_0xbcdd('0x45')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||''}];case _0xbcdd('0x46'):return[{'name':'attrHourFormat','value':_0x1ae6c7[_0xbcdd('0x47')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7['attrs'][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x48')},{'name':'attrTimezone','value':_0x1ae6c7[_0xbcdd('0x49')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1]['value']:undefined)||'0.00'},{'name':_0xbcdd('0x4a'),'value':_0x1ae6c7[_0xbcdd('0x4a')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0xbcdd('0x4b'),'value':_0x1ae6c7[_0xbcdd('0x4b')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x4c')},{'name':'attrVoiceQueues','value':_0x1ae6c7[_0xbcdd('0x4d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||[]},{'name':_0xbcdd('0x4a'),'value':_0x1ae6c7[_0xbcdd('0x4a')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||0x14},{'name':_0xbcdd('0x4e'),'value':_0x1ae6c7['attrChannel']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x3]?_0x1ae6c7[_0xbcdd('0x41')][0x3][_0xbcdd('0x42')]:undefined)||'voice'},{'name':_0xbcdd('0x4f'),'value':_0x1ae6c7[_0xbcdd('0x4f')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x4]?_0x1ae6c7[_0xbcdd('0x41')][0x4]['value']:undefined)||''},{'name':_0xbcdd('0x50'),'value':_0x1ae6c7[_0xbcdd('0x50')]||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x5]?_0x1ae6c7[_0xbcdd('0x41')][0x5][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x51'),'value':_0x1ae6c7[_0xbcdd('0x51')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x6]?_0x1ae6c7[_0xbcdd('0x41')][0x6]['value']:undefined)||''},{'name':_0xbcdd('0x52'),'value':_0x1ae6c7[_0xbcdd('0x52')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x7]?_0x1ae6c7['attrs'][0x7][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x53'),'value':_0x1ae6c7[_0xbcdd('0x53')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x8]?_0x1ae6c7[_0xbcdd('0x41')][0x8][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x54'),'value':_0x1ae6c7['attrChatWebsites']||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x9]?_0x1ae6c7[_0xbcdd('0x41')][0x9]['value']:undefined)||''}];case _0xbcdd('0x55'):case _0xbcdd('0x56'):return[{'name':_0xbcdd('0x57'),'value':_0x1ae6c7[_0xbcdd('0x57')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x4c')},{'name':_0xbcdd('0x58'),'value':_0x1ae6c7['attrSerie2']||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x59'),'value':_0x1ae6c7['attrSerie3']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x2]?_0x1ae6c7[_0xbcdd('0x41')][0x2][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x4d'),'value':_0x1ae6c7[_0xbcdd('0x4d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x3]?_0x1ae6c7[_0xbcdd('0x41')][0x3]['value']:undefined)||[]},{'name':_0xbcdd('0x4e'),'value':_0x1ae6c7[_0xbcdd('0x4e')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x4]?_0x1ae6c7[_0xbcdd('0x41')][0x4][_0xbcdd('0x42')]:undefined)||_0xbcdd('0x5a')},{'name':_0xbcdd('0x4f'),'value':_0x1ae6c7['attrEmailAccounts']||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x5]?_0x1ae6c7[_0xbcdd('0x41')][0x5][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x50'),'value':_0x1ae6c7['attrFaxAccounts']||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x6]?_0x1ae6c7['attrs'][0x6][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x51'),'value':_0x1ae6c7[_0xbcdd('0x51')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x7]?_0x1ae6c7[_0xbcdd('0x41')][0x7]['value']:undefined)||''},{'name':_0xbcdd('0x52'),'value':_0x1ae6c7[_0xbcdd('0x52')]||(_0x1ae6c7['attrs']&&_0x1ae6c7[_0xbcdd('0x41')][0x8]?_0x1ae6c7['attrs'][0x8][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x53'),'value':_0x1ae6c7[_0xbcdd('0x53')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x9]?_0x1ae6c7['attrs'][0x9][_0xbcdd('0x42')]:undefined)||''},{'name':_0xbcdd('0x54'),'value':_0x1ae6c7[_0xbcdd('0x54')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0xa]?_0x1ae6c7[_0xbcdd('0x41')][0xa][_0xbcdd('0x42')]:undefined)||''}];case _0xbcdd('0x5b'):return[{'name':_0xbcdd('0x5c'),'type':_0x1ae6c7[_0xbcdd('0x5d')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7['attrs'][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x3e')]:undefined)||null,'value':_0x1ae6c7[_0xbcdd('0x5c')]||(_0x1ae6c7[_0xbcdd('0x41')]&&_0x1ae6c7[_0xbcdd('0x41')][0x0]?_0x1ae6c7[_0xbcdd('0x41')][0x0][_0xbcdd('0x42')]:undefined)||null},{'name':_0xbcdd('0x5e'),'value':_0x1ae6c7[_0xbcdd('0x5e')]||(_0x1ae6c7['attrs']&&_0x1ae6c7['attrs'][0x1]?_0x1ae6c7[_0xbcdd('0x41')][0x1][_0xbcdd('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x492bae){logger['error'](_0xbcdd('0x5f'),JSON['stringify'](_0x492bae));return[];}}exports[_0xbcdd('0x60')]=function(_0x30137d,_0x4baa60){if(_0x30137d[_0xbcdd('0x61')]){_0x30137d['body'][_0xbcdd('0x41')]=widgetAttributes(_0x30137d[_0xbcdd('0x61')]);}return db[_0xbcdd('0x32')][_0xbcdd('0x60')](_0x30137d[_0xbcdd('0x61')],{})['then'](respondWithResult(_0x4baa60,0xc9))[_0xbcdd('0x3d')](handleError(_0x4baa60,null));};exports[_0xbcdd('0x27')]=function(_0x58b279,_0x58db35){if(_0x58b279[_0xbcdd('0x61')]['id']){delete _0x58b279['body']['id'];}_0x58b279[_0xbcdd('0x61')][_0xbcdd('0x41')]=widgetAttributes(_0x58b279[_0xbcdd('0x61')]);return db[_0xbcdd('0x32')][_0xbcdd('0x3c')]({'where':{'id':_0x58b279[_0xbcdd('0x2f')]['id']}})[_0xbcdd('0x28')](handleEntityNotFound(_0x58db35,null))[_0xbcdd('0x28')](saveUpdates(_0x58b279[_0xbcdd('0x61')],null))[_0xbcdd('0x28')](respondWithResult(_0x58db35,null))[_0xbcdd('0x3d')](handleError(_0x58db35,null));}; \ No newline at end of file +var _0xba18=['jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','find','catch','destroy','params','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8ba1('0x0'));var rimraf=require(_0x8ba1('0x1'));var zipdir=require(_0x8ba1('0x2'));var jsonpatch=require(_0x8ba1('0x3'));var rp=require(_0x8ba1('0x4'));var moment=require(_0x8ba1('0x5'));var BPromise=require(_0x8ba1('0x6'));var Mustache=require(_0x8ba1('0x7'));var util=require('util');var path=require(_0x8ba1('0x8'));var sox=require(_0x8ba1('0x9'));var csv=require(_0x8ba1('0xa'));var ejs=require(_0x8ba1('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba1('0xc'));var _=require(_0x8ba1('0xd'));var squel=require('squel');var crypto=require(_0x8ba1('0xe'));var jsforce=require(_0x8ba1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba1('0x10'));var Redis=require(_0x8ba1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ba1('0x12'));var as=require(_0x8ba1('0x13'));var hardwareService=require(_0x8ba1('0x14'));var logger=require(_0x8ba1('0x15'))(_0x8ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x8ba1('0x17'));var licenseUtil=require(_0x8ba1('0x18'));var db=require(_0x8ba1('0x19'))['db'];config[_0x8ba1('0x1a')]=_[_0x8ba1('0x1b')](config[_0x8ba1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ba1('0x1c'))(new Redis(config[_0x8ba1('0x1a')]));require(_0x8ba1('0x1d'))[_0x8ba1('0x1e')](socket);function respondWithStatusCode(_0x4c8d5c,_0x53a141){_0x53a141=_0x53a141||0xcc;return function(_0x5c04b7){if(_0x5c04b7){return _0x4c8d5c[_0x8ba1('0x1f')](_0x53a141);}return _0x4c8d5c[_0x8ba1('0x20')](_0x53a141)[_0x8ba1('0x21')]();};}function respondWithResult(_0x1b885b,_0xc72b8d){_0xc72b8d=_0xc72b8d||0xc8;return function(_0x3880aa){if(_0x3880aa){return _0x1b885b[_0x8ba1('0x20')](_0xc72b8d)[_0x8ba1('0x22')](_0x3880aa);}};}function respondWithFilteredResult(_0x19ade9,_0x245929){return function(_0x4d75fa){if(_0x4d75fa){var _0x4c6325=typeof _0x245929[_0x8ba1('0x23')]===_0x8ba1('0x24')&&typeof _0x245929['limit']===_0x8ba1('0x24');var _0x2e5fba=_0x4d75fa[_0x8ba1('0x25')];var _0x3355c8=_0x4c6325?0x0:_0x245929[_0x8ba1('0x23')];var _0x2e5983=_0x4c6325?_0x4d75fa['count']:_0x245929[_0x8ba1('0x23')]+_0x245929['limit'];var _0xd78e53;if(_0x2e5983>=_0x2e5fba){_0x2e5983=_0x2e5fba;_0xd78e53=0xc8;}else{_0xd78e53=0xce;}_0x19ade9[_0x8ba1('0x20')](_0xd78e53);return _0x19ade9[_0x8ba1('0x26')](_0x8ba1('0x27'),_0x3355c8+'-'+_0x2e5983+'/'+_0x2e5fba)['json'](_0x4d75fa);}return null;};}function patchUpdates(_0x1d619c){return function(_0x25b65c){try{jsonpatch[_0x8ba1('0x28')](_0x25b65c,_0x1d619c,!![]);}catch(_0x38a2de){return BPromise[_0x8ba1('0x29')](_0x38a2de);}return _0x25b65c[_0x8ba1('0x2a')]();};}function saveUpdates(_0x845108,_0x1c51ef){return function(_0x273e67){if(_0x273e67){return _0x273e67[_0x8ba1('0x2b')](_0x845108)[_0x8ba1('0x2c')](function(_0x550d33){return _0x550d33;});}return null;};}function removeEntity(_0x5c924e,_0x41c2bb){return function(_0x1ccd44){if(_0x1ccd44){return _0x1ccd44['destroy']()[_0x8ba1('0x2c')](function(){_0x5c924e[_0x8ba1('0x20')](0xcc)[_0x8ba1('0x21')]();});}};}function handleEntityNotFound(_0x326460,_0x15e419){return function(_0x8d8220){if(!_0x8d8220){_0x326460[_0x8ba1('0x1f')](0x194);}return _0x8d8220;};}function handleError(_0x26288a,_0x2bc037){_0x2bc037=_0x2bc037||0x1f4;return function(_0x3f1b37){logger[_0x8ba1('0x2d')](_0x3f1b37[_0x8ba1('0x2e')]);if(_0x3f1b37[_0x8ba1('0x2f')]){delete _0x3f1b37[_0x8ba1('0x2f')];}_0x26288a['status'](_0x2bc037)[_0x8ba1('0x30')](_0x3f1b37);};}exports[_0x8ba1('0x31')]=function(_0x22059f,_0x3c37fd){var _0x243a0a={'raw':![],'where':{'id':_0x22059f['params']['id']}},_0x24bf95={};_0x24bf95[_0x8ba1('0x32')]=_[_0x8ba1('0x33')](db['DashboardItem'][_0x8ba1('0x34')]);_0x24bf95['query']=_[_0x8ba1('0x33')](_0x22059f[_0x8ba1('0x35')]);_0x24bf95['filters']=_[_0x8ba1('0x36')](_0x24bf95[_0x8ba1('0x32')],_0x24bf95[_0x8ba1('0x35')]);_0x243a0a[_0x8ba1('0x37')]=_[_0x8ba1('0x36')](_0x24bf95['model'],qs[_0x8ba1('0x38')](_0x22059f[_0x8ba1('0x35')][_0x8ba1('0x38')]));_0x243a0a[_0x8ba1('0x37')]=_0x243a0a[_0x8ba1('0x37')][_0x8ba1('0x39')]?_0x243a0a[_0x8ba1('0x37')]:_0x24bf95[_0x8ba1('0x32')];if(_0x22059f['query'][_0x8ba1('0x3a')]){_0x243a0a[_0x8ba1('0x3b')]=[{'all':!![]}];}_0x243a0a=_[_0x8ba1('0x3c')]({},_0x243a0a,_0x22059f[_0x8ba1('0x3d')]);return db[_0x8ba1('0x3e')][_0x8ba1('0x3f')](_0x243a0a)[_0x8ba1('0x2c')](handleEntityNotFound(_0x3c37fd,null))[_0x8ba1('0x2c')](respondWithResult(_0x3c37fd,null))[_0x8ba1('0x40')](handleError(_0x3c37fd,null));};exports[_0x8ba1('0x41')]=function(_0x571edc,_0xc79922){return db[_0x8ba1('0x3e')][_0x8ba1('0x3f')]({'where':{'id':_0x571edc[_0x8ba1('0x42')]['id']}})[_0x8ba1('0x2c')](handleEntityNotFound(_0xc79922,null))[_0x8ba1('0x2c')](removeEntity(_0xc79922,null))[_0x8ba1('0x40')](handleError(_0xc79922,null));};function widgetAttributes(_0x2db01a){try{switch(_0x2db01a[_0x8ba1('0x43')]){case _0x8ba1('0x44'):return[{'name':'attrUrl','value':_0x2db01a['attrUrl']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0][_0x8ba1('0x46')]:undefined)||_0x8ba1('0x47')}];case _0x8ba1('0x48'):return[{'name':_0x8ba1('0x49'),'value':_0x2db01a[_0x8ba1('0x49')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0][_0x8ba1('0x46')]:undefined)||''}];case _0x8ba1('0x4a'):return[{'name':_0x8ba1('0x4b'),'value':_0x2db01a['attrHourFormat']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0][_0x8ba1('0x46')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2db01a[_0x8ba1('0x4c')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x1]?_0x2db01a[_0x8ba1('0x45')][0x1][_0x8ba1('0x46')]:undefined)||'0.00'},{'name':_0x8ba1('0x4d'),'value':_0x2db01a[_0x8ba1('0x4d')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a['attrs'][0x2]?_0x2db01a[_0x8ba1('0x45')][0x2][_0x8ba1('0x46')]:undefined)||0xc}];case _0x8ba1('0x4e'):return[{'name':_0x8ba1('0x4f'),'value':_0x2db01a[_0x8ba1('0x4f')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a['attrs'][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0]['value']:undefined)||_0x8ba1('0x50')},{'name':_0x8ba1('0x51'),'value':_0x2db01a[_0x8ba1('0x51')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x1]?_0x2db01a[_0x8ba1('0x45')][0x1]['value']:undefined)||[]},{'name':_0x8ba1('0x4d'),'value':_0x2db01a[_0x8ba1('0x4d')]||(_0x2db01a['attrs']&&_0x2db01a['attrs'][0x2]?_0x2db01a[_0x8ba1('0x45')][0x2][_0x8ba1('0x46')]:undefined)||0x14},{'name':_0x8ba1('0x52'),'value':_0x2db01a[_0x8ba1('0x52')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x3]?_0x2db01a[_0x8ba1('0x45')][0x3][_0x8ba1('0x46')]:undefined)||_0x8ba1('0x53')},{'name':_0x8ba1('0x54'),'value':_0x2db01a[_0x8ba1('0x54')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x4]?_0x2db01a['attrs'][0x4][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x55'),'value':_0x2db01a[_0x8ba1('0x55')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x5]?_0x2db01a[_0x8ba1('0x45')][0x5][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x56'),'value':_0x2db01a[_0x8ba1('0x56')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x6]?_0x2db01a[_0x8ba1('0x45')][0x6][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x57'),'value':_0x2db01a['attrOpenchannelAccounts']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x7]?_0x2db01a['attrs'][0x7][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x58'),'value':_0x2db01a[_0x8ba1('0x58')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x8]?_0x2db01a['attrs'][0x8]['value']:undefined)||''},{'name':_0x8ba1('0x59'),'value':_0x2db01a[_0x8ba1('0x59')]||(_0x2db01a['attrs']&&_0x2db01a[_0x8ba1('0x45')][0x9]?_0x2db01a[_0x8ba1('0x45')][0x9][_0x8ba1('0x46')]:undefined)||''}];case'multibar-chart':case _0x8ba1('0x5a'):return[{'name':_0x8ba1('0x5b'),'value':_0x2db01a[_0x8ba1('0x5b')]||(_0x2db01a['attrs']&&_0x2db01a[_0x8ba1('0x45')][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0][_0x8ba1('0x46')]:undefined)||_0x8ba1('0x50')},{'name':'attrSerie2','value':_0x2db01a[_0x8ba1('0x5c')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x1]?_0x2db01a[_0x8ba1('0x45')][0x1][_0x8ba1('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x2db01a[_0x8ba1('0x5d')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x2]?_0x2db01a[_0x8ba1('0x45')][0x2]['value']:undefined)||null},{'name':_0x8ba1('0x51'),'value':_0x2db01a[_0x8ba1('0x51')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x3]?_0x2db01a[_0x8ba1('0x45')][0x3][_0x8ba1('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x2db01a[_0x8ba1('0x52')]||(_0x2db01a['attrs']&&_0x2db01a['attrs'][0x4]?_0x2db01a[_0x8ba1('0x45')][0x4]['value']:undefined)||_0x8ba1('0x53')},{'name':_0x8ba1('0x54'),'value':_0x2db01a['attrEmailAccounts']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a['attrs'][0x5]?_0x2db01a['attrs'][0x5][_0x8ba1('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2db01a[_0x8ba1('0x55')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x6]?_0x2db01a[_0x8ba1('0x45')][0x6][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x56'),'value':_0x2db01a['attrSmsAccounts']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a['attrs'][0x7]?_0x2db01a[_0x8ba1('0x45')][0x7]['value']:undefined)||''},{'name':_0x8ba1('0x57'),'value':_0x2db01a['attrOpenchannelAccounts']||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x8]?_0x2db01a[_0x8ba1('0x45')][0x8][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x58'),'value':_0x2db01a['attrWhatsappAccounts']||(_0x2db01a['attrs']&&_0x2db01a['attrs'][0x9]?_0x2db01a['attrs'][0x9][_0x8ba1('0x46')]:undefined)||''},{'name':_0x8ba1('0x59'),'value':_0x2db01a[_0x8ba1('0x59')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a['attrs'][0xa]?_0x2db01a[_0x8ba1('0x45')][0xa][_0x8ba1('0x46')]:undefined)||''}];case _0x8ba1('0x5e'):return[{'name':_0x8ba1('0x5f'),'type':_0x2db01a['reportType']||(_0x2db01a['attrs']&&_0x2db01a['attrs'][0x0]?_0x2db01a[_0x8ba1('0x45')][0x0]['type']:undefined)||null,'value':_0x2db01a[_0x8ba1('0x5f')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x0]?_0x2db01a['attrs'][0x0][_0x8ba1('0x46')]:undefined)||null},{'name':'attrRefresh','value':_0x2db01a[_0x8ba1('0x60')]||(_0x2db01a[_0x8ba1('0x45')]&&_0x2db01a[_0x8ba1('0x45')][0x1]?_0x2db01a[_0x8ba1('0x45')][0x1][_0x8ba1('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x49faf1){logger[_0x8ba1('0x2d')](_0x8ba1('0x61'),JSON[_0x8ba1('0x62')](_0x49faf1));return[];}}exports['create']=function(_0x3f6720,_0x24f3fa){if(_0x3f6720[_0x8ba1('0x63')]){_0x3f6720[_0x8ba1('0x63')][_0x8ba1('0x45')]=widgetAttributes(_0x3f6720[_0x8ba1('0x63')]);}return db['DashboardItem'][_0x8ba1('0x64')](_0x3f6720[_0x8ba1('0x63')],{})['then'](respondWithResult(_0x24f3fa,0xc9))[_0x8ba1('0x40')](handleError(_0x24f3fa,null));};exports[_0x8ba1('0x2b')]=function(_0x20f6c6,_0x45dd64){if(_0x20f6c6['body']['id']){delete _0x20f6c6[_0x8ba1('0x63')]['id'];}_0x20f6c6[_0x8ba1('0x63')][_0x8ba1('0x45')]=widgetAttributes(_0x20f6c6[_0x8ba1('0x63')]);return db[_0x8ba1('0x3e')][_0x8ba1('0x3f')]({'where':{'id':_0x20f6c6['params']['id']}})[_0x8ba1('0x2c')](handleEntityNotFound(_0x45dd64,null))[_0x8ba1('0x2c')](saveUpdates(_0x20f6c6[_0x8ba1('0x63')],null))[_0x8ba1('0x2c')](respondWithResult(_0x45dd64,null))[_0x8ba1('0x40')](handleError(_0x45dd64,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5246692..ecd140b 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 _0x2ccd=['DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x13cdfd,_0x2e2521){var _0x50eee0=function(_0xc8dbe7){while(--_0xc8dbe7){_0x13cdfd['push'](_0x13cdfd['shift']());}};_0x50eee0(++_0x2e2521);}(_0x2ccd,0x142));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd2cc('0x0'));var DashboardItem=require(_0xd2cc('0x1'))['db'][_0xd2cc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd2cc('0x3')](0x0);var events={'afterCreate':_0xd2cc('0x4'),'afterUpdate':_0xd2cc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4effa4){return function(_0x3eb22c,_0x68552a,_0x2aa6f9){DashboardItemEvents[_0xd2cc('0x6')](_0x4effa4+':'+_0x3eb22c['id'],_0x3eb22c);DashboardItemEvents[_0xd2cc('0x6')](_0x4effa4,_0x3eb22c);_0x2aa6f9(null);};}for(var e in events){if(events[_0xd2cc('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd2cc('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x1069=['hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','emit'];(function(_0x550768,_0x258dd8){var _0x1cccec=function(_0x1a4c44){while(--_0x1a4c44){_0x550768['push'](_0x550768['shift']());}};_0x1cccec(++_0x258dd8);}(_0x1069,0x167));var _0x9106=function(_0x4aa47f,_0x25981e){_0x4aa47f=_0x4aa47f-0x0;var _0x2dde4c=_0x1069[_0x4aa47f];return _0x2dde4c;};'use strict';var EventEmitter=require(_0x9106('0x0'));var DashboardItem=require(_0x9106('0x1'))['db'][_0x9106('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9106('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ca5fb){return function(_0x339384,_0x39f9a8,_0x57e8fb){DashboardItemEvents['emit'](_0x3ca5fb+':'+_0x339384['id'],_0x339384);DashboardItemEvents[_0x9106('0x4')](_0x3ca5fb,_0x339384);_0x57e8fb(null);};}for(var e in events){if(events[_0x9106('0x5')](e)){var event=events[e];DashboardItem[_0x9106('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 69f230c..988e8fc 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 _0x4a25=['path','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x4a25,0x1d4));var _0x54a2=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x4a25[_0x574ce3];return _0x3447a0;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem'];(function(_0x3ed67d,_0x24c356){var _0x4d6d3a=function(_0x2e2376){while(--_0x2e2376){_0x3ed67d['push'](_0x3ed67d['shift']());}};_0x4d6d3a(++_0x24c356);}(_0x6324,0x13b));var _0x4632=function(_0x4fd812,_0x575915){_0x4fd812=_0x4fd812-0x0;var _0x6064b5=_0x6324[_0x4fd812];return _0x6064b5;};'use strict';var _=require('lodash');var util=require(_0x4632('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4632('0x1'));var BPromise=require(_0x4632('0x2'));var rp=require(_0x4632('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4632('0x4'));var config=require(_0x4632('0x5'));var attributes=require(_0x4632('0x6'));module[_0x4632('0x7')]=function(_0x39d265,_0xa77962){return _0x39d265['define'](_0x4632('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 098cee8..bdf5d62 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 _0x754e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','DashboardItem,\x20%s,\x20%s','message'];(function(_0x425c4c,_0x29ae48){var _0x2b4c08=function(_0x1c0887){while(--_0x1c0887){_0x425c4c['push'](_0x425c4c['shift']());}};_0x2b4c08(++_0x29ae48);}(_0x754e,0x1ef));var _0xe754=function(_0x201951,_0x9e1407){_0x201951=_0x201951-0x0;var _0x5c69c1=_0x754e[_0x201951];return _0x5c69c1;};'use strict';var _=require(_0xe754('0x0'));var util=require(_0xe754('0x1'));var moment=require(_0xe754('0x2'));var BPromise=require(_0xe754('0x3'));var rs=require(_0xe754('0x4'));var fs=require('fs');var Redis=require(_0xe754('0x5'));var db=require(_0xe754('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe754('0x7'))(_0xe754('0x8'));var config=require(_0xe754('0x9'));var jayson=require(_0xe754('0xa'));var client=jayson[_0xe754('0xb')][_0xe754('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe754('0xd')],{'host':_0xe754('0xe'),'port':0x18eb});var socket=require(_0xe754('0xf'))(new Redis(config[_0xe754('0xd')]));require(_0xe754('0x10'))['register'](socket);function respondWithRpcPromise(_0xd8f7b9,_0xd850d,_0x42a092){return new BPromise(function(_0x199bdc,_0x268d49){return client[_0xe754('0x11')](_0xd8f7b9,_0x42a092)[_0xe754('0x12')](function(_0x4d05ea){logger[_0xe754('0x13')]('DashboardItem,\x20%s,\x20%s',_0xd850d,_0xe754('0x14'));logger['debug'](_0xe754('0x15'),_0xd850d,_0xe754('0x14'),JSON[_0xe754('0x16')](_0x4d05ea));if(_0x4d05ea['error']){if(_0x4d05ea['error'][_0xe754('0x17')]===0x1f4){logger[_0xe754('0x18')](_0xe754('0x19'),_0xd850d,_0x4d05ea[_0xe754('0x18')][_0xe754('0x1a')]);return _0x268d49(_0x4d05ea[_0xe754('0x18')]['message']);}logger['error'](_0xe754('0x19'),_0xd850d,_0x4d05ea[_0xe754('0x18')]['message']);return _0x199bdc(_0x4d05ea['error'][_0xe754('0x1a')]);}else{logger['info'](_0xe754('0x19'),_0xd850d,_0xe754('0x14'));_0x199bdc(_0x4d05ea[_0xe754('0x1b')][_0xe754('0x1a')]);}})[_0xe754('0x1c')](function(_0x5d2712){logger[_0xe754('0x18')](_0xe754('0x19'),_0xd850d,_0x5d2712);_0x268d49(_0x5d2712);});});} \ No newline at end of file +var _0x94dc=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','./dashboardItem.socket','register','request'];(function(_0x5596d9,_0x4f266b){var _0x134975=function(_0x1409a9){while(--_0x1409a9){_0x5596d9['push'](_0x5596d9['shift']());}};_0x134975(++_0x4f266b);}(_0x94dc,0xa8));var _0xc94d=function(_0x51ebd3,_0x5302d3){_0x51ebd3=_0x51ebd3-0x0;var _0x4bfe98=_0x94dc[_0x51ebd3];return _0x4bfe98;};'use strict';var _=require(_0xc94d('0x0'));var util=require('util');var moment=require(_0xc94d('0x1'));var BPromise=require(_0xc94d('0x2'));var rs=require(_0xc94d('0x3'));var fs=require('fs');var Redis=require(_0xc94d('0x4'));var db=require(_0xc94d('0x5'))['db'];var utils=require(_0xc94d('0x6'));var logger=require(_0xc94d('0x7'))('rpc');var config=require(_0xc94d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc94d('0x9')]({'port':0x232a});config[_0xc94d('0xa')]=_['defaults'](config[_0xc94d('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc94d('0xa')]));require(_0xc94d('0xb'))[_0xc94d('0xc')](socket);function respondWithRpcPromise(_0x393621,_0x3c9d77,_0x4bb9bc){return new BPromise(function(_0x17cc02,_0x34687e){return client[_0xc94d('0xd')](_0x393621,_0x4bb9bc)[_0xc94d('0xe')](function(_0x179ee9){logger[_0xc94d('0xf')](_0xc94d('0x10'),_0x3c9d77,_0xc94d('0x11'));logger[_0xc94d('0x12')](_0xc94d('0x13'),_0x3c9d77,_0xc94d('0x11'),JSON[_0xc94d('0x14')](_0x179ee9));if(_0x179ee9[_0xc94d('0x15')]){if(_0x179ee9[_0xc94d('0x15')][_0xc94d('0x16')]===0x1f4){logger[_0xc94d('0x15')](_0xc94d('0x10'),_0x3c9d77,_0x179ee9['error'][_0xc94d('0x17')]);return _0x34687e(_0x179ee9['error'][_0xc94d('0x17')]);}logger[_0xc94d('0x15')](_0xc94d('0x10'),_0x3c9d77,_0x179ee9[_0xc94d('0x15')][_0xc94d('0x17')]);return _0x17cc02(_0x179ee9[_0xc94d('0x15')][_0xc94d('0x17')]);}else{logger[_0xc94d('0xf')](_0xc94d('0x10'),_0x3c9d77,'request\x20sent');_0x17cc02(_0x179ee9[_0xc94d('0x18')][_0xc94d('0x17')]);}})[_0xc94d('0x19')](function(_0x5a1aba){logger[_0xc94d('0x15')](_0xc94d('0x10'),_0x3c9d77,_0x5a1aba);_0x34687e(_0x5a1aba);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 22d62f3..a0a8d3b 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 _0xb2af=['length','./dashboardItem.events','save','remove','update','emit','register'];(function(_0x32bfac,_0x450905){var _0x587d6a=function(_0x3a02d8){while(--_0x3a02d8){_0x32bfac['push'](_0x32bfac['shift']());}};_0x587d6a(++_0x450905);}(_0xb2af,0x1a5));var _0xfb2a=function(_0x2a8ce9,_0x1d2c89){_0x2a8ce9=_0x2a8ce9-0x0;var _0x541e4c=_0xb2af[_0x2a8ce9];return _0x541e4c;};'use strict';var DashboardItemEvents=require(_0xfb2a('0x0'));var events=[_0xfb2a('0x1'),_0xfb2a('0x2'),_0xfb2a('0x3')];function createListener(_0x5ae0b0,_0x41be41){return function(_0x29bf00){_0x41be41[_0xfb2a('0x4')](_0x5ae0b0,_0x29bf00);};}function removeListener(_0x4f4bf3,_0x686463){return function(){DashboardItemEvents['removeListener'](_0x4f4bf3,_0x686463);};}exports[_0xfb2a('0x5')]=function(_0x3b1607){for(var _0x9566a2=0x0,_0x4a635d=events[_0xfb2a('0x6')];_0x9566a2<_0x4a635d;_0x9566a2++){var _0x5b4146=events[_0x9566a2];var _0x2ad158=createListener('dashboardItem:'+_0x5b4146,_0x3b1607);DashboardItemEvents['on'](_0x5b4146,_0x2ad158);}}; \ No newline at end of file +var _0x9a58=['update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x354ea0,_0x4b72fd){var _0x117d69=function(_0x2734b0){while(--_0x2734b0){_0x354ea0['push'](_0x354ea0['shift']());}};_0x117d69(++_0x4b72fd);}(_0x9a58,0x6d));var _0x89a5=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x9a58[_0xdbe2de];return _0x2facd7;};'use strict';var DashboardItemEvents=require(_0x89a5('0x0'));var events=[_0x89a5('0x1'),_0x89a5('0x2'),_0x89a5('0x3')];function createListener(_0x40a993,_0x209ace){return function(_0x6e36f7){_0x209ace[_0x89a5('0x4')](_0x40a993,_0x6e36f7);};}function removeListener(_0x1dff4d,_0x1be904){return function(){DashboardItemEvents[_0x89a5('0x5')](_0x1dff4d,_0x1be904);};}exports['register']=function(_0x3f304b){for(var _0x20e903=0x0,_0x4a8916=events[_0x89a5('0x6')];_0x20e903<_0x4a8916;_0x20e903++){var _0x31414c=events[_0x20e903];var _0x5a211a=createListener(_0x89a5('0x7')+_0x31414c,_0x3f304b);DashboardItemEvents['on'](_0x31414c,_0x5a211a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 69bb26c..0f4f2a9 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 _0x9239=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports'];(function(_0x2738a9,_0x101cca){var _0x43b533=function(_0x250e77){while(--_0x250e77){_0x2738a9['push'](_0x2738a9['shift']());}};_0x43b533(++_0x101cca);}(_0x9239,0x156));var _0x9923=function(_0x48e087,_0x287f83){_0x48e087=_0x48e087-0x0;var _0x23257f=_0x9239[_0x48e087];return _0x23257f;};'use strict';var multer=require(_0x9923('0x0'));var util=require(_0x9923('0x1'));var path=require('path');var timeout=require(_0x9923('0x2'));var express=require(_0x9923('0x3'));var router=express[_0x9923('0x4')]();var fs_extra=require(_0x9923('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9923('0x6'));var config=require(_0x9923('0x7'));var controller=require(_0x9923('0x8'));router[_0x9923('0x9')](_0x9923('0xa'),auth['isAuthenticated'](),controller[_0x9923('0xb')]);router[_0x9923('0xc')]('/',auth[_0x9923('0xd')](),controller[_0x9923('0xe')]);router[_0x9923('0xf')](_0x9923('0xa'),auth[_0x9923('0xd')](),controller[_0x9923('0x10')]);router['delete'](_0x9923('0xa'),auth[_0x9923('0xd')](),controller[_0x9923('0x11')]);module[_0x9923('0x12')]=router; \ No newline at end of file +var _0xa8bd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path'];(function(_0x50d3b0,_0x43e73b){var _0x459981=function(_0x918d7d){while(--_0x918d7d){_0x50d3b0['push'](_0x50d3b0['shift']());}};_0x459981(++_0x43e73b);}(_0xa8bd,0x6f));var _0xda8b=function(_0x2ff252,_0x222a1b){_0x2ff252=_0x2ff252-0x0;var _0x327741=_0xa8bd[_0x2ff252];return _0x327741;};'use strict';var multer=require(_0xda8b('0x0'));var util=require(_0xda8b('0x1'));var path=require(_0xda8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xda8b('0x3'));var router=express[_0xda8b('0x4')]();var fs_extra=require(_0xda8b('0x5'));var auth=require(_0xda8b('0x6'));var interaction=require(_0xda8b('0x7'));var config=require(_0xda8b('0x8'));var controller=require('./dashboardItem.controller');router[_0xda8b('0x9')]('/:id',auth[_0xda8b('0xa')](),controller[_0xda8b('0xb')]);router[_0xda8b('0xc')]('/',auth[_0xda8b('0xa')](),controller[_0xda8b('0xd')]);router[_0xda8b('0xe')](_0xda8b('0xf'),auth[_0xda8b('0xa')](),controller[_0xda8b('0x10')]);router[_0xda8b('0x11')](_0xda8b('0xf'),auth[_0xda8b('0xa')](),controller['destroy']);module[_0xda8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e390c00..aaf1e75 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 _0x7458=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x2c068a,_0x300872){var _0x22e3de=function(_0x244bbc){while(--_0x244bbc){_0x2c068a['push'](_0x2c068a['shift']());}};_0x22e3de(++_0x300872);}(_0x7458,0xc8));var _0x8745=function(_0x1e3924,_0x143bc3){_0x1e3924=_0x1e3924-0x0;var _0x38e3e0=_0x7458[_0x1e3924];return _0x38e3e0;};'use strict';var Sequelize=require(_0x8745('0x0'));module[_0x8745('0x1')]={'name':{'type':Sequelize[_0x8745('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8745('0x3')](_0x8745('0x4'),_0x8745('0x5'),_0x8745('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x8745('0x2')]}}; \ No newline at end of file +var _0x4221=['STRING','ENUM','first','third','sequelize'];(function(_0x3330f8,_0x2443da){var _0x22e2b1=function(_0x2e52c4){while(--_0x2e52c4){_0x3330f8['push'](_0x3330f8['shift']());}};_0x22e2b1(++_0x2443da);}(_0x4221,0x12b));var _0x1422=function(_0x111a97,_0x27e211){_0x111a97=_0x111a97-0x0;var _0x102545=_0x4221[_0x111a97];return _0x102545;};'use strict';var Sequelize=require(_0x1422('0x0'));module['exports']={'name':{'type':Sequelize[_0x1422('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x1422('0x2')](_0x1422('0x3'),'second',_0x1422('0x4')),'allowNull':![],'defaultValue':_0x1422('0x3')},'description':{'type':Sequelize[_0x1422('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9f1bad0..c557eea 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 _0xe978=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','map','Disposition','rawAttributes','type','key','model'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe978,0x70));var _0x8e97=function(_0x32acb8,_0xc93a4){_0x32acb8=_0x32acb8-0x0;var _0x1fa292=_0xe978[_0x32acb8];return _0x1fa292;};'use strict';var emlformat=require(_0x8e97('0x0'));var rimraf=require(_0x8e97('0x1'));var zipdir=require(_0x8e97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e97('0x3'));var BPromise=require(_0x8e97('0x4'));var Mustache=require(_0x8e97('0x5'));var util=require(_0x8e97('0x6'));var path=require(_0x8e97('0x7'));var sox=require('sox');var csv=require(_0x8e97('0x8'));var ejs=require(_0x8e97('0x9'));var fs=require('fs');var fs_extra=require(_0x8e97('0xa'));var _=require(_0x8e97('0xb'));var squel=require(_0x8e97('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e97('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e97('0x8'));var querystring=require(_0x8e97('0xe'));var Papa=require(_0x8e97('0xf'));var Redis=require('ioredis');var authService=require(_0x8e97('0x10'));var qs=require(_0x8e97('0x11'));var as=require(_0x8e97('0x12'));var hardwareService=require(_0x8e97('0x13'));var logger=require(_0x8e97('0x14'))(_0x8e97('0x15'));var utils=require(_0x8e97('0x16'));var config=require(_0x8e97('0x17'));var licenseUtil=require(_0x8e97('0x18'));var db=require(_0x8e97('0x19'))['db'];function respondWithStatusCode(_0x23215e,_0x4f45ee){_0x4f45ee=_0x4f45ee||0xcc;return function(_0x3d2c93){if(_0x3d2c93){return _0x23215e[_0x8e97('0x1a')](_0x4f45ee);}return _0x23215e[_0x8e97('0x1b')](_0x4f45ee)[_0x8e97('0x1c')]();};}function respondWithResult(_0x4df8d3,_0x5051e8){_0x5051e8=_0x5051e8||0xc8;return function(_0x583c0a){if(_0x583c0a){return _0x4df8d3['status'](_0x5051e8)['json'](_0x583c0a);}};}function respondWithFilteredResult(_0x5e2725,_0x17bc97){return function(_0x4fc685){if(_0x4fc685){var _0x33b6b3=typeof _0x17bc97[_0x8e97('0x1d')]==='undefined'&&typeof _0x17bc97['limit']===_0x8e97('0x1e');var _0x3f3738=_0x4fc685[_0x8e97('0x1f')];var _0x2f475c=_0x33b6b3?0x0:_0x17bc97[_0x8e97('0x1d')];var _0x2b823e=_0x33b6b3?_0x4fc685[_0x8e97('0x1f')]:_0x17bc97[_0x8e97('0x1d')]+_0x17bc97[_0x8e97('0x20')];var _0x596d71;if(_0x2b823e>=_0x3f3738){_0x2b823e=_0x3f3738;_0x596d71=0xc8;}else{_0x596d71=0xce;}_0x5e2725[_0x8e97('0x1b')](_0x596d71);return _0x5e2725[_0x8e97('0x21')](_0x8e97('0x22'),_0x2f475c+'-'+_0x2b823e+'/'+_0x3f3738)[_0x8e97('0x23')](_0x4fc685);}return null;};}function patchUpdates(_0x9bb69f){return function(_0xa2968a){try{jsonpatch[_0x8e97('0x24')](_0xa2968a,_0x9bb69f,!![]);}catch(_0x5a5c99){return BPromise[_0x8e97('0x25')](_0x5a5c99);}return _0xa2968a[_0x8e97('0x26')]();};}function saveUpdates(_0x2b1b01,_0x305686){return function(_0x387748){if(_0x387748){return _0x387748[_0x8e97('0x27')](_0x2b1b01)[_0x8e97('0x28')](function(_0x18fcdb){return _0x18fcdb;});}return null;};}function removeEntity(_0x3c13de,_0x5dde33){return function(_0x517c1e){if(_0x517c1e){return _0x517c1e['destroy']()['then'](function(){var _0x3d8440=_0x517c1e[_0x8e97('0x29')]({'plain':!![]});var _0x2be986=_0x8e97('0x2a');return db[_0x8e97('0x2b')][_0x8e97('0x2c')]({'where':{'type':_0x2be986,'resourceId':_0x3d8440['id']}})[_0x8e97('0x28')](function(){return _0x517c1e;});})[_0x8e97('0x28')](function(){_0x3c13de['status'](0xcc)[_0x8e97('0x1c')]();});}};}function handleEntityNotFound(_0x2a5f18,_0x33e801){return function(_0x5bb338){if(!_0x5bb338){_0x2a5f18[_0x8e97('0x1a')](0x194);}return _0x5bb338;};}function handleError(_0x4ef232,_0x7f0baf){_0x7f0baf=_0x7f0baf||0x1f4;return function(_0x7f3ea1){logger[_0x8e97('0x2d')](_0x7f3ea1[_0x8e97('0x2e')]);if(_0x7f3ea1[_0x8e97('0x2f')]){delete _0x7f3ea1[_0x8e97('0x2f')];}_0x4ef232[_0x8e97('0x1b')](_0x7f0baf)['send'](_0x7f3ea1);};}exports['index']=function(_0x1271c1,_0x364296){var _0x19d800={},_0x3f24d0={},_0x5818b0={'count':0x0,'rows':[]};var _0x5a63ce=_[_0x8e97('0x30')](db[_0x8e97('0x31')][_0x8e97('0x32')],function(_0x46ddaa){return{'name':_0x46ddaa['fieldName'],'type':_0x46ddaa[_0x8e97('0x33')][_0x8e97('0x34')]};});_0x3f24d0[_0x8e97('0x35')]=_[_0x8e97('0x30')](_0x5a63ce,_0x8e97('0x2f'));_0x3f24d0['query']=_[_0x8e97('0x36')](_0x1271c1['query']);_0x3f24d0[_0x8e97('0x37')]=_[_0x8e97('0x38')](_0x3f24d0[_0x8e97('0x35')],_0x3f24d0[_0x8e97('0x39')]);_0x19d800[_0x8e97('0x3a')]=_['intersection'](_0x3f24d0[_0x8e97('0x35')],qs[_0x8e97('0x3b')](_0x1271c1['query']['fields']));_0x19d800[_0x8e97('0x3a')]=_0x19d800[_0x8e97('0x3a')][_0x8e97('0x3c')]?_0x19d800['attributes']:_0x3f24d0[_0x8e97('0x35')];if(!_0x1271c1[_0x8e97('0x39')][_0x8e97('0x3d')](_0x8e97('0x3e'))){_0x19d800[_0x8e97('0x20')]=qs['limit'](_0x1271c1[_0x8e97('0x39')]['limit']);_0x19d800[_0x8e97('0x1d')]=qs[_0x8e97('0x1d')](_0x1271c1[_0x8e97('0x39')]['offset']);}_0x19d800['order']=qs[_0x8e97('0x3f')](_0x1271c1[_0x8e97('0x39')][_0x8e97('0x3f')]);_0x19d800['where']=qs['filters'](_[_0x8e97('0x40')](_0x1271c1[_0x8e97('0x39')],_0x3f24d0[_0x8e97('0x37')]),_0x5a63ce);if(_0x1271c1['query']['filter']){_0x19d800[_0x8e97('0x41')]=_['merge'](_0x19d800[_0x8e97('0x41')],{'$or':_[_0x8e97('0x30')](_0x5a63ce,function(_0x6a1e57){if(_0x6a1e57[_0x8e97('0x33')]!==_0x8e97('0x42')){var _0x13d73b={};_0x13d73b[_0x6a1e57[_0x8e97('0x2f')]]={'$like':'%'+_0x1271c1['query'][_0x8e97('0x43')]+'%'};return _0x13d73b;}})});}_0x19d800=_[_0x8e97('0x44')]({},_0x19d800,_0x1271c1[_0x8e97('0x45')]);var _0x27185b={'where':_0x19d800[_0x8e97('0x41')]};return db[_0x8e97('0x31')][_0x8e97('0x1f')](_0x27185b)[_0x8e97('0x28')](function(_0x4c1180){_0x5818b0[_0x8e97('0x1f')]=_0x4c1180;if(_0x1271c1[_0x8e97('0x39')][_0x8e97('0x46')]){_0x19d800['include']=[{'all':!![]}];}return db[_0x8e97('0x31')]['findAll'](_0x19d800);})[_0x8e97('0x28')](function(_0x60a881){_0x5818b0['rows']=_0x60a881;return _0x5818b0;})['then'](respondWithFilteredResult(_0x364296,_0x19d800))[_0x8e97('0x47')](handleError(_0x364296,null));};exports[_0x8e97('0x48')]=function(_0xfe53be,_0x3ce21d){var _0x183f92={'raw':!![],'where':{'id':_0xfe53be[_0x8e97('0x49')]['id']}},_0x1568ef={};_0x1568ef['model']=_[_0x8e97('0x36')](db[_0x8e97('0x31')][_0x8e97('0x32')]);_0x1568ef[_0x8e97('0x39')]=_[_0x8e97('0x36')](_0xfe53be[_0x8e97('0x39')]);_0x1568ef['filters']=_[_0x8e97('0x38')](_0x1568ef[_0x8e97('0x35')],_0x1568ef[_0x8e97('0x39')]);_0x183f92['attributes']=_['intersection'](_0x1568ef[_0x8e97('0x35')],qs[_0x8e97('0x3b')](_0xfe53be[_0x8e97('0x39')][_0x8e97('0x3b')]));_0x183f92[_0x8e97('0x3a')]=_0x183f92[_0x8e97('0x3a')]['length']?_0x183f92[_0x8e97('0x3a')]:_0x1568ef[_0x8e97('0x35')];if(_0xfe53be[_0x8e97('0x39')][_0x8e97('0x46')]){_0x183f92['include']=[{'all':!![]}];}_0x183f92=_[_0x8e97('0x44')]({},_0x183f92,_0xfe53be['options']);return db['Disposition'][_0x8e97('0x4a')](_0x183f92)[_0x8e97('0x28')](handleEntityNotFound(_0x3ce21d,null))[_0x8e97('0x28')](respondWithResult(_0x3ce21d,null))[_0x8e97('0x47')](handleError(_0x3ce21d,null));};exports[_0x8e97('0x4b')]=function(_0x48cc94,_0x2d4243){return db[_0x8e97('0x31')][_0x8e97('0x4b')](_0x48cc94[_0x8e97('0x4c')],{})[_0x8e97('0x28')](function(_0x630cca){var _0x541d8e=_0x48cc94['user'][_0x8e97('0x29')]({'plain':!![]});if(!_0x541d8e)throw new Error(_0x8e97('0x4d'));if(_0x541d8e['role']===_0x8e97('0x4e')){var _0x48752d=_0x630cca[_0x8e97('0x29')]({'plain':!![]});var _0x519760='Dispositions';return db[_0x8e97('0x4f')][_0x8e97('0x4a')]({'where':{'name':_0x519760,'userProfileId':_0x541d8e[_0x8e97('0x50')]},'raw':!![]})[_0x8e97('0x28')](function(_0x1570cd){if(_0x1570cd&&_0x1570cd[_0x8e97('0x51')]===0x0){return db[_0x8e97('0x2b')][_0x8e97('0x4b')]({'name':_0x48752d[_0x8e97('0x2f')],'resourceId':_0x48752d['id'],'type':_0x1570cd['name'],'sectionId':_0x1570cd['id']},{})['then'](function(){return _0x630cca;});}else{return _0x630cca;}})[_0x8e97('0x47')](function(_0x38fbf3){logger[_0x8e97('0x2d')](_0x8e97('0x52'),_0x38fbf3);throw _0x38fbf3;});}return _0x630cca;})['then'](respondWithResult(_0x2d4243,0xc9))[_0x8e97('0x47')](handleError(_0x2d4243,null));};exports['update']=function(_0x4e9aba,_0x7bc01d){if(_0x4e9aba[_0x8e97('0x4c')]['id']){delete _0x4e9aba[_0x8e97('0x4c')]['id'];}return db[_0x8e97('0x31')]['find']({'where':{'id':_0x4e9aba[_0x8e97('0x49')]['id']}})['then'](handleEntityNotFound(_0x7bc01d,null))[_0x8e97('0x28')](saveUpdates(_0x4e9aba[_0x8e97('0x4c')],null))[_0x8e97('0x28')](respondWithResult(_0x7bc01d,null))[_0x8e97('0x47')](handleError(_0x7bc01d,null));};exports[_0x8e97('0x2c')]=function(_0x4b82dd,_0x21c076){return db['Disposition'][_0x8e97('0x4a')]({'where':{'id':_0x4b82dd[_0x8e97('0x49')]['id']}})['then'](handleEntityNotFound(_0x21c076,null))[_0x8e97('0x28')](removeEntity(_0x21c076,null))[_0x8e97('0x47')](handleError(_0x21c076,null));}; \ No newline at end of file +var _0xe03f=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','status','set','json','apply','reject','save','update','destroy','get','Dispositions','then','sendStatus','stack','name','send','index','Disposition','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0xdf39aa,_0x4301e1){var _0x454cd6=function(_0x3ea4db){while(--_0x3ea4db){_0xdf39aa['push'](_0xdf39aa['shift']());}};_0x454cd6(++_0x4301e1);}(_0xe03f,0xa3));var _0xfe03=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe03f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfe03('0x0'));var rimraf=require(_0xfe03('0x1'));var zipdir=require(_0xfe03('0x2'));var jsonpatch=require(_0xfe03('0x3'));var rp=require('request-promise');var moment=require(_0xfe03('0x4'));var BPromise=require(_0xfe03('0x5'));var Mustache=require(_0xfe03('0x6'));var util=require(_0xfe03('0x7'));var path=require(_0xfe03('0x8'));var sox=require(_0xfe03('0x9'));var csv=require('to-csv');var ejs=require(_0xfe03('0xa'));var fs=require('fs');var fs_extra=require(_0xfe03('0xb'));var _=require(_0xfe03('0xc'));var squel=require('squel');var crypto=require(_0xfe03('0xd'));var jsforce=require(_0xfe03('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfe03('0xf'));var querystring=require('querystring');var Papa=require(_0xfe03('0x10'));var Redis=require(_0xfe03('0x11'));var authService=require(_0xfe03('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfe03('0x13'));var hardwareService=require(_0xfe03('0x14'));var logger=require(_0xfe03('0x15'))(_0xfe03('0x16'));var utils=require(_0xfe03('0x17'));var config=require(_0xfe03('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe03('0x19'))['db'];function respondWithStatusCode(_0x292f95,_0x5ebdb2){_0x5ebdb2=_0x5ebdb2||0xcc;return function(_0x4382f8){if(_0x4382f8){return _0x292f95['sendStatus'](_0x5ebdb2);}return _0x292f95['status'](_0x5ebdb2)[_0xfe03('0x1a')]();};}function respondWithResult(_0x2f9440,_0x2c0934){_0x2c0934=_0x2c0934||0xc8;return function(_0x3227ac){if(_0x3227ac){return _0x2f9440['status'](_0x2c0934)['json'](_0x3227ac);}};}function respondWithFilteredResult(_0xd130ad,_0x4c8ab0){return function(_0x8e866f){if(_0x8e866f){var _0x1e41fa=typeof _0x4c8ab0[_0xfe03('0x1b')]===_0xfe03('0x1c')&&typeof _0x4c8ab0['limit']===_0xfe03('0x1c');var _0x1fae80=_0x8e866f['count'];var _0x460219=_0x1e41fa?0x0:_0x4c8ab0[_0xfe03('0x1b')];var _0x5707dd=_0x1e41fa?_0x8e866f[_0xfe03('0x1d')]:_0x4c8ab0[_0xfe03('0x1b')]+_0x4c8ab0[_0xfe03('0x1e')];var _0x3aafb2;if(_0x5707dd>=_0x1fae80){_0x5707dd=_0x1fae80;_0x3aafb2=0xc8;}else{_0x3aafb2=0xce;}_0xd130ad[_0xfe03('0x1f')](_0x3aafb2);return _0xd130ad[_0xfe03('0x20')]('Content-Range',_0x460219+'-'+_0x5707dd+'/'+_0x1fae80)[_0xfe03('0x21')](_0x8e866f);}return null;};}function patchUpdates(_0x21c13a){return function(_0x482311){try{jsonpatch[_0xfe03('0x22')](_0x482311,_0x21c13a,!![]);}catch(_0x5da24c){return BPromise[_0xfe03('0x23')](_0x5da24c);}return _0x482311[_0xfe03('0x24')]();};}function saveUpdates(_0x2e1aa0,_0x3d8579){return function(_0x15d9f6){if(_0x15d9f6){return _0x15d9f6[_0xfe03('0x25')](_0x2e1aa0)['then'](function(_0x2843c6){return _0x2843c6;});}return null;};}function removeEntity(_0x56c1fb,_0x511916){return function(_0x503cf7){if(_0x503cf7){return _0x503cf7[_0xfe03('0x26')]()['then'](function(){var _0x1345a1=_0x503cf7[_0xfe03('0x27')]({'plain':!![]});var _0x3d3330=_0xfe03('0x28');return db['UserProfileResource'][_0xfe03('0x26')]({'where':{'type':_0x3d3330,'resourceId':_0x1345a1['id']}})[_0xfe03('0x29')](function(){return _0x503cf7;});})[_0xfe03('0x29')](function(){_0x56c1fb[_0xfe03('0x1f')](0xcc)[_0xfe03('0x1a')]();});}};}function handleEntityNotFound(_0x4b4a60,_0x22394a){return function(_0x535f81){if(!_0x535f81){_0x4b4a60[_0xfe03('0x2a')](0x194);}return _0x535f81;};}function handleError(_0x2e928d,_0x44b4b3){_0x44b4b3=_0x44b4b3||0x1f4;return function(_0x194e61){logger['error'](_0x194e61[_0xfe03('0x2b')]);if(_0x194e61['name']){delete _0x194e61[_0xfe03('0x2c')];}_0x2e928d[_0xfe03('0x1f')](_0x44b4b3)[_0xfe03('0x2d')](_0x194e61);};}exports[_0xfe03('0x2e')]=function(_0x147fa6,_0x59e8e3){var _0x48fb0b={},_0x1ba891={},_0x1019f0={'count':0x0,'rows':[]};var _0x27603a=_['map'](db[_0xfe03('0x2f')]['rawAttributes'],function(_0x404f64){return{'name':_0x404f64[_0xfe03('0x30')],'type':_0x404f64[_0xfe03('0x31')][_0xfe03('0x32')]};});_0x1ba891['model']=_[_0xfe03('0x33')](_0x27603a,_0xfe03('0x2c'));_0x1ba891[_0xfe03('0x34')]=_[_0xfe03('0x35')](_0x147fa6[_0xfe03('0x34')]);_0x1ba891[_0xfe03('0x36')]=_[_0xfe03('0x37')](_0x1ba891['model'],_0x1ba891[_0xfe03('0x34')]);_0x48fb0b['attributes']=_['intersection'](_0x1ba891[_0xfe03('0x38')],qs[_0xfe03('0x39')](_0x147fa6['query']['fields']));_0x48fb0b[_0xfe03('0x3a')]=_0x48fb0b['attributes'][_0xfe03('0x3b')]?_0x48fb0b[_0xfe03('0x3a')]:_0x1ba891[_0xfe03('0x38')];if(!_0x147fa6[_0xfe03('0x34')][_0xfe03('0x3c')](_0xfe03('0x3d'))){_0x48fb0b[_0xfe03('0x1e')]=qs[_0xfe03('0x1e')](_0x147fa6[_0xfe03('0x34')][_0xfe03('0x1e')]);_0x48fb0b[_0xfe03('0x1b')]=qs[_0xfe03('0x1b')](_0x147fa6[_0xfe03('0x34')][_0xfe03('0x1b')]);}_0x48fb0b['order']=qs['sort'](_0x147fa6['query'][_0xfe03('0x3e')]);_0x48fb0b[_0xfe03('0x3f')]=qs[_0xfe03('0x36')](_[_0xfe03('0x40')](_0x147fa6[_0xfe03('0x34')],_0x1ba891['filters']),_0x27603a);if(_0x147fa6[_0xfe03('0x34')]['filter']){_0x48fb0b['where']=_['merge'](_0x48fb0b[_0xfe03('0x3f')],{'$or':_[_0xfe03('0x33')](_0x27603a,function(_0x4d8932){if(_0x4d8932[_0xfe03('0x31')]!=='VIRTUAL'){var _0x238532={};_0x238532[_0x4d8932[_0xfe03('0x2c')]]={'$like':'%'+_0x147fa6[_0xfe03('0x34')][_0xfe03('0x41')]+'%'};return _0x238532;}})});}_0x48fb0b=_[_0xfe03('0x42')]({},_0x48fb0b,_0x147fa6[_0xfe03('0x43')]);var _0x47d94d={'where':_0x48fb0b[_0xfe03('0x3f')]};return db['Disposition'][_0xfe03('0x1d')](_0x47d94d)[_0xfe03('0x29')](function(_0x1ee3af){_0x1019f0[_0xfe03('0x1d')]=_0x1ee3af;if(_0x147fa6[_0xfe03('0x34')][_0xfe03('0x44')]){_0x48fb0b[_0xfe03('0x45')]=[{'all':!![]}];}return db[_0xfe03('0x2f')][_0xfe03('0x46')](_0x48fb0b);})[_0xfe03('0x29')](function(_0x17cf03){_0x1019f0['rows']=_0x17cf03;return _0x1019f0;})[_0xfe03('0x29')](respondWithFilteredResult(_0x59e8e3,_0x48fb0b))[_0xfe03('0x47')](handleError(_0x59e8e3,null));};exports['show']=function(_0x13a211,_0x362a3c){var _0x24580d={'raw':!![],'where':{'id':_0x13a211[_0xfe03('0x48')]['id']}},_0x1710bc={};_0x1710bc[_0xfe03('0x38')]=_[_0xfe03('0x35')](db[_0xfe03('0x2f')][_0xfe03('0x49')]);_0x1710bc[_0xfe03('0x34')]=_[_0xfe03('0x35')](_0x13a211[_0xfe03('0x34')]);_0x1710bc['filters']=_[_0xfe03('0x37')](_0x1710bc['model'],_0x1710bc[_0xfe03('0x34')]);_0x24580d['attributes']=_[_0xfe03('0x37')](_0x1710bc['model'],qs[_0xfe03('0x39')](_0x13a211[_0xfe03('0x34')][_0xfe03('0x39')]));_0x24580d['attributes']=_0x24580d[_0xfe03('0x3a')][_0xfe03('0x3b')]?_0x24580d[_0xfe03('0x3a')]:_0x1710bc[_0xfe03('0x38')];if(_0x13a211['query'][_0xfe03('0x44')]){_0x24580d[_0xfe03('0x45')]=[{'all':!![]}];}_0x24580d=_[_0xfe03('0x42')]({},_0x24580d,_0x13a211[_0xfe03('0x43')]);return db[_0xfe03('0x2f')][_0xfe03('0x4a')](_0x24580d)[_0xfe03('0x29')](handleEntityNotFound(_0x362a3c,null))[_0xfe03('0x29')](respondWithResult(_0x362a3c,null))[_0xfe03('0x47')](handleError(_0x362a3c,null));};exports[_0xfe03('0x4b')]=function(_0x5b0755,_0x59fa8d){return db[_0xfe03('0x2f')][_0xfe03('0x4b')](_0x5b0755[_0xfe03('0x4c')],{})['then'](function(_0x115638){var _0x167587=_0x5b0755[_0xfe03('0x4d')][_0xfe03('0x27')]({'plain':!![]});if(!_0x167587)throw new Error(_0xfe03('0x4e'));if(_0x167587[_0xfe03('0x4f')]===_0xfe03('0x4d')){var _0x4d615b=_0x115638[_0xfe03('0x27')]({'plain':!![]});var _0x4631e2='Dispositions';return db[_0xfe03('0x50')][_0xfe03('0x4a')]({'where':{'name':_0x4631e2,'userProfileId':_0x167587[_0xfe03('0x51')]},'raw':!![]})[_0xfe03('0x29')](function(_0xfeb7af){if(_0xfeb7af&&_0xfeb7af['autoAssociation']===0x0){return db[_0xfe03('0x52')][_0xfe03('0x4b')]({'name':_0x4d615b[_0xfe03('0x2c')],'resourceId':_0x4d615b['id'],'type':_0xfeb7af[_0xfe03('0x2c')],'sectionId':_0xfeb7af['id']},{})[_0xfe03('0x29')](function(){return _0x115638;});}else{return _0x115638;}})['catch'](function(_0xa02a16){logger[_0xfe03('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa02a16);throw _0xa02a16;});}return _0x115638;})[_0xfe03('0x29')](respondWithResult(_0x59fa8d,0xc9))[_0xfe03('0x47')](handleError(_0x59fa8d,null));};exports[_0xfe03('0x25')]=function(_0x23e7df,_0x5b2069){if(_0x23e7df['body']['id']){delete _0x23e7df[_0xfe03('0x4c')]['id'];}return db['Disposition'][_0xfe03('0x4a')]({'where':{'id':_0x23e7df[_0xfe03('0x48')]['id']}})[_0xfe03('0x29')](handleEntityNotFound(_0x5b2069,null))[_0xfe03('0x29')](saveUpdates(_0x23e7df[_0xfe03('0x4c')],null))['then'](respondWithResult(_0x5b2069,null))[_0xfe03('0x47')](handleError(_0x5b2069,null));};exports[_0xfe03('0x26')]=function(_0x4455d0,_0x5ae386){return db[_0xfe03('0x2f')][_0xfe03('0x4a')]({'where':{'id':_0x4455d0[_0xfe03('0x48')]['id']}})[_0xfe03('0x29')](handleEntityNotFound(_0x5ae386,null))['then'](removeEntity(_0x5ae386,null))[_0xfe03('0x47')](handleError(_0x5ae386,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 99f6154..d941932 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 _0x00cc=['ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_openchannel','WhatsappAccountId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name'];(function(_0xc5ad2b,_0x5d7243){var _0x3587f4=function(_0x1293c4){while(--_0x1293c4){_0xc5ad2b['push'](_0xc5ad2b['shift']());}};_0x3587f4(++_0x5d7243);}(_0x00cc,0xa2));var _0xc00c=function(_0x448810,_0x258677){_0x448810=_0x448810-0x0;var _0x39a55c=_0x00cc[_0x448810];return _0x39a55c;};'use strict';var _=require(_0xc00c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc00c('0x1'));var moment=require(_0xc00c('0x2'));var BPromise=require(_0xc00c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc00c('0x4'));var rimraf=require(_0xc00c('0x5'));var config=require(_0xc00c('0x6'));var attributes=require(_0xc00c('0x7'));module[_0xc00c('0x8')]=function(_0x967ab2,_0xc2c2eb){return _0x967ab2[_0xc00c('0x9')](_0xc00c('0xa'),attributes,{'tableName':_0xc00c('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc00c('0xc'),'fields':[_0xc00c('0xd'),_0xc00c('0xe')]},{'unique':!![],'name':_0xc00c('0xf'),'fields':['name',_0xc00c('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0xc00c('0xd'),_0xc00c('0x11')]},{'unique':!![],'name':_0xc00c('0x12'),'fields':['name',_0xc00c('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0xc00c('0xd'),'FaxAccountId']},{'unique':!![],'name':_0xc00c('0x14'),'fields':[_0xc00c('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xc00c('0xd'),_0xc00c('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8716=['name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Disposition','name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x4a9148,_0x4a699e){var _0x27057a=function(_0xbbaad3){while(--_0xbbaad3){_0x4a9148['push'](_0x4a9148['shift']());}};_0x27057a(++_0x4a699e);}(_0x8716,0xb3));var _0x6871=function(_0x3ce02d,_0x2c487d){_0x3ce02d=_0x3ce02d-0x0;var _0x1591dd=_0x8716[_0x3ce02d];return _0x1591dd;};'use strict';var _=require(_0x6871('0x0'));var util=require(_0x6871('0x1'));var logger=require(_0x6871('0x2'))(_0x6871('0x3'));var moment=require(_0x6871('0x4'));var BPromise=require(_0x6871('0x5'));var rp=require(_0x6871('0x6'));var fs=require('fs');var path=require(_0x6871('0x7'));var rimraf=require('rimraf');var config=require(_0x6871('0x8'));var attributes=require('./disposition.attributes');module[_0x6871('0x9')]=function(_0x56613c,_0x3c70fb){return _0x56613c['define'](_0x6871('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x6871('0xb'),'fields':[_0x6871('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x6871('0xd'),'fields':[_0x6871('0xc'),_0x6871('0xe')]},{'unique':!![],'name':_0x6871('0xf'),'fields':['name',_0x6871('0x10')]},{'unique':!![],'name':_0x6871('0x11'),'fields':[_0x6871('0xc'),_0x6871('0x12')]},{'unique':!![],'name':_0x6871('0x13'),'fields':[_0x6871('0xc'),_0x6871('0x14')]},{'unique':!![],'name':_0x6871('0x15'),'fields':[_0x6871('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 21284bc..5bbdc8f 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(_0x3469b5,_0x292f51){var _0x1ee7c1=function(_0x2c3327){while(--_0x2c3327){_0x3469b5['push'](_0x3469b5['shift']());}};_0x1ee7c1(++_0x292f51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x3d8609,_0x24c6e4){var _0xcb8cb4=function(_0x38e186){while(--_0x38e186){_0x3d8609['push'](_0x3d8609['shift']());}};_0xcb8cb4(++_0x24c6e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 e7bc1cb..4bd7654 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 _0xbcec=['isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xbcec,0xe6));var _0xcbce=function(_0x5db570,_0x4116d3){_0x5db570=_0x5db570-0x0;var _0x4ee280=_0xbcec[_0x5db570];return _0x4ee280;};'use strict';var multer=require(_0xcbce('0x0'));var util=require(_0xcbce('0x1'));var path=require(_0xcbce('0x2'));var timeout=require(_0xcbce('0x3'));var express=require(_0xcbce('0x4'));var router=express['Router']();var fs_extra=require(_0xcbce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcbce('0x6'));var config=require(_0xcbce('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0xcbce('0x8')](),controller[_0xcbce('0x9')]);router['get'](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xb')]);router[_0xcbce('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xd')]);router[_0xcbce('0xe')](_0xcbce('0xa'),auth[_0xcbce('0x8')](),controller[_0xcbce('0xf')]);module[_0xcbce('0x10')]=router; \ No newline at end of file +var _0x5f14=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5f14,0x157));var _0x45f1=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x5f14[_0x2e8418];return _0x548fe6;};'use strict';var multer=require(_0x45f1('0x0'));var util=require(_0x45f1('0x1'));var path=require(_0x45f1('0x2'));var timeout=require(_0x45f1('0x3'));var express=require(_0x45f1('0x4'));var router=express[_0x45f1('0x5')]();var fs_extra=require(_0x45f1('0x6'));var auth=require(_0x45f1('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x45f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x45f1('0x9')]);router[_0x45f1('0x8')]('/:id',auth[_0x45f1('0xa')](),controller['show']);router[_0x45f1('0xb')]('/',auth[_0x45f1('0xa')](),controller[_0x45f1('0xc')]);router[_0x45f1('0xd')](_0x45f1('0xe'),auth[_0x45f1('0xa')](),controller[_0x45f1('0xf')]);router[_0x45f1('0x10')]('/:id',auth[_0x45f1('0xa')](),controller[_0x45f1('0x11')]);module[_0x45f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5cba472..bbd6288 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 _0x7b6f=['7200','12000','9600','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0xb6dab,_0x5bff55){var _0x1ec72d=function(_0x208140){while(--_0x208140){_0xb6dab['push'](_0xb6dab['shift']());}};_0x1ec72d(++_0x5bff55);}(_0x7b6f,0x1c3));var _0xf7b6=function(_0x2cfb2b,_0x30c0f1){_0x2cfb2b=_0x2cfb2b-0x0;var _0x403a5c=_0x7b6f[_0x2cfb2b];return _0x403a5c;};'use strict';var Sequelize=require(_0xf7b6('0x0'));module[_0xf7b6('0x1')]={'name':{'type':Sequelize[_0xf7b6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x4'),'no'),'defaultValue':_0xf7b6('0x4')},'headerinfo':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':_0xf7b6('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf7b6('0x6')},'minrate':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x7'),_0xf7b6('0x8'),_0xf7b6('0x9'),'9600',_0xf7b6('0xa'),'14400'),'defaultValue':_0xf7b6('0x8')},'maxrate':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0x7'),_0xf7b6('0x8'),_0xf7b6('0x9'),_0xf7b6('0xb'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf7b6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf7b6('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf7b6('0x3')](_0xf7b6('0xd'),'IAX',_0xf7b6('0xe'),_0xf7b6('0xf')),'defaultValue':_0xf7b6('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf7b6('0x10')],'defaultValue':function(){return _0xf7b6('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf7b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf7b6('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf7b6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf7b6('0x12')],'defaultValue':![],'comment':_0xf7b6('0x14'),'set':function(_0x3be316){if(!_0x3be316)this[_0xf7b6('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xf7b6('0x16'),_0x3be316);}}}; \ No newline at end of file +var _0xd760=['14400','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','2400','7200','12000'];(function(_0x4b1501,_0x3267b0){var _0x5f4dd4=function(_0x521e37){while(--_0x521e37){_0x4b1501['push'](_0x4b1501['shift']());}};_0x5f4dd4(++_0x3267b0);}(_0xd760,0x13f));var _0x0d76=function(_0x3d8881,_0x511400){_0x3d8881=_0x3d8881-0x0;var _0x30defb=_0xd760[_0x3d8881];return _0x30defb;};'use strict';var Sequelize=require(_0x0d76('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d76('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0d76('0x1')]},'ecm':{'type':Sequelize[_0x0d76('0x2')](_0x0d76('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x0d76('0x1')],'defaultValue':_0x0d76('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x0d76('0x5')},'minrate':{'type':Sequelize[_0x0d76('0x2')]('2400',_0x0d76('0x6'),'7200',_0x0d76('0x7'),'12000','14400'),'defaultValue':_0x0d76('0x6')},'maxrate':{'type':Sequelize[_0x0d76('0x2')](_0x0d76('0x8'),_0x0d76('0x6'),_0x0d76('0x9'),_0x0d76('0x7'),_0x0d76('0xa'),_0x0d76('0xb')),'defaultValue':_0x0d76('0xb')},'modem':{'type':Sequelize[_0x0d76('0x1')],'defaultValue':_0x0d76('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0d76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0d76('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0d76('0x2')](_0x0d76('0xe'),'IAX','DADHI',_0x0d76('0xf')),'defaultValue':_0x0d76('0xe')},'key':{'type':Sequelize[_0x0d76('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0d76('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0d76('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0d76('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0d76('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d76('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d76('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d76('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x0d76('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0d76('0x13'),'set':function(_0x19bb14){if(!_0x19bb14)this['setDataValue'](_0x0d76('0x14'),null);this[_0x0d76('0x15')]('mandatoryDisposition',_0x19bb14);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index deb6203..820f0cc 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 _0x24d3=['userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','hasOwnProperty','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','send','getApplications','context','exten','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','Contacts','defaults','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','spread','emit'];(function(_0x54b09e,_0x2355ad){var _0x3b757a=function(_0x17e173){while(--_0x17e173){_0x54b09e['push'](_0x54b09e['shift']());}};_0x3b757a(++_0x2355ad);}(_0x24d3,0x19a));var _0x324d=function(_0x2a4577,_0x499a65){_0x2a4577=_0x2a4577-0x0;var _0x43e520=_0x24d3[_0x2a4577];return _0x43e520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x324d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x324d('0x1'));var moment=require(_0x324d('0x2'));var BPromise=require(_0x324d('0x3'));var Mustache=require(_0x324d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x324d('0x5'));var csv=require(_0x324d('0x6'));var ejs=require(_0x324d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x324d('0x8'));var squel=require('squel');var crypto=require(_0x324d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x324d('0xa'));var toCsv=require(_0x324d('0x6'));var querystring=require('querystring');var Papa=require(_0x324d('0xb'));var Redis=require(_0x324d('0xc'));var authService=require(_0x324d('0xd'));var qs=require(_0x324d('0xe'));var as=require(_0x324d('0xf'));var hardwareService=require(_0x324d('0x10'));var logger=require(_0x324d('0x11'))(_0x324d('0x12'));var utils=require('../../config/utils');var config=require(_0x324d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x324d('0x14'))['db'];config[_0x324d('0x15')]=_['defaults'](config[_0x324d('0x15')],{'host':_0x324d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x324d('0x15')]));require(_0x324d('0x17'))[_0x324d('0x18')](socket);var jayson=require(_0x324d('0x19'));var client=jayson[_0x324d('0x1a')][_0x324d('0x1b')]({'port':0x232c});var client9002=jayson[_0x324d('0x1a')][_0x324d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x588d0a,_0x53d1e5,_0x255d2c,_0x47e799){return new BPromise(function(_0x4115d9,_0x29f1fb){var _0x3e0769=_0x47e799||client;return _0x3e0769[_0x324d('0x1c')](_0x588d0a,_0x255d2c)['then'](function(_0x138801){logger[_0x324d('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x53d1e5,_0x324d('0x1e'));logger[_0x324d('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53d1e5,'request\x20sent',JSON[_0x324d('0x20')](_0x138801));if(_0x138801[_0x324d('0x21')]){if(_0x138801[_0x324d('0x21')][_0x324d('0x22')]===0x1f4){logger[_0x324d('0x21')](_0x324d('0x23'),_0x53d1e5,_0x138801['error'][_0x324d('0x24')]);return _0x29f1fb(_0x138801['error'][_0x324d('0x24')]);}logger[_0x324d('0x21')](_0x324d('0x23'),_0x53d1e5,_0x138801[_0x324d('0x21')]['message']);return _0x4115d9(_0x138801[_0x324d('0x21')][_0x324d('0x24')]);}else{logger[_0x324d('0x1d')](_0x324d('0x23'),_0x53d1e5,_0x324d('0x1e'));_0x4115d9(_0x138801[_0x324d('0x25')][_0x324d('0x24')]);}})[_0x324d('0x26')](function(_0x64fc6f){logger[_0x324d('0x21')]('FaxAccount,\x20%s,\x20%s',_0x53d1e5,_0x64fc6f);_0x29f1fb(_0x64fc6f);});});}function respondWithStatusCode(_0x1826f1,_0x406b12){_0x406b12=_0x406b12||0xcc;return function(_0x286a2a){if(_0x286a2a){return _0x1826f1[_0x324d('0x27')](_0x406b12);}return _0x1826f1[_0x324d('0x28')](_0x406b12)[_0x324d('0x29')]();};}function respondWithResult(_0x30ed1f,_0x10ac3b){_0x10ac3b=_0x10ac3b||0xc8;return function(_0x5e440d){if(_0x5e440d){return _0x30ed1f[_0x324d('0x28')](_0x10ac3b)['json'](_0x5e440d);}};}function respondWithFilteredResult(_0xe774b,_0x4fc2aa){return function(_0x3b8d39){if(_0x3b8d39){var _0x2858bb=typeof _0x4fc2aa['offset']===_0x324d('0x2a')&&typeof _0x4fc2aa[_0x324d('0x2b')]===_0x324d('0x2a');var _0x578913=_0x3b8d39['count'];var _0x407134=_0x2858bb?0x0:_0x4fc2aa['offset'];var _0x3b1978=_0x2858bb?_0x3b8d39['count']:_0x4fc2aa[_0x324d('0x2c')]+_0x4fc2aa[_0x324d('0x2b')];var _0x4d35c5;if(_0x3b1978>=_0x578913){_0x3b1978=_0x578913;_0x4d35c5=0xc8;}else{_0x4d35c5=0xce;}_0xe774b[_0x324d('0x28')](_0x4d35c5);return _0xe774b[_0x324d('0x2d')](_0x324d('0x2e'),_0x407134+'-'+_0x3b1978+'/'+_0x578913)[_0x324d('0x2f')](_0x3b8d39);}return null;};}function patchUpdates(_0x28dc22){return function(_0x122663){try{jsonpatch[_0x324d('0x30')](_0x122663,_0x28dc22,!![]);}catch(_0x462216){return BPromise[_0x324d('0x31')](_0x462216);}return _0x122663['save']();};}function saveUpdates(_0x3d0793,_0x4f9de0){return function(_0x5ae313){if(_0x5ae313){return _0x5ae313[_0x324d('0x32')](_0x3d0793)[_0x324d('0x33')](function(_0xf3d141){return _0xf3d141;});}return null;};}function removeEntity(_0x5ec48a,_0x2b50b3){return function(_0x22ec90){if(_0x22ec90){return _0x22ec90[_0x324d('0x34')]()['then'](function(){var _0xffadd1=_0x22ec90[_0x324d('0x35')]({'plain':!![]});var _0x26a1fe=_0x324d('0x36');return db[_0x324d('0x37')][_0x324d('0x34')]({'where':{'type':_0x26a1fe,'resourceId':_0xffadd1['id']}})['then'](function(){return _0x22ec90;});})[_0x324d('0x33')](function(){_0x5ec48a[_0x324d('0x28')](0xcc)[_0x324d('0x29')]();});}};}function handleEntityNotFound(_0x50a84a,_0x4146f2){return function(_0x4667fb){if(!_0x4667fb){_0x50a84a[_0x324d('0x27')](0x194);}return _0x4667fb;};}function handleError(_0x489201,_0x3ee61e){_0x3ee61e=_0x3ee61e||0x1f4;return function(_0x34f9a8){logger[_0x324d('0x21')](_0x34f9a8[_0x324d('0x38')]);if(_0x34f9a8[_0x324d('0x39')]){delete _0x34f9a8[_0x324d('0x39')];}_0x489201['status'](_0x3ee61e)['send'](_0x34f9a8);};}exports[_0x324d('0x3a')]=function(_0x153f46,_0x5373ad){var _0x3c5645={'include':[{'model':db[_0x324d('0x3b')],'as':_0x324d('0x3c')}]},_0x4023f3={},_0x18820f={'count':0x0,'rows':[]};var _0x33621c=_[_0x324d('0x3d')](db[_0x324d('0x3e')][_0x324d('0x3f')],function(_0x5bded2){return{'name':_0x5bded2[_0x324d('0x40')],'type':_0x5bded2[_0x324d('0x41')][_0x324d('0x42')]};});_0x4023f3[_0x324d('0x43')]=_[_0x324d('0x3d')](_0x33621c,_0x324d('0x39'));_0x4023f3[_0x324d('0x44')]=_['keys'](_0x153f46[_0x324d('0x44')]);_0x4023f3['filters']=_[_0x324d('0x45')](_0x4023f3[_0x324d('0x43')],_0x4023f3[_0x324d('0x44')]);_0x3c5645['attributes']=_[_0x324d('0x45')](_0x4023f3[_0x324d('0x43')],qs[_0x324d('0x46')](_0x153f46[_0x324d('0x44')]['fields']));_0x3c5645['attributes']=_0x3c5645[_0x324d('0x47')][_0x324d('0x48')]?_0x3c5645['attributes']:_0x4023f3[_0x324d('0x43')];if(!_0x153f46[_0x324d('0x44')]['hasOwnProperty'](_0x324d('0x49'))){_0x3c5645[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x153f46[_0x324d('0x44')]['limit']);_0x3c5645['offset']=qs[_0x324d('0x2c')](_0x153f46[_0x324d('0x44')][_0x324d('0x2c')]);}_0x3c5645[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0x153f46[_0x324d('0x44')][_0x324d('0x4b')]);_0x3c5645[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x153f46[_0x324d('0x44')],_0x4023f3['filters']),_0x33621c);if(_0x153f46[_0x324d('0x44')]['filter']){_0x3c5645[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x3c5645[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x33621c,function(_0x10018f){if(_0x10018f[_0x324d('0x41')]!==_0x324d('0x50')){var _0x21b087={};_0x21b087[_0x10018f['name']]={'$like':'%'+_0x153f46[_0x324d('0x44')]['filter']+'%'};return _0x21b087;}})});}_0x3c5645=_[_0x324d('0x4f')]({},_0x3c5645,_0x153f46[_0x324d('0x51')]);var _0x4f8d80={'where':_0x3c5645[_0x324d('0x4c')]};return db[_0x324d('0x3e')][_0x324d('0x52')](_0x4f8d80)[_0x324d('0x33')](function(_0x51ae7a){_0x18820f['count']=_0x51ae7a;if(_0x153f46['query'][_0x324d('0x53')]){_0x3c5645[_0x324d('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x324d('0x55')](_0x3c5645);})[_0x324d('0x33')](function(_0x145dec){_0x18820f[_0x324d('0x56')]=_0x145dec;return _0x18820f;})[_0x324d('0x33')](respondWithFilteredResult(_0x5373ad,_0x3c5645))[_0x324d('0x26')](handleError(_0x5373ad,null));};exports[_0x324d('0x57')]=function(_0x1b40a2,_0x1dda00){var _0x5e0105={'raw':![],'where':{'id':_0x1b40a2[_0x324d('0x58')]['id']},'include':[{'model':db[_0x324d('0x3b')],'as':'mandatoryDispositionPause'}]},_0x15cb6c={};_0x15cb6c[_0x324d('0x43')]=_['keys'](db[_0x324d('0x3e')][_0x324d('0x3f')]);_0x15cb6c[_0x324d('0x44')]=_[_0x324d('0x59')](_0x1b40a2[_0x324d('0x44')]);_0x15cb6c[_0x324d('0x4d')]=_['intersection'](_0x15cb6c[_0x324d('0x43')],_0x15cb6c[_0x324d('0x44')]);_0x5e0105[_0x324d('0x47')]=_[_0x324d('0x45')](_0x15cb6c[_0x324d('0x43')],qs[_0x324d('0x46')](_0x1b40a2[_0x324d('0x44')][_0x324d('0x46')]));_0x5e0105[_0x324d('0x47')]=_0x5e0105['attributes'][_0x324d('0x48')]?_0x5e0105[_0x324d('0x47')]:_0x15cb6c['model'];if(_0x1b40a2[_0x324d('0x44')][_0x324d('0x53')]){_0x5e0105[_0x324d('0x54')]=[{'all':!![]}];}_0x5e0105=_[_0x324d('0x4f')]({},_0x5e0105,_0x1b40a2[_0x324d('0x51')]);return db[_0x324d('0x3e')]['find'](_0x5e0105)[_0x324d('0x33')](handleEntityNotFound(_0x1dda00,null))[_0x324d('0x33')](respondWithResult(_0x1dda00,null))[_0x324d('0x26')](handleError(_0x1dda00,null));};exports[_0x324d('0x5a')]=function(_0x57d45a,_0x427ec3){return db[_0x324d('0x3e')][_0x324d('0x5a')](_0x57d45a[_0x324d('0x5b')],{})[_0x324d('0x33')](function(_0x2350d7){var _0x3e46f0=_0x57d45a[_0x324d('0x5c')][_0x324d('0x35')]({'plain':!![]});if(!_0x3e46f0)throw new Error(_0x324d('0x5d'));if(_0x3e46f0[_0x324d('0x5e')]===_0x324d('0x5c')){var _0x302cac=_0x2350d7[_0x324d('0x35')]({'plain':!![]});var _0x28e62c=_0x324d('0x36');return db[_0x324d('0x5f')][_0x324d('0x60')]({'where':{'name':_0x28e62c,'userProfileId':_0x3e46f0['userProfileId']},'raw':!![]})[_0x324d('0x33')](function(_0x5ea493){if(_0x5ea493&&_0x5ea493[_0x324d('0x61')]===0x0){return db[_0x324d('0x37')][_0x324d('0x5a')]({'name':_0x302cac['name'],'resourceId':_0x302cac['id'],'type':_0x5ea493[_0x324d('0x39')],'sectionId':_0x5ea493['id']},{})['then'](function(){return _0x2350d7;});}else{return _0x2350d7;}})[_0x324d('0x26')](function(_0x542385){logger[_0x324d('0x21')](_0x324d('0x62'),_0x542385);throw _0x542385;});}return _0x2350d7;})[_0x324d('0x33')](respondWithResult(_0x427ec3,0xc9))[_0x324d('0x26')](handleError(_0x427ec3,null));};exports[_0x324d('0x32')]=function(_0x30c7c4,_0x56f9b4){if(_0x30c7c4[_0x324d('0x5b')]['id']){delete _0x30c7c4[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x30c7c4['params']['id']},'include':[{'model':db['Pause'],'as':_0x324d('0x3c')}]})['then'](handleEntityNotFound(_0x56f9b4,null))[_0x324d('0x33')](saveUpdates(_0x30c7c4[_0x324d('0x5b')],null))[_0x324d('0x33')](respondWithResult(_0x56f9b4,null))[_0x324d('0x26')](handleError(_0x56f9b4,null));};exports[_0x324d('0x34')]=function(_0x3b2eea,_0x2b3121){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x3b2eea['params']['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x2b3121,null))['then'](removeEntity(_0x2b3121,null))[_0x324d('0x26')](handleError(_0x2b3121,null));};exports[_0x324d('0x63')]=function(_0x252154,_0xba319e){return db['FaxAccount']['describe']()[_0x324d('0x33')](respondWithResult(_0xba319e,null))[_0x324d('0x26')](handleError(_0xba319e,null));};exports[_0x324d('0x64')]=function(_0x41c7d6,_0xfe6dfc,_0x2cf07d){if(_0x41c7d6[_0x324d('0x5b')]['id']){delete _0x41c7d6[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')]['find']({'where':{'id':_0x41c7d6[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0xfe6dfc,null))[_0x324d('0x33')](function(_0x427ebc){if(_0x427ebc){_0x41c7d6['body'][_0x324d('0x65')]=_0x427ebc['id'];return db[_0x324d('0x66')][_0x324d('0x5a')](_0x41c7d6[_0x324d('0x5b')]);}})[_0x324d('0x33')](respondWithResult(_0xfe6dfc,null))[_0x324d('0x26')](handleError(_0xfe6dfc,null));};exports['getDispositions']=function(_0xcd8a92,_0x33a4dc,_0x3518ab){var _0x948e76={'raw':![],'where':{}};var _0x33906d={};var _0x40e118={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0xcd8a92[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x33a4dc,null))[_0x324d('0x33')](function(_0x57ec15){if(_0x57ec15){_0x33906d[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x66')][_0x324d('0x3f')]);_0x33906d[_0x324d('0x44')]=_[_0x324d('0x59')](_0xcd8a92['query']);_0x33906d[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x33906d[_0x324d('0x43')],_0x33906d['query']);_0x948e76[_0x324d('0x47')]=_[_0x324d('0x45')](_0x33906d[_0x324d('0x43')],qs[_0x324d('0x46')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x46')]));_0x948e76['attributes']=_0x948e76['attributes'][_0x324d('0x48')]?_0x948e76[_0x324d('0x47')]:_0x33906d[_0x324d('0x43')];if(!_0xcd8a92[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x948e76[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x2b')]);_0x948e76[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0xcd8a92[_0x324d('0x44')][_0x324d('0x2c')]);}_0x948e76['order']=qs['sort'](_0xcd8a92[_0x324d('0x44')][_0x324d('0x4b')]);_0x948e76['where']=qs[_0x324d('0x4d')](_['pick'](_0xcd8a92['query'],_0x33906d[_0x324d('0x4d')]));_0x948e76['where'][_0x324d('0x65')]=_0x57ec15['id'];if(_0xcd8a92[_0x324d('0x44')][_0x324d('0x69')]){_0x948e76[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x948e76[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x948e76[_0x324d('0x47')],function(_0x866e57){var _0x3ccbc8={};_0x3ccbc8[_0x866e57]={'$like':'%'+_0xcd8a92[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x3ccbc8;})});}_0x948e76=_['merge']({},_0x948e76,_0xcd8a92[_0x324d('0x51')]);return db[_0x324d('0x66')][_0x324d('0x52')]({'where':_0x948e76['where']})[_0x324d('0x33')](function(_0x294b97){_0x40e118['count']=_0x294b97;if(_0xcd8a92[_0x324d('0x44')][_0x324d('0x53')]){_0x948e76[_0x324d('0x54')]=[{'all':!![]}];}return db[_0x324d('0x66')]['findAll'](_0x948e76);})[_0x324d('0x33')](function(_0xf1acaa){_0x40e118[_0x324d('0x56')]=_0xf1acaa;return _0x40e118;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x33a4dc,_0x948e76))['catch'](handleError(_0x33a4dc,null));};exports[_0x324d('0x6a')]=function(_0x31e9d1,_0x10ab38,_0x15b5f6){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x31e9d1[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x10ab38,null))[_0x324d('0x33')](function(_0x4dbcd0){if(_0x4dbcd0){return _0x4dbcd0[_0x324d('0x6a')](_0x31e9d1[_0x324d('0x44')][_0x324d('0x6b')]);}})[_0x324d('0x33')](respondWithStatusCode(_0x10ab38,null))[_0x324d('0x26')](handleError(_0x10ab38,null));};exports[_0x324d('0x6c')]=function(_0x2b3fa6,_0x17438f,_0x37d4c){if(_0x2b3fa6[_0x324d('0x5b')]['id']){delete _0x2b3fa6[_0x324d('0x5b')]['id'];}return db[_0x324d('0x3e')]['find']({'where':{'id':_0x2b3fa6[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x17438f,null))[_0x324d('0x33')](function(_0x2cf359){if(_0x2cf359){_0x2b3fa6[_0x324d('0x5b')]['FaxAccountId']=_0x2cf359['id'];return db[_0x324d('0x6d')][_0x324d('0x5a')](_0x2b3fa6[_0x324d('0x5b')]);}})[_0x324d('0x33')](respondWithResult(_0x17438f,null))['catch'](handleError(_0x17438f,null));};exports[_0x324d('0x6e')]=function(_0x1cf620,_0x2fdfef,_0x53b199){var _0x3341f0={'raw':![],'where':{}};var _0x51f813={};var _0x2d2189={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x1cf620['params']['id']}})['then'](handleEntityNotFound(_0x2fdfef,null))[_0x324d('0x33')](function(_0x4fb82e){if(_0x4fb82e){_0x51f813[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x6d')]['rawAttributes']);_0x51f813[_0x324d('0x44')]=_[_0x324d('0x59')](_0x1cf620['query']);_0x51f813[_0x324d('0x4d')]=_['intersection'](_0x51f813[_0x324d('0x43')],_0x51f813[_0x324d('0x44')]);_0x3341f0[_0x324d('0x47')]=_[_0x324d('0x45')](_0x51f813[_0x324d('0x43')],qs['fields'](_0x1cf620[_0x324d('0x44')][_0x324d('0x46')]));_0x3341f0[_0x324d('0x47')]=_0x3341f0[_0x324d('0x47')][_0x324d('0x48')]?_0x3341f0[_0x324d('0x47')]:_0x51f813[_0x324d('0x43')];if(!_0x1cf620[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x3341f0[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x1cf620[_0x324d('0x44')]['limit']);_0x3341f0[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x1cf620[_0x324d('0x44')][_0x324d('0x2c')]);}_0x3341f0['order']=qs[_0x324d('0x4b')](_0x1cf620[_0x324d('0x44')][_0x324d('0x4b')]);_0x3341f0[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0x1cf620['query'],_0x51f813[_0x324d('0x4d')]));_0x3341f0[_0x324d('0x4c')]['FaxAccountId']=_0x4fb82e['id'];if(_0x1cf620[_0x324d('0x44')][_0x324d('0x69')]){_0x3341f0['where']=_[_0x324d('0x4f')](_0x3341f0[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x3341f0['attributes'],function(_0x40fba0){var _0x57881a={};_0x57881a[_0x40fba0]={'$like':'%'+_0x1cf620[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x57881a;})});}_0x3341f0=_[_0x324d('0x4f')]({},_0x3341f0,_0x1cf620[_0x324d('0x51')]);return db[_0x324d('0x6d')][_0x324d('0x52')]({'where':_0x3341f0[_0x324d('0x4c')]})[_0x324d('0x33')](function(_0x46218e){_0x2d2189[_0x324d('0x52')]=_0x46218e;if(_0x1cf620['query'][_0x324d('0x53')]){_0x3341f0[_0x324d('0x54')]=[{'all':!![]}];}return db[_0x324d('0x6d')][_0x324d('0x55')](_0x3341f0);})[_0x324d('0x33')](function(_0x433e95){_0x2d2189[_0x324d('0x56')]=_0x433e95;return _0x2d2189;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x2fdfef,_0x3341f0))[_0x324d('0x26')](handleError(_0x2fdfef,null));};exports['removeAnswers']=function(_0x508cd2,_0x203cdc,_0x45ce08){return db['FaxAccount']['find']({'where':{'id':_0x508cd2[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x203cdc,null))[_0x324d('0x33')](function(_0x2c2c86){if(_0x2c2c86){return _0x2c2c86[_0x324d('0x6f')](_0x508cd2[_0x324d('0x44')][_0x324d('0x6b')]);}})['then'](respondWithStatusCode(_0x203cdc,null))[_0x324d('0x26')](handleError(_0x203cdc,null));};exports[_0x324d('0x70')]=function(_0xb04174,_0x4924cd,_0x49cc1f){return db[_0x324d('0x71')][_0x324d('0x60')]({'where':{'id':_0xb04174[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x4924cd,null))[_0x324d('0x33')](function(_0xa5d619){if(_0xa5d619){return _0xa5d619['addInteraction'](_0xb04174['body'][_0x324d('0x6b')],_['omit'](_0xb04174['body'],[_0x324d('0x6b'),'id'])||{});}})[_0x324d('0x33')](respondWithResult(_0x4924cd,null))[_0x324d('0x26')](handleError(_0x4924cd,null));};exports[_0x324d('0x72')]=function(_0x2979de,_0x59c209,_0x4a62eb){var _0x214b1f={'raw':![],'where':{}};var _0x32efd7={};var _0x5dc79e={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x2979de[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x59c209,null))[_0x324d('0x33')](function(_0x4214ec){if(_0x4214ec){_0x32efd7[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x71')][_0x324d('0x3f')]);_0x32efd7[_0x324d('0x44')]=_[_0x324d('0x59')](_0x2979de[_0x324d('0x44')]);_0x32efd7['filters']=_[_0x324d('0x45')](_0x32efd7[_0x324d('0x43')],_0x32efd7[_0x324d('0x44')]);_0x214b1f[_0x324d('0x47')]=_[_0x324d('0x45')](_0x32efd7[_0x324d('0x43')],qs['fields'](_0x2979de['query'][_0x324d('0x46')]));_0x214b1f[_0x324d('0x47')]=_0x214b1f[_0x324d('0x47')][_0x324d('0x48')]?_0x214b1f['attributes']:_0x32efd7[_0x324d('0x43')];if(!_0x2979de[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x214b1f['limit']=qs[_0x324d('0x2b')](_0x2979de['query']['limit']);_0x214b1f[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x2979de[_0x324d('0x44')][_0x324d('0x2c')]);}_0x214b1f['order']=qs[_0x324d('0x4b')](_0x2979de[_0x324d('0x44')]['sort']);_0x214b1f[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0x2979de[_0x324d('0x44')],_0x32efd7[_0x324d('0x4d')]));_0x214b1f[_0x324d('0x4c')][_0x324d('0x65')]=_0x4214ec['id'];if(_0x2979de['query'][_0x324d('0x69')]){_0x214b1f[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x214b1f[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x214b1f[_0x324d('0x47')],function(_0x419cfc){var _0xab0d32={};_0xab0d32[_0x419cfc]={'$like':'%'+_0x2979de[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0xab0d32;})});}_0x214b1f=_[_0x324d('0x4f')]({},_0x214b1f,_0x2979de[_0x324d('0x51')]);return db['FaxInteraction'][_0x324d('0x52')]({'where':_0x214b1f[_0x324d('0x4c')]})[_0x324d('0x33')](function(_0x15f61d){_0x5dc79e['count']=_0x15f61d;if(_0x2979de[_0x324d('0x44')][_0x324d('0x53')]){_0x214b1f[_0x324d('0x54')]=[{'model':db['CmContact'],'as':_0x324d('0x73'),'required':![]},{'model':db[_0x324d('0x74')],'as':_0x324d('0x75'),'attributes':[_0x324d('0x39'),_0x324d('0x76'),'internal'],'required':![]},{'model':db[_0x324d('0x77')],'as':_0x324d('0x78'),'attributes':['id',_0x324d('0x39'),_0x324d('0x79')],'where':_0x2979de[_0x324d('0x44')][_0x324d('0x7a')]?{'id':_0x2979de[_0x324d('0x44')][_0x324d('0x7a')]}:undefined,'required':_0x2979de['query'][_0x324d('0x7a')]?!![]:![]}];}return db[_0x324d('0x71')][_0x324d('0x55')](_0x214b1f);})['then'](function(_0x3d8c76){_0x5dc79e[_0x324d('0x56')]=_0x3d8c76;return _0x5dc79e;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x59c209,_0x214b1f))[_0x324d('0x26')](handleError(_0x59c209,null));};exports[_0x324d('0x7b')]=function(_0x285fac,_0x2bbf5d){var _0x79bff=_0x285fac[_0x324d('0x58')]['id'];var _0x18da96=_0x285fac[_0x324d('0x5b')];var _0x3d6214=0xc8;var _0x393ef0=null;return db[_0x324d('0x7c')][_0x324d('0x7d')]({'isolationLevel':db[_0x324d('0x7c')][_0x324d('0x7e')][_0x324d('0x7f')][_0x324d('0x80')]},function(_0x24fa05){return db['FaxAccount']['findOne']({'where':{'id':_0x79bff},'transaction':_0x24fa05})[_0x324d('0x33')](function(_0x5b7d1c){if(_0x5b7d1c){return db[_0x324d('0x81')][_0x324d('0x34')]({'where':{'FaxAccountId':_0x79bff},'transaction':_0x24fa05})[_0x324d('0x33')](function(){var _0x280ef6=_['map'](_0x18da96,function(_0x3519c9){_0x3519c9['FaxAccountId']=_0x79bff;return _0x3519c9;});return db[_0x324d('0x81')][_0x324d('0x82')](_0x280ef6,{'transaction':_0x24fa05});});}else{_0x3d6214=0x194;_0x393ef0=[];}});})['then'](function(){if(_0x3d6214!==0x194){return db[_0x324d('0x81')][_0x324d('0x83')]({'where':{'FaxAccountId':_0x79bff},'order':'priority'})[_0x324d('0x33')](function(_0x326320){_0x393ef0=_0x326320;});}})[_0x324d('0x26')](function(_0x45f854){_0x3d6214=0x1f4;logger['error'](_0x45f854[_0x324d('0x38')]);if(_0x45f854[_0x324d('0x39')]){delete _0x45f854['name'];}_0x393ef0=_0x45f854;})['finally'](function(){if(_0x393ef0===null){_0x2bbf5d['sendStatus'](_0x3d6214);}else{if(_0x3d6214===0x1f4){_0x2bbf5d[_0x324d('0x28')](_0x3d6214)[_0x324d('0x84')](_0x393ef0);}else{_0x2bbf5d['status'](_0x3d6214)[_0x324d('0x2f')](_0x393ef0);}}});};exports[_0x324d('0x85')]=function(_0x2c2593,_0x52f2d4,_0x4f53ff){var _0x54fce1={};var _0x5b7d18={};var _0x2a2791;var _0x4a71d6;return db['FaxAccount']['findOne']({'where':{'id':_0x2c2593[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x52f2d4,null))[_0x324d('0x33')](function(_0x5e6575){if(_0x5e6575){_0x2a2791=_0x5e6575;_0x5b7d18[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x81')][_0x324d('0x3f')]);_0x5b7d18['query']=_['keys'](_0x2c2593['query']);_0x5b7d18['filters']=_[_0x324d('0x45')](_0x5b7d18['model'],_0x5b7d18['query']);_0x54fce1[_0x324d('0x47')]=_['intersection'](_0x5b7d18[_0x324d('0x43')],qs[_0x324d('0x46')](_0x2c2593['query'][_0x324d('0x46')]));_0x54fce1[_0x324d('0x47')]=_0x54fce1['attributes'][_0x324d('0x48')]?_0x54fce1[_0x324d('0x47')]:_0x5b7d18[_0x324d('0x43')];_0x54fce1['order']=qs['sort'](_0x2c2593[_0x324d('0x44')][_0x324d('0x4b')]);_0x54fce1['where']=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x2c2593[_0x324d('0x44')],_0x5b7d18[_0x324d('0x4d')]));if(_0x2c2593[_0x324d('0x44')][_0x324d('0x69')]){_0x54fce1['where']=_[_0x324d('0x4f')](_0x54fce1[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x54fce1[_0x324d('0x47')],function(_0x1642ca){var _0x5d6543={};_0x5d6543[_0x1642ca]={'$like':'%'+_0x2c2593[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x5d6543;})});}_0x54fce1=_[_0x324d('0x4f')]({},_0x54fce1,_0x2c2593[_0x324d('0x51')]);return _0x2a2791[_0x324d('0x85')](_0x54fce1);}})[_0x324d('0x33')](function(_0x2842af){if(_0x2842af){_0x4a71d6=_0x2842af[_0x324d('0x48')];if(!_0x2c2593['query']['hasOwnProperty'](_0x324d('0x49'))){_0x54fce1[_0x324d('0x2b')]=qs['limit'](_0x2c2593[_0x324d('0x44')][_0x324d('0x2b')]);_0x54fce1[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x2c2593[_0x324d('0x44')][_0x324d('0x2c')]);}return _0x2a2791[_0x324d('0x85')](_0x54fce1);}})[_0x324d('0x33')](function(_0x34b99e){if(_0x34b99e){return _0x34b99e?{'count':_0x4a71d6,'rows':_0x34b99e}:null;}})[_0x324d('0x33')](respondWithResult(_0x52f2d4,null))[_0x324d('0x26')](handleError(_0x52f2d4,null));};function Extension(_0x59dd0f,_0x15af6e,_0x14140b,_0xfdc29b){this[_0x324d('0x86')]='from-voip-provider';this[_0x324d('0x87')]=_0x59dd0f['localstationid'];this[_0x324d('0x88')]=_0xfdc29b;this[_0x324d('0x41')]=_0x324d('0x89');this[_0x324d('0x8a')]=_0x324d('0x8b');this[_0x324d('0x65')]=_0x59dd0f['id'];this[_0x324d('0x8c')]=_0x15af6e;this[_0x324d('0x8d')]=_0x14140b;}function createExtensionsReciveFax(_0x29b56c){var _0x33013e=0x1;var _0x1404fb=[];_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,'',_0x324d('0x8f')));_0x33013e+=0x1;_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,_0x324d('0x90'),_0x324d('0x91')));_0x33013e+=0x1;for(var _0x571bf1 in _0x29b56c){if(_0x29b56c[_0x324d('0x68')](_0x571bf1)&&(_0x571bf1===_0x324d('0x92')||_0x571bf1===_0x324d('0x93')||_0x571bf1===_0x324d('0x94')||_0x571bf1===_0x324d('0x95')||_0x571bf1===_0x324d('0x96')||_0x571bf1===_0x324d('0x97')||_0x571bf1===_0x324d('0x98')||_0x571bf1==='modem'||_0x571bf1===_0x324d('0x99'))){_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,_0x324d('0x9a')+_0x571bf1+')='+_0x29b56c[_0x571bf1],_0x324d('0x91')));_0x33013e+=0x1;}}_0x1404fb['push'](new Extension(_0x29b56c,_0x33013e,'6','Wait'));_0x33013e+=0x1;_0x1404fb[_0x324d('0x8e')](new Extension(_0x29b56c,_0x33013e,'/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',_0x324d('0x9b')));_0x33013e=0x0;return _0x1404fb;}exports[_0x324d('0x9c')]=function(_0x1f6887,_0x44ebf6,_0x4863d1){var _0x2b1ed7;return db[_0x324d('0x7c')][_0x324d('0x7d')](function(_0x2fee39){return db[_0x324d('0x3e')][_0x324d('0x5a')](_0x1f6887['body'],{'transaction':_0x2fee39})['then'](function(_0x566309){_0x2b1ed7=_0x566309[_0x324d('0x35')]({'plain':!![]});return db[_0x324d('0x9d')][_0x324d('0x82')](createExtensionsReciveFax(_0x2b1ed7),{'transaction':_0x2fee39});});})[_0x324d('0x33')](function(){return _0x2b1ed7;})[_0x324d('0x33')](respondWithResult(_0x44ebf6,null))[_0x324d('0x26')](handleError(_0x44ebf6,null));};exports[_0x324d('0x9e')]=function(_0x30b980,_0x244a9b,_0x1e71d8){var _0x12e52c;return db['sequelize']['transaction'](function(_0x289093){return db[_0x324d('0x3e')][_0x324d('0x32')](_0x30b980[_0x324d('0x5b')],{'where':{'id':_0x30b980[_0x324d('0x5b')]['id']},'transaction':_0x289093})['then'](function(_0xfa11fa){return db[_0x324d('0x9d')][_0x324d('0x34')]({'where':{'FaxAccountId':_0x30b980[_0x324d('0x5b')]['id']},'transaction':_0x289093})['then'](function(_0x266e9b){return db['VoiceExtension'][_0x324d('0x82')](createExtensionsReciveFax(_['omit'](_0x30b980[_0x324d('0x5b')],[_0x324d('0x9f'),'key',_0x324d('0xa0'),_0x324d('0xa1'),_0x324d('0xa2'),'ListId'])),{'transaction':_0x289093});});});})[_0x324d('0x33')](function(){return db[_0x324d('0x3e')][_0x324d('0xa3')](_0x30b980['body']['id']);})[_0x324d('0x33')](respondWithResult(_0x244a9b,null))[_0x324d('0x26')](handleError(_0x244a9b,null));};exports[_0x324d('0xa4')]=function(_0x5f53cb,_0x1233eb,_0x3de4f1){var _0x4b2f8b={'raw':!![],'where':{}};var _0x1431ed={};var _0x4fca70={'count':0x0,'rows':[]};return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0x5f53cb[_0x324d('0x58')]['id']}})['then'](handleEntityNotFound(_0x1233eb,null))[_0x324d('0x33')](function(_0x222a0f){if(_0x222a0f){_0x1431ed['model']=_[_0x324d('0x59')](db[_0x324d('0xa5')][_0x324d('0x3f')]);_0x1431ed[_0x324d('0x44')]=_[_0x324d('0x59')](_0x5f53cb['query']);_0x1431ed[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x1431ed[_0x324d('0x43')],_0x1431ed[_0x324d('0x44')]);_0x4b2f8b[_0x324d('0x47')]=_[_0x324d('0x45')](_0x1431ed[_0x324d('0x43')],qs['fields'](_0x5f53cb[_0x324d('0x44')][_0x324d('0x46')]));_0x4b2f8b[_0x324d('0x47')]=_0x4b2f8b[_0x324d('0x47')]['length']?_0x4b2f8b[_0x324d('0x47')]:_0x1431ed[_0x324d('0x43')];if(!_0x5f53cb[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x4b2f8b[_0x324d('0x2b')]=qs[_0x324d('0x2b')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x2b')]);_0x4b2f8b[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x2c')]);}_0x4b2f8b[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0x5f53cb[_0x324d('0x44')][_0x324d('0x4b')]);_0x4b2f8b['where']=qs[_0x324d('0x4d')](_[_0x324d('0x4e')](_0x5f53cb[_0x324d('0x44')],_0x1431ed['filters']));_0x4b2f8b['where'][_0x324d('0x65')]=_0x222a0f['id'];if(_0x5f53cb['query'][_0x324d('0x69')]){_0x4b2f8b['where']=_[_0x324d('0x4f')](_0x4b2f8b[_0x324d('0x4c')],{'$or':_['map'](_0x4b2f8b[_0x324d('0x47')],function(_0x5801d4){var _0x4145f5={};_0x4145f5[_0x5801d4]={'$like':'%'+_0x5f53cb[_0x324d('0x44')][_0x324d('0x69')]+'%'};return _0x4145f5;})});}if(_0x5f53cb[_0x324d('0x44')][_0x324d('0xa6')]){var _0x3e4adf=_0x5f53cb[_0x324d('0x44')][_0x324d('0xa6')][_0x324d('0xa7')](',');var _0x36b0b3={};_0x36b0b3[_0x3e4adf[0x0]]={'$gte':moment(_0x3e4adf[0x1])[_0x324d('0xa8')](_0x324d('0xa9'))};_0x4b2f8b['where']=_[_0x324d('0x4f')](_0x4b2f8b[_0x324d('0x4c')],_0x36b0b3);}_0x4b2f8b=_[_0x324d('0x4f')]({},_0x4b2f8b,_0x5f53cb[_0x324d('0x51')]);return db[_0x324d('0xa5')][_0x324d('0x52')]({'where':_0x4b2f8b['where']})['then'](function(_0x513261){_0x4fca70[_0x324d('0x52')]=_0x513261;if(_0x5f53cb[_0x324d('0x44')][_0x324d('0x53')]){_0x4b2f8b[_0x324d('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x324d('0x55')](_0x4b2f8b);})[_0x324d('0x33')](function(_0x4d9ac4){_0x4fca70['rows']=_0x4d9ac4;return _0x4fca70;});}})[_0x324d('0x33')](respondWithFilteredResult(_0x1233eb,_0x4b2f8b))[_0x324d('0x26')](handleError(_0x1233eb,null));};exports['send']=function(_0x2bde86,_0x3831e8,_0x5a089a){var _0xb8cd1f,_0x1b8a05={},_0x1819aa;if(_0x2bde86[_0x324d('0x5b')]['to']){_0x1819aa=_0x2bde86['body']['to'][0x0];}return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x2bde86[_0x324d('0x58')]['id']},'include':[{'model':db[_0x324d('0xaa')],'as':'List','include':[{'model':db[_0x324d('0xab')],'as':'Contacts','where':{'fax':_0x1819aa},'limit':0x1,'order':[[_0x324d('0xa1'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3831e8,null))[_0x324d('0x33')](function(_0x22c32b){_0xb8cd1f=_0x22c32b;if(_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')]&&_0x2bde86['body'][_0x324d('0xac')][_0x324d('0x48')]){for(var _0x429609=0x0;_0x429609<_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x324d('0x48')];_0x429609+=0x1){_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609]={'filename':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609][_0x324d('0x39')],'id':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609]['id'],'path':path[_0x324d('0xad')](config[_0x324d('0xae')],_0x324d('0xaf'),_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][_0x429609][_0x324d('0xb0')])};}}return respondWithRpcPromise(_0x324d('0xb1'),_0x324d('0xb1'),{'FaxAccountId':_['isNil'](_0x2bde86[_0x324d('0x58')]['id'])?undefined:_0x2bde86[_0x324d('0x58')]['id'],'path':_[_0x324d('0xb2')](_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0][_0x324d('0xb3')])?undefined:_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['path'],'fax':_['isNil'](_0x2bde86[_0x324d('0x5b')]['to'][0x0])?undefined:_0x2bde86[_0x324d('0x5b')]['to'][0x0]},client9002);})[_0x324d('0x33')](function(){if(_0xb8cd1f){if(_[_0x324d('0xb2')](_0x2bde86['body'][_0x324d('0xb4')])){_0x2bde86[_0x324d('0x5b')][_0x324d('0xb4')]=util[_0x324d('0xa8')](_0x324d('0xb5'),_0xb8cd1f[_0x324d('0x39')],_0xb8cd1f[_0x324d('0xb6')]);}if(_0xb8cd1f[_0x324d('0xb7')]){if(_0xb8cd1f[_0x324d('0xb7')][_0x324d('0xb8')]['length']){return _0xb8cd1f['List'][_0x324d('0xb8')][0x0];}else{return db[_0x324d('0xab')][_0x324d('0x5a')](_[_0x324d('0xb9')](_0x2bde86['body'],{'firstName':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'phone':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'fax':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'ListId':_0xb8cd1f[_0x324d('0xba')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x324d('0xbb'));}})['then'](function(_0x49a0dd){if(_0x49a0dd){return db[_0x324d('0x71')][_0x324d('0x60')]({'where':{'ContactId':_0x49a0dd['id'],'closed':![],'FaxAccountId':_0xb8cd1f['id']}})[_0x324d('0x33')](function(_0x50e73b){if(_0x50e73b){return[_0x50e73b,![]];}return db[_0x324d('0x71')][_0x324d('0x5a')]({'UserId':_0x2bde86[_0x324d('0x5c')]['id'],'ContactId':_0x49a0dd['id'],'FaxAccountId':_0xb8cd1f['id'],'fax':_0x2bde86[_0x324d('0x5b')]['to'][0x0],'firstMsgDirection':_0x324d('0xbc'),'Messages':[_[_0x324d('0x4f')](_0x2bde86[_0x324d('0x5b')],{'read':![],'body':_0x2bde86['body'][_0x324d('0xac')][0x0][_0x324d('0xbd')],'FaxAccountId':_0xb8cd1f['id'],'UserId':_0x2bde86['user']['id'],'ContactId':_0x49a0dd['id'],'AttachmentId':_0x2bde86['body'][_0x324d('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x324d('0xa5')],'as':_0x324d('0xbe')}]})[_0x324d('0x33')](function(_0x51b81e){return[_0x51b81e,!![]];});});}else{throw new Error(_0x324d('0xbf'));}})['spread'](function(_0x5baa3a,_0x5ee6d7){if(_0x5ee6d7){return _0x5baa3a;}return db['FaxMessage'][_0x324d('0x5a')]({'direction':_0x324d('0xbc'),'read':![],'body':_0x2bde86['body'][_0x324d('0xac')][0x0][_0x324d('0xbd')],'FaxAccountId':_0xb8cd1f['id'],'FaxInteractionId':_0x5baa3a['id'],'UserId':_0x2bde86[_0x324d('0x5c')]['id'],'ContactId':_0x5baa3a['ContactId'],'AttachmentId':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['id']})[_0x324d('0x33')](function(_0x1ac658){_0x5baa3a[_0x324d('0xc0')][_0x324d('0xbe')]=[];_0x5baa3a['dataValues']['Messages']['push'](_0x1ac658[_0x324d('0xc0')]);return _0x5baa3a;});})[_0x324d('0x33')](function(_0x26a5f5){respondWithRpcPromise('SendFax',_0x324d('0xc1'),{'FaxAccountId':_['isNil'](_0x2bde86[_0x324d('0x58')]['id'])?undefined:_0x2bde86[_0x324d('0x58')]['id'],'path':_['isNil'](_0x2bde86['body']['attachments'][0x0][_0x324d('0xb3')])?undefined:_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0][_0x324d('0xb3')],'fax':_[_0x324d('0xb2')](_0x2bde86[_0x324d('0x5b')]['to'][0x0])?undefined:_0x2bde86[_0x324d('0x5b')]['to'][0x0],'AttachmentId':_0x2bde86[_0x324d('0x5b')][_0x324d('0xac')][0x0]['id']},client9002)[_0x324d('0x33')](function(_0x21b7ce){logger['info'](_0x324d('0xc2'),_0x21b7ce);})[_0x324d('0x26')](function(_0x4c5319){logger['info']('SendFaxRpc,\x20%s',_0x4c5319);});return _0x26a5f5;})[_0x324d('0x33')](respondWithResult(_0x3831e8,null))['catch'](handleError(_0x3831e8,null));};exports[_0x324d('0xc3')]=function(_0x1a3495,_0x4e66c2,_0xe44828){return db[_0x324d('0x3e')][_0x324d('0x60')]({'where':{'id':_0x1a3495[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x4e66c2,null))[_0x324d('0x33')](function(_0x55be3e){if(_0x55be3e){return _0x55be3e[_0x324d('0xc3')](_0x1a3495[_0x324d('0x5b')][_0x324d('0x6b')],_[_0x324d('0xc4')](_0x1a3495[_0x324d('0x5b')],[_0x324d('0x6b'),'id'])||{})[_0x324d('0xc5')](function(_0xb07db){for(var _0x2f655a=0x0;_0x2f655a<_0x1a3495['body'][_0x324d('0x6b')]['length'];_0x2f655a+=0x1){socket[_0x324d('0xc6')](_0x324d('0xc7'),{'UserId':Number(_0x1a3495[_0x324d('0x5b')][_0x324d('0x6b')][_0x2f655a]),'FaxAccountId':Number(_0x1a3495[_0x324d('0x58')]['id'])});}return _0xb07db;});}})[_0x324d('0x33')](respondWithResult(_0x4e66c2,null))['catch'](handleError(_0x4e66c2,null));};exports[_0x324d('0xc8')]=function(_0x45ca3c,_0x33c207,_0x2ee60f){return db['FaxAccount'][_0x324d('0x60')]({'where':{'id':_0x45ca3c[_0x324d('0x58')]['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x33c207,null))[_0x324d('0x33')](function(_0x4b1e6e){if(_0x4b1e6e){return _0x4b1e6e['removeAgents'](_0x45ca3c[_0x324d('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x45ca3c['query'][_0x324d('0x6b')])){for(var _0x53ab53=0x0;_0x53ab53<_0x45ca3c[_0x324d('0x44')][_0x324d('0x6b')][_0x324d('0x48')];_0x53ab53+=0x1){socket[_0x324d('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x45ca3c['query'][_0x324d('0x6b')][_0x53ab53]),'FaxAccountId':Number(_0x45ca3c['params']['id'])});}}else{socket[_0x324d('0xc6')](_0x324d('0xc9'),{'UserId':Number(_0x45ca3c[_0x324d('0x44')][_0x324d('0x6b')]),'FaxAccountId':Number(_0x45ca3c[_0x324d('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x33c207,null))['catch'](handleError(_0x33c207,null));};exports[_0x324d('0xca')]=function(_0xc04d66,_0x51d873,_0x1660d2){var _0x262fd5={};var _0x597698={};var _0x17ba6c;var _0x697e27;return db[_0x324d('0x3e')][_0x324d('0x67')]({'where':{'id':_0xc04d66['params']['id']}})[_0x324d('0x33')](handleEntityNotFound(_0x51d873,null))[_0x324d('0x33')](function(_0x423165){if(_0x423165){_0x17ba6c=_0x423165;_0x597698[_0x324d('0x43')]=_[_0x324d('0x59')](db[_0x324d('0x74')]['rawAttributes']);_0x597698[_0x324d('0x44')]=_['keys'](_0xc04d66[_0x324d('0x44')]);_0x597698[_0x324d('0x4d')]=_[_0x324d('0x45')](_0x597698['model'],_0x597698[_0x324d('0x44')]);_0x262fd5[_0x324d('0x47')]=_[_0x324d('0x45')](_0x597698[_0x324d('0x43')],qs['fields'](_0xc04d66['query'][_0x324d('0x46')]));_0x262fd5['attributes']=_0x262fd5[_0x324d('0x47')]['length']?_0x262fd5[_0x324d('0x47')]:_0x597698[_0x324d('0x43')];_0x262fd5[_0x324d('0x4a')]=qs[_0x324d('0x4b')](_0xc04d66['query'][_0x324d('0x4b')]);_0x262fd5[_0x324d('0x4c')]=qs[_0x324d('0x4d')](_['pick'](_0xc04d66[_0x324d('0x44')],_0x597698[_0x324d('0x4d')]));if(_0xc04d66['query']['filter']){_0x262fd5[_0x324d('0x4c')]=_[_0x324d('0x4f')](_0x262fd5[_0x324d('0x4c')],{'$or':_[_0x324d('0x3d')](_0x262fd5[_0x324d('0x47')],function(_0x21c5c6){var _0xce681d={};_0xce681d[_0x21c5c6]={'$like':'%'+_0xc04d66[_0x324d('0x44')]['filter']+'%'};return _0xce681d;})});}_0x262fd5=_[_0x324d('0x4f')]({},_0x262fd5,_0xc04d66[_0x324d('0x51')]);return _0x17ba6c['getAgents'](_0x262fd5);}})[_0x324d('0x33')](function(_0x1cfbee){if(_0x1cfbee){_0x697e27=_0x1cfbee['length'];if(!_0xc04d66[_0x324d('0x44')][_0x324d('0x68')](_0x324d('0x49'))){_0x262fd5[_0x324d('0x2b')]=qs['limit'](_0xc04d66[_0x324d('0x44')][_0x324d('0x2b')]);_0x262fd5[_0x324d('0x2c')]=qs[_0x324d('0x2c')](_0xc04d66[_0x324d('0x44')][_0x324d('0x2c')]);}return _0x17ba6c[_0x324d('0xca')](_0x262fd5);}})[_0x324d('0x33')](function(_0x5c5536){if(_0x5c5536){return _0x5c5536?{'count':_0x697e27,'rows':_0x5c5536}:null;}})[_0x324d('0x33')](respondWithResult(_0x51d873,null))[_0x324d('0x26')](handleError(_0x51d873,null));}; \ No newline at end of file +var _0x28b8=['length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','update','describe','Disposition','findOne','hasOwnProperty','FaxAccountId','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','localstationid','app','description','Fax\x20Extension','Answer','ecm','gateway','faxdetect','headerinfo','modem','t38timeout','push','FAXOPT(','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','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','ListId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','emit','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields'];(function(_0xf4fea5,_0x12b984){var _0x1fc3a0=function(_0x3f1f9d){while(--_0x3f1f9d){_0xf4fea5['push'](_0xf4fea5['shift']());}};_0x1fc3a0(++_0x12b984);}(_0x28b8,0x72));var _0x828b=function(_0x1ffd3f,_0x3fe195){_0x1ffd3f=_0x1ffd3f-0x0;var _0x49bdb1=_0x28b8[_0x1ffd3f];return _0x49bdb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x828b('0x0'));var rp=require(_0x828b('0x1'));var moment=require(_0x828b('0x2'));var BPromise=require(_0x828b('0x3'));var Mustache=require(_0x828b('0x4'));var util=require(_0x828b('0x5'));var path=require(_0x828b('0x6'));var sox=require(_0x828b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x828b('0x8'));var _=require(_0x828b('0x9'));var squel=require(_0x828b('0xa'));var crypto=require(_0x828b('0xb'));var jsforce=require(_0x828b('0xc'));var deskjs=require(_0x828b('0xd'));var toCsv=require(_0x828b('0xe'));var querystring=require(_0x828b('0xf'));var Papa=require(_0x828b('0x10'));var Redis=require(_0x828b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x828b('0x12'));var hardwareService=require(_0x828b('0x13'));var logger=require(_0x828b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x828b('0x15'));var licenseUtil=require(_0x828b('0x16'));var db=require('../../mysqldb')['db'];config[_0x828b('0x17')]=_[_0x828b('0x18')](config[_0x828b('0x17')],{'host':_0x828b('0x19'),'port':0x18eb});var socket=require(_0x828b('0x1a'))(new Redis(config[_0x828b('0x17')]));require(_0x828b('0x1b'))['register'](socket);var jayson=require(_0x828b('0x1c'));var client=jayson[_0x828b('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x828b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x32184a,_0x3b8ee2,_0x50c7c5,_0x2acc39){return new BPromise(function(_0x394d19,_0x2836f9){var _0x2e4e4a=_0x2acc39||client;return _0x2e4e4a['request'](_0x32184a,_0x50c7c5)[_0x828b('0x1f')](function(_0x11bbbd){logger[_0x828b('0x20')]('FaxAccount,\x20%s,\x20%s',_0x3b8ee2,_0x828b('0x21'));logger[_0x828b('0x22')](_0x828b('0x23'),_0x3b8ee2,_0x828b('0x21'),JSON[_0x828b('0x24')](_0x11bbbd));if(_0x11bbbd[_0x828b('0x25')]){if(_0x11bbbd['error'][_0x828b('0x26')]===0x1f4){logger[_0x828b('0x25')](_0x828b('0x27'),_0x3b8ee2,_0x11bbbd['error'][_0x828b('0x28')]);return _0x2836f9(_0x11bbbd[_0x828b('0x25')][_0x828b('0x28')]);}logger[_0x828b('0x25')](_0x828b('0x27'),_0x3b8ee2,_0x11bbbd[_0x828b('0x25')][_0x828b('0x28')]);return _0x394d19(_0x11bbbd[_0x828b('0x25')]['message']);}else{logger['info'](_0x828b('0x27'),_0x3b8ee2,'request\x20sent');_0x394d19(_0x11bbbd[_0x828b('0x29')][_0x828b('0x28')]);}})[_0x828b('0x2a')](function(_0x52cfa5){logger[_0x828b('0x25')](_0x828b('0x27'),_0x3b8ee2,_0x52cfa5);_0x2836f9(_0x52cfa5);});});}function respondWithStatusCode(_0x25d39e,_0x89e9ac){_0x89e9ac=_0x89e9ac||0xcc;return function(_0x19a757){if(_0x19a757){return _0x25d39e[_0x828b('0x2b')](_0x89e9ac);}return _0x25d39e[_0x828b('0x2c')](_0x89e9ac)[_0x828b('0x2d')]();};}function respondWithResult(_0x23b3e0,_0x365275){_0x365275=_0x365275||0xc8;return function(_0x265e6d){if(_0x265e6d){return _0x23b3e0[_0x828b('0x2c')](_0x365275)[_0x828b('0x2e')](_0x265e6d);}};}function respondWithFilteredResult(_0x328830,_0x5253c7){return function(_0xfca72){if(_0xfca72){var _0x284be1=typeof _0x5253c7[_0x828b('0x2f')]==='undefined'&&typeof _0x5253c7[_0x828b('0x30')]===_0x828b('0x31');var _0x419989=_0xfca72[_0x828b('0x32')];var _0x4e9fb9=_0x284be1?0x0:_0x5253c7[_0x828b('0x2f')];var _0x4f77a9=_0x284be1?_0xfca72[_0x828b('0x32')]:_0x5253c7['offset']+_0x5253c7[_0x828b('0x30')];var _0x145bcb;if(_0x4f77a9>=_0x419989){_0x4f77a9=_0x419989;_0x145bcb=0xc8;}else{_0x145bcb=0xce;}_0x328830[_0x828b('0x2c')](_0x145bcb);return _0x328830[_0x828b('0x33')]('Content-Range',_0x4e9fb9+'-'+_0x4f77a9+'/'+_0x419989)[_0x828b('0x2e')](_0xfca72);}return null;};}function patchUpdates(_0x2a75c4){return function(_0x27b45d){try{jsonpatch[_0x828b('0x34')](_0x27b45d,_0x2a75c4,!![]);}catch(_0x4bc2ac){return BPromise[_0x828b('0x35')](_0x4bc2ac);}return _0x27b45d[_0x828b('0x36')]();};}function saveUpdates(_0x533b9e,_0x19eb94){return function(_0x1c1e18){if(_0x1c1e18){return _0x1c1e18['update'](_0x533b9e)['then'](function(_0x4d2f32){return _0x4d2f32;});}return null;};}function removeEntity(_0xa95bf9,_0x5e4ebf){return function(_0x50fde0){if(_0x50fde0){return _0x50fde0[_0x828b('0x37')]()[_0x828b('0x1f')](function(){var _0x572f57=_0x50fde0[_0x828b('0x38')]({'plain':!![]});var _0x4c64dd=_0x828b('0x39');return db['UserProfileResource'][_0x828b('0x37')]({'where':{'type':_0x4c64dd,'resourceId':_0x572f57['id']}})[_0x828b('0x1f')](function(){return _0x50fde0;});})[_0x828b('0x1f')](function(){_0xa95bf9[_0x828b('0x2c')](0xcc)[_0x828b('0x2d')]();});}};}function handleEntityNotFound(_0x126f65,_0x451130){return function(_0x17f778){if(!_0x17f778){_0x126f65['sendStatus'](0x194);}return _0x17f778;};}function handleError(_0x33b94c,_0x3f4eeb){_0x3f4eeb=_0x3f4eeb||0x1f4;return function(_0x5922fd){logger[_0x828b('0x25')](_0x5922fd[_0x828b('0x3a')]);if(_0x5922fd[_0x828b('0x3b')]){delete _0x5922fd['name'];}_0x33b94c['status'](_0x3f4eeb)[_0x828b('0x3c')](_0x5922fd);};}exports[_0x828b('0x3d')]=function(_0x4e977e,_0x5cdca2){var _0x497920={'include':[{'model':db['Pause'],'as':_0x828b('0x3e')}]},_0x54145e={},_0x208fc5={'count':0x0,'rows':[]};var _0x24ce7f=_['map'](db[_0x828b('0x3f')][_0x828b('0x40')],function(_0x1265c6){return{'name':_0x1265c6[_0x828b('0x41')],'type':_0x1265c6[_0x828b('0x42')][_0x828b('0x43')]};});_0x54145e[_0x828b('0x44')]=_[_0x828b('0x45')](_0x24ce7f,_0x828b('0x3b'));_0x54145e[_0x828b('0x46')]=_[_0x828b('0x47')](_0x4e977e[_0x828b('0x46')]);_0x54145e['filters']=_['intersection'](_0x54145e[_0x828b('0x44')],_0x54145e['query']);_0x497920[_0x828b('0x48')]=_[_0x828b('0x49')](_0x54145e[_0x828b('0x44')],qs[_0x828b('0x4a')](_0x4e977e[_0x828b('0x46')][_0x828b('0x4a')]));_0x497920[_0x828b('0x48')]=_0x497920['attributes'][_0x828b('0x4b')]?_0x497920[_0x828b('0x48')]:_0x54145e[_0x828b('0x44')];if(!_0x4e977e['query']['hasOwnProperty'](_0x828b('0x4c'))){_0x497920[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x4e977e[_0x828b('0x46')][_0x828b('0x30')]);_0x497920['offset']=qs[_0x828b('0x2f')](_0x4e977e[_0x828b('0x46')][_0x828b('0x2f')]);}_0x497920[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x4e977e['query']['sort']);_0x497920[_0x828b('0x4f')]=qs[_0x828b('0x50')](_[_0x828b('0x51')](_0x4e977e[_0x828b('0x46')],_0x54145e[_0x828b('0x50')]),_0x24ce7f);if(_0x4e977e['query'][_0x828b('0x52')]){_0x497920[_0x828b('0x4f')]=_[_0x828b('0x53')](_0x497920['where'],{'$or':_[_0x828b('0x45')](_0x24ce7f,function(_0x2784e9){if(_0x2784e9[_0x828b('0x42')]!=='VIRTUAL'){var _0x4d401d={};_0x4d401d[_0x2784e9[_0x828b('0x3b')]]={'$like':'%'+_0x4e977e['query'][_0x828b('0x52')]+'%'};return _0x4d401d;}})});}_0x497920=_[_0x828b('0x53')]({},_0x497920,_0x4e977e[_0x828b('0x54')]);var _0x32a245={'where':_0x497920['where']};return db[_0x828b('0x3f')]['count'](_0x32a245)['then'](function(_0x4f5e10){_0x208fc5[_0x828b('0x32')]=_0x4f5e10;if(_0x4e977e['query'][_0x828b('0x55')]){_0x497920[_0x828b('0x56')]=[{'all':!![]}];}return db[_0x828b('0x3f')][_0x828b('0x57')](_0x497920);})['then'](function(_0x5b03dd){_0x208fc5[_0x828b('0x58')]=_0x5b03dd;return _0x208fc5;})[_0x828b('0x1f')](respondWithFilteredResult(_0x5cdca2,_0x497920))[_0x828b('0x2a')](handleError(_0x5cdca2,null));};exports['show']=function(_0x2b5db0,_0x5d1b0b){var _0x2f3826={'raw':![],'where':{'id':_0x2b5db0[_0x828b('0x59')]['id']},'include':[{'model':db[_0x828b('0x5a')],'as':_0x828b('0x3e')}]},_0x5f4792={};_0x5f4792['model']=_[_0x828b('0x47')](db[_0x828b('0x3f')]['rawAttributes']);_0x5f4792[_0x828b('0x46')]=_[_0x828b('0x47')](_0x2b5db0[_0x828b('0x46')]);_0x5f4792['filters']=_[_0x828b('0x49')](_0x5f4792[_0x828b('0x44')],_0x5f4792[_0x828b('0x46')]);_0x2f3826['attributes']=_['intersection'](_0x5f4792['model'],qs[_0x828b('0x4a')](_0x2b5db0[_0x828b('0x46')][_0x828b('0x4a')]));_0x2f3826['attributes']=_0x2f3826[_0x828b('0x48')][_0x828b('0x4b')]?_0x2f3826[_0x828b('0x48')]:_0x5f4792[_0x828b('0x44')];if(_0x2b5db0['query']['includeAll']){_0x2f3826[_0x828b('0x56')]=[{'all':!![]}];}_0x2f3826=_[_0x828b('0x53')]({},_0x2f3826,_0x2b5db0[_0x828b('0x54')]);return db[_0x828b('0x3f')][_0x828b('0x5b')](_0x2f3826)[_0x828b('0x1f')](handleEntityNotFound(_0x5d1b0b,null))[_0x828b('0x1f')](respondWithResult(_0x5d1b0b,null))['catch'](handleError(_0x5d1b0b,null));};exports[_0x828b('0x5c')]=function(_0x551e74,_0x47586d){return db[_0x828b('0x3f')][_0x828b('0x5c')](_0x551e74[_0x828b('0x5d')],{})[_0x828b('0x1f')](function(_0x2837d8){var _0x35742b=_0x551e74[_0x828b('0x5e')][_0x828b('0x38')]({'plain':!![]});if(!_0x35742b)throw new Error(_0x828b('0x5f'));if(_0x35742b[_0x828b('0x60')]===_0x828b('0x5e')){var _0x1edc10=_0x2837d8[_0x828b('0x38')]({'plain':!![]});var _0x1f52bf=_0x828b('0x39');return db['UserProfileSection'][_0x828b('0x5b')]({'where':{'name':_0x1f52bf,'userProfileId':_0x35742b[_0x828b('0x61')]},'raw':!![]})[_0x828b('0x1f')](function(_0x3cb4e0){if(_0x3cb4e0&&_0x3cb4e0[_0x828b('0x62')]===0x0){return db[_0x828b('0x63')]['create']({'name':_0x1edc10['name'],'resourceId':_0x1edc10['id'],'type':_0x3cb4e0[_0x828b('0x3b')],'sectionId':_0x3cb4e0['id']},{})[_0x828b('0x1f')](function(){return _0x2837d8;});}else{return _0x2837d8;}})[_0x828b('0x2a')](function(_0x16f255){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f255);throw _0x16f255;});}return _0x2837d8;})[_0x828b('0x1f')](respondWithResult(_0x47586d,0xc9))[_0x828b('0x2a')](handleError(_0x47586d,null));};exports[_0x828b('0x64')]=function(_0x5a09a7,_0x4ab0e1){if(_0x5a09a7['body']['id']){delete _0x5a09a7[_0x828b('0x5d')]['id'];}return db[_0x828b('0x3f')][_0x828b('0x5b')]({'where':{'id':_0x5a09a7[_0x828b('0x59')]['id']},'include':[{'model':db[_0x828b('0x5a')],'as':_0x828b('0x3e')}]})[_0x828b('0x1f')](handleEntityNotFound(_0x4ab0e1,null))[_0x828b('0x1f')](saveUpdates(_0x5a09a7['body'],null))[_0x828b('0x1f')](respondWithResult(_0x4ab0e1,null))[_0x828b('0x2a')](handleError(_0x4ab0e1,null));};exports[_0x828b('0x37')]=function(_0x1a7969,_0x476ee6){return db[_0x828b('0x3f')]['find']({'where':{'id':_0x1a7969['params']['id']}})['then'](handleEntityNotFound(_0x476ee6,null))[_0x828b('0x1f')](removeEntity(_0x476ee6,null))['catch'](handleError(_0x476ee6,null));};exports[_0x828b('0x65')]=function(_0x4e4905,_0xabcead){return db[_0x828b('0x3f')][_0x828b('0x65')]()[_0x828b('0x1f')](respondWithResult(_0xabcead,null))['catch'](handleError(_0xabcead,null));};exports['addDisposition']=function(_0x178ea5,_0x3a3062,_0x48bee7){if(_0x178ea5['body']['id']){delete _0x178ea5[_0x828b('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x178ea5[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x3a3062,null))[_0x828b('0x1f')](function(_0x266dd9){if(_0x266dd9){_0x178ea5[_0x828b('0x5d')]['FaxAccountId']=_0x266dd9['id'];return db[_0x828b('0x66')]['create'](_0x178ea5['body']);}})['then'](respondWithResult(_0x3a3062,null))[_0x828b('0x2a')](handleError(_0x3a3062,null));};exports['getDispositions']=function(_0x367407,_0x3a4661,_0x522fa9){var _0x19dc5e={'raw':![],'where':{}};var _0x2bc889={};var _0x37d85b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x828b('0x67')]({'where':{'id':_0x367407[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x3a4661,null))[_0x828b('0x1f')](function(_0x376720){if(_0x376720){_0x2bc889[_0x828b('0x44')]=_[_0x828b('0x47')](db[_0x828b('0x66')]['rawAttributes']);_0x2bc889[_0x828b('0x46')]=_[_0x828b('0x47')](_0x367407[_0x828b('0x46')]);_0x2bc889[_0x828b('0x50')]=_[_0x828b('0x49')](_0x2bc889[_0x828b('0x44')],_0x2bc889[_0x828b('0x46')]);_0x19dc5e[_0x828b('0x48')]=_[_0x828b('0x49')](_0x2bc889[_0x828b('0x44')],qs[_0x828b('0x4a')](_0x367407[_0x828b('0x46')]['fields']));_0x19dc5e[_0x828b('0x48')]=_0x19dc5e[_0x828b('0x48')][_0x828b('0x4b')]?_0x19dc5e[_0x828b('0x48')]:_0x2bc889[_0x828b('0x44')];if(!_0x367407['query'][_0x828b('0x68')](_0x828b('0x4c'))){_0x19dc5e[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x367407[_0x828b('0x46')]['limit']);_0x19dc5e[_0x828b('0x2f')]=qs['offset'](_0x367407[_0x828b('0x46')][_0x828b('0x2f')]);}_0x19dc5e[_0x828b('0x4d')]=qs['sort'](_0x367407['query']['sort']);_0x19dc5e['where']=qs['filters'](_['pick'](_0x367407[_0x828b('0x46')],_0x2bc889['filters']));_0x19dc5e[_0x828b('0x4f')][_0x828b('0x69')]=_0x376720['id'];if(_0x367407[_0x828b('0x46')][_0x828b('0x52')]){_0x19dc5e['where']=_[_0x828b('0x53')](_0x19dc5e['where'],{'$or':_['map'](_0x19dc5e[_0x828b('0x48')],function(_0x2d68b6){var _0x3e2d1f={};_0x3e2d1f[_0x2d68b6]={'$like':'%'+_0x367407[_0x828b('0x46')][_0x828b('0x52')]+'%'};return _0x3e2d1f;})});}_0x19dc5e=_[_0x828b('0x53')]({},_0x19dc5e,_0x367407['options']);return db[_0x828b('0x66')][_0x828b('0x32')]({'where':_0x19dc5e[_0x828b('0x4f')]})[_0x828b('0x1f')](function(_0x234491){_0x37d85b[_0x828b('0x32')]=_0x234491;if(_0x367407[_0x828b('0x46')][_0x828b('0x55')]){_0x19dc5e[_0x828b('0x56')]=[{'all':!![]}];}return db[_0x828b('0x66')][_0x828b('0x57')](_0x19dc5e);})['then'](function(_0x2fc77f){_0x37d85b[_0x828b('0x58')]=_0x2fc77f;return _0x37d85b;});}})[_0x828b('0x1f')](respondWithFilteredResult(_0x3a4661,_0x19dc5e))[_0x828b('0x2a')](handleError(_0x3a4661,null));};exports['removeDispositions']=function(_0x22ba04,_0x22ccc6,_0x4bee71){return db[_0x828b('0x3f')]['find']({'where':{'id':_0x22ba04['params']['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x22ccc6,null))[_0x828b('0x1f')](function(_0x1f5c67){if(_0x1f5c67){return _0x1f5c67['removeDispositions'](_0x22ba04[_0x828b('0x46')][_0x828b('0x6a')]);}})[_0x828b('0x1f')](respondWithStatusCode(_0x22ccc6,null))[_0x828b('0x2a')](handleError(_0x22ccc6,null));};exports[_0x828b('0x6b')]=function(_0x50373d,_0x1055ad,_0x1e8d80){if(_0x50373d['body']['id']){delete _0x50373d['body']['id'];}return db[_0x828b('0x3f')][_0x828b('0x5b')]({'where':{'id':_0x50373d[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x1055ad,null))[_0x828b('0x1f')](function(_0x554754){if(_0x554754){_0x50373d[_0x828b('0x5d')]['FaxAccountId']=_0x554754['id'];return db[_0x828b('0x6c')][_0x828b('0x5c')](_0x50373d[_0x828b('0x5d')]);}})['then'](respondWithResult(_0x1055ad,null))[_0x828b('0x2a')](handleError(_0x1055ad,null));};exports[_0x828b('0x6d')]=function(_0x179eb8,_0x2bdf97,_0x94098e){var _0x3b79b4={'raw':![],'where':{}};var _0x48fbaa={};var _0x3ee40f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x828b('0x67')]({'where':{'id':_0x179eb8[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x2bdf97,null))['then'](function(_0x50eefe){if(_0x50eefe){_0x48fbaa[_0x828b('0x44')]=_['keys'](db[_0x828b('0x6c')]['rawAttributes']);_0x48fbaa[_0x828b('0x46')]=_[_0x828b('0x47')](_0x179eb8[_0x828b('0x46')]);_0x48fbaa['filters']=_['intersection'](_0x48fbaa[_0x828b('0x44')],_0x48fbaa[_0x828b('0x46')]);_0x3b79b4['attributes']=_[_0x828b('0x49')](_0x48fbaa[_0x828b('0x44')],qs[_0x828b('0x4a')](_0x179eb8['query'][_0x828b('0x4a')]));_0x3b79b4[_0x828b('0x48')]=_0x3b79b4['attributes'][_0x828b('0x4b')]?_0x3b79b4[_0x828b('0x48')]:_0x48fbaa[_0x828b('0x44')];if(!_0x179eb8[_0x828b('0x46')][_0x828b('0x68')](_0x828b('0x4c'))){_0x3b79b4[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x179eb8[_0x828b('0x46')][_0x828b('0x30')]);_0x3b79b4[_0x828b('0x2f')]=qs['offset'](_0x179eb8['query'][_0x828b('0x2f')]);}_0x3b79b4[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x179eb8['query'][_0x828b('0x4e')]);_0x3b79b4['where']=qs[_0x828b('0x50')](_[_0x828b('0x51')](_0x179eb8[_0x828b('0x46')],_0x48fbaa['filters']));_0x3b79b4[_0x828b('0x4f')][_0x828b('0x69')]=_0x50eefe['id'];if(_0x179eb8[_0x828b('0x46')][_0x828b('0x52')]){_0x3b79b4[_0x828b('0x4f')]=_[_0x828b('0x53')](_0x3b79b4['where'],{'$or':_[_0x828b('0x45')](_0x3b79b4[_0x828b('0x48')],function(_0x294958){var _0x462db2={};_0x462db2[_0x294958]={'$like':'%'+_0x179eb8['query']['filter']+'%'};return _0x462db2;})});}_0x3b79b4=_[_0x828b('0x53')]({},_0x3b79b4,_0x179eb8[_0x828b('0x54')]);return db[_0x828b('0x6c')][_0x828b('0x32')]({'where':_0x3b79b4['where']})[_0x828b('0x1f')](function(_0x3826d0){_0x3ee40f[_0x828b('0x32')]=_0x3826d0;if(_0x179eb8['query']['includeAll']){_0x3b79b4[_0x828b('0x56')]=[{'all':!![]}];}return db[_0x828b('0x6c')][_0x828b('0x57')](_0x3b79b4);})['then'](function(_0x4e1929){_0x3ee40f[_0x828b('0x58')]=_0x4e1929;return _0x3ee40f;});}})[_0x828b('0x1f')](respondWithFilteredResult(_0x2bdf97,_0x3b79b4))[_0x828b('0x2a')](handleError(_0x2bdf97,null));};exports['removeAnswers']=function(_0x3d4abc,_0x4cc06c,_0x1d816f){return db[_0x828b('0x3f')][_0x828b('0x5b')]({'where':{'id':_0x3d4abc[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x4cc06c,null))[_0x828b('0x1f')](function(_0x3ca256){if(_0x3ca256){return _0x3ca256[_0x828b('0x6e')](_0x3d4abc['query'][_0x828b('0x6a')]);}})[_0x828b('0x1f')](respondWithStatusCode(_0x4cc06c,null))['catch'](handleError(_0x4cc06c,null));};exports[_0x828b('0x6f')]=function(_0x256d9d,_0x757f4,_0x2bb5b0){return db[_0x828b('0x70')][_0x828b('0x5b')]({'where':{'id':_0x256d9d[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x757f4,null))['then'](function(_0xf2dbff){if(_0xf2dbff){return _0xf2dbff[_0x828b('0x6f')](_0x256d9d[_0x828b('0x5d')][_0x828b('0x6a')],_['omit'](_0x256d9d[_0x828b('0x5d')],['ids','id'])||{});}})[_0x828b('0x1f')](respondWithResult(_0x757f4,null))[_0x828b('0x2a')](handleError(_0x757f4,null));};exports[_0x828b('0x71')]=function(_0x5358b3,_0x2c3638,_0x42d232){var _0x749de0={'raw':![],'where':{}};var _0x249017={};var _0x403c0={'count':0x0,'rows':[]};return db[_0x828b('0x3f')][_0x828b('0x67')]({'where':{'id':_0x5358b3[_0x828b('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c3638,null))[_0x828b('0x1f')](function(_0x3d83f4){if(_0x3d83f4){_0x249017['model']=_['keys'](db[_0x828b('0x70')][_0x828b('0x40')]);_0x249017[_0x828b('0x46')]=_[_0x828b('0x47')](_0x5358b3[_0x828b('0x46')]);_0x249017['filters']=_[_0x828b('0x49')](_0x249017[_0x828b('0x44')],_0x249017[_0x828b('0x46')]);_0x749de0['attributes']=_[_0x828b('0x49')](_0x249017['model'],qs[_0x828b('0x4a')](_0x5358b3[_0x828b('0x46')]['fields']));_0x749de0[_0x828b('0x48')]=_0x749de0[_0x828b('0x48')][_0x828b('0x4b')]?_0x749de0[_0x828b('0x48')]:_0x249017[_0x828b('0x44')];if(!_0x5358b3[_0x828b('0x46')][_0x828b('0x68')](_0x828b('0x4c'))){_0x749de0[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x5358b3[_0x828b('0x46')]['limit']);_0x749de0[_0x828b('0x2f')]=qs[_0x828b('0x2f')](_0x5358b3[_0x828b('0x46')][_0x828b('0x2f')]);}_0x749de0[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x5358b3[_0x828b('0x46')][_0x828b('0x4e')]);_0x749de0[_0x828b('0x4f')]=qs['filters'](_['pick'](_0x5358b3[_0x828b('0x46')],_0x249017[_0x828b('0x50')]));_0x749de0['where']['FaxAccountId']=_0x3d83f4['id'];if(_0x5358b3[_0x828b('0x46')][_0x828b('0x52')]){_0x749de0[_0x828b('0x4f')]=_[_0x828b('0x53')](_0x749de0[_0x828b('0x4f')],{'$or':_[_0x828b('0x45')](_0x749de0[_0x828b('0x48')],function(_0x16681d){var _0x208d59={};_0x208d59[_0x16681d]={'$like':'%'+_0x5358b3[_0x828b('0x46')][_0x828b('0x52')]+'%'};return _0x208d59;})});}_0x749de0=_['merge']({},_0x749de0,_0x5358b3['options']);return db[_0x828b('0x70')][_0x828b('0x32')]({'where':_0x749de0[_0x828b('0x4f')]})[_0x828b('0x1f')](function(_0x46c213){_0x403c0[_0x828b('0x32')]=_0x46c213;if(_0x5358b3[_0x828b('0x46')][_0x828b('0x55')]){_0x749de0[_0x828b('0x56')]=[{'model':db['CmContact'],'as':_0x828b('0x72'),'required':![]},{'model':db[_0x828b('0x73')],'as':_0x828b('0x74'),'attributes':[_0x828b('0x3b'),_0x828b('0x75'),_0x828b('0x76')],'required':![]},{'model':db[_0x828b('0x77')],'as':_0x828b('0x78'),'attributes':['id',_0x828b('0x3b'),_0x828b('0x79')],'where':_0x5358b3[_0x828b('0x46')]['tag']?{'id':_0x5358b3['query'][_0x828b('0x7a')]}:undefined,'required':_0x5358b3['query'][_0x828b('0x7a')]?!![]:![]}];}return db['FaxInteraction'][_0x828b('0x57')](_0x749de0);})['then'](function(_0x68589){_0x403c0[_0x828b('0x58')]=_0x68589;return _0x403c0;});}})[_0x828b('0x1f')](respondWithFilteredResult(_0x2c3638,_0x749de0))[_0x828b('0x2a')](handleError(_0x2c3638,null));};exports['addApplications']=function(_0x2b9ae1,_0x580ffb){var _0xb54267=_0x2b9ae1[_0x828b('0x59')]['id'];var _0x3ee73e=_0x2b9ae1['body'];var _0x566c9e=0xc8;var _0x510c17=null;return db[_0x828b('0x7b')][_0x828b('0x7c')]({'isolationLevel':db[_0x828b('0x7b')][_0x828b('0x7d')][_0x828b('0x7e')]['READ_COMMITTED']},function(_0x118571){return db[_0x828b('0x3f')]['findOne']({'where':{'id':_0xb54267},'transaction':_0x118571})[_0x828b('0x1f')](function(_0x9f33f0){if(_0x9f33f0){return db[_0x828b('0x7f')][_0x828b('0x37')]({'where':{'FaxAccountId':_0xb54267},'transaction':_0x118571})['then'](function(){var _0x344f0c=_['map'](_0x3ee73e,function(_0x40fb18){_0x40fb18['FaxAccountId']=_0xb54267;return _0x40fb18;});return db['FaxApplication'][_0x828b('0x80')](_0x344f0c,{'transaction':_0x118571});});}else{_0x566c9e=0x194;_0x510c17=[];}});})[_0x828b('0x1f')](function(){if(_0x566c9e!==0x194){return db[_0x828b('0x7f')][_0x828b('0x81')]({'where':{'FaxAccountId':_0xb54267},'order':_0x828b('0x82')})[_0x828b('0x1f')](function(_0x5b2d26){_0x510c17=_0x5b2d26;});}})[_0x828b('0x2a')](function(_0x38b1dc){_0x566c9e=0x1f4;logger[_0x828b('0x25')](_0x38b1dc[_0x828b('0x3a')]);if(_0x38b1dc[_0x828b('0x3b')]){delete _0x38b1dc[_0x828b('0x3b')];}_0x510c17=_0x38b1dc;})['finally'](function(){if(_0x510c17===null){_0x580ffb[_0x828b('0x2b')](_0x566c9e);}else{if(_0x566c9e===0x1f4){_0x580ffb['status'](_0x566c9e)['send'](_0x510c17);}else{_0x580ffb[_0x828b('0x2c')](_0x566c9e)[_0x828b('0x2e')](_0x510c17);}}});};exports[_0x828b('0x83')]=function(_0x5b7d21,_0x5377eb,_0x4cf6b5){var _0x1c84b6={};var _0x45faf9={};var _0x4b3ded;var _0x7117a2;return db['FaxAccount'][_0x828b('0x67')]({'where':{'id':_0x5b7d21[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x5377eb,null))['then'](function(_0x487046){if(_0x487046){_0x4b3ded=_0x487046;_0x45faf9[_0x828b('0x44')]=_['keys'](db[_0x828b('0x7f')][_0x828b('0x40')]);_0x45faf9['query']=_[_0x828b('0x47')](_0x5b7d21['query']);_0x45faf9[_0x828b('0x50')]=_[_0x828b('0x49')](_0x45faf9[_0x828b('0x44')],_0x45faf9['query']);_0x1c84b6[_0x828b('0x48')]=_[_0x828b('0x49')](_0x45faf9[_0x828b('0x44')],qs[_0x828b('0x4a')](_0x5b7d21['query']['fields']));_0x1c84b6[_0x828b('0x48')]=_0x1c84b6[_0x828b('0x48')][_0x828b('0x4b')]?_0x1c84b6['attributes']:_0x45faf9[_0x828b('0x44')];_0x1c84b6[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x5b7d21['query'][_0x828b('0x4e')]);_0x1c84b6[_0x828b('0x4f')]=qs[_0x828b('0x50')](_[_0x828b('0x51')](_0x5b7d21[_0x828b('0x46')],_0x45faf9[_0x828b('0x50')]));if(_0x5b7d21[_0x828b('0x46')]['filter']){_0x1c84b6[_0x828b('0x4f')]=_['merge'](_0x1c84b6[_0x828b('0x4f')],{'$or':_[_0x828b('0x45')](_0x1c84b6['attributes'],function(_0x2ae058){var _0x3ce630={};_0x3ce630[_0x2ae058]={'$like':'%'+_0x5b7d21[_0x828b('0x46')]['filter']+'%'};return _0x3ce630;})});}_0x1c84b6=_['merge']({},_0x1c84b6,_0x5b7d21[_0x828b('0x54')]);return _0x4b3ded[_0x828b('0x83')](_0x1c84b6);}})['then'](function(_0x22b004){if(_0x22b004){_0x7117a2=_0x22b004[_0x828b('0x4b')];if(!_0x5b7d21[_0x828b('0x46')][_0x828b('0x68')](_0x828b('0x4c'))){_0x1c84b6['limit']=qs[_0x828b('0x30')](_0x5b7d21['query'][_0x828b('0x30')]);_0x1c84b6[_0x828b('0x2f')]=qs[_0x828b('0x2f')](_0x5b7d21[_0x828b('0x46')][_0x828b('0x2f')]);}return _0x4b3ded['getApplications'](_0x1c84b6);}})[_0x828b('0x1f')](function(_0x2a43fc){if(_0x2a43fc){return _0x2a43fc?{'count':_0x7117a2,'rows':_0x2a43fc}:null;}})[_0x828b('0x1f')](respondWithResult(_0x5377eb,null))[_0x828b('0x2a')](handleError(_0x5377eb,null));};function Extension(_0x4c9638,_0x3f9b29,_0x5a4d39,_0x19c412){this[_0x828b('0x84')]='from-voip-provider';this['exten']=_0x4c9638[_0x828b('0x85')];this[_0x828b('0x86')]=_0x19c412;this[_0x828b('0x42')]='system';this[_0x828b('0x87')]=_0x828b('0x88');this['FaxAccountId']=_0x4c9638['id'];this[_0x828b('0x82')]=_0x3f9b29;this['appdata']=_0x5a4d39;}function createExtensionsReciveFax(_0x5899b0){var _0x1c7d59=0x1;var _0x54fab9=[];_0x54fab9['push'](new Extension(_0x5899b0,_0x1c7d59,'',_0x828b('0x89')));_0x1c7d59+=0x1;_0x54fab9['push'](new Extension(_0x5899b0,_0x1c7d59,'CDR(type)=inbound-fax','Set'));_0x1c7d59+=0x1;for(var _0x352db3 in _0x5899b0){if(_0x5899b0[_0x828b('0x68')](_0x352db3)&&(_0x352db3===_0x828b('0x8a')||_0x352db3===_0x828b('0x85')||_0x352db3===_0x828b('0x8b')||_0x352db3===_0x828b('0x8c')||_0x352db3===_0x828b('0x8d')||_0x352db3==='maxrate'||_0x352db3==='minrate'||_0x352db3===_0x828b('0x8e')||_0x352db3===_0x828b('0x8f'))){_0x54fab9[_0x828b('0x90')](new Extension(_0x5899b0,_0x1c7d59,_0x828b('0x91')+_0x352db3+')='+_0x5899b0[_0x352db3],_0x828b('0x92')));_0x1c7d59+=0x1;}}_0x54fab9[_0x828b('0x90')](new Extension(_0x5899b0,_0x1c7d59,'6',_0x828b('0x93')));_0x1c7d59+=0x1;_0x54fab9['push'](new Extension(_0x5899b0,_0x1c7d59,_0x828b('0x94'),'ReceiveFax'));_0x1c7d59=0x0;return _0x54fab9;}exports[_0x828b('0x95')]=function(_0x91d2e5,_0x355a60,_0x4b7008){var _0x15e929;return db[_0x828b('0x7b')][_0x828b('0x7c')](function(_0x31f9fe){return db[_0x828b('0x3f')]['create'](_0x91d2e5[_0x828b('0x5d')],{'transaction':_0x31f9fe})['then'](function(_0x431517){_0x15e929=_0x431517[_0x828b('0x38')]({'plain':!![]});return db[_0x828b('0x96')][_0x828b('0x80')](createExtensionsReciveFax(_0x15e929),{'transaction':_0x31f9fe});});})['then'](function(){return _0x15e929;})[_0x828b('0x1f')](respondWithResult(_0x355a60,null))[_0x828b('0x2a')](handleError(_0x355a60,null));};exports[_0x828b('0x97')]=function(_0x2d43b3,_0x11181d,_0x5be745){var _0xeef61f;return db[_0x828b('0x7b')][_0x828b('0x7c')](function(_0x514fb8){return db[_0x828b('0x3f')][_0x828b('0x64')](_0x2d43b3['body'],{'where':{'id':_0x2d43b3['body']['id']},'transaction':_0x514fb8})[_0x828b('0x1f')](function(_0xc6dc1f){return db['VoiceExtension'][_0x828b('0x37')]({'where':{'FaxAccountId':_0x2d43b3[_0x828b('0x5d')]['id']},'transaction':_0x514fb8})[_0x828b('0x1f')](function(_0x4fc5eb){return db[_0x828b('0x96')]['bulkCreate'](createExtensionsReciveFax(_[_0x828b('0x98')](_0x2d43b3['body'],['tech',_0x828b('0x43'),_0x828b('0x99'),_0x828b('0x9a'),'TrunkId',_0x828b('0x9b')])),{'transaction':_0x514fb8});});});})[_0x828b('0x1f')](function(){return db[_0x828b('0x3f')]['findById'](_0x2d43b3[_0x828b('0x5d')]['id']);})[_0x828b('0x1f')](respondWithResult(_0x11181d,null))[_0x828b('0x2a')](handleError(_0x11181d,null));};exports[_0x828b('0x9c')]=function(_0x174eff,_0xe4f08a,_0x3743e8){var _0x1972af={'raw':!![],'where':{}};var _0x39cef1={};var _0x80047f={'count':0x0,'rows':[]};return db[_0x828b('0x3f')][_0x828b('0x67')]({'where':{'id':_0x174eff['params']['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0xe4f08a,null))[_0x828b('0x1f')](function(_0xe23f86){if(_0xe23f86){_0x39cef1['model']=_[_0x828b('0x47')](db['FaxMessage'][_0x828b('0x40')]);_0x39cef1[_0x828b('0x46')]=_[_0x828b('0x47')](_0x174eff[_0x828b('0x46')]);_0x39cef1['filters']=_['intersection'](_0x39cef1[_0x828b('0x44')],_0x39cef1[_0x828b('0x46')]);_0x1972af['attributes']=_['intersection'](_0x39cef1['model'],qs[_0x828b('0x4a')](_0x174eff[_0x828b('0x46')][_0x828b('0x4a')]));_0x1972af[_0x828b('0x48')]=_0x1972af[_0x828b('0x48')][_0x828b('0x4b')]?_0x1972af[_0x828b('0x48')]:_0x39cef1['model'];if(!_0x174eff[_0x828b('0x46')]['hasOwnProperty'](_0x828b('0x4c'))){_0x1972af[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x174eff[_0x828b('0x46')]['limit']);_0x1972af[_0x828b('0x2f')]=qs[_0x828b('0x2f')](_0x174eff[_0x828b('0x46')][_0x828b('0x2f')]);}_0x1972af[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x174eff[_0x828b('0x46')][_0x828b('0x4e')]);_0x1972af[_0x828b('0x4f')]=qs[_0x828b('0x50')](_['pick'](_0x174eff[_0x828b('0x46')],_0x39cef1['filters']));_0x1972af['where'][_0x828b('0x69')]=_0xe23f86['id'];if(_0x174eff[_0x828b('0x46')][_0x828b('0x52')]){_0x1972af[_0x828b('0x4f')]=_['merge'](_0x1972af['where'],{'$or':_[_0x828b('0x45')](_0x1972af['attributes'],function(_0x1252ba){var _0x4a9a7f={};_0x4a9a7f[_0x1252ba]={'$like':'%'+_0x174eff[_0x828b('0x46')]['filter']+'%'};return _0x4a9a7f;})});}if(_0x174eff[_0x828b('0x46')][_0x828b('0x9d')]){var _0x253b98=_0x174eff[_0x828b('0x46')][_0x828b('0x9d')]['split'](',');var _0x4cbad3={};_0x4cbad3[_0x253b98[0x0]]={'$gte':moment(_0x253b98[0x1])[_0x828b('0x9e')](_0x828b('0x9f'))};_0x1972af[_0x828b('0x4f')]=_[_0x828b('0x53')](_0x1972af[_0x828b('0x4f')],_0x4cbad3);}_0x1972af=_[_0x828b('0x53')]({},_0x1972af,_0x174eff['options']);return db[_0x828b('0xa0')][_0x828b('0x32')]({'where':_0x1972af[_0x828b('0x4f')]})[_0x828b('0x1f')](function(_0x1eca52){_0x80047f[_0x828b('0x32')]=_0x1eca52;if(_0x174eff[_0x828b('0x46')]['includeAll']){_0x1972af[_0x828b('0x56')]=[{'all':!![]}];}return db[_0x828b('0xa0')][_0x828b('0x57')](_0x1972af);})['then'](function(_0x489359){_0x80047f[_0x828b('0x58')]=_0x489359;return _0x80047f;});}})['then'](respondWithFilteredResult(_0xe4f08a,_0x1972af))['catch'](handleError(_0xe4f08a,null));};exports[_0x828b('0x3c')]=function(_0x8c89b9,_0x3805aa,_0x541b03){var _0x21e832,_0x12268b={},_0x153c02;if(_0x8c89b9['body']['to']){_0x153c02=_0x8c89b9[_0x828b('0x5d')]['to'][0x0];}return db[_0x828b('0x3f')]['find']({'where':{'id':_0x8c89b9[_0x828b('0x59')]['id']},'include':[{'model':db[_0x828b('0xa1')],'as':_0x828b('0xa2'),'include':[{'model':db[_0x828b('0xa3')],'as':_0x828b('0xa4'),'where':{'fax':_0x153c02},'limit':0x1,'order':[[_0x828b('0x9a'),_0x828b('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x3805aa,null))[_0x828b('0x1f')](function(_0x3397d5){_0x21e832=_0x3397d5;if(_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')]&&_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][_0x828b('0x4b')]){for(var _0x1f6b4f=0x0;_0x1f6b4f<_0x8c89b9['body'][_0x828b('0xa6')][_0x828b('0x4b')];_0x1f6b4f+=0x1){_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][_0x1f6b4f]={'filename':_0x8c89b9[_0x828b('0x5d')]['attachments'][_0x1f6b4f][_0x828b('0x3b')],'id':_0x8c89b9['body']['attachments'][_0x1f6b4f]['id'],'path':path[_0x828b('0xa7')](config[_0x828b('0xa8')],_0x828b('0xa9'),_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][_0x1f6b4f]['basename'])};}}return respondWithRpcPromise(_0x828b('0xaa'),_0x828b('0xaa'),{'FaxAccountId':_['isNil'](_0x8c89b9[_0x828b('0x59')]['id'])?undefined:_0x8c89b9[_0x828b('0x59')]['id'],'path':_['isNil'](_0x8c89b9['body'][_0x828b('0xa6')][0x0][_0x828b('0x6')])?undefined:_0x8c89b9[_0x828b('0x5d')]['attachments'][0x0][_0x828b('0x6')],'fax':_[_0x828b('0xab')](_0x8c89b9[_0x828b('0x5d')]['to'][0x0])?undefined:_0x8c89b9[_0x828b('0x5d')]['to'][0x0]},client9002);})[_0x828b('0x1f')](function(){if(_0x21e832){if(_[_0x828b('0xab')](_0x8c89b9['body'][_0x828b('0xac')])){_0x8c89b9[_0x828b('0x5d')][_0x828b('0xac')]=util[_0x828b('0x9e')](_0x828b('0xad'),_0x21e832[_0x828b('0x3b')],_0x21e832[_0x828b('0xae')]);}if(_0x21e832[_0x828b('0xa2')]){if(_0x21e832[_0x828b('0xa2')][_0x828b('0xa4')][_0x828b('0x4b')]){return _0x21e832[_0x828b('0xa2')][_0x828b('0xa4')][0x0];}else{return db[_0x828b('0xa3')][_0x828b('0x5c')](_[_0x828b('0x18')](_0x8c89b9['body'],{'firstName':_0x8c89b9[_0x828b('0x5d')]['to'][0x0],'phone':_0x8c89b9[_0x828b('0x5d')]['to'][0x0],'fax':_0x8c89b9[_0x828b('0x5d')]['to'][0x0],'ListId':_0x21e832[_0x828b('0x9b')]}));}}else{throw new Error(_0x828b('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x22967e){if(_0x22967e){return db['FaxInteraction'][_0x828b('0x5b')]({'where':{'ContactId':_0x22967e['id'],'closed':![],'FaxAccountId':_0x21e832['id']}})['then'](function(_0x13f6d7){if(_0x13f6d7){return[_0x13f6d7,![]];}return db[_0x828b('0x70')][_0x828b('0x5c')]({'UserId':_0x8c89b9[_0x828b('0x5e')]['id'],'ContactId':_0x22967e['id'],'FaxAccountId':_0x21e832['id'],'fax':_0x8c89b9[_0x828b('0x5d')]['to'][0x0],'firstMsgDirection':_0x828b('0xb0'),'Messages':[_[_0x828b('0x53')](_0x8c89b9[_0x828b('0x5d')],{'read':![],'body':_0x8c89b9['body'][_0x828b('0xa6')][0x0][_0x828b('0xb1')],'FaxAccountId':_0x21e832['id'],'UserId':_0x8c89b9[_0x828b('0x5e')]['id'],'ContactId':_0x22967e['id'],'AttachmentId':_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x828b('0xb2')}]})[_0x828b('0x1f')](function(_0x200ac3){return[_0x200ac3,!![]];});});}else{throw new Error(_0x828b('0xb3'));}})[_0x828b('0xb4')](function(_0x272abc,_0x24f66f){if(_0x24f66f){return _0x272abc;}return db[_0x828b('0xa0')][_0x828b('0x5c')]({'direction':_0x828b('0xb0'),'read':![],'body':_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][0x0]['filename'],'FaxAccountId':_0x21e832['id'],'FaxInteractionId':_0x272abc['id'],'UserId':_0x8c89b9[_0x828b('0x5e')]['id'],'ContactId':_0x272abc['ContactId'],'AttachmentId':_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][0x0]['id']})[_0x828b('0x1f')](function(_0x1c972c){_0x272abc['dataValues'][_0x828b('0xb2')]=[];_0x272abc[_0x828b('0xb5')]['Messages'][_0x828b('0x90')](_0x1c972c[_0x828b('0xb5')]);return _0x272abc;});})[_0x828b('0x1f')](function(_0x54df2f){respondWithRpcPromise(_0x828b('0xb6'),'SendFax',{'FaxAccountId':_[_0x828b('0xab')](_0x8c89b9['params']['id'])?undefined:_0x8c89b9[_0x828b('0x59')]['id'],'path':_['isNil'](_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][0x0][_0x828b('0x6')])?undefined:_0x8c89b9[_0x828b('0x5d')][_0x828b('0xa6')][0x0][_0x828b('0x6')],'fax':_[_0x828b('0xab')](_0x8c89b9[_0x828b('0x5d')]['to'][0x0])?undefined:_0x8c89b9[_0x828b('0x5d')]['to'][0x0],'AttachmentId':_0x8c89b9[_0x828b('0x5d')]['attachments'][0x0]['id']},client9002)[_0x828b('0x1f')](function(_0x15e30f){logger[_0x828b('0x20')](_0x828b('0xb7'),_0x15e30f);})[_0x828b('0x2a')](function(_0x1b45f3){logger['info'](_0x828b('0xb7'),_0x1b45f3);});return _0x54df2f;})[_0x828b('0x1f')](respondWithResult(_0x3805aa,null))[_0x828b('0x2a')](handleError(_0x3805aa,null));};exports[_0x828b('0xb8')]=function(_0x10ecb2,_0x2c87cf,_0x34ffe3){return db[_0x828b('0x3f')]['find']({'where':{'id':_0x10ecb2[_0x828b('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c87cf,null))[_0x828b('0x1f')](function(_0xa4083a){if(_0xa4083a){return _0xa4083a[_0x828b('0xb8')](_0x10ecb2['body'][_0x828b('0x6a')],_['omit'](_0x10ecb2[_0x828b('0x5d')],[_0x828b('0x6a'),'id'])||{})[_0x828b('0xb4')](function(_0x39ed11){for(var _0x3db612=0x0;_0x3db612<_0x10ecb2[_0x828b('0x5d')][_0x828b('0x6a')]['length'];_0x3db612+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x10ecb2[_0x828b('0x5d')]['ids'][_0x3db612]),'FaxAccountId':Number(_0x10ecb2['params']['id'])});}return _0x39ed11;});}})[_0x828b('0x1f')](respondWithResult(_0x2c87cf,null))['catch'](handleError(_0x2c87cf,null));};exports[_0x828b('0xb9')]=function(_0x526e31,_0x2877d5,_0x25542f){return db[_0x828b('0x3f')][_0x828b('0x5b')]({'where':{'id':_0x526e31['params']['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x2877d5,null))[_0x828b('0x1f')](function(_0x4e62e2){if(_0x4e62e2){return _0x4e62e2[_0x828b('0xb9')](_0x526e31[_0x828b('0x46')][_0x828b('0x6a')])[_0x828b('0x1f')](function(){if(_['isArray'](_0x526e31[_0x828b('0x46')][_0x828b('0x6a')])){for(var _0x50e052=0x0;_0x50e052<_0x526e31[_0x828b('0x46')]['ids']['length'];_0x50e052+=0x1){socket[_0x828b('0xba')](_0x828b('0xbb'),{'UserId':Number(_0x526e31[_0x828b('0x46')][_0x828b('0x6a')][_0x50e052]),'FaxAccountId':Number(_0x526e31[_0x828b('0x59')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x526e31[_0x828b('0x46')][_0x828b('0x6a')]),'FaxAccountId':Number(_0x526e31[_0x828b('0x59')]['id'])});}});}})[_0x828b('0x1f')](respondWithStatusCode(_0x2877d5,null))[_0x828b('0x2a')](handleError(_0x2877d5,null));};exports[_0x828b('0xbc')]=function(_0x31b2ef,_0x5ea5cd,_0x40b981){var _0x47e9af={};var _0xb8cf9d={};var _0x207be8;var _0x37ce94;return db[_0x828b('0x3f')][_0x828b('0x67')]({'where':{'id':_0x31b2ef[_0x828b('0x59')]['id']}})[_0x828b('0x1f')](handleEntityNotFound(_0x5ea5cd,null))[_0x828b('0x1f')](function(_0x438e48){if(_0x438e48){_0x207be8=_0x438e48;_0xb8cf9d[_0x828b('0x44')]=_['keys'](db[_0x828b('0x73')][_0x828b('0x40')]);_0xb8cf9d['query']=_[_0x828b('0x47')](_0x31b2ef[_0x828b('0x46')]);_0xb8cf9d['filters']=_[_0x828b('0x49')](_0xb8cf9d[_0x828b('0x44')],_0xb8cf9d[_0x828b('0x46')]);_0x47e9af['attributes']=_[_0x828b('0x49')](_0xb8cf9d['model'],qs[_0x828b('0x4a')](_0x31b2ef[_0x828b('0x46')][_0x828b('0x4a')]));_0x47e9af[_0x828b('0x48')]=_0x47e9af[_0x828b('0x48')][_0x828b('0x4b')]?_0x47e9af[_0x828b('0x48')]:_0xb8cf9d[_0x828b('0x44')];_0x47e9af[_0x828b('0x4d')]=qs[_0x828b('0x4e')](_0x31b2ef[_0x828b('0x46')][_0x828b('0x4e')]);_0x47e9af[_0x828b('0x4f')]=qs[_0x828b('0x50')](_['pick'](_0x31b2ef[_0x828b('0x46')],_0xb8cf9d['filters']));if(_0x31b2ef['query'][_0x828b('0x52')]){_0x47e9af[_0x828b('0x4f')]=_['merge'](_0x47e9af[_0x828b('0x4f')],{'$or':_[_0x828b('0x45')](_0x47e9af[_0x828b('0x48')],function(_0x438a8f){var _0x1f5d61={};_0x1f5d61[_0x438a8f]={'$like':'%'+_0x31b2ef[_0x828b('0x46')][_0x828b('0x52')]+'%'};return _0x1f5d61;})});}_0x47e9af=_[_0x828b('0x53')]({},_0x47e9af,_0x31b2ef['options']);return _0x207be8[_0x828b('0xbc')](_0x47e9af);}})[_0x828b('0x1f')](function(_0x398b80){if(_0x398b80){_0x37ce94=_0x398b80[_0x828b('0x4b')];if(!_0x31b2ef[_0x828b('0x46')][_0x828b('0x68')](_0x828b('0x4c'))){_0x47e9af[_0x828b('0x30')]=qs[_0x828b('0x30')](_0x31b2ef['query'][_0x828b('0x30')]);_0x47e9af[_0x828b('0x2f')]=qs[_0x828b('0x2f')](_0x31b2ef[_0x828b('0x46')][_0x828b('0x2f')]);}return _0x207be8['getAgents'](_0x47e9af);}})[_0x828b('0x1f')](function(_0x3d4a58){if(_0x3d4a58){return _0x3d4a58?{'count':_0x37ce94,'rows':_0x3d4a58}:null;}})['then'](respondWithResult(_0x5ea5cd,null))[_0x828b('0x2a')](handleError(_0x5ea5cd,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9ee7bf2..c506c67 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 _0x8797=['../../mysqldb','FaxAccount','remove','emit','hasOwnProperty','hook','events'];(function(_0x1284fd,_0x302999){var _0x12bfb7=function(_0x44fb38){while(--_0x44fb38){_0x1284fd['push'](_0x1284fd['shift']());}};_0x12bfb7(++_0x302999);}(_0x8797,0x133));var _0x7879=function(_0x472063,_0x11a264){_0x472063=_0x472063-0x0;var _0x17a1bf=_0x8797[_0x472063];return _0x17a1bf;};'use strict';var EventEmitter=require(_0x7879('0x0'));var FaxAccount=require(_0x7879('0x1'))['db'][_0x7879('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7879('0x3')};function emitEvent(_0x382526){return function(_0x5288e1,_0x3d733c,_0x280a3c){FaxAccountEvents['emit'](_0x382526+':'+_0x5288e1['id'],_0x5288e1);FaxAccountEvents[_0x7879('0x4')](_0x382526,_0x5288e1);_0x280a3c(null);};}for(var e in events){if(events[_0x7879('0x5')](e)){var event=events[e];FaxAccount[_0x7879('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x2b70=['emit','hook','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4092f4,_0x40e5cd){var _0x5b221c=function(_0x25188c){while(--_0x25188c){_0x4092f4['push'](_0x4092f4['shift']());}};_0x5b221c(++_0x40e5cd);}(_0x2b70,0xc0));var _0x02b7=function(_0x91d498,_0x482a89){_0x91d498=_0x91d498-0x0;var _0x1e0294=_0x2b70[_0x91d498];return _0x1e0294;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x02b7('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x02b7('0x1')](0x0);var events={'afterCreate':_0x02b7('0x2'),'afterUpdate':'update','afterDestroy':_0x02b7('0x3')};function emitEvent(_0x535f64){return function(_0x22d56c,_0x49917f,_0x17bb3b){FaxAccountEvents[_0x02b7('0x4')](_0x535f64+':'+_0x22d56c['id'],_0x22d56c);FaxAccountEvents[_0x02b7('0x4')](_0x535f64,_0x22d56c);_0x17bb3b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x02b7('0x5')](e,emitEvent(event));}}module[_0x02b7('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8dda163..a161217 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 _0x7781=['rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c13f7,_0x4a43b3){var _0x4f8df6=function(_0x26271f){while(--_0x26271f){_0x5c13f7['push'](_0x5c13f7['shift']());}};_0x4f8df6(++_0x4a43b3);}(_0x7781,0x1a9));var _0x1778=function(_0x2e882f,_0x47e09e){_0x2e882f=_0x2e882f-0x0;var _0x3c773e=_0x7781[_0x2e882f];return _0x3c773e;};'use strict';var _=require(_0x1778('0x0'));var util=require(_0x1778('0x1'));var logger=require(_0x1778('0x2'))(_0x1778('0x3'));var moment=require(_0x1778('0x4'));var BPromise=require(_0x1778('0x5'));var rp=require(_0x1778('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1778('0x7'));var config=require('../../config/environment');var attributes=require(_0x1778('0x8'));module['exports']=function(_0x5344f8,_0x51862e){return _0x5344f8[_0x1778('0x9')](_0x1778('0xa'),attributes,{'tableName':_0x1778('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71b9=['FaxAccount','fax_accounts','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define'];(function(_0x5ce735,_0x2e61cb){var _0x40d9aa=function(_0x5459a7){while(--_0x5459a7){_0x5ce735['push'](_0x5ce735['shift']());}};_0x40d9aa(++_0x2e61cb);}(_0x71b9,0x8e));var _0x971b=function(_0x43e29e,_0x4680e1){_0x43e29e=_0x43e29e-0x0;var _0x434fc9=_0x71b9[_0x43e29e];return _0x434fc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x971b('0x0'))('api');var moment=require('moment');var BPromise=require(_0x971b('0x1'));var rp=require(_0x971b('0x2'));var fs=require('fs');var path=require(_0x971b('0x3'));var rimraf=require(_0x971b('0x4'));var config=require(_0x971b('0x5'));var attributes=require(_0x971b('0x6'));module['exports']=function(_0x35f82a,_0x933484){return _0x35f82a[_0x971b('0x7')](_0x971b('0x8'),attributes,{'tableName':_0x971b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index fb75f75..8773a97 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 _0x0e52=['where','attributes','limit','include','map','then','catch','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','List','Contacts','DESC','Applications','get','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','GetFaxAccount','findAll','options','raw'];(function(_0x8819a1,_0x436876){var _0x2691c3=function(_0x3ae1dd){while(--_0x3ae1dd){_0x8819a1['push'](_0x8819a1['shift']());}};_0x2691c3(++_0x436876);}(_0x0e52,0x1d2));var _0x20e5=function(_0x9d8ad1,_0x3e3c74){_0x9d8ad1=_0x9d8ad1-0x0;var _0x4f37ad=_0x0e52[_0x9d8ad1];return _0x4f37ad;};'use strict';var _=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var moment=require('moment');var BPromise=require(_0x20e5('0x2'));var rs=require(_0x20e5('0x3'));var fs=require('fs');var Redis=require(_0x20e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20e5('0x5'));var logger=require(_0x20e5('0x6'))('rpc');var config=require(_0x20e5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20e5('0x8')]({'port':0x232c});config[_0x20e5('0x9')]=_[_0x20e5('0xa')](config[_0x20e5('0x9')],{'host':_0x20e5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20e5('0x9')]));require(_0x20e5('0xc'))[_0x20e5('0xd')](socket);function respondWithRpcPromise(_0xf73af9,_0x5454e9,_0x420cc6){return new BPromise(function(_0x571629,_0xa1fcd1){return client[_0x20e5('0xe')](_0xf73af9,_0x420cc6)['then'](function(_0x570a51){logger[_0x20e5('0xf')](_0x20e5('0x10'),_0x5454e9,_0x20e5('0x11'));logger[_0x20e5('0x12')](_0x20e5('0x13'),_0x5454e9,'request\x20sent',JSON['stringify'](_0x570a51));if(_0x570a51[_0x20e5('0x14')]){if(_0x570a51[_0x20e5('0x14')]['code']===0x1f4){logger[_0x20e5('0x14')](_0x20e5('0x10'),_0x5454e9,_0x570a51['error']['message']);return _0xa1fcd1(_0x570a51[_0x20e5('0x14')][_0x20e5('0x15')]);}logger[_0x20e5('0x14')]('FaxAccount,\x20%s,\x20%s',_0x5454e9,_0x570a51[_0x20e5('0x14')][_0x20e5('0x15')]);return _0x571629(_0x570a51[_0x20e5('0x14')]['message']);}else{logger[_0x20e5('0xf')]('FaxAccount,\x20%s,\x20%s',_0x5454e9,_0x20e5('0x11'));_0x571629(_0x570a51['result'][_0x20e5('0x15')]);}})['catch'](function(_0x58a521){logger['error'](_0x20e5('0x10'),_0x5454e9,_0x58a521);_0xa1fcd1(_0x58a521);});});}exports[_0x20e5('0x16')]=function(_0x2b19ca){var _0x4fdb81=this;return new Promise(function(_0x483c7c,_0x45ae4a){return db['FaxAccount'][_0x20e5('0x17')]({'raw':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x19')]===undefined?!![]:![]:!![],'where':_0x2b19ca['options']?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1a')]||null:null,'attributes':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1b')]||null:null,'limit':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1c')]||null:null,'include':_0x2b19ca[_0x20e5('0x18')]?_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1d')]?_['map'](_0x2b19ca[_0x20e5('0x18')][_0x20e5('0x1d')],function(_0x128f41){return{'model':db[_0x128f41['model']],'as':_0x128f41['as'],'attributes':_0x128f41[_0x20e5('0x1b')],'include':_0x128f41['include']?_[_0x20e5('0x1e')](_0x128f41[_0x20e5('0x1d')],function(_0x4c9e5d){return{'model':db[_0x4c9e5d['model']],'as':_0x4c9e5d['as'],'attributes':_0x4c9e5d[_0x20e5('0x1b')],'include':_0x4c9e5d[_0x20e5('0x1d')]?_[_0x20e5('0x1e')](_0x4c9e5d[_0x20e5('0x1d')],function(_0x47284d){return{'model':db[_0x47284d['model']],'as':_0x47284d['as'],'attributes':_0x47284d[_0x20e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x20e5('0x1f')](function(_0x1b3952){logger['info']('GetFaxAccount',_0x2b19ca);logger[_0x20e5('0x12')](_0x20e5('0x16'),_0x2b19ca,JSON['stringify'](_0x1b3952));_0x483c7c(_0x1b3952);})[_0x20e5('0x20')](function(_0x97b890){logger[_0x20e5('0x14')](_0x20e5('0x16'),_0x97b890[_0x20e5('0x15')],_0x2b19ca);_0x45ae4a(_0x4fdb81['error'](0x1f4,_0x97b890['message']));});});};exports[_0x20e5('0x21')]=function(_0x2f0557,_0x1f7cf6,_0xd55efe){var _0x56246c=this;return new Promise(function(_0x3ea913,_0xaa1de0){var _0x5d735b={'body':_0x2f0557[_0x20e5('0x22')],'channel':_0x20e5('0x23')};var _0x347364=[];var _0x3af360=[];var _0x400d53={};return db[_0x20e5('0x24')]['describe']()[_0x20e5('0x1f')](function(_0x2cf6d2){if(!_0x2cf6d2){throw new db['Sequelize'][(_0x20e5('0x25'))](_0x20e5('0x26'));}_0x347364=_['difference'](_[_0x20e5('0x27')](_0x2cf6d2),['createdAt',_0x20e5('0x28')]);_0x3af360=_['difference'](_['keys'](_0x2cf6d2),[_0x20e5('0x29'),_0x20e5('0x28'),_0x20e5('0x2a'),_0x20e5('0x2b')]);if(_0x2f0557['body']['id']){delete _0x2f0557['body']['id'];}if(_[_0x20e5('0x2c')](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x2d')])){throw new db[(_0x20e5('0x2e'))][(_0x20e5('0x25'))]('from\x20is\x20mandatory');}if(_[_0x20e5('0x2c')](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x22')])||_0x2f0557['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0x20e5('0x2f'));}if(_['isNil'](_0x2f0557[_0x20e5('0x22')][_0x20e5('0x30')])){throw new db[(_0x20e5('0x2e'))][(_0x20e5('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3af360);}if(!_[_0x20e5('0x31')](_0x3af360,_0x2f0557['body'][_0x20e5('0x30')])){throw new db['Sequelize'][(_0x20e5('0x25'))](_0x20e5('0x32')+_0x3af360);}_0x400d53[_0x2f0557[_0x20e5('0x22')][_0x20e5('0x30')]]=_0x2f0557[_0x20e5('0x22')][_0x20e5('0x2d')];})[_0x20e5('0x1f')](function(){return db[_0x20e5('0x33')]['find']({'where':{'id':_0x2f0557[_0x20e5('0x34')]['id']},'include':[{'model':db[_0x20e5('0x35')],'as':_0x20e5('0x36'),'include':[{'model':db[_0x20e5('0x24')],'as':_0x20e5('0x37'),'where':_0x400d53,'limit':0x1,'order':[[_0x20e5('0x28'),_0x20e5('0x38')]]}]},{'model':db['FaxApplication'],'as':_0x20e5('0x39')}]});})[_0x20e5('0x1f')](function(_0x563bbb){if(_0x563bbb&&_0x563bbb['List']){var _0x497059=_0x563bbb[_0x20e5('0x3a')]({'plain':!![]});_0x5d735b[_0x20e5('0x34')]=_0x497059;_0x5d735b['applications']=_0x497059[_0x20e5('0x39')];_0x5d735b['list']=_0x497059['List'];_0x5d735b[_0x20e5('0x3b')]=_[_0x20e5('0x3c')](_0x5d735b[_0x20e5('0x3b')],[_0x20e5('0x3d')],[_0x20e5('0x3e')]);if(_0x5d735b[_0x20e5('0x34')]['Applications']){delete _0x5d735b[_0x20e5('0x34')][_0x20e5('0x39')];}if(_0x5d735b[_0x20e5('0x34')]['List']&&_0x5d735b['account'][_0x20e5('0x36')][_0x20e5('0x37')][_0x20e5('0x3f')]){return _0x5d735b['account'][_0x20e5('0x36')]['Contacts'][0x0];}var _0x213204=_[_0x20e5('0xa')](_0x2f0557[_0x20e5('0x22')],{'firstName':_0x2f0557['body']['from'],'ListId':_0x497059['ListId']});_0x213204[_0x2f0557['body'][_0x20e5('0x30')]]=_0x2f0557[_0x20e5('0x22')]['from'];return db['CmContact'][_0x20e5('0x40')](_0x213204,{'fields':_0x347364,'raw':!![]});}})[_0x20e5('0x1f')](function(_0x334dd2){_0x5d735b[_0x20e5('0x41')]=_0x334dd2;if(_0x334dd2){var _0x27431f={'ContactId':_0x334dd2['id'],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id'],'fax':_0x334dd2['fax']};return db[_0x20e5('0x42')]['find']({'where':{'ContactId':_0x334dd2['id'],'closed':![],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id']}})[_0x20e5('0x1f')](function(_0x1004a9){if(_0x1004a9){return[_0x1004a9,![]];}return db[_0x20e5('0x42')][_0x20e5('0x40')](_0x27431f)[_0x20e5('0x1f')](function(_0x149cba){return[_0x149cba,!![]];});});}else{throw new Error(_0x20e5('0x43'));}})[_0x20e5('0x44')](function(_0xd0f237,_0x5a6cf9){var _0xc98b01=_0xd0f237[_0x20e5('0x3a')]({'plain':!![]});if(_0x5a6cf9){if(_0x5d735b[_0x20e5('0x34')]['autoclose']){_0x5d735b[_0x20e5('0x3b')]['push']({'id':0x0,'priority':_0x5d735b[_0x20e5('0x3b')][_0x20e5('0x3f')]+0x1,'app':_0x20e5('0x45'),'appdata':_0x20e5('0x46'),'interval':_0x20e5('0x47')});}_0xc98b01['created']=!![];}else{_0xc98b01[_0x20e5('0x48')]=![];}_0x5d735b[_0x20e5('0x49')]=_0xc98b01;return db[_0x20e5('0x4a')][_0x20e5('0x40')]({'body':_0x2f0557[_0x20e5('0x22')][_0x20e5('0x22')],'FaxAccountId':_0x2f0557[_0x20e5('0x34')]['id'],'FaxInteractionId':_0xd0f237['id'],'direction':'in','ContactId':_0xd0f237[_0x20e5('0x4b')],'AttachmentId':_0x2f0557[_0x20e5('0x22')]['AttachmentId']});})['then'](function(_0x487287){_0x5d735b[_0x20e5('0x15')]=_0x487287;if(_0x5d735b[_0x20e5('0x49')][_0x20e5('0x4c')]){return db[_0x20e5('0x4d')]['find']({'attributes':['id',_0x20e5('0x4e')],'where':{'id':_0x5d735b['interaction']['UserId']}})[_0x20e5('0x1f')](function(_0x2535ae){if(_0x2535ae){_0x5d735b[_0x20e5('0x3b')][_0x20e5('0x4f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2535ae[_0x20e5('0x4e')]+','+(_0x5d735b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x20e5('0x47')});}return respondWithRpcPromise(_0x20e5('0x50'),_0x20e5('0x51'),_0x5d735b);});}return respondWithRpcPromise(_0x20e5('0x50'),_0x20e5('0x51'),_0x5d735b);})[_0x20e5('0x1f')](function(_0x3d6a7c){_0x3ea913(_0x3d6a7c);})[_0x20e5('0x20')](function(_0x5646a7){_0xaa1de0(_0x56246c[_0x20e5('0x14')](0x1f4,_0x5646a7[_0x20e5('0x15')]));});});}; \ No newline at end of file +var _0x8bf0=['limit','include','map','model','stringify','catch','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','FaxApplication','get','account','applications','Applications','orderBy','priority','List','length','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','created','interaction','create','ContactId','AttachmentId','UserId','find','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','options','where','attributes'];(function(_0x38c644,_0x3e695d){var _0x33f443=function(_0x3c8208){while(--_0x3c8208){_0x38c644['push'](_0x38c644['shift']());}};_0x33f443(++_0x3e695d);}(_0x8bf0,0xf1));var _0x08bf=function(_0x586394,_0x41627d){_0x586394=_0x586394-0x0;var _0xdd5c71=_0x8bf0[_0x586394];return _0xdd5c71;};'use strict';var _=require(_0x08bf('0x0'));var util=require(_0x08bf('0x1'));var moment=require(_0x08bf('0x2'));var BPromise=require(_0x08bf('0x3'));var rs=require(_0x08bf('0x4'));var fs=require('fs');var Redis=require(_0x08bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x08bf('0x6'));var logger=require(_0x08bf('0x7'))(_0x08bf('0x8'));var config=require(_0x08bf('0x9'));var jayson=require(_0x08bf('0xa'));var client=jayson[_0x08bf('0xb')][_0x08bf('0xc')]({'port':0x232c});config['redis']=_[_0x08bf('0xd')](config[_0x08bf('0xe')],{'host':_0x08bf('0xf'),'port':0x18eb});var socket=require(_0x08bf('0x10'))(new Redis(config[_0x08bf('0xe')]));require(_0x08bf('0x11'))[_0x08bf('0x12')](socket);function respondWithRpcPromise(_0x3c29b4,_0xeca27,_0x4edbb1){return new BPromise(function(_0x1636b2,_0x43c18e){return client[_0x08bf('0x13')](_0x3c29b4,_0x4edbb1)[_0x08bf('0x14')](function(_0x138d08){logger[_0x08bf('0x15')]('FaxAccount,\x20%s,\x20%s',_0xeca27,_0x08bf('0x16'));logger[_0x08bf('0x17')](_0x08bf('0x18'),_0xeca27,_0x08bf('0x16'),JSON['stringify'](_0x138d08));if(_0x138d08[_0x08bf('0x19')]){if(_0x138d08[_0x08bf('0x19')][_0x08bf('0x1a')]===0x1f4){logger[_0x08bf('0x19')](_0x08bf('0x1b'),_0xeca27,_0x138d08['error']['message']);return _0x43c18e(_0x138d08[_0x08bf('0x19')][_0x08bf('0x1c')]);}logger[_0x08bf('0x19')]('FaxAccount,\x20%s,\x20%s',_0xeca27,_0x138d08[_0x08bf('0x19')]['message']);return _0x1636b2(_0x138d08[_0x08bf('0x19')][_0x08bf('0x1c')]);}else{logger['info'](_0x08bf('0x1b'),_0xeca27,_0x08bf('0x16'));_0x1636b2(_0x138d08[_0x08bf('0x1d')]['message']);}})['catch'](function(_0x1e4b5d){logger[_0x08bf('0x19')](_0x08bf('0x1b'),_0xeca27,_0x1e4b5d);_0x43c18e(_0x1e4b5d);});});}exports[_0x08bf('0x1e')]=function(_0x35426f){var _0x1d65e0=this;return new Promise(function(_0x3d49f6,_0x3e7d64){return db[_0x08bf('0x1f')]['findAll']({'raw':_0x35426f[_0x08bf('0x20')]?_0x35426f[_0x08bf('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x35426f[_0x08bf('0x20')]?_0x35426f[_0x08bf('0x20')][_0x08bf('0x21')]||null:null,'attributes':_0x35426f[_0x08bf('0x20')]?_0x35426f[_0x08bf('0x20')][_0x08bf('0x22')]||null:null,'limit':_0x35426f[_0x08bf('0x20')]?_0x35426f[_0x08bf('0x20')][_0x08bf('0x23')]||null:null,'include':_0x35426f[_0x08bf('0x20')]?_0x35426f[_0x08bf('0x20')][_0x08bf('0x24')]?_[_0x08bf('0x25')](_0x35426f[_0x08bf('0x20')]['include'],function(_0x4f0fd1){return{'model':db[_0x4f0fd1['model']],'as':_0x4f0fd1['as'],'attributes':_0x4f0fd1[_0x08bf('0x22')],'include':_0x4f0fd1[_0x08bf('0x24')]?_['map'](_0x4f0fd1[_0x08bf('0x24')],function(_0x57c399){return{'model':db[_0x57c399[_0x08bf('0x26')]],'as':_0x57c399['as'],'attributes':_0x57c399[_0x08bf('0x22')],'include':_0x57c399[_0x08bf('0x24')]?_[_0x08bf('0x25')](_0x57c399[_0x08bf('0x24')],function(_0x579731){return{'model':db[_0x579731[_0x08bf('0x26')]],'as':_0x579731['as'],'attributes':_0x579731[_0x08bf('0x22')]};}):[]};}):[]};}):[]:[]})[_0x08bf('0x14')](function(_0x2bb8a0){logger[_0x08bf('0x15')]('GetFaxAccount',_0x35426f);logger['debug'](_0x08bf('0x1e'),_0x35426f,JSON[_0x08bf('0x27')](_0x2bb8a0));_0x3d49f6(_0x2bb8a0);})[_0x08bf('0x28')](function(_0x58beeb){logger['error'](_0x08bf('0x1e'),_0x58beeb[_0x08bf('0x1c')],_0x35426f);_0x3e7d64(_0x1d65e0[_0x08bf('0x19')](0x1f4,_0x58beeb[_0x08bf('0x1c')]));});});};exports[_0x08bf('0x29')]=function(_0x57ea5f,_0x54825b,_0x30e019){var _0x2e2c75=this;return new Promise(function(_0x349e6f,_0x382465){var _0x2faeeb={'body':_0x57ea5f[_0x08bf('0x2a')],'channel':_0x08bf('0x2b')};var _0x78997e=[];var _0x389e0b=[];var _0x1b411c={};return db[_0x08bf('0x2c')]['describe']()[_0x08bf('0x14')](function(_0x49bf63){if(!_0x49bf63){throw new db['Sequelize'][(_0x08bf('0x2d'))](_0x08bf('0x2e'));}_0x78997e=_[_0x08bf('0x2f')](_['keys'](_0x49bf63),[_0x08bf('0x30'),_0x08bf('0x31')]);_0x389e0b=_[_0x08bf('0x2f')](_[_0x08bf('0x32')](_0x49bf63),[_0x08bf('0x30'),_0x08bf('0x31'),_0x08bf('0x33'),_0x08bf('0x34')]);if(_0x57ea5f['body']['id']){delete _0x57ea5f[_0x08bf('0x2a')]['id'];}if(_[_0x08bf('0x35')](_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x36')])){throw new db['Sequelize'][(_0x08bf('0x2d'))](_0x08bf('0x37'));}if(_[_0x08bf('0x35')](_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x2a')])||_0x57ea5f[_0x08bf('0x2a')]['body']===''){throw new db['Sequelize'][(_0x08bf('0x2d'))](_0x08bf('0x38'));}if(_['isNil'](_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x39')])){throw new db[(_0x08bf('0x3a'))]['ValidationError'](_0x08bf('0x3b')+_0x389e0b);}if(!_[_0x08bf('0x3c')](_0x389e0b,_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x39')])){throw new db[(_0x08bf('0x3a'))][(_0x08bf('0x2d'))](_0x08bf('0x3d')+_0x389e0b);}_0x1b411c[_0x57ea5f[_0x08bf('0x2a')]['mapKey']]=_0x57ea5f['body']['from'];})['then'](function(){return db[_0x08bf('0x1f')]['find']({'where':{'id':_0x57ea5f['account']['id']},'include':[{'model':db[_0x08bf('0x3e')],'as':'List','include':[{'model':db[_0x08bf('0x2c')],'as':_0x08bf('0x3f'),'where':_0x1b411c,'limit':0x1,'order':[[_0x08bf('0x31'),'DESC']]}]},{'model':db[_0x08bf('0x40')],'as':'Applications'}]});})['then'](function(_0x5bc504){if(_0x5bc504&&_0x5bc504['List']){var _0x5f4571=_0x5bc504[_0x08bf('0x41')]({'plain':!![]});_0x2faeeb[_0x08bf('0x42')]=_0x5f4571;_0x2faeeb[_0x08bf('0x43')]=_0x5f4571[_0x08bf('0x44')];_0x2faeeb['list']=_0x5f4571['List'];_0x2faeeb[_0x08bf('0x43')]=_[_0x08bf('0x45')](_0x2faeeb[_0x08bf('0x43')],[_0x08bf('0x46')],['asc']);if(_0x2faeeb['account'][_0x08bf('0x44')]){delete _0x2faeeb[_0x08bf('0x42')][_0x08bf('0x44')];}if(_0x2faeeb[_0x08bf('0x42')][_0x08bf('0x47')]&&_0x2faeeb[_0x08bf('0x42')][_0x08bf('0x47')]['Contacts'][_0x08bf('0x48')]){return _0x2faeeb[_0x08bf('0x42')]['List']['Contacts'][0x0];}var _0x2c2da5=_[_0x08bf('0xd')](_0x57ea5f[_0x08bf('0x2a')],{'firstName':_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x36')],'ListId':_0x5f4571[_0x08bf('0x34')]});_0x2c2da5[_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x39')]]=_0x57ea5f[_0x08bf('0x2a')]['from'];return db[_0x08bf('0x2c')]['create'](_0x2c2da5,{'fields':_0x78997e,'raw':!![]});}})[_0x08bf('0x14')](function(_0xba477b){_0x2faeeb[_0x08bf('0x49')]=_0xba477b;if(_0xba477b){var _0x262d4a={'ContactId':_0xba477b['id'],'FaxAccountId':_0x57ea5f['account']['id'],'fax':_0xba477b[_0x08bf('0x2b')]};return db[_0x08bf('0x4a')]['find']({'where':{'ContactId':_0xba477b['id'],'closed':![],'FaxAccountId':_0x57ea5f[_0x08bf('0x42')]['id']}})[_0x08bf('0x14')](function(_0x38122d){if(_0x38122d){return[_0x38122d,![]];}return db[_0x08bf('0x4a')]['create'](_0x262d4a)[_0x08bf('0x14')](function(_0xc73d73){return[_0xc73d73,!![]];});});}else{throw new Error(_0x08bf('0x4b'));}})[_0x08bf('0x4c')](function(_0x3c5595,_0x1d4c2a){var _0x252922=_0x3c5595['get']({'plain':!![]});if(_0x1d4c2a){if(_0x2faeeb[_0x08bf('0x42')][_0x08bf('0x4d')]){_0x2faeeb[_0x08bf('0x43')][_0x08bf('0x4e')]({'id':0x0,'priority':_0x2faeeb[_0x08bf('0x43')][_0x08bf('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x08bf('0x4f')});}_0x252922[_0x08bf('0x50')]=!![];}else{_0x252922[_0x08bf('0x50')]=![];}_0x2faeeb[_0x08bf('0x51')]=_0x252922;return db['FaxMessage'][_0x08bf('0x52')]({'body':_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x2a')],'FaxAccountId':_0x57ea5f[_0x08bf('0x42')]['id'],'FaxInteractionId':_0x3c5595['id'],'direction':'in','ContactId':_0x3c5595[_0x08bf('0x53')],'AttachmentId':_0x57ea5f[_0x08bf('0x2a')][_0x08bf('0x54')]});})[_0x08bf('0x14')](function(_0x506b06){_0x2faeeb['message']=_0x506b06;if(_0x2faeeb[_0x08bf('0x51')][_0x08bf('0x55')]){return db['User'][_0x08bf('0x56')]({'attributes':['id',_0x08bf('0x57')],'where':{'id':_0x2faeeb['interaction'][_0x08bf('0x55')]}})['then'](function(_0x19e6ee){if(_0x19e6ee){_0x2faeeb[_0x08bf('0x43')][_0x08bf('0x58')]({'id':0x0,'priority':0x0,'app':_0x08bf('0x59'),'appdata':_0x19e6ee['name']+','+(_0x2faeeb[_0x08bf('0x42')]['waitForTheAssignedAgent']||0xa),'interval':_0x08bf('0x4f')});}return respondWithRpcPromise(_0x08bf('0x5a'),_0x08bf('0x5b'),_0x2faeeb);});}return respondWithRpcPromise(_0x08bf('0x5a'),_0x08bf('0x5b'),_0x2faeeb);})[_0x08bf('0x14')](function(_0x18ccb8){_0x349e6f(_0x18ccb8);})[_0x08bf('0x28')](function(_0x3eeaab){_0x382465(_0x2e2c75[_0x08bf('0x19')](0x1f4,_0x3eeaab['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0bb9f7d..c799f4d 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 _0xa8fd=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa8fd,0x1c2));var _0xda8f=function(_0x2d2282,_0x1b736d){_0x2d2282=_0x2d2282-0x0;var _0x2eafea=_0xa8fd[_0x2d2282];return _0x2eafea;};'use strict';var FaxAccountEvents=require(_0xda8f('0x0'));var events=[_0xda8f('0x1'),_0xda8f('0x2'),_0xda8f('0x3')];function createListener(_0x160479,_0x7d8e5f){return function(_0x237e38){_0x7d8e5f[_0xda8f('0x4')](_0x160479,_0x237e38);};}function removeListener(_0x229cc7,_0x4b1e77){return function(){FaxAccountEvents[_0xda8f('0x5')](_0x229cc7,_0x4b1e77);};}exports[_0xda8f('0x6')]=function(_0x33b32f){for(var _0x454fd9=0x0,_0x5730f2=events[_0xda8f('0x7')];_0x454fd9<_0x5730f2;_0x454fd9++){var _0x21c2f6=events[_0x454fd9];var _0x403e23=createListener(_0xda8f('0x8')+_0x21c2f6,_0x33b32f);FaxAccountEvents['on'](_0x21c2f6,_0x403e23);}}; \ No newline at end of file +var _0x26a8=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x26a8,0x177));var _0x826a=function(_0x22ad50,_0x456b90){_0x22ad50=_0x22ad50-0x0;var _0x3e8eb3=_0x26a8[_0x22ad50];return _0x3e8eb3;};'use strict';var FaxAccountEvents=require(_0x826a('0x0'));var events=[_0x826a('0x1'),_0x826a('0x2'),_0x826a('0x3')];function createListener(_0x200c6d,_0x93a4ad){return function(_0xa8b740){_0x93a4ad[_0x826a('0x4')](_0x200c6d,_0xa8b740);};}function removeListener(_0x402c2d,_0x189fc9){return function(){FaxAccountEvents[_0x826a('0x5')](_0x402c2d,_0x189fc9);};}exports[_0x826a('0x6')]=function(_0x501d2b){for(var _0x276369=0x0,_0x4a26d9=events[_0x826a('0x7')];_0x276369<_0x4a26d9;_0x276369++){var _0x8ae4cf=events[_0x276369];var _0x4fc718=createListener(_0x826a('0x8')+_0x8ae4cf,_0x501d2b);FaxAccountEvents['on'](_0x8ae4cf,_0x4fc718);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 34fc415..dd3eb20 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(_0x16d004,_0x4d0ce7){var _0x28aa7a=function(_0x4882e8){while(--_0x4882e8){_0x16d004['push'](_0x16d004['shift']());}};_0x28aa7a(++_0x4d0ce7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x448e0f,_0x5e163a){var _0x200438=function(_0x93ce79){while(--_0x93ce79){_0x448e0f['push'](_0x448e0f['shift']());}};_0x200438(++_0x5e163a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 c77a376..03626ed 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 _0xe5aa=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x1b3232,_0x2515e8){var _0x5e5f9d=function(_0x24f2f2){while(--_0x24f2f2){_0x1b3232['push'](_0x1b3232['shift']());}};_0x5e5f9d(++_0x2515e8);}(_0xe5aa,0x1d2));var _0xae5a=function(_0x34e570,_0xd6eda8){_0x34e570=_0x34e570-0x0;var _0x563eef=_0xe5aa[_0x34e570];return _0x563eef;};'use strict';var Sequelize=require(_0xae5a('0x0'));module[_0xae5a('0x1')]={'priority':{'type':Sequelize[_0xae5a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xae5a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xae5a('0x4')]()},'description':{'type':Sequelize[_0xae5a('0x3')]},'interval':{'type':Sequelize[_0xae5a('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3466=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3466,0x178));var _0x6346=function(_0x44a463,_0x3961a7){_0x44a463=_0x44a463-0x0;var _0x2e945e=_0x3466[_0x44a463];return _0x2e945e;};'use strict';var Sequelize=require(_0x6346('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6346('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6346('0x2')]()},'description':{'type':Sequelize[_0x6346('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6346('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 98d6c0a..191f956 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 _0xaf83=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x312120,_0x3a1815){var _0x59997d=function(_0x36ae94){while(--_0x36ae94){_0x312120['push'](_0x312120['shift']());}};_0x59997d(++_0x3a1815);}(_0xaf83,0x1e6));var _0x3af8=function(_0x1deba9,_0x42ec49){_0x1deba9=_0x1deba9-0x0;var _0xda60c2=_0xaf83[_0x1deba9];return _0xda60c2;};'use strict';var emlformat=require(_0x3af8('0x0'));var rimraf=require(_0x3af8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3af8('0x2'));var rp=require(_0x3af8('0x3'));var moment=require('moment');var BPromise=require(_0x3af8('0x4'));var Mustache=require(_0x3af8('0x5'));var util=require('util');var path=require(_0x3af8('0x6'));var sox=require(_0x3af8('0x7'));var csv=require(_0x3af8('0x8'));var ejs=require(_0x3af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af8('0xa'));var squel=require('squel');var crypto=require(_0x3af8('0xb'));var jsforce=require(_0x3af8('0xc'));var deskjs=require(_0x3af8('0xd'));var toCsv=require(_0x3af8('0x8'));var querystring=require('querystring');var Papa=require(_0x3af8('0xe'));var Redis=require(_0x3af8('0xf'));var authService=require(_0x3af8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3af8('0x11'));var logger=require(_0x3af8('0x12'))(_0x3af8('0x13'));var utils=require(_0x3af8('0x14'));var config=require(_0x3af8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3af8('0x16'))['db'];function respondWithStatusCode(_0x485b57,_0x481da8){_0x481da8=_0x481da8||0xcc;return function(_0x135d7e){if(_0x135d7e){return _0x485b57['sendStatus'](_0x481da8);}return _0x485b57['status'](_0x481da8)[_0x3af8('0x17')]();};}function respondWithResult(_0x19f6d8,_0x282515){_0x282515=_0x282515||0xc8;return function(_0x80a73a){if(_0x80a73a){return _0x19f6d8['status'](_0x282515)[_0x3af8('0x18')](_0x80a73a);}};}function respondWithFilteredResult(_0x4a536f,_0x1d5162){return function(_0x1f98cf){if(_0x1f98cf){var _0x224390=typeof _0x1d5162[_0x3af8('0x19')]===_0x3af8('0x1a')&&typeof _0x1d5162[_0x3af8('0x1b')]===_0x3af8('0x1a');var _0x4b1f46=_0x1f98cf[_0x3af8('0x1c')];var _0x2715df=_0x224390?0x0:_0x1d5162[_0x3af8('0x19')];var _0x18a611=_0x224390?_0x1f98cf['count']:_0x1d5162[_0x3af8('0x19')]+_0x1d5162[_0x3af8('0x1b')];var _0x4a7409;if(_0x18a611>=_0x4b1f46){_0x18a611=_0x4b1f46;_0x4a7409=0xc8;}else{_0x4a7409=0xce;}_0x4a536f[_0x3af8('0x1d')](_0x4a7409);return _0x4a536f['set'](_0x3af8('0x1e'),_0x2715df+'-'+_0x18a611+'/'+_0x4b1f46)[_0x3af8('0x18')](_0x1f98cf);}return null;};}function patchUpdates(_0x5c8824){return function(_0x341cd8){try{jsonpatch[_0x3af8('0x1f')](_0x341cd8,_0x5c8824,!![]);}catch(_0x4679c1){return BPromise[_0x3af8('0x20')](_0x4679c1);}return _0x341cd8[_0x3af8('0x21')]();};}function saveUpdates(_0x11cc3a,_0x583c9b){return function(_0x4c75cb){if(_0x4c75cb){return _0x4c75cb['update'](_0x11cc3a)[_0x3af8('0x22')](function(_0x17b814){return _0x17b814;});}return null;};}function removeEntity(_0x36e541,_0x5858da){return function(_0x2c0197){if(_0x2c0197){return _0x2c0197[_0x3af8('0x23')]()[_0x3af8('0x22')](function(){_0x36e541[_0x3af8('0x1d')](0xcc)[_0x3af8('0x17')]();});}};}function handleEntityNotFound(_0x25f7f3,_0x217619){return function(_0x21a80b){if(!_0x21a80b){_0x25f7f3['sendStatus'](0x194);}return _0x21a80b;};}function handleError(_0x1bf593,_0xb48f4a){_0xb48f4a=_0xb48f4a||0x1f4;return function(_0x329eb4){logger[_0x3af8('0x24')](_0x329eb4[_0x3af8('0x25')]);if(_0x329eb4[_0x3af8('0x26')]){delete _0x329eb4[_0x3af8('0x26')];}_0x1bf593[_0x3af8('0x1d')](_0xb48f4a)[_0x3af8('0x27')](_0x329eb4);};}exports[_0x3af8('0x28')]=function(_0x5bf32e,_0x3be522){var _0x24e2e6={},_0x1f6658={},_0x50336c={'count':0x0,'rows':[]};var _0x4ffcfb=_[_0x3af8('0x29')](db[_0x3af8('0x2a')][_0x3af8('0x2b')],function(_0x4d59f3){return{'name':_0x4d59f3[_0x3af8('0x2c')],'type':_0x4d59f3[_0x3af8('0x2d')][_0x3af8('0x2e')]};});_0x1f6658[_0x3af8('0x2f')]=_['map'](_0x4ffcfb,_0x3af8('0x26'));_0x1f6658[_0x3af8('0x30')]=_[_0x3af8('0x31')](_0x5bf32e['query']);_0x1f6658['filters']=_['intersection'](_0x1f6658[_0x3af8('0x2f')],_0x1f6658[_0x3af8('0x30')]);_0x24e2e6[_0x3af8('0x32')]=_[_0x3af8('0x33')](_0x1f6658['model'],qs[_0x3af8('0x34')](_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x34')]));_0x24e2e6[_0x3af8('0x32')]=_0x24e2e6[_0x3af8('0x32')][_0x3af8('0x35')]?_0x24e2e6[_0x3af8('0x32')]:_0x1f6658['model'];if(!_0x5bf32e['query'][_0x3af8('0x36')]('nolimit')){_0x24e2e6[_0x3af8('0x1b')]=qs[_0x3af8('0x1b')](_0x5bf32e['query'][_0x3af8('0x1b')]);_0x24e2e6[_0x3af8('0x19')]=qs['offset'](_0x5bf32e[_0x3af8('0x30')]['offset']);}_0x24e2e6[_0x3af8('0x37')]=qs[_0x3af8('0x38')](_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x38')]);_0x24e2e6[_0x3af8('0x39')]=qs['filters'](_[_0x3af8('0x3a')](_0x5bf32e[_0x3af8('0x30')],_0x1f6658[_0x3af8('0x3b')]),_0x4ffcfb);if(_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x3c')]){_0x24e2e6[_0x3af8('0x39')]=_[_0x3af8('0x3d')](_0x24e2e6[_0x3af8('0x39')],{'$or':_[_0x3af8('0x29')](_0x4ffcfb,function(_0x589998){if(_0x589998[_0x3af8('0x2d')]!=='VIRTUAL'){var _0x49f0f9={};_0x49f0f9[_0x589998['name']]={'$like':'%'+_0x5bf32e[_0x3af8('0x30')]['filter']+'%'};return _0x49f0f9;}})});}_0x24e2e6=_[_0x3af8('0x3d')]({},_0x24e2e6,_0x5bf32e[_0x3af8('0x3e')]);var _0x14b694={'where':_0x24e2e6[_0x3af8('0x39')]};return db[_0x3af8('0x2a')]['count'](_0x14b694)[_0x3af8('0x22')](function(_0x47c83b){_0x50336c[_0x3af8('0x1c')]=_0x47c83b;if(_0x5bf32e[_0x3af8('0x30')][_0x3af8('0x3f')]){_0x24e2e6['include']=[{'all':!![]}];}return db[_0x3af8('0x2a')][_0x3af8('0x40')](_0x24e2e6);})[_0x3af8('0x22')](function(_0x2177a8){_0x50336c['rows']=_0x2177a8;return _0x50336c;})[_0x3af8('0x22')](respondWithFilteredResult(_0x3be522,_0x24e2e6))[_0x3af8('0x41')](handleError(_0x3be522,null));};exports[_0x3af8('0x42')]=function(_0x5e0a7b,_0x5df46a){var _0x2fdf4d={'raw':!![],'where':{'id':_0x5e0a7b[_0x3af8('0x43')]['id']}},_0xe4fc82={};_0xe4fc82[_0x3af8('0x2f')]=_[_0x3af8('0x31')](db['FaxApplication'][_0x3af8('0x2b')]);_0xe4fc82[_0x3af8('0x30')]=_['keys'](_0x5e0a7b[_0x3af8('0x30')]);_0xe4fc82[_0x3af8('0x3b')]=_['intersection'](_0xe4fc82[_0x3af8('0x2f')],_0xe4fc82[_0x3af8('0x30')]);_0x2fdf4d['attributes']=_['intersection'](_0xe4fc82['model'],qs['fields'](_0x5e0a7b[_0x3af8('0x30')]['fields']));_0x2fdf4d[_0x3af8('0x32')]=_0x2fdf4d['attributes'][_0x3af8('0x35')]?_0x2fdf4d[_0x3af8('0x32')]:_0xe4fc82[_0x3af8('0x2f')];if(_0x5e0a7b[_0x3af8('0x30')][_0x3af8('0x3f')]){_0x2fdf4d['include']=[{'all':!![]}];}_0x2fdf4d=_[_0x3af8('0x3d')]({},_0x2fdf4d,_0x5e0a7b[_0x3af8('0x3e')]);return db[_0x3af8('0x2a')][_0x3af8('0x44')](_0x2fdf4d)[_0x3af8('0x22')](handleEntityNotFound(_0x5df46a,null))[_0x3af8('0x22')](respondWithResult(_0x5df46a,null))[_0x3af8('0x41')](handleError(_0x5df46a,null));};exports[_0x3af8('0x45')]=function(_0x342160,_0x43e054){return db['FaxApplication'][_0x3af8('0x45')](_0x342160[_0x3af8('0x46')],{})[_0x3af8('0x22')](respondWithResult(_0x43e054,0xc9))[_0x3af8('0x41')](handleError(_0x43e054,null));};exports[_0x3af8('0x47')]=function(_0x2e37f5,_0x331e55){if(_0x2e37f5[_0x3af8('0x46')]['id']){delete _0x2e37f5[_0x3af8('0x46')]['id'];}return db[_0x3af8('0x2a')][_0x3af8('0x44')]({'where':{'id':_0x2e37f5[_0x3af8('0x43')]['id']}})['then'](handleEntityNotFound(_0x331e55,null))['then'](saveUpdates(_0x2e37f5[_0x3af8('0x46')],null))[_0x3af8('0x22')](respondWithResult(_0x331e55,null))[_0x3af8('0x41')](handleError(_0x331e55,null));};exports[_0x3af8('0x23')]=function(_0x13a061,_0x5947c2){return db[_0x3af8('0x2a')]['find']({'where':{'id':_0x13a061['params']['id']}})[_0x3af8('0x22')](handleEntityNotFound(_0x5947c2,null))[_0x3af8('0x22')](removeEntity(_0x5947c2,null))['catch'](handleError(_0x5947c2,null));}; \ No newline at end of file +var _0x2a3f=['create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','update','then','stack','send','FaxApplication','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','include','findAll','rows','show','params','catch'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0x2a3f,0x94));var _0xf2a3=function(_0x5e5568,_0x300d0d){_0x5e5568=_0x5e5568-0x0;var _0x557045=_0x2a3f[_0x5e5568];return _0x557045;};'use strict';var emlformat=require(_0xf2a3('0x0'));var rimraf=require(_0xf2a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2a3('0x2'));var rp=require(_0xf2a3('0x3'));var moment=require(_0xf2a3('0x4'));var BPromise=require(_0xf2a3('0x5'));var Mustache=require(_0xf2a3('0x6'));var util=require(_0xf2a3('0x7'));var path=require('path');var sox=require(_0xf2a3('0x8'));var csv=require('to-csv');var ejs=require(_0xf2a3('0x9'));var fs=require('fs');var fs_extra=require(_0xf2a3('0xa'));var _=require(_0xf2a3('0xb'));var squel=require('squel');var crypto=require(_0xf2a3('0xc'));var jsforce=require(_0xf2a3('0xd'));var deskjs=require(_0xf2a3('0xe'));var toCsv=require(_0xf2a3('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf2a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf2a3('0x11'));var as=require(_0xf2a3('0x12'));var hardwareService=require(_0xf2a3('0x13'));var logger=require('../../config/logger')(_0xf2a3('0x14'));var utils=require(_0xf2a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf2a3('0x16'));var db=require(_0xf2a3('0x17'))['db'];function respondWithStatusCode(_0x36b6c6,_0x22e5a0){_0x22e5a0=_0x22e5a0||0xcc;return function(_0x2aad14){if(_0x2aad14){return _0x36b6c6[_0xf2a3('0x18')](_0x22e5a0);}return _0x36b6c6[_0xf2a3('0x19')](_0x22e5a0)[_0xf2a3('0x1a')]();};}function respondWithResult(_0x5185ae,_0x6f99c0){_0x6f99c0=_0x6f99c0||0xc8;return function(_0x2d09c6){if(_0x2d09c6){return _0x5185ae[_0xf2a3('0x19')](_0x6f99c0)['json'](_0x2d09c6);}};}function respondWithFilteredResult(_0x10a999,_0x5aad62){return function(_0x3fc877){if(_0x3fc877){var _0x1db0f5=typeof _0x5aad62[_0xf2a3('0x1b')]==='undefined'&&typeof _0x5aad62['limit']===_0xf2a3('0x1c');var _0x57fb13=_0x3fc877['count'];var _0x1a984f=_0x1db0f5?0x0:_0x5aad62[_0xf2a3('0x1b')];var _0x305663=_0x1db0f5?_0x3fc877[_0xf2a3('0x1d')]:_0x5aad62[_0xf2a3('0x1b')]+_0x5aad62[_0xf2a3('0x1e')];var _0x9c74d5;if(_0x305663>=_0x57fb13){_0x305663=_0x57fb13;_0x9c74d5=0xc8;}else{_0x9c74d5=0xce;}_0x10a999[_0xf2a3('0x19')](_0x9c74d5);return _0x10a999[_0xf2a3('0x1f')]('Content-Range',_0x1a984f+'-'+_0x305663+'/'+_0x57fb13)['json'](_0x3fc877);}return null;};}function patchUpdates(_0x5b0c21){return function(_0x3bd211){try{jsonpatch[_0xf2a3('0x20')](_0x3bd211,_0x5b0c21,!![]);}catch(_0x5915ed){return BPromise[_0xf2a3('0x21')](_0x5915ed);}return _0x3bd211['save']();};}function saveUpdates(_0x350f8b,_0xaf427f){return function(_0x34c27a){if(_0x34c27a){return _0x34c27a[_0xf2a3('0x22')](_0x350f8b)[_0xf2a3('0x23')](function(_0x2deac9){return _0x2deac9;});}return null;};}function removeEntity(_0x19dcb2,_0x7402a4){return function(_0x16b444){if(_0x16b444){return _0x16b444['destroy']()[_0xf2a3('0x23')](function(){_0x19dcb2[_0xf2a3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb1e393,_0x5ea687){return function(_0xf887b1){if(!_0xf887b1){_0xb1e393['sendStatus'](0x194);}return _0xf887b1;};}function handleError(_0x4feb16,_0x40a27f){_0x40a27f=_0x40a27f||0x1f4;return function(_0xead5d){logger['error'](_0xead5d[_0xf2a3('0x24')]);if(_0xead5d['name']){delete _0xead5d['name'];}_0x4feb16['status'](_0x40a27f)[_0xf2a3('0x25')](_0xead5d);};}exports['index']=function(_0x561138,_0x17d48a){var _0x2c1960={},_0x297311={},_0x5c1aa1={'count':0x0,'rows':[]};var _0x577eea=_['map'](db[_0xf2a3('0x26')][_0xf2a3('0x27')],function(_0x2f1c06){return{'name':_0x2f1c06['fieldName'],'type':_0x2f1c06[_0xf2a3('0x28')][_0xf2a3('0x29')]};});_0x297311[_0xf2a3('0x2a')]=_[_0xf2a3('0x2b')](_0x577eea,'name');_0x297311['query']=_[_0xf2a3('0x2c')](_0x561138[_0xf2a3('0x2d')]);_0x297311[_0xf2a3('0x2e')]=_[_0xf2a3('0x2f')](_0x297311['model'],_0x297311[_0xf2a3('0x2d')]);_0x2c1960[_0xf2a3('0x30')]=_['intersection'](_0x297311[_0xf2a3('0x2a')],qs[_0xf2a3('0x31')](_0x561138[_0xf2a3('0x2d')]['fields']));_0x2c1960[_0xf2a3('0x30')]=_0x2c1960[_0xf2a3('0x30')][_0xf2a3('0x32')]?_0x2c1960['attributes']:_0x297311['model'];if(!_0x561138[_0xf2a3('0x2d')][_0xf2a3('0x33')](_0xf2a3('0x34'))){_0x2c1960[_0xf2a3('0x1e')]=qs[_0xf2a3('0x1e')](_0x561138[_0xf2a3('0x2d')][_0xf2a3('0x1e')]);_0x2c1960[_0xf2a3('0x1b')]=qs[_0xf2a3('0x1b')](_0x561138[_0xf2a3('0x2d')][_0xf2a3('0x1b')]);}_0x2c1960[_0xf2a3('0x35')]=qs[_0xf2a3('0x36')](_0x561138['query'][_0xf2a3('0x36')]);_0x2c1960[_0xf2a3('0x37')]=qs[_0xf2a3('0x2e')](_[_0xf2a3('0x38')](_0x561138['query'],_0x297311[_0xf2a3('0x2e')]),_0x577eea);if(_0x561138[_0xf2a3('0x2d')]['filter']){_0x2c1960[_0xf2a3('0x37')]=_[_0xf2a3('0x39')](_0x2c1960[_0xf2a3('0x37')],{'$or':_['map'](_0x577eea,function(_0xcb1710){if(_0xcb1710[_0xf2a3('0x28')]!==_0xf2a3('0x3a')){var _0x4cac28={};_0x4cac28[_0xcb1710[_0xf2a3('0x3b')]]={'$like':'%'+_0x561138['query'][_0xf2a3('0x3c')]+'%'};return _0x4cac28;}})});}_0x2c1960=_[_0xf2a3('0x39')]({},_0x2c1960,_0x561138[_0xf2a3('0x3d')]);var _0x2c1b6e={'where':_0x2c1960[_0xf2a3('0x37')]};return db[_0xf2a3('0x26')]['count'](_0x2c1b6e)[_0xf2a3('0x23')](function(_0x1647ef){_0x5c1aa1[_0xf2a3('0x1d')]=_0x1647ef;if(_0x561138[_0xf2a3('0x2d')]['includeAll']){_0x2c1960[_0xf2a3('0x3e')]=[{'all':!![]}];}return db['FaxApplication'][_0xf2a3('0x3f')](_0x2c1960);})['then'](function(_0x5e181d){_0x5c1aa1[_0xf2a3('0x40')]=_0x5e181d;return _0x5c1aa1;})['then'](respondWithFilteredResult(_0x17d48a,_0x2c1960))['catch'](handleError(_0x17d48a,null));};exports[_0xf2a3('0x41')]=function(_0x1c3151,_0x1676e0){var _0x3f199e={'raw':!![],'where':{'id':_0x1c3151[_0xf2a3('0x42')]['id']}},_0x4417fa={};_0x4417fa[_0xf2a3('0x2a')]=_['keys'](db['FaxApplication'][_0xf2a3('0x27')]);_0x4417fa['query']=_['keys'](_0x1c3151['query']);_0x4417fa['filters']=_['intersection'](_0x4417fa[_0xf2a3('0x2a')],_0x4417fa['query']);_0x3f199e[_0xf2a3('0x30')]=_[_0xf2a3('0x2f')](_0x4417fa['model'],qs[_0xf2a3('0x31')](_0x1c3151[_0xf2a3('0x2d')][_0xf2a3('0x31')]));_0x3f199e[_0xf2a3('0x30')]=_0x3f199e[_0xf2a3('0x30')][_0xf2a3('0x32')]?_0x3f199e[_0xf2a3('0x30')]:_0x4417fa[_0xf2a3('0x2a')];if(_0x1c3151['query']['includeAll']){_0x3f199e[_0xf2a3('0x3e')]=[{'all':!![]}];}_0x3f199e=_[_0xf2a3('0x39')]({},_0x3f199e,_0x1c3151['options']);return db['FaxApplication']['find'](_0x3f199e)['then'](handleEntityNotFound(_0x1676e0,null))[_0xf2a3('0x23')](respondWithResult(_0x1676e0,null))[_0xf2a3('0x43')](handleError(_0x1676e0,null));};exports['create']=function(_0x3e4beb,_0x277f41){return db['FaxApplication'][_0xf2a3('0x44')](_0x3e4beb['body'],{})[_0xf2a3('0x23')](respondWithResult(_0x277f41,0xc9))[_0xf2a3('0x43')](handleError(_0x277f41,null));};exports[_0xf2a3('0x22')]=function(_0x417656,_0x86ec5e){if(_0x417656[_0xf2a3('0x45')]['id']){delete _0x417656[_0xf2a3('0x45')]['id'];}return db[_0xf2a3('0x26')][_0xf2a3('0x46')]({'where':{'id':_0x417656['params']['id']}})[_0xf2a3('0x23')](handleEntityNotFound(_0x86ec5e,null))[_0xf2a3('0x23')](saveUpdates(_0x417656[_0xf2a3('0x45')],null))['then'](respondWithResult(_0x86ec5e,null))[_0xf2a3('0x43')](handleError(_0x86ec5e,null));};exports[_0xf2a3('0x47')]=function(_0x168ad8,_0x177755){return db[_0xf2a3('0x26')][_0xf2a3('0x46')]({'where':{'id':_0x168ad8[_0xf2a3('0x42')]['id']}})[_0xf2a3('0x23')](handleEntityNotFound(_0x177755,null))[_0xf2a3('0x23')](removeEntity(_0x177755,null))[_0xf2a3('0x43')](handleError(_0x177755,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 16be9b3..0f95367 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 _0xdca0=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xdca0,0x139));var _0x0dca=function(_0x5b8f6d,_0x15ecd0){_0x5b8f6d=_0x5b8f6d-0x0;var _0x729fba=_0xdca0[_0x5b8f6d];return _0x729fba;};'use strict';var _=require(_0x0dca('0x0'));var util=require('util');var logger=require(_0x0dca('0x1'))(_0x0dca('0x2'));var moment=require(_0x0dca('0x3'));var BPromise=require(_0x0dca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0dca('0x5'));var config=require(_0x0dca('0x6'));var attributes=require(_0x0dca('0x7'));module[_0x0dca('0x8')]=function(_0x53b1d8,_0x2f1830){return _0x53b1d8[_0x0dca('0x9')](_0x0dca('0xa'),attributes,{'tableName':_0x0dca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dca('0xc'),'collate':_0x0dca('0xd')});}; \ No newline at end of file +var _0x5b99=['request-promise','path','./faxApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32c1e3,_0x1adfb7){var _0x3c7169=function(_0x5357d5){while(--_0x5357d5){_0x32c1e3['push'](_0x32c1e3['shift']());}};_0x3c7169(++_0x1adfb7);}(_0x5b99,0xba));var _0x95b9=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5b99[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0x95b9('0x0'));var util=require(_0x95b9('0x1'));var logger=require(_0x95b9('0x2'))(_0x95b9('0x3'));var moment=require(_0x95b9('0x4'));var BPromise=require(_0x95b9('0x5'));var rp=require(_0x95b9('0x6'));var fs=require('fs');var path=require(_0x95b9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x95b9('0x8'));module['exports']=function(_0x532d65,_0x4e6d71){return _0x532d65[_0x95b9('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95b9('0xa'),'collate':_0x95b9('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e32becd..deed91f 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 _0x5c6e=['options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','body'];(function(_0x38dcde,_0x321efd){var _0x20bc51=function(_0x174ae2){while(--_0x174ae2){_0x38dcde['push'](_0x38dcde['shift']());}};_0x20bc51(++_0x321efd);}(_0x5c6e,0x11c));var _0xe5c6=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x5c6e[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0xe5c6('0x0'));var util=require(_0xe5c6('0x1'));var moment=require(_0xe5c6('0x2'));var BPromise=require(_0xe5c6('0x3'));var rs=require(_0xe5c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe5c6('0x5'));var config=require(_0xe5c6('0x6'));var jayson=require(_0xe5c6('0x7'));var client=jayson[_0xe5c6('0x8')][_0xe5c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcdbe,_0x4f38d4,_0x1c036d){return new BPromise(function(_0x5a5901,_0x1c161d){return client[_0xe5c6('0xa')](_0x3bcdbe,_0x1c036d)[_0xe5c6('0xb')](function(_0x33b447){logger[_0xe5c6('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4f38d4,_0xe5c6('0xd'));logger[_0xe5c6('0xe')](_0xe5c6('0xf'),_0x4f38d4,_0xe5c6('0xd'),JSON[_0xe5c6('0x10')](_0x33b447));if(_0x33b447[_0xe5c6('0x11')]){if(_0x33b447[_0xe5c6('0x11')]['code']===0x1f4){logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x33b447[_0xe5c6('0x11')]['message']);return _0x1c161d(_0x33b447[_0xe5c6('0x11')][_0xe5c6('0x13')]);}logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x33b447['error'][_0xe5c6('0x13')]);return _0x5a5901(_0x33b447[_0xe5c6('0x11')][_0xe5c6('0x13')]);}else{logger[_0xe5c6('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4f38d4,'request\x20sent');_0x5a5901(_0x33b447[_0xe5c6('0x14')][_0xe5c6('0x13')]);}})[_0xe5c6('0x15')](function(_0x31ecd4){logger[_0xe5c6('0x11')](_0xe5c6('0x12'),_0x4f38d4,_0x31ecd4);_0x1c161d(_0x31ecd4);});});}exports[_0xe5c6('0x16')]=function(_0xf1ec98){var _0x509aee=this;return new Promise(function(_0x3811fb,_0xccd52a){return db['FaxApplication']['update'](_0xf1ec98[_0xe5c6('0x17')],{'raw':_0xf1ec98['options']?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x1a')]||null:null,'attributes':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')][_0xe5c6('0x1b')]||null:null,'limit':_0xf1ec98[_0xe5c6('0x18')]?_0xf1ec98[_0xe5c6('0x18')]['limit']||null:null})[_0xe5c6('0xb')](function(_0x4c61af){logger[_0xe5c6('0xc')](_0xe5c6('0x16'),_0xf1ec98);logger[_0xe5c6('0xe')](_0xe5c6('0x16'),_0xf1ec98,JSON[_0xe5c6('0x10')](_0x4c61af));_0x3811fb(_0x4c61af);})[_0xe5c6('0x15')](function(_0x52df61){logger['error']('UpdateFaxApplication',_0x52df61[_0xe5c6('0x13')],_0xf1ec98);_0xccd52a(_0x509aee[_0xe5c6('0x11')](0x1f4,_0x52df61[_0xe5c6('0x13')]));});});}; \ No newline at end of file +var _0xe7c4=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xe7c4,0xa3));var _0x4e7c=function(_0x3b53ca,_0x141d6e){_0x3b53ca=_0x3b53ca-0x0;var _0x416fdb=_0xe7c4[_0x3b53ca];return _0x416fdb;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require(_0x4e7c('0x6'))['db'];var utils=require(_0x4e7c('0x7'));var logger=require('../../config/logger')(_0x4e7c('0x8'));var config=require(_0x4e7c('0x9'));var jayson=require(_0x4e7c('0xa'));var client=jayson[_0x4e7c('0xb')][_0x4e7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x123620,_0x1441a5,_0x11c183){return new BPromise(function(_0x487dcb,_0x478050){return client['request'](_0x123620,_0x11c183)[_0x4e7c('0xd')](function(_0x1d1427){logger[_0x4e7c('0xe')](_0x4e7c('0xf'),_0x1441a5,_0x4e7c('0x10'));logger[_0x4e7c('0x11')](_0x4e7c('0x12'),_0x1441a5,_0x4e7c('0x10'),JSON[_0x4e7c('0x13')](_0x1d1427));if(_0x1d1427[_0x4e7c('0x14')]){if(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x15')]===0x1f4){logger[_0x4e7c('0x14')]('FaxApplication,\x20%s,\x20%s',_0x1441a5,_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);return _0x478050(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);}logger[_0x4e7c('0x14')](_0x4e7c('0xf'),_0x1441a5,_0x1d1427['error'][_0x4e7c('0x16')]);return _0x487dcb(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);}else{logger[_0x4e7c('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1441a5,_0x4e7c('0x10'));_0x487dcb(_0x1d1427[_0x4e7c('0x17')][_0x4e7c('0x16')]);}})[_0x4e7c('0x18')](function(_0xdf0a29){logger[_0x4e7c('0x14')](_0x4e7c('0xf'),_0x1441a5,_0xdf0a29);_0x478050(_0xdf0a29);});});}exports[_0x4e7c('0x19')]=function(_0x331776){var _0xbf7635=this;return new Promise(function(_0x32b6bf,_0x538aaa){return db[_0x4e7c('0x1a')][_0x4e7c('0x1b')](_0x331776[_0x4e7c('0x1c')],{'raw':_0x331776['options']?_0x331776[_0x4e7c('0x1d')][_0x4e7c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331776[_0x4e7c('0x1d')]?_0x331776['options'][_0x4e7c('0x1f')]||null:null,'attributes':_0x331776[_0x4e7c('0x1d')]?_0x331776['options'][_0x4e7c('0x20')]||null:null,'limit':_0x331776[_0x4e7c('0x1d')]?_0x331776['options'][_0x4e7c('0x21')]||null:null})[_0x4e7c('0xd')](function(_0xa0770a){logger[_0x4e7c('0xe')](_0x4e7c('0x19'),_0x331776);logger[_0x4e7c('0x11')](_0x4e7c('0x19'),_0x331776,JSON[_0x4e7c('0x13')](_0xa0770a));_0x32b6bf(_0xa0770a);})[_0x4e7c('0x18')](function(_0x4b1465){logger[_0x4e7c('0x14')]('UpdateFaxApplication',_0x4b1465['message'],_0x331776);_0x538aaa(_0xbf7635[_0x4e7c('0x14')](0x1f4,_0x4b1465[_0x4e7c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3dd4406..781bac1 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0xb09560,_0x4ab514){var _0x5bed15=function(_0x34363f){while(--_0x34363f){_0xb09560['push'](_0xb09560['shift']());}};_0x5bed15(++_0x4ab514);}(_0x4024,0x89));var _0x4402=function(_0x2252a1,_0x42aa3c){_0x2252a1=_0x2252a1-0x0;var _0x468d05=_0x4024[_0x2252a1];return _0x468d05;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0xd4a2=['../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router'];(function(_0x1b2dbd,_0x31e69b){var _0x1b3d6e=function(_0x5d1170){while(--_0x5d1170){_0x1b2dbd['push'](_0x1b2dbd['shift']());}};_0x1b3d6e(++_0x31e69b);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5bc5b9,_0x5005ee){_0x5bc5b9=_0x5bc5b9-0x0;var _0x2f3b32=_0xd4a2[_0x5bc5b9];return _0x2f3b32;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0xd')](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0xf')](_0x2d4a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 130e5a3..d55e681 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 _0xddf1=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2722c3,_0x1a1b6a){var _0x590fc7=function(_0x33b0d6){while(--_0x33b0d6){_0x2722c3['push'](_0x2722c3['shift']());}};_0x590fc7(++_0x1a1b6a);}(_0xddf1,0x1b2));var _0x1ddf=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xddf1[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x1ddf('0x0'));module[_0x1ddf('0x1')]={'closed':{'type':Sequelize[_0x1ddf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1ddf('0x3')]},'disposition':{'type':Sequelize[_0x1ddf('0x4')]},'secondDisposition':{'type':Sequelize[_0x1ddf('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1ddf('0x4')]},'note':{'type':Sequelize[_0x1ddf('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1ddf('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1ddf('0x5')]('in',_0x1ddf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1ddf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1ddf('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4edc=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x284997,_0x427c90){var _0x58bfcf=function(_0xe31b57){while(--_0xe31b57){_0x284997['push'](_0x284997['shift']());}};_0x58bfcf(++_0x427c90);}(_0x4edc,0xe0));var _0xc4ed=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x4edc[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0xc4ed('0x0'));module[_0xc4ed('0x1')]={'closed':{'type':Sequelize[_0xc4ed('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc4ed('0x3')]},'disposition':{'type':Sequelize[_0xc4ed('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc4ed('0x4')]},'note':{'type':Sequelize[_0xc4ed('0x4')]},'read1stAt':{'type':Sequelize[_0xc4ed('0x3')]},'fax':{'type':Sequelize[_0xc4ed('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc4ed('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc4ed('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc4ed('0x5')]('in',_0xc4ed('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 d8adac5..46bd83f 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 _0x45ce=['color','emit','faxInteractionTags:save','removeTags','download','unix','files','join','root','server','attachments','push','Attachment','Messages','mkdirSync','basename','existsSync','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','FaxInteraction','fieldName','type','key','findAll','fax','user','catch','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag'];(function(_0x33ae4e,_0x296713){var _0x49d4be=function(_0x113d53){while(--_0x113d53){_0x33ae4e['push'](_0x33ae4e['shift']());}};_0x49d4be(++_0x296713);}(_0x45ce,0x7e));var _0xe45c=function(_0x26a5c9,_0x4b19d0){_0x26a5c9=_0x26a5c9-0x0;var _0x374c47=_0x45ce[_0x26a5c9];return _0x374c47;};'use strict';var rimraf=require(_0xe45c('0x0'));var zipdir=require(_0xe45c('0x1'));var moment=require(_0xe45c('0x2'));var BPromise=require(_0xe45c('0x3'));var util=require('util');var path=require(_0xe45c('0x4'));var fs=require('fs');var _=require(_0xe45c('0x5'));var Redis=require(_0xe45c('0x6'));var interaction=require(_0xe45c('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xe45c('0x8'))(_0xe45c('0x9'));var config=require(_0xe45c('0xa'));var db=require('../../mysqldb')['db'];config[_0xe45c('0xb')]=_[_0xe45c('0xc')](config[_0xe45c('0xb')],{'host':_0xe45c('0xd'),'port':0x18eb});var socket=require(_0xe45c('0xe'))(new Redis(config[_0xe45c('0xb')]));require(_0xe45c('0xf'))[_0xe45c('0x10')](socket);function respondWithStatusCode(_0x12dabf,_0x225e25){_0x225e25=_0x225e25||0xcc;return function(_0xb1bd13){if(_0xb1bd13){return _0x12dabf[_0xe45c('0x11')](_0x225e25);}return _0x12dabf[_0xe45c('0x12')](_0x225e25)[_0xe45c('0x13')]();};}function respondWithResult(_0x5dfd04,_0x246943){_0x246943=_0x246943||0xc8;return function(_0x11ecdd){if(_0x11ecdd){return _0x5dfd04[_0xe45c('0x12')](_0x246943)['json'](_0x11ecdd);}};}function respondWithFilteredResult(_0x5406af,_0x10bf9a){return function(_0x502c81){if(_0x502c81){var _0x294cf5=typeof _0x10bf9a[_0xe45c('0x14')]===_0xe45c('0x15')&&typeof _0x10bf9a[_0xe45c('0x16')]===_0xe45c('0x15');var _0x12d018=_0x502c81[_0xe45c('0x17')];var _0x284761=_0x294cf5?0x0:_0x10bf9a[_0xe45c('0x14')];var _0x250146=_0x294cf5?_0x502c81[_0xe45c('0x17')]:_0x10bf9a['offset']+_0x10bf9a['limit'];var _0x6dfb22;if(_0x250146>=_0x12d018){_0x250146=_0x12d018;_0x6dfb22=0xc8;}else{_0x6dfb22=0xce;}_0x5406af[_0xe45c('0x12')](_0x6dfb22);return _0x5406af[_0xe45c('0x18')](_0xe45c('0x19'),_0x284761+'-'+_0x250146+'/'+_0x12d018)['json'](_0x502c81);}return null;};}function saveUpdates(_0x18eb4d){return function(_0x4cd63d){if(_0x4cd63d){return _0x4cd63d[_0xe45c('0x1a')](_0x18eb4d)[_0xe45c('0x1b')](function(_0x2ed0ab){return _0x2ed0ab;});}return null;};}function removeEntity(_0x18893e){return function(_0x4cd7e1){if(_0x4cd7e1){return _0x4cd7e1[_0xe45c('0x1c')]()[_0xe45c('0x1b')](function(){_0x18893e[_0xe45c('0x12')](0xcc)[_0xe45c('0x13')]();});}};}function handleEntityNotFound(_0x33020d){return function(_0xbb98d2){if(!_0xbb98d2){_0x33020d['sendStatus'](0x194);}return _0xbb98d2;};}function handleError(_0x127978,_0x39e087){_0x39e087=_0x39e087||0x1f4;return function(_0xdac6f7){logger[_0xe45c('0x1d')](_0xdac6f7['stack']);if(_0xdac6f7[_0xe45c('0x1e')]){delete _0xdac6f7[_0xe45c('0x1e')];}_0x127978[_0xe45c('0x12')](_0x39e087)[_0xe45c('0x1f')](_0xdac6f7);};}exports[_0xe45c('0x20')]=function(_0xad8fc5,_0x10daa6){var _0x503fc7={};var _0x12bae6=_['map'](db[_0xe45c('0x21')]['rawAttributes'],function(_0x5ca2d9){return{'name':_0x5ca2d9[_0xe45c('0x22')],'type':_0x5ca2d9[_0xe45c('0x23')][_0xe45c('0x24')]};});_0x503fc7=qs['getOptions'](_0x12bae6,_0xad8fc5);return interaction[_0xe45c('0x25')](_0xe45c('0x26'),_0xad8fc5['query'],_0xad8fc5[_0xe45c('0x27')],_0x503fc7,_0x12bae6)['then'](respondWithFilteredResult(_0x10daa6,_0x503fc7))[_0xe45c('0x28')](handleError(_0x10daa6,null));};exports[_0xe45c('0x29')]=function(_0x5f15b3,_0x46d891){var _0x1339c9={'raw':![],'where':{'id':_0x5f15b3[_0xe45c('0x2a')]['id']}},_0x5a7271={};_0x5a7271['model']=_[_0xe45c('0x2b')](db['FaxInteraction'][_0xe45c('0x2c')]);_0x5a7271[_0xe45c('0x2d')]=_['keys'](_0x5f15b3[_0xe45c('0x2d')]);_0x5a7271[_0xe45c('0x2e')]=_[_0xe45c('0x2f')](_0x5a7271[_0xe45c('0x30')],_0x5a7271[_0xe45c('0x2d')]);_0x1339c9[_0xe45c('0x31')]=_['intersection'](_0x5a7271[_0xe45c('0x30')],qs[_0xe45c('0x32')](_0x5f15b3[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x1339c9['attributes']=_0x1339c9[_0xe45c('0x31')][_0xe45c('0x33')]?_0x1339c9[_0xe45c('0x31')]:_0x5a7271[_0xe45c('0x30')];if(_0x5f15b3[_0xe45c('0x2d')][_0xe45c('0x34')]){_0x1339c9[_0xe45c('0x35')]=[{'all':!![]}];}_0x1339c9=_[_0xe45c('0x36')]({},_0x1339c9,_0x5f15b3[_0xe45c('0x37')]);return db['FaxInteraction'][_0xe45c('0x38')](_0x1339c9)['then'](handleEntityNotFound(_0x46d891,null))[_0xe45c('0x1b')](respondWithResult(_0x46d891,null))[_0xe45c('0x28')](handleError(_0x46d891,null));};exports[_0xe45c('0x39')]=function(_0x56750e,_0x47362b){return db['FaxInteraction'][_0xe45c('0x39')](_0x56750e[_0xe45c('0x3a')],{})['then'](respondWithResult(_0x47362b,0xc9))[_0xe45c('0x28')](handleError(_0x47362b,null));};exports[_0xe45c('0x1a')]=function(_0x118a47,_0x332a03){if(_0x118a47['body']['id']){delete _0x118a47[_0xe45c('0x3a')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x118a47[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x332a03,null))[_0xe45c('0x1b')](saveUpdates(_0x118a47['body'],null))[_0xe45c('0x1b')](respondWithResult(_0x332a03,null))[_0xe45c('0x28')](handleError(_0x332a03,null));};exports[_0xe45c('0x1c')]=function(_0x4a7ae7,_0xd4693a){return db[_0xe45c('0x21')][_0xe45c('0x38')]({'where':{'id':_0x4a7ae7['params']['id']}})['then'](handleEntityNotFound(_0xd4693a,null))['then'](removeEntity(_0xd4693a,null))['catch'](handleError(_0xd4693a,null));};exports['describe']=function(_0x107d2e,_0x26c145){return db[_0xe45c('0x21')][_0xe45c('0x3b')]()[_0xe45c('0x1b')](respondWithResult(_0x26c145,null))[_0xe45c('0x28')](handleError(_0x26c145,null));};exports[_0xe45c('0x3c')]=function(_0x1b54b4,_0x53d8e7){return db[_0xe45c('0x3d')][_0xe45c('0x38')]({'where':{'id':_0x1b54b4[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x53d8e7,null))[_0xe45c('0x1b')](function(_0x409a27){if(_0x409a27){return _0x409a27[_0xe45c('0x3c')](_0x1b54b4[_0xe45c('0x3a')][_0xe45c('0x3e')],_['omit'](_0x1b54b4[_0xe45c('0x3a')],['ids','id'])||{});}})[_0xe45c('0x1b')](respondWithResult(_0x53d8e7,null))[_0xe45c('0x28')](handleError(_0x53d8e7,null));};exports['getMessages']=function(_0x1328cb,_0x487e53){var _0x380001={'raw':![],'where':{}};var _0x561f69={};var _0x1121ca={'count':0x0,'rows':[]};return db[_0xe45c('0x21')][_0xe45c('0x3f')]({'where':{'id':_0x1328cb[_0xe45c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x487e53,null))[_0xe45c('0x1b')](function(_0x4eb3c0){if(_0x4eb3c0){_0x561f69[_0xe45c('0x30')]=_[_0xe45c('0x2b')](db[_0xe45c('0x3d')][_0xe45c('0x2c')]);_0x561f69[_0xe45c('0x2d')]=_[_0xe45c('0x2b')](_0x1328cb['query']);_0x561f69[_0xe45c('0x2e')]=_['intersection'](_0x561f69[_0xe45c('0x30')],_0x561f69['query']);_0x380001[_0xe45c('0x31')]=_[_0xe45c('0x2f')](_0x561f69['model'],qs[_0xe45c('0x32')](_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x32')]));_0x380001[_0xe45c('0x31')]=_0x380001[_0xe45c('0x31')][_0xe45c('0x33')]?_0x380001[_0xe45c('0x31')]:_0x561f69[_0xe45c('0x30')];if(!_0x1328cb['query'][_0xe45c('0x40')](_0xe45c('0x41'))){_0x380001['limit']=qs[_0xe45c('0x16')](_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x16')]);_0x380001['offset']=qs[_0xe45c('0x14')](_0x1328cb[_0xe45c('0x2d')]['offset']);}_0x380001[_0xe45c('0x42')]=qs[_0xe45c('0x43')](_0x1328cb[_0xe45c('0x2d')]['sort']);_0x380001[_0xe45c('0x44')]=qs[_0xe45c('0x2e')](_[_0xe45c('0x45')](_0x1328cb[_0xe45c('0x2d')],_0x561f69['filters']));_0x380001[_0xe45c('0x44')][_0xe45c('0x46')]=_0x4eb3c0['id'];if(_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x47')]){_0x380001[_0xe45c('0x44')]=_['merge'](_0x380001[_0xe45c('0x44')],{'$or':_['map'](_0x380001[_0xe45c('0x31')],function(_0x296b6f){var _0x43d100={};_0x43d100[_0x296b6f]={'$like':'%'+_0x1328cb['query'][_0xe45c('0x47')]+'%'};return _0x43d100;})});}if(_0x1328cb['query'][_0xe45c('0x48')]){var _0x557013=_0x1328cb[_0xe45c('0x2d')][_0xe45c('0x48')][_0xe45c('0x49')](',');var _0x171de={};_0x171de[_0x557013[0x0]]={'$gte':moment(_0x557013[0x1])[_0xe45c('0x4a')](_0xe45c('0x4b'))};_0x380001[_0xe45c('0x44')]=_[_0xe45c('0x36')](_0x380001[_0xe45c('0x44')],_0x171de);}_0x380001=_[_0xe45c('0x36')]({},_0x380001,_0x1328cb['options']);return db[_0xe45c('0x3d')][_0xe45c('0x17')]({'where':_0x380001['where']})['then'](function(_0x2a2dad){_0x1121ca[_0xe45c('0x17')]=_0x2a2dad;if(_0x1328cb[_0xe45c('0x2d')]['includeAll']){_0x380001[_0xe45c('0x35')]=[{'all':!![]}];}return db['FaxMessage'][_0xe45c('0x25')](_0x380001);})[_0xe45c('0x1b')](function(_0x38e758){_0x1121ca[_0xe45c('0x4c')]=_0x38e758;return _0x1121ca;});}})[_0xe45c('0x1b')](respondWithFilteredResult(_0x487e53,_0x380001))[_0xe45c('0x28')](handleError(_0x487e53,null));};exports[_0xe45c('0x4d')]=function(_0x464627,_0x1ee281){return db[_0xe45c('0x21')]['find']({'where':{'id':_0x464627[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x1ee281,null))[_0xe45c('0x1b')](function(_0x1d8a8d){if(_0x1d8a8d){return _0x1d8a8d[_0xe45c('0x4e')](_0x464627[_0xe45c('0x3a')][_0xe45c('0x3e')],_[_0xe45c('0x4f')](_0x464627[_0xe45c('0x3a')],[_0xe45c('0x3e'),'id'])||{})[_0xe45c('0x50')](function(){return db[_0xe45c('0x51')][_0xe45c('0x25')]({'attributes':['id',_0xe45c('0x1e'),_0xe45c('0x52')],'where':{'id':_0x464627[_0xe45c('0x3a')][_0xe45c('0x3e')]}});})[_0xe45c('0x1b')](function(_0x14e191){socket[_0xe45c('0x53')](_0xe45c('0x54'),{'id':Number(_0x464627[_0xe45c('0x2a')]['id']),'tags':_0x14e191||[]});return{'id':Number(_0x464627[_0xe45c('0x2a')]['id']),'tags':_0x14e191||[]};});}})[_0xe45c('0x1b')](respondWithResult(_0x1ee281,null))[_0xe45c('0x28')](handleError(_0x1ee281,null));};exports[_0xe45c('0x55')]=function(_0x4782e8,_0x76feed){return db[_0xe45c('0x21')]['find']({'where':{'id':_0x4782e8[_0xe45c('0x2a')]['id']}})[_0xe45c('0x1b')](handleEntityNotFound(_0x76feed,null))['then'](function(_0x137e2d){if(_0x137e2d){return _0x137e2d[_0xe45c('0x55')](_0x4782e8[_0xe45c('0x2d')][_0xe45c('0x3e')]);}})[_0xe45c('0x1b')](respondWithStatusCode(_0x76feed,null))[_0xe45c('0x28')](handleError(_0x76feed,null));};exports[_0xe45c('0x56')]=function(_0xbbe349,_0x3668c5){var _0xf71a1f=moment()[_0xe45c('0x57')]()['toString']();var _0x3c3c59=path['join'](config['root'],'server',_0xe45c('0x58'),'tmp');var _0x43429a=path[_0xe45c('0x59')](config[_0xe45c('0x5a')],_0xe45c('0x5b'),_0xe45c('0x58'),_0xe45c('0x5c'));var _0x54d9c3=path[_0xe45c('0x59')](_0x3c3c59,_0xf71a1f);var _0x231498=util['format']('transcript-%d-%s.zip',_0xbbe349[_0xe45c('0x2a')]['id'],_0xf71a1f);var _0x1358ae=path[_0xe45c('0x59')](_0x3c3c59,_0x231498);var _0x1a89a9=[];_0x1a89a9[_0xe45c('0x5d')]({'model':db['Attachment'],'as':_0xe45c('0x5e'),'raw':!![]});var _0x272260=[{'model':db['FaxMessage'],'as':_0xe45c('0x5f'),'attributes':['id',_0xe45c('0x3a'),'createdAt'],'include':_0x1a89a9}];return db[_0xe45c('0x21')]['find']({'where':{'id':_0xbbe349[_0xe45c('0x2a')]['id']},'include':_0x272260})[_0xe45c('0x1b')](handleEntityNotFound(_0x3668c5,null))[_0xe45c('0x1b')](function(_0x5aff92){if(_0x5aff92&&_0x5aff92[_0xe45c('0x5f')]){var _0x1e04e8=_0x5aff92['get']({'plain':!![]});fs[_0xe45c('0x60')](_0x54d9c3);for(var _0x4f42a1=0x0;_0x4f42a1<_0x1e04e8[_0xe45c('0x5f')][_0xe45c('0x33')];_0x4f42a1++){var _0x27ed5a=_0x1e04e8['Messages'][_0x4f42a1][_0xe45c('0x5e')];if(_0x27ed5a){var _0x135b0b=path[_0xe45c('0x59')](_0x43429a,_0x27ed5a[_0xe45c('0x61')]);if(fs[_0xe45c('0x62')](_0x135b0b)){fs['createReadStream'](_0x135b0b)['pipe'](fs[_0xe45c('0x63')](path['join'](_0x54d9c3,_0x27ed5a[_0xe45c('0x61')])));}}}return BPromise[_0xe45c('0x64')]()[_0xe45c('0x1b')](function(){return new BPromise(function(_0x34fc6d,_0x58c12e){zipdir(_0x54d9c3,{'saveTo':_0x1358ae},function(_0x5006dc,_0x29e10c){if(_0x5006dc)return _0x58c12e(_0x5006dc);return _0x34fc6d(_0x29e10c);});})[_0xe45c('0x1b')](function(){return new BPromise(function(_0x389d3b,_0x197744){rimraf(_0x54d9c3,function(_0xdef4e){if(_0xdef4e)_0x197744(_0xdef4e);return _0x389d3b();});});})['then'](function(){return _0x3668c5[_0xe45c('0x56')](_0x1358ae,_0x231498,function(_0x98c6c5){if(_0x98c6c5){console[_0xe45c('0x65')](_0xe45c('0x66'),_0x98c6c5);}else{fs[_0xe45c('0x67')](_0x1358ae);}});});});}else{return _0x3668c5['sendStatus'](0xc8);}})[_0xe45c('0x28')](handleError(_0x3668c5,null));}; \ No newline at end of file +var _0xb73a=['catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','findOne','nolimit','order','sort','where','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','zip-dir','moment','bluebird','util','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','user'];(function(_0x3f25c4,_0x7d5eb5){var _0x2b213d=function(_0x4d0381){while(--_0x4d0381){_0x3f25c4['push'](_0x3f25c4['shift']());}};_0x2b213d(++_0x7d5eb5);}(_0xb73a,0x17a));var _0xab73=function(_0x1c5037,_0x52e4d0){_0x1c5037=_0x1c5037-0x0;var _0x1e6ead=_0xb73a[_0x1c5037];return _0x1e6ead;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xab73('0x0'));var moment=require(_0xab73('0x1'));var BPromise=require(_0xab73('0x2'));var util=require(_0xab73('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xab73('0x4'));var interaction=require(_0xab73('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xab73('0x6'))('api');var config=require(_0xab73('0x7'));var db=require(_0xab73('0x8'))['db'];config[_0xab73('0x9')]=_[_0xab73('0xa')](config[_0xab73('0x9')],{'host':_0xab73('0xb'),'port':0x18eb});var socket=require(_0xab73('0xc'))(new Redis(config[_0xab73('0x9')]));require('./faxInteraction.socket')[_0xab73('0xd')](socket);function respondWithStatusCode(_0x3c24c5,_0x18cd64){_0x18cd64=_0x18cd64||0xcc;return function(_0x4b6588){if(_0x4b6588){return _0x3c24c5[_0xab73('0xe')](_0x18cd64);}return _0x3c24c5[_0xab73('0xf')](_0x18cd64)[_0xab73('0x10')]();};}function respondWithResult(_0x20f0a0,_0x3db95a){_0x3db95a=_0x3db95a||0xc8;return function(_0x50a222){if(_0x50a222){return _0x20f0a0[_0xab73('0xf')](_0x3db95a)[_0xab73('0x11')](_0x50a222);}};}function respondWithFilteredResult(_0x2dcf40,_0x9fdaa3){return function(_0x54cad4){if(_0x54cad4){var _0x32fa9=typeof _0x9fdaa3[_0xab73('0x12')]===_0xab73('0x13')&&typeof _0x9fdaa3[_0xab73('0x14')]===_0xab73('0x13');var _0x2268bb=_0x54cad4[_0xab73('0x15')];var _0x306bd0=_0x32fa9?0x0:_0x9fdaa3['offset'];var _0x313d91=_0x32fa9?_0x54cad4[_0xab73('0x15')]:_0x9fdaa3[_0xab73('0x12')]+_0x9fdaa3[_0xab73('0x14')];var _0x50d8f4;if(_0x313d91>=_0x2268bb){_0x313d91=_0x2268bb;_0x50d8f4=0xc8;}else{_0x50d8f4=0xce;}_0x2dcf40[_0xab73('0xf')](_0x50d8f4);return _0x2dcf40[_0xab73('0x16')](_0xab73('0x17'),_0x306bd0+'-'+_0x313d91+'/'+_0x2268bb)[_0xab73('0x11')](_0x54cad4);}return null;};}function saveUpdates(_0x5575c3){return function(_0x2e4f3a){if(_0x2e4f3a){return _0x2e4f3a[_0xab73('0x18')](_0x5575c3)[_0xab73('0x19')](function(_0x2fda14){return _0x2fda14;});}return null;};}function removeEntity(_0x53d4c3){return function(_0x4c6b7c){if(_0x4c6b7c){return _0x4c6b7c[_0xab73('0x1a')]()[_0xab73('0x19')](function(){_0x53d4c3[_0xab73('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcaa5){return function(_0x46a758){if(!_0x46a758){_0x1bcaa5[_0xab73('0xe')](0x194);}return _0x46a758;};}function handleError(_0xb14c66,_0x928cf4){_0x928cf4=_0x928cf4||0x1f4;return function(_0x4b4366){logger[_0xab73('0x1b')](_0x4b4366[_0xab73('0x1c')]);if(_0x4b4366[_0xab73('0x1d')]){delete _0x4b4366['name'];}_0xb14c66[_0xab73('0xf')](_0x928cf4)[_0xab73('0x1e')](_0x4b4366);};}exports[_0xab73('0x1f')]=function(_0x588b7b,_0x1dc38d){var _0x3975f8={};var _0x229666=_[_0xab73('0x20')](db[_0xab73('0x21')][_0xab73('0x22')],function(_0x53e72b){return{'name':_0x53e72b[_0xab73('0x23')],'type':_0x53e72b[_0xab73('0x24')][_0xab73('0x25')]};});_0x3975f8=qs[_0xab73('0x26')](_0x229666,_0x588b7b);return interaction['findAll'](_0xab73('0x27'),_0x588b7b[_0xab73('0x28')],_0x588b7b[_0xab73('0x29')],_0x3975f8,_0x229666)[_0xab73('0x19')](respondWithFilteredResult(_0x1dc38d,_0x3975f8))[_0xab73('0x2a')](handleError(_0x1dc38d,null));};exports[_0xab73('0x2b')]=function(_0x28e620,_0xdb950c){var _0x59aa85={'raw':![],'where':{'id':_0x28e620[_0xab73('0x2c')]['id']}},_0x1e6d9a={};_0x1e6d9a[_0xab73('0x2d')]=_[_0xab73('0x2e')](db[_0xab73('0x21')][_0xab73('0x22')]);_0x1e6d9a[_0xab73('0x28')]=_[_0xab73('0x2e')](_0x28e620[_0xab73('0x28')]);_0x1e6d9a[_0xab73('0x2f')]=_[_0xab73('0x30')](_0x1e6d9a['model'],_0x1e6d9a[_0xab73('0x28')]);_0x59aa85[_0xab73('0x31')]=_['intersection'](_0x1e6d9a[_0xab73('0x2d')],qs[_0xab73('0x32')](_0x28e620['query']['fields']));_0x59aa85[_0xab73('0x31')]=_0x59aa85[_0xab73('0x31')][_0xab73('0x33')]?_0x59aa85['attributes']:_0x1e6d9a[_0xab73('0x2d')];if(_0x28e620[_0xab73('0x28')][_0xab73('0x34')]){_0x59aa85[_0xab73('0x35')]=[{'all':!![]}];}_0x59aa85=_[_0xab73('0x36')]({},_0x59aa85,_0x28e620[_0xab73('0x37')]);return db['FaxInteraction']['find'](_0x59aa85)[_0xab73('0x19')](handleEntityNotFound(_0xdb950c,null))[_0xab73('0x19')](respondWithResult(_0xdb950c,null))[_0xab73('0x2a')](handleError(_0xdb950c,null));};exports[_0xab73('0x38')]=function(_0x5e55a7,_0x1f468f){return db[_0xab73('0x21')][_0xab73('0x38')](_0x5e55a7['body'],{})['then'](respondWithResult(_0x1f468f,0xc9))[_0xab73('0x2a')](handleError(_0x1f468f,null));};exports[_0xab73('0x18')]=function(_0x58b73f,_0x2a7b37){if(_0x58b73f[_0xab73('0x39')]['id']){delete _0x58b73f['body']['id'];}return db[_0xab73('0x21')][_0xab73('0x3a')]({'where':{'id':_0x58b73f[_0xab73('0x2c')]['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x2a7b37,null))[_0xab73('0x19')](saveUpdates(_0x58b73f[_0xab73('0x39')],null))[_0xab73('0x19')](respondWithResult(_0x2a7b37,null))[_0xab73('0x2a')](handleError(_0x2a7b37,null));};exports[_0xab73('0x1a')]=function(_0x3bb83e,_0x216164){return db[_0xab73('0x21')][_0xab73('0x3a')]({'where':{'id':_0x3bb83e[_0xab73('0x2c')]['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x216164,null))[_0xab73('0x19')](removeEntity(_0x216164,null))[_0xab73('0x2a')](handleError(_0x216164,null));};exports[_0xab73('0x3b')]=function(_0x21cf52,_0x24cab9){return db[_0xab73('0x21')][_0xab73('0x3b')]()[_0xab73('0x19')](respondWithResult(_0x24cab9,null))[_0xab73('0x2a')](handleError(_0x24cab9,null));};exports[_0xab73('0x3c')]=function(_0xf49c3c,_0x1c1bbc){return db[_0xab73('0x3d')][_0xab73('0x3a')]({'where':{'id':_0xf49c3c[_0xab73('0x2c')]['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x1c1bbc,null))[_0xab73('0x19')](function(_0x349510){if(_0x349510){return _0x349510[_0xab73('0x3c')](_0xf49c3c[_0xab73('0x39')][_0xab73('0x3e')],_[_0xab73('0x3f')](_0xf49c3c[_0xab73('0x39')],[_0xab73('0x3e'),'id'])||{});}})[_0xab73('0x19')](respondWithResult(_0x1c1bbc,null))['catch'](handleError(_0x1c1bbc,null));};exports['getMessages']=function(_0x3b63ea,_0x54a02c){var _0x50ae92={'raw':![],'where':{}};var _0x225480={};var _0x5837e2={'count':0x0,'rows':[]};return db[_0xab73('0x21')][_0xab73('0x40')]({'where':{'id':_0x3b63ea[_0xab73('0x2c')]['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x54a02c,null))[_0xab73('0x19')](function(_0x5722e3){if(_0x5722e3){_0x225480[_0xab73('0x2d')]=_[_0xab73('0x2e')](db[_0xab73('0x3d')][_0xab73('0x22')]);_0x225480[_0xab73('0x28')]=_[_0xab73('0x2e')](_0x3b63ea['query']);_0x225480['filters']=_[_0xab73('0x30')](_0x225480[_0xab73('0x2d')],_0x225480[_0xab73('0x28')]);_0x50ae92['attributes']=_[_0xab73('0x30')](_0x225480['model'],qs[_0xab73('0x32')](_0x3b63ea[_0xab73('0x28')][_0xab73('0x32')]));_0x50ae92[_0xab73('0x31')]=_0x50ae92['attributes']['length']?_0x50ae92[_0xab73('0x31')]:_0x225480[_0xab73('0x2d')];if(!_0x3b63ea[_0xab73('0x28')]['hasOwnProperty'](_0xab73('0x41'))){_0x50ae92[_0xab73('0x14')]=qs[_0xab73('0x14')](_0x3b63ea[_0xab73('0x28')][_0xab73('0x14')]);_0x50ae92['offset']=qs[_0xab73('0x12')](_0x3b63ea[_0xab73('0x28')][_0xab73('0x12')]);}_0x50ae92[_0xab73('0x42')]=qs[_0xab73('0x43')](_0x3b63ea['query'][_0xab73('0x43')]);_0x50ae92[_0xab73('0x44')]=qs[_0xab73('0x2f')](_[_0xab73('0x45')](_0x3b63ea[_0xab73('0x28')],_0x225480[_0xab73('0x2f')]));_0x50ae92[_0xab73('0x44')]['FaxInteractionId']=_0x5722e3['id'];if(_0x3b63ea[_0xab73('0x28')]['filter']){_0x50ae92[_0xab73('0x44')]=_[_0xab73('0x36')](_0x50ae92[_0xab73('0x44')],{'$or':_[_0xab73('0x20')](_0x50ae92[_0xab73('0x31')],function(_0x9d4fc1){var _0x44377e={};_0x44377e[_0x9d4fc1]={'$like':'%'+_0x3b63ea['query']['filter']+'%'};return _0x44377e;})});}if(_0x3b63ea[_0xab73('0x28')][_0xab73('0x46')]){var _0xce5c6f=_0x3b63ea[_0xab73('0x28')][_0xab73('0x46')]['split'](',');var _0x5c2f35={};_0x5c2f35[_0xce5c6f[0x0]]={'$gte':moment(_0xce5c6f[0x1])['format'](_0xab73('0x47'))};_0x50ae92[_0xab73('0x44')]=_['merge'](_0x50ae92['where'],_0x5c2f35);}_0x50ae92=_['merge']({},_0x50ae92,_0x3b63ea['options']);return db[_0xab73('0x3d')]['count']({'where':_0x50ae92[_0xab73('0x44')]})[_0xab73('0x19')](function(_0x325468){_0x5837e2['count']=_0x325468;if(_0x3b63ea['query'][_0xab73('0x34')]){_0x50ae92['include']=[{'all':!![]}];}return db[_0xab73('0x3d')][_0xab73('0x48')](_0x50ae92);})[_0xab73('0x19')](function(_0x32320a){_0x5837e2[_0xab73('0x49')]=_0x32320a;return _0x5837e2;});}})[_0xab73('0x19')](respondWithFilteredResult(_0x54a02c,_0x50ae92))[_0xab73('0x2a')](handleError(_0x54a02c,null));};exports[_0xab73('0x4a')]=function(_0x5b75f8,_0x1f80a6){return db[_0xab73('0x21')][_0xab73('0x3a')]({'where':{'id':_0x5b75f8['params']['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x1f80a6,null))[_0xab73('0x19')](function(_0x310311){if(_0x310311){return _0x310311[_0xab73('0x4b')](_0x5b75f8[_0xab73('0x39')][_0xab73('0x3e')],_['omit'](_0x5b75f8[_0xab73('0x39')],[_0xab73('0x3e'),'id'])||{})[_0xab73('0x4c')](function(){return db[_0xab73('0x4d')][_0xab73('0x48')]({'attributes':['id','name',_0xab73('0x4e')],'where':{'id':_0x5b75f8['body']['ids']}});})[_0xab73('0x19')](function(_0x5ca54a){socket[_0xab73('0x4f')](_0xab73('0x50'),{'id':Number(_0x5b75f8['params']['id']),'tags':_0x5ca54a||[]});return{'id':Number(_0x5b75f8[_0xab73('0x2c')]['id']),'tags':_0x5ca54a||[]};});}})[_0xab73('0x19')](respondWithResult(_0x1f80a6,null))[_0xab73('0x2a')](handleError(_0x1f80a6,null));};exports[_0xab73('0x51')]=function(_0xbd4718,_0x5f5095){return db[_0xab73('0x21')][_0xab73('0x3a')]({'where':{'id':_0xbd4718[_0xab73('0x2c')]['id']}})[_0xab73('0x19')](handleEntityNotFound(_0x5f5095,null))[_0xab73('0x19')](function(_0x135a13){if(_0x135a13){return _0x135a13[_0xab73('0x51')](_0xbd4718['query'][_0xab73('0x3e')]);}})[_0xab73('0x19')](respondWithStatusCode(_0x5f5095,null))[_0xab73('0x2a')](handleError(_0x5f5095,null));};exports[_0xab73('0x52')]=function(_0x4069a6,_0x343aea){var _0x1d851f=moment()[_0xab73('0x53')]()[_0xab73('0x54')]();var _0x5c01dc=path[_0xab73('0x55')](config[_0xab73('0x56')],_0xab73('0x57'),_0xab73('0x58'),_0xab73('0x59'));var _0x173c7a=path[_0xab73('0x55')](config[_0xab73('0x56')],'server',_0xab73('0x58'),_0xab73('0x5a'));var _0x10982a=path[_0xab73('0x55')](_0x5c01dc,_0x1d851f);var _0x361fbb=util[_0xab73('0x5b')](_0xab73('0x5c'),_0x4069a6[_0xab73('0x2c')]['id'],_0x1d851f);var _0x57d386=path[_0xab73('0x55')](_0x5c01dc,_0x361fbb);var _0x39085b=[];_0x39085b[_0xab73('0x5d')]({'model':db[_0xab73('0x5e')],'as':_0xab73('0x5e'),'raw':!![]});var _0x49bd44=[{'model':db[_0xab73('0x3d')],'as':_0xab73('0x5f'),'attributes':['id',_0xab73('0x39'),'createdAt'],'include':_0x39085b}];return db['FaxInteraction'][_0xab73('0x3a')]({'where':{'id':_0x4069a6['params']['id']},'include':_0x49bd44})[_0xab73('0x19')](handleEntityNotFound(_0x343aea,null))[_0xab73('0x19')](function(_0x3cb87e){if(_0x3cb87e&&_0x3cb87e[_0xab73('0x5f')]){var _0x314985=_0x3cb87e[_0xab73('0x60')]({'plain':!![]});fs[_0xab73('0x61')](_0x10982a);for(var _0x2de916=0x0;_0x2de916<_0x314985[_0xab73('0x5f')][_0xab73('0x33')];_0x2de916++){var _0x16a552=_0x314985[_0xab73('0x5f')][_0x2de916][_0xab73('0x5e')];if(_0x16a552){var _0x5d0773=path[_0xab73('0x55')](_0x173c7a,_0x16a552[_0xab73('0x62')]);if(fs[_0xab73('0x63')](_0x5d0773)){fs[_0xab73('0x64')](_0x5d0773)[_0xab73('0x65')](fs[_0xab73('0x66')](path[_0xab73('0x55')](_0x10982a,_0x16a552[_0xab73('0x62')])));}}}return BPromise['resolve']()[_0xab73('0x19')](function(){return new BPromise(function(_0x3603a9,_0x28f891){zipdir(_0x10982a,{'saveTo':_0x57d386},function(_0xb3cfe7,_0x5cf63c){if(_0xb3cfe7)return _0x28f891(_0xb3cfe7);return _0x3603a9(_0x5cf63c);});})['then'](function(){return new BPromise(function(_0x5bd853,_0x4d7628){rimraf(_0x10982a,function(_0x2c65d7){if(_0x2c65d7)_0x4d7628(_0x2c65d7);return _0x5bd853();});});})[_0xab73('0x19')](function(){return _0x343aea[_0xab73('0x52')](_0x57d386,_0x361fbb,function(_0x58f023){if(_0x58f023){console[_0xab73('0x67')]('err',_0x58f023);}else{fs[_0xab73('0x68')](_0x57d386);}});});});}else{return _0x343aea[_0xab73('0xe')](0xc8);}})[_0xab73('0x2a')](handleError(_0x343aea,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bb158aa..b78224f 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 _0x7a66=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x7a66,0x6c));var _0x67a6=function(_0x401d81,_0x4fc6f0){_0x401d81=_0x401d81-0x0;var _0x17ac0b=_0x7a66[_0x401d81];return _0x17ac0b;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x67a6('0x0'))['db'][_0x67a6('0x1')];var FaxMessage=require(_0x67a6('0x0'))['db'][_0x67a6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x67a6('0x3')](0x0);var events={'afterCreate':_0x67a6('0x4'),'afterUpdate':_0x67a6('0x5'),'afterDestroy':_0x67a6('0x6')};function emitEvent(_0x128e20){return function(_0x2b35d4,_0x451e20,_0x113dbc){_0x2b35d4[_0x67a6('0x7')]({'attributes':['id'],'raw':!![]})[_0x67a6('0x8')](function(_0x2adf2e){_0x2b35d4['setDataValue']('Users',_0x2adf2e[_0x67a6('0x9')](function(_0x293eec){return{'id':_0x293eec['id']};}));return FaxMessage[_0x67a6('0xa')]({'where':{'FaxInteractionId':_0x2b35d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x67a6('0x8')](function(_0x559c78){_0x2b35d4[_0x67a6('0xb')](_0x67a6('0xc'),_0x559c78['length']);FaxInteractionEvents[_0x67a6('0xd')](_0x128e20+':'+_0x2b35d4['id'],_0x2b35d4);FaxInteractionEvents[_0x67a6('0xd')](_0x128e20,_0x2b35d4);_0x113dbc(null);})[_0x67a6('0xe')](_0x113dbc(null));};}for(var e in events){if(events[_0x67a6('0xf')](e)){var event=events[e];FaxInteraction[_0x67a6('0x10')](e,emitEvent(event));}}module[_0x67a6('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xccd1=['emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','then','setDataValue','Users','findAll','unreadMessages'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xccd1,0x165));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1ccd('0x0'))['db'][_0x1ccd('0x1')];var FaxMessage=require(_0x1ccd('0x0'))['db'][_0x1ccd('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1ccd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ccd('0x4'),'afterDestroy':_0x1ccd('0x5')};function emitEvent(_0x32e5ef){return function(_0x250b31,_0x2f48d4,_0x4e44dd){_0x250b31['getUsers']({'attributes':['id'],'raw':!![]})[_0x1ccd('0x6')](function(_0x3539e1){_0x250b31[_0x1ccd('0x7')](_0x1ccd('0x8'),_0x3539e1['map'](function(_0x41430f){return{'id':_0x41430f['id']};}));return FaxMessage[_0x1ccd('0x9')]({'where':{'FaxInteractionId':_0x250b31['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1ccd('0x6')](function(_0x46e87e){_0x250b31['setDataValue'](_0x1ccd('0xa'),_0x46e87e['length']);FaxInteractionEvents['emit'](_0x32e5ef+':'+_0x250b31['id'],_0x250b31);FaxInteractionEvents[_0x1ccd('0xb')](_0x32e5ef,_0x250b31);_0x4e44dd(null);})[_0x1ccd('0xc')](_0x4e44dd(null));};}for(var e in events){if(events[_0x1ccd('0xd')](e)){var event=events[e];FaxInteraction[_0x1ccd('0xe')](e,emitEvent(event));}}module[_0x1ccd('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ec798a5..fb2a6cf 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 _0xc035=['rimraf','exports','define','FaxInteraction','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc035,0xf6));var _0x5c03=function(_0xb90119,_0xfa02ab){_0xb90119=_0xb90119-0x0;var _0xf2a023=_0xc035[_0xb90119];return _0xf2a023;};'use strict';var _=require(_0x5c03('0x0'));var util=require('util');var logger=require(_0x5c03('0x1'))(_0x5c03('0x2'));var moment=require(_0x5c03('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c03('0x4'));var fs=require('fs');var path=require(_0x5c03('0x5'));var rimraf=require(_0x5c03('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x5c03('0x7')]=function(_0x50c273,_0x518514){return _0x50c273[_0x5c03('0x8')](_0x5c03('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x412c2f,_0x7469ff,_0x4243f8){if(_0x412c2f['changed']('closed')){_0x412c2f['closedAt']=moment()[_0x5c03('0xa')](_0x5c03('0xb'));}_0x4243f8(null,_0x412c2f);}}});}; \ No newline at end of file +var _0xca9e=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports'];(function(_0x2951ec,_0x35dff1){var _0x23570e=function(_0x9fa261){while(--_0x9fa261){_0x2951ec['push'](_0x2951ec['shift']());}};_0x23570e(++_0x35dff1);}(_0xca9e,0x167));var _0xeca9=function(_0x17e312,_0x10bcea){_0x17e312=_0x17e312-0x0;var _0x5d7e6e=_0xca9e[_0x17e312];return _0x5d7e6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeca9('0x0'))(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));var BPromise=require(_0xeca9('0x3'));var rp=require(_0xeca9('0x4'));var fs=require('fs');var path=require(_0xeca9('0x5'));var rimraf=require(_0xeca9('0x6'));var config=require('../../config/environment');var attributes=require(_0xeca9('0x7'));module[_0xeca9('0x8')]=function(_0x409ae7,_0x1d8cc5){return _0x409ae7['define'](_0xeca9('0x9'),attributes,{'tableName':_0xeca9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28d0b8,_0x6ea683,_0x4ad914){if(_0x28d0b8[_0xeca9('0xb')](_0xeca9('0xc'))){_0x28d0b8[_0xeca9('0xd')]=moment()[_0xeca9('0xe')](_0xeca9('0xf'));}_0x4ad914(null,_0x28d0b8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 5784eea..ccdd76a 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 _0x01a2=['error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','debug','FaxInteraction','find','addTags','ids','spread','stringify','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x652c98,_0x5d5e1e){var _0x3a2753=function(_0x29c01f){while(--_0x29c01f){_0x652c98['push'](_0x652c98['shift']());}};_0x3a2753(++_0x5d5e1e);}(_0x01a2,0x10b));var _0x201a=function(_0x2c4300,_0x74fadb){_0x2c4300=_0x2c4300-0x0;var _0x115ccb=_0x01a2[_0x2c4300];return _0x115ccb;};'use strict';var _=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var moment=require(_0x201a('0x2'));var BPromise=require('bluebird');var rs=require(_0x201a('0x3'));var fs=require('fs');var Redis=require(_0x201a('0x4'));var db=require(_0x201a('0x5'))['db'];var utils=require(_0x201a('0x6'));var logger=require(_0x201a('0x7'))('rpc');var config=require(_0x201a('0x8'));var jayson=require(_0x201a('0x9'));var client=jayson[_0x201a('0xa')][_0x201a('0xb')]({'port':0x232a});config[_0x201a('0xc')]=_[_0x201a('0xd')](config[_0x201a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x201a('0xc')]));require('./faxInteraction.socket')[_0x201a('0xe')](socket);function respondWithRpcPromise(_0x56b2c9,_0x38ff0d,_0xe44a5f){return new BPromise(function(_0x167a9a,_0x3050c0){return client[_0x201a('0xf')](_0x56b2c9,_0xe44a5f)[_0x201a('0x10')](function(_0x3bbecf){logger[_0x201a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x38ff0d,_0x201a('0x12'));logger['debug'](_0x201a('0x13'),_0x38ff0d,_0x201a('0x12'),JSON['stringify'](_0x3bbecf));if(_0x3bbecf[_0x201a('0x14')]){if(_0x3bbecf[_0x201a('0x14')][_0x201a('0x15')]===0x1f4){logger['error'](_0x201a('0x16'),_0x38ff0d,_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);return _0x3050c0(_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);}logger[_0x201a('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38ff0d,_0x3bbecf[_0x201a('0x14')]['message']);return _0x167a9a(_0x3bbecf[_0x201a('0x14')][_0x201a('0x17')]);}else{logger[_0x201a('0x11')](_0x201a('0x16'),_0x38ff0d,_0x201a('0x12'));_0x167a9a(_0x3bbecf[_0x201a('0x18')][_0x201a('0x17')]);}})[_0x201a('0x19')](function(_0x3fd287){logger[_0x201a('0x14')](_0x201a('0x16'),_0x38ff0d,_0x3fd287);_0x3050c0(_0x3fd287);});});}exports[_0x201a('0x1a')]=function(_0x247129){var _0x2476bd=this;return new Promise(function(_0x133c18,_0x12f2a2){return db['FaxInteraction'][_0x201a('0x1b')](_0x247129[_0x201a('0x1c')],{'raw':_0x247129['options']?_0x247129[_0x201a('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247129[_0x201a('0x1d')]?_0x247129[_0x201a('0x1d')][_0x201a('0x1e')]||null:null,'attributes':_0x247129[_0x201a('0x1d')]?_0x247129[_0x201a('0x1d')][_0x201a('0x1f')]||null:null,'limit':_0x247129[_0x201a('0x1d')]?_0x247129['options'][_0x201a('0x20')]||null:null})[_0x201a('0x10')](function(_0x3aec2b){logger[_0x201a('0x11')](_0x201a('0x1a'),_0x247129);logger[_0x201a('0x21')](_0x201a('0x1a'),_0x247129,JSON['stringify'](_0x3aec2b));_0x133c18(_0x3aec2b);})[_0x201a('0x19')](function(_0x187609){logger[_0x201a('0x14')](_0x201a('0x1a'),_0x187609['message'],_0x247129);_0x12f2a2(_0x2476bd[_0x201a('0x14')](0x1f4,_0x187609[_0x201a('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x21e468){return new Promise(function(_0x441722,_0x5ed2f0){return db[_0x201a('0x22')][_0x201a('0x23')]({'where':_0x21e468[_0x201a('0x1d')]?_0x21e468['options'][_0x201a('0x1e')]||null:null})['then'](function(_0x5ec03e){if(_0x5ec03e){return _0x5ec03e[_0x201a('0x24')](_0x21e468[_0x201a('0x1c')][_0x201a('0x25')],_['omit'](_0x21e468[_0x201a('0x1c')],[_0x201a('0x25'),'id'])||{});}})[_0x201a('0x26')](function(_0x3b69a0){logger['info']('AddTags',_0x21e468);logger[_0x201a('0x21')]('AddTags',_0x21e468,JSON[_0x201a('0x27')](_0x3b69a0));_0x441722(_0x3b69a0);})[_0x201a('0x19')](function(_0x4a52f9){logger[_0x201a('0x14')](_0x201a('0x28'),_0x4a52f9[_0x201a('0x17')],_0x21e468);_0x5ed2f0(_this[_0x201a('0x14')](0x1f4,_0x4a52f9['message']));});});}; \ No newline at end of file +var _0x42e9=['message','info','result','catch','FaxInteraction','update','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s'];(function(_0x33b3e7,_0x3c2592){var _0x49f558=function(_0x3bad6c){while(--_0x3bad6c){_0x33b3e7['push'](_0x33b3e7['shift']());}};_0x49f558(++_0x3c2592);}(_0x42e9,0x14f));var _0x942e=function(_0x445cf9,_0xaf37cc){_0x445cf9=_0x445cf9-0x0;var _0x14c55e=_0x42e9[_0x445cf9];return _0x14c55e;};'use strict';var _=require(_0x942e('0x0'));var util=require('util');var moment=require(_0x942e('0x1'));var BPromise=require(_0x942e('0x2'));var rs=require(_0x942e('0x3'));var fs=require('fs');var Redis=require(_0x942e('0x4'));var db=require(_0x942e('0x5'))['db'];var utils=require(_0x942e('0x6'));var logger=require(_0x942e('0x7'))(_0x942e('0x8'));var config=require('../../config/environment');var jayson=require(_0x942e('0x9'));var client=jayson['client'][_0x942e('0xa')]({'port':0x232a});config[_0x942e('0xb')]=_[_0x942e('0xc')](config[_0x942e('0xb')],{'host':_0x942e('0xd'),'port':0x18eb});var socket=require(_0x942e('0xe'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x942e('0xf')](socket);function respondWithRpcPromise(_0x338e9c,_0x5b9bfb,_0x57e983){return new BPromise(function(_0x155b65,_0x9532a5){return client[_0x942e('0x10')](_0x338e9c,_0x57e983)[_0x942e('0x11')](function(_0x1f463c){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5b9bfb,_0x942e('0x12'));logger[_0x942e('0x13')](_0x942e('0x14'),_0x5b9bfb,_0x942e('0x12'),JSON[_0x942e('0x15')](_0x1f463c));if(_0x1f463c[_0x942e('0x16')]){if(_0x1f463c[_0x942e('0x16')][_0x942e('0x17')]===0x1f4){logger['error'](_0x942e('0x18'),_0x5b9bfb,_0x1f463c[_0x942e('0x16')][_0x942e('0x19')]);return _0x9532a5(_0x1f463c[_0x942e('0x16')][_0x942e('0x19')]);}logger[_0x942e('0x16')](_0x942e('0x18'),_0x5b9bfb,_0x1f463c[_0x942e('0x16')][_0x942e('0x19')]);return _0x155b65(_0x1f463c['error']['message']);}else{logger[_0x942e('0x1a')](_0x942e('0x18'),_0x5b9bfb,_0x942e('0x12'));_0x155b65(_0x1f463c[_0x942e('0x1b')][_0x942e('0x19')]);}})[_0x942e('0x1c')](function(_0x21155b){logger[_0x942e('0x16')](_0x942e('0x18'),_0x5b9bfb,_0x21155b);_0x9532a5(_0x21155b);});});}exports['UpdateFaxInteraction']=function(_0x15a852){var _0x24198c=this;return new Promise(function(_0x2f1350,_0x34bef7){return db[_0x942e('0x1d')][_0x942e('0x1e')](_0x15a852['body'],{'raw':_0x15a852[_0x942e('0x1f')]?_0x15a852['options'][_0x942e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15a852[_0x942e('0x1f')]?_0x15a852[_0x942e('0x1f')]['where']||null:null,'attributes':_0x15a852[_0x942e('0x1f')]?_0x15a852[_0x942e('0x1f')][_0x942e('0x21')]||null:null,'limit':_0x15a852[_0x942e('0x1f')]?_0x15a852[_0x942e('0x1f')][_0x942e('0x22')]||null:null})[_0x942e('0x11')](function(_0xeb476c){logger[_0x942e('0x1a')](_0x942e('0x23'),_0x15a852);logger[_0x942e('0x13')]('UpdateFaxInteraction',_0x15a852,JSON[_0x942e('0x15')](_0xeb476c));_0x2f1350(_0xeb476c);})[_0x942e('0x1c')](function(_0x332acf){logger[_0x942e('0x16')](_0x942e('0x23'),_0x332acf['message'],_0x15a852);_0x34bef7(_0x24198c[_0x942e('0x16')](0x1f4,_0x332acf[_0x942e('0x19')]));});});};exports[_0x942e('0x24')]=function(_0x54f926){return new Promise(function(_0x521869,_0x56e421){return db[_0x942e('0x1d')][_0x942e('0x25')]({'where':_0x54f926[_0x942e('0x1f')]?_0x54f926[_0x942e('0x1f')][_0x942e('0x26')]||null:null})['then'](function(_0x22e4e6){if(_0x22e4e6){return _0x22e4e6[_0x942e('0x27')](_0x54f926[_0x942e('0x28')][_0x942e('0x29')],_[_0x942e('0x2a')](_0x54f926[_0x942e('0x28')],[_0x942e('0x29'),'id'])||{});}})[_0x942e('0x2b')](function(_0x3e99c5){logger[_0x942e('0x1a')](_0x942e('0x2c'),_0x54f926);logger['debug']('AddTags',_0x54f926,JSON[_0x942e('0x15')](_0x3e99c5));_0x521869(_0x3e99c5);})[_0x942e('0x1c')](function(_0x25a73a){logger[_0x942e('0x16')](_0x942e('0x2c'),_0x25a73a[_0x942e('0x19')],_0x54f926);_0x56e421(_this['error'](0x1f4,_0x25a73a[_0x942e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dd9c269..0cad307 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 _0xed3a=['register','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x20f902,_0x17e9af){var _0x42fd50=function(_0x5d478a){while(--_0x5d478a){_0x20f902['push'](_0x20f902['shift']());}};_0x42fd50(++_0x17e9af);}(_0xed3a,0x128));var _0xaed3=function(_0x59f846,_0x20d7cf){_0x59f846=_0x59f846-0x0;var _0x50c64a=_0xed3a[_0x59f846];return _0x50c64a;};'use strict';var FaxInteractionEvents=require(_0xaed3('0x0'));var events=[_0xaed3('0x1'),_0xaed3('0x2'),_0xaed3('0x3')];function createListener(_0x1626aa,_0xe1e47f){return function(_0x592c9c){_0xe1e47f['emit'](_0x1626aa,_0x592c9c);};}function removeListener(_0x43a8e5,_0x11ef1d){return function(){FaxInteractionEvents['removeListener'](_0x43a8e5,_0x11ef1d);};}exports[_0xaed3('0x4')]=function(_0x222ba0){for(var _0xfd50c3=0x0,_0x40631a=events['length'];_0xfd50c3<_0x40631a;_0xfd50c3++){var _0x3a94a6=events[_0xfd50c3];var _0x145f5f=createListener(_0xaed3('0x5')+_0x3a94a6,_0x222ba0);FaxInteractionEvents['on'](_0x3a94a6,_0x145f5f);}}; \ No newline at end of file +var _0x15e7=['removeListener','register','length','faxInteraction:','save','update','emit'];(function(_0x38b185,_0x543aee){var _0x39f607=function(_0x345074){while(--_0x345074){_0x38b185['push'](_0x38b185['shift']());}};_0x39f607(++_0x543aee);}(_0x15e7,0x1cb));var _0x715e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x15e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x715e('0x0'),'remove',_0x715e('0x1')];function createListener(_0x428c2f,_0x2c9d57){return function(_0x578312){_0x2c9d57[_0x715e('0x2')](_0x428c2f,_0x578312);};}function removeListener(_0x3f98b4,_0x59ef99){return function(){FaxInteractionEvents[_0x715e('0x3')](_0x3f98b4,_0x59ef99);};}exports[_0x715e('0x4')]=function(_0x18f16d){for(var _0x65a123=0x0,_0x3220c9=events[_0x715e('0x5')];_0x65a123<_0x3220c9;_0x65a123++){var _0x5f4906=events[_0x65a123];var _0x4fb448=createListener(_0x715e('0x6')+_0x5f4906,_0x18f16d);FaxInteractionEvents['on'](_0x5f4906,_0x4fb448);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index adefec7..aa7c53a 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 _0x9362=['../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id/download','download','create','post','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','express','Router','fs-extra'];(function(_0xbbfad4,_0x4e81a3){var _0x2bf8e8=function(_0x5326ae){while(--_0x5326ae){_0xbbfad4['push'](_0xbbfad4['shift']());}};_0x2bf8e8(++_0x4e81a3);}(_0x9362,0x111));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2936('0x0'));var util=require(_0x2936('0x1'));var path=require(_0x2936('0x2'));var timeout=require('connect-timeout');var express=require(_0x2936('0x3'));var router=express[_0x2936('0x4')]();var fs_extra=require(_0x2936('0x5'));var auth=require(_0x2936('0x6'));var interaction=require(_0x2936('0x7'));var config=require('../../config/environment');var controller=require(_0x2936('0x8'));router['get']('/',auth[_0x2936('0x9')](),controller[_0x2936('0xa')]);router['get'](_0x2936('0xb'),auth[_0x2936('0x9')](),controller[_0x2936('0xc')]);router[_0x2936('0xd')]('/:id',auth[_0x2936('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2936('0xe'),auth[_0x2936('0x9')](),controller[_0x2936('0xf')]);router['post']('/',auth[_0x2936('0x9')](),controller[_0x2936('0x10')]);router['post']('/:id/messages',auth[_0x2936('0x9')](),controller['addMessage']);router[_0x2936('0x11')](_0x2936('0x12'),auth[_0x2936('0x9')](),interaction['tracked'](_0x2936('0x13'),_0x2936('0x14')),controller[_0x2936('0x15')]);router[_0x2936('0x16')](_0x2936('0x17'),auth[_0x2936('0x9')](),interaction[_0x2936('0x18')](_0x2936('0x13'),_0x2936('0x19')),controller[_0x2936('0x1a')]);router[_0x2936('0x1b')](_0x2936('0x17'),auth[_0x2936('0x9')](),interaction[_0x2936('0x18')](_0x2936('0x13'),_0x2936('0x1c')),controller[_0x2936('0x1d')]);router[_0x2936('0x1b')](_0x2936('0x12'),auth['isAuthenticated'](),controller[_0x2936('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2b8c=['isAuthenticated','index','get','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','addTags','fax','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bfb05,_0x2fe9bd){var _0x4fbe0d=function(_0x2490db){while(--_0x2490db){_0x3bfb05['push'](_0x3bfb05['shift']());}};_0x4fbe0d(++_0x2fe9bd);}(_0x2b8c,0x9b));var _0xc2b8=function(_0x234014,_0x4c6b65){_0x234014=_0x234014-0x0;var _0x4141b7=_0x2b8c[_0x234014];return _0x4141b7;};'use strict';var multer=require(_0xc2b8('0x0'));var util=require(_0xc2b8('0x1'));var path=require('path');var timeout=require(_0xc2b8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc2b8('0x3'));var auth=require(_0xc2b8('0x4'));var interaction=require(_0xc2b8('0x5'));var config=require(_0xc2b8('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xc2b8('0x7')](),controller[_0xc2b8('0x8')]);router[_0xc2b8('0x9')](_0xc2b8('0xa'),auth[_0xc2b8('0x7')](),controller['describe']);router[_0xc2b8('0x9')](_0xc2b8('0xb'),auth[_0xc2b8('0x7')](),controller[_0xc2b8('0xc')]);router[_0xc2b8('0x9')](_0xc2b8('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xc2b8('0xe'),auth['isAuthenticated'](),controller[_0xc2b8('0xf')]);router[_0xc2b8('0x10')]('/',auth[_0xc2b8('0x7')](),controller[_0xc2b8('0x11')]);router[_0xc2b8('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xc2b8('0x10')](_0xc2b8('0x12'),auth['isAuthenticated'](),interaction[_0xc2b8('0x13')]('fax','faxinteraction:addtags'),controller[_0xc2b8('0x14')]);router['put']('/:id',auth[_0xc2b8('0x7')](),interaction[_0xc2b8('0x13')](_0xc2b8('0x15'),'faxinteraction:update'),controller[_0xc2b8('0x16')]);router[_0xc2b8('0x17')](_0xc2b8('0xb'),auth['isAuthenticated'](),interaction[_0xc2b8('0x13')](_0xc2b8('0x15'),_0xc2b8('0x18')),controller['destroy']);router[_0xc2b8('0x17')]('/:id/tags',auth[_0xc2b8('0x7')](),controller[_0xc2b8('0x19')]);module[_0xc2b8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 15ca623..47709c7 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 _0x26bc=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x1fd1b1,_0x3ccae9){var _0x78d7c4=function(_0x4005f9){while(--_0x4005f9){_0x1fd1b1['push'](_0x1fd1b1['shift']());}};_0x78d7c4(++_0x3ccae9);}(_0x26bc,0x162));var _0xc26b=function(_0x2d0e9d,_0x2fe853){_0x2d0e9d=_0x2d0e9d-0x0;var _0x785cbf=_0x26bc[_0x2d0e9d];return _0x785cbf;};'use strict';var Sequelize=require(_0xc26b('0x0'));module[_0xc26b('0x1')]={'body':{'type':Sequelize[_0xc26b('0x2')](_0xc26b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc26b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc26b('0x5')),'defaultValue':_0xc26b('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc26b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0624=['DATE','BOOLEAN','ENUM','out','TEXT'];(function(_0x1a57f3,_0x124a34){var _0x180ed9=function(_0x154fe4){while(--_0x154fe4){_0x1a57f3['push'](_0x1a57f3['shift']());}};_0x180ed9(++_0x124a34);}(_0x0624,0x132));var _0x4062=function(_0x23bf88,_0x5e39e8){_0x23bf88=_0x23bf88-0x0;var _0x3da608=_0x0624[_0x23bf88];return _0x3da608;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4062('0x0')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4062('0x1')]('in',_0x4062('0x2')),'defaultValue':_0x4062('0x2'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4062('0x3')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4062('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 36899be..45da762 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 _0xfbd2=['merge','type','options','count','includeAll','findAll','rows','show','params','FaxMessage','include','catch','body','find','describe','fax-interactions','accept','fax','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','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','role','rejectMessage','QueryTypes','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','json','undefined','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter'];(function(_0x4e88a1,_0x4ea61d){var _0x4bb106=function(_0x144e8c){while(--_0x144e8c){_0x4e88a1['push'](_0x4e88a1['shift']());}};_0x4bb106(++_0x4ea61d);}(_0xfbd2,0x164));var _0x2fbd=function(_0x2099f6,_0x32b4ad){_0x2099f6=_0x2099f6-0x0;var _0x13a947=_0xfbd2[_0x2099f6];return _0x13a947;};'use strict';var emlformat=require(_0x2fbd('0x0'));var rimraf=require(_0x2fbd('0x1'));var zipdir=require(_0x2fbd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fbd('0x3'));var moment=require('moment');var BPromise=require(_0x2fbd('0x4'));var Mustache=require(_0x2fbd('0x5'));var util=require('util');var path=require(_0x2fbd('0x6'));var sox=require('sox');var csv=require(_0x2fbd('0x7'));var ejs=require(_0x2fbd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fbd('0x9'));var squel=require(_0x2fbd('0xa'));var crypto=require(_0x2fbd('0xb'));var jsforce=require(_0x2fbd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2fbd('0xd'));var Papa=require(_0x2fbd('0xe'));var Redis=require(_0x2fbd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2fbd('0x10'));var as=require(_0x2fbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fbd('0x12'))('api');var utils=require(_0x2fbd('0x13'));var config=require(_0x2fbd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fbd('0x15'))['db'];config[_0x2fbd('0x16')]=_[_0x2fbd('0x17')](config[_0x2fbd('0x16')],{'host':_0x2fbd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2fbd('0x16')]));require('./faxMessage.socket')[_0x2fbd('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2fbd('0x1a')][_0x2fbd('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x2fbd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xbbcf60,_0x2b55ac,_0x1fe2bf,_0x10c073){return new BPromise(function(_0x373522,_0x375f58){var _0x80bbdf=_0x10c073||client;return _0x80bbdf[_0x2fbd('0x1c')](_0xbbcf60,_0x1fe2bf)['then'](function(_0x3f5b0a){logger[_0x2fbd('0x1d')](_0x2fbd('0x1e'),_0x2b55ac,_0x2fbd('0x1f'));logger[_0x2fbd('0x20')](_0x2fbd('0x21'),_0x2b55ac,'request\x20sent',JSON[_0x2fbd('0x22')](_0x3f5b0a));if(_0x3f5b0a['error']){if(_0x3f5b0a['error'][_0x2fbd('0x23')]===0x1f4){logger[_0x2fbd('0x24')](_0x2fbd('0x1e'),_0x2b55ac,_0x3f5b0a[_0x2fbd('0x24')]['message']);return _0x375f58(_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);}logger['error'](_0x2fbd('0x1e'),_0x2b55ac,_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);return _0x373522(_0x3f5b0a[_0x2fbd('0x24')][_0x2fbd('0x25')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2b55ac,'request\x20sent');_0x373522(_0x3f5b0a[_0x2fbd('0x26')][_0x2fbd('0x25')]);}})['catch'](function(_0x1328d3){logger[_0x2fbd('0x24')](_0x2fbd('0x1e'),_0x2b55ac,_0x1328d3);_0x375f58(_0x1328d3);});});}function respondWithStatusCode(_0x53c2bf,_0x3d7eb5){_0x3d7eb5=_0x3d7eb5||0xcc;return function(_0x3ab95e){if(_0x3ab95e){return _0x53c2bf[_0x2fbd('0x27')](_0x3d7eb5);}return _0x53c2bf[_0x2fbd('0x28')](_0x3d7eb5)['end']();};}function respondWithResult(_0x158c4e,_0x397239){_0x397239=_0x397239||0xc8;return function(_0x5598af){if(_0x5598af){return _0x158c4e['status'](_0x397239)[_0x2fbd('0x29')](_0x5598af);}};}function respondWithFilteredResult(_0xa83e63,_0x1efdcb){return function(_0x52b46a){if(_0x52b46a){var _0x2803e6=typeof _0x1efdcb['offset']===_0x2fbd('0x2a')&&typeof _0x1efdcb['limit']===_0x2fbd('0x2a');var _0x2a48ec=_0x52b46a['count'];var _0x388500=_0x2803e6?0x0:_0x1efdcb['offset'];var _0x4b6f8a=_0x2803e6?_0x52b46a['count']:_0x1efdcb['offset']+_0x1efdcb['limit'];var _0x139716;if(_0x4b6f8a>=_0x2a48ec){_0x4b6f8a=_0x2a48ec;_0x139716=0xc8;}else{_0x139716=0xce;}_0xa83e63[_0x2fbd('0x28')](_0x139716);return _0xa83e63[_0x2fbd('0x2b')](_0x2fbd('0x2c'),_0x388500+'-'+_0x4b6f8a+'/'+_0x2a48ec)[_0x2fbd('0x29')](_0x52b46a);}return null;};}function patchUpdates(_0x370141){return function(_0xf0b4f4){try{jsonpatch[_0x2fbd('0x2d')](_0xf0b4f4,_0x370141,!![]);}catch(_0x339d23){return BPromise[_0x2fbd('0x2e')](_0x339d23);}return _0xf0b4f4[_0x2fbd('0x2f')]();};}function saveUpdates(_0x21bb1c,_0xb105ac){return function(_0x3de05e){if(_0x3de05e){return _0x3de05e[_0x2fbd('0x30')](_0x21bb1c)[_0x2fbd('0x31')](function(_0x5f13f4){return _0x5f13f4;});}return null;};}function removeEntity(_0x1f2c06,_0x17d56f){return function(_0x28ae38){if(_0x28ae38){return _0x28ae38[_0x2fbd('0x32')]()[_0x2fbd('0x31')](function(){_0x1f2c06[_0x2fbd('0x28')](0xcc)[_0x2fbd('0x33')]();});}};}function handleEntityNotFound(_0x43dfaa,_0x34100d){return function(_0x2d450a){if(!_0x2d450a){_0x43dfaa['sendStatus'](0x194);}return _0x2d450a;};}function handleError(_0x4f8add,_0x6d35af){_0x6d35af=_0x6d35af||0x1f4;return function(_0x290f7b){logger[_0x2fbd('0x24')](_0x290f7b[_0x2fbd('0x34')]);if(_0x290f7b[_0x2fbd('0x35')]){delete _0x290f7b[_0x2fbd('0x35')];}_0x4f8add[_0x2fbd('0x28')](_0x6d35af)[_0x2fbd('0x36')](_0x290f7b);};}exports[_0x2fbd('0x37')]=function(_0x24f9fe,_0x21eac8){var _0x535adf={},_0x81bb2b={},_0x9fd5bc={'count':0x0,'rows':[]};var _0x6037e9=_[_0x2fbd('0x38')](db['FaxMessage'][_0x2fbd('0x39')],function(_0x155e43){return{'name':_0x155e43[_0x2fbd('0x3a')],'type':_0x155e43['type'][_0x2fbd('0x3b')]};});_0x81bb2b[_0x2fbd('0x3c')]=_['map'](_0x6037e9,_0x2fbd('0x35'));_0x81bb2b[_0x2fbd('0x3d')]=_[_0x2fbd('0x3e')](_0x24f9fe['query']);_0x81bb2b[_0x2fbd('0x3f')]=_[_0x2fbd('0x40')](_0x81bb2b[_0x2fbd('0x3c')],_0x81bb2b[_0x2fbd('0x3d')]);_0x535adf['attributes']=_[_0x2fbd('0x40')](_0x81bb2b[_0x2fbd('0x3c')],qs[_0x2fbd('0x41')](_0x24f9fe['query'][_0x2fbd('0x41')]));_0x535adf[_0x2fbd('0x42')]=_0x535adf['attributes'][_0x2fbd('0x43')]?_0x535adf[_0x2fbd('0x42')]:_0x81bb2b[_0x2fbd('0x3c')];if(!_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x44')](_0x2fbd('0x45'))){_0x535adf['limit']=qs[_0x2fbd('0x46')](_0x24f9fe[_0x2fbd('0x3d')]['limit']);_0x535adf[_0x2fbd('0x47')]=qs['offset'](_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x47')]);}_0x535adf['order']=qs['sort'](_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x48')]);_0x535adf[_0x2fbd('0x49')]=qs[_0x2fbd('0x3f')](_[_0x2fbd('0x4a')](_0x24f9fe[_0x2fbd('0x3d')],_0x81bb2b[_0x2fbd('0x3f')]),_0x6037e9);if(_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x4b')]){_0x535adf[_0x2fbd('0x49')]=_[_0x2fbd('0x4c')](_0x535adf[_0x2fbd('0x49')],{'$or':_[_0x2fbd('0x38')](_0x6037e9,function(_0x2003bc){if(_0x2003bc[_0x2fbd('0x4d')]!=='VIRTUAL'){var _0x1c5a85={};_0x1c5a85[_0x2003bc[_0x2fbd('0x35')]]={'$like':'%'+_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x4b')]+'%'};return _0x1c5a85;}})});}_0x535adf=_[_0x2fbd('0x4c')]({},_0x535adf,_0x24f9fe[_0x2fbd('0x4e')]);var _0x11c229={'where':_0x535adf[_0x2fbd('0x49')]};return db['FaxMessage']['count'](_0x11c229)[_0x2fbd('0x31')](function(_0x51e9cd){_0x9fd5bc[_0x2fbd('0x4f')]=_0x51e9cd;if(_0x24f9fe[_0x2fbd('0x3d')][_0x2fbd('0x50')]){_0x535adf['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2fbd('0x51')](_0x535adf);})[_0x2fbd('0x31')](function(_0x183e21){_0x9fd5bc[_0x2fbd('0x52')]=_0x183e21;return _0x9fd5bc;})[_0x2fbd('0x31')](respondWithFilteredResult(_0x21eac8,_0x535adf))['catch'](handleError(_0x21eac8,null));};exports[_0x2fbd('0x53')]=function(_0x1aa591,_0x127538){var _0x1ea648={'raw':!![],'where':{'id':_0x1aa591[_0x2fbd('0x54')]['id']}},_0x36ef54={};_0x36ef54[_0x2fbd('0x3c')]=_['keys'](db[_0x2fbd('0x55')][_0x2fbd('0x39')]);_0x36ef54[_0x2fbd('0x3d')]=_[_0x2fbd('0x3e')](_0x1aa591[_0x2fbd('0x3d')]);_0x36ef54[_0x2fbd('0x3f')]=_['intersection'](_0x36ef54[_0x2fbd('0x3c')],_0x36ef54['query']);_0x1ea648[_0x2fbd('0x42')]=_[_0x2fbd('0x40')](_0x36ef54[_0x2fbd('0x3c')],qs[_0x2fbd('0x41')](_0x1aa591[_0x2fbd('0x3d')][_0x2fbd('0x41')]));_0x1ea648[_0x2fbd('0x42')]=_0x1ea648[_0x2fbd('0x42')][_0x2fbd('0x43')]?_0x1ea648[_0x2fbd('0x42')]:_0x36ef54[_0x2fbd('0x3c')];if(_0x1aa591['query'][_0x2fbd('0x50')]){_0x1ea648[_0x2fbd('0x56')]=[{'all':!![]}];}_0x1ea648=_[_0x2fbd('0x4c')]({},_0x1ea648,_0x1aa591[_0x2fbd('0x4e')]);return db['FaxMessage']['find'](_0x1ea648)[_0x2fbd('0x31')](handleEntityNotFound(_0x127538,null))[_0x2fbd('0x31')](respondWithResult(_0x127538,null))[_0x2fbd('0x57')](handleError(_0x127538,null));};exports['update']=function(_0x5bfdfa,_0x1ead84){if(_0x5bfdfa[_0x2fbd('0x58')]['id']){delete _0x5bfdfa[_0x2fbd('0x58')]['id'];}return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x5bfdfa['params']['id']}})[_0x2fbd('0x31')](handleEntityNotFound(_0x1ead84,null))['then'](saveUpdates(_0x5bfdfa[_0x2fbd('0x58')],null))['then'](respondWithResult(_0x1ead84,null))[_0x2fbd('0x57')](handleError(_0x1ead84,null));};exports[_0x2fbd('0x32')]=function(_0x19af7e,_0x2dadf1){return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x19af7e[_0x2fbd('0x54')]['id']}})[_0x2fbd('0x31')](handleEntityNotFound(_0x2dadf1,null))[_0x2fbd('0x31')](removeEntity(_0x2dadf1,null))[_0x2fbd('0x57')](handleError(_0x2dadf1,null));};exports[_0x2fbd('0x5a')]=function(_0x44dd1e,_0x4dfb40){return db['FaxMessage'][_0x2fbd('0x5a')]()[_0x2fbd('0x31')](respondWithResult(_0x4dfb40,null))['catch'](handleError(_0x4dfb40,null));};var interaction_log=require(_0x2fbd('0x12'))(_0x2fbd('0x5b'));exports[_0x2fbd('0x5c')]=function(_0x447973,_0x24d9de,_0x334054){var _0x51b5da={'agent':{},'channel':_0x2fbd('0x5d')};if(_0x447973[_0x2fbd('0x58')]['id']){delete _0x447973[_0x2fbd('0x58')]['id'];}_0x447973[_0x2fbd('0x58')]['read']=!![];_0x447973['body'][_0x2fbd('0x5e')]=moment()['format'](_0x2fbd('0x5f'));_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')]=_0x447973['body'][_0x2fbd('0x60')]||_0x447973[_0x2fbd('0x61')]['id'];_0x51b5da['agent']['id']=_0x447973['body'][_0x2fbd('0x60')];return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x447973[_0x2fbd('0x54')]['id'],'UserId':null}})[_0x2fbd('0x31')](handleEntityNotFound(_0x24d9de,null))[_0x2fbd('0x31')](saveUpdates(_0x447973[_0x2fbd('0x58')],null))[_0x2fbd('0x31')](function(_0x3e19fa){if(_0x3e19fa){_0x51b5da[_0x2fbd('0x25')]=_0x3e19fa[_0x2fbd('0x62')]({'plain':!![]});return db[_0x2fbd('0x63')][_0x2fbd('0x59')]({'where':{'id':_0x3e19fa[_0x2fbd('0x64')]}});}return null;})[_0x2fbd('0x31')](handleEntityNotFound(_0x24d9de,null))[_0x2fbd('0x31')](function(_0x5e14b8){if(_0x5e14b8){return _0x5e14b8[_0x2fbd('0x30')]({'UserId':_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')],'read1stAt':_[_0x2fbd('0x65')](_0x5e14b8[_0x2fbd('0x66')])?moment()[_0x2fbd('0x67')](_0x2fbd('0x5f')):undefined});}return null;})[_0x2fbd('0x31')](function(_0x38b680){if(_0x38b680){_0x51b5da[_0x2fbd('0x68')]=_0x38b680['get']({'plain':!![]});interaction_log[_0x2fbd('0x1d')](_0x2fbd('0x69'),_0x447973[_0x2fbd('0x61')]['id'],_0x447973[_0x2fbd('0x61')][_0x2fbd('0x35')],_0x447973[_0x2fbd('0x61')]['role'],_0x51b5da['interaction']['id'],_0x447973[_0x2fbd('0x58')]?JSON['stringify'](_0x447973[_0x2fbd('0x58')]):_0x2fbd('0x6a'));return respondWithRpcPromise(_0x2fbd('0x6b'),'acceptMessage',_0x51b5da);}return null;})[_0x2fbd('0x31')](function(_0x430f5a){var _0x42801b=_0x2fbd('0x6c')+_0x430f5a[_0x2fbd('0x25')][_0x2fbd('0x6d')];return db[_0x2fbd('0x6e')]['query'](_0x42801b,{'type':db[_0x2fbd('0x6f')]['QueryTypes'][_0x2fbd('0x70')],'raw':!![]})['then'](function(_0x258321){return _0x258321;});})[_0x2fbd('0x31')](function(_0x3f93b2){if(_0x3f93b2){_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x71')]=_0x3f93b2[0x0];if(!_0x447973[_0x2fbd('0x58')]['UserId'])return;return db[_0x2fbd('0x72')][_0x2fbd('0x59')]({'where':{'id':_0x447973[_0x2fbd('0x58')][_0x2fbd('0x60')],'role':_0x2fbd('0x73')},'attributes':['id',_0x2fbd('0x35'),_0x2fbd('0x74'),_0x2fbd('0x75'),_0x2fbd('0x76')],'raw':!![]});}return null;})['then'](function(_0x60dd85){if(!_0x60dd85)return null;_0x51b5da[_0x2fbd('0x25')]['agent']=_0x60dd85;return _0x51b5da;})[_0x2fbd('0x31')](function(_0x4b7e66){if(_0x4b7e66){if(_0x447973['body'][_0x2fbd('0x77')]){_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x78')]=util[_0x2fbd('0x67')](_0x2fbd('0x79'),_0x447973[_0x2fbd('0x61')][_0x2fbd('0x35')]);_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7a')]=_0x51b5da[_0x2fbd('0x7a')];_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7b')]=_0x51b5da[_0x2fbd('0x7a')];_0x51b5da[_0x2fbd('0x25')][_0x2fbd('0x7c')]=_0x2fbd('0x5c');return respondWithRpcPromise(_0x2fbd('0x7d'),_0x2fbd('0x7d'),{'event':'acceptmessage','message':_0x51b5da[_0x2fbd('0x25')]},client9002)[_0x2fbd('0x31')](function(){return _0x51b5da;});}return _0x51b5da;}return null;})[_0x2fbd('0x31')](respondWithResult(_0x24d9de,null))[_0x2fbd('0x57')](handleError(_0x24d9de,null));};var interaction_log=require(_0x2fbd('0x12'))(_0x2fbd('0x5b'));exports[_0x2fbd('0x2e')]=function(_0x5b4b78,_0x53ceed,_0x2bd00b){var _0x52bef9={'agent':{},'channel':_0x2fbd('0x5d')};if(_0x5b4b78['body']['id']){delete _0x5b4b78[_0x2fbd('0x58')]['id'];}_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')]=_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')]||_0x5b4b78[_0x2fbd('0x61')]['id'];_0x52bef9[_0x2fbd('0x73')]['id']=_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')];return db[_0x2fbd('0x55')][_0x2fbd('0x59')]({'where':{'id':_0x5b4b78[_0x2fbd('0x54')]['id'],'UserId':null}})[_0x2fbd('0x31')](handleEntityNotFound(_0x53ceed,null))[_0x2fbd('0x31')](function(_0x8d4ba3){if(_0x8d4ba3){_0x52bef9[_0x2fbd('0x25')]=_0x8d4ba3[_0x2fbd('0x62')]({'plain':!![]});return db[_0x2fbd('0x63')][_0x2fbd('0x59')]({'where':{'id':_0x8d4ba3[_0x2fbd('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x53ceed,null))['then'](function(_0xa2fd52){if(_0xa2fd52){_0x52bef9[_0x2fbd('0x68')]=_0xa2fd52[_0x2fbd('0x62')]({'plain':!![]});interaction_log[_0x2fbd('0x1d')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b4b78['user']['id'],_0x5b4b78['user'][_0x2fbd('0x35')],_0x5b4b78[_0x2fbd('0x61')][_0x2fbd('0x7e')],_0x52bef9[_0x2fbd('0x68')]['id'],_0x5b4b78[_0x2fbd('0x58')]?JSON['stringify'](_0x5b4b78[_0x2fbd('0x58')]):_0x2fbd('0x6a'));return respondWithRpcPromise('RejectMessage',_0x2fbd('0x7f'),_0x52bef9);}return null;})[_0x2fbd('0x31')](function(_0x32b179){var _0x2ec1cb=_0x2fbd('0x6c')+_0x32b179[_0x2fbd('0x25')]['ContactId'];return db[_0x2fbd('0x6e')][_0x2fbd('0x3d')](_0x2ec1cb,{'type':db['Sequelize'][_0x2fbd('0x80')][_0x2fbd('0x70')],'raw':!![]})[_0x2fbd('0x31')](function(_0xfb50c){return _0xfb50c;});})[_0x2fbd('0x31')](function(_0x1f9514){if(_0x1f9514){_0x52bef9[_0x2fbd('0x25')]['contact']=_0x1f9514[0x0];if(!_0x5b4b78[_0x2fbd('0x58')][_0x2fbd('0x60')])return;return db[_0x2fbd('0x72')][_0x2fbd('0x59')]({'where':{'id':_0x5b4b78[_0x2fbd('0x58')]['UserId'],'role':_0x2fbd('0x73')},'attributes':['id',_0x2fbd('0x35'),'fullname',_0x2fbd('0x75'),_0x2fbd('0x76')],'raw':!![]});}return null;})[_0x2fbd('0x31')](function(_0x1f0843){if(!_0x1f0843)return null;_0x52bef9['message']['agent']=_0x1f0843;return _0x52bef9;})[_0x2fbd('0x31')](function(_0x15b93e){if(_0x15b93e){_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x78')]=util[_0x2fbd('0x67')](_0x2fbd('0x79'),_0x5b4b78[_0x2fbd('0x61')]['name']);_0x15b93e['message'][_0x2fbd('0x7a')]=_0x52bef9['channel'];_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x7b')]=_0x52bef9[_0x2fbd('0x7a')];_0x15b93e[_0x2fbd('0x25')][_0x2fbd('0x7c')]=_0x2fbd('0x2e');respondWithRpcPromise(_0x2fbd('0x7d'),_0x2fbd('0x7d'),{'event':_0x2fbd('0x81'),'message':_0x15b93e[_0x2fbd('0x25')]},client9002);return _0x52bef9;}return null;})['then'](respondWithResult(_0x53ceed,null))[_0x2fbd('0x57')](handleError(_0x53ceed,null));};exports[_0x2fbd('0x82')]=function(_0x3f6bcc,_0x17a35c){var _0x1e66ff;return db[_0x2fbd('0x55')]['create'](_0x3f6bcc['body'],{})[_0x2fbd('0x31')](function(_0x368d61){_0x1e66ff=_0x368d61;return db[_0x2fbd('0x83')][_0x2fbd('0x84')]({'where':{'id':_0x1e66ff[_0x2fbd('0x6d')]}});})[_0x2fbd('0x31')](function(_0x32756f){if(_[_0x2fbd('0x65')](_0x32756f)){return;}else{_0x1e66ff[_0x2fbd('0x5d')]=_0x32756f[_0x2fbd('0x5d')];return db[_0x2fbd('0x85')][_0x2fbd('0x84')]({'where':{'id':_0x1e66ff[_0x2fbd('0x86')]}});}})[_0x2fbd('0x31')](function(_0x4b919e){return respondWithRpcPromise(_0x2fbd('0x87'),_0x2fbd('0x87'),{'FaxAccountId':_['isNil'](_0x3f6bcc[_0x2fbd('0x58')])?undefined:_0x3f6bcc[_0x2fbd('0x58')][_0x2fbd('0x88')],'path':_['isNil'](_0x4b919e)?undefined:util[_0x2fbd('0x67')]('/var/opt/motion2/server/files/attachments/%s',_0x4b919e['basename']),'fax':_[_0x2fbd('0x65')](_0x1e66ff[_0x2fbd('0x5d')])?undefined:_0x1e66ff['fax'],'AttachmentId':_0x1e66ff[_0x2fbd('0x86')]},client9002);})['then'](respondWithResult(_0x17a35c,0xc9))['catch'](handleError(_0x17a35c,null));};exports[_0x2fbd('0x89')]=function(_0x4a20d4,_0x31c2a0){var _0x4a8919=path[_0x2fbd('0x8a')](config[_0x2fbd('0x8b')],_0x2fbd('0x8c'),_0x2fbd('0x8d'),_0x2fbd('0x8e'));return db[_0x2fbd('0x55')]['find']({'where':{'id':_0x4a20d4[_0x2fbd('0x54')]['id']},'include':[{'model':db[_0x2fbd('0x85')],'as':'Attachment'}]})[_0x2fbd('0x31')](handleEntityNotFound(_0x31c2a0,null))['then'](function(_0x35a761){if(_0x35a761){return _0x31c2a0[_0x2fbd('0x89')](path[_0x2fbd('0x8a')](_0x4a8919,_0x35a761[_0x2fbd('0x85')][_0x2fbd('0x8f')]));}})['catch'](handleError(_0x31c2a0,null));}; \ No newline at end of file +var _0xce12=['channel','motionChannel','event','acceptmessage','params','null','RejectMessage','rejectMessage','Sequelize','contact','internal','EventManager','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','files','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','index','map','FaxMessage','fieldName','type','key','query','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','show','keys','length','include','find','body','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','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','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s'];(function(_0x568afc,_0x458749){var _0x24999b=function(_0x292b49){while(--_0x292b49){_0x568afc['push'](_0x568afc['shift']());}};_0x24999b(++_0x458749);}(_0xce12,0x1d0));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2ce1('0x0'));var rimraf=require(_0x2ce1('0x1'));var zipdir=require(_0x2ce1('0x2'));var jsonpatch=require(_0x2ce1('0x3'));var rp=require(_0x2ce1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ce1('0x5'));var util=require(_0x2ce1('0x6'));var path=require(_0x2ce1('0x7'));var sox=require('sox');var csv=require(_0x2ce1('0x8'));var ejs=require(_0x2ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x2ce1('0xa'));var _=require('lodash');var squel=require(_0x2ce1('0xb'));var crypto=require('crypto');var jsforce=require(_0x2ce1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2ce1('0x8'));var querystring=require(_0x2ce1('0xd'));var Papa=require(_0x2ce1('0xe'));var Redis=require(_0x2ce1('0xf'));var authService=require(_0x2ce1('0x10'));var qs=require(_0x2ce1('0x11'));var as=require(_0x2ce1('0x12'));var hardwareService=require(_0x2ce1('0x13'));var logger=require(_0x2ce1('0x14'))(_0x2ce1('0x15'));var utils=require(_0x2ce1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2ce1('0x17'));var db=require(_0x2ce1('0x18'))['db'];config[_0x2ce1('0x19')]=_[_0x2ce1('0x1a')](config[_0x2ce1('0x19')],{'host':_0x2ce1('0x1b'),'port':0x18eb});var socket=require(_0x2ce1('0x1c'))(new Redis(config[_0x2ce1('0x19')]));require(_0x2ce1('0x1d'))[_0x2ce1('0x1e')](socket);var jayson=require(_0x2ce1('0x1f'));var client=jayson[_0x2ce1('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x2ce1('0x20')][_0x2ce1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3fad68,_0x28458a,_0x292bfc,_0x5dacc4){return new BPromise(function(_0x1f0c45,_0x398a60){var _0x36860b=_0x5dacc4||client;return _0x36860b[_0x2ce1('0x22')](_0x3fad68,_0x292bfc)['then'](function(_0xeba1b2){logger[_0x2ce1('0x23')](_0x2ce1('0x24'),_0x28458a,_0x2ce1('0x25'));logger[_0x2ce1('0x26')](_0x2ce1('0x27'),_0x28458a,'request\x20sent',JSON[_0x2ce1('0x28')](_0xeba1b2));if(_0xeba1b2['error']){if(_0xeba1b2['error'][_0x2ce1('0x29')]===0x1f4){logger['error'](_0x2ce1('0x24'),_0x28458a,_0xeba1b2[_0x2ce1('0x2a')]['message']);return _0x398a60(_0xeba1b2[_0x2ce1('0x2a')][_0x2ce1('0x2b')]);}logger['error'](_0x2ce1('0x24'),_0x28458a,_0xeba1b2['error']['message']);return _0x1f0c45(_0xeba1b2['error'][_0x2ce1('0x2b')]);}else{logger[_0x2ce1('0x23')]('FaxMessage,\x20%s,\x20%s',_0x28458a,_0x2ce1('0x25'));_0x1f0c45(_0xeba1b2['result'][_0x2ce1('0x2b')]);}})[_0x2ce1('0x2c')](function(_0x5d4e02){logger[_0x2ce1('0x2a')](_0x2ce1('0x24'),_0x28458a,_0x5d4e02);_0x398a60(_0x5d4e02);});});}function respondWithStatusCode(_0x1168d5,_0x374533){_0x374533=_0x374533||0xcc;return function(_0x2a3067){if(_0x2a3067){return _0x1168d5[_0x2ce1('0x2d')](_0x374533);}return _0x1168d5[_0x2ce1('0x2e')](_0x374533)[_0x2ce1('0x2f')]();};}function respondWithResult(_0x19ccb9,_0x1b20c5){_0x1b20c5=_0x1b20c5||0xc8;return function(_0x321d99){if(_0x321d99){return _0x19ccb9['status'](_0x1b20c5)[_0x2ce1('0x30')](_0x321d99);}};}function respondWithFilteredResult(_0x587f1d,_0x3fd7bc){return function(_0x3521f9){if(_0x3521f9){var _0x663c93=typeof _0x3fd7bc[_0x2ce1('0x31')]==='undefined'&&typeof _0x3fd7bc[_0x2ce1('0x32')]===_0x2ce1('0x33');var _0x5c47cc=_0x3521f9[_0x2ce1('0x34')];var _0x249a24=_0x663c93?0x0:_0x3fd7bc[_0x2ce1('0x31')];var _0x401599=_0x663c93?_0x3521f9['count']:_0x3fd7bc[_0x2ce1('0x31')]+_0x3fd7bc['limit'];var _0x2ab068;if(_0x401599>=_0x5c47cc){_0x401599=_0x5c47cc;_0x2ab068=0xc8;}else{_0x2ab068=0xce;}_0x587f1d['status'](_0x2ab068);return _0x587f1d[_0x2ce1('0x35')]('Content-Range',_0x249a24+'-'+_0x401599+'/'+_0x5c47cc)[_0x2ce1('0x30')](_0x3521f9);}return null;};}function patchUpdates(_0x4a4fb5){return function(_0x41dc30){try{jsonpatch[_0x2ce1('0x36')](_0x41dc30,_0x4a4fb5,!![]);}catch(_0x503383){return BPromise[_0x2ce1('0x37')](_0x503383);}return _0x41dc30[_0x2ce1('0x38')]();};}function saveUpdates(_0x5f1c63,_0x2398be){return function(_0x287eaf){if(_0x287eaf){return _0x287eaf[_0x2ce1('0x39')](_0x5f1c63)[_0x2ce1('0x3a')](function(_0x17a24c){return _0x17a24c;});}return null;};}function removeEntity(_0x470a48,_0x43b49b){return function(_0x2f303e){if(_0x2f303e){return _0x2f303e[_0x2ce1('0x3b')]()[_0x2ce1('0x3a')](function(){_0x470a48['status'](0xcc)[_0x2ce1('0x2f')]();});}};}function handleEntityNotFound(_0x82b037,_0x412b8a){return function(_0x489fcf){if(!_0x489fcf){_0x82b037['sendStatus'](0x194);}return _0x489fcf;};}function handleError(_0x1e5c47,_0x166885){_0x166885=_0x166885||0x1f4;return function(_0x362c2b){logger['error'](_0x362c2b[_0x2ce1('0x3c')]);if(_0x362c2b['name']){delete _0x362c2b[_0x2ce1('0x3d')];}_0x1e5c47['status'](_0x166885)['send'](_0x362c2b);};}exports[_0x2ce1('0x3e')]=function(_0x2fece3,_0x2d5102){var _0x9f1296={},_0x167771={},_0x3ad75e={'count':0x0,'rows':[]};var _0x1f41eb=_[_0x2ce1('0x3f')](db[_0x2ce1('0x40')]['rawAttributes'],function(_0x5523ba){return{'name':_0x5523ba[_0x2ce1('0x41')],'type':_0x5523ba[_0x2ce1('0x42')][_0x2ce1('0x43')]};});_0x167771['model']=_[_0x2ce1('0x3f')](_0x1f41eb,_0x2ce1('0x3d'));_0x167771[_0x2ce1('0x44')]=_['keys'](_0x2fece3[_0x2ce1('0x44')]);_0x167771['filters']=_[_0x2ce1('0x45')](_0x167771['model'],_0x167771['query']);_0x9f1296[_0x2ce1('0x46')]=_['intersection'](_0x167771[_0x2ce1('0x47')],qs['fields'](_0x2fece3['query'][_0x2ce1('0x48')]));_0x9f1296['attributes']=_0x9f1296[_0x2ce1('0x46')]['length']?_0x9f1296[_0x2ce1('0x46')]:_0x167771[_0x2ce1('0x47')];if(!_0x2fece3[_0x2ce1('0x44')]['hasOwnProperty'](_0x2ce1('0x49'))){_0x9f1296['limit']=qs[_0x2ce1('0x32')](_0x2fece3['query']['limit']);_0x9f1296[_0x2ce1('0x31')]=qs[_0x2ce1('0x31')](_0x2fece3['query'][_0x2ce1('0x31')]);}_0x9f1296[_0x2ce1('0x4a')]=qs[_0x2ce1('0x4b')](_0x2fece3[_0x2ce1('0x44')][_0x2ce1('0x4b')]);_0x9f1296[_0x2ce1('0x4c')]=qs['filters'](_[_0x2ce1('0x4d')](_0x2fece3[_0x2ce1('0x44')],_0x167771[_0x2ce1('0x4e')]),_0x1f41eb);if(_0x2fece3['query'][_0x2ce1('0x4f')]){_0x9f1296['where']=_[_0x2ce1('0x50')](_0x9f1296['where'],{'$or':_['map'](_0x1f41eb,function(_0x4df1f3){if(_0x4df1f3[_0x2ce1('0x42')]!=='VIRTUAL'){var _0x3e9d62={};_0x3e9d62[_0x4df1f3['name']]={'$like':'%'+_0x2fece3['query'][_0x2ce1('0x4f')]+'%'};return _0x3e9d62;}})});}_0x9f1296=_['merge']({},_0x9f1296,_0x2fece3[_0x2ce1('0x51')]);var _0x158240={'where':_0x9f1296['where']};return db[_0x2ce1('0x40')][_0x2ce1('0x34')](_0x158240)[_0x2ce1('0x3a')](function(_0x119d06){_0x3ad75e['count']=_0x119d06;if(_0x2fece3[_0x2ce1('0x44')]['includeAll']){_0x9f1296['include']=[{'all':!![]}];}return db[_0x2ce1('0x40')]['findAll'](_0x9f1296);})[_0x2ce1('0x3a')](function(_0x2ca8fc){_0x3ad75e[_0x2ce1('0x52')]=_0x2ca8fc;return _0x3ad75e;})[_0x2ce1('0x3a')](respondWithFilteredResult(_0x2d5102,_0x9f1296))[_0x2ce1('0x2c')](handleError(_0x2d5102,null));};exports[_0x2ce1('0x53')]=function(_0x40ddd8,_0x27e3cb){var _0x4f639a={'raw':!![],'where':{'id':_0x40ddd8['params']['id']}},_0xdf1d9={};_0xdf1d9[_0x2ce1('0x47')]=_[_0x2ce1('0x54')](db[_0x2ce1('0x40')]['rawAttributes']);_0xdf1d9[_0x2ce1('0x44')]=_[_0x2ce1('0x54')](_0x40ddd8['query']);_0xdf1d9[_0x2ce1('0x4e')]=_['intersection'](_0xdf1d9[_0x2ce1('0x47')],_0xdf1d9['query']);_0x4f639a['attributes']=_[_0x2ce1('0x45')](_0xdf1d9['model'],qs[_0x2ce1('0x48')](_0x40ddd8['query'][_0x2ce1('0x48')]));_0x4f639a[_0x2ce1('0x46')]=_0x4f639a['attributes'][_0x2ce1('0x55')]?_0x4f639a[_0x2ce1('0x46')]:_0xdf1d9['model'];if(_0x40ddd8['query']['includeAll']){_0x4f639a[_0x2ce1('0x56')]=[{'all':!![]}];}_0x4f639a=_['merge']({},_0x4f639a,_0x40ddd8['options']);return db[_0x2ce1('0x40')][_0x2ce1('0x57')](_0x4f639a)[_0x2ce1('0x3a')](handleEntityNotFound(_0x27e3cb,null))[_0x2ce1('0x3a')](respondWithResult(_0x27e3cb,null))[_0x2ce1('0x2c')](handleError(_0x27e3cb,null));};exports[_0x2ce1('0x39')]=function(_0x40097c,_0x29a40a){if(_0x40097c[_0x2ce1('0x58')]['id']){delete _0x40097c[_0x2ce1('0x58')]['id'];}return db[_0x2ce1('0x40')][_0x2ce1('0x57')]({'where':{'id':_0x40097c['params']['id']}})[_0x2ce1('0x3a')](handleEntityNotFound(_0x29a40a,null))['then'](saveUpdates(_0x40097c[_0x2ce1('0x58')],null))[_0x2ce1('0x3a')](respondWithResult(_0x29a40a,null))['catch'](handleError(_0x29a40a,null));};exports['destroy']=function(_0x8a3f05,_0x389739){return db['FaxMessage'][_0x2ce1('0x57')]({'where':{'id':_0x8a3f05['params']['id']}})[_0x2ce1('0x3a')](handleEntityNotFound(_0x389739,null))[_0x2ce1('0x3a')](removeEntity(_0x389739,null))[_0x2ce1('0x2c')](handleError(_0x389739,null));};exports['describe']=function(_0x318d3e,_0x502bb7){return db[_0x2ce1('0x40')]['describe']()[_0x2ce1('0x3a')](respondWithResult(_0x502bb7,null))[_0x2ce1('0x2c')](handleError(_0x502bb7,null));};var interaction_log=require(_0x2ce1('0x14'))(_0x2ce1('0x59'));exports[_0x2ce1('0x5a')]=function(_0x135e1a,_0x101bcc,_0xd0b38c){var _0xffa459={'agent':{},'channel':_0x2ce1('0x5b')};if(_0x135e1a[_0x2ce1('0x58')]['id']){delete _0x135e1a[_0x2ce1('0x58')]['id'];}_0x135e1a[_0x2ce1('0x58')][_0x2ce1('0x5c')]=!![];_0x135e1a[_0x2ce1('0x58')][_0x2ce1('0x5d')]=moment()[_0x2ce1('0x5e')](_0x2ce1('0x5f'));_0x135e1a['body'][_0x2ce1('0x60')]=_0x135e1a['body'][_0x2ce1('0x60')]||_0x135e1a[_0x2ce1('0x61')]['id'];_0xffa459[_0x2ce1('0x62')]['id']=_0x135e1a[_0x2ce1('0x58')][_0x2ce1('0x60')];return db[_0x2ce1('0x40')][_0x2ce1('0x57')]({'where':{'id':_0x135e1a['params']['id'],'UserId':null}})[_0x2ce1('0x3a')](handleEntityNotFound(_0x101bcc,null))['then'](saveUpdates(_0x135e1a[_0x2ce1('0x58')],null))['then'](function(_0x1fcbe0){if(_0x1fcbe0){_0xffa459[_0x2ce1('0x2b')]=_0x1fcbe0[_0x2ce1('0x63')]({'plain':!![]});return db[_0x2ce1('0x64')][_0x2ce1('0x57')]({'where':{'id':_0x1fcbe0[_0x2ce1('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x101bcc,null))[_0x2ce1('0x3a')](function(_0x2a53dc){if(_0x2a53dc){return _0x2a53dc[_0x2ce1('0x39')]({'UserId':_0x135e1a[_0x2ce1('0x58')][_0x2ce1('0x60')],'read1stAt':_[_0x2ce1('0x66')](_0x2a53dc[_0x2ce1('0x67')])?moment()[_0x2ce1('0x5e')](_0x2ce1('0x5f')):undefined});}return null;})[_0x2ce1('0x3a')](function(_0x4b6805){if(_0x4b6805){_0xffa459[_0x2ce1('0x68')]=_0x4b6805[_0x2ce1('0x63')]({'plain':!![]});interaction_log[_0x2ce1('0x23')](_0x2ce1('0x69'),_0x135e1a['user']['id'],_0x135e1a[_0x2ce1('0x61')]['name'],_0x135e1a['user'][_0x2ce1('0x6a')],_0xffa459[_0x2ce1('0x68')]['id'],_0x135e1a[_0x2ce1('0x58')]?JSON[_0x2ce1('0x28')](_0x135e1a['body']):'null');return respondWithRpcPromise(_0x2ce1('0x6b'),_0x2ce1('0x6c'),_0xffa459);}return null;})[_0x2ce1('0x3a')](function(_0x5ca91d){var _0x477c8f=_0x2ce1('0x6d')+_0x5ca91d[_0x2ce1('0x2b')][_0x2ce1('0x6e')];return db[_0x2ce1('0x6f')][_0x2ce1('0x44')](_0x477c8f,{'type':db['Sequelize'][_0x2ce1('0x70')][_0x2ce1('0x71')],'raw':!![]})[_0x2ce1('0x3a')](function(_0x51dd8f){return _0x51dd8f;});})[_0x2ce1('0x3a')](function(_0x417378){if(_0x417378){_0xffa459['message']['contact']=_0x417378[0x0];if(!_0x135e1a[_0x2ce1('0x58')][_0x2ce1('0x60')])return;return db[_0x2ce1('0x72')][_0x2ce1('0x57')]({'where':{'id':_0x135e1a[_0x2ce1('0x58')]['UserId'],'role':_0x2ce1('0x62')},'attributes':['id',_0x2ce1('0x3d'),_0x2ce1('0x73'),_0x2ce1('0x74'),'internal'],'raw':!![]});}return null;})[_0x2ce1('0x3a')](function(_0x121023){if(!_0x121023)return null;_0xffa459[_0x2ce1('0x2b')]['agent']=_0x121023;return _0xffa459;})[_0x2ce1('0x3a')](function(_0x2dbd05){if(_0x2dbd05){if(_0x135e1a['body'][_0x2ce1('0x75')]){_0xffa459[_0x2ce1('0x2b')][_0x2ce1('0x76')]=util[_0x2ce1('0x5e')](_0x2ce1('0x77'),_0x135e1a[_0x2ce1('0x61')][_0x2ce1('0x3d')]);_0xffa459['message']['channel']=_0xffa459[_0x2ce1('0x78')];_0xffa459['message'][_0x2ce1('0x79')]=_0xffa459['channel'];_0xffa459[_0x2ce1('0x2b')][_0x2ce1('0x7a')]=_0x2ce1('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x2ce1('0x7b'),'message':_0xffa459[_0x2ce1('0x2b')]},client9002)[_0x2ce1('0x3a')](function(){return _0xffa459;});}return _0xffa459;}return null;})[_0x2ce1('0x3a')](respondWithResult(_0x101bcc,null))[_0x2ce1('0x2c')](handleError(_0x101bcc,null));};var interaction_log=require(_0x2ce1('0x14'))(_0x2ce1('0x59'));exports[_0x2ce1('0x37')]=function(_0x28c761,_0x11c878,_0x5e07eb){var _0x1bb1e4={'agent':{},'channel':_0x2ce1('0x5b')};if(_0x28c761[_0x2ce1('0x58')]['id']){delete _0x28c761['body']['id'];}_0x28c761[_0x2ce1('0x58')][_0x2ce1('0x60')]=_0x28c761[_0x2ce1('0x58')]['UserId']||_0x28c761[_0x2ce1('0x61')]['id'];_0x1bb1e4[_0x2ce1('0x62')]['id']=_0x28c761[_0x2ce1('0x58')]['UserId'];return db['FaxMessage'][_0x2ce1('0x57')]({'where':{'id':_0x28c761[_0x2ce1('0x7c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11c878,null))[_0x2ce1('0x3a')](function(_0x13e911){if(_0x13e911){_0x1bb1e4['message']=_0x13e911[_0x2ce1('0x63')]({'plain':!![]});return db[_0x2ce1('0x64')][_0x2ce1('0x57')]({'where':{'id':_0x13e911['FaxInteractionId']}});}return null;})[_0x2ce1('0x3a')](handleEntityNotFound(_0x11c878,null))[_0x2ce1('0x3a')](function(_0x3e10f8){if(_0x3e10f8){_0x1bb1e4['interaction']=_0x3e10f8['get']({'plain':!![]});interaction_log[_0x2ce1('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28c761[_0x2ce1('0x61')]['id'],_0x28c761['user'][_0x2ce1('0x3d')],_0x28c761[_0x2ce1('0x61')][_0x2ce1('0x6a')],_0x1bb1e4['interaction']['id'],_0x28c761[_0x2ce1('0x58')]?JSON[_0x2ce1('0x28')](_0x28c761[_0x2ce1('0x58')]):_0x2ce1('0x7d'));return respondWithRpcPromise(_0x2ce1('0x7e'),_0x2ce1('0x7f'),_0x1bb1e4);}return null;})[_0x2ce1('0x3a')](function(_0x4d07e8){var _0x2342f9=_0x2ce1('0x6d')+_0x4d07e8[_0x2ce1('0x2b')][_0x2ce1('0x6e')];return db['sequelize'][_0x2ce1('0x44')](_0x2342f9,{'type':db[_0x2ce1('0x80')][_0x2ce1('0x70')]['SELECT'],'raw':!![]})[_0x2ce1('0x3a')](function(_0x52bdde){return _0x52bdde;});})[_0x2ce1('0x3a')](function(_0x42d143){if(_0x42d143){_0x1bb1e4[_0x2ce1('0x2b')][_0x2ce1('0x81')]=_0x42d143[0x0];if(!_0x28c761[_0x2ce1('0x58')][_0x2ce1('0x60')])return;return db[_0x2ce1('0x72')][_0x2ce1('0x57')]({'where':{'id':_0x28c761[_0x2ce1('0x58')][_0x2ce1('0x60')],'role':_0x2ce1('0x62')},'attributes':['id','name',_0x2ce1('0x73'),_0x2ce1('0x74'),_0x2ce1('0x82')],'raw':!![]});}return null;})[_0x2ce1('0x3a')](function(_0x2885d6){if(!_0x2885d6)return null;_0x1bb1e4[_0x2ce1('0x2b')][_0x2ce1('0x62')]=_0x2885d6;return _0x1bb1e4;})[_0x2ce1('0x3a')](function(_0x2e53bb){if(_0x2e53bb){_0x2e53bb[_0x2ce1('0x2b')][_0x2ce1('0x76')]=util[_0x2ce1('0x5e')](_0x2ce1('0x77'),_0x28c761['user']['name']);_0x2e53bb['message'][_0x2ce1('0x78')]=_0x1bb1e4[_0x2ce1('0x78')];_0x2e53bb[_0x2ce1('0x2b')][_0x2ce1('0x79')]=_0x1bb1e4[_0x2ce1('0x78')];_0x2e53bb[_0x2ce1('0x2b')]['event']=_0x2ce1('0x37');respondWithRpcPromise('EventManager',_0x2ce1('0x83'),{'event':_0x2ce1('0x84'),'message':_0x2e53bb[_0x2ce1('0x2b')]},client9002);return _0x1bb1e4;}return null;})[_0x2ce1('0x3a')](respondWithResult(_0x11c878,null))[_0x2ce1('0x2c')](handleError(_0x11c878,null));};exports[_0x2ce1('0x85')]=function(_0x4c0f3c,_0x1cd6a0){var _0x41c6f7;return db[_0x2ce1('0x40')][_0x2ce1('0x85')](_0x4c0f3c[_0x2ce1('0x58')],{})[_0x2ce1('0x3a')](function(_0x7f0f6f){_0x41c6f7=_0x7f0f6f;return db[_0x2ce1('0x86')][_0x2ce1('0x87')]({'where':{'id':_0x41c6f7['ContactId']}});})['then'](function(_0x39dfd2){if(_['isNil'](_0x39dfd2)){return;}else{_0x41c6f7[_0x2ce1('0x5b')]=_0x39dfd2['fax'];return db[_0x2ce1('0x88')][_0x2ce1('0x87')]({'where':{'id':_0x41c6f7['AttachmentId']}});}})[_0x2ce1('0x3a')](function(_0x3adc6b){return respondWithRpcPromise(_0x2ce1('0x89'),_0x2ce1('0x89'),{'FaxAccountId':_['isNil'](_0x4c0f3c[_0x2ce1('0x58')])?undefined:_0x4c0f3c[_0x2ce1('0x58')][_0x2ce1('0x8a')],'path':_['isNil'](_0x3adc6b)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x3adc6b[_0x2ce1('0x8b')]),'fax':_[_0x2ce1('0x66')](_0x41c6f7[_0x2ce1('0x5b')])?undefined:_0x41c6f7[_0x2ce1('0x5b')],'AttachmentId':_0x41c6f7[_0x2ce1('0x8c')]},client9002);})[_0x2ce1('0x3a')](respondWithResult(_0x1cd6a0,0xc9))['catch'](handleError(_0x1cd6a0,null));};exports[_0x2ce1('0x8d')]=function(_0x289a21,_0x30ef04){var _0xee3fa7=path[_0x2ce1('0x8e')](config[_0x2ce1('0x8f')],_0x2ce1('0x90'),_0x2ce1('0x91'),'attachments');return db[_0x2ce1('0x40')][_0x2ce1('0x57')]({'where':{'id':_0x289a21['params']['id']},'include':[{'model':db[_0x2ce1('0x88')],'as':_0x2ce1('0x88')}]})[_0x2ce1('0x3a')](handleEntityNotFound(_0x30ef04,null))[_0x2ce1('0x3a')](function(_0x8f413c){if(_0x8f413c){return _0x30ef04[_0x2ce1('0x8d')](path[_0x2ce1('0x8e')](_0xee3fa7,_0x8f413c[_0x2ce1('0x88')][_0x2ce1('0x8b')]));}})['catch'](handleError(_0x30ef04,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9f83e7b..6af07a2 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 _0xecb2=['exports','events','setMaxListeners','remove','emit'];(function(_0x2de9d4,_0x1ec48f){var _0x419580=function(_0x29864b){while(--_0x29864b){_0x2de9d4['push'](_0x2de9d4['shift']());}};_0x419580(++_0x1ec48f);}(_0xecb2,0xf6));var _0x2ecb=function(_0x1bca5a,_0xff1e4c){_0x1bca5a=_0x1bca5a-0x0;var _0x4b3e80=_0xecb2[_0x1bca5a];return _0x4b3e80;};'use strict';var EventEmitter=require(_0x2ecb('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2ecb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2ecb('0x2')};function emitEvent(_0x2f3639){return function(_0x393e7c,_0x2a4fe5,_0x1d007c){FaxMessageEvents[_0x2ecb('0x3')](_0x2f3639+':'+_0x393e7c['id'],_0x393e7c);FaxMessageEvents['emit'](_0x2f3639,_0x393e7c);_0x1d007c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x2ecb('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0x8a9a=['FaxMessage','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x27e69e,_0x5792a4){var _0x419856=function(_0x1e8cd8){while(--_0x1e8cd8){_0x27e69e['push'](_0x27e69e['shift']());}};_0x419856(++_0x5792a4);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8a9a[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xa8a9('0x0'))['db'][_0xa8a9('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa8a9('0x2')](0x0);var events={'afterCreate':_0xa8a9('0x3'),'afterUpdate':_0xa8a9('0x4'),'afterDestroy':_0xa8a9('0x5')};function emitEvent(_0x2d782d){return function(_0x9570dc,_0x3fcb8c,_0xe5e64b){FaxMessageEvents[_0xa8a9('0x6')](_0x2d782d+':'+_0x9570dc['id'],_0x9570dc);FaxMessageEvents[_0xa8a9('0x6')](_0x2d782d,_0x9570dc);_0xe5e64b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xa8a9('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4e4c12d..1db4858 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 _0xecca=['FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xecca,0x1d4));var _0xaecc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xecca[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xaecc('0x0'));var logger=require(_0xaecc('0x1'))(_0xaecc('0x2'));var moment=require('moment');var BPromise=require(_0xaecc('0x3'));var rp=require(_0xaecc('0x4'));var fs=require('fs');var path=require(_0xaecc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaecc('0x6'));module['exports']=function(_0x379c20,_0x390858){return _0x379c20[_0xaecc('0x7')](_0xaecc('0x8'),attributes,{'tableName':_0xaecc('0x9'),'paranoid':![],'indexes':[{'name':_0xaecc('0xa'),'fields':[_0xaecc('0xb')],'type':_0xaecc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40ec02,_0x252748,_0x4d2557){var _0x3aeb7a=_0x379c20[_0xaecc('0xd')];var _0x41f700=_0x40ec02['get']({'plain':!![]});if(_0x41f700[_0xaecc('0xe')][_0xaecc('0xf')]()==='in'||_0x41f700[_0xaecc('0xe')][_0xaecc('0xf')]()===_0xaecc('0x10')&&!_0x41f700[_0xaecc('0x11')]&&!_[_0xaecc('0x12')](_0x41f700[_0xaecc('0x13')])){_0x3aeb7a[_0xaecc('0x14')][_0xaecc('0x15')]({'where':{'id':_0x41f700[_0xaecc('0x16')]}})[_0xaecc('0x17')](function(_0x4dc5df){if(_0x4dc5df){_0x4dc5df[_0xaecc('0x18')]({'lastMsgAt':_0x41f700[_0xaecc('0x19')],'lastMsgDirection':_0x41f700[_0xaecc('0xe')]['toLowerCase']()});}})[_0xaecc('0x1a')](function(_0x1fb66e){console[_0xaecc('0x1b')](_0x1fb66e);});}_0x4d2557();}},'charset':_0xaecc('0x1c'),'collate':_0xaecc('0x1d')});}; \ No newline at end of file +var _0xede7=['secret','isNil','UserId','FaxInteraction','findOne','update','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xede7,0x1d3));var _0x7ede=function(_0x3c3888,_0x502fd1){_0x3c3888=_0x3c3888-0x0;var _0x545fc2=_0xede7[_0x3c3888];return _0x545fc2;};'use strict';var _=require(_0x7ede('0x0'));var util=require(_0x7ede('0x1'));var logger=require(_0x7ede('0x2'))(_0x7ede('0x3'));var moment=require(_0x7ede('0x4'));var BPromise=require(_0x7ede('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ede('0x6'));var rimraf=require(_0x7ede('0x7'));var config=require(_0x7ede('0x8'));var attributes=require(_0x7ede('0x9'));module[_0x7ede('0xa')]=function(_0x1f4996,_0x29516c){return _0x1f4996[_0x7ede('0xb')](_0x7ede('0xc'),attributes,{'tableName':_0x7ede('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x7ede('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x488416,_0x5f2954,_0x26853f){var _0x5e317a=_0x1f4996[_0x7ede('0xf')];var _0x469b92=_0x488416[_0x7ede('0x10')]({'plain':!![]});if(_0x469b92[_0x7ede('0x11')][_0x7ede('0x12')]()==='in'||_0x469b92[_0x7ede('0x11')][_0x7ede('0x12')]()==='out'&&!_0x469b92[_0x7ede('0x13')]&&!_[_0x7ede('0x14')](_0x469b92[_0x7ede('0x15')])){_0x5e317a[_0x7ede('0x16')][_0x7ede('0x17')]({'where':{'id':_0x469b92['FaxInteractionId']}})['then'](function(_0x5bd102){if(_0x5bd102){_0x5bd102[_0x7ede('0x18')]({'lastMsgAt':_0x469b92['createdAt'],'lastMsgDirection':_0x469b92[_0x7ede('0x11')]['toLowerCase']()});}})[_0x7ede('0x19')](function(_0x5a262f){console['error'](_0x5a262f);});}_0x26853f();}},'charset':_0x7ede('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e87cd1c..1a31420 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','request','then','info','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1cabf4,_0x521317){var _0x713508=function(_0x5a284f){while(--_0x5a284f){_0x1cabf4['push'](_0x1cabf4['shift']());}};_0x713508(++_0x521317);}(_0x54ef,0x112));var _0xf54e=function(_0x51dba4,_0x5e1d14){_0x51dba4=_0x51dba4-0x0;var _0x419e10=_0x54ef[_0x51dba4];return _0x419e10;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('FaxMessage,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});}exports['CreateFaxMessage']=function(_0x48a7e1){var _0x23e14=this;return new Promise(function(_0x59f338,_0x3e1556){return db[_0xf54e('0x19')][_0xf54e('0x1a')](_0x48a7e1[_0xf54e('0x1b')],{'raw':_0x48a7e1[_0xf54e('0x1c')]?_0x48a7e1[_0xf54e('0x1c')][_0xf54e('0x1d')]===undefined?!![]:![]:!![]})[_0xf54e('0x10')](function(_0x3c0169){logger[_0xf54e('0x11')](_0xf54e('0x1e'),_0x48a7e1);logger['debug'](_0xf54e('0x1e'),_0x48a7e1,JSON['stringify'](_0x3c0169));_0x59f338(_0x3c0169);})[_0xf54e('0x18')](function(_0x272df6){logger[_0xf54e('0x14')](_0xf54e('0x1e'),_0x272df6[_0xf54e('0x16')],_0x48a7e1);_0x3e1556(_0x23e14[_0xf54e('0x14')](0x1f4,_0x272df6[_0xf54e('0x16')]));});});};exports[_0xf54e('0x1f')]=function(_0x2342a9){var _0x33457f=this;return new Promise(function(_0xf6cdd7,_0x39c0ae){return db[_0xf54e('0x19')]['update'](_0x2342a9[_0xf54e('0x1b')],{'raw':_0x2342a9['options']?_0x2342a9[_0xf54e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x20')]||null:null,'attributes':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9[_0xf54e('0x1c')][_0xf54e('0x21')]||null:null,'limit':_0x2342a9[_0xf54e('0x1c')]?_0x2342a9['options']['limit']||null:null})[_0xf54e('0x10')](function(_0x258d29){logger[_0xf54e('0x11')](_0xf54e('0x1f'),_0x2342a9);logger[_0xf54e('0x22')](_0xf54e('0x1f'),_0x2342a9,JSON[_0xf54e('0x13')](_0x258d29));_0xf6cdd7(_0x258d29);})[_0xf54e('0x18')](function(_0x3ae704){logger[_0xf54e('0x14')]('UpdateFaxMessage',_0x3ae704['message'],_0x2342a9);_0x39c0ae(_0x33457f[_0xf54e('0x14')](0x1f4,_0x3ae704[_0xf54e('0x16')]));});});}; \ No newline at end of file +var _0xfd28=['message','info','catch','create','body','options','then','CreateFaxMessage','UpdateFaxMessage','FaxMessage','raw','where','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b3355,_0x4f4dfd){var _0xa68c06=function(_0x4ee658){while(--_0x4ee658){_0x4b3355['push'](_0x4b3355['shift']());}};_0xa68c06(++_0x4f4dfd);}(_0xfd28,0x148));var _0x8fd2=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xfd28[_0x41c381];return _0x427981;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});config[_0x8fd2('0xa')]=_['defaults'](config['redis'],{'host':_0x8fd2('0xb'),'port':0x18eb});var socket=require(_0x8fd2('0xc'))(new Redis(config[_0x8fd2('0xa')]));require('./faxMessage.socket')[_0x8fd2('0xd')](socket);function respondWithRpcPromise(_0x49ca87,_0x2842f3,_0x5aabf0){return new BPromise(function(_0x34ae5c,_0x4fdf0b){return client[_0x8fd2('0xe')](_0x49ca87,_0x5aabf0)['then'](function(_0x1b6558){logger['info'](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));logger[_0x8fd2('0x11')](_0x8fd2('0x12'),_0x2842f3,_0x8fd2('0x10'),JSON[_0x8fd2('0x13')](_0x1b6558));if(_0x1b6558[_0x8fd2('0x14')]){if(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x15')]===0x1f4){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);return _0x4fdf0b(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);}logger['error'](_0x8fd2('0xf'),_0x2842f3,_0x1b6558['error']['message']);return _0x34ae5c(_0x1b6558['error'][_0x8fd2('0x16')]);}else{logger[_0x8fd2('0x17')](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));_0x34ae5c(_0x1b6558['result'][_0x8fd2('0x16')]);}})[_0x8fd2('0x18')](function(_0x411943){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x411943);_0x4fdf0b(_0x411943);});});}exports['CreateFaxMessage']=function(_0x48ad51){var _0x3a0939=this;return new Promise(function(_0x4a2002,_0x3c03de){return db['FaxMessage'][_0x8fd2('0x19')](_0x48ad51[_0x8fd2('0x1a')],{'raw':_0x48ad51['options']?_0x48ad51[_0x8fd2('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8fd2('0x1c')](function(_0x44ee7a){logger['info'](_0x8fd2('0x1d'),_0x48ad51);logger[_0x8fd2('0x11')](_0x8fd2('0x1d'),_0x48ad51,JSON['stringify'](_0x44ee7a));_0x4a2002(_0x44ee7a);})[_0x8fd2('0x18')](function(_0x3b9e2f){logger[_0x8fd2('0x14')](_0x8fd2('0x1d'),_0x3b9e2f[_0x8fd2('0x16')],_0x48ad51);_0x3c03de(_0x3a0939[_0x8fd2('0x14')](0x1f4,_0x3b9e2f[_0x8fd2('0x16')]));});});};exports[_0x8fd2('0x1e')]=function(_0x1456b4){var _0xbc5945=this;return new Promise(function(_0x3392fb,_0x1f3237){return db[_0x8fd2('0x1f')]['update'](_0x1456b4['body'],{'raw':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1456b4['options']?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x21')]||null:null,'attributes':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x22')]||null:null,'limit':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')]['limit']||null:null})[_0x8fd2('0x1c')](function(_0x13c9b9){logger[_0x8fd2('0x17')](_0x8fd2('0x1e'),_0x1456b4);logger[_0x8fd2('0x11')](_0x8fd2('0x1e'),_0x1456b4,JSON[_0x8fd2('0x13')](_0x13c9b9));_0x3392fb(_0x13c9b9);})['catch'](function(_0x5b992a){logger['error'](_0x8fd2('0x1e'),_0x5b992a[_0x8fd2('0x16')],_0x1456b4);_0x1f3237(_0xbc5945[_0x8fd2('0x14')](0x1f4,_0x5b992a[_0x8fd2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7313183..50a9afb 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 _0xa25e=['update','emit','removeListener','register','length','./faxMessage.events','save','remove'];(function(_0x4c2769,_0x42aadd){var _0x27bdf9=function(_0x4136a5){while(--_0x4136a5){_0x4c2769['push'](_0x4c2769['shift']());}};_0x27bdf9(++_0x42aadd);}(_0xa25e,0xd5));var _0xea25=function(_0x5b955c,_0x1b03c0){_0x5b955c=_0x5b955c-0x0;var _0x28028a=_0xa25e[_0x5b955c];return _0x28028a;};'use strict';var FaxMessageEvents=require(_0xea25('0x0'));var events=[_0xea25('0x1'),_0xea25('0x2'),_0xea25('0x3')];function createListener(_0x2da056,_0x153996){return function(_0x56a92c){_0x153996[_0xea25('0x4')](_0x2da056,_0x56a92c);};}function removeListener(_0x8d9e22,_0x4232f5){return function(){FaxMessageEvents[_0xea25('0x5')](_0x8d9e22,_0x4232f5);};}exports[_0xea25('0x6')]=function(_0x6d2818){for(var _0x70e0f6=0x0,_0x461eb8=events[_0xea25('0x7')];_0x70e0f6<_0x461eb8;_0x70e0f6++){var _0x5a232e=events[_0x70e0f6];var _0xba3284=createListener('faxMessage:'+_0x5a232e,_0x6d2818);FaxMessageEvents['on'](_0x5a232e,_0xba3284);}}; \ No newline at end of file +var _0xf1dd=['removeListener','register','length','./faxMessage.events','save','remove','emit'];(function(_0x232ceb,_0x5f47d8){var _0x13a45e=function(_0x105fe5){while(--_0x105fe5){_0x232ceb['push'](_0x232ceb['shift']());}};_0x13a45e(++_0x5f47d8);}(_0xf1dd,0x1c3));var _0xdf1d=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf1dd[_0x29d915];return _0x160f86;};'use strict';var FaxMessageEvents=require(_0xdf1d('0x0'));var events=[_0xdf1d('0x1'),_0xdf1d('0x2'),'update'];function createListener(_0x4eb489,_0x2cb121){return function(_0x35435a){_0x2cb121[_0xdf1d('0x3')](_0x4eb489,_0x35435a);};}function removeListener(_0xaaf07a,_0x100a08){return function(){FaxMessageEvents[_0xdf1d('0x4')](_0xaaf07a,_0x100a08);};}exports[_0xdf1d('0x5')]=function(_0xa41f77){for(var _0x2af59a=0x0,_0x1ed471=events[_0xdf1d('0x6')];_0x2af59a<_0x1ed471;_0x2af59a++){var _0x44cf84=events[_0x2af59a];var _0xb47ebe=createListener('faxMessage:'+_0x44cf84,_0xa41f77);FaxMessageEvents['on'](_0x44cf84,_0xb47ebe);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index edb39ac..22a2237 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 _0x39cb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb39c('0x4'));var interaction=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var controller=require(_0xb39c('0x7'));router[_0xb39c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb39c('0x9')]);router[_0xb39c('0x8')](_0xb39c('0xa'),auth[_0xb39c('0xb')](),controller['describe']);router['get'](_0xb39c('0xc'),auth[_0xb39c('0xb')](),controller[_0xb39c('0xd')]);router[_0xb39c('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb39c('0xe')]('/',auth[_0xb39c('0xb')](),interaction[_0xb39c('0xf')](_0xb39c('0x10'),_0xb39c('0x11')),controller[_0xb39c('0x12')]);router[_0xb39c('0x13')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x14')]);router[_0xb39c('0x13')](_0xb39c('0x15'),auth['isAuthenticated'](),controller[_0xb39c('0x16')]);router[_0xb39c('0x13')](_0xb39c('0x17'),auth[_0xb39c('0xb')](),controller[_0xb39c('0x18')]);router[_0xb39c('0x19')](_0xb39c('0xc'),auth['isAuthenticated'](),controller[_0xb39c('0x1a')]);module[_0xb39c('0x1b')]=router; \ No newline at end of file +var _0xbdb7=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','describe','show','/:id/download','isAuthenticated','download','post','tracked','put','/:id','update'];(function(_0x1a2b5c,_0x9c4ba3){var _0x380973=function(_0x202a37){while(--_0x202a37){_0x1a2b5c['push'](_0x1a2b5c['shift']());}};_0x380973(++_0x9c4ba3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x14e589,_0x5d5c97){_0x14e589=_0x14e589-0x0;var _0x4ceb8c=_0xbdb7[_0x14e589];return _0x4ceb8c;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/',auth[_0x7bdb('0xf')](),interaction[_0x7bdb('0x12')]('fax','faxmessage:create'),controller['create']);router[_0x7bdb('0x13')](_0x7bdb('0x14'),auth['isAuthenticated'](),controller[_0x7bdb('0x15')]);router['put']('/:id/accept',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')](_0x7bdb('0x14'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x19')]);module[_0x7bdb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 81ce3df..4f5c9cf 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 _0xff4f=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xff4f,0x156));var _0xfff4=function(_0x243ff4,_0x44a1b5){_0x243ff4=_0x243ff4-0x0;var _0x2ed845=_0xff4f[_0x243ff4];return _0x2ed845;};'use strict';var Sequelize=require(_0xfff4('0x0'));module[_0xfff4('0x1')]={'name':{'type':Sequelize[_0xfff4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfff4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfff4('0x4')](_0xfff4('0x5'),'beepall',_0xfff4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfff4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89b6=['rrmemory','roundrobin','exports','INTEGER','ENUM'];(function(_0x38ed11,_0x11f401){var _0x41cf50=function(_0x3d2b20){while(--_0x3d2b20){_0x38ed11['push'](_0x38ed11['shift']());}};_0x41cf50(++_0x11f401);}(_0x89b6,0xf2));var _0x689b=function(_0x4026d1,_0x53f826){_0x4026d1=_0x4026d1-0x0;var _0x4f978e=_0x89b6[_0x4026d1];return _0x4f978e;};'use strict';var Sequelize=require('sequelize');module[_0x689b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x689b('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x689b('0x2')](_0x689b('0x3'),'beepall',_0x689b('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x689b('0x1')],'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 f796c86..106d3ab 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 _0xe127=['save','then','UserProfileResource','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','merge','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject'];(function(_0x1a8746,_0x3fc447){var _0x33bdae=function(_0x90a160){while(--_0x90a160){_0x1a8746['push'](_0x1a8746['shift']());}};_0x33bdae(++_0x3fc447);}(_0xe127,0xe9));var _0x7e12=function(_0x50a3f4,_0x50347a){_0x50a3f4=_0x50a3f4-0x0;var _0x3df624=_0xe127[_0x50a3f4];return _0x3df624;};'use strict';var emlformat=require(_0x7e12('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e12('0x1'));var jsonpatch=require(_0x7e12('0x2'));var rp=require('request-promise');var moment=require(_0x7e12('0x3'));var BPromise=require(_0x7e12('0x4'));var Mustache=require(_0x7e12('0x5'));var util=require('util');var path=require(_0x7e12('0x6'));var sox=require(_0x7e12('0x7'));var csv=require(_0x7e12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e12('0x9'));var _=require(_0x7e12('0xa'));var squel=require('squel');var crypto=require(_0x7e12('0xb'));var jsforce=require(_0x7e12('0xc'));var deskjs=require(_0x7e12('0xd'));var toCsv=require(_0x7e12('0x8'));var querystring=require(_0x7e12('0xe'));var Papa=require(_0x7e12('0xf'));var Redis=require(_0x7e12('0x10'));var authService=require(_0x7e12('0x11'));var qs=require(_0x7e12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e12('0x13'));var logger=require('../../config/logger')(_0x7e12('0x14'));var utils=require(_0x7e12('0x15'));var config=require(_0x7e12('0x16'));var licenseUtil=require(_0x7e12('0x17'));var db=require(_0x7e12('0x18'))['db'];config['redis']=_[_0x7e12('0x19')](config[_0x7e12('0x1a')],{'host':_0x7e12('0x1b'),'port':0x18eb});var socket=require(_0x7e12('0x1c'))(new Redis(config[_0x7e12('0x1a')]));require(_0x7e12('0x1d'))[_0x7e12('0x1e')](socket);function respondWithStatusCode(_0x470cb4,_0x17d266){_0x17d266=_0x17d266||0xcc;return function(_0x3fc17f){if(_0x3fc17f){return _0x470cb4[_0x7e12('0x1f')](_0x17d266);}return _0x470cb4[_0x7e12('0x20')](_0x17d266)[_0x7e12('0x21')]();};}function respondWithResult(_0x26f11f,_0x31596f){_0x31596f=_0x31596f||0xc8;return function(_0x567943){if(_0x567943){return _0x26f11f['status'](_0x31596f)[_0x7e12('0x22')](_0x567943);}};}function respondWithFilteredResult(_0x4f4140,_0x19adb1){return function(_0x48bf3a){if(_0x48bf3a){var _0x3af795=typeof _0x19adb1[_0x7e12('0x23')]===_0x7e12('0x24')&&typeof _0x19adb1[_0x7e12('0x25')]===_0x7e12('0x24');var _0x3c9a49=_0x48bf3a[_0x7e12('0x26')];var _0x202340=_0x3af795?0x0:_0x19adb1['offset'];var _0x3475b=_0x3af795?_0x48bf3a[_0x7e12('0x26')]:_0x19adb1['offset']+_0x19adb1[_0x7e12('0x25')];var _0x10bc01;if(_0x3475b>=_0x3c9a49){_0x3475b=_0x3c9a49;_0x10bc01=0xc8;}else{_0x10bc01=0xce;}_0x4f4140['status'](_0x10bc01);return _0x4f4140[_0x7e12('0x27')]('Content-Range',_0x202340+'-'+_0x3475b+'/'+_0x3c9a49)[_0x7e12('0x22')](_0x48bf3a);}return null;};}function patchUpdates(_0x1fa33b){return function(_0x1b2e29){try{jsonpatch['apply'](_0x1b2e29,_0x1fa33b,!![]);}catch(_0x464041){return BPromise[_0x7e12('0x28')](_0x464041);}return _0x1b2e29[_0x7e12('0x29')]();};}function saveUpdates(_0x3b3013,_0x164846){return function(_0xb8386f){if(_0xb8386f){return _0xb8386f['update'](_0x3b3013)[_0x7e12('0x2a')](function(_0x429766){return _0x429766;});}return null;};}function removeEntity(_0x56ad74,_0x5b8542){return function(_0x1b5346){if(_0x1b5346){return _0x1b5346['destroy']()[_0x7e12('0x2a')](function(){var _0x8e0f56=_0x1b5346['get']({'plain':!![]});var _0x4cea99='FaxQueues';return db[_0x7e12('0x2b')]['destroy']({'where':{'type':_0x4cea99,'resourceId':_0x8e0f56['id']}})[_0x7e12('0x2a')](function(){return _0x1b5346;});})[_0x7e12('0x2a')](function(){_0x56ad74[_0x7e12('0x20')](0xcc)[_0x7e12('0x21')]();});}};}function handleEntityNotFound(_0x3a1f01,_0x481fc8){return function(_0x5dac5f){if(!_0x5dac5f){_0x3a1f01[_0x7e12('0x1f')](0x194);}return _0x5dac5f;};}function handleError(_0x263c49,_0x49c53a){_0x49c53a=_0x49c53a||0x1f4;return function(_0x1010ca){logger['error'](_0x1010ca[_0x7e12('0x2c')]);if(_0x1010ca[_0x7e12('0x2d')]){delete _0x1010ca[_0x7e12('0x2d')];}_0x263c49[_0x7e12('0x20')](_0x49c53a)['send'](_0x1010ca);};}exports[_0x7e12('0x2e')]=function(_0x2c345e,_0x8d6d32){var _0x9c9912={},_0xe6493b={},_0x2938c3={'count':0x0,'rows':[]};var _0x44cf24=_[_0x7e12('0x2f')](db[_0x7e12('0x30')][_0x7e12('0x31')],function(_0x26955d){return{'name':_0x26955d[_0x7e12('0x32')],'type':_0x26955d[_0x7e12('0x33')][_0x7e12('0x34')]};});_0xe6493b['model']=_[_0x7e12('0x2f')](_0x44cf24,_0x7e12('0x2d'));_0xe6493b[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0x2c345e[_0x7e12('0x35')]);_0xe6493b[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0xe6493b['model'],_0xe6493b['query']);_0x9c9912[_0x7e12('0x39')]=_['intersection'](_0xe6493b[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2c345e['query'][_0x7e12('0x3b')]));_0x9c9912[_0x7e12('0x39')]=_0x9c9912[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x9c9912[_0x7e12('0x39')]:_0xe6493b[_0x7e12('0x3a')];if(!_0x2c345e['query'][_0x7e12('0x3d')]('nolimit')){_0x9c9912[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0x2c345e[_0x7e12('0x35')][_0x7e12('0x25')]);_0x9c9912[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0x2c345e[_0x7e12('0x35')]['offset']);}_0x9c9912[_0x7e12('0x3e')]=qs['sort'](_0x2c345e['query'][_0x7e12('0x3f')]);_0x9c9912['where']=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x2c345e[_0x7e12('0x35')],_0xe6493b['filters']),_0x44cf24);if(_0x2c345e[_0x7e12('0x35')][_0x7e12('0x41')]){_0x9c9912['where']=_['merge'](_0x9c9912[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x44cf24,function(_0x405797){if(_0x405797[_0x7e12('0x33')]!==_0x7e12('0x43')){var _0x249572={};_0x249572[_0x405797[_0x7e12('0x2d')]]={'$like':'%'+_0x2c345e[_0x7e12('0x35')]['filter']+'%'};return _0x249572;}})});}_0x9c9912=_['merge']({},_0x9c9912,_0x2c345e[_0x7e12('0x44')]);var _0x401e18={'where':_0x9c9912['where']};return db[_0x7e12('0x30')][_0x7e12('0x26')](_0x401e18)[_0x7e12('0x2a')](function(_0xe1a80f){_0x2938c3[_0x7e12('0x26')]=_0xe1a80f;if(_0x2c345e[_0x7e12('0x35')]['includeAll']){_0x9c9912['include']=[{'all':!![]}];}return db['FaxQueue'][_0x7e12('0x45')](_0x9c9912);})[_0x7e12('0x2a')](function(_0x3be463){_0x2938c3[_0x7e12('0x46')]=_0x3be463;return _0x2938c3;})['then'](respondWithFilteredResult(_0x8d6d32,_0x9c9912))[_0x7e12('0x47')](handleError(_0x8d6d32,null));};exports['show']=function(_0x2fc0ff,_0x4de88b){var _0x468b3b={'raw':!![],'where':{'id':_0x2fc0ff[_0x7e12('0x48')]['id']}},_0x1da422={};_0x1da422[_0x7e12('0x3a')]=_[_0x7e12('0x36')](db[_0x7e12('0x30')]['rawAttributes']);_0x1da422['query']=_[_0x7e12('0x36')](_0x2fc0ff['query']);_0x1da422[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x1da422[_0x7e12('0x3a')],_0x1da422[_0x7e12('0x35')]);_0x468b3b[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x1da422[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2fc0ff[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x468b3b[_0x7e12('0x39')]=_0x468b3b[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x468b3b[_0x7e12('0x39')]:_0x1da422['model'];if(_0x2fc0ff[_0x7e12('0x35')][_0x7e12('0x49')]){_0x468b3b[_0x7e12('0x4a')]=[{'all':!![]}];}_0x468b3b=_['merge']({},_0x468b3b,_0x2fc0ff['options']);return db['FaxQueue'][_0x7e12('0x4b')](_0x468b3b)[_0x7e12('0x2a')](handleEntityNotFound(_0x4de88b,null))['then'](respondWithResult(_0x4de88b,null))[_0x7e12('0x47')](handleError(_0x4de88b,null));};exports[_0x7e12('0x4c')]=function(_0xa1fe9b,_0x5cdb3f){return db[_0x7e12('0x30')]['create'](_0xa1fe9b[_0x7e12('0x4d')],{})['then'](function(_0x11faf2){var _0x5216b8=_0xa1fe9b[_0x7e12('0x4e')][_0x7e12('0x4f')]({'plain':!![]});if(!_0x5216b8)throw new Error(_0x7e12('0x50'));if(_0x5216b8[_0x7e12('0x51')]===_0x7e12('0x4e')){var _0x4e4640=_0x11faf2['get']({'plain':!![]});var _0x2cf450=_0x7e12('0x52');return db[_0x7e12('0x53')]['find']({'where':{'name':_0x2cf450,'userProfileId':_0x5216b8[_0x7e12('0x54')]},'raw':!![]})[_0x7e12('0x2a')](function(_0x27af34){if(_0x27af34&&_0x27af34[_0x7e12('0x55')]===0x0){return db[_0x7e12('0x2b')]['create']({'name':_0x4e4640['name'],'resourceId':_0x4e4640['id'],'type':_0x27af34[_0x7e12('0x2d')],'sectionId':_0x27af34['id']},{})[_0x7e12('0x2a')](function(){return _0x11faf2;});}else{return _0x11faf2;}})[_0x7e12('0x47')](function(_0x42f4c9){logger[_0x7e12('0x56')](_0x7e12('0x57'),_0x42f4c9);throw _0x42f4c9;});}return _0x11faf2;})[_0x7e12('0x2a')](respondWithResult(_0x5cdb3f,0xc9))['catch'](handleError(_0x5cdb3f,null));};exports['update']=function(_0x285bdd,_0x19f1b6){if(_0x285bdd[_0x7e12('0x4d')]['id']){delete _0x285bdd[_0x7e12('0x4d')]['id'];}return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x285bdd[_0x7e12('0x48')]['id']}})['then'](handleEntityNotFound(_0x19f1b6,null))[_0x7e12('0x2a')](saveUpdates(_0x285bdd[_0x7e12('0x4d')],null))[_0x7e12('0x2a')](respondWithResult(_0x19f1b6,null))[_0x7e12('0x47')](handleError(_0x19f1b6,null));};exports['destroy']=function(_0x6edb9c,_0x2397fb){return db['FaxQueue'][_0x7e12('0x4b')]({'where':{'id':_0x6edb9c['params']['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x2397fb,null))[_0x7e12('0x2a')](removeEntity(_0x2397fb,null))['catch'](handleError(_0x2397fb,null));};exports[_0x7e12('0x58')]=function(_0x5d9465,_0x516896){return db[_0x7e12('0x30')][_0x7e12('0x58')]()[_0x7e12('0x2a')](respondWithResult(_0x516896,null))[_0x7e12('0x47')](handleError(_0x516896,null));};exports[_0x7e12('0x59')]=function(_0x2aba49,_0x145c58,_0x2c0541){var _0x177a7b={'raw':!![],'where':{}},_0x5233e9={},_0x4867d4;return db['FaxQueue'][_0x7e12('0x5a')]({'where':{'id':_0x2aba49[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x145c58,null))[_0x7e12('0x2a')](function(_0x5175ea){if(_0x5175ea){_0x4867d4=_0x5175ea[_0x7e12('0x4f')]({'plain':!![]});_0x5233e9[_0x7e12('0x3a')]=_[_0x7e12('0x36')](db[_0x7e12('0x5b')][_0x7e12('0x31')]);_0x5233e9[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0x2aba49['query']);_0x5233e9[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x5233e9[_0x7e12('0x3a')],_0x5233e9[_0x7e12('0x35')]);_0x177a7b[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x5233e9[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x2aba49[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x177a7b['attributes']=_0x177a7b[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x177a7b[_0x7e12('0x39')]:_0x5233e9[_0x7e12('0x3a')];if(!_0x2aba49[_0x7e12('0x35')][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x177a7b[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0x2aba49['query'][_0x7e12('0x25')]);_0x177a7b['offset']=qs['offset'](_0x2aba49[_0x7e12('0x35')]['offset']);}_0x177a7b[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0x2aba49[_0x7e12('0x35')]['sort']);_0x177a7b[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x2aba49['query'],_0x5233e9[_0x7e12('0x37')]));_0x177a7b[_0x7e12('0x42')]['FaxQueueId']=_0x5175ea['id'];if(_0x2aba49[_0x7e12('0x35')]['filter']){_0x177a7b[_0x7e12('0x42')]=_['merge'](_0x177a7b[_0x7e12('0x42')],{'$or':_['map'](_0x177a7b[_0x7e12('0x39')],function(_0x491e31){var _0x3697ed={};_0x3697ed[_0x491e31]={'$like':'%'+_0x2aba49[_0x7e12('0x35')]['filter']+'%'};return _0x3697ed;})});}_0x177a7b=_['merge']({},_0x177a7b,_0x2aba49[_0x7e12('0x44')]);return db['UserFaxQueue']['findAll'](_0x177a7b);}})[_0x7e12('0x2a')](function(_0x36fb68){if(_0x36fb68){return db[_0x7e12('0x5d')][_0x7e12('0x5e')]({'where':{'id':_[_0x7e12('0x2f')](_0x36fb68,_0x7e12('0x5f')),'role':_0x7e12('0x60')},'attributes':['id','name',_0x7e12('0x61'),_0x7e12('0x62'),_0x7e12('0x63')]});}})[_0x7e12('0x2a')](function(_0x4010b5){if(_0x4010b5){return{'count':_0x4010b5[_0x7e12('0x26')],'rows':_[_0x7e12('0x2f')](_0x4010b5['rows'],function(_0x4d34af){return{'membername':_0x4d34af['name'],'UserId':_0x4d34af['id'],'queue_name':_0x4867d4[_0x7e12('0x2d')],'FaxQueueId':_0x4867d4['id'],'interface':util['format']('%s/%s','SIP',_0x4d34af[_0x7e12('0x2d')]),'penalty':0x0,'paused':_0x4d34af['faxPause'],'createdAt':_0x4d34af[_0x7e12('0x63')],'updatedAt':_0x4d34af[_0x7e12('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x145c58,_0x177a7b))[_0x7e12('0x47')](handleError(_0x145c58,null));};exports['getTeams']=function(_0x376ec7,_0x58a820,_0x3766df){var _0x42ff05={};var _0x904c8e={};var _0x3a3124;var _0x3bd111;return db[_0x7e12('0x30')][_0x7e12('0x5a')]({'where':{'id':_0x376ec7[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x58a820,null))[_0x7e12('0x2a')](function(_0x5f0c99){if(_0x5f0c99){_0x3a3124=_0x5f0c99;_0x904c8e['model']=_['keys'](db['Team'][_0x7e12('0x31')]);_0x904c8e['query']=_[_0x7e12('0x36')](_0x376ec7['query']);_0x904c8e[_0x7e12('0x37')]=_[_0x7e12('0x38')](_0x904c8e['model'],_0x904c8e[_0x7e12('0x35')]);_0x42ff05['attributes']=_[_0x7e12('0x38')](_0x904c8e[_0x7e12('0x3a')],qs[_0x7e12('0x3b')](_0x376ec7[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x42ff05[_0x7e12('0x39')]=_0x42ff05[_0x7e12('0x39')][_0x7e12('0x3c')]?_0x42ff05[_0x7e12('0x39')]:_0x904c8e[_0x7e12('0x3a')];_0x42ff05[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0x376ec7[_0x7e12('0x35')]['sort']);_0x42ff05[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0x376ec7['query'],_0x904c8e[_0x7e12('0x37')]));if(_0x376ec7['query']['filter']){_0x42ff05[_0x7e12('0x42')]=_[_0x7e12('0x64')](_0x42ff05[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x42ff05['attributes'],function(_0x3dc41b){var _0xf8ebb5={};_0xf8ebb5[_0x3dc41b]={'$like':'%'+_0x376ec7[_0x7e12('0x35')]['filter']+'%'};return _0xf8ebb5;})});}_0x42ff05=_['merge']({},_0x42ff05,_0x376ec7[_0x7e12('0x44')]);return _0x3a3124['getTeams'](_0x42ff05);}})[_0x7e12('0x2a')](function(_0x46eb12){if(_0x46eb12){_0x3bd111=_0x46eb12[_0x7e12('0x3c')];if(!_0x376ec7['query'][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x42ff05[_0x7e12('0x25')]=qs['limit'](_0x376ec7[_0x7e12('0x35')]['limit']);_0x42ff05[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0x376ec7[_0x7e12('0x35')][_0x7e12('0x23')]);}return _0x3a3124['getTeams'](_0x42ff05);}})[_0x7e12('0x2a')](function(_0x1cf939){if(_0x1cf939){return _0x1cf939?{'count':_0x3bd111,'rows':_0x1cf939}:null;}})[_0x7e12('0x2a')](respondWithResult(_0x58a820,null))['catch'](handleError(_0x58a820,null));};exports[_0x7e12('0x65')]=function(_0x34958a,_0xb41d77,_0x45336d){var _0x4968ec=_0x34958a[_0x7e12('0x4d')]['ids'];return db['Team'][_0x7e12('0x45')]({'where':{'id':_0x4968ec},'attributes':['id'],'include':[{'model':db[_0x7e12('0x5d')],'as':'Agents','attributes':['id',_0x7e12('0x2d'),'online',_0x7e12('0x66'),_0x7e12('0x67')],'raw':!![]}]})[_0x7e12('0x2a')](function(_0xfe70b3){if(_0xfe70b3){var _0x9f882f=_[_0x7e12('0x68')](_0xfe70b3,function(_0x16805a){var _0x3acbb9=_0x16805a['get']({'plain':!![]});return _0x3acbb9[_0x7e12('0x69')];});return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x34958a['params']['id']}})['then'](function(_0x100177){return db[_0x7e12('0x6a')][_0x7e12('0x6b')](function(_0x27c839){return _0x100177[_0x7e12('0x65')](_0x4968ec,{'transaction':_0x27c839})[_0x7e12('0x2a')](function(){return BPromise[_0x7e12('0x6c')](_0x9f882f,function(_0x265ea3){return db['UserFaxQueue'][_0x7e12('0x6d')]({'where':{'UserId':_0x265ea3['id'],'FaxQueueId':_0x34958a['params']['id']},'transaction':_0x27c839});});})['then'](function(){_0x9f882f[_0x7e12('0x6e')](function(_0x3deb76){socket[_0x7e12('0x6f')]('userFaxQueue:save',{'UserId':_0x3deb76['id'],'FaxQueueId':_0x100177['id']});});});});});}})[_0x7e12('0x2a')](respondWithStatusCode(_0xb41d77,null))[_0x7e12('0x47')](handleError(_0xb41d77,null));};exports[_0x7e12('0x70')]=function(_0x1a78f3,_0x2a1bc3,_0x1fb7b2){return db['Team'][_0x7e12('0x45')]({'where':{'id':_0x1a78f3[_0x7e12('0x35')][_0x7e12('0x71')]},'attributes':['id'],'include':[{'model':db[_0x7e12('0x5d')],'as':_0x7e12('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7e12('0x2a')](handleEntityNotFound(_0x2a1bc3,null))['then'](function(_0x14e70b){var _0x2d5e2c=_['map'](_0x14e70b,'id');var _0x4180c5=[];var _0x4d730e=[];var _0x1e156e=squel[_0x7e12('0x72')]();_0x1e156e[_0x7e12('0x73')](_0x7e12('0x74'))[_0x7e12('0x75')]('team_has_fax_queues','tq')['join'](_0x7e12('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7e12('0x77'),_0x1a78f3[_0x7e12('0x48')]['id']);for(var _0x8957b6=0x0;_0x8957b6<_0x14e70b[_0x7e12('0x3c')];_0x8957b6+=0x1){let _0x43e037=_0x14e70b[_0x8957b6];for(var _0x41a652=0x0;_0x41a652<_0x43e037[_0x7e12('0x69')][_0x7e12('0x3c')];_0x41a652+=0x1){let _0x50e636=_0x43e037['Agents'][_0x41a652];var _0x528329=_0x1e156e[_0x7e12('0x78')]();_0x528329[_0x7e12('0x42')](_0x7e12('0x79'),_0x50e636['id']);_0x4d730e[_0x7e12('0x7a')](db[_0x7e12('0x6a')]['query'](_0x528329[_0x7e12('0x7b')](),{'type':db[_0x7e12('0x6a')]['QueryTypes'][_0x7e12('0x7c')]})[_0x7e12('0x2a')](function(_0x2d01ed){if(_0x2d01ed['length']===0x1){return _0x50e636['id'];}else{var _0x194a0b=_[_0x7e12('0x7d')](_[_0x7e12('0x2f')](_0x2d01ed,_0x7e12('0x7e')),function(_0x22c516){return _['includes'](_0x2d5e2c,_0x22c516);});if(_0x194a0b){return _0x50e636['id'];}}}));}}return BPromise['all'](_0x4d730e)[_0x7e12('0x2a')](function(_0x4cfcad){_0x4180c5=_(_0x4180c5)[_0x7e12('0x7f')](_0x4cfcad)[_0x7e12('0x80')]()['value']();return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x1a78f3['params']['id']}})['then'](function(_0x22e70b){return db[_0x7e12('0x6a')][_0x7e12('0x6b')](function(_0x2075e1){return _0x22e70b[_0x7e12('0x70')](_0x1a78f3['query'][_0x7e12('0x71')],{'transaction':_0x2075e1})[_0x7e12('0x2a')](function(){if(!_[_0x7e12('0x81')](_0x4180c5)){return _0x22e70b[_0x7e12('0x82')](_0x4180c5,{'transaction':_0x2075e1});}})[_0x7e12('0x2a')](function(){_0x4180c5[_0x7e12('0x6e')](function(_0x1eeb1d){socket['emit'](_0x7e12('0x83'),{'UserId':_0x1eeb1d,'FaxQueueId':_0x22e70b['id']});});});});});});})['then'](respondWithStatusCode(_0x2a1bc3,null))[_0x7e12('0x47')](handleError(_0x2a1bc3,null));};exports[_0x7e12('0x84')]=function(_0x58fe80,_0x49e381,_0xbb1f5e){return db[_0x7e12('0x30')][_0x7e12('0x4b')]({'where':{'id':_0x58fe80[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x49e381,null))['then'](function(_0x2ad52e){if(_0x2ad52e){return _0x2ad52e[_0x7e12('0x84')](_0x58fe80['body'][_0x7e12('0x71')],_[_0x7e12('0x85')](_0x58fe80['body'],['ids','id'])||{})['spread'](function(_0x429a25){for(var _0x2ce6e7=0x0;_0x2ce6e7<_0x58fe80[_0x7e12('0x4d')][_0x7e12('0x71')][_0x7e12('0x3c')];_0x2ce6e7+=0x1){socket['emit'](_0x7e12('0x86'),{'UserId':Number(_0x58fe80[_0x7e12('0x4d')][_0x7e12('0x71')][_0x2ce6e7]),'FaxQueueId':Number(_0x58fe80[_0x7e12('0x48')]['id'])});}return _0x429a25;});}})[_0x7e12('0x2a')](respondWithResult(_0x49e381,null))['catch'](handleError(_0x49e381,null));};exports[_0x7e12('0x82')]=function(_0x5a7607,_0xec4396,_0x484651){return db[_0x7e12('0x30')]['find']({'where':{'id':_0x5a7607[_0x7e12('0x48')]['id']}})['then'](handleEntityNotFound(_0xec4396,null))[_0x7e12('0x2a')](function(_0x27e20e){if(_0x27e20e){return _0x27e20e['removeAgents'](_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')])[_0x7e12('0x2a')](function(){if(_[_0x7e12('0x87')](_0x5a7607['query'][_0x7e12('0x71')])){for(var _0xc6df31=0x0;_0xc6df31<_0x5a7607['query']['ids'][_0x7e12('0x3c')];_0xc6df31+=0x1){socket[_0x7e12('0x6f')](_0x7e12('0x83'),{'UserId':Number(_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')][_0xc6df31]),'FaxQueueId':Number(_0x5a7607[_0x7e12('0x48')]['id'])});}}else{socket[_0x7e12('0x6f')](_0x7e12('0x83'),{'UserId':Number(_0x5a7607[_0x7e12('0x35')][_0x7e12('0x71')]),'FaxQueueId':Number(_0x5a7607[_0x7e12('0x48')]['id'])});}});}})[_0x7e12('0x2a')](respondWithStatusCode(_0xec4396,null))[_0x7e12('0x47')](handleError(_0xec4396,null));};exports[_0x7e12('0x88')]=function(_0xebcae7,_0x477a8b,_0x52be8b){var _0x545ff0={};var _0x4ec02f={};var _0x3f163a;var _0x56363a;return db[_0x7e12('0x30')][_0x7e12('0x5a')]({'where':{'id':_0xebcae7[_0x7e12('0x48')]['id']}})[_0x7e12('0x2a')](handleEntityNotFound(_0x477a8b,null))[_0x7e12('0x2a')](function(_0x2d645d){if(_0x2d645d){_0x3f163a=_0x2d645d;_0x4ec02f['model']=_['keys'](db['User']['rawAttributes']);_0x4ec02f[_0x7e12('0x35')]=_[_0x7e12('0x36')](_0xebcae7[_0x7e12('0x35')]);_0x4ec02f[_0x7e12('0x37')]=_['intersection'](_0x4ec02f[_0x7e12('0x3a')],_0x4ec02f[_0x7e12('0x35')]);_0x545ff0[_0x7e12('0x39')]=_[_0x7e12('0x38')](_0x4ec02f[_0x7e12('0x3a')],qs['fields'](_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3b')]));_0x545ff0[_0x7e12('0x39')]=_0x545ff0['attributes'][_0x7e12('0x3c')]?_0x545ff0[_0x7e12('0x39')]:_0x4ec02f[_0x7e12('0x3a')];_0x545ff0[_0x7e12('0x3e')]=qs[_0x7e12('0x3f')](_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3f')]);_0x545ff0[_0x7e12('0x42')]=qs[_0x7e12('0x37')](_[_0x7e12('0x40')](_0xebcae7[_0x7e12('0x35')],_0x4ec02f[_0x7e12('0x37')]));if(_0xebcae7[_0x7e12('0x35')][_0x7e12('0x41')]){_0x545ff0['where']=_['merge'](_0x545ff0[_0x7e12('0x42')],{'$or':_[_0x7e12('0x2f')](_0x545ff0[_0x7e12('0x39')],function(_0x55f142){var _0x509052={};_0x509052[_0x55f142]={'$like':'%'+_0xebcae7['query'][_0x7e12('0x41')]+'%'};return _0x509052;})});}_0x545ff0=_[_0x7e12('0x64')]({},_0x545ff0,_0xebcae7[_0x7e12('0x44')]);return _0x3f163a[_0x7e12('0x88')](_0x545ff0);}})[_0x7e12('0x2a')](function(_0x25e0e6){if(_0x25e0e6){_0x56363a=_0x25e0e6[_0x7e12('0x3c')];if(!_0xebcae7[_0x7e12('0x35')][_0x7e12('0x3d')](_0x7e12('0x5c'))){_0x545ff0[_0x7e12('0x25')]=qs[_0x7e12('0x25')](_0xebcae7[_0x7e12('0x35')]['limit']);_0x545ff0[_0x7e12('0x23')]=qs[_0x7e12('0x23')](_0xebcae7['query']['offset']);}return _0x3f163a[_0x7e12('0x88')](_0x545ff0);}})[_0x7e12('0x2a')](function(_0x5b1cb9){if(_0x5b1cb9){return _0x5b1cb9?{'count':_0x56363a,'rows':_0x5b1cb9}:null;}})[_0x7e12('0x2a')](respondWithResult(_0x477a8b,null))[_0x7e12('0x47')](handleError(_0x477a8b,null));}; \ No newline at end of file +var _0xc27a=['UserFaxQueue','order','FaxQueueId','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','omit','spread','isArray','getAgents','rimraf','request-promise','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','offset','undefined','count','set','Content-Range','reject','save','update','then','get','FaxQueues','destroy','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','rows','show','keys','includeAll','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers'];(function(_0x1b0523,_0x162a1b){var _0x4a86cc=function(_0x87f9aa){while(--_0x87f9aa){_0x1b0523['push'](_0x1b0523['shift']());}};_0x4a86cc(++_0x162a1b);}(_0xc27a,0xc2));var _0xac27=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0xc27a[_0x115621];return _0x5ef5ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac27('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xac27('0x2'));var util=require(_0xac27('0x3'));var path=require('path');var sox=require(_0xac27('0x4'));var csv=require(_0xac27('0x5'));var ejs=require(_0xac27('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xac27('0x7'));var jsforce=require(_0xac27('0x8'));var deskjs=require(_0xac27('0x9'));var toCsv=require('to-csv');var querystring=require(_0xac27('0xa'));var Papa=require('papaparse');var Redis=require(_0xac27('0xb'));var authService=require(_0xac27('0xc'));var qs=require(_0xac27('0xd'));var as=require(_0xac27('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac27('0xf'))(_0xac27('0x10'));var utils=require(_0xac27('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xac27('0x12'));var db=require('../../mysqldb')['db'];config[_0xac27('0x13')]=_['defaults'](config[_0xac27('0x13')],{'host':_0xac27('0x14'),'port':0x18eb});var socket=require(_0xac27('0x15'))(new Redis(config[_0xac27('0x13')]));require(_0xac27('0x16'))[_0xac27('0x17')](socket);function respondWithStatusCode(_0x42f64c,_0x17dd5a){_0x17dd5a=_0x17dd5a||0xcc;return function(_0x40ebf1){if(_0x40ebf1){return _0x42f64c['sendStatus'](_0x17dd5a);}return _0x42f64c[_0xac27('0x18')](_0x17dd5a)[_0xac27('0x19')]();};}function respondWithResult(_0x911c2d,_0x27b741){_0x27b741=_0x27b741||0xc8;return function(_0x4031b1){if(_0x4031b1){return _0x911c2d[_0xac27('0x18')](_0x27b741)['json'](_0x4031b1);}};}function respondWithFilteredResult(_0x471d75,_0x1b8c08){return function(_0x566d6f){if(_0x566d6f){var _0x2f6d79=typeof _0x1b8c08[_0xac27('0x1a')]===_0xac27('0x1b')&&typeof _0x1b8c08['limit']===_0xac27('0x1b');var _0x5c97ba=_0x566d6f[_0xac27('0x1c')];var _0x599799=_0x2f6d79?0x0:_0x1b8c08[_0xac27('0x1a')];var _0x6841f9=_0x2f6d79?_0x566d6f['count']:_0x1b8c08[_0xac27('0x1a')]+_0x1b8c08['limit'];var _0x77abb4;if(_0x6841f9>=_0x5c97ba){_0x6841f9=_0x5c97ba;_0x77abb4=0xc8;}else{_0x77abb4=0xce;}_0x471d75[_0xac27('0x18')](_0x77abb4);return _0x471d75[_0xac27('0x1d')](_0xac27('0x1e'),_0x599799+'-'+_0x6841f9+'/'+_0x5c97ba)['json'](_0x566d6f);}return null;};}function patchUpdates(_0x3bc017){return function(_0x3d2601){try{jsonpatch['apply'](_0x3d2601,_0x3bc017,!![]);}catch(_0x3c874c){return BPromise[_0xac27('0x1f')](_0x3c874c);}return _0x3d2601[_0xac27('0x20')]();};}function saveUpdates(_0x11fae7,_0x18c2db){return function(_0x2ac284){if(_0x2ac284){return _0x2ac284[_0xac27('0x21')](_0x11fae7)[_0xac27('0x22')](function(_0x18d904){return _0x18d904;});}return null;};}function removeEntity(_0x5c79d2,_0x3290cd){return function(_0xff68fc){if(_0xff68fc){return _0xff68fc['destroy']()[_0xac27('0x22')](function(){var _0x1d4baf=_0xff68fc[_0xac27('0x23')]({'plain':!![]});var _0x5c7f85=_0xac27('0x24');return db['UserProfileResource'][_0xac27('0x25')]({'where':{'type':_0x5c7f85,'resourceId':_0x1d4baf['id']}})['then'](function(){return _0xff68fc;});})[_0xac27('0x22')](function(){_0x5c79d2[_0xac27('0x18')](0xcc)[_0xac27('0x19')]();});}};}function handleEntityNotFound(_0x5be0f8,_0x6b580a){return function(_0xd1bf8d){if(!_0xd1bf8d){_0x5be0f8['sendStatus'](0x194);}return _0xd1bf8d;};}function handleError(_0x55ef38,_0x1b3228){_0x1b3228=_0x1b3228||0x1f4;return function(_0x2d923d){logger[_0xac27('0x26')](_0x2d923d[_0xac27('0x27')]);if(_0x2d923d[_0xac27('0x28')]){delete _0x2d923d['name'];}_0x55ef38[_0xac27('0x18')](_0x1b3228)[_0xac27('0x29')](_0x2d923d);};}exports['index']=function(_0x57729a,_0x4b2354){var _0x163202={},_0x4b6a46={},_0x30a938={'count':0x0,'rows':[]};var _0x4f11fa=_[_0xac27('0x2a')](db[_0xac27('0x2b')][_0xac27('0x2c')],function(_0x6396f6){return{'name':_0x6396f6[_0xac27('0x2d')],'type':_0x6396f6['type'][_0xac27('0x2e')]};});_0x4b6a46[_0xac27('0x2f')]=_[_0xac27('0x2a')](_0x4f11fa,'name');_0x4b6a46['query']=_['keys'](_0x57729a[_0xac27('0x30')]);_0x4b6a46[_0xac27('0x31')]=_[_0xac27('0x32')](_0x4b6a46[_0xac27('0x2f')],_0x4b6a46[_0xac27('0x30')]);_0x163202[_0xac27('0x33')]=_[_0xac27('0x32')](_0x4b6a46['model'],qs[_0xac27('0x34')](_0x57729a['query'][_0xac27('0x34')]));_0x163202[_0xac27('0x33')]=_0x163202[_0xac27('0x33')][_0xac27('0x35')]?_0x163202[_0xac27('0x33')]:_0x4b6a46['model'];if(!_0x57729a[_0xac27('0x30')][_0xac27('0x36')](_0xac27('0x37'))){_0x163202['limit']=qs[_0xac27('0x38')](_0x57729a[_0xac27('0x30')][_0xac27('0x38')]);_0x163202[_0xac27('0x1a')]=qs['offset'](_0x57729a['query']['offset']);}_0x163202['order']=qs[_0xac27('0x39')](_0x57729a[_0xac27('0x30')][_0xac27('0x39')]);_0x163202[_0xac27('0x3a')]=qs[_0xac27('0x31')](_[_0xac27('0x3b')](_0x57729a['query'],_0x4b6a46[_0xac27('0x31')]),_0x4f11fa);if(_0x57729a['query'][_0xac27('0x3c')]){_0x163202[_0xac27('0x3a')]=_[_0xac27('0x3d')](_0x163202[_0xac27('0x3a')],{'$or':_[_0xac27('0x2a')](_0x4f11fa,function(_0x288643){if(_0x288643[_0xac27('0x3e')]!==_0xac27('0x3f')){var _0x1e5454={};_0x1e5454[_0x288643[_0xac27('0x28')]]={'$like':'%'+_0x57729a['query'][_0xac27('0x3c')]+'%'};return _0x1e5454;}})});}_0x163202=_[_0xac27('0x3d')]({},_0x163202,_0x57729a['options']);var _0x92fd7c={'where':_0x163202[_0xac27('0x3a')]};return db['FaxQueue'][_0xac27('0x1c')](_0x92fd7c)['then'](function(_0x5be076){_0x30a938['count']=_0x5be076;if(_0x57729a['query']['includeAll']){_0x163202['include']=[{'all':!![]}];}return db[_0xac27('0x2b')]['findAll'](_0x163202);})['then'](function(_0x43f883){_0x30a938[_0xac27('0x40')]=_0x43f883;return _0x30a938;})[_0xac27('0x22')](respondWithFilteredResult(_0x4b2354,_0x163202))['catch'](handleError(_0x4b2354,null));};exports[_0xac27('0x41')]=function(_0x2e5ae5,_0x277498){var _0x420312={'raw':!![],'where':{'id':_0x2e5ae5['params']['id']}},_0x45893f={};_0x45893f[_0xac27('0x2f')]=_[_0xac27('0x42')](db[_0xac27('0x2b')]['rawAttributes']);_0x45893f['query']=_[_0xac27('0x42')](_0x2e5ae5[_0xac27('0x30')]);_0x45893f['filters']=_[_0xac27('0x32')](_0x45893f['model'],_0x45893f[_0xac27('0x30')]);_0x420312[_0xac27('0x33')]=_[_0xac27('0x32')](_0x45893f['model'],qs[_0xac27('0x34')](_0x2e5ae5['query'][_0xac27('0x34')]));_0x420312['attributes']=_0x420312[_0xac27('0x33')][_0xac27('0x35')]?_0x420312[_0xac27('0x33')]:_0x45893f['model'];if(_0x2e5ae5['query'][_0xac27('0x43')]){_0x420312[_0xac27('0x44')]=[{'all':!![]}];}_0x420312=_[_0xac27('0x3d')]({},_0x420312,_0x2e5ae5[_0xac27('0x45')]);return db[_0xac27('0x2b')]['find'](_0x420312)[_0xac27('0x22')](handleEntityNotFound(_0x277498,null))[_0xac27('0x22')](respondWithResult(_0x277498,null))[_0xac27('0x46')](handleError(_0x277498,null));};exports[_0xac27('0x47')]=function(_0x2d4395,_0x5956cd){return db[_0xac27('0x2b')][_0xac27('0x47')](_0x2d4395[_0xac27('0x48')],{})['then'](function(_0x5adb5a){var _0x3ec592=_0x2d4395[_0xac27('0x49')][_0xac27('0x23')]({'plain':!![]});if(!_0x3ec592)throw new Error(_0xac27('0x4a'));if(_0x3ec592[_0xac27('0x4b')]===_0xac27('0x49')){var _0x55b596=_0x5adb5a['get']({'plain':!![]});var _0x5e3d10=_0xac27('0x24');return db[_0xac27('0x4c')]['find']({'where':{'name':_0x5e3d10,'userProfileId':_0x3ec592[_0xac27('0x4d')]},'raw':!![]})[_0xac27('0x22')](function(_0x297436){if(_0x297436&&_0x297436[_0xac27('0x4e')]===0x0){return db['UserProfileResource'][_0xac27('0x47')]({'name':_0x55b596[_0xac27('0x28')],'resourceId':_0x55b596['id'],'type':_0x297436[_0xac27('0x28')],'sectionId':_0x297436['id']},{})[_0xac27('0x22')](function(){return _0x5adb5a;});}else{return _0x5adb5a;}})[_0xac27('0x46')](function(_0x304bac){logger[_0xac27('0x26')](_0xac27('0x4f'),_0x304bac);throw _0x304bac;});}return _0x5adb5a;})[_0xac27('0x22')](respondWithResult(_0x5956cd,0xc9))[_0xac27('0x46')](handleError(_0x5956cd,null));};exports[_0xac27('0x21')]=function(_0xd3ab2,_0x409638){if(_0xd3ab2[_0xac27('0x48')]['id']){delete _0xd3ab2['body']['id'];}return db[_0xac27('0x2b')][_0xac27('0x50')]({'where':{'id':_0xd3ab2[_0xac27('0x51')]['id']}})['then'](handleEntityNotFound(_0x409638,null))[_0xac27('0x22')](saveUpdates(_0xd3ab2[_0xac27('0x48')],null))[_0xac27('0x22')](respondWithResult(_0x409638,null))[_0xac27('0x46')](handleError(_0x409638,null));};exports[_0xac27('0x25')]=function(_0x4a9ce2,_0x52f3c9){return db[_0xac27('0x2b')][_0xac27('0x50')]({'where':{'id':_0x4a9ce2[_0xac27('0x51')]['id']}})[_0xac27('0x22')](handleEntityNotFound(_0x52f3c9,null))[_0xac27('0x22')](removeEntity(_0x52f3c9,null))[_0xac27('0x46')](handleError(_0x52f3c9,null));};exports['describe']=function(_0x39f1a4,_0x13a47f){return db[_0xac27('0x2b')][_0xac27('0x52')]()[_0xac27('0x22')](respondWithResult(_0x13a47f,null))[_0xac27('0x46')](handleError(_0x13a47f,null));};exports[_0xac27('0x53')]=function(_0x59a2f8,_0x1bf2d0,_0x2484d0){var _0x2155bf={'raw':!![],'where':{}},_0xa4ddf={},_0x96484f;return db[_0xac27('0x2b')]['findOne']({'where':{'id':_0x59a2f8['params']['id']}})[_0xac27('0x22')](handleEntityNotFound(_0x1bf2d0,null))[_0xac27('0x22')](function(_0x28ec03){if(_0x28ec03){_0x96484f=_0x28ec03[_0xac27('0x23')]({'plain':!![]});_0xa4ddf['model']=_[_0xac27('0x42')](db[_0xac27('0x54')][_0xac27('0x2c')]);_0xa4ddf[_0xac27('0x30')]=_['keys'](_0x59a2f8['query']);_0xa4ddf[_0xac27('0x31')]=_[_0xac27('0x32')](_0xa4ddf[_0xac27('0x2f')],_0xa4ddf[_0xac27('0x30')]);_0x2155bf[_0xac27('0x33')]=_[_0xac27('0x32')](_0xa4ddf[_0xac27('0x2f')],qs[_0xac27('0x34')](_0x59a2f8[_0xac27('0x30')]['fields']));_0x2155bf[_0xac27('0x33')]=_0x2155bf[_0xac27('0x33')]['length']?_0x2155bf[_0xac27('0x33')]:_0xa4ddf[_0xac27('0x2f')];if(!_0x59a2f8[_0xac27('0x30')][_0xac27('0x36')]('nolimit')){_0x2155bf[_0xac27('0x38')]=qs[_0xac27('0x38')](_0x59a2f8[_0xac27('0x30')][_0xac27('0x38')]);_0x2155bf[_0xac27('0x1a')]=qs['offset'](_0x59a2f8[_0xac27('0x30')][_0xac27('0x1a')]);}_0x2155bf[_0xac27('0x55')]=qs['sort'](_0x59a2f8[_0xac27('0x30')][_0xac27('0x39')]);_0x2155bf[_0xac27('0x3a')]=qs['filters'](_['pick'](_0x59a2f8[_0xac27('0x30')],_0xa4ddf[_0xac27('0x31')]));_0x2155bf[_0xac27('0x3a')][_0xac27('0x56')]=_0x28ec03['id'];if(_0x59a2f8[_0xac27('0x30')]['filter']){_0x2155bf[_0xac27('0x3a')]=_[_0xac27('0x3d')](_0x2155bf[_0xac27('0x3a')],{'$or':_[_0xac27('0x2a')](_0x2155bf[_0xac27('0x33')],function(_0x3ed319){var _0x543554={};_0x543554[_0x3ed319]={'$like':'%'+_0x59a2f8[_0xac27('0x30')][_0xac27('0x3c')]+'%'};return _0x543554;})});}_0x2155bf=_['merge']({},_0x2155bf,_0x59a2f8['options']);return db[_0xac27('0x54')][_0xac27('0x57')](_0x2155bf);}})[_0xac27('0x22')](function(_0x42604b){if(_0x42604b){return db['User'][_0xac27('0x58')]({'where':{'id':_[_0xac27('0x2a')](_0x42604b,_0xac27('0x59')),'role':_0xac27('0x5a')},'attributes':['id',_0xac27('0x28'),_0xac27('0x5b'),_0xac27('0x5c'),_0xac27('0x5d')]});}})['then'](function(_0x862f6e){if(_0x862f6e){return{'count':_0x862f6e[_0xac27('0x1c')],'rows':_['map'](_0x862f6e['rows'],function(_0x1f7c80){return{'membername':_0x1f7c80[_0xac27('0x28')],'UserId':_0x1f7c80['id'],'queue_name':_0x96484f[_0xac27('0x28')],'FaxQueueId':_0x96484f['id'],'interface':util[_0xac27('0x5e')](_0xac27('0x5f'),_0xac27('0x60'),_0x1f7c80[_0xac27('0x28')]),'penalty':0x0,'paused':_0x1f7c80['faxPause'],'createdAt':_0x1f7c80[_0xac27('0x5d')],'updatedAt':_0x1f7c80[_0xac27('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac27('0x22')](respondWithFilteredResult(_0x1bf2d0,_0x2155bf))[_0xac27('0x46')](handleError(_0x1bf2d0,null));};exports['getTeams']=function(_0x1477a8,_0x222d94,_0x30bbb1){var _0x3c9ef4={};var _0x34e112={};var _0x22fd9d;var _0x33ee12;return db[_0xac27('0x2b')][_0xac27('0x61')]({'where':{'id':_0x1477a8[_0xac27('0x51')]['id']}})[_0xac27('0x22')](handleEntityNotFound(_0x222d94,null))[_0xac27('0x22')](function(_0x525506){if(_0x525506){_0x22fd9d=_0x525506;_0x34e112[_0xac27('0x2f')]=_[_0xac27('0x42')](db[_0xac27('0x62')]['rawAttributes']);_0x34e112[_0xac27('0x30')]=_[_0xac27('0x42')](_0x1477a8[_0xac27('0x30')]);_0x34e112[_0xac27('0x31')]=_[_0xac27('0x32')](_0x34e112[_0xac27('0x2f')],_0x34e112[_0xac27('0x30')]);_0x3c9ef4['attributes']=_[_0xac27('0x32')](_0x34e112[_0xac27('0x2f')],qs['fields'](_0x1477a8[_0xac27('0x30')]['fields']));_0x3c9ef4['attributes']=_0x3c9ef4[_0xac27('0x33')]['length']?_0x3c9ef4[_0xac27('0x33')]:_0x34e112['model'];_0x3c9ef4[_0xac27('0x55')]=qs['sort'](_0x1477a8['query'][_0xac27('0x39')]);_0x3c9ef4[_0xac27('0x3a')]=qs[_0xac27('0x31')](_['pick'](_0x1477a8[_0xac27('0x30')],_0x34e112['filters']));if(_0x1477a8[_0xac27('0x30')][_0xac27('0x3c')]){_0x3c9ef4[_0xac27('0x3a')]=_[_0xac27('0x3d')](_0x3c9ef4[_0xac27('0x3a')],{'$or':_['map'](_0x3c9ef4[_0xac27('0x33')],function(_0x145655){var _0x5265f2={};_0x5265f2[_0x145655]={'$like':'%'+_0x1477a8[_0xac27('0x30')][_0xac27('0x3c')]+'%'};return _0x5265f2;})});}_0x3c9ef4=_[_0xac27('0x3d')]({},_0x3c9ef4,_0x1477a8[_0xac27('0x45')]);return _0x22fd9d[_0xac27('0x63')](_0x3c9ef4);}})[_0xac27('0x22')](function(_0x5f0c30){if(_0x5f0c30){_0x33ee12=_0x5f0c30[_0xac27('0x35')];if(!_0x1477a8['query']['hasOwnProperty'](_0xac27('0x37'))){_0x3c9ef4[_0xac27('0x38')]=qs['limit'](_0x1477a8[_0xac27('0x30')]['limit']);_0x3c9ef4[_0xac27('0x1a')]=qs[_0xac27('0x1a')](_0x1477a8[_0xac27('0x30')]['offset']);}return _0x22fd9d[_0xac27('0x63')](_0x3c9ef4);}})['then'](function(_0x179dd6){if(_0x179dd6){return _0x179dd6?{'count':_0x33ee12,'rows':_0x179dd6}:null;}})['then'](respondWithResult(_0x222d94,null))[_0xac27('0x46')](handleError(_0x222d94,null));};exports['addTeams']=function(_0x586b4b,_0x3a3cbe,_0x6006ec){var _0x2bc384=_0x586b4b[_0xac27('0x48')][_0xac27('0x64')];return db['Team']['findAll']({'where':{'id':_0x2bc384},'attributes':['id'],'include':[{'model':db[_0xac27('0x65')],'as':_0xac27('0x66'),'attributes':['id',_0xac27('0x28'),_0xac27('0x67'),_0xac27('0x68'),_0xac27('0x69')],'raw':!![]}]})[_0xac27('0x22')](function(_0x4780e8){if(_0x4780e8){var _0x58aac6=_[_0xac27('0x6a')](_0x4780e8,function(_0x46e809){var _0x3e85d5=_0x46e809['get']({'plain':!![]});return _0x3e85d5['Agents'];});return db[_0xac27('0x2b')][_0xac27('0x50')]({'where':{'id':_0x586b4b[_0xac27('0x51')]['id']}})['then'](function(_0x8b8e79){return db[_0xac27('0x6b')][_0xac27('0x6c')](function(_0x148c99){return _0x8b8e79[_0xac27('0x6d')](_0x2bc384,{'transaction':_0x148c99})[_0xac27('0x22')](function(){return BPromise[_0xac27('0x6e')](_0x58aac6,function(_0x125ead){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x125ead['id'],'FaxQueueId':_0x586b4b[_0xac27('0x51')]['id']},'transaction':_0x148c99});});})['then'](function(){_0x58aac6[_0xac27('0x6f')](function(_0x4cf189){socket[_0xac27('0x70')](_0xac27('0x71'),{'UserId':_0x4cf189['id'],'FaxQueueId':_0x8b8e79['id']});});});});});}})[_0xac27('0x22')](respondWithStatusCode(_0x3a3cbe,null))[_0xac27('0x46')](handleError(_0x3a3cbe,null));};exports[_0xac27('0x72')]=function(_0x331d90,_0x37900d,_0x1efe5b){return db[_0xac27('0x62')][_0xac27('0x57')]({'where':{'id':_0x331d90[_0xac27('0x30')][_0xac27('0x64')]},'attributes':['id'],'include':[{'model':db[_0xac27('0x65')],'as':_0xac27('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37900d,null))[_0xac27('0x22')](function(_0x2c31d2){var _0x4e1b01=_[_0xac27('0x2a')](_0x2c31d2,'id');var _0x5f5399=[];var _0x438e8d=[];var _0x63f547=squel[_0xac27('0x73')]();_0x63f547[_0xac27('0x74')]('tq.TeamId')[_0xac27('0x75')](_0xac27('0x76'),'tq')[_0xac27('0x77')](_0xac27('0x78'),'ut',_0xac27('0x79'))[_0xac27('0x3a')]('FaxQueueId\x20=\x20?',_0x331d90['params']['id']);for(var _0x55d1ac=0x0;_0x55d1ac<_0x2c31d2[_0xac27('0x35')];_0x55d1ac+=0x1){let _0x2f0d1a=_0x2c31d2[_0x55d1ac];for(var _0x22297c=0x0;_0x22297c<_0x2f0d1a[_0xac27('0x66')][_0xac27('0x35')];_0x22297c+=0x1){let _0x131b5a=_0x2f0d1a[_0xac27('0x66')][_0x22297c];var _0xa12e27=_0x63f547['clone']();_0xa12e27[_0xac27('0x3a')](_0xac27('0x7a'),_0x131b5a['id']);_0x438e8d[_0xac27('0x7b')](db[_0xac27('0x6b')][_0xac27('0x30')](_0xa12e27[_0xac27('0x7c')](),{'type':db[_0xac27('0x6b')]['QueryTypes'][_0xac27('0x7d')]})[_0xac27('0x22')](function(_0x22dd52){if(_0x22dd52[_0xac27('0x35')]===0x1){return _0x131b5a['id'];}else{var _0x263a7d=_[_0xac27('0x7e')](_['map'](_0x22dd52,_0xac27('0x7f')),function(_0x647d3c){return _[_0xac27('0x80')](_0x4e1b01,_0x647d3c);});if(_0x263a7d){return _0x131b5a['id'];}}}));}}return BPromise[_0xac27('0x81')](_0x438e8d)[_0xac27('0x22')](function(_0x16d219){_0x5f5399=_(_0x5f5399)['union'](_0x16d219)[_0xac27('0x82')]()[_0xac27('0x83')]();return db[_0xac27('0x2b')][_0xac27('0x50')]({'where':{'id':_0x331d90[_0xac27('0x51')]['id']}})[_0xac27('0x22')](function(_0x57f35d){return db[_0xac27('0x6b')][_0xac27('0x6c')](function(_0x579284){return _0x57f35d[_0xac27('0x72')](_0x331d90[_0xac27('0x30')][_0xac27('0x64')],{'transaction':_0x579284})[_0xac27('0x22')](function(){if(!_[_0xac27('0x84')](_0x5f5399)){return _0x57f35d[_0xac27('0x85')](_0x5f5399,{'transaction':_0x579284});}})['then'](function(){_0x5f5399['forEach'](function(_0x3f22e0){socket[_0xac27('0x70')](_0xac27('0x86'),{'UserId':_0x3f22e0,'FaxQueueId':_0x57f35d['id']});});});});});});})['then'](respondWithStatusCode(_0x37900d,null))[_0xac27('0x46')](handleError(_0x37900d,null));};exports['addAgents']=function(_0x4c0bd2,_0x1d4305,_0x22c2c7){return db['FaxQueue']['find']({'where':{'id':_0x4c0bd2[_0xac27('0x51')]['id']}})[_0xac27('0x22')](handleEntityNotFound(_0x1d4305,null))[_0xac27('0x22')](function(_0x1ffca5){if(_0x1ffca5){return _0x1ffca5['addAgents'](_0x4c0bd2['body'][_0xac27('0x64')],_[_0xac27('0x87')](_0x4c0bd2[_0xac27('0x48')],[_0xac27('0x64'),'id'])||{})[_0xac27('0x88')](function(_0x1c5433){for(var _0x5505a4=0x0;_0x5505a4<_0x4c0bd2[_0xac27('0x48')][_0xac27('0x64')][_0xac27('0x35')];_0x5505a4+=0x1){socket[_0xac27('0x70')](_0xac27('0x71'),{'UserId':Number(_0x4c0bd2[_0xac27('0x48')][_0xac27('0x64')][_0x5505a4]),'FaxQueueId':Number(_0x4c0bd2[_0xac27('0x51')]['id'])});}return _0x1c5433;});}})['then'](respondWithResult(_0x1d4305,null))['catch'](handleError(_0x1d4305,null));};exports[_0xac27('0x85')]=function(_0x1d48f8,_0x5b4f3a,_0x3a3740){return db[_0xac27('0x2b')]['find']({'where':{'id':_0x1d48f8['params']['id']}})[_0xac27('0x22')](handleEntityNotFound(_0x5b4f3a,null))[_0xac27('0x22')](function(_0x4fbb52){if(_0x4fbb52){return _0x4fbb52[_0xac27('0x85')](_0x1d48f8['query'][_0xac27('0x64')])[_0xac27('0x22')](function(){if(_[_0xac27('0x89')](_0x1d48f8[_0xac27('0x30')][_0xac27('0x64')])){for(var _0x5e8d3b=0x0;_0x5e8d3b<_0x1d48f8[_0xac27('0x30')]['ids']['length'];_0x5e8d3b+=0x1){socket[_0xac27('0x70')](_0xac27('0x86'),{'UserId':Number(_0x1d48f8[_0xac27('0x30')][_0xac27('0x64')][_0x5e8d3b]),'FaxQueueId':Number(_0x1d48f8[_0xac27('0x51')]['id'])});}}else{socket[_0xac27('0x70')](_0xac27('0x86'),{'UserId':Number(_0x1d48f8['query'][_0xac27('0x64')]),'FaxQueueId':Number(_0x1d48f8[_0xac27('0x51')]['id'])});}});}})[_0xac27('0x22')](respondWithStatusCode(_0x5b4f3a,null))[_0xac27('0x46')](handleError(_0x5b4f3a,null));};exports[_0xac27('0x8a')]=function(_0x77e1b9,_0xae77da,_0x3b5cf0){var _0x52b390={};var _0x4c02aa={};var _0x2320cb;var _0x4adcf8;return db[_0xac27('0x2b')]['findOne']({'where':{'id':_0x77e1b9[_0xac27('0x51')]['id']}})[_0xac27('0x22')](handleEntityNotFound(_0xae77da,null))['then'](function(_0xdb6f7b){if(_0xdb6f7b){_0x2320cb=_0xdb6f7b;_0x4c02aa[_0xac27('0x2f')]=_[_0xac27('0x42')](db['User'][_0xac27('0x2c')]);_0x4c02aa[_0xac27('0x30')]=_['keys'](_0x77e1b9[_0xac27('0x30')]);_0x4c02aa[_0xac27('0x31')]=_[_0xac27('0x32')](_0x4c02aa[_0xac27('0x2f')],_0x4c02aa[_0xac27('0x30')]);_0x52b390[_0xac27('0x33')]=_['intersection'](_0x4c02aa[_0xac27('0x2f')],qs[_0xac27('0x34')](_0x77e1b9[_0xac27('0x30')][_0xac27('0x34')]));_0x52b390[_0xac27('0x33')]=_0x52b390[_0xac27('0x33')]['length']?_0x52b390[_0xac27('0x33')]:_0x4c02aa[_0xac27('0x2f')];_0x52b390[_0xac27('0x55')]=qs[_0xac27('0x39')](_0x77e1b9[_0xac27('0x30')][_0xac27('0x39')]);_0x52b390[_0xac27('0x3a')]=qs[_0xac27('0x31')](_[_0xac27('0x3b')](_0x77e1b9[_0xac27('0x30')],_0x4c02aa[_0xac27('0x31')]));if(_0x77e1b9[_0xac27('0x30')][_0xac27('0x3c')]){_0x52b390[_0xac27('0x3a')]=_['merge'](_0x52b390[_0xac27('0x3a')],{'$or':_[_0xac27('0x2a')](_0x52b390[_0xac27('0x33')],function(_0x561c4a){var _0x3b5a87={};_0x3b5a87[_0x561c4a]={'$like':'%'+_0x77e1b9['query']['filter']+'%'};return _0x3b5a87;})});}_0x52b390=_[_0xac27('0x3d')]({},_0x52b390,_0x77e1b9[_0xac27('0x45')]);return _0x2320cb[_0xac27('0x8a')](_0x52b390);}})[_0xac27('0x22')](function(_0x599e2d){if(_0x599e2d){_0x4adcf8=_0x599e2d[_0xac27('0x35')];if(!_0x77e1b9[_0xac27('0x30')][_0xac27('0x36')](_0xac27('0x37'))){_0x52b390[_0xac27('0x38')]=qs['limit'](_0x77e1b9[_0xac27('0x30')][_0xac27('0x38')]);_0x52b390[_0xac27('0x1a')]=qs[_0xac27('0x1a')](_0x77e1b9[_0xac27('0x30')]['offset']);}return _0x2320cb[_0xac27('0x8a')](_0x52b390);}})[_0xac27('0x22')](function(_0x433127){if(_0x433127){return _0x433127?{'count':_0x4adcf8,'rows':_0x433127}:null;}})[_0xac27('0x22')](respondWithResult(_0xae77da,null))[_0xac27('0x46')](handleError(_0xae77da,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5cabdee..a5d1e2b 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 _0x8392=['hook','exports','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x112011,_0x4ec684){var _0x1dc653=function(_0x2e2199){while(--_0x2e2199){_0x112011['push'](_0x112011['shift']());}};_0x1dc653(++_0x4ec684);}(_0x8392,0x160));var _0x2839=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8392[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2839('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2839('0x1'),'afterDestroy':_0x2839('0x2')};function emitEvent(_0x218b0a){return function(_0x46b724,_0x4abea0,_0x2e6381){FaxQueueEvents['emit'](_0x218b0a+':'+_0x46b724['id'],_0x46b724);FaxQueueEvents[_0x2839('0x3')](_0x218b0a,_0x46b724);_0x2e6381(null);};}for(var e in events){if(events[_0x2839('0x4')](e)){var event=events[e];FaxQueue[_0x2839('0x5')](e,emitEvent(event));}}module[_0x2839('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xd6db=['hook','events','FaxQueue','remove','emit','hasOwnProperty'];(function(_0x34de70,_0x167fad){var _0x1c0110=function(_0x4a2251){while(--_0x4a2251){_0x34de70['push'](_0x34de70['shift']());}};_0x1c0110(++_0x167fad);}(_0xd6db,0x199));var _0xbd6d=function(_0x3b5b27,_0x18b834){_0x3b5b27=_0x3b5b27-0x0;var _0x54da03=_0xd6db[_0x3b5b27];return _0x54da03;};'use strict';var EventEmitter=require(_0xbd6d('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xbd6d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd6d('0x2')};function emitEvent(_0x74dc36){return function(_0x5ae685,_0x6a6ce,_0x47c002){FaxQueueEvents[_0xbd6d('0x3')](_0x74dc36+':'+_0x5ae685['id'],_0x5ae685);FaxQueueEvents['emit'](_0x74dc36,_0x5ae685);_0x47c002(null);};}for(var e in events){if(events[_0xbd6d('0x4')](e)){var event=events[e];FaxQueue[_0xbd6d('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index eb88d9e..14df86c 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 _0x1dd1=['moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api'];(function(_0x42ea95,_0x5aab6b){var _0x25c59b=function(_0x206c86){while(--_0x206c86){_0x42ea95['push'](_0x42ea95['shift']());}};_0x25c59b(++_0x5aab6b);}(_0x1dd1,0x11a));var _0x11dd=function(_0x11b2ca,_0x5257ab){_0x11b2ca=_0x11b2ca-0x0;var _0x4fbdb9=_0x1dd1[_0x11b2ca];return _0x4fbdb9;};'use strict';var _=require(_0x11dd('0x0'));var util=require(_0x11dd('0x1'));var logger=require(_0x11dd('0x2'))(_0x11dd('0x3'));var moment=require(_0x11dd('0x4'));var BPromise=require(_0x11dd('0x5'));var rp=require(_0x11dd('0x6'));var fs=require('fs');var path=require(_0x11dd('0x7'));var rimraf=require(_0x11dd('0x8'));var config=require('../../config/environment');var attributes=require(_0x11dd('0x9'));module[_0x11dd('0xa')]=function(_0x112ad8,_0x54841b){return _0x112ad8[_0x11dd('0xb')](_0x11dd('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0xaf5b,0x75));var _0xbaf5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaf5b[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xbaf5('0x0'));var util=require('util');var logger=require(_0xbaf5('0x1'))(_0xbaf5('0x2'));var moment=require(_0xbaf5('0x3'));var BPromise=require(_0xbaf5('0x4'));var rp=require(_0xbaf5('0x5'));var fs=require('fs');var path=require(_0xbaf5('0x6'));var rimraf=require(_0xbaf5('0x7'));var config=require(_0xbaf5('0x8'));var attributes=require(_0xbaf5('0x9'));module[_0xbaf5('0xa')]=function(_0x1b487b,_0x37fe44){return _0x1b487b[_0xbaf5('0xb')]('FaxQueue',attributes,{'tableName':_0xbaf5('0xc'),'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 6f944a9..16b5e14 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 _0x06c9=['options','where','attributes','limit','include','map','model','info','debug','stringify','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFaxQueue','FaxQueue'];(function(_0x43bc4c,_0x29021f){var _0x8bd98f=function(_0x43490b){while(--_0x43490b){_0x43bc4c['push'](_0x43bc4c['shift']());}};_0x8bd98f(++_0x29021f);}(_0x06c9,0x158));var _0x906c=function(_0x1e4195,_0x1fea58){_0x1e4195=_0x1e4195-0x0;var _0x5b7479=_0x06c9[_0x1e4195];return _0x5b7479;};'use strict';var _=require(_0x906c('0x0'));var util=require('util');var moment=require(_0x906c('0x1'));var BPromise=require(_0x906c('0x2'));var rs=require(_0x906c('0x3'));var fs=require('fs');var Redis=require(_0x906c('0x4'));var db=require(_0x906c('0x5'))['db'];var utils=require(_0x906c('0x6'));var logger=require('../../config/logger')(_0x906c('0x7'));var config=require(_0x906c('0x8'));var jayson=require(_0x906c('0x9'));var client=jayson[_0x906c('0xa')]['http']({'port':0x232a});config[_0x906c('0xb')]=_['defaults'](config[_0x906c('0xb')],{'host':_0x906c('0xc'),'port':0x18eb});var socket=require(_0x906c('0xd'))(new Redis(config[_0x906c('0xb')]));require('./faxQueue.socket')[_0x906c('0xe')](socket);function respondWithRpcPromise(_0x3fefa9,_0x485ca9,_0x1cbd30){return new BPromise(function(_0x122aa8,_0x2bdcf6){return client['request'](_0x3fefa9,_0x1cbd30)[_0x906c('0xf')](function(_0x35f65d){logger['info'](_0x906c('0x10'),_0x485ca9,'request\x20sent');logger['debug'](_0x906c('0x11'),_0x485ca9,_0x906c('0x12'),JSON['stringify'](_0x35f65d));if(_0x35f65d[_0x906c('0x13')]){if(_0x35f65d['error'][_0x906c('0x14')]===0x1f4){logger[_0x906c('0x13')]('FaxQueue,\x20%s,\x20%s',_0x485ca9,_0x35f65d['error'][_0x906c('0x15')]);return _0x2bdcf6(_0x35f65d[_0x906c('0x13')]['message']);}logger[_0x906c('0x13')](_0x906c('0x10'),_0x485ca9,_0x35f65d['error'][_0x906c('0x15')]);return _0x122aa8(_0x35f65d[_0x906c('0x13')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x485ca9,'request\x20sent');_0x122aa8(_0x35f65d[_0x906c('0x16')]['message']);}})[_0x906c('0x17')](function(_0x3b3c96){logger[_0x906c('0x13')](_0x906c('0x10'),_0x485ca9,_0x3b3c96);_0x2bdcf6(_0x3b3c96);});});}exports[_0x906c('0x18')]=function(_0x1e7097){var _0x18faa6=this;return new Promise(function(_0x118065,_0x34bfb5){return db[_0x906c('0x19')]['findAll']({'raw':_0x1e7097[_0x906c('0x1a')]?_0x1e7097[_0x906c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e7097[_0x906c('0x1a')]?_0x1e7097['options'][_0x906c('0x1b')]||null:null,'attributes':_0x1e7097['options']?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1c')]||null:null,'limit':_0x1e7097[_0x906c('0x1a')]?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1d')]||null:null,'include':_0x1e7097['options']?_0x1e7097[_0x906c('0x1a')][_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x1e7097[_0x906c('0x1a')]['include'],function(_0x27efb0){return{'model':db[_0x27efb0[_0x906c('0x20')]],'as':_0x27efb0['as'],'attributes':_0x27efb0[_0x906c('0x1c')],'include':_0x27efb0[_0x906c('0x1e')]?_['map'](_0x27efb0['include'],function(_0x38e4b8){return{'model':db[_0x38e4b8[_0x906c('0x20')]],'as':_0x38e4b8['as'],'attributes':_0x38e4b8[_0x906c('0x1c')],'include':_0x38e4b8[_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x38e4b8['include'],function(_0x27f616){return{'model':db[_0x27f616[_0x906c('0x20')]],'as':_0x27f616['as'],'attributes':_0x27f616['attributes']};}):[]};}):[]};}):[]:[]})[_0x906c('0xf')](function(_0x4a3708){logger[_0x906c('0x21')](_0x906c('0x18'),_0x1e7097);logger[_0x906c('0x22')](_0x906c('0x18'),_0x1e7097,JSON[_0x906c('0x23')](_0x4a3708));_0x118065(_0x4a3708);})[_0x906c('0x17')](function(_0x70181a){logger[_0x906c('0x13')]('GetFaxQueue',_0x70181a[_0x906c('0x15')],_0x1e7097);_0x34bfb5(_0x18faa6['error'](0x1f4,_0x70181a['message']));});});};exports[_0x906c('0x24')]=function(_0x183d4e){var _0x15ad89=this;return new Promise(function(_0x467669,_0x1e3558){return db[_0x906c('0x19')]['find']({'raw':_0x183d4e[_0x906c('0x1a')]?_0x183d4e[_0x906c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x183d4e[_0x906c('0x1a')]?_0x183d4e[_0x906c('0x1a')][_0x906c('0x1b')]||null:null,'attributes':_0x183d4e['options']?_0x183d4e['options'][_0x906c('0x1c')]||null:null,'include':_0x183d4e['options']?_0x183d4e[_0x906c('0x1a')][_0x906c('0x1e')]?_[_0x906c('0x1f')](_0x183d4e[_0x906c('0x1a')]['include'],function(_0x4e4e63){return{'model':db[_0x4e4e63[_0x906c('0x20')]],'as':_0x4e4e63['as'],'attributes':_0x4e4e63[_0x906c('0x1c')],'include':_0x4e4e63[_0x906c('0x1e')]?_['map'](_0x4e4e63[_0x906c('0x1e')],function(_0x2dd667){return{'model':db[_0x2dd667[_0x906c('0x20')]],'as':_0x2dd667['as'],'attributes':_0x2dd667['attributes'],'include':_0x2dd667['include']?_[_0x906c('0x1f')](_0x2dd667['include'],function(_0x338655){return{'model':db[_0x338655[_0x906c('0x20')]],'as':_0x338655['as'],'attributes':_0x338655['attributes']};}):[]};}):[]};}):[]:[]})[_0x906c('0xf')](function(_0xf86796){logger[_0x906c('0x21')](_0x906c('0x24'),_0x183d4e);logger['debug'](_0x906c('0x24'),_0x183d4e,JSON[_0x906c('0x23')](_0xf86796));_0x467669(_0xf86796);})['catch'](function(_0x4a1a14){logger['error']('ShowFaxQueue',_0x4a1a14[_0x906c('0x15')],_0x183d4e);_0x1e3558(_0x15ad89[_0x906c('0x13')](0x1f4,_0x4a1a14['message']));});});}; \ No newline at end of file +var _0xca00=['GetFaxQueue','ShowFaxQueue','FaxQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','where','attributes','limit','include','map','model'];(function(_0x55c71f,_0x42e6e4){var _0x2377e2=function(_0x6eb832){while(--_0x6eb832){_0x55c71f['push'](_0x55c71f['shift']());}};_0x2377e2(++_0x42e6e4);}(_0xca00,0x116));var _0x0ca0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca00[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0ca0('0x0'));var util=require(_0x0ca0('0x1'));var moment=require(_0x0ca0('0x2'));var BPromise=require(_0x0ca0('0x3'));var rs=require(_0x0ca0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ca0('0x5'))['db'];var utils=require(_0x0ca0('0x6'));var logger=require(_0x0ca0('0x7'))(_0x0ca0('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ca0('0x9'));var client=jayson['client'][_0x0ca0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0ca0('0xb')],{'host':_0x0ca0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ca0('0xb')]));require(_0x0ca0('0xd'))[_0x0ca0('0xe')](socket);function respondWithRpcPromise(_0x21d50e,_0x39d54c,_0x33986a){return new BPromise(function(_0x1b990a,_0x580ad2){return client['request'](_0x21d50e,_0x33986a)[_0x0ca0('0xf')](function(_0x9e0a82){logger[_0x0ca0('0x10')](_0x0ca0('0x11'),_0x39d54c,_0x0ca0('0x12'));logger[_0x0ca0('0x13')](_0x0ca0('0x14'),_0x39d54c,_0x0ca0('0x12'),JSON[_0x0ca0('0x15')](_0x9e0a82));if(_0x9e0a82[_0x0ca0('0x16')]){if(_0x9e0a82[_0x0ca0('0x16')][_0x0ca0('0x17')]===0x1f4){logger[_0x0ca0('0x16')](_0x0ca0('0x11'),_0x39d54c,_0x9e0a82[_0x0ca0('0x16')][_0x0ca0('0x18')]);return _0x580ad2(_0x9e0a82[_0x0ca0('0x16')]['message']);}logger[_0x0ca0('0x16')](_0x0ca0('0x11'),_0x39d54c,_0x9e0a82['error'][_0x0ca0('0x18')]);return _0x1b990a(_0x9e0a82[_0x0ca0('0x16')][_0x0ca0('0x18')]);}else{logger['info'](_0x0ca0('0x11'),_0x39d54c,_0x0ca0('0x12'));_0x1b990a(_0x9e0a82[_0x0ca0('0x19')][_0x0ca0('0x18')]);}})['catch'](function(_0x37cde9){logger['error'](_0x0ca0('0x11'),_0x39d54c,_0x37cde9);_0x580ad2(_0x37cde9);});});}exports['GetFaxQueue']=function(_0xb3cc17){var _0x3c072a=this;return new Promise(function(_0x1d1fad,_0x23c60b){return db['FaxQueue'][_0x0ca0('0x1a')]({'raw':_0xb3cc17[_0x0ca0('0x1b')]?_0xb3cc17[_0x0ca0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xb3cc17[_0x0ca0('0x1b')]?_0xb3cc17[_0x0ca0('0x1b')][_0x0ca0('0x1c')]||null:null,'attributes':_0xb3cc17[_0x0ca0('0x1b')]?_0xb3cc17[_0x0ca0('0x1b')][_0x0ca0('0x1d')]||null:null,'limit':_0xb3cc17[_0x0ca0('0x1b')]?_0xb3cc17[_0x0ca0('0x1b')][_0x0ca0('0x1e')]||null:null,'include':_0xb3cc17[_0x0ca0('0x1b')]?_0xb3cc17[_0x0ca0('0x1b')][_0x0ca0('0x1f')]?_[_0x0ca0('0x20')](_0xb3cc17[_0x0ca0('0x1b')][_0x0ca0('0x1f')],function(_0x4ce456){return{'model':db[_0x4ce456[_0x0ca0('0x21')]],'as':_0x4ce456['as'],'attributes':_0x4ce456[_0x0ca0('0x1d')],'include':_0x4ce456[_0x0ca0('0x1f')]?_[_0x0ca0('0x20')](_0x4ce456[_0x0ca0('0x1f')],function(_0x44899a){return{'model':db[_0x44899a[_0x0ca0('0x21')]],'as':_0x44899a['as'],'attributes':_0x44899a['attributes'],'include':_0x44899a[_0x0ca0('0x1f')]?_[_0x0ca0('0x20')](_0x44899a[_0x0ca0('0x1f')],function(_0x749bc7){return{'model':db[_0x749bc7['model']],'as':_0x749bc7['as'],'attributes':_0x749bc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ca0('0xf')](function(_0x48b6d8){logger['info'](_0x0ca0('0x22'),_0xb3cc17);logger[_0x0ca0('0x13')](_0x0ca0('0x22'),_0xb3cc17,JSON[_0x0ca0('0x15')](_0x48b6d8));_0x1d1fad(_0x48b6d8);})['catch'](function(_0x4e70ca){logger[_0x0ca0('0x16')](_0x0ca0('0x22'),_0x4e70ca[_0x0ca0('0x18')],_0xb3cc17);_0x23c60b(_0x3c072a[_0x0ca0('0x16')](0x1f4,_0x4e70ca[_0x0ca0('0x18')]));});});};exports[_0x0ca0('0x23')]=function(_0x3082ef){var _0x2821a4=this;return new Promise(function(_0x4453af,_0x5c3e27){return db[_0x0ca0('0x24')][_0x0ca0('0x25')]({'raw':_0x3082ef[_0x0ca0('0x1b')]?_0x3082ef[_0x0ca0('0x1b')][_0x0ca0('0x26')]===undefined?!![]:![]:!![],'where':_0x3082ef[_0x0ca0('0x1b')]?_0x3082ef[_0x0ca0('0x1b')][_0x0ca0('0x1c')]||null:null,'attributes':_0x3082ef['options']?_0x3082ef['options']['attributes']||null:null,'include':_0x3082ef[_0x0ca0('0x1b')]?_0x3082ef[_0x0ca0('0x1b')][_0x0ca0('0x1f')]?_[_0x0ca0('0x20')](_0x3082ef['options']['include'],function(_0x11ad11){return{'model':db[_0x11ad11[_0x0ca0('0x21')]],'as':_0x11ad11['as'],'attributes':_0x11ad11[_0x0ca0('0x1d')],'include':_0x11ad11[_0x0ca0('0x1f')]?_[_0x0ca0('0x20')](_0x11ad11[_0x0ca0('0x1f')],function(_0x35987a){return{'model':db[_0x35987a[_0x0ca0('0x21')]],'as':_0x35987a['as'],'attributes':_0x35987a['attributes'],'include':_0x35987a['include']?_['map'](_0x35987a['include'],function(_0x4dca2d){return{'model':db[_0x4dca2d['model']],'as':_0x4dca2d['as'],'attributes':_0x4dca2d[_0x0ca0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0ca0('0xf')](function(_0x485cc5){logger[_0x0ca0('0x10')]('ShowFaxQueue',_0x3082ef);logger[_0x0ca0('0x13')]('ShowFaxQueue',_0x3082ef,JSON[_0x0ca0('0x15')](_0x485cc5));_0x4453af(_0x485cc5);})['catch'](function(_0x4e1d99){logger[_0x0ca0('0x16')](_0x0ca0('0x23'),_0x4e1d99[_0x0ca0('0x18')],_0x3082ef);_0x5c3e27(_0x2821a4[_0x0ca0('0x16')](0x1f4,_0x4e1d99[_0x0ca0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b36347e..e5f7087 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 _0xeaaa=['length','./faxQueue.events','save','remove','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xeaaa,0x13c));var _0xaeaa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeaaa[_0x397e5f];return _0x5302b8;};'use strict';var FaxQueueEvents=require(_0xaeaa('0x0'));var events=[_0xaeaa('0x1'),_0xaeaa('0x2'),_0xaeaa('0x3')];function createListener(_0x48542b,_0x47abd3){return function(_0xbed3d3){_0x47abd3['emit'](_0x48542b,_0xbed3d3);};}function removeListener(_0x51ae5d,_0x1c216e){return function(){FaxQueueEvents['removeListener'](_0x51ae5d,_0x1c216e);};}exports['register']=function(_0x18318d){for(var _0x1d1d6c=0x0,_0x313cc5=events[_0xaeaa('0x4')];_0x1d1d6c<_0x313cc5;_0x1d1d6c++){var _0x5c7bf2=events[_0x1d1d6c];var _0x85608d=createListener('faxQueue:'+_0x5c7bf2,_0x18318d);FaxQueueEvents['on'](_0x5c7bf2,_0x85608d);}}; \ No newline at end of file +var _0xb555=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x3af384,_0x2b2160){var _0x194aad=function(_0x39c9e4){while(--_0x39c9e4){_0x3af384['push'](_0x3af384['shift']());}};_0x194aad(++_0x2b2160);}(_0xb555,0xe5));var _0x5b55=function(_0x5538ad,_0x41efd4){_0x5538ad=_0x5538ad-0x0;var _0x49f0b4=_0xb555[_0x5538ad];return _0x49f0b4;};'use strict';var FaxQueueEvents=require(_0x5b55('0x0'));var events=[_0x5b55('0x1'),_0x5b55('0x2'),_0x5b55('0x3')];function createListener(_0x53968a,_0x325126){return function(_0x30483e){_0x325126[_0x5b55('0x4')](_0x53968a,_0x30483e);};}function removeListener(_0x45dd8c,_0x32bac6){return function(){FaxQueueEvents[_0x5b55('0x5')](_0x45dd8c,_0x32bac6);};}exports[_0x5b55('0x6')]=function(_0x4f5e7e){for(var _0xd91c38=0x0,_0x3d92df=events[_0x5b55('0x7')];_0xd91c38<_0x3d92df;_0xd91c38++){var _0x17ff7d=events[_0xd91c38];var _0xaa16cb=createListener(_0x5b55('0x8')+_0x17ff7d,_0x4f5e7e);FaxQueueEvents['on'](_0x17ff7d,_0xaa16cb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f08c0d1..4807b89 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 _0x4c60=['destroy','multer','util','path','connect-timeout','Router','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete'];(function(_0x2dbe87,_0x2084bc){var _0x294b99=function(_0x519831){while(--_0x519831){_0x2dbe87['push'](_0x2dbe87['shift']());}};_0x294b99(++_0x2084bc);}(_0x4c60,0xc1));var _0x04c6=function(_0x5e7781,_0x1451eb){_0x5e7781=_0x5e7781-0x0;var _0x231dea=_0x4c60[_0x5e7781];return _0x231dea;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('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(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['getTeams']);router[_0x04c6('0x6')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xf')]);router['post']('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);router[_0x04c6('0x11')]('/:id/teams',auth[_0x04c6('0x7')](),controller[_0x04c6('0x12')]);router[_0x04c6('0x11')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x13')]);router[_0x04c6('0x14')](_0x04c6('0xa'),auth['isAuthenticated'](),controller[_0x04c6('0x15')]);router[_0x04c6('0x16')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0x17')]);router[_0x04c6('0x16')](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['removeTeams']);router[_0x04c6('0x16')](_0x04c6('0xe'),auth[_0x04c6('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5f6f=['get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller'];(function(_0x395a1f,_0x540158){var _0x4e981a=function(_0x3bc009){while(--_0x3bc009){_0x395a1f['push'](_0x395a1f['shift']());}};_0x4e981a(++_0x540158);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x1e765a,_0x4a7c55){_0x1e765a=_0x1e765a-0x0;var _0x5bc8a1=_0x5f6f[_0x1e765a];return _0x5bc8a1;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require(_0xf5f6('0x2'));var timeout=require(_0xf5f6('0x3'));var express=require(_0xf5f6('0x4'));var router=express['Router']();var fs_extra=require(_0xf5f6('0x5'));var auth=require(_0xf5f6('0x6'));var interaction=require(_0xf5f6('0x7'));var config=require('../../config/environment');var controller=require(_0xf5f6('0x8'));router[_0xf5f6('0x9')]('/',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xb')]);router['get']('/describe',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xc')]);router[_0xf5f6('0x9')](_0xf5f6('0xd'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xe')]);router['get']('/:id/members',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0xf')]);router['get'](_0xf5f6('0x10'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x11')]);router[_0xf5f6('0x9')](_0xf5f6('0x12'),auth['isAuthenticated'](),controller[_0xf5f6('0x13')]);router['post']('/',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x14')]);router[_0xf5f6('0x15')](_0xf5f6('0x10'),auth['isAuthenticated'](),controller[_0xf5f6('0x16')]);router[_0xf5f6('0x15')](_0xf5f6('0x12'),auth[_0xf5f6('0xa')](),controller['addAgents']);router[_0xf5f6('0x17')](_0xf5f6('0xd'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x18')]);router['delete']('/:id',auth[_0xf5f6('0xa')](),controller['destroy']);router[_0xf5f6('0x19')]('/:id/teams',auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x1a')]);router[_0xf5f6('0x19')](_0xf5f6('0x12'),auth[_0xf5f6('0xa')](),controller[_0xf5f6('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7346968..96e53a3 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 _0x734b=['DATE','moment','exports','STRING'];(function(_0x17d114,_0x5a9988){var _0x95997b=function(_0x5e01e8){while(--_0x5e01e8){_0x17d114['push'](_0x17d114['shift']());}};_0x95997b(++_0x5a9988);}(_0x734b,0x15d));var _0xb734=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x734b[_0x51020b];return _0x371e47;};'use strict';var moment=require(_0xb734('0x0'));var Sequelize=require('sequelize');module[_0xb734('0x1')]={'uniqueid':{'type':Sequelize[_0xb734('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb734('0x2')]},'joinAt':{'type':Sequelize[_0xb734('0x3')]},'leaveAt':{'type':Sequelize[_0xb734('0x3')]},'acceptAt':{'type':Sequelize[_0xb734('0x3')]},'exitAt':{'type':Sequelize[_0xb734('0x3')]},'reason':{'type':Sequelize[_0xb734('0x2')]}}; \ No newline at end of file +var _0x7953=['STRING','DATE','moment','sequelize','exports'];(function(_0xaf9d09,_0xdf106b){var _0x10428e=function(_0x63199f){while(--_0x63199f){_0xaf9d09['push'](_0xaf9d09['shift']());}};_0x10428e(++_0xdf106b);}(_0x7953,0x1c4));var _0x3795=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x7953[_0x2d460c];return _0xf6fc4c;};'use strict';var moment=require(_0x3795('0x0'));var Sequelize=require(_0x3795('0x1'));module[_0x3795('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3795('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3795('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3795('0x4')]},'reason':{'type':Sequelize[_0x3795('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5b70fe0..bc15e00 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 _0x53d5=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','FaxQueueReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x2e3210,_0x555b54){var _0x399fad=function(_0x104a6d){while(--_0x104a6d){_0x2e3210['push'](_0x2e3210['shift']());}};_0x399fad(++_0x555b54);}(_0x53d5,0x1cc));var _0x553d=function(_0xf1e6f9,_0x527826){_0xf1e6f9=_0xf1e6f9-0x0;var _0x30556c=_0x53d5[_0xf1e6f9];return _0x30556c;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){_0x82dd3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caed9,_0x491dc2){return function(_0x576c56){if(!_0x576c56){_0x2caed9[_0x553d('0x1b')](0x194);}return _0x576c56;};}function handleError(_0x517a1c,_0x677832){_0x677832=_0x677832||0x1f4;return function(_0x2c0484){logger[_0x553d('0x2a')](_0x2c0484['stack']);if(_0x2c0484[_0x553d('0x2b')]){delete _0x2c0484[_0x553d('0x2b')];}_0x517a1c[_0x553d('0x1c')](_0x677832)['send'](_0x2c0484);};}exports[_0x553d('0x2c')]=function(_0x39943d,_0x2bf05d){var _0x50fbc3={},_0x37ddd7={},_0x180a66={'count':0x0,'rows':[]};var _0xc3d157=_['map'](db[_0x553d('0x2d')]['rawAttributes'],function(_0x174fea){return{'name':_0x174fea[_0x553d('0x2e')],'type':_0x174fea[_0x553d('0x2f')][_0x553d('0x30')]};});_0x37ddd7[_0x553d('0x31')]=_[_0x553d('0x32')](_0xc3d157,_0x553d('0x2b'));_0x37ddd7[_0x553d('0x33')]=_['keys'](_0x39943d[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],_0x37ddd7[_0x553d('0x33')]);_0x50fbc3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],qs['fields'](_0x39943d[_0x553d('0x33')][_0x553d('0x37')]));_0x50fbc3[_0x553d('0x36')]=_0x50fbc3['attributes'][_0x553d('0x38')]?_0x50fbc3[_0x553d('0x36')]:_0x37ddd7[_0x553d('0x31')];if(!_0x39943d[_0x553d('0x33')][_0x553d('0x39')](_0x553d('0x3a'))){_0x50fbc3[_0x553d('0x1f')]=qs[_0x553d('0x1f')](_0x39943d['query']['limit']);_0x50fbc3[_0x553d('0x21')]=qs[_0x553d('0x21')](_0x39943d['query'][_0x553d('0x21')]);}_0x50fbc3['order']=qs['sort'](_0x39943d[_0x553d('0x33')]['sort']);_0x50fbc3[_0x553d('0x3b')]=qs['filters'](_[_0x553d('0x3c')](_0x39943d[_0x553d('0x33')],_0x37ddd7['filters']),_0xc3d157);if(_0x39943d['query'][_0x553d('0x3d')]){_0x50fbc3[_0x553d('0x3b')]=_[_0x553d('0x3e')](_0x50fbc3[_0x553d('0x3b')],{'$or':_['map'](_0xc3d157,function(_0x19ed0e){if(_0x19ed0e[_0x553d('0x2f')]!=='VIRTUAL'){var _0xfac8ee={};_0xfac8ee[_0x19ed0e['name']]={'$like':'%'+_0x39943d[_0x553d('0x33')][_0x553d('0x3d')]+'%'};return _0xfac8ee;}})});}_0x50fbc3=_[_0x553d('0x3e')]({},_0x50fbc3,_0x39943d[_0x553d('0x3f')]);var _0x50776a={'where':_0x50fbc3['where']};return db[_0x553d('0x2d')][_0x553d('0x22')](_0x50776a)[_0x553d('0x28')](function(_0x32dfb8){_0x180a66[_0x553d('0x22')]=_0x32dfb8;if(_0x39943d[_0x553d('0x33')][_0x553d('0x40')]){_0x50fbc3[_0x553d('0x41')]=[{'all':!![]}];}return db[_0x553d('0x2d')][_0x553d('0x42')](_0x50fbc3);})['then'](function(_0x431fdb){_0x180a66[_0x553d('0x43')]=_0x431fdb;return _0x180a66;})['then'](respondWithFilteredResult(_0x2bf05d,_0x50fbc3))[_0x553d('0x44')](handleError(_0x2bf05d,null));};exports[_0x553d('0x45')]=function(_0x5cfbbc,_0x1caab8){var _0x60cdd3={'raw':!![],'where':{'id':_0x5cfbbc[_0x553d('0x46')]['id']}},_0x40bc7a={};_0x40bc7a[_0x553d('0x31')]=_[_0x553d('0x47')](db['FaxQueueReport'][_0x553d('0x48')]);_0x40bc7a[_0x553d('0x33')]=_[_0x553d('0x47')](_0x5cfbbc['query']);_0x40bc7a[_0x553d('0x34')]=_[_0x553d('0x35')](_0x40bc7a['model'],_0x40bc7a[_0x553d('0x33')]);_0x60cdd3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x40bc7a[_0x553d('0x31')],qs[_0x553d('0x37')](_0x5cfbbc[_0x553d('0x33')][_0x553d('0x37')]));_0x60cdd3[_0x553d('0x36')]=_0x60cdd3[_0x553d('0x36')]['length']?_0x60cdd3[_0x553d('0x36')]:_0x40bc7a['model'];if(_0x5cfbbc[_0x553d('0x33')]['includeAll']){_0x60cdd3[_0x553d('0x41')]=[{'all':!![]}];}_0x60cdd3=_[_0x553d('0x3e')]({},_0x60cdd3,_0x5cfbbc['options']);return db[_0x553d('0x2d')][_0x553d('0x49')](_0x60cdd3)[_0x553d('0x28')](handleEntityNotFound(_0x1caab8,null))[_0x553d('0x28')](respondWithResult(_0x1caab8,null))[_0x553d('0x44')](handleError(_0x1caab8,null));};exports['create']=function(_0x28a20b,_0x545dbf){return db[_0x553d('0x2d')][_0x553d('0x4a')](_0x28a20b[_0x553d('0x4b')],{})[_0x553d('0x28')](respondWithResult(_0x545dbf,0xc9))[_0x553d('0x44')](handleError(_0x545dbf,null));};exports[_0x553d('0x4c')]=function(_0xb6b182,_0x29259a){if(_0xb6b182[_0x553d('0x4b')]['id']){delete _0xb6b182[_0x553d('0x4b')]['id'];}return db[_0x553d('0x2d')][_0x553d('0x49')]({'where':{'id':_0xb6b182[_0x553d('0x46')]['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x29259a,null))[_0x553d('0x28')](saveUpdates(_0xb6b182[_0x553d('0x4b')],null))[_0x553d('0x28')](respondWithResult(_0x29259a,null))['catch'](handleError(_0x29259a,null));};exports[_0x553d('0x29')]=function(_0x1ed718,_0x2e1ff6){return db[_0x553d('0x2d')]['find']({'where':{'id':_0x1ed718['params']['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x2e1ff6,null))[_0x553d('0x28')](removeEntity(_0x2e1ff6,null))[_0x553d('0x44')](handleError(_0x2e1ff6,null));};exports[_0x553d('0x4d')]=function(_0x2f1746,_0x3576f0){return db[_0x553d('0x2d')][_0x553d('0x4d')]()[_0x553d('0x28')](respondWithResult(_0x3576f0,null))['catch'](handleError(_0x3576f0,null));}; \ No newline at end of file +var _0x98e5=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','name','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce'];(function(_0x5aa1d7,_0x51a1c5){var _0x5cac29=function(_0x295522){while(--_0x295522){_0x5aa1d7['push'](_0x5aa1d7['shift']());}};_0x5cac29(++_0x51a1c5);}(_0x98e5,0x8a));var _0x598e=function(_0x3e43c8,_0x516592){_0x3e43c8=_0x3e43c8-0x0;var _0x17b9b0=_0x98e5[_0x3e43c8];return _0x17b9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x598e('0x0'));var rp=require(_0x598e('0x1'));var moment=require('moment');var BPromise=require(_0x598e('0x2'));var Mustache=require(_0x598e('0x3'));var util=require('util');var path=require(_0x598e('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x598e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x598e('0x6'));var squel=require(_0x598e('0x7'));var crypto=require(_0x598e('0x8'));var jsforce=require(_0x598e('0x9'));var deskjs=require(_0x598e('0xa'));var toCsv=require(_0x598e('0xb'));var querystring=require(_0x598e('0xc'));var Papa=require(_0x598e('0xd'));var Redis=require(_0x598e('0xe'));var authService=require(_0x598e('0xf'));var qs=require(_0x598e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x598e('0x11'));var logger=require(_0x598e('0x12'))('api');var utils=require(_0x598e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x598e('0x14'));var db=require(_0x598e('0x15'))['db'];function respondWithStatusCode(_0x2e3614,_0xd29d12){_0xd29d12=_0xd29d12||0xcc;return function(_0x3811b2){if(_0x3811b2){return _0x2e3614['sendStatus'](_0xd29d12);}return _0x2e3614[_0x598e('0x16')](_0xd29d12)['end']();};}function respondWithResult(_0x1c3f37,_0x51d7f0){_0x51d7f0=_0x51d7f0||0xc8;return function(_0x4e253a){if(_0x4e253a){return _0x1c3f37[_0x598e('0x16')](_0x51d7f0)[_0x598e('0x17')](_0x4e253a);}};}function respondWithFilteredResult(_0x3d6571,_0x38868b){return function(_0x34c672){if(_0x34c672){var _0x93ba6c=typeof _0x38868b[_0x598e('0x18')]==='undefined'&&typeof _0x38868b[_0x598e('0x19')]===_0x598e('0x1a');var _0x3521bc=_0x34c672[_0x598e('0x1b')];var _0x50ffbb=_0x93ba6c?0x0:_0x38868b[_0x598e('0x18')];var _0x2ecb1e=_0x93ba6c?_0x34c672[_0x598e('0x1b')]:_0x38868b[_0x598e('0x18')]+_0x38868b[_0x598e('0x19')];var _0x1c1085;if(_0x2ecb1e>=_0x3521bc){_0x2ecb1e=_0x3521bc;_0x1c1085=0xc8;}else{_0x1c1085=0xce;}_0x3d6571[_0x598e('0x16')](_0x1c1085);return _0x3d6571[_0x598e('0x1c')](_0x598e('0x1d'),_0x50ffbb+'-'+_0x2ecb1e+'/'+_0x3521bc)[_0x598e('0x17')](_0x34c672);}return null;};}function patchUpdates(_0x17e5f1){return function(_0x2a1a65){try{jsonpatch[_0x598e('0x1e')](_0x2a1a65,_0x17e5f1,!![]);}catch(_0x20c1bb){return BPromise[_0x598e('0x1f')](_0x20c1bb);}return _0x2a1a65[_0x598e('0x20')]();};}function saveUpdates(_0x233f16,_0x5b9c3){return function(_0x4a483b){if(_0x4a483b){return _0x4a483b[_0x598e('0x21')](_0x233f16)['then'](function(_0xdec363){return _0xdec363;});}return null;};}function removeEntity(_0x3cea88,_0x5df3ba){return function(_0x45e7ee){if(_0x45e7ee){return _0x45e7ee[_0x598e('0x22')]()[_0x598e('0x23')](function(){_0x3cea88[_0x598e('0x16')](0xcc)[_0x598e('0x24')]();});}};}function handleEntityNotFound(_0x3e434e,_0x2cb735){return function(_0x2a8fbc){if(!_0x2a8fbc){_0x3e434e[_0x598e('0x25')](0x194);}return _0x2a8fbc;};}function handleError(_0x19d4f8,_0x1a8d85){_0x1a8d85=_0x1a8d85||0x1f4;return function(_0x5d63ce){logger[_0x598e('0x26')](_0x5d63ce['stack']);if(_0x5d63ce[_0x598e('0x27')]){delete _0x5d63ce[_0x598e('0x27')];}_0x19d4f8[_0x598e('0x16')](_0x1a8d85)['send'](_0x5d63ce);};}exports[_0x598e('0x28')]=function(_0xc81d68,_0x158681){var _0x884e0f={},_0x43ddf0={},_0x5ecac3={'count':0x0,'rows':[]};var _0x4fad2d=_['map'](db[_0x598e('0x29')][_0x598e('0x2a')],function(_0x2ee4a5){return{'name':_0x2ee4a5[_0x598e('0x2b')],'type':_0x2ee4a5[_0x598e('0x2c')][_0x598e('0x2d')]};});_0x43ddf0['model']=_[_0x598e('0x2e')](_0x4fad2d,_0x598e('0x27'));_0x43ddf0[_0x598e('0x2f')]=_[_0x598e('0x30')](_0xc81d68[_0x598e('0x2f')]);_0x43ddf0['filters']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],_0x43ddf0[_0x598e('0x2f')]);_0x884e0f['attributes']=_[_0x598e('0x31')](_0x43ddf0[_0x598e('0x32')],qs['fields'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x33')]));_0x884e0f[_0x598e('0x34')]=_0x884e0f[_0x598e('0x34')][_0x598e('0x35')]?_0x884e0f[_0x598e('0x34')]:_0x43ddf0['model'];if(!_0xc81d68[_0x598e('0x2f')][_0x598e('0x36')](_0x598e('0x37'))){_0x884e0f['limit']=qs['limit'](_0xc81d68[_0x598e('0x2f')]['limit']);_0x884e0f[_0x598e('0x18')]=qs[_0x598e('0x18')](_0xc81d68['query']['offset']);}_0x884e0f[_0x598e('0x38')]=qs['sort'](_0xc81d68[_0x598e('0x2f')][_0x598e('0x39')]);_0x884e0f[_0x598e('0x3a')]=qs['filters'](_[_0x598e('0x3b')](_0xc81d68['query'],_0x43ddf0['filters']),_0x4fad2d);if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]){_0x884e0f['where']=_['merge'](_0x884e0f[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x4fad2d,function(_0x5254e5){if(_0x5254e5[_0x598e('0x2c')]!==_0x598e('0x3d')){var _0x38142c={};_0x38142c[_0x5254e5[_0x598e('0x27')]]={'$like':'%'+_0xc81d68[_0x598e('0x2f')][_0x598e('0x3c')]+'%'};return _0x38142c;}})});}_0x884e0f=_[_0x598e('0x3e')]({},_0x884e0f,_0xc81d68['options']);var _0x3ee264={'where':_0x884e0f[_0x598e('0x3a')]};return db[_0x598e('0x29')][_0x598e('0x1b')](_0x3ee264)[_0x598e('0x23')](function(_0x25af45){_0x5ecac3[_0x598e('0x1b')]=_0x25af45;if(_0xc81d68[_0x598e('0x2f')][_0x598e('0x3f')]){_0x884e0f[_0x598e('0x40')]=[{'all':!![]}];}return db[_0x598e('0x29')][_0x598e('0x41')](_0x884e0f);})[_0x598e('0x23')](function(_0x5633c9){_0x5ecac3['rows']=_0x5633c9;return _0x5ecac3;})[_0x598e('0x23')](respondWithFilteredResult(_0x158681,_0x884e0f))[_0x598e('0x42')](handleError(_0x158681,null));};exports[_0x598e('0x43')]=function(_0x3c7828,_0x4d3273){var _0x3799c7={'raw':!![],'where':{'id':_0x3c7828[_0x598e('0x44')]['id']}},_0x22f24b={};_0x22f24b['model']=_[_0x598e('0x30')](db[_0x598e('0x29')][_0x598e('0x2a')]);_0x22f24b[_0x598e('0x2f')]=_[_0x598e('0x30')](_0x3c7828[_0x598e('0x2f')]);_0x22f24b[_0x598e('0x45')]=_[_0x598e('0x31')](_0x22f24b[_0x598e('0x32')],_0x22f24b[_0x598e('0x2f')]);_0x3799c7[_0x598e('0x34')]=_['intersection'](_0x22f24b['model'],qs['fields'](_0x3c7828[_0x598e('0x2f')][_0x598e('0x33')]));_0x3799c7[_0x598e('0x34')]=_0x3799c7['attributes'][_0x598e('0x35')]?_0x3799c7[_0x598e('0x34')]:_0x22f24b[_0x598e('0x32')];if(_0x3c7828['query'][_0x598e('0x3f')]){_0x3799c7[_0x598e('0x40')]=[{'all':!![]}];}_0x3799c7=_[_0x598e('0x3e')]({},_0x3799c7,_0x3c7828['options']);return db[_0x598e('0x29')][_0x598e('0x46')](_0x3799c7)[_0x598e('0x23')](handleEntityNotFound(_0x4d3273,null))[_0x598e('0x23')](respondWithResult(_0x4d3273,null))[_0x598e('0x42')](handleError(_0x4d3273,null));};exports[_0x598e('0x47')]=function(_0x5ec8d8,_0x2c7c8f){return db[_0x598e('0x29')]['create'](_0x5ec8d8[_0x598e('0x48')],{})[_0x598e('0x23')](respondWithResult(_0x2c7c8f,0xc9))[_0x598e('0x42')](handleError(_0x2c7c8f,null));};exports['update']=function(_0x59e67b,_0x57b11a){if(_0x59e67b[_0x598e('0x48')]['id']){delete _0x59e67b[_0x598e('0x48')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x59e67b[_0x598e('0x44')]['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x57b11a,null))['then'](saveUpdates(_0x59e67b['body'],null))[_0x598e('0x23')](respondWithResult(_0x57b11a,null))[_0x598e('0x42')](handleError(_0x57b11a,null));};exports[_0x598e('0x22')]=function(_0x34a43d,_0x5cbe61){return db['FaxQueueReport'][_0x598e('0x46')]({'where':{'id':_0x34a43d['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x5cbe61,null))['then'](removeEntity(_0x5cbe61,null))[_0x598e('0x42')](handleError(_0x5cbe61,null));};exports[_0x598e('0x49')]=function(_0x16105d,_0x46d71f){return db[_0x598e('0x29')][_0x598e('0x49')]()[_0x598e('0x23')](respondWithResult(_0x46d71f,null))['catch'](handleError(_0x46d71f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 23c811e..0b1a660 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x220e1b,_0x1e0406){var _0x49e317=function(_0x38ccf3){while(--_0x38ccf3){_0x220e1b['push'](_0x220e1b['shift']());}};_0x49e317(++_0x1e0406);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b7db2,_0x5edd58){_0x3b7db2=_0x3b7db2-0x0;var _0x3a819e=_0x7fbe[_0x3b7db2];return _0x3a819e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2857be,_0x3d1f61){var _0x425e69=function(_0x16bcf3){while(--_0x16bcf3){_0x2857be['push'](_0x2857be['shift']());}};_0x425e69(++_0x3d1f61);}(_0x53ec,0x192));var _0xc53e=function(_0x5e1f4b,_0x50b208){_0x5e1f4b=_0x5e1f4b-0x0;var _0x5ce7b4=_0x53ec[_0x5e1f4b];return _0x5ce7b4;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c80c302..31ee01c 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 _0xc19e=['request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','info','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xc19e,0x176));var _0xec19=function(_0x4c36ea,_0x204536){_0x4c36ea=_0x4c36ea-0x0;var _0x4292e8=_0xc19e[_0x4c36ea];return _0x4292e8;};'use strict';var _=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var moment=require(_0xec19('0x2'));var BPromise=require(_0xec19('0x3'));var rs=require(_0xec19('0x4'));var fs=require('fs');var Redis=require(_0xec19('0x5'));var db=require(_0xec19('0x6'))['db'];var utils=require(_0xec19('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xec19('0x8'));var client=jayson[_0xec19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50c771,_0x415c6a,_0x1e3004){return new BPromise(function(_0x31a477,_0x2389b7){return client[_0xec19('0xa')](_0x50c771,_0x1e3004)[_0xec19('0xb')](function(_0x36a8f3){logger['info'](_0xec19('0xc'),_0x415c6a,_0xec19('0xd'));logger[_0xec19('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x415c6a,_0xec19('0xd'),JSON['stringify'](_0x36a8f3));if(_0x36a8f3[_0xec19('0xf')]){if(_0x36a8f3[_0xec19('0xf')][_0xec19('0x10')]===0x1f4){logger['error'](_0xec19('0xc'),_0x415c6a,_0x36a8f3[_0xec19('0xf')][_0xec19('0x11')]);return _0x2389b7(_0x36a8f3[_0xec19('0xf')]['message']);}logger[_0xec19('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x415c6a,_0x36a8f3[_0xec19('0xf')][_0xec19('0x11')]);return _0x31a477(_0x36a8f3['error']['message']);}else{logger['info'](_0xec19('0xc'),_0x415c6a,'request\x20sent');_0x31a477(_0x36a8f3[_0xec19('0x12')][_0xec19('0x11')]);}})[_0xec19('0x13')](function(_0x5e7ede){logger[_0xec19('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x415c6a,_0x5e7ede);_0x2389b7(_0x5e7ede);});});}exports[_0xec19('0x14')]=function(_0x1e0f54){var _0x356148=this;return new Promise(function(_0x32bb15,_0x43c55e){return db['FaxQueueReport'][_0xec19('0x15')](_0x1e0f54[_0xec19('0x16')],{'raw':_0x1e0f54[_0xec19('0x17')]?_0x1e0f54[_0xec19('0x17')][_0xec19('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2e3228){logger[_0xec19('0x19')](_0xec19('0x14'),_0x1e0f54);logger[_0xec19('0xe')](_0xec19('0x14'),_0x1e0f54,JSON[_0xec19('0x1a')](_0x2e3228));_0x32bb15(_0x2e3228);})['catch'](function(_0x1af12){logger[_0xec19('0xf')](_0xec19('0x14'),_0x1af12[_0xec19('0x11')],_0x1e0f54);_0x43c55e(_0x356148[_0xec19('0xf')](0x1f4,_0x1af12[_0xec19('0x11')]));});});};exports[_0xec19('0x1b')]=function(_0x23cd63){var _0x3ec214=this;return new Promise(function(_0x267586,_0x70c7df){return db[_0xec19('0x1c')][_0xec19('0x1d')](_0x23cd63[_0xec19('0x16')],{'raw':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x1e')]||null:null,'attributes':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')]['attributes']||null:null,'limit':_0x23cd63[_0xec19('0x17')]?_0x23cd63[_0xec19('0x17')][_0xec19('0x1f')]||null:null})[_0xec19('0xb')](function(_0x141f92){logger[_0xec19('0x19')]('UpdateFaxQueueReport',_0x23cd63);logger[_0xec19('0xe')](_0xec19('0x1b'),_0x23cd63,JSON[_0xec19('0x1a')](_0x141f92));_0x267586(_0x141f92);})['catch'](function(_0x12aced){logger['error'](_0xec19('0x1b'),_0x12aced[_0xec19('0x11')],_0x23cd63);_0x70c7df(_0x3ec214['error'](0x1f4,_0x12aced[_0xec19('0x11')]));});});}; \ No newline at end of file +var _0xf0cc=['http','request','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','where','limit','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x136bae,_0x3bf8f3){var _0x30a2e2=function(_0x1815c6){while(--_0x1815c6){_0x136bae['push'](_0x136bae['shift']());}};_0x30a2e2(++_0x3bf8f3);}(_0xf0cc,0x13f));var _0xcf0c=function(_0x48bffe,_0x4ead08){_0x48bffe=_0x48bffe-0x0;var _0x28008d=_0xf0cc[_0x48bffe];return _0x28008d;};'use strict';var _=require(_0xcf0c('0x0'));var util=require(_0xcf0c('0x1'));var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var rs=require(_0xcf0c('0x3'));var fs=require('fs');var Redis=require(_0xcf0c('0x4'));var db=require(_0xcf0c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf0c('0x6'))(_0xcf0c('0x7'));var config=require(_0xcf0c('0x8'));var jayson=require(_0xcf0c('0x9'));var client=jayson[_0xcf0c('0xa')][_0xcf0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f75c4,_0x1cb16d,_0x2a9b3b){return new BPromise(function(_0x55fb80,_0x445389){return client[_0xcf0c('0xc')](_0x2f75c4,_0x2a9b3b)['then'](function(_0x5ed0ce){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1cb16d,_0xcf0c('0xd'));logger[_0xcf0c('0xe')](_0xcf0c('0xf'),_0x1cb16d,_0xcf0c('0xd'),JSON[_0xcf0c('0x10')](_0x5ed0ce));if(_0x5ed0ce[_0xcf0c('0x11')]){if(_0x5ed0ce['error'][_0xcf0c('0x12')]===0x1f4){logger['error'](_0xcf0c('0x13'),_0x1cb16d,_0x5ed0ce['error'][_0xcf0c('0x14')]);return _0x445389(_0x5ed0ce['error']['message']);}logger[_0xcf0c('0x11')](_0xcf0c('0x13'),_0x1cb16d,_0x5ed0ce[_0xcf0c('0x11')]['message']);return _0x55fb80(_0x5ed0ce[_0xcf0c('0x11')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1cb16d,'request\x20sent');_0x55fb80(_0x5ed0ce[_0xcf0c('0x15')][_0xcf0c('0x14')]);}})['catch'](function(_0x17787f){logger[_0xcf0c('0x11')](_0xcf0c('0x13'),_0x1cb16d,_0x17787f);_0x445389(_0x17787f);});});}exports[_0xcf0c('0x16')]=function(_0x547dfd){var _0x294ef2=this;return new Promise(function(_0x2a3998,_0x5f2fe7){return db['FaxQueueReport'][_0xcf0c('0x17')](_0x547dfd[_0xcf0c('0x18')],{'raw':_0x547dfd[_0xcf0c('0x19')]?_0x547dfd[_0xcf0c('0x19')][_0xcf0c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x30838b){logger['info'](_0xcf0c('0x16'),_0x547dfd);logger[_0xcf0c('0xe')]('CreateFaxQueueReport',_0x547dfd,JSON[_0xcf0c('0x10')](_0x30838b));_0x2a3998(_0x30838b);})[_0xcf0c('0x1b')](function(_0x3d9676){logger[_0xcf0c('0x11')](_0xcf0c('0x16'),_0x3d9676[_0xcf0c('0x14')],_0x547dfd);_0x5f2fe7(_0x294ef2['error'](0x1f4,_0x3d9676['message']));});});};exports[_0xcf0c('0x1c')]=function(_0x7dd1ad){var _0x2c6e3d=this;return new Promise(function(_0x4a5033,_0x3a23c9){return db['FaxQueueReport']['update'](_0x7dd1ad['body'],{'raw':_0x7dd1ad[_0xcf0c('0x19')]?_0x7dd1ad[_0xcf0c('0x19')][_0xcf0c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7dd1ad['options']?_0x7dd1ad[_0xcf0c('0x19')][_0xcf0c('0x1d')]||null:null,'attributes':_0x7dd1ad[_0xcf0c('0x19')]?_0x7dd1ad[_0xcf0c('0x19')]['attributes']||null:null,'limit':_0x7dd1ad[_0xcf0c('0x19')]?_0x7dd1ad['options'][_0xcf0c('0x1e')]||null:null})[_0xcf0c('0x1f')](function(_0x2f4978){logger[_0xcf0c('0x20')](_0xcf0c('0x1c'),_0x7dd1ad);logger['debug'](_0xcf0c('0x1c'),_0x7dd1ad,JSON[_0xcf0c('0x10')](_0x2f4978));_0x4a5033(_0x2f4978);})[_0xcf0c('0x1b')](function(_0x8753b2){logger['error']('UpdateFaxQueueReport',_0x8753b2[_0xcf0c('0x14')],_0x7dd1ad);_0x3a23c9(_0x2c6e3d[_0xcf0c('0x11')](0x1f4,_0x8753b2[_0xcf0c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b33de95..eca9add 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 _0xdde4=['show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x125b75,_0x5ed208){var _0x383527=function(_0x583184){while(--_0x583184){_0x125b75['push'](_0x125b75['shift']());}};_0x383527(++_0x5ed208);}(_0xdde4,0xb8));var _0x4dde=function(_0x12eb23,_0x38e217){_0x12eb23=_0x12eb23-0x0;var _0xf369e8=_0xdde4[_0x12eb23];return _0xf369e8;};'use strict';var multer=require(_0x4dde('0x0'));var util=require(_0x4dde('0x1'));var path=require(_0x4dde('0x2'));var timeout=require(_0x4dde('0x3'));var express=require(_0x4dde('0x4'));var router=express[_0x4dde('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4dde('0x6'));var config=require(_0x4dde('0x7'));var controller=require(_0x4dde('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4dde('0x9')]);router[_0x4dde('0xa')](_0x4dde('0xb'),auth[_0x4dde('0xc')](),controller[_0x4dde('0xd')]);router[_0x4dde('0xa')]('/:id',auth[_0x4dde('0xc')](),controller[_0x4dde('0xe')]);router[_0x4dde('0xf')]('/',auth[_0x4dde('0xc')](),controller[_0x4dde('0x10')]);router[_0x4dde('0x11')](_0x4dde('0x12'),auth[_0x4dde('0xc')](),controller[_0x4dde('0x13')]);router[_0x4dde('0x14')](_0x4dde('0x12'),auth[_0x4dde('0xc')](),controller['destroy']);module[_0x4dde('0x15')]=router; \ No newline at end of file +var _0x4950=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0xcb9ded,_0x3878e0){var _0x8615ed=function(_0x331749){while(--_0x331749){_0xcb9ded['push'](_0xcb9ded['shift']());}};_0x8615ed(++_0x3878e0);}(_0x4950,0x162));var _0x0495=function(_0x5ba3fd,_0x3f92f6){_0x5ba3fd=_0x5ba3fd-0x0;var _0x48afcd=_0x4950[_0x5ba3fd];return _0x48afcd;};'use strict';var multer=require(_0x0495('0x0'));var util=require(_0x0495('0x1'));var path=require(_0x0495('0x2'));var timeout=require(_0x0495('0x3'));var express=require(_0x0495('0x4'));var router=express[_0x0495('0x5')]();var fs_extra=require(_0x0495('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0495('0x7'));var config=require(_0x0495('0x8'));var controller=require(_0x0495('0x9'));router[_0x0495('0xa')]('/',auth[_0x0495('0xb')](),controller[_0x0495('0xc')]);router[_0x0495('0xa')](_0x0495('0xd'),auth['isAuthenticated'](),controller[_0x0495('0xe')]);router[_0x0495('0xa')](_0x0495('0xf'),auth['isAuthenticated'](),controller[_0x0495('0x10')]);router[_0x0495('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0495('0x12')](_0x0495('0xf'),auth[_0x0495('0xb')](),controller[_0x0495('0x13')]);router[_0x0495('0x14')](_0x0495('0xf'),auth[_0x0495('0xb')](),controller[_0x0495('0x15')]);module[_0x0495('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 729df8e..544ccaf 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1a5dcb,_0x7099c0){var _0x4b93dd=function(_0x399d9c){while(--_0x399d9c){_0x1a5dcb['push'](_0x1a5dcb['shift']());}};_0x4b93dd(++_0x7099c0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x00bb[_0x47b58b];return _0x46bebe;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8f7be77..512ce7c 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 _0x9423=['params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x9423,0x95));var _0x3942=function(_0x5678b9,_0x33f01f){_0x5678b9=_0x5678b9-0x0;var _0x251bc8=_0x9423[_0x5678b9];return _0x251bc8;};'use strict';var emlformat=require(_0x3942('0x0'));var rimraf=require(_0x3942('0x1'));var zipdir=require(_0x3942('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3942('0x3'));var moment=require(_0x3942('0x4'));var BPromise=require(_0x3942('0x5'));var Mustache=require('mustache');var util=require(_0x3942('0x6'));var path=require(_0x3942('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3942('0x8'));var fs=require('fs');var fs_extra=require(_0x3942('0x9'));var _=require('lodash');var squel=require(_0x3942('0xa'));var crypto=require(_0x3942('0xb'));var jsforce=require(_0x3942('0xc'));var deskjs=require(_0x3942('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3942('0xe'));var Redis=require(_0x3942('0xf'));var authService=require(_0x3942('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3942('0x11'));var logger=require(_0x3942('0x12'))('api');var utils=require(_0x3942('0x13'));var config=require(_0x3942('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d64c0,_0x5ad4f0){_0x5ad4f0=_0x5ad4f0||0xcc;return function(_0x1808f3){if(_0x1808f3){return _0x1d64c0['sendStatus'](_0x5ad4f0);}return _0x1d64c0['status'](_0x5ad4f0)['end']();};}function respondWithResult(_0x1e8b78,_0x4a0b85){_0x4a0b85=_0x4a0b85||0xc8;return function(_0xa96d4f){if(_0xa96d4f){return _0x1e8b78[_0x3942('0x15')](_0x4a0b85)['json'](_0xa96d4f);}};}function respondWithFilteredResult(_0x3d322a,_0x24e6c2){return function(_0x450c73){if(_0x450c73){var _0x8cd022=typeof _0x24e6c2[_0x3942('0x16')]===_0x3942('0x17')&&typeof _0x24e6c2['limit']==='undefined';var _0x2a9414=_0x450c73[_0x3942('0x18')];var _0xcaede=_0x8cd022?0x0:_0x24e6c2[_0x3942('0x16')];var _0x5d3a44=_0x8cd022?_0x450c73[_0x3942('0x18')]:_0x24e6c2[_0x3942('0x16')]+_0x24e6c2['limit'];var _0x5b720e;if(_0x5d3a44>=_0x2a9414){_0x5d3a44=_0x2a9414;_0x5b720e=0xc8;}else{_0x5b720e=0xce;}_0x3d322a['status'](_0x5b720e);return _0x3d322a[_0x3942('0x19')](_0x3942('0x1a'),_0xcaede+'-'+_0x5d3a44+'/'+_0x2a9414)['json'](_0x450c73);}return null;};}function patchUpdates(_0x15ca39){return function(_0x3e96c2){try{jsonpatch[_0x3942('0x1b')](_0x3e96c2,_0x15ca39,!![]);}catch(_0x325bcd){return BPromise[_0x3942('0x1c')](_0x325bcd);}return _0x3e96c2[_0x3942('0x1d')]();};}function saveUpdates(_0x4667f1,_0x4bc92e){return function(_0x9f0e73){if(_0x9f0e73){return _0x9f0e73[_0x3942('0x1e')](_0x4667f1)[_0x3942('0x1f')](function(_0x5ea246){return _0x5ea246;});}return null;};}function removeEntity(_0x1ce605,_0x4052c1){return function(_0x24fe1f){if(_0x24fe1f){return _0x24fe1f[_0x3942('0x20')]()[_0x3942('0x1f')](function(){_0x1ce605[_0x3942('0x15')](0xcc)[_0x3942('0x21')]();});}};}function handleEntityNotFound(_0x5798f2,_0x5e1413){return function(_0x5d22d8){if(!_0x5d22d8){_0x5798f2['sendStatus'](0x194);}return _0x5d22d8;};}function handleError(_0x96e528,_0x471e0d){_0x471e0d=_0x471e0d||0x1f4;return function(_0x5301e6){logger['error'](_0x5301e6[_0x3942('0x22')]);if(_0x5301e6['name']){delete _0x5301e6['name'];}_0x96e528[_0x3942('0x15')](_0x471e0d)['send'](_0x5301e6);};}exports['index']=function(_0x44df3d,_0x2d5583){var _0x1b4c5b={},_0x3a494f={},_0x24e1c2={'count':0x0,'rows':[]};var _0x3d6c26=_['map'](db['FaxTransferReport']['rawAttributes'],function(_0x30377d){return{'name':_0x30377d[_0x3942('0x23')],'type':_0x30377d[_0x3942('0x24')][_0x3942('0x25')]};});_0x3a494f[_0x3942('0x26')]=_[_0x3942('0x27')](_0x3d6c26,'name');_0x3a494f[_0x3942('0x28')]=_['keys'](_0x44df3d['query']);_0x3a494f['filters']=_[_0x3942('0x29')](_0x3a494f[_0x3942('0x26')],_0x3a494f['query']);_0x1b4c5b[_0x3942('0x2a')]=_[_0x3942('0x29')](_0x3a494f['model'],qs[_0x3942('0x2b')](_0x44df3d[_0x3942('0x28')][_0x3942('0x2b')]));_0x1b4c5b[_0x3942('0x2a')]=_0x1b4c5b[_0x3942('0x2a')][_0x3942('0x2c')]?_0x1b4c5b[_0x3942('0x2a')]:_0x3a494f[_0x3942('0x26')];if(!_0x44df3d[_0x3942('0x28')]['hasOwnProperty'](_0x3942('0x2d'))){_0x1b4c5b[_0x3942('0x2e')]=qs[_0x3942('0x2e')](_0x44df3d[_0x3942('0x28')][_0x3942('0x2e')]);_0x1b4c5b[_0x3942('0x16')]=qs[_0x3942('0x16')](_0x44df3d[_0x3942('0x28')]['offset']);}_0x1b4c5b[_0x3942('0x2f')]=qs[_0x3942('0x30')](_0x44df3d[_0x3942('0x28')]['sort']);_0x1b4c5b[_0x3942('0x31')]=qs[_0x3942('0x32')](_[_0x3942('0x33')](_0x44df3d[_0x3942('0x28')],_0x3a494f[_0x3942('0x32')]),_0x3d6c26);if(_0x44df3d[_0x3942('0x28')][_0x3942('0x34')]){_0x1b4c5b[_0x3942('0x31')]=_[_0x3942('0x35')](_0x1b4c5b[_0x3942('0x31')],{'$or':_[_0x3942('0x27')](_0x3d6c26,function(_0x99dde5){if(_0x99dde5[_0x3942('0x24')]!==_0x3942('0x36')){var _0x5592a8={};_0x5592a8[_0x99dde5[_0x3942('0x37')]]={'$like':'%'+_0x44df3d[_0x3942('0x28')][_0x3942('0x34')]+'%'};return _0x5592a8;}})});}_0x1b4c5b=_['merge']({},_0x1b4c5b,_0x44df3d[_0x3942('0x38')]);var _0x398c29={'where':_0x1b4c5b[_0x3942('0x31')]};return db['FaxTransferReport'][_0x3942('0x18')](_0x398c29)[_0x3942('0x1f')](function(_0xaa4faa){_0x24e1c2['count']=_0xaa4faa;if(_0x44df3d['query'][_0x3942('0x39')]){_0x1b4c5b[_0x3942('0x3a')]=[{'all':!![]}];}return db[_0x3942('0x3b')][_0x3942('0x3c')](_0x1b4c5b);})[_0x3942('0x1f')](function(_0x45dfd2){_0x24e1c2[_0x3942('0x3d')]=_0x45dfd2;return _0x24e1c2;})[_0x3942('0x1f')](respondWithFilteredResult(_0x2d5583,_0x1b4c5b))[_0x3942('0x3e')](handleError(_0x2d5583,null));};exports[_0x3942('0x3f')]=function(_0x5ae1d7,_0x4fe555){var _0x37b164={'raw':!![],'where':{'id':_0x5ae1d7[_0x3942('0x40')]['id']}},_0x2ba7ec={};_0x2ba7ec['model']=_[_0x3942('0x41')](db[_0x3942('0x3b')][_0x3942('0x42')]);_0x2ba7ec[_0x3942('0x28')]=_[_0x3942('0x41')](_0x5ae1d7[_0x3942('0x28')]);_0x2ba7ec['filters']=_['intersection'](_0x2ba7ec[_0x3942('0x26')],_0x2ba7ec[_0x3942('0x28')]);_0x37b164[_0x3942('0x2a')]=_['intersection'](_0x2ba7ec['model'],qs[_0x3942('0x2b')](_0x5ae1d7['query'][_0x3942('0x2b')]));_0x37b164[_0x3942('0x2a')]=_0x37b164['attributes'][_0x3942('0x2c')]?_0x37b164[_0x3942('0x2a')]:_0x2ba7ec[_0x3942('0x26')];if(_0x5ae1d7[_0x3942('0x28')][_0x3942('0x39')]){_0x37b164['include']=[{'all':!![]}];}_0x37b164=_['merge']({},_0x37b164,_0x5ae1d7[_0x3942('0x38')]);return db['FaxTransferReport']['find'](_0x37b164)[_0x3942('0x1f')](handleEntityNotFound(_0x4fe555,null))['then'](respondWithResult(_0x4fe555,null))[_0x3942('0x3e')](handleError(_0x4fe555,null));};exports[_0x3942('0x43')]=function(_0x5dab55,_0x284f66){return db['FaxTransferReport']['create'](_0x5dab55['body'],{})[_0x3942('0x1f')](respondWithResult(_0x284f66,0xc9))[_0x3942('0x3e')](handleError(_0x284f66,null));};exports['update']=function(_0xee71d6,_0xc84cff){if(_0xee71d6[_0x3942('0x44')]['id']){delete _0xee71d6[_0x3942('0x44')]['id'];}return db[_0x3942('0x3b')][_0x3942('0x45')]({'where':{'id':_0xee71d6[_0x3942('0x40')]['id']}})[_0x3942('0x1f')](handleEntityNotFound(_0xc84cff,null))['then'](saveUpdates(_0xee71d6['body'],null))[_0x3942('0x1f')](respondWithResult(_0xc84cff,null))[_0x3942('0x3e')](handleError(_0xc84cff,null));};exports[_0x3942('0x20')]=function(_0x103f25,_0x28cf7d){return db[_0x3942('0x3b')][_0x3942('0x45')]({'where':{'id':_0x103f25[_0x3942('0x40')]['id']}})['then'](handleEntityNotFound(_0x28cf7d,null))[_0x3942('0x1f')](removeEntity(_0x28cf7d,null))[_0x3942('0x3e')](handleError(_0x28cf7d,null));};exports[_0x3942('0x46')]=function(_0x1d5367,_0x34e4d3){return db[_0x3942('0x3b')][_0x3942('0x46')]()[_0x3942('0x1f')](respondWithResult(_0x34e4d3,null))[_0x3942('0x3e')](handleError(_0x34e4d3,null));}; \ No newline at end of file +var _0xf9aa=['order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','then','rows','catch','show','rawAttributes','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','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','set','Content-Range','apply','reject','destroy','error','stack','name','map','FaxTransferReport','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xf9aa,0xf9));var _0xaf9a=function(_0x2e14bf,_0x3af516){_0x2e14bf=_0x2e14bf-0x0;var _0x1f7d7b=_0xf9aa[_0x2e14bf];return _0x1f7d7b;};'use strict';var emlformat=require(_0xaf9a('0x0'));var rimraf=require(_0xaf9a('0x1'));var zipdir=require(_0xaf9a('0x2'));var jsonpatch=require(_0xaf9a('0x3'));var rp=require(_0xaf9a('0x4'));var moment=require('moment');var BPromise=require(_0xaf9a('0x5'));var Mustache=require(_0xaf9a('0x6'));var util=require(_0xaf9a('0x7'));var path=require(_0xaf9a('0x8'));var sox=require('sox');var csv=require(_0xaf9a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf9a('0xa'));var _=require('lodash');var squel=require(_0xaf9a('0xb'));var crypto=require(_0xaf9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf9a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaf9a('0xe'));var Papa=require(_0xaf9a('0xf'));var Redis=require('ioredis');var authService=require(_0xaf9a('0x10'));var qs=require(_0xaf9a('0x11'));var as=require(_0xaf9a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf9a('0x13'))('api');var utils=require(_0xaf9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaf9a('0x15'));var db=require(_0xaf9a('0x16'))['db'];function respondWithStatusCode(_0x4f366d,_0x5d7531){_0x5d7531=_0x5d7531||0xcc;return function(_0x250a9b){if(_0x250a9b){return _0x4f366d[_0xaf9a('0x17')](_0x5d7531);}return _0x4f366d[_0xaf9a('0x18')](_0x5d7531)[_0xaf9a('0x19')]();};}function respondWithResult(_0x325f47,_0x48cd7f){_0x48cd7f=_0x48cd7f||0xc8;return function(_0x247037){if(_0x247037){return _0x325f47[_0xaf9a('0x18')](_0x48cd7f)[_0xaf9a('0x1a')](_0x247037);}};}function respondWithFilteredResult(_0x44e443,_0xe0d329){return function(_0x3949e1){if(_0x3949e1){var _0x1303e8=typeof _0xe0d329[_0xaf9a('0x1b')]===_0xaf9a('0x1c')&&typeof _0xe0d329[_0xaf9a('0x1d')]===_0xaf9a('0x1c');var _0x4b83e6=_0x3949e1['count'];var _0x1895b8=_0x1303e8?0x0:_0xe0d329[_0xaf9a('0x1b')];var _0x439457=_0x1303e8?_0x3949e1['count']:_0xe0d329['offset']+_0xe0d329[_0xaf9a('0x1d')];var _0x18629f;if(_0x439457>=_0x4b83e6){_0x439457=_0x4b83e6;_0x18629f=0xc8;}else{_0x18629f=0xce;}_0x44e443[_0xaf9a('0x18')](_0x18629f);return _0x44e443[_0xaf9a('0x1e')](_0xaf9a('0x1f'),_0x1895b8+'-'+_0x439457+'/'+_0x4b83e6)['json'](_0x3949e1);}return null;};}function patchUpdates(_0xaf1a92){return function(_0xd9647f){try{jsonpatch[_0xaf9a('0x20')](_0xd9647f,_0xaf1a92,!![]);}catch(_0x533546){return BPromise[_0xaf9a('0x21')](_0x533546);}return _0xd9647f['save']();};}function saveUpdates(_0x2a4f6,_0x5b48e1){return function(_0x318b11){if(_0x318b11){return _0x318b11['update'](_0x2a4f6)['then'](function(_0x167d23){return _0x167d23;});}return null;};}function removeEntity(_0x5a2bbe,_0x507f8b){return function(_0x530bd7){if(_0x530bd7){return _0x530bd7[_0xaf9a('0x22')]()['then'](function(){_0x5a2bbe[_0xaf9a('0x18')](0xcc)[_0xaf9a('0x19')]();});}};}function handleEntityNotFound(_0x4c41af,_0x40d544){return function(_0x420cf6){if(!_0x420cf6){_0x4c41af[_0xaf9a('0x17')](0x194);}return _0x420cf6;};}function handleError(_0x6cbde7,_0x2446a0){_0x2446a0=_0x2446a0||0x1f4;return function(_0x456248){logger[_0xaf9a('0x23')](_0x456248[_0xaf9a('0x24')]);if(_0x456248[_0xaf9a('0x25')]){delete _0x456248['name'];}_0x6cbde7[_0xaf9a('0x18')](_0x2446a0)['send'](_0x456248);};}exports['index']=function(_0x223b4f,_0x2f5277){var _0x3e87f1={},_0x3da524={},_0x1c3d89={'count':0x0,'rows':[]};var _0x1d5401=_[_0xaf9a('0x26')](db[_0xaf9a('0x27')]['rawAttributes'],function(_0x52ab93){return{'name':_0x52ab93['fieldName'],'type':_0x52ab93[_0xaf9a('0x28')][_0xaf9a('0x29')]};});_0x3da524['model']=_[_0xaf9a('0x26')](_0x1d5401,_0xaf9a('0x25'));_0x3da524[_0xaf9a('0x2a')]=_[_0xaf9a('0x2b')](_0x223b4f['query']);_0x3da524['filters']=_[_0xaf9a('0x2c')](_0x3da524[_0xaf9a('0x2d')],_0x3da524[_0xaf9a('0x2a')]);_0x3e87f1['attributes']=_[_0xaf9a('0x2c')](_0x3da524[_0xaf9a('0x2d')],qs[_0xaf9a('0x2e')](_0x223b4f[_0xaf9a('0x2a')][_0xaf9a('0x2e')]));_0x3e87f1[_0xaf9a('0x2f')]=_0x3e87f1['attributes'][_0xaf9a('0x30')]?_0x3e87f1[_0xaf9a('0x2f')]:_0x3da524[_0xaf9a('0x2d')];if(!_0x223b4f[_0xaf9a('0x2a')][_0xaf9a('0x31')](_0xaf9a('0x32'))){_0x3e87f1[_0xaf9a('0x1d')]=qs['limit'](_0x223b4f[_0xaf9a('0x2a')][_0xaf9a('0x1d')]);_0x3e87f1[_0xaf9a('0x1b')]=qs['offset'](_0x223b4f[_0xaf9a('0x2a')]['offset']);}_0x3e87f1[_0xaf9a('0x33')]=qs[_0xaf9a('0x34')](_0x223b4f[_0xaf9a('0x2a')][_0xaf9a('0x34')]);_0x3e87f1[_0xaf9a('0x35')]=qs[_0xaf9a('0x36')](_[_0xaf9a('0x37')](_0x223b4f[_0xaf9a('0x2a')],_0x3da524[_0xaf9a('0x36')]),_0x1d5401);if(_0x223b4f[_0xaf9a('0x2a')]['filter']){_0x3e87f1['where']=_['merge'](_0x3e87f1[_0xaf9a('0x35')],{'$or':_[_0xaf9a('0x26')](_0x1d5401,function(_0x308435){if(_0x308435['type']!==_0xaf9a('0x38')){var _0x17b90d={};_0x17b90d[_0x308435[_0xaf9a('0x25')]]={'$like':'%'+_0x223b4f['query'][_0xaf9a('0x39')]+'%'};return _0x17b90d;}})});}_0x3e87f1=_[_0xaf9a('0x3a')]({},_0x3e87f1,_0x223b4f[_0xaf9a('0x3b')]);var _0x16fce4={'where':_0x3e87f1[_0xaf9a('0x35')]};return db[_0xaf9a('0x27')][_0xaf9a('0x3c')](_0x16fce4)['then'](function(_0x1169a1){_0x1c3d89['count']=_0x1169a1;if(_0x223b4f[_0xaf9a('0x2a')][_0xaf9a('0x3d')]){_0x3e87f1[_0xaf9a('0x3e')]=[{'all':!![]}];}return db[_0xaf9a('0x27')][_0xaf9a('0x3f')](_0x3e87f1);})[_0xaf9a('0x40')](function(_0x1d46d9){_0x1c3d89[_0xaf9a('0x41')]=_0x1d46d9;return _0x1c3d89;})[_0xaf9a('0x40')](respondWithFilteredResult(_0x2f5277,_0x3e87f1))[_0xaf9a('0x42')](handleError(_0x2f5277,null));};exports[_0xaf9a('0x43')]=function(_0x5baa77,_0x339cbd){var _0x280f7b={'raw':!![],'where':{'id':_0x5baa77['params']['id']}},_0x3331f2={};_0x3331f2['model']=_[_0xaf9a('0x2b')](db[_0xaf9a('0x27')][_0xaf9a('0x44')]);_0x3331f2[_0xaf9a('0x2a')]=_[_0xaf9a('0x2b')](_0x5baa77['query']);_0x3331f2['filters']=_[_0xaf9a('0x2c')](_0x3331f2['model'],_0x3331f2['query']);_0x280f7b[_0xaf9a('0x2f')]=_[_0xaf9a('0x2c')](_0x3331f2[_0xaf9a('0x2d')],qs[_0xaf9a('0x2e')](_0x5baa77[_0xaf9a('0x2a')][_0xaf9a('0x2e')]));_0x280f7b[_0xaf9a('0x2f')]=_0x280f7b[_0xaf9a('0x2f')]['length']?_0x280f7b[_0xaf9a('0x2f')]:_0x3331f2['model'];if(_0x5baa77['query'][_0xaf9a('0x3d')]){_0x280f7b[_0xaf9a('0x3e')]=[{'all':!![]}];}_0x280f7b=_[_0xaf9a('0x3a')]({},_0x280f7b,_0x5baa77[_0xaf9a('0x3b')]);return db[_0xaf9a('0x27')][_0xaf9a('0x45')](_0x280f7b)[_0xaf9a('0x40')](handleEntityNotFound(_0x339cbd,null))[_0xaf9a('0x40')](respondWithResult(_0x339cbd,null))[_0xaf9a('0x42')](handleError(_0x339cbd,null));};exports['create']=function(_0x55de26,_0x380f7c){return db[_0xaf9a('0x27')][_0xaf9a('0x46')](_0x55de26[_0xaf9a('0x47')],{})['then'](respondWithResult(_0x380f7c,0xc9))['catch'](handleError(_0x380f7c,null));};exports[_0xaf9a('0x48')]=function(_0x5336dd,_0x3e75bb){if(_0x5336dd[_0xaf9a('0x47')]['id']){delete _0x5336dd[_0xaf9a('0x47')]['id'];}return db[_0xaf9a('0x27')][_0xaf9a('0x45')]({'where':{'id':_0x5336dd['params']['id']}})[_0xaf9a('0x40')](handleEntityNotFound(_0x3e75bb,null))[_0xaf9a('0x40')](saveUpdates(_0x5336dd[_0xaf9a('0x47')],null))['then'](respondWithResult(_0x3e75bb,null))[_0xaf9a('0x42')](handleError(_0x3e75bb,null));};exports[_0xaf9a('0x22')]=function(_0x4a80ba,_0x463b99){return db[_0xaf9a('0x27')][_0xaf9a('0x45')]({'where':{'id':_0x4a80ba[_0xaf9a('0x49')]['id']}})['then'](handleEntityNotFound(_0x463b99,null))[_0xaf9a('0x40')](removeEntity(_0x463b99,null))[_0xaf9a('0x42')](handleError(_0x463b99,null));};exports[_0xaf9a('0x4a')]=function(_0x2b38da,_0x588dd6){return db[_0xaf9a('0x27')][_0xaf9a('0x4a')]()[_0xaf9a('0x40')](respondWithResult(_0x588dd6,null))[_0xaf9a('0x42')](handleError(_0x588dd6,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index db3f8d6..e6c1efd 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 _0xeb83=['exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x30ae64,_0x3407f7){var _0x613e2a=function(_0x22e926){while(--_0x22e926){_0x30ae64['push'](_0x30ae64['shift']());}};_0x613e2a(++_0x3407f7);}(_0xeb83,0xad));var _0x3eb8=function(_0x3f7eaa,_0x547479){_0x3f7eaa=_0x3f7eaa-0x0;var _0x39e86a=_0xeb83[_0x3f7eaa];return _0x39e86a;};'use strict';var _=require(_0x3eb8('0x0'));var util=require(_0x3eb8('0x1'));var logger=require(_0x3eb8('0x2'))(_0x3eb8('0x3'));var moment=require('moment');var BPromise=require(_0x3eb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3eb8('0x5'));var rimraf=require(_0x3eb8('0x6'));var config=require(_0x3eb8('0x7'));var attributes=require(_0x3eb8('0x8'));module[_0x3eb8('0x9')]=function(_0x26bd1d,_0x3b4253){return _0x26bd1d[_0x3eb8('0xa')]('FaxTransferReport',attributes,{'tableName':_0x3eb8('0xb'),'paranoid':![],'indexes':[{'name':_0x3eb8('0xc'),'fields':[_0x3eb8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e3=['report_fax_transfer','uniqueid','../../config/logger','api','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x9f7958,_0x496d9f){var _0x53d281=function(_0x5c20de){while(--_0x5c20de){_0x9f7958['push'](_0x9f7958['shift']());}};_0x53d281(++_0x496d9f);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x2b6ecc,_0x5d90b2){_0x2b6ecc=_0x2b6ecc-0x0;var _0x2a9039=_0xd9e3[_0x2b6ecc];return _0x2a9039;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d9e('0x0'))(_0x3d9e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d9e('0x3'));var config=require(_0x3d9e('0x4'));var attributes=require(_0x3d9e('0x5'));module[_0x3d9e('0x6')]=function(_0x3b9116,_0x58c8b3){return _0x3b9116[_0x3d9e('0x7')](_0x3d9e('0x8'),attributes,{'tableName':_0x3d9e('0x9'),'paranoid':![],'indexes':[{'name':_0x3d9e('0xa'),'fields':[_0x3d9e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7aa33b3..01727a7 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 _0xffed=['code','message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x31b221,_0x308538){var _0x1ff83c=function(_0x3754cf){while(--_0x3754cf){_0x31b221['push'](_0x31b221['shift']());}};_0x1ff83c(++_0x308538);}(_0xffed,0x82));var _0xdffe=function(_0x4ae035,_0x3f592c){_0x4ae035=_0x4ae035-0x0;var _0x44c665=_0xffed[_0x4ae035];return _0x44c665;};'use strict';var _=require(_0xdffe('0x0'));var util=require(_0xdffe('0x1'));var moment=require('moment');var BPromise=require(_0xdffe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffe('0x3'));var db=require(_0xdffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffe('0x5'))(_0xdffe('0x6'));var config=require(_0xdffe('0x7'));var jayson=require(_0xdffe('0x8'));var client=jayson[_0xdffe('0x9')][_0xdffe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x537528,_0x2a40c9,_0x4658fb){return new BPromise(function(_0x1355cd,_0x4ef1b7){return client[_0xdffe('0xb')](_0x537528,_0x4658fb)['then'](function(_0x30ed64){logger['info'](_0xdffe('0xc'),_0x2a40c9,_0xdffe('0xd'));logger[_0xdffe('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2a40c9,'request\x20sent',JSON[_0xdffe('0xf')](_0x30ed64));if(_0x30ed64[_0xdffe('0x10')]){if(_0x30ed64['error'][_0xdffe('0x11')]===0x1f4){logger[_0xdffe('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x2a40c9,_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);return _0x4ef1b7(_0x30ed64['error'][_0xdffe('0x12')]);}logger[_0xdffe('0x10')](_0xdffe('0xc'),_0x2a40c9,_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);return _0x1355cd(_0x30ed64[_0xdffe('0x10')][_0xdffe('0x12')]);}else{logger[_0xdffe('0x13')](_0xdffe('0xc'),_0x2a40c9,_0xdffe('0xd'));_0x1355cd(_0x30ed64['result'][_0xdffe('0x12')]);}})[_0xdffe('0x14')](function(_0x1fe21d){logger[_0xdffe('0x10')](_0xdffe('0xc'),_0x2a40c9,_0x1fe21d);_0x4ef1b7(_0x1fe21d);});});} \ No newline at end of file +var _0x5f79=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xe76443,_0x38261b){var _0x3d3488=function(_0x5f3a3c){while(--_0x5f3a3c){_0xe76443['push'](_0xe76443['shift']());}};_0x3d3488(++_0x38261b);}(_0x5f79,0x1b8));var _0x95f7=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0x5f79[_0x2534cf];return _0x221461;};'use strict';var _=require('lodash');var util=require(_0x95f7('0x0'));var moment=require('moment');var BPromise=require(_0x95f7('0x1'));var rs=require(_0x95f7('0x2'));var fs=require('fs');var Redis=require(_0x95f7('0x3'));var db=require(_0x95f7('0x4'))['db'];var utils=require(_0x95f7('0x5'));var logger=require(_0x95f7('0x6'))(_0x95f7('0x7'));var config=require(_0x95f7('0x8'));var jayson=require(_0x95f7('0x9'));var client=jayson[_0x95f7('0xa')][_0x95f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19d7e7,_0xadaa43,_0x228d89){return new BPromise(function(_0x51b1ea,_0x34befa){return client[_0x95f7('0xc')](_0x19d7e7,_0x228d89)['then'](function(_0x4bd196){logger[_0x95f7('0xd')](_0x95f7('0xe'),_0xadaa43,_0x95f7('0xf'));logger[_0x95f7('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xadaa43,_0x95f7('0xf'),JSON[_0x95f7('0x11')](_0x4bd196));if(_0x4bd196['error']){if(_0x4bd196[_0x95f7('0x12')][_0x95f7('0x13')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xadaa43,_0x4bd196[_0x95f7('0x12')][_0x95f7('0x14')]);return _0x34befa(_0x4bd196[_0x95f7('0x12')][_0x95f7('0x14')]);}logger['error'](_0x95f7('0xe'),_0xadaa43,_0x4bd196[_0x95f7('0x12')][_0x95f7('0x14')]);return _0x51b1ea(_0x4bd196['error'][_0x95f7('0x14')]);}else{logger[_0x95f7('0xd')](_0x95f7('0xe'),_0xadaa43,'request\x20sent');_0x51b1ea(_0x4bd196[_0x95f7('0x15')][_0x95f7('0x14')]);}})[_0x95f7('0x16')](function(_0x523cdc){logger[_0x95f7('0x12')](_0x95f7('0xe'),_0xadaa43,_0x523cdc);_0x34befa(_0x523cdc);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b5cf0ed..8686bef 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 _0x713d=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x16bbd7,_0xed5042){var _0x5b99aa=function(_0x22167f){while(--_0x22167f){_0x16bbd7['push'](_0x16bbd7['shift']());}};_0x5b99aa(++_0xed5042);}(_0x713d,0x1d4));var _0xd713=function(_0x3d13b3,_0x469d9a){_0x3d13b3=_0x3d13b3-0x0;var _0x2c4d6e=_0x713d[_0x3d13b3];return _0x2c4d6e;};'use strict';var multer=require(_0xd713('0x0'));var util=require('util');var path=require(_0xd713('0x1'));var timeout=require(_0xd713('0x2'));var express=require('express');var router=express[_0xd713('0x3')]();var fs_extra=require(_0xd713('0x4'));var auth=require(_0xd713('0x5'));var interaction=require(_0xd713('0x6'));var config=require(_0xd713('0x7'));var controller=require(_0xd713('0x8'));router[_0xd713('0x9')]('/',auth[_0xd713('0xa')](),controller['index']);router[_0xd713('0x9')](_0xd713('0xb'),auth[_0xd713('0xa')](),controller[_0xd713('0xc')]);router[_0xd713('0x9')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller['show']);router[_0xd713('0xe')]('/',auth[_0xd713('0xa')](),controller[_0xd713('0xf')]);router[_0xd713('0x10')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller[_0xd713('0x11')]);router[_0xd713('0x12')](_0xd713('0xd'),auth[_0xd713('0xa')](),controller[_0xd713('0x13')]);module[_0xd713('0x14')]=router; \ No newline at end of file +var _0x40fc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x32f2b5,_0x3e7573){var _0x4acddb=function(_0x2358bb){while(--_0x2358bb){_0x32f2b5['push'](_0x32f2b5['shift']());}};_0x4acddb(++_0x3e7573);}(_0x40fc,0x1d7));var _0xc40f=function(_0x3f9ec3,_0x3dfd37){_0x3f9ec3=_0x3f9ec3-0x0;var _0xe85b13=_0x40fc[_0x3f9ec3];return _0xe85b13;};'use strict';var multer=require('multer');var util=require(_0xc40f('0x0'));var path=require('path');var timeout=require(_0xc40f('0x1'));var express=require(_0xc40f('0x2'));var router=express[_0xc40f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc40f('0x4'));var interaction=require(_0xc40f('0x5'));var config=require(_0xc40f('0x6'));var controller=require('./faxTransferReport.controller');router[_0xc40f('0x7')]('/',auth['isAuthenticated'](),controller[_0xc40f('0x8')]);router[_0xc40f('0x7')](_0xc40f('0x9'),auth[_0xc40f('0xa')](),controller['describe']);router[_0xc40f('0x7')](_0xc40f('0xb'),auth[_0xc40f('0xa')](),controller[_0xc40f('0xc')]);router[_0xc40f('0xd')]('/',auth[_0xc40f('0xa')](),controller['create']);router[_0xc40f('0xe')]('/:id',auth[_0xc40f('0xa')](),controller[_0xc40f('0xf')]);router[_0xc40f('0x10')](_0xc40f('0xb'),auth['isAuthenticated'](),controller[_0xc40f('0x11')]);module[_0xc40f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 76b8ae3..6fc70e1 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 _0x8718=['./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x59a141,_0xaf822f){var _0x39edf0=function(_0x496c81){while(--_0x496c81){_0x59a141['push'](_0x59a141['shift']());}};_0x39edf0(++_0xaf822f);}(_0x8718,0x85));var _0x8871=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x8718[_0x81e39d];return _0x548fbb;};'use strict';var multer=require('multer');var util=require(_0x8871('0x0'));var path=require(_0x8871('0x1'));var timeout=require(_0x8871('0x2'));var express=require('express');var router=express[_0x8871('0x3')]();var fs_extra=require(_0x8871('0x4'));var auth=require(_0x8871('0x5'));var interaction=require(_0x8871('0x6'));var config=require('../../config/environment');var controller=require(_0x8871('0x7'));router[_0x8871('0x8')]('/',auth[_0x8871('0x9')](),controller[_0x8871('0xa')]);router[_0x8871('0x8')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller['show']);router[_0x8871('0x8')](_0x8871('0xc'),auth[_0x8871('0x9')](),controller[_0x8871('0xd')]);router[_0x8871('0x8')](_0x8871('0xe'),auth[_0x8871('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8871('0xf')](_0x8871('0xc'),auth[_0x8871('0x9')](),controller['addConfiguration']);router[_0x8871('0x10')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller['update']);router[_0x8871('0x11')](_0x8871('0xb'),auth[_0x8871('0x9')](),controller[_0x8871('0x12')]);module[_0x8871('0x13')]=router; \ No newline at end of file +var _0x48a8=['/:id','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x440dad,_0x40dfd3){var _0x3da043=function(_0xebe3e){while(--_0xebe3e){_0x440dad['push'](_0x440dad['shift']());}};_0x3da043(++_0x40dfd3);}(_0x48a8,0x99));var _0x848a=function(_0x1a5fc5,_0x259c50){_0x1a5fc5=_0x1a5fc5-0x0;var _0xff6ed1=_0x48a8[_0x1a5fc5];return _0xff6ed1;};'use strict';var multer=require(_0x848a('0x0'));var util=require(_0x848a('0x1'));var path=require(_0x848a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x848a('0x3')]();var fs_extra=require(_0x848a('0x4'));var auth=require(_0x848a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x848a('0x6'));var controller=require('./intDeskAccount.controller');router[_0x848a('0x7')]('/',auth[_0x848a('0x8')](),controller['index']);router[_0x848a('0x7')](_0x848a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x848a('0x7')]('/:id/configurations',auth[_0x848a('0x8')](),controller['getConfigurations']);router[_0x848a('0x7')](_0x848a('0xa'),auth[_0x848a('0x8')](),controller[_0x848a('0xb')]);router[_0x848a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x848a('0xc')]('/:id/configurations',auth[_0x848a('0x8')](),controller[_0x848a('0xd')]);router[_0x848a('0xe')]('/:id',auth[_0x848a('0x8')](),controller[_0x848a('0xf')]);router['delete'](_0x848a('0x9'),auth[_0x848a('0x8')](),controller[_0x848a('0x10')]);module[_0x848a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0d18dde..11e0cfd 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 _0x73d8=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x73d8,0x1cd));var _0x873d=function(_0x480465,_0x251df6){_0x480465=_0x480465-0x0;var _0x3312c2=_0x73d8[_0x480465];return _0x3312c2;};'use strict';var Sequelize=require(_0x873d('0x0'));module[_0x873d('0x1')]={'name':{'type':Sequelize[_0x873d('0x2')]},'description':{'type':Sequelize[_0x873d('0x2')]},'username':{'type':Sequelize[_0x873d('0x2')]},'remoteUri':{'type':Sequelize[_0x873d('0x2')]},'authType':{'type':Sequelize[_0x873d('0x3')](_0x873d('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x873d('0x2')]},'token':{'type':Sequelize[_0x873d('0x2')]},'tokenSecret':{'type':Sequelize[_0x873d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x873d('0x3')](_0x873d('0x5'),_0x873d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xb2b6=['STRING','basic','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x43f869,_0x459607){var _0x239d7e=function(_0x11eea2){while(--_0x11eea2){_0x43f869['push'](_0x43f869['shift']());}};_0x239d7e(++_0x459607);}(_0xb2b6,0xd0));var _0x6b2b=function(_0x502de0,_0x1424cc){_0x502de0=_0x502de0-0x0;var _0x5b8d38=_0xb2b6[_0x502de0];return _0x5b8d38;};'use strict';var Sequelize=require(_0x6b2b('0x0'));module[_0x6b2b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6b2b('0x2')]},'username':{'type':Sequelize[_0x6b2b('0x2')]},'remoteUri':{'type':Sequelize[_0x6b2b('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x6b2b('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6b2b('0x2')]},'consumerKey':{'type':Sequelize[_0x6b2b('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6b2b('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6b2b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6b2b('0x4')](_0x6b2b('0x5'),_0x6b2b('0x6')),'defaultValue':_0x6b2b('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 43f76b4..6e9515c 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 _0xd247=['DeskConfiguration','nolimit','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','authType','username','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','password','toString','base64','concat','_embedded','statusCode','stringify','test','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','limit','undefined','offset','count','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','length','options','create','body','update','find','getConfigurations','findOne'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xd247,0x1d6));var _0x7d24=function(_0x281d23,_0x20d215){_0x281d23=_0x281d23-0x0;var _0x6b91db=_0xd247[_0x281d23];return _0x6b91db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d24('0x0'));var zipdir=require(_0x7d24('0x1'));var jsonpatch=require(_0x7d24('0x2'));var rp=require('request-promise');var moment=require(_0x7d24('0x3'));var BPromise=require(_0x7d24('0x4'));var Mustache=require(_0x7d24('0x5'));var util=require('util');var path=require(_0x7d24('0x6'));var sox=require('sox');var csv=require(_0x7d24('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d24('0x8'));var _=require(_0x7d24('0x9'));var squel=require('squel');var crypto=require(_0x7d24('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7d24('0xb'));var toCsv=require(_0x7d24('0x7'));var querystring=require(_0x7d24('0xc'));var Papa=require(_0x7d24('0xd'));var Redis=require(_0x7d24('0xe'));var authService=require(_0x7d24('0xf'));var qs=require(_0x7d24('0x10'));var as=require(_0x7d24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d24('0x12'))(_0x7d24('0x13'));var utils=require(_0x7d24('0x14'));var config=require(_0x7d24('0x15'));var licenseUtil=require(_0x7d24('0x16'));var db=require(_0x7d24('0x17'))['db'];var integrations=require(_0x7d24('0x18'));function respondWithStatusCode(_0x31e755,_0x5a6cba){_0x5a6cba=_0x5a6cba||0xcc;return function(_0x426539){if(_0x426539){return _0x31e755['sendStatus'](_0x5a6cba);}return _0x31e755[_0x7d24('0x19')](_0x5a6cba)[_0x7d24('0x1a')]();};}function respondWithResult(_0x367a74,_0x4c3064){_0x4c3064=_0x4c3064||0xc8;return function(_0x4540ba){if(_0x4540ba){return _0x367a74[_0x7d24('0x19')](_0x4c3064)['json'](_0x4540ba);}};}function respondWithFilteredResult(_0xd37e6e,_0x37001d){return function(_0x318a08){if(_0x318a08){var _0x336246=typeof _0x37001d['offset']==='undefined'&&typeof _0x37001d[_0x7d24('0x1b')]===_0x7d24('0x1c');var _0x14524a=_0x318a08['count'];var _0x1c6640=_0x336246?0x0:_0x37001d[_0x7d24('0x1d')];var _0x238615=_0x336246?_0x318a08[_0x7d24('0x1e')]:_0x37001d[_0x7d24('0x1d')]+_0x37001d['limit'];var _0x144bf0;if(_0x238615>=_0x14524a){_0x238615=_0x14524a;_0x144bf0=0xc8;}else{_0x144bf0=0xce;}_0xd37e6e[_0x7d24('0x19')](_0x144bf0);return _0xd37e6e['set'](_0x7d24('0x1f'),_0x1c6640+'-'+_0x238615+'/'+_0x14524a)[_0x7d24('0x20')](_0x318a08);}return null;};}function patchUpdates(_0x2f2937){return function(_0x27861b){try{jsonpatch[_0x7d24('0x21')](_0x27861b,_0x2f2937,!![]);}catch(_0x17497b){return BPromise[_0x7d24('0x22')](_0x17497b);}return _0x27861b['save']();};}function saveUpdates(_0x568f56,_0x46edfd){return function(_0x33a5ed){if(_0x33a5ed){return _0x33a5ed['update'](_0x568f56)[_0x7d24('0x23')](function(_0x38be44){return _0x38be44;});}return null;};}function removeEntity(_0x4dc528,_0x4cfcbb){return function(_0x55baf0){if(_0x55baf0){return _0x55baf0[_0x7d24('0x24')]()[_0x7d24('0x23')](function(){_0x4dc528['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7d4,_0x248006){return function(_0x43f9e6){if(!_0x43f9e6){_0x3e7d4[_0x7d24('0x25')](0x194);}return _0x43f9e6;};}function handleError(_0x4d730f,_0x27f759){_0x27f759=_0x27f759||0x1f4;return function(_0x46a10d){logger[_0x7d24('0x26')](_0x46a10d[_0x7d24('0x27')]);if(_0x46a10d[_0x7d24('0x28')]){delete _0x46a10d[_0x7d24('0x28')];}_0x4d730f[_0x7d24('0x19')](_0x27f759)[_0x7d24('0x29')](_0x46a10d);};}exports[_0x7d24('0x2a')]=function(_0xfd98ff,_0xaa584){var _0x478598={},_0x5bbcd5={},_0x3b5c7d={'count':0x0,'rows':[]};var _0x3cfe9d=_[_0x7d24('0x2b')](db[_0x7d24('0x2c')][_0x7d24('0x2d')],function(_0x294bbe){return{'name':_0x294bbe[_0x7d24('0x2e')],'type':_0x294bbe[_0x7d24('0x2f')]['key']};});_0x5bbcd5[_0x7d24('0x30')]=_[_0x7d24('0x2b')](_0x3cfe9d,_0x7d24('0x28'));_0x5bbcd5[_0x7d24('0x31')]=_[_0x7d24('0x32')](_0xfd98ff['query']);_0x5bbcd5[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x5bbcd5[_0x7d24('0x30')],_0x5bbcd5['query']);_0x478598['attributes']=_[_0x7d24('0x34')](_0x5bbcd5[_0x7d24('0x30')],qs['fields'](_0xfd98ff['query'][_0x7d24('0x35')]));_0x478598[_0x7d24('0x36')]=_0x478598['attributes']['length']?_0x478598[_0x7d24('0x36')]:_0x5bbcd5['model'];if(!_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x37')]('nolimit')){_0x478598['limit']=qs[_0x7d24('0x1b')](_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x1b')]);_0x478598['offset']=qs[_0x7d24('0x1d')](_0xfd98ff['query']['offset']);}_0x478598['order']=qs[_0x7d24('0x38')](_0xfd98ff[_0x7d24('0x31')]['sort']);_0x478598[_0x7d24('0x39')]=qs[_0x7d24('0x33')](_[_0x7d24('0x3a')](_0xfd98ff['query'],_0x5bbcd5['filters']),_0x3cfe9d);if(_0xfd98ff['query'][_0x7d24('0x3b')]){_0x478598[_0x7d24('0x39')]=_[_0x7d24('0x3c')](_0x478598[_0x7d24('0x39')],{'$or':_['map'](_0x3cfe9d,function(_0x1d6c18){if(_0x1d6c18[_0x7d24('0x2f')]!=='VIRTUAL'){var _0x39395c={};_0x39395c[_0x1d6c18[_0x7d24('0x28')]]={'$like':'%'+_0xfd98ff[_0x7d24('0x31')]['filter']+'%'};return _0x39395c;}})});}_0x478598=_[_0x7d24('0x3c')]({},_0x478598,_0xfd98ff['options']);var _0x4c6159={'where':_0x478598[_0x7d24('0x39')]};return db['DeskAccount'][_0x7d24('0x1e')](_0x4c6159)[_0x7d24('0x23')](function(_0xe039b){_0x3b5c7d[_0x7d24('0x1e')]=_0xe039b;if(_0xfd98ff[_0x7d24('0x31')][_0x7d24('0x3d')]){_0x478598['include']=[{'all':!![]}];}return db[_0x7d24('0x2c')][_0x7d24('0x3e')](_0x478598);})[_0x7d24('0x23')](function(_0x12ea34){_0x3b5c7d[_0x7d24('0x3f')]=_0x12ea34;return _0x3b5c7d;})[_0x7d24('0x23')](respondWithFilteredResult(_0xaa584,_0x478598))[_0x7d24('0x40')](handleError(_0xaa584,null));};exports[_0x7d24('0x41')]=function(_0x14610e,_0x180eae){var _0x116883={'raw':![],'where':{'id':_0x14610e[_0x7d24('0x42')]['id']}},_0x38df54={};_0x38df54[_0x7d24('0x30')]=_[_0x7d24('0x32')](db[_0x7d24('0x2c')][_0x7d24('0x2d')]);_0x38df54[_0x7d24('0x31')]=_[_0x7d24('0x32')](_0x14610e['query']);_0x38df54[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x38df54[_0x7d24('0x30')],_0x38df54['query']);_0x116883[_0x7d24('0x36')]=_[_0x7d24('0x34')](_0x38df54['model'],qs['fields'](_0x14610e[_0x7d24('0x31')][_0x7d24('0x35')]));_0x116883[_0x7d24('0x36')]=_0x116883[_0x7d24('0x36')][_0x7d24('0x43')]?_0x116883[_0x7d24('0x36')]:_0x38df54['model'];if(_0x14610e['query'][_0x7d24('0x3d')]){_0x116883['include']=[{'all':!![]}];}_0x116883=_[_0x7d24('0x3c')]({},_0x116883,_0x14610e[_0x7d24('0x44')]);return db[_0x7d24('0x2c')]['find'](_0x116883)[_0x7d24('0x23')](handleEntityNotFound(_0x180eae,null))[_0x7d24('0x23')](respondWithResult(_0x180eae,null))[_0x7d24('0x40')](handleError(_0x180eae,null));};exports[_0x7d24('0x45')]=function(_0x36a3b4,_0x4312fb){return db[_0x7d24('0x2c')][_0x7d24('0x45')](_0x36a3b4[_0x7d24('0x46')],{})[_0x7d24('0x23')](respondWithResult(_0x4312fb,0xc9))['catch'](handleError(_0x4312fb,null));};exports[_0x7d24('0x47')]=function(_0x5c1341,_0x2039f0){if(_0x5c1341[_0x7d24('0x46')]['id']){delete _0x5c1341[_0x7d24('0x46')]['id'];}return db[_0x7d24('0x2c')][_0x7d24('0x48')]({'where':{'id':_0x5c1341[_0x7d24('0x42')]['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x2039f0,null))[_0x7d24('0x23')](saveUpdates(_0x5c1341[_0x7d24('0x46')],null))[_0x7d24('0x23')](respondWithResult(_0x2039f0,null))[_0x7d24('0x40')](handleError(_0x2039f0,null));};exports[_0x7d24('0x24')]=function(_0x291ade,_0x82096b){return db['DeskAccount'][_0x7d24('0x48')]({'where':{'id':_0x291ade['params']['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x82096b,null))[_0x7d24('0x23')](removeEntity(_0x82096b,null))[_0x7d24('0x40')](handleError(_0x82096b,null));};exports[_0x7d24('0x49')]=function(_0x5eced7,_0x212450,_0x4a0fdb){var _0xe82d5a={};var _0x244c28={};var _0x18f598;var _0x1dce1a;return db[_0x7d24('0x2c')][_0x7d24('0x4a')]({'where':{'id':_0x5eced7['params']['id']}})[_0x7d24('0x23')](handleEntityNotFound(_0x212450,null))['then'](function(_0x4d8d25){if(_0x4d8d25){_0x18f598=_0x4d8d25;_0x244c28[_0x7d24('0x30')]=_[_0x7d24('0x32')](db[_0x7d24('0x4b')]['rawAttributes']);_0x244c28[_0x7d24('0x31')]=_['keys'](_0x5eced7['query']);_0x244c28[_0x7d24('0x33')]=_[_0x7d24('0x34')](_0x244c28[_0x7d24('0x30')],_0x244c28[_0x7d24('0x31')]);_0xe82d5a[_0x7d24('0x36')]=_[_0x7d24('0x34')](_0x244c28[_0x7d24('0x30')],qs[_0x7d24('0x35')](_0x5eced7['query'][_0x7d24('0x35')]));_0xe82d5a[_0x7d24('0x36')]=_0xe82d5a[_0x7d24('0x36')][_0x7d24('0x43')]?_0xe82d5a[_0x7d24('0x36')]:_0x244c28[_0x7d24('0x30')];_0xe82d5a['order']=qs['sort'](_0x5eced7[_0x7d24('0x31')]['sort']);_0xe82d5a[_0x7d24('0x39')]=qs[_0x7d24('0x33')](_['pick'](_0x5eced7[_0x7d24('0x31')],_0x244c28[_0x7d24('0x33')]));if(_0x5eced7[_0x7d24('0x31')][_0x7d24('0x3b')]){_0xe82d5a[_0x7d24('0x39')]=_['merge'](_0xe82d5a[_0x7d24('0x39')],{'$or':_[_0x7d24('0x2b')](_0xe82d5a['attributes'],function(_0x3fac37){var _0x3c1207={};_0x3c1207[_0x3fac37]={'$like':'%'+_0x5eced7[_0x7d24('0x31')][_0x7d24('0x3b')]+'%'};return _0x3c1207;})});}_0xe82d5a=_[_0x7d24('0x3c')]({},_0xe82d5a,_0x5eced7[_0x7d24('0x44')]);return _0x18f598['getConfigurations'](_0xe82d5a);}})[_0x7d24('0x23')](function(_0x323163){if(_0x323163){_0x1dce1a=_0x323163[_0x7d24('0x43')];if(!_0x5eced7[_0x7d24('0x31')][_0x7d24('0x37')](_0x7d24('0x4c'))){_0xe82d5a[_0x7d24('0x1b')]=qs[_0x7d24('0x1b')](_0x5eced7[_0x7d24('0x31')][_0x7d24('0x1b')]);_0xe82d5a['offset']=qs[_0x7d24('0x1d')](_0x5eced7[_0x7d24('0x31')][_0x7d24('0x1d')]);}return _0x18f598[_0x7d24('0x49')](_0xe82d5a);}})[_0x7d24('0x23')](function(_0x3da368){if(_0x3da368){return _0x3da368?{'count':_0x1dce1a,'rows':_0x3da368}:null;}})[_0x7d24('0x23')](respondWithResult(_0x212450,null))[_0x7d24('0x40')](handleError(_0x212450,null));};exports['addConfiguration']=function(_0x48ffbe,_0x5c6bc5,_0x1f9f90){if(_0x48ffbe[_0x7d24('0x46')]['id']){delete _0x48ffbe[_0x7d24('0x46')]['id'];}return db['DeskAccount'][_0x7d24('0x4a')]({'where':{'id':_0x48ffbe[_0x7d24('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c6bc5,null))[_0x7d24('0x23')](function(_0x349460){if(_0x349460){_0x48ffbe['body'][_0x7d24('0x4d')]=_0x349460['id'];_0x48ffbe['body']['Subjects']=integrations[_0x7d24('0x4e')](_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x4f')],_0x48ffbe[_0x7d24('0x46')]['type']);_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x50')]=integrations['getDescriptions'](_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x4f')],_0x48ffbe[_0x7d24('0x46')][_0x7d24('0x2f')]);return db[_0x7d24('0x4b')][_0x7d24('0x45')](_0x48ffbe[_0x7d24('0x46')],{'include':[{'model':db[_0x7d24('0x51')],'as':_0x7d24('0x52')},{'model':db[_0x7d24('0x51')],'as':'Descriptions'}]});}return null;})[_0x7d24('0x23')](respondWithResult(_0x5c6bc5,null))[_0x7d24('0x40')](handleError(_0x5c6bc5,null));};exports[_0x7d24('0x53')]=function(_0x3f3645,_0x4ad183,_0x500f80){var _0x101d23=[{'name':_0x7d24('0x54'),'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 _0x4ead29='';return db[_0x7d24('0x2c')][_0x7d24('0x4a')]({'where':{'id':_0x3f3645['params']['id']},'attributes':['id','remoteUri',_0x7d24('0x55'),_0x7d24('0x56'),'password',_0x7d24('0x57'),_0x7d24('0x58'),_0x7d24('0x59'),_0x7d24('0x5a')]})[_0x7d24('0x23')](handleEntityNotFound(_0x4ad183,null))[_0x7d24('0x23')](function(_0x2a4dbb){if(_0x2a4dbb){_0x4ead29=_0x2a4dbb[_0x7d24('0x5b')];var _0x5a86f8=_0x4ead29[_0x7d24('0x5c')](-0x1);if(_0x5a86f8==='/'){_0x4ead29=_0x4ead29['substring'](0x0,_0x4ead29[_0x7d24('0x5d')](_0x5a86f8));}var _0x5370f5={'method':'GET','uri':util[_0x7d24('0x5e')](_0x7d24('0x5f'),_0x4ead29),'headers':{'Content-Type':_0x7d24('0x60'),'Accept':_0x7d24('0x60')},'json':!![]};if(_0x2a4dbb[_0x7d24('0x55')]===_0x7d24('0x61')){_0x5370f5[_0x7d24('0x62')][_0x7d24('0x63')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0x7d24('0x64'),_0x2a4dbb['username'],_0x2a4dbb[_0x7d24('0x65')]))[_0x7d24('0x66')](_0x7d24('0x67')));}return rp(_0x5370f5)[_0x7d24('0x23')](function(_0x20cda0){return _0x101d23[_0x7d24('0x68')](_[_0x7d24('0x2b')](_0x20cda0[_0x7d24('0x69')]['entries'],function(_0x57ad5d){return{'id':_0x57ad5d[_0x7d24('0x28')],'name':_0x57ad5d[_0x7d24('0x28')],'type':_0x57ad5d[_0x7d24('0x2f')],'active':_0x57ad5d['active'],'label':_0x57ad5d['label'],'custom':!![]};}));});}})[_0x7d24('0x23')](function(_0x13c880){return{'count':_0x13c880['length'],'rows':_0x13c880};})[_0x7d24('0x23')](respondWithResult(_0x4ad183,null))[_0x7d24('0x40')](function(_0x42ac35){var _0x5c3ce4=_0x3f3645[_0x7d24('0x31')]['test']?0x1f4:_0x42ac35[_0x7d24('0x6a')]||0x1f4;logger[_0x7d24('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x7d24('0x53'),_0x5c3ce4,JSON[_0x7d24('0x6b')](_0x42ac35));delete _0x42ac35[_0x7d24('0x28')];if(_0x5c3ce4===0x191){_0x5c3ce4=0x190;}_0x4ad183[_0x7d24('0x19')](_0x5c3ce4)[_0x7d24('0x29')](_0x3f3645[_0x7d24('0x31')][_0x7d24('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x42ac35['statusCode']}:_0x42ac35);});}; \ No newline at end of file +var _0xd490=['basic','headers','format','Basic\x20%s','password','toString','base64','_embedded','entries','active','label','statusCode','error','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','apply','update','then','destroy','stack','name','send','index','map','DeskAccount','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','keys','options','find','body','params','findOne','DeskConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','create','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json'];(function(_0x20b3ca,_0x5e7793){var _0x5d095d=function(_0x2a0211){while(--_0x2a0211){_0x20b3ca['push'](_0x20b3ca['shift']());}};_0x5d095d(++_0x5e7793);}(_0xd490,0x1e8));var _0x0d49=function(_0x713911,_0x3b0667){_0x713911=_0x713911-0x0;var _0x392bb7=_0xd490[_0x713911];return _0x392bb7;};'use strict';var emlformat=require(_0x0d49('0x0'));var rimraf=require(_0x0d49('0x1'));var zipdir=require(_0x0d49('0x2'));var jsonpatch=require(_0x0d49('0x3'));var rp=require(_0x0d49('0x4'));var moment=require('moment');var BPromise=require(_0x0d49('0x5'));var Mustache=require(_0x0d49('0x6'));var util=require(_0x0d49('0x7'));var path=require(_0x0d49('0x8'));var sox=require(_0x0d49('0x9'));var csv=require(_0x0d49('0xa'));var ejs=require(_0x0d49('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d49('0xc'));var squel=require(_0x0d49('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d49('0xe'));var toCsv=require(_0x0d49('0xa'));var querystring=require(_0x0d49('0xf'));var Papa=require(_0x0d49('0x10'));var Redis=require(_0x0d49('0x11'));var authService=require(_0x0d49('0x12'));var qs=require(_0x0d49('0x13'));var as=require(_0x0d49('0x14'));var hardwareService=require(_0x0d49('0x15'));var logger=require(_0x0d49('0x16'))(_0x0d49('0x17'));var utils=require(_0x0d49('0x18'));var config=require(_0x0d49('0x19'));var licenseUtil=require(_0x0d49('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0d49('0x1b'));function respondWithStatusCode(_0x2d5b03,_0x11d14e){_0x11d14e=_0x11d14e||0xcc;return function(_0x54600e){if(_0x54600e){return _0x2d5b03[_0x0d49('0x1c')](_0x11d14e);}return _0x2d5b03[_0x0d49('0x1d')](_0x11d14e)[_0x0d49('0x1e')]();};}function respondWithResult(_0xe94943,_0x4e9d1a){_0x4e9d1a=_0x4e9d1a||0xc8;return function(_0xcd208b){if(_0xcd208b){return _0xe94943[_0x0d49('0x1d')](_0x4e9d1a)['json'](_0xcd208b);}};}function respondWithFilteredResult(_0x457f73,_0x10ccc5){return function(_0x1d6681){if(_0x1d6681){var _0x11395f=typeof _0x10ccc5[_0x0d49('0x1f')]==='undefined'&&typeof _0x10ccc5[_0x0d49('0x20')]===_0x0d49('0x21');var _0x19a50=_0x1d6681[_0x0d49('0x22')];var _0x13ed6b=_0x11395f?0x0:_0x10ccc5[_0x0d49('0x1f')];var _0x53bb11=_0x11395f?_0x1d6681['count']:_0x10ccc5[_0x0d49('0x1f')]+_0x10ccc5[_0x0d49('0x20')];var _0x94ad87;if(_0x53bb11>=_0x19a50){_0x53bb11=_0x19a50;_0x94ad87=0xc8;}else{_0x94ad87=0xce;}_0x457f73[_0x0d49('0x1d')](_0x94ad87);return _0x457f73[_0x0d49('0x23')]('Content-Range',_0x13ed6b+'-'+_0x53bb11+'/'+_0x19a50)['json'](_0x1d6681);}return null;};}function patchUpdates(_0x282b53){return function(_0x51a677){try{jsonpatch[_0x0d49('0x24')](_0x51a677,_0x282b53,!![]);}catch(_0x40f233){return BPromise['reject'](_0x40f233);}return _0x51a677['save']();};}function saveUpdates(_0x48b5c3,_0x2527de){return function(_0x529340){if(_0x529340){return _0x529340[_0x0d49('0x25')](_0x48b5c3)[_0x0d49('0x26')](function(_0x2a7d45){return _0x2a7d45;});}return null;};}function removeEntity(_0x3ca279,_0xa23a13){return function(_0x1ed35e){if(_0x1ed35e){return _0x1ed35e[_0x0d49('0x27')]()['then'](function(){_0x3ca279['status'](0xcc)[_0x0d49('0x1e')]();});}};}function handleEntityNotFound(_0xdef6,_0x341f9d){return function(_0x54200f){if(!_0x54200f){_0xdef6[_0x0d49('0x1c')](0x194);}return _0x54200f;};}function handleError(_0x239a1f,_0x5164bf){_0x5164bf=_0x5164bf||0x1f4;return function(_0xd0143f){logger['error'](_0xd0143f[_0x0d49('0x28')]);if(_0xd0143f[_0x0d49('0x29')]){delete _0xd0143f[_0x0d49('0x29')];}_0x239a1f[_0x0d49('0x1d')](_0x5164bf)[_0x0d49('0x2a')](_0xd0143f);};}exports[_0x0d49('0x2b')]=function(_0x351c96,_0x275138){var _0x1f59b5={},_0x4da4ce={},_0x5fc9d8={'count':0x0,'rows':[]};var _0x5bc408=_[_0x0d49('0x2c')](db[_0x0d49('0x2d')]['rawAttributes'],function(_0x536dfc){return{'name':_0x536dfc[_0x0d49('0x2e')],'type':_0x536dfc['type'][_0x0d49('0x2f')]};});_0x4da4ce['model']=_['map'](_0x5bc408,_0x0d49('0x29'));_0x4da4ce[_0x0d49('0x30')]=_['keys'](_0x351c96[_0x0d49('0x30')]);_0x4da4ce['filters']=_[_0x0d49('0x31')](_0x4da4ce[_0x0d49('0x32')],_0x4da4ce[_0x0d49('0x30')]);_0x1f59b5[_0x0d49('0x33')]=_[_0x0d49('0x31')](_0x4da4ce[_0x0d49('0x32')],qs[_0x0d49('0x34')](_0x351c96[_0x0d49('0x30')][_0x0d49('0x34')]));_0x1f59b5[_0x0d49('0x33')]=_0x1f59b5[_0x0d49('0x33')][_0x0d49('0x35')]?_0x1f59b5[_0x0d49('0x33')]:_0x4da4ce[_0x0d49('0x32')];if(!_0x351c96[_0x0d49('0x30')][_0x0d49('0x36')](_0x0d49('0x37'))){_0x1f59b5[_0x0d49('0x20')]=qs[_0x0d49('0x20')](_0x351c96[_0x0d49('0x30')][_0x0d49('0x20')]);_0x1f59b5[_0x0d49('0x1f')]=qs[_0x0d49('0x1f')](_0x351c96[_0x0d49('0x30')][_0x0d49('0x1f')]);}_0x1f59b5['order']=qs[_0x0d49('0x38')](_0x351c96['query']['sort']);_0x1f59b5[_0x0d49('0x39')]=qs[_0x0d49('0x3a')](_[_0x0d49('0x3b')](_0x351c96[_0x0d49('0x30')],_0x4da4ce[_0x0d49('0x3a')]),_0x5bc408);if(_0x351c96['query']['filter']){_0x1f59b5[_0x0d49('0x39')]=_[_0x0d49('0x3c')](_0x1f59b5[_0x0d49('0x39')],{'$or':_[_0x0d49('0x2c')](_0x5bc408,function(_0x1a0423){if(_0x1a0423['type']!==_0x0d49('0x3d')){var _0x4bd956={};_0x4bd956[_0x1a0423[_0x0d49('0x29')]]={'$like':'%'+_0x351c96['query'][_0x0d49('0x3e')]+'%'};return _0x4bd956;}})});}_0x1f59b5=_['merge']({},_0x1f59b5,_0x351c96['options']);var _0xd94e25={'where':_0x1f59b5[_0x0d49('0x39')]};return db[_0x0d49('0x2d')]['count'](_0xd94e25)[_0x0d49('0x26')](function(_0x4caab6){_0x5fc9d8['count']=_0x4caab6;if(_0x351c96[_0x0d49('0x30')][_0x0d49('0x3f')]){_0x1f59b5[_0x0d49('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x1f59b5);})[_0x0d49('0x26')](function(_0x542dde){_0x5fc9d8[_0x0d49('0x41')]=_0x542dde;return _0x5fc9d8;})[_0x0d49('0x26')](respondWithFilteredResult(_0x275138,_0x1f59b5))[_0x0d49('0x42')](handleError(_0x275138,null));};exports[_0x0d49('0x43')]=function(_0x5a48f9,_0x3b0753){var _0x4e47fe={'raw':![],'where':{'id':_0x5a48f9['params']['id']}},_0xeb0295={};_0xeb0295[_0x0d49('0x32')]=_['keys'](db[_0x0d49('0x2d')][_0x0d49('0x44')]);_0xeb0295[_0x0d49('0x30')]=_[_0x0d49('0x45')](_0x5a48f9[_0x0d49('0x30')]);_0xeb0295['filters']=_['intersection'](_0xeb0295[_0x0d49('0x32')],_0xeb0295[_0x0d49('0x30')]);_0x4e47fe[_0x0d49('0x33')]=_[_0x0d49('0x31')](_0xeb0295[_0x0d49('0x32')],qs['fields'](_0x5a48f9[_0x0d49('0x30')][_0x0d49('0x34')]));_0x4e47fe[_0x0d49('0x33')]=_0x4e47fe[_0x0d49('0x33')][_0x0d49('0x35')]?_0x4e47fe[_0x0d49('0x33')]:_0xeb0295[_0x0d49('0x32')];if(_0x5a48f9[_0x0d49('0x30')][_0x0d49('0x3f')]){_0x4e47fe[_0x0d49('0x40')]=[{'all':!![]}];}_0x4e47fe=_[_0x0d49('0x3c')]({},_0x4e47fe,_0x5a48f9[_0x0d49('0x46')]);return db[_0x0d49('0x2d')][_0x0d49('0x47')](_0x4e47fe)['then'](handleEntityNotFound(_0x3b0753,null))['then'](respondWithResult(_0x3b0753,null))[_0x0d49('0x42')](handleError(_0x3b0753,null));};exports['create']=function(_0x1d758d,_0x13d7d8){return db['DeskAccount']['create'](_0x1d758d[_0x0d49('0x48')],{})[_0x0d49('0x26')](respondWithResult(_0x13d7d8,0xc9))[_0x0d49('0x42')](handleError(_0x13d7d8,null));};exports[_0x0d49('0x25')]=function(_0x4e13b0,_0x43cbc7){if(_0x4e13b0[_0x0d49('0x48')]['id']){delete _0x4e13b0['body']['id'];}return db[_0x0d49('0x2d')][_0x0d49('0x47')]({'where':{'id':_0x4e13b0[_0x0d49('0x49')]['id']}})['then'](handleEntityNotFound(_0x43cbc7,null))[_0x0d49('0x26')](saveUpdates(_0x4e13b0[_0x0d49('0x48')],null))[_0x0d49('0x26')](respondWithResult(_0x43cbc7,null))['catch'](handleError(_0x43cbc7,null));};exports['destroy']=function(_0x3f507e,_0x399e1b){return db['DeskAccount']['find']({'where':{'id':_0x3f507e[_0x0d49('0x49')]['id']}})[_0x0d49('0x26')](handleEntityNotFound(_0x399e1b,null))[_0x0d49('0x26')](removeEntity(_0x399e1b,null))['catch'](handleError(_0x399e1b,null));};exports['getConfigurations']=function(_0x312318,_0x55dbc1,_0x5cc660){var _0x395243={};var _0xf364e0={};var _0x20529d;var _0x4674cb;return db[_0x0d49('0x2d')][_0x0d49('0x4a')]({'where':{'id':_0x312318[_0x0d49('0x49')]['id']}})[_0x0d49('0x26')](handleEntityNotFound(_0x55dbc1,null))[_0x0d49('0x26')](function(_0x5b5625){if(_0x5b5625){_0x20529d=_0x5b5625;_0xf364e0['model']=_[_0x0d49('0x45')](db[_0x0d49('0x4b')][_0x0d49('0x44')]);_0xf364e0[_0x0d49('0x30')]=_[_0x0d49('0x45')](_0x312318[_0x0d49('0x30')]);_0xf364e0['filters']=_['intersection'](_0xf364e0['model'],_0xf364e0['query']);_0x395243[_0x0d49('0x33')]=_[_0x0d49('0x31')](_0xf364e0['model'],qs['fields'](_0x312318['query'][_0x0d49('0x34')]));_0x395243['attributes']=_0x395243[_0x0d49('0x33')][_0x0d49('0x35')]?_0x395243[_0x0d49('0x33')]:_0xf364e0[_0x0d49('0x32')];_0x395243[_0x0d49('0x4c')]=qs['sort'](_0x312318[_0x0d49('0x30')]['sort']);_0x395243[_0x0d49('0x39')]=qs[_0x0d49('0x3a')](_['pick'](_0x312318[_0x0d49('0x30')],_0xf364e0[_0x0d49('0x3a')]));if(_0x312318[_0x0d49('0x30')][_0x0d49('0x3e')]){_0x395243['where']=_[_0x0d49('0x3c')](_0x395243[_0x0d49('0x39')],{'$or':_[_0x0d49('0x2c')](_0x395243['attributes'],function(_0x3169cf){var _0x5a5ec4={};_0x5a5ec4[_0x3169cf]={'$like':'%'+_0x312318[_0x0d49('0x30')][_0x0d49('0x3e')]+'%'};return _0x5a5ec4;})});}_0x395243=_[_0x0d49('0x3c')]({},_0x395243,_0x312318[_0x0d49('0x46')]);return _0x20529d['getConfigurations'](_0x395243);}})[_0x0d49('0x26')](function(_0x1bd295){if(_0x1bd295){_0x4674cb=_0x1bd295[_0x0d49('0x35')];if(!_0x312318[_0x0d49('0x30')]['hasOwnProperty'](_0x0d49('0x37'))){_0x395243['limit']=qs[_0x0d49('0x20')](_0x312318[_0x0d49('0x30')][_0x0d49('0x20')]);_0x395243[_0x0d49('0x1f')]=qs[_0x0d49('0x1f')](_0x312318[_0x0d49('0x30')][_0x0d49('0x1f')]);}return _0x20529d[_0x0d49('0x4d')](_0x395243);}})['then'](function(_0x4ca145){if(_0x4ca145){return _0x4ca145?{'count':_0x4674cb,'rows':_0x4ca145}:null;}})[_0x0d49('0x26')](respondWithResult(_0x55dbc1,null))[_0x0d49('0x42')](handleError(_0x55dbc1,null));};exports[_0x0d49('0x4e')]=function(_0x22e09b,_0x420612,_0x2678e1){if(_0x22e09b[_0x0d49('0x48')]['id']){delete _0x22e09b[_0x0d49('0x48')]['id'];}return db[_0x0d49('0x2d')][_0x0d49('0x4a')]({'where':{'id':_0x22e09b[_0x0d49('0x49')]['id']}})[_0x0d49('0x26')](handleEntityNotFound(_0x420612,null))[_0x0d49('0x26')](function(_0x2598bd){if(_0x2598bd){_0x22e09b[_0x0d49('0x48')][_0x0d49('0x4f')]=_0x2598bd['id'];_0x22e09b[_0x0d49('0x48')][_0x0d49('0x50')]=integrations[_0x0d49('0x51')](_0x22e09b[_0x0d49('0x48')][_0x0d49('0x52')],_0x22e09b[_0x0d49('0x48')][_0x0d49('0x53')]);_0x22e09b[_0x0d49('0x48')]['Descriptions']=integrations[_0x0d49('0x54')](_0x22e09b[_0x0d49('0x48')][_0x0d49('0x52')],_0x22e09b[_0x0d49('0x48')][_0x0d49('0x53')]);return db[_0x0d49('0x4b')][_0x0d49('0x55')](_0x22e09b['body'],{'include':[{'model':db[_0x0d49('0x56')],'as':_0x0d49('0x50')},{'model':db['DeskField'],'as':_0x0d49('0x57')}]});}return null;})['then'](respondWithResult(_0x420612,null))[_0x0d49('0x42')](handleError(_0x420612,null));};exports[_0x0d49('0x58')]=function(_0x5ddc2e,_0x530000,_0x2ba207){var _0x148c7b=[{'name':_0x0d49('0x59'),'label':_0x0d49('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 _0x4142f9='';return db[_0x0d49('0x2d')][_0x0d49('0x4a')]({'where':{'id':_0x5ddc2e['params']['id']},'attributes':['id',_0x0d49('0x5a'),_0x0d49('0x5b'),_0x0d49('0x5c'),'password','consumerKey',_0x0d49('0x5d'),_0x0d49('0x5e'),_0x0d49('0x5f')]})[_0x0d49('0x26')](handleEntityNotFound(_0x530000,null))[_0x0d49('0x26')](function(_0x2feac8){if(_0x2feac8){_0x4142f9=_0x2feac8['remoteUri'];var _0x378662=_0x4142f9[_0x0d49('0x60')](-0x1);if(_0x378662==='/'){_0x4142f9=_0x4142f9[_0x0d49('0x61')](0x0,_0x4142f9[_0x0d49('0x62')](_0x378662));}var _0x125c4f={'method':_0x0d49('0x63'),'uri':util['format'](_0x0d49('0x64'),_0x4142f9),'headers':{'Content-Type':_0x0d49('0x65'),'Accept':_0x0d49('0x65')},'json':!![]};if(_0x2feac8['authType']===_0x0d49('0x66')){_0x125c4f[_0x0d49('0x67')]['Authorization']=util[_0x0d49('0x68')](_0x0d49('0x69'),new Buffer(util['format']('%s:%s',_0x2feac8[_0x0d49('0x5c')],_0x2feac8[_0x0d49('0x6a')]))[_0x0d49('0x6b')](_0x0d49('0x6c')));}return rp(_0x125c4f)[_0x0d49('0x26')](function(_0x5e258c){return _0x148c7b['concat'](_[_0x0d49('0x2c')](_0x5e258c[_0x0d49('0x6d')][_0x0d49('0x6e')],function(_0x18a144){return{'id':_0x18a144['name'],'name':_0x18a144[_0x0d49('0x29')],'type':_0x18a144[_0x0d49('0x53')],'active':_0x18a144[_0x0d49('0x6f')],'label':_0x18a144[_0x0d49('0x70')],'custom':!![]};}));});}})[_0x0d49('0x26')](function(_0x1c880b){return{'count':_0x1c880b[_0x0d49('0x35')],'rows':_0x1c880b};})[_0x0d49('0x26')](respondWithResult(_0x530000,null))['catch'](function(_0x219cc6){var _0x41bd2b=_0x5ddc2e[_0x0d49('0x30')]['test']?0x1f4:_0x219cc6[_0x0d49('0x71')]||0x1f4;logger[_0x0d49('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x0d49('0x58'),_0x41bd2b,JSON[_0x0d49('0x73')](_0x219cc6));delete _0x219cc6[_0x0d49('0x29')];if(_0x41bd2b===0x191){_0x41bd2b=0x190;}_0x530000[_0x0d49('0x1d')](_0x41bd2b)[_0x0d49('0x2a')](_0x5ddc2e[_0x0d49('0x30')][_0x0d49('0x74')]?{'message':_0x0d49('0x75'),'statusCode':_0x219cc6[_0x0d49('0x71')]}:_0x219cc6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 09d5ec5..95468a6 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 _0xada9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x505744,_0x17f1a5){var _0x5ae88b=function(_0xe71a70){while(--_0xe71a70){_0x505744['push'](_0x505744['shift']());}};_0x5ae88b(++_0x17f1a5);}(_0xada9,0x132));var _0x9ada=function(_0x1c158c,_0x1a763d){_0x1c158c=_0x1c158c-0x0;var _0x4428a3=_0xada9[_0x1c158c];return _0x4428a3;};'use strict';var _=require(_0x9ada('0x0'));var util=require(_0x9ada('0x1'));var logger=require(_0x9ada('0x2'))('api');var moment=require(_0x9ada('0x3'));var BPromise=require(_0x9ada('0x4'));var rp=require(_0x9ada('0x5'));var fs=require('fs');var path=require(_0x9ada('0x6'));var rimraf=require(_0x9ada('0x7'));var config=require(_0x9ada('0x8'));var attributes=require(_0x9ada('0x9'));var integrations=require(_0x9ada('0xa'));module['exports']=function(_0x2d163d,_0x1ad37a){return _0x2d163d[_0x9ada('0xb')](_0x9ada('0xc'),attributes,{'tableName':_0x9ada('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0898=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x297c50,_0x448d97){var _0x36f0e1=function(_0x498b0c){while(--_0x498b0c){_0x297c50['push'](_0x297c50['shift']());}};_0x36f0e1(++_0x448d97);}(_0x0898,0x103));var _0x8089=function(_0x3a0043,_0x570e29){_0x3a0043=_0x3a0043-0x0;var _0x274eaa=_0x0898[_0x3a0043];return _0x274eaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8089('0x0'))(_0x8089('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8089('0x2'));var rimraf=require(_0x8089('0x3'));var config=require(_0x8089('0x4'));var attributes=require(_0x8089('0x5'));var integrations=require(_0x8089('0x6'));module[_0x8089('0x7')]=function(_0xcf1c8b,_0x58b7e1){return _0xcf1c8b[_0x8089('0x8')](_0x8089('0x9'),attributes,{'tableName':_0x8089('0xa'),'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 b25078c..1ce19a0 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 _0x3142=['catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowDeskAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4eb828,_0x80d55a){var _0x5ddbb3=function(_0xda3cdf){while(--_0xda3cdf){_0x4eb828['push'](_0x4eb828['shift']());}};_0x5ddbb3(++_0x80d55a);}(_0x3142,0x1a5));var _0x2314=function(_0x3a8c1b,_0x5d4e5d){_0x3a8c1b=_0x3a8c1b-0x0;var _0x2f3c39=_0x3142[_0x3a8c1b];return _0x2f3c39;};'use strict';var _=require(_0x2314('0x0'));var util=require('util');var moment=require(_0x2314('0x1'));var BPromise=require(_0x2314('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2314('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2314('0x4'));var logger=require(_0x2314('0x5'))(_0x2314('0x6'));var config=require('../../config/environment');var jayson=require(_0x2314('0x7'));var client=jayson[_0x2314('0x8')][_0x2314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc6df2d,_0x33f361,_0x428e61){return new BPromise(function(_0xcf7ef2,_0x552bcc){return client[_0x2314('0xa')](_0xc6df2d,_0x428e61)[_0x2314('0xb')](function(_0x4daf43){logger[_0x2314('0xc')](_0x2314('0xd'),_0x33f361,'request\x20sent');logger['debug'](_0x2314('0xe'),_0x33f361,_0x2314('0xf'),JSON[_0x2314('0x10')](_0x4daf43));if(_0x4daf43[_0x2314('0x11')]){if(_0x4daf43[_0x2314('0x11')][_0x2314('0x12')]===0x1f4){logger[_0x2314('0x11')]('DeskAccount,\x20%s,\x20%s',_0x33f361,_0x4daf43[_0x2314('0x11')]['message']);return _0x552bcc(_0x4daf43[_0x2314('0x11')]['message']);}logger[_0x2314('0x11')](_0x2314('0xd'),_0x33f361,_0x4daf43[_0x2314('0x11')][_0x2314('0x13')]);return _0xcf7ef2(_0x4daf43[_0x2314('0x11')]['message']);}else{logger[_0x2314('0xc')]('DeskAccount,\x20%s,\x20%s',_0x33f361,'request\x20sent');_0xcf7ef2(_0x4daf43[_0x2314('0x14')][_0x2314('0x13')]);}})[_0x2314('0x15')](function(_0x404517){logger[_0x2314('0x11')](_0x2314('0xd'),_0x33f361,_0x404517);_0x552bcc(_0x404517);});});}exports[_0x2314('0x16')]=function(_0x719ee8){var _0x557702=this;return new Promise(function(_0x4bd8e1,_0x229199){return db[_0x2314('0x17')][_0x2314('0x18')]({'raw':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')][_0x2314('0x1a')]===undefined?!![]:![]:!![],'where':_0x719ee8[_0x2314('0x19')]?_0x719ee8[_0x2314('0x19')][_0x2314('0x1b')]||null:null,'attributes':_0x719ee8['options']?_0x719ee8['options'][_0x2314('0x1c')]||null:null,'limit':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')]['limit']||null:null,'include':_0x719ee8['options']?_0x719ee8[_0x2314('0x19')]['include']?_[_0x2314('0x1d')](_0x719ee8['options'][_0x2314('0x1e')],function(_0x52bd47){return{'model':db[_0x52bd47[_0x2314('0x1f')]],'as':_0x52bd47['as'],'attributes':_0x52bd47[_0x2314('0x1c')],'include':_0x52bd47[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x52bd47['include'],function(_0x5a6b5c){return{'model':db[_0x5a6b5c[_0x2314('0x1f')]],'as':_0x5a6b5c['as'],'attributes':_0x5a6b5c['attributes'],'include':_0x5a6b5c[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x5a6b5c['include'],function(_0x163acd){return{'model':db[_0x163acd['model']],'as':_0x163acd['as'],'attributes':_0x163acd[_0x2314('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2314('0xb')](function(_0x18fa4e){logger['info'](_0x2314('0x16'),_0x719ee8);logger[_0x2314('0x20')](_0x2314('0x16'),_0x719ee8,JSON[_0x2314('0x10')](_0x18fa4e));_0x4bd8e1(_0x18fa4e);})[_0x2314('0x15')](function(_0x396949){logger[_0x2314('0x11')](_0x2314('0x16'),_0x396949[_0x2314('0x13')],_0x719ee8);_0x229199(_0x557702[_0x2314('0x11')](0x1f4,_0x396949[_0x2314('0x13')]));});});};exports[_0x2314('0x21')]=function(_0x4958b2){var _0x4fbc01=this;return new Promise(function(_0x216dec,_0x4f5114){return db[_0x2314('0x17')]['find']({'raw':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1a')]===undefined?!![]:![]:!![],'where':_0x4958b2[_0x2314('0x19')]?_0x4958b2[_0x2314('0x19')][_0x2314('0x1b')]||null:null,'attributes':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1c')]||null:null,'include':_0x4958b2['options']?_0x4958b2[_0x2314('0x19')][_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x4958b2[_0x2314('0x19')][_0x2314('0x1e')],function(_0x25b47e){return{'model':db[_0x25b47e[_0x2314('0x1f')]],'as':_0x25b47e['as'],'attributes':_0x25b47e[_0x2314('0x1c')],'include':_0x25b47e[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0x25b47e['include'],function(_0xcc51cd){return{'model':db[_0xcc51cd[_0x2314('0x1f')]],'as':_0xcc51cd['as'],'attributes':_0xcc51cd[_0x2314('0x1c')],'include':_0xcc51cd[_0x2314('0x1e')]?_[_0x2314('0x1d')](_0xcc51cd[_0x2314('0x1e')],function(_0x4362c2){return{'model':db[_0x4362c2[_0x2314('0x1f')]],'as':_0x4362c2['as'],'attributes':_0x4362c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x2314('0xb')](function(_0x3c754f){logger['info']('ShowDeskAccount',_0x4958b2);logger['debug'](_0x2314('0x21'),_0x4958b2,JSON[_0x2314('0x10')](_0x3c754f));_0x216dec(_0x3c754f);})['catch'](function(_0x3f9d09){logger[_0x2314('0x11')](_0x2314('0x21'),_0x3f9d09[_0x2314('0x13')],_0x4958b2);_0x4f5114(_0x4fbc01[_0x2314('0x11')](0x1f4,_0x3f9d09[_0x2314('0x13')]));});});}; \ No newline at end of file +var _0x1e8d=['attributes','limit','include','map','model','debug','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where'];(function(_0xb2fcbd,_0x5bfcfd){var _0x253dca=function(_0x3ae685){while(--_0x3ae685){_0xb2fcbd['push'](_0xb2fcbd['shift']());}};_0x253dca(++_0x5bfcfd);}(_0x1e8d,0x17a));var _0xd1e8=function(_0x29a0ee,_0x1e56cf){_0x29a0ee=_0x29a0ee-0x0;var _0x91dc2a=_0x1e8d[_0x29a0ee];return _0x91dc2a;};'use strict';var _=require(_0xd1e8('0x0'));var util=require(_0xd1e8('0x1'));var moment=require(_0xd1e8('0x2'));var BPromise=require(_0xd1e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e8('0x4'));var db=require(_0xd1e8('0x5'))['db'];var utils=require(_0xd1e8('0x6'));var logger=require(_0xd1e8('0x7'))(_0xd1e8('0x8'));var config=require(_0xd1e8('0x9'));var jayson=require(_0xd1e8('0xa'));var client=jayson['client'][_0xd1e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1208c1,_0x1fd72c,_0x1f8dd6){return new BPromise(function(_0x149e09,_0x278e3b){return client[_0xd1e8('0xc')](_0x1208c1,_0x1f8dd6)[_0xd1e8('0xd')](function(_0x296266){logger[_0xd1e8('0xe')](_0xd1e8('0xf'),_0x1fd72c,_0xd1e8('0x10'));logger['debug'](_0xd1e8('0x11'),_0x1fd72c,'request\x20sent',JSON[_0xd1e8('0x12')](_0x296266));if(_0x296266[_0xd1e8('0x13')]){if(_0x296266['error']['code']===0x1f4){logger[_0xd1e8('0x13')](_0xd1e8('0xf'),_0x1fd72c,_0x296266['error']['message']);return _0x278e3b(_0x296266[_0xd1e8('0x13')][_0xd1e8('0x14')]);}logger[_0xd1e8('0x13')]('DeskAccount,\x20%s,\x20%s',_0x1fd72c,_0x296266[_0xd1e8('0x13')][_0xd1e8('0x14')]);return _0x149e09(_0x296266[_0xd1e8('0x13')]['message']);}else{logger[_0xd1e8('0xe')](_0xd1e8('0xf'),_0x1fd72c,_0xd1e8('0x10'));_0x149e09(_0x296266[_0xd1e8('0x15')][_0xd1e8('0x14')]);}})[_0xd1e8('0x16')](function(_0x5d9845){logger[_0xd1e8('0x13')](_0xd1e8('0xf'),_0x1fd72c,_0x5d9845);_0x278e3b(_0x5d9845);});});}exports[_0xd1e8('0x17')]=function(_0x480ff1){var _0x29365d=this;return new Promise(function(_0x2cec20,_0x31478a){return db[_0xd1e8('0x18')][_0xd1e8('0x19')]({'raw':_0x480ff1['options']?_0x480ff1['options'][_0xd1e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x480ff1[_0xd1e8('0x1b')]?_0x480ff1[_0xd1e8('0x1b')][_0xd1e8('0x1c')]||null:null,'attributes':_0x480ff1[_0xd1e8('0x1b')]?_0x480ff1['options'][_0xd1e8('0x1d')]||null:null,'limit':_0x480ff1[_0xd1e8('0x1b')]?_0x480ff1['options'][_0xd1e8('0x1e')]||null:null,'include':_0x480ff1[_0xd1e8('0x1b')]?_0x480ff1[_0xd1e8('0x1b')][_0xd1e8('0x1f')]?_[_0xd1e8('0x20')](_0x480ff1[_0xd1e8('0x1b')]['include'],function(_0x1dc21f){return{'model':db[_0x1dc21f['model']],'as':_0x1dc21f['as'],'attributes':_0x1dc21f[_0xd1e8('0x1d')],'include':_0x1dc21f['include']?_['map'](_0x1dc21f['include'],function(_0x5f4a32){return{'model':db[_0x5f4a32[_0xd1e8('0x21')]],'as':_0x5f4a32['as'],'attributes':_0x5f4a32['attributes'],'include':_0x5f4a32[_0xd1e8('0x1f')]?_[_0xd1e8('0x20')](_0x5f4a32['include'],function(_0x3f2a1c){return{'model':db[_0x3f2a1c[_0xd1e8('0x21')]],'as':_0x3f2a1c['as'],'attributes':_0x3f2a1c[_0xd1e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1e8('0xd')](function(_0x1d5dcf){logger[_0xd1e8('0xe')](_0xd1e8('0x17'),_0x480ff1);logger[_0xd1e8('0x22')](_0xd1e8('0x17'),_0x480ff1,JSON[_0xd1e8('0x12')](_0x1d5dcf));_0x2cec20(_0x1d5dcf);})[_0xd1e8('0x16')](function(_0x1916a7){logger[_0xd1e8('0x13')](_0xd1e8('0x17'),_0x1916a7[_0xd1e8('0x14')],_0x480ff1);_0x31478a(_0x29365d[_0xd1e8('0x13')](0x1f4,_0x1916a7[_0xd1e8('0x14')]));});});};exports[_0xd1e8('0x23')]=function(_0x1b8297){var _0x13bbb6=this;return new Promise(function(_0x410b9a,_0x1c8c1d){return db[_0xd1e8('0x18')][_0xd1e8('0x24')]({'raw':_0x1b8297[_0xd1e8('0x1b')]?_0x1b8297[_0xd1e8('0x1b')][_0xd1e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b8297['options']?_0x1b8297[_0xd1e8('0x1b')][_0xd1e8('0x1c')]||null:null,'attributes':_0x1b8297[_0xd1e8('0x1b')]?_0x1b8297[_0xd1e8('0x1b')]['attributes']||null:null,'include':_0x1b8297[_0xd1e8('0x1b')]?_0x1b8297[_0xd1e8('0x1b')][_0xd1e8('0x1f')]?_[_0xd1e8('0x20')](_0x1b8297[_0xd1e8('0x1b')]['include'],function(_0x13da5d){return{'model':db[_0x13da5d[_0xd1e8('0x21')]],'as':_0x13da5d['as'],'attributes':_0x13da5d['attributes'],'include':_0x13da5d['include']?_[_0xd1e8('0x20')](_0x13da5d['include'],function(_0x4ff2b0){return{'model':db[_0x4ff2b0[_0xd1e8('0x21')]],'as':_0x4ff2b0['as'],'attributes':_0x4ff2b0[_0xd1e8('0x1d')],'include':_0x4ff2b0[_0xd1e8('0x1f')]?_[_0xd1e8('0x20')](_0x4ff2b0[_0xd1e8('0x1f')],function(_0x2f3b6a){return{'model':db[_0x2f3b6a['model']],'as':_0x2f3b6a['as'],'attributes':_0x2f3b6a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1e8('0xd')](function(_0x110478){logger[_0xd1e8('0xe')](_0xd1e8('0x23'),_0x1b8297);logger[_0xd1e8('0x22')](_0xd1e8('0x23'),_0x1b8297,JSON[_0xd1e8('0x12')](_0x110478));_0x410b9a(_0x110478);})[_0xd1e8('0x16')](function(_0x3e98fc){logger[_0xd1e8('0x13')](_0xd1e8('0x23'),_0x3e98fc['message'],_0x1b8297);_0x1c8c1d(_0x13bbb6[_0xd1e8('0x13')](0x1f4,_0x3e98fc['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3a6e765..7a0ec1b 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x397d92,_0x109651){var _0xc40251=function(_0x136056){while(--_0x136056){_0x397d92['push'](_0x397d92['shift']());}};_0xc40251(++_0x109651);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x2c210f,_0x4d8458){var _0x515f7a=function(_0x112a31){while(--_0x112a31){_0x2c210f['push'](_0x2c210f['shift']());}};_0x515f7a(++_0x4d8458);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f4cdf3c..a8fb425 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 _0xfdfd=['sequelize','exports','STRING'];(function(_0x5130aa,_0x441b77){var _0x125ec6=function(_0x4d3bf2){while(--_0x4d3bf2){_0x5130aa['push'](_0x5130aa['shift']());}};_0x125ec6(++_0x441b77);}(_0xfdfd,0xfc));var _0xdfdf=function(_0x1ab203,_0x156141){_0x1ab203=_0x1ab203-0x0;var _0x1ebe2a=_0xfdfd[_0x1ab203];return _0x1ebe2a;};'use strict';var Sequelize=require(_0xdfdf('0x0'));module[_0xdfdf('0x1')]={'name':{'type':Sequelize[_0xdfdf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xefba=['sequelize','exports','STRING'];(function(_0x2e68e6,_0x119e37){var _0x32b8f6=function(_0x561d75){while(--_0x561d75){_0x2e68e6['push'](_0x2e68e6['shift']());}};_0x32b8f6(++_0x119e37);}(_0xefba,0x8a));var _0xaefb=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0xefba[_0x46d14b];return _0x367dfd;};'use strict';var Sequelize=require(_0xaefb('0x0'));module[_0xaefb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaefb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5c900eb..0b9dac5 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 _0xa4c8=['findAll','rows','catch','show','params','length','find','create','update','body','destroy','getFields','getSubjects','findOne','DeskField','hasOwnProperty','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0xa4c8,0x1b3));var _0x8a4c=function(_0x4ad937,_0x3b1001){_0x4ad937=_0x4ad937-0x0;var _0x360227=_0xa4c8[_0x4ad937];return _0x360227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a4c('0x0'));var zipdir=require(_0x8a4c('0x1'));var jsonpatch=require(_0x8a4c('0x2'));var rp=require(_0x8a4c('0x3'));var moment=require(_0x8a4c('0x4'));var BPromise=require(_0x8a4c('0x5'));var Mustache=require(_0x8a4c('0x6'));var util=require(_0x8a4c('0x7'));var path=require(_0x8a4c('0x8'));var sox=require('sox');var csv=require(_0x8a4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a4c('0xa'));var squel=require('squel');var crypto=require(_0x8a4c('0xb'));var jsforce=require(_0x8a4c('0xc'));var deskjs=require(_0x8a4c('0xd'));var toCsv=require(_0x8a4c('0x9'));var querystring=require(_0x8a4c('0xe'));var Papa=require(_0x8a4c('0xf'));var Redis=require(_0x8a4c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a4c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a4c('0x12'))(_0x8a4c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a4c('0x14'))['db'];function respondWithStatusCode(_0x303d14,_0x39348f){_0x39348f=_0x39348f||0xcc;return function(_0x106ea3){if(_0x106ea3){return _0x303d14[_0x8a4c('0x15')](_0x39348f);}return _0x303d14[_0x8a4c('0x16')](_0x39348f)[_0x8a4c('0x17')]();};}function respondWithResult(_0x3996ff,_0x499d3d){_0x499d3d=_0x499d3d||0xc8;return function(_0x2ea960){if(_0x2ea960){return _0x3996ff[_0x8a4c('0x16')](_0x499d3d)[_0x8a4c('0x18')](_0x2ea960);}};}function respondWithFilteredResult(_0x4acf61,_0x1ebf52){return function(_0x32748b){if(_0x32748b){var _0x7754da=typeof _0x1ebf52[_0x8a4c('0x19')]===_0x8a4c('0x1a')&&typeof _0x1ebf52[_0x8a4c('0x1b')]===_0x8a4c('0x1a');var _0x427680=_0x32748b[_0x8a4c('0x1c')];var _0x254f64=_0x7754da?0x0:_0x1ebf52[_0x8a4c('0x19')];var _0x327f65=_0x7754da?_0x32748b[_0x8a4c('0x1c')]:_0x1ebf52[_0x8a4c('0x19')]+_0x1ebf52[_0x8a4c('0x1b')];var _0x3e8c4f;if(_0x327f65>=_0x427680){_0x327f65=_0x427680;_0x3e8c4f=0xc8;}else{_0x3e8c4f=0xce;}_0x4acf61[_0x8a4c('0x16')](_0x3e8c4f);return _0x4acf61[_0x8a4c('0x1d')](_0x8a4c('0x1e'),_0x254f64+'-'+_0x327f65+'/'+_0x427680)[_0x8a4c('0x18')](_0x32748b);}return null;};}function patchUpdates(_0x44d8a6){return function(_0x30c609){try{jsonpatch[_0x8a4c('0x1f')](_0x30c609,_0x44d8a6,!![]);}catch(_0x169e80){return BPromise[_0x8a4c('0x20')](_0x169e80);}return _0x30c609[_0x8a4c('0x21')]();};}function saveUpdates(_0xf7eb65,_0x1367ca){return function(_0x599cee){if(_0x599cee){return _0x599cee['update'](_0xf7eb65)[_0x8a4c('0x22')](function(_0x58ce09){return _0x58ce09;});}return null;};}function removeEntity(_0x40df03,_0x11ef64){return function(_0x26cfaa){if(_0x26cfaa){return _0x26cfaa['destroy']()[_0x8a4c('0x22')](function(){_0x40df03[_0x8a4c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22c84b,_0x2122e2){return function(_0x402547){if(!_0x402547){_0x22c84b['sendStatus'](0x194);}return _0x402547;};}function handleError(_0x36931c,_0x1f7b9a){_0x1f7b9a=_0x1f7b9a||0x1f4;return function(_0x4a218e){logger[_0x8a4c('0x23')](_0x4a218e['stack']);if(_0x4a218e['name']){delete _0x4a218e[_0x8a4c('0x24')];}_0x36931c[_0x8a4c('0x16')](_0x1f7b9a)[_0x8a4c('0x25')](_0x4a218e);};}exports[_0x8a4c('0x26')]=function(_0x39e039,_0x597b23){var _0x3cd626={},_0x2a220d={},_0x3b6d1f={'count':0x0,'rows':[]};var _0x221cd4=_[_0x8a4c('0x27')](db[_0x8a4c('0x28')][_0x8a4c('0x29')],function(_0x56099d){return{'name':_0x56099d[_0x8a4c('0x2a')],'type':_0x56099d[_0x8a4c('0x2b')][_0x8a4c('0x2c')]};});_0x2a220d[_0x8a4c('0x2d')]=_[_0x8a4c('0x27')](_0x221cd4,'name');_0x2a220d[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x39e039[_0x8a4c('0x2e')]);_0x2a220d[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x2a220d[_0x8a4c('0x2d')],_0x2a220d[_0x8a4c('0x2e')]);_0x3cd626[_0x8a4c('0x32')]=_['intersection'](_0x2a220d['model'],qs[_0x8a4c('0x33')](_0x39e039[_0x8a4c('0x2e')]['fields']));_0x3cd626['attributes']=_0x3cd626['attributes']['length']?_0x3cd626[_0x8a4c('0x32')]:_0x2a220d[_0x8a4c('0x2d')];if(!_0x39e039['query']['hasOwnProperty'](_0x8a4c('0x34'))){_0x3cd626[_0x8a4c('0x1b')]=qs['limit'](_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x3cd626[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}_0x3cd626[_0x8a4c('0x35')]=qs['sort'](_0x39e039['query'][_0x8a4c('0x36')]);_0x3cd626[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x39e039['query'],_0x2a220d['filters']),_0x221cd4);if(_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x3cd626[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x3cd626[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x221cd4,function(_0x248bcf){if(_0x248bcf[_0x8a4c('0x2b')]!==_0x8a4c('0x3b')){var _0x33cb4d={};_0x33cb4d[_0x248bcf[_0x8a4c('0x24')]]={'$like':'%'+_0x39e039['query']['filter']+'%'};return _0x33cb4d;}})});}_0x3cd626=_['merge']({},_0x3cd626,_0x39e039[_0x8a4c('0x3c')]);var _0x5a0dfa={'where':_0x3cd626[_0x8a4c('0x37')]};return db[_0x8a4c('0x28')]['count'](_0x5a0dfa)[_0x8a4c('0x22')](function(_0x19c481){_0x3b6d1f[_0x8a4c('0x1c')]=_0x19c481;if(_0x39e039[_0x8a4c('0x2e')][_0x8a4c('0x3d')]){_0x3cd626[_0x8a4c('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x8a4c('0x3f')](_0x3cd626);})[_0x8a4c('0x22')](function(_0x5e29aa){_0x3b6d1f[_0x8a4c('0x40')]=_0x5e29aa;return _0x3b6d1f;})[_0x8a4c('0x22')](respondWithFilteredResult(_0x597b23,_0x3cd626))[_0x8a4c('0x41')](handleError(_0x597b23,null));};exports[_0x8a4c('0x42')]=function(_0x9792bd,_0x5af459){var _0x162dc7={'raw':![],'where':{'id':_0x9792bd[_0x8a4c('0x43')]['id']}},_0x38f8c4={};_0x38f8c4['model']=_[_0x8a4c('0x2f')](db[_0x8a4c('0x28')][_0x8a4c('0x29')]);_0x38f8c4[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x9792bd[_0x8a4c('0x2e')]);_0x38f8c4[_0x8a4c('0x30')]=_['intersection'](_0x38f8c4[_0x8a4c('0x2d')],_0x38f8c4[_0x8a4c('0x2e')]);_0x162dc7['attributes']=_['intersection'](_0x38f8c4[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x9792bd[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x162dc7[_0x8a4c('0x32')]=_0x162dc7[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x162dc7[_0x8a4c('0x32')]:_0x38f8c4['model'];if(_0x9792bd['query'][_0x8a4c('0x3d')]){_0x162dc7['include']=[{'all':!![]}];}_0x162dc7=_[_0x8a4c('0x3a')]({},_0x162dc7,_0x9792bd['options']);return db[_0x8a4c('0x28')][_0x8a4c('0x45')](_0x162dc7)[_0x8a4c('0x22')](handleEntityNotFound(_0x5af459,null))[_0x8a4c('0x22')](respondWithResult(_0x5af459,null))['catch'](handleError(_0x5af459,null));};exports['create']=function(_0x1336c2,_0x2358d5){return db[_0x8a4c('0x28')][_0x8a4c('0x46')](_0x1336c2['body'],{})[_0x8a4c('0x22')](respondWithResult(_0x2358d5,0xc9))[_0x8a4c('0x41')](handleError(_0x2358d5,null));};exports[_0x8a4c('0x47')]=function(_0x5c7607,_0x2cef56){if(_0x5c7607[_0x8a4c('0x48')]['id']){delete _0x5c7607['body']['id'];}return db[_0x8a4c('0x28')][_0x8a4c('0x45')]({'where':{'id':_0x5c7607[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2cef56,null))[_0x8a4c('0x22')](saveUpdates(_0x5c7607[_0x8a4c('0x48')],null))['then'](respondWithResult(_0x2cef56,null))['catch'](handleError(_0x2cef56,null));};exports[_0x8a4c('0x49')]=function(_0x115ea8,_0x2d066b){return db['DeskConfiguration'][_0x8a4c('0x45')]({'where':{'id':_0x115ea8[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2d066b,null))['then'](removeEntity(_0x2d066b,null))['catch'](handleError(_0x2d066b,null));};exports[_0x8a4c('0x4a')]=function(_0x837690,_0x5dab9b,_0x4dec98){var _0x1eac28={};var _0x24cde1={};var _0x3a8b0b;var _0x1caec4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x837690[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x5dab9b,null))[_0x8a4c('0x22')](function(_0x412a3c){if(_0x412a3c){_0x3a8b0b=_0x412a3c;_0x24cde1[_0x8a4c('0x2d')]=_[_0x8a4c('0x2f')](db['DeskField'][_0x8a4c('0x29')]);_0x24cde1[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x837690[_0x8a4c('0x2e')]);_0x24cde1['filters']=_[_0x8a4c('0x31')](_0x24cde1['model'],_0x24cde1[_0x8a4c('0x2e')]);_0x1eac28[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x24cde1[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x1eac28[_0x8a4c('0x32')]=_0x1eac28[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x1eac28['attributes']:_0x24cde1['model'];_0x1eac28[_0x8a4c('0x35')]=qs['sort'](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x1eac28[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x837690[_0x8a4c('0x2e')],_0x24cde1['filters']));if(_0x837690[_0x8a4c('0x2e')]['filter']){_0x1eac28[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x1eac28['where'],{'$or':_[_0x8a4c('0x27')](_0x1eac28[_0x8a4c('0x32')],function(_0x5db9ff){var _0x59ae9b={};_0x59ae9b[_0x5db9ff]={'$like':'%'+_0x837690['query']['filter']+'%'};return _0x59ae9b;})});}_0x1eac28=_[_0x8a4c('0x3a')]({},_0x1eac28,_0x837690[_0x8a4c('0x3c')]);return _0x3a8b0b['getFields'](_0x1eac28);}})[_0x8a4c('0x22')](function(_0xcd1558){if(_0xcd1558){_0x1caec4=_0xcd1558['length'];if(!_0x837690[_0x8a4c('0x2e')]['hasOwnProperty'](_0x8a4c('0x34'))){_0x1eac28[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x1eac28[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x837690[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0x3a8b0b[_0x8a4c('0x4a')](_0x1eac28);}})[_0x8a4c('0x22')](function(_0x52420b){if(_0x52420b){return _0x52420b?{'count':_0x1caec4,'rows':_0x52420b}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x5dab9b,null))['catch'](handleError(_0x5dab9b,null));};exports[_0x8a4c('0x4b')]=function(_0x113039,_0xee5b02,_0xb6ed6a){var _0x27ec60={};var _0x39e575={};var _0x1cb565;var _0x3c0da6;return db[_0x8a4c('0x28')][_0x8a4c('0x4c')]({'where':{'id':_0x113039['params']['id']}})['then'](handleEntityNotFound(_0xee5b02,null))[_0x8a4c('0x22')](function(_0xd6067b){if(_0xd6067b){_0x1cb565=_0xd6067b;_0x39e575['model']=_['keys'](db[_0x8a4c('0x4d')][_0x8a4c('0x29')]);_0x39e575['query']=_[_0x8a4c('0x2f')](_0x113039[_0x8a4c('0x2e')]);_0x39e575['filters']=_[_0x8a4c('0x31')](_0x39e575[_0x8a4c('0x2d')],_0x39e575[_0x8a4c('0x2e')]);_0x27ec60[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x39e575['model'],qs[_0x8a4c('0x33')](_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x33')]));_0x27ec60[_0x8a4c('0x32')]=_0x27ec60[_0x8a4c('0x32')][_0x8a4c('0x44')]?_0x27ec60['attributes']:_0x39e575['model'];_0x27ec60[_0x8a4c('0x35')]=qs[_0x8a4c('0x36')](_0x113039['query'][_0x8a4c('0x36')]);_0x27ec60[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_[_0x8a4c('0x38')](_0x113039[_0x8a4c('0x2e')],_0x39e575[_0x8a4c('0x30')]));if(_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x27ec60[_0x8a4c('0x37')]=_['merge'](_0x27ec60[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x27ec60['attributes'],function(_0x4d7ed4){var _0x4d81f9={};_0x4d81f9[_0x4d7ed4]={'$like':'%'+_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x39')]+'%'};return _0x4d81f9;})});}_0x27ec60=_[_0x8a4c('0x3a')]({},_0x27ec60,_0x113039[_0x8a4c('0x3c')]);return _0x1cb565[_0x8a4c('0x4b')](_0x27ec60);}})[_0x8a4c('0x22')](function(_0x380ae5){if(_0x380ae5){_0x3c0da6=_0x380ae5['length'];if(!_0x113039[_0x8a4c('0x2e')][_0x8a4c('0x4e')](_0x8a4c('0x34'))){_0x27ec60[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x113039['query'][_0x8a4c('0x1b')]);_0x27ec60[_0x8a4c('0x19')]=qs['offset'](_0x113039[_0x8a4c('0x2e')]['offset']);}return _0x1cb565[_0x8a4c('0x4b')](_0x27ec60);}})[_0x8a4c('0x22')](function(_0x3b149c){if(_0x3b149c){return _0x3b149c?{'count':_0x3c0da6,'rows':_0x3b149c}:null;}})[_0x8a4c('0x22')](respondWithResult(_0xee5b02,null))['catch'](handleError(_0xee5b02,null));};exports['getDescriptions']=function(_0x95a404,_0x45d112,_0x3f07d6){var _0x4c146e={};var _0x2d0fc9={};var _0xc2506c;var _0x17d30e;return db['DeskConfiguration']['findOne']({'where':{'id':_0x95a404[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x45d112,null))[_0x8a4c('0x22')](function(_0x311139){if(_0x311139){_0xc2506c=_0x311139;_0x2d0fc9[_0x8a4c('0x2d')]=_[_0x8a4c('0x2f')](db['DeskField'][_0x8a4c('0x29')]);_0x2d0fc9[_0x8a4c('0x2e')]=_[_0x8a4c('0x2f')](_0x95a404[_0x8a4c('0x2e')]);_0x2d0fc9[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x2d0fc9['model'],_0x2d0fc9[_0x8a4c('0x2e')]);_0x4c146e[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x2d0fc9[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x95a404[_0x8a4c('0x2e')]['fields']));_0x4c146e[_0x8a4c('0x32')]=_0x4c146e['attributes'][_0x8a4c('0x44')]?_0x4c146e[_0x8a4c('0x32')]:_0x2d0fc9['model'];_0x4c146e[_0x8a4c('0x35')]=qs[_0x8a4c('0x36')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x4c146e['where']=qs['filters'](_[_0x8a4c('0x38')](_0x95a404[_0x8a4c('0x2e')],_0x2d0fc9[_0x8a4c('0x30')]));if(_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x4c146e[_0x8a4c('0x37')]=_[_0x8a4c('0x3a')](_0x4c146e['where'],{'$or':_['map'](_0x4c146e[_0x8a4c('0x32')],function(_0x4c10b2){var _0x26af75={};_0x26af75[_0x4c10b2]={'$like':'%'+_0x95a404['query'][_0x8a4c('0x39')]+'%'};return _0x26af75;})});}_0x4c146e=_[_0x8a4c('0x3a')]({},_0x4c146e,_0x95a404['options']);return _0xc2506c[_0x8a4c('0x4f')](_0x4c146e);}})[_0x8a4c('0x22')](function(_0x28eb7b){if(_0x28eb7b){_0x17d30e=_0x28eb7b[_0x8a4c('0x44')];if(!_0x95a404['query'][_0x8a4c('0x4e')]('nolimit')){_0x4c146e[_0x8a4c('0x1b')]=qs[_0x8a4c('0x1b')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x1b')]);_0x4c146e[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x95a404[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0xc2506c[_0x8a4c('0x4f')](_0x4c146e);}})[_0x8a4c('0x22')](function(_0x593831){if(_0x593831){return _0x593831?{'count':_0x17d30e,'rows':_0x593831}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x45d112,null))[_0x8a4c('0x41')](handleError(_0x45d112,null));};exports['getTags']=function(_0x3a412e,_0x25e8ab,_0x4f35b6){var _0x1cdf81={};var _0x273d44={};var _0x36f92a;var _0x368ea5;return db[_0x8a4c('0x28')][_0x8a4c('0x4c')]({'where':{'id':_0x3a412e[_0x8a4c('0x43')]['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x25e8ab,null))[_0x8a4c('0x22')](function(_0x340d82){if(_0x340d82){_0x36f92a=_0x340d82;_0x273d44[_0x8a4c('0x2d')]=_['keys'](db['Tag'][_0x8a4c('0x29')]);_0x273d44['query']=_['keys'](_0x3a412e[_0x8a4c('0x2e')]);_0x273d44[_0x8a4c('0x30')]=_[_0x8a4c('0x31')](_0x273d44[_0x8a4c('0x2d')],_0x273d44['query']);_0x1cdf81[_0x8a4c('0x32')]=_[_0x8a4c('0x31')](_0x273d44[_0x8a4c('0x2d')],qs[_0x8a4c('0x33')](_0x3a412e['query'][_0x8a4c('0x33')]));_0x1cdf81[_0x8a4c('0x32')]=_0x1cdf81['attributes'][_0x8a4c('0x44')]?_0x1cdf81['attributes']:_0x273d44[_0x8a4c('0x2d')];_0x1cdf81['order']=qs[_0x8a4c('0x36')](_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x36')]);_0x1cdf81[_0x8a4c('0x37')]=qs[_0x8a4c('0x30')](_['pick'](_0x3a412e['query'],_0x273d44[_0x8a4c('0x30')]));if(_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x39')]){_0x1cdf81[_0x8a4c('0x37')]=_['merge'](_0x1cdf81[_0x8a4c('0x37')],{'$or':_[_0x8a4c('0x27')](_0x1cdf81[_0x8a4c('0x32')],function(_0xe5fff4){var _0x2acf44={};_0x2acf44[_0xe5fff4]={'$like':'%'+_0x3a412e['query'][_0x8a4c('0x39')]+'%'};return _0x2acf44;})});}_0x1cdf81=_['merge']({},_0x1cdf81,_0x3a412e[_0x8a4c('0x3c')]);return _0x36f92a['getTags'](_0x1cdf81);}})[_0x8a4c('0x22')](function(_0x41d5c2){if(_0x41d5c2){_0x368ea5=_0x41d5c2[_0x8a4c('0x44')];if(!_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x4e')](_0x8a4c('0x34'))){_0x1cdf81['limit']=qs[_0x8a4c('0x1b')](_0x3a412e['query'][_0x8a4c('0x1b')]);_0x1cdf81[_0x8a4c('0x19')]=qs[_0x8a4c('0x19')](_0x3a412e[_0x8a4c('0x2e')][_0x8a4c('0x19')]);}return _0x36f92a[_0x8a4c('0x50')](_0x1cdf81);}})[_0x8a4c('0x22')](function(_0x3f32c3){if(_0x3f32c3){return _0x3f32c3?{'count':_0x368ea5,'rows':_0x3f32c3}:null;}})[_0x8a4c('0x22')](respondWithResult(_0x25e8ab,null))[_0x8a4c('0x41')](handleError(_0x25e8ab,null));};exports[_0x8a4c('0x51')]=function(_0x46acd6,_0x2df235,_0x45c73f){if(_0x46acd6[_0x8a4c('0x48')]['id']){delete _0x46acd6[_0x8a4c('0x48')]['id'];}return db['DeskConfiguration'][_0x8a4c('0x4c')]({'where':{'id':_0x46acd6['params']['id']}})[_0x8a4c('0x22')](handleEntityNotFound(_0x2df235,null))[_0x8a4c('0x22')](function(_0x21ce00){if(_0x21ce00){return _0x21ce00[_0x8a4c('0x51')](_0x46acd6[_0x8a4c('0x48')][_0x8a4c('0x52')]||[]);}return null;})[_0x8a4c('0x22')](respondWithResult(_0x2df235,null))['catch'](handleError(_0x2df235,null));}; \ No newline at end of file +var _0x8891=['getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','show','params','options','find','catch','create','body','getFields','findOne','hasOwnProperty','getSubjects','DeskField'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8891,0x150));var _0x1889=function(_0x50a3e1,_0x43d894){_0x50a3e1=_0x50a3e1-0x0;var _0x3f5a7f=_0x8891[_0x50a3e1];return _0x3f5a7f;};'use strict';var emlformat=require(_0x1889('0x0'));var rimraf=require(_0x1889('0x1'));var zipdir=require(_0x1889('0x2'));var jsonpatch=require(_0x1889('0x3'));var rp=require(_0x1889('0x4'));var moment=require(_0x1889('0x5'));var BPromise=require(_0x1889('0x6'));var Mustache=require('mustache');var util=require(_0x1889('0x7'));var path=require(_0x1889('0x8'));var sox=require('sox');var csv=require(_0x1889('0x9'));var ejs=require(_0x1889('0xa'));var fs=require('fs');var fs_extra=require(_0x1889('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1889('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1889('0xd'));var toCsv=require(_0x1889('0x9'));var querystring=require(_0x1889('0xe'));var Papa=require(_0x1889('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1889('0x10'));var as=require(_0x1889('0x11'));var hardwareService=require(_0x1889('0x12'));var logger=require(_0x1889('0x13'))(_0x1889('0x14'));var utils=require(_0x1889('0x15'));var config=require(_0x1889('0x16'));var licenseUtil=require(_0x1889('0x17'));var db=require(_0x1889('0x18'))['db'];function respondWithStatusCode(_0x12e967,_0x562f00){_0x562f00=_0x562f00||0xcc;return function(_0x4f33b9){if(_0x4f33b9){return _0x12e967[_0x1889('0x19')](_0x562f00);}return _0x12e967['status'](_0x562f00)[_0x1889('0x1a')]();};}function respondWithResult(_0x242a8e,_0x5daf68){_0x5daf68=_0x5daf68||0xc8;return function(_0x454fc2){if(_0x454fc2){return _0x242a8e[_0x1889('0x1b')](_0x5daf68)['json'](_0x454fc2);}};}function respondWithFilteredResult(_0x250e59,_0x1b1a83){return function(_0xfef390){if(_0xfef390){var _0x228238=typeof _0x1b1a83[_0x1889('0x1c')]==='undefined'&&typeof _0x1b1a83[_0x1889('0x1d')]===_0x1889('0x1e');var _0x2dfc0b=_0xfef390[_0x1889('0x1f')];var _0x31af08=_0x228238?0x0:_0x1b1a83[_0x1889('0x1c')];var _0x516967=_0x228238?_0xfef390[_0x1889('0x1f')]:_0x1b1a83[_0x1889('0x1c')]+_0x1b1a83[_0x1889('0x1d')];var _0x3acf8c;if(_0x516967>=_0x2dfc0b){_0x516967=_0x2dfc0b;_0x3acf8c=0xc8;}else{_0x3acf8c=0xce;}_0x250e59[_0x1889('0x1b')](_0x3acf8c);return _0x250e59[_0x1889('0x20')]('Content-Range',_0x31af08+'-'+_0x516967+'/'+_0x2dfc0b)[_0x1889('0x21')](_0xfef390);}return null;};}function patchUpdates(_0xbc32c4){return function(_0x3bda37){try{jsonpatch[_0x1889('0x22')](_0x3bda37,_0xbc32c4,!![]);}catch(_0x1e1ecd){return BPromise[_0x1889('0x23')](_0x1e1ecd);}return _0x3bda37[_0x1889('0x24')]();};}function saveUpdates(_0xde0428,_0x3588fc){return function(_0x33a3c2){if(_0x33a3c2){return _0x33a3c2[_0x1889('0x25')](_0xde0428)[_0x1889('0x26')](function(_0x1faecf){return _0x1faecf;});}return null;};}function removeEntity(_0x371558,_0x52f9dd){return function(_0x1deaf9){if(_0x1deaf9){return _0x1deaf9[_0x1889('0x27')]()[_0x1889('0x26')](function(){_0x371558[_0x1889('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d8df2,_0x134dc1){return function(_0x36c9cf){if(!_0x36c9cf){_0x2d8df2['sendStatus'](0x194);}return _0x36c9cf;};}function handleError(_0x3c6558,_0x4db93e){_0x4db93e=_0x4db93e||0x1f4;return function(_0x72e238){logger[_0x1889('0x28')](_0x72e238['stack']);if(_0x72e238[_0x1889('0x29')]){delete _0x72e238[_0x1889('0x29')];}_0x3c6558[_0x1889('0x1b')](_0x4db93e)[_0x1889('0x2a')](_0x72e238);};}exports[_0x1889('0x2b')]=function(_0x56a891,_0x3978f4){var _0x26f588={},_0x4fece3={},_0x458841={'count':0x0,'rows':[]};var _0xb3a207=_[_0x1889('0x2c')](db[_0x1889('0x2d')][_0x1889('0x2e')],function(_0x5b11ad){return{'name':_0x5b11ad[_0x1889('0x2f')],'type':_0x5b11ad[_0x1889('0x30')]['key']};});_0x4fece3[_0x1889('0x31')]=_[_0x1889('0x2c')](_0xb3a207,'name');_0x4fece3['query']=_[_0x1889('0x32')](_0x56a891[_0x1889('0x33')]);_0x4fece3[_0x1889('0x34')]=_[_0x1889('0x35')](_0x4fece3[_0x1889('0x31')],_0x4fece3[_0x1889('0x33')]);_0x26f588[_0x1889('0x36')]=_[_0x1889('0x35')](_0x4fece3[_0x1889('0x31')],qs[_0x1889('0x37')](_0x56a891[_0x1889('0x33')][_0x1889('0x37')]));_0x26f588[_0x1889('0x36')]=_0x26f588[_0x1889('0x36')][_0x1889('0x38')]?_0x26f588[_0x1889('0x36')]:_0x4fece3['model'];if(!_0x56a891['query']['hasOwnProperty'](_0x1889('0x39'))){_0x26f588[_0x1889('0x1d')]=qs['limit'](_0x56a891[_0x1889('0x33')][_0x1889('0x1d')]);_0x26f588['offset']=qs['offset'](_0x56a891[_0x1889('0x33')][_0x1889('0x1c')]);}_0x26f588[_0x1889('0x3a')]=qs[_0x1889('0x3b')](_0x56a891[_0x1889('0x33')][_0x1889('0x3b')]);_0x26f588[_0x1889('0x3c')]=qs[_0x1889('0x34')](_[_0x1889('0x3d')](_0x56a891['query'],_0x4fece3[_0x1889('0x34')]),_0xb3a207);if(_0x56a891[_0x1889('0x33')]['filter']){_0x26f588[_0x1889('0x3c')]=_[_0x1889('0x3e')](_0x26f588[_0x1889('0x3c')],{'$or':_[_0x1889('0x2c')](_0xb3a207,function(_0xa75fa){if(_0xa75fa[_0x1889('0x30')]!=='VIRTUAL'){var _0x31dbf3={};_0x31dbf3[_0xa75fa['name']]={'$like':'%'+_0x56a891[_0x1889('0x33')][_0x1889('0x3f')]+'%'};return _0x31dbf3;}})});}_0x26f588=_['merge']({},_0x26f588,_0x56a891['options']);var _0x40db61={'where':_0x26f588[_0x1889('0x3c')]};return db[_0x1889('0x2d')][_0x1889('0x1f')](_0x40db61)[_0x1889('0x26')](function(_0x31b357){_0x458841[_0x1889('0x1f')]=_0x31b357;if(_0x56a891[_0x1889('0x33')][_0x1889('0x40')]){_0x26f588[_0x1889('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x1889('0x42')](_0x26f588);})[_0x1889('0x26')](function(_0xda317e){_0x458841['rows']=_0xda317e;return _0x458841;})[_0x1889('0x26')](respondWithFilteredResult(_0x3978f4,_0x26f588))['catch'](handleError(_0x3978f4,null));};exports[_0x1889('0x43')]=function(_0x3653d7,_0x20e383){var _0x35ccb6={'raw':![],'where':{'id':_0x3653d7[_0x1889('0x44')]['id']}},_0x109ddd={};_0x109ddd[_0x1889('0x31')]=_[_0x1889('0x32')](db[_0x1889('0x2d')][_0x1889('0x2e')]);_0x109ddd['query']=_['keys'](_0x3653d7[_0x1889('0x33')]);_0x109ddd['filters']=_[_0x1889('0x35')](_0x109ddd[_0x1889('0x31')],_0x109ddd[_0x1889('0x33')]);_0x35ccb6[_0x1889('0x36')]=_[_0x1889('0x35')](_0x109ddd[_0x1889('0x31')],qs[_0x1889('0x37')](_0x3653d7[_0x1889('0x33')][_0x1889('0x37')]));_0x35ccb6[_0x1889('0x36')]=_0x35ccb6[_0x1889('0x36')]['length']?_0x35ccb6[_0x1889('0x36')]:_0x109ddd[_0x1889('0x31')];if(_0x3653d7[_0x1889('0x33')][_0x1889('0x40')]){_0x35ccb6[_0x1889('0x41')]=[{'all':!![]}];}_0x35ccb6=_[_0x1889('0x3e')]({},_0x35ccb6,_0x3653d7[_0x1889('0x45')]);return db['DeskConfiguration'][_0x1889('0x46')](_0x35ccb6)[_0x1889('0x26')](handleEntityNotFound(_0x20e383,null))[_0x1889('0x26')](respondWithResult(_0x20e383,null))[_0x1889('0x47')](handleError(_0x20e383,null));};exports[_0x1889('0x48')]=function(_0x56816f,_0x414c29){return db[_0x1889('0x2d')][_0x1889('0x48')](_0x56816f[_0x1889('0x49')],{})[_0x1889('0x26')](respondWithResult(_0x414c29,0xc9))[_0x1889('0x47')](handleError(_0x414c29,null));};exports[_0x1889('0x25')]=function(_0x5af82d,_0x517d19){if(_0x5af82d[_0x1889('0x49')]['id']){delete _0x5af82d[_0x1889('0x49')]['id'];}return db[_0x1889('0x2d')]['find']({'where':{'id':_0x5af82d[_0x1889('0x44')]['id']}})['then'](handleEntityNotFound(_0x517d19,null))['then'](saveUpdates(_0x5af82d[_0x1889('0x49')],null))[_0x1889('0x26')](respondWithResult(_0x517d19,null))[_0x1889('0x47')](handleError(_0x517d19,null));};exports['destroy']=function(_0x5c96f2,_0x1ecbda){return db[_0x1889('0x2d')]['find']({'where':{'id':_0x5c96f2[_0x1889('0x44')]['id']}})[_0x1889('0x26')](handleEntityNotFound(_0x1ecbda,null))[_0x1889('0x26')](removeEntity(_0x1ecbda,null))[_0x1889('0x47')](handleError(_0x1ecbda,null));};exports[_0x1889('0x4a')]=function(_0xd8bc45,_0x589814,_0x513f04){var _0x5aa027={};var _0x39e07e={};var _0x1688c1;var _0x4794ed;return db['DeskConfiguration'][_0x1889('0x4b')]({'where':{'id':_0xd8bc45[_0x1889('0x44')]['id']}})['then'](handleEntityNotFound(_0x589814,null))[_0x1889('0x26')](function(_0x538bff){if(_0x538bff){_0x1688c1=_0x538bff;_0x39e07e[_0x1889('0x31')]=_[_0x1889('0x32')](db['DeskField']['rawAttributes']);_0x39e07e[_0x1889('0x33')]=_[_0x1889('0x32')](_0xd8bc45[_0x1889('0x33')]);_0x39e07e[_0x1889('0x34')]=_['intersection'](_0x39e07e[_0x1889('0x31')],_0x39e07e['query']);_0x5aa027['attributes']=_[_0x1889('0x35')](_0x39e07e[_0x1889('0x31')],qs['fields'](_0xd8bc45[_0x1889('0x33')][_0x1889('0x37')]));_0x5aa027[_0x1889('0x36')]=_0x5aa027['attributes'][_0x1889('0x38')]?_0x5aa027['attributes']:_0x39e07e[_0x1889('0x31')];_0x5aa027['order']=qs[_0x1889('0x3b')](_0xd8bc45[_0x1889('0x33')]['sort']);_0x5aa027[_0x1889('0x3c')]=qs['filters'](_[_0x1889('0x3d')](_0xd8bc45[_0x1889('0x33')],_0x39e07e[_0x1889('0x34')]));if(_0xd8bc45[_0x1889('0x33')][_0x1889('0x3f')]){_0x5aa027[_0x1889('0x3c')]=_[_0x1889('0x3e')](_0x5aa027[_0x1889('0x3c')],{'$or':_[_0x1889('0x2c')](_0x5aa027[_0x1889('0x36')],function(_0x3c2ff2){var _0x475dfb={};_0x475dfb[_0x3c2ff2]={'$like':'%'+_0xd8bc45[_0x1889('0x33')]['filter']+'%'};return _0x475dfb;})});}_0x5aa027=_[_0x1889('0x3e')]({},_0x5aa027,_0xd8bc45['options']);return _0x1688c1[_0x1889('0x4a')](_0x5aa027);}})[_0x1889('0x26')](function(_0x30e726){if(_0x30e726){_0x4794ed=_0x30e726[_0x1889('0x38')];if(!_0xd8bc45[_0x1889('0x33')][_0x1889('0x4c')](_0x1889('0x39'))){_0x5aa027[_0x1889('0x1d')]=qs['limit'](_0xd8bc45[_0x1889('0x33')][_0x1889('0x1d')]);_0x5aa027['offset']=qs['offset'](_0xd8bc45[_0x1889('0x33')][_0x1889('0x1c')]);}return _0x1688c1['getFields'](_0x5aa027);}})['then'](function(_0x496a9b){if(_0x496a9b){return _0x496a9b?{'count':_0x4794ed,'rows':_0x496a9b}:null;}})['then'](respondWithResult(_0x589814,null))[_0x1889('0x47')](handleError(_0x589814,null));};exports[_0x1889('0x4d')]=function(_0x1963db,_0x22ca73,_0x45c11e){var _0x2a1933={};var _0x3f6e02={};var _0x58081e;var _0x49ec82;return db[_0x1889('0x2d')][_0x1889('0x4b')]({'where':{'id':_0x1963db[_0x1889('0x44')]['id']}})['then'](handleEntityNotFound(_0x22ca73,null))['then'](function(_0x2e7370){if(_0x2e7370){_0x58081e=_0x2e7370;_0x3f6e02[_0x1889('0x31')]=_[_0x1889('0x32')](db[_0x1889('0x4e')][_0x1889('0x2e')]);_0x3f6e02[_0x1889('0x33')]=_[_0x1889('0x32')](_0x1963db[_0x1889('0x33')]);_0x3f6e02[_0x1889('0x34')]=_[_0x1889('0x35')](_0x3f6e02['model'],_0x3f6e02['query']);_0x2a1933[_0x1889('0x36')]=_[_0x1889('0x35')](_0x3f6e02[_0x1889('0x31')],qs['fields'](_0x1963db[_0x1889('0x33')][_0x1889('0x37')]));_0x2a1933[_0x1889('0x36')]=_0x2a1933[_0x1889('0x36')][_0x1889('0x38')]?_0x2a1933['attributes']:_0x3f6e02[_0x1889('0x31')];_0x2a1933[_0x1889('0x3a')]=qs[_0x1889('0x3b')](_0x1963db['query'][_0x1889('0x3b')]);_0x2a1933[_0x1889('0x3c')]=qs['filters'](_['pick'](_0x1963db['query'],_0x3f6e02[_0x1889('0x34')]));if(_0x1963db[_0x1889('0x33')][_0x1889('0x3f')]){_0x2a1933[_0x1889('0x3c')]=_[_0x1889('0x3e')](_0x2a1933[_0x1889('0x3c')],{'$or':_['map'](_0x2a1933[_0x1889('0x36')],function(_0x181e26){var _0x18fbb2={};_0x18fbb2[_0x181e26]={'$like':'%'+_0x1963db['query'][_0x1889('0x3f')]+'%'};return _0x18fbb2;})});}_0x2a1933=_[_0x1889('0x3e')]({},_0x2a1933,_0x1963db[_0x1889('0x45')]);return _0x58081e[_0x1889('0x4d')](_0x2a1933);}})[_0x1889('0x26')](function(_0x3c8b0a){if(_0x3c8b0a){_0x49ec82=_0x3c8b0a[_0x1889('0x38')];if(!_0x1963db[_0x1889('0x33')][_0x1889('0x4c')](_0x1889('0x39'))){_0x2a1933[_0x1889('0x1d')]=qs[_0x1889('0x1d')](_0x1963db['query'][_0x1889('0x1d')]);_0x2a1933[_0x1889('0x1c')]=qs['offset'](_0x1963db['query'][_0x1889('0x1c')]);}return _0x58081e[_0x1889('0x4d')](_0x2a1933);}})[_0x1889('0x26')](function(_0x4a2ebe){if(_0x4a2ebe){return _0x4a2ebe?{'count':_0x49ec82,'rows':_0x4a2ebe}:null;}})[_0x1889('0x26')](respondWithResult(_0x22ca73,null))[_0x1889('0x47')](handleError(_0x22ca73,null));};exports[_0x1889('0x4f')]=function(_0xb37e52,_0x5820ef,_0xa22cbf){var _0xba1fd6={};var _0x3c532c={};var _0x3d05a5;var _0x51911a;return db['DeskConfiguration'][_0x1889('0x4b')]({'where':{'id':_0xb37e52[_0x1889('0x44')]['id']}})[_0x1889('0x26')](handleEntityNotFound(_0x5820ef,null))[_0x1889('0x26')](function(_0x3a06a3){if(_0x3a06a3){_0x3d05a5=_0x3a06a3;_0x3c532c[_0x1889('0x31')]=_[_0x1889('0x32')](db[_0x1889('0x4e')]['rawAttributes']);_0x3c532c[_0x1889('0x33')]=_[_0x1889('0x32')](_0xb37e52['query']);_0x3c532c[_0x1889('0x34')]=_[_0x1889('0x35')](_0x3c532c['model'],_0x3c532c[_0x1889('0x33')]);_0xba1fd6[_0x1889('0x36')]=_[_0x1889('0x35')](_0x3c532c[_0x1889('0x31')],qs[_0x1889('0x37')](_0xb37e52['query'][_0x1889('0x37')]));_0xba1fd6[_0x1889('0x36')]=_0xba1fd6[_0x1889('0x36')][_0x1889('0x38')]?_0xba1fd6['attributes']:_0x3c532c['model'];_0xba1fd6[_0x1889('0x3a')]=qs[_0x1889('0x3b')](_0xb37e52[_0x1889('0x33')][_0x1889('0x3b')]);_0xba1fd6['where']=qs[_0x1889('0x34')](_['pick'](_0xb37e52[_0x1889('0x33')],_0x3c532c[_0x1889('0x34')]));if(_0xb37e52[_0x1889('0x33')][_0x1889('0x3f')]){_0xba1fd6[_0x1889('0x3c')]=_['merge'](_0xba1fd6['where'],{'$or':_[_0x1889('0x2c')](_0xba1fd6[_0x1889('0x36')],function(_0x49ee32){var _0x335588={};_0x335588[_0x49ee32]={'$like':'%'+_0xb37e52['query'][_0x1889('0x3f')]+'%'};return _0x335588;})});}_0xba1fd6=_[_0x1889('0x3e')]({},_0xba1fd6,_0xb37e52[_0x1889('0x45')]);return _0x3d05a5[_0x1889('0x4f')](_0xba1fd6);}})[_0x1889('0x26')](function(_0x3def12){if(_0x3def12){_0x51911a=_0x3def12['length'];if(!_0xb37e52[_0x1889('0x33')][_0x1889('0x4c')](_0x1889('0x39'))){_0xba1fd6['limit']=qs['limit'](_0xb37e52[_0x1889('0x33')][_0x1889('0x1d')]);_0xba1fd6[_0x1889('0x1c')]=qs[_0x1889('0x1c')](_0xb37e52[_0x1889('0x33')]['offset']);}return _0x3d05a5[_0x1889('0x4f')](_0xba1fd6);}})[_0x1889('0x26')](function(_0x26e010){if(_0x26e010){return _0x26e010?{'count':_0x51911a,'rows':_0x26e010}:null;}})[_0x1889('0x26')](respondWithResult(_0x5820ef,null))[_0x1889('0x47')](handleError(_0x5820ef,null));};exports[_0x1889('0x50')]=function(_0x3ee928,_0x11502a,_0x3177d3){var _0x3e0d03={};var _0x2bc568={};var _0xc18b0e;var _0x179684;return db[_0x1889('0x2d')][_0x1889('0x4b')]({'where':{'id':_0x3ee928[_0x1889('0x44')]['id']}})[_0x1889('0x26')](handleEntityNotFound(_0x11502a,null))['then'](function(_0x16e3f1){if(_0x16e3f1){_0xc18b0e=_0x16e3f1;_0x2bc568[_0x1889('0x31')]=_[_0x1889('0x32')](db['Tag'][_0x1889('0x2e')]);_0x2bc568[_0x1889('0x33')]=_[_0x1889('0x32')](_0x3ee928['query']);_0x2bc568[_0x1889('0x34')]=_[_0x1889('0x35')](_0x2bc568[_0x1889('0x31')],_0x2bc568['query']);_0x3e0d03['attributes']=_[_0x1889('0x35')](_0x2bc568[_0x1889('0x31')],qs[_0x1889('0x37')](_0x3ee928[_0x1889('0x33')][_0x1889('0x37')]));_0x3e0d03['attributes']=_0x3e0d03[_0x1889('0x36')]['length']?_0x3e0d03['attributes']:_0x2bc568['model'];_0x3e0d03[_0x1889('0x3a')]=qs[_0x1889('0x3b')](_0x3ee928[_0x1889('0x33')][_0x1889('0x3b')]);_0x3e0d03[_0x1889('0x3c')]=qs[_0x1889('0x34')](_[_0x1889('0x3d')](_0x3ee928['query'],_0x2bc568['filters']));if(_0x3ee928[_0x1889('0x33')][_0x1889('0x3f')]){_0x3e0d03[_0x1889('0x3c')]=_[_0x1889('0x3e')](_0x3e0d03[_0x1889('0x3c')],{'$or':_['map'](_0x3e0d03[_0x1889('0x36')],function(_0xc6e597){var _0x7bc176={};_0x7bc176[_0xc6e597]={'$like':'%'+_0x3ee928[_0x1889('0x33')][_0x1889('0x3f')]+'%'};return _0x7bc176;})});}_0x3e0d03=_['merge']({},_0x3e0d03,_0x3ee928['options']);return _0xc18b0e[_0x1889('0x50')](_0x3e0d03);}})[_0x1889('0x26')](function(_0x2d0fe6){if(_0x2d0fe6){_0x179684=_0x2d0fe6[_0x1889('0x38')];if(!_0x3ee928[_0x1889('0x33')][_0x1889('0x4c')](_0x1889('0x39'))){_0x3e0d03[_0x1889('0x1d')]=qs[_0x1889('0x1d')](_0x3ee928[_0x1889('0x33')][_0x1889('0x1d')]);_0x3e0d03[_0x1889('0x1c')]=qs[_0x1889('0x1c')](_0x3ee928[_0x1889('0x33')][_0x1889('0x1c')]);}return _0xc18b0e[_0x1889('0x50')](_0x3e0d03);}})[_0x1889('0x26')](function(_0x4889bb){if(_0x4889bb){return _0x4889bb?{'count':_0x179684,'rows':_0x4889bb}:null;}})[_0x1889('0x26')](respondWithResult(_0x11502a,null))[_0x1889('0x47')](handleError(_0x11502a,null));};exports['setTags']=function(_0x376a7f,_0x1b5d81,_0x26c786){if(_0x376a7f[_0x1889('0x49')]['id']){delete _0x376a7f[_0x1889('0x49')]['id'];}return db[_0x1889('0x2d')]['findOne']({'where':{'id':_0x376a7f[_0x1889('0x44')]['id']}})[_0x1889('0x26')](handleEntityNotFound(_0x1b5d81,null))[_0x1889('0x26')](function(_0xc635f3){if(_0xc635f3){return _0xc635f3[_0x1889('0x51')](_0x376a7f[_0x1889('0x49')][_0x1889('0x52')]||[]);}return null;})[_0x1889('0x26')](respondWithResult(_0x1b5d81,null))[_0x1889('0x47')](handleError(_0x1b5d81,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 58a5d37..15d99e5 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 _0xae2b=['util','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','define','lodash'];(function(_0x403069,_0x24bf55){var _0x3314ed=function(_0x2c6d8b){while(--_0x2c6d8b){_0x403069['push'](_0x403069['shift']());}};_0x3314ed(++_0x24bf55);}(_0xae2b,0xb3));var _0xbae2=function(_0x333d81,_0x18d63c){_0x333d81=_0x333d81-0x0;var _0x1294eb=_0xae2b[_0x333d81];return _0x1294eb;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var logger=require('../../config/logger')(_0xbae2('0x2'));var moment=require(_0xbae2('0x3'));var BPromise=require(_0xbae2('0x4'));var rp=require(_0xbae2('0x5'));var fs=require('fs');var path=require(_0xbae2('0x6'));var rimraf=require(_0xbae2('0x7'));var config=require('../../config/environment');var attributes=require(_0xbae2('0x8'));module['exports']=function(_0x365175,_0xbfd83a){return _0x365175[_0xbae2('0x9')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80df=['../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var logger=require(_0xf80d('0x2'))(_0xf80d('0x3'));var moment=require('moment');var BPromise=require(_0xf80d('0x4'));var rp=require(_0xf80d('0x5'));var fs=require('fs');var path=require(_0xf80d('0x6'));var rimraf=require(_0xf80d('0x7'));var config=require(_0xf80d('0x8'));var attributes=require(_0xf80d('0x9'));module[_0xf80d('0xa')]=function(_0xeffeb7,_0x1c9b19){return _0xeffeb7[_0xf80d('0xb')]('DeskConfiguration',attributes,{'tableName':_0xf80d('0xc'),'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 57c7c34..23a8b28 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 _0x627e=['request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x24fe4e,_0x3bd296){var _0x347327=function(_0x3e86e0){while(--_0x3e86e0){_0x24fe4e['push'](_0x24fe4e['shift']());}};_0x347327(++_0x3bd296);}(_0x627e,0x14a));var _0xe627=function(_0x251468,_0x685716){_0x251468=_0x251468-0x0;var _0x465240=_0x627e[_0x251468];return _0x465240;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file +var _0x0c07=['debug','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','DeskConfiguration,\x20%s,\x20%s'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0c07,0x8b));var _0x70c0=function(_0x3ddb02,_0x184ada){_0x3ddb02=_0x3ddb02-0x0;var _0x52b85f=_0x0c07[_0x3ddb02];return _0x52b85f;};'use strict';var _=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var moment=require(_0x70c0('0x2'));var BPromise=require(_0x70c0('0x3'));var rs=require(_0x70c0('0x4'));var fs=require('fs');var Redis=require(_0x70c0('0x5'));var db=require(_0x70c0('0x6'))['db'];var utils=require(_0x70c0('0x7'));var logger=require(_0x70c0('0x8'))(_0x70c0('0x9'));var config=require(_0x70c0('0xa'));var jayson=require(_0x70c0('0xb'));var client=jayson['client'][_0x70c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e8e0f,_0x4ee883,_0x35717f){return new BPromise(function(_0x18fba0,_0x20ed83){return client[_0x70c0('0xd')](_0x5e8e0f,_0x35717f)['then'](function(_0x47532f){logger['info'](_0x70c0('0xe'),_0x4ee883,'request\x20sent');logger[_0x70c0('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4ee883,_0x70c0('0x10'),JSON[_0x70c0('0x11')](_0x47532f));if(_0x47532f['error']){if(_0x47532f['error']['code']===0x1f4){logger[_0x70c0('0x12')](_0x70c0('0xe'),_0x4ee883,_0x47532f[_0x70c0('0x12')]['message']);return _0x20ed83(_0x47532f[_0x70c0('0x12')]['message']);}logger[_0x70c0('0x12')](_0x70c0('0xe'),_0x4ee883,_0x47532f[_0x70c0('0x12')][_0x70c0('0x13')]);return _0x18fba0(_0x47532f[_0x70c0('0x12')][_0x70c0('0x13')]);}else{logger[_0x70c0('0x14')](_0x70c0('0xe'),_0x4ee883,_0x70c0('0x10'));_0x18fba0(_0x47532f[_0x70c0('0x15')][_0x70c0('0x13')]);}})['catch'](function(_0x767ed6){logger[_0x70c0('0x12')](_0x70c0('0xe'),_0x4ee883,_0x767ed6);_0x20ed83(_0x767ed6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0ade84c..dedc3cd 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 _0xa7d7=['index','show','post','isAuthenticated','put','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa7d7,0x149));var _0x7a7d=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0xa7d7[_0x1cd674];return _0x27928f;};'use strict';var multer=require('multer');var util=require(_0x7a7d('0x0'));var path=require(_0x7a7d('0x1'));var timeout=require(_0x7a7d('0x2'));var express=require(_0x7a7d('0x3'));var router=express[_0x7a7d('0x4')]();var fs_extra=require(_0x7a7d('0x5'));var auth=require(_0x7a7d('0x6'));var interaction=require(_0x7a7d('0x7'));var config=require(_0x7a7d('0x8'));var controller=require(_0x7a7d('0x9'));router[_0x7a7d('0xa')]('/',auth['isAuthenticated'](),controller[_0x7a7d('0xb')]);router[_0x7a7d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7a7d('0xc')]);router[_0x7a7d('0xd')]('/',auth[_0x7a7d('0xe')](),controller['create']);router[_0x7a7d('0xf')]('/:id',auth[_0x7a7d('0xe')](),controller['update']);router['delete'](_0x7a7d('0x10'),auth[_0x7a7d('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe961=['fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','connect-timeout','Router'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xe961,0x11b));var _0x1e96=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe961[_0x521929];return _0x632436;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1e96('0x0'));var express=require('express');var router=express[_0x1e96('0x1')]();var fs_extra=require(_0x1e96('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1e96('0x3'));var config=require(_0x1e96('0x4'));var controller=require(_0x1e96('0x5'));router[_0x1e96('0x6')]('/',auth[_0x1e96('0x7')](),controller[_0x1e96('0x8')]);router[_0x1e96('0x6')](_0x1e96('0x9'),auth['isAuthenticated'](),controller[_0x1e96('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e96('0xb')]);router['put'](_0x1e96('0x9'),auth[_0x1e96('0x7')](),controller[_0x1e96('0xc')]);router[_0x1e96('0xd')](_0x1e96('0x9'),auth[_0x1e96('0x7')](),controller['destroy']);module[_0x1e96('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c9d39cf..ef5e125 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 _0x131a=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x131a,0x91));var _0xa131=function(_0x4cbc95,_0x419639){_0x4cbc95=_0x4cbc95-0x0;var _0x24af3a=_0x131a[_0x4cbc95];return _0x24af3a;};'use strict';var Sequelize=require(_0xa131('0x0'));module[_0xa131('0x1')]={'type':{'type':Sequelize[_0xa131('0x2')](_0xa131('0x3'),_0xa131('0x4'),_0xa131('0x5'),_0xa131('0x6'),_0xa131('0x7')),'defaultValue':_0xa131('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa131('0x8')]},'keyType':{'type':Sequelize[_0xa131('0x2')](_0xa131('0x3'),_0xa131('0x4'),_0xa131('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa131('0x8')]},'nameField':{'type':Sequelize[_0xa131('0x8')]},'customField':{'type':Sequelize[_0xa131('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc004=['string','STRING','customVariable','sequelize','exports','ENUM','variable','keyValue'];(function(_0x2da034,_0x1d9cb5){var _0x5c4851=function(_0x187246){while(--_0x187246){_0x2da034['push'](_0x2da034['shift']());}};_0x5c4851(++_0x1d9cb5);}(_0xc004,0x18b));var _0x4c00=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xc004[_0x3b76f7];return _0x43984e;};'use strict';var Sequelize=require(_0x4c00('0x0'));module[_0x4c00('0x1')]={'type':{'type':Sequelize[_0x4c00('0x2')]('string',_0x4c00('0x3'),'customVariable',_0x4c00('0x4'),'picklist'),'defaultValue':_0x4c00('0x5')},'content':{'type':Sequelize[_0x4c00('0x6')]},'key':{'type':Sequelize[_0x4c00('0x6')]},'keyType':{'type':Sequelize[_0x4c00('0x2')](_0x4c00('0x5'),'variable',_0x4c00('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4c00('0x6')]},'nameField':{'type':Sequelize[_0x4c00('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c00('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 98aa9f0..2cecc77 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 _0x7c7f=['eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','send','map','DeskField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','include','rows','show','includeAll','create','catch','body','find','params','destroy'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x7c7f,0x163));var _0xf7c7=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x7c7f[_0x3b1b23];return _0x1efc85;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c7('0x2'));var moment=require(_0xf7c7('0x3'));var BPromise=require(_0xf7c7('0x4'));var Mustache=require('mustache');var util=require(_0xf7c7('0x5'));var path=require(_0xf7c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7c7('0x8'));var crypto=require(_0xf7c7('0x9'));var jsforce=require(_0xf7c7('0xa'));var deskjs=require(_0xf7c7('0xb'));var toCsv=require(_0xf7c7('0xc'));var querystring=require('querystring');var Papa=require(_0xf7c7('0xd'));var Redis=require('ioredis');var authService=require(_0xf7c7('0xe'));var qs=require(_0xf7c7('0xf'));var as=require(_0xf7c7('0x10'));var hardwareService=require(_0xf7c7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7c7('0x12'));var licenseUtil=require(_0xf7c7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3a76,_0x12167c){_0x12167c=_0x12167c||0xcc;return function(_0x2c3313){if(_0x2c3313){return _0x5f3a76[_0xf7c7('0x14')](_0x12167c);}return _0x5f3a76[_0xf7c7('0x15')](_0x12167c)['end']();};}function respondWithResult(_0x571e83,_0x103442){_0x103442=_0x103442||0xc8;return function(_0x491988){if(_0x491988){return _0x571e83[_0xf7c7('0x15')](_0x103442)[_0xf7c7('0x16')](_0x491988);}};}function respondWithFilteredResult(_0x3888c7,_0x52fc80){return function(_0x9cd3d2){if(_0x9cd3d2){var _0x75f675=typeof _0x52fc80[_0xf7c7('0x17')]==='undefined'&&typeof _0x52fc80[_0xf7c7('0x18')]==='undefined';var _0x36de35=_0x9cd3d2[_0xf7c7('0x19')];var _0x553ac2=_0x75f675?0x0:_0x52fc80[_0xf7c7('0x17')];var _0x51b3f3=_0x75f675?_0x9cd3d2['count']:_0x52fc80[_0xf7c7('0x17')]+_0x52fc80[_0xf7c7('0x18')];var _0x54338a;if(_0x51b3f3>=_0x36de35){_0x51b3f3=_0x36de35;_0x54338a=0xc8;}else{_0x54338a=0xce;}_0x3888c7[_0xf7c7('0x15')](_0x54338a);return _0x3888c7[_0xf7c7('0x1a')](_0xf7c7('0x1b'),_0x553ac2+'-'+_0x51b3f3+'/'+_0x36de35)[_0xf7c7('0x16')](_0x9cd3d2);}return null;};}function patchUpdates(_0x32df10){return function(_0x1d9d8d){try{jsonpatch[_0xf7c7('0x1c')](_0x1d9d8d,_0x32df10,!![]);}catch(_0x3b6c6c){return BPromise[_0xf7c7('0x1d')](_0x3b6c6c);}return _0x1d9d8d[_0xf7c7('0x1e')]();};}function saveUpdates(_0xcf6819,_0x675424){return function(_0x233dcb){if(_0x233dcb){return _0x233dcb[_0xf7c7('0x1f')](_0xcf6819)[_0xf7c7('0x20')](function(_0x4638d8){return _0x4638d8;});}return null;};}function removeEntity(_0x48fd83,_0x5da18c){return function(_0x5cfed5){if(_0x5cfed5){return _0x5cfed5['destroy']()[_0xf7c7('0x20')](function(){_0x48fd83['status'](0xcc)[_0xf7c7('0x21')]();});}};}function handleEntityNotFound(_0x46fff5,_0x2f292c){return function(_0x148a6f){if(!_0x148a6f){_0x46fff5[_0xf7c7('0x14')](0x194);}return _0x148a6f;};}function handleError(_0x5e5d87,_0x28adcd){_0x28adcd=_0x28adcd||0x1f4;return function(_0x3370f0){logger[_0xf7c7('0x22')](_0x3370f0[_0xf7c7('0x23')]);if(_0x3370f0['name']){delete _0x3370f0['name'];}_0x5e5d87[_0xf7c7('0x15')](_0x28adcd)[_0xf7c7('0x24')](_0x3370f0);};}exports['index']=function(_0x212fae,_0x446350){var _0x21d90f={},_0x32fcef={},_0x2ddf40={'count':0x0,'rows':[]};var _0x20adee=_[_0xf7c7('0x25')](db[_0xf7c7('0x26')][_0xf7c7('0x27')],function(_0x490323){return{'name':_0x490323[_0xf7c7('0x28')],'type':_0x490323[_0xf7c7('0x29')]['key']};});_0x32fcef[_0xf7c7('0x2a')]=_[_0xf7c7('0x25')](_0x20adee,'name');_0x32fcef[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x212fae[_0xf7c7('0x2b')]);_0x32fcef['filters']=_[_0xf7c7('0x2d')](_0x32fcef[_0xf7c7('0x2a')],_0x32fcef[_0xf7c7('0x2b')]);_0x21d90f[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x32fcef['model'],qs[_0xf7c7('0x2f')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x2f')]));_0x21d90f[_0xf7c7('0x2e')]=_0x21d90f[_0xf7c7('0x2e')][_0xf7c7('0x30')]?_0x21d90f['attributes']:_0x32fcef[_0xf7c7('0x2a')];if(!_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x31')](_0xf7c7('0x32'))){_0x21d90f[_0xf7c7('0x18')]=qs['limit'](_0x212fae['query']['limit']);_0x21d90f[_0xf7c7('0x17')]=qs[_0xf7c7('0x17')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x17')]);}_0x21d90f[_0xf7c7('0x33')]=qs[_0xf7c7('0x34')](_0x212fae['query'][_0xf7c7('0x34')]);_0x21d90f[_0xf7c7('0x35')]=qs[_0xf7c7('0x36')](_[_0xf7c7('0x37')](_0x212fae[_0xf7c7('0x2b')],_0x32fcef[_0xf7c7('0x36')]),_0x20adee);if(_0x212fae['query'][_0xf7c7('0x38')]){_0x21d90f[_0xf7c7('0x35')]=_[_0xf7c7('0x39')](_0x21d90f['where'],{'$or':_[_0xf7c7('0x25')](_0x20adee,function(_0x3a74b6){if(_0x3a74b6[_0xf7c7('0x29')]!==_0xf7c7('0x3a')){var _0x183b1c={};_0x183b1c[_0x3a74b6[_0xf7c7('0x3b')]]={'$like':'%'+_0x212fae['query']['filter']+'%'};return _0x183b1c;}})});}_0x21d90f=_['merge']({},_0x21d90f,_0x212fae[_0xf7c7('0x3c')]);var _0x5df012={'where':_0x21d90f[_0xf7c7('0x35')]};return db[_0xf7c7('0x26')][_0xf7c7('0x19')](_0x5df012)[_0xf7c7('0x20')](function(_0x439455){_0x2ddf40[_0xf7c7('0x19')]=_0x439455;if(_0x212fae[_0xf7c7('0x2b')]['includeAll']){_0x21d90f[_0xf7c7('0x3d')]=[{'all':!![]}];}return db[_0xf7c7('0x26')]['findAll'](_0x21d90f);})[_0xf7c7('0x20')](function(_0x3a122a){_0x2ddf40[_0xf7c7('0x3e')]=_0x3a122a;return _0x2ddf40;})[_0xf7c7('0x20')](respondWithFilteredResult(_0x446350,_0x21d90f))['catch'](handleError(_0x446350,null));};exports[_0xf7c7('0x3f')]=function(_0x5379d9,_0x4365e1){var _0x4ffde0={'raw':!![],'where':{'id':_0x5379d9['params']['id']}},_0x2aa9fe={};_0x2aa9fe['model']=_[_0xf7c7('0x2c')](db['DeskField'][_0xf7c7('0x27')]);_0x2aa9fe[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x5379d9[_0xf7c7('0x2b')]);_0x2aa9fe[_0xf7c7('0x36')]=_['intersection'](_0x2aa9fe[_0xf7c7('0x2a')],_0x2aa9fe[_0xf7c7('0x2b')]);_0x4ffde0[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x2aa9fe[_0xf7c7('0x2a')],qs['fields'](_0x5379d9[_0xf7c7('0x2b')]['fields']));_0x4ffde0[_0xf7c7('0x2e')]=_0x4ffde0['attributes'][_0xf7c7('0x30')]?_0x4ffde0[_0xf7c7('0x2e')]:_0x2aa9fe[_0xf7c7('0x2a')];if(_0x5379d9[_0xf7c7('0x2b')][_0xf7c7('0x40')]){_0x4ffde0[_0xf7c7('0x3d')]=[{'all':!![]}];}_0x4ffde0=_[_0xf7c7('0x39')]({},_0x4ffde0,_0x5379d9[_0xf7c7('0x3c')]);return db[_0xf7c7('0x26')]['find'](_0x4ffde0)[_0xf7c7('0x20')](handleEntityNotFound(_0x4365e1,null))['then'](respondWithResult(_0x4365e1,null))['catch'](handleError(_0x4365e1,null));};exports[_0xf7c7('0x41')]=function(_0x37d9e1,_0xd6aafa){return db[_0xf7c7('0x26')][_0xf7c7('0x41')](_0x37d9e1['body'],{})[_0xf7c7('0x20')](respondWithResult(_0xd6aafa,0xc9))[_0xf7c7('0x42')](handleError(_0xd6aafa,null));};exports['update']=function(_0x51d3fa,_0x58e349){if(_0x51d3fa[_0xf7c7('0x43')]['id']){delete _0x51d3fa[_0xf7c7('0x43')]['id'];}return db['DeskField'][_0xf7c7('0x44')]({'where':{'id':_0x51d3fa[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x20')](handleEntityNotFound(_0x58e349,null))['then'](saveUpdates(_0x51d3fa[_0xf7c7('0x43')],null))['then'](respondWithResult(_0x58e349,null))[_0xf7c7('0x42')](handleError(_0x58e349,null));};exports[_0xf7c7('0x46')]=function(_0x3dbd2a,_0x222434){return db['DeskField'][_0xf7c7('0x44')]({'where':{'id':_0x3dbd2a[_0xf7c7('0x45')]['id']}})[_0xf7c7('0x20')](handleEntityNotFound(_0x222434,null))[_0xf7c7('0x20')](removeEntity(_0x222434,null))[_0xf7c7('0x42')](handleError(_0x222434,null));}; \ No newline at end of file +var _0x195f=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','Content-Range','save','update','then','destroy','end','sendStatus','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x36c87f,_0x508f45){var _0xc18463=function(_0x230aae){while(--_0x230aae){_0x36c87f['push'](_0x36c87f['shift']());}};_0xc18463(++_0x508f45);}(_0x195f,0x113));var _0xf195=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x195f[_0x3d2e4b];return _0x509e78;};'use strict';var emlformat=require(_0xf195('0x0'));var rimraf=require(_0xf195('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf195('0x2'));var rp=require(_0xf195('0x3'));var moment=require('moment');var BPromise=require(_0xf195('0x4'));var Mustache=require('mustache');var util=require(_0xf195('0x5'));var path=require(_0xf195('0x6'));var sox=require(_0xf195('0x7'));var csv=require(_0xf195('0x8'));var ejs=require(_0xf195('0x9'));var fs=require('fs');var fs_extra=require(_0xf195('0xa'));var _=require(_0xf195('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf195('0xc'));var deskjs=require(_0xf195('0xd'));var toCsv=require(_0xf195('0x8'));var querystring=require(_0xf195('0xe'));var Papa=require(_0xf195('0xf'));var Redis=require(_0xf195('0x10'));var authService=require(_0xf195('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf195('0x12'));var hardwareService=require(_0xf195('0x13'));var logger=require(_0xf195('0x14'))('api');var utils=require(_0xf195('0x15'));var config=require(_0xf195('0x16'));var licenseUtil=require(_0xf195('0x17'));var db=require(_0xf195('0x18'))['db'];function respondWithStatusCode(_0x48c9d9,_0x3e12f4){_0x3e12f4=_0x3e12f4||0xcc;return function(_0x33844b){if(_0x33844b){return _0x48c9d9['sendStatus'](_0x3e12f4);}return _0x48c9d9[_0xf195('0x19')](_0x3e12f4)['end']();};}function respondWithResult(_0x3d06cc,_0x9c114){_0x9c114=_0x9c114||0xc8;return function(_0x345a44){if(_0x345a44){return _0x3d06cc[_0xf195('0x19')](_0x9c114)[_0xf195('0x1a')](_0x345a44);}};}function respondWithFilteredResult(_0x33b5c4,_0x5041fd){return function(_0xe76164){if(_0xe76164){var _0x4c1956=typeof _0x5041fd['offset']===_0xf195('0x1b')&&typeof _0x5041fd[_0xf195('0x1c')]===_0xf195('0x1b');var _0x321bd7=_0xe76164['count'];var _0x374fc6=_0x4c1956?0x0:_0x5041fd[_0xf195('0x1d')];var _0x5cf7dc=_0x4c1956?_0xe76164[_0xf195('0x1e')]:_0x5041fd[_0xf195('0x1d')]+_0x5041fd['limit'];var _0x15acd6;if(_0x5cf7dc>=_0x321bd7){_0x5cf7dc=_0x321bd7;_0x15acd6=0xc8;}else{_0x15acd6=0xce;}_0x33b5c4[_0xf195('0x19')](_0x15acd6);return _0x33b5c4['set'](_0xf195('0x1f'),_0x374fc6+'-'+_0x5cf7dc+'/'+_0x321bd7)[_0xf195('0x1a')](_0xe76164);}return null;};}function patchUpdates(_0x421cab){return function(_0x1eea05){try{jsonpatch['apply'](_0x1eea05,_0x421cab,!![]);}catch(_0x5933f0){return BPromise['reject'](_0x5933f0);}return _0x1eea05[_0xf195('0x20')]();};}function saveUpdates(_0x1b2821,_0x388c36){return function(_0x785aae){if(_0x785aae){return _0x785aae[_0xf195('0x21')](_0x1b2821)[_0xf195('0x22')](function(_0x3d3d14){return _0x3d3d14;});}return null;};}function removeEntity(_0x1ee8d6,_0x45cfa4){return function(_0x255d58){if(_0x255d58){return _0x255d58[_0xf195('0x23')]()[_0xf195('0x22')](function(){_0x1ee8d6['status'](0xcc)[_0xf195('0x24')]();});}};}function handleEntityNotFound(_0x246750,_0x3dddd3){return function(_0x2ae42e){if(!_0x2ae42e){_0x246750[_0xf195('0x25')](0x194);}return _0x2ae42e;};}function handleError(_0x23484e,_0x1ea31a){_0x1ea31a=_0x1ea31a||0x1f4;return function(_0x3c1371){logger['error'](_0x3c1371['stack']);if(_0x3c1371[_0xf195('0x26')]){delete _0x3c1371[_0xf195('0x26')];}_0x23484e[_0xf195('0x19')](_0x1ea31a)[_0xf195('0x27')](_0x3c1371);};}exports[_0xf195('0x28')]=function(_0x37b3c6,_0x408e3b){var _0x3c592e={},_0x5dbca={},_0x7d3a34={'count':0x0,'rows':[]};var _0xe3465f=_[_0xf195('0x29')](db[_0xf195('0x2a')][_0xf195('0x2b')],function(_0xdb8e93){return{'name':_0xdb8e93[_0xf195('0x2c')],'type':_0xdb8e93[_0xf195('0x2d')][_0xf195('0x2e')]};});_0x5dbca[_0xf195('0x2f')]=_['map'](_0xe3465f,_0xf195('0x26'));_0x5dbca[_0xf195('0x30')]=_[_0xf195('0x31')](_0x37b3c6[_0xf195('0x30')]);_0x5dbca[_0xf195('0x32')]=_[_0xf195('0x33')](_0x5dbca[_0xf195('0x2f')],_0x5dbca[_0xf195('0x30')]);_0x3c592e[_0xf195('0x34')]=_[_0xf195('0x33')](_0x5dbca[_0xf195('0x2f')],qs[_0xf195('0x35')](_0x37b3c6[_0xf195('0x30')][_0xf195('0x35')]));_0x3c592e[_0xf195('0x34')]=_0x3c592e[_0xf195('0x34')][_0xf195('0x36')]?_0x3c592e['attributes']:_0x5dbca[_0xf195('0x2f')];if(!_0x37b3c6[_0xf195('0x30')][_0xf195('0x37')](_0xf195('0x38'))){_0x3c592e[_0xf195('0x1c')]=qs['limit'](_0x37b3c6[_0xf195('0x30')][_0xf195('0x1c')]);_0x3c592e[_0xf195('0x1d')]=qs['offset'](_0x37b3c6['query'][_0xf195('0x1d')]);}_0x3c592e[_0xf195('0x39')]=qs[_0xf195('0x3a')](_0x37b3c6[_0xf195('0x30')][_0xf195('0x3a')]);_0x3c592e[_0xf195('0x3b')]=qs[_0xf195('0x32')](_[_0xf195('0x3c')](_0x37b3c6[_0xf195('0x30')],_0x5dbca[_0xf195('0x32')]),_0xe3465f);if(_0x37b3c6['query']['filter']){_0x3c592e[_0xf195('0x3b')]=_[_0xf195('0x3d')](_0x3c592e[_0xf195('0x3b')],{'$or':_[_0xf195('0x29')](_0xe3465f,function(_0x4059b3){if(_0x4059b3[_0xf195('0x2d')]!==_0xf195('0x3e')){var _0x34f3ce={};_0x34f3ce[_0x4059b3['name']]={'$like':'%'+_0x37b3c6[_0xf195('0x30')]['filter']+'%'};return _0x34f3ce;}})});}_0x3c592e=_['merge']({},_0x3c592e,_0x37b3c6[_0xf195('0x3f')]);var _0x83c396={'where':_0x3c592e[_0xf195('0x3b')]};return db[_0xf195('0x2a')][_0xf195('0x1e')](_0x83c396)[_0xf195('0x22')](function(_0x7f9360){_0x7d3a34[_0xf195('0x1e')]=_0x7f9360;if(_0x37b3c6[_0xf195('0x30')][_0xf195('0x40')]){_0x3c592e[_0xf195('0x41')]=[{'all':!![]}];}return db[_0xf195('0x2a')][_0xf195('0x42')](_0x3c592e);})[_0xf195('0x22')](function(_0x49edfb){_0x7d3a34['rows']=_0x49edfb;return _0x7d3a34;})[_0xf195('0x22')](respondWithFilteredResult(_0x408e3b,_0x3c592e))[_0xf195('0x43')](handleError(_0x408e3b,null));};exports[_0xf195('0x44')]=function(_0x6b22ec,_0x382fd9){var _0x1907ce={'raw':!![],'where':{'id':_0x6b22ec[_0xf195('0x45')]['id']}},_0x343f3e={};_0x343f3e['model']=_[_0xf195('0x31')](db[_0xf195('0x2a')][_0xf195('0x2b')]);_0x343f3e[_0xf195('0x30')]=_[_0xf195('0x31')](_0x6b22ec[_0xf195('0x30')]);_0x343f3e[_0xf195('0x32')]=_['intersection'](_0x343f3e[_0xf195('0x2f')],_0x343f3e[_0xf195('0x30')]);_0x1907ce['attributes']=_[_0xf195('0x33')](_0x343f3e['model'],qs[_0xf195('0x35')](_0x6b22ec[_0xf195('0x30')][_0xf195('0x35')]));_0x1907ce['attributes']=_0x1907ce[_0xf195('0x34')][_0xf195('0x36')]?_0x1907ce['attributes']:_0x343f3e[_0xf195('0x2f')];if(_0x6b22ec[_0xf195('0x30')][_0xf195('0x40')]){_0x1907ce[_0xf195('0x41')]=[{'all':!![]}];}_0x1907ce=_[_0xf195('0x3d')]({},_0x1907ce,_0x6b22ec['options']);return db[_0xf195('0x2a')][_0xf195('0x46')](_0x1907ce)[_0xf195('0x22')](handleEntityNotFound(_0x382fd9,null))[_0xf195('0x22')](respondWithResult(_0x382fd9,null))[_0xf195('0x43')](handleError(_0x382fd9,null));};exports[_0xf195('0x47')]=function(_0x2362da,_0x30fc9b){return db['DeskField'][_0xf195('0x47')](_0x2362da['body'],{})[_0xf195('0x22')](respondWithResult(_0x30fc9b,0xc9))[_0xf195('0x43')](handleError(_0x30fc9b,null));};exports[_0xf195('0x21')]=function(_0x42f895,_0x2e56ea){if(_0x42f895[_0xf195('0x48')]['id']){delete _0x42f895[_0xf195('0x48')]['id'];}return db[_0xf195('0x2a')]['find']({'where':{'id':_0x42f895[_0xf195('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e56ea,null))[_0xf195('0x22')](saveUpdates(_0x42f895[_0xf195('0x48')],null))[_0xf195('0x22')](respondWithResult(_0x2e56ea,null))[_0xf195('0x43')](handleError(_0x2e56ea,null));};exports[_0xf195('0x23')]=function(_0x586275,_0x33a0a6){return db[_0xf195('0x2a')][_0xf195('0x46')]({'where':{'id':_0x586275[_0xf195('0x45')]['id']}})['then'](handleEntityNotFound(_0x33a0a6,null))[_0xf195('0x22')](removeEntity(_0x33a0a6,null))[_0xf195('0x43')](handleError(_0x33a0a6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c95c3df..a14945b 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 _0x7612=['api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','../../config/logger'];(function(_0x4c699f,_0x44cc11){var _0x34bc34=function(_0x336097){while(--_0x336097){_0x4c699f['push'](_0x4c699f['shift']());}};_0x34bc34(++_0x44cc11);}(_0x7612,0x1df));var _0x2761=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x7612[_0x2d8d69];return _0x39ae22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2761('0x0'))(_0x2761('0x1'));var moment=require(_0x2761('0x2'));var BPromise=require('bluebird');var rp=require(_0x2761('0x3'));var fs=require('fs');var path=require(_0x2761('0x4'));var rimraf=require(_0x2761('0x5'));var config=require(_0x2761('0x6'));var attributes=require(_0x2761('0x7'));module[_0x2761('0x8')]=function(_0x3b2b76,_0x2575d5){return _0x3b2b76[_0x2761('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2761('0xa'),'fields':[_0x2761('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb47=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util'];(function(_0x1ff868,_0x438bf9){var _0x1ad847=function(_0xf849f8){while(--_0xf849f8){_0x1ff868['push'](_0x1ff868['shift']());}};_0x1ad847(++_0x438bf9);}(_0xeb47,0x13e));var _0x7eb4=function(_0x1ade0b,_0x3fe223){_0x1ade0b=_0x1ade0b-0x0;var _0x417d1e=_0xeb47[_0x1ade0b];return _0x417d1e;};'use strict';var _=require(_0x7eb4('0x0'));var util=require(_0x7eb4('0x1'));var logger=require(_0x7eb4('0x2'))(_0x7eb4('0x3'));var moment=require(_0x7eb4('0x4'));var BPromise=require(_0x7eb4('0x5'));var rp=require(_0x7eb4('0x6'));var fs=require('fs');var path=require(_0x7eb4('0x7'));var rimraf=require('rimraf');var config=require(_0x7eb4('0x8'));var attributes=require(_0x7eb4('0x9'));module[_0x7eb4('0xa')]=function(_0x1bc46b,_0x320e8a){return _0x1bc46b[_0x7eb4('0xb')](_0x7eb4('0xc'),attributes,{'tableName':_0x7eb4('0xd'),'paranoid':![],'indexes':[{'name':_0x7eb4('0xe'),'fields':['idField',_0x7eb4('0xf')],'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 a434572..b0c46ec 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 _0xa506=['then','DeskField,\x20%s,\x20%s','request\x20sent','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x29afe7,_0x335185){var _0x23c00f=function(_0x370a1d){while(--_0x370a1d){_0x29afe7['push'](_0x29afe7['shift']());}};_0x23c00f(++_0x335185);}(_0xa506,0x9e));var _0x6a50=function(_0x541b38,_0x52440d){_0x541b38=_0x541b38-0x0;var _0x1ff587=_0xa506[_0x541b38];return _0x1ff587;};'use strict';var _=require(_0x6a50('0x0'));var util=require('util');var moment=require(_0x6a50('0x1'));var BPromise=require(_0x6a50('0x2'));var rs=require(_0x6a50('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a50('0x4'))['db'];var utils=require(_0x6a50('0x5'));var logger=require(_0x6a50('0x6'))(_0x6a50('0x7'));var config=require(_0x6a50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a50('0x9')][_0x6a50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b6fb8,_0x559e39,_0x2b0012){return new BPromise(function(_0x3bec5a,_0x47bed4){return client[_0x6a50('0xb')](_0x2b6fb8,_0x2b0012)[_0x6a50('0xc')](function(_0x46c93b){logger['info'](_0x6a50('0xd'),_0x559e39,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x559e39,_0x6a50('0xe'),JSON['stringify'](_0x46c93b));if(_0x46c93b[_0x6a50('0xf')]){if(_0x46c93b[_0x6a50('0xf')]['code']===0x1f4){logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x46c93b[_0x6a50('0xf')][_0x6a50('0x10')]);return _0x47bed4(_0x46c93b['error'][_0x6a50('0x10')]);}logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x46c93b['error']['message']);return _0x3bec5a(_0x46c93b[_0x6a50('0xf')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x559e39,_0x6a50('0xe'));_0x3bec5a(_0x46c93b['result'][_0x6a50('0x10')]);}})['catch'](function(_0x32177b){logger[_0x6a50('0xf')](_0x6a50('0xd'),_0x559e39,_0x32177b);_0x47bed4(_0x32177b);});});} \ No newline at end of file +var _0x96de=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x181940,_0x2c7136){var _0x64e36c=function(_0x3721a9){while(--_0x3721a9){_0x181940['push'](_0x181940['shift']());}};_0x64e36c(++_0x2c7136);}(_0x96de,0x8a));var _0xe96d=function(_0x38b74a,_0x495f4){_0x38b74a=_0x38b74a-0x0;var _0x18226a=_0x96de[_0x38b74a];return _0x18226a;};'use strict';var _=require(_0xe96d('0x0'));var util=require(_0xe96d('0x1'));var moment=require(_0xe96d('0x2'));var BPromise=require(_0xe96d('0x3'));var rs=require(_0xe96d('0x4'));var fs=require('fs');var Redis=require(_0xe96d('0x5'));var db=require(_0xe96d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe96d('0x7'))(_0xe96d('0x8'));var config=require(_0xe96d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe96d('0xa')][_0xe96d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d82c,_0x2db7a4,_0x5a1f3e){return new BPromise(function(_0x6505c1,_0x457335){return client[_0xe96d('0xc')](_0x21d82c,_0x5a1f3e)[_0xe96d('0xd')](function(_0x3885a2){logger[_0xe96d('0xe')](_0xe96d('0xf'),_0x2db7a4,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x2db7a4,_0xe96d('0x10'),JSON[_0xe96d('0x11')](_0x3885a2));if(_0x3885a2[_0xe96d('0x12')]){if(_0x3885a2[_0xe96d('0x12')][_0xe96d('0x13')]===0x1f4){logger['error'](_0xe96d('0xf'),_0x2db7a4,_0x3885a2['error'][_0xe96d('0x14')]);return _0x457335(_0x3885a2[_0xe96d('0x12')][_0xe96d('0x14')]);}logger['error'](_0xe96d('0xf'),_0x2db7a4,_0x3885a2[_0xe96d('0x12')][_0xe96d('0x14')]);return _0x6505c1(_0x3885a2[_0xe96d('0x12')][_0xe96d('0x14')]);}else{logger[_0xe96d('0xe')](_0xe96d('0xf'),_0x2db7a4,_0xe96d('0x10'));_0x6505c1(_0x3885a2[_0xe96d('0x15')][_0xe96d('0x14')]);}})[_0xe96d('0x16')](function(_0x39b66f){logger[_0xe96d('0x12')](_0xe96d('0xf'),_0x2db7a4,_0x39b66f);_0x457335(_0x39b66f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 42d89a1..104e1d9 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 _0x6882=['fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e38a4,_0x333514){var _0x401332=function(_0x18cd85){while(--_0x18cd85){_0x5e38a4['push'](_0x5e38a4['shift']());}};_0x401332(++_0x333514);}(_0x6882,0x1c6));var _0x2688=function(_0x3e1c0c,_0x2056ff){_0x3e1c0c=_0x3e1c0c-0x0;var _0x5d051a=_0x6882[_0x3e1c0c];return _0x5d051a;};'use strict';var multer=require(_0x2688('0x0'));var util=require(_0x2688('0x1'));var path=require(_0x2688('0x2'));var timeout=require(_0x2688('0x3'));var express=require(_0x2688('0x4'));var router=express[_0x2688('0x5')]();var fs_extra=require(_0x2688('0x6'));var auth=require(_0x2688('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2688('0x8'));var controller=require(_0x2688('0x9'));router[_0x2688('0xa')]('/',auth[_0x2688('0xb')](),controller['index']);router[_0x2688('0xa')](_0x2688('0xc'),auth[_0x2688('0xb')](),controller[_0x2688('0xd')]);router[_0x2688('0xa')](_0x2688('0xe'),auth[_0x2688('0xb')](),controller[_0x2688('0xf')]);router[_0x2688('0xa')](_0x2688('0x10'),auth[_0x2688('0xb')](),controller[_0x2688('0x11')]);router[_0x2688('0x12')]('/',auth[_0x2688('0xb')](),controller['create']);router[_0x2688('0x12')](_0x2688('0xe'),auth[_0x2688('0xb')](),controller['addConfiguration']);router[_0x2688('0x13')]('/:id',auth[_0x2688('0xb')](),controller[_0x2688('0x14')]);router[_0x2688('0x15')]('/:id',auth[_0x2688('0xb')](),controller['destroy']);module[_0x2688('0x16')]=router; \ No newline at end of file +var _0xf653=['getFields','create','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intDynamics365Account.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf653,0x11c));var _0x3f65=function(_0x303e50,_0x329edb){_0x303e50=_0x303e50-0x0;var _0xcb3d93=_0xf653[_0x303e50];return _0xcb3d93;};'use strict';var multer=require(_0x3f65('0x0'));var util=require(_0x3f65('0x1'));var path=require(_0x3f65('0x2'));var timeout=require(_0x3f65('0x3'));var express=require(_0x3f65('0x4'));var router=express[_0x3f65('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3f65('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f65('0x7'));router['get']('/',auth[_0x3f65('0x8')](),controller[_0x3f65('0x9')]);router[_0x3f65('0xa')]('/:id',auth[_0x3f65('0x8')](),controller[_0x3f65('0xb')]);router['get'](_0x3f65('0xc'),auth['isAuthenticated'](),controller[_0x3f65('0xd')]);router[_0x3f65('0xa')](_0x3f65('0xe'),auth[_0x3f65('0x8')](),controller[_0x3f65('0xf')]);router['post']('/',auth[_0x3f65('0x8')](),controller[_0x3f65('0x10')]);router[_0x3f65('0x11')](_0x3f65('0xc'),auth[_0x3f65('0x8')](),controller['addConfiguration']);router['put'](_0x3f65('0x12'),auth[_0x3f65('0x8')](),controller[_0x3f65('0x13')]);router[_0x3f65('0x14')](_0x3f65('0x12'),auth[_0x3f65('0x8')](),controller[_0x3f65('0x15')]);module[_0x3f65('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index af741ae..3d0183f 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 _0x1a0b=['sequelize','STRING','BOOLEAN'];(function(_0x504916,_0x1b3438){var _0x2745b6=function(_0x2cf9f0){while(--_0x2cf9f0){_0x504916['push'](_0x504916['shift']());}};_0x2745b6(++_0x1b3438);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x2cc94f,_0x4bddc2){_0x2cc94f=_0x2cc94f-0x0;var _0x93d0e5=_0x1a0b[_0x2cc94f];return _0x93d0e5;};'use strict';var Sequelize=require(_0xb1a0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1a0('0x1')]},'username':{'type':Sequelize[_0xb1a0('0x1')]},'password':{'type':Sequelize[_0xb1a0('0x1')]},'remoteUri':{'type':Sequelize[_0xb1a0('0x1')]},'tenantId':{'type':Sequelize[_0xb1a0('0x1')]},'clientId':{'type':Sequelize[_0xb1a0('0x1')]},'clientSecret':{'type':Sequelize[_0xb1a0('0x1')]},'serverUrl':{'type':Sequelize[_0xb1a0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb1a0('0x1')]},'modernAuthentication':{'type':Sequelize[_0xb1a0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xef17=['STRING','sequelize','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xef17,0x136));var _0x7ef1=function(_0x554cd3,_0x2459f9){_0x554cd3=_0x554cd3-0x0;var _0x2a3506=_0xef17[_0x554cd3];return _0x2a3506;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')]},'username':{'type':Sequelize[_0x7ef1('0x2')]},'password':{'type':Sequelize[_0x7ef1('0x2')]},'remoteUri':{'type':Sequelize[_0x7ef1('0x2')]},'tenantId':{'type':Sequelize[_0x7ef1('0x2')]},'clientId':{'type':Sequelize[_0x7ef1('0x2')]},'clientSecret':{'type':Sequelize[_0x7ef1('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7ef1('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fe282e0..2b9c861 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 _0x0312=['getDescriptions','Dynamics365Field','slice','lastIndexOf','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidyominame','productidname','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','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','LogicalName','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','@odata.type','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel',')/Attributes(','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','Subjects','channel','Descriptions'];(function(_0xbce8a,_0x240b7d){var _0x1daaa8=function(_0x3be06d){while(--_0x3be06d){_0xbce8a['push'](_0xbce8a['shift']());}};_0x1daaa8(++_0x240b7d);}(_0x0312,0x7d));var _0x2031=function(_0x210d5a,_0x1ef622){_0x210d5a=_0x210d5a-0x0;var _0x489236=_0x0312[_0x210d5a];return _0x489236;};'use strict';var rp=require('request-promise');var util=require(_0x2031('0x0'));var _=require(_0x2031('0x1'));var qs=require(_0x2031('0x2'));var logger=require('../../config/logger')(_0x2031('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2031('0x4'));function respondWithResult(_0x5718dc,_0x5955e0){_0x5955e0=_0x5955e0||0xc8;return function(_0x5293e1){if(_0x5293e1){return _0x5718dc[_0x2031('0x5')](_0x5955e0)[_0x2031('0x6')](_0x5293e1);}};}function respondWithFilteredResult(_0x2c7704,_0x208bc9){return function(_0x1b2e6b){if(_0x1b2e6b){var _0x3c12b5=typeof _0x208bc9[_0x2031('0x7')]==='undefined'&&typeof _0x208bc9[_0x2031('0x8')]===_0x2031('0x9');var _0x4f14cf=_0x1b2e6b[_0x2031('0xa')];var _0x26d6c4=_0x3c12b5?0x0:_0x208bc9[_0x2031('0x7')];var _0x19b688=_0x3c12b5?_0x1b2e6b[_0x2031('0xa')]:_0x208bc9['offset']+_0x208bc9['limit'];var _0x12d02f;if(_0x19b688>=_0x4f14cf){_0x19b688=_0x4f14cf;_0x12d02f=0xc8;}else{_0x12d02f=0xce;}_0x2c7704[_0x2031('0x5')](_0x12d02f);return _0x2c7704['set'](_0x2031('0xb'),_0x26d6c4+'-'+_0x19b688+'/'+_0x4f14cf)[_0x2031('0x6')](_0x1b2e6b);}return null;};}function saveUpdates(_0x5c1d7c){return function(_0x51c032){if(_0x51c032){return _0x51c032[_0x2031('0xc')](_0x5c1d7c)[_0x2031('0xd')](function(_0x104bec){return _0x104bec;});}return null;};}function removeEntity(_0xea2ee6){return function(_0x3a9f3e){if(_0x3a9f3e){return _0x3a9f3e[_0x2031('0xe')]()[_0x2031('0xd')](function(){_0xea2ee6[_0x2031('0x5')](0xcc)[_0x2031('0xf')]();});}};}function handleEntityNotFound(_0x593971){return function(_0x1f668f){if(!_0x1f668f){_0x593971[_0x2031('0x10')](0x194);}return _0x1f668f;};}function handleError(_0x5d64de,_0x42bdaf){_0x42bdaf=_0x42bdaf||0x1f4;return function(_0x53d42f){logger[_0x2031('0x11')](_0x53d42f[_0x2031('0x12')]);if(_0x53d42f[_0x2031('0x13')]){delete _0x53d42f['name'];}_0x5d64de[_0x2031('0x5')](_0x42bdaf)['send'](_0x53d42f);};}exports[_0x2031('0x14')]=function(_0x3a0d06,_0x10bc65){var _0x3d8b66={},_0x5cabc4={},_0x36aa4d={'count':0x0,'rows':[]};var _0x52288d=_['map'](db[_0x2031('0x15')][_0x2031('0x16')],function(_0x2f6ea7){return{'name':_0x2f6ea7['fieldName'],'type':_0x2f6ea7[_0x2031('0x17')][_0x2031('0x18')]};});_0x5cabc4['model']=_[_0x2031('0x19')](_0x52288d,_0x2031('0x13'));_0x5cabc4[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x3a0d06['query']);_0x5cabc4[_0x2031('0x1c')]=_['intersection'](_0x5cabc4[_0x2031('0x1d')],_0x5cabc4[_0x2031('0x1a')]);_0x3d8b66[_0x2031('0x1e')]=_[_0x2031('0x1f')](_0x5cabc4[_0x2031('0x1d')],qs['fields'](_0x3a0d06[_0x2031('0x1a')]['fields']));_0x3d8b66['attributes']=_0x3d8b66[_0x2031('0x1e')][_0x2031('0x20')]?_0x3d8b66['attributes']:_0x5cabc4[_0x2031('0x1d')];if(!_0x3a0d06[_0x2031('0x1a')][_0x2031('0x21')]('nolimit')){_0x3d8b66[_0x2031('0x8')]=qs['limit'](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x8')]);_0x3d8b66[_0x2031('0x7')]=qs['offset'](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x7')]);}_0x3d8b66[_0x2031('0x22')]=qs[_0x2031('0x23')](_0x3a0d06[_0x2031('0x1a')][_0x2031('0x23')]);_0x3d8b66['where']=qs[_0x2031('0x1c')](_[_0x2031('0x24')](_0x3a0d06[_0x2031('0x1a')],_0x5cabc4[_0x2031('0x1c')]),_0x52288d);if(_0x3a0d06[_0x2031('0x1a')]['filter']){_0x3d8b66[_0x2031('0x25')]=_[_0x2031('0x26')](_0x3d8b66[_0x2031('0x25')],{'$or':_[_0x2031('0x19')](_0x52288d,function(_0x4e35a9){if(_0x4e35a9[_0x2031('0x17')]!==_0x2031('0x27')){var _0x480ab3={};_0x480ab3[_0x4e35a9[_0x2031('0x13')]]={'$like':'%'+_0x3a0d06['query'][_0x2031('0x28')]+'%'};return _0x480ab3;}})});}_0x3d8b66=_['merge']({},_0x3d8b66,_0x3a0d06[_0x2031('0x29')]);var _0x5508de={'where':_0x3d8b66['where']};return db['Dynamics365Account'][_0x2031('0xa')](_0x5508de)[_0x2031('0xd')](function(_0x1a06f0){_0x36aa4d[_0x2031('0xa')]=_0x1a06f0;if(_0x3a0d06[_0x2031('0x1a')][_0x2031('0x2a')]){_0x3d8b66['include']=[{'all':!![]}];}return db[_0x2031('0x15')][_0x2031('0x2b')](_0x3d8b66);})[_0x2031('0xd')](function(_0x99ddb2){_0x36aa4d[_0x2031('0x2c')]=_0x99ddb2;return _0x36aa4d;})['then'](respondWithFilteredResult(_0x10bc65,_0x3d8b66))[_0x2031('0x2d')](handleError(_0x10bc65,null));};exports['show']=function(_0x43b7b6,_0x256ec5){var _0xb61876={'raw':![],'where':{'id':_0x43b7b6[_0x2031('0x2e')]['id']}},_0xdbdd28={};_0xdbdd28[_0x2031('0x1d')]=_['keys'](db[_0x2031('0x15')][_0x2031('0x16')]);_0xdbdd28[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x43b7b6[_0x2031('0x1a')]);_0xdbdd28['filters']=_[_0x2031('0x1f')](_0xdbdd28[_0x2031('0x1d')],_0xdbdd28['query']);_0xb61876[_0x2031('0x1e')]=_[_0x2031('0x1f')](_0xdbdd28[_0x2031('0x1d')],qs[_0x2031('0x2f')](_0x43b7b6['query'][_0x2031('0x2f')]));_0xb61876[_0x2031('0x1e')]=_0xb61876[_0x2031('0x1e')][_0x2031('0x20')]?_0xb61876[_0x2031('0x1e')]:_0xdbdd28[_0x2031('0x1d')];if(_0x43b7b6[_0x2031('0x1a')]['includeAll']){_0xb61876[_0x2031('0x30')]=[{'all':!![]}];}_0xb61876=_[_0x2031('0x26')]({},_0xb61876,_0x43b7b6[_0x2031('0x29')]);return db[_0x2031('0x15')][_0x2031('0x31')](_0xb61876)[_0x2031('0xd')](handleEntityNotFound(_0x256ec5,null))['then'](respondWithResult(_0x256ec5,null))[_0x2031('0x2d')](handleError(_0x256ec5,null));};exports[_0x2031('0x32')]=function(_0x4bb8ff,_0x55d43f){return db[_0x2031('0x15')][_0x2031('0x32')](_0x4bb8ff[_0x2031('0x33')],{})['then'](respondWithResult(_0x55d43f,0xc9))[_0x2031('0x2d')](handleError(_0x55d43f,null));};exports[_0x2031('0xc')]=function(_0x3e396f,_0x1c8df9){if(_0x3e396f[_0x2031('0x33')]['id']){delete _0x3e396f[_0x2031('0x33')]['id'];}return db['Dynamics365Account'][_0x2031('0x31')]({'where':{'id':_0x3e396f['params']['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x1c8df9,null))[_0x2031('0xd')](saveUpdates(_0x3e396f['body'],null))['then'](respondWithResult(_0x1c8df9,null))[_0x2031('0x2d')](handleError(_0x1c8df9,null));};exports[_0x2031('0xe')]=function(_0x2fedc5,_0x5bad37){return db[_0x2031('0x15')][_0x2031('0x31')]({'where':{'id':_0x2fedc5['params']['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x5bad37,null))['then'](removeEntity(_0x5bad37,null))['catch'](handleError(_0x5bad37,null));};exports[_0x2031('0x34')]=function(_0x498060,_0x251c68){var _0x5a6d08={};var _0x4ac6fe={};var _0x33a892;var _0x3a2acd;return db['Dynamics365Account'][_0x2031('0x35')]({'where':{'id':_0x498060[_0x2031('0x2e')]['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x251c68,null))[_0x2031('0xd')](function(_0x14e2eb){if(_0x14e2eb){_0x33a892=_0x14e2eb;_0x4ac6fe[_0x2031('0x1d')]=_[_0x2031('0x1b')](db[_0x2031('0x36')][_0x2031('0x16')]);_0x4ac6fe[_0x2031('0x1a')]=_[_0x2031('0x1b')](_0x498060['query']);_0x4ac6fe[_0x2031('0x1c')]=_[_0x2031('0x1f')](_0x4ac6fe[_0x2031('0x1d')],_0x4ac6fe[_0x2031('0x1a')]);_0x5a6d08[_0x2031('0x1e')]=_['intersection'](_0x4ac6fe[_0x2031('0x1d')],qs[_0x2031('0x2f')](_0x498060[_0x2031('0x1a')][_0x2031('0x2f')]));_0x5a6d08[_0x2031('0x1e')]=_0x5a6d08[_0x2031('0x1e')][_0x2031('0x20')]?_0x5a6d08[_0x2031('0x1e')]:_0x4ac6fe[_0x2031('0x1d')];_0x5a6d08[_0x2031('0x22')]=qs[_0x2031('0x23')](_0x498060['query']['sort']);_0x5a6d08[_0x2031('0x25')]=qs['filters'](_['pick'](_0x498060['query'],_0x4ac6fe[_0x2031('0x1c')]));if(_0x498060[_0x2031('0x1a')][_0x2031('0x28')]){_0x5a6d08['where']=_['merge'](_0x5a6d08[_0x2031('0x25')],{'$or':_[_0x2031('0x19')](_0x5a6d08['attributes'],function(_0x26b39a){var _0x3dc070={};_0x3dc070[_0x26b39a]={'$like':'%'+_0x498060[_0x2031('0x1a')][_0x2031('0x28')]+'%'};return _0x3dc070;})});}_0x5a6d08=_[_0x2031('0x26')]({},_0x5a6d08,_0x498060[_0x2031('0x29')]);return _0x33a892[_0x2031('0x34')](_0x5a6d08);}})[_0x2031('0xd')](function(_0xf86d2){if(_0xf86d2){_0x3a2acd=_0xf86d2['length'];if(!_0x498060['query']['hasOwnProperty'](_0x2031('0x37'))){_0x5a6d08[_0x2031('0x8')]=qs[_0x2031('0x8')](_0x498060[_0x2031('0x1a')][_0x2031('0x8')]);_0x5a6d08['offset']=qs[_0x2031('0x7')](_0x498060[_0x2031('0x1a')]['offset']);}return _0x33a892['getConfigurations'](_0x5a6d08);}})[_0x2031('0xd')](function(_0x31a838){if(_0x31a838){return _0x31a838?{'count':_0x3a2acd,'rows':_0x31a838}:null;}})[_0x2031('0xd')](respondWithResult(_0x251c68,null))[_0x2031('0x2d')](handleError(_0x251c68,null));};exports['addConfiguration']=function(_0x267758,_0x48f1bf){if(_0x267758['body']['id']){delete _0x267758['body']['id'];}return db[_0x2031('0x15')][_0x2031('0x35')]({'where':{'id':_0x267758[_0x2031('0x2e')]['id']}})[_0x2031('0xd')](handleEntityNotFound(_0x48f1bf,null))[_0x2031('0xd')](function(_0x4de4d8){if(_0x4de4d8){_0x267758[_0x2031('0x33')]['AccountId']=_0x4de4d8['id'];_0x267758[_0x2031('0x33')][_0x2031('0x38')]=integrations['getSubjects'](_0x267758[_0x2031('0x33')][_0x2031('0x39')],_0x267758['body'][_0x2031('0x17')]);_0x267758[_0x2031('0x33')][_0x2031('0x3a')]=integrations[_0x2031('0x3b')](_0x267758[_0x2031('0x33')][_0x2031('0x39')],_0x267758[_0x2031('0x33')][_0x2031('0x17')]);return db[_0x2031('0x36')][_0x2031('0x32')](_0x267758['body'],{'include':[{'model':db[_0x2031('0x3c')],'as':_0x2031('0x38')},{'model':db[_0x2031('0x3c')],'as':_0x2031('0x3a')}]});}return null;})['then'](respondWithResult(_0x48f1bf,null))[_0x2031('0x2d')](handleError(_0x48f1bf,null));};function sanitizeRemoteUri(_0x45dcef){var _0x52d761=_0x45dcef[_0x2031('0x3d')](-0x1);if(_0x52d761==='/')return _0x45dcef['substring'](0x0,_0x45dcef[_0x2031('0x3e')](_0x52d761));return _0x45dcef;}function getWebApiUrl(_0x299356){return util['format']('%s/api/data/v9.0/',_0x299356);}exports['getFields']=function(_0x48a486,_0x2d57c6){var _0x4a36f9=_0x48a486[_0x2031('0x1a')][_0x2031('0x3f')];var _0x4a690c=_0x4a36f9===_0x2031('0x40')?_0x2031('0x41'):_0x2031('0x42');var _0x213db6='';var _0x28cf5b='';var _0x3f6096='';var _0x62d238='';var _0x9a8cfc='';var _0x178fc4='';var _0x4476cf='';var _0x3df746='';var _0x161d3f=[_0x2031('0x43'),_0x2031('0x44'),_0x2031('0x45'),'ownerid',_0x2031('0x46'),_0x2031('0x47'),_0x2031('0x48'),_0x2031('0x49'),_0x2031('0x4a'),'phonecall_activity_parties'];var _0x3b4706=[_0x2031('0x4b'),'accountidyominame',_0x2031('0x4c'),_0x2031('0x4d'),'contactidname',_0x2031('0x4e'),_0x2031('0x4f'),_0x2031('0x50'),'createdbyexternalpartyname',_0x2031('0x51'),_0x2031('0x52'),_0x2031('0x53'),_0x2031('0x54'),_0x2031('0x55'),'createdonbehalfbyyominame',_0x2031('0x56'),_0x2031('0x57'),_0x2031('0x58'),'emailaddress','entitlementidname',_0x2031('0x59'),_0x2031('0x5a'),_0x2031('0x5b'),_0x2031('0x5c'),_0x2031('0x5d'),_0x2031('0x5e'),_0x2031('0x5f'),_0x2031('0x60'),_0x2031('0x61'),_0x2031('0x62'),'masteridname',_0x2031('0x63'),_0x2031('0x64'),_0x2031('0x65'),'modifiedbyyominame',_0x2031('0x66'),_0x2031('0x67'),_0x2031('0x68'),_0x2031('0x69'),'msdyn_iotalertname',_0x2031('0x6a'),_0x2031('0x6b'),_0x2031('0x6c'),'owneridname',_0x2031('0x6d'),'owneridyominame',_0x2031('0x6e'),'primarycontactidname',_0x2031('0x6f'),'prioritycodename',_0x2031('0x70'),'productserialnumber','resolveby',_0x2031('0x71'),_0x2031('0x72'),_0x2031('0x73'),'responsiblecontactidyominame',_0x2031('0x74'),'slainvokedidname',_0x2031('0x75'),'socialprofileidname',_0x2031('0x76'),_0x2031('0x77'),_0x2031('0x78'),_0x2031('0x79'),_0x2031('0x7a'),'transactioncurrencyidname',_0x2031('0x7b'),_0x2031('0x7c'),'versionnumber'];var _0x40921b=_0x161d3f[_0x2031('0x7d')](_0x3b4706);return db[_0x2031('0x15')][_0x2031('0x35')]({'where':{'id':_0x48a486['params']['id']},'attributes':['id',_0x2031('0x7e'),_0x2031('0x7f'),_0x2031('0x80'),_0x2031('0x81'),_0x2031('0x82'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x2031('0x83')],'as':'CloudProvider','attributes':['id',_0x2031('0x84'),_0x2031('0x85')]}]})[_0x2031('0xd')](handleEntityNotFound(_0x2d57c6,null))['then'](function(_0xa73f2a){if(_0xa73f2a){if(_0xa73f2a[_0x2031('0x86')]){_0xa73f2a[_0x2031('0x87')]=_0xa73f2a['CloudProvider'][_0x2031('0x84')];_0x3df746=sanitizeRemoteUri(_0xa73f2a['CloudProvider']['data7']);_0x4476cf=getWebApiUrl(_0x3df746);return _0xa73f2a;}_0x3df746=sanitizeRemoteUri(_0xa73f2a[_0x2031('0x80')]);_0x4476cf=getWebApiUrl(_0x3df746);var _0xa50a0c={'method':_0x2031('0x88'),'uri':_0x2031('0x89')+_0xa73f2a[_0x2031('0x81')]+_0x2031('0x8a'),'form':{'client_id':_0xa73f2a[_0x2031('0x82')],'resource':_0x3df746,'username':_0xa73f2a[_0x2031('0x7e')],'password':_0xa73f2a[_0x2031('0x7f')],'grant_type':_0x2031('0x7f'),'client_secret':_0xa73f2a[_0x2031('0x8b')]},'json':!![]};return rp(_0xa50a0c);}})[_0x2031('0xd')](function(_0x57baab){_0x178fc4=_0x57baab['access_token'];var _0x3a00c4={'method':_0x2031('0x8c'),'uri':encodeURI(_0x4476cf+_0x2031('0x8d')+_0x4a690c+'\x27'),'headers':{'Authorization':_0x2031('0x8e')+_0x178fc4,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x3a00c4);})[_0x2031('0xd')](function(_0x28f7fa){var _0x23b88f=_0x28f7fa[_0x2031('0x90')][0x0];var _0x478a4d=_0x23b88f['MetadataId'];var _0x3ebd8b={'method':_0x2031('0x8c'),'uri':_0x4476cf+_0x2031('0x91')+_0x478a4d+_0x2031('0x92'),'headers':{'Authorization':'Bearer\x20'+_0x178fc4,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x3ebd8b);})[_0x2031('0xd')](function(_0x43e0b3){_0x213db6=_0x43e0b3;_0x28cf5b=_0x213db6[_0x2031('0x93')];_0x28cf5b=_[_0x2031('0x94')](_0x28cf5b,function(_0x40033a){return!_0x40921b[_0x2031('0x95')](_0x40033a[_0x2031('0x96')]);});var _0x3b6a90=[];var _0x43fe3a=[];_0x28cf5b['forEach'](function(_0x503dbc){if(_0x503dbc['@odata.type']){var _0x753997=_0x503dbc['@odata.type']['substring'](_0x503dbc['@odata.type'][_0x2031('0x3e')]('.')+0x1);if(_0x753997===_0x2031('0x97')){_0x3b6a90[_0x2031('0x98')](getSelectList(_0x4476cf,_0x4a36f9,_0x43fe3a,_0x213db6[_0x2031('0x99')],_0x503dbc[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x3b6a90);})[_0x2031('0xd')](function(_0x465073){_0x3f6096=_0x465073[0x0];var _0x59be46=[];var _0x21b4c8=[];_0x28cf5b[_0x2031('0x9b')](function(_0x23a332){if(!_[_0x2031('0x9c')](_0x23a332[_0x2031('0x9d')])){var _0x563b32=_0x23a332['@odata.type'][_0x2031('0x9e')](_0x23a332[_0x2031('0x9d')][_0x2031('0x3e')]('.')+0x1);if(_0x563b32===_0x2031('0x9f')){_0x59be46[_0x2031('0x98')](getBooleanList(_0x4476cf,_0x4a36f9,_0x21b4c8,_0x213db6['MetadataId'],_0x23a332[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x59be46);})[_0x2031('0xd')](function(_0x22f223){_0x62d238=_0x22f223[0x0];var _0x482319=[];var _0x892ab5=[];_0x28cf5b[_0x2031('0x9b')](function(_0x503ecc){if(_0x503ecc[_0x2031('0x9d')]){var _0x262fda=_0x503ecc['@odata.type']['substring'](_0x503ecc[_0x2031('0x9d')][_0x2031('0x3e')]('.')+0x1);if(_0x262fda===_0x2031('0xa0')||_0x262fda===_0x2031('0xa1')||_0x262fda===_0x2031('0xa2')||_0x262fda==='IntegerAttributeMetadata'||_0x262fda===_0x2031('0xa3')||_0x262fda==='DateTimeAttributeMetadata'||_0x262fda===_0x2031('0xa4')||_0x262fda===_0x2031('0xa5')||_0x262fda===_0x2031('0xa6')||_0x262fda===_0x2031('0xa7')){_0x482319['push'](getInputList(_0x4476cf,_0x4a36f9,_0x262fda,_0x892ab5,_0x213db6['MetadataId'],_0x503ecc[_0x2031('0x99')],_0x178fc4));}}});return Promise[_0x2031('0x9a')](_0x482319);})[_0x2031('0xd')](function(_0x30f4ca){_0x9a8cfc=_0x30f4ca[0x0];var _0x3a3dc6=_0x3f6096[_0x2031('0x7d')](_0x62d238)[_0x2031('0x7d')](_0x9a8cfc);var _0x1a0f6b={'count':_0x3a3dc6[_0x2031('0x20')],'rows':_0x3a3dc6};return _0x1a0f6b;})['then'](respondWithResult(_0x2d57c6,null))[_0x2031('0x2d')](function(_0x558d63){var _0x5d3da1=_0x48a486[_0x2031('0x1a')][_0x2031('0xa8')]?0x1f4:_0x558d63[_0x2031('0xa9')]||0x1f4;logger['error'](_0x558d63['stack']);delete _0x558d63[_0x2031('0x13')];if(_0x5d3da1===0x191){_0x5d3da1=0x190;}_0x2d57c6[_0x2031('0x5')](_0x5d3da1)['send'](_0x48a486[_0x2031('0x1a')][_0x2031('0xa8')]?{'message':_0x2031('0xaa'),'statusCode':_0x558d63[_0x2031('0xa9')]}:_0x558d63);});};function getSelectList(_0x4d8d56,_0x10176d,_0x4a11f7,_0x1d7a98,_0xe59306,_0x42e0a9){var _0x32c997={'method':'GET','uri':_0x4d8d56+'EntityDefinitions('+_0x1d7a98+')/Attributes('+_0xe59306+_0x2031('0xab')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2031('0x8e')+_0x42e0a9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32c997)[_0x2031('0xd')](function(_0x2d63db){var _0x2f1cee=[];var _0x362a44=_0x2d63db[_0x2031('0xac')][_0x2031('0xad')];_0x362a44[_0x2031('0x9b')](function(_0x22d787){_0x2f1cee['push']({'name':_0x22d787[_0x2031('0xae')][_0x2031('0xaf')][_0x2031('0xae')],'value':String(_0x22d787['Value'])});});var _0x343fc6={'id':_0x10176d+'_'+_0x2d63db[_0x2031('0x96')],'name':_0x2d63db['DisplayName']['UserLocalizedLabel'][_0x2031('0xae')],'custom':![],'options':_0x2f1cee};_0x4a11f7[_0x2031('0x98')](_0x343fc6);return _0x4a11f7;});}function getBooleanList(_0xd34704,_0xcffe7c,_0x41d45c,_0xd4691c,_0x20b264,_0x2b7ffc){var _0x4526ec={'method':'GET','uri':_0xd34704+_0x2031('0x91')+_0xd4691c+_0x2031('0xb0')+_0x20b264+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x2031('0x8e')+_0x2b7ffc,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x4526ec)['then'](function(_0x51b394){var _0x24cf6b=[];_0x24cf6b['push']({'name':_0x51b394[_0x2031('0xac')][_0x2031('0xb1')][_0x2031('0xae')][_0x2031('0xaf')]['Label'],'value':_0x2031('0xb2')},{'name':_0x51b394[_0x2031('0xac')][_0x2031('0xb3')][_0x2031('0xae')]['UserLocalizedLabel']['Label'],'value':_0x2031('0xb4')});var _0x1a1491={'id':_0xcffe7c+'_'+_0x51b394['LogicalName'],'name':_0x51b394['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x24cf6b};_0x41d45c['push'](_0x1a1491);return _0x41d45c;});}function getInputList(_0x26c40a,_0x5030dd,_0x23bf9a,_0x35c219,_0x79d392,_0x2a3c71,_0x86424b){var _0x50aefb={'method':_0x2031('0x8c'),'uri':_0x26c40a+_0x2031('0x91')+_0x79d392+')/Attributes('+_0x2a3c71+_0x2031('0xb5')+_0x23bf9a+_0x2031('0xb6'),'headers':{'Authorization':_0x2031('0x8e')+_0x86424b,'If-None-Match':null,'OData-Version':_0x2031('0x8f')},'json':!![]};return rp(_0x50aefb)['then'](function(_0x2ee360){var _0x51b1b6={'id':_0x5030dd+'_'+_0x2ee360[_0x2031('0x96')],'name':_0x2ee360[_0x2031('0xb7')][_0x2031('0xaf')]?_0x2ee360[_0x2031('0xb7')][_0x2031('0xaf')][_0x2031('0xae')]:_0x2ee360['LogicalName'],'custom':![],'options':[]};_0x35c219[_0x2031('0x98')](_0x51b1b6);return _0x35c219;});} \ No newline at end of file +var _0x9563=['%s/api/data/v9.0/','getFields','ticketType','incident','Incident','ownerid','caseorigincode','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','versionnumber','concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','DisplayName','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body','catch','find','findOne','Dynamics365Configuration','getConfigurations','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring'];(function(_0x153ef9,_0x9615f1){var _0x5e902e=function(_0xbde7c){while(--_0xbde7c){_0x153ef9['push'](_0x153ef9['shift']());}};_0x5e902e(++_0x9615f1);}(_0x9563,0x1e7));var _0x3956=function(_0x191851,_0xaaad29){_0x191851=_0x191851-0x0;var _0x268fb8=_0x9563[_0x191851];return _0x268fb8;};'use strict';var rp=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var _=require('lodash');var qs=require(_0x3956('0x2'));var logger=require(_0x3956('0x3'))(_0x3956('0x4'));var db=require(_0x3956('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x58382b,_0x11ded2){_0x11ded2=_0x11ded2||0xc8;return function(_0x56e858){if(_0x56e858){return _0x58382b[_0x3956('0x6')](_0x11ded2)[_0x3956('0x7')](_0x56e858);}};}function respondWithFilteredResult(_0x177a1a,_0xba3e4b){return function(_0x47bdbc){if(_0x47bdbc){var _0x234e06=typeof _0xba3e4b[_0x3956('0x8')]===_0x3956('0x9')&&typeof _0xba3e4b[_0x3956('0xa')]===_0x3956('0x9');var _0x4dd27f=_0x47bdbc['count'];var _0x3cc5cc=_0x234e06?0x0:_0xba3e4b[_0x3956('0x8')];var _0x336973=_0x234e06?_0x47bdbc[_0x3956('0xb')]:_0xba3e4b['offset']+_0xba3e4b[_0x3956('0xa')];var _0x19019b;if(_0x336973>=_0x4dd27f){_0x336973=_0x4dd27f;_0x19019b=0xc8;}else{_0x19019b=0xce;}_0x177a1a[_0x3956('0x6')](_0x19019b);return _0x177a1a[_0x3956('0xc')](_0x3956('0xd'),_0x3cc5cc+'-'+_0x336973+'/'+_0x4dd27f)[_0x3956('0x7')](_0x47bdbc);}return null;};}function saveUpdates(_0x44d37c){return function(_0x1156a3){if(_0x1156a3){return _0x1156a3[_0x3956('0xe')](_0x44d37c)['then'](function(_0x59a454){return _0x59a454;});}return null;};}function removeEntity(_0x53c577){return function(_0xb7fad6){if(_0xb7fad6){return _0xb7fad6[_0x3956('0xf')]()['then'](function(){_0x53c577[_0x3956('0x6')](0xcc)[_0x3956('0x10')]();});}};}function handleEntityNotFound(_0x375980){return function(_0x19bd9c){if(!_0x19bd9c){_0x375980[_0x3956('0x11')](0x194);}return _0x19bd9c;};}function handleError(_0x1fc05c,_0x429d28){_0x429d28=_0x429d28||0x1f4;return function(_0x458b4a){logger[_0x3956('0x12')](_0x458b4a[_0x3956('0x13')]);if(_0x458b4a[_0x3956('0x14')]){delete _0x458b4a[_0x3956('0x14')];}_0x1fc05c[_0x3956('0x6')](_0x429d28)[_0x3956('0x15')](_0x458b4a);};}exports[_0x3956('0x16')]=function(_0x434df7,_0x2d3790){var _0x1a305e={},_0x31552d={},_0x3a882e={'count':0x0,'rows':[]};var _0x4b9acc=_[_0x3956('0x17')](db[_0x3956('0x18')]['rawAttributes'],function(_0x530d58){return{'name':_0x530d58['fieldName'],'type':_0x530d58[_0x3956('0x19')][_0x3956('0x1a')]};});_0x31552d['model']=_[_0x3956('0x17')](_0x4b9acc,'name');_0x31552d[_0x3956('0x1b')]=_['keys'](_0x434df7[_0x3956('0x1b')]);_0x31552d[_0x3956('0x1c')]=_[_0x3956('0x1d')](_0x31552d[_0x3956('0x1e')],_0x31552d[_0x3956('0x1b')]);_0x1a305e[_0x3956('0x1f')]=_['intersection'](_0x31552d['model'],qs[_0x3956('0x20')](_0x434df7[_0x3956('0x1b')]['fields']));_0x1a305e['attributes']=_0x1a305e[_0x3956('0x1f')][_0x3956('0x21')]?_0x1a305e['attributes']:_0x31552d[_0x3956('0x1e')];if(!_0x434df7[_0x3956('0x1b')][_0x3956('0x22')](_0x3956('0x23'))){_0x1a305e[_0x3956('0xa')]=qs[_0x3956('0xa')](_0x434df7['query'][_0x3956('0xa')]);_0x1a305e[_0x3956('0x8')]=qs[_0x3956('0x8')](_0x434df7['query'][_0x3956('0x8')]);}_0x1a305e[_0x3956('0x24')]=qs[_0x3956('0x25')](_0x434df7['query'][_0x3956('0x25')]);_0x1a305e[_0x3956('0x26')]=qs[_0x3956('0x1c')](_[_0x3956('0x27')](_0x434df7[_0x3956('0x1b')],_0x31552d[_0x3956('0x1c')]),_0x4b9acc);if(_0x434df7[_0x3956('0x1b')][_0x3956('0x28')]){_0x1a305e[_0x3956('0x26')]=_[_0x3956('0x29')](_0x1a305e['where'],{'$or':_[_0x3956('0x17')](_0x4b9acc,function(_0x14a3a8){if(_0x14a3a8['type']!==_0x3956('0x2a')){var _0x3d82b5={};_0x3d82b5[_0x14a3a8['name']]={'$like':'%'+_0x434df7[_0x3956('0x1b')]['filter']+'%'};return _0x3d82b5;}})});}_0x1a305e=_[_0x3956('0x29')]({},_0x1a305e,_0x434df7[_0x3956('0x2b')]);var _0x1a7334={'where':_0x1a305e['where']};return db['Dynamics365Account'][_0x3956('0xb')](_0x1a7334)[_0x3956('0x2c')](function(_0x52a72e){_0x3a882e[_0x3956('0xb')]=_0x52a72e;if(_0x434df7['query'][_0x3956('0x2d')]){_0x1a305e[_0x3956('0x2e')]=[{'all':!![]}];}return db[_0x3956('0x18')][_0x3956('0x2f')](_0x1a305e);})[_0x3956('0x2c')](function(_0x34f304){_0x3a882e[_0x3956('0x30')]=_0x34f304;return _0x3a882e;})[_0x3956('0x2c')](respondWithFilteredResult(_0x2d3790,_0x1a305e))['catch'](handleError(_0x2d3790,null));};exports[_0x3956('0x31')]=function(_0x55c35c,_0x371933){var _0x389787={'raw':![],'where':{'id':_0x55c35c[_0x3956('0x32')]['id']}},_0x248006={};_0x248006[_0x3956('0x1e')]=_[_0x3956('0x33')](db[_0x3956('0x18')][_0x3956('0x34')]);_0x248006[_0x3956('0x1b')]=_[_0x3956('0x33')](_0x55c35c[_0x3956('0x1b')]);_0x248006[_0x3956('0x1c')]=_['intersection'](_0x248006[_0x3956('0x1e')],_0x248006[_0x3956('0x1b')]);_0x389787[_0x3956('0x1f')]=_[_0x3956('0x1d')](_0x248006[_0x3956('0x1e')],qs[_0x3956('0x20')](_0x55c35c[_0x3956('0x1b')][_0x3956('0x20')]));_0x389787['attributes']=_0x389787[_0x3956('0x1f')][_0x3956('0x21')]?_0x389787[_0x3956('0x1f')]:_0x248006['model'];if(_0x55c35c[_0x3956('0x1b')][_0x3956('0x2d')]){_0x389787['include']=[{'all':!![]}];}_0x389787=_[_0x3956('0x29')]({},_0x389787,_0x55c35c[_0x3956('0x2b')]);return db[_0x3956('0x18')]['find'](_0x389787)[_0x3956('0x2c')](handleEntityNotFound(_0x371933,null))[_0x3956('0x2c')](respondWithResult(_0x371933,null))['catch'](handleError(_0x371933,null));};exports['create']=function(_0x141b68,_0x31d9fe){return db[_0x3956('0x18')][_0x3956('0x35')](_0x141b68[_0x3956('0x36')],{})['then'](respondWithResult(_0x31d9fe,0xc9))[_0x3956('0x37')](handleError(_0x31d9fe,null));};exports['update']=function(_0x9f84e1,_0x2d55ea){if(_0x9f84e1['body']['id']){delete _0x9f84e1[_0x3956('0x36')]['id'];}return db['Dynamics365Account'][_0x3956('0x38')]({'where':{'id':_0x9f84e1[_0x3956('0x32')]['id']}})[_0x3956('0x2c')](handleEntityNotFound(_0x2d55ea,null))[_0x3956('0x2c')](saveUpdates(_0x9f84e1[_0x3956('0x36')],null))[_0x3956('0x2c')](respondWithResult(_0x2d55ea,null))[_0x3956('0x37')](handleError(_0x2d55ea,null));};exports[_0x3956('0xf')]=function(_0xa22e67,_0x597de4){return db[_0x3956('0x18')]['find']({'where':{'id':_0xa22e67[_0x3956('0x32')]['id']}})[_0x3956('0x2c')](handleEntityNotFound(_0x597de4,null))[_0x3956('0x2c')](removeEntity(_0x597de4,null))['catch'](handleError(_0x597de4,null));};exports['getConfigurations']=function(_0x4e628b,_0x337f27){var _0x21334c={};var _0x43c6b8={};var _0x4439ef;var _0x4c9ed1;return db[_0x3956('0x18')][_0x3956('0x39')]({'where':{'id':_0x4e628b[_0x3956('0x32')]['id']}})[_0x3956('0x2c')](handleEntityNotFound(_0x337f27,null))[_0x3956('0x2c')](function(_0x128e66){if(_0x128e66){_0x4439ef=_0x128e66;_0x43c6b8[_0x3956('0x1e')]=_[_0x3956('0x33')](db[_0x3956('0x3a')]['rawAttributes']);_0x43c6b8['query']=_[_0x3956('0x33')](_0x4e628b[_0x3956('0x1b')]);_0x43c6b8[_0x3956('0x1c')]=_[_0x3956('0x1d')](_0x43c6b8['model'],_0x43c6b8[_0x3956('0x1b')]);_0x21334c['attributes']=_['intersection'](_0x43c6b8[_0x3956('0x1e')],qs[_0x3956('0x20')](_0x4e628b[_0x3956('0x1b')][_0x3956('0x20')]));_0x21334c[_0x3956('0x1f')]=_0x21334c[_0x3956('0x1f')]['length']?_0x21334c[_0x3956('0x1f')]:_0x43c6b8[_0x3956('0x1e')];_0x21334c[_0x3956('0x24')]=qs['sort'](_0x4e628b[_0x3956('0x1b')][_0x3956('0x25')]);_0x21334c[_0x3956('0x26')]=qs['filters'](_[_0x3956('0x27')](_0x4e628b['query'],_0x43c6b8[_0x3956('0x1c')]));if(_0x4e628b[_0x3956('0x1b')][_0x3956('0x28')]){_0x21334c[_0x3956('0x26')]=_['merge'](_0x21334c[_0x3956('0x26')],{'$or':_[_0x3956('0x17')](_0x21334c[_0x3956('0x1f')],function(_0xf1dc14){var _0x1c8b3d={};_0x1c8b3d[_0xf1dc14]={'$like':'%'+_0x4e628b[_0x3956('0x1b')]['filter']+'%'};return _0x1c8b3d;})});}_0x21334c=_[_0x3956('0x29')]({},_0x21334c,_0x4e628b[_0x3956('0x2b')]);return _0x4439ef[_0x3956('0x3b')](_0x21334c);}})[_0x3956('0x2c')](function(_0x16075e){if(_0x16075e){_0x4c9ed1=_0x16075e[_0x3956('0x21')];if(!_0x4e628b[_0x3956('0x1b')][_0x3956('0x22')](_0x3956('0x23'))){_0x21334c[_0x3956('0xa')]=qs[_0x3956('0xa')](_0x4e628b[_0x3956('0x1b')]['limit']);_0x21334c[_0x3956('0x8')]=qs['offset'](_0x4e628b['query'][_0x3956('0x8')]);}return _0x4439ef[_0x3956('0x3b')](_0x21334c);}})['then'](function(_0x3cc7c4){if(_0x3cc7c4){return _0x3cc7c4?{'count':_0x4c9ed1,'rows':_0x3cc7c4}:null;}})[_0x3956('0x2c')](respondWithResult(_0x337f27,null))[_0x3956('0x37')](handleError(_0x337f27,null));};exports['addConfiguration']=function(_0x10d6c9,_0x1f0be5){if(_0x10d6c9['body']['id']){delete _0x10d6c9['body']['id'];}return db[_0x3956('0x18')][_0x3956('0x39')]({'where':{'id':_0x10d6c9[_0x3956('0x32')]['id']}})[_0x3956('0x2c')](handleEntityNotFound(_0x1f0be5,null))[_0x3956('0x2c')](function(_0x567dce){if(_0x567dce){_0x10d6c9[_0x3956('0x36')]['AccountId']=_0x567dce['id'];_0x10d6c9[_0x3956('0x36')][_0x3956('0x3c')]=integrations[_0x3956('0x3d')](_0x10d6c9['body'][_0x3956('0x3e')],_0x10d6c9[_0x3956('0x36')]['type']);_0x10d6c9[_0x3956('0x36')]['Descriptions']=integrations[_0x3956('0x3f')](_0x10d6c9['body'][_0x3956('0x3e')],_0x10d6c9[_0x3956('0x36')][_0x3956('0x19')]);return db[_0x3956('0x3a')]['create'](_0x10d6c9[_0x3956('0x36')],{'include':[{'model':db['Dynamics365Field'],'as':_0x3956('0x3c')},{'model':db[_0x3956('0x40')],'as':_0x3956('0x41')}]});}return null;})[_0x3956('0x2c')](respondWithResult(_0x1f0be5,null))[_0x3956('0x37')](handleError(_0x1f0be5,null));};function sanitizeRemoteUri(_0x3bd2b8){var _0x35ca64=_0x3bd2b8[_0x3956('0x42')](-0x1);if(_0x35ca64==='/')return _0x3bd2b8[_0x3956('0x43')](0x0,_0x3bd2b8['lastIndexOf'](_0x35ca64));return _0x3bd2b8;}function getWebApiUrl(_0x5b00cb){return util['format'](_0x3956('0x44'),_0x5b00cb);}exports[_0x3956('0x45')]=function(_0x3bce00,_0x1beb16){var _0x32e201=_0x3bce00['query'][_0x3956('0x46')];var _0x492a36=_0x32e201===_0x3956('0x47')?_0x3956('0x48'):'PhoneCall';var _0xf913ed='';var _0x33f640='';var _0x1422ff='';var _0x1c915d='';var _0x2f4111='';var _0x2065b2='';var _0x4204d2='';var _0x2887e0='';var _0x227d8d=['title','description','customerid',_0x3956('0x49'),_0x3956('0x4a'),'subject',_0x3956('0x4b'),'regardingobjectid',_0x3956('0x4c'),'phonecall_activity_parties'];var _0x5ddd2e=[_0x3956('0x4d'),_0x3956('0x4e'),_0x3956('0x4f'),_0x3956('0x50'),'contactidname','contactidyominame','contractdetailidname',_0x3956('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x3956('0x52'),_0x3956('0x53'),_0x3956('0x54'),_0x3956('0x55'),_0x3956('0x56'),_0x3956('0x57'),_0x3956('0x58'),'customeridyominame',_0x3956('0x59'),_0x3956('0x5a'),'entityimage_timestamp',_0x3956('0x5b'),_0x3956('0x5c'),_0x3956('0x5d'),_0x3956('0x5e'),_0x3956('0x5f'),_0x3956('0x60'),'influencescore',_0x3956('0x61'),_0x3956('0x62'),_0x3956('0x63'),_0x3956('0x64'),'modifiedbyexternalpartyyominame',_0x3956('0x65'),_0x3956('0x66'),_0x3956('0x67'),_0x3956('0x68'),_0x3956('0x69'),_0x3956('0x6a'),_0x3956('0x6b'),_0x3956('0x6c'),_0x3956('0x6d'),'overriddencreatedon',_0x3956('0x6e'),_0x3956('0x6f'),'owneridyominame',_0x3956('0x70'),_0x3956('0x71'),_0x3956('0x72'),_0x3956('0x73'),_0x3956('0x74'),_0x3956('0x75'),_0x3956('0x76'),_0x3956('0x77'),_0x3956('0x78'),'responsiblecontactidname',_0x3956('0x79'),_0x3956('0x7a'),_0x3956('0x7b'),_0x3956('0x7c'),_0x3956('0x7d'),'statecode',_0x3956('0x7e'),_0x3956('0x7f'),_0x3956('0x80'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x3956('0x81')];var _0x9e9a30=_0x227d8d[_0x3956('0x82')](_0x5ddd2e);return db[_0x3956('0x18')]['findOne']({'where':{'id':_0x3bce00['params']['id']},'attributes':['id',_0x3956('0x83'),_0x3956('0x84'),_0x3956('0x85'),_0x3956('0x86'),_0x3956('0x87'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x3956('0x88')],'as':'CloudProvider','attributes':['id',_0x3956('0x89'),'data7']}]})[_0x3956('0x2c')](handleEntityNotFound(_0x1beb16,null))[_0x3956('0x2c')](function(_0x9d9343){if(_0x9d9343){if(_0x9d9343['modernAuthentication']){_0x9d9343['access_token']=_0x9d9343[_0x3956('0x88')][_0x3956('0x89')];_0x2887e0=sanitizeRemoteUri(_0x9d9343[_0x3956('0x88')]['data7']);_0x4204d2=getWebApiUrl(_0x2887e0);return _0x9d9343;}_0x2887e0=sanitizeRemoteUri(_0x9d9343[_0x3956('0x85')]);_0x4204d2=getWebApiUrl(_0x2887e0);var _0x2f095a={'method':_0x3956('0x8a'),'uri':_0x3956('0x8b')+_0x9d9343['tenantId']+_0x3956('0x8c'),'form':{'client_id':_0x9d9343[_0x3956('0x87')],'resource':_0x2887e0,'username':_0x9d9343[_0x3956('0x83')],'password':_0x9d9343[_0x3956('0x84')],'grant_type':'password','client_secret':_0x9d9343[_0x3956('0x8d')]},'json':!![]};return rp(_0x2f095a);}})[_0x3956('0x2c')](function(_0x30645c){_0x2065b2=_0x30645c['access_token'];var _0x40d479={'method':_0x3956('0x8e'),'uri':encodeURI(_0x4204d2+_0x3956('0x8f')+_0x492a36+'\x27'),'headers':{'Authorization':_0x3956('0x90')+_0x2065b2,'If-None-Match':null,'OData-Version':_0x3956('0x91')},'json':!![]};return rp(_0x40d479);})[_0x3956('0x2c')](function(_0x4ac983){var _0x36b77a=_0x4ac983[_0x3956('0x92')][0x0];var _0x1aeb9e=_0x36b77a[_0x3956('0x93')];var _0x4b8e15={'method':_0x3956('0x8e'),'uri':_0x4204d2+_0x3956('0x94')+_0x1aeb9e+_0x3956('0x95'),'headers':{'Authorization':_0x3956('0x90')+_0x2065b2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b8e15);})[_0x3956('0x2c')](function(_0x8e3e8b){_0xf913ed=_0x8e3e8b;_0x33f640=_0xf913ed[_0x3956('0x96')];_0x33f640=_[_0x3956('0x97')](_0x33f640,function(_0x4265e9){return!_0x9e9a30[_0x3956('0x98')](_0x4265e9[_0x3956('0x99')]);});var _0x4cbe56=[];var _0x31cba6=[];_0x33f640['forEach'](function(_0x328038){if(_0x328038[_0x3956('0x9a')]){var _0x592623=_0x328038[_0x3956('0x9a')]['substring'](_0x328038[_0x3956('0x9a')][_0x3956('0x9b')]('.')+0x1);if(_0x592623===_0x3956('0x9c')){_0x4cbe56[_0x3956('0x9d')](getSelectList(_0x4204d2,_0x32e201,_0x31cba6,_0xf913ed[_0x3956('0x93')],_0x328038[_0x3956('0x93')],_0x2065b2));}}});return Promise['all'](_0x4cbe56);})[_0x3956('0x2c')](function(_0x28506d){_0x1422ff=_0x28506d[0x0];var _0x479e82=[];var _0x495902=[];_0x33f640[_0x3956('0x9e')](function(_0x5f2fc3){if(!_[_0x3956('0x9f')](_0x5f2fc3[_0x3956('0x9a')])){var _0x50d2a0=_0x5f2fc3[_0x3956('0x9a')][_0x3956('0x43')](_0x5f2fc3['@odata.type'][_0x3956('0x9b')]('.')+0x1);if(_0x50d2a0===_0x3956('0xa0')){_0x479e82['push'](getBooleanList(_0x4204d2,_0x32e201,_0x495902,_0xf913ed['MetadataId'],_0x5f2fc3[_0x3956('0x93')],_0x2065b2));}}});return Promise['all'](_0x479e82);})[_0x3956('0x2c')](function(_0x16c57d){_0x1c915d=_0x16c57d[0x0];var _0x42ddc9=[];var _0x49880f=[];_0x33f640[_0x3956('0x9e')](function(_0x4da13e){if(_0x4da13e[_0x3956('0x9a')]){var _0x705055=_0x4da13e['@odata.type'][_0x3956('0x43')](_0x4da13e[_0x3956('0x9a')][_0x3956('0x9b')]('.')+0x1);if(_0x705055===_0x3956('0xa1')||_0x705055===_0x3956('0xa2')||_0x705055===_0x3956('0xa3')||_0x705055===_0x3956('0xa4')||_0x705055==='MemoAttributeMetadata'||_0x705055===_0x3956('0xa5')||_0x705055===_0x3956('0xa6')||_0x705055===_0x3956('0xa7')||_0x705055===_0x3956('0xa8')||_0x705055===_0x3956('0xa9')){_0x42ddc9[_0x3956('0x9d')](getInputList(_0x4204d2,_0x32e201,_0x705055,_0x49880f,_0xf913ed[_0x3956('0x93')],_0x4da13e[_0x3956('0x93')],_0x2065b2));}}});return Promise['all'](_0x42ddc9);})[_0x3956('0x2c')](function(_0x4c838f){_0x2f4111=_0x4c838f[0x0];var _0x3d72c2=_0x1422ff[_0x3956('0x82')](_0x1c915d)[_0x3956('0x82')](_0x2f4111);var _0x33c473={'count':_0x3d72c2['length'],'rows':_0x3d72c2};return _0x33c473;})[_0x3956('0x2c')](respondWithResult(_0x1beb16,null))[_0x3956('0x37')](function(_0x251cc8){var _0x48f23e=_0x3bce00[_0x3956('0x1b')][_0x3956('0xaa')]?0x1f4:_0x251cc8[_0x3956('0xab')]||0x1f4;logger[_0x3956('0x12')](_0x251cc8['stack']);delete _0x251cc8[_0x3956('0x14')];if(_0x48f23e===0x191){_0x48f23e=0x190;}_0x1beb16['status'](_0x48f23e)[_0x3956('0x15')](_0x3bce00['query'][_0x3956('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x251cc8['statusCode']}:_0x251cc8);});};function getSelectList(_0x4cb409,_0x381d3a,_0x104f69,_0xafbe0f,_0x205c62,_0x380346){var _0xe5ff32={'method':'GET','uri':_0x4cb409+_0x3956('0x94')+_0xafbe0f+_0x3956('0xac')+_0x205c62+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x3956('0xad'),'headers':{'Authorization':_0x3956('0x90')+_0x380346,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xe5ff32)['then'](function(_0x4c0628){var _0x5e5d78=[];var _0x57a674=_0x4c0628['OptionSet'][_0x3956('0xae')];_0x57a674[_0x3956('0x9e')](function(_0x1c2944){_0x5e5d78[_0x3956('0x9d')]({'name':_0x1c2944[_0x3956('0xaf')]['UserLocalizedLabel'][_0x3956('0xaf')],'value':String(_0x1c2944[_0x3956('0xb0')])});});var _0x4fdbea={'id':_0x381d3a+'_'+_0x4c0628['LogicalName'],'name':_0x4c0628['DisplayName'][_0x3956('0xb1')][_0x3956('0xaf')],'custom':![],'options':_0x5e5d78};_0x104f69[_0x3956('0x9d')](_0x4fdbea);return _0x104f69;});}function getBooleanList(_0x22082b,_0x10baec,_0x15235f,_0x48ab92,_0x365ce2,_0x48bd0d){var _0x5da717={'method':'GET','uri':_0x22082b+_0x3956('0x94')+_0x48ab92+_0x3956('0xac')+_0x365ce2+_0x3956('0xb2'),'headers':{'Authorization':_0x3956('0x90')+_0x48bd0d,'If-None-Match':null,'OData-Version':_0x3956('0x91')},'json':!![]};return rp(_0x5da717)['then'](function(_0x287f8c){var _0x38b198=[];_0x38b198[_0x3956('0x9d')]({'name':_0x287f8c[_0x3956('0xb3')][_0x3956('0xb4')][_0x3956('0xaf')]['UserLocalizedLabel'][_0x3956('0xaf')],'value':_0x3956('0xb5')},{'name':_0x287f8c[_0x3956('0xb3')][_0x3956('0xb6')][_0x3956('0xaf')][_0x3956('0xb1')][_0x3956('0xaf')],'value':'false'});var _0x506281={'id':_0x10baec+'_'+_0x287f8c[_0x3956('0x99')],'name':_0x287f8c[_0x3956('0xb7')][_0x3956('0xb1')][_0x3956('0xaf')],'custom':![],'options':_0x38b198};_0x15235f[_0x3956('0x9d')](_0x506281);return _0x15235f;});}function getInputList(_0x155536,_0x21d610,_0xebf93,_0x527f21,_0x4a3248,_0x3ca6be,_0x4e9d2f){var _0x4601d4={'method':'GET','uri':_0x155536+_0x3956('0x94')+_0x4a3248+_0x3956('0xac')+_0x3ca6be+')/Microsoft.Dynamics.CRM.'+_0xebf93+_0x3956('0xb8'),'headers':{'Authorization':_0x3956('0x90')+_0x4e9d2f,'If-None-Match':null,'OData-Version':_0x3956('0x91')},'json':!![]};return rp(_0x4601d4)[_0x3956('0x2c')](function(_0x59c559){var _0x5e7a22={'id':_0x21d610+'_'+_0x59c559[_0x3956('0x99')],'name':_0x59c559[_0x3956('0xb7')]['UserLocalizedLabel']?_0x59c559[_0x3956('0xb7')][_0x3956('0xb1')][_0x3956('0xaf')]:_0x59c559[_0x3956('0x99')],'custom':![],'options':[]};_0x527f21['push'](_0x5e7a22);return _0x527f21;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1f30f1b..7c34bc8 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4a9c61,_0x35cbcc){var _0x545910=function(_0x5d971f){while(--_0x5d971f){_0x4a9c61['push'](_0x4a9c61['shift']());}};_0x545910(++_0x35cbcc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x2077dd,_0x51e332){var _0x4d3220=function(_0x2b2954){while(--_0x2b2954){_0x2077dd['push'](_0x2077dd['shift']());}};_0x4d3220(++_0x51e332);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b2632e2..4386a81 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 _0xccdb=['then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map','model','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3e6cc8,_0x7c29e0){var _0x59bdc2=function(_0x812951){while(--_0x812951){_0x3e6cc8['push'](_0x3e6cc8['shift']());}};_0x59bdc2(++_0x7c29e0);}(_0xccdb,0x13f));var _0xbccd=function(_0x4c2249,_0x3a67a9){_0x4c2249=_0x4c2249-0x0;var _0x126d3c=_0xccdb[_0x4c2249];return _0x126d3c;};'use strict';var _=require('lodash');var util=require(_0xbccd('0x0'));var moment=require(_0xbccd('0x1'));var BPromise=require(_0xbccd('0x2'));var rs=require(_0xbccd('0x3'));var fs=require('fs');var Redis=require(_0xbccd('0x4'));var db=require(_0xbccd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbccd('0x6'))(_0xbccd('0x7'));var config=require(_0xbccd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbccd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc980,_0x47a174,_0x18698d){return new BPromise(function(_0x4afaab,_0x5c4ba8){return client[_0xbccd('0xa')](_0x1fc980,_0x18698d)[_0xbccd('0xb')](function(_0x194295){logger[_0xbccd('0xc')](_0xbccd('0xd'),_0x47a174,_0xbccd('0xe'));logger[_0xbccd('0xf')](_0xbccd('0x10'),_0x47a174,_0xbccd('0xe'),JSON[_0xbccd('0x11')](_0x194295));if(_0x194295[_0xbccd('0x12')]){if(_0x194295[_0xbccd('0x12')][_0xbccd('0x13')]===0x1f4){logger[_0xbccd('0x12')](_0xbccd('0xd'),_0x47a174,_0x194295['error'][_0xbccd('0x14')]);return _0x5c4ba8(_0x194295[_0xbccd('0x12')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x47a174,_0x194295['error'][_0xbccd('0x14')]);return _0x4afaab(_0x194295[_0xbccd('0x12')][_0xbccd('0x14')]);}else{logger[_0xbccd('0xc')](_0xbccd('0xd'),_0x47a174,_0xbccd('0xe'));_0x4afaab(_0x194295[_0xbccd('0x15')][_0xbccd('0x14')]);}})[_0xbccd('0x16')](function(_0xee4829){logger[_0xbccd('0x12')](_0xbccd('0xd'),_0x47a174,_0xee4829);_0x5c4ba8(_0xee4829);});});}exports[_0xbccd('0x17')]=function(_0x5b929c){var _0x12df0a=this;return new Promise(function(_0x420163,_0x17d73b){return db[_0xbccd('0x18')]['findAll']({'raw':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1b')]||null:null,'attributes':_0x5b929c['options']?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1c')]||null:null,'limit':_0x5b929c[_0xbccd('0x19')]?_0x5b929c['options']['limit']||null:null,'include':_0x5b929c[_0xbccd('0x19')]?_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x5b929c[_0xbccd('0x19')][_0xbccd('0x1d')],function(_0x5e44c8){return{'model':db[_0x5e44c8[_0xbccd('0x1f')]],'as':_0x5e44c8['as'],'attributes':_0x5e44c8[_0xbccd('0x1c')],'include':_0x5e44c8['include']?_[_0xbccd('0x1e')](_0x5e44c8[_0xbccd('0x1d')],function(_0x7d16e8){return{'model':db[_0x7d16e8[_0xbccd('0x1f')]],'as':_0x7d16e8['as'],'attributes':_0x7d16e8['attributes'],'include':_0x7d16e8[_0xbccd('0x1d')]?_['map'](_0x7d16e8[_0xbccd('0x1d')],function(_0x1155f9){return{'model':db[_0x1155f9[_0xbccd('0x1f')]],'as':_0x1155f9['as'],'attributes':_0x1155f9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbccd('0xb')](function(_0x289afa){logger[_0xbccd('0xc')](_0xbccd('0x17'),_0x5b929c);logger[_0xbccd('0xf')](_0xbccd('0x17'),_0x5b929c,JSON[_0xbccd('0x11')](_0x289afa));_0x420163(_0x289afa);})[_0xbccd('0x16')](function(_0x30d546){logger[_0xbccd('0x12')](_0xbccd('0x17'),_0x30d546[_0xbccd('0x14')],_0x5b929c);_0x17d73b(_0x12df0a['error'](0x1f4,_0x30d546['message']));});});};exports[_0xbccd('0x20')]=function(_0x40a34e){var _0x3791a8=this;return new Promise(function(_0x103dbb,_0x3b60bb){return db[_0xbccd('0x18')]['find']({'raw':_0x40a34e[_0xbccd('0x19')]?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1a')]===undefined?!![]:![]:!![],'where':_0x40a34e['options']?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1b')]||null:null,'attributes':_0x40a34e['options']?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1c')]||null:null,'include':_0x40a34e[_0xbccd('0x19')]?_0x40a34e[_0xbccd('0x19')][_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x40a34e[_0xbccd('0x19')]['include'],function(_0x2e4b5d){return{'model':db[_0x2e4b5d[_0xbccd('0x1f')]],'as':_0x2e4b5d['as'],'attributes':_0x2e4b5d[_0xbccd('0x1c')],'include':_0x2e4b5d[_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x2e4b5d[_0xbccd('0x1d')],function(_0x55870c){return{'model':db[_0x55870c[_0xbccd('0x1f')]],'as':_0x55870c['as'],'attributes':_0x55870c[_0xbccd('0x1c')],'include':_0x55870c[_0xbccd('0x1d')]?_[_0xbccd('0x1e')](_0x55870c[_0xbccd('0x1d')],function(_0x25027e){return{'model':db[_0x25027e[_0xbccd('0x1f')]],'as':_0x25027e['as'],'attributes':_0x25027e[_0xbccd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbccd('0xb')](function(_0x166e9d){logger['info']('ShowDynamics365Account',_0x40a34e);logger[_0xbccd('0xf')]('ShowDynamics365Account',_0x40a34e,JSON['stringify'](_0x166e9d));_0x103dbb(_0x166e9d);})[_0xbccd('0x16')](function(_0xff00f8){logger[_0xbccd('0x12')](_0xbccd('0x20'),_0xff00f8[_0xbccd('0x14')],_0x40a34e);_0x3b60bb(_0x3791a8['error'](0x1f4,_0xff00f8['message']));});});}; \ No newline at end of file +var _0x9d89=['Dynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetDynamics365Account'];(function(_0x5cce99,_0x40acd7){var _0x27d3c2=function(_0x119e78){while(--_0x119e78){_0x5cce99['push'](_0x5cce99['shift']());}};_0x27d3c2(++_0x40acd7);}(_0x9d89,0x8f));var _0x99d8=function(_0xe4c11e,_0x4184d){_0xe4c11e=_0xe4c11e-0x0;var _0x1d5044=_0x9d89[_0xe4c11e];return _0x1d5044;};'use strict';var _=require(_0x99d8('0x0'));var util=require(_0x99d8('0x1'));var moment=require('moment');var BPromise=require(_0x99d8('0x2'));var rs=require(_0x99d8('0x3'));var fs=require('fs');var Redis=require(_0x99d8('0x4'));var db=require(_0x99d8('0x5'))['db'];var utils=require(_0x99d8('0x6'));var logger=require('../../config/logger')(_0x99d8('0x7'));var config=require(_0x99d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x99d8('0x9')][_0x99d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52949d,_0x1a8649,_0x3e6bed){return new BPromise(function(_0xee20e7,_0x19cebd){return client[_0x99d8('0xb')](_0x52949d,_0x3e6bed)[_0x99d8('0xc')](function(_0x60ecf){logger['info'](_0x99d8('0xd'),_0x1a8649,_0x99d8('0xe'));logger[_0x99d8('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1a8649,_0x99d8('0xe'),JSON[_0x99d8('0x10')](_0x60ecf));if(_0x60ecf[_0x99d8('0x11')]){if(_0x60ecf[_0x99d8('0x11')][_0x99d8('0x12')]===0x1f4){logger[_0x99d8('0x11')](_0x99d8('0xd'),_0x1a8649,_0x60ecf[_0x99d8('0x11')]['message']);return _0x19cebd(_0x60ecf[_0x99d8('0x11')][_0x99d8('0x13')]);}logger[_0x99d8('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x1a8649,_0x60ecf[_0x99d8('0x11')]['message']);return _0xee20e7(_0x60ecf[_0x99d8('0x11')]['message']);}else{logger['info'](_0x99d8('0xd'),_0x1a8649,_0x99d8('0xe'));_0xee20e7(_0x60ecf['result']['message']);}})[_0x99d8('0x14')](function(_0x4d2394){logger['error'](_0x99d8('0xd'),_0x1a8649,_0x4d2394);_0x19cebd(_0x4d2394);});});}exports[_0x99d8('0x15')]=function(_0x4802df){var _0x46e35e=this;return new Promise(function(_0x151f65,_0x54c114){return db[_0x99d8('0x16')]['findAll']({'raw':_0x4802df[_0x99d8('0x17')]?_0x4802df[_0x99d8('0x17')][_0x99d8('0x18')]===undefined?!![]:![]:!![],'where':_0x4802df[_0x99d8('0x17')]?_0x4802df[_0x99d8('0x17')][_0x99d8('0x19')]||null:null,'attributes':_0x4802df[_0x99d8('0x17')]?_0x4802df[_0x99d8('0x17')][_0x99d8('0x1a')]||null:null,'limit':_0x4802df[_0x99d8('0x17')]?_0x4802df[_0x99d8('0x17')][_0x99d8('0x1b')]||null:null,'include':_0x4802df[_0x99d8('0x17')]?_0x4802df[_0x99d8('0x17')][_0x99d8('0x1c')]?_[_0x99d8('0x1d')](_0x4802df[_0x99d8('0x17')][_0x99d8('0x1c')],function(_0x54a433){return{'model':db[_0x54a433[_0x99d8('0x1e')]],'as':_0x54a433['as'],'attributes':_0x54a433[_0x99d8('0x1a')],'include':_0x54a433[_0x99d8('0x1c')]?_[_0x99d8('0x1d')](_0x54a433[_0x99d8('0x1c')],function(_0x346807){return{'model':db[_0x346807[_0x99d8('0x1e')]],'as':_0x346807['as'],'attributes':_0x346807[_0x99d8('0x1a')],'include':_0x346807[_0x99d8('0x1c')]?_[_0x99d8('0x1d')](_0x346807[_0x99d8('0x1c')],function(_0x1b0307){return{'model':db[_0x1b0307['model']],'as':_0x1b0307['as'],'attributes':_0x1b0307[_0x99d8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99d8('0xc')](function(_0x44bf5a){logger['info'](_0x99d8('0x15'),_0x4802df);logger[_0x99d8('0xf')](_0x99d8('0x15'),_0x4802df,JSON[_0x99d8('0x10')](_0x44bf5a));_0x151f65(_0x44bf5a);})[_0x99d8('0x14')](function(_0x43784e){logger['error']('GetDynamics365Account',_0x43784e[_0x99d8('0x13')],_0x4802df);_0x54c114(_0x46e35e[_0x99d8('0x11')](0x1f4,_0x43784e[_0x99d8('0x13')]));});});};exports[_0x99d8('0x1f')]=function(_0x436b73){var _0x425fc3=this;return new Promise(function(_0x423cf6,_0x2fb0c2){return db[_0x99d8('0x16')]['find']({'raw':_0x436b73[_0x99d8('0x17')]?_0x436b73['options'][_0x99d8('0x18')]===undefined?!![]:![]:!![],'where':_0x436b73[_0x99d8('0x17')]?_0x436b73[_0x99d8('0x17')][_0x99d8('0x19')]||null:null,'attributes':_0x436b73[_0x99d8('0x17')]?_0x436b73['options'][_0x99d8('0x1a')]||null:null,'include':_0x436b73['options']?_0x436b73[_0x99d8('0x17')][_0x99d8('0x1c')]?_['map'](_0x436b73[_0x99d8('0x17')][_0x99d8('0x1c')],function(_0x2fd931){return{'model':db[_0x2fd931[_0x99d8('0x1e')]],'as':_0x2fd931['as'],'attributes':_0x2fd931['attributes'],'include':_0x2fd931[_0x99d8('0x1c')]?_[_0x99d8('0x1d')](_0x2fd931[_0x99d8('0x1c')],function(_0x1f9c98){return{'model':db[_0x1f9c98[_0x99d8('0x1e')]],'as':_0x1f9c98['as'],'attributes':_0x1f9c98['attributes'],'include':_0x1f9c98[_0x99d8('0x1c')]?_['map'](_0x1f9c98[_0x99d8('0x1c')],function(_0x22452b){return{'model':db[_0x22452b[_0x99d8('0x1e')]],'as':_0x22452b['as'],'attributes':_0x22452b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x895261){logger[_0x99d8('0x20')](_0x99d8('0x1f'),_0x436b73);logger[_0x99d8('0xf')](_0x99d8('0x1f'),_0x436b73,JSON[_0x99d8('0x10')](_0x895261));_0x423cf6(_0x895261);})['catch'](function(_0x5179a8){logger[_0x99d8('0x11')](_0x99d8('0x1f'),_0x5179a8[_0x99d8('0x13')],_0x436b73);_0x2fb0c2(_0x425fc3['error'](0x1f4,_0x5179a8[_0x99d8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0c8088f..e64646b 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 _0x6e90=['update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x6e90,0xf5));var _0x06e9=function(_0xd00d6f,_0x2475ed){_0xd00d6f=_0xd00d6f-0x0;var _0x262b18=_0x6e90[_0xd00d6f];return _0x262b18;};'use strict';var multer=require(_0x06e9('0x0'));var util=require(_0x06e9('0x1'));var path=require(_0x06e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x06e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06e9('0x4'));var interaction=require(_0x06e9('0x5'));var config=require(_0x06e9('0x6'));var controller=require(_0x06e9('0x7'));router[_0x06e9('0x8')]('/',auth[_0x06e9('0x9')](),controller['index']);router[_0x06e9('0x8')](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xb')]);router[_0x06e9('0x8')](_0x06e9('0xc'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xd')]);router[_0x06e9('0x8')](_0x06e9('0xe'),auth[_0x06e9('0x9')](),controller[_0x06e9('0xf')]);router[_0x06e9('0x8')](_0x06e9('0x10'),auth[_0x06e9('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x06e9('0x9')](),controller[_0x06e9('0x11')]);router[_0x06e9('0x12')](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0x13')]);router['delete'](_0x06e9('0xa'),auth[_0x06e9('0x9')](),controller[_0x06e9('0x14')]);module[_0x06e9('0x15')]=router; \ No newline at end of file +var _0x2a9c=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','destroy','exports','multer','connect-timeout','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a9c,0x1e6));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc2a9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc2a9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc2a9('0x2'));var controller=require(_0xc2a9('0x3'));router[_0xc2a9('0x4')]('/',auth[_0xc2a9('0x5')](),controller['index']);router[_0xc2a9('0x4')](_0xc2a9('0x6'),auth[_0xc2a9('0x5')](),controller[_0xc2a9('0x7')]);router[_0xc2a9('0x4')](_0xc2a9('0x8'),auth['isAuthenticated'](),controller[_0xc2a9('0x9')]);router[_0xc2a9('0x4')](_0xc2a9('0xa'),auth[_0xc2a9('0x5')](),controller[_0xc2a9('0xb')]);router[_0xc2a9('0x4')]('/:id/descriptions',auth[_0xc2a9('0x5')](),controller[_0xc2a9('0xc')]);router[_0xc2a9('0xd')]('/',auth[_0xc2a9('0x5')](),controller[_0xc2a9('0xe')]);router['put']('/:id',auth[_0xc2a9('0x5')](),controller['update']);router['delete']('/:id',auth[_0xc2a9('0x5')](),controller[_0xc2a9('0xf')]);module[_0xc2a9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e6b318e..e7eb412 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 _0x2462=['incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0x2462,0x83));var _0x2246=function(_0x336168,_0x9b05d1){_0x336168=_0x336168-0x0;var _0x544351=_0x2462[_0x336168];return _0x544351;};'use strict';var Sequelize=require(_0x2246('0x0'));module[_0x2246('0x1')]={'name':{'type':Sequelize[_0x2246('0x2')]},'description':{'type':Sequelize[_0x2246('0x2')]},'ticketType':{'type':Sequelize[_0x2246('0x3')](_0x2246('0x4'),_0x2246('0x5')),'defaultValue':_0x2246('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2246('0x6'),_0x2246('0x7')),'defaultValue':_0x2246('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2246('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2246('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x71b2=['phonecall','contact','nothing','sequelize','exports','STRING','ENUM','incident'];(function(_0x56e298,_0x3a7f52){var _0x3ef91a=function(_0x582f59){while(--_0x582f59){_0x56e298['push'](_0x56e298['shift']());}};_0x3ef91a(++_0x3a7f52);}(_0x71b2,0x19b));var _0x271b=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x71b2[_0x189c9e];return _0x3f38ca;};'use strict';var Sequelize=require(_0x271b('0x0'));module[_0x271b('0x1')]={'name':{'type':Sequelize[_0x271b('0x2')]},'description':{'type':Sequelize[_0x271b('0x2')]},'ticketType':{'type':Sequelize[_0x271b('0x3')](_0x271b('0x4'),_0x271b('0x5')),'defaultValue':_0x271b('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x271b('0x6'),_0x271b('0x7')),'defaultValue':_0x271b('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x271b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index cb16958..154f558 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 _0x0ccb=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Dynamics365Configuration','fieldName','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','attributes','options','find','create','body','findOne','Dynamics365Field','pick','getFields','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x36d426,_0x311192){var _0x9a6750=function(_0x3d21a4){while(--_0x3d21a4){_0x36d426['push'](_0x36d426['shift']());}};_0x9a6750(++_0x311192);}(_0x0ccb,0x8f));var _0xb0cc=function(_0x40827f,_0x415800){_0x40827f=_0x40827f-0x0;var _0x109173=_0x0ccb[_0x40827f];return _0x109173;};'use strict';var emlformat=require(_0xb0cc('0x0'));var rimraf=require(_0xb0cc('0x1'));var zipdir=require(_0xb0cc('0x2'));var jsonpatch=require(_0xb0cc('0x3'));var rp=require(_0xb0cc('0x4'));var moment=require(_0xb0cc('0x5'));var BPromise=require(_0xb0cc('0x6'));var Mustache=require(_0xb0cc('0x7'));var util=require(_0xb0cc('0x8'));var path=require(_0xb0cc('0x9'));var sox=require(_0xb0cc('0xa'));var csv=require(_0xb0cc('0xb'));var ejs=require(_0xb0cc('0xc'));var fs=require('fs');var fs_extra=require(_0xb0cc('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0cc('0xe'));var deskjs=require(_0xb0cc('0xf'));var toCsv=require(_0xb0cc('0xb'));var querystring=require(_0xb0cc('0x10'));var Papa=require(_0xb0cc('0x11'));var Redis=require(_0xb0cc('0x12'));var authService=require(_0xb0cc('0x13'));var qs=require(_0xb0cc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0cc('0x15'))(_0xb0cc('0x16'));var utils=require(_0xb0cc('0x17'));var config=require(_0xb0cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0cc('0x19'))['db'];function respondWithStatusCode(_0x227b65,_0x23f8a3){_0x23f8a3=_0x23f8a3||0xcc;return function(_0x44e4d5){if(_0x44e4d5){return _0x227b65[_0xb0cc('0x1a')](_0x23f8a3);}return _0x227b65[_0xb0cc('0x1b')](_0x23f8a3)[_0xb0cc('0x1c')]();};}function respondWithResult(_0x53fd29,_0x27e107){_0x27e107=_0x27e107||0xc8;return function(_0x494d71){if(_0x494d71){return _0x53fd29['status'](_0x27e107)[_0xb0cc('0x1d')](_0x494d71);}};}function respondWithFilteredResult(_0x1b7e8b,_0x3cbeec){return function(_0x2b77ec){if(_0x2b77ec){var _0x8fea34=typeof _0x3cbeec[_0xb0cc('0x1e')]===_0xb0cc('0x1f')&&typeof _0x3cbeec[_0xb0cc('0x20')]===_0xb0cc('0x1f');var _0x4c7f76=_0x2b77ec[_0xb0cc('0x21')];var _0x1b3cda=_0x8fea34?0x0:_0x3cbeec[_0xb0cc('0x1e')];var _0x5431b7=_0x8fea34?_0x2b77ec['count']:_0x3cbeec[_0xb0cc('0x1e')]+_0x3cbeec['limit'];var _0x36ea93;if(_0x5431b7>=_0x4c7f76){_0x5431b7=_0x4c7f76;_0x36ea93=0xc8;}else{_0x36ea93=0xce;}_0x1b7e8b[_0xb0cc('0x1b')](_0x36ea93);return _0x1b7e8b['set'](_0xb0cc('0x22'),_0x1b3cda+'-'+_0x5431b7+'/'+_0x4c7f76)[_0xb0cc('0x1d')](_0x2b77ec);}return null;};}function patchUpdates(_0x3ab1a4){return function(_0x32be50){try{jsonpatch[_0xb0cc('0x23')](_0x32be50,_0x3ab1a4,!![]);}catch(_0x24a2c3){return BPromise[_0xb0cc('0x24')](_0x24a2c3);}return _0x32be50[_0xb0cc('0x25')]();};}function saveUpdates(_0x59047d,_0xfac0ae){return function(_0x120ab6){if(_0x120ab6){return _0x120ab6[_0xb0cc('0x26')](_0x59047d)[_0xb0cc('0x27')](function(_0x2919f6){return _0x2919f6;});}return null;};}function removeEntity(_0x48f82c,_0x2980bb){return function(_0x5a8e89){if(_0x5a8e89){return _0x5a8e89[_0xb0cc('0x28')]()[_0xb0cc('0x27')](function(){_0x48f82c[_0xb0cc('0x1b')](0xcc)[_0xb0cc('0x1c')]();});}};}function handleEntityNotFound(_0x87a17b,_0x24a141){return function(_0x3972dd){if(!_0x3972dd){_0x87a17b[_0xb0cc('0x1a')](0x194);}return _0x3972dd;};}function handleError(_0x5a2e10,_0x5b9beb){_0x5b9beb=_0x5b9beb||0x1f4;return function(_0x588fe8){logger[_0xb0cc('0x29')](_0x588fe8['stack']);if(_0x588fe8['name']){delete _0x588fe8[_0xb0cc('0x2a')];}_0x5a2e10[_0xb0cc('0x1b')](_0x5b9beb)[_0xb0cc('0x2b')](_0x588fe8);};}exports['index']=function(_0x42d08b,_0x2faad7){var _0x27a809={},_0x413de9={},_0x2d0c87={'count':0x0,'rows':[]};var _0x425878=_[_0xb0cc('0x2c')](db[_0xb0cc('0x2d')]['rawAttributes'],function(_0x3a98fd){return{'name':_0x3a98fd[_0xb0cc('0x2e')],'type':_0x3a98fd['type'][_0xb0cc('0x2f')]};});_0x413de9[_0xb0cc('0x30')]=_[_0xb0cc('0x2c')](_0x425878,'name');_0x413de9[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x42d08b[_0xb0cc('0x31')]);_0x413de9[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x413de9[_0xb0cc('0x30')],_0x413de9['query']);_0x27a809['attributes']=_[_0xb0cc('0x34')](_0x413de9['model'],qs[_0xb0cc('0x35')](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x27a809['attributes']=_0x27a809['attributes'][_0xb0cc('0x36')]?_0x27a809['attributes']:_0x413de9[_0xb0cc('0x30')];if(!_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x27a809[_0xb0cc('0x20')]=qs[_0xb0cc('0x20')](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x27a809[_0xb0cc('0x1e')]=qs['offset'](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}_0x27a809[_0xb0cc('0x39')]=qs['sort'](_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3a')]);_0x27a809[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_['pick'](_0x42d08b[_0xb0cc('0x31')],_0x413de9[_0xb0cc('0x33')]),_0x425878);if(_0x42d08b['query'][_0xb0cc('0x3c')]){_0x27a809[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x27a809[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x425878,function(_0x49f23f){if(_0x49f23f['type']!==_0xb0cc('0x3e')){var _0xb35d06={};_0xb35d06[_0x49f23f['name']]={'$like':'%'+_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3c')]+'%'};return _0xb35d06;}})});}_0x27a809=_[_0xb0cc('0x3d')]({},_0x27a809,_0x42d08b['options']);var _0x4c3483={'where':_0x27a809[_0xb0cc('0x3b')]};return db[_0xb0cc('0x2d')]['count'](_0x4c3483)[_0xb0cc('0x27')](function(_0x304df6){_0x2d0c87['count']=_0x304df6;if(_0x42d08b[_0xb0cc('0x31')][_0xb0cc('0x3f')]){_0x27a809[_0xb0cc('0x40')]=[{'all':!![]}];}return db[_0xb0cc('0x2d')][_0xb0cc('0x41')](_0x27a809);})[_0xb0cc('0x27')](function(_0x9ddb43){_0x2d0c87[_0xb0cc('0x42')]=_0x9ddb43;return _0x2d0c87;})[_0xb0cc('0x27')](respondWithFilteredResult(_0x2faad7,_0x27a809))[_0xb0cc('0x43')](handleError(_0x2faad7,null));};exports[_0xb0cc('0x44')]=function(_0x15acc0,_0x549820){var _0x218f0b={'raw':![],'where':{'id':_0x15acc0[_0xb0cc('0x45')]['id']}},_0x7acb40={};_0x7acb40[_0xb0cc('0x30')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x7acb40['query']=_[_0xb0cc('0x32')](_0x15acc0[_0xb0cc('0x31')]);_0x7acb40[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x7acb40['model'],_0x7acb40[_0xb0cc('0x31')]);_0x218f0b['attributes']=_[_0xb0cc('0x34')](_0x7acb40['model'],qs[_0xb0cc('0x35')](_0x15acc0[_0xb0cc('0x31')]['fields']));_0x218f0b[_0xb0cc('0x46')]=_0x218f0b[_0xb0cc('0x46')][_0xb0cc('0x36')]?_0x218f0b[_0xb0cc('0x46')]:_0x7acb40[_0xb0cc('0x30')];if(_0x15acc0[_0xb0cc('0x31')][_0xb0cc('0x3f')]){_0x218f0b[_0xb0cc('0x40')]=[{'all':!![]}];}_0x218f0b=_[_0xb0cc('0x3d')]({},_0x218f0b,_0x15acc0[_0xb0cc('0x47')]);return db[_0xb0cc('0x2d')][_0xb0cc('0x48')](_0x218f0b)[_0xb0cc('0x27')](handleEntityNotFound(_0x549820,null))[_0xb0cc('0x27')](respondWithResult(_0x549820,null))[_0xb0cc('0x43')](handleError(_0x549820,null));};exports[_0xb0cc('0x49')]=function(_0x48f0ad,_0x3a0e69){return db[_0xb0cc('0x2d')][_0xb0cc('0x49')](_0x48f0ad['body'],{})['then'](respondWithResult(_0x3a0e69,0xc9))[_0xb0cc('0x43')](handleError(_0x3a0e69,null));};exports[_0xb0cc('0x26')]=function(_0x23abec,_0x281a7c){if(_0x23abec[_0xb0cc('0x4a')]['id']){delete _0x23abec[_0xb0cc('0x4a')]['id'];}return db[_0xb0cc('0x2d')]['find']({'where':{'id':_0x23abec[_0xb0cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x281a7c,null))['then'](saveUpdates(_0x23abec[_0xb0cc('0x4a')],null))['then'](respondWithResult(_0x281a7c,null))[_0xb0cc('0x43')](handleError(_0x281a7c,null));};exports[_0xb0cc('0x28')]=function(_0x378315,_0x57c619){return db[_0xb0cc('0x2d')][_0xb0cc('0x48')]({'where':{'id':_0x378315[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x57c619,null))[_0xb0cc('0x27')](removeEntity(_0x57c619,null))[_0xb0cc('0x43')](handleError(_0x57c619,null));};exports['getFields']=function(_0x4d31c4,_0x27f9cf,_0xfce8cd){var _0x59b447={};var _0x243a4a={};var _0x3ac5c0;var _0x304c6e;return db['Dynamics365Configuration'][_0xb0cc('0x4b')]({'where':{'id':_0x4d31c4[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x27f9cf,null))[_0xb0cc('0x27')](function(_0x49cb41){if(_0x49cb41){_0x3ac5c0=_0x49cb41;_0x243a4a[_0xb0cc('0x30')]=_['keys'](db[_0xb0cc('0x4c')]['rawAttributes']);_0x243a4a[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x4d31c4[_0xb0cc('0x31')]);_0x243a4a[_0xb0cc('0x33')]=_['intersection'](_0x243a4a['model'],_0x243a4a[_0xb0cc('0x31')]);_0x59b447[_0xb0cc('0x46')]=_[_0xb0cc('0x34')](_0x243a4a[_0xb0cc('0x30')],qs['fields'](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x59b447[_0xb0cc('0x46')]=_0x59b447[_0xb0cc('0x46')][_0xb0cc('0x36')]?_0x59b447[_0xb0cc('0x46')]:_0x243a4a[_0xb0cc('0x30')];_0x59b447[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x3a')]);_0x59b447[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_[_0xb0cc('0x4d')](_0x4d31c4[_0xb0cc('0x31')],_0x243a4a[_0xb0cc('0x33')]));if(_0x4d31c4['query'][_0xb0cc('0x3c')]){_0x59b447[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x59b447[_0xb0cc('0x3b')],{'$or':_['map'](_0x59b447[_0xb0cc('0x46')],function(_0x11de53){var _0xf9948={};_0xf9948[_0x11de53]={'$like':'%'+_0x4d31c4[_0xb0cc('0x31')]['filter']+'%'};return _0xf9948;})});}_0x59b447=_[_0xb0cc('0x3d')]({},_0x59b447,_0x4d31c4[_0xb0cc('0x47')]);return _0x3ac5c0[_0xb0cc('0x4e')](_0x59b447);}})[_0xb0cc('0x27')](function(_0x257ecf){if(_0x257ecf){_0x304c6e=_0x257ecf['length'];if(!_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x37')]('nolimit')){_0x59b447['limit']=qs[_0xb0cc('0x20')](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x59b447[_0xb0cc('0x1e')]=qs['offset'](_0x4d31c4[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}return _0x3ac5c0['getFields'](_0x59b447);}})[_0xb0cc('0x27')](function(_0x3baec7){if(_0x3baec7){return _0x3baec7?{'count':_0x304c6e,'rows':_0x3baec7}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x27f9cf,null))[_0xb0cc('0x43')](handleError(_0x27f9cf,null));};exports['getSubjects']=function(_0x1fae65,_0x3f6d35,_0x4dbbac){var _0x7e0a77={};var _0x542280={};var _0x3cca37;var _0x2c79b3;return db[_0xb0cc('0x2d')][_0xb0cc('0x4b')]({'where':{'id':_0x1fae65[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x3f6d35,null))['then'](function(_0x1e15ff){if(_0x1e15ff){_0x3cca37=_0x1e15ff;_0x542280['model']=_['keys'](db[_0xb0cc('0x4c')][_0xb0cc('0x4f')]);_0x542280['query']=_['keys'](_0x1fae65['query']);_0x542280[_0xb0cc('0x33')]=_[_0xb0cc('0x34')](_0x542280[_0xb0cc('0x30')],_0x542280[_0xb0cc('0x31')]);_0x7e0a77[_0xb0cc('0x46')]=_[_0xb0cc('0x34')](_0x542280[_0xb0cc('0x30')],qs[_0xb0cc('0x35')](_0x1fae65['query'][_0xb0cc('0x35')]));_0x7e0a77[_0xb0cc('0x46')]=_0x7e0a77[_0xb0cc('0x46')]['length']?_0x7e0a77[_0xb0cc('0x46')]:_0x542280['model'];_0x7e0a77[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x1fae65['query'][_0xb0cc('0x3a')]);_0x7e0a77['where']=qs['filters'](_[_0xb0cc('0x4d')](_0x1fae65['query'],_0x542280[_0xb0cc('0x33')]));if(_0x1fae65['query'][_0xb0cc('0x3c')]){_0x7e0a77[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x7e0a77[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x7e0a77[_0xb0cc('0x46')],function(_0x26409f){var _0x136614={};_0x136614[_0x26409f]={'$like':'%'+_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x3c')]+'%'};return _0x136614;})});}_0x7e0a77=_[_0xb0cc('0x3d')]({},_0x7e0a77,_0x1fae65['options']);return _0x3cca37['getSubjects'](_0x7e0a77);}})['then'](function(_0x5954a8){if(_0x5954a8){_0x2c79b3=_0x5954a8[_0xb0cc('0x36')];if(!_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x7e0a77[_0xb0cc('0x20')]=qs[_0xb0cc('0x20')](_0x1fae65[_0xb0cc('0x31')][_0xb0cc('0x20')]);_0x7e0a77['offset']=qs[_0xb0cc('0x1e')](_0x1fae65[_0xb0cc('0x31')]['offset']);}return _0x3cca37[_0xb0cc('0x50')](_0x7e0a77);}})[_0xb0cc('0x27')](function(_0x49b15e){if(_0x49b15e){return _0x49b15e?{'count':_0x2c79b3,'rows':_0x49b15e}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x3f6d35,null))[_0xb0cc('0x43')](handleError(_0x3f6d35,null));};exports[_0xb0cc('0x51')]=function(_0x4bed0c,_0x3f0e64,_0x3966ce){var _0x39b4cc={};var _0x346edb={};var _0x44615c;var _0x19ae45;return db[_0xb0cc('0x2d')][_0xb0cc('0x4b')]({'where':{'id':_0x4bed0c[_0xb0cc('0x45')]['id']}})[_0xb0cc('0x27')](handleEntityNotFound(_0x3f0e64,null))['then'](function(_0x21f2b8){if(_0x21f2b8){_0x44615c=_0x21f2b8;_0x346edb['model']=_[_0xb0cc('0x32')](db[_0xb0cc('0x4c')][_0xb0cc('0x4f')]);_0x346edb[_0xb0cc('0x31')]=_[_0xb0cc('0x32')](_0x4bed0c[_0xb0cc('0x31')]);_0x346edb['filters']=_['intersection'](_0x346edb[_0xb0cc('0x30')],_0x346edb[_0xb0cc('0x31')]);_0x39b4cc[_0xb0cc('0x46')]=_['intersection'](_0x346edb[_0xb0cc('0x30')],qs[_0xb0cc('0x35')](_0x4bed0c[_0xb0cc('0x31')][_0xb0cc('0x35')]));_0x39b4cc[_0xb0cc('0x46')]=_0x39b4cc[_0xb0cc('0x46')]['length']?_0x39b4cc[_0xb0cc('0x46')]:_0x346edb[_0xb0cc('0x30')];_0x39b4cc[_0xb0cc('0x39')]=qs[_0xb0cc('0x3a')](_0x4bed0c['query'][_0xb0cc('0x3a')]);_0x39b4cc[_0xb0cc('0x3b')]=qs[_0xb0cc('0x33')](_[_0xb0cc('0x4d')](_0x4bed0c[_0xb0cc('0x31')],_0x346edb[_0xb0cc('0x33')]));if(_0x4bed0c[_0xb0cc('0x31')]['filter']){_0x39b4cc[_0xb0cc('0x3b')]=_[_0xb0cc('0x3d')](_0x39b4cc[_0xb0cc('0x3b')],{'$or':_[_0xb0cc('0x2c')](_0x39b4cc[_0xb0cc('0x46')],function(_0x3dfcd0){var _0x1e500c={};_0x1e500c[_0x3dfcd0]={'$like':'%'+_0x4bed0c[_0xb0cc('0x31')]['filter']+'%'};return _0x1e500c;})});}_0x39b4cc=_['merge']({},_0x39b4cc,_0x4bed0c[_0xb0cc('0x47')]);return _0x44615c[_0xb0cc('0x51')](_0x39b4cc);}})['then'](function(_0x3b6301){if(_0x3b6301){_0x19ae45=_0x3b6301['length'];if(!_0x4bed0c['query'][_0xb0cc('0x37')](_0xb0cc('0x38'))){_0x39b4cc['limit']=qs[_0xb0cc('0x20')](_0x4bed0c['query'][_0xb0cc('0x20')]);_0x39b4cc[_0xb0cc('0x1e')]=qs[_0xb0cc('0x1e')](_0x4bed0c[_0xb0cc('0x31')][_0xb0cc('0x1e')]);}return _0x44615c[_0xb0cc('0x51')](_0x39b4cc);}})[_0xb0cc('0x27')](function(_0x212b40){if(_0x212b40){return _0x212b40?{'count':_0x19ae45,'rows':_0x212b40}:null;}})[_0xb0cc('0x27')](respondWithResult(_0x3f0e64,null))[_0xb0cc('0x43')](handleError(_0x3f0e64,null));}; \ No newline at end of file +var _0xd50d=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x13bd4c,_0x1c1945){var _0x232b68=function(_0x32e597){while(--_0x32e597){_0x13bd4c['push'](_0x13bd4c['shift']());}};_0x232b68(++_0x1c1945);}(_0xd50d,0x1db));var _0xdd50=function(_0x58d1ff,_0x55c274){_0x58d1ff=_0x58d1ff-0x0;var _0x32c810=_0xd50d[_0x58d1ff];return _0x32c810;};'use strict';var emlformat=require(_0xdd50('0x0'));var rimraf=require(_0xdd50('0x1'));var zipdir=require(_0xdd50('0x2'));var jsonpatch=require(_0xdd50('0x3'));var rp=require(_0xdd50('0x4'));var moment=require(_0xdd50('0x5'));var BPromise=require(_0xdd50('0x6'));var Mustache=require(_0xdd50('0x7'));var util=require('util');var path=require(_0xdd50('0x8'));var sox=require(_0xdd50('0x9'));var csv=require(_0xdd50('0xa'));var ejs=require(_0xdd50('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd50('0xc'));var squel=require(_0xdd50('0xd'));var crypto=require(_0xdd50('0xe'));var jsforce=require(_0xdd50('0xf'));var deskjs=require(_0xdd50('0x10'));var toCsv=require(_0xdd50('0xa'));var querystring=require('querystring');var Papa=require(_0xdd50('0x11'));var Redis=require(_0xdd50('0x12'));var authService=require(_0xdd50('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd50('0x14'));var logger=require(_0xdd50('0x15'))(_0xdd50('0x16'));var utils=require('../../config/utils');var config=require(_0xdd50('0x17'));var licenseUtil=require(_0xdd50('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42e9b8,_0x1e5a96){_0x1e5a96=_0x1e5a96||0xcc;return function(_0x48ebd1){if(_0x48ebd1){return _0x42e9b8[_0xdd50('0x19')](_0x1e5a96);}return _0x42e9b8[_0xdd50('0x1a')](_0x1e5a96)[_0xdd50('0x1b')]();};}function respondWithResult(_0x54d4a9,_0x551ff2){_0x551ff2=_0x551ff2||0xc8;return function(_0x3f9f9f){if(_0x3f9f9f){return _0x54d4a9['status'](_0x551ff2)[_0xdd50('0x1c')](_0x3f9f9f);}};}function respondWithFilteredResult(_0x1b9f92,_0x2ce84c){return function(_0x1c20e3){if(_0x1c20e3){var _0x305254=typeof _0x2ce84c[_0xdd50('0x1d')]===_0xdd50('0x1e')&&typeof _0x2ce84c[_0xdd50('0x1f')]===_0xdd50('0x1e');var _0x234fed=_0x1c20e3[_0xdd50('0x20')];var _0x1d771f=_0x305254?0x0:_0x2ce84c['offset'];var _0x41d04e=_0x305254?_0x1c20e3[_0xdd50('0x20')]:_0x2ce84c[_0xdd50('0x1d')]+_0x2ce84c[_0xdd50('0x1f')];var _0x9aabc3;if(_0x41d04e>=_0x234fed){_0x41d04e=_0x234fed;_0x9aabc3=0xc8;}else{_0x9aabc3=0xce;}_0x1b9f92[_0xdd50('0x1a')](_0x9aabc3);return _0x1b9f92[_0xdd50('0x21')](_0xdd50('0x22'),_0x1d771f+'-'+_0x41d04e+'/'+_0x234fed)[_0xdd50('0x1c')](_0x1c20e3);}return null;};}function patchUpdates(_0x1f5841){return function(_0x178752){try{jsonpatch[_0xdd50('0x23')](_0x178752,_0x1f5841,!![]);}catch(_0x734c20){return BPromise['reject'](_0x734c20);}return _0x178752[_0xdd50('0x24')]();};}function saveUpdates(_0x797a1b,_0x479750){return function(_0x174e72){if(_0x174e72){return _0x174e72[_0xdd50('0x25')](_0x797a1b)[_0xdd50('0x26')](function(_0x264f1b){return _0x264f1b;});}return null;};}function removeEntity(_0x501119,_0x547bce){return function(_0x3cb98e){if(_0x3cb98e){return _0x3cb98e[_0xdd50('0x27')]()[_0xdd50('0x26')](function(){_0x501119['status'](0xcc)[_0xdd50('0x1b')]();});}};}function handleEntityNotFound(_0x202c00,_0x510ab4){return function(_0x351c2d){if(!_0x351c2d){_0x202c00[_0xdd50('0x19')](0x194);}return _0x351c2d;};}function handleError(_0x5848e7,_0x1aca2e){_0x1aca2e=_0x1aca2e||0x1f4;return function(_0x383cc2){logger[_0xdd50('0x28')](_0x383cc2[_0xdd50('0x29')]);if(_0x383cc2[_0xdd50('0x2a')]){delete _0x383cc2['name'];}_0x5848e7[_0xdd50('0x1a')](_0x1aca2e)[_0xdd50('0x2b')](_0x383cc2);};}exports[_0xdd50('0x2c')]=function(_0x2d70d9,_0x4569d8){var _0x4eeffe={},_0x1f3448={},_0x39b43e={'count':0x0,'rows':[]};var _0x50a1e5=_[_0xdd50('0x2d')](db[_0xdd50('0x2e')]['rawAttributes'],function(_0x44e4fa){return{'name':_0x44e4fa[_0xdd50('0x2f')],'type':_0x44e4fa['type'][_0xdd50('0x30')]};});_0x1f3448[_0xdd50('0x31')]=_[_0xdd50('0x2d')](_0x50a1e5,_0xdd50('0x2a'));_0x1f3448[_0xdd50('0x32')]=_[_0xdd50('0x33')](_0x2d70d9['query']);_0x1f3448[_0xdd50('0x34')]=_[_0xdd50('0x35')](_0x1f3448['model'],_0x1f3448[_0xdd50('0x32')]);_0x4eeffe['attributes']=_[_0xdd50('0x35')](_0x1f3448[_0xdd50('0x31')],qs['fields'](_0x2d70d9['query'][_0xdd50('0x36')]));_0x4eeffe[_0xdd50('0x37')]=_0x4eeffe[_0xdd50('0x37')]['length']?_0x4eeffe[_0xdd50('0x37')]:_0x1f3448[_0xdd50('0x31')];if(!_0x2d70d9['query'][_0xdd50('0x38')]('nolimit')){_0x4eeffe[_0xdd50('0x1f')]=qs[_0xdd50('0x1f')](_0x2d70d9['query']['limit']);_0x4eeffe[_0xdd50('0x1d')]=qs[_0xdd50('0x1d')](_0x2d70d9[_0xdd50('0x32')]['offset']);}_0x4eeffe[_0xdd50('0x39')]=qs['sort'](_0x2d70d9['query'][_0xdd50('0x3a')]);_0x4eeffe[_0xdd50('0x3b')]=qs[_0xdd50('0x34')](_[_0xdd50('0x3c')](_0x2d70d9[_0xdd50('0x32')],_0x1f3448['filters']),_0x50a1e5);if(_0x2d70d9[_0xdd50('0x32')][_0xdd50('0x3d')]){_0x4eeffe[_0xdd50('0x3b')]=_['merge'](_0x4eeffe[_0xdd50('0x3b')],{'$or':_[_0xdd50('0x2d')](_0x50a1e5,function(_0x1f1cf7){if(_0x1f1cf7['type']!==_0xdd50('0x3e')){var _0xf049ff={};_0xf049ff[_0x1f1cf7[_0xdd50('0x2a')]]={'$like':'%'+_0x2d70d9['query']['filter']+'%'};return _0xf049ff;}})});}_0x4eeffe=_[_0xdd50('0x3f')]({},_0x4eeffe,_0x2d70d9[_0xdd50('0x40')]);var _0x469387={'where':_0x4eeffe[_0xdd50('0x3b')]};return db[_0xdd50('0x2e')][_0xdd50('0x20')](_0x469387)[_0xdd50('0x26')](function(_0x180045){_0x39b43e[_0xdd50('0x20')]=_0x180045;if(_0x2d70d9['query'][_0xdd50('0x41')]){_0x4eeffe['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x4eeffe);})['then'](function(_0x502209){_0x39b43e[_0xdd50('0x42')]=_0x502209;return _0x39b43e;})[_0xdd50('0x26')](respondWithFilteredResult(_0x4569d8,_0x4eeffe))[_0xdd50('0x43')](handleError(_0x4569d8,null));};exports[_0xdd50('0x44')]=function(_0x251f09,_0x3dde5e){var _0x40f411={'raw':![],'where':{'id':_0x251f09[_0xdd50('0x45')]['id']}},_0x3fd0d7={};_0x3fd0d7[_0xdd50('0x31')]=_[_0xdd50('0x33')](db[_0xdd50('0x2e')][_0xdd50('0x46')]);_0x3fd0d7[_0xdd50('0x32')]=_[_0xdd50('0x33')](_0x251f09[_0xdd50('0x32')]);_0x3fd0d7[_0xdd50('0x34')]=_[_0xdd50('0x35')](_0x3fd0d7[_0xdd50('0x31')],_0x3fd0d7[_0xdd50('0x32')]);_0x40f411[_0xdd50('0x37')]=_[_0xdd50('0x35')](_0x3fd0d7['model'],qs[_0xdd50('0x36')](_0x251f09['query'][_0xdd50('0x36')]));_0x40f411[_0xdd50('0x37')]=_0x40f411[_0xdd50('0x37')][_0xdd50('0x47')]?_0x40f411[_0xdd50('0x37')]:_0x3fd0d7[_0xdd50('0x31')];if(_0x251f09[_0xdd50('0x32')][_0xdd50('0x41')]){_0x40f411[_0xdd50('0x48')]=[{'all':!![]}];}_0x40f411=_[_0xdd50('0x3f')]({},_0x40f411,_0x251f09[_0xdd50('0x40')]);return db[_0xdd50('0x2e')][_0xdd50('0x49')](_0x40f411)[_0xdd50('0x26')](handleEntityNotFound(_0x3dde5e,null))[_0xdd50('0x26')](respondWithResult(_0x3dde5e,null))[_0xdd50('0x43')](handleError(_0x3dde5e,null));};exports[_0xdd50('0x4a')]=function(_0x5c8e21,_0x4679a5){return db[_0xdd50('0x2e')][_0xdd50('0x4a')](_0x5c8e21[_0xdd50('0x4b')],{})[_0xdd50('0x26')](respondWithResult(_0x4679a5,0xc9))[_0xdd50('0x43')](handleError(_0x4679a5,null));};exports[_0xdd50('0x25')]=function(_0x320190,_0x4db7e8){if(_0x320190['body']['id']){delete _0x320190[_0xdd50('0x4b')]['id'];}return db[_0xdd50('0x2e')][_0xdd50('0x49')]({'where':{'id':_0x320190[_0xdd50('0x45')]['id']}})['then'](handleEntityNotFound(_0x4db7e8,null))[_0xdd50('0x26')](saveUpdates(_0x320190[_0xdd50('0x4b')],null))['then'](respondWithResult(_0x4db7e8,null))[_0xdd50('0x43')](handleError(_0x4db7e8,null));};exports[_0xdd50('0x27')]=function(_0x52ed6a,_0x4d86d2){return db[_0xdd50('0x2e')][_0xdd50('0x49')]({'where':{'id':_0x52ed6a[_0xdd50('0x45')]['id']}})[_0xdd50('0x26')](handleEntityNotFound(_0x4d86d2,null))[_0xdd50('0x26')](removeEntity(_0x4d86d2,null))[_0xdd50('0x43')](handleError(_0x4d86d2,null));};exports[_0xdd50('0x4c')]=function(_0x578ca9,_0x1db800,_0x5d6343){var _0x5260a1={};var _0x4e832d={};var _0x58ff6f;var _0x43af5a;return db[_0xdd50('0x2e')][_0xdd50('0x4d')]({'where':{'id':_0x578ca9[_0xdd50('0x45')]['id']}})[_0xdd50('0x26')](handleEntityNotFound(_0x1db800,null))[_0xdd50('0x26')](function(_0x236929){if(_0x236929){_0x58ff6f=_0x236929;_0x4e832d[_0xdd50('0x31')]=_[_0xdd50('0x33')](db[_0xdd50('0x4e')][_0xdd50('0x46')]);_0x4e832d[_0xdd50('0x32')]=_['keys'](_0x578ca9[_0xdd50('0x32')]);_0x4e832d[_0xdd50('0x34')]=_[_0xdd50('0x35')](_0x4e832d[_0xdd50('0x31')],_0x4e832d['query']);_0x5260a1[_0xdd50('0x37')]=_['intersection'](_0x4e832d['model'],qs[_0xdd50('0x36')](_0x578ca9[_0xdd50('0x32')][_0xdd50('0x36')]));_0x5260a1[_0xdd50('0x37')]=_0x5260a1[_0xdd50('0x37')]['length']?_0x5260a1[_0xdd50('0x37')]:_0x4e832d['model'];_0x5260a1[_0xdd50('0x39')]=qs['sort'](_0x578ca9[_0xdd50('0x32')][_0xdd50('0x3a')]);_0x5260a1[_0xdd50('0x3b')]=qs[_0xdd50('0x34')](_[_0xdd50('0x3c')](_0x578ca9['query'],_0x4e832d[_0xdd50('0x34')]));if(_0x578ca9['query']['filter']){_0x5260a1[_0xdd50('0x3b')]=_[_0xdd50('0x3f')](_0x5260a1[_0xdd50('0x3b')],{'$or':_['map'](_0x5260a1[_0xdd50('0x37')],function(_0x57b6c4){var _0x4f2de1={};_0x4f2de1[_0x57b6c4]={'$like':'%'+_0x578ca9[_0xdd50('0x32')][_0xdd50('0x3d')]+'%'};return _0x4f2de1;})});}_0x5260a1=_[_0xdd50('0x3f')]({},_0x5260a1,_0x578ca9['options']);return _0x58ff6f[_0xdd50('0x4c')](_0x5260a1);}})[_0xdd50('0x26')](function(_0x433884){if(_0x433884){_0x43af5a=_0x433884[_0xdd50('0x47')];if(!_0x578ca9[_0xdd50('0x32')][_0xdd50('0x38')](_0xdd50('0x4f'))){_0x5260a1[_0xdd50('0x1f')]=qs[_0xdd50('0x1f')](_0x578ca9[_0xdd50('0x32')][_0xdd50('0x1f')]);_0x5260a1[_0xdd50('0x1d')]=qs[_0xdd50('0x1d')](_0x578ca9[_0xdd50('0x32')][_0xdd50('0x1d')]);}return _0x58ff6f['getFields'](_0x5260a1);}})[_0xdd50('0x26')](function(_0x43b9ca){if(_0x43b9ca){return _0x43b9ca?{'count':_0x43af5a,'rows':_0x43b9ca}:null;}})[_0xdd50('0x26')](respondWithResult(_0x1db800,null))[_0xdd50('0x43')](handleError(_0x1db800,null));};exports[_0xdd50('0x50')]=function(_0x359e0d,_0x19d9af,_0x22508c){var _0x39907c={};var _0x1e8d59={};var _0x408b41;var _0x5db592;return db[_0xdd50('0x2e')]['findOne']({'where':{'id':_0x359e0d[_0xdd50('0x45')]['id']}})['then'](handleEntityNotFound(_0x19d9af,null))['then'](function(_0xe5cdc7){if(_0xe5cdc7){_0x408b41=_0xe5cdc7;_0x1e8d59[_0xdd50('0x31')]=_[_0xdd50('0x33')](db[_0xdd50('0x4e')][_0xdd50('0x46')]);_0x1e8d59[_0xdd50('0x32')]=_[_0xdd50('0x33')](_0x359e0d[_0xdd50('0x32')]);_0x1e8d59[_0xdd50('0x34')]=_[_0xdd50('0x35')](_0x1e8d59[_0xdd50('0x31')],_0x1e8d59[_0xdd50('0x32')]);_0x39907c[_0xdd50('0x37')]=_[_0xdd50('0x35')](_0x1e8d59[_0xdd50('0x31')],qs[_0xdd50('0x36')](_0x359e0d['query'][_0xdd50('0x36')]));_0x39907c['attributes']=_0x39907c[_0xdd50('0x37')][_0xdd50('0x47')]?_0x39907c[_0xdd50('0x37')]:_0x1e8d59[_0xdd50('0x31')];_0x39907c[_0xdd50('0x39')]=qs[_0xdd50('0x3a')](_0x359e0d[_0xdd50('0x32')]['sort']);_0x39907c[_0xdd50('0x3b')]=qs[_0xdd50('0x34')](_[_0xdd50('0x3c')](_0x359e0d[_0xdd50('0x32')],_0x1e8d59['filters']));if(_0x359e0d[_0xdd50('0x32')][_0xdd50('0x3d')]){_0x39907c['where']=_[_0xdd50('0x3f')](_0x39907c[_0xdd50('0x3b')],{'$or':_['map'](_0x39907c[_0xdd50('0x37')],function(_0x3447cb){var _0x51d84a={};_0x51d84a[_0x3447cb]={'$like':'%'+_0x359e0d['query'][_0xdd50('0x3d')]+'%'};return _0x51d84a;})});}_0x39907c=_[_0xdd50('0x3f')]({},_0x39907c,_0x359e0d[_0xdd50('0x40')]);return _0x408b41[_0xdd50('0x50')](_0x39907c);}})[_0xdd50('0x26')](function(_0x4b78e6){if(_0x4b78e6){_0x5db592=_0x4b78e6[_0xdd50('0x47')];if(!_0x359e0d['query'][_0xdd50('0x38')](_0xdd50('0x4f'))){_0x39907c[_0xdd50('0x1f')]=qs[_0xdd50('0x1f')](_0x359e0d[_0xdd50('0x32')][_0xdd50('0x1f')]);_0x39907c[_0xdd50('0x1d')]=qs['offset'](_0x359e0d['query']['offset']);}return _0x408b41[_0xdd50('0x50')](_0x39907c);}})[_0xdd50('0x26')](function(_0x2d2d2b){if(_0x2d2d2b){return _0x2d2d2b?{'count':_0x5db592,'rows':_0x2d2d2b}:null;}})[_0xdd50('0x26')](respondWithResult(_0x19d9af,null))['catch'](handleError(_0x19d9af,null));};exports[_0xdd50('0x51')]=function(_0x1925f2,_0x5831ca,_0x3428ff){var _0xb63e8a={};var _0xd64036={};var _0x19ccbc;var _0x1d06e3;return db[_0xdd50('0x2e')][_0xdd50('0x4d')]({'where':{'id':_0x1925f2[_0xdd50('0x45')]['id']}})[_0xdd50('0x26')](handleEntityNotFound(_0x5831ca,null))['then'](function(_0x47941d){if(_0x47941d){_0x19ccbc=_0x47941d;_0xd64036[_0xdd50('0x31')]=_[_0xdd50('0x33')](db[_0xdd50('0x4e')][_0xdd50('0x46')]);_0xd64036[_0xdd50('0x32')]=_[_0xdd50('0x33')](_0x1925f2[_0xdd50('0x32')]);_0xd64036[_0xdd50('0x34')]=_['intersection'](_0xd64036[_0xdd50('0x31')],_0xd64036[_0xdd50('0x32')]);_0xb63e8a[_0xdd50('0x37')]=_[_0xdd50('0x35')](_0xd64036[_0xdd50('0x31')],qs[_0xdd50('0x36')](_0x1925f2[_0xdd50('0x32')][_0xdd50('0x36')]));_0xb63e8a[_0xdd50('0x37')]=_0xb63e8a[_0xdd50('0x37')]['length']?_0xb63e8a[_0xdd50('0x37')]:_0xd64036[_0xdd50('0x31')];_0xb63e8a[_0xdd50('0x39')]=qs[_0xdd50('0x3a')](_0x1925f2[_0xdd50('0x32')]['sort']);_0xb63e8a[_0xdd50('0x3b')]=qs[_0xdd50('0x34')](_[_0xdd50('0x3c')](_0x1925f2[_0xdd50('0x32')],_0xd64036[_0xdd50('0x34')]));if(_0x1925f2[_0xdd50('0x32')]['filter']){_0xb63e8a[_0xdd50('0x3b')]=_[_0xdd50('0x3f')](_0xb63e8a[_0xdd50('0x3b')],{'$or':_[_0xdd50('0x2d')](_0xb63e8a[_0xdd50('0x37')],function(_0x39d57a){var _0x296c85={};_0x296c85[_0x39d57a]={'$like':'%'+_0x1925f2['query'][_0xdd50('0x3d')]+'%'};return _0x296c85;})});}_0xb63e8a=_[_0xdd50('0x3f')]({},_0xb63e8a,_0x1925f2[_0xdd50('0x40')]);return _0x19ccbc[_0xdd50('0x51')](_0xb63e8a);}})['then'](function(_0x5f550b){if(_0x5f550b){_0x1d06e3=_0x5f550b[_0xdd50('0x47')];if(!_0x1925f2[_0xdd50('0x32')]['hasOwnProperty']('nolimit')){_0xb63e8a['limit']=qs['limit'](_0x1925f2[_0xdd50('0x32')]['limit']);_0xb63e8a['offset']=qs['offset'](_0x1925f2[_0xdd50('0x32')][_0xdd50('0x1d')]);}return _0x19ccbc[_0xdd50('0x51')](_0xb63e8a);}})['then'](function(_0x5dcc02){if(_0x5dcc02){return _0x5dcc02?{'count':_0x1d06e3,'rows':_0x5dcc02}:null;}})[_0xdd50('0x26')](respondWithResult(_0x5831ca,null))[_0xdd50('0x43')](handleError(_0x5831ca,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 80928b7..8507e9f 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9a19,0x114));var _0x99a1=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x9a19[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x36caa5,_0x1cf3ab){_0x36caa5=_0x36caa5-0x0;var _0x111231=_0xe5b3[_0x36caa5];return _0x111231;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('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 b5d573c..f0f03ea 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 _0x6db3=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xae7b21,_0x55be5f){var _0x3dd709=function(_0x40f76d){while(--_0x40f76d){_0xae7b21['push'](_0xae7b21['shift']());}};_0x3dd709(++_0x55be5f);}(_0x6db3,0x1d8));var _0x36db=function(_0x308c81,_0x3b1c85){_0x308c81=_0x308c81-0x0;var _0x5cc912=_0x6db3[_0x308c81];return _0x5cc912;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36db('0x0'));var BPromise=require(_0x36db('0x1'));var rs=require(_0x36db('0x2'));var fs=require('fs');var Redis=require(_0x36db('0x3'));var db=require(_0x36db('0x4'))['db'];var utils=require(_0x36db('0x5'));var logger=require(_0x36db('0x6'))(_0x36db('0x7'));var config=require(_0x36db('0x8'));var jayson=require(_0x36db('0x9'));var client=jayson[_0x36db('0xa')][_0x36db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e549,_0x1fa988,_0x3421f3){return new BPromise(function(_0x145f31,_0x1e0bdd){return client['request'](_0x56e549,_0x3421f3)[_0x36db('0xc')](function(_0x14ad33){logger[_0x36db('0xd')](_0x36db('0xe'),_0x1fa988,_0x36db('0xf'));logger[_0x36db('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1fa988,_0x36db('0xf'),JSON[_0x36db('0x11')](_0x14ad33));if(_0x14ad33[_0x36db('0x12')]){if(_0x14ad33[_0x36db('0x12')][_0x36db('0x13')]===0x1f4){logger[_0x36db('0x12')](_0x36db('0xe'),_0x1fa988,_0x14ad33[_0x36db('0x12')][_0x36db('0x14')]);return _0x1e0bdd(_0x14ad33['error']['message']);}logger[_0x36db('0x12')](_0x36db('0xe'),_0x1fa988,_0x14ad33['error'][_0x36db('0x14')]);return _0x145f31(_0x14ad33['error'][_0x36db('0x14')]);}else{logger[_0x36db('0xd')](_0x36db('0xe'),_0x1fa988,_0x36db('0xf'));_0x145f31(_0x14ad33['result'][_0x36db('0x14')]);}})[_0x36db('0x15')](function(_0x433af7){logger[_0x36db('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1fa988,_0x433af7);_0x1e0bdd(_0x433af7);});});} \ No newline at end of file +var _0x0f13=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','../../config/utils'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0f13,0xb1));var _0x30f1=function(_0xe5338d,_0x5c911f){_0xe5338d=_0xe5338d-0x0;var _0x185e6d=_0x0f13[_0xe5338d];return _0x185e6d;};'use strict';var _=require(_0x30f1('0x0'));var util=require(_0x30f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x30f1('0x2'));var logger=require(_0x30f1('0x3'))(_0x30f1('0x4'));var config=require(_0x30f1('0x5'));var jayson=require(_0x30f1('0x6'));var client=jayson[_0x30f1('0x7')][_0x30f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x498e5f,_0x17829b,_0x2ed80d){return new BPromise(function(_0x335080,_0x2b4a8e){return client['request'](_0x498e5f,_0x2ed80d)['then'](function(_0x36d159){logger[_0x30f1('0x9')](_0x30f1('0xa'),_0x17829b,'request\x20sent');logger[_0x30f1('0xb')](_0x30f1('0xc'),_0x17829b,_0x30f1('0xd'),JSON[_0x30f1('0xe')](_0x36d159));if(_0x36d159[_0x30f1('0xf')]){if(_0x36d159[_0x30f1('0xf')][_0x30f1('0x10')]===0x1f4){logger['error'](_0x30f1('0xa'),_0x17829b,_0x36d159['error'][_0x30f1('0x11')]);return _0x2b4a8e(_0x36d159[_0x30f1('0xf')][_0x30f1('0x11')]);}logger[_0x30f1('0xf')](_0x30f1('0xa'),_0x17829b,_0x36d159[_0x30f1('0xf')]['message']);return _0x335080(_0x36d159['error'][_0x30f1('0x11')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x17829b,_0x30f1('0xd'));_0x335080(_0x36d159[_0x30f1('0x12')][_0x30f1('0x11')]);}})[_0x30f1('0x13')](function(_0xac9de9){logger[_0x30f1('0xf')](_0x30f1('0xa'),_0x17829b,_0xac9de9);_0x2b4a8e(_0xac9de9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 456f07d..40fc9a6 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 _0x3594=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','destroy','exports'];(function(_0x500649,_0x669569){var _0xec40d8=function(_0x1deca4){while(--_0x1deca4){_0x500649['push'](_0x500649['shift']());}};_0xec40d8(++_0x669569);}(_0x3594,0x165));var _0x4359=function(_0x4918cf,_0x1997e8){_0x4918cf=_0x4918cf-0x0;var _0x6e3ae4=_0x3594[_0x4918cf];return _0x6e3ae4;};'use strict';var multer=require(_0x4359('0x0'));var util=require(_0x4359('0x1'));var path=require('path');var timeout=require(_0x4359('0x2'));var express=require(_0x4359('0x3'));var router=express[_0x4359('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4359('0x5'));var interaction=require(_0x4359('0x6'));var config=require(_0x4359('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x4359('0x8')](),controller[_0x4359('0x9')]);router[_0x4359('0xa')](_0x4359('0xb'),auth['isAuthenticated'](),controller[_0x4359('0xc')]);router[_0x4359('0xd')]('/',auth[_0x4359('0x8')](),controller[_0x4359('0xe')]);router['put'](_0x4359('0xb'),auth[_0x4359('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4359('0xf')]);module[_0x4359('0x10')]=router; \ No newline at end of file +var _0xe7fd=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe7fd,0x1c2));var _0xde7f=function(_0x2f3e4d,_0x39c5f2){_0x2f3e4d=_0x2f3e4d-0x0;var _0x1d6e0d=_0xe7fd[_0x2f3e4d];return _0x1d6e0d;};'use strict';var multer=require(_0xde7f('0x0'));var util=require('util');var path=require(_0xde7f('0x1'));var timeout=require('connect-timeout');var express=require(_0xde7f('0x2'));var router=express['Router']();var fs_extra=require(_0xde7f('0x3'));var auth=require(_0xde7f('0x4'));var interaction=require(_0xde7f('0x5'));var config=require(_0xde7f('0x6'));var controller=require(_0xde7f('0x7'));router[_0xde7f('0x8')]('/',auth[_0xde7f('0x9')](),controller[_0xde7f('0xa')]);router[_0xde7f('0x8')](_0xde7f('0xb'),auth[_0xde7f('0x9')](),controller['show']);router[_0xde7f('0xc')]('/',auth[_0xde7f('0x9')](),controller['create']);router[_0xde7f('0xd')](_0xde7f('0xb'),auth[_0xde7f('0x9')](),controller[_0xde7f('0xe')]);router[_0xde7f('0xf')](_0xde7f('0xb'),auth[_0xde7f('0x9')](),controller[_0xde7f('0x10')]);module[_0xde7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0a7b284..46d853b 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 _0x0891=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5ddb8f,_0x349733){var _0xe22d4f=function(_0x45e0d2){while(--_0x45e0d2){_0x5ddb8f['push'](_0x5ddb8f['shift']());}};_0xe22d4f(++_0x349733);}(_0x0891,0xc9));var _0x1089=function(_0x21f5f3,_0x1d563d){_0x21f5f3=_0x21f5f3-0x0;var _0x53dc8c=_0x0891[_0x21f5f3];return _0x53dc8c;};'use strict';var Sequelize=require(_0x1089('0x0'));module[_0x1089('0x1')]={'type':{'type':Sequelize[_0x1089('0x2')]('string',_0x1089('0x3'),_0x1089('0x4'),_0x1089('0x5'),_0x1089('0x6')),'defaultValue':_0x1089('0x7')},'content':{'type':Sequelize[_0x1089('0x8')]},'key':{'type':Sequelize[_0x1089('0x8')]},'keyType':{'type':Sequelize[_0x1089('0x2')](_0x1089('0x7'),'variable',_0x1089('0x4'))},'keyContent':{'type':Sequelize[_0x1089('0x8')]},'idField':{'type':Sequelize[_0x1089('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1089('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1089('0x8')]}}; \ No newline at end of file +var _0x25aa=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x599b43,_0x3dfee4){var _0x1d4426=function(_0x1209f5){while(--_0x1209f5){_0x599b43['push'](_0x599b43['shift']());}};_0x1d4426(++_0x3dfee4);}(_0x25aa,0x16e));var _0xa25a=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x25aa[_0x35007a];return _0x574f68;};'use strict';var Sequelize=require(_0xa25a('0x0'));module[_0xa25a('0x1')]={'type':{'type':Sequelize[_0xa25a('0x2')](_0xa25a('0x3'),_0xa25a('0x4'),_0xa25a('0x5'),'keyValue',_0xa25a('0x6')),'defaultValue':_0xa25a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa25a('0x7')]},'keyType':{'type':Sequelize[_0xa25a('0x2')]('string','variable',_0xa25a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa25a('0x7')]},'nameField':{'type':Sequelize[_0xa25a('0x7')]},'customField':{'type':Sequelize[_0xa25a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa25a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2c050cf..798e7d8 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 _0x23ac=['query','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','eml-format','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/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1e9a51,_0x143522){var _0x2839b8=function(_0x3a242e){while(--_0x3a242e){_0x1e9a51['push'](_0x1e9a51['shift']());}};_0x2839b8(++_0x143522);}(_0x23ac,0x1d5));var _0xc23a=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x23ac[_0x3f8743];return _0x1f844c;};'use strict';var emlformat=require(_0xc23a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc23a('0x1'));var jsonpatch=require(_0xc23a('0x2'));var rp=require(_0xc23a('0x3'));var moment=require(_0xc23a('0x4'));var BPromise=require(_0xc23a('0x5'));var Mustache=require(_0xc23a('0x6'));var util=require(_0xc23a('0x7'));var path=require(_0xc23a('0x8'));var sox=require(_0xc23a('0x9'));var csv=require(_0xc23a('0xa'));var ejs=require(_0xc23a('0xb'));var fs=require('fs');var fs_extra=require(_0xc23a('0xc'));var _=require(_0xc23a('0xd'));var squel=require(_0xc23a('0xe'));var crypto=require(_0xc23a('0xf'));var jsforce=require(_0xc23a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc23a('0xa'));var querystring=require(_0xc23a('0x11'));var Papa=require(_0xc23a('0x12'));var Redis=require(_0xc23a('0x13'));var authService=require(_0xc23a('0x14'));var qs=require(_0xc23a('0x15'));var as=require(_0xc23a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc23a('0x17'))('api');var utils=require(_0xc23a('0x18'));var config=require(_0xc23a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a62d,_0x414d32){_0x414d32=_0x414d32||0xcc;return function(_0x5eb912){if(_0x5eb912){return _0x44a62d[_0xc23a('0x1a')](_0x414d32);}return _0x44a62d[_0xc23a('0x1b')](_0x414d32)[_0xc23a('0x1c')]();};}function respondWithResult(_0x2df06d,_0x2a0f49){_0x2a0f49=_0x2a0f49||0xc8;return function(_0x3516a7){if(_0x3516a7){return _0x2df06d['status'](_0x2a0f49)[_0xc23a('0x1d')](_0x3516a7);}};}function respondWithFilteredResult(_0x21731f,_0x43f5c5){return function(_0xdf4d92){if(_0xdf4d92){var _0x4c0342=typeof _0x43f5c5[_0xc23a('0x1e')]===_0xc23a('0x1f')&&typeof _0x43f5c5[_0xc23a('0x20')]==='undefined';var _0x457723=_0xdf4d92[_0xc23a('0x21')];var _0x54bb6c=_0x4c0342?0x0:_0x43f5c5[_0xc23a('0x1e')];var _0x559628=_0x4c0342?_0xdf4d92[_0xc23a('0x21')]:_0x43f5c5[_0xc23a('0x1e')]+_0x43f5c5[_0xc23a('0x20')];var _0x5379dc;if(_0x559628>=_0x457723){_0x559628=_0x457723;_0x5379dc=0xc8;}else{_0x5379dc=0xce;}_0x21731f[_0xc23a('0x1b')](_0x5379dc);return _0x21731f[_0xc23a('0x22')](_0xc23a('0x23'),_0x54bb6c+'-'+_0x559628+'/'+_0x457723)[_0xc23a('0x1d')](_0xdf4d92);}return null;};}function patchUpdates(_0x43a3ec){return function(_0x378a69){try{jsonpatch[_0xc23a('0x24')](_0x378a69,_0x43a3ec,!![]);}catch(_0x1953a0){return BPromise['reject'](_0x1953a0);}return _0x378a69['save']();};}function saveUpdates(_0x14bebb,_0x36a3e2){return function(_0x1cdd1b){if(_0x1cdd1b){return _0x1cdd1b[_0xc23a('0x25')](_0x14bebb)[_0xc23a('0x26')](function(_0x22e489){return _0x22e489;});}return null;};}function removeEntity(_0x39a999,_0x515653){return function(_0x2c4f1c){if(_0x2c4f1c){return _0x2c4f1c['destroy']()[_0xc23a('0x26')](function(){_0x39a999[_0xc23a('0x1b')](0xcc)[_0xc23a('0x1c')]();});}};}function handleEntityNotFound(_0x4cb075,_0x4be8f6){return function(_0x3896ab){if(!_0x3896ab){_0x4cb075[_0xc23a('0x1a')](0x194);}return _0x3896ab;};}function handleError(_0xaba175,_0x460410){_0x460410=_0x460410||0x1f4;return function(_0x5dfcee){logger['error'](_0x5dfcee[_0xc23a('0x27')]);if(_0x5dfcee[_0xc23a('0x28')]){delete _0x5dfcee[_0xc23a('0x28')];}_0xaba175[_0xc23a('0x1b')](_0x460410)['send'](_0x5dfcee);};}exports[_0xc23a('0x29')]=function(_0x296c97,_0x2a6660){var _0x1da5dc={},_0x293c9c={},_0x286704={'count':0x0,'rows':[]};var _0x2d269e=_[_0xc23a('0x2a')](db[_0xc23a('0x2b')][_0xc23a('0x2c')],function(_0x231e95){return{'name':_0x231e95[_0xc23a('0x2d')],'type':_0x231e95[_0xc23a('0x2e')][_0xc23a('0x2f')]};});_0x293c9c[_0xc23a('0x30')]=_['map'](_0x2d269e,'name');_0x293c9c['query']=_['keys'](_0x296c97['query']);_0x293c9c[_0xc23a('0x31')]=_[_0xc23a('0x32')](_0x293c9c[_0xc23a('0x30')],_0x293c9c['query']);_0x1da5dc[_0xc23a('0x33')]=_[_0xc23a('0x32')](_0x293c9c[_0xc23a('0x30')],qs['fields'](_0x296c97['query'][_0xc23a('0x34')]));_0x1da5dc['attributes']=_0x1da5dc['attributes'][_0xc23a('0x35')]?_0x1da5dc[_0xc23a('0x33')]:_0x293c9c[_0xc23a('0x30')];if(!_0x296c97['query'][_0xc23a('0x36')](_0xc23a('0x37'))){_0x1da5dc[_0xc23a('0x20')]=qs[_0xc23a('0x20')](_0x296c97[_0xc23a('0x38')][_0xc23a('0x20')]);_0x1da5dc[_0xc23a('0x1e')]=qs['offset'](_0x296c97[_0xc23a('0x38')][_0xc23a('0x1e')]);}_0x1da5dc[_0xc23a('0x39')]=qs[_0xc23a('0x3a')](_0x296c97[_0xc23a('0x38')][_0xc23a('0x3a')]);_0x1da5dc['where']=qs[_0xc23a('0x31')](_[_0xc23a('0x3b')](_0x296c97[_0xc23a('0x38')],_0x293c9c[_0xc23a('0x31')]),_0x2d269e);if(_0x296c97[_0xc23a('0x38')][_0xc23a('0x3c')]){_0x1da5dc[_0xc23a('0x3d')]=_[_0xc23a('0x3e')](_0x1da5dc[_0xc23a('0x3d')],{'$or':_[_0xc23a('0x2a')](_0x2d269e,function(_0x3c842c){if(_0x3c842c[_0xc23a('0x2e')]!==_0xc23a('0x3f')){var _0x4d8758={};_0x4d8758[_0x3c842c[_0xc23a('0x28')]]={'$like':'%'+_0x296c97[_0xc23a('0x38')][_0xc23a('0x3c')]+'%'};return _0x4d8758;}})});}_0x1da5dc=_[_0xc23a('0x3e')]({},_0x1da5dc,_0x296c97[_0xc23a('0x40')]);var _0x2b40f0={'where':_0x1da5dc[_0xc23a('0x3d')]};return db[_0xc23a('0x2b')][_0xc23a('0x21')](_0x2b40f0)['then'](function(_0x26e5ac){_0x286704[_0xc23a('0x21')]=_0x26e5ac;if(_0x296c97['query']['includeAll']){_0x1da5dc[_0xc23a('0x41')]=[{'all':!![]}];}return db[_0xc23a('0x2b')][_0xc23a('0x42')](_0x1da5dc);})[_0xc23a('0x26')](function(_0x45d464){_0x286704['rows']=_0x45d464;return _0x286704;})[_0xc23a('0x26')](respondWithFilteredResult(_0x2a6660,_0x1da5dc))[_0xc23a('0x43')](handleError(_0x2a6660,null));};exports[_0xc23a('0x44')]=function(_0xbc5451,_0xc2b5db){var _0x294be4={'raw':!![],'where':{'id':_0xbc5451[_0xc23a('0x45')]['id']}},_0xc61565={};_0xc61565[_0xc23a('0x30')]=_[_0xc23a('0x46')](db[_0xc23a('0x2b')]['rawAttributes']);_0xc61565['query']=_[_0xc23a('0x46')](_0xbc5451['query']);_0xc61565[_0xc23a('0x31')]=_[_0xc23a('0x32')](_0xc61565[_0xc23a('0x30')],_0xc61565[_0xc23a('0x38')]);_0x294be4[_0xc23a('0x33')]=_['intersection'](_0xc61565[_0xc23a('0x30')],qs[_0xc23a('0x34')](_0xbc5451['query']['fields']));_0x294be4['attributes']=_0x294be4[_0xc23a('0x33')]['length']?_0x294be4['attributes']:_0xc61565['model'];if(_0xbc5451['query'][_0xc23a('0x47')]){_0x294be4[_0xc23a('0x41')]=[{'all':!![]}];}_0x294be4=_[_0xc23a('0x3e')]({},_0x294be4,_0xbc5451[_0xc23a('0x40')]);return db['Dynamics365Field'][_0xc23a('0x48')](_0x294be4)[_0xc23a('0x26')](handleEntityNotFound(_0xc2b5db,null))[_0xc23a('0x26')](respondWithResult(_0xc2b5db,null))['catch'](handleError(_0xc2b5db,null));};exports['create']=function(_0x1915c1,_0x262dae){return db[_0xc23a('0x2b')][_0xc23a('0x49')](_0x1915c1[_0xc23a('0x4a')],{})[_0xc23a('0x26')](respondWithResult(_0x262dae,0xc9))['catch'](handleError(_0x262dae,null));};exports['update']=function(_0x1700a1,_0x14cfae){if(_0x1700a1[_0xc23a('0x4a')]['id']){delete _0x1700a1['body']['id'];}return db[_0xc23a('0x2b')][_0xc23a('0x48')]({'where':{'id':_0x1700a1[_0xc23a('0x45')]['id']}})['then'](handleEntityNotFound(_0x14cfae,null))[_0xc23a('0x26')](saveUpdates(_0x1700a1[_0xc23a('0x4a')],null))['then'](respondWithResult(_0x14cfae,null))['catch'](handleError(_0x14cfae,null));};exports['destroy']=function(_0xab7975,_0x90dda8){return db[_0xc23a('0x2b')][_0xc23a('0x48')]({'where':{'id':_0xab7975['params']['id']}})[_0xc23a('0x26')](handleEntityNotFound(_0x90dda8,null))[_0xc23a('0x26')](removeEntity(_0x90dda8,null))[_0xc23a('0x43')](handleError(_0x90dda8,null));}; \ No newline at end of file +var _0xfa59=['order','sort','pick','filters','filter','merge','where','VIRTUAL','include','catch','includeAll','create','body','find','params','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','Dynamics365Field','rawAttributes','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfa59,0xe4));var _0x9fa5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfa59[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9fa5('0x0'));var jsonpatch=require(_0x9fa5('0x1'));var rp=require(_0x9fa5('0x2'));var moment=require(_0x9fa5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fa5('0x4'));var util=require('util');var path=require(_0x9fa5('0x5'));var sox=require(_0x9fa5('0x6'));var csv=require(_0x9fa5('0x7'));var ejs=require(_0x9fa5('0x8'));var fs=require('fs');var fs_extra=require(_0x9fa5('0x9'));var _=require(_0x9fa5('0xa'));var squel=require(_0x9fa5('0xb'));var crypto=require(_0x9fa5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9fa5('0xd'));var toCsv=require(_0x9fa5('0x7'));var querystring=require('querystring');var Papa=require(_0x9fa5('0xe'));var Redis=require(_0x9fa5('0xf'));var authService=require(_0x9fa5('0x10'));var qs=require(_0x9fa5('0x11'));var as=require(_0x9fa5('0x12'));var hardwareService=require(_0x9fa5('0x13'));var logger=require(_0x9fa5('0x14'))(_0x9fa5('0x15'));var utils=require(_0x9fa5('0x16'));var config=require(_0x9fa5('0x17'));var licenseUtil=require(_0x9fa5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4478df,_0x496684){_0x496684=_0x496684||0xcc;return function(_0x3c4f41){if(_0x3c4f41){return _0x4478df['sendStatus'](_0x496684);}return _0x4478df[_0x9fa5('0x19')](_0x496684)[_0x9fa5('0x1a')]();};}function respondWithResult(_0x8a83b6,_0x53a721){_0x53a721=_0x53a721||0xc8;return function(_0x3051e8){if(_0x3051e8){return _0x8a83b6[_0x9fa5('0x19')](_0x53a721)[_0x9fa5('0x1b')](_0x3051e8);}};}function respondWithFilteredResult(_0x5491e0,_0xc52f2a){return function(_0x53d6cf){if(_0x53d6cf){var _0x5a7325=typeof _0xc52f2a[_0x9fa5('0x1c')]==='undefined'&&typeof _0xc52f2a[_0x9fa5('0x1d')]===_0x9fa5('0x1e');var _0x4af415=_0x53d6cf[_0x9fa5('0x1f')];var _0x59f8bc=_0x5a7325?0x0:_0xc52f2a[_0x9fa5('0x1c')];var _0x4f8e7f=_0x5a7325?_0x53d6cf[_0x9fa5('0x1f')]:_0xc52f2a[_0x9fa5('0x1c')]+_0xc52f2a['limit'];var _0xa9be43;if(_0x4f8e7f>=_0x4af415){_0x4f8e7f=_0x4af415;_0xa9be43=0xc8;}else{_0xa9be43=0xce;}_0x5491e0['status'](_0xa9be43);return _0x5491e0[_0x9fa5('0x20')]('Content-Range',_0x59f8bc+'-'+_0x4f8e7f+'/'+_0x4af415)[_0x9fa5('0x1b')](_0x53d6cf);}return null;};}function patchUpdates(_0x327335){return function(_0x1a704d){try{jsonpatch[_0x9fa5('0x21')](_0x1a704d,_0x327335,!![]);}catch(_0x4aab01){return BPromise[_0x9fa5('0x22')](_0x4aab01);}return _0x1a704d[_0x9fa5('0x23')]();};}function saveUpdates(_0x4eabad,_0x2a651c){return function(_0x363aec){if(_0x363aec){return _0x363aec[_0x9fa5('0x24')](_0x4eabad)[_0x9fa5('0x25')](function(_0x920062){return _0x920062;});}return null;};}function removeEntity(_0x4a42ed,_0x8afc41){return function(_0x3283f0){if(_0x3283f0){return _0x3283f0[_0x9fa5('0x26')]()[_0x9fa5('0x25')](function(){_0x4a42ed['status'](0xcc)[_0x9fa5('0x1a')]();});}};}function handleEntityNotFound(_0x25c314,_0xaba3ae){return function(_0x371aab){if(!_0x371aab){_0x25c314[_0x9fa5('0x27')](0x194);}return _0x371aab;};}function handleError(_0x1c1f87,_0x10d34c){_0x10d34c=_0x10d34c||0x1f4;return function(_0x422bf9){logger[_0x9fa5('0x28')](_0x422bf9['stack']);if(_0x422bf9[_0x9fa5('0x29')]){delete _0x422bf9[_0x9fa5('0x29')];}_0x1c1f87[_0x9fa5('0x19')](_0x10d34c)[_0x9fa5('0x2a')](_0x422bf9);};}exports[_0x9fa5('0x2b')]=function(_0x14a3c6,_0x283aea){var _0x216aa2={},_0x331441={},_0x2593ff={'count':0x0,'rows':[]};var _0x1d7099=_[_0x9fa5('0x2c')](db[_0x9fa5('0x2d')][_0x9fa5('0x2e')],function(_0x5c2607){return{'name':_0x5c2607['fieldName'],'type':_0x5c2607[_0x9fa5('0x2f')]['key']};});_0x331441[_0x9fa5('0x30')]=_[_0x9fa5('0x2c')](_0x1d7099,_0x9fa5('0x29'));_0x331441['query']=_[_0x9fa5('0x31')](_0x14a3c6[_0x9fa5('0x32')]);_0x331441['filters']=_['intersection'](_0x331441[_0x9fa5('0x30')],_0x331441[_0x9fa5('0x32')]);_0x216aa2['attributes']=_[_0x9fa5('0x33')](_0x331441[_0x9fa5('0x30')],qs[_0x9fa5('0x34')](_0x14a3c6['query']['fields']));_0x216aa2[_0x9fa5('0x35')]=_0x216aa2[_0x9fa5('0x35')][_0x9fa5('0x36')]?_0x216aa2[_0x9fa5('0x35')]:_0x331441[_0x9fa5('0x30')];if(!_0x14a3c6[_0x9fa5('0x32')][_0x9fa5('0x37')]('nolimit')){_0x216aa2[_0x9fa5('0x1d')]=qs[_0x9fa5('0x1d')](_0x14a3c6[_0x9fa5('0x32')]['limit']);_0x216aa2[_0x9fa5('0x1c')]=qs[_0x9fa5('0x1c')](_0x14a3c6[_0x9fa5('0x32')]['offset']);}_0x216aa2[_0x9fa5('0x38')]=qs[_0x9fa5('0x39')](_0x14a3c6['query'][_0x9fa5('0x39')]);_0x216aa2['where']=qs['filters'](_[_0x9fa5('0x3a')](_0x14a3c6[_0x9fa5('0x32')],_0x331441[_0x9fa5('0x3b')]),_0x1d7099);if(_0x14a3c6[_0x9fa5('0x32')][_0x9fa5('0x3c')]){_0x216aa2['where']=_[_0x9fa5('0x3d')](_0x216aa2[_0x9fa5('0x3e')],{'$or':_[_0x9fa5('0x2c')](_0x1d7099,function(_0x9e10d2){if(_0x9e10d2[_0x9fa5('0x2f')]!==_0x9fa5('0x3f')){var _0x144a39={};_0x144a39[_0x9e10d2[_0x9fa5('0x29')]]={'$like':'%'+_0x14a3c6[_0x9fa5('0x32')][_0x9fa5('0x3c')]+'%'};return _0x144a39;}})});}_0x216aa2=_[_0x9fa5('0x3d')]({},_0x216aa2,_0x14a3c6['options']);var _0x4cab03={'where':_0x216aa2[_0x9fa5('0x3e')]};return db[_0x9fa5('0x2d')][_0x9fa5('0x1f')](_0x4cab03)['then'](function(_0x38306a){_0x2593ff[_0x9fa5('0x1f')]=_0x38306a;if(_0x14a3c6[_0x9fa5('0x32')]['includeAll']){_0x216aa2[_0x9fa5('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x216aa2);})[_0x9fa5('0x25')](function(_0x5af3a2){_0x2593ff['rows']=_0x5af3a2;return _0x2593ff;})['then'](respondWithFilteredResult(_0x283aea,_0x216aa2))[_0x9fa5('0x41')](handleError(_0x283aea,null));};exports['show']=function(_0x503342,_0x5de40e){var _0x154660={'raw':!![],'where':{'id':_0x503342['params']['id']}},_0xd87cc4={};_0xd87cc4[_0x9fa5('0x30')]=_[_0x9fa5('0x31')](db[_0x9fa5('0x2d')][_0x9fa5('0x2e')]);_0xd87cc4[_0x9fa5('0x32')]=_[_0x9fa5('0x31')](_0x503342[_0x9fa5('0x32')]);_0xd87cc4[_0x9fa5('0x3b')]=_['intersection'](_0xd87cc4[_0x9fa5('0x30')],_0xd87cc4[_0x9fa5('0x32')]);_0x154660['attributes']=_['intersection'](_0xd87cc4[_0x9fa5('0x30')],qs[_0x9fa5('0x34')](_0x503342['query'][_0x9fa5('0x34')]));_0x154660[_0x9fa5('0x35')]=_0x154660[_0x9fa5('0x35')][_0x9fa5('0x36')]?_0x154660[_0x9fa5('0x35')]:_0xd87cc4[_0x9fa5('0x30')];if(_0x503342[_0x9fa5('0x32')][_0x9fa5('0x42')]){_0x154660[_0x9fa5('0x40')]=[{'all':!![]}];}_0x154660=_[_0x9fa5('0x3d')]({},_0x154660,_0x503342['options']);return db[_0x9fa5('0x2d')]['find'](_0x154660)['then'](handleEntityNotFound(_0x5de40e,null))['then'](respondWithResult(_0x5de40e,null))[_0x9fa5('0x41')](handleError(_0x5de40e,null));};exports[_0x9fa5('0x43')]=function(_0x1ba106,_0x49ddc0){return db[_0x9fa5('0x2d')][_0x9fa5('0x43')](_0x1ba106[_0x9fa5('0x44')],{})[_0x9fa5('0x25')](respondWithResult(_0x49ddc0,0xc9))[_0x9fa5('0x41')](handleError(_0x49ddc0,null));};exports[_0x9fa5('0x24')]=function(_0x49f90b,_0x79270c){if(_0x49f90b[_0x9fa5('0x44')]['id']){delete _0x49f90b[_0x9fa5('0x44')]['id'];}return db[_0x9fa5('0x2d')][_0x9fa5('0x45')]({'where':{'id':_0x49f90b[_0x9fa5('0x46')]['id']}})[_0x9fa5('0x25')](handleEntityNotFound(_0x79270c,null))['then'](saveUpdates(_0x49f90b['body'],null))[_0x9fa5('0x25')](respondWithResult(_0x79270c,null))[_0x9fa5('0x41')](handleError(_0x79270c,null));};exports[_0x9fa5('0x26')]=function(_0x1b459e,_0x2798ad){return db['Dynamics365Field'][_0x9fa5('0x45')]({'where':{'id':_0x1b459e[_0x9fa5('0x46')]['id']}})[_0x9fa5('0x25')](handleEntityNotFound(_0x2798ad,null))[_0x9fa5('0x25')](removeEntity(_0x2798ad,null))[_0x9fa5('0x41')](handleError(_0x2798ad,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 818e96a..71d6491 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 _0x890c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','Dynamics365Field','idField','FieldId','lodash'];(function(_0x2e68df,_0x46f8dc){var _0x33af7f=function(_0x28805a){while(--_0x28805a){_0x2e68df['push'](_0x2e68df['shift']());}};_0x33af7f(++_0x46f8dc);}(_0x890c,0x107));var _0xc890=function(_0x48448e,_0x2ac090){_0x48448e=_0x48448e-0x0;var _0x12d9d9=_0x890c[_0x48448e];return _0x12d9d9;};'use strict';var _=require(_0xc890('0x0'));var util=require(_0xc890('0x1'));var logger=require(_0xc890('0x2'))(_0xc890('0x3'));var moment=require('moment');var BPromise=require(_0xc890('0x4'));var rp=require(_0xc890('0x5'));var fs=require('fs');var path=require(_0xc890('0x6'));var rimraf=require(_0xc890('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xc890('0x8')]=function(_0x6aeed6,_0x530519){return _0x6aeed6['define'](_0xc890('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xc890('0xa'),_0xc890('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e17=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x46b4eb,_0x5178c3){var _0x2fcfd2=function(_0x120861){while(--_0x120861){_0x46b4eb['push'](_0x46b4eb['shift']());}};_0x2fcfd2(++_0x5178c3);}(_0x7e17,0x92));var _0x77e1=function(_0x43fe43,_0x40a903){_0x43fe43=_0x43fe43-0x0;var _0x3f5541=_0x7e17[_0x43fe43];return _0x3f5541;};'use strict';var _=require(_0x77e1('0x0'));var util=require(_0x77e1('0x1'));var logger=require(_0x77e1('0x2'))(_0x77e1('0x3'));var moment=require(_0x77e1('0x4'));var BPromise=require(_0x77e1('0x5'));var rp=require(_0x77e1('0x6'));var fs=require('fs');var path=require(_0x77e1('0x7'));var rimraf=require(_0x77e1('0x8'));var config=require(_0x77e1('0x9'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x19f72,_0x5cabd0){return _0x19f72[_0x77e1('0xa')]('Dynamics365Field',attributes,{'tableName':_0x77e1('0xb'),'paranoid':![],'indexes':[{'name':_0x77e1('0xc'),'fields':[_0x77e1('0xd'),_0x77e1('0xe')],'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 573e8be..416f6c3 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 _0x81f7=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x3eb25b,_0x87b21e){var _0x524d21=function(_0x189966){while(--_0x189966){_0x3eb25b['push'](_0x3eb25b['shift']());}};_0x524d21(++_0x87b21e);}(_0x81f7,0x1d4));var _0x781f=function(_0x43e686,_0x42eb32){_0x43e686=_0x43e686-0x0;var _0x336b4d=_0x81f7[_0x43e686];return _0x336b4d;};'use strict';var _=require(_0x781f('0x0'));var util=require('util');var moment=require(_0x781f('0x1'));var BPromise=require(_0x781f('0x2'));var rs=require(_0x781f('0x3'));var fs=require('fs');var Redis=require(_0x781f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x781f('0x5'))(_0x781f('0x6'));var config=require(_0x781f('0x7'));var jayson=require(_0x781f('0x8'));var client=jayson[_0x781f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb18813,_0x342cb1,_0x50b0a6){return new BPromise(function(_0x5106d9,_0x2c1453){return client['request'](_0xb18813,_0x50b0a6)[_0x781f('0xa')](function(_0xfee36f){logger[_0x781f('0xb')](_0x781f('0xc'),_0x342cb1,_0x781f('0xd'));logger[_0x781f('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x342cb1,'request\x20sent',JSON[_0x781f('0xf')](_0xfee36f));if(_0xfee36f['error']){if(_0xfee36f[_0x781f('0x10')]['code']===0x1f4){logger[_0x781f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x342cb1,_0xfee36f[_0x781f('0x10')]['message']);return _0x2c1453(_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);}logger[_0x781f('0x10')](_0x781f('0xc'),_0x342cb1,_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);return _0x5106d9(_0xfee36f[_0x781f('0x10')][_0x781f('0x11')]);}else{logger[_0x781f('0xb')](_0x781f('0xc'),_0x342cb1,_0x781f('0xd'));_0x5106d9(_0xfee36f[_0x781f('0x12')][_0x781f('0x11')]);}})[_0x781f('0x13')](function(_0x3dc97c){logger[_0x781f('0x10')](_0x781f('0xc'),_0x342cb1,_0x3dc97c);_0x2c1453(_0x3dc97c);});});} \ No newline at end of file +var _0x4ad2=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5214fd,_0x238b9d){var _0x4c22f8=function(_0x53b8bf){while(--_0x53b8bf){_0x5214fd['push'](_0x5214fd['shift']());}};_0x4c22f8(++_0x238b9d);}(_0x4ad2,0xd4));var _0x24ad=function(_0x39babd,_0x30ac19){_0x39babd=_0x39babd-0x0;var _0x48e779=_0x4ad2[_0x39babd];return _0x48e779;};'use strict';var _=require('lodash');var util=require(_0x24ad('0x0'));var moment=require(_0x24ad('0x1'));var BPromise=require(_0x24ad('0x2'));var rs=require(_0x24ad('0x3'));var fs=require('fs');var Redis=require(_0x24ad('0x4'));var db=require(_0x24ad('0x5'))['db'];var utils=require(_0x24ad('0x6'));var logger=require(_0x24ad('0x7'))(_0x24ad('0x8'));var config=require(_0x24ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x24ad('0xa')][_0x24ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a39f8,_0x4d069c,_0x4a4411){return new BPromise(function(_0x183b84,_0xd1a286){return client['request'](_0x1a39f8,_0x4a4411)['then'](function(_0x5710e2){logger[_0x24ad('0xc')](_0x24ad('0xd'),_0x4d069c,_0x24ad('0xe'));logger[_0x24ad('0xf')](_0x24ad('0x10'),_0x4d069c,_0x24ad('0xe'),JSON['stringify'](_0x5710e2));if(_0x5710e2[_0x24ad('0x11')]){if(_0x5710e2[_0x24ad('0x11')][_0x24ad('0x12')]===0x1f4){logger[_0x24ad('0x11')](_0x24ad('0xd'),_0x4d069c,_0x5710e2[_0x24ad('0x11')][_0x24ad('0x13')]);return _0xd1a286(_0x5710e2['error']['message']);}logger[_0x24ad('0x11')](_0x24ad('0xd'),_0x4d069c,_0x5710e2[_0x24ad('0x11')]['message']);return _0x183b84(_0x5710e2['error'][_0x24ad('0x13')]);}else{logger[_0x24ad('0xc')](_0x24ad('0xd'),_0x4d069c,_0x24ad('0xe'));_0x183b84(_0x5710e2[_0x24ad('0x14')][_0x24ad('0x13')]);}})['catch'](function(_0x371913){logger[_0x24ad('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x4d069c,_0x371913);_0xd1a286(_0x371913);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b96f028..5e4cae0 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 _0x5e36=['index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x218296,_0x515d36){var _0x459579=function(_0x6a825){while(--_0x6a825){_0x218296['push'](_0x218296['shift']());}};_0x459579(++_0x515d36);}(_0x5e36,0xe7));var _0x65e3=function(_0x5c3cd6,_0x27a538){_0x5c3cd6=_0x5c3cd6-0x0;var _0x515462=_0x5e36[_0x5c3cd6];return _0x515462;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x65e3('0x0'));var timeout=require('connect-timeout');var express=require(_0x65e3('0x1'));var router=express[_0x65e3('0x2')]();var fs_extra=require(_0x65e3('0x3'));var auth=require(_0x65e3('0x4'));var interaction=require(_0x65e3('0x5'));var config=require(_0x65e3('0x6'));var controller=require(_0x65e3('0x7'));router[_0x65e3('0x8')]('/',auth['isAuthenticated'](),controller[_0x65e3('0x9')]);router['get']('/:id',auth[_0x65e3('0xa')](),controller[_0x65e3('0xb')]);router['get'](_0x65e3('0xc'),auth['isAuthenticated'](),controller[_0x65e3('0xd')]);router[_0x65e3('0x8')](_0x65e3('0xe'),auth[_0x65e3('0xa')](),controller[_0x65e3('0xf')]);router[_0x65e3('0x10')]('/',auth[_0x65e3('0xa')](),controller[_0x65e3('0x11')]);router['post'](_0x65e3('0xc'),auth['isAuthenticated'](),controller[_0x65e3('0x12')]);router[_0x65e3('0x13')](_0x65e3('0x14'),auth[_0x65e3('0xa')](),controller[_0x65e3('0x15')]);router[_0x65e3('0x16')]('/:id',auth[_0x65e3('0xa')](),controller[_0x65e3('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdfe2=['getConfigurations','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x4590cf,_0xc7ba09){var _0x36bd08=function(_0x436c16){while(--_0x436c16){_0x4590cf['push'](_0x4590cf['shift']());}};_0x36bd08(++_0xc7ba09);}(_0xdfe2,0xa7));var _0x2dfe=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xdfe2[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x2dfe('0x0'));var util=require(_0x2dfe('0x1'));var path=require(_0x2dfe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2dfe('0x3'));var router=express[_0x2dfe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2dfe('0x5'));var interaction=require(_0x2dfe('0x6'));var config=require(_0x2dfe('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x2dfe('0x8')]('/',auth[_0x2dfe('0x9')](),controller['index']);router[_0x2dfe('0x8')](_0x2dfe('0xa'),auth[_0x2dfe('0x9')](),controller[_0x2dfe('0xb')]);router[_0x2dfe('0x8')](_0x2dfe('0xc'),auth[_0x2dfe('0x9')](),controller[_0x2dfe('0xd')]);router[_0x2dfe('0x8')]('/:id/fields',auth[_0x2dfe('0x9')](),controller['getFields']);router[_0x2dfe('0xe')]('/',auth['isAuthenticated'](),controller[_0x2dfe('0xf')]);router[_0x2dfe('0xe')](_0x2dfe('0xc'),auth[_0x2dfe('0x9')](),controller['addConfiguration']);router[_0x2dfe('0x10')]('/:id',auth[_0x2dfe('0x9')](),controller[_0x2dfe('0x11')]);router[_0x2dfe('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2dfe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e7eb3e2..61e9b3c 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5ed85c,_0x533d56){var _0x3db7c6=function(_0x4f62c2){while(--_0x4f62c2){_0x5ed85c['push'](_0x5ed85c['shift']());}};_0x3db7c6(++_0x533d56);}(_0xd943,0x15d));var _0x3d94=function(_0x44110b,_0x1b267b){_0x44110b=_0x44110b-0x0;var _0x1f4f50=_0xd943[_0x44110b];return _0x1f4f50;};'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 _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x5024a3,_0x1647de){var _0x4da682=function(_0x1e5557){while(--_0x1e5557){_0x5024a3['push'](_0x5024a3['shift']());}};_0x4da682(++_0x1647de);}(_0x7708,0x188));var _0x8770=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x7708[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3a9dc81..d136cbb 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 _0x4a3d=['custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','offset','undefined','count','set','apply','update','destroy','then','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','agent','description','priority','group','company','remove','includes'];(function(_0x17ac83,_0x17c298){var _0xd04a2b=function(_0x76bc9a){while(--_0x76bc9a){_0x17ac83['push'](_0x17ac83['shift']());}};_0xd04a2b(++_0x17c298);}(_0x4a3d,0x79));var _0xd4a3=function(_0x3a7155,_0x59e035){_0x3a7155=_0x3a7155-0x0;var _0x1f2c15=_0x4a3d[_0x3a7155];return _0x1f2c15;};'use strict';var emlformat=require(_0xd4a3('0x0'));var rimraf=require(_0xd4a3('0x1'));var zipdir=require(_0xd4a3('0x2'));var jsonpatch=require(_0xd4a3('0x3'));var rp=require(_0xd4a3('0x4'));var moment=require(_0xd4a3('0x5'));var BPromise=require(_0xd4a3('0x6'));var Mustache=require(_0xd4a3('0x7'));var util=require(_0xd4a3('0x8'));var path=require(_0xd4a3('0x9'));var sox=require(_0xd4a3('0xa'));var csv=require(_0xd4a3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xb'));var querystring=require(_0xd4a3('0xf'));var Papa=require(_0xd4a3('0x10'));var Redis=require(_0xd4a3('0x11'));var authService=require(_0xd4a3('0x12'));var qs=require(_0xd4a3('0x13'));var as=require(_0xd4a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x15'))(_0xd4a3('0x16'));var utils=require(_0xd4a3('0x17'));var config=require(_0xd4a3('0x18'));var licenseUtil=require(_0xd4a3('0x19'));var db=require(_0xd4a3('0x1a'))['db'];var integrations=require(_0xd4a3('0x1b'));function respondWithStatusCode(_0x57bd90,_0x3548e4){_0x3548e4=_0x3548e4||0xcc;return function(_0x2f4009){if(_0x2f4009){return _0x57bd90[_0xd4a3('0x1c')](_0x3548e4);}return _0x57bd90[_0xd4a3('0x1d')](_0x3548e4)[_0xd4a3('0x1e')]();};}function respondWithResult(_0x11f325,_0x2bfeb6){_0x2bfeb6=_0x2bfeb6||0xc8;return function(_0x306926){if(_0x306926){return _0x11f325['status'](_0x2bfeb6)['json'](_0x306926);}};}function respondWithFilteredResult(_0x140379,_0x2f96bb){return function(_0x124d03){if(_0x124d03){var _0xfd502c=typeof _0x2f96bb[_0xd4a3('0x1f')]===_0xd4a3('0x20')&&typeof _0x2f96bb['limit']===_0xd4a3('0x20');var _0x56ab48=_0x124d03[_0xd4a3('0x21')];var _0x592077=_0xfd502c?0x0:_0x2f96bb[_0xd4a3('0x1f')];var _0x4b8850=_0xfd502c?_0x124d03[_0xd4a3('0x21')]:_0x2f96bb[_0xd4a3('0x1f')]+_0x2f96bb['limit'];var _0x40973a;if(_0x4b8850>=_0x56ab48){_0x4b8850=_0x56ab48;_0x40973a=0xc8;}else{_0x40973a=0xce;}_0x140379[_0xd4a3('0x1d')](_0x40973a);return _0x140379[_0xd4a3('0x22')]('Content-Range',_0x592077+'-'+_0x4b8850+'/'+_0x56ab48)['json'](_0x124d03);}return null;};}function patchUpdates(_0x21efd7){return function(_0x5b2526){try{jsonpatch[_0xd4a3('0x23')](_0x5b2526,_0x21efd7,!![]);}catch(_0x1d7134){return BPromise['reject'](_0x1d7134);}return _0x5b2526['save']();};}function saveUpdates(_0x4f957f,_0x40535d){return function(_0xd558a8){if(_0xd558a8){return _0xd558a8[_0xd4a3('0x24')](_0x4f957f)['then'](function(_0x2de130){return _0x2de130;});}return null;};}function removeEntity(_0x137bba,_0x1a4ced){return function(_0x2e632f){if(_0x2e632f){return _0x2e632f[_0xd4a3('0x25')]()[_0xd4a3('0x26')](function(){_0x137bba['status'](0xcc)[_0xd4a3('0x1e')]();});}};}function handleEntityNotFound(_0x1dea89,_0x50c8ac){return function(_0x2b6cd8){if(!_0x2b6cd8){_0x1dea89[_0xd4a3('0x1c')](0x194);}return _0x2b6cd8;};}function handleError(_0x26cb96,_0x4ce98a){_0x4ce98a=_0x4ce98a||0x1f4;return function(_0x37f09e){logger[_0xd4a3('0x27')](_0x37f09e[_0xd4a3('0x28')]);if(_0x37f09e['name']){delete _0x37f09e[_0xd4a3('0x29')];}_0x26cb96['status'](_0x4ce98a)[_0xd4a3('0x2a')](_0x37f09e);};}exports['index']=function(_0x3019a4,_0x5d84f2){var _0x2769b7={},_0x535ecd={},_0x3e471e={'count':0x0,'rows':[]};var _0x5d1039=_[_0xd4a3('0x2b')](db[_0xd4a3('0x2c')][_0xd4a3('0x2d')],function(_0x318159){return{'name':_0x318159[_0xd4a3('0x2e')],'type':_0x318159['type']['key']};});_0x535ecd[_0xd4a3('0x2f')]=_[_0xd4a3('0x2b')](_0x5d1039,_0xd4a3('0x29'));_0x535ecd[_0xd4a3('0x30')]=_['keys'](_0x3019a4[_0xd4a3('0x30')]);_0x535ecd[_0xd4a3('0x31')]=_['intersection'](_0x535ecd[_0xd4a3('0x2f')],_0x535ecd['query']);_0x2769b7[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x535ecd[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0x2769b7[_0xd4a3('0x32')]=_0x2769b7[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x2769b7['attributes']:_0x535ecd[_0xd4a3('0x2f')];if(!_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x36')]('nolimit')){_0x2769b7[_0xd4a3('0x37')]=qs[_0xd4a3('0x37')](_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0x2769b7[_0xd4a3('0x1f')]=qs[_0xd4a3('0x1f')](_0x3019a4[_0xd4a3('0x30')]['offset']);}_0x2769b7[_0xd4a3('0x38')]=qs['sort'](_0x3019a4['query'][_0xd4a3('0x39')]);_0x2769b7[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_[_0xd4a3('0x3b')](_0x3019a4['query'],_0x535ecd[_0xd4a3('0x31')]),_0x5d1039);if(_0x3019a4['query'][_0xd4a3('0x3c')]){_0x2769b7[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0x2769b7[_0xd4a3('0x3a')],{'$or':_['map'](_0x5d1039,function(_0x23c13a){if(_0x23c13a[_0xd4a3('0x3e')]!==_0xd4a3('0x3f')){var _0xa307c5={};_0xa307c5[_0x23c13a['name']]={'$like':'%'+_0x3019a4['query'][_0xd4a3('0x3c')]+'%'};return _0xa307c5;}})});}_0x2769b7=_[_0xd4a3('0x3d')]({},_0x2769b7,_0x3019a4[_0xd4a3('0x40')]);var _0x3c3cb8={'where':_0x2769b7[_0xd4a3('0x3a')]};return db[_0xd4a3('0x2c')][_0xd4a3('0x21')](_0x3c3cb8)['then'](function(_0x55b03c){_0x3e471e[_0xd4a3('0x21')]=_0x55b03c;if(_0x3019a4[_0xd4a3('0x30')][_0xd4a3('0x41')]){_0x2769b7[_0xd4a3('0x42')]=[{'all':!![]}];}return db[_0xd4a3('0x2c')][_0xd4a3('0x43')](_0x2769b7);})[_0xd4a3('0x26')](function(_0x27c840){_0x3e471e[_0xd4a3('0x44')]=_0x27c840;return _0x3e471e;})[_0xd4a3('0x26')](respondWithFilteredResult(_0x5d84f2,_0x2769b7))['catch'](handleError(_0x5d84f2,null));};exports[_0xd4a3('0x45')]=function(_0x29955b,_0x6e7362){var _0x40b847={'raw':![],'where':{'id':_0x29955b[_0xd4a3('0x46')]['id']}},_0x48256e={};_0x48256e['model']=_[_0xd4a3('0x47')](db['FreshdeskAccount'][_0xd4a3('0x2d')]);_0x48256e[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x29955b[_0xd4a3('0x30')]);_0x48256e[_0xd4a3('0x31')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],_0x48256e[_0xd4a3('0x30')]);_0x40b847[_0xd4a3('0x32')]=_['intersection'](_0x48256e[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x29955b['query'][_0xd4a3('0x34')]));_0x40b847[_0xd4a3('0x32')]=_0x40b847[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0x40b847[_0xd4a3('0x32')]:_0x48256e['model'];if(_0x29955b['query'][_0xd4a3('0x41')]){_0x40b847[_0xd4a3('0x42')]=[{'all':!![]}];}_0x40b847=_[_0xd4a3('0x3d')]({},_0x40b847,_0x29955b[_0xd4a3('0x40')]);return db[_0xd4a3('0x2c')][_0xd4a3('0x48')](_0x40b847)[_0xd4a3('0x26')](handleEntityNotFound(_0x6e7362,null))[_0xd4a3('0x26')](respondWithResult(_0x6e7362,null))['catch'](handleError(_0x6e7362,null));};exports[_0xd4a3('0x49')]=function(_0x1ba4b9,_0x52e74e){return db['FreshdeskAccount'][_0xd4a3('0x49')](_0x1ba4b9['body'],{})['then'](respondWithResult(_0x52e74e,0xc9))[_0xd4a3('0x4a')](handleError(_0x52e74e,null));};exports[_0xd4a3('0x24')]=function(_0x1b0051,_0x3f5c3a){if(_0x1b0051[_0xd4a3('0x4b')]['id']){delete _0x1b0051[_0xd4a3('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x1b0051['params']['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x3f5c3a,null))['then'](saveUpdates(_0x1b0051[_0xd4a3('0x4b')],null))[_0xd4a3('0x26')](respondWithResult(_0x3f5c3a,null))[_0xd4a3('0x4a')](handleError(_0x3f5c3a,null));};exports[_0xd4a3('0x25')]=function(_0x37cdd3,_0x1ec9a3){return db[_0xd4a3('0x2c')]['find']({'where':{'id':_0x37cdd3[_0xd4a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec9a3,null))[_0xd4a3('0x26')](removeEntity(_0x1ec9a3,null))['catch'](handleError(_0x1ec9a3,null));};exports[_0xd4a3('0x4c')]=function(_0x31d2ca,_0x4f5039,_0x347049){var _0xd9ec86={};var _0x4f0db6={};var _0x40087b;var _0x155744;return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x31d2ca[_0xd4a3('0x46')]['id']}})[_0xd4a3('0x26')](handleEntityNotFound(_0x4f5039,null))[_0xd4a3('0x26')](function(_0x4d4491){if(_0x4d4491){_0x40087b=_0x4d4491;_0x4f0db6[_0xd4a3('0x2f')]=_[_0xd4a3('0x47')](db['FreshdeskConfiguration'][_0xd4a3('0x2d')]);_0x4f0db6[_0xd4a3('0x30')]=_[_0xd4a3('0x47')](_0x31d2ca[_0xd4a3('0x30')]);_0x4f0db6[_0xd4a3('0x31')]=_[_0xd4a3('0x33')](_0x4f0db6['model'],_0x4f0db6[_0xd4a3('0x30')]);_0xd9ec86[_0xd4a3('0x32')]=_[_0xd4a3('0x33')](_0x4f0db6[_0xd4a3('0x2f')],qs[_0xd4a3('0x34')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x34')]));_0xd9ec86[_0xd4a3('0x32')]=_0xd9ec86[_0xd4a3('0x32')][_0xd4a3('0x35')]?_0xd9ec86[_0xd4a3('0x32')]:_0x4f0db6[_0xd4a3('0x2f')];_0xd9ec86[_0xd4a3('0x38')]=qs[_0xd4a3('0x39')](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x39')]);_0xd9ec86[_0xd4a3('0x3a')]=qs[_0xd4a3('0x31')](_['pick'](_0x31d2ca[_0xd4a3('0x30')],_0x4f0db6[_0xd4a3('0x31')]));if(_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]){_0xd9ec86[_0xd4a3('0x3a')]=_[_0xd4a3('0x3d')](_0xd9ec86[_0xd4a3('0x3a')],{'$or':_['map'](_0xd9ec86['attributes'],function(_0x4293bf){var _0x55edc8={};_0x55edc8[_0x4293bf]={'$like':'%'+_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x3c')]+'%'};return _0x55edc8;})});}_0xd9ec86=_[_0xd4a3('0x3d')]({},_0xd9ec86,_0x31d2ca[_0xd4a3('0x40')]);return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x590c22){if(_0x590c22){_0x155744=_0x590c22[_0xd4a3('0x35')];if(!_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x36')](_0xd4a3('0x4d'))){_0xd9ec86['limit']=qs['limit'](_0x31d2ca[_0xd4a3('0x30')][_0xd4a3('0x37')]);_0xd9ec86[_0xd4a3('0x1f')]=qs['offset'](_0x31d2ca['query']['offset']);}return _0x40087b[_0xd4a3('0x4c')](_0xd9ec86);}})['then'](function(_0x2fc74c){if(_0x2fc74c){return _0x2fc74c?{'count':_0x155744,'rows':_0x2fc74c}:null;}})[_0xd4a3('0x26')](respondWithResult(_0x4f5039,null))[_0xd4a3('0x4a')](handleError(_0x4f5039,null));};exports[_0xd4a3('0x4e')]=function(_0x4b0398,_0x2d152c,_0x4193be){if(_0x4b0398['body']['id']){delete _0x4b0398[_0xd4a3('0x4b')]['id'];}return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x4b0398['params']['id']}})['then'](handleEntityNotFound(_0x2d152c,null))[_0xd4a3('0x26')](function(_0x3b5037){if(_0x3b5037){_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x4f')]=_0x3b5037['id'];_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x50')]=integrations['getSubjects'](_0x4b0398[_0xd4a3('0x4b')]['channel'],_0x4b0398['body']['type']);_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x51')]=integrations[_0xd4a3('0x52')](_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x53')],_0x4b0398[_0xd4a3('0x4b')][_0xd4a3('0x3e')]);return db['FreshdeskConfiguration'][_0xd4a3('0x49')](_0x4b0398[_0xd4a3('0x4b')],{'include':[{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x50')},{'model':db[_0xd4a3('0x54')],'as':_0xd4a3('0x51')}]});}return null;})[_0xd4a3('0x26')](respondWithResult(_0x2d152c,null))[_0xd4a3('0x4a')](handleError(_0x2d152c,null));};exports[_0xd4a3('0x55')]=function(_0x320c05,_0x49f4c5,_0x446d14){var _0x5b688e='';return db[_0xd4a3('0x2c')]['findOne']({'where':{'id':_0x320c05['params']['id']},'attributes':['id','remoteUri',_0xd4a3('0x56')]})[_0xd4a3('0x26')](handleEntityNotFound(_0x49f4c5,null))[_0xd4a3('0x26')](function(_0x5dcb3e){if(_0x5dcb3e){_0x5b688e=_0x5dcb3e[_0xd4a3('0x57')];var _0x524457=_0x5b688e[_0xd4a3('0x58')](-0x1);if(_0x524457==='/'){_0x5b688e=_0x5b688e[_0xd4a3('0x59')](0x0,_0x5b688e[_0xd4a3('0x5a')](_0x524457));}return rp({'method':_0xd4a3('0x5b'),'uri':util['format'](_0xd4a3('0x5c'),_0x5b688e,_0xd4a3('0x5d')),'headers':{'Authorization':util[_0xd4a3('0x5e')](_0xd4a3('0x5f'),new Buffer(util['format']('%s:X',_0x5dcb3e[_0xd4a3('0x56')]))[_0xd4a3('0x60')](_0xd4a3('0x61')))},'json':!![]});}})[_0xd4a3('0x26')](function(_0x4dc642){if(_0x4dc642){var _0x629f2d=['requester','subject',_0xd4a3('0x62'),_0xd4a3('0x63'),_0xd4a3('0x1d'),_0xd4a3('0x64'),_0xd4a3('0x65'),'source','ticket_type','group',_0xd4a3('0x66')];_[_0xd4a3('0x67')](_0x4dc642,function(_0x4e1992){return _0x629f2d[_0xd4a3('0x68')](_0x4e1992[_0xd4a3('0x29')])||!_0x4e1992['default']&&_0x4e1992[_0xd4a3('0x3e')]!==_0xd4a3('0x69')&&_0x4e1992['type']!=='custom_dropdown';});return{'count':_0x4dc642[_0xd4a3('0x35')],'rows':_[_0xd4a3('0x2b')](_0x4dc642,function(_0xd7b2cc){return{'id':_0xd7b2cc['name'],'name':_0xd7b2cc[_0xd4a3('0x6a')],'custom':!_0xd7b2cc[_0xd4a3('0x6b')],'options':_0xd7b2cc[_0xd4a3('0x6c')]?_[_0xd4a3('0x2b')](_0xd7b2cc[_0xd4a3('0x6c')],function(_0x10dd25){return{'name':_[_0xd4a3('0x6d')](_0x10dd25),'value':_0x10dd25};}):[]};})};}})[_0xd4a3('0x26')](respondWithResult(_0x49f4c5,null))[_0xd4a3('0x4a')](function(_0xa7a83b){var _0xb83eff=_0x320c05['query'][_0xd4a3('0x6e')]?0x1f4:_0xa7a83b[_0xd4a3('0x6f')]||0x1f4;logger['error'](_0xd4a3('0x70'),_0xd4a3('0x55'),_0xb83eff,JSON['stringify'](_0xa7a83b));delete _0xa7a83b[_0xd4a3('0x29')];if(_0xb83eff===0x191){_0xb83eff=0x190;}_0x49f4c5[_0xd4a3('0x1d')](_0xb83eff)[_0xd4a3('0x2a')](_0x320c05[_0xd4a3('0x30')][_0xd4a3('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa7a83b[_0xd4a3('0x6f')]}:_0xa7a83b);});}; \ No newline at end of file +var _0xe28e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskAccount','includeAll','include','findAll','catch','params','fields','options','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xe28e,0x1ba));var _0xee28=function(_0x4bbabd,_0x526f52){_0x4bbabd=_0x4bbabd-0x0;var _0x32a924=_0xe28e[_0x4bbabd];return _0x32a924;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];var integrations=require(_0xee28('0x1a'));function respondWithStatusCode(_0x267031,_0x46e784){_0x46e784=_0x46e784||0xcc;return function(_0x236de4){if(_0x236de4){return _0x267031['sendStatus'](_0x46e784);}return _0x267031[_0xee28('0x1b')](_0x46e784)[_0xee28('0x1c')]();};}function respondWithResult(_0x555b9c,_0x331b7c){_0x331b7c=_0x331b7c||0xc8;return function(_0x2ae3e0){if(_0x2ae3e0){return _0x555b9c['status'](_0x331b7c)[_0xee28('0x1d')](_0x2ae3e0);}};}function respondWithFilteredResult(_0x17c99a,_0x3d3a5c){return function(_0x343358){if(_0x343358){var _0x1ff99e=typeof _0x3d3a5c[_0xee28('0x1e')]==='undefined'&&typeof _0x3d3a5c[_0xee28('0x1f')]==='undefined';var _0x37e429=_0x343358[_0xee28('0x20')];var _0x5afd11=_0x1ff99e?0x0:_0x3d3a5c[_0xee28('0x1e')];var _0x49be69=_0x1ff99e?_0x343358[_0xee28('0x20')]:_0x3d3a5c['offset']+_0x3d3a5c[_0xee28('0x1f')];var _0x577332;if(_0x49be69>=_0x37e429){_0x49be69=_0x37e429;_0x577332=0xc8;}else{_0x577332=0xce;}_0x17c99a[_0xee28('0x1b')](_0x577332);return _0x17c99a['set'](_0xee28('0x21'),_0x5afd11+'-'+_0x49be69+'/'+_0x37e429)[_0xee28('0x1d')](_0x343358);}return null;};}function patchUpdates(_0x96f5db){return function(_0x3674c7){try{jsonpatch[_0xee28('0x22')](_0x3674c7,_0x96f5db,!![]);}catch(_0x1280f5){return BPromise[_0xee28('0x23')](_0x1280f5);}return _0x3674c7['save']();};}function saveUpdates(_0x342798,_0x44d7ff){return function(_0x3198d0){if(_0x3198d0){return _0x3198d0['update'](_0x342798)['then'](function(_0x17d8e4){return _0x17d8e4;});}return null;};}function removeEntity(_0x4a524d,_0x1519ae){return function(_0x29360e){if(_0x29360e){return _0x29360e[_0xee28('0x24')]()[_0xee28('0x25')](function(){_0x4a524d[_0xee28('0x1b')](0xcc)[_0xee28('0x1c')]();});}};}function handleEntityNotFound(_0x2a7c95,_0x733ca8){return function(_0x281c8a){if(!_0x281c8a){_0x2a7c95['sendStatus'](0x194);}return _0x281c8a;};}function handleError(_0x2c847b,_0x5b1b1e){_0x5b1b1e=_0x5b1b1e||0x1f4;return function(_0x51a87e){logger['error'](_0x51a87e['stack']);if(_0x51a87e['name']){delete _0x51a87e[_0xee28('0x26')];}_0x2c847b[_0xee28('0x1b')](_0x5b1b1e)[_0xee28('0x27')](_0x51a87e);};}exports[_0xee28('0x28')]=function(_0x346201,_0x417840){var _0xbafd67={},_0x4fcc8f={},_0x84e0ba={'count':0x0,'rows':[]};var _0x7390dc=_[_0xee28('0x29')](db['FreshdeskAccount'][_0xee28('0x2a')],function(_0x2890ad){return{'name':_0x2890ad[_0xee28('0x2b')],'type':_0x2890ad[_0xee28('0x2c')][_0xee28('0x2d')]};});_0x4fcc8f[_0xee28('0x2e')]=_[_0xee28('0x29')](_0x7390dc,'name');_0x4fcc8f[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x346201['query']);_0x4fcc8f[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],_0x4fcc8f[_0xee28('0x2f')]);_0xbafd67[_0xee28('0x33')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],qs['fields'](_0x346201['query']['fields']));_0xbafd67[_0xee28('0x33')]=_0xbafd67[_0xee28('0x33')][_0xee28('0x34')]?_0xbafd67[_0xee28('0x33')]:_0x4fcc8f[_0xee28('0x2e')];if(!_0x346201[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0xbafd67[_0xee28('0x1f')]=qs['limit'](_0x346201['query'][_0xee28('0x1f')]);_0xbafd67[_0xee28('0x1e')]=qs['offset'](_0x346201['query'][_0xee28('0x1e')]);}_0xbafd67[_0xee28('0x36')]=qs['sort'](_0x346201[_0xee28('0x2f')][_0xee28('0x37')]);_0xbafd67[_0xee28('0x38')]=qs[_0xee28('0x31')](_[_0xee28('0x39')](_0x346201[_0xee28('0x2f')],_0x4fcc8f[_0xee28('0x31')]),_0x7390dc);if(_0x346201[_0xee28('0x2f')][_0xee28('0x3a')]){_0xbafd67[_0xee28('0x38')]=_[_0xee28('0x3b')](_0xbafd67[_0xee28('0x38')],{'$or':_['map'](_0x7390dc,function(_0x191d7d){if(_0x191d7d['type']!=='VIRTUAL'){var _0x265ae5={};_0x265ae5[_0x191d7d['name']]={'$like':'%'+_0x346201[_0xee28('0x2f')]['filter']+'%'};return _0x265ae5;}})});}_0xbafd67=_[_0xee28('0x3b')]({},_0xbafd67,_0x346201['options']);var _0x1faf46={'where':_0xbafd67[_0xee28('0x38')]};return db[_0xee28('0x3c')][_0xee28('0x20')](_0x1faf46)['then'](function(_0x1cf211){_0x84e0ba['count']=_0x1cf211;if(_0x346201[_0xee28('0x2f')][_0xee28('0x3d')]){_0xbafd67[_0xee28('0x3e')]=[{'all':!![]}];}return db[_0xee28('0x3c')][_0xee28('0x3f')](_0xbafd67);})[_0xee28('0x25')](function(_0x216ca7){_0x84e0ba['rows']=_0x216ca7;return _0x84e0ba;})['then'](respondWithFilteredResult(_0x417840,_0xbafd67))[_0xee28('0x40')](handleError(_0x417840,null));};exports['show']=function(_0x52b666,_0x4064cf){var _0x14bd8d={'raw':![],'where':{'id':_0x52b666[_0xee28('0x41')]['id']}},_0x4ffb08={};_0x4ffb08[_0xee28('0x2e')]=_[_0xee28('0x30')](db[_0xee28('0x3c')][_0xee28('0x2a')]);_0x4ffb08[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x52b666['query']);_0x4ffb08[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4ffb08[_0xee28('0x2e')],_0x4ffb08[_0xee28('0x2f')]);_0x14bd8d[_0xee28('0x33')]=_['intersection'](_0x4ffb08[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x52b666['query'][_0xee28('0x42')]));_0x14bd8d[_0xee28('0x33')]=_0x14bd8d[_0xee28('0x33')][_0xee28('0x34')]?_0x14bd8d[_0xee28('0x33')]:_0x4ffb08[_0xee28('0x2e')];if(_0x52b666['query'][_0xee28('0x3d')]){_0x14bd8d['include']=[{'all':!![]}];}_0x14bd8d=_['merge']({},_0x14bd8d,_0x52b666[_0xee28('0x43')]);return db[_0xee28('0x3c')]['find'](_0x14bd8d)[_0xee28('0x25')](handleEntityNotFound(_0x4064cf,null))[_0xee28('0x25')](respondWithResult(_0x4064cf,null))[_0xee28('0x40')](handleError(_0x4064cf,null));};exports['create']=function(_0x57e57e,_0x18c96c){return db[_0xee28('0x3c')][_0xee28('0x44')](_0x57e57e[_0xee28('0x45')],{})[_0xee28('0x25')](respondWithResult(_0x18c96c,0xc9))[_0xee28('0x40')](handleError(_0x18c96c,null));};exports[_0xee28('0x46')]=function(_0x2b5f36,_0x3e31c3){if(_0x2b5f36[_0xee28('0x45')]['id']){delete _0x2b5f36['body']['id'];}return db[_0xee28('0x3c')]['find']({'where':{'id':_0x2b5f36[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x3e31c3,null))[_0xee28('0x25')](saveUpdates(_0x2b5f36[_0xee28('0x45')],null))[_0xee28('0x25')](respondWithResult(_0x3e31c3,null))['catch'](handleError(_0x3e31c3,null));};exports['destroy']=function(_0x5ca018,_0x1b15a4){return db['FreshdeskAccount']['find']({'where':{'id':_0x5ca018[_0xee28('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b15a4,null))[_0xee28('0x25')](removeEntity(_0x1b15a4,null))[_0xee28('0x40')](handleError(_0x1b15a4,null));};exports[_0xee28('0x47')]=function(_0x3a4e74,_0x398120,_0x34a89e){var _0x326c85={};var _0xc1bdba={};var _0x44402a;var _0x10d393;return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x3a4e74[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x398120,null))['then'](function(_0x5b9ced){if(_0x5b9ced){_0x44402a=_0x5b9ced;_0xc1bdba['model']=_['keys'](db[_0xee28('0x49')][_0xee28('0x2a')]);_0xc1bdba[_0xee28('0x2f')]=_['keys'](_0x3a4e74[_0xee28('0x2f')]);_0xc1bdba[_0xee28('0x31')]=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],_0xc1bdba[_0xee28('0x2f')]);_0x326c85['attributes']=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x3a4e74['query'][_0xee28('0x42')]));_0x326c85[_0xee28('0x33')]=_0x326c85[_0xee28('0x33')][_0xee28('0x34')]?_0x326c85[_0xee28('0x33')]:_0xc1bdba[_0xee28('0x2e')];_0x326c85[_0xee28('0x36')]=qs['sort'](_0x3a4e74[_0xee28('0x2f')]['sort']);_0x326c85['where']=qs['filters'](_[_0xee28('0x39')](_0x3a4e74[_0xee28('0x2f')],_0xc1bdba[_0xee28('0x31')]));if(_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]){_0x326c85[_0xee28('0x38')]=_[_0xee28('0x3b')](_0x326c85[_0xee28('0x38')],{'$or':_['map'](_0x326c85[_0xee28('0x33')],function(_0x386e24){var _0x32c06f={};_0x32c06f[_0x386e24]={'$like':'%'+_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]+'%'};return _0x32c06f;})});}_0x326c85=_[_0xee28('0x3b')]({},_0x326c85,_0x3a4e74[_0xee28('0x43')]);return _0x44402a['getConfigurations'](_0x326c85);}})[_0xee28('0x25')](function(_0x4fbb16){if(_0x4fbb16){_0x10d393=_0x4fbb16[_0xee28('0x34')];if(!_0x3a4e74[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0x326c85[_0xee28('0x1f')]=qs[_0xee28('0x1f')](_0x3a4e74[_0xee28('0x2f')]['limit']);_0x326c85[_0xee28('0x1e')]=qs[_0xee28('0x1e')](_0x3a4e74[_0xee28('0x2f')][_0xee28('0x1e')]);}return _0x44402a[_0xee28('0x47')](_0x326c85);}})[_0xee28('0x25')](function(_0xf3416b){if(_0xf3416b){return _0xf3416b?{'count':_0x10d393,'rows':_0xf3416b}:null;}})['then'](respondWithResult(_0x398120,null))[_0xee28('0x40')](handleError(_0x398120,null));};exports['addConfiguration']=function(_0x1aa19f,_0x152331,_0x48ad2b){if(_0x1aa19f['body']['id']){delete _0x1aa19f[_0xee28('0x45')]['id'];}return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x1aa19f[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x152331,null))[_0xee28('0x25')](function(_0x6e5bab){if(_0x6e5bab){_0x1aa19f[_0xee28('0x45')][_0xee28('0x4a')]=_0x6e5bab['id'];_0x1aa19f['body'][_0xee28('0x4b')]=integrations[_0xee28('0x4c')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);_0x1aa19f[_0xee28('0x45')][_0xee28('0x4d')]=integrations[_0xee28('0x4e')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);return db[_0xee28('0x49')][_0xee28('0x44')](_0x1aa19f[_0xee28('0x45')],{'include':[{'model':db[_0xee28('0x4f')],'as':'Subjects'},{'model':db[_0xee28('0x4f')],'as':_0xee28('0x4d')}]});}return null;})['then'](respondWithResult(_0x152331,null))['catch'](handleError(_0x152331,null));};exports['getFields']=function(_0x57f6d6,_0x149959,_0x56949a){var _0x24bc85='';return db[_0xee28('0x3c')][_0xee28('0x48')]({'where':{'id':_0x57f6d6['params']['id']},'attributes':['id',_0xee28('0x50'),_0xee28('0x51')]})[_0xee28('0x25')](handleEntityNotFound(_0x149959,null))[_0xee28('0x25')](function(_0x52f4e4){if(_0x52f4e4){_0x24bc85=_0x52f4e4[_0xee28('0x50')];var _0x4cb851=_0x24bc85[_0xee28('0x52')](-0x1);if(_0x4cb851==='/'){_0x24bc85=_0x24bc85[_0xee28('0x53')](0x0,_0x24bc85[_0xee28('0x54')](_0x4cb851));}return rp({'method':'GET','uri':util[_0xee28('0x55')](_0xee28('0x56'),_0x24bc85,_0xee28('0x57')),'headers':{'Authorization':util[_0xee28('0x55')]('Basic\x20%s',new Buffer(util[_0xee28('0x55')]('%s:X',_0x52f4e4[_0xee28('0x51')]))[_0xee28('0x58')](_0xee28('0x59')))},'json':!![]});}})[_0xee28('0x25')](function(_0x4d643b){if(_0x4d643b){var _0x182ad0=[_0xee28('0x5a'),_0xee28('0x5b'),'agent',_0xee28('0x5c'),'status',_0xee28('0x5d'),_0xee28('0x5e'),_0xee28('0x5f'),_0xee28('0x60'),_0xee28('0x5e'),_0xee28('0x61')];_['remove'](_0x4d643b,function(_0x4e0260){return _0x182ad0[_0xee28('0x62')](_0x4e0260[_0xee28('0x26')])||!_0x4e0260[_0xee28('0x63')]&&_0x4e0260[_0xee28('0x2c')]!==_0xee28('0x64')&&_0x4e0260[_0xee28('0x2c')]!=='custom_dropdown';});return{'count':_0x4d643b[_0xee28('0x34')],'rows':_[_0xee28('0x29')](_0x4d643b,function(_0x14cae0){return{'id':_0x14cae0[_0xee28('0x26')],'name':_0x14cae0[_0xee28('0x65')],'custom':!_0x14cae0[_0xee28('0x63')],'options':_0x14cae0[_0xee28('0x66')]?_[_0xee28('0x29')](_0x14cae0[_0xee28('0x66')],function(_0x2a6984){return{'name':_[_0xee28('0x67')](_0x2a6984),'value':_0x2a6984};}):[]};})};}})[_0xee28('0x25')](respondWithResult(_0x149959,null))[_0xee28('0x40')](function(_0x441ac1){var _0x46998f=_0x57f6d6[_0xee28('0x2f')][_0xee28('0x68')]?0x1f4:_0x441ac1['statusCode']||0x1f4;logger[_0xee28('0x69')](_0xee28('0x6a'),_0xee28('0x6b'),_0x46998f,JSON[_0xee28('0x6c')](_0x441ac1));delete _0x441ac1[_0xee28('0x26')];if(_0x46998f===0x191){_0x46998f=0x190;}_0x149959[_0xee28('0x1b')](_0x46998f)['send'](_0x57f6d6[_0xee28('0x2f')]['test']?{'message':_0xee28('0x6d'),'statusCode':_0x441ac1[_0xee28('0x6e')]}:_0x441ac1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 191251c..9bacd54 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 _0x415a=['int_freshdesk_accounts','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount'];(function(_0x864244,_0x5cd4d6){var _0x6b0119=function(_0x3e195e){while(--_0x3e195e){_0x864244['push'](_0x864244['shift']());}};_0x6b0119(++_0x5cd4d6);}(_0x415a,0x1b1));var _0xa415=function(_0x46afce,_0xde35ef){_0x46afce=_0x46afce-0x0;var _0x382f7e=_0x415a[_0x46afce];return _0x382f7e;};'use strict';var _=require(_0xa415('0x0'));var util=require(_0xa415('0x1'));var logger=require('../../config/logger')(_0xa415('0x2'));var moment=require(_0xa415('0x3'));var BPromise=require(_0xa415('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa415('0x5'));var config=require(_0xa415('0x6'));var attributes=require(_0xa415('0x7'));var integrations=require(_0xa415('0x8'));module['exports']=function(_0x3be544,_0x122313){return _0x3be544[_0xa415('0x9')](_0xa415('0xa'),attributes,{'tableName':_0xa415('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d88=['api','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8d88,0x190));var _0x88d8=function(_0x34e4a0,_0x1fd446){_0x34e4a0=_0x34e4a0-0x0;var _0x3ead3e=_0x8d88[_0x34e4a0];return _0x3ead3e;};'use strict';var _=require(_0x88d8('0x0'));var util=require(_0x88d8('0x1'));var logger=require(_0x88d8('0x2'))(_0x88d8('0x3'));var moment=require('moment');var BPromise=require(_0x88d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88d8('0x5'));var rimraf=require(_0x88d8('0x6'));var config=require(_0x88d8('0x7'));var attributes=require(_0x88d8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x88d8('0x9')]=function(_0x2dbc34,_0x4185c7){return _0x2dbc34[_0x88d8('0xa')](_0x88d8('0xb'),attributes,{'tableName':_0x88d8('0xc'),'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 cf13a91..456b46c 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 _0x8aa5=['limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8aa5,0x78));var _0x58aa=function(_0x5f3b50,_0x226ca7){_0x5f3b50=_0x5f3b50-0x0;var _0xf3ec36=_0x8aa5[_0x5f3b50];return _0xf3ec36;};'use strict';var _=require(_0x58aa('0x0'));var util=require(_0x58aa('0x1'));var moment=require(_0x58aa('0x2'));var BPromise=require(_0x58aa('0x3'));var rs=require(_0x58aa('0x4'));var fs=require('fs');var Redis=require(_0x58aa('0x5'));var db=require(_0x58aa('0x6'))['db'];var utils=require(_0x58aa('0x7'));var logger=require(_0x58aa('0x8'))(_0x58aa('0x9'));var config=require('../../config/environment');var jayson=require(_0x58aa('0xa'));var client=jayson[_0x58aa('0xb')][_0x58aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c5e44,_0x47d691,_0x1fd061){return new BPromise(function(_0x4a70f2,_0x7f3997){return client['request'](_0x8c5e44,_0x1fd061)[_0x58aa('0xd')](function(_0x35faad){logger[_0x58aa('0xe')](_0x58aa('0xf'),_0x47d691,_0x58aa('0x10'));logger[_0x58aa('0x11')](_0x58aa('0x12'),_0x47d691,_0x58aa('0x10'),JSON[_0x58aa('0x13')](_0x35faad));if(_0x35faad[_0x58aa('0x14')]){if(_0x35faad['error'][_0x58aa('0x15')]===0x1f4){logger['error'](_0x58aa('0xf'),_0x47d691,_0x35faad['error'][_0x58aa('0x16')]);return _0x7f3997(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);return _0x4a70f2(_0x35faad[_0x58aa('0x14')][_0x58aa('0x16')]);}else{logger[_0x58aa('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x47d691,_0x58aa('0x10'));_0x4a70f2(_0x35faad[_0x58aa('0x17')][_0x58aa('0x16')]);}})[_0x58aa('0x18')](function(_0x1baffc){logger[_0x58aa('0x14')](_0x58aa('0xf'),_0x47d691,_0x1baffc);_0x7f3997(_0x1baffc);});});}exports[_0x58aa('0x19')]=function(_0x542386){var _0x489663=this;return new Promise(function(_0x1ee792,_0x436092){return db[_0x58aa('0x1a')][_0x58aa('0x1b')]({'raw':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1e')]||null:null,'attributes':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x1f')]||null:null,'limit':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x20')]||null:null,'include':_0x542386[_0x58aa('0x1c')]?_0x542386[_0x58aa('0x1c')][_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x542386[_0x58aa('0x1c')][_0x58aa('0x21')],function(_0xbfafe7){return{'model':db[_0xbfafe7['model']],'as':_0xbfafe7['as'],'attributes':_0xbfafe7['attributes'],'include':_0xbfafe7[_0x58aa('0x21')]?_[_0x58aa('0x22')](_0xbfafe7[_0x58aa('0x21')],function(_0x2041c6){return{'model':db[_0x2041c6['model']],'as':_0x2041c6['as'],'attributes':_0x2041c6[_0x58aa('0x1f')],'include':_0x2041c6['include']?_[_0x58aa('0x22')](_0x2041c6[_0x58aa('0x21')],function(_0xe7ae31){return{'model':db[_0xe7ae31[_0x58aa('0x23')]],'as':_0xe7ae31['as'],'attributes':_0xe7ae31[_0x58aa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595d21){logger['info'](_0x58aa('0x19'),_0x542386);logger['debug']('GetFreshdeskAccount',_0x542386,JSON[_0x58aa('0x13')](_0x595d21));_0x1ee792(_0x595d21);})[_0x58aa('0x18')](function(_0x27c8be){logger['error'](_0x58aa('0x19'),_0x27c8be[_0x58aa('0x16')],_0x542386);_0x436092(_0x489663[_0x58aa('0x14')](0x1f4,_0x27c8be[_0x58aa('0x16')]));});});};exports[_0x58aa('0x24')]=function(_0x2d535c){var _0x4de66c=this;return new Promise(function(_0x70f1e4,_0x14bf7a){return db[_0x58aa('0x1a')][_0x58aa('0x25')]({'raw':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c['options'][_0x58aa('0x1e')]||null:null,'attributes':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x1f')]||null:null,'include':_0x2d535c[_0x58aa('0x1c')]?_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x2d535c[_0x58aa('0x1c')][_0x58aa('0x21')],function(_0x1f7550){return{'model':db[_0x1f7550['model']],'as':_0x1f7550['as'],'attributes':_0x1f7550['attributes'],'include':_0x1f7550['include']?_[_0x58aa('0x22')](_0x1f7550[_0x58aa('0x21')],function(_0x49d666){return{'model':db[_0x49d666[_0x58aa('0x23')]],'as':_0x49d666['as'],'attributes':_0x49d666[_0x58aa('0x1f')],'include':_0x49d666[_0x58aa('0x21')]?_[_0x58aa('0x22')](_0x49d666[_0x58aa('0x21')],function(_0x4a680e){return{'model':db[_0x4a680e[_0x58aa('0x23')]],'as':_0x4a680e['as'],'attributes':_0x4a680e[_0x58aa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e8390){logger[_0x58aa('0xe')](_0x58aa('0x24'),_0x2d535c);logger[_0x58aa('0x11')](_0x58aa('0x24'),_0x2d535c,JSON[_0x58aa('0x13')](_0x3e8390));_0x70f1e4(_0x3e8390);})[_0x58aa('0x18')](function(_0x4725b1){logger['error'](_0x58aa('0x24'),_0x4725b1['message'],_0x2d535c);_0x14bf7a(_0x4de66c[_0x58aa('0x14')](0x1f4,_0x4725b1[_0x58aa('0x16')]));});});}; \ No newline at end of file +var _0x7f79=['ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x3be24d,_0x108075){var _0xb6fc04=function(_0x3b1e99){while(--_0x3b1e99){_0x3be24d['push'](_0x3be24d['shift']());}};_0xb6fc04(++_0x108075);}(_0x7f79,0x8a));var _0x97f7=function(_0x5cb7a1,_0x56273b){_0x5cb7a1=_0x5cb7a1-0x0;var _0x247d53=_0x7f79[_0x5cb7a1];return _0x247d53;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var moment=require(_0x97f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x97f7('0x3'));var fs=require('fs');var Redis=require(_0x97f7('0x4'));var db=require(_0x97f7('0x5'))['db'];var utils=require(_0x97f7('0x6'));var logger=require(_0x97f7('0x7'))(_0x97f7('0x8'));var config=require('../../config/environment');var jayson=require(_0x97f7('0x9'));var client=jayson['client'][_0x97f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3053dc,_0x4aaca8,_0x4283d3){return new BPromise(function(_0x27d7c6,_0x117ced){return client['request'](_0x3053dc,_0x4283d3)[_0x97f7('0xb')](function(_0x37bc36){logger[_0x97f7('0xc')](_0x97f7('0xd'),_0x4aaca8,_0x97f7('0xe'));logger[_0x97f7('0xf')](_0x97f7('0x10'),_0x4aaca8,_0x97f7('0xe'),JSON[_0x97f7('0x11')](_0x37bc36));if(_0x37bc36['error']){if(_0x37bc36['error']['code']===0x1f4){logger[_0x97f7('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x4aaca8,_0x37bc36[_0x97f7('0x12')][_0x97f7('0x13')]);return _0x117ced(_0x37bc36[_0x97f7('0x12')][_0x97f7('0x13')]);}logger[_0x97f7('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x4aaca8,_0x37bc36[_0x97f7('0x12')][_0x97f7('0x13')]);return _0x27d7c6(_0x37bc36[_0x97f7('0x12')][_0x97f7('0x13')]);}else{logger[_0x97f7('0xc')](_0x97f7('0xd'),_0x4aaca8,_0x97f7('0xe'));_0x27d7c6(_0x37bc36[_0x97f7('0x14')][_0x97f7('0x13')]);}})[_0x97f7('0x15')](function(_0x265d30){logger[_0x97f7('0x12')](_0x97f7('0xd'),_0x4aaca8,_0x265d30);_0x117ced(_0x265d30);});});}exports[_0x97f7('0x16')]=function(_0x35e6e8){var _0x31029b=this;return new Promise(function(_0x35b429,_0x33cb4f){return db[_0x97f7('0x17')][_0x97f7('0x18')]({'raw':_0x35e6e8['options']?_0x35e6e8[_0x97f7('0x19')][_0x97f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x35e6e8[_0x97f7('0x19')]?_0x35e6e8['options'][_0x97f7('0x1b')]||null:null,'attributes':_0x35e6e8[_0x97f7('0x19')]?_0x35e6e8[_0x97f7('0x19')][_0x97f7('0x1c')]||null:null,'limit':_0x35e6e8[_0x97f7('0x19')]?_0x35e6e8[_0x97f7('0x19')]['limit']||null:null,'include':_0x35e6e8[_0x97f7('0x19')]?_0x35e6e8['options'][_0x97f7('0x1d')]?_[_0x97f7('0x1e')](_0x35e6e8[_0x97f7('0x19')][_0x97f7('0x1d')],function(_0x567df4){return{'model':db[_0x567df4[_0x97f7('0x1f')]],'as':_0x567df4['as'],'attributes':_0x567df4['attributes'],'include':_0x567df4[_0x97f7('0x1d')]?_[_0x97f7('0x1e')](_0x567df4['include'],function(_0x490bc2){return{'model':db[_0x490bc2['model']],'as':_0x490bc2['as'],'attributes':_0x490bc2['attributes'],'include':_0x490bc2['include']?_[_0x97f7('0x1e')](_0x490bc2[_0x97f7('0x1d')],function(_0xfaabd){return{'model':db[_0xfaabd[_0x97f7('0x1f')]],'as':_0xfaabd['as'],'attributes':_0xfaabd[_0x97f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97f7('0xb')](function(_0x5e17cd){logger['info'](_0x97f7('0x16'),_0x35e6e8);logger['debug']('GetFreshdeskAccount',_0x35e6e8,JSON[_0x97f7('0x11')](_0x5e17cd));_0x35b429(_0x5e17cd);})['catch'](function(_0x11c5e2){logger['error'](_0x97f7('0x16'),_0x11c5e2[_0x97f7('0x13')],_0x35e6e8);_0x33cb4f(_0x31029b[_0x97f7('0x12')](0x1f4,_0x11c5e2[_0x97f7('0x13')]));});});};exports[_0x97f7('0x20')]=function(_0x524076){var _0x4e0b6a=this;return new Promise(function(_0x2868c0,_0x2ed1df){return db[_0x97f7('0x17')][_0x97f7('0x21')]({'raw':_0x524076['options']?_0x524076[_0x97f7('0x19')][_0x97f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x524076[_0x97f7('0x19')]?_0x524076[_0x97f7('0x19')][_0x97f7('0x1b')]||null:null,'attributes':_0x524076[_0x97f7('0x19')]?_0x524076[_0x97f7('0x19')]['attributes']||null:null,'include':_0x524076[_0x97f7('0x19')]?_0x524076[_0x97f7('0x19')][_0x97f7('0x1d')]?_[_0x97f7('0x1e')](_0x524076[_0x97f7('0x19')][_0x97f7('0x1d')],function(_0x2d5bb5){return{'model':db[_0x2d5bb5[_0x97f7('0x1f')]],'as':_0x2d5bb5['as'],'attributes':_0x2d5bb5['attributes'],'include':_0x2d5bb5[_0x97f7('0x1d')]?_[_0x97f7('0x1e')](_0x2d5bb5[_0x97f7('0x1d')],function(_0x214e08){return{'model':db[_0x214e08['model']],'as':_0x214e08['as'],'attributes':_0x214e08[_0x97f7('0x1c')],'include':_0x214e08['include']?_[_0x97f7('0x1e')](_0x214e08[_0x97f7('0x1d')],function(_0x3edd95){return{'model':db[_0x3edd95[_0x97f7('0x1f')]],'as':_0x3edd95['as'],'attributes':_0x3edd95[_0x97f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x97f7('0xb')](function(_0x23697c){logger[_0x97f7('0xc')](_0x97f7('0x20'),_0x524076);logger[_0x97f7('0xf')](_0x97f7('0x20'),_0x524076,JSON[_0x97f7('0x11')](_0x23697c));_0x2868c0(_0x23697c);})['catch'](function(_0x1de382){logger['error'](_0x97f7('0x20'),_0x1de382[_0x97f7('0x13')],_0x524076);_0x2ed1df(_0x4e0b6a[_0x97f7('0x12')](0x1f4,_0x1de382[_0x97f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f8fa443..01635be 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 _0xc097=['put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags','getTags','post'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xc097,0xb8));var _0x7c09=function(_0x16ec83,_0x5b853d){_0x16ec83=_0x16ec83-0x0;var _0x449b22=_0xc097[_0x16ec83];return _0x449b22;};'use strict';var multer=require(_0x7c09('0x0'));var util=require(_0x7c09('0x1'));var path=require(_0x7c09('0x2'));var timeout=require(_0x7c09('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c09('0x5'));router[_0x7c09('0x6')]('/',auth[_0x7c09('0x7')](),controller[_0x7c09('0x8')]);router[_0x7c09('0x6')](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller['show']);router[_0x7c09('0x6')](_0x7c09('0xa'),auth['isAuthenticated'](),controller[_0x7c09('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x7c09('0xc')]);router[_0x7c09('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7c09('0x6')](_0x7c09('0xd'),auth[_0x7c09('0x7')](),controller[_0x7c09('0xe')]);router[_0x7c09('0xf')]('/',auth[_0x7c09('0x7')](),controller['create']);router[_0x7c09('0xf')](_0x7c09('0xd'),auth[_0x7c09('0x7')](),controller['setTags']);router[_0x7c09('0x10')](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller[_0x7c09('0x11')]);router['delete'](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller[_0x7c09('0x12')]);module[_0x7c09('0x13')]=router; \ No newline at end of file +var _0xe764=['getSubjects','getTags','post','create','/:id/tags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','/:id','show','isAuthenticated','/:id/subjects'];(function(_0x42eb29,_0x43cd6f){var _0x4a7185=function(_0x4121c4){while(--_0x4121c4){_0x42eb29['push'](_0x42eb29['shift']());}};_0x4a7185(++_0x43cd6f);}(_0xe764,0xc1));var _0x4e76=function(_0x48051b,_0x368d0b){_0x48051b=_0x48051b-0x0;var _0x5669e1=_0xe764[_0x48051b];return _0x5669e1;};'use strict';var multer=require(_0x4e76('0x0'));var util=require(_0x4e76('0x1'));var path=require(_0x4e76('0x2'));var timeout=require(_0x4e76('0x3'));var express=require(_0x4e76('0x4'));var router=express[_0x4e76('0x5')]();var fs_extra=require(_0x4e76('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e76('0x7'));var config=require('../../config/environment');var controller=require(_0x4e76('0x8'));router[_0x4e76('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e76('0x9')](_0x4e76('0xa'),auth['isAuthenticated'](),controller[_0x4e76('0xb')]);router[_0x4e76('0x9')]('/:id/fields',auth[_0x4e76('0xc')](),controller['getFields']);router[_0x4e76('0x9')](_0x4e76('0xd'),auth[_0x4e76('0xc')](),controller[_0x4e76('0xe')]);router[_0x4e76('0x9')]('/:id/descriptions',auth[_0x4e76('0xc')](),controller['getDescriptions']);router[_0x4e76('0x9')]('/:id/tags',auth[_0x4e76('0xc')](),controller[_0x4e76('0xf')]);router[_0x4e76('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e76('0x11')]);router[_0x4e76('0x10')](_0x4e76('0x12'),auth[_0x4e76('0xc')](),controller['setTags']);router[_0x4e76('0x13')](_0x4e76('0xa'),auth[_0x4e76('0xc')](),controller[_0x4e76('0x14')]);router[_0x4e76('0x15')](_0x4e76('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e76('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 72e0cfa..961e5f7 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 _0xb101=['exports','STRING','sequelize'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xb101,0xda));var _0x1b10=function(_0x4a14dd,_0x431e28){_0x4a14dd=_0x4a14dd-0x0;var _0x30214f=_0xb101[_0x4a14dd];return _0x30214f;};'use strict';var Sequelize=require(_0x1b10('0x0'));module[_0x1b10('0x1')]={'name':{'type':Sequelize[_0x1b10('0x2')]},'description':{'type':Sequelize[_0x1b10('0x2')]}}; \ No newline at end of file +var _0x04b1=['STRING','sequelize'];(function(_0x2c4e8a,_0x15d39d){var _0x243a26=function(_0x4137c5){while(--_0x4137c5){_0x2c4e8a['push'](_0x2c4e8a['shift']());}};_0x243a26(++_0x15d39d);}(_0x04b1,0x139));var _0x104b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x04b1[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x104b('0x0'));module['exports']={'name':{'type':Sequelize[_0x104b('0x1')]},'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 6be5792..617bcb7 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 _0x33f1=['name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','include','body','update','find','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x33f1,0xce));var _0x133f=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x33f1[_0x4605dc];return _0x5d3e81;};'use strict';var emlformat=require(_0x133f('0x0'));var rimraf=require(_0x133f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x133f('0x2'));var rp=require(_0x133f('0x3'));var moment=require(_0x133f('0x4'));var BPromise=require(_0x133f('0x5'));var Mustache=require(_0x133f('0x6'));var util=require(_0x133f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x133f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x133f('0x9'));var _=require('lodash');var squel=require(_0x133f('0xa'));var crypto=require(_0x133f('0xb'));var jsforce=require(_0x133f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x133f('0x8'));var querystring=require(_0x133f('0xd'));var Papa=require(_0x133f('0xe'));var Redis=require(_0x133f('0xf'));var authService=require(_0x133f('0x10'));var qs=require(_0x133f('0x11'));var as=require(_0x133f('0x12'));var hardwareService=require(_0x133f('0x13'));var logger=require('../../config/logger')(_0x133f('0x14'));var utils=require(_0x133f('0x15'));var config=require(_0x133f('0x16'));var licenseUtil=require(_0x133f('0x17'));var db=require(_0x133f('0x18'))['db'];function respondWithStatusCode(_0x3e26f4,_0x1cfdb4){_0x1cfdb4=_0x1cfdb4||0xcc;return function(_0x2e0306){if(_0x2e0306){return _0x3e26f4['sendStatus'](_0x1cfdb4);}return _0x3e26f4[_0x133f('0x19')](_0x1cfdb4)[_0x133f('0x1a')]();};}function respondWithResult(_0x13f735,_0x3a280b){_0x3a280b=_0x3a280b||0xc8;return function(_0x367136){if(_0x367136){return _0x13f735[_0x133f('0x19')](_0x3a280b)[_0x133f('0x1b')](_0x367136);}};}function respondWithFilteredResult(_0x3b8e75,_0x1f9885){return function(_0x2a765d){if(_0x2a765d){var _0x5387b5=typeof _0x1f9885[_0x133f('0x1c')]===_0x133f('0x1d')&&typeof _0x1f9885[_0x133f('0x1e')]==='undefined';var _0x175265=_0x2a765d[_0x133f('0x1f')];var _0x3b26a5=_0x5387b5?0x0:_0x1f9885[_0x133f('0x1c')];var _0x454b9a=_0x5387b5?_0x2a765d[_0x133f('0x1f')]:_0x1f9885[_0x133f('0x1c')]+_0x1f9885[_0x133f('0x1e')];var _0x6dd94f;if(_0x454b9a>=_0x175265){_0x454b9a=_0x175265;_0x6dd94f=0xc8;}else{_0x6dd94f=0xce;}_0x3b8e75[_0x133f('0x19')](_0x6dd94f);return _0x3b8e75[_0x133f('0x20')](_0x133f('0x21'),_0x3b26a5+'-'+_0x454b9a+'/'+_0x175265)[_0x133f('0x1b')](_0x2a765d);}return null;};}function patchUpdates(_0x40cb71){return function(_0x537c51){try{jsonpatch[_0x133f('0x22')](_0x537c51,_0x40cb71,!![]);}catch(_0x17ff23){return BPromise[_0x133f('0x23')](_0x17ff23);}return _0x537c51[_0x133f('0x24')]();};}function saveUpdates(_0x28076d,_0xf42ac1){return function(_0x34ff1a){if(_0x34ff1a){return _0x34ff1a['update'](_0x28076d)[_0x133f('0x25')](function(_0x30727c){return _0x30727c;});}return null;};}function removeEntity(_0x1c82ff,_0x330a4c){return function(_0x55eb55){if(_0x55eb55){return _0x55eb55['destroy']()[_0x133f('0x25')](function(){_0x1c82ff[_0x133f('0x19')](0xcc)[_0x133f('0x1a')]();});}};}function handleEntityNotFound(_0x128f4d,_0x27aaa9){return function(_0x42915b){if(!_0x42915b){_0x128f4d['sendStatus'](0x194);}return _0x42915b;};}function handleError(_0x27e35f,_0x4e270d){_0x4e270d=_0x4e270d||0x1f4;return function(_0x4b2551){logger[_0x133f('0x26')](_0x4b2551[_0x133f('0x27')]);if(_0x4b2551['name']){delete _0x4b2551[_0x133f('0x28')];}_0x27e35f[_0x133f('0x19')](_0x4e270d)[_0x133f('0x29')](_0x4b2551);};}exports[_0x133f('0x2a')]=function(_0x4c9e14,_0x30592f){var _0x33a69b={},_0x841fa9={},_0x5d3cfb={'count':0x0,'rows':[]};var _0x39c66a=_[_0x133f('0x2b')](db[_0x133f('0x2c')][_0x133f('0x2d')],function(_0x300aeb){return{'name':_0x300aeb[_0x133f('0x2e')],'type':_0x300aeb[_0x133f('0x2f')]['key']};});_0x841fa9[_0x133f('0x30')]=_[_0x133f('0x2b')](_0x39c66a,'name');_0x841fa9[_0x133f('0x31')]=_[_0x133f('0x32')](_0x4c9e14[_0x133f('0x31')]);_0x841fa9[_0x133f('0x33')]=_[_0x133f('0x34')](_0x841fa9['model'],_0x841fa9[_0x133f('0x31')]);_0x33a69b['attributes']=_['intersection'](_0x841fa9[_0x133f('0x30')],qs[_0x133f('0x35')](_0x4c9e14[_0x133f('0x31')]['fields']));_0x33a69b[_0x133f('0x36')]=_0x33a69b[_0x133f('0x36')][_0x133f('0x37')]?_0x33a69b['attributes']:_0x841fa9['model'];if(!_0x4c9e14['query'][_0x133f('0x38')](_0x133f('0x39'))){_0x33a69b[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x4c9e14[_0x133f('0x31')][_0x133f('0x1e')]);_0x33a69b[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x4c9e14[_0x133f('0x31')]['offset']);}_0x33a69b[_0x133f('0x3a')]=qs[_0x133f('0x3b')](_0x4c9e14['query'][_0x133f('0x3b')]);_0x33a69b[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x4c9e14['query'],_0x841fa9[_0x133f('0x33')]),_0x39c66a);if(_0x4c9e14['query'][_0x133f('0x3e')]){_0x33a69b[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x33a69b[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x39c66a,function(_0x1cd4a9){if(_0x1cd4a9[_0x133f('0x2f')]!=='VIRTUAL'){var _0x29af33={};_0x29af33[_0x1cd4a9[_0x133f('0x28')]]={'$like':'%'+_0x4c9e14[_0x133f('0x31')]['filter']+'%'};return _0x29af33;}})});}_0x33a69b=_[_0x133f('0x3f')]({},_0x33a69b,_0x4c9e14[_0x133f('0x40')]);var _0x3feae9={'where':_0x33a69b[_0x133f('0x3c')]};return db['FreshdeskConfiguration'][_0x133f('0x1f')](_0x3feae9)[_0x133f('0x25')](function(_0x5bb24d){_0x5d3cfb['count']=_0x5bb24d;if(_0x4c9e14[_0x133f('0x31')]['includeAll']){_0x33a69b['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x133f('0x41')](_0x33a69b);})[_0x133f('0x25')](function(_0x58feff){_0x5d3cfb['rows']=_0x58feff;return _0x5d3cfb;})[_0x133f('0x25')](respondWithFilteredResult(_0x30592f,_0x33a69b))[_0x133f('0x42')](handleError(_0x30592f,null));};exports[_0x133f('0x43')]=function(_0x3f996f,_0x130f29){var _0x47ed39={'raw':![],'where':{'id':_0x3f996f[_0x133f('0x44')]['id']}},_0x157f78={};_0x157f78['model']=_[_0x133f('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x157f78[_0x133f('0x31')]=_[_0x133f('0x32')](_0x3f996f['query']);_0x157f78['filters']=_['intersection'](_0x157f78['model'],_0x157f78[_0x133f('0x31')]);_0x47ed39['attributes']=_[_0x133f('0x34')](_0x157f78[_0x133f('0x30')],qs['fields'](_0x3f996f[_0x133f('0x31')][_0x133f('0x35')]));_0x47ed39[_0x133f('0x36')]=_0x47ed39[_0x133f('0x36')]['length']?_0x47ed39['attributes']:_0x157f78[_0x133f('0x30')];if(_0x3f996f['query']['includeAll']){_0x47ed39[_0x133f('0x45')]=[{'all':!![]}];}_0x47ed39=_[_0x133f('0x3f')]({},_0x47ed39,_0x3f996f[_0x133f('0x40')]);return db[_0x133f('0x2c')]['find'](_0x47ed39)[_0x133f('0x25')](handleEntityNotFound(_0x130f29,null))[_0x133f('0x25')](respondWithResult(_0x130f29,null))['catch'](handleError(_0x130f29,null));};exports['create']=function(_0xb23ed1,_0x3a60d3){return db[_0x133f('0x2c')]['create'](_0xb23ed1[_0x133f('0x46')],{})[_0x133f('0x25')](respondWithResult(_0x3a60d3,0xc9))['catch'](handleError(_0x3a60d3,null));};exports[_0x133f('0x47')]=function(_0x3af25d,_0x5c86f3){if(_0x3af25d[_0x133f('0x46')]['id']){delete _0x3af25d['body']['id'];}return db[_0x133f('0x2c')][_0x133f('0x48')]({'where':{'id':_0x3af25d['params']['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x5c86f3,null))[_0x133f('0x25')](saveUpdates(_0x3af25d[_0x133f('0x46')],null))[_0x133f('0x25')](respondWithResult(_0x5c86f3,null))['catch'](handleError(_0x5c86f3,null));};exports[_0x133f('0x49')]=function(_0x31cbf0,_0x2165ac){return db['FreshdeskConfiguration'][_0x133f('0x48')]({'where':{'id':_0x31cbf0[_0x133f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2165ac,null))[_0x133f('0x25')](removeEntity(_0x2165ac,null))['catch'](handleError(_0x2165ac,null));};exports[_0x133f('0x4a')]=function(_0x1239c6,_0x3d6c88,_0x490da0){var _0x4ed605={};var _0x6a689c={};var _0x88b60d;var _0x5d8a07;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x1239c6['params']['id']}})['then'](handleEntityNotFound(_0x3d6c88,null))[_0x133f('0x25')](function(_0x568a56){if(_0x568a56){_0x88b60d=_0x568a56;_0x6a689c['model']=_['keys'](db[_0x133f('0x4c')][_0x133f('0x2d')]);_0x6a689c[_0x133f('0x31')]=_[_0x133f('0x32')](_0x1239c6[_0x133f('0x31')]);_0x6a689c[_0x133f('0x33')]=_[_0x133f('0x34')](_0x6a689c[_0x133f('0x30')],_0x6a689c['query']);_0x4ed605[_0x133f('0x36')]=_[_0x133f('0x34')](_0x6a689c[_0x133f('0x30')],qs[_0x133f('0x35')](_0x1239c6[_0x133f('0x31')][_0x133f('0x35')]));_0x4ed605[_0x133f('0x36')]=_0x4ed605[_0x133f('0x36')]['length']?_0x4ed605['attributes']:_0x6a689c[_0x133f('0x30')];_0x4ed605[_0x133f('0x3a')]=qs[_0x133f('0x3b')](_0x1239c6[_0x133f('0x31')][_0x133f('0x3b')]);_0x4ed605['where']=qs['filters'](_[_0x133f('0x3d')](_0x1239c6['query'],_0x6a689c[_0x133f('0x33')]));if(_0x1239c6[_0x133f('0x31')][_0x133f('0x3e')]){_0x4ed605[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x4ed605[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x4ed605[_0x133f('0x36')],function(_0x5381dd){var _0x565255={};_0x565255[_0x5381dd]={'$like':'%'+_0x1239c6[_0x133f('0x31')][_0x133f('0x3e')]+'%'};return _0x565255;})});}_0x4ed605=_[_0x133f('0x3f')]({},_0x4ed605,_0x1239c6[_0x133f('0x40')]);return _0x88b60d['getFields'](_0x4ed605);}})['then'](function(_0x26af6e){if(_0x26af6e){_0x5d8a07=_0x26af6e[_0x133f('0x37')];if(!_0x1239c6[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x4ed605[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x1239c6[_0x133f('0x31')][_0x133f('0x1e')]);_0x4ed605[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x1239c6[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x88b60d[_0x133f('0x4a')](_0x4ed605);}})[_0x133f('0x25')](function(_0x209bce){if(_0x209bce){return _0x209bce?{'count':_0x5d8a07,'rows':_0x209bce}:null;}})[_0x133f('0x25')](respondWithResult(_0x3d6c88,null))[_0x133f('0x42')](handleError(_0x3d6c88,null));};exports[_0x133f('0x4d')]=function(_0x10ec94,_0x262b40,_0x4e31c3){var _0x284cda={};var _0x1da48b={};var _0x3db9d0;var _0x421849;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x10ec94['params']['id']}})['then'](handleEntityNotFound(_0x262b40,null))[_0x133f('0x25')](function(_0x78cf0e){if(_0x78cf0e){_0x3db9d0=_0x78cf0e;_0x1da48b['model']=_[_0x133f('0x32')](db['FreshdeskField'][_0x133f('0x2d')]);_0x1da48b[_0x133f('0x31')]=_[_0x133f('0x32')](_0x10ec94['query']);_0x1da48b[_0x133f('0x33')]=_[_0x133f('0x34')](_0x1da48b[_0x133f('0x30')],_0x1da48b['query']);_0x284cda['attributes']=_[_0x133f('0x34')](_0x1da48b[_0x133f('0x30')],qs[_0x133f('0x35')](_0x10ec94[_0x133f('0x31')][_0x133f('0x35')]));_0x284cda['attributes']=_0x284cda[_0x133f('0x36')][_0x133f('0x37')]?_0x284cda[_0x133f('0x36')]:_0x1da48b[_0x133f('0x30')];_0x284cda[_0x133f('0x3a')]=qs['sort'](_0x10ec94[_0x133f('0x31')]['sort']);_0x284cda['where']=qs['filters'](_[_0x133f('0x3d')](_0x10ec94[_0x133f('0x31')],_0x1da48b[_0x133f('0x33')]));if(_0x10ec94[_0x133f('0x31')]['filter']){_0x284cda['where']=_[_0x133f('0x3f')](_0x284cda[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x284cda[_0x133f('0x36')],function(_0x2cfd62){var _0x3605d7={};_0x3605d7[_0x2cfd62]={'$like':'%'+_0x10ec94['query']['filter']+'%'};return _0x3605d7;})});}_0x284cda=_[_0x133f('0x3f')]({},_0x284cda,_0x10ec94[_0x133f('0x40')]);return _0x3db9d0['getSubjects'](_0x284cda);}})[_0x133f('0x25')](function(_0x205f77){if(_0x205f77){_0x421849=_0x205f77[_0x133f('0x37')];if(!_0x10ec94['query']['hasOwnProperty'](_0x133f('0x39'))){_0x284cda[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x10ec94['query']['limit']);_0x284cda[_0x133f('0x1c')]=qs[_0x133f('0x1c')](_0x10ec94[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x3db9d0[_0x133f('0x4d')](_0x284cda);}})[_0x133f('0x25')](function(_0x2a196b){if(_0x2a196b){return _0x2a196b?{'count':_0x421849,'rows':_0x2a196b}:null;}})[_0x133f('0x25')](respondWithResult(_0x262b40,null))['catch'](handleError(_0x262b40,null));};exports[_0x133f('0x4e')]=function(_0x56b899,_0x59d210,_0x16eac2){var _0x1e7343={};var _0x3e2b49={};var _0xf9d64;var _0x2aeabf;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x56b899[_0x133f('0x44')]['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x59d210,null))[_0x133f('0x25')](function(_0x5bbdad){if(_0x5bbdad){_0xf9d64=_0x5bbdad;_0x3e2b49[_0x133f('0x30')]=_[_0x133f('0x32')](db[_0x133f('0x4c')][_0x133f('0x2d')]);_0x3e2b49[_0x133f('0x31')]=_['keys'](_0x56b899[_0x133f('0x31')]);_0x3e2b49['filters']=_[_0x133f('0x34')](_0x3e2b49[_0x133f('0x30')],_0x3e2b49[_0x133f('0x31')]);_0x1e7343[_0x133f('0x36')]=_[_0x133f('0x34')](_0x3e2b49['model'],qs['fields'](_0x56b899['query']['fields']));_0x1e7343[_0x133f('0x36')]=_0x1e7343[_0x133f('0x36')][_0x133f('0x37')]?_0x1e7343[_0x133f('0x36')]:_0x3e2b49[_0x133f('0x30')];_0x1e7343[_0x133f('0x3a')]=qs['sort'](_0x56b899[_0x133f('0x31')][_0x133f('0x3b')]);_0x1e7343[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x56b899[_0x133f('0x31')],_0x3e2b49[_0x133f('0x33')]));if(_0x56b899[_0x133f('0x31')]['filter']){_0x1e7343[_0x133f('0x3c')]=_[_0x133f('0x3f')](_0x1e7343[_0x133f('0x3c')],{'$or':_[_0x133f('0x2b')](_0x1e7343['attributes'],function(_0x1463c0){var _0x11039c={};_0x11039c[_0x1463c0]={'$like':'%'+_0x56b899[_0x133f('0x31')]['filter']+'%'};return _0x11039c;})});}_0x1e7343=_[_0x133f('0x3f')]({},_0x1e7343,_0x56b899['options']);return _0xf9d64[_0x133f('0x4e')](_0x1e7343);}})['then'](function(_0x58c12c){if(_0x58c12c){_0x2aeabf=_0x58c12c[_0x133f('0x37')];if(!_0x56b899[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x1e7343[_0x133f('0x1e')]=qs[_0x133f('0x1e')](_0x56b899['query'][_0x133f('0x1e')]);_0x1e7343[_0x133f('0x1c')]=qs['offset'](_0x56b899['query'][_0x133f('0x1c')]);}return _0xf9d64['getDescriptions'](_0x1e7343);}})[_0x133f('0x25')](function(_0x104168){if(_0x104168){return _0x104168?{'count':_0x2aeabf,'rows':_0x104168}:null;}})[_0x133f('0x25')](respondWithResult(_0x59d210,null))[_0x133f('0x42')](handleError(_0x59d210,null));};exports['getTags']=function(_0x28d398,_0x32aeed,_0x57d80d){var _0x3012f8={};var _0x10ce6d={};var _0x1c7a2a;var _0x2f2d64;return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x28d398[_0x133f('0x44')]['id']}})[_0x133f('0x25')](handleEntityNotFound(_0x32aeed,null))[_0x133f('0x25')](function(_0x5af047){if(_0x5af047){_0x1c7a2a=_0x5af047;_0x10ce6d['model']=_['keys'](db[_0x133f('0x4f')]['rawAttributes']);_0x10ce6d[_0x133f('0x31')]=_[_0x133f('0x32')](_0x28d398[_0x133f('0x31')]);_0x10ce6d[_0x133f('0x33')]=_[_0x133f('0x34')](_0x10ce6d['model'],_0x10ce6d['query']);_0x3012f8['attributes']=_[_0x133f('0x34')](_0x10ce6d['model'],qs[_0x133f('0x35')](_0x28d398[_0x133f('0x31')]['fields']));_0x3012f8[_0x133f('0x36')]=_0x3012f8[_0x133f('0x36')][_0x133f('0x37')]?_0x3012f8[_0x133f('0x36')]:_0x10ce6d['model'];_0x3012f8['order']=qs[_0x133f('0x3b')](_0x28d398['query'][_0x133f('0x3b')]);_0x3012f8[_0x133f('0x3c')]=qs[_0x133f('0x33')](_[_0x133f('0x3d')](_0x28d398[_0x133f('0x31')],_0x10ce6d[_0x133f('0x33')]));if(_0x28d398[_0x133f('0x31')][_0x133f('0x3e')]){_0x3012f8[_0x133f('0x3c')]=_['merge'](_0x3012f8[_0x133f('0x3c')],{'$or':_['map'](_0x3012f8['attributes'],function(_0x24a228){var _0x4151c7={};_0x4151c7[_0x24a228]={'$like':'%'+_0x28d398['query'][_0x133f('0x3e')]+'%'};return _0x4151c7;})});}_0x3012f8=_[_0x133f('0x3f')]({},_0x3012f8,_0x28d398[_0x133f('0x40')]);return _0x1c7a2a[_0x133f('0x50')](_0x3012f8);}})[_0x133f('0x25')](function(_0x36903a){if(_0x36903a){_0x2f2d64=_0x36903a[_0x133f('0x37')];if(!_0x28d398[_0x133f('0x31')][_0x133f('0x38')](_0x133f('0x39'))){_0x3012f8['limit']=qs[_0x133f('0x1e')](_0x28d398[_0x133f('0x31')][_0x133f('0x1e')]);_0x3012f8['offset']=qs['offset'](_0x28d398[_0x133f('0x31')][_0x133f('0x1c')]);}return _0x1c7a2a[_0x133f('0x50')](_0x3012f8);}})[_0x133f('0x25')](function(_0x38dcf8){if(_0x38dcf8){return _0x38dcf8?{'count':_0x2f2d64,'rows':_0x38dcf8}:null;}})[_0x133f('0x25')](respondWithResult(_0x32aeed,null))[_0x133f('0x42')](handleError(_0x32aeed,null));};exports[_0x133f('0x51')]=function(_0x92eabc,_0x9a8d91,_0x3c7099){if(_0x92eabc['body']['id']){delete _0x92eabc[_0x133f('0x46')]['id'];}return db[_0x133f('0x2c')][_0x133f('0x4b')]({'where':{'id':_0x92eabc[_0x133f('0x44')]['id']}})['then'](handleEntityNotFound(_0x9a8d91,null))[_0x133f('0x25')](function(_0x16e17f){if(_0x16e17f){return _0x16e17f['setTags'](_0x92eabc['body']['ids']||[]);}return null;})[_0x133f('0x25')](respondWithResult(_0x9a8d91,null))[_0x133f('0x42')](handleError(_0x9a8d91,null));}; \ No newline at end of file +var _0xb877=['find','create','body','params','destroy','getFields','findOne','FreshdeskField','where','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','error','name','index','map','FreshdeskConfiguration','rawAttributes','type','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys'];(function(_0x33bdc8,_0x265136){var _0x49d344=function(_0x5e48c8){while(--_0x5e48c8){_0x33bdc8['push'](_0x33bdc8['shift']());}};_0x49d344(++_0x265136);}(_0xb877,0xb2));var _0x7b87=function(_0x3b1162,_0x5ae750){_0x3b1162=_0x3b1162-0x0;var _0x12074f=_0xb877[_0x3b1162];return _0x12074f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b87('0x0'));var zipdir=require(_0x7b87('0x1'));var jsonpatch=require(_0x7b87('0x2'));var rp=require('request-promise');var moment=require(_0x7b87('0x3'));var BPromise=require(_0x7b87('0x4'));var Mustache=require(_0x7b87('0x5'));var util=require(_0x7b87('0x6'));var path=require('path');var sox=require(_0x7b87('0x7'));var csv=require(_0x7b87('0x8'));var ejs=require(_0x7b87('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b87('0xa'));var squel=require(_0x7b87('0xb'));var crypto=require(_0x7b87('0xc'));var jsforce=require(_0x7b87('0xd'));var deskjs=require(_0x7b87('0xe'));var toCsv=require(_0x7b87('0x8'));var querystring=require(_0x7b87('0xf'));var Papa=require(_0x7b87('0x10'));var Redis=require(_0x7b87('0x11'));var authService=require(_0x7b87('0x12'));var qs=require(_0x7b87('0x13'));var as=require(_0x7b87('0x14'));var hardwareService=require(_0x7b87('0x15'));var logger=require(_0x7b87('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7b87('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b87('0x18'))['db'];function respondWithStatusCode(_0x7b58c9,_0x4fe677){_0x4fe677=_0x4fe677||0xcc;return function(_0xfb3e0b){if(_0xfb3e0b){return _0x7b58c9[_0x7b87('0x19')](_0x4fe677);}return _0x7b58c9['status'](_0x4fe677)['end']();};}function respondWithResult(_0x482cd5,_0x8ad44){_0x8ad44=_0x8ad44||0xc8;return function(_0x328624){if(_0x328624){return _0x482cd5[_0x7b87('0x1a')](_0x8ad44)['json'](_0x328624);}};}function respondWithFilteredResult(_0x452bc7,_0x48fc75){return function(_0x567304){if(_0x567304){var _0x18a749=typeof _0x48fc75[_0x7b87('0x1b')]===_0x7b87('0x1c')&&typeof _0x48fc75[_0x7b87('0x1d')]==='undefined';var _0x2fb93a=_0x567304[_0x7b87('0x1e')];var _0x357b4d=_0x18a749?0x0:_0x48fc75['offset'];var _0x41bb6e=_0x18a749?_0x567304['count']:_0x48fc75[_0x7b87('0x1b')]+_0x48fc75['limit'];var _0x36b3d1;if(_0x41bb6e>=_0x2fb93a){_0x41bb6e=_0x2fb93a;_0x36b3d1=0xc8;}else{_0x36b3d1=0xce;}_0x452bc7[_0x7b87('0x1a')](_0x36b3d1);return _0x452bc7[_0x7b87('0x1f')]('Content-Range',_0x357b4d+'-'+_0x41bb6e+'/'+_0x2fb93a)[_0x7b87('0x20')](_0x567304);}return null;};}function patchUpdates(_0x2fd5a4){return function(_0x285ad5){try{jsonpatch[_0x7b87('0x21')](_0x285ad5,_0x2fd5a4,!![]);}catch(_0x70c24f){return BPromise[_0x7b87('0x22')](_0x70c24f);}return _0x285ad5[_0x7b87('0x23')]();};}function saveUpdates(_0x1fe4c6,_0x340234){return function(_0x2ed98f){if(_0x2ed98f){return _0x2ed98f[_0x7b87('0x24')](_0x1fe4c6)[_0x7b87('0x25')](function(_0x3bf326){return _0x3bf326;});}return null;};}function removeEntity(_0x1ead8f,_0x3a0d47){return function(_0x1f8696){if(_0x1f8696){return _0x1f8696['destroy']()[_0x7b87('0x25')](function(){_0x1ead8f[_0x7b87('0x1a')](0xcc)[_0x7b87('0x26')]();});}};}function handleEntityNotFound(_0x4adbd8,_0x4fdb15){return function(_0x5c5fdf){if(!_0x5c5fdf){_0x4adbd8['sendStatus'](0x194);}return _0x5c5fdf;};}function handleError(_0x125431,_0x4c4aea){_0x4c4aea=_0x4c4aea||0x1f4;return function(_0x332e23){logger[_0x7b87('0x27')](_0x332e23['stack']);if(_0x332e23[_0x7b87('0x28')]){delete _0x332e23[_0x7b87('0x28')];}_0x125431[_0x7b87('0x1a')](_0x4c4aea)['send'](_0x332e23);};}exports[_0x7b87('0x29')]=function(_0x348255,_0xefd2b2){var _0x2d9665={},_0x26b056={},_0x237a76={'count':0x0,'rows':[]};var _0x22e481=_[_0x7b87('0x2a')](db[_0x7b87('0x2b')][_0x7b87('0x2c')],function(_0x2ad69c){return{'name':_0x2ad69c['fieldName'],'type':_0x2ad69c[_0x7b87('0x2d')]['key']};});_0x26b056['model']=_[_0x7b87('0x2a')](_0x22e481,_0x7b87('0x28'));_0x26b056[_0x7b87('0x2e')]=_['keys'](_0x348255[_0x7b87('0x2e')]);_0x26b056['filters']=_['intersection'](_0x26b056[_0x7b87('0x2f')],_0x26b056[_0x7b87('0x2e')]);_0x2d9665['attributes']=_[_0x7b87('0x30')](_0x26b056[_0x7b87('0x2f')],qs[_0x7b87('0x31')](_0x348255['query']['fields']));_0x2d9665[_0x7b87('0x32')]=_0x2d9665[_0x7b87('0x32')][_0x7b87('0x33')]?_0x2d9665['attributes']:_0x26b056[_0x7b87('0x2f')];if(!_0x348255[_0x7b87('0x2e')][_0x7b87('0x34')](_0x7b87('0x35'))){_0x2d9665['limit']=qs[_0x7b87('0x1d')](_0x348255[_0x7b87('0x2e')][_0x7b87('0x1d')]);_0x2d9665[_0x7b87('0x1b')]=qs['offset'](_0x348255[_0x7b87('0x2e')][_0x7b87('0x1b')]);}_0x2d9665[_0x7b87('0x36')]=qs[_0x7b87('0x37')](_0x348255[_0x7b87('0x2e')][_0x7b87('0x37')]);_0x2d9665['where']=qs[_0x7b87('0x38')](_[_0x7b87('0x39')](_0x348255[_0x7b87('0x2e')],_0x26b056['filters']),_0x22e481);if(_0x348255['query'][_0x7b87('0x3a')]){_0x2d9665['where']=_[_0x7b87('0x3b')](_0x2d9665['where'],{'$or':_[_0x7b87('0x2a')](_0x22e481,function(_0x19dccb){if(_0x19dccb[_0x7b87('0x2d')]!==_0x7b87('0x3c')){var _0xcc4da9={};_0xcc4da9[_0x19dccb[_0x7b87('0x28')]]={'$like':'%'+_0x348255[_0x7b87('0x2e')]['filter']+'%'};return _0xcc4da9;}})});}_0x2d9665=_['merge']({},_0x2d9665,_0x348255[_0x7b87('0x3d')]);var _0xa1ea43={'where':_0x2d9665['where']};return db[_0x7b87('0x2b')][_0x7b87('0x1e')](_0xa1ea43)[_0x7b87('0x25')](function(_0x255b8d){_0x237a76[_0x7b87('0x1e')]=_0x255b8d;if(_0x348255[_0x7b87('0x2e')]['includeAll']){_0x2d9665[_0x7b87('0x3e')]=[{'all':!![]}];}return db[_0x7b87('0x2b')][_0x7b87('0x3f')](_0x2d9665);})[_0x7b87('0x25')](function(_0x3bcdd2){_0x237a76[_0x7b87('0x40')]=_0x3bcdd2;return _0x237a76;})[_0x7b87('0x25')](respondWithFilteredResult(_0xefd2b2,_0x2d9665))[_0x7b87('0x41')](handleError(_0xefd2b2,null));};exports[_0x7b87('0x42')]=function(_0x23689b,_0x2fb94f){var _0x34a758={'raw':![],'where':{'id':_0x23689b['params']['id']}},_0x23a6cc={};_0x23a6cc[_0x7b87('0x2f')]=_[_0x7b87('0x43')](db[_0x7b87('0x2b')][_0x7b87('0x2c')]);_0x23a6cc['query']=_[_0x7b87('0x43')](_0x23689b[_0x7b87('0x2e')]);_0x23a6cc['filters']=_['intersection'](_0x23a6cc[_0x7b87('0x2f')],_0x23a6cc[_0x7b87('0x2e')]);_0x34a758[_0x7b87('0x32')]=_[_0x7b87('0x30')](_0x23a6cc[_0x7b87('0x2f')],qs[_0x7b87('0x31')](_0x23689b[_0x7b87('0x2e')][_0x7b87('0x31')]));_0x34a758['attributes']=_0x34a758[_0x7b87('0x32')][_0x7b87('0x33')]?_0x34a758[_0x7b87('0x32')]:_0x23a6cc[_0x7b87('0x2f')];if(_0x23689b[_0x7b87('0x2e')]['includeAll']){_0x34a758[_0x7b87('0x3e')]=[{'all':!![]}];}_0x34a758=_[_0x7b87('0x3b')]({},_0x34a758,_0x23689b[_0x7b87('0x3d')]);return db[_0x7b87('0x2b')][_0x7b87('0x44')](_0x34a758)[_0x7b87('0x25')](handleEntityNotFound(_0x2fb94f,null))[_0x7b87('0x25')](respondWithResult(_0x2fb94f,null))[_0x7b87('0x41')](handleError(_0x2fb94f,null));};exports['create']=function(_0x164cf7,_0x2d6787){return db['FreshdeskConfiguration'][_0x7b87('0x45')](_0x164cf7[_0x7b87('0x46')],{})[_0x7b87('0x25')](respondWithResult(_0x2d6787,0xc9))[_0x7b87('0x41')](handleError(_0x2d6787,null));};exports['update']=function(_0x467757,_0xb1699d){if(_0x467757[_0x7b87('0x46')]['id']){delete _0x467757['body']['id'];}return db[_0x7b87('0x2b')][_0x7b87('0x44')]({'where':{'id':_0x467757[_0x7b87('0x47')]['id']}})[_0x7b87('0x25')](handleEntityNotFound(_0xb1699d,null))[_0x7b87('0x25')](saveUpdates(_0x467757['body'],null))['then'](respondWithResult(_0xb1699d,null))[_0x7b87('0x41')](handleError(_0xb1699d,null));};exports[_0x7b87('0x48')]=function(_0x587e40,_0x4e62ab){return db[_0x7b87('0x2b')][_0x7b87('0x44')]({'where':{'id':_0x587e40[_0x7b87('0x47')]['id']}})[_0x7b87('0x25')](handleEntityNotFound(_0x4e62ab,null))[_0x7b87('0x25')](removeEntity(_0x4e62ab,null))[_0x7b87('0x41')](handleError(_0x4e62ab,null));};exports[_0x7b87('0x49')]=function(_0x172fee,_0x4662bf,_0x2cbd6e){var _0x35254c={};var _0x2c3e96={};var _0xdda195;var _0x595a0a;return db[_0x7b87('0x2b')][_0x7b87('0x4a')]({'where':{'id':_0x172fee['params']['id']}})[_0x7b87('0x25')](handleEntityNotFound(_0x4662bf,null))[_0x7b87('0x25')](function(_0x6cf41f){if(_0x6cf41f){_0xdda195=_0x6cf41f;_0x2c3e96[_0x7b87('0x2f')]=_[_0x7b87('0x43')](db[_0x7b87('0x4b')]['rawAttributes']);_0x2c3e96[_0x7b87('0x2e')]=_[_0x7b87('0x43')](_0x172fee[_0x7b87('0x2e')]);_0x2c3e96[_0x7b87('0x38')]=_['intersection'](_0x2c3e96[_0x7b87('0x2f')],_0x2c3e96[_0x7b87('0x2e')]);_0x35254c[_0x7b87('0x32')]=_[_0x7b87('0x30')](_0x2c3e96[_0x7b87('0x2f')],qs['fields'](_0x172fee[_0x7b87('0x2e')][_0x7b87('0x31')]));_0x35254c['attributes']=_0x35254c[_0x7b87('0x32')][_0x7b87('0x33')]?_0x35254c[_0x7b87('0x32')]:_0x2c3e96['model'];_0x35254c['order']=qs['sort'](_0x172fee['query']['sort']);_0x35254c[_0x7b87('0x4c')]=qs[_0x7b87('0x38')](_['pick'](_0x172fee[_0x7b87('0x2e')],_0x2c3e96[_0x7b87('0x38')]));if(_0x172fee[_0x7b87('0x2e')][_0x7b87('0x3a')]){_0x35254c[_0x7b87('0x4c')]=_['merge'](_0x35254c[_0x7b87('0x4c')],{'$or':_[_0x7b87('0x2a')](_0x35254c[_0x7b87('0x32')],function(_0x3fc081){var _0x2cf3e5={};_0x2cf3e5[_0x3fc081]={'$like':'%'+_0x172fee[_0x7b87('0x2e')][_0x7b87('0x3a')]+'%'};return _0x2cf3e5;})});}_0x35254c=_[_0x7b87('0x3b')]({},_0x35254c,_0x172fee[_0x7b87('0x3d')]);return _0xdda195[_0x7b87('0x49')](_0x35254c);}})['then'](function(_0x3c6ff2){if(_0x3c6ff2){_0x595a0a=_0x3c6ff2[_0x7b87('0x33')];if(!_0x172fee[_0x7b87('0x2e')][_0x7b87('0x34')]('nolimit')){_0x35254c[_0x7b87('0x1d')]=qs[_0x7b87('0x1d')](_0x172fee[_0x7b87('0x2e')][_0x7b87('0x1d')]);_0x35254c[_0x7b87('0x1b')]=qs['offset'](_0x172fee[_0x7b87('0x2e')][_0x7b87('0x1b')]);}return _0xdda195[_0x7b87('0x49')](_0x35254c);}})['then'](function(_0x307fb7){if(_0x307fb7){return _0x307fb7?{'count':_0x595a0a,'rows':_0x307fb7}:null;}})[_0x7b87('0x25')](respondWithResult(_0x4662bf,null))['catch'](handleError(_0x4662bf,null));};exports['getSubjects']=function(_0x183683,_0x34c01c,_0x268c1b){var _0x1cc548={};var _0x23da4d={};var _0x1b4180;var _0x2333a3;return db[_0x7b87('0x2b')][_0x7b87('0x4a')]({'where':{'id':_0x183683[_0x7b87('0x47')]['id']}})[_0x7b87('0x25')](handleEntityNotFound(_0x34c01c,null))[_0x7b87('0x25')](function(_0x3c9d48){if(_0x3c9d48){_0x1b4180=_0x3c9d48;_0x23da4d[_0x7b87('0x2f')]=_[_0x7b87('0x43')](db[_0x7b87('0x4b')][_0x7b87('0x2c')]);_0x23da4d[_0x7b87('0x2e')]=_[_0x7b87('0x43')](_0x183683[_0x7b87('0x2e')]);_0x23da4d[_0x7b87('0x38')]=_['intersection'](_0x23da4d['model'],_0x23da4d[_0x7b87('0x2e')]);_0x1cc548[_0x7b87('0x32')]=_[_0x7b87('0x30')](_0x23da4d[_0x7b87('0x2f')],qs[_0x7b87('0x31')](_0x183683[_0x7b87('0x2e')]['fields']));_0x1cc548[_0x7b87('0x32')]=_0x1cc548[_0x7b87('0x32')]['length']?_0x1cc548[_0x7b87('0x32')]:_0x23da4d['model'];_0x1cc548['order']=qs['sort'](_0x183683[_0x7b87('0x2e')][_0x7b87('0x37')]);_0x1cc548[_0x7b87('0x4c')]=qs[_0x7b87('0x38')](_[_0x7b87('0x39')](_0x183683[_0x7b87('0x2e')],_0x23da4d[_0x7b87('0x38')]));if(_0x183683[_0x7b87('0x2e')]['filter']){_0x1cc548[_0x7b87('0x4c')]=_[_0x7b87('0x3b')](_0x1cc548[_0x7b87('0x4c')],{'$or':_[_0x7b87('0x2a')](_0x1cc548[_0x7b87('0x32')],function(_0x485b94){var _0x9ce242={};_0x9ce242[_0x485b94]={'$like':'%'+_0x183683[_0x7b87('0x2e')][_0x7b87('0x3a')]+'%'};return _0x9ce242;})});}_0x1cc548=_[_0x7b87('0x3b')]({},_0x1cc548,_0x183683[_0x7b87('0x3d')]);return _0x1b4180[_0x7b87('0x4d')](_0x1cc548);}})['then'](function(_0x48c47c){if(_0x48c47c){_0x2333a3=_0x48c47c[_0x7b87('0x33')];if(!_0x183683[_0x7b87('0x2e')][_0x7b87('0x34')](_0x7b87('0x35'))){_0x1cc548[_0x7b87('0x1d')]=qs['limit'](_0x183683['query']['limit']);_0x1cc548[_0x7b87('0x1b')]=qs[_0x7b87('0x1b')](_0x183683[_0x7b87('0x2e')][_0x7b87('0x1b')]);}return _0x1b4180[_0x7b87('0x4d')](_0x1cc548);}})[_0x7b87('0x25')](function(_0x174c9b){if(_0x174c9b){return _0x174c9b?{'count':_0x2333a3,'rows':_0x174c9b}:null;}})[_0x7b87('0x25')](respondWithResult(_0x34c01c,null))[_0x7b87('0x41')](handleError(_0x34c01c,null));};exports['getDescriptions']=function(_0x35aa8b,_0x480617,_0x4eab38){var _0x5eea97={};var _0x4729d2={};var _0x23af25;var _0xb77ab8;return db[_0x7b87('0x2b')]['findOne']({'where':{'id':_0x35aa8b[_0x7b87('0x47')]['id']}})['then'](handleEntityNotFound(_0x480617,null))[_0x7b87('0x25')](function(_0x3e5cb4){if(_0x3e5cb4){_0x23af25=_0x3e5cb4;_0x4729d2[_0x7b87('0x2f')]=_[_0x7b87('0x43')](db[_0x7b87('0x4b')][_0x7b87('0x2c')]);_0x4729d2['query']=_['keys'](_0x35aa8b[_0x7b87('0x2e')]);_0x4729d2['filters']=_[_0x7b87('0x30')](_0x4729d2[_0x7b87('0x2f')],_0x4729d2[_0x7b87('0x2e')]);_0x5eea97[_0x7b87('0x32')]=_[_0x7b87('0x30')](_0x4729d2[_0x7b87('0x2f')],qs[_0x7b87('0x31')](_0x35aa8b[_0x7b87('0x2e')][_0x7b87('0x31')]));_0x5eea97[_0x7b87('0x32')]=_0x5eea97[_0x7b87('0x32')]['length']?_0x5eea97[_0x7b87('0x32')]:_0x4729d2[_0x7b87('0x2f')];_0x5eea97[_0x7b87('0x36')]=qs[_0x7b87('0x37')](_0x35aa8b['query'][_0x7b87('0x37')]);_0x5eea97[_0x7b87('0x4c')]=qs[_0x7b87('0x38')](_['pick'](_0x35aa8b[_0x7b87('0x2e')],_0x4729d2['filters']));if(_0x35aa8b[_0x7b87('0x2e')][_0x7b87('0x3a')]){_0x5eea97[_0x7b87('0x4c')]=_[_0x7b87('0x3b')](_0x5eea97['where'],{'$or':_[_0x7b87('0x2a')](_0x5eea97[_0x7b87('0x32')],function(_0x1f448a){var _0x4db658={};_0x4db658[_0x1f448a]={'$like':'%'+_0x35aa8b[_0x7b87('0x2e')][_0x7b87('0x3a')]+'%'};return _0x4db658;})});}_0x5eea97=_[_0x7b87('0x3b')]({},_0x5eea97,_0x35aa8b[_0x7b87('0x3d')]);return _0x23af25['getDescriptions'](_0x5eea97);}})['then'](function(_0xf0622d){if(_0xf0622d){_0xb77ab8=_0xf0622d[_0x7b87('0x33')];if(!_0x35aa8b[_0x7b87('0x2e')][_0x7b87('0x34')](_0x7b87('0x35'))){_0x5eea97[_0x7b87('0x1d')]=qs['limit'](_0x35aa8b['query'][_0x7b87('0x1d')]);_0x5eea97[_0x7b87('0x1b')]=qs['offset'](_0x35aa8b[_0x7b87('0x2e')]['offset']);}return _0x23af25[_0x7b87('0x4e')](_0x5eea97);}})['then'](function(_0xe529de){if(_0xe529de){return _0xe529de?{'count':_0xb77ab8,'rows':_0xe529de}:null;}})[_0x7b87('0x25')](respondWithResult(_0x480617,null))[_0x7b87('0x41')](handleError(_0x480617,null));};exports[_0x7b87('0x4f')]=function(_0x194bb5,_0x1b9d75,_0x58da40){var _0x391a1a={};var _0x5f510a={};var _0x346b48;var _0x37c04a;return db[_0x7b87('0x2b')][_0x7b87('0x4a')]({'where':{'id':_0x194bb5['params']['id']}})['then'](handleEntityNotFound(_0x1b9d75,null))[_0x7b87('0x25')](function(_0x5b7538){if(_0x5b7538){_0x346b48=_0x5b7538;_0x5f510a[_0x7b87('0x2f')]=_[_0x7b87('0x43')](db[_0x7b87('0x50')][_0x7b87('0x2c')]);_0x5f510a['query']=_[_0x7b87('0x43')](_0x194bb5[_0x7b87('0x2e')]);_0x5f510a[_0x7b87('0x38')]=_['intersection'](_0x5f510a[_0x7b87('0x2f')],_0x5f510a[_0x7b87('0x2e')]);_0x391a1a['attributes']=_[_0x7b87('0x30')](_0x5f510a[_0x7b87('0x2f')],qs[_0x7b87('0x31')](_0x194bb5[_0x7b87('0x2e')][_0x7b87('0x31')]));_0x391a1a[_0x7b87('0x32')]=_0x391a1a[_0x7b87('0x32')]['length']?_0x391a1a[_0x7b87('0x32')]:_0x5f510a[_0x7b87('0x2f')];_0x391a1a[_0x7b87('0x36')]=qs[_0x7b87('0x37')](_0x194bb5[_0x7b87('0x2e')][_0x7b87('0x37')]);_0x391a1a[_0x7b87('0x4c')]=qs[_0x7b87('0x38')](_[_0x7b87('0x39')](_0x194bb5['query'],_0x5f510a[_0x7b87('0x38')]));if(_0x194bb5[_0x7b87('0x2e')]['filter']){_0x391a1a['where']=_[_0x7b87('0x3b')](_0x391a1a[_0x7b87('0x4c')],{'$or':_[_0x7b87('0x2a')](_0x391a1a['attributes'],function(_0x15d854){var _0x4bd696={};_0x4bd696[_0x15d854]={'$like':'%'+_0x194bb5[_0x7b87('0x2e')][_0x7b87('0x3a')]+'%'};return _0x4bd696;})});}_0x391a1a=_[_0x7b87('0x3b')]({},_0x391a1a,_0x194bb5[_0x7b87('0x3d')]);return _0x346b48[_0x7b87('0x4f')](_0x391a1a);}})[_0x7b87('0x25')](function(_0x416898){if(_0x416898){_0x37c04a=_0x416898[_0x7b87('0x33')];if(!_0x194bb5[_0x7b87('0x2e')]['hasOwnProperty'](_0x7b87('0x35'))){_0x391a1a[_0x7b87('0x1d')]=qs[_0x7b87('0x1d')](_0x194bb5[_0x7b87('0x2e')]['limit']);_0x391a1a['offset']=qs[_0x7b87('0x1b')](_0x194bb5[_0x7b87('0x2e')][_0x7b87('0x1b')]);}return _0x346b48[_0x7b87('0x4f')](_0x391a1a);}})[_0x7b87('0x25')](function(_0x5eeb6e){if(_0x5eeb6e){return _0x5eeb6e?{'count':_0x37c04a,'rows':_0x5eeb6e}:null;}})[_0x7b87('0x25')](respondWithResult(_0x1b9d75,null))[_0x7b87('0x41')](handleError(_0x1b9d75,null));};exports[_0x7b87('0x51')]=function(_0x4333e5,_0x3ea127,_0x2ff487){if(_0x4333e5[_0x7b87('0x46')]['id']){delete _0x4333e5['body']['id'];}return db[_0x7b87('0x2b')]['findOne']({'where':{'id':_0x4333e5[_0x7b87('0x47')]['id']}})[_0x7b87('0x25')](handleEntityNotFound(_0x3ea127,null))[_0x7b87('0x25')](function(_0x10560a){if(_0x10560a){return _0x10560a['setTags'](_0x4333e5[_0x7b87('0x46')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3ea127,null))[_0x7b87('0x41')](handleError(_0x3ea127,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6377960..79e4c65 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 _0x2d19=['moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x2d19,0xed));var _0x92d1=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x2d19[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var logger=require(_0x92d1('0x1'))(_0x92d1('0x2'));var moment=require(_0x92d1('0x3'));var BPromise=require(_0x92d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92d1('0x5'));var rimraf=require('rimraf');var config=require(_0x92d1('0x6'));var attributes=require(_0x92d1('0x7'));module[_0x92d1('0x8')]=function(_0x1176c3,_0xc889bb){return _0x1176c3[_0x92d1('0x9')](_0x92d1('0xa'),attributes,{'tableName':_0x92d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee3=['int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x4ee3,0x198));var _0x34ee=function(_0x57be5b,_0x5d2e62){_0x57be5b=_0x57be5b-0x0;var _0x5a12df=_0x4ee3[_0x57be5b];return _0x5a12df;};'use strict';var _=require(_0x34ee('0x0'));var util=require('util');var logger=require(_0x34ee('0x1'))(_0x34ee('0x2'));var moment=require('moment');var BPromise=require(_0x34ee('0x3'));var rp=require(_0x34ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34ee('0x5'));var config=require(_0x34ee('0x6'));var attributes=require(_0x34ee('0x7'));module[_0x34ee('0x8')]=function(_0x174ee4,_0x3f9929){return _0x174ee4[_0x34ee('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x34ee('0xa'),'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 b4b4b0f..5db86bf 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 _0xf253=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x493414,_0x44b9fd){var _0x1ec60a=function(_0x58215b){while(--_0x58215b){_0x493414['push'](_0x493414['shift']());}};_0x1ec60a(++_0x44b9fd);}(_0xf253,0xca));var _0x3f25=function(_0x4c0d77,_0xa04a6a){_0x4c0d77=_0x4c0d77-0x0;var _0xb37e0c=_0xf253[_0x4c0d77];return _0xb37e0c;};'use strict';var _=require('lodash');var util=require(_0x3f25('0x0'));var moment=require(_0x3f25('0x1'));var BPromise=require(_0x3f25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f25('0x3'));var db=require(_0x3f25('0x4'))['db'];var utils=require(_0x3f25('0x5'));var logger=require(_0x3f25('0x6'))(_0x3f25('0x7'));var config=require(_0x3f25('0x8'));var jayson=require(_0x3f25('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd17774,_0x11e976,_0x3e8e14){return new BPromise(function(_0x373373,_0x52d0aa){return client[_0x3f25('0xa')](_0xd17774,_0x3e8e14)['then'](function(_0x418457){logger['info'](_0x3f25('0xb'),_0x11e976,_0x3f25('0xc'));logger[_0x3f25('0xd')](_0x3f25('0xe'),_0x11e976,_0x3f25('0xc'),JSON[_0x3f25('0xf')](_0x418457));if(_0x418457[_0x3f25('0x10')]){if(_0x418457['error'][_0x3f25('0x11')]===0x1f4){logger[_0x3f25('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e976,_0x418457['error'][_0x3f25('0x12')]);return _0x52d0aa(_0x418457[_0x3f25('0x10')][_0x3f25('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x11e976,_0x418457[_0x3f25('0x10')]['message']);return _0x373373(_0x418457['error'][_0x3f25('0x12')]);}else{logger[_0x3f25('0x13')](_0x3f25('0xb'),_0x11e976,'request\x20sent');_0x373373(_0x418457[_0x3f25('0x14')]['message']);}})[_0x3f25('0x15')](function(_0x3c8997){logger[_0x3f25('0x10')](_0x3f25('0xb'),_0x11e976,_0x3c8997);_0x52d0aa(_0x3c8997);});});} \ No newline at end of file +var _0xa35d=['client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x64c4e,_0x493d08){var _0x5df5d3=function(_0x523897){while(--_0x523897){_0x64c4e['push'](_0x64c4e['shift']());}};_0x5df5d3(++_0x493d08);}(_0xa35d,0x175));var _0xda35=function(_0x57d209,_0x37dc1a){_0x57d209=_0x57d209-0x0;var _0x182ced=_0xa35d[_0x57d209];return _0x182ced;};'use strict';var _=require(_0xda35('0x0'));var util=require(_0xda35('0x1'));var moment=require(_0xda35('0x2'));var BPromise=require(_0xda35('0x3'));var rs=require(_0xda35('0x4'));var fs=require('fs');var Redis=require(_0xda35('0x5'));var db=require(_0xda35('0x6'))['db'];var utils=require(_0xda35('0x7'));var logger=require(_0xda35('0x8'))(_0xda35('0x9'));var config=require('../../config/environment');var jayson=require(_0xda35('0xa'));var client=jayson[_0xda35('0xb')][_0xda35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d4960,_0x229907,_0x175e13){return new BPromise(function(_0x345391,_0x254958){return client[_0xda35('0xd')](_0x5d4960,_0x175e13)[_0xda35('0xe')](function(_0x15c2a3){logger[_0xda35('0xf')](_0xda35('0x10'),_0x229907,_0xda35('0x11'));logger[_0xda35('0x12')](_0xda35('0x13'),_0x229907,_0xda35('0x11'),JSON[_0xda35('0x14')](_0x15c2a3));if(_0x15c2a3['error']){if(_0x15c2a3[_0xda35('0x15')]['code']===0x1f4){logger[_0xda35('0x15')](_0xda35('0x10'),_0x229907,_0x15c2a3['error'][_0xda35('0x16')]);return _0x254958(_0x15c2a3[_0xda35('0x15')][_0xda35('0x16')]);}logger[_0xda35('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x229907,_0x15c2a3[_0xda35('0x15')][_0xda35('0x16')]);return _0x345391(_0x15c2a3[_0xda35('0x15')][_0xda35('0x16')]);}else{logger[_0xda35('0xf')](_0xda35('0x10'),_0x229907,'request\x20sent');_0x345391(_0x15c2a3[_0xda35('0x17')][_0xda35('0x16')]);}})['catch'](function(_0x56a17a){logger[_0xda35('0x15')](_0xda35('0x10'),_0x229907,_0x56a17a);_0x254958(_0x56a17a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 57cbb05..c3f8d1d 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 _0xbb34=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util'];(function(_0x1e280d,_0x21a932){var _0x3abb95=function(_0x11b104){while(--_0x11b104){_0x1e280d['push'](_0x1e280d['shift']());}};_0x3abb95(++_0x21a932);}(_0xbb34,0x11b));var _0x4bb3=function(_0x1e55d9,_0x5ce14a){_0x1e55d9=_0x1e55d9-0x0;var _0x6dc799=_0xbb34[_0x1e55d9];return _0x6dc799;};'use strict';var multer=require(_0x4bb3('0x0'));var util=require(_0x4bb3('0x1'));var path=require(_0x4bb3('0x2'));var timeout=require(_0x4bb3('0x3'));var express=require(_0x4bb3('0x4'));var router=express['Router']();var fs_extra=require(_0x4bb3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4bb3('0x6'));var config=require(_0x4bb3('0x7'));var controller=require(_0x4bb3('0x8'));router[_0x4bb3('0x9')]('/',auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xb')]);router['get'](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xd')]);router[_0x4bb3('0xe')]('/',auth[_0x4bb3('0xa')](),controller['create']);router['put'](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0xf')]);router[_0x4bb3('0x10')](_0x4bb3('0xc'),auth[_0x4bb3('0xa')](),controller[_0x4bb3('0x11')]);module[_0x4bb3('0x12')]=router; \ No newline at end of file +var _0x3276=['show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated'];(function(_0x9906ff,_0x471c43){var _0x143a16=function(_0x261d87){while(--_0x261d87){_0x9906ff['push'](_0x9906ff['shift']());}};_0x143a16(++_0x471c43);}(_0x3276,0xa7));var _0x6327=function(_0x178028,_0x3df707){_0x178028=_0x178028-0x0;var _0xcaead5=_0x3276[_0x178028];return _0xcaead5;};'use strict';var multer=require(_0x6327('0x0'));var util=require(_0x6327('0x1'));var path=require(_0x6327('0x2'));var timeout=require(_0x6327('0x3'));var express=require(_0x6327('0x4'));var router=express[_0x6327('0x5')]();var fs_extra=require(_0x6327('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6327('0x7'));var controller=require(_0x6327('0x8'));router[_0x6327('0x9')]('/',auth['isAuthenticated'](),controller[_0x6327('0xa')]);router['get'](_0x6327('0xb'),auth[_0x6327('0xc')](),controller[_0x6327('0xd')]);router['post']('/',auth[_0x6327('0xc')](),controller[_0x6327('0xe')]);router[_0x6327('0xf')](_0x6327('0xb'),auth[_0x6327('0xc')](),controller[_0x6327('0x10')]);router[_0x6327('0x11')](_0x6327('0xb'),auth[_0x6327('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index b5181e3..61d2a83 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 _0xe45f=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x350218,_0x553cee){var _0x29a58d=function(_0x190f54){while(--_0x190f54){_0x350218['push'](_0x350218['shift']());}};_0x29a58d(++_0x553cee);}(_0xe45f,0xda));var _0xfe45=function(_0x58025c,_0xb0060f){_0x58025c=_0x58025c-0x0;var _0x4ae559=_0xe45f[_0x58025c];return _0x4ae559;};'use strict';var Sequelize=require(_0xfe45('0x0'));module[_0xfe45('0x1')]={'type':{'type':Sequelize[_0xfe45('0x2')](_0xfe45('0x3'),_0xfe45('0x4'),'customVariable',_0xfe45('0x5'),'picklist'),'defaultValue':_0xfe45('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfe45('0x6')]},'keyType':{'type':Sequelize[_0xfe45('0x2')]('string','variable',_0xfe45('0x7'))},'keyContent':{'type':Sequelize[_0xfe45('0x6')]},'idField':{'type':Sequelize[_0xfe45('0x6')]},'nameField':{'type':Sequelize[_0xfe45('0x6')]},'customField':{'type':Sequelize[_0xfe45('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe45('0x6')]}}; \ No newline at end of file +var _0xfda1=['string','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x26cc2c,_0x5e3be4){var _0x3e009f=function(_0x2b6358){while(--_0x2b6358){_0x26cc2c['push'](_0x26cc2c['shift']());}};_0x3e009f(++_0x5e3be4);}(_0xfda1,0x9d));var _0x1fda=function(_0x447ce1,_0x11cf0b){_0x447ce1=_0x447ce1-0x0;var _0x4c1e7a=_0xfda1[_0x447ce1];return _0x4c1e7a;};'use strict';var Sequelize=require(_0x1fda('0x0'));module[_0x1fda('0x1')]={'type':{'type':Sequelize[_0x1fda('0x2')](_0x1fda('0x3'),'variable','customVariable',_0x1fda('0x4'),_0x1fda('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1fda('0x6')]},'key':{'type':Sequelize[_0x1fda('0x6')]},'keyType':{'type':Sequelize[_0x1fda('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1fda('0x6')]},'idField':{'type':Sequelize[_0x1fda('0x6')]},'nameField':{'type':Sequelize[_0x1fda('0x6')]},'customField':{'type':Sequelize[_0x1fda('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c1d9418..e766575 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 _0xc901=['save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','eml-format','moment','bluebird','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/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x23a9af,_0x2bc11c){var _0x11d0eb=function(_0x46f889){while(--_0x46f889){_0x23a9af['push'](_0x23a9af['shift']());}};_0x11d0eb(++_0x2bc11c);}(_0xc901,0x142));var _0x1c90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc901[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={},_0x35c843={},_0x52c308={'count':0x0,'rows':[]};var _0xc1a571=_[_0x1c90('0x2a')](db[_0x1c90('0x2b')][_0x1c90('0x2c')],function(_0x1979de){return{'name':_0x1979de[_0x1c90('0x2d')],'type':_0x1979de[_0x1c90('0x2e')][_0x1c90('0x2f')]};});_0x35c843[_0x1c90('0x30')]=_[_0x1c90('0x2a')](_0xc1a571,_0x1c90('0x27'));_0x35c843['query']=_[_0x1c90('0x31')](_0x395edb[_0x1c90('0x32')]);_0x35c843['filters']=_[_0x1c90('0x33')](_0x35c843['model'],_0x35c843[_0x1c90('0x32')]);_0xd0a607['attributes']=_[_0x1c90('0x33')](_0x35c843['model'],qs[_0x1c90('0x34')](_0x395edb[_0x1c90('0x32')]['fields']));_0xd0a607[_0x1c90('0x35')]=_0xd0a607[_0x1c90('0x35')]['length']?_0xd0a607[_0x1c90('0x35')]:_0x35c843[_0x1c90('0x30')];if(!_0x395edb[_0x1c90('0x32')][_0x1c90('0x36')](_0x1c90('0x37'))){_0xd0a607['limit']=qs['limit'](_0x395edb['query']['limit']);_0xd0a607['offset']=qs[_0x1c90('0x1a')](_0x395edb[_0x1c90('0x32')][_0x1c90('0x1a')]);}_0xd0a607['order']=qs[_0x1c90('0x38')](_0x395edb['query'][_0x1c90('0x38')]);_0xd0a607[_0x1c90('0x39')]=qs['filters'](_['pick'](_0x395edb[_0x1c90('0x32')],_0x35c843[_0x1c90('0x3a')]),_0xc1a571);if(_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]){_0xd0a607[_0x1c90('0x39')]=_[_0x1c90('0x3c')](_0xd0a607[_0x1c90('0x39')],{'$or':_['map'](_0xc1a571,function(_0x508025){if(_0x508025[_0x1c90('0x2e')]!==_0x1c90('0x3d')){var _0x134501={};_0x134501[_0x508025[_0x1c90('0x27')]]={'$like':'%'+_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]+'%'};return _0x134501;}})});}_0xd0a607=_[_0x1c90('0x3c')]({},_0xd0a607,_0x395edb[_0x1c90('0x3e')]);var _0x398ee9={'where':_0xd0a607[_0x1c90('0x39')]};return db['FreshdeskField'][_0x1c90('0x1d')](_0x398ee9)['then'](function(_0x5a8eea){_0x52c308[_0x1c90('0x1d')]=_0x5a8eea;if(_0x395edb['query']['includeAll']){_0xd0a607[_0x1c90('0x3f')]=[{'all':!![]}];}return db[_0x1c90('0x2b')]['findAll'](_0xd0a607);})[_0x1c90('0x24')](function(_0x3271ea){_0x52c308[_0x1c90('0x40')]=_0x3271ea;return _0x52c308;})[_0x1c90('0x24')](respondWithFilteredResult(_0x111e20,_0xd0a607))['catch'](handleError(_0x111e20,null));};exports['show']=function(_0x19e689,_0x171ca0){var _0x5680fe={'raw':!![],'where':{'id':_0x19e689['params']['id']}},_0x35952a={};_0x35952a[_0x1c90('0x30')]=_[_0x1c90('0x31')](db['FreshdeskField'][_0x1c90('0x2c')]);_0x35952a[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x19e689[_0x1c90('0x32')]);_0x35952a[_0x1c90('0x3a')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],_0x35952a[_0x1c90('0x32')]);_0x5680fe[_0x1c90('0x35')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],qs['fields'](_0x19e689[_0x1c90('0x32')]['fields']));_0x5680fe[_0x1c90('0x35')]=_0x5680fe['attributes']['length']?_0x5680fe[_0x1c90('0x35')]:_0x35952a[_0x1c90('0x30')];if(_0x19e689[_0x1c90('0x32')][_0x1c90('0x41')]){_0x5680fe[_0x1c90('0x3f')]=[{'all':!![]}];}_0x5680fe=_[_0x1c90('0x3c')]({},_0x5680fe,_0x19e689[_0x1c90('0x3e')]);return db[_0x1c90('0x2b')][_0x1c90('0x42')](_0x5680fe)['then'](handleEntityNotFound(_0x171ca0,null))['then'](respondWithResult(_0x171ca0,null))[_0x1c90('0x43')](handleError(_0x171ca0,null));};exports[_0x1c90('0x44')]=function(_0x68fac8,_0x2d30f5){return db[_0x1c90('0x2b')][_0x1c90('0x44')](_0x68fac8[_0x1c90('0x45')],{})[_0x1c90('0x24')](respondWithResult(_0x2d30f5,0xc9))['catch'](handleError(_0x2d30f5,null));};exports[_0x1c90('0x22')]=function(_0x24016a,_0x9524b6){if(_0x24016a['body']['id']){delete _0x24016a['body']['id'];}return db[_0x1c90('0x2b')]['find']({'where':{'id':_0x24016a[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x9524b6,null))['then'](saveUpdates(_0x24016a[_0x1c90('0x45')],null))[_0x1c90('0x24')](respondWithResult(_0x9524b6,null))['catch'](handleError(_0x9524b6,null));};exports['destroy']=function(_0x394177,_0x53f158){return db[_0x1c90('0x2b')][_0x1c90('0x42')]({'where':{'id':_0x394177[_0x1c90('0x46')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x53f158,null))['then'](removeEntity(_0x53f158,null))['catch'](handleError(_0x53f158,null));}; \ No newline at end of file +var _0x9d9b=['reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply'];(function(_0x34c763,_0x317a0d){var _0x111719=function(_0x58ec02){while(--_0x58ec02){_0x34c763['push'](_0x34c763['shift']());}};_0x111719(++_0x317a0d);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x120f67,_0x3728e5){_0x120f67=_0x120f67-0x0;var _0x24c26b=_0x9d9b[_0x120f67];return _0x24c26b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={},_0x39f006={},_0x3e79ef={'count':0x0,'rows':[]};var _0xdf519a=_[_0xb9d9('0x27')](db[_0xb9d9('0x28')][_0xb9d9('0x29')],function(_0x5dbb27){return{'name':_0x5dbb27[_0xb9d9('0x2a')],'type':_0x5dbb27[_0xb9d9('0x2b')][_0xb9d9('0x2c')]};});_0x39f006[_0xb9d9('0x2d')]=_['map'](_0xdf519a,_0xb9d9('0x24'));_0x39f006[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x402968[_0xb9d9('0x2e')]);_0x39f006[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0x39f006['model'],_0x39f006['query']);_0x5c74eb[_0xb9d9('0x32')]=_['intersection'](_0x39f006[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x402968[_0xb9d9('0x2e')]['fields']));_0x5c74eb[_0xb9d9('0x32')]=_0x5c74eb[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x5c74eb[_0xb9d9('0x32')]:_0x39f006[_0xb9d9('0x2d')];if(!_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x35')](_0xb9d9('0x36'))){_0x5c74eb[_0xb9d9('0x1a')]=qs['limit'](_0x402968['query']['limit']);_0x5c74eb[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x18')]);}_0x5c74eb[_0xb9d9('0x37')]=qs[_0xb9d9('0x38')](_0x402968['query']['sort']);_0x5c74eb['where']=qs[_0xb9d9('0x30')](_[_0xb9d9('0x39')](_0x402968[_0xb9d9('0x2e')],_0x39f006[_0xb9d9('0x30')]),_0xdf519a);if(_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]){_0x5c74eb[_0xb9d9('0x3b')]=_[_0xb9d9('0x3c')](_0x5c74eb[_0xb9d9('0x3b')],{'$or':_[_0xb9d9('0x27')](_0xdf519a,function(_0xd8b9a2){if(_0xd8b9a2[_0xb9d9('0x2b')]!==_0xb9d9('0x3d')){var _0x46d9a7={};_0x46d9a7[_0xd8b9a2[_0xb9d9('0x24')]]={'$like':'%'+_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]+'%'};return _0x46d9a7;}})});}_0x5c74eb=_[_0xb9d9('0x3c')]({},_0x5c74eb,_0x402968[_0xb9d9('0x3e')]);var _0x4d3cea={'where':_0x5c74eb[_0xb9d9('0x3b')]};return db[_0xb9d9('0x28')]['count'](_0x4d3cea)['then'](function(_0x41cf93){_0x3e79ef['count']=_0x41cf93;if(_0x402968[_0xb9d9('0x2e')]['includeAll']){_0x5c74eb['include']=[{'all':!![]}];}return db[_0xb9d9('0x28')][_0xb9d9('0x3f')](_0x5c74eb);})[_0xb9d9('0x21')](function(_0x2acfe8){_0x3e79ef[_0xb9d9('0x40')]=_0x2acfe8;return _0x3e79ef;})[_0xb9d9('0x21')](respondWithFilteredResult(_0x89f901,_0x5c74eb))[_0xb9d9('0x41')](handleError(_0x89f901,null));};exports[_0xb9d9('0x42')]=function(_0x596cd8,_0x55007a){var _0x3f4b76={'raw':!![],'where':{'id':_0x596cd8[_0xb9d9('0x43')]['id']}},_0xb7c4ec={};_0xb7c4ec['model']=_[_0xb9d9('0x2f')](db[_0xb9d9('0x28')][_0xb9d9('0x29')]);_0xb7c4ec[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x596cd8[_0xb9d9('0x2e')]);_0xb7c4ec[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0xb7c4ec['model'],_0xb7c4ec[_0xb9d9('0x2e')]);_0x3f4b76[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0xb7c4ec[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x33')]));_0x3f4b76[_0xb9d9('0x32')]=_0x3f4b76[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x3f4b76[_0xb9d9('0x32')]:_0xb7c4ec[_0xb9d9('0x2d')];if(_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x44')]){_0x3f4b76[_0xb9d9('0x45')]=[{'all':!![]}];}_0x3f4b76=_[_0xb9d9('0x3c')]({},_0x3f4b76,_0x596cd8[_0xb9d9('0x3e')]);return db['FreshdeskField'][_0xb9d9('0x46')](_0x3f4b76)[_0xb9d9('0x21')](handleEntityNotFound(_0x55007a,null))['then'](respondWithResult(_0x55007a,null))[_0xb9d9('0x41')](handleError(_0x55007a,null));};exports[_0xb9d9('0x47')]=function(_0x1a4922,_0xa6ce10){return db[_0xb9d9('0x28')][_0xb9d9('0x47')](_0x1a4922['body'],{})[_0xb9d9('0x21')](respondWithResult(_0xa6ce10,0xc9))[_0xb9d9('0x41')](handleError(_0xa6ce10,null));};exports[_0xb9d9('0x20')]=function(_0x30e3b1,_0x53f7cb){if(_0x30e3b1[_0xb9d9('0x48')]['id']){delete _0x30e3b1[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x28')]['find']({'where':{'id':_0x30e3b1[_0xb9d9('0x43')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x21')](saveUpdates(_0x30e3b1[_0xb9d9('0x48')],null))[_0xb9d9('0x21')](respondWithResult(_0x53f7cb,null))[_0xb9d9('0x41')](handleError(_0x53f7cb,null));};exports['destroy']=function(_0xd417b9,_0x5cf9a0){return db[_0xb9d9('0x28')][_0xb9d9('0x46')]({'where':{'id':_0xd417b9['params']['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x5cf9a0,null))['then'](removeEntity(_0x5cf9a0,null))['catch'](handleError(_0x5cf9a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1f98597..67f4102 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 _0x7079=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','api','moment','request-promise','path','rimraf','./intFreshdeskField.attributes'];(function(_0x36a8dd,_0x18263b){var _0x306e43=function(_0xe899c0){while(--_0xe899c0){_0x36a8dd['push'](_0x36a8dd['shift']());}};_0x306e43(++_0x18263b);}(_0x7079,0x68));var _0x9707=function(_0x483733,_0x5b2261){_0x483733=_0x483733-0x0;var _0x323ea7=_0x7079[_0x483733];return _0x323ea7;};'use strict';var _=require(_0x9707('0x0'));var util=require(_0x9707('0x1'));var logger=require('../../config/logger')(_0x9707('0x2'));var moment=require(_0x9707('0x3'));var BPromise=require('bluebird');var rp=require(_0x9707('0x4'));var fs=require('fs');var path=require(_0x9707('0x5'));var rimraf=require(_0x9707('0x6'));var config=require('../../config/environment');var attributes=require(_0x9707('0x7'));module[_0x9707('0x8')]=function(_0x4dcb1b,_0x2c7b04){return _0x4dcb1b[_0x9707('0x9')](_0x9707('0xa'),attributes,{'tableName':_0x9707('0xb'),'paranoid':![],'indexes':[{'name':_0x9707('0xc'),'fields':[_0x9707('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfd2=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','lodash'];(function(_0x4b0a54,_0x292955){var _0x1aa5be=function(_0x2d9ee9){while(--_0x2d9ee9){_0x4b0a54['push'](_0x4b0a54['shift']());}};_0x1aa5be(++_0x292955);}(_0xcfd2,0xe9));var _0x2cfd=function(_0x306da8,_0x469206){_0x306da8=_0x306da8-0x0;var _0x14a94b=_0xcfd2[_0x306da8];return _0x14a94b;};'use strict';var _=require(_0x2cfd('0x0'));var util=require(_0x2cfd('0x1'));var logger=require(_0x2cfd('0x2'))(_0x2cfd('0x3'));var moment=require(_0x2cfd('0x4'));var BPromise=require(_0x2cfd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfd('0x6'));var rimraf=require(_0x2cfd('0x7'));var config=require(_0x2cfd('0x8'));var attributes=require(_0x2cfd('0x9'));module['exports']=function(_0x3c901c,_0x2e9553){return _0x3c901c['define'](_0x2cfd('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2cfd('0xb'),'fields':[_0x2cfd('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 a568854..ffbc506 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 _0xe906=['message','FreshdeskField,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe906,0x1e8));var _0x6e90=function(_0x2b8a8f,_0x4ae23c){_0x2b8a8f=_0x2b8a8f-0x0;var _0x224073=_0xe906[_0x2b8a8f];return _0x224073;};'use strict';var _=require('lodash');var util=require(_0x6e90('0x0'));var moment=require(_0x6e90('0x1'));var BPromise=require(_0x6e90('0x2'));var rs=require(_0x6e90('0x3'));var fs=require('fs');var Redis=require(_0x6e90('0x4'));var db=require(_0x6e90('0x5'))['db'];var utils=require(_0x6e90('0x6'));var logger=require(_0x6e90('0x7'))(_0x6e90('0x8'));var config=require(_0x6e90('0x9'));var jayson=require(_0x6e90('0xa'));var client=jayson[_0x6e90('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c63ca,_0xaabd13,_0x2bee35){return new BPromise(function(_0x2d9ecd,_0x20837d){return client['request'](_0x5c63ca,_0x2bee35)[_0x6e90('0xc')](function(_0x3ae388){logger['info']('FreshdeskField,\x20%s,\x20%s',_0xaabd13,_0x6e90('0xd'));logger[_0x6e90('0xe')](_0x6e90('0xf'),_0xaabd13,_0x6e90('0xd'),JSON['stringify'](_0x3ae388));if(_0x3ae388['error']){if(_0x3ae388[_0x6e90('0x10')][_0x6e90('0x11')]===0x1f4){logger[_0x6e90('0x10')]('FreshdeskField,\x20%s,\x20%s',_0xaabd13,_0x3ae388[_0x6e90('0x10')][_0x6e90('0x12')]);return _0x20837d(_0x3ae388[_0x6e90('0x10')]['message']);}logger['error'](_0x6e90('0x13'),_0xaabd13,_0x3ae388['error'][_0x6e90('0x12')]);return _0x2d9ecd(_0x3ae388[_0x6e90('0x10')][_0x6e90('0x12')]);}else{logger[_0x6e90('0x14')](_0x6e90('0x13'),_0xaabd13,_0x6e90('0xd'));_0x2d9ecd(_0x3ae388[_0x6e90('0x15')]['message']);}})[_0x6e90('0x16')](function(_0xa12cce){logger[_0x6e90('0x10')](_0x6e90('0x13'),_0xaabd13,_0xa12cce);_0x20837d(_0xa12cce);});});} \ No newline at end of file +var _0xcd9e=['error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ec924,_0x1fde7b){var _0xbb930e=function(_0x16cb8f){while(--_0x16cb8f){_0x5ec924['push'](_0x5ec924['shift']());}};_0xbb930e(++_0x1fde7b);}(_0xcd9e,0xdc));var _0xecd9=function(_0x71e727,_0x4fcc51){_0x71e727=_0x71e727-0x0;var _0x7c45c7=_0xcd9e[_0x71e727];return _0x7c45c7;};'use strict';var _=require(_0xecd9('0x0'));var util=require(_0xecd9('0x1'));var moment=require(_0xecd9('0x2'));var BPromise=require(_0xecd9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecd9('0x4'))['db'];var utils=require(_0xecd9('0x5'));var logger=require(_0xecd9('0x6'))(_0xecd9('0x7'));var config=require(_0xecd9('0x8'));var jayson=require(_0xecd9('0x9'));var client=jayson[_0xecd9('0xa')][_0xecd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f313c,_0x461cee,_0x54b7e7){return new BPromise(function(_0x439be2,_0x1cc036){return client[_0xecd9('0xc')](_0x5f313c,_0x54b7e7)[_0xecd9('0xd')](function(_0x442007){logger[_0xecd9('0xe')](_0xecd9('0xf'),_0x461cee,_0xecd9('0x10'));logger[_0xecd9('0x11')](_0xecd9('0x12'),_0x461cee,_0xecd9('0x10'),JSON[_0xecd9('0x13')](_0x442007));if(_0x442007[_0xecd9('0x14')]){if(_0x442007[_0xecd9('0x14')]['code']===0x1f4){logger[_0xecd9('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x461cee,_0x442007[_0xecd9('0x14')][_0xecd9('0x15')]);return _0x1cc036(_0x442007[_0xecd9('0x14')][_0xecd9('0x15')]);}logger['error'](_0xecd9('0xf'),_0x461cee,_0x442007['error'][_0xecd9('0x15')]);return _0x439be2(_0x442007['error'][_0xecd9('0x15')]);}else{logger[_0xecd9('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x461cee,'request\x20sent');_0x439be2(_0x442007[_0xecd9('0x16')]['message']);}})[_0xecd9('0x17')](function(_0x86830e){logger['error'](_0xecd9('0xf'),_0x461cee,_0x86830e);_0x1cc036(_0x86830e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b79c90e..cdad8ed 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 _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x2e127a,_0xe316bf){var _0x2aa888=function(_0x19ec38){while(--_0x19ec38){_0x2e127a['push'](_0x2e127a['shift']());}};_0x2aa888(++_0xe316bf);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0bb5=['./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x313907,_0x2876a6){var _0x2aaae5=function(_0x2223d5){while(--_0x2223d5){_0x313907['push'](_0x313907['shift']());}};_0x2aaae5(++_0x2876a6);}(_0x0bb5,0x148));var _0x50bb=function(_0x5690f8,_0x4b0e1f){_0x5690f8=_0x5690f8-0x0;var _0x5251cf=_0x0bb5[_0x5690f8];return _0x5251cf;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/configurations',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x10')](_0x50bb('0x12'),auth[_0x50bb('0xb')](),controller['addConfiguration']);router[_0x50bb('0x13')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);module[_0x50bb('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 8ee07b5..0319c77 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 _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x296cff,_0x16d1e8){var _0x51c99e=function(_0x33b914){while(--_0x33b914){_0x296cff['push'](_0x296cff['shift']());}};_0x51c99e(++_0x16d1e8);}(_0x0120,0x6f));var _0x0012=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0120[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1893=['STRING','username','remoteUri'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x1893,0xa2));var _0x3189=function(_0x45a85e,_0x292dd7){_0x45a85e=_0x45a85e-0x0;var _0x4c85b7=_0x1893[_0x45a85e];return _0x4c85b7;};'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')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3278a88..41cc00f 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 _0x12c2=['test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','set','json','apply','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','merge','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found'];(function(_0x3f2621,_0x569366){var _0x43018c=function(_0x441a01){while(--_0x441a01){_0x3f2621['push'](_0x3f2621['shift']());}};_0x43018c(++_0x569366);}(_0x12c2,0xc7));var _0x212c=function(_0x138ad5,_0x3bb524){_0x138ad5=_0x138ad5-0x0;var _0x22a464=_0x12c2[_0x138ad5];return _0x22a464;};'use strict';var emlformat=require(_0x212c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x212c('0x1'));var jsonpatch=require(_0x212c('0x2'));var rp=require(_0x212c('0x3'));var moment=require(_0x212c('0x4'));var BPromise=require(_0x212c('0x5'));var Mustache=require(_0x212c('0x6'));var util=require(_0x212c('0x7'));var path=require('path');var sox=require(_0x212c('0x8'));var csv=require('to-csv');var ejs=require(_0x212c('0x9'));var fs=require('fs');var fs_extra=require(_0x212c('0xa'));var _=require(_0x212c('0xb'));var squel=require(_0x212c('0xc'));var crypto=require(_0x212c('0xd'));var jsforce=require(_0x212c('0xe'));var deskjs=require(_0x212c('0xf'));var toCsv=require(_0x212c('0x10'));var querystring=require(_0x212c('0x11'));var Papa=require(_0x212c('0x12'));var Redis=require(_0x212c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x212c('0x14'));var as=require(_0x212c('0x15'));var hardwareService=require(_0x212c('0x16'));var logger=require(_0x212c('0x17'))(_0x212c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x212c('0x19'));var db=require(_0x212c('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4385ec,_0x4bde0e){_0x4bde0e=_0x4bde0e||0xcc;return function(_0x35dd51){if(_0x35dd51){return _0x4385ec[_0x212c('0x1b')](_0x4bde0e);}return _0x4385ec[_0x212c('0x1c')](_0x4bde0e)[_0x212c('0x1d')]();};}function respondWithResult(_0x5a3874,_0x514e93){_0x514e93=_0x514e93||0xc8;return function(_0x576e78){if(_0x576e78){return _0x5a3874['status'](_0x514e93)['json'](_0x576e78);}};}function respondWithFilteredResult(_0x52439f,_0x202c69){return function(_0xc56e70){if(_0xc56e70){var _0x4fc369=typeof _0x202c69['offset']==='undefined'&&typeof _0x202c69['limit']==='undefined';var _0x10bea2=_0xc56e70[_0x212c('0x1e')];var _0x421249=_0x4fc369?0x0:_0x202c69['offset'];var _0x177596=_0x4fc369?_0xc56e70[_0x212c('0x1e')]:_0x202c69['offset']+_0x202c69[_0x212c('0x1f')];var _0x47de3d;if(_0x177596>=_0x10bea2){_0x177596=_0x10bea2;_0x47de3d=0xc8;}else{_0x47de3d=0xce;}_0x52439f[_0x212c('0x1c')](_0x47de3d);return _0x52439f[_0x212c('0x20')]('Content-Range',_0x421249+'-'+_0x177596+'/'+_0x10bea2)[_0x212c('0x21')](_0xc56e70);}return null;};}function patchUpdates(_0x13af30){return function(_0x56fd3c){try{jsonpatch[_0x212c('0x22')](_0x56fd3c,_0x13af30,!![]);}catch(_0x32fe7c){return BPromise['reject'](_0x32fe7c);}return _0x56fd3c['save']();};}function saveUpdates(_0x163278,_0x3def08){return function(_0x1704a9){if(_0x1704a9){return _0x1704a9['update'](_0x163278)[_0x212c('0x23')](function(_0x20a396){return _0x20a396;});}return null;};}function removeEntity(_0x3bbc42,_0x4ddcd8){return function(_0x5efebd){if(_0x5efebd){return _0x5efebd[_0x212c('0x24')]()[_0x212c('0x23')](function(){_0x3bbc42['status'](0xcc)[_0x212c('0x1d')]();});}};}function handleEntityNotFound(_0x5bf964,_0x3ba462){return function(_0x45d7a3){if(!_0x45d7a3){_0x5bf964[_0x212c('0x1b')](0x194);}return _0x45d7a3;};}function handleError(_0xc7c7ea,_0x22817b){_0x22817b=_0x22817b||0x1f4;return function(_0x40159f){logger[_0x212c('0x25')](_0x40159f[_0x212c('0x26')]);if(_0x40159f[_0x212c('0x27')]){delete _0x40159f[_0x212c('0x27')];}_0xc7c7ea[_0x212c('0x1c')](_0x22817b)[_0x212c('0x28')](_0x40159f);};}exports[_0x212c('0x29')]=function(_0x3d80e9,_0x14dd87){var _0x5dbbdb={},_0x10c25e={},_0x4bc01c={'count':0x0,'rows':[]};var _0x18dd86=_[_0x212c('0x2a')](db[_0x212c('0x2b')][_0x212c('0x2c')],function(_0x3afdc2){return{'name':_0x3afdc2[_0x212c('0x2d')],'type':_0x3afdc2['type']['key']};});_0x10c25e[_0x212c('0x2e')]=_[_0x212c('0x2a')](_0x18dd86,_0x212c('0x27'));_0x10c25e['query']=_[_0x212c('0x2f')](_0x3d80e9[_0x212c('0x30')]);_0x10c25e[_0x212c('0x31')]=_[_0x212c('0x32')](_0x10c25e[_0x212c('0x2e')],_0x10c25e['query']);_0x5dbbdb['attributes']=_[_0x212c('0x32')](_0x10c25e[_0x212c('0x2e')],qs['fields'](_0x3d80e9[_0x212c('0x30')][_0x212c('0x33')]));_0x5dbbdb[_0x212c('0x34')]=_0x5dbbdb[_0x212c('0x34')][_0x212c('0x35')]?_0x5dbbdb[_0x212c('0x34')]:_0x10c25e[_0x212c('0x2e')];if(!_0x3d80e9[_0x212c('0x30')]['hasOwnProperty'](_0x212c('0x36'))){_0x5dbbdb[_0x212c('0x1f')]=qs[_0x212c('0x1f')](_0x3d80e9[_0x212c('0x30')][_0x212c('0x1f')]);_0x5dbbdb[_0x212c('0x37')]=qs[_0x212c('0x37')](_0x3d80e9[_0x212c('0x30')][_0x212c('0x37')]);}_0x5dbbdb[_0x212c('0x38')]=qs['sort'](_0x3d80e9[_0x212c('0x30')]['sort']);_0x5dbbdb[_0x212c('0x39')]=qs['filters'](_[_0x212c('0x3a')](_0x3d80e9['query'],_0x10c25e['filters']),_0x18dd86);if(_0x3d80e9[_0x212c('0x30')]['filter']){_0x5dbbdb[_0x212c('0x39')]=_['merge'](_0x5dbbdb['where'],{'$or':_[_0x212c('0x2a')](_0x18dd86,function(_0x418240){if(_0x418240[_0x212c('0x3b')]!==_0x212c('0x3c')){var _0x263546={};_0x263546[_0x418240[_0x212c('0x27')]]={'$like':'%'+_0x3d80e9['query'][_0x212c('0x3d')]+'%'};return _0x263546;}})});}_0x5dbbdb=_['merge']({},_0x5dbbdb,_0x3d80e9[_0x212c('0x3e')]);var _0x448e39={'where':_0x5dbbdb['where']};return db[_0x212c('0x2b')][_0x212c('0x1e')](_0x448e39)[_0x212c('0x23')](function(_0x2f5ed9){_0x4bc01c['count']=_0x2f5ed9;if(_0x3d80e9[_0x212c('0x30')][_0x212c('0x3f')]){_0x5dbbdb[_0x212c('0x40')]=[{'all':!![]}];}return db[_0x212c('0x2b')][_0x212c('0x41')](_0x5dbbdb);})[_0x212c('0x23')](function(_0x29bf02){_0x4bc01c[_0x212c('0x42')]=_0x29bf02;return _0x4bc01c;})[_0x212c('0x23')](respondWithFilteredResult(_0x14dd87,_0x5dbbdb))[_0x212c('0x43')](handleError(_0x14dd87,null));};exports['show']=function(_0x1a002a,_0x1b9c14){var _0x1a94f2={'raw':![],'where':{'id':_0x1a002a['params']['id']}},_0x57071e={};_0x57071e[_0x212c('0x2e')]=_['keys'](db[_0x212c('0x2b')][_0x212c('0x2c')]);_0x57071e[_0x212c('0x30')]=_[_0x212c('0x2f')](_0x1a002a[_0x212c('0x30')]);_0x57071e[_0x212c('0x31')]=_['intersection'](_0x57071e[_0x212c('0x2e')],_0x57071e['query']);_0x1a94f2['attributes']=_['intersection'](_0x57071e[_0x212c('0x2e')],qs[_0x212c('0x33')](_0x1a002a['query'][_0x212c('0x33')]));_0x1a94f2['attributes']=_0x1a94f2['attributes']['length']?_0x1a94f2['attributes']:_0x57071e[_0x212c('0x2e')];if(_0x1a002a[_0x212c('0x30')][_0x212c('0x3f')]){_0x1a94f2[_0x212c('0x40')]=[{'all':!![]}];}_0x1a94f2=_[_0x212c('0x44')]({},_0x1a94f2,_0x1a002a[_0x212c('0x3e')]);return db['FreshsalesAccount'][_0x212c('0x45')](_0x1a94f2)[_0x212c('0x23')](handleEntityNotFound(_0x1b9c14,null))[_0x212c('0x23')](respondWithResult(_0x1b9c14,null))[_0x212c('0x43')](handleError(_0x1b9c14,null));};exports['create']=function(_0x5ab0be,_0x2ab44c){return db[_0x212c('0x2b')][_0x212c('0x46')](_0x5ab0be[_0x212c('0x47')],{})[_0x212c('0x23')](respondWithResult(_0x2ab44c,0xc9))['catch'](handleError(_0x2ab44c,null));};exports[_0x212c('0x48')]=function(_0x8b5bd1,_0x554c7){if(_0x8b5bd1['body']['id']){delete _0x8b5bd1[_0x212c('0x47')]['id'];}return db[_0x212c('0x2b')][_0x212c('0x45')]({'where':{'id':_0x8b5bd1[_0x212c('0x49')]['id']}})['then'](handleEntityNotFound(_0x554c7,null))['then'](saveUpdates(_0x8b5bd1[_0x212c('0x47')],null))['then'](respondWithResult(_0x554c7,null))['catch'](handleError(_0x554c7,null));};exports[_0x212c('0x24')]=function(_0xed7565,_0xc8f839){return db[_0x212c('0x2b')]['find']({'where':{'id':_0xed7565[_0x212c('0x49')]['id']}})[_0x212c('0x23')](handleEntityNotFound(_0xc8f839,null))[_0x212c('0x23')](removeEntity(_0xc8f839,null))[_0x212c('0x43')](handleError(_0xc8f839,null));};exports[_0x212c('0x4a')]=function(_0x5d89af,_0x161bd6,_0x5204a8){var _0x299e7f={};var _0x3754a8={};var _0x23e0d4;var _0x47f91d;return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x5d89af['params']['id']}})['then'](handleEntityNotFound(_0x161bd6,null))[_0x212c('0x23')](function(_0x5437fe){if(_0x5437fe){_0x23e0d4=_0x5437fe;_0x3754a8['model']=_[_0x212c('0x2f')](db[_0x212c('0x4c')][_0x212c('0x2c')]);_0x3754a8[_0x212c('0x30')]=_[_0x212c('0x2f')](_0x5d89af['query']);_0x3754a8['filters']=_['intersection'](_0x3754a8[_0x212c('0x2e')],_0x3754a8[_0x212c('0x30')]);_0x299e7f[_0x212c('0x34')]=_['intersection'](_0x3754a8[_0x212c('0x2e')],qs[_0x212c('0x33')](_0x5d89af['query']['fields']));_0x299e7f[_0x212c('0x34')]=_0x299e7f[_0x212c('0x34')]['length']?_0x299e7f['attributes']:_0x3754a8[_0x212c('0x2e')];_0x299e7f[_0x212c('0x38')]=qs[_0x212c('0x4d')](_0x5d89af['query'][_0x212c('0x4d')]);_0x299e7f[_0x212c('0x39')]=qs[_0x212c('0x31')](_['pick'](_0x5d89af[_0x212c('0x30')],_0x3754a8[_0x212c('0x31')]));if(_0x5d89af[_0x212c('0x30')][_0x212c('0x3d')]){_0x299e7f[_0x212c('0x39')]=_[_0x212c('0x44')](_0x299e7f['where'],{'$or':_[_0x212c('0x2a')](_0x299e7f[_0x212c('0x34')],function(_0x179b96){var _0x1c4288={};_0x1c4288[_0x179b96]={'$like':'%'+_0x5d89af[_0x212c('0x30')][_0x212c('0x3d')]+'%'};return _0x1c4288;})});}_0x299e7f=_[_0x212c('0x44')]({},_0x299e7f,_0x5d89af[_0x212c('0x3e')]);return _0x23e0d4[_0x212c('0x4a')](_0x299e7f);}})[_0x212c('0x23')](function(_0x647baa){if(_0x647baa){_0x47f91d=_0x647baa[_0x212c('0x35')];if(!_0x5d89af[_0x212c('0x30')]['hasOwnProperty'](_0x212c('0x36'))){_0x299e7f[_0x212c('0x1f')]=qs['limit'](_0x5d89af[_0x212c('0x30')][_0x212c('0x1f')]);_0x299e7f[_0x212c('0x37')]=qs[_0x212c('0x37')](_0x5d89af[_0x212c('0x30')][_0x212c('0x37')]);}return _0x23e0d4[_0x212c('0x4a')](_0x299e7f);}})[_0x212c('0x23')](function(_0x3ff15e){if(_0x3ff15e){return _0x3ff15e?{'count':_0x47f91d,'rows':_0x3ff15e}:null;}})['then'](respondWithResult(_0x161bd6,null))['catch'](handleError(_0x161bd6,null));};exports[_0x212c('0x4e')]=function(_0x5651a0,_0x525bdd,_0xa6b430){if(_0x5651a0[_0x212c('0x47')]['id']){delete _0x5651a0[_0x212c('0x47')]['id'];}return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x5651a0['params']['id']}})[_0x212c('0x23')](handleEntityNotFound(_0x525bdd,null))[_0x212c('0x23')](function(_0xcabf3e){if(_0xcabf3e){_0x5651a0[_0x212c('0x47')]['AccountId']=_0xcabf3e['id'];_0x5651a0[_0x212c('0x47')][_0x212c('0x4f')]=integrations[_0x212c('0x50')](_0x5651a0[_0x212c('0x47')][_0x212c('0x51')],_0x5651a0[_0x212c('0x47')][_0x212c('0x3b')]);_0x5651a0['body'][_0x212c('0x52')]=integrations[_0x212c('0x53')](_0x5651a0[_0x212c('0x47')][_0x212c('0x51')],_0x5651a0[_0x212c('0x47')]['type']);return db[_0x212c('0x4c')][_0x212c('0x46')](_0x5651a0['body'],{'include':[{'model':db[_0x212c('0x54')],'as':'Subjects'},{'model':db[_0x212c('0x54')],'as':'Descriptions'}]});}return null;})[_0x212c('0x23')](respondWithResult(_0x525bdd,null))[_0x212c('0x43')](handleError(_0x525bdd,null));};exports[_0x212c('0x55')]=function(_0x247853,_0x1c2540,_0x3f27c0){var _0x42831c='';var _0x50536d='';return db[_0x212c('0x2b')][_0x212c('0x4b')]({'where':{'id':_0x247853[_0x212c('0x49')]['id']},'attributes':['id',_0x212c('0x56'),'remoteUri',_0x212c('0x57')]})[_0x212c('0x23')](handleEntityNotFound(_0x1c2540,null))[_0x212c('0x23')](function(_0x410edc){if(_0x410edc){_0x50536d=_0x410edc['username'];_0x42831c=_0x410edc[_0x212c('0x58')];var _0x41f029=_0x410edc[_0x212c('0x58')][_0x212c('0x59')](-0x1);if(_0x41f029==='/'){_0x42831c=_0x42831c[_0x212c('0x5a')](0x0,_0x42831c['lastIndexOf'](_0x41f029));}return rp({'method':'GET','uri':util['format']('%s%s',_0x42831c,'/api/selector/owners'),'headers':{'Authorization':_0x212c('0x5b')+_0x410edc[_0x212c('0x57')]},'json':!![]});}})[_0x212c('0x23')](function(_0x53e9d1){if(_0x53e9d1){var _0x332263=_0x53e9d1[_0x212c('0x5c')];var _0x25d505=![];var _0x1571e9=null;for(_0x1571e9=0x0;_0x1571e9<_0x332263[_0x212c('0x35')];_0x1571e9++){if(_0x332263[_0x1571e9][_0x212c('0x5d')]===_0x50536d){_0x25d505=!![];}}if(_0x25d505){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x212c('0x5e')});}}})[_0x212c('0x23')](respondWithResult(_0x1c2540,null))['catch'](function(_0x4c9458){var _0x1f29e5=_0x247853[_0x212c('0x30')][_0x212c('0x5f')]?0x1f4:_0x4c9458[_0x212c('0x60')]||0x1f4;logger[_0x212c('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x212c('0x55'),_0x1f29e5,JSON['stringify'](_0x4c9458));delete _0x4c9458[_0x212c('0x27')];if(_0x1f29e5===0x191){_0x1f29e5=0x190;}_0x1c2540[_0x212c('0x1c')](_0x1f29e5)[_0x212c('0x28')](_0x247853[_0x212c('0x30')][_0x212c('0x5f')]?{'message':_0x212c('0x61'),'statusCode':_0x4c9458['statusCode']}:_0x4c9458);});}; \ No newline at end of file +var _0xe4b5=['create','body','find','getConfigurations','findOne','FreshsalesConfiguration','merge','AccountId','getSubjects','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','show','params','length','catch'];(function(_0x4081a5,_0x27e9e2){var _0x59f5d9=function(_0x5b7420){while(--_0x5b7420){_0x4081a5['push'](_0x4081a5['shift']());}};_0x59f5d9(++_0x27e9e2);}(_0xe4b5,0x8b));var _0x5e4b=function(_0x418810,_0x524a80){_0x418810=_0x418810-0x0;var _0x1b9c1d=_0xe4b5[_0x418810];return _0x1b9c1d;};'use strict';var emlformat=require(_0x5e4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e4b('0x2'));var moment=require(_0x5e4b('0x3'));var BPromise=require(_0x5e4b('0x4'));var Mustache=require(_0x5e4b('0x5'));var util=require(_0x5e4b('0x6'));var path=require(_0x5e4b('0x7'));var sox=require(_0x5e4b('0x8'));var csv=require(_0x5e4b('0x9'));var ejs=require(_0x5e4b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e4b('0xb'));var _=require('lodash');var squel=require(_0x5e4b('0xc'));var crypto=require(_0x5e4b('0xd'));var jsforce=require(_0x5e4b('0xe'));var deskjs=require(_0x5e4b('0xf'));var toCsv=require(_0x5e4b('0x9'));var querystring=require(_0x5e4b('0x10'));var Papa=require(_0x5e4b('0x11'));var Redis=require(_0x5e4b('0x12'));var authService=require(_0x5e4b('0x13'));var qs=require(_0x5e4b('0x14'));var as=require(_0x5e4b('0x15'));var hardwareService=require(_0x5e4b('0x16'));var logger=require(_0x5e4b('0x17'))('api');var utils=require(_0x5e4b('0x18'));var config=require(_0x5e4b('0x19'));var licenseUtil=require(_0x5e4b('0x1a'));var db=require(_0x5e4b('0x1b'))['db'];var integrations=require(_0x5e4b('0x1c'));function respondWithStatusCode(_0x2a6daf,_0x424ec7){_0x424ec7=_0x424ec7||0xcc;return function(_0x4723ec){if(_0x4723ec){return _0x2a6daf[_0x5e4b('0x1d')](_0x424ec7);}return _0x2a6daf[_0x5e4b('0x1e')](_0x424ec7)[_0x5e4b('0x1f')]();};}function respondWithResult(_0x336715,_0x10cb72){_0x10cb72=_0x10cb72||0xc8;return function(_0x13347e){if(_0x13347e){return _0x336715[_0x5e4b('0x1e')](_0x10cb72)[_0x5e4b('0x20')](_0x13347e);}};}function respondWithFilteredResult(_0x3f731c,_0x5996bc){return function(_0x5bdc9b){if(_0x5bdc9b){var _0xde3fa=typeof _0x5996bc[_0x5e4b('0x21')]===_0x5e4b('0x22')&&typeof _0x5996bc[_0x5e4b('0x23')]===_0x5e4b('0x22');var _0x1524de=_0x5bdc9b['count'];var _0x4f53fd=_0xde3fa?0x0:_0x5996bc[_0x5e4b('0x21')];var _0x1972a6=_0xde3fa?_0x5bdc9b[_0x5e4b('0x24')]:_0x5996bc[_0x5e4b('0x21')]+_0x5996bc['limit'];var _0x1f966f;if(_0x1972a6>=_0x1524de){_0x1972a6=_0x1524de;_0x1f966f=0xc8;}else{_0x1f966f=0xce;}_0x3f731c[_0x5e4b('0x1e')](_0x1f966f);return _0x3f731c['set'](_0x5e4b('0x25'),_0x4f53fd+'-'+_0x1972a6+'/'+_0x1524de)[_0x5e4b('0x20')](_0x5bdc9b);}return null;};}function patchUpdates(_0x5f0799){return function(_0x5642ba){try{jsonpatch[_0x5e4b('0x26')](_0x5642ba,_0x5f0799,!![]);}catch(_0xf83c8d){return BPromise[_0x5e4b('0x27')](_0xf83c8d);}return _0x5642ba[_0x5e4b('0x28')]();};}function saveUpdates(_0x3e7977,_0x48012c){return function(_0x3219f9){if(_0x3219f9){return _0x3219f9[_0x5e4b('0x29')](_0x3e7977)['then'](function(_0x2a3acc){return _0x2a3acc;});}return null;};}function removeEntity(_0x12ace1,_0x9c23e5){return function(_0x2325af){if(_0x2325af){return _0x2325af[_0x5e4b('0x2a')]()[_0x5e4b('0x2b')](function(){_0x12ace1[_0x5e4b('0x1e')](0xcc)[_0x5e4b('0x1f')]();});}};}function handleEntityNotFound(_0x1be58e,_0x112f85){return function(_0x5ec3f2){if(!_0x5ec3f2){_0x1be58e[_0x5e4b('0x1d')](0x194);}return _0x5ec3f2;};}function handleError(_0x48a29d,_0x37cb21){_0x37cb21=_0x37cb21||0x1f4;return function(_0x189db5){logger[_0x5e4b('0x2c')](_0x189db5[_0x5e4b('0x2d')]);if(_0x189db5[_0x5e4b('0x2e')]){delete _0x189db5[_0x5e4b('0x2e')];}_0x48a29d[_0x5e4b('0x1e')](_0x37cb21)[_0x5e4b('0x2f')](_0x189db5);};}exports[_0x5e4b('0x30')]=function(_0xe91ba2,_0x27696a){var _0x5e9c11={},_0x3261ab={},_0x5c022d={'count':0x0,'rows':[]};var _0x1d8d3a=_[_0x5e4b('0x31')](db['FreshsalesAccount'][_0x5e4b('0x32')],function(_0x2d42aa){return{'name':_0x2d42aa[_0x5e4b('0x33')],'type':_0x2d42aa[_0x5e4b('0x34')][_0x5e4b('0x35')]};});_0x3261ab[_0x5e4b('0x36')]=_[_0x5e4b('0x31')](_0x1d8d3a,_0x5e4b('0x2e'));_0x3261ab['query']=_[_0x5e4b('0x37')](_0xe91ba2['query']);_0x3261ab['filters']=_['intersection'](_0x3261ab[_0x5e4b('0x36')],_0x3261ab[_0x5e4b('0x38')]);_0x5e9c11[_0x5e4b('0x39')]=_[_0x5e4b('0x3a')](_0x3261ab[_0x5e4b('0x36')],qs[_0x5e4b('0x3b')](_0xe91ba2[_0x5e4b('0x38')][_0x5e4b('0x3b')]));_0x5e9c11['attributes']=_0x5e9c11[_0x5e4b('0x39')]['length']?_0x5e9c11[_0x5e4b('0x39')]:_0x3261ab['model'];if(!_0xe91ba2[_0x5e4b('0x38')][_0x5e4b('0x3c')](_0x5e4b('0x3d'))){_0x5e9c11[_0x5e4b('0x23')]=qs['limit'](_0xe91ba2[_0x5e4b('0x38')][_0x5e4b('0x23')]);_0x5e9c11['offset']=qs['offset'](_0xe91ba2[_0x5e4b('0x38')][_0x5e4b('0x21')]);}_0x5e9c11['order']=qs[_0x5e4b('0x3e')](_0xe91ba2[_0x5e4b('0x38')]['sort']);_0x5e9c11[_0x5e4b('0x3f')]=qs[_0x5e4b('0x40')](_[_0x5e4b('0x41')](_0xe91ba2[_0x5e4b('0x38')],_0x3261ab['filters']),_0x1d8d3a);if(_0xe91ba2['query'][_0x5e4b('0x42')]){_0x5e9c11[_0x5e4b('0x3f')]=_['merge'](_0x5e9c11[_0x5e4b('0x3f')],{'$or':_['map'](_0x1d8d3a,function(_0x2744be){if(_0x2744be[_0x5e4b('0x34')]!==_0x5e4b('0x43')){var _0x41acd8={};_0x41acd8[_0x2744be[_0x5e4b('0x2e')]]={'$like':'%'+_0xe91ba2['query'][_0x5e4b('0x42')]+'%'};return _0x41acd8;}})});}_0x5e9c11=_['merge']({},_0x5e9c11,_0xe91ba2[_0x5e4b('0x44')]);var _0x3c65ef={'where':_0x5e9c11[_0x5e4b('0x3f')]};return db[_0x5e4b('0x45')][_0x5e4b('0x24')](_0x3c65ef)['then'](function(_0x57406e){_0x5c022d[_0x5e4b('0x24')]=_0x57406e;if(_0xe91ba2[_0x5e4b('0x38')][_0x5e4b('0x46')]){_0x5e9c11[_0x5e4b('0x47')]=[{'all':!![]}];}return db[_0x5e4b('0x45')][_0x5e4b('0x48')](_0x5e9c11);})[_0x5e4b('0x2b')](function(_0x3d3805){_0x5c022d['rows']=_0x3d3805;return _0x5c022d;})['then'](respondWithFilteredResult(_0x27696a,_0x5e9c11))['catch'](handleError(_0x27696a,null));};exports[_0x5e4b('0x49')]=function(_0x3669de,_0x4c01f3){var _0xf8c1d8={'raw':![],'where':{'id':_0x3669de[_0x5e4b('0x4a')]['id']}},_0x10818a={};_0x10818a['model']=_['keys'](db[_0x5e4b('0x45')][_0x5e4b('0x32')]);_0x10818a['query']=_[_0x5e4b('0x37')](_0x3669de[_0x5e4b('0x38')]);_0x10818a[_0x5e4b('0x40')]=_['intersection'](_0x10818a['model'],_0x10818a[_0x5e4b('0x38')]);_0xf8c1d8['attributes']=_[_0x5e4b('0x3a')](_0x10818a[_0x5e4b('0x36')],qs[_0x5e4b('0x3b')](_0x3669de[_0x5e4b('0x38')]['fields']));_0xf8c1d8['attributes']=_0xf8c1d8[_0x5e4b('0x39')][_0x5e4b('0x4b')]?_0xf8c1d8['attributes']:_0x10818a[_0x5e4b('0x36')];if(_0x3669de[_0x5e4b('0x38')]['includeAll']){_0xf8c1d8[_0x5e4b('0x47')]=[{'all':!![]}];}_0xf8c1d8=_['merge']({},_0xf8c1d8,_0x3669de[_0x5e4b('0x44')]);return db['FreshsalesAccount']['find'](_0xf8c1d8)[_0x5e4b('0x2b')](handleEntityNotFound(_0x4c01f3,null))['then'](respondWithResult(_0x4c01f3,null))[_0x5e4b('0x4c')](handleError(_0x4c01f3,null));};exports[_0x5e4b('0x4d')]=function(_0x55265a,_0x5d40dc){return db['FreshsalesAccount'][_0x5e4b('0x4d')](_0x55265a[_0x5e4b('0x4e')],{})['then'](respondWithResult(_0x5d40dc,0xc9))[_0x5e4b('0x4c')](handleError(_0x5d40dc,null));};exports[_0x5e4b('0x29')]=function(_0x3341c4,_0x2ba40c){if(_0x3341c4[_0x5e4b('0x4e')]['id']){delete _0x3341c4['body']['id'];}return db[_0x5e4b('0x45')]['find']({'where':{'id':_0x3341c4['params']['id']}})['then'](handleEntityNotFound(_0x2ba40c,null))[_0x5e4b('0x2b')](saveUpdates(_0x3341c4[_0x5e4b('0x4e')],null))[_0x5e4b('0x2b')](respondWithResult(_0x2ba40c,null))[_0x5e4b('0x4c')](handleError(_0x2ba40c,null));};exports['destroy']=function(_0x3cc529,_0x5f3909){return db[_0x5e4b('0x45')][_0x5e4b('0x4f')]({'where':{'id':_0x3cc529['params']['id']}})[_0x5e4b('0x2b')](handleEntityNotFound(_0x5f3909,null))[_0x5e4b('0x2b')](removeEntity(_0x5f3909,null))[_0x5e4b('0x4c')](handleError(_0x5f3909,null));};exports[_0x5e4b('0x50')]=function(_0x1a1319,_0x25d6b5,_0x457909){var _0xc572c3={};var _0x1763db={};var _0x4e9a08;var _0x535d75;return db['FreshsalesAccount'][_0x5e4b('0x51')]({'where':{'id':_0x1a1319[_0x5e4b('0x4a')]['id']}})[_0x5e4b('0x2b')](handleEntityNotFound(_0x25d6b5,null))[_0x5e4b('0x2b')](function(_0x435097){if(_0x435097){_0x4e9a08=_0x435097;_0x1763db[_0x5e4b('0x36')]=_[_0x5e4b('0x37')](db[_0x5e4b('0x52')][_0x5e4b('0x32')]);_0x1763db[_0x5e4b('0x38')]=_[_0x5e4b('0x37')](_0x1a1319[_0x5e4b('0x38')]);_0x1763db[_0x5e4b('0x40')]=_[_0x5e4b('0x3a')](_0x1763db[_0x5e4b('0x36')],_0x1763db[_0x5e4b('0x38')]);_0xc572c3['attributes']=_['intersection'](_0x1763db[_0x5e4b('0x36')],qs[_0x5e4b('0x3b')](_0x1a1319['query'][_0x5e4b('0x3b')]));_0xc572c3[_0x5e4b('0x39')]=_0xc572c3['attributes'][_0x5e4b('0x4b')]?_0xc572c3[_0x5e4b('0x39')]:_0x1763db[_0x5e4b('0x36')];_0xc572c3['order']=qs[_0x5e4b('0x3e')](_0x1a1319[_0x5e4b('0x38')]['sort']);_0xc572c3[_0x5e4b('0x3f')]=qs['filters'](_['pick'](_0x1a1319[_0x5e4b('0x38')],_0x1763db['filters']));if(_0x1a1319[_0x5e4b('0x38')][_0x5e4b('0x42')]){_0xc572c3[_0x5e4b('0x3f')]=_[_0x5e4b('0x53')](_0xc572c3['where'],{'$or':_[_0x5e4b('0x31')](_0xc572c3['attributes'],function(_0x5dbfbb){var _0x9b3fd8={};_0x9b3fd8[_0x5dbfbb]={'$like':'%'+_0x1a1319['query'][_0x5e4b('0x42')]+'%'};return _0x9b3fd8;})});}_0xc572c3=_[_0x5e4b('0x53')]({},_0xc572c3,_0x1a1319[_0x5e4b('0x44')]);return _0x4e9a08['getConfigurations'](_0xc572c3);}})[_0x5e4b('0x2b')](function(_0x18d272){if(_0x18d272){_0x535d75=_0x18d272['length'];if(!_0x1a1319[_0x5e4b('0x38')][_0x5e4b('0x3c')]('nolimit')){_0xc572c3[_0x5e4b('0x23')]=qs['limit'](_0x1a1319[_0x5e4b('0x38')]['limit']);_0xc572c3[_0x5e4b('0x21')]=qs[_0x5e4b('0x21')](_0x1a1319[_0x5e4b('0x38')][_0x5e4b('0x21')]);}return _0x4e9a08[_0x5e4b('0x50')](_0xc572c3);}})['then'](function(_0x1d01f9){if(_0x1d01f9){return _0x1d01f9?{'count':_0x535d75,'rows':_0x1d01f9}:null;}})[_0x5e4b('0x2b')](respondWithResult(_0x25d6b5,null))[_0x5e4b('0x4c')](handleError(_0x25d6b5,null));};exports['addConfiguration']=function(_0x5c7bc1,_0x3aa48a,_0x5050e0){if(_0x5c7bc1[_0x5e4b('0x4e')]['id']){delete _0x5c7bc1['body']['id'];}return db['FreshsalesAccount'][_0x5e4b('0x51')]({'where':{'id':_0x5c7bc1[_0x5e4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3aa48a,null))[_0x5e4b('0x2b')](function(_0xfc2758){if(_0xfc2758){_0x5c7bc1[_0x5e4b('0x4e')][_0x5e4b('0x54')]=_0xfc2758['id'];_0x5c7bc1[_0x5e4b('0x4e')]['Subjects']=integrations[_0x5e4b('0x55')](_0x5c7bc1[_0x5e4b('0x4e')]['channel'],_0x5c7bc1['body'][_0x5e4b('0x34')]);_0x5c7bc1[_0x5e4b('0x4e')][_0x5e4b('0x56')]=integrations[_0x5e4b('0x57')](_0x5c7bc1[_0x5e4b('0x4e')]['channel'],_0x5c7bc1['body'][_0x5e4b('0x34')]);return db[_0x5e4b('0x52')][_0x5e4b('0x4d')](_0x5c7bc1[_0x5e4b('0x4e')],{'include':[{'model':db[_0x5e4b('0x58')],'as':'Subjects'},{'model':db[_0x5e4b('0x58')],'as':_0x5e4b('0x56')}]});}return null;})['then'](respondWithResult(_0x3aa48a,null))[_0x5e4b('0x4c')](handleError(_0x3aa48a,null));};exports['getFields']=function(_0x39acd3,_0x82ec44,_0x4da4a7){var _0x20e4ae='';var _0x4982be='';return db[_0x5e4b('0x45')]['findOne']({'where':{'id':_0x39acd3[_0x5e4b('0x4a')]['id']},'attributes':['id',_0x5e4b('0x59'),_0x5e4b('0x5a'),_0x5e4b('0x5b')]})['then'](handleEntityNotFound(_0x82ec44,null))[_0x5e4b('0x2b')](function(_0x1e214e){if(_0x1e214e){_0x4982be=_0x1e214e[_0x5e4b('0x59')];_0x20e4ae=_0x1e214e[_0x5e4b('0x5a')];var _0x126a6c=_0x1e214e[_0x5e4b('0x5a')][_0x5e4b('0x5c')](-0x1);if(_0x126a6c==='/'){_0x20e4ae=_0x20e4ae[_0x5e4b('0x5d')](0x0,_0x20e4ae[_0x5e4b('0x5e')](_0x126a6c));}return rp({'method':'GET','uri':util[_0x5e4b('0x5f')](_0x5e4b('0x60'),_0x20e4ae,_0x5e4b('0x61')),'headers':{'Authorization':_0x5e4b('0x62')+_0x1e214e['apiKey']},'json':!![]});}})[_0x5e4b('0x2b')](function(_0x97bdb1){if(_0x97bdb1){var _0x1aa648=_0x97bdb1[_0x5e4b('0x63')];var _0x5c9d7f=![];var _0x2271e6=null;for(_0x2271e6=0x0;_0x2271e6<_0x1aa648['length'];_0x2271e6++){if(_0x1aa648[_0x2271e6][_0x5e4b('0x64')]===_0x4982be){_0x5c9d7f=!![];}}if(_0x5c9d7f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5e4b('0x65')});}}})['then'](respondWithResult(_0x82ec44,null))[_0x5e4b('0x4c')](function(_0x516edf){var _0x22db7b=_0x39acd3[_0x5e4b('0x38')]['test']?0x1f4:_0x516edf['statusCode']||0x1f4;logger['error'](_0x5e4b('0x66'),_0x5e4b('0x67'),_0x22db7b,JSON[_0x5e4b('0x68')](_0x516edf));delete _0x516edf[_0x5e4b('0x2e')];if(_0x22db7b===0x191){_0x22db7b=0x190;}_0x82ec44[_0x5e4b('0x1e')](_0x22db7b)[_0x5e4b('0x2f')](_0x39acd3[_0x5e4b('0x38')][_0x5e4b('0x69')]?{'message':_0x5e4b('0x6a'),'statusCode':_0x516edf[_0x5e4b('0x6b')]}:_0x516edf);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index cbfedd0..1c1c28a 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 _0x71ab=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise'];(function(_0x481291,_0x3400e0){var _0x35dc78=function(_0x13bf87){while(--_0x13bf87){_0x481291['push'](_0x481291['shift']());}};_0x35dc78(++_0x3400e0);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_freshsales_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x3f7d20,_0x48f004){var _0xdd965f=function(_0x3a545c){while(--_0x3a545c){_0x3f7d20['push'](_0x3f7d20['shift']());}};_0xdd965f(++_0x48f004);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xee2f('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 5947fca..4a3fc67 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 _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x1123c0,_0x403255){var _0x1af339=function(_0x55f675){while(--_0x55f675){_0x1123c0['push'](_0x1123c0['shift']());}};_0x1af339(++_0x403255);}(_0x4991,0xf7));var _0x1499=function(_0x2e8000,_0x25b2b5){_0x2e8000=_0x2e8000-0x0;var _0x3f41bd=_0x4991[_0x2e8000];return _0x3f41bd;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file +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(_0x35ce13,_0x12d22b){var _0x2addc6=function(_0x26494e){while(--_0x26494e){_0x35ce13['push'](_0x35ce13['shift']());}};_0x2addc6(++_0x12d22b);}(_0x5fdc,0x127));var _0xc5fd=function(_0x37da2e,_0x30a7fe){_0x37da2e=_0x37da2e-0x0;var _0x51efae=_0x5fdc[_0x37da2e];return _0x51efae;};'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 diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e3f3aae..ebbf577 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 _0xe2c1=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects'];(function(_0x47a8e6,_0x85eb5a){var _0x1070bf=function(_0x29d3d7){while(--_0x29d3d7){_0x47a8e6['push'](_0x47a8e6['shift']());}};_0x1070bf(++_0x85eb5a);}(_0xe2c1,0x1a8));var _0x1e2c=function(_0x48d63e,_0x41af3d){_0x48d63e=_0x48d63e-0x0;var _0x5a3f4b=_0xe2c1[_0x48d63e];return _0x5a3f4b;};'use strict';var multer=require(_0x1e2c('0x0'));var util=require(_0x1e2c('0x1'));var path=require(_0x1e2c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e2c('0x3'));var router=express[_0x1e2c('0x4')]();var fs_extra=require(_0x1e2c('0x5'));var auth=require(_0x1e2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e2c('0x7'));router[_0x1e2c('0x8')]('/',auth[_0x1e2c('0x9')](),controller['index']);router[_0x1e2c('0x8')](_0x1e2c('0xa'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xb')]);router[_0x1e2c('0x8')]('/:id/subjects',auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xc')]);router[_0x1e2c('0x8')](_0x1e2c('0xd'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0xe')]);router['get'](_0x1e2c('0xf'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0x10')]);router[_0x1e2c('0x11')]('/',auth[_0x1e2c('0x9')](),controller['create']);router[_0x1e2c('0x12')](_0x1e2c('0xa'),auth[_0x1e2c('0x9')](),controller[_0x1e2c('0x13')]);router[_0x1e2c('0x14')](_0x1e2c('0xa'),auth['isAuthenticated'](),controller[_0x1e2c('0x15')]);module[_0x1e2c('0x16')]=router; \ No newline at end of file +var _0xd0da=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/fields','getFields','post','create','put'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd0da,0x6b));var _0xad0d=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xd0da[_0x1d426f];return _0x17f71a;};'use strict';var multer=require(_0xad0d('0x0'));var util=require(_0xad0d('0x1'));var path=require(_0xad0d('0x2'));var timeout=require(_0xad0d('0x3'));var express=require(_0xad0d('0x4'));var router=express[_0xad0d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xad0d('0x6'));var config=require('../../config/environment');var controller=require(_0xad0d('0x7'));router[_0xad0d('0x8')]('/',auth[_0xad0d('0x9')](),controller[_0xad0d('0xa')]);router['get'](_0xad0d('0xb'),auth[_0xad0d('0x9')](),controller['show']);router[_0xad0d('0x8')](_0xad0d('0xc'),auth[_0xad0d('0x9')](),controller[_0xad0d('0xd')]);router[_0xad0d('0x8')]('/:id/descriptions',auth[_0xad0d('0x9')](),controller['getDescriptions']);router[_0xad0d('0x8')](_0xad0d('0xe'),auth[_0xad0d('0x9')](),controller[_0xad0d('0xf')]);router[_0xad0d('0x10')]('/',auth['isAuthenticated'](),controller[_0xad0d('0x11')]);router[_0xad0d('0x12')](_0xad0d('0xb'),auth[_0xad0d('0x9')](),controller[_0xad0d('0x13')]);router['delete'](_0xad0d('0xb'),auth['isAuthenticated'](),controller[_0xad0d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5b8dec4..4f8fe8a 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 _0x525d=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x525d,0x1e2));var _0xd525=function(_0x381fe7,_0x444931){_0x381fe7=_0x381fe7-0x0;var _0x536366=_0x525d[_0x381fe7];return _0x536366;};'use strict';var Sequelize=require(_0xd525('0x0'));module[_0xd525('0x1')]={'name':{'type':Sequelize[_0xd525('0x2')]},'description':{'type':Sequelize[_0xd525('0x2')]}}; \ No newline at end of file +var _0xfd1d=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd1d,0x173));var _0xdfd1=function(_0x540cc0,_0x41da8){_0x540cc0=_0x540cc0-0x0;var _0x3dce0a=_0xfd1d[_0x540cc0];return _0x3dce0a;};'use strict';var Sequelize=require(_0xdfd1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdfd1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 319be93..8b4138a 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 _0x0400=['rows','catch','params','keys','find','create','body','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x0400,0x197));var _0x0040=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x0400[_0x52f159];return _0x156799;};'use strict';var emlformat=require(_0x0040('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0040('0x1'));var jsonpatch=require(_0x0040('0x2'));var rp=require(_0x0040('0x3'));var moment=require(_0x0040('0x4'));var BPromise=require(_0x0040('0x5'));var Mustache=require(_0x0040('0x6'));var util=require('util');var path=require(_0x0040('0x7'));var sox=require(_0x0040('0x8'));var csv=require(_0x0040('0x9'));var ejs=require(_0x0040('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0040('0xb'));var squel=require('squel');var crypto=require(_0x0040('0xc'));var jsforce=require(_0x0040('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0040('0x9'));var querystring=require(_0x0040('0xe'));var Papa=require('papaparse');var Redis=require(_0x0040('0xf'));var authService=require(_0x0040('0x10'));var qs=require(_0x0040('0x11'));var as=require(_0x0040('0x12'));var hardwareService=require(_0x0040('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0040('0x14'));var config=require(_0x0040('0x15'));var licenseUtil=require(_0x0040('0x16'));var db=require(_0x0040('0x17'))['db'];function respondWithStatusCode(_0x5ab224,_0x278701){_0x278701=_0x278701||0xcc;return function(_0x1f2aee){if(_0x1f2aee){return _0x5ab224[_0x0040('0x18')](_0x278701);}return _0x5ab224[_0x0040('0x19')](_0x278701)['end']();};}function respondWithResult(_0x2d4ed5,_0x4762db){_0x4762db=_0x4762db||0xc8;return function(_0x3c168c){if(_0x3c168c){return _0x2d4ed5[_0x0040('0x19')](_0x4762db)['json'](_0x3c168c);}};}function respondWithFilteredResult(_0x530c2a,_0x2519cf){return function(_0x4fd7c1){if(_0x4fd7c1){var _0x5962c9=typeof _0x2519cf[_0x0040('0x1a')]===_0x0040('0x1b')&&typeof _0x2519cf[_0x0040('0x1c')]==='undefined';var _0x28f5e3=_0x4fd7c1['count'];var _0x133b65=_0x5962c9?0x0:_0x2519cf[_0x0040('0x1a')];var _0x3b2ae4=_0x5962c9?_0x4fd7c1['count']:_0x2519cf[_0x0040('0x1a')]+_0x2519cf[_0x0040('0x1c')];var _0x22b3d4;if(_0x3b2ae4>=_0x28f5e3){_0x3b2ae4=_0x28f5e3;_0x22b3d4=0xc8;}else{_0x22b3d4=0xce;}_0x530c2a[_0x0040('0x19')](_0x22b3d4);return _0x530c2a[_0x0040('0x1d')](_0x0040('0x1e'),_0x133b65+'-'+_0x3b2ae4+'/'+_0x28f5e3)[_0x0040('0x1f')](_0x4fd7c1);}return null;};}function patchUpdates(_0x2d2fb6){return function(_0x2d2de8){try{jsonpatch['apply'](_0x2d2de8,_0x2d2fb6,!![]);}catch(_0x382015){return BPromise[_0x0040('0x20')](_0x382015);}return _0x2d2de8[_0x0040('0x21')]();};}function saveUpdates(_0xc93e04,_0x4ed33e){return function(_0x3cc96d){if(_0x3cc96d){return _0x3cc96d[_0x0040('0x22')](_0xc93e04)[_0x0040('0x23')](function(_0x183908){return _0x183908;});}return null;};}function removeEntity(_0x40d3e6,_0x3e8965){return function(_0x5486b7){if(_0x5486b7){return _0x5486b7[_0x0040('0x24')]()[_0x0040('0x23')](function(){_0x40d3e6[_0x0040('0x19')](0xcc)[_0x0040('0x25')]();});}};}function handleEntityNotFound(_0xa931b0,_0x424af3){return function(_0x5174f3){if(!_0x5174f3){_0xa931b0[_0x0040('0x18')](0x194);}return _0x5174f3;};}function handleError(_0x5f1d3c,_0x28db90){_0x28db90=_0x28db90||0x1f4;return function(_0x1e0040){logger[_0x0040('0x26')](_0x1e0040['stack']);if(_0x1e0040[_0x0040('0x27')]){delete _0x1e0040[_0x0040('0x27')];}_0x5f1d3c[_0x0040('0x19')](_0x28db90)['send'](_0x1e0040);};}exports['index']=function(_0x2ddc28,_0x1dba11){var _0x18278b={},_0x295ce4={},_0x197e1c={'count':0x0,'rows':[]};var _0x3cd15f=_[_0x0040('0x28')](db[_0x0040('0x29')][_0x0040('0x2a')],function(_0x492ae5){return{'name':_0x492ae5[_0x0040('0x2b')],'type':_0x492ae5[_0x0040('0x2c')][_0x0040('0x2d')]};});_0x295ce4[_0x0040('0x2e')]=_['map'](_0x3cd15f,_0x0040('0x27'));_0x295ce4[_0x0040('0x2f')]=_['keys'](_0x2ddc28[_0x0040('0x2f')]);_0x295ce4[_0x0040('0x30')]=_[_0x0040('0x31')](_0x295ce4['model'],_0x295ce4[_0x0040('0x2f')]);_0x18278b[_0x0040('0x32')]=_['intersection'](_0x295ce4[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x33')]));_0x18278b[_0x0040('0x32')]=_0x18278b[_0x0040('0x32')][_0x0040('0x34')]?_0x18278b['attributes']:_0x295ce4[_0x0040('0x2e')];if(!_0x2ddc28['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x18278b[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0x2ddc28['query']['limit']);_0x18278b['offset']=qs['offset'](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x1a')]);}_0x18278b[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x2ddc28[_0x0040('0x2f')][_0x0040('0x38')]);_0x18278b['where']=qs[_0x0040('0x30')](_[_0x0040('0x39')](_0x2ddc28[_0x0040('0x2f')],_0x295ce4[_0x0040('0x30')]),_0x3cd15f);if(_0x2ddc28[_0x0040('0x2f')][_0x0040('0x3a')]){_0x18278b[_0x0040('0x3b')]=_[_0x0040('0x3c')](_0x18278b['where'],{'$or':_[_0x0040('0x28')](_0x3cd15f,function(_0x50288f){if(_0x50288f[_0x0040('0x2c')]!==_0x0040('0x3d')){var _0x1434dd={};_0x1434dd[_0x50288f[_0x0040('0x27')]]={'$like':'%'+_0x2ddc28['query'][_0x0040('0x3a')]+'%'};return _0x1434dd;}})});}_0x18278b=_[_0x0040('0x3c')]({},_0x18278b,_0x2ddc28[_0x0040('0x3e')]);var _0x4db4fb={'where':_0x18278b[_0x0040('0x3b')]};return db[_0x0040('0x29')][_0x0040('0x3f')](_0x4db4fb)['then'](function(_0x1bd29e){_0x197e1c['count']=_0x1bd29e;if(_0x2ddc28['query'][_0x0040('0x40')]){_0x18278b[_0x0040('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x0040('0x42')](_0x18278b);})[_0x0040('0x23')](function(_0x288c2d){_0x197e1c[_0x0040('0x43')]=_0x288c2d;return _0x197e1c;})[_0x0040('0x23')](respondWithFilteredResult(_0x1dba11,_0x18278b))[_0x0040('0x44')](handleError(_0x1dba11,null));};exports['show']=function(_0xf7bb9b,_0x347926){var _0x2379a2={'raw':![],'where':{'id':_0xf7bb9b[_0x0040('0x45')]['id']}},_0x52e036={};_0x52e036[_0x0040('0x2e')]=_[_0x0040('0x46')](db[_0x0040('0x29')]['rawAttributes']);_0x52e036[_0x0040('0x2f')]=_[_0x0040('0x46')](_0xf7bb9b[_0x0040('0x2f')]);_0x52e036[_0x0040('0x30')]=_['intersection'](_0x52e036[_0x0040('0x2e')],_0x52e036[_0x0040('0x2f')]);_0x2379a2[_0x0040('0x32')]=_[_0x0040('0x31')](_0x52e036[_0x0040('0x2e')],qs[_0x0040('0x33')](_0xf7bb9b['query']['fields']));_0x2379a2[_0x0040('0x32')]=_0x2379a2[_0x0040('0x32')]['length']?_0x2379a2[_0x0040('0x32')]:_0x52e036[_0x0040('0x2e')];if(_0xf7bb9b[_0x0040('0x2f')][_0x0040('0x40')]){_0x2379a2['include']=[{'all':!![]}];}_0x2379a2=_[_0x0040('0x3c')]({},_0x2379a2,_0xf7bb9b['options']);return db[_0x0040('0x29')][_0x0040('0x47')](_0x2379a2)[_0x0040('0x23')](handleEntityNotFound(_0x347926,null))[_0x0040('0x23')](respondWithResult(_0x347926,null))[_0x0040('0x44')](handleError(_0x347926,null));};exports[_0x0040('0x48')]=function(_0x416925,_0x5a6bfe){return db['FreshsalesConfiguration'][_0x0040('0x48')](_0x416925[_0x0040('0x49')],{})[_0x0040('0x23')](respondWithResult(_0x5a6bfe,0xc9))[_0x0040('0x44')](handleError(_0x5a6bfe,null));};exports['update']=function(_0x221a7a,_0x33493b){if(_0x221a7a[_0x0040('0x49')]['id']){delete _0x221a7a[_0x0040('0x49')]['id'];}return db[_0x0040('0x29')][_0x0040('0x47')]({'where':{'id':_0x221a7a[_0x0040('0x45')]['id']}})['then'](handleEntityNotFound(_0x33493b,null))['then'](saveUpdates(_0x221a7a[_0x0040('0x49')],null))[_0x0040('0x23')](respondWithResult(_0x33493b,null))[_0x0040('0x44')](handleError(_0x33493b,null));};exports['destroy']=function(_0x279fa1,_0x140508){return db['FreshsalesConfiguration'][_0x0040('0x47')]({'where':{'id':_0x279fa1[_0x0040('0x45')]['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x140508,null))[_0x0040('0x23')](removeEntity(_0x140508,null))[_0x0040('0x44')](handleError(_0x140508,null));};exports['getSubjects']=function(_0xdafdf2,_0x1c2995,_0x2e7fdc){var _0x37ef29={};var _0x22c782={};var _0x16dc85;var _0x124cfc;return db[_0x0040('0x29')]['findOne']({'where':{'id':_0xdafdf2['params']['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x1c2995,null))[_0x0040('0x23')](function(_0x4ccb1f){if(_0x4ccb1f){_0x16dc85=_0x4ccb1f;_0x22c782[_0x0040('0x2e')]=_[_0x0040('0x46')](db['FreshsalesField'][_0x0040('0x2a')]);_0x22c782['query']=_[_0x0040('0x46')](_0xdafdf2['query']);_0x22c782[_0x0040('0x30')]=_[_0x0040('0x31')](_0x22c782[_0x0040('0x2e')],_0x22c782[_0x0040('0x2f')]);_0x37ef29[_0x0040('0x32')]=_[_0x0040('0x31')](_0x22c782['model'],qs[_0x0040('0x33')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x33')]));_0x37ef29['attributes']=_0x37ef29['attributes'][_0x0040('0x34')]?_0x37ef29['attributes']:_0x22c782[_0x0040('0x2e')];_0x37ef29[_0x0040('0x37')]=qs[_0x0040('0x38')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x38')]);_0x37ef29[_0x0040('0x3b')]=qs[_0x0040('0x30')](_[_0x0040('0x39')](_0xdafdf2[_0x0040('0x2f')],_0x22c782['filters']));if(_0xdafdf2[_0x0040('0x2f')][_0x0040('0x3a')]){_0x37ef29[_0x0040('0x3b')]=_[_0x0040('0x3c')](_0x37ef29[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x37ef29[_0x0040('0x32')],function(_0x2990c2){var _0xf9a28a={};_0xf9a28a[_0x2990c2]={'$like':'%'+_0xdafdf2['query'][_0x0040('0x3a')]+'%'};return _0xf9a28a;})});}_0x37ef29=_[_0x0040('0x3c')]({},_0x37ef29,_0xdafdf2['options']);return _0x16dc85[_0x0040('0x4a')](_0x37ef29);}})[_0x0040('0x23')](function(_0x25fa25){if(_0x25fa25){_0x124cfc=_0x25fa25[_0x0040('0x34')];if(!_0xdafdf2['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x37ef29[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x1c')]);_0x37ef29['offset']=qs[_0x0040('0x1a')](_0xdafdf2[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x16dc85['getSubjects'](_0x37ef29);}})['then'](function(_0xbe94c7){if(_0xbe94c7){return _0xbe94c7?{'count':_0x124cfc,'rows':_0xbe94c7}:null;}})['then'](respondWithResult(_0x1c2995,null))[_0x0040('0x44')](handleError(_0x1c2995,null));};exports[_0x0040('0x4b')]=function(_0x49a05b,_0x71675,_0x4b1f2a){var _0x859176={};var _0x29246f={};var _0x37dba9;var _0x52f5fe;return db[_0x0040('0x29')][_0x0040('0x4c')]({'where':{'id':_0x49a05b['params']['id']}})[_0x0040('0x23')](handleEntityNotFound(_0x71675,null))['then'](function(_0x446379){if(_0x446379){_0x37dba9=_0x446379;_0x29246f['model']=_['keys'](db[_0x0040('0x4d')][_0x0040('0x2a')]);_0x29246f[_0x0040('0x2f')]=_[_0x0040('0x46')](_0x49a05b[_0x0040('0x2f')]);_0x29246f['filters']=_['intersection'](_0x29246f[_0x0040('0x2e')],_0x29246f[_0x0040('0x2f')]);_0x859176[_0x0040('0x32')]=_['intersection'](_0x29246f[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x49a05b[_0x0040('0x2f')][_0x0040('0x33')]));_0x859176[_0x0040('0x32')]=_0x859176[_0x0040('0x32')][_0x0040('0x34')]?_0x859176[_0x0040('0x32')]:_0x29246f[_0x0040('0x2e')];_0x859176[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x49a05b['query']['sort']);_0x859176[_0x0040('0x3b')]=qs['filters'](_[_0x0040('0x39')](_0x49a05b[_0x0040('0x2f')],_0x29246f[_0x0040('0x30')]));if(_0x49a05b['query'][_0x0040('0x3a')]){_0x859176[_0x0040('0x3b')]=_['merge'](_0x859176[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x859176['attributes'],function(_0x4d8d87){var _0x5909eb={};_0x5909eb[_0x4d8d87]={'$like':'%'+_0x49a05b[_0x0040('0x2f')][_0x0040('0x3a')]+'%'};return _0x5909eb;})});}_0x859176=_[_0x0040('0x3c')]({},_0x859176,_0x49a05b[_0x0040('0x3e')]);return _0x37dba9['getDescriptions'](_0x859176);}})['then'](function(_0x5bead4){if(_0x5bead4){_0x52f5fe=_0x5bead4[_0x0040('0x34')];if(!_0x49a05b['query'][_0x0040('0x35')](_0x0040('0x36'))){_0x859176[_0x0040('0x1c')]=qs['limit'](_0x49a05b['query']['limit']);_0x859176[_0x0040('0x1a')]=qs[_0x0040('0x1a')](_0x49a05b[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x37dba9[_0x0040('0x4b')](_0x859176);}})[_0x0040('0x23')](function(_0x1d8fed){if(_0x1d8fed){return _0x1d8fed?{'count':_0x52f5fe,'rows':_0x1d8fed}:null;}})[_0x0040('0x23')](respondWithResult(_0x71675,null))[_0x0040('0x44')](handleError(_0x71675,null));};exports[_0x0040('0x4e')]=function(_0x34cd4c,_0x50007f,_0x577906){var _0x1d6aa0={};var _0x103917={};var _0x388e4a;var _0x3b9f88;return db['FreshsalesConfiguration'][_0x0040('0x4c')]({'where':{'id':_0x34cd4c[_0x0040('0x45')]['id']}})['then'](handleEntityNotFound(_0x50007f,null))[_0x0040('0x23')](function(_0x2dfe1f){if(_0x2dfe1f){_0x388e4a=_0x2dfe1f;_0x103917[_0x0040('0x2e')]=_[_0x0040('0x46')](db[_0x0040('0x4d')]['rawAttributes']);_0x103917[_0x0040('0x2f')]=_[_0x0040('0x46')](_0x34cd4c[_0x0040('0x2f')]);_0x103917[_0x0040('0x30')]=_[_0x0040('0x31')](_0x103917[_0x0040('0x2e')],_0x103917[_0x0040('0x2f')]);_0x1d6aa0[_0x0040('0x32')]=_['intersection'](_0x103917[_0x0040('0x2e')],qs[_0x0040('0x33')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x33')]));_0x1d6aa0[_0x0040('0x32')]=_0x1d6aa0['attributes'][_0x0040('0x34')]?_0x1d6aa0[_0x0040('0x32')]:_0x103917[_0x0040('0x2e')];_0x1d6aa0[_0x0040('0x37')]=qs[_0x0040('0x38')](_0x34cd4c['query'][_0x0040('0x38')]);_0x1d6aa0[_0x0040('0x3b')]=qs[_0x0040('0x30')](_['pick'](_0x34cd4c[_0x0040('0x2f')],_0x103917[_0x0040('0x30')]));if(_0x34cd4c[_0x0040('0x2f')][_0x0040('0x3a')]){_0x1d6aa0['where']=_['merge'](_0x1d6aa0[_0x0040('0x3b')],{'$or':_[_0x0040('0x28')](_0x1d6aa0[_0x0040('0x32')],function(_0x4c069b){var _0x391faf={};_0x391faf[_0x4c069b]={'$like':'%'+_0x34cd4c[_0x0040('0x2f')][_0x0040('0x3a')]+'%'};return _0x391faf;})});}_0x1d6aa0=_['merge']({},_0x1d6aa0,_0x34cd4c[_0x0040('0x3e')]);return _0x388e4a[_0x0040('0x4e')](_0x1d6aa0);}})['then'](function(_0x4dfbc0){if(_0x4dfbc0){_0x3b9f88=_0x4dfbc0['length'];if(!_0x34cd4c[_0x0040('0x2f')][_0x0040('0x35')]('nolimit')){_0x1d6aa0[_0x0040('0x1c')]=qs[_0x0040('0x1c')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x1c')]);_0x1d6aa0[_0x0040('0x1a')]=qs[_0x0040('0x1a')](_0x34cd4c[_0x0040('0x2f')][_0x0040('0x1a')]);}return _0x388e4a[_0x0040('0x4e')](_0x1d6aa0);}})[_0x0040('0x23')](function(_0x3d1443){if(_0x3d1443){return _0x3d1443?{'count':_0x3b9f88,'rows':_0x3d1443}:null;}})[_0x0040('0x23')](respondWithResult(_0x50007f,null))[_0x0040('0x44')](handleError(_0x50007f,null));}; \ No newline at end of file +var _0x7d0b=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','FreshsalesConfiguration','findAll','then','rows','catch','show','params','rawAttributes','create','body','find','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1de164,_0x1ccf5f){var _0x5613b4=function(_0x22dca9){while(--_0x22dca9){_0x1de164['push'](_0x1de164['shift']());}};_0x5613b4(++_0x1ccf5f);}(_0x7d0b,0x170));var _0xb7d0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7d0b[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xb7d0('0x0'));var rimraf=require(_0xb7d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7d0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb7d0('0x3'));var util=require(_0xb7d0('0x4'));var path=require('path');var sox=require(_0xb7d0('0x5'));var csv=require(_0xb7d0('0x6'));var ejs=require(_0xb7d0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7d0('0x8'));var squel=require(_0xb7d0('0x9'));var crypto=require(_0xb7d0('0xa'));var jsforce=require(_0xb7d0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb7d0('0x6'));var querystring=require('querystring');var Papa=require(_0xb7d0('0xc'));var Redis=require(_0xb7d0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb7d0('0xe'));var as=require(_0xb7d0('0xf'));var hardwareService=require(_0xb7d0('0x10'));var logger=require(_0xb7d0('0x11'))('api');var utils=require(_0xb7d0('0x12'));var config=require(_0xb7d0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7d0('0x14'))['db'];function respondWithStatusCode(_0x186eaf,_0x39133f){_0x39133f=_0x39133f||0xcc;return function(_0x2e143b){if(_0x2e143b){return _0x186eaf[_0xb7d0('0x15')](_0x39133f);}return _0x186eaf[_0xb7d0('0x16')](_0x39133f)[_0xb7d0('0x17')]();};}function respondWithResult(_0x38c0e8,_0x579a0b){_0x579a0b=_0x579a0b||0xc8;return function(_0x435c29){if(_0x435c29){return _0x38c0e8['status'](_0x579a0b)['json'](_0x435c29);}};}function respondWithFilteredResult(_0x53c9e5,_0x478a55){return function(_0x382f12){if(_0x382f12){var _0x55a56a=typeof _0x478a55['offset']===_0xb7d0('0x18')&&typeof _0x478a55[_0xb7d0('0x19')]==='undefined';var _0x256788=_0x382f12['count'];var _0x1fdc8a=_0x55a56a?0x0:_0x478a55['offset'];var _0x2061a4=_0x55a56a?_0x382f12[_0xb7d0('0x1a')]:_0x478a55[_0xb7d0('0x1b')]+_0x478a55[_0xb7d0('0x19')];var _0x4a4a81;if(_0x2061a4>=_0x256788){_0x2061a4=_0x256788;_0x4a4a81=0xc8;}else{_0x4a4a81=0xce;}_0x53c9e5[_0xb7d0('0x16')](_0x4a4a81);return _0x53c9e5[_0xb7d0('0x1c')](_0xb7d0('0x1d'),_0x1fdc8a+'-'+_0x2061a4+'/'+_0x256788)['json'](_0x382f12);}return null;};}function patchUpdates(_0x3234b9){return function(_0xa6a526){try{jsonpatch[_0xb7d0('0x1e')](_0xa6a526,_0x3234b9,!![]);}catch(_0xbe54d6){return BPromise['reject'](_0xbe54d6);}return _0xa6a526['save']();};}function saveUpdates(_0x905799,_0x3afa4a){return function(_0x18e673){if(_0x18e673){return _0x18e673[_0xb7d0('0x1f')](_0x905799)['then'](function(_0x2698b1){return _0x2698b1;});}return null;};}function removeEntity(_0x39fda1,_0x34013f){return function(_0x4ee075){if(_0x4ee075){return _0x4ee075[_0xb7d0('0x20')]()['then'](function(){_0x39fda1[_0xb7d0('0x16')](0xcc)[_0xb7d0('0x17')]();});}};}function handleEntityNotFound(_0x4d0e57,_0x5d5ffd){return function(_0x1dafdb){if(!_0x1dafdb){_0x4d0e57[_0xb7d0('0x15')](0x194);}return _0x1dafdb;};}function handleError(_0x15a06b,_0x186d7a){_0x186d7a=_0x186d7a||0x1f4;return function(_0x2c9a33){logger[_0xb7d0('0x21')](_0x2c9a33[_0xb7d0('0x22')]);if(_0x2c9a33[_0xb7d0('0x23')]){delete _0x2c9a33[_0xb7d0('0x23')];}_0x15a06b[_0xb7d0('0x16')](_0x186d7a)[_0xb7d0('0x24')](_0x2c9a33);};}exports[_0xb7d0('0x25')]=function(_0x484036,_0x54e0ae){var _0x4fe5ab={},_0x4ce513={},_0xc29ea7={'count':0x0,'rows':[]};var _0x5744f5=_[_0xb7d0('0x26')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x1589d5){return{'name':_0x1589d5[_0xb7d0('0x27')],'type':_0x1589d5[_0xb7d0('0x28')][_0xb7d0('0x29')]};});_0x4ce513[_0xb7d0('0x2a')]=_['map'](_0x5744f5,_0xb7d0('0x23'));_0x4ce513[_0xb7d0('0x2b')]=_[_0xb7d0('0x2c')](_0x484036[_0xb7d0('0x2b')]);_0x4ce513[_0xb7d0('0x2d')]=_[_0xb7d0('0x2e')](_0x4ce513[_0xb7d0('0x2a')],_0x4ce513['query']);_0x4fe5ab[_0xb7d0('0x2f')]=_['intersection'](_0x4ce513[_0xb7d0('0x2a')],qs[_0xb7d0('0x30')](_0x484036['query'][_0xb7d0('0x30')]));_0x4fe5ab[_0xb7d0('0x2f')]=_0x4fe5ab['attributes'][_0xb7d0('0x31')]?_0x4fe5ab['attributes']:_0x4ce513['model'];if(!_0x484036[_0xb7d0('0x2b')][_0xb7d0('0x32')](_0xb7d0('0x33'))){_0x4fe5ab['limit']=qs[_0xb7d0('0x19')](_0x484036[_0xb7d0('0x2b')][_0xb7d0('0x19')]);_0x4fe5ab[_0xb7d0('0x1b')]=qs['offset'](_0x484036[_0xb7d0('0x2b')][_0xb7d0('0x1b')]);}_0x4fe5ab[_0xb7d0('0x34')]=qs[_0xb7d0('0x35')](_0x484036['query'][_0xb7d0('0x35')]);_0x4fe5ab[_0xb7d0('0x36')]=qs[_0xb7d0('0x2d')](_[_0xb7d0('0x37')](_0x484036[_0xb7d0('0x2b')],_0x4ce513[_0xb7d0('0x2d')]),_0x5744f5);if(_0x484036['query']['filter']){_0x4fe5ab[_0xb7d0('0x36')]=_['merge'](_0x4fe5ab[_0xb7d0('0x36')],{'$or':_[_0xb7d0('0x26')](_0x5744f5,function(_0x44c376){if(_0x44c376[_0xb7d0('0x28')]!=='VIRTUAL'){var _0x58dac7={};_0x58dac7[_0x44c376[_0xb7d0('0x23')]]={'$like':'%'+_0x484036[_0xb7d0('0x2b')][_0xb7d0('0x38')]+'%'};return _0x58dac7;}})});}_0x4fe5ab=_[_0xb7d0('0x39')]({},_0x4fe5ab,_0x484036[_0xb7d0('0x3a')]);var _0x58e7df={'where':_0x4fe5ab[_0xb7d0('0x36')]};return db['FreshsalesConfiguration']['count'](_0x58e7df)['then'](function(_0x3ba41b){_0xc29ea7[_0xb7d0('0x1a')]=_0x3ba41b;if(_0x484036[_0xb7d0('0x2b')][_0xb7d0('0x3b')]){_0x4fe5ab[_0xb7d0('0x3c')]=[{'all':!![]}];}return db[_0xb7d0('0x3d')][_0xb7d0('0x3e')](_0x4fe5ab);})[_0xb7d0('0x3f')](function(_0x56e9cb){_0xc29ea7[_0xb7d0('0x40')]=_0x56e9cb;return _0xc29ea7;})[_0xb7d0('0x3f')](respondWithFilteredResult(_0x54e0ae,_0x4fe5ab))[_0xb7d0('0x41')](handleError(_0x54e0ae,null));};exports[_0xb7d0('0x42')]=function(_0x3e4680,_0x4fa78e){var _0x40797e={'raw':![],'where':{'id':_0x3e4680[_0xb7d0('0x43')]['id']}},_0x47ee12={};_0x47ee12[_0xb7d0('0x2a')]=_['keys'](db[_0xb7d0('0x3d')][_0xb7d0('0x44')]);_0x47ee12[_0xb7d0('0x2b')]=_['keys'](_0x3e4680[_0xb7d0('0x2b')]);_0x47ee12['filters']=_['intersection'](_0x47ee12[_0xb7d0('0x2a')],_0x47ee12[_0xb7d0('0x2b')]);_0x40797e['attributes']=_[_0xb7d0('0x2e')](_0x47ee12['model'],qs[_0xb7d0('0x30')](_0x3e4680[_0xb7d0('0x2b')][_0xb7d0('0x30')]));_0x40797e[_0xb7d0('0x2f')]=_0x40797e[_0xb7d0('0x2f')][_0xb7d0('0x31')]?_0x40797e['attributes']:_0x47ee12['model'];if(_0x3e4680[_0xb7d0('0x2b')][_0xb7d0('0x3b')]){_0x40797e[_0xb7d0('0x3c')]=[{'all':!![]}];}_0x40797e=_[_0xb7d0('0x39')]({},_0x40797e,_0x3e4680[_0xb7d0('0x3a')]);return db[_0xb7d0('0x3d')]['find'](_0x40797e)[_0xb7d0('0x3f')](handleEntityNotFound(_0x4fa78e,null))[_0xb7d0('0x3f')](respondWithResult(_0x4fa78e,null))[_0xb7d0('0x41')](handleError(_0x4fa78e,null));};exports[_0xb7d0('0x45')]=function(_0x45e11f,_0x47ea99){return db['FreshsalesConfiguration']['create'](_0x45e11f['body'],{})[_0xb7d0('0x3f')](respondWithResult(_0x47ea99,0xc9))['catch'](handleError(_0x47ea99,null));};exports['update']=function(_0x29111b,_0x58f359){if(_0x29111b[_0xb7d0('0x46')]['id']){delete _0x29111b[_0xb7d0('0x46')]['id'];}return db[_0xb7d0('0x3d')][_0xb7d0('0x47')]({'where':{'id':_0x29111b['params']['id']}})[_0xb7d0('0x3f')](handleEntityNotFound(_0x58f359,null))['then'](saveUpdates(_0x29111b[_0xb7d0('0x46')],null))[_0xb7d0('0x3f')](respondWithResult(_0x58f359,null))[_0xb7d0('0x41')](handleError(_0x58f359,null));};exports[_0xb7d0('0x20')]=function(_0x3676e9,_0x31ace2){return db['FreshsalesConfiguration'][_0xb7d0('0x47')]({'where':{'id':_0x3676e9[_0xb7d0('0x43')]['id']}})[_0xb7d0('0x3f')](handleEntityNotFound(_0x31ace2,null))['then'](removeEntity(_0x31ace2,null))['catch'](handleError(_0x31ace2,null));};exports['getSubjects']=function(_0x30dcdb,_0x4b4af4,_0x3e0e13){var _0x1528e9={};var _0x576057={};var _0x29f5c4;var _0x5e93b8;return db['FreshsalesConfiguration'][_0xb7d0('0x48')]({'where':{'id':_0x30dcdb[_0xb7d0('0x43')]['id']}})[_0xb7d0('0x3f')](handleEntityNotFound(_0x4b4af4,null))['then'](function(_0x271a07){if(_0x271a07){_0x29f5c4=_0x271a07;_0x576057[_0xb7d0('0x2a')]=_['keys'](db[_0xb7d0('0x49')][_0xb7d0('0x44')]);_0x576057['query']=_[_0xb7d0('0x2c')](_0x30dcdb['query']);_0x576057['filters']=_[_0xb7d0('0x2e')](_0x576057[_0xb7d0('0x2a')],_0x576057[_0xb7d0('0x2b')]);_0x1528e9['attributes']=_[_0xb7d0('0x2e')](_0x576057[_0xb7d0('0x2a')],qs['fields'](_0x30dcdb[_0xb7d0('0x2b')]['fields']));_0x1528e9[_0xb7d0('0x2f')]=_0x1528e9[_0xb7d0('0x2f')][_0xb7d0('0x31')]?_0x1528e9[_0xb7d0('0x2f')]:_0x576057['model'];_0x1528e9['order']=qs[_0xb7d0('0x35')](_0x30dcdb['query'][_0xb7d0('0x35')]);_0x1528e9[_0xb7d0('0x36')]=qs[_0xb7d0('0x2d')](_['pick'](_0x30dcdb[_0xb7d0('0x2b')],_0x576057[_0xb7d0('0x2d')]));if(_0x30dcdb[_0xb7d0('0x2b')][_0xb7d0('0x38')]){_0x1528e9['where']=_[_0xb7d0('0x39')](_0x1528e9[_0xb7d0('0x36')],{'$or':_[_0xb7d0('0x26')](_0x1528e9[_0xb7d0('0x2f')],function(_0x55267a){var _0x35b3ae={};_0x35b3ae[_0x55267a]={'$like':'%'+_0x30dcdb[_0xb7d0('0x2b')][_0xb7d0('0x38')]+'%'};return _0x35b3ae;})});}_0x1528e9=_[_0xb7d0('0x39')]({},_0x1528e9,_0x30dcdb['options']);return _0x29f5c4['getSubjects'](_0x1528e9);}})['then'](function(_0x3479f8){if(_0x3479f8){_0x5e93b8=_0x3479f8[_0xb7d0('0x31')];if(!_0x30dcdb['query'][_0xb7d0('0x32')]('nolimit')){_0x1528e9[_0xb7d0('0x19')]=qs[_0xb7d0('0x19')](_0x30dcdb[_0xb7d0('0x2b')][_0xb7d0('0x19')]);_0x1528e9[_0xb7d0('0x1b')]=qs['offset'](_0x30dcdb['query'][_0xb7d0('0x1b')]);}return _0x29f5c4[_0xb7d0('0x4a')](_0x1528e9);}})[_0xb7d0('0x3f')](function(_0x27c7ed){if(_0x27c7ed){return _0x27c7ed?{'count':_0x5e93b8,'rows':_0x27c7ed}:null;}})[_0xb7d0('0x3f')](respondWithResult(_0x4b4af4,null))[_0xb7d0('0x41')](handleError(_0x4b4af4,null));};exports[_0xb7d0('0x4b')]=function(_0x363eef,_0x211aad,_0x4b536e){var _0x5221a6={};var _0x45c10c={};var _0x4d798e;var _0x16bbbd;return db[_0xb7d0('0x3d')][_0xb7d0('0x48')]({'where':{'id':_0x363eef['params']['id']}})[_0xb7d0('0x3f')](handleEntityNotFound(_0x211aad,null))[_0xb7d0('0x3f')](function(_0x4bf596){if(_0x4bf596){_0x4d798e=_0x4bf596;_0x45c10c[_0xb7d0('0x2a')]=_['keys'](db['FreshsalesField'][_0xb7d0('0x44')]);_0x45c10c[_0xb7d0('0x2b')]=_[_0xb7d0('0x2c')](_0x363eef[_0xb7d0('0x2b')]);_0x45c10c[_0xb7d0('0x2d')]=_[_0xb7d0('0x2e')](_0x45c10c['model'],_0x45c10c[_0xb7d0('0x2b')]);_0x5221a6[_0xb7d0('0x2f')]=_['intersection'](_0x45c10c[_0xb7d0('0x2a')],qs['fields'](_0x363eef['query'][_0xb7d0('0x30')]));_0x5221a6[_0xb7d0('0x2f')]=_0x5221a6[_0xb7d0('0x2f')][_0xb7d0('0x31')]?_0x5221a6[_0xb7d0('0x2f')]:_0x45c10c[_0xb7d0('0x2a')];_0x5221a6[_0xb7d0('0x34')]=qs[_0xb7d0('0x35')](_0x363eef['query']['sort']);_0x5221a6[_0xb7d0('0x36')]=qs[_0xb7d0('0x2d')](_[_0xb7d0('0x37')](_0x363eef[_0xb7d0('0x2b')],_0x45c10c[_0xb7d0('0x2d')]));if(_0x363eef[_0xb7d0('0x2b')]['filter']){_0x5221a6['where']=_[_0xb7d0('0x39')](_0x5221a6['where'],{'$or':_[_0xb7d0('0x26')](_0x5221a6[_0xb7d0('0x2f')],function(_0x282a0c){var _0x420750={};_0x420750[_0x282a0c]={'$like':'%'+_0x363eef[_0xb7d0('0x2b')]['filter']+'%'};return _0x420750;})});}_0x5221a6=_['merge']({},_0x5221a6,_0x363eef[_0xb7d0('0x3a')]);return _0x4d798e[_0xb7d0('0x4b')](_0x5221a6);}})[_0xb7d0('0x3f')](function(_0x2ace6c){if(_0x2ace6c){_0x16bbbd=_0x2ace6c[_0xb7d0('0x31')];if(!_0x363eef[_0xb7d0('0x2b')][_0xb7d0('0x32')]('nolimit')){_0x5221a6[_0xb7d0('0x19')]=qs['limit'](_0x363eef['query']['limit']);_0x5221a6[_0xb7d0('0x1b')]=qs[_0xb7d0('0x1b')](_0x363eef[_0xb7d0('0x2b')][_0xb7d0('0x1b')]);}return _0x4d798e['getDescriptions'](_0x5221a6);}})[_0xb7d0('0x3f')](function(_0x58d469){if(_0x58d469){return _0x58d469?{'count':_0x16bbbd,'rows':_0x58d469}:null;}})[_0xb7d0('0x3f')](respondWithResult(_0x211aad,null))['catch'](handleError(_0x211aad,null));};exports[_0xb7d0('0x4c')]=function(_0x4118fd,_0x3a4ad0,_0x13cd0d){var _0x5d3671={};var _0x208b47={};var _0x5c5b59;var _0x13999e;return db[_0xb7d0('0x3d')]['findOne']({'where':{'id':_0x4118fd[_0xb7d0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a4ad0,null))[_0xb7d0('0x3f')](function(_0x2cbf77){if(_0x2cbf77){_0x5c5b59=_0x2cbf77;_0x208b47[_0xb7d0('0x2a')]=_[_0xb7d0('0x2c')](db['FreshsalesField'][_0xb7d0('0x44')]);_0x208b47[_0xb7d0('0x2b')]=_['keys'](_0x4118fd['query']);_0x208b47[_0xb7d0('0x2d')]=_['intersection'](_0x208b47['model'],_0x208b47[_0xb7d0('0x2b')]);_0x5d3671[_0xb7d0('0x2f')]=_[_0xb7d0('0x2e')](_0x208b47[_0xb7d0('0x2a')],qs[_0xb7d0('0x30')](_0x4118fd['query'][_0xb7d0('0x30')]));_0x5d3671['attributes']=_0x5d3671[_0xb7d0('0x2f')][_0xb7d0('0x31')]?_0x5d3671[_0xb7d0('0x2f')]:_0x208b47[_0xb7d0('0x2a')];_0x5d3671[_0xb7d0('0x34')]=qs['sort'](_0x4118fd[_0xb7d0('0x2b')][_0xb7d0('0x35')]);_0x5d3671[_0xb7d0('0x36')]=qs[_0xb7d0('0x2d')](_[_0xb7d0('0x37')](_0x4118fd[_0xb7d0('0x2b')],_0x208b47['filters']));if(_0x4118fd[_0xb7d0('0x2b')]['filter']){_0x5d3671['where']=_[_0xb7d0('0x39')](_0x5d3671[_0xb7d0('0x36')],{'$or':_[_0xb7d0('0x26')](_0x5d3671['attributes'],function(_0x927c69){var _0x5b87a0={};_0x5b87a0[_0x927c69]={'$like':'%'+_0x4118fd[_0xb7d0('0x2b')][_0xb7d0('0x38')]+'%'};return _0x5b87a0;})});}_0x5d3671=_[_0xb7d0('0x39')]({},_0x5d3671,_0x4118fd['options']);return _0x5c5b59[_0xb7d0('0x4c')](_0x5d3671);}})[_0xb7d0('0x3f')](function(_0x346ce4){if(_0x346ce4){_0x13999e=_0x346ce4[_0xb7d0('0x31')];if(!_0x4118fd[_0xb7d0('0x2b')][_0xb7d0('0x32')](_0xb7d0('0x33'))){_0x5d3671[_0xb7d0('0x19')]=qs['limit'](_0x4118fd[_0xb7d0('0x2b')]['limit']);_0x5d3671[_0xb7d0('0x1b')]=qs[_0xb7d0('0x1b')](_0x4118fd[_0xb7d0('0x2b')][_0xb7d0('0x1b')]);}return _0x5c5b59[_0xb7d0('0x4c')](_0x5d3671);}})[_0xb7d0('0x3f')](function(_0xc1f2d9){if(_0xc1f2d9){return _0xc1f2d9?{'count':_0x13999e,'rows':_0xc1f2d9}:null;}})[_0xb7d0('0x3f')](respondWithResult(_0x3a4ad0,null))['catch'](handleError(_0x3a4ad0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1b3495b..21d5684 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 _0x252a=['api','moment','request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x2ad656,_0x25c2fd){var _0x3f861f=function(_0x1e9e75){while(--_0x1e9e75){_0x2ad656['push'](_0x2ad656['shift']());}};_0x3f861f(++_0x25c2fd);}(_0x252a,0x81));var _0xa252=function(_0x4ba8ad,_0x573d37){_0x4ba8ad=_0x4ba8ad-0x0;var _0x203a0b=_0x252a[_0x4ba8ad];return _0x203a0b;};'use strict';var _=require(_0xa252('0x0'));var util=require(_0xa252('0x1'));var logger=require(_0xa252('0x2'))(_0xa252('0x3'));var moment=require(_0xa252('0x4'));var BPromise=require('bluebird');var rp=require(_0xa252('0x5'));var fs=require('fs');var path=require(_0xa252('0x6'));var rimraf=require(_0xa252('0x7'));var config=require(_0xa252('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x2a53dc,_0x7006a0){return _0x2a53dc[_0xa252('0x9')](_0xa252('0xa'),attributes,{'tableName':_0xa252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f1f=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x4f1f,0x190));var _0xf4f1=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x4f1f[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require(_0xf4f1('0x0'));var logger=require(_0xf4f1('0x1'))(_0xf4f1('0x2'));var moment=require(_0xf4f1('0x3'));var BPromise=require(_0xf4f1('0x4'));var rp=require(_0xf4f1('0x5'));var fs=require('fs');var path=require(_0xf4f1('0x6'));var rimraf=require(_0xf4f1('0x7'));var config=require('../../config/environment');var attributes=require(_0xf4f1('0x8'));module[_0xf4f1('0x9')]=function(_0xe0e2ae,_0x1799d5){return _0xe0e2ae['define'](_0xf4f1('0xa'),attributes,{'tableName':_0xf4f1('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 8dca3d7..9bac990 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 _0x5eca=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x5023cb,_0x5ae9a6){var _0x52c5d6=function(_0x4fe596){while(--_0x4fe596){_0x5023cb['push'](_0x5023cb['shift']());}};_0x52c5d6(++_0x5ae9a6);}(_0x5eca,0xb3));var _0xa5ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5eca[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xa5ec('0x0'));var moment=require(_0xa5ec('0x1'));var BPromise=require(_0xa5ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5ec('0x3'));var db=require(_0xa5ec('0x4'))['db'];var utils=require(_0xa5ec('0x5'));var logger=require('../../config/logger')(_0xa5ec('0x6'));var config=require(_0xa5ec('0x7'));var jayson=require(_0xa5ec('0x8'));var client=jayson['client'][_0xa5ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cec42,_0x17fedd,_0x1ac216){return new BPromise(function(_0x544f42,_0x2181f1){return client['request'](_0x2cec42,_0x1ac216)[_0xa5ec('0xa')](function(_0x53910b){logger['info'](_0xa5ec('0xb'),_0x17fedd,_0xa5ec('0xc'));logger[_0xa5ec('0xd')](_0xa5ec('0xe'),_0x17fedd,_0xa5ec('0xc'),JSON['stringify'](_0x53910b));if(_0x53910b['error']){if(_0x53910b[_0xa5ec('0xf')]['code']===0x1f4){logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);return _0x2181f1(_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);}logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x53910b['error']['message']);return _0x544f42(_0x53910b[_0xa5ec('0xf')][_0xa5ec('0x10')]);}else{logger[_0xa5ec('0x11')](_0xa5ec('0xb'),_0x17fedd,_0xa5ec('0xc'));_0x544f42(_0x53910b[_0xa5ec('0x12')]['message']);}})['catch'](function(_0x1de808){logger[_0xa5ec('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x17fedd,_0x1de808);_0x2181f1(_0x1de808);});});} \ No newline at end of file +var _0x5f34=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1092fa,_0x3ea119){var _0x307340=function(_0x406cf3){while(--_0x406cf3){_0x1092fa['push'](_0x1092fa['shift']());}};_0x307340(++_0x3ea119);}(_0x5f34,0xb8));var _0x45f3=function(_0x1e69a9,_0x3b0d38){_0x1e69a9=_0x1e69a9-0x0;var _0x3a278c=_0x5f34[_0x1e69a9];return _0x3a278c;};'use strict';var _=require(_0x45f3('0x0'));var util=require(_0x45f3('0x1'));var moment=require(_0x45f3('0x2'));var BPromise=require(_0x45f3('0x3'));var rs=require(_0x45f3('0x4'));var fs=require('fs');var Redis=require(_0x45f3('0x5'));var db=require(_0x45f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x45f3('0x7'))('rpc');var config=require(_0x45f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d0838,_0x1d7c91,_0x5906db){return new BPromise(function(_0xe2b343,_0x10d634){return client[_0x45f3('0xa')](_0x2d0838,_0x5906db)[_0x45f3('0xb')](function(_0x11d679){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1d7c91,_0x45f3('0xc'));logger['debug'](_0x45f3('0xd'),_0x1d7c91,_0x45f3('0xc'),JSON['stringify'](_0x11d679));if(_0x11d679[_0x45f3('0xe')]){if(_0x11d679[_0x45f3('0xe')][_0x45f3('0xf')]===0x1f4){logger['error'](_0x45f3('0x10'),_0x1d7c91,_0x11d679['error'][_0x45f3('0x11')]);return _0x10d634(_0x11d679['error']['message']);}logger[_0x45f3('0xe')](_0x45f3('0x10'),_0x1d7c91,_0x11d679['error']['message']);return _0xe2b343(_0x11d679[_0x45f3('0xe')][_0x45f3('0x11')]);}else{logger[_0x45f3('0x12')](_0x45f3('0x10'),_0x1d7c91,_0x45f3('0xc'));_0xe2b343(_0x11d679[_0x45f3('0x13')]['message']);}})[_0x45f3('0x14')](function(_0x5a9b2d){logger['error'](_0x45f3('0x10'),_0x1d7c91,_0x5a9b2d);_0x10d634(_0x5a9b2d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 59c1715..79a3d74 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 _0x35aa=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x4060ce,_0x3259a5){var _0x4bbecc=function(_0x3b573e){while(--_0x3b573e){_0x4060ce['push'](_0x4060ce['shift']());}};_0x4bbecc(++_0x3259a5);}(_0x35aa,0xbe));var _0xa35a=function(_0x2673bb,_0x292576){_0x2673bb=_0x2673bb-0x0;var _0x3edc1c=_0x35aa[_0x2673bb];return _0x3edc1c;};'use strict';var multer=require('multer');var util=require(_0xa35a('0x0'));var path=require(_0xa35a('0x1'));var timeout=require(_0xa35a('0x2'));var express=require(_0xa35a('0x3'));var router=express['Router']();var fs_extra=require(_0xa35a('0x4'));var auth=require(_0xa35a('0x5'));var interaction=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var controller=require(_0xa35a('0x8'));router[_0xa35a('0x9')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xb')]);router['get'](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0xd')]);router[_0xa35a('0xe')]('/',auth[_0xa35a('0xa')](),controller[_0xa35a('0xf')]);router[_0xa35a('0x10')](_0xa35a('0xc'),auth['isAuthenticated'](),controller[_0xa35a('0x11')]);router[_0xa35a('0x12')](_0xa35a('0xc'),auth[_0xa35a('0xa')](),controller['destroy']);module[_0xa35a('0x13')]=router; \ No newline at end of file +var _0x8696=['put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x462d2b,_0x1b67eb){var _0x3e1554=function(_0x108cf4){while(--_0x108cf4){_0x462d2b['push'](_0x462d2b['shift']());}};_0x3e1554(++_0x1b67eb);}(_0x8696,0x143));var _0x6869=function(_0x16287d,_0x15fdac){_0x16287d=_0x16287d-0x0;var _0x13c2c2=_0x8696[_0x16287d];return _0x13c2c2;};'use strict';var multer=require(_0x6869('0x0'));var util=require(_0x6869('0x1'));var path=require('path');var timeout=require(_0x6869('0x2'));var express=require('express');var router=express[_0x6869('0x3')]();var fs_extra=require(_0x6869('0x4'));var auth=require(_0x6869('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6869('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x6869('0x7')]('/',auth[_0x6869('0x8')](),controller['index']);router['get'](_0x6869('0x9'),auth[_0x6869('0x8')](),controller[_0x6869('0xa')]);router[_0x6869('0xb')]('/',auth[_0x6869('0x8')](),controller[_0x6869('0xc')]);router[_0x6869('0xd')]('/:id',auth[_0x6869('0x8')](),controller[_0x6869('0xe')]);router[_0x6869('0xf')](_0x6869('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 19c9bb0..bdfbdef 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 _0x98b3=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x491ded,_0x17abba){var _0x4ea2c9=function(_0x4013d3){while(--_0x4013d3){_0x491ded['push'](_0x491ded['shift']());}};_0x4ea2c9(++_0x17abba);}(_0x98b3,0x1ad));var _0x398b=function(_0x2cdab0,_0x54b1d8){_0x2cdab0=_0x2cdab0-0x0;var _0x499ff1=_0x98b3[_0x2cdab0];return _0x499ff1;};'use strict';var Sequelize=require(_0x398b('0x0'));module[_0x398b('0x1')]={'type':{'type':Sequelize[_0x398b('0x2')](_0x398b('0x3'),_0x398b('0x4'),_0x398b('0x5'),_0x398b('0x6'),_0x398b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x398b('0x8')]},'key':{'type':Sequelize[_0x398b('0x8')]},'keyType':{'type':Sequelize[_0x398b('0x2')](_0x398b('0x3'),_0x398b('0x4'),_0x398b('0x5'))},'keyContent':{'type':Sequelize[_0x398b('0x8')]},'idField':{'type':Sequelize[_0x398b('0x8')]},'nameField':{'type':Sequelize[_0x398b('0x8')]},'customField':{'type':Sequelize[_0x398b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x398b('0x8')]}}; \ No newline at end of file +var _0xb94e=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x68db69,_0x37e177){var _0x5df8ad=function(_0x16a894){while(--_0x16a894){_0x68db69['push'](_0x68db69['shift']());}};_0x5df8ad(++_0x37e177);}(_0xb94e,0xaa));var _0xeb94=function(_0x4b978a,_0x472e65){_0x4b978a=_0x4b978a-0x0;var _0x2dbd2c=_0xb94e[_0x4b978a];return _0x2dbd2c;};'use strict';var Sequelize=require(_0xeb94('0x0'));module[_0xeb94('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeb94('0x2'),_0xeb94('0x3'),_0xeb94('0x4'),'keyValue',_0xeb94('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xeb94('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xeb94('0x2'),_0xeb94('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xeb94('0x6')]},'idField':{'type':Sequelize[_0xeb94('0x6')]},'nameField':{'type':Sequelize[_0xeb94('0x6')]},'customField':{'type':Sequelize[_0xeb94('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb94('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5f06a60..2fb58c0 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 _0x48fc=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x4fa7b8,_0x147a39){var _0x2c811b=function(_0x33ad7e){while(--_0x33ad7e){_0x4fa7b8['push'](_0x4fa7b8['shift']());}};_0x2c811b(++_0x147a39);}(_0x48fc,0x102));var _0xc48f=function(_0x4e5fe9,_0x69af0c){_0x4e5fe9=_0x4e5fe9-0x0;var _0x5f3127=_0x48fc[_0x4e5fe9];return _0x5f3127;};'use strict';var emlformat=require(_0xc48f('0x0'));var rimraf=require(_0xc48f('0x1'));var zipdir=require(_0xc48f('0x2'));var jsonpatch=require(_0xc48f('0x3'));var rp=require('request-promise');var moment=require(_0xc48f('0x4'));var BPromise=require(_0xc48f('0x5'));var Mustache=require(_0xc48f('0x6'));var util=require(_0xc48f('0x7'));var path=require(_0xc48f('0x8'));var sox=require(_0xc48f('0x9'));var csv=require(_0xc48f('0xa'));var ejs=require(_0xc48f('0xb'));var fs=require('fs');var fs_extra=require(_0xc48f('0xc'));var _=require(_0xc48f('0xd'));var squel=require(_0xc48f('0xe'));var crypto=require(_0xc48f('0xf'));var jsforce=require(_0xc48f('0x10'));var deskjs=require(_0xc48f('0x11'));var toCsv=require(_0xc48f('0xa'));var querystring=require(_0xc48f('0x12'));var Papa=require(_0xc48f('0x13'));var Redis=require('ioredis');var authService=require(_0xc48f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc48f('0x15'));var logger=require(_0xc48f('0x16'))(_0xc48f('0x17'));var utils=require('../../config/utils');var config=require(_0xc48f('0x18'));var licenseUtil=require(_0xc48f('0x19'));var db=require(_0xc48f('0x1a'))['db'];function respondWithStatusCode(_0x2542b0,_0x3614cd){_0x3614cd=_0x3614cd||0xcc;return function(_0xe70dd0){if(_0xe70dd0){return _0x2542b0['sendStatus'](_0x3614cd);}return _0x2542b0[_0xc48f('0x1b')](_0x3614cd)['end']();};}function respondWithResult(_0x14381d,_0x13b87c){_0x13b87c=_0x13b87c||0xc8;return function(_0x19e168){if(_0x19e168){return _0x14381d[_0xc48f('0x1b')](_0x13b87c)['json'](_0x19e168);}};}function respondWithFilteredResult(_0x5d568b,_0x42bb37){return function(_0x56acf0){if(_0x56acf0){var _0x418023=typeof _0x42bb37[_0xc48f('0x1c')]===_0xc48f('0x1d')&&typeof _0x42bb37[_0xc48f('0x1e')]==='undefined';var _0x1529fe=_0x56acf0[_0xc48f('0x1f')];var _0x1d4a24=_0x418023?0x0:_0x42bb37[_0xc48f('0x1c')];var _0x3dacd6=_0x418023?_0x56acf0['count']:_0x42bb37[_0xc48f('0x1c')]+_0x42bb37[_0xc48f('0x1e')];var _0x1351c2;if(_0x3dacd6>=_0x1529fe){_0x3dacd6=_0x1529fe;_0x1351c2=0xc8;}else{_0x1351c2=0xce;}_0x5d568b[_0xc48f('0x1b')](_0x1351c2);return _0x5d568b[_0xc48f('0x20')]('Content-Range',_0x1d4a24+'-'+_0x3dacd6+'/'+_0x1529fe)[_0xc48f('0x21')](_0x56acf0);}return null;};}function patchUpdates(_0x543796){return function(_0x280169){try{jsonpatch[_0xc48f('0x22')](_0x280169,_0x543796,!![]);}catch(_0x3e793b){return BPromise[_0xc48f('0x23')](_0x3e793b);}return _0x280169['save']();};}function saveUpdates(_0x39e587,_0x59e2c2){return function(_0x54ef30){if(_0x54ef30){return _0x54ef30[_0xc48f('0x24')](_0x39e587)[_0xc48f('0x25')](function(_0x2a3fa1){return _0x2a3fa1;});}return null;};}function removeEntity(_0x26e09b,_0x4c5f53){return function(_0x2c6513){if(_0x2c6513){return _0x2c6513[_0xc48f('0x26')]()[_0xc48f('0x25')](function(){_0x26e09b[_0xc48f('0x1b')](0xcc)[_0xc48f('0x27')]();});}};}function handleEntityNotFound(_0x1e87c2,_0x43378a){return function(_0x907ef9){if(!_0x907ef9){_0x1e87c2[_0xc48f('0x28')](0x194);}return _0x907ef9;};}function handleError(_0x1c8089,_0x5617b0){_0x5617b0=_0x5617b0||0x1f4;return function(_0x4f6623){logger[_0xc48f('0x29')](_0x4f6623['stack']);if(_0x4f6623['name']){delete _0x4f6623[_0xc48f('0x2a')];}_0x1c8089[_0xc48f('0x1b')](_0x5617b0)[_0xc48f('0x2b')](_0x4f6623);};}exports[_0xc48f('0x2c')]=function(_0x12065c,_0x82558a){var _0x543b30={},_0x4be1b3={},_0x142cb0={'count':0x0,'rows':[]};var _0x2bfecf=_['map'](db['FreshsalesField'][_0xc48f('0x2d')],function(_0x418b93){return{'name':_0x418b93[_0xc48f('0x2e')],'type':_0x418b93[_0xc48f('0x2f')][_0xc48f('0x30')]};});_0x4be1b3[_0xc48f('0x31')]=_[_0xc48f('0x32')](_0x2bfecf,_0xc48f('0x2a'));_0x4be1b3[_0xc48f('0x33')]=_[_0xc48f('0x34')](_0x12065c[_0xc48f('0x33')]);_0x4be1b3['filters']=_[_0xc48f('0x35')](_0x4be1b3[_0xc48f('0x31')],_0x4be1b3[_0xc48f('0x33')]);_0x543b30['attributes']=_[_0xc48f('0x35')](_0x4be1b3[_0xc48f('0x31')],qs[_0xc48f('0x36')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x36')]));_0x543b30[_0xc48f('0x37')]=_0x543b30[_0xc48f('0x37')][_0xc48f('0x38')]?_0x543b30['attributes']:_0x4be1b3[_0xc48f('0x31')];if(!_0x12065c['query'][_0xc48f('0x39')](_0xc48f('0x3a'))){_0x543b30[_0xc48f('0x1e')]=qs[_0xc48f('0x1e')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x1e')]);_0x543b30[_0xc48f('0x1c')]=qs[_0xc48f('0x1c')](_0x12065c[_0xc48f('0x33')][_0xc48f('0x1c')]);}_0x543b30[_0xc48f('0x3b')]=qs['sort'](_0x12065c[_0xc48f('0x33')][_0xc48f('0x3c')]);_0x543b30[_0xc48f('0x3d')]=qs[_0xc48f('0x3e')](_[_0xc48f('0x3f')](_0x12065c[_0xc48f('0x33')],_0x4be1b3[_0xc48f('0x3e')]),_0x2bfecf);if(_0x12065c['query'][_0xc48f('0x40')]){_0x543b30[_0xc48f('0x3d')]=_['merge'](_0x543b30[_0xc48f('0x3d')],{'$or':_[_0xc48f('0x32')](_0x2bfecf,function(_0x677ed7){if(_0x677ed7[_0xc48f('0x2f')]!=='VIRTUAL'){var _0xf9f347={};_0xf9f347[_0x677ed7[_0xc48f('0x2a')]]={'$like':'%'+_0x12065c[_0xc48f('0x33')][_0xc48f('0x40')]+'%'};return _0xf9f347;}})});}_0x543b30=_[_0xc48f('0x41')]({},_0x543b30,_0x12065c[_0xc48f('0x42')]);var _0xaa960a={'where':_0x543b30['where']};return db[_0xc48f('0x43')][_0xc48f('0x1f')](_0xaa960a)['then'](function(_0xa807af){_0x142cb0['count']=_0xa807af;if(_0x12065c[_0xc48f('0x33')][_0xc48f('0x44')]){_0x543b30[_0xc48f('0x45')]=[{'all':!![]}];}return db[_0xc48f('0x43')][_0xc48f('0x46')](_0x543b30);})[_0xc48f('0x25')](function(_0x69daa2){_0x142cb0[_0xc48f('0x47')]=_0x69daa2;return _0x142cb0;})[_0xc48f('0x25')](respondWithFilteredResult(_0x82558a,_0x543b30))[_0xc48f('0x48')](handleError(_0x82558a,null));};exports[_0xc48f('0x49')]=function(_0x380ed0,_0x30e670){var _0xe36ab8={'raw':!![],'where':{'id':_0x380ed0[_0xc48f('0x4a')]['id']}},_0x1e598e={};_0x1e598e[_0xc48f('0x31')]=_[_0xc48f('0x34')](db[_0xc48f('0x43')]['rawAttributes']);_0x1e598e[_0xc48f('0x33')]=_[_0xc48f('0x34')](_0x380ed0[_0xc48f('0x33')]);_0x1e598e[_0xc48f('0x3e')]=_[_0xc48f('0x35')](_0x1e598e['model'],_0x1e598e[_0xc48f('0x33')]);_0xe36ab8[_0xc48f('0x37')]=_['intersection'](_0x1e598e[_0xc48f('0x31')],qs[_0xc48f('0x36')](_0x380ed0[_0xc48f('0x33')][_0xc48f('0x36')]));_0xe36ab8[_0xc48f('0x37')]=_0xe36ab8['attributes'][_0xc48f('0x38')]?_0xe36ab8[_0xc48f('0x37')]:_0x1e598e[_0xc48f('0x31')];if(_0x380ed0[_0xc48f('0x33')][_0xc48f('0x44')]){_0xe36ab8[_0xc48f('0x45')]=[{'all':!![]}];}_0xe36ab8=_[_0xc48f('0x41')]({},_0xe36ab8,_0x380ed0[_0xc48f('0x42')]);return db[_0xc48f('0x43')][_0xc48f('0x4b')](_0xe36ab8)['then'](handleEntityNotFound(_0x30e670,null))[_0xc48f('0x25')](respondWithResult(_0x30e670,null))[_0xc48f('0x48')](handleError(_0x30e670,null));};exports[_0xc48f('0x4c')]=function(_0x1ecc14,_0x5b6c7d){return db[_0xc48f('0x43')][_0xc48f('0x4c')](_0x1ecc14['body'],{})['then'](respondWithResult(_0x5b6c7d,0xc9))['catch'](handleError(_0x5b6c7d,null));};exports['update']=function(_0x59910b,_0x5aa342){if(_0x59910b[_0xc48f('0x4d')]['id']){delete _0x59910b[_0xc48f('0x4d')]['id'];}return db['FreshsalesField'][_0xc48f('0x4b')]({'where':{'id':_0x59910b[_0xc48f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5aa342,null))[_0xc48f('0x25')](saveUpdates(_0x59910b['body'],null))[_0xc48f('0x25')](respondWithResult(_0x5aa342,null))[_0xc48f('0x48')](handleError(_0x5aa342,null));};exports['destroy']=function(_0x523dd2,_0x566758){return db[_0xc48f('0x43')][_0xc48f('0x4b')]({'where':{'id':_0x523dd2['params']['id']}})[_0xc48f('0x25')](handleEntityNotFound(_0x566758,null))[_0xc48f('0x25')](removeEntity(_0x566758,null))['catch'](handleError(_0x566758,null));}; \ No newline at end of file +var _0xb398=['../../config/logger','api','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','FreshsalesField','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x27d7ad,_0x1bc731){var _0xa1cb0b=function(_0x160214){while(--_0x160214){_0x27d7ad['push'](_0x27d7ad['shift']());}};_0xa1cb0b(++_0x1bc731);}(_0xb398,0x1da));var _0x8b39=function(_0x35c94a,_0x37ed53){_0x35c94a=_0x35c94a-0x0;var _0x13148a=_0xb398[_0x35c94a];return _0x13148a;};'use strict';var emlformat=require(_0x8b39('0x0'));var rimraf=require(_0x8b39('0x1'));var zipdir=require(_0x8b39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b39('0x4'));var util=require(_0x8b39('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8b39('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b39('0x7'));var _=require('lodash');var squel=require(_0x8b39('0x8'));var crypto=require(_0x8b39('0x9'));var jsforce=require(_0x8b39('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8b39('0x6'));var querystring=require('querystring');var Papa=require(_0x8b39('0xb'));var Redis=require('ioredis');var authService=require(_0x8b39('0xc'));var qs=require(_0x8b39('0xd'));var as=require(_0x8b39('0xe'));var hardwareService=require(_0x8b39('0xf'));var logger=require(_0x8b39('0x10'))(_0x8b39('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b39('0x12'))['db'];function respondWithStatusCode(_0x4d63f6,_0x54b2f8){_0x54b2f8=_0x54b2f8||0xcc;return function(_0x3e180f){if(_0x3e180f){return _0x4d63f6[_0x8b39('0x13')](_0x54b2f8);}return _0x4d63f6['status'](_0x54b2f8)['end']();};}function respondWithResult(_0x57680c,_0x447a8c){_0x447a8c=_0x447a8c||0xc8;return function(_0x749592){if(_0x749592){return _0x57680c[_0x8b39('0x14')](_0x447a8c)['json'](_0x749592);}};}function respondWithFilteredResult(_0x129cb8,_0x5df51f){return function(_0x217b83){if(_0x217b83){var _0x519912=typeof _0x5df51f['offset']==='undefined'&&typeof _0x5df51f[_0x8b39('0x15')]===_0x8b39('0x16');var _0x26e559=_0x217b83[_0x8b39('0x17')];var _0xf21445=_0x519912?0x0:_0x5df51f[_0x8b39('0x18')];var _0x2821a1=_0x519912?_0x217b83[_0x8b39('0x17')]:_0x5df51f[_0x8b39('0x18')]+_0x5df51f[_0x8b39('0x15')];var _0x46ba6b;if(_0x2821a1>=_0x26e559){_0x2821a1=_0x26e559;_0x46ba6b=0xc8;}else{_0x46ba6b=0xce;}_0x129cb8['status'](_0x46ba6b);return _0x129cb8[_0x8b39('0x19')](_0x8b39('0x1a'),_0xf21445+'-'+_0x2821a1+'/'+_0x26e559)[_0x8b39('0x1b')](_0x217b83);}return null;};}function patchUpdates(_0x1d34d7){return function(_0x2661d8){try{jsonpatch[_0x8b39('0x1c')](_0x2661d8,_0x1d34d7,!![]);}catch(_0x48b00f){return BPromise[_0x8b39('0x1d')](_0x48b00f);}return _0x2661d8['save']();};}function saveUpdates(_0x4a151d,_0x1693c1){return function(_0x497ace){if(_0x497ace){return _0x497ace[_0x8b39('0x1e')](_0x4a151d)[_0x8b39('0x1f')](function(_0x363d03){return _0x363d03;});}return null;};}function removeEntity(_0xa43e15,_0x38c777){return function(_0x16059a){if(_0x16059a){return _0x16059a[_0x8b39('0x20')]()[_0x8b39('0x1f')](function(){_0xa43e15['status'](0xcc)[_0x8b39('0x21')]();});}};}function handleEntityNotFound(_0x3484f7,_0x519cf){return function(_0x5dafad){if(!_0x5dafad){_0x3484f7[_0x8b39('0x13')](0x194);}return _0x5dafad;};}function handleError(_0x34bf4a,_0x2d7779){_0x2d7779=_0x2d7779||0x1f4;return function(_0xcaba4d){logger[_0x8b39('0x22')](_0xcaba4d[_0x8b39('0x23')]);if(_0xcaba4d[_0x8b39('0x24')]){delete _0xcaba4d[_0x8b39('0x24')];}_0x34bf4a['status'](_0x2d7779)[_0x8b39('0x25')](_0xcaba4d);};}exports[_0x8b39('0x26')]=function(_0x4ff6fa,_0x47aa16){var _0x302630={},_0x1f4751={},_0x2e2f5d={'count':0x0,'rows':[]};var _0x44bcbb=_[_0x8b39('0x27')](db['FreshsalesField']['rawAttributes'],function(_0xff3338){return{'name':_0xff3338[_0x8b39('0x28')],'type':_0xff3338['type'][_0x8b39('0x29')]};});_0x1f4751[_0x8b39('0x2a')]=_[_0x8b39('0x27')](_0x44bcbb,_0x8b39('0x24'));_0x1f4751['query']=_['keys'](_0x4ff6fa[_0x8b39('0x2b')]);_0x1f4751[_0x8b39('0x2c')]=_[_0x8b39('0x2d')](_0x1f4751[_0x8b39('0x2a')],_0x1f4751[_0x8b39('0x2b')]);_0x302630['attributes']=_['intersection'](_0x1f4751[_0x8b39('0x2a')],qs['fields'](_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x2e')]));_0x302630['attributes']=_0x302630[_0x8b39('0x2f')]['length']?_0x302630[_0x8b39('0x2f')]:_0x1f4751[_0x8b39('0x2a')];if(!_0x4ff6fa['query']['hasOwnProperty'](_0x8b39('0x30'))){_0x302630[_0x8b39('0x15')]=qs['limit'](_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x15')]);_0x302630[_0x8b39('0x18')]=qs[_0x8b39('0x18')](_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x18')]);}_0x302630[_0x8b39('0x31')]=qs[_0x8b39('0x32')](_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x32')]);_0x302630['where']=qs['filters'](_[_0x8b39('0x33')](_0x4ff6fa['query'],_0x1f4751[_0x8b39('0x2c')]),_0x44bcbb);if(_0x4ff6fa['query'][_0x8b39('0x34')]){_0x302630[_0x8b39('0x35')]=_[_0x8b39('0x36')](_0x302630[_0x8b39('0x35')],{'$or':_['map'](_0x44bcbb,function(_0x3acf2f){if(_0x3acf2f[_0x8b39('0x37')]!==_0x8b39('0x38')){var _0x5557cf={};_0x5557cf[_0x3acf2f[_0x8b39('0x24')]]={'$like':'%'+_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x34')]+'%'};return _0x5557cf;}})});}_0x302630=_[_0x8b39('0x36')]({},_0x302630,_0x4ff6fa['options']);var _0xb9af6c={'where':_0x302630[_0x8b39('0x35')]};return db[_0x8b39('0x39')]['count'](_0xb9af6c)[_0x8b39('0x1f')](function(_0x38777d){_0x2e2f5d[_0x8b39('0x17')]=_0x38777d;if(_0x4ff6fa[_0x8b39('0x2b')][_0x8b39('0x3a')]){_0x302630[_0x8b39('0x3b')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x302630);})[_0x8b39('0x1f')](function(_0x4093a9){_0x2e2f5d[_0x8b39('0x3c')]=_0x4093a9;return _0x2e2f5d;})[_0x8b39('0x1f')](respondWithFilteredResult(_0x47aa16,_0x302630))[_0x8b39('0x3d')](handleError(_0x47aa16,null));};exports[_0x8b39('0x3e')]=function(_0x7ec727,_0x20e0f9){var _0x3ce93d={'raw':!![],'where':{'id':_0x7ec727[_0x8b39('0x3f')]['id']}},_0x329e9c={};_0x329e9c[_0x8b39('0x2a')]=_['keys'](db[_0x8b39('0x39')]['rawAttributes']);_0x329e9c[_0x8b39('0x2b')]=_[_0x8b39('0x40')](_0x7ec727['query']);_0x329e9c[_0x8b39('0x2c')]=_[_0x8b39('0x2d')](_0x329e9c[_0x8b39('0x2a')],_0x329e9c[_0x8b39('0x2b')]);_0x3ce93d[_0x8b39('0x2f')]=_[_0x8b39('0x2d')](_0x329e9c[_0x8b39('0x2a')],qs[_0x8b39('0x2e')](_0x7ec727[_0x8b39('0x2b')]['fields']));_0x3ce93d[_0x8b39('0x2f')]=_0x3ce93d['attributes'][_0x8b39('0x41')]?_0x3ce93d[_0x8b39('0x2f')]:_0x329e9c[_0x8b39('0x2a')];if(_0x7ec727[_0x8b39('0x2b')][_0x8b39('0x3a')]){_0x3ce93d[_0x8b39('0x3b')]=[{'all':!![]}];}_0x3ce93d=_[_0x8b39('0x36')]({},_0x3ce93d,_0x7ec727[_0x8b39('0x42')]);return db[_0x8b39('0x39')][_0x8b39('0x43')](_0x3ce93d)[_0x8b39('0x1f')](handleEntityNotFound(_0x20e0f9,null))[_0x8b39('0x1f')](respondWithResult(_0x20e0f9,null))[_0x8b39('0x3d')](handleError(_0x20e0f9,null));};exports[_0x8b39('0x44')]=function(_0x1a8b39,_0x8c31de){return db[_0x8b39('0x39')]['create'](_0x1a8b39[_0x8b39('0x45')],{})[_0x8b39('0x1f')](respondWithResult(_0x8c31de,0xc9))['catch'](handleError(_0x8c31de,null));};exports[_0x8b39('0x1e')]=function(_0x53f53d,_0x3baeb0){if(_0x53f53d['body']['id']){delete _0x53f53d[_0x8b39('0x45')]['id'];}return db['FreshsalesField'][_0x8b39('0x43')]({'where':{'id':_0x53f53d[_0x8b39('0x3f')]['id']}})[_0x8b39('0x1f')](handleEntityNotFound(_0x3baeb0,null))[_0x8b39('0x1f')](saveUpdates(_0x53f53d[_0x8b39('0x45')],null))[_0x8b39('0x1f')](respondWithResult(_0x3baeb0,null))['catch'](handleError(_0x3baeb0,null));};exports[_0x8b39('0x20')]=function(_0x555709,_0x317bb3){return db[_0x8b39('0x39')][_0x8b39('0x43')]({'where':{'id':_0x555709[_0x8b39('0x3f')]['id']}})[_0x8b39('0x1f')](handleEntityNotFound(_0x317bb3,null))[_0x8b39('0x1f')](removeEntity(_0x317bb3,null))[_0x8b39('0x3d')](handleError(_0x317bb3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 51830db..78073a1 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 _0x337f=['bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x18dab5,_0xb76cc5){var _0x28a919=function(_0x54562a){while(--_0x54562a){_0x18dab5['push'](_0x18dab5['shift']());}};_0x28a919(++_0xb76cc5);}(_0x337f,0x11c));var _0xf337=function(_0x584a05,_0x4528ce){_0x584a05=_0x584a05-0x0;var _0x2d414d=_0x337f[_0x584a05];return _0x2d414d;};'use strict';var _=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var logger=require(_0xf337('0x2'))('api');var moment=require(_0xf337('0x3'));var BPromise=require(_0xf337('0x4'));var rp=require(_0xf337('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0xf337('0x8')]=function(_0x485b2a,_0x4580a3){return _0x485b2a['define'](_0xf337('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf337('0xa'),_0xf337('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf60=['../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util'];(function(_0x28e3ae,_0x1f5ad7){var _0x2ec91d=function(_0x56ec03){while(--_0x56ec03){_0x28e3ae['push'](_0x28e3ae['shift']());}};_0x2ec91d(++_0x1f5ad7);}(_0xaf60,0x82));var _0x0af6=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xaf60[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));module[_0x0af6('0x7')]=function(_0x463023,_0x333ce1){return _0x463023[_0x0af6('0x8')]('FreshsalesField',attributes,{'tableName':_0x0af6('0x9'),'paranoid':![],'indexes':[{'name':_0x0af6('0xa'),'fields':['idField',_0x0af6('0xb')],'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 0ef61f2..8daa932 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 _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2254a0,_0x41f33e){var _0x35cd31=function(_0x5242d5){while(--_0x5242d5){_0x2254a0['push'](_0x2254a0['shift']());}};_0x35cd31(++_0x41f33e);}(_0x5d58,0x187));var _0x85d5=function(_0x5e4612,_0x433f67){_0x5e4612=_0x5e4612-0x0;var _0x5c22fd=_0x5d58[_0x5e4612];return _0x5c22fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x397628,_0x373823){var _0x63b7cd=function(_0x54542c){while(--_0x54542c){_0x397628['push'](_0x397628['shift']());}};_0x63b7cd(++_0x373823);}(_0x5496,0x175));var _0x6549=function(_0x5876b4,_0x347afb){_0x5876b4=_0x5876b4-0x0;var _0x308746=_0x5496[_0x5876b4];return _0x308746;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9036b8e..9e2417d 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(_0x5d4571,_0x15eeef){var _0xff47eb=function(_0x203e7e){while(--_0x203e7e){_0x5d4571['push'](_0x5d4571['shift']());}};_0xff47eb(++_0x15eeef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x201f93,_0x124330){var _0xdee2ab=function(_0x340816){while(--_0x340816){_0x201f93['push'](_0x201f93['shift']());}};_0xdee2ab(++_0x124330);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c96ac72..065b9eb 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 _0x937d=['sequelize','STRING','username','ENUM','integrationTab'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x937d,0x1f4));var _0xd937=function(_0x15f059,_0x230760){_0x15f059=_0x15f059-0x0;var _0x5188e4=_0x937d[_0x15f059];return _0x5188e4;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd937('0x1')],'unique':_0xd937('0x2')},'remoteUri':{'type':Sequelize[_0xd937('0x1')]},'password':{'type':Sequelize[_0xd937('0x1')]},'clientId':{'type':Sequelize[_0xd937('0x1')]},'clientSecret':{'type':Sequelize[_0xd937('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd937('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd937('0x3')](_0xd937('0x4'),'newTab'),'defaultValue':_0xd937('0x4')}}; \ No newline at end of file +var _0xcbe2=['username','ENUM','integrationTab','sequelize','STRING'];(function(_0x58d1ef,_0x541359){var _0x34ef2e=function(_0x4cb42f){while(--_0x4cb42f){_0x58d1ef['push'](_0x58d1ef['shift']());}};_0x34ef2e(++_0x541359);}(_0xcbe2,0x148));var _0x2cbe=function(_0x43cf99,_0xe1b67c){_0x43cf99=_0x43cf99-0x0;var _0x5893df=_0xcbe2[_0x43cf99];return _0x5893df;};'use strict';var Sequelize=require(_0x2cbe('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2cbe('0x1')]},'username':{'type':Sequelize[_0x2cbe('0x1')],'unique':_0x2cbe('0x2')},'remoteUri':{'type':Sequelize[_0x2cbe('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2cbe('0x1')]},'clientSecret':{'type':Sequelize[_0x2cbe('0x1')]},'securityToken':{'type':Sequelize[_0x2cbe('0x1')]},'serverUrl':{'type':Sequelize[_0x2cbe('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2cbe('0x3')](_0x2cbe('0x4'),'newTab'),'defaultValue':_0x2cbe('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6bde7c2..f8128d2 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 _0x4dab=['order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','password','slice','substring','lastIndexOf','clientSecret','login','username','securityToken','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','phone','remove','includes','custom','picklistValues','label','value','true','False','false','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','SalesforceAccount','includeAll','include','findAll','rows','show','options','find','create','catch','update','body','params','getConfigurations','findOne','SalesforceConfiguration'];(function(_0x191d70,_0x18c726){var _0x2133fa=function(_0x1cdad5){while(--_0x1cdad5){_0x191d70['push'](_0x191d70['shift']());}};_0x2133fa(++_0x18c726);}(_0x4dab,0xad));var _0xb4da=function(_0x56f220,_0x9e6544){_0x56f220=_0x56f220-0x0;var _0x187aaa=_0x4dab[_0x56f220];return _0x187aaa;};'use strict';var emlformat=require(_0xb4da('0x0'));var rimraf=require(_0xb4da('0x1'));var zipdir=require(_0xb4da('0x2'));var jsonpatch=require(_0xb4da('0x3'));var rp=require(_0xb4da('0x4'));var moment=require(_0xb4da('0x5'));var BPromise=require(_0xb4da('0x6'));var Mustache=require(_0xb4da('0x7'));var util=require(_0xb4da('0x8'));var path=require(_0xb4da('0x9'));var sox=require(_0xb4da('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4da('0xb'));var _=require(_0xb4da('0xc'));var squel=require(_0xb4da('0xd'));var crypto=require(_0xb4da('0xe'));var jsforce=require(_0xb4da('0xf'));var deskjs=require(_0xb4da('0x10'));var toCsv=require(_0xb4da('0x11'));var querystring=require('querystring');var Papa=require(_0xb4da('0x12'));var Redis=require(_0xb4da('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb4da('0x14'));var as=require(_0xb4da('0x15'));var hardwareService=require(_0xb4da('0x16'));var logger=require(_0xb4da('0x17'))('api');var utils=require(_0xb4da('0x18'));var config=require(_0xb4da('0x19'));var licenseUtil=require(_0xb4da('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb4da('0x1b'));function respondWithStatusCode(_0x344ffa,_0x552adb){_0x552adb=_0x552adb||0xcc;return function(_0x59a600){if(_0x59a600){return _0x344ffa[_0xb4da('0x1c')](_0x552adb);}return _0x344ffa[_0xb4da('0x1d')](_0x552adb)[_0xb4da('0x1e')]();};}function respondWithResult(_0x31a4bb,_0x7c994b){_0x7c994b=_0x7c994b||0xc8;return function(_0x45c9af){if(_0x45c9af){return _0x31a4bb[_0xb4da('0x1d')](_0x7c994b)[_0xb4da('0x1f')](_0x45c9af);}};}function respondWithFilteredResult(_0x451798,_0xc5fb72){return function(_0x5d48b3){if(_0x5d48b3){var _0x3219f2=typeof _0xc5fb72[_0xb4da('0x20')]===_0xb4da('0x21')&&typeof _0xc5fb72['limit']===_0xb4da('0x21');var _0x2a5279=_0x5d48b3[_0xb4da('0x22')];var _0x878508=_0x3219f2?0x0:_0xc5fb72['offset'];var _0x38bb1=_0x3219f2?_0x5d48b3['count']:_0xc5fb72[_0xb4da('0x20')]+_0xc5fb72[_0xb4da('0x23')];var _0x215d9e;if(_0x38bb1>=_0x2a5279){_0x38bb1=_0x2a5279;_0x215d9e=0xc8;}else{_0x215d9e=0xce;}_0x451798[_0xb4da('0x1d')](_0x215d9e);return _0x451798[_0xb4da('0x24')](_0xb4da('0x25'),_0x878508+'-'+_0x38bb1+'/'+_0x2a5279)['json'](_0x5d48b3);}return null;};}function patchUpdates(_0x18f843){return function(_0x62918f){try{jsonpatch[_0xb4da('0x26')](_0x62918f,_0x18f843,!![]);}catch(_0x4cb726){return BPromise[_0xb4da('0x27')](_0x4cb726);}return _0x62918f['save']();};}function saveUpdates(_0x25bae4,_0x5abf4e){return function(_0x4d1134){if(_0x4d1134){return _0x4d1134['update'](_0x25bae4)[_0xb4da('0x28')](function(_0x4acbee){return _0x4acbee;});}return null;};}function removeEntity(_0x1cdbcb,_0x2ce684){return function(_0x2dcd5c){if(_0x2dcd5c){return _0x2dcd5c[_0xb4da('0x29')]()[_0xb4da('0x28')](function(){_0x1cdbcb[_0xb4da('0x1d')](0xcc)[_0xb4da('0x1e')]();});}};}function handleEntityNotFound(_0x1f1886,_0x42f96b){return function(_0x22d2a9){if(!_0x22d2a9){_0x1f1886[_0xb4da('0x1c')](0x194);}return _0x22d2a9;};}function handleError(_0x5c8594,_0x39e7e9){_0x39e7e9=_0x39e7e9||0x1f4;return function(_0x444996){logger[_0xb4da('0x2a')](_0x444996['stack']);if(_0x444996[_0xb4da('0x2b')]){delete _0x444996['name'];}_0x5c8594[_0xb4da('0x1d')](_0x39e7e9)[_0xb4da('0x2c')](_0x444996);};}exports[_0xb4da('0x2d')]=function(_0x1ba154,_0x30c232){var _0x1492d6={},_0x3278c5={},_0x43092f={'count':0x0,'rows':[]};var _0x2ef16c=_[_0xb4da('0x2e')](db['SalesforceAccount'][_0xb4da('0x2f')],function(_0x10c003){return{'name':_0x10c003['fieldName'],'type':_0x10c003[_0xb4da('0x30')][_0xb4da('0x31')]};});_0x3278c5[_0xb4da('0x32')]=_[_0xb4da('0x2e')](_0x2ef16c,_0xb4da('0x2b'));_0x3278c5['query']=_[_0xb4da('0x33')](_0x1ba154[_0xb4da('0x34')]);_0x3278c5[_0xb4da('0x35')]=_[_0xb4da('0x36')](_0x3278c5[_0xb4da('0x32')],_0x3278c5[_0xb4da('0x34')]);_0x1492d6[_0xb4da('0x37')]=_['intersection'](_0x3278c5[_0xb4da('0x32')],qs[_0xb4da('0x38')](_0x1ba154[_0xb4da('0x34')]['fields']));_0x1492d6[_0xb4da('0x37')]=_0x1492d6['attributes'][_0xb4da('0x39')]?_0x1492d6['attributes']:_0x3278c5[_0xb4da('0x32')];if(!_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3a')](_0xb4da('0x3b'))){_0x1492d6[_0xb4da('0x23')]=qs[_0xb4da('0x23')](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x23')]);_0x1492d6['offset']=qs[_0xb4da('0x20')](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x20')]);}_0x1492d6['order']=qs['sort'](_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3c')]);_0x1492d6['where']=qs[_0xb4da('0x35')](_[_0xb4da('0x3d')](_0x1ba154[_0xb4da('0x34')],_0x3278c5[_0xb4da('0x35')]),_0x2ef16c);if(_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3e')]){_0x1492d6[_0xb4da('0x3f')]=_[_0xb4da('0x40')](_0x1492d6[_0xb4da('0x3f')],{'$or':_[_0xb4da('0x2e')](_0x2ef16c,function(_0x3bffce){if(_0x3bffce[_0xb4da('0x30')]!=='VIRTUAL'){var _0x4f0776={};_0x4f0776[_0x3bffce[_0xb4da('0x2b')]]={'$like':'%'+_0x1ba154[_0xb4da('0x34')][_0xb4da('0x3e')]+'%'};return _0x4f0776;}})});}_0x1492d6=_[_0xb4da('0x40')]({},_0x1492d6,_0x1ba154['options']);var _0x5646fb={'where':_0x1492d6[_0xb4da('0x3f')]};return db[_0xb4da('0x41')][_0xb4da('0x22')](_0x5646fb)[_0xb4da('0x28')](function(_0x94bd){_0x43092f[_0xb4da('0x22')]=_0x94bd;if(_0x1ba154[_0xb4da('0x34')][_0xb4da('0x42')]){_0x1492d6[_0xb4da('0x43')]=[{'all':!![]}];}return db[_0xb4da('0x41')][_0xb4da('0x44')](_0x1492d6);})['then'](function(_0x5b4ac5){_0x43092f[_0xb4da('0x45')]=_0x5b4ac5;return _0x43092f;})[_0xb4da('0x28')](respondWithFilteredResult(_0x30c232,_0x1492d6))['catch'](handleError(_0x30c232,null));};exports[_0xb4da('0x46')]=function(_0x567d11,_0x4c2b73){var _0xb056b7={'raw':![],'where':{'id':_0x567d11['params']['id']}},_0x25873e={};_0x25873e['model']=_[_0xb4da('0x33')](db[_0xb4da('0x41')]['rawAttributes']);_0x25873e[_0xb4da('0x34')]=_['keys'](_0x567d11['query']);_0x25873e[_0xb4da('0x35')]=_['intersection'](_0x25873e[_0xb4da('0x32')],_0x25873e['query']);_0xb056b7[_0xb4da('0x37')]=_[_0xb4da('0x36')](_0x25873e['model'],qs[_0xb4da('0x38')](_0x567d11['query'][_0xb4da('0x38')]));_0xb056b7[_0xb4da('0x37')]=_0xb056b7[_0xb4da('0x37')][_0xb4da('0x39')]?_0xb056b7[_0xb4da('0x37')]:_0x25873e['model'];if(_0x567d11['query'][_0xb4da('0x42')]){_0xb056b7[_0xb4da('0x43')]=[{'all':!![]}];}_0xb056b7=_[_0xb4da('0x40')]({},_0xb056b7,_0x567d11[_0xb4da('0x47')]);return db[_0xb4da('0x41')][_0xb4da('0x48')](_0xb056b7)[_0xb4da('0x28')](handleEntityNotFound(_0x4c2b73,null))[_0xb4da('0x28')](respondWithResult(_0x4c2b73,null))['catch'](handleError(_0x4c2b73,null));};exports[_0xb4da('0x49')]=function(_0x2afb25,_0x2acc4f){return db[_0xb4da('0x41')]['create'](_0x2afb25['body'],{})[_0xb4da('0x28')](respondWithResult(_0x2acc4f,0xc9))[_0xb4da('0x4a')](handleError(_0x2acc4f,null));};exports[_0xb4da('0x4b')]=function(_0x175762,_0x2b766f){if(_0x175762['body']['id']){delete _0x175762[_0xb4da('0x4c')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x175762[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2b766f,null))['then'](saveUpdates(_0x175762[_0xb4da('0x4c')],null))[_0xb4da('0x28')](respondWithResult(_0x2b766f,null))[_0xb4da('0x4a')](handleError(_0x2b766f,null));};exports['destroy']=function(_0x669f9d,_0x306f13){return db['SalesforceAccount'][_0xb4da('0x48')]({'where':{'id':_0x669f9d['params']['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x306f13,null))[_0xb4da('0x28')](removeEntity(_0x306f13,null))[_0xb4da('0x4a')](handleError(_0x306f13,null));};exports[_0xb4da('0x4e')]=function(_0x394ac1,_0x2f170f,_0x1282d1){var _0x29379b={};var _0x3ce9f8={};var _0x53f43d;var _0x4893ef;return db[_0xb4da('0x41')][_0xb4da('0x4f')]({'where':{'id':_0x394ac1[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2f170f,null))[_0xb4da('0x28')](function(_0x60f892){if(_0x60f892){_0x53f43d=_0x60f892;_0x3ce9f8[_0xb4da('0x32')]=_[_0xb4da('0x33')](db[_0xb4da('0x50')][_0xb4da('0x2f')]);_0x3ce9f8['query']=_[_0xb4da('0x33')](_0x394ac1['query']);_0x3ce9f8[_0xb4da('0x35')]=_[_0xb4da('0x36')](_0x3ce9f8[_0xb4da('0x32')],_0x3ce9f8['query']);_0x29379b[_0xb4da('0x37')]=_[_0xb4da('0x36')](_0x3ce9f8[_0xb4da('0x32')],qs[_0xb4da('0x38')](_0x394ac1['query']['fields']));_0x29379b[_0xb4da('0x37')]=_0x29379b[_0xb4da('0x37')][_0xb4da('0x39')]?_0x29379b[_0xb4da('0x37')]:_0x3ce9f8[_0xb4da('0x32')];_0x29379b[_0xb4da('0x51')]=qs['sort'](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3c')]);_0x29379b['where']=qs[_0xb4da('0x35')](_[_0xb4da('0x3d')](_0x394ac1['query'],_0x3ce9f8[_0xb4da('0x35')]));if(_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3e')]){_0x29379b[_0xb4da('0x3f')]=_[_0xb4da('0x40')](_0x29379b['where'],{'$or':_[_0xb4da('0x2e')](_0x29379b[_0xb4da('0x37')],function(_0xaa1eea){var _0x2da14b={};_0x2da14b[_0xaa1eea]={'$like':'%'+_0x394ac1['query'][_0xb4da('0x3e')]+'%'};return _0x2da14b;})});}_0x29379b=_[_0xb4da('0x40')]({},_0x29379b,_0x394ac1[_0xb4da('0x47')]);return _0x53f43d['getConfigurations'](_0x29379b);}})[_0xb4da('0x28')](function(_0x59f582){if(_0x59f582){_0x4893ef=_0x59f582[_0xb4da('0x39')];if(!_0x394ac1[_0xb4da('0x34')][_0xb4da('0x3a')](_0xb4da('0x3b'))){_0x29379b[_0xb4da('0x23')]=qs[_0xb4da('0x23')](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x23')]);_0x29379b[_0xb4da('0x20')]=qs[_0xb4da('0x20')](_0x394ac1[_0xb4da('0x34')][_0xb4da('0x20')]);}return _0x53f43d[_0xb4da('0x4e')](_0x29379b);}})['then'](function(_0x3dbbf7){if(_0x3dbbf7){return _0x3dbbf7?{'count':_0x4893ef,'rows':_0x3dbbf7}:null;}})[_0xb4da('0x28')](respondWithResult(_0x2f170f,null))[_0xb4da('0x4a')](handleError(_0x2f170f,null));};exports[_0xb4da('0x52')]=function(_0x1ad4e1,_0x2d67be,_0x1e2ba8){if(_0x1ad4e1[_0xb4da('0x4c')]['id']){delete _0x1ad4e1[_0xb4da('0x4c')]['id'];}return db[_0xb4da('0x41')][_0xb4da('0x4f')]({'where':{'id':_0x1ad4e1[_0xb4da('0x4d')]['id']}})[_0xb4da('0x28')](handleEntityNotFound(_0x2d67be,null))[_0xb4da('0x28')](function(_0x45e1eb){if(_0x45e1eb){_0x1ad4e1['body'][_0xb4da('0x53')]=_0x45e1eb['id'];_0x1ad4e1[_0xb4da('0x4c')]['Subjects']=integrations[_0xb4da('0x54')](_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x55')],_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x30')]);_0x1ad4e1['body'][_0xb4da('0x56')]=integrations[_0xb4da('0x57')](_0x1ad4e1[_0xb4da('0x4c')][_0xb4da('0x55')],_0x1ad4e1['body'][_0xb4da('0x30')]);return db[_0xb4da('0x50')]['create'](_0x1ad4e1[_0xb4da('0x4c')],{'include':[{'model':db[_0xb4da('0x58')],'as':_0xb4da('0x59')},{'model':db[_0xb4da('0x58')],'as':_0xb4da('0x56')}]});}return null;})[_0xb4da('0x28')](respondWithResult(_0x2d67be,null))[_0xb4da('0x4a')](handleError(_0x2d67be,null));};exports[_0xb4da('0x5a')]=function(_0x42dea2,_0x37a2bf,_0x3af2fd){var _0x3ceea9;var _0xbc678f='';var _0x3301c2=_0xb4da('0x5b');return db['SalesforceAccount'][_0xb4da('0x4f')]({'where':{'id':_0x42dea2[_0xb4da('0x4d')]['id']},'attributes':['id',_0xb4da('0x5c'),_0xb4da('0x5d'),'clientSecret','username',_0xb4da('0x5e'),'securityToken']})[_0xb4da('0x28')](handleEntityNotFound(_0x37a2bf,null))['then'](function(_0x498e64){if(_0x498e64){_0xbc678f=_0x498e64[_0xb4da('0x5c')];var _0x525e34=_0xbc678f[_0xb4da('0x5f')](-0x1);if(_0x525e34==='/'){_0xbc678f=_0xbc678f[_0xb4da('0x60')](0x0,_0xbc678f[_0xb4da('0x61')](_0x525e34));}_0x3ceea9=new jsforce['Connection']({'oauth2':{'loginUrl':_0xbc678f,'clientId':_0x498e64[_0xb4da('0x5d')],'clientSecret':_0x498e64[_0xb4da('0x62')]}});return _0x3ceea9[_0xb4da('0x63')](_0x498e64[_0xb4da('0x64')],_0x498e64[_0xb4da('0x5e')]['concat'](_0x498e64[_0xb4da('0x65')]));}})[_0xb4da('0x28')](function(_0x1bf96c){if(_0x1bf96c){if(!_[_0xb4da('0x66')](_0x42dea2[_0xb4da('0x34')][_0xb4da('0x67')])){_0x3301c2=_0x42dea2[_0xb4da('0x34')][_0xb4da('0x67')];}return _0x3ceea9['sobject'](_0x3301c2)[_0xb4da('0x68')]();}})[_0xb4da('0x28')](function(_0x461b97){var _0x243608=[_0xb4da('0x69'),'ActivityDate',_0xb4da('0x6a'),_0xb4da('0x6b'),_0xb4da('0x6c'),_0xb4da('0x6d')];var _0x55a9e4=[_0xb4da('0x6e'),_0xb4da('0x6f'),'picklist',_0xb4da('0x70'),'email',_0xb4da('0x71'),_0xb4da('0x72')];if(_0x461b97){_[_0xb4da('0x73')](_0x461b97[_0xb4da('0x38')],function(_0x164253){return _0x243608[_0xb4da('0x74')](_0x164253[_0xb4da('0x2b')])||!_0x55a9e4[_0xb4da('0x74')](_0x164253[_0xb4da('0x30')]);});return{'count':_0x461b97['fields'][_0xb4da('0x39')],'rows':_[_0xb4da('0x2e')](_0x461b97[_0xb4da('0x38')],function(_0x1ecd83){return{'id':_0x1ecd83[_0xb4da('0x2b')],'name':_0x1ecd83['label'],'custom':_0x1ecd83[_0xb4da('0x75')],'options':_0x1ecd83[_0xb4da('0x76')][_0xb4da('0x39')]>0x0?_[_0xb4da('0x2e')](_0x1ecd83['picklistValues'],function(_0x5731e1){return{'name':_0x5731e1[_0xb4da('0x77')],'value':_0x5731e1[_0xb4da('0x78')]};}):_0x1ecd83[_0xb4da('0x30')]==_0xb4da('0x70')?[{'name':'True','value':_0xb4da('0x79')},{'name':_0xb4da('0x7a'),'value':_0xb4da('0x7b')}]:[]};})};}})['then'](respondWithResult(_0x37a2bf,null))['catch'](function(_0x4dd415){var _0x6a8e08=_0x42dea2[_0xb4da('0x34')]['test']?0x1f4:_0x4dd415[_0xb4da('0x7c')]||0x1f4;logger[_0xb4da('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xb4da('0x5a'),_0x6a8e08,JSON[_0xb4da('0x7d')](_0x4dd415));delete _0x4dd415[_0xb4da('0x2b')];if(_0x6a8e08===0x191){_0x6a8e08=0x190;}_0x37a2bf['status'](_0x6a8e08)[_0xb4da('0x2c')](_0x42dea2[_0xb4da('0x34')][_0xb4da('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x4dd415[_0xb4da('0x7c')]}:_0x4dd415);});}; \ No newline at end of file +var _0x825d=['index','SalesforceAccount','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','Connection','login','concat','securityToken','ticketType','OwnerId','ActivityDate','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','apply','save','update','then','destroy','end','error','stack','name','send'];(function(_0x5330f8,_0x3325d1){var _0x1f0f79=function(_0xf179b6){while(--_0xf179b6){_0x5330f8['push'](_0x5330f8['shift']());}};_0x1f0f79(++_0x3325d1);}(_0x825d,0x151));var _0xd825=function(_0x192578,_0x544829){_0x192578=_0x192578-0x0;var _0x42af9d=_0x825d[_0x192578];return _0x42af9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd825('0x0'));var zipdir=require(_0xd825('0x1'));var jsonpatch=require(_0xd825('0x2'));var rp=require('request-promise');var moment=require(_0xd825('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd825('0x4'));var util=require('util');var path=require(_0xd825('0x5'));var sox=require(_0xd825('0x6'));var csv=require('to-csv');var ejs=require(_0xd825('0x7'));var fs=require('fs');var fs_extra=require(_0xd825('0x8'));var _=require(_0xd825('0x9'));var squel=require(_0xd825('0xa'));var crypto=require(_0xd825('0xb'));var jsforce=require(_0xd825('0xc'));var deskjs=require(_0xd825('0xd'));var toCsv=require(_0xd825('0xe'));var querystring=require('querystring');var Papa=require(_0xd825('0xf'));var Redis=require(_0xd825('0x10'));var authService=require(_0xd825('0x11'));var qs=require(_0xd825('0x12'));var as=require(_0xd825('0x13'));var hardwareService=require(_0xd825('0x14'));var logger=require(_0xd825('0x15'))(_0xd825('0x16'));var utils=require(_0xd825('0x17'));var config=require(_0xd825('0x18'));var licenseUtil=require(_0xd825('0x19'));var db=require(_0xd825('0x1a'))['db'];var integrations=require(_0xd825('0x1b'));function respondWithStatusCode(_0x43fe68,_0x121e43){_0x121e43=_0x121e43||0xcc;return function(_0x27bac6){if(_0x27bac6){return _0x43fe68[_0xd825('0x1c')](_0x121e43);}return _0x43fe68[_0xd825('0x1d')](_0x121e43)['end']();};}function respondWithResult(_0x5a6468,_0x3301bf){_0x3301bf=_0x3301bf||0xc8;return function(_0x10deb1){if(_0x10deb1){return _0x5a6468['status'](_0x3301bf)[_0xd825('0x1e')](_0x10deb1);}};}function respondWithFilteredResult(_0x3ce89b,_0x23e8cf){return function(_0x25b27c){if(_0x25b27c){var _0x285a92=typeof _0x23e8cf[_0xd825('0x1f')]===_0xd825('0x20')&&typeof _0x23e8cf['limit']===_0xd825('0x20');var _0xa08caa=_0x25b27c[_0xd825('0x21')];var _0x28076e=_0x285a92?0x0:_0x23e8cf[_0xd825('0x1f')];var _0x377766=_0x285a92?_0x25b27c['count']:_0x23e8cf[_0xd825('0x1f')]+_0x23e8cf['limit'];var _0x294e72;if(_0x377766>=_0xa08caa){_0x377766=_0xa08caa;_0x294e72=0xc8;}else{_0x294e72=0xce;}_0x3ce89b['status'](_0x294e72);return _0x3ce89b['set']('Content-Range',_0x28076e+'-'+_0x377766+'/'+_0xa08caa)['json'](_0x25b27c);}return null;};}function patchUpdates(_0x55e547){return function(_0x413b79){try{jsonpatch[_0xd825('0x22')](_0x413b79,_0x55e547,!![]);}catch(_0x5652d0){return BPromise['reject'](_0x5652d0);}return _0x413b79[_0xd825('0x23')]();};}function saveUpdates(_0x16202f,_0x51acd7){return function(_0x2eb279){if(_0x2eb279){return _0x2eb279[_0xd825('0x24')](_0x16202f)[_0xd825('0x25')](function(_0x1d4565){return _0x1d4565;});}return null;};}function removeEntity(_0x29ce64,_0x358fc1){return function(_0xc23071){if(_0xc23071){return _0xc23071[_0xd825('0x26')]()['then'](function(){_0x29ce64['status'](0xcc)[_0xd825('0x27')]();});}};}function handleEntityNotFound(_0x2d7403,_0x1ef5f4){return function(_0xe7df5e){if(!_0xe7df5e){_0x2d7403[_0xd825('0x1c')](0x194);}return _0xe7df5e;};}function handleError(_0x2d57cf,_0x34dc50){_0x34dc50=_0x34dc50||0x1f4;return function(_0x10f966){logger[_0xd825('0x28')](_0x10f966[_0xd825('0x29')]);if(_0x10f966[_0xd825('0x2a')]){delete _0x10f966[_0xd825('0x2a')];}_0x2d57cf['status'](_0x34dc50)[_0xd825('0x2b')](_0x10f966);};}exports[_0xd825('0x2c')]=function(_0x3c01f5,_0xf3c8dd){var _0x37822b={},_0x1e7d7c={},_0x107912={'count':0x0,'rows':[]};var _0x4f6f06=_['map'](db[_0xd825('0x2d')][_0xd825('0x2e')],function(_0x2a755d){return{'name':_0x2a755d['fieldName'],'type':_0x2a755d[_0xd825('0x2f')][_0xd825('0x30')]};});_0x1e7d7c[_0xd825('0x31')]=_[_0xd825('0x32')](_0x4f6f06,_0xd825('0x2a'));_0x1e7d7c[_0xd825('0x33')]=_['keys'](_0x3c01f5[_0xd825('0x33')]);_0x1e7d7c['filters']=_['intersection'](_0x1e7d7c[_0xd825('0x31')],_0x1e7d7c['query']);_0x37822b['attributes']=_[_0xd825('0x34')](_0x1e7d7c[_0xd825('0x31')],qs['fields'](_0x3c01f5[_0xd825('0x33')][_0xd825('0x35')]));_0x37822b[_0xd825('0x36')]=_0x37822b['attributes'][_0xd825('0x37')]?_0x37822b[_0xd825('0x36')]:_0x1e7d7c[_0xd825('0x31')];if(!_0x3c01f5[_0xd825('0x33')][_0xd825('0x38')](_0xd825('0x39'))){_0x37822b[_0xd825('0x3a')]=qs['limit'](_0x3c01f5[_0xd825('0x33')]['limit']);_0x37822b['offset']=qs[_0xd825('0x1f')](_0x3c01f5['query'][_0xd825('0x1f')]);}_0x37822b[_0xd825('0x3b')]=qs[_0xd825('0x3c')](_0x3c01f5[_0xd825('0x33')][_0xd825('0x3c')]);_0x37822b[_0xd825('0x3d')]=qs[_0xd825('0x3e')](_[_0xd825('0x3f')](_0x3c01f5[_0xd825('0x33')],_0x1e7d7c[_0xd825('0x3e')]),_0x4f6f06);if(_0x3c01f5[_0xd825('0x33')][_0xd825('0x40')]){_0x37822b[_0xd825('0x3d')]=_[_0xd825('0x41')](_0x37822b[_0xd825('0x3d')],{'$or':_[_0xd825('0x32')](_0x4f6f06,function(_0x556801){if(_0x556801[_0xd825('0x2f')]!==_0xd825('0x42')){var _0x53dcad={};_0x53dcad[_0x556801[_0xd825('0x2a')]]={'$like':'%'+_0x3c01f5['query'][_0xd825('0x40')]+'%'};return _0x53dcad;}})});}_0x37822b=_[_0xd825('0x41')]({},_0x37822b,_0x3c01f5[_0xd825('0x43')]);var _0x20ab13={'where':_0x37822b[_0xd825('0x3d')]};return db[_0xd825('0x2d')]['count'](_0x20ab13)[_0xd825('0x25')](function(_0x420fc2){_0x107912[_0xd825('0x21')]=_0x420fc2;if(_0x3c01f5[_0xd825('0x33')]['includeAll']){_0x37822b[_0xd825('0x44')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xd825('0x45')](_0x37822b);})[_0xd825('0x25')](function(_0x4c6fa9){_0x107912[_0xd825('0x46')]=_0x4c6fa9;return _0x107912;})[_0xd825('0x25')](respondWithFilteredResult(_0xf3c8dd,_0x37822b))['catch'](handleError(_0xf3c8dd,null));};exports[_0xd825('0x47')]=function(_0x1e5d2f,_0x34c464){var _0x5e0418={'raw':![],'where':{'id':_0x1e5d2f[_0xd825('0x48')]['id']}},_0x1b2457={};_0x1b2457[_0xd825('0x31')]=_[_0xd825('0x49')](db[_0xd825('0x2d')][_0xd825('0x2e')]);_0x1b2457[_0xd825('0x33')]=_[_0xd825('0x49')](_0x1e5d2f[_0xd825('0x33')]);_0x1b2457[_0xd825('0x3e')]=_[_0xd825('0x34')](_0x1b2457['model'],_0x1b2457[_0xd825('0x33')]);_0x5e0418[_0xd825('0x36')]=_['intersection'](_0x1b2457[_0xd825('0x31')],qs[_0xd825('0x35')](_0x1e5d2f[_0xd825('0x33')][_0xd825('0x35')]));_0x5e0418[_0xd825('0x36')]=_0x5e0418[_0xd825('0x36')][_0xd825('0x37')]?_0x5e0418[_0xd825('0x36')]:_0x1b2457['model'];if(_0x1e5d2f[_0xd825('0x33')][_0xd825('0x4a')]){_0x5e0418[_0xd825('0x44')]=[{'all':!![]}];}_0x5e0418=_[_0xd825('0x41')]({},_0x5e0418,_0x1e5d2f['options']);return db['SalesforceAccount'][_0xd825('0x4b')](_0x5e0418)[_0xd825('0x25')](handleEntityNotFound(_0x34c464,null))[_0xd825('0x25')](respondWithResult(_0x34c464,null))[_0xd825('0x4c')](handleError(_0x34c464,null));};exports[_0xd825('0x4d')]=function(_0x43d32b,_0x2eb6fd){return db['SalesforceAccount'][_0xd825('0x4d')](_0x43d32b[_0xd825('0x4e')],{})[_0xd825('0x25')](respondWithResult(_0x2eb6fd,0xc9))[_0xd825('0x4c')](handleError(_0x2eb6fd,null));};exports[_0xd825('0x24')]=function(_0x293a76,_0xf64ad2){if(_0x293a76[_0xd825('0x4e')]['id']){delete _0x293a76['body']['id'];}return db[_0xd825('0x2d')]['find']({'where':{'id':_0x293a76[_0xd825('0x48')]['id']}})['then'](handleEntityNotFound(_0xf64ad2,null))['then'](saveUpdates(_0x293a76[_0xd825('0x4e')],null))[_0xd825('0x25')](respondWithResult(_0xf64ad2,null))[_0xd825('0x4c')](handleError(_0xf64ad2,null));};exports[_0xd825('0x26')]=function(_0xc4cac6,_0x45dfc2){return db['SalesforceAccount'][_0xd825('0x4b')]({'where':{'id':_0xc4cac6[_0xd825('0x48')]['id']}})[_0xd825('0x25')](handleEntityNotFound(_0x45dfc2,null))[_0xd825('0x25')](removeEntity(_0x45dfc2,null))[_0xd825('0x4c')](handleError(_0x45dfc2,null));};exports[_0xd825('0x4f')]=function(_0x2d7ac3,_0x1fa3e4,_0x3168c5){var _0x3061e2={};var _0xb16046={};var _0xd07c8c;var _0x2fa3c1;return db[_0xd825('0x2d')][_0xd825('0x50')]({'where':{'id':_0x2d7ac3[_0xd825('0x48')]['id']}})[_0xd825('0x25')](handleEntityNotFound(_0x1fa3e4,null))[_0xd825('0x25')](function(_0x50dea7){if(_0x50dea7){_0xd07c8c=_0x50dea7;_0xb16046['model']=_[_0xd825('0x49')](db[_0xd825('0x51')]['rawAttributes']);_0xb16046[_0xd825('0x33')]=_[_0xd825('0x49')](_0x2d7ac3[_0xd825('0x33')]);_0xb16046[_0xd825('0x3e')]=_[_0xd825('0x34')](_0xb16046[_0xd825('0x31')],_0xb16046[_0xd825('0x33')]);_0x3061e2['attributes']=_[_0xd825('0x34')](_0xb16046[_0xd825('0x31')],qs[_0xd825('0x35')](_0x2d7ac3[_0xd825('0x33')][_0xd825('0x35')]));_0x3061e2[_0xd825('0x36')]=_0x3061e2[_0xd825('0x36')][_0xd825('0x37')]?_0x3061e2[_0xd825('0x36')]:_0xb16046[_0xd825('0x31')];_0x3061e2['order']=qs[_0xd825('0x3c')](_0x2d7ac3[_0xd825('0x33')][_0xd825('0x3c')]);_0x3061e2[_0xd825('0x3d')]=qs[_0xd825('0x3e')](_['pick'](_0x2d7ac3[_0xd825('0x33')],_0xb16046[_0xd825('0x3e')]));if(_0x2d7ac3[_0xd825('0x33')][_0xd825('0x40')]){_0x3061e2[_0xd825('0x3d')]=_[_0xd825('0x41')](_0x3061e2[_0xd825('0x3d')],{'$or':_['map'](_0x3061e2[_0xd825('0x36')],function(_0x38e409){var _0xcd0860={};_0xcd0860[_0x38e409]={'$like':'%'+_0x2d7ac3[_0xd825('0x33')]['filter']+'%'};return _0xcd0860;})});}_0x3061e2=_[_0xd825('0x41')]({},_0x3061e2,_0x2d7ac3[_0xd825('0x43')]);return _0xd07c8c['getConfigurations'](_0x3061e2);}})[_0xd825('0x25')](function(_0xd0af8c){if(_0xd0af8c){_0x2fa3c1=_0xd0af8c['length'];if(!_0x2d7ac3[_0xd825('0x33')][_0xd825('0x38')]('nolimit')){_0x3061e2['limit']=qs[_0xd825('0x3a')](_0x2d7ac3['query']['limit']);_0x3061e2['offset']=qs[_0xd825('0x1f')](_0x2d7ac3['query'][_0xd825('0x1f')]);}return _0xd07c8c[_0xd825('0x4f')](_0x3061e2);}})[_0xd825('0x25')](function(_0x513fdb){if(_0x513fdb){return _0x513fdb?{'count':_0x2fa3c1,'rows':_0x513fdb}:null;}})[_0xd825('0x25')](respondWithResult(_0x1fa3e4,null))['catch'](handleError(_0x1fa3e4,null));};exports[_0xd825('0x52')]=function(_0x114256,_0x1a934f,_0x36421a){if(_0x114256[_0xd825('0x4e')]['id']){delete _0x114256['body']['id'];}return db[_0xd825('0x2d')][_0xd825('0x50')]({'where':{'id':_0x114256['params']['id']}})[_0xd825('0x25')](handleEntityNotFound(_0x1a934f,null))[_0xd825('0x25')](function(_0x57cc24){if(_0x57cc24){_0x114256['body'][_0xd825('0x53')]=_0x57cc24['id'];_0x114256[_0xd825('0x4e')][_0xd825('0x54')]=integrations[_0xd825('0x55')](_0x114256[_0xd825('0x4e')][_0xd825('0x56')],_0x114256[_0xd825('0x4e')]['type']);_0x114256[_0xd825('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x114256[_0xd825('0x4e')][_0xd825('0x56')],_0x114256['body']['type']);return db['SalesforceConfiguration'][_0xd825('0x4d')](_0x114256[_0xd825('0x4e')],{'include':[{'model':db['SalesforceField'],'as':_0xd825('0x54')},{'model':db[_0xd825('0x57')],'as':_0xd825('0x58')}]});}return null;})[_0xd825('0x25')](respondWithResult(_0x1a934f,null))['catch'](handleError(_0x1a934f,null));};exports[_0xd825('0x59')]=function(_0x1a2355,_0x5750e0,_0x29ff9e){var _0x5e075f;var _0x37487e='';var _0x2dc784=_0xd825('0x5a');return db['SalesforceAccount'][_0xd825('0x50')]({'where':{'id':_0x1a2355[_0xd825('0x48')]['id']},'attributes':['id',_0xd825('0x5b'),_0xd825('0x5c'),_0xd825('0x5d'),_0xd825('0x5e'),'password','securityToken']})[_0xd825('0x25')](handleEntityNotFound(_0x5750e0,null))[_0xd825('0x25')](function(_0x3ec362){if(_0x3ec362){_0x37487e=_0x3ec362[_0xd825('0x5b')];var _0xc8d514=_0x37487e[_0xd825('0x5f')](-0x1);if(_0xc8d514==='/'){_0x37487e=_0x37487e[_0xd825('0x60')](0x0,_0x37487e[_0xd825('0x61')](_0xc8d514));}_0x5e075f=new jsforce[(_0xd825('0x62'))]({'oauth2':{'loginUrl':_0x37487e,'clientId':_0x3ec362['clientId'],'clientSecret':_0x3ec362['clientSecret']}});return _0x5e075f[_0xd825('0x63')](_0x3ec362['username'],_0x3ec362['password'][_0xd825('0x64')](_0x3ec362[_0xd825('0x65')]));}})[_0xd825('0x25')](function(_0x4d6d97){if(_0x4d6d97){if(!_['isNil'](_0x1a2355[_0xd825('0x33')][_0xd825('0x66')])){_0x2dc784=_0x1a2355[_0xd825('0x33')][_0xd825('0x66')];}return _0x5e075f['sobject'](_0x2dc784)['describe']();}})['then'](function(_0x2ff1ac){var _0x49c1cd=[_0xd825('0x67'),_0xd825('0x68'),'IsReminderSet',_0xd825('0x69'),'Subject',_0xd825('0x6a')];var _0x42963d=[_0xd825('0x6b'),_0xd825('0x6c'),_0xd825('0x6d'),_0xd825('0x6e'),_0xd825('0x6f'),_0xd825('0x70'),_0xd825('0x71')];if(_0x2ff1ac){_[_0xd825('0x72')](_0x2ff1ac[_0xd825('0x35')],function(_0x105d70){return _0x49c1cd[_0xd825('0x73')](_0x105d70[_0xd825('0x2a')])||!_0x42963d[_0xd825('0x73')](_0x105d70[_0xd825('0x2f')]);});return{'count':_0x2ff1ac[_0xd825('0x35')]['length'],'rows':_[_0xd825('0x32')](_0x2ff1ac[_0xd825('0x35')],function(_0x461ca4){return{'id':_0x461ca4[_0xd825('0x2a')],'name':_0x461ca4[_0xd825('0x74')],'custom':_0x461ca4[_0xd825('0x75')],'options':_0x461ca4['picklistValues'][_0xd825('0x37')]>0x0?_['map'](_0x461ca4[_0xd825('0x76')],function(_0x2d04c5){return{'name':_0x2d04c5[_0xd825('0x74')],'value':_0x2d04c5['value']};}):_0x461ca4[_0xd825('0x2f')]==_0xd825('0x6e')?[{'name':_0xd825('0x77'),'value':_0xd825('0x78')},{'name':_0xd825('0x79'),'value':_0xd825('0x7a')}]:[]};})};}})[_0xd825('0x25')](respondWithResult(_0x5750e0,null))[_0xd825('0x4c')](function(_0x523461){var _0x5281e2=_0x1a2355[_0xd825('0x33')][_0xd825('0x7b')]?0x1f4:_0x523461[_0xd825('0x7c')]||0x1f4;logger[_0xd825('0x28')](_0xd825('0x7d'),_0xd825('0x59'),_0x5281e2,JSON['stringify'](_0x523461));delete _0x523461['name'];if(_0x5281e2===0x191){_0x5281e2=0x190;}_0x5750e0[_0xd825('0x1d')](_0x5281e2)[_0xd825('0x2b')](_0x1a2355['query']['test']?{'message':_0xd825('0x7e'),'statusCode':_0x523461[_0xd825('0x7c')]}:_0x523461);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 07e0ebb..c7678f8 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 _0xc078=['int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x39f309,_0x15a64c){var _0x584700=function(_0x484467){while(--_0x484467){_0x39f309['push'](_0x39f309['shift']());}};_0x584700(++_0x15a64c);}(_0xc078,0xfd));var _0x8c07=function(_0x4f3378,_0x249480){_0x4f3378=_0x4f3378-0x0;var _0x2fad35=_0xc078[_0x4f3378];return _0x2fad35;};'use strict';var _=require('lodash');var util=require(_0x8c07('0x0'));var logger=require(_0x8c07('0x1'))(_0x8c07('0x2'));var moment=require(_0x8c07('0x3'));var BPromise=require(_0x8c07('0x4'));var rp=require(_0x8c07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c07('0x6'));var config=require(_0x8c07('0x7'));var attributes=require(_0x8c07('0x8'));var integrations=require(_0x8c07('0x9'));module[_0x8c07('0xa')]=function(_0x585966,_0x57d02b){return _0x585966[_0x8c07('0xb')](_0x8c07('0xc'),attributes,{'tableName':_0x8c07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6e4=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xa6d183,_0x480b25){var _0x1b26bb=function(_0x290fa8){while(--_0x290fa8){_0xa6d183['push'](_0xa6d183['shift']());}};_0x1b26bb(++_0x480b25);}(_0xb6e4,0x117));var _0x4b6e=function(_0x35c8dc,_0x36c908){_0x35c8dc=_0x35c8dc-0x0;var _0xdaf290=_0xb6e4[_0x35c8dc];return _0xdaf290;};'use strict';var _=require(_0x4b6e('0x0'));var util=require(_0x4b6e('0x1'));var logger=require(_0x4b6e('0x2'))(_0x4b6e('0x3'));var moment=require(_0x4b6e('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b6e('0x5'));var fs=require('fs');var path=require(_0x4b6e('0x6'));var rimraf=require(_0x4b6e('0x7'));var config=require(_0x4b6e('0x8'));var attributes=require(_0x4b6e('0x9'));var integrations=require(_0x4b6e('0xa'));module[_0x4b6e('0xb')]=function(_0x49ba4d,_0x19238b){return _0x49ba4d[_0x4b6e('0xc')](_0x4b6e('0xd'),attributes,{'tableName':_0x4b6e('0xe'),'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 dcaf583..971fc2c 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 _0x9129=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceAccount,\x20%s,\x20%s','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','map','include','model','where','ShowSalesforceAccount','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x592ea0,_0xf096b2){var _0x55a2be=function(_0x1848b5){while(--_0x1848b5){_0x592ea0['push'](_0x592ea0['shift']());}};_0x55a2be(++_0xf096b2);}(_0x9129,0xcc));var _0x9912=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x9129[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var moment=require('moment');var BPromise=require(_0x9912('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9912('0x3'));var db=require(_0x9912('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9912('0x5'));var config=require(_0x9912('0x6'));var jayson=require(_0x9912('0x7'));var client=jayson[_0x9912('0x8')][_0x9912('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b039a,_0x75f6b3,_0x67a3aa){return new BPromise(function(_0x3e1176,_0x536e71){return client['request'](_0x4b039a,_0x67a3aa)[_0x9912('0xa')](function(_0x498a0c){logger[_0x9912('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x75f6b3,_0x9912('0xc'));logger[_0x9912('0xd')](_0x9912('0xe'),_0x75f6b3,_0x9912('0xc'),JSON[_0x9912('0xf')](_0x498a0c));if(_0x498a0c[_0x9912('0x10')]){if(_0x498a0c[_0x9912('0x10')]['code']===0x1f4){logger[_0x9912('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x75f6b3,_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);return _0x536e71(_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);}logger[_0x9912('0x10')](_0x9912('0x12'),_0x75f6b3,_0x498a0c[_0x9912('0x10')][_0x9912('0x11')]);return _0x3e1176(_0x498a0c['error'][_0x9912('0x11')]);}else{logger[_0x9912('0xb')](_0x9912('0x12'),_0x75f6b3,_0x9912('0xc'));_0x3e1176(_0x498a0c['result'][_0x9912('0x11')]);}})[_0x9912('0x13')](function(_0xa59603){logger[_0x9912('0x10')](_0x9912('0x12'),_0x75f6b3,_0xa59603);_0x536e71(_0xa59603);});});}exports[_0x9912('0x14')]=function(_0x33098e){var _0xc7c035=this;return new Promise(function(_0x3d187a,_0x3b8b58){return db['SalesforceAccount'][_0x9912('0x15')]({'raw':_0x33098e['options']?_0x33098e[_0x9912('0x16')][_0x9912('0x17')]===undefined?!![]:![]:!![],'where':_0x33098e['options']?_0x33098e[_0x9912('0x16')]['where']||null:null,'attributes':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')][_0x9912('0x18')]||null:null,'limit':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')][_0x9912('0x19')]||null:null,'include':_0x33098e[_0x9912('0x16')]?_0x33098e[_0x9912('0x16')]['include']?_[_0x9912('0x1a')](_0x33098e[_0x9912('0x16')][_0x9912('0x1b')],function(_0x5cf142){return{'model':db[_0x5cf142[_0x9912('0x1c')]],'as':_0x5cf142['as'],'attributes':_0x5cf142[_0x9912('0x18')],'include':_0x5cf142[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x5cf142[_0x9912('0x1b')],function(_0x498d00){return{'model':db[_0x498d00[_0x9912('0x1c')]],'as':_0x498d00['as'],'attributes':_0x498d00[_0x9912('0x18')],'include':_0x498d00[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x498d00['include'],function(_0x329ea1){return{'model':db[_0x329ea1[_0x9912('0x1c')]],'as':_0x329ea1['as'],'attributes':_0x329ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b7349){logger[_0x9912('0xb')]('GetSalesforceAccount',_0x33098e);logger[_0x9912('0xd')](_0x9912('0x14'),_0x33098e,JSON[_0x9912('0xf')](_0x9b7349));_0x3d187a(_0x9b7349);})[_0x9912('0x13')](function(_0x16c395){logger[_0x9912('0x10')](_0x9912('0x14'),_0x16c395[_0x9912('0x11')],_0x33098e);_0x3b8b58(_0xc7c035[_0x9912('0x10')](0x1f4,_0x16c395['message']));});});};exports['ShowSalesforceAccount']=function(_0x23fd77){var _0x9030fb=this;return new Promise(function(_0x26cc1a,_0xb635a5){return db['SalesforceAccount']['find']({'raw':_0x23fd77[_0x9912('0x16')]?_0x23fd77[_0x9912('0x16')][_0x9912('0x17')]===undefined?!![]:![]:!![],'where':_0x23fd77['options']?_0x23fd77['options'][_0x9912('0x1d')]||null:null,'attributes':_0x23fd77[_0x9912('0x16')]?_0x23fd77[_0x9912('0x16')]['attributes']||null:null,'include':_0x23fd77[_0x9912('0x16')]?_0x23fd77['options'][_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x23fd77[_0x9912('0x16')]['include'],function(_0x3c8aa3){return{'model':db[_0x3c8aa3[_0x9912('0x1c')]],'as':_0x3c8aa3['as'],'attributes':_0x3c8aa3[_0x9912('0x18')],'include':_0x3c8aa3[_0x9912('0x1b')]?_['map'](_0x3c8aa3[_0x9912('0x1b')],function(_0x27512b){return{'model':db[_0x27512b[_0x9912('0x1c')]],'as':_0x27512b['as'],'attributes':_0x27512b['attributes'],'include':_0x27512b[_0x9912('0x1b')]?_[_0x9912('0x1a')](_0x27512b[_0x9912('0x1b')],function(_0x4fa378){return{'model':db[_0x4fa378[_0x9912('0x1c')]],'as':_0x4fa378['as'],'attributes':_0x4fa378[_0x9912('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9912('0xa')](function(_0x1f273d){logger['info'](_0x9912('0x1e'),_0x23fd77);logger[_0x9912('0xd')](_0x9912('0x1e'),_0x23fd77,JSON[_0x9912('0xf')](_0x1f273d));_0x26cc1a(_0x1f273d);})['catch'](function(_0x50c6b7){logger['error']('ShowSalesforceAccount',_0x50c6b7[_0x9912('0x11')],_0x23fd77);_0xb635a5(_0x9030fb[_0x9912('0x10')](0x1f4,_0x50c6b7[_0x9912('0x11')]));});});}; \ No newline at end of file +var _0x5261=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','raw','options','where','attributes','include','map','model','then','find','ShowSalesforceAccount','lodash','util','moment'];(function(_0x328081,_0x4d2b6d){var _0x3e5155=function(_0x57f103){while(--_0x57f103){_0x328081['push'](_0x328081['shift']());}};_0x3e5155(++_0x4d2b6d);}(_0x5261,0xa7));var _0x1526=function(_0x23c836,_0x543bae){_0x23c836=_0x23c836-0x0;var _0xadc52f=_0x5261[_0x23c836];return _0xadc52f;};'use strict';var _=require(_0x1526('0x0'));var util=require(_0x1526('0x1'));var moment=require(_0x1526('0x2'));var BPromise=require(_0x1526('0x3'));var rs=require(_0x1526('0x4'));var fs=require('fs');var Redis=require(_0x1526('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1526('0x6'));var config=require(_0x1526('0x7'));var jayson=require(_0x1526('0x8'));var client=jayson[_0x1526('0x9')][_0x1526('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164e48,_0x5d406c,_0x35c350){return new BPromise(function(_0x347a03,_0x1adf0b){return client['request'](_0x164e48,_0x35c350)['then'](function(_0x6a6b64){logger[_0x1526('0xb')](_0x1526('0xc'),_0x5d406c,_0x1526('0xd'));logger[_0x1526('0xe')](_0x1526('0xf'),_0x5d406c,'request\x20sent',JSON[_0x1526('0x10')](_0x6a6b64));if(_0x6a6b64['error']){if(_0x6a6b64['error'][_0x1526('0x11')]===0x1f4){logger[_0x1526('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x5d406c,_0x6a6b64['error']['message']);return _0x1adf0b(_0x6a6b64['error'][_0x1526('0x13')]);}logger[_0x1526('0x12')](_0x1526('0xc'),_0x5d406c,_0x6a6b64[_0x1526('0x12')][_0x1526('0x13')]);return _0x347a03(_0x6a6b64['error'][_0x1526('0x13')]);}else{logger[_0x1526('0xb')](_0x1526('0xc'),_0x5d406c,'request\x20sent');_0x347a03(_0x6a6b64[_0x1526('0x14')][_0x1526('0x13')]);}})[_0x1526('0x15')](function(_0x2f2705){logger[_0x1526('0x12')](_0x1526('0xc'),_0x5d406c,_0x2f2705);_0x1adf0b(_0x2f2705);});});}exports[_0x1526('0x16')]=function(_0x396e8c){var _0x13872d=this;return new Promise(function(_0x180036,_0x418a75){return db[_0x1526('0x17')]['findAll']({'raw':_0x396e8c['options']?_0x396e8c['options'][_0x1526('0x18')]===undefined?!![]:![]:!![],'where':_0x396e8c[_0x1526('0x19')]?_0x396e8c[_0x1526('0x19')][_0x1526('0x1a')]||null:null,'attributes':_0x396e8c['options']?_0x396e8c[_0x1526('0x19')][_0x1526('0x1b')]||null:null,'limit':_0x396e8c[_0x1526('0x19')]?_0x396e8c[_0x1526('0x19')]['limit']||null:null,'include':_0x396e8c[_0x1526('0x19')]?_0x396e8c[_0x1526('0x19')][_0x1526('0x1c')]?_[_0x1526('0x1d')](_0x396e8c[_0x1526('0x19')]['include'],function(_0x49bca6){return{'model':db[_0x49bca6[_0x1526('0x1e')]],'as':_0x49bca6['as'],'attributes':_0x49bca6[_0x1526('0x1b')],'include':_0x49bca6[_0x1526('0x1c')]?_['map'](_0x49bca6[_0x1526('0x1c')],function(_0x3fa3ff){return{'model':db[_0x3fa3ff['model']],'as':_0x3fa3ff['as'],'attributes':_0x3fa3ff['attributes'],'include':_0x3fa3ff['include']?_[_0x1526('0x1d')](_0x3fa3ff[_0x1526('0x1c')],function(_0x37c0ab){return{'model':db[_0x37c0ab[_0x1526('0x1e')]],'as':_0x37c0ab['as'],'attributes':_0x37c0ab[_0x1526('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1526('0x1f')](function(_0x1e0649){logger[_0x1526('0xb')](_0x1526('0x16'),_0x396e8c);logger['debug'](_0x1526('0x16'),_0x396e8c,JSON[_0x1526('0x10')](_0x1e0649));_0x180036(_0x1e0649);})[_0x1526('0x15')](function(_0x45032e){logger[_0x1526('0x12')](_0x1526('0x16'),_0x45032e[_0x1526('0x13')],_0x396e8c);_0x418a75(_0x13872d[_0x1526('0x12')](0x1f4,_0x45032e['message']));});});};exports['ShowSalesforceAccount']=function(_0x291905){var _0x598adf=this;return new Promise(function(_0x2d5715,_0x43abc2){return db[_0x1526('0x17')][_0x1526('0x20')]({'raw':_0x291905['options']?_0x291905[_0x1526('0x19')][_0x1526('0x18')]===undefined?!![]:![]:!![],'where':_0x291905[_0x1526('0x19')]?_0x291905[_0x1526('0x19')]['where']||null:null,'attributes':_0x291905[_0x1526('0x19')]?_0x291905[_0x1526('0x19')][_0x1526('0x1b')]||null:null,'include':_0x291905[_0x1526('0x19')]?_0x291905['options'][_0x1526('0x1c')]?_[_0x1526('0x1d')](_0x291905[_0x1526('0x19')][_0x1526('0x1c')],function(_0x2d1dbc){return{'model':db[_0x2d1dbc[_0x1526('0x1e')]],'as':_0x2d1dbc['as'],'attributes':_0x2d1dbc[_0x1526('0x1b')],'include':_0x2d1dbc[_0x1526('0x1c')]?_[_0x1526('0x1d')](_0x2d1dbc['include'],function(_0x58acc3){return{'model':db[_0x58acc3[_0x1526('0x1e')]],'as':_0x58acc3['as'],'attributes':_0x58acc3[_0x1526('0x1b')],'include':_0x58acc3[_0x1526('0x1c')]?_['map'](_0x58acc3[_0x1526('0x1c')],function(_0x292297){return{'model':db[_0x292297['model']],'as':_0x292297['as'],'attributes':_0x292297[_0x1526('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1526('0x1f')](function(_0x2fe431){logger[_0x1526('0xb')](_0x1526('0x21'),_0x291905);logger['debug'](_0x1526('0x21'),_0x291905,JSON[_0x1526('0x10')](_0x2fe431));_0x2d5715(_0x2fe431);})[_0x1526('0x15')](function(_0x533c96){logger[_0x1526('0x12')](_0x1526('0x21'),_0x533c96[_0x1526('0x13')],_0x291905);_0x43abc2(_0x598adf[_0x1526('0x12')](0x1f4,_0x533c96[_0x1526('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 19faf17..d452d48 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2c6470,_0x590d58){var _0x3ddf3c=function(_0x373b74){while(--_0x373b74){_0x2c6470['push'](_0x2c6470['shift']());}};_0x3ddf3c(++_0x590d58);}(_0x2ef3,0xba));var _0x32ef=function(_0x56ae24,_0x205ad6){_0x56ae24=_0x56ae24-0x0;var _0x7291c9=_0x2ef3[_0x56ae24];return _0x7291c9;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x6c0b0a,_0x496391){_0x6c0b0a=_0x6c0b0a-0x0;var _0x5f456a=_0x0b0e[_0x6c0b0a];return _0x5f456a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index db31301..6a7eb30 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 _0x2a43=['Task','contact_lead','contact','lead','nothing','account','sequelize','exports','STRING','ENUM'];(function(_0x1192c7,_0x403d79){var _0x50ae76=function(_0x5efe50){while(--_0x5efe50){_0x1192c7['push'](_0x1192c7['shift']());}};_0x50ae76(++_0x403d79);}(_0x2a43,0x1b4));var _0x32a4=function(_0x1700cb,_0x232eb5){_0x1700cb=_0x1700cb-0x0;var _0x3a2d56=_0x2a43[_0x1700cb];return _0x3a2d56;};'use strict';var Sequelize=require(_0x32a4('0x0'));module[_0x32a4('0x1')]={'name':{'type':Sequelize[_0x32a4('0x2')]},'description':{'type':Sequelize[_0x32a4('0x2')]},'ticketType':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x4'),'Case'),'defaultValue':_0x32a4('0x4')},'moduleSearch':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x5'),_0x32a4('0x6'),_0x32a4('0x7'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x32a4('0x3')](_0x32a4('0x8'),_0x32a4('0x6'),_0x32a4('0x7'),_0x32a4('0x9')),'defaultValue':_0x32a4('0x7')},'leadId':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x32a4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x32a4('0x2')]}}; \ No newline at end of file +var _0xa57b=['ENUM','Task','Case','contact_lead','account_contact_lead','account','lead','sequelize','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xa57b,0x1a5));var _0xba57=function(_0x5c0f8b,_0x30d958){_0x5c0f8b=_0x5c0f8b-0x0;var _0x1462e2=_0xa57b[_0x5c0f8b];return _0x1462e2;};'use strict';var Sequelize=require(_0xba57('0x0'));module['exports']={'name':{'type':Sequelize[_0xba57('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xba57('0x2')](_0xba57('0x3'),_0xba57('0x4')),'defaultValue':_0xba57('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xba57('0x5'),'contact','lead',_0xba57('0x6'),_0xba57('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing','contact',_0xba57('0x8'),'account'),'defaultValue':_0xba57('0x8')},'leadId':{'type':Sequelize[_0xba57('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xba57('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xba57('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xba57('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 146bb6e..acd1bd1 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 _0x5c54=['attributes','fields','query','hasOwnProperty','nolimit','order','sort','pick','filters','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','intersection'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x5c54,0x71));var _0x45c5=function(_0x45b26b,_0x76397b){_0x45b26b=_0x45b26b-0x0;var _0x6330f1=_0x5c54[_0x45b26b];return _0x6330f1;};'use strict';var emlformat=require(_0x45c5('0x0'));var rimraf=require(_0x45c5('0x1'));var zipdir=require(_0x45c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x45c5('0x3'));var BPromise=require(_0x45c5('0x4'));var Mustache=require(_0x45c5('0x5'));var util=require('util');var path=require(_0x45c5('0x6'));var sox=require(_0x45c5('0x7'));var csv=require('to-csv');var ejs=require(_0x45c5('0x8'));var fs=require('fs');var fs_extra=require(_0x45c5('0x9'));var _=require(_0x45c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45c5('0xb'));var deskjs=require(_0x45c5('0xc'));var toCsv=require(_0x45c5('0xd'));var querystring=require(_0x45c5('0xe'));var Papa=require(_0x45c5('0xf'));var Redis=require(_0x45c5('0x10'));var authService=require(_0x45c5('0x11'));var qs=require(_0x45c5('0x12'));var as=require(_0x45c5('0x13'));var hardwareService=require(_0x45c5('0x14'));var logger=require(_0x45c5('0x15'))(_0x45c5('0x16'));var utils=require(_0x45c5('0x17'));var config=require(_0x45c5('0x18'));var licenseUtil=require(_0x45c5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28709d,_0x2b48db){_0x2b48db=_0x2b48db||0xcc;return function(_0x340526){if(_0x340526){return _0x28709d[_0x45c5('0x1a')](_0x2b48db);}return _0x28709d[_0x45c5('0x1b')](_0x2b48db)[_0x45c5('0x1c')]();};}function respondWithResult(_0x44e707,_0x2e0329){_0x2e0329=_0x2e0329||0xc8;return function(_0x1b7d6c){if(_0x1b7d6c){return _0x44e707[_0x45c5('0x1b')](_0x2e0329)[_0x45c5('0x1d')](_0x1b7d6c);}};}function respondWithFilteredResult(_0x1945de,_0x1e09ff){return function(_0x43e136){if(_0x43e136){var _0x4605fb=typeof _0x1e09ff['offset']==='undefined'&&typeof _0x1e09ff['limit']===_0x45c5('0x1e');var _0x5f1068=_0x43e136[_0x45c5('0x1f')];var _0x30b98f=_0x4605fb?0x0:_0x1e09ff[_0x45c5('0x20')];var _0x3e6f5e=_0x4605fb?_0x43e136[_0x45c5('0x1f')]:_0x1e09ff[_0x45c5('0x20')]+_0x1e09ff[_0x45c5('0x21')];var _0x1c93a0;if(_0x3e6f5e>=_0x5f1068){_0x3e6f5e=_0x5f1068;_0x1c93a0=0xc8;}else{_0x1c93a0=0xce;}_0x1945de[_0x45c5('0x1b')](_0x1c93a0);return _0x1945de['set'](_0x45c5('0x22'),_0x30b98f+'-'+_0x3e6f5e+'/'+_0x5f1068)['json'](_0x43e136);}return null;};}function patchUpdates(_0x2e4361){return function(_0x271b79){try{jsonpatch[_0x45c5('0x23')](_0x271b79,_0x2e4361,!![]);}catch(_0x20c043){return BPromise[_0x45c5('0x24')](_0x20c043);}return _0x271b79['save']();};}function saveUpdates(_0x16b768,_0x11085e){return function(_0x5ef95b){if(_0x5ef95b){return _0x5ef95b[_0x45c5('0x25')](_0x16b768)[_0x45c5('0x26')](function(_0x1c80fe){return _0x1c80fe;});}return null;};}function removeEntity(_0x88795,_0x4612f1){return function(_0x122f7d){if(_0x122f7d){return _0x122f7d['destroy']()[_0x45c5('0x26')](function(){_0x88795[_0x45c5('0x1b')](0xcc)[_0x45c5('0x1c')]();});}};}function handleEntityNotFound(_0x24dc76,_0x321a78){return function(_0x292a46){if(!_0x292a46){_0x24dc76[_0x45c5('0x1a')](0x194);}return _0x292a46;};}function handleError(_0x23c259,_0x27369a){_0x27369a=_0x27369a||0x1f4;return function(_0x865b11){logger['error'](_0x865b11['stack']);if(_0x865b11[_0x45c5('0x27')]){delete _0x865b11[_0x45c5('0x27')];}_0x23c259[_0x45c5('0x1b')](_0x27369a)[_0x45c5('0x28')](_0x865b11);};}exports[_0x45c5('0x29')]=function(_0x1c9ca8,_0x1ea63a){var _0x133871={},_0x2117b1={},_0x175917={'count':0x0,'rows':[]};var _0x598f54=_[_0x45c5('0x2a')](db[_0x45c5('0x2b')][_0x45c5('0x2c')],function(_0x4a4c25){return{'name':_0x4a4c25['fieldName'],'type':_0x4a4c25[_0x45c5('0x2d')][_0x45c5('0x2e')]};});_0x2117b1[_0x45c5('0x2f')]=_[_0x45c5('0x2a')](_0x598f54,_0x45c5('0x27'));_0x2117b1['query']=_['keys'](_0x1c9ca8['query']);_0x2117b1['filters']=_[_0x45c5('0x30')](_0x2117b1['model'],_0x2117b1['query']);_0x133871[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x2117b1[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x1c9ca8['query']['fields']));_0x133871[_0x45c5('0x31')]=_0x133871[_0x45c5('0x31')]['length']?_0x133871[_0x45c5('0x31')]:_0x2117b1[_0x45c5('0x2f')];if(!_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x34')](_0x45c5('0x35'))){_0x133871['limit']=qs['limit'](_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x21')]);_0x133871[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x1c9ca8['query'][_0x45c5('0x20')]);}_0x133871[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x37')]);_0x133871['where']=qs['filters'](_[_0x45c5('0x38')](_0x1c9ca8[_0x45c5('0x33')],_0x2117b1[_0x45c5('0x39')]),_0x598f54);if(_0x1c9ca8[_0x45c5('0x33')]['filter']){_0x133871['where']=_['merge'](_0x133871[_0x45c5('0x3a')],{'$or':_['map'](_0x598f54,function(_0x34a1dd){if(_0x34a1dd[_0x45c5('0x2d')]!==_0x45c5('0x3b')){var _0x1fe904={};_0x1fe904[_0x34a1dd['name']]={'$like':'%'+_0x1c9ca8[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x1fe904;}})});}_0x133871=_[_0x45c5('0x3d')]({},_0x133871,_0x1c9ca8['options']);var _0x595fe0={'where':_0x133871[_0x45c5('0x3a')]};return db[_0x45c5('0x2b')][_0x45c5('0x1f')](_0x595fe0)[_0x45c5('0x26')](function(_0x4ee112){_0x175917[_0x45c5('0x1f')]=_0x4ee112;if(_0x1c9ca8['query'][_0x45c5('0x3e')]){_0x133871[_0x45c5('0x3f')]=[{'all':!![]}];}return db[_0x45c5('0x2b')][_0x45c5('0x40')](_0x133871);})[_0x45c5('0x26')](function(_0x4dc61c){_0x175917[_0x45c5('0x41')]=_0x4dc61c;return _0x175917;})[_0x45c5('0x26')](respondWithFilteredResult(_0x1ea63a,_0x133871))['catch'](handleError(_0x1ea63a,null));};exports[_0x45c5('0x42')]=function(_0x4d059a,_0x16fa42){var _0x106673={'raw':![],'where':{'id':_0x4d059a[_0x45c5('0x43')]['id']}},_0x1d2544={};_0x1d2544['model']=_[_0x45c5('0x44')](db[_0x45c5('0x2b')][_0x45c5('0x2c')]);_0x1d2544[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0x4d059a['query']);_0x1d2544[_0x45c5('0x39')]=_['intersection'](_0x1d2544['model'],_0x1d2544[_0x45c5('0x33')]);_0x106673['attributes']=_[_0x45c5('0x30')](_0x1d2544[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x4d059a[_0x45c5('0x33')][_0x45c5('0x32')]));_0x106673['attributes']=_0x106673['attributes'][_0x45c5('0x45')]?_0x106673[_0x45c5('0x31')]:_0x1d2544['model'];if(_0x4d059a[_0x45c5('0x33')][_0x45c5('0x3e')]){_0x106673[_0x45c5('0x3f')]=[{'all':!![]}];}_0x106673=_[_0x45c5('0x3d')]({},_0x106673,_0x4d059a[_0x45c5('0x46')]);return db[_0x45c5('0x2b')][_0x45c5('0x47')](_0x106673)[_0x45c5('0x26')](handleEntityNotFound(_0x16fa42,null))[_0x45c5('0x26')](respondWithResult(_0x16fa42,null))[_0x45c5('0x48')](handleError(_0x16fa42,null));};exports[_0x45c5('0x49')]=function(_0x1fc94d,_0x46b35e){return db[_0x45c5('0x2b')][_0x45c5('0x49')](_0x1fc94d[_0x45c5('0x4a')],{})[_0x45c5('0x26')](respondWithResult(_0x46b35e,0xc9))[_0x45c5('0x48')](handleError(_0x46b35e,null));};exports['update']=function(_0x32d9a3,_0x106594){if(_0x32d9a3[_0x45c5('0x4a')]['id']){delete _0x32d9a3[_0x45c5('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x45c5('0x47')]({'where':{'id':_0x32d9a3['params']['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x106594,null))[_0x45c5('0x26')](saveUpdates(_0x32d9a3[_0x45c5('0x4a')],null))[_0x45c5('0x26')](respondWithResult(_0x106594,null))[_0x45c5('0x48')](handleError(_0x106594,null));};exports[_0x45c5('0x4b')]=function(_0x776c97,_0xaf8a74){return db['SalesforceConfiguration'][_0x45c5('0x47')]({'where':{'id':_0x776c97[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0xaf8a74,null))[_0x45c5('0x26')](removeEntity(_0xaf8a74,null))[_0x45c5('0x48')](handleError(_0xaf8a74,null));};exports[_0x45c5('0x4c')]=function(_0xd9aa70,_0x16447f,_0xfa55eb){var _0x5d0b55={};var _0x523eea={};var _0x4631e5;var _0x1cd133;return db[_0x45c5('0x2b')][_0x45c5('0x4d')]({'where':{'id':_0xd9aa70[_0x45c5('0x43')]['id']}})['then'](handleEntityNotFound(_0x16447f,null))[_0x45c5('0x26')](function(_0x424d9d){if(_0x424d9d){_0x4631e5=_0x424d9d;_0x523eea['model']=_[_0x45c5('0x44')](db[_0x45c5('0x4e')][_0x45c5('0x2c')]);_0x523eea[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0xd9aa70[_0x45c5('0x33')]);_0x523eea['filters']=_[_0x45c5('0x30')](_0x523eea['model'],_0x523eea['query']);_0x5d0b55[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x523eea[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x32')]));_0x5d0b55['attributes']=_0x5d0b55[_0x45c5('0x31')]['length']?_0x5d0b55['attributes']:_0x523eea[_0x45c5('0x2f')];_0x5d0b55[_0x45c5('0x36')]=qs['sort'](_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x37')]);_0x5d0b55['where']=qs['filters'](_[_0x45c5('0x38')](_0xd9aa70[_0x45c5('0x33')],_0x523eea[_0x45c5('0x39')]));if(_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x5d0b55[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x5d0b55[_0x45c5('0x3a')],{'$or':_['map'](_0x5d0b55[_0x45c5('0x31')],function(_0x3132d3){var _0x5c33c5={};_0x5c33c5[_0x3132d3]={'$like':'%'+_0xd9aa70[_0x45c5('0x33')]['filter']+'%'};return _0x5c33c5;})});}_0x5d0b55=_[_0x45c5('0x3d')]({},_0x5d0b55,_0xd9aa70[_0x45c5('0x46')]);return _0x4631e5[_0x45c5('0x4c')](_0x5d0b55);}})[_0x45c5('0x26')](function(_0x9c0082){if(_0x9c0082){_0x1cd133=_0x9c0082[_0x45c5('0x45')];if(!_0xd9aa70[_0x45c5('0x33')][_0x45c5('0x34')](_0x45c5('0x35'))){_0x5d0b55[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0xd9aa70[_0x45c5('0x33')]['limit']);_0x5d0b55[_0x45c5('0x20')]=qs['offset'](_0xd9aa70[_0x45c5('0x33')]['offset']);}return _0x4631e5[_0x45c5('0x4c')](_0x5d0b55);}})[_0x45c5('0x26')](function(_0x4c104e){if(_0x4c104e){return _0x4c104e?{'count':_0x1cd133,'rows':_0x4c104e}:null;}})[_0x45c5('0x26')](respondWithResult(_0x16447f,null))[_0x45c5('0x48')](handleError(_0x16447f,null));};exports[_0x45c5('0x4f')]=function(_0x58db43,_0x3cc87a,_0x2c43b5){var _0x47c2fa={};var _0x58add6={};var _0x1859f7;var _0x10ec30;return db['SalesforceConfiguration'][_0x45c5('0x4d')]({'where':{'id':_0x58db43[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x3cc87a,null))[_0x45c5('0x26')](function(_0x1ecaea){if(_0x1ecaea){_0x1859f7=_0x1ecaea;_0x58add6[_0x45c5('0x2f')]=_[_0x45c5('0x44')](db['SalesforceField'][_0x45c5('0x2c')]);_0x58add6[_0x45c5('0x33')]=_[_0x45c5('0x44')](_0x58db43[_0x45c5('0x33')]);_0x58add6[_0x45c5('0x39')]=_[_0x45c5('0x30')](_0x58add6[_0x45c5('0x2f')],_0x58add6[_0x45c5('0x33')]);_0x47c2fa['attributes']=_[_0x45c5('0x30')](_0x58add6['model'],qs[_0x45c5('0x32')](_0x58db43['query'][_0x45c5('0x32')]));_0x47c2fa['attributes']=_0x47c2fa['attributes'][_0x45c5('0x45')]?_0x47c2fa['attributes']:_0x58add6[_0x45c5('0x2f')];_0x47c2fa[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x58db43['query']['sort']);_0x47c2fa[_0x45c5('0x3a')]=qs['filters'](_[_0x45c5('0x38')](_0x58db43[_0x45c5('0x33')],_0x58add6[_0x45c5('0x39')]));if(_0x58db43[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x47c2fa[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x47c2fa[_0x45c5('0x3a')],{'$or':_[_0x45c5('0x2a')](_0x47c2fa[_0x45c5('0x31')],function(_0x503d76){var _0x1e0eb9={};_0x1e0eb9[_0x503d76]={'$like':'%'+_0x58db43[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x1e0eb9;})});}_0x47c2fa=_['merge']({},_0x47c2fa,_0x58db43[_0x45c5('0x46')]);return _0x1859f7[_0x45c5('0x4f')](_0x47c2fa);}})[_0x45c5('0x26')](function(_0x523bfc){if(_0x523bfc){_0x10ec30=_0x523bfc[_0x45c5('0x45')];if(!_0x58db43['query'][_0x45c5('0x34')](_0x45c5('0x35'))){_0x47c2fa[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0x58db43['query'][_0x45c5('0x21')]);_0x47c2fa[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x58db43['query'][_0x45c5('0x20')]);}return _0x1859f7[_0x45c5('0x4f')](_0x47c2fa);}})[_0x45c5('0x26')](function(_0x1978be){if(_0x1978be){return _0x1978be?{'count':_0x10ec30,'rows':_0x1978be}:null;}})[_0x45c5('0x26')](respondWithResult(_0x3cc87a,null))[_0x45c5('0x48')](handleError(_0x3cc87a,null));};exports[_0x45c5('0x50')]=function(_0x348acb,_0x47f437,_0x423201){var _0x47436b={};var _0x4f18d0={};var _0x55c1a0;var _0x31a537;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x348acb[_0x45c5('0x43')]['id']}})[_0x45c5('0x26')](handleEntityNotFound(_0x47f437,null))[_0x45c5('0x26')](function(_0x199170){if(_0x199170){_0x55c1a0=_0x199170;_0x4f18d0['model']=_['keys'](db['SalesforceField'][_0x45c5('0x2c')]);_0x4f18d0[_0x45c5('0x33')]=_['keys'](_0x348acb['query']);_0x4f18d0[_0x45c5('0x39')]=_[_0x45c5('0x30')](_0x4f18d0[_0x45c5('0x2f')],_0x4f18d0[_0x45c5('0x33')]);_0x47436b[_0x45c5('0x31')]=_[_0x45c5('0x30')](_0x4f18d0[_0x45c5('0x2f')],qs[_0x45c5('0x32')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x32')]));_0x47436b['attributes']=_0x47436b[_0x45c5('0x31')]['length']?_0x47436b[_0x45c5('0x31')]:_0x4f18d0[_0x45c5('0x2f')];_0x47436b[_0x45c5('0x36')]=qs[_0x45c5('0x37')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x37')]);_0x47436b[_0x45c5('0x3a')]=qs[_0x45c5('0x39')](_[_0x45c5('0x38')](_0x348acb[_0x45c5('0x33')],_0x4f18d0['filters']));if(_0x348acb[_0x45c5('0x33')][_0x45c5('0x3c')]){_0x47436b[_0x45c5('0x3a')]=_[_0x45c5('0x3d')](_0x47436b[_0x45c5('0x3a')],{'$or':_[_0x45c5('0x2a')](_0x47436b[_0x45c5('0x31')],function(_0x179720){var _0x39ec1b={};_0x39ec1b[_0x179720]={'$like':'%'+_0x348acb[_0x45c5('0x33')][_0x45c5('0x3c')]+'%'};return _0x39ec1b;})});}_0x47436b=_[_0x45c5('0x3d')]({},_0x47436b,_0x348acb[_0x45c5('0x46')]);return _0x55c1a0[_0x45c5('0x50')](_0x47436b);}})[_0x45c5('0x26')](function(_0x4a21c8){if(_0x4a21c8){_0x31a537=_0x4a21c8[_0x45c5('0x45')];if(!_0x348acb[_0x45c5('0x33')]['hasOwnProperty'](_0x45c5('0x35'))){_0x47436b[_0x45c5('0x21')]=qs[_0x45c5('0x21')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x21')]);_0x47436b[_0x45c5('0x20')]=qs[_0x45c5('0x20')](_0x348acb[_0x45c5('0x33')][_0x45c5('0x20')]);}return _0x55c1a0[_0x45c5('0x50')](_0x47436b);}})[_0x45c5('0x26')](function(_0x2594cd){if(_0x2594cd){return _0x2594cd?{'count':_0x31a537,'rows':_0x2594cd}:null;}})[_0x45c5('0x26')](respondWithResult(_0x47f437,null))['catch'](handleError(_0x47f437,null));}; \ No newline at end of file +var _0x5893=['status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','name','send','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','findOne','SalesforceField','pick','map','getFields','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x5073c1,_0x3c0e62){var _0x2f3029=function(_0x246c4f){while(--_0x246c4f){_0x5073c1['push'](_0x5073c1['shift']());}};_0x2f3029(++_0x3c0e62);}(_0x5893,0x11d));var _0x3589=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5893[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3589('0x0'));var zipdir=require(_0x3589('0x1'));var jsonpatch=require(_0x3589('0x2'));var rp=require(_0x3589('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3589('0x4'));var path=require('path');var sox=require(_0x3589('0x5'));var csv=require(_0x3589('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3589('0x7'));var _=require(_0x3589('0x8'));var squel=require(_0x3589('0x9'));var crypto=require(_0x3589('0xa'));var jsforce=require(_0x3589('0xb'));var deskjs=require(_0x3589('0xc'));var toCsv=require(_0x3589('0x6'));var querystring=require(_0x3589('0xd'));var Papa=require(_0x3589('0xe'));var Redis=require(_0x3589('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3589('0x10'));var as=require(_0x3589('0x11'));var hardwareService=require(_0x3589('0x12'));var logger=require('../../config/logger')(_0x3589('0x13'));var utils=require(_0x3589('0x14'));var config=require(_0x3589('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca493,_0x3504ac){_0x3504ac=_0x3504ac||0xcc;return function(_0x201827){if(_0x201827){return _0x5ca493[_0x3589('0x16')](_0x3504ac);}return _0x5ca493[_0x3589('0x17')](_0x3504ac)[_0x3589('0x18')]();};}function respondWithResult(_0xbc983c,_0x582737){_0x582737=_0x582737||0xc8;return function(_0x4c2080){if(_0x4c2080){return _0xbc983c[_0x3589('0x17')](_0x582737)['json'](_0x4c2080);}};}function respondWithFilteredResult(_0x4408f3,_0x5cfcfd){return function(_0x13c728){if(_0x13c728){var _0x3b9374=typeof _0x5cfcfd[_0x3589('0x19')]===_0x3589('0x1a')&&typeof _0x5cfcfd[_0x3589('0x1b')]===_0x3589('0x1a');var _0x4a5828=_0x13c728['count'];var _0x2cdcb0=_0x3b9374?0x0:_0x5cfcfd[_0x3589('0x19')];var _0x5df5c6=_0x3b9374?_0x13c728[_0x3589('0x1c')]:_0x5cfcfd[_0x3589('0x19')]+_0x5cfcfd['limit'];var _0x53e3db;if(_0x5df5c6>=_0x4a5828){_0x5df5c6=_0x4a5828;_0x53e3db=0xc8;}else{_0x53e3db=0xce;}_0x4408f3[_0x3589('0x17')](_0x53e3db);return _0x4408f3[_0x3589('0x1d')]('Content-Range',_0x2cdcb0+'-'+_0x5df5c6+'/'+_0x4a5828)[_0x3589('0x1e')](_0x13c728);}return null;};}function patchUpdates(_0x46b398){return function(_0x3ab7e3){try{jsonpatch[_0x3589('0x1f')](_0x3ab7e3,_0x46b398,!![]);}catch(_0x346064){return BPromise[_0x3589('0x20')](_0x346064);}return _0x3ab7e3['save']();};}function saveUpdates(_0x2b10a8,_0x440c8d){return function(_0x7fcb89){if(_0x7fcb89){return _0x7fcb89[_0x3589('0x21')](_0x2b10a8)[_0x3589('0x22')](function(_0x1e692d){return _0x1e692d;});}return null;};}function removeEntity(_0x2c4723,_0x10c71c){return function(_0x4d4a91){if(_0x4d4a91){return _0x4d4a91[_0x3589('0x23')]()[_0x3589('0x22')](function(){_0x2c4723[_0x3589('0x17')](0xcc)[_0x3589('0x18')]();});}};}function handleEntityNotFound(_0x3f368a,_0x57b25d){return function(_0x4093a1){if(!_0x4093a1){_0x3f368a['sendStatus'](0x194);}return _0x4093a1;};}function handleError(_0x8f220,_0x44b620){_0x44b620=_0x44b620||0x1f4;return function(_0x507500){logger[_0x3589('0x24')](_0x507500['stack']);if(_0x507500[_0x3589('0x25')]){delete _0x507500[_0x3589('0x25')];}_0x8f220[_0x3589('0x17')](_0x44b620)[_0x3589('0x26')](_0x507500);};}exports['index']=function(_0x31e669,_0x26caeb){var _0x40dff2={},_0xecfb34={},_0x36675a={'count':0x0,'rows':[]};var _0x444381=_['map'](db[_0x3589('0x27')][_0x3589('0x28')],function(_0x15eacf){return{'name':_0x15eacf[_0x3589('0x29')],'type':_0x15eacf[_0x3589('0x2a')]['key']};});_0xecfb34[_0x3589('0x2b')]=_['map'](_0x444381,_0x3589('0x25'));_0xecfb34[_0x3589('0x2c')]=_[_0x3589('0x2d')](_0x31e669[_0x3589('0x2c')]);_0xecfb34['filters']=_[_0x3589('0x2e')](_0xecfb34[_0x3589('0x2b')],_0xecfb34[_0x3589('0x2c')]);_0x40dff2[_0x3589('0x2f')]=_[_0x3589('0x2e')](_0xecfb34[_0x3589('0x2b')],qs[_0x3589('0x30')](_0x31e669['query'][_0x3589('0x30')]));_0x40dff2[_0x3589('0x2f')]=_0x40dff2[_0x3589('0x2f')][_0x3589('0x31')]?_0x40dff2[_0x3589('0x2f')]:_0xecfb34[_0x3589('0x2b')];if(!_0x31e669[_0x3589('0x2c')]['hasOwnProperty'](_0x3589('0x32'))){_0x40dff2[_0x3589('0x1b')]=qs[_0x3589('0x1b')](_0x31e669[_0x3589('0x2c')][_0x3589('0x1b')]);_0x40dff2[_0x3589('0x19')]=qs[_0x3589('0x19')](_0x31e669['query']['offset']);}_0x40dff2[_0x3589('0x33')]=qs[_0x3589('0x34')](_0x31e669['query'][_0x3589('0x34')]);_0x40dff2[_0x3589('0x35')]=qs[_0x3589('0x36')](_['pick'](_0x31e669[_0x3589('0x2c')],_0xecfb34[_0x3589('0x36')]),_0x444381);if(_0x31e669[_0x3589('0x2c')][_0x3589('0x37')]){_0x40dff2['where']=_[_0x3589('0x38')](_0x40dff2[_0x3589('0x35')],{'$or':_['map'](_0x444381,function(_0x30bdae){if(_0x30bdae[_0x3589('0x2a')]!==_0x3589('0x39')){var _0x219deb={};_0x219deb[_0x30bdae['name']]={'$like':'%'+_0x31e669[_0x3589('0x2c')]['filter']+'%'};return _0x219deb;}})});}_0x40dff2=_[_0x3589('0x38')]({},_0x40dff2,_0x31e669['options']);var _0x57e005={'where':_0x40dff2['where']};return db[_0x3589('0x27')][_0x3589('0x1c')](_0x57e005)[_0x3589('0x22')](function(_0x58ee5d){_0x36675a[_0x3589('0x1c')]=_0x58ee5d;if(_0x31e669[_0x3589('0x2c')]['includeAll']){_0x40dff2[_0x3589('0x3a')]=[{'all':!![]}];}return db[_0x3589('0x27')][_0x3589('0x3b')](_0x40dff2);})[_0x3589('0x22')](function(_0x4c83d7){_0x36675a[_0x3589('0x3c')]=_0x4c83d7;return _0x36675a;})[_0x3589('0x22')](respondWithFilteredResult(_0x26caeb,_0x40dff2))[_0x3589('0x3d')](handleError(_0x26caeb,null));};exports[_0x3589('0x3e')]=function(_0x22deb3,_0x4a093d){var _0x31e919={'raw':![],'where':{'id':_0x22deb3[_0x3589('0x3f')]['id']}},_0x49d913={};_0x49d913['model']=_[_0x3589('0x2d')](db['SalesforceConfiguration'][_0x3589('0x28')]);_0x49d913[_0x3589('0x2c')]=_[_0x3589('0x2d')](_0x22deb3['query']);_0x49d913[_0x3589('0x36')]=_[_0x3589('0x2e')](_0x49d913[_0x3589('0x2b')],_0x49d913['query']);_0x31e919[_0x3589('0x2f')]=_[_0x3589('0x2e')](_0x49d913[_0x3589('0x2b')],qs[_0x3589('0x30')](_0x22deb3['query'][_0x3589('0x30')]));_0x31e919[_0x3589('0x2f')]=_0x31e919[_0x3589('0x2f')][_0x3589('0x31')]?_0x31e919[_0x3589('0x2f')]:_0x49d913[_0x3589('0x2b')];if(_0x22deb3['query'][_0x3589('0x40')]){_0x31e919['include']=[{'all':!![]}];}_0x31e919=_[_0x3589('0x38')]({},_0x31e919,_0x22deb3[_0x3589('0x41')]);return db[_0x3589('0x27')][_0x3589('0x42')](_0x31e919)[_0x3589('0x22')](handleEntityNotFound(_0x4a093d,null))['then'](respondWithResult(_0x4a093d,null))[_0x3589('0x3d')](handleError(_0x4a093d,null));};exports['create']=function(_0x8c7bf6,_0x27e9b7){return db['SalesforceConfiguration'][_0x3589('0x43')](_0x8c7bf6[_0x3589('0x44')],{})['then'](respondWithResult(_0x27e9b7,0xc9))[_0x3589('0x3d')](handleError(_0x27e9b7,null));};exports[_0x3589('0x21')]=function(_0xc31ea0,_0x166cfb){if(_0xc31ea0['body']['id']){delete _0xc31ea0[_0x3589('0x44')]['id'];}return db['SalesforceConfiguration'][_0x3589('0x42')]({'where':{'id':_0xc31ea0['params']['id']}})[_0x3589('0x22')](handleEntityNotFound(_0x166cfb,null))[_0x3589('0x22')](saveUpdates(_0xc31ea0['body'],null))[_0x3589('0x22')](respondWithResult(_0x166cfb,null))[_0x3589('0x3d')](handleError(_0x166cfb,null));};exports['destroy']=function(_0x1ab82f,_0x97c8b7){return db[_0x3589('0x27')]['find']({'where':{'id':_0x1ab82f['params']['id']}})['then'](handleEntityNotFound(_0x97c8b7,null))[_0x3589('0x22')](removeEntity(_0x97c8b7,null))[_0x3589('0x3d')](handleError(_0x97c8b7,null));};exports['getFields']=function(_0x4cf0d6,_0x48d9f5,_0x3064f1){var _0xacd5ac={};var _0x5da7b7={};var _0x517a40;var _0x3ab401;return db['SalesforceConfiguration'][_0x3589('0x45')]({'where':{'id':_0x4cf0d6[_0x3589('0x3f')]['id']}})[_0x3589('0x22')](handleEntityNotFound(_0x48d9f5,null))[_0x3589('0x22')](function(_0x2535d7){if(_0x2535d7){_0x517a40=_0x2535d7;_0x5da7b7[_0x3589('0x2b')]=_[_0x3589('0x2d')](db[_0x3589('0x46')][_0x3589('0x28')]);_0x5da7b7[_0x3589('0x2c')]=_[_0x3589('0x2d')](_0x4cf0d6[_0x3589('0x2c')]);_0x5da7b7[_0x3589('0x36')]=_[_0x3589('0x2e')](_0x5da7b7[_0x3589('0x2b')],_0x5da7b7['query']);_0xacd5ac[_0x3589('0x2f')]=_[_0x3589('0x2e')](_0x5da7b7[_0x3589('0x2b')],qs['fields'](_0x4cf0d6[_0x3589('0x2c')]['fields']));_0xacd5ac[_0x3589('0x2f')]=_0xacd5ac[_0x3589('0x2f')][_0x3589('0x31')]?_0xacd5ac['attributes']:_0x5da7b7['model'];_0xacd5ac[_0x3589('0x33')]=qs[_0x3589('0x34')](_0x4cf0d6[_0x3589('0x2c')]['sort']);_0xacd5ac[_0x3589('0x35')]=qs[_0x3589('0x36')](_[_0x3589('0x47')](_0x4cf0d6['query'],_0x5da7b7[_0x3589('0x36')]));if(_0x4cf0d6[_0x3589('0x2c')]['filter']){_0xacd5ac[_0x3589('0x35')]=_[_0x3589('0x38')](_0xacd5ac['where'],{'$or':_[_0x3589('0x48')](_0xacd5ac['attributes'],function(_0x3c4bbf){var _0x2d2da7={};_0x2d2da7[_0x3c4bbf]={'$like':'%'+_0x4cf0d6['query'][_0x3589('0x37')]+'%'};return _0x2d2da7;})});}_0xacd5ac=_['merge']({},_0xacd5ac,_0x4cf0d6[_0x3589('0x41')]);return _0x517a40[_0x3589('0x49')](_0xacd5ac);}})['then'](function(_0x2de028){if(_0x2de028){_0x3ab401=_0x2de028[_0x3589('0x31')];if(!_0x4cf0d6[_0x3589('0x2c')]['hasOwnProperty'](_0x3589('0x32'))){_0xacd5ac['limit']=qs[_0x3589('0x1b')](_0x4cf0d6['query']['limit']);_0xacd5ac[_0x3589('0x19')]=qs[_0x3589('0x19')](_0x4cf0d6[_0x3589('0x2c')][_0x3589('0x19')]);}return _0x517a40[_0x3589('0x49')](_0xacd5ac);}})[_0x3589('0x22')](function(_0x54edfb){if(_0x54edfb){return _0x54edfb?{'count':_0x3ab401,'rows':_0x54edfb}:null;}})[_0x3589('0x22')](respondWithResult(_0x48d9f5,null))[_0x3589('0x3d')](handleError(_0x48d9f5,null));};exports['getSubjects']=function(_0x4fdd7b,_0x1858df,_0x495a40){var _0x39ff87={};var _0x5c4d65={};var _0x1d59dd;var _0x6acd3a;return db[_0x3589('0x27')][_0x3589('0x45')]({'where':{'id':_0x4fdd7b[_0x3589('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1858df,null))[_0x3589('0x22')](function(_0x55635b){if(_0x55635b){_0x1d59dd=_0x55635b;_0x5c4d65[_0x3589('0x2b')]=_['keys'](db[_0x3589('0x46')]['rawAttributes']);_0x5c4d65['query']=_['keys'](_0x4fdd7b[_0x3589('0x2c')]);_0x5c4d65[_0x3589('0x36')]=_[_0x3589('0x2e')](_0x5c4d65[_0x3589('0x2b')],_0x5c4d65[_0x3589('0x2c')]);_0x39ff87[_0x3589('0x2f')]=_[_0x3589('0x2e')](_0x5c4d65['model'],qs[_0x3589('0x30')](_0x4fdd7b['query'][_0x3589('0x30')]));_0x39ff87['attributes']=_0x39ff87[_0x3589('0x2f')]['length']?_0x39ff87[_0x3589('0x2f')]:_0x5c4d65['model'];_0x39ff87['order']=qs[_0x3589('0x34')](_0x4fdd7b[_0x3589('0x2c')][_0x3589('0x34')]);_0x39ff87[_0x3589('0x35')]=qs[_0x3589('0x36')](_['pick'](_0x4fdd7b[_0x3589('0x2c')],_0x5c4d65[_0x3589('0x36')]));if(_0x4fdd7b[_0x3589('0x2c')][_0x3589('0x37')]){_0x39ff87[_0x3589('0x35')]=_['merge'](_0x39ff87[_0x3589('0x35')],{'$or':_[_0x3589('0x48')](_0x39ff87[_0x3589('0x2f')],function(_0x2cc622){var _0x3c90e1={};_0x3c90e1[_0x2cc622]={'$like':'%'+_0x4fdd7b['query'][_0x3589('0x37')]+'%'};return _0x3c90e1;})});}_0x39ff87=_[_0x3589('0x38')]({},_0x39ff87,_0x4fdd7b[_0x3589('0x41')]);return _0x1d59dd[_0x3589('0x4a')](_0x39ff87);}})['then'](function(_0x28104d){if(_0x28104d){_0x6acd3a=_0x28104d[_0x3589('0x31')];if(!_0x4fdd7b[_0x3589('0x2c')][_0x3589('0x4b')]('nolimit')){_0x39ff87[_0x3589('0x1b')]=qs[_0x3589('0x1b')](_0x4fdd7b[_0x3589('0x2c')][_0x3589('0x1b')]);_0x39ff87[_0x3589('0x19')]=qs[_0x3589('0x19')](_0x4fdd7b[_0x3589('0x2c')][_0x3589('0x19')]);}return _0x1d59dd[_0x3589('0x4a')](_0x39ff87);}})[_0x3589('0x22')](function(_0x303e80){if(_0x303e80){return _0x303e80?{'count':_0x6acd3a,'rows':_0x303e80}:null;}})[_0x3589('0x22')](respondWithResult(_0x1858df,null))[_0x3589('0x3d')](handleError(_0x1858df,null));};exports[_0x3589('0x4c')]=function(_0xdcb678,_0x4ed4b8,_0x3f7d45){var _0xaf4b23={};var _0x3a8af6={};var _0xf92ba7;var _0x3e3a9c;return db[_0x3589('0x27')][_0x3589('0x45')]({'where':{'id':_0xdcb678['params']['id']}})[_0x3589('0x22')](handleEntityNotFound(_0x4ed4b8,null))[_0x3589('0x22')](function(_0x189a36){if(_0x189a36){_0xf92ba7=_0x189a36;_0x3a8af6[_0x3589('0x2b')]=_[_0x3589('0x2d')](db[_0x3589('0x46')][_0x3589('0x28')]);_0x3a8af6[_0x3589('0x2c')]=_[_0x3589('0x2d')](_0xdcb678[_0x3589('0x2c')]);_0x3a8af6[_0x3589('0x36')]=_[_0x3589('0x2e')](_0x3a8af6['model'],_0x3a8af6[_0x3589('0x2c')]);_0xaf4b23['attributes']=_[_0x3589('0x2e')](_0x3a8af6[_0x3589('0x2b')],qs[_0x3589('0x30')](_0xdcb678[_0x3589('0x2c')]['fields']));_0xaf4b23['attributes']=_0xaf4b23['attributes']['length']?_0xaf4b23[_0x3589('0x2f')]:_0x3a8af6['model'];_0xaf4b23[_0x3589('0x33')]=qs[_0x3589('0x34')](_0xdcb678['query']['sort']);_0xaf4b23[_0x3589('0x35')]=qs[_0x3589('0x36')](_[_0x3589('0x47')](_0xdcb678[_0x3589('0x2c')],_0x3a8af6[_0x3589('0x36')]));if(_0xdcb678[_0x3589('0x2c')][_0x3589('0x37')]){_0xaf4b23[_0x3589('0x35')]=_[_0x3589('0x38')](_0xaf4b23['where'],{'$or':_['map'](_0xaf4b23[_0x3589('0x2f')],function(_0x39e791){var _0x45a912={};_0x45a912[_0x39e791]={'$like':'%'+_0xdcb678['query'][_0x3589('0x37')]+'%'};return _0x45a912;})});}_0xaf4b23=_[_0x3589('0x38')]({},_0xaf4b23,_0xdcb678[_0x3589('0x41')]);return _0xf92ba7[_0x3589('0x4c')](_0xaf4b23);}})[_0x3589('0x22')](function(_0x1030c8){if(_0x1030c8){_0x3e3a9c=_0x1030c8[_0x3589('0x31')];if(!_0xdcb678[_0x3589('0x2c')]['hasOwnProperty'](_0x3589('0x32'))){_0xaf4b23[_0x3589('0x1b')]=qs['limit'](_0xdcb678[_0x3589('0x2c')][_0x3589('0x1b')]);_0xaf4b23[_0x3589('0x19')]=qs['offset'](_0xdcb678[_0x3589('0x2c')]['offset']);}return _0xf92ba7['getDescriptions'](_0xaf4b23);}})[_0x3589('0x22')](function(_0x2df7c7){if(_0x2df7c7){return _0x2df7c7?{'count':_0x3e3a9c,'rows':_0x2df7c7}:null;}})[_0x3589('0x22')](respondWithResult(_0x4ed4b8,null))[_0x3589('0x3d')](handleError(_0x4ed4b8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9f8c528..d0a4516 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 _0x14a7=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x133f78,_0x32c4af){var _0x213cd3=function(_0x344b8c){while(--_0x344b8c){_0x133f78['push'](_0x133f78['shift']());}};_0x213cd3(++_0x32c4af);}(_0x14a7,0x149));var _0x714a=function(_0x1faed1,_0x4330d3){_0x1faed1=_0x1faed1-0x0;var _0x16c1c9=_0x14a7[_0x1faed1];return _0x16c1c9;};'use strict';var _=require(_0x714a('0x0'));var util=require(_0x714a('0x1'));var logger=require('../../config/logger')(_0x714a('0x2'));var moment=require(_0x714a('0x3'));var BPromise=require(_0x714a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x714a('0x5'));var rimraf=require(_0x714a('0x6'));var config=require(_0x714a('0x7'));var attributes=require(_0x714a('0x8'));module[_0x714a('0x9')]=function(_0x30c41a,_0x3a06c8){return _0x30c41a[_0x714a('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x714a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98b3=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x298869,_0x3b18b3){var _0x6e03d6=function(_0x4ce65e){while(--_0x4ce65e){_0x298869['push'](_0x298869['shift']());}};_0x6e03d6(++_0x3b18b3);}(_0x98b3,0x117));var _0x398b=function(_0x4b4220,_0x204249){_0x4b4220=_0x4b4220-0x0;var _0x437f2c=_0x98b3[_0x4b4220];return _0x437f2c;};'use strict';var _=require(_0x398b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x398b('0x1'));var BPromise=require(_0x398b('0x2'));var rp=require(_0x398b('0x3'));var fs=require('fs');var path=require(_0x398b('0x4'));var rimraf=require(_0x398b('0x5'));var config=require(_0x398b('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x398b('0x7')]=function(_0x5a7146,_0x4a2d67){return _0x5a7146[_0x398b('0x8')](_0x398b('0x9'),attributes,{'tableName':_0x398b('0xa'),'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 d2d0ccf..58b1e44 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 _0xfb8c=['client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xc7b3c7,_0x4755d5){var _0x51c8d9=function(_0x43dab8){while(--_0x43dab8){_0xc7b3c7['push'](_0xc7b3c7['shift']());}};_0x51c8d9(++_0x4755d5);}(_0xfb8c,0xbe));var _0xcfb8=function(_0x54d1f4,_0x195be5){_0x54d1f4=_0x54d1f4-0x0;var _0x3bfb51=_0xfb8c[_0x54d1f4];return _0x3bfb51;};'use strict';var _=require(_0xcfb8('0x0'));var util=require('util');var moment=require(_0xcfb8('0x1'));var BPromise=require(_0xcfb8('0x2'));var rs=require(_0xcfb8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcfb8('0x4'));var logger=require(_0xcfb8('0x5'))('rpc');var config=require(_0xcfb8('0x6'));var jayson=require(_0xcfb8('0x7'));var client=jayson[_0xcfb8('0x8')][_0xcfb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9403,_0x1062d4,_0x1608d7){return new BPromise(function(_0x419e9d,_0x44ec1a){return client[_0xcfb8('0xa')](_0x2e9403,_0x1608d7)[_0xcfb8('0xb')](function(_0x5cfc7f){logger[_0xcfb8('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1062d4,_0xcfb8('0xd'));logger[_0xcfb8('0xe')](_0xcfb8('0xf'),_0x1062d4,'request\x20sent',JSON[_0xcfb8('0x10')](_0x5cfc7f));if(_0x5cfc7f[_0xcfb8('0x11')]){if(_0x5cfc7f[_0xcfb8('0x11')][_0xcfb8('0x12')]===0x1f4){logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x5cfc7f['error'][_0xcfb8('0x14')]);return _0x44ec1a(_0x5cfc7f[_0xcfb8('0x11')]['message']);}logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x5cfc7f[_0xcfb8('0x11')][_0xcfb8('0x14')]);return _0x419e9d(_0x5cfc7f['error']['message']);}else{logger[_0xcfb8('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1062d4,_0xcfb8('0xd'));_0x419e9d(_0x5cfc7f[_0xcfb8('0x15')][_0xcfb8('0x14')]);}})['catch'](function(_0x39c750){logger[_0xcfb8('0x11')](_0xcfb8('0x13'),_0x1062d4,_0x39c750);_0x44ec1a(_0x39c750);});});} \ No newline at end of file +var _0x6b0b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x558b56,_0x133816){var _0x3996d3=function(_0x56c83e){while(--_0x56c83e){_0x558b56['push'](_0x558b56['shift']());}};_0x3996d3(++_0x133816);}(_0x6b0b,0x9e));var _0xb6b0=function(_0x1cb614,_0x517b67){_0x1cb614=_0x1cb614-0x0;var _0x2b2d0c=_0x6b0b[_0x1cb614];return _0x2b2d0c;};'use strict';var _=require(_0xb6b0('0x0'));var util=require(_0xb6b0('0x1'));var moment=require(_0xb6b0('0x2'));var BPromise=require(_0xb6b0('0x3'));var rs=require(_0xb6b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6b0('0x5'))['db'];var utils=require(_0xb6b0('0x6'));var logger=require('../../config/logger')(_0xb6b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6b0('0x8'));var client=jayson[_0xb6b0('0x9')][_0xb6b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a4779,_0x85b2a1,_0x57d619){return new BPromise(function(_0x5b06eb,_0x4589d7){return client[_0xb6b0('0xb')](_0x4a4779,_0x57d619)[_0xb6b0('0xc')](function(_0x191697){logger[_0xb6b0('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x85b2a1,_0xb6b0('0xe'));logger['debug'](_0xb6b0('0xf'),_0x85b2a1,_0xb6b0('0xe'),JSON[_0xb6b0('0x10')](_0x191697));if(_0x191697['error']){if(_0x191697['error'][_0xb6b0('0x11')]===0x1f4){logger[_0xb6b0('0x12')](_0xb6b0('0x13'),_0x85b2a1,_0x191697[_0xb6b0('0x12')][_0xb6b0('0x14')]);return _0x4589d7(_0x191697['error'][_0xb6b0('0x14')]);}logger[_0xb6b0('0x12')](_0xb6b0('0x13'),_0x85b2a1,_0x191697[_0xb6b0('0x12')][_0xb6b0('0x14')]);return _0x5b06eb(_0x191697[_0xb6b0('0x12')][_0xb6b0('0x14')]);}else{logger[_0xb6b0('0xd')](_0xb6b0('0x13'),_0x85b2a1,'request\x20sent');_0x5b06eb(_0x191697[_0xb6b0('0x15')][_0xb6b0('0x14')]);}})[_0xb6b0('0x16')](function(_0x26a9c0){logger[_0xb6b0('0x12')](_0xb6b0('0x13'),_0x85b2a1,_0x26a9c0);_0x4589d7(_0x26a9c0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4d1e9db..8f0e08c 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 _0x0006=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer'];(function(_0x2ed3a2,_0x5cc62a){var _0xf11bbc=function(_0x241d9d){while(--_0x241d9d){_0x2ed3a2['push'](_0x2ed3a2['shift']());}};_0xf11bbc(++_0x5cc62a);}(_0x0006,0x18f));var _0x6000=function(_0x5447a1,_0x226452){_0x5447a1=_0x5447a1-0x0;var _0x59bf42=_0x0006[_0x5447a1];return _0x59bf42;};'use strict';var multer=require(_0x6000('0x0'));var util=require(_0x6000('0x1'));var path=require(_0x6000('0x2'));var timeout=require(_0x6000('0x3'));var express=require(_0x6000('0x4'));var router=express[_0x6000('0x5')]();var fs_extra=require(_0x6000('0x6'));var auth=require(_0x6000('0x7'));var interaction=require(_0x6000('0x8'));var config=require(_0x6000('0x9'));var controller=require(_0x6000('0xa'));router[_0x6000('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6000('0xb')](_0x6000('0xc'),auth[_0x6000('0xd')](),controller[_0x6000('0xe')]);router[_0x6000('0xf')]('/',auth[_0x6000('0xd')](),controller['create']);router['put'](_0x6000('0xc'),auth[_0x6000('0xd')](),controller[_0x6000('0x10')]);router[_0x6000('0x11')]('/:id',auth[_0x6000('0xd')](),controller[_0x6000('0x12')]);module[_0x6000('0x13')]=router; \ No newline at end of file +var _0x7b7f=['./intSalesforceField.controller','get','/:id','isAuthenticated','show','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1e7944,_0x5a1ee7){var _0x4be825=function(_0x14932d){while(--_0x14932d){_0x1e7944['push'](_0x1e7944['shift']());}};_0x4be825(++_0x5a1ee7);}(_0x7b7f,0x17f));var _0xf7b7=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7b7f[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0xf7b7('0x0'));var path=require(_0xf7b7('0x1'));var timeout=require(_0xf7b7('0x2'));var express=require(_0xf7b7('0x3'));var router=express[_0xf7b7('0x4')]();var fs_extra=require(_0xf7b7('0x5'));var auth=require(_0xf7b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7b7('0x7'));var controller=require(_0xf7b7('0x8'));router[_0xf7b7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf7b7('0xa'),auth[_0xf7b7('0xb')](),controller[_0xf7b7('0xc')]);router[_0xf7b7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf7b7('0xe')]);router[_0xf7b7('0xf')](_0xf7b7('0xa'),auth[_0xf7b7('0xb')](),controller[_0xf7b7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4d0b07f..efba4ed 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 _0xf55b=['exports','string','customVariable','keyValue','STRING','variable','sequelize'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0xf55b,0x1bf));var _0xbf55=function(_0xf9968b,_0x2a7d07){_0xf9968b=_0xf9968b-0x0;var _0x206bd5=_0xf55b[_0xf9968b];return _0x206bd5;};'use strict';var Sequelize=require(_0xbf55('0x0'));module[_0xbf55('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbf55('0x2'),'variable',_0xbf55('0x3'),_0xbf55('0x4'),'picklist'),'defaultValue':_0xbf55('0x2')},'content':{'type':Sequelize[_0xbf55('0x5')]},'key':{'type':Sequelize[_0xbf55('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbf55('0x2'),_0xbf55('0x6'),_0xbf55('0x3'))},'keyContent':{'type':Sequelize[_0xbf55('0x5')]},'idField':{'type':Sequelize[_0xbf55('0x5')]},'variableName':{'type':Sequelize[_0xbf55('0x5')]}}; \ No newline at end of file +var _0xe499=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x4da763,_0x4532ca){var _0xa1945f=function(_0x3c99d2){while(--_0x3c99d2){_0x4da763['push'](_0x4da763['shift']());}};_0xa1945f(++_0x4532ca);}(_0xe499,0x68));var _0x9e49=function(_0x22ba6,_0x18dc12){_0x22ba6=_0x22ba6-0x0;var _0x4dca2e=_0xe499[_0x22ba6];return _0x4dca2e;};'use strict';var Sequelize=require(_0x9e49('0x0'));module[_0x9e49('0x1')]={'type':{'type':Sequelize[_0x9e49('0x2')](_0x9e49('0x3'),_0x9e49('0x4'),_0x9e49('0x5'),_0x9e49('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9e49('0x7')]},'key':{'type':Sequelize[_0x9e49('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9e49('0x3'),_0x9e49('0x4'),_0x9e49('0x5'))},'keyContent':{'type':Sequelize[_0x9e49('0x7')]},'idField':{'type':Sequelize[_0x9e49('0x7')]},'variableName':{'type':Sequelize[_0x9e49('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f95a700..d943eb7 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 _0xf77a=['filter','options','includeAll','include','rows','params','rawAttributes','merge','find','create','body','catch','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4b2c0f,_0x342192){var _0x332132=function(_0x318683){while(--_0x318683){_0x4b2c0f['push'](_0x4b2c0f['shift']());}};_0x332132(++_0x342192);}(_0xf77a,0xa4));var _0xaf77=function(_0x9458c0,_0x513288){_0x9458c0=_0x9458c0-0x0;var _0x45656e=_0xf77a[_0x9458c0];return _0x45656e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf77('0x0'));var zipdir=require(_0xaf77('0x1'));var jsonpatch=require(_0xaf77('0x2'));var rp=require(_0xaf77('0x3'));var moment=require(_0xaf77('0x4'));var BPromise=require(_0xaf77('0x5'));var Mustache=require('mustache');var util=require(_0xaf77('0x6'));var path=require('path');var sox=require(_0xaf77('0x7'));var csv=require(_0xaf77('0x8'));var ejs=require(_0xaf77('0x9'));var fs=require('fs');var fs_extra=require(_0xaf77('0xa'));var _=require(_0xaf77('0xb'));var squel=require(_0xaf77('0xc'));var crypto=require(_0xaf77('0xd'));var jsforce=require(_0xaf77('0xe'));var deskjs=require(_0xaf77('0xf'));var toCsv=require(_0xaf77('0x8'));var querystring=require(_0xaf77('0x10'));var Papa=require(_0xaf77('0x11'));var Redis=require(_0xaf77('0x12'));var authService=require(_0xaf77('0x13'));var qs=require(_0xaf77('0x14'));var as=require(_0xaf77('0x15'));var hardwareService=require(_0xaf77('0x16'));var logger=require(_0xaf77('0x17'))(_0xaf77('0x18'));var utils=require(_0xaf77('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaf77('0x1a'));var db=require(_0xaf77('0x1b'))['db'];function respondWithStatusCode(_0x139dc7,_0x20b82a){_0x20b82a=_0x20b82a||0xcc;return function(_0x44195d){if(_0x44195d){return _0x139dc7[_0xaf77('0x1c')](_0x20b82a);}return _0x139dc7[_0xaf77('0x1d')](_0x20b82a)[_0xaf77('0x1e')]();};}function respondWithResult(_0x216cfd,_0x35617c){_0x35617c=_0x35617c||0xc8;return function(_0x2b92e2){if(_0x2b92e2){return _0x216cfd[_0xaf77('0x1d')](_0x35617c)[_0xaf77('0x1f')](_0x2b92e2);}};}function respondWithFilteredResult(_0x30b8ee,_0x58c076){return function(_0x418bef){if(_0x418bef){var _0x32523f=typeof _0x58c076[_0xaf77('0x20')]===_0xaf77('0x21')&&typeof _0x58c076[_0xaf77('0x22')]==='undefined';var _0x329128=_0x418bef[_0xaf77('0x23')];var _0x256890=_0x32523f?0x0:_0x58c076[_0xaf77('0x20')];var _0x4cd94f=_0x32523f?_0x418bef[_0xaf77('0x23')]:_0x58c076[_0xaf77('0x20')]+_0x58c076[_0xaf77('0x22')];var _0x2fd0ad;if(_0x4cd94f>=_0x329128){_0x4cd94f=_0x329128;_0x2fd0ad=0xc8;}else{_0x2fd0ad=0xce;}_0x30b8ee[_0xaf77('0x1d')](_0x2fd0ad);return _0x30b8ee['set'](_0xaf77('0x24'),_0x256890+'-'+_0x4cd94f+'/'+_0x329128)[_0xaf77('0x1f')](_0x418bef);}return null;};}function patchUpdates(_0xaa14f3){return function(_0x2e722f){try{jsonpatch[_0xaf77('0x25')](_0x2e722f,_0xaa14f3,!![]);}catch(_0x341406){return BPromise[_0xaf77('0x26')](_0x341406);}return _0x2e722f[_0xaf77('0x27')]();};}function saveUpdates(_0x17672d,_0x106d33){return function(_0x174f96){if(_0x174f96){return _0x174f96[_0xaf77('0x28')](_0x17672d)[_0xaf77('0x29')](function(_0x4887dd){return _0x4887dd;});}return null;};}function removeEntity(_0x6bd263,_0x7d7374){return function(_0x2804f9){if(_0x2804f9){return _0x2804f9[_0xaf77('0x2a')]()[_0xaf77('0x29')](function(){_0x6bd263['status'](0xcc)[_0xaf77('0x1e')]();});}};}function handleEntityNotFound(_0x4a6f0b,_0x579acf){return function(_0x2880da){if(!_0x2880da){_0x4a6f0b[_0xaf77('0x1c')](0x194);}return _0x2880da;};}function handleError(_0x243ac1,_0x26ff1d){_0x26ff1d=_0x26ff1d||0x1f4;return function(_0x4ae7ed){logger[_0xaf77('0x2b')](_0x4ae7ed[_0xaf77('0x2c')]);if(_0x4ae7ed[_0xaf77('0x2d')]){delete _0x4ae7ed['name'];}_0x243ac1['status'](_0x26ff1d)['send'](_0x4ae7ed);};}exports[_0xaf77('0x2e')]=function(_0x114e6f,_0x48ac2a){var _0x1159f2={},_0xe7f67={},_0x2aadea={'count':0x0,'rows':[]};var _0xd86de4=_[_0xaf77('0x2f')](db[_0xaf77('0x30')]['rawAttributes'],function(_0x85986b){return{'name':_0x85986b[_0xaf77('0x31')],'type':_0x85986b[_0xaf77('0x32')]['key']};});_0xe7f67['model']=_[_0xaf77('0x2f')](_0xd86de4,_0xaf77('0x2d'));_0xe7f67[_0xaf77('0x33')]=_[_0xaf77('0x34')](_0x114e6f[_0xaf77('0x33')]);_0xe7f67[_0xaf77('0x35')]=_[_0xaf77('0x36')](_0xe7f67[_0xaf77('0x37')],_0xe7f67[_0xaf77('0x33')]);_0x1159f2['attributes']=_['intersection'](_0xe7f67[_0xaf77('0x37')],qs[_0xaf77('0x38')](_0x114e6f['query']['fields']));_0x1159f2['attributes']=_0x1159f2[_0xaf77('0x39')][_0xaf77('0x3a')]?_0x1159f2[_0xaf77('0x39')]:_0xe7f67[_0xaf77('0x37')];if(!_0x114e6f['query'][_0xaf77('0x3b')](_0xaf77('0x3c'))){_0x1159f2[_0xaf77('0x22')]=qs['limit'](_0x114e6f['query']['limit']);_0x1159f2[_0xaf77('0x20')]=qs['offset'](_0x114e6f[_0xaf77('0x33')]['offset']);}_0x1159f2[_0xaf77('0x3d')]=qs[_0xaf77('0x3e')](_0x114e6f['query']['sort']);_0x1159f2[_0xaf77('0x3f')]=qs[_0xaf77('0x35')](_['pick'](_0x114e6f[_0xaf77('0x33')],_0xe7f67[_0xaf77('0x35')]),_0xd86de4);if(_0x114e6f[_0xaf77('0x33')]['filter']){_0x1159f2[_0xaf77('0x3f')]=_['merge'](_0x1159f2[_0xaf77('0x3f')],{'$or':_[_0xaf77('0x2f')](_0xd86de4,function(_0x5bb90a){if(_0x5bb90a['type']!=='VIRTUAL'){var _0x20f76c={};_0x20f76c[_0x5bb90a[_0xaf77('0x2d')]]={'$like':'%'+_0x114e6f['query'][_0xaf77('0x40')]+'%'};return _0x20f76c;}})});}_0x1159f2=_['merge']({},_0x1159f2,_0x114e6f[_0xaf77('0x41')]);var _0x179999={'where':_0x1159f2['where']};return db[_0xaf77('0x30')][_0xaf77('0x23')](_0x179999)['then'](function(_0xf2fda5){_0x2aadea['count']=_0xf2fda5;if(_0x114e6f['query'][_0xaf77('0x42')]){_0x1159f2[_0xaf77('0x43')]=[{'all':!![]}];}return db[_0xaf77('0x30')]['findAll'](_0x1159f2);})[_0xaf77('0x29')](function(_0x37b18d){_0x2aadea[_0xaf77('0x44')]=_0x37b18d;return _0x2aadea;})[_0xaf77('0x29')](respondWithFilteredResult(_0x48ac2a,_0x1159f2))['catch'](handleError(_0x48ac2a,null));};exports['show']=function(_0x1b4e85,_0x1e4e31){var _0x399bf2={'raw':!![],'where':{'id':_0x1b4e85[_0xaf77('0x45')]['id']}},_0x5c944a={};_0x5c944a[_0xaf77('0x37')]=_[_0xaf77('0x34')](db[_0xaf77('0x30')][_0xaf77('0x46')]);_0x5c944a[_0xaf77('0x33')]=_[_0xaf77('0x34')](_0x1b4e85[_0xaf77('0x33')]);_0x5c944a['filters']=_[_0xaf77('0x36')](_0x5c944a[_0xaf77('0x37')],_0x5c944a[_0xaf77('0x33')]);_0x399bf2[_0xaf77('0x39')]=_['intersection'](_0x5c944a[_0xaf77('0x37')],qs[_0xaf77('0x38')](_0x1b4e85[_0xaf77('0x33')][_0xaf77('0x38')]));_0x399bf2[_0xaf77('0x39')]=_0x399bf2[_0xaf77('0x39')][_0xaf77('0x3a')]?_0x399bf2['attributes']:_0x5c944a['model'];if(_0x1b4e85[_0xaf77('0x33')][_0xaf77('0x42')]){_0x399bf2['include']=[{'all':!![]}];}_0x399bf2=_[_0xaf77('0x47')]({},_0x399bf2,_0x1b4e85['options']);return db['SalesforceField'][_0xaf77('0x48')](_0x399bf2)[_0xaf77('0x29')](handleEntityNotFound(_0x1e4e31,null))[_0xaf77('0x29')](respondWithResult(_0x1e4e31,null))['catch'](handleError(_0x1e4e31,null));};exports['create']=function(_0x322f3e,_0x2cc07d){return db[_0xaf77('0x30')][_0xaf77('0x49')](_0x322f3e[_0xaf77('0x4a')],{})[_0xaf77('0x29')](respondWithResult(_0x2cc07d,0xc9))[_0xaf77('0x4b')](handleError(_0x2cc07d,null));};exports[_0xaf77('0x28')]=function(_0x13286b,_0x3c67cb){if(_0x13286b['body']['id']){delete _0x13286b['body']['id'];}return db[_0xaf77('0x30')]['find']({'where':{'id':_0x13286b[_0xaf77('0x45')]['id']}})[_0xaf77('0x29')](handleEntityNotFound(_0x3c67cb,null))[_0xaf77('0x29')](saveUpdates(_0x13286b['body'],null))['then'](respondWithResult(_0x3c67cb,null))['catch'](handleError(_0x3c67cb,null));};exports['destroy']=function(_0x258b3d,_0x3e2455){return db[_0xaf77('0x30')][_0xaf77('0x48')]({'where':{'id':_0x258b3d[_0xaf77('0x45')]['id']}})[_0xaf77('0x29')](handleEntityNotFound(_0x3e2455,null))['then'](removeEntity(_0x3e2455,null))[_0xaf77('0x4b')](handleError(_0x3e2455,null));}; \ No newline at end of file +var _0x9b85=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4ea3e0,_0x44ca82){var _0x115fc5=function(_0x34f2e9){while(--_0x34f2e9){_0x4ea3e0['push'](_0x4ea3e0['shift']());}};_0x115fc5(++_0x44ca82);}(_0x9b85,0x1e2));var _0x59b8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x9b85[_0x29b609];return _0x54c952;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59b8('0x0'));var zipdir=require(_0x59b8('0x1'));var jsonpatch=require(_0x59b8('0x2'));var rp=require(_0x59b8('0x3'));var moment=require(_0x59b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59b8('0x5'));var util=require(_0x59b8('0x6'));var path=require('path');var sox=require(_0x59b8('0x7'));var csv=require(_0x59b8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x59b8('0x9'));var jsforce=require(_0x59b8('0xa'));var deskjs=require(_0x59b8('0xb'));var toCsv=require(_0x59b8('0x8'));var querystring=require(_0x59b8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x59b8('0xd'));var qs=require(_0x59b8('0xe'));var as=require(_0x59b8('0xf'));var hardwareService=require(_0x59b8('0x10'));var logger=require(_0x59b8('0x11'))('api');var utils=require(_0x59b8('0x12'));var config=require(_0x59b8('0x13'));var licenseUtil=require(_0x59b8('0x14'));var db=require(_0x59b8('0x15'))['db'];function respondWithStatusCode(_0x103953,_0x3497c1){_0x3497c1=_0x3497c1||0xcc;return function(_0x46e701){if(_0x46e701){return _0x103953[_0x59b8('0x16')](_0x3497c1);}return _0x103953[_0x59b8('0x17')](_0x3497c1)[_0x59b8('0x18')]();};}function respondWithResult(_0x4f5bfb,_0xe952bc){_0xe952bc=_0xe952bc||0xc8;return function(_0x2b1cc7){if(_0x2b1cc7){return _0x4f5bfb['status'](_0xe952bc)[_0x59b8('0x19')](_0x2b1cc7);}};}function respondWithFilteredResult(_0x3b4cec,_0x357987){return function(_0x1bf5c5){if(_0x1bf5c5){var _0x1c8d14=typeof _0x357987['offset']===_0x59b8('0x1a')&&typeof _0x357987['limit']===_0x59b8('0x1a');var _0x35626e=_0x1bf5c5[_0x59b8('0x1b')];var _0x2ca5c8=_0x1c8d14?0x0:_0x357987[_0x59b8('0x1c')];var _0x11282a=_0x1c8d14?_0x1bf5c5[_0x59b8('0x1b')]:_0x357987['offset']+_0x357987[_0x59b8('0x1d')];var _0x2a1feb;if(_0x11282a>=_0x35626e){_0x11282a=_0x35626e;_0x2a1feb=0xc8;}else{_0x2a1feb=0xce;}_0x3b4cec[_0x59b8('0x17')](_0x2a1feb);return _0x3b4cec[_0x59b8('0x1e')](_0x59b8('0x1f'),_0x2ca5c8+'-'+_0x11282a+'/'+_0x35626e)[_0x59b8('0x19')](_0x1bf5c5);}return null;};}function patchUpdates(_0x4d4328){return function(_0x1e6a43){try{jsonpatch[_0x59b8('0x20')](_0x1e6a43,_0x4d4328,!![]);}catch(_0x2a80a8){return BPromise['reject'](_0x2a80a8);}return _0x1e6a43['save']();};}function saveUpdates(_0x371fa4,_0x6bef85){return function(_0x641aa9){if(_0x641aa9){return _0x641aa9[_0x59b8('0x21')](_0x371fa4)[_0x59b8('0x22')](function(_0x156e84){return _0x156e84;});}return null;};}function removeEntity(_0x17e3f1,_0x48a44d){return function(_0x3ffb06){if(_0x3ffb06){return _0x3ffb06['destroy']()[_0x59b8('0x22')](function(){_0x17e3f1[_0x59b8('0x17')](0xcc)[_0x59b8('0x18')]();});}};}function handleEntityNotFound(_0x137f68,_0xa1181c){return function(_0x5181e1){if(!_0x5181e1){_0x137f68['sendStatus'](0x194);}return _0x5181e1;};}function handleError(_0x467034,_0x472f5a){_0x472f5a=_0x472f5a||0x1f4;return function(_0x276079){logger[_0x59b8('0x23')](_0x276079[_0x59b8('0x24')]);if(_0x276079[_0x59b8('0x25')]){delete _0x276079[_0x59b8('0x25')];}_0x467034[_0x59b8('0x17')](_0x472f5a)[_0x59b8('0x26')](_0x276079);};}exports[_0x59b8('0x27')]=function(_0x3030e5,_0x500554){var _0x256808={},_0x355636={},_0x59b732={'count':0x0,'rows':[]};var _0x3da5ec=_[_0x59b8('0x28')](db['SalesforceField'][_0x59b8('0x29')],function(_0x3f8853){return{'name':_0x3f8853[_0x59b8('0x2a')],'type':_0x3f8853[_0x59b8('0x2b')]['key']};});_0x355636['model']=_[_0x59b8('0x28')](_0x3da5ec,'name');_0x355636['query']=_[_0x59b8('0x2c')](_0x3030e5[_0x59b8('0x2d')]);_0x355636[_0x59b8('0x2e')]=_[_0x59b8('0x2f')](_0x355636[_0x59b8('0x30')],_0x355636[_0x59b8('0x2d')]);_0x256808['attributes']=_[_0x59b8('0x2f')](_0x355636[_0x59b8('0x30')],qs['fields'](_0x3030e5[_0x59b8('0x2d')]['fields']));_0x256808[_0x59b8('0x31')]=_0x256808['attributes'][_0x59b8('0x32')]?_0x256808[_0x59b8('0x31')]:_0x355636[_0x59b8('0x30')];if(!_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x33')](_0x59b8('0x34'))){_0x256808[_0x59b8('0x1d')]=qs['limit'](_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x1d')]);_0x256808[_0x59b8('0x1c')]=qs['offset'](_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x1c')]);}_0x256808['order']=qs[_0x59b8('0x35')](_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x35')]);_0x256808[_0x59b8('0x36')]=qs[_0x59b8('0x2e')](_['pick'](_0x3030e5[_0x59b8('0x2d')],_0x355636['filters']),_0x3da5ec);if(_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x37')]){_0x256808[_0x59b8('0x36')]=_[_0x59b8('0x38')](_0x256808[_0x59b8('0x36')],{'$or':_[_0x59b8('0x28')](_0x3da5ec,function(_0x38e1e6){if(_0x38e1e6[_0x59b8('0x2b')]!==_0x59b8('0x39')){var _0x461463={};_0x461463[_0x38e1e6[_0x59b8('0x25')]]={'$like':'%'+_0x3030e5[_0x59b8('0x2d')][_0x59b8('0x37')]+'%'};return _0x461463;}})});}_0x256808=_['merge']({},_0x256808,_0x3030e5[_0x59b8('0x3a')]);var _0x3b15af={'where':_0x256808['where']};return db[_0x59b8('0x3b')][_0x59b8('0x1b')](_0x3b15af)[_0x59b8('0x22')](function(_0x24c2cc){_0x59b732['count']=_0x24c2cc;if(_0x3030e5['query']['includeAll']){_0x256808[_0x59b8('0x3c')]=[{'all':!![]}];}return db['SalesforceField'][_0x59b8('0x3d')](_0x256808);})[_0x59b8('0x22')](function(_0x14711b){_0x59b732[_0x59b8('0x3e')]=_0x14711b;return _0x59b732;})['then'](respondWithFilteredResult(_0x500554,_0x256808))[_0x59b8('0x3f')](handleError(_0x500554,null));};exports[_0x59b8('0x40')]=function(_0x10cbf9,_0x22a1b5){var _0x2813d8={'raw':!![],'where':{'id':_0x10cbf9[_0x59b8('0x41')]['id']}},_0x4fed96={};_0x4fed96['model']=_[_0x59b8('0x2c')](db['SalesforceField']['rawAttributes']);_0x4fed96[_0x59b8('0x2d')]=_[_0x59b8('0x2c')](_0x10cbf9[_0x59b8('0x2d')]);_0x4fed96[_0x59b8('0x2e')]=_[_0x59b8('0x2f')](_0x4fed96[_0x59b8('0x30')],_0x4fed96[_0x59b8('0x2d')]);_0x2813d8[_0x59b8('0x31')]=_['intersection'](_0x4fed96[_0x59b8('0x30')],qs['fields'](_0x10cbf9[_0x59b8('0x2d')][_0x59b8('0x42')]));_0x2813d8['attributes']=_0x2813d8[_0x59b8('0x31')]['length']?_0x2813d8['attributes']:_0x4fed96[_0x59b8('0x30')];if(_0x10cbf9[_0x59b8('0x2d')][_0x59b8('0x43')]){_0x2813d8['include']=[{'all':!![]}];}_0x2813d8=_[_0x59b8('0x38')]({},_0x2813d8,_0x10cbf9['options']);return db[_0x59b8('0x3b')][_0x59b8('0x44')](_0x2813d8)[_0x59b8('0x22')](handleEntityNotFound(_0x22a1b5,null))[_0x59b8('0x22')](respondWithResult(_0x22a1b5,null))['catch'](handleError(_0x22a1b5,null));};exports[_0x59b8('0x45')]=function(_0xbef047,_0x567ddf){return db[_0x59b8('0x3b')][_0x59b8('0x45')](_0xbef047[_0x59b8('0x46')],{})[_0x59b8('0x22')](respondWithResult(_0x567ddf,0xc9))[_0x59b8('0x3f')](handleError(_0x567ddf,null));};exports[_0x59b8('0x21')]=function(_0xb3b73e,_0x242011){if(_0xb3b73e[_0x59b8('0x46')]['id']){delete _0xb3b73e['body']['id'];}return db[_0x59b8('0x3b')][_0x59b8('0x44')]({'where':{'id':_0xb3b73e['params']['id']}})[_0x59b8('0x22')](handleEntityNotFound(_0x242011,null))[_0x59b8('0x22')](saveUpdates(_0xb3b73e[_0x59b8('0x46')],null))[_0x59b8('0x22')](respondWithResult(_0x242011,null))['catch'](handleError(_0x242011,null));};exports[_0x59b8('0x47')]=function(_0x42667f,_0x4900ee){return db[_0x59b8('0x3b')][_0x59b8('0x44')]({'where':{'id':_0x42667f[_0x59b8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4900ee,null))['then'](removeEntity(_0x4900ee,null))['catch'](handleError(_0x4900ee,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index a3cbaeb..b74eb72 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 _0x63df=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x35b1eb,_0x215907){var _0x4a93b3=function(_0x3e8420){while(--_0x3e8420){_0x35b1eb['push'](_0x35b1eb['shift']());}};_0x4a93b3(++_0x215907);}(_0x63df,0x1e1));var _0xf63d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x63df[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf63d('0x0'));var util=require('util');var logger=require(_0xf63d('0x1'))(_0xf63d('0x2'));var moment=require('moment');var BPromise=require(_0xf63d('0x3'));var rp=require(_0xf63d('0x4'));var fs=require('fs');var path=require(_0xf63d('0x5'));var rimraf=require(_0xf63d('0x6'));var config=require(_0xf63d('0x7'));var attributes=require(_0xf63d('0x8'));module[_0xf63d('0x9')]=function(_0x16200d,_0x16fd9e){return _0x16200d[_0xf63d('0xa')](_0xf63d('0xb'),attributes,{'tableName':_0xf63d('0xc'),'paranoid':![],'indexes':[{'name':_0xf63d('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf243=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x3f0670,_0x158306){var _0x4ba51e=function(_0x162c26){while(--_0x162c26){_0x3f0670['push'](_0x3f0670['shift']());}};_0x4ba51e(++_0x158306);}(_0xf243,0x1d1));var _0x3f24=function(_0x45ec71,_0x31ca8b){_0x45ec71=_0x45ec71-0x0;var _0x386f82=_0xf243[_0x45ec71];return _0x386f82;};'use strict';var _=require(_0x3f24('0x0'));var util=require('util');var logger=require(_0x3f24('0x1'))(_0x3f24('0x2'));var moment=require(_0x3f24('0x3'));var BPromise=require(_0x3f24('0x4'));var rp=require(_0x3f24('0x5'));var fs=require('fs');var path=require(_0x3f24('0x6'));var rimraf=require(_0x3f24('0x7'));var config=require(_0x3f24('0x8'));var attributes=require(_0x3f24('0x9'));module[_0x3f24('0xa')]=function(_0x58da0b,_0x17e3c3){return _0x58da0b[_0x3f24('0xb')](_0x3f24('0xc'),attributes,{'tableName':_0x3f24('0xd'),'paranoid':![],'indexes':[{'name':_0x3f24('0xe'),'fields':['idField',_0x3f24('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index fd37446..b61ebec 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 _0x3140=['info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3140,0x6f));var _0x0314=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x3140[_0x33e4a7];return _0x598620;};'use strict';var _=require(_0x0314('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0314('0x1'));var rs=require(_0x0314('0x2'));var fs=require('fs');var Redis=require(_0x0314('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0314('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0314('0x5'));var client=jayson[_0x0314('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d194c,_0x32eb2a,_0x32d5c3){return new BPromise(function(_0x54489e,_0x1538ec){return client[_0x0314('0x7')](_0x1d194c,_0x32d5c3)[_0x0314('0x8')](function(_0xd2f779){logger[_0x0314('0x9')](_0x0314('0xa'),_0x32eb2a,'request\x20sent');logger[_0x0314('0xb')](_0x0314('0xc'),_0x32eb2a,_0x0314('0xd'),JSON[_0x0314('0xe')](_0xd2f779));if(_0xd2f779['error']){if(_0xd2f779['error'][_0x0314('0xf')]===0x1f4){logger[_0x0314('0x10')](_0x0314('0xa'),_0x32eb2a,_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);return _0x1538ec(_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);}logger[_0x0314('0x10')]('SalesforceField,\x20%s,\x20%s',_0x32eb2a,_0xd2f779['error'][_0x0314('0x11')]);return _0x54489e(_0xd2f779[_0x0314('0x10')][_0x0314('0x11')]);}else{logger[_0x0314('0x9')]('SalesforceField,\x20%s,\x20%s',_0x32eb2a,_0x0314('0xd'));_0x54489e(_0xd2f779[_0x0314('0x12')][_0x0314('0x11')]);}})[_0x0314('0x13')](function(_0x1b3779){logger['error'](_0x0314('0xa'),_0x32eb2a,_0x1b3779);_0x1538ec(_0x1b3779);});});} \ No newline at end of file +var _0x130d=['info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x130d,0x11c));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var moment=require(_0xd130('0x1'));var BPromise=require('bluebird');var rs=require(_0xd130('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd130('0x3'))['db'];var utils=require(_0xd130('0x4'));var logger=require('../../config/logger')(_0xd130('0x5'));var config=require('../../config/environment');var jayson=require(_0xd130('0x6'));var client=jayson[_0xd130('0x7')][_0xd130('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x422ff7,_0x39cb15,_0x4de6){return new BPromise(function(_0x245050,_0x9c24ec){return client['request'](_0x422ff7,_0x4de6)[_0xd130('0x9')](function(_0x3ba760){logger[_0xd130('0xa')](_0xd130('0xb'),_0x39cb15,'request\x20sent');logger[_0xd130('0xc')](_0xd130('0xd'),_0x39cb15,_0xd130('0xe'),JSON[_0xd130('0xf')](_0x3ba760));if(_0x3ba760['error']){if(_0x3ba760[_0xd130('0x10')][_0xd130('0x11')]===0x1f4){logger['error'](_0xd130('0xb'),_0x39cb15,_0x3ba760[_0xd130('0x10')]['message']);return _0x9c24ec(_0x3ba760[_0xd130('0x10')][_0xd130('0x12')]);}logger[_0xd130('0x10')](_0xd130('0xb'),_0x39cb15,_0x3ba760[_0xd130('0x10')][_0xd130('0x12')]);return _0x245050(_0x3ba760[_0xd130('0x10')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x39cb15,'request\x20sent');_0x245050(_0x3ba760[_0xd130('0x13')][_0xd130('0x12')]);}})[_0xd130('0x14')](function(_0x1e4708){logger[_0xd130('0x10')]('SalesforceField,\x20%s,\x20%s',_0x39cb15,_0x1e4708);_0x9c24ec(_0x1e4708);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 77e2b8d..d9d3acd 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 _0x5145=['./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x588141,_0x116b5d){var _0x3dd7ab=function(_0x52878b){while(--_0x52878b){_0x588141['push'](_0x588141['shift']());}};_0x3dd7ab(++_0x116b5d);}(_0x5145,0x1bf));var _0x5514=function(_0x1d562b,_0x125e5a){_0x1d562b=_0x1d562b-0x0;var _0x53a5bb=_0x5145[_0x1d562b];return _0x53a5bb;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5514('0x6'));var interaction=require(_0x5514('0x7'));var config=require(_0x5514('0x8'));var controller=require(_0x5514('0x9'));router[_0x5514('0xa')]('/',auth[_0x5514('0xb')](),controller[_0x5514('0xc')]);router['get']('/:id',auth[_0x5514('0xb')](),controller[_0x5514('0xd')]);router[_0x5514('0xa')](_0x5514('0xe'),auth[_0x5514('0xb')](),controller[_0x5514('0xf')]);router[_0x5514('0xa')](_0x5514('0x10'),auth['isAuthenticated'](),controller[_0x5514('0x11')]);router[_0x5514('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5514('0xe'),auth['isAuthenticated'](),controller[_0x5514('0x13')]);router[_0x5514('0x14')]('/:id',auth[_0x5514('0xb')](),controller[_0x5514('0x15')]);router['delete'](_0x5514('0x16'),auth['isAuthenticated'](),controller[_0x5514('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6995=['index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated'];(function(_0x3797ba,_0x2478f2){var _0x55c7fd=function(_0x29d91d){while(--_0x29d91d){_0x3797ba['push'](_0x3797ba['shift']());}};_0x55c7fd(++_0x2478f2);}(_0x6995,0xfd));var _0x5699=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6995[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x5699('0x0'));var util=require(_0x5699('0x1'));var path=require(_0x5699('0x2'));var timeout=require(_0x5699('0x3'));var express=require(_0x5699('0x4'));var router=express[_0x5699('0x5')]();var fs_extra=require(_0x5699('0x6'));var auth=require(_0x5699('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5699('0x8'));var controller=require(_0x5699('0x9'));router['get']('/',auth[_0x5699('0xa')](),controller[_0x5699('0xb')]);router[_0x5699('0xc')](_0x5699('0xd'),auth[_0x5699('0xa')](),controller['show']);router['get'](_0x5699('0xe'),auth[_0x5699('0xa')](),controller[_0x5699('0xf')]);router['get'](_0x5699('0x10'),auth[_0x5699('0xa')](),controller['getFields']);router[_0x5699('0x11')]('/',auth[_0x5699('0xa')](),controller[_0x5699('0x12')]);router[_0x5699('0x11')]('/:id/configurations',auth[_0x5699('0xa')](),controller['addConfiguration']);router['put'](_0x5699('0xd'),auth[_0x5699('0xa')](),controller[_0x5699('0x13')]);router[_0x5699('0x14')](_0x5699('0xd'),auth[_0x5699('0xa')](),controller[_0x5699('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 120bf8b..6f7f743 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 _0xe8fb=['sequelize','exports','STRING','remoteUri'];(function(_0x59ab20,_0xbc8e3e){var _0x110a1b=function(_0x281e15){while(--_0x281e15){_0x59ab20['push'](_0x59ab20['shift']());}};_0x110a1b(++_0xbc8e3e);}(_0xe8fb,0x16c));var _0xbe8f=function(_0x5524b3,_0x4251d9){_0x5524b3=_0x5524b3-0x0;var _0x1d417c=_0xe8fb[_0x5524b3];return _0x1d417c;};'use strict';var Sequelize=require(_0xbe8f('0x0'));module[_0xbe8f('0x1')]={'name':{'type':Sequelize[_0xbe8f('0x2')]},'description':{'type':Sequelize[_0xbe8f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xbe8f('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbe8f('0x2')],'unique':_0xbe8f('0x3')},'serverUrl':{'type':Sequelize[_0xbe8f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa70a=['remoteUri','sequelize','exports','STRING','username'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xa70a,0xa6));var _0xaa70=function(_0x3e3357,_0x2ca1b5){_0x3e3357=_0x3e3357-0x0;var _0xaa8278=_0xa70a[_0x3e3357];return _0xaa8278;};'use strict';var Sequelize=require(_0xaa70('0x0'));module[_0xaa70('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa70('0x2')]},'username':{'type':Sequelize[_0xaa70('0x2')],'unique':_0xaa70('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaa70('0x2')],'unique':_0xaa70('0x4')},'serverUrl':{'type':Sequelize[_0xaa70('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 9c10e84..dcc8825 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 _0xa504=['map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','work_start','assignment_group','additional_assignee_list','description','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','problem_id','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xa504,0x148));var _0x4a50=function(_0x34784c,_0x50f529){_0x34784c=_0x34784c-0x0;var _0x4a63ba=_0xa504[_0x34784c];return _0x4a63ba;};'use strict';var emlformat=require(_0x4a50('0x0'));var rimraf=require(_0x4a50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a50('0x2'));var rp=require(_0x4a50('0x3'));var moment=require('moment');var BPromise=require(_0x4a50('0x4'));var Mustache=require(_0x4a50('0x5'));var util=require(_0x4a50('0x6'));var path=require(_0x4a50('0x7'));var sox=require('sox');var csv=require(_0x4a50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a50('0x9'));var _=require('lodash');var squel=require(_0x4a50('0xa'));var crypto=require(_0x4a50('0xb'));var jsforce=require(_0x4a50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4a50('0x8'));var querystring=require('querystring');var Papa=require(_0x4a50('0xd'));var Redis=require(_0x4a50('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4a50('0xf'));var as=require(_0x4a50('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4a50('0x11'));var config=require(_0x4a50('0x12'));var licenseUtil=require(_0x4a50('0x13'));var db=require(_0x4a50('0x14'))['db'];var integrations=require(_0x4a50('0x15'));function respondWithStatusCode(_0x34f5b9,_0x57eb88){_0x57eb88=_0x57eb88||0xcc;return function(_0xc54b2){if(_0xc54b2){return _0x34f5b9[_0x4a50('0x16')](_0x57eb88);}return _0x34f5b9[_0x4a50('0x17')](_0x57eb88)[_0x4a50('0x18')]();};}function respondWithResult(_0x23a141,_0x58df8f){_0x58df8f=_0x58df8f||0xc8;return function(_0xae1d66){if(_0xae1d66){return _0x23a141['status'](_0x58df8f)[_0x4a50('0x19')](_0xae1d66);}};}function respondWithFilteredResult(_0x5f151f,_0x5f2229){return function(_0x1a8b38){if(_0x1a8b38){var _0x58b10d=typeof _0x5f2229['offset']===_0x4a50('0x1a')&&typeof _0x5f2229[_0x4a50('0x1b')]===_0x4a50('0x1a');var _0x5e2af7=_0x1a8b38['count'];var _0x2c055c=_0x58b10d?0x0:_0x5f2229[_0x4a50('0x1c')];var _0x2f1809=_0x58b10d?_0x1a8b38['count']:_0x5f2229[_0x4a50('0x1c')]+_0x5f2229['limit'];var _0x1412ce;if(_0x2f1809>=_0x5e2af7){_0x2f1809=_0x5e2af7;_0x1412ce=0xc8;}else{_0x1412ce=0xce;}_0x5f151f[_0x4a50('0x17')](_0x1412ce);return _0x5f151f[_0x4a50('0x1d')](_0x4a50('0x1e'),_0x2c055c+'-'+_0x2f1809+'/'+_0x5e2af7)[_0x4a50('0x19')](_0x1a8b38);}return null;};}function patchUpdates(_0x53fdb3){return function(_0xa58178){try{jsonpatch[_0x4a50('0x1f')](_0xa58178,_0x53fdb3,!![]);}catch(_0x596627){return BPromise[_0x4a50('0x20')](_0x596627);}return _0xa58178[_0x4a50('0x21')]();};}function saveUpdates(_0x42ff06,_0x3c15b9){return function(_0x1bde67){if(_0x1bde67){return _0x1bde67[_0x4a50('0x22')](_0x42ff06)[_0x4a50('0x23')](function(_0x3942b9){return _0x3942b9;});}return null;};}function removeEntity(_0x423233,_0x2ae9a7){return function(_0x2eee00){if(_0x2eee00){return _0x2eee00['destroy']()[_0x4a50('0x23')](function(){_0x423233[_0x4a50('0x17')](0xcc)[_0x4a50('0x18')]();});}};}function handleEntityNotFound(_0x2cfb7e,_0x20e074){return function(_0x40341c){if(!_0x40341c){_0x2cfb7e['sendStatus'](0x194);}return _0x40341c;};}function handleError(_0x42300f,_0xb5b1d7){_0xb5b1d7=_0xb5b1d7||0x1f4;return function(_0x29811f){logger[_0x4a50('0x24')](_0x29811f['stack']);if(_0x29811f[_0x4a50('0x25')]){delete _0x29811f[_0x4a50('0x25')];}_0x42300f['status'](_0xb5b1d7)[_0x4a50('0x26')](_0x29811f);};}exports[_0x4a50('0x27')]=function(_0x4e7bf0,_0x162f4b){var _0x19ca66={},_0x1f2375={},_0x28ab64={'count':0x0,'rows':[]};var _0x35e791=_[_0x4a50('0x28')](db[_0x4a50('0x29')][_0x4a50('0x2a')],function(_0x268c3e){return{'name':_0x268c3e[_0x4a50('0x2b')],'type':_0x268c3e['type'][_0x4a50('0x2c')]};});_0x1f2375[_0x4a50('0x2d')]=_[_0x4a50('0x28')](_0x35e791,_0x4a50('0x25'));_0x1f2375[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x4e7bf0['query']);_0x1f2375[_0x4a50('0x30')]=_[_0x4a50('0x31')](_0x1f2375['model'],_0x1f2375['query']);_0x19ca66[_0x4a50('0x32')]=_['intersection'](_0x1f2375[_0x4a50('0x2d')],qs['fields'](_0x4e7bf0[_0x4a50('0x2e')]['fields']));_0x19ca66[_0x4a50('0x32')]=_0x19ca66[_0x4a50('0x32')][_0x4a50('0x33')]?_0x19ca66[_0x4a50('0x32')]:_0x1f2375[_0x4a50('0x2d')];if(!_0x4e7bf0['query'][_0x4a50('0x34')](_0x4a50('0x35'))){_0x19ca66[_0x4a50('0x1b')]=qs[_0x4a50('0x1b')](_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x1b')]);_0x19ca66[_0x4a50('0x1c')]=qs[_0x4a50('0x1c')](_0x4e7bf0['query']['offset']);}_0x19ca66[_0x4a50('0x36')]=qs[_0x4a50('0x37')](_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x37')]);_0x19ca66[_0x4a50('0x38')]=qs['filters'](_[_0x4a50('0x39')](_0x4e7bf0[_0x4a50('0x2e')],_0x1f2375[_0x4a50('0x30')]),_0x35e791);if(_0x4e7bf0[_0x4a50('0x2e')]['filter']){_0x19ca66['where']=_[_0x4a50('0x3a')](_0x19ca66[_0x4a50('0x38')],{'$or':_[_0x4a50('0x28')](_0x35e791,function(_0x1a87dd){if(_0x1a87dd[_0x4a50('0x3b')]!==_0x4a50('0x3c')){var _0x33aea5={};_0x33aea5[_0x1a87dd[_0x4a50('0x25')]]={'$like':'%'+_0x4e7bf0[_0x4a50('0x2e')]['filter']+'%'};return _0x33aea5;}})});}_0x19ca66=_[_0x4a50('0x3a')]({},_0x19ca66,_0x4e7bf0['options']);var _0x325751={'where':_0x19ca66[_0x4a50('0x38')]};return db[_0x4a50('0x29')][_0x4a50('0x3d')](_0x325751)[_0x4a50('0x23')](function(_0x348fc2){_0x28ab64[_0x4a50('0x3d')]=_0x348fc2;if(_0x4e7bf0[_0x4a50('0x2e')][_0x4a50('0x3e')]){_0x19ca66[_0x4a50('0x3f')]=[{'all':!![]}];}return db[_0x4a50('0x29')][_0x4a50('0x40')](_0x19ca66);})[_0x4a50('0x23')](function(_0x17eb10){_0x28ab64[_0x4a50('0x41')]=_0x17eb10;return _0x28ab64;})[_0x4a50('0x23')](respondWithFilteredResult(_0x162f4b,_0x19ca66))[_0x4a50('0x42')](handleError(_0x162f4b,null));};exports[_0x4a50('0x43')]=function(_0x19fc30,_0x411e80){var _0x430e96={'raw':![],'where':{'id':_0x19fc30[_0x4a50('0x44')]['id']}},_0x54645c={};_0x54645c[_0x4a50('0x2d')]=_[_0x4a50('0x2f')](db[_0x4a50('0x29')][_0x4a50('0x2a')]);_0x54645c[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x19fc30['query']);_0x54645c['filters']=_['intersection'](_0x54645c[_0x4a50('0x2d')],_0x54645c['query']);_0x430e96[_0x4a50('0x32')]=_[_0x4a50('0x31')](_0x54645c['model'],qs[_0x4a50('0x45')](_0x19fc30[_0x4a50('0x2e')][_0x4a50('0x45')]));_0x430e96[_0x4a50('0x32')]=_0x430e96[_0x4a50('0x32')][_0x4a50('0x33')]?_0x430e96[_0x4a50('0x32')]:_0x54645c[_0x4a50('0x2d')];if(_0x19fc30[_0x4a50('0x2e')][_0x4a50('0x3e')]){_0x430e96[_0x4a50('0x3f')]=[{'all':!![]}];}_0x430e96=_[_0x4a50('0x3a')]({},_0x430e96,_0x19fc30[_0x4a50('0x46')]);return db[_0x4a50('0x29')][_0x4a50('0x47')](_0x430e96)[_0x4a50('0x23')](handleEntityNotFound(_0x411e80,null))['then'](respondWithResult(_0x411e80,null))[_0x4a50('0x42')](handleError(_0x411e80,null));};exports[_0x4a50('0x48')]=function(_0x2b080f,_0x7bc776){return db[_0x4a50('0x29')][_0x4a50('0x48')](_0x2b080f[_0x4a50('0x49')],{})[_0x4a50('0x23')](respondWithResult(_0x7bc776,0xc9))['catch'](handleError(_0x7bc776,null));};exports['update']=function(_0x589861,_0x306ed0){if(_0x589861[_0x4a50('0x49')]['id']){delete _0x589861[_0x4a50('0x49')]['id'];}return db[_0x4a50('0x29')]['find']({'where':{'id':_0x589861[_0x4a50('0x44')]['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x306ed0,null))[_0x4a50('0x23')](saveUpdates(_0x589861[_0x4a50('0x49')],null))[_0x4a50('0x23')](respondWithResult(_0x306ed0,null))['catch'](handleError(_0x306ed0,null));};exports[_0x4a50('0x4a')]=function(_0x5e1d10,_0x25d0d9){return db['ServicenowAccount'][_0x4a50('0x47')]({'where':{'id':_0x5e1d10['params']['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x25d0d9,null))['then'](removeEntity(_0x25d0d9,null))[_0x4a50('0x42')](handleError(_0x25d0d9,null));};exports[_0x4a50('0x4b')]=function(_0x2261c1,_0x33dd74,_0xe7d59e){var _0x34e7de={};var _0x43e3ba={};var _0x15790c;var _0x11de50;return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0x2261c1[_0x4a50('0x44')]['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x33dd74,null))[_0x4a50('0x23')](function(_0x277f60){if(_0x277f60){_0x15790c=_0x277f60;_0x43e3ba[_0x4a50('0x2d')]=_[_0x4a50('0x2f')](db[_0x4a50('0x4d')][_0x4a50('0x2a')]);_0x43e3ba[_0x4a50('0x2e')]=_[_0x4a50('0x2f')](_0x2261c1[_0x4a50('0x2e')]);_0x43e3ba[_0x4a50('0x30')]=_[_0x4a50('0x31')](_0x43e3ba['model'],_0x43e3ba[_0x4a50('0x2e')]);_0x34e7de[_0x4a50('0x32')]=_[_0x4a50('0x31')](_0x43e3ba[_0x4a50('0x2d')],qs[_0x4a50('0x45')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x45')]));_0x34e7de['attributes']=_0x34e7de[_0x4a50('0x32')]['length']?_0x34e7de[_0x4a50('0x32')]:_0x43e3ba[_0x4a50('0x2d')];_0x34e7de[_0x4a50('0x36')]=qs[_0x4a50('0x37')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x37')]);_0x34e7de[_0x4a50('0x38')]=qs[_0x4a50('0x30')](_['pick'](_0x2261c1[_0x4a50('0x2e')],_0x43e3ba[_0x4a50('0x30')]));if(_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x4e')]){_0x34e7de[_0x4a50('0x38')]=_[_0x4a50('0x3a')](_0x34e7de[_0x4a50('0x38')],{'$or':_[_0x4a50('0x28')](_0x34e7de[_0x4a50('0x32')],function(_0x5501da){var _0x50994f={};_0x50994f[_0x5501da]={'$like':'%'+_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x4e')]+'%'};return _0x50994f;})});}_0x34e7de=_[_0x4a50('0x3a')]({},_0x34e7de,_0x2261c1[_0x4a50('0x46')]);return _0x15790c[_0x4a50('0x4b')](_0x34e7de);}})[_0x4a50('0x23')](function(_0x3fb84a){if(_0x3fb84a){_0x11de50=_0x3fb84a[_0x4a50('0x33')];if(!_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x34')](_0x4a50('0x35'))){_0x34e7de[_0x4a50('0x1b')]=qs[_0x4a50('0x1b')](_0x2261c1[_0x4a50('0x2e')][_0x4a50('0x1b')]);_0x34e7de[_0x4a50('0x1c')]=qs['offset'](_0x2261c1['query'][_0x4a50('0x1c')]);}return _0x15790c[_0x4a50('0x4b')](_0x34e7de);}})['then'](function(_0x497c99){if(_0x497c99){return _0x497c99?{'count':_0x11de50,'rows':_0x497c99}:null;}})['then'](respondWithResult(_0x33dd74,null))['catch'](handleError(_0x33dd74,null));};exports[_0x4a50('0x4f')]=function(_0xf92f25,_0x507475,_0x2a8295){if(_0xf92f25[_0x4a50('0x49')]['id']){delete _0xf92f25['body']['id'];}return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0xf92f25['params']['id']}})[_0x4a50('0x23')](handleEntityNotFound(_0x507475,null))[_0x4a50('0x23')](function(_0x2a2801){if(_0x2a2801){_0xf92f25[_0x4a50('0x49')][_0x4a50('0x50')]=_0x2a2801['id'];_0xf92f25[_0x4a50('0x49')][_0x4a50('0x51')]=integrations[_0x4a50('0x52')](_0xf92f25['body'][_0x4a50('0x53')],_0xf92f25['body']['type']);_0xf92f25['body'][_0x4a50('0x54')]=integrations[_0x4a50('0x55')](_0xf92f25[_0x4a50('0x49')][_0x4a50('0x53')],_0xf92f25[_0x4a50('0x49')][_0x4a50('0x3b')]);return db[_0x4a50('0x4d')][_0x4a50('0x48')](_0xf92f25[_0x4a50('0x49')],{'include':[{'model':db[_0x4a50('0x56')],'as':_0x4a50('0x51')},{'model':db[_0x4a50('0x56')],'as':_0x4a50('0x54')}]});}return null;})[_0x4a50('0x23')](respondWithResult(_0x507475,null))['catch'](handleError(_0x507475,null));};exports[_0x4a50('0x57')]=function(_0x59a811,_0x1df4fe,_0x347823){var _0x155af7=['made_sla',_0x4a50('0x58'),_0x4a50('0x59'),_0x4a50('0x5a'),_0x4a50('0x5b'),_0x4a50('0x5c'),_0x4a50('0x5d'),_0x4a50('0x5e'),_0x4a50('0x5f')];var _0x24304b=[_0x4a50('0x60'),_0x4a50('0x61'),_0x4a50('0x62'),_0x4a50('0x63'),_0x4a50('0x64'),'sys_updated_on',_0x4a50('0x65'),_0x4a50('0x58'),'approval_history',_0x4a50('0x66'),_0x4a50('0x67'),_0x4a50('0x68'),_0x4a50('0x69'),_0x4a50('0x6a'),_0x4a50('0x6b'),'sys_domain',_0x4a50('0x6c'),_0x4a50('0x6d'),_0x4a50('0x59'),'order','calendar_stc','closed_at',_0x4a50('0x6e'),_0x4a50('0x6f'),_0x4a50('0x70'),_0x4a50('0x71'),'work_notes_list','business_service',_0x4a50('0x72'),'sys_domain_path',_0x4a50('0x73'),_0x4a50('0x74'),'expected_start',_0x4a50('0x75'),_0x4a50('0x76'),_0x4a50('0x77'),_0x4a50('0x78'),_0x4a50('0x79'),_0x4a50('0x7a'),_0x4a50('0x7b'),_0x4a50('0x7c'),'subcategory','work_notes',_0x4a50('0x7d'),_0x4a50('0x5b'),'correlation_display','delivery_task',_0x4a50('0x7e'),_0x4a50('0x7f'),'business_stc',_0x4a50('0x80'),_0x4a50('0x81'),'calendar_duration',_0x4a50('0x5c'),'sys_class_name',_0x4a50('0x82'),_0x4a50('0x83'),_0x4a50('0x84'),'parent_incident',_0x4a50('0x85'),_0x4a50('0x86'),'reopened_by',_0x4a50('0x5d'),_0x4a50('0x87'),_0x4a50('0x88'),'company','reassignment_count',_0x4a50('0x89'),_0x4a50('0x8a'),_0x4a50('0x5e'),'comments',_0x4a50('0x8b'),_0x4a50('0x8c'),_0x4a50('0x8d'),_0x4a50('0x8e'),_0x4a50('0x8f'),_0x4a50('0x90'),'sys_tags',_0x4a50('0x91'),_0x4a50('0x92'),_0x4a50('0x93'),_0x4a50('0x94'),'category'];var _0x429678='';var _0x47f867='';var _0x5041e2=[];var _0xe9eb='';var _0x48f66a='';var _0x138c05=[];var _0x345044='';var _0x56b0fe='';var _0x177cb1={};var _0x251007='';return db[_0x4a50('0x29')][_0x4a50('0x4c')]({'where':{'id':_0x59a811['params']['id']},'attributes':['id','username',_0x4a50('0x95'),_0x4a50('0x96'),_0x4a50('0x97'),_0x4a50('0x98')]})[_0x4a50('0x23')](handleEntityNotFound(_0x1df4fe,null))[_0x4a50('0x23')](function(_0x4760bc){if(_0x4760bc){_0x251007=_0x4760bc['remoteUri'];var _0x1ac9e2=_0x251007[_0x4a50('0x99')](-0x1);if(_0x1ac9e2==='/'){_0x251007=_0x251007['substring'](0x0,_0x251007[_0x4a50('0x9a')](_0x1ac9e2));}_0x56b0fe=util[_0x4a50('0x9b')](_0x4a50('0x9c'),_0x251007);_0x345044=util[_0x4a50('0x9b')]('%s/api/now/table/',_0x251007);_0x177cb1={'user':_0x4760bc[_0x4a50('0x9d')],'pass':_0x4760bc[_0x4a50('0x95')]};var _0x212458={'method':'GET','uri':_0x56b0fe+_0x4a50('0x9e'),'auth':_0x177cb1,'json':!![]};return rp(_0x212458);}})[_0x4a50('0x23')](function(_0x5d26c4){if(_0x5d26c4['result'][_0x4a50('0x33')]>0x0){_0x429678=_0x5d26c4[_0x4a50('0x9f')];}console[_0x4a50('0xa0')]('incident\x20table\x20objects',_0x429678);_0x138c05=[];_0x47f867=Object[_0x4a50('0xa1')]([],_0x429678);_[_0x4a50('0xa2')](_0x47f867,function(_0x4abad3){return!_0x155af7[_0x4a50('0xa3')](_0x4abad3[_0x4a50('0x25')]);});_0x47f867[_0x4a50('0xa4')](function(_0x5c9fa3){var _0x10f2b9=createFieldObject(_0x345044,_0x177cb1,_0x5c9fa3[_0x4a50('0xa5')],_0x5c9fa3['name'],_0x5c9fa3[_0x4a50('0xa6')],![]);_0x138c05[_0x4a50('0xa7')](_0x10f2b9);});return Promise['all'](_0x138c05);})[_0x4a50('0x23')](function(_0x28b830){_0x5041e2=_0x28b830;_0xe9eb=Object['assign']([],_0x429678);console[_0x4a50('0xa0')](_0x4a50('0xa8'),_0x429678);_[_0x4a50('0xa2')](_0xe9eb,function(_0x5f3262){return _0x24304b['includes'](_0x5f3262[_0x4a50('0x25')]);});console[_0x4a50('0xa0')](_0x4a50('0xa9'),_0xe9eb);_0x138c05=[];_0xe9eb['forEach'](function(_0x9a7fba){var _0x24234a=createFieldObject(_0x345044,_0x177cb1,_0x9a7fba[_0x4a50('0xa5')],_0x9a7fba[_0x4a50('0x25')],_0x9a7fba[_0x4a50('0xa6')],!![]);_0x138c05[_0x4a50('0xa7')](_0x24234a);});return Promise[_0x4a50('0xaa')](_0x138c05);})[_0x4a50('0x23')](function(_0x2baa0d){_0x48f66a=_0x2baa0d;var _0x4481ac=_0x5041e2[_0x4a50('0xab')](_0x48f66a);return{'count':_0x4481ac[_0x4a50('0x33')],'rows':_0x4481ac};})[_0x4a50('0x23')](respondWithResult(_0x1df4fe,null))[_0x4a50('0x42')](function(_0x1641f1){console['log'](_0x4a50('0xac')+_0x1641f1);var _0x397163=_0x59a811['query'][_0x4a50('0xad')]?0x1f4:_0x1641f1[_0x4a50('0xae')]||0x1f4;logger[_0x4a50('0x24')](_0x1641f1[_0x4a50('0xaf')]);delete _0x1641f1[_0x4a50('0x25')];if(_0x397163===0x191){_0x397163=0x190;}_0x1df4fe[_0x4a50('0x17')](_0x397163)[_0x4a50('0x26')](_0x59a811[_0x4a50('0x2e')][_0x4a50('0xad')]?{'message':_0x4a50('0xb0'),'statusCode':_0x1641f1['statusCode']}:_0x1641f1);});};function createFieldObject(_0x11861d,_0x5ba4c5,_0x55b141,_0x5d60c2,_0x638253,_0x51fc98){return new Promise(function(_0x2de37d,_0x4c0b3d){var _0x2395b5={'id':_0x5d60c2,'name':_0x638253,'custom':_0x51fc98};if(_0x55b141===_0x4a50('0xb1')){_0x2395b5[_0x4a50('0x46')]=[{'name':_0x4a50('0xb2'),'value':'true'},{'name':_0x4a50('0xb3'),'value':_0x4a50('0xb4')}];_0x2de37d(_0x2395b5);}else{var _0x2af6ac={'method':'GET','uri':_0x11861d+_0x4a50('0xb5')+_0x5d60c2,'auth':_0x5ba4c5,'json':!![]};return rp(_0x2af6ac)[_0x4a50('0x23')](function(_0x1465b4){var _0x2edca8=[];if(_0x1465b4['result'][_0x4a50('0x33')]>0x0){_0x1465b4[_0x4a50('0x9f')]['forEach'](function(_0xdf6d5e){if(_0xdf6d5e[_0x4a50('0xb6')]==='false'){var _0x1761db={'name':_0xdf6d5e[_0x4a50('0xa6')],'value':_0xdf6d5e[_0x4a50('0xb7')]};_0x2edca8['push'](_0x1761db);}});}_0x2395b5[_0x4a50('0x46')]=_0x2edca8;if(_0x2395b5[_0x4a50('0x46')][_0x4a50('0x33')]>0x0){_0x2de37d(_0x2395b5);}else{if(_0x51fc98==![]){_0x2de37d();}else{_0x2de37d(_0x2395b5);}}});}});} \ No newline at end of file +var _0x77b0=['caller_id','approval_set','work_notes','short_description','close_code','delivery_task','work_start','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','password','GET','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','internalType','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','all','concat','statusCode','error','stack','Wrong\x20credentials','boolean','False','false','inactive','value','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','name','send','map','ServicenowAccount','fieldName','type','key','keys','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','rawAttributes','intersection','find','catch','create','update','body','params','getConfigurations','findOne','order','pick','AccountId','Subjects','getDescriptions','channel','ServicenowConfiguration','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','state','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end'];(function(_0x419f2d,_0x36df11){var _0x42a972=function(_0x5443e6){while(--_0x5443e6){_0x419f2d['push'](_0x419f2d['shift']());}};_0x42a972(++_0x36df11);}(_0x77b0,0x1b0));var _0x077b=function(_0xc84c8b,_0x43d0a0){_0xc84c8b=_0xc84c8b-0x0;var _0x396f8f=_0x77b0[_0xc84c8b];return _0x396f8f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x077b('0x0'));var jsonpatch=require(_0x077b('0x1'));var rp=require(_0x077b('0x2'));var moment=require(_0x077b('0x3'));var BPromise=require(_0x077b('0x4'));var Mustache=require(_0x077b('0x5'));var util=require(_0x077b('0x6'));var path=require(_0x077b('0x7'));var sox=require(_0x077b('0x8'));var csv=require('to-csv');var ejs=require(_0x077b('0x9'));var fs=require('fs');var fs_extra=require(_0x077b('0xa'));var _=require(_0x077b('0xb'));var squel=require(_0x077b('0xc'));var crypto=require(_0x077b('0xd'));var jsforce=require(_0x077b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x077b('0xf'));var querystring=require(_0x077b('0x10'));var Papa=require(_0x077b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x077b('0x12'));var hardwareService=require(_0x077b('0x13'));var logger=require(_0x077b('0x14'))('api');var utils=require(_0x077b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x077b('0x16'));var db=require(_0x077b('0x17'))['db'];var integrations=require(_0x077b('0x18'));function respondWithStatusCode(_0x5e1494,_0x29710e){_0x29710e=_0x29710e||0xcc;return function(_0x23418c){if(_0x23418c){return _0x5e1494[_0x077b('0x19')](_0x29710e);}return _0x5e1494['status'](_0x29710e)[_0x077b('0x1a')]();};}function respondWithResult(_0x7843f7,_0x244262){_0x244262=_0x244262||0xc8;return function(_0x2bdd3c){if(_0x2bdd3c){return _0x7843f7[_0x077b('0x1b')](_0x244262)[_0x077b('0x1c')](_0x2bdd3c);}};}function respondWithFilteredResult(_0x779a5b,_0x337506){return function(_0x8be2ea){if(_0x8be2ea){var _0x1b04d3=typeof _0x337506[_0x077b('0x1d')]==='undefined'&&typeof _0x337506[_0x077b('0x1e')]===_0x077b('0x1f');var _0x3f2367=_0x8be2ea['count'];var _0x144784=_0x1b04d3?0x0:_0x337506['offset'];var _0x4a0974=_0x1b04d3?_0x8be2ea[_0x077b('0x20')]:_0x337506['offset']+_0x337506[_0x077b('0x1e')];var _0x372a1f;if(_0x4a0974>=_0x3f2367){_0x4a0974=_0x3f2367;_0x372a1f=0xc8;}else{_0x372a1f=0xce;}_0x779a5b[_0x077b('0x1b')](_0x372a1f);return _0x779a5b[_0x077b('0x21')](_0x077b('0x22'),_0x144784+'-'+_0x4a0974+'/'+_0x3f2367)[_0x077b('0x1c')](_0x8be2ea);}return null;};}function patchUpdates(_0x59f89f){return function(_0x598fd1){try{jsonpatch[_0x077b('0x23')](_0x598fd1,_0x59f89f,!![]);}catch(_0x5714f6){return BPromise[_0x077b('0x24')](_0x5714f6);}return _0x598fd1[_0x077b('0x25')]();};}function saveUpdates(_0x7e80c4,_0x2ab809){return function(_0x3b27d0){if(_0x3b27d0){return _0x3b27d0['update'](_0x7e80c4)[_0x077b('0x26')](function(_0x282e54){return _0x282e54;});}return null;};}function removeEntity(_0x1ae8c0,_0xd5f164){return function(_0x11da8e){if(_0x11da8e){return _0x11da8e['destroy']()[_0x077b('0x26')](function(){_0x1ae8c0[_0x077b('0x1b')](0xcc)[_0x077b('0x1a')]();});}};}function handleEntityNotFound(_0x3d6bf0,_0x28e830){return function(_0x4679fa){if(!_0x4679fa){_0x3d6bf0[_0x077b('0x19')](0x194);}return _0x4679fa;};}function handleError(_0x5ef30e,_0x522eb5){_0x522eb5=_0x522eb5||0x1f4;return function(_0x30f1d5){logger['error'](_0x30f1d5['stack']);if(_0x30f1d5[_0x077b('0x27')]){delete _0x30f1d5[_0x077b('0x27')];}_0x5ef30e['status'](_0x522eb5)[_0x077b('0x28')](_0x30f1d5);};}exports['index']=function(_0x2b06f6,_0x21ec50){var _0x3bc6ec={},_0x1306e9={},_0x17091c={'count':0x0,'rows':[]};var _0x30dd15=_[_0x077b('0x29')](db[_0x077b('0x2a')]['rawAttributes'],function(_0x1d4bcb){return{'name':_0x1d4bcb[_0x077b('0x2b')],'type':_0x1d4bcb[_0x077b('0x2c')][_0x077b('0x2d')]};});_0x1306e9['model']=_[_0x077b('0x29')](_0x30dd15,'name');_0x1306e9['query']=_[_0x077b('0x2e')](_0x2b06f6[_0x077b('0x2f')]);_0x1306e9['filters']=_['intersection'](_0x1306e9['model'],_0x1306e9[_0x077b('0x2f')]);_0x3bc6ec[_0x077b('0x30')]=_['intersection'](_0x1306e9[_0x077b('0x31')],qs[_0x077b('0x32')](_0x2b06f6[_0x077b('0x2f')][_0x077b('0x32')]));_0x3bc6ec[_0x077b('0x30')]=_0x3bc6ec[_0x077b('0x30')][_0x077b('0x33')]?_0x3bc6ec[_0x077b('0x30')]:_0x1306e9['model'];if(!_0x2b06f6[_0x077b('0x2f')][_0x077b('0x34')](_0x077b('0x35'))){_0x3bc6ec['limit']=qs[_0x077b('0x1e')](_0x2b06f6[_0x077b('0x2f')][_0x077b('0x1e')]);_0x3bc6ec[_0x077b('0x1d')]=qs['offset'](_0x2b06f6['query'][_0x077b('0x1d')]);}_0x3bc6ec['order']=qs[_0x077b('0x36')](_0x2b06f6[_0x077b('0x2f')][_0x077b('0x36')]);_0x3bc6ec['where']=qs[_0x077b('0x37')](_['pick'](_0x2b06f6[_0x077b('0x2f')],_0x1306e9[_0x077b('0x37')]),_0x30dd15);if(_0x2b06f6['query'][_0x077b('0x38')]){_0x3bc6ec[_0x077b('0x39')]=_[_0x077b('0x3a')](_0x3bc6ec[_0x077b('0x39')],{'$or':_[_0x077b('0x29')](_0x30dd15,function(_0x260315){if(_0x260315[_0x077b('0x2c')]!==_0x077b('0x3b')){var _0x181ac5={};_0x181ac5[_0x260315[_0x077b('0x27')]]={'$like':'%'+_0x2b06f6[_0x077b('0x2f')]['filter']+'%'};return _0x181ac5;}})});}_0x3bc6ec=_[_0x077b('0x3a')]({},_0x3bc6ec,_0x2b06f6[_0x077b('0x3c')]);var _0x4e8f4b={'where':_0x3bc6ec[_0x077b('0x39')]};return db[_0x077b('0x2a')][_0x077b('0x20')](_0x4e8f4b)['then'](function(_0x4a00ab){_0x17091c[_0x077b('0x20')]=_0x4a00ab;if(_0x2b06f6[_0x077b('0x2f')][_0x077b('0x3d')]){_0x3bc6ec[_0x077b('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x3bc6ec);})[_0x077b('0x26')](function(_0x1358c0){_0x17091c[_0x077b('0x3f')]=_0x1358c0;return _0x17091c;})[_0x077b('0x26')](respondWithFilteredResult(_0x21ec50,_0x3bc6ec))['catch'](handleError(_0x21ec50,null));};exports['show']=function(_0x1e9a8c,_0x437c6b){var _0x5d32e4={'raw':![],'where':{'id':_0x1e9a8c['params']['id']}},_0x5cecef={};_0x5cecef[_0x077b('0x31')]=_['keys'](db[_0x077b('0x2a')][_0x077b('0x40')]);_0x5cecef[_0x077b('0x2f')]=_[_0x077b('0x2e')](_0x1e9a8c[_0x077b('0x2f')]);_0x5cecef['filters']=_[_0x077b('0x41')](_0x5cecef[_0x077b('0x31')],_0x5cecef[_0x077b('0x2f')]);_0x5d32e4['attributes']=_[_0x077b('0x41')](_0x5cecef[_0x077b('0x31')],qs[_0x077b('0x32')](_0x1e9a8c[_0x077b('0x2f')][_0x077b('0x32')]));_0x5d32e4[_0x077b('0x30')]=_0x5d32e4[_0x077b('0x30')][_0x077b('0x33')]?_0x5d32e4[_0x077b('0x30')]:_0x5cecef[_0x077b('0x31')];if(_0x1e9a8c['query'][_0x077b('0x3d')]){_0x5d32e4[_0x077b('0x3e')]=[{'all':!![]}];}_0x5d32e4=_[_0x077b('0x3a')]({},_0x5d32e4,_0x1e9a8c['options']);return db[_0x077b('0x2a')][_0x077b('0x42')](_0x5d32e4)[_0x077b('0x26')](handleEntityNotFound(_0x437c6b,null))[_0x077b('0x26')](respondWithResult(_0x437c6b,null))[_0x077b('0x43')](handleError(_0x437c6b,null));};exports[_0x077b('0x44')]=function(_0x1a4cb8,_0x24f642){return db[_0x077b('0x2a')][_0x077b('0x44')](_0x1a4cb8['body'],{})['then'](respondWithResult(_0x24f642,0xc9))[_0x077b('0x43')](handleError(_0x24f642,null));};exports[_0x077b('0x45')]=function(_0x116464,_0x19bfd9){if(_0x116464[_0x077b('0x46')]['id']){delete _0x116464[_0x077b('0x46')]['id'];}return db['ServicenowAccount'][_0x077b('0x42')]({'where':{'id':_0x116464['params']['id']}})[_0x077b('0x26')](handleEntityNotFound(_0x19bfd9,null))[_0x077b('0x26')](saveUpdates(_0x116464[_0x077b('0x46')],null))[_0x077b('0x26')](respondWithResult(_0x19bfd9,null))[_0x077b('0x43')](handleError(_0x19bfd9,null));};exports['destroy']=function(_0x59959c,_0x495ad9){return db[_0x077b('0x2a')]['find']({'where':{'id':_0x59959c[_0x077b('0x47')]['id']}})[_0x077b('0x26')](handleEntityNotFound(_0x495ad9,null))['then'](removeEntity(_0x495ad9,null))['catch'](handleError(_0x495ad9,null));};exports[_0x077b('0x48')]=function(_0x2e1f1a,_0x1751bf,_0x2250ef){var _0x4e42f0={};var _0x2e383c={};var _0x17fac5;var _0x4aefd0;return db[_0x077b('0x2a')][_0x077b('0x49')]({'where':{'id':_0x2e1f1a[_0x077b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1751bf,null))[_0x077b('0x26')](function(_0x546e40){if(_0x546e40){_0x17fac5=_0x546e40;_0x2e383c[_0x077b('0x31')]=_[_0x077b('0x2e')](db['ServicenowConfiguration'][_0x077b('0x40')]);_0x2e383c[_0x077b('0x2f')]=_[_0x077b('0x2e')](_0x2e1f1a[_0x077b('0x2f')]);_0x2e383c[_0x077b('0x37')]=_[_0x077b('0x41')](_0x2e383c[_0x077b('0x31')],_0x2e383c[_0x077b('0x2f')]);_0x4e42f0[_0x077b('0x30')]=_[_0x077b('0x41')](_0x2e383c[_0x077b('0x31')],qs[_0x077b('0x32')](_0x2e1f1a[_0x077b('0x2f')][_0x077b('0x32')]));_0x4e42f0[_0x077b('0x30')]=_0x4e42f0['attributes'][_0x077b('0x33')]?_0x4e42f0[_0x077b('0x30')]:_0x2e383c['model'];_0x4e42f0[_0x077b('0x4a')]=qs[_0x077b('0x36')](_0x2e1f1a['query'][_0x077b('0x36')]);_0x4e42f0[_0x077b('0x39')]=qs['filters'](_[_0x077b('0x4b')](_0x2e1f1a[_0x077b('0x2f')],_0x2e383c[_0x077b('0x37')]));if(_0x2e1f1a['query'][_0x077b('0x38')]){_0x4e42f0['where']=_[_0x077b('0x3a')](_0x4e42f0[_0x077b('0x39')],{'$or':_['map'](_0x4e42f0[_0x077b('0x30')],function(_0xb03555){var _0x22ca88={};_0x22ca88[_0xb03555]={'$like':'%'+_0x2e1f1a[_0x077b('0x2f')][_0x077b('0x38')]+'%'};return _0x22ca88;})});}_0x4e42f0=_['merge']({},_0x4e42f0,_0x2e1f1a[_0x077b('0x3c')]);return _0x17fac5['getConfigurations'](_0x4e42f0);}})[_0x077b('0x26')](function(_0x267351){if(_0x267351){_0x4aefd0=_0x267351['length'];if(!_0x2e1f1a[_0x077b('0x2f')][_0x077b('0x34')](_0x077b('0x35'))){_0x4e42f0[_0x077b('0x1e')]=qs['limit'](_0x2e1f1a[_0x077b('0x2f')][_0x077b('0x1e')]);_0x4e42f0[_0x077b('0x1d')]=qs[_0x077b('0x1d')](_0x2e1f1a[_0x077b('0x2f')][_0x077b('0x1d')]);}return _0x17fac5[_0x077b('0x48')](_0x4e42f0);}})[_0x077b('0x26')](function(_0x2bd212){if(_0x2bd212){return _0x2bd212?{'count':_0x4aefd0,'rows':_0x2bd212}:null;}})['then'](respondWithResult(_0x1751bf,null))['catch'](handleError(_0x1751bf,null));};exports['addConfiguration']=function(_0xcce1d5,_0x47f6a8,_0x541ed5){if(_0xcce1d5[_0x077b('0x46')]['id']){delete _0xcce1d5[_0x077b('0x46')]['id'];}return db[_0x077b('0x2a')][_0x077b('0x49')]({'where':{'id':_0xcce1d5['params']['id']}})[_0x077b('0x26')](handleEntityNotFound(_0x47f6a8,null))[_0x077b('0x26')](function(_0xb350f5){if(_0xb350f5){_0xcce1d5[_0x077b('0x46')][_0x077b('0x4c')]=_0xb350f5['id'];_0xcce1d5[_0x077b('0x46')][_0x077b('0x4d')]=integrations['getSubjects'](_0xcce1d5['body']['channel'],_0xcce1d5[_0x077b('0x46')][_0x077b('0x2c')]);_0xcce1d5[_0x077b('0x46')]['Descriptions']=integrations[_0x077b('0x4e')](_0xcce1d5[_0x077b('0x46')][_0x077b('0x4f')],_0xcce1d5['body'][_0x077b('0x2c')]);return db[_0x077b('0x50')][_0x077b('0x44')](_0xcce1d5[_0x077b('0x46')],{'include':[{'model':db['ServicenowField'],'as':_0x077b('0x4d')},{'model':db['ServicenowField'],'as':_0x077b('0x51')}]});}return null;})['then'](respondWithResult(_0x47f6a8,null))[_0x077b('0x43')](handleError(_0x47f6a8,null));};exports[_0x077b('0x52')]=function(_0x1ffaff,_0x42c264,_0x5b1bb8){var _0xe44fe4=[_0x077b('0x53'),_0x077b('0x54'),_0x077b('0x55'),_0x077b('0x56'),'close_code',_0x077b('0x57'),'incident_state',_0x077b('0x58'),_0x077b('0x59')];var _0x59d243=[_0x077b('0x5a'),'made_sla',_0x077b('0x5b'),'watch_list',_0x077b('0x5c'),_0x077b('0x5d'),_0x077b('0x5e'),_0x077b('0x54'),_0x077b('0x5f'),_0x077b('0x60'),_0x077b('0x61'),_0x077b('0x62'),_0x077b('0x63'),_0x077b('0x64'),'sys_created_on','sys_domain',_0x077b('0x65'),'sys_created_by',_0x077b('0x55'),_0x077b('0x4a'),_0x077b('0x66'),_0x077b('0x67'),'cmdb_ci',_0x077b('0x68'),_0x077b('0x69'),_0x077b('0x6a'),_0x077b('0x6b'),_0x077b('0x6c'),_0x077b('0x6d'),_0x077b('0x6e'),_0x077b('0x6f'),_0x077b('0x70'),_0x077b('0x71'),'opened_at',_0x077b('0x72'),_0x077b('0x73'),_0x077b('0x74'),'reopened_time','resolved_at',_0x077b('0x75'),_0x077b('0x76'),'subcategory',_0x077b('0x77'),_0x077b('0x78'),_0x077b('0x79'),'correlation_display',_0x077b('0x7a'),_0x077b('0x7b'),'assignment_group','business_stc',_0x077b('0x7c'),_0x077b('0x7d'),_0x077b('0x7e'),_0x077b('0x57'),'sys_class_name',_0x077b('0x7f'),_0x077b('0x80'),_0x077b('0x81'),_0x077b('0x82'),_0x077b('0x83'),_0x077b('0x84'),'reopened_by',_0x077b('0x85'),_0x077b('0x86'),_0x077b('0x87'),_0x077b('0x88'),_0x077b('0x89'),_0x077b('0x8a'),_0x077b('0x8b'),_0x077b('0x58'),_0x077b('0x8c'),_0x077b('0x8d'),_0x077b('0x8e'),_0x077b('0x8f'),_0x077b('0x90'),_0x077b('0x91'),_0x077b('0x92'),_0x077b('0x93'),_0x077b('0x94'),_0x077b('0x95'),_0x077b('0x96'),'location',_0x077b('0x59')];var _0x3bf276='';var _0xe09e25='';var _0xdd561c=[];var _0xe1ceaa='';var _0x5651c0='';var _0x2cd466=[];var _0xb0b3de='';var _0x549e36='';var _0x49cdeb={};var _0x10e37a='';return db[_0x077b('0x2a')]['findOne']({'where':{'id':_0x1ffaff[_0x077b('0x47')]['id']},'attributes':['id','username','password','email','remoteUri',_0x077b('0x97')]})[_0x077b('0x26')](handleEntityNotFound(_0x42c264,null))['then'](function(_0x5a58b3){if(_0x5a58b3){_0x10e37a=_0x5a58b3[_0x077b('0x98')];var _0x9aa6c3=_0x10e37a[_0x077b('0x99')](-0x1);if(_0x9aa6c3==='/'){_0x10e37a=_0x10e37a[_0x077b('0x9a')](0x0,_0x10e37a[_0x077b('0x9b')](_0x9aa6c3));}_0x549e36=util[_0x077b('0x9c')](_0x077b('0x9d'),_0x10e37a);_0xb0b3de=util[_0x077b('0x9c')]('%s/api/now/table/',_0x10e37a);_0x49cdeb={'user':_0x5a58b3[_0x077b('0x9e')],'pass':_0x5a58b3[_0x077b('0x9f')]};var _0xdbedbd={'method':_0x077b('0xa0'),'uri':_0x549e36+_0x077b('0xa1'),'auth':_0x49cdeb,'json':!![]};return rp(_0xdbedbd);}})[_0x077b('0x26')](function(_0x1f4c41){if(_0x1f4c41[_0x077b('0xa2')]['length']>0x0){_0x3bf276=_0x1f4c41[_0x077b('0xa2')];}console['log']('incident\x20table\x20objects',_0x3bf276);_0x2cd466=[];_0xe09e25=Object[_0x077b('0xa3')]([],_0x3bf276);_[_0x077b('0xa4')](_0xe09e25,function(_0x1e2d1a){return!_0xe44fe4[_0x077b('0xa5')](_0x1e2d1a['name']);});_0xe09e25[_0x077b('0xa6')](function(_0x1c40b1){var _0x1e173e=createFieldObject(_0xb0b3de,_0x49cdeb,_0x1c40b1[_0x077b('0xa7')],_0x1c40b1['name'],_0x1c40b1['label'],![]);_0x2cd466['push'](_0x1e173e);});return Promise['all'](_0x2cd466);})['then'](function(_0x555c75){_0xdd561c=_0x555c75;_0xe1ceaa=Object[_0x077b('0xa3')]([],_0x3bf276);console[_0x077b('0xa8')]('TCL:\x20_object',_0x3bf276);_[_0x077b('0xa4')](_0xe1ceaa,function(_0x98cce1){return _0x59d243[_0x077b('0xa5')](_0x98cce1[_0x077b('0x27')]);});console[_0x077b('0xa8')](_0x077b('0xa9'),_0xe1ceaa);_0x2cd466=[];_0xe1ceaa[_0x077b('0xa6')](function(_0x3ccfba){var _0x30d9e5=createFieldObject(_0xb0b3de,_0x49cdeb,_0x3ccfba[_0x077b('0xa7')],_0x3ccfba['name'],_0x3ccfba[_0x077b('0xaa')],!![]);_0x2cd466[_0x077b('0xab')](_0x30d9e5);});return Promise[_0x077b('0xac')](_0x2cd466);})['then'](function(_0x210d77){_0x5651c0=_0x210d77;var _0x590888=_0xdd561c[_0x077b('0xad')](_0x5651c0);return{'count':_0x590888[_0x077b('0x33')],'rows':_0x590888};})[_0x077b('0x26')](respondWithResult(_0x42c264,null))[_0x077b('0x43')](function(_0x24eee4){console[_0x077b('0xa8')]('ServiceNow\x20error:\x20'+_0x24eee4);var _0x2bec14=_0x1ffaff['query']['test']?0x1f4:_0x24eee4[_0x077b('0xae')]||0x1f4;logger[_0x077b('0xaf')](_0x24eee4[_0x077b('0xb0')]);delete _0x24eee4[_0x077b('0x27')];if(_0x2bec14===0x191){_0x2bec14=0x190;}_0x42c264[_0x077b('0x1b')](_0x2bec14)[_0x077b('0x28')](_0x1ffaff['query']['test']?{'message':_0x077b('0xb1'),'statusCode':_0x24eee4[_0x077b('0xae')]}:_0x24eee4);});};function createFieldObject(_0x212063,_0x2f9a54,_0x29f566,_0x1e8459,_0x180059,_0xc2260b){return new Promise(function(_0x200a0d,_0x2040fc){var _0xa36bd0={'id':_0x1e8459,'name':_0x180059,'custom':_0xc2260b};if(_0x29f566===_0x077b('0xb2')){_0xa36bd0['options']=[{'name':'True','value':'true'},{'name':_0x077b('0xb3'),'value':_0x077b('0xb4')}];_0x200a0d(_0xa36bd0);}else{var _0x1fd727={'method':_0x077b('0xa0'),'uri':_0x212063+'sys_choice?sysparm_query=name=incident^element='+_0x1e8459,'auth':_0x2f9a54,'json':!![]};return rp(_0x1fd727)[_0x077b('0x26')](function(_0x11d686){var _0x499cee=[];if(_0x11d686[_0x077b('0xa2')][_0x077b('0x33')]>0x0){_0x11d686[_0x077b('0xa2')][_0x077b('0xa6')](function(_0x2013a9){if(_0x2013a9[_0x077b('0xb5')]===_0x077b('0xb4')){var _0x52897d={'name':_0x2013a9['label'],'value':_0x2013a9[_0x077b('0xb6')]};_0x499cee[_0x077b('0xab')](_0x52897d);}});}_0xa36bd0[_0x077b('0x3c')]=_0x499cee;if(_0xa36bd0['options']['length']>0x0){_0x200a0d(_0xa36bd0);}else{if(_0xc2260b==![]){_0x200a0d();}else{_0x200a0d(_0xa36bd0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f78d620..9b531d7 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x52c864,_0x53694a){var _0x506bcf=function(_0x5ec764){while(--_0x5ec764){_0x52c864['push'](_0x52c864['shift']());}};_0x506bcf(++_0x53694a);}(_0x8958,0x93));var _0x8895=function(_0x40ec45,_0x30f25a){_0x40ec45=_0x40ec45-0x0;var _0xd4399a=_0x8958[_0x40ec45];return _0xd4399a;};'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 +var _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0xabce,0x103));var _0xeabc=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xabce[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'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 6ac63d1..3de333b 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 _0x85ab=['then','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','GetServicenowAccount','ServicenowAccount','raw','options','where','attributes','limit','include','model','map','catch','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5efb33,_0x426463){var _0xe0778d=function(_0x1befe7){while(--_0x1befe7){_0x5efb33['push'](_0x5efb33['shift']());}};_0xe0778d(++_0x426463);}(_0x85ab,0x104));var _0xb85a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x85ab[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xb85a('0x0'));var util=require(_0xb85a('0x1'));var moment=require('moment');var BPromise=require(_0xb85a('0x2'));var rs=require(_0xb85a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb85a('0x4'))['db'];var utils=require(_0xb85a('0x5'));var logger=require(_0xb85a('0x6'))('rpc');var config=require(_0xb85a('0x7'));var jayson=require(_0xb85a('0x8'));var client=jayson[_0xb85a('0x9')][_0xb85a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38741e,_0x31362e,_0xd4f040){return new BPromise(function(_0x351720,_0x1c46d7){return client[_0xb85a('0xb')](_0x38741e,_0xd4f040)[_0xb85a('0xc')](function(_0x3aafe2){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x31362e,_0xb85a('0xd'));logger[_0xb85a('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x31362e,_0xb85a('0xd'),JSON[_0xb85a('0xf')](_0x3aafe2));if(_0x3aafe2[_0xb85a('0x10')]){if(_0x3aafe2['error'][_0xb85a('0x11')]===0x1f4){logger['error'](_0xb85a('0x12'),_0x31362e,_0x3aafe2[_0xb85a('0x10')]['message']);return _0x1c46d7(_0x3aafe2[_0xb85a('0x10')]['message']);}logger[_0xb85a('0x10')](_0xb85a('0x12'),_0x31362e,_0x3aafe2[_0xb85a('0x10')][_0xb85a('0x13')]);return _0x351720(_0x3aafe2[_0xb85a('0x10')][_0xb85a('0x13')]);}else{logger[_0xb85a('0x14')](_0xb85a('0x12'),_0x31362e,_0xb85a('0xd'));_0x351720(_0x3aafe2['result'][_0xb85a('0x13')]);}})['catch'](function(_0x212273){logger[_0xb85a('0x10')](_0xb85a('0x12'),_0x31362e,_0x212273);_0x1c46d7(_0x212273);});});}exports[_0xb85a('0x15')]=function(_0x14eecc){var _0x496650=this;return new Promise(function(_0x23d404,_0x273e2d){return db[_0xb85a('0x16')]['findAll']({'raw':_0x14eecc['options']?_0x14eecc['options'][_0xb85a('0x17')]===undefined?!![]:![]:!![],'where':_0x14eecc[_0xb85a('0x18')]?_0x14eecc[_0xb85a('0x18')][_0xb85a('0x19')]||null:null,'attributes':_0x14eecc['options']?_0x14eecc[_0xb85a('0x18')][_0xb85a('0x1a')]||null:null,'limit':_0x14eecc['options']?_0x14eecc['options'][_0xb85a('0x1b')]||null:null,'include':_0x14eecc['options']?_0x14eecc[_0xb85a('0x18')]['include']?_['map'](_0x14eecc[_0xb85a('0x18')][_0xb85a('0x1c')],function(_0x4e4738){return{'model':db[_0x4e4738[_0xb85a('0x1d')]],'as':_0x4e4738['as'],'attributes':_0x4e4738[_0xb85a('0x1a')],'include':_0x4e4738[_0xb85a('0x1c')]?_[_0xb85a('0x1e')](_0x4e4738['include'],function(_0x508c23){return{'model':db[_0x508c23['model']],'as':_0x508c23['as'],'attributes':_0x508c23[_0xb85a('0x1a')],'include':_0x508c23['include']?_[_0xb85a('0x1e')](_0x508c23[_0xb85a('0x1c')],function(_0x5a9e67){return{'model':db[_0x5a9e67[_0xb85a('0x1d')]],'as':_0x5a9e67['as'],'attributes':_0x5a9e67[_0xb85a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6af7){logger[_0xb85a('0x14')](_0xb85a('0x15'),_0x14eecc);logger[_0xb85a('0xe')](_0xb85a('0x15'),_0x14eecc,JSON[_0xb85a('0xf')](_0xb6af7));_0x23d404(_0xb6af7);})[_0xb85a('0x1f')](function(_0x3cbac5){logger[_0xb85a('0x10')]('GetServicenowAccount',_0x3cbac5[_0xb85a('0x13')],_0x14eecc);_0x273e2d(_0x496650['error'](0x1f4,_0x3cbac5['message']));});});};exports[_0xb85a('0x20')]=function(_0x35dfbb){var _0x2656a3=this;return new Promise(function(_0x93b506,_0x2cf882){return db[_0xb85a('0x16')][_0xb85a('0x21')]({'raw':_0x35dfbb['options']?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x17')]===undefined?!![]:![]:!![],'where':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x19')]||null:null,'attributes':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1a')]||null:null,'include':_0x35dfbb[_0xb85a('0x18')]?_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1c')]?_[_0xb85a('0x1e')](_0x35dfbb[_0xb85a('0x18')][_0xb85a('0x1c')],function(_0x52255c){return{'model':db[_0x52255c[_0xb85a('0x1d')]],'as':_0x52255c['as'],'attributes':_0x52255c['attributes'],'include':_0x52255c[_0xb85a('0x1c')]?_['map'](_0x52255c[_0xb85a('0x1c')],function(_0x1f6a24){return{'model':db[_0x1f6a24[_0xb85a('0x1d')]],'as':_0x1f6a24['as'],'attributes':_0x1f6a24[_0xb85a('0x1a')],'include':_0x1f6a24[_0xb85a('0x1c')]?_['map'](_0x1f6a24['include'],function(_0x5ce6ae){return{'model':db[_0x5ce6ae[_0xb85a('0x1d')]],'as':_0x5ce6ae['as'],'attributes':_0x5ce6ae[_0xb85a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb85a('0xc')](function(_0x27719d){logger[_0xb85a('0x14')](_0xb85a('0x20'),_0x35dfbb);logger[_0xb85a('0xe')](_0xb85a('0x20'),_0x35dfbb,JSON['stringify'](_0x27719d));_0x93b506(_0x27719d);})[_0xb85a('0x1f')](function(_0x33e069){logger[_0xb85a('0x10')](_0xb85a('0x20'),_0x33e069[_0xb85a('0x13')],_0x35dfbb);_0x2cf882(_0x2656a3[_0xb85a('0x10')](0x1f4,_0x33e069[_0xb85a('0x13')]));});});}; \ No newline at end of file +var _0xc366=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowServicenowAccount'];(function(_0x245ecc,_0x2ed0f8){var _0x23a06f=function(_0x1f3d2a){while(--_0x1f3d2a){_0x245ecc['push'](_0x245ecc['shift']());}};_0x23a06f(++_0x2ed0f8);}(_0xc366,0x130));var _0x6c36=function(_0xd9650e,_0x1f7fb5){_0xd9650e=_0xd9650e-0x0;var _0x34f735=_0xc366[_0xd9650e];return _0x34f735;};'use strict';var _=require(_0x6c36('0x0'));var util=require(_0x6c36('0x1'));var moment=require(_0x6c36('0x2'));var BPromise=require(_0x6c36('0x3'));var rs=require(_0x6c36('0x4'));var fs=require('fs');var Redis=require(_0x6c36('0x5'));var db=require(_0x6c36('0x6'))['db'];var utils=require(_0x6c36('0x7'));var logger=require(_0x6c36('0x8'))(_0x6c36('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c36('0xa'));var client=jayson[_0x6c36('0xb')][_0x6c36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x500d87,_0x65e6ab,_0x1cd623){return new BPromise(function(_0x446fd2,_0x4c64be){return client[_0x6c36('0xd')](_0x500d87,_0x1cd623)[_0x6c36('0xe')](function(_0x1ce2fe){logger[_0x6c36('0xf')](_0x6c36('0x10'),_0x65e6ab,_0x6c36('0x11'));logger[_0x6c36('0x12')](_0x6c36('0x13'),_0x65e6ab,_0x6c36('0x11'),JSON[_0x6c36('0x14')](_0x1ce2fe));if(_0x1ce2fe[_0x6c36('0x15')]){if(_0x1ce2fe[_0x6c36('0x15')][_0x6c36('0x16')]===0x1f4){logger['error'](_0x6c36('0x10'),_0x65e6ab,_0x1ce2fe['error'][_0x6c36('0x17')]);return _0x4c64be(_0x1ce2fe[_0x6c36('0x15')][_0x6c36('0x17')]);}logger['error'](_0x6c36('0x10'),_0x65e6ab,_0x1ce2fe[_0x6c36('0x15')][_0x6c36('0x17')]);return _0x446fd2(_0x1ce2fe[_0x6c36('0x15')][_0x6c36('0x17')]);}else{logger['info'](_0x6c36('0x10'),_0x65e6ab,_0x6c36('0x11'));_0x446fd2(_0x1ce2fe['result'][_0x6c36('0x17')]);}})[_0x6c36('0x18')](function(_0x30c869){logger[_0x6c36('0x15')](_0x6c36('0x10'),_0x65e6ab,_0x30c869);_0x4c64be(_0x30c869);});});}exports[_0x6c36('0x19')]=function(_0x395fde){var _0x32adb4=this;return new Promise(function(_0xe429e0,_0x14cdef){return db[_0x6c36('0x1a')][_0x6c36('0x1b')]({'raw':_0x395fde[_0x6c36('0x1c')]?_0x395fde[_0x6c36('0x1c')][_0x6c36('0x1d')]===undefined?!![]:![]:!![],'where':_0x395fde['options']?_0x395fde[_0x6c36('0x1c')]['where']||null:null,'attributes':_0x395fde[_0x6c36('0x1c')]?_0x395fde[_0x6c36('0x1c')][_0x6c36('0x1e')]||null:null,'limit':_0x395fde[_0x6c36('0x1c')]?_0x395fde[_0x6c36('0x1c')][_0x6c36('0x1f')]||null:null,'include':_0x395fde[_0x6c36('0x1c')]?_0x395fde[_0x6c36('0x1c')][_0x6c36('0x20')]?_[_0x6c36('0x21')](_0x395fde[_0x6c36('0x1c')][_0x6c36('0x20')],function(_0x4ab1be){return{'model':db[_0x4ab1be[_0x6c36('0x22')]],'as':_0x4ab1be['as'],'attributes':_0x4ab1be['attributes'],'include':_0x4ab1be['include']?_['map'](_0x4ab1be[_0x6c36('0x20')],function(_0x36516b){return{'model':db[_0x36516b[_0x6c36('0x22')]],'as':_0x36516b['as'],'attributes':_0x36516b['attributes'],'include':_0x36516b[_0x6c36('0x20')]?_['map'](_0x36516b[_0x6c36('0x20')],function(_0x33e697){return{'model':db[_0x33e697[_0x6c36('0x22')]],'as':_0x33e697['as'],'attributes':_0x33e697[_0x6c36('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6f9ec9){logger[_0x6c36('0xf')](_0x6c36('0x19'),_0x395fde);logger[_0x6c36('0x12')]('GetServicenowAccount',_0x395fde,JSON['stringify'](_0x6f9ec9));_0xe429e0(_0x6f9ec9);})[_0x6c36('0x18')](function(_0x1fecdf){logger[_0x6c36('0x15')](_0x6c36('0x19'),_0x1fecdf[_0x6c36('0x17')],_0x395fde);_0x14cdef(_0x32adb4[_0x6c36('0x15')](0x1f4,_0x1fecdf[_0x6c36('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x1e7502){var _0x41df6d=this;return new Promise(function(_0x11cbd5,_0x155478){return db[_0x6c36('0x1a')][_0x6c36('0x23')]({'raw':_0x1e7502[_0x6c36('0x1c')]?_0x1e7502[_0x6c36('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1e7502[_0x6c36('0x1c')]?_0x1e7502[_0x6c36('0x1c')][_0x6c36('0x24')]||null:null,'attributes':_0x1e7502['options']?_0x1e7502[_0x6c36('0x1c')][_0x6c36('0x1e')]||null:null,'include':_0x1e7502[_0x6c36('0x1c')]?_0x1e7502[_0x6c36('0x1c')][_0x6c36('0x20')]?_[_0x6c36('0x21')](_0x1e7502[_0x6c36('0x1c')]['include'],function(_0x4228d0){return{'model':db[_0x4228d0['model']],'as':_0x4228d0['as'],'attributes':_0x4228d0['attributes'],'include':_0x4228d0[_0x6c36('0x20')]?_[_0x6c36('0x21')](_0x4228d0[_0x6c36('0x20')],function(_0x5df510){return{'model':db[_0x5df510[_0x6c36('0x22')]],'as':_0x5df510['as'],'attributes':_0x5df510[_0x6c36('0x1e')],'include':_0x5df510['include']?_['map'](_0x5df510[_0x6c36('0x20')],function(_0x517a1b){return{'model':db[_0x517a1b['model']],'as':_0x517a1b['as'],'attributes':_0x517a1b[_0x6c36('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6c36('0xe')](function(_0x4ae05f){logger[_0x6c36('0xf')]('ShowServicenowAccount',_0x1e7502);logger['debug'](_0x6c36('0x25'),_0x1e7502,JSON[_0x6c36('0x14')](_0x4ae05f));_0x11cbd5(_0x4ae05f);})[_0x6c36('0x18')](function(_0x9e11f0){logger[_0x6c36('0x15')](_0x6c36('0x25'),_0x9e11f0[_0x6c36('0x17')],_0x1e7502);_0x155478(_0x41df6d['error'](0x1f4,_0x9e11f0['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 712349b..fdd9e6a 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 _0x741f=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x415ac5,_0x663a59){var _0x2fb770=function(_0x2286c4){while(--_0x2286c4){_0x415ac5['push'](_0x415ac5['shift']());}};_0x2fb770(++_0x663a59);}(_0x741f,0xdc));var _0xf741=function(_0x2ca071,_0x5893c5){_0x2ca071=_0x2ca071-0x0;var _0x353fe3=_0x741f[_0x2ca071];return _0x353fe3;};'use strict';var multer=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var path=require(_0xf741('0x2'));var timeout=require(_0xf741('0x3'));var express=require('express');var router=express[_0xf741('0x4')]();var fs_extra=require(_0xf741('0x5'));var auth=require(_0xf741('0x6'));var interaction=require(_0xf741('0x7'));var config=require(_0xf741('0x8'));var controller=require(_0xf741('0x9'));router[_0xf741('0xa')]('/',auth[_0xf741('0xb')](),controller['index']);router[_0xf741('0xa')](_0xf741('0xc'),auth[_0xf741('0xb')](),controller['show']);router[_0xf741('0xa')]('/:id/fields',auth[_0xf741('0xb')](),controller[_0xf741('0xd')]);router[_0xf741('0xa')](_0xf741('0xe'),auth[_0xf741('0xb')](),controller[_0xf741('0xf')]);router[_0xf741('0xa')](_0xf741('0x10'),auth[_0xf741('0xb')](),controller[_0xf741('0x11')]);router[_0xf741('0x12')]('/',auth[_0xf741('0xb')](),controller[_0xf741('0x13')]);router[_0xf741('0x14')](_0xf741('0xc'),auth['isAuthenticated'](),controller[_0xf741('0x15')]);router[_0xf741('0x16')](_0xf741('0xc'),auth[_0xf741('0xb')](),controller[_0xf741('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd7c2=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xd7c2,0xbd));var _0x2d7c=function(_0x461ce9,_0x50c8e6){_0x461ce9=_0x461ce9-0x0;var _0x27a1c7=_0xd7c2[_0x461ce9];return _0x27a1c7;};'use strict';var multer=require(_0x2d7c('0x0'));var util=require('util');var path=require(_0x2d7c('0x1'));var timeout=require('connect-timeout');var express=require(_0x2d7c('0x2'));var router=express[_0x2d7c('0x3')]();var fs_extra=require(_0x2d7c('0x4'));var auth=require(_0x2d7c('0x5'));var interaction=require(_0x2d7c('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x2d7c('0x7')]('/',auth[_0x2d7c('0x8')](),controller[_0x2d7c('0x9')]);router[_0x2d7c('0x7')](_0x2d7c('0xa'),auth[_0x2d7c('0x8')](),controller['show']);router['get'](_0x2d7c('0xb'),auth[_0x2d7c('0x8')](),controller[_0x2d7c('0xc')]);router[_0x2d7c('0x7')]('/:id/subjects',auth[_0x2d7c('0x8')](),controller[_0x2d7c('0xd')]);router[_0x2d7c('0x7')](_0x2d7c('0xe'),auth['isAuthenticated'](),controller[_0x2d7c('0xf')]);router[_0x2d7c('0x10')]('/',auth[_0x2d7c('0x8')](),controller['create']);router[_0x2d7c('0x11')](_0x2d7c('0xa'),auth[_0x2d7c('0x8')](),controller[_0x2d7c('0x12')]);router[_0x2d7c('0x13')](_0x2d7c('0xa'),auth[_0x2d7c('0x8')](),controller['destroy']);module[_0x2d7c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7930405..e2b9047 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 _0x6edb=['STRING'];(function(_0x3db023,_0x2e88bc){var _0x20f63c=function(_0xeb15f8){while(--_0xeb15f8){_0x3db023['push'](_0x3db023['shift']());}};_0x20f63c(++_0x2e88bc);}(_0x6edb,0xcc));var _0xb6ed=function(_0x100a95,_0x3188df){_0x100a95=_0x100a95-0x0;var _0x19c632=_0x6edb[_0x100a95];return _0x19c632;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb6ed('0x0')]},'description':{'type':Sequelize[_0xb6ed('0x0')]}}; \ No newline at end of file +var _0x3b10=['sequelize','STRING'];(function(_0xd7da64,_0x1e0936){var _0x4b74ce=function(_0x47af7a){while(--_0x47af7a){_0xd7da64['push'](_0xd7da64['shift']());}};_0x4b74ce(++_0x1e0936);}(_0x3b10,0x176));var _0x03b1=function(_0x48e8c1,_0x5cceef){_0x48e8c1=_0x48e8c1-0x0;var _0x46fd3f=_0x3b10[_0x48e8c1];return _0x46fd3f;};'use strict';var Sequelize=require(_0x03b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x03b1('0x1')]},'description':{'type':Sequelize[_0x03b1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0851e66..ac6f093 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 _0xfb99=['fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','includeAll','include','rows','show','keys','find','catch','create','body','params','ServicenowField','sort','filter','options','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv'];(function(_0x22f53f,_0x14ef66){var _0x57bc67=function(_0x375f18){while(--_0x375f18){_0x22f53f['push'](_0x22f53f['shift']());}};_0x57bc67(++_0x14ef66);}(_0xfb99,0x1b5));var _0x9fb9=function(_0x39c745,_0xa4b72a){_0x39c745=_0x39c745-0x0;var _0x3b4c9c=_0xfb99[_0x39c745];return _0x3b4c9c;};'use strict';var emlformat=require(_0x9fb9('0x0'));var rimraf=require(_0x9fb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fb9('0x2'));var rp=require('request-promise');var moment=require(_0x9fb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fb9('0x4'));var util=require(_0x9fb9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9fb9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fb9('0x7'));var _=require(_0x9fb9('0x8'));var squel=require('squel');var crypto=require(_0x9fb9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9fb9('0xa'));var toCsv=require(_0x9fb9('0x6'));var querystring=require('querystring');var Papa=require(_0x9fb9('0xb'));var Redis=require(_0x9fb9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9fb9('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9fb9('0xe'));var config=require(_0x9fb9('0xf'));var licenseUtil=require(_0x9fb9('0x10'));var db=require(_0x9fb9('0x11'))['db'];function respondWithStatusCode(_0x14607f,_0x445173){_0x445173=_0x445173||0xcc;return function(_0x44f5c8){if(_0x44f5c8){return _0x14607f[_0x9fb9('0x12')](_0x445173);}return _0x14607f['status'](_0x445173)[_0x9fb9('0x13')]();};}function respondWithResult(_0x3526bb,_0x4e754d){_0x4e754d=_0x4e754d||0xc8;return function(_0x10baca){if(_0x10baca){return _0x3526bb[_0x9fb9('0x14')](_0x4e754d)[_0x9fb9('0x15')](_0x10baca);}};}function respondWithFilteredResult(_0x42115b,_0x181242){return function(_0x25b786){if(_0x25b786){var _0x150807=typeof _0x181242[_0x9fb9('0x16')]==='undefined'&&typeof _0x181242['limit']===_0x9fb9('0x17');var _0x3b8444=_0x25b786[_0x9fb9('0x18')];var _0x5e0705=_0x150807?0x0:_0x181242[_0x9fb9('0x16')];var _0x3e0b35=_0x150807?_0x25b786['count']:_0x181242[_0x9fb9('0x16')]+_0x181242['limit'];var _0x36a2b8;if(_0x3e0b35>=_0x3b8444){_0x3e0b35=_0x3b8444;_0x36a2b8=0xc8;}else{_0x36a2b8=0xce;}_0x42115b[_0x9fb9('0x14')](_0x36a2b8);return _0x42115b['set'](_0x9fb9('0x19'),_0x5e0705+'-'+_0x3e0b35+'/'+_0x3b8444)['json'](_0x25b786);}return null;};}function patchUpdates(_0x344009){return function(_0x30e1eb){try{jsonpatch['apply'](_0x30e1eb,_0x344009,!![]);}catch(_0x3cdd03){return BPromise[_0x9fb9('0x1a')](_0x3cdd03);}return _0x30e1eb[_0x9fb9('0x1b')]();};}function saveUpdates(_0x260af4,_0x3d9790){return function(_0x21b4d0){if(_0x21b4d0){return _0x21b4d0[_0x9fb9('0x1c')](_0x260af4)[_0x9fb9('0x1d')](function(_0x99768f){return _0x99768f;});}return null;};}function removeEntity(_0x53d524,_0x59e1a3){return function(_0x107667){if(_0x107667){return _0x107667[_0x9fb9('0x1e')]()[_0x9fb9('0x1d')](function(){_0x53d524['status'](0xcc)[_0x9fb9('0x13')]();});}};}function handleEntityNotFound(_0x22d25a,_0x240f4d){return function(_0x4039af){if(!_0x4039af){_0x22d25a[_0x9fb9('0x12')](0x194);}return _0x4039af;};}function handleError(_0x5554cd,_0x366c21){_0x366c21=_0x366c21||0x1f4;return function(_0x280b1d){logger[_0x9fb9('0x1f')](_0x280b1d[_0x9fb9('0x20')]);if(_0x280b1d[_0x9fb9('0x21')]){delete _0x280b1d[_0x9fb9('0x21')];}_0x5554cd[_0x9fb9('0x14')](_0x366c21)[_0x9fb9('0x22')](_0x280b1d);};}exports[_0x9fb9('0x23')]=function(_0x373250,_0x332bdf){var _0x10b57c={},_0x626c2a={},_0xfdcb19={'count':0x0,'rows':[]};var _0x1bd976=_[_0x9fb9('0x24')](db[_0x9fb9('0x25')][_0x9fb9('0x26')],function(_0x5212c1){return{'name':_0x5212c1[_0x9fb9('0x27')],'type':_0x5212c1[_0x9fb9('0x28')][_0x9fb9('0x29')]};});_0x626c2a[_0x9fb9('0x2a')]=_['map'](_0x1bd976,'name');_0x626c2a[_0x9fb9('0x2b')]=_['keys'](_0x373250[_0x9fb9('0x2b')]);_0x626c2a[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x626c2a[_0x9fb9('0x2a')],_0x626c2a[_0x9fb9('0x2b')]);_0x10b57c['attributes']=_[_0x9fb9('0x2d')](_0x626c2a['model'],qs['fields'](_0x373250['query'][_0x9fb9('0x2e')]));_0x10b57c[_0x9fb9('0x2f')]=_0x10b57c['attributes'][_0x9fb9('0x30')]?_0x10b57c[_0x9fb9('0x2f')]:_0x626c2a[_0x9fb9('0x2a')];if(!_0x373250['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x10b57c[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x373250['query'][_0x9fb9('0x33')]);_0x10b57c[_0x9fb9('0x16')]=qs['offset'](_0x373250[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}_0x10b57c[_0x9fb9('0x34')]=qs['sort'](_0x373250['query']['sort']);_0x10b57c[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0x373250[_0x9fb9('0x2b')],_0x626c2a[_0x9fb9('0x2c')]),_0x1bd976);if(_0x373250[_0x9fb9('0x2b')]['filter']){_0x10b57c[_0x9fb9('0x35')]=_['merge'](_0x10b57c[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x1bd976,function(_0x270d9c){if(_0x270d9c[_0x9fb9('0x28')]!=='VIRTUAL'){var _0x53b64f={};_0x53b64f[_0x270d9c[_0x9fb9('0x21')]]={'$like':'%'+_0x373250[_0x9fb9('0x2b')]['filter']+'%'};return _0x53b64f;}})});}_0x10b57c=_[_0x9fb9('0x37')]({},_0x10b57c,_0x373250['options']);var _0x2d3038={'where':_0x10b57c[_0x9fb9('0x35')]};return db[_0x9fb9('0x25')]['count'](_0x2d3038)['then'](function(_0x220a9c){_0xfdcb19['count']=_0x220a9c;if(_0x373250[_0x9fb9('0x2b')][_0x9fb9('0x38')]){_0x10b57c[_0x9fb9('0x39')]=[{'all':!![]}];}return db[_0x9fb9('0x25')]['findAll'](_0x10b57c);})['then'](function(_0x2f8a1b){_0xfdcb19[_0x9fb9('0x3a')]=_0x2f8a1b;return _0xfdcb19;})[_0x9fb9('0x1d')](respondWithFilteredResult(_0x332bdf,_0x10b57c))['catch'](handleError(_0x332bdf,null));};exports[_0x9fb9('0x3b')]=function(_0x26d9f5,_0x1820ae){var _0x52455f={'raw':![],'where':{'id':_0x26d9f5['params']['id']}},_0x338e4e={};_0x338e4e[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db[_0x9fb9('0x25')][_0x9fb9('0x26')]);_0x338e4e[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0x26d9f5['query']);_0x338e4e[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x338e4e['model'],_0x338e4e[_0x9fb9('0x2b')]);_0x52455f[_0x9fb9('0x2f')]=_[_0x9fb9('0x2d')](_0x338e4e[_0x9fb9('0x2a')],qs[_0x9fb9('0x2e')](_0x26d9f5[_0x9fb9('0x2b')]['fields']));_0x52455f['attributes']=_0x52455f[_0x9fb9('0x2f')]['length']?_0x52455f[_0x9fb9('0x2f')]:_0x338e4e[_0x9fb9('0x2a')];if(_0x26d9f5[_0x9fb9('0x2b')][_0x9fb9('0x38')]){_0x52455f[_0x9fb9('0x39')]=[{'all':!![]}];}_0x52455f=_[_0x9fb9('0x37')]({},_0x52455f,_0x26d9f5['options']);return db['ServicenowConfiguration'][_0x9fb9('0x3d')](_0x52455f)[_0x9fb9('0x1d')](handleEntityNotFound(_0x1820ae,null))[_0x9fb9('0x1d')](respondWithResult(_0x1820ae,null))[_0x9fb9('0x3e')](handleError(_0x1820ae,null));};exports[_0x9fb9('0x3f')]=function(_0x38cb73,_0x4ab261){return db[_0x9fb9('0x25')][_0x9fb9('0x3f')](_0x38cb73[_0x9fb9('0x40')],{})['then'](respondWithResult(_0x4ab261,0xc9))['catch'](handleError(_0x4ab261,null));};exports['update']=function(_0x2105f4,_0x12bb0c){if(_0x2105f4[_0x9fb9('0x40')]['id']){delete _0x2105f4[_0x9fb9('0x40')]['id'];}return db[_0x9fb9('0x25')][_0x9fb9('0x3d')]({'where':{'id':_0x2105f4['params']['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x12bb0c,null))[_0x9fb9('0x1d')](saveUpdates(_0x2105f4[_0x9fb9('0x40')],null))[_0x9fb9('0x1d')](respondWithResult(_0x12bb0c,null))[_0x9fb9('0x3e')](handleError(_0x12bb0c,null));};exports['destroy']=function(_0x245a4b,_0x5a052c){return db['ServicenowConfiguration'][_0x9fb9('0x3d')]({'where':{'id':_0x245a4b[_0x9fb9('0x41')]['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x5a052c,null))[_0x9fb9('0x1d')](removeEntity(_0x5a052c,null))[_0x9fb9('0x3e')](handleError(_0x5a052c,null));};exports['getFields']=function(_0xeed5cf,_0x27d9d1,_0x815f01){var _0x5a8d34={};var _0x4b93a7={};var _0x4d8ccb;var _0x55a1d0;return db[_0x9fb9('0x25')]['findOne']({'where':{'id':_0xeed5cf['params']['id']}})[_0x9fb9('0x1d')](handleEntityNotFound(_0x27d9d1,null))[_0x9fb9('0x1d')](function(_0x4a5dd7){if(_0x4a5dd7){_0x4d8ccb=_0x4a5dd7;_0x4b93a7['model']=_[_0x9fb9('0x3c')](db[_0x9fb9('0x42')][_0x9fb9('0x26')]);_0x4b93a7[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0xeed5cf['query']);_0x4b93a7['filters']=_[_0x9fb9('0x2d')](_0x4b93a7[_0x9fb9('0x2a')],_0x4b93a7[_0x9fb9('0x2b')]);_0x5a8d34['attributes']=_['intersection'](_0x4b93a7[_0x9fb9('0x2a')],qs['fields'](_0xeed5cf[_0x9fb9('0x2b')]['fields']));_0x5a8d34[_0x9fb9('0x2f')]=_0x5a8d34['attributes'][_0x9fb9('0x30')]?_0x5a8d34[_0x9fb9('0x2f')]:_0x4b93a7[_0x9fb9('0x2a')];_0x5a8d34[_0x9fb9('0x34')]=qs['sort'](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x43')]);_0x5a8d34[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0xeed5cf[_0x9fb9('0x2b')],_0x4b93a7['filters']));if(_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x44')]){_0x5a8d34['where']=_[_0x9fb9('0x37')](_0x5a8d34[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x5a8d34['attributes'],function(_0x5aa0de){var _0x455c42={};_0x455c42[_0x5aa0de]={'$like':'%'+_0xeed5cf[_0x9fb9('0x2b')]['filter']+'%'};return _0x455c42;})});}_0x5a8d34=_[_0x9fb9('0x37')]({},_0x5a8d34,_0xeed5cf[_0x9fb9('0x45')]);return _0x4d8ccb[_0x9fb9('0x46')](_0x5a8d34);}})[_0x9fb9('0x1d')](function(_0x5513a2){if(_0x5513a2){_0x55a1d0=_0x5513a2[_0x9fb9('0x30')];if(!_0xeed5cf['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x5a8d34[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x33')]);_0x5a8d34[_0x9fb9('0x16')]=qs[_0x9fb9('0x16')](_0xeed5cf[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x4d8ccb[_0x9fb9('0x46')](_0x5a8d34);}})[_0x9fb9('0x1d')](function(_0x4a6282){if(_0x4a6282){return _0x4a6282?{'count':_0x55a1d0,'rows':_0x4a6282}:null;}})['then'](respondWithResult(_0x27d9d1,null))[_0x9fb9('0x3e')](handleError(_0x27d9d1,null));};exports[_0x9fb9('0x47')]=function(_0x3dfdb3,_0x3a69c3,_0x2ba4a5){var _0x17fe35={};var _0x58beca={};var _0x5becf1;var _0x1ba772;return db[_0x9fb9('0x25')][_0x9fb9('0x48')]({'where':{'id':_0x3dfdb3[_0x9fb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a69c3,null))['then'](function(_0x4263e8){if(_0x4263e8){_0x5becf1=_0x4263e8;_0x58beca[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db[_0x9fb9('0x42')][_0x9fb9('0x26')]);_0x58beca[_0x9fb9('0x2b')]=_['keys'](_0x3dfdb3[_0x9fb9('0x2b')]);_0x58beca[_0x9fb9('0x2c')]=_[_0x9fb9('0x2d')](_0x58beca[_0x9fb9('0x2a')],_0x58beca[_0x9fb9('0x2b')]);_0x17fe35[_0x9fb9('0x2f')]=_[_0x9fb9('0x2d')](_0x58beca[_0x9fb9('0x2a')],qs[_0x9fb9('0x2e')](_0x3dfdb3['query']['fields']));_0x17fe35['attributes']=_0x17fe35['attributes']['length']?_0x17fe35[_0x9fb9('0x2f')]:_0x58beca[_0x9fb9('0x2a')];_0x17fe35[_0x9fb9('0x34')]=qs[_0x9fb9('0x43')](_0x3dfdb3['query'][_0x9fb9('0x43')]);_0x17fe35['where']=qs['filters'](_[_0x9fb9('0x36')](_0x3dfdb3[_0x9fb9('0x2b')],_0x58beca[_0x9fb9('0x2c')]));if(_0x3dfdb3[_0x9fb9('0x2b')]['filter']){_0x17fe35[_0x9fb9('0x35')]=_['merge'](_0x17fe35[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x17fe35['attributes'],function(_0x4fd2ce){var _0x674feb={};_0x674feb[_0x4fd2ce]={'$like':'%'+_0x3dfdb3[_0x9fb9('0x2b')]['filter']+'%'};return _0x674feb;})});}_0x17fe35=_['merge']({},_0x17fe35,_0x3dfdb3[_0x9fb9('0x45')]);return _0x5becf1['getSubjects'](_0x17fe35);}})[_0x9fb9('0x1d')](function(_0x45f7cc){if(_0x45f7cc){_0x1ba772=_0x45f7cc[_0x9fb9('0x30')];if(!_0x3dfdb3['query']['hasOwnProperty'](_0x9fb9('0x32'))){_0x17fe35[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x3dfdb3[_0x9fb9('0x2b')][_0x9fb9('0x33')]);_0x17fe35[_0x9fb9('0x16')]=qs['offset'](_0x3dfdb3[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x5becf1[_0x9fb9('0x47')](_0x17fe35);}})['then'](function(_0x2e63d7){if(_0x2e63d7){return _0x2e63d7?{'count':_0x1ba772,'rows':_0x2e63d7}:null;}})[_0x9fb9('0x1d')](respondWithResult(_0x3a69c3,null))['catch'](handleError(_0x3a69c3,null));};exports[_0x9fb9('0x49')]=function(_0x3db9a4,_0x1c4dd9,_0x2e5d2a){var _0x35fca5={};var _0x390249={};var _0x1cf8d0;var _0x29934c;return db[_0x9fb9('0x25')][_0x9fb9('0x48')]({'where':{'id':_0x3db9a4['params']['id']}})['then'](handleEntityNotFound(_0x1c4dd9,null))[_0x9fb9('0x1d')](function(_0xef2dad){if(_0xef2dad){_0x1cf8d0=_0xef2dad;_0x390249[_0x9fb9('0x2a')]=_[_0x9fb9('0x3c')](db['ServicenowField'][_0x9fb9('0x26')]);_0x390249[_0x9fb9('0x2b')]=_[_0x9fb9('0x3c')](_0x3db9a4[_0x9fb9('0x2b')]);_0x390249[_0x9fb9('0x2c')]=_['intersection'](_0x390249[_0x9fb9('0x2a')],_0x390249[_0x9fb9('0x2b')]);_0x35fca5[_0x9fb9('0x2f')]=_['intersection'](_0x390249[_0x9fb9('0x2a')],qs['fields'](_0x3db9a4['query'][_0x9fb9('0x2e')]));_0x35fca5[_0x9fb9('0x2f')]=_0x35fca5[_0x9fb9('0x2f')][_0x9fb9('0x30')]?_0x35fca5['attributes']:_0x390249[_0x9fb9('0x2a')];_0x35fca5[_0x9fb9('0x34')]=qs['sort'](_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x43')]);_0x35fca5[_0x9fb9('0x35')]=qs[_0x9fb9('0x2c')](_[_0x9fb9('0x36')](_0x3db9a4[_0x9fb9('0x2b')],_0x390249[_0x9fb9('0x2c')]));if(_0x3db9a4[_0x9fb9('0x2b')]['filter']){_0x35fca5['where']=_['merge'](_0x35fca5[_0x9fb9('0x35')],{'$or':_[_0x9fb9('0x24')](_0x35fca5[_0x9fb9('0x2f')],function(_0x38bd9c){var _0x2a0542={};_0x2a0542[_0x38bd9c]={'$like':'%'+_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x44')]+'%'};return _0x2a0542;})});}_0x35fca5=_[_0x9fb9('0x37')]({},_0x35fca5,_0x3db9a4[_0x9fb9('0x45')]);return _0x1cf8d0['getDescriptions'](_0x35fca5);}})[_0x9fb9('0x1d')](function(_0x14adf7){if(_0x14adf7){_0x29934c=_0x14adf7['length'];if(!_0x3db9a4['query'][_0x9fb9('0x31')](_0x9fb9('0x32'))){_0x35fca5[_0x9fb9('0x33')]=qs[_0x9fb9('0x33')](_0x3db9a4['query']['limit']);_0x35fca5[_0x9fb9('0x16')]=qs['offset'](_0x3db9a4[_0x9fb9('0x2b')][_0x9fb9('0x16')]);}return _0x1cf8d0['getDescriptions'](_0x35fca5);}})[_0x9fb9('0x1d')](function(_0xee3578){if(_0xee3578){return _0xee3578?{'count':_0x29934c,'rows':_0xee3578}:null;}})[_0x9fb9('0x1d')](respondWithResult(_0x1c4dd9,null))[_0x9fb9('0x3e')](handleError(_0x1c4dd9,null));}; \ No newline at end of file +var _0xdac9=['../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','ServicenowConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','length','merge','find','catch','create','body','destroy','params','ServicenowField','rawAttributes','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xdac9,0x8a));var _0x9dac=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xdac9[_0xcaf223];return _0x17e00d;};'use strict';var emlformat=require(_0x9dac('0x0'));var rimraf=require(_0x9dac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dac('0x2'));var rp=require(_0x9dac('0x3'));var moment=require(_0x9dac('0x4'));var BPromise=require(_0x9dac('0x5'));var Mustache=require(_0x9dac('0x6'));var util=require(_0x9dac('0x7'));var path=require(_0x9dac('0x8'));var sox=require(_0x9dac('0x9'));var csv=require(_0x9dac('0xa'));var ejs=require(_0x9dac('0xb'));var fs=require('fs');var fs_extra=require(_0x9dac('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9dac('0xd'));var deskjs=require(_0x9dac('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9dac('0xf'));var Papa=require(_0x9dac('0x10'));var Redis=require(_0x9dac('0x11'));var authService=require(_0x9dac('0x12'));var qs=require(_0x9dac('0x13'));var as=require(_0x9dac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dac('0x15'))(_0x9dac('0x16'));var utils=require(_0x9dac('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9dac('0x18'))['db'];function respondWithStatusCode(_0x47e2ef,_0x2365f5){_0x2365f5=_0x2365f5||0xcc;return function(_0x292065){if(_0x292065){return _0x47e2ef['sendStatus'](_0x2365f5);}return _0x47e2ef[_0x9dac('0x19')](_0x2365f5)['end']();};}function respondWithResult(_0x4534d5,_0x4d86a3){_0x4d86a3=_0x4d86a3||0xc8;return function(_0x5b550a){if(_0x5b550a){return _0x4534d5[_0x9dac('0x19')](_0x4d86a3)[_0x9dac('0x1a')](_0x5b550a);}};}function respondWithFilteredResult(_0x3c7350,_0x3816f1){return function(_0x59fb66){if(_0x59fb66){var _0x18af7b=typeof _0x3816f1[_0x9dac('0x1b')]===_0x9dac('0x1c')&&typeof _0x3816f1['limit']===_0x9dac('0x1c');var _0x3eb10c=_0x59fb66['count'];var _0x5b1dd5=_0x18af7b?0x0:_0x3816f1[_0x9dac('0x1b')];var _0x5331bb=_0x18af7b?_0x59fb66[_0x9dac('0x1d')]:_0x3816f1[_0x9dac('0x1b')]+_0x3816f1[_0x9dac('0x1e')];var _0x4a5206;if(_0x5331bb>=_0x3eb10c){_0x5331bb=_0x3eb10c;_0x4a5206=0xc8;}else{_0x4a5206=0xce;}_0x3c7350['status'](_0x4a5206);return _0x3c7350[_0x9dac('0x1f')](_0x9dac('0x20'),_0x5b1dd5+'-'+_0x5331bb+'/'+_0x3eb10c)[_0x9dac('0x1a')](_0x59fb66);}return null;};}function patchUpdates(_0x46856e){return function(_0x14685d){try{jsonpatch['apply'](_0x14685d,_0x46856e,!![]);}catch(_0x311d38){return BPromise['reject'](_0x311d38);}return _0x14685d['save']();};}function saveUpdates(_0x5e7216,_0x3ee340){return function(_0x16d127){if(_0x16d127){return _0x16d127[_0x9dac('0x21')](_0x5e7216)[_0x9dac('0x22')](function(_0x2aebf2){return _0x2aebf2;});}return null;};}function removeEntity(_0x5e823b,_0x278043){return function(_0x4b3b28){if(_0x4b3b28){return _0x4b3b28['destroy']()[_0x9dac('0x22')](function(){_0x5e823b[_0x9dac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45630d,_0x2087af){return function(_0x5f0422){if(!_0x5f0422){_0x45630d[_0x9dac('0x23')](0x194);}return _0x5f0422;};}function handleError(_0x5c647a,_0x1d0d00){_0x1d0d00=_0x1d0d00||0x1f4;return function(_0xc8c29c){logger[_0x9dac('0x24')](_0xc8c29c[_0x9dac('0x25')]);if(_0xc8c29c['name']){delete _0xc8c29c[_0x9dac('0x26')];}_0x5c647a['status'](_0x1d0d00)[_0x9dac('0x27')](_0xc8c29c);};}exports[_0x9dac('0x28')]=function(_0x20f503,_0x5cfe25){var _0x5be7a6={},_0x2c7894={},_0x27daaa={'count':0x0,'rows':[]};var _0xd3f7fd=_['map'](db[_0x9dac('0x29')]['rawAttributes'],function(_0x514c4b){return{'name':_0x514c4b[_0x9dac('0x2a')],'type':_0x514c4b[_0x9dac('0x2b')][_0x9dac('0x2c')]};});_0x2c7894[_0x9dac('0x2d')]=_[_0x9dac('0x2e')](_0xd3f7fd,_0x9dac('0x26'));_0x2c7894[_0x9dac('0x2f')]=_['keys'](_0x20f503[_0x9dac('0x2f')]);_0x2c7894[_0x9dac('0x30')]=_[_0x9dac('0x31')](_0x2c7894[_0x9dac('0x2d')],_0x2c7894[_0x9dac('0x2f')]);_0x5be7a6[_0x9dac('0x32')]=_['intersection'](_0x2c7894['model'],qs[_0x9dac('0x33')](_0x20f503[_0x9dac('0x2f')][_0x9dac('0x33')]));_0x5be7a6[_0x9dac('0x32')]=_0x5be7a6[_0x9dac('0x32')]['length']?_0x5be7a6[_0x9dac('0x32')]:_0x2c7894[_0x9dac('0x2d')];if(!_0x20f503[_0x9dac('0x2f')]['hasOwnProperty'](_0x9dac('0x34'))){_0x5be7a6[_0x9dac('0x1e')]=qs[_0x9dac('0x1e')](_0x20f503[_0x9dac('0x2f')]['limit']);_0x5be7a6['offset']=qs[_0x9dac('0x1b')](_0x20f503['query']['offset']);}_0x5be7a6[_0x9dac('0x35')]=qs[_0x9dac('0x36')](_0x20f503['query']['sort']);_0x5be7a6['where']=qs[_0x9dac('0x30')](_[_0x9dac('0x37')](_0x20f503[_0x9dac('0x2f')],_0x2c7894[_0x9dac('0x30')]),_0xd3f7fd);if(_0x20f503['query'][_0x9dac('0x38')]){_0x5be7a6['where']=_['merge'](_0x5be7a6[_0x9dac('0x39')],{'$or':_[_0x9dac('0x2e')](_0xd3f7fd,function(_0x4f7d82){if(_0x4f7d82['type']!==_0x9dac('0x3a')){var _0x52dfad={};_0x52dfad[_0x4f7d82[_0x9dac('0x26')]]={'$like':'%'+_0x20f503[_0x9dac('0x2f')][_0x9dac('0x38')]+'%'};return _0x52dfad;}})});}_0x5be7a6=_['merge']({},_0x5be7a6,_0x20f503[_0x9dac('0x3b')]);var _0x30f6b4={'where':_0x5be7a6[_0x9dac('0x39')]};return db['ServicenowConfiguration'][_0x9dac('0x1d')](_0x30f6b4)['then'](function(_0x24fa24){_0x27daaa['count']=_0x24fa24;if(_0x20f503[_0x9dac('0x2f')][_0x9dac('0x3c')]){_0x5be7a6[_0x9dac('0x3d')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x9dac('0x3e')](_0x5be7a6);})[_0x9dac('0x22')](function(_0xe15c5d){_0x27daaa[_0x9dac('0x3f')]=_0xe15c5d;return _0x27daaa;})[_0x9dac('0x22')](respondWithFilteredResult(_0x5cfe25,_0x5be7a6))['catch'](handleError(_0x5cfe25,null));};exports[_0x9dac('0x40')]=function(_0x4afe66,_0x12b861){var _0xde71f2={'raw':![],'where':{'id':_0x4afe66['params']['id']}},_0x634249={};_0x634249['model']=_[_0x9dac('0x41')](db[_0x9dac('0x29')]['rawAttributes']);_0x634249[_0x9dac('0x2f')]=_[_0x9dac('0x41')](_0x4afe66[_0x9dac('0x2f')]);_0x634249[_0x9dac('0x30')]=_[_0x9dac('0x31')](_0x634249['model'],_0x634249['query']);_0xde71f2[_0x9dac('0x32')]=_['intersection'](_0x634249['model'],qs[_0x9dac('0x33')](_0x4afe66[_0x9dac('0x2f')]['fields']));_0xde71f2[_0x9dac('0x32')]=_0xde71f2[_0x9dac('0x32')][_0x9dac('0x42')]?_0xde71f2[_0x9dac('0x32')]:_0x634249[_0x9dac('0x2d')];if(_0x4afe66[_0x9dac('0x2f')][_0x9dac('0x3c')]){_0xde71f2['include']=[{'all':!![]}];}_0xde71f2=_[_0x9dac('0x43')]({},_0xde71f2,_0x4afe66[_0x9dac('0x3b')]);return db[_0x9dac('0x29')][_0x9dac('0x44')](_0xde71f2)[_0x9dac('0x22')](handleEntityNotFound(_0x12b861,null))[_0x9dac('0x22')](respondWithResult(_0x12b861,null))[_0x9dac('0x45')](handleError(_0x12b861,null));};exports['create']=function(_0x50430d,_0x16ed31){return db[_0x9dac('0x29')][_0x9dac('0x46')](_0x50430d[_0x9dac('0x47')],{})[_0x9dac('0x22')](respondWithResult(_0x16ed31,0xc9))[_0x9dac('0x45')](handleError(_0x16ed31,null));};exports[_0x9dac('0x21')]=function(_0x408a66,_0x27cb26){if(_0x408a66[_0x9dac('0x47')]['id']){delete _0x408a66[_0x9dac('0x47')]['id'];}return db['ServicenowConfiguration'][_0x9dac('0x44')]({'where':{'id':_0x408a66['params']['id']}})[_0x9dac('0x22')](handleEntityNotFound(_0x27cb26,null))['then'](saveUpdates(_0x408a66[_0x9dac('0x47')],null))[_0x9dac('0x22')](respondWithResult(_0x27cb26,null))[_0x9dac('0x45')](handleError(_0x27cb26,null));};exports[_0x9dac('0x48')]=function(_0x35ad39,_0x1a65b4){return db['ServicenowConfiguration']['find']({'where':{'id':_0x35ad39[_0x9dac('0x49')]['id']}})[_0x9dac('0x22')](handleEntityNotFound(_0x1a65b4,null))['then'](removeEntity(_0x1a65b4,null))[_0x9dac('0x45')](handleError(_0x1a65b4,null));};exports['getFields']=function(_0x4e5713,_0x57b02d,_0x2f551f){var _0x4a9f9f={};var _0x87b7e7={};var _0x1934a0;var _0x201183;return db[_0x9dac('0x29')]['findOne']({'where':{'id':_0x4e5713[_0x9dac('0x49')]['id']}})['then'](handleEntityNotFound(_0x57b02d,null))['then'](function(_0x36a508){if(_0x36a508){_0x1934a0=_0x36a508;_0x87b7e7[_0x9dac('0x2d')]=_[_0x9dac('0x41')](db[_0x9dac('0x4a')][_0x9dac('0x4b')]);_0x87b7e7['query']=_[_0x9dac('0x41')](_0x4e5713[_0x9dac('0x2f')]);_0x87b7e7[_0x9dac('0x30')]=_[_0x9dac('0x31')](_0x87b7e7[_0x9dac('0x2d')],_0x87b7e7[_0x9dac('0x2f')]);_0x4a9f9f['attributes']=_[_0x9dac('0x31')](_0x87b7e7['model'],qs[_0x9dac('0x33')](_0x4e5713[_0x9dac('0x2f')][_0x9dac('0x33')]));_0x4a9f9f[_0x9dac('0x32')]=_0x4a9f9f['attributes'][_0x9dac('0x42')]?_0x4a9f9f[_0x9dac('0x32')]:_0x87b7e7['model'];_0x4a9f9f[_0x9dac('0x35')]=qs[_0x9dac('0x36')](_0x4e5713[_0x9dac('0x2f')]['sort']);_0x4a9f9f[_0x9dac('0x39')]=qs[_0x9dac('0x30')](_['pick'](_0x4e5713[_0x9dac('0x2f')],_0x87b7e7['filters']));if(_0x4e5713[_0x9dac('0x2f')][_0x9dac('0x38')]){_0x4a9f9f['where']=_[_0x9dac('0x43')](_0x4a9f9f[_0x9dac('0x39')],{'$or':_[_0x9dac('0x2e')](_0x4a9f9f[_0x9dac('0x32')],function(_0x51c3b1){var _0x293745={};_0x293745[_0x51c3b1]={'$like':'%'+_0x4e5713[_0x9dac('0x2f')][_0x9dac('0x38')]+'%'};return _0x293745;})});}_0x4a9f9f=_['merge']({},_0x4a9f9f,_0x4e5713[_0x9dac('0x3b')]);return _0x1934a0[_0x9dac('0x4c')](_0x4a9f9f);}})[_0x9dac('0x22')](function(_0x4bd842){if(_0x4bd842){_0x201183=_0x4bd842[_0x9dac('0x42')];if(!_0x4e5713[_0x9dac('0x2f')][_0x9dac('0x4d')]('nolimit')){_0x4a9f9f['limit']=qs[_0x9dac('0x1e')](_0x4e5713[_0x9dac('0x2f')][_0x9dac('0x1e')]);_0x4a9f9f[_0x9dac('0x1b')]=qs['offset'](_0x4e5713['query'][_0x9dac('0x1b')]);}return _0x1934a0[_0x9dac('0x4c')](_0x4a9f9f);}})[_0x9dac('0x22')](function(_0x6680fa){if(_0x6680fa){return _0x6680fa?{'count':_0x201183,'rows':_0x6680fa}:null;}})[_0x9dac('0x22')](respondWithResult(_0x57b02d,null))['catch'](handleError(_0x57b02d,null));};exports[_0x9dac('0x4e')]=function(_0x1bec2e,_0x722f1e,_0x1ff002){var _0x27b552={};var _0x1f9bba={};var _0x4ebb91;var _0x298039;return db[_0x9dac('0x29')][_0x9dac('0x4f')]({'where':{'id':_0x1bec2e[_0x9dac('0x49')]['id']}})[_0x9dac('0x22')](handleEntityNotFound(_0x722f1e,null))[_0x9dac('0x22')](function(_0x4a4255){if(_0x4a4255){_0x4ebb91=_0x4a4255;_0x1f9bba['model']=_['keys'](db[_0x9dac('0x4a')]['rawAttributes']);_0x1f9bba[_0x9dac('0x2f')]=_[_0x9dac('0x41')](_0x1bec2e[_0x9dac('0x2f')]);_0x1f9bba[_0x9dac('0x30')]=_[_0x9dac('0x31')](_0x1f9bba[_0x9dac('0x2d')],_0x1f9bba[_0x9dac('0x2f')]);_0x27b552[_0x9dac('0x32')]=_['intersection'](_0x1f9bba[_0x9dac('0x2d')],qs[_0x9dac('0x33')](_0x1bec2e[_0x9dac('0x2f')][_0x9dac('0x33')]));_0x27b552[_0x9dac('0x32')]=_0x27b552[_0x9dac('0x32')]['length']?_0x27b552[_0x9dac('0x32')]:_0x1f9bba[_0x9dac('0x2d')];_0x27b552[_0x9dac('0x35')]=qs['sort'](_0x1bec2e[_0x9dac('0x2f')][_0x9dac('0x36')]);_0x27b552['where']=qs[_0x9dac('0x30')](_[_0x9dac('0x37')](_0x1bec2e['query'],_0x1f9bba[_0x9dac('0x30')]));if(_0x1bec2e[_0x9dac('0x2f')][_0x9dac('0x38')]){_0x27b552[_0x9dac('0x39')]=_[_0x9dac('0x43')](_0x27b552[_0x9dac('0x39')],{'$or':_[_0x9dac('0x2e')](_0x27b552[_0x9dac('0x32')],function(_0x27f6b3){var _0x58baba={};_0x58baba[_0x27f6b3]={'$like':'%'+_0x1bec2e[_0x9dac('0x2f')][_0x9dac('0x38')]+'%'};return _0x58baba;})});}_0x27b552=_['merge']({},_0x27b552,_0x1bec2e[_0x9dac('0x3b')]);return _0x4ebb91['getSubjects'](_0x27b552);}})[_0x9dac('0x22')](function(_0x1812c3){if(_0x1812c3){_0x298039=_0x1812c3['length'];if(!_0x1bec2e['query'][_0x9dac('0x4d')](_0x9dac('0x34'))){_0x27b552['limit']=qs['limit'](_0x1bec2e[_0x9dac('0x2f')][_0x9dac('0x1e')]);_0x27b552['offset']=qs[_0x9dac('0x1b')](_0x1bec2e['query'][_0x9dac('0x1b')]);}return _0x4ebb91['getSubjects'](_0x27b552);}})[_0x9dac('0x22')](function(_0x43a3c3){if(_0x43a3c3){return _0x43a3c3?{'count':_0x298039,'rows':_0x43a3c3}:null;}})[_0x9dac('0x22')](respondWithResult(_0x722f1e,null))[_0x9dac('0x45')](handleError(_0x722f1e,null));};exports[_0x9dac('0x50')]=function(_0x131797,_0x431379,_0x2cfcb2){var _0x29b68a={};var _0x22fdd4={};var _0x238f05;var _0xdcb2fc;return db[_0x9dac('0x29')][_0x9dac('0x4f')]({'where':{'id':_0x131797['params']['id']}})[_0x9dac('0x22')](handleEntityNotFound(_0x431379,null))['then'](function(_0x271c85){if(_0x271c85){_0x238f05=_0x271c85;_0x22fdd4['model']=_[_0x9dac('0x41')](db[_0x9dac('0x4a')][_0x9dac('0x4b')]);_0x22fdd4[_0x9dac('0x2f')]=_['keys'](_0x131797[_0x9dac('0x2f')]);_0x22fdd4['filters']=_[_0x9dac('0x31')](_0x22fdd4[_0x9dac('0x2d')],_0x22fdd4[_0x9dac('0x2f')]);_0x29b68a[_0x9dac('0x32')]=_[_0x9dac('0x31')](_0x22fdd4[_0x9dac('0x2d')],qs['fields'](_0x131797[_0x9dac('0x2f')][_0x9dac('0x33')]));_0x29b68a[_0x9dac('0x32')]=_0x29b68a[_0x9dac('0x32')][_0x9dac('0x42')]?_0x29b68a[_0x9dac('0x32')]:_0x22fdd4[_0x9dac('0x2d')];_0x29b68a[_0x9dac('0x35')]=qs[_0x9dac('0x36')](_0x131797[_0x9dac('0x2f')][_0x9dac('0x36')]);_0x29b68a[_0x9dac('0x39')]=qs['filters'](_[_0x9dac('0x37')](_0x131797[_0x9dac('0x2f')],_0x22fdd4[_0x9dac('0x30')]));if(_0x131797['query'][_0x9dac('0x38')]){_0x29b68a['where']=_[_0x9dac('0x43')](_0x29b68a[_0x9dac('0x39')],{'$or':_[_0x9dac('0x2e')](_0x29b68a[_0x9dac('0x32')],function(_0x3c34dd){var _0x1b86f4={};_0x1b86f4[_0x3c34dd]={'$like':'%'+_0x131797[_0x9dac('0x2f')][_0x9dac('0x38')]+'%'};return _0x1b86f4;})});}_0x29b68a=_[_0x9dac('0x43')]({},_0x29b68a,_0x131797['options']);return _0x238f05[_0x9dac('0x50')](_0x29b68a);}})[_0x9dac('0x22')](function(_0x4af8fa){if(_0x4af8fa){_0xdcb2fc=_0x4af8fa['length'];if(!_0x131797[_0x9dac('0x2f')][_0x9dac('0x4d')](_0x9dac('0x34'))){_0x29b68a[_0x9dac('0x1e')]=qs[_0x9dac('0x1e')](_0x131797[_0x9dac('0x2f')][_0x9dac('0x1e')]);_0x29b68a[_0x9dac('0x1b')]=qs[_0x9dac('0x1b')](_0x131797[_0x9dac('0x2f')][_0x9dac('0x1b')]);}return _0x238f05[_0x9dac('0x50')](_0x29b68a);}})[_0x9dac('0x22')](function(_0x3e3d7e){if(_0x3e3d7e){return _0x3e3d7e?{'count':_0xdcb2fc,'rows':_0x3e3d7e}:null;}})[_0x9dac('0x22')](respondWithResult(_0x431379,null))[_0x9dac('0x45')](handleError(_0x431379,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 93e4076..45be70d 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 _0xa45b=['../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x2b6cd4,_0x3052c0){var _0x50784f=function(_0xdb031f){while(--_0xdb031f){_0x2b6cd4['push'](_0x2b6cd4['shift']());}};_0x50784f(++_0x3052c0);}(_0xa45b,0x199));var _0xba45=function(_0x50045c,_0x5cf17b){_0x50045c=_0x50045c-0x0;var _0x57f956=_0xa45b[_0x50045c];return _0x57f956;};'use strict';var _=require('lodash');var util=require(_0xba45('0x0'));var logger=require(_0xba45('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba45('0x2'));var fs=require('fs');var path=require(_0xba45('0x3'));var rimraf=require(_0xba45('0x4'));var config=require(_0xba45('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xba45('0x6')]=function(_0x14ee6c,_0x330e53){return _0x14ee6c[_0xba45('0x7')](_0xba45('0x8'),attributes,{'tableName':_0xba45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc893=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','bluebird','request-promise'];(function(_0xcf6618,_0x5722cf){var _0x78f9bf=function(_0x4f3493){while(--_0x4f3493){_0xcf6618['push'](_0xcf6618['shift']());}};_0x78f9bf(++_0x5722cf);}(_0xc893,0x194));var _0x3c89=function(_0x1f3ba1,_0x5a4111){_0x1f3ba1=_0x1f3ba1-0x0;var _0x212263=_0xc893[_0x1f3ba1];return _0x212263;};'use strict';var _=require('lodash');var util=require(_0x3c89('0x0'));var logger=require(_0x3c89('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3c89('0x2'));var rp=require(_0x3c89('0x3'));var fs=require('fs');var path=require(_0x3c89('0x4'));var rimraf=require(_0x3c89('0x5'));var config=require(_0x3c89('0x6'));var attributes=require(_0x3c89('0x7'));module[_0x3c89('0x8')]=function(_0x5f2803,_0x2e156d){return _0x5f2803[_0x3c89('0x9')](_0x3c89('0xa'),attributes,{'tableName':_0x3c89('0xb'),'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 90e3ec6..b703c7a 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 _0x855e=['rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xc78d91,_0x56f506){var _0xe3c019=function(_0x1cc61e){while(--_0x1cc61e){_0xc78d91['push'](_0xc78d91['shift']());}};_0xe3c019(++_0x56f506);}(_0x855e,0x1f2));var _0xe855=function(_0x28e24b,_0x3a39a1){_0x28e24b=_0x28e24b-0x0;var _0x408dc7=_0x855e[_0x28e24b];return _0x408dc7;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var moment=require(_0xe855('0x2'));var BPromise=require(_0xe855('0x3'));var rs=require(_0xe855('0x4'));var fs=require('fs');var Redis=require(_0xe855('0x5'));var db=require(_0xe855('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe855('0x7'))(_0xe855('0x8'));var config=require('../../config/environment');var jayson=require(_0xe855('0x9'));var client=jayson[_0xe855('0xa')][_0xe855('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12e649,_0x3a4782,_0x259097){return new BPromise(function(_0x23cfb3,_0x3f1437){return client[_0xe855('0xc')](_0x12e649,_0x259097)[_0xe855('0xd')](function(_0x481620){logger[_0xe855('0xe')](_0xe855('0xf'),_0x3a4782,_0xe855('0x10'));logger[_0xe855('0x11')](_0xe855('0x12'),_0x3a4782,_0xe855('0x10'),JSON['stringify'](_0x481620));if(_0x481620[_0xe855('0x13')]){if(_0x481620[_0xe855('0x13')][_0xe855('0x14')]===0x1f4){logger[_0xe855('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,_0x481620[_0xe855('0x13')][_0xe855('0x15')]);return _0x3f1437(_0x481620['error'][_0xe855('0x15')]);}logger[_0xe855('0x13')](_0xe855('0xf'),_0x3a4782,_0x481620['error'][_0xe855('0x15')]);return _0x23cfb3(_0x481620['error'][_0xe855('0x15')]);}else{logger[_0xe855('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,'request\x20sent');_0x23cfb3(_0x481620[_0xe855('0x16')][_0xe855('0x15')]);}})['catch'](function(_0x7522be){logger[_0xe855('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a4782,_0x7522be);_0x3f1437(_0x7522be);});});} \ No newline at end of file +var _0x1317=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x42c023,_0x4f7f2f){var _0x2ae550=function(_0x429a13){while(--_0x429a13){_0x42c023['push'](_0x42c023['shift']());}};_0x2ae550(++_0x4f7f2f);}(_0x1317,0x1bb));var _0x7131=function(_0xafc1b8,_0x17f191){_0xafc1b8=_0xafc1b8-0x0;var _0x1b5a22=_0x1317[_0xafc1b8];return _0x1b5a22;};'use strict';var _=require(_0x7131('0x0'));var util=require(_0x7131('0x1'));var moment=require(_0x7131('0x2'));var BPromise=require(_0x7131('0x3'));var rs=require(_0x7131('0x4'));var fs=require('fs');var Redis=require(_0x7131('0x5'));var db=require(_0x7131('0x6'))['db'];var utils=require(_0x7131('0x7'));var logger=require('../../config/logger')(_0x7131('0x8'));var config=require(_0x7131('0x9'));var jayson=require(_0x7131('0xa'));var client=jayson['client'][_0x7131('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f7598,_0x36d168,_0x59ab64){return new BPromise(function(_0x581585,_0x5aaf09){return client['request'](_0x2f7598,_0x59ab64)[_0x7131('0xc')](function(_0x119e68){logger[_0x7131('0xd')](_0x7131('0xe'),_0x36d168,_0x7131('0xf'));logger[_0x7131('0x10')](_0x7131('0x11'),_0x36d168,'request\x20sent',JSON[_0x7131('0x12')](_0x119e68));if(_0x119e68['error']){if(_0x119e68['error'][_0x7131('0x13')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x36d168,_0x119e68[_0x7131('0x14')][_0x7131('0x15')]);return _0x5aaf09(_0x119e68[_0x7131('0x14')]['message']);}logger[_0x7131('0x14')](_0x7131('0xe'),_0x36d168,_0x119e68[_0x7131('0x14')][_0x7131('0x15')]);return _0x581585(_0x119e68[_0x7131('0x14')]['message']);}else{logger[_0x7131('0xd')](_0x7131('0xe'),_0x36d168,_0x7131('0xf'));_0x581585(_0x119e68[_0x7131('0x16')][_0x7131('0x15')]);}})[_0x7131('0x17')](function(_0x3a2b18){logger[_0x7131('0x14')](_0x7131('0xe'),_0x36d168,_0x3a2b18);_0x5aaf09(_0x3a2b18);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4d570dd..963b65b 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 _0x02fc=['delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','post','/:id'];(function(_0x3055a3,_0x5b79a6){var _0x3801ac=function(_0x2ce9fd){while(--_0x2ce9fd){_0x3055a3['push'](_0x3055a3['shift']());}};_0x3801ac(++_0x5b79a6);}(_0x02fc,0x6a));var _0xc02f=function(_0xf36f8f,_0x1f32bd){_0xf36f8f=_0xf36f8f-0x0;var _0x35c2c7=_0x02fc[_0xf36f8f];return _0x35c2c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc02f('0x0'));var timeout=require(_0xc02f('0x1'));var express=require(_0xc02f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc02f('0x3'));var interaction=require(_0xc02f('0x4'));var config=require(_0xc02f('0x5'));var controller=require(_0xc02f('0x6'));router[_0xc02f('0x7')]('/',auth[_0xc02f('0x8')](),controller['index']);router[_0xc02f('0x7')]('/:id',auth[_0xc02f('0x8')](),controller['show']);router[_0xc02f('0x9')]('/',auth[_0xc02f('0x8')](),controller['create']);router['put'](_0xc02f('0xa'),auth[_0xc02f('0x8')](),controller['update']);router[_0xc02f('0xb')](_0xc02f('0xa'),auth[_0xc02f('0x8')](),controller[_0xc02f('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd231=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express'];(function(_0x1a84fd,_0x4a2058){var _0x5cd113=function(_0x14220b){while(--_0x14220b){_0x1a84fd['push'](_0x1a84fd['shift']());}};_0x5cd113(++_0x4a2058);}(_0xd231,0x153));var _0x1d23=function(_0x3973da,_0x3e8345){_0x3973da=_0x3973da-0x0;var _0x455279=_0xd231[_0x3973da];return _0x455279;};'use strict';var multer=require('multer');var util=require(_0x1d23('0x0'));var path=require('path');var timeout=require(_0x1d23('0x1'));var express=require(_0x1d23('0x2'));var router=express[_0x1d23('0x3')]();var fs_extra=require(_0x1d23('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1d23('0x5'));var config=require(_0x1d23('0x6'));var controller=require(_0x1d23('0x7'));router[_0x1d23('0x8')]('/',auth[_0x1d23('0x9')](),controller[_0x1d23('0xa')]);router['get'](_0x1d23('0xb'),auth[_0x1d23('0x9')](),controller[_0x1d23('0xc')]);router[_0x1d23('0xd')]('/',auth[_0x1d23('0x9')](),controller[_0x1d23('0xe')]);router[_0x1d23('0xf')](_0x1d23('0xb'),auth['isAuthenticated'](),controller[_0x1d23('0x10')]);router['delete'](_0x1d23('0xb'),auth[_0x1d23('0x9')](),controller[_0x1d23('0x11')]);module[_0x1d23('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a0a2d5b..04bd7ca 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 _0x339f=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x41ccbb,_0x3771e8){var _0x519c61=function(_0x4724a6){while(--_0x4724a6){_0x41ccbb['push'](_0x41ccbb['shift']());}};_0x519c61(++_0x3771e8);}(_0x339f,0x176));var _0xf339=function(_0x5549a5,_0x135bf1){_0x5549a5=_0x5549a5-0x0;var _0x3efdd3=_0x339f[_0x5549a5];return _0x3efdd3;};'use strict';var Sequelize=require(_0xf339('0x0'));module[_0xf339('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf339('0x2'),_0xf339('0x3'),_0xf339('0x4'),_0xf339('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf339('0x6')]},'key':{'type':Sequelize[_0xf339('0x6')]},'keyType':{'type':Sequelize[_0xf339('0x7')]('string',_0xf339('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf339('0x6')]},'nameField':{'type':Sequelize[_0xf339('0x6')]},'customField':{'type':Sequelize[_0xf339('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf339('0x6')]}}; \ No newline at end of file +var _0x0b00=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x8396b7,_0x3a8e5c){var _0x50ddf6=function(_0x38e075){while(--_0x38e075){_0x8396b7['push'](_0x8396b7['shift']());}};_0x50ddf6(++_0x3a8e5c);}(_0x0b00,0xf8));var _0x00b0=function(_0x97f874,_0x584114){_0x97f874=_0x97f874-0x0;var _0x10a04e=_0x0b00[_0x97f874];return _0x10a04e;};'use strict';var Sequelize=require(_0x00b0('0x0'));module['exports']={'type':{'type':Sequelize[_0x00b0('0x1')](_0x00b0('0x2'),_0x00b0('0x3'),'customVariable',_0x00b0('0x4'),_0x00b0('0x5')),'defaultValue':_0x00b0('0x2')},'content':{'type':Sequelize[_0x00b0('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x00b0('0x1')](_0x00b0('0x2'),'variable',_0x00b0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00b0('0x6')]},'customField':{'type':Sequelize[_0x00b0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3afb7e8..425bc18 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 _0xa457=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','findAll','catch','show','params','length','find','create','body','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa457,0x1b1));var _0x7a45=function(_0x2ede8d,_0x584c77){_0x2ede8d=_0x2ede8d-0x0;var _0x291827=_0xa457[_0x2ede8d];return _0x291827;};'use strict';var emlformat=require(_0x7a45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a45('0x1'));var jsonpatch=require(_0x7a45('0x2'));var rp=require(_0x7a45('0x3'));var moment=require(_0x7a45('0x4'));var BPromise=require(_0x7a45('0x5'));var Mustache=require(_0x7a45('0x6'));var util=require('util');var path=require(_0x7a45('0x7'));var sox=require(_0x7a45('0x8'));var csv=require(_0x7a45('0x9'));var ejs=require(_0x7a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a45('0xb'));var squel=require(_0x7a45('0xc'));var crypto=require(_0x7a45('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a45('0xe'));var toCsv=require(_0x7a45('0x9'));var querystring=require(_0x7a45('0xf'));var Papa=require(_0x7a45('0x10'));var Redis=require(_0x7a45('0x11'));var authService=require(_0x7a45('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a45('0x13'));var hardwareService=require(_0x7a45('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7a45('0x15'));var config=require(_0x7a45('0x16'));var licenseUtil=require(_0x7a45('0x17'));var db=require(_0x7a45('0x18'))['db'];function respondWithStatusCode(_0x4eea4e,_0x5867d9){_0x5867d9=_0x5867d9||0xcc;return function(_0x59974a){if(_0x59974a){return _0x4eea4e[_0x7a45('0x19')](_0x5867d9);}return _0x4eea4e[_0x7a45('0x1a')](_0x5867d9)[_0x7a45('0x1b')]();};}function respondWithResult(_0x2f948f,_0x516ef3){_0x516ef3=_0x516ef3||0xc8;return function(_0x595967){if(_0x595967){return _0x2f948f['status'](_0x516ef3)[_0x7a45('0x1c')](_0x595967);}};}function respondWithFilteredResult(_0x1a20fd,_0x2cd724){return function(_0x20b63a){if(_0x20b63a){var _0x4f05a0=typeof _0x2cd724[_0x7a45('0x1d')]===_0x7a45('0x1e')&&typeof _0x2cd724[_0x7a45('0x1f')]===_0x7a45('0x1e');var _0x1dcff9=_0x20b63a['count'];var _0x1416ac=_0x4f05a0?0x0:_0x2cd724[_0x7a45('0x1d')];var _0x26e430=_0x4f05a0?_0x20b63a[_0x7a45('0x20')]:_0x2cd724[_0x7a45('0x1d')]+_0x2cd724[_0x7a45('0x1f')];var _0x2aaa9d;if(_0x26e430>=_0x1dcff9){_0x26e430=_0x1dcff9;_0x2aaa9d=0xc8;}else{_0x2aaa9d=0xce;}_0x1a20fd[_0x7a45('0x1a')](_0x2aaa9d);return _0x1a20fd[_0x7a45('0x21')]('Content-Range',_0x1416ac+'-'+_0x26e430+'/'+_0x1dcff9)['json'](_0x20b63a);}return null;};}function patchUpdates(_0x149b65){return function(_0x2a8545){try{jsonpatch[_0x7a45('0x22')](_0x2a8545,_0x149b65,!![]);}catch(_0x474fd7){return BPromise[_0x7a45('0x23')](_0x474fd7);}return _0x2a8545[_0x7a45('0x24')]();};}function saveUpdates(_0x51f120,_0x4a65ff){return function(_0x338b8e){if(_0x338b8e){return _0x338b8e[_0x7a45('0x25')](_0x51f120)['then'](function(_0x1fa8a1){return _0x1fa8a1;});}return null;};}function removeEntity(_0x354959,_0x4294a4){return function(_0x448d93){if(_0x448d93){return _0x448d93[_0x7a45('0x26')]()[_0x7a45('0x27')](function(){_0x354959[_0x7a45('0x1a')](0xcc)[_0x7a45('0x1b')]();});}};}function handleEntityNotFound(_0x2401f7,_0x19a1df){return function(_0x11862a){if(!_0x11862a){_0x2401f7[_0x7a45('0x19')](0x194);}return _0x11862a;};}function handleError(_0x30bb5a,_0x4964cf){_0x4964cf=_0x4964cf||0x1f4;return function(_0x181228){logger[_0x7a45('0x28')](_0x181228[_0x7a45('0x29')]);if(_0x181228[_0x7a45('0x2a')]){delete _0x181228[_0x7a45('0x2a')];}_0x30bb5a[_0x7a45('0x1a')](_0x4964cf)[_0x7a45('0x2b')](_0x181228);};}exports[_0x7a45('0x2c')]=function(_0x213215,_0x2f23f1){var _0x50f904={},_0x41b137={},_0x5478f7={'count':0x0,'rows':[]};var _0x6ef67a=_[_0x7a45('0x2d')](db['ServicenowField'][_0x7a45('0x2e')],function(_0x30faba){return{'name':_0x30faba[_0x7a45('0x2f')],'type':_0x30faba[_0x7a45('0x30')]['key']};});_0x41b137[_0x7a45('0x31')]=_['map'](_0x6ef67a,_0x7a45('0x2a'));_0x41b137[_0x7a45('0x32')]=_[_0x7a45('0x33')](_0x213215[_0x7a45('0x32')]);_0x41b137[_0x7a45('0x34')]=_[_0x7a45('0x35')](_0x41b137[_0x7a45('0x31')],_0x41b137[_0x7a45('0x32')]);_0x50f904[_0x7a45('0x36')]=_[_0x7a45('0x35')](_0x41b137[_0x7a45('0x31')],qs[_0x7a45('0x37')](_0x213215[_0x7a45('0x32')][_0x7a45('0x37')]));_0x50f904[_0x7a45('0x36')]=_0x50f904[_0x7a45('0x36')]['length']?_0x50f904['attributes']:_0x41b137[_0x7a45('0x31')];if(!_0x213215[_0x7a45('0x32')][_0x7a45('0x38')](_0x7a45('0x39'))){_0x50f904['limit']=qs[_0x7a45('0x1f')](_0x213215['query'][_0x7a45('0x1f')]);_0x50f904[_0x7a45('0x1d')]=qs['offset'](_0x213215['query'][_0x7a45('0x1d')]);}_0x50f904[_0x7a45('0x3a')]=qs[_0x7a45('0x3b')](_0x213215[_0x7a45('0x32')][_0x7a45('0x3b')]);_0x50f904[_0x7a45('0x3c')]=qs['filters'](_['pick'](_0x213215[_0x7a45('0x32')],_0x41b137[_0x7a45('0x34')]),_0x6ef67a);if(_0x213215['query'][_0x7a45('0x3d')]){_0x50f904[_0x7a45('0x3c')]=_[_0x7a45('0x3e')](_0x50f904[_0x7a45('0x3c')],{'$or':_[_0x7a45('0x2d')](_0x6ef67a,function(_0x1efd3e){if(_0x1efd3e[_0x7a45('0x30')]!==_0x7a45('0x3f')){var _0x32e7cb={};_0x32e7cb[_0x1efd3e[_0x7a45('0x2a')]]={'$like':'%'+_0x213215[_0x7a45('0x32')][_0x7a45('0x3d')]+'%'};return _0x32e7cb;}})});}_0x50f904=_[_0x7a45('0x3e')]({},_0x50f904,_0x213215[_0x7a45('0x40')]);var _0x5b2b35={'where':_0x50f904[_0x7a45('0x3c')]};return db['ServicenowField'][_0x7a45('0x20')](_0x5b2b35)[_0x7a45('0x27')](function(_0x309d2e){_0x5478f7[_0x7a45('0x20')]=_0x309d2e;if(_0x213215[_0x7a45('0x32')][_0x7a45('0x41')]){_0x50f904[_0x7a45('0x42')]=[{'all':!![]}];}return db[_0x7a45('0x43')][_0x7a45('0x44')](_0x50f904);})['then'](function(_0x78d816){_0x5478f7['rows']=_0x78d816;return _0x5478f7;})['then'](respondWithFilteredResult(_0x2f23f1,_0x50f904))[_0x7a45('0x45')](handleError(_0x2f23f1,null));};exports[_0x7a45('0x46')]=function(_0x51b197,_0x2f83ed){var _0x1203af={'raw':!![],'where':{'id':_0x51b197[_0x7a45('0x47')]['id']}},_0x32111f={};_0x32111f['model']=_[_0x7a45('0x33')](db[_0x7a45('0x43')][_0x7a45('0x2e')]);_0x32111f[_0x7a45('0x32')]=_[_0x7a45('0x33')](_0x51b197[_0x7a45('0x32')]);_0x32111f['filters']=_[_0x7a45('0x35')](_0x32111f[_0x7a45('0x31')],_0x32111f[_0x7a45('0x32')]);_0x1203af[_0x7a45('0x36')]=_[_0x7a45('0x35')](_0x32111f[_0x7a45('0x31')],qs[_0x7a45('0x37')](_0x51b197[_0x7a45('0x32')][_0x7a45('0x37')]));_0x1203af[_0x7a45('0x36')]=_0x1203af['attributes'][_0x7a45('0x48')]?_0x1203af[_0x7a45('0x36')]:_0x32111f['model'];if(_0x51b197[_0x7a45('0x32')][_0x7a45('0x41')]){_0x1203af[_0x7a45('0x42')]=[{'all':!![]}];}_0x1203af=_['merge']({},_0x1203af,_0x51b197[_0x7a45('0x40')]);return db[_0x7a45('0x43')][_0x7a45('0x49')](_0x1203af)[_0x7a45('0x27')](handleEntityNotFound(_0x2f83ed,null))[_0x7a45('0x27')](respondWithResult(_0x2f83ed,null))['catch'](handleError(_0x2f83ed,null));};exports[_0x7a45('0x4a')]=function(_0x5bc505,_0x37099f){return db[_0x7a45('0x43')][_0x7a45('0x4a')](_0x5bc505[_0x7a45('0x4b')],{})[_0x7a45('0x27')](respondWithResult(_0x37099f,0xc9))[_0x7a45('0x45')](handleError(_0x37099f,null));};exports['update']=function(_0x13a4e9,_0x29ee07){if(_0x13a4e9[_0x7a45('0x4b')]['id']){delete _0x13a4e9[_0x7a45('0x4b')]['id'];}return db[_0x7a45('0x43')]['find']({'where':{'id':_0x13a4e9[_0x7a45('0x47')]['id']}})[_0x7a45('0x27')](handleEntityNotFound(_0x29ee07,null))['then'](saveUpdates(_0x13a4e9[_0x7a45('0x4b')],null))[_0x7a45('0x27')](respondWithResult(_0x29ee07,null))[_0x7a45('0x45')](handleError(_0x29ee07,null));};exports[_0x7a45('0x26')]=function(_0xf43a18,_0x3d06c8){return db[_0x7a45('0x43')][_0x7a45('0x49')]({'where':{'id':_0xf43a18[_0x7a45('0x47')]['id']}})[_0x7a45('0x27')](handleEntityNotFound(_0x3d06c8,null))[_0x7a45('0x27')](removeEntity(_0x3d06c8,null))[_0x7a45('0x45')](handleError(_0x3d06c8,null));}; \ No newline at end of file +var _0xae5c=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys'];(function(_0x5e3dd2,_0x26430e){var _0x2cab42=function(_0x5194f8){while(--_0x5194f8){_0x5e3dd2['push'](_0x5e3dd2['shift']());}};_0x2cab42(++_0x26430e);}(_0xae5c,0x180));var _0xcae5=function(_0xc8d6d,_0x2f4414){_0xc8d6d=_0xc8d6d-0x0;var _0x5efd0f=_0xae5c[_0xc8d6d];return _0x5efd0f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcae5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcae5('0x1'));var moment=require(_0xcae5('0x2'));var BPromise=require(_0xcae5('0x3'));var Mustache=require(_0xcae5('0x4'));var util=require(_0xcae5('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcae5('0x6'));var fs=require('fs');var fs_extra=require(_0xcae5('0x7'));var _=require(_0xcae5('0x8'));var squel=require(_0xcae5('0x9'));var crypto=require('crypto');var jsforce=require(_0xcae5('0xa'));var deskjs=require(_0xcae5('0xb'));var toCsv=require(_0xcae5('0xc'));var querystring=require('querystring');var Papa=require(_0xcae5('0xd'));var Redis=require(_0xcae5('0xe'));var authService=require(_0xcae5('0xf'));var qs=require(_0xcae5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcae5('0x11'));var logger=require(_0xcae5('0x12'))(_0xcae5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcae5('0x14'));var db=require(_0xcae5('0x15'))['db'];function respondWithStatusCode(_0x18402e,_0x2ab330){_0x2ab330=_0x2ab330||0xcc;return function(_0xeda465){if(_0xeda465){return _0x18402e[_0xcae5('0x16')](_0x2ab330);}return _0x18402e[_0xcae5('0x17')](_0x2ab330)[_0xcae5('0x18')]();};}function respondWithResult(_0x388a0b,_0x32ab3b){_0x32ab3b=_0x32ab3b||0xc8;return function(_0x3181df){if(_0x3181df){return _0x388a0b[_0xcae5('0x17')](_0x32ab3b)[_0xcae5('0x19')](_0x3181df);}};}function respondWithFilteredResult(_0x1d132e,_0x36bd01){return function(_0x28f908){if(_0x28f908){var _0x3bbf06=typeof _0x36bd01[_0xcae5('0x1a')]===_0xcae5('0x1b')&&typeof _0x36bd01[_0xcae5('0x1c')]==='undefined';var _0xb0cca9=_0x28f908['count'];var _0xf4e668=_0x3bbf06?0x0:_0x36bd01[_0xcae5('0x1a')];var _0x148a0d=_0x3bbf06?_0x28f908[_0xcae5('0x1d')]:_0x36bd01[_0xcae5('0x1a')]+_0x36bd01[_0xcae5('0x1c')];var _0x2550e7;if(_0x148a0d>=_0xb0cca9){_0x148a0d=_0xb0cca9;_0x2550e7=0xc8;}else{_0x2550e7=0xce;}_0x1d132e[_0xcae5('0x17')](_0x2550e7);return _0x1d132e[_0xcae5('0x1e')](_0xcae5('0x1f'),_0xf4e668+'-'+_0x148a0d+'/'+_0xb0cca9)[_0xcae5('0x19')](_0x28f908);}return null;};}function patchUpdates(_0x567218){return function(_0x4871b1){try{jsonpatch['apply'](_0x4871b1,_0x567218,!![]);}catch(_0x2414cc){return BPromise['reject'](_0x2414cc);}return _0x4871b1[_0xcae5('0x20')]();};}function saveUpdates(_0x535806,_0x117664){return function(_0x27e48f){if(_0x27e48f){return _0x27e48f[_0xcae5('0x21')](_0x535806)[_0xcae5('0x22')](function(_0x4ae9df){return _0x4ae9df;});}return null;};}function removeEntity(_0x468ae5,_0x330129){return function(_0x17d860){if(_0x17d860){return _0x17d860[_0xcae5('0x23')]()[_0xcae5('0x22')](function(){_0x468ae5[_0xcae5('0x17')](0xcc)[_0xcae5('0x18')]();});}};}function handleEntityNotFound(_0x5bb1a9,_0x4c6876){return function(_0x3a469e){if(!_0x3a469e){_0x5bb1a9[_0xcae5('0x16')](0x194);}return _0x3a469e;};}function handleError(_0x32b51a,_0x3d2ee2){_0x3d2ee2=_0x3d2ee2||0x1f4;return function(_0xbea19){logger[_0xcae5('0x24')](_0xbea19['stack']);if(_0xbea19[_0xcae5('0x25')]){delete _0xbea19[_0xcae5('0x25')];}_0x32b51a[_0xcae5('0x17')](_0x3d2ee2)[_0xcae5('0x26')](_0xbea19);};}exports[_0xcae5('0x27')]=function(_0x369075,_0x3f8941){var _0x341c45={},_0x47a14d={},_0x309c73={'count':0x0,'rows':[]};var _0xb75c1=_[_0xcae5('0x28')](db[_0xcae5('0x29')][_0xcae5('0x2a')],function(_0x5a8987){return{'name':_0x5a8987[_0xcae5('0x2b')],'type':_0x5a8987['type'][_0xcae5('0x2c')]};});_0x47a14d[_0xcae5('0x2d')]=_['map'](_0xb75c1,_0xcae5('0x25'));_0x47a14d[_0xcae5('0x2e')]=_[_0xcae5('0x2f')](_0x369075[_0xcae5('0x2e')]);_0x47a14d['filters']=_[_0xcae5('0x30')](_0x47a14d[_0xcae5('0x2d')],_0x47a14d['query']);_0x341c45[_0xcae5('0x31')]=_[_0xcae5('0x30')](_0x47a14d[_0xcae5('0x2d')],qs[_0xcae5('0x32')](_0x369075['query']['fields']));_0x341c45[_0xcae5('0x31')]=_0x341c45['attributes'][_0xcae5('0x33')]?_0x341c45[_0xcae5('0x31')]:_0x47a14d['model'];if(!_0x369075[_0xcae5('0x2e')][_0xcae5('0x34')](_0xcae5('0x35'))){_0x341c45[_0xcae5('0x1c')]=qs[_0xcae5('0x1c')](_0x369075[_0xcae5('0x2e')][_0xcae5('0x1c')]);_0x341c45[_0xcae5('0x1a')]=qs[_0xcae5('0x1a')](_0x369075[_0xcae5('0x2e')][_0xcae5('0x1a')]);}_0x341c45[_0xcae5('0x36')]=qs['sort'](_0x369075[_0xcae5('0x2e')][_0xcae5('0x37')]);_0x341c45[_0xcae5('0x38')]=qs['filters'](_[_0xcae5('0x39')](_0x369075['query'],_0x47a14d['filters']),_0xb75c1);if(_0x369075[_0xcae5('0x2e')][_0xcae5('0x3a')]){_0x341c45[_0xcae5('0x38')]=_[_0xcae5('0x3b')](_0x341c45[_0xcae5('0x38')],{'$or':_[_0xcae5('0x28')](_0xb75c1,function(_0x326f09){if(_0x326f09['type']!=='VIRTUAL'){var _0x1c064a={};_0x1c064a[_0x326f09[_0xcae5('0x25')]]={'$like':'%'+_0x369075[_0xcae5('0x2e')][_0xcae5('0x3a')]+'%'};return _0x1c064a;}})});}_0x341c45=_['merge']({},_0x341c45,_0x369075[_0xcae5('0x3c')]);var _0x410c8f={'where':_0x341c45['where']};return db['ServicenowField'][_0xcae5('0x1d')](_0x410c8f)[_0xcae5('0x22')](function(_0x4a70a2){_0x309c73[_0xcae5('0x1d')]=_0x4a70a2;if(_0x369075[_0xcae5('0x2e')][_0xcae5('0x3d')]){_0x341c45[_0xcae5('0x3e')]=[{'all':!![]}];}return db[_0xcae5('0x29')][_0xcae5('0x3f')](_0x341c45);})[_0xcae5('0x22')](function(_0x5995f8){_0x309c73[_0xcae5('0x40')]=_0x5995f8;return _0x309c73;})[_0xcae5('0x22')](respondWithFilteredResult(_0x3f8941,_0x341c45))[_0xcae5('0x41')](handleError(_0x3f8941,null));};exports[_0xcae5('0x42')]=function(_0x446ade,_0xfd0b3d){var _0x307783={'raw':!![],'where':{'id':_0x446ade[_0xcae5('0x43')]['id']}},_0x1fc3b5={};_0x1fc3b5[_0xcae5('0x2d')]=_[_0xcae5('0x2f')](db[_0xcae5('0x29')][_0xcae5('0x2a')]);_0x1fc3b5[_0xcae5('0x2e')]=_['keys'](_0x446ade['query']);_0x1fc3b5[_0xcae5('0x44')]=_['intersection'](_0x1fc3b5['model'],_0x1fc3b5[_0xcae5('0x2e')]);_0x307783['attributes']=_[_0xcae5('0x30')](_0x1fc3b5[_0xcae5('0x2d')],qs[_0xcae5('0x32')](_0x446ade[_0xcae5('0x2e')][_0xcae5('0x32')]));_0x307783[_0xcae5('0x31')]=_0x307783[_0xcae5('0x31')][_0xcae5('0x33')]?_0x307783[_0xcae5('0x31')]:_0x1fc3b5['model'];if(_0x446ade[_0xcae5('0x2e')]['includeAll']){_0x307783[_0xcae5('0x3e')]=[{'all':!![]}];}_0x307783=_[_0xcae5('0x3b')]({},_0x307783,_0x446ade['options']);return db[_0xcae5('0x29')][_0xcae5('0x45')](_0x307783)[_0xcae5('0x22')](handleEntityNotFound(_0xfd0b3d,null))[_0xcae5('0x22')](respondWithResult(_0xfd0b3d,null))[_0xcae5('0x41')](handleError(_0xfd0b3d,null));};exports[_0xcae5('0x46')]=function(_0x41d556,_0x381996){return db['ServicenowField']['create'](_0x41d556[_0xcae5('0x47')],{})[_0xcae5('0x22')](respondWithResult(_0x381996,0xc9))['catch'](handleError(_0x381996,null));};exports[_0xcae5('0x21')]=function(_0xba17ff,_0xee7207){if(_0xba17ff[_0xcae5('0x47')]['id']){delete _0xba17ff[_0xcae5('0x47')]['id'];}return db[_0xcae5('0x29')]['find']({'where':{'id':_0xba17ff['params']['id']}})[_0xcae5('0x22')](handleEntityNotFound(_0xee7207,null))[_0xcae5('0x22')](saveUpdates(_0xba17ff[_0xcae5('0x47')],null))['then'](respondWithResult(_0xee7207,null))['catch'](handleError(_0xee7207,null));};exports[_0xcae5('0x23')]=function(_0x3d22b4,_0x5268c5){return db['ServicenowField'][_0xcae5('0x45')]({'where':{'id':_0x3d22b4[_0xcae5('0x43')]['id']}})['then'](handleEntityNotFound(_0x5268c5,null))['then'](removeEntity(_0x5268c5,null))['catch'](handleError(_0x5268c5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c2f045f..f171d94 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 _0xd8bc=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x1ef5ff,_0x175709){var _0x17041e=function(_0x3547a7){while(--_0x3547a7){_0x1ef5ff['push'](_0x1ef5ff['shift']());}};_0x17041e(++_0x175709);}(_0xd8bc,0x186));var _0xcd8b=function(_0xed83f9,_0x27350b){_0xed83f9=_0xed83f9-0x0;var _0x5b599c=_0xd8bc[_0xed83f9];return _0x5b599c;};'use strict';var _=require(_0xcd8b('0x0'));var util=require(_0xcd8b('0x1'));var logger=require(_0xcd8b('0x2'))(_0xcd8b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd8b('0x4'));var rimraf=require(_0xcd8b('0x5'));var config=require(_0xcd8b('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xcd8b('0x7')]=function(_0x23012b,_0x1243f0){return _0x23012b[_0xcd8b('0x8')](_0xcd8b('0x9'),attributes,{'tableName':_0xcd8b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xcd8b('0xb'),_0xcd8b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbec=['idField','lodash','util','moment','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x1026f6,_0x44f2db){var _0x3e131a=function(_0x5831b7){while(--_0x5831b7){_0x1026f6['push'](_0x1026f6['shift']());}};_0x3e131a(++_0x44f2db);}(_0xcbec,0x91));var _0xccbe=function(_0x3c0d42,_0xd7288f){_0x3c0d42=_0x3c0d42-0x0;var _0xf38889=_0xcbec[_0x3c0d42];return _0xf38889;};'use strict';var _=require(_0xccbe('0x0'));var util=require(_0xccbe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xccbe('0x2'));var BPromise=require('bluebird');var rp=require(_0xccbe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccbe('0x4'));var config=require(_0xccbe('0x5'));var attributes=require(_0xccbe('0x6'));module['exports']=function(_0x490486,_0x26a445){return _0x490486[_0xccbe('0x7')](_0xccbe('0x8'),attributes,{'tableName':_0xccbe('0x9'),'paranoid':![],'indexes':[{'name':_0xccbe('0xa'),'fields':[_0xccbe('0xb'),'FieldId'],'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 b1c2934..cfd17f8 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac4a,0x13f));var _0xaac4=function(_0x6551a,_0x56a406){_0x6551a=_0x6551a-0x0;var _0x13e0a5=_0xac4a[_0x6551a];return _0x13e0a5;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +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(_0x243e12,_0x2d7bc5){var _0x3fddfc=function(_0x2896ee){while(--_0x2896ee){_0x243e12['push'](_0x243e12['shift']());}};_0x3fddfc(++_0x2d7bc5);}(_0xaa88,0x137));var _0x8aa8=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xaa88[_0x4c3070];return _0x536a44;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 55d78fd..6761ec5 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(_0x234d67,_0x2f2827){var _0x4d58bd=function(_0x20a20c){while(--_0x20a20c){_0x234d67['push'](_0x234d67['shift']());}};_0x4d58bd(++_0x2f2827);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x2bd716,_0x5488ad){var _0x532794=function(_0x3f9d7f){while(--_0x3f9d7f){_0x2bd716['push'](_0x2bd716['shift']());}};_0x532794(++_0x5488ad);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 4d9f2f9..006cd20 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(_0x40fb10,_0x453676){var _0x110a3f=function(_0x413490){while(--_0x413490){_0x40fb10['push'](_0x40fb10['shift']());}};_0x110a3f(++_0x453676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x495bbb,_0x560988){var _0x1ed3ff=function(_0x1e740c){while(--_0x1e740c){_0x495bbb['push'](_0x495bbb['shift']());}};_0x1ed3ff(++_0x560988);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 ef9ee18..37c7150 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 _0xa8f0=['show','params','length','create','body','destroy','find','findOne','SugarcrmConfiguration','pick','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','catch'];(function(_0x203f53,_0x5b2ce9){var _0x44f626=function(_0x1e1b01){while(--_0x1e1b01){_0x203f53['push'](_0x203f53['shift']());}};_0x44f626(++_0x5b2ce9);}(_0xa8f0,0x123));var _0x0a8f=function(_0x43f5c7,_0x118763){_0x43f5c7=_0x43f5c7-0x0;var _0x46be5f=_0xa8f0[_0x43f5c7];return _0x46be5f;};'use strict';var emlformat=require(_0x0a8f('0x0'));var rimraf=require(_0x0a8f('0x1'));var zipdir=require(_0x0a8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a8f('0x3'));var moment=require(_0x0a8f('0x4'));var BPromise=require(_0x0a8f('0x5'));var Mustache=require(_0x0a8f('0x6'));var util=require(_0x0a8f('0x7'));var path=require(_0x0a8f('0x8'));var sox=require(_0x0a8f('0x9'));var csv=require(_0x0a8f('0xa'));var ejs=require(_0x0a8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a8f('0xc'));var squel=require('squel');var crypto=require(_0x0a8f('0xd'));var jsforce=require(_0x0a8f('0xe'));var deskjs=require(_0x0a8f('0xf'));var toCsv=require(_0x0a8f('0xa'));var querystring=require(_0x0a8f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a8f('0x11'));var qs=require(_0x0a8f('0x12'));var as=require(_0x0a8f('0x13'));var hardwareService=require(_0x0a8f('0x14'));var logger=require(_0x0a8f('0x15'))('api');var utils=require(_0x0a8f('0x16'));var config=require(_0x0a8f('0x17'));var licenseUtil=require(_0x0a8f('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x197ca3,_0x323b78){_0x323b78=_0x323b78||0xcc;return function(_0x15f717){if(_0x15f717){return _0x197ca3[_0x0a8f('0x19')](_0x323b78);}return _0x197ca3[_0x0a8f('0x1a')](_0x323b78)[_0x0a8f('0x1b')]();};}function respondWithResult(_0x260910,_0x180a70){_0x180a70=_0x180a70||0xc8;return function(_0xd59e80){if(_0xd59e80){return _0x260910['status'](_0x180a70)[_0x0a8f('0x1c')](_0xd59e80);}};}function respondWithFilteredResult(_0x195f48,_0x73e614){return function(_0xdcdc72){if(_0xdcdc72){var _0x24e8c9=typeof _0x73e614[_0x0a8f('0x1d')]===_0x0a8f('0x1e')&&typeof _0x73e614[_0x0a8f('0x1f')]==='undefined';var _0x277663=_0xdcdc72[_0x0a8f('0x20')];var _0x1aac1b=_0x24e8c9?0x0:_0x73e614[_0x0a8f('0x1d')];var _0x59182e=_0x24e8c9?_0xdcdc72['count']:_0x73e614['offset']+_0x73e614['limit'];var _0x5e1f5a;if(_0x59182e>=_0x277663){_0x59182e=_0x277663;_0x5e1f5a=0xc8;}else{_0x5e1f5a=0xce;}_0x195f48[_0x0a8f('0x1a')](_0x5e1f5a);return _0x195f48[_0x0a8f('0x21')](_0x0a8f('0x22'),_0x1aac1b+'-'+_0x59182e+'/'+_0x277663)['json'](_0xdcdc72);}return null;};}function patchUpdates(_0x3a98b0){return function(_0x1d1e33){try{jsonpatch[_0x0a8f('0x23')](_0x1d1e33,_0x3a98b0,!![]);}catch(_0x50ed6e){return BPromise[_0x0a8f('0x24')](_0x50ed6e);}return _0x1d1e33[_0x0a8f('0x25')]();};}function saveUpdates(_0x5c530f,_0x55c3d8){return function(_0x7b38c1){if(_0x7b38c1){return _0x7b38c1['update'](_0x5c530f)[_0x0a8f('0x26')](function(_0x134379){return _0x134379;});}return null;};}function removeEntity(_0x46e786,_0x442b34){return function(_0x58f8a0){if(_0x58f8a0){return _0x58f8a0['destroy']()[_0x0a8f('0x26')](function(){_0x46e786[_0x0a8f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89e09a,_0x39893d){return function(_0x5e4fef){if(!_0x5e4fef){_0x89e09a['sendStatus'](0x194);}return _0x5e4fef;};}function handleError(_0x18c7b5,_0x1b6e9d){_0x1b6e9d=_0x1b6e9d||0x1f4;return function(_0x4ff187){logger['error'](_0x4ff187[_0x0a8f('0x27')]);if(_0x4ff187[_0x0a8f('0x28')]){delete _0x4ff187[_0x0a8f('0x28')];}_0x18c7b5[_0x0a8f('0x1a')](_0x1b6e9d)[_0x0a8f('0x29')](_0x4ff187);};}exports['index']=function(_0x5828e2,_0x509fa5){var _0x49f39f={},_0x538458={},_0x401aa3={'count':0x0,'rows':[]};var _0xd4f4de=_['map'](db['SugarcrmAccount'][_0x0a8f('0x2a')],function(_0x37e8ff){return{'name':_0x37e8ff[_0x0a8f('0x2b')],'type':_0x37e8ff[_0x0a8f('0x2c')][_0x0a8f('0x2d')]};});_0x538458[_0x0a8f('0x2e')]=_[_0x0a8f('0x2f')](_0xd4f4de,_0x0a8f('0x28'));_0x538458['query']=_[_0x0a8f('0x30')](_0x5828e2[_0x0a8f('0x31')]);_0x538458[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x538458['model'],_0x538458[_0x0a8f('0x31')]);_0x49f39f['attributes']=_['intersection'](_0x538458[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x34')]));_0x49f39f[_0x0a8f('0x35')]=_0x49f39f[_0x0a8f('0x35')]['length']?_0x49f39f[_0x0a8f('0x35')]:_0x538458[_0x0a8f('0x2e')];if(!_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x36')](_0x0a8f('0x37'))){_0x49f39f[_0x0a8f('0x1f')]=qs['limit'](_0x5828e2[_0x0a8f('0x31')]['limit']);_0x49f39f['offset']=qs['offset'](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x1d')]);}_0x49f39f[_0x0a8f('0x38')]=qs['sort'](_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x39')]);_0x49f39f[_0x0a8f('0x3a')]=qs[_0x0a8f('0x32')](_['pick'](_0x5828e2[_0x0a8f('0x31')],_0x538458[_0x0a8f('0x32')]),_0xd4f4de);if(_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x3b')]){_0x49f39f[_0x0a8f('0x3a')]=_[_0x0a8f('0x3c')](_0x49f39f[_0x0a8f('0x3a')],{'$or':_[_0x0a8f('0x2f')](_0xd4f4de,function(_0x49e104){if(_0x49e104[_0x0a8f('0x2c')]!==_0x0a8f('0x3d')){var _0x2ea8e5={};_0x2ea8e5[_0x49e104[_0x0a8f('0x28')]]={'$like':'%'+_0x5828e2[_0x0a8f('0x31')][_0x0a8f('0x3b')]+'%'};return _0x2ea8e5;}})});}_0x49f39f=_['merge']({},_0x49f39f,_0x5828e2[_0x0a8f('0x3e')]);var _0x1305c1={'where':_0x49f39f[_0x0a8f('0x3a')]};return db[_0x0a8f('0x3f')][_0x0a8f('0x20')](_0x1305c1)['then'](function(_0x2d5491){_0x401aa3[_0x0a8f('0x20')]=_0x2d5491;if(_0x5828e2['query'][_0x0a8f('0x40')]){_0x49f39f[_0x0a8f('0x41')]=[{'all':!![]}];}return db[_0x0a8f('0x3f')][_0x0a8f('0x42')](_0x49f39f);})['then'](function(_0x1790b2){_0x401aa3[_0x0a8f('0x43')]=_0x1790b2;return _0x401aa3;})[_0x0a8f('0x26')](respondWithFilteredResult(_0x509fa5,_0x49f39f))[_0x0a8f('0x44')](handleError(_0x509fa5,null));};exports[_0x0a8f('0x45')]=function(_0xc7a79f,_0x3ae6ff){var _0xed6c0e={'raw':![],'where':{'id':_0xc7a79f[_0x0a8f('0x46')]['id']}},_0x3b36f6={};_0x3b36f6[_0x0a8f('0x2e')]=_[_0x0a8f('0x30')](db[_0x0a8f('0x3f')][_0x0a8f('0x2a')]);_0x3b36f6[_0x0a8f('0x31')]=_[_0x0a8f('0x30')](_0xc7a79f[_0x0a8f('0x31')]);_0x3b36f6[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x3b36f6[_0x0a8f('0x2e')],_0x3b36f6['query']);_0xed6c0e[_0x0a8f('0x35')]=_[_0x0a8f('0x33')](_0x3b36f6[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0xc7a79f[_0x0a8f('0x31')][_0x0a8f('0x34')]));_0xed6c0e['attributes']=_0xed6c0e[_0x0a8f('0x35')][_0x0a8f('0x47')]?_0xed6c0e[_0x0a8f('0x35')]:_0x3b36f6[_0x0a8f('0x2e')];if(_0xc7a79f['query']['includeAll']){_0xed6c0e['include']=[{'all':!![]}];}_0xed6c0e=_[_0x0a8f('0x3c')]({},_0xed6c0e,_0xc7a79f[_0x0a8f('0x3e')]);return db[_0x0a8f('0x3f')]['find'](_0xed6c0e)['then'](handleEntityNotFound(_0x3ae6ff,null))[_0x0a8f('0x26')](respondWithResult(_0x3ae6ff,null))[_0x0a8f('0x44')](handleError(_0x3ae6ff,null));};exports[_0x0a8f('0x48')]=function(_0x5e5301,_0x53fe2b){return db[_0x0a8f('0x3f')][_0x0a8f('0x48')](_0x5e5301[_0x0a8f('0x49')],{})[_0x0a8f('0x26')](respondWithResult(_0x53fe2b,0xc9))['catch'](handleError(_0x53fe2b,null));};exports['update']=function(_0x3c9066,_0x39be5f){if(_0x3c9066[_0x0a8f('0x49')]['id']){delete _0x3c9066[_0x0a8f('0x49')]['id'];}return db[_0x0a8f('0x3f')]['find']({'where':{'id':_0x3c9066[_0x0a8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x39be5f,null))[_0x0a8f('0x26')](saveUpdates(_0x3c9066['body'],null))[_0x0a8f('0x26')](respondWithResult(_0x39be5f,null))[_0x0a8f('0x44')](handleError(_0x39be5f,null));};exports[_0x0a8f('0x4a')]=function(_0x19f040,_0x25a364){return db[_0x0a8f('0x3f')][_0x0a8f('0x4b')]({'where':{'id':_0x19f040[_0x0a8f('0x46')]['id']}})[_0x0a8f('0x26')](handleEntityNotFound(_0x25a364,null))['then'](removeEntity(_0x25a364,null))[_0x0a8f('0x44')](handleError(_0x25a364,null));};exports['getConfigurations']=function(_0x208b61,_0x1de76c,_0x899d4f){var _0x172bc6={};var _0x2df1fa={};var _0x1e664b;var _0x2b656b;return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x208b61[_0x0a8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1de76c,null))[_0x0a8f('0x26')](function(_0x4a4834){if(_0x4a4834){_0x1e664b=_0x4a4834;_0x2df1fa['model']=_[_0x0a8f('0x30')](db[_0x0a8f('0x4d')][_0x0a8f('0x2a')]);_0x2df1fa[_0x0a8f('0x31')]=_[_0x0a8f('0x30')](_0x208b61['query']);_0x2df1fa[_0x0a8f('0x32')]=_[_0x0a8f('0x33')](_0x2df1fa[_0x0a8f('0x2e')],_0x2df1fa['query']);_0x172bc6[_0x0a8f('0x35')]=_[_0x0a8f('0x33')](_0x2df1fa[_0x0a8f('0x2e')],qs[_0x0a8f('0x34')](_0x208b61[_0x0a8f('0x31')]['fields']));_0x172bc6['attributes']=_0x172bc6[_0x0a8f('0x35')][_0x0a8f('0x47')]?_0x172bc6[_0x0a8f('0x35')]:_0x2df1fa[_0x0a8f('0x2e')];_0x172bc6[_0x0a8f('0x38')]=qs[_0x0a8f('0x39')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x39')]);_0x172bc6[_0x0a8f('0x3a')]=qs[_0x0a8f('0x32')](_[_0x0a8f('0x4e')](_0x208b61[_0x0a8f('0x31')],_0x2df1fa[_0x0a8f('0x32')]));if(_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x3b')]){_0x172bc6[_0x0a8f('0x3a')]=_[_0x0a8f('0x3c')](_0x172bc6[_0x0a8f('0x3a')],{'$or':_[_0x0a8f('0x2f')](_0x172bc6[_0x0a8f('0x35')],function(_0x59cb53){var _0x132bd4={};_0x132bd4[_0x59cb53]={'$like':'%'+_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x3b')]+'%'};return _0x132bd4;})});}_0x172bc6=_[_0x0a8f('0x3c')]({},_0x172bc6,_0x208b61['options']);return _0x1e664b['getConfigurations'](_0x172bc6);}})[_0x0a8f('0x26')](function(_0xa2fa6){if(_0xa2fa6){_0x2b656b=_0xa2fa6[_0x0a8f('0x47')];if(!_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x36')](_0x0a8f('0x37'))){_0x172bc6['limit']=qs[_0x0a8f('0x1f')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x1f')]);_0x172bc6['offset']=qs[_0x0a8f('0x1d')](_0x208b61[_0x0a8f('0x31')][_0x0a8f('0x1d')]);}return _0x1e664b[_0x0a8f('0x4f')](_0x172bc6);}})[_0x0a8f('0x26')](function(_0x5c859c){if(_0x5c859c){return _0x5c859c?{'count':_0x2b656b,'rows':_0x5c859c}:null;}})[_0x0a8f('0x26')](respondWithResult(_0x1de76c,null))[_0x0a8f('0x44')](handleError(_0x1de76c,null));};exports['addConfiguration']=function(_0x2a66f8,_0x35bbed,_0x1c02d3){if(_0x2a66f8[_0x0a8f('0x49')]['id']){delete _0x2a66f8[_0x0a8f('0x49')]['id'];}return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x2a66f8[_0x0a8f('0x46')]['id']}})[_0x0a8f('0x26')](handleEntityNotFound(_0x35bbed,null))[_0x0a8f('0x26')](function(_0x3ea59b){if(_0x3ea59b){_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x50')]=_0x3ea59b['id'];_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x51')]=integrations['getSubjects'](_0x2a66f8[_0x0a8f('0x49')]['channel'],_0x2a66f8['body'][_0x0a8f('0x2c')]);_0x2a66f8[_0x0a8f('0x49')][_0x0a8f('0x52')]=integrations[_0x0a8f('0x53')](_0x2a66f8['body']['channel'],_0x2a66f8['body'][_0x0a8f('0x2c')]);return db[_0x0a8f('0x4d')][_0x0a8f('0x48')](_0x2a66f8[_0x0a8f('0x49')],{'include':[{'model':db[_0x0a8f('0x54')],'as':_0x0a8f('0x51')},{'model':db['SugarcrmField'],'as':_0x0a8f('0x52')}]});}return null;})[_0x0a8f('0x26')](respondWithResult(_0x35bbed,null))[_0x0a8f('0x44')](handleError(_0x35bbed,null));};exports[_0x0a8f('0x55')]=function(_0x9add1d,_0x50218e,_0x5db4c0){var _0x4dff97='';var _0x254cb1=['id',_0x0a8f('0x28'),_0x0a8f('0x56'),_0x0a8f('0x57'),'description','date_start',_0x0a8f('0x58'),_0x0a8f('0x59'),_0x0a8f('0x5a'),_0x0a8f('0x5b'),'parent_name',_0x0a8f('0x5c')];return db[_0x0a8f('0x3f')][_0x0a8f('0x4c')]({'where':{'id':_0x9add1d[_0x0a8f('0x46')]['id']},'attributes':['id',_0x0a8f('0x5d'),_0x0a8f('0x5e'),'remoteUri']})[_0x0a8f('0x26')](handleEntityNotFound(_0x50218e,null))[_0x0a8f('0x26')](function(_0xa11df4){if(_0xa11df4){_0x4dff97=_0xa11df4[_0x0a8f('0x5f')];var _0x5a88cf=_0x4dff97[_0x0a8f('0x60')](-0x1);if(_0x5a88cf==='/'){_0x4dff97=_0x4dff97['substring'](0x0,_0x4dff97[_0x0a8f('0x61')](_0x5a88cf));}return rp({'method':_0x0a8f('0x62'),'uri':util[_0x0a8f('0x63')](_0x0a8f('0x64'),_0x4dff97,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0a8f('0x65'),'input_type':_0x0a8f('0x66'),'response_type':_0x0a8f('0x66'),'rest_data':JSON[_0x0a8f('0x67')]({'user_auth':{'user_name':_0xa11df4['username'],'password':_0xa11df4[_0x0a8f('0x5e')],'encryption':_0x0a8f('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x0a8f('0x26')](function(_0x289d73){if(_0x289d73&&_0x289d73[_0x0a8f('0x28')]!==_0x0a8f('0x69')&&_0x289d73[_0x0a8f('0x28')]!==_0x0a8f('0x6a')){return rp({'method':_0x0a8f('0x62'),'uri':util[_0x0a8f('0x63')](_0x0a8f('0x64'),_0x4dff97,_0x0a8f('0x6b')),'json':!![],'form':{'method':_0x0a8f('0x6c'),'input_type':_0x0a8f('0x66'),'response_type':_0x0a8f('0x66'),'rest_data':JSON[_0x0a8f('0x67')]({'session':_0x289d73['id'],'module_name':_0x0a8f('0x6d')})}})[_0x0a8f('0x26')](function(_0x5ef6c8){if(_0x5ef6c8){var _0x2174d9=_[_0x0a8f('0x6e')](_0x5ef6c8[_0x0a8f('0x6f')]);_[_0x0a8f('0x70')](_0x2174d9,function(_0x1c0de3){return _0x254cb1[_0x0a8f('0x71')](_0x1c0de3['name']);});return{'count':_0x2174d9[_0x0a8f('0x47')],'rows':_['map'](_0x2174d9,function(_0x48fc03){return{'id':_0x48fc03['name'],'name':_0x48fc03['label'],'custom':_[_0x0a8f('0x72')](_0x48fc03[_0x0a8f('0x28')],'_c')?!![]:![],'options':_0x48fc03[_0x0a8f('0x3e')]?_[_0x0a8f('0x2f')](_['values'](_0x48fc03[_0x0a8f('0x3e')]),function(_0x483795){return{'name':_0x483795['value'],'value':_0x483795[_0x0a8f('0x28')]};}):[]};})};}})[_0x0a8f('0x26')](respondWithResult(_0x50218e,null))[_0x0a8f('0x44')](function(_0x190594){var _0x4d7b63=_0x9add1d['query'][_0x0a8f('0x73')]?0x1f4:_0x190594[_0x0a8f('0x74')]||0x1f4;logger[_0x0a8f('0x75')](_0x0a8f('0x76'),'getFields',_0x4d7b63,JSON[_0x0a8f('0x67')](_0x190594));delete _0x190594[_0x0a8f('0x28')];if(_0x4d7b63===0x191){_0x4d7b63=0x190;}_0x50218e['status'](_0x4d7b63)[_0x0a8f('0x29')](_0x9add1d[_0x0a8f('0x31')]['test']?{'message':_0x0a8f('0x77'),'statusCode':_0x190594['statusCode']}:_0x190594);});}else{var _0x3ef80e=0x1f4;_0x50218e[_0x0a8f('0x1a')](_0x3ef80e)[_0x0a8f('0x29')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xdf9a=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','direction','findOne','password','remoteUri','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','Calls','module_fields','remove','includes','length','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x39ffa2,_0x3e8520){var _0x143015=function(_0x4162c1){while(--_0x4162c1){_0x39ffa2['push'](_0x39ffa2['shift']());}};_0x143015(++_0x3e8520);}(_0xdf9a,0x1c6));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xadf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadf9('0x1'));var jsonpatch=require(_0xadf9('0x2'));var rp=require(_0xadf9('0x3'));var moment=require(_0xadf9('0x4'));var BPromise=require(_0xadf9('0x5'));var Mustache=require(_0xadf9('0x6'));var util=require(_0xadf9('0x7'));var path=require(_0xadf9('0x8'));var sox=require(_0xadf9('0x9'));var csv=require(_0xadf9('0xa'));var ejs=require(_0xadf9('0xb'));var fs=require('fs');var fs_extra=require(_0xadf9('0xc'));var _=require(_0xadf9('0xd'));var squel=require(_0xadf9('0xe'));var crypto=require(_0xadf9('0xf'));var jsforce=require(_0xadf9('0x10'));var deskjs=require(_0xadf9('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xadf9('0x12'));var authService=require(_0xadf9('0x13'));var qs=require(_0xadf9('0x14'));var as=require(_0xadf9('0x15'));var hardwareService=require(_0xadf9('0x16'));var logger=require(_0xadf9('0x17'))(_0xadf9('0x18'));var utils=require(_0xadf9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xadf9('0x1a'));var db=require(_0xadf9('0x1b'))['db'];var integrations=require(_0xadf9('0x1c'));function respondWithStatusCode(_0x852f9d,_0x2de285){_0x2de285=_0x2de285||0xcc;return function(_0x403e6b){if(_0x403e6b){return _0x852f9d[_0xadf9('0x1d')](_0x2de285);}return _0x852f9d[_0xadf9('0x1e')](_0x2de285)[_0xadf9('0x1f')]();};}function respondWithResult(_0x229655,_0x551fbf){_0x551fbf=_0x551fbf||0xc8;return function(_0x5a2bc4){if(_0x5a2bc4){return _0x229655[_0xadf9('0x1e')](_0x551fbf)[_0xadf9('0x20')](_0x5a2bc4);}};}function respondWithFilteredResult(_0x26c8e1,_0x529ab3){return function(_0x4cdd95){if(_0x4cdd95){var _0x4eba0e=typeof _0x529ab3[_0xadf9('0x21')]===_0xadf9('0x22')&&typeof _0x529ab3[_0xadf9('0x23')]==='undefined';var _0x2bafb7=_0x4cdd95['count'];var _0x4e503c=_0x4eba0e?0x0:_0x529ab3['offset'];var _0x592e73=_0x4eba0e?_0x4cdd95['count']:_0x529ab3['offset']+_0x529ab3[_0xadf9('0x23')];var _0x5e08bd;if(_0x592e73>=_0x2bafb7){_0x592e73=_0x2bafb7;_0x5e08bd=0xc8;}else{_0x5e08bd=0xce;}_0x26c8e1[_0xadf9('0x1e')](_0x5e08bd);return _0x26c8e1['set'](_0xadf9('0x24'),_0x4e503c+'-'+_0x592e73+'/'+_0x2bafb7)['json'](_0x4cdd95);}return null;};}function patchUpdates(_0x28d271){return function(_0x2af085){try{jsonpatch[_0xadf9('0x25')](_0x2af085,_0x28d271,!![]);}catch(_0x55f73a){return BPromise['reject'](_0x55f73a);}return _0x2af085['save']();};}function saveUpdates(_0x18afe2,_0x137ecc){return function(_0x40da2a){if(_0x40da2a){return _0x40da2a[_0xadf9('0x26')](_0x18afe2)[_0xadf9('0x27')](function(_0x453611){return _0x453611;});}return null;};}function removeEntity(_0x9534de,_0x3be5a9){return function(_0x41f50b){if(_0x41f50b){return _0x41f50b[_0xadf9('0x28')]()['then'](function(){_0x9534de[_0xadf9('0x1e')](0xcc)[_0xadf9('0x1f')]();});}};}function handleEntityNotFound(_0x191659,_0x2d003c){return function(_0x4245a6){if(!_0x4245a6){_0x191659[_0xadf9('0x1d')](0x194);}return _0x4245a6;};}function handleError(_0x3c5a8b,_0x3d9d47){_0x3d9d47=_0x3d9d47||0x1f4;return function(_0x91a86a){logger[_0xadf9('0x29')](_0x91a86a[_0xadf9('0x2a')]);if(_0x91a86a[_0xadf9('0x2b')]){delete _0x91a86a[_0xadf9('0x2b')];}_0x3c5a8b[_0xadf9('0x1e')](_0x3d9d47)[_0xadf9('0x2c')](_0x91a86a);};}exports['index']=function(_0x5d3a38,_0xfa3557){var _0x55d03c={},_0x4690aa={},_0x492e97={'count':0x0,'rows':[]};var _0x3b70d2=_['map'](db[_0xadf9('0x2d')][_0xadf9('0x2e')],function(_0x3eeda9){return{'name':_0x3eeda9[_0xadf9('0x2f')],'type':_0x3eeda9[_0xadf9('0x30')][_0xadf9('0x31')]};});_0x4690aa[_0xadf9('0x32')]=_[_0xadf9('0x33')](_0x3b70d2,_0xadf9('0x2b'));_0x4690aa[_0xadf9('0x34')]=_[_0xadf9('0x35')](_0x5d3a38['query']);_0x4690aa[_0xadf9('0x36')]=_['intersection'](_0x4690aa[_0xadf9('0x32')],_0x4690aa['query']);_0x55d03c['attributes']=_['intersection'](_0x4690aa['model'],qs[_0xadf9('0x37')](_0x5d3a38[_0xadf9('0x34')][_0xadf9('0x37')]));_0x55d03c[_0xadf9('0x38')]=_0x55d03c[_0xadf9('0x38')]['length']?_0x55d03c['attributes']:_0x4690aa['model'];if(!_0x5d3a38[_0xadf9('0x34')]['hasOwnProperty'](_0xadf9('0x39'))){_0x55d03c[_0xadf9('0x23')]=qs[_0xadf9('0x23')](_0x5d3a38[_0xadf9('0x34')]['limit']);_0x55d03c['offset']=qs[_0xadf9('0x21')](_0x5d3a38[_0xadf9('0x34')][_0xadf9('0x21')]);}_0x55d03c[_0xadf9('0x3a')]=qs[_0xadf9('0x3b')](_0x5d3a38[_0xadf9('0x34')][_0xadf9('0x3b')]);_0x55d03c[_0xadf9('0x3c')]=qs[_0xadf9('0x36')](_[_0xadf9('0x3d')](_0x5d3a38[_0xadf9('0x34')],_0x4690aa[_0xadf9('0x36')]),_0x3b70d2);if(_0x5d3a38[_0xadf9('0x34')][_0xadf9('0x3e')]){_0x55d03c[_0xadf9('0x3c')]=_[_0xadf9('0x3f')](_0x55d03c[_0xadf9('0x3c')],{'$or':_[_0xadf9('0x33')](_0x3b70d2,function(_0xc01fd1){if(_0xc01fd1['type']!==_0xadf9('0x40')){var _0x161f0c={};_0x161f0c[_0xc01fd1[_0xadf9('0x2b')]]={'$like':'%'+_0x5d3a38[_0xadf9('0x34')][_0xadf9('0x3e')]+'%'};return _0x161f0c;}})});}_0x55d03c=_[_0xadf9('0x3f')]({},_0x55d03c,_0x5d3a38[_0xadf9('0x41')]);var _0x295951={'where':_0x55d03c[_0xadf9('0x3c')]};return db['SugarcrmAccount']['count'](_0x295951)[_0xadf9('0x27')](function(_0x210a43){_0x492e97[_0xadf9('0x42')]=_0x210a43;if(_0x5d3a38['query'][_0xadf9('0x43')]){_0x55d03c[_0xadf9('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xadf9('0x45')](_0x55d03c);})[_0xadf9('0x27')](function(_0xefe100){_0x492e97[_0xadf9('0x46')]=_0xefe100;return _0x492e97;})[_0xadf9('0x27')](respondWithFilteredResult(_0xfa3557,_0x55d03c))[_0xadf9('0x47')](handleError(_0xfa3557,null));};exports[_0xadf9('0x48')]=function(_0x3081b1,_0x870f2c){var _0x5d17f9={'raw':![],'where':{'id':_0x3081b1[_0xadf9('0x49')]['id']}},_0x555091={};_0x555091[_0xadf9('0x32')]=_[_0xadf9('0x35')](db[_0xadf9('0x2d')][_0xadf9('0x2e')]);_0x555091['query']=_[_0xadf9('0x35')](_0x3081b1[_0xadf9('0x34')]);_0x555091[_0xadf9('0x36')]=_[_0xadf9('0x4a')](_0x555091['model'],_0x555091[_0xadf9('0x34')]);_0x5d17f9[_0xadf9('0x38')]=_[_0xadf9('0x4a')](_0x555091[_0xadf9('0x32')],qs[_0xadf9('0x37')](_0x3081b1[_0xadf9('0x34')][_0xadf9('0x37')]));_0x5d17f9[_0xadf9('0x38')]=_0x5d17f9[_0xadf9('0x38')]['length']?_0x5d17f9[_0xadf9('0x38')]:_0x555091[_0xadf9('0x32')];if(_0x3081b1[_0xadf9('0x34')][_0xadf9('0x43')]){_0x5d17f9[_0xadf9('0x44')]=[{'all':!![]}];}_0x5d17f9=_[_0xadf9('0x3f')]({},_0x5d17f9,_0x3081b1[_0xadf9('0x41')]);return db['SugarcrmAccount'][_0xadf9('0x4b')](_0x5d17f9)[_0xadf9('0x27')](handleEntityNotFound(_0x870f2c,null))[_0xadf9('0x27')](respondWithResult(_0x870f2c,null))[_0xadf9('0x47')](handleError(_0x870f2c,null));};exports[_0xadf9('0x4c')]=function(_0x85e1ea,_0x3ebbc3){return db[_0xadf9('0x2d')][_0xadf9('0x4c')](_0x85e1ea[_0xadf9('0x4d')],{})[_0xadf9('0x27')](respondWithResult(_0x3ebbc3,0xc9))[_0xadf9('0x47')](handleError(_0x3ebbc3,null));};exports[_0xadf9('0x26')]=function(_0x4ff978,_0x213f4c){if(_0x4ff978['body']['id']){delete _0x4ff978['body']['id'];}return db[_0xadf9('0x2d')][_0xadf9('0x4b')]({'where':{'id':_0x4ff978[_0xadf9('0x49')]['id']}})[_0xadf9('0x27')](handleEntityNotFound(_0x213f4c,null))[_0xadf9('0x27')](saveUpdates(_0x4ff978[_0xadf9('0x4d')],null))[_0xadf9('0x27')](respondWithResult(_0x213f4c,null))[_0xadf9('0x47')](handleError(_0x213f4c,null));};exports['destroy']=function(_0x1f76c4,_0x4c95db){return db[_0xadf9('0x2d')][_0xadf9('0x4b')]({'where':{'id':_0x1f76c4[_0xadf9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c95db,null))['then'](removeEntity(_0x4c95db,null))['catch'](handleError(_0x4c95db,null));};exports[_0xadf9('0x4e')]=function(_0x1504f2,_0x59f013,_0x56d0b4){var _0x24f47a={};var _0x490c55={};var _0x35f436;var _0x3bb18e;return db[_0xadf9('0x2d')]['findOne']({'where':{'id':_0x1504f2[_0xadf9('0x49')]['id']}})[_0xadf9('0x27')](handleEntityNotFound(_0x59f013,null))[_0xadf9('0x27')](function(_0x40e0ad){if(_0x40e0ad){_0x35f436=_0x40e0ad;_0x490c55['model']=_['keys'](db[_0xadf9('0x4f')][_0xadf9('0x2e')]);_0x490c55[_0xadf9('0x34')]=_[_0xadf9('0x35')](_0x1504f2[_0xadf9('0x34')]);_0x490c55['filters']=_['intersection'](_0x490c55[_0xadf9('0x32')],_0x490c55[_0xadf9('0x34')]);_0x24f47a[_0xadf9('0x38')]=_['intersection'](_0x490c55[_0xadf9('0x32')],qs[_0xadf9('0x37')](_0x1504f2[_0xadf9('0x34')][_0xadf9('0x37')]));_0x24f47a[_0xadf9('0x38')]=_0x24f47a[_0xadf9('0x38')]['length']?_0x24f47a[_0xadf9('0x38')]:_0x490c55['model'];_0x24f47a['order']=qs[_0xadf9('0x3b')](_0x1504f2['query'][_0xadf9('0x3b')]);_0x24f47a[_0xadf9('0x3c')]=qs[_0xadf9('0x36')](_[_0xadf9('0x3d')](_0x1504f2[_0xadf9('0x34')],_0x490c55[_0xadf9('0x36')]));if(_0x1504f2['query'][_0xadf9('0x3e')]){_0x24f47a[_0xadf9('0x3c')]=_[_0xadf9('0x3f')](_0x24f47a['where'],{'$or':_[_0xadf9('0x33')](_0x24f47a[_0xadf9('0x38')],function(_0x318bcb){var _0xbe6ab5={};_0xbe6ab5[_0x318bcb]={'$like':'%'+_0x1504f2[_0xadf9('0x34')][_0xadf9('0x3e')]+'%'};return _0xbe6ab5;})});}_0x24f47a=_[_0xadf9('0x3f')]({},_0x24f47a,_0x1504f2[_0xadf9('0x41')]);return _0x35f436[_0xadf9('0x4e')](_0x24f47a);}})['then'](function(_0x1fc5a5){if(_0x1fc5a5){_0x3bb18e=_0x1fc5a5['length'];if(!_0x1504f2[_0xadf9('0x34')][_0xadf9('0x50')]('nolimit')){_0x24f47a[_0xadf9('0x23')]=qs['limit'](_0x1504f2['query'][_0xadf9('0x23')]);_0x24f47a[_0xadf9('0x21')]=qs[_0xadf9('0x21')](_0x1504f2[_0xadf9('0x34')][_0xadf9('0x21')]);}return _0x35f436[_0xadf9('0x4e')](_0x24f47a);}})['then'](function(_0x3f5f3a){if(_0x3f5f3a){return _0x3f5f3a?{'count':_0x3bb18e,'rows':_0x3f5f3a}:null;}})['then'](respondWithResult(_0x59f013,null))[_0xadf9('0x47')](handleError(_0x59f013,null));};exports[_0xadf9('0x51')]=function(_0x4d44e8,_0x5e3aad,_0x2ef9b0){if(_0x4d44e8[_0xadf9('0x4d')]['id']){delete _0x4d44e8[_0xadf9('0x4d')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4d44e8[_0xadf9('0x49')]['id']}})[_0xadf9('0x27')](handleEntityNotFound(_0x5e3aad,null))['then'](function(_0x1533ae){if(_0x1533ae){_0x4d44e8['body'][_0xadf9('0x52')]=_0x1533ae['id'];_0x4d44e8[_0xadf9('0x4d')][_0xadf9('0x53')]=integrations[_0xadf9('0x54')](_0x4d44e8['body']['channel'],_0x4d44e8[_0xadf9('0x4d')][_0xadf9('0x30')]);_0x4d44e8[_0xadf9('0x4d')][_0xadf9('0x55')]=integrations[_0xadf9('0x56')](_0x4d44e8[_0xadf9('0x4d')][_0xadf9('0x57')],_0x4d44e8[_0xadf9('0x4d')][_0xadf9('0x30')]);return db[_0xadf9('0x4f')][_0xadf9('0x4c')](_0x4d44e8[_0xadf9('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0xadf9('0x53')},{'model':db['SugarcrmField'],'as':_0xadf9('0x55')}]});}return null;})[_0xadf9('0x27')](respondWithResult(_0x5e3aad,null))[_0xadf9('0x47')](handleError(_0x5e3aad,null));};exports[_0xadf9('0x58')]=function(_0x2ed9dc,_0xfc1447,_0x105703){var _0x24fd7f='';var _0x208de0=['id',_0xadf9('0x2b'),_0xadf9('0x59'),_0xadf9('0x5a'),_0xadf9('0x5b'),'date_start',_0xadf9('0x5c'),_0xadf9('0x5d'),_0xadf9('0x5e'),_0xadf9('0x5f'),'parent_name',_0xadf9('0x60')];return db[_0xadf9('0x2d')][_0xadf9('0x61')]({'where':{'id':_0x2ed9dc[_0xadf9('0x49')]['id']},'attributes':['id','username',_0xadf9('0x62'),_0xadf9('0x63')]})['then'](handleEntityNotFound(_0xfc1447,null))['then'](function(_0x4a1d3f){if(_0x4a1d3f){_0x24fd7f=_0x4a1d3f[_0xadf9('0x63')];var _0x4a8262=_0x24fd7f['slice'](-0x1);if(_0x4a8262==='/'){_0x24fd7f=_0x24fd7f['substring'](0x0,_0x24fd7f['lastIndexOf'](_0x4a8262));}return rp({'method':_0xadf9('0x64'),'uri':util['format'](_0xadf9('0x65'),_0x24fd7f,_0xadf9('0x66')),'json':!![],'form':{'method':'login','input_type':_0xadf9('0x67'),'response_type':_0xadf9('0x67'),'rest_data':JSON[_0xadf9('0x68')]({'user_auth':{'user_name':_0x4a1d3f[_0xadf9('0x69')],'password':_0x4a1d3f[_0xadf9('0x62')],'encryption':'PLAIN'},'application':_0xadf9('0x6a')})}});}})['then'](function(_0x4e9c1e){if(_0x4e9c1e&&_0x4e9c1e['name']!==_0xadf9('0x6b')&&_0x4e9c1e[_0xadf9('0x2b')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xadf9('0x6c')](_0xadf9('0x65'),_0x24fd7f,_0xadf9('0x66')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xadf9('0x67'),'response_type':_0xadf9('0x67'),'rest_data':JSON['stringify']({'session':_0x4e9c1e['id'],'module_name':_0xadf9('0x6d')})}})[_0xadf9('0x27')](function(_0x11bfbe){if(_0x11bfbe){var _0x544acd=_['values'](_0x11bfbe[_0xadf9('0x6e')]);_[_0xadf9('0x6f')](_0x544acd,function(_0x3b3008){return _0x208de0[_0xadf9('0x70')](_0x3b3008[_0xadf9('0x2b')]);});return{'count':_0x544acd[_0xadf9('0x71')],'rows':_[_0xadf9('0x33')](_0x544acd,function(_0x13d84d){return{'id':_0x13d84d[_0xadf9('0x2b')],'name':_0x13d84d[_0xadf9('0x72')],'custom':_[_0xadf9('0x73')](_0x13d84d[_0xadf9('0x2b')],'_c')?!![]:![],'options':_0x13d84d[_0xadf9('0x41')]?_['map'](_['values'](_0x13d84d[_0xadf9('0x41')]),function(_0x4144cf){return{'name':_0x4144cf['value'],'value':_0x4144cf['name']};}):[]};})};}})[_0xadf9('0x27')](respondWithResult(_0xfc1447,null))[_0xadf9('0x47')](function(_0xca5ce){var _0xe3482=_0x2ed9dc['query'][_0xadf9('0x74')]?0x1f4:_0xca5ce[_0xadf9('0x75')]||0x1f4;logger['error'](_0xadf9('0x76'),'getFields',_0xe3482,JSON[_0xadf9('0x68')](_0xca5ce));delete _0xca5ce['name'];if(_0xe3482===0x191){_0xe3482=0x190;}_0xfc1447[_0xadf9('0x1e')](_0xe3482)['send'](_0x2ed9dc[_0xadf9('0x34')][_0xadf9('0x74')]?{'message':_0xadf9('0x77'),'statusCode':_0xca5ce[_0xadf9('0x75')]}:_0xca5ce);});}else{var _0x104871=0x1f4;_0xfc1447[_0xadf9('0x1e')](_0x104871)[_0xadf9('0x2c')]({'message':'Wrong\x20credentials','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 5e21fd7..e3f3ec8 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 _0xe4f9=['rimraf','../../config/environment','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment'];(function(_0x66ae90,_0x1fbf4c){var _0x3a418e=function(_0x3618e2){while(--_0x3618e2){_0x66ae90['push'](_0x66ae90['shift']());}};_0x3a418e(++_0x1fbf4c);}(_0xe4f9,0xa8));var _0x9e4f=function(_0x57a822,_0x3e34f1){_0x57a822=_0x57a822-0x0;var _0x22b1d7=_0xe4f9[_0x57a822];return _0x22b1d7;};'use strict';var _=require(_0x9e4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9e4f('0x1'));var moment=require(_0x9e4f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e4f('0x3'));var config=require(_0x9e4f('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9e4f('0x5')]=function(_0x2da0dd,_0x503d35){return _0x2da0dd[_0x9e4f('0x6')](_0x9e4f('0x7'),attributes,{'tableName':_0x9e4f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x926f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x59d9f0,_0x5f3c78){var _0x3889a2=function(_0x2d22b4){while(--_0x2d22b4){_0x59d9f0['push'](_0x59d9f0['shift']());}};_0x3889a2(++_0x5f3c78);}(_0x926f,0xb6));var _0xf926=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x926f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf926('0x0'));var util=require(_0xf926('0x1'));var logger=require(_0xf926('0x2'))(_0xf926('0x3'));var moment=require(_0xf926('0x4'));var BPromise=require(_0xf926('0x5'));var rp=require(_0xf926('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf926('0x7'));var config=require(_0xf926('0x8'));var attributes=require(_0xf926('0x9'));var integrations=require(_0xf926('0xa'));module[_0xf926('0xb')]=function(_0x55c098,_0x431a3f){return _0x55c098[_0xf926('0xc')](_0xf926('0xd'),attributes,{'tableName':'int_sugarcrm_accounts','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 bde2728..2de7d02 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 _0xfbca=['include','map','model','stringify','find','ShowSugarcrmAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit'];(function(_0x2f9b0c,_0x4bf62a){var _0x4a3c19=function(_0x162314){while(--_0x162314){_0x2f9b0c['push'](_0x2f9b0c['shift']());}};_0x4a3c19(++_0x4bf62a);}(_0xfbca,0xb0));var _0xafbc=function(_0x3a5966,_0x1d60c4){_0x3a5966=_0x3a5966-0x0;var _0x8469b6=_0xfbca[_0x3a5966];return _0x8469b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xafbc('0x0'));var BPromise=require('bluebird');var rs=require(_0xafbc('0x1'));var fs=require('fs');var Redis=require(_0xafbc('0x2'));var db=require(_0xafbc('0x3'))['db'];var utils=require(_0xafbc('0x4'));var logger=require(_0xafbc('0x5'))(_0xafbc('0x6'));var config=require(_0xafbc('0x7'));var jayson=require(_0xafbc('0x8'));var client=jayson['client'][_0xafbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46fb98,_0x91dec9,_0xbb7bcb){return new BPromise(function(_0x587dce,_0x587175){return client[_0xafbc('0xa')](_0x46fb98,_0xbb7bcb)[_0xafbc('0xb')](function(_0x55423c){logger[_0xafbc('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x91dec9,_0xafbc('0xd'));logger[_0xafbc('0xe')](_0xafbc('0xf'),_0x91dec9,_0xafbc('0xd'),JSON['stringify'](_0x55423c));if(_0x55423c[_0xafbc('0x10')]){if(_0x55423c['error']['code']===0x1f4){logger[_0xafbc('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x91dec9,_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);return _0x587175(_0x55423c['error'][_0xafbc('0x11')]);}logger[_0xafbc('0x10')](_0xafbc('0x12'),_0x91dec9,_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);return _0x587dce(_0x55423c[_0xafbc('0x10')][_0xafbc('0x11')]);}else{logger['info'](_0xafbc('0x12'),_0x91dec9,'request\x20sent');_0x587dce(_0x55423c[_0xafbc('0x13')][_0xafbc('0x11')]);}})[_0xafbc('0x14')](function(_0x22a3b7){logger[_0xafbc('0x10')](_0xafbc('0x12'),_0x91dec9,_0x22a3b7);_0x587175(_0x22a3b7);});});}exports[_0xafbc('0x15')]=function(_0x2c391c){var _0x13e3fa=this;return new Promise(function(_0x4f8830,_0x57e1d2){return db[_0xafbc('0x16')]['findAll']({'raw':_0x2c391c['options']?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x18')]===undefined?!![]:![]:!![],'where':_0x2c391c[_0xafbc('0x17')]?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x19')]||null:null,'attributes':_0x2c391c[_0xafbc('0x17')]?_0x2c391c[_0xafbc('0x17')][_0xafbc('0x1a')]||null:null,'limit':_0x2c391c[_0xafbc('0x17')]?_0x2c391c['options'][_0xafbc('0x1b')]||null:null,'include':_0x2c391c[_0xafbc('0x17')]?_0x2c391c['options'][_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x2c391c[_0xafbc('0x17')]['include'],function(_0x347d0c){return{'model':db[_0x347d0c[_0xafbc('0x1e')]],'as':_0x347d0c['as'],'attributes':_0x347d0c[_0xafbc('0x1a')],'include':_0x347d0c[_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x347d0c['include'],function(_0x28869c){return{'model':db[_0x28869c[_0xafbc('0x1e')]],'as':_0x28869c['as'],'attributes':_0x28869c[_0xafbc('0x1a')],'include':_0x28869c[_0xafbc('0x1c')]?_[_0xafbc('0x1d')](_0x28869c['include'],function(_0x38a8c2){return{'model':db[_0x38a8c2[_0xafbc('0x1e')]],'as':_0x38a8c2['as'],'attributes':_0x38a8c2[_0xafbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafbc('0xb')](function(_0x5b768d){logger[_0xafbc('0xc')]('GetSugarcrmAccount',_0x2c391c);logger[_0xafbc('0xe')](_0xafbc('0x15'),_0x2c391c,JSON[_0xafbc('0x1f')](_0x5b768d));_0x4f8830(_0x5b768d);})[_0xafbc('0x14')](function(_0x2a88d7){logger[_0xafbc('0x10')](_0xafbc('0x15'),_0x2a88d7['message'],_0x2c391c);_0x57e1d2(_0x13e3fa[_0xafbc('0x10')](0x1f4,_0x2a88d7['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1188dc){var _0x39551d=this;return new Promise(function(_0x6d8da2,_0xc663da){return db[_0xafbc('0x16')][_0xafbc('0x20')]({'raw':_0x1188dc['options']?_0x1188dc[_0xafbc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')]['where']||null:null,'attributes':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')][_0xafbc('0x1a')]||null:null,'include':_0x1188dc[_0xafbc('0x17')]?_0x1188dc[_0xafbc('0x17')]['include']?_[_0xafbc('0x1d')](_0x1188dc[_0xafbc('0x17')][_0xafbc('0x1c')],function(_0x2d421b){return{'model':db[_0x2d421b[_0xafbc('0x1e')]],'as':_0x2d421b['as'],'attributes':_0x2d421b[_0xafbc('0x1a')],'include':_0x2d421b[_0xafbc('0x1c')]?_['map'](_0x2d421b['include'],function(_0x4f03f0){return{'model':db[_0x4f03f0[_0xafbc('0x1e')]],'as':_0x4f03f0['as'],'attributes':_0x4f03f0[_0xafbc('0x1a')],'include':_0x4f03f0['include']?_[_0xafbc('0x1d')](_0x4f03f0[_0xafbc('0x1c')],function(_0x2003b3){return{'model':db[_0x2003b3[_0xafbc('0x1e')]],'as':_0x2003b3['as'],'attributes':_0x2003b3[_0xafbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafbc('0xb')](function(_0x49b490){logger['info']('ShowSugarcrmAccount',_0x1188dc);logger[_0xafbc('0xe')](_0xafbc('0x21'),_0x1188dc,JSON['stringify'](_0x49b490));_0x6d8da2(_0x49b490);})[_0xafbc('0x14')](function(_0x6330e7){logger['error'](_0xafbc('0x21'),_0x6330e7[_0xafbc('0x11')],_0x1188dc);_0xc663da(_0x39551d[_0xafbc('0x10')](0x1f4,_0x6330e7[_0xafbc('0x11')]));});});}; \ No newline at end of file +var _0x4771=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','ShowSugarcrmAccount','find','raw','lodash','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x3276ed,_0x2ff885){var _0x47815c=function(_0x2799cd){while(--_0x2799cd){_0x3276ed['push'](_0x3276ed['shift']());}};_0x47815c(++_0x2ff885);}(_0x4771,0x1c6));var _0x1477=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4771[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x1477('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1477('0x1'));var rs=require(_0x1477('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1477('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1477('0x4'));var jayson=require(_0x1477('0x5'));var client=jayson[_0x1477('0x6')][_0x1477('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27f6bd,_0xa3962d,_0x41befa){return new BPromise(function(_0x4ec262,_0xca5b7c){return client['request'](_0x27f6bd,_0x41befa)[_0x1477('0x8')](function(_0x207b5){logger[_0x1477('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0xa3962d,_0x1477('0xa'));logger[_0x1477('0xb')](_0x1477('0xc'),_0xa3962d,'request\x20sent',JSON[_0x1477('0xd')](_0x207b5));if(_0x207b5[_0x1477('0xe')]){if(_0x207b5[_0x1477('0xe')]['code']===0x1f4){logger[_0x1477('0xe')](_0x1477('0xf'),_0xa3962d,_0x207b5[_0x1477('0xe')]['message']);return _0xca5b7c(_0x207b5[_0x1477('0xe')][_0x1477('0x10')]);}logger[_0x1477('0xe')](_0x1477('0xf'),_0xa3962d,_0x207b5[_0x1477('0xe')][_0x1477('0x10')]);return _0x4ec262(_0x207b5[_0x1477('0xe')][_0x1477('0x10')]);}else{logger['info'](_0x1477('0xf'),_0xa3962d,_0x1477('0xa'));_0x4ec262(_0x207b5[_0x1477('0x11')][_0x1477('0x10')]);}})[_0x1477('0x12')](function(_0xa24580){logger[_0x1477('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0xa3962d,_0xa24580);_0xca5b7c(_0xa24580);});});}exports[_0x1477('0x13')]=function(_0x52f929){var _0x43d5a0=this;return new Promise(function(_0x28d0fd,_0x357c59){return db[_0x1477('0x14')][_0x1477('0x15')]({'raw':_0x52f929[_0x1477('0x16')]?_0x52f929[_0x1477('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52f929['options']?_0x52f929[_0x1477('0x16')][_0x1477('0x17')]||null:null,'attributes':_0x52f929[_0x1477('0x16')]?_0x52f929[_0x1477('0x16')][_0x1477('0x18')]||null:null,'limit':_0x52f929[_0x1477('0x16')]?_0x52f929[_0x1477('0x16')]['limit']||null:null,'include':_0x52f929['options']?_0x52f929[_0x1477('0x16')][_0x1477('0x19')]?_[_0x1477('0x1a')](_0x52f929[_0x1477('0x16')][_0x1477('0x19')],function(_0x3149e3){return{'model':db[_0x3149e3[_0x1477('0x1b')]],'as':_0x3149e3['as'],'attributes':_0x3149e3[_0x1477('0x18')],'include':_0x3149e3['include']?_[_0x1477('0x1a')](_0x3149e3[_0x1477('0x19')],function(_0x578073){return{'model':db[_0x578073[_0x1477('0x1b')]],'as':_0x578073['as'],'attributes':_0x578073[_0x1477('0x18')],'include':_0x578073[_0x1477('0x19')]?_['map'](_0x578073[_0x1477('0x19')],function(_0x127619){return{'model':db[_0x127619[_0x1477('0x1b')]],'as':_0x127619['as'],'attributes':_0x127619[_0x1477('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1477('0x8')](function(_0x410bee){logger[_0x1477('0x9')](_0x1477('0x13'),_0x52f929);logger['debug'](_0x1477('0x13'),_0x52f929,JSON[_0x1477('0xd')](_0x410bee));_0x28d0fd(_0x410bee);})[_0x1477('0x12')](function(_0x39721d){logger['error'](_0x1477('0x13'),_0x39721d[_0x1477('0x10')],_0x52f929);_0x357c59(_0x43d5a0[_0x1477('0xe')](0x1f4,_0x39721d[_0x1477('0x10')]));});});};exports[_0x1477('0x1c')]=function(_0x513c5c){var _0x292699=this;return new Promise(function(_0x1c4524,_0x32e63b){return db['SugarcrmAccount'][_0x1477('0x1d')]({'raw':_0x513c5c[_0x1477('0x16')]?_0x513c5c['options'][_0x1477('0x1e')]===undefined?!![]:![]:!![],'where':_0x513c5c[_0x1477('0x16')]?_0x513c5c[_0x1477('0x16')][_0x1477('0x17')]||null:null,'attributes':_0x513c5c['options']?_0x513c5c['options'][_0x1477('0x18')]||null:null,'include':_0x513c5c[_0x1477('0x16')]?_0x513c5c[_0x1477('0x16')][_0x1477('0x19')]?_[_0x1477('0x1a')](_0x513c5c[_0x1477('0x16')][_0x1477('0x19')],function(_0x354095){return{'model':db[_0x354095[_0x1477('0x1b')]],'as':_0x354095['as'],'attributes':_0x354095[_0x1477('0x18')],'include':_0x354095[_0x1477('0x19')]?_['map'](_0x354095[_0x1477('0x19')],function(_0x463dc7){return{'model':db[_0x463dc7['model']],'as':_0x463dc7['as'],'attributes':_0x463dc7[_0x1477('0x18')],'include':_0x463dc7[_0x1477('0x19')]?_[_0x1477('0x1a')](_0x463dc7[_0x1477('0x19')],function(_0x3141c0){return{'model':db[_0x3141c0[_0x1477('0x1b')]],'as':_0x3141c0['as'],'attributes':_0x3141c0['attributes']};}):[]};}):[]};}):[]:[]})[_0x1477('0x8')](function(_0x3661b4){logger[_0x1477('0x9')](_0x1477('0x1c'),_0x513c5c);logger[_0x1477('0xb')](_0x1477('0x1c'),_0x513c5c,JSON[_0x1477('0xd')](_0x3661b4));_0x1c4524(_0x3661b4);})[_0x1477('0x12')](function(_0x3a75a4){logger['error']('ShowSugarcrmAccount',_0x3a75a4[_0x1477('0x10')],_0x513c5c);_0x32e63b(_0x292699['error'](0x1f4,_0x3a75a4[_0x1477('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f99823c..f4ed4ec 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 _0x2e77=['delete','multer','util','path','express','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2e77,0x141));var _0x72e7=function(_0x6087c2,_0x37bef6){_0x6087c2=_0x6087c2-0x0;var _0x88e7c=_0x2e77[_0x6087c2];return _0x88e7c;};'use strict';var multer=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var path=require(_0x72e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x72e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x72e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72e7('0x5'));var controller=require(_0x72e7('0x6'));router[_0x72e7('0x7')]('/',auth[_0x72e7('0x8')](),controller[_0x72e7('0x9')]);router['get'](_0x72e7('0xa'),auth['isAuthenticated'](),controller[_0x72e7('0xb')]);router[_0x72e7('0x7')](_0x72e7('0xc'),auth[_0x72e7('0x8')](),controller[_0x72e7('0xd')]);router[_0x72e7('0x7')]('/:id/subjects',auth[_0x72e7('0x8')](),controller[_0x72e7('0xe')]);router[_0x72e7('0x7')]('/:id/descriptions',auth[_0x72e7('0x8')](),controller[_0x72e7('0xf')]);router[_0x72e7('0x10')]('/',auth[_0x72e7('0x8')](),controller['create']);router[_0x72e7('0x11')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller[_0x72e7('0x12')]);router[_0x72e7('0x13')](_0x72e7('0xa'),auth[_0x72e7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd359=['/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','/:id/subjects','getSubjects'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xd359,0x1a0));var _0x9d35=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd359[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x9d35('0x0'));var util=require(_0x9d35('0x1'));var path=require(_0x9d35('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d35('0x3'));var router=express[_0x9d35('0x4')]();var fs_extra=require(_0x9d35('0x5'));var auth=require(_0x9d35('0x6'));var interaction=require(_0x9d35('0x7'));var config=require(_0x9d35('0x8'));var controller=require(_0x9d35('0x9'));router['get']('/',auth[_0x9d35('0xa')](),controller[_0x9d35('0xb')]);router[_0x9d35('0xc')](_0x9d35('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9d35('0xc')]('/:id/fields',auth[_0x9d35('0xa')](),controller['getFields']);router[_0x9d35('0xc')](_0x9d35('0xe'),auth[_0x9d35('0xa')](),controller[_0x9d35('0xf')]);router['get'](_0x9d35('0x10'),auth[_0x9d35('0xa')](),controller[_0x9d35('0x11')]);router[_0x9d35('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9d35('0x13')]('/:id',auth[_0x9d35('0xa')](),controller[_0x9d35('0x14')]);router[_0x9d35('0x15')](_0x9d35('0xd'),auth[_0x9d35('0xa')](),controller[_0x9d35('0x16')]);module[_0x9d35('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index a785212..ba3f4e6 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 _0xd6c9=['sequelize','exports','STRING'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xd6c9,0x102));var _0x9d6c=function(_0x53d147,_0x259f9e){_0x53d147=_0x53d147-0x0;var _0x3bc064=_0xd6c9[_0x53d147];return _0x3bc064;};'use strict';var Sequelize=require(_0x9d6c('0x0'));module[_0x9d6c('0x1')]={'name':{'type':Sequelize[_0x9d6c('0x2')]},'description':{'type':Sequelize[_0x9d6c('0x2')]}}; \ No newline at end of file +var _0x9485=['exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9485,0xa0));var _0x5948=function(_0x328213,_0x38ab6b){_0x328213=_0x328213-0x0;var _0xeefb01=_0x9485[_0x328213];return _0xeefb01;};'use strict';var Sequelize=require('sequelize');module[_0x5948('0x0')]={'name':{'type':Sequelize[_0x5948('0x1')]},'description':{'type':Sequelize[_0x5948('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2cfb8c6..a8f3d24 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 _0x7ea7=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','getFields','SugarcrmField','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','fieldName','type','model'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7ea7,0x6c));var _0x77ea=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x7ea7[_0x59eacf];return _0x5d74f2;};'use strict';var emlformat=require(_0x77ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77ea('0x1'));var jsonpatch=require(_0x77ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77ea('0x3'));var util=require(_0x77ea('0x4'));var path=require(_0x77ea('0x5'));var sox=require(_0x77ea('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77ea('0x7'));var _=require(_0x77ea('0x8'));var squel=require(_0x77ea('0x9'));var crypto=require('crypto');var jsforce=require(_0x77ea('0xa'));var deskjs=require(_0x77ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0x77ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x77ea('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x77ea('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77ea('0xf'));var logger=require(_0x77ea('0x10'))(_0x77ea('0x11'));var utils=require(_0x77ea('0x12'));var config=require(_0x77ea('0x13'));var licenseUtil=require(_0x77ea('0x14'));var db=require(_0x77ea('0x15'))['db'];function respondWithStatusCode(_0x3e3c20,_0x1ced1){_0x1ced1=_0x1ced1||0xcc;return function(_0x132e36){if(_0x132e36){return _0x3e3c20[_0x77ea('0x16')](_0x1ced1);}return _0x3e3c20[_0x77ea('0x17')](_0x1ced1)['end']();};}function respondWithResult(_0xf5ea13,_0x1f0bd5){_0x1f0bd5=_0x1f0bd5||0xc8;return function(_0x37305f){if(_0x37305f){return _0xf5ea13[_0x77ea('0x17')](_0x1f0bd5)['json'](_0x37305f);}};}function respondWithFilteredResult(_0x17adf3,_0x1b9b53){return function(_0x125ff2){if(_0x125ff2){var _0x58b605=typeof _0x1b9b53[_0x77ea('0x18')]==='undefined'&&typeof _0x1b9b53[_0x77ea('0x19')]===_0x77ea('0x1a');var _0x3adee8=_0x125ff2[_0x77ea('0x1b')];var _0x1d8ba4=_0x58b605?0x0:_0x1b9b53['offset'];var _0x14a162=_0x58b605?_0x125ff2[_0x77ea('0x1b')]:_0x1b9b53['offset']+_0x1b9b53[_0x77ea('0x19')];var _0x3f1b80;if(_0x14a162>=_0x3adee8){_0x14a162=_0x3adee8;_0x3f1b80=0xc8;}else{_0x3f1b80=0xce;}_0x17adf3[_0x77ea('0x17')](_0x3f1b80);return _0x17adf3[_0x77ea('0x1c')]('Content-Range',_0x1d8ba4+'-'+_0x14a162+'/'+_0x3adee8)['json'](_0x125ff2);}return null;};}function patchUpdates(_0x54e024){return function(_0x1cd84d){try{jsonpatch[_0x77ea('0x1d')](_0x1cd84d,_0x54e024,!![]);}catch(_0x476c03){return BPromise[_0x77ea('0x1e')](_0x476c03);}return _0x1cd84d[_0x77ea('0x1f')]();};}function saveUpdates(_0x56f527,_0xda700f){return function(_0x49dbc8){if(_0x49dbc8){return _0x49dbc8[_0x77ea('0x20')](_0x56f527)[_0x77ea('0x21')](function(_0x563fc6){return _0x563fc6;});}return null;};}function removeEntity(_0x2c4e6d,_0x2d6540){return function(_0x2a6831){if(_0x2a6831){return _0x2a6831[_0x77ea('0x22')]()[_0x77ea('0x21')](function(){_0x2c4e6d[_0x77ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x446839,_0x1ee03c){return function(_0x17c179){if(!_0x17c179){_0x446839[_0x77ea('0x16')](0x194);}return _0x17c179;};}function handleError(_0x57a161,_0x19f376){_0x19f376=_0x19f376||0x1f4;return function(_0x5f00dd){logger[_0x77ea('0x23')](_0x5f00dd['stack']);if(_0x5f00dd[_0x77ea('0x24')]){delete _0x5f00dd['name'];}_0x57a161[_0x77ea('0x17')](_0x19f376)[_0x77ea('0x25')](_0x5f00dd);};}exports[_0x77ea('0x26')]=function(_0x13b8cd,_0x32a99e){var _0x2a5bdc={},_0x3cedd2={},_0x1011a3={'count':0x0,'rows':[]};var _0x12a465=_[_0x77ea('0x27')](db[_0x77ea('0x28')]['rawAttributes'],function(_0x16bd7d){return{'name':_0x16bd7d[_0x77ea('0x29')],'type':_0x16bd7d[_0x77ea('0x2a')]['key']};});_0x3cedd2[_0x77ea('0x2b')]=_['map'](_0x12a465,'name');_0x3cedd2[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x13b8cd[_0x77ea('0x2c')]);_0x3cedd2[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3cedd2[_0x77ea('0x2b')],_0x3cedd2['query']);_0x2a5bdc[_0x77ea('0x30')]=_['intersection'](_0x3cedd2[_0x77ea('0x2b')],qs[_0x77ea('0x31')](_0x13b8cd[_0x77ea('0x2c')]['fields']));_0x2a5bdc[_0x77ea('0x30')]=_0x2a5bdc[_0x77ea('0x30')][_0x77ea('0x32')]?_0x2a5bdc[_0x77ea('0x30')]:_0x3cedd2[_0x77ea('0x2b')];if(!_0x13b8cd[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x2a5bdc[_0x77ea('0x19')]=qs['limit'](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x2a5bdc[_0x77ea('0x18')]=qs['offset'](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x18')]);}_0x2a5bdc[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x35')]);_0x2a5bdc[_0x77ea('0x36')]=qs[_0x77ea('0x2e')](_[_0x77ea('0x37')](_0x13b8cd['query'],_0x3cedd2[_0x77ea('0x2e')]),_0x12a465);if(_0x13b8cd[_0x77ea('0x2c')]['filter']){_0x2a5bdc[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x2a5bdc[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x12a465,function(_0x16b47b){if(_0x16b47b[_0x77ea('0x2a')]!==_0x77ea('0x39')){var _0x620ca9={};_0x620ca9[_0x16b47b[_0x77ea('0x24')]]={'$like':'%'+_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x3a')]+'%'};return _0x620ca9;}})});}_0x2a5bdc=_[_0x77ea('0x38')]({},_0x2a5bdc,_0x13b8cd[_0x77ea('0x3b')]);var _0xf9276d={'where':_0x2a5bdc[_0x77ea('0x36')]};return db[_0x77ea('0x28')][_0x77ea('0x1b')](_0xf9276d)[_0x77ea('0x21')](function(_0x53b820){_0x1011a3[_0x77ea('0x1b')]=_0x53b820;if(_0x13b8cd[_0x77ea('0x2c')][_0x77ea('0x3c')]){_0x2a5bdc[_0x77ea('0x3d')]=[{'all':!![]}];}return db[_0x77ea('0x28')][_0x77ea('0x3e')](_0x2a5bdc);})[_0x77ea('0x21')](function(_0x2aaafc){_0x1011a3['rows']=_0x2aaafc;return _0x1011a3;})[_0x77ea('0x21')](respondWithFilteredResult(_0x32a99e,_0x2a5bdc))['catch'](handleError(_0x32a99e,null));};exports[_0x77ea('0x3f')]=function(_0x35b9b3,_0x165f69){var _0x39d196={'raw':![],'where':{'id':_0x35b9b3['params']['id']}},_0x4e783a={};_0x4e783a[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db[_0x77ea('0x28')][_0x77ea('0x40')]);_0x4e783a[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x35b9b3[_0x77ea('0x2c')]);_0x4e783a['filters']=_[_0x77ea('0x2f')](_0x4e783a[_0x77ea('0x2b')],_0x4e783a['query']);_0x39d196['attributes']=_[_0x77ea('0x2f')](_0x4e783a[_0x77ea('0x2b')],qs[_0x77ea('0x31')](_0x35b9b3[_0x77ea('0x2c')]['fields']));_0x39d196[_0x77ea('0x30')]=_0x39d196[_0x77ea('0x30')][_0x77ea('0x32')]?_0x39d196[_0x77ea('0x30')]:_0x4e783a['model'];if(_0x35b9b3[_0x77ea('0x2c')][_0x77ea('0x3c')]){_0x39d196['include']=[{'all':!![]}];}_0x39d196=_['merge']({},_0x39d196,_0x35b9b3[_0x77ea('0x3b')]);return db[_0x77ea('0x28')][_0x77ea('0x41')](_0x39d196)[_0x77ea('0x21')](handleEntityNotFound(_0x165f69,null))[_0x77ea('0x21')](respondWithResult(_0x165f69,null))[_0x77ea('0x42')](handleError(_0x165f69,null));};exports[_0x77ea('0x43')]=function(_0xfed73,_0x191a1d){return db[_0x77ea('0x28')][_0x77ea('0x43')](_0xfed73[_0x77ea('0x44')],{})[_0x77ea('0x21')](respondWithResult(_0x191a1d,0xc9))[_0x77ea('0x42')](handleError(_0x191a1d,null));};exports[_0x77ea('0x20')]=function(_0x57ea2a,_0x37768e){if(_0x57ea2a[_0x77ea('0x44')]['id']){delete _0x57ea2a[_0x77ea('0x44')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x57ea2a[_0x77ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x37768e,null))['then'](saveUpdates(_0x57ea2a[_0x77ea('0x44')],null))[_0x77ea('0x21')](respondWithResult(_0x37768e,null))['catch'](handleError(_0x37768e,null));};exports[_0x77ea('0x22')]=function(_0x24bc15,_0x1db656){return db['SugarcrmConfiguration'][_0x77ea('0x41')]({'where':{'id':_0x24bc15['params']['id']}})['then'](handleEntityNotFound(_0x1db656,null))[_0x77ea('0x21')](removeEntity(_0x1db656,null))[_0x77ea('0x42')](handleError(_0x1db656,null));};exports[_0x77ea('0x46')]=function(_0x4c513e,_0x5689b5,_0x23e0f5){var _0x3fc652={};var _0x3f135b={};var _0x5eae76;var _0x1d778f;return db[_0x77ea('0x28')]['findOne']({'where':{'id':_0x4c513e[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x5689b5,null))['then'](function(_0x53b85d){if(_0x53b85d){_0x5eae76=_0x53b85d;_0x3f135b[_0x77ea('0x2b')]=_['keys'](db[_0x77ea('0x47')]['rawAttributes']);_0x3f135b[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x4c513e[_0x77ea('0x2c')]);_0x3f135b[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3f135b[_0x77ea('0x2b')],_0x3f135b[_0x77ea('0x2c')]);_0x3fc652[_0x77ea('0x30')]=_['intersection'](_0x3f135b['model'],qs[_0x77ea('0x31')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x3fc652[_0x77ea('0x30')]=_0x3fc652[_0x77ea('0x30')]['length']?_0x3fc652[_0x77ea('0x30')]:_0x3f135b[_0x77ea('0x2b')];_0x3fc652[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x4c513e['query'][_0x77ea('0x35')]);_0x3fc652['where']=qs[_0x77ea('0x2e')](_['pick'](_0x4c513e[_0x77ea('0x2c')],_0x3f135b['filters']));if(_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x3a')]){_0x3fc652[_0x77ea('0x36')]=_['merge'](_0x3fc652[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x3fc652['attributes'],function(_0x524b04){var _0x17f846={};_0x17f846[_0x524b04]={'$like':'%'+_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x3a')]+'%'};return _0x17f846;})});}_0x3fc652=_['merge']({},_0x3fc652,_0x4c513e[_0x77ea('0x3b')]);return _0x5eae76[_0x77ea('0x46')](_0x3fc652);}})[_0x77ea('0x21')](function(_0x478f80){if(_0x478f80){_0x1d778f=_0x478f80['length'];if(!_0x4c513e['query'][_0x77ea('0x48')](_0x77ea('0x33'))){_0x3fc652[_0x77ea('0x19')]=qs[_0x77ea('0x19')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x3fc652[_0x77ea('0x18')]=qs[_0x77ea('0x18')](_0x4c513e[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x5eae76[_0x77ea('0x46')](_0x3fc652);}})['then'](function(_0x47378f){if(_0x47378f){return _0x47378f?{'count':_0x1d778f,'rows':_0x47378f}:null;}})[_0x77ea('0x21')](respondWithResult(_0x5689b5,null))[_0x77ea('0x42')](handleError(_0x5689b5,null));};exports['getSubjects']=function(_0x5179e2,_0x2f7bc9,_0x321de0){var _0x2cc33d={};var _0x3bd34a={};var _0x210d8d;var _0x197281;return db[_0x77ea('0x28')][_0x77ea('0x49')]({'where':{'id':_0x5179e2[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x2f7bc9,null))['then'](function(_0x57c53f){if(_0x57c53f){_0x210d8d=_0x57c53f;_0x3bd34a[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db['SugarcrmField'][_0x77ea('0x40')]);_0x3bd34a[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x5179e2[_0x77ea('0x2c')]);_0x3bd34a['filters']=_[_0x77ea('0x2f')](_0x3bd34a[_0x77ea('0x2b')],_0x3bd34a[_0x77ea('0x2c')]);_0x2cc33d[_0x77ea('0x30')]=_[_0x77ea('0x2f')](_0x3bd34a['model'],qs['fields'](_0x5179e2[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x2cc33d[_0x77ea('0x30')]=_0x2cc33d[_0x77ea('0x30')][_0x77ea('0x32')]?_0x2cc33d[_0x77ea('0x30')]:_0x3bd34a[_0x77ea('0x2b')];_0x2cc33d[_0x77ea('0x34')]=qs['sort'](_0x5179e2[_0x77ea('0x2c')]['sort']);_0x2cc33d[_0x77ea('0x36')]=qs['filters'](_[_0x77ea('0x37')](_0x5179e2['query'],_0x3bd34a['filters']));if(_0x5179e2['query']['filter']){_0x2cc33d[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x2cc33d[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x2cc33d['attributes'],function(_0x398cda){var _0x52d64f={};_0x52d64f[_0x398cda]={'$like':'%'+_0x5179e2['query'][_0x77ea('0x3a')]+'%'};return _0x52d64f;})});}_0x2cc33d=_[_0x77ea('0x38')]({},_0x2cc33d,_0x5179e2['options']);return _0x210d8d['getSubjects'](_0x2cc33d);}})[_0x77ea('0x21')](function(_0x523ece){if(_0x523ece){_0x197281=_0x523ece[_0x77ea('0x32')];if(!_0x5179e2[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x2cc33d[_0x77ea('0x19')]=qs[_0x77ea('0x19')](_0x5179e2['query']['limit']);_0x2cc33d[_0x77ea('0x18')]=qs[_0x77ea('0x18')](_0x5179e2[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x210d8d[_0x77ea('0x4a')](_0x2cc33d);}})[_0x77ea('0x21')](function(_0x112ca3){if(_0x112ca3){return _0x112ca3?{'count':_0x197281,'rows':_0x112ca3}:null;}})[_0x77ea('0x21')](respondWithResult(_0x2f7bc9,null))[_0x77ea('0x42')](handleError(_0x2f7bc9,null));};exports[_0x77ea('0x4b')]=function(_0x33f84a,_0x298bc1,_0x2059e7){var _0x13de01={};var _0x3e6b90={};var _0x114ff1;var _0x11a639;return db[_0x77ea('0x28')][_0x77ea('0x49')]({'where':{'id':_0x33f84a[_0x77ea('0x45')]['id']}})[_0x77ea('0x21')](handleEntityNotFound(_0x298bc1,null))[_0x77ea('0x21')](function(_0x35c46c){if(_0x35c46c){_0x114ff1=_0x35c46c;_0x3e6b90[_0x77ea('0x2b')]=_[_0x77ea('0x2d')](db[_0x77ea('0x47')][_0x77ea('0x40')]);_0x3e6b90[_0x77ea('0x2c')]=_[_0x77ea('0x2d')](_0x33f84a[_0x77ea('0x2c')]);_0x3e6b90[_0x77ea('0x2e')]=_[_0x77ea('0x2f')](_0x3e6b90[_0x77ea('0x2b')],_0x3e6b90[_0x77ea('0x2c')]);_0x13de01[_0x77ea('0x30')]=_['intersection'](_0x3e6b90[_0x77ea('0x2b')],qs['fields'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x31')]));_0x13de01[_0x77ea('0x30')]=_0x13de01[_0x77ea('0x30')]['length']?_0x13de01[_0x77ea('0x30')]:_0x3e6b90[_0x77ea('0x2b')];_0x13de01[_0x77ea('0x34')]=qs[_0x77ea('0x35')](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x35')]);_0x13de01[_0x77ea('0x36')]=qs[_0x77ea('0x2e')](_[_0x77ea('0x37')](_0x33f84a['query'],_0x3e6b90['filters']));if(_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x3a')]){_0x13de01[_0x77ea('0x36')]=_[_0x77ea('0x38')](_0x13de01[_0x77ea('0x36')],{'$or':_[_0x77ea('0x27')](_0x13de01['attributes'],function(_0x23b5c2){var _0x3bc818={};_0x3bc818[_0x23b5c2]={'$like':'%'+_0x33f84a['query']['filter']+'%'};return _0x3bc818;})});}_0x13de01=_['merge']({},_0x13de01,_0x33f84a['options']);return _0x114ff1['getDescriptions'](_0x13de01);}})[_0x77ea('0x21')](function(_0x3820f1){if(_0x3820f1){_0x11a639=_0x3820f1[_0x77ea('0x32')];if(!_0x33f84a[_0x77ea('0x2c')]['hasOwnProperty'](_0x77ea('0x33'))){_0x13de01[_0x77ea('0x19')]=qs['limit'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x19')]);_0x13de01[_0x77ea('0x18')]=qs['offset'](_0x33f84a[_0x77ea('0x2c')][_0x77ea('0x18')]);}return _0x114ff1['getDescriptions'](_0x13de01);}})['then'](function(_0x3c4bba){if(_0x3c4bba){return _0x3c4bba?{'count':_0x11a639,'rows':_0x3c4bba}:null;}})[_0x77ea('0x21')](respondWithResult(_0x298bc1,null))['catch'](handleError(_0x298bc1,null));}; \ No newline at end of file +var _0x3061=['destroy','getFields','SugarcrmField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SugarcrmConfiguration','rows','catch','show','find','create','body','params'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3061,0xec));var _0x1306=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x3061[_0x4d7a70];return _0x3aafbb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1306('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1306('0x1'));var moment=require(_0x1306('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1306('0x3'));var util=require('util');var path=require(_0x1306('0x4'));var sox=require(_0x1306('0x5'));var csv=require(_0x1306('0x6'));var ejs=require(_0x1306('0x7'));var fs=require('fs');var fs_extra=require(_0x1306('0x8'));var _=require(_0x1306('0x9'));var squel=require(_0x1306('0xa'));var crypto=require(_0x1306('0xb'));var jsforce=require(_0x1306('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1306('0x6'));var querystring=require(_0x1306('0xd'));var Papa=require(_0x1306('0xe'));var Redis=require(_0x1306('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1306('0x10'));var as=require(_0x1306('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1306('0x12'))('api');var utils=require(_0x1306('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1306('0x14'))['db'];function respondWithStatusCode(_0x1bdfeb,_0x5bfbf1){_0x5bfbf1=_0x5bfbf1||0xcc;return function(_0x366d31){if(_0x366d31){return _0x1bdfeb[_0x1306('0x15')](_0x5bfbf1);}return _0x1bdfeb[_0x1306('0x16')](_0x5bfbf1)[_0x1306('0x17')]();};}function respondWithResult(_0x5175ab,_0x386886){_0x386886=_0x386886||0xc8;return function(_0x541de4){if(_0x541de4){return _0x5175ab[_0x1306('0x16')](_0x386886)[_0x1306('0x18')](_0x541de4);}};}function respondWithFilteredResult(_0x1c7dcb,_0x507119){return function(_0x3ec87b){if(_0x3ec87b){var _0xae8e5c=typeof _0x507119[_0x1306('0x19')]===_0x1306('0x1a')&&typeof _0x507119['limit']===_0x1306('0x1a');var _0x2b60af=_0x3ec87b[_0x1306('0x1b')];var _0x4f5465=_0xae8e5c?0x0:_0x507119[_0x1306('0x19')];var _0x45ccc4=_0xae8e5c?_0x3ec87b[_0x1306('0x1b')]:_0x507119['offset']+_0x507119[_0x1306('0x1c')];var _0x356148;if(_0x45ccc4>=_0x2b60af){_0x45ccc4=_0x2b60af;_0x356148=0xc8;}else{_0x356148=0xce;}_0x1c7dcb[_0x1306('0x16')](_0x356148);return _0x1c7dcb[_0x1306('0x1d')]('Content-Range',_0x4f5465+'-'+_0x45ccc4+'/'+_0x2b60af)[_0x1306('0x18')](_0x3ec87b);}return null;};}function patchUpdates(_0x2f6d90){return function(_0x2edc8a){try{jsonpatch[_0x1306('0x1e')](_0x2edc8a,_0x2f6d90,!![]);}catch(_0x4694f7){return BPromise[_0x1306('0x1f')](_0x4694f7);}return _0x2edc8a['save']();};}function saveUpdates(_0x54afca,_0x2c2c1a){return function(_0x6386d6){if(_0x6386d6){return _0x6386d6[_0x1306('0x20')](_0x54afca)[_0x1306('0x21')](function(_0x7abca0){return _0x7abca0;});}return null;};}function removeEntity(_0xb0a288,_0x56e53c){return function(_0x27dd14){if(_0x27dd14){return _0x27dd14['destroy']()[_0x1306('0x21')](function(){_0xb0a288['status'](0xcc)[_0x1306('0x17')]();});}};}function handleEntityNotFound(_0x54503d,_0x4facfd){return function(_0x2384ff){if(!_0x2384ff){_0x54503d[_0x1306('0x15')](0x194);}return _0x2384ff;};}function handleError(_0x2dec9c,_0xc55790){_0xc55790=_0xc55790||0x1f4;return function(_0x39cfa4){logger[_0x1306('0x22')](_0x39cfa4[_0x1306('0x23')]);if(_0x39cfa4[_0x1306('0x24')]){delete _0x39cfa4[_0x1306('0x24')];}_0x2dec9c['status'](_0xc55790)[_0x1306('0x25')](_0x39cfa4);};}exports[_0x1306('0x26')]=function(_0x54d112,_0x48550b){var _0x2c9969={},_0x2b60de={},_0x4e526d={'count':0x0,'rows':[]};var _0x134147=_[_0x1306('0x27')](db['SugarcrmConfiguration'][_0x1306('0x28')],function(_0x39bd90){return{'name':_0x39bd90[_0x1306('0x29')],'type':_0x39bd90[_0x1306('0x2a')]['key']};});_0x2b60de[_0x1306('0x2b')]=_['map'](_0x134147,'name');_0x2b60de[_0x1306('0x2c')]=_[_0x1306('0x2d')](_0x54d112[_0x1306('0x2c')]);_0x2b60de[_0x1306('0x2e')]=_['intersection'](_0x2b60de[_0x1306('0x2b')],_0x2b60de[_0x1306('0x2c')]);_0x2c9969[_0x1306('0x2f')]=_[_0x1306('0x30')](_0x2b60de[_0x1306('0x2b')],qs['fields'](_0x54d112['query'][_0x1306('0x31')]));_0x2c9969[_0x1306('0x2f')]=_0x2c9969[_0x1306('0x2f')][_0x1306('0x32')]?_0x2c9969[_0x1306('0x2f')]:_0x2b60de[_0x1306('0x2b')];if(!_0x54d112[_0x1306('0x2c')]['hasOwnProperty']('nolimit')){_0x2c9969[_0x1306('0x1c')]=qs[_0x1306('0x1c')](_0x54d112[_0x1306('0x2c')][_0x1306('0x1c')]);_0x2c9969['offset']=qs[_0x1306('0x19')](_0x54d112[_0x1306('0x2c')][_0x1306('0x19')]);}_0x2c9969[_0x1306('0x33')]=qs['sort'](_0x54d112[_0x1306('0x2c')][_0x1306('0x34')]);_0x2c9969[_0x1306('0x35')]=qs[_0x1306('0x2e')](_['pick'](_0x54d112[_0x1306('0x2c')],_0x2b60de[_0x1306('0x2e')]),_0x134147);if(_0x54d112[_0x1306('0x2c')][_0x1306('0x36')]){_0x2c9969[_0x1306('0x35')]=_[_0x1306('0x37')](_0x2c9969[_0x1306('0x35')],{'$or':_[_0x1306('0x27')](_0x134147,function(_0x3a3c75){if(_0x3a3c75[_0x1306('0x2a')]!==_0x1306('0x38')){var _0x40e37a={};_0x40e37a[_0x3a3c75[_0x1306('0x24')]]={'$like':'%'+_0x54d112[_0x1306('0x2c')][_0x1306('0x36')]+'%'};return _0x40e37a;}})});}_0x2c9969=_[_0x1306('0x37')]({},_0x2c9969,_0x54d112[_0x1306('0x39')]);var _0x57da97={'where':_0x2c9969[_0x1306('0x35')]};return db['SugarcrmConfiguration']['count'](_0x57da97)[_0x1306('0x21')](function(_0x24247f){_0x4e526d[_0x1306('0x1b')]=_0x24247f;if(_0x54d112[_0x1306('0x2c')][_0x1306('0x3a')]){_0x2c9969[_0x1306('0x3b')]=[{'all':!![]}];}return db[_0x1306('0x3c')]['findAll'](_0x2c9969);})[_0x1306('0x21')](function(_0x5698b6){_0x4e526d[_0x1306('0x3d')]=_0x5698b6;return _0x4e526d;})[_0x1306('0x21')](respondWithFilteredResult(_0x48550b,_0x2c9969))[_0x1306('0x3e')](handleError(_0x48550b,null));};exports[_0x1306('0x3f')]=function(_0x41f2c8,_0x15901a){var _0xf11129={'raw':![],'where':{'id':_0x41f2c8['params']['id']}},_0x3935a5={};_0x3935a5[_0x1306('0x2b')]=_['keys'](db[_0x1306('0x3c')][_0x1306('0x28')]);_0x3935a5[_0x1306('0x2c')]=_[_0x1306('0x2d')](_0x41f2c8[_0x1306('0x2c')]);_0x3935a5[_0x1306('0x2e')]=_[_0x1306('0x30')](_0x3935a5['model'],_0x3935a5[_0x1306('0x2c')]);_0xf11129[_0x1306('0x2f')]=_[_0x1306('0x30')](_0x3935a5[_0x1306('0x2b')],qs[_0x1306('0x31')](_0x41f2c8['query'][_0x1306('0x31')]));_0xf11129[_0x1306('0x2f')]=_0xf11129[_0x1306('0x2f')]['length']?_0xf11129[_0x1306('0x2f')]:_0x3935a5[_0x1306('0x2b')];if(_0x41f2c8[_0x1306('0x2c')][_0x1306('0x3a')]){_0xf11129[_0x1306('0x3b')]=[{'all':!![]}];}_0xf11129=_['merge']({},_0xf11129,_0x41f2c8['options']);return db[_0x1306('0x3c')][_0x1306('0x40')](_0xf11129)[_0x1306('0x21')](handleEntityNotFound(_0x15901a,null))[_0x1306('0x21')](respondWithResult(_0x15901a,null))[_0x1306('0x3e')](handleError(_0x15901a,null));};exports[_0x1306('0x41')]=function(_0x5e06ff,_0x657a8f){return db[_0x1306('0x3c')][_0x1306('0x41')](_0x5e06ff[_0x1306('0x42')],{})[_0x1306('0x21')](respondWithResult(_0x657a8f,0xc9))[_0x1306('0x3e')](handleError(_0x657a8f,null));};exports[_0x1306('0x20')]=function(_0x443460,_0x960900){if(_0x443460[_0x1306('0x42')]['id']){delete _0x443460['body']['id'];}return db[_0x1306('0x3c')][_0x1306('0x40')]({'where':{'id':_0x443460[_0x1306('0x43')]['id']}})[_0x1306('0x21')](handleEntityNotFound(_0x960900,null))[_0x1306('0x21')](saveUpdates(_0x443460[_0x1306('0x42')],null))[_0x1306('0x21')](respondWithResult(_0x960900,null))[_0x1306('0x3e')](handleError(_0x960900,null));};exports[_0x1306('0x44')]=function(_0x34c946,_0x467d8d){return db['SugarcrmConfiguration'][_0x1306('0x40')]({'where':{'id':_0x34c946[_0x1306('0x43')]['id']}})[_0x1306('0x21')](handleEntityNotFound(_0x467d8d,null))[_0x1306('0x21')](removeEntity(_0x467d8d,null))[_0x1306('0x3e')](handleError(_0x467d8d,null));};exports[_0x1306('0x45')]=function(_0x29eca2,_0x56e909,_0x5c1681){var _0x40f056={};var _0x5cd487={};var _0x3ddbba;var _0x26840d;return db[_0x1306('0x3c')]['findOne']({'where':{'id':_0x29eca2[_0x1306('0x43')]['id']}})[_0x1306('0x21')](handleEntityNotFound(_0x56e909,null))['then'](function(_0x2edd26){if(_0x2edd26){_0x3ddbba=_0x2edd26;_0x5cd487[_0x1306('0x2b')]=_[_0x1306('0x2d')](db[_0x1306('0x46')]['rawAttributes']);_0x5cd487[_0x1306('0x2c')]=_['keys'](_0x29eca2[_0x1306('0x2c')]);_0x5cd487[_0x1306('0x2e')]=_['intersection'](_0x5cd487['model'],_0x5cd487[_0x1306('0x2c')]);_0x40f056[_0x1306('0x2f')]=_[_0x1306('0x30')](_0x5cd487[_0x1306('0x2b')],qs[_0x1306('0x31')](_0x29eca2['query'][_0x1306('0x31')]));_0x40f056[_0x1306('0x2f')]=_0x40f056[_0x1306('0x2f')][_0x1306('0x32')]?_0x40f056[_0x1306('0x2f')]:_0x5cd487['model'];_0x40f056['order']=qs['sort'](_0x29eca2[_0x1306('0x2c')][_0x1306('0x34')]);_0x40f056['where']=qs[_0x1306('0x2e')](_[_0x1306('0x47')](_0x29eca2[_0x1306('0x2c')],_0x5cd487['filters']));if(_0x29eca2[_0x1306('0x2c')]['filter']){_0x40f056['where']=_[_0x1306('0x37')](_0x40f056['where'],{'$or':_[_0x1306('0x27')](_0x40f056[_0x1306('0x2f')],function(_0x3cbc97){var _0x50746b={};_0x50746b[_0x3cbc97]={'$like':'%'+_0x29eca2[_0x1306('0x2c')]['filter']+'%'};return _0x50746b;})});}_0x40f056=_[_0x1306('0x37')]({},_0x40f056,_0x29eca2[_0x1306('0x39')]);return _0x3ddbba[_0x1306('0x45')](_0x40f056);}})[_0x1306('0x21')](function(_0x22c5d3){if(_0x22c5d3){_0x26840d=_0x22c5d3[_0x1306('0x32')];if(!_0x29eca2[_0x1306('0x2c')][_0x1306('0x48')](_0x1306('0x49'))){_0x40f056[_0x1306('0x1c')]=qs[_0x1306('0x1c')](_0x29eca2[_0x1306('0x2c')][_0x1306('0x1c')]);_0x40f056['offset']=qs[_0x1306('0x19')](_0x29eca2[_0x1306('0x2c')][_0x1306('0x19')]);}return _0x3ddbba[_0x1306('0x45')](_0x40f056);}})[_0x1306('0x21')](function(_0x3cfdb7){if(_0x3cfdb7){return _0x3cfdb7?{'count':_0x26840d,'rows':_0x3cfdb7}:null;}})[_0x1306('0x21')](respondWithResult(_0x56e909,null))[_0x1306('0x3e')](handleError(_0x56e909,null));};exports[_0x1306('0x4a')]=function(_0x145f11,_0xa8a63f,_0x46d16c){var _0x523233={};var _0x34daea={};var _0x57c615;var _0x32a48e;return db[_0x1306('0x3c')]['findOne']({'where':{'id':_0x145f11[_0x1306('0x43')]['id']}})['then'](handleEntityNotFound(_0xa8a63f,null))[_0x1306('0x21')](function(_0x1c9670){if(_0x1c9670){_0x57c615=_0x1c9670;_0x34daea[_0x1306('0x2b')]=_[_0x1306('0x2d')](db[_0x1306('0x46')][_0x1306('0x28')]);_0x34daea['query']=_['keys'](_0x145f11['query']);_0x34daea[_0x1306('0x2e')]=_[_0x1306('0x30')](_0x34daea[_0x1306('0x2b')],_0x34daea[_0x1306('0x2c')]);_0x523233[_0x1306('0x2f')]=_['intersection'](_0x34daea[_0x1306('0x2b')],qs['fields'](_0x145f11[_0x1306('0x2c')][_0x1306('0x31')]));_0x523233[_0x1306('0x2f')]=_0x523233[_0x1306('0x2f')][_0x1306('0x32')]?_0x523233[_0x1306('0x2f')]:_0x34daea[_0x1306('0x2b')];_0x523233[_0x1306('0x33')]=qs[_0x1306('0x34')](_0x145f11[_0x1306('0x2c')][_0x1306('0x34')]);_0x523233['where']=qs[_0x1306('0x2e')](_[_0x1306('0x47')](_0x145f11['query'],_0x34daea[_0x1306('0x2e')]));if(_0x145f11['query'][_0x1306('0x36')]){_0x523233[_0x1306('0x35')]=_[_0x1306('0x37')](_0x523233['where'],{'$or':_['map'](_0x523233[_0x1306('0x2f')],function(_0x3b552d){var _0x47019c={};_0x47019c[_0x3b552d]={'$like':'%'+_0x145f11['query']['filter']+'%'};return _0x47019c;})});}_0x523233=_[_0x1306('0x37')]({},_0x523233,_0x145f11['options']);return _0x57c615['getSubjects'](_0x523233);}})[_0x1306('0x21')](function(_0x1a40b1){if(_0x1a40b1){_0x32a48e=_0x1a40b1['length'];if(!_0x145f11[_0x1306('0x2c')][_0x1306('0x48')](_0x1306('0x49'))){_0x523233[_0x1306('0x1c')]=qs[_0x1306('0x1c')](_0x145f11[_0x1306('0x2c')][_0x1306('0x1c')]);_0x523233[_0x1306('0x19')]=qs[_0x1306('0x19')](_0x145f11['query'][_0x1306('0x19')]);}return _0x57c615['getSubjects'](_0x523233);}})['then'](function(_0x162194){if(_0x162194){return _0x162194?{'count':_0x32a48e,'rows':_0x162194}:null;}})[_0x1306('0x21')](respondWithResult(_0xa8a63f,null))[_0x1306('0x3e')](handleError(_0xa8a63f,null));};exports[_0x1306('0x4b')]=function(_0x35d07a,_0x1ce6ed,_0x8e939f){var _0x3f1da5={};var _0x7bc3cb={};var _0x3892af;var _0x3ef006;return db[_0x1306('0x3c')]['findOne']({'where':{'id':_0x35d07a[_0x1306('0x43')]['id']}})[_0x1306('0x21')](handleEntityNotFound(_0x1ce6ed,null))[_0x1306('0x21')](function(_0x192e08){if(_0x192e08){_0x3892af=_0x192e08;_0x7bc3cb[_0x1306('0x2b')]=_['keys'](db[_0x1306('0x46')]['rawAttributes']);_0x7bc3cb[_0x1306('0x2c')]=_[_0x1306('0x2d')](_0x35d07a[_0x1306('0x2c')]);_0x7bc3cb['filters']=_['intersection'](_0x7bc3cb[_0x1306('0x2b')],_0x7bc3cb[_0x1306('0x2c')]);_0x3f1da5[_0x1306('0x2f')]=_['intersection'](_0x7bc3cb[_0x1306('0x2b')],qs['fields'](_0x35d07a[_0x1306('0x2c')][_0x1306('0x31')]));_0x3f1da5[_0x1306('0x2f')]=_0x3f1da5[_0x1306('0x2f')]['length']?_0x3f1da5[_0x1306('0x2f')]:_0x7bc3cb[_0x1306('0x2b')];_0x3f1da5[_0x1306('0x33')]=qs[_0x1306('0x34')](_0x35d07a['query'][_0x1306('0x34')]);_0x3f1da5[_0x1306('0x35')]=qs[_0x1306('0x2e')](_['pick'](_0x35d07a[_0x1306('0x2c')],_0x7bc3cb[_0x1306('0x2e')]));if(_0x35d07a[_0x1306('0x2c')][_0x1306('0x36')]){_0x3f1da5['where']=_['merge'](_0x3f1da5[_0x1306('0x35')],{'$or':_[_0x1306('0x27')](_0x3f1da5[_0x1306('0x2f')],function(_0x565dea){var _0x2e4435={};_0x2e4435[_0x565dea]={'$like':'%'+_0x35d07a['query'][_0x1306('0x36')]+'%'};return _0x2e4435;})});}_0x3f1da5=_[_0x1306('0x37')]({},_0x3f1da5,_0x35d07a['options']);return _0x3892af[_0x1306('0x4b')](_0x3f1da5);}})[_0x1306('0x21')](function(_0x34462b){if(_0x34462b){_0x3ef006=_0x34462b[_0x1306('0x32')];if(!_0x35d07a[_0x1306('0x2c')][_0x1306('0x48')](_0x1306('0x49'))){_0x3f1da5[_0x1306('0x1c')]=qs[_0x1306('0x1c')](_0x35d07a[_0x1306('0x2c')][_0x1306('0x1c')]);_0x3f1da5['offset']=qs[_0x1306('0x19')](_0x35d07a['query']['offset']);}return _0x3892af['getDescriptions'](_0x3f1da5);}})[_0x1306('0x21')](function(_0x2bb091){if(_0x2bb091){return _0x2bb091?{'count':_0x3ef006,'rows':_0x2bb091}:null;}})[_0x1306('0x21')](respondWithResult(_0x1ce6ed,null))[_0x1306('0x3e')](handleError(_0x1ce6ed,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8fb1653..904dc18 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 _0x814c=['request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3cdfdb,_0x40545d){var _0x57d4d8=function(_0x3e7f86){while(--_0x3e7f86){_0x3cdfdb['push'](_0x3cdfdb['shift']());}};_0x57d4d8(++_0x40545d);}(_0x814c,0xd3));var _0xc814=function(_0x60cc61,_0x563ce9){_0x60cc61=_0x60cc61-0x0;var _0x4824b6=_0x814c[_0x60cc61];return _0x4824b6;};'use strict';var _=require(_0xc814('0x0'));var util=require(_0xc814('0x1'));var logger=require(_0xc814('0x2'))('api');var moment=require(_0xc814('0x3'));var BPromise=require(_0xc814('0x4'));var rp=require(_0xc814('0x5'));var fs=require('fs');var path=require(_0xc814('0x6'));var rimraf=require(_0xc814('0x7'));var config=require(_0xc814('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x460fa8,_0x36c7c5){return _0x460fa8[_0xc814('0x9')](_0xc814('0xa'),attributes,{'tableName':_0xc814('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec65=['../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4eb523,_0x415f1a){var _0x492577=function(_0x54a656){while(--_0x54a656){_0x4eb523['push'](_0x4eb523['shift']());}};_0x492577(++_0x415f1a);}(_0xec65,0x1ed));var _0x5ec6=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0xec65[_0x5ad190];return _0x518ed3;};'use strict';var _=require(_0x5ec6('0x0'));var util=require(_0x5ec6('0x1'));var logger=require(_0x5ec6('0x2'))('api');var moment=require(_0x5ec6('0x3'));var BPromise=require(_0x5ec6('0x4'));var rp=require(_0x5ec6('0x5'));var fs=require('fs');var path=require(_0x5ec6('0x6'));var rimraf=require('rimraf');var config=require(_0x5ec6('0x7'));var attributes=require(_0x5ec6('0x8'));module['exports']=function(_0x2b671a,_0x4232ae){return _0x2b671a['define'](_0x5ec6('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 3534789..3d146ca 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 _0x07a5=['moment','bluebird','randomstring','../../config/utils','../../config/logger','http','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x426897,_0xd4bbb0){var _0x185fa7=function(_0x58342f){while(--_0x58342f){_0x426897['push'](_0x426897['shift']());}};_0x185fa7(++_0xd4bbb0);}(_0x07a5,0x154));var _0x507a=function(_0x2f1089,_0x42d03d){_0x2f1089=_0x2f1089-0x0;var _0x1af573=_0x07a5[_0x2f1089];return _0x1af573;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x507a('0x0'));var BPromise=require(_0x507a('0x1'));var rs=require(_0x507a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x507a('0x3'));var logger=require(_0x507a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x507a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5031bb,_0xed7e8,_0x4daec7){return new BPromise(function(_0x36d06b,_0x47d03c){return client['request'](_0x5031bb,_0x4daec7)[_0x507a('0x6')](function(_0x3cd369){logger[_0x507a('0x7')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xed7e8,'request\x20sent');logger[_0x507a('0x8')](_0x507a('0x9'),_0xed7e8,_0x507a('0xa'),JSON['stringify'](_0x3cd369));if(_0x3cd369[_0x507a('0xb')]){if(_0x3cd369[_0x507a('0xb')][_0x507a('0xc')]===0x1f4){logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);return _0x47d03c(_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);}logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x3cd369[_0x507a('0xb')][_0x507a('0xe')]);return _0x36d06b(_0x3cd369['error'][_0x507a('0xe')]);}else{logger['info'](_0x507a('0xd'),_0xed7e8,_0x507a('0xa'));_0x36d06b(_0x3cd369[_0x507a('0xf')][_0x507a('0xe')]);}})[_0x507a('0x10')](function(_0x5746b5){logger[_0x507a('0xb')](_0x507a('0xd'),_0xed7e8,_0x5746b5);_0x47d03c(_0x5746b5);});});} \ No newline at end of file +var _0x9ace=['../../config/environment','jayson/promise','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc'];(function(_0x47158e,_0x537f1d){var _0x42a4e5=function(_0x564ebb){while(--_0x564ebb){_0x47158e['push'](_0x47158e['shift']());}};_0x42a4e5(++_0x537f1d);}(_0x9ace,0x162));var _0xe9ac=function(_0x5799e1,_0x789913){_0x5799e1=_0x5799e1-0x0;var _0x271eb3=_0x9ace[_0x5799e1];return _0x271eb3;};'use strict';var _=require(_0xe9ac('0x0'));var util=require(_0xe9ac('0x1'));var moment=require(_0xe9ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9ac('0x5'));var config=require(_0xe9ac('0x6'));var jayson=require(_0xe9ac('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x65d8c6,_0x550d53,_0x2be38d){return new BPromise(function(_0x3d394f,_0x296282){return client[_0xe9ac('0x8')](_0x65d8c6,_0x2be38d)['then'](function(_0x58c78a){logger[_0xe9ac('0x9')](_0xe9ac('0xa'),_0x550d53,_0xe9ac('0xb'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x550d53,_0xe9ac('0xb'),JSON[_0xe9ac('0xc')](_0x58c78a));if(_0x58c78a[_0xe9ac('0xd')]){if(_0x58c78a[_0xe9ac('0xd')][_0xe9ac('0xe')]===0x1f4){logger[_0xe9ac('0xd')](_0xe9ac('0xa'),_0x550d53,_0x58c78a[_0xe9ac('0xd')][_0xe9ac('0xf')]);return _0x296282(_0x58c78a['error']['message']);}logger['error'](_0xe9ac('0xa'),_0x550d53,_0x58c78a[_0xe9ac('0xd')][_0xe9ac('0xf')]);return _0x3d394f(_0x58c78a[_0xe9ac('0xd')][_0xe9ac('0xf')]);}else{logger[_0xe9ac('0x9')](_0xe9ac('0xa'),_0x550d53,_0xe9ac('0xb'));_0x3d394f(_0x58c78a[_0xe9ac('0x10')][_0xe9ac('0xf')]);}})[_0xe9ac('0x11')](function(_0x418a02){logger[_0xe9ac('0xd')](_0xe9ac('0xa'),_0x550d53,_0x418a02);_0x296282(_0x418a02);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c43133a..058c0ab 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 _0xd126=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd126,0xe8));var _0x6d12=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0xd126[_0x4da382];return _0x10073f;};'use strict';var multer=require(_0x6d12('0x0'));var util=require(_0x6d12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d12('0x2'));var router=express[_0x6d12('0x3')]();var fs_extra=require(_0x6d12('0x4'));var auth=require(_0x6d12('0x5'));var interaction=require(_0x6d12('0x6'));var config=require('../../config/environment');var controller=require(_0x6d12('0x7'));router[_0x6d12('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6d12('0x9'),auth['isAuthenticated'](),controller[_0x6d12('0xa')]);router[_0x6d12('0xb')]('/',auth[_0x6d12('0xc')](),controller[_0x6d12('0xd')]);router[_0x6d12('0xe')](_0x6d12('0x9'),auth['isAuthenticated'](),controller[_0x6d12('0xf')]);router[_0x6d12('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6d12('0x11')]);module[_0x6d12('0x12')]=router; \ No newline at end of file +var _0xf415=['isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x56bba1,_0x15a552){var _0x225e54=function(_0x1e7ec5){while(--_0x1e7ec5){_0x56bba1['push'](_0x56bba1['shift']());}};_0x225e54(++_0x15a552);}(_0xf415,0x197));var _0x5f41=function(_0x37c8ca,_0x104b95){_0x37c8ca=_0x37c8ca-0x0;var _0x33fd32=_0xf415[_0x37c8ca];return _0x33fd32;};'use strict';var multer=require(_0x5f41('0x0'));var util=require(_0x5f41('0x1'));var path=require(_0x5f41('0x2'));var timeout=require(_0x5f41('0x3'));var express=require(_0x5f41('0x4'));var router=express[_0x5f41('0x5')]();var fs_extra=require(_0x5f41('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5f41('0x7'));var config=require(_0x5f41('0x8'));var controller=require(_0x5f41('0x9'));router[_0x5f41('0xa')]('/',auth[_0x5f41('0xb')](),controller[_0x5f41('0xc')]);router[_0x5f41('0xa')](_0x5f41('0xd'),auth['isAuthenticated'](),controller[_0x5f41('0xe')]);router['post']('/',auth[_0x5f41('0xb')](),controller[_0x5f41('0xf')]);router[_0x5f41('0x10')](_0x5f41('0xd'),auth[_0x5f41('0xb')](),controller[_0x5f41('0x11')]);router['delete']('/:id',auth[_0x5f41('0xb')](),controller[_0x5f41('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index aa88ae7..13ca171 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 _0xf2ac=['STRING','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x2688d8,_0x5e544b){var _0x5e8f99=function(_0x4041f0){while(--_0x4041f0){_0x2688d8['push'](_0x2688d8['shift']());}};_0x5e8f99(++_0x5e544b);}(_0xf2ac,0x1c1));var _0xcf2a=function(_0x29249d,_0x26c095){_0x29249d=_0x29249d-0x0;var _0x572db9=_0xf2ac[_0x29249d];return _0x572db9;};'use strict';var Sequelize=require(_0xcf2a('0x0'));module[_0xcf2a('0x1')]={'type':{'type':Sequelize[_0xcf2a('0x2')](_0xcf2a('0x3'),_0xcf2a('0x4'),'customVariable',_0xcf2a('0x5'),_0xcf2a('0x6')),'defaultValue':_0xcf2a('0x3')},'content':{'type':Sequelize[_0xcf2a('0x7')]},'key':{'type':Sequelize[_0xcf2a('0x7')]},'keyType':{'type':Sequelize[_0xcf2a('0x2')]('string',_0xcf2a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcf2a('0x7')]},'idField':{'type':Sequelize[_0xcf2a('0x7')]},'nameField':{'type':Sequelize[_0xcf2a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf2a('0x7')]}}; \ No newline at end of file +var _0xd926=['customVariable','keyValue','STRING','string','BOOLEAN','exports','variable'];(function(_0x543fd7,_0x40391f){var _0x1dd397=function(_0x25ebcf){while(--_0x25ebcf){_0x543fd7['push'](_0x543fd7['shift']());}};_0x1dd397(++_0x40391f);}(_0xd926,0x17f));var _0x6d92=function(_0x33e8fe,_0x66ba07){_0x33e8fe=_0x33e8fe-0x0;var _0xd57085=_0xd926[_0x33e8fe];return _0xd57085;};'use strict';var Sequelize=require('sequelize');module[_0x6d92('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x6d92('0x1'),_0x6d92('0x2'),_0x6d92('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6d92('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x6d92('0x5'),'variable',_0x6d92('0x2'))},'keyContent':{'type':Sequelize[_0x6d92('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6d92('0x4')]},'customField':{'type':Sequelize[_0x6d92('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d92('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c733a5e..d855c65 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 _0xe0b8=['desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','sendStatus','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x2579e8,_0xcaef90){var _0x56c607=function(_0x596c73){while(--_0x596c73){_0x2579e8['push'](_0x2579e8['shift']());}};_0x56c607(++_0xcaef90);}(_0xe0b8,0x1ec));var _0x8e0b=function(_0x4db0ad,_0x39acd0){_0x4db0ad=_0x4db0ad-0x0;var _0x989cd2=_0xe0b8[_0x4db0ad];return _0x989cd2;};'use strict';var emlformat=require(_0x8e0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e0b('0x1'));var jsonpatch=require(_0x8e0b('0x2'));var rp=require(_0x8e0b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e0b('0x4'));var util=require(_0x8e0b('0x5'));var path=require(_0x8e0b('0x6'));var sox=require('sox');var csv=require(_0x8e0b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e0b('0x8'));var _=require(_0x8e0b('0x9'));var squel=require('squel');var crypto=require(_0x8e0b('0xa'));var jsforce=require(_0x8e0b('0xb'));var deskjs=require(_0x8e0b('0xc'));var toCsv=require(_0x8e0b('0x7'));var querystring=require('querystring');var Papa=require(_0x8e0b('0xd'));var Redis=require(_0x8e0b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e0b('0xf'));var logger=require(_0x8e0b('0x10'))('api');var utils=require(_0x8e0b('0x11'));var config=require(_0x8e0b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e0b('0x13'))['db'];function respondWithStatusCode(_0x2ade87,_0x4dfa75){_0x4dfa75=_0x4dfa75||0xcc;return function(_0x46078e){if(_0x46078e){return _0x2ade87['sendStatus'](_0x4dfa75);}return _0x2ade87[_0x8e0b('0x14')](_0x4dfa75)[_0x8e0b('0x15')]();};}function respondWithResult(_0x10d7a8,_0x605715){_0x605715=_0x605715||0xc8;return function(_0x921ba8){if(_0x921ba8){return _0x10d7a8[_0x8e0b('0x14')](_0x605715)['json'](_0x921ba8);}};}function respondWithFilteredResult(_0xe24ff1,_0x40b582){return function(_0x902d2f){if(_0x902d2f){var _0x24bdd9=typeof _0x40b582[_0x8e0b('0x16')]===_0x8e0b('0x17')&&typeof _0x40b582['limit']==='undefined';var _0xbaa387=_0x902d2f[_0x8e0b('0x18')];var _0x2aea52=_0x24bdd9?0x0:_0x40b582[_0x8e0b('0x16')];var _0x4a19df=_0x24bdd9?_0x902d2f[_0x8e0b('0x18')]:_0x40b582[_0x8e0b('0x16')]+_0x40b582[_0x8e0b('0x19')];var _0x15ab24;if(_0x4a19df>=_0xbaa387){_0x4a19df=_0xbaa387;_0x15ab24=0xc8;}else{_0x15ab24=0xce;}_0xe24ff1[_0x8e0b('0x14')](_0x15ab24);return _0xe24ff1[_0x8e0b('0x1a')]('Content-Range',_0x2aea52+'-'+_0x4a19df+'/'+_0xbaa387)[_0x8e0b('0x1b')](_0x902d2f);}return null;};}function patchUpdates(_0x1b6560){return function(_0x109808){try{jsonpatch['apply'](_0x109808,_0x1b6560,!![]);}catch(_0x872a8f){return BPromise[_0x8e0b('0x1c')](_0x872a8f);}return _0x109808[_0x8e0b('0x1d')]();};}function saveUpdates(_0x453cb7,_0x133476){return function(_0x355cba){if(_0x355cba){return _0x355cba[_0x8e0b('0x1e')](_0x453cb7)[_0x8e0b('0x1f')](function(_0x39e784){return _0x39e784;});}return null;};}function removeEntity(_0x1276fb,_0x4a7a2a){return function(_0x29e81f){if(_0x29e81f){return _0x29e81f['destroy']()[_0x8e0b('0x1f')](function(){_0x1276fb['status'](0xcc)[_0x8e0b('0x15')]();});}};}function handleEntityNotFound(_0x1c521a,_0x245593){return function(_0x1984c0){if(!_0x1984c0){_0x1c521a[_0x8e0b('0x20')](0x194);}return _0x1984c0;};}function handleError(_0x2673dd,_0x5720fa){_0x5720fa=_0x5720fa||0x1f4;return function(_0x4e9cbb){logger[_0x8e0b('0x21')](_0x4e9cbb[_0x8e0b('0x22')]);if(_0x4e9cbb[_0x8e0b('0x23')]){delete _0x4e9cbb[_0x8e0b('0x23')];}_0x2673dd['status'](_0x5720fa)[_0x8e0b('0x24')](_0x4e9cbb);};}exports['index']=function(_0xf501e0,_0x3ffd62){var _0x301ed4={},_0x540e0b={},_0x389119={'count':0x0,'rows':[]};var _0x1e6937=_[_0x8e0b('0x25')](db[_0x8e0b('0x26')][_0x8e0b('0x27')],function(_0x3cd0ba){return{'name':_0x3cd0ba[_0x8e0b('0x28')],'type':_0x3cd0ba[_0x8e0b('0x29')][_0x8e0b('0x2a')]};});_0x540e0b[_0x8e0b('0x2b')]=_[_0x8e0b('0x25')](_0x1e6937,_0x8e0b('0x23'));_0x540e0b['query']=_['keys'](_0xf501e0[_0x8e0b('0x2c')]);_0x540e0b[_0x8e0b('0x2d')]=_[_0x8e0b('0x2e')](_0x540e0b[_0x8e0b('0x2b')],_0x540e0b[_0x8e0b('0x2c')]);_0x301ed4[_0x8e0b('0x2f')]=_[_0x8e0b('0x2e')](_0x540e0b[_0x8e0b('0x2b')],qs[_0x8e0b('0x30')](_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x30')]));_0x301ed4[_0x8e0b('0x2f')]=_0x301ed4[_0x8e0b('0x2f')][_0x8e0b('0x31')]?_0x301ed4['attributes']:_0x540e0b[_0x8e0b('0x2b')];if(!_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x32')](_0x8e0b('0x33'))){_0x301ed4[_0x8e0b('0x19')]=qs['limit'](_0xf501e0[_0x8e0b('0x2c')][_0x8e0b('0x19')]);_0x301ed4[_0x8e0b('0x16')]=qs['offset'](_0xf501e0[_0x8e0b('0x2c')]['offset']);}_0x301ed4[_0x8e0b('0x34')]=qs[_0x8e0b('0x35')](_0xf501e0[_0x8e0b('0x2c')]['sort']);_0x301ed4['where']=qs['filters'](_[_0x8e0b('0x36')](_0xf501e0['query'],_0x540e0b['filters']),_0x1e6937);if(_0xf501e0[_0x8e0b('0x2c')]['filter']){_0x301ed4[_0x8e0b('0x37')]=_[_0x8e0b('0x38')](_0x301ed4[_0x8e0b('0x37')],{'$or':_[_0x8e0b('0x25')](_0x1e6937,function(_0x4677bf){if(_0x4677bf['type']!==_0x8e0b('0x39')){var _0x321254={};_0x321254[_0x4677bf[_0x8e0b('0x23')]]={'$like':'%'+_0xf501e0['query'][_0x8e0b('0x3a')]+'%'};return _0x321254;}})});}_0x301ed4=_[_0x8e0b('0x38')]({},_0x301ed4,_0xf501e0[_0x8e0b('0x3b')]);var _0x19e920={'where':_0x301ed4[_0x8e0b('0x37')]};return db[_0x8e0b('0x26')]['count'](_0x19e920)[_0x8e0b('0x1f')](function(_0x3b5f4f){_0x389119[_0x8e0b('0x18')]=_0x3b5f4f;if(_0xf501e0['query'][_0x8e0b('0x3c')]){_0x301ed4[_0x8e0b('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x8e0b('0x3e')](_0x301ed4);})[_0x8e0b('0x1f')](function(_0x470760){_0x389119[_0x8e0b('0x3f')]=_0x470760;return _0x389119;})[_0x8e0b('0x1f')](respondWithFilteredResult(_0x3ffd62,_0x301ed4))[_0x8e0b('0x40')](handleError(_0x3ffd62,null));};exports[_0x8e0b('0x41')]=function(_0x1cbc2c,_0x3286a9){var _0x4a1ea3={'raw':!![],'where':{'id':_0x1cbc2c['params']['id']}},_0x1e608c={};_0x1e608c[_0x8e0b('0x2b')]=_['keys'](db[_0x8e0b('0x26')][_0x8e0b('0x27')]);_0x1e608c[_0x8e0b('0x2c')]=_[_0x8e0b('0x42')](_0x1cbc2c[_0x8e0b('0x2c')]);_0x1e608c[_0x8e0b('0x2d')]=_['intersection'](_0x1e608c[_0x8e0b('0x2b')],_0x1e608c[_0x8e0b('0x2c')]);_0x4a1ea3[_0x8e0b('0x2f')]=_['intersection'](_0x1e608c[_0x8e0b('0x2b')],qs[_0x8e0b('0x30')](_0x1cbc2c['query'][_0x8e0b('0x30')]));_0x4a1ea3[_0x8e0b('0x2f')]=_0x4a1ea3[_0x8e0b('0x2f')][_0x8e0b('0x31')]?_0x4a1ea3[_0x8e0b('0x2f')]:_0x1e608c['model'];if(_0x1cbc2c[_0x8e0b('0x2c')][_0x8e0b('0x3c')]){_0x4a1ea3[_0x8e0b('0x3d')]=[{'all':!![]}];}_0x4a1ea3=_[_0x8e0b('0x38')]({},_0x4a1ea3,_0x1cbc2c['options']);return db[_0x8e0b('0x26')]['find'](_0x4a1ea3)[_0x8e0b('0x1f')](handleEntityNotFound(_0x3286a9,null))['then'](respondWithResult(_0x3286a9,null))[_0x8e0b('0x40')](handleError(_0x3286a9,null));};exports[_0x8e0b('0x43')]=function(_0x5dc13f,_0x2b3cbd){return db['SugarcrmField'][_0x8e0b('0x43')](_0x5dc13f[_0x8e0b('0x44')],{})[_0x8e0b('0x1f')](respondWithResult(_0x2b3cbd,0xc9))['catch'](handleError(_0x2b3cbd,null));};exports[_0x8e0b('0x1e')]=function(_0xad331c,_0x157091){if(_0xad331c[_0x8e0b('0x44')]['id']){delete _0xad331c['body']['id'];}return db[_0x8e0b('0x26')][_0x8e0b('0x45')]({'where':{'id':_0xad331c['params']['id']}})['then'](handleEntityNotFound(_0x157091,null))['then'](saveUpdates(_0xad331c[_0x8e0b('0x44')],null))[_0x8e0b('0x1f')](respondWithResult(_0x157091,null))[_0x8e0b('0x40')](handleError(_0x157091,null));};exports[_0x8e0b('0x46')]=function(_0x36032e,_0xb8d7d1){return db['SugarcrmField'][_0x8e0b('0x45')]({'where':{'id':_0x36032e[_0x8e0b('0x47')]['id']}})[_0x8e0b('0x1f')](handleEntityNotFound(_0xb8d7d1,null))[_0x8e0b('0x1f')](removeEntity(_0xb8d7d1,null))[_0x8e0b('0x40')](handleError(_0xb8d7d1,null));}; \ No newline at end of file +var _0xc075=['name','send','index','SugarcrmField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll','findAll','show','params','include','create','catch','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x55d006,_0x41e94c){var _0x5778c8=function(_0x51f95e){while(--_0x51f95e){_0x55d006['push'](_0x55d006['shift']());}};_0x5778c8(++_0x41e94c);}(_0xc075,0x1f0));var _0x5c07=function(_0x3e724e,_0x9221a8){_0x3e724e=_0x3e724e-0x0;var _0x9d6c68=_0xc075[_0x3e724e];return _0x9d6c68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c07('0x1'));var rp=require(_0x5c07('0x2'));var moment=require('moment');var BPromise=require(_0x5c07('0x3'));var Mustache=require(_0x5c07('0x4'));var util=require(_0x5c07('0x5'));var path=require(_0x5c07('0x6'));var sox=require(_0x5c07('0x7'));var csv=require(_0x5c07('0x8'));var ejs=require(_0x5c07('0x9'));var fs=require('fs');var fs_extra=require(_0x5c07('0xa'));var _=require(_0x5c07('0xb'));var squel=require(_0x5c07('0xc'));var crypto=require(_0x5c07('0xd'));var jsforce=require(_0x5c07('0xe'));var deskjs=require(_0x5c07('0xf'));var toCsv=require(_0x5c07('0x8'));var querystring=require(_0x5c07('0x10'));var Papa=require(_0x5c07('0x11'));var Redis=require(_0x5c07('0x12'));var authService=require(_0x5c07('0x13'));var qs=require(_0x5c07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c07('0x15'));var logger=require(_0x5c07('0x16'))(_0x5c07('0x17'));var utils=require(_0x5c07('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c07('0x19'))['db'];function respondWithStatusCode(_0x3a495f,_0x327ffb){_0x327ffb=_0x327ffb||0xcc;return function(_0x5181b4){if(_0x5181b4){return _0x3a495f[_0x5c07('0x1a')](_0x327ffb);}return _0x3a495f[_0x5c07('0x1b')](_0x327ffb)[_0x5c07('0x1c')]();};}function respondWithResult(_0x20f5c3,_0x36e428){_0x36e428=_0x36e428||0xc8;return function(_0x89032e){if(_0x89032e){return _0x20f5c3['status'](_0x36e428)[_0x5c07('0x1d')](_0x89032e);}};}function respondWithFilteredResult(_0xa6e4b8,_0x5ad97a){return function(_0x3993c1){if(_0x3993c1){var _0x320582=typeof _0x5ad97a[_0x5c07('0x1e')]===_0x5c07('0x1f')&&typeof _0x5ad97a['limit']===_0x5c07('0x1f');var _0x39b2a0=_0x3993c1[_0x5c07('0x20')];var _0x556cc5=_0x320582?0x0:_0x5ad97a['offset'];var _0x3f6a2b=_0x320582?_0x3993c1['count']:_0x5ad97a[_0x5c07('0x1e')]+_0x5ad97a[_0x5c07('0x21')];var _0x4b84df;if(_0x3f6a2b>=_0x39b2a0){_0x3f6a2b=_0x39b2a0;_0x4b84df=0xc8;}else{_0x4b84df=0xce;}_0xa6e4b8[_0x5c07('0x1b')](_0x4b84df);return _0xa6e4b8[_0x5c07('0x22')](_0x5c07('0x23'),_0x556cc5+'-'+_0x3f6a2b+'/'+_0x39b2a0)['json'](_0x3993c1);}return null;};}function patchUpdates(_0x59d403){return function(_0x1e167e){try{jsonpatch[_0x5c07('0x24')](_0x1e167e,_0x59d403,!![]);}catch(_0x1d1547){return BPromise[_0x5c07('0x25')](_0x1d1547);}return _0x1e167e[_0x5c07('0x26')]();};}function saveUpdates(_0x30b2da,_0x469a1a){return function(_0x53d60c){if(_0x53d60c){return _0x53d60c[_0x5c07('0x27')](_0x30b2da)[_0x5c07('0x28')](function(_0x338653){return _0x338653;});}return null;};}function removeEntity(_0x5ef5b1,_0x3b15f5){return function(_0x556d7b){if(_0x556d7b){return _0x556d7b['destroy']()[_0x5c07('0x28')](function(){_0x5ef5b1[_0x5c07('0x1b')](0xcc)[_0x5c07('0x1c')]();});}};}function handleEntityNotFound(_0x6ca78f,_0x36bd5e){return function(_0x353edd){if(!_0x353edd){_0x6ca78f[_0x5c07('0x1a')](0x194);}return _0x353edd;};}function handleError(_0x29d3b5,_0x56574f){_0x56574f=_0x56574f||0x1f4;return function(_0x58a72d){logger[_0x5c07('0x29')](_0x58a72d[_0x5c07('0x2a')]);if(_0x58a72d['name']){delete _0x58a72d[_0x5c07('0x2b')];}_0x29d3b5[_0x5c07('0x1b')](_0x56574f)[_0x5c07('0x2c')](_0x58a72d);};}exports[_0x5c07('0x2d')]=function(_0x47c488,_0x3aab70){var _0x22b45d={},_0xd0d1f5={},_0xaeaa53={'count':0x0,'rows':[]};var _0xc9984d=_['map'](db[_0x5c07('0x2e')][_0x5c07('0x2f')],function(_0x50ef0e){return{'name':_0x50ef0e[_0x5c07('0x30')],'type':_0x50ef0e['type'][_0x5c07('0x31')]};});_0xd0d1f5['model']=_[_0x5c07('0x32')](_0xc9984d,'name');_0xd0d1f5[_0x5c07('0x33')]=_[_0x5c07('0x34')](_0x47c488[_0x5c07('0x33')]);_0xd0d1f5[_0x5c07('0x35')]=_[_0x5c07('0x36')](_0xd0d1f5[_0x5c07('0x37')],_0xd0d1f5['query']);_0x22b45d[_0x5c07('0x38')]=_[_0x5c07('0x36')](_0xd0d1f5['model'],qs[_0x5c07('0x39')](_0x47c488['query'][_0x5c07('0x39')]));_0x22b45d[_0x5c07('0x38')]=_0x22b45d[_0x5c07('0x38')][_0x5c07('0x3a')]?_0x22b45d[_0x5c07('0x38')]:_0xd0d1f5[_0x5c07('0x37')];if(!_0x47c488[_0x5c07('0x33')][_0x5c07('0x3b')](_0x5c07('0x3c'))){_0x22b45d[_0x5c07('0x21')]=qs[_0x5c07('0x21')](_0x47c488[_0x5c07('0x33')]['limit']);_0x22b45d[_0x5c07('0x1e')]=qs[_0x5c07('0x1e')](_0x47c488['query'][_0x5c07('0x1e')]);}_0x22b45d[_0x5c07('0x3d')]=qs[_0x5c07('0x3e')](_0x47c488[_0x5c07('0x33')]['sort']);_0x22b45d[_0x5c07('0x3f')]=qs[_0x5c07('0x35')](_[_0x5c07('0x40')](_0x47c488['query'],_0xd0d1f5['filters']),_0xc9984d);if(_0x47c488[_0x5c07('0x33')][_0x5c07('0x41')]){_0x22b45d['where']=_['merge'](_0x22b45d[_0x5c07('0x3f')],{'$or':_[_0x5c07('0x32')](_0xc9984d,function(_0x25f3be){if(_0x25f3be[_0x5c07('0x42')]!=='VIRTUAL'){var _0x8c91e4={};_0x8c91e4[_0x25f3be['name']]={'$like':'%'+_0x47c488[_0x5c07('0x33')][_0x5c07('0x41')]+'%'};return _0x8c91e4;}})});}_0x22b45d=_['merge']({},_0x22b45d,_0x47c488[_0x5c07('0x43')]);var _0x3690f5={'where':_0x22b45d['where']};return db['SugarcrmField']['count'](_0x3690f5)[_0x5c07('0x28')](function(_0x7b56d2){_0xaeaa53['count']=_0x7b56d2;if(_0x47c488[_0x5c07('0x33')][_0x5c07('0x44')]){_0x22b45d['include']=[{'all':!![]}];}return db[_0x5c07('0x2e')][_0x5c07('0x45')](_0x22b45d);})[_0x5c07('0x28')](function(_0x356b77){_0xaeaa53['rows']=_0x356b77;return _0xaeaa53;})[_0x5c07('0x28')](respondWithFilteredResult(_0x3aab70,_0x22b45d))['catch'](handleError(_0x3aab70,null));};exports[_0x5c07('0x46')]=function(_0x3ccb24,_0x283353){var _0x4c0620={'raw':!![],'where':{'id':_0x3ccb24[_0x5c07('0x47')]['id']}},_0x29f362={};_0x29f362[_0x5c07('0x37')]=_[_0x5c07('0x34')](db[_0x5c07('0x2e')][_0x5c07('0x2f')]);_0x29f362[_0x5c07('0x33')]=_['keys'](_0x3ccb24['query']);_0x29f362[_0x5c07('0x35')]=_['intersection'](_0x29f362[_0x5c07('0x37')],_0x29f362[_0x5c07('0x33')]);_0x4c0620['attributes']=_['intersection'](_0x29f362['model'],qs['fields'](_0x3ccb24[_0x5c07('0x33')][_0x5c07('0x39')]));_0x4c0620['attributes']=_0x4c0620[_0x5c07('0x38')]['length']?_0x4c0620[_0x5c07('0x38')]:_0x29f362[_0x5c07('0x37')];if(_0x3ccb24[_0x5c07('0x33')]['includeAll']){_0x4c0620[_0x5c07('0x48')]=[{'all':!![]}];}_0x4c0620=_['merge']({},_0x4c0620,_0x3ccb24[_0x5c07('0x43')]);return db[_0x5c07('0x2e')]['find'](_0x4c0620)[_0x5c07('0x28')](handleEntityNotFound(_0x283353,null))[_0x5c07('0x28')](respondWithResult(_0x283353,null))['catch'](handleError(_0x283353,null));};exports[_0x5c07('0x49')]=function(_0x53a9ee,_0x284f63){return db[_0x5c07('0x2e')][_0x5c07('0x49')](_0x53a9ee['body'],{})[_0x5c07('0x28')](respondWithResult(_0x284f63,0xc9))[_0x5c07('0x4a')](handleError(_0x284f63,null));};exports[_0x5c07('0x27')]=function(_0x5e1948,_0x3c4844){if(_0x5e1948[_0x5c07('0x4b')]['id']){delete _0x5e1948[_0x5c07('0x4b')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x5e1948[_0x5c07('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c4844,null))[_0x5c07('0x28')](saveUpdates(_0x5e1948[_0x5c07('0x4b')],null))[_0x5c07('0x28')](respondWithResult(_0x3c4844,null))[_0x5c07('0x4a')](handleError(_0x3c4844,null));};exports['destroy']=function(_0x50f0bc,_0x18f967){return db[_0x5c07('0x2e')][_0x5c07('0x4c')]({'where':{'id':_0x50f0bc[_0x5c07('0x47')]['id']}})[_0x5c07('0x28')](handleEntityNotFound(_0x18f967,null))['then'](removeEntity(_0x18f967,null))[_0x5c07('0x4a')](handleError(_0x18f967,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index af6c3f2..e290dc2 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 _0xe219=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmField.attributes','define'];(function(_0x210e7f,_0x853523){var _0x3aab55=function(_0x2916ac){while(--_0x2916ac){_0x210e7f['push'](_0x210e7f['shift']());}};_0x3aab55(++_0x853523);}(_0xe219,0x101));var _0x9e21=function(_0x20b0bd,_0x26e296){_0x20b0bd=_0x20b0bd-0x0;var _0x2051c8=_0xe219[_0x20b0bd];return _0x2051c8;};'use strict';var _=require(_0x9e21('0x0'));var util=require(_0x9e21('0x1'));var logger=require(_0x9e21('0x2'))(_0x9e21('0x3'));var moment=require('moment');var BPromise=require(_0x9e21('0x4'));var rp=require(_0x9e21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e21('0x6'));var attributes=require(_0x9e21('0x7'));module['exports']=function(_0x1b68c2,_0x104e80){return _0x1b68c2[_0x9e21('0x8')](_0x9e21('0x9'),attributes,{'tableName':_0x9e21('0xa'),'paranoid':![],'indexes':[{'name':_0x9e21('0xb'),'fields':[_0x9e21('0xc'),_0x9e21('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0138=['./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x0138,0xf1));var _0x8013=function(_0x3dd8da,_0x52b7f9){_0x3dd8da=_0x3dd8da-0x0;var _0x1342b3=_0x0138[_0x3dd8da];return _0x1342b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8013('0x0'));var moment=require(_0x8013('0x1'));var BPromise=require('bluebird');var rp=require(_0x8013('0x2'));var fs=require('fs');var path=require(_0x8013('0x3'));var rimraf=require(_0x8013('0x4'));var config=require(_0x8013('0x5'));var attributes=require(_0x8013('0x6'));module[_0x8013('0x7')]=function(_0x473b7d,_0x8672b0){return _0x473b7d[_0x8013('0x8')]('SugarcrmField',attributes,{'tableName':_0x8013('0x9'),'paranoid':![],'indexes':[{'name':_0x8013('0xa'),'fields':[_0x8013('0xb'),_0x8013('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index b2b0b99..4f020ad 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 _0x65f1=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3215a2,_0x591d21){var _0x17dc60=function(_0x72a8f){while(--_0x72a8f){_0x3215a2['push'](_0x3215a2['shift']());}};_0x17dc60(++_0x591d21);}(_0x65f1,0x182));var _0x165f=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x65f1[_0x154192];return _0x3c2792;};'use strict';var _=require('lodash');var util=require(_0x165f('0x0'));var moment=require(_0x165f('0x1'));var BPromise=require('bluebird');var rs=require(_0x165f('0x2'));var fs=require('fs');var Redis=require(_0x165f('0x3'));var db=require(_0x165f('0x4'))['db'];var utils=require(_0x165f('0x5'));var logger=require(_0x165f('0x6'))(_0x165f('0x7'));var config=require('../../config/environment');var jayson=require(_0x165f('0x8'));var client=jayson[_0x165f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36f759,_0x21f1b9,_0x33c2ba){return new BPromise(function(_0x2d3434,_0xe96d7b){return client['request'](_0x36f759,_0x33c2ba)['then'](function(_0x17ed27){logger[_0x165f('0xa')](_0x165f('0xb'),_0x21f1b9,_0x165f('0xc'));logger[_0x165f('0xd')](_0x165f('0xe'),_0x21f1b9,'request\x20sent',JSON[_0x165f('0xf')](_0x17ed27));if(_0x17ed27[_0x165f('0x10')]){if(_0x17ed27[_0x165f('0x10')][_0x165f('0x11')]===0x1f4){logger[_0x165f('0x10')](_0x165f('0xb'),_0x21f1b9,_0x17ed27[_0x165f('0x10')][_0x165f('0x12')]);return _0xe96d7b(_0x17ed27['error'][_0x165f('0x12')]);}logger['error'](_0x165f('0xb'),_0x21f1b9,_0x17ed27[_0x165f('0x10')][_0x165f('0x12')]);return _0x2d3434(_0x17ed27[_0x165f('0x10')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x21f1b9,_0x165f('0xc'));_0x2d3434(_0x17ed27['result'][_0x165f('0x12')]);}})[_0x165f('0x13')](function(_0x16e464){logger[_0x165f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x21f1b9,_0x16e464);_0xe96d7b(_0x16e464);});});} \ No newline at end of file +var _0xfb80=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis'];(function(_0x24fb68,_0x70ba74){var _0x38ee8f=function(_0x313210){while(--_0x313210){_0x24fb68['push'](_0x24fb68['shift']());}};_0x38ee8f(++_0x70ba74);}(_0xfb80,0x1df));var _0x0fb8=function(_0x59404c,_0x1b2c2e){_0x59404c=_0x59404c-0x0;var _0x12cd01=_0xfb80[_0x59404c];return _0x12cd01;};'use strict';var _=require(_0x0fb8('0x0'));var util=require('util');var moment=require(_0x0fb8('0x1'));var BPromise=require(_0x0fb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fb8('0x3'));var db=require(_0x0fb8('0x4'))['db'];var utils=require(_0x0fb8('0x5'));var logger=require(_0x0fb8('0x6'))(_0x0fb8('0x7'));var config=require(_0x0fb8('0x8'));var jayson=require(_0x0fb8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c9576,_0xa7029f,_0x2f4501){return new BPromise(function(_0x3d37e1,_0x292c4e){return client[_0x0fb8('0xa')](_0x5c9576,_0x2f4501)[_0x0fb8('0xb')](function(_0x52311d){logger[_0x0fb8('0xc')]('SugarcrmField,\x20%s,\x20%s',_0xa7029f,_0x0fb8('0xd'));logger[_0x0fb8('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xa7029f,_0x0fb8('0xd'),JSON[_0x0fb8('0xf')](_0x52311d));if(_0x52311d[_0x0fb8('0x10')]){if(_0x52311d[_0x0fb8('0x10')][_0x0fb8('0x11')]===0x1f4){logger['error'](_0x0fb8('0x12'),_0xa7029f,_0x52311d['error'][_0x0fb8('0x13')]);return _0x292c4e(_0x52311d[_0x0fb8('0x10')]['message']);}logger[_0x0fb8('0x10')](_0x0fb8('0x12'),_0xa7029f,_0x52311d['error']['message']);return _0x3d37e1(_0x52311d[_0x0fb8('0x10')][_0x0fb8('0x13')]);}else{logger['info'](_0x0fb8('0x12'),_0xa7029f,_0x0fb8('0xd'));_0x3d37e1(_0x52311d[_0x0fb8('0x14')]['message']);}})['catch'](function(_0x269a69){logger[_0x0fb8('0x10')]('SugarcrmField,\x20%s,\x20%s',_0xa7029f,_0x269a69);_0x292c4e(_0x269a69);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0c1cf0b..d9abf3e 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 _0x31c2=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x1bd3e7,_0x48d960){var _0x56d747=function(_0x156e21){while(--_0x156e21){_0x1bd3e7['push'](_0x1bd3e7['shift']());}};_0x56d747(++_0x48d960);}(_0x31c2,0x98));var _0x231c=function(_0xfdc55a,_0xc1ab2a){_0xfdc55a=_0xfdc55a-0x0;var _0x3cbdf8=_0x31c2[_0xfdc55a];return _0x3cbdf8;};'use strict';var multer=require(_0x231c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x231c('0x1'));var express=require(_0x231c('0x2'));var router=express['Router']();var fs_extra=require(_0x231c('0x3'));var auth=require(_0x231c('0x4'));var interaction=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var controller=require(_0x231c('0x7'));router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router['get'](_0x231c('0xb'),auth['isAuthenticated'](),controller[_0x231c('0xc')]);router[_0x231c('0x8')](_0x231c('0xd'),auth[_0x231c('0x9')](),controller['getConfigurations']);router[_0x231c('0x8')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0xf')]);router[_0x231c('0x10')]('/',auth[_0x231c('0x9')](),controller['create']);router['post']('/:id/configurations',auth[_0x231c('0x9')](),controller[_0x231c('0x11')]);router[_0x231c('0x12')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x13')]);router[_0x231c('0x14')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x15')]);module[_0x231c('0x16')]=router; \ No newline at end of file +var _0xce9b=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4f9e10,_0x51d7ff){var _0x187d96=function(_0x121a1a){while(--_0x121a1a){_0x4f9e10['push'](_0x4f9e10['shift']());}};_0x187d96(++_0x51d7ff);}(_0xce9b,0xc6));var _0xbce9=function(_0x3b5a89,_0x11f700){_0x3b5a89=_0x3b5a89-0x0;var _0x4dccfb=_0xce9b[_0x3b5a89];return _0x4dccfb;};'use strict';var multer=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var path=require(_0xbce9('0x2'));var timeout=require(_0xbce9('0x3'));var express=require(_0xbce9('0x4'));var router=express[_0xbce9('0x5')]();var fs_extra=require(_0xbce9('0x6'));var auth=require(_0xbce9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbce9('0x8'));var controller=require(_0xbce9('0x9'));router[_0xbce9('0xa')]('/',auth[_0xbce9('0xb')](),controller[_0xbce9('0xc')]);router[_0xbce9('0xa')](_0xbce9('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xbce9('0xa')](_0xbce9('0xe'),auth['isAuthenticated'](),controller[_0xbce9('0xf')]);router[_0xbce9('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbce9('0x10')]);router[_0xbce9('0x11')]('/',auth[_0xbce9('0xb')](),controller['create']);router['post'](_0xbce9('0xe'),auth[_0xbce9('0xb')](),controller[_0xbce9('0x12')]);router[_0xbce9('0x13')](_0xbce9('0xd'),auth[_0xbce9('0xb')](),controller[_0xbce9('0x14')]);router[_0xbce9('0x15')](_0xbce9('0xd'),auth[_0xbce9('0xb')](),controller['destroy']);module[_0xbce9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 629dea2..9b861f2 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 _0x8d8d=['sequelize','exports','STRING'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x8d8d,0x171));var _0xd8d8=function(_0x161424,_0x30fb0e){_0x161424=_0x161424-0x0;var _0x17ed8c=_0x8d8d[_0x161424];return _0x17ed8c;};'use strict';var Sequelize=require(_0xd8d8('0x0'));module[_0xd8d8('0x1')]={'name':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd8d8('0x2')]},'username':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd8d8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8385=['HelpDesk','exports','STRING'];(function(_0x3f96ed,_0x5c1fcb){var _0x12cb62=function(_0x4a5569){while(--_0x4a5569){_0x3f96ed['push'](_0x3f96ed['shift']());}};_0x12cb62(++_0x5c1fcb);}(_0x8385,0x1db));var _0x5838=function(_0x14c0ef,_0x5ead41){_0x14c0ef=_0x14c0ef-0x0;var _0x4f9af1=_0x8385[_0x14c0ef];return _0x4f9af1;};'use strict';var Sequelize=require('sequelize');module[_0x5838('0x0')]={'name':{'type':Sequelize[_0x5838('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5838('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5838('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5838('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5838('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 6af7387..1e8a986 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 _0xec76=['desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','VtigerAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','getConfigurations','params','VtigerConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','crypto','jsforce'];(function(_0x3eb043,_0x13419c){var _0x338b2b=function(_0x103cf2){while(--_0x103cf2){_0x3eb043['push'](_0x3eb043['shift']());}};_0x338b2b(++_0x13419c);}(_0xec76,0x1cd));var _0x6ec7=function(_0x2d3d48,_0x20c963){_0x2d3d48=_0x2d3d48-0x0;var _0x27764a=_0xec76[_0x2d3d48];return _0x27764a;};'use strict';var emlformat=require(_0x6ec7('0x0'));var rimraf=require(_0x6ec7('0x1'));var zipdir=require(_0x6ec7('0x2'));var jsonpatch=require(_0x6ec7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ec7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6ec7('0x5'));var sox=require(_0x6ec7('0x6'));var csv=require('to-csv');var ejs=require(_0x6ec7('0x7'));var fs=require('fs');var fs_extra=require(_0x6ec7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ec7('0x9'));var jsforce=require(_0x6ec7('0xa'));var deskjs=require(_0x6ec7('0xb'));var toCsv=require(_0x6ec7('0xc'));var querystring=require(_0x6ec7('0xd'));var Papa=require(_0x6ec7('0xe'));var Redis=require(_0x6ec7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ec7('0x10'));var logger=require(_0x6ec7('0x11'))(_0x6ec7('0x12'));var utils=require(_0x6ec7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6ec7('0x14'));function respondWithStatusCode(_0x367810,_0x2bf35c){_0x2bf35c=_0x2bf35c||0xcc;return function(_0x1391ff){if(_0x1391ff){return _0x367810[_0x6ec7('0x15')](_0x2bf35c);}return _0x367810[_0x6ec7('0x16')](_0x2bf35c)[_0x6ec7('0x17')]();};}function respondWithResult(_0x58b0c2,_0x4be636){_0x4be636=_0x4be636||0xc8;return function(_0x8958b8){if(_0x8958b8){return _0x58b0c2['status'](_0x4be636)[_0x6ec7('0x18')](_0x8958b8);}};}function respondWithFilteredResult(_0x28d0b0,_0x1bba52){return function(_0x508b49){if(_0x508b49){var _0x27553f=typeof _0x1bba52[_0x6ec7('0x19')]==='undefined'&&typeof _0x1bba52[_0x6ec7('0x1a')]===_0x6ec7('0x1b');var _0x3a040f=_0x508b49[_0x6ec7('0x1c')];var _0x1e9656=_0x27553f?0x0:_0x1bba52[_0x6ec7('0x19')];var _0x534d06=_0x27553f?_0x508b49[_0x6ec7('0x1c')]:_0x1bba52['offset']+_0x1bba52['limit'];var _0x3a530a;if(_0x534d06>=_0x3a040f){_0x534d06=_0x3a040f;_0x3a530a=0xc8;}else{_0x3a530a=0xce;}_0x28d0b0[_0x6ec7('0x16')](_0x3a530a);return _0x28d0b0['set'](_0x6ec7('0x1d'),_0x1e9656+'-'+_0x534d06+'/'+_0x3a040f)[_0x6ec7('0x18')](_0x508b49);}return null;};}function patchUpdates(_0x16f02d){return function(_0x338e6e){try{jsonpatch['apply'](_0x338e6e,_0x16f02d,!![]);}catch(_0x44ff35){return BPromise[_0x6ec7('0x1e')](_0x44ff35);}return _0x338e6e['save']();};}function saveUpdates(_0x4ca0ac,_0x51ce16){return function(_0x511075){if(_0x511075){return _0x511075[_0x6ec7('0x1f')](_0x4ca0ac)[_0x6ec7('0x20')](function(_0x195efa){return _0x195efa;});}return null;};}function removeEntity(_0x316c3b,_0x3406c9){return function(_0x3dbad4){if(_0x3dbad4){return _0x3dbad4[_0x6ec7('0x21')]()[_0x6ec7('0x20')](function(){_0x316c3b[_0x6ec7('0x16')](0xcc)[_0x6ec7('0x17')]();});}};}function handleEntityNotFound(_0x48a21f,_0x33c53f){return function(_0x277ad3){if(!_0x277ad3){_0x48a21f['sendStatus'](0x194);}return _0x277ad3;};}function handleError(_0x59467b,_0x103cc2){_0x103cc2=_0x103cc2||0x1f4;return function(_0x3ce0c4){logger[_0x6ec7('0x22')](_0x3ce0c4[_0x6ec7('0x23')]);if(_0x3ce0c4[_0x6ec7('0x24')]){delete _0x3ce0c4[_0x6ec7('0x24')];}_0x59467b['status'](_0x103cc2)[_0x6ec7('0x25')](_0x3ce0c4);};}exports[_0x6ec7('0x26')]=function(_0x1a8bd7,_0xc66838){var _0x1ddb02={},_0x5a0698={},_0x1964ad={'count':0x0,'rows':[]};var _0x5f16fb=_['map'](db[_0x6ec7('0x27')]['rawAttributes'],function(_0x1c8744){return{'name':_0x1c8744[_0x6ec7('0x28')],'type':_0x1c8744[_0x6ec7('0x29')][_0x6ec7('0x2a')]};});_0x5a0698['model']=_[_0x6ec7('0x2b')](_0x5f16fb,_0x6ec7('0x24'));_0x5a0698[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0x1a8bd7[_0x6ec7('0x2c')]);_0x5a0698[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x5a0698[_0x6ec7('0x30')],_0x5a0698[_0x6ec7('0x2c')]);_0x1ddb02[_0x6ec7('0x31')]=_['intersection'](_0x5a0698[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0x1a8bd7['query'][_0x6ec7('0x32')]));_0x1ddb02[_0x6ec7('0x31')]=_0x1ddb02[_0x6ec7('0x31')][_0x6ec7('0x33')]?_0x1ddb02[_0x6ec7('0x31')]:_0x5a0698[_0x6ec7('0x30')];if(!_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x34')]('nolimit')){_0x1ddb02[_0x6ec7('0x1a')]=qs['limit'](_0x1a8bd7[_0x6ec7('0x2c')]['limit']);_0x1ddb02[_0x6ec7('0x19')]=qs[_0x6ec7('0x19')](_0x1a8bd7['query'][_0x6ec7('0x19')]);}_0x1ddb02[_0x6ec7('0x35')]=qs[_0x6ec7('0x36')](_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x36')]);_0x1ddb02[_0x6ec7('0x37')]=qs[_0x6ec7('0x2e')](_['pick'](_0x1a8bd7['query'],_0x5a0698[_0x6ec7('0x2e')]),_0x5f16fb);if(_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x38')]){_0x1ddb02[_0x6ec7('0x37')]=_['merge'](_0x1ddb02['where'],{'$or':_['map'](_0x5f16fb,function(_0xd82a3e){if(_0xd82a3e[_0x6ec7('0x29')]!==_0x6ec7('0x39')){var _0x8bef96={};_0x8bef96[_0xd82a3e[_0x6ec7('0x24')]]={'$like':'%'+_0x1a8bd7[_0x6ec7('0x2c')]['filter']+'%'};return _0x8bef96;}})});}_0x1ddb02=_[_0x6ec7('0x3a')]({},_0x1ddb02,_0x1a8bd7[_0x6ec7('0x3b')]);var _0x1e9f43={'where':_0x1ddb02['where']};return db[_0x6ec7('0x27')][_0x6ec7('0x1c')](_0x1e9f43)[_0x6ec7('0x20')](function(_0x77ef97){_0x1964ad['count']=_0x77ef97;if(_0x1a8bd7[_0x6ec7('0x2c')][_0x6ec7('0x3c')]){_0x1ddb02[_0x6ec7('0x3d')]=[{'all':!![]}];}return db[_0x6ec7('0x27')][_0x6ec7('0x3e')](_0x1ddb02);})[_0x6ec7('0x20')](function(_0x29a1b4){_0x1964ad[_0x6ec7('0x3f')]=_0x29a1b4;return _0x1964ad;})[_0x6ec7('0x20')](respondWithFilteredResult(_0xc66838,_0x1ddb02))[_0x6ec7('0x40')](handleError(_0xc66838,null));};exports[_0x6ec7('0x41')]=function(_0xa8aa26,_0x3d515a){var _0x57a70a={'raw':![],'where':{'id':_0xa8aa26['params']['id']}},_0x1cc537={};_0x1cc537[_0x6ec7('0x30')]=_[_0x6ec7('0x2d')](db['VtigerAccount'][_0x6ec7('0x42')]);_0x1cc537[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0xa8aa26['query']);_0x1cc537[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x1cc537[_0x6ec7('0x30')],_0x1cc537['query']);_0x57a70a[_0x6ec7('0x31')]=_[_0x6ec7('0x2f')](_0x1cc537[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0xa8aa26[_0x6ec7('0x2c')]['fields']));_0x57a70a[_0x6ec7('0x31')]=_0x57a70a['attributes'][_0x6ec7('0x33')]?_0x57a70a[_0x6ec7('0x31')]:_0x1cc537['model'];if(_0xa8aa26[_0x6ec7('0x2c')][_0x6ec7('0x3c')]){_0x57a70a[_0x6ec7('0x3d')]=[{'all':!![]}];}_0x57a70a=_[_0x6ec7('0x3a')]({},_0x57a70a,_0xa8aa26['options']);return db[_0x6ec7('0x27')][_0x6ec7('0x43')](_0x57a70a)['then'](handleEntityNotFound(_0x3d515a,null))[_0x6ec7('0x20')](respondWithResult(_0x3d515a,null))['catch'](handleError(_0x3d515a,null));};exports[_0x6ec7('0x44')]=function(_0x51998d,_0x295fd1){return db['VtigerAccount'][_0x6ec7('0x44')](_0x51998d[_0x6ec7('0x45')],{})[_0x6ec7('0x20')](respondWithResult(_0x295fd1,0xc9))[_0x6ec7('0x40')](handleError(_0x295fd1,null));};exports['update']=function(_0x548bfb,_0x2124ab){if(_0x548bfb[_0x6ec7('0x45')]['id']){delete _0x548bfb['body']['id'];}return db[_0x6ec7('0x27')][_0x6ec7('0x43')]({'where':{'id':_0x548bfb['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x2124ab,null))[_0x6ec7('0x20')](saveUpdates(_0x548bfb['body'],null))['then'](respondWithResult(_0x2124ab,null))[_0x6ec7('0x40')](handleError(_0x2124ab,null));};exports['destroy']=function(_0x488f7b,_0x24f678){return db[_0x6ec7('0x27')][_0x6ec7('0x43')]({'where':{'id':_0x488f7b['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x24f678,null))[_0x6ec7('0x20')](removeEntity(_0x24f678,null))[_0x6ec7('0x40')](handleError(_0x24f678,null));};exports[_0x6ec7('0x46')]=function(_0x4ac485,_0x1dbc5c,_0x454199){var _0x1f3d76={};var _0x41fdde={};var _0x9587a4;var _0xf6c178;return db[_0x6ec7('0x27')]['findOne']({'where':{'id':_0x4ac485[_0x6ec7('0x47')]['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x1dbc5c,null))[_0x6ec7('0x20')](function(_0xa245ae){if(_0xa245ae){_0x9587a4=_0xa245ae;_0x41fdde[_0x6ec7('0x30')]=_[_0x6ec7('0x2d')](db[_0x6ec7('0x48')][_0x6ec7('0x42')]);_0x41fdde[_0x6ec7('0x2c')]=_[_0x6ec7('0x2d')](_0x4ac485['query']);_0x41fdde[_0x6ec7('0x2e')]=_[_0x6ec7('0x2f')](_0x41fdde[_0x6ec7('0x30')],_0x41fdde[_0x6ec7('0x2c')]);_0x1f3d76['attributes']=_[_0x6ec7('0x2f')](_0x41fdde[_0x6ec7('0x30')],qs[_0x6ec7('0x32')](_0x4ac485['query'][_0x6ec7('0x32')]));_0x1f3d76[_0x6ec7('0x31')]=_0x1f3d76[_0x6ec7('0x31')][_0x6ec7('0x33')]?_0x1f3d76[_0x6ec7('0x31')]:_0x41fdde[_0x6ec7('0x30')];_0x1f3d76['order']=qs['sort'](_0x4ac485[_0x6ec7('0x2c')][_0x6ec7('0x36')]);_0x1f3d76[_0x6ec7('0x37')]=qs['filters'](_['pick'](_0x4ac485[_0x6ec7('0x2c')],_0x41fdde['filters']));if(_0x4ac485[_0x6ec7('0x2c')][_0x6ec7('0x38')]){_0x1f3d76['where']=_[_0x6ec7('0x3a')](_0x1f3d76[_0x6ec7('0x37')],{'$or':_[_0x6ec7('0x2b')](_0x1f3d76['attributes'],function(_0x5d0cf2){var _0x25a49b={};_0x25a49b[_0x5d0cf2]={'$like':'%'+_0x4ac485['query'][_0x6ec7('0x38')]+'%'};return _0x25a49b;})});}_0x1f3d76=_[_0x6ec7('0x3a')]({},_0x1f3d76,_0x4ac485[_0x6ec7('0x3b')]);return _0x9587a4[_0x6ec7('0x46')](_0x1f3d76);}})[_0x6ec7('0x20')](function(_0x2ded96){if(_0x2ded96){_0xf6c178=_0x2ded96['length'];if(!_0x4ac485[_0x6ec7('0x2c')]['hasOwnProperty'](_0x6ec7('0x49'))){_0x1f3d76[_0x6ec7('0x1a')]=qs[_0x6ec7('0x1a')](_0x4ac485[_0x6ec7('0x2c')]['limit']);_0x1f3d76[_0x6ec7('0x19')]=qs[_0x6ec7('0x19')](_0x4ac485[_0x6ec7('0x2c')]['offset']);}return _0x9587a4[_0x6ec7('0x46')](_0x1f3d76);}})[_0x6ec7('0x20')](function(_0x4660fa){if(_0x4660fa){return _0x4660fa?{'count':_0xf6c178,'rows':_0x4660fa}:null;}})[_0x6ec7('0x20')](respondWithResult(_0x1dbc5c,null))[_0x6ec7('0x40')](handleError(_0x1dbc5c,null));};exports[_0x6ec7('0x4a')]=function(_0x32ff38,_0x4485d2,_0x2c9bf1){if(_0x32ff38[_0x6ec7('0x45')]['id']){delete _0x32ff38[_0x6ec7('0x45')]['id'];}return db[_0x6ec7('0x27')][_0x6ec7('0x4b')]({'where':{'id':_0x32ff38['params']['id']}})[_0x6ec7('0x20')](handleEntityNotFound(_0x4485d2,null))[_0x6ec7('0x20')](function(_0x55057e){if(_0x55057e){_0x32ff38['body'][_0x6ec7('0x4c')]=_0x55057e['id'];_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4d')]=integrations[_0x6ec7('0x4e')](_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4f')],_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x29')]);_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x50')]=integrations[_0x6ec7('0x51')](_0x32ff38[_0x6ec7('0x45')][_0x6ec7('0x4f')],_0x32ff38['body'][_0x6ec7('0x29')]);return db[_0x6ec7('0x48')][_0x6ec7('0x44')](_0x32ff38[_0x6ec7('0x45')],{'include':[{'model':db[_0x6ec7('0x52')],'as':'Subjects'},{'model':db[_0x6ec7('0x52')],'as':_0x6ec7('0x50')}]});}return null;})[_0x6ec7('0x20')](respondWithResult(_0x4485d2,null))[_0x6ec7('0x40')](handleError(_0x4485d2,null));};var md5=require(_0x6ec7('0x53'));exports['getFields']=function(_0x4ee838,_0x402854,_0x5fd229){var _0x1ae8ad=null;var _0x57039a=null;var _0x4af8df=null;var _0x10eae1=null;var _0x2be2be='';return db[_0x6ec7('0x27')][_0x6ec7('0x4b')]({'where':{'id':_0x4ee838[_0x6ec7('0x47')]['id']},'attributes':['id',_0x6ec7('0x24'),_0x6ec7('0x54'),'description',_0x6ec7('0x55'),_0x6ec7('0x56'),'serverUrl',_0x6ec7('0x57')]})[_0x6ec7('0x20')](handleEntityNotFound(_0x402854,null))['then'](function(_0x100489){if(_0x100489){_0x1ae8ad=_0x100489[_0x6ec7('0x54')];_0x57039a=_0x100489[_0x6ec7('0x57')];_0x4af8df=_0x100489[_0x6ec7('0x55')];_0x2be2be=_0x100489[_0x6ec7('0x56')];var _0x488dea=_0x2be2be[_0x6ec7('0x58')](-0x1);if(_0x488dea==='/'){_0x2be2be=_0x2be2be[_0x6ec7('0x59')](0x0,_0x2be2be[_0x6ec7('0x5a')](_0x488dea));}_0x10eae1=util[_0x6ec7('0x5b')]('%s/webservice.php',_0x2be2be);var _0x5cfce5={'method':'GET','uri':_0x10eae1,'qs':{'operation':_0x6ec7('0x5c'),'username':_0x100489['username']},'json':!![]};return rp(_0x5cfce5);}})['then'](function(_0x2f2f4e){if(_0x2f2f4e[_0x6ec7('0x5d')]){var _0x4bdb5a={'method':_0x6ec7('0x5e'),'uri':_0x10eae1,'form':{'operation':_0x6ec7('0x5f'),'username':_0x1ae8ad,'accessKey':md5(_0x2f2f4e[_0x6ec7('0x60')][_0x6ec7('0x61')]+_0x57039a)},'json':!![]};return rp(_0x4bdb5a);}})[_0x6ec7('0x20')](function(_0xa88de8){if(_0xa88de8[_0x6ec7('0x5d')]){var _0x2a61aa={'method':_0x6ec7('0x62'),'uri':_0x10eae1,'qs':{'operation':_0x6ec7('0x63'),'username':_0x1ae8ad,'sessionName':_0xa88de8[_0x6ec7('0x60')][_0x6ec7('0x64')],'elementType':_0x4af8df},'json':!![]};return rp(_0x2a61aa);}})[_0x6ec7('0x20')](function(_0x950ac3){if(_0x950ac3[_0x6ec7('0x5d')]){var _0x201209=[_0x6ec7('0x65'),'reference',_0x6ec7('0x66')];_[_0x6ec7('0x67')](_0x950ac3[_0x6ec7('0x60')][_0x6ec7('0x32')],function(_0x51931c){return _0x201209[_0x6ec7('0x68')](_0x51931c[_0x6ec7('0x29')]['name']);});_[_0x6ec7('0x67')](_0x950ac3[_0x6ec7('0x60')]['fields'],function(_0x58d330){return _0x58d330[_0x6ec7('0x69')]==='false';});return{'count':_0x950ac3[_0x6ec7('0x60')]['fields']['length'],'rows':_['map'](_0x950ac3[_0x6ec7('0x60')][_0x6ec7('0x32')],function(_0x426794){return{'id':_0x426794[_0x6ec7('0x24')],'name':_0x426794[_0x6ec7('0x6a')],'custom':_[_0x6ec7('0x6b')](_0x426794[_0x6ec7('0x24')],_0x6ec7('0x6c'))?!![]:![],'options':_0x426794['type']['name']===_0x6ec7('0x6d')&&_0x426794[_0x6ec7('0x29')][_0x6ec7('0x6e')][_0x6ec7('0x33')]>0x0?_[_0x6ec7('0x2b')](_0x426794['type'][_0x6ec7('0x6e')],function(_0x31c730){return{'name':_0x31c730[_0x6ec7('0x6a')],'value':_0x31c730['value']};}):[]};})};}})[_0x6ec7('0x20')](respondWithResult(_0x402854,null))[_0x6ec7('0x40')](function(_0x5e8246){console[_0x6ec7('0x6f')](_0x6ec7('0x70')+_0x5e8246);var _0x35c5ec=_0x4ee838['query'][_0x6ec7('0x71')]?0x1f4:_0x5e8246[_0x6ec7('0x72')]||0x1f4;logger[_0x6ec7('0x22')](_0x6ec7('0x73'),_0x6ec7('0x74'),_0x35c5ec,JSON[_0x6ec7('0x75')](_0x5e8246));delete _0x5e8246[_0x6ec7('0x24')];if(_0x35c5ec===0x191){_0x35c5ec=0x190;}_0x402854[_0x6ec7('0x16')](_0x35c5ec)[_0x6ec7('0x25')](_0x4ee838[_0x6ec7('0x2c')][_0x6ec7('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x5e8246['statusCode']}:_0x5e8246);});}; \ No newline at end of file +var _0xe890=['VtigerAccount','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','merge','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','POST','login','token','success','GET','describe','result','sessionName','autogenerated','reference','owner','remove','includes','false','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map'];(function(_0x19b6e8,_0xc00f43){var _0x126cd5=function(_0xcc9f62){while(--_0xcc9f62){_0x19b6e8['push'](_0x19b6e8['shift']());}};_0x126cd5(++_0xc00f43);}(_0xe890,0x1b3));var _0x0e89=function(_0x48d684,_0x382ba6){_0x48d684=_0x48d684-0x0;var _0x1022ec=_0xe890[_0x48d684];return _0x1022ec;};'use strict';var emlformat=require(_0x0e89('0x0'));var rimraf=require(_0x0e89('0x1'));var zipdir=require(_0x0e89('0x2'));var jsonpatch=require(_0x0e89('0x3'));var rp=require('request-promise');var moment=require(_0x0e89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e89('0x5'));var util=require(_0x0e89('0x6'));var path=require('path');var sox=require(_0x0e89('0x7'));var csv=require(_0x0e89('0x8'));var ejs=require(_0x0e89('0x9'));var fs=require('fs');var fs_extra=require(_0x0e89('0xa'));var _=require(_0x0e89('0xb'));var squel=require(_0x0e89('0xc'));var crypto=require('crypto');var jsforce=require(_0x0e89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0e89('0x8'));var querystring=require(_0x0e89('0xe'));var Papa=require(_0x0e89('0xf'));var Redis=require(_0x0e89('0x10'));var authService=require(_0x0e89('0x11'));var qs=require(_0x0e89('0x12'));var as=require(_0x0e89('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e89('0x14'))('api');var utils=require(_0x0e89('0x15'));var config=require(_0x0e89('0x16'));var licenseUtil=require(_0x0e89('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0e89('0x18'));function respondWithStatusCode(_0x11163f,_0x4c3695){_0x4c3695=_0x4c3695||0xcc;return function(_0x54bc2b){if(_0x54bc2b){return _0x11163f[_0x0e89('0x19')](_0x4c3695);}return _0x11163f[_0x0e89('0x1a')](_0x4c3695)[_0x0e89('0x1b')]();};}function respondWithResult(_0x44d55b,_0x368df2){_0x368df2=_0x368df2||0xc8;return function(_0x21d337){if(_0x21d337){return _0x44d55b[_0x0e89('0x1a')](_0x368df2)[_0x0e89('0x1c')](_0x21d337);}};}function respondWithFilteredResult(_0x74ea0d,_0x15cab2){return function(_0x1595af){if(_0x1595af){var _0x187681=typeof _0x15cab2[_0x0e89('0x1d')]===_0x0e89('0x1e')&&typeof _0x15cab2[_0x0e89('0x1f')]==='undefined';var _0x58fb16=_0x1595af[_0x0e89('0x20')];var _0x33a4bf=_0x187681?0x0:_0x15cab2['offset'];var _0x17cabe=_0x187681?_0x1595af[_0x0e89('0x20')]:_0x15cab2[_0x0e89('0x1d')]+_0x15cab2[_0x0e89('0x1f')];var _0x533a52;if(_0x17cabe>=_0x58fb16){_0x17cabe=_0x58fb16;_0x533a52=0xc8;}else{_0x533a52=0xce;}_0x74ea0d[_0x0e89('0x1a')](_0x533a52);return _0x74ea0d[_0x0e89('0x21')](_0x0e89('0x22'),_0x33a4bf+'-'+_0x17cabe+'/'+_0x58fb16)[_0x0e89('0x1c')](_0x1595af);}return null;};}function patchUpdates(_0x2fa2fb){return function(_0x1adda4){try{jsonpatch[_0x0e89('0x23')](_0x1adda4,_0x2fa2fb,!![]);}catch(_0x3be5f1){return BPromise['reject'](_0x3be5f1);}return _0x1adda4[_0x0e89('0x24')]();};}function saveUpdates(_0x34b006,_0x22ddb2){return function(_0x3985b3){if(_0x3985b3){return _0x3985b3[_0x0e89('0x25')](_0x34b006)['then'](function(_0x32cd83){return _0x32cd83;});}return null;};}function removeEntity(_0x5511d3,_0x547aae){return function(_0x3fbeac){if(_0x3fbeac){return _0x3fbeac[_0x0e89('0x26')]()[_0x0e89('0x27')](function(){_0x5511d3[_0x0e89('0x1a')](0xcc)[_0x0e89('0x1b')]();});}};}function handleEntityNotFound(_0x1617c1,_0x3257aa){return function(_0x170f53){if(!_0x170f53){_0x1617c1['sendStatus'](0x194);}return _0x170f53;};}function handleError(_0x4c06f6,_0x5831b4){_0x5831b4=_0x5831b4||0x1f4;return function(_0x3f11bb){logger['error'](_0x3f11bb[_0x0e89('0x28')]);if(_0x3f11bb[_0x0e89('0x29')]){delete _0x3f11bb[_0x0e89('0x29')];}_0x4c06f6['status'](_0x5831b4)[_0x0e89('0x2a')](_0x3f11bb);};}exports[_0x0e89('0x2b')]=function(_0x34038c,_0x575788){var _0x518950={},_0x18e276={},_0x4e6c20={'count':0x0,'rows':[]};var _0x450aac=_[_0x0e89('0x2c')](db[_0x0e89('0x2d')][_0x0e89('0x2e')],function(_0xdcf2e){return{'name':_0xdcf2e[_0x0e89('0x2f')],'type':_0xdcf2e['type'][_0x0e89('0x30')]};});_0x18e276[_0x0e89('0x31')]=_[_0x0e89('0x2c')](_0x450aac,_0x0e89('0x29'));_0x18e276['query']=_[_0x0e89('0x32')](_0x34038c[_0x0e89('0x33')]);_0x18e276['filters']=_[_0x0e89('0x34')](_0x18e276[_0x0e89('0x31')],_0x18e276['query']);_0x518950['attributes']=_[_0x0e89('0x34')](_0x18e276[_0x0e89('0x31')],qs[_0x0e89('0x35')](_0x34038c['query'][_0x0e89('0x35')]));_0x518950[_0x0e89('0x36')]=_0x518950['attributes'][_0x0e89('0x37')]?_0x518950['attributes']:_0x18e276[_0x0e89('0x31')];if(!_0x34038c['query'][_0x0e89('0x38')](_0x0e89('0x39'))){_0x518950[_0x0e89('0x1f')]=qs[_0x0e89('0x1f')](_0x34038c[_0x0e89('0x33')][_0x0e89('0x1f')]);_0x518950[_0x0e89('0x1d')]=qs['offset'](_0x34038c[_0x0e89('0x33')][_0x0e89('0x1d')]);}_0x518950[_0x0e89('0x3a')]=qs[_0x0e89('0x3b')](_0x34038c[_0x0e89('0x33')][_0x0e89('0x3b')]);_0x518950[_0x0e89('0x3c')]=qs[_0x0e89('0x3d')](_['pick'](_0x34038c[_0x0e89('0x33')],_0x18e276[_0x0e89('0x3d')]),_0x450aac);if(_0x34038c['query'][_0x0e89('0x3e')]){_0x518950[_0x0e89('0x3c')]=_['merge'](_0x518950[_0x0e89('0x3c')],{'$or':_[_0x0e89('0x2c')](_0x450aac,function(_0x13a221){if(_0x13a221[_0x0e89('0x3f')]!=='VIRTUAL'){var _0x415325={};_0x415325[_0x13a221['name']]={'$like':'%'+_0x34038c['query'][_0x0e89('0x3e')]+'%'};return _0x415325;}})});}_0x518950=_['merge']({},_0x518950,_0x34038c[_0x0e89('0x40')]);var _0xfd4f04={'where':_0x518950[_0x0e89('0x3c')]};return db['VtigerAccount'][_0x0e89('0x20')](_0xfd4f04)[_0x0e89('0x27')](function(_0x477a21){_0x4e6c20[_0x0e89('0x20')]=_0x477a21;if(_0x34038c[_0x0e89('0x33')][_0x0e89('0x41')]){_0x518950[_0x0e89('0x42')]=[{'all':!![]}];}return db[_0x0e89('0x2d')][_0x0e89('0x43')](_0x518950);})[_0x0e89('0x27')](function(_0x4271df){_0x4e6c20[_0x0e89('0x44')]=_0x4271df;return _0x4e6c20;})['then'](respondWithFilteredResult(_0x575788,_0x518950))[_0x0e89('0x45')](handleError(_0x575788,null));};exports['show']=function(_0x21b425,_0x1ac741){var _0x2b8c0c={'raw':![],'where':{'id':_0x21b425[_0x0e89('0x46')]['id']}},_0x15475c={};_0x15475c[_0x0e89('0x31')]=_['keys'](db['VtigerAccount'][_0x0e89('0x2e')]);_0x15475c[_0x0e89('0x33')]=_['keys'](_0x21b425[_0x0e89('0x33')]);_0x15475c[_0x0e89('0x3d')]=_[_0x0e89('0x34')](_0x15475c[_0x0e89('0x31')],_0x15475c[_0x0e89('0x33')]);_0x2b8c0c[_0x0e89('0x36')]=_[_0x0e89('0x34')](_0x15475c[_0x0e89('0x31')],qs[_0x0e89('0x35')](_0x21b425[_0x0e89('0x33')][_0x0e89('0x35')]));_0x2b8c0c[_0x0e89('0x36')]=_0x2b8c0c['attributes']['length']?_0x2b8c0c[_0x0e89('0x36')]:_0x15475c[_0x0e89('0x31')];if(_0x21b425[_0x0e89('0x33')][_0x0e89('0x41')]){_0x2b8c0c[_0x0e89('0x42')]=[{'all':!![]}];}_0x2b8c0c=_['merge']({},_0x2b8c0c,_0x21b425['options']);return db[_0x0e89('0x2d')][_0x0e89('0x47')](_0x2b8c0c)[_0x0e89('0x27')](handleEntityNotFound(_0x1ac741,null))[_0x0e89('0x27')](respondWithResult(_0x1ac741,null))[_0x0e89('0x45')](handleError(_0x1ac741,null));};exports[_0x0e89('0x48')]=function(_0x999b80,_0x4f6112){return db[_0x0e89('0x2d')][_0x0e89('0x48')](_0x999b80[_0x0e89('0x49')],{})[_0x0e89('0x27')](respondWithResult(_0x4f6112,0xc9))[_0x0e89('0x45')](handleError(_0x4f6112,null));};exports[_0x0e89('0x25')]=function(_0xacc9f4,_0xd55d95){if(_0xacc9f4[_0x0e89('0x49')]['id']){delete _0xacc9f4[_0x0e89('0x49')]['id'];}return db['VtigerAccount'][_0x0e89('0x47')]({'where':{'id':_0xacc9f4[_0x0e89('0x46')]['id']}})['then'](handleEntityNotFound(_0xd55d95,null))[_0x0e89('0x27')](saveUpdates(_0xacc9f4[_0x0e89('0x49')],null))[_0x0e89('0x27')](respondWithResult(_0xd55d95,null))[_0x0e89('0x45')](handleError(_0xd55d95,null));};exports['destroy']=function(_0x1ea876,_0x45e4ab){return db['VtigerAccount'][_0x0e89('0x47')]({'where':{'id':_0x1ea876[_0x0e89('0x46')]['id']}})[_0x0e89('0x27')](handleEntityNotFound(_0x45e4ab,null))['then'](removeEntity(_0x45e4ab,null))[_0x0e89('0x45')](handleError(_0x45e4ab,null));};exports[_0x0e89('0x4a')]=function(_0x2be1a4,_0x2b724e,_0x2bef61){var _0x1852d4={};var _0x13aeaf={};var _0xb29452;var _0x958284;return db['VtigerAccount'][_0x0e89('0x4b')]({'where':{'id':_0x2be1a4[_0x0e89('0x46')]['id']}})[_0x0e89('0x27')](handleEntityNotFound(_0x2b724e,null))[_0x0e89('0x27')](function(_0x14d4d0){if(_0x14d4d0){_0xb29452=_0x14d4d0;_0x13aeaf[_0x0e89('0x31')]=_[_0x0e89('0x32')](db['VtigerConfiguration'][_0x0e89('0x2e')]);_0x13aeaf[_0x0e89('0x33')]=_[_0x0e89('0x32')](_0x2be1a4['query']);_0x13aeaf['filters']=_[_0x0e89('0x34')](_0x13aeaf[_0x0e89('0x31')],_0x13aeaf[_0x0e89('0x33')]);_0x1852d4[_0x0e89('0x36')]=_[_0x0e89('0x34')](_0x13aeaf[_0x0e89('0x31')],qs[_0x0e89('0x35')](_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x35')]));_0x1852d4[_0x0e89('0x36')]=_0x1852d4[_0x0e89('0x36')]['length']?_0x1852d4[_0x0e89('0x36')]:_0x13aeaf[_0x0e89('0x31')];_0x1852d4[_0x0e89('0x3a')]=qs[_0x0e89('0x3b')](_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x3b')]);_0x1852d4['where']=qs['filters'](_['pick'](_0x2be1a4[_0x0e89('0x33')],_0x13aeaf[_0x0e89('0x3d')]));if(_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x3e')]){_0x1852d4['where']=_[_0x0e89('0x4c')](_0x1852d4[_0x0e89('0x3c')],{'$or':_[_0x0e89('0x2c')](_0x1852d4[_0x0e89('0x36')],function(_0xe61083){var _0x57a56b={};_0x57a56b[_0xe61083]={'$like':'%'+_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x3e')]+'%'};return _0x57a56b;})});}_0x1852d4=_['merge']({},_0x1852d4,_0x2be1a4[_0x0e89('0x40')]);return _0xb29452['getConfigurations'](_0x1852d4);}})['then'](function(_0x1715c3){if(_0x1715c3){_0x958284=_0x1715c3['length'];if(!_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x38')](_0x0e89('0x39'))){_0x1852d4[_0x0e89('0x1f')]=qs[_0x0e89('0x1f')](_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x1f')]);_0x1852d4[_0x0e89('0x1d')]=qs[_0x0e89('0x1d')](_0x2be1a4[_0x0e89('0x33')][_0x0e89('0x1d')]);}return _0xb29452[_0x0e89('0x4a')](_0x1852d4);}})[_0x0e89('0x27')](function(_0x63a2ed){if(_0x63a2ed){return _0x63a2ed?{'count':_0x958284,'rows':_0x63a2ed}:null;}})[_0x0e89('0x27')](respondWithResult(_0x2b724e,null))[_0x0e89('0x45')](handleError(_0x2b724e,null));};exports[_0x0e89('0x4d')]=function(_0x332f14,_0x41fdd0,_0x229073){if(_0x332f14['body']['id']){delete _0x332f14[_0x0e89('0x49')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x332f14['params']['id']}})[_0x0e89('0x27')](handleEntityNotFound(_0x41fdd0,null))[_0x0e89('0x27')](function(_0x4b938f){if(_0x4b938f){_0x332f14[_0x0e89('0x49')][_0x0e89('0x4e')]=_0x4b938f['id'];_0x332f14[_0x0e89('0x49')][_0x0e89('0x4f')]=integrations['getSubjects'](_0x332f14[_0x0e89('0x49')][_0x0e89('0x50')],_0x332f14[_0x0e89('0x49')][_0x0e89('0x3f')]);_0x332f14[_0x0e89('0x49')][_0x0e89('0x51')]=integrations[_0x0e89('0x52')](_0x332f14[_0x0e89('0x49')][_0x0e89('0x50')],_0x332f14[_0x0e89('0x49')][_0x0e89('0x3f')]);return db[_0x0e89('0x53')][_0x0e89('0x48')](_0x332f14[_0x0e89('0x49')],{'include':[{'model':db[_0x0e89('0x54')],'as':_0x0e89('0x4f')},{'model':db[_0x0e89('0x54')],'as':_0x0e89('0x51')}]});}return null;})['then'](respondWithResult(_0x41fdd0,null))[_0x0e89('0x45')](handleError(_0x41fdd0,null));};var md5=require(_0x0e89('0x55'));exports['getFields']=function(_0x32c56b,_0x188a3a,_0x21809b){var _0x568e56=null;var _0x40a32e=null;var _0x4b4b09=null;var _0x3ffbc4=null;var _0x227154='';return db[_0x0e89('0x2d')][_0x0e89('0x4b')]({'where':{'id':_0x32c56b[_0x0e89('0x46')]['id']},'attributes':['id','name',_0x0e89('0x56'),_0x0e89('0x57'),_0x0e89('0x58'),_0x0e89('0x59'),_0x0e89('0x5a'),_0x0e89('0x5b')]})['then'](handleEntityNotFound(_0x188a3a,null))[_0x0e89('0x27')](function(_0x13ed07){if(_0x13ed07){_0x568e56=_0x13ed07['username'];_0x40a32e=_0x13ed07['accessKey'];_0x4b4b09=_0x13ed07['moduleName'];_0x227154=_0x13ed07[_0x0e89('0x59')];var _0x38b31a=_0x227154['slice'](-0x1);if(_0x38b31a==='/'){_0x227154=_0x227154['substring'](0x0,_0x227154['lastIndexOf'](_0x38b31a));}_0x3ffbc4=util[_0x0e89('0x5c')](_0x0e89('0x5d'),_0x227154);var _0x24b415={'method':'GET','uri':_0x3ffbc4,'qs':{'operation':'getchallenge','username':_0x13ed07['username']},'json':!![]};return rp(_0x24b415);}})[_0x0e89('0x27')](function(_0x1affa3){if(_0x1affa3['success']){var _0x5b27cd={'method':_0x0e89('0x5e'),'uri':_0x3ffbc4,'form':{'operation':_0x0e89('0x5f'),'username':_0x568e56,'accessKey':md5(_0x1affa3['result'][_0x0e89('0x60')]+_0x40a32e)},'json':!![]};return rp(_0x5b27cd);}})[_0x0e89('0x27')](function(_0x571422){if(_0x571422[_0x0e89('0x61')]){var _0x4aa4eb={'method':_0x0e89('0x62'),'uri':_0x3ffbc4,'qs':{'operation':_0x0e89('0x63'),'username':_0x568e56,'sessionName':_0x571422[_0x0e89('0x64')][_0x0e89('0x65')],'elementType':_0x4b4b09},'json':!![]};return rp(_0x4aa4eb);}})['then'](function(_0xe00d26){if(_0xe00d26['success']){var _0x26a4e9=[_0x0e89('0x66'),_0x0e89('0x67'),_0x0e89('0x68')];_[_0x0e89('0x69')](_0xe00d26['result']['fields'],function(_0x522968){return _0x26a4e9[_0x0e89('0x6a')](_0x522968['type']['name']);});_['remove'](_0xe00d26['result']['fields'],function(_0x41bc93){return _0x41bc93['editable']===_0x0e89('0x6b');});return{'count':_0xe00d26[_0x0e89('0x64')][_0x0e89('0x35')][_0x0e89('0x37')],'rows':_[_0x0e89('0x2c')](_0xe00d26[_0x0e89('0x64')]['fields'],function(_0x105152){return{'id':_0x105152['name'],'name':_0x105152['label'],'custom':_['startsWith'](_0x105152[_0x0e89('0x29')],'cf_')?!![]:![],'options':_0x105152[_0x0e89('0x3f')][_0x0e89('0x29')]===_0x0e89('0x6c')&&_0x105152[_0x0e89('0x3f')][_0x0e89('0x6d')]['length']>0x0?_['map'](_0x105152[_0x0e89('0x3f')][_0x0e89('0x6d')],function(_0x30e7c6){return{'name':_0x30e7c6[_0x0e89('0x6e')],'value':_0x30e7c6['value']};}):[]};})};}})[_0x0e89('0x27')](respondWithResult(_0x188a3a,null))[_0x0e89('0x45')](function(_0x3ea8f5){console[_0x0e89('0x6f')](_0x0e89('0x70')+_0x3ea8f5);var _0x362822=_0x32c56b[_0x0e89('0x33')][_0x0e89('0x71')]?0x1f4:_0x3ea8f5[_0x0e89('0x72')]||0x1f4;logger[_0x0e89('0x73')](_0x0e89('0x74'),_0x0e89('0x75'),_0x362822,JSON[_0x0e89('0x76')](_0x3ea8f5));delete _0x3ea8f5['name'];if(_0x362822===0x191){_0x362822=0x190;}_0x188a3a[_0x0e89('0x1a')](_0x362822)['send'](_0x32c56b[_0x0e89('0x33')][_0x0e89('0x71')]?{'message':_0x0e89('0x77'),'statusCode':_0x3ea8f5[_0x0e89('0x72')]}:_0x3ea8f5);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8e99b7f..dd97607 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 _0xa753=['bluebird','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','lodash','util','../../config/logger','moment'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xa753,0xa6));var _0x3a75=function(_0x19f73c,_0x21ad86){_0x19f73c=_0x19f73c-0x0;var _0x3f3323=_0xa753[_0x19f73c];return _0x3f3323;};'use strict';var _=require(_0x3a75('0x0'));var util=require(_0x3a75('0x1'));var logger=require(_0x3a75('0x2'))('api');var moment=require(_0x3a75('0x3'));var BPromise=require(_0x3a75('0x4'));var rp=require(_0x3a75('0x5'));var fs=require('fs');var path=require(_0x3a75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a75('0x7'));var integrations=require(_0x3a75('0x8'));module['exports']=function(_0x3a8514,_0x26ea73){return _0x3a8514['define'](_0x3a75('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1563=['api','request-promise','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x1563,0xb1));var _0x3156=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x1563[_0x11ec6c];return _0xb59506;};'use strict';var _=require(_0x3156('0x0'));var util=require(_0x3156('0x1'));var logger=require(_0x3156('0x2'))(_0x3156('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3156('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3156('0x5'));var attributes=require(_0x3156('0x6'));var integrations=require(_0x3156('0x7'));module[_0x3156('0x8')]=function(_0x9c956e,_0x55ed58){return _0x9c956e[_0x3156('0x9')](_0x3156('0xa'),attributes,{'tableName':_0x3156('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 602828f..ed18802 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 _0x04b8=['jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x04b8,0x159));var _0x804b=function(_0x48d138,_0x2fa9df){_0x48d138=_0x48d138-0x0;var _0x1e1ed8=_0x04b8[_0x48d138];return _0x1e1ed8;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5404,_0x476262,_0x50826d){return new BPromise(function(_0x27e950,_0x1071b4){return client['request'](_0x3c5404,_0x50826d)[_0x804b('0x9')](function(_0x336325){logger[_0x804b('0xa')](_0x804b('0xb'),_0x476262,_0x804b('0xc'));logger['debug'](_0x804b('0xd'),_0x476262,_0x804b('0xc'),JSON[_0x804b('0xe')](_0x336325));if(_0x336325[_0x804b('0xf')]){if(_0x336325[_0x804b('0xf')][_0x804b('0x10')]===0x1f4){logger['error'](_0x804b('0xb'),_0x476262,_0x336325['error'][_0x804b('0x11')]);return _0x1071b4(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}logger[_0x804b('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x476262,_0x336325[_0x804b('0xf')][_0x804b('0x11')]);return _0x27e950(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}else{logger['info'](_0x804b('0xb'),_0x476262,_0x804b('0xc'));_0x27e950(_0x336325['result'][_0x804b('0x11')]);}})['catch'](function(_0x2c90b9){logger[_0x804b('0xf')](_0x804b('0xb'),_0x476262,_0x2c90b9);_0x1071b4(_0x2c90b9);});});}exports[_0x804b('0x12')]=function(_0x3a05c0){var _0x5a0a82=this;return new Promise(function(_0x871d6c,_0x50b4fe){return db[_0x804b('0x13')][_0x804b('0x14')]({'raw':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x17')]||null:null,'limit':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x18')]||null:null,'include':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['include']?_[_0x804b('0x19')](_0x3a05c0[_0x804b('0x15')]['include'],function(_0x44a921){return{'model':db[_0x44a921[_0x804b('0x1a')]],'as':_0x44a921['as'],'attributes':_0x44a921[_0x804b('0x17')],'include':_0x44a921[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x44a921['include'],function(_0x2de812){return{'model':db[_0x2de812[_0x804b('0x1a')]],'as':_0x2de812['as'],'attributes':_0x2de812['attributes'],'include':_0x2de812[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x2de812[_0x804b('0x1b')],function(_0x27d5ec){return{'model':db[_0x27d5ec[_0x804b('0x1a')]],'as':_0x27d5ec['as'],'attributes':_0x27d5ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x804b('0x9')](function(_0x22f822){logger[_0x804b('0xa')](_0x804b('0x12'),_0x3a05c0);logger[_0x804b('0x1c')]('GetVtigerAccount',_0x3a05c0,JSON[_0x804b('0xe')](_0x22f822));_0x871d6c(_0x22f822);})[_0x804b('0x1d')](function(_0x410871){logger['error'](_0x804b('0x12'),_0x410871[_0x804b('0x11')],_0x3a05c0);_0x50b4fe(_0x5a0a82[_0x804b('0xf')](0x1f4,_0x410871['message']));});});};exports[_0x804b('0x1e')]=function(_0x471c04){var _0x5e8f85=this;return new Promise(function(_0x391376,_0x37dd3e){return db[_0x804b('0x13')][_0x804b('0x1f')]({'raw':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x17')]||null:null,'include':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x1b')]?_[_0x804b('0x19')](_0x471c04[_0x804b('0x15')][_0x804b('0x1b')],function(_0x34d5d0){return{'model':db[_0x34d5d0[_0x804b('0x1a')]],'as':_0x34d5d0['as'],'attributes':_0x34d5d0[_0x804b('0x17')],'include':_0x34d5d0[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x34d5d0[_0x804b('0x1b')],function(_0xf47023){return{'model':db[_0xf47023[_0x804b('0x1a')]],'as':_0xf47023['as'],'attributes':_0xf47023[_0x804b('0x17')],'include':_0xf47023[_0x804b('0x1b')]?_[_0x804b('0x19')](_0xf47023[_0x804b('0x1b')],function(_0x35150b){return{'model':db[_0x35150b['model']],'as':_0x35150b['as'],'attributes':_0x35150b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da331){logger[_0x804b('0xa')](_0x804b('0x1e'),_0x471c04);logger['debug']('ShowVtigerAccount',_0x471c04,JSON['stringify'](_0x3da331));_0x391376(_0x3da331);})[_0x804b('0x1d')](function(_0x1aaa47){logger[_0x804b('0xf')](_0x804b('0x1e'),_0x1aaa47[_0x804b('0x11')],_0x471c04);_0x37dd3e(_0x5e8f85[_0x804b('0xf')](0x1f4,_0x1aaa47[_0x804b('0x11')]));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetVtigerAccount','VtigerAccount','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2776ad,_0x5e26ed){var _0x378760=function(_0x10bb9f){while(--_0x10bb9f){_0x2776ad['push'](_0x2776ad['shift']());}};_0x378760(++_0x5e26ed);}(_0x4fc2,0x111));var _0x24fc=function(_0x573dce,_0xaf98ef){_0x573dce=_0x573dce-0x0;var _0x96ac9c=_0x4fc2[_0x573dce];return _0x96ac9c;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetVtigerAccount']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['VtigerAccount'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowVtigerAccount']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bb81ec6..8ae328f 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 _0x8b2f=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update'];(function(_0x59ee92,_0x4f57d0){var _0x3ad8df=function(_0x359b50){while(--_0x359b50){_0x59ee92['push'](_0x59ee92['shift']());}};_0x3ad8df(++_0x4f57d0);}(_0x8b2f,0x172));var _0xf8b2=function(_0x4db498,_0x1b9c7d){_0x4db498=_0x4db498-0x0;var _0x483a1b=_0x8b2f[_0x4db498];return _0x483a1b;};'use strict';var multer=require(_0xf8b2('0x0'));var util=require(_0xf8b2('0x1'));var path=require(_0xf8b2('0x2'));var timeout=require(_0xf8b2('0x3'));var express=require('express');var router=express[_0xf8b2('0x4')]();var fs_extra=require(_0xf8b2('0x5'));var auth=require(_0xf8b2('0x6'));var interaction=require(_0xf8b2('0x7'));var config=require(_0xf8b2('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0xf8b2('0x9')]('/',auth[_0xf8b2('0xa')](),controller[_0xf8b2('0xb')]);router[_0xf8b2('0x9')](_0xf8b2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf8b2('0x9')](_0xf8b2('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xf8b2('0x9')](_0xf8b2('0xe'),auth[_0xf8b2('0xa')](),controller[_0xf8b2('0xf')]);router['get'](_0xf8b2('0x10'),auth[_0xf8b2('0xa')](),controller[_0xf8b2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf8b2('0x12')]);router[_0xf8b2('0x13')](_0xf8b2('0xc'),auth['isAuthenticated'](),controller[_0xf8b2('0x14')]);router[_0xf8b2('0x15')]('/:id',auth[_0xf8b2('0xa')](),controller[_0xf8b2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8cdb=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x8cdb,0x1dc));var _0xb8cd=function(_0x58af53,_0x10e6a1){_0x58af53=_0x58af53-0x0;var _0x3d507d=_0x8cdb[_0x58af53];return _0x3d507d;};'use strict';var multer=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var path=require(_0xb8cd('0x2'));var timeout=require(_0xb8cd('0x3'));var express=require('express');var router=express[_0xb8cd('0x4')]();var fs_extra=require(_0xb8cd('0x5'));var auth=require(_0xb8cd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8cd('0x7'));router[_0xb8cd('0x8')]('/',auth[_0xb8cd('0x9')](),controller[_0xb8cd('0xa')]);router[_0xb8cd('0x8')](_0xb8cd('0xb'),auth[_0xb8cd('0x9')](),controller[_0xb8cd('0xc')]);router[_0xb8cd('0x8')](_0xb8cd('0xd'),auth[_0xb8cd('0x9')](),controller[_0xb8cd('0xe')]);router[_0xb8cd('0x8')](_0xb8cd('0xf'),auth[_0xb8cd('0x9')](),controller['getSubjects']);router['get'](_0xb8cd('0x10'),auth['isAuthenticated'](),controller[_0xb8cd('0x11')]);router[_0xb8cd('0x12')]('/',auth[_0xb8cd('0x9')](),controller['create']);router[_0xb8cd('0x13')](_0xb8cd('0xb'),auth[_0xb8cd('0x9')](),controller[_0xb8cd('0x14')]);router['delete'](_0xb8cd('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb8cd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 033b6ac..7df06ff 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 _0xbacd=['sequelize','exports','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xbacd,0x1aa));var _0xdbac=function(_0x35199e,_0x585fa1){_0x35199e=_0x35199e-0x0;var _0x13d0cc=_0xbacd[_0x35199e];return _0x13d0cc;};'use strict';var Sequelize=require(_0xdbac('0x0'));module[_0xdbac('0x1')]={'name':{'type':Sequelize[_0xdbac('0x2')]},'description':{'type':Sequelize[_0xdbac('0x2')]}}; \ No newline at end of file +var _0x1ad5=['sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1ad5,0xc9));var _0x51ad=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1ad5[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x51ad('0x0'));module[_0x51ad('0x1')]={'name':{'type':Sequelize[_0x51ad('0x2')]},'description':{'type':Sequelize[_0x51ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0e9feb0..cd325a9 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 _0xb63c=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','catch','create','find','params','body','getFields','findOne','getSubjects','VtigerField'];(function(_0x2152be,_0x232f64){var _0x1af596=function(_0x4ae0c8){while(--_0x4ae0c8){_0x2152be['push'](_0x2152be['shift']());}};_0x1af596(++_0x232f64);}(_0xb63c,0x155));var _0xcb63=function(_0x3a07b4,_0x469816){_0x3a07b4=_0x3a07b4-0x0;var _0x51dfa1=_0xb63c[_0x3a07b4];return _0x51dfa1;};'use strict';var emlformat=require(_0xcb63('0x0'));var rimraf=require(_0xcb63('0x1'));var zipdir=require(_0xcb63('0x2'));var jsonpatch=require(_0xcb63('0x3'));var rp=require(_0xcb63('0x4'));var moment=require(_0xcb63('0x5'));var BPromise=require(_0xcb63('0x6'));var Mustache=require(_0xcb63('0x7'));var util=require(_0xcb63('0x8'));var path=require(_0xcb63('0x9'));var sox=require(_0xcb63('0xa'));var csv=require(_0xcb63('0xb'));var ejs=require(_0xcb63('0xc'));var fs=require('fs');var fs_extra=require(_0xcb63('0xd'));var _=require(_0xcb63('0xe'));var squel=require(_0xcb63('0xf'));var crypto=require(_0xcb63('0x10'));var jsforce=require(_0xcb63('0x11'));var deskjs=require(_0xcb63('0x12'));var toCsv=require(_0xcb63('0xb'));var querystring=require(_0xcb63('0x13'));var Papa=require(_0xcb63('0x14'));var Redis=require('ioredis');var authService=require(_0xcb63('0x15'));var qs=require(_0xcb63('0x16'));var as=require(_0xcb63('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb63('0x18'));var utils=require(_0xcb63('0x19'));var config=require(_0xcb63('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb63('0x1b'))['db'];function respondWithStatusCode(_0x19940c,_0x575124){_0x575124=_0x575124||0xcc;return function(_0x1d4d72){if(_0x1d4d72){return _0x19940c[_0xcb63('0x1c')](_0x575124);}return _0x19940c[_0xcb63('0x1d')](_0x575124)[_0xcb63('0x1e')]();};}function respondWithResult(_0x4d4e57,_0xce72d3){_0xce72d3=_0xce72d3||0xc8;return function(_0x5191cb){if(_0x5191cb){return _0x4d4e57[_0xcb63('0x1d')](_0xce72d3)['json'](_0x5191cb);}};}function respondWithFilteredResult(_0x2363b9,_0x404f2a){return function(_0x44f13f){if(_0x44f13f){var _0x521bb7=typeof _0x404f2a[_0xcb63('0x1f')]===_0xcb63('0x20')&&typeof _0x404f2a[_0xcb63('0x21')]==='undefined';var _0x1bb242=_0x44f13f['count'];var _0x4a2ef0=_0x521bb7?0x0:_0x404f2a['offset'];var _0x234134=_0x521bb7?_0x44f13f['count']:_0x404f2a[_0xcb63('0x1f')]+_0x404f2a[_0xcb63('0x21')];var _0x48748d;if(_0x234134>=_0x1bb242){_0x234134=_0x1bb242;_0x48748d=0xc8;}else{_0x48748d=0xce;}_0x2363b9['status'](_0x48748d);return _0x2363b9['set'](_0xcb63('0x22'),_0x4a2ef0+'-'+_0x234134+'/'+_0x1bb242)[_0xcb63('0x23')](_0x44f13f);}return null;};}function patchUpdates(_0x10c6e4){return function(_0x518e47){try{jsonpatch[_0xcb63('0x24')](_0x518e47,_0x10c6e4,!![]);}catch(_0xf0c3c7){return BPromise[_0xcb63('0x25')](_0xf0c3c7);}return _0x518e47[_0xcb63('0x26')]();};}function saveUpdates(_0x5aad6f,_0x4a41b3){return function(_0x1b06e8){if(_0x1b06e8){return _0x1b06e8[_0xcb63('0x27')](_0x5aad6f)[_0xcb63('0x28')](function(_0x535279){return _0x535279;});}return null;};}function removeEntity(_0x2b3e4a,_0x27c6ee){return function(_0x3edbaa){if(_0x3edbaa){return _0x3edbaa[_0xcb63('0x29')]()[_0xcb63('0x28')](function(){_0x2b3e4a[_0xcb63('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b194,_0x5c2ca3){return function(_0x2574a0){if(!_0x2574a0){_0x28b194['sendStatus'](0x194);}return _0x2574a0;};}function handleError(_0x4077bf,_0x48fb9d){_0x48fb9d=_0x48fb9d||0x1f4;return function(_0x47931e){logger[_0xcb63('0x2a')](_0x47931e['stack']);if(_0x47931e[_0xcb63('0x2b')]){delete _0x47931e[_0xcb63('0x2b')];}_0x4077bf['status'](_0x48fb9d)[_0xcb63('0x2c')](_0x47931e);};}exports[_0xcb63('0x2d')]=function(_0xdf9b3b,_0x1dc084){var _0x5c057c={},_0xcc45e9={},_0x994e92={'count':0x0,'rows':[]};var _0x36820a=_[_0xcb63('0x2e')](db[_0xcb63('0x2f')][_0xcb63('0x30')],function(_0x4a8420){return{'name':_0x4a8420[_0xcb63('0x31')],'type':_0x4a8420[_0xcb63('0x32')]['key']};});_0xcc45e9[_0xcb63('0x33')]=_[_0xcb63('0x2e')](_0x36820a,_0xcb63('0x2b'));_0xcc45e9[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0xdf9b3b[_0xcb63('0x34')]);_0xcc45e9[_0xcb63('0x36')]=_['intersection'](_0xcc45e9[_0xcb63('0x33')],_0xcc45e9['query']);_0x5c057c[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0xcc45e9[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x39')]));_0x5c057c['attributes']=_0x5c057c[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x5c057c[_0xcb63('0x37')]:_0xcc45e9[_0xcb63('0x33')];if(!_0xdf9b3b['query'][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x5c057c[_0xcb63('0x21')]=qs[_0xcb63('0x21')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x21')]);_0x5c057c[_0xcb63('0x1f')]=qs[_0xcb63('0x1f')](_0xdf9b3b['query'][_0xcb63('0x1f')]);}_0x5c057c[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x5c057c[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0xdf9b3b['query'],_0xcc45e9[_0xcb63('0x36')]),_0x36820a);if(_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x41')]){_0x5c057c[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x5c057c[_0xcb63('0x3f')],{'$or':_['map'](_0x36820a,function(_0x360076){if(_0x360076[_0xcb63('0x32')]!==_0xcb63('0x43')){var _0x4e7dc2={};_0x4e7dc2[_0x360076[_0xcb63('0x2b')]]={'$like':'%'+_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x4e7dc2;}})});}_0x5c057c=_['merge']({},_0x5c057c,_0xdf9b3b[_0xcb63('0x44')]);var _0x85598e={'where':_0x5c057c[_0xcb63('0x3f')]};return db['VtigerConfiguration']['count'](_0x85598e)[_0xcb63('0x28')](function(_0x45782b){_0x994e92[_0xcb63('0x45')]=_0x45782b;if(_0xdf9b3b[_0xcb63('0x34')][_0xcb63('0x46')]){_0x5c057c[_0xcb63('0x47')]=[{'all':!![]}];}return db[_0xcb63('0x2f')][_0xcb63('0x48')](_0x5c057c);})[_0xcb63('0x28')](function(_0x4e7f31){_0x994e92[_0xcb63('0x49')]=_0x4e7f31;return _0x994e92;})['then'](respondWithFilteredResult(_0x1dc084,_0x5c057c))['catch'](handleError(_0x1dc084,null));};exports[_0xcb63('0x4a')]=function(_0x17072d,_0xb80c4a){var _0x114da6={'raw':![],'where':{'id':_0x17072d['params']['id']}},_0x38ecf0={};_0x38ecf0[_0xcb63('0x33')]=_['keys'](db[_0xcb63('0x2f')][_0xcb63('0x30')]);_0x38ecf0[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x17072d[_0xcb63('0x34')]);_0x38ecf0[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x38ecf0[_0xcb63('0x33')],_0x38ecf0[_0xcb63('0x34')]);_0x114da6[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0x38ecf0['model'],qs[_0xcb63('0x39')](_0x17072d[_0xcb63('0x34')]['fields']));_0x114da6[_0xcb63('0x37')]=_0x114da6[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x114da6[_0xcb63('0x37')]:_0x38ecf0[_0xcb63('0x33')];if(_0x17072d[_0xcb63('0x34')][_0xcb63('0x46')]){_0x114da6[_0xcb63('0x47')]=[{'all':!![]}];}_0x114da6=_[_0xcb63('0x42')]({},_0x114da6,_0x17072d[_0xcb63('0x44')]);return db[_0xcb63('0x2f')]['find'](_0x114da6)[_0xcb63('0x28')](handleEntityNotFound(_0xb80c4a,null))['then'](respondWithResult(_0xb80c4a,null))[_0xcb63('0x4b')](handleError(_0xb80c4a,null));};exports[_0xcb63('0x4c')]=function(_0x1af3b2,_0x832908){return db[_0xcb63('0x2f')][_0xcb63('0x4c')](_0x1af3b2['body'],{})[_0xcb63('0x28')](respondWithResult(_0x832908,0xc9))[_0xcb63('0x4b')](handleError(_0x832908,null));};exports[_0xcb63('0x27')]=function(_0x1230d5,_0x28105a){if(_0x1230d5['body']['id']){delete _0x1230d5['body']['id'];}return db[_0xcb63('0x2f')][_0xcb63('0x4d')]({'where':{'id':_0x1230d5[_0xcb63('0x4e')]['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x28105a,null))[_0xcb63('0x28')](saveUpdates(_0x1230d5[_0xcb63('0x4f')],null))[_0xcb63('0x28')](respondWithResult(_0x28105a,null))[_0xcb63('0x4b')](handleError(_0x28105a,null));};exports[_0xcb63('0x29')]=function(_0x184b9f,_0x17227c){return db[_0xcb63('0x2f')][_0xcb63('0x4d')]({'where':{'id':_0x184b9f[_0xcb63('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17227c,null))[_0xcb63('0x28')](removeEntity(_0x17227c,null))['catch'](handleError(_0x17227c,null));};exports[_0xcb63('0x50')]=function(_0x5ae0c9,_0x46f891,_0x2bebb2){var _0x49d1fd={};var _0x45f55b={};var _0x2168aa;var _0xe4a88f;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x5ae0c9[_0xcb63('0x4e')]['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x46f891,null))[_0xcb63('0x28')](function(_0x2876eb){if(_0x2876eb){_0x2168aa=_0x2876eb;_0x45f55b['model']=_[_0xcb63('0x35')](db['VtigerField'][_0xcb63('0x30')]);_0x45f55b[_0xcb63('0x34')]=_['keys'](_0x5ae0c9['query']);_0x45f55b[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x45f55b[_0xcb63('0x33')],_0x45f55b[_0xcb63('0x34')]);_0x49d1fd[_0xcb63('0x37')]=_['intersection'](_0x45f55b[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0x5ae0c9['query'][_0xcb63('0x39')]));_0x49d1fd[_0xcb63('0x37')]=_0x49d1fd[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x49d1fd[_0xcb63('0x37')]:_0x45f55b[_0xcb63('0x33')];_0x49d1fd['order']=qs[_0xcb63('0x3e')](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x49d1fd[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0x5ae0c9[_0xcb63('0x34')],_0x45f55b[_0xcb63('0x36')]));if(_0x5ae0c9[_0xcb63('0x34')]['filter']){_0x49d1fd[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x49d1fd[_0xcb63('0x3f')],{'$or':_[_0xcb63('0x2e')](_0x49d1fd['attributes'],function(_0x48f36c){var _0x48ddcb={};_0x48ddcb[_0x48f36c]={'$like':'%'+_0x5ae0c9['query'][_0xcb63('0x41')]+'%'};return _0x48ddcb;})});}_0x49d1fd=_[_0xcb63('0x42')]({},_0x49d1fd,_0x5ae0c9['options']);return _0x2168aa[_0xcb63('0x50')](_0x49d1fd);}})['then'](function(_0x5d38d5){if(_0x5d38d5){_0xe4a88f=_0x5d38d5[_0xcb63('0x3a')];if(!_0x5ae0c9['query'][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x49d1fd['limit']=qs['limit'](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x21')]);_0x49d1fd[_0xcb63('0x1f')]=qs['offset'](_0x5ae0c9[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x2168aa[_0xcb63('0x50')](_0x49d1fd);}})[_0xcb63('0x28')](function(_0x4f153a){if(_0x4f153a){return _0x4f153a?{'count':_0xe4a88f,'rows':_0x4f153a}:null;}})[_0xcb63('0x28')](respondWithResult(_0x46f891,null))[_0xcb63('0x4b')](handleError(_0x46f891,null));};exports[_0xcb63('0x52')]=function(_0x850f4b,_0x2a5eeb,_0x55ccc2){var _0x2edc4e={};var _0x309ffb={};var _0x4a3bc0;var _0x572fc0;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x850f4b[_0xcb63('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a5eeb,null))[_0xcb63('0x28')](function(_0xbb5259){if(_0xbb5259){_0x4a3bc0=_0xbb5259;_0x309ffb[_0xcb63('0x33')]=_[_0xcb63('0x35')](db['VtigerField'][_0xcb63('0x30')]);_0x309ffb[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x850f4b[_0xcb63('0x34')]);_0x309ffb[_0xcb63('0x36')]=_['intersection'](_0x309ffb['model'],_0x309ffb[_0xcb63('0x34')]);_0x2edc4e[_0xcb63('0x37')]=_[_0xcb63('0x38')](_0x309ffb['model'],qs['fields'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x39')]));_0x2edc4e[_0xcb63('0x37')]=_0x2edc4e['attributes'][_0xcb63('0x3a')]?_0x2edc4e['attributes']:_0x309ffb[_0xcb63('0x33')];_0x2edc4e[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x3e')]);_0x2edc4e[_0xcb63('0x3f')]=qs['filters'](_[_0xcb63('0x40')](_0x850f4b[_0xcb63('0x34')],_0x309ffb[_0xcb63('0x36')]));if(_0x850f4b[_0xcb63('0x34')][_0xcb63('0x41')]){_0x2edc4e[_0xcb63('0x3f')]=_[_0xcb63('0x42')](_0x2edc4e[_0xcb63('0x3f')],{'$or':_['map'](_0x2edc4e[_0xcb63('0x37')],function(_0x2a6c0e){var _0x436bc6={};_0x436bc6[_0x2a6c0e]={'$like':'%'+_0x850f4b[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x436bc6;})});}_0x2edc4e=_[_0xcb63('0x42')]({},_0x2edc4e,_0x850f4b[_0xcb63('0x44')]);return _0x4a3bc0[_0xcb63('0x52')](_0x2edc4e);}})[_0xcb63('0x28')](function(_0x3088ca){if(_0x3088ca){_0x572fc0=_0x3088ca[_0xcb63('0x3a')];if(!_0x850f4b[_0xcb63('0x34')][_0xcb63('0x3b')](_0xcb63('0x3c'))){_0x2edc4e['limit']=qs['limit'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x21')]);_0x2edc4e[_0xcb63('0x1f')]=qs['offset'](_0x850f4b[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x4a3bc0[_0xcb63('0x52')](_0x2edc4e);}})[_0xcb63('0x28')](function(_0x4efd6d){if(_0x4efd6d){return _0x4efd6d?{'count':_0x572fc0,'rows':_0x4efd6d}:null;}})['then'](respondWithResult(_0x2a5eeb,null))[_0xcb63('0x4b')](handleError(_0x2a5eeb,null));};exports['getDescriptions']=function(_0x4994ac,_0x8dfe88,_0x28f7b1){var _0x36a8ce={};var _0x3575bf={};var _0x12b782;var _0x128525;return db[_0xcb63('0x2f')][_0xcb63('0x51')]({'where':{'id':_0x4994ac['params']['id']}})[_0xcb63('0x28')](handleEntityNotFound(_0x8dfe88,null))['then'](function(_0x5c26cd){if(_0x5c26cd){_0x12b782=_0x5c26cd;_0x3575bf[_0xcb63('0x33')]=_[_0xcb63('0x35')](db[_0xcb63('0x53')]['rawAttributes']);_0x3575bf[_0xcb63('0x34')]=_[_0xcb63('0x35')](_0x4994ac['query']);_0x3575bf[_0xcb63('0x36')]=_[_0xcb63('0x38')](_0x3575bf['model'],_0x3575bf[_0xcb63('0x34')]);_0x36a8ce['attributes']=_[_0xcb63('0x38')](_0x3575bf[_0xcb63('0x33')],qs[_0xcb63('0x39')](_0x4994ac['query'][_0xcb63('0x39')]));_0x36a8ce[_0xcb63('0x37')]=_0x36a8ce[_0xcb63('0x37')][_0xcb63('0x3a')]?_0x36a8ce[_0xcb63('0x37')]:_0x3575bf[_0xcb63('0x33')];_0x36a8ce[_0xcb63('0x3d')]=qs[_0xcb63('0x3e')](_0x4994ac[_0xcb63('0x34')]['sort']);_0x36a8ce[_0xcb63('0x3f')]=qs[_0xcb63('0x36')](_[_0xcb63('0x40')](_0x4994ac[_0xcb63('0x34')],_0x3575bf['filters']));if(_0x4994ac[_0xcb63('0x34')]['filter']){_0x36a8ce['where']=_[_0xcb63('0x42')](_0x36a8ce['where'],{'$or':_[_0xcb63('0x2e')](_0x36a8ce[_0xcb63('0x37')],function(_0x1b7a42){var _0x59cbf6={};_0x59cbf6[_0x1b7a42]={'$like':'%'+_0x4994ac[_0xcb63('0x34')][_0xcb63('0x41')]+'%'};return _0x59cbf6;})});}_0x36a8ce=_[_0xcb63('0x42')]({},_0x36a8ce,_0x4994ac[_0xcb63('0x44')]);return _0x12b782[_0xcb63('0x54')](_0x36a8ce);}})[_0xcb63('0x28')](function(_0x2dc581){if(_0x2dc581){_0x128525=_0x2dc581[_0xcb63('0x3a')];if(!_0x4994ac['query'][_0xcb63('0x3b')]('nolimit')){_0x36a8ce['limit']=qs['limit'](_0x4994ac[_0xcb63('0x34')][_0xcb63('0x21')]);_0x36a8ce[_0xcb63('0x1f')]=qs[_0xcb63('0x1f')](_0x4994ac[_0xcb63('0x34')][_0xcb63('0x1f')]);}return _0x12b782[_0xcb63('0x54')](_0x36a8ce);}})[_0xcb63('0x28')](function(_0x32b791){if(_0x32b791){return _0x32b791?{'count':_0x128525,'rows':_0x32b791}:null;}})['then'](respondWithResult(_0x8dfe88,null))[_0xcb63('0x4b')](handleError(_0x8dfe88,null));}; \ No newline at end of file +var _0x7754=['fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerConfiguration','includeAll','include','findAll','rows','params','fields','create','body','catch','find','VtigerField','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x7754,0x1d7));var _0x4775=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x7754[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0x4775('0x0'));var rimraf=require(_0x4775('0x1'));var zipdir=require(_0x4775('0x2'));var jsonpatch=require(_0x4775('0x3'));var rp=require(_0x4775('0x4'));var moment=require('moment');var BPromise=require(_0x4775('0x5'));var Mustache=require(_0x4775('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4775('0x7'));var csv=require('to-csv');var ejs=require(_0x4775('0x8'));var fs=require('fs');var fs_extra=require(_0x4775('0x9'));var _=require('lodash');var squel=require(_0x4775('0xa'));var crypto=require(_0x4775('0xb'));var jsforce=require(_0x4775('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4775('0xd'));var Papa=require(_0x4775('0xe'));var Redis=require('ioredis');var authService=require(_0x4775('0xf'));var qs=require(_0x4775('0x10'));var as=require(_0x4775('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4775('0x12'))(_0x4775('0x13'));var utils=require('../../config/utils');var config=require(_0x4775('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4775('0x15'))['db'];function respondWithStatusCode(_0x2373d0,_0x9ecd23){_0x9ecd23=_0x9ecd23||0xcc;return function(_0x585b7e){if(_0x585b7e){return _0x2373d0[_0x4775('0x16')](_0x9ecd23);}return _0x2373d0[_0x4775('0x17')](_0x9ecd23)[_0x4775('0x18')]();};}function respondWithResult(_0x572a32,_0x3a65d2){_0x3a65d2=_0x3a65d2||0xc8;return function(_0x2f02a7){if(_0x2f02a7){return _0x572a32[_0x4775('0x17')](_0x3a65d2)[_0x4775('0x19')](_0x2f02a7);}};}function respondWithFilteredResult(_0x36a0e2,_0x2c595b){return function(_0x8d9cf1){if(_0x8d9cf1){var _0xb83394=typeof _0x2c595b['offset']==='undefined'&&typeof _0x2c595b[_0x4775('0x1a')]===_0x4775('0x1b');var _0x58b63b=_0x8d9cf1[_0x4775('0x1c')];var _0x25c740=_0xb83394?0x0:_0x2c595b['offset'];var _0x370f20=_0xb83394?_0x8d9cf1[_0x4775('0x1c')]:_0x2c595b[_0x4775('0x1d')]+_0x2c595b[_0x4775('0x1a')];var _0x27f990;if(_0x370f20>=_0x58b63b){_0x370f20=_0x58b63b;_0x27f990=0xc8;}else{_0x27f990=0xce;}_0x36a0e2[_0x4775('0x17')](_0x27f990);return _0x36a0e2[_0x4775('0x1e')](_0x4775('0x1f'),_0x25c740+'-'+_0x370f20+'/'+_0x58b63b)[_0x4775('0x19')](_0x8d9cf1);}return null;};}function patchUpdates(_0x22e92a){return function(_0xb0f44c){try{jsonpatch[_0x4775('0x20')](_0xb0f44c,_0x22e92a,!![]);}catch(_0x16a277){return BPromise['reject'](_0x16a277);}return _0xb0f44c[_0x4775('0x21')]();};}function saveUpdates(_0x2508a5,_0x2cd7d9){return function(_0x242d95){if(_0x242d95){return _0x242d95[_0x4775('0x22')](_0x2508a5)[_0x4775('0x23')](function(_0x2481fb){return _0x2481fb;});}return null;};}function removeEntity(_0x4363e4,_0x13d794){return function(_0x19fe64){if(_0x19fe64){return _0x19fe64[_0x4775('0x24')]()[_0x4775('0x23')](function(){_0x4363e4[_0x4775('0x17')](0xcc)[_0x4775('0x18')]();});}};}function handleEntityNotFound(_0x1b125f,_0x516483){return function(_0x1ada1c){if(!_0x1ada1c){_0x1b125f['sendStatus'](0x194);}return _0x1ada1c;};}function handleError(_0x5ec017,_0x9edce6){_0x9edce6=_0x9edce6||0x1f4;return function(_0x28411a){logger[_0x4775('0x25')](_0x28411a[_0x4775('0x26')]);if(_0x28411a[_0x4775('0x27')]){delete _0x28411a[_0x4775('0x27')];}_0x5ec017['status'](_0x9edce6)[_0x4775('0x28')](_0x28411a);};}exports[_0x4775('0x29')]=function(_0x135730,_0x758626){var _0x5811a1={},_0x1bdbe1={},_0x5a8090={'count':0x0,'rows':[]};var _0xd77757=_[_0x4775('0x2a')](db['VtigerConfiguration'][_0x4775('0x2b')],function(_0x23acc6){return{'name':_0x23acc6[_0x4775('0x2c')],'type':_0x23acc6[_0x4775('0x2d')][_0x4775('0x2e')]};});_0x1bdbe1[_0x4775('0x2f')]=_[_0x4775('0x2a')](_0xd77757,_0x4775('0x27'));_0x1bdbe1[_0x4775('0x30')]=_[_0x4775('0x31')](_0x135730[_0x4775('0x30')]);_0x1bdbe1[_0x4775('0x32')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],_0x1bdbe1[_0x4775('0x30')]);_0x5811a1[_0x4775('0x34')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],qs['fields'](_0x135730['query']['fields']));_0x5811a1[_0x4775('0x34')]=_0x5811a1[_0x4775('0x34')][_0x4775('0x35')]?_0x5811a1[_0x4775('0x34')]:_0x1bdbe1[_0x4775('0x2f')];if(!_0x135730[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x5811a1['limit']=qs[_0x4775('0x1a')](_0x135730[_0x4775('0x30')]['limit']);_0x5811a1[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x135730[_0x4775('0x30')]['offset']);}_0x5811a1[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x135730[_0x4775('0x30')]['sort']);_0x5811a1[_0x4775('0x3a')]=qs['filters'](_['pick'](_0x135730[_0x4775('0x30')],_0x1bdbe1['filters']),_0xd77757);if(_0x135730[_0x4775('0x30')][_0x4775('0x3b')]){_0x5811a1[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x5811a1[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0xd77757,function(_0x13d1f5){if(_0x13d1f5[_0x4775('0x2d')]!=='VIRTUAL'){var _0x5b3146={};_0x5b3146[_0x13d1f5[_0x4775('0x27')]]={'$like':'%'+_0x135730['query'][_0x4775('0x3b')]+'%'};return _0x5b3146;}})});}_0x5811a1=_['merge']({},_0x5811a1,_0x135730[_0x4775('0x3d')]);var _0x1094a4={'where':_0x5811a1[_0x4775('0x3a')]};return db[_0x4775('0x3e')][_0x4775('0x1c')](_0x1094a4)[_0x4775('0x23')](function(_0x26655b){_0x5a8090[_0x4775('0x1c')]=_0x26655b;if(_0x135730[_0x4775('0x30')][_0x4775('0x3f')]){_0x5811a1[_0x4775('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x4775('0x41')](_0x5811a1);})[_0x4775('0x23')](function(_0x25720a){_0x5a8090[_0x4775('0x42')]=_0x25720a;return _0x5a8090;})[_0x4775('0x23')](respondWithFilteredResult(_0x758626,_0x5811a1))['catch'](handleError(_0x758626,null));};exports['show']=function(_0x357cde,_0x1f9b6e){var _0x42aa2e={'raw':![],'where':{'id':_0x357cde[_0x4775('0x43')]['id']}},_0x4a5b7f={};_0x4a5b7f[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x3e')][_0x4775('0x2b')]);_0x4a5b7f['query']=_[_0x4775('0x31')](_0x357cde[_0x4775('0x30')]);_0x4a5b7f[_0x4775('0x32')]=_[_0x4775('0x33')](_0x4a5b7f['model'],_0x4a5b7f[_0x4775('0x30')]);_0x42aa2e['attributes']=_['intersection'](_0x4a5b7f['model'],qs['fields'](_0x357cde[_0x4775('0x30')][_0x4775('0x44')]));_0x42aa2e[_0x4775('0x34')]=_0x42aa2e[_0x4775('0x34')][_0x4775('0x35')]?_0x42aa2e[_0x4775('0x34')]:_0x4a5b7f[_0x4775('0x2f')];if(_0x357cde[_0x4775('0x30')]['includeAll']){_0x42aa2e[_0x4775('0x40')]=[{'all':!![]}];}_0x42aa2e=_[_0x4775('0x3c')]({},_0x42aa2e,_0x357cde[_0x4775('0x3d')]);return db[_0x4775('0x3e')]['find'](_0x42aa2e)[_0x4775('0x23')](handleEntityNotFound(_0x1f9b6e,null))[_0x4775('0x23')](respondWithResult(_0x1f9b6e,null))['catch'](handleError(_0x1f9b6e,null));};exports[_0x4775('0x45')]=function(_0x5e6662,_0x40e2e0){return db[_0x4775('0x3e')][_0x4775('0x45')](_0x5e6662[_0x4775('0x46')],{})[_0x4775('0x23')](respondWithResult(_0x40e2e0,0xc9))[_0x4775('0x47')](handleError(_0x40e2e0,null));};exports[_0x4775('0x22')]=function(_0x386177,_0x3673e5){if(_0x386177[_0x4775('0x46')]['id']){delete _0x386177[_0x4775('0x46')]['id'];}return db[_0x4775('0x3e')][_0x4775('0x48')]({'where':{'id':_0x386177[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3673e5,null))['then'](saveUpdates(_0x386177[_0x4775('0x46')],null))[_0x4775('0x23')](respondWithResult(_0x3673e5,null))[_0x4775('0x47')](handleError(_0x3673e5,null));};exports[_0x4775('0x24')]=function(_0x28c900,_0x28a0c9){return db[_0x4775('0x3e')]['find']({'where':{'id':_0x28c900[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x28a0c9,null))['then'](removeEntity(_0x28a0c9,null))[_0x4775('0x47')](handleError(_0x28a0c9,null));};exports['getFields']=function(_0x1243cd,_0x3ed3b5,_0x27dd39){var _0x34faf7={};var _0x371dad={};var _0x3b2327;var _0x6a4d19;return db[_0x4775('0x3e')]['findOne']({'where':{'id':_0x1243cd[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3ed3b5,null))[_0x4775('0x23')](function(_0x50b7d3){if(_0x50b7d3){_0x3b2327=_0x50b7d3;_0x371dad[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x371dad[_0x4775('0x30')]=_['keys'](_0x1243cd[_0x4775('0x30')]);_0x371dad['filters']=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],_0x371dad['query']);_0x34faf7[_0x4775('0x34')]=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],qs['fields'](_0x1243cd[_0x4775('0x30')][_0x4775('0x44')]));_0x34faf7[_0x4775('0x34')]=_0x34faf7[_0x4775('0x34')]['length']?_0x34faf7[_0x4775('0x34')]:_0x371dad[_0x4775('0x2f')];_0x34faf7[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x1243cd['query'][_0x4775('0x39')]);_0x34faf7[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x1243cd['query'],_0x371dad['filters']));if(_0x1243cd['query'][_0x4775('0x3b')]){_0x34faf7[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x34faf7['where'],{'$or':_[_0x4775('0x2a')](_0x34faf7[_0x4775('0x34')],function(_0x4efe85){var _0x212344={};_0x212344[_0x4efe85]={'$like':'%'+_0x1243cd[_0x4775('0x30')]['filter']+'%'};return _0x212344;})});}_0x34faf7=_[_0x4775('0x3c')]({},_0x34faf7,_0x1243cd[_0x4775('0x3d')]);return _0x3b2327['getFields'](_0x34faf7);}})['then'](function(_0x929413){if(_0x929413){_0x6a4d19=_0x929413[_0x4775('0x35')];if(!_0x1243cd['query']['hasOwnProperty'](_0x4775('0x37'))){_0x34faf7[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x1243cd['query'][_0x4775('0x1a')]);_0x34faf7[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x1243cd['query'][_0x4775('0x1d')]);}return _0x3b2327[_0x4775('0x4b')](_0x34faf7);}})[_0x4775('0x23')](function(_0x2446ba){if(_0x2446ba){return _0x2446ba?{'count':_0x6a4d19,'rows':_0x2446ba}:null;}})[_0x4775('0x23')](respondWithResult(_0x3ed3b5,null))[_0x4775('0x47')](handleError(_0x3ed3b5,null));};exports[_0x4775('0x4c')]=function(_0x438dbf,_0x45cdfe,_0x441df9){var _0x8e3312={};var _0x36fb9b={};var _0x8928ed;var _0x3f2edd;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x438dbf[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x45cdfe,null))[_0x4775('0x23')](function(_0x29a6b4){if(_0x29a6b4){_0x8928ed=_0x29a6b4;_0x36fb9b[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x36fb9b[_0x4775('0x30')]=_['keys'](_0x438dbf[_0x4775('0x30')]);_0x36fb9b[_0x4775('0x32')]=_['intersection'](_0x36fb9b[_0x4775('0x2f')],_0x36fb9b[_0x4775('0x30')]);_0x8e3312[_0x4775('0x34')]=_[_0x4775('0x33')](_0x36fb9b[_0x4775('0x2f')],qs['fields'](_0x438dbf[_0x4775('0x30')][_0x4775('0x44')]));_0x8e3312['attributes']=_0x8e3312['attributes'][_0x4775('0x35')]?_0x8e3312['attributes']:_0x36fb9b[_0x4775('0x2f')];_0x8e3312[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x438dbf[_0x4775('0x30')]['sort']);_0x8e3312['where']=qs['filters'](_['pick'](_0x438dbf[_0x4775('0x30')],_0x36fb9b[_0x4775('0x32')]));if(_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]){_0x8e3312[_0x4775('0x3a')]=_['merge'](_0x8e3312[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0x8e3312[_0x4775('0x34')],function(_0x836aa7){var _0x1eea7a={};_0x1eea7a[_0x836aa7]={'$like':'%'+_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]+'%'};return _0x1eea7a;})});}_0x8e3312=_[_0x4775('0x3c')]({},_0x8e3312,_0x438dbf[_0x4775('0x3d')]);return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x3bd1f3){if(_0x3bd1f3){_0x3f2edd=_0x3bd1f3['length'];if(!_0x438dbf['query'][_0x4775('0x36')](_0x4775('0x37'))){_0x8e3312[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1a')]);_0x8e3312[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1d')]);}return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x1e0978){if(_0x1e0978){return _0x1e0978?{'count':_0x3f2edd,'rows':_0x1e0978}:null;}})[_0x4775('0x23')](respondWithResult(_0x45cdfe,null))[_0x4775('0x47')](handleError(_0x45cdfe,null));};exports[_0x4775('0x4e')]=function(_0x163b10,_0x51adcb,_0x3a2a54){var _0x327834={};var _0x451d6e={};var _0x2f13a2;var _0x25c89d;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x163b10[_0x4775('0x43')]['id']}})['then'](handleEntityNotFound(_0x51adcb,null))[_0x4775('0x23')](function(_0x3d25d8){if(_0x3d25d8){_0x2f13a2=_0x3d25d8;_0x451d6e[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x451d6e[_0x4775('0x30')]=_[_0x4775('0x31')](_0x163b10[_0x4775('0x30')]);_0x451d6e[_0x4775('0x32')]=_[_0x4775('0x33')](_0x451d6e[_0x4775('0x2f')],_0x451d6e[_0x4775('0x30')]);_0x327834[_0x4775('0x34')]=_['intersection'](_0x451d6e[_0x4775('0x2f')],qs[_0x4775('0x44')](_0x163b10['query']['fields']));_0x327834[_0x4775('0x34')]=_0x327834[_0x4775('0x34')][_0x4775('0x35')]?_0x327834[_0x4775('0x34')]:_0x451d6e[_0x4775('0x2f')];_0x327834['order']=qs[_0x4775('0x39')](_0x163b10[_0x4775('0x30')][_0x4775('0x39')]);_0x327834[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x163b10[_0x4775('0x30')],_0x451d6e[_0x4775('0x32')]));if(_0x163b10[_0x4775('0x30')]['filter']){_0x327834['where']=_[_0x4775('0x3c')](_0x327834[_0x4775('0x3a')],{'$or':_['map'](_0x327834[_0x4775('0x34')],function(_0x2a4278){var _0x1ff832={};_0x1ff832[_0x2a4278]={'$like':'%'+_0x163b10['query'][_0x4775('0x3b')]+'%'};return _0x1ff832;})});}_0x327834=_[_0x4775('0x3c')]({},_0x327834,_0x163b10[_0x4775('0x3d')]);return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x208c1a){if(_0x208c1a){_0x25c89d=_0x208c1a[_0x4775('0x35')];if(!_0x163b10[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x327834['limit']=qs[_0x4775('0x1a')](_0x163b10[_0x4775('0x30')]['limit']);_0x327834[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x163b10['query'][_0x4775('0x1d')]);}return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x229575){if(_0x229575){return _0x229575?{'count':_0x25c89d,'rows':_0x229575}:null;}})[_0x4775('0x23')](respondWithResult(_0x51adcb,null))[_0x4775('0x47')](handleError(_0x51adcb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6fefaf5..15b8b9c 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 _0x85c2=['request-promise','path','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x85c2,0x1f4));var _0x285c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x85c2[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x285c('0x0'));var util=require(_0x285c('0x1'));var logger=require(_0x285c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x285c('0x3'));var rp=require(_0x285c('0x4'));var fs=require('fs');var path=require(_0x285c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x413d19,_0x4e937f){return _0x413d19[_0x285c('0x6')](_0x285c('0x7'),attributes,{'tableName':_0x285c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5166=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','../../config/logger','api','moment'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x5166,0x98));var _0x6516=function(_0x4216ce,_0x2d705d){_0x4216ce=_0x4216ce-0x0;var _0xad1e4f=_0x5166[_0x4216ce];return _0xad1e4f;};'use strict';var _=require(_0x6516('0x0'));var util=require('util');var logger=require(_0x6516('0x1'))(_0x6516('0x2'));var moment=require(_0x6516('0x3'));var BPromise=require('bluebird');var rp=require(_0x6516('0x4'));var fs=require('fs');var path=require(_0x6516('0x5'));var rimraf=require(_0x6516('0x6'));var config=require(_0x6516('0x7'));var attributes=require(_0x6516('0x8'));module[_0x6516('0x9')]=function(_0x44171e,_0x1f21b5){return _0x44171e[_0x6516('0xa')](_0x6516('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 33dda00..a496c20 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 _0xea86=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x102bdd,_0x3b05ba){var _0x1fc2d0=function(_0x5651b6){while(--_0x5651b6){_0x102bdd['push'](_0x102bdd['shift']());}};_0x1fc2d0(++_0x3b05ba);}(_0xea86,0x110));var _0x6ea8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea86[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6ea8('0x0'));var util=require('util');var moment=require(_0x6ea8('0x1'));var BPromise=require(_0x6ea8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ea8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ea8('0x4'))(_0x6ea8('0x5'));var config=require(_0x6ea8('0x6'));var jayson=require(_0x6ea8('0x7'));var client=jayson[_0x6ea8('0x8')][_0x6ea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x195458,_0x36af26,_0x46e31d){return new BPromise(function(_0x3b5316,_0x2cb03d){return client[_0x6ea8('0xa')](_0x195458,_0x46e31d)['then'](function(_0x360ead){logger[_0x6ea8('0xb')](_0x6ea8('0xc'),_0x36af26,_0x6ea8('0xd'));logger[_0x6ea8('0xe')](_0x6ea8('0xf'),_0x36af26,_0x6ea8('0xd'),JSON[_0x6ea8('0x10')](_0x360ead));if(_0x360ead[_0x6ea8('0x11')]){if(_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x12')]===0x1f4){logger[_0x6ea8('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x36af26,_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x13')]);return _0x2cb03d(_0x360ead[_0x6ea8('0x11')]['message']);}logger[_0x6ea8('0x11')](_0x6ea8('0xc'),_0x36af26,_0x360ead[_0x6ea8('0x11')][_0x6ea8('0x13')]);return _0x3b5316(_0x360ead['error'][_0x6ea8('0x13')]);}else{logger[_0x6ea8('0xb')](_0x6ea8('0xc'),_0x36af26,'request\x20sent');_0x3b5316(_0x360ead[_0x6ea8('0x14')][_0x6ea8('0x13')]);}})[_0x6ea8('0x15')](function(_0x15ece9){logger['error'](_0x6ea8('0xc'),_0x36af26,_0x15ece9);_0x2cb03d(_0x15ece9);});});} \ No newline at end of file +var _0x9990=['stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','rpc','../../config/environment','http','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x101038,_0x353c1a){var _0x1d2641=function(_0x422137){while(--_0x422137){_0x101038['push'](_0x101038['shift']());}};_0x1d2641(++_0x353c1a);}(_0x9990,0xa7));var _0x0999=function(_0x3f0553,_0x1ee7d8){_0x3f0553=_0x3f0553-0x0;var _0x185007=_0x9990[_0x3f0553];return _0x185007;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0999('0x0'));var rs=require(_0x0999('0x1'));var fs=require('fs');var Redis=require(_0x0999('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0999('0x3'));var config=require(_0x0999('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0999('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x443d3f,_0x18c558,_0x16f1ca){return new BPromise(function(_0x41160c,_0x1b9fdb){return client['request'](_0x443d3f,_0x16f1ca)['then'](function(_0x12c95b){logger['info'](_0x0999('0x6'),_0x18c558,_0x0999('0x7'));logger['debug'](_0x0999('0x8'),_0x18c558,'request\x20sent',JSON[_0x0999('0x9')](_0x12c95b));if(_0x12c95b[_0x0999('0xa')]){if(_0x12c95b[_0x0999('0xa')][_0x0999('0xb')]===0x1f4){logger[_0x0999('0xa')](_0x0999('0x6'),_0x18c558,_0x12c95b[_0x0999('0xa')]['message']);return _0x1b9fdb(_0x12c95b[_0x0999('0xa')]['message']);}logger['error'](_0x0999('0x6'),_0x18c558,_0x12c95b['error'][_0x0999('0xc')]);return _0x41160c(_0x12c95b[_0x0999('0xa')][_0x0999('0xc')]);}else{logger[_0x0999('0xd')](_0x0999('0x6'),_0x18c558,_0x0999('0x7'));_0x41160c(_0x12c95b[_0x0999('0xe')][_0x0999('0xc')]);}})[_0x0999('0xf')](function(_0x1d6c91){logger[_0x0999('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x18c558,_0x1d6c91);_0x1b9fdb(_0x1d6c91);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d78cd79..dec3878 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 _0xf0a4=['show','post','create','put','/:id','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x38facd,_0x5ad181){var _0x192066=function(_0x5469e1){while(--_0x5469e1){_0x38facd['push'](_0x38facd['shift']());}};_0x192066(++_0x5ad181);}(_0xf0a4,0x178));var _0x4f0a=function(_0x20bf79,_0x53b0d2){_0x20bf79=_0x20bf79-0x0;var _0x2a791f=_0xf0a4[_0x20bf79];return _0x2a791f;};'use strict';var multer=require(_0x4f0a('0x0'));var util=require('util');var path=require(_0x4f0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f0a('0x2'));var router=express[_0x4f0a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0a('0x4'));var interaction=require(_0x4f0a('0x5'));var config=require(_0x4f0a('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x4f0a('0x7')](),controller['index']);router['get']('/:id',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0x8')]);router[_0x4f0a('0x9')]('/',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xa')]);router[_0x4f0a('0xb')](_0x4f0a('0xc'),auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xd')]);router['delete']('/:id',auth[_0x4f0a('0x7')](),controller[_0x4f0a('0xe')]);module[_0x4f0a('0xf')]=router; \ No newline at end of file +var _0xd88e=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0xd88e,0xa7));var _0xed88=function(_0x1dca9d,_0x4d51b2){_0x1dca9d=_0x1dca9d-0x0;var _0x426b0c=_0xd88e[_0x1dca9d];return _0x426b0c;};'use strict';var multer=require(_0xed88('0x0'));var util=require(_0xed88('0x1'));var path=require(_0xed88('0x2'));var timeout=require(_0xed88('0x3'));var express=require(_0xed88('0x4'));var router=express['Router']();var fs_extra=require(_0xed88('0x5'));var auth=require(_0xed88('0x6'));var interaction=require(_0xed88('0x7'));var config=require(_0xed88('0x8'));var controller=require(_0xed88('0x9'));router['get']('/',auth[_0xed88('0xa')](),controller['index']);router[_0xed88('0xb')](_0xed88('0xc'),auth['isAuthenticated'](),controller[_0xed88('0xd')]);router[_0xed88('0xe')]('/',auth[_0xed88('0xa')](),controller[_0xed88('0xf')]);router[_0xed88('0x10')](_0xed88('0xc'),auth[_0xed88('0xa')](),controller['update']);router[_0xed88('0x11')](_0xed88('0xc'),auth[_0xed88('0xa')](),controller[_0xed88('0x12')]);module[_0xed88('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8a7750d..59e99cf 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 _0x3098=['exports','string','STRING','ENUM','customVariable','sequelize'];(function(_0x1b9e66,_0x7ba3ac){var _0x1efadc=function(_0x111634){while(--_0x111634){_0x1b9e66['push'](_0x1b9e66['shift']());}};_0x1efadc(++_0x7ba3ac);}(_0x3098,0x113));var _0x8309=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x3098[_0x1d7037];return _0x4d6568;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8309('0x2'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x8309('0x2')},'content':{'type':Sequelize[_0x8309('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8309('0x4')](_0x8309('0x2'),'variable',_0x8309('0x5'))},'keyContent':{'type':Sequelize[_0x8309('0x3')]},'idField':{'type':Sequelize[_0x8309('0x3')]},'nameField':{'type':Sequelize[_0x8309('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7824=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x601cf5,_0x252962){var _0x166130=function(_0x53a5cc){while(--_0x53a5cc){_0x601cf5['push'](_0x601cf5['shift']());}};_0x166130(++_0x252962);}(_0x7824,0x18d));var _0x4782=function(_0x379943,_0x2ac537){_0x379943=_0x379943-0x0;var _0x404069=_0x7824[_0x379943];return _0x404069;};'use strict';var Sequelize=require(_0x4782('0x0'));module[_0x4782('0x1')]={'type':{'type':Sequelize[_0x4782('0x2')](_0x4782('0x3'),_0x4782('0x4'),_0x4782('0x5'),_0x4782('0x6'),'picklist'),'defaultValue':_0x4782('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4782('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4782('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4782('0x7')]},'customField':{'type':Sequelize[_0x4782('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4782('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0570a52..58ad051 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 _0xc5f6=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x557ffa,_0x453787){var _0x2a23af=function(_0x2b1ae4){while(--_0x2b1ae4){_0x557ffa['push'](_0x557ffa['shift']());}};_0x2a23af(++_0x453787);}(_0xc5f6,0x9d));var _0x6c5f=function(_0x457496,_0x4ce59e){_0x457496=_0x457496-0x0;var _0x4db06b=_0xc5f6[_0x457496];return _0x4db06b;};'use strict';var emlformat=require(_0x6c5f('0x0'));var rimraf=require(_0x6c5f('0x1'));var zipdir=require(_0x6c5f('0x2'));var jsonpatch=require(_0x6c5f('0x3'));var rp=require(_0x6c5f('0x4'));var moment=require(_0x6c5f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c5f('0x6'));var util=require(_0x6c5f('0x7'));var path=require('path');var sox=require(_0x6c5f('0x8'));var csv=require(_0x6c5f('0x9'));var ejs=require(_0x6c5f('0xa'));var fs=require('fs');var fs_extra=require(_0x6c5f('0xb'));var _=require(_0x6c5f('0xc'));var squel=require(_0x6c5f('0xd'));var crypto=require('crypto');var jsforce=require(_0x6c5f('0xe'));var deskjs=require(_0x6c5f('0xf'));var toCsv=require(_0x6c5f('0x9'));var querystring=require(_0x6c5f('0x10'));var Papa=require(_0x6c5f('0x11'));var Redis=require(_0x6c5f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6c5f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c5f('0x14'));var logger=require(_0x6c5f('0x15'))(_0x6c5f('0x16'));var utils=require(_0x6c5f('0x17'));var config=require(_0x6c5f('0x18'));var licenseUtil=require(_0x6c5f('0x19'));var db=require(_0x6c5f('0x1a'))['db'];function respondWithStatusCode(_0x37f630,_0x117838){_0x117838=_0x117838||0xcc;return function(_0x4f75a4){if(_0x4f75a4){return _0x37f630[_0x6c5f('0x1b')](_0x117838);}return _0x37f630[_0x6c5f('0x1c')](_0x117838)['end']();};}function respondWithResult(_0x1ba28c,_0x40df61){_0x40df61=_0x40df61||0xc8;return function(_0x28ddb9){if(_0x28ddb9){return _0x1ba28c[_0x6c5f('0x1c')](_0x40df61)['json'](_0x28ddb9);}};}function respondWithFilteredResult(_0x430aae,_0x31c28a){return function(_0x293e41){if(_0x293e41){var _0x380c00=typeof _0x31c28a[_0x6c5f('0x1d')]===_0x6c5f('0x1e')&&typeof _0x31c28a[_0x6c5f('0x1f')]===_0x6c5f('0x1e');var _0x1db043=_0x293e41['count'];var _0x3f84c2=_0x380c00?0x0:_0x31c28a[_0x6c5f('0x1d')];var _0x363f8b=_0x380c00?_0x293e41[_0x6c5f('0x20')]:_0x31c28a[_0x6c5f('0x1d')]+_0x31c28a[_0x6c5f('0x1f')];var _0x361220;if(_0x363f8b>=_0x1db043){_0x363f8b=_0x1db043;_0x361220=0xc8;}else{_0x361220=0xce;}_0x430aae[_0x6c5f('0x1c')](_0x361220);return _0x430aae[_0x6c5f('0x21')](_0x6c5f('0x22'),_0x3f84c2+'-'+_0x363f8b+'/'+_0x1db043)[_0x6c5f('0x23')](_0x293e41);}return null;};}function patchUpdates(_0x12c500){return function(_0x4c728b){try{jsonpatch[_0x6c5f('0x24')](_0x4c728b,_0x12c500,!![]);}catch(_0x4058fa){return BPromise[_0x6c5f('0x25')](_0x4058fa);}return _0x4c728b[_0x6c5f('0x26')]();};}function saveUpdates(_0xcaaafd,_0x1b6600){return function(_0x1bc82f){if(_0x1bc82f){return _0x1bc82f['update'](_0xcaaafd)[_0x6c5f('0x27')](function(_0xd7cf3b){return _0xd7cf3b;});}return null;};}function removeEntity(_0x492bd3,_0x11360f){return function(_0x4b61b8){if(_0x4b61b8){return _0x4b61b8[_0x6c5f('0x28')]()[_0x6c5f('0x27')](function(){_0x492bd3['status'](0xcc)[_0x6c5f('0x29')]();});}};}function handleEntityNotFound(_0x187240,_0x4d9c75){return function(_0xa87698){if(!_0xa87698){_0x187240['sendStatus'](0x194);}return _0xa87698;};}function handleError(_0x11c359,_0x52756f){_0x52756f=_0x52756f||0x1f4;return function(_0x338723){logger[_0x6c5f('0x2a')](_0x338723[_0x6c5f('0x2b')]);if(_0x338723[_0x6c5f('0x2c')]){delete _0x338723['name'];}_0x11c359[_0x6c5f('0x1c')](_0x52756f)[_0x6c5f('0x2d')](_0x338723);};}exports[_0x6c5f('0x2e')]=function(_0x56675f,_0x1832c0){var _0x307fc6={},_0x872fdc={},_0x4fec1f={'count':0x0,'rows':[]};var _0x15cee=_[_0x6c5f('0x2f')](db[_0x6c5f('0x30')][_0x6c5f('0x31')],function(_0x26b5fe){return{'name':_0x26b5fe[_0x6c5f('0x32')],'type':_0x26b5fe[_0x6c5f('0x33')][_0x6c5f('0x34')]};});_0x872fdc[_0x6c5f('0x35')]=_['map'](_0x15cee,_0x6c5f('0x2c'));_0x872fdc[_0x6c5f('0x36')]=_[_0x6c5f('0x37')](_0x56675f[_0x6c5f('0x36')]);_0x872fdc[_0x6c5f('0x38')]=_['intersection'](_0x872fdc[_0x6c5f('0x35')],_0x872fdc['query']);_0x307fc6[_0x6c5f('0x39')]=_[_0x6c5f('0x3a')](_0x872fdc[_0x6c5f('0x35')],qs[_0x6c5f('0x3b')](_0x56675f[_0x6c5f('0x36')]['fields']));_0x307fc6[_0x6c5f('0x39')]=_0x307fc6[_0x6c5f('0x39')]['length']?_0x307fc6['attributes']:_0x872fdc['model'];if(!_0x56675f['query']['hasOwnProperty'](_0x6c5f('0x3c'))){_0x307fc6['limit']=qs[_0x6c5f('0x1f')](_0x56675f[_0x6c5f('0x36')]['limit']);_0x307fc6[_0x6c5f('0x1d')]=qs[_0x6c5f('0x1d')](_0x56675f['query'][_0x6c5f('0x1d')]);}_0x307fc6[_0x6c5f('0x3d')]=qs['sort'](_0x56675f['query'][_0x6c5f('0x3e')]);_0x307fc6[_0x6c5f('0x3f')]=qs[_0x6c5f('0x38')](_[_0x6c5f('0x40')](_0x56675f[_0x6c5f('0x36')],_0x872fdc[_0x6c5f('0x38')]),_0x15cee);if(_0x56675f[_0x6c5f('0x36')][_0x6c5f('0x41')]){_0x307fc6[_0x6c5f('0x3f')]=_[_0x6c5f('0x42')](_0x307fc6[_0x6c5f('0x3f')],{'$or':_[_0x6c5f('0x2f')](_0x15cee,function(_0x20a2e7){if(_0x20a2e7[_0x6c5f('0x33')]!==_0x6c5f('0x43')){var _0x3abb51={};_0x3abb51[_0x20a2e7[_0x6c5f('0x2c')]]={'$like':'%'+_0x56675f[_0x6c5f('0x36')]['filter']+'%'};return _0x3abb51;}})});}_0x307fc6=_[_0x6c5f('0x42')]({},_0x307fc6,_0x56675f[_0x6c5f('0x44')]);var _0x48c67f={'where':_0x307fc6[_0x6c5f('0x3f')]};return db[_0x6c5f('0x30')]['count'](_0x48c67f)[_0x6c5f('0x27')](function(_0x300022){_0x4fec1f[_0x6c5f('0x20')]=_0x300022;if(_0x56675f[_0x6c5f('0x36')][_0x6c5f('0x45')]){_0x307fc6[_0x6c5f('0x46')]=[{'all':!![]}];}return db[_0x6c5f('0x30')][_0x6c5f('0x47')](_0x307fc6);})[_0x6c5f('0x27')](function(_0x5288b1){_0x4fec1f[_0x6c5f('0x48')]=_0x5288b1;return _0x4fec1f;})[_0x6c5f('0x27')](respondWithFilteredResult(_0x1832c0,_0x307fc6))[_0x6c5f('0x49')](handleError(_0x1832c0,null));};exports['show']=function(_0x20ca50,_0x1b380d){var _0x455cc2={'raw':!![],'where':{'id':_0x20ca50[_0x6c5f('0x4a')]['id']}},_0x462854={};_0x462854[_0x6c5f('0x35')]=_[_0x6c5f('0x37')](db[_0x6c5f('0x30')][_0x6c5f('0x31')]);_0x462854[_0x6c5f('0x36')]=_['keys'](_0x20ca50[_0x6c5f('0x36')]);_0x462854[_0x6c5f('0x38')]=_[_0x6c5f('0x3a')](_0x462854[_0x6c5f('0x35')],_0x462854[_0x6c5f('0x36')]);_0x455cc2['attributes']=_[_0x6c5f('0x3a')](_0x462854['model'],qs[_0x6c5f('0x3b')](_0x20ca50[_0x6c5f('0x36')][_0x6c5f('0x3b')]));_0x455cc2[_0x6c5f('0x39')]=_0x455cc2['attributes'][_0x6c5f('0x4b')]?_0x455cc2[_0x6c5f('0x39')]:_0x462854['model'];if(_0x20ca50['query']['includeAll']){_0x455cc2[_0x6c5f('0x46')]=[{'all':!![]}];}_0x455cc2=_[_0x6c5f('0x42')]({},_0x455cc2,_0x20ca50[_0x6c5f('0x44')]);return db[_0x6c5f('0x30')][_0x6c5f('0x4c')](_0x455cc2)['then'](handleEntityNotFound(_0x1b380d,null))[_0x6c5f('0x27')](respondWithResult(_0x1b380d,null))['catch'](handleError(_0x1b380d,null));};exports['create']=function(_0x49de7f,_0x33e36c){return db[_0x6c5f('0x30')][_0x6c5f('0x4d')](_0x49de7f[_0x6c5f('0x4e')],{})[_0x6c5f('0x27')](respondWithResult(_0x33e36c,0xc9))[_0x6c5f('0x49')](handleError(_0x33e36c,null));};exports[_0x6c5f('0x4f')]=function(_0xadd77c,_0x4f9cdc){if(_0xadd77c[_0x6c5f('0x4e')]['id']){delete _0xadd77c[_0x6c5f('0x4e')]['id'];}return db['VtigerField'][_0x6c5f('0x4c')]({'where':{'id':_0xadd77c[_0x6c5f('0x4a')]['id']}})[_0x6c5f('0x27')](handleEntityNotFound(_0x4f9cdc,null))['then'](saveUpdates(_0xadd77c[_0x6c5f('0x4e')],null))['then'](respondWithResult(_0x4f9cdc,null))[_0x6c5f('0x49')](handleError(_0x4f9cdc,null));};exports[_0x6c5f('0x28')]=function(_0x1182a5,_0xf37568){return db[_0x6c5f('0x30')][_0x6c5f('0x4c')]({'where':{'id':_0x1182a5[_0x6c5f('0x4a')]['id']}})[_0x6c5f('0x27')](handleEntityNotFound(_0xf37568,null))[_0x6c5f('0x27')](removeEntity(_0xf37568,null))[_0x6c5f('0x49')](handleError(_0xf37568,null));}; \ No newline at end of file +var _0x6a3a=['then','end','error','stack','name','send','map','VtigerField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','update','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','destroy'];(function(_0x32f0b2,_0x1c9a23){var _0x554592=function(_0x33e033){while(--_0x33e033){_0x32f0b2['push'](_0x32f0b2['shift']());}};_0x554592(++_0x1c9a23);}(_0x6a3a,0x1d7));var _0xa6a3=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x6a3a[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6a3('0x0'));var zipdir=require(_0xa6a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6a3('0x2'));var moment=require(_0xa6a3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa6a3('0x4'));var util=require(_0xa6a3('0x5'));var path=require(_0xa6a3('0x6'));var sox=require(_0xa6a3('0x7'));var csv=require(_0xa6a3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6a3('0x9'));var _=require(_0xa6a3('0xa'));var squel=require(_0xa6a3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6a3('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa6a3('0xd'));var Papa=require(_0xa6a3('0xe'));var Redis=require(_0xa6a3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa6a3('0x10'));var as=require(_0xa6a3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa6a3('0x12'));var utils=require(_0xa6a3('0x13'));var config=require(_0xa6a3('0x14'));var licenseUtil=require(_0xa6a3('0x15'));var db=require(_0xa6a3('0x16'))['db'];function respondWithStatusCode(_0x2677f2,_0x3aa9ee){_0x3aa9ee=_0x3aa9ee||0xcc;return function(_0x2e7843){if(_0x2e7843){return _0x2677f2[_0xa6a3('0x17')](_0x3aa9ee);}return _0x2677f2[_0xa6a3('0x18')](_0x3aa9ee)['end']();};}function respondWithResult(_0x2141e6,_0x5f3b2a){_0x5f3b2a=_0x5f3b2a||0xc8;return function(_0x16765e){if(_0x16765e){return _0x2141e6[_0xa6a3('0x18')](_0x5f3b2a)[_0xa6a3('0x19')](_0x16765e);}};}function respondWithFilteredResult(_0x595a29,_0x5a1be0){return function(_0x1c906f){if(_0x1c906f){var _0x20fa8d=typeof _0x5a1be0['offset']==='undefined'&&typeof _0x5a1be0['limit']==='undefined';var _0x513265=_0x1c906f[_0xa6a3('0x1a')];var _0x2cda71=_0x20fa8d?0x0:_0x5a1be0[_0xa6a3('0x1b')];var _0x27783e=_0x20fa8d?_0x1c906f['count']:_0x5a1be0['offset']+_0x5a1be0[_0xa6a3('0x1c')];var _0xe2fa2a;if(_0x27783e>=_0x513265){_0x27783e=_0x513265;_0xe2fa2a=0xc8;}else{_0xe2fa2a=0xce;}_0x595a29[_0xa6a3('0x18')](_0xe2fa2a);return _0x595a29['set']('Content-Range',_0x2cda71+'-'+_0x27783e+'/'+_0x513265)[_0xa6a3('0x19')](_0x1c906f);}return null;};}function patchUpdates(_0x5ecfe3){return function(_0xc44ccf){try{jsonpatch[_0xa6a3('0x1d')](_0xc44ccf,_0x5ecfe3,!![]);}catch(_0x2a9ecc){return BPromise[_0xa6a3('0x1e')](_0x2a9ecc);}return _0xc44ccf[_0xa6a3('0x1f')]();};}function saveUpdates(_0x40b9a7,_0x12ffa3){return function(_0x5396cf){if(_0x5396cf){return _0x5396cf['update'](_0x40b9a7)['then'](function(_0x1ae644){return _0x1ae644;});}return null;};}function removeEntity(_0x6844bd,_0x3d8dfc){return function(_0x1c94f4){if(_0x1c94f4){return _0x1c94f4[_0xa6a3('0x20')]()[_0xa6a3('0x21')](function(){_0x6844bd['status'](0xcc)[_0xa6a3('0x22')]();});}};}function handleEntityNotFound(_0x44c573,_0x33011b){return function(_0x15b3b8){if(!_0x15b3b8){_0x44c573[_0xa6a3('0x17')](0x194);}return _0x15b3b8;};}function handleError(_0x580fa7,_0xc38915){_0xc38915=_0xc38915||0x1f4;return function(_0x435045){logger[_0xa6a3('0x23')](_0x435045[_0xa6a3('0x24')]);if(_0x435045[_0xa6a3('0x25')]){delete _0x435045[_0xa6a3('0x25')];}_0x580fa7[_0xa6a3('0x18')](_0xc38915)[_0xa6a3('0x26')](_0x435045);};}exports['index']=function(_0x20cf33,_0x44a0b9){var _0x34cf3c={},_0x130d4b={},_0x11560a={'count':0x0,'rows':[]};var _0x635686=_[_0xa6a3('0x27')](db[_0xa6a3('0x28')][_0xa6a3('0x29')],function(_0x113efa){return{'name':_0x113efa['fieldName'],'type':_0x113efa[_0xa6a3('0x2a')]['key']};});_0x130d4b[_0xa6a3('0x2b')]=_['map'](_0x635686,_0xa6a3('0x25'));_0x130d4b[_0xa6a3('0x2c')]=_[_0xa6a3('0x2d')](_0x20cf33[_0xa6a3('0x2c')]);_0x130d4b[_0xa6a3('0x2e')]=_[_0xa6a3('0x2f')](_0x130d4b[_0xa6a3('0x2b')],_0x130d4b[_0xa6a3('0x2c')]);_0x34cf3c['attributes']=_['intersection'](_0x130d4b[_0xa6a3('0x2b')],qs['fields'](_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x30')]));_0x34cf3c['attributes']=_0x34cf3c[_0xa6a3('0x31')][_0xa6a3('0x32')]?_0x34cf3c[_0xa6a3('0x31')]:_0x130d4b['model'];if(!_0x20cf33['query'][_0xa6a3('0x33')](_0xa6a3('0x34'))){_0x34cf3c[_0xa6a3('0x1c')]=qs[_0xa6a3('0x1c')](_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x1c')]);_0x34cf3c[_0xa6a3('0x1b')]=qs['offset'](_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x1b')]);}_0x34cf3c[_0xa6a3('0x35')]=qs['sort'](_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x36')]);_0x34cf3c['where']=qs[_0xa6a3('0x2e')](_[_0xa6a3('0x37')](_0x20cf33[_0xa6a3('0x2c')],_0x130d4b[_0xa6a3('0x2e')]),_0x635686);if(_0x20cf33['query']['filter']){_0x34cf3c[_0xa6a3('0x38')]=_[_0xa6a3('0x39')](_0x34cf3c[_0xa6a3('0x38')],{'$or':_[_0xa6a3('0x27')](_0x635686,function(_0x2e52de){if(_0x2e52de[_0xa6a3('0x2a')]!==_0xa6a3('0x3a')){var _0x15e218={};_0x15e218[_0x2e52de['name']]={'$like':'%'+_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x3b')]+'%'};return _0x15e218;}})});}_0x34cf3c=_['merge']({},_0x34cf3c,_0x20cf33['options']);var _0x2e73e4={'where':_0x34cf3c[_0xa6a3('0x38')]};return db[_0xa6a3('0x28')][_0xa6a3('0x1a')](_0x2e73e4)['then'](function(_0x10b70a){_0x11560a['count']=_0x10b70a;if(_0x20cf33[_0xa6a3('0x2c')][_0xa6a3('0x3c')]){_0x34cf3c['include']=[{'all':!![]}];}return db[_0xa6a3('0x28')][_0xa6a3('0x3d')](_0x34cf3c);})[_0xa6a3('0x21')](function(_0x59944b){_0x11560a[_0xa6a3('0x3e')]=_0x59944b;return _0x11560a;})[_0xa6a3('0x21')](respondWithFilteredResult(_0x44a0b9,_0x34cf3c))['catch'](handleError(_0x44a0b9,null));};exports[_0xa6a3('0x3f')]=function(_0x46fe92,_0x54a4c6){var _0x4d2b87={'raw':!![],'where':{'id':_0x46fe92[_0xa6a3('0x40')]['id']}},_0x4d473a={};_0x4d473a[_0xa6a3('0x2b')]=_[_0xa6a3('0x2d')](db[_0xa6a3('0x28')][_0xa6a3('0x29')]);_0x4d473a['query']=_[_0xa6a3('0x2d')](_0x46fe92['query']);_0x4d473a[_0xa6a3('0x2e')]=_[_0xa6a3('0x2f')](_0x4d473a[_0xa6a3('0x2b')],_0x4d473a[_0xa6a3('0x2c')]);_0x4d2b87[_0xa6a3('0x31')]=_[_0xa6a3('0x2f')](_0x4d473a[_0xa6a3('0x2b')],qs[_0xa6a3('0x30')](_0x46fe92[_0xa6a3('0x2c')][_0xa6a3('0x30')]));_0x4d2b87['attributes']=_0x4d2b87[_0xa6a3('0x31')][_0xa6a3('0x32')]?_0x4d2b87[_0xa6a3('0x31')]:_0x4d473a['model'];if(_0x46fe92[_0xa6a3('0x2c')]['includeAll']){_0x4d2b87[_0xa6a3('0x41')]=[{'all':!![]}];}_0x4d2b87=_[_0xa6a3('0x39')]({},_0x4d2b87,_0x46fe92[_0xa6a3('0x42')]);return db['VtigerField'][_0xa6a3('0x43')](_0x4d2b87)[_0xa6a3('0x21')](handleEntityNotFound(_0x54a4c6,null))[_0xa6a3('0x21')](respondWithResult(_0x54a4c6,null))[_0xa6a3('0x44')](handleError(_0x54a4c6,null));};exports['create']=function(_0x32eff3,_0x52ac5d){return db[_0xa6a3('0x28')][_0xa6a3('0x45')](_0x32eff3[_0xa6a3('0x46')],{})[_0xa6a3('0x21')](respondWithResult(_0x52ac5d,0xc9))['catch'](handleError(_0x52ac5d,null));};exports[_0xa6a3('0x47')]=function(_0x1b1d03,_0x5e6bc6){if(_0x1b1d03[_0xa6a3('0x46')]['id']){delete _0x1b1d03[_0xa6a3('0x46')]['id'];}return db[_0xa6a3('0x28')]['find']({'where':{'id':_0x1b1d03[_0xa6a3('0x40')]['id']}})[_0xa6a3('0x21')](handleEntityNotFound(_0x5e6bc6,null))[_0xa6a3('0x21')](saveUpdates(_0x1b1d03['body'],null))[_0xa6a3('0x21')](respondWithResult(_0x5e6bc6,null))['catch'](handleError(_0x5e6bc6,null));};exports[_0xa6a3('0x20')]=function(_0x10f855,_0x27bebc){return db[_0xa6a3('0x28')][_0xa6a3('0x43')]({'where':{'id':_0x10f855[_0xa6a3('0x40')]['id']}})[_0xa6a3('0x21')](handleEntityNotFound(_0x27bebc,null))[_0xa6a3('0x21')](removeEntity(_0x27bebc,null))[_0xa6a3('0x44')](handleError(_0x27bebc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 27849f6..5a97fad 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 _0xcdc7=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x15781b,_0x4db9bb){var _0x20f955=function(_0x636ad0){while(--_0x636ad0){_0x15781b['push'](_0x15781b['shift']());}};_0x20f955(++_0x4db9bb);}(_0xcdc7,0x77));var _0x7cdc=function(_0xd9c5f7,_0x1a7b27){_0xd9c5f7=_0xd9c5f7-0x0;var _0x264ece=_0xcdc7[_0xd9c5f7];return _0x264ece;};'use strict';var _=require(_0x7cdc('0x0'));var util=require('util');var logger=require(_0x7cdc('0x1'))(_0x7cdc('0x2'));var moment=require('moment');var BPromise=require(_0x7cdc('0x3'));var rp=require(_0x7cdc('0x4'));var fs=require('fs');var path=require(_0x7cdc('0x5'));var rimraf=require(_0x7cdc('0x6'));var config=require(_0x7cdc('0x7'));var attributes=require(_0x7cdc('0x8'));module[_0x7cdc('0x9')]=function(_0x417166,_0x5282f5){return _0x417166[_0x7cdc('0xa')]('VtigerField',attributes,{'tableName':_0x7cdc('0xb'),'paranoid':![],'indexes':[{'name':_0x7cdc('0xc'),'fields':[_0x7cdc('0xd'),_0x7cdc('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1085=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1085,0x8f));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5108('0x0'));var logger=require(_0x5108('0x1'))(_0x5108('0x2'));var moment=require(_0x5108('0x3'));var BPromise=require(_0x5108('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5108('0x5'));var rimraf=require('rimraf');var config=require(_0x5108('0x6'));var attributes=require(_0x5108('0x7'));module[_0x5108('0x8')]=function(_0x2b8004,_0x40ef9c){return _0x2b8004[_0x5108('0x9')](_0x5108('0xa'),attributes,{'tableName':_0x5108('0xb'),'paranoid':![],'indexes':[{'name':_0x5108('0xc'),'fields':[_0x5108('0xd'),_0x5108('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index afd43d1..c2cc89b 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 _0xa9ec=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','VtigerField,\x20%s,\x20%s','result'];(function(_0xe0b8f,_0x7a5369){var _0x2609a0=function(_0x29f1db){while(--_0x29f1db){_0xe0b8f['push'](_0xe0b8f['shift']());}};_0x2609a0(++_0x7a5369);}(_0xa9ec,0x13b));var _0xca9e=function(_0x4a002e,_0x14a5f6){_0x4a002e=_0x4a002e-0x0;var _0xb86ae3=_0xa9ec[_0x4a002e];return _0xb86ae3;};'use strict';var _=require(_0xca9e('0x0'));var util=require('util');var moment=require(_0xca9e('0x1'));var BPromise=require(_0xca9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9e('0x3'));var db=require(_0xca9e('0x4'))['db'];var utils=require(_0xca9e('0x5'));var logger=require(_0xca9e('0x6'))(_0xca9e('0x7'));var config=require(_0xca9e('0x8'));var jayson=require(_0xca9e('0x9'));var client=jayson[_0xca9e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c21f,_0xa74283,_0x1dd333){return new BPromise(function(_0x201fe3,_0x496af7){return client[_0xca9e('0xb')](_0x36c21f,_0x1dd333)['then'](function(_0x899200){logger[_0xca9e('0xc')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0xca9e('0xd'));logger[_0xca9e('0xe')](_0xca9e('0xf'),_0xa74283,'request\x20sent',JSON['stringify'](_0x899200));if(_0x899200[_0xca9e('0x10')]){if(_0x899200[_0xca9e('0x10')][_0xca9e('0x11')]===0x1f4){logger[_0xca9e('0x10')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0x899200[_0xca9e('0x10')]['message']);return _0x496af7(_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);}logger[_0xca9e('0x10')](_0xca9e('0x13'),_0xa74283,_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);return _0x201fe3(_0x899200[_0xca9e('0x10')][_0xca9e('0x12')]);}else{logger['info'](_0xca9e('0x13'),_0xa74283,_0xca9e('0xd'));_0x201fe3(_0x899200[_0xca9e('0x14')][_0xca9e('0x12')]);}})['catch'](function(_0x5c919b){logger[_0xca9e('0x10')]('VtigerField,\x20%s,\x20%s',_0xa74283,_0x5c919b);_0x496af7(_0x5c919b);});});} \ No newline at end of file +var _0x6d26=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x2a4e26,_0x1af6fb){var _0x21115f=function(_0x55ea1c){while(--_0x55ea1c){_0x2a4e26['push'](_0x2a4e26['shift']());}};_0x21115f(++_0x1af6fb);}(_0x6d26,0x1e1));var _0x66d2=function(_0x4e2399,_0x3c22d4){_0x4e2399=_0x4e2399-0x0;var _0xf369c5=_0x6d26[_0x4e2399];return _0xf369c5;};'use strict';var _=require(_0x66d2('0x0'));var util=require(_0x66d2('0x1'));var moment=require(_0x66d2('0x2'));var BPromise=require('bluebird');var rs=require(_0x66d2('0x3'));var fs=require('fs');var Redis=require(_0x66d2('0x4'));var db=require(_0x66d2('0x5'))['db'];var utils=require(_0x66d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x66d2('0x7'));var jayson=require(_0x66d2('0x8'));var client=jayson['client'][_0x66d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33c705,_0x44acc2,_0x49e688){return new BPromise(function(_0x5f3cea,_0x212512){return client['request'](_0x33c705,_0x49e688)[_0x66d2('0xa')](function(_0x3593a6){logger[_0x66d2('0xb')]('VtigerField,\x20%s,\x20%s',_0x44acc2,_0x66d2('0xc'));logger['debug'](_0x66d2('0xd'),_0x44acc2,_0x66d2('0xc'),JSON[_0x66d2('0xe')](_0x3593a6));if(_0x3593a6[_0x66d2('0xf')]){if(_0x3593a6['error'][_0x66d2('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x44acc2,_0x3593a6['error']['message']);return _0x212512(_0x3593a6[_0x66d2('0xf')][_0x66d2('0x11')]);}logger[_0x66d2('0xf')]('VtigerField,\x20%s,\x20%s',_0x44acc2,_0x3593a6[_0x66d2('0xf')][_0x66d2('0x11')]);return _0x5f3cea(_0x3593a6[_0x66d2('0xf')][_0x66d2('0x11')]);}else{logger[_0x66d2('0xb')](_0x66d2('0x12'),_0x44acc2,'request\x20sent');_0x5f3cea(_0x3593a6[_0x66d2('0x13')][_0x66d2('0x11')]);}})[_0x66d2('0x14')](function(_0x120be0){logger['error'](_0x66d2('0x12'),_0x44acc2,_0x120be0);_0x212512(_0x120be0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index aaf868b..b439025 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 _0x450a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x450a,0x149));var _0xa450=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x450a[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var path=require(_0xa450('0x2'));var timeout=require(_0xa450('0x3'));var express=require(_0xa450('0x4'));var router=express[_0xa450('0x5')]();var fs_extra=require(_0xa450('0x6'));var auth=require(_0xa450('0x7'));var interaction=require(_0xa450('0x8'));var config=require(_0xa450('0x9'));var controller=require('./intZendeskAccount.controller');router[_0xa450('0xa')]('/',auth[_0xa450('0xb')](),controller['index']);router['get'](_0xa450('0xc'),auth['isAuthenticated'](),controller[_0xa450('0xd')]);router[_0xa450('0xa')](_0xa450('0xe'),auth[_0xa450('0xb')](),controller[_0xa450('0xf')]);router['get'](_0xa450('0x10'),auth[_0xa450('0xb')](),controller[_0xa450('0x11')]);router[_0xa450('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa450('0x12')](_0xa450('0xe'),auth[_0xa450('0xb')](),controller[_0xa450('0x13')]);router[_0xa450('0x14')](_0xa450('0xc'),auth[_0xa450('0xb')](),controller[_0xa450('0x15')]);router[_0xa450('0x16')](_0xa450('0xc'),auth[_0xa450('0xb')](),controller['destroy']);module[_0xa450('0x17')]=router; \ No newline at end of file +var _0xa35c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x1cc299,_0x27cc74){var _0x5310e1=function(_0x15c7b8){while(--_0x15c7b8){_0x1cc299['push'](_0x1cc299['shift']());}};_0x5310e1(++_0x27cc74);}(_0xa35c,0xe1));var _0xca35=function(_0x3ef961,_0x48b9d3){_0x3ef961=_0x3ef961-0x0;var _0x5b84bd=_0xa35c[_0x3ef961];return _0x5b84bd;};'use strict';var multer=require('multer');var util=require(_0xca35('0x0'));var path=require(_0xca35('0x1'));var timeout=require(_0xca35('0x2'));var express=require(_0xca35('0x3'));var router=express[_0xca35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xca35('0x5'));var interaction=require(_0xca35('0x6'));var config=require(_0xca35('0x7'));var controller=require(_0xca35('0x8'));router[_0xca35('0x9')]('/',auth[_0xca35('0xa')](),controller[_0xca35('0xb')]);router['get'](_0xca35('0xc'),auth[_0xca35('0xa')](),controller[_0xca35('0xd')]);router[_0xca35('0x9')](_0xca35('0xe'),auth[_0xca35('0xa')](),controller['getConfigurations']);router[_0xca35('0x9')](_0xca35('0xf'),auth['isAuthenticated'](),controller[_0xca35('0x10')]);router[_0xca35('0x11')]('/',auth[_0xca35('0xa')](),controller[_0xca35('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xca35('0x13')]);router[_0xca35('0x14')](_0xca35('0xc'),auth[_0xca35('0xa')](),controller['update']);router[_0xca35('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xca35('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4eaf098..374ff7f 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 _0xdeb3=['newTab','exports','STRING','remoteUri','ENUM','token','integrationTab'];(function(_0x4f6651,_0x446266){var _0x389ef0=function(_0x4e6fa3){while(--_0x4e6fa3){_0x4f6651['push'](_0x4f6651['shift']());}};_0x389ef0(++_0x446266);}(_0xdeb3,0xb7));var _0x3deb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdeb3[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x3deb('0x0')]={'name':{'type':Sequelize[_0x3deb('0x1')]},'description':{'type':Sequelize[_0x3deb('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x3deb('0x1')]},'token':{'type':Sequelize[_0x3deb('0x1')]},'remoteUri':{'type':Sequelize[_0x3deb('0x1')],'unique':_0x3deb('0x2')},'authType':{'type':Sequelize[_0x3deb('0x3')]('password',_0x3deb('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3deb('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3deb('0x5'),_0x3deb('0x6')),'defaultValue':_0x3deb('0x5')}}; \ No newline at end of file +var _0xfc65=['password','token','newTab','integrationTab','sequelize','STRING','username','remoteUri','ENUM'];(function(_0x17fc1a,_0x407f68){var _0x1536e1=function(_0x3d4c98){while(--_0x3d4c98){_0x17fc1a['push'](_0x17fc1a['shift']());}};_0x1536e1(++_0x407f68);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x2c07fa,_0x3a43c3){_0x2c07fa=_0x2c07fa-0x0;var _0x296c6f=_0xfc65[_0x2c07fa];return _0x296c6f;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5fc6('0x1')]},'username':{'type':Sequelize[_0x5fc6('0x1')],'unique':_0x5fc6('0x2')},'password':{'type':Sequelize[_0x5fc6('0x1')]},'token':{'type':Sequelize[_0x5fc6('0x1')]},'remoteUri':{'type':Sequelize[_0x5fc6('0x1')],'unique':_0x5fc6('0x3')},'authType':{'type':Sequelize[_0x5fc6('0x4')](_0x5fc6('0x5'),_0x5fc6('0x6')),'defaultValue':_0x5fc6('0x5')},'serverUrl':{'type':Sequelize[_0x5fc6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5fc6('0x4')]('integrationTab',_0x5fc6('0x7')),'defaultValue':_0x5fc6('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 84b9007..da1fb26 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 _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x4272c4,_0x379c31){var _0x2024b3=function(_0x3926cc){while(--_0x3926cc){_0x4272c4['push'](_0x4272c4['shift']());}};_0x2024b3(++_0x379c31);}(_0xe511,0x16f));var _0x1e51=function(_0x229527,_0x337664){_0x229527=_0x229527-0x0;var _0x1b88d3=_0xe511[_0x229527];return _0x1b88d3;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file +var _0x087b=['nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x087b,0x11a));var _0xb087=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x087b[_0x62c958];return _0x57ec61;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];var integrations=require(_0xb087('0x1b'));function respondWithStatusCode(_0x323656,_0x51ceaa){_0x51ceaa=_0x51ceaa||0xcc;return function(_0x3001e3){if(_0x3001e3){return _0x323656[_0xb087('0x1c')](_0x51ceaa);}return _0x323656[_0xb087('0x1d')](_0x51ceaa)[_0xb087('0x1e')]();};}function respondWithResult(_0x11784c,_0x12d0db){_0x12d0db=_0x12d0db||0xc8;return function(_0x5e9757){if(_0x5e9757){return _0x11784c[_0xb087('0x1d')](_0x12d0db)[_0xb087('0x1f')](_0x5e9757);}};}function respondWithFilteredResult(_0x16d0b7,_0x5193a4){return function(_0x43e576){if(_0x43e576){var _0x412b48=typeof _0x5193a4['offset']===_0xb087('0x20')&&typeof _0x5193a4[_0xb087('0x21')]===_0xb087('0x20');var _0x5bb80b=_0x43e576[_0xb087('0x22')];var _0x3c680f=_0x412b48?0x0:_0x5193a4[_0xb087('0x23')];var _0x45d074=_0x412b48?_0x43e576['count']:_0x5193a4[_0xb087('0x23')]+_0x5193a4[_0xb087('0x21')];var _0x10bb5b;if(_0x45d074>=_0x5bb80b){_0x45d074=_0x5bb80b;_0x10bb5b=0xc8;}else{_0x10bb5b=0xce;}_0x16d0b7[_0xb087('0x1d')](_0x10bb5b);return _0x16d0b7['set']('Content-Range',_0x3c680f+'-'+_0x45d074+'/'+_0x5bb80b)['json'](_0x43e576);}return null;};}function patchUpdates(_0x49450a){return function(_0x45a6cf){try{jsonpatch[_0xb087('0x24')](_0x45a6cf,_0x49450a,!![]);}catch(_0x3d0f57){return BPromise[_0xb087('0x25')](_0x3d0f57);}return _0x45a6cf[_0xb087('0x26')]();};}function saveUpdates(_0x258b4c,_0x31ae01){return function(_0x5587f7){if(_0x5587f7){return _0x5587f7[_0xb087('0x27')](_0x258b4c)[_0xb087('0x28')](function(_0x1de654){return _0x1de654;});}return null;};}function removeEntity(_0x1cfb3e,_0x3ad74e){return function(_0x4d9028){if(_0x4d9028){return _0x4d9028[_0xb087('0x29')]()[_0xb087('0x28')](function(){_0x1cfb3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(!_0x5a4ee0){_0x50745a[_0xb087('0x1c')](0x194);}return _0x5a4ee0;};}function handleError(_0x45685d,_0x1d124f){_0x1d124f=_0x1d124f||0x1f4;return function(_0x3ca2df){logger[_0xb087('0x2a')](_0x3ca2df[_0xb087('0x2b')]);if(_0x3ca2df[_0xb087('0x2c')]){delete _0x3ca2df[_0xb087('0x2c')];}_0x45685d[_0xb087('0x1d')](_0x1d124f)[_0xb087('0x2d')](_0x3ca2df);};}exports[_0xb087('0x2e')]=function(_0x31e3e6,_0xb0baf6){var _0x263259={},_0x593b78={},_0x37393a={'count':0x0,'rows':[]};var _0x1335d9=_[_0xb087('0x2f')](db[_0xb087('0x30')][_0xb087('0x31')],function(_0xa6d90c){return{'name':_0xa6d90c[_0xb087('0x32')],'type':_0xa6d90c[_0xb087('0x33')]['key']};});_0x593b78['model']=_[_0xb087('0x2f')](_0x1335d9,_0xb087('0x2c'));_0x593b78['query']=_[_0xb087('0x34')](_0x31e3e6[_0xb087('0x35')]);_0x593b78[_0xb087('0x36')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],_0x593b78[_0xb087('0x35')]);_0x263259[_0xb087('0x39')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],qs[_0xb087('0x3a')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3a')]));_0x263259['attributes']=_0x263259[_0xb087('0x39')]['length']?_0x263259[_0xb087('0x39')]:_0x593b78[_0xb087('0x38')];if(!_0x31e3e6[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x263259[_0xb087('0x21')]=qs[_0xb087('0x21')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x21')]);_0x263259['offset']=qs['offset'](_0x31e3e6[_0xb087('0x35')][_0xb087('0x23')]);}_0x263259[_0xb087('0x3d')]=qs[_0xb087('0x3e')](_0x31e3e6[_0xb087('0x35')]['sort']);_0x263259[_0xb087('0x3f')]=qs[_0xb087('0x36')](_['pick'](_0x31e3e6['query'],_0x593b78[_0xb087('0x36')]),_0x1335d9);if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x40')]){_0x263259['where']=_[_0xb087('0x41')](_0x263259[_0xb087('0x3f')],{'$or':_[_0xb087('0x2f')](_0x1335d9,function(_0x1ed2c9){if(_0x1ed2c9[_0xb087('0x33')]!=='VIRTUAL'){var _0x7e1315={};_0x7e1315[_0x1ed2c9['name']]={'$like':'%'+_0x31e3e6[_0xb087('0x35')]['filter']+'%'};return _0x7e1315;}})});}_0x263259=_[_0xb087('0x41')]({},_0x263259,_0x31e3e6[_0xb087('0x42')]);var _0x513332={'where':_0x263259[_0xb087('0x3f')]};return db['ZendeskAccount'][_0xb087('0x22')](_0x513332)['then'](function(_0x2d2c74){_0x37393a[_0xb087('0x22')]=_0x2d2c74;if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x43')]){_0x263259[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x30')][_0xb087('0x45')](_0x263259);})['then'](function(_0x1625f6){_0x37393a['rows']=_0x1625f6;return _0x37393a;})[_0xb087('0x28')](respondWithFilteredResult(_0xb0baf6,_0x263259))[_0xb087('0x46')](handleError(_0xb0baf6,null));};exports['show']=function(_0xb662bf,_0x45dc6f){var _0x7650c5={'raw':![],'where':{'id':_0xb662bf[_0xb087('0x47')]['id']}},_0x4c33cc={};_0x4c33cc['model']=_[_0xb087('0x34')](db[_0xb087('0x30')]['rawAttributes']);_0x4c33cc[_0xb087('0x35')]=_[_0xb087('0x34')](_0xb662bf['query']);_0x4c33cc[_0xb087('0x36')]=_[_0xb087('0x37')](_0x4c33cc['model'],_0x4c33cc[_0xb087('0x35')]);_0x7650c5[_0xb087('0x39')]=_[_0xb087('0x37')](_0x4c33cc[_0xb087('0x38')],qs['fields'](_0xb662bf['query'][_0xb087('0x3a')]));_0x7650c5[_0xb087('0x39')]=_0x7650c5[_0xb087('0x39')][_0xb087('0x48')]?_0x7650c5[_0xb087('0x39')]:_0x4c33cc[_0xb087('0x38')];if(_0xb662bf['query']['includeAll']){_0x7650c5[_0xb087('0x44')]=[{'all':!![]}];}_0x7650c5=_['merge']({},_0x7650c5,_0xb662bf[_0xb087('0x42')]);return db[_0xb087('0x30')][_0xb087('0x49')](_0x7650c5)[_0xb087('0x28')](handleEntityNotFound(_0x45dc6f,null))['then'](respondWithResult(_0x45dc6f,null))[_0xb087('0x46')](handleError(_0x45dc6f,null));};exports['create']=function(_0x2fe8a0,_0x73413b){return db[_0xb087('0x30')][_0xb087('0x4a')](_0x2fe8a0[_0xb087('0x4b')],{})['then'](respondWithResult(_0x73413b,0xc9))[_0xb087('0x46')](handleError(_0x73413b,null));};exports[_0xb087('0x27')]=function(_0x588d96,_0x4fba31){if(_0x588d96[_0xb087('0x4b')]['id']){delete _0x588d96['body']['id'];}return db['ZendeskAccount'][_0xb087('0x49')]({'where':{'id':_0x588d96[_0xb087('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fba31,null))[_0xb087('0x28')](saveUpdates(_0x588d96[_0xb087('0x4b')],null))[_0xb087('0x28')](respondWithResult(_0x4fba31,null))['catch'](handleError(_0x4fba31,null));};exports['destroy']=function(_0x30cc83,_0x54862a){return db['ZendeskAccount'][_0xb087('0x49')]({'where':{'id':_0x30cc83[_0xb087('0x47')]['id']}})[_0xb087('0x28')](handleEntityNotFound(_0x54862a,null))[_0xb087('0x28')](removeEntity(_0x54862a,null))[_0xb087('0x46')](handleError(_0x54862a,null));};exports[_0xb087('0x4c')]=function(_0xbd849d,_0xfb8827,_0x1fe178){var _0x18d93b={};var _0x47d47c={};var _0x2cfc44;var _0x55e653;return db[_0xb087('0x30')][_0xb087('0x4d')]({'where':{'id':_0xbd849d['params']['id']}})[_0xb087('0x28')](handleEntityNotFound(_0xfb8827,null))[_0xb087('0x28')](function(_0x343830){if(_0x343830){_0x2cfc44=_0x343830;_0x47d47c[_0xb087('0x38')]=_[_0xb087('0x34')](db[_0xb087('0x4e')][_0xb087('0x31')]);_0x47d47c[_0xb087('0x35')]=_[_0xb087('0x34')](_0xbd849d[_0xb087('0x35')]);_0x47d47c[_0xb087('0x36')]=_['intersection'](_0x47d47c[_0xb087('0x38')],_0x47d47c['query']);_0x18d93b[_0xb087('0x39')]=_['intersection'](_0x47d47c[_0xb087('0x38')],qs[_0xb087('0x3a')](_0xbd849d[_0xb087('0x35')][_0xb087('0x3a')]));_0x18d93b[_0xb087('0x39')]=_0x18d93b[_0xb087('0x39')][_0xb087('0x48')]?_0x18d93b[_0xb087('0x39')]:_0x47d47c[_0xb087('0x38')];_0x18d93b[_0xb087('0x3d')]=qs[_0xb087('0x3e')](_0xbd849d[_0xb087('0x35')][_0xb087('0x3e')]);_0x18d93b[_0xb087('0x3f')]=qs[_0xb087('0x36')](_[_0xb087('0x4f')](_0xbd849d[_0xb087('0x35')],_0x47d47c[_0xb087('0x36')]));if(_0xbd849d[_0xb087('0x35')][_0xb087('0x40')]){_0x18d93b[_0xb087('0x3f')]=_[_0xb087('0x41')](_0x18d93b['where'],{'$or':_[_0xb087('0x2f')](_0x18d93b[_0xb087('0x39')],function(_0xe81087){var _0x561c40={};_0x561c40[_0xe81087]={'$like':'%'+_0xbd849d[_0xb087('0x35')][_0xb087('0x40')]+'%'};return _0x561c40;})});}_0x18d93b=_['merge']({},_0x18d93b,_0xbd849d[_0xb087('0x42')]);return _0x2cfc44[_0xb087('0x4c')](_0x18d93b);}})[_0xb087('0x28')](function(_0x596264){if(_0x596264){_0x55e653=_0x596264[_0xb087('0x48')];if(!_0xbd849d[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x18d93b[_0xb087('0x21')]=qs[_0xb087('0x21')](_0xbd849d[_0xb087('0x35')][_0xb087('0x21')]);_0x18d93b['offset']=qs[_0xb087('0x23')](_0xbd849d[_0xb087('0x35')][_0xb087('0x23')]);}return _0x2cfc44['getConfigurations'](_0x18d93b);}})[_0xb087('0x28')](function(_0x4a26d0){if(_0x4a26d0){return _0x4a26d0?{'count':_0x55e653,'rows':_0x4a26d0}:null;}})['then'](respondWithResult(_0xfb8827,null))[_0xb087('0x46')](handleError(_0xfb8827,null));};exports[_0xb087('0x50')]=function(_0x48c00c,_0x298fdb,_0x524d18){if(_0x48c00c[_0xb087('0x4b')]['id']){delete _0x48c00c[_0xb087('0x4b')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x48c00c[_0xb087('0x47')]['id']}})['then'](handleEntityNotFound(_0x298fdb,null))['then'](function(_0x3c97ab){if(_0x3c97ab){_0x48c00c['body'][_0xb087('0x51')]=_0x3c97ab['id'];_0x48c00c['body'][_0xb087('0x52')]=integrations[_0xb087('0x53')](_0x48c00c[_0xb087('0x4b')][_0xb087('0x54')],_0x48c00c[_0xb087('0x4b')][_0xb087('0x33')]);_0x48c00c['body'][_0xb087('0x55')]=integrations['getDescriptions'](_0x48c00c[_0xb087('0x4b')][_0xb087('0x54')],_0x48c00c[_0xb087('0x4b')]['type']);return db[_0xb087('0x4e')]['create'](_0x48c00c[_0xb087('0x4b')],{'include':[{'model':db[_0xb087('0x56')],'as':_0xb087('0x52')},{'model':db[_0xb087('0x56')],'as':_0xb087('0x55')}]});}return null;})[_0xb087('0x28')](respondWithResult(_0x298fdb,null))['catch'](handleError(_0x298fdb,null));};exports[_0xb087('0x57')]=function(_0xd01a6b,_0x4bedbd,_0x25a45f){var _0x58de88='';return db[_0xb087('0x30')][_0xb087('0x4d')]({'where':{'id':_0xd01a6b[_0xb087('0x47')]['id']},'attributes':['id',_0xb087('0x58'),_0xb087('0x59'),_0xb087('0x5a'),_0xb087('0x5b'),_0xb087('0x5c')]})['then'](handleEntityNotFound(_0x4bedbd,null))['then'](function(_0x5c727f){if(_0x5c727f){_0x58de88=_0x5c727f[_0xb087('0x5c')];var _0x5190a4=_0x58de88[_0xb087('0x5d')](-0x1);if(_0x5190a4==='/'){_0x58de88=_0x58de88['substring'](0x0,_0x58de88[_0xb087('0x5e')](_0x5190a4));}var _0x43bf47={'method':_0xb087('0x5f'),'uri':util[_0xb087('0x60')]('%s/%s',_0x58de88,_0xb087('0x61')),'json':!![]};switch(_0x5c727f['authType']){case _0xb087('0x59'):_0x43bf47[_0xb087('0x62')]={'Authorization':util[_0xb087('0x60')](_0xb087('0x63'),new Buffer(util['format']('%s:%s',_0x5c727f[_0xb087('0x58')],_0x5c727f['password']))[_0xb087('0x64')](_0xb087('0x65')))};break;case _0xb087('0x5a'):_0x43bf47[_0xb087('0x62')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xb087('0x60')]('%s/token:%s',_0x5c727f[_0xb087('0x58')],_0x5c727f[_0xb087('0x5a')]))[_0xb087('0x64')](_0xb087('0x65')))};break;default:throw new db[(_0xb087('0x66'))]['ValidationError'](_0xb087('0x67'));}return rp(_0x43bf47);}})[_0xb087('0x28')](function(_0x5b9c5f){if(_0x5b9c5f){var _0x544ee0=['subject',_0xb087('0x68'),_0xb087('0x69'),_0xb087('0x6a')];_[_0xb087('0x6b')](_0x5b9c5f[_0xb087('0x61')],function(_0x19d7ae){return _0x544ee0['includes'](_0x19d7ae[_0xb087('0x33')]);});return{'count':_0x5b9c5f[_0xb087('0x61')][_0xb087('0x48')],'rows':_[_0xb087('0x2f')](_0x5b9c5f[_0xb087('0x61')],function(_0x3330b2){return{'id':_0x3330b2['id'],'name':_0x3330b2[_0xb087('0x6c')]>0x7?_0x3330b2['title']:_0x3330b2[_0xb087('0x33')],'custom':_0x3330b2[_0xb087('0x6c')]>0x7?!![]:![],'options':_0x3330b2[_0xb087('0x6d')]?_0x3330b2['system_field_options']:_0x3330b2[_0xb087('0x6e')]?_0x3330b2['custom_field_options']:[]};})};}})[_0xb087('0x28')](respondWithResult(_0x4bedbd,null))[_0xb087('0x46')](function(_0x45da69){var _0x267dea=_0xd01a6b[_0xb087('0x35')][_0xb087('0x6f')]?0x1f4:_0x45da69['statusCode']||0x1f4;logger['error'](_0xb087('0x70'),_0xb087('0x57'),_0x267dea,JSON['stringify'](_0x45da69));delete _0x45da69[_0xb087('0x2c')];if(_0x267dea===0x191){_0x267dea=0x190;}_0x4bedbd[_0xb087('0x1d')](_0x267dea)[_0xb087('0x2d')](_0xd01a6b[_0xb087('0x35')][_0xb087('0x6f')]?{'message':_0xb087('0x71'),'statusCode':_0x45da69['statusCode']}:_0x45da69);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d7c322a..87ac389 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 _0xa927=['../../config/logger','moment','path','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x296fe9,_0x1e39d6){var _0x306a95=function(_0x29d160){while(--_0x29d160){_0x296fe9['push'](_0x296fe9['shift']());}};_0x306a95(++_0x1e39d6);}(_0xa927,0xc7));var _0x7a92=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa927[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x7a92('0x0'));var util=require('util');var logger=require(_0x7a92('0x1'))('api');var moment=require(_0x7a92('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a92('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a92('0x4'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5471fb,_0x994dc0){return _0x5471fb[_0x7a92('0x5')](_0x7a92('0x6'),attributes,{'tableName':_0x7a92('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1257=['../../config/logger','api','bluebird','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util'];(function(_0x7c6bb7,_0x539726){var _0x3bf74e=function(_0x35eb46){while(--_0x35eb46){_0x7c6bb7['push'](_0x7c6bb7['shift']());}};_0x3bf74e(++_0x539726);}(_0x1257,0xb9));var _0x7125=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x1257[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x7125('0x0'));var util=require(_0x7125('0x1'));var logger=require(_0x7125('0x2'))(_0x7125('0x3'));var moment=require('moment');var BPromise=require(_0x7125('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7125('0x5'));var config=require('../../config/environment');var attributes=require(_0x7125('0x6'));var integrations=require(_0x7125('0x7'));module[_0x7125('0x8')]=function(_0x633db,_0x30e3e0){return _0x633db[_0x7125('0x9')]('ZendeskAccount',attributes,{'tableName':_0x7125('0xa'),'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 a37f3de..3b94687 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 _0xb4d5=['debug','catch','find','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x5186bc,_0x42fd3d){var _0x59f772=function(_0x120154){while(--_0x120154){_0x5186bc['push'](_0x5186bc['shift']());}};_0x59f772(++_0x42fd3d);}(_0xb4d5,0x162));var _0x5b4d=function(_0x5a225e,_0x3696b7){_0x5a225e=_0x5a225e-0x0;var _0x475110=_0xb4d5[_0x5a225e];return _0x475110;};'use strict';var _=require('lodash');var util=require(_0x5b4d('0x0'));var moment=require('moment');var BPromise=require(_0x5b4d('0x1'));var rs=require(_0x5b4d('0x2'));var fs=require('fs');var Redis=require(_0x5b4d('0x3'));var db=require(_0x5b4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4d('0x5'))(_0x5b4d('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b4d('0x7'));var client=jayson[_0x5b4d('0x8')][_0x5b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x202411,_0x1ec6cc,_0x14cd0d){return new BPromise(function(_0x3eb451,_0x6a48bc){return client[_0x5b4d('0xa')](_0x202411,_0x14cd0d)[_0x5b4d('0xb')](function(_0x5d08c8){logger[_0x5b4d('0xc')](_0x5b4d('0xd'),_0x1ec6cc,_0x5b4d('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1ec6cc,_0x5b4d('0xe'),JSON[_0x5b4d('0xf')](_0x5d08c8));if(_0x5d08c8[_0x5b4d('0x10')]){if(_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x11')]===0x1f4){logger[_0x5b4d('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x1ec6cc,_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x12')]);return _0x6a48bc(_0x5d08c8['error'][_0x5b4d('0x12')]);}logger[_0x5b4d('0x10')](_0x5b4d('0xd'),_0x1ec6cc,_0x5d08c8[_0x5b4d('0x10')][_0x5b4d('0x12')]);return _0x3eb451(_0x5d08c8[_0x5b4d('0x10')]['message']);}else{logger[_0x5b4d('0xc')](_0x5b4d('0xd'),_0x1ec6cc,_0x5b4d('0xe'));_0x3eb451(_0x5d08c8[_0x5b4d('0x13')][_0x5b4d('0x12')]);}})['catch'](function(_0x3023a5){logger[_0x5b4d('0x10')](_0x5b4d('0xd'),_0x1ec6cc,_0x3023a5);_0x6a48bc(_0x3023a5);});});}exports[_0x5b4d('0x14')]=function(_0x12aa05){var _0x41b0d1=this;return new Promise(function(_0x307d7e,_0x23a728){return db[_0x5b4d('0x15')][_0x5b4d('0x16')]({'raw':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x18')]===undefined?!![]:![]:!![],'where':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x19')]||null:null,'attributes':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x1a')]||null:null,'limit':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options'][_0x5b4d('0x1b')]||null:null,'include':_0x12aa05[_0x5b4d('0x17')]?_0x12aa05['options']['include']?_['map'](_0x12aa05[_0x5b4d('0x17')][_0x5b4d('0x1c')],function(_0x5de624){return{'model':db[_0x5de624[_0x5b4d('0x1d')]],'as':_0x5de624['as'],'attributes':_0x5de624[_0x5b4d('0x1a')],'include':_0x5de624[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x5de624[_0x5b4d('0x1c')],function(_0x31f636){return{'model':db[_0x31f636[_0x5b4d('0x1d')]],'as':_0x31f636['as'],'attributes':_0x31f636[_0x5b4d('0x1a')],'include':_0x31f636[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x31f636[_0x5b4d('0x1c')],function(_0x585957){return{'model':db[_0x585957[_0x5b4d('0x1d')]],'as':_0x585957['as'],'attributes':_0x585957['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf0bf08){logger[_0x5b4d('0xc')](_0x5b4d('0x14'),_0x12aa05);logger[_0x5b4d('0x1f')](_0x5b4d('0x14'),_0x12aa05,JSON['stringify'](_0xf0bf08));_0x307d7e(_0xf0bf08);})[_0x5b4d('0x20')](function(_0x5b3424){logger[_0x5b4d('0x10')](_0x5b4d('0x14'),_0x5b3424[_0x5b4d('0x12')],_0x12aa05);_0x23a728(_0x41b0d1[_0x5b4d('0x10')](0x1f4,_0x5b3424[_0x5b4d('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x109d6f){var _0x5ce43f=this;return new Promise(function(_0x46bdc8,_0x498882){return db['ZendeskAccount'][_0x5b4d('0x21')]({'raw':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x18')]===undefined?!![]:![]:!![],'where':_0x109d6f['options']?_0x109d6f[_0x5b4d('0x17')]['where']||null:null,'attributes':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1a')]||null:null,'include':_0x109d6f[_0x5b4d('0x17')]?_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x109d6f[_0x5b4d('0x17')][_0x5b4d('0x1c')],function(_0x5122db){return{'model':db[_0x5122db[_0x5b4d('0x1d')]],'as':_0x5122db['as'],'attributes':_0x5122db[_0x5b4d('0x1a')],'include':_0x5122db['include']?_[_0x5b4d('0x1e')](_0x5122db['include'],function(_0x2b1058){return{'model':db[_0x2b1058[_0x5b4d('0x1d')]],'as':_0x2b1058['as'],'attributes':_0x2b1058[_0x5b4d('0x1a')],'include':_0x2b1058[_0x5b4d('0x1c')]?_[_0x5b4d('0x1e')](_0x2b1058[_0x5b4d('0x1c')],function(_0x2216ac){return{'model':db[_0x2216ac[_0x5b4d('0x1d')]],'as':_0x2216ac['as'],'attributes':_0x2216ac[_0x5b4d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b4d('0xb')](function(_0x33c91d){logger['info'](_0x5b4d('0x22'),_0x109d6f);logger[_0x5b4d('0x1f')](_0x5b4d('0x22'),_0x109d6f,JSON[_0x5b4d('0xf')](_0x33c91d));_0x46bdc8(_0x33c91d);})[_0x5b4d('0x20')](function(_0x1487ba){logger[_0x5b4d('0x10')](_0x5b4d('0x22'),_0x1487ba[_0x5b4d('0x12')],_0x109d6f);_0x498882(_0x5ce43f[_0x5b4d('0x10')](0x1f4,_0x1487ba[_0x5b4d('0x12')]));});});}; \ No newline at end of file +var _0xcf5a=['../../config/logger','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZendeskAccount','find','where','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x220954,_0x153286){var _0x598557=function(_0x530e09){while(--_0x530e09){_0x220954['push'](_0x220954['shift']());}};_0x598557(++_0x153286);}(_0xcf5a,0x1cd));var _0xacf5=function(_0x548651,_0x2bf4ef){_0x548651=_0x548651-0x0;var _0x46402c=_0xcf5a[_0x548651];return _0x46402c;};'use strict';var _=require(_0xacf5('0x0'));var util=require(_0xacf5('0x1'));var moment=require('moment');var BPromise=require(_0xacf5('0x2'));var rs=require(_0xacf5('0x3'));var fs=require('fs');var Redis=require(_0xacf5('0x4'));var db=require(_0xacf5('0x5'))['db'];var utils=require(_0xacf5('0x6'));var logger=require(_0xacf5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xacf5('0x8'));var client=jayson[_0xacf5('0x9')][_0xacf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1013f6,_0x4e71fc,_0x35534c){return new BPromise(function(_0xdb0a8,_0x5413ab){return client[_0xacf5('0xb')](_0x1013f6,_0x35534c)[_0xacf5('0xc')](function(_0x420313){logger[_0xacf5('0xd')](_0xacf5('0xe'),_0x4e71fc,_0xacf5('0xf'));logger[_0xacf5('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4e71fc,_0xacf5('0xf'),JSON[_0xacf5('0x11')](_0x420313));if(_0x420313[_0xacf5('0x12')]){if(_0x420313[_0xacf5('0x12')][_0xacf5('0x13')]===0x1f4){logger['error'](_0xacf5('0xe'),_0x4e71fc,_0x420313[_0xacf5('0x12')][_0xacf5('0x14')]);return _0x5413ab(_0x420313['error'][_0xacf5('0x14')]);}logger[_0xacf5('0x12')](_0xacf5('0xe'),_0x4e71fc,_0x420313[_0xacf5('0x12')][_0xacf5('0x14')]);return _0xdb0a8(_0x420313['error'][_0xacf5('0x14')]);}else{logger[_0xacf5('0xd')](_0xacf5('0xe'),_0x4e71fc,'request\x20sent');_0xdb0a8(_0x420313[_0xacf5('0x15')]['message']);}})['catch'](function(_0x7aadb1){logger[_0xacf5('0x12')](_0xacf5('0xe'),_0x4e71fc,_0x7aadb1);_0x5413ab(_0x7aadb1);});});}exports[_0xacf5('0x16')]=function(_0x5dcaf3){var _0x44d1d9=this;return new Promise(function(_0x51e604,_0x2954a2){return db[_0xacf5('0x17')][_0xacf5('0x18')]({'raw':_0x5dcaf3[_0xacf5('0x19')]?_0x5dcaf3['options'][_0xacf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dcaf3[_0xacf5('0x19')]?_0x5dcaf3[_0xacf5('0x19')]['where']||null:null,'attributes':_0x5dcaf3[_0xacf5('0x19')]?_0x5dcaf3[_0xacf5('0x19')][_0xacf5('0x1b')]||null:null,'limit':_0x5dcaf3[_0xacf5('0x19')]?_0x5dcaf3[_0xacf5('0x19')][_0xacf5('0x1c')]||null:null,'include':_0x5dcaf3[_0xacf5('0x19')]?_0x5dcaf3[_0xacf5('0x19')][_0xacf5('0x1d')]?_['map'](_0x5dcaf3['options'][_0xacf5('0x1d')],function(_0x4390df){return{'model':db[_0x4390df[_0xacf5('0x1e')]],'as':_0x4390df['as'],'attributes':_0x4390df[_0xacf5('0x1b')],'include':_0x4390df[_0xacf5('0x1d')]?_[_0xacf5('0x1f')](_0x4390df[_0xacf5('0x1d')],function(_0x19f52d){return{'model':db[_0x19f52d[_0xacf5('0x1e')]],'as':_0x19f52d['as'],'attributes':_0x19f52d[_0xacf5('0x1b')],'include':_0x19f52d['include']?_['map'](_0x19f52d[_0xacf5('0x1d')],function(_0x5aa0f0){return{'model':db[_0x5aa0f0['model']],'as':_0x5aa0f0['as'],'attributes':_0x5aa0f0[_0xacf5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacf5('0xc')](function(_0x435168){logger['info'](_0xacf5('0x16'),_0x5dcaf3);logger[_0xacf5('0x10')](_0xacf5('0x16'),_0x5dcaf3,JSON[_0xacf5('0x11')](_0x435168));_0x51e604(_0x435168);})['catch'](function(_0x5e0ca5){logger[_0xacf5('0x12')](_0xacf5('0x16'),_0x5e0ca5[_0xacf5('0x14')],_0x5dcaf3);_0x2954a2(_0x44d1d9[_0xacf5('0x12')](0x1f4,_0x5e0ca5[_0xacf5('0x14')]));});});};exports[_0xacf5('0x20')]=function(_0x4c497e){var _0x405cdb=this;return new Promise(function(_0x3795c2,_0x2cf2ae){return db[_0xacf5('0x17')][_0xacf5('0x21')]({'raw':_0x4c497e['options']?_0x4c497e[_0xacf5('0x19')][_0xacf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c497e[_0xacf5('0x19')]?_0x4c497e[_0xacf5('0x19')][_0xacf5('0x22')]||null:null,'attributes':_0x4c497e[_0xacf5('0x19')]?_0x4c497e[_0xacf5('0x19')][_0xacf5('0x1b')]||null:null,'include':_0x4c497e[_0xacf5('0x19')]?_0x4c497e[_0xacf5('0x19')][_0xacf5('0x1d')]?_[_0xacf5('0x1f')](_0x4c497e[_0xacf5('0x19')][_0xacf5('0x1d')],function(_0x2fc744){return{'model':db[_0x2fc744[_0xacf5('0x1e')]],'as':_0x2fc744['as'],'attributes':_0x2fc744[_0xacf5('0x1b')],'include':_0x2fc744[_0xacf5('0x1d')]?_[_0xacf5('0x1f')](_0x2fc744[_0xacf5('0x1d')],function(_0x55396f){return{'model':db[_0x55396f[_0xacf5('0x1e')]],'as':_0x55396f['as'],'attributes':_0x55396f[_0xacf5('0x1b')],'include':_0x55396f[_0xacf5('0x1d')]?_[_0xacf5('0x1f')](_0x55396f[_0xacf5('0x1d')],function(_0x14e52f){return{'model':db[_0x14e52f[_0xacf5('0x1e')]],'as':_0x14e52f['as'],'attributes':_0x14e52f[_0xacf5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacf5('0xc')](function(_0x1b9b5e){logger[_0xacf5('0xd')](_0xacf5('0x20'),_0x4c497e);logger[_0xacf5('0x10')]('ShowZendeskAccount',_0x4c497e,JSON[_0xacf5('0x11')](_0x1b9b5e));_0x3795c2(_0x1b9b5e);})[_0xacf5('0x23')](function(_0x50f06a){logger[_0xacf5('0x12')](_0xacf5('0x20'),_0x50f06a[_0xacf5('0x14')],_0x4c497e);_0x2cf2ae(_0x405cdb[_0xacf5('0x12')](0x1f4,_0x50f06a[_0xacf5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 359cc2b..2584c88 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x428901,_0x37bac1){var _0x1348c6=function(_0x1c6aa9){while(--_0x1c6aa9){_0x428901['push'](_0x428901['shift']());}};_0x1348c6(++_0x37bac1);}(_0xb10b,0x12a));var _0xbb10=function(_0xb0ed0c,_0x1a1fb1){_0xb0ed0c=_0xb0ed0c-0x0;var _0x5d5356=_0xb10b[_0xb0ed0c];return _0x5d5356;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x41f96e,_0x4797aa){var _0x2c6e32=function(_0x51c47f){while(--_0x51c47f){_0x41f96e['push'](_0x41f96e['shift']());}};_0x2c6e32(++_0x4797aa);}(_0xa571,0x107));var _0x1a57=function(_0x24f08a,_0x4d5b51){_0x24f08a=_0x24f08a-0x0;var _0x405dcf=_0xa571[_0x24f08a];return _0x405dcf;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4bce9a0..04bed5a 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 _0xb90a=['STRING','sequelize','exports'];(function(_0x59f5cc,_0x21d4ee){var _0xb46d3f=function(_0x427cba){while(--_0x427cba){_0x59f5cc['push'](_0x59f5cc['shift']());}};_0xb46d3f(++_0x21d4ee);}(_0xb90a,0xfa));var _0xab90=function(_0x413935,_0x34e81b){_0x413935=_0x413935-0x0;var _0x3ef383=_0xb90a[_0x413935];return _0x3ef383;};'use strict';var Sequelize=require(_0xab90('0x0'));module[_0xab90('0x1')]={'name':{'type':Sequelize[_0xab90('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe093=['STRING','exports'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xe093,0x1cf));var _0x3e09=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe093[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x3e09('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e09('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4d5984a..6d4adbb 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 _0xdbd1=['ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','map','filter','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','params','destroy','getFields','sort','getSubjects','getDescriptions','ZendeskField','getTags','findOne','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index'];(function(_0x5f5995,_0x2323ae){var _0x125d06=function(_0x4f46c3){while(--_0x4f46c3){_0x5f5995['push'](_0x5f5995['shift']());}};_0x125d06(++_0x2323ae);}(_0xdbd1,0x132));var _0x1dbd=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0xdbd1[_0x2a1b33];return _0x4c50e7;};'use strict';var emlformat=require(_0x1dbd('0x0'));var rimraf=require(_0x1dbd('0x1'));var zipdir=require(_0x1dbd('0x2'));var jsonpatch=require(_0x1dbd('0x3'));var rp=require(_0x1dbd('0x4'));var moment=require('moment');var BPromise=require(_0x1dbd('0x5'));var Mustache=require(_0x1dbd('0x6'));var util=require(_0x1dbd('0x7'));var path=require(_0x1dbd('0x8'));var sox=require(_0x1dbd('0x9'));var csv=require('to-csv');var ejs=require(_0x1dbd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1dbd('0xb'));var squel=require(_0x1dbd('0xc'));var crypto=require('crypto');var jsforce=require(_0x1dbd('0xd'));var deskjs=require(_0x1dbd('0xe'));var toCsv=require(_0x1dbd('0xf'));var querystring=require(_0x1dbd('0x10'));var Papa=require(_0x1dbd('0x11'));var Redis=require(_0x1dbd('0x12'));var authService=require(_0x1dbd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dbd('0x14'))(_0x1dbd('0x15'));var utils=require(_0x1dbd('0x16'));var config=require(_0x1dbd('0x17'));var licenseUtil=require(_0x1dbd('0x18'));var db=require(_0x1dbd('0x19'))['db'];function respondWithStatusCode(_0x2cb37b,_0x5cb03c){_0x5cb03c=_0x5cb03c||0xcc;return function(_0x1aff33){if(_0x1aff33){return _0x2cb37b[_0x1dbd('0x1a')](_0x5cb03c);}return _0x2cb37b[_0x1dbd('0x1b')](_0x5cb03c)['end']();};}function respondWithResult(_0x596623,_0x3a9340){_0x3a9340=_0x3a9340||0xc8;return function(_0x36f5e9){if(_0x36f5e9){return _0x596623[_0x1dbd('0x1b')](_0x3a9340)[_0x1dbd('0x1c')](_0x36f5e9);}};}function respondWithFilteredResult(_0x502389,_0x2692d8){return function(_0x7def42){if(_0x7def42){var _0x38fb0f=typeof _0x2692d8['offset']==='undefined'&&typeof _0x2692d8[_0x1dbd('0x1d')]===_0x1dbd('0x1e');var _0x2f4215=_0x7def42['count'];var _0x15a237=_0x38fb0f?0x0:_0x2692d8[_0x1dbd('0x1f')];var _0x34e3a7=_0x38fb0f?_0x7def42[_0x1dbd('0x20')]:_0x2692d8['offset']+_0x2692d8['limit'];var _0x15f0c8;if(_0x34e3a7>=_0x2f4215){_0x34e3a7=_0x2f4215;_0x15f0c8=0xc8;}else{_0x15f0c8=0xce;}_0x502389['status'](_0x15f0c8);return _0x502389[_0x1dbd('0x21')](_0x1dbd('0x22'),_0x15a237+'-'+_0x34e3a7+'/'+_0x2f4215)[_0x1dbd('0x1c')](_0x7def42);}return null;};}function patchUpdates(_0x48b8a2){return function(_0x927800){try{jsonpatch[_0x1dbd('0x23')](_0x927800,_0x48b8a2,!![]);}catch(_0x433c2d){return BPromise[_0x1dbd('0x24')](_0x433c2d);}return _0x927800[_0x1dbd('0x25')]();};}function saveUpdates(_0x2817eb,_0x155f42){return function(_0x31b440){if(_0x31b440){return _0x31b440[_0x1dbd('0x26')](_0x2817eb)[_0x1dbd('0x27')](function(_0xe771f3){return _0xe771f3;});}return null;};}function removeEntity(_0x215b35,_0x1264ab){return function(_0x4445e1){if(_0x4445e1){return _0x4445e1['destroy']()['then'](function(){_0x215b35['status'](0xcc)[_0x1dbd('0x28')]();});}};}function handleEntityNotFound(_0xc9576e,_0x5e3845){return function(_0x4ff7a1){if(!_0x4ff7a1){_0xc9576e[_0x1dbd('0x1a')](0x194);}return _0x4ff7a1;};}function handleError(_0x4b426b,_0x8a1ef8){_0x8a1ef8=_0x8a1ef8||0x1f4;return function(_0x28a595){logger[_0x1dbd('0x29')](_0x28a595[_0x1dbd('0x2a')]);if(_0x28a595[_0x1dbd('0x2b')]){delete _0x28a595[_0x1dbd('0x2b')];}_0x4b426b[_0x1dbd('0x1b')](_0x8a1ef8)[_0x1dbd('0x2c')](_0x28a595);};}exports[_0x1dbd('0x2d')]=function(_0x540299,_0x4fcbfd){var _0x3e2f07={},_0x47dc61={},_0x398be3={'count':0x0,'rows':[]};var _0x4910c6=_['map'](db[_0x1dbd('0x2e')][_0x1dbd('0x2f')],function(_0x30c1c7){return{'name':_0x30c1c7[_0x1dbd('0x30')],'type':_0x30c1c7[_0x1dbd('0x31')][_0x1dbd('0x32')]};});_0x47dc61['model']=_['map'](_0x4910c6,_0x1dbd('0x2b'));_0x47dc61[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x540299['query']);_0x47dc61[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x47dc61[_0x1dbd('0x37')],_0x47dc61[_0x1dbd('0x33')]);_0x3e2f07[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x47dc61[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x540299['query'][_0x1dbd('0x39')]));_0x3e2f07[_0x1dbd('0x38')]=_0x3e2f07[_0x1dbd('0x38')]['length']?_0x3e2f07[_0x1dbd('0x38')]:_0x47dc61[_0x1dbd('0x37')];if(!_0x540299['query'][_0x1dbd('0x3a')](_0x1dbd('0x3b'))){_0x3e2f07['limit']=qs['limit'](_0x540299[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x3e2f07[_0x1dbd('0x1f')]=qs[_0x1dbd('0x1f')](_0x540299['query'][_0x1dbd('0x1f')]);}_0x3e2f07[_0x1dbd('0x3c')]=qs['sort'](_0x540299['query']['sort']);_0x3e2f07[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x540299[_0x1dbd('0x33')],_0x47dc61[_0x1dbd('0x35')]),_0x4910c6);if(_0x540299['query']['filter']){_0x3e2f07[_0x1dbd('0x3d')]=_['merge'](_0x3e2f07[_0x1dbd('0x3d')],{'$or':_[_0x1dbd('0x3f')](_0x4910c6,function(_0x17870b){if(_0x17870b['type']!=='VIRTUAL'){var _0xc0f2d7={};_0xc0f2d7[_0x17870b[_0x1dbd('0x2b')]]={'$like':'%'+_0x540299[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0xc0f2d7;}})});}_0x3e2f07=_['merge']({},_0x3e2f07,_0x540299[_0x1dbd('0x41')]);var _0x4b4a9c={'where':_0x3e2f07[_0x1dbd('0x3d')]};return db[_0x1dbd('0x2e')][_0x1dbd('0x20')](_0x4b4a9c)[_0x1dbd('0x27')](function(_0x4d82e3){_0x398be3['count']=_0x4d82e3;if(_0x540299[_0x1dbd('0x33')][_0x1dbd('0x42')]){_0x3e2f07[_0x1dbd('0x43')]=[{'all':!![]}];}return db[_0x1dbd('0x2e')][_0x1dbd('0x44')](_0x3e2f07);})['then'](function(_0x2ca3c8){_0x398be3[_0x1dbd('0x45')]=_0x2ca3c8;return _0x398be3;})[_0x1dbd('0x27')](respondWithFilteredResult(_0x4fcbfd,_0x3e2f07))[_0x1dbd('0x46')](handleError(_0x4fcbfd,null));};exports[_0x1dbd('0x47')]=function(_0x2ab1e1,_0x530a9b){var _0x1b89ba={'raw':![],'where':{'id':_0x2ab1e1['params']['id']}},_0x32498d={};_0x32498d[_0x1dbd('0x37')]=_['keys'](db['ZendeskConfiguration'][_0x1dbd('0x2f')]);_0x32498d['query']=_[_0x1dbd('0x34')](_0x2ab1e1[_0x1dbd('0x33')]);_0x32498d[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x32498d[_0x1dbd('0x37')],_0x32498d[_0x1dbd('0x33')]);_0x1b89ba[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x32498d[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x2ab1e1[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x1b89ba[_0x1dbd('0x38')]=_0x1b89ba['attributes'][_0x1dbd('0x48')]?_0x1b89ba[_0x1dbd('0x38')]:_0x32498d[_0x1dbd('0x37')];if(_0x2ab1e1[_0x1dbd('0x33')]['includeAll']){_0x1b89ba[_0x1dbd('0x43')]=[{'all':!![]}];}_0x1b89ba=_[_0x1dbd('0x49')]({},_0x1b89ba,_0x2ab1e1[_0x1dbd('0x41')]);return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')](_0x1b89ba)[_0x1dbd('0x27')](handleEntityNotFound(_0x530a9b,null))[_0x1dbd('0x27')](respondWithResult(_0x530a9b,null))['catch'](handleError(_0x530a9b,null));};exports[_0x1dbd('0x4b')]=function(_0x9c581d,_0x277104){return db[_0x1dbd('0x2e')][_0x1dbd('0x4b')](_0x9c581d[_0x1dbd('0x4c')],{})['then'](respondWithResult(_0x277104,0xc9))[_0x1dbd('0x46')](handleError(_0x277104,null));};exports[_0x1dbd('0x26')]=function(_0x18ef48,_0x26ad09){if(_0x18ef48[_0x1dbd('0x4c')]['id']){delete _0x18ef48[_0x1dbd('0x4c')]['id'];}return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')]({'where':{'id':_0x18ef48[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x26ad09,null))['then'](saveUpdates(_0x18ef48[_0x1dbd('0x4c')],null))['then'](respondWithResult(_0x26ad09,null))[_0x1dbd('0x46')](handleError(_0x26ad09,null));};exports[_0x1dbd('0x4e')]=function(_0x53d1c8,_0x20d5aa){return db[_0x1dbd('0x2e')][_0x1dbd('0x4a')]({'where':{'id':_0x53d1c8[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x20d5aa,null))[_0x1dbd('0x27')](removeEntity(_0x20d5aa,null))[_0x1dbd('0x46')](handleError(_0x20d5aa,null));};exports[_0x1dbd('0x4f')]=function(_0x1c47b9,_0x1ece23,_0x4b4bc6){var _0x5896d4={};var _0x4387de={};var _0x463011;var _0x30903d;return db[_0x1dbd('0x2e')]['findOne']({'where':{'id':_0x1c47b9[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x1ece23,null))['then'](function(_0x538103){if(_0x538103){_0x463011=_0x538103;_0x4387de[_0x1dbd('0x37')]=_['keys'](db['ZendeskField'][_0x1dbd('0x2f')]);_0x4387de['query']=_[_0x1dbd('0x34')](_0x1c47b9[_0x1dbd('0x33')]);_0x4387de['filters']=_['intersection'](_0x4387de[_0x1dbd('0x37')],_0x4387de[_0x1dbd('0x33')]);_0x5896d4[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x4387de[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x1c47b9['query'][_0x1dbd('0x39')]));_0x5896d4['attributes']=_0x5896d4[_0x1dbd('0x38')][_0x1dbd('0x48')]?_0x5896d4[_0x1dbd('0x38')]:_0x4387de[_0x1dbd('0x37')];_0x5896d4['order']=qs['sort'](_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0x5896d4[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x1c47b9[_0x1dbd('0x33')],_0x4387de[_0x1dbd('0x35')]));if(_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x40')]){_0x5896d4[_0x1dbd('0x3d')]=_[_0x1dbd('0x49')](_0x5896d4[_0x1dbd('0x3d')],{'$or':_[_0x1dbd('0x3f')](_0x5896d4[_0x1dbd('0x38')],function(_0x1fac49){var _0x41e56a={};_0x41e56a[_0x1fac49]={'$like':'%'+_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0x41e56a;})});}_0x5896d4=_[_0x1dbd('0x49')]({},_0x5896d4,_0x1c47b9['options']);return _0x463011[_0x1dbd('0x4f')](_0x5896d4);}})['then'](function(_0x506e9f){if(_0x506e9f){_0x30903d=_0x506e9f['length'];if(!_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x3a')](_0x1dbd('0x3b'))){_0x5896d4[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x1c47b9[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x5896d4[_0x1dbd('0x1f')]=qs[_0x1dbd('0x1f')](_0x1c47b9['query']['offset']);}return _0x463011[_0x1dbd('0x4f')](_0x5896d4);}})[_0x1dbd('0x27')](function(_0x37f489){if(_0x37f489){return _0x37f489?{'count':_0x30903d,'rows':_0x37f489}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x1ece23,null))[_0x1dbd('0x46')](handleError(_0x1ece23,null));};exports[_0x1dbd('0x51')]=function(_0x5729ac,_0x434972,_0x7d43f4){var _0x14715b={};var _0x1b59f0={};var _0x2a022a;var _0x45336a;return db[_0x1dbd('0x2e')]['findOne']({'where':{'id':_0x5729ac[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x434972,null))[_0x1dbd('0x27')](function(_0x3590e1){if(_0x3590e1){_0x2a022a=_0x3590e1;_0x1b59f0[_0x1dbd('0x37')]=_[_0x1dbd('0x34')](db['ZendeskField'][_0x1dbd('0x2f')]);_0x1b59f0[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x5729ac['query']);_0x1b59f0[_0x1dbd('0x35')]=_['intersection'](_0x1b59f0[_0x1dbd('0x37')],_0x1b59f0[_0x1dbd('0x33')]);_0x14715b[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x1b59f0[_0x1dbd('0x37')],qs['fields'](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x14715b['attributes']=_0x14715b['attributes']['length']?_0x14715b['attributes']:_0x1b59f0[_0x1dbd('0x37')];_0x14715b[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0x14715b[_0x1dbd('0x3d')]=qs['filters'](_[_0x1dbd('0x3e')](_0x5729ac[_0x1dbd('0x33')],_0x1b59f0[_0x1dbd('0x35')]));if(_0x5729ac['query'][_0x1dbd('0x40')]){_0x14715b['where']=_[_0x1dbd('0x49')](_0x14715b['where'],{'$or':_[_0x1dbd('0x3f')](_0x14715b[_0x1dbd('0x38')],function(_0x53a9e0){var _0xa5b72e={};_0xa5b72e[_0x53a9e0]={'$like':'%'+_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0xa5b72e;})});}_0x14715b=_['merge']({},_0x14715b,_0x5729ac[_0x1dbd('0x41')]);return _0x2a022a[_0x1dbd('0x51')](_0x14715b);}})[_0x1dbd('0x27')](function(_0x408a35){if(_0x408a35){_0x45336a=_0x408a35[_0x1dbd('0x48')];if(!_0x5729ac[_0x1dbd('0x33')]['hasOwnProperty'](_0x1dbd('0x3b'))){_0x14715b[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x5729ac[_0x1dbd('0x33')][_0x1dbd('0x1d')]);_0x14715b['offset']=qs[_0x1dbd('0x1f')](_0x5729ac['query'][_0x1dbd('0x1f')]);}return _0x2a022a[_0x1dbd('0x51')](_0x14715b);}})['then'](function(_0x84af42){if(_0x84af42){return _0x84af42?{'count':_0x45336a,'rows':_0x84af42}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x434972,null))[_0x1dbd('0x46')](handleError(_0x434972,null));};exports[_0x1dbd('0x52')]=function(_0x37187a,_0x2bfd5a,_0x1ff6fc){var _0x2e529e={};var _0x2a324f={};var _0x339b8a;var _0xa9e250;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x37187a[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x2bfd5a,null))[_0x1dbd('0x27')](function(_0xd83a7e){if(_0xd83a7e){_0x339b8a=_0xd83a7e;_0x2a324f[_0x1dbd('0x37')]=_[_0x1dbd('0x34')](db[_0x1dbd('0x53')][_0x1dbd('0x2f')]);_0x2a324f['query']=_[_0x1dbd('0x34')](_0x37187a['query']);_0x2a324f[_0x1dbd('0x35')]=_[_0x1dbd('0x36')](_0x2a324f[_0x1dbd('0x37')],_0x2a324f[_0x1dbd('0x33')]);_0x2e529e[_0x1dbd('0x38')]=_[_0x1dbd('0x36')](_0x2a324f[_0x1dbd('0x37')],qs['fields'](_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0x2e529e['attributes']=_0x2e529e['attributes'][_0x1dbd('0x48')]?_0x2e529e[_0x1dbd('0x38')]:_0x2a324f[_0x1dbd('0x37')];_0x2e529e[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x37187a[_0x1dbd('0x33')]['sort']);_0x2e529e[_0x1dbd('0x3d')]=qs[_0x1dbd('0x35')](_[_0x1dbd('0x3e')](_0x37187a[_0x1dbd('0x33')],_0x2a324f[_0x1dbd('0x35')]));if(_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x40')]){_0x2e529e[_0x1dbd('0x3d')]=_[_0x1dbd('0x49')](_0x2e529e[_0x1dbd('0x3d')],{'$or':_['map'](_0x2e529e[_0x1dbd('0x38')],function(_0x67a641){var _0x993613={};_0x993613[_0x67a641]={'$like':'%'+_0x37187a[_0x1dbd('0x33')][_0x1dbd('0x40')]+'%'};return _0x993613;})});}_0x2e529e=_[_0x1dbd('0x49')]({},_0x2e529e,_0x37187a[_0x1dbd('0x41')]);return _0x339b8a[_0x1dbd('0x52')](_0x2e529e);}})['then'](function(_0x49ce62){if(_0x49ce62){_0xa9e250=_0x49ce62[_0x1dbd('0x48')];if(!_0x37187a['query'][_0x1dbd('0x3a')]('nolimit')){_0x2e529e[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x37187a[_0x1dbd('0x33')]['limit']);_0x2e529e['offset']=qs[_0x1dbd('0x1f')](_0x37187a['query'][_0x1dbd('0x1f')]);}return _0x339b8a[_0x1dbd('0x52')](_0x2e529e);}})['then'](function(_0x2488c6){if(_0x2488c6){return _0x2488c6?{'count':_0xa9e250,'rows':_0x2488c6}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x2bfd5a,null))[_0x1dbd('0x46')](handleError(_0x2bfd5a,null));};exports[_0x1dbd('0x54')]=function(_0x586ff5,_0x5cae70,_0x2d06a3){var _0xbefd52={};var _0x9f868a={};var _0x1e8975;var _0x23c5d0;return db[_0x1dbd('0x2e')][_0x1dbd('0x55')]({'where':{'id':_0x586ff5[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x5cae70,null))['then'](function(_0x2b3832){if(_0x2b3832){_0x1e8975=_0x2b3832;_0x9f868a['model']=_[_0x1dbd('0x34')](db[_0x1dbd('0x56')][_0x1dbd('0x2f')]);_0x9f868a[_0x1dbd('0x33')]=_[_0x1dbd('0x34')](_0x586ff5[_0x1dbd('0x33')]);_0x9f868a[_0x1dbd('0x35')]=_['intersection'](_0x9f868a[_0x1dbd('0x37')],_0x9f868a['query']);_0xbefd52['attributes']=_[_0x1dbd('0x36')](_0x9f868a[_0x1dbd('0x37')],qs[_0x1dbd('0x39')](_0x586ff5[_0x1dbd('0x33')][_0x1dbd('0x39')]));_0xbefd52[_0x1dbd('0x38')]=_0xbefd52['attributes'][_0x1dbd('0x48')]?_0xbefd52[_0x1dbd('0x38')]:_0x9f868a['model'];_0xbefd52[_0x1dbd('0x3c')]=qs[_0x1dbd('0x50')](_0x586ff5[_0x1dbd('0x33')][_0x1dbd('0x50')]);_0xbefd52[_0x1dbd('0x3d')]=qs['filters'](_[_0x1dbd('0x3e')](_0x586ff5[_0x1dbd('0x33')],_0x9f868a[_0x1dbd('0x35')]));if(_0x586ff5['query']['filter']){_0xbefd52['where']=_[_0x1dbd('0x49')](_0xbefd52['where'],{'$or':_[_0x1dbd('0x3f')](_0xbefd52[_0x1dbd('0x38')],function(_0x974450){var _0x991213={};_0x991213[_0x974450]={'$like':'%'+_0x586ff5[_0x1dbd('0x33')]['filter']+'%'};return _0x991213;})});}_0xbefd52=_[_0x1dbd('0x49')]({},_0xbefd52,_0x586ff5[_0x1dbd('0x41')]);return _0x1e8975['getTags'](_0xbefd52);}})['then'](function(_0x3392a0){if(_0x3392a0){_0x23c5d0=_0x3392a0[_0x1dbd('0x48')];if(!_0x586ff5['query'][_0x1dbd('0x3a')]('nolimit')){_0xbefd52[_0x1dbd('0x1d')]=qs[_0x1dbd('0x1d')](_0x586ff5['query']['limit']);_0xbefd52['offset']=qs[_0x1dbd('0x1f')](_0x586ff5[_0x1dbd('0x33')]['offset']);}return _0x1e8975[_0x1dbd('0x54')](_0xbefd52);}})['then'](function(_0x22ecff){if(_0x22ecff){return _0x22ecff?{'count':_0x23c5d0,'rows':_0x22ecff}:null;}})[_0x1dbd('0x27')](respondWithResult(_0x5cae70,null))[_0x1dbd('0x46')](handleError(_0x5cae70,null));};exports['setTags']=function(_0x30a005,_0x32dc0b,_0x279f3f){if(_0x30a005[_0x1dbd('0x4c')]['id']){delete _0x30a005['body']['id'];}return db[_0x1dbd('0x2e')][_0x1dbd('0x55')]({'where':{'id':_0x30a005[_0x1dbd('0x4d')]['id']}})[_0x1dbd('0x27')](handleEntityNotFound(_0x32dc0b,null))['then'](function(_0x353e76){if(_0x353e76){return _0x353e76['setTags'](_0x30a005[_0x1dbd('0x4c')][_0x1dbd('0x57')]||[]);}return null;})[_0x1dbd('0x27')](respondWithResult(_0x32dc0b,null))[_0x1dbd('0x46')](handleError(_0x32dc0b,null));}; \ No newline at end of file +var _0x43de=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0x43de,0x18c));var _0xe43d=function(_0x2177d6,_0x49a796){_0x2177d6=_0x2177d6-0x0;var _0x45562b=_0x43de[_0x2177d6];return _0x45562b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe43d('0x0'));var zipdir=require(_0xe43d('0x1'));var jsonpatch=require(_0xe43d('0x2'));var rp=require(_0xe43d('0x3'));var moment=require(_0xe43d('0x4'));var BPromise=require(_0xe43d('0x5'));var Mustache=require(_0xe43d('0x6'));var util=require(_0xe43d('0x7'));var path=require(_0xe43d('0x8'));var sox=require(_0xe43d('0x9'));var csv=require(_0xe43d('0xa'));var ejs=require(_0xe43d('0xb'));var fs=require('fs');var fs_extra=require(_0xe43d('0xc'));var _=require('lodash');var squel=require(_0xe43d('0xd'));var crypto=require(_0xe43d('0xe'));var jsforce=require(_0xe43d('0xf'));var deskjs=require(_0xe43d('0x10'));var toCsv=require(_0xe43d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe43d('0x11'));var authService=require(_0xe43d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe43d('0x13'));var hardwareService=require(_0xe43d('0x14'));var logger=require('../../config/logger')(_0xe43d('0x15'));var utils=require('../../config/utils');var config=require(_0xe43d('0x16'));var licenseUtil=require(_0xe43d('0x17'));var db=require(_0xe43d('0x18'))['db'];function respondWithStatusCode(_0x3e2683,_0x326cdb){_0x326cdb=_0x326cdb||0xcc;return function(_0x2aee86){if(_0x2aee86){return _0x3e2683[_0xe43d('0x19')](_0x326cdb);}return _0x3e2683[_0xe43d('0x1a')](_0x326cdb)[_0xe43d('0x1b')]();};}function respondWithResult(_0x599076,_0x31cbf6){_0x31cbf6=_0x31cbf6||0xc8;return function(_0x52f3db){if(_0x52f3db){return _0x599076['status'](_0x31cbf6)[_0xe43d('0x1c')](_0x52f3db);}};}function respondWithFilteredResult(_0x331a6d,_0x45b33b){return function(_0x454560){if(_0x454560){var _0x577940=typeof _0x45b33b[_0xe43d('0x1d')]===_0xe43d('0x1e')&&typeof _0x45b33b[_0xe43d('0x1f')]===_0xe43d('0x1e');var _0x98be04=_0x454560['count'];var _0x4b589f=_0x577940?0x0:_0x45b33b[_0xe43d('0x1d')];var _0x45452a=_0x577940?_0x454560[_0xe43d('0x20')]:_0x45b33b['offset']+_0x45b33b[_0xe43d('0x1f')];var _0x1adb26;if(_0x45452a>=_0x98be04){_0x45452a=_0x98be04;_0x1adb26=0xc8;}else{_0x1adb26=0xce;}_0x331a6d[_0xe43d('0x1a')](_0x1adb26);return _0x331a6d[_0xe43d('0x21')](_0xe43d('0x22'),_0x4b589f+'-'+_0x45452a+'/'+_0x98be04)[_0xe43d('0x1c')](_0x454560);}return null;};}function patchUpdates(_0x8a03d8){return function(_0x371f1f){try{jsonpatch[_0xe43d('0x23')](_0x371f1f,_0x8a03d8,!![]);}catch(_0x23e1f9){return BPromise[_0xe43d('0x24')](_0x23e1f9);}return _0x371f1f['save']();};}function saveUpdates(_0x4ee324,_0x5b4b4a){return function(_0x2e3c2f){if(_0x2e3c2f){return _0x2e3c2f[_0xe43d('0x25')](_0x4ee324)[_0xe43d('0x26')](function(_0x1ec1dc){return _0x1ec1dc;});}return null;};}function removeEntity(_0x27ed6a,_0x132de3){return function(_0x1d0193){if(_0x1d0193){return _0x1d0193[_0xe43d('0x27')]()['then'](function(){_0x27ed6a[_0xe43d('0x1a')](0xcc)[_0xe43d('0x1b')]();});}};}function handleEntityNotFound(_0x1fe390,_0x298637){return function(_0x41848d){if(!_0x41848d){_0x1fe390['sendStatus'](0x194);}return _0x41848d;};}function handleError(_0x76e245,_0x2cebb5){_0x2cebb5=_0x2cebb5||0x1f4;return function(_0x4017f9){logger['error'](_0x4017f9['stack']);if(_0x4017f9[_0xe43d('0x28')]){delete _0x4017f9[_0xe43d('0x28')];}_0x76e245[_0xe43d('0x1a')](_0x2cebb5)[_0xe43d('0x29')](_0x4017f9);};}exports[_0xe43d('0x2a')]=function(_0x44f38f,_0x198ecf){var _0x106db2={},_0x4964e0={},_0x1d8f65={'count':0x0,'rows':[]};var _0x3a50f6=_[_0xe43d('0x2b')](db[_0xe43d('0x2c')][_0xe43d('0x2d')],function(_0x1d7116){return{'name':_0x1d7116['fieldName'],'type':_0x1d7116['type'][_0xe43d('0x2e')]};});_0x4964e0[_0xe43d('0x2f')]=_[_0xe43d('0x2b')](_0x3a50f6,'name');_0x4964e0['query']=_[_0xe43d('0x30')](_0x44f38f['query']);_0x4964e0['filters']=_['intersection'](_0x4964e0[_0xe43d('0x2f')],_0x4964e0[_0xe43d('0x31')]);_0x106db2[_0xe43d('0x32')]=_[_0xe43d('0x33')](_0x4964e0[_0xe43d('0x2f')],qs['fields'](_0x44f38f[_0xe43d('0x31')][_0xe43d('0x34')]));_0x106db2['attributes']=_0x106db2[_0xe43d('0x32')][_0xe43d('0x35')]?_0x106db2[_0xe43d('0x32')]:_0x4964e0['model'];if(!_0x44f38f['query'][_0xe43d('0x36')](_0xe43d('0x37'))){_0x106db2[_0xe43d('0x1f')]=qs[_0xe43d('0x1f')](_0x44f38f['query'][_0xe43d('0x1f')]);_0x106db2[_0xe43d('0x1d')]=qs['offset'](_0x44f38f[_0xe43d('0x31')][_0xe43d('0x1d')]);}_0x106db2['order']=qs[_0xe43d('0x38')](_0x44f38f[_0xe43d('0x31')][_0xe43d('0x38')]);_0x106db2[_0xe43d('0x39')]=qs['filters'](_[_0xe43d('0x3a')](_0x44f38f['query'],_0x4964e0[_0xe43d('0x3b')]),_0x3a50f6);if(_0x44f38f[_0xe43d('0x31')]['filter']){_0x106db2[_0xe43d('0x39')]=_[_0xe43d('0x3c')](_0x106db2['where'],{'$or':_[_0xe43d('0x2b')](_0x3a50f6,function(_0x30a4b7){if(_0x30a4b7['type']!==_0xe43d('0x3d')){var _0x15a625={};_0x15a625[_0x30a4b7['name']]={'$like':'%'+_0x44f38f[_0xe43d('0x31')][_0xe43d('0x3e')]+'%'};return _0x15a625;}})});}_0x106db2=_['merge']({},_0x106db2,_0x44f38f[_0xe43d('0x3f')]);var _0x622123={'where':_0x106db2[_0xe43d('0x39')]};return db[_0xe43d('0x2c')]['count'](_0x622123)[_0xe43d('0x26')](function(_0x43d3ad){_0x1d8f65[_0xe43d('0x20')]=_0x43d3ad;if(_0x44f38f[_0xe43d('0x31')][_0xe43d('0x40')]){_0x106db2[_0xe43d('0x41')]=[{'all':!![]}];}return db[_0xe43d('0x2c')][_0xe43d('0x42')](_0x106db2);})[_0xe43d('0x26')](function(_0x4cdc40){_0x1d8f65[_0xe43d('0x43')]=_0x4cdc40;return _0x1d8f65;})['then'](respondWithFilteredResult(_0x198ecf,_0x106db2))[_0xe43d('0x44')](handleError(_0x198ecf,null));};exports['show']=function(_0x21a717,_0x151e26){var _0x454e48={'raw':![],'where':{'id':_0x21a717[_0xe43d('0x45')]['id']}},_0x5224d7={};_0x5224d7[_0xe43d('0x2f')]=_[_0xe43d('0x30')](db[_0xe43d('0x2c')][_0xe43d('0x2d')]);_0x5224d7[_0xe43d('0x31')]=_['keys'](_0x21a717[_0xe43d('0x31')]);_0x5224d7[_0xe43d('0x3b')]=_['intersection'](_0x5224d7[_0xe43d('0x2f')],_0x5224d7[_0xe43d('0x31')]);_0x454e48[_0xe43d('0x32')]=_[_0xe43d('0x33')](_0x5224d7[_0xe43d('0x2f')],qs[_0xe43d('0x34')](_0x21a717['query'][_0xe43d('0x34')]));_0x454e48[_0xe43d('0x32')]=_0x454e48[_0xe43d('0x32')][_0xe43d('0x35')]?_0x454e48[_0xe43d('0x32')]:_0x5224d7['model'];if(_0x21a717['query'][_0xe43d('0x40')]){_0x454e48[_0xe43d('0x41')]=[{'all':!![]}];}_0x454e48=_[_0xe43d('0x3c')]({},_0x454e48,_0x21a717['options']);return db[_0xe43d('0x2c')][_0xe43d('0x46')](_0x454e48)[_0xe43d('0x26')](handleEntityNotFound(_0x151e26,null))[_0xe43d('0x26')](respondWithResult(_0x151e26,null))[_0xe43d('0x44')](handleError(_0x151e26,null));};exports[_0xe43d('0x47')]=function(_0x30f314,_0x245008){return db['ZendeskConfiguration'][_0xe43d('0x47')](_0x30f314['body'],{})[_0xe43d('0x26')](respondWithResult(_0x245008,0xc9))['catch'](handleError(_0x245008,null));};exports[_0xe43d('0x25')]=function(_0x2e606f,_0x128ebf){if(_0x2e606f[_0xe43d('0x48')]['id']){delete _0x2e606f[_0xe43d('0x48')]['id'];}return db[_0xe43d('0x2c')][_0xe43d('0x46')]({'where':{'id':_0x2e606f[_0xe43d('0x45')]['id']}})[_0xe43d('0x26')](handleEntityNotFound(_0x128ebf,null))[_0xe43d('0x26')](saveUpdates(_0x2e606f[_0xe43d('0x48')],null))[_0xe43d('0x26')](respondWithResult(_0x128ebf,null))['catch'](handleError(_0x128ebf,null));};exports[_0xe43d('0x27')]=function(_0x57ece3,_0x27aebe){return db[_0xe43d('0x2c')][_0xe43d('0x46')]({'where':{'id':_0x57ece3[_0xe43d('0x45')]['id']}})[_0xe43d('0x26')](handleEntityNotFound(_0x27aebe,null))['then'](removeEntity(_0x27aebe,null))[_0xe43d('0x44')](handleError(_0x27aebe,null));};exports[_0xe43d('0x49')]=function(_0xd92b57,_0x254a26,_0x433f88){var _0x573176={};var _0x7d4c08={};var _0x2b3777;var _0x2243c2;return db['ZendeskConfiguration'][_0xe43d('0x4a')]({'where':{'id':_0xd92b57[_0xe43d('0x45')]['id']}})['then'](handleEntityNotFound(_0x254a26,null))[_0xe43d('0x26')](function(_0x47ce07){if(_0x47ce07){_0x2b3777=_0x47ce07;_0x7d4c08['model']=_[_0xe43d('0x30')](db[_0xe43d('0x4b')]['rawAttributes']);_0x7d4c08[_0xe43d('0x31')]=_[_0xe43d('0x30')](_0xd92b57[_0xe43d('0x31')]);_0x7d4c08['filters']=_['intersection'](_0x7d4c08[_0xe43d('0x2f')],_0x7d4c08[_0xe43d('0x31')]);_0x573176[_0xe43d('0x32')]=_[_0xe43d('0x33')](_0x7d4c08[_0xe43d('0x2f')],qs['fields'](_0xd92b57[_0xe43d('0x31')]['fields']));_0x573176[_0xe43d('0x32')]=_0x573176[_0xe43d('0x32')][_0xe43d('0x35')]?_0x573176['attributes']:_0x7d4c08['model'];_0x573176[_0xe43d('0x4c')]=qs['sort'](_0xd92b57['query']['sort']);_0x573176[_0xe43d('0x39')]=qs[_0xe43d('0x3b')](_[_0xe43d('0x3a')](_0xd92b57[_0xe43d('0x31')],_0x7d4c08[_0xe43d('0x3b')]));if(_0xd92b57[_0xe43d('0x31')][_0xe43d('0x3e')]){_0x573176[_0xe43d('0x39')]=_[_0xe43d('0x3c')](_0x573176[_0xe43d('0x39')],{'$or':_['map'](_0x573176[_0xe43d('0x32')],function(_0x590b69){var _0x42e9bf={};_0x42e9bf[_0x590b69]={'$like':'%'+_0xd92b57[_0xe43d('0x31')]['filter']+'%'};return _0x42e9bf;})});}_0x573176=_['merge']({},_0x573176,_0xd92b57['options']);return _0x2b3777[_0xe43d('0x49')](_0x573176);}})['then'](function(_0x55f073){if(_0x55f073){_0x2243c2=_0x55f073[_0xe43d('0x35')];if(!_0xd92b57['query'][_0xe43d('0x36')](_0xe43d('0x37'))){_0x573176[_0xe43d('0x1f')]=qs[_0xe43d('0x1f')](_0xd92b57['query'][_0xe43d('0x1f')]);_0x573176['offset']=qs[_0xe43d('0x1d')](_0xd92b57[_0xe43d('0x31')][_0xe43d('0x1d')]);}return _0x2b3777['getFields'](_0x573176);}})[_0xe43d('0x26')](function(_0x232db6){if(_0x232db6){return _0x232db6?{'count':_0x2243c2,'rows':_0x232db6}:null;}})[_0xe43d('0x26')](respondWithResult(_0x254a26,null))['catch'](handleError(_0x254a26,null));};exports[_0xe43d('0x4d')]=function(_0x418351,_0x5d0a76,_0x4c1801){var _0x1d4232={};var _0x324634={};var _0x41d5b1;var _0x302ae4;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x418351['params']['id']}})[_0xe43d('0x26')](handleEntityNotFound(_0x5d0a76,null))[_0xe43d('0x26')](function(_0x12dc8a){if(_0x12dc8a){_0x41d5b1=_0x12dc8a;_0x324634[_0xe43d('0x2f')]=_[_0xe43d('0x30')](db[_0xe43d('0x4b')][_0xe43d('0x2d')]);_0x324634[_0xe43d('0x31')]=_[_0xe43d('0x30')](_0x418351[_0xe43d('0x31')]);_0x324634[_0xe43d('0x3b')]=_[_0xe43d('0x33')](_0x324634[_0xe43d('0x2f')],_0x324634[_0xe43d('0x31')]);_0x1d4232[_0xe43d('0x32')]=_[_0xe43d('0x33')](_0x324634[_0xe43d('0x2f')],qs['fields'](_0x418351[_0xe43d('0x31')][_0xe43d('0x34')]));_0x1d4232[_0xe43d('0x32')]=_0x1d4232[_0xe43d('0x32')]['length']?_0x1d4232['attributes']:_0x324634[_0xe43d('0x2f')];_0x1d4232[_0xe43d('0x4c')]=qs[_0xe43d('0x38')](_0x418351[_0xe43d('0x31')][_0xe43d('0x38')]);_0x1d4232[_0xe43d('0x39')]=qs['filters'](_['pick'](_0x418351[_0xe43d('0x31')],_0x324634[_0xe43d('0x3b')]));if(_0x418351[_0xe43d('0x31')][_0xe43d('0x3e')]){_0x1d4232[_0xe43d('0x39')]=_['merge'](_0x1d4232['where'],{'$or':_[_0xe43d('0x2b')](_0x1d4232[_0xe43d('0x32')],function(_0x42f873){var _0x4f017f={};_0x4f017f[_0x42f873]={'$like':'%'+_0x418351['query']['filter']+'%'};return _0x4f017f;})});}_0x1d4232=_[_0xe43d('0x3c')]({},_0x1d4232,_0x418351[_0xe43d('0x3f')]);return _0x41d5b1['getSubjects'](_0x1d4232);}})['then'](function(_0x4133d8){if(_0x4133d8){_0x302ae4=_0x4133d8[_0xe43d('0x35')];if(!_0x418351[_0xe43d('0x31')][_0xe43d('0x36')](_0xe43d('0x37'))){_0x1d4232[_0xe43d('0x1f')]=qs['limit'](_0x418351[_0xe43d('0x31')][_0xe43d('0x1f')]);_0x1d4232[_0xe43d('0x1d')]=qs['offset'](_0x418351[_0xe43d('0x31')][_0xe43d('0x1d')]);}return _0x41d5b1[_0xe43d('0x4d')](_0x1d4232);}})[_0xe43d('0x26')](function(_0x2402d3){if(_0x2402d3){return _0x2402d3?{'count':_0x302ae4,'rows':_0x2402d3}:null;}})[_0xe43d('0x26')](respondWithResult(_0x5d0a76,null))[_0xe43d('0x44')](handleError(_0x5d0a76,null));};exports[_0xe43d('0x4e')]=function(_0x4c51cc,_0x3b6075,_0x14b8b1){var _0x10f21d={};var _0x4cf948={};var _0x3d3180;var _0x1339a2;return db['ZendeskConfiguration'][_0xe43d('0x4a')]({'where':{'id':_0x4c51cc[_0xe43d('0x45')]['id']}})[_0xe43d('0x26')](handleEntityNotFound(_0x3b6075,null))[_0xe43d('0x26')](function(_0x59913a){if(_0x59913a){_0x3d3180=_0x59913a;_0x4cf948['model']=_[_0xe43d('0x30')](db[_0xe43d('0x4b')][_0xe43d('0x2d')]);_0x4cf948[_0xe43d('0x31')]=_[_0xe43d('0x30')](_0x4c51cc['query']);_0x4cf948['filters']=_[_0xe43d('0x33')](_0x4cf948['model'],_0x4cf948[_0xe43d('0x31')]);_0x10f21d[_0xe43d('0x32')]=_['intersection'](_0x4cf948[_0xe43d('0x2f')],qs[_0xe43d('0x34')](_0x4c51cc[_0xe43d('0x31')][_0xe43d('0x34')]));_0x10f21d[_0xe43d('0x32')]=_0x10f21d['attributes'][_0xe43d('0x35')]?_0x10f21d[_0xe43d('0x32')]:_0x4cf948[_0xe43d('0x2f')];_0x10f21d[_0xe43d('0x4c')]=qs[_0xe43d('0x38')](_0x4c51cc['query'][_0xe43d('0x38')]);_0x10f21d[_0xe43d('0x39')]=qs['filters'](_['pick'](_0x4c51cc[_0xe43d('0x31')],_0x4cf948['filters']));if(_0x4c51cc[_0xe43d('0x31')][_0xe43d('0x3e')]){_0x10f21d['where']=_[_0xe43d('0x3c')](_0x10f21d[_0xe43d('0x39')],{'$or':_[_0xe43d('0x2b')](_0x10f21d[_0xe43d('0x32')],function(_0x6470f7){var _0x3047fb={};_0x3047fb[_0x6470f7]={'$like':'%'+_0x4c51cc[_0xe43d('0x31')]['filter']+'%'};return _0x3047fb;})});}_0x10f21d=_[_0xe43d('0x3c')]({},_0x10f21d,_0x4c51cc[_0xe43d('0x3f')]);return _0x3d3180[_0xe43d('0x4e')](_0x10f21d);}})[_0xe43d('0x26')](function(_0x1be1d6){if(_0x1be1d6){_0x1339a2=_0x1be1d6[_0xe43d('0x35')];if(!_0x4c51cc[_0xe43d('0x31')][_0xe43d('0x36')](_0xe43d('0x37'))){_0x10f21d['limit']=qs[_0xe43d('0x1f')](_0x4c51cc['query'][_0xe43d('0x1f')]);_0x10f21d[_0xe43d('0x1d')]=qs['offset'](_0x4c51cc[_0xe43d('0x31')][_0xe43d('0x1d')]);}return _0x3d3180[_0xe43d('0x4e')](_0x10f21d);}})[_0xe43d('0x26')](function(_0x58b366){if(_0x58b366){return _0x58b366?{'count':_0x1339a2,'rows':_0x58b366}:null;}})[_0xe43d('0x26')](respondWithResult(_0x3b6075,null))[_0xe43d('0x44')](handleError(_0x3b6075,null));};exports['getTags']=function(_0x1c6c9b,_0x20e04e,_0x2ae8a5){var _0x4b940d={};var _0x3b50e5={};var _0x3e04b7;var _0xb7844a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1c6c9b['params']['id']}})['then'](handleEntityNotFound(_0x20e04e,null))[_0xe43d('0x26')](function(_0x3269d0){if(_0x3269d0){_0x3e04b7=_0x3269d0;_0x3b50e5['model']=_[_0xe43d('0x30')](db['Tag']['rawAttributes']);_0x3b50e5['query']=_['keys'](_0x1c6c9b['query']);_0x3b50e5[_0xe43d('0x3b')]=_[_0xe43d('0x33')](_0x3b50e5[_0xe43d('0x2f')],_0x3b50e5[_0xe43d('0x31')]);_0x4b940d[_0xe43d('0x32')]=_['intersection'](_0x3b50e5[_0xe43d('0x2f')],qs[_0xe43d('0x34')](_0x1c6c9b[_0xe43d('0x31')]['fields']));_0x4b940d[_0xe43d('0x32')]=_0x4b940d[_0xe43d('0x32')][_0xe43d('0x35')]?_0x4b940d[_0xe43d('0x32')]:_0x3b50e5['model'];_0x4b940d[_0xe43d('0x4c')]=qs[_0xe43d('0x38')](_0x1c6c9b[_0xe43d('0x31')][_0xe43d('0x38')]);_0x4b940d[_0xe43d('0x39')]=qs[_0xe43d('0x3b')](_[_0xe43d('0x3a')](_0x1c6c9b[_0xe43d('0x31')],_0x3b50e5['filters']));if(_0x1c6c9b[_0xe43d('0x31')]['filter']){_0x4b940d[_0xe43d('0x39')]=_[_0xe43d('0x3c')](_0x4b940d['where'],{'$or':_[_0xe43d('0x2b')](_0x4b940d[_0xe43d('0x32')],function(_0x21e552){var _0x3fdbd1={};_0x3fdbd1[_0x21e552]={'$like':'%'+_0x1c6c9b[_0xe43d('0x31')][_0xe43d('0x3e')]+'%'};return _0x3fdbd1;})});}_0x4b940d=_[_0xe43d('0x3c')]({},_0x4b940d,_0x1c6c9b[_0xe43d('0x3f')]);return _0x3e04b7[_0xe43d('0x4f')](_0x4b940d);}})['then'](function(_0x18effb){if(_0x18effb){_0xb7844a=_0x18effb[_0xe43d('0x35')];if(!_0x1c6c9b[_0xe43d('0x31')][_0xe43d('0x36')](_0xe43d('0x37'))){_0x4b940d[_0xe43d('0x1f')]=qs['limit'](_0x1c6c9b[_0xe43d('0x31')][_0xe43d('0x1f')]);_0x4b940d['offset']=qs[_0xe43d('0x1d')](_0x1c6c9b[_0xe43d('0x31')]['offset']);}return _0x3e04b7[_0xe43d('0x4f')](_0x4b940d);}})[_0xe43d('0x26')](function(_0x145a1d){if(_0x145a1d){return _0x145a1d?{'count':_0xb7844a,'rows':_0x145a1d}:null;}})[_0xe43d('0x26')](respondWithResult(_0x20e04e,null))[_0xe43d('0x44')](handleError(_0x20e04e,null));};exports['setTags']=function(_0x18926b,_0x3ddb6b,_0x2b0f2a){if(_0x18926b['body']['id']){delete _0x18926b[_0xe43d('0x48')]['id'];}return db[_0xe43d('0x2c')]['findOne']({'where':{'id':_0x18926b[_0xe43d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ddb6b,null))[_0xe43d('0x26')](function(_0x1bab01){if(_0x1bab01){return _0x1bab01[_0xe43d('0x50')](_0x18926b[_0xe43d('0x48')][_0xe43d('0x51')]||[]);}return null;})[_0xe43d('0x26')](respondWithResult(_0x3ddb6b,null))['catch'](handleError(_0x3ddb6b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 7abb63e..d125efe 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x4fc2,0x111));var _0x24fc=function(_0x5b50ae,_0x7da7e1){_0x5b50ae=_0x5b50ae-0x0;var _0x84eb56=_0x4fc2[_0x5b50ae];return _0x84eb56;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','api'];(function(_0x56bd7e,_0x3a7c22){var _0x4ab1bd=function(_0x3f8d9d){while(--_0x3f8d9d){_0x56bd7e['push'](_0x56bd7e['shift']());}};_0x4ab1bd(++_0x3a7c22);}(_0xe511,0x16f));var _0x1e51=function(_0x461546,_0x152a89){_0x461546=_0x461546-0x0;var _0xf9e527=_0xe511[_0x461546];return _0xf9e527;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 99da466..0f07703 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 _0xc099=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','ioredis','../../config/utils','../../config/logger'];(function(_0x298510,_0x122dcc){var _0xaf1de9=function(_0x3cced9){while(--_0x3cced9){_0x298510['push'](_0x298510['shift']());}};_0xaf1de9(++_0x122dcc);}(_0xc099,0x18c));var _0x9c09=function(_0x1c8d31,_0x53a36d){_0x1c8d31=_0x1c8d31-0x0;var _0x3cf0f7=_0xc099[_0x1c8d31];return _0x3cf0f7;};'use strict';var _=require('lodash');var util=require(_0x9c09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c09('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c09('0x2'));var logger=require(_0x9c09('0x3'))(_0x9c09('0x4'));var config=require(_0x9c09('0x5'));var jayson=require(_0x9c09('0x6'));var client=jayson[_0x9c09('0x7')][_0x9c09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e5d1b,_0x445e24,_0x34bf09){return new BPromise(function(_0x511df0,_0x244518){return client[_0x9c09('0x9')](_0x3e5d1b,_0x34bf09)[_0x9c09('0xa')](function(_0x5cf60a){logger[_0x9c09('0xb')](_0x9c09('0xc'),_0x445e24,'request\x20sent');logger[_0x9c09('0xd')](_0x9c09('0xe'),_0x445e24,_0x9c09('0xf'),JSON['stringify'](_0x5cf60a));if(_0x5cf60a[_0x9c09('0x10')]){if(_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x11')]===0x1f4){logger[_0x9c09('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);return _0x244518(_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);}logger[_0x9c09('0x10')](_0x9c09('0xc'),_0x445e24,_0x5cf60a[_0x9c09('0x10')][_0x9c09('0x12')]);return _0x511df0(_0x5cf60a['error'][_0x9c09('0x12')]);}else{logger[_0x9c09('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x9c09('0xf'));_0x511df0(_0x5cf60a['result'][_0x9c09('0x12')]);}})[_0x9c09('0x13')](function(_0x103100){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x445e24,_0x103100);_0x244518(_0x103100);});});} \ No newline at end of file +var _0xbdbf=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x2d8b49,_0x267614){var _0xf4cb7=function(_0x2990b2){while(--_0x2990b2){_0x2d8b49['push'](_0x2d8b49['shift']());}};_0xf4cb7(++_0x267614);}(_0xbdbf,0x8b));var _0xfbdb=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xbdbf[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0xfbdb('0x0'));var util=require(_0xfbdb('0x1'));var moment=require('moment');var BPromise=require(_0xfbdb('0x2'));var rs=require(_0xfbdb('0x3'));var fs=require('fs');var Redis=require(_0xfbdb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbdb('0x5'));var logger=require(_0xfbdb('0x6'))(_0xfbdb('0x7'));var config=require(_0xfbdb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfbdb('0x9')][_0xfbdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fbdc1,_0x10b561,_0x329af9){return new BPromise(function(_0x3ce6ca,_0x101f84){return client[_0xfbdb('0xb')](_0x4fbdc1,_0x329af9)[_0xfbdb('0xc')](function(_0xce60d9){logger['info'](_0xfbdb('0xd'),_0x10b561,_0xfbdb('0xe'));logger[_0xfbdb('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x10b561,_0xfbdb('0xe'),JSON[_0xfbdb('0x10')](_0xce60d9));if(_0xce60d9[_0xfbdb('0x11')]){if(_0xce60d9[_0xfbdb('0x11')][_0xfbdb('0x12')]===0x1f4){logger[_0xfbdb('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x10b561,_0xce60d9[_0xfbdb('0x11')][_0xfbdb('0x13')]);return _0x101f84(_0xce60d9[_0xfbdb('0x11')]['message']);}logger[_0xfbdb('0x11')](_0xfbdb('0xd'),_0x10b561,_0xce60d9[_0xfbdb('0x11')][_0xfbdb('0x13')]);return _0x3ce6ca(_0xce60d9['error']['message']);}else{logger[_0xfbdb('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x10b561,'request\x20sent');_0x3ce6ca(_0xce60d9[_0xfbdb('0x15')][_0xfbdb('0x13')]);}})[_0xfbdb('0x16')](function(_0x2e25ba){logger[_0xfbdb('0x11')](_0xfbdb('0xd'),_0x10b561,_0x2e25ba);_0x101f84(_0x2e25ba);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3a24170..887219d 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 _0x2855=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','multer','util','connect-timeout','Router'];(function(_0x53e699,_0xca858d){var _0x16e570=function(_0x2163a1){while(--_0x2163a1){_0x53e699['push'](_0x53e699['shift']());}};_0x16e570(++_0xca858d);}(_0x2855,0x95));var _0x5285=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x2855[_0x4d1ee9];return _0x9a5456;};'use strict';var multer=require(_0x5285('0x0'));var util=require(_0x5285('0x1'));var path=require('path');var timeout=require(_0x5285('0x2'));var express=require('express');var router=express[_0x5285('0x3')]();var fs_extra=require(_0x5285('0x4'));var auth=require(_0x5285('0x5'));var interaction=require(_0x5285('0x6'));var config=require(_0x5285('0x7'));var controller=require(_0x5285('0x8'));router[_0x5285('0x9')]('/',auth[_0x5285('0xa')](),controller[_0x5285('0xb')]);router[_0x5285('0x9')](_0x5285('0xc'),auth[_0x5285('0xa')](),controller[_0x5285('0xd')]);router[_0x5285('0xe')]('/',auth[_0x5285('0xa')](),controller[_0x5285('0xf')]);router['put'](_0x5285('0xc'),auth[_0x5285('0xa')](),controller['update']);router[_0x5285('0x10')]('/:id',auth[_0x5285('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x342c=['index','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x578ed7,_0x3ea733){var _0x359e82=function(_0x3c815d){while(--_0x3c815d){_0x578ed7['push'](_0x578ed7['shift']());}};_0x359e82(++_0x3ea733);}(_0x342c,0x170));var _0xc342=function(_0x5afdb0,_0x391751){_0x5afdb0=_0x5afdb0-0x0;var _0x55d400=_0x342c[_0x5afdb0];return _0x55d400;};'use strict';var multer=require(_0xc342('0x0'));var util=require('util');var path=require(_0xc342('0x1'));var timeout=require(_0xc342('0x2'));var express=require(_0xc342('0x3'));var router=express['Router']();var fs_extra=require(_0xc342('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc342('0x5'));var config=require(_0xc342('0x6'));var controller=require(_0xc342('0x7'));router[_0xc342('0x8')]('/',auth[_0xc342('0x9')](),controller[_0xc342('0xa')]);router[_0xc342('0x8')](_0xc342('0xb'),auth[_0xc342('0x9')](),controller[_0xc342('0xc')]);router[_0xc342('0xd')]('/',auth[_0xc342('0x9')](),controller['create']);router[_0xc342('0xe')](_0xc342('0xb'),auth[_0xc342('0x9')](),controller[_0xc342('0xf')]);router[_0xc342('0x10')](_0xc342('0xb'),auth[_0xc342('0x9')](),controller['destroy']);module[_0xc342('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0eee9cd..577c393 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 _0xb618=['ENUM','customVariable','keyValue','STRING','string','BOOLEAN','sequelize'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xb618,0x180));var _0x8b61=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0xb618[_0x608e20];return _0x5f498a;};'use strict';var Sequelize=require(_0x8b61('0x0'));module['exports']={'type':{'type':Sequelize[_0x8b61('0x1')]('string','variable',_0x8b61('0x2'),_0x8b61('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b61('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b61('0x5'),'variable',_0x8b61('0x2'))},'keyContent':{'type':Sequelize[_0x8b61('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b61('0x4')]},'customField':{'type':Sequelize[_0x8b61('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b61('0x4')]}}; \ No newline at end of file +var _0x37e2=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x576d1d,_0x44b457){var _0x56ad86=function(_0xdf7f0d){while(--_0xdf7f0d){_0x576d1d['push'](_0x576d1d['shift']());}};_0x56ad86(++_0x44b457);}(_0x37e2,0x76));var _0x237e=function(_0x280448,_0x299f26){_0x280448=_0x280448-0x0;var _0xa421cf=_0x37e2[_0x280448];return _0xa421cf;};'use strict';var Sequelize=require(_0x237e('0x0'));module[_0x237e('0x1')]={'type':{'type':Sequelize[_0x237e('0x2')]('string',_0x237e('0x3'),_0x237e('0x4'),_0x237e('0x5'),'picklist'),'defaultValue':_0x237e('0x6')},'content':{'type':Sequelize[_0x237e('0x7')]},'key':{'type':Sequelize[_0x237e('0x7')]},'keyType':{'type':Sequelize[_0x237e('0x2')](_0x237e('0x6'),'variable',_0x237e('0x4'))},'keyContent':{'type':Sequelize[_0x237e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x237e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index df0ecb5..3a0308a 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 _0x5493=['count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskField','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit'];(function(_0x2274d7,_0x466a90){var _0x4ad3fa=function(_0x3f595c){while(--_0x3f595c){_0x2274d7['push'](_0x2274d7['shift']());}};_0x4ad3fa(++_0x466a90);}(_0x5493,0x1ae));var _0x3549=function(_0x23ae03,_0x373bd7){_0x23ae03=_0x23ae03-0x0;var _0x320c15=_0x5493[_0x23ae03];return _0x320c15;};'use strict';var emlformat=require(_0x3549('0x0'));var rimraf=require(_0x3549('0x1'));var zipdir=require(_0x3549('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3549('0x3'));var BPromise=require(_0x3549('0x4'));var Mustache=require(_0x3549('0x5'));var util=require(_0x3549('0x6'));var path=require(_0x3549('0x7'));var sox=require(_0x3549('0x8'));var csv=require(_0x3549('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3549('0xa'));var _=require(_0x3549('0xb'));var squel=require('squel');var crypto=require(_0x3549('0xc'));var jsforce=require(_0x3549('0xd'));var deskjs=require(_0x3549('0xe'));var toCsv=require(_0x3549('0x9'));var querystring=require(_0x3549('0xf'));var Papa=require(_0x3549('0x10'));var Redis=require(_0x3549('0x11'));var authService=require(_0x3549('0x12'));var qs=require(_0x3549('0x13'));var as=require(_0x3549('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3549('0x15'))(_0x3549('0x16'));var utils=require(_0x3549('0x17'));var config=require(_0x3549('0x18'));var licenseUtil=require(_0x3549('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fbc0e,_0x25a8fb){_0x25a8fb=_0x25a8fb||0xcc;return function(_0x1621bd){if(_0x1621bd){return _0x1fbc0e[_0x3549('0x1a')](_0x25a8fb);}return _0x1fbc0e[_0x3549('0x1b')](_0x25a8fb)[_0x3549('0x1c')]();};}function respondWithResult(_0x87c0f,_0x46691a){_0x46691a=_0x46691a||0xc8;return function(_0x5703a4){if(_0x5703a4){return _0x87c0f['status'](_0x46691a)['json'](_0x5703a4);}};}function respondWithFilteredResult(_0x2c8f7c,_0x16eae5){return function(_0x3ca135){if(_0x3ca135){var _0x2d399b=typeof _0x16eae5[_0x3549('0x1d')]===_0x3549('0x1e')&&typeof _0x16eae5[_0x3549('0x1f')]===_0x3549('0x1e');var _0x512b9d=_0x3ca135[_0x3549('0x20')];var _0x26ee13=_0x2d399b?0x0:_0x16eae5[_0x3549('0x1d')];var _0x2e8e1d=_0x2d399b?_0x3ca135[_0x3549('0x20')]:_0x16eae5['offset']+_0x16eae5['limit'];var _0xf0055b;if(_0x2e8e1d>=_0x512b9d){_0x2e8e1d=_0x512b9d;_0xf0055b=0xc8;}else{_0xf0055b=0xce;}_0x2c8f7c[_0x3549('0x1b')](_0xf0055b);return _0x2c8f7c[_0x3549('0x21')]('Content-Range',_0x26ee13+'-'+_0x2e8e1d+'/'+_0x512b9d)[_0x3549('0x22')](_0x3ca135);}return null;};}function patchUpdates(_0x55afd2){return function(_0x433888){try{jsonpatch[_0x3549('0x23')](_0x433888,_0x55afd2,!![]);}catch(_0x2a9a21){return BPromise[_0x3549('0x24')](_0x2a9a21);}return _0x433888[_0x3549('0x25')]();};}function saveUpdates(_0x2d3753,_0x16b340){return function(_0x4c673d){if(_0x4c673d){return _0x4c673d[_0x3549('0x26')](_0x2d3753)[_0x3549('0x27')](function(_0x11697b){return _0x11697b;});}return null;};}function removeEntity(_0x4a6ce2,_0x450d18){return function(_0x53c0b0){if(_0x53c0b0){return _0x53c0b0[_0x3549('0x28')]()[_0x3549('0x27')](function(){_0x4a6ce2[_0x3549('0x1b')](0xcc)[_0x3549('0x1c')]();});}};}function handleEntityNotFound(_0x27e5a3,_0x37b465){return function(_0x5cb964){if(!_0x5cb964){_0x27e5a3[_0x3549('0x1a')](0x194);}return _0x5cb964;};}function handleError(_0x452e05,_0x12dd5c){_0x12dd5c=_0x12dd5c||0x1f4;return function(_0xe15438){logger['error'](_0xe15438[_0x3549('0x29')]);if(_0xe15438[_0x3549('0x2a')]){delete _0xe15438[_0x3549('0x2a')];}_0x452e05[_0x3549('0x1b')](_0x12dd5c)[_0x3549('0x2b')](_0xe15438);};}exports[_0x3549('0x2c')]=function(_0x554f11,_0x4dc85a){var _0x5f4299={},_0x5cb488={},_0x681e03={'count':0x0,'rows':[]};var _0x4e54fc=_[_0x3549('0x2d')](db['ZendeskField'][_0x3549('0x2e')],function(_0x3657a5){return{'name':_0x3657a5[_0x3549('0x2f')],'type':_0x3657a5[_0x3549('0x30')]['key']};});_0x5cb488['model']=_[_0x3549('0x2d')](_0x4e54fc,_0x3549('0x2a'));_0x5cb488[_0x3549('0x31')]=_['keys'](_0x554f11[_0x3549('0x31')]);_0x5cb488[_0x3549('0x32')]=_[_0x3549('0x33')](_0x5cb488[_0x3549('0x34')],_0x5cb488[_0x3549('0x31')]);_0x5f4299['attributes']=_[_0x3549('0x33')](_0x5cb488[_0x3549('0x34')],qs[_0x3549('0x35')](_0x554f11[_0x3549('0x31')][_0x3549('0x35')]));_0x5f4299[_0x3549('0x36')]=_0x5f4299['attributes'][_0x3549('0x37')]?_0x5f4299['attributes']:_0x5cb488[_0x3549('0x34')];if(!_0x554f11['query'][_0x3549('0x38')](_0x3549('0x39'))){_0x5f4299[_0x3549('0x1f')]=qs[_0x3549('0x1f')](_0x554f11[_0x3549('0x31')][_0x3549('0x1f')]);_0x5f4299[_0x3549('0x1d')]=qs[_0x3549('0x1d')](_0x554f11[_0x3549('0x31')]['offset']);}_0x5f4299[_0x3549('0x3a')]=qs['sort'](_0x554f11[_0x3549('0x31')][_0x3549('0x3b')]);_0x5f4299[_0x3549('0x3c')]=qs[_0x3549('0x32')](_[_0x3549('0x3d')](_0x554f11[_0x3549('0x31')],_0x5cb488['filters']),_0x4e54fc);if(_0x554f11[_0x3549('0x31')][_0x3549('0x3e')]){_0x5f4299[_0x3549('0x3c')]=_[_0x3549('0x3f')](_0x5f4299[_0x3549('0x3c')],{'$or':_[_0x3549('0x2d')](_0x4e54fc,function(_0x43d790){if(_0x43d790['type']!==_0x3549('0x40')){var _0xc31c11={};_0xc31c11[_0x43d790[_0x3549('0x2a')]]={'$like':'%'+_0x554f11[_0x3549('0x31')]['filter']+'%'};return _0xc31c11;}})});}_0x5f4299=_['merge']({},_0x5f4299,_0x554f11['options']);var _0x1247ff={'where':_0x5f4299['where']};return db['ZendeskField'][_0x3549('0x20')](_0x1247ff)[_0x3549('0x27')](function(_0x8ad13a){_0x681e03[_0x3549('0x20')]=_0x8ad13a;if(_0x554f11[_0x3549('0x31')][_0x3549('0x41')]){_0x5f4299[_0x3549('0x42')]=[{'all':!![]}];}return db[_0x3549('0x43')][_0x3549('0x44')](_0x5f4299);})[_0x3549('0x27')](function(_0x2b901d){_0x681e03[_0x3549('0x45')]=_0x2b901d;return _0x681e03;})[_0x3549('0x27')](respondWithFilteredResult(_0x4dc85a,_0x5f4299))['catch'](handleError(_0x4dc85a,null));};exports[_0x3549('0x46')]=function(_0x73875a,_0x190467){var _0x32f67e={'raw':!![],'where':{'id':_0x73875a[_0x3549('0x47')]['id']}},_0x251f1c={};_0x251f1c[_0x3549('0x34')]=_[_0x3549('0x48')](db[_0x3549('0x43')]['rawAttributes']);_0x251f1c[_0x3549('0x31')]=_[_0x3549('0x48')](_0x73875a[_0x3549('0x31')]);_0x251f1c['filters']=_[_0x3549('0x33')](_0x251f1c[_0x3549('0x34')],_0x251f1c[_0x3549('0x31')]);_0x32f67e[_0x3549('0x36')]=_[_0x3549('0x33')](_0x251f1c[_0x3549('0x34')],qs['fields'](_0x73875a['query']['fields']));_0x32f67e[_0x3549('0x36')]=_0x32f67e[_0x3549('0x36')][_0x3549('0x37')]?_0x32f67e[_0x3549('0x36')]:_0x251f1c[_0x3549('0x34')];if(_0x73875a[_0x3549('0x31')][_0x3549('0x41')]){_0x32f67e['include']=[{'all':!![]}];}_0x32f67e=_['merge']({},_0x32f67e,_0x73875a['options']);return db[_0x3549('0x43')][_0x3549('0x49')](_0x32f67e)[_0x3549('0x27')](handleEntityNotFound(_0x190467,null))[_0x3549('0x27')](respondWithResult(_0x190467,null))[_0x3549('0x4a')](handleError(_0x190467,null));};exports[_0x3549('0x4b')]=function(_0xaffb90,_0x45cee9){return db[_0x3549('0x43')][_0x3549('0x4b')](_0xaffb90[_0x3549('0x4c')],{})[_0x3549('0x27')](respondWithResult(_0x45cee9,0xc9))[_0x3549('0x4a')](handleError(_0x45cee9,null));};exports[_0x3549('0x26')]=function(_0x19696c,_0x48ca4f){if(_0x19696c[_0x3549('0x4c')]['id']){delete _0x19696c['body']['id'];}return db[_0x3549('0x43')][_0x3549('0x49')]({'where':{'id':_0x19696c[_0x3549('0x47')]['id']}})[_0x3549('0x27')](handleEntityNotFound(_0x48ca4f,null))[_0x3549('0x27')](saveUpdates(_0x19696c[_0x3549('0x4c')],null))['then'](respondWithResult(_0x48ca4f,null))['catch'](handleError(_0x48ca4f,null));};exports[_0x3549('0x28')]=function(_0x4e1f78,_0x588db6){return db[_0x3549('0x43')][_0x3549('0x49')]({'where':{'id':_0x4e1f78['params']['id']}})[_0x3549('0x27')](handleEntityNotFound(_0x588db6,null))[_0x3549('0x27')](removeEntity(_0x588db6,null))['catch'](handleError(_0x588db6,null));}; \ No newline at end of file +var _0xe0ae=['include','findAll','rows','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ZendeskField','includeAll'];(function(_0x238e7c,_0x46ee86){var _0x128a39=function(_0x54b983){while(--_0x54b983){_0x238e7c['push'](_0x238e7c['shift']());}};_0x128a39(++_0x46ee86);}(_0xe0ae,0x135));var _0xee0a=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xe0ae[_0x1ff575];return _0x48fc9e;};'use strict';var emlformat=require(_0xee0a('0x0'));var rimraf=require(_0xee0a('0x1'));var zipdir=require(_0xee0a('0x2'));var jsonpatch=require(_0xee0a('0x3'));var rp=require(_0xee0a('0x4'));var moment=require('moment');var BPromise=require(_0xee0a('0x5'));var Mustache=require(_0xee0a('0x6'));var util=require(_0xee0a('0x7'));var path=require(_0xee0a('0x8'));var sox=require(_0xee0a('0x9'));var csv=require(_0xee0a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee0a('0xb'));var crypto=require('crypto');var jsforce=require(_0xee0a('0xc'));var deskjs=require(_0xee0a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xe'));var Redis=require(_0xee0a('0xf'));var authService=require(_0xee0a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee0a('0x11'));var logger=require(_0xee0a('0x12'))(_0xee0a('0x13'));var utils=require(_0xee0a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee0a('0x15'));var db=require(_0xee0a('0x16'))['db'];function respondWithStatusCode(_0x22b5f3,_0x3103f5){_0x3103f5=_0x3103f5||0xcc;return function(_0xf8ab69){if(_0xf8ab69){return _0x22b5f3[_0xee0a('0x17')](_0x3103f5);}return _0x22b5f3[_0xee0a('0x18')](_0x3103f5)['end']();};}function respondWithResult(_0x3e05ad,_0x3fcf6b){_0x3fcf6b=_0x3fcf6b||0xc8;return function(_0x5c372b){if(_0x5c372b){return _0x3e05ad['status'](_0x3fcf6b)[_0xee0a('0x19')](_0x5c372b);}};}function respondWithFilteredResult(_0xf26c2b,_0x1b409e){return function(_0x52eb0f){if(_0x52eb0f){var _0x46b18f=typeof _0x1b409e[_0xee0a('0x1a')]===_0xee0a('0x1b')&&typeof _0x1b409e['limit']===_0xee0a('0x1b');var _0x4c431f=_0x52eb0f[_0xee0a('0x1c')];var _0x118def=_0x46b18f?0x0:_0x1b409e[_0xee0a('0x1a')];var _0x549c8a=_0x46b18f?_0x52eb0f['count']:_0x1b409e[_0xee0a('0x1a')]+_0x1b409e[_0xee0a('0x1d')];var _0x5f47ed;if(_0x549c8a>=_0x4c431f){_0x549c8a=_0x4c431f;_0x5f47ed=0xc8;}else{_0x5f47ed=0xce;}_0xf26c2b[_0xee0a('0x18')](_0x5f47ed);return _0xf26c2b[_0xee0a('0x1e')](_0xee0a('0x1f'),_0x118def+'-'+_0x549c8a+'/'+_0x4c431f)[_0xee0a('0x19')](_0x52eb0f);}return null;};}function patchUpdates(_0x133076){return function(_0x3b3f4c){try{jsonpatch['apply'](_0x3b3f4c,_0x133076,!![]);}catch(_0x557f5b){return BPromise[_0xee0a('0x20')](_0x557f5b);}return _0x3b3f4c[_0xee0a('0x21')]();};}function saveUpdates(_0x39a32c,_0x41cb12){return function(_0x4547ae){if(_0x4547ae){return _0x4547ae[_0xee0a('0x22')](_0x39a32c)[_0xee0a('0x23')](function(_0x16c4c8){return _0x16c4c8;});}return null;};}function removeEntity(_0x485c9a,_0x42fc43){return function(_0x37323b){if(_0x37323b){return _0x37323b[_0xee0a('0x24')]()['then'](function(){_0x485c9a[_0xee0a('0x18')](0xcc)[_0xee0a('0x25')]();});}};}function handleEntityNotFound(_0x1a8b9c,_0x4ea67e){return function(_0x29296){if(!_0x29296){_0x1a8b9c[_0xee0a('0x17')](0x194);}return _0x29296;};}function handleError(_0x49c1f5,_0x3202be){_0x3202be=_0x3202be||0x1f4;return function(_0x13413c){logger[_0xee0a('0x26')](_0x13413c[_0xee0a('0x27')]);if(_0x13413c[_0xee0a('0x28')]){delete _0x13413c[_0xee0a('0x28')];}_0x49c1f5[_0xee0a('0x18')](_0x3202be)['send'](_0x13413c);};}exports[_0xee0a('0x29')]=function(_0x393b98,_0x44c062){var _0x45c25f={},_0x5706b4={},_0x4c6ff5={'count':0x0,'rows':[]};var _0x24a755=_['map'](db['ZendeskField'][_0xee0a('0x2a')],function(_0x11fac9){return{'name':_0x11fac9[_0xee0a('0x2b')],'type':_0x11fac9[_0xee0a('0x2c')][_0xee0a('0x2d')]};});_0x5706b4['model']=_[_0xee0a('0x2e')](_0x24a755,_0xee0a('0x28'));_0x5706b4[_0xee0a('0x2f')]=_[_0xee0a('0x30')](_0x393b98[_0xee0a('0x2f')]);_0x5706b4[_0xee0a('0x31')]=_[_0xee0a('0x32')](_0x5706b4[_0xee0a('0x33')],_0x5706b4[_0xee0a('0x2f')]);_0x45c25f[_0xee0a('0x34')]=_[_0xee0a('0x32')](_0x5706b4[_0xee0a('0x33')],qs['fields'](_0x393b98[_0xee0a('0x2f')][_0xee0a('0x35')]));_0x45c25f[_0xee0a('0x34')]=_0x45c25f[_0xee0a('0x34')][_0xee0a('0x36')]?_0x45c25f['attributes']:_0x5706b4[_0xee0a('0x33')];if(!_0x393b98[_0xee0a('0x2f')][_0xee0a('0x37')](_0xee0a('0x38'))){_0x45c25f[_0xee0a('0x1d')]=qs[_0xee0a('0x1d')](_0x393b98[_0xee0a('0x2f')]['limit']);_0x45c25f[_0xee0a('0x1a')]=qs['offset'](_0x393b98[_0xee0a('0x2f')][_0xee0a('0x1a')]);}_0x45c25f[_0xee0a('0x39')]=qs[_0xee0a('0x3a')](_0x393b98[_0xee0a('0x2f')][_0xee0a('0x3a')]);_0x45c25f['where']=qs[_0xee0a('0x31')](_[_0xee0a('0x3b')](_0x393b98[_0xee0a('0x2f')],_0x5706b4[_0xee0a('0x31')]),_0x24a755);if(_0x393b98[_0xee0a('0x2f')][_0xee0a('0x3c')]){_0x45c25f[_0xee0a('0x3d')]=_[_0xee0a('0x3e')](_0x45c25f[_0xee0a('0x3d')],{'$or':_[_0xee0a('0x2e')](_0x24a755,function(_0x187dcc){if(_0x187dcc['type']!==_0xee0a('0x3f')){var _0x35a156={};_0x35a156[_0x187dcc[_0xee0a('0x28')]]={'$like':'%'+_0x393b98[_0xee0a('0x2f')][_0xee0a('0x3c')]+'%'};return _0x35a156;}})});}_0x45c25f=_[_0xee0a('0x3e')]({},_0x45c25f,_0x393b98['options']);var _0x47d3d7={'where':_0x45c25f[_0xee0a('0x3d')]};return db[_0xee0a('0x40')]['count'](_0x47d3d7)['then'](function(_0x4c8ef9){_0x4c6ff5['count']=_0x4c8ef9;if(_0x393b98[_0xee0a('0x2f')][_0xee0a('0x41')]){_0x45c25f[_0xee0a('0x42')]=[{'all':!![]}];}return db[_0xee0a('0x40')][_0xee0a('0x43')](_0x45c25f);})[_0xee0a('0x23')](function(_0x222054){_0x4c6ff5[_0xee0a('0x44')]=_0x222054;return _0x4c6ff5;})['then'](respondWithFilteredResult(_0x44c062,_0x45c25f))['catch'](handleError(_0x44c062,null));};exports['show']=function(_0x384cd8,_0x335e64){var _0x52bb42={'raw':!![],'where':{'id':_0x384cd8['params']['id']}},_0x352d85={};_0x352d85['model']=_[_0xee0a('0x30')](db[_0xee0a('0x40')]['rawAttributes']);_0x352d85[_0xee0a('0x2f')]=_['keys'](_0x384cd8[_0xee0a('0x2f')]);_0x352d85['filters']=_[_0xee0a('0x32')](_0x352d85[_0xee0a('0x33')],_0x352d85[_0xee0a('0x2f')]);_0x52bb42[_0xee0a('0x34')]=_[_0xee0a('0x32')](_0x352d85[_0xee0a('0x33')],qs[_0xee0a('0x35')](_0x384cd8[_0xee0a('0x2f')][_0xee0a('0x35')]));_0x52bb42[_0xee0a('0x34')]=_0x52bb42[_0xee0a('0x34')][_0xee0a('0x36')]?_0x52bb42['attributes']:_0x352d85['model'];if(_0x384cd8['query'][_0xee0a('0x41')]){_0x52bb42['include']=[{'all':!![]}];}_0x52bb42=_[_0xee0a('0x3e')]({},_0x52bb42,_0x384cd8[_0xee0a('0x45')]);return db[_0xee0a('0x40')][_0xee0a('0x46')](_0x52bb42)['then'](handleEntityNotFound(_0x335e64,null))[_0xee0a('0x23')](respondWithResult(_0x335e64,null))[_0xee0a('0x47')](handleError(_0x335e64,null));};exports[_0xee0a('0x48')]=function(_0x5a274b,_0x59be5e){return db[_0xee0a('0x40')][_0xee0a('0x48')](_0x5a274b[_0xee0a('0x49')],{})[_0xee0a('0x23')](respondWithResult(_0x59be5e,0xc9))[_0xee0a('0x47')](handleError(_0x59be5e,null));};exports[_0xee0a('0x22')]=function(_0x395da3,_0x6429a4){if(_0x395da3['body']['id']){delete _0x395da3['body']['id'];}return db[_0xee0a('0x40')]['find']({'where':{'id':_0x395da3[_0xee0a('0x4a')]['id']}})[_0xee0a('0x23')](handleEntityNotFound(_0x6429a4,null))['then'](saveUpdates(_0x395da3[_0xee0a('0x49')],null))[_0xee0a('0x23')](respondWithResult(_0x6429a4,null))[_0xee0a('0x47')](handleError(_0x6429a4,null));};exports[_0xee0a('0x24')]=function(_0xd9017,_0x178c63){return db[_0xee0a('0x40')][_0xee0a('0x46')]({'where':{'id':_0xd9017[_0xee0a('0x4a')]['id']}})[_0xee0a('0x23')](handleEntityNotFound(_0x178c63,null))[_0xee0a('0x23')](removeEntity(_0x178c63,null))[_0xee0a('0x47')](handleError(_0x178c63,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d0beb0d..a8c340f 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 _0x936a=['request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x287ccd,_0x5e35d2){var _0x2be637=function(_0x4aea5c){while(--_0x4aea5c){_0x287ccd['push'](_0x287ccd['shift']());}};_0x2be637(++_0x5e35d2);}(_0x936a,0x19a));var _0xa936=function(_0x5fa488,_0x21a582){_0x5fa488=_0x5fa488-0x0;var _0x1aa239=_0x936a[_0x5fa488];return _0x1aa239;};'use strict';var _=require(_0xa936('0x0'));var util=require(_0xa936('0x1'));var logger=require(_0xa936('0x2'))(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require(_0xa936('0x5'));var rp=require(_0xa936('0x6'));var fs=require('fs');var path=require(_0xa936('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa936('0x8'));module[_0xa936('0x9')]=function(_0x3ca11b,_0x973b88){return _0x3ca11b[_0xa936('0xa')](_0xa936('0xb'),attributes,{'tableName':_0xa936('0xc'),'paranoid':![],'indexes':[{'name':_0xa936('0xd'),'fields':[_0xa936('0xe'),_0xa936('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdac4=['../../config/logger','api','request-promise','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0x11e4db,_0x41cb4a){var _0x4aca78=function(_0x203270){while(--_0x203270){_0x11e4db['push'](_0x11e4db['shift']());}};_0x4aca78(++_0x41cb4a);}(_0xdac4,0x105));var _0x4dac=function(_0x2e0da6,_0x4a4adf){_0x2e0da6=_0x2e0da6-0x0;var _0x9503b3=_0xdac4[_0x2e0da6];return _0x9503b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4dac('0x0'))(_0x4dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4dac('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4dac('0x3'));module[_0x4dac('0x4')]=function(_0x364697,_0x4ef698){return _0x364697[_0x4dac('0x5')](_0x4dac('0x6'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4dac('0x7'),'fields':[_0x4dac('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 07c3d07..25ddcc0 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 _0xc19e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xc19e,0xef));var _0xec19=function(_0x316b12,_0x12a04f){_0x316b12=_0x316b12-0x0;var _0x29769f=_0xc19e[_0x316b12];return _0x29769f;};'use strict';var _=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var moment=require(_0xec19('0x2'));var BPromise=require(_0xec19('0x3'));var rs=require(_0xec19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec19('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec19('0x6'))('rpc');var config=require(_0xec19('0x7'));var jayson=require(_0xec19('0x8'));var client=jayson[_0xec19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x264d8b,_0x224534,_0x3187a2){return new BPromise(function(_0x16dba3,_0x2bd23a){return client[_0xec19('0xa')](_0x264d8b,_0x3187a2)[_0xec19('0xb')](function(_0x37cc0e){logger[_0xec19('0xc')](_0xec19('0xd'),_0x224534,_0xec19('0xe'));logger['debug'](_0xec19('0xf'),_0x224534,'request\x20sent',JSON['stringify'](_0x37cc0e));if(_0x37cc0e[_0xec19('0x10')]){if(_0x37cc0e[_0xec19('0x10')][_0xec19('0x11')]===0x1f4){logger[_0xec19('0x10')](_0xec19('0xd'),_0x224534,_0x37cc0e['error'][_0xec19('0x12')]);return _0x2bd23a(_0x37cc0e['error']['message']);}logger[_0xec19('0x10')](_0xec19('0xd'),_0x224534,_0x37cc0e[_0xec19('0x10')][_0xec19('0x12')]);return _0x16dba3(_0x37cc0e[_0xec19('0x10')][_0xec19('0x12')]);}else{logger[_0xec19('0xc')](_0xec19('0xd'),_0x224534,_0xec19('0xe'));_0x16dba3(_0x37cc0e[_0xec19('0x13')][_0xec19('0x12')]);}})['catch'](function(_0x3e6184){logger[_0xec19('0x10')]('ZendeskField,\x20%s,\x20%s',_0x224534,_0x3e6184);_0x2bd23a(_0x3e6184);});});} \ No newline at end of file +var _0x47a1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','ZendeskField,\x20%s,\x20%s','message','result','util','moment','bluebird'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x47a1,0x9d));var _0x147a=function(_0x3191ac,_0x5177a7){_0x3191ac=_0x3191ac-0x0;var _0xf1b8b2=_0x47a1[_0x3191ac];return _0xf1b8b2;};'use strict';var _=require('lodash');var util=require(_0x147a('0x0'));var moment=require(_0x147a('0x1'));var BPromise=require(_0x147a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x147a('0x3'));var db=require(_0x147a('0x4'))['db'];var utils=require(_0x147a('0x5'));var logger=require(_0x147a('0x6'))(_0x147a('0x7'));var config=require(_0x147a('0x8'));var jayson=require(_0x147a('0x9'));var client=jayson[_0x147a('0xa')][_0x147a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d6d2b,_0x43d771,_0x5c9f3a){return new BPromise(function(_0xa53d4f,_0xe3dcbe){return client['request'](_0x3d6d2b,_0x5c9f3a)[_0x147a('0xc')](function(_0x1bb694){logger[_0x147a('0xd')]('ZendeskField,\x20%s,\x20%s',_0x43d771,_0x147a('0xe'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x43d771,_0x147a('0xe'),JSON[_0x147a('0xf')](_0x1bb694));if(_0x1bb694['error']){if(_0x1bb694[_0x147a('0x10')]['code']===0x1f4){logger[_0x147a('0x10')](_0x147a('0x11'),_0x43d771,_0x1bb694[_0x147a('0x10')][_0x147a('0x12')]);return _0xe3dcbe(_0x1bb694[_0x147a('0x10')][_0x147a('0x12')]);}logger['error'](_0x147a('0x11'),_0x43d771,_0x1bb694[_0x147a('0x10')][_0x147a('0x12')]);return _0xa53d4f(_0x1bb694[_0x147a('0x10')][_0x147a('0x12')]);}else{logger['info'](_0x147a('0x11'),_0x43d771,_0x147a('0xe'));_0xa53d4f(_0x1bb694[_0x147a('0x13')][_0x147a('0x12')]);}})['catch'](function(_0x433d94){logger[_0x147a('0x10')]('ZendeskField,\x20%s,\x20%s',_0x43d771,_0x433d94);_0xe3dcbe(_0x433d94);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b99e19b..8bcc73c 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 _0xb828=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xb828,0x9e));var _0x8b82=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0xb828[_0x295583];return _0x4c2ae6;};'use strict';var multer=require(_0x8b82('0x0'));var util=require('util');var path=require(_0x8b82('0x1'));var timeout=require(_0x8b82('0x2'));var express=require(_0x8b82('0x3'));var router=express[_0x8b82('0x4')]();var fs_extra=require(_0x8b82('0x5'));var auth=require(_0x8b82('0x6'));var interaction=require(_0x8b82('0x7'));var config=require(_0x8b82('0x8'));var controller=require(_0x8b82('0x9'));router[_0x8b82('0xa')]('/',auth[_0x8b82('0xb')](),controller[_0x8b82('0xc')]);router['get'](_0x8b82('0xd'),auth[_0x8b82('0xb')](),controller[_0x8b82('0xe')]);router['get'](_0x8b82('0xf'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x10')]);router['get'](_0x8b82('0x11'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x12')]);router[_0x8b82('0x13')]('/',auth[_0x8b82('0xb')](),controller[_0x8b82('0x14')]);router[_0x8b82('0x13')]('/:id/configurations',auth[_0x8b82('0xb')](),controller[_0x8b82('0x15')]);router['put']('/:id',auth[_0x8b82('0xb')](),controller[_0x8b82('0x16')]);router[_0x8b82('0x17')](_0x8b82('0xd'),auth[_0x8b82('0xb')](),controller[_0x8b82('0x18')]);module[_0x8b82('0x19')]=router; \ No newline at end of file +var _0x9bad=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x584918,_0x4ee96b){var _0x30ddad=function(_0x57ad94){while(--_0x57ad94){_0x584918['push'](_0x584918['shift']());}};_0x30ddad(++_0x4ee96b);}(_0x9bad,0x15a));var _0xd9ba=function(_0x5eec4b,_0x2d9386){_0x5eec4b=_0x5eec4b-0x0;var _0x69b5fc=_0x9bad[_0x5eec4b];return _0x69b5fc;};'use strict';var multer=require(_0xd9ba('0x0'));var util=require(_0xd9ba('0x1'));var path=require(_0xd9ba('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ba('0x3'));var router=express['Router']();var fs_extra=require(_0xd9ba('0x4'));var auth=require(_0xd9ba('0x5'));var interaction=require(_0xd9ba('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ba('0x7'));router[_0xd9ba('0x8')]('/',auth[_0xd9ba('0x9')](),controller[_0xd9ba('0xa')]);router[_0xd9ba('0x8')](_0xd9ba('0xb'),auth[_0xd9ba('0x9')](),controller[_0xd9ba('0xc')]);router[_0xd9ba('0x8')](_0xd9ba('0xd'),auth[_0xd9ba('0x9')](),controller[_0xd9ba('0xe')]);router[_0xd9ba('0x8')](_0xd9ba('0xf'),auth[_0xd9ba('0x9')](),controller[_0xd9ba('0x10')]);router[_0xd9ba('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd9ba('0x11')](_0xd9ba('0xd'),auth['isAuthenticated'](),controller[_0xd9ba('0x12')]);router[_0xd9ba('0x13')](_0xd9ba('0xb'),auth[_0xd9ba('0x9')](),controller[_0xd9ba('0x14')]);router[_0xd9ba('0x15')](_0xd9ba('0xb'),auth[_0xd9ba('0x9')](),controller['destroy']);module[_0xd9ba('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 026bd90..82d1f3b 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 _0xb4e6=['sequelize','STRING'];(function(_0x16869e,_0x50e3b7){var _0x4b4af3=function(_0x353d58){while(--_0x353d58){_0x16869e['push'](_0x16869e['shift']());}};_0x4b4af3(++_0x50e3b7);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0xb4e6[_0x1a595a];return _0x33f008;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file +var _0xbd50=['STRING','sequelize','exports'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xbd50,0x196));var _0x0bd5=function(_0x57c5e2,_0x10f331){_0x57c5e2=_0x57c5e2-0x0;var _0x19e57=_0xbd50[_0x57c5e2];return _0x19e57;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0bd5('0x2')]},'zone':{'type':Sequelize[_0x0bd5('0x2')]},'clientId':{'type':Sequelize[_0x0bd5('0x2')]},'clientSecret':{'type':Sequelize[_0x0bd5('0x2')]},'serverUrl':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index def2448..45dedd3 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 _0x6e6a=['https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','remove','push','display_label','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','ZohoAccount','rows','catch','params','fields','length','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','code','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0x6e6a,0x10e));var _0xa6e6=function(_0x86f227,_0x437176){_0x86f227=_0x86f227-0x0;var _0x17cbce=_0x6e6a[_0x86f227];return _0x17cbce;};'use strict';var emlformat=require(_0xa6e6('0x0'));var rimraf=require(_0xa6e6('0x1'));var zipdir=require(_0xa6e6('0x2'));var jsonpatch=require(_0xa6e6('0x3'));var rp=require('request-promise');var moment=require(_0xa6e6('0x4'));var BPromise=require(_0xa6e6('0x5'));var Mustache=require('mustache');var util=require(_0xa6e6('0x6'));var path=require('path');var sox=require(_0xa6e6('0x7'));var csv=require(_0xa6e6('0x8'));var ejs=require(_0xa6e6('0x9'));var fs=require('fs');var fs_extra=require(_0xa6e6('0xa'));var _=require(_0xa6e6('0xb'));var squel=require(_0xa6e6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa6e6('0x8'));var querystring=require(_0xa6e6('0xd'));var Papa=require(_0xa6e6('0xe'));var Redis=require(_0xa6e6('0xf'));var authService=require(_0xa6e6('0x10'));var qs=require(_0xa6e6('0x11'));var as=require(_0xa6e6('0x12'));var hardwareService=require(_0xa6e6('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa6e6('0x14'));var config=require(_0xa6e6('0x15'));var licenseUtil=require(_0xa6e6('0x16'));var db=require(_0xa6e6('0x17'))['db'];var integrations=require(_0xa6e6('0x18'));function respondWithStatusCode(_0xacd2bf,_0x78271d){_0x78271d=_0x78271d||0xcc;return function(_0x186793){if(_0x186793){return _0xacd2bf[_0xa6e6('0x19')](_0x78271d);}return _0xacd2bf['status'](_0x78271d)[_0xa6e6('0x1a')]();};}function respondWithResult(_0x412cbb,_0x4ff431){_0x4ff431=_0x4ff431||0xc8;return function(_0x4a7bdc){if(_0x4a7bdc){return _0x412cbb[_0xa6e6('0x1b')](_0x4ff431)[_0xa6e6('0x1c')](_0x4a7bdc);}};}function respondWithFilteredResult(_0x1e8376,_0x4d2990){return function(_0x4c97da){if(_0x4c97da){var _0x1b8006=typeof _0x4d2990[_0xa6e6('0x1d')]==='undefined'&&typeof _0x4d2990[_0xa6e6('0x1e')]===_0xa6e6('0x1f');var _0x381622=_0x4c97da['count'];var _0xc620dc=_0x1b8006?0x0:_0x4d2990[_0xa6e6('0x1d')];var _0x289161=_0x1b8006?_0x4c97da[_0xa6e6('0x20')]:_0x4d2990['offset']+_0x4d2990[_0xa6e6('0x1e')];var _0x483f93;if(_0x289161>=_0x381622){_0x289161=_0x381622;_0x483f93=0xc8;}else{_0x483f93=0xce;}_0x1e8376[_0xa6e6('0x1b')](_0x483f93);return _0x1e8376[_0xa6e6('0x21')]('Content-Range',_0xc620dc+'-'+_0x289161+'/'+_0x381622)[_0xa6e6('0x1c')](_0x4c97da);}return null;};}function patchUpdates(_0x3fa358){return function(_0x1c92f4){try{jsonpatch[_0xa6e6('0x22')](_0x1c92f4,_0x3fa358,!![]);}catch(_0x20f2d1){return BPromise['reject'](_0x20f2d1);}return _0x1c92f4[_0xa6e6('0x23')]();};}function saveUpdates(_0x1f08f9,_0x29ab1d){return function(_0x15adfd){if(_0x15adfd){return _0x15adfd[_0xa6e6('0x24')](_0x1f08f9)[_0xa6e6('0x25')](function(_0xba012d){return _0xba012d;});}return null;};}function removeEntity(_0x44cde9,_0x4c451b){return function(_0x539745){if(_0x539745){return _0x539745[_0xa6e6('0x26')]()[_0xa6e6('0x25')](function(){_0x44cde9['status'](0xcc)[_0xa6e6('0x1a')]();});}};}function handleEntityNotFound(_0x4221c4,_0x2bec9d){return function(_0x2df476){if(!_0x2df476){_0x4221c4[_0xa6e6('0x19')](0x194);}return _0x2df476;};}function handleError(_0x130330,_0xa488f1){_0xa488f1=_0xa488f1||0x1f4;return function(_0x50ea54){logger[_0xa6e6('0x27')](_0x50ea54[_0xa6e6('0x28')]);if(_0x50ea54[_0xa6e6('0x29')]){delete _0x50ea54[_0xa6e6('0x29')];}_0x130330[_0xa6e6('0x1b')](_0xa488f1)['send'](_0x50ea54);};}exports['index']=function(_0x2c6d76,_0x5ded55){var _0x32f8a9={},_0x23a2db={},_0xd8408e={'count':0x0,'rows':[]};var _0x5273d2=_[_0xa6e6('0x2a')](db['ZohoAccount'][_0xa6e6('0x2b')],function(_0x2115e8){return{'name':_0x2115e8[_0xa6e6('0x2c')],'type':_0x2115e8[_0xa6e6('0x2d')][_0xa6e6('0x2e')]};});_0x23a2db[_0xa6e6('0x2f')]=_[_0xa6e6('0x2a')](_0x5273d2,'name');_0x23a2db['query']=_[_0xa6e6('0x30')](_0x2c6d76['query']);_0x23a2db['filters']=_[_0xa6e6('0x31')](_0x23a2db[_0xa6e6('0x2f')],_0x23a2db[_0xa6e6('0x32')]);_0x32f8a9[_0xa6e6('0x33')]=_[_0xa6e6('0x31')](_0x23a2db['model'],qs['fields'](_0x2c6d76[_0xa6e6('0x32')]['fields']));_0x32f8a9['attributes']=_0x32f8a9[_0xa6e6('0x33')]['length']?_0x32f8a9[_0xa6e6('0x33')]:_0x23a2db[_0xa6e6('0x2f')];if(!_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x34')](_0xa6e6('0x35'))){_0x32f8a9[_0xa6e6('0x1e')]=qs['limit'](_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x1e')]);_0x32f8a9['offset']=qs['offset'](_0x2c6d76['query'][_0xa6e6('0x1d')]);}_0x32f8a9['order']=qs['sort'](_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x36')]);_0x32f8a9[_0xa6e6('0x37')]=qs[_0xa6e6('0x38')](_[_0xa6e6('0x39')](_0x2c6d76['query'],_0x23a2db[_0xa6e6('0x38')]),_0x5273d2);if(_0x2c6d76[_0xa6e6('0x32')]['filter']){_0x32f8a9[_0xa6e6('0x37')]=_[_0xa6e6('0x3a')](_0x32f8a9[_0xa6e6('0x37')],{'$or':_[_0xa6e6('0x2a')](_0x5273d2,function(_0x3d80f){if(_0x3d80f[_0xa6e6('0x2d')]!==_0xa6e6('0x3b')){var _0x5efc45={};_0x5efc45[_0x3d80f[_0xa6e6('0x29')]]={'$like':'%'+_0x2c6d76[_0xa6e6('0x32')][_0xa6e6('0x3c')]+'%'};return _0x5efc45;}})});}_0x32f8a9=_[_0xa6e6('0x3a')]({},_0x32f8a9,_0x2c6d76[_0xa6e6('0x3d')]);var _0x528729={'where':_0x32f8a9[_0xa6e6('0x37')]};return db[_0xa6e6('0x3e')][_0xa6e6('0x20')](_0x528729)[_0xa6e6('0x25')](function(_0x38805a){_0xd8408e['count']=_0x38805a;if(_0x2c6d76[_0xa6e6('0x32')]['includeAll']){_0x32f8a9['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x32f8a9);})['then'](function(_0x2d4724){_0xd8408e[_0xa6e6('0x3f')]=_0x2d4724;return _0xd8408e;})[_0xa6e6('0x25')](respondWithFilteredResult(_0x5ded55,_0x32f8a9))[_0xa6e6('0x40')](handleError(_0x5ded55,null));};exports['show']=function(_0x1d5b33,_0x32cc80){var _0x14dd64={'raw':![],'where':{'id':_0x1d5b33[_0xa6e6('0x41')]['id']}},_0x237638={};_0x237638[_0xa6e6('0x2f')]=_[_0xa6e6('0x30')](db[_0xa6e6('0x3e')][_0xa6e6('0x2b')]);_0x237638[_0xa6e6('0x32')]=_['keys'](_0x1d5b33[_0xa6e6('0x32')]);_0x237638['filters']=_['intersection'](_0x237638[_0xa6e6('0x2f')],_0x237638['query']);_0x14dd64['attributes']=_[_0xa6e6('0x31')](_0x237638[_0xa6e6('0x2f')],qs[_0xa6e6('0x42')](_0x1d5b33[_0xa6e6('0x32')][_0xa6e6('0x42')]));_0x14dd64[_0xa6e6('0x33')]=_0x14dd64[_0xa6e6('0x33')][_0xa6e6('0x43')]?_0x14dd64['attributes']:_0x237638[_0xa6e6('0x2f')];if(_0x1d5b33[_0xa6e6('0x32')][_0xa6e6('0x44')]){_0x14dd64['include']=[{'all':!![]}];}_0x14dd64=_[_0xa6e6('0x3a')]({},_0x14dd64,_0x1d5b33['options']);return db[_0xa6e6('0x3e')][_0xa6e6('0x45')](_0x14dd64)[_0xa6e6('0x25')](handleEntityNotFound(_0x32cc80,null))['then'](respondWithResult(_0x32cc80,null))[_0xa6e6('0x40')](handleError(_0x32cc80,null));};exports[_0xa6e6('0x46')]=function(_0x3a415b,_0x54b4a4){return db['ZohoAccount'][_0xa6e6('0x46')](_0x3a415b[_0xa6e6('0x47')],{})[_0xa6e6('0x25')](respondWithResult(_0x54b4a4,0xc9))['catch'](handleError(_0x54b4a4,null));};exports['update']=function(_0x2c6e6b,_0x9395d3){if(_0x2c6e6b[_0xa6e6('0x47')]['id']){delete _0x2c6e6b[_0xa6e6('0x47')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2c6e6b['params']['id']}})['then'](handleEntityNotFound(_0x9395d3,null))[_0xa6e6('0x25')](saveUpdates(_0x2c6e6b[_0xa6e6('0x47')],null))['then'](respondWithResult(_0x9395d3,null))['catch'](handleError(_0x9395d3,null));};exports[_0xa6e6('0x26')]=function(_0x5540e1,_0x1a0f61){return db[_0xa6e6('0x3e')][_0xa6e6('0x45')]({'where':{'id':_0x5540e1[_0xa6e6('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a0f61,null))[_0xa6e6('0x25')](removeEntity(_0x1a0f61,null))[_0xa6e6('0x40')](handleError(_0x1a0f61,null));};exports[_0xa6e6('0x48')]=function(_0xca8f30,_0x2e7933,_0x40c7cd){var _0x47afb8={};var _0x3931b4={};var _0x3651aa;var _0x52fad4;return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0xca8f30['params']['id']}})[_0xa6e6('0x25')](handleEntityNotFound(_0x2e7933,null))[_0xa6e6('0x25')](function(_0x1060ee){if(_0x1060ee){_0x3651aa=_0x1060ee;_0x3931b4[_0xa6e6('0x2f')]=_[_0xa6e6('0x30')](db[_0xa6e6('0x4a')][_0xa6e6('0x2b')]);_0x3931b4[_0xa6e6('0x32')]=_[_0xa6e6('0x30')](_0xca8f30[_0xa6e6('0x32')]);_0x3931b4[_0xa6e6('0x38')]=_[_0xa6e6('0x31')](_0x3931b4[_0xa6e6('0x2f')],_0x3931b4[_0xa6e6('0x32')]);_0x47afb8['attributes']=_[_0xa6e6('0x31')](_0x3931b4['model'],qs[_0xa6e6('0x42')](_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x42')]));_0x47afb8[_0xa6e6('0x33')]=_0x47afb8[_0xa6e6('0x33')][_0xa6e6('0x43')]?_0x47afb8[_0xa6e6('0x33')]:_0x3931b4[_0xa6e6('0x2f')];_0x47afb8['order']=qs[_0xa6e6('0x36')](_0xca8f30['query'][_0xa6e6('0x36')]);_0x47afb8['where']=qs['filters'](_[_0xa6e6('0x39')](_0xca8f30[_0xa6e6('0x32')],_0x3931b4[_0xa6e6('0x38')]));if(_0xca8f30['query']['filter']){_0x47afb8[_0xa6e6('0x37')]=_[_0xa6e6('0x3a')](_0x47afb8['where'],{'$or':_[_0xa6e6('0x2a')](_0x47afb8[_0xa6e6('0x33')],function(_0x5748b4){var _0x533ae6={};_0x533ae6[_0x5748b4]={'$like':'%'+_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x3c')]+'%'};return _0x533ae6;})});}_0x47afb8=_[_0xa6e6('0x3a')]({},_0x47afb8,_0xca8f30[_0xa6e6('0x3d')]);return _0x3651aa['getConfigurations'](_0x47afb8);}})[_0xa6e6('0x25')](function(_0x564bd0){if(_0x564bd0){_0x52fad4=_0x564bd0[_0xa6e6('0x43')];if(!_0xca8f30[_0xa6e6('0x32')]['hasOwnProperty'](_0xa6e6('0x35'))){_0x47afb8['limit']=qs['limit'](_0xca8f30[_0xa6e6('0x32')][_0xa6e6('0x1e')]);_0x47afb8[_0xa6e6('0x1d')]=qs[_0xa6e6('0x1d')](_0xca8f30[_0xa6e6('0x32')]['offset']);}return _0x3651aa[_0xa6e6('0x48')](_0x47afb8);}})[_0xa6e6('0x25')](function(_0x370bd0){if(_0x370bd0){return _0x370bd0?{'count':_0x52fad4,'rows':_0x370bd0}:null;}})['then'](respondWithResult(_0x2e7933,null))['catch'](handleError(_0x2e7933,null));};exports[_0xa6e6('0x4b')]=function(_0x44476d,_0x69640c,_0xf50e59){if(_0x44476d[_0xa6e6('0x47')]['id']){delete _0x44476d[_0xa6e6('0x47')]['id'];}return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0x44476d['params']['id']}})[_0xa6e6('0x25')](handleEntityNotFound(_0x69640c,null))[_0xa6e6('0x25')](function(_0x1b7500){if(_0x1b7500){_0x44476d['body']['AccountId']=_0x1b7500['id'];_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x4c')]=integrations[_0xa6e6('0x4d')](_0x44476d['body']['channel'],_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x2d')]);_0x44476d['body'][_0xa6e6('0x4e')]=integrations[_0xa6e6('0x4f')](_0x44476d[_0xa6e6('0x47')][_0xa6e6('0x50')],_0x44476d['body'][_0xa6e6('0x2d')]);return db[_0xa6e6('0x4a')][_0xa6e6('0x46')](_0x44476d['body'],{'include':[{'model':db[_0xa6e6('0x51')],'as':_0xa6e6('0x4c')},{'model':db[_0xa6e6('0x51')],'as':_0xa6e6('0x4e')}]});}return null;})[_0xa6e6('0x25')](respondWithResult(_0x69640c,null))[_0xa6e6('0x40')](handleError(_0x69640c,null));};function getAccessToken(_0x52aa27){return new Promise(function(_0x17f058,_0x3a50ff){var _0x539a86;switch(_0x52aa27[_0xa6e6('0x52')]){case'US':_0x539a86=_0xa6e6('0x53');break;case'AU':_0x539a86=_0xa6e6('0x54');break;case'EU':_0x539a86=_0xa6e6('0x55');break;case'IN':_0x539a86='https://accounts.zoho.in';break;case'CN':_0x539a86=_0xa6e6('0x56');break;default:_0x539a86=_0xa6e6('0x55');break;}var _0x332d14={'method':_0xa6e6('0x57'),'uri':_0x539a86+_0xa6e6('0x58'),'qs':{'refresh_token':_0x52aa27[_0xa6e6('0x59')],'client_id':_0x52aa27[_0xa6e6('0x5a')],'client_secret':_0x52aa27[_0xa6e6('0x5b')],'grant_type':_0xa6e6('0x5c')},'json':!![]};return rp(_0x332d14)[_0xa6e6('0x25')](function(_0x5f4bee){if(_0x5f4bee[_0xa6e6('0x5d')]){_0x17f058(_0x5f4bee[_0xa6e6('0x5d')]);}else{_0x3a50ff('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa6e6('0x40')](function(_0x1e69c3){_0x3a50ff(_0x1e69c3);});});}exports[_0xa6e6('0x5e')]=function(_0x3e3acd,_0x50d50e,_0x3aad0a){var _0x20fd1d,_0x5a16e0,_0x32ff6b,_0x4adb62,_0x4f9164;return db[_0xa6e6('0x3e')][_0xa6e6('0x49')]({'where':{'id':_0x3e3acd[_0xa6e6('0x41')]['id']},'attributes':['id',_0xa6e6('0x5f'),_0xa6e6('0x52'),_0xa6e6('0x5a'),_0xa6e6('0x5b'),'serverUrl',_0xa6e6('0x60'),_0xa6e6('0x59')]})['then'](handleEntityNotFound(_0x50d50e,null))[_0xa6e6('0x25')](function(_0x88d88a){_0x4f9164=_0x88d88a;_0x20fd1d=_0x4f9164[_0xa6e6('0x5f')];_0x5a16e0=_0x20fd1d==='zoho.eu'?'eu':_0xa6e6('0x61');_0x32ff6b=_0x4f9164[_0xa6e6('0x62')];var _0x4ffa96=_0x32ff6b[_0xa6e6('0x63')](-0x1);if(_0x4ffa96==='/'||_0x4ffa96==='\x5c'||_0x4ffa96===':'){_0x32ff6b=_0x32ff6b[_0xa6e6('0x64')](0x0,_0x32ff6b[_0xa6e6('0x65')](_0x4ffa96));}if(!_0x4f9164[_0xa6e6('0x59')]){throw new Error(_0xa6e6('0x66'));}return getAccessToken(_0x4f9164);})[_0xa6e6('0x25')](function(_0x2bccc2){if(_0x2bccc2){return rp({'method':_0xa6e6('0x67'),'uri':util[_0xa6e6('0x68')](_0xa6e6('0x69'),_0x5a16e0),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa6e6('0x6a')+_0x2bccc2},'json':!![]});}})[_0xa6e6('0x25')](function(_0x1a3791){if(_0x1a3791){if(_0x1a3791['response']&&_0x1a3791[_0xa6e6('0x6b')]['error']){throw new Error(_0x1a3791[_0xa6e6('0x6b')][_0xa6e6('0x27')]['message']);}var _0x2bce4f=[];var _0x1c3db8=[];var _0x49ba50=[_0xa6e6('0x6c'),_0xa6e6('0x6d'),'Description',_0xa6e6('0x6e'),_0xa6e6('0x6f'),'Call_Result',_0xa6e6('0x70'),'Call_Type'];_0x1c3db8=_[_0xa6e6('0x71')](_0x1a3791[_0xa6e6('0x42')],function(_0x5ccc61){return _0x49ba50['includes'](_0x5ccc61['api_name']);});for(var _0x45683b=0x0;_0x45683b<_0x1c3db8[_0xa6e6('0x43')];_0x45683b++){if(_0x1c3db8[_0x45683b]['system_mandatory']===![]){_0x2bce4f[_0xa6e6('0x72')]({'id':_0x1c3db8[_0x45683b]['id'],'name':_0x1c3db8[_0x45683b][_0xa6e6('0x73')],'custom':_0x1c3db8[_0x45683b][_0xa6e6('0x74')],'options':_0x1c3db8[_0x45683b][_0xa6e6('0x75')]===_0xa6e6('0x76')&&_0x1c3db8[_0x45683b]['pick_list_values'][_0xa6e6('0x43')]>-0x1?_[_0xa6e6('0x2a')](_0x1c3db8[_0x45683b]['pick_list_values'],function(_0xe08ed4){return{'name':_0xe08ed4,'value':_0xe08ed4};}):[]});}}return{'count':_0x2bce4f['length'],'rows':_0x2bce4f};}else{return{'count':0x0,'rows':[]};}})[_0xa6e6('0x25')](respondWithResult(_0x50d50e,null))['catch'](function(_0x18839f){var _0x27b172=_0x3e3acd[_0xa6e6('0x32')][_0xa6e6('0x77')]?0x1f4:_0x18839f[_0xa6e6('0x78')]||0x1f4;logger['error'](_0xa6e6('0x79'),_0xa6e6('0x5e'),_0x27b172,JSON[_0xa6e6('0x7a')](_0x18839f));delete _0x18839f[_0xa6e6('0x29')];if(_0x27b172===0x191){_0x27b172=0x190;}_0x50d50e[_0xa6e6('0x1b')](_0x27b172)[_0xa6e6('0x7b')](_0x3e3acd['query'][_0xa6e6('0x77')]?{'message':_0xa6e6('0x7c'),'statusCode':_0x18839f['statusCode']}:_0x18839f);});}; \ No newline at end of file +var _0xbf19=['getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','host','zone','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects'];(function(_0x147435,_0x11366f){var _0x2cac98=function(_0x15b73d){while(--_0x15b73d){_0x147435['push'](_0x147435['shift']());}};_0x2cac98(++_0x11366f);}(_0xbf19,0x143));var _0x9bf1=function(_0x22d29c,_0x332aa5){_0x22d29c=_0x22d29c-0x0;var _0x32a162=_0xbf19[_0x22d29c];return _0x32a162;};'use strict';var emlformat=require(_0x9bf1('0x0'));var rimraf=require(_0x9bf1('0x1'));var zipdir=require(_0x9bf1('0x2'));var jsonpatch=require(_0x9bf1('0x3'));var rp=require(_0x9bf1('0x4'));var moment=require(_0x9bf1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9bf1('0x6'));var util=require(_0x9bf1('0x7'));var path=require(_0x9bf1('0x8'));var sox=require(_0x9bf1('0x9'));var csv=require(_0x9bf1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bf1('0xb'));var _=require(_0x9bf1('0xc'));var squel=require(_0x9bf1('0xd'));var crypto=require(_0x9bf1('0xe'));var jsforce=require(_0x9bf1('0xf'));var deskjs=require(_0x9bf1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bf1('0x11'));var Redis=require(_0x9bf1('0x12'));var authService=require(_0x9bf1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9bf1('0x14'));var hardwareService=require(_0x9bf1('0x15'));var logger=require(_0x9bf1('0x16'))(_0x9bf1('0x17'));var utils=require(_0x9bf1('0x18'));var config=require(_0x9bf1('0x19'));var licenseUtil=require(_0x9bf1('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9bf1('0x1b'));function respondWithStatusCode(_0x3094bd,_0x5dff7e){_0x5dff7e=_0x5dff7e||0xcc;return function(_0x40d579){if(_0x40d579){return _0x3094bd[_0x9bf1('0x1c')](_0x5dff7e);}return _0x3094bd['status'](_0x5dff7e)[_0x9bf1('0x1d')]();};}function respondWithResult(_0x80f5ff,_0x2f9785){_0x2f9785=_0x2f9785||0xc8;return function(_0x172fed){if(_0x172fed){return _0x80f5ff[_0x9bf1('0x1e')](_0x2f9785)[_0x9bf1('0x1f')](_0x172fed);}};}function respondWithFilteredResult(_0x196be1,_0x22b297){return function(_0x40d74f){if(_0x40d74f){var _0x1f2b5a=typeof _0x22b297['offset']===_0x9bf1('0x20')&&typeof _0x22b297[_0x9bf1('0x21')]==='undefined';var _0x1be0b4=_0x40d74f[_0x9bf1('0x22')];var _0x3ea9a2=_0x1f2b5a?0x0:_0x22b297[_0x9bf1('0x23')];var _0x4e7880=_0x1f2b5a?_0x40d74f['count']:_0x22b297[_0x9bf1('0x23')]+_0x22b297['limit'];var _0x416c34;if(_0x4e7880>=_0x1be0b4){_0x4e7880=_0x1be0b4;_0x416c34=0xc8;}else{_0x416c34=0xce;}_0x196be1[_0x9bf1('0x1e')](_0x416c34);return _0x196be1[_0x9bf1('0x24')](_0x9bf1('0x25'),_0x3ea9a2+'-'+_0x4e7880+'/'+_0x1be0b4)['json'](_0x40d74f);}return null;};}function patchUpdates(_0x26051f){return function(_0x26c441){try{jsonpatch[_0x9bf1('0x26')](_0x26c441,_0x26051f,!![]);}catch(_0x56d1cc){return BPromise[_0x9bf1('0x27')](_0x56d1cc);}return _0x26c441[_0x9bf1('0x28')]();};}function saveUpdates(_0x50b55d,_0x5854ce){return function(_0x569aa7){if(_0x569aa7){return _0x569aa7[_0x9bf1('0x29')](_0x50b55d)[_0x9bf1('0x2a')](function(_0x242582){return _0x242582;});}return null;};}function removeEntity(_0x483512,_0x32cc2c){return function(_0x42bc57){if(_0x42bc57){return _0x42bc57[_0x9bf1('0x2b')]()[_0x9bf1('0x2a')](function(){_0x483512[_0x9bf1('0x1e')](0xcc)[_0x9bf1('0x1d')]();});}};}function handleEntityNotFound(_0x363caa,_0x52f40d){return function(_0x38f3e8){if(!_0x38f3e8){_0x363caa[_0x9bf1('0x1c')](0x194);}return _0x38f3e8;};}function handleError(_0x279b65,_0x44a0d1){_0x44a0d1=_0x44a0d1||0x1f4;return function(_0x44071f){logger[_0x9bf1('0x2c')](_0x44071f[_0x9bf1('0x2d')]);if(_0x44071f[_0x9bf1('0x2e')]){delete _0x44071f[_0x9bf1('0x2e')];}_0x279b65[_0x9bf1('0x1e')](_0x44a0d1)[_0x9bf1('0x2f')](_0x44071f);};}exports[_0x9bf1('0x30')]=function(_0x2d87ef,_0x13dfb1){var _0x47dd9a={},_0x1393d2={},_0x38fc14={'count':0x0,'rows':[]};var _0x3f1a8c=_[_0x9bf1('0x31')](db[_0x9bf1('0x32')][_0x9bf1('0x33')],function(_0x2e9cec){return{'name':_0x2e9cec[_0x9bf1('0x34')],'type':_0x2e9cec[_0x9bf1('0x35')][_0x9bf1('0x36')]};});_0x1393d2['model']=_[_0x9bf1('0x31')](_0x3f1a8c,_0x9bf1('0x2e'));_0x1393d2['query']=_[_0x9bf1('0x37')](_0x2d87ef[_0x9bf1('0x38')]);_0x1393d2[_0x9bf1('0x39')]=_[_0x9bf1('0x3a')](_0x1393d2[_0x9bf1('0x3b')],_0x1393d2[_0x9bf1('0x38')]);_0x47dd9a[_0x9bf1('0x3c')]=_[_0x9bf1('0x3a')](_0x1393d2['model'],qs['fields'](_0x2d87ef[_0x9bf1('0x38')][_0x9bf1('0x3d')]));_0x47dd9a['attributes']=_0x47dd9a['attributes'][_0x9bf1('0x3e')]?_0x47dd9a[_0x9bf1('0x3c')]:_0x1393d2[_0x9bf1('0x3b')];if(!_0x2d87ef[_0x9bf1('0x38')][_0x9bf1('0x3f')](_0x9bf1('0x40'))){_0x47dd9a[_0x9bf1('0x21')]=qs[_0x9bf1('0x21')](_0x2d87ef['query'][_0x9bf1('0x21')]);_0x47dd9a[_0x9bf1('0x23')]=qs['offset'](_0x2d87ef[_0x9bf1('0x38')]['offset']);}_0x47dd9a[_0x9bf1('0x41')]=qs[_0x9bf1('0x42')](_0x2d87ef[_0x9bf1('0x38')]['sort']);_0x47dd9a[_0x9bf1('0x43')]=qs[_0x9bf1('0x39')](_[_0x9bf1('0x44')](_0x2d87ef['query'],_0x1393d2[_0x9bf1('0x39')]),_0x3f1a8c);if(_0x2d87ef['query']['filter']){_0x47dd9a[_0x9bf1('0x43')]=_[_0x9bf1('0x45')](_0x47dd9a[_0x9bf1('0x43')],{'$or':_[_0x9bf1('0x31')](_0x3f1a8c,function(_0x2cdf81){if(_0x2cdf81[_0x9bf1('0x35')]!==_0x9bf1('0x46')){var _0x30a6bf={};_0x30a6bf[_0x2cdf81['name']]={'$like':'%'+_0x2d87ef[_0x9bf1('0x38')][_0x9bf1('0x47')]+'%'};return _0x30a6bf;}})});}_0x47dd9a=_[_0x9bf1('0x45')]({},_0x47dd9a,_0x2d87ef[_0x9bf1('0x48')]);var _0x36e2ee={'where':_0x47dd9a[_0x9bf1('0x43')]};return db[_0x9bf1('0x32')][_0x9bf1('0x22')](_0x36e2ee)['then'](function(_0x4f3dd4){_0x38fc14[_0x9bf1('0x22')]=_0x4f3dd4;if(_0x2d87ef['query'][_0x9bf1('0x49')]){_0x47dd9a[_0x9bf1('0x4a')]=[{'all':!![]}];}return db[_0x9bf1('0x32')][_0x9bf1('0x4b')](_0x47dd9a);})['then'](function(_0x164c88){_0x38fc14[_0x9bf1('0x4c')]=_0x164c88;return _0x38fc14;})[_0x9bf1('0x2a')](respondWithFilteredResult(_0x13dfb1,_0x47dd9a))[_0x9bf1('0x4d')](handleError(_0x13dfb1,null));};exports[_0x9bf1('0x4e')]=function(_0x17bee0,_0x3fbc7e){var _0x3602e6={'raw':![],'where':{'id':_0x17bee0[_0x9bf1('0x4f')]['id']}},_0x337d39={};_0x337d39['model']=_[_0x9bf1('0x37')](db['ZohoAccount'][_0x9bf1('0x33')]);_0x337d39[_0x9bf1('0x38')]=_[_0x9bf1('0x37')](_0x17bee0[_0x9bf1('0x38')]);_0x337d39['filters']=_[_0x9bf1('0x3a')](_0x337d39['model'],_0x337d39['query']);_0x3602e6[_0x9bf1('0x3c')]=_[_0x9bf1('0x3a')](_0x337d39[_0x9bf1('0x3b')],qs[_0x9bf1('0x3d')](_0x17bee0[_0x9bf1('0x38')]['fields']));_0x3602e6[_0x9bf1('0x3c')]=_0x3602e6[_0x9bf1('0x3c')][_0x9bf1('0x3e')]?_0x3602e6[_0x9bf1('0x3c')]:_0x337d39[_0x9bf1('0x3b')];if(_0x17bee0[_0x9bf1('0x38')][_0x9bf1('0x49')]){_0x3602e6[_0x9bf1('0x4a')]=[{'all':!![]}];}_0x3602e6=_[_0x9bf1('0x45')]({},_0x3602e6,_0x17bee0[_0x9bf1('0x48')]);return db[_0x9bf1('0x32')][_0x9bf1('0x50')](_0x3602e6)['then'](handleEntityNotFound(_0x3fbc7e,null))['then'](respondWithResult(_0x3fbc7e,null))[_0x9bf1('0x4d')](handleError(_0x3fbc7e,null));};exports['create']=function(_0x1503bf,_0x4adab2){return db['ZohoAccount'][_0x9bf1('0x51')](_0x1503bf[_0x9bf1('0x52')],{})[_0x9bf1('0x2a')](respondWithResult(_0x4adab2,0xc9))[_0x9bf1('0x4d')](handleError(_0x4adab2,null));};exports['update']=function(_0x471487,_0x3d0502){if(_0x471487[_0x9bf1('0x52')]['id']){delete _0x471487[_0x9bf1('0x52')]['id'];}return db[_0x9bf1('0x32')][_0x9bf1('0x50')]({'where':{'id':_0x471487[_0x9bf1('0x4f')]['id']}})[_0x9bf1('0x2a')](handleEntityNotFound(_0x3d0502,null))['then'](saveUpdates(_0x471487[_0x9bf1('0x52')],null))[_0x9bf1('0x2a')](respondWithResult(_0x3d0502,null))[_0x9bf1('0x4d')](handleError(_0x3d0502,null));};exports[_0x9bf1('0x2b')]=function(_0x5afb2c,_0x3e5590){return db[_0x9bf1('0x32')][_0x9bf1('0x50')]({'where':{'id':_0x5afb2c[_0x9bf1('0x4f')]['id']}})[_0x9bf1('0x2a')](handleEntityNotFound(_0x3e5590,null))[_0x9bf1('0x2a')](removeEntity(_0x3e5590,null))[_0x9bf1('0x4d')](handleError(_0x3e5590,null));};exports['getConfigurations']=function(_0xcaf5be,_0x516b84,_0x3fb306){var _0x508ee7={};var _0x53564f={};var _0x7a13af;var _0x374b85;return db[_0x9bf1('0x32')][_0x9bf1('0x53')]({'where':{'id':_0xcaf5be[_0x9bf1('0x4f')]['id']}})[_0x9bf1('0x2a')](handleEntityNotFound(_0x516b84,null))['then'](function(_0x5bc617){if(_0x5bc617){_0x7a13af=_0x5bc617;_0x53564f[_0x9bf1('0x3b')]=_[_0x9bf1('0x37')](db['ZohoConfiguration'][_0x9bf1('0x33')]);_0x53564f[_0x9bf1('0x38')]=_[_0x9bf1('0x37')](_0xcaf5be[_0x9bf1('0x38')]);_0x53564f['filters']=_['intersection'](_0x53564f[_0x9bf1('0x3b')],_0x53564f[_0x9bf1('0x38')]);_0x508ee7[_0x9bf1('0x3c')]=_[_0x9bf1('0x3a')](_0x53564f[_0x9bf1('0x3b')],qs['fields'](_0xcaf5be[_0x9bf1('0x38')][_0x9bf1('0x3d')]));_0x508ee7['attributes']=_0x508ee7[_0x9bf1('0x3c')][_0x9bf1('0x3e')]?_0x508ee7[_0x9bf1('0x3c')]:_0x53564f[_0x9bf1('0x3b')];_0x508ee7[_0x9bf1('0x41')]=qs[_0x9bf1('0x42')](_0xcaf5be[_0x9bf1('0x38')][_0x9bf1('0x42')]);_0x508ee7[_0x9bf1('0x43')]=qs['filters'](_['pick'](_0xcaf5be[_0x9bf1('0x38')],_0x53564f[_0x9bf1('0x39')]));if(_0xcaf5be[_0x9bf1('0x38')]['filter']){_0x508ee7['where']=_['merge'](_0x508ee7[_0x9bf1('0x43')],{'$or':_['map'](_0x508ee7[_0x9bf1('0x3c')],function(_0x4e6852){var _0x564e2d={};_0x564e2d[_0x4e6852]={'$like':'%'+_0xcaf5be[_0x9bf1('0x38')][_0x9bf1('0x47')]+'%'};return _0x564e2d;})});}_0x508ee7=_[_0x9bf1('0x45')]({},_0x508ee7,_0xcaf5be['options']);return _0x7a13af[_0x9bf1('0x54')](_0x508ee7);}})[_0x9bf1('0x2a')](function(_0x4abc17){if(_0x4abc17){_0x374b85=_0x4abc17[_0x9bf1('0x3e')];if(!_0xcaf5be['query'][_0x9bf1('0x3f')](_0x9bf1('0x40'))){_0x508ee7['limit']=qs[_0x9bf1('0x21')](_0xcaf5be['query'][_0x9bf1('0x21')]);_0x508ee7['offset']=qs[_0x9bf1('0x23')](_0xcaf5be['query'][_0x9bf1('0x23')]);}return _0x7a13af[_0x9bf1('0x54')](_0x508ee7);}})[_0x9bf1('0x2a')](function(_0x5371de){if(_0x5371de){return _0x5371de?{'count':_0x374b85,'rows':_0x5371de}:null;}})[_0x9bf1('0x2a')](respondWithResult(_0x516b84,null))[_0x9bf1('0x4d')](handleError(_0x516b84,null));};exports[_0x9bf1('0x55')]=function(_0x2b1e0c,_0xebfb3b,_0x51194e){if(_0x2b1e0c['body']['id']){delete _0x2b1e0c[_0x9bf1('0x52')]['id'];}return db['ZohoAccount'][_0x9bf1('0x53')]({'where':{'id':_0x2b1e0c[_0x9bf1('0x4f')]['id']}})[_0x9bf1('0x2a')](handleEntityNotFound(_0xebfb3b,null))[_0x9bf1('0x2a')](function(_0x324081){if(_0x324081){_0x2b1e0c['body'][_0x9bf1('0x56')]=_0x324081['id'];_0x2b1e0c['body'][_0x9bf1('0x57')]=integrations[_0x9bf1('0x58')](_0x2b1e0c[_0x9bf1('0x52')][_0x9bf1('0x59')],_0x2b1e0c[_0x9bf1('0x52')][_0x9bf1('0x35')]);_0x2b1e0c[_0x9bf1('0x52')]['Descriptions']=integrations[_0x9bf1('0x5a')](_0x2b1e0c[_0x9bf1('0x52')][_0x9bf1('0x59')],_0x2b1e0c['body']['type']);return db[_0x9bf1('0x5b')]['create'](_0x2b1e0c[_0x9bf1('0x52')],{'include':[{'model':db[_0x9bf1('0x5c')],'as':_0x9bf1('0x57')},{'model':db[_0x9bf1('0x5c')],'as':_0x9bf1('0x5d')}]});}return null;})[_0x9bf1('0x2a')](respondWithResult(_0xebfb3b,null))['catch'](handleError(_0xebfb3b,null));};function getAccessToken(_0x4ae54e){return new Promise(function(_0x3b9e6c,_0xd77c08){var _0x4b6407;switch(_0x4ae54e['zone']){case'US':_0x4b6407=_0x9bf1('0x5e');break;case'AU':_0x4b6407='https://accounts.zoho.com.au';break;case'EU':_0x4b6407=_0x9bf1('0x5f');break;case'IN':_0x4b6407='https://accounts.zoho.in';break;case'CN':_0x4b6407=_0x9bf1('0x60');break;default:_0x4b6407='https://accounts.zoho.eu';break;}var _0x16e54d={'method':_0x9bf1('0x61'),'uri':_0x4b6407+_0x9bf1('0x62'),'qs':{'refresh_token':_0x4ae54e[_0x9bf1('0x63')],'client_id':_0x4ae54e[_0x9bf1('0x64')],'client_secret':_0x4ae54e['clientSecret'],'grant_type':_0x9bf1('0x65')},'json':!![]};return rp(_0x16e54d)['then'](function(_0xd31859){if(_0xd31859[_0x9bf1('0x66')]){_0x3b9e6c(_0xd31859[_0x9bf1('0x66')]);}else{_0xd77c08('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x4b9e18){_0xd77c08(_0x4b9e18);});});}exports[_0x9bf1('0x67')]=function(_0x336d42,_0x2219f4,_0x2c135c){var _0x36127f,_0x42c24f,_0x1bb659,_0x3d7bef,_0x3a152b;return db[_0x9bf1('0x32')][_0x9bf1('0x53')]({'where':{'id':_0x336d42[_0x9bf1('0x4f')]['id']},'attributes':['id',_0x9bf1('0x68'),_0x9bf1('0x69'),'clientId','clientSecret','serverUrl',_0x9bf1('0x6a'),_0x9bf1('0x63')]})[_0x9bf1('0x2a')](handleEntityNotFound(_0x2219f4,null))[_0x9bf1('0x2a')](function(_0x27cb24){_0x3a152b=_0x27cb24;_0x36127f=_0x3a152b[_0x9bf1('0x68')];_0x42c24f=_0x36127f===_0x9bf1('0x6b')?'eu':_0x9bf1('0x6c');_0x1bb659=_0x3a152b['serverUrl'];var _0x3f8e87=_0x1bb659[_0x9bf1('0x6d')](-0x1);if(_0x3f8e87==='/'||_0x3f8e87==='\x5c'||_0x3f8e87===':'){_0x1bb659=_0x1bb659['substring'](0x0,_0x1bb659[_0x9bf1('0x6e')](_0x3f8e87));}if(!_0x3a152b[_0x9bf1('0x63')]){throw new Error(_0x9bf1('0x6f'));}return getAccessToken(_0x3a152b);})[_0x9bf1('0x2a')](function(_0x17a7bf){if(_0x17a7bf){return rp({'method':_0x9bf1('0x70'),'uri':util[_0x9bf1('0x71')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x42c24f),'qs':{'module':_0x9bf1('0x72')},'headers':{'Authorization':_0x9bf1('0x73')+_0x17a7bf},'json':!![]});}})[_0x9bf1('0x2a')](function(_0x264cad){if(_0x264cad){if(_0x264cad[_0x9bf1('0x74')]&&_0x264cad['response'][_0x9bf1('0x2c')]){throw new Error(_0x264cad[_0x9bf1('0x74')]['error'][_0x9bf1('0x75')]);}var _0x230ea0=[];var _0x300a61=[];var _0x4db0e2=[_0x9bf1('0x76'),_0x9bf1('0x77'),_0x9bf1('0x78'),_0x9bf1('0x79'),'Call_Duration',_0x9bf1('0x7a'),_0x9bf1('0x7b'),'Call_Type'];_0x300a61=_[_0x9bf1('0x7c')](_0x264cad[_0x9bf1('0x3d')],function(_0x1a54d6){return _0x4db0e2['includes'](_0x1a54d6['api_name']);});for(var _0x52174e=0x0;_0x52174e<_0x300a61[_0x9bf1('0x3e')];_0x52174e++){if(_0x300a61[_0x52174e][_0x9bf1('0x7d')]===![]){_0x230ea0[_0x9bf1('0x7e')]({'id':_0x300a61[_0x52174e]['id'],'name':_0x300a61[_0x52174e][_0x9bf1('0x7f')],'custom':_0x300a61[_0x52174e][_0x9bf1('0x80')],'options':_0x300a61[_0x52174e][_0x9bf1('0x81')]===_0x9bf1('0x82')&&_0x300a61[_0x52174e][_0x9bf1('0x83')][_0x9bf1('0x3e')]>-0x1?_[_0x9bf1('0x31')](_0x300a61[_0x52174e]['pick_list_values'],function(_0x4c32c8){return{'name':_0x4c32c8,'value':_0x4c32c8};}):[]});}}return{'count':_0x230ea0[_0x9bf1('0x3e')],'rows':_0x230ea0};}else{return{'count':0x0,'rows':[]};}})[_0x9bf1('0x2a')](respondWithResult(_0x2219f4,null))['catch'](function(_0xf42565){var _0x158c6f=_0x336d42['query']['test']?0x1f4:_0xf42565['statusCode']||0x1f4;logger[_0x9bf1('0x2c')](_0x9bf1('0x84'),_0x9bf1('0x67'),_0x158c6f,JSON[_0x9bf1('0x85')](_0xf42565));delete _0xf42565[_0x9bf1('0x2e')];if(_0x158c6f===0x191){_0x158c6f=0x190;}_0x2219f4[_0x9bf1('0x1e')](_0x158c6f)['send'](_0x336d42[_0x9bf1('0x38')][_0x9bf1('0x86')]?{'message':_0x9bf1('0x87'),'statusCode':_0xf42565[_0x9bf1('0x88')]}:_0xf42565);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e80710a..f47fc89 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 _0x1fce=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','substring','https://accounts.zoho.com.au','/oauth/v2/token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1fce,0x1a6));var _0xe1fc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1fce[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xe1fc('0x0'));var logger=require(_0xe1fc('0x1'))(_0xe1fc('0x2'));var moment=require(_0xe1fc('0x3'));var BPromise=require(_0xe1fc('0x4'));var rp=require(_0xe1fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1fc('0x6'));var config=require(_0xe1fc('0x7'));var attributes=require(_0xe1fc('0x8'));var integrations=require(_0xe1fc('0x9'));module[_0xe1fc('0xa')]=function(_0x5b4794,_0x299dd0){return _0x5b4794[_0xe1fc('0xb')]('ZohoAccount',attributes,{'tableName':_0xe1fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b5b53,_0x3a92ae,_0x32dfa2){if(_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0xe'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0xf'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x10'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x11'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x12'))||_0x1b5b53[_0xe1fc('0xd')](_0xe1fc('0x13'))){var _0x558238,_0x1c54f2;_0x558238=_0x1b5b53[_0xe1fc('0xf')];var _0x2bf671=_0x558238['slice'](-0x1);if(_0x2bf671==='/'||_0x2bf671==='\x5c'||_0x2bf671===':'){_0x558238=_0x558238['substring'](0x0,_0x558238[_0xe1fc('0x14')](_0x2bf671));}switch(_0x1b5b53[_0xe1fc('0xe')]){case'US':_0x1c54f2=_0xe1fc('0x15');break;case'AU':_0x1c54f2='https://accounts.zoho.com.au';break;case'IN':_0x1c54f2=_0xe1fc('0x16');break;case'CN':_0x1c54f2=_0xe1fc('0x17');break;default:_0x1c54f2=_0xe1fc('0x18');break;}var _0x16699b={'method':_0xe1fc('0x19'),'uri':_0x1c54f2+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1b5b53[_0xe1fc('0x10')],'client_secret':_0x1b5b53['clientSecret'],'redirect_uri':_0x1b5b53[_0xe1fc('0xf')],'code':_0x1b5b53[_0xe1fc('0x12')]},'headers':{'Content-Type':_0xe1fc('0x1a')}};return rp(_0x16699b)[_0xe1fc('0x1b')](function(_0xdd5d4){var _0x315195=JSON[_0xe1fc('0x1c')](_0xdd5d4);if(_0x315195[_0xe1fc('0x1d')]){_0x1b5b53[_0xe1fc('0x1e')]=_0x315195[_0xe1fc('0x1d')];logger['info'](util[_0xe1fc('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b5b53['name'],_0x1b5b53['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1b5b53['name'],_0x1b5b53['id']),util['inspect'](_0x315195,{'showHidden':![],'depth':null}));}return _0x32dfa2(null,_0x3a92ae);})[_0xe1fc('0x20')](function(_0x446f94){logger['error'](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0x1b5b53['name'],_0x1b5b53['id']),util[_0xe1fc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x32dfa2(_0x446f94);});}else{return _0x32dfa2(null,_0x3a92ae);}},'beforeUpdate':function(_0xc5cec8,_0x383faa,_0x39efa4){if(_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0xe'))||_0xc5cec8['changed']('serverUrl')||_0xc5cec8[_0xe1fc('0xd')]('clientId')||_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0x11'))||_0xc5cec8[_0xe1fc('0xd')](_0xe1fc('0x12'))||_0xc5cec8[_0xe1fc('0xd')]('host')){var _0x4bc3e6,_0x467fca;_0x4bc3e6=_0xc5cec8['serverUrl'];var _0x537483=_0x4bc3e6[_0xe1fc('0x23')](-0x1);if(_0x537483==='/'||_0x537483==='\x5c'||_0x537483===':'){_0x4bc3e6=_0x4bc3e6[_0xe1fc('0x24')](0x0,_0x4bc3e6['lastIndexOf'](_0x537483));}switch(_0xc5cec8[_0xe1fc('0xe')]){case'US':_0x467fca='https://accounts.zoho.com';break;case'AU':_0x467fca=_0xe1fc('0x25');break;case'IN':_0x467fca=_0xe1fc('0x16');break;case'CN':_0x467fca=_0xe1fc('0x17');break;default:_0x467fca=_0xe1fc('0x18');break;}var _0x466f8a={'method':_0xe1fc('0x19'),'uri':_0x467fca+_0xe1fc('0x26'),'form':{'grant_type':'authorization_code','client_id':_0xc5cec8[_0xe1fc('0x10')],'client_secret':_0xc5cec8[_0xe1fc('0x11')],'redirect_uri':_0xc5cec8[_0xe1fc('0xf')],'code':_0xc5cec8[_0xe1fc('0x12')]},'headers':{'Content-Type':_0xe1fc('0x1a')}};return rp(_0x466f8a)[_0xe1fc('0x1b')](function(_0x319f6e){var _0x444a57=JSON[_0xe1fc('0x1c')](_0x319f6e);if(_0x444a57['refresh_token']){_0xc5cec8[_0xe1fc('0x1e')]=_0x444a57[_0xe1fc('0x1d')];logger[_0xe1fc('0x27')](util[_0xe1fc('0x1f')](_0xe1fc('0x28'),_0xc5cec8[_0xe1fc('0x29')],_0xc5cec8['id']));}else{logger['error'](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0xc5cec8['name'],_0xc5cec8['id']),util[_0xe1fc('0x22')](_0x444a57,{'showHidden':![],'depth':null}));}return _0x39efa4(null,_0x383faa);})[_0xe1fc('0x20')](function(_0x5294a2){logger[_0xe1fc('0x2a')](util[_0xe1fc('0x1f')](_0xe1fc('0x21'),_0xc5cec8[_0xe1fc('0x29')],_0xc5cec8['id']),util[_0xe1fc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x39efa4(_0x5294a2);});}else{return _0x39efa4(null,_0x383faa);}}}});}; \ No newline at end of file +var _0xdf9d=['then','catch','inspect','lodash','util','../../config/logger','api','moment','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','format','host','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId'];(function(_0x3d6bd1,_0x4ea854){var _0x1a9850=function(_0x257175){while(--_0x257175){_0x3d6bd1['push'](_0x3d6bd1['shift']());}};_0x1a9850(++_0x4ea854);}(_0xdf9d,0x1dc));var _0xddf9=function(_0x22708a,_0x618315){_0x22708a=_0x22708a-0x0;var _0x3c78e0=_0xdf9d[_0x22708a];return _0x3c78e0;};'use strict';var _=require(_0xddf9('0x0'));var util=require(_0xddf9('0x1'));var logger=require(_0xddf9('0x2'))(_0xddf9('0x3'));var moment=require(_0xddf9('0x4'));var BPromise=require('bluebird');var rp=require(_0xddf9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xddf9('0x6'));var integrations=require(_0xddf9('0x7'));module[_0xddf9('0x8')]=function(_0x4ece21,_0x4f5abb){return _0x4ece21[_0xddf9('0x9')](_0xddf9('0xa'),attributes,{'tableName':_0xddf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4331eb,_0x3d43c1,_0x4550b4){if(_0x4331eb[_0xddf9('0xc')](_0xddf9('0xd'))||_0x4331eb['changed'](_0xddf9('0xe'))||_0x4331eb[_0xddf9('0xc')]('clientId')||_0x4331eb[_0xddf9('0xc')]('clientSecret')||_0x4331eb[_0xddf9('0xc')](_0xddf9('0xf'))||_0x4331eb[_0xddf9('0xc')]('host')){var _0x2c4064,_0x36823c;_0x2c4064=_0x4331eb[_0xddf9('0xe')];var _0x2d79cb=_0x2c4064[_0xddf9('0x10')](-0x1);if(_0x2d79cb==='/'||_0x2d79cb==='\x5c'||_0x2d79cb===':'){_0x2c4064=_0x2c4064[_0xddf9('0x11')](0x0,_0x2c4064[_0xddf9('0x12')](_0x2d79cb));}switch(_0x4331eb['zone']){case'US':_0x36823c=_0xddf9('0x13');break;case'AU':_0x36823c=_0xddf9('0x14');break;case'IN':_0x36823c='https://accounts.zoho.in';break;case'CN':_0x36823c='https://accounts.zoho.com.cn';break;default:_0x36823c=_0xddf9('0x15');break;}var _0x405eae={'method':'POST','uri':_0x36823c+_0xddf9('0x16'),'form':{'grant_type':_0xddf9('0x17'),'client_id':_0x4331eb['clientId'],'client_secret':_0x4331eb[_0xddf9('0x18')],'redirect_uri':_0x4331eb['serverUrl'],'code':_0x4331eb[_0xddf9('0xf')]},'headers':{'Content-Type':_0xddf9('0x19')}};return rp(_0x405eae)['then'](function(_0x406c9d){var _0x3e25f5=JSON[_0xddf9('0x1a')](_0x406c9d);if(_0x3e25f5[_0xddf9('0x1b')]){_0x4331eb[_0xddf9('0x1c')]=_0x3e25f5[_0xddf9('0x1b')];logger[_0xddf9('0x1d')](util['format'](_0xddf9('0x1e'),_0x4331eb[_0xddf9('0x1f')],_0x4331eb['id']));}else{logger[_0xddf9('0x20')](util['format'](_0xddf9('0x21'),_0x4331eb[_0xddf9('0x1f')],_0x4331eb['id']),util['inspect'](_0x3e25f5,{'showHidden':![],'depth':null}));}return _0x4550b4(null,_0x3d43c1);})['catch'](function(_0x326d37){logger[_0xddf9('0x20')](util[_0xddf9('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4331eb[_0xddf9('0x1f')],_0x4331eb['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4550b4(_0x326d37);});}else{return _0x4550b4(null,_0x3d43c1);}},'beforeUpdate':function(_0x318cc3,_0x4e1a9e,_0x4cedfc){if(_0x318cc3[_0xddf9('0xc')](_0xddf9('0xd'))||_0x318cc3['changed'](_0xddf9('0xe'))||_0x318cc3[_0xddf9('0xc')]('clientId')||_0x318cc3[_0xddf9('0xc')](_0xddf9('0x18'))||_0x318cc3[_0xddf9('0xc')](_0xddf9('0xf'))||_0x318cc3['changed'](_0xddf9('0x23'))){var _0x201afe,_0x555b00;_0x201afe=_0x318cc3[_0xddf9('0xe')];var _0x29edeb=_0x201afe[_0xddf9('0x10')](-0x1);if(_0x29edeb==='/'||_0x29edeb==='\x5c'||_0x29edeb===':'){_0x201afe=_0x201afe[_0xddf9('0x11')](0x0,_0x201afe[_0xddf9('0x12')](_0x29edeb));}switch(_0x318cc3[_0xddf9('0xd')]){case'US':_0x555b00='https://accounts.zoho.com';break;case'AU':_0x555b00='https://accounts.zoho.com.au';break;case'IN':_0x555b00=_0xddf9('0x24');break;case'CN':_0x555b00=_0xddf9('0x25');break;default:_0x555b00='https://accounts.zoho.eu';break;}var _0x8db7de={'method':_0xddf9('0x26'),'uri':_0x555b00+'/oauth/v2/token','form':{'grant_type':_0xddf9('0x17'),'client_id':_0x318cc3[_0xddf9('0x27')],'client_secret':_0x318cc3[_0xddf9('0x18')],'redirect_uri':_0x318cc3[_0xddf9('0xe')],'code':_0x318cc3[_0xddf9('0xf')]},'headers':{'Content-Type':_0xddf9('0x19')}};return rp(_0x8db7de)[_0xddf9('0x28')](function(_0x161ea1){var _0x14515d=JSON['parse'](_0x161ea1);if(_0x14515d[_0xddf9('0x1b')]){_0x318cc3['refreshToken']=_0x14515d[_0xddf9('0x1b')];logger[_0xddf9('0x1d')](util[_0xddf9('0x22')](_0xddf9('0x1e'),_0x318cc3[_0xddf9('0x1f')],_0x318cc3['id']));}else{logger[_0xddf9('0x20')](util[_0xddf9('0x22')](_0xddf9('0x21'),_0x318cc3['name'],_0x318cc3['id']),util['inspect'](_0x14515d,{'showHidden':![],'depth':null}));}return _0x4cedfc(null,_0x4e1a9e);})[_0xddf9('0x29')](function(_0x6ffd26){logger[_0xddf9('0x20')](util[_0xddf9('0x22')](_0xddf9('0x21'),_0x318cc3[_0xddf9('0x1f')],_0x318cc3['id']),util[_0xddf9('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x4cedfc(_0x6ffd26);});}else{return _0x4cedfc(null,_0x4e1a9e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b334863..b93141e 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 _0x0b7f=['then','info','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','request\x20sent','result','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowZohoAccount','find','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x5bf4fc,_0x1bda13){var _0x265565=function(_0xdd0932){while(--_0xdd0932){_0x5bf4fc['push'](_0x5bf4fc['shift']());}};_0x265565(++_0x1bda13);}(_0x0b7f,0x115));var _0xf0b7=function(_0x489b02,_0x3c3896){_0x489b02=_0x489b02-0x0;var _0xe0a94b=_0x0b7f[_0x489b02];return _0xe0a94b;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')]({'raw':_0x52b27e['options']?_0x52b27e[_0xf0b7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x18')]||null:null,'attributes':_0x52b27e['options']?_0x52b27e['options'][_0xf0b7('0x19')]||null:null,'limit':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x1a')]||null:null,'include':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e[_0xf0b7('0x17')][_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x52b27e[_0xf0b7('0x17')]['include'],function(_0x1b8e95){return{'model':db[_0x1b8e95[_0xf0b7('0x1d')]],'as':_0x1b8e95['as'],'attributes':_0x1b8e95[_0xf0b7('0x19')],'include':_0x1b8e95[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x1b8e95[_0xf0b7('0x1b')],function(_0x4724f1){return{'model':db[_0x4724f1[_0xf0b7('0x1d')]],'as':_0x4724f1['as'],'attributes':_0x4724f1[_0xf0b7('0x19')],'include':_0x4724f1[_0xf0b7('0x1b')]?_['map'](_0x4724f1[_0xf0b7('0x1b')],function(_0x4d0c61){return{'model':db[_0x4d0c61['model']],'as':_0x4d0c61['as'],'attributes':_0x4d0c61[_0xf0b7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf0b7('0xb')](function(_0x3709a5){logger['info'](_0xf0b7('0x14'),_0x52b27e);logger[_0xf0b7('0x1e')](_0xf0b7('0x14'),_0x52b27e,JSON['stringify'](_0x3709a5));_0x153d23(_0x3709a5);})[_0xf0b7('0x1f')](function(_0x2773ce){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0x2773ce[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0x2773ce[_0xf0b7('0x11')]));});});};exports[_0xf0b7('0x20')]=function(_0x3cb0ef){var _0x976a8b=this;return new Promise(function(_0x559510,_0xd89848){return db[_0xf0b7('0x15')][_0xf0b7('0x21')]({'raw':_0x3cb0ef['options']?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x22')]===undefined?!![]:![]:!![],'where':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x18')]||null:null,'attributes':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef[_0xf0b7('0x17')][_0xf0b7('0x19')]||null:null,'include':_0x3cb0ef[_0xf0b7('0x17')]?_0x3cb0ef['options'][_0xf0b7('0x1b')]?_['map'](_0x3cb0ef['options'][_0xf0b7('0x1b')],function(_0x4f14dd){return{'model':db[_0x4f14dd[_0xf0b7('0x1d')]],'as':_0x4f14dd['as'],'attributes':_0x4f14dd[_0xf0b7('0x19')],'include':_0x4f14dd[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x4f14dd['include'],function(_0x4142c9){return{'model':db[_0x4142c9[_0xf0b7('0x1d')]],'as':_0x4142c9['as'],'attributes':_0x4142c9[_0xf0b7('0x19')],'include':_0x4142c9[_0xf0b7('0x1b')]?_['map'](_0x4142c9[_0xf0b7('0x1b')],function(_0x4d47b6){return{'model':db[_0x4d47b6['model']],'as':_0x4d47b6['as'],'attributes':_0x4d47b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a90f6){logger[_0xf0b7('0xc')](_0xf0b7('0x20'),_0x3cb0ef);logger[_0xf0b7('0x1e')](_0xf0b7('0x20'),_0x3cb0ef,JSON[_0xf0b7('0x23')](_0x4a90f6));_0x559510(_0x4a90f6);})[_0xf0b7('0x1f')](function(_0x3b105c){logger[_0xf0b7('0xe')](_0xf0b7('0x20'),_0x3b105c['message'],_0x3cb0ef);_0xd89848(_0x976a8b[_0xf0b7('0xe')](0x1f4,_0x3b105c['message']));});});}; \ No newline at end of file +var _0x8710=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where','attributes','limit','include','model','map','find','ShowZohoAccount','lodash','util','bluebird','randomstring'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8710,0x68));var _0x0871=function(_0x6b7dd1,_0x413973){_0x6b7dd1=_0x6b7dd1-0x0;var _0x485dd1=_0x8710[_0x6b7dd1];return _0x485dd1;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var moment=require('moment');var BPromise=require(_0x0871('0x2'));var rs=require(_0x0871('0x3'));var fs=require('fs');var Redis=require(_0x0871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0871('0x5'));var logger=require(_0x0871('0x6'))('rpc');var config=require(_0x0871('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0871('0x8')][_0x0871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b47f,_0x846dd7,_0x3df2b3){return new BPromise(function(_0x3ed8f4,_0x47dd75){return client[_0x0871('0xa')](_0x18b47f,_0x3df2b3)[_0x0871('0xb')](function(_0x5e9ef){logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,'request\x20sent');logger[_0x0871('0xe')](_0x0871('0xf'),_0x846dd7,_0x0871('0x10'),JSON[_0x0871('0x11')](_0x5e9ef));if(_0x5e9ef[_0x0871('0x12')]){if(_0x5e9ef['error'][_0x0871('0x13')]===0x1f4){logger[_0x0871('0x12')](_0x0871('0xd'),_0x846dd7,_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);return _0x47dd75(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}logger[_0x0871('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x846dd7,_0x5e9ef['error'][_0x0871('0x14')]);return _0x3ed8f4(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}else{logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,_0x0871('0x10'));_0x3ed8f4(_0x5e9ef[_0x0871('0x15')][_0x0871('0x14')]);}})[_0x0871('0x16')](function(_0x4decab){logger[_0x0871('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x846dd7,_0x4decab);_0x47dd75(_0x4decab);});});}exports[_0x0871('0x17')]=function(_0x238d3a){var _0x48eb82=this;return new Promise(function(_0x6036b0,_0x22db5a){return db[_0x0871('0x18')][_0x0871('0x19')]({'raw':_0x238d3a['options']?_0x238d3a['options'][_0x0871('0x1a')]===undefined?!![]:![]:!![],'where':_0x238d3a[_0x0871('0x1b')]?_0x238d3a[_0x0871('0x1b')][_0x0871('0x1c')]||null:null,'attributes':_0x238d3a[_0x0871('0x1b')]?_0x238d3a[_0x0871('0x1b')][_0x0871('0x1d')]||null:null,'limit':_0x238d3a[_0x0871('0x1b')]?_0x238d3a[_0x0871('0x1b')][_0x0871('0x1e')]||null:null,'include':_0x238d3a[_0x0871('0x1b')]?_0x238d3a[_0x0871('0x1b')][_0x0871('0x1f')]?_['map'](_0x238d3a[_0x0871('0x1b')][_0x0871('0x1f')],function(_0x20ca39){return{'model':db[_0x20ca39[_0x0871('0x20')]],'as':_0x20ca39['as'],'attributes':_0x20ca39['attributes'],'include':_0x20ca39[_0x0871('0x1f')]?_[_0x0871('0x21')](_0x20ca39[_0x0871('0x1f')],function(_0x34bea0){return{'model':db[_0x34bea0['model']],'as':_0x34bea0['as'],'attributes':_0x34bea0[_0x0871('0x1d')],'include':_0x34bea0['include']?_[_0x0871('0x21')](_0x34bea0[_0x0871('0x1f')],function(_0x128720){return{'model':db[_0x128720[_0x0871('0x20')]],'as':_0x128720['as'],'attributes':_0x128720[_0x0871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0871('0xb')](function(_0x31b331){logger[_0x0871('0xc')]('GetZohoAccount',_0x238d3a);logger[_0x0871('0xe')](_0x0871('0x17'),_0x238d3a,JSON[_0x0871('0x11')](_0x31b331));_0x6036b0(_0x31b331);})[_0x0871('0x16')](function(_0x35d1f9){logger[_0x0871('0x12')](_0x0871('0x17'),_0x35d1f9[_0x0871('0x14')],_0x238d3a);_0x22db5a(_0x48eb82[_0x0871('0x12')](0x1f4,_0x35d1f9[_0x0871('0x14')]));});});};exports['ShowZohoAccount']=function(_0x153bf0){var _0x1865e7=this;return new Promise(function(_0x3c83ea,_0x3cf265){return db['ZohoAccount'][_0x0871('0x22')]({'raw':_0x153bf0[_0x0871('0x1b')]?_0x153bf0[_0x0871('0x1b')][_0x0871('0x1a')]===undefined?!![]:![]:!![],'where':_0x153bf0['options']?_0x153bf0['options'][_0x0871('0x1c')]||null:null,'attributes':_0x153bf0['options']?_0x153bf0[_0x0871('0x1b')][_0x0871('0x1d')]||null:null,'include':_0x153bf0[_0x0871('0x1b')]?_0x153bf0[_0x0871('0x1b')]['include']?_[_0x0871('0x21')](_0x153bf0[_0x0871('0x1b')][_0x0871('0x1f')],function(_0x8e5e7b){return{'model':db[_0x8e5e7b[_0x0871('0x20')]],'as':_0x8e5e7b['as'],'attributes':_0x8e5e7b[_0x0871('0x1d')],'include':_0x8e5e7b[_0x0871('0x1f')]?_[_0x0871('0x21')](_0x8e5e7b[_0x0871('0x1f')],function(_0x56c1ef){return{'model':db[_0x56c1ef[_0x0871('0x20')]],'as':_0x56c1ef['as'],'attributes':_0x56c1ef[_0x0871('0x1d')],'include':_0x56c1ef['include']?_[_0x0871('0x21')](_0x56c1ef[_0x0871('0x1f')],function(_0x1ebc90){return{'model':db[_0x1ebc90[_0x0871('0x20')]],'as':_0x1ebc90['as'],'attributes':_0x1ebc90[_0x0871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0871('0xb')](function(_0x1b8519){logger[_0x0871('0xc')](_0x0871('0x23'),_0x153bf0);logger[_0x0871('0xe')](_0x0871('0x23'),_0x153bf0,JSON[_0x0871('0x11')](_0x1b8519));_0x3c83ea(_0x1b8519);})[_0x0871('0x16')](function(_0x35cf04){logger[_0x0871('0x12')](_0x0871('0x23'),_0x35cf04[_0x0871('0x14')],_0x153bf0);_0x3cf265(_0x1865e7[_0x0871('0x12')](0x1f4,_0x35cf04['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9629496..02624d6 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 _0x565a=['isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x565a,0xbc));var _0xa565=function(_0x4df6c6,_0x4cddf8){_0x4df6c6=_0x4df6c6-0x0;var _0x2fb6bb=_0x565a[_0x4df6c6];return _0x2fb6bb;};'use strict';var multer=require(_0xa565('0x0'));var util=require(_0xa565('0x1'));var path=require(_0xa565('0x2'));var timeout=require(_0xa565('0x3'));var express=require(_0xa565('0x4'));var router=express[_0xa565('0x5')]();var fs_extra=require(_0xa565('0x6'));var auth=require(_0xa565('0x7'));var interaction=require(_0xa565('0x8'));var config=require(_0xa565('0x9'));var controller=require(_0xa565('0xa'));router[_0xa565('0xb')]('/',auth[_0xa565('0xc')](),controller['index']);router[_0xa565('0xb')]('/:id',auth[_0xa565('0xc')](),controller[_0xa565('0xd')]);router['get'](_0xa565('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xa565('0xb')]('/:id/subjects',auth[_0xa565('0xc')](),controller[_0xa565('0xf')]);router[_0xa565('0xb')](_0xa565('0x10'),auth[_0xa565('0xc')](),controller[_0xa565('0x11')]);router[_0xa565('0x12')]('/',auth['isAuthenticated'](),controller[_0xa565('0x13')]);router[_0xa565('0x14')](_0xa565('0x15'),auth[_0xa565('0xc')](),controller['update']);router[_0xa565('0x16')](_0xa565('0x15'),auth['isAuthenticated'](),controller[_0xa565('0x17')]);module[_0xa565('0x18')]=router; \ No newline at end of file +var _0xc0b0=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/descriptions','getDescriptions','create','put','update','destroy'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xc0b0,0x191));var _0x0c0b=function(_0x11dd18,_0xff3a35){_0x11dd18=_0x11dd18-0x0;var _0x1a83b6=_0xc0b0[_0x11dd18];return _0x1a83b6;};'use strict';var multer=require(_0x0c0b('0x0'));var util=require('util');var path=require(_0x0c0b('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c0b('0x2'));var router=express['Router']();var fs_extra=require(_0x0c0b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0c0b('0x4'));var config=require(_0x0c0b('0x5'));var controller=require(_0x0c0b('0x6'));router['get']('/',auth[_0x0c0b('0x7')](),controller[_0x0c0b('0x8')]);router[_0x0c0b('0x9')](_0x0c0b('0xa'),auth[_0x0c0b('0x7')](),controller[_0x0c0b('0xb')]);router[_0x0c0b('0x9')](_0x0c0b('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x0c0b('0x9')]('/:id/subjects',auth[_0x0c0b('0x7')](),controller['getSubjects']);router['get'](_0x0c0b('0xd'),auth[_0x0c0b('0x7')](),controller[_0x0c0b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0c0b('0xf')]);router[_0x0c0b('0x10')](_0x0c0b('0xa'),auth['isAuthenticated'](),controller[_0x0c0b('0x11')]);router['delete'](_0x0c0b('0xa'),auth[_0x0c0b('0x7')](),controller[_0x0c0b('0x12')]);module[_0x0c0b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 06aa457..dc5beaa 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 _0x4d29=['STRING','sequelize','ENUM','nothing','lead','contact_lead','contact'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x4d29,0x13c));var _0x94d2=function(_0x2a082f,_0x54f442){_0x2a082f=_0x2a082f-0x0;var _0x298453=_0x4d29[_0x2a082f];return _0x298453;};'use strict';var Sequelize=require(_0x94d2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x94d2('0x1')]('lead','contact',_0x94d2('0x2')),'defaultValue':_0x94d2('0x3')},'moduleSearch':{'type':Sequelize[_0x94d2('0x1')](_0x94d2('0x4'),_0x94d2('0x5'),'lead'),'defaultValue':_0x94d2('0x4')},'description':{'type':Sequelize[_0x94d2('0x6')]}}; \ No newline at end of file +var _0x17aa=['lead','contact_lead','contact','STRING','ENUM','nothing'];(function(_0x2ee181,_0x314bca){var _0x5a5d5e=function(_0x9a3267){while(--_0x9a3267){_0x2ee181['push'](_0x2ee181['shift']());}};_0x5a5d5e(++_0x314bca);}(_0x17aa,0x1b9));var _0xa17a=function(_0x2a2a47,_0x3db5f0){_0x2a2a47=_0x2a2a47-0x0;var _0x6edb0f=_0x17aa[_0x2a2a47];return _0x6edb0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa17a('0x0')]},'moduleCreate':{'type':Sequelize[_0xa17a('0x1')]('lead','contact',_0xa17a('0x2')),'defaultValue':_0xa17a('0x3')},'moduleSearch':{'type':Sequelize[_0xa17a('0x1')](_0xa17a('0x4'),_0xa17a('0x5'),_0xa17a('0x3')),'defaultValue':_0xa17a('0x4')},'description':{'type':Sequelize[_0xa17a('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2fed6d4..ca45f7c 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 _0xb0da=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','length','include','find','catch','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb0da,0xc6));var _0xab0d=function(_0x555d8f,_0xc02e67){_0x555d8f=_0x555d8f-0x0;var _0x214bd2=_0xb0da[_0x555d8f];return _0x214bd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab0d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab0d('0x1'));var rp=require(_0xab0d('0x2'));var moment=require('moment');var BPromise=require(_0xab0d('0x3'));var Mustache=require(_0xab0d('0x4'));var util=require(_0xab0d('0x5'));var path=require('path');var sox=require(_0xab0d('0x6'));var csv=require(_0xab0d('0x7'));var ejs=require(_0xab0d('0x8'));var fs=require('fs');var fs_extra=require(_0xab0d('0x9'));var _=require(_0xab0d('0xa'));var squel=require(_0xab0d('0xb'));var crypto=require(_0xab0d('0xc'));var jsforce=require(_0xab0d('0xd'));var deskjs=require(_0xab0d('0xe'));var toCsv=require(_0xab0d('0x7'));var querystring=require(_0xab0d('0xf'));var Papa=require('papaparse');var Redis=require(_0xab0d('0x10'));var authService=require(_0xab0d('0x11'));var qs=require(_0xab0d('0x12'));var as=require(_0xab0d('0x13'));var hardwareService=require(_0xab0d('0x14'));var logger=require(_0xab0d('0x15'))(_0xab0d('0x16'));var utils=require(_0xab0d('0x17'));var config=require(_0xab0d('0x18'));var licenseUtil=require(_0xab0d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4422a3,_0x1bdadc){_0x1bdadc=_0x1bdadc||0xcc;return function(_0x49e72c){if(_0x49e72c){return _0x4422a3['sendStatus'](_0x1bdadc);}return _0x4422a3[_0xab0d('0x1a')](_0x1bdadc)[_0xab0d('0x1b')]();};}function respondWithResult(_0x2b7bff,_0x92eb33){_0x92eb33=_0x92eb33||0xc8;return function(_0x104899){if(_0x104899){return _0x2b7bff[_0xab0d('0x1a')](_0x92eb33)[_0xab0d('0x1c')](_0x104899);}};}function respondWithFilteredResult(_0x3adc8e,_0x3cae3d){return function(_0x26ff88){if(_0x26ff88){var _0x4b937b=typeof _0x3cae3d[_0xab0d('0x1d')]===_0xab0d('0x1e')&&typeof _0x3cae3d[_0xab0d('0x1f')]===_0xab0d('0x1e');var _0x150435=_0x26ff88['count'];var _0x203512=_0x4b937b?0x0:_0x3cae3d[_0xab0d('0x1d')];var _0x4e2eff=_0x4b937b?_0x26ff88[_0xab0d('0x20')]:_0x3cae3d['offset']+_0x3cae3d['limit'];var _0x3da4d9;if(_0x4e2eff>=_0x150435){_0x4e2eff=_0x150435;_0x3da4d9=0xc8;}else{_0x3da4d9=0xce;}_0x3adc8e[_0xab0d('0x1a')](_0x3da4d9);return _0x3adc8e[_0xab0d('0x21')](_0xab0d('0x22'),_0x203512+'-'+_0x4e2eff+'/'+_0x150435)[_0xab0d('0x1c')](_0x26ff88);}return null;};}function patchUpdates(_0x3252ab){return function(_0x4b2557){try{jsonpatch['apply'](_0x4b2557,_0x3252ab,!![]);}catch(_0x12c8b6){return BPromise[_0xab0d('0x23')](_0x12c8b6);}return _0x4b2557[_0xab0d('0x24')]();};}function saveUpdates(_0x2bb7a0,_0x2aab40){return function(_0x599c34){if(_0x599c34){return _0x599c34[_0xab0d('0x25')](_0x2bb7a0)[_0xab0d('0x26')](function(_0x5bd314){return _0x5bd314;});}return null;};}function removeEntity(_0x18de88,_0x420e70){return function(_0x4f8358){if(_0x4f8358){return _0x4f8358[_0xab0d('0x27')]()[_0xab0d('0x26')](function(){_0x18de88[_0xab0d('0x1a')](0xcc)[_0xab0d('0x1b')]();});}};}function handleEntityNotFound(_0x308e93,_0x2129a6){return function(_0x4a16b8){if(!_0x4a16b8){_0x308e93['sendStatus'](0x194);}return _0x4a16b8;};}function handleError(_0x1f492d,_0x886ebd){_0x886ebd=_0x886ebd||0x1f4;return function(_0x2439cc){logger[_0xab0d('0x28')](_0x2439cc[_0xab0d('0x29')]);if(_0x2439cc[_0xab0d('0x2a')]){delete _0x2439cc['name'];}_0x1f492d[_0xab0d('0x1a')](_0x886ebd)[_0xab0d('0x2b')](_0x2439cc);};}exports[_0xab0d('0x2c')]=function(_0x155b47,_0xb4e590){var _0x4a5235={},_0x20de49={},_0x202233={'count':0x0,'rows':[]};var _0xbc75b1=_['map'](db[_0xab0d('0x2d')][_0xab0d('0x2e')],function(_0x4cbed9){return{'name':_0x4cbed9[_0xab0d('0x2f')],'type':_0x4cbed9['type'][_0xab0d('0x30')]};});_0x20de49[_0xab0d('0x31')]=_[_0xab0d('0x32')](_0xbc75b1,_0xab0d('0x2a'));_0x20de49[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x155b47[_0xab0d('0x33')]);_0x20de49['filters']=_[_0xab0d('0x35')](_0x20de49['model'],_0x20de49[_0xab0d('0x33')]);_0x4a5235[_0xab0d('0x36')]=_[_0xab0d('0x35')](_0x20de49['model'],qs[_0xab0d('0x37')](_0x155b47['query'][_0xab0d('0x37')]));_0x4a5235[_0xab0d('0x36')]=_0x4a5235[_0xab0d('0x36')]['length']?_0x4a5235[_0xab0d('0x36')]:_0x20de49[_0xab0d('0x31')];if(!_0x155b47[_0xab0d('0x33')][_0xab0d('0x38')](_0xab0d('0x39'))){_0x4a5235[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x155b47[_0xab0d('0x33')][_0xab0d('0x1f')]);_0x4a5235['offset']=qs[_0xab0d('0x1d')](_0x155b47[_0xab0d('0x33')][_0xab0d('0x1d')]);}_0x4a5235[_0xab0d('0x3a')]=qs[_0xab0d('0x3b')](_0x155b47['query'][_0xab0d('0x3b')]);_0x4a5235[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_[_0xab0d('0x3e')](_0x155b47[_0xab0d('0x33')],_0x20de49[_0xab0d('0x3d')]),_0xbc75b1);if(_0x155b47[_0xab0d('0x33')][_0xab0d('0x3f')]){_0x4a5235[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0x4a5235[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0xbc75b1,function(_0x197618){if(_0x197618[_0xab0d('0x41')]!==_0xab0d('0x42')){var _0x4fbfc6={};_0x4fbfc6[_0x197618[_0xab0d('0x2a')]]={'$like':'%'+_0x155b47[_0xab0d('0x33')]['filter']+'%'};return _0x4fbfc6;}})});}_0x4a5235=_['merge']({},_0x4a5235,_0x155b47[_0xab0d('0x43')]);var _0x2418e8={'where':_0x4a5235[_0xab0d('0x3c')]};return db['ZohoConfiguration'][_0xab0d('0x20')](_0x2418e8)[_0xab0d('0x26')](function(_0x2c2fa0){_0x202233[_0xab0d('0x20')]=_0x2c2fa0;if(_0x155b47[_0xab0d('0x33')][_0xab0d('0x44')]){_0x4a5235['include']=[{'all':!![]}];}return db[_0xab0d('0x2d')][_0xab0d('0x45')](_0x4a5235);})[_0xab0d('0x26')](function(_0x18fea8){_0x202233[_0xab0d('0x46')]=_0x18fea8;return _0x202233;})[_0xab0d('0x26')](respondWithFilteredResult(_0xb4e590,_0x4a5235))['catch'](handleError(_0xb4e590,null));};exports['show']=function(_0x41a798,_0x209b69){var _0x32a616={'raw':![],'where':{'id':_0x41a798[_0xab0d('0x47')]['id']}},_0x4d4d4b={};_0x4d4d4b[_0xab0d('0x31')]=_[_0xab0d('0x34')](db[_0xab0d('0x2d')][_0xab0d('0x2e')]);_0x4d4d4b[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x41a798[_0xab0d('0x33')]);_0x4d4d4b['filters']=_[_0xab0d('0x35')](_0x4d4d4b[_0xab0d('0x31')],_0x4d4d4b['query']);_0x32a616[_0xab0d('0x36')]=_[_0xab0d('0x35')](_0x4d4d4b['model'],qs[_0xab0d('0x37')](_0x41a798['query'][_0xab0d('0x37')]));_0x32a616[_0xab0d('0x36')]=_0x32a616[_0xab0d('0x36')][_0xab0d('0x48')]?_0x32a616['attributes']:_0x4d4d4b[_0xab0d('0x31')];if(_0x41a798[_0xab0d('0x33')][_0xab0d('0x44')]){_0x32a616[_0xab0d('0x49')]=[{'all':!![]}];}_0x32a616=_[_0xab0d('0x40')]({},_0x32a616,_0x41a798[_0xab0d('0x43')]);return db['ZohoConfiguration'][_0xab0d('0x4a')](_0x32a616)[_0xab0d('0x26')](handleEntityNotFound(_0x209b69,null))[_0xab0d('0x26')](respondWithResult(_0x209b69,null))[_0xab0d('0x4b')](handleError(_0x209b69,null));};exports[_0xab0d('0x4c')]=function(_0x22874f,_0x2945d8){return db[_0xab0d('0x2d')][_0xab0d('0x4c')](_0x22874f[_0xab0d('0x4d')],{})[_0xab0d('0x26')](respondWithResult(_0x2945d8,0xc9))[_0xab0d('0x4b')](handleError(_0x2945d8,null));};exports[_0xab0d('0x25')]=function(_0x38f34d,_0x21e824){if(_0x38f34d['body']['id']){delete _0x38f34d[_0xab0d('0x4d')]['id'];}return db[_0xab0d('0x2d')][_0xab0d('0x4a')]({'where':{'id':_0x38f34d[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x21e824,null))[_0xab0d('0x26')](saveUpdates(_0x38f34d['body'],null))[_0xab0d('0x26')](respondWithResult(_0x21e824,null))['catch'](handleError(_0x21e824,null));};exports[_0xab0d('0x27')]=function(_0x57d050,_0x1d22b1){return db['ZohoConfiguration'][_0xab0d('0x4a')]({'where':{'id':_0x57d050[_0xab0d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d22b1,null))['then'](removeEntity(_0x1d22b1,null))[_0xab0d('0x4b')](handleError(_0x1d22b1,null));};exports[_0xab0d('0x4e')]=function(_0x72c070,_0x13446b,_0x373dcf){var _0xa104fa={};var _0x125e2c={};var _0x1c5541;var _0x3e617b;return db[_0xab0d('0x2d')][_0xab0d('0x4f')]({'where':{'id':_0x72c070[_0xab0d('0x47')]['id']}})['then'](handleEntityNotFound(_0x13446b,null))[_0xab0d('0x26')](function(_0x12287c){if(_0x12287c){_0x1c5541=_0x12287c;_0x125e2c['model']=_['keys'](db[_0xab0d('0x50')][_0xab0d('0x2e')]);_0x125e2c[_0xab0d('0x33')]=_[_0xab0d('0x34')](_0x72c070[_0xab0d('0x33')]);_0x125e2c[_0xab0d('0x3d')]=_['intersection'](_0x125e2c[_0xab0d('0x31')],_0x125e2c[_0xab0d('0x33')]);_0xa104fa[_0xab0d('0x36')]=_['intersection'](_0x125e2c[_0xab0d('0x31')],qs[_0xab0d('0x37')](_0x72c070[_0xab0d('0x33')][_0xab0d('0x37')]));_0xa104fa[_0xab0d('0x36')]=_0xa104fa[_0xab0d('0x36')][_0xab0d('0x48')]?_0xa104fa['attributes']:_0x125e2c[_0xab0d('0x31')];_0xa104fa[_0xab0d('0x3a')]=qs['sort'](_0x72c070[_0xab0d('0x33')][_0xab0d('0x3b')]);_0xa104fa[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_[_0xab0d('0x3e')](_0x72c070[_0xab0d('0x33')],_0x125e2c[_0xab0d('0x3d')]));if(_0x72c070[_0xab0d('0x33')][_0xab0d('0x3f')]){_0xa104fa[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0xa104fa[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0xa104fa[_0xab0d('0x36')],function(_0x2b39ab){var _0x45b58e={};_0x45b58e[_0x2b39ab]={'$like':'%'+_0x72c070[_0xab0d('0x33')][_0xab0d('0x3f')]+'%'};return _0x45b58e;})});}_0xa104fa=_[_0xab0d('0x40')]({},_0xa104fa,_0x72c070[_0xab0d('0x43')]);return _0x1c5541[_0xab0d('0x4e')](_0xa104fa);}})['then'](function(_0x5de9dc){if(_0x5de9dc){_0x3e617b=_0x5de9dc[_0xab0d('0x48')];if(!_0x72c070[_0xab0d('0x33')]['hasOwnProperty']('nolimit')){_0xa104fa[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x72c070[_0xab0d('0x33')]['limit']);_0xa104fa[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0x72c070[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x1c5541[_0xab0d('0x4e')](_0xa104fa);}})[_0xab0d('0x26')](function(_0x556df0){if(_0x556df0){return _0x556df0?{'count':_0x3e617b,'rows':_0x556df0}:null;}})[_0xab0d('0x26')](respondWithResult(_0x13446b,null))[_0xab0d('0x4b')](handleError(_0x13446b,null));};exports[_0xab0d('0x51')]=function(_0xda7de0,_0x2fcbd2,_0x20c0eb){var _0x46952={};var _0x54f114={};var _0x56803d;var _0x2eac98;return db['ZohoConfiguration'][_0xab0d('0x4f')]({'where':{'id':_0xda7de0[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x2fcbd2,null))[_0xab0d('0x26')](function(_0x2efc66){if(_0x2efc66){_0x56803d=_0x2efc66;_0x54f114[_0xab0d('0x31')]=_[_0xab0d('0x34')](db[_0xab0d('0x50')][_0xab0d('0x2e')]);_0x54f114['query']=_[_0xab0d('0x34')](_0xda7de0[_0xab0d('0x33')]);_0x54f114['filters']=_['intersection'](_0x54f114[_0xab0d('0x31')],_0x54f114['query']);_0x46952['attributes']=_[_0xab0d('0x35')](_0x54f114[_0xab0d('0x31')],qs[_0xab0d('0x37')](_0xda7de0['query'][_0xab0d('0x37')]));_0x46952[_0xab0d('0x36')]=_0x46952[_0xab0d('0x36')][_0xab0d('0x48')]?_0x46952[_0xab0d('0x36')]:_0x54f114[_0xab0d('0x31')];_0x46952[_0xab0d('0x3a')]=qs[_0xab0d('0x3b')](_0xda7de0[_0xab0d('0x33')][_0xab0d('0x3b')]);_0x46952[_0xab0d('0x3c')]=qs[_0xab0d('0x3d')](_['pick'](_0xda7de0[_0xab0d('0x33')],_0x54f114['filters']));if(_0xda7de0[_0xab0d('0x33')][_0xab0d('0x3f')]){_0x46952[_0xab0d('0x3c')]=_[_0xab0d('0x40')](_0x46952['where'],{'$or':_[_0xab0d('0x32')](_0x46952[_0xab0d('0x36')],function(_0x53d762){var _0x34aafb={};_0x34aafb[_0x53d762]={'$like':'%'+_0xda7de0['query'][_0xab0d('0x3f')]+'%'};return _0x34aafb;})});}_0x46952=_[_0xab0d('0x40')]({},_0x46952,_0xda7de0['options']);return _0x56803d[_0xab0d('0x51')](_0x46952);}})[_0xab0d('0x26')](function(_0x240605){if(_0x240605){_0x2eac98=_0x240605[_0xab0d('0x48')];if(!_0xda7de0[_0xab0d('0x33')][_0xab0d('0x38')]('nolimit')){_0x46952[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0xda7de0['query'][_0xab0d('0x1f')]);_0x46952[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0xda7de0[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x56803d[_0xab0d('0x51')](_0x46952);}})['then'](function(_0x5c8b8c){if(_0x5c8b8c){return _0x5c8b8c?{'count':_0x2eac98,'rows':_0x5c8b8c}:null;}})[_0xab0d('0x26')](respondWithResult(_0x2fcbd2,null))[_0xab0d('0x4b')](handleError(_0x2fcbd2,null));};exports[_0xab0d('0x52')]=function(_0x23ee6c,_0x548b03,_0x5d1d12){var _0x3bc0ff={};var _0x25d5a5={};var _0x59ec8c;var _0xb36aee;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x23ee6c[_0xab0d('0x47')]['id']}})[_0xab0d('0x26')](handleEntityNotFound(_0x548b03,null))[_0xab0d('0x26')](function(_0x297e23){if(_0x297e23){_0x59ec8c=_0x297e23;_0x25d5a5[_0xab0d('0x31')]=_[_0xab0d('0x34')](db['ZohoField'][_0xab0d('0x2e')]);_0x25d5a5['query']=_[_0xab0d('0x34')](_0x23ee6c['query']);_0x25d5a5[_0xab0d('0x3d')]=_[_0xab0d('0x35')](_0x25d5a5['model'],_0x25d5a5[_0xab0d('0x33')]);_0x3bc0ff[_0xab0d('0x36')]=_['intersection'](_0x25d5a5[_0xab0d('0x31')],qs['fields'](_0x23ee6c['query'][_0xab0d('0x37')]));_0x3bc0ff[_0xab0d('0x36')]=_0x3bc0ff[_0xab0d('0x36')][_0xab0d('0x48')]?_0x3bc0ff[_0xab0d('0x36')]:_0x25d5a5[_0xab0d('0x31')];_0x3bc0ff[_0xab0d('0x3a')]=qs['sort'](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x3b')]);_0x3bc0ff[_0xab0d('0x3c')]=qs['filters'](_[_0xab0d('0x3e')](_0x23ee6c[_0xab0d('0x33')],_0x25d5a5[_0xab0d('0x3d')]));if(_0x23ee6c[_0xab0d('0x33')]['filter']){_0x3bc0ff[_0xab0d('0x3c')]=_['merge'](_0x3bc0ff[_0xab0d('0x3c')],{'$or':_[_0xab0d('0x32')](_0x3bc0ff[_0xab0d('0x36')],function(_0x2c7686){var _0x1749c1={};_0x1749c1[_0x2c7686]={'$like':'%'+_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x3f')]+'%'};return _0x1749c1;})});}_0x3bc0ff=_['merge']({},_0x3bc0ff,_0x23ee6c[_0xab0d('0x43')]);return _0x59ec8c[_0xab0d('0x52')](_0x3bc0ff);}})['then'](function(_0x22f090){if(_0x22f090){_0xb36aee=_0x22f090[_0xab0d('0x48')];if(!_0x23ee6c['query'][_0xab0d('0x38')]('nolimit')){_0x3bc0ff[_0xab0d('0x1f')]=qs[_0xab0d('0x1f')](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x1f')]);_0x3bc0ff[_0xab0d('0x1d')]=qs[_0xab0d('0x1d')](_0x23ee6c[_0xab0d('0x33')][_0xab0d('0x1d')]);}return _0x59ec8c[_0xab0d('0x52')](_0x3bc0ff);}})[_0xab0d('0x26')](function(_0x4f6ea0){if(_0x4f6ea0){return _0x4f6ea0?{'count':_0xb36aee,'rows':_0x4f6ea0}:null;}})[_0xab0d('0x26')](respondWithResult(_0x548b03,null))[_0xab0d('0x4b')](handleError(_0x548b03,null));}; \ No newline at end of file +var _0x5f66=['nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','ZohoConfiguration','findAll','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3e2ddf,_0x36f36e){var _0x502df7=function(_0x4f3f72){while(--_0x4f3f72){_0x3e2ddf['push'](_0x3e2ddf['shift']());}};_0x502df7(++_0x36f36e);}(_0x5f66,0x6f));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x65f6('0x0'));var rimraf=require(_0x65f6('0x1'));var zipdir=require(_0x65f6('0x2'));var jsonpatch=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x65f6('0x5'));var util=require(_0x65f6('0x6'));var path=require(_0x65f6('0x7'));var sox=require('sox');var csv=require(_0x65f6('0x8'));var ejs=require(_0x65f6('0x9'));var fs=require('fs');var fs_extra=require(_0x65f6('0xa'));var _=require(_0x65f6('0xb'));var squel=require(_0x65f6('0xc'));var crypto=require(_0x65f6('0xd'));var jsforce=require(_0x65f6('0xe'));var deskjs=require(_0x65f6('0xf'));var toCsv=require(_0x65f6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x65f6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f6('0x12'))(_0x65f6('0x13'));var utils=require(_0x65f6('0x14'));var config=require(_0x65f6('0x15'));var licenseUtil=require(_0x65f6('0x16'));var db=require(_0x65f6('0x17'))['db'];function respondWithStatusCode(_0xc751c1,_0x10509c){_0x10509c=_0x10509c||0xcc;return function(_0xaea62c){if(_0xaea62c){return _0xc751c1[_0x65f6('0x18')](_0x10509c);}return _0xc751c1[_0x65f6('0x19')](_0x10509c)[_0x65f6('0x1a')]();};}function respondWithResult(_0x30254d,_0x4f5979){_0x4f5979=_0x4f5979||0xc8;return function(_0x4206a7){if(_0x4206a7){return _0x30254d['status'](_0x4f5979)['json'](_0x4206a7);}};}function respondWithFilteredResult(_0x1c9f89,_0x3c6b94){return function(_0x4d693d){if(_0x4d693d){var _0x4342a4=typeof _0x3c6b94['offset']===_0x65f6('0x1b')&&typeof _0x3c6b94['limit']===_0x65f6('0x1b');var _0x4dd68c=_0x4d693d['count'];var _0x37badc=_0x4342a4?0x0:_0x3c6b94['offset'];var _0x172d3d=_0x4342a4?_0x4d693d[_0x65f6('0x1c')]:_0x3c6b94[_0x65f6('0x1d')]+_0x3c6b94[_0x65f6('0x1e')];var _0x4512de;if(_0x172d3d>=_0x4dd68c){_0x172d3d=_0x4dd68c;_0x4512de=0xc8;}else{_0x4512de=0xce;}_0x1c9f89[_0x65f6('0x19')](_0x4512de);return _0x1c9f89[_0x65f6('0x1f')](_0x65f6('0x20'),_0x37badc+'-'+_0x172d3d+'/'+_0x4dd68c)[_0x65f6('0x21')](_0x4d693d);}return null;};}function patchUpdates(_0x15b979){return function(_0x5b11cb){try{jsonpatch[_0x65f6('0x22')](_0x5b11cb,_0x15b979,!![]);}catch(_0x128971){return BPromise[_0x65f6('0x23')](_0x128971);}return _0x5b11cb[_0x65f6('0x24')]();};}function saveUpdates(_0x168f42,_0x1fd1a0){return function(_0x3d3740){if(_0x3d3740){return _0x3d3740[_0x65f6('0x25')](_0x168f42)[_0x65f6('0x26')](function(_0x3c0f4c){return _0x3c0f4c;});}return null;};}function removeEntity(_0x582763,_0x3f3f85){return function(_0x1d9080){if(_0x1d9080){return _0x1d9080['destroy']()[_0x65f6('0x26')](function(){_0x582763[_0x65f6('0x19')](0xcc)[_0x65f6('0x1a')]();});}};}function handleEntityNotFound(_0x51a196,_0x15537d){return function(_0x5c70ce){if(!_0x5c70ce){_0x51a196[_0x65f6('0x18')](0x194);}return _0x5c70ce;};}function handleError(_0x47c015,_0x5e9be9){_0x5e9be9=_0x5e9be9||0x1f4;return function(_0xd77565){logger[_0x65f6('0x27')](_0xd77565[_0x65f6('0x28')]);if(_0xd77565[_0x65f6('0x29')]){delete _0xd77565[_0x65f6('0x29')];}_0x47c015['status'](_0x5e9be9)[_0x65f6('0x2a')](_0xd77565);};}exports[_0x65f6('0x2b')]=function(_0x3ec115,_0x2e79e7){var _0xc3bf37={},_0x3e028b={},_0x36195d={'count':0x0,'rows':[]};var _0x1832b2=_[_0x65f6('0x2c')](db['ZohoConfiguration'][_0x65f6('0x2d')],function(_0x236347){return{'name':_0x236347[_0x65f6('0x2e')],'type':_0x236347['type'][_0x65f6('0x2f')]};});_0x3e028b[_0x65f6('0x30')]=_[_0x65f6('0x2c')](_0x1832b2,_0x65f6('0x29'));_0x3e028b[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x3ec115[_0x65f6('0x31')]);_0x3e028b[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x3e028b[_0x65f6('0x30')],_0x3e028b['query']);_0xc3bf37[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x3e028b[_0x65f6('0x30')],qs['fields'](_0x3ec115['query'][_0x65f6('0x36')]));_0xc3bf37[_0x65f6('0x35')]=_0xc3bf37[_0x65f6('0x35')]['length']?_0xc3bf37[_0x65f6('0x35')]:_0x3e028b[_0x65f6('0x30')];if(!_0x3ec115[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x37'))){_0xc3bf37[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x3ec115[_0x65f6('0x31')][_0x65f6('0x1e')]);_0xc3bf37[_0x65f6('0x1d')]=qs['offset'](_0x3ec115['query']['offset']);}_0xc3bf37[_0x65f6('0x38')]=qs[_0x65f6('0x39')](_0x3ec115[_0x65f6('0x31')][_0x65f6('0x39')]);_0xc3bf37[_0x65f6('0x3a')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3b')](_0x3ec115[_0x65f6('0x31')],_0x3e028b[_0x65f6('0x33')]),_0x1832b2);if(_0x3ec115[_0x65f6('0x31')]['filter']){_0xc3bf37[_0x65f6('0x3a')]=_[_0x65f6('0x3c')](_0xc3bf37[_0x65f6('0x3a')],{'$or':_[_0x65f6('0x2c')](_0x1832b2,function(_0x20d262){if(_0x20d262[_0x65f6('0x3d')]!=='VIRTUAL'){var _0x696de4={};_0x696de4[_0x20d262['name']]={'$like':'%'+_0x3ec115[_0x65f6('0x31')][_0x65f6('0x3e')]+'%'};return _0x696de4;}})});}_0xc3bf37=_[_0x65f6('0x3c')]({},_0xc3bf37,_0x3ec115[_0x65f6('0x3f')]);var _0x36d643={'where':_0xc3bf37[_0x65f6('0x3a')]};return db['ZohoConfiguration'][_0x65f6('0x1c')](_0x36d643)['then'](function(_0x195aff){_0x36195d[_0x65f6('0x1c')]=_0x195aff;if(_0x3ec115[_0x65f6('0x31')][_0x65f6('0x40')]){_0xc3bf37[_0x65f6('0x41')]=[{'all':!![]}];}return db[_0x65f6('0x42')][_0x65f6('0x43')](_0xc3bf37);})[_0x65f6('0x26')](function(_0xe24988){_0x36195d[_0x65f6('0x44')]=_0xe24988;return _0x36195d;})[_0x65f6('0x26')](respondWithFilteredResult(_0x2e79e7,_0xc3bf37))[_0x65f6('0x45')](handleError(_0x2e79e7,null));};exports[_0x65f6('0x46')]=function(_0x5d473c,_0x3d5c69){var _0x548296={'raw':![],'where':{'id':_0x5d473c[_0x65f6('0x47')]['id']}},_0x500d74={};_0x500d74[_0x65f6('0x30')]=_[_0x65f6('0x32')](db[_0x65f6('0x42')][_0x65f6('0x2d')]);_0x500d74[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x5d473c['query']);_0x500d74[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x500d74['model'],_0x500d74[_0x65f6('0x31')]);_0x548296[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x500d74['model'],qs['fields'](_0x5d473c[_0x65f6('0x31')][_0x65f6('0x36')]));_0x548296[_0x65f6('0x35')]=_0x548296[_0x65f6('0x35')][_0x65f6('0x48')]?_0x548296['attributes']:_0x500d74['model'];if(_0x5d473c[_0x65f6('0x31')][_0x65f6('0x40')]){_0x548296[_0x65f6('0x41')]=[{'all':!![]}];}_0x548296=_['merge']({},_0x548296,_0x5d473c['options']);return db['ZohoConfiguration'][_0x65f6('0x49')](_0x548296)['then'](handleEntityNotFound(_0x3d5c69,null))['then'](respondWithResult(_0x3d5c69,null))[_0x65f6('0x45')](handleError(_0x3d5c69,null));};exports[_0x65f6('0x4a')]=function(_0x57ed34,_0x14c56b){return db['ZohoConfiguration'][_0x65f6('0x4a')](_0x57ed34[_0x65f6('0x4b')],{})[_0x65f6('0x26')](respondWithResult(_0x14c56b,0xc9))['catch'](handleError(_0x14c56b,null));};exports['update']=function(_0x4a23a4,_0x480d2a){if(_0x4a23a4['body']['id']){delete _0x4a23a4[_0x65f6('0x4b')]['id'];}return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x4a23a4[_0x65f6('0x47')]['id']}})[_0x65f6('0x26')](handleEntityNotFound(_0x480d2a,null))['then'](saveUpdates(_0x4a23a4['body'],null))['then'](respondWithResult(_0x480d2a,null))[_0x65f6('0x45')](handleError(_0x480d2a,null));};exports[_0x65f6('0x4c')]=function(_0x9ef953,_0x3fe709){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x9ef953[_0x65f6('0x47')]['id']}})[_0x65f6('0x26')](handleEntityNotFound(_0x3fe709,null))[_0x65f6('0x26')](removeEntity(_0x3fe709,null))[_0x65f6('0x45')](handleError(_0x3fe709,null));};exports[_0x65f6('0x4d')]=function(_0x23cb81,_0x349eb1,_0x15ed58){var _0x373ce7={};var _0x4e75d8={};var _0x22cba9;var _0x1870a4;return db[_0x65f6('0x42')][_0x65f6('0x4e')]({'where':{'id':_0x23cb81[_0x65f6('0x47')]['id']}})[_0x65f6('0x26')](handleEntityNotFound(_0x349eb1,null))[_0x65f6('0x26')](function(_0x3eca80){if(_0x3eca80){_0x22cba9=_0x3eca80;_0x4e75d8[_0x65f6('0x30')]=_[_0x65f6('0x32')](db[_0x65f6('0x4f')][_0x65f6('0x2d')]);_0x4e75d8[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x23cb81[_0x65f6('0x31')]);_0x4e75d8[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x4e75d8[_0x65f6('0x30')],_0x4e75d8[_0x65f6('0x31')]);_0x373ce7[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x4e75d8[_0x65f6('0x30')],qs[_0x65f6('0x36')](_0x23cb81['query'][_0x65f6('0x36')]));_0x373ce7[_0x65f6('0x35')]=_0x373ce7['attributes'][_0x65f6('0x48')]?_0x373ce7['attributes']:_0x4e75d8[_0x65f6('0x30')];_0x373ce7['order']=qs['sort'](_0x23cb81[_0x65f6('0x31')][_0x65f6('0x39')]);_0x373ce7[_0x65f6('0x3a')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3b')](_0x23cb81['query'],_0x4e75d8[_0x65f6('0x33')]));if(_0x23cb81[_0x65f6('0x31')][_0x65f6('0x3e')]){_0x373ce7['where']=_[_0x65f6('0x3c')](_0x373ce7[_0x65f6('0x3a')],{'$or':_[_0x65f6('0x2c')](_0x373ce7[_0x65f6('0x35')],function(_0x277071){var _0x328b3f={};_0x328b3f[_0x277071]={'$like':'%'+_0x23cb81[_0x65f6('0x31')][_0x65f6('0x3e')]+'%'};return _0x328b3f;})});}_0x373ce7=_[_0x65f6('0x3c')]({},_0x373ce7,_0x23cb81[_0x65f6('0x3f')]);return _0x22cba9['getFields'](_0x373ce7);}})[_0x65f6('0x26')](function(_0x3c04a5){if(_0x3c04a5){_0x1870a4=_0x3c04a5[_0x65f6('0x48')];if(!_0x23cb81[_0x65f6('0x31')][_0x65f6('0x50')](_0x65f6('0x37'))){_0x373ce7['limit']=qs['limit'](_0x23cb81[_0x65f6('0x31')]['limit']);_0x373ce7['offset']=qs['offset'](_0x23cb81[_0x65f6('0x31')]['offset']);}return _0x22cba9[_0x65f6('0x4d')](_0x373ce7);}})[_0x65f6('0x26')](function(_0x5ca1b5){if(_0x5ca1b5){return _0x5ca1b5?{'count':_0x1870a4,'rows':_0x5ca1b5}:null;}})[_0x65f6('0x26')](respondWithResult(_0x349eb1,null))[_0x65f6('0x45')](handleError(_0x349eb1,null));};exports['getSubjects']=function(_0x3a8384,_0x4159c0,_0x4bc5c3){var _0x2f9e29={};var _0x1d9209={};var _0x2989bf;var _0x1555b8;return db[_0x65f6('0x42')][_0x65f6('0x4e')]({'where':{'id':_0x3a8384[_0x65f6('0x47')]['id']}})['then'](handleEntityNotFound(_0x4159c0,null))[_0x65f6('0x26')](function(_0x329395){if(_0x329395){_0x2989bf=_0x329395;_0x1d9209['model']=_[_0x65f6('0x32')](db[_0x65f6('0x4f')][_0x65f6('0x2d')]);_0x1d9209[_0x65f6('0x31')]=_['keys'](_0x3a8384[_0x65f6('0x31')]);_0x1d9209['filters']=_[_0x65f6('0x34')](_0x1d9209[_0x65f6('0x30')],_0x1d9209[_0x65f6('0x31')]);_0x2f9e29['attributes']=_[_0x65f6('0x34')](_0x1d9209[_0x65f6('0x30')],qs[_0x65f6('0x36')](_0x3a8384[_0x65f6('0x31')][_0x65f6('0x36')]));_0x2f9e29[_0x65f6('0x35')]=_0x2f9e29[_0x65f6('0x35')][_0x65f6('0x48')]?_0x2f9e29[_0x65f6('0x35')]:_0x1d9209[_0x65f6('0x30')];_0x2f9e29[_0x65f6('0x38')]=qs['sort'](_0x3a8384[_0x65f6('0x31')][_0x65f6('0x39')]);_0x2f9e29['where']=qs[_0x65f6('0x33')](_[_0x65f6('0x3b')](_0x3a8384[_0x65f6('0x31')],_0x1d9209['filters']));if(_0x3a8384['query']['filter']){_0x2f9e29[_0x65f6('0x3a')]=_[_0x65f6('0x3c')](_0x2f9e29['where'],{'$or':_[_0x65f6('0x2c')](_0x2f9e29[_0x65f6('0x35')],function(_0x44d27c){var _0x35fe54={};_0x35fe54[_0x44d27c]={'$like':'%'+_0x3a8384[_0x65f6('0x31')][_0x65f6('0x3e')]+'%'};return _0x35fe54;})});}_0x2f9e29=_[_0x65f6('0x3c')]({},_0x2f9e29,_0x3a8384[_0x65f6('0x3f')]);return _0x2989bf[_0x65f6('0x51')](_0x2f9e29);}})['then'](function(_0x119c9d){if(_0x119c9d){_0x1555b8=_0x119c9d[_0x65f6('0x48')];if(!_0x3a8384[_0x65f6('0x31')][_0x65f6('0x50')](_0x65f6('0x37'))){_0x2f9e29['limit']=qs['limit'](_0x3a8384[_0x65f6('0x31')][_0x65f6('0x1e')]);_0x2f9e29[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x3a8384[_0x65f6('0x31')]['offset']);}return _0x2989bf['getSubjects'](_0x2f9e29);}})[_0x65f6('0x26')](function(_0x50f99c){if(_0x50f99c){return _0x50f99c?{'count':_0x1555b8,'rows':_0x50f99c}:null;}})[_0x65f6('0x26')](respondWithResult(_0x4159c0,null))['catch'](handleError(_0x4159c0,null));};exports['getDescriptions']=function(_0x58f106,_0x1e77bb,_0x21902a){var _0xbbac9c={};var _0x4cb687={};var _0x4e334d;var _0x5b4fce;return db[_0x65f6('0x42')][_0x65f6('0x4e')]({'where':{'id':_0x58f106[_0x65f6('0x47')]['id']}})[_0x65f6('0x26')](handleEntityNotFound(_0x1e77bb,null))[_0x65f6('0x26')](function(_0x5e405b){if(_0x5e405b){_0x4e334d=_0x5e405b;_0x4cb687[_0x65f6('0x30')]=_[_0x65f6('0x32')](db[_0x65f6('0x4f')][_0x65f6('0x2d')]);_0x4cb687[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x58f106[_0x65f6('0x31')]);_0x4cb687['filters']=_[_0x65f6('0x34')](_0x4cb687[_0x65f6('0x30')],_0x4cb687[_0x65f6('0x31')]);_0xbbac9c['attributes']=_[_0x65f6('0x34')](_0x4cb687[_0x65f6('0x30')],qs['fields'](_0x58f106[_0x65f6('0x31')][_0x65f6('0x36')]));_0xbbac9c[_0x65f6('0x35')]=_0xbbac9c[_0x65f6('0x35')][_0x65f6('0x48')]?_0xbbac9c[_0x65f6('0x35')]:_0x4cb687['model'];_0xbbac9c[_0x65f6('0x38')]=qs[_0x65f6('0x39')](_0x58f106['query'][_0x65f6('0x39')]);_0xbbac9c[_0x65f6('0x3a')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3b')](_0x58f106[_0x65f6('0x31')],_0x4cb687[_0x65f6('0x33')]));if(_0x58f106[_0x65f6('0x31')][_0x65f6('0x3e')]){_0xbbac9c[_0x65f6('0x3a')]=_[_0x65f6('0x3c')](_0xbbac9c[_0x65f6('0x3a')],{'$or':_['map'](_0xbbac9c[_0x65f6('0x35')],function(_0x5c55e6){var _0x30c5d6={};_0x30c5d6[_0x5c55e6]={'$like':'%'+_0x58f106[_0x65f6('0x31')][_0x65f6('0x3e')]+'%'};return _0x30c5d6;})});}_0xbbac9c=_[_0x65f6('0x3c')]({},_0xbbac9c,_0x58f106['options']);return _0x4e334d['getDescriptions'](_0xbbac9c);}})[_0x65f6('0x26')](function(_0x3ac02d){if(_0x3ac02d){_0x5b4fce=_0x3ac02d[_0x65f6('0x48')];if(!_0x58f106[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x37'))){_0xbbac9c[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x58f106[_0x65f6('0x31')]['limit']);_0xbbac9c[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x58f106['query']['offset']);}return _0x4e334d[_0x65f6('0x52')](_0xbbac9c);}})[_0x65f6('0x26')](function(_0x2181b1){if(_0x2181b1){return _0x2181b1?{'count':_0x5b4fce,'rows':_0x2181b1}:null;}})[_0x65f6('0x26')](respondWithResult(_0x1e77bb,null))[_0x65f6('0x45')](handleError(_0x1e77bb,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 582b09c..6679fcc 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 _0x8bfe=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3b0e76,_0x239221){var _0x1e4af4=function(_0x4c1daa){while(--_0x4c1daa){_0x3b0e76['push'](_0x3b0e76['shift']());}};_0x1e4af4(++_0x239221);}(_0x8bfe,0x73));var _0xe8bf=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x8bfe[_0x4350c2];return _0x8b6406;};'use strict';var _=require(_0xe8bf('0x0'));var util=require(_0xe8bf('0x1'));var logger=require(_0xe8bf('0x2'))('api');var moment=require(_0xe8bf('0x3'));var BPromise=require(_0xe8bf('0x4'));var rp=require(_0xe8bf('0x5'));var fs=require('fs');var path=require(_0xe8bf('0x6'));var rimraf=require(_0xe8bf('0x7'));var config=require(_0xe8bf('0x8'));var attributes=require(_0xe8bf('0x9'));module[_0xe8bf('0xa')]=function(_0x54cdc2,_0x4d6ca0){return _0x54cdc2['define']('ZohoConfiguration',attributes,{'tableName':_0xe8bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce40=['path','rimraf','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','api','moment','request-promise'];(function(_0xbd3a4c,_0x2dec21){var _0x61b7e9=function(_0x5d6d88){while(--_0x5d6d88){_0xbd3a4c['push'](_0xbd3a4c['shift']());}};_0x61b7e9(++_0x2dec21);}(_0xce40,0xd8));var _0x0ce4=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0xce40[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require(_0x0ce4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ce4('0x1'));var moment=require(_0x0ce4('0x2'));var BPromise=require('bluebird');var rp=require(_0x0ce4('0x3'));var fs=require('fs');var path=require(_0x0ce4('0x4'));var rimraf=require(_0x0ce4('0x5'));var config=require('../../config/environment');var attributes=require(_0x0ce4('0x6'));module[_0x0ce4('0x7')]=function(_0x2ced36,_0xd334d6){return _0x2ced36[_0x0ce4('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x0ce4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index d6bf52d..0b83cc9 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 _0x36ae=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x24bc4c,_0x2bc7ee){var _0x3a6bf1=function(_0x50149e){while(--_0x50149e){_0x24bc4c['push'](_0x24bc4c['shift']());}};_0x3a6bf1(++_0x2bc7ee);}(_0x36ae,0x161));var _0xe36a=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x36ae[_0x1ff2ec];return _0x405683;};'use strict';var _=require(_0xe36a('0x0'));var util=require(_0xe36a('0x1'));var moment=require(_0xe36a('0x2'));var BPromise=require(_0xe36a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe36a('0x4'));var db=require(_0xe36a('0x5'))['db'];var utils=require(_0xe36a('0x6'));var logger=require(_0xe36a('0x7'))(_0xe36a('0x8'));var config=require(_0xe36a('0x9'));var jayson=require(_0xe36a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1150,_0x83ea88,_0x1bfbbb){return new BPromise(function(_0x90e797,_0x519c8c){return client['request'](_0x2d1150,_0x1bfbbb)[_0xe36a('0xb')](function(_0x1c9cb4){logger[_0xe36a('0xc')](_0xe36a('0xd'),_0x83ea88,_0xe36a('0xe'));logger[_0xe36a('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x83ea88,_0xe36a('0xe'),JSON[_0xe36a('0x10')](_0x1c9cb4));if(_0x1c9cb4[_0xe36a('0x11')]){if(_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x12')]===0x1f4){logger['error'](_0xe36a('0xd'),_0x83ea88,_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x13')]);return _0x519c8c(_0x1c9cb4['error']['message']);}logger[_0xe36a('0x11')](_0xe36a('0xd'),_0x83ea88,_0x1c9cb4['error'][_0xe36a('0x13')]);return _0x90e797(_0x1c9cb4[_0xe36a('0x11')][_0xe36a('0x13')]);}else{logger[_0xe36a('0xc')](_0xe36a('0xd'),_0x83ea88,_0xe36a('0xe'));_0x90e797(_0x1c9cb4[_0xe36a('0x14')][_0xe36a('0x13')]);}})[_0xe36a('0x15')](function(_0x1d65e1){logger[_0xe36a('0x11')](_0xe36a('0xd'),_0x83ea88,_0x1d65e1);_0x519c8c(_0x1d65e1);});});} \ No newline at end of file +var _0x3f1f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','ZohoConfiguration,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18cfb3,_0x4b1c49){var _0x5d0680=function(_0x42bcb3){while(--_0x42bcb3){_0x18cfb3['push'](_0x18cfb3['shift']());}};_0x5d0680(++_0x4b1c49);}(_0x3f1f,0x1f4));var _0xf3f1=function(_0x58b198,_0x5a63c1){_0x58b198=_0x58b198-0x0;var _0x2683bf=_0x3f1f[_0x58b198];return _0x2683bf;};'use strict';var _=require(_0xf3f1('0x0'));var util=require(_0xf3f1('0x1'));var moment=require('moment');var BPromise=require(_0xf3f1('0x2'));var rs=require(_0xf3f1('0x3'));var fs=require('fs');var Redis=require(_0xf3f1('0x4'));var db=require(_0xf3f1('0x5'))['db'];var utils=require(_0xf3f1('0x6'));var logger=require(_0xf3f1('0x7'))(_0xf3f1('0x8'));var config=require(_0xf3f1('0x9'));var jayson=require(_0xf3f1('0xa'));var client=jayson[_0xf3f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3796ca,_0x3617c6,_0x3511aa){return new BPromise(function(_0x423bfe,_0x255112){return client['request'](_0x3796ca,_0x3511aa)[_0xf3f1('0xc')](function(_0xc9746){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3617c6,_0xf3f1('0xd'));logger[_0xf3f1('0xe')](_0xf3f1('0xf'),_0x3617c6,_0xf3f1('0xd'),JSON['stringify'](_0xc9746));if(_0xc9746[_0xf3f1('0x10')]){if(_0xc9746[_0xf3f1('0x10')][_0xf3f1('0x11')]===0x1f4){logger[_0xf3f1('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3617c6,_0xc9746[_0xf3f1('0x10')]['message']);return _0x255112(_0xc9746[_0xf3f1('0x10')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3617c6,_0xc9746['error'][_0xf3f1('0x12')]);return _0x423bfe(_0xc9746[_0xf3f1('0x10')][_0xf3f1('0x12')]);}else{logger[_0xf3f1('0x13')](_0xf3f1('0x14'),_0x3617c6,_0xf3f1('0xd'));_0x423bfe(_0xc9746[_0xf3f1('0x15')]['message']);}})['catch'](function(_0x2fa40b){logger['error'](_0xf3f1('0x14'),_0x3617c6,_0x2fa40b);_0x255112(_0x2fa40b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 922f495..5aabc48 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 _0xd4f4=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4f4,0x1ae));var _0x4d4f=function(_0x1a8a68,_0x5bbc54){_0x1a8a68=_0x1a8a68-0x0;var _0x4e06c1=_0xd4f4[_0x1a8a68];return _0x4e06c1;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require('./intZohoField.controller');router[_0x4d4f('0x9')]('/',auth[_0x4d4f('0xa')](),controller[_0x4d4f('0xb')]);router[_0x4d4f('0x9')](_0x4d4f('0xc'),auth[_0x4d4f('0xa')](),controller[_0x4d4f('0xd')]);router[_0x4d4f('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d4f('0xf')]);router[_0x4d4f('0x10')](_0x4d4f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4d4f('0x11')]('/:id',auth[_0x4d4f('0xa')](),controller[_0x4d4f('0x12')]);module[_0x4d4f('0x13')]=router; \ No newline at end of file +var _0x094d=['create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x094d,0x147));var _0xd094=function(_0x4b5871,_0x34b52f){_0x4b5871=_0x4b5871-0x0;var _0x4f228b=_0x094d[_0x4b5871];return _0x4f228b;};'use strict';var multer=require('multer');var util=require(_0xd094('0x0'));var path=require(_0xd094('0x1'));var timeout=require(_0xd094('0x2'));var express=require(_0xd094('0x3'));var router=express[_0xd094('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd094('0x5'));var interaction=require(_0xd094('0x6'));var config=require(_0xd094('0x7'));var controller=require(_0xd094('0x8'));router[_0xd094('0x9')]('/',auth[_0xd094('0xa')](),controller[_0xd094('0xb')]);router[_0xd094('0x9')](_0xd094('0xc'),auth['isAuthenticated'](),controller[_0xd094('0xd')]);router[_0xd094('0xe')]('/',auth['isAuthenticated'](),controller[_0xd094('0xf')]);router[_0xd094('0x10')](_0xd094('0xc'),auth[_0xd094('0xa')](),controller[_0xd094('0x11')]);router['delete'](_0xd094('0xc'),auth[_0xd094('0xa')](),controller['destroy']);module[_0xd094('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e68f684..dc17f56 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 _0x3092=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x3092,0x10e));var _0x2309=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x3092[_0x12b8ec];return _0x21af77;};'use strict';var Sequelize=require(_0x2309('0x0'));module[_0x2309('0x1')]={'type':{'type':Sequelize[_0x2309('0x2')](_0x2309('0x3'),'variable','customVariable',_0x2309('0x4'),_0x2309('0x5')),'defaultValue':_0x2309('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2309('0x6')]},'keyType':{'type':Sequelize[_0x2309('0x2')](_0x2309('0x3'),_0x2309('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x2309('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2309('0x6')]},'customField':{'type':Sequelize[_0x2309('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2309('0x6')]}}; \ No newline at end of file +var _0x506b=['BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x22ba5e,_0x4f0ae3){var _0x370857=function(_0x213415){while(--_0x213415){_0x22ba5e['push'](_0x22ba5e['shift']());}};_0x370857(++_0x4f0ae3);}(_0x506b,0x1cc));var _0xb506=function(_0x36156b,_0x25cc26){_0x36156b=_0x36156b-0x0;var _0x5db905=_0x506b[_0x36156b];return _0x5db905;};'use strict';var Sequelize=require(_0xb506('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb506('0x1'),_0xb506('0x2'),_0xb506('0x3'),_0xb506('0x4'),_0xb506('0x5')),'defaultValue':_0xb506('0x1')},'content':{'type':Sequelize[_0xb506('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb506('0x7')](_0xb506('0x1'),_0xb506('0x2'),_0xb506('0x3'))},'keyContent':{'type':Sequelize[_0xb506('0x6')]},'idField':{'type':Sequelize[_0xb506('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb506('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb506('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ae7ed3d..7cd17bd 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 _0x3cf3=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','ZohoField','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','create','body','catch'];(function(_0x22d88f,_0x38f325){var _0x996d53=function(_0x9c175){while(--_0x9c175){_0x22d88f['push'](_0x22d88f['shift']());}};_0x996d53(++_0x38f325);}(_0x3cf3,0x128));var _0x33cf=function(_0x516770,_0xb9ffc8){_0x516770=_0x516770-0x0;var _0x5008f8=_0x3cf3[_0x516770];return _0x5008f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33cf('0x0'));var zipdir=require(_0x33cf('0x1'));var jsonpatch=require(_0x33cf('0x2'));var rp=require(_0x33cf('0x3'));var moment=require('moment');var BPromise=require(_0x33cf('0x4'));var Mustache=require(_0x33cf('0x5'));var util=require('util');var path=require(_0x33cf('0x6'));var sox=require(_0x33cf('0x7'));var csv=require(_0x33cf('0x8'));var ejs=require(_0x33cf('0x9'));var fs=require('fs');var fs_extra=require(_0x33cf('0xa'));var _=require(_0x33cf('0xb'));var squel=require(_0x33cf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33cf('0xd'));var toCsv=require(_0x33cf('0x8'));var querystring=require(_0x33cf('0xe'));var Papa=require(_0x33cf('0xf'));var Redis=require(_0x33cf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x33cf('0x11'));var as=require(_0x33cf('0x12'));var hardwareService=require(_0x33cf('0x13'));var logger=require(_0x33cf('0x14'))(_0x33cf('0x15'));var utils=require(_0x33cf('0x16'));var config=require(_0x33cf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33cf('0x18'))['db'];function respondWithStatusCode(_0x33383b,_0x2fa6e8){_0x2fa6e8=_0x2fa6e8||0xcc;return function(_0x52418b){if(_0x52418b){return _0x33383b[_0x33cf('0x19')](_0x2fa6e8);}return _0x33383b[_0x33cf('0x1a')](_0x2fa6e8)['end']();};}function respondWithResult(_0x25f967,_0x21c32e){_0x21c32e=_0x21c32e||0xc8;return function(_0x3c0017){if(_0x3c0017){return _0x25f967[_0x33cf('0x1a')](_0x21c32e)[_0x33cf('0x1b')](_0x3c0017);}};}function respondWithFilteredResult(_0x2bf0ba,_0xdcbdee){return function(_0x4f52a2){if(_0x4f52a2){var _0x1f8494=typeof _0xdcbdee[_0x33cf('0x1c')]===_0x33cf('0x1d')&&typeof _0xdcbdee[_0x33cf('0x1e')]===_0x33cf('0x1d');var _0x32c4e0=_0x4f52a2['count'];var _0xede4b7=_0x1f8494?0x0:_0xdcbdee['offset'];var _0x9526a4=_0x1f8494?_0x4f52a2[_0x33cf('0x1f')]:_0xdcbdee['offset']+_0xdcbdee[_0x33cf('0x1e')];var _0x29054c;if(_0x9526a4>=_0x32c4e0){_0x9526a4=_0x32c4e0;_0x29054c=0xc8;}else{_0x29054c=0xce;}_0x2bf0ba[_0x33cf('0x1a')](_0x29054c);return _0x2bf0ba[_0x33cf('0x20')](_0x33cf('0x21'),_0xede4b7+'-'+_0x9526a4+'/'+_0x32c4e0)[_0x33cf('0x1b')](_0x4f52a2);}return null;};}function patchUpdates(_0x19c2a9){return function(_0x3c0efb){try{jsonpatch[_0x33cf('0x22')](_0x3c0efb,_0x19c2a9,!![]);}catch(_0x160542){return BPromise['reject'](_0x160542);}return _0x3c0efb[_0x33cf('0x23')]();};}function saveUpdates(_0x8382d0,_0x3e7880){return function(_0x195e67){if(_0x195e67){return _0x195e67[_0x33cf('0x24')](_0x8382d0)['then'](function(_0x9b21f3){return _0x9b21f3;});}return null;};}function removeEntity(_0x4a9f3c,_0x277150){return function(_0x16624f){if(_0x16624f){return _0x16624f[_0x33cf('0x25')]()[_0x33cf('0x26')](function(){_0x4a9f3c[_0x33cf('0x1a')](0xcc)[_0x33cf('0x27')]();});}};}function handleEntityNotFound(_0x1f570f,_0x5af06e){return function(_0x1ba988){if(!_0x1ba988){_0x1f570f['sendStatus'](0x194);}return _0x1ba988;};}function handleError(_0x4463af,_0x5f3b2f){_0x5f3b2f=_0x5f3b2f||0x1f4;return function(_0x352cf8){logger[_0x33cf('0x28')](_0x352cf8[_0x33cf('0x29')]);if(_0x352cf8[_0x33cf('0x2a')]){delete _0x352cf8[_0x33cf('0x2a')];}_0x4463af[_0x33cf('0x1a')](_0x5f3b2f)[_0x33cf('0x2b')](_0x352cf8);};}exports[_0x33cf('0x2c')]=function(_0x214263,_0x1ff9bc){var _0x3a1766={},_0x1b07b9={},_0x2a5a56={'count':0x0,'rows':[]};var _0x597672=_[_0x33cf('0x2d')](db[_0x33cf('0x2e')]['rawAttributes'],function(_0x57bb68){return{'name':_0x57bb68[_0x33cf('0x2f')],'type':_0x57bb68[_0x33cf('0x30')]['key']};});_0x1b07b9[_0x33cf('0x31')]=_[_0x33cf('0x2d')](_0x597672,_0x33cf('0x2a'));_0x1b07b9[_0x33cf('0x32')]=_[_0x33cf('0x33')](_0x214263[_0x33cf('0x32')]);_0x1b07b9['filters']=_[_0x33cf('0x34')](_0x1b07b9['model'],_0x1b07b9[_0x33cf('0x32')]);_0x3a1766[_0x33cf('0x35')]=_['intersection'](_0x1b07b9[_0x33cf('0x31')],qs[_0x33cf('0x36')](_0x214263[_0x33cf('0x32')][_0x33cf('0x36')]));_0x3a1766[_0x33cf('0x35')]=_0x3a1766['attributes'][_0x33cf('0x37')]?_0x3a1766[_0x33cf('0x35')]:_0x1b07b9[_0x33cf('0x31')];if(!_0x214263[_0x33cf('0x32')][_0x33cf('0x38')]('nolimit')){_0x3a1766[_0x33cf('0x1e')]=qs[_0x33cf('0x1e')](_0x214263[_0x33cf('0x32')][_0x33cf('0x1e')]);_0x3a1766[_0x33cf('0x1c')]=qs[_0x33cf('0x1c')](_0x214263[_0x33cf('0x32')][_0x33cf('0x1c')]);}_0x3a1766[_0x33cf('0x39')]=qs[_0x33cf('0x3a')](_0x214263['query']['sort']);_0x3a1766[_0x33cf('0x3b')]=qs[_0x33cf('0x3c')](_['pick'](_0x214263[_0x33cf('0x32')],_0x1b07b9[_0x33cf('0x3c')]),_0x597672);if(_0x214263[_0x33cf('0x32')][_0x33cf('0x3d')]){_0x3a1766[_0x33cf('0x3b')]=_[_0x33cf('0x3e')](_0x3a1766[_0x33cf('0x3b')],{'$or':_[_0x33cf('0x2d')](_0x597672,function(_0x3a06ba){if(_0x3a06ba[_0x33cf('0x30')]!==_0x33cf('0x3f')){var _0x210f01={};_0x210f01[_0x3a06ba['name']]={'$like':'%'+_0x214263[_0x33cf('0x32')][_0x33cf('0x3d')]+'%'};return _0x210f01;}})});}_0x3a1766=_[_0x33cf('0x3e')]({},_0x3a1766,_0x214263[_0x33cf('0x40')]);var _0x2971da={'where':_0x3a1766[_0x33cf('0x3b')]};return db[_0x33cf('0x2e')][_0x33cf('0x1f')](_0x2971da)[_0x33cf('0x26')](function(_0x19a70e){_0x2a5a56[_0x33cf('0x1f')]=_0x19a70e;if(_0x214263[_0x33cf('0x32')][_0x33cf('0x41')]){_0x3a1766[_0x33cf('0x42')]=[{'all':!![]}];}return db[_0x33cf('0x2e')]['findAll'](_0x3a1766);})[_0x33cf('0x26')](function(_0x51740a){_0x2a5a56[_0x33cf('0x43')]=_0x51740a;return _0x2a5a56;})[_0x33cf('0x26')](respondWithFilteredResult(_0x1ff9bc,_0x3a1766))['catch'](handleError(_0x1ff9bc,null));};exports['show']=function(_0x434a24,_0x381634){var _0xc216f9={'raw':!![],'where':{'id':_0x434a24[_0x33cf('0x44')]['id']}},_0x3a580d={};_0x3a580d[_0x33cf('0x31')]=_[_0x33cf('0x33')](db[_0x33cf('0x2e')][_0x33cf('0x45')]);_0x3a580d[_0x33cf('0x32')]=_[_0x33cf('0x33')](_0x434a24[_0x33cf('0x32')]);_0x3a580d[_0x33cf('0x3c')]=_[_0x33cf('0x34')](_0x3a580d[_0x33cf('0x31')],_0x3a580d[_0x33cf('0x32')]);_0xc216f9[_0x33cf('0x35')]=_[_0x33cf('0x34')](_0x3a580d[_0x33cf('0x31')],qs[_0x33cf('0x36')](_0x434a24[_0x33cf('0x32')]['fields']));_0xc216f9[_0x33cf('0x35')]=_0xc216f9[_0x33cf('0x35')][_0x33cf('0x37')]?_0xc216f9[_0x33cf('0x35')]:_0x3a580d[_0x33cf('0x31')];if(_0x434a24['query']['includeAll']){_0xc216f9[_0x33cf('0x42')]=[{'all':!![]}];}_0xc216f9=_[_0x33cf('0x3e')]({},_0xc216f9,_0x434a24[_0x33cf('0x40')]);return db[_0x33cf('0x2e')][_0x33cf('0x46')](_0xc216f9)[_0x33cf('0x26')](handleEntityNotFound(_0x381634,null))[_0x33cf('0x26')](respondWithResult(_0x381634,null))['catch'](handleError(_0x381634,null));};exports[_0x33cf('0x47')]=function(_0x185465,_0x19e142){return db[_0x33cf('0x2e')][_0x33cf('0x47')](_0x185465[_0x33cf('0x48')],{})['then'](respondWithResult(_0x19e142,0xc9))[_0x33cf('0x49')](handleError(_0x19e142,null));};exports[_0x33cf('0x24')]=function(_0x13c093,_0x25a82e){if(_0x13c093[_0x33cf('0x48')]['id']){delete _0x13c093[_0x33cf('0x48')]['id'];}return db[_0x33cf('0x2e')]['find']({'where':{'id':_0x13c093['params']['id']}})[_0x33cf('0x26')](handleEntityNotFound(_0x25a82e,null))[_0x33cf('0x26')](saveUpdates(_0x13c093[_0x33cf('0x48')],null))[_0x33cf('0x26')](respondWithResult(_0x25a82e,null))[_0x33cf('0x49')](handleError(_0x25a82e,null));};exports[_0x33cf('0x25')]=function(_0x47f598,_0x34d072){return db[_0x33cf('0x2e')][_0x33cf('0x46')]({'where':{'id':_0x47f598[_0x33cf('0x44')]['id']}})[_0x33cf('0x26')](handleEntityNotFound(_0x34d072,null))[_0x33cf('0x26')](removeEntity(_0x34d072,null))[_0x33cf('0x49')](handleError(_0x34d072,null));}; \ No newline at end of file +var _0x5217=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count'];(function(_0x3c7e9d,_0x204c2e){var _0xca738c=function(_0x533eb7){while(--_0x533eb7){_0x3c7e9d['push'](_0x3c7e9d['shift']());}};_0xca738c(++_0x204c2e);}(_0x5217,0xbb));var _0x7521=function(_0x15b48a,_0xcfdb53){_0x15b48a=_0x15b48a-0x0;var _0x316906=_0x5217[_0x15b48a];return _0x316906;};'use strict';var emlformat=require(_0x7521('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7521('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7521('0x2'));var moment=require(_0x7521('0x3'));var BPromise=require(_0x7521('0x4'));var Mustache=require(_0x7521('0x5'));var util=require('util');var path=require(_0x7521('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7521('0x7'));var _=require(_0x7521('0x8'));var squel=require('squel');var crypto=require(_0x7521('0x9'));var jsforce=require(_0x7521('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7521('0xb'));var querystring=require(_0x7521('0xc'));var Papa=require(_0x7521('0xd'));var Redis=require(_0x7521('0xe'));var authService=require(_0x7521('0xf'));var qs=require(_0x7521('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7521('0x11'));var logger=require('../../config/logger')(_0x7521('0x12'));var utils=require(_0x7521('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7521('0x14'));var db=require(_0x7521('0x15'))['db'];function respondWithStatusCode(_0x14f31c,_0x3d0456){_0x3d0456=_0x3d0456||0xcc;return function(_0x4b79d8){if(_0x4b79d8){return _0x14f31c[_0x7521('0x16')](_0x3d0456);}return _0x14f31c[_0x7521('0x17')](_0x3d0456)[_0x7521('0x18')]();};}function respondWithResult(_0x39ff6a,_0xcfcc2b){_0xcfcc2b=_0xcfcc2b||0xc8;return function(_0x2bf608){if(_0x2bf608){return _0x39ff6a[_0x7521('0x17')](_0xcfcc2b)[_0x7521('0x19')](_0x2bf608);}};}function respondWithFilteredResult(_0x3a49fd,_0x35af3c){return function(_0x545f9d){if(_0x545f9d){var _0x107726=typeof _0x35af3c[_0x7521('0x1a')]==='undefined'&&typeof _0x35af3c[_0x7521('0x1b')]==='undefined';var _0x1036f9=_0x545f9d['count'];var _0x34c506=_0x107726?0x0:_0x35af3c[_0x7521('0x1a')];var _0x27a2ee=_0x107726?_0x545f9d[_0x7521('0x1c')]:_0x35af3c[_0x7521('0x1a')]+_0x35af3c[_0x7521('0x1b')];var _0x4266d8;if(_0x27a2ee>=_0x1036f9){_0x27a2ee=_0x1036f9;_0x4266d8=0xc8;}else{_0x4266d8=0xce;}_0x3a49fd[_0x7521('0x17')](_0x4266d8);return _0x3a49fd['set'](_0x7521('0x1d'),_0x34c506+'-'+_0x27a2ee+'/'+_0x1036f9)[_0x7521('0x19')](_0x545f9d);}return null;};}function patchUpdates(_0x4cc186){return function(_0x3e4d98){try{jsonpatch[_0x7521('0x1e')](_0x3e4d98,_0x4cc186,!![]);}catch(_0x28ea57){return BPromise[_0x7521('0x1f')](_0x28ea57);}return _0x3e4d98[_0x7521('0x20')]();};}function saveUpdates(_0x44df8f,_0x4e6b2f){return function(_0xb505b5){if(_0xb505b5){return _0xb505b5[_0x7521('0x21')](_0x44df8f)[_0x7521('0x22')](function(_0x30eb9a){return _0x30eb9a;});}return null;};}function removeEntity(_0x4c9cab,_0x46ae18){return function(_0x60c3d8){if(_0x60c3d8){return _0x60c3d8[_0x7521('0x23')]()[_0x7521('0x22')](function(){_0x4c9cab[_0x7521('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a4da,_0x823708){return function(_0x271a12){if(!_0x271a12){_0x49a4da[_0x7521('0x16')](0x194);}return _0x271a12;};}function handleError(_0xf17a66,_0x27d856){_0x27d856=_0x27d856||0x1f4;return function(_0xcd0b7f){logger['error'](_0xcd0b7f[_0x7521('0x24')]);if(_0xcd0b7f['name']){delete _0xcd0b7f[_0x7521('0x25')];}_0xf17a66[_0x7521('0x17')](_0x27d856)[_0x7521('0x26')](_0xcd0b7f);};}exports[_0x7521('0x27')]=function(_0x103641,_0x94834){var _0x1cd09e={},_0x172549={},_0x3cf96f={'count':0x0,'rows':[]};var _0x303bdf=_[_0x7521('0x28')](db[_0x7521('0x29')][_0x7521('0x2a')],function(_0x1cbb59){return{'name':_0x1cbb59[_0x7521('0x2b')],'type':_0x1cbb59[_0x7521('0x2c')][_0x7521('0x2d')]};});_0x172549[_0x7521('0x2e')]=_['map'](_0x303bdf,_0x7521('0x25'));_0x172549[_0x7521('0x2f')]=_[_0x7521('0x30')](_0x103641[_0x7521('0x2f')]);_0x172549[_0x7521('0x31')]=_['intersection'](_0x172549[_0x7521('0x2e')],_0x172549[_0x7521('0x2f')]);_0x1cd09e['attributes']=_[_0x7521('0x32')](_0x172549['model'],qs[_0x7521('0x33')](_0x103641[_0x7521('0x2f')][_0x7521('0x33')]));_0x1cd09e[_0x7521('0x34')]=_0x1cd09e[_0x7521('0x34')][_0x7521('0x35')]?_0x1cd09e[_0x7521('0x34')]:_0x172549['model'];if(!_0x103641[_0x7521('0x2f')]['hasOwnProperty'](_0x7521('0x36'))){_0x1cd09e['limit']=qs[_0x7521('0x1b')](_0x103641['query'][_0x7521('0x1b')]);_0x1cd09e[_0x7521('0x1a')]=qs[_0x7521('0x1a')](_0x103641[_0x7521('0x2f')][_0x7521('0x1a')]);}_0x1cd09e[_0x7521('0x37')]=qs['sort'](_0x103641['query'][_0x7521('0x38')]);_0x1cd09e['where']=qs[_0x7521('0x31')](_['pick'](_0x103641[_0x7521('0x2f')],_0x172549[_0x7521('0x31')]),_0x303bdf);if(_0x103641[_0x7521('0x2f')]['filter']){_0x1cd09e[_0x7521('0x39')]=_[_0x7521('0x3a')](_0x1cd09e['where'],{'$or':_[_0x7521('0x28')](_0x303bdf,function(_0x5bed10){if(_0x5bed10[_0x7521('0x2c')]!==_0x7521('0x3b')){var _0x319004={};_0x319004[_0x5bed10[_0x7521('0x25')]]={'$like':'%'+_0x103641['query'][_0x7521('0x3c')]+'%'};return _0x319004;}})});}_0x1cd09e=_[_0x7521('0x3a')]({},_0x1cd09e,_0x103641[_0x7521('0x3d')]);var _0x48d176={'where':_0x1cd09e['where']};return db['ZohoField'][_0x7521('0x1c')](_0x48d176)[_0x7521('0x22')](function(_0x4d47f6){_0x3cf96f[_0x7521('0x1c')]=_0x4d47f6;if(_0x103641[_0x7521('0x2f')][_0x7521('0x3e')]){_0x1cd09e[_0x7521('0x3f')]=[{'all':!![]}];}return db[_0x7521('0x29')][_0x7521('0x40')](_0x1cd09e);})['then'](function(_0x2ab042){_0x3cf96f[_0x7521('0x41')]=_0x2ab042;return _0x3cf96f;})[_0x7521('0x22')](respondWithFilteredResult(_0x94834,_0x1cd09e))['catch'](handleError(_0x94834,null));};exports[_0x7521('0x42')]=function(_0x2cc586,_0x4fcb55){var _0x2de03d={'raw':!![],'where':{'id':_0x2cc586[_0x7521('0x43')]['id']}},_0x527962={};_0x527962[_0x7521('0x2e')]=_['keys'](db[_0x7521('0x29')][_0x7521('0x2a')]);_0x527962['query']=_['keys'](_0x2cc586[_0x7521('0x2f')]);_0x527962['filters']=_[_0x7521('0x32')](_0x527962[_0x7521('0x2e')],_0x527962[_0x7521('0x2f')]);_0x2de03d[_0x7521('0x34')]=_[_0x7521('0x32')](_0x527962[_0x7521('0x2e')],qs[_0x7521('0x33')](_0x2cc586[_0x7521('0x2f')][_0x7521('0x33')]));_0x2de03d[_0x7521('0x34')]=_0x2de03d[_0x7521('0x34')][_0x7521('0x35')]?_0x2de03d['attributes']:_0x527962[_0x7521('0x2e')];if(_0x2cc586[_0x7521('0x2f')]['includeAll']){_0x2de03d['include']=[{'all':!![]}];}_0x2de03d=_[_0x7521('0x3a')]({},_0x2de03d,_0x2cc586[_0x7521('0x3d')]);return db[_0x7521('0x29')]['find'](_0x2de03d)[_0x7521('0x22')](handleEntityNotFound(_0x4fcb55,null))[_0x7521('0x22')](respondWithResult(_0x4fcb55,null))[_0x7521('0x44')](handleError(_0x4fcb55,null));};exports['create']=function(_0x2fcdf2,_0x3fade9){return db[_0x7521('0x29')][_0x7521('0x45')](_0x2fcdf2['body'],{})[_0x7521('0x22')](respondWithResult(_0x3fade9,0xc9))[_0x7521('0x44')](handleError(_0x3fade9,null));};exports[_0x7521('0x21')]=function(_0x2697d9,_0x3b42bc){if(_0x2697d9[_0x7521('0x46')]['id']){delete _0x2697d9[_0x7521('0x46')]['id'];}return db[_0x7521('0x29')]['find']({'where':{'id':_0x2697d9['params']['id']}})[_0x7521('0x22')](handleEntityNotFound(_0x3b42bc,null))[_0x7521('0x22')](saveUpdates(_0x2697d9['body'],null))['then'](respondWithResult(_0x3b42bc,null))[_0x7521('0x44')](handleError(_0x3b42bc,null));};exports[_0x7521('0x23')]=function(_0x1da50b,_0x4d7eda){return db['ZohoField'][_0x7521('0x47')]({'where':{'id':_0x1da50b[_0x7521('0x43')]['id']}})[_0x7521('0x22')](handleEntityNotFound(_0x4d7eda,null))['then'](removeEntity(_0x4d7eda,null))[_0x7521('0x44')](handleError(_0x4d7eda,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 12e46ee..be8c3f1 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 _0x430c=['api','moment','bluebird','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x1c5e72,_0x267eca){var _0x549f2a=function(_0x24f41d){while(--_0x24f41d){_0x1c5e72['push'](_0x1c5e72['shift']());}};_0x549f2a(++_0x267eca);}(_0x430c,0x1a1));var _0xc430=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x430c[_0x1fd675];return _0x16b554;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x9'),_0xc430('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x47a940,_0x50c7bc){var _0x408cc8=function(_0x3ce7fe){while(--_0x3ce7fe){_0x47a940['push'](_0x47a940['shift']());}};_0x408cc8(++_0x50c7bc);}(_0x5204,0xdf));var _0x4520=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x5204[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'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 39cd465..e716d68 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 _0xcb48=['then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc9c3f5,_0x310f57){var _0x2d135a=function(_0x24c2ff){while(--_0x24c2ff){_0xc9c3f5['push'](_0xc9c3f5['shift']());}};_0x2d135a(++_0x310f57);}(_0xcb48,0x129));var _0x8cb4=function(_0x109316,_0x38a7c7){_0x109316=_0x109316-0x0;var _0x26f2ff=_0xcb48[_0x109316];return _0x26f2ff;};'use strict';var _=require(_0x8cb4('0x0'));var util=require(_0x8cb4('0x1'));var moment=require(_0x8cb4('0x2'));var BPromise=require(_0x8cb4('0x3'));var rs=require(_0x8cb4('0x4'));var fs=require('fs');var Redis=require(_0x8cb4('0x5'));var db=require(_0x8cb4('0x6'))['db'];var utils=require(_0x8cb4('0x7'));var logger=require(_0x8cb4('0x8'))(_0x8cb4('0x9'));var config=require(_0x8cb4('0xa'));var jayson=require(_0x8cb4('0xb'));var client=jayson[_0x8cb4('0xc')][_0x8cb4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ec336,_0x5f3c84,_0x2c155d){return new BPromise(function(_0x349a6f,_0x10dce8){return client[_0x8cb4('0xe')](_0x4ec336,_0x2c155d)[_0x8cb4('0xf')](function(_0x1cf3e1){logger[_0x8cb4('0x10')](_0x8cb4('0x11'),_0x5f3c84,'request\x20sent');logger[_0x8cb4('0x12')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5f3c84,_0x8cb4('0x13'),JSON[_0x8cb4('0x14')](_0x1cf3e1));if(_0x1cf3e1['error']){if(_0x1cf3e1[_0x8cb4('0x15')]['code']===0x1f4){logger[_0x8cb4('0x15')](_0x8cb4('0x11'),_0x5f3c84,_0x1cf3e1[_0x8cb4('0x15')]['message']);return _0x10dce8(_0x1cf3e1[_0x8cb4('0x15')][_0x8cb4('0x16')]);}logger[_0x8cb4('0x15')](_0x8cb4('0x11'),_0x5f3c84,_0x1cf3e1[_0x8cb4('0x15')]['message']);return _0x349a6f(_0x1cf3e1[_0x8cb4('0x15')][_0x8cb4('0x16')]);}else{logger['info'](_0x8cb4('0x11'),_0x5f3c84,_0x8cb4('0x13'));_0x349a6f(_0x1cf3e1[_0x8cb4('0x17')][_0x8cb4('0x16')]);}})['catch'](function(_0x5376ad){logger['error'](_0x8cb4('0x11'),_0x5f3c84,_0x5376ad);_0x10dce8(_0x5376ad);});});} \ No newline at end of file +var _0xe24e=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xe24e,0x1ee));var _0xee24=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xe24e[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var moment=require('moment');var BPromise=require(_0xee24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee24('0x3'));var db=require(_0xee24('0x4'))['db'];var utils=require(_0xee24('0x5'));var logger=require(_0xee24('0x6'))('rpc');var config=require(_0xee24('0x7'));var jayson=require(_0xee24('0x8'));var client=jayson[_0xee24('0x9')][_0xee24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50c9ec,_0x3f99da,_0x25e4e4){return new BPromise(function(_0x20d5a8,_0x3e8ce2){return client[_0xee24('0xb')](_0x50c9ec,_0x25e4e4)['then'](function(_0x2cbd88){logger[_0xee24('0xc')](_0xee24('0xd'),_0x3f99da,_0xee24('0xe'));logger[_0xee24('0xf')](_0xee24('0x10'),_0x3f99da,_0xee24('0xe'),JSON[_0xee24('0x11')](_0x2cbd88));if(_0x2cbd88[_0xee24('0x12')]){if(_0x2cbd88['error'][_0xee24('0x13')]===0x1f4){logger[_0xee24('0x12')]('ZohoField,\x20%s,\x20%s',_0x3f99da,_0x2cbd88['error'][_0xee24('0x14')]);return _0x3e8ce2(_0x2cbd88['error']['message']);}logger[_0xee24('0x12')](_0xee24('0xd'),_0x3f99da,_0x2cbd88[_0xee24('0x12')][_0xee24('0x14')]);return _0x20d5a8(_0x2cbd88['error'][_0xee24('0x14')]);}else{logger['info'](_0xee24('0xd'),_0x3f99da,_0xee24('0xe'));_0x20d5a8(_0x2cbd88['result'][_0xee24('0x14')]);}})[_0xee24('0x15')](function(_0xbeea6f){logger[_0xee24('0x12')]('ZohoField,\x20%s,\x20%s',_0x3f99da,_0xbeea6f);_0x3e8ce2(_0xbeea6f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index afb73ce..a262f23 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x295a4b,_0x4ce67b){var _0x348927=function(_0x20c8f9){while(--_0x20c8f9){_0x295a4b['push'](_0x295a4b['shift']());}};_0x348927(++_0x4ce67b);}(_0xedd9,0xfc));var _0x9edd=function(_0x43bf69,_0x64a838){_0x43bf69=_0x43bf69-0x0;var _0x1511a1=_0xedd9[_0x43bf69];return _0x1511a1;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 344dc59..f83f4dc 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 _0xab7f=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x1c5711,_0x44c32d){var _0xd0bfc0=function(_0x14105a){while(--_0x14105a){_0x1c5711['push'](_0x1c5711['shift']());}};_0xd0bfc0(++_0x44c32d);}(_0xab7f,0xa6));var _0xfab7=function(_0x34666b,_0x1e0246){_0x34666b=_0x34666b-0x0;var _0x391828=_0xab7f[_0x34666b];return _0x391828;};'use strict';var Sequelize=require(_0xfab7('0x0'));module[_0xfab7('0x1')]={'name':{'type':Sequelize[_0xfab7('0x2')],'allowNull':![],'unique':_0xfab7('0x3')},'version':{'type':Sequelize[_0xfab7('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xfab7('0x2')],'defaultValue':_0xfab7('0x4')},'filename':{'type':Sequelize[_0xfab7('0x2')]},'path':{'type':Sequelize[_0xfab7('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xfab7('0x5')]},'active':{'type':Sequelize[_0xfab7('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfab7('0x2')]},'state':{'type':Sequelize[_0xfab7('0x2')],'unique':_0xfab7('0x7')},'description':{'type':Sequelize[_0xfab7('0x2')]},'title':{'type':Sequelize[_0xfab7('0x2')]},'remoteUri':{'type':Sequelize[_0xfab7('0x2')]},'link':{'type':Sequelize[_0xfab7('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0585=['unique_name_and_version','STRING','app.js','INTEGER','sequelize','exports'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x0585,0x1ba));var _0x5058=function(_0x13622c,_0x56fdf3){_0x13622c=_0x13622c-0x0;var _0x1a9481=_0x0585[_0x13622c];return _0x1a9481;};'use strict';var Sequelize=require(_0x5058('0x0'));module[_0x5058('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5058('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5058('0x2')},'main':{'type':Sequelize[_0x5058('0x3')],'defaultValue':_0x5058('0x4')},'filename':{'type':Sequelize[_0x5058('0x3')]},'path':{'type':Sequelize[_0x5058('0x3')]},'type':{'type':Sequelize[_0x5058('0x3')]},'size':{'type':Sequelize[_0x5058('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x5058('0x3')]},'logo':{'type':Sequelize[_0x5058('0x3')]},'state':{'type':Sequelize[_0x5058('0x3')],'unique':'state'},'description':{'type':Sequelize[_0x5058('0x3')]},'title':{'type':Sequelize[_0x5058('0x3')]},'remoteUri':{'type':Sequelize[_0x5058('0x3')]},'link':{'type':Sequelize[_0x5058('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dcb9e45..707480e 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 _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x3bba4c,_0x1554b5){var _0xb90a9a=function(_0x271abe){while(--_0x271abe){_0x3bba4c['push'](_0x3bba4c['shift']());}};_0xb90a9a(++_0x1554b5);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c1929,_0x8beedb){_0x4c1929=_0x4c1929-0x0;var _0x439cbf=_0x2ef3[_0x4c1929];return _0x439cbf;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa28a01,_0x4271ab){_0xa28a01=_0xa28a01-0x0;var _0x2e43b1=_0x5f2f[_0xa28a01];return _0x2e43b1;};'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 f08091c..70888e7 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 _0xe0e5=['exports','define','integrations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./integration.attributes'];(function(_0x268988,_0x11b770){var _0x1579e5=function(_0x292dd0){while(--_0x292dd0){_0x268988['push'](_0x268988['shift']());}};_0x1579e5(++_0x11b770);}(_0xe0e5,0xdf));var _0x5e0e=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xe0e5[_0x33554b];return _0x256954;};'use strict';var _=require(_0x5e0e('0x0'));var util=require(_0x5e0e('0x1'));var logger=require(_0x5e0e('0x2'))(_0x5e0e('0x3'));var moment=require(_0x5e0e('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e0e('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e0e('0x7'));module[_0x5e0e('0x8')]=function(_0x3f9b27,_0x408c86){return _0x3f9b27[_0x5e0e('0x9')]('Integration',attributes,{'tableName':_0x5e0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x309c=['rimraf','./integration.attributes','define','Integration','integrations','util','../../config/logger','api','moment','path'];(function(_0x5ef518,_0x4e2b1c){var _0x3061cf=function(_0x20c9e2){while(--_0x20c9e2){_0x5ef518['push'](_0x5ef518['shift']());}};_0x3061cf(++_0x4e2b1c);}(_0x309c,0x9b));var _0xc309=function(_0x20dbdb,_0x311f7e){_0x20dbdb=_0x20dbdb-0x0;var _0x1e6d5e=_0x309c[_0x20dbdb];return _0x1e6d5e;};'use strict';var _=require('lodash');var util=require(_0xc309('0x0'));var logger=require(_0xc309('0x1'))(_0xc309('0x2'));var moment=require(_0xc309('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc309('0x4'));var rimraf=require(_0xc309('0x5'));var config=require('../../config/environment');var attributes=require(_0xc309('0x6'));module['exports']=function(_0x27d331,_0x589347){return _0x27d331[_0xc309('0x7')](_0xc309('0x8'),attributes,{'tableName':_0xc309('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 63cb7b7..d99a4ef 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x361d97,_0x4d5411){var _0x2c77bd=function(_0x4fa100){while(--_0x4fa100){_0x361d97['push'](_0x361d97['shift']());}};_0x2c77bd(++_0x4d5411);}(_0x57ca,0x108));var _0xa57c=function(_0x34e806,_0x568f5b){_0x34e806=_0x34e806-0x0;var _0x41044e=_0x57ca[_0x34e806];return _0x41044e;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x40042d,_0x3ce810){var _0x3889a1=function(_0x2fdcbb){while(--_0x2fdcbb){_0x40042d['push'](_0x40042d['shift']());}};_0x3889a1(++_0x3ce810);}(_0xadb5,0xad));var _0x5adb=function(_0x486280,_0x1a2629){_0x486280=_0x486280-0x0;var _0x265062=_0xadb5[_0x486280];return _0x265062;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 123e6d5..f8ea6d5 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x4c0d01,_0x25cb48){var _0x3e475a=function(_0x3a87cb){while(--_0x3a87cb){_0x4c0d01['push'](_0x4c0d01['shift']());}};_0x3e475a(++_0x25cb48);}(_0xc2c7,0x134));var _0x7c2c=function(_0x49a853,_0x2b3c6a){_0x49a853=_0x49a853-0x0;var _0x533b60=_0xc2c7[_0x49a853];return _0x533b60;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _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(_0x48c53f,_0x2964da){var _0x51297a=function(_0x250784){while(--_0x250784){_0x48c53f['push'](_0x48c53f['shift']());}};_0x51297a(++_0x2964da);}(_0x4975,0x86));var _0x5497=function(_0xf7f9f7,_0x148b88){_0xf7f9f7=_0xf7f9f7-0x0;var _0x1b9b5c=_0x4975[_0xf7f9f7];return _0x1b9b5c;};'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 792b279..146474b 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 _0x89a5=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize','exports'];(function(_0x43e9ed,_0xe5a03d){var _0x523323=function(_0x3a6bc1){while(--_0x3a6bc1){_0x43e9ed['push'](_0x43e9ed['shift']());}};_0x523323(++_0xe5a03d);}(_0x89a5,0x13e));var _0x589a=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x89a5[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0x589a('0x0'));module[_0x589a('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x589a('0x2')]},'exitStatus':{'type':Sequelize[_0x589a('0x2')]},'ticketId':{'type':Sequelize[_0x589a('0x2')]},'integrationId':{'type':Sequelize[_0x589a('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x589a('0x2')]},'calleridnum':{'type':Sequelize[_0x589a('0x2')]},'calleridname':{'type':Sequelize[_0x589a('0x2')]},'queue':{'type':Sequelize[_0x589a('0x2')]},'interface':{'type':Sequelize[_0x589a('0x2')]},'membername':{'type':Sequelize[_0x589a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x589a('0x4')]},'holdtime':{'type':Sequelize[_0x589a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x589a('0x3')]},'agentacw':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x589a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x589a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x589a('0x2')]},'channel':{'type':Sequelize[_0x589a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x589a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x589a('0x2')]},'connectedlinename':{'type':Sequelize[_0x589a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x589a('0x2')]},'exten':{'type':Sequelize[_0x589a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x589a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x589a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x589a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x589a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x589a('0x2')]},'destlanguage':{'type':Sequelize[_0x589a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x589a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x589a('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x589a('0x2')]},'from':{'type':Sequelize[_0x589a('0x2')]},'to':{'type':Sequelize[_0x589a('0x2')]},'cc':{'type':Sequelize[_0x589a('0x2')]},'attachment':{'type':Sequelize[_0x589a('0x6')]},'html':{'type':Sequelize[_0x589a('0x6')]},'text':{'type':Sequelize[_0x589a('0x6')]},'status':{'type':Sequelize[_0x589a('0x7')](_0x589a('0x8'),'SENDING','RECEIVED',_0x589a('0x9'))},'url':{'type':Sequelize[_0x589a('0x2')]},'app':{'type':Sequelize[_0x589a('0x2')]},'appdata':{'type':Sequelize[_0x589a('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf85d=['BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','DATE'];(function(_0x386009,_0x173cc6){var _0x19207=function(_0x2d0a50){while(--_0x2d0a50){_0x386009['push'](_0x386009['shift']());}};_0x19207(++_0x173cc6);}(_0xf85d,0x8c));var _0xdf85=function(_0x2399ec,_0x22b88c){_0x2399ec=_0x2399ec-0x0;var _0x5159a2=_0xf85d[_0x2399ec];return _0x5159a2;};'use strict';var Sequelize=require(_0xdf85('0x0'));module['exports']={'integration':{'type':Sequelize[_0xdf85('0x1')]},'eventChannel':{'type':Sequelize[_0xdf85('0x1')]},'exitStatus':{'type':Sequelize[_0xdf85('0x1')]},'ticketId':{'type':Sequelize[_0xdf85('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdf85('0x1')]},'calleridnum':{'type':Sequelize[_0xdf85('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdf85('0x1')]},'interface':{'type':Sequelize[_0xdf85('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xdf85('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xdf85('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdf85('0x2')]},'talktime':{'type':Sequelize[_0xdf85('0x4')]},'agentacw':{'type':Sequelize[_0xdf85('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdf85('0x4')]},'reason':{'type':Sequelize[_0xdf85('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xdf85('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xdf85('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xdf85('0x2')]},'lastevent':{'type':Sequelize[_0xdf85('0x1')]},'channel':{'type':Sequelize[_0xdf85('0x1')]},'channelstate':{'type':Sequelize[_0xdf85('0x4')]},'channelstatedesc':{'type':Sequelize[_0xdf85('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xdf85('0x1')]},'language':{'type':Sequelize[_0xdf85('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xdf85('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xdf85('0x1')]},'destcalleridname':{'type':Sequelize[_0xdf85('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xdf85('0x1')]},'destlanguage':{'type':Sequelize[_0xdf85('0x1')]},'destaccountcode':{'type':Sequelize[_0xdf85('0x1')]},'destcontext':{'type':Sequelize[_0xdf85('0x1')]},'destexten':{'type':Sequelize[_0xdf85('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xdf85('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xdf85('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xdf85('0x5')]},'html':{'type':Sequelize[_0xdf85('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xdf85('0x6')](_0xdf85('0x7'),_0xdf85('0x8'),_0xdf85('0x9'),_0xdf85('0xa'))},'url':{'type':Sequelize[_0xdf85('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xdf85('0x1')]},'projectId':{'type':Sequelize[_0xdf85('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f94a50b..435ab4c 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 _0x311b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x35022e,_0xf1b1a8){var _0x18c1c9=function(_0x3b29da){while(--_0x3b29da){_0x35022e['push'](_0x35022e['shift']());}};_0x18c1c9(++_0xf1b1a8);}(_0x311b,0x138));var _0xb311=function(_0x3b58e2,_0x4fbf5f){_0x3b58e2=_0x3b58e2-0x0;var _0x5a6677=_0x311b[_0x3b58e2];return _0x5a6677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb311('0x0'));var zipdir=require(_0xb311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb311('0x2'));var moment=require(_0xb311('0x3'));var BPromise=require(_0xb311('0x4'));var Mustache=require(_0xb311('0x5'));var util=require(_0xb311('0x6'));var path=require(_0xb311('0x7'));var sox=require(_0xb311('0x8'));var csv=require(_0xb311('0x9'));var ejs=require(_0xb311('0xa'));var fs=require('fs');var fs_extra=require(_0xb311('0xb'));var _=require(_0xb311('0xc'));var squel=require(_0xb311('0xd'));var crypto=require('crypto');var jsforce=require(_0xb311('0xe'));var deskjs=require(_0xb311('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb311('0x10'));var Papa=require(_0xb311('0x11'));var Redis=require(_0xb311('0x12'));var authService=require(_0xb311('0x13'));var qs=require(_0xb311('0x14'));var as=require(_0xb311('0x15'));var hardwareService=require(_0xb311('0x16'));var logger=require(_0xb311('0x17'))(_0xb311('0x18'));var utils=require(_0xb311('0x19'));var config=require(_0xb311('0x1a'));var licenseUtil=require(_0xb311('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28e1a3,_0x3c6893){_0x3c6893=_0x3c6893||0xcc;return function(_0x16e7ad){if(_0x16e7ad){return _0x28e1a3[_0xb311('0x1c')](_0x3c6893);}return _0x28e1a3['status'](_0x3c6893)[_0xb311('0x1d')]();};}function respondWithResult(_0x5208c1,_0x1d9ec0){_0x1d9ec0=_0x1d9ec0||0xc8;return function(_0x32ff20){if(_0x32ff20){return _0x5208c1[_0xb311('0x1e')](_0x1d9ec0)[_0xb311('0x1f')](_0x32ff20);}};}function respondWithFilteredResult(_0x5ed5c4,_0x2fee6a){return function(_0x58aad8){if(_0x58aad8){var _0x42a0fb=typeof _0x2fee6a['offset']===_0xb311('0x20')&&typeof _0x2fee6a['limit']===_0xb311('0x20');var _0x128066=_0x58aad8[_0xb311('0x21')];var _0x40dcc0=_0x42a0fb?0x0:_0x2fee6a[_0xb311('0x22')];var _0x2e886e=_0x42a0fb?_0x58aad8[_0xb311('0x21')]:_0x2fee6a[_0xb311('0x22')]+_0x2fee6a['limit'];var _0x1e667b;if(_0x2e886e>=_0x128066){_0x2e886e=_0x128066;_0x1e667b=0xc8;}else{_0x1e667b=0xce;}_0x5ed5c4['status'](_0x1e667b);return _0x5ed5c4[_0xb311('0x23')](_0xb311('0x24'),_0x40dcc0+'-'+_0x2e886e+'/'+_0x128066)[_0xb311('0x1f')](_0x58aad8);}return null;};}function patchUpdates(_0x485f06){return function(_0x41e5b6){try{jsonpatch[_0xb311('0x25')](_0x41e5b6,_0x485f06,!![]);}catch(_0x1967d6){return BPromise[_0xb311('0x26')](_0x1967d6);}return _0x41e5b6[_0xb311('0x27')]();};}function saveUpdates(_0x5ac4cc,_0x1fb84f){return function(_0x3b0bfe){if(_0x3b0bfe){return _0x3b0bfe[_0xb311('0x28')](_0x5ac4cc)[_0xb311('0x29')](function(_0x3172c9){return _0x3172c9;});}return null;};}function removeEntity(_0x1b0267,_0x477c30){return function(_0x12c42d){if(_0x12c42d){return _0x12c42d['destroy']()[_0xb311('0x29')](function(){_0x1b0267[_0xb311('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8e35,_0x34cd32){return function(_0x4ba3b7){if(!_0x4ba3b7){_0x4d8e35['sendStatus'](0x194);}return _0x4ba3b7;};}function handleError(_0x26d049,_0x3dde16){_0x3dde16=_0x3dde16||0x1f4;return function(_0x413b60){logger[_0xb311('0x2a')](_0x413b60[_0xb311('0x2b')]);if(_0x413b60['name']){delete _0x413b60['name'];}_0x26d049[_0xb311('0x1e')](_0x3dde16)[_0xb311('0x2c')](_0x413b60);};}exports['index']=function(_0x5bfb5f,_0x226ed8){var _0x2c1996={},_0x47e83e={},_0x196f19={'count':0x0,'rows':[]};var _0x1d6cd2=_[_0xb311('0x2d')](db[_0xb311('0x2e')][_0xb311('0x2f')],function(_0x13135f){return{'name':_0x13135f[_0xb311('0x30')],'type':_0x13135f[_0xb311('0x31')][_0xb311('0x32')]};});_0x47e83e[_0xb311('0x33')]=_[_0xb311('0x2d')](_0x1d6cd2,_0xb311('0x34'));_0x47e83e[_0xb311('0x35')]=_['keys'](_0x5bfb5f['query']);_0x47e83e[_0xb311('0x36')]=_[_0xb311('0x37')](_0x47e83e[_0xb311('0x33')],_0x47e83e[_0xb311('0x35')]);_0x2c1996[_0xb311('0x38')]=_[_0xb311('0x37')](_0x47e83e[_0xb311('0x33')],qs[_0xb311('0x39')](_0x5bfb5f[_0xb311('0x35')][_0xb311('0x39')]));_0x2c1996[_0xb311('0x38')]=_0x2c1996[_0xb311('0x38')][_0xb311('0x3a')]?_0x2c1996[_0xb311('0x38')]:_0x47e83e[_0xb311('0x33')];if(!_0x5bfb5f[_0xb311('0x35')][_0xb311('0x3b')](_0xb311('0x3c'))){_0x2c1996[_0xb311('0x3d')]=qs['limit'](_0x5bfb5f[_0xb311('0x35')][_0xb311('0x3d')]);_0x2c1996[_0xb311('0x22')]=qs[_0xb311('0x22')](_0x5bfb5f['query'][_0xb311('0x22')]);}_0x2c1996[_0xb311('0x3e')]=qs[_0xb311('0x3f')](_0x5bfb5f[_0xb311('0x35')]['sort']);_0x2c1996['where']=qs['filters'](_[_0xb311('0x40')](_0x5bfb5f[_0xb311('0x35')],_0x47e83e[_0xb311('0x36')]),_0x1d6cd2);if(_0x5bfb5f[_0xb311('0x35')][_0xb311('0x41')]){_0x2c1996[_0xb311('0x42')]=_['merge'](_0x2c1996[_0xb311('0x42')],{'$or':_[_0xb311('0x2d')](_0x1d6cd2,function(_0x36101e){if(_0x36101e['type']!==_0xb311('0x43')){var _0x40f52f={};_0x40f52f[_0x36101e[_0xb311('0x34')]]={'$like':'%'+_0x5bfb5f[_0xb311('0x35')]['filter']+'%'};return _0x40f52f;}})});}_0x2c1996=_['merge']({},_0x2c1996,_0x5bfb5f['options']);var _0x61d12={'where':_0x2c1996['where']};return db[_0xb311('0x2e')]['count'](_0x61d12)[_0xb311('0x29')](function(_0x16c5da){_0x196f19['count']=_0x16c5da;if(_0x5bfb5f['query'][_0xb311('0x44')]){_0x2c1996[_0xb311('0x45')]=[{'all':!![]}];}return db[_0xb311('0x2e')][_0xb311('0x46')](_0x2c1996);})['then'](function(_0x519938){_0x196f19[_0xb311('0x47')]=_0x519938;return _0x196f19;})[_0xb311('0x29')](respondWithFilteredResult(_0x226ed8,_0x2c1996))[_0xb311('0x48')](handleError(_0x226ed8,null));};exports[_0xb311('0x49')]=function(_0x30e587,_0x58b3cc){var _0x3c9420={'raw':![],'where':{'id':_0x30e587[_0xb311('0x4a')]['id']}},_0x5d0cbb={};_0x5d0cbb[_0xb311('0x33')]=_['keys'](db[_0xb311('0x2e')][_0xb311('0x2f')]);_0x5d0cbb[_0xb311('0x35')]=_[_0xb311('0x4b')](_0x30e587[_0xb311('0x35')]);_0x5d0cbb[_0xb311('0x36')]=_[_0xb311('0x37')](_0x5d0cbb[_0xb311('0x33')],_0x5d0cbb[_0xb311('0x35')]);_0x3c9420[_0xb311('0x38')]=_[_0xb311('0x37')](_0x5d0cbb['model'],qs[_0xb311('0x39')](_0x30e587['query'][_0xb311('0x39')]));_0x3c9420['attributes']=_0x3c9420[_0xb311('0x38')][_0xb311('0x3a')]?_0x3c9420[_0xb311('0x38')]:_0x5d0cbb['model'];if(_0x30e587['query']['includeAll']){_0x3c9420[_0xb311('0x45')]=[{'all':!![]}];}_0x3c9420=_[_0xb311('0x4c')]({},_0x3c9420,_0x30e587[_0xb311('0x4d')]);return db[_0xb311('0x2e')][_0xb311('0x4e')](_0x3c9420)['then'](handleEntityNotFound(_0x58b3cc,null))[_0xb311('0x29')](respondWithResult(_0x58b3cc,null))[_0xb311('0x48')](handleError(_0x58b3cc,null));};exports[_0xb311('0x4f')]=function(_0x4a7849,_0xd1585b){return db[_0xb311('0x2e')]['create'](_0x4a7849['body'],{})[_0xb311('0x29')](respondWithResult(_0xd1585b,0xc9))[_0xb311('0x48')](handleError(_0xd1585b,null));};exports[_0xb311('0x28')]=function(_0x54fd48,_0x540848){if(_0x54fd48['body']['id']){delete _0x54fd48[_0xb311('0x50')]['id'];}return db[_0xb311('0x2e')][_0xb311('0x4e')]({'where':{'id':_0x54fd48['params']['id']}})[_0xb311('0x29')](handleEntityNotFound(_0x540848,null))[_0xb311('0x29')](saveUpdates(_0x54fd48['body'],null))[_0xb311('0x29')](respondWithResult(_0x540848,null))['catch'](handleError(_0x540848,null));};exports[_0xb311('0x51')]=function(_0x1fa9c0,_0x3f3095){return db[_0xb311('0x2e')]['find']({'where':{'id':_0x1fa9c0[_0xb311('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f3095,null))[_0xb311('0x29')](removeEntity(_0x3f3095,null))[_0xb311('0x48')](handleError(_0x3f3095,null));};exports[_0xb311('0x52')]=function(_0x58ccb4,_0x440e21){return db[_0xb311('0x2e')]['describe']()[_0xb311('0x29')](respondWithResult(_0x440e21,null))[_0xb311('0x48')](handleError(_0x440e21,null));}; \ No newline at end of file +var _0x6e2a=['set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','IntegrationReport','findAll','params','catch','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count'];(function(_0x362e87,_0x38d17c){var _0x334244=function(_0x24feb8){while(--_0x24feb8){_0x362e87['push'](_0x362e87['shift']());}};_0x334244(++_0x38d17c);}(_0x6e2a,0xbf));var _0xa6e2=function(_0x150199,_0x5d8234){_0x150199=_0x150199-0x0;var _0x50fa5c=_0x6e2a[_0x150199];return _0x50fa5c;};'use strict';var emlformat=require(_0xa6e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6e2('0x1'));var jsonpatch=require(_0xa6e2('0x2'));var rp=require(_0xa6e2('0x3'));var moment=require('moment');var BPromise=require(_0xa6e2('0x4'));var Mustache=require(_0xa6e2('0x5'));var util=require(_0xa6e2('0x6'));var path=require(_0xa6e2('0x7'));var sox=require(_0xa6e2('0x8'));var csv=require(_0xa6e2('0x9'));var ejs=require(_0xa6e2('0xa'));var fs=require('fs');var fs_extra=require(_0xa6e2('0xb'));var _=require(_0xa6e2('0xc'));var squel=require('squel');var crypto=require(_0xa6e2('0xd'));var jsforce=require(_0xa6e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa6e2('0x9'));var querystring=require(_0xa6e2('0xf'));var Papa=require(_0xa6e2('0x10'));var Redis=require(_0xa6e2('0x11'));var authService=require(_0xa6e2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6e2('0x13'));var logger=require(_0xa6e2('0x14'))(_0xa6e2('0x15'));var utils=require(_0xa6e2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa6e2('0x17'));var db=require(_0xa6e2('0x18'))['db'];function respondWithStatusCode(_0x2071cd,_0x4607d8){_0x4607d8=_0x4607d8||0xcc;return function(_0x126018){if(_0x126018){return _0x2071cd['sendStatus'](_0x4607d8);}return _0x2071cd[_0xa6e2('0x19')](_0x4607d8)[_0xa6e2('0x1a')]();};}function respondWithResult(_0xf160dc,_0x2c8a86){_0x2c8a86=_0x2c8a86||0xc8;return function(_0x257304){if(_0x257304){return _0xf160dc['status'](_0x2c8a86)[_0xa6e2('0x1b')](_0x257304);}};}function respondWithFilteredResult(_0x4de1ec,_0x1e4627){return function(_0x52a650){if(_0x52a650){var _0x785971=typeof _0x1e4627[_0xa6e2('0x1c')]==='undefined'&&typeof _0x1e4627['limit']===_0xa6e2('0x1d');var _0xd4c2ca=_0x52a650['count'];var _0x1814c5=_0x785971?0x0:_0x1e4627[_0xa6e2('0x1c')];var _0x27b9ee=_0x785971?_0x52a650[_0xa6e2('0x1e')]:_0x1e4627[_0xa6e2('0x1c')]+_0x1e4627['limit'];var _0x5d63f2;if(_0x27b9ee>=_0xd4c2ca){_0x27b9ee=_0xd4c2ca;_0x5d63f2=0xc8;}else{_0x5d63f2=0xce;}_0x4de1ec[_0xa6e2('0x19')](_0x5d63f2);return _0x4de1ec[_0xa6e2('0x1f')](_0xa6e2('0x20'),_0x1814c5+'-'+_0x27b9ee+'/'+_0xd4c2ca)[_0xa6e2('0x1b')](_0x52a650);}return null;};}function patchUpdates(_0x3bd62a){return function(_0x2e86d6){try{jsonpatch[_0xa6e2('0x21')](_0x2e86d6,_0x3bd62a,!![]);}catch(_0xfd01c0){return BPromise['reject'](_0xfd01c0);}return _0x2e86d6[_0xa6e2('0x22')]();};}function saveUpdates(_0x44a5a6,_0x1b1472){return function(_0x3fda85){if(_0x3fda85){return _0x3fda85[_0xa6e2('0x23')](_0x44a5a6)[_0xa6e2('0x24')](function(_0x202ad7){return _0x202ad7;});}return null;};}function removeEntity(_0x309bb6,_0x3238fa){return function(_0x1f04a1){if(_0x1f04a1){return _0x1f04a1['destroy']()[_0xa6e2('0x24')](function(){_0x309bb6[_0xa6e2('0x19')](0xcc)[_0xa6e2('0x1a')]();});}};}function handleEntityNotFound(_0x25be65,_0x41605e){return function(_0x19904b){if(!_0x19904b){_0x25be65[_0xa6e2('0x25')](0x194);}return _0x19904b;};}function handleError(_0x34fa85,_0x5b0134){_0x5b0134=_0x5b0134||0x1f4;return function(_0x4a1d0b){logger[_0xa6e2('0x26')](_0x4a1d0b[_0xa6e2('0x27')]);if(_0x4a1d0b[_0xa6e2('0x28')]){delete _0x4a1d0b[_0xa6e2('0x28')];}_0x34fa85[_0xa6e2('0x19')](_0x5b0134)[_0xa6e2('0x29')](_0x4a1d0b);};}exports['index']=function(_0x4d5eab,_0x12ae3b){var _0x3087e9={},_0x23a218={},_0x3625f3={'count':0x0,'rows':[]};var _0x1b6ff6=_[_0xa6e2('0x2a')](db['IntegrationReport'][_0xa6e2('0x2b')],function(_0x5d1623){return{'name':_0x5d1623['fieldName'],'type':_0x5d1623[_0xa6e2('0x2c')][_0xa6e2('0x2d')]};});_0x23a218[_0xa6e2('0x2e')]=_[_0xa6e2('0x2a')](_0x1b6ff6,_0xa6e2('0x28'));_0x23a218[_0xa6e2('0x2f')]=_[_0xa6e2('0x30')](_0x4d5eab[_0xa6e2('0x2f')]);_0x23a218['filters']=_[_0xa6e2('0x31')](_0x23a218[_0xa6e2('0x2e')],_0x23a218['query']);_0x3087e9['attributes']=_['intersection'](_0x23a218['model'],qs['fields'](_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x32')]));_0x3087e9[_0xa6e2('0x33')]=_0x3087e9[_0xa6e2('0x33')][_0xa6e2('0x34')]?_0x3087e9[_0xa6e2('0x33')]:_0x23a218[_0xa6e2('0x2e')];if(!_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x35')](_0xa6e2('0x36'))){_0x3087e9['limit']=qs[_0xa6e2('0x37')](_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x37')]);_0x3087e9[_0xa6e2('0x1c')]=qs[_0xa6e2('0x1c')](_0x4d5eab['query'][_0xa6e2('0x1c')]);}_0x3087e9['order']=qs[_0xa6e2('0x38')](_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x38')]);_0x3087e9[_0xa6e2('0x39')]=qs[_0xa6e2('0x3a')](_['pick'](_0x4d5eab[_0xa6e2('0x2f')],_0x23a218[_0xa6e2('0x3a')]),_0x1b6ff6);if(_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x3b')]){_0x3087e9[_0xa6e2('0x39')]=_[_0xa6e2('0x3c')](_0x3087e9['where'],{'$or':_['map'](_0x1b6ff6,function(_0x36a431){if(_0x36a431[_0xa6e2('0x2c')]!==_0xa6e2('0x3d')){var _0x569734={};_0x569734[_0x36a431[_0xa6e2('0x28')]]={'$like':'%'+_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x3b')]+'%'};return _0x569734;}})});}_0x3087e9=_[_0xa6e2('0x3c')]({},_0x3087e9,_0x4d5eab[_0xa6e2('0x3e')]);var _0x18f52b={'where':_0x3087e9[_0xa6e2('0x39')]};return db['IntegrationReport'][_0xa6e2('0x1e')](_0x18f52b)[_0xa6e2('0x24')](function(_0x2c6618){_0x3625f3[_0xa6e2('0x1e')]=_0x2c6618;if(_0x4d5eab[_0xa6e2('0x2f')][_0xa6e2('0x3f')]){_0x3087e9[_0xa6e2('0x40')]=[{'all':!![]}];}return db[_0xa6e2('0x41')][_0xa6e2('0x42')](_0x3087e9);})[_0xa6e2('0x24')](function(_0x4a72a1){_0x3625f3['rows']=_0x4a72a1;return _0x3625f3;})[_0xa6e2('0x24')](respondWithFilteredResult(_0x12ae3b,_0x3087e9))['catch'](handleError(_0x12ae3b,null));};exports['show']=function(_0x3bbefb,_0x4f20b1){var _0x2036d5={'raw':![],'where':{'id':_0x3bbefb[_0xa6e2('0x43')]['id']}},_0x3203d9={};_0x3203d9[_0xa6e2('0x2e')]=_[_0xa6e2('0x30')](db[_0xa6e2('0x41')][_0xa6e2('0x2b')]);_0x3203d9[_0xa6e2('0x2f')]=_[_0xa6e2('0x30')](_0x3bbefb[_0xa6e2('0x2f')]);_0x3203d9[_0xa6e2('0x3a')]=_[_0xa6e2('0x31')](_0x3203d9['model'],_0x3203d9['query']);_0x2036d5['attributes']=_[_0xa6e2('0x31')](_0x3203d9['model'],qs[_0xa6e2('0x32')](_0x3bbefb['query']['fields']));_0x2036d5[_0xa6e2('0x33')]=_0x2036d5[_0xa6e2('0x33')][_0xa6e2('0x34')]?_0x2036d5['attributes']:_0x3203d9['model'];if(_0x3bbefb[_0xa6e2('0x2f')][_0xa6e2('0x3f')]){_0x2036d5[_0xa6e2('0x40')]=[{'all':!![]}];}_0x2036d5=_[_0xa6e2('0x3c')]({},_0x2036d5,_0x3bbefb[_0xa6e2('0x3e')]);return db[_0xa6e2('0x41')]['find'](_0x2036d5)[_0xa6e2('0x24')](handleEntityNotFound(_0x4f20b1,null))[_0xa6e2('0x24')](respondWithResult(_0x4f20b1,null))[_0xa6e2('0x44')](handleError(_0x4f20b1,null));};exports[_0xa6e2('0x45')]=function(_0x43e991,_0x324d2f){return db[_0xa6e2('0x41')][_0xa6e2('0x45')](_0x43e991[_0xa6e2('0x46')],{})[_0xa6e2('0x24')](respondWithResult(_0x324d2f,0xc9))[_0xa6e2('0x44')](handleError(_0x324d2f,null));};exports[_0xa6e2('0x23')]=function(_0x40ce70,_0x312b50){if(_0x40ce70[_0xa6e2('0x46')]['id']){delete _0x40ce70[_0xa6e2('0x46')]['id'];}return db[_0xa6e2('0x41')][_0xa6e2('0x47')]({'where':{'id':_0x40ce70[_0xa6e2('0x43')]['id']}})[_0xa6e2('0x24')](handleEntityNotFound(_0x312b50,null))['then'](saveUpdates(_0x40ce70['body'],null))[_0xa6e2('0x24')](respondWithResult(_0x312b50,null))['catch'](handleError(_0x312b50,null));};exports[_0xa6e2('0x48')]=function(_0x4573f3,_0x2bb0e1){return db[_0xa6e2('0x41')][_0xa6e2('0x47')]({'where':{'id':_0x4573f3[_0xa6e2('0x43')]['id']}})[_0xa6e2('0x24')](handleEntityNotFound(_0x2bb0e1,null))['then'](removeEntity(_0x2bb0e1,null))[_0xa6e2('0x44')](handleError(_0x2bb0e1,null));};exports[_0xa6e2('0x49')]=function(_0x4a887b,_0x52db5c){return db[_0xa6e2('0x41')][_0xa6e2('0x49')]()[_0xa6e2('0x24')](respondWithResult(_0x52db5c,null))['catch'](handleError(_0x52db5c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 21c1436..3027a46 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 _0xd7fa=['bluebird','request-promise','rimraf','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','../../config/logger','api','moment'];(function(_0x2d07f1,_0x112dc6){var _0x38701e=function(_0x43e0f2){while(--_0x43e0f2){_0x2d07f1['push'](_0x2d07f1['shift']());}};_0x38701e(++_0x112dc6);}(_0xd7fa,0xa1));var _0xad7f=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0xd7fa[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0xad7f('0x0'));var util=require('util');var logger=require(_0xad7f('0x1'))(_0xad7f('0x2'));var moment=require(_0xad7f('0x3'));var BPromise=require(_0xad7f('0x4'));var rp=require(_0xad7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad7f('0x6'));var config=require('../../config/environment');var attributes=require(_0xad7f('0x7'));module[_0xad7f('0x8')]=function(_0x4f6d34,_0x2bdf6b){return _0x4f6d34['define'](_0xad7f('0x9'),attributes,{'tableName':_0xad7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c0=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash'];(function(_0xb1efb7,_0x1ce9e6){var _0x440e13=function(_0xec117d){while(--_0xec117d){_0xb1efb7['push'](_0xb1efb7['shift']());}};_0x440e13(++_0x1ce9e6);}(_0xf6c0,0x171));var _0x0f6c=function(_0x3eb5cc,_0x142bd6){_0x3eb5cc=_0x3eb5cc-0x0;var _0x1d549d=_0xf6c0[_0x3eb5cc];return _0x1d549d;};'use strict';var _=require(_0x0f6c('0x0'));var util=require(_0x0f6c('0x1'));var logger=require(_0x0f6c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0f6c('0x3'));var fs=require('fs');var path=require(_0x0f6c('0x4'));var rimraf=require(_0x0f6c('0x5'));var config=require(_0x0f6c('0x6'));var attributes=require(_0x0f6c('0x7'));module['exports']=function(_0x61cdf0,_0x4b2e96){return _0x61cdf0[_0x0f6c('0x8')](_0x0f6c('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 3dd2a64..7e334d9 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x8e78f3,_0x2adccc){var _0x3b55c6=function(_0x47ab24){while(--_0x47ab24){_0x8e78f3['push'](_0x8e78f3['shift']());}};_0x3b55c6(++_0x2adccc);}(_0x4819,0xcd));var _0x9481=function(_0x44913c,_0x754aad){_0x44913c=_0x44913c-0x0;var _0x4b7ca2=_0x4819[_0x44913c];return _0x4b7ca2;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1060bc,_0x55fb82){var _0x25151f=function(_0x2dd661){while(--_0x2dd661){_0x1060bc['push'](_0x1060bc['shift']());}};_0x25151f(++_0x55fb82);}(_0x4819,0xcd));var _0x9481=function(_0x1168c2,_0x1ed2ce){_0x1168c2=_0x1168c2-0x0;var _0x5ab8b5=_0x4819[_0x1168c2];return _0x5ab8b5;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6a07c14..cedc9f2 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 _0x27fa=['./interval.controller','get','isAuthenticated','/:id','show','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x27fa,0x1c3));var _0xa27f=function(_0x455852,_0x720ea1){_0x455852=_0x455852-0x0;var _0x2cfed8=_0x27fa[_0x455852];return _0x2cfed8;};'use strict';var multer=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var path=require(_0xa27f('0x2'));var timeout=require(_0xa27f('0x3'));var express=require(_0xa27f('0x4'));var router=express[_0xa27f('0x5')]();var fs_extra=require(_0xa27f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa27f('0x7'));var config=require(_0xa27f('0x8'));var controller=require(_0xa27f('0x9'));router[_0xa27f('0xa')]('/',auth[_0xa27f('0xb')](),controller['index']);router[_0xa27f('0xa')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0xd')]);router[_0xa27f('0xa')]('/:id/sub_intervals',auth[_0xa27f('0xb')](),controller[_0xa27f('0xe')]);router[_0xa27f('0xf')]('/',auth['isAuthenticated'](),controller[_0xa27f('0x10')]);router[_0xa27f('0xf')]('/:id/sub_intervals',auth[_0xa27f('0xb')](),controller['addInterval']);router[_0xa27f('0xf')](_0xa27f('0x11'),auth[_0xa27f('0xb')](),controller['addIntervals']);router[_0xa27f('0x12')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0x13')]);router[_0xa27f('0x14')](_0xa27f('0xc'),auth['isAuthenticated'](),controller[_0xa27f('0x15')]);module[_0xa27f('0x16')]=router; \ No newline at end of file +var _0xb7b6=['/:id','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x155209,_0x31d24e){_0x155209=_0x155209-0x0;var _0x523c64=_0xb7b6[_0x155209];return _0x523c64;};'use strict';var multer=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b7b('0x2'));var router=express[_0x6b7b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b7b('0x4'));var interaction=require(_0x6b7b('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x6b7b('0x6')]('/',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x8')]);router[_0x6b7b('0x6')](_0x6b7b('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6b7b('0x6')](_0x6b7b('0xa'),auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6b7b('0xc')](_0x6b7b('0xa'),auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xd')]);router[_0x6b7b('0xc')](_0x6b7b('0xe'),auth['isAuthenticated'](),controller[_0x6b7b('0xf')]);router[_0x6b7b('0x10')]('/:id',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x11')]);router['delete'](_0x6b7b('0x9'),auth['isAuthenticated'](),controller[_0x6b7b('0x12')]);module[_0x6b7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5aad355..83424aa 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 _0x5fae=['exports','STRING','sequelize'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x5fae,0x152));var _0xe5fa=function(_0x471d25,_0x3e415e){_0x471d25=_0x471d25-0x0;var _0x15dadf=_0x5fae[_0x471d25];return _0x15dadf;};'use strict';var Sequelize=require(_0xe5fa('0x0'));module[_0xe5fa('0x1')]={'name':{'type':Sequelize[_0xe5fa('0x2')]},'description':{'type':Sequelize[_0xe5fa('0x2')]},'interval':{'type':Sequelize[_0xe5fa('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4805=['STRING','sequelize','exports'];(function(_0x4b9680,_0x2ca119){var _0x12f096=function(_0xf5fbc6){while(--_0xf5fbc6){_0x4b9680['push'](_0x4b9680['shift']());}};_0x12f096(++_0x2ca119);}(_0x4805,0x1a8));var _0x5480=function(_0x9b6061,_0x365ad9){_0x9b6061=_0x9b6061-0x0;var _0x58c42d=_0x4805[_0x9b6061];return _0x58c42d;};'use strict';var Sequelize=require(_0x5480('0x0'));module[_0x5480('0x1')]={'name':{'type':Sequelize[_0x5480('0x2')]},'description':{'type':Sequelize[_0x5480('0x2')]},'interval':{'type':Sequelize[_0x5480('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5bf1f68..c7f28df 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 _0xbc22=['error','stack','name','index','Interval','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','rawAttributes','includeAll','catch','create','body','user','role','UserProfileSection','find','userProfileId','update','params','addInterval','IntervalId','getIntervals','findOne','map','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','offset','count','set','reject','save','destroy','then','get','UserProfileResource','end'];(function(_0x5f27dc,_0x1d18f3){var _0xa5eee8=function(_0x5d85e7){while(--_0x5d85e7){_0x5f27dc['push'](_0x5f27dc['shift']());}};_0xa5eee8(++_0x1d18f3);}(_0xbc22,0x144));var _0x2bc2=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xbc22[_0x589aee];return _0x2f5ed4;};'use strict';var emlformat=require(_0x2bc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2bc2('0x1'));var rp=require(_0x2bc2('0x2'));var moment=require(_0x2bc2('0x3'));var BPromise=require(_0x2bc2('0x4'));var Mustache=require(_0x2bc2('0x5'));var util=require(_0x2bc2('0x6'));var path=require(_0x2bc2('0x7'));var sox=require(_0x2bc2('0x8'));var csv=require(_0x2bc2('0x9'));var ejs=require(_0x2bc2('0xa'));var fs=require('fs');var fs_extra=require(_0x2bc2('0xb'));var _=require(_0x2bc2('0xc'));var squel=require(_0x2bc2('0xd'));var crypto=require(_0x2bc2('0xe'));var jsforce=require(_0x2bc2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2bc2('0x9'));var querystring=require(_0x2bc2('0x10'));var Papa=require('papaparse');var Redis=require(_0x2bc2('0x11'));var authService=require(_0x2bc2('0x12'));var qs=require(_0x2bc2('0x13'));var as=require(_0x2bc2('0x14'));var hardwareService=require(_0x2bc2('0x15'));var logger=require(_0x2bc2('0x16'))(_0x2bc2('0x17'));var utils=require(_0x2bc2('0x18'));var config=require(_0x2bc2('0x19'));var licenseUtil=require(_0x2bc2('0x1a'));var db=require(_0x2bc2('0x1b'))['db'];var extensions=require(_0x2bc2('0x1c'));function respondWithStatusCode(_0x3124c9,_0x5f5605){_0x5f5605=_0x5f5605||0xcc;return function(_0x1de076){if(_0x1de076){return _0x3124c9[_0x2bc2('0x1d')](_0x5f5605);}return _0x3124c9[_0x2bc2('0x1e')](_0x5f5605)['end']();};}function respondWithResult(_0x56381b,_0x287ae3){_0x287ae3=_0x287ae3||0xc8;return function(_0x3c6b3b){if(_0x3c6b3b){return _0x56381b['status'](_0x287ae3)[_0x2bc2('0x1f')](_0x3c6b3b);}};}function respondWithFilteredResult(_0x1da973,_0x2589f7){return function(_0x7290e3){if(_0x7290e3){var _0x1cbf4e=typeof _0x2589f7['offset']===_0x2bc2('0x20')&&typeof _0x2589f7[_0x2bc2('0x21')]==='undefined';var _0x17ec8d=_0x7290e3['count'];var _0x58f72c=_0x1cbf4e?0x0:_0x2589f7[_0x2bc2('0x22')];var _0x5b1940=_0x1cbf4e?_0x7290e3[_0x2bc2('0x23')]:_0x2589f7['offset']+_0x2589f7[_0x2bc2('0x21')];var _0x2f2ab1;if(_0x5b1940>=_0x17ec8d){_0x5b1940=_0x17ec8d;_0x2f2ab1=0xc8;}else{_0x2f2ab1=0xce;}_0x1da973[_0x2bc2('0x1e')](_0x2f2ab1);return _0x1da973[_0x2bc2('0x24')]('Content-Range',_0x58f72c+'-'+_0x5b1940+'/'+_0x17ec8d)['json'](_0x7290e3);}return null;};}function patchUpdates(_0x52d290){return function(_0x2dee45){try{jsonpatch['apply'](_0x2dee45,_0x52d290,!![]);}catch(_0xd2ad5d){return BPromise[_0x2bc2('0x25')](_0xd2ad5d);}return _0x2dee45[_0x2bc2('0x26')]();};}function saveUpdates(_0x327dc3,_0xd6abe7){return function(_0x3342d7){if(_0x3342d7){return _0x3342d7['update'](_0x327dc3)['then'](function(_0x3867ce){return _0x3867ce;});}return null;};}function removeEntity(_0x6c6675,_0x5a78ee){return function(_0xe764f7){if(_0xe764f7){return _0xe764f7[_0x2bc2('0x27')]()[_0x2bc2('0x28')](function(){var _0x481f00=_0xe764f7[_0x2bc2('0x29')]({'plain':!![]});var _0x2bd74a='Intervals';return db[_0x2bc2('0x2a')][_0x2bc2('0x27')]({'where':{'type':_0x2bd74a,'resourceId':_0x481f00['id']}})['then'](function(){return _0xe764f7;});})[_0x2bc2('0x28')](function(){_0x6c6675[_0x2bc2('0x1e')](0xcc)[_0x2bc2('0x2b')]();});}};}function handleEntityNotFound(_0x5d6cd0,_0x2422ff){return function(_0x4ed876){if(!_0x4ed876){_0x5d6cd0['sendStatus'](0x194);}return _0x4ed876;};}function handleError(_0x1e9e1c,_0x1ada5b){_0x1ada5b=_0x1ada5b||0x1f4;return function(_0x223607){logger[_0x2bc2('0x2c')](_0x223607[_0x2bc2('0x2d')]);if(_0x223607[_0x2bc2('0x2e')]){delete _0x223607[_0x2bc2('0x2e')];}_0x1e9e1c[_0x2bc2('0x1e')](_0x1ada5b)['send'](_0x223607);};}exports[_0x2bc2('0x2f')]=function(_0x54ccc6,_0x311a49){var _0x52ec5b={},_0x4cfd32={},_0x3d42a9={'count':0x0,'rows':[]};var _0x1817c1=_['map'](db[_0x2bc2('0x30')]['rawAttributes'],function(_0x18ed4c){return{'name':_0x18ed4c[_0x2bc2('0x31')],'type':_0x18ed4c[_0x2bc2('0x32')]['key']};});_0x4cfd32[_0x2bc2('0x33')]=_['map'](_0x1817c1,'name');_0x4cfd32[_0x2bc2('0x34')]=_['keys'](_0x54ccc6['query']);_0x4cfd32[_0x2bc2('0x35')]=_[_0x2bc2('0x36')](_0x4cfd32[_0x2bc2('0x33')],_0x4cfd32[_0x2bc2('0x34')]);_0x52ec5b[_0x2bc2('0x37')]=_[_0x2bc2('0x36')](_0x4cfd32['model'],qs[_0x2bc2('0x38')](_0x54ccc6[_0x2bc2('0x34')][_0x2bc2('0x38')]));_0x52ec5b['attributes']=_0x52ec5b['attributes'][_0x2bc2('0x39')]?_0x52ec5b[_0x2bc2('0x37')]:_0x4cfd32['model'];if(!_0x54ccc6[_0x2bc2('0x34')]['hasOwnProperty'](_0x2bc2('0x3a'))){_0x52ec5b[_0x2bc2('0x21')]=qs['limit'](_0x54ccc6[_0x2bc2('0x34')][_0x2bc2('0x21')]);_0x52ec5b['offset']=qs['offset'](_0x54ccc6['query']['offset']);}_0x52ec5b[_0x2bc2('0x3b')]=qs[_0x2bc2('0x3c')](_0x54ccc6['query'][_0x2bc2('0x3c')]);_0x52ec5b[_0x2bc2('0x3d')]=qs['filters'](_['pick'](_0x54ccc6[_0x2bc2('0x34')],_0x4cfd32['filters']),_0x1817c1);if(_0x54ccc6['query'][_0x2bc2('0x3e')]){_0x52ec5b['where']=_[_0x2bc2('0x3f')](_0x52ec5b[_0x2bc2('0x3d')],{'$or':_['map'](_0x1817c1,function(_0x39ef63){if(_0x39ef63[_0x2bc2('0x32')]!==_0x2bc2('0x40')){var _0x2b6218={};_0x2b6218[_0x39ef63['name']]={'$like':'%'+_0x54ccc6[_0x2bc2('0x34')]['filter']+'%'};return _0x2b6218;}})});}_0x52ec5b=_[_0x2bc2('0x3f')]({},_0x52ec5b,_0x54ccc6[_0x2bc2('0x41')]);var _0x5c8fdb={'where':_0x52ec5b['where']};return db['Interval'][_0x2bc2('0x23')](_0x5c8fdb)[_0x2bc2('0x28')](function(_0x54c3c3){_0x3d42a9[_0x2bc2('0x23')]=_0x54c3c3;if(_0x54ccc6[_0x2bc2('0x34')]['includeAll']){_0x52ec5b[_0x2bc2('0x42')]=[{'all':!![]}];}return db[_0x2bc2('0x30')][_0x2bc2('0x43')](_0x52ec5b);})['then'](function(_0x25f8f3){_0x3d42a9[_0x2bc2('0x44')]=_0x25f8f3;return _0x3d42a9;})[_0x2bc2('0x28')](respondWithFilteredResult(_0x311a49,_0x52ec5b))['catch'](handleError(_0x311a49,null));};exports[_0x2bc2('0x45')]=function(_0x3389aa,_0x277df5){var _0x5e2c84={'raw':!![],'where':{'id':_0x3389aa['params']['id']}},_0x48e4b3={};_0x48e4b3[_0x2bc2('0x33')]=_[_0x2bc2('0x46')](db[_0x2bc2('0x30')][_0x2bc2('0x47')]);_0x48e4b3['query']=_[_0x2bc2('0x46')](_0x3389aa[_0x2bc2('0x34')]);_0x48e4b3[_0x2bc2('0x35')]=_[_0x2bc2('0x36')](_0x48e4b3[_0x2bc2('0x33')],_0x48e4b3[_0x2bc2('0x34')]);_0x5e2c84[_0x2bc2('0x37')]=_['intersection'](_0x48e4b3[_0x2bc2('0x33')],qs[_0x2bc2('0x38')](_0x3389aa['query']['fields']));_0x5e2c84[_0x2bc2('0x37')]=_0x5e2c84['attributes']['length']?_0x5e2c84[_0x2bc2('0x37')]:_0x48e4b3['model'];if(_0x3389aa[_0x2bc2('0x34')][_0x2bc2('0x48')]){_0x5e2c84['include']=[{'all':!![]}];}_0x5e2c84=_[_0x2bc2('0x3f')]({},_0x5e2c84,_0x3389aa['options']);return db[_0x2bc2('0x30')]['find'](_0x5e2c84)['then'](handleEntityNotFound(_0x277df5,null))[_0x2bc2('0x28')](respondWithResult(_0x277df5,null))[_0x2bc2('0x49')](handleError(_0x277df5,null));};exports[_0x2bc2('0x4a')]=function(_0x49fe40,_0x9a1ab4){return db['Interval']['create'](_0x49fe40[_0x2bc2('0x4b')],{})[_0x2bc2('0x28')](function(_0xf61c4b){var _0x2ec842=_0x49fe40[_0x2bc2('0x4c')][_0x2bc2('0x29')]({'plain':!![]});if(!_0x2ec842)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec842[_0x2bc2('0x4d')]===_0x2bc2('0x4c')){var _0x34b593=_0xf61c4b[_0x2bc2('0x29')]({'plain':!![]});var _0x378152='Intervals';return db[_0x2bc2('0x4e')][_0x2bc2('0x4f')]({'where':{'name':_0x378152,'userProfileId':_0x2ec842[_0x2bc2('0x50')]},'raw':!![]})[_0x2bc2('0x28')](function(_0x2f58c3){if(_0x2f58c3&&_0x2f58c3['autoAssociation']===0x0){return db['UserProfileResource'][_0x2bc2('0x4a')]({'name':_0x34b593[_0x2bc2('0x2e')],'resourceId':_0x34b593['id'],'type':_0x2f58c3[_0x2bc2('0x2e')],'sectionId':_0x2f58c3['id']},{})[_0x2bc2('0x28')](function(){return _0xf61c4b;});}else{return _0xf61c4b;}})[_0x2bc2('0x49')](function(_0x40d3dc){logger[_0x2bc2('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40d3dc);throw _0x40d3dc;});}return _0xf61c4b;})[_0x2bc2('0x28')](respondWithResult(_0x9a1ab4,0xc9))[_0x2bc2('0x49')](handleError(_0x9a1ab4,null));};exports[_0x2bc2('0x51')]=function(_0x4b3128,_0xf8bfef){if(_0x4b3128[_0x2bc2('0x4b')]['id']){delete _0x4b3128[_0x2bc2('0x4b')]['id'];}return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x4b3128[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0xf8bfef,null))[_0x2bc2('0x28')](saveUpdates(_0x4b3128[_0x2bc2('0x4b')],null))[_0x2bc2('0x28')](respondWithResult(_0xf8bfef,null))[_0x2bc2('0x49')](handleError(_0xf8bfef,null));};exports[_0x2bc2('0x27')]=function(_0x3d2fa5,_0x4b1337){return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x3d2fa5[_0x2bc2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b1337,null))[_0x2bc2('0x28')](removeEntity(_0x4b1337,null))[_0x2bc2('0x49')](handleError(_0x4b1337,null));};exports[_0x2bc2('0x53')]=function(_0x15e46a,_0x341b4f,_0x6f286e){if(_0x15e46a[_0x2bc2('0x4b')]['id']){delete _0x15e46a[_0x2bc2('0x4b')]['id'];}return db[_0x2bc2('0x30')]['find']({'where':{'id':_0x15e46a[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x341b4f,null))['then'](function(_0x5067e5){if(_0x5067e5){_0x15e46a[_0x2bc2('0x4b')][_0x2bc2('0x54')]=_0x5067e5['id'];return db[_0x2bc2('0x30')]['create'](_0x15e46a['body']);}})['then'](respondWithResult(_0x341b4f,null))[_0x2bc2('0x49')](handleError(_0x341b4f,null));};exports[_0x2bc2('0x55')]=function(_0x95ebf7,_0x411f83,_0x2834fb){var _0x4e9055={};var _0x311666={};var _0x318bf0;var _0x17f9be;return db[_0x2bc2('0x30')][_0x2bc2('0x56')]({'where':{'id':_0x95ebf7[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x411f83,null))[_0x2bc2('0x28')](function(_0x16570b){if(_0x16570b){_0x318bf0=_0x16570b;_0x311666[_0x2bc2('0x33')]=_[_0x2bc2('0x46')](db[_0x2bc2('0x30')][_0x2bc2('0x47')]);_0x311666[_0x2bc2('0x34')]=_[_0x2bc2('0x46')](_0x95ebf7[_0x2bc2('0x34')]);_0x311666[_0x2bc2('0x35')]=_['intersection'](_0x311666[_0x2bc2('0x33')],_0x311666[_0x2bc2('0x34')]);_0x4e9055[_0x2bc2('0x37')]=_[_0x2bc2('0x36')](_0x311666[_0x2bc2('0x33')],qs[_0x2bc2('0x38')](_0x95ebf7['query'][_0x2bc2('0x38')]));_0x4e9055[_0x2bc2('0x37')]=_0x4e9055[_0x2bc2('0x37')]['length']?_0x4e9055['attributes']:_0x311666['model'];_0x4e9055[_0x2bc2('0x3b')]=qs[_0x2bc2('0x3c')](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x3c')]);_0x4e9055[_0x2bc2('0x3d')]=qs[_0x2bc2('0x35')](_['pick'](_0x95ebf7[_0x2bc2('0x34')],_0x311666[_0x2bc2('0x35')]));if(_0x95ebf7[_0x2bc2('0x34')]['filter']){_0x4e9055['where']=_[_0x2bc2('0x3f')](_0x4e9055[_0x2bc2('0x3d')],{'$or':_[_0x2bc2('0x57')](_0x4e9055[_0x2bc2('0x37')],function(_0xf87dfb){var _0x5e3b7d={};_0x5e3b7d[_0xf87dfb]={'$like':'%'+_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x3e')]+'%'};return _0x5e3b7d;})});}_0x4e9055=_[_0x2bc2('0x3f')]({},_0x4e9055,_0x95ebf7[_0x2bc2('0x41')]);return _0x318bf0[_0x2bc2('0x55')](_0x4e9055);}})['then'](function(_0x1b60e1){if(_0x1b60e1){_0x17f9be=_0x1b60e1[_0x2bc2('0x39')];if(!_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x58')]('nolimit')){_0x4e9055[_0x2bc2('0x21')]=qs[_0x2bc2('0x21')](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x21')]);_0x4e9055['offset']=qs['offset'](_0x95ebf7[_0x2bc2('0x34')][_0x2bc2('0x22')]);}return _0x318bf0[_0x2bc2('0x55')](_0x4e9055);}})[_0x2bc2('0x28')](function(_0x1e3a4c){if(_0x1e3a4c){return _0x1e3a4c?{'count':_0x17f9be,'rows':_0x1e3a4c}:null;}})['then'](respondWithResult(_0x411f83,null))[_0x2bc2('0x49')](handleError(_0x411f83,null));};exports['addIntervals']=function(_0x5aca6c,_0x1b892b,_0x18fd4b){return db[_0x2bc2('0x30')]['findOne']({'where':{'id':_0x5aca6c[_0x2bc2('0x52')]['id']}})[_0x2bc2('0x28')](handleEntityNotFound(_0x1b892b,null))[_0x2bc2('0x28')](function(_0x22b141){if(_0x22b141){return db[_0x2bc2('0x59')][_0x2bc2('0x5a')](function(_0x3624ea){return db[_0x2bc2('0x30')]['destroy']({'where':{'IntervalId':_0x5aca6c[_0x2bc2('0x52')]['id']},'transaction':_0x3624ea})[_0x2bc2('0x28')](function(_0x4bb729){var _0x1e65ce=_['map'](_0x5aca6c[_0x2bc2('0x4b')],function(_0xc4d04f){delete _0xc4d04f['id'];_0xc4d04f[_0x2bc2('0x54')]=_0x5aca6c[_0x2bc2('0x52')]['id'];return _0xc4d04f;});return db[_0x2bc2('0x30')][_0x2bc2('0x5b')](_0x1e65ce,{'transaction':_0x3624ea});});})[_0x2bc2('0x28')](function(){return db['Interval'][_0x2bc2('0x43')]({'where':{'IntervalId':_0x5aca6c['params']['id']}});});}})[_0x2bc2('0x28')](respondWithResult(_0x1b892b,null))[_0x2bc2('0x49')](handleError(_0x1b892b,null));}; \ No newline at end of file +var _0xef42=['status','end','json','offset','limit','count','set','apply','reject','save','then','destroy','get','Intervals','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','length','nolimit','pick','filter','where','merge','Interval','findAll','catch','show','filters','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params','addInterval','IntervalId','findOne','sort','options','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','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','../../mysqldb','../../components/extensions/rewrite'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0xef42,0xf3));var _0x2ef4=function(_0x5e9e5f,_0x19aeeb){_0x5e9e5f=_0x5e9e5f-0x0;var _0x4944f5=_0xef42[_0x5e9e5f];return _0x4944f5;};'use strict';var emlformat=require(_0x2ef4('0x0'));var rimraf=require(_0x2ef4('0x1'));var zipdir=require(_0x2ef4('0x2'));var jsonpatch=require(_0x2ef4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ef4('0x4'));var util=require('util');var path=require(_0x2ef4('0x5'));var sox=require(_0x2ef4('0x6'));var csv=require(_0x2ef4('0x7'));var ejs=require(_0x2ef4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ef4('0x9'));var jsforce=require(_0x2ef4('0xa'));var deskjs=require(_0x2ef4('0xb'));var toCsv=require(_0x2ef4('0x7'));var querystring=require(_0x2ef4('0xc'));var Papa=require(_0x2ef4('0xd'));var Redis=require(_0x2ef4('0xe'));var authService=require(_0x2ef4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef4('0x10'));var hardwareService=require(_0x2ef4('0x11'));var logger=require(_0x2ef4('0x12'))('api');var utils=require(_0x2ef4('0x13'));var config=require(_0x2ef4('0x14'));var licenseUtil=require(_0x2ef4('0x15'));var db=require(_0x2ef4('0x16'))['db'];var extensions=require(_0x2ef4('0x17'));function respondWithStatusCode(_0x184686,_0x41cb87){_0x41cb87=_0x41cb87||0xcc;return function(_0x3704c2){if(_0x3704c2){return _0x184686['sendStatus'](_0x41cb87);}return _0x184686[_0x2ef4('0x18')](_0x41cb87)[_0x2ef4('0x19')]();};}function respondWithResult(_0x13d2b3,_0x3a9fb6){_0x3a9fb6=_0x3a9fb6||0xc8;return function(_0x5a0cd6){if(_0x5a0cd6){return _0x13d2b3[_0x2ef4('0x18')](_0x3a9fb6)[_0x2ef4('0x1a')](_0x5a0cd6);}};}function respondWithFilteredResult(_0xce486e,_0x486f7c){return function(_0x4dcd46){if(_0x4dcd46){var _0x2b9d4a=typeof _0x486f7c[_0x2ef4('0x1b')]==='undefined'&&typeof _0x486f7c[_0x2ef4('0x1c')]==='undefined';var _0x5d57d5=_0x4dcd46['count'];var _0x474e3c=_0x2b9d4a?0x0:_0x486f7c[_0x2ef4('0x1b')];var _0x448341=_0x2b9d4a?_0x4dcd46[_0x2ef4('0x1d')]:_0x486f7c[_0x2ef4('0x1b')]+_0x486f7c[_0x2ef4('0x1c')];var _0x141b7d;if(_0x448341>=_0x5d57d5){_0x448341=_0x5d57d5;_0x141b7d=0xc8;}else{_0x141b7d=0xce;}_0xce486e['status'](_0x141b7d);return _0xce486e[_0x2ef4('0x1e')]('Content-Range',_0x474e3c+'-'+_0x448341+'/'+_0x5d57d5)['json'](_0x4dcd46);}return null;};}function patchUpdates(_0x30829d){return function(_0x3d02b4){try{jsonpatch[_0x2ef4('0x1f')](_0x3d02b4,_0x30829d,!![]);}catch(_0x18845c){return BPromise[_0x2ef4('0x20')](_0x18845c);}return _0x3d02b4[_0x2ef4('0x21')]();};}function saveUpdates(_0x2d31a7,_0x43f99a){return function(_0x521d98){if(_0x521d98){return _0x521d98['update'](_0x2d31a7)[_0x2ef4('0x22')](function(_0x131295){return _0x131295;});}return null;};}function removeEntity(_0x16f5ff,_0x3d208a){return function(_0x17cb89){if(_0x17cb89){return _0x17cb89[_0x2ef4('0x23')]()[_0x2ef4('0x22')](function(){var _0x2cd769=_0x17cb89[_0x2ef4('0x24')]({'plain':!![]});var _0x2001ea=_0x2ef4('0x25');return db['UserProfileResource'][_0x2ef4('0x23')]({'where':{'type':_0x2001ea,'resourceId':_0x2cd769['id']}})[_0x2ef4('0x22')](function(){return _0x17cb89;});})[_0x2ef4('0x22')](function(){_0x16f5ff[_0x2ef4('0x18')](0xcc)[_0x2ef4('0x19')]();});}};}function handleEntityNotFound(_0x47c0fe,_0x4b40f8){return function(_0x58d8a7){if(!_0x58d8a7){_0x47c0fe[_0x2ef4('0x26')](0x194);}return _0x58d8a7;};}function handleError(_0x2ff612,_0x41f472){_0x41f472=_0x41f472||0x1f4;return function(_0x4a1c66){logger[_0x2ef4('0x27')](_0x4a1c66[_0x2ef4('0x28')]);if(_0x4a1c66['name']){delete _0x4a1c66['name'];}_0x2ff612[_0x2ef4('0x18')](_0x41f472)[_0x2ef4('0x29')](_0x4a1c66);};}exports[_0x2ef4('0x2a')]=function(_0x5e2816,_0x337f9f){var _0xac07a1={},_0x408751={},_0x4cd4be={'count':0x0,'rows':[]};var _0x53d59c=_[_0x2ef4('0x2b')](db['Interval'][_0x2ef4('0x2c')],function(_0x52d349){return{'name':_0x52d349[_0x2ef4('0x2d')],'type':_0x52d349[_0x2ef4('0x2e')][_0x2ef4('0x2f')]};});_0x408751[_0x2ef4('0x30')]=_['map'](_0x53d59c,_0x2ef4('0x31'));_0x408751['query']=_[_0x2ef4('0x32')](_0x5e2816[_0x2ef4('0x33')]);_0x408751['filters']=_['intersection'](_0x408751[_0x2ef4('0x30')],_0x408751[_0x2ef4('0x33')]);_0xac07a1[_0x2ef4('0x34')]=_[_0x2ef4('0x35')](_0x408751[_0x2ef4('0x30')],qs['fields'](_0x5e2816[_0x2ef4('0x33')][_0x2ef4('0x36')]));_0xac07a1[_0x2ef4('0x34')]=_0xac07a1[_0x2ef4('0x34')][_0x2ef4('0x37')]?_0xac07a1[_0x2ef4('0x34')]:_0x408751[_0x2ef4('0x30')];if(!_0x5e2816[_0x2ef4('0x33')]['hasOwnProperty'](_0x2ef4('0x38'))){_0xac07a1['limit']=qs['limit'](_0x5e2816[_0x2ef4('0x33')][_0x2ef4('0x1c')]);_0xac07a1['offset']=qs['offset'](_0x5e2816['query'][_0x2ef4('0x1b')]);}_0xac07a1['order']=qs['sort'](_0x5e2816[_0x2ef4('0x33')]['sort']);_0xac07a1['where']=qs['filters'](_[_0x2ef4('0x39')](_0x5e2816[_0x2ef4('0x33')],_0x408751['filters']),_0x53d59c);if(_0x5e2816[_0x2ef4('0x33')][_0x2ef4('0x3a')]){_0xac07a1[_0x2ef4('0x3b')]=_[_0x2ef4('0x3c')](_0xac07a1['where'],{'$or':_['map'](_0x53d59c,function(_0x46f44b){if(_0x46f44b[_0x2ef4('0x2e')]!=='VIRTUAL'){var _0x492bc3={};_0x492bc3[_0x46f44b[_0x2ef4('0x31')]]={'$like':'%'+_0x5e2816[_0x2ef4('0x33')][_0x2ef4('0x3a')]+'%'};return _0x492bc3;}})});}_0xac07a1=_[_0x2ef4('0x3c')]({},_0xac07a1,_0x5e2816['options']);var _0x4f2bd2={'where':_0xac07a1['where']};return db['Interval'][_0x2ef4('0x1d')](_0x4f2bd2)['then'](function(_0x1feb9d){_0x4cd4be[_0x2ef4('0x1d')]=_0x1feb9d;if(_0x5e2816[_0x2ef4('0x33')]['includeAll']){_0xac07a1['include']=[{'all':!![]}];}return db[_0x2ef4('0x3d')][_0x2ef4('0x3e')](_0xac07a1);})[_0x2ef4('0x22')](function(_0x1d6a73){_0x4cd4be['rows']=_0x1d6a73;return _0x4cd4be;})[_0x2ef4('0x22')](respondWithFilteredResult(_0x337f9f,_0xac07a1))[_0x2ef4('0x3f')](handleError(_0x337f9f,null));};exports[_0x2ef4('0x40')]=function(_0x42a33a,_0x172bdf){var _0x2a610f={'raw':!![],'where':{'id':_0x42a33a['params']['id']}},_0x5777cf={};_0x5777cf[_0x2ef4('0x30')]=_['keys'](db[_0x2ef4('0x3d')][_0x2ef4('0x2c')]);_0x5777cf['query']=_[_0x2ef4('0x32')](_0x42a33a[_0x2ef4('0x33')]);_0x5777cf[_0x2ef4('0x41')]=_[_0x2ef4('0x35')](_0x5777cf[_0x2ef4('0x30')],_0x5777cf[_0x2ef4('0x33')]);_0x2a610f[_0x2ef4('0x34')]=_[_0x2ef4('0x35')](_0x5777cf[_0x2ef4('0x30')],qs['fields'](_0x42a33a['query']['fields']));_0x2a610f[_0x2ef4('0x34')]=_0x2a610f[_0x2ef4('0x34')][_0x2ef4('0x37')]?_0x2a610f[_0x2ef4('0x34')]:_0x5777cf['model'];if(_0x42a33a[_0x2ef4('0x33')][_0x2ef4('0x42')]){_0x2a610f[_0x2ef4('0x43')]=[{'all':!![]}];}_0x2a610f=_['merge']({},_0x2a610f,_0x42a33a['options']);return db[_0x2ef4('0x3d')][_0x2ef4('0x44')](_0x2a610f)['then'](handleEntityNotFound(_0x172bdf,null))['then'](respondWithResult(_0x172bdf,null))['catch'](handleError(_0x172bdf,null));};exports[_0x2ef4('0x45')]=function(_0x1d6a91,_0x37cb18){return db[_0x2ef4('0x3d')][_0x2ef4('0x45')](_0x1d6a91[_0x2ef4('0x46')],{})[_0x2ef4('0x22')](function(_0x2f8fd6){var _0x1f2d27=_0x1d6a91[_0x2ef4('0x47')][_0x2ef4('0x24')]({'plain':!![]});if(!_0x1f2d27)throw new Error(_0x2ef4('0x48'));if(_0x1f2d27['role']===_0x2ef4('0x47')){var _0x11e0b1=_0x2f8fd6['get']({'plain':!![]});var _0xdb4831=_0x2ef4('0x25');return db[_0x2ef4('0x49')][_0x2ef4('0x44')]({'where':{'name':_0xdb4831,'userProfileId':_0x1f2d27[_0x2ef4('0x4a')]},'raw':!![]})[_0x2ef4('0x22')](function(_0x4abe5c){if(_0x4abe5c&&_0x4abe5c[_0x2ef4('0x4b')]===0x0){return db[_0x2ef4('0x4c')][_0x2ef4('0x45')]({'name':_0x11e0b1['name'],'resourceId':_0x11e0b1['id'],'type':_0x4abe5c[_0x2ef4('0x31')],'sectionId':_0x4abe5c['id']},{})[_0x2ef4('0x22')](function(){return _0x2f8fd6;});}else{return _0x2f8fd6;}})['catch'](function(_0xec383d){logger[_0x2ef4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xec383d);throw _0xec383d;});}return _0x2f8fd6;})['then'](respondWithResult(_0x37cb18,0xc9))[_0x2ef4('0x3f')](handleError(_0x37cb18,null));};exports[_0x2ef4('0x4d')]=function(_0x490458,_0x54f33b){if(_0x490458['body']['id']){delete _0x490458[_0x2ef4('0x46')]['id'];}return db[_0x2ef4('0x3d')]['find']({'where':{'id':_0x490458[_0x2ef4('0x4e')]['id']}})[_0x2ef4('0x22')](handleEntityNotFound(_0x54f33b,null))['then'](saveUpdates(_0x490458[_0x2ef4('0x46')],null))[_0x2ef4('0x22')](respondWithResult(_0x54f33b,null))[_0x2ef4('0x3f')](handleError(_0x54f33b,null));};exports['destroy']=function(_0x160f94,_0x29b02b){return db[_0x2ef4('0x3d')][_0x2ef4('0x44')]({'where':{'id':_0x160f94[_0x2ef4('0x4e')]['id']}})[_0x2ef4('0x22')](handleEntityNotFound(_0x29b02b,null))[_0x2ef4('0x22')](removeEntity(_0x29b02b,null))[_0x2ef4('0x3f')](handleError(_0x29b02b,null));};exports[_0x2ef4('0x4f')]=function(_0x57217a,_0x5bf1d5,_0x20764e){if(_0x57217a['body']['id']){delete _0x57217a['body']['id'];}return db['Interval'][_0x2ef4('0x44')]({'where':{'id':_0x57217a[_0x2ef4('0x4e')]['id']}})[_0x2ef4('0x22')](handleEntityNotFound(_0x5bf1d5,null))[_0x2ef4('0x22')](function(_0x10e7cb){if(_0x10e7cb){_0x57217a[_0x2ef4('0x46')][_0x2ef4('0x50')]=_0x10e7cb['id'];return db['Interval']['create'](_0x57217a[_0x2ef4('0x46')]);}})['then'](respondWithResult(_0x5bf1d5,null))[_0x2ef4('0x3f')](handleError(_0x5bf1d5,null));};exports['getIntervals']=function(_0x26bf45,_0x41904a,_0x52a87d){var _0x5aa300={};var _0x3fb025={};var _0x2fb9a9;var _0x106d94;return db[_0x2ef4('0x3d')][_0x2ef4('0x51')]({'where':{'id':_0x26bf45[_0x2ef4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x41904a,null))['then'](function(_0x2f5ca8){if(_0x2f5ca8){_0x2fb9a9=_0x2f5ca8;_0x3fb025[_0x2ef4('0x30')]=_['keys'](db['Interval']['rawAttributes']);_0x3fb025['query']=_[_0x2ef4('0x32')](_0x26bf45[_0x2ef4('0x33')]);_0x3fb025['filters']=_[_0x2ef4('0x35')](_0x3fb025[_0x2ef4('0x30')],_0x3fb025[_0x2ef4('0x33')]);_0x5aa300[_0x2ef4('0x34')]=_['intersection'](_0x3fb025[_0x2ef4('0x30')],qs[_0x2ef4('0x36')](_0x26bf45[_0x2ef4('0x33')][_0x2ef4('0x36')]));_0x5aa300[_0x2ef4('0x34')]=_0x5aa300['attributes']['length']?_0x5aa300[_0x2ef4('0x34')]:_0x3fb025[_0x2ef4('0x30')];_0x5aa300['order']=qs[_0x2ef4('0x52')](_0x26bf45[_0x2ef4('0x33')]['sort']);_0x5aa300[_0x2ef4('0x3b')]=qs[_0x2ef4('0x41')](_['pick'](_0x26bf45[_0x2ef4('0x33')],_0x3fb025['filters']));if(_0x26bf45['query'][_0x2ef4('0x3a')]){_0x5aa300['where']=_[_0x2ef4('0x3c')](_0x5aa300[_0x2ef4('0x3b')],{'$or':_[_0x2ef4('0x2b')](_0x5aa300['attributes'],function(_0x33afed){var _0x47d219={};_0x47d219[_0x33afed]={'$like':'%'+_0x26bf45[_0x2ef4('0x33')]['filter']+'%'};return _0x47d219;})});}_0x5aa300=_[_0x2ef4('0x3c')]({},_0x5aa300,_0x26bf45[_0x2ef4('0x53')]);return _0x2fb9a9[_0x2ef4('0x54')](_0x5aa300);}})[_0x2ef4('0x22')](function(_0x38ca01){if(_0x38ca01){_0x106d94=_0x38ca01[_0x2ef4('0x37')];if(!_0x26bf45['query'][_0x2ef4('0x55')](_0x2ef4('0x38'))){_0x5aa300[_0x2ef4('0x1c')]=qs[_0x2ef4('0x1c')](_0x26bf45['query']['limit']);_0x5aa300['offset']=qs['offset'](_0x26bf45[_0x2ef4('0x33')]['offset']);}return _0x2fb9a9[_0x2ef4('0x54')](_0x5aa300);}})[_0x2ef4('0x22')](function(_0x364e65){if(_0x364e65){return _0x364e65?{'count':_0x106d94,'rows':_0x364e65}:null;}})[_0x2ef4('0x22')](respondWithResult(_0x41904a,null))[_0x2ef4('0x3f')](handleError(_0x41904a,null));};exports['addIntervals']=function(_0x630a9,_0x2619f3,_0x56bb23){return db['Interval'][_0x2ef4('0x51')]({'where':{'id':_0x630a9[_0x2ef4('0x4e')]['id']}})[_0x2ef4('0x22')](handleEntityNotFound(_0x2619f3,null))[_0x2ef4('0x22')](function(_0xae8e5c){if(_0xae8e5c){return db[_0x2ef4('0x56')][_0x2ef4('0x57')](function(_0x4ce179){return db[_0x2ef4('0x3d')][_0x2ef4('0x23')]({'where':{'IntervalId':_0x630a9[_0x2ef4('0x4e')]['id']},'transaction':_0x4ce179})[_0x2ef4('0x22')](function(_0x315d21){var _0x4f2edb=_[_0x2ef4('0x2b')](_0x630a9[_0x2ef4('0x46')],function(_0x5e057c){delete _0x5e057c['id'];_0x5e057c[_0x2ef4('0x50')]=_0x630a9['params']['id'];return _0x5e057c;});return db['Interval'][_0x2ef4('0x58')](_0x4f2edb,{'transaction':_0x4ce179});});})['then'](function(){return db[_0x2ef4('0x3d')][_0x2ef4('0x3e')]({'where':{'IntervalId':_0x630a9[_0x2ef4('0x4e')]['id']}});});}})[_0x2ef4('0x22')](respondWithResult(_0x2619f3,null))['catch'](handleError(_0x2619f3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bc34846..668c1ee 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 _0xf473=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map'];(function(_0x3c2da4,_0x4ec94d){var _0x1ff561=function(_0x2494b3){while(--_0x2494b3){_0x3c2da4['push'](_0x3c2da4['shift']());}};_0x1ff561(++_0x4ec94d);}(_0xf473,0x14a));var _0x3f47=function(_0x301bb2,_0xc4169c){_0x301bb2=_0x301bb2-0x0;var _0x51b5ec=_0xf473[_0x301bb2];return _0x51b5ec;};'use strict';var attributes=require(_0x3f47('0x0'));var extensions=require(_0x3f47('0x1'));var iftime=require(_0x3f47('0x2'))[_0x3f47('0x3')];module[_0x3f47('0x4')]=function(_0x23f4ab){return _0x23f4ab[_0x3f47('0x5')](_0x3f47('0x6'),attributes,{'tableName':_0x3f47('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x9217a0){extensions[_0x3f47('0x8')](_0x23f4ab,_0x9217a0);},'afterBulkCreate':function(_0x5380ef,_0x5472c2,_0x3c2686){_0x3c2686();extensions[_0x3f47('0x8')](_0x23f4ab,_0x5380ef[0x0]);},'afterUpdate':function(_0x4d190f){extensions['rewrite'](_0x23f4ab,_0x4d190f);},'afterDestroy':function(_0x26b42f){extensions['rewrite'](_0x23f4ab,_0x26b42f);}},'instanceMethods':{'ifTime':function(_0x3d86d2=undefined,_0x592856=new Date()){if(typeof this[_0x3f47('0x9')]===_0x3f47('0xa')){return iftime(this[_0x3f47('0x9')],_0x3d86d2,_0x592856);}else{return this[_0x3f47('0xb')]()[_0x3f47('0xc')](function(_0x5ac91c){return Promise[_0x3f47('0xd')](_0x5ac91c[_0x3f47('0xe')](function(_0x46a2bf){return _0x46a2bf['ifTime'](_0x3d86d2,_0x592856);}));})[_0x3f47('0xc')](function(_0x43b845){return _0x43b845['reduce'](function(_0xfdd175,_0x435690){return _0xfdd175||_0x435690;},![]);});}}}});}; \ No newline at end of file +var _0xb4a5=['rewrite','interval','getIntervals','then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals'];(function(_0x95a1de,_0x567c5b){var _0x436ffe=function(_0x864b05){while(--_0x864b05){_0x95a1de['push'](_0x95a1de['shift']());}};_0x436ffe(++_0x567c5b);}(_0xb4a5,0x106));var _0x5b4a=function(_0x143381,_0x4c6ba5){_0x143381=_0x143381-0x0;var _0xba8169=_0xb4a5[_0x143381];return _0xba8169;};'use strict';var attributes=require(_0x5b4a('0x0'));var extensions=require(_0x5b4a('0x1'));var iftime=require(_0x5b4a('0x2'))[_0x5b4a('0x3')];module[_0x5b4a('0x4')]=function(_0x2b05cc){return _0x2b05cc[_0x5b4a('0x5')](_0x5b4a('0x6'),attributes,{'tableName':_0x5b4a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c24ea){extensions['rewrite'](_0x2b05cc,_0x1c24ea);},'afterBulkCreate':function(_0x475f10,_0x2e868f,_0x26a2da){_0x26a2da();extensions[_0x5b4a('0x8')](_0x2b05cc,_0x475f10[0x0]);},'afterUpdate':function(_0x4cf0c0){extensions[_0x5b4a('0x8')](_0x2b05cc,_0x4cf0c0);},'afterDestroy':function(_0x11ccb7){extensions[_0x5b4a('0x8')](_0x2b05cc,_0x11ccb7);}},'instanceMethods':{'ifTime':function(_0x1bf87b=undefined,_0x310bb4=new Date()){if(typeof this[_0x5b4a('0x9')]==='string'){return iftime(this[_0x5b4a('0x9')],_0x1bf87b,_0x310bb4);}else{return this[_0x5b4a('0xa')]()[_0x5b4a('0xb')](function(_0x254ecf){return Promise[_0x5b4a('0xc')](_0x254ecf[_0x5b4a('0xd')](function(_0x141d2f){return _0x141d2f['ifTime'](_0x1bf87b,_0x310bb4);}));})[_0x5b4a('0xb')](function(_0x5f1ff2){return _0x5f1ff2[_0x5b4a('0xe')](function(_0x2723b2,_0x3bf28d){return _0x2723b2||_0x3bf28d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 350bc41..2d70d69 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 _0xe352=['find','attributes','info','debug','all','ifTime','reduce','name','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','resolve','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','findAll','options','raw','where','limit','include','map','model','then','GetInterval','stringify','catch','error','message','ShowInterval','Interval'];(function(_0x3c2c14,_0x9c61a4){var _0x10c214=function(_0x581a89){while(--_0x581a89){_0x3c2c14['push'](_0x3c2c14['shift']());}};_0x10c214(++_0x9c61a4);}(_0xe352,0x86));var _0x2e35=function(_0x30f635,_0x3027e0){_0x30f635=_0x30f635-0x0;var _0x4a3be0=_0xe352[_0x30f635];return _0x4a3be0;};'use strict';var _=require(_0x2e35('0x0'));var util=require(_0x2e35('0x1'));var db=require(_0x2e35('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x2e35('0x3')];var logger=require(_0x2e35('0x4'))(_0x2e35('0x5'));exports['GetInterval']=function(_0x43d049){var _0x310b4e=this;return new Promise(function(_0x3a15a9,_0x5146b3){return db['Interval'][_0x2e35('0x6')]({'raw':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0x8')]===undefined?!![]:![]:!![],'where':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0x9')]||null:null,'attributes':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')]['attributes']||null:null,'limit':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0xa')]||null:null,'include':_0x43d049[_0x2e35('0x7')]?_0x43d049[_0x2e35('0x7')][_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x43d049[_0x2e35('0x7')][_0x2e35('0xb')],function(_0x473643){return{'model':db[_0x473643[_0x2e35('0xd')]],'as':_0x473643['as'],'attributes':_0x473643['attributes'],'include':_0x473643['include']?_[_0x2e35('0xc')](_0x473643['include'],function(_0x1f0f88){return{'model':db[_0x1f0f88[_0x2e35('0xd')]],'as':_0x1f0f88['as'],'attributes':_0x1f0f88['attributes'],'include':_0x1f0f88[_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x1f0f88[_0x2e35('0xb')],function(_0x2d7564){return{'model':db[_0x2d7564[_0x2e35('0xd')]],'as':_0x2d7564['as'],'attributes':_0x2d7564['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e35('0xe')](function(_0x2de4b0){logger['info'](_0x2e35('0xf'),_0x43d049);logger['debug'](_0x2e35('0xf'),_0x43d049,JSON[_0x2e35('0x10')](_0x2de4b0));_0x3a15a9(_0x2de4b0);})[_0x2e35('0x11')](function(_0x3f564f){logger[_0x2e35('0x12')]('GetInterval',_0x3f564f['message'],_0x43d049);_0x5146b3(_0x310b4e[_0x2e35('0x12')](0x1f4,_0x3f564f[_0x2e35('0x13')]));});});};exports[_0x2e35('0x14')]=function(_0xd81cda){var _0x3ff4cd=this;return new Promise(function(_0xb46423,_0x359597){return db[_0x2e35('0x15')][_0x2e35('0x16')]({'raw':_0xd81cda[_0x2e35('0x7')]?_0xd81cda['options']['raw']===undefined?!![]:![]:!![],'where':_0xd81cda[_0x2e35('0x7')]?_0xd81cda[_0x2e35('0x7')][_0x2e35('0x9')]||null:null,'attributes':_0xd81cda['options']?_0xd81cda[_0x2e35('0x7')][_0x2e35('0x17')]||null:null,'include':_0xd81cda[_0x2e35('0x7')]?_0xd81cda['options']['include']?_[_0x2e35('0xc')](_0xd81cda[_0x2e35('0x7')][_0x2e35('0xb')],function(_0x19694d){return{'model':db[_0x19694d[_0x2e35('0xd')]],'as':_0x19694d['as'],'attributes':_0x19694d[_0x2e35('0x17')],'include':_0x19694d[_0x2e35('0xb')]?_[_0x2e35('0xc')](_0x19694d[_0x2e35('0xb')],function(_0x293077){return{'model':db[_0x293077[_0x2e35('0xd')]],'as':_0x293077['as'],'attributes':_0x293077['attributes'],'include':_0x293077['include']?_[_0x2e35('0xc')](_0x293077[_0x2e35('0xb')],function(_0x4378ae){return{'model':db[_0x4378ae['model']],'as':_0x4378ae['as'],'attributes':_0x4378ae[_0x2e35('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2e35('0xe')](function(_0x3dba66){logger[_0x2e35('0x18')](_0x2e35('0x14'),_0xd81cda);logger[_0x2e35('0x19')](_0x2e35('0x14'),_0xd81cda,JSON['stringify'](_0x3dba66));_0xb46423(_0x3dba66);})[_0x2e35('0x11')](function(_0x4fdc63){logger[_0x2e35('0x12')]('ShowInterval',_0x4fdc63[_0x2e35('0x13')],_0xd81cda);_0x359597(_0x3ff4cd[_0x2e35('0x12')](0x1f4,_0x4fdc63[_0x2e35('0x13')]));});});};function checkArrayOfIntervals(_0x4096d8,_0xe5dd7a){var _0xd7d0b8=[];return db[_0x2e35('0x15')]['findAll']({'where':{'id':_0x4096d8}})[_0x2e35('0xe')](function(_0x2e4398){_0xd7d0b8=_0x2e4398;return Promise[_0x2e35('0x1a')](_0xd7d0b8[_0x2e35('0xc')](function(_0x217121){return _0x217121[_0x2e35('0x1b')](_0xe5dd7a);}));})[_0x2e35('0xe')](function(_0x2e7b25){var _0x42b605=_0x2e7b25[_0x2e35('0x1c')](function(_0x5adee3,_0x467820){return _0x5adee3||_0x467820;},![]);logger[_0x2e35('0x18')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xd7d0b8[_0x2e35('0xc')](function(_0x220c7e){return _0x220c7e[_0x2e35('0x1d')];})[_0x2e35('0x1e')](',\x20'),_0xd7d0b8[_0x2e35('0xc')](function(_0x11102c){return _0x11102c['id'];})[_0x2e35('0x1e')](',\x20')));return _0x42b605;});}function checkSingleInterval(_0x504201,_0x50e838){return db[_0x2e35('0x15')]['findById'](_0x504201)[_0x2e35('0xe')](function(_0x243006){if(_0x243006){logger['info'](util[_0x2e35('0x1f')](_0x2e35('0x20'),_0x243006[_0x2e35('0x1d')],_0x243006['id']));return _0x243006['ifTime'](_0x50e838);}});}exports[_0x2e35('0x21')]=function(_0x2e0c3a){var _0xb5abbd=_0x2e0c3a[_0x2e35('0x22')];var _0x39ec72=Array['isArray'](_0x2e0c3a['intervals'])?_0x2e0c3a['intervals']:typeof _0x2e0c3a[_0x2e35('0x23')]==='string'?[_0x2e0c3a[_0x2e35('0x23')]]:[];var _0x435300=_0x2e0c3a['timezone']||undefined;var _0x1d6364=![];if(_0x39ec72['length']){logger[_0x2e35('0x18')](util[_0x2e35('0x1f')](_0x2e35('0x24'),_0x39ec72[_0x2e35('0x1e')](';\x20')));}if(_0x435300){logger[_0x2e35('0x18')](util[_0x2e35('0x1f')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x435300));}logger[_0x2e35('0x19')]('Iftime',_0x1d6364);logger[_0x2e35('0x25')](_0x2e35('0x21'),_0x2e0c3a);return Promise[_0x2e35('0x26')]()['then'](function(){if(Array['isArray'](_0xb5abbd)){return checkArrayOfIntervals(_0xb5abbd,_0x435300);}else if(_0xb5abbd){return checkSingleInterval(_0xb5abbd,_0x435300);}})['then'](function(_0x417818){var _0x311a8e=_0x39ec72['reduce'](function(_0x34d235,_0x246f7c){return _0x34d235||iftime(_0x246f7c,_0x435300);},![]);_0x1d6364=_0x417818||_0x311a8e;return _0x1d6364;})[_0x2e35('0x11')](function(_0x4085e2){logger[_0x2e35('0x12')](_0x2e35('0x21'),_0x2e0c3a,_0x4085e2);throw this[_0x2e35('0x12')](0x1f4,_0x4085e2[_0x2e35('0x13')]);});}; \ No newline at end of file +var _0xdbf7=['isArray','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','find','raw','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime','intervalIds','intervals','string','timezone','length','resolve'];(function(_0x507a80,_0x5e15b9){var _0x45f4af=function(_0x4319f3){while(--_0x4319f3){_0x507a80['push'](_0x507a80['shift']());}};_0x45f4af(++_0x5e15b9);}(_0xdbf7,0x1a6));var _0x7dbf=function(_0x2498cb,_0x2bd5f8){_0x2498cb=_0x2498cb-0x0;var _0x1b5588=_0xdbf7[_0x2498cb];return _0x1b5588;};'use strict';var _=require(_0x7dbf('0x0'));var util=require(_0x7dbf('0x1'));var db=require(_0x7dbf('0x2'))['db'];var iftime=require(_0x7dbf('0x3'))[_0x7dbf('0x4')];var logger=require(_0x7dbf('0x5'))(_0x7dbf('0x6'));exports[_0x7dbf('0x7')]=function(_0x5fa92){var _0x5c80d9=this;return new Promise(function(_0x42782b,_0x268a05){return db['Interval'][_0x7dbf('0x8')]({'raw':_0x5fa92[_0x7dbf('0x9')]?_0x5fa92[_0x7dbf('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5fa92['options']?_0x5fa92[_0x7dbf('0x9')][_0x7dbf('0xa')]||null:null,'attributes':_0x5fa92[_0x7dbf('0x9')]?_0x5fa92['options'][_0x7dbf('0xb')]||null:null,'limit':_0x5fa92[_0x7dbf('0x9')]?_0x5fa92[_0x7dbf('0x9')][_0x7dbf('0xc')]||null:null,'include':_0x5fa92[_0x7dbf('0x9')]?_0x5fa92[_0x7dbf('0x9')]['include']?_['map'](_0x5fa92[_0x7dbf('0x9')][_0x7dbf('0xd')],function(_0x28c708){return{'model':db[_0x28c708[_0x7dbf('0xe')]],'as':_0x28c708['as'],'attributes':_0x28c708[_0x7dbf('0xb')],'include':_0x28c708['include']?_['map'](_0x28c708[_0x7dbf('0xd')],function(_0x402814){return{'model':db[_0x402814['model']],'as':_0x402814['as'],'attributes':_0x402814[_0x7dbf('0xb')],'include':_0x402814['include']?_[_0x7dbf('0xf')](_0x402814[_0x7dbf('0xd')],function(_0x3113b3){return{'model':db[_0x3113b3['model']],'as':_0x3113b3['as'],'attributes':_0x3113b3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7dbf('0x10')](function(_0x407514){logger[_0x7dbf('0x11')](_0x7dbf('0x7'),_0x5fa92);logger[_0x7dbf('0x12')](_0x7dbf('0x7'),_0x5fa92,JSON[_0x7dbf('0x13')](_0x407514));_0x42782b(_0x407514);})[_0x7dbf('0x14')](function(_0x47c741){logger[_0x7dbf('0x15')](_0x7dbf('0x7'),_0x47c741[_0x7dbf('0x16')],_0x5fa92);_0x268a05(_0x5c80d9['error'](0x1f4,_0x47c741['message']));});});};exports[_0x7dbf('0x17')]=function(_0x3a4b57){var _0x361885=this;return new Promise(function(_0x4168a4,_0x29f60b){return db[_0x7dbf('0x18')][_0x7dbf('0x19')]({'raw':_0x3a4b57['options']?_0x3a4b57[_0x7dbf('0x9')][_0x7dbf('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a4b57['options']?_0x3a4b57[_0x7dbf('0x9')][_0x7dbf('0xa')]||null:null,'attributes':_0x3a4b57[_0x7dbf('0x9')]?_0x3a4b57[_0x7dbf('0x9')][_0x7dbf('0xb')]||null:null,'include':_0x3a4b57[_0x7dbf('0x9')]?_0x3a4b57[_0x7dbf('0x9')]['include']?_[_0x7dbf('0xf')](_0x3a4b57[_0x7dbf('0x9')][_0x7dbf('0xd')],function(_0x447022){return{'model':db[_0x447022['model']],'as':_0x447022['as'],'attributes':_0x447022[_0x7dbf('0xb')],'include':_0x447022[_0x7dbf('0xd')]?_[_0x7dbf('0xf')](_0x447022[_0x7dbf('0xd')],function(_0x289d7f){return{'model':db[_0x289d7f[_0x7dbf('0xe')]],'as':_0x289d7f['as'],'attributes':_0x289d7f[_0x7dbf('0xb')],'include':_0x289d7f[_0x7dbf('0xd')]?_[_0x7dbf('0xf')](_0x289d7f[_0x7dbf('0xd')],function(_0x9c03fa){return{'model':db[_0x9c03fa[_0x7dbf('0xe')]],'as':_0x9c03fa['as'],'attributes':_0x9c03fa[_0x7dbf('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7dbf('0x10')](function(_0x6e4718){logger[_0x7dbf('0x11')]('ShowInterval',_0x3a4b57);logger[_0x7dbf('0x12')]('ShowInterval',_0x3a4b57,JSON[_0x7dbf('0x13')](_0x6e4718));_0x4168a4(_0x6e4718);})[_0x7dbf('0x14')](function(_0x36262a){logger[_0x7dbf('0x15')](_0x7dbf('0x17'),_0x36262a[_0x7dbf('0x16')],_0x3a4b57);_0x29f60b(_0x361885[_0x7dbf('0x15')](0x1f4,_0x36262a[_0x7dbf('0x16')]));});});};function checkArrayOfIntervals(_0x5c2b7e,_0x120fdf){var _0x5a737a=[];return db[_0x7dbf('0x18')][_0x7dbf('0x8')]({'where':{'id':_0x5c2b7e}})[_0x7dbf('0x10')](function(_0x14d3b4){_0x5a737a=_0x14d3b4;return Promise['all'](_0x5a737a[_0x7dbf('0xf')](function(_0x408ec5){return _0x408ec5[_0x7dbf('0x1b')](_0x120fdf);}));})[_0x7dbf('0x10')](function(_0x27b8ca){var _0x203cb0=_0x27b8ca['reduce'](function(_0x530365,_0x52ecc8){return _0x530365||_0x52ecc8;},![]);logger[_0x7dbf('0x11')](util['format'](_0x7dbf('0x1c'),_0x5a737a[_0x7dbf('0xf')](function(_0x3b6d02){return _0x3b6d02[_0x7dbf('0x1d')];})[_0x7dbf('0x1e')](',\x20'),_0x5a737a['map'](function(_0xecd3cf){return _0xecd3cf['id'];})[_0x7dbf('0x1e')](',\x20')));return _0x203cb0;});}function checkSingleInterval(_0x471c03,_0x13c961){return db[_0x7dbf('0x18')][_0x7dbf('0x1f')](_0x471c03)[_0x7dbf('0x10')](function(_0x347243){if(_0x347243){logger[_0x7dbf('0x11')](util[_0x7dbf('0x20')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x347243['name'],_0x347243['id']));return _0x347243[_0x7dbf('0x1b')](_0x13c961);}});}exports[_0x7dbf('0x21')]=function(_0x548e2c){var _0x2bd08b=_0x548e2c[_0x7dbf('0x22')];var _0x47bda1=Array['isArray'](_0x548e2c[_0x7dbf('0x23')])?_0x548e2c[_0x7dbf('0x23')]:typeof _0x548e2c[_0x7dbf('0x23')]===_0x7dbf('0x24')?[_0x548e2c[_0x7dbf('0x23')]]:[];var _0x3c752f=_0x548e2c[_0x7dbf('0x25')]||undefined;var _0x810bb4=![];if(_0x47bda1[_0x7dbf('0x26')]){logger[_0x7dbf('0x11')](util[_0x7dbf('0x20')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x47bda1[_0x7dbf('0x1e')](';\x20')));}if(_0x3c752f){logger[_0x7dbf('0x11')](util[_0x7dbf('0x20')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x3c752f));}logger[_0x7dbf('0x12')]('Iftime',_0x810bb4);logger['silly']('IntervalIftime',_0x548e2c);return Promise[_0x7dbf('0x27')]()[_0x7dbf('0x10')](function(){if(Array[_0x7dbf('0x28')](_0x2bd08b)){return checkArrayOfIntervals(_0x2bd08b,_0x3c752f);}else if(_0x2bd08b){return checkSingleInterval(_0x2bd08b,_0x3c752f);}})['then'](function(_0x31d1d1){var _0x5ecc9b=_0x47bda1[_0x7dbf('0x29')](function(_0x37958e,_0x1a9bd5){return _0x37958e||iftime(_0x1a9bd5,_0x3c752f);},![]);_0x810bb4=_0x31d1d1||_0x5ecc9b;return _0x810bb4;})[_0x7dbf('0x14')](function(_0x479def){logger[_0x7dbf('0x15')](_0x7dbf('0x21'),_0x548e2c,_0x479def);throw this[_0x7dbf('0x15')](0x1f4,_0x479def[_0x7dbf('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 57658c6..265ffff 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(_0x36f6de,_0x380843){var _0x2fed42=function(_0x4d1da7){while(--_0x4d1da7){_0x36f6de['push'](_0x36f6de['shift']());}};_0x2fed42(++_0x380843);}(_0xdb28,0x106));var _0x8db2=function(_0x389b28,_0x40b8d3){_0x389b28=_0x389b28-0x0;var _0x2764ec=_0xdb28[_0x389b28];return _0x2764ec;};'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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb10b,0x12a));var _0xbb10=function(_0xf65bf8,_0x494a66){_0xf65bf8=_0xf65bf8-0x0;var _0x2e4a66=_0xb10b[_0xf65bf8];return _0x2e4a66;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5480c09..2edf967 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 _0x0257=['socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','statusCode','json','parse','error','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0257,0x14a));var _0x7025=function(_0x223bbd,_0x2f8c30){_0x223bbd=_0x223bbd-0x0;var _0x11e852=_0x0257[_0x223bbd];return _0x11e852;};'use strict';var BPromise=require(_0x7025('0x0'));var https=require('https');var logger=require(_0x7025('0x1'))(_0x7025('0x2'));var USERNAME=_0x7025('0x3');var PASSWORD=_0x7025('0x4');function openIssue(_0xe9270f,_0x3afd84){var _0x5a2fa4={'fields':{'project':{'key':_0xe9270f[_0x7025('0x5')]||_0x7025('0x6')},'summary':(_0xe9270f[_0x7025('0x7')]||'Report')+_0x7025('0x8')+_0xe9270f['ip'],'description':_0xe9270f['description']||JSON[_0x7025('0x9')](_0xe9270f),'issuetype':{'name':_0xe9270f[_0x7025('0xa')]||_0x7025('0xb')}}};_0x5a2fa4[_0x7025('0xc')][_0x7025('0xd')]=_0xe9270f[_0x7025('0xe')];_0x5a2fa4[_0x7025('0xc')][_0x7025('0xf')]=_0xe9270f[_0x7025('0x10')];_0x5a2fa4['fields'][_0x7025('0x11')]=_0xe9270f[_0x7025('0x12')];_0x5a2fa4[_0x7025('0xc')][_0x7025('0x13')]=_0xe9270f[_0x7025('0x14')];_0x5a2fa4['fields'][_0x7025('0x15')]=_0xe9270f[_0x7025('0x16')];_0x5a2fa4[_0x7025('0xc')]['customfield_10102']=_0xe9270f['ip'];var _0x244c83={'host':_0x7025('0x17'),'port':0x1bb,'path':_0x7025('0x18'),'method':_0x7025('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x7025('0x1a'),'Authorization':_0x7025('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7025('0x1c'))}};var _0x1d4e52=JSON[_0x7025('0x9')](_0x5a2fa4);var _0x357d16=https[_0x7025('0x1d')](_0x244c83,function(_0x56af26){_0x56af26[_0x7025('0x1e')](_0x7025('0x1f'));var _0x381250='';_0x56af26['on']('data',function(_0x44031f){_0x381250+=_0x44031f;});_0x56af26['on'](_0x7025('0x20'),function(){if(_0x3afd84){return _0x3afd84[_0x7025('0x21')](_0x56af26[_0x7025('0x22')])[_0x7025('0x23')](JSON[_0x7025('0x24')](_0x381250));}});});_0x357d16['on'](_0x7025('0x25'),function(_0x2c90c9){if(_0x3afd84){return _0x3afd84[_0x7025('0x21')](0x1f4)[_0x7025('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7025('0x26')}]});}});_0x357d16[_0x7025('0x27')](_0x1d4e52);_0x357d16[_0x7025('0x20')]();}exports[_0x7025('0x28')]=openIssue;exports['send']=function(_0x30a800,_0x56bb85){_0x30a800[_0x7025('0x29')]['ip']=_0x30a800[_0x7025('0x2a')][_0x7025('0x2b')]||_0x30a800[_0x7025('0x2c')][_0x7025('0x2d')]||_0x30a800[_0x7025('0x2e')][_0x7025('0x2d')]||_0x30a800[_0x7025('0x2c')]['socket'][_0x7025('0x2d')];return openIssue(_0x30a800[_0x7025('0x29')],_0x56bb85);}; \ No newline at end of file +var _0x47aa=['customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','customfield_11501','oldToken'];(function(_0x37a774,_0x24c001){var _0x5eacc6=function(_0x3ffac8){while(--_0x3ffac8){_0x37a774['push'](_0x37a774['shift']());}};_0x5eacc6(++_0x24c001);}(_0x47aa,0x7b));var _0xa47a=function(_0xddae8e,_0x2bada1){_0xddae8e=_0xddae8e-0x0;var _0x22353b=_0x47aa[_0xddae8e];return _0x22353b;};'use strict';var BPromise=require(_0xa47a('0x0'));var https=require('https');var logger=require(_0xa47a('0x1'))(_0xa47a('0x2'));var USERNAME='support';var PASSWORD=_0xa47a('0x3');function openIssue(_0x506694,_0x17d240){var _0x4be1ed={'fields':{'project':{'key':_0x506694[_0xa47a('0x4')]||'MOTGUI'},'summary':(_0x506694[_0xa47a('0x5')]||_0xa47a('0x6'))+_0xa47a('0x7')+_0x506694['ip'],'description':_0x506694[_0xa47a('0x8')]||JSON[_0xa47a('0x9')](_0x506694),'issuetype':{'name':_0x506694[_0xa47a('0xa')]||'Bug'}}};_0x4be1ed[_0xa47a('0xb')][_0xa47a('0xc')]=_0x506694['email'];_0x4be1ed[_0xa47a('0xb')][_0xa47a('0xd')]=_0x506694[_0xa47a('0xe')];_0x4be1ed[_0xa47a('0xb')][_0xa47a('0xf')]=_0x506694['newToken'];_0x4be1ed['fields'][_0xa47a('0x10')]=_0x506694[_0xa47a('0x11')];_0x4be1ed['fields'][_0xa47a('0x12')]=_0x506694[_0xa47a('0x13')];_0x4be1ed[_0xa47a('0xb')][_0xa47a('0x14')]=_0x506694['ip'];var _0x1828e5={'host':_0xa47a('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa47a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xa47a('0x17'),'Authorization':_0xa47a('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xa47a('0x19')](_0xa47a('0x1a'))}};var _0xb6c9c3=JSON[_0xa47a('0x9')](_0x4be1ed);var _0x31f900=https[_0xa47a('0x1b')](_0x1828e5,function(_0x576672){_0x576672['setEncoding'](_0xa47a('0x1c'));var _0x26f132='';_0x576672['on'](_0xa47a('0x1d'),function(_0x23fc08){_0x26f132+=_0x23fc08;});_0x576672['on'](_0xa47a('0x1e'),function(){if(_0x17d240){return _0x17d240[_0xa47a('0x1f')](_0x576672[_0xa47a('0x20')])[_0xa47a('0x21')](JSON['parse'](_0x26f132));}});});_0x31f900['on'](_0xa47a('0x22'),function(_0xb6256c){if(_0x17d240){return _0x17d240['status'](0x1f4)['json']({'errors':[{'message':_0xa47a('0x23'),'type':_0xa47a('0x24')}]});}});_0x31f900[_0xa47a('0x25')](_0xb6c9c3);_0x31f900[_0xa47a('0x1e')]();}exports[_0xa47a('0x26')]=openIssue;exports[_0xa47a('0x27')]=function(_0x5e0371,_0x182cdb){_0x5e0371[_0xa47a('0x28')]['ip']=_0x5e0371[_0xa47a('0x29')][_0xa47a('0x2a')]||_0x5e0371['connection']['remoteAddress']||_0x5e0371['socket'][_0xa47a('0x2b')]||_0x5e0371[_0xa47a('0x2c')][_0xa47a('0x2d')][_0xa47a('0x2b')];return openIssue(_0x5e0371['body'],_0x182cdb);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index dbfa146..b5212a7 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 _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xe2280b,_0x491bd6){var _0x295d4b=function(_0x221790){while(--_0x221790){_0xe2280b['push'](_0xe2280b['shift']());}};_0x295d4b(++_0x491bd6);}(_0xee5b,0x1f4));var _0xbee5=function(_0x27eeac,_0x41f91c){_0x27eeac=_0x27eeac-0x0;var _0x31ca39=_0xee5b[_0x27eeac];return _0x31ca39;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0xaa7a9f,_0x8d5e2f){var _0x3b9927=function(_0x315f30){while(--_0x315f30){_0xaa7a9f['push'](_0xaa7a9f['shift']());}};_0x3b9927(++_0x8d5e2f);}(_0xec56,0x1bd));var _0x6ec5=function(_0x32512f,_0x2b472e){_0x32512f=_0x32512f-0x0;var _0x102c5b=_0xec56[_0x32512f];return _0x102c5b;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);module[_0x6ec5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 49e59bf..e42e8b4 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x4935ce,_0x45e493){_0x4935ce=_0x4935ce-0x0;var _0x497941=_0x7a54[_0x4935ce];return _0x497941;};'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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x505816,_0x4f82c9){_0x505816=_0x505816-0x0;var _0x34ba64=_0x7a54[_0x505816];return _0x34ba64;};'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 f85eead..c157fe3 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 _0xa786=['stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','update','then','destroy','end'];(function(_0x2bd7c7,_0x4e3ea3){var _0x27e326=function(_0x512531){while(--_0x512531){_0x2bd7c7['push'](_0x2bd7c7['shift']());}};_0x27e326(++_0x4e3ea3);}(_0xa786,0x71));var _0x6a78=function(_0x209db9,_0x4f159c){_0x209db9=_0x209db9-0x0;var _0x1d0d3a=_0xa786[_0x209db9];return _0x1d0d3a;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];function respondWithStatusCode(_0x1fd1be,_0x5b633c){_0x5b633c=_0x5b633c||0xcc;return function(_0x24a60a){if(_0x24a60a){return _0x1fd1be[_0x6a78('0x1a')](_0x5b633c);}return _0x1fd1be[_0x6a78('0x1b')](_0x5b633c)['end']();};}function respondWithResult(_0x44c863,_0xecf980){_0xecf980=_0xecf980||0xc8;return function(_0x4c5351){if(_0x4c5351){return _0x44c863[_0x6a78('0x1b')](_0xecf980)[_0x6a78('0x1c')](_0x4c5351);}};}function respondWithFilteredResult(_0xe27467,_0x40ef48){return function(_0x3deede){if(_0x3deede){var _0x36e824=typeof _0x40ef48['offset']===_0x6a78('0x1d')&&typeof _0x40ef48[_0x6a78('0x1e')]===_0x6a78('0x1d');var _0x265f90=_0x3deede['count'];var _0x5e3616=_0x36e824?0x0:_0x40ef48[_0x6a78('0x1f')];var _0x585917=_0x36e824?_0x3deede['count']:_0x40ef48['offset']+_0x40ef48[_0x6a78('0x1e')];var _0xed3863;if(_0x585917>=_0x265f90){_0x585917=_0x265f90;_0xed3863=0xc8;}else{_0xed3863=0xce;}_0xe27467[_0x6a78('0x1b')](_0xed3863);return _0xe27467['set']('Content-Range',_0x5e3616+'-'+_0x585917+'/'+_0x265f90)[_0x6a78('0x1c')](_0x3deede);}return null;};}function patchUpdates(_0x29dec5){return function(_0x356b93){try{jsonpatch[_0x6a78('0x20')](_0x356b93,_0x29dec5,!![]);}catch(_0x5dc3fa){return BPromise['reject'](_0x5dc3fa);}return _0x356b93['save']();};}function saveUpdates(_0xd57884,_0x5869fd){return function(_0xd938cd){if(_0xd938cd){return _0xd938cd[_0x6a78('0x21')](_0xd57884)[_0x6a78('0x22')](function(_0x4b47b6){return _0x4b47b6;});}return null;};}function removeEntity(_0x49f711,_0xa5f42f){return function(_0x89fd2b){if(_0x89fd2b){return _0x89fd2b[_0x6a78('0x23')]()[_0x6a78('0x22')](function(){_0x49f711[_0x6a78('0x1b')](0xcc)[_0x6a78('0x24')]();});}};}function handleEntityNotFound(_0xefaa55,_0x4ea33e){return function(_0x28cbbf){if(!_0x28cbbf){_0xefaa55[_0x6a78('0x1a')](0x194);}return _0x28cbbf;};}function handleError(_0x1e91ad,_0x57a859){_0x57a859=_0x57a859||0x1f4;return function(_0x19860c){logger['error'](_0x19860c[_0x6a78('0x25')]);if(_0x19860c[_0x6a78('0x26')]){delete _0x19860c['name'];}_0x1e91ad[_0x6a78('0x1b')](_0x57a859)[_0x6a78('0x27')](_0x19860c);};}exports[_0x6a78('0x28')]=function(_0x149105,_0x5942c0){var _0x8bc302={},_0x125ca2={},_0x273a73={'count':0x0,'rows':[]};var _0x12e0c5=_['map'](db[_0x6a78('0x29')][_0x6a78('0x2a')],function(_0x3299c2){return{'name':_0x3299c2['fieldName'],'type':_0x3299c2[_0x6a78('0x2b')][_0x6a78('0x2c')]};});_0x125ca2['model']=_[_0x6a78('0x2d')](_0x12e0c5,_0x6a78('0x26'));_0x125ca2[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0x149105[_0x6a78('0x2e')]);_0x125ca2['filters']=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],_0x125ca2['query']);_0x8bc302[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x33')]));_0x8bc302['attributes']=_0x8bc302[_0x6a78('0x32')]['length']?_0x8bc302[_0x6a78('0x32')]:_0x125ca2[_0x6a78('0x31')];if(!_0x149105[_0x6a78('0x2e')][_0x6a78('0x34')](_0x6a78('0x35'))){_0x8bc302[_0x6a78('0x1e')]=qs[_0x6a78('0x1e')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x1e')]);_0x8bc302['offset']=qs['offset'](_0x149105[_0x6a78('0x2e')]['offset']);}_0x8bc302[_0x6a78('0x36')]=qs[_0x6a78('0x37')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x37')]);_0x8bc302[_0x6a78('0x38')]=qs[_0x6a78('0x39')](_[_0x6a78('0x3a')](_0x149105[_0x6a78('0x2e')],_0x125ca2['filters']),_0x12e0c5);if(_0x149105[_0x6a78('0x2e')][_0x6a78('0x3b')]){_0x8bc302[_0x6a78('0x38')]=_['merge'](_0x8bc302[_0x6a78('0x38')],{'$or':_['map'](_0x12e0c5,function(_0x310ab2){if(_0x310ab2[_0x6a78('0x2b')]!==_0x6a78('0x3c')){var _0xe180fb={};_0xe180fb[_0x310ab2['name']]={'$like':'%'+_0x149105['query']['filter']+'%'};return _0xe180fb;}})});}_0x8bc302=_[_0x6a78('0x3d')]({},_0x8bc302,_0x149105[_0x6a78('0x3e')]);var _0x48eafa={'where':_0x8bc302[_0x6a78('0x38')]};return db[_0x6a78('0x29')][_0x6a78('0x3f')](_0x48eafa)[_0x6a78('0x22')](function(_0x44d5f7){_0x273a73[_0x6a78('0x3f')]=_0x44d5f7;if(_0x149105['query'][_0x6a78('0x40')]){_0x8bc302[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x29')][_0x6a78('0x42')](_0x8bc302);})[_0x6a78('0x22')](function(_0x23dcce){_0x273a73[_0x6a78('0x43')]=_0x23dcce;return _0x273a73;})['then'](respondWithFilteredResult(_0x5942c0,_0x8bc302))[_0x6a78('0x44')](handleError(_0x5942c0,null));};exports['show']=function(_0xeddf03,_0x4d3aec){var _0x526f09={'raw':!![],'where':{'id':_0xeddf03[_0x6a78('0x45')]['id']}},_0xc8f3e8={};_0xc8f3e8['model']=_[_0x6a78('0x2f')](db[_0x6a78('0x29')][_0x6a78('0x2a')]);_0xc8f3e8[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0xeddf03['query']);_0xc8f3e8['filters']=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],_0xc8f3e8[_0x6a78('0x2e')]);_0x526f09[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0xeddf03['query'][_0x6a78('0x33')]));_0x526f09[_0x6a78('0x32')]=_0x526f09['attributes'][_0x6a78('0x46')]?_0x526f09[_0x6a78('0x32')]:_0xc8f3e8[_0x6a78('0x31')];if(_0xeddf03[_0x6a78('0x2e')][_0x6a78('0x40')]){_0x526f09[_0x6a78('0x41')]=[{'all':!![]}];}_0x526f09=_['merge']({},_0x526f09,_0xeddf03[_0x6a78('0x3e')]);return db[_0x6a78('0x29')][_0x6a78('0x47')](_0x526f09)[_0x6a78('0x22')](handleEntityNotFound(_0x4d3aec,null))[_0x6a78('0x22')](respondWithResult(_0x4d3aec,null))['catch'](handleError(_0x4d3aec,null));};exports[_0x6a78('0x48')]=function(_0x59a4c1,_0x1bdd6b){return db[_0x6a78('0x29')]['create'](_0x59a4c1[_0x6a78('0x49')],{})['then'](respondWithResult(_0x1bdd6b,0xc9))[_0x6a78('0x44')](handleError(_0x1bdd6b,null));};exports[_0x6a78('0x21')]=function(_0xe40d18,_0x46c94e){if(_0xe40d18[_0x6a78('0x49')]['id']){delete _0xe40d18['body']['id'];}return db['JscriptyAnswerReport'][_0x6a78('0x47')]({'where':{'id':_0xe40d18[_0x6a78('0x45')]['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x46c94e,null))[_0x6a78('0x22')](saveUpdates(_0xe40d18['body'],null))[_0x6a78('0x22')](respondWithResult(_0x46c94e,null))[_0x6a78('0x44')](handleError(_0x46c94e,null));};exports[_0x6a78('0x23')]=function(_0x57c0c4,_0x57bd8a){return db[_0x6a78('0x29')]['find']({'where':{'id':_0x57c0c4['params']['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x57bd8a,null))[_0x6a78('0x22')](removeEntity(_0x57bd8a,null))[_0x6a78('0x44')](handleError(_0x57bd8a,null));};exports[_0x6a78('0x4a')]=function(_0x15ca1a,_0x5a4d6e){return db['JscriptyAnswerReport']['describe']()[_0x6a78('0x22')](respondWithResult(_0x5a4d6e,null))[_0x6a78('0x44')](handleError(_0x5a4d6e,null));}; \ No newline at end of file +var _0x63b6=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','JscriptyAnswerReport','findAll','rows','catch','show','params','rawAttributes','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x4d98cc,_0x92dc34){var _0xf66eb5=function(_0x4f4643){while(--_0x4f4643){_0x4d98cc['push'](_0x4d98cc['shift']());}};_0xf66eb5(++_0x92dc34);}(_0x63b6,0x127));var _0x663b=function(_0x4d3814,_0x5eb446){_0x4d3814=_0x4d3814-0x0;var _0x3b71d5=_0x63b6[_0x4d3814];return _0x3b71d5;};'use strict';var emlformat=require(_0x663b('0x0'));var rimraf=require(_0x663b('0x1'));var zipdir=require(_0x663b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663b('0x3'));var moment=require('moment');var BPromise=require(_0x663b('0x4'));var Mustache=require('mustache');var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require(_0x663b('0x7'));var csv=require('to-csv');var ejs=require(_0x663b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663b('0x9'));var squel=require('squel');var crypto=require(_0x663b('0xa'));var jsforce=require(_0x663b('0xb'));var deskjs=require(_0x663b('0xc'));var toCsv=require(_0x663b('0xd'));var querystring=require(_0x663b('0xe'));var Papa=require(_0x663b('0xf'));var Redis=require('ioredis');var authService=require(_0x663b('0x10'));var qs=require(_0x663b('0x11'));var as=require(_0x663b('0x12'));var hardwareService=require(_0x663b('0x13'));var logger=require(_0x663b('0x14'))(_0x663b('0x15'));var utils=require(_0x663b('0x16'));var config=require(_0x663b('0x17'));var licenseUtil=require(_0x663b('0x18'));var db=require(_0x663b('0x19'))['db'];function respondWithStatusCode(_0x4fa8a3,_0x544643){_0x544643=_0x544643||0xcc;return function(_0x1ef28c){if(_0x1ef28c){return _0x4fa8a3[_0x663b('0x1a')](_0x544643);}return _0x4fa8a3[_0x663b('0x1b')](_0x544643)[_0x663b('0x1c')]();};}function respondWithResult(_0x43449a,_0x13cb09){_0x13cb09=_0x13cb09||0xc8;return function(_0x4e263a){if(_0x4e263a){return _0x43449a[_0x663b('0x1b')](_0x13cb09)[_0x663b('0x1d')](_0x4e263a);}};}function respondWithFilteredResult(_0x4738e2,_0x1f8238){return function(_0x343eac){if(_0x343eac){var _0x46db68=typeof _0x1f8238[_0x663b('0x1e')]===_0x663b('0x1f')&&typeof _0x1f8238[_0x663b('0x20')]===_0x663b('0x1f');var _0x26a596=_0x343eac[_0x663b('0x21')];var _0x14be5c=_0x46db68?0x0:_0x1f8238[_0x663b('0x1e')];var _0x4c8a8a=_0x46db68?_0x343eac[_0x663b('0x21')]:_0x1f8238[_0x663b('0x1e')]+_0x1f8238['limit'];var _0x79a64c;if(_0x4c8a8a>=_0x26a596){_0x4c8a8a=_0x26a596;_0x79a64c=0xc8;}else{_0x79a64c=0xce;}_0x4738e2[_0x663b('0x1b')](_0x79a64c);return _0x4738e2['set']('Content-Range',_0x14be5c+'-'+_0x4c8a8a+'/'+_0x26a596)[_0x663b('0x1d')](_0x343eac);}return null;};}function patchUpdates(_0x12a5b7){return function(_0x33a6b9){try{jsonpatch[_0x663b('0x22')](_0x33a6b9,_0x12a5b7,!![]);}catch(_0x50ecbb){return BPromise[_0x663b('0x23')](_0x50ecbb);}return _0x33a6b9[_0x663b('0x24')]();};}function saveUpdates(_0x4b81c1,_0x58b3ce){return function(_0x521a89){if(_0x521a89){return _0x521a89['update'](_0x4b81c1)[_0x663b('0x25')](function(_0x37236e){return _0x37236e;});}return null;};}function removeEntity(_0x2d1b52,_0xf08506){return function(_0x25c295){if(_0x25c295){return _0x25c295[_0x663b('0x26')]()[_0x663b('0x25')](function(){_0x2d1b52[_0x663b('0x1b')](0xcc)[_0x663b('0x1c')]();});}};}function handleEntityNotFound(_0x5063b2,_0x20edcc){return function(_0x158c09){if(!_0x158c09){_0x5063b2['sendStatus'](0x194);}return _0x158c09;};}function handleError(_0x37a5f4,_0x54bb0d){_0x54bb0d=_0x54bb0d||0x1f4;return function(_0x1e4e97){logger[_0x663b('0x27')](_0x1e4e97[_0x663b('0x28')]);if(_0x1e4e97['name']){delete _0x1e4e97[_0x663b('0x29')];}_0x37a5f4[_0x663b('0x1b')](_0x54bb0d)[_0x663b('0x2a')](_0x1e4e97);};}exports[_0x663b('0x2b')]=function(_0x5a1580,_0x4ef875){var _0x4e7486={},_0x110c6c={},_0x2b4b1f={'count':0x0,'rows':[]};var _0x5ef7ae=_[_0x663b('0x2c')](db['JscriptyAnswerReport']['rawAttributes'],function(_0xe7689c){return{'name':_0xe7689c[_0x663b('0x2d')],'type':_0xe7689c[_0x663b('0x2e')]['key']};});_0x110c6c['model']=_[_0x663b('0x2c')](_0x5ef7ae,_0x663b('0x29'));_0x110c6c[_0x663b('0x2f')]=_[_0x663b('0x30')](_0x5a1580[_0x663b('0x2f')]);_0x110c6c[_0x663b('0x31')]=_[_0x663b('0x32')](_0x110c6c[_0x663b('0x33')],_0x110c6c[_0x663b('0x2f')]);_0x4e7486[_0x663b('0x34')]=_[_0x663b('0x32')](_0x110c6c[_0x663b('0x33')],qs[_0x663b('0x35')](_0x5a1580[_0x663b('0x2f')]['fields']));_0x4e7486['attributes']=_0x4e7486[_0x663b('0x34')][_0x663b('0x36')]?_0x4e7486[_0x663b('0x34')]:_0x110c6c['model'];if(!_0x5a1580['query']['hasOwnProperty']('nolimit')){_0x4e7486['limit']=qs[_0x663b('0x20')](_0x5a1580[_0x663b('0x2f')][_0x663b('0x20')]);_0x4e7486[_0x663b('0x1e')]=qs[_0x663b('0x1e')](_0x5a1580[_0x663b('0x2f')]['offset']);}_0x4e7486[_0x663b('0x37')]=qs[_0x663b('0x38')](_0x5a1580['query']['sort']);_0x4e7486[_0x663b('0x39')]=qs[_0x663b('0x31')](_[_0x663b('0x3a')](_0x5a1580['query'],_0x110c6c['filters']),_0x5ef7ae);if(_0x5a1580[_0x663b('0x2f')][_0x663b('0x3b')]){_0x4e7486['where']=_[_0x663b('0x3c')](_0x4e7486[_0x663b('0x39')],{'$or':_[_0x663b('0x2c')](_0x5ef7ae,function(_0x47f73d){if(_0x47f73d[_0x663b('0x2e')]!==_0x663b('0x3d')){var _0x5bf75e={};_0x5bf75e[_0x47f73d[_0x663b('0x29')]]={'$like':'%'+_0x5a1580[_0x663b('0x2f')][_0x663b('0x3b')]+'%'};return _0x5bf75e;}})});}_0x4e7486=_['merge']({},_0x4e7486,_0x5a1580[_0x663b('0x3e')]);var _0x3a3976={'where':_0x4e7486[_0x663b('0x39')]};return db['JscriptyAnswerReport'][_0x663b('0x21')](_0x3a3976)[_0x663b('0x25')](function(_0x552f70){_0x2b4b1f[_0x663b('0x21')]=_0x552f70;if(_0x5a1580['query'][_0x663b('0x3f')]){_0x4e7486[_0x663b('0x40')]=[{'all':!![]}];}return db[_0x663b('0x41')][_0x663b('0x42')](_0x4e7486);})['then'](function(_0x432166){_0x2b4b1f[_0x663b('0x43')]=_0x432166;return _0x2b4b1f;})['then'](respondWithFilteredResult(_0x4ef875,_0x4e7486))[_0x663b('0x44')](handleError(_0x4ef875,null));};exports[_0x663b('0x45')]=function(_0xc703c1,_0x30bb10){var _0x4491a3={'raw':!![],'where':{'id':_0xc703c1[_0x663b('0x46')]['id']}},_0x5e4b04={};_0x5e4b04[_0x663b('0x33')]=_[_0x663b('0x30')](db[_0x663b('0x41')][_0x663b('0x47')]);_0x5e4b04[_0x663b('0x2f')]=_['keys'](_0xc703c1[_0x663b('0x2f')]);_0x5e4b04[_0x663b('0x31')]=_[_0x663b('0x32')](_0x5e4b04[_0x663b('0x33')],_0x5e4b04[_0x663b('0x2f')]);_0x4491a3[_0x663b('0x34')]=_[_0x663b('0x32')](_0x5e4b04[_0x663b('0x33')],qs[_0x663b('0x35')](_0xc703c1[_0x663b('0x2f')][_0x663b('0x35')]));_0x4491a3['attributes']=_0x4491a3[_0x663b('0x34')][_0x663b('0x36')]?_0x4491a3[_0x663b('0x34')]:_0x5e4b04[_0x663b('0x33')];if(_0xc703c1[_0x663b('0x2f')][_0x663b('0x3f')]){_0x4491a3[_0x663b('0x40')]=[{'all':!![]}];}_0x4491a3=_[_0x663b('0x3c')]({},_0x4491a3,_0xc703c1[_0x663b('0x3e')]);return db[_0x663b('0x41')]['find'](_0x4491a3)[_0x663b('0x25')](handleEntityNotFound(_0x30bb10,null))[_0x663b('0x25')](respondWithResult(_0x30bb10,null))['catch'](handleError(_0x30bb10,null));};exports[_0x663b('0x48')]=function(_0x2a9847,_0x10ae27){return db['JscriptyAnswerReport']['create'](_0x2a9847['body'],{})[_0x663b('0x25')](respondWithResult(_0x10ae27,0xc9))['catch'](handleError(_0x10ae27,null));};exports[_0x663b('0x49')]=function(_0x31e831,_0x4a05ef){if(_0x31e831[_0x663b('0x4a')]['id']){delete _0x31e831[_0x663b('0x4a')]['id'];}return db[_0x663b('0x41')][_0x663b('0x4b')]({'where':{'id':_0x31e831[_0x663b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a05ef,null))[_0x663b('0x25')](saveUpdates(_0x31e831[_0x663b('0x4a')],null))['then'](respondWithResult(_0x4a05ef,null))['catch'](handleError(_0x4a05ef,null));};exports[_0x663b('0x26')]=function(_0xa17d04,_0x23b5b6){return db[_0x663b('0x41')][_0x663b('0x4b')]({'where':{'id':_0xa17d04[_0x663b('0x46')]['id']}})['then'](handleEntityNotFound(_0x23b5b6,null))[_0x663b('0x25')](removeEntity(_0x23b5b6,null))[_0x663b('0x44')](handleError(_0x23b5b6,null));};exports[_0x663b('0x4c')]=function(_0x92844a,_0x1806fc){return db[_0x663b('0x41')][_0x663b('0x4c')]()[_0x663b('0x25')](respondWithResult(_0x1806fc,null))[_0x663b('0x44')](handleError(_0x1806fc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 689b450..362ca37 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 _0x888d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x4369a8,_0x25ba80){var _0x434b45=function(_0x1db786){while(--_0x1db786){_0x4369a8['push'](_0x4369a8['shift']());}};_0x434b45(++_0x25ba80);}(_0x888d,0x12a));var _0xd888=function(_0x504956,_0x365621){_0x504956=_0x504956-0x0;var _0x3750ea=_0x888d[_0x504956];return _0x3750ea;};'use strict';var _=require(_0xd888('0x0'));var util=require(_0xd888('0x1'));var logger=require(_0xd888('0x2'))(_0xd888('0x3'));var moment=require(_0xd888('0x4'));var BPromise=require(_0xd888('0x5'));var rp=require(_0xd888('0x6'));var fs=require('fs');var path=require(_0xd888('0x7'));var rimraf=require(_0xd888('0x8'));var config=require(_0xd888('0x9'));var attributes=require(_0xd888('0xa'));module[_0xd888('0xb')]=function(_0x2ea876,_0x1de87f){return _0x2ea876[_0xd888('0xc')](_0xd888('0xd'),attributes,{'tableName':_0xd888('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d77=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x1bef07,_0x526da5){var _0x132404=function(_0xbd0d98){while(--_0xbd0d98){_0x1bef07['push'](_0x1bef07['shift']());}};_0x132404(++_0x526da5);}(_0x1d77,0x1bc));var _0x71d7=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x1d77[_0x364a36];return _0x5cd6fa;};'use strict';var _=require(_0x71d7('0x0'));var util=require(_0x71d7('0x1'));var logger=require(_0x71d7('0x2'))(_0x71d7('0x3'));var moment=require('moment');var BPromise=require(_0x71d7('0x4'));var rp=require(_0x71d7('0x5'));var fs=require('fs');var path=require(_0x71d7('0x6'));var rimraf=require(_0x71d7('0x7'));var config=require(_0x71d7('0x8'));var attributes=require(_0x71d7('0x9'));module[_0x71d7('0xa')]=function(_0x16a13b,_0x5a0f94){return _0x16a13b['define'](_0x71d7('0xb'),attributes,{'tableName':_0x71d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 34fa169..8e36354 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 _0x7ffe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x7ffe,0x96));var _0xe7ff=function(_0x4d8368,_0xb86126){_0x4d8368=_0x4d8368-0x0;var _0xbf0a1c=_0x7ffe[_0x4d8368];return _0xbf0a1c;};'use strict';var _=require(_0xe7ff('0x0'));var util=require(_0xe7ff('0x1'));var moment=require(_0xe7ff('0x2'));var BPromise=require(_0xe7ff('0x3'));var rs=require(_0xe7ff('0x4'));var fs=require('fs');var Redis=require(_0xe7ff('0x5'));var db=require(_0xe7ff('0x6'))['db'];var utils=require(_0xe7ff('0x7'));var logger=require(_0xe7ff('0x8'))(_0xe7ff('0x9'));var config=require(_0xe7ff('0xa'));var jayson=require(_0xe7ff('0xb'));var client=jayson[_0xe7ff('0xc')][_0xe7ff('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3679b7,_0x3b0827,_0x50ffa3){return new BPromise(function(_0x553d19,_0x5c1bea){return client[_0xe7ff('0xe')](_0x3679b7,_0x50ffa3)[_0xe7ff('0xf')](function(_0x53182b){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3b0827,'request\x20sent');logger['debug'](_0xe7ff('0x10'),_0x3b0827,_0xe7ff('0x11'),JSON[_0xe7ff('0x12')](_0x53182b));if(_0x53182b[_0xe7ff('0x13')]){if(_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x14')]===0x1f4){logger[_0xe7ff('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3b0827,_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x15')]);return _0x5c1bea(_0x53182b[_0xe7ff('0x13')][_0xe7ff('0x15')]);}logger[_0xe7ff('0x13')](_0xe7ff('0x16'),_0x3b0827,_0x53182b['error'][_0xe7ff('0x15')]);return _0x553d19(_0x53182b['error']['message']);}else{logger[_0xe7ff('0x17')](_0xe7ff('0x16'),_0x3b0827,_0xe7ff('0x11'));_0x553d19(_0x53182b[_0xe7ff('0x18')][_0xe7ff('0x15')]);}})[_0xe7ff('0x19')](function(_0x4e8ef3){logger[_0xe7ff('0x13')](_0xe7ff('0x16'),_0x3b0827,_0x4e8ef3);_0x5c1bea(_0x4e8ef3);});});} \ No newline at end of file +var _0x2e46=['moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3eb267,_0x64e1f5){var _0x29adf5=function(_0x57e6b4){while(--_0x57e6b4){_0x3eb267['push'](_0x3eb267['shift']());}};_0x29adf5(++_0x64e1f5);}(_0x2e46,0x106));var _0x62e4=function(_0x5ac0b3,_0x3e20fb){_0x5ac0b3=_0x5ac0b3-0x0;var _0x4cb82e=_0x2e46[_0x5ac0b3];return _0x4cb82e;};'use strict';var _=require(_0x62e4('0x0'));var util=require(_0x62e4('0x1'));var moment=require(_0x62e4('0x2'));var BPromise=require(_0x62e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x62e4('0x5'));var logger=require(_0x62e4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x62e4('0x7'));var client=jayson[_0x62e4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266f03,_0x27a837,_0x47dc15){return new BPromise(function(_0xedbc0,_0x2828eb){return client[_0x62e4('0x9')](_0x266f03,_0x47dc15)[_0x62e4('0xa')](function(_0x59f983){logger[_0x62e4('0xb')](_0x62e4('0xc'),_0x27a837,_0x62e4('0xd'));logger[_0x62e4('0xe')](_0x62e4('0xf'),_0x27a837,_0x62e4('0xd'),JSON[_0x62e4('0x10')](_0x59f983));if(_0x59f983[_0x62e4('0x11')]){if(_0x59f983[_0x62e4('0x11')][_0x62e4('0x12')]===0x1f4){logger[_0x62e4('0x11')](_0x62e4('0xc'),_0x27a837,_0x59f983[_0x62e4('0x11')][_0x62e4('0x13')]);return _0x2828eb(_0x59f983[_0x62e4('0x11')][_0x62e4('0x13')]);}logger[_0x62e4('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x27a837,_0x59f983[_0x62e4('0x11')]['message']);return _0xedbc0(_0x59f983[_0x62e4('0x11')][_0x62e4('0x13')]);}else{logger[_0x62e4('0xb')](_0x62e4('0xc'),_0x27a837,_0x62e4('0xd'));_0xedbc0(_0x59f983[_0x62e4('0x14')][_0x62e4('0x13')]);}})[_0x62e4('0x15')](function(_0x1cfc42){logger[_0x62e4('0x11')](_0x62e4('0xc'),_0x27a837,_0x1cfc42);_0x2828eb(_0x1cfc42);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f4ed98c..77a6226 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 _0x2464=['getSummary','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sessions','getAnswers','/:id/summary','30s'];(function(_0x545b89,_0x1e44d5){var _0x95928d=function(_0xf398af){while(--_0xf398af){_0x545b89['push'](_0x545b89['shift']());}};_0x95928d(++_0x1e44d5);}(_0x2464,0x76));var _0x4246=function(_0x135b33,_0x2b0d32){_0x135b33=_0x135b33-0x0;var _0x4cccca=_0x2464[_0x135b33];return _0x4cccca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4246('0x0'));var timeout=require('connect-timeout');var express=require(_0x4246('0x1'));var router=express[_0x4246('0x2')]();var fs_extra=require(_0x4246('0x3'));var auth=require(_0x4246('0x4'));var interaction=require(_0x4246('0x5'));var config=require(_0x4246('0x6'));var controller=require('./jscriptyProject.controller');router[_0x4246('0x7')]('/',auth[_0x4246('0x8')](),controller['index']);router[_0x4246('0x7')](_0x4246('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4246('0xa'),auth[_0x4246('0x8')](),controller['getSessions']);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x4246('0xb')]);router['get'](_0x4246('0xc'),auth[_0x4246('0x8')](),timeout(_0x4246('0xd')),controller[_0x4246('0xe')]);router[_0x4246('0xf')]('/',auth['isAuthenticated'](),controller[_0x4246('0x10')]);router[_0x4246('0xf')]('/:id/clone',auth[_0x4246('0x8')](),controller['clone']);router[_0x4246('0x11')]('/:id',auth[_0x4246('0x8')](),controller[_0x4246('0x12')]);router[_0x4246('0x13')](_0x4246('0x9'),auth[_0x4246('0x8')](),controller[_0x4246('0x14')]);module[_0x4246('0x15')]=router; \ No newline at end of file +var _0xb43d=['getSessions','/:id/answers','/:id/summary','30s','create','post','/:id/clone','clone','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','/:id/sessions'];(function(_0x4f45c0,_0xce273){var _0x584a1b=function(_0x421ad0){while(--_0x421ad0){_0x4f45c0['push'](_0x4f45c0['shift']());}};_0x584a1b(++_0xce273);}(_0xb43d,0xc2));var _0xdb43=function(_0x2e3756,_0x32670f){_0x2e3756=_0x2e3756-0x0;var _0x442861=_0xb43d[_0x2e3756];return _0x442861;};'use strict';var multer=require(_0xdb43('0x0'));var util=require(_0xdb43('0x1'));var path=require(_0xdb43('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb43('0x3'));var router=express['Router']();var fs_extra=require(_0xdb43('0x4'));var auth=require(_0xdb43('0x5'));var interaction=require(_0xdb43('0x6'));var config=require(_0xdb43('0x7'));var controller=require(_0xdb43('0x8'));router['get']('/',auth[_0xdb43('0x9')](),controller[_0xdb43('0xa')]);router[_0xdb43('0xb')](_0xdb43('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdb43('0xb')](_0xdb43('0xd'),auth[_0xdb43('0x9')](),controller[_0xdb43('0xe')]);router[_0xdb43('0xb')](_0xdb43('0xf'),auth[_0xdb43('0x9')](),controller['getAnswers']);router[_0xdb43('0xb')](_0xdb43('0x10'),auth['isAuthenticated'](),timeout(_0xdb43('0x11')),controller['getSummary']);router['post']('/',auth[_0xdb43('0x9')](),controller[_0xdb43('0x12')]);router[_0xdb43('0x13')](_0xdb43('0x14'),auth['isAuthenticated'](),controller[_0xdb43('0x15')]);router[_0xdb43('0x16')](_0xdb43('0xc'),auth[_0xdb43('0x9')](),controller[_0xdb43('0x17')]);router[_0xdb43('0x18')]('/:id',auth[_0xdb43('0x9')](),controller['destroy']);module[_0xdb43('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 47c9d35..cb3bb3c 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 _0x5a0e=['formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x39b9dc,_0x4e8ebb){var _0x316cd4=function(_0x455a06){while(--_0x455a06){_0x39b9dc['push'](_0x39b9dc['shift']());}};_0x316cd4(++_0x4e8ebb);}(_0x5a0e,0x9c));var _0xe5a0=function(_0x261b1f,_0x594b1f){_0x261b1f=_0x261b1f-0x0;var _0x56529a=_0x5a0e[_0x261b1f];return _0x56529a;};'use strict';var Sequelize=require(_0xe5a0('0x0'));var _=require(_0xe5a0('0x1'));var util=require('util');module[_0xe5a0('0x2')]={'name':{'type':Sequelize[_0xe5a0('0x3')],'unique':_0xe5a0('0x4')},'description':{'type':Sequelize[_0xe5a0('0x3')]},'formData':{'type':Sequelize[_0xe5a0('0x5')](_0xe5a0('0x6')),'set':function(_0x325557){if(_[_0xe5a0('0x7')](_0x325557)){this[_0xe5a0('0x8')](_0xe5a0('0x9'),JSON[_0xe5a0('0xa')](_0x325557));}else if(_['isString'](_0x325557)){this['setDataValue']('formData',_0x325557);}else{this[_0xe5a0('0x8')](_0xe5a0('0x9'),util[_0xe5a0('0xb')](_0xe5a0('0xc'),this['getDataValue'](_0xe5a0('0x4'))||'',this['getDataValue'](_0xe5a0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe5a0('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x787b=['setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','long'];(function(_0x1962b4,_0x5e21c5){var _0x5c2f0c=function(_0x193dae){while(--_0x193dae){_0x1962b4['push'](_0x1962b4['shift']());}};_0x5c2f0c(++_0x5e21c5);}(_0x787b,0x1e9));var _0xb787=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x787b[_0x427d3a];return _0xe5c521;};'use strict';var Sequelize=require(_0xb787('0x0'));var _=require(_0xb787('0x1'));var util=require(_0xb787('0x2'));module[_0xb787('0x3')]={'name':{'type':Sequelize[_0xb787('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb787('0x5')),'set':function(_0x29b325){if(_['isObjectLike'](_0x29b325)){this[_0xb787('0x6')](_0xb787('0x7'),JSON[_0xb787('0x8')](_0x29b325));}else if(_['isString'](_0x29b325)){this[_0xb787('0x6')](_0xb787('0x7'),_0x29b325);}else{this[_0xb787('0x6')]('formData',util[_0xb787('0x9')](_0xb787('0xa'),this[_0xb787('0xb')](_0xb787('0xc'))||'',this[_0xb787('0xb')](_0xb787('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb787('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb787('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9cee8e1..265b472 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 _0x17a7=['apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','nolimit','sort','filter','where','merge','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','createdAt','UserProfileSection','error','getSessions','findOne','JscriptySessionReport','hasOwnProperty','order','pick','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','answer','push','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','count','json'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x17a7,0xc2));var _0x717a=function(_0x1a708c,_0x3de647){_0x1a708c=_0x1a708c-0x0;var _0x2b6c76=_0x17a7[_0x1a708c];return _0x2b6c76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x717a('0x0'));var rp=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require(_0x717a('0x3'));var Mustache=require('mustache');var util=require(_0x717a('0x4'));var path=require('path');var sox=require(_0x717a('0x5'));var csv=require(_0x717a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x717a('0x7'));var _=require(_0x717a('0x8'));var squel=require(_0x717a('0x9'));var crypto=require(_0x717a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x717a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x717a('0xc'));var Papa=require('papaparse');var Redis=require(_0x717a('0xd'));var authService=require(_0x717a('0xe'));var qs=require(_0x717a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x10'))(_0x717a('0x11'));var utils=require(_0x717a('0x12'));var config=require(_0x717a('0x13'));var licenseUtil=require(_0x717a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45eb68,_0x588baf){_0x588baf=_0x588baf||0xcc;return function(_0x2e2e95){if(_0x2e2e95){return _0x45eb68['sendStatus'](_0x588baf);}return _0x45eb68['status'](_0x588baf)['end']();};}function respondWithResult(_0x4a11bb,_0x295862){_0x295862=_0x295862||0xc8;return function(_0x546495){if(_0x546495){return _0x4a11bb[_0x717a('0x15')](_0x295862)['json'](_0x546495);}};}function respondWithFilteredResult(_0x1eca09,_0x58e33a){return function(_0xb85066){if(_0xb85066){var _0x6ae1be=typeof _0x58e33a[_0x717a('0x16')]==='undefined'&&typeof _0x58e33a[_0x717a('0x17')]==='undefined';var _0x130cb2=_0xb85066[_0x717a('0x18')];var _0x152e10=_0x6ae1be?0x0:_0x58e33a[_0x717a('0x16')];var _0x45dc38=_0x6ae1be?_0xb85066[_0x717a('0x18')]:_0x58e33a[_0x717a('0x16')]+_0x58e33a[_0x717a('0x17')];var _0x1e798f;if(_0x45dc38>=_0x130cb2){_0x45dc38=_0x130cb2;_0x1e798f=0xc8;}else{_0x1e798f=0xce;}_0x1eca09[_0x717a('0x15')](_0x1e798f);return _0x1eca09['set']('Content-Range',_0x152e10+'-'+_0x45dc38+'/'+_0x130cb2)[_0x717a('0x19')](_0xb85066);}return null;};}function patchUpdates(_0x1d7ebd){return function(_0x3ac808){try{jsonpatch[_0x717a('0x1a')](_0x3ac808,_0x1d7ebd,!![]);}catch(_0x2ef0e9){return BPromise[_0x717a('0x1b')](_0x2ef0e9);}return _0x3ac808[_0x717a('0x1c')]();};}function saveUpdates(_0x50847f,_0x4e95dc){return function(_0x3fc2be){if(_0x3fc2be){return _0x3fc2be[_0x717a('0x1d')](_0x50847f)[_0x717a('0x1e')](function(_0x33947c){return _0x33947c;});}return null;};}function removeEntity(_0x29a64c,_0x594e9c){return function(_0x345d54){if(_0x345d54){return _0x345d54[_0x717a('0x1f')]()[_0x717a('0x1e')](function(){var _0x5e578e=_0x345d54[_0x717a('0x20')]({'plain':!![]});var _0x36a145='Projects';return db[_0x717a('0x21')][_0x717a('0x1f')]({'where':{'type':_0x36a145,'resourceId':_0x5e578e['id']}})[_0x717a('0x1e')](function(){return _0x345d54;});})[_0x717a('0x1e')](function(){_0x29a64c[_0x717a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1654dd,_0x25bc5e){return function(_0x2d628c){if(!_0x2d628c){_0x1654dd[_0x717a('0x22')](0x194);}return _0x2d628c;};}function handleError(_0x315d64,_0x42ac79){_0x42ac79=_0x42ac79||0x1f4;return function(_0x40f3ac){logger['error'](_0x40f3ac[_0x717a('0x23')]);if(_0x40f3ac[_0x717a('0x24')]){delete _0x40f3ac[_0x717a('0x24')];}_0x315d64['status'](_0x42ac79)['send'](_0x40f3ac);};}exports[_0x717a('0x25')]=function(_0x45847a,_0x97d7a1){var _0x5007e3={},_0x2719ab={},_0x24f51d={'count':0x0,'rows':[]};var _0x4c63d8=_[_0x717a('0x26')](db['JscriptyProject'][_0x717a('0x27')],function(_0x13481e){return{'name':_0x13481e[_0x717a('0x28')],'type':_0x13481e[_0x717a('0x29')]['key']};});_0x2719ab['model']=_['map'](_0x4c63d8,_0x717a('0x24'));_0x2719ab['query']=_[_0x717a('0x2a')](_0x45847a[_0x717a('0x2b')]);_0x2719ab[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x2719ab['model'],_0x2719ab['query']);_0x5007e3[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x2719ab['model'],qs[_0x717a('0x2f')](_0x45847a[_0x717a('0x2b')][_0x717a('0x2f')]));_0x5007e3[_0x717a('0x2e')]=_0x5007e3['attributes'][_0x717a('0x30')]?_0x5007e3[_0x717a('0x2e')]:_0x2719ab[_0x717a('0x31')];if(!_0x45847a[_0x717a('0x2b')]['hasOwnProperty'](_0x717a('0x32'))){_0x5007e3['limit']=qs['limit'](_0x45847a['query']['limit']);_0x5007e3[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x45847a['query']['offset']);}_0x5007e3['order']=qs[_0x717a('0x33')](_0x45847a[_0x717a('0x2b')][_0x717a('0x33')]);_0x5007e3['where']=qs[_0x717a('0x2c')](_['pick'](_0x45847a['query'],_0x2719ab[_0x717a('0x2c')]),_0x4c63d8);if(_0x45847a[_0x717a('0x2b')][_0x717a('0x34')]){_0x5007e3[_0x717a('0x35')]=_[_0x717a('0x36')](_0x5007e3[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x4c63d8,function(_0x2b545b){if(_0x2b545b[_0x717a('0x29')]!=='VIRTUAL'){var _0x7dfb98={};_0x7dfb98[_0x2b545b[_0x717a('0x24')]]={'$like':'%'+_0x45847a[_0x717a('0x2b')][_0x717a('0x34')]+'%'};return _0x7dfb98;}})});}_0x5007e3=_['merge']({},_0x5007e3,_0x45847a['options']);var _0x154f74={'where':_0x5007e3[_0x717a('0x35')]};return db[_0x717a('0x37')][_0x717a('0x18')](_0x154f74)[_0x717a('0x1e')](function(_0x52b944){_0x24f51d[_0x717a('0x18')]=_0x52b944;if(_0x45847a['query'][_0x717a('0x38')]){_0x5007e3[_0x717a('0x39')]=[{'all':!![]}];}return db['JscriptyProject'][_0x717a('0x3a')](_0x5007e3);})[_0x717a('0x1e')](function(_0x684c41){_0x24f51d[_0x717a('0x3b')]=_0x684c41;return _0x24f51d;})[_0x717a('0x1e')](respondWithFilteredResult(_0x97d7a1,_0x5007e3))[_0x717a('0x3c')](handleError(_0x97d7a1,null));};exports[_0x717a('0x3d')]=function(_0x3970c7,_0x437107){var _0x5c430f={'raw':![],'where':{'id':_0x3970c7[_0x717a('0x3e')]['id']}},_0x44cf53={};_0x44cf53[_0x717a('0x31')]=_['keys'](db['JscriptyProject'][_0x717a('0x27')]);_0x44cf53[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x3970c7[_0x717a('0x2b')]);_0x44cf53[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x44cf53[_0x717a('0x31')],_0x44cf53[_0x717a('0x2b')]);_0x5c430f[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x44cf53[_0x717a('0x31')],qs[_0x717a('0x2f')](_0x3970c7[_0x717a('0x2b')][_0x717a('0x2f')]));_0x5c430f[_0x717a('0x2e')]=_0x5c430f['attributes'][_0x717a('0x30')]?_0x5c430f['attributes']:_0x44cf53[_0x717a('0x31')];if(_0x3970c7['query'][_0x717a('0x38')]){_0x5c430f[_0x717a('0x39')]=[{'all':!![]}];}_0x5c430f=_[_0x717a('0x36')]({},_0x5c430f,_0x3970c7[_0x717a('0x3f')]);return db[_0x717a('0x37')][_0x717a('0x40')](_0x5c430f)[_0x717a('0x1e')](handleEntityNotFound(_0x437107,null))[_0x717a('0x1e')](respondWithResult(_0x437107,null))[_0x717a('0x3c')](handleError(_0x437107,null));};exports[_0x717a('0x41')]=function(_0x3914f4,_0x20c865){return db[_0x717a('0x37')][_0x717a('0x41')](_0x3914f4['body'],{})[_0x717a('0x1e')](function(_0x4cb6f2){var _0x425142=_0x3914f4[_0x717a('0x42')][_0x717a('0x20')]({'plain':!![]});if(!_0x425142)throw new Error(_0x717a('0x43'));if(_0x425142[_0x717a('0x44')]===_0x717a('0x42')){var _0x2e07eb=_0x4cb6f2[_0x717a('0x20')]({'plain':!![]});var _0x2c8751=_0x717a('0x45');return db['UserProfileSection'][_0x717a('0x40')]({'where':{'name':_0x2c8751,'userProfileId':_0x425142[_0x717a('0x46')]},'raw':!![]})[_0x717a('0x1e')](function(_0x4ba556){if(_0x4ba556&&_0x4ba556['autoAssociation']===0x0){return db[_0x717a('0x21')][_0x717a('0x41')]({'name':_0x2e07eb[_0x717a('0x24')],'resourceId':_0x2e07eb['id'],'type':_0x4ba556[_0x717a('0x24')],'sectionId':_0x4ba556['id']},{})['then'](function(){return _0x4cb6f2;});}else{return _0x4cb6f2;}})[_0x717a('0x3c')](function(_0x43a320){logger['error'](_0x717a('0x47'),_0x43a320);throw _0x43a320;});}return _0x4cb6f2;})[_0x717a('0x1e')](respondWithResult(_0x20c865,0xc9))[_0x717a('0x3c')](handleError(_0x20c865,null));};exports[_0x717a('0x48')]=function(_0xa1ab6d,_0x3d4663){var _0x430084={'where':{'id':_0xa1ab6d['params']['id']}},_0x498077={};_0x498077[_0x717a('0x31')]=_[_0x717a('0x2a')](db[_0x717a('0x37')]['rawAttributes']);_0x430084['attributes']=_[_0x717a('0x2d')](_0x498077[_0x717a('0x31')],qs[_0x717a('0x2f')](_0xa1ab6d[_0x717a('0x2b')][_0x717a('0x2f')]));_0x430084[_0x717a('0x2e')]=_0x430084[_0x717a('0x2e')][_0x717a('0x30')]?_0x430084[_0x717a('0x2e')]:_0x498077[_0x717a('0x31')];if(_0xa1ab6d[_0x717a('0x2b')][_0x717a('0x38')]){_0x430084[_0x717a('0x39')]=[{'all':!![]}];}_0x430084=_['merge']({},_0x430084,_0xa1ab6d[_0x717a('0x3f')]);return db['JscriptyProject']['find'](_0x430084)[_0x717a('0x1e')](handleEntityNotFound(_0x3d4663,null))[_0x717a('0x1e')](function(_0x5f0884){if(_0x5f0884){var _0x5887d1=_0x5f0884[_0x717a('0x20')]({'plain':!![]});_0x5887d1=qs['omit'](_0x5887d1,['id','createdAt',_0x717a('0x49')]);_0xa1ab6d['body']=_['omit'](_0xa1ab6d[_0x717a('0x4a')],['id',_0x717a('0x4b'),_0x717a('0x49')]);return db['JscriptyProject'][_0x717a('0x41')](_['merge'](_0x5887d1,_0xa1ab6d[_0x717a('0x4a')]),{'include':_0xa1ab6d[_0x717a('0x2b')]['includeAll']?[{'all':!![]}]:undefined})[_0x717a('0x1e')](function(_0x3501e6){var _0x2d85a2=_0xa1ab6d[_0x717a('0x42')]['get']({'plain':!![]});if(!_0x2d85a2)throw new Error(_0x717a('0x43'));if(_0x2d85a2[_0x717a('0x44')]==='user'){var _0xdd262e=_0x3501e6[_0x717a('0x20')]({'plain':!![]});var _0x7943e5=_0x717a('0x45');return db[_0x717a('0x4c')][_0x717a('0x40')]({'where':{'name':_0x7943e5,'userProfileId':_0x2d85a2[_0x717a('0x46')]},'raw':!![]})[_0x717a('0x1e')](function(_0x39a0c5){if(_0x39a0c5&&_0x39a0c5['autoAssociation']===0x0){return db[_0x717a('0x21')][_0x717a('0x41')]({'name':_0xdd262e[_0x717a('0x24')],'resourceId':_0xdd262e['id'],'type':_0x39a0c5[_0x717a('0x24')],'sectionId':_0x39a0c5['id']},{})[_0x717a('0x1e')](function(){return _0x3501e6;});}else{return _0x3501e6;}})['catch'](function(_0x4e5941){logger[_0x717a('0x4d')](_0x717a('0x47'),_0x4e5941);throw _0x4e5941;});}return _0x3501e6;});}})[_0x717a('0x1e')](respondWithResult(_0x3d4663,0xc9))[_0x717a('0x3c')](handleError(_0x3d4663,null));};exports[_0x717a('0x1d')]=function(_0x58d6b8,_0x4688db){if(_0x58d6b8[_0x717a('0x4a')]['id']){delete _0x58d6b8[_0x717a('0x4a')]['id'];}return db[_0x717a('0x37')][_0x717a('0x40')]({'where':{'id':_0x58d6b8['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x4688db,null))[_0x717a('0x1e')](saveUpdates(_0x58d6b8[_0x717a('0x4a')],null))[_0x717a('0x1e')](respondWithResult(_0x4688db,null))[_0x717a('0x3c')](handleError(_0x4688db,null));};exports[_0x717a('0x1f')]=function(_0x395bcc,_0x3e156e){return db['JscriptyProject'][_0x717a('0x40')]({'where':{'id':_0x395bcc['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x3e156e,null))[_0x717a('0x1e')](removeEntity(_0x3e156e,null))[_0x717a('0x3c')](handleError(_0x3e156e,null));};exports[_0x717a('0x4e')]=function(_0x2ab0b3,_0x395f27,_0x1be55c){var _0x420afa={'raw':!![],'where':{}};var _0x5ad8d6={};var _0x77887c={'count':0x0,'rows':[]};return db[_0x717a('0x37')][_0x717a('0x4f')]({'where':{'id':_0x2ab0b3[_0x717a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x395f27,null))[_0x717a('0x1e')](function(_0x45cc58){if(_0x45cc58){_0x5ad8d6[_0x717a('0x31')]=_['keys'](db[_0x717a('0x50')][_0x717a('0x27')]);_0x5ad8d6[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x2ab0b3['query']);_0x5ad8d6[_0x717a('0x2c')]=_[_0x717a('0x2d')](_0x5ad8d6[_0x717a('0x31')],_0x5ad8d6['query']);_0x420afa[_0x717a('0x2e')]=_[_0x717a('0x2d')](_0x5ad8d6['model'],qs[_0x717a('0x2f')](_0x2ab0b3['query'][_0x717a('0x2f')]));_0x420afa['attributes']=_0x420afa['attributes'][_0x717a('0x30')]?_0x420afa[_0x717a('0x2e')]:_0x5ad8d6[_0x717a('0x31')];if(!_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x51')](_0x717a('0x32'))){_0x420afa[_0x717a('0x17')]=qs[_0x717a('0x17')](_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x17')]);_0x420afa[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x2ab0b3['query'][_0x717a('0x16')]);}_0x420afa[_0x717a('0x52')]=qs[_0x717a('0x33')](_0x2ab0b3['query']['sort']);_0x420afa[_0x717a('0x35')]=qs[_0x717a('0x2c')](_[_0x717a('0x53')](_0x2ab0b3['query'],_0x5ad8d6[_0x717a('0x2c')]));_0x420afa['where'][_0x717a('0x54')]=_0x45cc58['id'];if(_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x34')]){_0x420afa[_0x717a('0x35')]=_['merge'](_0x420afa[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x420afa[_0x717a('0x2e')],function(_0x5a291b){var _0x2acfb5={};_0x2acfb5[_0x5a291b]={'$like':'%'+_0x2ab0b3[_0x717a('0x2b')]['filter']+'%'};return _0x2acfb5;})});}_0x420afa=_[_0x717a('0x36')]({},_0x420afa,_0x2ab0b3[_0x717a('0x3f')]);return db[_0x717a('0x50')][_0x717a('0x18')]({'where':_0x420afa['where']})[_0x717a('0x1e')](function(_0x284151){_0x77887c[_0x717a('0x18')]=_0x284151;if(_0x2ab0b3[_0x717a('0x2b')][_0x717a('0x38')]){_0x420afa[_0x717a('0x39')]=[{'all':!![]}];}return db[_0x717a('0x50')][_0x717a('0x3a')](_0x420afa);})[_0x717a('0x1e')](function(_0x4a4f12){_0x77887c[_0x717a('0x3b')]=_0x4a4f12;return _0x77887c;});}})[_0x717a('0x1e')](respondWithFilteredResult(_0x395f27,_0x420afa))[_0x717a('0x3c')](handleError(_0x395f27,null));};exports['getAnswers']=function(_0x41fd62,_0x3d09e5,_0x3fefb8){var _0x3230d5={'raw':!![],'where':{}};var _0x4913db={};var _0x40b95e={'count':0x0,'rows':[]};return db[_0x717a('0x37')]['findOne']({'where':{'id':_0x41fd62[_0x717a('0x3e')]['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x3d09e5,null))['then'](function(_0xbc9021){if(_0xbc9021){_0x4913db[_0x717a('0x31')]=_[_0x717a('0x2a')](db[_0x717a('0x55')][_0x717a('0x27')]);_0x4913db[_0x717a('0x2b')]=_[_0x717a('0x2a')](_0x41fd62[_0x717a('0x2b')]);_0x4913db['filters']=_[_0x717a('0x2d')](_0x4913db['model'],_0x4913db[_0x717a('0x2b')]);_0x3230d5[_0x717a('0x2e')]=_['intersection'](_0x4913db[_0x717a('0x31')],qs[_0x717a('0x2f')](_0x41fd62[_0x717a('0x2b')][_0x717a('0x2f')]));_0x3230d5[_0x717a('0x2e')]=_0x3230d5['attributes'][_0x717a('0x30')]?_0x3230d5[_0x717a('0x2e')]:_0x4913db['model'];if(!_0x41fd62[_0x717a('0x2b')][_0x717a('0x51')](_0x717a('0x32'))){_0x3230d5['limit']=qs[_0x717a('0x17')](_0x41fd62[_0x717a('0x2b')]['limit']);_0x3230d5[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x41fd62[_0x717a('0x2b')]['offset']);}_0x3230d5[_0x717a('0x52')]=qs[_0x717a('0x33')](_0x41fd62[_0x717a('0x2b')][_0x717a('0x33')]);_0x3230d5[_0x717a('0x35')]=qs[_0x717a('0x2c')](_[_0x717a('0x53')](_0x41fd62[_0x717a('0x2b')],_0x4913db[_0x717a('0x2c')]));_0x3230d5[_0x717a('0x35')][_0x717a('0x54')]=_0xbc9021['id'];if(_0x41fd62[_0x717a('0x2b')][_0x717a('0x34')]){_0x3230d5[_0x717a('0x35')]=_[_0x717a('0x36')](_0x3230d5[_0x717a('0x35')],{'$or':_[_0x717a('0x26')](_0x3230d5[_0x717a('0x2e')],function(_0x5eb315){var _0x149e2f={};_0x149e2f[_0x5eb315]={'$like':'%'+_0x41fd62[_0x717a('0x2b')][_0x717a('0x34')]+'%'};return _0x149e2f;})});}_0x3230d5=_['merge']({},_0x3230d5,_0x41fd62[_0x717a('0x3f')]);return db[_0x717a('0x55')][_0x717a('0x18')]({'where':_0x3230d5[_0x717a('0x35')]})[_0x717a('0x1e')](function(_0x381e01){_0x40b95e[_0x717a('0x18')]=_0x381e01;if(_0x41fd62[_0x717a('0x2b')][_0x717a('0x38')]){_0x3230d5[_0x717a('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x717a('0x3a')](_0x3230d5);})['then'](function(_0x951dac){_0x40b95e[_0x717a('0x3b')]=_0x951dac;return _0x40b95e;});}})[_0x717a('0x1e')](respondWithFilteredResult(_0x3d09e5,_0x3230d5))[_0x717a('0x3c')](handleError(_0x3d09e5,null));};function char(_0x2162d8){return _0x717a('0x56')===typeof _0x2162d8?String[_0x717a('0x57')][_0x717a('0x1a')](null,arguments):_0x2162d8;}function needsEncapsulation(_0x5a7743){return!!_0x5a7743&&(_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0xd))>=0x0||_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0xa))>=0x0||_0x5a7743[_0x717a('0x58')]()['indexOf'](char(0x2c))>=0x0||_0x5a7743[_0x717a('0x58')]()[_0x717a('0x59')](char(0x22))>=0x0);}function encapsulate(_0x5d5e1e){var _0x17f574=char(0x22),_0x569d4e='\x5c'+char(0x22),_0x10bea3=_0x5d5e1e[_0x717a('0x58')]()[_0x717a('0x5a')](new RegExp(_0x17f574,'g'),_0x569d4e);return _0x17f574+_0x10bea3+_0x17f574;}exports[_0x717a('0x5b')]=function(_0xa3697d,_0x48c8b9,_0x44816a){var _0x2821cb,_0x381409;var _0x211fa2={'where':{'ProjectId':_0xa3697d['params']['id']}};if(_0xa3697d[_0x717a('0x2b')]['startTime']){_0x211fa2['where']['starttime']=JSON[_0x717a('0x5c')](_0xa3697d['query'][_0x717a('0x5d')]);}return db['JscriptySessionReport'][_0x717a('0x3a')](_0x211fa2)[_0x717a('0x1e')](handleEntityNotFound(_0x48c8b9,null))[_0x717a('0x1e')](function(_0x47660b){if(_0x47660b){_0x2821cb=_0x47660b;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x717a('0x26')](_0x2821cb,'id')},'ProjectId':_0xa3697d[_0x717a('0x3e')]['id']},'order':_0x717a('0x5e')});}})[_0x717a('0x1e')](handleEntityNotFound(_0x48c8b9,null))['then'](function(_0x5229f7){if(_0x5229f7){_0x381409=_0x5229f7;var _0x6bbda6={};for(var _0xd21805=0x0,_0x892af9=_0x381409[_0x717a('0x30')];_0xd21805<_0x892af9;_0xd21805++){if(!_0x6bbda6[_0x717a('0x51')](_0x381409[_0xd21805][_0x717a('0x5f')])){_0x6bbda6[_0x381409[_0xd21805][_0x717a('0x5f')]]=needsEncapsulation(_0x381409[_0xd21805]['question'])?encapsulate(_0x381409[_0xd21805][_0x717a('0x60')]):_0x381409[_0xd21805][_0x717a('0x60')];}}var _0xa7076e=[],_0x53fc09={};for(var _0x33b670=0x0,_0x1c2959=_0x2821cb[_0x717a('0x30')];_0x33b670<_0x1c2959;_0x33b670++){_0x53fc09={'ProjectId':_0xa3697d[_0x717a('0x3e')]['id'],'SessionId':_0x2821cb[_0x33b670]['id'],'StartTime':moment(_0x2821cb[_0x33b670][_0x717a('0x61')])['format'](_0x717a('0x62'))};for(var _0x2e8366=0x0,_0x20bab6=_0x381409[_0x717a('0x30')];_0x2e8366<_0x20bab6;_0x2e8366++){if(_0x381409[_0x2e8366]['SessionId']==_0x2821cb[_0x33b670]['id']&&_0x6bbda6[_0x717a('0x51')](_0x381409[_0x2e8366][_0x717a('0x5f')])){_0x53fc09[_0x6bbda6[_0x381409[_0x2e8366][_0x717a('0x5f')]]]=_0x381409[_0x2e8366][_0x717a('0x63')];}}for(var _0x272c45 in _0x6bbda6){if(!_0x53fc09[_0x717a('0x51')](_0x6bbda6[_0x272c45])){_0x53fc09[_0x6bbda6[_0x272c45]]=null;}}_0xa7076e[_0x717a('0x64')](_0x53fc09);}return _0xa7076e;}})[_0x717a('0x1e')](function(_0x468877){if(!_['isEmpty'](_0x468877)){var _0xd55e70=toCsv(_0x468877);var _0x3d15f5=Date[_0x717a('0x65')]();fs[_0x717a('0x66')](util[_0x717a('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa3697d[_0x717a('0x3e')]['id'],_0x3d15f5),_0xd55e70);_0x48c8b9[_0x717a('0x68')](_0x717a('0x69'),_0x717a('0x6a')+util[_0x717a('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xa3697d['params']['id'],_0x3d15f5));_0x48c8b9[_0x717a('0x68')](_0x717a('0x6b'),_0x717a('0x6c'));return _0x48c8b9['download'](util['format'](_0x717a('0x6d'),_0xa3697d[_0x717a('0x3e')]['id'],_0x3d15f5));}else{return _0x48c8b9[_0x717a('0x22')](0xcc);}})['catch'](handleError(_0x48c8b9,null));}; \ No newline at end of file +var _0x7969=['set','Content-Range','reject','save','update','then','destroy','get','Projects','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','JscriptyProject','includeAll','include','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','UserProfileSection','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','nolimit','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','startTime','JscriptyQuestionReport','-createdAt','question','starttime','SessionId','questionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','undefined','count','offset','limit'];(function(_0x3c286e,_0x1d0d27){var _0x1181d2=function(_0x1582fe){while(--_0x1582fe){_0x3c286e['push'](_0x3c286e['shift']());}};_0x1181d2(++_0x1d0d27);}(_0x7969,0x1c2));var _0x9796=function(_0x24bced,_0x276624){_0x24bced=_0x24bced-0x0;var _0xdee77b=_0x7969[_0x24bced];return _0xdee77b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9796('0x0'));var jsonpatch=require(_0x9796('0x1'));var rp=require(_0x9796('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9796('0x3'));var util=require(_0x9796('0x4'));var path=require(_0x9796('0x5'));var sox=require(_0x9796('0x6'));var csv=require(_0x9796('0x7'));var ejs=require(_0x9796('0x8'));var fs=require('fs');var fs_extra=require(_0x9796('0x9'));var _=require(_0x9796('0xa'));var squel=require('squel');var crypto=require(_0x9796('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9796('0x7'));var querystring=require('querystring');var Papa=require(_0x9796('0xc'));var Redis=require('ioredis');var authService=require(_0x9796('0xd'));var qs=require(_0x9796('0xe'));var as=require(_0x9796('0xf'));var hardwareService=require(_0x9796('0x10'));var logger=require(_0x9796('0x11'))(_0x9796('0x12'));var utils=require(_0x9796('0x13'));var config=require(_0x9796('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9796('0x15'))['db'];function respondWithStatusCode(_0x54c658,_0x46ebe1){_0x46ebe1=_0x46ebe1||0xcc;return function(_0x58d7ec){if(_0x58d7ec){return _0x54c658[_0x9796('0x16')](_0x46ebe1);}return _0x54c658[_0x9796('0x17')](_0x46ebe1)[_0x9796('0x18')]();};}function respondWithResult(_0x3c080a,_0x1b2ed3){_0x1b2ed3=_0x1b2ed3||0xc8;return function(_0x2d3874){if(_0x2d3874){return _0x3c080a[_0x9796('0x17')](_0x1b2ed3)[_0x9796('0x19')](_0x2d3874);}};}function respondWithFilteredResult(_0x226a6b,_0x3e8299){return function(_0x432a00){if(_0x432a00){var _0xf2fd9a=typeof _0x3e8299['offset']==='undefined'&&typeof _0x3e8299['limit']===_0x9796('0x1a');var _0x146c58=_0x432a00[_0x9796('0x1b')];var _0x3212c8=_0xf2fd9a?0x0:_0x3e8299[_0x9796('0x1c')];var _0x40df64=_0xf2fd9a?_0x432a00[_0x9796('0x1b')]:_0x3e8299[_0x9796('0x1c')]+_0x3e8299[_0x9796('0x1d')];var _0x41a0b2;if(_0x40df64>=_0x146c58){_0x40df64=_0x146c58;_0x41a0b2=0xc8;}else{_0x41a0b2=0xce;}_0x226a6b[_0x9796('0x17')](_0x41a0b2);return _0x226a6b[_0x9796('0x1e')](_0x9796('0x1f'),_0x3212c8+'-'+_0x40df64+'/'+_0x146c58)[_0x9796('0x19')](_0x432a00);}return null;};}function patchUpdates(_0xa3c110){return function(_0x8bda7b){try{jsonpatch['apply'](_0x8bda7b,_0xa3c110,!![]);}catch(_0x1d7d7b){return BPromise[_0x9796('0x20')](_0x1d7d7b);}return _0x8bda7b[_0x9796('0x21')]();};}function saveUpdates(_0x272b3a,_0x554613){return function(_0x50b89d){if(_0x50b89d){return _0x50b89d[_0x9796('0x22')](_0x272b3a)[_0x9796('0x23')](function(_0x5aa12d){return _0x5aa12d;});}return null;};}function removeEntity(_0x47468f,_0x2f5766){return function(_0x1c8749){if(_0x1c8749){return _0x1c8749[_0x9796('0x24')]()[_0x9796('0x23')](function(){var _0x1600be=_0x1c8749[_0x9796('0x25')]({'plain':!![]});var _0x5e12ce=_0x9796('0x26');return db['UserProfileResource'][_0x9796('0x24')]({'where':{'type':_0x5e12ce,'resourceId':_0x1600be['id']}})[_0x9796('0x23')](function(){return _0x1c8749;});})[_0x9796('0x23')](function(){_0x47468f[_0x9796('0x17')](0xcc)[_0x9796('0x18')]();});}};}function handleEntityNotFound(_0x1009e9,_0x118022){return function(_0x2e98ca){if(!_0x2e98ca){_0x1009e9['sendStatus'](0x194);}return _0x2e98ca;};}function handleError(_0x1e2984,_0x53ba4c){_0x53ba4c=_0x53ba4c||0x1f4;return function(_0x5e268d){logger[_0x9796('0x27')](_0x5e268d[_0x9796('0x28')]);if(_0x5e268d[_0x9796('0x29')]){delete _0x5e268d['name'];}_0x1e2984[_0x9796('0x17')](_0x53ba4c)['send'](_0x5e268d);};}exports[_0x9796('0x2a')]=function(_0x156b26,_0x4b72aa){var _0x29b1fe={},_0x1f3c17={},_0x336e61={'count':0x0,'rows':[]};var _0x6c5ab8=_[_0x9796('0x2b')](db['JscriptyProject'][_0x9796('0x2c')],function(_0x2b9b19){return{'name':_0x2b9b19[_0x9796('0x2d')],'type':_0x2b9b19[_0x9796('0x2e')][_0x9796('0x2f')]};});_0x1f3c17[_0x9796('0x30')]=_[_0x9796('0x2b')](_0x6c5ab8,_0x9796('0x29'));_0x1f3c17[_0x9796('0x31')]=_[_0x9796('0x32')](_0x156b26[_0x9796('0x31')]);_0x1f3c17[_0x9796('0x33')]=_['intersection'](_0x1f3c17[_0x9796('0x30')],_0x1f3c17[_0x9796('0x31')]);_0x29b1fe[_0x9796('0x34')]=_[_0x9796('0x35')](_0x1f3c17[_0x9796('0x30')],qs[_0x9796('0x36')](_0x156b26[_0x9796('0x31')][_0x9796('0x36')]));_0x29b1fe[_0x9796('0x34')]=_0x29b1fe['attributes'][_0x9796('0x37')]?_0x29b1fe[_0x9796('0x34')]:_0x1f3c17[_0x9796('0x30')];if(!_0x156b26['query']['hasOwnProperty']('nolimit')){_0x29b1fe[_0x9796('0x1d')]=qs[_0x9796('0x1d')](_0x156b26[_0x9796('0x31')][_0x9796('0x1d')]);_0x29b1fe[_0x9796('0x1c')]=qs[_0x9796('0x1c')](_0x156b26[_0x9796('0x31')][_0x9796('0x1c')]);}_0x29b1fe[_0x9796('0x38')]=qs['sort'](_0x156b26[_0x9796('0x31')][_0x9796('0x39')]);_0x29b1fe[_0x9796('0x3a')]=qs[_0x9796('0x33')](_[_0x9796('0x3b')](_0x156b26[_0x9796('0x31')],_0x1f3c17[_0x9796('0x33')]),_0x6c5ab8);if(_0x156b26[_0x9796('0x31')]['filter']){_0x29b1fe[_0x9796('0x3a')]=_[_0x9796('0x3c')](_0x29b1fe[_0x9796('0x3a')],{'$or':_[_0x9796('0x2b')](_0x6c5ab8,function(_0x36a80f){if(_0x36a80f['type']!==_0x9796('0x3d')){var _0x23ec47={};_0x23ec47[_0x36a80f['name']]={'$like':'%'+_0x156b26[_0x9796('0x31')][_0x9796('0x3e')]+'%'};return _0x23ec47;}})});}_0x29b1fe=_[_0x9796('0x3c')]({},_0x29b1fe,_0x156b26['options']);var _0x567348={'where':_0x29b1fe[_0x9796('0x3a')]};return db[_0x9796('0x3f')][_0x9796('0x1b')](_0x567348)[_0x9796('0x23')](function(_0x353525){_0x336e61[_0x9796('0x1b')]=_0x353525;if(_0x156b26['query'][_0x9796('0x40')]){_0x29b1fe[_0x9796('0x41')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x29b1fe);})[_0x9796('0x23')](function(_0x54d3c6){_0x336e61[_0x9796('0x42')]=_0x54d3c6;return _0x336e61;})[_0x9796('0x23')](respondWithFilteredResult(_0x4b72aa,_0x29b1fe))[_0x9796('0x43')](handleError(_0x4b72aa,null));};exports[_0x9796('0x44')]=function(_0x3669ff,_0x11cbb4){var _0x429917={'raw':![],'where':{'id':_0x3669ff[_0x9796('0x45')]['id']}},_0x5d6d77={};_0x5d6d77[_0x9796('0x30')]=_[_0x9796('0x32')](db[_0x9796('0x3f')]['rawAttributes']);_0x5d6d77[_0x9796('0x31')]=_['keys'](_0x3669ff[_0x9796('0x31')]);_0x5d6d77[_0x9796('0x33')]=_[_0x9796('0x35')](_0x5d6d77['model'],_0x5d6d77[_0x9796('0x31')]);_0x429917['attributes']=_[_0x9796('0x35')](_0x5d6d77[_0x9796('0x30')],qs['fields'](_0x3669ff['query'][_0x9796('0x36')]));_0x429917[_0x9796('0x34')]=_0x429917[_0x9796('0x34')][_0x9796('0x37')]?_0x429917[_0x9796('0x34')]:_0x5d6d77[_0x9796('0x30')];if(_0x3669ff[_0x9796('0x31')]['includeAll']){_0x429917[_0x9796('0x41')]=[{'all':!![]}];}_0x429917=_[_0x9796('0x3c')]({},_0x429917,_0x3669ff[_0x9796('0x46')]);return db['JscriptyProject']['find'](_0x429917)['then'](handleEntityNotFound(_0x11cbb4,null))[_0x9796('0x23')](respondWithResult(_0x11cbb4,null))[_0x9796('0x43')](handleError(_0x11cbb4,null));};exports['create']=function(_0x479783,_0x3ddaa0){return db['JscriptyProject'][_0x9796('0x47')](_0x479783[_0x9796('0x48')],{})[_0x9796('0x23')](function(_0x35fec6){var _0x5e8c0d=_0x479783[_0x9796('0x49')][_0x9796('0x25')]({'plain':!![]});if(!_0x5e8c0d)throw new Error(_0x9796('0x4a'));if(_0x5e8c0d['role']===_0x9796('0x49')){var _0x2ea9bd=_0x35fec6[_0x9796('0x25')]({'plain':!![]});var _0x1914dd='Projects';return db['UserProfileSection'][_0x9796('0x4b')]({'where':{'name':_0x1914dd,'userProfileId':_0x5e8c0d['userProfileId']},'raw':!![]})[_0x9796('0x23')](function(_0x5816c1){if(_0x5816c1&&_0x5816c1[_0x9796('0x4c')]===0x0){return db[_0x9796('0x4d')][_0x9796('0x47')]({'name':_0x2ea9bd[_0x9796('0x29')],'resourceId':_0x2ea9bd['id'],'type':_0x5816c1[_0x9796('0x29')],'sectionId':_0x5816c1['id']},{})[_0x9796('0x23')](function(){return _0x35fec6;});}else{return _0x35fec6;}})[_0x9796('0x43')](function(_0x5bad6d){logger['error'](_0x9796('0x4e'),_0x5bad6d);throw _0x5bad6d;});}return _0x35fec6;})['then'](respondWithResult(_0x3ddaa0,0xc9))['catch'](handleError(_0x3ddaa0,null));};exports[_0x9796('0x4f')]=function(_0x1ebf23,_0x514d91){var _0x39def9={'where':{'id':_0x1ebf23['params']['id']}},_0x188c33={};_0x188c33['model']=_['keys'](db[_0x9796('0x3f')]['rawAttributes']);_0x39def9[_0x9796('0x34')]=_[_0x9796('0x35')](_0x188c33['model'],qs['fields'](_0x1ebf23['query'][_0x9796('0x36')]));_0x39def9[_0x9796('0x34')]=_0x39def9['attributes'][_0x9796('0x37')]?_0x39def9[_0x9796('0x34')]:_0x188c33[_0x9796('0x30')];if(_0x1ebf23[_0x9796('0x31')][_0x9796('0x40')]){_0x39def9[_0x9796('0x41')]=[{'all':!![]}];}_0x39def9=_[_0x9796('0x3c')]({},_0x39def9,_0x1ebf23[_0x9796('0x46')]);return db['JscriptyProject'][_0x9796('0x4b')](_0x39def9)['then'](handleEntityNotFound(_0x514d91,null))[_0x9796('0x23')](function(_0x15ee65){if(_0x15ee65){var _0x30d8e2=_0x15ee65[_0x9796('0x25')]({'plain':!![]});_0x30d8e2=qs['omit'](_0x30d8e2,['id',_0x9796('0x50'),_0x9796('0x51')]);_0x1ebf23[_0x9796('0x48')]=_[_0x9796('0x52')](_0x1ebf23[_0x9796('0x48')],['id',_0x9796('0x50'),_0x9796('0x51')]);return db['JscriptyProject'][_0x9796('0x47')](_[_0x9796('0x3c')](_0x30d8e2,_0x1ebf23[_0x9796('0x48')]),{'include':_0x1ebf23[_0x9796('0x31')][_0x9796('0x40')]?[{'all':!![]}]:undefined})[_0x9796('0x23')](function(_0x27679a){var _0x1cbb28=_0x1ebf23[_0x9796('0x49')][_0x9796('0x25')]({'plain':!![]});if(!_0x1cbb28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cbb28[_0x9796('0x53')]===_0x9796('0x49')){var _0x44b93f=_0x27679a['get']({'plain':!![]});var _0x48a684=_0x9796('0x26');return db[_0x9796('0x54')]['find']({'where':{'name':_0x48a684,'userProfileId':_0x1cbb28[_0x9796('0x55')]},'raw':!![]})[_0x9796('0x23')](function(_0x52f4fb){if(_0x52f4fb&&_0x52f4fb[_0x9796('0x4c')]===0x0){return db[_0x9796('0x4d')][_0x9796('0x47')]({'name':_0x44b93f['name'],'resourceId':_0x44b93f['id'],'type':_0x52f4fb['name'],'sectionId':_0x52f4fb['id']},{})['then'](function(){return _0x27679a;});}else{return _0x27679a;}})[_0x9796('0x43')](function(_0x2795ca){logger[_0x9796('0x27')](_0x9796('0x4e'),_0x2795ca);throw _0x2795ca;});}return _0x27679a;});}})[_0x9796('0x23')](respondWithResult(_0x514d91,0xc9))[_0x9796('0x43')](handleError(_0x514d91,null));};exports[_0x9796('0x22')]=function(_0x5d4a9c,_0x44096b){if(_0x5d4a9c['body']['id']){delete _0x5d4a9c[_0x9796('0x48')]['id'];}return db[_0x9796('0x3f')][_0x9796('0x4b')]({'where':{'id':_0x5d4a9c[_0x9796('0x45')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x44096b,null))[_0x9796('0x23')](saveUpdates(_0x5d4a9c[_0x9796('0x48')],null))[_0x9796('0x23')](respondWithResult(_0x44096b,null))['catch'](handleError(_0x44096b,null));};exports[_0x9796('0x24')]=function(_0x4b3aa7,_0xf6b39f){return db[_0x9796('0x3f')]['find']({'where':{'id':_0x4b3aa7[_0x9796('0x45')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0xf6b39f,null))[_0x9796('0x23')](removeEntity(_0xf6b39f,null))[_0x9796('0x43')](handleError(_0xf6b39f,null));};exports[_0x9796('0x56')]=function(_0x3a56c4,_0x5e7a21,_0x2dd43a){var _0x5703dc={'raw':!![],'where':{}};var _0x13caa7={};var _0x193a80={'count':0x0,'rows':[]};return db[_0x9796('0x3f')][_0x9796('0x57')]({'where':{'id':_0x3a56c4[_0x9796('0x45')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x5e7a21,null))[_0x9796('0x23')](function(_0x221731){if(_0x221731){_0x13caa7[_0x9796('0x30')]=_[_0x9796('0x32')](db[_0x9796('0x58')][_0x9796('0x2c')]);_0x13caa7[_0x9796('0x31')]=_['keys'](_0x3a56c4[_0x9796('0x31')]);_0x13caa7[_0x9796('0x33')]=_['intersection'](_0x13caa7[_0x9796('0x30')],_0x13caa7['query']);_0x5703dc[_0x9796('0x34')]=_['intersection'](_0x13caa7[_0x9796('0x30')],qs['fields'](_0x3a56c4['query']['fields']));_0x5703dc[_0x9796('0x34')]=_0x5703dc[_0x9796('0x34')][_0x9796('0x37')]?_0x5703dc['attributes']:_0x13caa7[_0x9796('0x30')];if(!_0x3a56c4[_0x9796('0x31')][_0x9796('0x59')]('nolimit')){_0x5703dc[_0x9796('0x1d')]=qs[_0x9796('0x1d')](_0x3a56c4[_0x9796('0x31')]['limit']);_0x5703dc['offset']=qs['offset'](_0x3a56c4[_0x9796('0x31')][_0x9796('0x1c')]);}_0x5703dc[_0x9796('0x38')]=qs[_0x9796('0x39')](_0x3a56c4[_0x9796('0x31')][_0x9796('0x39')]);_0x5703dc[_0x9796('0x3a')]=qs[_0x9796('0x33')](_['pick'](_0x3a56c4[_0x9796('0x31')],_0x13caa7[_0x9796('0x33')]));_0x5703dc[_0x9796('0x3a')][_0x9796('0x5a')]=_0x221731['id'];if(_0x3a56c4[_0x9796('0x31')][_0x9796('0x3e')]){_0x5703dc['where']=_['merge'](_0x5703dc[_0x9796('0x3a')],{'$or':_[_0x9796('0x2b')](_0x5703dc['attributes'],function(_0x2d3e93){var _0x3fd0a4={};_0x3fd0a4[_0x2d3e93]={'$like':'%'+_0x3a56c4['query']['filter']+'%'};return _0x3fd0a4;})});}_0x5703dc=_[_0x9796('0x3c')]({},_0x5703dc,_0x3a56c4['options']);return db[_0x9796('0x58')][_0x9796('0x1b')]({'where':_0x5703dc['where']})[_0x9796('0x23')](function(_0x3a06ae){_0x193a80[_0x9796('0x1b')]=_0x3a06ae;if(_0x3a56c4[_0x9796('0x31')][_0x9796('0x40')]){_0x5703dc[_0x9796('0x41')]=[{'all':!![]}];}return db[_0x9796('0x58')][_0x9796('0x5b')](_0x5703dc);})[_0x9796('0x23')](function(_0x5e4c1e){_0x193a80['rows']=_0x5e4c1e;return _0x193a80;});}})['then'](respondWithFilteredResult(_0x5e7a21,_0x5703dc))[_0x9796('0x43')](handleError(_0x5e7a21,null));};exports[_0x9796('0x5c')]=function(_0x2fb1be,_0xe95137,_0x505ebd){var _0x7d18ab={'raw':!![],'where':{}};var _0x5965e0={};var _0x40a63b={'count':0x0,'rows':[]};return db[_0x9796('0x3f')][_0x9796('0x57')]({'where':{'id':_0x2fb1be[_0x9796('0x45')]['id']}})['then'](handleEntityNotFound(_0xe95137,null))[_0x9796('0x23')](function(_0x26fa34){if(_0x26fa34){_0x5965e0[_0x9796('0x30')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x5965e0[_0x9796('0x31')]=_[_0x9796('0x32')](_0x2fb1be[_0x9796('0x31')]);_0x5965e0[_0x9796('0x33')]=_[_0x9796('0x35')](_0x5965e0[_0x9796('0x30')],_0x5965e0['query']);_0x7d18ab[_0x9796('0x34')]=_['intersection'](_0x5965e0[_0x9796('0x30')],qs[_0x9796('0x36')](_0x2fb1be[_0x9796('0x31')][_0x9796('0x36')]));_0x7d18ab['attributes']=_0x7d18ab[_0x9796('0x34')][_0x9796('0x37')]?_0x7d18ab[_0x9796('0x34')]:_0x5965e0[_0x9796('0x30')];if(!_0x2fb1be['query'][_0x9796('0x59')](_0x9796('0x5d'))){_0x7d18ab['limit']=qs[_0x9796('0x1d')](_0x2fb1be[_0x9796('0x31')][_0x9796('0x1d')]);_0x7d18ab[_0x9796('0x1c')]=qs[_0x9796('0x1c')](_0x2fb1be[_0x9796('0x31')]['offset']);}_0x7d18ab[_0x9796('0x38')]=qs[_0x9796('0x39')](_0x2fb1be[_0x9796('0x31')][_0x9796('0x39')]);_0x7d18ab[_0x9796('0x3a')]=qs[_0x9796('0x33')](_[_0x9796('0x3b')](_0x2fb1be['query'],_0x5965e0[_0x9796('0x33')]));_0x7d18ab[_0x9796('0x3a')][_0x9796('0x5a')]=_0x26fa34['id'];if(_0x2fb1be[_0x9796('0x31')]['filter']){_0x7d18ab[_0x9796('0x3a')]=_[_0x9796('0x3c')](_0x7d18ab[_0x9796('0x3a')],{'$or':_[_0x9796('0x2b')](_0x7d18ab[_0x9796('0x34')],function(_0x2175a4){var _0x91eba8={};_0x91eba8[_0x2175a4]={'$like':'%'+_0x2fb1be[_0x9796('0x31')][_0x9796('0x3e')]+'%'};return _0x91eba8;})});}_0x7d18ab=_[_0x9796('0x3c')]({},_0x7d18ab,_0x2fb1be[_0x9796('0x46')]);return db[_0x9796('0x5e')][_0x9796('0x1b')]({'where':_0x7d18ab[_0x9796('0x3a')]})[_0x9796('0x23')](function(_0x494bfc){_0x40a63b[_0x9796('0x1b')]=_0x494bfc;if(_0x2fb1be['query']['includeAll']){_0x7d18ab['include']=[{'all':!![]}];}return db[_0x9796('0x5e')][_0x9796('0x5b')](_0x7d18ab);})[_0x9796('0x23')](function(_0x5d086b){_0x40a63b[_0x9796('0x42')]=_0x5d086b;return _0x40a63b;});}})[_0x9796('0x23')](respondWithFilteredResult(_0xe95137,_0x7d18ab))[_0x9796('0x43')](handleError(_0xe95137,null));};function char(_0x523353){return _0x9796('0x5f')===typeof _0x523353?String[_0x9796('0x60')][_0x9796('0x61')](null,arguments):_0x523353;}function needsEncapsulation(_0x15d962){return!!_0x15d962&&(_0x15d962[_0x9796('0x62')]()[_0x9796('0x63')](char(0xd))>=0x0||_0x15d962[_0x9796('0x62')]()[_0x9796('0x63')](char(0xa))>=0x0||_0x15d962['toString']()['indexOf'](char(0x2c))>=0x0||_0x15d962['toString']()[_0x9796('0x63')](char(0x22))>=0x0);}function encapsulate(_0x57b4db){var _0x3136f2=char(0x22),_0x393366='\x5c'+char(0x22),_0x56c660=_0x57b4db[_0x9796('0x62')]()[_0x9796('0x64')](new RegExp(_0x3136f2,'g'),_0x393366);return _0x3136f2+_0x56c660+_0x3136f2;}exports['getSummary']=function(_0x25ca8a,_0xe37c37,_0x2433b7){var _0x21acf7,_0x501f0e;var _0x12b1b5={'where':{'ProjectId':_0x25ca8a['params']['id']}};if(_0x25ca8a[_0x9796('0x31')][_0x9796('0x65')]){_0x12b1b5[_0x9796('0x3a')]['starttime']=JSON['parse'](_0x25ca8a[_0x9796('0x31')][_0x9796('0x65')]);}return db[_0x9796('0x58')][_0x9796('0x5b')](_0x12b1b5)['then'](handleEntityNotFound(_0xe37c37,null))[_0x9796('0x23')](function(_0x236a2f){if(_0x236a2f){_0x21acf7=_0x236a2f;return db[_0x9796('0x66')]['findAll']({'where':{'SessionId':{'$in':_[_0x9796('0x2b')](_0x21acf7,'id')},'ProjectId':_0x25ca8a[_0x9796('0x45')]['id']},'order':_0x9796('0x67')});}})[_0x9796('0x23')](handleEntityNotFound(_0xe37c37,null))[_0x9796('0x23')](function(_0x211a16){if(_0x211a16){_0x501f0e=_0x211a16;var _0x38fb24={};for(var _0x44d1e1=0x0,_0x4610db=_0x501f0e[_0x9796('0x37')];_0x44d1e1<_0x4610db;_0x44d1e1++){if(!_0x38fb24[_0x9796('0x59')](_0x501f0e[_0x44d1e1]['questionId'])){_0x38fb24[_0x501f0e[_0x44d1e1]['questionId']]=needsEncapsulation(_0x501f0e[_0x44d1e1]['question'])?encapsulate(_0x501f0e[_0x44d1e1][_0x9796('0x68')]):_0x501f0e[_0x44d1e1]['question'];}}var _0x31133f=[],_0xd7bdbb={};for(var _0x4b5628=0x0,_0x1eedb4=_0x21acf7['length'];_0x4b5628<_0x1eedb4;_0x4b5628++){_0xd7bdbb={'ProjectId':_0x25ca8a[_0x9796('0x45')]['id'],'SessionId':_0x21acf7[_0x4b5628]['id'],'StartTime':moment(_0x21acf7[_0x4b5628][_0x9796('0x69')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x36c83e=0x0,_0x37766b=_0x501f0e[_0x9796('0x37')];_0x36c83e<_0x37766b;_0x36c83e++){if(_0x501f0e[_0x36c83e][_0x9796('0x6a')]==_0x21acf7[_0x4b5628]['id']&&_0x38fb24[_0x9796('0x59')](_0x501f0e[_0x36c83e][_0x9796('0x6b')])){_0xd7bdbb[_0x38fb24[_0x501f0e[_0x36c83e][_0x9796('0x6b')]]]=_0x501f0e[_0x36c83e][_0x9796('0x6c')];}}for(var _0x2b8609 in _0x38fb24){if(!_0xd7bdbb[_0x9796('0x59')](_0x38fb24[_0x2b8609])){_0xd7bdbb[_0x38fb24[_0x2b8609]]=null;}}_0x31133f[_0x9796('0x6d')](_0xd7bdbb);}return _0x31133f;}})[_0x9796('0x23')](function(_0x3a0a96){if(!_['isEmpty'](_0x3a0a96)){var _0x2fccbb=toCsv(_0x3a0a96);var _0x486b38=Date[_0x9796('0x6e')]();fs[_0x9796('0x6f')](util['format'](_0x9796('0x70'),_0x25ca8a[_0x9796('0x45')]['id'],_0x486b38),_0x2fccbb);_0xe37c37[_0x9796('0x71')]('Content-disposition',_0x9796('0x72')+util[_0x9796('0x73')](_0x9796('0x74'),_0x25ca8a[_0x9796('0x45')]['id'],_0x486b38));_0xe37c37['setHeader'](_0x9796('0x75'),_0x9796('0x76'));return _0xe37c37[_0x9796('0x77')](util[_0x9796('0x73')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x25ca8a['params']['id'],_0x486b38));}else{return _0xe37c37['sendStatus'](0xcc);}})['catch'](handleError(_0xe37c37,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8fce948..caf19e2 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 _0xa992=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4520b8,_0x12d8da){var _0x562bfb=function(_0x102227){while(--_0x102227){_0x4520b8['push'](_0x4520b8['shift']());}};_0x562bfb(++_0x12d8da);}(_0xa992,0x18c));var _0x2a99=function(_0x294f67,_0x1d346e){_0x294f67=_0x294f67-0x0;var _0x21f3bc=_0xa992[_0x294f67];return _0x21f3bc;};'use strict';var _=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var logger=require(_0x2a99('0x2'))(_0x2a99('0x3'));var moment=require('moment');var BPromise=require(_0x2a99('0x4'));var rp=require(_0x2a99('0x5'));var fs=require('fs');var path=require(_0x2a99('0x6'));var rimraf=require(_0x2a99('0x7'));var config=require(_0x2a99('0x8'));var attributes=require(_0x2a99('0x9'));module[_0x2a99('0xa')]=function(_0x90fbc9,_0x11c36a){return _0x90fbc9[_0x2a99('0xb')]('JscriptyProject',attributes,{'tableName':_0x2a99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef0=['bluebird','request-promise','path','rimraf','exports','define','jscripty_projects','lodash','util','api','moment'];(function(_0x485515,_0x32246f){var _0x17f881=function(_0x1a2a05){while(--_0x1a2a05){_0x485515['push'](_0x485515['shift']());}};_0x17f881(++_0x32246f);}(_0x0ef0,0x80));var _0x00ef=function(_0x19e89d,_0x4793ce){_0x19e89d=_0x19e89d-0x0;var _0x48aeed=_0x0ef0[_0x19e89d];return _0x48aeed;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var logger=require('../../config/logger')(_0x00ef('0x2'));var moment=require(_0x00ef('0x3'));var BPromise=require(_0x00ef('0x4'));var rp=require(_0x00ef('0x5'));var fs=require('fs');var path=require(_0x00ef('0x6'));var rimraf=require(_0x00ef('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x00ef('0x8')]=function(_0x406d13,_0x471ebf){return _0x406d13[_0x00ef('0x9')]('JscriptyProject',attributes,{'tableName':_0x00ef('0xa'),'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 de61915..c89d365 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x177526,_0x44be73){var _0xfce16c=function(_0x54c843){while(--_0x54c843){_0x177526['push'](_0x177526['shift']());}};_0xfce16c(++_0x44be73);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x562b0a,_0x570263){var _0x3d9212=function(_0x1eb073){while(--_0x1eb073){_0x562b0a['push'](_0x562b0a['shift']());}};_0x3d9212(++_0x570263);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2728c1,_0x1971f9){_0x2728c1=_0x2728c1-0x0;var _0x158c89=_0xb43b[_0x2728c1];return _0x158c89;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b8794c3..d400f2e 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 _0xb4e9=['show','post','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x526c3d,_0xaad2e){var _0x17f2ea=function(_0x44988d){while(--_0x44988d){_0x526c3d['push'](_0x526c3d['shift']());}};_0x17f2ea(++_0xaad2e);}(_0xb4e9,0x1d5));var _0x9b4e=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0xb4e9[_0x1635fe];return _0x3c512a;};'use strict';var multer=require('multer');var util=require(_0x9b4e('0x0'));var path=require('path');var timeout=require(_0x9b4e('0x1'));var express=require('express');var router=express[_0x9b4e('0x2')]();var fs_extra=require(_0x9b4e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b4e('0x4'));var config=require(_0x9b4e('0x5'));var controller=require(_0x9b4e('0x6'));router[_0x9b4e('0x7')]('/',auth[_0x9b4e('0x8')](),controller['index']);router['get']('/describe',auth[_0x9b4e('0x8')](),controller[_0x9b4e('0x9')]);router['get'](_0x9b4e('0xa'),auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xb')]);router[_0x9b4e('0xc')]('/',auth[_0x9b4e('0x8')](),controller['create']);router['put'](_0x9b4e('0xa'),auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xd')]);router[_0x9b4e('0xe')]('/:id',auth[_0x9b4e('0x8')](),controller[_0x9b4e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1798=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','post','create','update','destroy','exports','util'];(function(_0x5f124a,_0x34e5d2){var _0x3717c1=function(_0x16e713){while(--_0x16e713){_0x5f124a['push'](_0x5f124a['shift']());}};_0x3717c1(++_0x34e5d2);}(_0x1798,0xe9));var _0x8179=function(_0x145946,_0x1e231d){_0x145946=_0x145946-0x0;var _0x36b03e=_0x1798[_0x145946];return _0x36b03e;};'use strict';var multer=require('multer');var util=require(_0x8179('0x0'));var path=require(_0x8179('0x1'));var timeout=require(_0x8179('0x2'));var express=require(_0x8179('0x3'));var router=express['Router']();var fs_extra=require(_0x8179('0x4'));var auth=require(_0x8179('0x5'));var interaction=require(_0x8179('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x8179('0x7')]('/',auth[_0x8179('0x8')](),controller[_0x8179('0x9')]);router['get']('/describe',auth[_0x8179('0x8')](),controller[_0x8179('0xa')]);router[_0x8179('0x7')](_0x8179('0xb'),auth['isAuthenticated'](),controller[_0x8179('0xc')]);router[_0x8179('0xd')]('/',auth[_0x8179('0x8')](),controller[_0x8179('0xe')]);router['put']('/:id',auth[_0x8179('0x8')](),controller[_0x8179('0xf')]);router['delete']('/:id',auth[_0x8179('0x8')](),controller[_0x8179('0x10')]);module[_0x8179('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index dd5dc51..a9f12ab 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x2054fc,_0x2bc22c){_0x2054fc=_0x2054fc-0x0;var _0x33d52f=_0x7a54[_0x2054fc];return _0x33d52f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7a54,0x106));var _0x47a5=function(_0x102ee0,_0x5c0785){_0x102ee0=_0x102ee0-0x0;var _0x317140=_0x7a54[_0x102ee0];return _0x317140;};'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 78e6c49..cd4de6b 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 _0x1c5c=['to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','name','send','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','show','params','JscriptyQuestionReport','rawAttributes','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x1c5c,0x1ae));var _0xc1c5=function(_0x3aaf56,_0x5744a8){_0x3aaf56=_0x3aaf56-0x0;var _0x58fcad=_0x1c5c[_0x3aaf56];return _0x58fcad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1c5('0x0'));var zipdir=require(_0xc1c5('0x1'));var jsonpatch=require(_0xc1c5('0x2'));var rp=require(_0xc1c5('0x3'));var moment=require(_0xc1c5('0x4'));var BPromise=require(_0xc1c5('0x5'));var Mustache=require(_0xc1c5('0x6'));var util=require('util');var path=require(_0xc1c5('0x7'));var sox=require('sox');var csv=require(_0xc1c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1c5('0x9'));var _=require(_0xc1c5('0xa'));var squel=require('squel');var crypto=require(_0xc1c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc1c5('0xc'));var toCsv=require(_0xc1c5('0x8'));var querystring=require(_0xc1c5('0xd'));var Papa=require(_0xc1c5('0xe'));var Redis=require('ioredis');var authService=require(_0xc1c5('0xf'));var qs=require(_0xc1c5('0x10'));var as=require(_0xc1c5('0x11'));var hardwareService=require(_0xc1c5('0x12'));var logger=require(_0xc1c5('0x13'))(_0xc1c5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc1c5('0x15'));var db=require(_0xc1c5('0x16'))['db'];function respondWithStatusCode(_0x254915,_0xed820a){_0xed820a=_0xed820a||0xcc;return function(_0x5dca8b){if(_0x5dca8b){return _0x254915[_0xc1c5('0x17')](_0xed820a);}return _0x254915[_0xc1c5('0x18')](_0xed820a)[_0xc1c5('0x19')]();};}function respondWithResult(_0x259e06,_0x21c134){_0x21c134=_0x21c134||0xc8;return function(_0x3d7045){if(_0x3d7045){return _0x259e06[_0xc1c5('0x18')](_0x21c134)[_0xc1c5('0x1a')](_0x3d7045);}};}function respondWithFilteredResult(_0x472157,_0x1e44d3){return function(_0x4ac152){if(_0x4ac152){var _0x3e9f88=typeof _0x1e44d3['offset']===_0xc1c5('0x1b')&&typeof _0x1e44d3[_0xc1c5('0x1c')]==='undefined';var _0x1441dd=_0x4ac152['count'];var _0x2b44f8=_0x3e9f88?0x0:_0x1e44d3['offset'];var _0x4f2431=_0x3e9f88?_0x4ac152[_0xc1c5('0x1d')]:_0x1e44d3[_0xc1c5('0x1e')]+_0x1e44d3['limit'];var _0x395f86;if(_0x4f2431>=_0x1441dd){_0x4f2431=_0x1441dd;_0x395f86=0xc8;}else{_0x395f86=0xce;}_0x472157[_0xc1c5('0x18')](_0x395f86);return _0x472157[_0xc1c5('0x1f')](_0xc1c5('0x20'),_0x2b44f8+'-'+_0x4f2431+'/'+_0x1441dd)[_0xc1c5('0x1a')](_0x4ac152);}return null;};}function patchUpdates(_0x17fb96){return function(_0x4d0d4c){try{jsonpatch['apply'](_0x4d0d4c,_0x17fb96,!![]);}catch(_0x581b7c){return BPromise['reject'](_0x581b7c);}return _0x4d0d4c['save']();};}function saveUpdates(_0x4b8571,_0x1b3e93){return function(_0x164c51){if(_0x164c51){return _0x164c51[_0xc1c5('0x21')](_0x4b8571)[_0xc1c5('0x22')](function(_0x25f688){return _0x25f688;});}return null;};}function removeEntity(_0x3cb43f,_0x472096){return function(_0x278eec){if(_0x278eec){return _0x278eec[_0xc1c5('0x23')]()['then'](function(){_0x3cb43f[_0xc1c5('0x18')](0xcc)[_0xc1c5('0x19')]();});}};}function handleEntityNotFound(_0x506b3b,_0x52df7b){return function(_0x47a2b4){if(!_0x47a2b4){_0x506b3b[_0xc1c5('0x17')](0x194);}return _0x47a2b4;};}function handleError(_0x4d730e,_0x2bab13){_0x2bab13=_0x2bab13||0x1f4;return function(_0x1576e7){logger[_0xc1c5('0x24')](_0x1576e7['stack']);if(_0x1576e7['name']){delete _0x1576e7[_0xc1c5('0x25')];}_0x4d730e[_0xc1c5('0x18')](_0x2bab13)[_0xc1c5('0x26')](_0x1576e7);};}exports['index']=function(_0x2fd624,_0x418ba9){var _0x4f8580={},_0x2ca105={},_0x252512={'count':0x0,'rows':[]};var _0x4bfb17=_[_0xc1c5('0x27')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x41d638){return{'name':_0x41d638[_0xc1c5('0x28')],'type':_0x41d638[_0xc1c5('0x29')][_0xc1c5('0x2a')]};});_0x2ca105[_0xc1c5('0x2b')]=_['map'](_0x4bfb17,'name');_0x2ca105['query']=_[_0xc1c5('0x2c')](_0x2fd624[_0xc1c5('0x2d')]);_0x2ca105['filters']=_[_0xc1c5('0x2e')](_0x2ca105[_0xc1c5('0x2b')],_0x2ca105[_0xc1c5('0x2d')]);_0x4f8580['attributes']=_[_0xc1c5('0x2e')](_0x2ca105[_0xc1c5('0x2b')],qs[_0xc1c5('0x2f')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x2f')]));_0x4f8580['attributes']=_0x4f8580[_0xc1c5('0x30')][_0xc1c5('0x31')]?_0x4f8580[_0xc1c5('0x30')]:_0x2ca105[_0xc1c5('0x2b')];if(!_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x32')](_0xc1c5('0x33'))){_0x4f8580[_0xc1c5('0x1c')]=qs[_0xc1c5('0x1c')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x1c')]);_0x4f8580[_0xc1c5('0x1e')]=qs[_0xc1c5('0x1e')](_0x2fd624[_0xc1c5('0x2d')]['offset']);}_0x4f8580['order']=qs[_0xc1c5('0x34')](_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x34')]);_0x4f8580[_0xc1c5('0x35')]=qs['filters'](_[_0xc1c5('0x36')](_0x2fd624['query'],_0x2ca105[_0xc1c5('0x37')]),_0x4bfb17);if(_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x38')]){_0x4f8580[_0xc1c5('0x35')]=_[_0xc1c5('0x39')](_0x4f8580[_0xc1c5('0x35')],{'$or':_[_0xc1c5('0x27')](_0x4bfb17,function(_0x51f29c){if(_0x51f29c['type']!==_0xc1c5('0x3a')){var _0x344c67={};_0x344c67[_0x51f29c[_0xc1c5('0x25')]]={'$like':'%'+_0x2fd624[_0xc1c5('0x2d')][_0xc1c5('0x38')]+'%'};return _0x344c67;}})});}_0x4f8580=_['merge']({},_0x4f8580,_0x2fd624['options']);var _0x27e988={'where':_0x4f8580[_0xc1c5('0x35')]};return db['JscriptyQuestionReport']['count'](_0x27e988)[_0xc1c5('0x22')](function(_0x3e9a5e){_0x252512[_0xc1c5('0x1d')]=_0x3e9a5e;if(_0x2fd624['query']['includeAll']){_0x4f8580[_0xc1c5('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc1c5('0x3c')](_0x4f8580);})[_0xc1c5('0x22')](function(_0x15dcfd){_0x252512[_0xc1c5('0x3d')]=_0x15dcfd;return _0x252512;})['then'](respondWithFilteredResult(_0x418ba9,_0x4f8580))['catch'](handleError(_0x418ba9,null));};exports[_0xc1c5('0x3e')]=function(_0x44d8f2,_0x3724cb){var _0x3fb814={'raw':!![],'where':{'id':_0x44d8f2[_0xc1c5('0x3f')]['id']}},_0x476964={};_0x476964[_0xc1c5('0x2b')]=_[_0xc1c5('0x2c')](db[_0xc1c5('0x40')][_0xc1c5('0x41')]);_0x476964['query']=_[_0xc1c5('0x2c')](_0x44d8f2[_0xc1c5('0x2d')]);_0x476964[_0xc1c5('0x37')]=_[_0xc1c5('0x2e')](_0x476964[_0xc1c5('0x2b')],_0x476964[_0xc1c5('0x2d')]);_0x3fb814[_0xc1c5('0x30')]=_['intersection'](_0x476964['model'],qs[_0xc1c5('0x2f')](_0x44d8f2[_0xc1c5('0x2d')]['fields']));_0x3fb814['attributes']=_0x3fb814[_0xc1c5('0x30')][_0xc1c5('0x31')]?_0x3fb814['attributes']:_0x476964[_0xc1c5('0x2b')];if(_0x44d8f2[_0xc1c5('0x2d')][_0xc1c5('0x42')]){_0x3fb814[_0xc1c5('0x3b')]=[{'all':!![]}];}_0x3fb814=_[_0xc1c5('0x39')]({},_0x3fb814,_0x44d8f2[_0xc1c5('0x43')]);return db[_0xc1c5('0x40')][_0xc1c5('0x44')](_0x3fb814)[_0xc1c5('0x22')](handleEntityNotFound(_0x3724cb,null))[_0xc1c5('0x22')](respondWithResult(_0x3724cb,null))[_0xc1c5('0x45')](handleError(_0x3724cb,null));};exports[_0xc1c5('0x46')]=function(_0x544d51,_0x9d85e9){return db[_0xc1c5('0x40')]['create'](_0x544d51[_0xc1c5('0x47')],{})[_0xc1c5('0x22')](respondWithResult(_0x9d85e9,0xc9))[_0xc1c5('0x45')](handleError(_0x9d85e9,null));};exports[_0xc1c5('0x21')]=function(_0x214bc4,_0x35dd2e){if(_0x214bc4['body']['id']){delete _0x214bc4[_0xc1c5('0x47')]['id'];}return db[_0xc1c5('0x40')][_0xc1c5('0x44')]({'where':{'id':_0x214bc4[_0xc1c5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35dd2e,null))['then'](saveUpdates(_0x214bc4[_0xc1c5('0x47')],null))[_0xc1c5('0x22')](respondWithResult(_0x35dd2e,null))[_0xc1c5('0x45')](handleError(_0x35dd2e,null));};exports[_0xc1c5('0x23')]=function(_0xff4c8,_0xf4dfbb){return db[_0xc1c5('0x40')][_0xc1c5('0x44')]({'where':{'id':_0xff4c8[_0xc1c5('0x3f')]['id']}})[_0xc1c5('0x22')](handleEntityNotFound(_0xf4dfbb,null))[_0xc1c5('0x22')](removeEntity(_0xf4dfbb,null))[_0xc1c5('0x45')](handleError(_0xf4dfbb,null));};exports[_0xc1c5('0x48')]=function(_0x168e34,_0x13a117){return db[_0xc1c5('0x40')]['describe']()[_0xc1c5('0x22')](respondWithResult(_0x13a117,null))[_0xc1c5('0x45')](handleError(_0x13a117,null));}; \ No newline at end of file +var _0x02b6=['error','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy'];(function(_0x43fab6,_0xa89f49){var _0x1aa02e=function(_0x5eb504){while(--_0x5eb504){_0x43fab6['push'](_0x43fab6['shift']());}};_0x1aa02e(++_0xa89f49);}(_0x02b6,0xf0));var _0x602b=function(_0x37b5b9,_0x20490f){_0x37b5b9=_0x37b5b9-0x0;var _0x5438f2=_0x02b6[_0x37b5b9];return _0x5438f2;};'use strict';var emlformat=require(_0x602b('0x0'));var rimraf=require(_0x602b('0x1'));var zipdir=require(_0x602b('0x2'));var jsonpatch=require(_0x602b('0x3'));var rp=require(_0x602b('0x4'));var moment=require(_0x602b('0x5'));var BPromise=require(_0x602b('0x6'));var Mustache=require(_0x602b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x602b('0x8'));var csv=require(_0x602b('0x9'));var ejs=require(_0x602b('0xa'));var fs=require('fs');var fs_extra=require(_0x602b('0xb'));var _=require(_0x602b('0xc'));var squel=require(_0x602b('0xd'));var crypto=require(_0x602b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x602b('0xf'));var toCsv=require(_0x602b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x602b('0x10'));var as=require(_0x602b('0x11'));var hardwareService=require(_0x602b('0x12'));var logger=require('../../config/logger')(_0x602b('0x13'));var utils=require(_0x602b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x602b('0x15'));var db=require(_0x602b('0x16'))['db'];function respondWithStatusCode(_0x23cd36,_0x1ba63b){_0x1ba63b=_0x1ba63b||0xcc;return function(_0x4b943c){if(_0x4b943c){return _0x23cd36[_0x602b('0x17')](_0x1ba63b);}return _0x23cd36[_0x602b('0x18')](_0x1ba63b)[_0x602b('0x19')]();};}function respondWithResult(_0x321b4f,_0x17ce2a){_0x17ce2a=_0x17ce2a||0xc8;return function(_0x1be698){if(_0x1be698){return _0x321b4f[_0x602b('0x18')](_0x17ce2a)[_0x602b('0x1a')](_0x1be698);}};}function respondWithFilteredResult(_0x9eb9a7,_0x18de93){return function(_0x1238f0){if(_0x1238f0){var _0xc72442=typeof _0x18de93[_0x602b('0x1b')]===_0x602b('0x1c')&&typeof _0x18de93[_0x602b('0x1d')]===_0x602b('0x1c');var _0xc76409=_0x1238f0[_0x602b('0x1e')];var _0x50129e=_0xc72442?0x0:_0x18de93['offset'];var _0x1cfd9e=_0xc72442?_0x1238f0[_0x602b('0x1e')]:_0x18de93[_0x602b('0x1b')]+_0x18de93['limit'];var _0x1cd44d;if(_0x1cfd9e>=_0xc76409){_0x1cfd9e=_0xc76409;_0x1cd44d=0xc8;}else{_0x1cd44d=0xce;}_0x9eb9a7[_0x602b('0x18')](_0x1cd44d);return _0x9eb9a7['set']('Content-Range',_0x50129e+'-'+_0x1cfd9e+'/'+_0xc76409)[_0x602b('0x1a')](_0x1238f0);}return null;};}function patchUpdates(_0x39738d){return function(_0x57d53d){try{jsonpatch[_0x602b('0x1f')](_0x57d53d,_0x39738d,!![]);}catch(_0x1ea1bb){return BPromise[_0x602b('0x20')](_0x1ea1bb);}return _0x57d53d['save']();};}function saveUpdates(_0x366e6e,_0x288393){return function(_0x27b2bb){if(_0x27b2bb){return _0x27b2bb[_0x602b('0x21')](_0x366e6e)[_0x602b('0x22')](function(_0x43ff46){return _0x43ff46;});}return null;};}function removeEntity(_0x15f6d5,_0x1f6b82){return function(_0x2534b3){if(_0x2534b3){return _0x2534b3[_0x602b('0x23')]()[_0x602b('0x22')](function(){_0x15f6d5[_0x602b('0x18')](0xcc)[_0x602b('0x19')]();});}};}function handleEntityNotFound(_0x12009a,_0x54c888){return function(_0x149469){if(!_0x149469){_0x12009a[_0x602b('0x17')](0x194);}return _0x149469;};}function handleError(_0x3acb42,_0x554351){_0x554351=_0x554351||0x1f4;return function(_0x1606fc){logger[_0x602b('0x24')](_0x1606fc['stack']);if(_0x1606fc[_0x602b('0x25')]){delete _0x1606fc[_0x602b('0x25')];}_0x3acb42[_0x602b('0x18')](_0x554351)[_0x602b('0x26')](_0x1606fc);};}exports['index']=function(_0xab6b8a,_0x3e3d3d){var _0x5d9e80={},_0x4cec28={},_0x1fbcb7={'count':0x0,'rows':[]};var _0x1c1d29=_[_0x602b('0x27')](db[_0x602b('0x28')][_0x602b('0x29')],function(_0x36ed47){return{'name':_0x36ed47[_0x602b('0x2a')],'type':_0x36ed47[_0x602b('0x2b')][_0x602b('0x2c')]};});_0x4cec28[_0x602b('0x2d')]=_[_0x602b('0x27')](_0x1c1d29,_0x602b('0x25'));_0x4cec28[_0x602b('0x2e')]=_[_0x602b('0x2f')](_0xab6b8a[_0x602b('0x2e')]);_0x4cec28['filters']=_[_0x602b('0x30')](_0x4cec28[_0x602b('0x2d')],_0x4cec28['query']);_0x5d9e80['attributes']=_[_0x602b('0x30')](_0x4cec28[_0x602b('0x2d')],qs[_0x602b('0x31')](_0xab6b8a[_0x602b('0x2e')]['fields']));_0x5d9e80[_0x602b('0x32')]=_0x5d9e80[_0x602b('0x32')]['length']?_0x5d9e80[_0x602b('0x32')]:_0x4cec28[_0x602b('0x2d')];if(!_0xab6b8a[_0x602b('0x2e')]['hasOwnProperty'](_0x602b('0x33'))){_0x5d9e80['limit']=qs[_0x602b('0x1d')](_0xab6b8a[_0x602b('0x2e')]['limit']);_0x5d9e80[_0x602b('0x1b')]=qs[_0x602b('0x1b')](_0xab6b8a[_0x602b('0x2e')][_0x602b('0x1b')]);}_0x5d9e80[_0x602b('0x34')]=qs[_0x602b('0x35')](_0xab6b8a[_0x602b('0x2e')][_0x602b('0x35')]);_0x5d9e80[_0x602b('0x36')]=qs[_0x602b('0x37')](_['pick'](_0xab6b8a[_0x602b('0x2e')],_0x4cec28['filters']),_0x1c1d29);if(_0xab6b8a[_0x602b('0x2e')][_0x602b('0x38')]){_0x5d9e80[_0x602b('0x36')]=_[_0x602b('0x39')](_0x5d9e80[_0x602b('0x36')],{'$or':_[_0x602b('0x27')](_0x1c1d29,function(_0x138fe1){if(_0x138fe1[_0x602b('0x2b')]!=='VIRTUAL'){var _0x12b8dd={};_0x12b8dd[_0x138fe1[_0x602b('0x25')]]={'$like':'%'+_0xab6b8a[_0x602b('0x2e')][_0x602b('0x38')]+'%'};return _0x12b8dd;}})});}_0x5d9e80=_[_0x602b('0x39')]({},_0x5d9e80,_0xab6b8a[_0x602b('0x3a')]);var _0x376392={'where':_0x5d9e80[_0x602b('0x36')]};return db[_0x602b('0x28')][_0x602b('0x1e')](_0x376392)[_0x602b('0x22')](function(_0x500962){_0x1fbcb7['count']=_0x500962;if(_0xab6b8a['query'][_0x602b('0x3b')]){_0x5d9e80[_0x602b('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x602b('0x3d')](_0x5d9e80);})['then'](function(_0x2a0a87){_0x1fbcb7['rows']=_0x2a0a87;return _0x1fbcb7;})[_0x602b('0x22')](respondWithFilteredResult(_0x3e3d3d,_0x5d9e80))[_0x602b('0x3e')](handleError(_0x3e3d3d,null));};exports[_0x602b('0x3f')]=function(_0xa1c8f9,_0xd7cf19){var _0x1347fd={'raw':!![],'where':{'id':_0xa1c8f9[_0x602b('0x40')]['id']}},_0x459ee7={};_0x459ee7[_0x602b('0x2d')]=_[_0x602b('0x2f')](db['JscriptyQuestionReport'][_0x602b('0x29')]);_0x459ee7['query']=_[_0x602b('0x2f')](_0xa1c8f9[_0x602b('0x2e')]);_0x459ee7[_0x602b('0x37')]=_[_0x602b('0x30')](_0x459ee7[_0x602b('0x2d')],_0x459ee7['query']);_0x1347fd[_0x602b('0x32')]=_[_0x602b('0x30')](_0x459ee7[_0x602b('0x2d')],qs['fields'](_0xa1c8f9[_0x602b('0x2e')][_0x602b('0x31')]));_0x1347fd[_0x602b('0x32')]=_0x1347fd[_0x602b('0x32')][_0x602b('0x41')]?_0x1347fd[_0x602b('0x32')]:_0x459ee7['model'];if(_0xa1c8f9[_0x602b('0x2e')]['includeAll']){_0x1347fd[_0x602b('0x3c')]=[{'all':!![]}];}_0x1347fd=_[_0x602b('0x39')]({},_0x1347fd,_0xa1c8f9['options']);return db[_0x602b('0x28')][_0x602b('0x42')](_0x1347fd)[_0x602b('0x22')](handleEntityNotFound(_0xd7cf19,null))[_0x602b('0x22')](respondWithResult(_0xd7cf19,null))[_0x602b('0x3e')](handleError(_0xd7cf19,null));};exports[_0x602b('0x43')]=function(_0x19d8f9,_0xb6fa47){return db[_0x602b('0x28')]['create'](_0x19d8f9[_0x602b('0x44')],{})[_0x602b('0x22')](respondWithResult(_0xb6fa47,0xc9))[_0x602b('0x3e')](handleError(_0xb6fa47,null));};exports['update']=function(_0x3d1f43,_0x161348){if(_0x3d1f43[_0x602b('0x44')]['id']){delete _0x3d1f43['body']['id'];}return db[_0x602b('0x28')][_0x602b('0x42')]({'where':{'id':_0x3d1f43[_0x602b('0x40')]['id']}})[_0x602b('0x22')](handleEntityNotFound(_0x161348,null))[_0x602b('0x22')](saveUpdates(_0x3d1f43['body'],null))[_0x602b('0x22')](respondWithResult(_0x161348,null))[_0x602b('0x3e')](handleError(_0x161348,null));};exports[_0x602b('0x23')]=function(_0x2bbf9e,_0x4ec2c1){return db[_0x602b('0x28')][_0x602b('0x42')]({'where':{'id':_0x2bbf9e[_0x602b('0x40')]['id']}})[_0x602b('0x22')](handleEntityNotFound(_0x4ec2c1,null))[_0x602b('0x22')](removeEntity(_0x4ec2c1,null))['catch'](handleError(_0x4ec2c1,null));};exports['describe']=function(_0x342db8,_0x3d2182){return db[_0x602b('0x28')]['describe']()[_0x602b('0x22')](respondWithResult(_0x3d2182,null))['catch'](handleError(_0x3d2182,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 874a1d6..906b5eb 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 _0xeaa4=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x502b0c,_0x3b6b38){var _0x32b28a=function(_0x5dcc97){while(--_0x5dcc97){_0x502b0c['push'](_0x502b0c['shift']());}};_0x32b28a(++_0x3b6b38);}(_0xeaa4,0x141));var _0x4eaa=function(_0x149390,_0x5ad9ab){_0x149390=_0x149390-0x0;var _0x4e3597=_0xeaa4[_0x149390];return _0x4e3597;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var logger=require(_0x4eaa('0x2'))(_0x4eaa('0x3'));var moment=require('moment');var BPromise=require(_0x4eaa('0x4'));var rp=require(_0x4eaa('0x5'));var fs=require('fs');var path=require(_0x4eaa('0x6'));var rimraf=require(_0x4eaa('0x7'));var config=require(_0x4eaa('0x8'));var attributes=require(_0x4eaa('0x9'));module['exports']=function(_0x557909,_0x36a16f){return _0x557909[_0x4eaa('0xa')](_0x4eaa('0xb'),attributes,{'tableName':_0x4eaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a5e=['JscriptyQuestionReport','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x8a5e,0x123));var _0xe8a5=function(_0xc26d9c,_0xbaaa95){_0xc26d9c=_0xc26d9c-0x0;var _0xacb62a=_0x8a5e[_0xc26d9c];return _0xacb62a;};'use strict';var _=require('lodash');var util=require(_0xe8a5('0x0'));var logger=require('../../config/logger')(_0xe8a5('0x1'));var moment=require('moment');var BPromise=require(_0xe8a5('0x2'));var rp=require(_0xe8a5('0x3'));var fs=require('fs');var path=require(_0xe8a5('0x4'));var rimraf=require(_0xe8a5('0x5'));var config=require(_0xe8a5('0x6'));var attributes=require(_0xe8a5('0x7'));module['exports']=function(_0x3e9716,_0x49ad56){return _0x3e9716[_0xe8a5('0x8')](_0xe8a5('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 33f498b..7b1ee4d 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 _0x87ae=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyQuestionReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x87ae,0x179));var _0xe87a=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x87ae[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xe87a('0x0'));var util=require(_0xe87a('0x1'));var moment=require('moment');var BPromise=require(_0xe87a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x3'));var db=require(_0xe87a('0x4'))['db'];var utils=require(_0xe87a('0x5'));var logger=require('../../config/logger')(_0xe87a('0x6'));var config=require(_0xe87a('0x7'));var jayson=require(_0xe87a('0x8'));var client=jayson[_0xe87a('0x9')][_0xe87a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0647,_0x5d8de8,_0x56edd0){return new BPromise(function(_0x2a82e0,_0x39b04e){return client[_0xe87a('0xb')](_0x5d0647,_0x56edd0)[_0xe87a('0xc')](function(_0x333300){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d8de8,_0xe87a('0xd'));logger[_0xe87a('0xe')](_0xe87a('0xf'),_0x5d8de8,_0xe87a('0xd'),JSON[_0xe87a('0x10')](_0x333300));if(_0x333300['error']){if(_0x333300['error']['code']===0x1f4){logger[_0xe87a('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5d8de8,_0x333300[_0xe87a('0x11')]['message']);return _0x39b04e(_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);}logger[_0xe87a('0x11')](_0xe87a('0x13'),_0x5d8de8,_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);return _0x2a82e0(_0x333300[_0xe87a('0x11')][_0xe87a('0x12')]);}else{logger[_0xe87a('0x14')](_0xe87a('0x13'),_0x5d8de8,_0xe87a('0xd'));_0x2a82e0(_0x333300[_0xe87a('0x15')][_0xe87a('0x12')]);}})[_0xe87a('0x16')](function(_0x55fd06){logger['error'](_0xe87a('0x13'),_0x5d8de8,_0x55fd06);_0x39b04e(_0x55fd06);});});} \ No newline at end of file +var _0x8894=['info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x50f288,_0xfecd76){var _0x2a0755=function(_0x48f555){while(--_0x48f555){_0x50f288['push'](_0x50f288['shift']());}};_0x2a0755(++_0xfecd76);}(_0x8894,0x1cd));var _0x4889=function(_0x2cc659,_0x3981c0){_0x2cc659=_0x2cc659-0x0;var _0x37c538=_0x8894[_0x2cc659];return _0x37c538;};'use strict';var _=require(_0x4889('0x0'));var util=require(_0x4889('0x1'));var moment=require('moment');var BPromise=require(_0x4889('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4889('0x3'));var db=require(_0x4889('0x4'))['db'];var utils=require(_0x4889('0x5'));var logger=require(_0x4889('0x6'))(_0x4889('0x7'));var config=require(_0x4889('0x8'));var jayson=require(_0x4889('0x9'));var client=jayson[_0x4889('0xa')][_0x4889('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49714b,_0xc2d0e2,_0x2a0869){return new BPromise(function(_0x4b1991,_0x42ac02){return client[_0x4889('0xc')](_0x49714b,_0x2a0869)[_0x4889('0xd')](function(_0x8b4ed6){logger['info'](_0x4889('0xe'),_0xc2d0e2,_0x4889('0xf'));logger[_0x4889('0x10')](_0x4889('0x11'),_0xc2d0e2,_0x4889('0xf'),JSON[_0x4889('0x12')](_0x8b4ed6));if(_0x8b4ed6[_0x4889('0x13')]){if(_0x8b4ed6[_0x4889('0x13')][_0x4889('0x14')]===0x1f4){logger[_0x4889('0x13')](_0x4889('0xe'),_0xc2d0e2,_0x8b4ed6[_0x4889('0x13')]['message']);return _0x42ac02(_0x8b4ed6['error'][_0x4889('0x15')]);}logger[_0x4889('0x13')](_0x4889('0xe'),_0xc2d0e2,_0x8b4ed6['error'][_0x4889('0x15')]);return _0x4b1991(_0x8b4ed6[_0x4889('0x13')]['message']);}else{logger[_0x4889('0x16')](_0x4889('0xe'),_0xc2d0e2,'request\x20sent');_0x4b1991(_0x8b4ed6['result']['message']);}})['catch'](function(_0x3dbf2a){logger['error'](_0x4889('0xe'),_0xc2d0e2,_0x3dbf2a);_0x42ac02(_0x3dbf2a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8ae47e9..1517167 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 _0x41c2=['get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x41c2,0x168));var _0x241c=function(_0x315f83,_0x4d1c97){_0x315f83=_0x315f83-0x0;var _0x32c01f=_0x41c2[_0x315f83];return _0x32c01f;};'use strict';var multer=require('multer');var util=require(_0x241c('0x0'));var path=require(_0x241c('0x1'));var timeout=require(_0x241c('0x2'));var express=require('express');var router=express[_0x241c('0x3')]();var fs_extra=require(_0x241c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x241c('0x5'));var config=require(_0x241c('0x6'));var controller=require(_0x241c('0x7'));router[_0x241c('0x8')]('/',auth[_0x241c('0x9')](),controller[_0x241c('0xa')]);router[_0x241c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x241c('0xb')]);router['get'](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0xd')]);router[_0x241c('0x8')](_0x241c('0xe'),auth[_0x241c('0x9')](),controller[_0x241c('0xf')]);router[_0x241c('0x10')]('/',auth[_0x241c('0x9')](),controller[_0x241c('0x11')]);router[_0x241c('0x12')](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0x13')]);router[_0x241c('0x14')](_0x241c('0xc'),auth[_0x241c('0x9')](),controller[_0x241c('0x15')]);module[_0x241c('0x16')]=router; \ No newline at end of file +var _0x3257=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','getQuestions','post','update','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x3257,0x86));var _0x7325=function(_0x1371aa,_0xcbff2){_0x1371aa=_0x1371aa-0x0;var _0x4e1bb3=_0x3257[_0x1371aa];return _0x4e1bb3;};'use strict';var multer=require(_0x7325('0x0'));var util=require(_0x7325('0x1'));var path=require(_0x7325('0x2'));var timeout=require(_0x7325('0x3'));var express=require('express');var router=express[_0x7325('0x4')]();var fs_extra=require(_0x7325('0x5'));var auth=require(_0x7325('0x6'));var interaction=require(_0x7325('0x7'));var config=require(_0x7325('0x8'));var controller=require(_0x7325('0x9'));router[_0x7325('0xa')]('/',auth[_0x7325('0xb')](),controller[_0x7325('0xc')]);router[_0x7325('0xa')]('/describe',auth[_0x7325('0xb')](),controller[_0x7325('0xd')]);router[_0x7325('0xa')](_0x7325('0xe'),auth[_0x7325('0xb')](),controller[_0x7325('0xf')]);router[_0x7325('0xa')]('/:id/questions',auth[_0x7325('0xb')](),controller[_0x7325('0x10')]);router[_0x7325('0x11')]('/',auth[_0x7325('0xb')](),controller['create']);router['put']('/:id',auth[_0x7325('0xb')](),controller[_0x7325('0x12')]);router['delete']('/:id',auth[_0x7325('0xb')](),controller[_0x7325('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4468320..6acdbbf 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 _0x4134=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0xe03f16,_0x1a210b){var _0x4d76b5=function(_0x47dec3){while(--_0x47dec3){_0xe03f16['push'](_0xe03f16['shift']());}};_0x4d76b5(++_0x1a210b);}(_0x4134,0x114));var _0x4413=function(_0x43f20a,_0x404ef4){_0x43f20a=_0x43f20a-0x0;var _0x416ea5=_0x4134[_0x43f20a];return _0x416ea5;};'use strict';var moment=require(_0x4413('0x0'));var Sequelize=require(_0x4413('0x1'));module[_0x4413('0x2')]={'starttime':{'type':Sequelize[_0x4413('0x3')],'set':function(_0x23f7a9){this[_0x4413('0x4')](_0x4413('0x5'),_0x23f7a9);this[_0x4413('0x4')](_0x4413('0x6'),moment()[_0x4413('0x7')](_0x4413('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x4413('0x9')]},'projectname':{'type':Sequelize[_0x4413('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4413('0x9')]},'calleridname':{'type':Sequelize[_0x4413('0x9')]},'calleridnum':{'type':Sequelize[_0x4413('0x9')]},'completed':{'type':Sequelize[_0x4413('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x8710=['sequelize','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment'];(function(_0xdd7ee2,_0x56dea8){var _0x36cf8a=function(_0x2bfe17){while(--_0x2bfe17){_0xdd7ee2['push'](_0xdd7ee2['shift']());}};_0x36cf8a(++_0x56dea8);}(_0x8710,0x68));var _0x0871=function(_0x4a351a,_0x5e0e09){_0x4a351a=_0x4a351a-0x0;var _0x21be4b=_0x8710[_0x4a351a];return _0x21be4b;};'use strict';var moment=require(_0x0871('0x0'));var Sequelize=require(_0x0871('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x0871('0x2')],'set':function(_0x23ce1f){this[_0x0871('0x3')]('starttime',_0x23ce1f);this[_0x0871('0x3')](_0x0871('0x4'),moment()['format'](_0x0871('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x0871('0x6')]},'projectname':{'type':Sequelize[_0x0871('0x6')]},'queue':{'type':Sequelize[_0x0871('0x6')]},'uniqueid':{'type':Sequelize[_0x0871('0x6')]},'calleridname':{'type':Sequelize[_0x0871('0x6')]},'calleridnum':{'type':Sequelize[_0x0871('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b84ac7d..dc8b534 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 _0x10e6=['nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','findOne','order','SessionId','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x10e6,0x1ac));var _0x610e=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x10e6[_0x2dc343];return _0x51eac5;};'use strict';var emlformat=require(_0x610e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x610e('0x1'));var jsonpatch=require(_0x610e('0x2'));var rp=require(_0x610e('0x3'));var moment=require(_0x610e('0x4'));var BPromise=require(_0x610e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x610e('0x6'));var sox=require(_0x610e('0x7'));var csv=require(_0x610e('0x8'));var ejs=require(_0x610e('0x9'));var fs=require('fs');var fs_extra=require(_0x610e('0xa'));var _=require('lodash');var squel=require(_0x610e('0xb'));var crypto=require(_0x610e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x610e('0xd'));var toCsv=require(_0x610e('0x8'));var querystring=require(_0x610e('0xe'));var Papa=require(_0x610e('0xf'));var Redis=require(_0x610e('0x10'));var authService=require(_0x610e('0x11'));var qs=require(_0x610e('0x12'));var as=require(_0x610e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x610e('0x14'))(_0x610e('0x15'));var utils=require('../../config/utils');var config=require(_0x610e('0x16'));var licenseUtil=require(_0x610e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fefa7,_0x2ee1c7){_0x2ee1c7=_0x2ee1c7||0xcc;return function(_0x170538){if(_0x170538){return _0x2fefa7[_0x610e('0x18')](_0x2ee1c7);}return _0x2fefa7[_0x610e('0x19')](_0x2ee1c7)[_0x610e('0x1a')]();};}function respondWithResult(_0xe13d0d,_0x9fe312){_0x9fe312=_0x9fe312||0xc8;return function(_0x3c6748){if(_0x3c6748){return _0xe13d0d[_0x610e('0x19')](_0x9fe312)[_0x610e('0x1b')](_0x3c6748);}};}function respondWithFilteredResult(_0x440704,_0x35fe24){return function(_0x20864d){if(_0x20864d){var _0x186bd1=typeof _0x35fe24[_0x610e('0x1c')]==='undefined'&&typeof _0x35fe24[_0x610e('0x1d')]===_0x610e('0x1e');var _0x58f6ac=_0x20864d[_0x610e('0x1f')];var _0x3618db=_0x186bd1?0x0:_0x35fe24[_0x610e('0x1c')];var _0x1f4dc1=_0x186bd1?_0x20864d['count']:_0x35fe24[_0x610e('0x1c')]+_0x35fe24[_0x610e('0x1d')];var _0x1dac8f;if(_0x1f4dc1>=_0x58f6ac){_0x1f4dc1=_0x58f6ac;_0x1dac8f=0xc8;}else{_0x1dac8f=0xce;}_0x440704[_0x610e('0x19')](_0x1dac8f);return _0x440704[_0x610e('0x20')](_0x610e('0x21'),_0x3618db+'-'+_0x1f4dc1+'/'+_0x58f6ac)[_0x610e('0x1b')](_0x20864d);}return null;};}function patchUpdates(_0x283520){return function(_0x1270d9){try{jsonpatch['apply'](_0x1270d9,_0x283520,!![]);}catch(_0x1dc79e){return BPromise[_0x610e('0x22')](_0x1dc79e);}return _0x1270d9['save']();};}function saveUpdates(_0x5c3565,_0x46194c){return function(_0x653350){if(_0x653350){return _0x653350[_0x610e('0x23')](_0x5c3565)['then'](function(_0x3c733c){return _0x3c733c;});}return null;};}function removeEntity(_0x3fc778,_0x54c39b){return function(_0x2df6b5){if(_0x2df6b5){return _0x2df6b5[_0x610e('0x24')]()[_0x610e('0x25')](function(){_0x3fc778[_0x610e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fe97,_0x296df8){return function(_0x59e60c){if(!_0x59e60c){_0x23fe97[_0x610e('0x18')](0x194);}return _0x59e60c;};}function handleError(_0x3aa37c,_0x94acdb){_0x94acdb=_0x94acdb||0x1f4;return function(_0x95632f){logger[_0x610e('0x26')](_0x95632f[_0x610e('0x27')]);if(_0x95632f[_0x610e('0x28')]){delete _0x95632f[_0x610e('0x28')];}_0x3aa37c[_0x610e('0x19')](_0x94acdb)[_0x610e('0x29')](_0x95632f);};}exports[_0x610e('0x2a')]=function(_0x16aafe,_0x2391b8){var _0x1baa18={},_0x5c0a0e={},_0x15ccbf={'count':0x0,'rows':[]};var _0x1413aa=_['map'](db[_0x610e('0x2b')][_0x610e('0x2c')],function(_0x5f44c2){return{'name':_0x5f44c2[_0x610e('0x2d')],'type':_0x5f44c2[_0x610e('0x2e')][_0x610e('0x2f')]};});_0x5c0a0e[_0x610e('0x30')]=_[_0x610e('0x31')](_0x1413aa,_0x610e('0x28'));_0x5c0a0e[_0x610e('0x32')]=_[_0x610e('0x33')](_0x16aafe[_0x610e('0x32')]);_0x5c0a0e[_0x610e('0x34')]=_['intersection'](_0x5c0a0e[_0x610e('0x30')],_0x5c0a0e[_0x610e('0x32')]);_0x1baa18[_0x610e('0x35')]=_[_0x610e('0x36')](_0x5c0a0e[_0x610e('0x30')],qs['fields'](_0x16aafe['query'][_0x610e('0x37')]));_0x1baa18['attributes']=_0x1baa18['attributes'][_0x610e('0x38')]?_0x1baa18[_0x610e('0x35')]:_0x5c0a0e[_0x610e('0x30')];if(!_0x16aafe[_0x610e('0x32')][_0x610e('0x39')](_0x610e('0x3a'))){_0x1baa18['limit']=qs[_0x610e('0x1d')](_0x16aafe['query']['limit']);_0x1baa18[_0x610e('0x1c')]=qs[_0x610e('0x1c')](_0x16aafe[_0x610e('0x32')][_0x610e('0x1c')]);}_0x1baa18['order']=qs[_0x610e('0x3b')](_0x16aafe[_0x610e('0x32')][_0x610e('0x3b')]);_0x1baa18[_0x610e('0x3c')]=qs['filters'](_[_0x610e('0x3d')](_0x16aafe[_0x610e('0x32')],_0x5c0a0e[_0x610e('0x34')]),_0x1413aa);if(_0x16aafe[_0x610e('0x32')][_0x610e('0x3e')]){_0x1baa18[_0x610e('0x3c')]=_[_0x610e('0x3f')](_0x1baa18[_0x610e('0x3c')],{'$or':_[_0x610e('0x31')](_0x1413aa,function(_0x354775){if(_0x354775['type']!=='VIRTUAL'){var _0x52a18e={};_0x52a18e[_0x354775[_0x610e('0x28')]]={'$like':'%'+_0x16aafe[_0x610e('0x32')][_0x610e('0x3e')]+'%'};return _0x52a18e;}})});}_0x1baa18=_[_0x610e('0x3f')]({},_0x1baa18,_0x16aafe[_0x610e('0x40')]);var _0x13138e={'where':_0x1baa18[_0x610e('0x3c')]};return db[_0x610e('0x2b')]['count'](_0x13138e)[_0x610e('0x25')](function(_0x1c0f75){_0x15ccbf[_0x610e('0x1f')]=_0x1c0f75;if(_0x16aafe[_0x610e('0x32')][_0x610e('0x41')]){_0x1baa18[_0x610e('0x42')]=[{'all':!![]}];}return db[_0x610e('0x2b')][_0x610e('0x43')](_0x1baa18);})[_0x610e('0x25')](function(_0x2a3db0){_0x15ccbf[_0x610e('0x44')]=_0x2a3db0;return _0x15ccbf;})['then'](respondWithFilteredResult(_0x2391b8,_0x1baa18))['catch'](handleError(_0x2391b8,null));};exports[_0x610e('0x45')]=function(_0x69aa3e,_0x5d58b1){var _0x5956d9={'raw':!![],'where':{'id':_0x69aa3e[_0x610e('0x46')]['id']}},_0x38d61c={};_0x38d61c[_0x610e('0x30')]=_['keys'](db[_0x610e('0x2b')][_0x610e('0x2c')]);_0x38d61c[_0x610e('0x32')]=_[_0x610e('0x33')](_0x69aa3e[_0x610e('0x32')]);_0x38d61c[_0x610e('0x34')]=_[_0x610e('0x36')](_0x38d61c['model'],_0x38d61c[_0x610e('0x32')]);_0x5956d9['attributes']=_[_0x610e('0x36')](_0x38d61c[_0x610e('0x30')],qs[_0x610e('0x37')](_0x69aa3e[_0x610e('0x32')][_0x610e('0x37')]));_0x5956d9[_0x610e('0x35')]=_0x5956d9[_0x610e('0x35')][_0x610e('0x38')]?_0x5956d9[_0x610e('0x35')]:_0x38d61c[_0x610e('0x30')];if(_0x69aa3e[_0x610e('0x32')][_0x610e('0x41')]){_0x5956d9[_0x610e('0x42')]=[{'all':!![]}];}_0x5956d9=_[_0x610e('0x3f')]({},_0x5956d9,_0x69aa3e[_0x610e('0x40')]);return db[_0x610e('0x2b')][_0x610e('0x47')](_0x5956d9)['then'](handleEntityNotFound(_0x5d58b1,null))['then'](respondWithResult(_0x5d58b1,null))[_0x610e('0x48')](handleError(_0x5d58b1,null));};exports[_0x610e('0x49')]=function(_0x247f08,_0x144ef1){return db[_0x610e('0x2b')][_0x610e('0x49')](_0x247f08[_0x610e('0x4a')],{})['then'](respondWithResult(_0x144ef1,0xc9))[_0x610e('0x48')](handleError(_0x144ef1,null));};exports['update']=function(_0xbbbd7c,_0x5ec41a){if(_0xbbbd7c[_0x610e('0x4a')]['id']){delete _0xbbbd7c[_0x610e('0x4a')]['id'];}return db[_0x610e('0x2b')][_0x610e('0x47')]({'where':{'id':_0xbbbd7c['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x5ec41a,null))[_0x610e('0x25')](saveUpdates(_0xbbbd7c[_0x610e('0x4a')],null))[_0x610e('0x25')](respondWithResult(_0x5ec41a,null))[_0x610e('0x48')](handleError(_0x5ec41a,null));};exports[_0x610e('0x24')]=function(_0x554215,_0x49343d){return db[_0x610e('0x2b')]['find']({'where':{'id':_0x554215['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x49343d,null))['then'](removeEntity(_0x49343d,null))[_0x610e('0x48')](handleError(_0x49343d,null));};exports[_0x610e('0x4b')]=function(_0x36e050,_0x4a0526){return db[_0x610e('0x2b')][_0x610e('0x4b')]()[_0x610e('0x25')](respondWithResult(_0x4a0526,null))[_0x610e('0x48')](handleError(_0x4a0526,null));};exports[_0x610e('0x4c')]=function(_0x11a657,_0x320b7d,_0x4083ae){var _0x340d03={'raw':!![],'where':{}};var _0xe5b21a={};var _0x59e7d8={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x610e('0x4d')]({'where':{'id':_0x11a657['params']['id']}})[_0x610e('0x25')](handleEntityNotFound(_0x320b7d,null))[_0x610e('0x25')](function(_0x4e732c){if(_0x4e732c){_0xe5b21a['model']=_[_0x610e('0x33')](db['JscriptyQuestionReport'][_0x610e('0x2c')]);_0xe5b21a[_0x610e('0x32')]=_['keys'](_0x11a657[_0x610e('0x32')]);_0xe5b21a[_0x610e('0x34')]=_[_0x610e('0x36')](_0xe5b21a['model'],_0xe5b21a[_0x610e('0x32')]);_0x340d03['attributes']=_['intersection'](_0xe5b21a[_0x610e('0x30')],qs[_0x610e('0x37')](_0x11a657['query']['fields']));_0x340d03['attributes']=_0x340d03[_0x610e('0x35')][_0x610e('0x38')]?_0x340d03[_0x610e('0x35')]:_0xe5b21a[_0x610e('0x30')];if(!_0x11a657['query'][_0x610e('0x39')](_0x610e('0x3a'))){_0x340d03[_0x610e('0x1d')]=qs[_0x610e('0x1d')](_0x11a657['query'][_0x610e('0x1d')]);_0x340d03[_0x610e('0x1c')]=qs['offset'](_0x11a657[_0x610e('0x32')][_0x610e('0x1c')]);}_0x340d03[_0x610e('0x4e')]=qs[_0x610e('0x3b')](_0x11a657[_0x610e('0x32')][_0x610e('0x3b')]);_0x340d03[_0x610e('0x3c')]=qs[_0x610e('0x34')](_['pick'](_0x11a657[_0x610e('0x32')],_0xe5b21a[_0x610e('0x34')]));_0x340d03[_0x610e('0x3c')][_0x610e('0x4f')]=_0x4e732c['id'];if(_0x11a657[_0x610e('0x32')][_0x610e('0x3e')]){_0x340d03[_0x610e('0x3c')]=_[_0x610e('0x3f')](_0x340d03[_0x610e('0x3c')],{'$or':_['map'](_0x340d03[_0x610e('0x35')],function(_0x41c737){var _0x36ec40={};_0x36ec40[_0x41c737]={'$like':'%'+_0x11a657['query'][_0x610e('0x3e')]+'%'};return _0x36ec40;})});}_0x340d03=_['merge']({},_0x340d03,_0x11a657[_0x610e('0x40')]);return db[_0x610e('0x50')][_0x610e('0x1f')]({'where':_0x340d03[_0x610e('0x3c')]})[_0x610e('0x25')](function(_0x106dae){_0x59e7d8[_0x610e('0x1f')]=_0x106dae;if(_0x11a657['query'][_0x610e('0x41')]){_0x340d03[_0x610e('0x42')]=[{'all':!![]}];}return db[_0x610e('0x50')]['findAll'](_0x340d03);})[_0x610e('0x25')](function(_0x54f772){_0x59e7d8[_0x610e('0x44')]=_0x54f772;return _0x59e7d8;});}})[_0x610e('0x25')](respondWithFilteredResult(_0x320b7d,_0x340d03))[_0x610e('0x48')](handleError(_0x320b7d,null));}; \ No newline at end of file +var _0xab02=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','describe','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x7e7267,_0x2641d1){var _0x5d4901=function(_0xb57ee4){while(--_0xb57ee4){_0x7e7267['push'](_0x7e7267['shift']());}};_0x5d4901(++_0x2641d1);}(_0xab02,0xd8));var _0x2ab0=function(_0x564e26,_0x164f53){_0x564e26=_0x564e26-0x0;var _0x1d0085=_0xab02[_0x564e26];return _0x1d0085;};'use strict';var emlformat=require(_0x2ab0('0x0'));var rimraf=require(_0x2ab0('0x1'));var zipdir=require(_0x2ab0('0x2'));var jsonpatch=require(_0x2ab0('0x3'));var rp=require('request-promise');var moment=require(_0x2ab0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2ab0('0x5'));var util=require(_0x2ab0('0x6'));var path=require(_0x2ab0('0x7'));var sox=require('sox');var csv=require(_0x2ab0('0x8'));var ejs=require(_0x2ab0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ab0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2ab0('0xb'));var deskjs=require(_0x2ab0('0xc'));var toCsv=require(_0x2ab0('0x8'));var querystring=require(_0x2ab0('0xd'));var Papa=require(_0x2ab0('0xe'));var Redis=require(_0x2ab0('0xf'));var authService=require(_0x2ab0('0x10'));var qs=require(_0x2ab0('0x11'));var as=require(_0x2ab0('0x12'));var hardwareService=require(_0x2ab0('0x13'));var logger=require(_0x2ab0('0x14'))('api');var utils=require(_0x2ab0('0x15'));var config=require(_0x2ab0('0x16'));var licenseUtil=require(_0x2ab0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21a903,_0x57ff3c){_0x57ff3c=_0x57ff3c||0xcc;return function(_0x25f666){if(_0x25f666){return _0x21a903[_0x2ab0('0x18')](_0x57ff3c);}return _0x21a903[_0x2ab0('0x19')](_0x57ff3c)[_0x2ab0('0x1a')]();};}function respondWithResult(_0x5e1b30,_0x3af1cc){_0x3af1cc=_0x3af1cc||0xc8;return function(_0x28d262){if(_0x28d262){return _0x5e1b30['status'](_0x3af1cc)['json'](_0x28d262);}};}function respondWithFilteredResult(_0x19ea1b,_0x43bc21){return function(_0x30e38a){if(_0x30e38a){var _0x155baf=typeof _0x43bc21[_0x2ab0('0x1b')]===_0x2ab0('0x1c')&&typeof _0x43bc21[_0x2ab0('0x1d')]===_0x2ab0('0x1c');var _0x42e2f9=_0x30e38a['count'];var _0x2c13b7=_0x155baf?0x0:_0x43bc21[_0x2ab0('0x1b')];var _0x2e773d=_0x155baf?_0x30e38a[_0x2ab0('0x1e')]:_0x43bc21[_0x2ab0('0x1b')]+_0x43bc21['limit'];var _0x535e01;if(_0x2e773d>=_0x42e2f9){_0x2e773d=_0x42e2f9;_0x535e01=0xc8;}else{_0x535e01=0xce;}_0x19ea1b[_0x2ab0('0x19')](_0x535e01);return _0x19ea1b[_0x2ab0('0x1f')](_0x2ab0('0x20'),_0x2c13b7+'-'+_0x2e773d+'/'+_0x42e2f9)[_0x2ab0('0x21')](_0x30e38a);}return null;};}function patchUpdates(_0x48a880){return function(_0x17a6ec){try{jsonpatch[_0x2ab0('0x22')](_0x17a6ec,_0x48a880,!![]);}catch(_0x4faaad){return BPromise[_0x2ab0('0x23')](_0x4faaad);}return _0x17a6ec['save']();};}function saveUpdates(_0x15f954,_0x160c70){return function(_0x158ecb){if(_0x158ecb){return _0x158ecb[_0x2ab0('0x24')](_0x15f954)[_0x2ab0('0x25')](function(_0x5082cf){return _0x5082cf;});}return null;};}function removeEntity(_0x5b88b0,_0x362847){return function(_0x5503bc){if(_0x5503bc){return _0x5503bc[_0x2ab0('0x26')]()[_0x2ab0('0x25')](function(){_0x5b88b0['status'](0xcc)[_0x2ab0('0x1a')]();});}};}function handleEntityNotFound(_0x2cc771,_0x45d7f0){return function(_0x7cd1d6){if(!_0x7cd1d6){_0x2cc771['sendStatus'](0x194);}return _0x7cd1d6;};}function handleError(_0xdb9767,_0x2162a3){_0x2162a3=_0x2162a3||0x1f4;return function(_0x8936d6){logger['error'](_0x8936d6[_0x2ab0('0x27')]);if(_0x8936d6[_0x2ab0('0x28')]){delete _0x8936d6[_0x2ab0('0x28')];}_0xdb9767[_0x2ab0('0x19')](_0x2162a3)[_0x2ab0('0x29')](_0x8936d6);};}exports[_0x2ab0('0x2a')]=function(_0x135758,_0x27ced0){var _0x72d509={},_0x134b69={},_0x14deb5={'count':0x0,'rows':[]};var _0x32ffb8=_[_0x2ab0('0x2b')](db[_0x2ab0('0x2c')][_0x2ab0('0x2d')],function(_0x40bd7c){return{'name':_0x40bd7c['fieldName'],'type':_0x40bd7c['type']['key']};});_0x134b69['model']=_[_0x2ab0('0x2b')](_0x32ffb8,'name');_0x134b69[_0x2ab0('0x2e')]=_['keys'](_0x135758['query']);_0x134b69['filters']=_['intersection'](_0x134b69['model'],_0x134b69[_0x2ab0('0x2e')]);_0x72d509[_0x2ab0('0x2f')]=_['intersection'](_0x134b69[_0x2ab0('0x30')],qs[_0x2ab0('0x31')](_0x135758[_0x2ab0('0x2e')][_0x2ab0('0x31')]));_0x72d509['attributes']=_0x72d509[_0x2ab0('0x2f')][_0x2ab0('0x32')]?_0x72d509[_0x2ab0('0x2f')]:_0x134b69[_0x2ab0('0x30')];if(!_0x135758['query'][_0x2ab0('0x33')](_0x2ab0('0x34'))){_0x72d509[_0x2ab0('0x1d')]=qs['limit'](_0x135758[_0x2ab0('0x2e')]['limit']);_0x72d509[_0x2ab0('0x1b')]=qs[_0x2ab0('0x1b')](_0x135758[_0x2ab0('0x2e')][_0x2ab0('0x1b')]);}_0x72d509[_0x2ab0('0x35')]=qs[_0x2ab0('0x36')](_0x135758[_0x2ab0('0x2e')]['sort']);_0x72d509[_0x2ab0('0x37')]=qs[_0x2ab0('0x38')](_[_0x2ab0('0x39')](_0x135758['query'],_0x134b69[_0x2ab0('0x38')]),_0x32ffb8);if(_0x135758['query']['filter']){_0x72d509[_0x2ab0('0x37')]=_[_0x2ab0('0x3a')](_0x72d509['where'],{'$or':_[_0x2ab0('0x2b')](_0x32ffb8,function(_0x386ce3){if(_0x386ce3[_0x2ab0('0x3b')]!==_0x2ab0('0x3c')){var _0x18785c={};_0x18785c[_0x386ce3[_0x2ab0('0x28')]]={'$like':'%'+_0x135758[_0x2ab0('0x2e')][_0x2ab0('0x3d')]+'%'};return _0x18785c;}})});}_0x72d509=_['merge']({},_0x72d509,_0x135758[_0x2ab0('0x3e')]);var _0x1f0e43={'where':_0x72d509[_0x2ab0('0x37')]};return db[_0x2ab0('0x2c')][_0x2ab0('0x1e')](_0x1f0e43)[_0x2ab0('0x25')](function(_0x3b5535){_0x14deb5[_0x2ab0('0x1e')]=_0x3b5535;if(_0x135758[_0x2ab0('0x2e')][_0x2ab0('0x3f')]){_0x72d509[_0x2ab0('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2ab0('0x41')](_0x72d509);})[_0x2ab0('0x25')](function(_0x3e2b10){_0x14deb5[_0x2ab0('0x42')]=_0x3e2b10;return _0x14deb5;})[_0x2ab0('0x25')](respondWithFilteredResult(_0x27ced0,_0x72d509))[_0x2ab0('0x43')](handleError(_0x27ced0,null));};exports[_0x2ab0('0x44')]=function(_0x37e9c3,_0x550fdd){var _0x52f607={'raw':!![],'where':{'id':_0x37e9c3[_0x2ab0('0x45')]['id']}},_0x538cfa={};_0x538cfa['model']=_[_0x2ab0('0x46')](db['JscriptySessionReport'][_0x2ab0('0x2d')]);_0x538cfa[_0x2ab0('0x2e')]=_['keys'](_0x37e9c3['query']);_0x538cfa['filters']=_[_0x2ab0('0x47')](_0x538cfa[_0x2ab0('0x30')],_0x538cfa['query']);_0x52f607[_0x2ab0('0x2f')]=_[_0x2ab0('0x47')](_0x538cfa[_0x2ab0('0x30')],qs[_0x2ab0('0x31')](_0x37e9c3[_0x2ab0('0x2e')][_0x2ab0('0x31')]));_0x52f607[_0x2ab0('0x2f')]=_0x52f607['attributes'][_0x2ab0('0x32')]?_0x52f607['attributes']:_0x538cfa[_0x2ab0('0x30')];if(_0x37e9c3[_0x2ab0('0x2e')][_0x2ab0('0x3f')]){_0x52f607[_0x2ab0('0x40')]=[{'all':!![]}];}_0x52f607=_[_0x2ab0('0x3a')]({},_0x52f607,_0x37e9c3[_0x2ab0('0x3e')]);return db['JscriptySessionReport'][_0x2ab0('0x48')](_0x52f607)['then'](handleEntityNotFound(_0x550fdd,null))[_0x2ab0('0x25')](respondWithResult(_0x550fdd,null))[_0x2ab0('0x43')](handleError(_0x550fdd,null));};exports[_0x2ab0('0x49')]=function(_0x949d17,_0x358b54){return db[_0x2ab0('0x2c')][_0x2ab0('0x49')](_0x949d17['body'],{})[_0x2ab0('0x25')](respondWithResult(_0x358b54,0xc9))['catch'](handleError(_0x358b54,null));};exports[_0x2ab0('0x24')]=function(_0x3900ef,_0x3abd5c){if(_0x3900ef[_0x2ab0('0x4a')]['id']){delete _0x3900ef[_0x2ab0('0x4a')]['id'];}return db[_0x2ab0('0x2c')][_0x2ab0('0x48')]({'where':{'id':_0x3900ef[_0x2ab0('0x45')]['id']}})[_0x2ab0('0x25')](handleEntityNotFound(_0x3abd5c,null))[_0x2ab0('0x25')](saveUpdates(_0x3900ef[_0x2ab0('0x4a')],null))[_0x2ab0('0x25')](respondWithResult(_0x3abd5c,null))['catch'](handleError(_0x3abd5c,null));};exports[_0x2ab0('0x26')]=function(_0x9ae136,_0x5d288e){return db[_0x2ab0('0x2c')][_0x2ab0('0x48')]({'where':{'id':_0x9ae136[_0x2ab0('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d288e,null))[_0x2ab0('0x25')](removeEntity(_0x5d288e,null))[_0x2ab0('0x43')](handleError(_0x5d288e,null));};exports[_0x2ab0('0x4b')]=function(_0x25f75d,_0x57bbb8){return db[_0x2ab0('0x2c')][_0x2ab0('0x4b')]()[_0x2ab0('0x25')](respondWithResult(_0x57bbb8,null))[_0x2ab0('0x43')](handleError(_0x57bbb8,null));};exports['getQuestions']=function(_0xd74512,_0x13763c,_0x49da65){var _0x11bab2={'raw':!![],'where':{}};var _0x2e0b63={};var _0x424768={'count':0x0,'rows':[]};return db[_0x2ab0('0x2c')][_0x2ab0('0x4c')]({'where':{'id':_0xd74512[_0x2ab0('0x45')]['id']}})[_0x2ab0('0x25')](handleEntityNotFound(_0x13763c,null))[_0x2ab0('0x25')](function(_0x2a175a){if(_0x2a175a){_0x2e0b63[_0x2ab0('0x30')]=_[_0x2ab0('0x46')](db['JscriptyQuestionReport']['rawAttributes']);_0x2e0b63[_0x2ab0('0x2e')]=_[_0x2ab0('0x46')](_0xd74512[_0x2ab0('0x2e')]);_0x2e0b63[_0x2ab0('0x38')]=_['intersection'](_0x2e0b63['model'],_0x2e0b63['query']);_0x11bab2[_0x2ab0('0x2f')]=_[_0x2ab0('0x47')](_0x2e0b63[_0x2ab0('0x30')],qs[_0x2ab0('0x31')](_0xd74512[_0x2ab0('0x2e')][_0x2ab0('0x31')]));_0x11bab2[_0x2ab0('0x2f')]=_0x11bab2[_0x2ab0('0x2f')][_0x2ab0('0x32')]?_0x11bab2[_0x2ab0('0x2f')]:_0x2e0b63[_0x2ab0('0x30')];if(!_0xd74512[_0x2ab0('0x2e')][_0x2ab0('0x33')](_0x2ab0('0x34'))){_0x11bab2['limit']=qs[_0x2ab0('0x1d')](_0xd74512['query']['limit']);_0x11bab2['offset']=qs[_0x2ab0('0x1b')](_0xd74512['query'][_0x2ab0('0x1b')]);}_0x11bab2[_0x2ab0('0x35')]=qs[_0x2ab0('0x36')](_0xd74512[_0x2ab0('0x2e')][_0x2ab0('0x36')]);_0x11bab2[_0x2ab0('0x37')]=qs['filters'](_[_0x2ab0('0x39')](_0xd74512[_0x2ab0('0x2e')],_0x2e0b63[_0x2ab0('0x38')]));_0x11bab2[_0x2ab0('0x37')][_0x2ab0('0x4d')]=_0x2a175a['id'];if(_0xd74512[_0x2ab0('0x2e')]['filter']){_0x11bab2[_0x2ab0('0x37')]=_[_0x2ab0('0x3a')](_0x11bab2[_0x2ab0('0x37')],{'$or':_[_0x2ab0('0x2b')](_0x11bab2[_0x2ab0('0x2f')],function(_0x2d9117){var _0x582099={};_0x582099[_0x2d9117]={'$like':'%'+_0xd74512[_0x2ab0('0x2e')][_0x2ab0('0x3d')]+'%'};return _0x582099;})});}_0x11bab2=_[_0x2ab0('0x3a')]({},_0x11bab2,_0xd74512[_0x2ab0('0x3e')]);return db['JscriptyQuestionReport'][_0x2ab0('0x1e')]({'where':_0x11bab2['where']})[_0x2ab0('0x25')](function(_0x47d247){_0x424768[_0x2ab0('0x1e')]=_0x47d247;if(_0xd74512[_0x2ab0('0x2e')]['includeAll']){_0x11bab2[_0x2ab0('0x40')]=[{'all':!![]}];}return db[_0x2ab0('0x4e')][_0x2ab0('0x41')](_0x11bab2);})['then'](function(_0x21c5c7){_0x424768[_0x2ab0('0x42')]=_0x21c5c7;return _0x424768;});}})['then'](respondWithFilteredResult(_0x13763c,_0x11bab2))[_0x2ab0('0x43')](handleError(_0x13763c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 13ad3f5..234acb3 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57ebed,_0xfac0ac){_0x57ebed=_0x57ebed-0x0;var _0x3a0874=_0x7fbe[_0x57ebed];return _0x3a0874;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1f65f0,_0x43188a){var _0x1e8e90=function(_0x2ad886){while(--_0x2ad886){_0x1f65f0['push'](_0x1f65f0['shift']());}};_0x1e8e90(++_0x43188a);}(_0x31f0,0xb7));var _0x031f=function(_0xccc3e9,_0x26b34c){_0xccc3e9=_0xccc3e9-0x0;var _0x3686c0=_0x31f0[_0xccc3e9];return _0x3686c0;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('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 01591de..5667c5f 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x342316,_0x123396){var _0x158810=function(_0x137024){while(--_0x137024){_0x342316['push'](_0x342316['shift']());}};_0x158810(++_0x123396);}(_0x57ca,0x108));var _0xa57c=function(_0x1c9971,_0x43afc7){_0x1c9971=_0x1c9971-0x0;var _0x2b5f45=_0x57ca[_0x1c9971];return _0x2b5f45;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x4bd3=['request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x12e824,_0xaa5a23){var _0x2b0cd3=function(_0xb4ba57){while(--_0xb4ba57){_0x12e824['push'](_0x12e824['shift']());}};_0x2b0cd3(++_0xaa5a23);}(_0x4bd3,0x174));var _0x34bd=function(_0x279795,_0x2c5202){_0x279795=_0x279795-0x0;var _0x552786=_0x4bd3[_0x279795];return _0x552786;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('JscriptySessionReport,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 712ed9d..402b162 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 _0xe6c3=['put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x352033,_0x359469){var _0x207f41=function(_0x382bf2){while(--_0x382bf2){_0x352033['push'](_0x352033['shift']());}};_0x207f41(++_0x359469);}(_0xe6c3,0x111));var _0x3e6c=function(_0xc40651,_0x3b4bff){_0xc40651=_0xc40651-0x0;var _0x3676e7=_0xe6c3[_0xc40651];return _0x3676e7;};'use strict';var multer=require('multer');var util=require(_0x3e6c('0x0'));var path=require(_0x3e6c('0x1'));var timeout=require(_0x3e6c('0x2'));var express=require(_0x3e6c('0x3'));var router=express[_0x3e6c('0x4')]();var fs_extra=require(_0x3e6c('0x5'));var auth=require(_0x3e6c('0x6'));var interaction=require(_0x3e6c('0x7'));var config=require(_0x3e6c('0x8'));var controller=require(_0x3e6c('0x9'));router[_0x3e6c('0xa')]('/',controller[_0x3e6c('0xb')]);router[_0x3e6c('0xc')](_0x3e6c('0xd'),auth[_0x3e6c('0xe')](),controller[_0x3e6c('0xf')]);router['get'](_0x3e6c('0x10'),auth[_0x3e6c('0xe')](),controller[_0x3e6c('0x11')]);module[_0x3e6c('0x12')]=router; \ No newline at end of file +var _0x747d=['update','/download_log_file','downloadLogFile','multer','path','express','Router','fs-extra','../../components/auth/service','./license.controller','isAuthenticated'];(function(_0x270d6c,_0x46df10){var _0x4bdd4c=function(_0x45648e){while(--_0x45648e){_0x270d6c['push'](_0x270d6c['shift']());}};_0x4bdd4c(++_0x46df10);}(_0x747d,0x137));var _0xd747=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x747d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd747('0x0'));var util=require('util');var path=require(_0xd747('0x1'));var timeout=require('connect-timeout');var express=require(_0xd747('0x2'));var router=express[_0xd747('0x3')]();var fs_extra=require(_0xd747('0x4'));var auth=require(_0xd747('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd747('0x6'));router['get']('/',controller['index']);router['put']('/:id',auth[_0xd747('0x7')](),controller[_0xd747('0x8')]);router['get'](_0xd747('0x9'),auth[_0xd747('0x7')](),controller[_0xd747('0xa')]);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 d53d6cf..7ae6cc8 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 _0xd97f=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x3743bc,_0x3eba72){var _0x46f693=function(_0x4eeccd){while(--_0x4eeccd){_0x3743bc['push'](_0x3743bc['shift']());}};_0x46f693(++_0x3eba72);}(_0xd97f,0xcb));var _0xfd97=function(_0x38e05f,_0x5b89a5){_0x38e05f=_0x38e05f-0x0;var _0x93c991=_0xd97f[_0x38e05f];return _0x93c991;};'use strict';var Sequelize=require(_0xfd97('0x0'));module[_0xfd97('0x1')]={'license':{'type':Sequelize[_0xfd97('0x2')]},'data1':{'type':Sequelize[_0xfd97('0x3')]},'data2':{'type':Sequelize[_0xfd97('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xfd97('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe01f=['STRING','INTEGER','sequelize','TEXT'];(function(_0x118f36,_0x2f0f06){var _0x47770b=function(_0x4ded57){while(--_0x4ded57){_0x118f36['push'](_0x118f36['shift']());}};_0x47770b(++_0x2f0f06);}(_0xe01f,0x112));var _0xfe01=function(_0x200ba8,_0xc9a8e8){_0x200ba8=_0x200ba8-0x0;var _0x2a3337=_0xe01f[_0x200ba8];return _0x2a3337;};'use strict';var Sequelize=require(_0xfe01('0x0'));module['exports']={'license':{'type':Sequelize[_0xfe01('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfe01('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xfe01('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ba00c4d..be7265f 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 _0xcefc=['send','index','model','keys','query','filters','attributes','intersection','fields','length','merge','catch','body','License','find','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','set','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name'];(function(_0x454a0e,_0x290451){var _0x254ad4=function(_0x4acf8b){while(--_0x4acf8b){_0x454a0e['push'](_0x454a0e['shift']());}};_0x254ad4(++_0x290451);}(_0xcefc,0x175));var _0xccef=function(_0x5560d5,_0x20c33){_0x5560d5=_0x5560d5-0x0;var _0x331267=_0xcefc[_0x5560d5];return _0x331267;};'use strict';var emlformat=require(_0xccef('0x0'));var rimraf=require(_0xccef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccef('0x2'));var rp=require(_0xccef('0x3'));var moment=require(_0xccef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccef('0x5'));var util=require(_0xccef('0x6'));var path=require(_0xccef('0x7'));var sox=require(_0xccef('0x8'));var csv=require(_0xccef('0x9'));var ejs=require(_0xccef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xccef('0xb'));var jsforce=require(_0xccef('0xc'));var deskjs=require(_0xccef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xccef('0xe'));var Papa=require('papaparse');var Redis=require(_0xccef('0xf'));var authService=require(_0xccef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xccef('0x11'));var hardwareService=require(_0xccef('0x12'));var logger=require(_0xccef('0x13'))(_0xccef('0x14'));var utils=require(_0xccef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xccef('0x16'));var db=require(_0xccef('0x17'))['db'];function respondWithStatusCode(_0x2b877d,_0x2e8243){_0x2e8243=_0x2e8243||0xcc;return function(_0x3a5bc5){if(_0x3a5bc5){return _0x2b877d[_0xccef('0x18')](_0x2e8243);}return _0x2b877d[_0xccef('0x19')](_0x2e8243)['end']();};}function respondWithResult(_0x16978d,_0x3c52e8){_0x3c52e8=_0x3c52e8||0xc8;return function(_0x4f4771){if(_0x4f4771){return _0x16978d[_0xccef('0x19')](_0x3c52e8)[_0xccef('0x1a')](_0x4f4771);}};}function respondWithFilteredResult(_0x2aa3fc,_0x8dba85){return function(_0x235c3e){if(_0x235c3e){var _0x25c520=typeof _0x8dba85[_0xccef('0x1b')]===_0xccef('0x1c')&&typeof _0x8dba85[_0xccef('0x1d')]===_0xccef('0x1c');var _0x4c2341=_0x235c3e[_0xccef('0x1e')];var _0x495649=_0x25c520?0x0:_0x8dba85[_0xccef('0x1b')];var _0x32c96e=_0x25c520?_0x235c3e[_0xccef('0x1e')]:_0x8dba85[_0xccef('0x1b')]+_0x8dba85[_0xccef('0x1d')];var _0xfa6ba2;if(_0x32c96e>=_0x4c2341){_0x32c96e=_0x4c2341;_0xfa6ba2=0xc8;}else{_0xfa6ba2=0xce;}_0x2aa3fc['status'](_0xfa6ba2);return _0x2aa3fc['set'](_0xccef('0x1f'),_0x495649+'-'+_0x32c96e+'/'+_0x4c2341)[_0xccef('0x1a')](_0x235c3e);}return null;};}function patchUpdates(_0x147bab){return function(_0x8fe0a){try{jsonpatch[_0xccef('0x20')](_0x8fe0a,_0x147bab,!![]);}catch(_0x55a9a1){return BPromise[_0xccef('0x21')](_0x55a9a1);}return _0x8fe0a[_0xccef('0x22')]();};}function saveUpdates(_0x1fda42,_0x3b820e){return function(_0x41b9c4){if(_0x41b9c4){return _0x41b9c4[_0xccef('0x23')](_0x1fda42)[_0xccef('0x24')](function(_0x312025){return _0x312025;});}return null;};}function removeEntity(_0x17815b,_0x1af135){return function(_0x46a059){if(_0x46a059){return _0x46a059['destroy']()[_0xccef('0x24')](function(){_0x17815b['status'](0xcc)[_0xccef('0x25')]();});}};}function handleEntityNotFound(_0x1f827d,_0x4cf2df){return function(_0x16eebd){if(!_0x16eebd){_0x1f827d['sendStatus'](0x194);}return _0x16eebd;};}function handleError(_0x32e46c,_0x5b90ce){_0x5b90ce=_0x5b90ce||0x1f4;return function(_0x48adac){logger[_0xccef('0x26')](_0x48adac[_0xccef('0x27')]);if(_0x48adac[_0xccef('0x28')]){delete _0x48adac[_0xccef('0x28')];}_0x32e46c[_0xccef('0x19')](_0x5b90ce)[_0xccef('0x29')](_0x48adac);};}var utilLicense=require(_0xccef('0x16'));exports[_0xccef('0x2a')]=function(_0x378cdd,_0x352e44){var _0x185b39={'raw':!![],'where':{'id':0x1}},_0x46522c={};_0x46522c[_0xccef('0x2b')]=_[_0xccef('0x2c')](db['License']['rawAttributes']);_0x46522c[_0xccef('0x2d')]=_[_0xccef('0x2c')](_0x378cdd['query']);_0x46522c[_0xccef('0x2e')]=_['intersection'](_0x46522c[_0xccef('0x2b')],_0x46522c[_0xccef('0x2d')]);_0x185b39[_0xccef('0x2f')]=_[_0xccef('0x30')](_0x46522c[_0xccef('0x2b')],qs[_0xccef('0x31')](_0x378cdd[_0xccef('0x2d')][_0xccef('0x31')]));_0x185b39[_0xccef('0x2f')]=_0x185b39[_0xccef('0x2f')][_0xccef('0x32')]?_0x185b39[_0xccef('0x2f')]:_0x46522c['model'];_0x185b39=_[_0xccef('0x33')]({},_0x185b39,_0x378cdd['options']);return utilLicense['getLicense'](_0x185b39)[_0xccef('0x24')](respondWithResult(_0x352e44,null))[_0xccef('0x34')](handleError(_0x352e44,null));};exports[_0xccef('0x23')]=function(_0x27bd0e,_0x5f569d){if(_0x27bd0e[_0xccef('0x35')]['id']){delete _0x27bd0e['body']['id'];}return db[_0xccef('0x36')][_0xccef('0x37')]({'where':{'id':_0x27bd0e['params']['id']}})[_0xccef('0x24')](handleEntityNotFound(_0x5f569d,null))[_0xccef('0x24')](function(_0x824c5f){var _0x191647=_0x824c5f[_0xccef('0x38')]({'plain':!![]});return utilLicense[_0xccef('0x39')](_0x191647,_0x27bd0e[_0xccef('0x35')]['key']);})[_0xccef('0x24')](function(_0x19d086){if(!_0x19d086[_0xccef('0x3a')]){return saveUpdates(_0x27bd0e[_0xccef('0x35')],null);}return _0x19d086;})['then'](respondWithResult(_0x5f569d,null))['catch'](handleError(_0x5f569d,null));};exports[_0xccef('0x3b')]=function(_0x2e40a5,_0x26e856){var _0x4b1ca2=_0xccef('0x3c');var _0x4d35ea=path[_0xccef('0x3d')](_0xccef('0x3e'),'log',_0xccef('0x3f'),_0x4b1ca2);_0x26e856[_0xccef('0x40')](_0xccef('0x41'),'attachment;\x20filename='+_0x4b1ca2);_0x26e856[_0xccef('0x42')]('Content-Type',_0xccef('0x43'));_0x26e856[_0xccef('0x44')](_0x4d35ea);}; \ No newline at end of file +var _0xddbc=['getLicense','body','find','params','then','get','checkLicense','key','catch','license-info.log','join','log','xcally','attachment;\x20filename=','set','Content-Type','text/plain','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge'];(function(_0x5c010f,_0x10aadf){var _0x14293e=function(_0x4208d0){while(--_0x4208d0){_0x5c010f['push'](_0x5c010f['shift']());}};_0x14293e(++_0x10aadf);}(_0xddbc,0x97));var _0xcddb=function(_0x3d109b,_0x5e1b5d){_0x3d109b=_0x3d109b-0x0;var _0x5794a1=_0xddbc[_0x3d109b];return _0x5794a1;};'use strict';var emlformat=require(_0xcddb('0x0'));var rimraf=require(_0xcddb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcddb('0x2'));var rp=require(_0xcddb('0x3'));var moment=require('moment');var BPromise=require(_0xcddb('0x4'));var Mustache=require(_0xcddb('0x5'));var util=require(_0xcddb('0x6'));var path=require(_0xcddb('0x7'));var sox=require(_0xcddb('0x8'));var csv=require('to-csv');var ejs=require(_0xcddb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcddb('0xa'));var squel=require('squel');var crypto=require(_0xcddb('0xb'));var jsforce=require(_0xcddb('0xc'));var deskjs=require(_0xcddb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcddb('0xe'));var Papa=require(_0xcddb('0xf'));var Redis=require(_0xcddb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcddb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcddb('0x12'));var logger=require(_0xcddb('0x13'))(_0xcddb('0x14'));var utils=require('../../config/utils');var config=require(_0xcddb('0x15'));var licenseUtil=require(_0xcddb('0x16'));var db=require(_0xcddb('0x17'))['db'];function respondWithStatusCode(_0x18cd87,_0x2d2f2c){_0x2d2f2c=_0x2d2f2c||0xcc;return function(_0x71144b){if(_0x71144b){return _0x18cd87[_0xcddb('0x18')](_0x2d2f2c);}return _0x18cd87['status'](_0x2d2f2c)['end']();};}function respondWithResult(_0x2086c6,_0x3d83a7){_0x3d83a7=_0x3d83a7||0xc8;return function(_0x26b02a){if(_0x26b02a){return _0x2086c6[_0xcddb('0x19')](_0x3d83a7)[_0xcddb('0x1a')](_0x26b02a);}};}function respondWithFilteredResult(_0x52abc7,_0x2dbfb0){return function(_0x25e399){if(_0x25e399){var _0x37a103=typeof _0x2dbfb0[_0xcddb('0x1b')]===_0xcddb('0x1c')&&typeof _0x2dbfb0[_0xcddb('0x1d')]==='undefined';var _0x1cd8d4=_0x25e399[_0xcddb('0x1e')];var _0x775645=_0x37a103?0x0:_0x2dbfb0[_0xcddb('0x1b')];var _0x2e1694=_0x37a103?_0x25e399[_0xcddb('0x1e')]:_0x2dbfb0[_0xcddb('0x1b')]+_0x2dbfb0[_0xcddb('0x1d')];var _0x43b0fd;if(_0x2e1694>=_0x1cd8d4){_0x2e1694=_0x1cd8d4;_0x43b0fd=0xc8;}else{_0x43b0fd=0xce;}_0x52abc7[_0xcddb('0x19')](_0x43b0fd);return _0x52abc7['set'](_0xcddb('0x1f'),_0x775645+'-'+_0x2e1694+'/'+_0x1cd8d4)[_0xcddb('0x1a')](_0x25e399);}return null;};}function patchUpdates(_0x48e0cf){return function(_0x12ae96){try{jsonpatch['apply'](_0x12ae96,_0x48e0cf,!![]);}catch(_0x81f588){return BPromise[_0xcddb('0x20')](_0x81f588);}return _0x12ae96[_0xcddb('0x21')]();};}function saveUpdates(_0x27371,_0x48ed77){return function(_0xe281b5){if(_0xe281b5){return _0xe281b5[_0xcddb('0x22')](_0x27371)['then'](function(_0x25cddf){return _0x25cddf;});}return null;};}function removeEntity(_0x5afb23,_0x381819){return function(_0xad8d61){if(_0xad8d61){return _0xad8d61[_0xcddb('0x23')]()['then'](function(){_0x5afb23['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c19a6,_0x5912da){return function(_0x3fac7e){if(!_0x3fac7e){_0x2c19a6[_0xcddb('0x18')](0x194);}return _0x3fac7e;};}function handleError(_0x1e16d5,_0x533ecf){_0x533ecf=_0x533ecf||0x1f4;return function(_0x57a3b6){logger['error'](_0x57a3b6[_0xcddb('0x24')]);if(_0x57a3b6[_0xcddb('0x25')]){delete _0x57a3b6[_0xcddb('0x25')];}_0x1e16d5[_0xcddb('0x19')](_0x533ecf)[_0xcddb('0x26')](_0x57a3b6);};}var utilLicense=require('../../config/license/util');exports[_0xcddb('0x27')]=function(_0x44da8c,_0x2106d4){var _0x2028e1={'raw':!![],'where':{'id':0x1}},_0x3c4a3a={};_0x3c4a3a[_0xcddb('0x28')]=_[_0xcddb('0x29')](db[_0xcddb('0x2a')]['rawAttributes']);_0x3c4a3a[_0xcddb('0x2b')]=_[_0xcddb('0x29')](_0x44da8c[_0xcddb('0x2b')]);_0x3c4a3a[_0xcddb('0x2c')]=_[_0xcddb('0x2d')](_0x3c4a3a[_0xcddb('0x28')],_0x3c4a3a[_0xcddb('0x2b')]);_0x2028e1[_0xcddb('0x2e')]=_['intersection'](_0x3c4a3a[_0xcddb('0x28')],qs[_0xcddb('0x2f')](_0x44da8c[_0xcddb('0x2b')]['fields']));_0x2028e1[_0xcddb('0x2e')]=_0x2028e1[_0xcddb('0x2e')][_0xcddb('0x30')]?_0x2028e1[_0xcddb('0x2e')]:_0x3c4a3a[_0xcddb('0x28')];_0x2028e1=_[_0xcddb('0x31')]({},_0x2028e1,_0x44da8c['options']);return utilLicense[_0xcddb('0x32')](_0x2028e1)['then'](respondWithResult(_0x2106d4,null))['catch'](handleError(_0x2106d4,null));};exports[_0xcddb('0x22')]=function(_0x2c17fa,_0xc0bff2){if(_0x2c17fa[_0xcddb('0x33')]['id']){delete _0x2c17fa[_0xcddb('0x33')]['id'];}return db[_0xcddb('0x2a')][_0xcddb('0x34')]({'where':{'id':_0x2c17fa[_0xcddb('0x35')]['id']}})[_0xcddb('0x36')](handleEntityNotFound(_0xc0bff2,null))[_0xcddb('0x36')](function(_0x252981){var _0x128b66=_0x252981[_0xcddb('0x37')]({'plain':!![]});return utilLicense[_0xcddb('0x38')](_0x128b66,_0x2c17fa[_0xcddb('0x33')][_0xcddb('0x39')]);})[_0xcddb('0x36')](function(_0x69f72f){if(!_0x69f72f['demo']){return saveUpdates(_0x2c17fa[_0xcddb('0x33')],null);}return _0x69f72f;})['then'](respondWithResult(_0xc0bff2,null))[_0xcddb('0x3a')](handleError(_0xc0bff2,null));};exports['downloadLogFile']=function(_0x3d5d65,_0x2979f3){var _0x3a77e8=_0xcddb('0x3b');var _0x5112cc=path[_0xcddb('0x3c')]('/var',_0xcddb('0x3d'),_0xcddb('0x3e'),_0x3a77e8);_0x2979f3['setHeader']('Content-disposition',_0xcddb('0x3f')+_0x3a77e8);_0x2979f3[_0xcddb('0x40')](_0xcddb('0x41'),_0xcddb('0x42'));_0x2979f3['download'](_0x5112cc);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 21b7273..9a62e85 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 _0x6272=['../../config/logger','path','rimraf','../../config/environment','exports'];(function(_0x3b1c59,_0x2d9785){var _0xe66420=function(_0x27d584){while(--_0x27d584){_0x3b1c59['push'](_0x3b1c59['shift']());}};_0xe66420(++_0x2d9785);}(_0x6272,0x78));var _0x2627=function(_0x1f84c8,_0x41efcf){_0x1f84c8=_0x1f84c8-0x0;var _0x5f483f=_0x6272[_0x1f84c8];return _0x5f483f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2627('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2627('0x1'));var rimraf=require(_0x2627('0x2'));var config=require(_0x2627('0x3'));var attributes=require('./license.attributes');module[_0x2627('0x4')]=function(_0x55cd60,_0x5e3b9d){return _0x55cd60['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f18=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','define','License','license'];(function(_0x1bcb05,_0x271f4b){var _0x569680=function(_0x418eb0){while(--_0x418eb0){_0x1bcb05['push'](_0x1bcb05['shift']());}};_0x569680(++_0x271f4b);}(_0x8f18,0x108));var _0x88f1=function(_0x5c816b,_0x5457db){_0x5c816b=_0x5c816b-0x0;var _0x5b1151=_0x8f18[_0x5c816b];return _0x5b1151;};'use strict';var _=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88f1('0x4'));var rimraf=require(_0x88f1('0x5'));var config=require(_0x88f1('0x6'));var attributes=require(_0x88f1('0x7'));module['exports']=function(_0x1d42fe,_0x4fc7df){return _0x1d42fe[_0x88f1('0x8')](_0x88f1('0x9'),attributes,{'tableName':_0x88f1('0xa'),'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 5dc3198..fb6739c 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 _0xd646=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd646,0x18f));var _0x6d64=function(_0x25f372,_0x18327c){_0x25f372=_0x25f372-0x0;var _0x1069b7=_0xd646[_0x25f372];return _0x1069b7;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require(_0x6d64('0x3'));var rs=require(_0x6d64('0x4'));var fs=require('fs');var Redis=require(_0x6d64('0x5'));var db=require(_0x6d64('0x6'))['db'];var utils=require(_0x6d64('0x7'));var logger=require(_0x6d64('0x8'))(_0x6d64('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d64('0xa'));var client=jayson['client'][_0x6d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e5250,_0x22869c,_0x3386df){return new BPromise(function(_0x42074c,_0x5e02f4){return client['request'](_0x3e5250,_0x3386df)[_0x6d64('0xc')](function(_0x2df998){logger[_0x6d64('0xd')](_0x6d64('0xe'),_0x22869c,_0x6d64('0xf'));logger['debug'](_0x6d64('0x10'),_0x22869c,_0x6d64('0xf'),JSON['stringify'](_0x2df998));if(_0x2df998[_0x6d64('0x11')]){if(_0x2df998[_0x6d64('0x11')][_0x6d64('0x12')]===0x1f4){logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2df998[_0x6d64('0x11')][_0x6d64('0x13')]);return _0x5e02f4(_0x2df998['error'][_0x6d64('0x13')]);}logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2df998['error'][_0x6d64('0x13')]);return _0x42074c(_0x2df998[_0x6d64('0x11')][_0x6d64('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x22869c,'request\x20sent');_0x42074c(_0x2df998[_0x6d64('0x14')][_0x6d64('0x13')]);}})['catch'](function(_0x2e1f96){logger[_0x6d64('0x11')](_0x6d64('0xe'),_0x22869c,_0x2e1f96);_0x5e02f4(_0x2e1f96);});});} \ No newline at end of file +var _0xf86d=['http','request','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5be851,_0x1f9d87){var _0x545134=function(_0x5e0fd6){while(--_0x5e0fd6){_0x5be851['push'](_0x5be851['shift']());}};_0x545134(++_0x1f9d87);}(_0xf86d,0x6e));var _0xdf86=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xf86d[_0x5951e8];return _0x20a1f5;};'use strict';var _=require('lodash');var util=require(_0xdf86('0x0'));var moment=require(_0xdf86('0x1'));var BPromise=require(_0xdf86('0x2'));var rs=require(_0xdf86('0x3'));var fs=require('fs');var Redis=require(_0xdf86('0x4'));var db=require(_0xdf86('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf86('0x6'))(_0xdf86('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf86('0x8'));var client=jayson[_0xdf86('0x9')][_0xdf86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dfd63,_0x55ee51,_0x5800eb){return new BPromise(function(_0x299c5c,_0x40d189){return client[_0xdf86('0xb')](_0x4dfd63,_0x5800eb)['then'](function(_0x19fe53){logger[_0xdf86('0xc')](_0xdf86('0xd'),_0x55ee51,'request\x20sent');logger[_0xdf86('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x55ee51,_0xdf86('0xf'),JSON[_0xdf86('0x10')](_0x19fe53));if(_0x19fe53[_0xdf86('0x11')]){if(_0x19fe53['error']['code']===0x1f4){logger['error'](_0xdf86('0xd'),_0x55ee51,_0x19fe53[_0xdf86('0x11')][_0xdf86('0x12')]);return _0x40d189(_0x19fe53[_0xdf86('0x11')]['message']);}logger[_0xdf86('0x11')]('License,\x20%s,\x20%s',_0x55ee51,_0x19fe53[_0xdf86('0x11')][_0xdf86('0x12')]);return _0x299c5c(_0x19fe53['error'][_0xdf86('0x12')]);}else{logger[_0xdf86('0xc')](_0xdf86('0xd'),_0x55ee51,_0xdf86('0xf'));_0x299c5c(_0x19fe53[_0xdf86('0x13')][_0xdf86('0x12')]);}})['catch'](function(_0x18f0c8){logger[_0xdf86('0x11')]('License,\x20%s,\x20%s',_0x55ee51,_0x18f0c8);_0x40d189(_0x18f0c8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 88edebd..323ad98 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 _0x4d5c=['put','/:id','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','/:id/dispositions','addDisposition','addAnswer','post','addImap','addInteraction','/:id/send','send','/:id/users','addAgents'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x4d5c,0x8c));var _0xc4d5=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x4d5c[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0xc4d5('0x0'));var util=require(_0xc4d5('0x1'));var path=require('path');var timeout=require(_0xc4d5('0x2'));var express=require('express');var router=express[_0xc4d5('0x3')]();var fs_extra=require(_0xc4d5('0x4'));var auth=require(_0xc4d5('0x5'));var interaction=require(_0xc4d5('0x6'));var config=require(_0xc4d5('0x7'));var controller=require('./mailAccount.controller');router[_0xc4d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4d5('0x9')]);router[_0xc4d5('0x8')](_0xc4d5('0xa'),auth[_0xc4d5('0xb')](),controller['describe']);router[_0xc4d5('0x8')]('/:id',auth[_0xc4d5('0xb')](),controller['show']);router[_0xc4d5('0x8')]('/:id/dispositions',auth[_0xc4d5('0xb')](),controller[_0xc4d5('0xc')]);router[_0xc4d5('0x8')](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0xe')]);router[_0xc4d5('0x8')](_0xc4d5('0xf'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x10')]);router['get'](_0xc4d5('0x11'),auth[_0xc4d5('0xb')](),controller['getSmtp']);router[_0xc4d5('0x8')](_0xc4d5('0x12'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x13')]);router[_0xc4d5('0x8')](_0xc4d5('0x14'),auth['isAuthenticated'](),controller[_0xc4d5('0x15')]);router[_0xc4d5('0x8')](_0xc4d5('0x16'),auth['isAuthenticated'](),controller[_0xc4d5('0x17')]);router[_0xc4d5('0x8')](_0xc4d5('0x18'),auth[_0xc4d5('0xb')](),controller['verifySmtp']);router[_0xc4d5('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xc4d5('0x19')]);router['post'](_0xc4d5('0x1a'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1b')]);router['post'](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1c')]);router[_0xc4d5('0x1d')]('/',auth[_0xc4d5('0xb')](),controller['create']);router[_0xc4d5('0x1d')](_0xc4d5('0xf'),auth['isAuthenticated'](),controller[_0xc4d5('0x1e')]);router[_0xc4d5('0x1d')](_0xc4d5('0x11'),auth[_0xc4d5('0xb')](),controller['addSmtp']);router[_0xc4d5('0x1d')]('/:id/interactions',auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x1f')]);router[_0xc4d5('0x1d')](_0xc4d5('0x14'),auth[_0xc4d5('0xb')](),controller['addApplications']);router[_0xc4d5('0x1d')](_0xc4d5('0x20'),auth['isAuthenticated'](),controller[_0xc4d5('0x21')]);router[_0xc4d5('0x1d')](_0xc4d5('0x22'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x23')]);router[_0xc4d5('0x24')](_0xc4d5('0x25'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x26')]);router['delete']('/:id/dispositions',auth[_0xc4d5('0xb')](),controller['removeDispositions']);router[_0xc4d5('0x27')](_0xc4d5('0xd'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x28')]);router['delete'](_0xc4d5('0xf'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x29')]);router['delete'](_0xc4d5('0x11'),auth['isAuthenticated'](),controller[_0xc4d5('0x2a')]);router[_0xc4d5('0x27')](_0xc4d5('0x25'),auth[_0xc4d5('0xb')](),controller['destroy']);router['delete'](_0xc4d5('0x22'),auth[_0xc4d5('0xb')](),controller[_0xc4d5('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x9683=['addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','isAuthenticated','describe','/:id','show','get','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x9683,0x18b));var _0x3968=function(_0x5c6c91,_0x324213){_0x5c6c91=_0x5c6c91-0x0;var _0x4333c4=_0x9683[_0x5c6c91];return _0x4333c4;};'use strict';var multer=require('multer');var util=require(_0x3968('0x0'));var path=require(_0x3968('0x1'));var timeout=require(_0x3968('0x2'));var express=require('express');var router=express[_0x3968('0x3')]();var fs_extra=require(_0x3968('0x4'));var auth=require(_0x3968('0x5'));var interaction=require(_0x3968('0x6'));var config=require(_0x3968('0x7'));var controller=require(_0x3968('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3968('0x9')]);router['get']('/describe',auth[_0x3968('0xa')](),controller[_0x3968('0xb')]);router['get'](_0x3968('0xc'),auth[_0x3968('0xa')](),controller[_0x3968('0xd')]);router[_0x3968('0xe')](_0x3968('0xf'),auth[_0x3968('0xa')](),controller[_0x3968('0x10')]);router[_0x3968('0xe')]('/:id/canned_answers',auth[_0x3968('0xa')](),controller[_0x3968('0x11')]);router[_0x3968('0xe')](_0x3968('0x12'),auth['isAuthenticated'](),controller[_0x3968('0x13')]);router['get'](_0x3968('0x14'),auth[_0x3968('0xa')](),controller[_0x3968('0x15')]);router[_0x3968('0xe')](_0x3968('0x16'),auth[_0x3968('0xa')](),controller['getInteractions']);router[_0x3968('0xe')](_0x3968('0x17'),auth[_0x3968('0xa')](),controller['getApplications']);router[_0x3968('0xe')](_0x3968('0x18'),auth[_0x3968('0xa')](),controller[_0x3968('0x19')]);router['get'](_0x3968('0x1a'),auth['isAuthenticated'](),controller[_0x3968('0x1b')]);router[_0x3968('0xe')](_0x3968('0x1c'),auth[_0x3968('0xa')](),controller[_0x3968('0x1d')]);router[_0x3968('0x1e')](_0x3968('0xf'),auth[_0x3968('0xa')](),controller['addDisposition']);router[_0x3968('0x1e')](_0x3968('0x1f'),auth[_0x3968('0xa')](),controller[_0x3968('0x20')]);router[_0x3968('0x1e')]('/',auth[_0x3968('0xa')](),controller[_0x3968('0x21')]);router[_0x3968('0x1e')](_0x3968('0x12'),auth['isAuthenticated'](),controller[_0x3968('0x22')]);router[_0x3968('0x1e')](_0x3968('0x14'),auth[_0x3968('0xa')](),controller[_0x3968('0x23')]);router[_0x3968('0x1e')]('/:id/interactions',auth[_0x3968('0xa')](),controller[_0x3968('0x24')]);router[_0x3968('0x1e')]('/:id/applications',auth[_0x3968('0xa')](),controller[_0x3968('0x25')]);router[_0x3968('0x1e')]('/:id/send',auth[_0x3968('0xa')](),controller['send']);router[_0x3968('0x1e')](_0x3968('0x1c'),auth['isAuthenticated'](),controller[_0x3968('0x26')]);router[_0x3968('0x27')](_0x3968('0xc'),auth[_0x3968('0xa')](),controller[_0x3968('0x28')]);router[_0x3968('0x29')](_0x3968('0xf'),auth[_0x3968('0xa')](),controller[_0x3968('0x2a')]);router['delete'](_0x3968('0x1f'),auth[_0x3968('0xa')](),controller[_0x3968('0x2b')]);router[_0x3968('0x29')](_0x3968('0x12'),auth[_0x3968('0xa')](),controller[_0x3968('0x2c')]);router[_0x3968('0x29')](_0x3968('0x14'),auth[_0x3968('0xa')](),controller[_0x3968('0x2d')]);router[_0x3968('0x29')](_0x3968('0xc'),auth[_0x3968('0xa')](),controller[_0x3968('0x2e')]);router['delete']('/:id/users',auth[_0x3968('0xa')](),controller['removeAgents']);module[_0x3968('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7abe795..5308850 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 _0xe5fe=['gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xe5fe,0x16e));var _0xee5f=function(_0xb24c89,_0x106170){_0xb24c89=_0xb24c89-0x0;var _0x27ab88=_0xe5fe[_0xb24c89];return _0x27ab88;};'use strict';var Sequelize=require(_0xee5f('0x0'));module[_0xee5f('0x1')]={'description':{'type':Sequelize[_0xee5f('0x2')]},'name':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xee5f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xee5f('0x4')]},'markAsUnread':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xee5f('0x2')],'allowNull':![],'defaultValue':_0xee5f('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xee5f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xee5f('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee5f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xee5f('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xee5f('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f094f){if(!_0x4f094f)this[_0xee5f('0x8')](_0xee5f('0x9'),null);this[_0xee5f('0x8')](_0xee5f('0xa'),_0x4f094f);}},'provider':{'type':Sequelize[_0xee5f('0xb')](_0xee5f('0xc'),'hotmail',_0xee5f('0xd'),_0xee5f('0xe')),'defaultValue':null,'get':function(){if(!this[_0xee5f('0xf')](_0xee5f('0x10')))return _0xee5f('0x11');return this[_0xee5f('0xf')](_0xee5f('0x10'));},'set':function(_0x40d01a){if(_0x40d01a===_0xee5f('0x11'))_0x40d01a=null;return this[_0xee5f('0x8')](_0xee5f('0x10'),_0x40d01a);}}}; \ No newline at end of file +var _0x42e8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x42e8,0xc9));var _0x842e=function(_0x27e18e,_0x2be332){_0x27e18e=_0x27e18e-0x0;var _0x464d0b=_0x42e8[_0x27e18e];return _0x464d0b;};'use strict';var Sequelize=require(_0x842e('0x0'));module[_0x842e('0x1')]={'description':{'type':Sequelize[_0x842e('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x842e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x842e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x842e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x842e('0x4')]},'markAsUnread':{'type':Sequelize[_0x842e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x842e('0x2')],'allowNull':![],'defaultValue':_0x842e('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x842e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x842e('0x4')],'defaultValue':function(){return _0x842e('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x842e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x842e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x842e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x842e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x842e('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x842e('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x842e('0xa'),'set':function(_0x4769ac){if(!_0x4769ac)this[_0x842e('0xb')](_0x842e('0xc'),null);this['setDataValue'](_0x842e('0xd'),_0x4769ac);}},'provider':{'type':Sequelize[_0x842e('0xe')](_0x842e('0xf'),_0x842e('0x10'),_0x842e('0x11'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x842e('0x12')](_0x842e('0x13')))return _0x842e('0x14');return this[_0x842e('0x12')](_0x842e('0x13'));},'set':function(_0x470a9e){if(_0x470a9e===_0x842e('0x14'))_0x470a9e=null;return this[_0x842e('0xb')]('provider',_0x470a9e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 66aed73..d0cf0b9 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 _0x68e5=['rawAttributes','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','includeAll','include','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','params','Disposition','create','getDispositions','keys','sort','MailAccountId','removeDispositions','addAnswer','findOne','CannedAnswer','removeAnswers','ids','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','root','basename','SendMail','sendMail','List','List\x20not\x20found','subject','attach','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','info','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount'];(function(_0x538d7e,_0x1f7944){var _0x5debc4=function(_0x1018fd){while(--_0x1018fd){_0x538d7e['push'](_0x538d7e['shift']());}};_0x5debc4(++_0x1f7944);}(_0x68e5,0x79));var _0x568e=function(_0x401169,_0x3e0dff){_0x401169=_0x401169-0x0;var _0x4d8f81=_0x68e5[_0x401169];return _0x4d8f81;};'use strict';var moment=require('moment');var BPromise=require(_0x568e('0x0'));var util=require(_0x568e('0x1'));var path=require(_0x568e('0x2'));var _=require(_0x568e('0x3'));var juice=require(_0x568e('0x4'));var Redis=require(_0x568e('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x568e('0x6'));var config=require(_0x568e('0x7'));var db=require(_0x568e('0x8'))['db'];config[_0x568e('0x9')]=_[_0x568e('0xa')](config[_0x568e('0x9')],{'host':_0x568e('0xb'),'port':0x18eb});var socket=require(_0x568e('0xc'))(new Redis(config['redis']));require(_0x568e('0xd'))['register'](socket);var jayson=require(_0x568e('0xe'));var client=jayson[_0x568e('0xf')][_0x568e('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x351914,_0x3202a6,_0x1ae008,_0x3f50ec){return new BPromise(function(_0x640fb1,_0x112327){var _0x1ab700=_0x3f50ec||client;return _0x1ab700['request'](_0x351914,_0x1ae008)['then'](function(_0x3f9549){logger[_0x568e('0x11')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x568e('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x3202a6,_0x568e('0x12'),JSON[_0x568e('0x13')](_0x3f9549));if(_0x3f9549[_0x568e('0x14')]){if(_0x3f9549[_0x568e('0x14')][_0x568e('0x15')]===0x1f4){logger[_0x568e('0x14')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x3f9549[_0x568e('0x14')][_0x568e('0x16')]);return _0x112327(_0x3f9549[_0x568e('0x14')][_0x568e('0x16')]);}logger[_0x568e('0x14')](_0x568e('0x17'),_0x3202a6,_0x3f9549['error'][_0x568e('0x16')]);return _0x640fb1(_0x3f9549[_0x568e('0x14')]['message']);}else{logger[_0x568e('0x11')](_0x568e('0x17'),_0x3202a6,_0x568e('0x12'));_0x640fb1(_0x3f9549[_0x568e('0x18')]['message']);}})['catch'](function(_0x583372){logger[_0x568e('0x14')]('MailAccount,\x20%s,\x20%s',_0x3202a6,_0x583372);_0x112327(_0x583372);});});}function respondWithStatusCode(_0xb01143,_0x309370){_0x309370=_0x309370||0xcc;return function(_0x4e3d27){if(_0x4e3d27){return _0xb01143[_0x568e('0x19')](_0x309370);}return _0xb01143[_0x568e('0x1a')](_0x309370)[_0x568e('0x1b')]();};}function respondWithResult(_0x3f77d7,_0x4ba455){_0x4ba455=_0x4ba455||0xc8;return function(_0x574164){if(_0x574164){return _0x3f77d7[_0x568e('0x1a')](_0x4ba455)[_0x568e('0x1c')](_0x574164);}};}function respondWithFilteredResult(_0x1b8af5,_0x56f455){return function(_0x32021a){if(_0x32021a){var _0x5df385=typeof _0x56f455[_0x568e('0x1d')]===_0x568e('0x1e')&&typeof _0x56f455[_0x568e('0x1f')]===_0x568e('0x1e');var _0x380ed3=_0x32021a['count'];var _0x4c689c=_0x5df385?0x0:_0x56f455[_0x568e('0x1d')];var _0xad9937=_0x5df385?_0x32021a['count']:_0x56f455['offset']+_0x56f455['limit'];var _0x595c1a;if(_0xad9937>=_0x380ed3){_0xad9937=_0x380ed3;_0x595c1a=0xc8;}else{_0x595c1a=0xce;}_0x1b8af5[_0x568e('0x1a')](_0x595c1a);return _0x1b8af5[_0x568e('0x20')](_0x568e('0x21'),_0x4c689c+'-'+_0xad9937+'/'+_0x380ed3)[_0x568e('0x1c')](_0x32021a);}return null;};}function saveUpdates(_0x51c7de){return function(_0x4fa544){if(_0x4fa544){return _0x4fa544[_0x568e('0x22')](_0x51c7de)[_0x568e('0x23')](function(_0x492481){return _0x492481;});}return null;};}function removeEntity(_0x371a26){return function(_0x42ee7d){if(_0x42ee7d){return _0x42ee7d[_0x568e('0x24')]()[_0x568e('0x23')](function(){var _0x5dcea2=_0x42ee7d[_0x568e('0x25')]({'plain':!![]});var _0x2310bf=_0x568e('0x26');return db[_0x568e('0x27')]['destroy']({'where':{'type':_0x2310bf,'resourceId':_0x5dcea2['id']}})[_0x568e('0x23')](function(){return _0x42ee7d;});})[_0x568e('0x23')](function(){_0x371a26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23f189){return function(_0x99e42e){if(!_0x99e42e){_0x23f189[_0x568e('0x19')](0x194);}return _0x99e42e;};}function handleError(_0x5d214d,_0x4123dd){_0x4123dd=_0x4123dd||0x1f4;return function(_0x3c7e51){logger['error'](_0x3c7e51['stack']);if(_0x3c7e51[_0x568e('0x28')]){delete _0x3c7e51[_0x568e('0x28')];}_0x5d214d['status'](_0x4123dd)[_0x568e('0x29')](_0x3c7e51);};}function getImapHost(_0x171774){switch(_0x171774){case _0x568e('0x2a'):return'imap.gmail.com';case _0x568e('0x2b'):return _0x568e('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0x568e('0x2d'):return _0x568e('0x2e');}throw new Error(_0x568e('0x2f'),_0x171774);}function getSmtpHost(_0x2f41c3){switch(_0x2f41c3){case'gmail':return'smtp.gmail.com';case'yahoo':return _0x568e('0x30');case _0x568e('0x31'):return _0x568e('0x32');case _0x568e('0x2d'):return _0x568e('0x33');}throw new Error(_0x568e('0x2f'),_0x2f41c3);}function getAuthenticationOptions(_0x271f86,_0x4e5243){var _0x14191={};var _0x2cdaca={};if(_0x271f86){_0x14191[_0x568e('0x34')]=_0x2cdaca[_0x568e('0x34')]=_0x4e5243[_0x568e('0x35')];_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=_0x4e5243[_0x568e('0x36')];if(_0x4e5243[_0x568e('0x38')]){_0x14191['modernAuthentication']=_0x2cdaca[_0x568e('0x38')]=!![];_0x14191[_0x568e('0x39')]=_0x2cdaca['CloudProviderId']=_0x4e5243[_0x568e('0x39')];_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=null;}else{_0x14191[_0x568e('0x39')]=_0x2cdaca[_0x568e('0x39')]=null;}_0x14191['host']=getImapHost(_0x271f86);_0x14191[_0x568e('0x3a')]=0x3e1;_0x2cdaca[_0x568e('0x3b')]=getSmtpHost(_0x271f86);_0x2cdaca[_0x568e('0x3a')]=0x24b;_0x2cdaca[_0x568e('0x3c')]=![];_0x14191[_0x568e('0x3d')]=_0x2cdaca['service']=null;}else{if(_0x4e5243['authentication']){_0x14191['user']=_0x2cdaca[_0x568e('0x34')]=_0x4e5243[_0x568e('0x35')];_0x14191['password']=_0x2cdaca[_0x568e('0x37')]=_0x4e5243[_0x568e('0x36')];}else{_0x14191[_0x568e('0x3e')]=_0x2cdaca[_0x568e('0x3e')]=![];_0x14191[_0x568e('0x34')]=_0x2cdaca['user']=null;_0x14191[_0x568e('0x36')]=_0x2cdaca[_0x568e('0x37')]=null;}_0x14191[_0x568e('0x3b')]=_0x4e5243[_0x568e('0x3f')]['host'];_0x14191[_0x568e('0x3a')]=_0x4e5243[_0x568e('0x3f')]['port'];_0x2cdaca[_0x568e('0x3b')]=_0x4e5243['Smtp'][_0x568e('0x3b')];_0x2cdaca['port']=_0x4e5243[_0x568e('0x40')][_0x568e('0x3a')];}return{'Imap':_0x14191,'Smtp':_0x2cdaca};}exports[_0x568e('0x41')]=function(_0x293740,_0x244a6d){var _0x45559f={'include':[{'model':db[_0x568e('0x42')],'as':'Imap'},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db[_0x568e('0x44')],'as':_0x568e('0x45')}]},_0x46efa0={},_0x4d6ff5={'count':0x0,'rows':[]};var _0x18370d=_[_0x568e('0x46')](db[_0x568e('0x47')][_0x568e('0x48')],function(_0x41bead){return{'name':_0x41bead['fieldName'],'type':_0x41bead[_0x568e('0x49')][_0x568e('0x4a')]};});_0x46efa0[_0x568e('0x4b')]=_['map'](_0x18370d,_0x568e('0x28'));_0x46efa0['query']=_['keys'](_0x293740['query']);_0x46efa0[_0x568e('0x4c')]=_['intersection'](_0x46efa0[_0x568e('0x4b')],_0x46efa0[_0x568e('0x4d')]);_0x45559f['attributes']=_[_0x568e('0x4e')](_0x46efa0[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x293740[_0x568e('0x4d')][_0x568e('0x4f')]));_0x45559f[_0x568e('0x50')]=_0x45559f[_0x568e('0x50')][_0x568e('0x51')]?_0x45559f['attributes']:_0x46efa0[_0x568e('0x4b')];if(!_0x293740[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x45559f[_0x568e('0x1f')]=qs['limit'](_0x293740['query'][_0x568e('0x1f')]);_0x45559f[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x293740['query']['offset']);}_0x45559f[_0x568e('0x54')]=qs['sort'](_0x293740[_0x568e('0x4d')]['sort']);_0x45559f[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x293740[_0x568e('0x4d')],_0x46efa0[_0x568e('0x4c')]),_0x18370d);if(_0x293740[_0x568e('0x4d')][_0x568e('0x57')]){_0x45559f[_0x568e('0x55')]=_[_0x568e('0x58')](_0x45559f[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x18370d,function(_0x6631ae){if(_0x6631ae[_0x568e('0x49')]!==_0x568e('0x59')){var _0x368aec={};_0x368aec[_0x6631ae[_0x568e('0x28')]]={'$like':'%'+_0x293740[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x368aec;}})});}_0x45559f=_[_0x568e('0x58')]({},_0x45559f,_0x293740[_0x568e('0x5a')]);var _0x2ecb43={'where':_0x45559f[_0x568e('0x55')]};return db[_0x568e('0x47')][_0x568e('0x5b')](_0x2ecb43)['then'](function(_0x3ab53f){_0x4d6ff5[_0x568e('0x5b')]=_0x3ab53f;if(_0x293740['query']['includeAll']){_0x45559f['include']=[{'all':!![]}];}return db[_0x568e('0x47')][_0x568e('0x5c')](_0x45559f);})[_0x568e('0x23')](function(_0x5b3d74){_0x4d6ff5[_0x568e('0x5d')]=_0x5b3d74;return _0x4d6ff5;})['then'](respondWithFilteredResult(_0x244a6d,_0x45559f))[_0x568e('0x5e')](handleError(_0x244a6d,null));};exports[_0x568e('0x5f')]=function(_0x39bdca,_0x1c6e89){var _0x3fe06e={'raw':![],'where':{'id':_0x39bdca['params']['id']},'include':[{'model':db[_0x568e('0x42')],'as':_0x568e('0x3f')},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xbedc09={};_0xbedc09[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x47')][_0x568e('0x48')]);_0xbedc09[_0x568e('0x4d')]=_['keys'](_0x39bdca[_0x568e('0x4d')]);_0xbedc09[_0x568e('0x4c')]=_['intersection'](_0xbedc09['model'],_0xbedc09['query']);_0x3fe06e[_0x568e('0x50')]=_['intersection'](_0xbedc09[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x39bdca[_0x568e('0x4d')][_0x568e('0x4f')]));_0x3fe06e[_0x568e('0x50')]=_0x3fe06e['attributes'][_0x568e('0x51')]?_0x3fe06e[_0x568e('0x50')]:_0xbedc09[_0x568e('0x4b')];if(_0x39bdca['query'][_0x568e('0x60')]){_0x3fe06e[_0x568e('0x61')]=[{'all':!![]}];}_0x3fe06e=_[_0x568e('0x58')]({},_0x3fe06e,_0x39bdca[_0x568e('0x5a')]);return db['MailAccount'][_0x568e('0x62')](_0x3fe06e)[_0x568e('0x23')](handleEntityNotFound(_0x1c6e89,null))[_0x568e('0x23')](respondWithResult(_0x1c6e89,null))[_0x568e('0x5e')](handleError(_0x1c6e89,null));};exports['update']=function(_0x3f696b,_0x336e22){if(_0x3f696b[_0x568e('0x63')]['id']){delete _0x3f696b[_0x568e('0x63')]['id'];}var _0x5f60df=_0x3f696b[_0x568e('0x63')][_0x568e('0x64')]===_0x568e('0x65')?null:_0x3f696b[_0x568e('0x63')][_0x568e('0x64')];var _0x46f360=_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')]||{};var _0x4d8ecc=_0x3f696b[_0x568e('0x63')][_0x568e('0x40')]||{};if(_0x5f60df){_0x46f360[_0x568e('0x3b')]=getImapHost(_0x5f60df);_0x46f360[_0x568e('0x3a')]=0x3e1;_0x4d8ecc[_0x568e('0x3b')]=getSmtpHost(_0x5f60df);_0x4d8ecc[_0x568e('0x3a')]=0x24b;_0x4d8ecc[_0x568e('0x3c')]=![];}if(_0x4d8ecc[_0x568e('0x38')]){_0x4d8ecc[_0x568e('0x3c')]=![];}else{_0x4d8ecc['CloudProviderId']=null;}if(!_0x46f360[_0x568e('0x38')])_0x46f360['CloudProviderId']=null;_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')]=_0x46f360;_0x3f696b[_0x568e('0x63')][_0x568e('0x40')]=_0x4d8ecc;return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x3f696b['params']['id']},'include':[{'model':db[_0x568e('0x42')],'as':'Imap'},{'model':db[_0x568e('0x43')],'as':_0x568e('0x40')},{'model':db[_0x568e('0x44')],'as':_0x568e('0x45')}]})['then'](handleEntityNotFound(_0x336e22,null))[_0x568e('0x23')](function(_0x395841){if(!_0x395841)throw new Error(_0x568e('0x66'));if(_0x395841[_0x568e('0x3d')])delete _0x3f696b[_0x568e('0x63')][_0x568e('0x3f')];return _0x395841;})['then'](saveUpdates(_0x3f696b[_0x568e('0x63')],null))[_0x568e('0x23')](function(_0x152cad){if(!_0x3f696b['body']['Imap'])return _0x152cad;return db[_0x568e('0x42')][_0x568e('0x22')](_0x3f696b[_0x568e('0x63')][_0x568e('0x3f')],{'where':{'MailAccountId':_0x152cad['id']}})[_0x568e('0x23')](function(){return _0x152cad;});})[_0x568e('0x23')](function(_0x135119){if(!_0x3f696b[_0x568e('0x63')][_0x568e('0x40')])return _0x135119;return db[_0x568e('0x43')][_0x568e('0x22')](_0x3f696b[_0x568e('0x63')]['Smtp'],{'where':{'MailAccountId':_0x135119['id']}})[_0x568e('0x23')](function(){return _0x135119;});})[_0x568e('0x23')](respondWithResult(_0x336e22,null))[_0x568e('0x5e')](handleError(_0x336e22,null));};exports[_0x568e('0x67')]=function(_0x596d83,_0x10bb53){return db[_0x568e('0x47')][_0x568e('0x67')]()[_0x568e('0x23')](respondWithResult(_0x10bb53,null))['catch'](handleError(_0x10bb53,null));};exports[_0x568e('0x68')]=function(_0x3fc1f6,_0x2fb319){if(_0x3fc1f6['body']['id']){delete _0x3fc1f6['body']['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3fc1f6[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x2fb319,null))[_0x568e('0x23')](function(_0x36c10e){if(_0x36c10e){_0x3fc1f6[_0x568e('0x63')]['MailAccountId']=_0x36c10e['id'];return db[_0x568e('0x6a')][_0x568e('0x6b')](_0x3fc1f6['body']);}})['then'](respondWithResult(_0x2fb319,null))['catch'](handleError(_0x2fb319,null));};exports[_0x568e('0x6c')]=function(_0x1c34e0,_0x1efc54){var _0x257692={'raw':![],'where':{}};var _0x51b96d={};var _0x1c54f5={'count':0x0,'rows':[]};return db[_0x568e('0x47')]['findOne']({'where':{'id':_0x1c34e0['params']['id']}})['then'](handleEntityNotFound(_0x1efc54,null))[_0x568e('0x23')](function(_0x4a6bdb){if(_0x4a6bdb){_0x51b96d[_0x568e('0x4b')]=_[_0x568e('0x6d')](db[_0x568e('0x6a')][_0x568e('0x48')]);_0x51b96d['query']=_[_0x568e('0x6d')](_0x1c34e0[_0x568e('0x4d')]);_0x51b96d[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x51b96d[_0x568e('0x4b')],_0x51b96d['query']);_0x257692['attributes']=_[_0x568e('0x4e')](_0x51b96d[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x1c34e0[_0x568e('0x4d')][_0x568e('0x4f')]));_0x257692[_0x568e('0x50')]=_0x257692['attributes']['length']?_0x257692[_0x568e('0x50')]:_0x51b96d[_0x568e('0x4b')];if(!_0x1c34e0[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x257692['limit']=qs[_0x568e('0x1f')](_0x1c34e0['query'][_0x568e('0x1f')]);_0x257692[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x1c34e0['query'][_0x568e('0x1d')]);}_0x257692[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x1c34e0[_0x568e('0x4d')]['sort']);_0x257692[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x1c34e0['query'],_0x51b96d[_0x568e('0x4c')]));_0x257692[_0x568e('0x55')][_0x568e('0x6f')]=_0x4a6bdb['id'];if(_0x1c34e0[_0x568e('0x4d')]['filter']){_0x257692[_0x568e('0x55')]=_[_0x568e('0x58')](_0x257692[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x257692[_0x568e('0x50')],function(_0x40dc5e){var _0x220c06={};_0x220c06[_0x40dc5e]={'$like':'%'+_0x1c34e0['query'][_0x568e('0x57')]+'%'};return _0x220c06;})});}_0x257692=_[_0x568e('0x58')]({},_0x257692,_0x1c34e0[_0x568e('0x5a')]);return db['Disposition'][_0x568e('0x5b')]({'where':_0x257692[_0x568e('0x55')]})['then'](function(_0x6a7f2){_0x1c54f5[_0x568e('0x5b')]=_0x6a7f2;if(_0x1c34e0[_0x568e('0x4d')][_0x568e('0x60')]){_0x257692[_0x568e('0x61')]=[{'all':!![]}];}return db[_0x568e('0x6a')]['findAll'](_0x257692);})['then'](function(_0x38531a){_0x1c54f5[_0x568e('0x5d')]=_0x38531a;return _0x1c54f5;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x1efc54,_0x257692))['catch'](handleError(_0x1efc54,null));};exports[_0x568e('0x70')]=function(_0x5d01ec,_0xbe191b){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x5d01ec[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0xbe191b,null))[_0x568e('0x23')](function(_0x208b2c){if(_0x208b2c){return _0x208b2c[_0x568e('0x70')](_0x5d01ec[_0x568e('0x4d')]['ids']);}})[_0x568e('0x23')](respondWithStatusCode(_0xbe191b,null))[_0x568e('0x5e')](handleError(_0xbe191b,null));};exports[_0x568e('0x71')]=function(_0x642eb6,_0x58a31f){if(_0x642eb6['body']['id']){delete _0x642eb6[_0x568e('0x63')]['id'];}return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x642eb6[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x58a31f,null))[_0x568e('0x23')](function(_0x18a8f9){if(_0x18a8f9){_0x642eb6['body']['MailAccountId']=_0x18a8f9['id'];return db['CannedAnswer'][_0x568e('0x6b')](_0x642eb6['body']);}})[_0x568e('0x23')](respondWithResult(_0x58a31f,null))[_0x568e('0x5e')](handleError(_0x58a31f,null));};exports['getAnswers']=function(_0x575e2f,_0x2f69d9){var _0x3c79b2={'raw':![],'where':{}};var _0x33f4b7={};var _0x318234={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x575e2f[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x2f69d9,null))[_0x568e('0x23')](function(_0x510f1b){if(_0x510f1b){_0x33f4b7['model']=_['keys'](db[_0x568e('0x73')][_0x568e('0x48')]);_0x33f4b7['query']=_[_0x568e('0x6d')](_0x575e2f['query']);_0x33f4b7[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x33f4b7[_0x568e('0x4b')],_0x33f4b7['query']);_0x3c79b2['attributes']=_[_0x568e('0x4e')](_0x33f4b7[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x575e2f[_0x568e('0x4d')]['fields']));_0x3c79b2[_0x568e('0x50')]=_0x3c79b2['attributes'][_0x568e('0x51')]?_0x3c79b2[_0x568e('0x50')]:_0x33f4b7[_0x568e('0x4b')];if(!_0x575e2f['query'][_0x568e('0x52')]('nolimit')){_0x3c79b2[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x575e2f['query'][_0x568e('0x1f')]);_0x3c79b2[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x575e2f[_0x568e('0x4d')][_0x568e('0x1d')]);}_0x3c79b2[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x575e2f[_0x568e('0x4d')][_0x568e('0x6e')]);_0x3c79b2[_0x568e('0x55')]=qs[_0x568e('0x4c')](_['pick'](_0x575e2f[_0x568e('0x4d')],_0x33f4b7[_0x568e('0x4c')]));_0x3c79b2[_0x568e('0x55')][_0x568e('0x6f')]=_0x510f1b['id'];if(_0x575e2f['query'][_0x568e('0x57')]){_0x3c79b2[_0x568e('0x55')]=_[_0x568e('0x58')](_0x3c79b2[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x3c79b2[_0x568e('0x50')],function(_0x1393e4){var _0x388fcc={};_0x388fcc[_0x1393e4]={'$like':'%'+_0x575e2f[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x388fcc;})});}_0x3c79b2=_[_0x568e('0x58')]({},_0x3c79b2,_0x575e2f[_0x568e('0x5a')]);return db['CannedAnswer'][_0x568e('0x5b')]({'where':_0x3c79b2['where']})[_0x568e('0x23')](function(_0x2f303f){_0x318234[_0x568e('0x5b')]=_0x2f303f;if(_0x575e2f['query'][_0x568e('0x60')]){_0x3c79b2[_0x568e('0x61')]=[{'all':!![]}];}return db['CannedAnswer'][_0x568e('0x5c')](_0x3c79b2);})[_0x568e('0x23')](function(_0x2fce0f){_0x318234[_0x568e('0x5d')]=_0x2fce0f;return _0x318234;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x2f69d9,_0x3c79b2))['catch'](handleError(_0x2f69d9,null));};exports[_0x568e('0x74')]=function(_0xc5c253,_0x4d0dc6){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0xc5c253[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x4d0dc6,null))[_0x568e('0x23')](function(_0x5c58f2){if(_0x5c58f2){return _0x5c58f2[_0x568e('0x74')](_0xc5c253[_0x568e('0x4d')][_0x568e('0x75')]);}})[_0x568e('0x23')](respondWithStatusCode(_0x4d0dc6,null))[_0x568e('0x5e')](handleError(_0x4d0dc6,null));};exports[_0x568e('0x6b')]=function(_0x527b16,_0x24ce4b){var _0x102357={'name':_0x527b16[_0x568e('0x63')]['name'],'key':_0x527b16['body'][_0x568e('0x4a')],'provider':_0x527b16['body'][_0x568e('0x64')]===_0x568e('0x65')?null:_0x527b16[_0x568e('0x63')][_0x568e('0x64')],'email':_0x527b16[_0x568e('0x63')]['email'],'ListId':_0x527b16[_0x568e('0x63')][_0x568e('0x76')],'active':!_['isNil'](_0x527b16[_0x568e('0x63')][_0x568e('0x77')])?_0x527b16[_0x568e('0x63')][_0x568e('0x77')]:!![],'description':_0x527b16['body'][_0x568e('0x78')]||null};var _0x256276=getAuthenticationOptions(_0x102357[_0x568e('0x64')],_0x527b16[_0x568e('0x63')]);_0x102357[_0x568e('0x3f')]=_0x256276['Imap'];_0x102357[_0x568e('0x40')]=_0x256276[_0x568e('0x40')];return db[_0x568e('0x47')][_0x568e('0x6b')](_0x102357,{'include':[{'model':db[_0x568e('0x43')],'as':'Smtp'},{'model':db[_0x568e('0x42')],'as':_0x568e('0x3f')}]})[_0x568e('0x23')](function(_0x952d4){var _0x39e193=_0x527b16['user'][_0x568e('0x25')]({'plain':!![]});if(!_0x39e193)throw new Error(_0x568e('0x79'));if(_0x39e193[_0x568e('0x7a')]===_0x568e('0x34')){var _0x1e2c28=_0x952d4[_0x568e('0x25')]({'plain':!![]});return db[_0x568e('0x7b')][_0x568e('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x39e193[_0x568e('0x7c')]},'raw':!![]})[_0x568e('0x23')](function(_0x106b54){if(_0x106b54&&_0x106b54[_0x568e('0x7d')]===0x0){return db[_0x568e('0x27')][_0x568e('0x6b')]({'name':_0x1e2c28[_0x568e('0x28')],'resourceId':_0x1e2c28['id'],'type':_0x106b54[_0x568e('0x28')],'sectionId':_0x106b54['id']},{})[_0x568e('0x23')](function(){return _0x952d4;});}else{return _0x952d4;}})[_0x568e('0x5e')](function(_0x3d9b50){logger['error'](_0x568e('0x7e'),_0x3d9b50);throw _0x3d9b50;});}return _0x952d4;})[_0x568e('0x23')](respondWithResult(_0x24ce4b,0xc9))[_0x568e('0x5e')](handleError(_0x24ce4b,null));};exports['getImap']=function(_0x4c7346,_0x248ac9){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x4c7346['params']['id']}})['then'](handleEntityNotFound(_0x248ac9,null))[_0x568e('0x23')](function(_0x1fce12){if(_0x1fce12){return _0x1fce12['getImap']();}return null;})['then'](respondWithResult(_0x248ac9,null))[_0x568e('0x5e')](handleError(_0x248ac9,null));};exports[_0x568e('0x7f')]=function(_0x2f923b,_0x54d6b7){if(_0x2f923b[_0x568e('0x63')]['id']){delete _0x2f923b[_0x568e('0x63')]['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x2f923b[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x54d6b7,null))[_0x568e('0x23')](function(_0x3cb77a){if(_0x3cb77a){_0x2f923b[_0x568e('0x63')][_0x568e('0x6f')]=_0x3cb77a['id'];return db[_0x568e('0x42')][_0x568e('0x6b')](_0x2f923b[_0x568e('0x63')]);}})[_0x568e('0x23')](respondWithResult(_0x54d6b7,null))[_0x568e('0x5e')](handleError(_0x54d6b7,null));};exports['removeImap']=function(_0x3d33cd,_0x4d0e02){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x3d33cd['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x4d0e02,null))[_0x568e('0x23')](function(_0x497f98){if(_0x497f98){return _0x497f98[_0x568e('0x80')](null);}return null;})[_0x568e('0x23')](respondWithStatusCode(_0x4d0e02,null))[_0x568e('0x5e')](handleError(_0x4d0e02,null));};exports[_0x568e('0x81')]=function(_0x5bd3a3,_0x4d31a8){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x5bd3a3[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x4d31a8,null))[_0x568e('0x23')](function(_0xb3d39f){if(_0xb3d39f){return _0xb3d39f['getSmtp']();}return null;})[_0x568e('0x23')](respondWithResult(_0x4d31a8,null))[_0x568e('0x5e')](handleError(_0x4d31a8,null));};exports[_0x568e('0x82')]=function(_0x3f7c36,_0x1ca1bd){if(_0x3f7c36[_0x568e('0x63')]['id']){delete _0x3f7c36['body']['id'];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3f7c36['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x1ca1bd,null))[_0x568e('0x23')](function(_0x503910){if(_0x503910){_0x3f7c36[_0x568e('0x63')][_0x568e('0x6f')]=_0x503910['id'];return db['MailServerOut'][_0x568e('0x6b')](_0x3f7c36[_0x568e('0x63')]);}})[_0x568e('0x23')](respondWithResult(_0x1ca1bd,null))['catch'](handleError(_0x1ca1bd,null));};exports['removeSmtp']=function(_0x235afb,_0x42d679){return db[_0x568e('0x47')]['findOne']({'where':{'id':_0x235afb[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x42d679,null))[_0x568e('0x23')](function(_0x22cd0c){if(_0x22cd0c){return _0x22cd0c[_0x568e('0x83')](null);}return null;})[_0x568e('0x23')](respondWithStatusCode(_0x42d679,null))[_0x568e('0x5e')](handleError(_0x42d679,null));};exports[_0x568e('0x84')]=function(_0x53a53,_0x23f808){return db[_0x568e('0x85')]['find']({'where':{'id':_0x53a53[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x23f808,null))[_0x568e('0x23')](function(_0xd3d1b1){if(_0xd3d1b1){return _0xd3d1b1[_0x568e('0x84')](_0x53a53[_0x568e('0x63')][_0x568e('0x75')],_[_0x568e('0x86')](_0x53a53[_0x568e('0x63')],[_0x568e('0x75'),'id'])||{});}})[_0x568e('0x23')](respondWithResult(_0x23f808,null))[_0x568e('0x5e')](handleError(_0x23f808,null));};exports['getInteractions']=function(_0x18cde0,_0x21b30f){var _0x5f55cf={'raw':![],'where':{}};var _0x3dc2d9={};var _0x4e6764={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x18cde0[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x21b30f,null))[_0x568e('0x23')](function(_0x30b951){if(_0x30b951){_0x3dc2d9[_0x568e('0x4b')]=_[_0x568e('0x6d')](db[_0x568e('0x85')][_0x568e('0x48')]);_0x3dc2d9[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x18cde0['query']);_0x3dc2d9[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x3dc2d9[_0x568e('0x4b')],_0x3dc2d9[_0x568e('0x4d')]);_0x5f55cf[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x3dc2d9[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x18cde0[_0x568e('0x4d')][_0x568e('0x4f')]));_0x5f55cf[_0x568e('0x50')]=_0x5f55cf[_0x568e('0x50')][_0x568e('0x51')]?_0x5f55cf[_0x568e('0x50')]:_0x3dc2d9[_0x568e('0x4b')];if(!_0x18cde0[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x5f55cf['limit']=qs['limit'](_0x18cde0[_0x568e('0x4d')][_0x568e('0x1f')]);_0x5f55cf[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x18cde0['query'][_0x568e('0x1d')]);}_0x5f55cf['order']=qs[_0x568e('0x6e')](_0x18cde0[_0x568e('0x4d')]['sort']);_0x5f55cf['where']=qs[_0x568e('0x4c')](_['pick'](_0x18cde0[_0x568e('0x4d')],_0x3dc2d9[_0x568e('0x4c')]));_0x5f55cf[_0x568e('0x55')][_0x568e('0x6f')]=_0x30b951['id'];if(_0x18cde0[_0x568e('0x4d')]['filter']){_0x5f55cf[_0x568e('0x55')]=_[_0x568e('0x58')](_0x5f55cf[_0x568e('0x55')],{'$or':_['map'](_0x5f55cf[_0x568e('0x50')],function(_0x23509a){var _0xee7f1a={};_0xee7f1a[_0x23509a]={'$like':'%'+_0x18cde0[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0xee7f1a;})});}_0x5f55cf=_[_0x568e('0x58')]({},_0x5f55cf,_0x18cde0[_0x568e('0x5a')]);return db['MailInteraction'][_0x568e('0x5b')]({'where':_0x5f55cf[_0x568e('0x55')]})[_0x568e('0x23')](function(_0x4b4a3b){_0x4e6764[_0x568e('0x5b')]=_0x4b4a3b;if(_0x18cde0['query'][_0x568e('0x60')]){_0x5f55cf[_0x568e('0x61')]=[{'model':db[_0x568e('0x87')],'as':_0x568e('0x88'),'required':![]},{'model':db[_0x568e('0x89')],'as':'Owner','attributes':[_0x568e('0x28'),_0x568e('0x8a'),_0x568e('0x8b')],'required':![]},{'model':db[_0x568e('0x8c')],'as':'Tags','attributes':['id','name',_0x568e('0x8d')],'where':_0x18cde0[_0x568e('0x4d')]['tag']?{'id':_0x18cde0[_0x568e('0x4d')][_0x568e('0x8e')]}:undefined,'required':_0x18cde0[_0x568e('0x4d')]['tag']?!![]:![]}];}return db[_0x568e('0x85')]['findAll'](_0x5f55cf);})[_0x568e('0x23')](function(_0x1cc327){_0x4e6764[_0x568e('0x5d')]=_0x1cc327;return _0x4e6764;});}})[_0x568e('0x23')](respondWithFilteredResult(_0x21b30f,_0x5f55cf))[_0x568e('0x5e')](handleError(_0x21b30f,null));};exports[_0x568e('0x8f')]=function addApplications(_0x117b70,_0xa589a2){var _0x4c904b=_0x117b70[_0x568e('0x69')]['id'];var _0x2770a1=_0x117b70[_0x568e('0x63')];var _0x5cbbc0=0xc8;var _0x547879=null;return db[_0x568e('0x90')][_0x568e('0x91')]({'isolationLevel':db['sequelize'][_0x568e('0x92')]['ISOLATION_LEVELS'][_0x568e('0x93')]},function(_0x1574dd){return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x4c904b},'transaction':_0x1574dd})[_0x568e('0x23')](function(_0x52377a){if(_0x52377a){return db[_0x568e('0x94')]['destroy']({'where':{'MailAccountId':_0x4c904b},'transaction':_0x1574dd})[_0x568e('0x23')](function(){var _0x3e47b7=_[_0x568e('0x46')](_0x2770a1,function(_0x3b0d85){_0x3b0d85[_0x568e('0x6f')]=_0x4c904b;return _0x3b0d85;});return db[_0x568e('0x94')][_0x568e('0x95')](_0x3e47b7,{'transaction':_0x1574dd});});}else{_0x5cbbc0=0x194;_0x547879=[];}});})['then'](function(){if(_0x5cbbc0!==0x194){return db['MailApplication'][_0x568e('0x96')]({'where':{'MailAccountId':_0x4c904b},'order':_0x568e('0x97')})['then'](function(_0x247d16){_0x547879=_0x247d16;});}})[_0x568e('0x5e')](function(_0x2be27a){_0x5cbbc0=0x1f4;logger[_0x568e('0x14')](_0x2be27a[_0x568e('0x98')]);if(_0x2be27a[_0x568e('0x28')]){delete _0x2be27a[_0x568e('0x28')];}_0x547879=_0x2be27a;})[_0x568e('0x99')](function(){if(_0x547879===null){_0xa589a2[_0x568e('0x19')](_0x5cbbc0);}else{if(_0x5cbbc0===0x1f4){_0xa589a2[_0x568e('0x1a')](_0x5cbbc0)[_0x568e('0x29')](_0x547879);}else{_0xa589a2[_0x568e('0x1a')](_0x5cbbc0)[_0x568e('0x1c')](_0x547879);}}});};exports[_0x568e('0x9a')]=function(_0x2890b1,_0x196dab){var _0x5549e9={};var _0x325fa7={};var _0x3b0e40;var _0x33e6d0;return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x2890b1[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x196dab,null))['then'](function(_0x47e0f0){if(_0x47e0f0){_0x3b0e40=_0x47e0f0;_0x325fa7[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x94')]['rawAttributes']);_0x325fa7[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x2890b1[_0x568e('0x4d')]);_0x325fa7[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x325fa7[_0x568e('0x4b')],_0x325fa7[_0x568e('0x4d')]);_0x5549e9[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x325fa7[_0x568e('0x4b')],qs[_0x568e('0x4f')](_0x2890b1[_0x568e('0x4d')]['fields']));_0x5549e9[_0x568e('0x50')]=_0x5549e9[_0x568e('0x50')][_0x568e('0x51')]?_0x5549e9['attributes']:_0x325fa7[_0x568e('0x4b')];_0x5549e9['order']=qs[_0x568e('0x6e')](_0x2890b1[_0x568e('0x4d')][_0x568e('0x6e')]);_0x5549e9[_0x568e('0x55')]=qs['filters'](_[_0x568e('0x56')](_0x2890b1[_0x568e('0x4d')],_0x325fa7[_0x568e('0x4c')]));if(_0x2890b1[_0x568e('0x4d')][_0x568e('0x57')]){_0x5549e9['where']=_[_0x568e('0x58')](_0x5549e9[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x5549e9[_0x568e('0x50')],function(_0x33f10b){var _0x569fdb={};_0x569fdb[_0x33f10b]={'$like':'%'+_0x2890b1['query'][_0x568e('0x57')]+'%'};return _0x569fdb;})});}_0x5549e9=_[_0x568e('0x58')]({},_0x5549e9,_0x2890b1[_0x568e('0x5a')]);return _0x3b0e40[_0x568e('0x9a')](_0x5549e9);}})[_0x568e('0x23')](function(_0x1f7728){if(_0x1f7728){_0x33e6d0=_0x1f7728['length'];if(!_0x2890b1[_0x568e('0x4d')][_0x568e('0x52')]('nolimit')){_0x5549e9[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x2890b1['query'][_0x568e('0x1f')]);_0x5549e9[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x2890b1[_0x568e('0x4d')][_0x568e('0x1d')]);}return _0x3b0e40['getApplications'](_0x5549e9);}})[_0x568e('0x23')](function(_0x3d4e36){if(_0x3d4e36){return _0x3d4e36?{'count':_0x33e6d0,'rows':_0x3d4e36}:null;}})['then'](respondWithResult(_0x196dab,null))[_0x568e('0x5e')](handleError(_0x196dab,null));};exports['getMessages']=function(_0x48ea7f,_0x88c750){var _0x4933ed={'raw':!![],'where':{}};var _0x548ae2={};var _0x518b9b={'count':0x0,'rows':[]};return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x48ea7f[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x88c750,null))[_0x568e('0x23')](function(_0x208d97){if(_0x208d97){_0x548ae2[_0x568e('0x4b')]=_['keys'](db[_0x568e('0x9b')]['rawAttributes']);_0x548ae2['query']=_[_0x568e('0x6d')](_0x48ea7f[_0x568e('0x4d')]);_0x548ae2[_0x568e('0x4c')]=_[_0x568e('0x4e')](_0x548ae2[_0x568e('0x4b')],_0x548ae2[_0x568e('0x4d')]);_0x4933ed[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x548ae2[_0x568e('0x4b')],qs['fields'](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x4f')]));_0x4933ed[_0x568e('0x50')]=_0x4933ed[_0x568e('0x50')]['length']?_0x4933ed[_0x568e('0x50')]:_0x548ae2[_0x568e('0x4b')];if(!_0x48ea7f[_0x568e('0x4d')]['hasOwnProperty'](_0x568e('0x53'))){_0x4933ed[_0x568e('0x1f')]=qs['limit'](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x1f')]);_0x4933ed[_0x568e('0x1d')]=qs[_0x568e('0x1d')](_0x48ea7f[_0x568e('0x4d')][_0x568e('0x1d')]);}_0x4933ed[_0x568e('0x54')]=qs[_0x568e('0x6e')](_0x48ea7f['query'][_0x568e('0x6e')]);_0x4933ed[_0x568e('0x55')]=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x48ea7f[_0x568e('0x4d')],_0x548ae2[_0x568e('0x4c')]));_0x4933ed[_0x568e('0x55')]['MailAccountId']=_0x208d97['id'];if(_0x48ea7f[_0x568e('0x4d')][_0x568e('0x57')]){_0x4933ed[_0x568e('0x55')]=_[_0x568e('0x58')](_0x4933ed[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x4933ed[_0x568e('0x50')],function(_0x3dd179){var _0x3c61a7={};_0x3c61a7[_0x3dd179]={'$like':'%'+_0x48ea7f[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x3c61a7;})});}if(_0x48ea7f[_0x568e('0x4d')][_0x568e('0x9c')]){var _0x2c1215=_0x48ea7f[_0x568e('0x4d')][_0x568e('0x9c')][_0x568e('0x9d')](',');var _0x32b7fd={};_0x32b7fd[_0x2c1215[0x0]]={'$gte':moment(_0x2c1215[0x1])['format'](_0x568e('0x9e'))};_0x4933ed[_0x568e('0x55')]=_[_0x568e('0x58')](_0x4933ed['where'],_0x32b7fd);}_0x4933ed=_['merge']({},_0x4933ed,_0x48ea7f[_0x568e('0x5a')]);return db['MailMessage'][_0x568e('0x5b')]({'where':_0x4933ed[_0x568e('0x55')]})[_0x568e('0x23')](function(_0x3da4df){_0x518b9b[_0x568e('0x5b')]=_0x3da4df;if(_0x48ea7f['query'][_0x568e('0x60')]){_0x4933ed[_0x568e('0x61')]=[{'all':!![]}];}return db[_0x568e('0x9b')][_0x568e('0x5c')](_0x4933ed);})[_0x568e('0x23')](function(_0x59e459){if(_0x48ea7f[_0x568e('0x4d')]['inlineCss']===_0x568e('0x9f')){for(var _0x41ab74=0x0;_0x41ab74<_0x59e459[_0x568e('0x51')];_0x41ab74++){_0x59e459[_0x41ab74][_0x568e('0x63')]=juice(_0x59e459[_0x41ab74][_0x568e('0x63')]);}}_0x518b9b[_0x568e('0x5d')]=_0x59e459;return _0x518b9b;});}})['then'](respondWithFilteredResult(_0x88c750,_0x4933ed))['catch'](handleError(_0x88c750,null));};exports['send']=function(_0xf3acac,_0x1ea593){var _0x7a4a24,_0x584b0f={},_0xdc584f;if(_0xf3acac[_0x568e('0x63')]['to']){_0xdc584f=_0xf3acac['body']['to'][_0x568e('0x9d')](',')[0x0];}return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0xf3acac[_0x568e('0x69')]['id']},'include':[{'model':db[_0x568e('0xa0')],'as':'List','include':[{'model':db[_0x568e('0x87')],'as':_0x568e('0xa1'),'where':{'email':_0xdc584f},'limit':0x1,'order':[[_0x568e('0xa2'),_0x568e('0xa3')]]}]},{'model':db[_0x568e('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x568e('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x568e('0x23')](handleEntityNotFound(_0x1ea593,null))['then'](function(_0x2b23af){if(!_0x2b23af)return;_0x7a4a24=_0x2b23af;if(!_0x2b23af[_0x568e('0x40')])throw new Error(_0x568e('0xa5'));if(_[_0x568e('0xa6')](_0xf3acac[_0x568e('0x63')]['from'])){_0xf3acac[_0x568e('0x63')][_0x568e('0xa7')]=util[_0x568e('0xa8')](_0x568e('0xa9'),_0x2b23af['name'],_0x2b23af['email']||_0x2b23af[_0x568e('0x40')][_0x568e('0x34')]);}if(_0xf3acac['body'][_0x568e('0xaa')]&&_0xf3acac[_0x568e('0x63')][_0x568e('0xaa')]['length']){for(var _0x2397a3=0x0;_0x2397a3<_0xf3acac[_0x568e('0x63')][_0x568e('0xaa')]['length'];_0x2397a3+=0x1){_0xf3acac['body']['attachments'][_0x2397a3]={'filename':_0xf3acac['body'][_0x568e('0xaa')][_0x2397a3][_0x568e('0x28')],'path':path['join'](config[_0x568e('0xab')],'server/files/attachments',_0xf3acac[_0x568e('0x63')]['attachments'][_0x2397a3][_0x568e('0xac')])};}}var _0x46f32b=_0x2b23af['getSmtpOptions']();return respondWithRpcPromise(_0x568e('0xad'),_0x568e('0xae'),{'account':_0x46f32b,'message':_0xf3acac[_0x568e('0x63')]});})[_0x568e('0x23')](function(_0x274481){if(!_0x274481)return;_0x584b0f=_0x274481;if(!_0x7a4a24[_0x568e('0xaf')])throw new Error(_0x568e('0xb0'));if(_0x7a4a24[_0x568e('0xaf')][_0x568e('0xa1')][_0x568e('0x51')])return _0x7a4a24['List'][_0x568e('0xa1')][0x0];return db[_0x568e('0x87')]['create'](_[_0x568e('0xa')](_0xf3acac[_0x568e('0x63')],{'firstName':_0xf3acac[_0x568e('0x63')]['to'],'email':_0xf3acac[_0x568e('0x63')]['to'],'phone':_0xf3acac[_0x568e('0x63')]['to'],'ListId':_0x7a4a24[_0x568e('0x76')]}));})[_0x568e('0x23')](function(_0x89a46a){if(!_0x89a46a)return;var _0x4842a1={'UserId':_0xf3acac[_0x568e('0x34')]['id'],'ContactId':_0x89a46a['id'],'MailAccountId':_0x7a4a24['id'],'inReplyTo':_0x584b0f['messageId'],'to':_0xf3acac[_0x568e('0x63')][_0x568e('0xa7')],'cc':_0xf3acac[_0x568e('0x63')]['cc'],'subject':_0xf3acac[_0x568e('0x63')][_0x568e('0xb1')],'attach':_0xf3acac['body'][_0x568e('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x568e('0x58')](_0xf3acac['body'],{'messageId':_0x584b0f[_0x568e('0xb3')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x7a4a24['id'],'UserId':_0xf3acac['user']['id'],'ContactId':_0x89a46a['id']})]};if(_0xf3acac[_0x568e('0x63')][_0x568e('0xb4')]){_0x4842a1=_['merge'](_0x4842a1,_0xf3acac[_0x568e('0x63')][_0x568e('0xb4')]);}return db[_0x568e('0x85')]['create'](_0x4842a1,{'include':[{'model':db[_0x568e('0x9b')],'as':'Messages'}]});})[_0x568e('0x23')](respondWithResult(_0x1ea593,null))[_0x568e('0x5e')](handleError(_0x1ea593,null));};exports[_0x568e('0xb5')]=function(_0x3b7f29,_0x418713){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x3b7f29[_0x568e('0x69')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x568e('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x568e('0xa4'),'raw':!![]}]}]})[_0x568e('0x23')](handleEntityNotFound(_0x418713,null))[_0x568e('0x23')](function(_0x2ff8e6){if(!_0x2ff8e6[_0x568e('0x40')])return;var _0x13522e=_0x2ff8e6['getSmtpOptions']();return respondWithRpcPromise(_0x568e('0xb6'),_0x568e('0xb5'),{'account':_0x13522e});})[_0x568e('0x23')](respondWithResult(_0x418713,null))['catch'](handleError(_0x418713,null));};exports[_0x568e('0x24')]=function(_0x1637dd,_0x340725){return db[_0x568e('0x47')][_0x568e('0x62')]({'where':{'id':_0x1637dd[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x340725,null))['then'](function(_0x20a6ae){if(_0x20a6ae&&_0x20a6ae[_0x568e('0x3d')]){throw new db[(_0x568e('0xb7'))][(_0x568e('0xb8'))](_0x568e('0xb9'));}return _0x20a6ae;})[_0x568e('0x23')](removeEntity(_0x340725,null))['catch'](handleError(_0x340725,null));};exports[_0x568e('0xba')]=function(_0x590218,_0x19857d){return db['MailAccount'][_0x568e('0x62')]({'where':{'id':_0x590218[_0x568e('0x69')]['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x19857d,null))[_0x568e('0x23')](function(_0x5c3aaf){if(_0x5c3aaf){return _0x5c3aaf[_0x568e('0xba')](_0x590218[_0x568e('0x63')][_0x568e('0x75')],_[_0x568e('0x86')](_0x590218[_0x568e('0x63')],[_0x568e('0x75'),'id'])||{})[_0x568e('0xbb')](function(_0x5ebf9f){for(var _0xef0f66=0x0;_0xef0f66<_0x590218[_0x568e('0x63')][_0x568e('0x75')][_0x568e('0x51')];_0xef0f66+=0x1){socket[_0x568e('0xbc')](_0x568e('0xbd'),{'UserId':Number(_0x590218['body'][_0x568e('0x75')][_0xef0f66]),'MailAccountId':Number(_0x590218[_0x568e('0x69')]['id'])});}return _0x5ebf9f;});}})[_0x568e('0x23')](respondWithResult(_0x19857d,null))['catch'](handleError(_0x19857d,null));};exports['removeAgents']=function(_0x15f260,_0x5b907e){return db['MailAccount']['find']({'where':{'id':_0x15f260['params']['id']}})[_0x568e('0x23')](handleEntityNotFound(_0x5b907e,null))['then'](function(_0x337343){if(_0x337343){return _0x337343['removeAgents'](_0x15f260[_0x568e('0x4d')][_0x568e('0x75')])[_0x568e('0x23')](function(){if(_[_0x568e('0xbe')](_0x15f260[_0x568e('0x4d')][_0x568e('0x75')])){for(var _0x5e3e27=0x0;_0x5e3e27<_0x15f260[_0x568e('0x4d')]['ids'][_0x568e('0x51')];_0x5e3e27+=0x1){socket[_0x568e('0xbc')](_0x568e('0xbf'),{'UserId':Number(_0x15f260[_0x568e('0x4d')][_0x568e('0x75')][_0x5e3e27]),'MailAccountId':Number(_0x15f260[_0x568e('0x69')]['id'])});}}else{socket[_0x568e('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x15f260['query'][_0x568e('0x75')]),'MailAccountId':Number(_0x15f260[_0x568e('0x69')]['id'])});}});}})[_0x568e('0x23')](respondWithStatusCode(_0x5b907e,null))[_0x568e('0x5e')](handleError(_0x5b907e,null));};exports[_0x568e('0xc0')]=function(_0x6ebc3c,_0x10746d){var _0x31c335={};var _0x520f0c={};var _0x425b76;var _0x5d6365;return db[_0x568e('0x47')][_0x568e('0x72')]({'where':{'id':_0x6ebc3c[_0x568e('0x69')]['id']}})['then'](handleEntityNotFound(_0x10746d,null))['then'](function(_0x57bc45){if(_0x57bc45){_0x425b76=_0x57bc45;_0x520f0c['model']=_[_0x568e('0x6d')](db[_0x568e('0x89')][_0x568e('0x48')]);_0x520f0c[_0x568e('0x4d')]=_[_0x568e('0x6d')](_0x6ebc3c[_0x568e('0x4d')]);_0x520f0c[_0x568e('0x4c')]=_['intersection'](_0x520f0c[_0x568e('0x4b')],_0x520f0c[_0x568e('0x4d')]);_0x31c335[_0x568e('0x50')]=_[_0x568e('0x4e')](_0x520f0c['model'],qs[_0x568e('0x4f')](_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x4f')]));_0x31c335[_0x568e('0x50')]=_0x31c335[_0x568e('0x50')][_0x568e('0x51')]?_0x31c335['attributes']:_0x520f0c[_0x568e('0x4b')];_0x31c335['order']=qs[_0x568e('0x6e')](_0x6ebc3c[_0x568e('0x4d')]['sort']);_0x31c335['where']=qs[_0x568e('0x4c')](_[_0x568e('0x56')](_0x6ebc3c[_0x568e('0x4d')],_0x520f0c['filters']));if(_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x57')]){_0x31c335[_0x568e('0x55')]=_['merge'](_0x31c335[_0x568e('0x55')],{'$or':_[_0x568e('0x46')](_0x31c335[_0x568e('0x50')],function(_0x194f61){var _0x4809e8={};_0x4809e8[_0x194f61]={'$like':'%'+_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x57')]+'%'};return _0x4809e8;})});}_0x31c335=_[_0x568e('0x58')]({},_0x31c335,_0x6ebc3c['options']);return _0x425b76[_0x568e('0xc0')](_0x31c335);}})[_0x568e('0x23')](function(_0x156eb0){if(_0x156eb0){_0x5d6365=_0x156eb0['length'];if(!_0x6ebc3c[_0x568e('0x4d')][_0x568e('0x52')](_0x568e('0x53'))){_0x31c335[_0x568e('0x1f')]=qs[_0x568e('0x1f')](_0x6ebc3c['query']['limit']);_0x31c335['offset']=qs[_0x568e('0x1d')](_0x6ebc3c[_0x568e('0x4d')]['offset']);}return _0x425b76[_0x568e('0xc0')](_0x31c335);}})[_0x568e('0x23')](function(_0x55725e){if(_0x55725e){return _0x55725e?{'count':_0x5d6365,'rows':_0x55725e}:null;}})[_0x568e('0x23')](respondWithResult(_0x10746d,null))[_0x568e('0x5e')](handleError(_0x10746d,null));}; \ No newline at end of file +var _0x6b0b=['out','Interaction','Messages','VerifySmtp','verifySmtp','service','Sequelize','ValidationError','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','MailAccounts','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','username','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','key','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','options','find','body','provider','custom','secure','Pause','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','User','Owner','fullname','Tag','color','tag','addApplications','transaction','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','CloudProvider','from','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x6b0b,0xcf));var _0xb6b0=function(_0x287b23,_0x365235){_0x287b23=_0x287b23-0x0;var _0x49651e=_0x6b0b[_0x287b23];return _0x49651e;};'use strict';var moment=require(_0xb6b0('0x0'));var BPromise=require(_0xb6b0('0x1'));var util=require(_0xb6b0('0x2'));var path=require(_0xb6b0('0x3'));var _=require(_0xb6b0('0x4'));var juice=require(_0xb6b0('0x5'));var Redis=require(_0xb6b0('0x6'));var qs=require(_0xb6b0('0x7'));var logger=require(_0xb6b0('0x8'))(_0xb6b0('0x9'));var config=require(_0xb6b0('0xa'));var db=require(_0xb6b0('0xb'))['db'];config[_0xb6b0('0xc')]=_[_0xb6b0('0xd')](config[_0xb6b0('0xc')],{'host':_0xb6b0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6b0('0xc')]));require(_0xb6b0('0xf'))[_0xb6b0('0x10')](socket);var jayson=require(_0xb6b0('0x11'));var client=jayson['client'][_0xb6b0('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x24c4e4,_0x3450a6,_0x16e8b2,_0x4242a6){return new BPromise(function(_0x3b60f4,_0x1c430e){var _0x39478d=_0x4242a6||client;return _0x39478d[_0xb6b0('0x13')](_0x24c4e4,_0x16e8b2)[_0xb6b0('0x14')](function(_0x6413d5){logger['info'](_0xb6b0('0x15'),_0x3450a6,_0xb6b0('0x16'));logger[_0xb6b0('0x17')](_0xb6b0('0x18'),_0x3450a6,_0xb6b0('0x16'),JSON[_0xb6b0('0x19')](_0x6413d5));if(_0x6413d5[_0xb6b0('0x1a')]){if(_0x6413d5[_0xb6b0('0x1a')]['code']===0x1f4){logger[_0xb6b0('0x1a')](_0xb6b0('0x15'),_0x3450a6,_0x6413d5[_0xb6b0('0x1a')][_0xb6b0('0x1b')]);return _0x1c430e(_0x6413d5[_0xb6b0('0x1a')][_0xb6b0('0x1b')]);}logger['error'](_0xb6b0('0x15'),_0x3450a6,_0x6413d5[_0xb6b0('0x1a')][_0xb6b0('0x1b')]);return _0x3b60f4(_0x6413d5['error'][_0xb6b0('0x1b')]);}else{logger[_0xb6b0('0x1c')]('MailAccount,\x20%s,\x20%s',_0x3450a6,'request\x20sent');_0x3b60f4(_0x6413d5[_0xb6b0('0x1d')]['message']);}})[_0xb6b0('0x1e')](function(_0x2e4882){logger['error'](_0xb6b0('0x15'),_0x3450a6,_0x2e4882);_0x1c430e(_0x2e4882);});});}function respondWithStatusCode(_0x4d13db,_0x1b9b6b){_0x1b9b6b=_0x1b9b6b||0xcc;return function(_0x5f4503){if(_0x5f4503){return _0x4d13db[_0xb6b0('0x1f')](_0x1b9b6b);}return _0x4d13db[_0xb6b0('0x20')](_0x1b9b6b)[_0xb6b0('0x21')]();};}function respondWithResult(_0x222cb7,_0x370fb6){_0x370fb6=_0x370fb6||0xc8;return function(_0x1240e3){if(_0x1240e3){return _0x222cb7[_0xb6b0('0x20')](_0x370fb6)[_0xb6b0('0x22')](_0x1240e3);}};}function respondWithFilteredResult(_0x17065e,_0x427e17){return function(_0x233db4){if(_0x233db4){var _0x2f217a=typeof _0x427e17[_0xb6b0('0x23')]===_0xb6b0('0x24')&&typeof _0x427e17[_0xb6b0('0x25')]===_0xb6b0('0x24');var _0x45836f=_0x233db4[_0xb6b0('0x26')];var _0x4639b7=_0x2f217a?0x0:_0x427e17[_0xb6b0('0x23')];var _0x4893cf=_0x2f217a?_0x233db4[_0xb6b0('0x26')]:_0x427e17[_0xb6b0('0x23')]+_0x427e17[_0xb6b0('0x25')];var _0x5d7c6d;if(_0x4893cf>=_0x45836f){_0x4893cf=_0x45836f;_0x5d7c6d=0xc8;}else{_0x5d7c6d=0xce;}_0x17065e[_0xb6b0('0x20')](_0x5d7c6d);return _0x17065e[_0xb6b0('0x27')](_0xb6b0('0x28'),_0x4639b7+'-'+_0x4893cf+'/'+_0x45836f)[_0xb6b0('0x22')](_0x233db4);}return null;};}function saveUpdates(_0x3396b4){return function(_0x592350){if(_0x592350){return _0x592350['update'](_0x3396b4)['then'](function(_0xa98620){return _0xa98620;});}return null;};}function removeEntity(_0x3aa840){return function(_0x46ddd1){if(_0x46ddd1){return _0x46ddd1[_0xb6b0('0x29')]()['then'](function(){var _0x52aa22=_0x46ddd1['get']({'plain':!![]});var _0x59a738=_0xb6b0('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x59a738,'resourceId':_0x52aa22['id']}})[_0xb6b0('0x14')](function(){return _0x46ddd1;});})['then'](function(){_0x3aa840[_0xb6b0('0x20')](0xcc)[_0xb6b0('0x21')]();});}};}function handleEntityNotFound(_0x45d15e){return function(_0x24c023){if(!_0x24c023){_0x45d15e[_0xb6b0('0x1f')](0x194);}return _0x24c023;};}function handleError(_0x23b5b9,_0x37bf70){_0x37bf70=_0x37bf70||0x1f4;return function(_0x135a0e){logger[_0xb6b0('0x1a')](_0x135a0e[_0xb6b0('0x2b')]);if(_0x135a0e['name']){delete _0x135a0e[_0xb6b0('0x2c')];}_0x23b5b9[_0xb6b0('0x20')](_0x37bf70)[_0xb6b0('0x2d')](_0x135a0e);};}function getImapHost(_0x48b782){switch(_0x48b782){case _0xb6b0('0x2e'):return'imap.gmail.com';case _0xb6b0('0x2f'):return _0xb6b0('0x30');case _0xb6b0('0x31'):return _0xb6b0('0x32');case _0xb6b0('0x33'):return _0xb6b0('0x34');}throw new Error(_0xb6b0('0x35'),_0x48b782);}function getSmtpHost(_0x13e53e){switch(_0x13e53e){case _0xb6b0('0x2e'):return _0xb6b0('0x36');case'yahoo':return _0xb6b0('0x37');case _0xb6b0('0x31'):return _0xb6b0('0x38');case _0xb6b0('0x33'):return _0xb6b0('0x39');}throw new Error(_0xb6b0('0x35'),_0x13e53e);}function getAuthenticationOptions(_0x396c1b,_0x1094ac){var _0x4072bd={};var _0x1ebd6d={};if(_0x396c1b){_0x4072bd[_0xb6b0('0x3a')]=_0x1ebd6d[_0xb6b0('0x3a')]=_0x1094ac['username'];_0x4072bd[_0xb6b0('0x3b')]=_0x1ebd6d['pass']=_0x1094ac[_0xb6b0('0x3b')];if(_0x1094ac[_0xb6b0('0x3c')]){_0x4072bd[_0xb6b0('0x3c')]=_0x1ebd6d[_0xb6b0('0x3c')]=!![];_0x4072bd[_0xb6b0('0x3d')]=_0x1ebd6d[_0xb6b0('0x3d')]=_0x1094ac[_0xb6b0('0x3d')];_0x4072bd[_0xb6b0('0x3b')]=_0x1ebd6d[_0xb6b0('0x3e')]=null;}else{_0x4072bd[_0xb6b0('0x3d')]=_0x1ebd6d['CloudProviderId']=null;}_0x4072bd[_0xb6b0('0x3f')]=getImapHost(_0x396c1b);_0x4072bd['port']=0x3e1;_0x1ebd6d[_0xb6b0('0x3f')]=getSmtpHost(_0x396c1b);_0x1ebd6d[_0xb6b0('0x40')]=0x24b;_0x1ebd6d['secure']=![];_0x4072bd['service']=_0x1ebd6d['service']=null;}else{if(_0x1094ac['authentication']){_0x4072bd['user']=_0x1ebd6d[_0xb6b0('0x3a')]=_0x1094ac[_0xb6b0('0x41')];_0x4072bd['password']=_0x1ebd6d[_0xb6b0('0x3e')]=_0x1094ac[_0xb6b0('0x3b')];}else{_0x4072bd['authentication']=_0x1ebd6d[_0xb6b0('0x42')]=![];_0x4072bd[_0xb6b0('0x3a')]=_0x1ebd6d[_0xb6b0('0x3a')]=null;_0x4072bd[_0xb6b0('0x3b')]=_0x1ebd6d['pass']=null;}_0x4072bd[_0xb6b0('0x3f')]=_0x1094ac[_0xb6b0('0x43')][_0xb6b0('0x3f')];_0x4072bd[_0xb6b0('0x40')]=_0x1094ac[_0xb6b0('0x43')][_0xb6b0('0x40')];_0x1ebd6d[_0xb6b0('0x3f')]=_0x1094ac['Smtp'][_0xb6b0('0x3f')];_0x1ebd6d[_0xb6b0('0x40')]=_0x1094ac[_0xb6b0('0x44')]['port'];}return{'Imap':_0x4072bd,'Smtp':_0x1ebd6d};}exports[_0xb6b0('0x45')]=function(_0x3a68b9,_0x1a158a){var _0x1c6baf={'include':[{'model':db[_0xb6b0('0x46')],'as':'Imap'},{'model':db[_0xb6b0('0x47')],'as':'Smtp'},{'model':db['Pause'],'as':_0xb6b0('0x48')}]},_0x1aabe5={},_0x10f69f={'count':0x0,'rows':[]};var _0x10c4ee=_[_0xb6b0('0x49')](db[_0xb6b0('0x4a')]['rawAttributes'],function(_0x56f897){return{'name':_0x56f897['fieldName'],'type':_0x56f897['type'][_0xb6b0('0x4b')]};});_0x1aabe5['model']=_['map'](_0x10c4ee,_0xb6b0('0x2c'));_0x1aabe5[_0xb6b0('0x4c')]=_[_0xb6b0('0x4d')](_0x3a68b9[_0xb6b0('0x4c')]);_0x1aabe5[_0xb6b0('0x4e')]=_['intersection'](_0x1aabe5[_0xb6b0('0x4f')],_0x1aabe5[_0xb6b0('0x4c')]);_0x1c6baf[_0xb6b0('0x50')]=_['intersection'](_0x1aabe5['model'],qs[_0xb6b0('0x51')](_0x3a68b9[_0xb6b0('0x4c')]['fields']));_0x1c6baf[_0xb6b0('0x50')]=_0x1c6baf['attributes'][_0xb6b0('0x52')]?_0x1c6baf[_0xb6b0('0x50')]:_0x1aabe5[_0xb6b0('0x4f')];if(!_0x3a68b9[_0xb6b0('0x4c')]['hasOwnProperty']('nolimit')){_0x1c6baf[_0xb6b0('0x25')]=qs[_0xb6b0('0x25')](_0x3a68b9[_0xb6b0('0x4c')]['limit']);_0x1c6baf['offset']=qs['offset'](_0x3a68b9[_0xb6b0('0x4c')][_0xb6b0('0x23')]);}_0x1c6baf[_0xb6b0('0x53')]=qs[_0xb6b0('0x54')](_0x3a68b9[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x1c6baf[_0xb6b0('0x55')]=qs[_0xb6b0('0x4e')](_[_0xb6b0('0x56')](_0x3a68b9[_0xb6b0('0x4c')],_0x1aabe5[_0xb6b0('0x4e')]),_0x10c4ee);if(_0x3a68b9[_0xb6b0('0x4c')][_0xb6b0('0x57')]){_0x1c6baf[_0xb6b0('0x55')]=_['merge'](_0x1c6baf[_0xb6b0('0x55')],{'$or':_[_0xb6b0('0x49')](_0x10c4ee,function(_0x1ecdfb){if(_0x1ecdfb['type']!=='VIRTUAL'){var _0x3c94ad={};_0x3c94ad[_0x1ecdfb[_0xb6b0('0x2c')]]={'$like':'%'+_0x3a68b9[_0xb6b0('0x4c')][_0xb6b0('0x57')]+'%'};return _0x3c94ad;}})});}_0x1c6baf=_[_0xb6b0('0x58')]({},_0x1c6baf,_0x3a68b9['options']);var _0x131a7d={'where':_0x1c6baf['where']};return db['MailAccount'][_0xb6b0('0x26')](_0x131a7d)[_0xb6b0('0x14')](function(_0x28f11c){_0x10f69f[_0xb6b0('0x26')]=_0x28f11c;if(_0x3a68b9[_0xb6b0('0x4c')][_0xb6b0('0x59')]){_0x1c6baf[_0xb6b0('0x5a')]=[{'all':!![]}];}return db[_0xb6b0('0x4a')][_0xb6b0('0x5b')](_0x1c6baf);})[_0xb6b0('0x14')](function(_0x336350){_0x10f69f[_0xb6b0('0x5c')]=_0x336350;return _0x10f69f;})[_0xb6b0('0x14')](respondWithFilteredResult(_0x1a158a,_0x1c6baf))[_0xb6b0('0x1e')](handleError(_0x1a158a,null));};exports[_0xb6b0('0x5d')]=function(_0x42c446,_0x2a0119){var _0x5f3a88={'raw':![],'where':{'id':_0x42c446[_0xb6b0('0x5e')]['id']},'include':[{'model':db[_0xb6b0('0x46')],'as':'Imap'},{'model':db[_0xb6b0('0x47')],'as':_0xb6b0('0x44')},{'model':db['Pause'],'as':_0xb6b0('0x48')}]},_0xc99032={};_0xc99032[_0xb6b0('0x4f')]=_[_0xb6b0('0x4d')](db[_0xb6b0('0x4a')][_0xb6b0('0x5f')]);_0xc99032[_0xb6b0('0x4c')]=_['keys'](_0x42c446[_0xb6b0('0x4c')]);_0xc99032[_0xb6b0('0x4e')]=_[_0xb6b0('0x60')](_0xc99032[_0xb6b0('0x4f')],_0xc99032[_0xb6b0('0x4c')]);_0x5f3a88[_0xb6b0('0x50')]=_[_0xb6b0('0x60')](_0xc99032[_0xb6b0('0x4f')],qs[_0xb6b0('0x51')](_0x42c446[_0xb6b0('0x4c')][_0xb6b0('0x51')]));_0x5f3a88['attributes']=_0x5f3a88['attributes'][_0xb6b0('0x52')]?_0x5f3a88['attributes']:_0xc99032['model'];if(_0x42c446['query'][_0xb6b0('0x59')]){_0x5f3a88['include']=[{'all':!![]}];}_0x5f3a88=_['merge']({},_0x5f3a88,_0x42c446[_0xb6b0('0x61')]);return db[_0xb6b0('0x4a')][_0xb6b0('0x62')](_0x5f3a88)[_0xb6b0('0x14')](handleEntityNotFound(_0x2a0119,null))[_0xb6b0('0x14')](respondWithResult(_0x2a0119,null))[_0xb6b0('0x1e')](handleError(_0x2a0119,null));};exports['update']=function(_0x469bc9,_0x478dc4){if(_0x469bc9['body']['id']){delete _0x469bc9['body']['id'];}var _0x3f69d5=_0x469bc9[_0xb6b0('0x63')][_0xb6b0('0x64')]===_0xb6b0('0x65')?null:_0x469bc9['body'][_0xb6b0('0x64')];var _0x24c7bb=_0x469bc9[_0xb6b0('0x63')]['Imap']||{};var _0x2a6a5d=_0x469bc9[_0xb6b0('0x63')][_0xb6b0('0x44')]||{};if(_0x3f69d5){_0x24c7bb[_0xb6b0('0x3f')]=getImapHost(_0x3f69d5);_0x24c7bb['port']=0x3e1;_0x2a6a5d['host']=getSmtpHost(_0x3f69d5);_0x2a6a5d[_0xb6b0('0x40')]=0x24b;_0x2a6a5d[_0xb6b0('0x66')]=![];}if(_0x2a6a5d[_0xb6b0('0x3c')]){_0x2a6a5d[_0xb6b0('0x66')]=![];}else{_0x2a6a5d[_0xb6b0('0x3d')]=null;}if(!_0x24c7bb['modernAuthentication'])_0x24c7bb['CloudProviderId']=null;_0x469bc9['body'][_0xb6b0('0x43')]=_0x24c7bb;_0x469bc9[_0xb6b0('0x63')][_0xb6b0('0x44')]=_0x2a6a5d;return db['MailAccount']['find']({'where':{'id':_0x469bc9[_0xb6b0('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb6b0('0x43')},{'model':db['MailServerOut'],'as':_0xb6b0('0x44')},{'model':db[_0xb6b0('0x67')],'as':'mandatoryDispositionPause'}]})[_0xb6b0('0x14')](handleEntityNotFound(_0x478dc4,null))[_0xb6b0('0x14')](function(_0x383da9){if(!_0x383da9)throw new Error('Mail\x20Account\x20not\x20found');if(_0x383da9['service'])delete _0x469bc9['body'][_0xb6b0('0x43')];return _0x383da9;})[_0xb6b0('0x14')](saveUpdates(_0x469bc9['body'],null))[_0xb6b0('0x14')](function(_0x26c9d8){if(!_0x469bc9[_0xb6b0('0x63')][_0xb6b0('0x43')])return _0x26c9d8;return db['MailServerIn'][_0xb6b0('0x68')](_0x469bc9[_0xb6b0('0x63')]['Imap'],{'where':{'MailAccountId':_0x26c9d8['id']}})[_0xb6b0('0x14')](function(){return _0x26c9d8;});})['then'](function(_0xf75f7){if(!_0x469bc9[_0xb6b0('0x63')][_0xb6b0('0x44')])return _0xf75f7;return db['MailServerOut'][_0xb6b0('0x68')](_0x469bc9[_0xb6b0('0x63')]['Smtp'],{'where':{'MailAccountId':_0xf75f7['id']}})['then'](function(){return _0xf75f7;});})[_0xb6b0('0x14')](respondWithResult(_0x478dc4,null))[_0xb6b0('0x1e')](handleError(_0x478dc4,null));};exports['describe']=function(_0x5511ff,_0x3d763a){return db[_0xb6b0('0x4a')][_0xb6b0('0x69')]()[_0xb6b0('0x14')](respondWithResult(_0x3d763a,null))['catch'](handleError(_0x3d763a,null));};exports[_0xb6b0('0x6a')]=function(_0x5d53bb,_0x1188b8){if(_0x5d53bb['body']['id']){delete _0x5d53bb[_0xb6b0('0x63')]['id'];}return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x5d53bb[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x1188b8,null))['then'](function(_0x20e22c){if(_0x20e22c){_0x5d53bb['body'][_0xb6b0('0x6b')]=_0x20e22c['id'];return db[_0xb6b0('0x6c')][_0xb6b0('0x6d')](_0x5d53bb[_0xb6b0('0x63')]);}})[_0xb6b0('0x14')](respondWithResult(_0x1188b8,null))['catch'](handleError(_0x1188b8,null));};exports[_0xb6b0('0x6e')]=function(_0x53be7e,_0x78d45c){var _0x2ede4a={'raw':![],'where':{}};var _0x414f0f={};var _0x1f7581={'count':0x0,'rows':[]};return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x53be7e['params']['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x78d45c,null))[_0xb6b0('0x14')](function(_0x382bf4){if(_0x382bf4){_0x414f0f[_0xb6b0('0x4f')]=_[_0xb6b0('0x4d')](db[_0xb6b0('0x6c')]['rawAttributes']);_0x414f0f[_0xb6b0('0x4c')]=_['keys'](_0x53be7e[_0xb6b0('0x4c')]);_0x414f0f[_0xb6b0('0x4e')]=_[_0xb6b0('0x60')](_0x414f0f['model'],_0x414f0f[_0xb6b0('0x4c')]);_0x2ede4a[_0xb6b0('0x50')]=_['intersection'](_0x414f0f[_0xb6b0('0x4f')],qs[_0xb6b0('0x51')](_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x51')]));_0x2ede4a['attributes']=_0x2ede4a[_0xb6b0('0x50')][_0xb6b0('0x52')]?_0x2ede4a['attributes']:_0x414f0f[_0xb6b0('0x4f')];if(!_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x70')](_0xb6b0('0x71'))){_0x2ede4a[_0xb6b0('0x25')]=qs[_0xb6b0('0x25')](_0x53be7e[_0xb6b0('0x4c')]['limit']);_0x2ede4a[_0xb6b0('0x23')]=qs[_0xb6b0('0x23')](_0x53be7e[_0xb6b0('0x4c')]['offset']);}_0x2ede4a[_0xb6b0('0x53')]=qs['sort'](_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x2ede4a[_0xb6b0('0x55')]=qs[_0xb6b0('0x4e')](_[_0xb6b0('0x56')](_0x53be7e[_0xb6b0('0x4c')],_0x414f0f[_0xb6b0('0x4e')]));_0x2ede4a[_0xb6b0('0x55')][_0xb6b0('0x6b')]=_0x382bf4['id'];if(_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x57')]){_0x2ede4a[_0xb6b0('0x55')]=_[_0xb6b0('0x58')](_0x2ede4a[_0xb6b0('0x55')],{'$or':_[_0xb6b0('0x49')](_0x2ede4a['attributes'],function(_0x4f4541){var _0x28cbe8={};_0x28cbe8[_0x4f4541]={'$like':'%'+_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x57')]+'%'};return _0x28cbe8;})});}_0x2ede4a=_[_0xb6b0('0x58')]({},_0x2ede4a,_0x53be7e['options']);return db['Disposition'][_0xb6b0('0x26')]({'where':_0x2ede4a[_0xb6b0('0x55')]})[_0xb6b0('0x14')](function(_0x534291){_0x1f7581[_0xb6b0('0x26')]=_0x534291;if(_0x53be7e[_0xb6b0('0x4c')][_0xb6b0('0x59')]){_0x2ede4a[_0xb6b0('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xb6b0('0x5b')](_0x2ede4a);})[_0xb6b0('0x14')](function(_0xda8efe){_0x1f7581[_0xb6b0('0x5c')]=_0xda8efe;return _0x1f7581;});}})[_0xb6b0('0x14')](respondWithFilteredResult(_0x78d45c,_0x2ede4a))[_0xb6b0('0x1e')](handleError(_0x78d45c,null));};exports[_0xb6b0('0x72')]=function(_0x2fd6f4,_0x53d090){return db[_0xb6b0('0x4a')]['find']({'where':{'id':_0x2fd6f4[_0xb6b0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x53d090,null))[_0xb6b0('0x14')](function(_0x3774a6){if(_0x3774a6){return _0x3774a6[_0xb6b0('0x72')](_0x2fd6f4[_0xb6b0('0x4c')][_0xb6b0('0x73')]);}})[_0xb6b0('0x14')](respondWithStatusCode(_0x53d090,null))[_0xb6b0('0x1e')](handleError(_0x53d090,null));};exports[_0xb6b0('0x74')]=function(_0x18d6f4,_0x3fe072){if(_0x18d6f4[_0xb6b0('0x63')]['id']){delete _0x18d6f4[_0xb6b0('0x63')]['id'];}return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x18d6f4[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x3fe072,null))['then'](function(_0x51748d){if(_0x51748d){_0x18d6f4[_0xb6b0('0x63')]['MailAccountId']=_0x51748d['id'];return db[_0xb6b0('0x75')][_0xb6b0('0x6d')](_0x18d6f4['body']);}})[_0xb6b0('0x14')](respondWithResult(_0x3fe072,null))[_0xb6b0('0x1e')](handleError(_0x3fe072,null));};exports[_0xb6b0('0x76')]=function(_0x8d5a79,_0x276d01){var _0xc6b3a8={'raw':![],'where':{}};var _0x5b910e={};var _0x20c323={'count':0x0,'rows':[]};return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x8d5a79[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x276d01,null))['then'](function(_0x4c84e6){if(_0x4c84e6){_0x5b910e[_0xb6b0('0x4f')]=_[_0xb6b0('0x4d')](db[_0xb6b0('0x75')][_0xb6b0('0x5f')]);_0x5b910e[_0xb6b0('0x4c')]=_[_0xb6b0('0x4d')](_0x8d5a79['query']);_0x5b910e[_0xb6b0('0x4e')]=_[_0xb6b0('0x60')](_0x5b910e[_0xb6b0('0x4f')],_0x5b910e[_0xb6b0('0x4c')]);_0xc6b3a8['attributes']=_[_0xb6b0('0x60')](_0x5b910e[_0xb6b0('0x4f')],qs[_0xb6b0('0x51')](_0x8d5a79['query'][_0xb6b0('0x51')]));_0xc6b3a8[_0xb6b0('0x50')]=_0xc6b3a8[_0xb6b0('0x50')][_0xb6b0('0x52')]?_0xc6b3a8[_0xb6b0('0x50')]:_0x5b910e['model'];if(!_0x8d5a79['query']['hasOwnProperty'](_0xb6b0('0x71'))){_0xc6b3a8['limit']=qs['limit'](_0x8d5a79['query']['limit']);_0xc6b3a8['offset']=qs['offset'](_0x8d5a79[_0xb6b0('0x4c')]['offset']);}_0xc6b3a8[_0xb6b0('0x53')]=qs[_0xb6b0('0x54')](_0x8d5a79[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0xc6b3a8[_0xb6b0('0x55')]=qs[_0xb6b0('0x4e')](_[_0xb6b0('0x56')](_0x8d5a79[_0xb6b0('0x4c')],_0x5b910e[_0xb6b0('0x4e')]));_0xc6b3a8[_0xb6b0('0x55')][_0xb6b0('0x6b')]=_0x4c84e6['id'];if(_0x8d5a79[_0xb6b0('0x4c')]['filter']){_0xc6b3a8['where']=_[_0xb6b0('0x58')](_0xc6b3a8[_0xb6b0('0x55')],{'$or':_[_0xb6b0('0x49')](_0xc6b3a8[_0xb6b0('0x50')],function(_0xac4dbc){var _0x446e8a={};_0x446e8a[_0xac4dbc]={'$like':'%'+_0x8d5a79[_0xb6b0('0x4c')][_0xb6b0('0x57')]+'%'};return _0x446e8a;})});}_0xc6b3a8=_[_0xb6b0('0x58')]({},_0xc6b3a8,_0x8d5a79[_0xb6b0('0x61')]);return db[_0xb6b0('0x75')][_0xb6b0('0x26')]({'where':_0xc6b3a8[_0xb6b0('0x55')]})[_0xb6b0('0x14')](function(_0x16358e){_0x20c323[_0xb6b0('0x26')]=_0x16358e;if(_0x8d5a79[_0xb6b0('0x4c')][_0xb6b0('0x59')]){_0xc6b3a8['include']=[{'all':!![]}];}return db[_0xb6b0('0x75')]['findAll'](_0xc6b3a8);})['then'](function(_0x5ea390){_0x20c323[_0xb6b0('0x5c')]=_0x5ea390;return _0x20c323;});}})[_0xb6b0('0x14')](respondWithFilteredResult(_0x276d01,_0xc6b3a8))['catch'](handleError(_0x276d01,null));};exports[_0xb6b0('0x77')]=function(_0x52077b,_0x4ddb4e){return db['MailAccount'][_0xb6b0('0x62')]({'where':{'id':_0x52077b[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x4ddb4e,null))[_0xb6b0('0x14')](function(_0x3a5ab2){if(_0x3a5ab2){return _0x3a5ab2[_0xb6b0('0x77')](_0x52077b[_0xb6b0('0x4c')][_0xb6b0('0x73')]);}})[_0xb6b0('0x14')](respondWithStatusCode(_0x4ddb4e,null))['catch'](handleError(_0x4ddb4e,null));};exports[_0xb6b0('0x6d')]=function(_0x471ed9,_0x26bc55){var _0x2d6418={'name':_0x471ed9[_0xb6b0('0x63')]['name'],'key':_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x4b')],'provider':_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x64')]===_0xb6b0('0x65')?null:_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x64')],'email':_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x78')],'ListId':_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x79')],'active':!_[_0xb6b0('0x7a')](_0x471ed9[_0xb6b0('0x63')]['active'])?_0x471ed9['body'][_0xb6b0('0x7b')]:!![],'description':_0x471ed9[_0xb6b0('0x63')][_0xb6b0('0x7c')]||null};var _0x15c900=getAuthenticationOptions(_0x2d6418[_0xb6b0('0x64')],_0x471ed9[_0xb6b0('0x63')]);_0x2d6418[_0xb6b0('0x43')]=_0x15c900[_0xb6b0('0x43')];_0x2d6418[_0xb6b0('0x44')]=_0x15c900[_0xb6b0('0x44')];return db[_0xb6b0('0x4a')][_0xb6b0('0x6d')](_0x2d6418,{'include':[{'model':db[_0xb6b0('0x47')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xb6b0('0x14')](function(_0x261232){var _0x16957f=_0x471ed9[_0xb6b0('0x3a')]['get']({'plain':!![]});if(!_0x16957f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16957f[_0xb6b0('0x7d')]===_0xb6b0('0x3a')){var _0x1a21fc=_0x261232[_0xb6b0('0x7e')]({'plain':!![]});return db[_0xb6b0('0x7f')][_0xb6b0('0x62')]({'where':{'name':_0xb6b0('0x2a'),'userProfileId':_0x16957f[_0xb6b0('0x80')]},'raw':!![]})[_0xb6b0('0x14')](function(_0x41d890){if(_0x41d890&&_0x41d890[_0xb6b0('0x81')]===0x0){return db[_0xb6b0('0x82')][_0xb6b0('0x6d')]({'name':_0x1a21fc['name'],'resourceId':_0x1a21fc['id'],'type':_0x41d890['name'],'sectionId':_0x41d890['id']},{})[_0xb6b0('0x14')](function(){return _0x261232;});}else{return _0x261232;}})['catch'](function(_0x12a055){logger['error'](_0xb6b0('0x83'),_0x12a055);throw _0x12a055;});}return _0x261232;})[_0xb6b0('0x14')](respondWithResult(_0x26bc55,0xc9))[_0xb6b0('0x1e')](handleError(_0x26bc55,null));};exports[_0xb6b0('0x84')]=function(_0x429491,_0x4acfa9){return db['MailAccount'][_0xb6b0('0x6f')]({'where':{'id':_0x429491[_0xb6b0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4acfa9,null))[_0xb6b0('0x14')](function(_0x235823){if(_0x235823){return _0x235823[_0xb6b0('0x84')]();}return null;})[_0xb6b0('0x14')](respondWithResult(_0x4acfa9,null))[_0xb6b0('0x1e')](handleError(_0x4acfa9,null));};exports['addImap']=function(_0x4767c3,_0x52f68a){if(_0x4767c3['body']['id']){delete _0x4767c3[_0xb6b0('0x63')]['id'];}return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x4767c3[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x52f68a,null))['then'](function(_0x26dce){if(_0x26dce){_0x4767c3[_0xb6b0('0x63')][_0xb6b0('0x6b')]=_0x26dce['id'];return db[_0xb6b0('0x46')]['create'](_0x4767c3[_0xb6b0('0x63')]);}})[_0xb6b0('0x14')](respondWithResult(_0x52f68a,null))[_0xb6b0('0x1e')](handleError(_0x52f68a,null));};exports[_0xb6b0('0x85')]=function(_0x451c28,_0x71a44f){return db[_0xb6b0('0x4a')]['findOne']({'where':{'id':_0x451c28[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x71a44f,null))['then'](function(_0x1c42fe){if(_0x1c42fe){return _0x1c42fe[_0xb6b0('0x86')](null);}return null;})[_0xb6b0('0x14')](respondWithStatusCode(_0x71a44f,null))[_0xb6b0('0x1e')](handleError(_0x71a44f,null));};exports[_0xb6b0('0x87')]=function(_0x2ae175,_0x41988a){return db['MailAccount'][_0xb6b0('0x6f')]({'where':{'id':_0x2ae175['params']['id']}})['then'](handleEntityNotFound(_0x41988a,null))[_0xb6b0('0x14')](function(_0x22c33a){if(_0x22c33a){return _0x22c33a['getSmtp']();}return null;})[_0xb6b0('0x14')](respondWithResult(_0x41988a,null))[_0xb6b0('0x1e')](handleError(_0x41988a,null));};exports[_0xb6b0('0x88')]=function(_0x232bb8,_0x1f2cc9){if(_0x232bb8[_0xb6b0('0x63')]['id']){delete _0x232bb8[_0xb6b0('0x63')]['id'];}return db['MailAccount'][_0xb6b0('0x62')]({'where':{'id':_0x232bb8[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x1f2cc9,null))[_0xb6b0('0x14')](function(_0x1d4dda){if(_0x1d4dda){_0x232bb8[_0xb6b0('0x63')][_0xb6b0('0x6b')]=_0x1d4dda['id'];return db[_0xb6b0('0x47')][_0xb6b0('0x6d')](_0x232bb8[_0xb6b0('0x63')]);}})['then'](respondWithResult(_0x1f2cc9,null))[_0xb6b0('0x1e')](handleError(_0x1f2cc9,null));};exports[_0xb6b0('0x89')]=function(_0x440a5a,_0x992691){return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x440a5a[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x992691,null))[_0xb6b0('0x14')](function(_0x537f7f){if(_0x537f7f){return _0x537f7f[_0xb6b0('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x992691,null))[_0xb6b0('0x1e')](handleError(_0x992691,null));};exports[_0xb6b0('0x8b')]=function(_0x166925,_0x3dd2b7){return db['MailInteraction'][_0xb6b0('0x62')]({'where':{'id':_0x166925['params']['id']}})['then'](handleEntityNotFound(_0x3dd2b7,null))['then'](function(_0xce7032){if(_0xce7032){return _0xce7032[_0xb6b0('0x8b')](_0x166925[_0xb6b0('0x63')][_0xb6b0('0x73')],_[_0xb6b0('0x8c')](_0x166925[_0xb6b0('0x63')],['ids','id'])||{});}})[_0xb6b0('0x14')](respondWithResult(_0x3dd2b7,null))[_0xb6b0('0x1e')](handleError(_0x3dd2b7,null));};exports[_0xb6b0('0x8d')]=function(_0x7f7e37,_0x2f0260){var _0x47ae6e={'raw':![],'where':{}};var _0x573e32={};var _0x5eda94={'count':0x0,'rows':[]};return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x7f7e37[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x2f0260,null))[_0xb6b0('0x14')](function(_0x57e038){if(_0x57e038){_0x573e32['model']=_['keys'](db[_0xb6b0('0x8e')][_0xb6b0('0x5f')]);_0x573e32[_0xb6b0('0x4c')]=_[_0xb6b0('0x4d')](_0x7f7e37[_0xb6b0('0x4c')]);_0x573e32['filters']=_[_0xb6b0('0x60')](_0x573e32[_0xb6b0('0x4f')],_0x573e32[_0xb6b0('0x4c')]);_0x47ae6e[_0xb6b0('0x50')]=_[_0xb6b0('0x60')](_0x573e32[_0xb6b0('0x4f')],qs['fields'](_0x7f7e37[_0xb6b0('0x4c')][_0xb6b0('0x51')]));_0x47ae6e[_0xb6b0('0x50')]=_0x47ae6e[_0xb6b0('0x50')][_0xb6b0('0x52')]?_0x47ae6e[_0xb6b0('0x50')]:_0x573e32[_0xb6b0('0x4f')];if(!_0x7f7e37['query'][_0xb6b0('0x70')](_0xb6b0('0x71'))){_0x47ae6e['limit']=qs[_0xb6b0('0x25')](_0x7f7e37[_0xb6b0('0x4c')][_0xb6b0('0x25')]);_0x47ae6e[_0xb6b0('0x23')]=qs['offset'](_0x7f7e37[_0xb6b0('0x4c')][_0xb6b0('0x23')]);}_0x47ae6e[_0xb6b0('0x53')]=qs[_0xb6b0('0x54')](_0x7f7e37[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x47ae6e['where']=qs[_0xb6b0('0x4e')](_[_0xb6b0('0x56')](_0x7f7e37['query'],_0x573e32[_0xb6b0('0x4e')]));_0x47ae6e[_0xb6b0('0x55')][_0xb6b0('0x6b')]=_0x57e038['id'];if(_0x7f7e37[_0xb6b0('0x4c')]['filter']){_0x47ae6e[_0xb6b0('0x55')]=_[_0xb6b0('0x58')](_0x47ae6e['where'],{'$or':_['map'](_0x47ae6e[_0xb6b0('0x50')],function(_0x9246a8){var _0x3d3fd9={};_0x3d3fd9[_0x9246a8]={'$like':'%'+_0x7f7e37['query'][_0xb6b0('0x57')]+'%'};return _0x3d3fd9;})});}_0x47ae6e=_['merge']({},_0x47ae6e,_0x7f7e37[_0xb6b0('0x61')]);return db[_0xb6b0('0x8e')][_0xb6b0('0x26')]({'where':_0x47ae6e['where']})[_0xb6b0('0x14')](function(_0x4780d6){_0x5eda94['count']=_0x4780d6;if(_0x7f7e37[_0xb6b0('0x4c')]['includeAll']){_0x47ae6e[_0xb6b0('0x5a')]=[{'model':db[_0xb6b0('0x8f')],'as':'Contact','required':![]},{'model':db[_0xb6b0('0x90')],'as':_0xb6b0('0x91'),'attributes':[_0xb6b0('0x2c'),_0xb6b0('0x92'),'internal'],'required':![]},{'model':db[_0xb6b0('0x93')],'as':'Tags','attributes':['id',_0xb6b0('0x2c'),_0xb6b0('0x94')],'where':_0x7f7e37['query'][_0xb6b0('0x95')]?{'id':_0x7f7e37[_0xb6b0('0x4c')][_0xb6b0('0x95')]}:undefined,'required':_0x7f7e37[_0xb6b0('0x4c')]['tag']?!![]:![]}];}return db[_0xb6b0('0x8e')]['findAll'](_0x47ae6e);})[_0xb6b0('0x14')](function(_0x4e066a){_0x5eda94['rows']=_0x4e066a;return _0x5eda94;});}})[_0xb6b0('0x14')](respondWithFilteredResult(_0x2f0260,_0x47ae6e))[_0xb6b0('0x1e')](handleError(_0x2f0260,null));};exports[_0xb6b0('0x96')]=function addApplications(_0x5d3e7e,_0x44f4ff){var _0x29eeae=_0x5d3e7e[_0xb6b0('0x5e')]['id'];var _0x43cd69=_0x5d3e7e['body'];var _0x330590=0xc8;var _0x20bcbf=null;return db['sequelize'][_0xb6b0('0x97')]({'isolationLevel':db['sequelize'][_0xb6b0('0x98')]['ISOLATION_LEVELS'][_0xb6b0('0x99')]},function(_0x21afb2){return db['MailAccount']['findOne']({'where':{'id':_0x29eeae},'transaction':_0x21afb2})[_0xb6b0('0x14')](function(_0x20e121){if(_0x20e121){return db[_0xb6b0('0x9a')]['destroy']({'where':{'MailAccountId':_0x29eeae},'transaction':_0x21afb2})['then'](function(){var _0x3b73b2=_[_0xb6b0('0x49')](_0x43cd69,function(_0x18bef4){_0x18bef4['MailAccountId']=_0x29eeae;return _0x18bef4;});return db[_0xb6b0('0x9a')]['bulkCreate'](_0x3b73b2,{'transaction':_0x21afb2});});}else{_0x330590=0x194;_0x20bcbf=[];}});})['then'](function(){if(_0x330590!==0x194){return db['MailApplication'][_0xb6b0('0x9b')]({'where':{'MailAccountId':_0x29eeae},'order':'priority'})['then'](function(_0x373467){_0x20bcbf=_0x373467;});}})['catch'](function(_0xe16258){_0x330590=0x1f4;logger['error'](_0xe16258[_0xb6b0('0x2b')]);if(_0xe16258[_0xb6b0('0x2c')]){delete _0xe16258[_0xb6b0('0x2c')];}_0x20bcbf=_0xe16258;})[_0xb6b0('0x9c')](function(){if(_0x20bcbf===null){_0x44f4ff['sendStatus'](_0x330590);}else{if(_0x330590===0x1f4){_0x44f4ff[_0xb6b0('0x20')](_0x330590)[_0xb6b0('0x2d')](_0x20bcbf);}else{_0x44f4ff[_0xb6b0('0x20')](_0x330590)[_0xb6b0('0x22')](_0x20bcbf);}}});};exports[_0xb6b0('0x9d')]=function(_0x5e0e00,_0x139289){var _0x516f72={};var _0x531375={};var _0x4f1444;var _0x38e114;return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x5e0e00['params']['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x139289,null))[_0xb6b0('0x14')](function(_0x11788e){if(_0x11788e){_0x4f1444=_0x11788e;_0x531375[_0xb6b0('0x4f')]=_[_0xb6b0('0x4d')](db[_0xb6b0('0x9a')][_0xb6b0('0x5f')]);_0x531375[_0xb6b0('0x4c')]=_[_0xb6b0('0x4d')](_0x5e0e00[_0xb6b0('0x4c')]);_0x531375[_0xb6b0('0x4e')]=_[_0xb6b0('0x60')](_0x531375[_0xb6b0('0x4f')],_0x531375[_0xb6b0('0x4c')]);_0x516f72['attributes']=_[_0xb6b0('0x60')](_0x531375['model'],qs[_0xb6b0('0x51')](_0x5e0e00[_0xb6b0('0x4c')]['fields']));_0x516f72[_0xb6b0('0x50')]=_0x516f72[_0xb6b0('0x50')][_0xb6b0('0x52')]?_0x516f72[_0xb6b0('0x50')]:_0x531375['model'];_0x516f72[_0xb6b0('0x53')]=qs[_0xb6b0('0x54')](_0x5e0e00[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x516f72[_0xb6b0('0x55')]=qs['filters'](_[_0xb6b0('0x56')](_0x5e0e00[_0xb6b0('0x4c')],_0x531375[_0xb6b0('0x4e')]));if(_0x5e0e00[_0xb6b0('0x4c')][_0xb6b0('0x57')]){_0x516f72['where']=_['merge'](_0x516f72['where'],{'$or':_[_0xb6b0('0x49')](_0x516f72[_0xb6b0('0x50')],function(_0x1120cc){var _0x2ba65b={};_0x2ba65b[_0x1120cc]={'$like':'%'+_0x5e0e00['query'][_0xb6b0('0x57')]+'%'};return _0x2ba65b;})});}_0x516f72=_['merge']({},_0x516f72,_0x5e0e00['options']);return _0x4f1444['getApplications'](_0x516f72);}})[_0xb6b0('0x14')](function(_0x5b2759){if(_0x5b2759){_0x38e114=_0x5b2759['length'];if(!_0x5e0e00[_0xb6b0('0x4c')]['hasOwnProperty'](_0xb6b0('0x71'))){_0x516f72[_0xb6b0('0x25')]=qs['limit'](_0x5e0e00[_0xb6b0('0x4c')]['limit']);_0x516f72['offset']=qs[_0xb6b0('0x23')](_0x5e0e00[_0xb6b0('0x4c')]['offset']);}return _0x4f1444[_0xb6b0('0x9d')](_0x516f72);}})[_0xb6b0('0x14')](function(_0x33baf1){if(_0x33baf1){return _0x33baf1?{'count':_0x38e114,'rows':_0x33baf1}:null;}})[_0xb6b0('0x14')](respondWithResult(_0x139289,null))[_0xb6b0('0x1e')](handleError(_0x139289,null));};exports[_0xb6b0('0x9e')]=function(_0x17cf1a,_0x28069a){var _0x2eb362={'raw':!![],'where':{}};var _0x132106={};var _0x34c5e1={'count':0x0,'rows':[]};return db[_0xb6b0('0x4a')]['findOne']({'where':{'id':_0x17cf1a[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x28069a,null))['then'](function(_0x4de8e1){if(_0x4de8e1){_0x132106[_0xb6b0('0x4f')]=_['keys'](db[_0xb6b0('0x9f')][_0xb6b0('0x5f')]);_0x132106[_0xb6b0('0x4c')]=_['keys'](_0x17cf1a[_0xb6b0('0x4c')]);_0x132106[_0xb6b0('0x4e')]=_[_0xb6b0('0x60')](_0x132106['model'],_0x132106[_0xb6b0('0x4c')]);_0x2eb362[_0xb6b0('0x50')]=_[_0xb6b0('0x60')](_0x132106[_0xb6b0('0x4f')],qs[_0xb6b0('0x51')](_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0x51')]));_0x2eb362[_0xb6b0('0x50')]=_0x2eb362['attributes'][_0xb6b0('0x52')]?_0x2eb362[_0xb6b0('0x50')]:_0x132106['model'];if(!_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0x70')](_0xb6b0('0x71'))){_0x2eb362[_0xb6b0('0x25')]=qs['limit'](_0x17cf1a['query'][_0xb6b0('0x25')]);_0x2eb362[_0xb6b0('0x23')]=qs['offset'](_0x17cf1a['query'][_0xb6b0('0x23')]);}_0x2eb362[_0xb6b0('0x53')]=qs[_0xb6b0('0x54')](_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x2eb362[_0xb6b0('0x55')]=qs[_0xb6b0('0x4e')](_[_0xb6b0('0x56')](_0x17cf1a[_0xb6b0('0x4c')],_0x132106[_0xb6b0('0x4e')]));_0x2eb362['where'][_0xb6b0('0x6b')]=_0x4de8e1['id'];if(_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0x57')]){_0x2eb362['where']=_['merge'](_0x2eb362[_0xb6b0('0x55')],{'$or':_['map'](_0x2eb362['attributes'],function(_0x19587f){var _0x11a9f7={};_0x11a9f7[_0x19587f]={'$like':'%'+_0x17cf1a['query'][_0xb6b0('0x57')]+'%'};return _0x11a9f7;})});}if(_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0xa0')]){var _0x29b0dc=_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0xa0')]['split'](',');var _0x800dc3={};_0x800dc3[_0x29b0dc[0x0]]={'$gte':moment(_0x29b0dc[0x1])[_0xb6b0('0xa1')](_0xb6b0('0xa2'))};_0x2eb362[_0xb6b0('0x55')]=_[_0xb6b0('0x58')](_0x2eb362['where'],_0x800dc3);}_0x2eb362=_[_0xb6b0('0x58')]({},_0x2eb362,_0x17cf1a[_0xb6b0('0x61')]);return db['MailMessage']['count']({'where':_0x2eb362['where']})[_0xb6b0('0x14')](function(_0x139af5){_0x34c5e1[_0xb6b0('0x26')]=_0x139af5;if(_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0x59')]){_0x2eb362[_0xb6b0('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0xb6b0('0x5b')](_0x2eb362);})['then'](function(_0x5d8dc7){if(_0x17cf1a[_0xb6b0('0x4c')][_0xb6b0('0xa3')]===_0xb6b0('0xa4')){for(var _0x5deab7=0x0;_0x5deab7<_0x5d8dc7[_0xb6b0('0x52')];_0x5deab7++){_0x5d8dc7[_0x5deab7][_0xb6b0('0x63')]=juice(_0x5d8dc7[_0x5deab7][_0xb6b0('0x63')]);}}_0x34c5e1[_0xb6b0('0x5c')]=_0x5d8dc7;return _0x34c5e1;});}})['then'](respondWithFilteredResult(_0x28069a,_0x2eb362))[_0xb6b0('0x1e')](handleError(_0x28069a,null));};exports['send']=function(_0x3eb00b,_0x151141){var _0x451109,_0x72d52d={},_0x3aeb48;if(_0x3eb00b[_0xb6b0('0x63')]['to']){_0x3aeb48=_0x3eb00b[_0xb6b0('0x63')]['to']['split'](',')[0x0];}return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x3eb00b['params']['id']},'include':[{'model':db['CmList'],'as':_0xb6b0('0xa5'),'include':[{'model':db[_0xb6b0('0x8f')],'as':_0xb6b0('0xa6'),'where':{'email':_0x3aeb48},'limit':0x1,'order':[[_0xb6b0('0xa7'),'DESC']]}]},{'model':db[_0xb6b0('0x47')],'as':_0xb6b0('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb6b0('0xa8'),'raw':!![]}]}]})[_0xb6b0('0x14')](handleEntityNotFound(_0x151141,null))[_0xb6b0('0x14')](function(_0x179fe6){if(!_0x179fe6)return;_0x451109=_0x179fe6;if(!_0x179fe6[_0xb6b0('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xb6b0('0x7a')](_0x3eb00b[_0xb6b0('0x63')][_0xb6b0('0xa9')])){_0x3eb00b['body'][_0xb6b0('0xa9')]=util[_0xb6b0('0xa1')]('%s\x20<%s>',_0x179fe6[_0xb6b0('0x2c')],_0x179fe6['email']||_0x179fe6[_0xb6b0('0x44')][_0xb6b0('0x3a')]);}if(_0x3eb00b[_0xb6b0('0x63')][_0xb6b0('0xaa')]&&_0x3eb00b[_0xb6b0('0x63')][_0xb6b0('0xaa')]['length']){for(var _0x38a129=0x0;_0x38a129<_0x3eb00b[_0xb6b0('0x63')]['attachments']['length'];_0x38a129+=0x1){_0x3eb00b[_0xb6b0('0x63')]['attachments'][_0x38a129]={'filename':_0x3eb00b[_0xb6b0('0x63')]['attachments'][_0x38a129][_0xb6b0('0x2c')],'path':path['join'](config[_0xb6b0('0xab')],_0xb6b0('0xac'),_0x3eb00b[_0xb6b0('0x63')][_0xb6b0('0xaa')][_0x38a129][_0xb6b0('0xad')])};}}var _0x575f14=_0x179fe6[_0xb6b0('0xae')]();return respondWithRpcPromise(_0xb6b0('0xaf'),_0xb6b0('0xb0'),{'account':_0x575f14,'message':_0x3eb00b[_0xb6b0('0x63')]});})['then'](function(_0x5a1da9){if(!_0x5a1da9)return;_0x72d52d=_0x5a1da9;if(!_0x451109['List'])throw new Error(_0xb6b0('0xb1'));if(_0x451109['List'][_0xb6b0('0xa6')][_0xb6b0('0x52')])return _0x451109[_0xb6b0('0xa5')][_0xb6b0('0xa6')][0x0];return db[_0xb6b0('0x8f')]['create'](_[_0xb6b0('0xd')](_0x3eb00b[_0xb6b0('0x63')],{'firstName':_0x3eb00b[_0xb6b0('0x63')]['to'],'email':_0x3eb00b[_0xb6b0('0x63')]['to'],'phone':_0x3eb00b[_0xb6b0('0x63')]['to'],'ListId':_0x451109[_0xb6b0('0x79')]}));})[_0xb6b0('0x14')](function(_0x102279){if(!_0x102279)return;var _0x521122={'UserId':_0x3eb00b[_0xb6b0('0x3a')]['id'],'ContactId':_0x102279['id'],'MailAccountId':_0x451109['id'],'inReplyTo':_0x72d52d[_0xb6b0('0xb2')],'to':_0x3eb00b[_0xb6b0('0x63')]['from'],'cc':_0x3eb00b[_0xb6b0('0x63')]['cc'],'subject':_0x3eb00b[_0xb6b0('0x63')]['subject'],'attach':_0x3eb00b[_0xb6b0('0x63')]['attach'],'firstMsgDirection':_0xb6b0('0xb3'),'lastMsgAt':moment()[_0xb6b0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xb6b0('0xb3'),'Messages':[_[_0xb6b0('0x58')](_0x3eb00b[_0xb6b0('0x63')],{'messageId':_0x72d52d[_0xb6b0('0xb2')],'sentAt':moment()['format'](_0xb6b0('0xa2')),'read':!![],'MailAccountId':_0x451109['id'],'UserId':_0x3eb00b[_0xb6b0('0x3a')]['id'],'ContactId':_0x102279['id']})]};if(_0x3eb00b[_0xb6b0('0x63')]['Interaction']){_0x521122=_[_0xb6b0('0x58')](_0x521122,_0x3eb00b[_0xb6b0('0x63')][_0xb6b0('0xb4')]);}return db['MailInteraction'][_0xb6b0('0x6d')](_0x521122,{'include':[{'model':db['MailMessage'],'as':_0xb6b0('0xb5')}]});})[_0xb6b0('0x14')](respondWithResult(_0x151141,null))['catch'](handleError(_0x151141,null));};exports['verifySmtp']=function(_0x5ea0be,_0x26700e){return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x5ea0be['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0xb6b0('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xb6b0('0x14')](handleEntityNotFound(_0x26700e,null))['then'](function(_0x587311){if(!_0x587311[_0xb6b0('0x44')])return;var _0x39b1a4=_0x587311[_0xb6b0('0xae')]();return respondWithRpcPromise(_0xb6b0('0xb6'),_0xb6b0('0xb7'),{'account':_0x39b1a4});})['then'](respondWithResult(_0x26700e,null))[_0xb6b0('0x1e')](handleError(_0x26700e,null));};exports[_0xb6b0('0x29')]=function(_0x1bbf2c,_0x1be1ef){return db[_0xb6b0('0x4a')]['find']({'where':{'id':_0x1bbf2c[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x1be1ef,null))[_0xb6b0('0x14')](function(_0x512b4d){if(_0x512b4d&&_0x512b4d[_0xb6b0('0xb8')]){throw new db[(_0xb6b0('0xb9'))][(_0xb6b0('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x512b4d;})[_0xb6b0('0x14')](removeEntity(_0x1be1ef,null))[_0xb6b0('0x1e')](handleError(_0x1be1ef,null));};exports['addAgents']=function(_0x4d8d1f,_0x5e8ccf){return db[_0xb6b0('0x4a')][_0xb6b0('0x62')]({'where':{'id':_0x4d8d1f[_0xb6b0('0x5e')]['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x5e8ccf,null))[_0xb6b0('0x14')](function(_0x1f4c1a){if(_0x1f4c1a){return _0x1f4c1a['addAgents'](_0x4d8d1f[_0xb6b0('0x63')]['ids'],_[_0xb6b0('0x8c')](_0x4d8d1f['body'],[_0xb6b0('0x73'),'id'])||{})[_0xb6b0('0xbb')](function(_0x366095){for(var _0x1c34a2=0x0;_0x1c34a2<_0x4d8d1f[_0xb6b0('0x63')]['ids'][_0xb6b0('0x52')];_0x1c34a2+=0x1){socket[_0xb6b0('0xbc')](_0xb6b0('0xbd'),{'UserId':Number(_0x4d8d1f[_0xb6b0('0x63')]['ids'][_0x1c34a2]),'MailAccountId':Number(_0x4d8d1f[_0xb6b0('0x5e')]['id'])});}return _0x366095;});}})[_0xb6b0('0x14')](respondWithResult(_0x5e8ccf,null))[_0xb6b0('0x1e')](handleError(_0x5e8ccf,null));};exports[_0xb6b0('0xbe')]=function(_0x56e58a,_0x135a74){return db[_0xb6b0('0x4a')]['find']({'where':{'id':_0x56e58a['params']['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x135a74,null))[_0xb6b0('0x14')](function(_0x4e8369){if(_0x4e8369){return _0x4e8369['removeAgents'](_0x56e58a[_0xb6b0('0x4c')][_0xb6b0('0x73')])[_0xb6b0('0x14')](function(){if(_['isArray'](_0x56e58a[_0xb6b0('0x4c')][_0xb6b0('0x73')])){for(var _0x115a8c=0x0;_0x115a8c<_0x56e58a[_0xb6b0('0x4c')]['ids'][_0xb6b0('0x52')];_0x115a8c+=0x1){socket[_0xb6b0('0xbc')](_0xb6b0('0xbf'),{'UserId':Number(_0x56e58a[_0xb6b0('0x4c')][_0xb6b0('0x73')][_0x115a8c]),'MailAccountId':Number(_0x56e58a[_0xb6b0('0x5e')]['id'])});}}else{socket[_0xb6b0('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x56e58a['query'][_0xb6b0('0x73')]),'MailAccountId':Number(_0x56e58a['params']['id'])});}});}})[_0xb6b0('0x14')](respondWithStatusCode(_0x135a74,null))[_0xb6b0('0x1e')](handleError(_0x135a74,null));};exports[_0xb6b0('0xc0')]=function(_0x35b31f,_0x261157){var _0x4e5f30={};var _0x3d087a={};var _0x4d9435;var _0x49d923;return db[_0xb6b0('0x4a')][_0xb6b0('0x6f')]({'where':{'id':_0x35b31f['params']['id']}})[_0xb6b0('0x14')](handleEntityNotFound(_0x261157,null))[_0xb6b0('0x14')](function(_0x36c312){if(_0x36c312){_0x4d9435=_0x36c312;_0x3d087a[_0xb6b0('0x4f')]=_[_0xb6b0('0x4d')](db[_0xb6b0('0x90')][_0xb6b0('0x5f')]);_0x3d087a[_0xb6b0('0x4c')]=_[_0xb6b0('0x4d')](_0x35b31f[_0xb6b0('0x4c')]);_0x3d087a['filters']=_[_0xb6b0('0x60')](_0x3d087a[_0xb6b0('0x4f')],_0x3d087a[_0xb6b0('0x4c')]);_0x4e5f30['attributes']=_[_0xb6b0('0x60')](_0x3d087a[_0xb6b0('0x4f')],qs['fields'](_0x35b31f['query']['fields']));_0x4e5f30[_0xb6b0('0x50')]=_0x4e5f30[_0xb6b0('0x50')][_0xb6b0('0x52')]?_0x4e5f30['attributes']:_0x3d087a[_0xb6b0('0x4f')];_0x4e5f30['order']=qs['sort'](_0x35b31f[_0xb6b0('0x4c')][_0xb6b0('0x54')]);_0x4e5f30[_0xb6b0('0x55')]=qs['filters'](_[_0xb6b0('0x56')](_0x35b31f[_0xb6b0('0x4c')],_0x3d087a[_0xb6b0('0x4e')]));if(_0x35b31f['query'][_0xb6b0('0x57')]){_0x4e5f30[_0xb6b0('0x55')]=_[_0xb6b0('0x58')](_0x4e5f30[_0xb6b0('0x55')],{'$or':_[_0xb6b0('0x49')](_0x4e5f30['attributes'],function(_0x3e56b5){var _0x6799cf={};_0x6799cf[_0x3e56b5]={'$like':'%'+_0x35b31f[_0xb6b0('0x4c')][_0xb6b0('0x57')]+'%'};return _0x6799cf;})});}_0x4e5f30=_[_0xb6b0('0x58')]({},_0x4e5f30,_0x35b31f['options']);return _0x4d9435[_0xb6b0('0xc0')](_0x4e5f30);}})[_0xb6b0('0x14')](function(_0x4e2402){if(_0x4e2402){_0x49d923=_0x4e2402[_0xb6b0('0x52')];if(!_0x35b31f[_0xb6b0('0x4c')][_0xb6b0('0x70')](_0xb6b0('0x71'))){_0x4e5f30[_0xb6b0('0x25')]=qs[_0xb6b0('0x25')](_0x35b31f[_0xb6b0('0x4c')][_0xb6b0('0x25')]);_0x4e5f30[_0xb6b0('0x23')]=qs['offset'](_0x35b31f['query'][_0xb6b0('0x23')]);}return _0x4d9435[_0xb6b0('0xc0')](_0x4e5f30);}})['then'](function(_0xa9a3b7){if(_0xa9a3b7){return _0xa9a3b7?{'count':_0x49d923,'rows':_0xa9a3b7}:null;}})[_0xb6b0('0x14')](respondWithResult(_0x261157,null))[_0xb6b0('0x1e')](handleError(_0x261157,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8b7b2a8..4d5639a 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 _0xaf1b=['hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x1a21db,_0x9489fb){var _0x13ea9b=function(_0xb91444){while(--_0xb91444){_0x1a21db['push'](_0x1a21db['shift']());}};_0x13ea9b(++_0x9489fb);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x4b7b9f,_0x1ea2a1){_0x4b7b9f=_0x4b7b9f-0x0;var _0x580c0d=_0xaf1b[_0x4b7b9f];return _0x580c0d;};'use strict';var EventEmitter=require(_0xbaf1('0x0'));var MailAccount=require(_0xbaf1('0x1'))['db'][_0xbaf1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbaf1('0x3')](0x0);var events={'afterCreate':_0xbaf1('0x4'),'afterUpdate':_0xbaf1('0x5'),'afterDestroy':_0xbaf1('0x6')};function emitEvent(_0xdf4a1b){return function(_0x461ffb,_0x3fe8f0,_0x156a67){MailAccountEvents[_0xbaf1('0x7')](_0xdf4a1b+':'+_0x461ffb['id'],_0x461ffb);MailAccountEvents[_0xbaf1('0x7')](_0xdf4a1b,_0x461ffb);_0x156a67(null);};}for(var e in events){if(events[_0xbaf1('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xbaf1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x4c23=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c23,0x138));var _0x34c2=function(_0x54f758,_0x2d5122){_0x54f758=_0x54f758-0x0;var _0x347898=_0x4c23[_0x54f758];return _0x347898;};'use strict';var EventEmitter=require(_0x34c2('0x0'));var MailAccount=require(_0x34c2('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34c2('0x2'),'afterUpdate':_0x34c2('0x3'),'afterDestroy':_0x34c2('0x4')};function emitEvent(_0x18a3e9){return function(_0x5ed6ee,_0x42bb32,_0xc46f37){MailAccountEvents[_0x34c2('0x5')](_0x18a3e9+':'+_0x5ed6ee['id'],_0x5ed6ee);MailAccountEvents[_0x34c2('0x5')](_0x18a3e9,_0x5ed6ee);_0xc46f37(null);};}for(var e in events){if(events[_0x34c2('0x6')](e)){var event=events[e];MailAccount[_0x34c2('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e6f15e7..81d4eea 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 _0xaf1a=['Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','CloudProvider','data5','auth','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','secure','modernAuthentication'];(function(_0x25b17d,_0x21b2ca){var _0x5c1e3b=function(_0x490c90){while(--_0x490c90){_0x25b17d['push'](_0x25b17d['shift']());}};_0x5c1e3b(++_0x21b2ca);}(_0xaf1a,0x127));var _0xaaf1=function(_0x2e4d57,_0x20d07d){_0x2e4d57=_0x2e4d57-0x0;var _0x6c02b1=_0xaf1a[_0x2e4d57];return _0x6c02b1;};'use strict';var attributes=require(_0xaaf1('0x0'));module['exports']=function(_0x2b60fe){return _0x2b60fe[_0xaaf1('0x1')](_0xaaf1('0x2'),attributes,{'tableName':_0xaaf1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x442692=this;var _0xc2bd1a={'id':_0x442692['id'],'tls':{'rejectUnauthorized':![]}};if(_0x442692[_0xaaf1('0x4')]!=='custom'){_0xc2bd1a[_0xaaf1('0x5')]=_0x442692[_0xaaf1('0x4')];}else{_0xc2bd1a[_0xaaf1('0x6')]=_0x442692[_0xaaf1('0x7')][_0xaaf1('0x6')];_0xc2bd1a[_0xaaf1('0x8')]=_0x442692[_0xaaf1('0x7')]['port'];_0xc2bd1a[_0xaaf1('0x9')]=_0x442692[_0xaaf1('0x7')][_0xaaf1('0x9')];}if(_0x442692[_0xaaf1('0x7')]['authentication']){if(_0x442692[_0xaaf1('0x7')][_0xaaf1('0xa')]){if(!_0x442692[_0xaaf1('0x7')]['CloudProvider'])throw new Error(_0xaaf1('0xb'));_0xc2bd1a['auth']={'type':_0xaaf1('0xc'),'user':_0x442692[_0xaaf1('0x7')]['user'],'accessToken':_0x442692[_0xaaf1('0x7')][_0xaaf1('0xd')][_0xaaf1('0xe')]};}else{_0xc2bd1a[_0xaaf1('0xf')]={'user':_0x442692['Smtp']['user'],'pass':_0x442692[_0xaaf1('0x7')][_0xaaf1('0x10')]};}}return _0xc2bd1a;}}});}; \ No newline at end of file +var _0x98e0=['host','Smtp','port','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','define','mail_accounts','provider','custom','service'];(function(_0x460d4a,_0x31cb8d){var _0x14680f=function(_0x4549e5){while(--_0x4549e5){_0x460d4a['push'](_0x460d4a['shift']());}};_0x14680f(++_0x31cb8d);}(_0x98e0,0x14e));var _0x098e=function(_0x3d08fb,_0x36a491){_0x3d08fb=_0x3d08fb-0x0;var _0x1e3d10=_0x98e0[_0x3d08fb];return _0x1e3d10;};'use strict';var attributes=require(_0x098e('0x0'));module['exports']=function(_0x5de306){return _0x5de306[_0x098e('0x1')]('MailAccount',attributes,{'tableName':_0x098e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x316c1b=this;var _0x41c539={'id':_0x316c1b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x316c1b[_0x098e('0x3')]!==_0x098e('0x4')){_0x41c539[_0x098e('0x5')]=_0x316c1b[_0x098e('0x3')];}else{_0x41c539[_0x098e('0x6')]=_0x316c1b[_0x098e('0x7')][_0x098e('0x6')];_0x41c539['port']=_0x316c1b[_0x098e('0x7')][_0x098e('0x8')];_0x41c539[_0x098e('0x9')]=_0x316c1b['Smtp'][_0x098e('0x9')];}if(_0x316c1b[_0x098e('0x7')][_0x098e('0xa')]){if(_0x316c1b[_0x098e('0x7')]['modernAuthentication']){if(!_0x316c1b[_0x098e('0x7')][_0x098e('0xb')])throw new Error(_0x098e('0xc'));_0x41c539[_0x098e('0xd')]={'type':'OAuth2','user':_0x316c1b[_0x098e('0x7')][_0x098e('0xe')],'accessToken':_0x316c1b[_0x098e('0x7')][_0x098e('0xb')][_0x098e('0xf')]};}else{_0x41c539[_0x098e('0xd')]={'user':_0x316c1b[_0x098e('0x7')]['user'],'pass':_0x316c1b[_0x098e('0x7')][_0x098e('0x10')]};}}return _0x41c539;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 92383f8..a196292 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 _0x896e=['createdAt','updatedAt','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','list','orderBy','asc','autoclose','applications','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','get','attachments','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','then','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes'];(function(_0xb0e018,_0x499065){var _0x2aaef0=function(_0x1bbe17){while(--_0x1bbe17){_0xb0e018['push'](_0xb0e018['shift']());}};_0x2aaef0(++_0x499065);}(_0x896e,0x1e9));var _0xe896=function(_0x3edf7c,_0x60fdce){_0x3edf7c=_0x3edf7c-0x0;var _0xab84e3=_0x896e[_0x3edf7c];return _0xab84e3;};'use strict';var _=require(_0xe896('0x0'));var moment=require(_0xe896('0x1'));var BPromise=require(_0xe896('0x2'));var rs=require(_0xe896('0x3'));var Redis=require(_0xe896('0x4'));var db=require(_0xe896('0x5'))['db'];var logger=require(_0xe896('0x6'))(_0xe896('0x7'));var config=require(_0xe896('0x8'));var jayson=require(_0xe896('0x9'));var client=jayson[_0xe896('0xa')][_0xe896('0xb')]({'port':0x232c});config['redis']=_[_0xe896('0xc')](config[_0xe896('0xd')],{'host':_0xe896('0xe'),'port':0x18eb});var socket=require(_0xe896('0xf'))(new Redis(config[_0xe896('0xd')]));require('./mailAccount.socket')[_0xe896('0x10')](socket);function respondWithRpcPromise(_0x14b7e4,_0x37a90d,_0x4afd3f){return new BPromise(function(_0x305616,_0x48251e){return client[_0xe896('0x11')](_0x14b7e4,_0x4afd3f)['then'](function(_0x409eaf){logger[_0xe896('0x12')](_0xe896('0x13'),_0x37a90d,'request\x20sent');logger[_0xe896('0x14')](_0xe896('0x15'),_0x37a90d,_0xe896('0x16'),JSON['stringify'](_0x409eaf));if(_0x409eaf[_0xe896('0x17')]){if(_0x409eaf[_0xe896('0x17')][_0xe896('0x18')]===0x1f4){logger['error'](_0xe896('0x13'),_0x37a90d,_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);return _0x48251e(_0x409eaf['error']['message']);}logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x409eaf['error']['message']);return _0x305616(_0x409eaf[_0xe896('0x17')][_0xe896('0x19')]);}else{logger['info'](_0xe896('0x13'),_0x37a90d,'request\x20sent');_0x305616(_0x409eaf[_0xe896('0x1a')][_0xe896('0x19')]);}})[_0xe896('0x1b')](function(_0x5dc89d){logger[_0xe896('0x17')](_0xe896('0x13'),_0x37a90d,_0x5dc89d);_0x48251e(_0x5dc89d);});});}exports[_0xe896('0x1c')]=function(_0xbebbe1){var _0x2693d6=this;return new Promise(function(_0x3ac8b8,_0x388c2e){return db[_0xe896('0x1d')]['findAll']({'raw':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options']['raw']===undefined?!![]:![]:!![],'where':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1['options'][_0xe896('0x20')]||null:null,'limit':_0xbebbe1['options']?_0xbebbe1['options'][_0xe896('0x21')]||null:null,'include':_0xbebbe1[_0xe896('0x1e')]?_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0xbebbe1[_0xe896('0x1e')][_0xe896('0x22')],function(_0x4b71cc){return{'model':db[_0x4b71cc[_0xe896('0x24')]],'as':_0x4b71cc['as'],'attributes':_0x4b71cc[_0xe896('0x20')],'include':_0x4b71cc[_0xe896('0x22')]?_['map'](_0x4b71cc[_0xe896('0x22')],function(_0xd50fe2){return{'model':db[_0xd50fe2[_0xe896('0x24')]],'as':_0xd50fe2['as'],'attributes':_0xd50fe2[_0xe896('0x20')],'include':_0xd50fe2[_0xe896('0x22')]?_[_0xe896('0x23')](_0xd50fe2['include'],function(_0x10adad){return{'model':db[_0x10adad[_0xe896('0x24')]],'as':_0x10adad['as'],'attributes':_0x10adad[_0xe896('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0xace03f){logger['info']('GetMailAccount',_0xbebbe1);logger['debug']('GetMailAccount',_0xbebbe1,JSON['stringify'](_0xace03f));_0x3ac8b8(_0xace03f);})[_0xe896('0x1b')](function(_0x29a18e){logger[_0xe896('0x17')](_0xe896('0x1c'),_0x29a18e[_0xe896('0x19')],_0xbebbe1);_0x388c2e(_0x2693d6[_0xe896('0x17')](0x1f4,_0x29a18e[_0xe896('0x19')]));});});};exports[_0xe896('0x26')]=function(_0x4ab96b){var _0x4ce052=this;return new Promise(function(_0x142d29,_0x255dd1){return db[_0xe896('0x1d')][_0xe896('0x27')]({'raw':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x1f')]||null:null,'attributes':_0x4ab96b[_0xe896('0x1e')]?_0x4ab96b['options']['attributes']||null:null,'include':_0x4ab96b['options']?_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')]?_[_0xe896('0x23')](_0x4ab96b[_0xe896('0x1e')][_0xe896('0x22')],function(_0x486eb5){return{'model':db[_0x486eb5[_0xe896('0x24')]],'as':_0x486eb5['as'],'attributes':_0x486eb5[_0xe896('0x20')],'include':_0x486eb5[_0xe896('0x22')]?_[_0xe896('0x23')](_0x486eb5[_0xe896('0x22')],function(_0x2cce09){return{'model':db[_0x2cce09[_0xe896('0x24')]],'as':_0x2cce09['as'],'attributes':_0x2cce09[_0xe896('0x20')],'include':_0x2cce09['include']?_[_0xe896('0x23')](_0x2cce09[_0xe896('0x22')],function(_0x5a2dd2){return{'model':db[_0x5a2dd2[_0xe896('0x24')]],'as':_0x5a2dd2['as'],'attributes':_0x5a2dd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe896('0x25')](function(_0x4f164f){if(_0x4ab96b[_0xe896('0x1e')]['smtp']===!![])_0x4f164f[_0xe896('0x28')](_0xe896('0x29'),_0x4f164f[_0xe896('0x2a')]());logger[_0xe896('0x12')](_0xe896('0x26'),_0x4ab96b);logger['debug']('ShowMailAccount',_0x4ab96b,JSON[_0xe896('0x2b')](_0x4f164f));_0x142d29(_0x4f164f);})[_0xe896('0x1b')](function(_0x387cc6){logger[_0xe896('0x17')](_0xe896('0x26'),_0x387cc6['message'],_0x4ab96b);_0x255dd1(_0x4ce052['error'](0x1f4,_0x387cc6[_0xe896('0x19')]));});});};exports[_0xe896('0x2c')]=function(_0x5890b1){var _0x57e194=this;return new Promise(function(_0x19d2fd,_0x3b1de8){var _0x911adb={'body':_0x5890b1[_0xe896('0x2d')],'channel':_0xe896('0x2e')};var _0x41fa6f=_[_0xe896('0x2f')](_[_0xe896('0x30')](db[_0xe896('0x31')][_0xe896('0x32')]),[_0xe896('0x33'),_0xe896('0x34'),'CompanyId',_0xe896('0x35')]);var _0x143ad4=![];if(_0x5890b1['body']['id']){delete _0x5890b1['body']['id'];}if(_['isNil'](_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')]['body'])||_0x5890b1['body']['body']===''){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x38')));}if(_[_0xe896('0x37')](_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41fa6f));}if(!_[_0xe896('0x3a')](_0x41fa6f,_0x5890b1[_0xe896('0x2d')]['mapKey'])){return _0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0xe896('0x3b')+_0x41fa6f));}var _0x179fc2={};_0x179fc2[_0x5890b1[_0xe896('0x2d')]['mapKey']]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db[_0xe896('0x1d')][_0xe896('0x27')]({'where':{'id':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x3d')],'as':'List','include':[{'model':db[_0xe896('0x31')],'as':'Contacts','where':_0x179fc2,'limit':0x1,'order':[[_0xe896('0x34'),_0xe896('0x3e')]]}]},{'model':db[_0xe896('0x3f')],'as':_0xe896('0x40')},{'model':db[_0xe896('0x41')],'as':_0xe896('0x42'),'include':[{'model':db['CloudProvider'],'as':_0xe896('0x43')}]}]})[_0xe896('0x25')](function(_0x4818cd){if(_0x4818cd&&_0x4818cd[_0xe896('0x44')]){var _0x355443=_0x4818cd['get']({'plain':!![]});_0x911adb[_0xe896('0x3c')]=_['omit'](_0x355443,[_0xe896('0x40'),_0xe896('0x44')]);_0x911adb[_0xe896('0x3c')][_0xe896('0x29')]=_0x4818cd[_0xe896('0x2a')]();_0x911adb['applications']=_0x355443[_0xe896('0x40')];_0x911adb[_0xe896('0x45')]=_0x355443[_0xe896('0x44')];_0x911adb['applications']=_[_0xe896('0x46')](_0x911adb['applications'],['priority'],[_0xe896('0x47')]);if(_0x911adb[_0xe896('0x3c')]&&_0x911adb['account'][_0xe896('0x48')]){_0x911adb[_0xe896('0x49')]['push']({'id':0x0,'priority':_0x911adb['applications'][_0xe896('0x4a')]+0x1,'app':_0xe896('0x4b'),'appdata':'autoclose','interval':_0xe896('0x4c')});}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x40')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x40')];}if(_0x911adb[_0xe896('0x3c')][_0xe896('0x44')]){delete _0x911adb[_0xe896('0x3c')][_0xe896('0x44')];}if(_0x355443[_0xe896('0x44')][_0xe896('0x4d')]['length']){return _0x355443[_0xe896('0x44')][_0xe896('0x4d')][0x0];}var _0x131c1c=_[_0xe896('0xc')](_0x5890b1[_0xe896('0x2d')],{'firstName':_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')],'ListId':_0x355443[_0xe896('0x35')]});_0x131c1c[_0x5890b1[_0xe896('0x2d')][_0xe896('0x39')]]=_0x5890b1[_0xe896('0x2d')][_0xe896('0x36')];return db['CmContact'][_0xe896('0x4e')](_0x131c1c);}else{throw new Error(_0xe896('0x4f'));}})[_0xe896('0x25')](function(_0x5180b6){_0x911adb['contact']=_0x5180b6;if(_0x5180b6){if(!_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x50')]){_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId']=rs[_0xe896('0x51')]()+'\x20'+_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')];}var _0x5d6c1c={'ContactId':_0x5180b6['id'],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id'],'inReplyTo':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')]['message']['from'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x5890b1[_0xe896('0x3c')]['id']},'include':[{'model':db[_0xe896('0x56')],'as':'Messages','attributes':[_0xe896('0x50')],'where':{'messageId':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x57')]}}]})[_0xe896('0x25')](function(_0x3cc348){if(_0x3cc348){return[_0x3cc348,![]];}return db[_0xe896('0x58')][_0xe896('0x4e')](_0x5d6c1c)[_0xe896('0x25')](function(_0x117e92){return[_0x117e92,!![]];});});}else{throw new Error(_0xe896('0x59'));}})[_0xe896('0x5a')](function(_0xcb329a,_0x3248e6){if(_0xcb329a){_0x143ad4=_0x3248e6;if(!_0x3248e6){return _0xcb329a[_0xe896('0x5b')]({'inReplyTo':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x50')],'to':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x36')],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1[_0xe896('0x2d')]['message']['subject'],'attach':_0xcb329a[_0xe896('0x53')]?_0xcb329a[_0xe896('0x53')]:_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x53')],'substatus':null,'substatusAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgAt':moment()[_0xe896('0x54')](_0xe896('0x55')),'lastMsgDirection':'in'});}else{return _0xcb329a;}}})[_0xe896('0x25')](function(_0x40e91d){_0x911adb[_0xe896('0x5c')]=_0x40e91d[_0xe896('0x5d')]({'plain':!![]});_0x911adb[_0xe896('0x5c')]['created']=_0x143ad4;return db[_0xe896('0x56')][_0xe896('0x4e')]({'body':_0x5890b1['body'][_0xe896('0x2d')],'MailAccountId':_0x5890b1['account']['id'],'MailInteractionId':_0x40e91d['id'],'direction':'in','ContactId':_0x911adb['contact']['id'],'messageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['messageId'],'from':_0x5890b1['body'][_0xe896('0x19')]['from'],'to':_0x5890b1['body'][_0xe896('0x19')]['to'],'cc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['cc'],'subject':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x52')],'attach':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x53')],'Attachments':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x5e')],'originTo':_0x5890b1['body'][_0xe896('0x19')][_0xe896('0x5f')],'originCc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['originCc'],'bcc':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')]['bcc'],'ChatWebsiteId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x60')]||null,'originChannel':_0x5890b1[_0xe896('0x2d')]['message'][_0xe896('0x61')]||_0xe896('0x62'),'ChatOfflineMessageId':_0x5890b1[_0xe896('0x2d')][_0xe896('0x19')][_0xe896('0x63')]||null},{'include':[{'model':db[_0xe896('0x64')],'as':'Attachments'}]});})['then'](function(_0x48b523){_0x911adb[_0xe896('0x19')]=_0x48b523;if(_0x911adb[_0xe896('0x5c')][_0xe896('0x65')]){return db[_0xe896('0x66')][_0xe896('0x27')]({'attributes':['id',_0xe896('0x67')],'where':{'id':_0x911adb[_0xe896('0x5c')]['UserId']}})['then'](function(_0x4674ba){if(_0x4674ba){_0x911adb['applications'][_0xe896('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4674ba[_0xe896('0x67')]+','+(_0x911adb['account'][_0xe896('0x69')]||0xa),'interval':_0xe896('0x4c')});}return respondWithRpcPromise(_0xe896('0x6a'),_0xe896('0x6b'),_0x911adb);});}return respondWithRpcPromise(_0xe896('0x6a'),'startRouting',_0x911adb);})[_0xe896('0x25')](function(_0x35306d){_0x19d2fd(_0x35306d);})[_0xe896('0x1b')](function(_0x1bcfda){_0x3b1de8(_0x57e194[_0xe896('0x17')](0x1f4,_0x1bcfda[_0xe896('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['ShowMailAccount','smtp','setDataValue','getSmtpOptions','body','mail','difference','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','Smtp','account','list','applications','orderBy','priority','asc','autoclose','push','length','close','from','then','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','interaction','get','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify'];(function(_0xf1396b,_0x1647b0){var _0x2da083=function(_0x36a3ea){while(--_0x36a3ea){_0xf1396b['push'](_0xf1396b['shift']());}};_0x2da083(++_0x1647b0);}(_0xadb5,0xad));var _0x5adb=function(_0x565e3f,_0x1b5a14){_0x565e3f=_0x565e3f-0x0;var _0x5d7bac=_0xadb5[_0x565e3f];return _0x5d7bac;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var db=require(_0x5adb('0x3'))['db'];var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var jayson=require(_0x5adb('0x6'));var client=jayson['client'][_0x5adb('0x7')]({'port':0x232c});config[_0x5adb('0x8')]=_[_0x5adb('0x9')](config[_0x5adb('0x8')],{'host':_0x5adb('0xa'),'port':0x18eb});var socket=require(_0x5adb('0xb'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xc'))[_0x5adb('0xd')](socket);function respondWithRpcPromise(_0x7293ab,_0x34f59d,_0x336bad){return new BPromise(function(_0x129f5a,_0x275428){return client['request'](_0x7293ab,_0x336bad)['then'](function(_0x1a8f66){logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,'request\x20sent');logger[_0x5adb('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x34f59d,_0x5adb('0x11'),JSON['stringify'](_0x1a8f66));if(_0x1a8f66[_0x5adb('0x12')]){if(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x13')]===0x1f4){logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x275428(_0x1a8f66['error'][_0x5adb('0x14')]);}logger['error'](_0x5adb('0xf'),_0x34f59d,_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);return _0x129f5a(_0x1a8f66[_0x5adb('0x12')][_0x5adb('0x14')]);}else{logger[_0x5adb('0xe')](_0x5adb('0xf'),_0x34f59d,_0x5adb('0x11'));_0x129f5a(_0x1a8f66[_0x5adb('0x15')]['message']);}})[_0x5adb('0x16')](function(_0x5de028){logger[_0x5adb('0x12')]('MailAccount,\x20%s,\x20%s',_0x34f59d,_0x5de028);_0x275428(_0x5de028);});});}exports[_0x5adb('0x17')]=function(_0x50e84f){var _0x5e218c=this;return new Promise(function(_0x1fbaa5,_0x1bed20){return db[_0x5adb('0x18')][_0x5adb('0x19')]({'raw':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f['options'][_0x5adb('0x1b')]===undefined?!![]:![]:!![],'where':_0x50e84f['options']?_0x50e84f['options'][_0x5adb('0x1c')]||null:null,'attributes':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'limit':_0x50e84f[_0x5adb('0x1a')]?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1e')]||null:null,'include':_0x50e84f['options']?_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x50e84f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x49f203){return{'model':db[_0x49f203[_0x5adb('0x21')]],'as':_0x49f203['as'],'attributes':_0x49f203[_0x5adb('0x1d')],'include':_0x49f203['include']?_[_0x5adb('0x20')](_0x49f203[_0x5adb('0x1f')],function(_0x1a0acd){return{'model':db[_0x1a0acd['model']],'as':_0x1a0acd['as'],'attributes':_0x1a0acd[_0x5adb('0x1d')],'include':_0x1a0acd[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1a0acd[_0x5adb('0x1f')],function(_0x36459b){return{'model':db[_0x36459b[_0x5adb('0x21')]],'as':_0x36459b['as'],'attributes':_0x36459b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d457e){logger[_0x5adb('0xe')](_0x5adb('0x17'),_0x50e84f);logger[_0x5adb('0x10')](_0x5adb('0x17'),_0x50e84f,JSON[_0x5adb('0x22')](_0x5d457e));_0x1fbaa5(_0x5d457e);})['catch'](function(_0x11ec2a){logger[_0x5adb('0x12')](_0x5adb('0x17'),_0x11ec2a[_0x5adb('0x14')],_0x50e84f);_0x1bed20(_0x5e218c[_0x5adb('0x12')](0x1f4,_0x11ec2a[_0x5adb('0x14')]));});});};exports[_0x5adb('0x23')]=function(_0x28bf1f){var _0x138bf6=this;return new Promise(function(_0x260295,_0x4790f1){return db[_0x5adb('0x18')]['find']({'raw':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bf1f[_0x5adb('0x1a')]?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1c')]||null:null,'attributes':_0x28bf1f['options']?_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1d')]||null:null,'include':_0x28bf1f['options']?_0x28bf1f['options'][_0x5adb('0x1f')]?_['map'](_0x28bf1f[_0x5adb('0x1a')][_0x5adb('0x1f')],function(_0x3c2b07){return{'model':db[_0x3c2b07[_0x5adb('0x21')]],'as':_0x3c2b07['as'],'attributes':_0x3c2b07[_0x5adb('0x1d')],'include':_0x3c2b07['include']?_[_0x5adb('0x20')](_0x3c2b07[_0x5adb('0x1f')],function(_0x1c3a5c){return{'model':db[_0x1c3a5c['model']],'as':_0x1c3a5c['as'],'attributes':_0x1c3a5c['attributes'],'include':_0x1c3a5c[_0x5adb('0x1f')]?_[_0x5adb('0x20')](_0x1c3a5c['include'],function(_0x2355bc){return{'model':db[_0x2355bc['model']],'as':_0x2355bc['as'],'attributes':_0x2355bc[_0x5adb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cb37){if(_0x28bf1f['options'][_0x5adb('0x24')]===!![])_0x11cb37[_0x5adb('0x25')]('smtpOptions',_0x11cb37[_0x5adb('0x26')]());logger['info'](_0x5adb('0x23'),_0x28bf1f);logger[_0x5adb('0x10')](_0x5adb('0x23'),_0x28bf1f,JSON['stringify'](_0x11cb37));_0x260295(_0x11cb37);})[_0x5adb('0x16')](function(_0x2b3b0b){logger[_0x5adb('0x12')](_0x5adb('0x23'),_0x2b3b0b[_0x5adb('0x14')],_0x28bf1f);_0x4790f1(_0x138bf6['error'](0x1f4,_0x2b3b0b['message']));});});};exports['NotifyMailAccount']=function(_0x599999){var _0x427c71=this;return new Promise(function(_0x2fbe14,_0x3a104a){var _0x399489={'body':_0x599999[_0x5adb('0x27')],'channel':_0x5adb('0x28')};var _0x2c69a8=_[_0x5adb('0x29')](_['keys'](db['CmContact'][_0x5adb('0x2a')]),['createdAt',_0x5adb('0x2b'),_0x5adb('0x2c'),_0x5adb('0x2d')]);var _0x121714=![];if(_0x599999[_0x5adb('0x27')]['id']){delete _0x599999['body']['id'];}if(_[_0x5adb('0x2e')](_0x599999[_0x5adb('0x27')]['from'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x2f')));}if(_['isNil'](_0x599999[_0x5adb('0x27')][_0x5adb('0x27')])||_0x599999[_0x5adb('0x27')][_0x5adb('0x27')]===''){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x30')));}if(_[_0x5adb('0x2e')](_0x599999['body']['mapKey'])){return _0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x5adb('0x31')+_0x2c69a8));}if(!_[_0x5adb('0x32')](_0x2c69a8,_0x599999[_0x5adb('0x27')]['mapKey'])){return _0x3a104a(_0x427c71['error'](0x1f4,_0x5adb('0x33')+_0x2c69a8));}var _0x4d7d86={};_0x4d7d86[_0x599999[_0x5adb('0x27')][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')]['from'];return db[_0x5adb('0x18')][_0x5adb('0x35')]({'where':{'id':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x36')],'as':_0x5adb('0x37'),'include':[{'model':db[_0x5adb('0x38')],'as':_0x5adb('0x39'),'where':_0x4d7d86,'limit':0x1,'order':[[_0x5adb('0x2b'),_0x5adb('0x3a')]]}]},{'model':db[_0x5adb('0x3b')],'as':_0x5adb('0x3c')},{'model':db['MailServerOut'],'as':_0x5adb('0x3d'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x3cd211){if(_0x3cd211&&_0x3cd211[_0x5adb('0x37')]){var _0x207a81=_0x3cd211['get']({'plain':!![]});_0x399489[_0x5adb('0x3e')]=_['omit'](_0x207a81,[_0x5adb('0x3c'),_0x5adb('0x37')]);_0x399489[_0x5adb('0x3e')]['smtpOptions']=_0x3cd211[_0x5adb('0x26')]();_0x399489['applications']=_0x207a81[_0x5adb('0x3c')];_0x399489[_0x5adb('0x3f')]=_0x207a81['List'];_0x399489[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x399489[_0x5adb('0x40')],[_0x5adb('0x42')],[_0x5adb('0x43')]);if(_0x399489['account']&&_0x399489[_0x5adb('0x3e')][_0x5adb('0x44')]){_0x399489[_0x5adb('0x40')][_0x5adb('0x45')]({'id':0x0,'priority':_0x399489['applications'][_0x5adb('0x46')]+0x1,'app':_0x5adb('0x47'),'appdata':_0x5adb('0x44'),'interval':'*,*,*,*'});}if(_0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x3c')];}if(_0x399489['account'][_0x5adb('0x37')]){delete _0x399489[_0x5adb('0x3e')][_0x5adb('0x37')];}if(_0x207a81[_0x5adb('0x37')][_0x5adb('0x39')]['length']){return _0x207a81[_0x5adb('0x37')]['Contacts'][0x0];}var _0x2b790d=_['defaults'](_0x599999[_0x5adb('0x27')],{'firstName':_0x599999[_0x5adb('0x27')][_0x5adb('0x48')],'ListId':_0x207a81[_0x5adb('0x2d')]});_0x2b790d[_0x599999['body'][_0x5adb('0x34')]]=_0x599999[_0x5adb('0x27')][_0x5adb('0x48')];return db['CmContact']['create'](_0x2b790d);}else{throw new Error('List\x20not\x20found');}})[_0x5adb('0x49')](function(_0x31a1f9){_0x399489[_0x5adb('0x4a')]=_0x31a1f9;if(_0x31a1f9){if(!_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]){_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')]=rs[_0x5adb('0x4c')]()+'\x20'+_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x48')];}var _0x511746={'ContactId':_0x31a1f9['id'],'MailAccountId':_0x599999['account']['id'],'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')]['message']['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x4e')],'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'};return db[_0x5adb('0x51')][_0x5adb('0x35')]({'where':{'closed':![],'MailAccountId':_0x599999['account']['id']},'include':[{'model':db[_0x5adb('0x52')],'as':_0x5adb('0x53'),'attributes':[_0x5adb('0x4b')],'where':{'messageId':_0x599999['body'][_0x5adb('0x14')][_0x5adb('0x54')]}}]})[_0x5adb('0x49')](function(_0x4f6107){if(_0x4f6107){return[_0x4f6107,![]];}return db[_0x5adb('0x51')]['create'](_0x511746)[_0x5adb('0x49')](function(_0x1e7e3a){return[_0x1e7e3a,!![]];});});}else{throw new Error(_0x5adb('0x55'));}})['spread'](function(_0x192b1f,_0x3627d1){if(_0x192b1f){_0x121714=_0x3627d1;if(!_0x3627d1){return _0x192b1f['update']({'inReplyTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'to':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x48')],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')]['message']['subject'],'attach':_0x192b1f[_0x5adb('0x4e')]?_0x192b1f['attach']:_0x599999['body']['message'][_0x5adb('0x4e')],'substatus':null,'substatusAt':moment()[_0x5adb('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5adb('0x4f')](_0x5adb('0x50')),'lastMsgDirection':'in'});}else{return _0x192b1f;}}})[_0x5adb('0x49')](function(_0xf6ef8a){_0x399489[_0x5adb('0x56')]=_0xf6ef8a[_0x5adb('0x57')]({'plain':!![]});_0x399489[_0x5adb('0x56')][_0x5adb('0x58')]=_0x121714;return db['MailMessage']['create']({'body':_0x599999['body'][_0x5adb('0x27')],'MailAccountId':_0x599999[_0x5adb('0x3e')]['id'],'MailInteractionId':_0xf6ef8a['id'],'direction':'in','ContactId':_0x399489[_0x5adb('0x4a')]['id'],'messageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4b')],'from':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['from'],'to':_0x599999['body'][_0x5adb('0x14')]['to'],'cc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['cc'],'subject':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4d')],'attach':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x4e')],'Attachments':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x59')],'originTo':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originTo'],'originCc':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')]['originCc'],'bcc':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5a')],'ChatWebsiteId':_0x599999[_0x5adb('0x27')]['message'][_0x5adb('0x5b')]||null,'originChannel':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5c')]||_0x5adb('0x5d'),'ChatOfflineMessageId':_0x599999[_0x5adb('0x27')][_0x5adb('0x14')][_0x5adb('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x5adb('0x5f')}]});})[_0x5adb('0x49')](function(_0x2362b8){_0x399489['message']=_0x2362b8;if(_0x399489['interaction'][_0x5adb('0x60')]){return db['User'][_0x5adb('0x35')]({'attributes':['id',_0x5adb('0x61')],'where':{'id':_0x399489[_0x5adb('0x56')]['UserId']}})[_0x5adb('0x49')](function(_0x288e4f){if(_0x288e4f){_0x399489[_0x5adb('0x40')][_0x5adb('0x62')]({'id':0x0,'priority':0x0,'app':_0x5adb('0x63'),'appdata':_0x288e4f['name']+','+(_0x399489[_0x5adb('0x3e')][_0x5adb('0x64')]||0xa),'interval':_0x5adb('0x65')});}return respondWithRpcPromise(_0x5adb('0x66'),'startRouting',_0x399489);});}return respondWithRpcPromise(_0x5adb('0x66'),_0x5adb('0x67'),_0x399489);})[_0x5adb('0x49')](function(_0x1e9cd1){_0x2fbe14(_0x1e9cd1);})[_0x5adb('0x16')](function(_0x20faf6){_0x3a104a(_0x427c71[_0x5adb('0x12')](0x1f4,_0x20faf6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a7f0f0c..194e87e 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 _0x3743=['mailAccount:','./mailAccount.events','remove','register'];(function(_0x4bb8d2,_0x230aef){var _0x56a60c=function(_0x3236a2){while(--_0x3236a2){_0x4bb8d2['push'](_0x4bb8d2['shift']());}};_0x56a60c(++_0x230aef);}(_0x3743,0xd1));var _0x3374=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x3743[_0x322522];return _0x293bcf;};'use strict';var MailAccountEvents=require(_0x3374('0x0'));var events=['save',_0x3374('0x1'),'update'];function createListener(_0x277e80,_0x4a6d3d){return function(_0x3cea88){_0x4a6d3d['emit'](_0x277e80,_0x3cea88);};}function removeListener(_0x5c0aeb,_0x528f18){return function(){MailAccountEvents['removeListener'](_0x5c0aeb,_0x528f18);};}exports[_0x3374('0x2')]=function(_0x45c93a){for(var _0x56998f=0x0,_0x230a13=events['length'];_0x56998f<_0x230a13;_0x56998f++){var _0xb537e6=events[_0x56998f];var _0x2f6287=createListener(_0x3374('0x3')+_0xb537e6,_0x45c93a);MailAccountEvents['on'](_0xb537e6,_0x2f6287);}}; \ No newline at end of file +var _0x555e=['emit','register','mailAccount:','./mailAccount.events','save','remove'];(function(_0x5d56aa,_0x314fc6){var _0x1fb670=function(_0xf687dd){while(--_0xf687dd){_0x5d56aa['push'](_0x5d56aa['shift']());}};_0x1fb670(++_0x314fc6);}(_0x555e,0x159));var _0xe555=function(_0x216beb,_0x5781eb){_0x216beb=_0x216beb-0x0;var _0x1d69f0=_0x555e[_0x216beb];return _0x1d69f0;};'use strict';var MailAccountEvents=require(_0xe555('0x0'));var events=[_0xe555('0x1'),_0xe555('0x2'),'update'];function createListener(_0x43fc86,_0x2f1c01){return function(_0x1a5f37){_0x2f1c01[_0xe555('0x3')](_0x43fc86,_0x1a5f37);};}function removeListener(_0x5bfc5b,_0x563c8a){return function(){MailAccountEvents['removeListener'](_0x5bfc5b,_0x563c8a);};}exports[_0xe555('0x4')]=function(_0x240584){for(var _0x2616c3=0x0,_0x53a2cd=events['length'];_0x2616c3<_0x53a2cd;_0x2616c3++){var _0x29065f=events[_0x2616c3];var _0x5dd26d=createListener(_0xe555('0x5')+_0x29065f,_0x240584);MailAccountEvents['on'](_0x29065f,_0x5dd26d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index df56e9e..ebc4031 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 _0xae23=['show','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated'];(function(_0xc829c2,_0x174efd){var _0x1bdd2a=function(_0x33a147){while(--_0x33a147){_0xc829c2['push'](_0xc829c2['shift']());}};_0x1bdd2a(++_0x174efd);}(_0xae23,0x138));var _0x3ae2=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xae23[_0x521929];return _0x632436;};'use strict';var multer=require(_0x3ae2('0x0'));var util=require(_0x3ae2('0x1'));var path=require(_0x3ae2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ae2('0x3'));var router=express[_0x3ae2('0x4')]();var fs_extra=require(_0x3ae2('0x5'));var auth=require(_0x3ae2('0x6'));var interaction=require(_0x3ae2('0x7'));var config=require(_0x3ae2('0x8'));var controller=require(_0x3ae2('0x9'));router[_0x3ae2('0xa')]('/:id',auth[_0x3ae2('0xb')](),controller[_0x3ae2('0xc')]);router['put'](_0x3ae2('0xd'),auth[_0x3ae2('0xb')](),controller[_0x3ae2('0xe')]);router[_0x3ae2('0xf')](_0x3ae2('0xd'),auth['isAuthenticated'](),controller[_0x3ae2('0x10')]);module[_0x3ae2('0x11')]=router; \ No newline at end of file +var _0xff94=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x2718e4,_0x44ed43){var _0x1fb25c=function(_0x25f7c6){while(--_0x25f7c6){_0x2718e4['push'](_0x2718e4['shift']());}};_0x1fb25c(++_0x44ed43);}(_0xff94,0x158));var _0x4ff9=function(_0x2a9a05,_0x18ab1d){_0x2a9a05=_0x2a9a05-0x0;var _0x23d035=_0xff94[_0x2a9a05];return _0x23d035;};'use strict';var multer=require(_0x4ff9('0x0'));var util=require(_0x4ff9('0x1'));var path=require(_0x4ff9('0x2'));var timeout=require(_0x4ff9('0x3'));var express=require(_0x4ff9('0x4'));var router=express[_0x4ff9('0x5')]();var fs_extra=require(_0x4ff9('0x6'));var auth=require(_0x4ff9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4ff9('0x8'));var controller=require(_0x4ff9('0x9'));router[_0x4ff9('0xa')](_0x4ff9('0xb'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0xd')]);router[_0x4ff9('0xe')]('/:id',auth[_0x4ff9('0xc')](),controller[_0x4ff9('0xf')]);router[_0x4ff9('0x10')](_0x4ff9('0xb'),auth[_0x4ff9('0xc')](),controller[_0x4ff9('0x11')]);module[_0x4ff9('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index fd1d407..a829978 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 _0x4f3a=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4f3a,0x92));var _0xa4f3=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x4f3a[_0x22b39b];return _0x280e1d;};'use strict';var Sequelize=require('sequelize');module[_0xa4f3('0x0')]={'priority':{'type':Sequelize[_0xa4f3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa4f3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa4f3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa4f3('0x4')}}; \ No newline at end of file +var _0xbaf4=['*,*,*,*','sequelize','STRING'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xbaf4,0x13f));var _0x4baf=function(_0x2f6de7,_0x54a6b6){_0x2f6de7=_0x2f6de7-0x0;var _0x1dcde4=_0xbaf4[_0x2f6de7];return _0x1dcde4;};'use strict';var Sequelize=require(_0x4baf('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4baf('0x1')]},'interval':{'type':Sequelize[_0x4baf('0x1')],'defaultValue':_0x4baf('0x2')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 61a8f78..c656823 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xaa88[_0x5d7227];return _0x15ac55;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1dfebf,_0x1d6791){var _0x5ec3fe=function(_0x874cfc){while(--_0x874cfc){_0x1dfebf['push'](_0x1dfebf['shift']());}};_0x5ec3fe(++_0x1d6791);}(_0x54ef,0x112));var _0xf54e=function(_0x4c6a35,_0x3dc067){_0x4c6a35=_0x4c6a35-0x0;var _0x509f0a=_0x54ef[_0x4c6a35];return _0x509f0a;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ce109dc..d4fac32 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 _0x9cfd=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci'];(function(_0x467de4,_0x4d14ca){var _0x10ddcb=function(_0x550483){while(--_0x550483){_0x467de4['push'](_0x467de4['shift']());}};_0x10ddcb(++_0x4d14ca);}(_0x9cfd,0x9c));var _0xd9cf=function(_0x1ded9b,_0x2940f0){_0x1ded9b=_0x1ded9b-0x0;var _0x299ba7=_0x9cfd[_0x1ded9b];return _0x299ba7;};'use strict';var _=require(_0xd9cf('0x0'));var util=require('util');var logger=require(_0xd9cf('0x1'))(_0xd9cf('0x2'));var moment=require(_0xd9cf('0x3'));var BPromise=require(_0xd9cf('0x4'));var rp=require(_0xd9cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9cf('0x6'));var attributes=require(_0xd9cf('0x7'));module[_0xd9cf('0x8')]=function(_0x3a67fb,_0x434fdf){return _0x3a67fb[_0xd9cf('0x9')]('MailApplication',attributes,{'tableName':_0xd9cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd9cf('0xb')});}; \ No newline at end of file +var _0xa9f7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x19484a,_0xfd7b55){var _0xb87ea6=function(_0x2f3a73){while(--_0x2f3a73){_0x19484a['push'](_0x19484a['shift']());}};_0xb87ea6(++_0xfd7b55);}(_0xa9f7,0x177));var _0x7a9f=function(_0x234f16,_0x43a99a){_0x234f16=_0x234f16-0x0;var _0x157ac8=_0xa9f7[_0x234f16];return _0x157ac8;};'use strict';var _=require(_0x7a9f('0x0'));var util=require(_0x7a9f('0x1'));var logger=require(_0x7a9f('0x2'))(_0x7a9f('0x3'));var moment=require(_0x7a9f('0x4'));var BPromise=require(_0x7a9f('0x5'));var rp=require(_0x7a9f('0x6'));var fs=require('fs');var path=require(_0x7a9f('0x7'));var rimraf=require(_0x7a9f('0x8'));var config=require(_0x7a9f('0x9'));var attributes=require('./mailApplication.attributes');module[_0x7a9f('0xa')]=function(_0x19779b,_0x4a0e40){return _0x19779b[_0x7a9f('0xb')](_0x7a9f('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a9f('0xd'),'collate':_0x7a9f('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5b4fadd..0ce887d 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 _0xf948=['error','code','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x58563f,_0x196ea2){var _0xe50dc7=function(_0x36ca5b){while(--_0x36ca5b){_0x58563f['push'](_0x58563f['shift']());}};_0xe50dc7(++_0x196ea2);}(_0xf948,0xc0));var _0x8f94=function(_0x37a63c,_0x33588b){_0x37a63c=_0x37a63c-0x0;var _0x2f737e=_0xf948[_0x37a63c];return _0x2f737e;};'use strict';var _=require(_0x8f94('0x0'));var util=require(_0x8f94('0x1'));var moment=require(_0x8f94('0x2'));var BPromise=require(_0x8f94('0x3'));var rs=require(_0x8f94('0x4'));var fs=require('fs');var Redis=require(_0x8f94('0x5'));var db=require(_0x8f94('0x6'))['db'];var utils=require(_0x8f94('0x7'));var logger=require(_0x8f94('0x8'))(_0x8f94('0x9'));var config=require('../../config/environment');var jayson=require(_0x8f94('0xa'));var client=jayson['client'][_0x8f94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50bd5f,_0x263002,_0x207d1d){return new BPromise(function(_0x308411,_0x2d2806){return client[_0x8f94('0xc')](_0x50bd5f,_0x207d1d)[_0x8f94('0xd')](function(_0x28a02b){logger['info'](_0x8f94('0xe'),_0x263002,'request\x20sent');logger[_0x8f94('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x263002,_0x8f94('0x10'),JSON[_0x8f94('0x11')](_0x28a02b));if(_0x28a02b[_0x8f94('0x12')]){if(_0x28a02b['error'][_0x8f94('0x13')]===0x1f4){logger[_0x8f94('0x12')](_0x8f94('0xe'),_0x263002,_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);return _0x2d2806(_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);}logger[_0x8f94('0x12')]('MailApplication,\x20%s,\x20%s',_0x263002,_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);return _0x308411(_0x28a02b[_0x8f94('0x12')][_0x8f94('0x14')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x263002,_0x8f94('0x10'));_0x308411(_0x28a02b['result'][_0x8f94('0x14')]);}})[_0x8f94('0x15')](function(_0x7b22d5){logger[_0x8f94('0x12')]('MailApplication,\x20%s,\x20%s',_0x263002,_0x7b22d5);_0x2d2806(_0x7b22d5);});});}exports[_0x8f94('0x16')]=function(_0x3a9481){var _0x4bc30c=this;return new Promise(function(_0x56fc42,_0x2de33a){return db[_0x8f94('0x17')][_0x8f94('0x18')](_0x3a9481[_0x8f94('0x19')],{'raw':_0x3a9481[_0x8f94('0x1a')]?_0x3a9481[_0x8f94('0x1a')][_0x8f94('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9481['options']?_0x3a9481[_0x8f94('0x1a')]['where']||null:null,'attributes':_0x3a9481['options']?_0x3a9481[_0x8f94('0x1a')][_0x8f94('0x1c')]||null:null,'limit':_0x3a9481[_0x8f94('0x1a')]?_0x3a9481[_0x8f94('0x1a')]['limit']||null:null})['then'](function(_0x5b4acc){logger[_0x8f94('0x1d')](_0x8f94('0x16'),_0x3a9481);logger[_0x8f94('0xf')](_0x8f94('0x16'),_0x3a9481,JSON['stringify'](_0x5b4acc));_0x56fc42(_0x5b4acc);})['catch'](function(_0x4160c0){logger[_0x8f94('0x12')](_0x8f94('0x16'),_0x4160c0['message'],_0x3a9481);_0x2de33a(_0x4bc30c[_0x8f94('0x12')](0x1f4,_0x4160c0[_0x8f94('0x14')]));});});}; \ No newline at end of file +var _0x7391=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','body','options','where','attributes','limit','lodash'];(function(_0x3fff90,_0x379523){var _0x1a70ee=function(_0x57a34b){while(--_0x57a34b){_0x3fff90['push'](_0x3fff90['shift']());}};_0x1a70ee(++_0x379523);}(_0x7391,0x8b));var _0x1739=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x7391[_0x5d6b41];return _0x1c2dd6;};'use strict';var _=require(_0x1739('0x0'));var util=require(_0x1739('0x1'));var moment=require('moment');var BPromise=require(_0x1739('0x2'));var rs=require(_0x1739('0x3'));var fs=require('fs');var Redis=require(_0x1739('0x4'));var db=require(_0x1739('0x5'))['db'];var utils=require(_0x1739('0x6'));var logger=require(_0x1739('0x7'))(_0x1739('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1739('0x9')][_0x1739('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fdef9,_0x30739c,_0x4cefce){return new BPromise(function(_0x565c08,_0x5e558e){return client['request'](_0x2fdef9,_0x4cefce)[_0x1739('0xb')](function(_0x3c1c98){logger[_0x1739('0xc')]('MailApplication,\x20%s,\x20%s',_0x30739c,'request\x20sent');logger[_0x1739('0xd')](_0x1739('0xe'),_0x30739c,_0x1739('0xf'),JSON[_0x1739('0x10')](_0x3c1c98));if(_0x3c1c98[_0x1739('0x11')]){if(_0x3c1c98[_0x1739('0x11')][_0x1739('0x12')]===0x1f4){logger[_0x1739('0x11')](_0x1739('0x13'),_0x30739c,_0x3c1c98['error'][_0x1739('0x14')]);return _0x5e558e(_0x3c1c98[_0x1739('0x11')][_0x1739('0x14')]);}logger['error'](_0x1739('0x13'),_0x30739c,_0x3c1c98[_0x1739('0x11')][_0x1739('0x14')]);return _0x565c08(_0x3c1c98[_0x1739('0x11')]['message']);}else{logger[_0x1739('0xc')](_0x1739('0x13'),_0x30739c,_0x1739('0xf'));_0x565c08(_0x3c1c98['result']['message']);}})[_0x1739('0x15')](function(_0x40d175){logger[_0x1739('0x11')](_0x1739('0x13'),_0x30739c,_0x40d175);_0x5e558e(_0x40d175);});});}exports[_0x1739('0x16')]=function(_0x269540){var _0x161441=this;return new Promise(function(_0x274933,_0x2dd2b4){return db['MailApplication']['update'](_0x269540[_0x1739('0x17')],{'raw':_0x269540[_0x1739('0x18')]?_0x269540[_0x1739('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269540[_0x1739('0x18')]?_0x269540[_0x1739('0x18')][_0x1739('0x19')]||null:null,'attributes':_0x269540[_0x1739('0x18')]?_0x269540[_0x1739('0x18')][_0x1739('0x1a')]||null:null,'limit':_0x269540[_0x1739('0x18')]?_0x269540[_0x1739('0x18')][_0x1739('0x1b')]||null:null})[_0x1739('0xb')](function(_0x10f24c){logger[_0x1739('0xc')](_0x1739('0x16'),_0x269540);logger[_0x1739('0xd')](_0x1739('0x16'),_0x269540,JSON['stringify'](_0x10f24c));_0x274933(_0x10f24c);})['catch'](function(_0x2b185b){logger[_0x1739('0x11')](_0x1739('0x16'),_0x2b185b[_0x1739('0x14')],_0x269540);_0x2dd2b4(_0x161441[_0x1739('0x11')](0x1f4,_0x2b185b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index af82321..3ff829c 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 _0xf9b6=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','getMessages'];(function(_0x1fabb8,_0xeb471f){var _0x495e1f=function(_0x150209){while(--_0x150209){_0x1fabb8['push'](_0x1fabb8['shift']());}};_0x495e1f(++_0xeb471f);}(_0xf9b6,0x114));var _0x6f9b=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xf9b6[_0x5e0bfe];return _0x6468b8;};'use strict';var express=require('express');var router=express[_0x6f9b('0x0')]();var auth=require(_0x6f9b('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x6f9b('0x2'));router['get']('/',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x4')]);router[_0x6f9b('0x5')](_0x6f9b('0x6'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6f9b('0x7')]);router['get'](_0x6f9b('0x8'),auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x9')]);router[_0x6f9b('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0x6f9b('0xa')]);router[_0x6f9b('0xb')]('/',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0xc')]);router['post'](_0x6f9b('0x8'),auth[_0x6f9b('0x3')](),controller[_0x6f9b('0xd')]);router['post'](_0x6f9b('0xe'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x6f9b('0x11')),controller['addTags']);router[_0x6f9b('0x12')](_0x6f9b('0x13'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')]('mail',_0x6f9b('0x14')),controller[_0x6f9b('0x15')]);router[_0x6f9b('0x16')](_0x6f9b('0x13'),auth[_0x6f9b('0x3')](),interaction[_0x6f9b('0xf')](_0x6f9b('0x10'),_0x6f9b('0x17')),controller['destroy']);router[_0x6f9b('0x16')]('/:id/tags',auth[_0x6f9b('0x3')](),controller[_0x6f9b('0x18')]);module[_0x6f9b('0x19')]=router; \ No newline at end of file +var _0x9fef=['/:id/download','download','post','tracked','mail','mailinteraction:addtags','addTags','put','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages'];(function(_0x3a82e1,_0x5d7ec7){var _0x5066b9=function(_0x274007){while(--_0x274007){_0x3a82e1['push'](_0x3a82e1['shift']());}};_0x5066b9(++_0x5d7ec7);}(_0x9fef,0x107));var _0xf9fe=function(_0x17325e,_0x5863f2){_0x17325e=_0x17325e-0x0;var _0x51062a=_0x9fef[_0x17325e];return _0x51062a;};'use strict';var express=require(_0xf9fe('0x0'));var router=express[_0xf9fe('0x1')]();var auth=require(_0xf9fe('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xf9fe('0x3'));router['get']('/',auth[_0xf9fe('0x4')](),controller[_0xf9fe('0x5')]);router[_0xf9fe('0x6')](_0xf9fe('0x7'),auth[_0xf9fe('0x4')](),controller[_0xf9fe('0x8')]);router[_0xf9fe('0x6')](_0xf9fe('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf9fe('0x6')](_0xf9fe('0xa'),auth[_0xf9fe('0x4')](),controller[_0xf9fe('0xb')]);router['get'](_0xf9fe('0xc'),auth[_0xf9fe('0x4')](),controller[_0xf9fe('0xd')]);router['post']('/',auth[_0xf9fe('0x4')](),controller['create']);router[_0xf9fe('0xe')]('/:id/messages',auth[_0xf9fe('0x4')](),controller['addMessage']);router[_0xf9fe('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xf9fe('0xf')](_0xf9fe('0x10'),_0xf9fe('0x11')),controller[_0xf9fe('0x12')]);router[_0xf9fe('0x13')]('/:id',auth[_0xf9fe('0x4')](),interaction[_0xf9fe('0xf')]('mail','mailinteraction:update'),controller['update']);router[_0xf9fe('0x14')]('/:id',auth[_0xf9fe('0x4')](),interaction[_0xf9fe('0xf')]('mail',_0xf9fe('0x15')),controller[_0xf9fe('0x16')]);router[_0xf9fe('0x14')](_0xf9fe('0x17'),auth[_0xf9fe('0x4')](),controller[_0xf9fe('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1a7ef74..19f449f 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 _0xcae2=['ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xcae2,0x107));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cae('0x0'));var iconv=require(_0x2cae('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2cae('0x3')]},'disposition':{'type':Sequelize[_0x2cae('0x4')]},'secondDisposition':{'type':Sequelize[_0x2cae('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2cae('0x4')]},'inReplyTo':{'type':Sequelize[_0x2cae('0x4')](0x1fe)},'to':{'type':Sequelize[_0x2cae('0x4')]},'cc':{'type':Sequelize[_0x2cae('0x5')](_0x2cae('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2cae('0x3')]},'substatus':{'type':Sequelize[_0x2cae('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2cae('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2cae('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2cae('0x7')]('in',_0x2cae('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ddd=['iconv','BOOLEAN','DATE','STRING','long','TEXT','ENUM','sequelize'];(function(_0x37bd46,_0x2cd9de){var _0x560101=function(_0x447878){while(--_0x447878){_0x37bd46['push'](_0x37bd46['shift']());}};_0x560101(++_0x2cd9de);}(_0x6ddd,0x157));var _0xd6dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6ddd[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xd6dd('0x0'));var iconv=require(_0xd6dd('0x1'));module['exports']={'closed':{'type':Sequelize[_0xd6dd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd6dd('0x3')]},'disposition':{'type':Sequelize[_0xd6dd('0x4')]},'secondDisposition':{'type':Sequelize[_0xd6dd('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd6dd('0x4')]},'note':{'type':Sequelize[_0xd6dd('0x4')]},'inReplyTo':{'type':Sequelize[_0xd6dd('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xd6dd('0x5'))},'subject':{'type':Sequelize[_0xd6dd('0x6')]()},'attach':{'type':Sequelize[_0xd6dd('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd6dd('0x3')]},'substatus':{'type':Sequelize[_0xd6dd('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd6dd('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd6dd('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd6dd('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd6dd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 660262f..61cc1eb 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 _0xdbd0=['filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','Tag','emit','removeTags','unix','toString','join','files','root','server','attachments','transcript-%d-%s.zip','Attachment','from','subject','createdAt','Messages','get','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','bcc','Attachments','existsSync','push','type','readFileSync','format','message%d.eml','unlinkSync','eml-format','zip-dir','bluebird','util','path','lodash','juice','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','sendStatus','status','offset','undefined','count','limit','Content-Range','end','error','name','send','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','mail','query','user','then','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','sort','where','MailInteractionId'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdbd0,0xf6));var _0x0dbd=function(_0x9e3352,_0x3b54d7){_0x9e3352=_0x9e3352-0x0;var _0x5ae6f9=_0xdbd0[_0x9e3352];return _0x5ae6f9;};'use strict';var emlformat=require(_0x0dbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dbd('0x1'));var moment=require('moment');var BPromise=require(_0x0dbd('0x2'));var util=require(_0x0dbd('0x3'));var path=require(_0x0dbd('0x4'));var fs=require('fs');var _=require(_0x0dbd('0x5'));var juice=require(_0x0dbd('0x6'));var Redis=require('ioredis');var interaction=require(_0x0dbd('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x0dbd('0x8'))('api');var config=require(_0x0dbd('0x9'));var db=require(_0x0dbd('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x0dbd('0xb')]=_[_0x0dbd('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0dbd('0xd'))(new Redis(config[_0x0dbd('0xb')]));require(_0x0dbd('0xe'))['register'](socket);function respondWithStatusCode(_0x3bf6f5,_0x29da7e){_0x29da7e=_0x29da7e||0xcc;return function(_0x3dae62){if(_0x3dae62){return _0x3bf6f5[_0x0dbd('0xf')](_0x29da7e);}return _0x3bf6f5['status'](_0x29da7e)['end']();};}function respondWithResult(_0x2bafa0,_0x5bd7da){_0x5bd7da=_0x5bd7da||0xc8;return function(_0x402b38){if(_0x402b38){return _0x2bafa0[_0x0dbd('0x10')](_0x5bd7da)['json'](_0x402b38);}};}function respondWithFilteredResult(_0x17e730,_0x22f24c){return function(_0x45b3a2){if(_0x45b3a2){var _0xc20fad=typeof _0x22f24c[_0x0dbd('0x11')]===_0x0dbd('0x12')&&typeof _0x22f24c['limit']===_0x0dbd('0x12');var _0x21c08f=_0x45b3a2[_0x0dbd('0x13')];var _0x4ec650=_0xc20fad?0x0:_0x22f24c[_0x0dbd('0x11')];var _0x3cd09c=_0xc20fad?_0x45b3a2[_0x0dbd('0x13')]:_0x22f24c[_0x0dbd('0x11')]+_0x22f24c[_0x0dbd('0x14')];var _0x54a7e9;if(_0x3cd09c>=_0x21c08f){_0x3cd09c=_0x21c08f;_0x54a7e9=0xc8;}else{_0x54a7e9=0xce;}_0x17e730[_0x0dbd('0x10')](_0x54a7e9);return _0x17e730['set'](_0x0dbd('0x15'),_0x4ec650+'-'+_0x3cd09c+'/'+_0x21c08f)['json'](_0x45b3a2);}return null;};}function saveUpdates(_0x4e3385){return function(_0xde4ecb){if(_0xde4ecb){return _0xde4ecb['update'](_0x4e3385)['then'](function(_0x1044f3){return _0x1044f3;});}return null;};}function removeEntity(_0x49f0f0){return function(_0x23f27f){if(_0x23f27f){return _0x23f27f['destroy']()['then'](function(){_0x49f0f0[_0x0dbd('0x10')](0xcc)[_0x0dbd('0x16')]();});}};}function handleEntityNotFound(_0x1b0207){return function(_0x3fba3e){if(!_0x3fba3e){_0x1b0207[_0x0dbd('0xf')](0x194);}return _0x3fba3e;};}function handleError(_0x1cee71,_0x51162c){_0x51162c=_0x51162c||0x1f4;return function(_0x41b2f2){logger[_0x0dbd('0x17')](_0x41b2f2['stack']);if(_0x41b2f2[_0x0dbd('0x18')]){delete _0x41b2f2['name'];}_0x1cee71[_0x0dbd('0x10')](_0x51162c)[_0x0dbd('0x19')](_0x41b2f2);};}exports['index']=function(_0x3c30a8,_0x4ec5c4){var _0x2e97c2={};var _0x371b74=_[_0x0dbd('0x1a')](db[_0x0dbd('0x1b')][_0x0dbd('0x1c')],function(_0xee31c8){return{'name':_0xee31c8[_0x0dbd('0x1d')],'type':_0xee31c8['type'][_0x0dbd('0x1e')]};});_0x2e97c2=qs[_0x0dbd('0x1f')](_0x371b74,_0x3c30a8);return interaction[_0x0dbd('0x20')](_0x0dbd('0x21'),_0x3c30a8[_0x0dbd('0x22')],_0x3c30a8[_0x0dbd('0x23')],_0x2e97c2,_0x371b74)[_0x0dbd('0x24')](respondWithFilteredResult(_0x4ec5c4,_0x2e97c2))[_0x0dbd('0x25')](handleError(_0x4ec5c4,null));};exports[_0x0dbd('0x26')]=function(_0x4d7161,_0x95db8){var _0x118678={'raw':![],'where':{'id':_0x4d7161[_0x0dbd('0x27')]['id']}},_0x3611cd={};_0x3611cd[_0x0dbd('0x28')]=_[_0x0dbd('0x29')](db[_0x0dbd('0x1b')]['rawAttributes']);_0x3611cd[_0x0dbd('0x22')]=_[_0x0dbd('0x29')](_0x4d7161[_0x0dbd('0x22')]);_0x3611cd[_0x0dbd('0x2a')]=_[_0x0dbd('0x2b')](_0x3611cd[_0x0dbd('0x28')],_0x3611cd[_0x0dbd('0x22')]);_0x118678['attributes']=_[_0x0dbd('0x2b')](_0x3611cd[_0x0dbd('0x28')],qs[_0x0dbd('0x2c')](_0x4d7161[_0x0dbd('0x22')][_0x0dbd('0x2c')]));_0x118678[_0x0dbd('0x2d')]=_0x118678[_0x0dbd('0x2d')][_0x0dbd('0x2e')]?_0x118678['attributes']:_0x3611cd[_0x0dbd('0x28')];if(_0x4d7161[_0x0dbd('0x22')][_0x0dbd('0x2f')]){_0x118678[_0x0dbd('0x30')]=[{'all':!![]}];}_0x118678=_[_0x0dbd('0x31')]({},_0x118678,_0x4d7161[_0x0dbd('0x32')]);return db[_0x0dbd('0x1b')][_0x0dbd('0x33')](_0x118678)['then'](handleEntityNotFound(_0x95db8,null))[_0x0dbd('0x24')](respondWithResult(_0x95db8,null))[_0x0dbd('0x25')](handleError(_0x95db8,null));};exports[_0x0dbd('0x34')]=function(_0x55a611,_0x2376ef){return db[_0x0dbd('0x1b')][_0x0dbd('0x34')](_0x55a611[_0x0dbd('0x35')],{})['then'](respondWithResult(_0x2376ef,0xc9))[_0x0dbd('0x25')](handleError(_0x2376ef,null));};exports['update']=function(_0xcdb4eb,_0xceb093){if(_0xcdb4eb[_0x0dbd('0x35')]['id']){delete _0xcdb4eb[_0x0dbd('0x35')]['id'];}return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0xcdb4eb['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0xceb093,null))['then'](saveUpdates(_0xcdb4eb['body'],null))['then'](respondWithResult(_0xceb093,null))['catch'](handleError(_0xceb093,null));};exports[_0x0dbd('0x36')]=function(_0x559a70,_0x26fdd6){return db[_0x0dbd('0x1b')]['find']({'where':{'id':_0x559a70['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x26fdd6,null))[_0x0dbd('0x24')](removeEntity(_0x26fdd6,null))[_0x0dbd('0x25')](handleError(_0x26fdd6,null));};exports['describe']=function(_0x14321f,_0x4e56ad){return db[_0x0dbd('0x1b')][_0x0dbd('0x37')]()[_0x0dbd('0x24')](respondWithResult(_0x4e56ad,null))[_0x0dbd('0x25')](handleError(_0x4e56ad,null));};exports[_0x0dbd('0x38')]=function(_0x4db32b,_0x39d3dc){return db[_0x0dbd('0x39')][_0x0dbd('0x33')]({'where':{'id':_0x4db32b['params']['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x39d3dc,null))[_0x0dbd('0x24')](function(_0xe383e8){if(_0xe383e8){return _0xe383e8['addMessage'](_0x4db32b[_0x0dbd('0x35')][_0x0dbd('0x3a')],_[_0x0dbd('0x3b')](_0x4db32b['body'],[_0x0dbd('0x3a'),'id'])||{});}})[_0x0dbd('0x24')](respondWithResult(_0x39d3dc,null))[_0x0dbd('0x25')](handleError(_0x39d3dc,null));};exports[_0x0dbd('0x3c')]=function(_0x1e3af5,_0x248962){var _0x420bb0={'raw':![],'where':{}};var _0xb968c3={};var _0x58e7b2={'count':0x0,'rows':[]};return db[_0x0dbd('0x1b')][_0x0dbd('0x3d')]({'where':{'id':_0x1e3af5[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x248962,null))[_0x0dbd('0x24')](function(_0x5ba59e){if(_0x5ba59e){_0xb968c3[_0x0dbd('0x28')]=_[_0x0dbd('0x29')](db[_0x0dbd('0x39')][_0x0dbd('0x1c')]);_0xb968c3[_0x0dbd('0x22')]=_[_0x0dbd('0x29')](_0x1e3af5['query']);_0xb968c3[_0x0dbd('0x2a')]=_['intersection'](_0xb968c3[_0x0dbd('0x28')],_0xb968c3[_0x0dbd('0x22')]);_0x420bb0[_0x0dbd('0x2d')]=_['intersection'](_0xb968c3[_0x0dbd('0x28')],qs[_0x0dbd('0x2c')](_0x1e3af5['query'][_0x0dbd('0x2c')]));_0x420bb0['attributes']=_0x420bb0[_0x0dbd('0x2d')][_0x0dbd('0x2e')]?_0x420bb0[_0x0dbd('0x2d')]:_0xb968c3[_0x0dbd('0x28')];if(!_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x3e')]('nolimit')){_0x420bb0[_0x0dbd('0x14')]=qs[_0x0dbd('0x14')](_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x14')]);_0x420bb0[_0x0dbd('0x11')]=qs[_0x0dbd('0x11')](_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x11')]);}_0x420bb0['order']=qs[_0x0dbd('0x3f')](_0x1e3af5[_0x0dbd('0x22')]['sort']);_0x420bb0['where']=qs[_0x0dbd('0x2a')](_['pick'](_0x1e3af5[_0x0dbd('0x22')],_0xb968c3[_0x0dbd('0x2a')]));_0x420bb0[_0x0dbd('0x40')][_0x0dbd('0x41')]=_0x5ba59e['id'];if(_0x1e3af5[_0x0dbd('0x22')]['filter']){_0x420bb0[_0x0dbd('0x40')]=_['merge'](_0x420bb0[_0x0dbd('0x40')],{'$or':_['map'](_0x420bb0[_0x0dbd('0x2d')],function(_0x528cf8){var _0x19ebb0={};_0x19ebb0[_0x528cf8]={'$like':'%'+_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x42')]+'%'};return _0x19ebb0;})});}if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x43')]){var _0x31b402=_0x1e3af5[_0x0dbd('0x22')]['$gte'][_0x0dbd('0x44')](',');var _0x4788f4={};_0x4788f4[_0x31b402[0x0]]={'$gte':moment(_0x31b402[0x1])['format'](_0x0dbd('0x45'))};_0x420bb0[_0x0dbd('0x40')]=_[_0x0dbd('0x31')](_0x420bb0['where'],_0x4788f4);}_0x420bb0=_[_0x0dbd('0x31')]({},_0x420bb0,_0x1e3af5[_0x0dbd('0x32')]);return db[_0x0dbd('0x39')][_0x0dbd('0x13')]({'where':_0x420bb0[_0x0dbd('0x40')]})[_0x0dbd('0x24')](function(_0xb7f0f9){_0x58e7b2[_0x0dbd('0x13')]=_0xb7f0f9;if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x2f')]){_0x420bb0[_0x0dbd('0x30')]=[{'all':!![]}];}return db[_0x0dbd('0x39')]['findAll'](_0x420bb0);})[_0x0dbd('0x24')](function(_0x5a2e8f){if(_0x1e3af5[_0x0dbd('0x22')][_0x0dbd('0x46')]==='true'){for(var _0xa39b02=0x0;_0xa39b02<_0x5a2e8f['length'];_0xa39b02++){_0x5a2e8f[_0xa39b02][_0x0dbd('0x35')]=juice(_0x5a2e8f[_0xa39b02][_0x0dbd('0x35')]);}}_0x58e7b2[_0x0dbd('0x47')]=_0x5a2e8f;return _0x58e7b2;});}})[_0x0dbd('0x24')](respondWithFilteredResult(_0x248962,_0x420bb0))['catch'](handleError(_0x248962,null));};exports[_0x0dbd('0x48')]=function(_0x2530e7,_0x5157ff){return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0x2530e7[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x5157ff,null))[_0x0dbd('0x24')](function(_0x51ab8b){if(_0x51ab8b){return _0x51ab8b['setTags'](_0x2530e7[_0x0dbd('0x35')]['ids'],_[_0x0dbd('0x3b')](_0x2530e7[_0x0dbd('0x35')],[_0x0dbd('0x3a'),'id'])||{})['spread'](function(){return db[_0x0dbd('0x49')][_0x0dbd('0x20')]({'attributes':['id','name','color'],'where':{'id':_0x2530e7['body']['ids']}});})[_0x0dbd('0x24')](function(_0x402df5){socket[_0x0dbd('0x4a')]('mailInteractionTags:save',{'id':Number(_0x2530e7[_0x0dbd('0x27')]['id']),'tags':_0x402df5||[]});return{'id':Number(_0x2530e7['params']['id']),'tags':_0x402df5||[]};});}})['then'](respondWithResult(_0x5157ff,null))[_0x0dbd('0x25')](handleError(_0x5157ff,null));};exports[_0x0dbd('0x4b')]=function(_0x4f7711,_0x5de636){return db[_0x0dbd('0x1b')]['find']({'where':{'id':_0x4f7711[_0x0dbd('0x27')]['id']}})[_0x0dbd('0x24')](handleEntityNotFound(_0x5de636,null))[_0x0dbd('0x24')](function(_0x144d02){if(_0x144d02){return _0x144d02[_0x0dbd('0x4b')](_0x4f7711[_0x0dbd('0x22')][_0x0dbd('0x3a')]);}})[_0x0dbd('0x24')](respondWithStatusCode(_0x5de636,null))[_0x0dbd('0x25')](handleError(_0x5de636,null));};exports['download']=function(_0x49d395,_0x279821){var _0x4213b5=moment()[_0x0dbd('0x4c')]()[_0x0dbd('0x4d')]();var _0x5021de=path[_0x0dbd('0x4e')](config['root'],'server',_0x0dbd('0x4f'),'tmp');var _0x22fa54=path[_0x0dbd('0x4e')](config[_0x0dbd('0x50')],_0x0dbd('0x51'),_0x0dbd('0x4f'),_0x0dbd('0x52'));var _0x4da85e=path[_0x0dbd('0x4e')](_0x5021de,_0x4213b5);var _0x1e4c27=util['format'](_0x0dbd('0x53'),_0x49d395[_0x0dbd('0x27')]['id'],_0x4213b5);var _0x261024=path['join'](_0x5021de,_0x1e4c27);var _0x39d2bd=[];if(_0x49d395['query'][_0x0dbd('0x52')]){_0x39d2bd['push']({'model':db[_0x0dbd('0x54')],'as':'Attachments','raw':!![]});}var _0x2b159b=[{'model':db[_0x0dbd('0x39')],'as':'Messages','attributes':['id','body',_0x0dbd('0x55'),'to','cc','bcc',_0x0dbd('0x56'),_0x0dbd('0x57')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x39d2bd}];return db[_0x0dbd('0x1b')][_0x0dbd('0x33')]({'where':{'id':_0x49d395[_0x0dbd('0x27')]['id']},'include':_0x2b159b})[_0x0dbd('0x24')](handleEntityNotFound(_0x279821,null))[_0x0dbd('0x24')](function(_0x210cdb){if(_0x210cdb&&_0x210cdb[_0x0dbd('0x58')]){var _0x568121=_0x210cdb[_0x0dbd('0x59')]({'plain':!![]});fs['mkdirSync'](_0x4da85e);return BPromise[_0x0dbd('0x5a')](_0x568121[_0x0dbd('0x58')],function(_0x18877d,_0x3f3846){var _0xfd35d3={'from':_0x18877d[_0x0dbd('0x55')],'to':_0x18877d['to']||_0x0dbd('0x5b'),'subject':_0x18877d[_0x0dbd('0x56')],'html':htmlEntities[_0x0dbd('0x5c')](_0x18877d['body']),'headers':{'Date':moment(_0x18877d[_0x0dbd('0x57')])['format'](_0x0dbd('0x5d'))},'attachments':[]};if(_0x18877d['cc']){_0xfd35d3['headers']['Cc']=_0x18877d['cc'];}if(_0x18877d['bcc']){_0xfd35d3['headers'][_0x0dbd('0x5e')]=_0x18877d[_0x0dbd('0x5f')];}return new BPromise(function(_0x57f8f1,_0x99a526){if(_0x18877d['Attachments']){for(var _0x57a206=0x0;_0x57a206<_0x18877d[_0x0dbd('0x60')]['length'];_0x57a206++){var _0x24c66e=_0x18877d[_0x0dbd('0x60')][_0x57a206];var _0x3d0276=path['join'](_0x22fa54,_0x24c66e['basename']);if(fs[_0x0dbd('0x61')](_0x3d0276)){_0xfd35d3[_0x0dbd('0x52')][_0x0dbd('0x62')]({'name':_0x24c66e['name'],'contentType':_0x24c66e[_0x0dbd('0x63')],'data':fs[_0x0dbd('0x64')](_0x3d0276)});}}}emlformat['build'](_0xfd35d3,function(_0x1bf853,_0x366d2b){if(_0x1bf853)return _0x99a526(_0x1bf853);fs['writeFileSync'](path[_0x0dbd('0x4e')](_0x4da85e,util[_0x0dbd('0x65')](_0x0dbd('0x66'),_0x3f3846)),_0x366d2b);return _0x57f8f1(_0x366d2b);});});})[_0x0dbd('0x24')](function(){return new BPromise(function(_0x4fd56c,_0xf2988a){zipdir(_0x4da85e,{'saveTo':_0x261024},function(_0x534b3d,_0x29cd04){if(_0x534b3d)return _0xf2988a(_0x534b3d);return _0x4fd56c(_0x29cd04);});})['then'](function(){return new BPromise(function(_0x14b5b5,_0x638b65){rimraf(_0x4da85e,function(_0x32e01b){if(_0x32e01b)_0x638b65(_0x32e01b);return _0x14b5b5();});});})[_0x0dbd('0x24')](function(){return _0x279821['download'](_0x261024,_0x1e4c27,function(_0x2397a3){if(!_0x2397a3)fs[_0x0dbd('0x67')](_0x261024);});});});}else{return _0x279821[_0x0dbd('0xf')](0xc8);}})[_0x0dbd('0x25')](handleError(_0x279821,null));}; \ No newline at end of file +var _0x8d54=['catch','show','params','model','query','filters','intersection','fields','attributes','length','includeAll','merge','options','MailInteraction','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','keys','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','join','server','files','root','attachments','push','Attachments','subject','createdAt','get','mkdirSync','each','from','decode','headers','bcc','Bcc','basename','readFileSync','build','writeFileSync','unlinkSync','rimraf','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','html-entities','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','status','end','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail'];(function(_0x115816,_0x17ad45){var _0xd625f0=function(_0x261452){while(--_0x261452){_0x115816['push'](_0x115816['shift']());}};_0xd625f0(++_0x17ad45);}(_0x8d54,0xb1));var _0x48d5=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x8d54[_0x3048ea];return _0x1a13c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48d5('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x48d5('0x1'));var util=require('util');var path=require(_0x48d5('0x2'));var fs=require('fs');var _=require(_0x48d5('0x3'));var juice=require(_0x48d5('0x4'));var Redis=require(_0x48d5('0x5'));var interaction=require(_0x48d5('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x48d5('0x7'))('api');var config=require(_0x48d5('0x8'));var db=require(_0x48d5('0x9'))['db'];var htmlEntities=require(_0x48d5('0xa'));config['redis']=_[_0x48d5('0xb')](config['redis'],{'host':_0x48d5('0xc'),'port':0x18eb});var socket=require(_0x48d5('0xd'))(new Redis(config[_0x48d5('0xe')]));require(_0x48d5('0xf'))['register'](socket);function respondWithStatusCode(_0x4ed082,_0x15bbc0){_0x15bbc0=_0x15bbc0||0xcc;return function(_0x3f5e76){if(_0x3f5e76){return _0x4ed082['sendStatus'](_0x15bbc0);}return _0x4ed082[_0x48d5('0x10')](_0x15bbc0)[_0x48d5('0x11')]();};}function respondWithResult(_0x829033,_0x37769e){_0x37769e=_0x37769e||0xc8;return function(_0x5260ef){if(_0x5260ef){return _0x829033[_0x48d5('0x10')](_0x37769e)[_0x48d5('0x12')](_0x5260ef);}};}function respondWithFilteredResult(_0x2db525,_0x35a064){return function(_0x3a29aa){if(_0x3a29aa){var _0x43b60b=typeof _0x35a064[_0x48d5('0x13')]===_0x48d5('0x14')&&typeof _0x35a064[_0x48d5('0x15')]===_0x48d5('0x14');var _0x42c782=_0x3a29aa[_0x48d5('0x16')];var _0x1501c6=_0x43b60b?0x0:_0x35a064[_0x48d5('0x13')];var _0x36c6cf=_0x43b60b?_0x3a29aa[_0x48d5('0x16')]:_0x35a064['offset']+_0x35a064[_0x48d5('0x15')];var _0x525f40;if(_0x36c6cf>=_0x42c782){_0x36c6cf=_0x42c782;_0x525f40=0xc8;}else{_0x525f40=0xce;}_0x2db525[_0x48d5('0x10')](_0x525f40);return _0x2db525[_0x48d5('0x17')]('Content-Range',_0x1501c6+'-'+_0x36c6cf+'/'+_0x42c782)[_0x48d5('0x12')](_0x3a29aa);}return null;};}function saveUpdates(_0x44f8ce){return function(_0x3c5e55){if(_0x3c5e55){return _0x3c5e55[_0x48d5('0x18')](_0x44f8ce)[_0x48d5('0x19')](function(_0x17fbba){return _0x17fbba;});}return null;};}function removeEntity(_0x4bb150){return function(_0x263654){if(_0x263654){return _0x263654[_0x48d5('0x1a')]()[_0x48d5('0x19')](function(){_0x4bb150['status'](0xcc)[_0x48d5('0x11')]();});}};}function handleEntityNotFound(_0x2fbbb3){return function(_0x2ec76b){if(!_0x2ec76b){_0x2fbbb3[_0x48d5('0x1b')](0x194);}return _0x2ec76b;};}function handleError(_0x5b294d,_0x3f9816){_0x3f9816=_0x3f9816||0x1f4;return function(_0x4e0b0f){logger[_0x48d5('0x1c')](_0x4e0b0f[_0x48d5('0x1d')]);if(_0x4e0b0f[_0x48d5('0x1e')]){delete _0x4e0b0f['name'];}_0x5b294d[_0x48d5('0x10')](_0x3f9816)['send'](_0x4e0b0f);};}exports['index']=function(_0x28f89a,_0x248c36){var _0x30d6b1={};var _0x4c7f8a=_[_0x48d5('0x1f')](db['MailInteraction'][_0x48d5('0x20')],function(_0x2bf0d6){return{'name':_0x2bf0d6[_0x48d5('0x21')],'type':_0x2bf0d6[_0x48d5('0x22')][_0x48d5('0x23')]};});_0x30d6b1=qs[_0x48d5('0x24')](_0x4c7f8a,_0x28f89a);return interaction[_0x48d5('0x25')](_0x48d5('0x26'),_0x28f89a['query'],_0x28f89a['user'],_0x30d6b1,_0x4c7f8a)[_0x48d5('0x19')](respondWithFilteredResult(_0x248c36,_0x30d6b1))[_0x48d5('0x27')](handleError(_0x248c36,null));};exports[_0x48d5('0x28')]=function(_0x1b119d,_0x3942f1){var _0x5e9603={'raw':![],'where':{'id':_0x1b119d[_0x48d5('0x29')]['id']}},_0x34cab1={};_0x34cab1[_0x48d5('0x2a')]=_['keys'](db['MailInteraction'][_0x48d5('0x20')]);_0x34cab1[_0x48d5('0x2b')]=_['keys'](_0x1b119d[_0x48d5('0x2b')]);_0x34cab1[_0x48d5('0x2c')]=_[_0x48d5('0x2d')](_0x34cab1[_0x48d5('0x2a')],_0x34cab1['query']);_0x5e9603['attributes']=_[_0x48d5('0x2d')](_0x34cab1['model'],qs[_0x48d5('0x2e')](_0x1b119d[_0x48d5('0x2b')]['fields']));_0x5e9603[_0x48d5('0x2f')]=_0x5e9603['attributes'][_0x48d5('0x30')]?_0x5e9603[_0x48d5('0x2f')]:_0x34cab1[_0x48d5('0x2a')];if(_0x1b119d[_0x48d5('0x2b')][_0x48d5('0x31')]){_0x5e9603['include']=[{'all':!![]}];}_0x5e9603=_[_0x48d5('0x32')]({},_0x5e9603,_0x1b119d[_0x48d5('0x33')]);return db[_0x48d5('0x34')][_0x48d5('0x35')](_0x5e9603)[_0x48d5('0x19')](handleEntityNotFound(_0x3942f1,null))[_0x48d5('0x19')](respondWithResult(_0x3942f1,null))['catch'](handleError(_0x3942f1,null));};exports[_0x48d5('0x36')]=function(_0x248a6e,_0x33d436){return db['MailInteraction'][_0x48d5('0x36')](_0x248a6e[_0x48d5('0x37')],{})[_0x48d5('0x19')](respondWithResult(_0x33d436,0xc9))[_0x48d5('0x27')](handleError(_0x33d436,null));};exports[_0x48d5('0x18')]=function(_0x1167f1,_0x399717){if(_0x1167f1[_0x48d5('0x37')]['id']){delete _0x1167f1[_0x48d5('0x37')]['id'];}return db[_0x48d5('0x34')]['find']({'where':{'id':_0x1167f1[_0x48d5('0x29')]['id']}})['then'](handleEntityNotFound(_0x399717,null))[_0x48d5('0x19')](saveUpdates(_0x1167f1[_0x48d5('0x37')],null))[_0x48d5('0x19')](respondWithResult(_0x399717,null))[_0x48d5('0x27')](handleError(_0x399717,null));};exports[_0x48d5('0x1a')]=function(_0x3ce141,_0x365878){return db[_0x48d5('0x34')][_0x48d5('0x35')]({'where':{'id':_0x3ce141['params']['id']}})[_0x48d5('0x19')](handleEntityNotFound(_0x365878,null))[_0x48d5('0x19')](removeEntity(_0x365878,null))['catch'](handleError(_0x365878,null));};exports['describe']=function(_0x53d60e,_0x1be69a){return db[_0x48d5('0x34')][_0x48d5('0x38')]()['then'](respondWithResult(_0x1be69a,null))[_0x48d5('0x27')](handleError(_0x1be69a,null));};exports[_0x48d5('0x39')]=function(_0x253c23,_0x2fc329){return db[_0x48d5('0x3a')][_0x48d5('0x35')]({'where':{'id':_0x253c23[_0x48d5('0x29')]['id']}})[_0x48d5('0x19')](handleEntityNotFound(_0x2fc329,null))[_0x48d5('0x19')](function(_0x401e2f){if(_0x401e2f){return _0x401e2f[_0x48d5('0x39')](_0x253c23[_0x48d5('0x37')][_0x48d5('0x3b')],_[_0x48d5('0x3c')](_0x253c23[_0x48d5('0x37')],[_0x48d5('0x3b'),'id'])||{});}})[_0x48d5('0x19')](respondWithResult(_0x2fc329,null))[_0x48d5('0x27')](handleError(_0x2fc329,null));};exports[_0x48d5('0x3d')]=function(_0x5d9c99,_0x2dd24b){var _0x361e17={'raw':![],'where':{}};var _0x302cbe={};var _0x8280ba={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x5d9c99[_0x48d5('0x29')]['id']}})['then'](handleEntityNotFound(_0x2dd24b,null))[_0x48d5('0x19')](function(_0x5c65ba){if(_0x5c65ba){_0x302cbe[_0x48d5('0x2a')]=_[_0x48d5('0x3e')](db[_0x48d5('0x3a')][_0x48d5('0x20')]);_0x302cbe['query']=_[_0x48d5('0x3e')](_0x5d9c99[_0x48d5('0x2b')]);_0x302cbe['filters']=_[_0x48d5('0x2d')](_0x302cbe[_0x48d5('0x2a')],_0x302cbe[_0x48d5('0x2b')]);_0x361e17[_0x48d5('0x2f')]=_['intersection'](_0x302cbe[_0x48d5('0x2a')],qs[_0x48d5('0x2e')](_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x2e')]));_0x361e17[_0x48d5('0x2f')]=_0x361e17[_0x48d5('0x2f')][_0x48d5('0x30')]?_0x361e17[_0x48d5('0x2f')]:_0x302cbe[_0x48d5('0x2a')];if(!_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x3f')](_0x48d5('0x40'))){_0x361e17[_0x48d5('0x15')]=qs[_0x48d5('0x15')](_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x15')]);_0x361e17[_0x48d5('0x13')]=qs[_0x48d5('0x13')](_0x5d9c99['query']['offset']);}_0x361e17['order']=qs[_0x48d5('0x41')](_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x41')]);_0x361e17[_0x48d5('0x42')]=qs[_0x48d5('0x2c')](_[_0x48d5('0x43')](_0x5d9c99[_0x48d5('0x2b')],_0x302cbe[_0x48d5('0x2c')]));_0x361e17[_0x48d5('0x42')][_0x48d5('0x44')]=_0x5c65ba['id'];if(_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x45')]){_0x361e17['where']=_[_0x48d5('0x32')](_0x361e17[_0x48d5('0x42')],{'$or':_[_0x48d5('0x1f')](_0x361e17[_0x48d5('0x2f')],function(_0x532a12){var _0x15576b={};_0x15576b[_0x532a12]={'$like':'%'+_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x45')]+'%'};return _0x15576b;})});}if(_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x46')]){var _0x4a22d1=_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x46')][_0x48d5('0x47')](',');var _0x5725c3={};_0x5725c3[_0x4a22d1[0x0]]={'$gte':moment(_0x4a22d1[0x1])[_0x48d5('0x48')](_0x48d5('0x49'))};_0x361e17[_0x48d5('0x42')]=_['merge'](_0x361e17[_0x48d5('0x42')],_0x5725c3);}_0x361e17=_[_0x48d5('0x32')]({},_0x361e17,_0x5d9c99[_0x48d5('0x33')]);return db[_0x48d5('0x3a')][_0x48d5('0x16')]({'where':_0x361e17[_0x48d5('0x42')]})[_0x48d5('0x19')](function(_0xd2414e){_0x8280ba[_0x48d5('0x16')]=_0xd2414e;if(_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x31')]){_0x361e17[_0x48d5('0x4a')]=[{'all':!![]}];}return db[_0x48d5('0x3a')][_0x48d5('0x25')](_0x361e17);})[_0x48d5('0x19')](function(_0x500de7){if(_0x5d9c99[_0x48d5('0x2b')][_0x48d5('0x4b')]===_0x48d5('0x4c')){for(var _0x17693a=0x0;_0x17693a<_0x500de7[_0x48d5('0x30')];_0x17693a++){_0x500de7[_0x17693a][_0x48d5('0x37')]=juice(_0x500de7[_0x17693a][_0x48d5('0x37')]);}}_0x8280ba[_0x48d5('0x4d')]=_0x500de7;return _0x8280ba;});}})[_0x48d5('0x19')](respondWithFilteredResult(_0x2dd24b,_0x361e17))[_0x48d5('0x27')](handleError(_0x2dd24b,null));};exports[_0x48d5('0x4e')]=function(_0x223e6f,_0x41accc){return db[_0x48d5('0x34')][_0x48d5('0x35')]({'where':{'id':_0x223e6f[_0x48d5('0x29')]['id']}})[_0x48d5('0x19')](handleEntityNotFound(_0x41accc,null))['then'](function(_0x116069){if(_0x116069){return _0x116069[_0x48d5('0x4f')](_0x223e6f[_0x48d5('0x37')][_0x48d5('0x3b')],_['omit'](_0x223e6f[_0x48d5('0x37')],[_0x48d5('0x3b'),'id'])||{})['spread'](function(){return db[_0x48d5('0x50')][_0x48d5('0x25')]({'attributes':['id',_0x48d5('0x1e'),_0x48d5('0x51')],'where':{'id':_0x223e6f[_0x48d5('0x37')][_0x48d5('0x3b')]}});})['then'](function(_0xadbff1){socket[_0x48d5('0x52')]('mailInteractionTags:save',{'id':Number(_0x223e6f[_0x48d5('0x29')]['id']),'tags':_0xadbff1||[]});return{'id':Number(_0x223e6f[_0x48d5('0x29')]['id']),'tags':_0xadbff1||[]};});}})[_0x48d5('0x19')](respondWithResult(_0x41accc,null))[_0x48d5('0x27')](handleError(_0x41accc,null));};exports[_0x48d5('0x53')]=function(_0x330f64,_0x50e68f){return db[_0x48d5('0x34')][_0x48d5('0x35')]({'where':{'id':_0x330f64[_0x48d5('0x29')]['id']}})[_0x48d5('0x19')](handleEntityNotFound(_0x50e68f,null))[_0x48d5('0x19')](function(_0x27151b){if(_0x27151b){return _0x27151b[_0x48d5('0x53')](_0x330f64[_0x48d5('0x2b')][_0x48d5('0x3b')]);}})[_0x48d5('0x19')](respondWithStatusCode(_0x50e68f,null))[_0x48d5('0x27')](handleError(_0x50e68f,null));};exports[_0x48d5('0x54')]=function(_0x59b27d,_0x5a5aa7){var _0x441879=moment()[_0x48d5('0x55')]()['toString']();var _0x165b92=path[_0x48d5('0x56')](config['root'],_0x48d5('0x57'),_0x48d5('0x58'),'tmp');var _0x4f0458=path[_0x48d5('0x56')](config[_0x48d5('0x59')],'server',_0x48d5('0x58'),_0x48d5('0x5a'));var _0x250a57=path['join'](_0x165b92,_0x441879);var _0x486757=util['format']('transcript-%d-%s.zip',_0x59b27d[_0x48d5('0x29')]['id'],_0x441879);var _0x520a0a=path[_0x48d5('0x56')](_0x165b92,_0x486757);var _0x2e0bd5=[];if(_0x59b27d[_0x48d5('0x2b')][_0x48d5('0x5a')]){_0x2e0bd5[_0x48d5('0x5b')]({'model':db['Attachment'],'as':_0x48d5('0x5c'),'raw':!![]});}var _0x294214=[{'model':db[_0x48d5('0x3a')],'as':'Messages','attributes':['id',_0x48d5('0x37'),'from','to','cc','bcc',_0x48d5('0x5d'),_0x48d5('0x5e')],'where':{'secret':![]},'order':qs[_0x48d5('0x41')]('id'),'include':_0x2e0bd5}];return db[_0x48d5('0x34')][_0x48d5('0x35')]({'where':{'id':_0x59b27d['params']['id']},'include':_0x294214})[_0x48d5('0x19')](handleEntityNotFound(_0x5a5aa7,null))[_0x48d5('0x19')](function(_0xebef98){if(_0xebef98&&_0xebef98['Messages']){var _0x530b66=_0xebef98[_0x48d5('0x5f')]({'plain':!![]});fs[_0x48d5('0x60')](_0x250a57);return BPromise[_0x48d5('0x61')](_0x530b66['Messages'],function(_0x3b23d5,_0x1f2bd6){var _0x56bce0={'from':_0x3b23d5[_0x48d5('0x62')],'to':_0x3b23d5['to']||'missing.recipient@your.company.com','subject':_0x3b23d5[_0x48d5('0x5d')],'html':htmlEntities[_0x48d5('0x63')](_0x3b23d5[_0x48d5('0x37')]),'headers':{'Date':moment(_0x3b23d5[_0x48d5('0x5e')])[_0x48d5('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3b23d5['cc']){_0x56bce0[_0x48d5('0x64')]['Cc']=_0x3b23d5['cc'];}if(_0x3b23d5[_0x48d5('0x65')]){_0x56bce0[_0x48d5('0x64')][_0x48d5('0x66')]=_0x3b23d5['bcc'];}return new BPromise(function(_0x1a53de,_0x2ff2bf){if(_0x3b23d5[_0x48d5('0x5c')]){for(var _0x35004a=0x0;_0x35004a<_0x3b23d5[_0x48d5('0x5c')][_0x48d5('0x30')];_0x35004a++){var _0x38ac1c=_0x3b23d5[_0x48d5('0x5c')][_0x35004a];var _0x2c8fef=path[_0x48d5('0x56')](_0x4f0458,_0x38ac1c[_0x48d5('0x67')]);if(fs['existsSync'](_0x2c8fef)){_0x56bce0[_0x48d5('0x5a')][_0x48d5('0x5b')]({'name':_0x38ac1c[_0x48d5('0x1e')],'contentType':_0x38ac1c[_0x48d5('0x22')],'data':fs[_0x48d5('0x68')](_0x2c8fef)});}}}emlformat[_0x48d5('0x69')](_0x56bce0,function(_0x100a4f,_0x3a3100){if(_0x100a4f)return _0x2ff2bf(_0x100a4f);fs[_0x48d5('0x6a')](path[_0x48d5('0x56')](_0x250a57,util['format']('message%d.eml',_0x1f2bd6)),_0x3a3100);return _0x1a53de(_0x3a3100);});});})[_0x48d5('0x19')](function(){return new BPromise(function(_0x1258c1,_0x20bd2c){zipdir(_0x250a57,{'saveTo':_0x520a0a},function(_0x484241,_0x21137b){if(_0x484241)return _0x20bd2c(_0x484241);return _0x1258c1(_0x21137b);});})[_0x48d5('0x19')](function(){return new BPromise(function(_0x3bdea9,_0x14c59a){rimraf(_0x250a57,function(_0x4e2432){if(_0x4e2432)_0x14c59a(_0x4e2432);return _0x3bdea9();});});})[_0x48d5('0x19')](function(){return _0x5a5aa7['download'](_0x520a0a,_0x486757,function(_0x21f3bb){if(!_0x21f3bb)fs[_0x48d5('0x6b')](_0x520a0a);});});});}else{return _0x5a5aa7[_0x48d5('0x1b')](0xc8);}})[_0x48d5('0x27')](handleError(_0x5a5aa7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6ca0283..3544958 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 _0xd9f0=['then','Users','setDataValue','length','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove'];(function(_0xea8171,_0x49ea98){var _0x5a7ce5=function(_0x55d6d9){while(--_0x55d6d9){_0xea8171['push'](_0xea8171['shift']());}};_0x5a7ce5(++_0x49ea98);}(_0xd9f0,0xe4));var _0x0d9f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd9f0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0d9f('0x0'))['db'][_0x0d9f('0x1')];var MailMessage=require(_0x0d9f('0x0'))['db'][_0x0d9f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0d9f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d9f('0x4'),'afterDestroy':_0x0d9f('0x5')};function emitEvent(_0x28dd6a){return function(_0x5286fe,_0x231054,_0x10d8f3){_0x5286fe['getUsers']({'attributes':['id'],'raw':!![]})[_0x0d9f('0x6')](function(_0x27da69){_0x5286fe['setDataValue'](_0x0d9f('0x7'),_0x27da69['map'](function(_0x47a76e){return{'id':_0x47a76e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5286fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d9f('0x6')](function(_0x4255fd){_0x5286fe[_0x0d9f('0x8')]('unreadMessages',_0x4255fd[_0x0d9f('0x9')]);MailInteractionEvents['emit'](_0x28dd6a+':'+_0x5286fe['id'],_0x5286fe);MailInteractionEvents['emit'](_0x28dd6a,_0x5286fe);_0x10d8f3(null);})[_0x0d9f('0xa')](_0x10d8f3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0d9f('0xb')](e,emitEvent(event));}}module[_0x0d9f('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x46d0=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46d0,0xb9));var _0x046d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46d0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x046d('0x0'));var MailInteraction=require(_0x046d('0x1'))['db'][_0x046d('0x2')];var MailMessage=require(_0x046d('0x1'))['db'][_0x046d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x046d('0x4')](0x0);var events={'afterCreate':_0x046d('0x5'),'afterUpdate':_0x046d('0x6'),'afterDestroy':_0x046d('0x7')};function emitEvent(_0x256eb2){return function(_0xe13fba,_0x429120,_0x3ddccc){_0xe13fba['getUsers']({'attributes':['id'],'raw':!![]})[_0x046d('0x8')](function(_0x205b01){_0xe13fba[_0x046d('0x9')]('Users',_0x205b01[_0x046d('0xa')](function(_0x4f1b57){return{'id':_0x4f1b57['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xe13fba['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14eaa0){_0xe13fba[_0x046d('0x9')](_0x046d('0xb'),_0x14eaa0[_0x046d('0xc')]);MailInteractionEvents[_0x046d('0xd')](_0x256eb2+':'+_0xe13fba['id'],_0xe13fba);MailInteractionEvents[_0x046d('0xd')](_0x256eb2,_0xe13fba);_0x3ddccc(null);})[_0x046d('0xe')](_0x3ddccc(null));};}for(var e in events){if(events[_0x046d('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x046d('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index fac119a..73ff38a 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 _0x1911=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4a8007,_0x110b76){var _0x3bc6ff=function(_0x576a5a){while(--_0x576a5a){_0x4a8007['push'](_0x4a8007['shift']());}};_0x3bc6ff(++_0x110b76);}(_0x1911,0x192));var _0x1191=function(_0x47eb8e,_0x36eb0d){_0x47eb8e=_0x47eb8e-0x0;var _0x28ec77=_0x1911[_0x47eb8e];return _0x28ec77;};'use strict';var _=require(_0x1191('0x0'));var util=require(_0x1191('0x1'));var logger=require(_0x1191('0x2'))(_0x1191('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1191('0x4'));var fs=require('fs');var path=require(_0x1191('0x5'));var rimraf=require(_0x1191('0x6'));var config=require(_0x1191('0x7'));var attributes=require(_0x1191('0x8'));module[_0x1191('0x9')]=function(_0x1f4768,_0x5b8b60){return _0x1f4768[_0x1191('0xa')](_0x1191('0xb'),attributes,{'tableName':_0x1191('0xc'),'paranoid':![],'indexes':[{'name':_0x1191('0xd'),'fields':[_0x1191('0xe'),'to'],'type':_0x1191('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37d5f7,_0x1efa8e,_0xb72563){if(_0x37d5f7[_0x1191('0x10')]){_0x37d5f7[_0x1191('0x11')]=moment()['format'](_0x1191('0x12'));}if(_0x37d5f7[_0x1191('0x13')]){_0x37d5f7[_0x1191('0x14')]=moment()[_0x1191('0x15')](_0x1191('0x12'));}_0xb72563(null,_0x1efa8e);},'beforeUpdate':function(_0x29b8db,_0x48d692,_0x5312ec){if(_0x29b8db[_0x1191('0x16')](_0x1191('0x10'))){_0x29b8db['substatusAt']=_0x29b8db[_0x1191('0x10')]?moment()[_0x1191('0x15')](_0x1191('0x12')):null;}if(_0x29b8db[_0x1191('0x16')](_0x1191('0x13'))){_0x29b8db[_0x1191('0x14')]=moment()[_0x1191('0x15')](_0x1191('0x12'));_0x29b8db[_0x1191('0x10')]=null;_0x29b8db[_0x1191('0x11')]=null;}_0x5312ec(null,_0x29b8db);},'afterUpdate':function(_0x1f4c56,_0x6303da,_0x188bb1){var _0xee56a1=_0x1f4768[_0x1191('0x17')];var _0x3b03c3=_0x1f4c56[_0x1191('0x18')]({'plain':!![]});if(_0x3b03c3['closed']){return _0xee56a1[_0x1191('0x19')][_0x1191('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x3b03c3['id']}})[_0x1191('0x1b')](function(){_0x188bb1();})[_0x1191('0x1c')](function(_0x45be0f){_0x188bb1(_0x45be0f);});}else{_0x188bb1();}}},'charset':_0x1191('0x1d'),'collate':_0x1191('0x1e')});}; \ No newline at end of file +var _0xbe18=['closed','changed','get','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x36f86b,_0x2bf5e6){var _0x15adda=function(_0x4d3131){while(--_0x4d3131){_0x36f86b['push'](_0x36f86b['shift']());}};_0x15adda(++_0x2bf5e6);}(_0xbe18,0x1e2));var _0x8be1=function(_0x381cac,_0x1a29a9){_0x381cac=_0x381cac-0x0;var _0xb6b55=_0xbe18[_0x381cac];return _0xb6b55;};'use strict';var _=require(_0x8be1('0x0'));var util=require('util');var logger=require(_0x8be1('0x1'))(_0x8be1('0x2'));var moment=require(_0x8be1('0x3'));var BPromise=require(_0x8be1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be1('0x5'));var rimraf=require('rimraf');var config=require(_0x8be1('0x6'));var attributes=require(_0x8be1('0x7'));module[_0x8be1('0x8')]=function(_0x5ae6fd,_0x5e2a70){return _0x5ae6fd[_0x8be1('0x9')]('MailInteraction',attributes,{'tableName':_0x8be1('0xa'),'paranoid':![],'indexes':[{'name':_0x8be1('0xb'),'fields':[_0x8be1('0xc'),'to'],'type':_0x8be1('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x248e52,_0x47dee4,_0x5a7f10){if(_0x248e52[_0x8be1('0xe')]){_0x248e52[_0x8be1('0xf')]=moment()[_0x8be1('0x10')](_0x8be1('0x11'));}if(_0x248e52[_0x8be1('0x12')]){_0x248e52['closedAt']=moment()['format'](_0x8be1('0x11'));}_0x5a7f10(null,_0x47dee4);},'beforeUpdate':function(_0x55d8c9,_0x271e9f,_0x8ca33c){if(_0x55d8c9[_0x8be1('0x13')]('substatus')){_0x55d8c9[_0x8be1('0xf')]=_0x55d8c9['substatus']?moment()[_0x8be1('0x10')](_0x8be1('0x11')):null;}if(_0x55d8c9[_0x8be1('0x13')](_0x8be1('0x12'))){_0x55d8c9['closedAt']=moment()[_0x8be1('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x55d8c9[_0x8be1('0xe')]=null;_0x55d8c9['substatusAt']=null;}_0x8ca33c(null,_0x55d8c9);},'afterUpdate':function(_0x19e2e3,_0x3bd960,_0x415840){var _0x1b2e21=_0x5ae6fd['models'];var _0x34e681=_0x19e2e3[_0x8be1('0x14')]({'plain':!![]});if(_0x34e681[_0x8be1('0x12')]){return _0x1b2e21['MailMessage'][_0x8be1('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x34e681['id']}})[_0x8be1('0x16')](function(){_0x415840();})[_0x8be1('0x17')](function(_0x587f25){_0x415840(_0x587f25);});}else{_0x415840();}}},'charset':'utf8mb4','collate':_0x8be1('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fa93fb0..57f0107 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 _0x095b=['request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','debug','catch','AddTagsToMailInteraction','then','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','info'];(function(_0x593a4a,_0x172bf4){var _0x30dfb5=function(_0x213c0e){while(--_0x213c0e){_0x593a4a['push'](_0x593a4a['shift']());}};_0x30dfb5(++_0x172bf4);}(_0x095b,0x6e));var _0xb095=function(_0x50b934,_0x3f966e){_0x50b934=_0x50b934-0x0;var _0x4db226=_0x095b[_0x50b934];return _0x4db226;};'use strict';var _=require(_0xb095('0x0'));var util=require('util');var moment=require(_0xb095('0x1'));var BPromise=require(_0xb095('0x2'));var rs=require(_0xb095('0x3'));var fs=require('fs');var Redis=require(_0xb095('0x4'));var db=require(_0xb095('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb095('0x6'))(_0xb095('0x7'));var config=require(_0xb095('0x8'));var jayson=require(_0xb095('0x9'));var client=jayson[_0xb095('0xa')][_0xb095('0xb')]({'port':0x232a});config[_0xb095('0xc')]=_[_0xb095('0xd')](config[_0xb095('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb095('0xe'))(new Redis(config[_0xb095('0xc')]));require(_0xb095('0xf'))[_0xb095('0x10')](socket);function respondWithRpcPromise(_0x10efbe,_0x311c57,_0x5c3522){return new BPromise(function(_0x47f74d,_0x2e510a){return client[_0xb095('0x11')](_0x10efbe,_0x5c3522)['then'](function(_0x192d2){logger[_0xb095('0x12')]('MailInteraction,\x20%s,\x20%s',_0x311c57,_0xb095('0x13'));logger['debug'](_0xb095('0x14'),_0x311c57,_0xb095('0x13'),JSON[_0xb095('0x15')](_0x192d2));if(_0x192d2[_0xb095('0x16')]){if(_0x192d2[_0xb095('0x16')][_0xb095('0x17')]===0x1f4){logger[_0xb095('0x16')]('MailInteraction,\x20%s,\x20%s',_0x311c57,_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);return _0x2e510a(_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);}logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x192d2['error']['message']);return _0x47f74d(_0x192d2['error'][_0xb095('0x18')]);}else{logger[_0xb095('0x12')](_0xb095('0x19'),_0x311c57,_0xb095('0x13'));_0x47f74d(_0x192d2[_0xb095('0x1a')][_0xb095('0x18')]);}})['catch'](function(_0x7f9045){logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x7f9045);_0x2e510a(_0x7f9045);});});}exports[_0xb095('0x1b')]=function(_0x5c2674){var _0x172b3e=this;return new Promise(function(_0x212c53,_0x2273f8){return db[_0xb095('0x1c')][_0xb095('0x1d')](_0x5c2674[_0xb095('0x1e')],{'raw':_0x5c2674['options']?_0x5c2674[_0xb095('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2674['options']?_0x5c2674['options'][_0xb095('0x20')]||null:null,'attributes':_0x5c2674['options']?_0x5c2674[_0xb095('0x1f')][_0xb095('0x21')]||null:null,'limit':_0x5c2674[_0xb095('0x1f')]?_0x5c2674[_0xb095('0x1f')]['limit']||null:null})['then'](function(_0x371365){logger['info'](_0xb095('0x1b'),_0x5c2674);logger[_0xb095('0x22')](_0xb095('0x1b'),_0x5c2674,JSON['stringify'](_0x371365));_0x212c53(_0x371365);})[_0xb095('0x23')](function(_0x608591){logger[_0xb095('0x16')](_0xb095('0x1b'),_0x608591[_0xb095('0x18')],_0x5c2674);_0x2273f8(_0x172b3e[_0xb095('0x16')](0x1f4,_0x608591[_0xb095('0x18')]));});});};exports[_0xb095('0x24')]=function(_0x5ed6f7){return new Promise(function(_0x55233e,_0xd6426c){return db[_0xb095('0x1c')]['find']({'where':_0x5ed6f7[_0xb095('0x1f')]?_0x5ed6f7[_0xb095('0x1f')][_0xb095('0x20')]||null:null})[_0xb095('0x25')](function(_0xe3bc42){if(_0xe3bc42){return _0xe3bc42[_0xb095('0x26')](_0x5ed6f7[_0xb095('0x1e')]['ids'],_[_0xb095('0x27')](_0x5ed6f7[_0xb095('0x1e')],[_0xb095('0x28'),'id'])||{});}})[_0xb095('0x29')](function(_0x3ec688){logger[_0xb095('0x12')](_0xb095('0x2a'),_0x5ed6f7);logger['debug']('AddTags',_0x5ed6f7,JSON['stringify'](_0x3ec688));_0x55233e(_0x3ec688);})['catch'](function(_0x4c390e){logger[_0xb095('0x16')](_0xb095('0x2a'),_0x4c390e[_0xb095('0x18')],_0x5ed6f7);_0xd6426c(_this[_0xb095('0x16')](0x1f4,_0x4c390e[_0xb095('0x18')]));});});}; \ No newline at end of file +var _0x9f53=['body','raw','options','attributes','limit','then','UpdateMailInteraction','find','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','update'];(function(_0x182aa3,_0x55cb6c){var _0x4bd366=function(_0x200578){while(--_0x200578){_0x182aa3['push'](_0x182aa3['shift']());}};_0x4bd366(++_0x55cb6c);}(_0x9f53,0xfb));var _0x39f5=function(_0x25dde9,_0x53668f){_0x25dde9=_0x25dde9-0x0;var _0x4a8b1a=_0x9f53[_0x25dde9];return _0x4a8b1a;};'use strict';var _=require(_0x39f5('0x0'));var util=require(_0x39f5('0x1'));var moment=require(_0x39f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x39f5('0x3'));var fs=require('fs');var Redis=require(_0x39f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39f5('0x5'));var logger=require(_0x39f5('0x6'))(_0x39f5('0x7'));var config=require(_0x39f5('0x8'));var jayson=require(_0x39f5('0x9'));var client=jayson[_0x39f5('0xa')][_0x39f5('0xb')]({'port':0x232a});config[_0x39f5('0xc')]=_[_0x39f5('0xd')](config['redis'],{'host':_0x39f5('0xe'),'port':0x18eb});var socket=require(_0x39f5('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5a4ef3,_0x21e6f8,_0xa21bfb){return new BPromise(function(_0x56ffc6,_0x2f5487){return client[_0x39f5('0x10')](_0x5a4ef3,_0xa21bfb)['then'](function(_0x5cce59){logger[_0x39f5('0x11')]('MailInteraction,\x20%s,\x20%s',_0x21e6f8,'request\x20sent');logger[_0x39f5('0x12')](_0x39f5('0x13'),_0x21e6f8,_0x39f5('0x14'),JSON[_0x39f5('0x15')](_0x5cce59));if(_0x5cce59[_0x39f5('0x16')]){if(_0x5cce59[_0x39f5('0x16')]['code']===0x1f4){logger['error'](_0x39f5('0x17'),_0x21e6f8,_0x5cce59['error']['message']);return _0x2f5487(_0x5cce59[_0x39f5('0x16')]['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x21e6f8,_0x5cce59[_0x39f5('0x16')]['message']);return _0x56ffc6(_0x5cce59['error'][_0x39f5('0x18')]);}else{logger[_0x39f5('0x11')](_0x39f5('0x17'),_0x21e6f8,_0x39f5('0x14'));_0x56ffc6(_0x5cce59[_0x39f5('0x19')][_0x39f5('0x18')]);}})[_0x39f5('0x1a')](function(_0x4f2763){logger['error'](_0x39f5('0x17'),_0x21e6f8,_0x4f2763);_0x2f5487(_0x4f2763);});});}exports['UpdateMailInteraction']=function(_0x2d94fd){var _0x11619a=this;return new Promise(function(_0xe79213,_0x58e524){return db[_0x39f5('0x1b')][_0x39f5('0x1c')](_0x2d94fd[_0x39f5('0x1d')],{'raw':_0x2d94fd['options']?_0x2d94fd['options'][_0x39f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d94fd[_0x39f5('0x1f')]?_0x2d94fd['options']['where']||null:null,'attributes':_0x2d94fd[_0x39f5('0x1f')]?_0x2d94fd[_0x39f5('0x1f')][_0x39f5('0x20')]||null:null,'limit':_0x2d94fd[_0x39f5('0x1f')]?_0x2d94fd[_0x39f5('0x1f')][_0x39f5('0x21')]||null:null})[_0x39f5('0x22')](function(_0x147d67){logger[_0x39f5('0x11')](_0x39f5('0x23'),_0x2d94fd);logger[_0x39f5('0x12')]('UpdateMailInteraction',_0x2d94fd,JSON[_0x39f5('0x15')](_0x147d67));_0xe79213(_0x147d67);})['catch'](function(_0x5e3a2f){logger[_0x39f5('0x16')](_0x39f5('0x23'),_0x5e3a2f['message'],_0x2d94fd);_0x58e524(_0x11619a['error'](0x1f4,_0x5e3a2f[_0x39f5('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x39f678){return new Promise(function(_0x8f35f5,_0x4803c2){return db[_0x39f5('0x1b')][_0x39f5('0x24')]({'where':_0x39f678['options']?_0x39f678[_0x39f5('0x1f')]['where']||null:null})[_0x39f5('0x22')](function(_0x3b118b){if(_0x3b118b){return _0x3b118b['addTags'](_0x39f678[_0x39f5('0x1d')][_0x39f5('0x25')],_['omit'](_0x39f678['body'],[_0x39f5('0x25'),'id'])||{});}})[_0x39f5('0x26')](function(_0x4eec15){logger[_0x39f5('0x11')](_0x39f5('0x27'),_0x39f678);logger[_0x39f5('0x12')](_0x39f5('0x27'),_0x39f678,JSON[_0x39f5('0x15')](_0x4eec15));_0x8f35f5(_0x4eec15);})[_0x39f5('0x1a')](function(_0x3a0a6e){logger['error'](_0x39f5('0x27'),_0x3a0a6e['message'],_0x39f678);_0x4803c2(_this['error'](0x1f4,_0x3a0a6e[_0x39f5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a5542a4..549b5ca 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 _0xff4a=['remove','update','emit','register','length','./mailInteraction.events','save'];(function(_0x534be1,_0x525502){var _0x2905e4=function(_0x3978c4){while(--_0x3978c4){_0x534be1['push'](_0x534be1['shift']());}};_0x2905e4(++_0x525502);}(_0xff4a,0x1cc));var _0xaff4=function(_0x226a72,_0xa15351){_0x226a72=_0x226a72-0x0;var _0x51dc3f=_0xff4a[_0x226a72];return _0x51dc3f;};'use strict';var MailInteractionEvents=require(_0xaff4('0x0'));var events=[_0xaff4('0x1'),_0xaff4('0x2'),_0xaff4('0x3')];function createListener(_0x9cf83b,_0x17edb1){return function(_0x15f8bb){_0x17edb1[_0xaff4('0x4')](_0x9cf83b,_0x15f8bb);};}function removeListener(_0x52a51f,_0x3814f5){return function(){MailInteractionEvents['removeListener'](_0x52a51f,_0x3814f5);};}exports[_0xaff4('0x5')]=function(_0x28655e){for(var _0x1a75bd=0x0,_0x1b3027=events[_0xaff4('0x6')];_0x1a75bd<_0x1b3027;_0x1a75bd++){var _0x1f3678=events[_0x1a75bd];var _0x37a217=createListener('mailInteraction:'+_0x1f3678,_0x28655e);MailInteractionEvents['on'](_0x1f3678,_0x37a217);}}; \ No newline at end of file +var _0x20ba=['./mailInteraction.events','save','remove','update','emit','length'];(function(_0x5a9291,_0x4dc2a6){var _0xb91377=function(_0x57719b){while(--_0x57719b){_0x5a9291['push'](_0x5a9291['shift']());}};_0xb91377(++_0x4dc2a6);}(_0x20ba,0x150));var _0xa20b=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x20ba[_0x4fc421];return _0x8c6d63;};'use strict';var MailInteractionEvents=require(_0xa20b('0x0'));var events=[_0xa20b('0x1'),_0xa20b('0x2'),_0xa20b('0x3')];function createListener(_0x82a129,_0x503299){return function(_0x10f6cf){_0x503299[_0xa20b('0x4')](_0x82a129,_0x10f6cf);};}function removeListener(_0x506798,_0x419cf7){return function(){MailInteractionEvents['removeListener'](_0x506798,_0x419cf7);};}exports['register']=function(_0x45947a){for(var _0x3e1ad6=0x0,_0x5ba191=events[_0xa20b('0x5')];_0x3e1ad6<_0x5ba191;_0x3e1ad6++){var _0x2627cf=events[_0x3e1ad6];var _0x33fb99=createListener('mailInteraction:'+_0x2627cf,_0x45947a);MailInteractionEvents['on'](_0x2627cf,_0x33fb99);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 72bd687..9b757c6 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 _0x86a8=['mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked'];(function(_0x467df4,_0x24b22f){var _0x38f096=function(_0x4c9502){while(--_0x4c9502){_0x467df4['push'](_0x467df4['shift']());}};_0x38f096(++_0x24b22f);}(_0x86a8,0x1ae));var _0x886a=function(_0x1ad411,_0x3f76c1){_0x1ad411=_0x1ad411-0x0;var _0x3dd70f=_0x86a8[_0x1ad411];return _0x3dd70f;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require(_0x886a('0x3'));var express=require(_0x886a('0x4'));var router=express[_0x886a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x886a('0x6'));var interaction=require(_0x886a('0x7'));var config=require('../../config/environment');var controller=require(_0x886a('0x8'));router[_0x886a('0x9')]('/',auth['isAuthenticated'](),controller[_0x886a('0xa')]);router['get'](_0x886a('0xb'),auth['isAuthenticated'](),controller[_0x886a('0xc')]);router[_0x886a('0x9')](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0xf')]);router[_0x886a('0x9')](_0x886a('0x10'),auth[_0x886a('0xe')](),controller[_0x886a('0x11')]);router[_0x886a('0x12')]('/',auth['isAuthenticated'](),interaction[_0x886a('0x13')](_0x886a('0x14'),_0x886a('0x15')),controller[_0x886a('0x16')]);router['put'](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0x17')]);router[_0x886a('0x18')](_0x886a('0x19'),auth[_0x886a('0xe')](),controller[_0x886a('0x1a')]);router[_0x886a('0x18')](_0x886a('0x1b'),auth[_0x886a('0xe')](),controller['reject']);router[_0x886a('0x1c')](_0x886a('0xd'),auth[_0x886a('0xe')](),controller[_0x886a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x8e44=['/:id/download','download','post','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0x8e44,0x1ac));var _0x48e4=function(_0x1874ec,_0x599576){_0x1874ec=_0x1874ec-0x0;var _0x2e6308=_0x8e44[_0x1874ec];return _0x2e6308;};'use strict';var multer=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var path=require(_0x48e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x48e4('0x3')]();var fs_extra=require(_0x48e4('0x4'));var auth=require(_0x48e4('0x5'));var interaction=require(_0x48e4('0x6'));var config=require('../../config/environment');var controller=require(_0x48e4('0x7'));router[_0x48e4('0x8')]('/',auth[_0x48e4('0x9')](),controller['index']);router['get'](_0x48e4('0xa'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xb')]);router[_0x48e4('0x8')](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller[_0x48e4('0xd')]);router[_0x48e4('0x8')](_0x48e4('0xe'),auth['isAuthenticated'](),controller[_0x48e4('0xf')]);router[_0x48e4('0x10')]('/',auth[_0x48e4('0x9')](),interaction['tracked']('mail',_0x48e4('0x11')),controller[_0x48e4('0x12')]);router[_0x48e4('0x13')](_0x48e4('0xc'),auth['isAuthenticated'](),controller[_0x48e4('0x14')]);router['put'](_0x48e4('0x15'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x16')]);router[_0x48e4('0x13')](_0x48e4('0x17'),auth[_0x48e4('0x9')](),controller[_0x48e4('0x18')]);router['delete'](_0x48e4('0xc'),auth[_0x48e4('0x9')](),controller['destroy']);module[_0x48e4('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f710baa..89b0c70 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 _0xe317=['ENUM','out','STRING','DATE','INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe317,0x8a));var _0x7e31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe317[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7e31('0x0'));module[_0x7e31('0x1')]={'body':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x4'))},'read':{'type':Sequelize[_0x7e31('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e31('0x6')]('in',_0x7e31('0x7')),'defaultValue':_0x7e31('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e31('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7e31('0x8')]},'to':{'type':Sequelize[_0x7e31('0x2')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'subject':{'type':Sequelize[_0x7e31('0x2')]},'sentAt':{'type':Sequelize[_0x7e31('0x9')]},'attach':{'type':Sequelize[_0x7e31('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7e31('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7e31('0x9')]},'originTo':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'originCc':{'type':Sequelize[_0x7e31('0x2')](_0x7e31('0x3'))},'originChannel':{'type':Sequelize[_0x7e31('0x6')](_0x7e31('0xb'),'Chat'),'defaultValue':_0x7e31('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x7b69=['DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x7b69,0x114));var _0x97b6=function(_0x3c8b32,_0x59252d){_0x3c8b32=_0x3c8b32-0x0;var _0x43b309=_0x7b69[_0x3c8b32];return _0x43b309;};'use strict';var Sequelize=require(_0x97b6('0x0'));var _=require(_0x97b6('0x1'));module[_0x97b6('0x2')]={'body':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x5'))},'read':{'type':Sequelize[_0x97b6('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x97b6('0x7')]('in',_0x97b6('0x8')),'defaultValue':_0x97b6('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x97b6('0x9')](0x1fe)},'from':{'type':Sequelize[_0x97b6('0x9')]},'to':{'type':Sequelize[_0x97b6('0x3')]('long')},'cc':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x4'))},'bcc':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x4'))},'subject':{'type':Sequelize[_0x97b6('0x3')]},'sentAt':{'type':Sequelize[_0x97b6('0xa')]},'attach':{'type':Sequelize[_0x97b6('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x4'))},'originCc':{'type':Sequelize[_0x97b6('0x3')](_0x97b6('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x97b6('0xc'),'Chat'),'defaultValue':_0x97b6('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index a0a4c7c..1a374ad 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 _0x44f8=['include','findAll','rows','show','keys','includeAll','find','body','params','create','direction','out','secret','MailAccount','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','List','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','MailInteraction','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','SIP/%s','rejectmessage','download','toString','server','files','message-%s.eml','bcc','subject','Attachment','Attachments','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','client','http','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge','options','MailMessage'];(function(_0x39c5e5,_0x2198a9){var _0x30c44c=function(_0xc956db){while(--_0xc956db){_0x39c5e5['push'](_0x39c5e5['shift']());}};_0x30c44c(++_0x2198a9);}(_0x44f8,0x193));var _0x844f=function(_0x53236b,_0x45443b){_0x53236b=_0x53236b-0x0;var _0x2c8631=_0x44f8[_0x53236b];return _0x2c8631;};'use strict';var emlformat=require(_0x844f('0x0'));var moment=require(_0x844f('0x1'));var BPromise=require('bluebird');var util=require(_0x844f('0x2'));var path=require(_0x844f('0x3'));var fs=require('fs');var _=require(_0x844f('0x4'));var Redis=require(_0x844f('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x844f('0x6'));var logger=require(_0x844f('0x7'))(_0x844f('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x844f('0x9'));var db=require(_0x844f('0xa'))['db'];config[_0x844f('0xb')]=_[_0x844f('0xc')](config['redis'],{'host':_0x844f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x844f('0xb')]));var htmlEntities=require(_0x844f('0xe'));require('./mailMessage.socket')[_0x844f('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232c});var client9003=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232b});var client9002=jayson[_0x844f('0x10')][_0x844f('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x381212,_0xd31c8b,_0x2cea33,_0x3546fd){return new BPromise(function(_0x4f0771,_0x32ba5a){var _0x576fe8=_0x3546fd||client;return _0x576fe8[_0x844f('0x12')](_0x381212,_0x2cea33)['then'](function(_0x1ec733){logger['info'](_0x844f('0x13'),_0xd31c8b,_0x844f('0x14'));logger[_0x844f('0x15')](_0x844f('0x16'),_0xd31c8b,'request\x20sent',JSON[_0x844f('0x17')](_0x1ec733));if(_0x1ec733[_0x844f('0x18')]){if(_0x1ec733['error'][_0x844f('0x19')]===0x1f4){logger[_0x844f('0x18')]('MailMessage,\x20%s,\x20%s',_0xd31c8b,_0x1ec733[_0x844f('0x18')]['message']);return _0x32ba5a(_0x1ec733['error'][_0x844f('0x1a')]);}logger[_0x844f('0x18')](_0x844f('0x13'),_0xd31c8b,_0x1ec733[_0x844f('0x18')]['message']);return _0x4f0771(_0x1ec733['error']['message']);}else{logger[_0x844f('0x1b')](_0x844f('0x13'),_0xd31c8b,_0x844f('0x14'));_0x4f0771(_0x1ec733['result']['message']);}})[_0x844f('0x1c')](function(_0x1ed0fa){logger[_0x844f('0x18')](_0x844f('0x13'),_0xd31c8b,_0x1ed0fa);_0x32ba5a(_0x1ed0fa);});});}function respondWithResult(_0x449b39,_0x2b54eb){_0x2b54eb=_0x2b54eb||0xc8;return function(_0x2aa2a9){if(_0x2aa2a9){return _0x449b39[_0x844f('0x1d')](_0x2b54eb)[_0x844f('0x1e')](_0x2aa2a9);}};}function respondWithFilteredResult(_0x1cfd26,_0xaeb104){return function(_0x59efe9){if(_0x59efe9){var _0x3d39ca=typeof _0xaeb104['offset']==='undefined'&&typeof _0xaeb104[_0x844f('0x1f')]==='undefined';var _0x5a2d1b=_0x59efe9[_0x844f('0x20')];var _0x15207b=_0x3d39ca?0x0:_0xaeb104['offset'];var _0x51dea2=_0x3d39ca?_0x59efe9[_0x844f('0x20')]:_0xaeb104['offset']+_0xaeb104[_0x844f('0x1f')];var _0x40e762;if(_0x51dea2>=_0x5a2d1b){_0x51dea2=_0x5a2d1b;_0x40e762=0xc8;}else{_0x40e762=0xce;}_0x1cfd26[_0x844f('0x1d')](_0x40e762);return _0x1cfd26[_0x844f('0x21')](_0x844f('0x22'),_0x15207b+'-'+_0x51dea2+'/'+_0x5a2d1b)[_0x844f('0x1e')](_0x59efe9);}return null;};}function saveUpdates(_0x35958d){return function(_0xa34d58){if(_0xa34d58){return _0xa34d58[_0x844f('0x23')](_0x35958d)[_0x844f('0x24')](function(_0x5701b8){return _0x5701b8;});}return null;};}function removeEntity(_0x3a5970){return function(_0x11118e){if(_0x11118e){return _0x11118e[_0x844f('0x25')]()[_0x844f('0x24')](function(){_0x3a5970[_0x844f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222a22){return function(_0x3b42f2){if(!_0x3b42f2){_0x222a22[_0x844f('0x26')](0x194);}return _0x3b42f2;};}function handleError(_0x1e0bd9,_0x471905){_0x471905=_0x471905||0x1f4;return function(_0x49502e){logger[_0x844f('0x18')](_0x49502e[_0x844f('0x27')]);if(_0x49502e[_0x844f('0x28')]){delete _0x49502e[_0x844f('0x28')];}_0x1e0bd9['status'](_0x471905)['send'](_0x49502e);};}exports['index']=function(_0x24c2cf,_0x17abfd){var _0x251b24={},_0x5eb5ee={},_0x1aa6c7={'count':0x0,'rows':[]};var _0xeaa75e=_[_0x844f('0x29')](db['MailMessage'][_0x844f('0x2a')],function(_0x40a194){return{'name':_0x40a194[_0x844f('0x2b')],'type':_0x40a194[_0x844f('0x2c')][_0x844f('0x2d')]};});_0x5eb5ee[_0x844f('0x2e')]=_[_0x844f('0x29')](_0xeaa75e,_0x844f('0x28'));_0x5eb5ee[_0x844f('0x2f')]=_['keys'](_0x24c2cf[_0x844f('0x2f')]);_0x5eb5ee[_0x844f('0x30')]=_[_0x844f('0x31')](_0x5eb5ee['model'],_0x5eb5ee[_0x844f('0x2f')]);_0x251b24[_0x844f('0x32')]=_['intersection'](_0x5eb5ee['model'],qs['fields'](_0x24c2cf[_0x844f('0x2f')][_0x844f('0x33')]));_0x251b24['attributes']=_0x251b24['attributes'][_0x844f('0x34')]?_0x251b24[_0x844f('0x32')]:_0x5eb5ee[_0x844f('0x2e')];if(!_0x24c2cf[_0x844f('0x2f')][_0x844f('0x35')]('nolimit')){_0x251b24['limit']=qs[_0x844f('0x1f')](_0x24c2cf['query'][_0x844f('0x1f')]);_0x251b24['offset']=qs[_0x844f('0x36')](_0x24c2cf[_0x844f('0x2f')][_0x844f('0x36')]);}_0x251b24[_0x844f('0x37')]=qs[_0x844f('0x38')](_0x24c2cf[_0x844f('0x2f')]['sort']);_0x251b24[_0x844f('0x39')]=qs[_0x844f('0x30')](_['pick'](_0x24c2cf[_0x844f('0x2f')],_0x5eb5ee[_0x844f('0x30')]),_0xeaa75e);if(_0x24c2cf[_0x844f('0x2f')][_0x844f('0x3a')]){_0x251b24[_0x844f('0x39')]=_[_0x844f('0x3b')](_0x251b24[_0x844f('0x39')],{'$or':_['map'](_0xeaa75e,function(_0x282c6f){if(_0x282c6f[_0x844f('0x2c')]!=='VIRTUAL'){var _0x1645e0={};_0x1645e0[_0x282c6f[_0x844f('0x28')]]={'$like':'%'+_0x24c2cf[_0x844f('0x2f')][_0x844f('0x3a')]+'%'};return _0x1645e0;}})});}_0x251b24=_['merge']({},_0x251b24,_0x24c2cf[_0x844f('0x3c')]);var _0x305216={'where':_0x251b24[_0x844f('0x39')]};return db[_0x844f('0x3d')][_0x844f('0x20')](_0x305216)[_0x844f('0x24')](function(_0x3cb8a2){_0x1aa6c7[_0x844f('0x20')]=_0x3cb8a2;if(_0x24c2cf[_0x844f('0x2f')]['includeAll']){_0x251b24[_0x844f('0x3e')]=[{'all':!![]}];}return db[_0x844f('0x3d')][_0x844f('0x3f')](_0x251b24);})[_0x844f('0x24')](function(_0x18a84b){_0x1aa6c7[_0x844f('0x40')]=_0x18a84b;return _0x1aa6c7;})[_0x844f('0x24')](respondWithFilteredResult(_0x17abfd,_0x251b24))[_0x844f('0x1c')](handleError(_0x17abfd,null));};exports[_0x844f('0x41')]=function(_0x13a031,_0x56cd1d){var _0x47b684={'raw':!![],'where':{'id':_0x13a031['params']['id']}},_0x5a864c={};_0x5a864c[_0x844f('0x2e')]=_[_0x844f('0x42')](db[_0x844f('0x3d')][_0x844f('0x2a')]);_0x5a864c[_0x844f('0x2f')]=_[_0x844f('0x42')](_0x13a031[_0x844f('0x2f')]);_0x5a864c[_0x844f('0x30')]=_[_0x844f('0x31')](_0x5a864c[_0x844f('0x2e')],_0x5a864c[_0x844f('0x2f')]);_0x47b684[_0x844f('0x32')]=_['intersection'](_0x5a864c[_0x844f('0x2e')],qs['fields'](_0x13a031['query'][_0x844f('0x33')]));_0x47b684[_0x844f('0x32')]=_0x47b684[_0x844f('0x32')]['length']?_0x47b684[_0x844f('0x32')]:_0x5a864c[_0x844f('0x2e')];if(_0x13a031[_0x844f('0x2f')][_0x844f('0x43')]){_0x47b684['include']=[{'all':!![]}];}_0x47b684=_[_0x844f('0x3b')]({},_0x47b684,_0x13a031[_0x844f('0x3c')]);return db[_0x844f('0x3d')][_0x844f('0x44')](_0x47b684)[_0x844f('0x24')](handleEntityNotFound(_0x56cd1d,null))[_0x844f('0x24')](respondWithResult(_0x56cd1d,null))[_0x844f('0x1c')](handleError(_0x56cd1d,null));};exports['update']=function(_0x4ddc6b,_0x469a08){if(_0x4ddc6b['body']['id']){delete _0x4ddc6b[_0x844f('0x45')]['id'];}return db[_0x844f('0x3d')]['find']({'where':{'id':_0x4ddc6b[_0x844f('0x46')]['id']}})[_0x844f('0x24')](handleEntityNotFound(_0x469a08,null))['then'](saveUpdates(_0x4ddc6b[_0x844f('0x45')],null))[_0x844f('0x24')](respondWithResult(_0x469a08,null))['catch'](handleError(_0x469a08,null));};exports['destroy']=function(_0x4fa3ea,_0x599599){return db[_0x844f('0x3d')]['find']({'where':{'id':_0x4fa3ea[_0x844f('0x46')]['id']}})[_0x844f('0x24')](handleEntityNotFound(_0x599599,null))[_0x844f('0x24')](removeEntity(_0x599599,null))[_0x844f('0x1c')](handleError(_0x599599,null));};exports['describe']=function(_0x415f0f,_0x1a4d82){return db[_0x844f('0x3d')]['describe']()[_0x844f('0x24')](respondWithResult(_0x1a4d82,null))[_0x844f('0x1c')](handleError(_0x1a4d82,null));};exports[_0x844f('0x47')]=function(_0x1a6597,_0x46d60a){return db[_0x844f('0x3d')]['create'](_0x1a6597[_0x844f('0x45')])[_0x844f('0x24')](function(_0x13a206){if(_0x13a206){if(_0x13a206[_0x844f('0x48')]===_0x844f('0x49')&&!_0x13a206[_0x844f('0x4a')]){var _0x22b7c3,_0x562d2b,_0x15e54c;if(_0x1a6597[_0x844f('0x45')]['to']){_0x562d2b=_0x1a6597[_0x844f('0x45')]['to']['split'](',')[0x0];}return db[_0x844f('0x4b')]['findOne']({'where':{'id':_0x13a206[_0x844f('0x4c')]},'include':[{'model':db[_0x844f('0x4d')],'as':'List','include':[{'model':db[_0x844f('0x4e')],'as':_0x844f('0x4f'),'where':{'email':_0x562d2b},'limit':0x1,'order':[[_0x844f('0x50'),_0x844f('0x51')]]}]},{'model':db[_0x844f('0x52')],'as':_0x844f('0x53'),'raw':!![],'include':[{'model':db[_0x844f('0x54')],'as':'CloudProvider','raw':!![]}]}]})[_0x844f('0x24')](function(_0x4a3ebe){_0x22b7c3=_0x4a3ebe;if(!_0x22b7c3||!_0x22b7c3['Smtp'])return;var _0x414bb3=_0x22b7c3['getSmtpOptions']();if(_0x1a6597['body'][_0x844f('0x55')]&&_0x1a6597[_0x844f('0x45')][_0x844f('0x55')][_0x844f('0x34')]){for(var _0x572ee3=0x0;_0x572ee3<_0x1a6597[_0x844f('0x45')]['attachments'][_0x844f('0x34')];_0x572ee3+=0x1){_0x1a6597[_0x844f('0x45')]['attachments'][_0x572ee3]={'filename':_0x1a6597[_0x844f('0x45')][_0x844f('0x55')][_0x572ee3][_0x844f('0x28')],'path':path[_0x844f('0x56')](config[_0x844f('0x57')],_0x844f('0x58'),_0x1a6597[_0x844f('0x45')]['attachments'][_0x572ee3]['basename'])};}}_0x15e54c={'account':_0x414bb3,'message':_0x1a6597[_0x844f('0x45')]};return;})[_0x844f('0x24')](function(){if(_0x22b7c3[_0x844f('0x59')]){if(_0x22b7c3[_0x844f('0x59')][_0x844f('0x4f')][_0x844f('0x34')]){return _0x22b7c3[_0x844f('0x59')][_0x844f('0x4f')][0x0];}else{return db[_0x844f('0x4e')][_0x844f('0x47')](_['defaults'](_0x1a6597[_0x844f('0x45')],{'firstName':_0x1a6597[_0x844f('0x45')]['to'],'email':_0x1a6597[_0x844f('0x45')]['to'],'phone':_0x1a6597[_0x844f('0x45')]['to'],'ListId':_0x22b7c3[_0x844f('0x5a')]}));}}else{throw new Error(_0x844f('0x5b'));}})[_0x844f('0x24')](function(){if(_0x15e54c){return respondWithRpcPromise('SendMail',_0x844f('0x5c'),_0x15e54c,client9003)[_0x844f('0x24')](function(_0x212ce7){return _0x13a206[_0x844f('0x23')]({'read':!![],'messageId':_0x212ce7[_0x844f('0x5d')],'sentAt':moment()[_0x844f('0x5e')](_0x844f('0x5f'))});})[_0x844f('0x1c')](function(_0xf8e4b1){logger['error']('%s',JSON['stringify'](_0xf8e4b1));return _0x13a206;});}return _0x13a206;});}return _0x13a206;}})[_0x844f('0x24')](respondWithResult(_0x46d60a,0xc9))['catch'](handleError(_0x46d60a,null));};exports[_0x844f('0x60')]=function(_0xfda090,_0x12b7f0){var _0x30be77={'agent':{},'channel':_0x844f('0x61')};if(_0xfda090[_0x844f('0x45')]['id']){delete _0xfda090[_0x844f('0x45')]['id'];}_0xfda090['body'][_0x844f('0x62')]=!![];_0xfda090[_0x844f('0x45')][_0x844f('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfda090[_0x844f('0x45')][_0x844f('0x64')]=_0xfda090[_0x844f('0x45')]['UserId']||_0xfda090[_0x844f('0x65')]['id'];_0x30be77[_0x844f('0x66')]['id']=_0xfda090['body'][_0x844f('0x64')];return db[_0x844f('0x3d')][_0x844f('0x44')]({'where':{'id':_0xfda090['params']['id'],'UserId':null}})[_0x844f('0x24')](handleEntityNotFound(_0x12b7f0,null))['then'](saveUpdates(_0xfda090[_0x844f('0x45')],null))['then'](function(_0x63b0c3){if(_0x63b0c3){_0x30be77[_0x844f('0x1a')]=_0x63b0c3['get']({'plain':!![]});return db[_0x844f('0x67')][_0x844f('0x44')]({'where':{'id':_0x63b0c3['MailInteractionId']}});}return null;})[_0x844f('0x24')](handleEntityNotFound(_0x12b7f0,null))['then'](function(_0x227029){if(_0x227029){return _0x227029[_0x844f('0x23')]({'UserId':_0xfda090[_0x844f('0x45')][_0x844f('0x64')],'read1stAt':_[_0x844f('0x68')](_0x227029[_0x844f('0x69')])?moment()[_0x844f('0x5e')](_0x844f('0x5f')):undefined});}return null;})[_0x844f('0x24')](function(_0x358bef){if(_0x358bef){_0x30be77['interaction']=_0x358bef[_0x844f('0x6a')]({'plain':!![]});interaction_log[_0x844f('0x1b')](_0x844f('0x6b'),_0xfda090[_0x844f('0x65')]['id'],_0xfda090[_0x844f('0x65')]['name'],_0xfda090[_0x844f('0x65')]['role'],_0x30be77[_0x844f('0x6c')]['id'],_0xfda090[_0x844f('0x45')]?JSON[_0x844f('0x17')](_0xfda090[_0x844f('0x45')]):'null');return respondWithRpcPromise(_0x844f('0x6d'),_0x844f('0x6e'),_0x30be77);}return null;})[_0x844f('0x24')](function(_0x29667a){var _0x85c32c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29667a[_0x844f('0x1a')][_0x844f('0x6f')];return db[_0x844f('0x70')]['query'](_0x85c32c,{'type':db[_0x844f('0x71')][_0x844f('0x72')][_0x844f('0x73')],'raw':!![]})['then'](function(_0x88afbb){return _0x88afbb;});})[_0x844f('0x24')](function(_0x167f73){if(_0x167f73){_0x30be77[_0x844f('0x1a')][_0x844f('0x74')]=_0x167f73[0x0];if(!_0xfda090[_0x844f('0x45')]['UserId'])return;return db['User'][_0x844f('0x44')]({'where':{'id':_0xfda090[_0x844f('0x45')][_0x844f('0x64')],'role':_0x844f('0x66')},'attributes':['id',_0x844f('0x28'),_0x844f('0x75'),_0x844f('0x76'),_0x844f('0x77')],'raw':!![]});}return null;})[_0x844f('0x24')](function(_0x36fa6c){if(!_0x36fa6c)return null;_0x30be77[_0x844f('0x1a')][_0x844f('0x66')]=_0x36fa6c;return _0x30be77;})[_0x844f('0x24')](function(_0x5d5d53){if(_0x5d5d53){if(_0xfda090[_0x844f('0x45')][_0x844f('0x78')]){_0x30be77[_0x844f('0x1a')][_0x844f('0x79')]=util['format']('SIP/%s',_0xfda090[_0x844f('0x65')][_0x844f('0x28')]);_0x30be77[_0x844f('0x1a')][_0x844f('0x7a')]=_0x30be77[_0x844f('0x7a')];_0x30be77[_0x844f('0x1a')][_0x844f('0x7b')]=_0x30be77[_0x844f('0x7a')];_0x30be77[_0x844f('0x1a')]['event']=_0x844f('0x60');_0x30be77[_0x844f('0x1a')][_0x844f('0x45')]=htmlToText[_0x844f('0x7c')](_0x30be77[_0x844f('0x1a')][_0x844f('0x45')]);return respondWithRpcPromise(_0x844f('0x7d'),_0x844f('0x7d'),{'event':_0x844f('0x7e'),'message':_0x30be77['message']},client9002)[_0x844f('0x24')](function(){return _0x30be77;});}return _0x30be77;}return null;})[_0x844f('0x24')](respondWithResult(_0x12b7f0,null))[_0x844f('0x1c')](handleError(_0x12b7f0,null));};exports['reject']=function(_0x2d6379,_0xe33c40){var _0x29ebda={'agent':{},'channel':'mail'};if(_0x2d6379[_0x844f('0x45')]['id']){delete _0x2d6379[_0x844f('0x45')]['id'];}_0x2d6379[_0x844f('0x45')]['UserId']=_0x2d6379[_0x844f('0x45')][_0x844f('0x64')]||_0x2d6379['user']['id'];_0x29ebda[_0x844f('0x66')]['id']=_0x2d6379[_0x844f('0x45')][_0x844f('0x64')];return db[_0x844f('0x3d')]['find']({'where':{'id':_0x2d6379[_0x844f('0x46')]['id'],'UserId':null}})[_0x844f('0x24')](handleEntityNotFound(_0xe33c40,null))[_0x844f('0x24')](function(_0x50950f){if(_0x50950f){_0x29ebda[_0x844f('0x1a')]=_0x50950f[_0x844f('0x6a')]({'plain':!![]});return db[_0x844f('0x67')][_0x844f('0x44')]({'where':{'id':_0x50950f[_0x844f('0x7f')]}});}return null;})[_0x844f('0x24')](handleEntityNotFound(_0xe33c40,null))[_0x844f('0x24')](function(_0x15036c){if(_0x15036c){_0x29ebda['interaction']=_0x15036c[_0x844f('0x6a')]({'plain':!![]});interaction_log[_0x844f('0x1b')](_0x844f('0x80'),_0x2d6379[_0x844f('0x65')]['id'],_0x2d6379[_0x844f('0x65')][_0x844f('0x28')],_0x2d6379[_0x844f('0x65')][_0x844f('0x81')],_0x29ebda[_0x844f('0x6c')]['id'],_0x2d6379[_0x844f('0x45')]?JSON[_0x844f('0x17')](_0x2d6379[_0x844f('0x45')]):_0x844f('0x82'));return respondWithRpcPromise(_0x844f('0x83'),_0x844f('0x84'),_0x29ebda);}return null;})['then'](function(_0x17a4dd){var _0x589717='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17a4dd['message'][_0x844f('0x6f')];return db['sequelize'][_0x844f('0x2f')](_0x589717,{'type':db['Sequelize']['QueryTypes'][_0x844f('0x73')],'raw':!![]})[_0x844f('0x24')](function(_0x4177b7){return _0x4177b7;});})['then'](function(_0x512c89){if(_0x512c89){_0x29ebda[_0x844f('0x1a')]['contact']=_0x512c89[0x0];if(!_0x2d6379[_0x844f('0x45')][_0x844f('0x64')])return;return db[_0x844f('0x85')]['find']({'where':{'id':_0x2d6379['body'][_0x844f('0x64')],'role':'agent'},'attributes':['id',_0x844f('0x28'),_0x844f('0x75'),_0x844f('0x76'),_0x844f('0x77')],'raw':!![]});}return null;})['then'](function(_0xce89ba){if(!_0xce89ba)return null;_0x29ebda[_0x844f('0x1a')][_0x844f('0x66')]=_0xce89ba;return _0x29ebda;})[_0x844f('0x24')](function(_0xbecbdf){if(_0xbecbdf){_0xbecbdf['message'][_0x844f('0x79')]=util[_0x844f('0x5e')](_0x844f('0x86'),_0x2d6379['user']['name']);_0xbecbdf[_0x844f('0x1a')][_0x844f('0x7a')]=_0x29ebda[_0x844f('0x7a')];_0xbecbdf['message']['motionChannel']=_0x29ebda[_0x844f('0x7a')];_0xbecbdf[_0x844f('0x1a')]['event']='reject';_0xbecbdf['message'][_0x844f('0x45')]=htmlToText[_0x844f('0x7c')](_0x29ebda[_0x844f('0x1a')][_0x844f('0x45')]);respondWithRpcPromise(_0x844f('0x7d'),'EventManager',{'event':_0x844f('0x87'),'message':_0xbecbdf['message']},client9002);return _0x29ebda;}return null;})['then'](respondWithResult(_0xe33c40,null))['catch'](handleError(_0xe33c40,null));};exports[_0x844f('0x88')]=function(_0x5d8341,_0x3a8bc2){var _0x5d6188=moment()['unix']()[_0x844f('0x89')]();var _0x1a7943=path['join'](config['root'],_0x844f('0x8a'),_0x844f('0x8b'),'tmp');var _0x17bd40=path[_0x844f('0x56')](config[_0x844f('0x57')],_0x844f('0x8a'),'files',_0x844f('0x55'));var _0x543a8c=util[_0x844f('0x5e')](_0x844f('0x8c'),_0x5d6188);return db[_0x844f('0x3d')][_0x844f('0x44')]({'where':{'id':_0x5d8341[_0x844f('0x46')]['id']},'attributes':['id',_0x844f('0x45'),'from','to','cc',_0x844f('0x8d'),_0x844f('0x8e'),'createdAt'],'include':_0x5d8341[_0x844f('0x2f')]['attachments']?[{'model':db[_0x844f('0x8f')],'as':_0x844f('0x90')}]:undefined})['then'](handleEntityNotFound(_0x3a8bc2,null))[_0x844f('0x24')](function(_0x380d29){if(_0x380d29){var _0x1392c1=_0x380d29;var _0x343dd3={'from':_0x1392c1[_0x844f('0x91')],'to':_0x1392c1['to'],'subject':_0x1392c1[_0x844f('0x8e')],'html':htmlEntities[_0x844f('0x92')](_0x1392c1[_0x844f('0x45')]),'headers':{'Date':moment(_0x1392c1[_0x844f('0x93')])[_0x844f('0x5e')](_0x844f('0x94'))},'attachments':[]};if(_0x380d29['cc']){_0x343dd3[_0x844f('0x95')]['Cc']=_0x380d29['cc'];}if(_0x380d29['bcc']){_0x343dd3['headers'][_0x844f('0x96')]=_0x380d29['bcc'];}return new BPromise(function(_0x336ac5,_0x35ebfc){if(_0x380d29['Attachments']){for(var _0x5b8771=0x0;_0x5b8771<_0x380d29[_0x844f('0x90')]['length'];_0x5b8771++){var _0x191c6f=_0x380d29[_0x844f('0x90')][_0x5b8771];var _0x3c6ecc=path['join'](_0x17bd40,_0x191c6f['basename']);if(fs['existsSync'](_0x3c6ecc)){_0x343dd3[_0x844f('0x55')]['push']({'name':_0x191c6f['name'],'contentType':_0x191c6f['type'],'data':fs[_0x844f('0x97')](_0x3c6ecc)});}}}emlformat[_0x844f('0x98')](_0x343dd3,function(_0x2a6dce,_0x153c28){if(_0x2a6dce)return _0x35ebfc(_0x2a6dce);fs[_0x844f('0x99')](path['join'](_0x1a7943,_0x543a8c),_0x153c28);return _0x336ac5(_0x153c28);});});}})['then'](function(_0x2251c5){if(_0x2251c5){return _0x3a8bc2[_0x844f('0x88')](path[_0x844f('0x56')](_0x1a7943,_0x543a8c),_0x543a8c,function(_0x5d18a0){if(!_0x5d18a0)fs[_0x844f('0x9a')](path[_0x844f('0x56')](_0x1a7943,_0x543a8c));});}})[_0x844f('0x1c')](handleError(_0x3a8bc2,null));}; \ No newline at end of file +var _0x57eb=['agent','fullname','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','email','SIP/%s','rejectmessage','download','unix','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment','Attachments','from','subject','decode','headers','Bcc','basename','push','type','readFileSync','build','writeFileSync','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','options','find','body','describe','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE: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','SELECT','contact','User'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x57eb,0xca));var _0xb57e=function(_0x32cd29,_0x29f6bb){_0x32cd29=_0x32cd29-0x0;var _0x2f7e6e=_0x57eb[_0x32cd29];return _0x2f7e6e;};'use strict';var emlformat=require('eml-format');var moment=require(_0xb57e('0x0'));var BPromise=require(_0xb57e('0x1'));var util=require(_0xb57e('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xb57e('0x3'));var Redis=require(_0xb57e('0x4'));var htmlToText=require(_0xb57e('0x5'));var qs=require(_0xb57e('0x6'));var logger=require('../../config/logger')(_0xb57e('0x7'));var interaction_log=require('../../config/logger')(_0xb57e('0x8'));var config=require(_0xb57e('0x9'));var db=require('../../mysqldb')['db'];config[_0xb57e('0xa')]=_[_0xb57e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb57e('0xc'))(new Redis(config[_0xb57e('0xa')]));var htmlEntities=require(_0xb57e('0xd'));require('./mailMessage.socket')[_0xb57e('0xe')](socket);var jayson=require(_0xb57e('0xf'));var client=jayson[_0xb57e('0x10')][_0xb57e('0x11')]({'port':0x232c});var client9003=jayson['client'][_0xb57e('0x11')]({'port':0x232b});var client9002=jayson[_0xb57e('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203804,_0x270612,_0x22f6ff,_0x3667ed){return new BPromise(function(_0x3f6078,_0x4aee72){var _0x18168d=_0x3667ed||client;return _0x18168d[_0xb57e('0x12')](_0x203804,_0x22f6ff)[_0xb57e('0x13')](function(_0x2bf22e){logger[_0xb57e('0x14')](_0xb57e('0x15'),_0x270612,_0xb57e('0x16'));logger['debug'](_0xb57e('0x17'),_0x270612,_0xb57e('0x16'),JSON['stringify'](_0x2bf22e));if(_0x2bf22e[_0xb57e('0x18')]){if(_0x2bf22e[_0xb57e('0x18')][_0xb57e('0x19')]===0x1f4){logger[_0xb57e('0x18')](_0xb57e('0x15'),_0x270612,_0x2bf22e[_0xb57e('0x18')][_0xb57e('0x1a')]);return _0x4aee72(_0x2bf22e['error'][_0xb57e('0x1a')]);}logger[_0xb57e('0x18')](_0xb57e('0x15'),_0x270612,_0x2bf22e[_0xb57e('0x18')][_0xb57e('0x1a')]);return _0x3f6078(_0x2bf22e[_0xb57e('0x18')][_0xb57e('0x1a')]);}else{logger[_0xb57e('0x14')](_0xb57e('0x15'),_0x270612,_0xb57e('0x16'));_0x3f6078(_0x2bf22e['result']['message']);}})[_0xb57e('0x1b')](function(_0x3d2f9b){logger[_0xb57e('0x18')](_0xb57e('0x15'),_0x270612,_0x3d2f9b);_0x4aee72(_0x3d2f9b);});});}function respondWithResult(_0x509194,_0x5beb3d){_0x5beb3d=_0x5beb3d||0xc8;return function(_0x15a06f){if(_0x15a06f){return _0x509194[_0xb57e('0x1c')](_0x5beb3d)[_0xb57e('0x1d')](_0x15a06f);}};}function respondWithFilteredResult(_0x479006,_0x591fe6){return function(_0xb13586){if(_0xb13586){var _0x4d4279=typeof _0x591fe6[_0xb57e('0x1e')]===_0xb57e('0x1f')&&typeof _0x591fe6['limit']==='undefined';var _0x4b2c9b=_0xb13586[_0xb57e('0x20')];var _0x5ddb99=_0x4d4279?0x0:_0x591fe6[_0xb57e('0x1e')];var _0x17f260=_0x4d4279?_0xb13586['count']:_0x591fe6[_0xb57e('0x1e')]+_0x591fe6['limit'];var _0x23b7a1;if(_0x17f260>=_0x4b2c9b){_0x17f260=_0x4b2c9b;_0x23b7a1=0xc8;}else{_0x23b7a1=0xce;}_0x479006['status'](_0x23b7a1);return _0x479006[_0xb57e('0x21')](_0xb57e('0x22'),_0x5ddb99+'-'+_0x17f260+'/'+_0x4b2c9b)[_0xb57e('0x1d')](_0xb13586);}return null;};}function saveUpdates(_0x4670fd){return function(_0x5e50bd){if(_0x5e50bd){return _0x5e50bd[_0xb57e('0x23')](_0x4670fd)[_0xb57e('0x13')](function(_0x345646){return _0x345646;});}return null;};}function removeEntity(_0x46a5de){return function(_0x1bc853){if(_0x1bc853){return _0x1bc853[_0xb57e('0x24')]()[_0xb57e('0x13')](function(){_0x46a5de[_0xb57e('0x1c')](0xcc)[_0xb57e('0x25')]();});}};}function handleEntityNotFound(_0x431f02){return function(_0x43df6f){if(!_0x43df6f){_0x431f02[_0xb57e('0x26')](0x194);}return _0x43df6f;};}function handleError(_0x359f24,_0x1e35ab){_0x1e35ab=_0x1e35ab||0x1f4;return function(_0x1f3fc5){logger['error'](_0x1f3fc5[_0xb57e('0x27')]);if(_0x1f3fc5[_0xb57e('0x28')]){delete _0x1f3fc5[_0xb57e('0x28')];}_0x359f24[_0xb57e('0x1c')](_0x1e35ab)[_0xb57e('0x29')](_0x1f3fc5);};}exports[_0xb57e('0x2a')]=function(_0x31c6eb,_0x101f25){var _0x472cea={},_0x36866f={},_0x85b225={'count':0x0,'rows':[]};var _0x1c4e70=_[_0xb57e('0x2b')](db[_0xb57e('0x2c')]['rawAttributes'],function(_0x3c9c88){return{'name':_0x3c9c88[_0xb57e('0x2d')],'type':_0x3c9c88['type'][_0xb57e('0x2e')]};});_0x36866f['model']=_[_0xb57e('0x2b')](_0x1c4e70,'name');_0x36866f[_0xb57e('0x2f')]=_[_0xb57e('0x30')](_0x31c6eb[_0xb57e('0x2f')]);_0x36866f[_0xb57e('0x31')]=_['intersection'](_0x36866f[_0xb57e('0x32')],_0x36866f[_0xb57e('0x2f')]);_0x472cea['attributes']=_['intersection'](_0x36866f['model'],qs[_0xb57e('0x33')](_0x31c6eb[_0xb57e('0x2f')][_0xb57e('0x33')]));_0x472cea[_0xb57e('0x34')]=_0x472cea[_0xb57e('0x34')][_0xb57e('0x35')]?_0x472cea[_0xb57e('0x34')]:_0x36866f[_0xb57e('0x32')];if(!_0x31c6eb['query'][_0xb57e('0x36')](_0xb57e('0x37'))){_0x472cea[_0xb57e('0x38')]=qs[_0xb57e('0x38')](_0x31c6eb[_0xb57e('0x2f')]['limit']);_0x472cea[_0xb57e('0x1e')]=qs[_0xb57e('0x1e')](_0x31c6eb['query'][_0xb57e('0x1e')]);}_0x472cea['order']=qs[_0xb57e('0x39')](_0x31c6eb['query']['sort']);_0x472cea['where']=qs['filters'](_[_0xb57e('0x3a')](_0x31c6eb['query'],_0x36866f[_0xb57e('0x31')]),_0x1c4e70);if(_0x31c6eb[_0xb57e('0x2f')][_0xb57e('0x3b')]){_0x472cea[_0xb57e('0x3c')]=_[_0xb57e('0x3d')](_0x472cea[_0xb57e('0x3c')],{'$or':_[_0xb57e('0x2b')](_0x1c4e70,function(_0x10d7d8){if(_0x10d7d8['type']!==_0xb57e('0x3e')){var _0x536ec4={};_0x536ec4[_0x10d7d8['name']]={'$like':'%'+_0x31c6eb['query']['filter']+'%'};return _0x536ec4;}})});}_0x472cea=_[_0xb57e('0x3d')]({},_0x472cea,_0x31c6eb['options']);var _0x353ed5={'where':_0x472cea[_0xb57e('0x3c')]};return db[_0xb57e('0x2c')]['count'](_0x353ed5)[_0xb57e('0x13')](function(_0x47723e){_0x85b225[_0xb57e('0x20')]=_0x47723e;if(_0x31c6eb[_0xb57e('0x2f')][_0xb57e('0x3f')]){_0x472cea[_0xb57e('0x40')]=[{'all':!![]}];}return db[_0xb57e('0x2c')][_0xb57e('0x41')](_0x472cea);})[_0xb57e('0x13')](function(_0x3ba3b8){_0x85b225[_0xb57e('0x42')]=_0x3ba3b8;return _0x85b225;})[_0xb57e('0x13')](respondWithFilteredResult(_0x101f25,_0x472cea))[_0xb57e('0x1b')](handleError(_0x101f25,null));};exports[_0xb57e('0x43')]=function(_0x31c09d,_0x2cfba6){var _0x352e3f={'raw':!![],'where':{'id':_0x31c09d[_0xb57e('0x44')]['id']}},_0x503d24={};_0x503d24[_0xb57e('0x32')]=_[_0xb57e('0x30')](db[_0xb57e('0x2c')][_0xb57e('0x45')]);_0x503d24[_0xb57e('0x2f')]=_[_0xb57e('0x30')](_0x31c09d[_0xb57e('0x2f')]);_0x503d24[_0xb57e('0x31')]=_[_0xb57e('0x46')](_0x503d24[_0xb57e('0x32')],_0x503d24[_0xb57e('0x2f')]);_0x352e3f['attributes']=_['intersection'](_0x503d24[_0xb57e('0x32')],qs[_0xb57e('0x33')](_0x31c09d[_0xb57e('0x2f')][_0xb57e('0x33')]));_0x352e3f[_0xb57e('0x34')]=_0x352e3f[_0xb57e('0x34')][_0xb57e('0x35')]?_0x352e3f[_0xb57e('0x34')]:_0x503d24[_0xb57e('0x32')];if(_0x31c09d[_0xb57e('0x2f')][_0xb57e('0x3f')]){_0x352e3f[_0xb57e('0x40')]=[{'all':!![]}];}_0x352e3f=_[_0xb57e('0x3d')]({},_0x352e3f,_0x31c09d[_0xb57e('0x47')]);return db[_0xb57e('0x2c')][_0xb57e('0x48')](_0x352e3f)[_0xb57e('0x13')](handleEntityNotFound(_0x2cfba6,null))[_0xb57e('0x13')](respondWithResult(_0x2cfba6,null))[_0xb57e('0x1b')](handleError(_0x2cfba6,null));};exports[_0xb57e('0x23')]=function(_0x49e8b1,_0x2c5ca0){if(_0x49e8b1[_0xb57e('0x49')]['id']){delete _0x49e8b1[_0xb57e('0x49')]['id'];}return db[_0xb57e('0x2c')]['find']({'where':{'id':_0x49e8b1['params']['id']}})[_0xb57e('0x13')](handleEntityNotFound(_0x2c5ca0,null))[_0xb57e('0x13')](saveUpdates(_0x49e8b1['body'],null))[_0xb57e('0x13')](respondWithResult(_0x2c5ca0,null))[_0xb57e('0x1b')](handleError(_0x2c5ca0,null));};exports['destroy']=function(_0x11439d,_0x3df51c){return db[_0xb57e('0x2c')][_0xb57e('0x48')]({'where':{'id':_0x11439d['params']['id']}})[_0xb57e('0x13')](handleEntityNotFound(_0x3df51c,null))[_0xb57e('0x13')](removeEntity(_0x3df51c,null))['catch'](handleError(_0x3df51c,null));};exports[_0xb57e('0x4a')]=function(_0x567dfe,_0x26578d){return db[_0xb57e('0x2c')][_0xb57e('0x4a')]()['then'](respondWithResult(_0x26578d,null))[_0xb57e('0x1b')](handleError(_0x26578d,null));};exports['create']=function(_0x48857a,_0x53266b){return db['MailMessage']['create'](_0x48857a['body'])[_0xb57e('0x13')](function(_0x635b75){if(_0x635b75){if(_0x635b75['direction']===_0xb57e('0x4b')&&!_0x635b75[_0xb57e('0x4c')]){var _0x14320d,_0x5758d1,_0x2544bc;if(_0x48857a['body']['to']){_0x5758d1=_0x48857a[_0xb57e('0x49')]['to'][_0xb57e('0x4d')](',')[0x0];}return db['MailAccount'][_0xb57e('0x4e')]({'where':{'id':_0x635b75[_0xb57e('0x4f')]},'include':[{'model':db[_0xb57e('0x50')],'as':_0xb57e('0x51'),'include':[{'model':db[_0xb57e('0x52')],'as':_0xb57e('0x53'),'where':{'email':_0x5758d1},'limit':0x1,'order':[[_0xb57e('0x54'),_0xb57e('0x55')]]}]},{'model':db[_0xb57e('0x56')],'as':_0xb57e('0x57'),'raw':!![],'include':[{'model':db[_0xb57e('0x58')],'as':_0xb57e('0x58'),'raw':!![]}]}]})['then'](function(_0x1789e1){_0x14320d=_0x1789e1;if(!_0x14320d||!_0x14320d['Smtp'])return;var _0x39d5f4=_0x14320d[_0xb57e('0x59')]();if(_0x48857a[_0xb57e('0x49')]['attachments']&&_0x48857a['body']['attachments'][_0xb57e('0x35')]){for(var _0x62dee2=0x0;_0x62dee2<_0x48857a[_0xb57e('0x49')][_0xb57e('0x5a')][_0xb57e('0x35')];_0x62dee2+=0x1){_0x48857a[_0xb57e('0x49')][_0xb57e('0x5a')][_0x62dee2]={'filename':_0x48857a['body'][_0xb57e('0x5a')][_0x62dee2][_0xb57e('0x28')],'path':path[_0xb57e('0x5b')](config[_0xb57e('0x5c')],_0xb57e('0x5d'),_0x48857a[_0xb57e('0x49')][_0xb57e('0x5a')][_0x62dee2]['basename'])};}}_0x2544bc={'account':_0x39d5f4,'message':_0x48857a[_0xb57e('0x49')]};return;})[_0xb57e('0x13')](function(){if(_0x14320d[_0xb57e('0x51')]){if(_0x14320d['List']['Contacts'][_0xb57e('0x35')]){return _0x14320d[_0xb57e('0x51')][_0xb57e('0x53')][0x0];}else{return db[_0xb57e('0x52')]['create'](_[_0xb57e('0xb')](_0x48857a['body'],{'firstName':_0x48857a[_0xb57e('0x49')]['to'],'email':_0x48857a['body']['to'],'phone':_0x48857a[_0xb57e('0x49')]['to'],'ListId':_0x14320d[_0xb57e('0x5e')]}));}}else{throw new Error(_0xb57e('0x5f'));}})['then'](function(){if(_0x2544bc){return respondWithRpcPromise(_0xb57e('0x60'),_0xb57e('0x61'),_0x2544bc,client9003)['then'](function(_0x39e45b){return _0x635b75[_0xb57e('0x23')]({'read':!![],'messageId':_0x39e45b[_0xb57e('0x62')],'sentAt':moment()[_0xb57e('0x63')](_0xb57e('0x64'))});})[_0xb57e('0x1b')](function(_0x39e7c2){logger['error']('%s',JSON[_0xb57e('0x65')](_0x39e7c2));return _0x635b75;});}return _0x635b75;});}return _0x635b75;}})[_0xb57e('0x13')](respondWithResult(_0x53266b,0xc9))[_0xb57e('0x1b')](handleError(_0x53266b,null));};exports[_0xb57e('0x66')]=function(_0x56b5c4,_0x3e9cb3){var _0x5872ee={'agent':{},'channel':_0xb57e('0x67')};if(_0x56b5c4['body']['id']){delete _0x56b5c4['body']['id'];}_0x56b5c4[_0xb57e('0x49')][_0xb57e('0x68')]=!![];_0x56b5c4[_0xb57e('0x49')][_0xb57e('0x69')]=moment()[_0xb57e('0x63')](_0xb57e('0x64'));_0x56b5c4[_0xb57e('0x49')]['UserId']=_0x56b5c4[_0xb57e('0x49')][_0xb57e('0x6a')]||_0x56b5c4['user']['id'];_0x5872ee['agent']['id']=_0x56b5c4[_0xb57e('0x49')][_0xb57e('0x6a')];return db[_0xb57e('0x2c')][_0xb57e('0x48')]({'where':{'id':_0x56b5c4['params']['id'],'UserId':null}})[_0xb57e('0x13')](handleEntityNotFound(_0x3e9cb3,null))[_0xb57e('0x13')](saveUpdates(_0x56b5c4[_0xb57e('0x49')],null))['then'](function(_0x4e3ca9){if(_0x4e3ca9){_0x5872ee[_0xb57e('0x1a')]=_0x4e3ca9[_0xb57e('0x6b')]({'plain':!![]});return db[_0xb57e('0x6c')]['find']({'where':{'id':_0x4e3ca9[_0xb57e('0x6d')]}});}return null;})[_0xb57e('0x13')](handleEntityNotFound(_0x3e9cb3,null))[_0xb57e('0x13')](function(_0x432900){if(_0x432900){return _0x432900[_0xb57e('0x23')]({'UserId':_0x56b5c4['body'][_0xb57e('0x6a')],'read1stAt':_['isNil'](_0x432900[_0xb57e('0x6e')])?moment()['format'](_0xb57e('0x64')):undefined});}return null;})[_0xb57e('0x13')](function(_0x23f40f){if(_0x23f40f){_0x5872ee[_0xb57e('0x6f')]=_0x23f40f[_0xb57e('0x6b')]({'plain':!![]});interaction_log[_0xb57e('0x14')](_0xb57e('0x70'),_0x56b5c4[_0xb57e('0x71')]['id'],_0x56b5c4['user'][_0xb57e('0x28')],_0x56b5c4[_0xb57e('0x71')][_0xb57e('0x72')],_0x5872ee[_0xb57e('0x6f')]['id'],_0x56b5c4['body']?JSON['stringify'](_0x56b5c4[_0xb57e('0x49')]):_0xb57e('0x73'));return respondWithRpcPromise(_0xb57e('0x74'),_0xb57e('0x75'),_0x5872ee);}return null;})[_0xb57e('0x13')](function(_0x131669){var _0x325e54=_0xb57e('0x76')+_0x131669[_0xb57e('0x1a')][_0xb57e('0x77')];return db[_0xb57e('0x78')]['query'](_0x325e54,{'type':db['Sequelize']['QueryTypes'][_0xb57e('0x79')],'raw':!![]})[_0xb57e('0x13')](function(_0x610071){return _0x610071;});})['then'](function(_0x5658ac){if(_0x5658ac){_0x5872ee['message'][_0xb57e('0x7a')]=_0x5658ac[0x0];if(!_0x56b5c4[_0xb57e('0x49')]['UserId'])return;return db[_0xb57e('0x7b')][_0xb57e('0x48')]({'where':{'id':_0x56b5c4[_0xb57e('0x49')]['UserId'],'role':_0xb57e('0x7c')},'attributes':['id','name',_0xb57e('0x7d'),'email',_0xb57e('0x7e')],'raw':!![]});}return null;})['then'](function(_0x5c5d8c){if(!_0x5c5d8c)return null;_0x5872ee['message'][_0xb57e('0x7c')]=_0x5c5d8c;return _0x5872ee;})[_0xb57e('0x13')](function(_0x471668){if(_0x471668){if(_0x56b5c4[_0xb57e('0x49')][_0xb57e('0x7f')]){_0x5872ee['message'][_0xb57e('0x80')]=util[_0xb57e('0x63')]('SIP/%s',_0x56b5c4[_0xb57e('0x71')][_0xb57e('0x28')]);_0x5872ee[_0xb57e('0x1a')][_0xb57e('0x81')]=_0x5872ee['channel'];_0x5872ee[_0xb57e('0x1a')][_0xb57e('0x82')]=_0x5872ee['channel'];_0x5872ee[_0xb57e('0x1a')][_0xb57e('0x83')]=_0xb57e('0x66');_0x5872ee[_0xb57e('0x1a')][_0xb57e('0x49')]=htmlToText[_0xb57e('0x84')](_0x5872ee[_0xb57e('0x1a')][_0xb57e('0x49')]);return respondWithRpcPromise(_0xb57e('0x85'),_0xb57e('0x85'),{'event':'acceptmessage','message':_0x5872ee[_0xb57e('0x1a')]},client9002)[_0xb57e('0x13')](function(){return _0x5872ee;});}return _0x5872ee;}return null;})[_0xb57e('0x13')](respondWithResult(_0x3e9cb3,null))[_0xb57e('0x1b')](handleError(_0x3e9cb3,null));};exports[_0xb57e('0x86')]=function(_0x15d1f0,_0x204d04){var _0x1a9b45={'agent':{},'channel':_0xb57e('0x67')};if(_0x15d1f0[_0xb57e('0x49')]['id']){delete _0x15d1f0[_0xb57e('0x49')]['id'];}_0x15d1f0[_0xb57e('0x49')][_0xb57e('0x6a')]=_0x15d1f0[_0xb57e('0x49')][_0xb57e('0x6a')]||_0x15d1f0[_0xb57e('0x71')]['id'];_0x1a9b45[_0xb57e('0x7c')]['id']=_0x15d1f0[_0xb57e('0x49')][_0xb57e('0x6a')];return db[_0xb57e('0x2c')][_0xb57e('0x48')]({'where':{'id':_0x15d1f0['params']['id'],'UserId':null}})[_0xb57e('0x13')](handleEntityNotFound(_0x204d04,null))['then'](function(_0x5743b8){if(_0x5743b8){_0x1a9b45[_0xb57e('0x1a')]=_0x5743b8[_0xb57e('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5743b8['MailInteractionId']}});}return null;})[_0xb57e('0x13')](handleEntityNotFound(_0x204d04,null))[_0xb57e('0x13')](function(_0x244641){if(_0x244641){_0x1a9b45[_0xb57e('0x6f')]=_0x244641[_0xb57e('0x6b')]({'plain':!![]});interaction_log[_0xb57e('0x14')](_0xb57e('0x87'),_0x15d1f0['user']['id'],_0x15d1f0[_0xb57e('0x71')]['name'],_0x15d1f0[_0xb57e('0x71')][_0xb57e('0x72')],_0x1a9b45['interaction']['id'],_0x15d1f0['body']?JSON['stringify'](_0x15d1f0['body']):'null');return respondWithRpcPromise(_0xb57e('0x88'),_0xb57e('0x89'),_0x1a9b45);}return null;})[_0xb57e('0x13')](function(_0x5c6a71){var _0x3dc6cc=_0xb57e('0x76')+_0x5c6a71[_0xb57e('0x1a')][_0xb57e('0x77')];return db['sequelize']['query'](_0x3dc6cc,{'type':db[_0xb57e('0x8a')]['QueryTypes'][_0xb57e('0x79')],'raw':!![]})['then'](function(_0x2915ee){return _0x2915ee;});})['then'](function(_0x3cb8b1){if(_0x3cb8b1){_0x1a9b45[_0xb57e('0x1a')][_0xb57e('0x7a')]=_0x3cb8b1[0x0];if(!_0x15d1f0[_0xb57e('0x49')][_0xb57e('0x6a')])return;return db[_0xb57e('0x7b')]['find']({'where':{'id':_0x15d1f0['body'][_0xb57e('0x6a')],'role':_0xb57e('0x7c')},'attributes':['id','name',_0xb57e('0x7d'),_0xb57e('0x8b'),_0xb57e('0x7e')],'raw':!![]});}return null;})[_0xb57e('0x13')](function(_0x1151c3){if(!_0x1151c3)return null;_0x1a9b45[_0xb57e('0x1a')][_0xb57e('0x7c')]=_0x1151c3;return _0x1a9b45;})[_0xb57e('0x13')](function(_0xa36861){if(_0xa36861){_0xa36861[_0xb57e('0x1a')][_0xb57e('0x80')]=util[_0xb57e('0x63')](_0xb57e('0x8c'),_0x15d1f0['user'][_0xb57e('0x28')]);_0xa36861['message'][_0xb57e('0x81')]=_0x1a9b45[_0xb57e('0x81')];_0xa36861[_0xb57e('0x1a')][_0xb57e('0x82')]=_0x1a9b45[_0xb57e('0x81')];_0xa36861[_0xb57e('0x1a')]['event']='reject';_0xa36861['message'][_0xb57e('0x49')]=htmlToText['fromString'](_0x1a9b45[_0xb57e('0x1a')]['body']);respondWithRpcPromise(_0xb57e('0x85'),'EventManager',{'event':_0xb57e('0x8d'),'message':_0xa36861[_0xb57e('0x1a')]},client9002);return _0x1a9b45;}return null;})[_0xb57e('0x13')](respondWithResult(_0x204d04,null))[_0xb57e('0x1b')](handleError(_0x204d04,null));};exports[_0xb57e('0x8e')]=function(_0x5b5c1c,_0x1227ad){var _0x3cfedb=moment()[_0xb57e('0x8f')]()['toString']();var _0x24af39=path['join'](config['root'],_0xb57e('0x90'),_0xb57e('0x91'),_0xb57e('0x92'));var _0x44fa36=path[_0xb57e('0x5b')](config[_0xb57e('0x5c')],'server','files',_0xb57e('0x5a'));var _0x3c1387=util[_0xb57e('0x63')](_0xb57e('0x93'),_0x3cfedb);return db['MailMessage'][_0xb57e('0x48')]({'where':{'id':_0x5b5c1c[_0xb57e('0x44')]['id']},'attributes':['id',_0xb57e('0x49'),'from','to','cc',_0xb57e('0x94'),'subject',_0xb57e('0x95')],'include':_0x5b5c1c[_0xb57e('0x2f')]['attachments']?[{'model':db[_0xb57e('0x96')],'as':_0xb57e('0x97')}]:undefined})[_0xb57e('0x13')](handleEntityNotFound(_0x1227ad,null))[_0xb57e('0x13')](function(_0x5a9eb2){if(_0x5a9eb2){var _0x1f8ae1=_0x5a9eb2;var _0x4208b5={'from':_0x1f8ae1[_0xb57e('0x98')],'to':_0x1f8ae1['to'],'subject':_0x1f8ae1[_0xb57e('0x99')],'html':htmlEntities[_0xb57e('0x9a')](_0x1f8ae1[_0xb57e('0x49')]),'headers':{'Date':moment(_0x1f8ae1[_0xb57e('0x95')])[_0xb57e('0x63')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5a9eb2['cc']){_0x4208b5[_0xb57e('0x9b')]['Cc']=_0x5a9eb2['cc'];}if(_0x5a9eb2[_0xb57e('0x94')]){_0x4208b5[_0xb57e('0x9b')][_0xb57e('0x9c')]=_0x5a9eb2[_0xb57e('0x94')];}return new BPromise(function(_0x5d222f,_0x54f8a4){if(_0x5a9eb2['Attachments']){for(var _0x10f076=0x0;_0x10f076<_0x5a9eb2['Attachments'][_0xb57e('0x35')];_0x10f076++){var _0x5e16b5=_0x5a9eb2[_0xb57e('0x97')][_0x10f076];var _0x404463=path['join'](_0x44fa36,_0x5e16b5[_0xb57e('0x9d')]);if(fs['existsSync'](_0x404463)){_0x4208b5[_0xb57e('0x5a')][_0xb57e('0x9e')]({'name':_0x5e16b5['name'],'contentType':_0x5e16b5[_0xb57e('0x9f')],'data':fs[_0xb57e('0xa0')](_0x404463)});}}}emlformat[_0xb57e('0xa1')](_0x4208b5,function(_0x274e0c,_0x46086b){if(_0x274e0c)return _0x54f8a4(_0x274e0c);fs[_0xb57e('0xa2')](path['join'](_0x24af39,_0x3c1387),_0x46086b);return _0x5d222f(_0x46086b);});});}})[_0xb57e('0x13')](function(_0x66ea42){if(_0x66ea42){return _0x1227ad[_0xb57e('0x8e')](path[_0xb57e('0x5b')](_0x24af39,_0x3c1387),_0x3c1387,function(_0x4f846d){if(!_0x4f846d)fs['unlinkSync'](path[_0xb57e('0x5b')](_0x24af39,_0x3c1387));});}})[_0xb57e('0x1b')](handleError(_0x1227ad,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5ea3e83..ccb6d17 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 _0x0cdf=['update','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x4fdd95,_0x54fb7e){var _0x178524=function(_0x9f6fa9){while(--_0x9f6fa9){_0x4fdd95['push'](_0x4fdd95['shift']());}};_0x178524(++_0x54fb7e);}(_0x0cdf,0x93));var _0xf0cd=function(_0x5d2507,_0x556fac){_0x5d2507=_0x5d2507-0x0;var _0x198c07=_0x0cdf[_0x5d2507];return _0x198c07;};'use strict';var EventEmitter=require(_0xf0cd('0x0'));var MailMessage=require(_0xf0cd('0x1'))['db'][_0xf0cd('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf0cd('0x3')](0x0);var events={'afterCreate':_0xf0cd('0x4'),'afterUpdate':_0xf0cd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3e41e7){return function(_0x2ae652,_0x4819f2,_0x5e522b){MailMessageEvents['emit'](_0x3e41e7+':'+_0x2ae652['id'],_0x2ae652);MailMessageEvents['emit'](_0x3e41e7,_0x2ae652);_0x5e522b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf0cd('0x6')](e,emitEvent(event));}}module[_0xf0cd('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x79a6=['update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0x381e71,_0x56ba1e){var _0x14446c=function(_0x24ce94){while(--_0x24ce94){_0x381e71['push'](_0x381e71['shift']());}};_0x14446c(++_0x56ba1e);}(_0x79a6,0x88));var _0x679a=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x79a6[_0x43b584];return _0x48f27b;};'use strict';var EventEmitter=require(_0x679a('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x679a('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x679a('0x2')](0x0);var events={'afterCreate':_0x679a('0x3'),'afterUpdate':_0x679a('0x4'),'afterDestroy':_0x679a('0x5')};function emitEvent(_0x47d632){return function(_0x3cb69a,_0x4cb400,_0x27a99b){MailMessageEvents[_0x679a('0x6')](_0x47d632+':'+_0x3cb69a['id'],_0x3cb69a);MailMessageEvents[_0x679a('0x6')](_0x47d632,_0x3cb69a);_0x27a99b(null);};}for(var e in events){if(events[_0x679a('0x7')](e)){var event=events[e];MailMessage[_0x679a('0x8')](e,emitEvent(event));}}module[_0x679a('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 4a57cf4..7bedbc5 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 _0xc6b5=['out','secret','isNil','MailInteraction','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase'];(function(_0x1785c4,_0x9cfa67){var _0x4734c7=function(_0x45f542){while(--_0x45f542){_0x1785c4['push'](_0x1785c4['shift']());}};_0x4734c7(++_0x9cfa67);}(_0xc6b5,0x149));var _0x5c6b=function(_0x538553,_0x34456a){_0x538553=_0x538553-0x0;var _0x4ae1bd=_0xc6b5[_0x538553];return _0x4ae1bd;};'use strict';var _=require(_0x5c6b('0x0'));var util=require('util');var logger=require(_0x5c6b('0x1'))(_0x5c6b('0x2'));var moment=require(_0x5c6b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x5c6b('0x4'));var fs=require('fs');var path=require(_0x5c6b('0x5'));var rimraf=require(_0x5c6b('0x6'));var config=require(_0x5c6b('0x7'));var attributes=require(_0x5c6b('0x8'));module[_0x5c6b('0x9')]=function(_0x16f7d2,_0x40ebb4){return _0x16f7d2[_0x5c6b('0xa')](_0x5c6b('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x5c6b('0xc'),'fields':[_0x5c6b('0xc')]},{'name':_0x5c6b('0xd'),'fields':[_0x5c6b('0xe'),_0x5c6b('0xf')],'type':_0x5c6b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x551c46,_0xd63b39,_0x547153){if(_0x551c46[_0x5c6b('0x11')]){_0x551c46['plainBody']=htmlToText[_0x5c6b('0x12')](_0x551c46[_0x5c6b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x547153(null,_0xd63b39);},'afterCreate':function(_0x1e1bb8,_0x2a87ea,_0x35b028){var _0x10100e=_0x16f7d2[_0x5c6b('0x13')];var _0x2c0152=_0x1e1bb8[_0x5c6b('0x14')]({'plain':!![]});if(_0x2c0152[_0x5c6b('0x15')]['toLowerCase']()==='in'||_0x2c0152[_0x5c6b('0x15')][_0x5c6b('0x16')]()===_0x5c6b('0x17')&&!_0x2c0152[_0x5c6b('0x18')]&&!_[_0x5c6b('0x19')](_0x2c0152['UserId'])){_0x10100e[_0x5c6b('0x1a')]['findOne']({'where':{'id':_0x2c0152['MailInteractionId']}})[_0x5c6b('0x1b')](function(_0x14e0c1){if(_0x14e0c1){_0x14e0c1[_0x5c6b('0x1c')]({'lastMsgAt':_0x2c0152[_0x5c6b('0x1d')],'lastMsgDirection':_0x2c0152[_0x5c6b('0x15')][_0x5c6b('0x16')]()});}})[_0x5c6b('0x1e')](function(_0x3c4530){console['error'](_0x3c4530);});}_0x35b028();}},'charset':'utf8mb4','collate':_0x5c6b('0x1f')});}; \ No newline at end of file +var _0xcd66=['fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','direction','toLowerCase','out','isNil','MailInteraction','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcd66,0xd1));var _0x6cd6=function(_0xce62f,_0x32c54c){_0xce62f=_0xce62f-0x0;var _0x573bd0=_0xcd66[_0xce62f];return _0x573bd0;};'use strict';var _=require(_0x6cd6('0x0'));var util=require(_0x6cd6('0x1'));var logger=require(_0x6cd6('0x2'))(_0x6cd6('0x3'));var moment=require(_0x6cd6('0x4'));var BPromise=require(_0x6cd6('0x5'));var rp=require(_0x6cd6('0x6'));var htmlToText=require(_0x6cd6('0x7'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cd6('0x8'));var attributes=require(_0x6cd6('0x9'));module[_0x6cd6('0xa')]=function(_0x40a2b3,_0x2915c8){return _0x40a2b3[_0x6cd6('0xb')](_0x6cd6('0xc'),attributes,{'tableName':_0x6cd6('0xd'),'paranoid':![],'indexes':[{'name':_0x6cd6('0xe'),'fields':[_0x6cd6('0xe')]},{'name':_0x6cd6('0xf'),'fields':[_0x6cd6('0x10'),_0x6cd6('0x11')],'type':_0x6cd6('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10a2d0,_0x225905,_0x444b26){if(_0x10a2d0[_0x6cd6('0x13')]){_0x10a2d0['plainBody']=htmlToText[_0x6cd6('0x14')](_0x10a2d0[_0x6cd6('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x444b26(null,_0x225905);},'afterCreate':function(_0x199aa3,_0x21d2c7,_0x499d5c){var _0xffaa9e=_0x40a2b3['models'];var _0x14fb21=_0x199aa3['get']({'plain':!![]});if(_0x14fb21[_0x6cd6('0x15')]['toLowerCase']()==='in'||_0x14fb21['direction'][_0x6cd6('0x16')]()===_0x6cd6('0x17')&&!_0x14fb21['secret']&&!_[_0x6cd6('0x18')](_0x14fb21['UserId'])){_0xffaa9e[_0x6cd6('0x19')]['findOne']({'where':{'id':_0x14fb21[_0x6cd6('0x1a')]}})[_0x6cd6('0x1b')](function(_0x3f6113){if(_0x3f6113){_0x3f6113[_0x6cd6('0x1c')]({'lastMsgAt':_0x14fb21[_0x6cd6('0x1d')],'lastMsgDirection':_0x14fb21[_0x6cd6('0x15')][_0x6cd6('0x16')]()});}})[_0x6cd6('0x1e')](function(_0x4e1d8c){console['error'](_0x4e1d8c);});}_0x499d5c();}},'charset':'utf8mb4','collate':_0x6cd6('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2045557..4bc7913 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 _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x17fa38,_0x4ac40d){var _0x140aa2=function(_0x151362){while(--_0x151362){_0x17fa38['push'](_0x17fa38['shift']());}};_0x140aa2(++_0x4ac40d);}(_0xd943,0x15d));var _0x3d94=function(_0x205dfe,_0x48d5d7){_0x205dfe=_0x205dfe-0x0;var _0x585b99=_0xd943[_0x205dfe];return _0x585b99;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file +var _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x4c19a1,_0x15197f){var _0x58ac50=function(_0x7c08c1){while(--_0x7c08c1){_0x4c19a1['push'](_0x4c19a1['shift']());}};_0x58ac50(++_0x15197f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 260ec08..eef7aeb 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 _0xca04=['remove','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0xc01434,_0x455766){var _0x138542=function(_0x4fcfca){while(--_0x4fcfca){_0xc01434['push'](_0xc01434['shift']());}};_0x138542(++_0x455766);}(_0xca04,0xa4));var _0x4ca0=function(_0x241656,_0x3a7475){_0x241656=_0x241656-0x0;var _0x4cf2ff=_0xca04[_0x241656];return _0x4cf2ff;};'use strict';var MailMessageEvents=require(_0x4ca0('0x0'));var events=['save',_0x4ca0('0x1'),'update'];function createListener(_0x55ddae,_0x2645cf){return function(_0x7fa3e1){_0x2645cf['emit'](_0x55ddae,_0x7fa3e1);};}function removeListener(_0x55c792,_0xfedfad){return function(){MailMessageEvents[_0x4ca0('0x2')](_0x55c792,_0xfedfad);};}exports['register']=function(_0x5c8a12){for(var _0x2f98c1=0x0,_0x4c6d3d=events[_0x4ca0('0x3')];_0x2f98c1<_0x4c6d3d;_0x2f98c1++){var _0x51cc84=events[_0x2f98c1];var _0x3e19e3=createListener(_0x4ca0('0x4')+_0x51cc84,_0x5c8a12);MailMessageEvents['on'](_0x51cc84,_0x3e19e3);}}; \ No newline at end of file +var _0x8413=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x3a2e7d,_0x212103){var _0x2584be=function(_0x16e75e){while(--_0x16e75e){_0x3a2e7d['push'](_0x3a2e7d['shift']());}};_0x2584be(++_0x212103);}(_0x8413,0x7b));var _0x3841=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8413[_0x6c993a];return _0x27f547;};'use strict';var MailMessageEvents=require(_0x3841('0x0'));var events=[_0x3841('0x1'),_0x3841('0x2'),_0x3841('0x3')];function createListener(_0x27590c,_0x103256){return function(_0x4dc214){_0x103256[_0x3841('0x4')](_0x27590c,_0x4dc214);};}function removeListener(_0x18e399,_0x4b70ee){return function(){MailMessageEvents[_0x3841('0x5')](_0x18e399,_0x4b70ee);};}exports[_0x3841('0x6')]=function(_0x3cdddc){for(var _0x41e6ab=0x0,_0xd32bba=events['length'];_0x41e6ab<_0xd32bba;_0x41e6ab++){var _0x407337=events[_0x41e6ab];var _0x5792d5=createListener(_0x3841('0x7')+_0x407337,_0x3cdddc);MailMessageEvents['on'](_0x407337,_0x5792d5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f966989..a5d83fe 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 _0x7793=['destroy','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','/describe','get','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','put','/:id','update'];(function(_0x150cea,_0x4581ed){var _0xceda08=function(_0x23da51){while(--_0x23da51){_0x150cea['push'](_0x150cea['shift']());}};_0xceda08(++_0x4581ed);}(_0x7793,0x13b));var _0x3779=function(_0x481046,_0x10d606){_0x481046=_0x481046-0x0;var _0x999d0b=_0x7793[_0x481046];return _0x999d0b;};'use strict';var multer=require(_0x3779('0x0'));var util=require('util');var path=require(_0x3779('0x1'));var timeout=require('connect-timeout');var express=require(_0x3779('0x2'));var router=express[_0x3779('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3779('0x4'));var config=require(_0x3779('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3779('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3779('0x7')]('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x9')]);router[_0x3779('0x7')](_0x3779('0xa'),auth['isAuthenticated'](),controller[_0x3779('0xb')]);router['get'](_0x3779('0xc'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3779('0x7')](_0x3779('0xd'),auth[_0x3779('0x8')](),controller[_0x3779('0xe')]);router['post']('/',auth[_0x3779('0x8')](),controller[_0x3779('0xf')]);router['post'](_0x3779('0xc'),auth[_0x3779('0x8')](),controller['addTeams']);router[_0x3779('0x10')]('/:id/users',auth[_0x3779('0x8')](),controller[_0x3779('0x11')]);router[_0x3779('0x12')](_0x3779('0x13'),auth[_0x3779('0x8')](),controller[_0x3779('0x14')]);router['delete']('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x15')]);router['delete'](_0x3779('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3779('0x16')](_0x3779('0xd'),auth[_0x3779('0x8')](),controller['removeAgents']);module[_0x3779('0x17')]=router; \ No newline at end of file +var _0x1cf9=['put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users'];(function(_0x4b7a26,_0x233be4){var _0xe6bacc=function(_0x38a503){while(--_0x38a503){_0x4b7a26['push'](_0x4b7a26['shift']());}};_0xe6bacc(++_0x233be4);}(_0x1cf9,0x91));var _0x91cf=function(_0x29c36d,_0x58eca3){_0x29c36d=_0x29c36d-0x0;var _0x21946e=_0x1cf9[_0x29c36d];return _0x21946e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x91cf('0x0'));var timeout=require(_0x91cf('0x1'));var express=require('express');var router=express[_0x91cf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x91cf('0x3'));var interaction=require(_0x91cf('0x4'));var config=require(_0x91cf('0x5'));var controller=require(_0x91cf('0x6'));router[_0x91cf('0x7')]('/',auth[_0x91cf('0x8')](),controller[_0x91cf('0x9')]);router[_0x91cf('0x7')](_0x91cf('0xa'),auth[_0x91cf('0x8')](),controller[_0x91cf('0xb')]);router[_0x91cf('0x7')](_0x91cf('0xc'),auth[_0x91cf('0x8')](),controller[_0x91cf('0xd')]);router[_0x91cf('0x7')](_0x91cf('0xe'),auth[_0x91cf('0x8')](),controller[_0x91cf('0xf')]);router[_0x91cf('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x91cf('0x10')]);router[_0x91cf('0x7')]('/:id/users',auth[_0x91cf('0x8')](),controller[_0x91cf('0x11')]);router[_0x91cf('0x12')]('/',auth[_0x91cf('0x8')](),controller[_0x91cf('0x13')]);router[_0x91cf('0x12')](_0x91cf('0x14'),auth[_0x91cf('0x8')](),controller[_0x91cf('0x15')]);router[_0x91cf('0x12')](_0x91cf('0x16'),auth[_0x91cf('0x8')](),controller['addAgents']);router[_0x91cf('0x17')](_0x91cf('0xc'),auth['isAuthenticated'](),controller[_0x91cf('0x18')]);router[_0x91cf('0x19')](_0x91cf('0xc'),auth[_0x91cf('0x8')](),controller[_0x91cf('0x1a')]);router[_0x91cf('0x19')](_0x91cf('0x14'),auth[_0x91cf('0x8')](),controller['removeTeams']);router[_0x91cf('0x19')]('/:id/users',auth[_0x91cf('0x8')](),controller['removeAgents']);module[_0x91cf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index a288bab..0196211 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 _0x0e39=['name','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3a9d2b,_0x4a754d){var _0x50dff9=function(_0x300429){while(--_0x300429){_0x3a9d2b['push'](_0x3a9d2b['shift']());}};_0x50dff9(++_0x4a754d);}(_0x0e39,0x13f));var _0x90e3=function(_0x5c6f37,_0x53bc84){_0x5c6f37=_0x5c6f37-0x0;var _0x4ae388=_0x0e39[_0x5c6f37];return _0x4ae388;};'use strict';var Sequelize=require(_0x90e3('0x0'));module[_0x90e3('0x1')]={'name':{'type':Sequelize[_0x90e3('0x2')],'unique':_0x90e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x90e3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x90e3('0x4'),_0x90e3('0x5'),_0x90e3('0x6'))}}; \ No newline at end of file +var _0xa74b=['beepall','roundrobin','sequelize','STRING','INTEGER','rrmemory'];(function(_0x3467d,_0x239b0e){var _0x8b13e7=function(_0x533510){while(--_0x533510){_0x3467d['push'](_0x3467d['shift']());}};_0x8b13e7(++_0x239b0e);}(_0xa74b,0x146));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xba74('0x0'));module['exports']={'name':{'type':Sequelize[_0xba74('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba74('0x1')]},'timeout':{'type':Sequelize[_0xba74('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xba74('0x3'),_0xba74('0x4'),_0xba74('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7a91d3f..2022e00 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 _0x984b=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','MailQueue','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','format','mailPause','updatedAt','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','each','findOrCreate','emit','removeTeams','Agents','select','field','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./mailQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','MailQueues','UserProfileResource','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x984b,0xee));var _0xb984=function(_0x2abfe7,_0x2466df){_0x2abfe7=_0x2abfe7-0x0;var _0x2bef5c=_0x984b[_0x2abfe7];return _0x2bef5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x0'));var rp=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb984('0x3'));var path=require(_0xb984('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb984('0x5'));var fs=require('fs');var fs_extra=require(_0xb984('0x6'));var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];config[_0xb984('0x16')]=_['defaults'](config[_0xb984('0x16')],{'host':_0xb984('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb984('0x16')]));require(_0xb984('0x18'))['register'](socket);function respondWithStatusCode(_0x203dba,_0x7a1b60){_0x7a1b60=_0x7a1b60||0xcc;return function(_0x549791){if(_0x549791){return _0x203dba[_0xb984('0x19')](_0x7a1b60);}return _0x203dba[_0xb984('0x1a')](_0x7a1b60)['end']();};}function respondWithResult(_0x6fae41,_0x5cd1aa){_0x5cd1aa=_0x5cd1aa||0xc8;return function(_0x3b8241){if(_0x3b8241){return _0x6fae41[_0xb984('0x1a')](_0x5cd1aa)[_0xb984('0x1b')](_0x3b8241);}};}function respondWithFilteredResult(_0x3f7cff,_0x59dcb7){return function(_0x396c36){if(_0x396c36){var _0x35bd75=typeof _0x59dcb7[_0xb984('0x1c')]===_0xb984('0x1d')&&typeof _0x59dcb7[_0xb984('0x1e')]===_0xb984('0x1d');var _0x5c2e25=_0x396c36[_0xb984('0x1f')];var _0x2f6d70=_0x35bd75?0x0:_0x59dcb7[_0xb984('0x1c')];var _0x3870ba=_0x35bd75?_0x396c36[_0xb984('0x1f')]:_0x59dcb7[_0xb984('0x1c')]+_0x59dcb7['limit'];var _0x39d16f;if(_0x3870ba>=_0x5c2e25){_0x3870ba=_0x5c2e25;_0x39d16f=0xc8;}else{_0x39d16f=0xce;}_0x3f7cff[_0xb984('0x1a')](_0x39d16f);return _0x3f7cff['set'](_0xb984('0x20'),_0x2f6d70+'-'+_0x3870ba+'/'+_0x5c2e25)[_0xb984('0x1b')](_0x396c36);}return null;};}function patchUpdates(_0x14734a){return function(_0x932579){try{jsonpatch[_0xb984('0x21')](_0x932579,_0x14734a,!![]);}catch(_0x286033){return BPromise[_0xb984('0x22')](_0x286033);}return _0x932579['save']();};}function saveUpdates(_0x391a1e,_0x25de23){return function(_0x1b6be3){if(_0x1b6be3){return _0x1b6be3['update'](_0x391a1e)[_0xb984('0x23')](function(_0x2e806e){return _0x2e806e;});}return null;};}function removeEntity(_0x1cb2c2,_0x2d0450){return function(_0x1f7b62){if(_0x1f7b62){return _0x1f7b62[_0xb984('0x24')]()[_0xb984('0x23')](function(){var _0x4b3da0=_0x1f7b62['get']({'plain':!![]});var _0x249d47=_0xb984('0x25');return db[_0xb984('0x26')][_0xb984('0x24')]({'where':{'type':_0x249d47,'resourceId':_0x4b3da0['id']}})['then'](function(){return _0x1f7b62;});})[_0xb984('0x23')](function(){_0x1cb2c2[_0xb984('0x1a')](0xcc)[_0xb984('0x27')]();});}};}function handleEntityNotFound(_0x482a9f,_0x363e33){return function(_0x311e22){if(!_0x311e22){_0x482a9f[_0xb984('0x19')](0x194);}return _0x311e22;};}function handleError(_0x3d2757,_0x4d00a8){_0x4d00a8=_0x4d00a8||0x1f4;return function(_0x5b8da1){logger['error'](_0x5b8da1[_0xb984('0x28')]);if(_0x5b8da1[_0xb984('0x29')]){delete _0x5b8da1['name'];}_0x3d2757[_0xb984('0x1a')](_0x4d00a8)[_0xb984('0x2a')](_0x5b8da1);};}exports[_0xb984('0x2b')]=function(_0x2c5a99,_0x518bef){var _0x4bb6da={},_0x315f70={},_0x2daa31={'count':0x0,'rows':[]};var _0x2c0562=_[_0xb984('0x2c')](db['MailQueue'][_0xb984('0x2d')],function(_0x35b37f){return{'name':_0x35b37f[_0xb984('0x2e')],'type':_0x35b37f[_0xb984('0x2f')][_0xb984('0x30')]};});_0x315f70[_0xb984('0x31')]=_['map'](_0x2c0562,_0xb984('0x29'));_0x315f70[_0xb984('0x32')]=_[_0xb984('0x33')](_0x2c5a99[_0xb984('0x32')]);_0x315f70[_0xb984('0x34')]=_[_0xb984('0x35')](_0x315f70['model'],_0x315f70[_0xb984('0x32')]);_0x4bb6da[_0xb984('0x36')]=_['intersection'](_0x315f70['model'],qs[_0xb984('0x37')](_0x2c5a99['query'][_0xb984('0x37')]));_0x4bb6da[_0xb984('0x36')]=_0x4bb6da['attributes'][_0xb984('0x38')]?_0x4bb6da['attributes']:_0x315f70[_0xb984('0x31')];if(!_0x2c5a99['query'][_0xb984('0x39')]('nolimit')){_0x4bb6da['limit']=qs[_0xb984('0x1e')](_0x2c5a99[_0xb984('0x32')]['limit']);_0x4bb6da[_0xb984('0x1c')]=qs[_0xb984('0x1c')](_0x2c5a99['query'][_0xb984('0x1c')]);}_0x4bb6da[_0xb984('0x3a')]=qs[_0xb984('0x3b')](_0x2c5a99[_0xb984('0x32')]['sort']);_0x4bb6da[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x2c5a99[_0xb984('0x32')],_0x315f70[_0xb984('0x34')]),_0x2c0562);if(_0x2c5a99[_0xb984('0x32')][_0xb984('0x3e')]){_0x4bb6da[_0xb984('0x3c')]=_[_0xb984('0x3f')](_0x4bb6da[_0xb984('0x3c')],{'$or':_['map'](_0x2c0562,function(_0x134ba5){if(_0x134ba5[_0xb984('0x2f')]!==_0xb984('0x40')){var _0x192037={};_0x192037[_0x134ba5[_0xb984('0x29')]]={'$like':'%'+_0x2c5a99[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x192037;}})});}_0x4bb6da=_[_0xb984('0x3f')]({},_0x4bb6da,_0x2c5a99['options']);var _0x5d4be9={'where':_0x4bb6da[_0xb984('0x3c')]};return db['MailQueue'][_0xb984('0x1f')](_0x5d4be9)[_0xb984('0x23')](function(_0x216df6){_0x2daa31[_0xb984('0x1f')]=_0x216df6;if(_0x2c5a99['query'][_0xb984('0x41')]){_0x4bb6da[_0xb984('0x42')]=[{'all':!![]}];}return db['MailQueue'][_0xb984('0x43')](_0x4bb6da);})[_0xb984('0x23')](function(_0x38a025){_0x2daa31[_0xb984('0x44')]=_0x38a025;return _0x2daa31;})[_0xb984('0x23')](respondWithFilteredResult(_0x518bef,_0x4bb6da))[_0xb984('0x45')](handleError(_0x518bef,null));};exports[_0xb984('0x46')]=function(_0x587c19,_0xbca7cd){var _0x234178={'raw':!![],'where':{'id':_0x587c19['params']['id']}},_0x4f6f2b={};_0x4f6f2b[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x47')][_0xb984('0x2d')]);_0x4f6f2b[_0xb984('0x32')]=_['keys'](_0x587c19[_0xb984('0x32')]);_0x4f6f2b[_0xb984('0x34')]=_[_0xb984('0x35')](_0x4f6f2b[_0xb984('0x31')],_0x4f6f2b[_0xb984('0x32')]);_0x234178[_0xb984('0x36')]=_[_0xb984('0x35')](_0x4f6f2b[_0xb984('0x31')],qs[_0xb984('0x37')](_0x587c19[_0xb984('0x32')]['fields']));_0x234178[_0xb984('0x36')]=_0x234178[_0xb984('0x36')]['length']?_0x234178[_0xb984('0x36')]:_0x4f6f2b[_0xb984('0x31')];if(_0x587c19[_0xb984('0x32')][_0xb984('0x41')]){_0x234178[_0xb984('0x42')]=[{'all':!![]}];}_0x234178=_[_0xb984('0x3f')]({},_0x234178,_0x587c19[_0xb984('0x48')]);return db[_0xb984('0x47')][_0xb984('0x49')](_0x234178)[_0xb984('0x23')](handleEntityNotFound(_0xbca7cd,null))['then'](respondWithResult(_0xbca7cd,null))[_0xb984('0x45')](handleError(_0xbca7cd,null));};exports[_0xb984('0x4a')]=function(_0x262898,_0x2ae0d8){return db[_0xb984('0x47')][_0xb984('0x4a')](_0x262898[_0xb984('0x4b')],{})[_0xb984('0x23')](function(_0xc6389d){var _0x5c3d82=_0x262898[_0xb984('0x4c')][_0xb984('0x4d')]({'plain':!![]});if(!_0x5c3d82)throw new Error(_0xb984('0x4e'));if(_0x5c3d82['role']===_0xb984('0x4c')){var _0x42a9f8=_0xc6389d['get']({'plain':!![]});var _0xdb477='MailQueues';return db[_0xb984('0x4f')][_0xb984('0x49')]({'where':{'name':_0xdb477,'userProfileId':_0x5c3d82['userProfileId']},'raw':!![]})[_0xb984('0x23')](function(_0x38b1cb){if(_0x38b1cb&&_0x38b1cb[_0xb984('0x50')]===0x0){return db[_0xb984('0x26')][_0xb984('0x4a')]({'name':_0x42a9f8[_0xb984('0x29')],'resourceId':_0x42a9f8['id'],'type':_0x38b1cb['name'],'sectionId':_0x38b1cb['id']},{})[_0xb984('0x23')](function(){return _0xc6389d;});}else{return _0xc6389d;}})['catch'](function(_0x4553d1){logger[_0xb984('0x51')](_0xb984('0x52'),_0x4553d1);throw _0x4553d1;});}return _0xc6389d;})['then'](respondWithResult(_0x2ae0d8,0xc9))['catch'](handleError(_0x2ae0d8,null));};exports[_0xb984('0x53')]=function(_0x2dfaf8,_0x56ad15){if(_0x2dfaf8['body']['id']){delete _0x2dfaf8[_0xb984('0x4b')]['id'];}return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x2dfaf8[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x56ad15,null))[_0xb984('0x23')](saveUpdates(_0x2dfaf8['body'],null))['then'](respondWithResult(_0x56ad15,null))[_0xb984('0x45')](handleError(_0x56ad15,null));};exports[_0xb984('0x24')]=function(_0x59ed42,_0x727af2){return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x59ed42[_0xb984('0x54')]['id']}})['then'](handleEntityNotFound(_0x727af2,null))['then'](removeEntity(_0x727af2,null))[_0xb984('0x45')](handleError(_0x727af2,null));};exports[_0xb984('0x55')]=function(_0x2fc1f7,_0x29c79d){return db[_0xb984('0x47')][_0xb984('0x55')]()['then'](respondWithResult(_0x29c79d,null))[_0xb984('0x45')](handleError(_0x29c79d,null));};exports[_0xb984('0x56')]=function(_0x7c47aa,_0x345e1d,_0x2d77dd){var _0xdb7a50={'raw':!![],'where':{}},_0x575503={},_0x55852d;return db['MailQueue'][_0xb984('0x57')]({'where':{'id':_0x7c47aa[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x345e1d,null))[_0xb984('0x23')](function(_0x19c6e7){if(_0x19c6e7){_0x55852d=_0x19c6e7['get']({'plain':!![]});_0x575503[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x58')]['rawAttributes']);_0x575503[_0xb984('0x32')]=_[_0xb984('0x33')](_0x7c47aa['query']);_0x575503['filters']=_[_0xb984('0x35')](_0x575503['model'],_0x575503['query']);_0xdb7a50[_0xb984('0x36')]=_['intersection'](_0x575503[_0xb984('0x31')],qs[_0xb984('0x37')](_0x7c47aa[_0xb984('0x32')][_0xb984('0x37')]));_0xdb7a50[_0xb984('0x36')]=_0xdb7a50[_0xb984('0x36')][_0xb984('0x38')]?_0xdb7a50[_0xb984('0x36')]:_0x575503[_0xb984('0x31')];if(!_0x7c47aa[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0xdb7a50['limit']=qs[_0xb984('0x1e')](_0x7c47aa[_0xb984('0x32')][_0xb984('0x1e')]);_0xdb7a50['offset']=qs['offset'](_0x7c47aa[_0xb984('0x32')][_0xb984('0x1c')]);}_0xdb7a50[_0xb984('0x3a')]=qs['sort'](_0x7c47aa[_0xb984('0x32')][_0xb984('0x3b')]);_0xdb7a50[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x7c47aa[_0xb984('0x32')],_0x575503[_0xb984('0x34')]));_0xdb7a50[_0xb984('0x3c')][_0xb984('0x5a')]=_0x19c6e7['id'];if(_0x7c47aa[_0xb984('0x32')][_0xb984('0x3e')]){_0xdb7a50[_0xb984('0x3c')]=_[_0xb984('0x3f')](_0xdb7a50[_0xb984('0x3c')],{'$or':_['map'](_0xdb7a50[_0xb984('0x36')],function(_0x51399c){var _0x2acfc1={};_0x2acfc1[_0x51399c]={'$like':'%'+_0x7c47aa['query'][_0xb984('0x3e')]+'%'};return _0x2acfc1;})});}_0xdb7a50=_[_0xb984('0x3f')]({},_0xdb7a50,_0x7c47aa[_0xb984('0x48')]);return db[_0xb984('0x58')][_0xb984('0x43')](_0xdb7a50);}})[_0xb984('0x23')](function(_0x2eb8bf){if(_0x2eb8bf){return db[_0xb984('0x5b')][_0xb984('0x5c')]({'where':{'id':_[_0xb984('0x2c')](_0x2eb8bf,_0xb984('0x5d')),'role':_0xb984('0x5e')},'attributes':['id',_0xb984('0x29'),'mailPause','updatedAt',_0xb984('0x5f')]});}})[_0xb984('0x23')](function(_0x1e90ae){if(_0x1e90ae){return{'count':_0x1e90ae['count'],'rows':_[_0xb984('0x2c')](_0x1e90ae[_0xb984('0x44')],function(_0x50544b){return{'membername':_0x50544b['name'],'UserId':_0x50544b['id'],'queue_name':_0x55852d['name'],'MailQueueId':_0x55852d['id'],'interface':util[_0xb984('0x60')]('%s/%s','SIP',_0x50544b['name']),'penalty':0x0,'paused':_0x50544b[_0xb984('0x61')],'createdAt':_0x50544b[_0xb984('0x5f')],'updatedAt':_0x50544b[_0xb984('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb984('0x23')](respondWithFilteredResult(_0x345e1d,_0xdb7a50))['catch'](handleError(_0x345e1d,null));};exports['getTeams']=function(_0xa47568,_0x2a0f8f,_0x3c6050){var _0xe4e069={};var _0x307263={};var _0x5ce513;var _0x2063cd;return db[_0xb984('0x47')][_0xb984('0x57')]({'where':{'id':_0xa47568[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x2a0f8f,null))[_0xb984('0x23')](function(_0x4f51a0){if(_0x4f51a0){_0x5ce513=_0x4f51a0;_0x307263[_0xb984('0x31')]=_['keys'](db[_0xb984('0x63')][_0xb984('0x2d')]);_0x307263[_0xb984('0x32')]=_[_0xb984('0x33')](_0xa47568[_0xb984('0x32')]);_0x307263['filters']=_[_0xb984('0x35')](_0x307263[_0xb984('0x31')],_0x307263[_0xb984('0x32')]);_0xe4e069['attributes']=_[_0xb984('0x35')](_0x307263[_0xb984('0x31')],qs[_0xb984('0x37')](_0xa47568[_0xb984('0x32')][_0xb984('0x37')]));_0xe4e069['attributes']=_0xe4e069['attributes'][_0xb984('0x38')]?_0xe4e069[_0xb984('0x36')]:_0x307263[_0xb984('0x31')];_0xe4e069[_0xb984('0x3a')]=qs['sort'](_0xa47568[_0xb984('0x32')][_0xb984('0x3b')]);_0xe4e069[_0xb984('0x3c')]=qs[_0xb984('0x34')](_['pick'](_0xa47568[_0xb984('0x32')],_0x307263[_0xb984('0x34')]));if(_0xa47568[_0xb984('0x32')][_0xb984('0x3e')]){_0xe4e069['where']=_[_0xb984('0x3f')](_0xe4e069[_0xb984('0x3c')],{'$or':_[_0xb984('0x2c')](_0xe4e069[_0xb984('0x36')],function(_0x46e5c7){var _0x37c2b0={};_0x37c2b0[_0x46e5c7]={'$like':'%'+_0xa47568[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x37c2b0;})});}_0xe4e069=_[_0xb984('0x3f')]({},_0xe4e069,_0xa47568[_0xb984('0x48')]);return _0x5ce513[_0xb984('0x64')](_0xe4e069);}})['then'](function(_0x19b7d0){if(_0x19b7d0){_0x2063cd=_0x19b7d0[_0xb984('0x38')];if(!_0xa47568[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0xe4e069[_0xb984('0x1e')]=qs['limit'](_0xa47568[_0xb984('0x32')][_0xb984('0x1e')]);_0xe4e069[_0xb984('0x1c')]=qs[_0xb984('0x1c')](_0xa47568['query'][_0xb984('0x1c')]);}return _0x5ce513[_0xb984('0x64')](_0xe4e069);}})['then'](function(_0x18d79c){if(_0x18d79c){return _0x18d79c?{'count':_0x2063cd,'rows':_0x18d79c}:null;}})['then'](respondWithResult(_0x2a0f8f,null))['catch'](handleError(_0x2a0f8f,null));};exports[_0xb984('0x65')]=function(_0x187a29,_0x1015fd,_0xc27f82){var _0x168d6c=_0x187a29[_0xb984('0x4b')][_0xb984('0x66')];return db[_0xb984('0x63')][_0xb984('0x43')]({'where':{'id':_0x168d6c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb984('0x29'),_0xb984('0x67'),_0xb984('0x68'),_0xb984('0x69')],'raw':!![]}]})['then'](function(_0x40ce51){if(_0x40ce51){var _0x3f34f0=_[_0xb984('0x6a')](_0x40ce51,function(_0xc9a1a9){var _0x199c2=_0xc9a1a9[_0xb984('0x4d')]({'plain':!![]});return _0x199c2['Agents'];});return db[_0xb984('0x47')]['find']({'where':{'id':_0x187a29[_0xb984('0x54')]['id']}})['then'](function(_0x3dd59c){return db['sequelize']['transaction'](function(_0x28b95d){return _0x3dd59c[_0xb984('0x65')](_0x168d6c,{'transaction':_0x28b95d})['then'](function(){return BPromise[_0xb984('0x6b')](_0x3f34f0,function(_0x1b3155){return db[_0xb984('0x58')][_0xb984('0x6c')]({'where':{'UserId':_0x1b3155['id'],'MailQueueId':_0x187a29[_0xb984('0x54')]['id']},'transaction':_0x28b95d});});})['then'](function(){_0x3f34f0['forEach'](function(_0x1d21c5){socket[_0xb984('0x6d')]('userMailQueue:save',{'UserId':_0x1d21c5['id'],'MailQueueId':_0x3dd59c['id']});});});});});}})[_0xb984('0x23')](respondWithStatusCode(_0x1015fd,null))[_0xb984('0x45')](handleError(_0x1015fd,null));};exports[_0xb984('0x6e')]=function(_0x5db11c,_0x52f937,_0x52c145){return db[_0xb984('0x63')][_0xb984('0x43')]({'where':{'id':_0x5db11c['query'][_0xb984('0x66')]},'attributes':['id'],'include':[{'model':db[_0xb984('0x5b')],'as':_0xb984('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb984('0x23')](handleEntityNotFound(_0x52f937,null))['then'](function(_0x53880c){var _0x4f55da=_['map'](_0x53880c,'id');var _0x4d5773=[];var _0x3b47b0=[];var _0x431b44=squel[_0xb984('0x70')]();_0x431b44[_0xb984('0x71')](_0xb984('0x72'))[_0xb984('0x73')]('team_has_mail_queues','tq')[_0xb984('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb984('0x3c')]('MailQueueId\x20=\x20?',_0x5db11c[_0xb984('0x54')]['id']);for(var _0x2917f6=0x0;_0x2917f6<_0x53880c['length'];_0x2917f6+=0x1){let _0x3f99e5=_0x53880c[_0x2917f6];for(var _0x3e90cb=0x0;_0x3e90cb<_0x3f99e5[_0xb984('0x6f')][_0xb984('0x38')];_0x3e90cb+=0x1){let _0x1e48c5=_0x3f99e5[_0xb984('0x6f')][_0x3e90cb];var _0x175683=_0x431b44[_0xb984('0x75')]();_0x175683[_0xb984('0x3c')](_0xb984('0x76'),_0x1e48c5['id']);_0x3b47b0[_0xb984('0x77')](db[_0xb984('0x78')][_0xb984('0x32')](_0x175683['toString'](),{'type':db[_0xb984('0x78')]['QueryTypes'][_0xb984('0x79')]})['then'](function(_0x2f5ebd){if(_0x2f5ebd[_0xb984('0x38')]===0x1){return _0x1e48c5['id'];}else{var _0xf8f84e=_[_0xb984('0x7a')](_[_0xb984('0x2c')](_0x2f5ebd,_0xb984('0x7b')),function(_0x24c858){return _['includes'](_0x4f55da,_0x24c858);});if(_0xf8f84e){return _0x1e48c5['id'];}}}));}}return BPromise[_0xb984('0x7c')](_0x3b47b0)[_0xb984('0x23')](function(_0x41171e){_0x4d5773=_(_0x4d5773)[_0xb984('0x7d')](_0x41171e)[_0xb984('0x7e')]()[_0xb984('0x7f')]();return db[_0xb984('0x47')][_0xb984('0x49')]({'where':{'id':_0x5db11c[_0xb984('0x54')]['id']}})['then'](function(_0xd6cfe0){return db[_0xb984('0x78')][_0xb984('0x80')](function(_0x14337a){return _0xd6cfe0[_0xb984('0x6e')](_0x5db11c[_0xb984('0x32')][_0xb984('0x66')],{'transaction':_0x14337a})[_0xb984('0x23')](function(){if(!_[_0xb984('0x81')](_0x4d5773)){return _0xd6cfe0[_0xb984('0x82')](_0x4d5773,{'transaction':_0x14337a});}})['then'](function(){_0x4d5773[_0xb984('0x83')](function(_0x508d85){socket[_0xb984('0x6d')](_0xb984('0x84'),{'UserId':_0x508d85,'MailQueueId':_0xd6cfe0['id']});});});});});});})[_0xb984('0x23')](respondWithStatusCode(_0x52f937,null))[_0xb984('0x45')](handleError(_0x52f937,null));};exports[_0xb984('0x85')]=function(_0x55394b,_0xca9497,_0x2e5a9a){return db['MailQueue'][_0xb984('0x49')]({'where':{'id':_0x55394b[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0xca9497,null))['then'](function(_0x100a15){if(_0x100a15){return _0x100a15[_0xb984('0x85')](_0x55394b[_0xb984('0x4b')][_0xb984('0x66')],_[_0xb984('0x86')](_0x55394b[_0xb984('0x4b')],[_0xb984('0x66'),'id'])||{})[_0xb984('0x87')](function(_0x2a61b5){for(var _0x220323=0x0;_0x220323<_0x55394b['body']['ids']['length'];_0x220323+=0x1){socket[_0xb984('0x6d')](_0xb984('0x88'),{'UserId':Number(_0x55394b[_0xb984('0x4b')][_0xb984('0x66')][_0x220323]),'MailQueueId':Number(_0x55394b['params']['id'])});}return _0x2a61b5;});}})['then'](respondWithResult(_0xca9497,null))['catch'](handleError(_0xca9497,null));};exports[_0xb984('0x82')]=function(_0x1c8731,_0x5e9fa1,_0x278a22){return db['MailQueue'][_0xb984('0x49')]({'where':{'id':_0x1c8731['params']['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x5e9fa1,null))['then'](function(_0xc526a9){if(_0xc526a9){return _0xc526a9[_0xb984('0x82')](_0x1c8731['query'][_0xb984('0x66')])['then'](function(){if(_[_0xb984('0x89')](_0x1c8731[_0xb984('0x32')][_0xb984('0x66')])){for(var _0x515c3c=0x0;_0x515c3c<_0x1c8731['query'][_0xb984('0x66')]['length'];_0x515c3c+=0x1){socket[_0xb984('0x6d')](_0xb984('0x84'),{'UserId':Number(_0x1c8731[_0xb984('0x32')][_0xb984('0x66')][_0x515c3c]),'MailQueueId':Number(_0x1c8731[_0xb984('0x54')]['id'])});}}else{socket[_0xb984('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x1c8731[_0xb984('0x32')][_0xb984('0x66')]),'MailQueueId':Number(_0x1c8731[_0xb984('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e9fa1,null))[_0xb984('0x45')](handleError(_0x5e9fa1,null));};exports[_0xb984('0x8a')]=function(_0x314572,_0x5e5999,_0x26b0bf){var _0x3138df={};var _0x3c7a23={};var _0x883044;var _0x2060c6;return db[_0xb984('0x47')][_0xb984('0x57')]({'where':{'id':_0x314572[_0xb984('0x54')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x5e5999,null))['then'](function(_0x3323c4){if(_0x3323c4){_0x883044=_0x3323c4;_0x3c7a23[_0xb984('0x31')]=_[_0xb984('0x33')](db[_0xb984('0x5b')][_0xb984('0x2d')]);_0x3c7a23[_0xb984('0x32')]=_['keys'](_0x314572['query']);_0x3c7a23['filters']=_['intersection'](_0x3c7a23['model'],_0x3c7a23[_0xb984('0x32')]);_0x3138df[_0xb984('0x36')]=_[_0xb984('0x35')](_0x3c7a23[_0xb984('0x31')],qs[_0xb984('0x37')](_0x314572[_0xb984('0x32')][_0xb984('0x37')]));_0x3138df[_0xb984('0x36')]=_0x3138df[_0xb984('0x36')][_0xb984('0x38')]?_0x3138df[_0xb984('0x36')]:_0x3c7a23[_0xb984('0x31')];_0x3138df[_0xb984('0x3a')]=qs[_0xb984('0x3b')](_0x314572[_0xb984('0x32')][_0xb984('0x3b')]);_0x3138df[_0xb984('0x3c')]=qs[_0xb984('0x34')](_[_0xb984('0x3d')](_0x314572[_0xb984('0x32')],_0x3c7a23['filters']));if(_0x314572[_0xb984('0x32')][_0xb984('0x3e')]){_0x3138df['where']=_[_0xb984('0x3f')](_0x3138df[_0xb984('0x3c')],{'$or':_[_0xb984('0x2c')](_0x3138df[_0xb984('0x36')],function(_0x2f395c){var _0x319945={};_0x319945[_0x2f395c]={'$like':'%'+_0x314572[_0xb984('0x32')][_0xb984('0x3e')]+'%'};return _0x319945;})});}_0x3138df=_[_0xb984('0x3f')]({},_0x3138df,_0x314572[_0xb984('0x48')]);return _0x883044[_0xb984('0x8a')](_0x3138df);}})[_0xb984('0x23')](function(_0x1145e1){if(_0x1145e1){_0x2060c6=_0x1145e1[_0xb984('0x38')];if(!_0x314572[_0xb984('0x32')][_0xb984('0x39')](_0xb984('0x59'))){_0x3138df[_0xb984('0x1e')]=qs[_0xb984('0x1e')](_0x314572[_0xb984('0x32')][_0xb984('0x1e')]);_0x3138df['offset']=qs[_0xb984('0x1c')](_0x314572['query']['offset']);}return _0x883044[_0xb984('0x8a')](_0x3138df);}})[_0xb984('0x23')](function(_0x2ecd8a){if(_0x2ecd8a){return _0x2ecd8a?{'count':_0x2060c6,'rows':_0x2ecd8a}:null;}})['then'](respondWithResult(_0x5e5999,null))[_0xb984('0x45')](handleError(_0x5e5999,null));}; \ No newline at end of file +var _0xec6b=['ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','userMailQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','rows','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams'];(function(_0x29f6dc,_0x158791){var _0x4d180b=function(_0x29ba28){while(--_0x29ba28){_0x29f6dc['push'](_0x29f6dc['shift']());}};_0x4d180b(++_0x158791);}(_0xec6b,0x129));var _0xbec6=function(_0x4679cb,_0x2e1469){_0x4679cb=_0x4679cb-0x0;var _0x1e345b=_0xec6b[_0x4679cb];return _0x1e345b;};'use strict';var emlformat=require(_0xbec6('0x0'));var rimraf=require(_0xbec6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbec6('0x2'));var rp=require('request-promise');var moment=require(_0xbec6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbec6('0x4'));var util=require(_0xbec6('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbec6('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbec6('0x7'));var toCsv=require(_0xbec6('0x8'));var querystring=require(_0xbec6('0x9'));var Papa=require(_0xbec6('0xa'));var Redis=require(_0xbec6('0xb'));var authService=require(_0xbec6('0xc'));var qs=require(_0xbec6('0xd'));var as=require(_0xbec6('0xe'));var hardwareService=require(_0xbec6('0xf'));var logger=require(_0xbec6('0x10'))(_0xbec6('0x11'));var utils=require(_0xbec6('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbec6('0x13'));var db=require('../../mysqldb')['db'];config[_0xbec6('0x14')]=_[_0xbec6('0x15')](config['redis'],{'host':_0xbec6('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbec6('0x14')]));require('./mailQueue.socket')[_0xbec6('0x17')](socket);function respondWithStatusCode(_0x4a674d,_0x26bf75){_0x26bf75=_0x26bf75||0xcc;return function(_0xe54bd){if(_0xe54bd){return _0x4a674d[_0xbec6('0x18')](_0x26bf75);}return _0x4a674d[_0xbec6('0x19')](_0x26bf75)['end']();};}function respondWithResult(_0x15461c,_0x4b70b3){_0x4b70b3=_0x4b70b3||0xc8;return function(_0x786c76){if(_0x786c76){return _0x15461c[_0xbec6('0x19')](_0x4b70b3)[_0xbec6('0x1a')](_0x786c76);}};}function respondWithFilteredResult(_0xd9cf32,_0x28a784){return function(_0x4a18bd){if(_0x4a18bd){var _0x2e4fbc=typeof _0x28a784[_0xbec6('0x1b')]==='undefined'&&typeof _0x28a784[_0xbec6('0x1c')]===_0xbec6('0x1d');var _0x36b570=_0x4a18bd[_0xbec6('0x1e')];var _0x576358=_0x2e4fbc?0x0:_0x28a784[_0xbec6('0x1b')];var _0x1b5003=_0x2e4fbc?_0x4a18bd[_0xbec6('0x1e')]:_0x28a784[_0xbec6('0x1b')]+_0x28a784['limit'];var _0x34a83e;if(_0x1b5003>=_0x36b570){_0x1b5003=_0x36b570;_0x34a83e=0xc8;}else{_0x34a83e=0xce;}_0xd9cf32[_0xbec6('0x19')](_0x34a83e);return _0xd9cf32[_0xbec6('0x1f')]('Content-Range',_0x576358+'-'+_0x1b5003+'/'+_0x36b570)[_0xbec6('0x1a')](_0x4a18bd);}return null;};}function patchUpdates(_0x5bead7){return function(_0x29eb4d){try{jsonpatch[_0xbec6('0x20')](_0x29eb4d,_0x5bead7,!![]);}catch(_0x1fb151){return BPromise[_0xbec6('0x21')](_0x1fb151);}return _0x29eb4d[_0xbec6('0x22')]();};}function saveUpdates(_0x44574e,_0x33d7bb){return function(_0x435f80){if(_0x435f80){return _0x435f80[_0xbec6('0x23')](_0x44574e)[_0xbec6('0x24')](function(_0x59dea8){return _0x59dea8;});}return null;};}function removeEntity(_0x1e9b41,_0x2f5887){return function(_0x495266){if(_0x495266){return _0x495266[_0xbec6('0x25')]()['then'](function(){var _0x17b98d=_0x495266[_0xbec6('0x26')]({'plain':!![]});var _0x218039=_0xbec6('0x27');return db[_0xbec6('0x28')][_0xbec6('0x25')]({'where':{'type':_0x218039,'resourceId':_0x17b98d['id']}})[_0xbec6('0x24')](function(){return _0x495266;});})['then'](function(){_0x1e9b41[_0xbec6('0x19')](0xcc)[_0xbec6('0x29')]();});}};}function handleEntityNotFound(_0x3ef4da,_0x1e5bc0){return function(_0x5ce667){if(!_0x5ce667){_0x3ef4da[_0xbec6('0x18')](0x194);}return _0x5ce667;};}function handleError(_0x57c1b1,_0x555f37){_0x555f37=_0x555f37||0x1f4;return function(_0x172b89){logger[_0xbec6('0x2a')](_0x172b89[_0xbec6('0x2b')]);if(_0x172b89[_0xbec6('0x2c')]){delete _0x172b89['name'];}_0x57c1b1[_0xbec6('0x19')](_0x555f37)['send'](_0x172b89);};}exports[_0xbec6('0x2d')]=function(_0x5dcf1a,_0x5f501b){var _0x437e6f={},_0x77b0ef={},_0x5916e9={'count':0x0,'rows':[]};var _0x5ef89b=_[_0xbec6('0x2e')](db[_0xbec6('0x2f')][_0xbec6('0x30')],function(_0x3cf830){return{'name':_0x3cf830[_0xbec6('0x31')],'type':_0x3cf830['type'][_0xbec6('0x32')]};});_0x77b0ef[_0xbec6('0x33')]=_[_0xbec6('0x2e')](_0x5ef89b,'name');_0x77b0ef[_0xbec6('0x34')]=_[_0xbec6('0x35')](_0x5dcf1a[_0xbec6('0x34')]);_0x77b0ef[_0xbec6('0x36')]=_['intersection'](_0x77b0ef[_0xbec6('0x33')],_0x77b0ef[_0xbec6('0x34')]);_0x437e6f[_0xbec6('0x37')]=_[_0xbec6('0x38')](_0x77b0ef[_0xbec6('0x33')],qs['fields'](_0x5dcf1a[_0xbec6('0x34')][_0xbec6('0x39')]));_0x437e6f['attributes']=_0x437e6f[_0xbec6('0x37')]['length']?_0x437e6f[_0xbec6('0x37')]:_0x77b0ef[_0xbec6('0x33')];if(!_0x5dcf1a['query'][_0xbec6('0x3a')](_0xbec6('0x3b'))){_0x437e6f[_0xbec6('0x1c')]=qs[_0xbec6('0x1c')](_0x5dcf1a['query']['limit']);_0x437e6f[_0xbec6('0x1b')]=qs[_0xbec6('0x1b')](_0x5dcf1a[_0xbec6('0x34')][_0xbec6('0x1b')]);}_0x437e6f[_0xbec6('0x3c')]=qs['sort'](_0x5dcf1a[_0xbec6('0x34')][_0xbec6('0x3d')]);_0x437e6f[_0xbec6('0x3e')]=qs[_0xbec6('0x36')](_[_0xbec6('0x3f')](_0x5dcf1a['query'],_0x77b0ef[_0xbec6('0x36')]),_0x5ef89b);if(_0x5dcf1a['query'][_0xbec6('0x40')]){_0x437e6f[_0xbec6('0x3e')]=_[_0xbec6('0x41')](_0x437e6f[_0xbec6('0x3e')],{'$or':_[_0xbec6('0x2e')](_0x5ef89b,function(_0x54593f){if(_0x54593f[_0xbec6('0x42')]!==_0xbec6('0x43')){var _0x24ed18={};_0x24ed18[_0x54593f[_0xbec6('0x2c')]]={'$like':'%'+_0x5dcf1a[_0xbec6('0x34')][_0xbec6('0x40')]+'%'};return _0x24ed18;}})});}_0x437e6f=_[_0xbec6('0x41')]({},_0x437e6f,_0x5dcf1a[_0xbec6('0x44')]);var _0x696cbc={'where':_0x437e6f[_0xbec6('0x3e')]};return db[_0xbec6('0x2f')]['count'](_0x696cbc)[_0xbec6('0x24')](function(_0x24d1d4){_0x5916e9[_0xbec6('0x1e')]=_0x24d1d4;if(_0x5dcf1a[_0xbec6('0x34')][_0xbec6('0x45')]){_0x437e6f['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x437e6f);})[_0xbec6('0x24')](function(_0x5431b1){_0x5916e9['rows']=_0x5431b1;return _0x5916e9;})[_0xbec6('0x24')](respondWithFilteredResult(_0x5f501b,_0x437e6f))[_0xbec6('0x46')](handleError(_0x5f501b,null));};exports[_0xbec6('0x47')]=function(_0x1821c1,_0x5abb1b){var _0x2aa830={'raw':!![],'where':{'id':_0x1821c1['params']['id']}},_0x2a2ebd={};_0x2a2ebd['model']=_['keys'](db[_0xbec6('0x2f')][_0xbec6('0x30')]);_0x2a2ebd[_0xbec6('0x34')]=_[_0xbec6('0x35')](_0x1821c1['query']);_0x2a2ebd['filters']=_[_0xbec6('0x38')](_0x2a2ebd[_0xbec6('0x33')],_0x2a2ebd[_0xbec6('0x34')]);_0x2aa830[_0xbec6('0x37')]=_[_0xbec6('0x38')](_0x2a2ebd[_0xbec6('0x33')],qs[_0xbec6('0x39')](_0x1821c1['query']['fields']));_0x2aa830[_0xbec6('0x37')]=_0x2aa830[_0xbec6('0x37')][_0xbec6('0x48')]?_0x2aa830['attributes']:_0x2a2ebd[_0xbec6('0x33')];if(_0x1821c1[_0xbec6('0x34')][_0xbec6('0x45')]){_0x2aa830[_0xbec6('0x49')]=[{'all':!![]}];}_0x2aa830=_[_0xbec6('0x41')]({},_0x2aa830,_0x1821c1['options']);return db['MailQueue']['find'](_0x2aa830)['then'](handleEntityNotFound(_0x5abb1b,null))[_0xbec6('0x24')](respondWithResult(_0x5abb1b,null))[_0xbec6('0x46')](handleError(_0x5abb1b,null));};exports[_0xbec6('0x4a')]=function(_0x1936ff,_0x3d3720){return db['MailQueue'][_0xbec6('0x4a')](_0x1936ff[_0xbec6('0x4b')],{})['then'](function(_0x23590b){var _0x13f02b=_0x1936ff[_0xbec6('0x4c')]['get']({'plain':!![]});if(!_0x13f02b)throw new Error(_0xbec6('0x4d'));if(_0x13f02b['role']===_0xbec6('0x4c')){var _0x5d814f=_0x23590b[_0xbec6('0x26')]({'plain':!![]});var _0x4b0372=_0xbec6('0x27');return db[_0xbec6('0x4e')][_0xbec6('0x4f')]({'where':{'name':_0x4b0372,'userProfileId':_0x13f02b[_0xbec6('0x50')]},'raw':!![]})['then'](function(_0x4e2707){if(_0x4e2707&&_0x4e2707[_0xbec6('0x51')]===0x0){return db[_0xbec6('0x28')][_0xbec6('0x4a')]({'name':_0x5d814f[_0xbec6('0x2c')],'resourceId':_0x5d814f['id'],'type':_0x4e2707[_0xbec6('0x2c')],'sectionId':_0x4e2707['id']},{})['then'](function(){return _0x23590b;});}else{return _0x23590b;}})[_0xbec6('0x46')](function(_0x16aa8c){logger[_0xbec6('0x2a')](_0xbec6('0x52'),_0x16aa8c);throw _0x16aa8c;});}return _0x23590b;})[_0xbec6('0x24')](respondWithResult(_0x3d3720,0xc9))[_0xbec6('0x46')](handleError(_0x3d3720,null));};exports['update']=function(_0x979cb1,_0x3f36f0){if(_0x979cb1[_0xbec6('0x4b')]['id']){delete _0x979cb1['body']['id'];}return db[_0xbec6('0x2f')][_0xbec6('0x4f')]({'where':{'id':_0x979cb1[_0xbec6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f36f0,null))['then'](saveUpdates(_0x979cb1[_0xbec6('0x4b')],null))[_0xbec6('0x24')](respondWithResult(_0x3f36f0,null))[_0xbec6('0x46')](handleError(_0x3f36f0,null));};exports[_0xbec6('0x25')]=function(_0x7a3d59,_0x3b11c6){return db[_0xbec6('0x2f')][_0xbec6('0x4f')]({'where':{'id':_0x7a3d59[_0xbec6('0x53')]['id']}})[_0xbec6('0x24')](handleEntityNotFound(_0x3b11c6,null))['then'](removeEntity(_0x3b11c6,null))[_0xbec6('0x46')](handleError(_0x3b11c6,null));};exports['describe']=function(_0x5cf89c,_0x3dbd50){return db[_0xbec6('0x2f')][_0xbec6('0x54')]()['then'](respondWithResult(_0x3dbd50,null))[_0xbec6('0x46')](handleError(_0x3dbd50,null));};exports[_0xbec6('0x55')]=function(_0x5cae40,_0x36a20b,_0x31c135){var _0x25fabd={'raw':!![],'where':{}},_0x4d53c4={},_0x4de70b;return db[_0xbec6('0x2f')][_0xbec6('0x56')]({'where':{'id':_0x5cae40[_0xbec6('0x53')]['id']}})['then'](handleEntityNotFound(_0x36a20b,null))[_0xbec6('0x24')](function(_0x17c2e3){if(_0x17c2e3){_0x4de70b=_0x17c2e3[_0xbec6('0x26')]({'plain':!![]});_0x4d53c4['model']=_[_0xbec6('0x35')](db[_0xbec6('0x57')][_0xbec6('0x30')]);_0x4d53c4[_0xbec6('0x34')]=_[_0xbec6('0x35')](_0x5cae40[_0xbec6('0x34')]);_0x4d53c4[_0xbec6('0x36')]=_['intersection'](_0x4d53c4[_0xbec6('0x33')],_0x4d53c4['query']);_0x25fabd['attributes']=_[_0xbec6('0x38')](_0x4d53c4[_0xbec6('0x33')],qs['fields'](_0x5cae40[_0xbec6('0x34')][_0xbec6('0x39')]));_0x25fabd[_0xbec6('0x37')]=_0x25fabd[_0xbec6('0x37')][_0xbec6('0x48')]?_0x25fabd[_0xbec6('0x37')]:_0x4d53c4[_0xbec6('0x33')];if(!_0x5cae40[_0xbec6('0x34')]['hasOwnProperty']('nolimit')){_0x25fabd[_0xbec6('0x1c')]=qs[_0xbec6('0x1c')](_0x5cae40[_0xbec6('0x34')]['limit']);_0x25fabd[_0xbec6('0x1b')]=qs[_0xbec6('0x1b')](_0x5cae40['query'][_0xbec6('0x1b')]);}_0x25fabd[_0xbec6('0x3c')]=qs[_0xbec6('0x3d')](_0x5cae40[_0xbec6('0x34')]['sort']);_0x25fabd[_0xbec6('0x3e')]=qs[_0xbec6('0x36')](_[_0xbec6('0x3f')](_0x5cae40['query'],_0x4d53c4[_0xbec6('0x36')]));_0x25fabd['where'][_0xbec6('0x58')]=_0x17c2e3['id'];if(_0x5cae40[_0xbec6('0x34')]['filter']){_0x25fabd['where']=_[_0xbec6('0x41')](_0x25fabd[_0xbec6('0x3e')],{'$or':_[_0xbec6('0x2e')](_0x25fabd['attributes'],function(_0x50b4b6){var _0x5b95d7={};_0x5b95d7[_0x50b4b6]={'$like':'%'+_0x5cae40[_0xbec6('0x34')][_0xbec6('0x40')]+'%'};return _0x5b95d7;})});}_0x25fabd=_['merge']({},_0x25fabd,_0x5cae40[_0xbec6('0x44')]);return db[_0xbec6('0x57')][_0xbec6('0x59')](_0x25fabd);}})[_0xbec6('0x24')](function(_0x23bc2c){if(_0x23bc2c){return db[_0xbec6('0x5a')][_0xbec6('0x5b')]({'where':{'id':_['map'](_0x23bc2c,_0xbec6('0x5c')),'role':_0xbec6('0x5d')},'attributes':['id',_0xbec6('0x2c'),_0xbec6('0x5e'),'updatedAt','createdAt']});}})[_0xbec6('0x24')](function(_0x404552){if(_0x404552){return{'count':_0x404552[_0xbec6('0x1e')],'rows':_[_0xbec6('0x2e')](_0x404552[_0xbec6('0x5f')],function(_0x246116){return{'membername':_0x246116[_0xbec6('0x2c')],'UserId':_0x246116['id'],'queue_name':_0x4de70b['name'],'MailQueueId':_0x4de70b['id'],'interface':util[_0xbec6('0x60')](_0xbec6('0x61'),_0xbec6('0x62'),_0x246116['name']),'penalty':0x0,'paused':_0x246116[_0xbec6('0x5e')],'createdAt':_0x246116['createdAt'],'updatedAt':_0x246116[_0xbec6('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbec6('0x24')](respondWithFilteredResult(_0x36a20b,_0x25fabd))[_0xbec6('0x46')](handleError(_0x36a20b,null));};exports[_0xbec6('0x64')]=function(_0x49171e,_0x49f87c,_0x1e6560){var _0x119ef5={};var _0x51631b={};var _0x352248;var _0x20ffab;return db['MailQueue'][_0xbec6('0x56')]({'where':{'id':_0x49171e[_0xbec6('0x53')]['id']}})[_0xbec6('0x24')](handleEntityNotFound(_0x49f87c,null))[_0xbec6('0x24')](function(_0x3937af){if(_0x3937af){_0x352248=_0x3937af;_0x51631b[_0xbec6('0x33')]=_['keys'](db['Team']['rawAttributes']);_0x51631b[_0xbec6('0x34')]=_[_0xbec6('0x35')](_0x49171e[_0xbec6('0x34')]);_0x51631b[_0xbec6('0x36')]=_[_0xbec6('0x38')](_0x51631b[_0xbec6('0x33')],_0x51631b['query']);_0x119ef5['attributes']=_[_0xbec6('0x38')](_0x51631b['model'],qs['fields'](_0x49171e[_0xbec6('0x34')]['fields']));_0x119ef5[_0xbec6('0x37')]=_0x119ef5[_0xbec6('0x37')]['length']?_0x119ef5[_0xbec6('0x37')]:_0x51631b[_0xbec6('0x33')];_0x119ef5['order']=qs[_0xbec6('0x3d')](_0x49171e['query'][_0xbec6('0x3d')]);_0x119ef5['where']=qs[_0xbec6('0x36')](_[_0xbec6('0x3f')](_0x49171e[_0xbec6('0x34')],_0x51631b['filters']));if(_0x49171e[_0xbec6('0x34')][_0xbec6('0x40')]){_0x119ef5[_0xbec6('0x3e')]=_[_0xbec6('0x41')](_0x119ef5['where'],{'$or':_[_0xbec6('0x2e')](_0x119ef5[_0xbec6('0x37')],function(_0x52abcb){var _0x572497={};_0x572497[_0x52abcb]={'$like':'%'+_0x49171e[_0xbec6('0x34')][_0xbec6('0x40')]+'%'};return _0x572497;})});}_0x119ef5=_['merge']({},_0x119ef5,_0x49171e['options']);return _0x352248[_0xbec6('0x64')](_0x119ef5);}})[_0xbec6('0x24')](function(_0x5ec831){if(_0x5ec831){_0x20ffab=_0x5ec831[_0xbec6('0x48')];if(!_0x49171e[_0xbec6('0x34')][_0xbec6('0x3a')](_0xbec6('0x3b'))){_0x119ef5[_0xbec6('0x1c')]=qs[_0xbec6('0x1c')](_0x49171e['query']['limit']);_0x119ef5[_0xbec6('0x1b')]=qs[_0xbec6('0x1b')](_0x49171e[_0xbec6('0x34')][_0xbec6('0x1b')]);}return _0x352248['getTeams'](_0x119ef5);}})[_0xbec6('0x24')](function(_0x1f1f67){if(_0x1f1f67){return _0x1f1f67?{'count':_0x20ffab,'rows':_0x1f1f67}:null;}})['then'](respondWithResult(_0x49f87c,null))[_0xbec6('0x46')](handleError(_0x49f87c,null));};exports[_0xbec6('0x65')]=function(_0x28c652,_0x172418,_0x4d7c1e){var _0x5b59ef=_0x28c652['body'][_0xbec6('0x66')];return db['Team'][_0xbec6('0x59')]({'where':{'id':_0x5b59ef},'attributes':['id'],'include':[{'model':db[_0xbec6('0x5a')],'as':_0xbec6('0x67'),'attributes':['id',_0xbec6('0x2c'),_0xbec6('0x68'),_0xbec6('0x69'),_0xbec6('0x6a')],'raw':!![]}]})[_0xbec6('0x24')](function(_0x4e041f){if(_0x4e041f){var _0x12a797=_[_0xbec6('0x6b')](_0x4e041f,function(_0x130a62){var _0x5b3158=_0x130a62['get']({'plain':!![]});return _0x5b3158[_0xbec6('0x67')];});return db[_0xbec6('0x2f')][_0xbec6('0x4f')]({'where':{'id':_0x28c652['params']['id']}})['then'](function(_0x316628){return db[_0xbec6('0x6c')][_0xbec6('0x6d')](function(_0x58f69a){return _0x316628['addTeams'](_0x5b59ef,{'transaction':_0x58f69a})[_0xbec6('0x24')](function(){return BPromise[_0xbec6('0x6e')](_0x12a797,function(_0x2363f3){return db[_0xbec6('0x57')][_0xbec6('0x6f')]({'where':{'UserId':_0x2363f3['id'],'MailQueueId':_0x28c652[_0xbec6('0x53')]['id']},'transaction':_0x58f69a});});})[_0xbec6('0x24')](function(){_0x12a797[_0xbec6('0x70')](function(_0x580de8){socket[_0xbec6('0x71')](_0xbec6('0x72'),{'UserId':_0x580de8['id'],'MailQueueId':_0x316628['id']});});});});});}})[_0xbec6('0x24')](respondWithStatusCode(_0x172418,null))['catch'](handleError(_0x172418,null));};exports[_0xbec6('0x73')]=function(_0x458383,_0x1b0917,_0x299791){return db[_0xbec6('0x74')][_0xbec6('0x59')]({'where':{'id':_0x458383['query'][_0xbec6('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbec6('0x67'),'attributes':['id'],'raw':!![]}]})[_0xbec6('0x24')](handleEntityNotFound(_0x1b0917,null))[_0xbec6('0x24')](function(_0x5971cb){var _0x310b8b=_[_0xbec6('0x2e')](_0x5971cb,'id');var _0x322d33=[];var _0x1eda30=[];var _0xd675c9=squel[_0xbec6('0x75')]();_0xd675c9[_0xbec6('0x76')](_0xbec6('0x77'))[_0xbec6('0x78')](_0xbec6('0x79'),'tq')['join'](_0xbec6('0x7a'),'ut',_0xbec6('0x7b'))[_0xbec6('0x3e')](_0xbec6('0x7c'),_0x458383['params']['id']);for(var _0x35efd2=0x0;_0x35efd2<_0x5971cb[_0xbec6('0x48')];_0x35efd2+=0x1){let _0x53ebcc=_0x5971cb[_0x35efd2];for(var _0x240e02=0x0;_0x240e02<_0x53ebcc[_0xbec6('0x67')]['length'];_0x240e02+=0x1){let _0x3e079d=_0x53ebcc[_0xbec6('0x67')][_0x240e02];var _0x57c53b=_0xd675c9[_0xbec6('0x7d')]();_0x57c53b[_0xbec6('0x3e')](_0xbec6('0x7e'),_0x3e079d['id']);_0x1eda30['push'](db[_0xbec6('0x6c')][_0xbec6('0x34')](_0x57c53b['toString'](),{'type':db[_0xbec6('0x6c')][_0xbec6('0x7f')][_0xbec6('0x80')]})[_0xbec6('0x24')](function(_0x4f63e2){if(_0x4f63e2['length']===0x1){return _0x3e079d['id'];}else{var _0x44fbda=_[_0xbec6('0x81')](_[_0xbec6('0x2e')](_0x4f63e2,_0xbec6('0x82')),function(_0x1eb715){return _[_0xbec6('0x83')](_0x310b8b,_0x1eb715);});if(_0x44fbda){return _0x3e079d['id'];}}}));}}return BPromise[_0xbec6('0x84')](_0x1eda30)['then'](function(_0x3ac8a8){_0x322d33=_(_0x322d33)['union'](_0x3ac8a8)['compact']()[_0xbec6('0x85')]();return db[_0xbec6('0x2f')][_0xbec6('0x4f')]({'where':{'id':_0x458383['params']['id']}})['then'](function(_0x1279c9){return db['sequelize'][_0xbec6('0x6d')](function(_0x533847){return _0x1279c9[_0xbec6('0x73')](_0x458383[_0xbec6('0x34')][_0xbec6('0x66')],{'transaction':_0x533847})[_0xbec6('0x24')](function(){if(!_[_0xbec6('0x86')](_0x322d33)){return _0x1279c9['removeAgents'](_0x322d33,{'transaction':_0x533847});}})[_0xbec6('0x24')](function(){_0x322d33[_0xbec6('0x70')](function(_0x25dfe2){socket[_0xbec6('0x71')](_0xbec6('0x87'),{'UserId':_0x25dfe2,'MailQueueId':_0x1279c9['id']});});});});});});})['then'](respondWithStatusCode(_0x1b0917,null))[_0xbec6('0x46')](handleError(_0x1b0917,null));};exports[_0xbec6('0x88')]=function(_0x6e8838,_0x50ff4f,_0x4a2304){return db[_0xbec6('0x2f')][_0xbec6('0x4f')]({'where':{'id':_0x6e8838[_0xbec6('0x53')]['id']}})[_0xbec6('0x24')](handleEntityNotFound(_0x50ff4f,null))[_0xbec6('0x24')](function(_0x37a93){if(_0x37a93){return _0x37a93[_0xbec6('0x88')](_0x6e8838[_0xbec6('0x4b')]['ids'],_[_0xbec6('0x89')](_0x6e8838['body'],[_0xbec6('0x66'),'id'])||{})['spread'](function(_0x1b96a3){for(var _0x15cb9d=0x0;_0x15cb9d<_0x6e8838['body'][_0xbec6('0x66')][_0xbec6('0x48')];_0x15cb9d+=0x1){socket[_0xbec6('0x71')](_0xbec6('0x72'),{'UserId':Number(_0x6e8838[_0xbec6('0x4b')][_0xbec6('0x66')][_0x15cb9d]),'MailQueueId':Number(_0x6e8838[_0xbec6('0x53')]['id'])});}return _0x1b96a3;});}})[_0xbec6('0x24')](respondWithResult(_0x50ff4f,null))[_0xbec6('0x46')](handleError(_0x50ff4f,null));};exports[_0xbec6('0x8a')]=function(_0x3c75a7,_0x2a648,_0xa916c){return db[_0xbec6('0x2f')]['find']({'where':{'id':_0x3c75a7['params']['id']}})[_0xbec6('0x24')](handleEntityNotFound(_0x2a648,null))[_0xbec6('0x24')](function(_0x226fd1){if(_0x226fd1){return _0x226fd1[_0xbec6('0x8a')](_0x3c75a7[_0xbec6('0x34')][_0xbec6('0x66')])[_0xbec6('0x24')](function(){if(_['isArray'](_0x3c75a7[_0xbec6('0x34')][_0xbec6('0x66')])){for(var _0x43b890=0x0;_0x43b890<_0x3c75a7[_0xbec6('0x34')][_0xbec6('0x66')][_0xbec6('0x48')];_0x43b890+=0x1){socket[_0xbec6('0x71')](_0xbec6('0x87'),{'UserId':Number(_0x3c75a7[_0xbec6('0x34')][_0xbec6('0x66')][_0x43b890]),'MailQueueId':Number(_0x3c75a7['params']['id'])});}}else{socket[_0xbec6('0x71')](_0xbec6('0x87'),{'UserId':Number(_0x3c75a7[_0xbec6('0x34')][_0xbec6('0x66')]),'MailQueueId':Number(_0x3c75a7[_0xbec6('0x53')]['id'])});}});}})[_0xbec6('0x24')](respondWithStatusCode(_0x2a648,null))[_0xbec6('0x46')](handleError(_0x2a648,null));};exports[_0xbec6('0x8b')]=function(_0x3b12df,_0x5642e4,_0x44ee39){var _0x7ab4e8={};var _0x2e623d={};var _0x501a86;var _0x25dbd8;return db[_0xbec6('0x2f')][_0xbec6('0x56')]({'where':{'id':_0x3b12df[_0xbec6('0x53')]['id']}})[_0xbec6('0x24')](handleEntityNotFound(_0x5642e4,null))[_0xbec6('0x24')](function(_0x2ee408){if(_0x2ee408){_0x501a86=_0x2ee408;_0x2e623d[_0xbec6('0x33')]=_[_0xbec6('0x35')](db[_0xbec6('0x5a')][_0xbec6('0x30')]);_0x2e623d[_0xbec6('0x34')]=_[_0xbec6('0x35')](_0x3b12df[_0xbec6('0x34')]);_0x2e623d[_0xbec6('0x36')]=_[_0xbec6('0x38')](_0x2e623d[_0xbec6('0x33')],_0x2e623d[_0xbec6('0x34')]);_0x7ab4e8[_0xbec6('0x37')]=_['intersection'](_0x2e623d['model'],qs[_0xbec6('0x39')](_0x3b12df['query'][_0xbec6('0x39')]));_0x7ab4e8[_0xbec6('0x37')]=_0x7ab4e8[_0xbec6('0x37')][_0xbec6('0x48')]?_0x7ab4e8[_0xbec6('0x37')]:_0x2e623d[_0xbec6('0x33')];_0x7ab4e8[_0xbec6('0x3c')]=qs[_0xbec6('0x3d')](_0x3b12df[_0xbec6('0x34')][_0xbec6('0x3d')]);_0x7ab4e8['where']=qs[_0xbec6('0x36')](_['pick'](_0x3b12df[_0xbec6('0x34')],_0x2e623d[_0xbec6('0x36')]));if(_0x3b12df['query'][_0xbec6('0x40')]){_0x7ab4e8[_0xbec6('0x3e')]=_[_0xbec6('0x41')](_0x7ab4e8['where'],{'$or':_['map'](_0x7ab4e8['attributes'],function(_0x1750f8){var _0x5e9623={};_0x5e9623[_0x1750f8]={'$like':'%'+_0x3b12df[_0xbec6('0x34')][_0xbec6('0x40')]+'%'};return _0x5e9623;})});}_0x7ab4e8=_[_0xbec6('0x41')]({},_0x7ab4e8,_0x3b12df[_0xbec6('0x44')]);return _0x501a86[_0xbec6('0x8b')](_0x7ab4e8);}})[_0xbec6('0x24')](function(_0x2eb3f4){if(_0x2eb3f4){_0x25dbd8=_0x2eb3f4[_0xbec6('0x48')];if(!_0x3b12df[_0xbec6('0x34')][_0xbec6('0x3a')](_0xbec6('0x3b'))){_0x7ab4e8[_0xbec6('0x1c')]=qs[_0xbec6('0x1c')](_0x3b12df[_0xbec6('0x34')][_0xbec6('0x1c')]);_0x7ab4e8[_0xbec6('0x1b')]=qs[_0xbec6('0x1b')](_0x3b12df[_0xbec6('0x34')][_0xbec6('0x1b')]);}return _0x501a86['getAgents'](_0x7ab4e8);}})[_0xbec6('0x24')](function(_0x252ebd){if(_0x252ebd){return _0x252ebd?{'count':_0x25dbd8,'rows':_0x252ebd}:null;}})[_0xbec6('0x24')](respondWithResult(_0x5642e4,null))[_0xbec6('0x46')](handleError(_0x5642e4,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7d539c1..b8f6ec4 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 _0x9c2b=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xa38e6f,_0x581d52){var _0xa4e745=function(_0x1df56c){while(--_0x1df56c){_0xa38e6f['push'](_0xa38e6f['shift']());}};_0xa4e745(++_0x581d52);}(_0x9c2b,0x9a));var _0xb9c2=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9c2b[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0xb9c2('0x0'));var MailQueue=require(_0xb9c2('0x1'))['db'][_0xb9c2('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb9c2('0x3')](0x0);var events={'afterCreate':_0xb9c2('0x4'),'afterUpdate':_0xb9c2('0x5'),'afterDestroy':_0xb9c2('0x6')};function emitEvent(_0x167dda){return function(_0x40e61e,_0x2d08cb,_0x557f4a){MailQueueEvents['emit'](_0x167dda+':'+_0x40e61e['id'],_0x40e61e);MailQueueEvents[_0xb9c2('0x7')](_0x167dda,_0x40e61e);_0x557f4a(null);};}for(var e in events){if(events[_0xb9c2('0x8')](e)){var event=events[e];MailQueue[_0xb9c2('0x9')](e,emitEvent(event));}}module[_0xb9c2('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xdca1=['save','update','emit','hasOwnProperty','events','MailQueue','setMaxListeners'];(function(_0x5f5672,_0x4025c9){var _0x12ca7b=function(_0x278f2f){while(--_0x278f2f){_0x5f5672['push'](_0x5f5672['shift']());}};_0x12ca7b(++_0x4025c9);}(_0xdca1,0x1af));var _0x1dca=function(_0x11970d,_0x33e94c){_0x11970d=_0x11970d-0x0;var _0x2ce41f=_0xdca1[_0x11970d];return _0x2ce41f;};'use strict';var EventEmitter=require(_0x1dca('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x1dca('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1dca('0x2')](0x0);var events={'afterCreate':_0x1dca('0x3'),'afterUpdate':_0x1dca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b1c1c){return function(_0x1d86bb,_0x22a0fd,_0x186102){MailQueueEvents[_0x1dca('0x5')](_0x4b1c1c+':'+_0x1d86bb['id'],_0x1d86bb);MailQueueEvents[_0x1dca('0x5')](_0x4b1c1c,_0x1d86bb);_0x186102(null);};}for(var e in events){if(events[_0x1dca('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 20268ea..0fb286d 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 _0xd14f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd14f,0xb4));var _0xfd14=function(_0x5433e7,_0x509d14){_0x5433e7=_0x5433e7-0x0;var _0x3b1e25=_0xd14f[_0x5433e7];return _0x3b1e25;};'use strict';var _=require('lodash');var util=require(_0xfd14('0x0'));var logger=require(_0xfd14('0x1'))(_0xfd14('0x2'));var moment=require(_0xfd14('0x3'));var BPromise=require(_0xfd14('0x4'));var rp=require(_0xfd14('0x5'));var fs=require('fs');var path=require(_0xfd14('0x6'));var rimraf=require(_0xfd14('0x7'));var config=require(_0xfd14('0x8'));var attributes=require('./mailQueue.attributes');module[_0xfd14('0x9')]=function(_0x45e68c,_0xd0ac88){return _0x45e68c[_0xfd14('0xa')](_0xfd14('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb272=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','moment','request-promise','rimraf'];(function(_0x2ed688,_0x514578){var _0x2b8fb4=function(_0x40519c){while(--_0x40519c){_0x2ed688['push'](_0x2ed688['shift']());}};_0x2b8fb4(++_0x514578);}(_0xb272,0xa0));var _0x2b27=function(_0x27e321,_0x222eb5){_0x27e321=_0x27e321-0x0;var _0x19ac6c=_0xb272[_0x27e321];return _0x19ac6c;};'use strict';var _=require(_0x2b27('0x0'));var util=require(_0x2b27('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b27('0x2'));var BPromise=require('bluebird');var rp=require(_0x2b27('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b27('0x4'));var config=require(_0x2b27('0x5'));var attributes=require(_0x2b27('0x6'));module[_0x2b27('0x7')]=function(_0x534d2e,_0x24cc4a){return _0x534d2e[_0x2b27('0x8')](_0x2b27('0x9'),attributes,{'tableName':_0x2b27('0xa'),'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 68fc844..285e49d 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 _0x5ae6=['find','raw','lodash','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','GetMailQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','MailQueue'];(function(_0x56ab11,_0x14cba4){var _0x5f3bba=function(_0x35041b){while(--_0x35041b){_0x56ab11['push'](_0x56ab11['shift']());}};_0x5f3bba(++_0x14cba4);}(_0x5ae6,0x105));var _0x65ae=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x5ae6[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0x65ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65ae('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ae('0x2'))['db'];var utils=require(_0x65ae('0x3'));var logger=require('../../config/logger')(_0x65ae('0x4'));var config=require('../../config/environment');var jayson=require(_0x65ae('0x5'));var client=jayson[_0x65ae('0x6')][_0x65ae('0x7')]({'port':0x232a});config[_0x65ae('0x8')]=_[_0x65ae('0x9')](config['redis'],{'host':_0x65ae('0xa'),'port':0x18eb});var socket=require(_0x65ae('0xb'))(new Redis(config[_0x65ae('0x8')]));require('./mailQueue.socket')[_0x65ae('0xc')](socket);function respondWithRpcPromise(_0x23b9a8,_0x7e4068,_0x2c350c){return new BPromise(function(_0x1779ce,_0x3255fe){return client[_0x65ae('0xd')](_0x23b9a8,_0x2c350c)[_0x65ae('0xe')](function(_0x181d6b){logger['info'](_0x65ae('0xf'),_0x7e4068,'request\x20sent');logger[_0x65ae('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x7e4068,_0x65ae('0x11'),JSON[_0x65ae('0x12')](_0x181d6b));if(_0x181d6b[_0x65ae('0x13')]){if(_0x181d6b[_0x65ae('0x13')]['code']===0x1f4){logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);return _0x3255fe(_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);}logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);return _0x1779ce(_0x181d6b[_0x65ae('0x13')][_0x65ae('0x14')]);}else{logger[_0x65ae('0x15')]('MailQueue,\x20%s,\x20%s',_0x7e4068,_0x65ae('0x11'));_0x1779ce(_0x181d6b[_0x65ae('0x16')][_0x65ae('0x14')]);}})['catch'](function(_0x59ff17){logger[_0x65ae('0x13')](_0x65ae('0xf'),_0x7e4068,_0x59ff17);_0x3255fe(_0x59ff17);});});}exports[_0x65ae('0x17')]=function(_0x315b0c){var _0x376ebc=this;return new Promise(function(_0x550c63,_0x5aa293){return db['MailQueue'][_0x65ae('0x18')]({'raw':_0x315b0c['options']?_0x315b0c[_0x65ae('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1a')]||null:null,'attributes':_0x315b0c[_0x65ae('0x19')]?_0x315b0c['options'][_0x65ae('0x1b')]||null:null,'limit':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1c')]||null:null,'include':_0x315b0c[_0x65ae('0x19')]?_0x315b0c[_0x65ae('0x19')][_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x315b0c['options'][_0x65ae('0x1d')],function(_0x451908){return{'model':db[_0x451908[_0x65ae('0x1f')]],'as':_0x451908['as'],'attributes':_0x451908[_0x65ae('0x1b')],'include':_0x451908[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x451908[_0x65ae('0x1d')],function(_0x11a4bd){return{'model':db[_0x11a4bd[_0x65ae('0x1f')]],'as':_0x11a4bd['as'],'attributes':_0x11a4bd['attributes'],'include':_0x11a4bd[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x11a4bd[_0x65ae('0x1d')],function(_0x19fec7){return{'model':db[_0x19fec7[_0x65ae('0x1f')]],'as':_0x19fec7['as'],'attributes':_0x19fec7[_0x65ae('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14c622){logger['info'](_0x65ae('0x17'),_0x315b0c);logger[_0x65ae('0x10')](_0x65ae('0x17'),_0x315b0c,JSON[_0x65ae('0x12')](_0x14c622));_0x550c63(_0x14c622);})[_0x65ae('0x20')](function(_0xb24017){logger[_0x65ae('0x13')](_0x65ae('0x17'),_0xb24017[_0x65ae('0x14')],_0x315b0c);_0x5aa293(_0x376ebc[_0x65ae('0x13')](0x1f4,_0xb24017['message']));});});};exports[_0x65ae('0x21')]=function(_0x32f475){var _0x136655=this;return new Promise(function(_0x163021,_0xb028fc){return db[_0x65ae('0x22')][_0x65ae('0x23')]({'raw':_0x32f475['options']?_0x32f475['options'][_0x65ae('0x24')]===undefined?!![]:![]:!![],'where':_0x32f475[_0x65ae('0x19')]?_0x32f475[_0x65ae('0x19')]['where']||null:null,'attributes':_0x32f475['options']?_0x32f475[_0x65ae('0x19')][_0x65ae('0x1b')]||null:null,'include':_0x32f475[_0x65ae('0x19')]?_0x32f475[_0x65ae('0x19')][_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x32f475[_0x65ae('0x19')][_0x65ae('0x1d')],function(_0x24aec9){return{'model':db[_0x24aec9[_0x65ae('0x1f')]],'as':_0x24aec9['as'],'attributes':_0x24aec9[_0x65ae('0x1b')],'include':_0x24aec9[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x24aec9[_0x65ae('0x1d')],function(_0x36e04c){return{'model':db[_0x36e04c[_0x65ae('0x1f')]],'as':_0x36e04c['as'],'attributes':_0x36e04c[_0x65ae('0x1b')],'include':_0x36e04c[_0x65ae('0x1d')]?_[_0x65ae('0x1e')](_0x36e04c[_0x65ae('0x1d')],function(_0x1ccc34){return{'model':db[_0x1ccc34[_0x65ae('0x1f')]],'as':_0x1ccc34['as'],'attributes':_0x1ccc34[_0x65ae('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x65ae('0xe')](function(_0x42a2e){logger[_0x65ae('0x15')]('ShowMailQueue',_0x32f475);logger[_0x65ae('0x10')](_0x65ae('0x21'),_0x32f475,JSON['stringify'](_0x42a2e));_0x163021(_0x42a2e);})['catch'](function(_0x58557e){logger[_0x65ae('0x13')](_0x65ae('0x21'),_0x58557e[_0x65ae('0x14')],_0x32f475);_0xb028fc(_0x136655[_0x65ae('0x13')](0x1f4,_0x58557e[_0x65ae('0x14')]));});});}; \ No newline at end of file +var _0xceb2=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','catch','ShowMailQueue','find','raw','util','moment','bluebird','ioredis'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0xceb2,0x1b8));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2ceb('0x0'));var moment=require(_0x2ceb('0x1'));var BPromise=require(_0x2ceb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ceb('0x3'));var db=require(_0x2ceb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ceb('0x5'))('rpc');var config=require(_0x2ceb('0x6'));var jayson=require(_0x2ceb('0x7'));var client=jayson[_0x2ceb('0x8')][_0x2ceb('0x9')]({'port':0x232a});config[_0x2ceb('0xa')]=_[_0x2ceb('0xb')](config[_0x2ceb('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ceb('0xa')]));require(_0x2ceb('0xc'))[_0x2ceb('0xd')](socket);function respondWithRpcPromise(_0x44a867,_0x45c026,_0x5ef4f7){return new BPromise(function(_0x524947,_0x1d1313){return client[_0x2ceb('0xe')](_0x44a867,_0x5ef4f7)['then'](function(_0x50b435){logger['info'](_0x2ceb('0xf'),_0x45c026,_0x2ceb('0x10'));logger[_0x2ceb('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x45c026,'request\x20sent',JSON[_0x2ceb('0x12')](_0x50b435));if(_0x50b435[_0x2ceb('0x13')]){if(_0x50b435[_0x2ceb('0x13')]['code']===0x1f4){logger[_0x2ceb('0x13')](_0x2ceb('0xf'),_0x45c026,_0x50b435[_0x2ceb('0x13')][_0x2ceb('0x14')]);return _0x1d1313(_0x50b435['error'][_0x2ceb('0x14')]);}logger['error'](_0x2ceb('0xf'),_0x45c026,_0x50b435[_0x2ceb('0x13')]['message']);return _0x524947(_0x50b435['error'][_0x2ceb('0x14')]);}else{logger[_0x2ceb('0x15')](_0x2ceb('0xf'),_0x45c026,_0x2ceb('0x10'));_0x524947(_0x50b435[_0x2ceb('0x16')][_0x2ceb('0x14')]);}})['catch'](function(_0x66599a){logger['error'](_0x2ceb('0xf'),_0x45c026,_0x66599a);_0x1d1313(_0x66599a);});});}exports['GetMailQueue']=function(_0x551896){var _0xeb04a9=this;return new Promise(function(_0x3ef866,_0x222f65){return db[_0x2ceb('0x17')][_0x2ceb('0x18')]({'raw':_0x551896[_0x2ceb('0x19')]?_0x551896[_0x2ceb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x551896[_0x2ceb('0x19')]?_0x551896[_0x2ceb('0x19')][_0x2ceb('0x1a')]||null:null,'attributes':_0x551896[_0x2ceb('0x19')]?_0x551896[_0x2ceb('0x19')][_0x2ceb('0x1b')]||null:null,'limit':_0x551896[_0x2ceb('0x19')]?_0x551896[_0x2ceb('0x19')][_0x2ceb('0x1c')]||null:null,'include':_0x551896[_0x2ceb('0x19')]?_0x551896['options'][_0x2ceb('0x1d')]?_[_0x2ceb('0x1e')](_0x551896[_0x2ceb('0x19')][_0x2ceb('0x1d')],function(_0x2393c3){return{'model':db[_0x2393c3['model']],'as':_0x2393c3['as'],'attributes':_0x2393c3[_0x2ceb('0x1b')],'include':_0x2393c3[_0x2ceb('0x1d')]?_[_0x2ceb('0x1e')](_0x2393c3[_0x2ceb('0x1d')],function(_0x1fc13e){return{'model':db[_0x1fc13e[_0x2ceb('0x1f')]],'as':_0x1fc13e['as'],'attributes':_0x1fc13e[_0x2ceb('0x1b')],'include':_0x1fc13e['include']?_[_0x2ceb('0x1e')](_0x1fc13e['include'],function(_0x3aa33c){return{'model':db[_0x3aa33c[_0x2ceb('0x1f')]],'as':_0x3aa33c['as'],'attributes':_0x3aa33c[_0x2ceb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cce8a){logger[_0x2ceb('0x15')](_0x2ceb('0x20'),_0x551896);logger['debug'](_0x2ceb('0x20'),_0x551896,JSON[_0x2ceb('0x12')](_0x2cce8a));_0x3ef866(_0x2cce8a);})[_0x2ceb('0x21')](function(_0x541fb6){logger['error']('GetMailQueue',_0x541fb6[_0x2ceb('0x14')],_0x551896);_0x222f65(_0xeb04a9[_0x2ceb('0x13')](0x1f4,_0x541fb6[_0x2ceb('0x14')]));});});};exports[_0x2ceb('0x22')]=function(_0x1fc35f){var _0x33eb8c=this;return new Promise(function(_0x4e34cc,_0x2458bf){return db[_0x2ceb('0x17')][_0x2ceb('0x23')]({'raw':_0x1fc35f['options']?_0x1fc35f[_0x2ceb('0x19')][_0x2ceb('0x24')]===undefined?!![]:![]:!![],'where':_0x1fc35f[_0x2ceb('0x19')]?_0x1fc35f['options'][_0x2ceb('0x1a')]||null:null,'attributes':_0x1fc35f['options']?_0x1fc35f[_0x2ceb('0x19')]['attributes']||null:null,'include':_0x1fc35f[_0x2ceb('0x19')]?_0x1fc35f[_0x2ceb('0x19')][_0x2ceb('0x1d')]?_[_0x2ceb('0x1e')](_0x1fc35f[_0x2ceb('0x19')][_0x2ceb('0x1d')],function(_0x40fb91){return{'model':db[_0x40fb91[_0x2ceb('0x1f')]],'as':_0x40fb91['as'],'attributes':_0x40fb91[_0x2ceb('0x1b')],'include':_0x40fb91['include']?_[_0x2ceb('0x1e')](_0x40fb91['include'],function(_0x2cb6ae){return{'model':db[_0x2cb6ae['model']],'as':_0x2cb6ae['as'],'attributes':_0x2cb6ae['attributes'],'include':_0x2cb6ae[_0x2ceb('0x1d')]?_[_0x2ceb('0x1e')](_0x2cb6ae[_0x2ceb('0x1d')],function(_0x2cb118){return{'model':db[_0x2cb118[_0x2ceb('0x1f')]],'as':_0x2cb118['as'],'attributes':_0x2cb118[_0x2ceb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x424989){logger[_0x2ceb('0x15')]('ShowMailQueue',_0x1fc35f);logger[_0x2ceb('0x11')]('ShowMailQueue',_0x1fc35f,JSON['stringify'](_0x424989));_0x4e34cc(_0x424989);})[_0x2ceb('0x21')](function(_0x37cbdb){logger['error']('ShowMailQueue',_0x37cbdb['message'],_0x1fc35f);_0x2458bf(_0x33eb8c[_0x2ceb('0x13')](0x1f4,_0x37cbdb['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4ce08ef..695e464 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 _0xf7a3=['emit','register','length','mailQueue:','remove','update'];(function(_0x23f40a,_0x556ffc){var _0x14e216=function(_0x4fab71){while(--_0x4fab71){_0x23f40a['push'](_0x23f40a['shift']());}};_0x14e216(++_0x556ffc);}(_0xf7a3,0xac));var _0x3f7a=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf7a3[_0x13b7fd];return _0x32a74a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x3f7a('0x0'),_0x3f7a('0x1')];function createListener(_0x5cec67,_0x99b502){return function(_0x5148b3){_0x99b502[_0x3f7a('0x2')](_0x5cec67,_0x5148b3);};}function removeListener(_0x449f54,_0xf61a3){return function(){MailQueueEvents['removeListener'](_0x449f54,_0xf61a3);};}exports[_0x3f7a('0x3')]=function(_0x72a19d){for(var _0x58d8e7=0x0,_0x1bb3e1=events[_0x3f7a('0x4')];_0x58d8e7<_0x1bb3e1;_0x58d8e7++){var _0x6148f0=events[_0x58d8e7];var _0x4e3edb=createListener(_0x3f7a('0x5')+_0x6148f0,_0x72a19d);MailQueueEvents['on'](_0x6148f0,_0x4e3edb);}}; \ No newline at end of file +var _0xea28=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x4bb7e4,_0x211d37){var _0x398622=function(_0x5e5251){while(--_0x5e5251){_0x4bb7e4['push'](_0x4bb7e4['shift']());}};_0x398622(++_0x211d37);}(_0xea28,0x13a));var _0x8ea2=function(_0x5d1818,_0x2b082e){_0x5d1818=_0x5d1818-0x0;var _0xcb215c=_0xea28[_0x5d1818];return _0xcb215c;};'use strict';var MailQueueEvents=require(_0x8ea2('0x0'));var events=[_0x8ea2('0x1'),_0x8ea2('0x2'),_0x8ea2('0x3')];function createListener(_0x459c4e,_0x25e47e){return function(_0x3309d9){_0x25e47e[_0x8ea2('0x4')](_0x459c4e,_0x3309d9);};}function removeListener(_0x4b7cda,_0x9b45ab){return function(){MailQueueEvents[_0x8ea2('0x5')](_0x4b7cda,_0x9b45ab);};}exports[_0x8ea2('0x6')]=function(_0x513a0d){for(var _0x29b82b=0x0,_0x435d78=events[_0x8ea2('0x7')];_0x29b82b<_0x435d78;_0x29b82b++){var _0x39b1fa=events[_0x29b82b];var _0x28b5b8=createListener(_0x8ea2('0x8')+_0x39b1fa,_0x513a0d);MailQueueEvents['on'](_0x39b1fa,_0x28b5b8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 48a9565..d7ac72c 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 _0x2fab=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','index','get','isAuthenticated','describe','create','update','delete','/:id'];(function(_0x220fa6,_0x1a965a){var _0x321a8e=function(_0x17a7c7){while(--_0x17a7c7){_0x220fa6['push'](_0x220fa6['shift']());}};_0x321a8e(++_0x1a965a);}(_0x2fab,0x1a1));var _0xb2fa=function(_0x38c0eb,_0x17c7ce){_0x38c0eb=_0x38c0eb-0x0;var _0x2dbd1e=_0x2fab[_0x38c0eb];return _0x2dbd1e;};'use strict';var multer=require(_0xb2fa('0x0'));var util=require('util');var path=require(_0xb2fa('0x1'));var timeout=require(_0xb2fa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2fa('0x3'));var auth=require(_0xb2fa('0x4'));var interaction=require(_0xb2fa('0x5'));var config=require('../../config/environment');var controller=require(_0xb2fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2fa('0x7')]);router[_0xb2fa('0x8')]('/describe',auth[_0xb2fa('0x9')](),controller[_0xb2fa('0xa')]);router['get']('/:id',auth[_0xb2fa('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb2fa('0xb')]);router['put']('/:id',auth[_0xb2fa('0x9')](),controller[_0xb2fa('0xc')]);router[_0xb2fa('0xd')](_0xb2fa('0xe'),auth[_0xb2fa('0x9')](),controller['destroy']);module[_0xb2fa('0xf')]=router; \ No newline at end of file +var _0x5790=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x5790,0xf7));var _0x0579=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5790[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x0579('0x0'));var util=require('util');var path=require(_0x0579('0x1'));var timeout=require(_0x0579('0x2'));var express=require(_0x0579('0x3'));var router=express[_0x0579('0x4')]();var fs_extra=require(_0x0579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0579('0x6'));var config=require(_0x0579('0x7'));var controller=require('./mailQueueReport.controller');router[_0x0579('0x8')]('/',auth[_0x0579('0x9')](),controller[_0x0579('0xa')]);router[_0x0579('0x8')](_0x0579('0xb'),auth[_0x0579('0x9')](),controller[_0x0579('0xc')]);router[_0x0579('0x8')](_0x0579('0xd'),auth[_0x0579('0x9')](),controller['show']);router[_0x0579('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0579('0xf')](_0x0579('0xd'),auth[_0x0579('0x9')](),controller['update']);router[_0x0579('0x10')](_0x0579('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0579('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7120fe2..33318cf 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 _0xc11f=['DATE','moment','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc11f,0x1b5));var _0xfc11=function(_0x18af59,_0x2dad50){_0x18af59=_0x18af59-0x0;var _0x4366da=_0xc11f[_0x18af59];return _0x4366da;};'use strict';var moment=require(_0xfc11('0x0'));var Sequelize=require('sequelize');module[_0xfc11('0x1')]={'uniqueid':{'type':Sequelize[_0xfc11('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc11('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfc11('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfc11('0x3')]},'reason':{'type':Sequelize[_0xfc11('0x2')]}}; \ No newline at end of file +var _0x5b28=['DATE','STRING','moment','sequelize','exports'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5b28,0xac));var _0x85b2=function(_0x3ba4e1,_0x4d9374){_0x3ba4e1=_0x3ba4e1-0x0;var _0x446bc5=_0x5b28[_0x3ba4e1];return _0x446bc5;};'use strict';var moment=require(_0x85b2('0x0'));var Sequelize=require(_0x85b2('0x1'));module[_0x85b2('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x85b2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x85b2('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 64c64bc..df3c0d0 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xacf4,0xe7));var _0x4acf=function(_0x2d6df9,_0x45da50){_0x2d6df9=_0x2d6df9-0x0;var _0x429b18=_0xacf4[_0x2d6df9];return _0x429b18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['MailQueueReport'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['MailQueueReport']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x4e2e=['name','send','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack'];(function(_0x499384,_0x45cca9){var _0x11033d=function(_0x5b3f8e){while(--_0x5b3f8e){_0x499384['push'](_0x499384['shift']());}};_0x11033d(++_0x45cca9);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x35ae08,_0x1e9732){_0x35ae08=_0x35ae08-0x0;var _0x4f093a=_0x4e2e[_0x35ae08];return _0x4f093a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['MailQueueReport'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['MailQueueReport'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));};exports[_0xe4e2('0x4c')]=function(_0x582674,_0x169251){return db[_0xe4e2('0x2c')]['describe']()[_0xe4e2('0x26')](respondWithResult(_0x169251,null))[_0xe4e2('0x43')](handleError(_0x169251,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 95e7e69..41ea28f 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 _0xd6e5=['uniqueid','lodash','../../config/logger','bluebird','path','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x2d7116,_0xbf7571){var _0x3a82c6=function(_0x3b8a17){while(--_0x3b8a17){_0x2d7116['push'](_0x2d7116['shift']());}};_0x3a82c6(++_0xbf7571);}(_0xd6e5,0x184));var _0x5d6e=function(_0x41cb2e,_0x24088c){_0x41cb2e=_0x41cb2e-0x0;var _0x555a54=_0xd6e5[_0x41cb2e];return _0x555a54;};'use strict';var _=require(_0x5d6e('0x0'));var util=require('util');var logger=require(_0x5d6e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5d6e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d6e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d6e('0x4'));module['exports']=function(_0x582ab4,_0x169fc7){return _0x582ab4[_0x5d6e('0x5')](_0x5d6e('0x6'),attributes,{'tableName':_0x5d6e('0x7'),'paranoid':![],'indexes':[{'name':_0x5d6e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b06=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0x6b06,0x1e4));var _0x66b0=function(_0x35e2a,_0x2de5f7){_0x35e2a=_0x35e2a-0x0;var _0x4433f5=_0x6b06[_0x35e2a];return _0x4433f5;};'use strict';var _=require(_0x66b0('0x0'));var util=require(_0x66b0('0x1'));var logger=require(_0x66b0('0x2'))('api');var moment=require(_0x66b0('0x3'));var BPromise=require(_0x66b0('0x4'));var rp=require(_0x66b0('0x5'));var fs=require('fs');var path=require(_0x66b0('0x6'));var rimraf=require(_0x66b0('0x7'));var config=require(_0x66b0('0x8'));var attributes=require(_0x66b0('0x9'));module[_0x66b0('0xa')]=function(_0x4965ce,_0x274586){return _0x4965ce[_0x66b0('0xb')]('MailQueueReport',attributes,{'tableName':_0x66b0('0xc'),'paranoid':![],'indexes':[{'name':_0x66b0('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8fc8166..ab1497d 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5263ac,_0x7e13da){var _0x49df66=function(_0x511cf7){while(--_0x511cf7){_0x5263ac['push'](_0x5263ac['shift']());}};_0x49df66(++_0x7e13da);}(_0xadb5,0xad));var _0x5adb=function(_0x57cf36,_0x4b6e17){_0x57cf36=_0x57cf36-0x0;var _0x3ec0a5=_0xadb5[_0x57cf36];return _0x3ec0a5;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3c3039,_0xd0a1dc){var _0xc9710d=function(_0x191211){while(--_0x191211){_0x3c3039['push'](_0x3c3039['shift']());}};_0xc9710d(++_0xd0a1dc);}(_0x2ef3,0xba));var _0x32ef=function(_0x399f6e,_0x1acea3){_0x399f6e=_0x399f6e-0x0;var _0x203595=_0x2ef3[_0x399f6e];return _0x203595;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a66c458..11760d3 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x12926a,_0xb3be90){var _0x2db765=function(_0x32e279){while(--_0x32e279){_0x12926a['push'](_0x12926a['shift']());}};_0x2db765(++_0xb3be90);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 47c0b52..f66575f 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 _0x9956=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x5a45aa,_0x3e065e){var _0xdcadaf=function(_0xd8e093){while(--_0xd8e093){_0x5a45aa['push'](_0x5a45aa['shift']());}};_0xdcadaf(++_0x3e065e);}(_0x9956,0x1b1));var _0x6995=function(_0xcc2917,_0x4ea96c){_0xcc2917=_0xcc2917-0x0;var _0x40c7d4=_0x9956[_0xcc2917];return _0x40c7d4;};'use strict';var Sequelize=require(_0x6995('0x0'));module[_0x6995('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6995('0x2')]},'authentication':{'type':Sequelize[_0x6995('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6995('0x2')]},'password':{'type':Sequelize[_0x6995('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x6995('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6995('0x2')],'defaultValue':_0x6995('0x4')},'connTimeout':{'type':Sequelize[_0x6995('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6995('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8769=['BOOLEAN','INBOX','INTEGER','sequelize','STRING'];(function(_0xbaed7d,_0x3000bc){var _0x3bc9b4=function(_0x5cda2b){while(--_0x5cda2b){_0xbaed7d['push'](_0xbaed7d['shift']());}};_0x3bc9b4(++_0x3000bc);}(_0x8769,0xc6));var _0x9876=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x8769[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x9876('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9876('0x1')]},'authentication':{'type':Sequelize[_0x9876('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9876('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x9876('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x9876('0x3')},'connTimeout':{'type':Sequelize[_0x9876('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9876('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9876('0x1')]},'modernAuthentication':{'type':Sequelize[_0x9876('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7db112c..9b72d6c 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 _0xf6fa=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','api','moment','request-promise'];(function(_0x172266,_0x34c4de){var _0x4678b5=function(_0x18fc8e){while(--_0x18fc8e){_0x172266['push'](_0x172266['shift']());}};_0x4678b5(++_0x34c4de);}(_0xf6fa,0x8b));var _0xaf6f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf6fa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xaf6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf6f('0x1'));var moment=require(_0xaf6f('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf6f('0x3'));var fs=require('fs');var path=require(_0xaf6f('0x4'));var rimraf=require(_0xaf6f('0x5'));var config=require(_0xaf6f('0x6'));var attributes=require(_0xaf6f('0x7'));module[_0xaf6f('0x8')]=function(_0x41cf8a,_0x313e50){return _0x41cf8a[_0xaf6f('0x9')](_0xaf6f('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa234=['request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5dcc33,_0x541c56){var _0x51df1d=function(_0x2f30b8){while(--_0x2f30b8){_0x5dcc33['push'](_0x5dcc33['shift']());}};_0x51df1d(++_0x541c56);}(_0xa234,0xa4));var _0x4a23=function(_0x2e69e7,_0x1ff052){_0x2e69e7=_0x2e69e7-0x0;var _0x1aebf6=_0xa234[_0x2e69e7];return _0x1aebf6;};'use strict';var _=require(_0x4a23('0x0'));var util=require('util');var logger=require(_0x4a23('0x1'))(_0x4a23('0x2'));var moment=require(_0x4a23('0x3'));var BPromise=require(_0x4a23('0x4'));var rp=require(_0x4a23('0x5'));var fs=require('fs');var path=require(_0x4a23('0x6'));var rimraf=require('rimraf');var config=require(_0x4a23('0x7'));var attributes=require(_0x4a23('0x8'));module[_0x4a23('0x9')]=function(_0x51cf86,_0x24ef58){return _0x51cf86[_0x4a23('0xa')](_0x4a23('0xb'),attributes,{'tableName':_0x4a23('0xc'),'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 496b2c0..b721c32 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 _0x12ae=['../../config/logger','rpc','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','raw','where','include','map','model','attributes','then','GetMailServerIn','catch','util','moment','../../mysqldb','../../config/utils'];(function(_0x30e949,_0x199032){var _0x848fb6=function(_0x5a0cc9){while(--_0x5a0cc9){_0x30e949['push'](_0x30e949['shift']());}};_0x848fb6(++_0x199032);}(_0x12ae,0x175));var _0xe12a=function(_0x5ea101,_0x3f034a){_0x5ea101=_0x5ea101-0x0;var _0x39d51f=_0x12ae[_0x5ea101];return _0x39d51f;};'use strict';var _=require('lodash');var util=require(_0xe12a('0x0'));var moment=require(_0xe12a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe12a('0x2'))['db'];var utils=require(_0xe12a('0x3'));var logger=require(_0xe12a('0x4'))(_0xe12a('0x5'));var config=require(_0xe12a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe12a('0x7')][_0xe12a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x296caf,_0x39a0d3,_0x234fa5){return new BPromise(function(_0x23503e,_0x15750a){return client['request'](_0x296caf,_0x234fa5)['then'](function(_0x457162){logger[_0xe12a('0x9')](_0xe12a('0xa'),_0x39a0d3,_0xe12a('0xb'));logger[_0xe12a('0xc')](_0xe12a('0xd'),_0x39a0d3,_0xe12a('0xb'),JSON[_0xe12a('0xe')](_0x457162));if(_0x457162[_0xe12a('0xf')]){if(_0x457162['error'][_0xe12a('0x10')]===0x1f4){logger[_0xe12a('0xf')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);return _0x15750a(_0x457162['error'][_0xe12a('0x11')]);}logger[_0xe12a('0xf')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);return _0x23503e(_0x457162[_0xe12a('0xf')][_0xe12a('0x11')]);}else{logger[_0xe12a('0x9')]('MailServerIn,\x20%s,\x20%s',_0x39a0d3,_0xe12a('0xb'));_0x23503e(_0x457162['result'][_0xe12a('0x11')]);}})['catch'](function(_0x3264b3){logger[_0xe12a('0xf')](_0xe12a('0xa'),_0x39a0d3,_0x3264b3);_0x15750a(_0x3264b3);});});}exports['GetMailServerIn']=function(_0x14b1e2){var _0x471bdd=this;return new Promise(function(_0xf6f1a6,_0x58ed7b){return db['MailServerIn'][_0xe12a('0x12')]({'raw':_0x14b1e2['options']?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x14')]===undefined?!![]:![]:!![],'where':_0x14b1e2[_0xe12a('0x13')]?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x15')]||null:null,'attributes':_0x14b1e2['options']?_0x14b1e2['options']['attributes']||null:null,'limit':_0x14b1e2[_0xe12a('0x13')]?_0x14b1e2[_0xe12a('0x13')]['limit']||null:null,'include':_0x14b1e2['options']?_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x14b1e2[_0xe12a('0x13')][_0xe12a('0x16')],function(_0x1f90b){return{'model':db[_0x1f90b[_0xe12a('0x18')]],'as':_0x1f90b['as'],'attributes':_0x1f90b[_0xe12a('0x19')],'include':_0x1f90b[_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x1f90b[_0xe12a('0x16')],function(_0x2dcadd){return{'model':db[_0x2dcadd[_0xe12a('0x18')]],'as':_0x2dcadd['as'],'attributes':_0x2dcadd[_0xe12a('0x19')],'include':_0x2dcadd[_0xe12a('0x16')]?_[_0xe12a('0x17')](_0x2dcadd['include'],function(_0x261c2d){return{'model':db[_0x261c2d[_0xe12a('0x18')]],'as':_0x261c2d['as'],'attributes':_0x261c2d[_0xe12a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe12a('0x1a')](function(_0x48c62e){logger[_0xe12a('0x9')]('GetMailServerIn',_0x14b1e2);logger['debug'](_0xe12a('0x1b'),_0x14b1e2,JSON['stringify'](_0x48c62e));_0xf6f1a6(_0x48c62e);})[_0xe12a('0x1c')](function(_0x2ad4d6){logger[_0xe12a('0xf')]('GetMailServerIn',_0x2ad4d6[_0xe12a('0x11')],_0x14b1e2);_0x58ed7b(_0x471bdd[_0xe12a('0xf')](0x1f4,_0x2ad4d6[_0xe12a('0x11')]));});});}; \ No newline at end of file +var _0x1120=['model','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw','attributes','include','map'];(function(_0x4bdd01,_0x2f5d03){var _0x38f327=function(_0x405b2e){while(--_0x405b2e){_0x4bdd01['push'](_0x4bdd01['shift']());}};_0x38f327(++_0x2f5d03);}(_0x1120,0x140));var _0x0112=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1120[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var moment=require(_0x0112('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(_0x0112('0x3'));var logger=require(_0x0112('0x4'))(_0x0112('0x5'));var config=require(_0x0112('0x6'));var jayson=require(_0x0112('0x7'));var client=jayson[_0x0112('0x8')][_0x0112('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ad0d,_0x31d67a,_0x444422){return new BPromise(function(_0x2fd18c,_0x1e87af){return client['request'](_0x40ad0d,_0x444422)[_0x0112('0xa')](function(_0x26fd2e){logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));logger[_0x0112('0xe')](_0x0112('0xf'),_0x31d67a,'request\x20sent',JSON[_0x0112('0x10')](_0x26fd2e));if(_0x26fd2e[_0x0112('0x11')]){if(_0x26fd2e[_0x0112('0x11')][_0x0112('0x12')]===0x1f4){logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e[_0x0112('0x11')][_0x0112('0x13')]);return _0x1e87af(_0x26fd2e[_0x0112('0x11')]['message']);}logger['error'](_0x0112('0xc'),_0x31d67a,_0x26fd2e['error'][_0x0112('0x13')]);return _0x2fd18c(_0x26fd2e['error'][_0x0112('0x13')]);}else{logger[_0x0112('0xb')](_0x0112('0xc'),_0x31d67a,_0x0112('0xd'));_0x2fd18c(_0x26fd2e['result'][_0x0112('0x13')]);}})[_0x0112('0x14')](function(_0x5ef9fe){logger['error']('MailServerIn,\x20%s,\x20%s',_0x31d67a,_0x5ef9fe);_0x1e87af(_0x5ef9fe);});});}exports[_0x0112('0x15')]=function(_0x58f0ed){var _0x5c2236=this;return new Promise(function(_0x4e34c1,_0x19f10e){return db[_0x0112('0x16')]['findAll']({'raw':_0x58f0ed['options']?_0x58f0ed[_0x0112('0x17')][_0x0112('0x18')]===undefined?!![]:![]:!![],'where':_0x58f0ed['options']?_0x58f0ed[_0x0112('0x17')]['where']||null:null,'attributes':_0x58f0ed['options']?_0x58f0ed['options'][_0x0112('0x19')]||null:null,'limit':_0x58f0ed[_0x0112('0x17')]?_0x58f0ed[_0x0112('0x17')]['limit']||null:null,'include':_0x58f0ed[_0x0112('0x17')]?_0x58f0ed[_0x0112('0x17')][_0x0112('0x1a')]?_[_0x0112('0x1b')](_0x58f0ed['options'][_0x0112('0x1a')],function(_0x408bb8){return{'model':db[_0x408bb8[_0x0112('0x1c')]],'as':_0x408bb8['as'],'attributes':_0x408bb8[_0x0112('0x19')],'include':_0x408bb8['include']?_[_0x0112('0x1b')](_0x408bb8['include'],function(_0x58ea13){return{'model':db[_0x58ea13[_0x0112('0x1c')]],'as':_0x58ea13['as'],'attributes':_0x58ea13['attributes'],'include':_0x58ea13[_0x0112('0x1a')]?_['map'](_0x58ea13[_0x0112('0x1a')],function(_0x58e5){return{'model':db[_0x58e5[_0x0112('0x1c')]],'as':_0x58e5['as'],'attributes':_0x58e5[_0x0112('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0112('0xa')](function(_0x11bd7f){logger[_0x0112('0xb')](_0x0112('0x15'),_0x58f0ed);logger[_0x0112('0xe')](_0x0112('0x15'),_0x58f0ed,JSON[_0x0112('0x10')](_0x11bd7f));_0x4e34c1(_0x11bd7f);})['catch'](function(_0x6d44bb){logger['error'](_0x0112('0x15'),_0x6d44bb[_0x0112('0x13')],_0x58f0ed);_0x19f10e(_0x5c2236[_0x0112('0x11')](0x1f4,_0x6d44bb['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 355a527..97b6e5b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x2dcaa7,_0x1d41e5){_0x2dcaa7=_0x2dcaa7-0x0;var _0x3925fe=_0x7a54[_0x2dcaa7];return _0x3925fe;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 60d7763..21e428d 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 _0xb9be=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5ad59d,_0xc93a6){var _0x3486c2=function(_0x15e565){while(--_0x15e565){_0x5ad59d['push'](_0x5ad59d['shift']());}};_0x3486c2(++_0xc93a6);}(_0xb9be,0xc5));var _0xeb9b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb9be[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'description':{'type':Sequelize[_0xeb9b('0x2')]},'host':{'type':Sequelize[_0xeb9b('0x2')]},'user':{'type':Sequelize[_0xeb9b('0x2')]},'pass':{'type':Sequelize[_0xeb9b('0x2')]},'port':{'type':Sequelize[_0xeb9b('0x3')]},'secure':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb9b('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3f8c=['STRING'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4ce64c,_0x57440e){_0x4ce64c=_0x4ce64c-0x0;var _0x288c66=_0x3f8c[_0x4ce64c];return _0x288c66;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc3f8('0x0')]},'host':{'type':Sequelize[_0xc3f8('0x0')]},'user':{'type':Sequelize[_0xc3f8('0x0')]},'pass':{'type':Sequelize[_0xc3f8('0x0')]},'port':{'type':Sequelize['INTEGER']},'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 b50c000..5aec45c 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 _0x4c07=['rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailServerOut','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','filter','merge','where','includeAll','include','findAll'];(function(_0x5673c4,_0x5b672d){var _0x32b859=function(_0x4aa620){while(--_0x4aa620){_0x5673c4['push'](_0x5673c4['shift']());}};_0x32b859(++_0x5b672d);}(_0x4c07,0x9f));var _0x74c0=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x4c07[_0x1deb72];return _0x18bbdf;};'use strict';var emlformat=require(_0x74c0('0x0'));var rimraf=require(_0x74c0('0x1'));var zipdir=require(_0x74c0('0x2'));var jsonpatch=require(_0x74c0('0x3'));var rp=require(_0x74c0('0x4'));var moment=require(_0x74c0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74c0('0x6'));var util=require(_0x74c0('0x7'));var path=require(_0x74c0('0x8'));var sox=require(_0x74c0('0x9'));var csv=require(_0x74c0('0xa'));var ejs=require(_0x74c0('0xb'));var fs=require('fs');var fs_extra=require(_0x74c0('0xc'));var _=require(_0x74c0('0xd'));var squel=require(_0x74c0('0xe'));var crypto=require(_0x74c0('0xf'));var jsforce=require(_0x74c0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74c0('0x11'));var Papa=require(_0x74c0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x74c0('0x13'));var as=require(_0x74c0('0x14'));var hardwareService=require(_0x74c0('0x15'));var logger=require(_0x74c0('0x16'))(_0x74c0('0x17'));var utils=require(_0x74c0('0x18'));var config=require(_0x74c0('0x19'));var licenseUtil=require(_0x74c0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ea341,_0x1585f3){_0x1585f3=_0x1585f3||0xcc;return function(_0x908ce6){if(_0x908ce6){return _0x2ea341[_0x74c0('0x1b')](_0x1585f3);}return _0x2ea341[_0x74c0('0x1c')](_0x1585f3)[_0x74c0('0x1d')]();};}function respondWithResult(_0x3a5899,_0xc293ee){_0xc293ee=_0xc293ee||0xc8;return function(_0x2579d2){if(_0x2579d2){return _0x3a5899[_0x74c0('0x1c')](_0xc293ee)[_0x74c0('0x1e')](_0x2579d2);}};}function respondWithFilteredResult(_0x2c3e27,_0x6ad583){return function(_0x1e537b){if(_0x1e537b){var _0x25bc65=typeof _0x6ad583[_0x74c0('0x1f')]==='undefined'&&typeof _0x6ad583['limit']==='undefined';var _0x25f4d9=_0x1e537b[_0x74c0('0x20')];var _0x3b4b06=_0x25bc65?0x0:_0x6ad583[_0x74c0('0x1f')];var _0x2ab78f=_0x25bc65?_0x1e537b[_0x74c0('0x20')]:_0x6ad583[_0x74c0('0x1f')]+_0x6ad583['limit'];var _0x3061cc;if(_0x2ab78f>=_0x25f4d9){_0x2ab78f=_0x25f4d9;_0x3061cc=0xc8;}else{_0x3061cc=0xce;}_0x2c3e27['status'](_0x3061cc);return _0x2c3e27['set'](_0x74c0('0x21'),_0x3b4b06+'-'+_0x2ab78f+'/'+_0x25f4d9)['json'](_0x1e537b);}return null;};}function patchUpdates(_0x1568cf){return function(_0x1e8d45){try{jsonpatch[_0x74c0('0x22')](_0x1e8d45,_0x1568cf,!![]);}catch(_0x529eac){return BPromise[_0x74c0('0x23')](_0x529eac);}return _0x1e8d45[_0x74c0('0x24')]();};}function saveUpdates(_0x438bd8,_0x364782){return function(_0x18a245){if(_0x18a245){return _0x18a245[_0x74c0('0x25')](_0x438bd8)[_0x74c0('0x26')](function(_0x24f149){return _0x24f149;});}return null;};}function removeEntity(_0x3de127,_0x293468){return function(_0x2b9b8f){if(_0x2b9b8f){return _0x2b9b8f[_0x74c0('0x27')]()['then'](function(){_0x3de127[_0x74c0('0x1c')](0xcc)[_0x74c0('0x1d')]();});}};}function handleEntityNotFound(_0x38e1dd,_0x514be5){return function(_0x493b5a){if(!_0x493b5a){_0x38e1dd[_0x74c0('0x1b')](0x194);}return _0x493b5a;};}function handleError(_0x2d7de5,_0x460d86){_0x460d86=_0x460d86||0x1f4;return function(_0x4c88fc){logger[_0x74c0('0x28')](_0x4c88fc[_0x74c0('0x29')]);if(_0x4c88fc['name']){delete _0x4c88fc[_0x74c0('0x2a')];}_0x2d7de5[_0x74c0('0x1c')](_0x460d86)[_0x74c0('0x2b')](_0x4c88fc);};}exports['index']=function(_0x3eef80,_0x6ef903){var _0x32cd5c={},_0x12d6a8={},_0x3fc8c7={'count':0x0,'rows':[]};var _0x1170c6=_[_0x74c0('0x2c')](db[_0x74c0('0x2d')][_0x74c0('0x2e')],function(_0xc76ed4){return{'name':_0xc76ed4['fieldName'],'type':_0xc76ed4[_0x74c0('0x2f')][_0x74c0('0x30')]};});_0x12d6a8[_0x74c0('0x31')]=_[_0x74c0('0x2c')](_0x1170c6,_0x74c0('0x2a'));_0x12d6a8[_0x74c0('0x32')]=_['keys'](_0x3eef80[_0x74c0('0x32')]);_0x12d6a8['filters']=_[_0x74c0('0x33')](_0x12d6a8['model'],_0x12d6a8[_0x74c0('0x32')]);_0x32cd5c[_0x74c0('0x34')]=_[_0x74c0('0x33')](_0x12d6a8[_0x74c0('0x31')],qs[_0x74c0('0x35')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x35')]));_0x32cd5c[_0x74c0('0x34')]=_0x32cd5c['attributes'][_0x74c0('0x36')]?_0x32cd5c['attributes']:_0x12d6a8[_0x74c0('0x31')];if(!_0x3eef80['query']['hasOwnProperty'](_0x74c0('0x37'))){_0x32cd5c[_0x74c0('0x38')]=qs[_0x74c0('0x38')](_0x3eef80['query'][_0x74c0('0x38')]);_0x32cd5c[_0x74c0('0x1f')]=qs[_0x74c0('0x1f')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x1f')]);}_0x32cd5c[_0x74c0('0x39')]=qs[_0x74c0('0x3a')](_0x3eef80[_0x74c0('0x32')][_0x74c0('0x3a')]);_0x32cd5c['where']=qs[_0x74c0('0x3b')](_['pick'](_0x3eef80[_0x74c0('0x32')],_0x12d6a8[_0x74c0('0x3b')]),_0x1170c6);if(_0x3eef80['query'][_0x74c0('0x3c')]){_0x32cd5c['where']=_[_0x74c0('0x3d')](_0x32cd5c[_0x74c0('0x3e')],{'$or':_[_0x74c0('0x2c')](_0x1170c6,function(_0x3c664f){if(_0x3c664f[_0x74c0('0x2f')]!=='VIRTUAL'){var _0x353eac={};_0x353eac[_0x3c664f[_0x74c0('0x2a')]]={'$like':'%'+_0x3eef80[_0x74c0('0x32')][_0x74c0('0x3c')]+'%'};return _0x353eac;}})});}_0x32cd5c=_['merge']({},_0x32cd5c,_0x3eef80['options']);var _0x1edf47={'where':_0x32cd5c[_0x74c0('0x3e')]};return db[_0x74c0('0x2d')][_0x74c0('0x20')](_0x1edf47)[_0x74c0('0x26')](function(_0x2b80d0){_0x3fc8c7[_0x74c0('0x20')]=_0x2b80d0;if(_0x3eef80['query'][_0x74c0('0x3f')]){_0x32cd5c[_0x74c0('0x40')]=[{'all':!![]}];}return db[_0x74c0('0x2d')][_0x74c0('0x41')](_0x32cd5c);})[_0x74c0('0x26')](function(_0x53ef9a){_0x3fc8c7[_0x74c0('0x42')]=_0x53ef9a;return _0x3fc8c7;})[_0x74c0('0x26')](respondWithFilteredResult(_0x6ef903,_0x32cd5c))[_0x74c0('0x43')](handleError(_0x6ef903,null));};exports[_0x74c0('0x44')]=function(_0x4a3400,_0x1e3d57){var _0x31adfc={'raw':!![],'where':{'id':_0x4a3400['params']['id']}},_0x5aecbf={};_0x5aecbf[_0x74c0('0x31')]=_[_0x74c0('0x45')](db[_0x74c0('0x2d')]['rawAttributes']);_0x5aecbf['query']=_[_0x74c0('0x45')](_0x4a3400[_0x74c0('0x32')]);_0x5aecbf[_0x74c0('0x3b')]=_['intersection'](_0x5aecbf[_0x74c0('0x31')],_0x5aecbf[_0x74c0('0x32')]);_0x31adfc['attributes']=_[_0x74c0('0x33')](_0x5aecbf['model'],qs[_0x74c0('0x35')](_0x4a3400['query'][_0x74c0('0x35')]));_0x31adfc[_0x74c0('0x34')]=_0x31adfc['attributes'][_0x74c0('0x36')]?_0x31adfc[_0x74c0('0x34')]:_0x5aecbf[_0x74c0('0x31')];if(_0x4a3400[_0x74c0('0x32')][_0x74c0('0x3f')]){_0x31adfc[_0x74c0('0x40')]=[{'all':!![]}];}_0x31adfc=_['merge']({},_0x31adfc,_0x4a3400[_0x74c0('0x46')]);return db['MailServerOut'][_0x74c0('0x47')](_0x31adfc)[_0x74c0('0x26')](handleEntityNotFound(_0x1e3d57,null))[_0x74c0('0x26')](respondWithResult(_0x1e3d57,null))[_0x74c0('0x43')](handleError(_0x1e3d57,null));};exports[_0x74c0('0x48')]=function(_0x205c46,_0x3826b9){return db[_0x74c0('0x2d')]['create'](_0x205c46[_0x74c0('0x49')],{})[_0x74c0('0x26')](respondWithResult(_0x3826b9,0xc9))['catch'](handleError(_0x3826b9,null));};exports[_0x74c0('0x25')]=function(_0xb233ac,_0x4de9d2){if(_0xb233ac[_0x74c0('0x49')]['id']){delete _0xb233ac[_0x74c0('0x49')]['id'];}return db[_0x74c0('0x2d')][_0x74c0('0x47')]({'where':{'id':_0xb233ac[_0x74c0('0x4a')]['id']}})[_0x74c0('0x26')](handleEntityNotFound(_0x4de9d2,null))[_0x74c0('0x26')](saveUpdates(_0xb233ac['body'],null))['then'](respondWithResult(_0x4de9d2,null))[_0x74c0('0x43')](handleError(_0x4de9d2,null));};exports[_0x74c0('0x27')]=function(_0x28d022,_0x2a73bd){return db['MailServerOut'][_0x74c0('0x47')]({'where':{'id':_0x28d022[_0x74c0('0x4a')]['id']}})[_0x74c0('0x26')](handleEntityNotFound(_0x2a73bd,null))[_0x74c0('0x26')](removeEntity(_0x2a73bd,null))[_0x74c0('0x43')](handleError(_0x2a73bd,null));}; \ No newline at end of file +var _0x4a79=['catch','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','MailServerOut','includeAll','findAll','rows'];(function(_0x1eb9ac,_0x5cd854){var _0x5325c7=function(_0x1daa68){while(--_0x1daa68){_0x1eb9ac['push'](_0x1eb9ac['shift']());}};_0x5325c7(++_0x5cd854);}(_0x4a79,0x9b));var _0x94a7=function(_0x288efd,_0x86ff6b){_0x288efd=_0x288efd-0x0;var _0x7466bb=_0x4a79[_0x288efd];return _0x7466bb;};'use strict';var emlformat=require(_0x94a7('0x0'));var rimraf=require(_0x94a7('0x1'));var zipdir=require(_0x94a7('0x2'));var jsonpatch=require(_0x94a7('0x3'));var rp=require(_0x94a7('0x4'));var moment=require(_0x94a7('0x5'));var BPromise=require(_0x94a7('0x6'));var Mustache=require('mustache');var util=require(_0x94a7('0x7'));var path=require(_0x94a7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x94a7('0x9'));var fs=require('fs');var fs_extra=require(_0x94a7('0xa'));var _=require(_0x94a7('0xb'));var squel=require(_0x94a7('0xc'));var crypto=require(_0x94a7('0xd'));var jsforce=require(_0x94a7('0xe'));var deskjs=require(_0x94a7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x94a7('0x10'));var Papa=require('papaparse');var Redis=require(_0x94a7('0x11'));var authService=require(_0x94a7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x94a7('0x13'));var hardwareService=require(_0x94a7('0x14'));var logger=require(_0x94a7('0x15'))(_0x94a7('0x16'));var utils=require(_0x94a7('0x17'));var config=require(_0x94a7('0x18'));var licenseUtil=require(_0x94a7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7a1d,_0x489783){_0x489783=_0x489783||0xcc;return function(_0x1d8979){if(_0x1d8979){return _0x1d7a1d[_0x94a7('0x1a')](_0x489783);}return _0x1d7a1d['status'](_0x489783)[_0x94a7('0x1b')]();};}function respondWithResult(_0x5e7c16,_0x1c6447){_0x1c6447=_0x1c6447||0xc8;return function(_0x414199){if(_0x414199){return _0x5e7c16[_0x94a7('0x1c')](_0x1c6447)[_0x94a7('0x1d')](_0x414199);}};}function respondWithFilteredResult(_0x1666ef,_0x13ac73){return function(_0x3c2d50){if(_0x3c2d50){var _0x50b315=typeof _0x13ac73[_0x94a7('0x1e')]===_0x94a7('0x1f')&&typeof _0x13ac73['limit']==='undefined';var _0x2c46c6=_0x3c2d50[_0x94a7('0x20')];var _0x3a98bb=_0x50b315?0x0:_0x13ac73[_0x94a7('0x1e')];var _0x1ea4b5=_0x50b315?_0x3c2d50[_0x94a7('0x20')]:_0x13ac73[_0x94a7('0x1e')]+_0x13ac73['limit'];var _0x442f58;if(_0x1ea4b5>=_0x2c46c6){_0x1ea4b5=_0x2c46c6;_0x442f58=0xc8;}else{_0x442f58=0xce;}_0x1666ef['status'](_0x442f58);return _0x1666ef[_0x94a7('0x21')](_0x94a7('0x22'),_0x3a98bb+'-'+_0x1ea4b5+'/'+_0x2c46c6)[_0x94a7('0x1d')](_0x3c2d50);}return null;};}function patchUpdates(_0xc8ea04){return function(_0x4f1ac8){try{jsonpatch['apply'](_0x4f1ac8,_0xc8ea04,!![]);}catch(_0x170f16){return BPromise[_0x94a7('0x23')](_0x170f16);}return _0x4f1ac8['save']();};}function saveUpdates(_0x444511,_0x3a38ab){return function(_0x41d984){if(_0x41d984){return _0x41d984[_0x94a7('0x24')](_0x444511)[_0x94a7('0x25')](function(_0x2e61d2){return _0x2e61d2;});}return null;};}function removeEntity(_0x104d1b,_0x4d70ee){return function(_0x4691ee){if(_0x4691ee){return _0x4691ee[_0x94a7('0x26')]()['then'](function(){_0x104d1b[_0x94a7('0x1c')](0xcc)[_0x94a7('0x1b')]();});}};}function handleEntityNotFound(_0x29b848,_0x5d6885){return function(_0x3249a1){if(!_0x3249a1){_0x29b848['sendStatus'](0x194);}return _0x3249a1;};}function handleError(_0x73c3fb,_0x4d2268){_0x4d2268=_0x4d2268||0x1f4;return function(_0x2190d0){logger['error'](_0x2190d0['stack']);if(_0x2190d0['name']){delete _0x2190d0[_0x94a7('0x27')];}_0x73c3fb['status'](_0x4d2268)[_0x94a7('0x28')](_0x2190d0);};}exports[_0x94a7('0x29')]=function(_0x2b9612,_0x46516f){var _0x3a6787={},_0x366b58={},_0x56b8c4={'count':0x0,'rows':[]};var _0x12bcf7=_[_0x94a7('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x5ae4c6){return{'name':_0x5ae4c6[_0x94a7('0x2b')],'type':_0x5ae4c6[_0x94a7('0x2c')][_0x94a7('0x2d')]};});_0x366b58['model']=_[_0x94a7('0x2a')](_0x12bcf7,'name');_0x366b58[_0x94a7('0x2e')]=_[_0x94a7('0x2f')](_0x2b9612[_0x94a7('0x2e')]);_0x366b58[_0x94a7('0x30')]=_[_0x94a7('0x31')](_0x366b58[_0x94a7('0x32')],_0x366b58[_0x94a7('0x2e')]);_0x3a6787[_0x94a7('0x33')]=_[_0x94a7('0x31')](_0x366b58[_0x94a7('0x32')],qs[_0x94a7('0x34')](_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x34')]));_0x3a6787['attributes']=_0x3a6787[_0x94a7('0x33')][_0x94a7('0x35')]?_0x3a6787[_0x94a7('0x33')]:_0x366b58['model'];if(!_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x36')](_0x94a7('0x37'))){_0x3a6787['limit']=qs[_0x94a7('0x38')](_0x2b9612[_0x94a7('0x2e')]['limit']);_0x3a6787[_0x94a7('0x1e')]=qs[_0x94a7('0x1e')](_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x1e')]);}_0x3a6787['order']=qs[_0x94a7('0x39')](_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x39')]);_0x3a6787[_0x94a7('0x3a')]=qs[_0x94a7('0x30')](_['pick'](_0x2b9612['query'],_0x366b58[_0x94a7('0x30')]),_0x12bcf7);if(_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x3b')]){_0x3a6787[_0x94a7('0x3a')]=_[_0x94a7('0x3c')](_0x3a6787[_0x94a7('0x3a')],{'$or':_[_0x94a7('0x2a')](_0x12bcf7,function(_0x4db2e3){if(_0x4db2e3[_0x94a7('0x2c')]!==_0x94a7('0x3d')){var _0x1f92ed={};_0x1f92ed[_0x4db2e3[_0x94a7('0x27')]]={'$like':'%'+_0x2b9612['query'][_0x94a7('0x3b')]+'%'};return _0x1f92ed;}})});}_0x3a6787=_['merge']({},_0x3a6787,_0x2b9612[_0x94a7('0x3e')]);var _0x27afc4={'where':_0x3a6787[_0x94a7('0x3a')]};return db[_0x94a7('0x3f')][_0x94a7('0x20')](_0x27afc4)[_0x94a7('0x25')](function(_0x2eb84c){_0x56b8c4[_0x94a7('0x20')]=_0x2eb84c;if(_0x2b9612[_0x94a7('0x2e')][_0x94a7('0x40')]){_0x3a6787['include']=[{'all':!![]}];}return db[_0x94a7('0x3f')][_0x94a7('0x41')](_0x3a6787);})['then'](function(_0x46e27a){_0x56b8c4[_0x94a7('0x42')]=_0x46e27a;return _0x56b8c4;})[_0x94a7('0x25')](respondWithFilteredResult(_0x46516f,_0x3a6787))[_0x94a7('0x43')](handleError(_0x46516f,null));};exports['show']=function(_0x145b42,_0x41ecf0){var _0x17e7f5={'raw':!![],'where':{'id':_0x145b42[_0x94a7('0x44')]['id']}},_0x3872dc={};_0x3872dc[_0x94a7('0x32')]=_['keys'](db[_0x94a7('0x3f')][_0x94a7('0x45')]);_0x3872dc[_0x94a7('0x2e')]=_[_0x94a7('0x2f')](_0x145b42[_0x94a7('0x2e')]);_0x3872dc[_0x94a7('0x30')]=_[_0x94a7('0x31')](_0x3872dc[_0x94a7('0x32')],_0x3872dc[_0x94a7('0x2e')]);_0x17e7f5[_0x94a7('0x33')]=_[_0x94a7('0x31')](_0x3872dc[_0x94a7('0x32')],qs[_0x94a7('0x34')](_0x145b42[_0x94a7('0x2e')][_0x94a7('0x34')]));_0x17e7f5[_0x94a7('0x33')]=_0x17e7f5['attributes'][_0x94a7('0x35')]?_0x17e7f5[_0x94a7('0x33')]:_0x3872dc[_0x94a7('0x32')];if(_0x145b42[_0x94a7('0x2e')][_0x94a7('0x40')]){_0x17e7f5[_0x94a7('0x46')]=[{'all':!![]}];}_0x17e7f5=_[_0x94a7('0x3c')]({},_0x17e7f5,_0x145b42[_0x94a7('0x3e')]);return db[_0x94a7('0x3f')][_0x94a7('0x47')](_0x17e7f5)['then'](handleEntityNotFound(_0x41ecf0,null))['then'](respondWithResult(_0x41ecf0,null))[_0x94a7('0x43')](handleError(_0x41ecf0,null));};exports[_0x94a7('0x48')]=function(_0x14f428,_0x112f47){return db[_0x94a7('0x3f')][_0x94a7('0x48')](_0x14f428[_0x94a7('0x49')],{})[_0x94a7('0x25')](respondWithResult(_0x112f47,0xc9))['catch'](handleError(_0x112f47,null));};exports[_0x94a7('0x24')]=function(_0x39dd5d,_0xbd8690){if(_0x39dd5d['body']['id']){delete _0x39dd5d[_0x94a7('0x49')]['id'];}return db[_0x94a7('0x3f')][_0x94a7('0x47')]({'where':{'id':_0x39dd5d['params']['id']}})['then'](handleEntityNotFound(_0xbd8690,null))['then'](saveUpdates(_0x39dd5d[_0x94a7('0x49')],null))['then'](respondWithResult(_0xbd8690,null))[_0x94a7('0x43')](handleError(_0xbd8690,null));};exports[_0x94a7('0x26')]=function(_0x77a1cb,_0x5758dc){return db['MailServerOut']['find']({'where':{'id':_0x77a1cb['params']['id']}})['then'](handleEntityNotFound(_0x5758dc,null))['then'](removeEntity(_0x5758dc,null))[_0x94a7('0x43')](handleError(_0x5758dc,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d081155..7e94b2b 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 _0xed6b=['mail_servers_out','lodash','../../config/logger','api','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1ca6f4,_0x4c7904){var _0x4acc04=function(_0x4ebbbf){while(--_0x4ebbbf){_0x1ca6f4['push'](_0x1ca6f4['shift']());}};_0x4acc04(++_0x4c7904);}(_0xed6b,0x90));var _0xbed6=function(_0x399ed2,_0x29b5e8){_0x399ed2=_0x399ed2-0x0;var _0x266fd9=_0xed6b[_0x399ed2];return _0x266fd9;};'use strict';var _=require(_0xbed6('0x0'));var util=require('util');var logger=require(_0xbed6('0x1'))(_0xbed6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbed6('0x3'));var rimraf=require(_0xbed6('0x4'));var config=require(_0xbed6('0x5'));var attributes=require(_0xbed6('0x6'));module[_0xbed6('0x7')]=function(_0x28feb8,_0x4badf3){return _0x28feb8[_0xbed6('0x8')](_0xbed6('0x9'),attributes,{'tableName':_0xbed6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ac7=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2ac7,0x149));var _0x72ac=function(_0x586bf9,_0x570f7d){_0x586bf9=_0x586bf9-0x0;var _0x143436=_0x2ac7[_0x586bf9];return _0x143436;};'use strict';var _=require(_0x72ac('0x0'));var util=require(_0x72ac('0x1'));var logger=require('../../config/logger')(_0x72ac('0x2'));var moment=require(_0x72ac('0x3'));var BPromise=require(_0x72ac('0x4'));var rp=require(_0x72ac('0x5'));var fs=require('fs');var path=require(_0x72ac('0x6'));var rimraf=require(_0x72ac('0x7'));var config=require(_0x72ac('0x8'));var attributes=require(_0x72ac('0x9'));module[_0x72ac('0xa')]=function(_0x1f5874,_0x3bbd0f){return _0x1f5874[_0x72ac('0xb')](_0x72ac('0xc'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 278d3fa..ee4cb6f 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5a7188,_0x2ec5ad){var _0x805ef=function(_0x2dfeba){while(--_0x2dfeba){_0x5a7188['push'](_0x5a7188['shift']());}};_0x805ef(++_0x2ec5ad);}(_0xadb5,0xad));var _0x5adb=function(_0x191ca1,_0x2f48a9){_0x191ca1=_0x191ca1-0x0;var _0x4682ea=_0xadb5[_0x191ca1];return _0x4682ea;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x567a49,_0x2717e2){var _0x3a8433=function(_0x582da2){while(--_0x582da2){_0x567a49['push'](_0x567a49['shift']());}};_0x3a8433(++_0x2717e2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27fdb6,_0x3b4b68){_0x27fdb6=_0x27fdb6-0x0;var _0x2f2f31=_0x5f2f[_0x27fdb6];return _0x2f2f31;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ea61a79..40c4797 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 _0xf1a4=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x504c5d,_0x27a75a){var _0x4d1821=function(_0x558ffe){while(--_0x558ffe){_0x504c5d['push'](_0x504c5d['shift']());}};_0x4d1821(++_0x27a75a);}(_0xf1a4,0x109));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4f1a('0x0'));var util=require(_0x4f1a('0x1'));var path=require(_0x4f1a('0x2'));var timeout=require(_0x4f1a('0x3'));var express=require(_0x4f1a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4f1a('0x5'));var config=require(_0x4f1a('0x6'));var controller=require(_0x4f1a('0x7'));router[_0x4f1a('0x8')]('/',auth['isAuthenticated'](),controller[_0x4f1a('0x9')]);router[_0x4f1a('0x8')]('/describe',auth[_0x4f1a('0xa')](),controller[_0x4f1a('0xb')]);router[_0x4f1a('0x8')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0xd')]);router[_0x4f1a('0xe')]('/',auth[_0x4f1a('0xa')](),controller['create']);router[_0x4f1a('0xf')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0x10')]);router[_0x4f1a('0x11')](_0x4f1a('0xc'),auth[_0x4f1a('0xa')](),controller[_0x4f1a('0x12')]);module[_0x4f1a('0x13')]=router; \ No newline at end of file +var _0xe925=['isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe'];(function(_0x3d68ed,_0x542fde){var _0x5bad0b=function(_0x4153a7){while(--_0x4153a7){_0x3d68ed['push'](_0x3d68ed['shift']());}};_0x5bad0b(++_0x542fde);}(_0xe925,0x8d));var _0x5e92=function(_0xdf1399,_0x1f5502){_0xdf1399=_0xdf1399-0x0;var _0xa3cdd3=_0xe925[_0xdf1399];return _0xa3cdd3;};'use strict';var multer=require('multer');var util=require(_0x5e92('0x0'));var path=require(_0x5e92('0x1'));var timeout=require(_0x5e92('0x2'));var express=require(_0x5e92('0x3'));var router=express[_0x5e92('0x4')]();var fs_extra=require(_0x5e92('0x5'));var auth=require(_0x5e92('0x6'));var interaction=require(_0x5e92('0x7'));var config=require(_0x5e92('0x8'));var controller=require(_0x5e92('0x9'));router[_0x5e92('0xa')]('/',auth['isAuthenticated'](),controller[_0x5e92('0xb')]);router['get'](_0x5e92('0xc'),auth[_0x5e92('0xd')](),controller[_0x5e92('0xe')]);router['get'](_0x5e92('0xf'),auth['isAuthenticated'](),controller[_0x5e92('0x10')]);router[_0x5e92('0x11')]('/',auth[_0x5e92('0xd')](),controller[_0x5e92('0x12')]);router['put'](_0x5e92('0xf'),auth[_0x5e92('0xd')](),controller['update']);router[_0x5e92('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5e92('0x14')]);module[_0x5e92('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4184ca5..7bb811d 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 _0x5496=['name','sequelize','exports','STRING'];(function(_0x3f8392,_0x4e9d02){var _0x1086af=function(_0x54574e){while(--_0x54574e){_0x3f8392['push'](_0x3f8392['shift']());}};_0x1086af(++_0x4e9d02);}(_0x5496,0x175));var _0x6549=function(_0x58d5d4,_0x218511){_0x58d5d4=_0x58d5d4-0x0;var _0x20d06a=_0x5496[_0x58d5d4];return _0x20d06a;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'unique':_0x6549('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6549('0x2')]}}; \ No newline at end of file +var _0xbfe8=['exports','name','STRING'];(function(_0x444c5a,_0x245377){var _0x5dde98=function(_0x2a4dbd){while(--_0x2a4dbd){_0x444c5a['push'](_0x444c5a['shift']());}};_0x5dde98(++_0x245377);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x6933d0,_0x48d236){_0x6933d0=_0x6933d0-0x0;var _0x24c883=_0xbfe8[_0x6933d0];return _0x24c883;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8bfe('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8bfe('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index eed65ad..47bf45f 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 _0xc3f9=['crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x14fcf5,_0x507d9d){var _0x335eb9=function(_0x1ebd4c){while(--_0x1ebd4c){_0x14fcf5['push'](_0x14fcf5['shift']());}};_0x335eb9(++_0x507d9d);}(_0xc3f9,0x1f1));var _0x9c3f=function(_0x51c141,_0x361d7d){_0x51c141=_0x51c141-0x0;var _0x420a0f=_0xc3f9[_0x51c141];return _0x420a0f;};'use strict';var emlformat=require(_0x9c3f('0x0'));var rimraf=require(_0x9c3f('0x1'));var zipdir=require(_0x9c3f('0x2'));var jsonpatch=require(_0x9c3f('0x3'));var rp=require(_0x9c3f('0x4'));var moment=require(_0x9c3f('0x5'));var BPromise=require(_0x9c3f('0x6'));var Mustache=require(_0x9c3f('0x7'));var util=require(_0x9c3f('0x8'));var path=require(_0x9c3f('0x9'));var sox=require(_0x9c3f('0xa'));var csv=require(_0x9c3f('0xb'));var ejs=require(_0x9c3f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c3f('0xd'));var squel=require('squel');var crypto=require(_0x9c3f('0xe'));var jsforce=require(_0x9c3f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c3f('0x10'));var Redis=require('ioredis');var authService=require(_0x9c3f('0x11'));var qs=require(_0x9c3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c3f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c3f('0x14'))['db'];function respondWithStatusCode(_0xf97655,_0x307773){_0x307773=_0x307773||0xcc;return function(_0x24486c){if(_0x24486c){return _0xf97655[_0x9c3f('0x15')](_0x307773);}return _0xf97655['status'](_0x307773)[_0x9c3f('0x16')]();};}function respondWithResult(_0x2c65a8,_0x112f9f){_0x112f9f=_0x112f9f||0xc8;return function(_0x31fab9){if(_0x31fab9){return _0x2c65a8[_0x9c3f('0x17')](_0x112f9f)[_0x9c3f('0x18')](_0x31fab9);}};}function respondWithFilteredResult(_0x3f1b69,_0x2dfb79){return function(_0x286469){if(_0x286469){var _0x32d5fd=typeof _0x2dfb79[_0x9c3f('0x19')]===_0x9c3f('0x1a')&&typeof _0x2dfb79['limit']===_0x9c3f('0x1a');var _0x16ecdc=_0x286469[_0x9c3f('0x1b')];var _0x3186f1=_0x32d5fd?0x0:_0x2dfb79[_0x9c3f('0x19')];var _0x44f6c7=_0x32d5fd?_0x286469['count']:_0x2dfb79[_0x9c3f('0x19')]+_0x2dfb79[_0x9c3f('0x1c')];var _0x577e12;if(_0x44f6c7>=_0x16ecdc){_0x44f6c7=_0x16ecdc;_0x577e12=0xc8;}else{_0x577e12=0xce;}_0x3f1b69['status'](_0x577e12);return _0x3f1b69[_0x9c3f('0x1d')](_0x9c3f('0x1e'),_0x3186f1+'-'+_0x44f6c7+'/'+_0x16ecdc)[_0x9c3f('0x18')](_0x286469);}return null;};}function patchUpdates(_0x24a05e){return function(_0x176620){try{jsonpatch[_0x9c3f('0x1f')](_0x176620,_0x24a05e,!![]);}catch(_0x4b1598){return BPromise[_0x9c3f('0x20')](_0x4b1598);}return _0x176620[_0x9c3f('0x21')]();};}function saveUpdates(_0x535c3b,_0x544234){return function(_0x38ee77){if(_0x38ee77){return _0x38ee77[_0x9c3f('0x22')](_0x535c3b)['then'](function(_0x570587){return _0x570587;});}return null;};}function removeEntity(_0x33b04c,_0x3fc0bd){return function(_0x4e4ddb){if(_0x4e4ddb){return _0x4e4ddb['destroy']()[_0x9c3f('0x23')](function(){_0x33b04c[_0x9c3f('0x17')](0xcc)[_0x9c3f('0x16')]();});}};}function handleEntityNotFound(_0x9876b2,_0xc9463a){return function(_0x137a2c){if(!_0x137a2c){_0x9876b2['sendStatus'](0x194);}return _0x137a2c;};}function handleError(_0x13b76f,_0x16b9cf){_0x16b9cf=_0x16b9cf||0x1f4;return function(_0x50d044){logger['error'](_0x50d044[_0x9c3f('0x24')]);if(_0x50d044[_0x9c3f('0x25')]){delete _0x50d044[_0x9c3f('0x25')];}_0x13b76f[_0x9c3f('0x17')](_0x16b9cf)[_0x9c3f('0x26')](_0x50d044);};}exports[_0x9c3f('0x27')]=function(_0x563b7e,_0x29387a){var _0x15096b={},_0x1835e0={},_0x2285e5={'count':0x0,'rows':[]};var _0x497f5e=_[_0x9c3f('0x28')](db[_0x9c3f('0x29')][_0x9c3f('0x2a')],function(_0x52b9ad){return{'name':_0x52b9ad[_0x9c3f('0x2b')],'type':_0x52b9ad[_0x9c3f('0x2c')][_0x9c3f('0x2d')]};});_0x1835e0[_0x9c3f('0x2e')]=_['map'](_0x497f5e,_0x9c3f('0x25'));_0x1835e0[_0x9c3f('0x2f')]=_[_0x9c3f('0x30')](_0x563b7e[_0x9c3f('0x2f')]);_0x1835e0[_0x9c3f('0x31')]=_['intersection'](_0x1835e0[_0x9c3f('0x2e')],_0x1835e0[_0x9c3f('0x2f')]);_0x15096b[_0x9c3f('0x32')]=_['intersection'](_0x1835e0[_0x9c3f('0x2e')],qs[_0x9c3f('0x33')](_0x563b7e[_0x9c3f('0x2f')]['fields']));_0x15096b[_0x9c3f('0x32')]=_0x15096b[_0x9c3f('0x32')][_0x9c3f('0x34')]?_0x15096b[_0x9c3f('0x32')]:_0x1835e0[_0x9c3f('0x2e')];if(!_0x563b7e[_0x9c3f('0x2f')]['hasOwnProperty']('nolimit')){_0x15096b['limit']=qs[_0x9c3f('0x1c')](_0x563b7e['query']['limit']);_0x15096b[_0x9c3f('0x19')]=qs[_0x9c3f('0x19')](_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x19')]);}_0x15096b[_0x9c3f('0x35')]=qs[_0x9c3f('0x36')](_0x563b7e[_0x9c3f('0x2f')]['sort']);_0x15096b[_0x9c3f('0x37')]=qs[_0x9c3f('0x31')](_[_0x9c3f('0x38')](_0x563b7e[_0x9c3f('0x2f')],_0x1835e0[_0x9c3f('0x31')]),_0x497f5e);if(_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x39')]){_0x15096b[_0x9c3f('0x37')]=_[_0x9c3f('0x3a')](_0x15096b[_0x9c3f('0x37')],{'$or':_[_0x9c3f('0x28')](_0x497f5e,function(_0x375046){if(_0x375046[_0x9c3f('0x2c')]!==_0x9c3f('0x3b')){var _0x49acc6={};_0x49acc6[_0x375046[_0x9c3f('0x25')]]={'$like':'%'+_0x563b7e[_0x9c3f('0x2f')]['filter']+'%'};return _0x49acc6;}})});}_0x15096b=_[_0x9c3f('0x3a')]({},_0x15096b,_0x563b7e[_0x9c3f('0x3c')]);var _0x5b33b6={'where':_0x15096b[_0x9c3f('0x37')]};return db[_0x9c3f('0x29')][_0x9c3f('0x1b')](_0x5b33b6)['then'](function(_0x437972){_0x2285e5[_0x9c3f('0x1b')]=_0x437972;if(_0x563b7e[_0x9c3f('0x2f')][_0x9c3f('0x3d')]){_0x15096b[_0x9c3f('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x15096b);})['then'](function(_0x35b56a){_0x2285e5[_0x9c3f('0x3f')]=_0x35b56a;return _0x2285e5;})[_0x9c3f('0x23')](respondWithFilteredResult(_0x29387a,_0x15096b))[_0x9c3f('0x40')](handleError(_0x29387a,null));};exports[_0x9c3f('0x41')]=function(_0x163fc7,_0x49aca6){var _0x4d0266={'raw':!![],'where':{'id':_0x163fc7[_0x9c3f('0x42')]['id']}},_0x563abf={};_0x563abf[_0x9c3f('0x2e')]=_[_0x9c3f('0x30')](db[_0x9c3f('0x29')][_0x9c3f('0x2a')]);_0x563abf[_0x9c3f('0x2f')]=_['keys'](_0x163fc7[_0x9c3f('0x2f')]);_0x563abf[_0x9c3f('0x31')]=_[_0x9c3f('0x43')](_0x563abf['model'],_0x563abf['query']);_0x4d0266[_0x9c3f('0x32')]=_[_0x9c3f('0x43')](_0x563abf['model'],qs[_0x9c3f('0x33')](_0x163fc7['query'][_0x9c3f('0x33')]));_0x4d0266[_0x9c3f('0x32')]=_0x4d0266[_0x9c3f('0x32')][_0x9c3f('0x34')]?_0x4d0266['attributes']:_0x563abf[_0x9c3f('0x2e')];if(_0x163fc7[_0x9c3f('0x2f')][_0x9c3f('0x3d')]){_0x4d0266[_0x9c3f('0x3e')]=[{'all':!![]}];}_0x4d0266=_[_0x9c3f('0x3a')]({},_0x4d0266,_0x163fc7[_0x9c3f('0x3c')]);return db['MailSubstatus'][_0x9c3f('0x44')](_0x4d0266)[_0x9c3f('0x23')](handleEntityNotFound(_0x49aca6,null))[_0x9c3f('0x23')](respondWithResult(_0x49aca6,null))[_0x9c3f('0x40')](handleError(_0x49aca6,null));};exports[_0x9c3f('0x45')]=function(_0x427498,_0x16badb){return db['MailSubstatus'][_0x9c3f('0x45')](_0x427498[_0x9c3f('0x46')],{})['then'](respondWithResult(_0x16badb,0xc9))[_0x9c3f('0x40')](handleError(_0x16badb,null));};exports['update']=function(_0xfebde2,_0x3ccc65){if(_0xfebde2[_0x9c3f('0x46')]['id']){delete _0xfebde2[_0x9c3f('0x46')]['id'];}return db[_0x9c3f('0x29')]['find']({'where':{'id':_0xfebde2[_0x9c3f('0x42')]['id']}})[_0x9c3f('0x23')](handleEntityNotFound(_0x3ccc65,null))[_0x9c3f('0x23')](saveUpdates(_0xfebde2[_0x9c3f('0x46')],null))[_0x9c3f('0x23')](respondWithResult(_0x3ccc65,null))[_0x9c3f('0x40')](handleError(_0x3ccc65,null));};exports[_0x9c3f('0x47')]=function(_0x1f312d,_0xd8fbd7){return db[_0x9c3f('0x29')][_0x9c3f('0x44')]({'where':{'id':_0x1f312d[_0x9c3f('0x42')]['id']}})[_0x9c3f('0x23')](handleEntityNotFound(_0xd8fbd7,null))['then'](removeEntity(_0xd8fbd7,null))['catch'](handleError(_0xd8fbd7,null));};exports[_0x9c3f('0x48')]=function(_0x4c2275,_0x5424cd){return db[_0x9c3f('0x29')][_0x9c3f('0x48')]()['then'](respondWithResult(_0x5424cd,null))[_0x9c3f('0x40')](handleError(_0x5424cd,null));}; \ No newline at end of file +var _0x49d8=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status'];(function(_0x1d4923,_0x4e222f){var _0x14ea9a=function(_0x54e138){while(--_0x54e138){_0x1d4923['push'](_0x1d4923['shift']());}};_0x14ea9a(++_0x4e222f);}(_0x49d8,0x115));var _0x849d=function(_0x3887a7,_0x50af3e){_0x3887a7=_0x3887a7-0x0;var _0x57e440=_0x49d8[_0x3887a7];return _0x57e440;};'use strict';var emlformat=require(_0x849d('0x0'));var rimraf=require(_0x849d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x849d('0x2'));var rp=require(_0x849d('0x3'));var moment=require(_0x849d('0x4'));var BPromise=require(_0x849d('0x5'));var Mustache=require(_0x849d('0x6'));var util=require(_0x849d('0x7'));var path=require(_0x849d('0x8'));var sox=require('sox');var csv=require(_0x849d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x849d('0xa'));var squel=require('squel');var crypto=require(_0x849d('0xb'));var jsforce=require(_0x849d('0xc'));var deskjs=require(_0x849d('0xd'));var toCsv=require(_0x849d('0x9'));var querystring=require(_0x849d('0xe'));var Papa=require(_0x849d('0xf'));var Redis=require(_0x849d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x849d('0x11'));var as=require(_0x849d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x849d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x849d('0x14'));var db=require(_0x849d('0x15'))['db'];function respondWithStatusCode(_0x3c11e8,_0x3dfe82){_0x3dfe82=_0x3dfe82||0xcc;return function(_0x2ddd21){if(_0x2ddd21){return _0x3c11e8['sendStatus'](_0x3dfe82);}return _0x3c11e8[_0x849d('0x16')](_0x3dfe82)[_0x849d('0x17')]();};}function respondWithResult(_0x400ed3,_0x4ced1c){_0x4ced1c=_0x4ced1c||0xc8;return function(_0x5547d7){if(_0x5547d7){return _0x400ed3[_0x849d('0x16')](_0x4ced1c)[_0x849d('0x18')](_0x5547d7);}};}function respondWithFilteredResult(_0x101b9b,_0x490636){return function(_0x48132e){if(_0x48132e){var _0x104d71=typeof _0x490636[_0x849d('0x19')]===_0x849d('0x1a')&&typeof _0x490636[_0x849d('0x1b')]===_0x849d('0x1a');var _0x3ed82c=_0x48132e[_0x849d('0x1c')];var _0x183120=_0x104d71?0x0:_0x490636[_0x849d('0x19')];var _0x185c7f=_0x104d71?_0x48132e['count']:_0x490636[_0x849d('0x19')]+_0x490636['limit'];var _0x581e5b;if(_0x185c7f>=_0x3ed82c){_0x185c7f=_0x3ed82c;_0x581e5b=0xc8;}else{_0x581e5b=0xce;}_0x101b9b['status'](_0x581e5b);return _0x101b9b[_0x849d('0x1d')](_0x849d('0x1e'),_0x183120+'-'+_0x185c7f+'/'+_0x3ed82c)[_0x849d('0x18')](_0x48132e);}return null;};}function patchUpdates(_0x50daf4){return function(_0x570f1e){try{jsonpatch[_0x849d('0x1f')](_0x570f1e,_0x50daf4,!![]);}catch(_0x14b541){return BPromise['reject'](_0x14b541);}return _0x570f1e[_0x849d('0x20')]();};}function saveUpdates(_0x2b1879,_0x3afba1){return function(_0x5084b3){if(_0x5084b3){return _0x5084b3['update'](_0x2b1879)[_0x849d('0x21')](function(_0x157c36){return _0x157c36;});}return null;};}function removeEntity(_0x177ce7,_0x51e65a){return function(_0x357222){if(_0x357222){return _0x357222[_0x849d('0x22')]()[_0x849d('0x21')](function(){_0x177ce7[_0x849d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f5f5,_0x367405){return function(_0x594a2a){if(!_0x594a2a){_0x22f5f5[_0x849d('0x23')](0x194);}return _0x594a2a;};}function handleError(_0x3a988e,_0x4fee00){_0x4fee00=_0x4fee00||0x1f4;return function(_0xaadae4){logger[_0x849d('0x24')](_0xaadae4['stack']);if(_0xaadae4[_0x849d('0x25')]){delete _0xaadae4['name'];}_0x3a988e[_0x849d('0x16')](_0x4fee00)[_0x849d('0x26')](_0xaadae4);};}exports[_0x849d('0x27')]=function(_0x1ca8f9,_0x3c5bdd){var _0x5bce49={},_0x472d39={},_0x51a478={'count':0x0,'rows':[]};var _0x50a995=_['map'](db[_0x849d('0x28')][_0x849d('0x29')],function(_0x20d45e){return{'name':_0x20d45e[_0x849d('0x2a')],'type':_0x20d45e[_0x849d('0x2b')][_0x849d('0x2c')]};});_0x472d39[_0x849d('0x2d')]=_['map'](_0x50a995,_0x849d('0x25'));_0x472d39[_0x849d('0x2e')]=_[_0x849d('0x2f')](_0x1ca8f9['query']);_0x472d39[_0x849d('0x30')]=_[_0x849d('0x31')](_0x472d39['model'],_0x472d39[_0x849d('0x2e')]);_0x5bce49[_0x849d('0x32')]=_[_0x849d('0x31')](_0x472d39['model'],qs[_0x849d('0x33')](_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x33')]));_0x5bce49[_0x849d('0x32')]=_0x5bce49[_0x849d('0x32')][_0x849d('0x34')]?_0x5bce49[_0x849d('0x32')]:_0x472d39[_0x849d('0x2d')];if(!_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x35')](_0x849d('0x36'))){_0x5bce49[_0x849d('0x1b')]=qs[_0x849d('0x1b')](_0x1ca8f9['query']['limit']);_0x5bce49['offset']=qs[_0x849d('0x19')](_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x19')]);}_0x5bce49[_0x849d('0x37')]=qs[_0x849d('0x38')](_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x38')]);_0x5bce49['where']=qs[_0x849d('0x30')](_[_0x849d('0x39')](_0x1ca8f9[_0x849d('0x2e')],_0x472d39[_0x849d('0x30')]),_0x50a995);if(_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x3a')]){_0x5bce49[_0x849d('0x3b')]=_['merge'](_0x5bce49[_0x849d('0x3b')],{'$or':_[_0x849d('0x3c')](_0x50a995,function(_0x2724cf){if(_0x2724cf[_0x849d('0x2b')]!==_0x849d('0x3d')){var _0x5ed84e={};_0x5ed84e[_0x2724cf[_0x849d('0x25')]]={'$like':'%'+_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x3a')]+'%'};return _0x5ed84e;}})});}_0x5bce49=_[_0x849d('0x3e')]({},_0x5bce49,_0x1ca8f9[_0x849d('0x3f')]);var _0x27cf25={'where':_0x5bce49[_0x849d('0x3b')]};return db[_0x849d('0x28')][_0x849d('0x1c')](_0x27cf25)['then'](function(_0x22372e){_0x51a478['count']=_0x22372e;if(_0x1ca8f9[_0x849d('0x2e')][_0x849d('0x40')]){_0x5bce49[_0x849d('0x41')]=[{'all':!![]}];}return db[_0x849d('0x28')]['findAll'](_0x5bce49);})[_0x849d('0x21')](function(_0x23a707){_0x51a478[_0x849d('0x42')]=_0x23a707;return _0x51a478;})[_0x849d('0x21')](respondWithFilteredResult(_0x3c5bdd,_0x5bce49))[_0x849d('0x43')](handleError(_0x3c5bdd,null));};exports[_0x849d('0x44')]=function(_0x1c70a1,_0x4244a9){var _0x263525={'raw':!![],'where':{'id':_0x1c70a1[_0x849d('0x45')]['id']}},_0x259105={};_0x259105['model']=_[_0x849d('0x2f')](db[_0x849d('0x28')]['rawAttributes']);_0x259105[_0x849d('0x2e')]=_[_0x849d('0x2f')](_0x1c70a1[_0x849d('0x2e')]);_0x259105[_0x849d('0x30')]=_[_0x849d('0x31')](_0x259105[_0x849d('0x2d')],_0x259105['query']);_0x263525[_0x849d('0x32')]=_[_0x849d('0x31')](_0x259105['model'],qs['fields'](_0x1c70a1['query'][_0x849d('0x33')]));_0x263525['attributes']=_0x263525[_0x849d('0x32')][_0x849d('0x34')]?_0x263525['attributes']:_0x259105[_0x849d('0x2d')];if(_0x1c70a1['query'][_0x849d('0x40')]){_0x263525[_0x849d('0x41')]=[{'all':!![]}];}_0x263525=_[_0x849d('0x3e')]({},_0x263525,_0x1c70a1['options']);return db[_0x849d('0x28')][_0x849d('0x46')](_0x263525)[_0x849d('0x21')](handleEntityNotFound(_0x4244a9,null))[_0x849d('0x21')](respondWithResult(_0x4244a9,null))[_0x849d('0x43')](handleError(_0x4244a9,null));};exports[_0x849d('0x47')]=function(_0x47d7af,_0x337ec4){return db[_0x849d('0x28')][_0x849d('0x47')](_0x47d7af[_0x849d('0x48')],{})[_0x849d('0x21')](respondWithResult(_0x337ec4,0xc9))[_0x849d('0x43')](handleError(_0x337ec4,null));};exports[_0x849d('0x49')]=function(_0x5c34b8,_0x44bdf6){if(_0x5c34b8[_0x849d('0x48')]['id']){delete _0x5c34b8['body']['id'];}return db['MailSubstatus'][_0x849d('0x46')]({'where':{'id':_0x5c34b8[_0x849d('0x45')]['id']}})[_0x849d('0x21')](handleEntityNotFound(_0x44bdf6,null))['then'](saveUpdates(_0x5c34b8[_0x849d('0x48')],null))[_0x849d('0x21')](respondWithResult(_0x44bdf6,null))['catch'](handleError(_0x44bdf6,null));};exports[_0x849d('0x22')]=function(_0x6e5648,_0x2464bc){return db[_0x849d('0x28')][_0x849d('0x46')]({'where':{'id':_0x6e5648[_0x849d('0x45')]['id']}})[_0x849d('0x21')](handleEntityNotFound(_0x2464bc,null))[_0x849d('0x21')](removeEntity(_0x2464bc,null))[_0x849d('0x43')](handleError(_0x2464bc,null));};exports[_0x849d('0x4a')]=function(_0xcfc64d,_0x3d2447){return db[_0x849d('0x28')][_0x849d('0x4a')]()[_0x849d('0x21')](respondWithResult(_0x3d2447,null))[_0x849d('0x43')](handleError(_0x3d2447,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 58bfd4a..26347b5 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 _0x3550=['../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x505509,_0x537f0c){var _0x1aab66=function(_0x395280){while(--_0x395280){_0x505509['push'](_0x505509['shift']());}};_0x1aab66(++_0x537f0c);}(_0x3550,0x124));var _0x0355=function(_0x159c09,_0x2f5974){_0x159c09=_0x159c09-0x0;var _0x21810d=_0x3550[_0x159c09];return _0x21810d;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x0355('0x0'))['db'][_0x0355('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0355('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x53eeba){return function(_0x602e4b,_0x2c6102,_0xb0eb84){MailSubstatusEvents['emit'](_0x53eeba+':'+_0x602e4b['id'],_0x602e4b);MailSubstatusEvents[_0x0355('0x3')](_0x53eeba,_0x602e4b);_0xb0eb84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7381=['MailSubstatus','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x7381,0x197));var _0x1738=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7381[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x1738('0x0'))['db'][_0x1738('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x1738('0x2')};function emitEvent(_0x104d90){return function(_0x1b6376,_0x3186a4,_0x280ecf){MailSubstatusEvents[_0x1738('0x3')](_0x104d90+':'+_0x1b6376['id'],_0x1b6376);MailSubstatusEvents[_0x1738('0x3')](_0x104d90,_0x1b6376);_0x280ecf(null);};}for(var e in events){if(events[_0x1738('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x1738('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 98435ed..389a86b 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 _0x23f0=['then','exports','define','MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','name'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x23f0,0x121));var _0x023f=function(_0x1a6015,_0x1e215d){_0x1a6015=_0x1a6015-0x0;var _0x17ea7e=_0x23f0[_0x1a6015];return _0x17ea7e;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x023f('0x0')]=function(_0x3a31b9){var _0x312637=_0x3a31b9['models'];return _0x3a31b9[_0x023f('0x1')](_0x023f('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3ec6cb,_0x42f03f,_0xb3a72c){return _0x312637[_0x023f('0x3')][_0x023f('0x4')]({'value':_0x3ec6cb['name']},{'where':{'field':_0x023f('0x5'),'value':_0x3ec6cb[_0x023f('0x6')][_0x023f('0x7')]}})[_0x023f('0x8')](function(){_0xb3a72c();})['catch'](function(_0xcfebc4){_0xb3a72c(_0xcfebc4);});}}});}; \ No newline at end of file +var _0x0c01=['Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0c01,0x11b));var _0x10c0=function(_0x4bd825,_0xf1ff7f){_0x4bd825=_0x4bd825-0x0;var _0x5c0e2f=_0x0c01[_0x4bd825];return _0x5c0e2f;};'use strict';var attributes=require(_0x10c0('0x0'));module['exports']=function(_0x6c9e61){var _0x3636c3=_0x6c9e61[_0x10c0('0x1')];return _0x6c9e61[_0x10c0('0x2')](_0x10c0('0x3'),attributes,{'tableName':_0x10c0('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xceed75,_0x441bd3,_0x676b2b){return _0x3636c3[_0x10c0('0x5')][_0x10c0('0x6')]({'value':_0xceed75['name']},{'where':{'field':_0x10c0('0x7'),'value':_0xceed75[_0x10c0('0x8')][_0x10c0('0x9')]}})[_0x10c0('0xa')](function(){_0x676b2b();})[_0x10c0('0xb')](function(_0x21d355){_0x676b2b(_0x21d355);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ddbc460..ac9d373 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 _0xca69=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','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'];(function(_0x307049,_0x1e9968){var _0x2d3015=function(_0x285429){while(--_0x285429){_0x307049['push'](_0x307049['shift']());}};_0x2d3015(++_0x1e9968);}(_0xca69,0xb1));var _0x9ca6=function(_0x26ce74,_0x573948){_0x26ce74=_0x26ce74-0x0;var _0xe5fbaf=_0xca69[_0x26ce74];return _0xe5fbaf;};'use strict';var _=require(_0x9ca6('0x0'));var util=require(_0x9ca6('0x1'));var moment=require(_0x9ca6('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(_0x9ca6('0x3'));var logger=require(_0x9ca6('0x4'))(_0x9ca6('0x5'));var config=require(_0x9ca6('0x6'));var jayson=require(_0x9ca6('0x7'));var client=jayson[_0x9ca6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x326340,_0x31bf5d,_0x898bdb){return new BPromise(function(_0x5c832d,_0x3fedfd){return client[_0x9ca6('0x9')](_0x326340,_0x898bdb)[_0x9ca6('0xa')](function(_0x327860){logger[_0x9ca6('0xb')](_0x9ca6('0xc'),_0x31bf5d,_0x9ca6('0xd'));logger[_0x9ca6('0xe')](_0x9ca6('0xf'),_0x31bf5d,'request\x20sent',JSON['stringify'](_0x327860));if(_0x327860['error']){if(_0x327860[_0x9ca6('0x10')]['code']===0x1f4){logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);return _0x3fedfd(_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);}logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x327860[_0x9ca6('0x10')]['message']);return _0x5c832d(_0x327860[_0x9ca6('0x10')][_0x9ca6('0x11')]);}else{logger['info'](_0x9ca6('0xc'),_0x31bf5d,_0x9ca6('0xd'));_0x5c832d(_0x327860[_0x9ca6('0x12')]['message']);}})[_0x9ca6('0x13')](function(_0x155074){logger[_0x9ca6('0x10')](_0x9ca6('0xc'),_0x31bf5d,_0x155074);_0x3fedfd(_0x155074);});});} \ No newline at end of file +var _0x4d74=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d74,0xc0));var _0x44d7=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x4d74[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x44d7('0x0'));var util=require(_0x44d7('0x1'));var moment=require(_0x44d7('0x2'));var BPromise=require(_0x44d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44d7('0x4'));var db=require(_0x44d7('0x5'))['db'];var utils=require(_0x44d7('0x6'));var logger=require(_0x44d7('0x7'))(_0x44d7('0x8'));var config=require(_0x44d7('0x9'));var jayson=require(_0x44d7('0xa'));var client=jayson[_0x44d7('0xb')][_0x44d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4104bd,_0x1c6911,_0x1ddd8d){return new BPromise(function(_0x2ad289,_0xfe40bf){return client[_0x44d7('0xd')](_0x4104bd,_0x1ddd8d)[_0x44d7('0xe')](function(_0xd92a04){logger[_0x44d7('0xf')](_0x44d7('0x10'),_0x1c6911,_0x44d7('0x11'));logger[_0x44d7('0x12')](_0x44d7('0x13'),_0x1c6911,_0x44d7('0x11'),JSON[_0x44d7('0x14')](_0xd92a04));if(_0xd92a04['error']){if(_0xd92a04[_0x44d7('0x15')][_0x44d7('0x16')]===0x1f4){logger[_0x44d7('0x15')](_0x44d7('0x10'),_0x1c6911,_0xd92a04[_0x44d7('0x15')][_0x44d7('0x17')]);return _0xfe40bf(_0xd92a04['error'][_0x44d7('0x17')]);}logger[_0x44d7('0x15')](_0x44d7('0x10'),_0x1c6911,_0xd92a04[_0x44d7('0x15')][_0x44d7('0x17')]);return _0x2ad289(_0xd92a04['error']['message']);}else{logger[_0x44d7('0xf')](_0x44d7('0x10'),_0x1c6911,_0x44d7('0x11'));_0x2ad289(_0xd92a04['result'][_0x44d7('0x17')]);}})['catch'](function(_0x196389){logger[_0x44d7('0x15')](_0x44d7('0x10'),_0x1c6911,_0x196389);_0xfe40bf(_0x196389);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 64623ab..7415256 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 _0x14ad=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5be16f,_0x557554){var _0x57cb4e=function(_0x57b476){while(--_0x57b476){_0x5be16f['push'](_0x5be16f['shift']());}};_0x57cb4e(++_0x557554);}(_0x14ad,0xa3));var _0xd14a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x14ad[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xd14a('0x0'));var util=require(_0xd14a('0x1'));var path=require(_0xd14a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd14a('0x3'));var router=express[_0xd14a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd14a('0x5'));var interaction=require(_0xd14a('0x6'));var config=require(_0xd14a('0x7'));var controller=require(_0xd14a('0x8'));router[_0xd14a('0x9')]('/',auth[_0xd14a('0xa')](),controller[_0xd14a('0xb')]);router[_0xd14a('0x9')](_0xd14a('0xc'),auth[_0xd14a('0xa')](),controller[_0xd14a('0xd')]);router[_0xd14a('0x9')](_0xd14a('0xe'),auth[_0xd14a('0xa')](),controller['show']);router[_0xd14a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd14a('0x10')]);router['put'](_0xd14a('0xe'),auth['isAuthenticated'](),controller[_0xd14a('0x11')]);router[_0xd14a('0x12')](_0xd14a('0xe'),auth[_0xd14a('0xa')](),controller[_0xd14a('0x13')]);module[_0xd14a('0x14')]=router; \ No newline at end of file +var _0x36b7=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x911275,_0xd3e301){var _0x2c3848=function(_0x4bde5f){while(--_0x4bde5f){_0x911275['push'](_0x911275['shift']());}};_0x2c3848(++_0xd3e301);}(_0x36b7,0xf2));var _0x736b=function(_0x247c71,_0x2254e2){_0x247c71=_0x247c71-0x0;var _0x202a3c=_0x36b7[_0x247c71];return _0x202a3c;};'use strict';var multer=require(_0x736b('0x0'));var util=require('util');var path=require(_0x736b('0x1'));var timeout=require(_0x736b('0x2'));var express=require('express');var router=express[_0x736b('0x3')]();var fs_extra=require(_0x736b('0x4'));var auth=require(_0x736b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x736b('0x6'));var controller=require('./mailTransferReport.controller');router[_0x736b('0x7')]('/',auth[_0x736b('0x8')](),controller[_0x736b('0x9')]);router[_0x736b('0x7')](_0x736b('0xa'),auth['isAuthenticated'](),controller[_0x736b('0xb')]);router[_0x736b('0x7')](_0x736b('0xc'),auth['isAuthenticated'](),controller[_0x736b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x736b('0xe')]);router['put'](_0x736b('0xc'),auth[_0x736b('0x8')](),controller[_0x736b('0xf')]);router[_0x736b('0x10')]('/:id',auth[_0x736b('0x8')](),controller[_0x736b('0x11')]);module[_0x736b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 60caef1..180a86e 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x371862,_0x5de996){var _0x199464=function(_0x3b811e){while(--_0x3b811e){_0x371862['push'](_0x371862['shift']());}};_0x199464(++_0x5de996);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x00bb[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1346e1,_0x2683ff){var _0x3fe205=function(_0x5b6f63){while(--_0x5b6f63){_0x1346e1['push'](_0x1346e1['shift']());}};_0x3fe205(++_0x2683ff);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e4048,_0x374fcf){_0x2e4048=_0x2e4048-0x0;var _0x150fee=_0xedd9[_0x2e4048];return _0x150fee;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f445ee1..bba96bd 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 _0xa951=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','MailTransferReport','include','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x1b828a,_0x10edaf){var _0x35c70b=function(_0x2fb097){while(--_0x2fb097){_0x1b828a['push'](_0x1b828a['shift']());}};_0x35c70b(++_0x10edaf);}(_0xa951,0x1ba));var _0x1a95=function(_0x69034e,_0x4b9513){_0x69034e=_0x69034e-0x0;var _0x10976a=_0xa951[_0x69034e];return _0x10976a;};'use strict';var emlformat=require(_0x1a95('0x0'));var rimraf=require(_0x1a95('0x1'));var zipdir=require(_0x1a95('0x2'));var jsonpatch=require(_0x1a95('0x3'));var rp=require(_0x1a95('0x4'));var moment=require(_0x1a95('0x5'));var BPromise=require(_0x1a95('0x6'));var Mustache=require(_0x1a95('0x7'));var util=require(_0x1a95('0x8'));var path=require(_0x1a95('0x9'));var sox=require(_0x1a95('0xa'));var csv=require(_0x1a95('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a95('0xc'));var _=require('lodash');var squel=require(_0x1a95('0xd'));var crypto=require(_0x1a95('0xe'));var jsforce=require(_0x1a95('0xf'));var deskjs=require(_0x1a95('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a95('0x11'));var Redis=require(_0x1a95('0x12'));var authService=require(_0x1a95('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1a95('0x14'));var hardwareService=require(_0x1a95('0x15'));var logger=require(_0x1a95('0x16'))('api');var utils=require(_0x1a95('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a95('0x18'))['db'];function respondWithStatusCode(_0x11a812,_0x52a741){_0x52a741=_0x52a741||0xcc;return function(_0x27958e){if(_0x27958e){return _0x11a812[_0x1a95('0x19')](_0x52a741);}return _0x11a812[_0x1a95('0x1a')](_0x52a741)['end']();};}function respondWithResult(_0x26fa31,_0x578edc){_0x578edc=_0x578edc||0xc8;return function(_0x2372cf){if(_0x2372cf){return _0x26fa31[_0x1a95('0x1a')](_0x578edc)['json'](_0x2372cf);}};}function respondWithFilteredResult(_0x2ad731,_0x4fe7db){return function(_0x28334b){if(_0x28334b){var _0x2c70a5=typeof _0x4fe7db[_0x1a95('0x1b')]==='undefined'&&typeof _0x4fe7db[_0x1a95('0x1c')]===_0x1a95('0x1d');var _0x26b9af=_0x28334b[_0x1a95('0x1e')];var _0x3a1c95=_0x2c70a5?0x0:_0x4fe7db['offset'];var _0xfb6893=_0x2c70a5?_0x28334b[_0x1a95('0x1e')]:_0x4fe7db[_0x1a95('0x1b')]+_0x4fe7db['limit'];var _0x3c4679;if(_0xfb6893>=_0x26b9af){_0xfb6893=_0x26b9af;_0x3c4679=0xc8;}else{_0x3c4679=0xce;}_0x2ad731[_0x1a95('0x1a')](_0x3c4679);return _0x2ad731[_0x1a95('0x1f')](_0x1a95('0x20'),_0x3a1c95+'-'+_0xfb6893+'/'+_0x26b9af)['json'](_0x28334b);}return null;};}function patchUpdates(_0x2f5153){return function(_0x40622a){try{jsonpatch[_0x1a95('0x21')](_0x40622a,_0x2f5153,!![]);}catch(_0x226b6d){return BPromise[_0x1a95('0x22')](_0x226b6d);}return _0x40622a[_0x1a95('0x23')]();};}function saveUpdates(_0x1391ee,_0x4e9a92){return function(_0x47031d){if(_0x47031d){return _0x47031d[_0x1a95('0x24')](_0x1391ee)[_0x1a95('0x25')](function(_0x3db9d1){return _0x3db9d1;});}return null;};}function removeEntity(_0xb988ba,_0x31d1fe){return function(_0x3d103e){if(_0x3d103e){return _0x3d103e[_0x1a95('0x26')]()[_0x1a95('0x25')](function(){_0xb988ba[_0x1a95('0x1a')](0xcc)[_0x1a95('0x27')]();});}};}function handleEntityNotFound(_0x26885d,_0xb3704f){return function(_0x7bc35c){if(!_0x7bc35c){_0x26885d[_0x1a95('0x19')](0x194);}return _0x7bc35c;};}function handleError(_0x331cb8,_0x374c69){_0x374c69=_0x374c69||0x1f4;return function(_0x6270f9){logger[_0x1a95('0x28')](_0x6270f9['stack']);if(_0x6270f9[_0x1a95('0x29')]){delete _0x6270f9[_0x1a95('0x29')];}_0x331cb8['status'](_0x374c69)[_0x1a95('0x2a')](_0x6270f9);};}exports[_0x1a95('0x2b')]=function(_0x652f0f,_0x4e38fb){var _0x26ba3c={},_0xc7ac0f={},_0x3c5bc4={'count':0x0,'rows':[]};var _0x2ce87d=_[_0x1a95('0x2c')](db['MailTransferReport'][_0x1a95('0x2d')],function(_0x502fff){return{'name':_0x502fff[_0x1a95('0x2e')],'type':_0x502fff[_0x1a95('0x2f')][_0x1a95('0x30')]};});_0xc7ac0f[_0x1a95('0x31')]=_[_0x1a95('0x2c')](_0x2ce87d,_0x1a95('0x29'));_0xc7ac0f[_0x1a95('0x32')]=_[_0x1a95('0x33')](_0x652f0f['query']);_0xc7ac0f[_0x1a95('0x34')]=_[_0x1a95('0x35')](_0xc7ac0f[_0x1a95('0x31')],_0xc7ac0f[_0x1a95('0x32')]);_0x26ba3c[_0x1a95('0x36')]=_[_0x1a95('0x35')](_0xc7ac0f[_0x1a95('0x31')],qs[_0x1a95('0x37')](_0x652f0f[_0x1a95('0x32')][_0x1a95('0x37')]));_0x26ba3c[_0x1a95('0x36')]=_0x26ba3c['attributes'][_0x1a95('0x38')]?_0x26ba3c[_0x1a95('0x36')]:_0xc7ac0f[_0x1a95('0x31')];if(!_0x652f0f[_0x1a95('0x32')]['hasOwnProperty'](_0x1a95('0x39'))){_0x26ba3c[_0x1a95('0x1c')]=qs[_0x1a95('0x1c')](_0x652f0f['query'][_0x1a95('0x1c')]);_0x26ba3c[_0x1a95('0x1b')]=qs[_0x1a95('0x1b')](_0x652f0f[_0x1a95('0x32')][_0x1a95('0x1b')]);}_0x26ba3c[_0x1a95('0x3a')]=qs[_0x1a95('0x3b')](_0x652f0f['query']['sort']);_0x26ba3c['where']=qs['filters'](_[_0x1a95('0x3c')](_0x652f0f['query'],_0xc7ac0f[_0x1a95('0x34')]),_0x2ce87d);if(_0x652f0f[_0x1a95('0x32')][_0x1a95('0x3d')]){_0x26ba3c['where']=_[_0x1a95('0x3e')](_0x26ba3c[_0x1a95('0x3f')],{'$or':_[_0x1a95('0x2c')](_0x2ce87d,function(_0x36cf8a){if(_0x36cf8a['type']!=='VIRTUAL'){var _0x53d11a={};_0x53d11a[_0x36cf8a[_0x1a95('0x29')]]={'$like':'%'+_0x652f0f[_0x1a95('0x32')][_0x1a95('0x3d')]+'%'};return _0x53d11a;}})});}_0x26ba3c=_[_0x1a95('0x3e')]({},_0x26ba3c,_0x652f0f[_0x1a95('0x40')]);var _0x3038e5={'where':_0x26ba3c['where']};return db[_0x1a95('0x41')][_0x1a95('0x1e')](_0x3038e5)['then'](function(_0x2c5d3b){_0x3c5bc4[_0x1a95('0x1e')]=_0x2c5d3b;if(_0x652f0f[_0x1a95('0x32')]['includeAll']){_0x26ba3c[_0x1a95('0x42')]=[{'all':!![]}];}return db[_0x1a95('0x41')]['findAll'](_0x26ba3c);})[_0x1a95('0x25')](function(_0x46f83e){_0x3c5bc4[_0x1a95('0x43')]=_0x46f83e;return _0x3c5bc4;})[_0x1a95('0x25')](respondWithFilteredResult(_0x4e38fb,_0x26ba3c))[_0x1a95('0x44')](handleError(_0x4e38fb,null));};exports[_0x1a95('0x45')]=function(_0x49588b,_0x46fa69){var _0x1b5932={'raw':!![],'where':{'id':_0x49588b[_0x1a95('0x46')]['id']}},_0xbb177d={};_0xbb177d[_0x1a95('0x31')]=_[_0x1a95('0x33')](db[_0x1a95('0x41')][_0x1a95('0x2d')]);_0xbb177d[_0x1a95('0x32')]=_[_0x1a95('0x33')](_0x49588b[_0x1a95('0x32')]);_0xbb177d[_0x1a95('0x34')]=_['intersection'](_0xbb177d['model'],_0xbb177d[_0x1a95('0x32')]);_0x1b5932[_0x1a95('0x36')]=_[_0x1a95('0x35')](_0xbb177d[_0x1a95('0x31')],qs[_0x1a95('0x37')](_0x49588b[_0x1a95('0x32')][_0x1a95('0x37')]));_0x1b5932[_0x1a95('0x36')]=_0x1b5932[_0x1a95('0x36')]['length']?_0x1b5932[_0x1a95('0x36')]:_0xbb177d[_0x1a95('0x31')];if(_0x49588b[_0x1a95('0x32')][_0x1a95('0x47')]){_0x1b5932[_0x1a95('0x42')]=[{'all':!![]}];}_0x1b5932=_[_0x1a95('0x3e')]({},_0x1b5932,_0x49588b['options']);return db[_0x1a95('0x41')]['find'](_0x1b5932)[_0x1a95('0x25')](handleEntityNotFound(_0x46fa69,null))['then'](respondWithResult(_0x46fa69,null))['catch'](handleError(_0x46fa69,null));};exports[_0x1a95('0x48')]=function(_0x5b18b3,_0x478790){return db[_0x1a95('0x41')][_0x1a95('0x48')](_0x5b18b3[_0x1a95('0x49')],{})['then'](respondWithResult(_0x478790,0xc9))[_0x1a95('0x44')](handleError(_0x478790,null));};exports[_0x1a95('0x24')]=function(_0xe9050f,_0x20893c){if(_0xe9050f[_0x1a95('0x49')]['id']){delete _0xe9050f[_0x1a95('0x49')]['id'];}return db[_0x1a95('0x41')][_0x1a95('0x4a')]({'where':{'id':_0xe9050f['params']['id']}})[_0x1a95('0x25')](handleEntityNotFound(_0x20893c,null))[_0x1a95('0x25')](saveUpdates(_0xe9050f[_0x1a95('0x49')],null))[_0x1a95('0x25')](respondWithResult(_0x20893c,null))[_0x1a95('0x44')](handleError(_0x20893c,null));};exports[_0x1a95('0x26')]=function(_0x33df0f,_0xbeff0d){return db[_0x1a95('0x41')][_0x1a95('0x4a')]({'where':{'id':_0x33df0f[_0x1a95('0x46')]['id']}})['then'](handleEntityNotFound(_0xbeff0d,null))[_0x1a95('0x25')](removeEntity(_0xbeff0d,null))[_0x1a95('0x44')](handleError(_0xbeff0d,null));};exports[_0x1a95('0x4b')]=function(_0x2aec36,_0x2f0d57){return db[_0x1a95('0x41')][_0x1a95('0x4b')]()[_0x1a95('0x25')](respondWithResult(_0x2f0d57,null))[_0x1a95('0x44')](handleError(_0x2f0d57,null));}; \ No newline at end of file +var _0x43c1=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','MailTransferReport','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','fields','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x38f02e,_0xe73a0d){var _0x206435=function(_0x26c7bd){while(--_0x26c7bd){_0x38f02e['push'](_0x38f02e['shift']());}};_0x206435(++_0xe73a0d);}(_0x43c1,0x12c));var _0x143c=function(_0x26b26a,_0x4be91d){_0x26b26a=_0x26b26a-0x0;var _0x360bba=_0x43c1[_0x26b26a];return _0x360bba;};'use strict';var emlformat=require(_0x143c('0x0'));var rimraf=require(_0x143c('0x1'));var zipdir=require(_0x143c('0x2'));var jsonpatch=require(_0x143c('0x3'));var rp=require(_0x143c('0x4'));var moment=require('moment');var BPromise=require(_0x143c('0x5'));var Mustache=require('mustache');var util=require(_0x143c('0x6'));var path=require(_0x143c('0x7'));var sox=require(_0x143c('0x8'));var csv=require(_0x143c('0x9'));var ejs=require(_0x143c('0xa'));var fs=require('fs');var fs_extra=require(_0x143c('0xb'));var _=require(_0x143c('0xc'));var squel=require(_0x143c('0xd'));var crypto=require(_0x143c('0xe'));var jsforce=require(_0x143c('0xf'));var deskjs=require(_0x143c('0x10'));var toCsv=require(_0x143c('0x9'));var querystring=require(_0x143c('0x11'));var Papa=require(_0x143c('0x12'));var Redis=require('ioredis');var authService=require(_0x143c('0x13'));var qs=require(_0x143c('0x14'));var as=require(_0x143c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x143c('0x16'))(_0x143c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x143c('0x18'));var db=require(_0x143c('0x19'))['db'];function respondWithStatusCode(_0x2d7bd4,_0x36a2db){_0x36a2db=_0x36a2db||0xcc;return function(_0xdcf8b6){if(_0xdcf8b6){return _0x2d7bd4['sendStatus'](_0x36a2db);}return _0x2d7bd4[_0x143c('0x1a')](_0x36a2db)['end']();};}function respondWithResult(_0x40baa8,_0x1e5ad0){_0x1e5ad0=_0x1e5ad0||0xc8;return function(_0x2c72ee){if(_0x2c72ee){return _0x40baa8['status'](_0x1e5ad0)['json'](_0x2c72ee);}};}function respondWithFilteredResult(_0x412ce3,_0x2ccd88){return function(_0x226a52){if(_0x226a52){var _0x3027b4=typeof _0x2ccd88['offset']==='undefined'&&typeof _0x2ccd88['limit']===_0x143c('0x1b');var _0x1b7364=_0x226a52[_0x143c('0x1c')];var _0x5bfbe4=_0x3027b4?0x0:_0x2ccd88[_0x143c('0x1d')];var _0x3c5cfd=_0x3027b4?_0x226a52[_0x143c('0x1c')]:_0x2ccd88['offset']+_0x2ccd88[_0x143c('0x1e')];var _0x279f3a;if(_0x3c5cfd>=_0x1b7364){_0x3c5cfd=_0x1b7364;_0x279f3a=0xc8;}else{_0x279f3a=0xce;}_0x412ce3[_0x143c('0x1a')](_0x279f3a);return _0x412ce3[_0x143c('0x1f')](_0x143c('0x20'),_0x5bfbe4+'-'+_0x3c5cfd+'/'+_0x1b7364)[_0x143c('0x21')](_0x226a52);}return null;};}function patchUpdates(_0x427546){return function(_0x173960){try{jsonpatch[_0x143c('0x22')](_0x173960,_0x427546,!![]);}catch(_0x28e209){return BPromise[_0x143c('0x23')](_0x28e209);}return _0x173960[_0x143c('0x24')]();};}function saveUpdates(_0x536451,_0x499f3c){return function(_0x155dd2){if(_0x155dd2){return _0x155dd2[_0x143c('0x25')](_0x536451)[_0x143c('0x26')](function(_0x5abbdc){return _0x5abbdc;});}return null;};}function removeEntity(_0x1906b6,_0x194d56){return function(_0x2b954f){if(_0x2b954f){return _0x2b954f[_0x143c('0x27')]()[_0x143c('0x26')](function(){_0x1906b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x391409,_0x48a98e){return function(_0x447cad){if(!_0x447cad){_0x391409[_0x143c('0x28')](0x194);}return _0x447cad;};}function handleError(_0x2f8178,_0x17d974){_0x17d974=_0x17d974||0x1f4;return function(_0x1d2abc){logger[_0x143c('0x29')](_0x1d2abc['stack']);if(_0x1d2abc[_0x143c('0x2a')]){delete _0x1d2abc[_0x143c('0x2a')];}_0x2f8178[_0x143c('0x1a')](_0x17d974)[_0x143c('0x2b')](_0x1d2abc);};}exports[_0x143c('0x2c')]=function(_0x13ad9f,_0x4d41ae){var _0x3f3e7d={},_0x4130f1={},_0x3368aa={'count':0x0,'rows':[]};var _0x4277ed=_[_0x143c('0x2d')](db[_0x143c('0x2e')]['rawAttributes'],function(_0x6e7a74){return{'name':_0x6e7a74[_0x143c('0x2f')],'type':_0x6e7a74[_0x143c('0x30')][_0x143c('0x31')]};});_0x4130f1[_0x143c('0x32')]=_[_0x143c('0x2d')](_0x4277ed,'name');_0x4130f1['query']=_[_0x143c('0x33')](_0x13ad9f[_0x143c('0x34')]);_0x4130f1['filters']=_[_0x143c('0x35')](_0x4130f1[_0x143c('0x32')],_0x4130f1[_0x143c('0x34')]);_0x3f3e7d[_0x143c('0x36')]=_[_0x143c('0x35')](_0x4130f1[_0x143c('0x32')],qs['fields'](_0x13ad9f[_0x143c('0x34')]['fields']));_0x3f3e7d[_0x143c('0x36')]=_0x3f3e7d[_0x143c('0x36')][_0x143c('0x37')]?_0x3f3e7d[_0x143c('0x36')]:_0x4130f1[_0x143c('0x32')];if(!_0x13ad9f[_0x143c('0x34')][_0x143c('0x38')]('nolimit')){_0x3f3e7d[_0x143c('0x1e')]=qs[_0x143c('0x1e')](_0x13ad9f['query']['limit']);_0x3f3e7d['offset']=qs[_0x143c('0x1d')](_0x13ad9f[_0x143c('0x34')]['offset']);}_0x3f3e7d[_0x143c('0x39')]=qs[_0x143c('0x3a')](_0x13ad9f[_0x143c('0x34')]['sort']);_0x3f3e7d[_0x143c('0x3b')]=qs[_0x143c('0x3c')](_[_0x143c('0x3d')](_0x13ad9f[_0x143c('0x34')],_0x4130f1[_0x143c('0x3c')]),_0x4277ed);if(_0x13ad9f[_0x143c('0x34')]['filter']){_0x3f3e7d[_0x143c('0x3b')]=_['merge'](_0x3f3e7d[_0x143c('0x3b')],{'$or':_[_0x143c('0x2d')](_0x4277ed,function(_0x485b2b){if(_0x485b2b['type']!==_0x143c('0x3e')){var _0x28d486={};_0x28d486[_0x485b2b[_0x143c('0x2a')]]={'$like':'%'+_0x13ad9f[_0x143c('0x34')][_0x143c('0x3f')]+'%'};return _0x28d486;}})});}_0x3f3e7d=_['merge']({},_0x3f3e7d,_0x13ad9f[_0x143c('0x40')]);var _0x423b2f={'where':_0x3f3e7d[_0x143c('0x3b')]};return db[_0x143c('0x2e')]['count'](_0x423b2f)[_0x143c('0x26')](function(_0x1b869b){_0x3368aa['count']=_0x1b869b;if(_0x13ad9f[_0x143c('0x34')][_0x143c('0x41')]){_0x3f3e7d['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x143c('0x42')](_0x3f3e7d);})[_0x143c('0x26')](function(_0x2f999f){_0x3368aa[_0x143c('0x43')]=_0x2f999f;return _0x3368aa;})['then'](respondWithFilteredResult(_0x4d41ae,_0x3f3e7d))['catch'](handleError(_0x4d41ae,null));};exports[_0x143c('0x44')]=function(_0x24f6aa,_0x44348f){var _0x511651={'raw':!![],'where':{'id':_0x24f6aa[_0x143c('0x45')]['id']}},_0x3a7907={};_0x3a7907[_0x143c('0x32')]=_[_0x143c('0x33')](db[_0x143c('0x2e')][_0x143c('0x46')]);_0x3a7907['query']=_[_0x143c('0x33')](_0x24f6aa[_0x143c('0x34')]);_0x3a7907[_0x143c('0x3c')]=_[_0x143c('0x35')](_0x3a7907[_0x143c('0x32')],_0x3a7907[_0x143c('0x34')]);_0x511651[_0x143c('0x36')]=_['intersection'](_0x3a7907[_0x143c('0x32')],qs[_0x143c('0x47')](_0x24f6aa[_0x143c('0x34')][_0x143c('0x47')]));_0x511651['attributes']=_0x511651[_0x143c('0x36')][_0x143c('0x37')]?_0x511651[_0x143c('0x36')]:_0x3a7907[_0x143c('0x32')];if(_0x24f6aa[_0x143c('0x34')][_0x143c('0x41')]){_0x511651[_0x143c('0x48')]=[{'all':!![]}];}_0x511651=_['merge']({},_0x511651,_0x24f6aa[_0x143c('0x40')]);return db[_0x143c('0x2e')][_0x143c('0x49')](_0x511651)[_0x143c('0x26')](handleEntityNotFound(_0x44348f,null))[_0x143c('0x26')](respondWithResult(_0x44348f,null))['catch'](handleError(_0x44348f,null));};exports[_0x143c('0x4a')]=function(_0x33cec3,_0x33afa5){return db[_0x143c('0x2e')]['create'](_0x33cec3[_0x143c('0x4b')],{})['then'](respondWithResult(_0x33afa5,0xc9))['catch'](handleError(_0x33afa5,null));};exports[_0x143c('0x25')]=function(_0x189a45,_0x37d5eb){if(_0x189a45[_0x143c('0x4b')]['id']){delete _0x189a45[_0x143c('0x4b')]['id'];}return db[_0x143c('0x2e')][_0x143c('0x49')]({'where':{'id':_0x189a45[_0x143c('0x45')]['id']}})[_0x143c('0x26')](handleEntityNotFound(_0x37d5eb,null))[_0x143c('0x26')](saveUpdates(_0x189a45[_0x143c('0x4b')],null))[_0x143c('0x26')](respondWithResult(_0x37d5eb,null))['catch'](handleError(_0x37d5eb,null));};exports['destroy']=function(_0x2e9f5f,_0xaf71f5){return db[_0x143c('0x2e')][_0x143c('0x49')]({'where':{'id':_0x2e9f5f[_0x143c('0x45')]['id']}})['then'](handleEntityNotFound(_0xaf71f5,null))[_0x143c('0x26')](removeEntity(_0xaf71f5,null))[_0x143c('0x4c')](handleError(_0xaf71f5,null));};exports[_0x143c('0x4d')]=function(_0x16a9d8,_0x165cfd){return db[_0x143c('0x2e')][_0x143c('0x4d')]()['then'](respondWithResult(_0x165cfd,null))[_0x143c('0x4c')](handleError(_0x165cfd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9098a4c..ad0c008 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 _0x28a2=['moment','bluebird','request-promise','rimraf','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('MailTransferReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'name':_0x228a('0xc'),'fields':[_0x228a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99d6=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','moment','bluebird','request-promise','path'];(function(_0x427214,_0xaa01af){var _0x4a9fe0=function(_0x6ab42){while(--_0x6ab42){_0x427214['push'](_0x427214['shift']());}};_0x4a9fe0(++_0xaa01af);}(_0x99d6,0x193));var _0x699d=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x99d6[_0x15fc7a];return _0x3aa9f4;};'use strict';var _=require(_0x699d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x699d('0x1'));var BPromise=require(_0x699d('0x2'));var rp=require(_0x699d('0x3'));var fs=require('fs');var path=require(_0x699d('0x4'));var rimraf=require(_0x699d('0x5'));var config=require(_0x699d('0x6'));var attributes=require(_0x699d('0x7'));module[_0x699d('0x8')]=function(_0x3de40a,_0x260a5e){return _0x3de40a[_0x699d('0x9')](_0x699d('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x699d('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 68c85d6..836c562 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 _0x5280=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x5280,0xbf));var _0x0528=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x5280[_0x2df1f2];return _0x38652b;};'use strict';var _=require(_0x0528('0x0'));var util=require('util');var moment=require(_0x0528('0x1'));var BPromise=require(_0x0528('0x2'));var rs=require(_0x0528('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0528('0x4'))['db'];var utils=require(_0x0528('0x5'));var logger=require(_0x0528('0x6'))(_0x0528('0x7'));var config=require(_0x0528('0x8'));var jayson=require(_0x0528('0x9'));var client=jayson['client'][_0x0528('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42b13f,_0x3c265c,_0x44f362){return new BPromise(function(_0x2480a2,_0x1a5123){return client['request'](_0x42b13f,_0x44f362)['then'](function(_0x410d41){logger[_0x0528('0xb')](_0x0528('0xc'),_0x3c265c,'request\x20sent');logger[_0x0528('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3c265c,_0x0528('0xe'),JSON[_0x0528('0xf')](_0x410d41));if(_0x410d41[_0x0528('0x10')]){if(_0x410d41[_0x0528('0x10')][_0x0528('0x11')]===0x1f4){logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);return _0x1a5123(_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);}logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);return _0x2480a2(_0x410d41[_0x0528('0x10')][_0x0528('0x12')]);}else{logger[_0x0528('0xb')](_0x0528('0xc'),_0x3c265c,_0x0528('0xe'));_0x2480a2(_0x410d41[_0x0528('0x13')]['message']);}})[_0x0528('0x14')](function(_0x1e8b9f){logger[_0x0528('0x10')](_0x0528('0xc'),_0x3c265c,_0x1e8b9f);_0x1a5123(_0x1e8b9f);});});} \ No newline at end of file +var _0x9375=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9375,0x169));var _0x5937=function(_0x169cc5,_0x4fbba2){_0x169cc5=_0x169cc5-0x0;var _0x347f29=_0x9375[_0x169cc5];return _0x347f29;};'use strict';var _=require(_0x5937('0x0'));var util=require(_0x5937('0x1'));var moment=require(_0x5937('0x2'));var BPromise=require(_0x5937('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5937('0x4'));var db=require(_0x5937('0x5'))['db'];var utils=require(_0x5937('0x6'));var logger=require(_0x5937('0x7'))(_0x5937('0x8'));var config=require(_0x5937('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5937('0xa')][_0x5937('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb1e,_0x69d002,_0x135440){return new BPromise(function(_0x496a2f,_0x5ec528){return client[_0x5937('0xc')](_0x3eeb1e,_0x135440)[_0x5937('0xd')](function(_0x3e22a2){logger[_0x5937('0xe')](_0x5937('0xf'),_0x69d002,_0x5937('0x10'));logger[_0x5937('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x69d002,_0x5937('0x10'),JSON['stringify'](_0x3e22a2));if(_0x3e22a2['error']){if(_0x3e22a2[_0x5937('0x12')][_0x5937('0x13')]===0x1f4){logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x3e22a2[_0x5937('0x12')][_0x5937('0x14')]);return _0x5ec528(_0x3e22a2[_0x5937('0x12')][_0x5937('0x14')]);}logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x3e22a2[_0x5937('0x12')]['message']);return _0x496a2f(_0x3e22a2['error'][_0x5937('0x14')]);}else{logger[_0x5937('0xe')](_0x5937('0xf'),_0x69d002,'request\x20sent');_0x496a2f(_0x3e22a2[_0x5937('0x15')][_0x5937('0x14')]);}})[_0x5937('0x16')](function(_0x307dae){logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x307dae);_0x5ec528(_0x307dae);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3898a57..50370d7 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 _0x8d18=['index','/describe','describe','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x8d18,0xda));var _0x88d1=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x8d18[_0x4e5552];return _0x60a338;};'use strict';var multer=require(_0x88d1('0x0'));var util=require(_0x88d1('0x1'));var path=require(_0x88d1('0x2'));var timeout=require(_0x88d1('0x3'));var express=require('express');var router=express[_0x88d1('0x4')]();var fs_extra=require(_0x88d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x88d1('0x6'));var controller=require(_0x88d1('0x7'));router[_0x88d1('0x8')]('/',auth[_0x88d1('0x9')](),controller[_0x88d1('0xa')]);router['get'](_0x88d1('0xb'),auth[_0x88d1('0x9')](),controller[_0x88d1('0xc')]);router[_0x88d1('0x8')](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0xe')]);router['post']('/',auth[_0x88d1('0x9')](),controller[_0x88d1('0xf')]);router['put'](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0x10')]);router[_0x88d1('0x11')](_0x88d1('0xd'),auth[_0x88d1('0x9')](),controller[_0x88d1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4df0=['../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','exports','multer','util','path','fs-extra'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x4df0,0xd4));var _0x04df=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x4df0[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0x04df('0x0'));var util=require(_0x04df('0x1'));var path=require(_0x04df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x04df('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x04df('0x4'));var config=require(_0x04df('0x5'));var controller=require(_0x04df('0x6'));router['get']('/',auth[_0x04df('0x7')](),controller[_0x04df('0x8')]);router[_0x04df('0x9')](_0x04df('0xa'),auth[_0x04df('0x7')](),controller[_0x04df('0xb')]);router[_0x04df('0x9')](_0x04df('0xc'),auth[_0x04df('0x7')](),controller[_0x04df('0xd')]);router['post']('/',auth[_0x04df('0x7')](),controller[_0x04df('0xe')]);router[_0x04df('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x04df('0x10')](_0x04df('0xc'),auth[_0x04df('0x7')](),controller['destroy']);module[_0x04df('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8195469..8cbd489 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 _0x0739=['setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0x3ca6aa,_0x163df9){var _0x1c34d5=function(_0x119bda){while(--_0x119bda){_0x3ca6aa['push'](_0x3ca6aa['shift']());}};_0x1c34d5(++_0x163df9);}(_0x0739,0xba));var _0x9073=function(_0x14076c,_0x2da3e4){_0x14076c=_0x14076c-0x0;var _0x338630=_0x0739[_0x14076c];return _0x338630;};'use strict';var Sequelize=require(_0x9073('0x0'));var moment=require(_0x9073('0x1'));module[_0x9073('0x2')]={'channel':{'type':Sequelize[_0x9073('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9073('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9073('0x4')},'duration':{'type':Sequelize[_0x9073('0x5')]},'enterAt':{'type':Sequelize[_0x9073('0x6')]},'exitAt':{'type':Sequelize[_0x9073('0x6')],'set':function(_0x5511e2){var _0x17adc2=moment(_0x5511e2);var _0xdc1bc8=moment(this[_0x9073('0x7')]('enterAt'));var _0x136e15=_0x17adc2[_0x9073('0x8')](_0xdc1bc8,_0x9073('0x9'));this[_0x9073('0xa')]('exitAt',_0x5511e2);this[_0x9073('0xa')]('duration',_0x136e15>=0x0?_0x136e15:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xb')},'data3':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xc')},'data4':{'type':Sequelize[_0x9073('0x3')],'comment':_0x9073('0xd')},'data5':{'type':Sequelize[_0x9073('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9073('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9073('0x3')]}}; \ No newline at end of file +var _0xa9c4=['diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt'];(function(_0x41b84b,_0x50668e){var _0x27d373=function(_0x5a4815){while(--_0x5a4815){_0x41b84b['push'](_0x41b84b['shift']());}};_0x27d373(++_0x50668e);}(_0xa9c4,0x1ba));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4a9c('0x0'));var moment=require('moment');module[_0x4a9c('0x1')]={'channel':{'type':Sequelize[_0x4a9c('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4a9c('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x4a9c('0x3'),'comment':_0x4a9c('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x4a9c('0x5')]},'exitAt':{'type':Sequelize[_0x4a9c('0x5')],'set':function(_0x52ff4c){var _0x15d319=moment(_0x52ff4c);var _0x3a6767=moment(this[_0x4a9c('0x6')](_0x4a9c('0x7')));var _0x4d0bff=_0x15d319[_0x4a9c('0x8')](_0x3a6767,_0x4a9c('0x9'));this[_0x4a9c('0xa')](_0x4a9c('0xb'),_0x52ff4c);this[_0x4a9c('0xa')](_0x4a9c('0xc'),_0x4d0bff>=0x0?_0x4d0bff:null);}},'data1':{'type':Sequelize[_0x4a9c('0x2')],'comment':_0x4a9c('0xd')},'data2':{'type':Sequelize[_0x4a9c('0x2')],'comment':_0x4a9c('0xe')},'data3':{'type':Sequelize[_0x4a9c('0x2')],'comment':_0x4a9c('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x4a9c('0x10')},'data5':{'type':Sequelize[_0x4a9c('0x2')],'comment':_0x4a9c('0x11')},'role':{'type':Sequelize[_0x4a9c('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4a9c('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 93c96d9..c803ed7 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x5121df,_0x5f41f7){_0x5121df=_0x5121df-0x0;var _0x5ac69e=_0x34e8[_0x5121df];return _0x5ac69e;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x34e8,0x12c));var _0x834e=function(_0x4c7448,_0x2f6a5d){_0x4c7448=_0x4c7448-0x0;var _0xe64562=_0x34e8[_0x4c7448];return _0xe64562;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index bebbcde..2b6013b 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 _0x9c94=['bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash','util','api'];(function(_0xc64242,_0x1dca2c){var _0x5b197c=function(_0x14b616){while(--_0x14b616){_0xc64242['push'](_0xc64242['shift']());}};_0x5b197c(++_0x1dca2c);}(_0x9c94,0x99));var _0x49c9=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x9c94[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var logger=require('../../config/logger')(_0x49c9('0x2'));var moment=require('moment');var BPromise=require(_0x49c9('0x3'));var rp=require(_0x49c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c9('0x5'));var config=require(_0x49c9('0x6'));var attributes=require(_0x49c9('0x7'));module['exports']=function(_0x16bfb0,_0x492954){return _0x16bfb0[_0x49c9('0x8')]('MemberReport',attributes,{'tableName':_0x49c9('0x9'),'paranoid':![],'indexes':[{'name':_0x49c9('0xa'),'fields':[_0x49c9('0xb'),_0x49c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe43=['membername_interface','membername','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member'];(function(_0x506090,_0x44d91c){var _0x152fc3=function(_0x660ab1){while(--_0x660ab1){_0x506090['push'](_0x506090['shift']());}};_0x152fc3(++_0x44d91c);}(_0xfe43,0x120));var _0x3fe4=function(_0x877e0f,_0x5b95d8){_0x877e0f=_0x877e0f-0x0;var _0x4e5ec1=_0xfe43[_0x877e0f];return _0x4e5ec1;};'use strict';var _=require(_0x3fe4('0x0'));var util=require('util');var logger=require(_0x3fe4('0x1'))(_0x3fe4('0x2'));var moment=require('moment');var BPromise=require(_0x3fe4('0x3'));var rp=require(_0x3fe4('0x4'));var fs=require('fs');var path=require(_0x3fe4('0x5'));var rimraf=require(_0x3fe4('0x6'));var config=require('../../config/environment');var attributes=require(_0x3fe4('0x7'));module[_0x3fe4('0x8')]=function(_0x4b27cc,_0x219abc){return _0x4b27cc[_0x3fe4('0x9')]('MemberReport',attributes,{'tableName':_0x3fe4('0xa'),'paranoid':![],'indexes':[{'name':_0x3fe4('0xb'),'fields':[_0x3fe4('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8c24607..aa72e30 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 _0x4553=['body','UpdateMemberReport','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','findAll','options','raw','where','limit','include','model','attributes','map','catch','CreateMemberReport','MemberReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4553,0x1be));var _0x3455=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x4553[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require(_0x3455('0x0'));var moment=require(_0x3455('0x1'));var BPromise=require(_0x3455('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3455('0x3'))['db'];var utils=require(_0x3455('0x4'));var logger=require(_0x3455('0x5'))(_0x3455('0x6'));var config=require(_0x3455('0x7'));var jayson=require(_0x3455('0x8'));var client=jayson[_0x3455('0x9')][_0x3455('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e1e1f,_0x5b61bb,_0x362d07){return new BPromise(function(_0x4c0c61,_0x2ced4a){return client['request'](_0x3e1e1f,_0x362d07)[_0x3455('0xb')](function(_0xe8aa2e){logger[_0x3455('0xc')]('MemberReport,\x20%s,\x20%s',_0x5b61bb,'request\x20sent');logger[_0x3455('0xd')](_0x3455('0xe'),_0x5b61bb,_0x3455('0xf'),JSON[_0x3455('0x10')](_0xe8aa2e));if(_0xe8aa2e[_0x3455('0x11')]){if(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x12')]===0x1f4){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x2ced4a(_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);}logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0xe8aa2e[_0x3455('0x11')][_0x3455('0x14')]);return _0x4c0c61(_0xe8aa2e['error'][_0x3455('0x14')]);}else{logger[_0x3455('0xc')](_0x3455('0x13'),_0x5b61bb,_0x3455('0xf'));_0x4c0c61(_0xe8aa2e[_0x3455('0x15')][_0x3455('0x14')]);}})['catch'](function(_0x383b55){logger[_0x3455('0x11')](_0x3455('0x13'),_0x5b61bb,_0x383b55);_0x2ced4a(_0x383b55);});});}exports[_0x3455('0x16')]=function(_0x4d3915){var _0x178518=this;return new Promise(function(_0x59d493,_0x157310){return db['MemberReport'][_0x3455('0x17')]({'raw':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x19')]===undefined?!![]:![]:!![],'where':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x1a')]||null:null,'attributes':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')]['attributes']||null:null,'limit':_0x4d3915[_0x3455('0x18')]?_0x4d3915[_0x3455('0x18')][_0x3455('0x1b')]||null:null,'include':_0x4d3915['options']?_0x4d3915[_0x3455('0x18')][_0x3455('0x1c')]?_['map'](_0x4d3915['options'][_0x3455('0x1c')],function(_0x13b9af){return{'model':db[_0x13b9af[_0x3455('0x1d')]],'as':_0x13b9af['as'],'attributes':_0x13b9af[_0x3455('0x1e')],'include':_0x13b9af['include']?_[_0x3455('0x1f')](_0x13b9af['include'],function(_0x252f87){return{'model':db[_0x252f87['model']],'as':_0x252f87['as'],'attributes':_0x252f87[_0x3455('0x1e')],'include':_0x252f87[_0x3455('0x1c')]?_[_0x3455('0x1f')](_0x252f87['include'],function(_0x3658a4){return{'model':db[_0x3658a4[_0x3455('0x1d')]],'as':_0x3658a4['as'],'attributes':_0x3658a4[_0x3455('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3455('0xb')](function(_0x594780){logger['info'](_0x3455('0x16'),_0x4d3915);logger[_0x3455('0xd')](_0x3455('0x16'),_0x4d3915,JSON['stringify'](_0x594780));_0x59d493(_0x594780);})[_0x3455('0x20')](function(_0x25e280){logger[_0x3455('0x11')](_0x3455('0x16'),_0x25e280['message'],_0x4d3915);_0x157310(_0x178518[_0x3455('0x11')](0x1f4,_0x25e280[_0x3455('0x14')]));});});};exports[_0x3455('0x21')]=function(_0x178bec){var _0x3ff829=this;return new Promise(function(_0x57c8ab,_0x13c62f){return db[_0x3455('0x22')]['create'](_0x178bec[_0x3455('0x23')],{'raw':_0x178bec['options']?_0x178bec[_0x3455('0x18')][_0x3455('0x19')]===undefined?!![]:![]:!![]})[_0x3455('0xb')](function(_0x1b71c0){logger['info'](_0x3455('0x21'),_0x178bec);logger['debug'](_0x3455('0x21'),_0x178bec,JSON[_0x3455('0x10')](_0x1b71c0));_0x57c8ab(_0x1b71c0);})[_0x3455('0x20')](function(_0x57d61b){logger[_0x3455('0x11')](_0x3455('0x21'),_0x57d61b['message'],_0x178bec);_0x13c62f(_0x3ff829['error'](0x1f4,_0x57d61b[_0x3455('0x14')]));});});};exports[_0x3455('0x24')]=function(_0x2b0a6e){var _0x537f47=this;return new Promise(function(_0x8c34db,_0x32534e){return db[_0x3455('0x22')]['update'](_0x2b0a6e[_0x3455('0x23')],{'raw':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1a')]||null:null,'attributes':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1e')]||null:null,'limit':_0x2b0a6e[_0x3455('0x18')]?_0x2b0a6e['options'][_0x3455('0x1b')]||null:null})[_0x3455('0xb')](function(_0x189090){logger['info'](_0x3455('0x24'),_0x2b0a6e);logger['debug'](_0x3455('0x24'),_0x2b0a6e,JSON[_0x3455('0x10')](_0x189090));_0x8c34db(_0x189090);})['catch'](function(_0x478d93){logger[_0x3455('0x11')](_0x3455('0x24'),_0x478d93['message'],_0x2b0a6e);_0x32534e(_0x537f47[_0x3455('0x11')](0x1f4,_0x478d93[_0x3455('0x14')]));});});}; \ No newline at end of file +var _0x3e4d=['where','attributes','limit','map','include','model','CreateMemberReport','body','info','debug','catch','UpdateMemberReport','update','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetMemberReport','MemberReport','options','raw'];(function(_0x57eebd,_0x561057){var _0x343a79=function(_0x5e2cb4){while(--_0x5e2cb4){_0x57eebd['push'](_0x57eebd['shift']());}};_0x343a79(++_0x561057);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x5bb086,_0x22ea54){_0x5bb086=_0x5bb086-0x0;var _0x3284f1=_0x3e4d[_0x5bb086];return _0x3284f1;};'use strict';var _=require(_0xd3e4('0x0'));var util=require('util');var moment=require(_0xd3e4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3e4('0x2'))['db'];var utils=require(_0xd3e4('0x3'));var logger=require(_0xd3e4('0x4'))('rpc');var config=require(_0xd3e4('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3e4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x41d37a,_0x2b3e19,_0x381eeb){return new BPromise(function(_0xd1a5bf,_0x4b3954){return client[_0xd3e4('0x7')](_0x41d37a,_0x381eeb)[_0xd3e4('0x8')](function(_0x279f4c){logger['info'](_0xd3e4('0x9'),_0x2b3e19,_0xd3e4('0xa'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x2b3e19,_0xd3e4('0xa'),JSON[_0xd3e4('0xb')](_0x279f4c));if(_0x279f4c[_0xd3e4('0xc')]){if(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xd')]===0x1f4){logger[_0xd3e4('0xc')](_0xd3e4('0x9'),_0x2b3e19,_0x279f4c['error'][_0xd3e4('0xe')]);return _0x4b3954(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xe')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x2b3e19,_0x279f4c[_0xd3e4('0xc')]['message']);return _0xd1a5bf(_0x279f4c[_0xd3e4('0xc')][_0xd3e4('0xe')]);}else{logger['info'](_0xd3e4('0x9'),_0x2b3e19,_0xd3e4('0xa'));_0xd1a5bf(_0x279f4c['result']['message']);}})['catch'](function(_0x353f84){logger[_0xd3e4('0xc')](_0xd3e4('0x9'),_0x2b3e19,_0x353f84);_0x4b3954(_0x353f84);});});}exports[_0xd3e4('0xf')]=function(_0xcf261b){var _0x48d143=this;return new Promise(function(_0x1a6d65,_0x210540){return db[_0xd3e4('0x10')]['findAll']({'raw':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x12')]===undefined?!![]:![]:!![],'where':_0xcf261b['options']?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x13')]||null:null,'attributes':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x14')]||null:null,'limit':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')][_0xd3e4('0x15')]||null:null,'include':_0xcf261b[_0xd3e4('0x11')]?_0xcf261b[_0xd3e4('0x11')]['include']?_[_0xd3e4('0x16')](_0xcf261b['options'][_0xd3e4('0x17')],function(_0x4281e5){return{'model':db[_0x4281e5[_0xd3e4('0x18')]],'as':_0x4281e5['as'],'attributes':_0x4281e5[_0xd3e4('0x14')],'include':_0x4281e5[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x4281e5[_0xd3e4('0x17')],function(_0x4d24ab){return{'model':db[_0x4d24ab['model']],'as':_0x4d24ab['as'],'attributes':_0x4d24ab[_0xd3e4('0x14')],'include':_0x4d24ab[_0xd3e4('0x17')]?_[_0xd3e4('0x16')](_0x4d24ab[_0xd3e4('0x17')],function(_0x868020){return{'model':db[_0x868020[_0xd3e4('0x18')]],'as':_0x868020['as'],'attributes':_0x868020[_0xd3e4('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bfec1){logger['info'](_0xd3e4('0xf'),_0xcf261b);logger['debug'](_0xd3e4('0xf'),_0xcf261b,JSON[_0xd3e4('0xb')](_0x4bfec1));_0x1a6d65(_0x4bfec1);})['catch'](function(_0x250e70){logger[_0xd3e4('0xc')](_0xd3e4('0xf'),_0x250e70[_0xd3e4('0xe')],_0xcf261b);_0x210540(_0x48d143[_0xd3e4('0xc')](0x1f4,_0x250e70[_0xd3e4('0xe')]));});});};exports[_0xd3e4('0x19')]=function(_0x2f0571){var _0x2ba847=this;return new Promise(function(_0x5c384f,_0x5548ef){return db[_0xd3e4('0x10')]['create'](_0x2f0571[_0xd3e4('0x1a')],{'raw':_0x2f0571['options']?_0x2f0571['options']['raw']===undefined?!![]:![]:!![]})[_0xd3e4('0x8')](function(_0x30a324){logger[_0xd3e4('0x1b')]('CreateMemberReport',_0x2f0571);logger[_0xd3e4('0x1c')](_0xd3e4('0x19'),_0x2f0571,JSON[_0xd3e4('0xb')](_0x30a324));_0x5c384f(_0x30a324);})[_0xd3e4('0x1d')](function(_0x262ea5){logger[_0xd3e4('0xc')]('CreateMemberReport',_0x262ea5['message'],_0x2f0571);_0x5548ef(_0x2ba847[_0xd3e4('0xc')](0x1f4,_0x262ea5['message']));});});};exports[_0xd3e4('0x1e')]=function(_0x373c99){var _0x42d363=this;return new Promise(function(_0x58c9b1,_0x11e6b8){return db['MemberReport'][_0xd3e4('0x1f')](_0x373c99[_0xd3e4('0x1a')],{'raw':_0x373c99[_0xd3e4('0x11')]?_0x373c99[_0xd3e4('0x11')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x373c99[_0xd3e4('0x11')]?_0x373c99['options'][_0xd3e4('0x13')]||null:null,'attributes':_0x373c99[_0xd3e4('0x11')]?_0x373c99[_0xd3e4('0x11')]['attributes']||null:null,'limit':_0x373c99[_0xd3e4('0x11')]?_0x373c99[_0xd3e4('0x11')][_0xd3e4('0x15')]||null:null})[_0xd3e4('0x8')](function(_0xd2c61e){logger[_0xd3e4('0x1b')](_0xd3e4('0x1e'),_0x373c99);logger[_0xd3e4('0x1c')](_0xd3e4('0x1e'),_0x373c99,JSON[_0xd3e4('0xb')](_0xd2c61e));_0x58c9b1(_0xd2c61e);})[_0xd3e4('0x1d')](function(_0x13ea6e){logger['error'](_0xd3e4('0x1e'),_0x13ea6e[_0xd3e4('0xe')],_0x373c99);_0x11e6b8(_0x42d363[_0xd3e4('0xc')](0x1f4,_0x13ea6e[_0xd3e4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 269a9d0..32879d9 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 _0xaa96=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xaa96,0x145));var _0x6aa9=function(_0x335647,_0x13f7a0){_0x335647=_0x335647-0x0;var _0x5dbf94=_0xaa96[_0x335647];return _0x5dbf94;};'use strict';var multer=require('multer');var util=require(_0x6aa9('0x0'));var path=require(_0x6aa9('0x1'));var timeout=require(_0x6aa9('0x2'));var express=require(_0x6aa9('0x3'));var router=express[_0x6aa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa9('0x5'));var interaction=require(_0x6aa9('0x6'));var config=require(_0x6aa9('0x7'));var controller=require(_0x6aa9('0x8'));router[_0x6aa9('0x9')]('/',controller[_0x6aa9('0xa')]);module[_0x6aa9('0xb')]=router; \ No newline at end of file +var _0xd90b=['multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x3480e9,_0x1ce980){var _0x389aad=function(_0x4b6bda){while(--_0x4b6bda){_0x3480e9['push'](_0x3480e9['shift']());}};_0x389aad(++_0x1ce980);}(_0xd90b,0xbd));var _0xbd90=function(_0x4a26d4,_0x355350){_0x4a26d4=_0x4a26d4-0x0;var _0x225203=_0xd90b[_0x4a26d4];return _0x225203;};'use strict';var multer=require(_0xbd90('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd90('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x3'));var config=require(_0xbd90('0x4'));var controller=require(_0xbd90('0x5'));router[_0xbd90('0x6')]('/',controller[_0xbd90('0x7')]);module[_0xbd90('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 16cb6b0..d7449cf 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 _0x5947=['sequelize','exports','STRING','version'];(function(_0x1d0c95,_0x1e2a16){var _0x16caf4=function(_0x2fb7e9){while(--_0x2fb7e9){_0x1d0c95['push'](_0x1d0c95['shift']());}};_0x16caf4(++_0x1e2a16);}(_0x5947,0x78));var _0x7594=function(_0x1e5b73,_0x3d7907){_0x1e5b73=_0x1e5b73-0x0;var _0x5b7503=_0x5947[_0x1e5b73];return _0x5b7503;};'use strict';var Sequelize=require(_0x7594('0x0'));module[_0x7594('0x1')]={'version':{'type':Sequelize[_0x7594('0x2')],'unique':_0x7594('0x3')}}; \ No newline at end of file +var _0x3129=['exports','STRING','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3129,0xa2));var _0x9312=function(_0x13f1c4,_0x135f1f){_0x13f1c4=_0x13f1c4-0x0;var _0x29746a=_0x3129[_0x13f1c4];return _0x29746a;};'use strict';var Sequelize=require('sequelize');module[_0x9312('0x0')]={'version':{'type':Sequelize[_0x9312('0x1')],'unique':_0x9312('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 53c00b3..12bce47 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 _0x8ec9=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8ec9,0x8d));var _0x98ec=function(_0x3090d3,_0x1994b2){_0x3090d3=_0x3090d3-0x0;var _0x4251c1=_0x8ec9[_0x3090d3];return _0x4251c1;};'use strict';var emlformat=require(_0x98ec('0x0'));var rimraf=require(_0x98ec('0x1'));var zipdir=require(_0x98ec('0x2'));var jsonpatch=require(_0x98ec('0x3'));var rp=require('request-promise');var moment=require(_0x98ec('0x4'));var BPromise=require(_0x98ec('0x5'));var Mustache=require(_0x98ec('0x6'));var util=require(_0x98ec('0x7'));var path=require(_0x98ec('0x8'));var sox=require(_0x98ec('0x9'));var csv=require(_0x98ec('0xa'));var ejs=require(_0x98ec('0xb'));var fs=require('fs');var fs_extra=require(_0x98ec('0xc'));var _=require(_0x98ec('0xd'));var squel=require(_0x98ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x98ec('0xf'));var deskjs=require(_0x98ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98ec('0x11'));var Papa=require('papaparse');var Redis=require(_0x98ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ec('0x13'));var as=require(_0x98ec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98ec('0x15'));var utils=require(_0x98ec('0x16'));var config=require(_0x98ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ec('0x18'))['db'];function respondWithStatusCode(_0x3e42bc,_0x3de5cb){_0x3de5cb=_0x3de5cb||0xcc;return function(_0x25b432){if(_0x25b432){return _0x3e42bc['sendStatus'](_0x3de5cb);}return _0x3e42bc[_0x98ec('0x19')](_0x3de5cb)[_0x98ec('0x1a')]();};}function respondWithResult(_0x5a5fa0,_0x5e41eb){_0x5e41eb=_0x5e41eb||0xc8;return function(_0x347ed3){if(_0x347ed3){return _0x5a5fa0[_0x98ec('0x19')](_0x5e41eb)[_0x98ec('0x1b')](_0x347ed3);}};}function respondWithFilteredResult(_0x5a6fcd,_0x2f68fb){return function(_0x20e85d){if(_0x20e85d){var _0x69df1b=typeof _0x2f68fb[_0x98ec('0x1c')]===_0x98ec('0x1d')&&typeof _0x2f68fb[_0x98ec('0x1e')]===_0x98ec('0x1d');var _0x27b867=_0x20e85d['count'];var _0x454fd1=_0x69df1b?0x0:_0x2f68fb[_0x98ec('0x1c')];var _0x22f588=_0x69df1b?_0x20e85d[_0x98ec('0x1f')]:_0x2f68fb[_0x98ec('0x1c')]+_0x2f68fb[_0x98ec('0x1e')];var _0xe7d1e0;if(_0x22f588>=_0x27b867){_0x22f588=_0x27b867;_0xe7d1e0=0xc8;}else{_0xe7d1e0=0xce;}_0x5a6fcd[_0x98ec('0x19')](_0xe7d1e0);return _0x5a6fcd[_0x98ec('0x20')](_0x98ec('0x21'),_0x454fd1+'-'+_0x22f588+'/'+_0x27b867)['json'](_0x20e85d);}return null;};}function patchUpdates(_0x456994){return function(_0x279a12){try{jsonpatch[_0x98ec('0x22')](_0x279a12,_0x456994,!![]);}catch(_0x19d1a7){return BPromise[_0x98ec('0x23')](_0x19d1a7);}return _0x279a12['save']();};}function saveUpdates(_0x1e716b,_0x1454bb){return function(_0x4c56be){if(_0x4c56be){return _0x4c56be[_0x98ec('0x24')](_0x1e716b)['then'](function(_0x76c820){return _0x76c820;});}return null;};}function removeEntity(_0x945dea,_0x146565){return function(_0x5f2355){if(_0x5f2355){return _0x5f2355[_0x98ec('0x25')]()[_0x98ec('0x26')](function(){_0x945dea[_0x98ec('0x19')](0xcc)[_0x98ec('0x1a')]();});}};}function handleEntityNotFound(_0x48b53f,_0x3e5edd){return function(_0x81c7d8){if(!_0x81c7d8){_0x48b53f[_0x98ec('0x27')](0x194);}return _0x81c7d8;};}function handleError(_0x422a05,_0x37cb1e){_0x37cb1e=_0x37cb1e||0x1f4;return function(_0x132748){logger[_0x98ec('0x28')](_0x132748[_0x98ec('0x29')]);if(_0x132748[_0x98ec('0x2a')]){delete _0x132748['name'];}_0x422a05[_0x98ec('0x19')](_0x37cb1e)[_0x98ec('0x2b')](_0x132748);};}exports[_0x98ec('0x2c')]=function(_0x271a1c,_0x2640ac){var _0x22ca13={},_0x4ddb56={},_0x1f37c1={'count':0x0,'rows':[]};var _0x20b50e=_[_0x98ec('0x2d')](db[_0x98ec('0x2e')][_0x98ec('0x2f')],function(_0xc5beab){return{'name':_0xc5beab[_0x98ec('0x30')],'type':_0xc5beab['type'][_0x98ec('0x31')]};});_0x4ddb56['model']=_['map'](_0x20b50e,_0x98ec('0x2a'));_0x4ddb56['query']=_['keys'](_0x271a1c[_0x98ec('0x32')]);_0x4ddb56[_0x98ec('0x33')]=_['intersection'](_0x4ddb56[_0x98ec('0x34')],_0x4ddb56[_0x98ec('0x32')]);_0x22ca13['attributes']=_[_0x98ec('0x35')](_0x4ddb56[_0x98ec('0x34')],qs[_0x98ec('0x36')](_0x271a1c[_0x98ec('0x32')]['fields']));_0x22ca13['attributes']=_0x22ca13[_0x98ec('0x37')][_0x98ec('0x38')]?_0x22ca13['attributes']:_0x4ddb56[_0x98ec('0x34')];if(!_0x271a1c[_0x98ec('0x32')][_0x98ec('0x39')](_0x98ec('0x3a'))){_0x22ca13['limit']=qs[_0x98ec('0x1e')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x1e')]);_0x22ca13[_0x98ec('0x1c')]=qs[_0x98ec('0x1c')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x1c')]);}_0x22ca13[_0x98ec('0x3b')]=qs[_0x98ec('0x3c')](_0x271a1c[_0x98ec('0x32')][_0x98ec('0x3c')]);_0x22ca13[_0x98ec('0x3d')]=qs[_0x98ec('0x33')](_[_0x98ec('0x3e')](_0x271a1c[_0x98ec('0x32')],_0x4ddb56[_0x98ec('0x33')]),_0x20b50e);if(_0x271a1c[_0x98ec('0x32')][_0x98ec('0x3f')]){_0x22ca13[_0x98ec('0x3d')]=_['merge'](_0x22ca13[_0x98ec('0x3d')],{'$or':_[_0x98ec('0x2d')](_0x20b50e,function(_0x82a25c){if(_0x82a25c[_0x98ec('0x40')]!==_0x98ec('0x41')){var _0x3629c2={};_0x3629c2[_0x82a25c[_0x98ec('0x2a')]]={'$like':'%'+_0x271a1c['query']['filter']+'%'};return _0x3629c2;}})});}_0x22ca13=_[_0x98ec('0x42')]({},_0x22ca13,_0x271a1c[_0x98ec('0x43')]);var _0x4db245={'where':_0x22ca13['where']};return db['Migration']['count'](_0x4db245)[_0x98ec('0x26')](function(_0x20c249){_0x1f37c1['count']=_0x20c249;if(_0x271a1c[_0x98ec('0x32')][_0x98ec('0x44')]){_0x22ca13[_0x98ec('0x45')]=[{'all':!![]}];}return db[_0x98ec('0x2e')][_0x98ec('0x46')](_0x22ca13);})[_0x98ec('0x26')](function(_0x50e0ff){_0x1f37c1[_0x98ec('0x47')]=_0x50e0ff;return _0x1f37c1;})[_0x98ec('0x26')](respondWithFilteredResult(_0x2640ac,_0x22ca13))[_0x98ec('0x48')](handleError(_0x2640ac,null));}; \ No newline at end of file +var _0x48f8=['json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','Migration','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5d632b,_0x303abd){var _0x36e778=function(_0x38bcd3){while(--_0x38bcd3){_0x5d632b['push'](_0x5d632b['shift']());}};_0x36e778(++_0x303abd);}(_0x48f8,0x127));var _0x848f=function(_0x58b773,_0x15f572){_0x58b773=_0x58b773-0x0;var _0x2b3dc1=_0x48f8[_0x58b773];return _0x2b3dc1;};'use strict';var emlformat=require(_0x848f('0x0'));var rimraf=require(_0x848f('0x1'));var zipdir=require(_0x848f('0x2'));var jsonpatch=require(_0x848f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x848f('0x4'));var Mustache=require(_0x848f('0x5'));var util=require('util');var path=require(_0x848f('0x6'));var sox=require('sox');var csv=require(_0x848f('0x7'));var ejs=require(_0x848f('0x8'));var fs=require('fs');var fs_extra=require(_0x848f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x848f('0xa'));var jsforce=require(_0x848f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x848f('0x7'));var querystring=require(_0x848f('0xc'));var Papa=require('papaparse');var Redis=require(_0x848f('0xd'));var authService=require(_0x848f('0xe'));var qs=require(_0x848f('0xf'));var as=require(_0x848f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x848f('0x11'))(_0x848f('0x12'));var utils=require('../../config/utils');var config=require(_0x848f('0x13'));var licenseUtil=require(_0x848f('0x14'));var db=require(_0x848f('0x15'))['db'];function respondWithStatusCode(_0x1d37a8,_0x1ae7ab){_0x1ae7ab=_0x1ae7ab||0xcc;return function(_0x4e977d){if(_0x4e977d){return _0x1d37a8[_0x848f('0x16')](_0x1ae7ab);}return _0x1d37a8[_0x848f('0x17')](_0x1ae7ab)[_0x848f('0x18')]();};}function respondWithResult(_0x5c5f32,_0x32d657){_0x32d657=_0x32d657||0xc8;return function(_0x48aaa7){if(_0x48aaa7){return _0x5c5f32[_0x848f('0x17')](_0x32d657)[_0x848f('0x19')](_0x48aaa7);}};}function respondWithFilteredResult(_0x5981bb,_0x289623){return function(_0x126d7e){if(_0x126d7e){var _0x70e3d4=typeof _0x289623[_0x848f('0x1a')]===_0x848f('0x1b')&&typeof _0x289623['limit']==='undefined';var _0x31cab8=_0x126d7e[_0x848f('0x1c')];var _0x427aed=_0x70e3d4?0x0:_0x289623['offset'];var _0x1c0a96=_0x70e3d4?_0x126d7e['count']:_0x289623[_0x848f('0x1a')]+_0x289623['limit'];var _0x5c65b2;if(_0x1c0a96>=_0x31cab8){_0x1c0a96=_0x31cab8;_0x5c65b2=0xc8;}else{_0x5c65b2=0xce;}_0x5981bb[_0x848f('0x17')](_0x5c65b2);return _0x5981bb[_0x848f('0x1d')](_0x848f('0x1e'),_0x427aed+'-'+_0x1c0a96+'/'+_0x31cab8)[_0x848f('0x19')](_0x126d7e);}return null;};}function patchUpdates(_0x46372b){return function(_0x93a5ca){try{jsonpatch['apply'](_0x93a5ca,_0x46372b,!![]);}catch(_0x221d0c){return BPromise[_0x848f('0x1f')](_0x221d0c);}return _0x93a5ca[_0x848f('0x20')]();};}function saveUpdates(_0x6fd604,_0x6c2d25){return function(_0x2f099b){if(_0x2f099b){return _0x2f099b[_0x848f('0x21')](_0x6fd604)[_0x848f('0x22')](function(_0xc62a61){return _0xc62a61;});}return null;};}function removeEntity(_0x5d68b5,_0x30bd78){return function(_0x5ece6b){if(_0x5ece6b){return _0x5ece6b['destroy']()[_0x848f('0x22')](function(){_0x5d68b5[_0x848f('0x17')](0xcc)[_0x848f('0x18')]();});}};}function handleEntityNotFound(_0xee4f7,_0x2c8d9a){return function(_0x1b0a02){if(!_0x1b0a02){_0xee4f7[_0x848f('0x16')](0x194);}return _0x1b0a02;};}function handleError(_0x1b3a10,_0x47a01e){_0x47a01e=_0x47a01e||0x1f4;return function(_0x54bba7){logger[_0x848f('0x23')](_0x54bba7[_0x848f('0x24')]);if(_0x54bba7[_0x848f('0x25')]){delete _0x54bba7[_0x848f('0x25')];}_0x1b3a10['status'](_0x47a01e)[_0x848f('0x26')](_0x54bba7);};}exports['index']=function(_0x90b819,_0x85e624){var _0x5e8737={},_0x26e246={},_0x45d8f7={'count':0x0,'rows':[]};var _0xe42cf5=_[_0x848f('0x27')](db[_0x848f('0x28')][_0x848f('0x29')],function(_0x15ed96){return{'name':_0x15ed96[_0x848f('0x2a')],'type':_0x15ed96['type'][_0x848f('0x2b')]};});_0x26e246['model']=_[_0x848f('0x27')](_0xe42cf5,'name');_0x26e246['query']=_['keys'](_0x90b819[_0x848f('0x2c')]);_0x26e246[_0x848f('0x2d')]=_[_0x848f('0x2e')](_0x26e246[_0x848f('0x2f')],_0x26e246['query']);_0x5e8737['attributes']=_[_0x848f('0x2e')](_0x26e246[_0x848f('0x2f')],qs[_0x848f('0x30')](_0x90b819['query'][_0x848f('0x30')]));_0x5e8737[_0x848f('0x31')]=_0x5e8737[_0x848f('0x31')]['length']?_0x5e8737['attributes']:_0x26e246['model'];if(!_0x90b819['query'][_0x848f('0x32')]('nolimit')){_0x5e8737[_0x848f('0x33')]=qs[_0x848f('0x33')](_0x90b819[_0x848f('0x2c')][_0x848f('0x33')]);_0x5e8737[_0x848f('0x1a')]=qs[_0x848f('0x1a')](_0x90b819[_0x848f('0x2c')][_0x848f('0x1a')]);}_0x5e8737[_0x848f('0x34')]=qs[_0x848f('0x35')](_0x90b819[_0x848f('0x2c')][_0x848f('0x35')]);_0x5e8737['where']=qs[_0x848f('0x2d')](_['pick'](_0x90b819[_0x848f('0x2c')],_0x26e246[_0x848f('0x2d')]),_0xe42cf5);if(_0x90b819['query'][_0x848f('0x36')]){_0x5e8737[_0x848f('0x37')]=_[_0x848f('0x38')](_0x5e8737['where'],{'$or':_[_0x848f('0x27')](_0xe42cf5,function(_0x56168c){if(_0x56168c[_0x848f('0x39')]!==_0x848f('0x3a')){var _0x4af100={};_0x4af100[_0x56168c[_0x848f('0x25')]]={'$like':'%'+_0x90b819[_0x848f('0x2c')][_0x848f('0x36')]+'%'};return _0x4af100;}})});}_0x5e8737=_['merge']({},_0x5e8737,_0x90b819[_0x848f('0x3b')]);var _0x54cc01={'where':_0x5e8737[_0x848f('0x37')]};return db['Migration']['count'](_0x54cc01)[_0x848f('0x22')](function(_0x2ea4a1){_0x45d8f7[_0x848f('0x1c')]=_0x2ea4a1;if(_0x90b819[_0x848f('0x2c')][_0x848f('0x3c')]){_0x5e8737[_0x848f('0x3d')]=[{'all':!![]}];}return db[_0x848f('0x28')][_0x848f('0x3e')](_0x5e8737);})['then'](function(_0x563d8e){_0x45d8f7[_0x848f('0x3f')]=_0x563d8e;return _0x45d8f7;})['then'](respondWithFilteredResult(_0x85e624,_0x5e8737))['catch'](handleError(_0x85e624,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b8c90d4..8d5de6b 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 _0x8c0f=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations'];(function(_0x204b6d,_0x227d95){var _0x3003f5=function(_0x128eda){while(--_0x128eda){_0x204b6d['push'](_0x204b6d['shift']());}};_0x3003f5(++_0x227d95);}(_0x8c0f,0xdc));var _0xf8c0=function(_0x34f8b4,_0x53e364){_0x34f8b4=_0x34f8b4-0x0;var _0x2c41bb=_0x8c0f[_0x34f8b4];return _0x2c41bb;};'use strict';var _=require('lodash');var util=require(_0xf8c0('0x0'));var logger=require(_0xf8c0('0x1'))(_0xf8c0('0x2'));var moment=require(_0xf8c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf8c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8c0('0x5'));var config=require(_0xf8c0('0x6'));var attributes=require('./migration.attributes');module[_0xf8c0('0x7')]=function(_0x2806b4,_0x597220){return _0x2806b4[_0xf8c0('0x8')](_0xf8c0('0x9'),attributes,{'tableName':_0xf8c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc23=['Migration','migrations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x3c1b83,_0xb13dc6){var _0x18da28=function(_0x280762){while(--_0x280762){_0x3c1b83['push'](_0x3c1b83['shift']());}};_0x18da28(++_0xb13dc6);}(_0xbc23,0x7b));var _0x3bc2=function(_0x4c4e74,_0x968238){_0x4c4e74=_0x4c4e74-0x0;var _0x32c1b3=_0xbc23[_0x4c4e74];return _0x32c1b3;};'use strict';var _=require('lodash');var util=require(_0x3bc2('0x0'));var logger=require(_0x3bc2('0x1'))(_0x3bc2('0x2'));var moment=require('moment');var BPromise=require(_0x3bc2('0x3'));var rp=require(_0x3bc2('0x4'));var fs=require('fs');var path=require(_0x3bc2('0x5'));var rimraf=require(_0x3bc2('0x6'));var config=require('../../config/environment');var attributes=require(_0x3bc2('0x7'));module[_0x3bc2('0x8')]=function(_0x408311,_0x2f201f){return _0x408311['define'](_0x3bc2('0x9'),attributes,{'tableName':_0x3bc2('0xa'),'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 b3f9654..238ff09 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 _0x44f8=['moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44f8,0x1de));var _0x844f=function(_0x1a97df,_0x3b39cf){_0x1a97df=_0x1a97df-0x0;var _0x26a053=_0x44f8[_0x1a97df];return _0x26a053;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Migration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Migration,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});} \ No newline at end of file +var _0xb945=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb945,0x97));var _0x5b94=function(_0x29c436,_0x325ca6){_0x29c436=_0x29c436-0x0;var _0x57cec3=_0xb945[_0x29c436];return _0x57cec3;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var moment=require(_0x5b94('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b94('0x3'));var logger=require(_0x5b94('0x4'))(_0x5b94('0x5'));var config=require(_0x5b94('0x6'));var jayson=require(_0x5b94('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2db8d8,_0x2cfea8,_0x42bd69){return new BPromise(function(_0x186d22,_0x5d2448){return client[_0x5b94('0x8')](_0x2db8d8,_0x42bd69)['then'](function(_0x3e7695){logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,_0x5b94('0xb'));logger[_0x5b94('0xc')](_0x5b94('0xd'),_0x2cfea8,_0x5b94('0xb'),JSON['stringify'](_0x3e7695));if(_0x3e7695[_0x5b94('0xe')]){if(_0x3e7695['error'][_0x5b94('0xf')]===0x1f4){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')][_0x5b94('0x10')]);return _0x5d2448(_0x3e7695['error'][_0x5b94('0x10')]);}logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x3e7695[_0x5b94('0xe')]['message']);return _0x186d22(_0x3e7695[_0x5b94('0xe')]['message']);}else{logger[_0x5b94('0x9')](_0x5b94('0xa'),_0x2cfea8,'request\x20sent');_0x186d22(_0x3e7695[_0x5b94('0x11')][_0x5b94('0x10')]);}})[_0x5b94('0x12')](function(_0x537c8e){logger[_0x5b94('0xe')](_0x5b94('0xa'),_0x2cfea8,_0x537c8e);_0x5d2448(_0x537c8e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index add06c6..e3bb4b4 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 _0x0b78=['show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','./network.controller','get','isAuthenticated','index','/:id'];(function(_0xad78ed,_0x94b25){var _0x34e0b5=function(_0x4f9c13){while(--_0x4f9c13){_0xad78ed['push'](_0xad78ed['shift']());}};_0x34e0b5(++_0x94b25);}(_0x0b78,0x1d6));var _0x80b7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0b78[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x80b7('0x0'));var path=require(_0x80b7('0x1'));var timeout=require(_0x80b7('0x2'));var express=require('express');var router=express[_0x80b7('0x3')]();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80b7('0x5'));router[_0x80b7('0x6')]('/',auth[_0x80b7('0x7')](),controller[_0x80b7('0x8')]);router[_0x80b7('0x6')](_0x80b7('0x9'),auth['isAuthenticated'](),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')]('/',auth[_0x80b7('0x7')](),controller['create']);router['put'](_0x80b7('0x9'),auth['isAuthenticated'](),controller[_0x80b7('0xc')]);router[_0x80b7('0xd')]('/:id',auth[_0x80b7('0x7')](),controller[_0x80b7('0xe')]);module[_0x80b7('0xf')]=router; \ No newline at end of file +var _0xbe54=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','./network.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x377940,_0x1560bf){var _0x36c9b6=function(_0x4c15e6){while(--_0x4c15e6){_0x377940['push'](_0x377940['shift']());}};_0x36c9b6(++_0x1560bf);}(_0xbe54,0x9e));var _0x4be5=function(_0x35f353,_0xc48d49){_0x35f353=_0x35f353-0x0;var _0x2f6fc8=_0xbe54[_0x35f353];return _0x2f6fc8;};'use strict';var multer=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var path=require('path');var timeout=require(_0x4be5('0x2'));var express=require('express');var router=express[_0x4be5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4be5('0x4'));router['get']('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0x6')]);router[_0x4be5('0x7')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0x8')]);router[_0x4be5('0x9')]('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0xa')]);router[_0x4be5('0xb')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0xc')]);router[_0x4be5('0xd')](_0x4be5('0xe'),auth[_0x4be5('0x5')](),controller[_0x4be5('0xf')]);module[_0x4be5('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f9066ca..a6a5420 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 _0xd657=['externip','turn','STRING','ENUM','localnet'];(function(_0x37d72d,_0x27d166){var _0x830cdd=function(_0x1d694a){while(--_0x1d694a){_0x37d72d['push'](_0x37d72d['shift']());}};_0x830cdd(++_0x27d166);}(_0xd657,0x111));var _0x7d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd657[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7d65('0x0')](_0x7d65('0x1'),_0x7d65('0x2'),'stun',_0x7d65('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7d65('0x4')]},'password':{'type':Sequelize[_0x7d65('0x4')]}}; \ No newline at end of file +var _0x8819=['exports','ENUM','localnet','stun','turn','STRING','sequelize'];(function(_0x15c368,_0x51b650){var _0x44c82d=function(_0x419da3){while(--_0x419da3){_0x15c368['push'](_0x15c368['shift']());}};_0x44c82d(++_0x51b650);}(_0x8819,0x1b8));var _0x9881=function(_0x471d14,_0x5b0619){_0x471d14=_0x471d14-0x0;var _0x512792=_0x8819[_0x471d14];return _0x512792;};'use strict';var Sequelize=require(_0x9881('0x0'));module[_0x9881('0x1')]={'type':{'type':Sequelize[_0x9881('0x2')](_0x9881('0x3'),'externip',_0x9881('0x4'),_0x9881('0x5'))},'value':{'type':Sequelize[_0x9881('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9881('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 980c7f4..fd14aab 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 _0x6d4f=['destroy','end','sendStatus','stack','name','index','map','Network','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','type','STUN','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','writeFileSync','format','chan_sip.so','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then'];(function(_0xc831c6,_0x542b00){var _0x5063a7=function(_0x4600ee){while(--_0x4600ee){_0xc831c6['push'](_0xc831c6['shift']());}};_0x5063a7(++_0x542b00);}(_0x6d4f,0x90));var _0xf6d4=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x6d4f[_0x190ff6];return _0x5356d2;};'use strict';var util=require('util');var path=require(_0xf6d4('0x0'));var ejs=require(_0xf6d4('0x1'));var fs=require('fs');var _=require(_0xf6d4('0x2'));var qs=require(_0xf6d4('0x3'));var logger=require(_0xf6d4('0x4'))(_0xf6d4('0x5'));var config=require('../../config/environment');var db=require(_0xf6d4('0x6'))['db'];var jayson=require(_0xf6d4('0x7'));var client=jayson[_0xf6d4('0x8')][_0xf6d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a97df,_0x57b399,_0x19ae4f,_0x3925d5){return new Promise(function(_0x2dae14,_0x46de76){var _0x62ed38=_0x3925d5||client;return _0x62ed38[_0xf6d4('0xa')](_0x3a97df,_0x19ae4f)['then'](function(_0x147279){logger[_0xf6d4('0xb')](_0xf6d4('0xc'),_0x57b399,_0xf6d4('0xd'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x57b399,_0xf6d4('0xd'),JSON[_0xf6d4('0xe')](_0x147279));if(_0x147279[_0xf6d4('0xf')]){if(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x10')]===0x1f4){logger['error'](_0xf6d4('0xc'),_0x57b399,_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);return _0x46de76(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);}logger[_0xf6d4('0xf')]('Network,\x20%s,\x20%s',_0x57b399,_0x147279['error'][_0xf6d4('0x11')]);return _0x2dae14(_0x147279[_0xf6d4('0xf')][_0xf6d4('0x11')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x57b399,_0xf6d4('0xd'));_0x2dae14(_0x147279[_0xf6d4('0x12')][_0xf6d4('0x11')]);}})[_0xf6d4('0x13')](function(_0x48644d){logger['error'](_0xf6d4('0xc'),_0x57b399,_0x48644d);_0x46de76(_0x48644d);});});}function respondWithResult(_0x53c8e0,_0x252889){_0x252889=_0x252889||0xc8;return function(_0x4d02a5){if(_0x4d02a5){return _0x53c8e0[_0xf6d4('0x14')](_0x252889)[_0xf6d4('0x15')](_0x4d02a5);}};}function respondWithFilteredResult(_0x1360d9,_0x4eea51){return function(_0x4bfda5){if(_0x4bfda5){var _0x31c83f=typeof _0x4eea51['offset']===_0xf6d4('0x16')&&typeof _0x4eea51[_0xf6d4('0x17')]==='undefined';var _0x4dff5a=_0x4bfda5[_0xf6d4('0x18')];var _0x5c9b33=_0x31c83f?0x0:_0x4eea51[_0xf6d4('0x19')];var _0x28a991=_0x31c83f?_0x4bfda5['count']:_0x4eea51[_0xf6d4('0x19')]+_0x4eea51['limit'];var _0x22401c;if(_0x28a991>=_0x4dff5a){_0x28a991=_0x4dff5a;_0x22401c=0xc8;}else{_0x22401c=0xce;}_0x1360d9['status'](_0x22401c);return _0x1360d9[_0xf6d4('0x1a')](_0xf6d4('0x1b'),_0x5c9b33+'-'+_0x28a991+'/'+_0x4dff5a)[_0xf6d4('0x15')](_0x4bfda5);}return null;};}function saveUpdates(_0x2ee3da){return function(_0x1b2c06){if(_0x1b2c06){return _0x1b2c06[_0xf6d4('0x1c')](_0x2ee3da)[_0xf6d4('0x1d')](function(_0x2ac380){return _0x2ac380;});}return null;};}function removeEntity(_0x5866c2){return function(_0x5567eb){if(_0x5567eb){return _0x5567eb[_0xf6d4('0x1e')]()['then'](function(){_0x5866c2[_0xf6d4('0x14')](0xcc)[_0xf6d4('0x1f')]();});}};}function handleEntityNotFound(_0x11285a){return function(_0x1f4c8d){if(!_0x1f4c8d){_0x11285a[_0xf6d4('0x20')](0x194);}return _0x1f4c8d;};}function handleError(_0x28db3f,_0x5a4463){_0x5a4463=_0x5a4463||0x1f4;return function(_0x1bef92){logger[_0xf6d4('0xf')](_0x1bef92[_0xf6d4('0x21')]);if(_0x1bef92['name']){delete _0x1bef92[_0xf6d4('0x22')];}_0x28db3f[_0xf6d4('0x14')](_0x5a4463)['send'](_0x1bef92);};}exports[_0xf6d4('0x23')]=function(_0x92dc0,_0x9c33df){var _0x4cc53f={},_0x5968f8={},_0x568cdb={'count':0x0,'rows':[]};var _0x1c9297=_[_0xf6d4('0x24')](db[_0xf6d4('0x25')]['rawAttributes'],function(_0x423232){return{'name':_0x423232[_0xf6d4('0x26')],'type':_0x423232['type'][_0xf6d4('0x27')]};});_0x5968f8[_0xf6d4('0x28')]=_[_0xf6d4('0x24')](_0x1c9297,_0xf6d4('0x22'));_0x5968f8[_0xf6d4('0x29')]=_['keys'](_0x92dc0[_0xf6d4('0x29')]);_0x5968f8[_0xf6d4('0x2a')]=_[_0xf6d4('0x2b')](_0x5968f8[_0xf6d4('0x28')],_0x5968f8['query']);_0x4cc53f[_0xf6d4('0x2c')]=_['intersection'](_0x5968f8[_0xf6d4('0x28')],qs['fields'](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x2d')]));_0x4cc53f[_0xf6d4('0x2c')]=_0x4cc53f[_0xf6d4('0x2c')][_0xf6d4('0x2e')]?_0x4cc53f['attributes']:_0x5968f8[_0xf6d4('0x28')];if(!_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x2f')](_0xf6d4('0x30'))){_0x4cc53f[_0xf6d4('0x17')]=qs[_0xf6d4('0x17')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x17')]);_0x4cc53f[_0xf6d4('0x19')]=qs[_0xf6d4('0x19')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x19')]);}_0x4cc53f[_0xf6d4('0x31')]=qs[_0xf6d4('0x32')](_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x32')]);_0x4cc53f[_0xf6d4('0x33')]=qs['filters'](_[_0xf6d4('0x34')](_0x92dc0[_0xf6d4('0x29')],_0x5968f8[_0xf6d4('0x2a')]),_0x1c9297);if(_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x35')]){_0x4cc53f[_0xf6d4('0x33')]=_[_0xf6d4('0x36')](_0x4cc53f[_0xf6d4('0x33')],{'$or':_['map'](_0x1c9297,function(_0x4e6a6e){if(_0x4e6a6e['type']!=='VIRTUAL'){var _0x2dee7f={};_0x2dee7f[_0x4e6a6e[_0xf6d4('0x22')]]={'$like':'%'+_0x92dc0[_0xf6d4('0x29')]['filter']+'%'};return _0x2dee7f;}})});}_0x4cc53f=_[_0xf6d4('0x36')]({},_0x4cc53f,_0x92dc0[_0xf6d4('0x37')]);var _0x250fa0={'where':_0x4cc53f[_0xf6d4('0x33')]};return db[_0xf6d4('0x25')][_0xf6d4('0x18')](_0x250fa0)['then'](function(_0x2384fe){_0x568cdb['count']=_0x2384fe;if(_0x92dc0[_0xf6d4('0x29')][_0xf6d4('0x38')]){_0x4cc53f[_0xf6d4('0x39')]=[{'all':!![]}];}return db[_0xf6d4('0x25')][_0xf6d4('0x3a')](_0x4cc53f);})['then'](function(_0x1a5a9a){_0x568cdb[_0xf6d4('0x3b')]=_0x1a5a9a;return _0x568cdb;})[_0xf6d4('0x1d')](respondWithFilteredResult(_0x9c33df,_0x4cc53f))[_0xf6d4('0x13')](handleError(_0x9c33df,null));};exports['show']=function(_0x1cd10d,_0x17e1b2){var _0x56c050={'raw':!![],'where':{'id':_0x1cd10d[_0xf6d4('0x3c')]['id']}},_0x2aafa0={};_0x2aafa0[_0xf6d4('0x28')]=_[_0xf6d4('0x3d')](db[_0xf6d4('0x25')][_0xf6d4('0x3e')]);_0x2aafa0['query']=_['keys'](_0x1cd10d[_0xf6d4('0x29')]);_0x2aafa0['filters']=_[_0xf6d4('0x2b')](_0x2aafa0[_0xf6d4('0x28')],_0x2aafa0[_0xf6d4('0x29')]);_0x56c050['attributes']=_['intersection'](_0x2aafa0['model'],qs['fields'](_0x1cd10d[_0xf6d4('0x29')]['fields']));_0x56c050[_0xf6d4('0x2c')]=_0x56c050[_0xf6d4('0x2c')][_0xf6d4('0x2e')]?_0x56c050['attributes']:_0x2aafa0[_0xf6d4('0x28')];if(_0x1cd10d[_0xf6d4('0x29')]['includeAll']){_0x56c050[_0xf6d4('0x39')]=[{'all':!![]}];}_0x56c050=_['merge']({},_0x56c050,_0x1cd10d['options']);return db['Network'][_0xf6d4('0x3f')](_0x56c050)[_0xf6d4('0x1d')](handleEntityNotFound(_0x17e1b2,null))[_0xf6d4('0x1d')](respondWithResult(_0x17e1b2,null))[_0xf6d4('0x13')](handleError(_0x17e1b2,null));};exports[_0xf6d4('0x40')]=function(_0x568c7b,_0x2bf7ff){var _0x6baf89;return db[_0xf6d4('0x25')][_0xf6d4('0x40')](_0x568c7b[_0xf6d4('0x41')],{'raw':!![]})[_0xf6d4('0x1d')](function(_0x24b702){_0x6baf89=_0x24b702;return db[_0xf6d4('0x25')][_0xf6d4('0x3a')]({'where':{'type':_0x568c7b[_0xf6d4('0x41')]['type']},'raw':!![]});})[_0xf6d4('0x1d')](function(_0x555a70){if(_0x6baf89[_0xf6d4('0x42')]['toUpperCase']()==_0xf6d4('0x43')){var _0x37d89d=fs['readFileSync'](path['join'](config[_0xf6d4('0x44')],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x45'));var _0x2e3fb1=ejs[_0xf6d4('0x46')](_0x37d89d,{'networks':_0x555a70||[]});fs['writeFileSync'](_0xf6d4('0x47'),_0x2e3fb1);return respondWithRpcPromise(_0xf6d4('0x48'),'create',{'module':_0xf6d4('0x49')});}else if(_0x6baf89[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x55a70d=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x4e')),_0xf6d4('0x45'));var _0x1ec354=ejs[_0xf6d4('0x46')](_0x55a70d,{'networks':_0x555a70||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1ec354);return respondWithRpcPromise('Reload','create',{'module':_0xf6d4('0x49')});}else{var _0x48d2f1=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x322625=ejs[_0xf6d4('0x46')](_0x48d2f1,{'networks':_0x555a70||[]});fs[_0xf6d4('0x4f')](util[_0xf6d4('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x568c7b['body'][_0xf6d4('0x42')]['toLowerCase']()),_0x322625);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x40'),{'module':_0xf6d4('0x51')});}})[_0xf6d4('0x1d')](function(){return _0x6baf89;})['then'](respondWithResult(_0x2bf7ff,0xc9))['catch'](handleError(_0x2bf7ff,null));};exports[_0xf6d4('0x1c')]=function(_0x4f4a66,_0x3b6b87){var _0x21442e;return db['Network'][_0xf6d4('0x3f')]({'where':{'id':_0x4f4a66[_0xf6d4('0x3c')]['id']}})[_0xf6d4('0x1d')](handleEntityNotFound(_0x3b6b87,null))[_0xf6d4('0x1d')](saveUpdates(_0x4f4a66[_0xf6d4('0x41')],null))['then'](function(_0x1b9414){if(_0x1b9414){_0x21442e=_0x1b9414;return db[_0xf6d4('0x25')]['findAll']({'where':{'type':_0x21442e['type']},'raw':!![]});}return null;})[_0xf6d4('0x1d')](function(_0x576120){if(_0x21442e['type'][_0xf6d4('0x4a')]()==_0xf6d4('0x43')){var _0x9d1435=fs['readFileSync'](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x52')),_0xf6d4('0x45'));var _0x470981=ejs[_0xf6d4('0x46')](_0x9d1435,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x47'),_0x470981);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x21442e['type'][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x460f1f=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],'server/files/templates/turn_multiple.ejs'),_0xf6d4('0x45'));var _0x544489=ejs[_0xf6d4('0x46')](_0x460f1f,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x53'),_0x544489);return respondWithRpcPromise('Reload',_0xf6d4('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x3b741b=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config['root'],_0xf6d4('0x54')),_0xf6d4('0x45'));var _0x10da05=ejs[_0xf6d4('0x46')](_0x3b741b,{'networks':_0x576120||[]});fs[_0xf6d4('0x4f')](util[_0xf6d4('0x50')](_0xf6d4('0x55'),_0x4f4a66[_0xf6d4('0x41')][_0xf6d4('0x42')][_0xf6d4('0x56')]()),_0x10da05);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1c'),{'module':_0xf6d4('0x51')});}})[_0xf6d4('0x1d')](function(_0x216486){if(_0x216486){return _0x21442e;}return null;})[_0xf6d4('0x1d')](respondWithResult(_0x3b6b87,null))['catch'](handleError(_0x3b6b87,null));};exports[_0xf6d4('0x1e')]=function(_0x5520a2,_0x6bff88){var _0x5cf9a0;return db[_0xf6d4('0x25')][_0xf6d4('0x3f')]({'where':{'id':_0x5520a2[_0xf6d4('0x3c')]['id']}})['then'](function(_0x22b1e3){_0x5cf9a0=_0x22b1e3;return _0x22b1e3;})['then'](handleEntityNotFound(_0x6bff88,null))['then'](removeEntity(_0x6bff88,null))['then'](function(){if(_0x5cf9a0){return db[_0xf6d4('0x25')][_0xf6d4('0x3a')]({'where':{'type':_0x5cf9a0['type']},'raw':!![]});}})['then'](function(_0x2fbabf){if(_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x43')){var _0x56d7bf=fs[_0xf6d4('0x4c')](path['join'](config['root'],_0xf6d4('0x52')),'utf8');var _0xd9d6e8=ejs[_0xf6d4('0x46')](_0x56d7bf,{'networks':_0x2fbabf||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x47'),_0xd9d6e8);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x4a')]()==_0xf6d4('0x4b')){var _0x5a687d=fs['readFileSync'](path['join'](config[_0xf6d4('0x44')],_0xf6d4('0x4e')),_0xf6d4('0x45'));var _0x5255a2=ejs[_0xf6d4('0x46')](_0x5a687d,{'networks':_0x2fbabf||[]});fs[_0xf6d4('0x4f')](_0xf6d4('0x53'),_0x5255a2);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':_0xf6d4('0x49')});}else{var _0x394c3e=fs[_0xf6d4('0x4c')](path[_0xf6d4('0x4d')](config[_0xf6d4('0x44')],_0xf6d4('0x54')),'utf8');var _0xc0f17b=ejs[_0xf6d4('0x46')](_0x394c3e,{'networks':_0x2fbabf||[]});fs['writeFileSync'](util[_0xf6d4('0x50')](_0xf6d4('0x55'),_0x5cf9a0[_0xf6d4('0x42')][_0xf6d4('0x56')]()),_0xc0f17b);return respondWithRpcPromise(_0xf6d4('0x48'),_0xf6d4('0x1e'),{'module':_0xf6d4('0x51')});}})['catch'](handleError(_0x6bff88,null));}; \ No newline at end of file +var _0x65c4=['map','Network','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','include','findAll','show','intersection','includeAll','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','res_stun_monitor.so','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','readFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','params','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','destroy','util','path','ejs','lodash','api','../../config/environment','../../mysqldb','client','http','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','offset','undefined','limit','count','set','json','update','then','end','sendStatus','stack','name','index'];(function(_0x35860c,_0x30f18e){var _0x24a257=function(_0x3d6ee9){while(--_0x3d6ee9){_0x35860c['push'](_0x35860c['shift']());}};_0x24a257(++_0x30f18e);}(_0x65c4,0x87));var _0x465c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x65c4[_0x6131cd];return _0x47e916;};'use strict';var util=require(_0x465c('0x0'));var path=require(_0x465c('0x1'));var ejs=require(_0x465c('0x2'));var fs=require('fs');var _=require(_0x465c('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x465c('0x4'));var config=require(_0x465c('0x5'));var db=require(_0x465c('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x465c('0x7')][_0x465c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31def5,_0x21cb85,_0x3b7f11,_0xf8473b){return new Promise(function(_0x1c7869,_0x32ac05){var _0x59e0cb=_0xf8473b||client;return _0x59e0cb[_0x465c('0x9')](_0x31def5,_0x3b7f11)['then'](function(_0x46fb1a){logger[_0x465c('0xa')]('Network,\x20%s,\x20%s',_0x21cb85,_0x465c('0xb'));logger[_0x465c('0xc')](_0x465c('0xd'),_0x21cb85,'request\x20sent',JSON[_0x465c('0xe')](_0x46fb1a));if(_0x46fb1a['error']){if(_0x46fb1a[_0x465c('0xf')][_0x465c('0x10')]===0x1f4){logger['error'](_0x465c('0x11'),_0x21cb85,_0x46fb1a[_0x465c('0xf')][_0x465c('0x12')]);return _0x32ac05(_0x46fb1a['error']['message']);}logger['error']('Network,\x20%s,\x20%s',_0x21cb85,_0x46fb1a['error'][_0x465c('0x12')]);return _0x1c7869(_0x46fb1a['error']['message']);}else{logger['info'](_0x465c('0x11'),_0x21cb85,_0x465c('0xb'));_0x1c7869(_0x46fb1a[_0x465c('0x13')][_0x465c('0x12')]);}})[_0x465c('0x14')](function(_0x1a1296){logger[_0x465c('0xf')](_0x465c('0x11'),_0x21cb85,_0x1a1296);_0x32ac05(_0x1a1296);});});}function respondWithResult(_0x51f16c,_0x855534){_0x855534=_0x855534||0xc8;return function(_0x4f8fdc){if(_0x4f8fdc){return _0x51f16c[_0x465c('0x15')](_0x855534)['json'](_0x4f8fdc);}};}function respondWithFilteredResult(_0x182ace,_0x28d578){return function(_0x387d66){if(_0x387d66){var _0x36b301=typeof _0x28d578[_0x465c('0x16')]===_0x465c('0x17')&&typeof _0x28d578[_0x465c('0x18')]==='undefined';var _0x205914=_0x387d66[_0x465c('0x19')];var _0x2e2271=_0x36b301?0x0:_0x28d578[_0x465c('0x16')];var _0x2238f7=_0x36b301?_0x387d66[_0x465c('0x19')]:_0x28d578[_0x465c('0x16')]+_0x28d578[_0x465c('0x18')];var _0x476537;if(_0x2238f7>=_0x205914){_0x2238f7=_0x205914;_0x476537=0xc8;}else{_0x476537=0xce;}_0x182ace[_0x465c('0x15')](_0x476537);return _0x182ace[_0x465c('0x1a')]('Content-Range',_0x2e2271+'-'+_0x2238f7+'/'+_0x205914)[_0x465c('0x1b')](_0x387d66);}return null;};}function saveUpdates(_0x12858d){return function(_0x19da60){if(_0x19da60){return _0x19da60[_0x465c('0x1c')](_0x12858d)[_0x465c('0x1d')](function(_0x301701){return _0x301701;});}return null;};}function removeEntity(_0x1f6c1c){return function(_0x1c5cc7){if(_0x1c5cc7){return _0x1c5cc7['destroy']()[_0x465c('0x1d')](function(){_0x1f6c1c[_0x465c('0x15')](0xcc)[_0x465c('0x1e')]();});}};}function handleEntityNotFound(_0x3778f1){return function(_0x2a2e05){if(!_0x2a2e05){_0x3778f1[_0x465c('0x1f')](0x194);}return _0x2a2e05;};}function handleError(_0x34628c,_0x2fe6a8){_0x2fe6a8=_0x2fe6a8||0x1f4;return function(_0xe80925){logger[_0x465c('0xf')](_0xe80925[_0x465c('0x20')]);if(_0xe80925['name']){delete _0xe80925[_0x465c('0x21')];}_0x34628c[_0x465c('0x15')](_0x2fe6a8)['send'](_0xe80925);};}exports[_0x465c('0x22')]=function(_0x92f5c1,_0x245eee){var _0x32d2a6={},_0xdfae84={},_0x15cf12={'count':0x0,'rows':[]};var _0x41418a=_[_0x465c('0x23')](db[_0x465c('0x24')][_0x465c('0x25')],function(_0x8db1e6){return{'name':_0x8db1e6['fieldName'],'type':_0x8db1e6[_0x465c('0x26')][_0x465c('0x27')]};});_0xdfae84[_0x465c('0x28')]=_[_0x465c('0x23')](_0x41418a,'name');_0xdfae84[_0x465c('0x29')]=_[_0x465c('0x2a')](_0x92f5c1[_0x465c('0x29')]);_0xdfae84[_0x465c('0x2b')]=_['intersection'](_0xdfae84['model'],_0xdfae84[_0x465c('0x29')]);_0x32d2a6['attributes']=_['intersection'](_0xdfae84[_0x465c('0x28')],qs[_0x465c('0x2c')](_0x92f5c1[_0x465c('0x29')][_0x465c('0x2c')]));_0x32d2a6[_0x465c('0x2d')]=_0x32d2a6[_0x465c('0x2d')][_0x465c('0x2e')]?_0x32d2a6['attributes']:_0xdfae84['model'];if(!_0x92f5c1[_0x465c('0x29')][_0x465c('0x2f')](_0x465c('0x30'))){_0x32d2a6[_0x465c('0x18')]=qs[_0x465c('0x18')](_0x92f5c1[_0x465c('0x29')][_0x465c('0x18')]);_0x32d2a6[_0x465c('0x16')]=qs[_0x465c('0x16')](_0x92f5c1['query'][_0x465c('0x16')]);}_0x32d2a6[_0x465c('0x31')]=qs[_0x465c('0x32')](_0x92f5c1[_0x465c('0x29')][_0x465c('0x32')]);_0x32d2a6['where']=qs[_0x465c('0x2b')](_['pick'](_0x92f5c1[_0x465c('0x29')],_0xdfae84[_0x465c('0x2b')]),_0x41418a);if(_0x92f5c1[_0x465c('0x29')][_0x465c('0x33')]){_0x32d2a6['where']=_[_0x465c('0x34')](_0x32d2a6['where'],{'$or':_['map'](_0x41418a,function(_0x2ce118){if(_0x2ce118['type']!==_0x465c('0x35')){var _0x355290={};_0x355290[_0x2ce118[_0x465c('0x21')]]={'$like':'%'+_0x92f5c1[_0x465c('0x29')][_0x465c('0x33')]+'%'};return _0x355290;}})});}_0x32d2a6=_[_0x465c('0x34')]({},_0x32d2a6,_0x92f5c1[_0x465c('0x36')]);var _0x40755e={'where':_0x32d2a6['where']};return db[_0x465c('0x24')][_0x465c('0x19')](_0x40755e)[_0x465c('0x1d')](function(_0x56d1f9){_0x15cf12[_0x465c('0x19')]=_0x56d1f9;if(_0x92f5c1[_0x465c('0x29')]['includeAll']){_0x32d2a6[_0x465c('0x37')]=[{'all':!![]}];}return db[_0x465c('0x24')][_0x465c('0x38')](_0x32d2a6);})[_0x465c('0x1d')](function(_0xb5bb26){_0x15cf12['rows']=_0xb5bb26;return _0x15cf12;})[_0x465c('0x1d')](respondWithFilteredResult(_0x245eee,_0x32d2a6))[_0x465c('0x14')](handleError(_0x245eee,null));};exports[_0x465c('0x39')]=function(_0x53adf9,_0x57d14a){var _0x69f81e={'raw':!![],'where':{'id':_0x53adf9['params']['id']}},_0x55a8c2={};_0x55a8c2[_0x465c('0x28')]=_[_0x465c('0x2a')](db[_0x465c('0x24')]['rawAttributes']);_0x55a8c2[_0x465c('0x29')]=_[_0x465c('0x2a')](_0x53adf9[_0x465c('0x29')]);_0x55a8c2[_0x465c('0x2b')]=_[_0x465c('0x3a')](_0x55a8c2[_0x465c('0x28')],_0x55a8c2[_0x465c('0x29')]);_0x69f81e[_0x465c('0x2d')]=_[_0x465c('0x3a')](_0x55a8c2[_0x465c('0x28')],qs[_0x465c('0x2c')](_0x53adf9[_0x465c('0x29')][_0x465c('0x2c')]));_0x69f81e[_0x465c('0x2d')]=_0x69f81e['attributes'][_0x465c('0x2e')]?_0x69f81e[_0x465c('0x2d')]:_0x55a8c2[_0x465c('0x28')];if(_0x53adf9['query'][_0x465c('0x3b')]){_0x69f81e[_0x465c('0x37')]=[{'all':!![]}];}_0x69f81e=_[_0x465c('0x34')]({},_0x69f81e,_0x53adf9[_0x465c('0x36')]);return db['Network']['find'](_0x69f81e)[_0x465c('0x1d')](handleEntityNotFound(_0x57d14a,null))[_0x465c('0x1d')](respondWithResult(_0x57d14a,null))[_0x465c('0x14')](handleError(_0x57d14a,null));};exports[_0x465c('0x3c')]=function(_0x1ffbb0,_0x2b610a){var _0x13297a;return db[_0x465c('0x24')][_0x465c('0x3c')](_0x1ffbb0['body'],{'raw':!![]})[_0x465c('0x1d')](function(_0x535101){_0x13297a=_0x535101;return db[_0x465c('0x24')]['findAll']({'where':{'type':_0x1ffbb0[_0x465c('0x3d')][_0x465c('0x26')]},'raw':!![]});})[_0x465c('0x1d')](function(_0xbdf60c){if(_0x13297a[_0x465c('0x26')][_0x465c('0x3e')]()==_0x465c('0x3f')){var _0x2e8f76=fs['readFileSync'](path[_0x465c('0x40')](config[_0x465c('0x41')],_0x465c('0x42')),_0x465c('0x43'));var _0x2224d6=ejs[_0x465c('0x44')](_0x2e8f76,{'networks':_0xbdf60c||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2224d6);return respondWithRpcPromise('Reload','create',{'module':_0x465c('0x45')});}else if(_0x13297a[_0x465c('0x26')]['toUpperCase']()==_0x465c('0x46')){var _0x50dc5a=fs['readFileSync'](path[_0x465c('0x40')](config[_0x465c('0x41')],'server/files/templates/turn_multiple.ejs'),_0x465c('0x43'));var _0xe65dd0=ejs[_0x465c('0x44')](_0x50dc5a,{'networks':_0xbdf60c||[]});fs[_0x465c('0x47')](_0x465c('0x48'),_0xe65dd0);return respondWithRpcPromise(_0x465c('0x49'),'create',{'module':_0x465c('0x45')});}else{var _0x2adc4d=fs[_0x465c('0x4a')](path[_0x465c('0x40')](config[_0x465c('0x41')],'server/files/templates/network.ejs'),_0x465c('0x43'));var _0x45bdd4=ejs[_0x465c('0x44')](_0x2adc4d,{'networks':_0xbdf60c||[]});fs[_0x465c('0x47')](util[_0x465c('0x4b')](_0x465c('0x4c'),_0x1ffbb0['body'][_0x465c('0x26')][_0x465c('0x4d')]()),_0x45bdd4);return respondWithRpcPromise('Reload',_0x465c('0x3c'),{'module':_0x465c('0x4e')});}})[_0x465c('0x1d')](function(){return _0x13297a;})[_0x465c('0x1d')](respondWithResult(_0x2b610a,0xc9))[_0x465c('0x14')](handleError(_0x2b610a,null));};exports[_0x465c('0x1c')]=function(_0x322aa1,_0x30ee30){var _0x2d2821;return db[_0x465c('0x24')][_0x465c('0x4f')]({'where':{'id':_0x322aa1[_0x465c('0x50')]['id']}})[_0x465c('0x1d')](handleEntityNotFound(_0x30ee30,null))['then'](saveUpdates(_0x322aa1[_0x465c('0x3d')],null))[_0x465c('0x1d')](function(_0x1e9160){if(_0x1e9160){_0x2d2821=_0x1e9160;return db['Network'][_0x465c('0x38')]({'where':{'type':_0x2d2821[_0x465c('0x26')]},'raw':!![]});}return null;})[_0x465c('0x1d')](function(_0x297253){if(_0x2d2821[_0x465c('0x26')][_0x465c('0x3e')]()==_0x465c('0x3f')){var _0x5170e3=fs['readFileSync'](path[_0x465c('0x40')](config['root'],_0x465c('0x42')),_0x465c('0x43'));var _0xbbd293=ejs[_0x465c('0x44')](_0x5170e3,{'networks':_0x297253||[]});fs[_0x465c('0x47')](_0x465c('0x51'),_0xbbd293);return respondWithRpcPromise('Reload',_0x465c('0x1c'),{'module':_0x465c('0x45')});}else if(_0x2d2821[_0x465c('0x26')][_0x465c('0x3e')]()==_0x465c('0x46')){var _0x145cb0=fs[_0x465c('0x4a')](path[_0x465c('0x40')](config[_0x465c('0x41')],_0x465c('0x52')),_0x465c('0x43'));var _0x1a8b7d=ejs[_0x465c('0x44')](_0x145cb0,{'networks':_0x297253||[]});fs[_0x465c('0x47')](_0x465c('0x48'),_0x1a8b7d);return respondWithRpcPromise(_0x465c('0x49'),_0x465c('0x1c'),{'module':_0x465c('0x45')});}else{var _0x4751a9=fs[_0x465c('0x4a')](path[_0x465c('0x40')](config[_0x465c('0x41')],_0x465c('0x53')),_0x465c('0x43'));var _0x1c6fa6=ejs[_0x465c('0x44')](_0x4751a9,{'networks':_0x297253||[]});fs[_0x465c('0x47')](util[_0x465c('0x4b')](_0x465c('0x4c'),_0x322aa1['body']['type'][_0x465c('0x4d')]()),_0x1c6fa6);return respondWithRpcPromise(_0x465c('0x49'),_0x465c('0x1c'),{'module':_0x465c('0x4e')});}})['then'](function(_0x5a9654){if(_0x5a9654){return _0x2d2821;}return null;})['then'](respondWithResult(_0x30ee30,null))[_0x465c('0x14')](handleError(_0x30ee30,null));};exports[_0x465c('0x54')]=function(_0x322d8d,_0x2cfb62){var _0x153923;return db[_0x465c('0x24')][_0x465c('0x4f')]({'where':{'id':_0x322d8d[_0x465c('0x50')]['id']}})['then'](function(_0x4da7fa){_0x153923=_0x4da7fa;return _0x4da7fa;})[_0x465c('0x1d')](handleEntityNotFound(_0x2cfb62,null))[_0x465c('0x1d')](removeEntity(_0x2cfb62,null))[_0x465c('0x1d')](function(){if(_0x153923){return db['Network']['findAll']({'where':{'type':_0x153923[_0x465c('0x26')]},'raw':!![]});}})[_0x465c('0x1d')](function(_0x5d7153){if(_0x153923['type'][_0x465c('0x3e')]()=='STUN'){var _0x569adb=fs[_0x465c('0x4a')](path[_0x465c('0x40')](config['root'],_0x465c('0x42')),_0x465c('0x43'));var _0x5abae6=ejs[_0x465c('0x44')](_0x569adb,{'networks':_0x5d7153||[]});fs['writeFileSync'](_0x465c('0x51'),_0x5abae6);return respondWithRpcPromise('Reload',_0x465c('0x54'),{'module':_0x465c('0x45')});}else if(_0x153923[_0x465c('0x26')][_0x465c('0x3e')]()==_0x465c('0x46')){var _0x2c0042=fs['readFileSync'](path[_0x465c('0x40')](config['root'],_0x465c('0x52')),'utf8');var _0x413e6c=ejs[_0x465c('0x44')](_0x2c0042,{'networks':_0x5d7153||[]});fs[_0x465c('0x47')]('/etc/asterisk/turn_xcally.conf',_0x413e6c);return respondWithRpcPromise(_0x465c('0x49'),_0x465c('0x54'),{'module':_0x465c('0x45')});}else{var _0x51f451=fs[_0x465c('0x4a')](path[_0x465c('0x40')](config[_0x465c('0x41')],_0x465c('0x53')),_0x465c('0x43'));var _0x2864f0=ejs[_0x465c('0x44')](_0x51f451,{'networks':_0x5d7153||[]});fs['writeFileSync'](util[_0x465c('0x4b')](_0x465c('0x4c'),_0x153923[_0x465c('0x26')][_0x465c('0x4d')]()),_0x2864f0);return respondWithRpcPromise(_0x465c('0x49'),_0x465c('0x54'),{'module':'chan_sip.so'});}})[_0x465c('0x14')](handleError(_0x2cfb62,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0908e19..3e7c57d 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 _0xb903=['rimraf','../../config/environment','./network.attributes','exports','network','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e928b,_0x7cb412){var _0x3e26c3=function(_0x1c41f8){while(--_0x1c41f8){_0x1e928b['push'](_0x1e928b['shift']());}};_0x3e26c3(++_0x7cb412);}(_0xb903,0x185));var _0x3b90=function(_0x2099a1,_0x52482d){_0x2099a1=_0x2099a1-0x0;var _0x428684=_0xb903[_0x2099a1];return _0x428684;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('Network',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x222f=['define','network','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x127ba0,_0x252ebd){var _0x1564f8=function(_0x3d5fc2){while(--_0x3d5fc2){_0x127ba0['push'](_0x127ba0['shift']());}};_0x1564f8(++_0x252ebd);}(_0x222f,0x1a4));var _0xf222=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x222f[_0xa79977];return _0x109f10;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./network.attributes');module[_0xf222('0x8')]=function(_0x54a758,_0x112e6d){return _0x54a758[_0xf222('0x9')]('Network',attributes,{'tableName':_0xf222('0xa'),'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 585569a..3011b14 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x57d6b4,_0x102e93){_0x57d6b4=_0x57d6b4-0x0;var _0x53030b=_0x7a54[_0x57d6b4];return _0x53030b;};'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(_0x4c35da,_0x4ba253){var _0x1b130d=function(_0x1aa298){while(--_0x1aa298){_0x4c35da['push'](_0x4c35da['shift']());}};_0x1b130d(++_0x4ba253);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 f98fcbd..458f455 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 _0x6977=['notify','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','/:id/notify'];(function(_0x5e966a,_0x47c9a3){var _0x3b31a7=function(_0x7ed7e6){while(--_0x7ed7e6){_0x5e966a['push'](_0x5e966a['shift']());}};_0x3b31a7(++_0x47c9a3);}(_0x6977,0x10d));var _0x7697=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x6977[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x7697('0x0'));var util=require(_0x7697('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7697('0x2'));var router=express['Router']();var fs_extra=require(_0x7697('0x3'));var auth=require(_0x7697('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7697('0x5'));var controller=require(_0x7697('0x6'));router[_0x7697('0x7')]('/',auth['isAuthenticated'](),controller[_0x7697('0x8')]);router['get'](_0x7697('0x9'),auth['isAuthenticated'](),controller[_0x7697('0xa')]);router['get'](_0x7697('0xb'),auth[_0x7697('0xc')](),controller[_0x7697('0xd')]);router['get'](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0xf')]);router[_0x7697('0x7')]('/:id/canned_answers',auth[_0x7697('0xc')](),controller[_0x7697('0x10')]);router[_0x7697('0x7')](_0x7697('0x11'),auth[_0x7697('0xc')](),controller[_0x7697('0x12')]);router[_0x7697('0x7')](_0x7697('0x13'),auth['isAuthenticated'](),controller[_0x7697('0x14')]);router['get'](_0x7697('0x15'),auth[_0x7697('0xc')](),controller[_0x7697('0x16')]);router[_0x7697('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7697('0x17')](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0x18')]);router['post'](_0x7697('0x19'),auth[_0x7697('0xc')](),controller['addAnswer']);router['post'](_0x7697('0x1a'),controller[_0x7697('0x1b')]);router[_0x7697('0x17')]('/:id/applications',auth[_0x7697('0xc')](),controller[_0x7697('0x1c')]);router[_0x7697('0x17')](_0x7697('0x15'),auth['isAuthenticated'](),controller[_0x7697('0x1d')]);router['post'](_0x7697('0x1e'),auth[_0x7697('0xc')](),controller['send']);router[_0x7697('0x1f')](_0x7697('0xb'),auth[_0x7697('0xc')](),controller['update']);router[_0x7697('0x20')]('/:id',auth[_0x7697('0xc')](),controller[_0x7697('0x21')]);router[_0x7697('0x20')](_0x7697('0xe'),auth[_0x7697('0xc')](),controller[_0x7697('0x22')]);router[_0x7697('0x20')]('/:id/canned_answers',auth[_0x7697('0xc')](),controller[_0x7697('0x23')]);router['delete'](_0x7697('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7697('0x24')]=router; \ No newline at end of file +var _0xc071=['isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x7ca39e,_0x37a469){var _0x17f9c0=function(_0x5065ce){while(--_0x5065ce){_0x7ca39e['push'](_0x7ca39e['shift']());}};_0x17f9c0(++_0x37a469);}(_0xc071,0xfa));var _0x1c07=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xc071[_0xce6f11];return _0x35b709;};'use strict';var multer=require(_0x1c07('0x0'));var util=require('util');var path=require(_0x1c07('0x1'));var timeout=require(_0x1c07('0x2'));var express=require('express');var router=express[_0x1c07('0x3')]();var fs_extra=require(_0x1c07('0x4'));var auth=require(_0x1c07('0x5'));var interaction=require(_0x1c07('0x6'));var config=require(_0x1c07('0x7'));var controller=require(_0x1c07('0x8'));router['get']('/',auth[_0x1c07('0x9')](),controller[_0x1c07('0xa')]);router[_0x1c07('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x1c07('0xc')]);router[_0x1c07('0xb')](_0x1c07('0xd'),auth[_0x1c07('0x9')](),controller[_0x1c07('0xe')]);router[_0x1c07('0xb')](_0x1c07('0xf'),auth['isAuthenticated'](),controller[_0x1c07('0x10')]);router[_0x1c07('0xb')](_0x1c07('0x11'),auth['isAuthenticated'](),controller[_0x1c07('0x12')]);router[_0x1c07('0xb')](_0x1c07('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x1c07('0xb')](_0x1c07('0x14'),auth[_0x1c07('0x9')](),controller[_0x1c07('0x15')]);router[_0x1c07('0xb')]('/:id/users',auth[_0x1c07('0x9')](),controller[_0x1c07('0x16')]);router[_0x1c07('0x17')]('/',auth[_0x1c07('0x9')](),controller['create']);router[_0x1c07('0x17')](_0x1c07('0xf'),auth[_0x1c07('0x9')](),controller[_0x1c07('0x18')]);router[_0x1c07('0x17')](_0x1c07('0x11'),auth[_0x1c07('0x9')](),controller[_0x1c07('0x19')]);router[_0x1c07('0x17')](_0x1c07('0x1a'),controller[_0x1c07('0x1b')]);router[_0x1c07('0x17')]('/:id/applications',auth[_0x1c07('0x9')](),controller[_0x1c07('0x1c')]);router[_0x1c07('0x17')](_0x1c07('0x1d'),auth[_0x1c07('0x9')](),controller['addAgents']);router[_0x1c07('0x17')]('/:id/send',auth[_0x1c07('0x9')](),controller['send']);router['put'](_0x1c07('0xd'),auth[_0x1c07('0x9')](),controller[_0x1c07('0x1e')]);router[_0x1c07('0x1f')](_0x1c07('0xd'),auth['isAuthenticated'](),controller[_0x1c07('0x20')]);router[_0x1c07('0x1f')]('/:id/dispositions',auth[_0x1c07('0x9')](),controller[_0x1c07('0x21')]);router[_0x1c07('0x1f')]('/:id/canned_answers',auth[_0x1c07('0x9')](),controller[_0x1c07('0x22')]);router['delete'](_0x1c07('0x1d'),auth[_0x1c07('0x9')](),controller[_0x1c07('0x23')]);module[_0x1c07('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 5d54d07..16f8512 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 _0x629e=['mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x629e,0x1b1));var _0xe629=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x629e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe629('0x0'));var rs=require(_0xe629('0x1'));module['exports']={'name':{'type':Sequelize[_0xe629('0x2')],'unique':_0xe629('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe629('0x2')]},'token':{'type':Sequelize[_0xe629('0x2')],'defaultValue':function(){return rs[_0xe629('0x4')]();}},'replyUri':{'type':Sequelize[_0xe629('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe629('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe629('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe629('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe629('0x2')]},'queueTransfer':{'type':Sequelize[_0xe629('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe629('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe629('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe629('0x7')],'defaultValue':![],'comment':_0xe629('0x9'),'set':function(_0x5934d0){if(!_0x5934d0)this['setDataValue'](_0xe629('0xa'),null);this['setDataValue'](_0xe629('0xb'),_0x5934d0);}}}; \ No newline at end of file +var _0xd6be=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6be,0x1ef));var _0xed6b=function(_0x3feeda,_0x587510){_0x3feeda=_0x3feeda-0x0;var _0x4bd666=_0xd6be[_0x3feeda];return _0x4bd666;};'use strict';var Sequelize=require(_0xed6b('0x0'));var rs=require(_0xed6b('0x1'));module[_0xed6b('0x2')]={'name':{'type':Sequelize[_0xed6b('0x3')],'unique':_0xed6b('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xed6b('0x3')],'defaultValue':function(){return rs[_0xed6b('0x5')]();}},'replyUri':{'type':Sequelize[_0xed6b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xed6b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xed6b('0x6')],'defaultValue':function(){return _0xed6b('0x7');}},'notificationSound':{'type':Sequelize[_0xed6b('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed6b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed6b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed6b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed6b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed6b('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xed6b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xed6b('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x388c0b){if(!_0x388c0b)this[_0xed6b('0xb')](_0xed6b('0xc'),null);this['setDataValue'](_0xed6b('0xd'),_0x388c0b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8d70d3d..da80d44 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 _0xc831=['OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0xc831,0x103));var _0x1c83=function(_0x2a4b89,_0xc626dc){_0x2a4b89=_0x2a4b89-0x0;var _0x5a62e4=_0xc831[_0x2a4b89];return _0x5a62e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];config[_0x1c83('0x17')]=_[_0x1c83('0x18')](config[_0x1c83('0x17')],{'host':_0x1c83('0x19'),'port':0x18eb});var socket=require(_0x1c83('0x1a'))(new Redis(config[_0x1c83('0x17')]));require('./openchannelAccount.socket')[_0x1c83('0x1b')](socket);var jayson=require(_0x1c83('0x1c'));var client=jayson[_0x1c83('0x1d')][_0x1c83('0x1e')]({'port':0x232c});var client9002=jayson[_0x1c83('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11acf1,_0x18a06d,_0x179906,_0x441a5e){return new BPromise(function(_0x596a69,_0x21b04c){var _0x4a5025=_0x441a5e||client;return _0x4a5025['request'](_0x11acf1,_0x179906)[_0x1c83('0x1f')](function(_0x1d6027){logger[_0x1c83('0x20')](_0x1c83('0x21'),_0x18a06d,'request\x20sent');logger[_0x1c83('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x18a06d,_0x1c83('0x23'),JSON[_0x1c83('0x24')](_0x1d6027));if(_0x1d6027['error']){if(_0x1d6027[_0x1c83('0x25')][_0x1c83('0x26')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a06d,_0x1d6027[_0x1c83('0x25')]['message']);return _0x21b04c(_0x1d6027['error'][_0x1c83('0x27')]);}logger[_0x1c83('0x25')](_0x1c83('0x21'),_0x18a06d,_0x1d6027['error'][_0x1c83('0x27')]);return _0x596a69(_0x1d6027[_0x1c83('0x25')][_0x1c83('0x27')]);}else{logger['info'](_0x1c83('0x21'),_0x18a06d,'request\x20sent');_0x596a69(_0x1d6027[_0x1c83('0x28')][_0x1c83('0x27')]);}})[_0x1c83('0x29')](function(_0x1096ed){logger[_0x1c83('0x25')](_0x1c83('0x21'),_0x18a06d,_0x1096ed);_0x21b04c(_0x1096ed);});});}function respondWithStatusCode(_0x11baa6,_0x2beb2b){_0x2beb2b=_0x2beb2b||0xcc;return function(_0x2ed4a3){if(_0x2ed4a3){return _0x11baa6['sendStatus'](_0x2beb2b);}return _0x11baa6[_0x1c83('0x2a')](_0x2beb2b)['end']();};}function respondWithResult(_0x354cdf,_0x4ef78a){_0x4ef78a=_0x4ef78a||0xc8;return function(_0x2ac671){if(_0x2ac671){return _0x354cdf[_0x1c83('0x2a')](_0x4ef78a)[_0x1c83('0x2b')](_0x2ac671);}};}function respondWithFilteredResult(_0x341d8d,_0x3c027b){return function(_0x282df2){if(_0x282df2){var _0x2671a9=typeof _0x3c027b[_0x1c83('0x2c')]===_0x1c83('0x2d')&&typeof _0x3c027b['limit']===_0x1c83('0x2d');var _0x56cd77=_0x282df2['count'];var _0x3e9814=_0x2671a9?0x0:_0x3c027b[_0x1c83('0x2c')];var _0x39f492=_0x2671a9?_0x282df2[_0x1c83('0x2e')]:_0x3c027b[_0x1c83('0x2c')]+_0x3c027b[_0x1c83('0x2f')];var _0x1e96fb;if(_0x39f492>=_0x56cd77){_0x39f492=_0x56cd77;_0x1e96fb=0xc8;}else{_0x1e96fb=0xce;}_0x341d8d[_0x1c83('0x2a')](_0x1e96fb);return _0x341d8d['set'](_0x1c83('0x30'),_0x3e9814+'-'+_0x39f492+'/'+_0x56cd77)[_0x1c83('0x2b')](_0x282df2);}return null;};}function patchUpdates(_0x206e6d){return function(_0x152b17){try{jsonpatch[_0x1c83('0x31')](_0x152b17,_0x206e6d,!![]);}catch(_0x5735b6){return BPromise[_0x1c83('0x32')](_0x5735b6);}return _0x152b17[_0x1c83('0x33')]();};}function saveUpdates(_0x31b14d,_0x4cbe0c){return function(_0x3dd2de){if(_0x3dd2de){return _0x3dd2de[_0x1c83('0x34')](_0x31b14d)[_0x1c83('0x1f')](function(_0x1f00ab){return _0x1f00ab;});}return null;};}function removeEntity(_0x31f9fd,_0x9d9670){return function(_0x21a75d){if(_0x21a75d){return _0x21a75d[_0x1c83('0x35')]()[_0x1c83('0x1f')](function(){var _0x579105=_0x21a75d[_0x1c83('0x36')]({'plain':!![]});var _0x77da35=_0x1c83('0x37');return db[_0x1c83('0x38')][_0x1c83('0x35')]({'where':{'type':_0x77da35,'resourceId':_0x579105['id']}})['then'](function(){return _0x21a75d;});})['then'](function(){_0x31f9fd['status'](0xcc)[_0x1c83('0x39')]();});}};}function handleEntityNotFound(_0x498dc5,_0x67bfdd){return function(_0x3a52c6){if(!_0x3a52c6){_0x498dc5[_0x1c83('0x3a')](0x194);}return _0x3a52c6;};}function handleError(_0x1b372f,_0x2e7916){_0x2e7916=_0x2e7916||0x1f4;return function(_0x4ed578){logger['error'](_0x4ed578['stack']);if(_0x4ed578[_0x1c83('0x3b')]){delete _0x4ed578[_0x1c83('0x3b')];}_0x1b372f[_0x1c83('0x2a')](_0x2e7916)[_0x1c83('0x3c')](_0x4ed578);};}exports[_0x1c83('0x3d')]=function(_0x1c8283,_0x24d8c5){var _0x590d6a={'include':[{'model':db[_0x1c83('0x3e')],'as':_0x1c83('0x3f')}]},_0x5a4584={},_0x2d80bc={'count':0x0,'rows':[]};var _0x267988=_[_0x1c83('0x40')](db[_0x1c83('0x41')][_0x1c83('0x42')],function(_0x4c1144){return{'name':_0x4c1144[_0x1c83('0x43')],'type':_0x4c1144[_0x1c83('0x44')][_0x1c83('0x45')]};});_0x5a4584[_0x1c83('0x46')]=_[_0x1c83('0x40')](_0x267988,_0x1c83('0x3b'));_0x5a4584[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x1c8283[_0x1c83('0x47')]);_0x5a4584[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x5a4584[_0x1c83('0x46')],_0x5a4584[_0x1c83('0x47')]);_0x590d6a[_0x1c83('0x4b')]=_['intersection'](_0x5a4584[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x1c8283['query'][_0x1c83('0x4c')]));_0x590d6a[_0x1c83('0x4b')]=_0x590d6a[_0x1c83('0x4b')][_0x1c83('0x4d')]?_0x590d6a[_0x1c83('0x4b')]:_0x5a4584[_0x1c83('0x46')];if(!_0x1c8283[_0x1c83('0x47')][_0x1c83('0x4e')]('nolimit')){_0x590d6a[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x590d6a[_0x1c83('0x2c')]=qs[_0x1c83('0x2c')](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x590d6a['order']=qs['sort'](_0x1c8283[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x590d6a[_0x1c83('0x50')]=qs[_0x1c83('0x49')](_[_0x1c83('0x51')](_0x1c8283['query'],_0x5a4584[_0x1c83('0x49')]),_0x267988);if(_0x1c8283['query']['filter']){_0x590d6a['where']=_[_0x1c83('0x52')](_0x590d6a['where'],{'$or':_[_0x1c83('0x40')](_0x267988,function(_0x1a9034){if(_0x1a9034[_0x1c83('0x44')]!==_0x1c83('0x53')){var _0x274ee1={};_0x274ee1[_0x1a9034[_0x1c83('0x3b')]]={'$like':'%'+_0x1c8283[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x274ee1;}})});}_0x590d6a=_['merge']({},_0x590d6a,_0x1c8283[_0x1c83('0x55')]);var _0x2421d3={'where':_0x590d6a[_0x1c83('0x50')]};return db[_0x1c83('0x41')][_0x1c83('0x2e')](_0x2421d3)['then'](function(_0x56f853){_0x2d80bc[_0x1c83('0x2e')]=_0x56f853;if(_0x1c8283[_0x1c83('0x47')][_0x1c83('0x56')]){_0x590d6a[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x41')]['findAll'](_0x590d6a);})[_0x1c83('0x1f')](function(_0x901dc5){_0x2d80bc[_0x1c83('0x58')]=_0x901dc5;return _0x2d80bc;})['then'](respondWithFilteredResult(_0x24d8c5,_0x590d6a))[_0x1c83('0x29')](handleError(_0x24d8c5,null));};exports[_0x1c83('0x59')]=function(_0x2aa850,_0x1500dd){var _0x409e85={'raw':![],'where':{'id':_0x2aa850[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x3e')],'as':'mandatoryDispositionPause'}]},_0xca58e6={};_0xca58e6[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x41')]['rawAttributes']);_0xca58e6['query']=_['keys'](_0x2aa850[_0x1c83('0x47')]);_0xca58e6[_0x1c83('0x49')]=_['intersection'](_0xca58e6[_0x1c83('0x46')],_0xca58e6[_0x1c83('0x47')]);_0x409e85[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0xca58e6[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x2aa850[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x409e85[_0x1c83('0x4b')]=_0x409e85[_0x1c83('0x4b')]['length']?_0x409e85['attributes']:_0xca58e6[_0x1c83('0x46')];if(_0x2aa850['query']['includeAll']){_0x409e85[_0x1c83('0x57')]=[{'all':!![]}];}_0x409e85=_[_0x1c83('0x52')]({},_0x409e85,_0x2aa850['options']);return db[_0x1c83('0x41')][_0x1c83('0x5b')](_0x409e85)[_0x1c83('0x1f')](handleEntityNotFound(_0x1500dd,null))['then'](respondWithResult(_0x1500dd,null))[_0x1c83('0x29')](handleError(_0x1500dd,null));};exports[_0x1c83('0x5c')]=function(_0x12305f,_0x3e0a94){return db['OpenchannelAccount']['create'](_0x12305f[_0x1c83('0x5d')],{})[_0x1c83('0x1f')](function(_0x156983){var _0x1fd85f=_0x12305f['user']['get']({'plain':!![]});if(!_0x1fd85f)throw new Error(_0x1c83('0x5e'));if(_0x1fd85f['role']===_0x1c83('0x5f')){var _0x4992d2=_0x156983[_0x1c83('0x36')]({'plain':!![]});var _0x3ca02d='OpenchannelAccounts';return db['UserProfileSection'][_0x1c83('0x5b')]({'where':{'name':_0x3ca02d,'userProfileId':_0x1fd85f[_0x1c83('0x60')]},'raw':!![]})[_0x1c83('0x1f')](function(_0x71d64e){if(_0x71d64e&&_0x71d64e[_0x1c83('0x61')]===0x0){return db['UserProfileResource'][_0x1c83('0x5c')]({'name':_0x4992d2[_0x1c83('0x3b')],'resourceId':_0x4992d2['id'],'type':_0x71d64e[_0x1c83('0x3b')],'sectionId':_0x71d64e['id']},{})[_0x1c83('0x1f')](function(){return _0x156983;});}else{return _0x156983;}})[_0x1c83('0x29')](function(_0x489e2e){logger[_0x1c83('0x25')](_0x1c83('0x62'),_0x489e2e);throw _0x489e2e;});}return _0x156983;})[_0x1c83('0x1f')](respondWithResult(_0x3e0a94,0xc9))[_0x1c83('0x29')](handleError(_0x3e0a94,null));};exports['update']=function(_0x409313,_0x3428cd){if(_0x409313[_0x1c83('0x5d')]['id']){delete _0x409313[_0x1c83('0x5d')]['id'];}return db[_0x1c83('0x41')]['find']({'where':{'id':_0x409313[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x3e')],'as':_0x1c83('0x3f')}]})[_0x1c83('0x1f')](handleEntityNotFound(_0x3428cd,null))[_0x1c83('0x1f')](saveUpdates(_0x409313[_0x1c83('0x5d')],null))[_0x1c83('0x1f')](respondWithResult(_0x3428cd,null))['catch'](handleError(_0x3428cd,null));};exports[_0x1c83('0x35')]=function(_0x5c126f,_0x44b8a6){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c126f[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x44b8a6,null))[_0x1c83('0x1f')](removeEntity(_0x44b8a6,null))[_0x1c83('0x29')](handleError(_0x44b8a6,null));};exports[_0x1c83('0x63')]=function(_0x26b11e,_0x511043){return db[_0x1c83('0x41')][_0x1c83('0x63')]()[_0x1c83('0x1f')](respondWithResult(_0x511043,null))[_0x1c83('0x29')](handleError(_0x511043,null));};exports['addDisposition']=function(_0x5f91b1,_0x41424b,_0x2b0bcb){if(_0x5f91b1[_0x1c83('0x5d')]['id']){delete _0x5f91b1[_0x1c83('0x5d')]['id'];}return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x5f91b1['params']['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x41424b,null))[_0x1c83('0x1f')](function(_0x14c225){if(_0x14c225){_0x5f91b1[_0x1c83('0x5d')][_0x1c83('0x64')]=_0x14c225['id'];return db[_0x1c83('0x65')][_0x1c83('0x5c')](_0x5f91b1[_0x1c83('0x5d')]);}})[_0x1c83('0x1f')](respondWithResult(_0x41424b,null))['catch'](handleError(_0x41424b,null));};exports[_0x1c83('0x66')]=function(_0x468fc1,_0x165f30,_0x53e331){var _0x526e3c={'raw':![],'where':{}};var _0x9a08f7={};var _0x44f2b3={'count':0x0,'rows':[]};return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0x468fc1['params']['id']}})['then'](handleEntityNotFound(_0x165f30,null))['then'](function(_0x8ddae2){if(_0x8ddae2){_0x9a08f7[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x65')]['rawAttributes']);_0x9a08f7[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x468fc1[_0x1c83('0x47')]);_0x9a08f7[_0x1c83('0x49')]=_['intersection'](_0x9a08f7[_0x1c83('0x46')],_0x9a08f7[_0x1c83('0x47')]);_0x526e3c[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x9a08f7[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x468fc1['query'][_0x1c83('0x4c')]));_0x526e3c[_0x1c83('0x4b')]=_0x526e3c[_0x1c83('0x4b')]['length']?_0x526e3c[_0x1c83('0x4b')]:_0x9a08f7[_0x1c83('0x46')];if(!_0x468fc1[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x526e3c[_0x1c83('0x2f')]=qs['limit'](_0x468fc1[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x526e3c['offset']=qs[_0x1c83('0x2c')](_0x468fc1[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x526e3c['order']=qs['sort'](_0x468fc1['query']['sort']);_0x526e3c['where']=qs[_0x1c83('0x49')](_['pick'](_0x468fc1[_0x1c83('0x47')],_0x9a08f7[_0x1c83('0x49')]));_0x526e3c[_0x1c83('0x50')][_0x1c83('0x64')]=_0x8ddae2['id'];if(_0x468fc1['query']['filter']){_0x526e3c[_0x1c83('0x50')]=_['merge'](_0x526e3c['where'],{'$or':_['map'](_0x526e3c[_0x1c83('0x4b')],function(_0x2fa45e){var _0x1d3593={};_0x1d3593[_0x2fa45e]={'$like':'%'+_0x468fc1[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x1d3593;})});}_0x526e3c=_[_0x1c83('0x52')]({},_0x526e3c,_0x468fc1[_0x1c83('0x55')]);return db[_0x1c83('0x65')][_0x1c83('0x2e')]({'where':_0x526e3c['where']})['then'](function(_0x1321b0){_0x44f2b3[_0x1c83('0x2e')]=_0x1321b0;if(_0x468fc1[_0x1c83('0x47')][_0x1c83('0x56')]){_0x526e3c[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x65')][_0x1c83('0x69')](_0x526e3c);})[_0x1c83('0x1f')](function(_0x3dcc6a){_0x44f2b3[_0x1c83('0x58')]=_0x3dcc6a;return _0x44f2b3;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x165f30,_0x526e3c))[_0x1c83('0x29')](handleError(_0x165f30,null));};exports[_0x1c83('0x6a')]=function(_0x25549a,_0x34c790,_0x41e177){return db[_0x1c83('0x41')]['find']({'where':{'id':_0x25549a[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x34c790,null))[_0x1c83('0x1f')](function(_0xcbbaf4){if(_0xcbbaf4){return _0xcbbaf4[_0x1c83('0x6a')](_0x25549a[_0x1c83('0x47')][_0x1c83('0x6b')]);}})[_0x1c83('0x1f')](respondWithStatusCode(_0x34c790,null))[_0x1c83('0x29')](handleError(_0x34c790,null));};exports[_0x1c83('0x6c')]=function(_0x564559,_0x2d0db0,_0x427345){if(_0x564559[_0x1c83('0x5d')]['id']){delete _0x564559[_0x1c83('0x5d')]['id'];}return db['OpenchannelAccount'][_0x1c83('0x5b')]({'where':{'id':_0x564559[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x2d0db0,null))[_0x1c83('0x1f')](function(_0x4b2400){if(_0x4b2400){_0x564559[_0x1c83('0x5d')][_0x1c83('0x64')]=_0x4b2400['id'];return db[_0x1c83('0x6d')][_0x1c83('0x5c')](_0x564559[_0x1c83('0x5d')]);}})[_0x1c83('0x1f')](respondWithResult(_0x2d0db0,null))[_0x1c83('0x29')](handleError(_0x2d0db0,null));};exports['getAnswers']=function(_0x2c6abd,_0x547e82,_0x485908){var _0x30a9c3={'raw':![],'where':{}};var _0x4ac907={};var _0x138287={'count':0x0,'rows':[]};return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x2c6abd['params']['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x547e82,null))[_0x1c83('0x1f')](function(_0x2b6c18){if(_0x2b6c18){_0x4ac907[_0x1c83('0x46')]=_[_0x1c83('0x48')](db[_0x1c83('0x6d')][_0x1c83('0x42')]);_0x4ac907[_0x1c83('0x47')]=_['keys'](_0x2c6abd[_0x1c83('0x47')]);_0x4ac907[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x4ac907[_0x1c83('0x46')],_0x4ac907[_0x1c83('0x47')]);_0x30a9c3[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x4ac907[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x30a9c3['attributes']=_0x30a9c3[_0x1c83('0x4b')][_0x1c83('0x4d')]?_0x30a9c3[_0x1c83('0x4b')]:_0x4ac907['model'];if(!_0x2c6abd['query'][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x30a9c3[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x2c6abd[_0x1c83('0x47')]['limit']);_0x30a9c3[_0x1c83('0x2c')]=qs[_0x1c83('0x2c')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x2c')]);}_0x30a9c3[_0x1c83('0x6e')]=qs[_0x1c83('0x4f')](_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x30a9c3[_0x1c83('0x50')]=qs['filters'](_[_0x1c83('0x51')](_0x2c6abd[_0x1c83('0x47')],_0x4ac907['filters']));_0x30a9c3[_0x1c83('0x50')][_0x1c83('0x64')]=_0x2b6c18['id'];if(_0x2c6abd[_0x1c83('0x47')]['filter']){_0x30a9c3[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x30a9c3['where'],{'$or':_[_0x1c83('0x40')](_0x30a9c3[_0x1c83('0x4b')],function(_0x1cf313){var _0x401b0e={};_0x401b0e[_0x1cf313]={'$like':'%'+_0x2c6abd[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x401b0e;})});}_0x30a9c3=_[_0x1c83('0x52')]({},_0x30a9c3,_0x2c6abd['options']);return db[_0x1c83('0x6d')][_0x1c83('0x2e')]({'where':_0x30a9c3['where']})[_0x1c83('0x1f')](function(_0x4eb7df){_0x138287[_0x1c83('0x2e')]=_0x4eb7df;if(_0x2c6abd[_0x1c83('0x47')]['includeAll']){_0x30a9c3[_0x1c83('0x57')]=[{'all':!![]}];}return db[_0x1c83('0x6d')][_0x1c83('0x69')](_0x30a9c3);})[_0x1c83('0x1f')](function(_0x31f64f){_0x138287[_0x1c83('0x58')]=_0x31f64f;return _0x138287;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x547e82,_0x30a9c3))[_0x1c83('0x29')](handleError(_0x547e82,null));};exports[_0x1c83('0x6f')]=function(_0x1d058c,_0x11a0e9,_0xf0d96e){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x1d058c[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x11a0e9,null))[_0x1c83('0x1f')](function(_0x5d7e8c){if(_0x5d7e8c){return _0x5d7e8c[_0x1c83('0x6f')](_0x1d058c[_0x1c83('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x11a0e9,null))[_0x1c83('0x29')](handleError(_0x11a0e9,null));};exports[_0x1c83('0x70')]=function(_0xb409f,_0x6278e7,_0x1d5e4d){var _0x15c14e={'body':_0xb409f['body'],'channel':_0x1c83('0x71')};var _0x21f041=[];var _0x4acbd4=[];var _0x46e5d3={};var _0xc7ce36=![];return db['CmContact'][_0x1c83('0x63')]()[_0x1c83('0x1f')](function(_0x2d803a){if(!_0x2d803a){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x74'));}_0x21f041=_[_0x1c83('0x75')](_['keys'](_0x2d803a),[_0x1c83('0x76'),'updatedAt']);_0x4acbd4=_[_0x1c83('0x75')](_[_0x1c83('0x48')](_0x2d803a),['createdAt',_0x1c83('0x77'),_0x1c83('0x78'),_0x1c83('0x79')]);if(_0xb409f[_0x1c83('0x5d')]['id']){delete _0xb409f[_0x1c83('0x5d')]['id'];}if(_['isNil'](_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')])){throw new db[(_0x1c83('0x72'))]['ValidationError'](_0x1c83('0x7b'));}if(_[_0x1c83('0x7c')](_0xb409f[_0x1c83('0x5d')]['body'])||_0xb409f[_0x1c83('0x5d')][_0x1c83('0x5d')]===''){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1c83('0x7c')](_0xb409f[_0x1c83('0x5d')]['mapKey'])){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x7d')+_0x4acbd4);}if(!_[_0x1c83('0x7e')](_0x4acbd4,_0xb409f[_0x1c83('0x5d')]['mapKey'])){throw new db[(_0x1c83('0x72'))][(_0x1c83('0x73'))](_0x1c83('0x7f')+_0x4acbd4);}_0x46e5d3[_0xb409f['body'][_0x1c83('0x80')]]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')];})[_0x1c83('0x1f')](function(){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0xb409f[_0x1c83('0x5a')]['id']},'include':[{'model':db[_0x1c83('0x81')],'as':_0x1c83('0x82'),'include':[{'model':db[_0x1c83('0x83')],'as':_0x1c83('0x84'),'where':_0x46e5d3,'limit':0x1,'order':[[_0x1c83('0x77'),'DESC']]}]},{'model':db[_0x1c83('0x85')],'as':_0x1c83('0x86')}]});})['then'](handleEntityNotFound(_0x6278e7,null))[_0x1c83('0x1f')](function(_0x50b942){if(_0x50b942&&_0x50b942[_0x1c83('0x82')]){_0x15c14e[_0x1c83('0x87')]=_0x50b942;_0x15c14e[_0x1c83('0x88')]=_0x50b942[_0x1c83('0x86')];_0x15c14e[_0x1c83('0x89')]=_0x50b942['List'];_0x15c14e[_0x1c83('0x88')]=_[_0x1c83('0x8a')](_0x15c14e['applications'],[_0x1c83('0x8b')],[_0x1c83('0x8c')]);if(_0x15c14e[_0x1c83('0x87')]['Applications']){delete _0x15c14e[_0x1c83('0x87')][_0x1c83('0x86')];}if(_0x15c14e[_0x1c83('0x87')][_0x1c83('0x82')]&&_0x15c14e[_0x1c83('0x87')][_0x1c83('0x82')][_0x1c83('0x84')][_0x1c83('0x4d')]){return _0x15c14e['account'][_0x1c83('0x82')][_0x1c83('0x84')][0x0];}var _0x45cd35=_[_0x1c83('0x18')](_0xb409f['body'],{'firstName':_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')],'ListId':_0x50b942[_0x1c83('0x79')]});_0x45cd35[_0xb409f['body']['mapKey']]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x7a')];return db[_0x1c83('0x83')][_0x1c83('0x5c')](_0x45cd35,{'fields':_0x21f041,'raw':!![]});}})[_0x1c83('0x1f')](handleEntityNotFound(_0x6278e7,null))[_0x1c83('0x1f')](function(_0x2be478){_0x15c14e[_0x1c83('0x8d')]=_0x2be478;if(_0x2be478){var _0x4bb096={'ContactId':_0x2be478['id'],'OpenchannelAccountId':_0xb409f['params']['id'],'from':(_0x2be478[_0x1c83('0x8e')]||'')+'\x20'+(_0x2be478[_0x1c83('0x8f')]||'')};var _0x5ba1be={'OpenchannelAccountId':_0xb409f[_0x1c83('0x5a')]['id'],'closed':![]};if(_0xb409f['body']['threadId']){_0x5ba1be[_0x1c83('0x90')]=_0xb409f[_0x1c83('0x5d')]['threadId'];return db[_0x1c83('0x91')]['find']({'where':_0x5ba1be})['then'](function(_0x5c06c2){if(_0x5c06c2){return[_0x5c06c2,![]];}_0x4bb096[_0x1c83('0x90')]=_0xb409f['body'][_0x1c83('0x90')];_0x4bb096['externalUrl']=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x92')];return db[_0x1c83('0x91')][_0x1c83('0x5c')](_0x4bb096)['then'](function(_0x11c780){return[_0x11c780,!![]];});});}else{_0x5ba1be['threadId']=null;}_0x5ba1be[_0x1c83('0x93')]=_0x2be478['id'];return db[_0x1c83('0x91')][_0x1c83('0x5b')]({'where':_0x5ba1be})['then'](function(_0xefe789){if(_0xefe789){return[_0xefe789,![]];}return db[_0x1c83('0x91')][_0x1c83('0x5c')](_0x4bb096)[_0x1c83('0x1f')](function(_0x482893){return[_0x482893,!![]];});});}})[_0x1c83('0x94')](function(_0x119659,_0x23252c){if(_0x119659){_0xc7ce36=_0x23252c;if(!_0x23252c){var _0x23062b={'from':(_0x15c14e[_0x1c83('0x8d')][_0x1c83('0x8e')]||'')+'\x20'+(_0x15c14e[_0x1c83('0x8d')][_0x1c83('0x8f')]||'')};if(_0xb409f['body']['threadId']&&_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')]&&_0xb409f[_0x1c83('0x5d')]['threadId']!=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')]){_0x23062b[_0x1c83('0x90')]=_0xb409f[_0x1c83('0x5d')][_0x1c83('0x95')];}return _0x119659[_0x1c83('0x34')](_0x23062b);}else{return _0x119659;}}})[_0x1c83('0x1f')](function(_0x2dfe27){_0x15c14e['interaction']=_0x2dfe27[_0x1c83('0x36')]({'plain':!![]});_0x15c14e['interaction']['created']=_0xc7ce36;if(_0x15c14e[_0x1c83('0x96')][_0x1c83('0x97')]){if(_0x15c14e[_0x1c83('0x87')][_0x1c83('0x98')]){_0x15c14e['applications'][_0x1c83('0x99')]({'id':0x0,'priority':_0x15c14e[_0x1c83('0x88')]['length']+0x1,'app':_0x1c83('0x9a'),'appdata':_0x1c83('0x9b'),'interval':_0x1c83('0x9c')});}}return db[_0x1c83('0x9d')][_0x1c83('0x5c')]({'body':_0xb409f[_0x1c83('0x5d')]['body'],'OpenchannelAccountId':_0xb409f[_0x1c83('0x5a')]['id'],'OpenchannelInteractionId':_0x2dfe27['id'],'direction':'in','ContactId':_0x15c14e['contact']['id'],'AttachmentId':_0xb409f[_0x1c83('0x5d')][_0x1c83('0x9e')]});})[_0x1c83('0x1f')](function(_0x4a5c8e){_0x15c14e[_0x1c83('0x27')]=_0x4a5c8e;if(_0x15c14e[_0x1c83('0x96')]['UserId']){return db[_0x1c83('0x9f')][_0x1c83('0x5b')]({'attributes':['id',_0x1c83('0x3b')],'where':{'id':_0x15c14e[_0x1c83('0x96')][_0x1c83('0xa0')]}})[_0x1c83('0x1f')](function(_0x23227d){if(_0x23227d){_0x15c14e[_0x1c83('0x88')][_0x1c83('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23227d['name']+','+(_0x15c14e[_0x1c83('0x87')][_0x1c83('0xa2')]||0xa),'interval':_0x1c83('0x9c')});_0x15c14e[_0x1c83('0xa3')]=![];}return respondWithRpcPromise(_0x1c83('0xa4'),_0x1c83('0xa5'),_0x15c14e);});}return respondWithRpcPromise('Start','startRouting',_0x15c14e);})['then'](function(_0x3924ec){respondWithRpcPromise(_0x1c83('0xa6'),'EventManager',{'event':_0x1c83('0x70'),'message':_0x3924ec},client9002);return _0x3924ec;})[_0x1c83('0x1f')](respondWithResult(_0x6278e7,null))[_0x1c83('0x29')](handleError(_0x6278e7,null));};exports[_0x1c83('0xa7')]=function(_0x42202a,_0x23ae2e){var _0xfb57bc=_0x42202a[_0x1c83('0x5a')]['id'];var _0x623f68=_0x42202a[_0x1c83('0x5d')];var _0x5524eb=0xc8;var _0x5c8e18=null;return db[_0x1c83('0xa8')][_0x1c83('0xa9')]({'isolationLevel':db[_0x1c83('0xa8')][_0x1c83('0xaa')][_0x1c83('0xab')][_0x1c83('0xac')]},function(_0x5171d7){return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0xfb57bc},'transaction':_0x5171d7})[_0x1c83('0x1f')](function(_0x5d5801){if(_0x5d5801){return db[_0x1c83('0x85')][_0x1c83('0x35')]({'where':{'OpenchannelAccountId':_0xfb57bc},'transaction':_0x5171d7})[_0x1c83('0x1f')](function(){var _0x113f68=_[_0x1c83('0x40')](_0x623f68,function(_0x2c73dd){_0x2c73dd['OpenchannelAccountId']=_0xfb57bc;return _0x2c73dd;});return db[_0x1c83('0x85')][_0x1c83('0xad')](_0x113f68,{'transaction':_0x5171d7});});}else{_0x5524eb=0x194;_0x5c8e18=[];}});})[_0x1c83('0x1f')](function(){if(_0x5524eb!==0x194){return db[_0x1c83('0x85')][_0x1c83('0xae')]({'where':{'OpenchannelAccountId':_0xfb57bc},'order':_0x1c83('0x8b')})['then'](function(_0x5d161b){_0x5c8e18=_0x5d161b;});}})['catch'](function(_0x5b854d){_0x5524eb=0x1f4;logger[_0x1c83('0x25')](_0x5b854d['stack']);if(_0x5b854d[_0x1c83('0x3b')]){delete _0x5b854d[_0x1c83('0x3b')];}_0x5c8e18=_0x5b854d;})['finally'](function(){if(_0x5c8e18===null){_0x23ae2e[_0x1c83('0x3a')](_0x5524eb);}else{if(_0x5524eb===0x1f4){_0x23ae2e[_0x1c83('0x2a')](_0x5524eb)[_0x1c83('0x3c')](_0x5c8e18);}else{_0x23ae2e[_0x1c83('0x2a')](_0x5524eb)['json'](_0x5c8e18);}}});};exports[_0x1c83('0xaf')]=function(_0x30a6a1,_0x25bedb,_0x4a51f2){var _0x15a166={};var _0x963a30={};var _0x53641c;var _0x2ad10b;return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x30a6a1[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x25bedb,null))[_0x1c83('0x1f')](function(_0xacd22f){if(_0xacd22f){_0x53641c=_0xacd22f;_0x963a30['model']=_[_0x1c83('0x48')](db[_0x1c83('0x85')][_0x1c83('0x42')]);_0x963a30[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x30a6a1[_0x1c83('0x47')]);_0x963a30['filters']=_[_0x1c83('0x4a')](_0x963a30[_0x1c83('0x46')],_0x963a30[_0x1c83('0x47')]);_0x15a166['attributes']=_['intersection'](_0x963a30[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x30a6a1[_0x1c83('0x47')]['fields']));_0x15a166[_0x1c83('0x4b')]=_0x15a166[_0x1c83('0x4b')]['length']?_0x15a166['attributes']:_0x963a30['model'];_0x15a166['order']=qs['sort'](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x4f')]);_0x15a166['where']=qs['filters'](_[_0x1c83('0x51')](_0x30a6a1[_0x1c83('0x47')],_0x963a30[_0x1c83('0x49')]));if(_0x30a6a1['query']['filter']){_0x15a166[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x15a166[_0x1c83('0x50')],{'$or':_[_0x1c83('0x40')](_0x15a166[_0x1c83('0x4b')],function(_0x10ff74){var _0x26b658={};_0x26b658[_0x10ff74]={'$like':'%'+_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x26b658;})});}_0x15a166=_[_0x1c83('0x52')]({},_0x15a166,_0x30a6a1['options']);return _0x53641c[_0x1c83('0xaf')](_0x15a166);}})[_0x1c83('0x1f')](function(_0x2c7e42){if(_0x2c7e42){_0x2ad10b=_0x2c7e42['length'];if(!_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x15a166[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x15a166['offset']=qs[_0x1c83('0x2c')](_0x30a6a1[_0x1c83('0x47')][_0x1c83('0x2c')]);}return _0x53641c[_0x1c83('0xaf')](_0x15a166);}})[_0x1c83('0x1f')](function(_0x50be7d){if(_0x50be7d){return _0x50be7d?{'count':_0x2ad10b,'rows':_0x50be7d}:null;}})[_0x1c83('0x1f')](respondWithResult(_0x25bedb,null))[_0x1c83('0x29')](handleError(_0x25bedb,null));};exports[_0x1c83('0xb0')]=function(_0x1a3ad3,_0x477ff8,_0x2ab498){var _0x4affec={'raw':![],'where':{}};var _0x4f0710={};var _0x3d12cc={'count':0x0,'rows':[]};return db[_0x1c83('0x41')]['findOne']({'where':{'id':_0x1a3ad3[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x477ff8,null))['then'](function(_0x2858ba){if(_0x2858ba){_0x4f0710[_0x1c83('0x46')]=_['keys'](db[_0x1c83('0x91')][_0x1c83('0x42')]);_0x4f0710[_0x1c83('0x47')]=_[_0x1c83('0x48')](_0x1a3ad3[_0x1c83('0x47')]);_0x4f0710[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x4f0710[_0x1c83('0x46')],_0x4f0710[_0x1c83('0x47')]);_0x4affec[_0x1c83('0x4b')]=_[_0x1c83('0x4a')](_0x4f0710[_0x1c83('0x46')],qs[_0x1c83('0x4c')](_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x4c')]));_0x4affec[_0x1c83('0x4b')]=_0x4affec['attributes'][_0x1c83('0x4d')]?_0x4affec[_0x1c83('0x4b')]:_0x4f0710[_0x1c83('0x46')];if(!_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x4e')](_0x1c83('0x68'))){_0x4affec[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0x1a3ad3['query'][_0x1c83('0x2f')]);_0x4affec[_0x1c83('0x2c')]=qs['offset'](_0x1a3ad3[_0x1c83('0x47')]['offset']);}_0x4affec[_0x1c83('0x6e')]=qs['sort'](_0x1a3ad3[_0x1c83('0x47')]['sort']);_0x4affec['where']=qs['filters'](_[_0x1c83('0x51')](_0x1a3ad3[_0x1c83('0x47')],_0x4f0710['filters']));_0x4affec['where']['OpenchannelAccountId']=_0x2858ba['id'];if(_0x1a3ad3[_0x1c83('0x47')]['filter']){_0x4affec[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x4affec['where'],{'$or':_[_0x1c83('0x40')](_0x4affec[_0x1c83('0x4b')],function(_0x4a8897){var _0x3609ea={};_0x3609ea[_0x4a8897]={'$like':'%'+_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x3609ea;})});}_0x4affec=_[_0x1c83('0x52')]({},_0x4affec,_0x1a3ad3['options']);return db['OpenchannelInteraction']['count']({'where':_0x4affec[_0x1c83('0x50')]})['then'](function(_0x1bfc02){_0x3d12cc['count']=_0x1bfc02;if(_0x1a3ad3[_0x1c83('0x47')]['includeAll']){_0x4affec[_0x1c83('0x57')]=[{'model':db['CmContact'],'as':_0x1c83('0xb1'),'required':![]},{'model':db[_0x1c83('0x9f')],'as':_0x1c83('0xb2'),'attributes':['name',_0x1c83('0xb3'),_0x1c83('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x1c83('0xb5'),'attributes':['id','name',_0x1c83('0xb6')],'where':_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0xb7')]?{'id':_0x1a3ad3[_0x1c83('0x47')][_0x1c83('0xb7')]}:undefined,'required':_0x1a3ad3['query'][_0x1c83('0xb7')]?!![]:![]}];}return db[_0x1c83('0x91')][_0x1c83('0x69')](_0x4affec);})[_0x1c83('0x1f')](function(_0x229c20){_0x3d12cc[_0x1c83('0x58')]=_0x229c20;return _0x3d12cc;});}})[_0x1c83('0x1f')](respondWithFilteredResult(_0x477ff8,_0x4affec))[_0x1c83('0x29')](handleError(_0x477ff8,null));};exports[_0x1c83('0xb8')]=function(_0x57a259,_0x6a6e94,_0x1e7de4){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x57a259[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x6a6e94,null))[_0x1c83('0x1f')](function(_0x4ec817){if(_0x4ec817){return _0x4ec817[_0x1c83('0xb8')](_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')],_[_0x1c83('0xb9')](_0x57a259[_0x1c83('0x5d')],[_0x1c83('0x6b'),'id'])||{})['spread'](function(_0x6301c3){for(var _0xb80b2b=0x0;_0xb80b2b<_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')][_0x1c83('0x4d')];_0xb80b2b+=0x1){socket[_0x1c83('0xba')](_0x1c83('0xbb'),{'UserId':Number(_0x57a259[_0x1c83('0x5d')][_0x1c83('0x6b')][_0xb80b2b]),'OpenchannelAccountId':Number(_0x57a259[_0x1c83('0x5a')]['id'])});}return _0x6301c3;});}})['then'](respondWithResult(_0x6a6e94,null))[_0x1c83('0x29')](handleError(_0x6a6e94,null));};exports[_0x1c83('0xbc')]=function(_0x59800b,_0x41568b,_0x5a224a){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x59800b[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x41568b,null))[_0x1c83('0x1f')](function(_0x2c1956){if(_0x2c1956){return _0x2c1956[_0x1c83('0xbc')](_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')])[_0x1c83('0x1f')](function(){if(_[_0x1c83('0xbd')](_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')])){for(var _0xaa970c=0x0;_0xaa970c<_0x59800b[_0x1c83('0x47')]['ids']['length'];_0xaa970c+=0x1){socket[_0x1c83('0xba')](_0x1c83('0xbe'),{'UserId':Number(_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')][_0xaa970c]),'OpenchannelAccountId':Number(_0x59800b[_0x1c83('0x5a')]['id'])});}}else{socket[_0x1c83('0xba')](_0x1c83('0xbe'),{'UserId':Number(_0x59800b[_0x1c83('0x47')][_0x1c83('0x6b')]),'OpenchannelAccountId':Number(_0x59800b[_0x1c83('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x41568b,null))[_0x1c83('0x29')](handleError(_0x41568b,null));};exports[_0x1c83('0xbf')]=function(_0xbc51e2,_0x2eece2,_0x195633){var _0x11edab={};var _0x5411ad={};var _0x3f8096;var _0x2ddd18;return db[_0x1c83('0x41')][_0x1c83('0x67')]({'where':{'id':_0xbc51e2[_0x1c83('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2eece2,null))[_0x1c83('0x1f')](function(_0x5cec4d){if(_0x5cec4d){_0x3f8096=_0x5cec4d;_0x5411ad[_0x1c83('0x46')]=_['keys'](db[_0x1c83('0x9f')][_0x1c83('0x42')]);_0x5411ad[_0x1c83('0x47')]=_['keys'](_0xbc51e2[_0x1c83('0x47')]);_0x5411ad[_0x1c83('0x49')]=_[_0x1c83('0x4a')](_0x5411ad[_0x1c83('0x46')],_0x5411ad['query']);_0x11edab['attributes']=_[_0x1c83('0x4a')](_0x5411ad['model'],qs['fields'](_0xbc51e2[_0x1c83('0x47')]['fields']));_0x11edab[_0x1c83('0x4b')]=_0x11edab[_0x1c83('0x4b')]['length']?_0x11edab['attributes']:_0x5411ad['model'];_0x11edab['order']=qs[_0x1c83('0x4f')](_0xbc51e2[_0x1c83('0x47')]['sort']);_0x11edab[_0x1c83('0x50')]=qs['filters'](_[_0x1c83('0x51')](_0xbc51e2['query'],_0x5411ad[_0x1c83('0x49')]));if(_0xbc51e2[_0x1c83('0x47')]['filter']){_0x11edab[_0x1c83('0x50')]=_[_0x1c83('0x52')](_0x11edab[_0x1c83('0x50')],{'$or':_[_0x1c83('0x40')](_0x11edab[_0x1c83('0x4b')],function(_0x360f8f){var _0x5ccfad={};_0x5ccfad[_0x360f8f]={'$like':'%'+_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x54')]+'%'};return _0x5ccfad;})});}_0x11edab=_[_0x1c83('0x52')]({},_0x11edab,_0xbc51e2[_0x1c83('0x55')]);return _0x3f8096['getAgents'](_0x11edab);}})['then'](function(_0x4f4780){if(_0x4f4780){_0x2ddd18=_0x4f4780[_0x1c83('0x4d')];if(!_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x4e')]('nolimit')){_0x11edab[_0x1c83('0x2f')]=qs[_0x1c83('0x2f')](_0xbc51e2[_0x1c83('0x47')][_0x1c83('0x2f')]);_0x11edab['offset']=qs[_0x1c83('0x2c')](_0xbc51e2[_0x1c83('0x47')]['offset']);}return _0x3f8096[_0x1c83('0xbf')](_0x11edab);}})[_0x1c83('0x1f')](function(_0x4fbb67){if(_0x4fbb67){return _0x4fbb67?{'count':_0x2ddd18,'rows':_0x4fbb67}:null;}})[_0x1c83('0x1f')](respondWithResult(_0x2eece2,null))[_0x1c83('0x29')](handleError(_0x2eece2,null));};exports[_0x1c83('0x3c')]=function(_0x400dd6,_0x40794a,_0x29e647){var _0x4b71f0,_0xa4a4af,_0x5db197;if(_['isNil'](_0x400dd6['body'][_0x1c83('0x5d')])||_0x400dd6[_0x1c83('0x5d')]['body']===''){throw new db['Sequelize'][(_0x1c83('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x400dd6['body']['to'])){}_0x4b71f0=_0x400dd6['body']['to'];return db['OpenchannelAccount'][_0x1c83('0x67')]({'where':{'id':_0x400dd6[_0x1c83('0x5a')]['id']}})[_0x1c83('0x1f')](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x7ace62){if(_0x7ace62){return db[_0x1c83('0x41')][_0x1c83('0x5b')]({'where':{'id':_0x7ace62['id']},'include':[{'model':db[_0x1c83('0x81')],'as':_0x1c83('0x82'),'include':[{'model':db[_0x1c83('0x83')],'as':_0x1c83('0x84'),'where':{[_0x7ace62[_0x1c83('0x80')]]:_0x4b71f0},'limit':0x1,'order':[[_0x1c83('0x77'),_0x1c83('0xc0')]]}]}]})[_0x1c83('0x1f')](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x3e1c9c){if(_0x3e1c9c&&_0x3e1c9c[_0x1c83('0x82')]){_0xa4a4af=_0x3e1c9c[_0x1c83('0x36')]({'plain':!![]});if(_0xa4a4af['List']&&_0xa4a4af['List'][_0x1c83('0x84')][_0x1c83('0x4d')]){return _0xa4a4af[_0x1c83('0x82')]['Contacts'][0x0];}return db[_0x1c83('0x83')][_0x1c83('0x5c')](_[_0x1c83('0x18')](_0x400dd6[_0x1c83('0x5d')],{'firstName':_0x4b71f0,[_0x3e1c9c['mapKey']]:_0x4b71f0,'phone':_0x4b71f0,'ListId':_0xa4a4af[_0x1c83('0x79')]}));}})['then'](handleEntityNotFound(_0x40794a,null))[_0x1c83('0x1f')](function(_0x5df6ea){if(_0x5df6ea){_0x5db197=_0x5df6ea;return db[_0x1c83('0x91')][_0x1c83('0x5b')]({'where':{'ContactId':_0x5db197['id'],'closed':![],'OpenchannelAccountId':_0xa4a4af['id']}})['then'](function(_0x10e042){if(_0x10e042){return[_0x10e042,![]];}return db[_0x1c83('0x91')][_0x1c83('0x5c')]({'UserId':_0x400dd6[_0x1c83('0x5f')]['id'],'ContactId':_0x5db197['id'],'OpenchannelAccountId':_0xa4a4af['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1c83('0xc1'),'Messages':[_['merge'](_0x400dd6[_0x1c83('0x5d')],{'read':![],'body':_0x400dd6[_0x1c83('0x5d')][_0x1c83('0x5d')],'OpenchannelAccountId':_0xa4a4af['id'],'UserId':_0x400dd6[_0x1c83('0x5f')]['id'],'ContactId':_0x5db197['id']})]},{'include':[{'model':db[_0x1c83('0x9d')],'as':'Messages'}]})[_0x1c83('0x1f')](function(_0x4f04ed){return[_0x4f04ed,!![]];});});}})[_0x1c83('0x94')](function(_0x2933a5,_0x9711f5){if(_0x9711f5){return _0x2933a5;}return db[_0x1c83('0x9d')][_0x1c83('0x5c')](_[_0x1c83('0x52')](_0x400dd6[_0x1c83('0x5d')],{'read':![],'body':_0x400dd6[_0x1c83('0x5d')][_0x1c83('0x5d')],'OpenchannelAccountId':_0xa4a4af['id'],'OpenchannelInteractionId':_0x2933a5['id'],'UserId':_0x400dd6['user']['id'],'ContactId':_0x5db197['id']}))['then'](function(_0x25de6f){_0x2933a5['dataValues'][_0x1c83('0xc2')]=[];_0x2933a5[_0x1c83('0xc3')][_0x1c83('0xc2')][_0x1c83('0x99')](_0x25de6f['dataValues']);return _0x2933a5;});});}})[_0x1c83('0x1f')](respondWithResult(_0x40794a,null))[_0x1c83('0x29')](handleError(_0x40794a,null));}; \ No newline at end of file +var _0x38c3=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','OpenchannelApplication','Applications','applications','List','orderBy','priority','asc','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x38c3,0x13d));var _0x338c=function(_0x52ad5f,_0x16d1a3){_0x52ad5f=_0x52ad5f-0x0;var _0xb217a2=_0x38c3[_0x52ad5f];return _0xb217a2;};'use strict';var emlformat=require(_0x338c('0x0'));var rimraf=require(_0x338c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x338c('0x2'));var rp=require(_0x338c('0x3'));var moment=require(_0x338c('0x4'));var BPromise=require(_0x338c('0x5'));var Mustache=require(_0x338c('0x6'));var util=require(_0x338c('0x7'));var path=require('path');var sox=require(_0x338c('0x8'));var csv=require('to-csv');var ejs=require(_0x338c('0x9'));var fs=require('fs');var fs_extra=require(_0x338c('0xa'));var _=require('lodash');var squel=require(_0x338c('0xb'));var crypto=require(_0x338c('0xc'));var jsforce=require(_0x338c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x338c('0xe'));var querystring=require(_0x338c('0xf'));var Papa=require(_0x338c('0x10'));var Redis=require(_0x338c('0x11'));var authService=require(_0x338c('0x12'));var qs=require(_0x338c('0x13'));var as=require(_0x338c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x338c('0x15'))(_0x338c('0x16'));var utils=require('../../config/utils');var config=require(_0x338c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x338c('0x18'))['db'];config[_0x338c('0x19')]=_['defaults'](config[_0x338c('0x19')],{'host':_0x338c('0x1a'),'port':0x18eb});var socket=require(_0x338c('0x1b'))(new Redis(config[_0x338c('0x19')]));require(_0x338c('0x1c'))[_0x338c('0x1d')](socket);var jayson=require(_0x338c('0x1e'));var client=jayson[_0x338c('0x1f')][_0x338c('0x20')]({'port':0x232c});var client9002=jayson[_0x338c('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5afbd4,_0x26a6dd,_0x306097,_0xbbb319){return new BPromise(function(_0x21cbd4,_0x5eca2b){var _0x22a70b=_0xbbb319||client;return _0x22a70b[_0x338c('0x21')](_0x5afbd4,_0x306097)[_0x338c('0x22')](function(_0x307f7b){logger[_0x338c('0x23')](_0x338c('0x24'),_0x26a6dd,_0x338c('0x25'));logger[_0x338c('0x26')](_0x338c('0x27'),_0x26a6dd,_0x338c('0x25'),JSON[_0x338c('0x28')](_0x307f7b));if(_0x307f7b[_0x338c('0x29')]){if(_0x307f7b[_0x338c('0x29')]['code']===0x1f4){logger['error'](_0x338c('0x24'),_0x26a6dd,_0x307f7b[_0x338c('0x29')][_0x338c('0x2a')]);return _0x5eca2b(_0x307f7b[_0x338c('0x29')]['message']);}logger[_0x338c('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x26a6dd,_0x307f7b[_0x338c('0x29')][_0x338c('0x2a')]);return _0x21cbd4(_0x307f7b['error'][_0x338c('0x2a')]);}else{logger[_0x338c('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x26a6dd,_0x338c('0x25'));_0x21cbd4(_0x307f7b[_0x338c('0x2b')][_0x338c('0x2a')]);}})[_0x338c('0x2c')](function(_0x26013d){logger[_0x338c('0x29')](_0x338c('0x24'),_0x26a6dd,_0x26013d);_0x5eca2b(_0x26013d);});});}function respondWithStatusCode(_0x71acf4,_0x1deeda){_0x1deeda=_0x1deeda||0xcc;return function(_0x54d94d){if(_0x54d94d){return _0x71acf4[_0x338c('0x2d')](_0x1deeda);}return _0x71acf4[_0x338c('0x2e')](_0x1deeda)[_0x338c('0x2f')]();};}function respondWithResult(_0x4d78a5,_0x3ae957){_0x3ae957=_0x3ae957||0xc8;return function(_0x2ab079){if(_0x2ab079){return _0x4d78a5['status'](_0x3ae957)[_0x338c('0x30')](_0x2ab079);}};}function respondWithFilteredResult(_0x164260,_0x1cb5d9){return function(_0x37e72a){if(_0x37e72a){var _0x1b7339=typeof _0x1cb5d9[_0x338c('0x31')]==='undefined'&&typeof _0x1cb5d9['limit']===_0x338c('0x32');var _0x35e84a=_0x37e72a[_0x338c('0x33')];var _0x469c25=_0x1b7339?0x0:_0x1cb5d9[_0x338c('0x31')];var _0x4d924c=_0x1b7339?_0x37e72a['count']:_0x1cb5d9[_0x338c('0x31')]+_0x1cb5d9['limit'];var _0x301e21;if(_0x4d924c>=_0x35e84a){_0x4d924c=_0x35e84a;_0x301e21=0xc8;}else{_0x301e21=0xce;}_0x164260[_0x338c('0x2e')](_0x301e21);return _0x164260[_0x338c('0x34')](_0x338c('0x35'),_0x469c25+'-'+_0x4d924c+'/'+_0x35e84a)[_0x338c('0x30')](_0x37e72a);}return null;};}function patchUpdates(_0x3ef888){return function(_0x4a148e){try{jsonpatch['apply'](_0x4a148e,_0x3ef888,!![]);}catch(_0x578de2){return BPromise[_0x338c('0x36')](_0x578de2);}return _0x4a148e[_0x338c('0x37')]();};}function saveUpdates(_0x5314b0,_0x1656c6){return function(_0x3a0edd){if(_0x3a0edd){return _0x3a0edd[_0x338c('0x38')](_0x5314b0)[_0x338c('0x22')](function(_0x15b48b){return _0x15b48b;});}return null;};}function removeEntity(_0x276a11,_0x579073){return function(_0x420ff8){if(_0x420ff8){return _0x420ff8[_0x338c('0x39')]()[_0x338c('0x22')](function(){var _0x5715ab=_0x420ff8[_0x338c('0x3a')]({'plain':!![]});var _0x358d4d=_0x338c('0x3b');return db[_0x338c('0x3c')][_0x338c('0x39')]({'where':{'type':_0x358d4d,'resourceId':_0x5715ab['id']}})[_0x338c('0x22')](function(){return _0x420ff8;});})[_0x338c('0x22')](function(){_0x276a11[_0x338c('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33699e,_0x15d672){return function(_0x1837dd){if(!_0x1837dd){_0x33699e[_0x338c('0x2d')](0x194);}return _0x1837dd;};}function handleError(_0x525404,_0x314b95){_0x314b95=_0x314b95||0x1f4;return function(_0x451a58){logger[_0x338c('0x29')](_0x451a58[_0x338c('0x3d')]);if(_0x451a58['name']){delete _0x451a58[_0x338c('0x3e')];}_0x525404[_0x338c('0x2e')](_0x314b95)[_0x338c('0x3f')](_0x451a58);};}exports[_0x338c('0x40')]=function(_0x1b7ea8,_0x38e891){var _0xba3b1b={'include':[{'model':db[_0x338c('0x41')],'as':_0x338c('0x42')}]},_0x227648={},_0x1208fe={'count':0x0,'rows':[]};var _0x39498d=_[_0x338c('0x43')](db[_0x338c('0x44')][_0x338c('0x45')],function(_0xe7a15f){return{'name':_0xe7a15f[_0x338c('0x46')],'type':_0xe7a15f[_0x338c('0x47')][_0x338c('0x48')]};});_0x227648[_0x338c('0x49')]=_[_0x338c('0x43')](_0x39498d,_0x338c('0x3e'));_0x227648[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x1b7ea8[_0x338c('0x4a')]);_0x227648[_0x338c('0x4c')]=_['intersection'](_0x227648[_0x338c('0x49')],_0x227648['query']);_0xba3b1b[_0x338c('0x4d')]=_[_0x338c('0x4e')](_0x227648[_0x338c('0x49')],qs['fields'](_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x4f')]));_0xba3b1b[_0x338c('0x4d')]=_0xba3b1b[_0x338c('0x4d')][_0x338c('0x50')]?_0xba3b1b[_0x338c('0x4d')]:_0x227648[_0x338c('0x49')];if(!_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x51')](_0x338c('0x52'))){_0xba3b1b['limit']=qs[_0x338c('0x53')](_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x53')]);_0xba3b1b['offset']=qs[_0x338c('0x31')](_0x1b7ea8[_0x338c('0x4a')]['offset']);}_0xba3b1b[_0x338c('0x54')]=qs[_0x338c('0x55')](_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x55')]);_0xba3b1b['where']=qs[_0x338c('0x4c')](_[_0x338c('0x56')](_0x1b7ea8['query'],_0x227648[_0x338c('0x4c')]),_0x39498d);if(_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x57')]){_0xba3b1b[_0x338c('0x58')]=_[_0x338c('0x59')](_0xba3b1b[_0x338c('0x58')],{'$or':_[_0x338c('0x43')](_0x39498d,function(_0x30747f){if(_0x30747f['type']!==_0x338c('0x5a')){var _0x2b3943={};_0x2b3943[_0x30747f[_0x338c('0x3e')]]={'$like':'%'+_0x1b7ea8[_0x338c('0x4a')]['filter']+'%'};return _0x2b3943;}})});}_0xba3b1b=_[_0x338c('0x59')]({},_0xba3b1b,_0x1b7ea8[_0x338c('0x5b')]);var _0x5ea49f={'where':_0xba3b1b['where']};return db['OpenchannelAccount'][_0x338c('0x33')](_0x5ea49f)[_0x338c('0x22')](function(_0x3a4eb8){_0x1208fe['count']=_0x3a4eb8;if(_0x1b7ea8[_0x338c('0x4a')][_0x338c('0x5c')]){_0xba3b1b['include']=[{'all':!![]}];}return db[_0x338c('0x44')][_0x338c('0x5d')](_0xba3b1b);})[_0x338c('0x22')](function(_0x51f67f){_0x1208fe[_0x338c('0x5e')]=_0x51f67f;return _0x1208fe;})[_0x338c('0x22')](respondWithFilteredResult(_0x38e891,_0xba3b1b))['catch'](handleError(_0x38e891,null));};exports[_0x338c('0x5f')]=function(_0x598a4f,_0x110e97){var _0x3a796d={'raw':![],'where':{'id':_0x598a4f[_0x338c('0x60')]['id']},'include':[{'model':db[_0x338c('0x41')],'as':_0x338c('0x42')}]},_0x451c23={};_0x451c23[_0x338c('0x49')]=_[_0x338c('0x4b')](db[_0x338c('0x44')][_0x338c('0x45')]);_0x451c23['query']=_['keys'](_0x598a4f[_0x338c('0x4a')]);_0x451c23[_0x338c('0x4c')]=_[_0x338c('0x4e')](_0x451c23[_0x338c('0x49')],_0x451c23[_0x338c('0x4a')]);_0x3a796d[_0x338c('0x4d')]=_[_0x338c('0x4e')](_0x451c23[_0x338c('0x49')],qs[_0x338c('0x4f')](_0x598a4f[_0x338c('0x4a')][_0x338c('0x4f')]));_0x3a796d[_0x338c('0x4d')]=_0x3a796d['attributes'][_0x338c('0x50')]?_0x3a796d['attributes']:_0x451c23['model'];if(_0x598a4f[_0x338c('0x4a')][_0x338c('0x5c')]){_0x3a796d['include']=[{'all':!![]}];}_0x3a796d=_['merge']({},_0x3a796d,_0x598a4f['options']);return db[_0x338c('0x44')][_0x338c('0x61')](_0x3a796d)[_0x338c('0x22')](handleEntityNotFound(_0x110e97,null))[_0x338c('0x22')](respondWithResult(_0x110e97,null))[_0x338c('0x2c')](handleError(_0x110e97,null));};exports[_0x338c('0x62')]=function(_0x4d920f,_0x4df959){return db[_0x338c('0x44')][_0x338c('0x62')](_0x4d920f[_0x338c('0x63')],{})['then'](function(_0x2ecdbe){var _0x1abb1d=_0x4d920f[_0x338c('0x64')][_0x338c('0x3a')]({'plain':!![]});if(!_0x1abb1d)throw new Error(_0x338c('0x65'));if(_0x1abb1d[_0x338c('0x66')]===_0x338c('0x64')){var _0x10481f=_0x2ecdbe[_0x338c('0x3a')]({'plain':!![]});var _0x148071=_0x338c('0x3b');return db[_0x338c('0x67')][_0x338c('0x61')]({'where':{'name':_0x148071,'userProfileId':_0x1abb1d['userProfileId']},'raw':!![]})['then'](function(_0x2d127b){if(_0x2d127b&&_0x2d127b[_0x338c('0x68')]===0x0){return db[_0x338c('0x3c')][_0x338c('0x62')]({'name':_0x10481f[_0x338c('0x3e')],'resourceId':_0x10481f['id'],'type':_0x2d127b[_0x338c('0x3e')],'sectionId':_0x2d127b['id']},{})[_0x338c('0x22')](function(){return _0x2ecdbe;});}else{return _0x2ecdbe;}})[_0x338c('0x2c')](function(_0x2a0c1b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a0c1b);throw _0x2a0c1b;});}return _0x2ecdbe;})[_0x338c('0x22')](respondWithResult(_0x4df959,0xc9))['catch'](handleError(_0x4df959,null));};exports[_0x338c('0x38')]=function(_0x31b057,_0x5e629b){if(_0x31b057[_0x338c('0x63')]['id']){delete _0x31b057[_0x338c('0x63')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x31b057[_0x338c('0x60')]['id']},'include':[{'model':db[_0x338c('0x41')],'as':_0x338c('0x42')}]})[_0x338c('0x22')](handleEntityNotFound(_0x5e629b,null))['then'](saveUpdates(_0x31b057['body'],null))[_0x338c('0x22')](respondWithResult(_0x5e629b,null))[_0x338c('0x2c')](handleError(_0x5e629b,null));};exports[_0x338c('0x39')]=function(_0xbb8c7b,_0x55890c){return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0xbb8c7b['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x55890c,null))[_0x338c('0x22')](removeEntity(_0x55890c,null))[_0x338c('0x2c')](handleError(_0x55890c,null));};exports[_0x338c('0x69')]=function(_0x3813e7,_0x22d4ed){return db[_0x338c('0x44')][_0x338c('0x69')]()[_0x338c('0x22')](respondWithResult(_0x22d4ed,null))[_0x338c('0x2c')](handleError(_0x22d4ed,null));};exports[_0x338c('0x6a')]=function(_0x220500,_0x41f371,_0xe207b2){if(_0x220500[_0x338c('0x63')]['id']){delete _0x220500['body']['id'];}return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0x220500[_0x338c('0x60')]['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x41f371,null))['then'](function(_0x2499c3){if(_0x2499c3){_0x220500[_0x338c('0x63')][_0x338c('0x6b')]=_0x2499c3['id'];return db['Disposition'][_0x338c('0x62')](_0x220500[_0x338c('0x63')]);}})[_0x338c('0x22')](respondWithResult(_0x41f371,null))[_0x338c('0x2c')](handleError(_0x41f371,null));};exports[_0x338c('0x6c')]=function(_0x17bb47,_0x3798bf,_0x3a8d54){var _0xc6490a={'raw':![],'where':{}};var _0x4eb69d={};var _0x2dda13={'count':0x0,'rows':[]};return db[_0x338c('0x44')][_0x338c('0x6d')]({'where':{'id':_0x17bb47['params']['id']}})['then'](handleEntityNotFound(_0x3798bf,null))[_0x338c('0x22')](function(_0x23d801){if(_0x23d801){_0x4eb69d[_0x338c('0x49')]=_[_0x338c('0x4b')](db['Disposition']['rawAttributes']);_0x4eb69d[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x17bb47[_0x338c('0x4a')]);_0x4eb69d[_0x338c('0x4c')]=_['intersection'](_0x4eb69d[_0x338c('0x49')],_0x4eb69d[_0x338c('0x4a')]);_0xc6490a['attributes']=_[_0x338c('0x4e')](_0x4eb69d[_0x338c('0x49')],qs['fields'](_0x17bb47[_0x338c('0x4a')][_0x338c('0x4f')]));_0xc6490a[_0x338c('0x4d')]=_0xc6490a['attributes'][_0x338c('0x50')]?_0xc6490a[_0x338c('0x4d')]:_0x4eb69d['model'];if(!_0x17bb47[_0x338c('0x4a')][_0x338c('0x51')](_0x338c('0x52'))){_0xc6490a[_0x338c('0x53')]=qs[_0x338c('0x53')](_0x17bb47[_0x338c('0x4a')][_0x338c('0x53')]);_0xc6490a[_0x338c('0x31')]=qs['offset'](_0x17bb47[_0x338c('0x4a')][_0x338c('0x31')]);}_0xc6490a['order']=qs['sort'](_0x17bb47[_0x338c('0x4a')][_0x338c('0x55')]);_0xc6490a[_0x338c('0x58')]=qs[_0x338c('0x4c')](_['pick'](_0x17bb47[_0x338c('0x4a')],_0x4eb69d[_0x338c('0x4c')]));_0xc6490a[_0x338c('0x58')][_0x338c('0x6b')]=_0x23d801['id'];if(_0x17bb47[_0x338c('0x4a')][_0x338c('0x57')]){_0xc6490a['where']=_[_0x338c('0x59')](_0xc6490a[_0x338c('0x58')],{'$or':_['map'](_0xc6490a[_0x338c('0x4d')],function(_0x2339f0){var _0x297f03={};_0x297f03[_0x2339f0]={'$like':'%'+_0x17bb47[_0x338c('0x4a')][_0x338c('0x57')]+'%'};return _0x297f03;})});}_0xc6490a=_['merge']({},_0xc6490a,_0x17bb47[_0x338c('0x5b')]);return db[_0x338c('0x6e')]['count']({'where':_0xc6490a[_0x338c('0x58')]})[_0x338c('0x22')](function(_0x4fb894){_0x2dda13['count']=_0x4fb894;if(_0x17bb47[_0x338c('0x4a')][_0x338c('0x5c')]){_0xc6490a[_0x338c('0x6f')]=[{'all':!![]}];}return db['Disposition'][_0x338c('0x5d')](_0xc6490a);})[_0x338c('0x22')](function(_0x147ece){_0x2dda13[_0x338c('0x5e')]=_0x147ece;return _0x2dda13;});}})[_0x338c('0x22')](respondWithFilteredResult(_0x3798bf,_0xc6490a))['catch'](handleError(_0x3798bf,null));};exports[_0x338c('0x70')]=function(_0x5a8c12,_0x4e7593,_0x5b82e6){return db[_0x338c('0x44')]['find']({'where':{'id':_0x5a8c12['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x4e7593,null))[_0x338c('0x22')](function(_0x5ce7fe){if(_0x5ce7fe){return _0x5ce7fe[_0x338c('0x70')](_0x5a8c12[_0x338c('0x4a')][_0x338c('0x71')]);}})[_0x338c('0x22')](respondWithStatusCode(_0x4e7593,null))[_0x338c('0x2c')](handleError(_0x4e7593,null));};exports[_0x338c('0x72')]=function(_0x238445,_0x320afb,_0x5194fd){if(_0x238445[_0x338c('0x63')]['id']){delete _0x238445['body']['id'];}return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0x238445['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x320afb,null))[_0x338c('0x22')](function(_0x3bf608){if(_0x3bf608){_0x238445['body'][_0x338c('0x6b')]=_0x3bf608['id'];return db[_0x338c('0x73')]['create'](_0x238445['body']);}})[_0x338c('0x22')](respondWithResult(_0x320afb,null))['catch'](handleError(_0x320afb,null));};exports[_0x338c('0x74')]=function(_0x8ce800,_0x18c973,_0x30be59){var _0x2f7dad={'raw':![],'where':{}};var _0x5d997c={};var _0x2d0aab={'count':0x0,'rows':[]};return db[_0x338c('0x44')][_0x338c('0x6d')]({'where':{'id':_0x8ce800['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x18c973,null))[_0x338c('0x22')](function(_0x2922ed){if(_0x2922ed){_0x5d997c['model']=_[_0x338c('0x4b')](db[_0x338c('0x73')]['rawAttributes']);_0x5d997c[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x8ce800['query']);_0x5d997c['filters']=_[_0x338c('0x4e')](_0x5d997c[_0x338c('0x49')],_0x5d997c[_0x338c('0x4a')]);_0x2f7dad[_0x338c('0x4d')]=_[_0x338c('0x4e')](_0x5d997c[_0x338c('0x49')],qs[_0x338c('0x4f')](_0x8ce800[_0x338c('0x4a')][_0x338c('0x4f')]));_0x2f7dad[_0x338c('0x4d')]=_0x2f7dad[_0x338c('0x4d')][_0x338c('0x50')]?_0x2f7dad['attributes']:_0x5d997c[_0x338c('0x49')];if(!_0x8ce800[_0x338c('0x4a')][_0x338c('0x51')](_0x338c('0x52'))){_0x2f7dad[_0x338c('0x53')]=qs[_0x338c('0x53')](_0x8ce800[_0x338c('0x4a')]['limit']);_0x2f7dad['offset']=qs[_0x338c('0x31')](_0x8ce800[_0x338c('0x4a')][_0x338c('0x31')]);}_0x2f7dad[_0x338c('0x54')]=qs['sort'](_0x8ce800[_0x338c('0x4a')]['sort']);_0x2f7dad[_0x338c('0x58')]=qs[_0x338c('0x4c')](_['pick'](_0x8ce800[_0x338c('0x4a')],_0x5d997c[_0x338c('0x4c')]));_0x2f7dad['where'][_0x338c('0x6b')]=_0x2922ed['id'];if(_0x8ce800['query'][_0x338c('0x57')]){_0x2f7dad[_0x338c('0x58')]=_[_0x338c('0x59')](_0x2f7dad[_0x338c('0x58')],{'$or':_['map'](_0x2f7dad['attributes'],function(_0x56cb3f){var _0x35c4b0={};_0x35c4b0[_0x56cb3f]={'$like':'%'+_0x8ce800[_0x338c('0x4a')]['filter']+'%'};return _0x35c4b0;})});}_0x2f7dad=_[_0x338c('0x59')]({},_0x2f7dad,_0x8ce800[_0x338c('0x5b')]);return db[_0x338c('0x73')][_0x338c('0x33')]({'where':_0x2f7dad[_0x338c('0x58')]})['then'](function(_0x361991){_0x2d0aab[_0x338c('0x33')]=_0x361991;if(_0x8ce800[_0x338c('0x4a')][_0x338c('0x5c')]){_0x2f7dad[_0x338c('0x6f')]=[{'all':!![]}];}return db[_0x338c('0x73')]['findAll'](_0x2f7dad);})[_0x338c('0x22')](function(_0x33d10f){_0x2d0aab[_0x338c('0x5e')]=_0x33d10f;return _0x2d0aab;});}})[_0x338c('0x22')](respondWithFilteredResult(_0x18c973,_0x2f7dad))[_0x338c('0x2c')](handleError(_0x18c973,null));};exports[_0x338c('0x75')]=function(_0x7d208f,_0x383275,_0x3b9d6f){return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0x7d208f[_0x338c('0x60')]['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x383275,null))[_0x338c('0x22')](function(_0x1a13d3){if(_0x1a13d3){return _0x1a13d3['removeAnswers'](_0x7d208f[_0x338c('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x383275,null))[_0x338c('0x2c')](handleError(_0x383275,null));};exports[_0x338c('0x76')]=function(_0x316f8e,_0x38094a,_0x2bff6d){var _0x129488={'body':_0x316f8e[_0x338c('0x63')],'channel':_0x338c('0x77')};var _0xe66b77=[];var _0x57c614=[];var _0x115bb1={};var _0x510c81=![];return db['CmContact'][_0x338c('0x69')]()[_0x338c('0x22')](function(_0x47bc9f){if(!_0x47bc9f){throw new db[(_0x338c('0x78'))][(_0x338c('0x79'))]('no\x20available\x20attributes');}_0xe66b77=_[_0x338c('0x7a')](_[_0x338c('0x4b')](_0x47bc9f),[_0x338c('0x7b'),'updatedAt']);_0x57c614=_[_0x338c('0x7a')](_[_0x338c('0x4b')](_0x47bc9f),[_0x338c('0x7b'),_0x338c('0x7c'),'CompanyId',_0x338c('0x7d')]);if(_0x316f8e[_0x338c('0x63')]['id']){delete _0x316f8e[_0x338c('0x63')]['id'];}if(_[_0x338c('0x7e')](_0x316f8e[_0x338c('0x63')][_0x338c('0x7f')])){throw new db['Sequelize'][(_0x338c('0x79'))]('from\x20is\x20mandatory');}if(_[_0x338c('0x7e')](_0x316f8e[_0x338c('0x63')][_0x338c('0x63')])||_0x316f8e[_0x338c('0x63')][_0x338c('0x63')]===''){throw new db[(_0x338c('0x78'))][(_0x338c('0x79'))](_0x338c('0x80'));}if(_[_0x338c('0x7e')](_0x316f8e[_0x338c('0x63')][_0x338c('0x81')])){throw new db[(_0x338c('0x78'))][(_0x338c('0x79'))](_0x338c('0x82')+_0x57c614);}if(!_[_0x338c('0x83')](_0x57c614,_0x316f8e['body'][_0x338c('0x81')])){throw new db[(_0x338c('0x78'))]['ValidationError'](_0x338c('0x84')+_0x57c614);}_0x115bb1[_0x316f8e[_0x338c('0x63')][_0x338c('0x81')]]=_0x316f8e[_0x338c('0x63')][_0x338c('0x7f')];})[_0x338c('0x22')](function(){return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0x316f8e['params']['id']},'include':[{'model':db[_0x338c('0x85')],'as':'List','include':[{'model':db[_0x338c('0x86')],'as':_0x338c('0x87'),'where':_0x115bb1,'limit':0x1,'order':[[_0x338c('0x7c'),'DESC']]}]},{'model':db[_0x338c('0x88')],'as':_0x338c('0x89')}]});})[_0x338c('0x22')](handleEntityNotFound(_0x38094a,null))[_0x338c('0x22')](function(_0x12d330){if(_0x12d330&&_0x12d330['List']){_0x129488['account']=_0x12d330;_0x129488[_0x338c('0x8a')]=_0x12d330['Applications'];_0x129488['list']=_0x12d330[_0x338c('0x8b')];_0x129488[_0x338c('0x8a')]=_[_0x338c('0x8c')](_0x129488[_0x338c('0x8a')],[_0x338c('0x8d')],[_0x338c('0x8e')]);if(_0x129488[_0x338c('0x8f')][_0x338c('0x89')]){delete _0x129488[_0x338c('0x8f')][_0x338c('0x89')];}if(_0x129488[_0x338c('0x8f')][_0x338c('0x8b')]&&_0x129488['account'][_0x338c('0x8b')][_0x338c('0x87')][_0x338c('0x50')]){return _0x129488[_0x338c('0x8f')][_0x338c('0x8b')][_0x338c('0x87')][0x0];}var _0x4d916c=_['defaults'](_0x316f8e[_0x338c('0x63')],{'firstName':_0x316f8e[_0x338c('0x63')][_0x338c('0x7f')],'ListId':_0x12d330[_0x338c('0x7d')]});_0x4d916c[_0x316f8e[_0x338c('0x63')][_0x338c('0x81')]]=_0x316f8e[_0x338c('0x63')]['from'];return db[_0x338c('0x86')][_0x338c('0x62')](_0x4d916c,{'fields':_0xe66b77,'raw':!![]});}})[_0x338c('0x22')](handleEntityNotFound(_0x38094a,null))['then'](function(_0x7af579){_0x129488[_0x338c('0x90')]=_0x7af579;if(_0x7af579){var _0x5c38d6={'ContactId':_0x7af579['id'],'OpenchannelAccountId':_0x316f8e[_0x338c('0x60')]['id'],'from':(_0x7af579[_0x338c('0x91')]||'')+'\x20'+(_0x7af579['lastName']||'')};var _0x1bb6e4={'OpenchannelAccountId':_0x316f8e[_0x338c('0x60')]['id'],'closed':![]};if(_0x316f8e[_0x338c('0x63')]['threadId']){_0x1bb6e4[_0x338c('0x92')]=_0x316f8e[_0x338c('0x63')]['threadId'];return db[_0x338c('0x93')]['find']({'where':_0x1bb6e4})[_0x338c('0x22')](function(_0x515ba6){if(_0x515ba6){return[_0x515ba6,![]];}_0x5c38d6['threadId']=_0x316f8e[_0x338c('0x63')][_0x338c('0x92')];_0x5c38d6['externalUrl']=_0x316f8e[_0x338c('0x63')][_0x338c('0x94')];return db['OpenchannelInteraction'][_0x338c('0x62')](_0x5c38d6)[_0x338c('0x22')](function(_0x410070){return[_0x410070,!![]];});});}else{_0x1bb6e4[_0x338c('0x92')]=null;}_0x1bb6e4[_0x338c('0x95')]=_0x7af579['id'];return db[_0x338c('0x93')][_0x338c('0x61')]({'where':_0x1bb6e4})[_0x338c('0x22')](function(_0x18a72d){if(_0x18a72d){return[_0x18a72d,![]];}return db[_0x338c('0x93')][_0x338c('0x62')](_0x5c38d6)[_0x338c('0x22')](function(_0x7e71b7){return[_0x7e71b7,!![]];});});}})[_0x338c('0x96')](function(_0x44ecf3,_0x56ef40){if(_0x44ecf3){_0x510c81=_0x56ef40;if(!_0x56ef40){var _0x19efa4={'from':(_0x129488[_0x338c('0x90')]['firstName']||'')+'\x20'+(_0x129488[_0x338c('0x90')][_0x338c('0x97')]||'')};if(_0x316f8e[_0x338c('0x63')]['threadId']&&_0x316f8e[_0x338c('0x63')]['messageId']&&_0x316f8e[_0x338c('0x63')][_0x338c('0x92')]!=_0x316f8e[_0x338c('0x63')][_0x338c('0x98')]){_0x19efa4['threadId']=_0x316f8e[_0x338c('0x63')][_0x338c('0x98')];}return _0x44ecf3['update'](_0x19efa4);}else{return _0x44ecf3;}}})[_0x338c('0x22')](function(_0x143d02){_0x129488[_0x338c('0x99')]=_0x143d02[_0x338c('0x3a')]({'plain':!![]});_0x129488[_0x338c('0x99')]['created']=_0x510c81;if(_0x129488[_0x338c('0x99')][_0x338c('0x9a')]){if(_0x129488[_0x338c('0x8f')][_0x338c('0x9b')]){_0x129488[_0x338c('0x8a')][_0x338c('0x9c')]({'id':0x0,'priority':_0x129488['applications'][_0x338c('0x50')]+0x1,'app':_0x338c('0x9d'),'appdata':'unmanaged','interval':_0x338c('0x9e')});}}return db['OpenchannelMessage']['create']({'body':_0x316f8e[_0x338c('0x63')][_0x338c('0x63')],'OpenchannelAccountId':_0x316f8e['params']['id'],'OpenchannelInteractionId':_0x143d02['id'],'direction':'in','ContactId':_0x129488[_0x338c('0x90')]['id'],'AttachmentId':_0x316f8e[_0x338c('0x63')][_0x338c('0x9f')]});})[_0x338c('0x22')](function(_0x187c80){_0x129488[_0x338c('0x2a')]=_0x187c80;if(_0x129488[_0x338c('0x99')]['UserId']){return db['User'][_0x338c('0x61')]({'attributes':['id',_0x338c('0x3e')],'where':{'id':_0x129488[_0x338c('0x99')][_0x338c('0xa0')]}})['then'](function(_0x389dc7){if(_0x389dc7){_0x129488[_0x338c('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x338c('0xa1'),'appdata':_0x389dc7['name']+','+(_0x129488[_0x338c('0x8f')][_0x338c('0xa2')]||0xa),'interval':_0x338c('0x9e')});_0x129488[_0x338c('0xa3')]=![];}return respondWithRpcPromise(_0x338c('0xa4'),_0x338c('0xa5'),_0x129488);});}return respondWithRpcPromise('Start',_0x338c('0xa5'),_0x129488);})[_0x338c('0x22')](function(_0x4cc47f){respondWithRpcPromise(_0x338c('0xa6'),'EventManager',{'event':_0x338c('0x76'),'message':_0x4cc47f},client9002);return _0x4cc47f;})[_0x338c('0x22')](respondWithResult(_0x38094a,null))[_0x338c('0x2c')](handleError(_0x38094a,null));};exports[_0x338c('0xa7')]=function(_0x5641e5,_0xfcbe78){var _0x41f55d=_0x5641e5[_0x338c('0x60')]['id'];var _0x428cce=_0x5641e5[_0x338c('0x63')];var _0x2198f5=0xc8;var _0x3c74f7=null;return db[_0x338c('0xa8')]['transaction']({'isolationLevel':db[_0x338c('0xa8')][_0x338c('0xa9')][_0x338c('0xaa')][_0x338c('0xab')]},function(_0x5bb688){return db['OpenchannelAccount'][_0x338c('0x6d')]({'where':{'id':_0x41f55d},'transaction':_0x5bb688})['then'](function(_0x705a8f){if(_0x705a8f){return db[_0x338c('0x88')]['destroy']({'where':{'OpenchannelAccountId':_0x41f55d},'transaction':_0x5bb688})['then'](function(){var _0xb9707c=_[_0x338c('0x43')](_0x428cce,function(_0x30df04){_0x30df04[_0x338c('0x6b')]=_0x41f55d;return _0x30df04;});return db[_0x338c('0x88')][_0x338c('0xac')](_0xb9707c,{'transaction':_0x5bb688});});}else{_0x2198f5=0x194;_0x3c74f7=[];}});})[_0x338c('0x22')](function(){if(_0x2198f5!==0x194){return db[_0x338c('0x88')][_0x338c('0xad')]({'where':{'OpenchannelAccountId':_0x41f55d},'order':'priority'})['then'](function(_0x226ecb){_0x3c74f7=_0x226ecb;});}})[_0x338c('0x2c')](function(_0x7aa0ac){_0x2198f5=0x1f4;logger[_0x338c('0x29')](_0x7aa0ac['stack']);if(_0x7aa0ac['name']){delete _0x7aa0ac['name'];}_0x3c74f7=_0x7aa0ac;})[_0x338c('0xae')](function(){if(_0x3c74f7===null){_0xfcbe78[_0x338c('0x2d')](_0x2198f5);}else{if(_0x2198f5===0x1f4){_0xfcbe78[_0x338c('0x2e')](_0x2198f5)[_0x338c('0x3f')](_0x3c74f7);}else{_0xfcbe78['status'](_0x2198f5)[_0x338c('0x30')](_0x3c74f7);}}});};exports['getApplications']=function(_0x739bad,_0x5259a3,_0x5206eb){var _0x27831c={};var _0x1dd6f7={};var _0xbb1120;var _0x4aee49;return db[_0x338c('0x44')][_0x338c('0x6d')]({'where':{'id':_0x739bad[_0x338c('0x60')]['id']}})['then'](handleEntityNotFound(_0x5259a3,null))[_0x338c('0x22')](function(_0x48aeaa){if(_0x48aeaa){_0xbb1120=_0x48aeaa;_0x1dd6f7[_0x338c('0x49')]=_[_0x338c('0x4b')](db['OpenchannelApplication'][_0x338c('0x45')]);_0x1dd6f7[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x739bad[_0x338c('0x4a')]);_0x1dd6f7['filters']=_[_0x338c('0x4e')](_0x1dd6f7[_0x338c('0x49')],_0x1dd6f7[_0x338c('0x4a')]);_0x27831c[_0x338c('0x4d')]=_['intersection'](_0x1dd6f7[_0x338c('0x49')],qs['fields'](_0x739bad[_0x338c('0x4a')][_0x338c('0x4f')]));_0x27831c['attributes']=_0x27831c[_0x338c('0x4d')][_0x338c('0x50')]?_0x27831c[_0x338c('0x4d')]:_0x1dd6f7['model'];_0x27831c[_0x338c('0x54')]=qs[_0x338c('0x55')](_0x739bad[_0x338c('0x4a')][_0x338c('0x55')]);_0x27831c[_0x338c('0x58')]=qs['filters'](_[_0x338c('0x56')](_0x739bad[_0x338c('0x4a')],_0x1dd6f7['filters']));if(_0x739bad[_0x338c('0x4a')][_0x338c('0x57')]){_0x27831c['where']=_[_0x338c('0x59')](_0x27831c[_0x338c('0x58')],{'$or':_['map'](_0x27831c[_0x338c('0x4d')],function(_0x419bc4){var _0x3fc3f4={};_0x3fc3f4[_0x419bc4]={'$like':'%'+_0x739bad['query']['filter']+'%'};return _0x3fc3f4;})});}_0x27831c=_[_0x338c('0x59')]({},_0x27831c,_0x739bad['options']);return _0xbb1120['getApplications'](_0x27831c);}})['then'](function(_0x4f90b0){if(_0x4f90b0){_0x4aee49=_0x4f90b0[_0x338c('0x50')];if(!_0x739bad['query'][_0x338c('0x51')](_0x338c('0x52'))){_0x27831c[_0x338c('0x53')]=qs[_0x338c('0x53')](_0x739bad[_0x338c('0x4a')][_0x338c('0x53')]);_0x27831c['offset']=qs[_0x338c('0x31')](_0x739bad[_0x338c('0x4a')][_0x338c('0x31')]);}return _0xbb1120[_0x338c('0xaf')](_0x27831c);}})[_0x338c('0x22')](function(_0x23b593){if(_0x23b593){return _0x23b593?{'count':_0x4aee49,'rows':_0x23b593}:null;}})[_0x338c('0x22')](respondWithResult(_0x5259a3,null))[_0x338c('0x2c')](handleError(_0x5259a3,null));};exports[_0x338c('0xb0')]=function(_0x592db1,_0x32c7df,_0x37a99c){var _0x14363e={'raw':![],'where':{}};var _0x27d673={};var _0x3eda18={'count':0x0,'rows':[]};return db[_0x338c('0x44')]['findOne']({'where':{'id':_0x592db1[_0x338c('0x60')]['id']}})['then'](handleEntityNotFound(_0x32c7df,null))[_0x338c('0x22')](function(_0x314b44){if(_0x314b44){_0x27d673[_0x338c('0x49')]=_[_0x338c('0x4b')](db[_0x338c('0x93')][_0x338c('0x45')]);_0x27d673[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x592db1['query']);_0x27d673[_0x338c('0x4c')]=_[_0x338c('0x4e')](_0x27d673['model'],_0x27d673[_0x338c('0x4a')]);_0x14363e['attributes']=_[_0x338c('0x4e')](_0x27d673[_0x338c('0x49')],qs[_0x338c('0x4f')](_0x592db1['query'][_0x338c('0x4f')]));_0x14363e['attributes']=_0x14363e[_0x338c('0x4d')][_0x338c('0x50')]?_0x14363e['attributes']:_0x27d673[_0x338c('0x49')];if(!_0x592db1['query']['hasOwnProperty']('nolimit')){_0x14363e[_0x338c('0x53')]=qs[_0x338c('0x53')](_0x592db1['query']['limit']);_0x14363e[_0x338c('0x31')]=qs[_0x338c('0x31')](_0x592db1[_0x338c('0x4a')][_0x338c('0x31')]);}_0x14363e['order']=qs[_0x338c('0x55')](_0x592db1[_0x338c('0x4a')]['sort']);_0x14363e[_0x338c('0x58')]=qs[_0x338c('0x4c')](_['pick'](_0x592db1['query'],_0x27d673[_0x338c('0x4c')]));_0x14363e[_0x338c('0x58')][_0x338c('0x6b')]=_0x314b44['id'];if(_0x592db1[_0x338c('0x4a')][_0x338c('0x57')]){_0x14363e[_0x338c('0x58')]=_[_0x338c('0x59')](_0x14363e[_0x338c('0x58')],{'$or':_[_0x338c('0x43')](_0x14363e['attributes'],function(_0x390389){var _0x56f52f={};_0x56f52f[_0x390389]={'$like':'%'+_0x592db1[_0x338c('0x4a')]['filter']+'%'};return _0x56f52f;})});}_0x14363e=_[_0x338c('0x59')]({},_0x14363e,_0x592db1[_0x338c('0x5b')]);return db['OpenchannelInteraction']['count']({'where':_0x14363e[_0x338c('0x58')]})[_0x338c('0x22')](function(_0x194df7){_0x3eda18['count']=_0x194df7;if(_0x592db1[_0x338c('0x4a')]['includeAll']){_0x14363e[_0x338c('0x6f')]=[{'model':db['CmContact'],'as':_0x338c('0xb1'),'required':![]},{'model':db[_0x338c('0xb2')],'as':_0x338c('0xb3'),'attributes':[_0x338c('0x3e'),_0x338c('0xb4'),_0x338c('0xb5')],'required':![]},{'model':db[_0x338c('0xb6')],'as':_0x338c('0xb7'),'attributes':['id','name',_0x338c('0xb8')],'where':_0x592db1[_0x338c('0x4a')]['tag']?{'id':_0x592db1[_0x338c('0x4a')]['tag']}:undefined,'required':_0x592db1[_0x338c('0x4a')]['tag']?!![]:![]}];}return db[_0x338c('0x93')]['findAll'](_0x14363e);})['then'](function(_0x49dfd3){_0x3eda18[_0x338c('0x5e')]=_0x49dfd3;return _0x3eda18;});}})['then'](respondWithFilteredResult(_0x32c7df,_0x14363e))['catch'](handleError(_0x32c7df,null));};exports[_0x338c('0xb9')]=function(_0x5a570b,_0x4e9bed,_0x4cc27e){return db[_0x338c('0x44')]['find']({'where':{'id':_0x5a570b[_0x338c('0x60')]['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x4e9bed,null))[_0x338c('0x22')](function(_0x2242eb){if(_0x2242eb){return _0x2242eb[_0x338c('0xb9')](_0x5a570b[_0x338c('0x63')][_0x338c('0x71')],_[_0x338c('0xba')](_0x5a570b[_0x338c('0x63')],['ids','id'])||{})[_0x338c('0x96')](function(_0x25b1f6){for(var _0x3e65f7=0x0;_0x3e65f7<_0x5a570b[_0x338c('0x63')][_0x338c('0x71')][_0x338c('0x50')];_0x3e65f7+=0x1){socket[_0x338c('0xbb')](_0x338c('0xbc'),{'UserId':Number(_0x5a570b[_0x338c('0x63')]['ids'][_0x3e65f7]),'OpenchannelAccountId':Number(_0x5a570b[_0x338c('0x60')]['id'])});}return _0x25b1f6;});}})[_0x338c('0x22')](respondWithResult(_0x4e9bed,null))['catch'](handleError(_0x4e9bed,null));};exports[_0x338c('0xbd')]=function(_0xfe0eb8,_0x54bd6a,_0x221413){return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0xfe0eb8['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x54bd6a,null))['then'](function(_0x28c209){if(_0x28c209){return _0x28c209['removeAgents'](_0xfe0eb8[_0x338c('0x4a')][_0x338c('0x71')])['then'](function(){if(_['isArray'](_0xfe0eb8[_0x338c('0x4a')]['ids'])){for(var _0x301df0=0x0;_0x301df0<_0xfe0eb8[_0x338c('0x4a')]['ids']['length'];_0x301df0+=0x1){socket['emit'](_0x338c('0xbe'),{'UserId':Number(_0xfe0eb8[_0x338c('0x4a')]['ids'][_0x301df0]),'OpenchannelAccountId':Number(_0xfe0eb8['params']['id'])});}}else{socket[_0x338c('0xbb')](_0x338c('0xbe'),{'UserId':Number(_0xfe0eb8[_0x338c('0x4a')][_0x338c('0x71')]),'OpenchannelAccountId':Number(_0xfe0eb8[_0x338c('0x60')]['id'])});}});}})[_0x338c('0x22')](respondWithStatusCode(_0x54bd6a,null))[_0x338c('0x2c')](handleError(_0x54bd6a,null));};exports[_0x338c('0xbf')]=function(_0x917a48,_0x47c532,_0x4bfc96){var _0x75b761={};var _0x9b1e8a={};var _0x1c453e;var _0x488d67;return db[_0x338c('0x44')][_0x338c('0x6d')]({'where':{'id':_0x917a48['params']['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x47c532,null))[_0x338c('0x22')](function(_0x2590cb){if(_0x2590cb){_0x1c453e=_0x2590cb;_0x9b1e8a[_0x338c('0x49')]=_['keys'](db[_0x338c('0xb2')][_0x338c('0x45')]);_0x9b1e8a[_0x338c('0x4a')]=_[_0x338c('0x4b')](_0x917a48[_0x338c('0x4a')]);_0x9b1e8a[_0x338c('0x4c')]=_[_0x338c('0x4e')](_0x9b1e8a[_0x338c('0x49')],_0x9b1e8a['query']);_0x75b761['attributes']=_[_0x338c('0x4e')](_0x9b1e8a[_0x338c('0x49')],qs[_0x338c('0x4f')](_0x917a48[_0x338c('0x4a')]['fields']));_0x75b761['attributes']=_0x75b761[_0x338c('0x4d')]['length']?_0x75b761[_0x338c('0x4d')]:_0x9b1e8a['model'];_0x75b761[_0x338c('0x54')]=qs[_0x338c('0x55')](_0x917a48['query'][_0x338c('0x55')]);_0x75b761['where']=qs[_0x338c('0x4c')](_['pick'](_0x917a48['query'],_0x9b1e8a[_0x338c('0x4c')]));if(_0x917a48['query'][_0x338c('0x57')]){_0x75b761['where']=_[_0x338c('0x59')](_0x75b761[_0x338c('0x58')],{'$or':_['map'](_0x75b761[_0x338c('0x4d')],function(_0x5b94b6){var _0x2920d5={};_0x2920d5[_0x5b94b6]={'$like':'%'+_0x917a48['query']['filter']+'%'};return _0x2920d5;})});}_0x75b761=_[_0x338c('0x59')]({},_0x75b761,_0x917a48[_0x338c('0x5b')]);return _0x1c453e[_0x338c('0xbf')](_0x75b761);}})[_0x338c('0x22')](function(_0x27686b){if(_0x27686b){_0x488d67=_0x27686b[_0x338c('0x50')];if(!_0x917a48[_0x338c('0x4a')][_0x338c('0x51')](_0x338c('0x52'))){_0x75b761['limit']=qs[_0x338c('0x53')](_0x917a48[_0x338c('0x4a')][_0x338c('0x53')]);_0x75b761[_0x338c('0x31')]=qs[_0x338c('0x31')](_0x917a48[_0x338c('0x4a')][_0x338c('0x31')]);}return _0x1c453e[_0x338c('0xbf')](_0x75b761);}})[_0x338c('0x22')](function(_0xcc264d){if(_0xcc264d){return _0xcc264d?{'count':_0x488d67,'rows':_0xcc264d}:null;}})[_0x338c('0x22')](respondWithResult(_0x47c532,null))['catch'](handleError(_0x47c532,null));};exports[_0x338c('0x3f')]=function(_0x292a2a,_0x2ff2fc,_0x71e6d5){var _0x112b9c,_0x4e43ba,_0x2b13f4;if(_[_0x338c('0x7e')](_0x292a2a[_0x338c('0x63')][_0x338c('0x63')])||_0x292a2a[_0x338c('0x63')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x338c('0x80'));}if(_[_0x338c('0x7e')](_0x292a2a[_0x338c('0x63')]['to'])){}_0x112b9c=_0x292a2a[_0x338c('0x63')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x292a2a[_0x338c('0x60')]['id']}})[_0x338c('0x22')](handleEntityNotFound(_0x2ff2fc,null))[_0x338c('0x22')](function(_0xb7cb34){if(_0xb7cb34){return db[_0x338c('0x44')][_0x338c('0x61')]({'where':{'id':_0xb7cb34['id']},'include':[{'model':db[_0x338c('0x85')],'as':'List','include':[{'model':db[_0x338c('0x86')],'as':_0x338c('0x87'),'where':{[_0xb7cb34[_0x338c('0x81')]]:_0x112b9c},'limit':0x1,'order':[[_0x338c('0x7c'),'DESC']]}]}]})[_0x338c('0x22')](handleEntityNotFound(_0x2ff2fc,null))[_0x338c('0x22')](function(_0x81de35){if(_0x81de35&&_0x81de35['List']){_0x4e43ba=_0x81de35[_0x338c('0x3a')]({'plain':!![]});if(_0x4e43ba['List']&&_0x4e43ba['List'][_0x338c('0x87')][_0x338c('0x50')]){return _0x4e43ba['List'][_0x338c('0x87')][0x0];}return db[_0x338c('0x86')][_0x338c('0x62')](_['defaults'](_0x292a2a[_0x338c('0x63')],{'firstName':_0x112b9c,[_0x81de35[_0x338c('0x81')]]:_0x112b9c,'phone':_0x112b9c,'ListId':_0x4e43ba[_0x338c('0x7d')]}));}})[_0x338c('0x22')](handleEntityNotFound(_0x2ff2fc,null))['then'](function(_0x5a1752){if(_0x5a1752){_0x2b13f4=_0x5a1752;return db[_0x338c('0x93')][_0x338c('0x61')]({'where':{'ContactId':_0x2b13f4['id'],'closed':![],'OpenchannelAccountId':_0x4e43ba['id']}})[_0x338c('0x22')](function(_0x53898a){if(_0x53898a){return[_0x53898a,![]];}return db[_0x338c('0x93')]['create']({'UserId':_0x292a2a[_0x338c('0x64')]['id'],'ContactId':_0x2b13f4['id'],'OpenchannelAccountId':_0x4e43ba['id'],'lastMsgDirection':_0x338c('0xc0'),'firstMsgDirection':_0x338c('0xc0'),'Messages':[_[_0x338c('0x59')](_0x292a2a[_0x338c('0x63')],{'read':![],'body':_0x292a2a[_0x338c('0x63')]['body'],'OpenchannelAccountId':_0x4e43ba['id'],'UserId':_0x292a2a[_0x338c('0x64')]['id'],'ContactId':_0x2b13f4['id']})]},{'include':[{'model':db[_0x338c('0xc1')],'as':_0x338c('0xc2')}]})[_0x338c('0x22')](function(_0x459748){return[_0x459748,!![]];});});}})[_0x338c('0x96')](function(_0x50cca7,_0x4f2e7b){if(_0x4f2e7b){return _0x50cca7;}return db['OpenchannelMessage'][_0x338c('0x62')](_[_0x338c('0x59')](_0x292a2a[_0x338c('0x63')],{'read':![],'body':_0x292a2a['body'][_0x338c('0x63')],'OpenchannelAccountId':_0x4e43ba['id'],'OpenchannelInteractionId':_0x50cca7['id'],'UserId':_0x292a2a[_0x338c('0x64')]['id'],'ContactId':_0x2b13f4['id']}))[_0x338c('0x22')](function(_0xddfa5b){_0x50cca7[_0x338c('0xc3')][_0x338c('0xc2')]=[];_0x50cca7[_0x338c('0xc3')][_0x338c('0xc2')]['push'](_0xddfa5b['dataValues']);return _0x50cca7;});});}})[_0x338c('0x22')](respondWithResult(_0x2ff2fc,null))[_0x338c('0x2c')](handleError(_0x2ff2fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d629c0b..a4ab7c7 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 _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x596930,_0x5d7764){var _0x322698=function(_0x39c3bb){while(--_0x39c3bb){_0x596930['push'](_0x596930['shift']());}};_0x322698(++_0x5d7764);}(_0x702d,0x147));var _0xd702=function(_0x706dec,_0x43e6fc){_0x706dec=_0x706dec-0x0;var _0x232271=_0x702d[_0x706dec];return _0x232271;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2dbae6,_0x461479){_0x2dbae6=_0x2dbae6-0x0;var _0x4f22b2=_0x6f7a[_0x2dbae6];return _0x4f22b2;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b37d9f5..177c62d 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(_0x3ebf85,_0x1f71a8){var _0x4e98e0=function(_0x526d74){while(--_0x526d74){_0x3ebf85['push'](_0x3ebf85['shift']());}};_0x4e98e0(++_0x1f71a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x1f30e5,_0x391056){var _0x17f239=function(_0x1c9063){while(--_0x1c9063){_0x1f30e5['push'](_0x1f30e5['shift']());}};_0x17f239(++_0x391056);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 e579d4a..a2a656e 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 _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','moment','bluebird'];(function(_0x58efce,_0x41316e){var _0x378870=function(_0x20c8a6){while(--_0x20c8a6){_0x58efce['push'](_0x58efce['shift']());}};_0x378870(++_0x41316e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x386e19,_0x2b6189){_0x386e19=_0x386e19-0x0;var _0x529947=_0xb58b[_0x386e19];return _0x529947;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});config[_0xbb58('0x9')]=_[_0xbb58('0xa')](config[_0xbb58('0x9')],{'host':_0xbb58('0xb'),'port':0x18eb});var socket=require(_0xbb58('0xc'))(new Redis(config[_0xbb58('0x9')]));require(_0xbb58('0xd'))[_0xbb58('0xe')](socket);function respondWithRpcPromise(_0x429e75,_0x261d00,_0x27f77f){return new BPromise(function(_0x4bb8c5,_0x80ab3a){return client['request'](_0x429e75,_0x27f77f)[_0xbb58('0xf')](function(_0x440392){logger[_0xbb58('0x10')](_0xbb58('0x11'),_0x261d00,'request\x20sent');logger[_0xbb58('0x12')](_0xbb58('0x13'),_0x261d00,'request\x20sent',JSON[_0xbb58('0x14')](_0x440392));if(_0x440392[_0xbb58('0x15')]){if(_0x440392[_0xbb58('0x15')][_0xbb58('0x16')]===0x1f4){logger[_0xbb58('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x261d00,_0x440392[_0xbb58('0x15')][_0xbb58('0x17')]);return _0x80ab3a(_0x440392['error']['message']);}logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x440392[_0xbb58('0x15')]['message']);return _0x4bb8c5(_0x440392['error']['message']);}else{logger['info'](_0xbb58('0x11'),_0x261d00,_0xbb58('0x18'));_0x4bb8c5(_0x440392['result'][_0xbb58('0x17')]);}})['catch'](function(_0x2cf892){logger[_0xbb58('0x15')](_0xbb58('0x11'),_0x261d00,_0x2cf892);_0x80ab3a(_0x2cf892);});});} \ No newline at end of file +var _0xf403=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x53a4e2,_0xb3bac9){var _0x2f8083=function(_0x4f4d69){while(--_0x4f4d69){_0x53a4e2['push'](_0x53a4e2['shift']());}};_0x2f8083(++_0xb3bac9);}(_0xf403,0x1d3));var _0x3f40=function(_0x4e9ccc,_0x457b8c){_0x4e9ccc=_0x4e9ccc-0x0;var _0xbf3db=_0xf403[_0x4e9ccc];return _0xbf3db;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f40('0x9')][_0x3f40('0xa')]({'port':0x232a});config[_0x3f40('0xb')]=_[_0x3f40('0xc')](config['redis'],{'host':_0x3f40('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f40('0xe'))[_0x3f40('0xf')](socket);function respondWithRpcPromise(_0x40d198,_0x5bf41d,_0x48c244){return new BPromise(function(_0x297a4e,_0x360e2c){return client[_0x3f40('0x10')](_0x40d198,_0x48c244)['then'](function(_0x378a3d){logger[_0x3f40('0x11')](_0x3f40('0x12'),_0x5bf41d,'request\x20sent');logger[_0x3f40('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5bf41d,_0x3f40('0x14'),JSON[_0x3f40('0x15')](_0x378a3d));if(_0x378a3d[_0x3f40('0x16')]){if(_0x378a3d[_0x3f40('0x16')]['code']===0x1f4){logger[_0x3f40('0x16')](_0x3f40('0x12'),_0x5bf41d,_0x378a3d[_0x3f40('0x16')][_0x3f40('0x17')]);return _0x360e2c(_0x378a3d[_0x3f40('0x16')]['message']);}logger[_0x3f40('0x16')](_0x3f40('0x12'),_0x5bf41d,_0x378a3d['error']['message']);return _0x297a4e(_0x378a3d['error'][_0x3f40('0x17')]);}else{logger[_0x3f40('0x11')](_0x3f40('0x12'),_0x5bf41d,_0x3f40('0x14'));_0x297a4e(_0x378a3d[_0x3f40('0x18')]['message']);}})[_0x3f40('0x19')](function(_0xaab367){logger[_0x3f40('0x16')](_0x3f40('0x12'),_0x5bf41d,_0xaab367);_0x360e2c(_0xaab367);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ebc065c..c5901fb 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 _0x1b73=['openchannelAccount:','save','remove','update','register','length'];(function(_0x1c2f32,_0x48e6b3){var _0x3b6ba7=function(_0x4d0273){while(--_0x4d0273){_0x1c2f32['push'](_0x1c2f32['shift']());}};_0x3b6ba7(++_0x48e6b3);}(_0x1b73,0x1d5));var _0x31b7=function(_0x3991b3,_0x35b97c){_0x3991b3=_0x3991b3-0x0;var _0x9402dd=_0x1b73[_0x3991b3];return _0x9402dd;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x31b7('0x0'),_0x31b7('0x1'),_0x31b7('0x2')];function createListener(_0x5c767e,_0x4bf5ae){return function(_0x17c0ef){_0x4bf5ae['emit'](_0x5c767e,_0x17c0ef);};}function removeListener(_0x40fef2,_0x3682cc){return function(){OpenchannelAccountEvents['removeListener'](_0x40fef2,_0x3682cc);};}exports[_0x31b7('0x3')]=function(_0x3d058f){for(var _0x15c31e=0x0,_0x502838=events[_0x31b7('0x4')];_0x15c31e<_0x502838;_0x15c31e++){var _0x1a730f=events[_0x15c31e];var _0x86ef8e=createListener(_0x31b7('0x5')+_0x1a730f,_0x3d058f);OpenchannelAccountEvents['on'](_0x1a730f,_0x86ef8e);}}; \ No newline at end of file +var _0x2948=['save','remove','update','emit','removeListener','./openchannelAccount.events'];(function(_0x537959,_0xac9b88){var _0x13d91f=function(_0x52deb5){while(--_0x52deb5){_0x537959['push'](_0x537959['shift']());}};_0x13d91f(++_0xac9b88);}(_0x2948,0xcb));var _0x8294=function(_0x8d900a,_0x429f45){_0x8d900a=_0x8d900a-0x0;var _0x1c2914=_0x2948[_0x8d900a];return _0x1c2914;};'use strict';var OpenchannelAccountEvents=require(_0x8294('0x0'));var events=[_0x8294('0x1'),_0x8294('0x2'),_0x8294('0x3')];function createListener(_0x8e99bd,_0xbbaec1){return function(_0xcb5eea){_0xbbaec1[_0x8294('0x4')](_0x8e99bd,_0xcb5eea);};}function removeListener(_0x3ac253,_0x4bddff){return function(){OpenchannelAccountEvents[_0x8294('0x5')](_0x3ac253,_0x4bddff);};}exports['register']=function(_0x11c415){for(var _0x26128c=0x0,_0x39aa65=events['length'];_0x26128c<_0x39aa65;_0x26128c++){var _0x5a7135=events[_0x26128c];var _0x56f7c8=createListener('openchannelAccount:'+_0x5a7135,_0x11c415);OpenchannelAccountEvents['on'](_0x5a7135,_0x56f7c8);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3096fb4..7f44c63 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 _0xde84=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','util','connect-timeout'];(function(_0x378886,_0xd6e40a){var _0x3563fc=function(_0x2251c6){while(--_0x2251c6){_0x378886['push'](_0x378886['shift']());}};_0x3563fc(++_0xd6e40a);}(_0xde84,0x178));var _0x4de8=function(_0x4b1552,_0x43b0f5){_0x4b1552=_0x4b1552-0x0;var _0x2fc6f1=_0xde84[_0x4b1552];return _0x2fc6f1;};'use strict';var multer=require('multer');var util=require(_0x4de8('0x0'));var path=require('path');var timeout=require(_0x4de8('0x1'));var express=require('express');var router=express[_0x4de8('0x2')]();var fs_extra=require(_0x4de8('0x3'));var auth=require(_0x4de8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4de8('0x5'));var controller=require('./openchannelApplication.controller');router[_0x4de8('0x6')]('/',auth[_0x4de8('0x7')](),controller[_0x4de8('0x8')]);router[_0x4de8('0x6')](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller[_0x4de8('0xa')]);router[_0x4de8('0xb')]('/',auth[_0x4de8('0x7')](),controller['create']);router[_0x4de8('0xc')](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller[_0x4de8('0xd')]);router['delete'](_0x4de8('0x9'),auth[_0x4de8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd4bf=['create','put','destroy','exports','multer','util','../../components/auth/service','./openchannelApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x59b093,_0x27c4a2){var _0xffd8d5=function(_0x1dcb79){while(--_0x1dcb79){_0x59b093['push'](_0x59b093['shift']());}};_0xffd8d5(++_0x27c4a2);}(_0xd4bf,0x178));var _0xfd4b=function(_0x51e9ca,_0x54486c){_0x51e9ca=_0x51e9ca-0x0;var _0x1a3bca=_0xd4bf[_0x51e9ca];return _0x1a3bca;};'use strict';var multer=require(_0xfd4b('0x0'));var util=require(_0xfd4b('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(_0xfd4b('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd4b('0x3'));router[_0xfd4b('0x4')]('/',auth[_0xfd4b('0x5')](),controller['index']);router[_0xfd4b('0x4')](_0xfd4b('0x6'),auth[_0xfd4b('0x5')](),controller['show']);router[_0xfd4b('0x7')]('/',auth[_0xfd4b('0x5')](),controller[_0xfd4b('0x8')]);router[_0xfd4b('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xfd4b('0x6'),auth[_0xfd4b('0x5')](),controller[_0xfd4b('0xa')]);module[_0xfd4b('0xb')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 73f7d8e..ca97e97 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 _0xaa5b=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x58b277,_0x55ceea){var _0x242c62=function(_0x142809){while(--_0x142809){_0x58b277['push'](_0x58b277['shift']());}};_0x242c62(++_0x55ceea);}(_0xaa5b,0x1a7));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbaa5('0x0'));module[_0xbaa5('0x1')]={'priority':{'type':Sequelize[_0xbaa5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbaa5('0x3')],'allowNull':![],'defaultValue':_0xbaa5('0x4')},'appdata':{'type':Sequelize[_0xbaa5('0x5')]()},'description':{'type':Sequelize[_0xbaa5('0x3')]},'interval':{'type':Sequelize[_0xbaa5('0x3')],'defaultValue':_0xbaa5('0x6')}}; \ No newline at end of file +var _0xee6e=['INTEGER','noop','*,*,*,*','sequelize'];(function(_0x5d31ee,_0x24a4fb){var _0x5ce126=function(_0x4606f1){while(--_0x4606f1){_0x5d31ee['push'](_0x5d31ee['shift']());}};_0x5ce126(++_0x24a4fb);}(_0xee6e,0x1d7));var _0xeee6=function(_0x44c221,_0x4a9d4a){_0x44c221=_0x44c221-0x0;var _0x4fad62=_0xee6e[_0x44c221];return _0x4fad62;};'use strict';var Sequelize=require(_0xeee6('0x0'));module['exports']={'priority':{'type':Sequelize[_0xeee6('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeee6('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeee6('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2ec7809..95d98d8 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 _0x4215=['fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','eml-format','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x2ddb96,_0x5e6282){var _0x5123a8=function(_0x41b084){while(--_0x41b084){_0x2ddb96['push'](_0x2ddb96['shift']());}};_0x5123a8(++_0x5e6282);}(_0x4215,0x177));var _0x5421=function(_0x55b351,_0x1bb062){_0x55b351=_0x55b351-0x0;var _0x3f684f=_0x4215[_0x55b351];return _0x3f684f;};'use strict';var emlformat=require(_0x5421('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5421('0x1'));var rp=require('request-promise');var moment=require(_0x5421('0x2'));var BPromise=require(_0x5421('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5421('0x4'));var sox=require('sox');var csv=require(_0x5421('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5421('0x6'));var _=require('lodash');var squel=require(_0x5421('0x7'));var crypto=require(_0x5421('0x8'));var jsforce=require(_0x5421('0x9'));var deskjs=require(_0x5421('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5421('0xb'));var Redis=require('ioredis');var authService=require(_0x5421('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x5421('0xd'));var hardwareService=require(_0x5421('0xe'));var logger=require(_0x5421('0xf'))(_0x5421('0x10'));var utils=require('../../config/utils');var config=require(_0x5421('0x11'));var licenseUtil=require(_0x5421('0x12'));var db=require(_0x5421('0x13'))['db'];function respondWithStatusCode(_0x276791,_0x4cc7a2){_0x4cc7a2=_0x4cc7a2||0xcc;return function(_0x59acd4){if(_0x59acd4){return _0x276791[_0x5421('0x14')](_0x4cc7a2);}return _0x276791['status'](_0x4cc7a2)['end']();};}function respondWithResult(_0x414eae,_0x4927e9){_0x4927e9=_0x4927e9||0xc8;return function(_0x21aae0){if(_0x21aae0){return _0x414eae['status'](_0x4927e9)['json'](_0x21aae0);}};}function respondWithFilteredResult(_0x26a339,_0x5a93d7){return function(_0x24b0d6){if(_0x24b0d6){var _0x1817bd=typeof _0x5a93d7[_0x5421('0x15')]===_0x5421('0x16')&&typeof _0x5a93d7[_0x5421('0x17')]===_0x5421('0x16');var _0x1677e6=_0x24b0d6[_0x5421('0x18')];var _0x4b6363=_0x1817bd?0x0:_0x5a93d7[_0x5421('0x15')];var _0x1374f7=_0x1817bd?_0x24b0d6[_0x5421('0x18')]:_0x5a93d7['offset']+_0x5a93d7[_0x5421('0x17')];var _0x4fa14f;if(_0x1374f7>=_0x1677e6){_0x1374f7=_0x1677e6;_0x4fa14f=0xc8;}else{_0x4fa14f=0xce;}_0x26a339[_0x5421('0x19')](_0x4fa14f);return _0x26a339['set'](_0x5421('0x1a'),_0x4b6363+'-'+_0x1374f7+'/'+_0x1677e6)[_0x5421('0x1b')](_0x24b0d6);}return null;};}function patchUpdates(_0x32f712){return function(_0x4ae481){try{jsonpatch[_0x5421('0x1c')](_0x4ae481,_0x32f712,!![]);}catch(_0x5d36a5){return BPromise['reject'](_0x5d36a5);}return _0x4ae481[_0x5421('0x1d')]();};}function saveUpdates(_0x5155c2,_0x5f1a2a){return function(_0xa0525f){if(_0xa0525f){return _0xa0525f[_0x5421('0x1e')](_0x5155c2)[_0x5421('0x1f')](function(_0x1f2ac2){return _0x1f2ac2;});}return null;};}function removeEntity(_0x4a7f78,_0x39f83c){return function(_0x3a9a7c){if(_0x3a9a7c){return _0x3a9a7c[_0x5421('0x20')]()['then'](function(){_0x4a7f78['status'](0xcc)[_0x5421('0x21')]();});}};}function handleEntityNotFound(_0x357bc6,_0x5d1bf7){return function(_0x51420c){if(!_0x51420c){_0x357bc6[_0x5421('0x14')](0x194);}return _0x51420c;};}function handleError(_0x3fc242,_0x31108a){_0x31108a=_0x31108a||0x1f4;return function(_0x465b78){logger[_0x5421('0x22')](_0x465b78[_0x5421('0x23')]);if(_0x465b78['name']){delete _0x465b78[_0x5421('0x24')];}_0x3fc242[_0x5421('0x19')](_0x31108a)[_0x5421('0x25')](_0x465b78);};}exports[_0x5421('0x26')]=function(_0x3821f4,_0x108517){var _0x1bf01d={},_0x2a9928={},_0x3ac3d7={'count':0x0,'rows':[]};var _0x2ca360=_[_0x5421('0x27')](db[_0x5421('0x28')][_0x5421('0x29')],function(_0x2b889d){return{'name':_0x2b889d[_0x5421('0x2a')],'type':_0x2b889d[_0x5421('0x2b')][_0x5421('0x2c')]};});_0x2a9928['model']=_[_0x5421('0x27')](_0x2ca360,_0x5421('0x24'));_0x2a9928[_0x5421('0x2d')]=_[_0x5421('0x2e')](_0x3821f4[_0x5421('0x2d')]);_0x2a9928[_0x5421('0x2f')]=_[_0x5421('0x30')](_0x2a9928[_0x5421('0x31')],_0x2a9928[_0x5421('0x2d')]);_0x1bf01d[_0x5421('0x32')]=_[_0x5421('0x30')](_0x2a9928['model'],qs['fields'](_0x3821f4[_0x5421('0x2d')][_0x5421('0x33')]));_0x1bf01d['attributes']=_0x1bf01d[_0x5421('0x32')][_0x5421('0x34')]?_0x1bf01d[_0x5421('0x32')]:_0x2a9928['model'];if(!_0x3821f4[_0x5421('0x2d')][_0x5421('0x35')]('nolimit')){_0x1bf01d['limit']=qs[_0x5421('0x17')](_0x3821f4[_0x5421('0x2d')][_0x5421('0x17')]);_0x1bf01d['offset']=qs['offset'](_0x3821f4['query'][_0x5421('0x15')]);}_0x1bf01d[_0x5421('0x36')]=qs[_0x5421('0x37')](_0x3821f4[_0x5421('0x2d')][_0x5421('0x37')]);_0x1bf01d[_0x5421('0x38')]=qs[_0x5421('0x2f')](_['pick'](_0x3821f4['query'],_0x2a9928[_0x5421('0x2f')]),_0x2ca360);if(_0x3821f4[_0x5421('0x2d')]['filter']){_0x1bf01d[_0x5421('0x38')]=_['merge'](_0x1bf01d[_0x5421('0x38')],{'$or':_['map'](_0x2ca360,function(_0x36f2a2){if(_0x36f2a2[_0x5421('0x2b')]!==_0x5421('0x39')){var _0x333fca={};_0x333fca[_0x36f2a2[_0x5421('0x24')]]={'$like':'%'+_0x3821f4[_0x5421('0x2d')][_0x5421('0x3a')]+'%'};return _0x333fca;}})});}_0x1bf01d=_['merge']({},_0x1bf01d,_0x3821f4[_0x5421('0x3b')]);var _0x17fd9d={'where':_0x1bf01d[_0x5421('0x38')]};return db[_0x5421('0x28')][_0x5421('0x18')](_0x17fd9d)[_0x5421('0x1f')](function(_0x154814){_0x3ac3d7['count']=_0x154814;if(_0x3821f4[_0x5421('0x2d')][_0x5421('0x3c')]){_0x1bf01d[_0x5421('0x3d')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5421('0x3e')](_0x1bf01d);})[_0x5421('0x1f')](function(_0x544df8){_0x3ac3d7[_0x5421('0x3f')]=_0x544df8;return _0x3ac3d7;})[_0x5421('0x1f')](respondWithFilteredResult(_0x108517,_0x1bf01d))[_0x5421('0x40')](handleError(_0x108517,null));};exports[_0x5421('0x41')]=function(_0x12bd5c,_0x1b8358){var _0x23bb04={'raw':!![],'where':{'id':_0x12bd5c[_0x5421('0x42')]['id']}},_0x2bbbe8={};_0x2bbbe8['model']=_[_0x5421('0x2e')](db[_0x5421('0x28')][_0x5421('0x29')]);_0x2bbbe8[_0x5421('0x2d')]=_[_0x5421('0x2e')](_0x12bd5c[_0x5421('0x2d')]);_0x2bbbe8[_0x5421('0x2f')]=_[_0x5421('0x30')](_0x2bbbe8[_0x5421('0x31')],_0x2bbbe8['query']);_0x23bb04[_0x5421('0x32')]=_[_0x5421('0x30')](_0x2bbbe8[_0x5421('0x31')],qs[_0x5421('0x33')](_0x12bd5c[_0x5421('0x2d')][_0x5421('0x33')]));_0x23bb04[_0x5421('0x32')]=_0x23bb04['attributes'][_0x5421('0x34')]?_0x23bb04[_0x5421('0x32')]:_0x2bbbe8[_0x5421('0x31')];if(_0x12bd5c[_0x5421('0x2d')]['includeAll']){_0x23bb04[_0x5421('0x3d')]=[{'all':!![]}];}_0x23bb04=_[_0x5421('0x43')]({},_0x23bb04,_0x12bd5c[_0x5421('0x3b')]);return db[_0x5421('0x28')]['find'](_0x23bb04)[_0x5421('0x1f')](handleEntityNotFound(_0x1b8358,null))[_0x5421('0x1f')](respondWithResult(_0x1b8358,null))[_0x5421('0x40')](handleError(_0x1b8358,null));};exports[_0x5421('0x44')]=function(_0x382b93,_0x34fbb9){return db[_0x5421('0x28')][_0x5421('0x44')](_0x382b93[_0x5421('0x45')],{})[_0x5421('0x1f')](respondWithResult(_0x34fbb9,0xc9))['catch'](handleError(_0x34fbb9,null));};exports['update']=function(_0x4d9ac5,_0x92ea9e){if(_0x4d9ac5[_0x5421('0x45')]['id']){delete _0x4d9ac5[_0x5421('0x45')]['id'];}return db['OpenchannelApplication'][_0x5421('0x46')]({'where':{'id':_0x4d9ac5['params']['id']}})[_0x5421('0x1f')](handleEntityNotFound(_0x92ea9e,null))[_0x5421('0x1f')](saveUpdates(_0x4d9ac5[_0x5421('0x45')],null))['then'](respondWithResult(_0x92ea9e,null))[_0x5421('0x40')](handleError(_0x92ea9e,null));};exports[_0x5421('0x20')]=function(_0x3340ac,_0x4b4059){return db[_0x5421('0x28')]['find']({'where':{'id':_0x3340ac[_0x5421('0x42')]['id']}})[_0x5421('0x1f')](handleEntityNotFound(_0x4b4059,null))[_0x5421('0x1f')](removeEntity(_0x4b4059,null))[_0x5421('0x40')](handleError(_0x4b4059,null));}; \ No newline at end of file +var _0x0bc1=['util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','OpenchannelApplication','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x45366b,_0x16881e){var _0x4e13d0=function(_0x6c82f4){while(--_0x6c82f4){_0x45366b['push'](_0x45366b['shift']());}};_0x4e13d0(++_0x16881e);}(_0x0bc1,0x85));var _0x10bc=function(_0x3eb535,_0x5d916b){_0x3eb535=_0x3eb535-0x0;var _0x472d65=_0x0bc1[_0x3eb535];return _0x472d65;};'use strict';var emlformat=require(_0x10bc('0x0'));var rimraf=require(_0x10bc('0x1'));var zipdir=require(_0x10bc('0x2'));var jsonpatch=require(_0x10bc('0x3'));var rp=require(_0x10bc('0x4'));var moment=require(_0x10bc('0x5'));var BPromise=require(_0x10bc('0x6'));var Mustache=require('mustache');var util=require(_0x10bc('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x10bc('0x8'));var fs=require('fs');var fs_extra=require(_0x10bc('0x9'));var _=require(_0x10bc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x10bc('0xb'));var deskjs=require(_0x10bc('0xc'));var toCsv=require(_0x10bc('0xd'));var querystring=require(_0x10bc('0xe'));var Papa=require('papaparse');var Redis=require(_0x10bc('0xf'));var authService=require(_0x10bc('0x10'));var qs=require(_0x10bc('0x11'));var as=require(_0x10bc('0x12'));var hardwareService=require(_0x10bc('0x13'));var logger=require(_0x10bc('0x14'))('api');var utils=require(_0x10bc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x10bc('0x16'));var db=require(_0x10bc('0x17'))['db'];function respondWithStatusCode(_0x2c58d1,_0x353c88){_0x353c88=_0x353c88||0xcc;return function(_0x59ee34){if(_0x59ee34){return _0x2c58d1[_0x10bc('0x18')](_0x353c88);}return _0x2c58d1[_0x10bc('0x19')](_0x353c88)['end']();};}function respondWithResult(_0x327548,_0x95e4ef){_0x95e4ef=_0x95e4ef||0xc8;return function(_0x1f85ec){if(_0x1f85ec){return _0x327548['status'](_0x95e4ef)['json'](_0x1f85ec);}};}function respondWithFilteredResult(_0xcf9313,_0x19e5ae){return function(_0x4462b2){if(_0x4462b2){var _0x390506=typeof _0x19e5ae[_0x10bc('0x1a')]==='undefined'&&typeof _0x19e5ae[_0x10bc('0x1b')]==='undefined';var _0x541093=_0x4462b2[_0x10bc('0x1c')];var _0x21ec14=_0x390506?0x0:_0x19e5ae[_0x10bc('0x1a')];var _0x3223b4=_0x390506?_0x4462b2[_0x10bc('0x1c')]:_0x19e5ae['offset']+_0x19e5ae[_0x10bc('0x1b')];var _0x44d273;if(_0x3223b4>=_0x541093){_0x3223b4=_0x541093;_0x44d273=0xc8;}else{_0x44d273=0xce;}_0xcf9313[_0x10bc('0x19')](_0x44d273);return _0xcf9313[_0x10bc('0x1d')](_0x10bc('0x1e'),_0x21ec14+'-'+_0x3223b4+'/'+_0x541093)['json'](_0x4462b2);}return null;};}function patchUpdates(_0xd7ad30){return function(_0x45c830){try{jsonpatch[_0x10bc('0x1f')](_0x45c830,_0xd7ad30,!![]);}catch(_0x500fd0){return BPromise['reject'](_0x500fd0);}return _0x45c830[_0x10bc('0x20')]();};}function saveUpdates(_0x4b9b8,_0x13e32f){return function(_0x3bb904){if(_0x3bb904){return _0x3bb904[_0x10bc('0x21')](_0x4b9b8)[_0x10bc('0x22')](function(_0x3bb6c0){return _0x3bb6c0;});}return null;};}function removeEntity(_0x2095cb,_0x575dde){return function(_0x3c3422){if(_0x3c3422){return _0x3c3422[_0x10bc('0x23')]()[_0x10bc('0x22')](function(){_0x2095cb[_0x10bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18a00c,_0x28690f){return function(_0x6fd722){if(!_0x6fd722){_0x18a00c[_0x10bc('0x18')](0x194);}return _0x6fd722;};}function handleError(_0x17f866,_0x380eca){_0x380eca=_0x380eca||0x1f4;return function(_0x2741df){logger['error'](_0x2741df[_0x10bc('0x24')]);if(_0x2741df[_0x10bc('0x25')]){delete _0x2741df[_0x10bc('0x25')];}_0x17f866[_0x10bc('0x19')](_0x380eca)[_0x10bc('0x26')](_0x2741df);};}exports[_0x10bc('0x27')]=function(_0x2c13b6,_0xfbfb6a){var _0x23f913={},_0x486202={},_0x5aa334={'count':0x0,'rows':[]};var _0x46b81d=_['map'](db['OpenchannelApplication'][_0x10bc('0x28')],function(_0x372be7){return{'name':_0x372be7['fieldName'],'type':_0x372be7[_0x10bc('0x29')]['key']};});_0x486202[_0x10bc('0x2a')]=_[_0x10bc('0x2b')](_0x46b81d,'name');_0x486202[_0x10bc('0x2c')]=_[_0x10bc('0x2d')](_0x2c13b6[_0x10bc('0x2c')]);_0x486202[_0x10bc('0x2e')]=_[_0x10bc('0x2f')](_0x486202['model'],_0x486202[_0x10bc('0x2c')]);_0x23f913[_0x10bc('0x30')]=_[_0x10bc('0x2f')](_0x486202[_0x10bc('0x2a')],qs[_0x10bc('0x31')](_0x2c13b6[_0x10bc('0x2c')]['fields']));_0x23f913[_0x10bc('0x30')]=_0x23f913[_0x10bc('0x30')]['length']?_0x23f913[_0x10bc('0x30')]:_0x486202['model'];if(!_0x2c13b6[_0x10bc('0x2c')][_0x10bc('0x32')]('nolimit')){_0x23f913['limit']=qs[_0x10bc('0x1b')](_0x2c13b6[_0x10bc('0x2c')]['limit']);_0x23f913[_0x10bc('0x1a')]=qs[_0x10bc('0x1a')](_0x2c13b6[_0x10bc('0x2c')]['offset']);}_0x23f913['order']=qs[_0x10bc('0x33')](_0x2c13b6[_0x10bc('0x2c')]['sort']);_0x23f913[_0x10bc('0x34')]=qs['filters'](_[_0x10bc('0x35')](_0x2c13b6[_0x10bc('0x2c')],_0x486202[_0x10bc('0x2e')]),_0x46b81d);if(_0x2c13b6['query'][_0x10bc('0x36')]){_0x23f913[_0x10bc('0x34')]=_[_0x10bc('0x37')](_0x23f913[_0x10bc('0x34')],{'$or':_[_0x10bc('0x2b')](_0x46b81d,function(_0x2665fc){if(_0x2665fc['type']!==_0x10bc('0x38')){var _0x340a6e={};_0x340a6e[_0x2665fc[_0x10bc('0x25')]]={'$like':'%'+_0x2c13b6['query'][_0x10bc('0x36')]+'%'};return _0x340a6e;}})});}_0x23f913=_[_0x10bc('0x37')]({},_0x23f913,_0x2c13b6[_0x10bc('0x39')]);var _0x5be8b6={'where':_0x23f913['where']};return db['OpenchannelApplication'][_0x10bc('0x1c')](_0x5be8b6)[_0x10bc('0x22')](function(_0x2914af){_0x5aa334['count']=_0x2914af;if(_0x2c13b6[_0x10bc('0x2c')][_0x10bc('0x3a')]){_0x23f913[_0x10bc('0x3b')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x10bc('0x3c')](_0x23f913);})[_0x10bc('0x22')](function(_0x306ed4){_0x5aa334[_0x10bc('0x3d')]=_0x306ed4;return _0x5aa334;})['then'](respondWithFilteredResult(_0xfbfb6a,_0x23f913))[_0x10bc('0x3e')](handleError(_0xfbfb6a,null));};exports[_0x10bc('0x3f')]=function(_0x3cd206,_0x3bfb4a){var _0x1a61d8={'raw':!![],'where':{'id':_0x3cd206[_0x10bc('0x40')]['id']}},_0x58a9a1={};_0x58a9a1[_0x10bc('0x2a')]=_[_0x10bc('0x2d')](db[_0x10bc('0x41')][_0x10bc('0x28')]);_0x58a9a1[_0x10bc('0x2c')]=_[_0x10bc('0x2d')](_0x3cd206[_0x10bc('0x2c')]);_0x58a9a1[_0x10bc('0x2e')]=_['intersection'](_0x58a9a1['model'],_0x58a9a1[_0x10bc('0x2c')]);_0x1a61d8[_0x10bc('0x30')]=_[_0x10bc('0x2f')](_0x58a9a1['model'],qs[_0x10bc('0x31')](_0x3cd206['query'][_0x10bc('0x31')]));_0x1a61d8[_0x10bc('0x30')]=_0x1a61d8[_0x10bc('0x30')][_0x10bc('0x42')]?_0x1a61d8['attributes']:_0x58a9a1[_0x10bc('0x2a')];if(_0x3cd206[_0x10bc('0x2c')][_0x10bc('0x3a')]){_0x1a61d8[_0x10bc('0x3b')]=[{'all':!![]}];}_0x1a61d8=_[_0x10bc('0x37')]({},_0x1a61d8,_0x3cd206[_0x10bc('0x39')]);return db[_0x10bc('0x41')][_0x10bc('0x43')](_0x1a61d8)['then'](handleEntityNotFound(_0x3bfb4a,null))['then'](respondWithResult(_0x3bfb4a,null))[_0x10bc('0x3e')](handleError(_0x3bfb4a,null));};exports[_0x10bc('0x44')]=function(_0x4930a1,_0x4920d1){return db[_0x10bc('0x41')][_0x10bc('0x44')](_0x4930a1[_0x10bc('0x45')],{})['then'](respondWithResult(_0x4920d1,0xc9))['catch'](handleError(_0x4920d1,null));};exports[_0x10bc('0x21')]=function(_0x8efc44,_0x2a3e55){if(_0x8efc44[_0x10bc('0x45')]['id']){delete _0x8efc44[_0x10bc('0x45')]['id'];}return db['OpenchannelApplication'][_0x10bc('0x43')]({'where':{'id':_0x8efc44['params']['id']}})[_0x10bc('0x22')](handleEntityNotFound(_0x2a3e55,null))[_0x10bc('0x22')](saveUpdates(_0x8efc44[_0x10bc('0x45')],null))['then'](respondWithResult(_0x2a3e55,null))[_0x10bc('0x3e')](handleError(_0x2a3e55,null));};exports[_0x10bc('0x23')]=function(_0x34a40f,_0x51010a){return db['OpenchannelApplication'][_0x10bc('0x43')]({'where':{'id':_0x34a40f[_0x10bc('0x40')]['id']}})[_0x10bc('0x22')](handleEntityNotFound(_0x51010a,null))['then'](removeEntity(_0x51010a,null))[_0x10bc('0x3e')](handleError(_0x51010a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index bdd4372..1d6ee0a 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 _0x64e2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xab3033,_0x4e9a4c){var _0x34fd8c=function(_0x2fd63d){while(--_0x2fd63d){_0xab3033['push'](_0xab3033['shift']());}};_0x34fd8c(++_0x4e9a4c);}(_0x64e2,0x177));var _0x264e=function(_0xbc847d,_0x2779bc){_0xbc847d=_0xbc847d-0x0;var _0x85712=_0x64e2[_0xbc847d];return _0x85712;};'use strict';var _=require('lodash');var util=require(_0x264e('0x0'));var logger=require(_0x264e('0x1'))(_0x264e('0x2'));var moment=require(_0x264e('0x3'));var BPromise=require(_0x264e('0x4'));var rp=require(_0x264e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x264e('0x6'));var config=require(_0x264e('0x7'));var attributes=require(_0x264e('0x8'));module[_0x264e('0x9')]=function(_0x3dfca6,_0x1a5200){return _0x3dfca6['define']('OpenchannelApplication',attributes,{'tableName':_0x264e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x264e('0xb'),'collate':_0x264e('0xc')});}; \ No newline at end of file +var _0x2817=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2f465e,_0x4a8526){var _0x312043=function(_0x1414e3){while(--_0x1414e3){_0x2f465e['push'](_0x2f465e['shift']());}};_0x312043(++_0x4a8526);}(_0x2817,0x147));var _0x7281=function(_0x4947e7,_0x98cfef){_0x4947e7=_0x4947e7-0x0;var _0x16e3f6=_0x2817[_0x4947e7];return _0x16e3f6;};'use strict';var _=require(_0x7281('0x0'));var util=require(_0x7281('0x1'));var logger=require(_0x7281('0x2'))(_0x7281('0x3'));var moment=require(_0x7281('0x4'));var BPromise=require(_0x7281('0x5'));var rp=require(_0x7281('0x6'));var fs=require('fs');var path=require(_0x7281('0x7'));var rimraf=require(_0x7281('0x8'));var config=require(_0x7281('0x9'));var attributes=require(_0x7281('0xa'));module[_0x7281('0xb')]=function(_0xe373a4,_0x2610f5){return _0xe373a4['define'](_0x7281('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7281('0xd'),'collate':_0x7281('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 09e40d6..e2b6e4f 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 _0x8990=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4334af,_0x21e066){var _0xec5be0=function(_0x1ee788){while(--_0x1ee788){_0x4334af['push'](_0x4334af['shift']());}};_0xec5be0(++_0x21e066);}(_0x8990,0x143));var _0x0899=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x8990[_0x3ff4a3];return _0x38676f;};'use strict';var _=require(_0x0899('0x0'));var util=require(_0x0899('0x1'));var moment=require(_0x0899('0x2'));var BPromise=require(_0x0899('0x3'));var rs=require(_0x0899('0x4'));var fs=require('fs');var Redis=require(_0x0899('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0899('0x6'));var logger=require(_0x0899('0x7'))('rpc');var config=require(_0x0899('0x8'));var jayson=require(_0x0899('0x9'));var client=jayson[_0x0899('0xa')][_0x0899('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a502,_0x3e01d2,_0x4f13bb){return new BPromise(function(_0x8fb9a1,_0xf153db){return client[_0x0899('0xc')](_0x58a502,_0x4f13bb)[_0x0899('0xd')](function(_0x120b4d){logger[_0x0899('0xe')](_0x0899('0xf'),_0x3e01d2,_0x0899('0x10'));logger[_0x0899('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3e01d2,_0x0899('0x10'),JSON['stringify'](_0x120b4d));if(_0x120b4d[_0x0899('0x12')]){if(_0x120b4d[_0x0899('0x12')][_0x0899('0x13')]===0x1f4){logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);return _0xf153db(_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);}logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);return _0x8fb9a1(_0x120b4d[_0x0899('0x12')][_0x0899('0x14')]);}else{logger[_0x0899('0xe')](_0x0899('0xf'),_0x3e01d2,_0x0899('0x10'));_0x8fb9a1(_0x120b4d[_0x0899('0x15')][_0x0899('0x14')]);}})[_0x0899('0x16')](function(_0x23b6f2){logger[_0x0899('0x12')](_0x0899('0xf'),_0x3e01d2,_0x23b6f2);_0xf153db(_0x23b6f2);});});}exports[_0x0899('0x17')]=function(_0x2a4f93){var _0x198934=this;return new Promise(function(_0x3c8ea4,_0x11f4c9){return db[_0x0899('0x18')][_0x0899('0x19')](_0x2a4f93[_0x0899('0x1a')],{'raw':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93['options'][_0x0899('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93['options']['where']||null:null,'attributes':_0x2a4f93[_0x0899('0x1b')]?_0x2a4f93[_0x0899('0x1b')][_0x0899('0x1d')]||null:null,'limit':_0x2a4f93['options']?_0x2a4f93['options']['limit']||null:null})['then'](function(_0x2630a2){logger['info'](_0x0899('0x17'),_0x2a4f93);logger[_0x0899('0x11')](_0x0899('0x17'),_0x2a4f93,JSON['stringify'](_0x2630a2));_0x3c8ea4(_0x2630a2);})['catch'](function(_0x18d562){logger[_0x0899('0x12')]('UpdateOpenchannelApplication',_0x18d562[_0x0899('0x14')],_0x2a4f93);_0x11f4c9(_0x198934['error'](0x1f4,_0x18d562['message']));});});}; \ No newline at end of file +var _0x7b3e=['UpdateOpenchannelApplication','body','options','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x7b3e,0x103));var _0xe7b3=function(_0x1a77e5,_0x185cb1){_0x1a77e5=_0x1a77e5-0x0;var _0x910a18=_0x7b3e[_0x1a77e5];return _0x910a18;};'use strict';var _=require(_0xe7b3('0x0'));var util=require(_0xe7b3('0x1'));var moment=require(_0xe7b3('0x2'));var BPromise=require(_0xe7b3('0x3'));var rs=require(_0xe7b3('0x4'));var fs=require('fs');var Redis=require(_0xe7b3('0x5'));var db=require(_0xe7b3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe7b3('0x7'));var config=require(_0xe7b3('0x8'));var jayson=require(_0xe7b3('0x9'));var client=jayson[_0xe7b3('0xa')][_0xe7b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb474,_0x128d39,_0x4dc0bc){return new BPromise(function(_0x434fea,_0x5e8569){return client[_0xe7b3('0xc')](_0x1bb474,_0x4dc0bc)[_0xe7b3('0xd')](function(_0x3b8bb0){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x128d39,_0xe7b3('0xe'));logger['debug'](_0xe7b3('0xf'),_0x128d39,_0xe7b3('0xe'),JSON[_0xe7b3('0x10')](_0x3b8bb0));if(_0x3b8bb0[_0xe7b3('0x11')]){if(_0x3b8bb0[_0xe7b3('0x11')]['code']===0x1f4){logger[_0xe7b3('0x11')](_0xe7b3('0x12'),_0x128d39,_0x3b8bb0[_0xe7b3('0x11')][_0xe7b3('0x13')]);return _0x5e8569(_0x3b8bb0[_0xe7b3('0x11')][_0xe7b3('0x13')]);}logger['error'](_0xe7b3('0x12'),_0x128d39,_0x3b8bb0[_0xe7b3('0x11')][_0xe7b3('0x13')]);return _0x434fea(_0x3b8bb0[_0xe7b3('0x11')]['message']);}else{logger['info'](_0xe7b3('0x12'),_0x128d39,'request\x20sent');_0x434fea(_0x3b8bb0['result'][_0xe7b3('0x13')]);}})[_0xe7b3('0x14')](function(_0x2d30fd){logger[_0xe7b3('0x11')](_0xe7b3('0x12'),_0x128d39,_0x2d30fd);_0x5e8569(_0x2d30fd);});});}exports[_0xe7b3('0x15')]=function(_0x5a8513){var _0xdab4c1=this;return new Promise(function(_0x1d470a,_0x303dcf){return db['OpenchannelApplication']['update'](_0x5a8513[_0xe7b3('0x16')],{'raw':_0x5a8513[_0xe7b3('0x17')]?_0x5a8513['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a8513[_0xe7b3('0x17')]?_0x5a8513[_0xe7b3('0x17')][_0xe7b3('0x18')]||null:null,'attributes':_0x5a8513[_0xe7b3('0x17')]?_0x5a8513['options'][_0xe7b3('0x19')]||null:null,'limit':_0x5a8513['options']?_0x5a8513[_0xe7b3('0x17')][_0xe7b3('0x1a')]||null:null})[_0xe7b3('0xd')](function(_0xd62c46){logger[_0xe7b3('0x1b')](_0xe7b3('0x15'),_0x5a8513);logger['debug'](_0xe7b3('0x15'),_0x5a8513,JSON[_0xe7b3('0x10')](_0xd62c46));_0x1d470a(_0xd62c46);})[_0xe7b3('0x14')](function(_0x4923ed){logger[_0xe7b3('0x11')](_0xe7b3('0x15'),_0x4923ed[_0xe7b3('0x13')],_0x5a8513);_0x303dcf(_0xdab4c1[_0xe7b3('0x11')](0x1f4,_0x4923ed['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7eaf0b7..afc0b56 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 _0xa671=['update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel'];(function(_0x49c493,_0x46f3e0){var _0x3fa0b4=function(_0x42b445){while(--_0x42b445){_0x49c493['push'](_0x49c493['shift']());}};_0x3fa0b4(++_0x46f3e0);}(_0xa671,0x1a5));var _0x1a67=function(_0x2fcf16,_0x344dcb){_0x2fcf16=_0x2fcf16-0x0;var _0x54013e=_0xa671[_0x2fcf16];return _0x54013e;};'use strict';var multer=require(_0x1a67('0x0'));var util=require(_0x1a67('0x1'));var path=require(_0x1a67('0x2'));var timeout=require(_0x1a67('0x3'));var express=require(_0x1a67('0x4'));var router=express['Router']();var fs_extra=require(_0x1a67('0x5'));var auth=require(_0x1a67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a67('0x7'));var controller=require(_0x1a67('0x8'));router[_0x1a67('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a67('0x9')](_0x1a67('0xa'),auth[_0x1a67('0xb')](),controller[_0x1a67('0xc')]);router[_0x1a67('0x9')](_0x1a67('0xd'),auth[_0x1a67('0xb')](),controller[_0x1a67('0xe')]);router[_0x1a67('0x9')](_0x1a67('0xf'),auth[_0x1a67('0xb')](),controller['getMessages']);router['get'](_0x1a67('0x10'),auth[_0x1a67('0xb')](),controller[_0x1a67('0x11')]);router['post']('/',auth[_0x1a67('0xb')](),controller[_0x1a67('0x12')]);router['post'](_0x1a67('0xf'),auth[_0x1a67('0xb')](),controller[_0x1a67('0x13')]);router[_0x1a67('0x14')](_0x1a67('0x15'),auth[_0x1a67('0xb')](),interaction[_0x1a67('0x16')]('openchannel',_0x1a67('0x17')),controller[_0x1a67('0x18')]);router[_0x1a67('0x19')](_0x1a67('0xd'),auth[_0x1a67('0xb')](),interaction['tracked'](_0x1a67('0x1a'),'openchannelinteraction:update'),controller[_0x1a67('0x1b')]);router[_0x1a67('0x1c')]('/:id',auth[_0x1a67('0xb')](),interaction[_0x1a67('0x16')](_0x1a67('0x1a'),_0x1a67('0x1d')),controller[_0x1a67('0x1e')]);router[_0x1a67('0x1c')](_0x1a67('0x15'),auth[_0x1a67('0xb')](),controller['removeTags']);module[_0x1a67('0x1f')]=router; \ No newline at end of file +var _0x73b8=['post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','get','isAuthenticated','describe','/:id','getMessages','/:id/download','download'];(function(_0x4ba7de,_0xde0329){var _0x5346c5=function(_0x4842ad){while(--_0x4842ad){_0x4ba7de['push'](_0x4ba7de['shift']());}};_0x5346c5(++_0xde0329);}(_0x73b8,0x152));var _0x873b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x73b8[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x873b('0x0'));var util=require(_0x873b('0x1'));var path=require(_0x873b('0x2'));var timeout=require(_0x873b('0x3'));var express=require('express');var router=express[_0x873b('0x4')]();var fs_extra=require(_0x873b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x873b('0x6')]('/',auth[_0x873b('0x7')](),controller['index']);router['get']('/describe',auth[_0x873b('0x7')](),controller[_0x873b('0x8')]);router[_0x873b('0x6')](_0x873b('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x873b('0x6')]('/:id/messages',auth[_0x873b('0x7')](),controller[_0x873b('0xa')]);router[_0x873b('0x6')](_0x873b('0xb'),auth['isAuthenticated'](),controller[_0x873b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x873b('0xd')](_0x873b('0xe'),auth[_0x873b('0x7')](),controller[_0x873b('0xf')]);router[_0x873b('0xd')](_0x873b('0x10'),auth[_0x873b('0x7')](),interaction[_0x873b('0x11')](_0x873b('0x12'),_0x873b('0x13')),controller[_0x873b('0x14')]);router[_0x873b('0x15')](_0x873b('0x9'),auth[_0x873b('0x7')](),interaction[_0x873b('0x11')](_0x873b('0x12'),_0x873b('0x16')),controller['update']);router[_0x873b('0x17')](_0x873b('0x9'),auth[_0x873b('0x7')](),interaction['tracked'](_0x873b('0x12'),_0x873b('0x18')),controller['destroy']);router[_0x873b('0x17')](_0x873b('0x10'),auth[_0x873b('0x7')](),controller[_0x873b('0x19')]);module[_0x873b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c191da7..4654a74 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 _0x447b=['STRING','ENUM','out','BOOLEAN','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x447b,0xe4));var _0xb447=function(_0xd366e0,_0x327ac5){_0xd366e0=_0xd366e0-0x0;var _0x3b64b1=_0x447b[_0xd366e0];return _0x3b64b1;};'use strict';var Sequelize=require(_0xb447('0x0'));module[_0xb447('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb447('0x2')]},'disposition':{'type':Sequelize[_0xb447('0x3')]},'secondDisposition':{'type':Sequelize[_0xb447('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb447('0x3')]},'note':{'type':Sequelize[_0xb447('0x3')]},'read1stAt':{'type':Sequelize[_0xb447('0x2')]},'threadId':{'type':Sequelize[_0xb447('0x3')]},'externalUrl':{'type':Sequelize[_0xb447('0x3')]},'lastMsgAt':{'type':Sequelize[_0xb447('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xb447('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb447('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xb447('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6c6f=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x435fdd,_0x311fb5){var _0x9ba46c=function(_0x20c8c){while(--_0x20c8c){_0x435fdd['push'](_0x435fdd['shift']());}};_0x9ba46c(++_0x311fb5);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x1da123,_0x1c05f6){_0x1da123=_0x1da123-0x0;var _0x521207=_0x6c6f[_0x1da123];return _0x521207;};'use strict';var Sequelize=require(_0xf6c6('0x0'));module[_0xf6c6('0x1')]={'closed':{'type':Sequelize[_0xf6c6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf6c6('0x3')]},'disposition':{'type':Sequelize[_0xf6c6('0x4')]},'secondDisposition':{'type':Sequelize[_0xf6c6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf6c6('0x4')]},'note':{'type':Sequelize[_0xf6c6('0x4')]},'read1stAt':{'type':Sequelize[_0xf6c6('0x3')]},'threadId':{'type':Sequelize[_0xf6c6('0x4')]},'externalUrl':{'type':Sequelize[_0xf6c6('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf6c6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf6c6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xf6c6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a15f36e..27cf800 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 _0xa998=['removeTags','download','join','root','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','Public','Attachment','basename','pipe','createWriteStream','direction','out','System','value','server','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','fields','length','options','create','body','find','describe','ids','omit','getMessages','findOne','order','sort','where','pick','OpenchannelInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','includeAll','rows','addTags','setTags','name','color','emit'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xa998,0xa1));var _0x8a99=function(_0x5834be,_0x15935c){_0x5834be=_0x5834be-0x0;var _0x4a89a1=_0xa998[_0x5834be];return _0x4a89a1;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8a99('0x0'));var moment=require(_0x8a99('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x8a99('0x2'));var fs=require('fs');var _=require(_0x8a99('0x3'));var Redis=require(_0x8a99('0x4'));var interaction=require(_0x8a99('0x5'));var qs=require(_0x8a99('0x6'));var pdf=require(_0x8a99('0x7'));var logger=require(_0x8a99('0x8'))('api');var config=require(_0x8a99('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8a99('0xa')](config['redis'],{'host':_0x8a99('0xb'),'port':0x18eb});var socket=require(_0x8a99('0xc'))(new Redis(config['redis']));require(_0x8a99('0xd'))[_0x8a99('0xe')](socket);function respondWithStatusCode(_0x2d53a7,_0x3c6080){_0x3c6080=_0x3c6080||0xcc;return function(_0x56bced){if(_0x56bced){return _0x2d53a7[_0x8a99('0xf')](_0x3c6080);}return _0x2d53a7[_0x8a99('0x10')](_0x3c6080)[_0x8a99('0x11')]();};}function respondWithResult(_0x4d322a,_0x30d28d){_0x30d28d=_0x30d28d||0xc8;return function(_0x1b3fe3){if(_0x1b3fe3){return _0x4d322a[_0x8a99('0x10')](_0x30d28d)['json'](_0x1b3fe3);}};}function respondWithFilteredResult(_0x1334fd,_0x15e620){return function(_0x2d3973){if(_0x2d3973){var _0x5ab62a=typeof _0x15e620[_0x8a99('0x12')]==='undefined'&&typeof _0x15e620[_0x8a99('0x13')]===_0x8a99('0x14');var _0x559844=_0x2d3973[_0x8a99('0x15')];var _0x556ed=_0x5ab62a?0x0:_0x15e620[_0x8a99('0x12')];var _0x1e38f7=_0x5ab62a?_0x2d3973['count']:_0x15e620[_0x8a99('0x12')]+_0x15e620[_0x8a99('0x13')];var _0x520e54;if(_0x1e38f7>=_0x559844){_0x1e38f7=_0x559844;_0x520e54=0xc8;}else{_0x520e54=0xce;}_0x1334fd[_0x8a99('0x10')](_0x520e54);return _0x1334fd[_0x8a99('0x16')](_0x8a99('0x17'),_0x556ed+'-'+_0x1e38f7+'/'+_0x559844)['json'](_0x2d3973);}return null;};}function saveUpdates(_0x230de2){return function(_0x856875){if(_0x856875){return _0x856875[_0x8a99('0x18')](_0x230de2)[_0x8a99('0x19')](function(_0x3fe271){return _0x3fe271;});}return null;};}function removeEntity(_0x23eeab){return function(_0x17fa63){if(_0x17fa63){return _0x17fa63[_0x8a99('0x1a')]()[_0x8a99('0x19')](function(){_0x23eeab[_0x8a99('0x10')](0xcc)[_0x8a99('0x11')]();});}};}function handleEntityNotFound(_0x165d12){return function(_0x19a39f){if(!_0x19a39f){_0x165d12[_0x8a99('0xf')](0x194);}return _0x19a39f;};}function handleError(_0x58f70a,_0x753f80){_0x753f80=_0x753f80||0x1f4;return function(_0x5efc08){logger[_0x8a99('0x1b')](_0x5efc08[_0x8a99('0x1c')]);if(_0x5efc08['name']){delete _0x5efc08['name'];}_0x58f70a[_0x8a99('0x10')](_0x753f80)['send'](_0x5efc08);};}exports[_0x8a99('0x1d')]=function(_0x5b9962,_0x253e84){var _0x29aff8={};var _0x43a369=_[_0x8a99('0x1e')](db[_0x8a99('0x1f')][_0x8a99('0x20')],function(_0xe97a28){return{'name':_0xe97a28[_0x8a99('0x21')],'type':_0xe97a28[_0x8a99('0x22')][_0x8a99('0x23')]};});_0x29aff8=qs['getOptions'](_0x43a369,_0x5b9962);return interaction[_0x8a99('0x24')](_0x8a99('0x25'),_0x5b9962[_0x8a99('0x26')],_0x5b9962[_0x8a99('0x27')],_0x29aff8,_0x43a369)['then'](respondWithFilteredResult(_0x253e84,_0x29aff8))[_0x8a99('0x28')](handleError(_0x253e84,null));};exports[_0x8a99('0x29')]=function(_0x589ee4,_0x1d9106){var _0x114721={};if(_0x589ee4[_0x8a99('0x26')]['type']&&_0x589ee4[_0x8a99('0x26')][_0x8a99('0x22')]==='from'){_0x114721[_0x8a99('0x2a')]=_0x589ee4[_0x8a99('0x2b')]['id'];}else{_0x114721['id']=_0x589ee4['params']['id'];}var _0x89ed51={'raw':![],'where':_0x114721},_0x6f402d={};_0x6f402d[_0x8a99('0x2c')]=_['keys'](db[_0x8a99('0x1f')][_0x8a99('0x20')]);_0x6f402d['query']=_[_0x8a99('0x2d')](_0x589ee4[_0x8a99('0x26')]);_0x6f402d[_0x8a99('0x2e')]=_['intersection'](_0x6f402d[_0x8a99('0x2c')],_0x6f402d['query']);_0x89ed51[_0x8a99('0x2f')]=_[_0x8a99('0x30')](_0x6f402d['model'],qs[_0x8a99('0x31')](_0x589ee4[_0x8a99('0x26')][_0x8a99('0x31')]));_0x89ed51[_0x8a99('0x2f')]=_0x89ed51[_0x8a99('0x2f')][_0x8a99('0x32')]?_0x89ed51[_0x8a99('0x2f')]:_0x6f402d[_0x8a99('0x2c')];if(_0x589ee4[_0x8a99('0x26')]['includeAll']){_0x89ed51['include']=[{'all':!![]}];}_0x89ed51=_['merge']({},_0x89ed51,_0x589ee4[_0x8a99('0x33')]);return db[_0x8a99('0x1f')]['find'](_0x89ed51)[_0x8a99('0x19')](handleEntityNotFound(_0x1d9106,null))['then'](respondWithResult(_0x1d9106,null))['catch'](handleError(_0x1d9106,null));};exports['create']=function(_0x45e0ee,_0x250374){return db['OpenchannelInteraction'][_0x8a99('0x34')](_0x45e0ee[_0x8a99('0x35')],{})[_0x8a99('0x19')](respondWithResult(_0x250374,0xc9))[_0x8a99('0x28')](handleError(_0x250374,null));};exports[_0x8a99('0x18')]=function(_0x4d3915,_0x22af14){if(_0x4d3915[_0x8a99('0x35')]['id']){delete _0x4d3915[_0x8a99('0x35')]['id'];}return db['OpenchannelInteraction'][_0x8a99('0x36')]({'where':{'id':_0x4d3915[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x22af14,null))[_0x8a99('0x19')](saveUpdates(_0x4d3915[_0x8a99('0x35')],null))[_0x8a99('0x19')](respondWithResult(_0x22af14,null))[_0x8a99('0x28')](handleError(_0x22af14,null));};exports[_0x8a99('0x1a')]=function(_0x5988f3,_0x34cf4b){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x5988f3[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x34cf4b,null))[_0x8a99('0x19')](removeEntity(_0x34cf4b,null))[_0x8a99('0x28')](handleError(_0x34cf4b,null));};exports[_0x8a99('0x37')]=function(_0x204a77,_0x3ea9ee){return db['OpenchannelInteraction']['describe']()[_0x8a99('0x19')](respondWithResult(_0x3ea9ee,null))['catch'](handleError(_0x3ea9ee,null));};exports['addMessage']=function(_0x9ea990,_0x2c4b9f){return db['OpenchannelMessage'][_0x8a99('0x36')]({'where':{'id':_0x9ea990[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x2c4b9f,null))['then'](function(_0x221bb0){if(_0x221bb0){return _0x221bb0['addMessage'](_0x9ea990[_0x8a99('0x35')][_0x8a99('0x38')],_[_0x8a99('0x39')](_0x9ea990[_0x8a99('0x35')],[_0x8a99('0x38'),'id'])||{});}})['then'](respondWithResult(_0x2c4b9f,null))[_0x8a99('0x28')](handleError(_0x2c4b9f,null));};exports[_0x8a99('0x3a')]=function(_0x1156c9,_0x23e978){var _0x175f2e={'raw':![],'where':{}};var _0x2bf788={};var _0x5ea3ff={'count':0x0,'rows':[]};return db[_0x8a99('0x1f')][_0x8a99('0x3b')]({'where':{'id':_0x1156c9[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x23e978,null))['then'](function(_0x53d4ad){if(_0x53d4ad){_0x2bf788['model']=_[_0x8a99('0x2d')](db['OpenchannelMessage']['rawAttributes']);_0x2bf788['query']=_[_0x8a99('0x2d')](_0x1156c9[_0x8a99('0x26')]);_0x2bf788[_0x8a99('0x2e')]=_[_0x8a99('0x30')](_0x2bf788[_0x8a99('0x2c')],_0x2bf788[_0x8a99('0x26')]);_0x175f2e['attributes']=_[_0x8a99('0x30')](_0x2bf788[_0x8a99('0x2c')],qs['fields'](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x31')]));_0x175f2e[_0x8a99('0x2f')]=_0x175f2e[_0x8a99('0x2f')][_0x8a99('0x32')]?_0x175f2e[_0x8a99('0x2f')]:_0x2bf788[_0x8a99('0x2c')];if(!_0x1156c9[_0x8a99('0x26')]['hasOwnProperty']('nolimit')){_0x175f2e[_0x8a99('0x13')]=qs[_0x8a99('0x13')](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x13')]);_0x175f2e['offset']=qs['offset'](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x12')]);}_0x175f2e[_0x8a99('0x3c')]=qs[_0x8a99('0x3d')](_0x1156c9[_0x8a99('0x26')][_0x8a99('0x3d')]);_0x175f2e[_0x8a99('0x3e')]=qs[_0x8a99('0x2e')](_[_0x8a99('0x3f')](_0x1156c9[_0x8a99('0x26')],_0x2bf788['filters']));_0x175f2e[_0x8a99('0x3e')][_0x8a99('0x40')]=_0x53d4ad['id'];if(_0x1156c9['query']['filter']){_0x175f2e[_0x8a99('0x3e')]=_[_0x8a99('0x41')](_0x175f2e[_0x8a99('0x3e')],{'$or':_['map'](_0x175f2e[_0x8a99('0x2f')],function(_0x4e56dc){var _0x542499={};_0x542499[_0x4e56dc]={'$like':'%'+_0x1156c9[_0x8a99('0x26')][_0x8a99('0x42')]+'%'};return _0x542499;})});}if(_0x1156c9[_0x8a99('0x26')][_0x8a99('0x43')]){var _0x3f0cb0=_0x1156c9['query'][_0x8a99('0x43')][_0x8a99('0x44')](',');var _0x114040={};_0x114040[_0x3f0cb0[0x0]]={'$gte':moment(_0x3f0cb0[0x1])[_0x8a99('0x45')](_0x8a99('0x46'))};_0x175f2e['where']=_['merge'](_0x175f2e[_0x8a99('0x3e')],_0x114040);}_0x175f2e=_[_0x8a99('0x41')]({},_0x175f2e,_0x1156c9[_0x8a99('0x33')]);return db[_0x8a99('0x47')][_0x8a99('0x15')]({'where':_0x175f2e[_0x8a99('0x3e')]})[_0x8a99('0x19')](function(_0x105d43){_0x5ea3ff['count']=_0x105d43;if(_0x1156c9[_0x8a99('0x26')][_0x8a99('0x48')]){_0x175f2e['include']=[{'all':!![]}];}return db[_0x8a99('0x47')][_0x8a99('0x24')](_0x175f2e);})['then'](function(_0x506d39){_0x5ea3ff[_0x8a99('0x49')]=_0x506d39;return _0x5ea3ff;});}})[_0x8a99('0x19')](respondWithFilteredResult(_0x23e978,_0x175f2e))[_0x8a99('0x28')](handleError(_0x23e978,null));};exports[_0x8a99('0x4a')]=function(_0x3c277b,_0x2ddfa6){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x3c277b[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0x2ddfa6,null))[_0x8a99('0x19')](function(_0x25ca43){if(_0x25ca43){return _0x25ca43[_0x8a99('0x4b')](_0x3c277b['body'][_0x8a99('0x38')],_['omit'](_0x3c277b[_0x8a99('0x35')],[_0x8a99('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x8a99('0x24')]({'attributes':['id',_0x8a99('0x4c'),_0x8a99('0x4d')],'where':{'id':_0x3c277b['body'][_0x8a99('0x38')]}});})[_0x8a99('0x19')](function(_0x932342){socket[_0x8a99('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x3c277b['params']['id']),'tags':_0x932342||[]});return{'id':Number(_0x3c277b[_0x8a99('0x2b')]['id']),'tags':_0x932342||[]};});}})[_0x8a99('0x19')](respondWithResult(_0x2ddfa6,null))['catch'](handleError(_0x2ddfa6,null));};exports['removeTags']=function(_0x365471,_0xe03545){return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x365471[_0x8a99('0x2b')]['id']}})[_0x8a99('0x19')](handleEntityNotFound(_0xe03545,null))[_0x8a99('0x19')](function(_0x3fa7fb){if(_0x3fa7fb){return _0x3fa7fb[_0x8a99('0x4f')](_0x365471['query'][_0x8a99('0x38')]);}})[_0x8a99('0x19')](respondWithStatusCode(_0xe03545,null))[_0x8a99('0x28')](handleError(_0xe03545,null));};exports[_0x8a99('0x50')]=function(_0x178c9b,_0xec9548){var _0xc6e15e=moment()['unix']()['toString']();var _0x45fabf=path[_0x8a99('0x51')](config[_0x8a99('0x52')],'server',_0x8a99('0x53'),_0x8a99('0x54'));var _0x68cd5=path[_0x8a99('0x51')](config[_0x8a99('0x52')],'server','files','attachments');var _0x569d09=path[_0x8a99('0x51')](_0x45fabf,_0xc6e15e);var _0x2e5e45=util[_0x8a99('0x45')](_0x8a99('0x55'),_0x178c9b[_0x8a99('0x2b')]['id'],_0xc6e15e);var _0x1ad8dd=path['join'](_0x45fabf,_0x2e5e45);var _0x3847be=[];_0x3847be[_0x8a99('0x56')]({'model':db[_0x8a99('0x57')],'as':_0x8a99('0x57'),'attributes':['id',_0x8a99('0x58')],'raw':!![]});_0x3847be['push']({'model':db[_0x8a99('0x59')],'as':_0x8a99('0x5a'),'attributes':['id',_0x8a99('0x5b'),_0x8a99('0x5c')],'raw':!![]});if(_0x178c9b[_0x8a99('0x26')]['attachments']){_0x3847be['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x159635=[{'model':db[_0x8a99('0x47')],'as':'Messages','attributes':['id',_0x8a99('0x35'),'createdAt','direction',_0x8a99('0x5d'),_0x8a99('0x5e')],'include':_0x3847be}];_0x159635['push']({'model':db[_0x8a99('0x5f')],'as':_0x8a99('0x60'),'attributes':['id',_0x8a99('0x4c')]});_0x159635['push']({'model':db[_0x8a99('0x57')],'as':_0x8a99('0x61'),'attributes':['id',_0x8a99('0x58')]});return db[_0x8a99('0x1f')]['find']({'where':{'id':_0x178c9b[_0x8a99('0x2b')]['id']},'include':_0x159635})[_0x8a99('0x19')](handleEntityNotFound(_0xec9548,null))[_0x8a99('0x19')](function(_0x4f1ce3){if(_0x4f1ce3){var _0x46e9b6=_0x4f1ce3[_0x8a99('0x62')]({'plain':!![]});fs[_0x8a99('0x63')](_0x569d09);var _0x43c038={'channel':_0x8a99('0x64'),'account':_0x46e9b6[_0x8a99('0x60')][_0x8a99('0x4c')],'agent':_0x46e9b6[_0x8a99('0x61')]?_0x46e9b6[_0x8a99('0x61')][_0x8a99('0x58')]:_0x8a99('0x65'),'createdAt':moment(_0x46e9b6[_0x8a99('0x66')])[_0x8a99('0x45')](_0x8a99('0x46'))[_0x8a99('0x67')](),'closedAt':_0x46e9b6[_0x8a99('0x68')]?moment(_0x46e9b6[_0x8a99('0x69')])[_0x8a99('0x45')](_0x8a99('0x46'))['toString']():'','disposition':_0x46e9b6[_0x8a99('0x6a')],'visibility':_0x46e9b6[_0x8a99('0x6b')]?_0x8a99('0x6c'):'Private','messages':_(_0x46e9b6['Messages'])[_0x8a99('0x42')]({'secret':![]})['map'](function(_0x5220fa){if(_0x5220fa[_0x8a99('0x6d')]){var _0x99dc55=path['join'](_0x68cd5,_0x5220fa['Attachment'][_0x8a99('0x6e')]);if(fs['existsSync'](_0x99dc55)){fs['createReadStream'](_0x99dc55)[_0x8a99('0x6f')](fs[_0x8a99('0x70')](path[_0x8a99('0x51')](_0x569d09,_0x5220fa[_0x8a99('0x6d')][_0x8a99('0x6e')])));}}return{'date':moment(_0x5220fa['createdAt'])[_0x8a99('0x45')](_0x8a99('0x46'))['toString'](),'sender':_0x5220fa[_0x8a99('0x71')]===_0x8a99('0x72')?_0x5220fa[_0x8a99('0x57')]?_0x5220fa[_0x8a99('0x57')][_0x8a99('0x58')]:_0x8a99('0x73'):_0x5220fa['Contact'][_0x8a99('0x5b')]+(_0x5220fa[_0x8a99('0x5a')][_0x8a99('0x5c')]?'\x20'+_0x5220fa['Contact'][_0x8a99('0x5c')]:''),'body':_0x5220fa['Attachment']?_0x5220fa[_0x8a99('0x6d')][_0x8a99('0x6e')]:_0x5220fa[_0x8a99('0x35')],'direction':_0x5220fa[_0x8a99('0x71')]===_0x8a99('0x72')?'A':'C','secret':_0x5220fa[_0x8a99('0x5d')],'read':_0x5220fa[_0x8a99('0x5e')],'attachment':_0x5220fa[_0x8a99('0x6d')]};})[_0x8a99('0x74')]()};return ejs['renderFile'](path[_0x8a99('0x51')](config[_0x8a99('0x52')],_0x8a99('0x75'),'views','downloadInteraction.ejs'),{'interaction':_0x43c038})[_0x8a99('0x19')](function(_0x3ad09f){var _0x138adc=path[_0x8a99('0x51')](_0x569d09,'transcript-'+_0x46e9b6['id']+'-'+_0xc6e15e+'.pdf');var _0x3a93cd={'path':_0x138adc,'channel':_0x8a99('0x64'),'interactionId':_0x46e9b6['id']};return pdf['createPdfFromHTML'](_0x3ad09f,_0x3a93cd);})['then'](function(){return new Promise(function(_0x5f0f9f,_0x14f853){zipdir(_0x569d09,{'saveTo':_0x1ad8dd},function(_0x57eaf5,_0x5939d3){if(_0x57eaf5)return _0x14f853(_0x57eaf5);return _0x5f0f9f(_0x5939d3);});})[_0x8a99('0x19')](function(){return new Promise(function(_0x131967,_0x31e351){rimraf(_0x569d09,function(_0x55efe0){if(_0x55efe0)_0x31e351(_0x55efe0);return _0x131967();});});})[_0x8a99('0x19')](function(){return _0xec9548[_0x8a99('0x50')](_0x1ad8dd,_0x2e5e45,function(_0x3ac5e7){if(_0x3ac5e7){logger[_0x8a99('0x1b')](_0x8a99('0x76'),_0x3ac5e7);}else{fs[_0x8a99('0x77')](_0x1ad8dd);}});});});}else{return _0xec9548['sendStatus'](0xc8);}})['catch'](handleError(_0xec9548,null));}; \ No newline at end of file +var _0x6710=['redis','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','update','destroy','then','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','findAll','openchannel','user','catch','show','query','from','params','model','keys','filters','intersection','attributes','fields','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','pick','where','merge','$gte','split','format','count','include','rows','setTags','omit','spread','Tag','color','emit','removeTags','download','join','server','tmp','root','files','transcript-%d-%s.zip','User','fullname','CmContact','firstName','attachments','push','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','toString','disposition','Private','existsSync','createReadStream','createWriteStream','basename','out','Contact','lastName','value','views','downloadInteraction.ejs','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults'];(function(_0x32ac14,_0x2ace1f){var _0x47581d=function(_0x1e31ea){while(--_0x1e31ea){_0x32ac14['push'](_0x32ac14['shift']());}};_0x47581d(++_0x2ace1f);}(_0x6710,0x172));var _0x0671=function(_0x12573d,_0x3585b3){_0x12573d=_0x12573d-0x0;var _0x19cba2=_0x6710[_0x12573d];return _0x19cba2;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0671('0x0'));var moment=require(_0x0671('0x1'));var util=require(_0x0671('0x2'));var path=require(_0x0671('0x3'));var ejs=require(_0x0671('0x4'));var fs=require('fs');var _=require(_0x0671('0x5'));var Redis=require(_0x0671('0x6'));var interaction=require(_0x0671('0x7'));var qs=require(_0x0671('0x8'));var pdf=require(_0x0671('0x9'));var logger=require(_0x0671('0xa'))(_0x0671('0xb'));var config=require('../../config/environment');var db=require(_0x0671('0xc'))['db'];config['redis']=_[_0x0671('0xd')](config[_0x0671('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0671('0xe')]));require(_0x0671('0xf'))[_0x0671('0x10')](socket);function respondWithStatusCode(_0x51715e,_0x101d0d){_0x101d0d=_0x101d0d||0xcc;return function(_0x373f2b){if(_0x373f2b){return _0x51715e[_0x0671('0x11')](_0x101d0d);}return _0x51715e[_0x0671('0x12')](_0x101d0d)[_0x0671('0x13')]();};}function respondWithResult(_0x3c9cf9,_0x31956b){_0x31956b=_0x31956b||0xc8;return function(_0x51c93d){if(_0x51c93d){return _0x3c9cf9[_0x0671('0x12')](_0x31956b)['json'](_0x51c93d);}};}function respondWithFilteredResult(_0x577ba1,_0x571d66){return function(_0x58d9e5){if(_0x58d9e5){var _0xc2a0d1=typeof _0x571d66[_0x0671('0x14')]==='undefined'&&typeof _0x571d66[_0x0671('0x15')]===_0x0671('0x16');var _0x268fac=_0x58d9e5['count'];var _0x45daac=_0xc2a0d1?0x0:_0x571d66['offset'];var _0x17217a=_0xc2a0d1?_0x58d9e5['count']:_0x571d66[_0x0671('0x14')]+_0x571d66['limit'];var _0x1beca1;if(_0x17217a>=_0x268fac){_0x17217a=_0x268fac;_0x1beca1=0xc8;}else{_0x1beca1=0xce;}_0x577ba1[_0x0671('0x12')](_0x1beca1);return _0x577ba1[_0x0671('0x17')](_0x0671('0x18'),_0x45daac+'-'+_0x17217a+'/'+_0x268fac)[_0x0671('0x19')](_0x58d9e5);}return null;};}function saveUpdates(_0xc33025){return function(_0x1cfb6f){if(_0x1cfb6f){return _0x1cfb6f[_0x0671('0x1a')](_0xc33025)['then'](function(_0x5e4f42){return _0x5e4f42;});}return null;};}function removeEntity(_0x13c160){return function(_0x302b13){if(_0x302b13){return _0x302b13[_0x0671('0x1b')]()[_0x0671('0x1c')](function(){_0x13c160[_0x0671('0x12')](0xcc)[_0x0671('0x13')]();});}};}function handleEntityNotFound(_0x57d95a){return function(_0x55381){if(!_0x55381){_0x57d95a['sendStatus'](0x194);}return _0x55381;};}function handleError(_0x28d7c6,_0x3c2017){_0x3c2017=_0x3c2017||0x1f4;return function(_0x1db9b8){logger[_0x0671('0x1d')](_0x1db9b8[_0x0671('0x1e')]);if(_0x1db9b8[_0x0671('0x1f')]){delete _0x1db9b8[_0x0671('0x1f')];}_0x28d7c6[_0x0671('0x12')](_0x3c2017)[_0x0671('0x20')](_0x1db9b8);};}exports[_0x0671('0x21')]=function(_0x4f6559,_0x17bc2b){var _0x7ad051={};var _0x275453=_[_0x0671('0x22')](db[_0x0671('0x23')][_0x0671('0x24')],function(_0x8df743){return{'name':_0x8df743[_0x0671('0x25')],'type':_0x8df743[_0x0671('0x26')]['key']};});_0x7ad051=qs['getOptions'](_0x275453,_0x4f6559);return interaction[_0x0671('0x27')](_0x0671('0x28'),_0x4f6559['query'],_0x4f6559[_0x0671('0x29')],_0x7ad051,_0x275453)[_0x0671('0x1c')](respondWithFilteredResult(_0x17bc2b,_0x7ad051))[_0x0671('0x2a')](handleError(_0x17bc2b,null));};exports[_0x0671('0x2b')]=function(_0x514736,_0xda229f){var _0xd25811={};if(_0x514736[_0x0671('0x2c')][_0x0671('0x26')]&&_0x514736[_0x0671('0x2c')][_0x0671('0x26')]===_0x0671('0x2d')){_0xd25811[_0x0671('0x2d')]=_0x514736['params']['id'];}else{_0xd25811['id']=_0x514736[_0x0671('0x2e')]['id'];}var _0x29045f={'raw':![],'where':_0xd25811},_0x51a3bd={};_0x51a3bd[_0x0671('0x2f')]=_[_0x0671('0x30')](db[_0x0671('0x23')][_0x0671('0x24')]);_0x51a3bd[_0x0671('0x2c')]=_[_0x0671('0x30')](_0x514736[_0x0671('0x2c')]);_0x51a3bd[_0x0671('0x31')]=_[_0x0671('0x32')](_0x51a3bd['model'],_0x51a3bd['query']);_0x29045f[_0x0671('0x33')]=_[_0x0671('0x32')](_0x51a3bd[_0x0671('0x2f')],qs[_0x0671('0x34')](_0x514736['query']['fields']));_0x29045f['attributes']=_0x29045f[_0x0671('0x33')]['length']?_0x29045f['attributes']:_0x51a3bd[_0x0671('0x2f')];if(_0x514736[_0x0671('0x2c')][_0x0671('0x35')]){_0x29045f['include']=[{'all':!![]}];}_0x29045f=_['merge']({},_0x29045f,_0x514736[_0x0671('0x36')]);return db[_0x0671('0x23')][_0x0671('0x37')](_0x29045f)[_0x0671('0x1c')](handleEntityNotFound(_0xda229f,null))[_0x0671('0x1c')](respondWithResult(_0xda229f,null))[_0x0671('0x2a')](handleError(_0xda229f,null));};exports[_0x0671('0x38')]=function(_0x48164b,_0x3c55eb){return db[_0x0671('0x23')]['create'](_0x48164b[_0x0671('0x39')],{})['then'](respondWithResult(_0x3c55eb,0xc9))[_0x0671('0x2a')](handleError(_0x3c55eb,null));};exports[_0x0671('0x1a')]=function(_0x5118b6,_0xa91d7e){if(_0x5118b6['body']['id']){delete _0x5118b6[_0x0671('0x39')]['id'];}return db[_0x0671('0x23')]['find']({'where':{'id':_0x5118b6[_0x0671('0x2e')]['id']}})[_0x0671('0x1c')](handleEntityNotFound(_0xa91d7e,null))['then'](saveUpdates(_0x5118b6[_0x0671('0x39')],null))[_0x0671('0x1c')](respondWithResult(_0xa91d7e,null))['catch'](handleError(_0xa91d7e,null));};exports[_0x0671('0x1b')]=function(_0x5c618e,_0x44b773){return db['OpenchannelInteraction'][_0x0671('0x37')]({'where':{'id':_0x5c618e['params']['id']}})[_0x0671('0x1c')](handleEntityNotFound(_0x44b773,null))[_0x0671('0x1c')](removeEntity(_0x44b773,null))['catch'](handleError(_0x44b773,null));};exports[_0x0671('0x3a')]=function(_0x5a5487,_0x260047){return db[_0x0671('0x23')][_0x0671('0x3a')]()[_0x0671('0x1c')](respondWithResult(_0x260047,null))['catch'](handleError(_0x260047,null));};exports[_0x0671('0x3b')]=function(_0x3abeaa,_0x5eedd4){return db[_0x0671('0x3c')][_0x0671('0x37')]({'where':{'id':_0x3abeaa[_0x0671('0x2e')]['id']}})[_0x0671('0x1c')](handleEntityNotFound(_0x5eedd4,null))['then'](function(_0x5e4025){if(_0x5e4025){return _0x5e4025[_0x0671('0x3b')](_0x3abeaa[_0x0671('0x39')][_0x0671('0x3d')],_['omit'](_0x3abeaa[_0x0671('0x39')],[_0x0671('0x3d'),'id'])||{});}})[_0x0671('0x1c')](respondWithResult(_0x5eedd4,null))[_0x0671('0x2a')](handleError(_0x5eedd4,null));};exports[_0x0671('0x3e')]=function(_0x38262c,_0x27e55b){var _0x54efac={'raw':![],'where':{}};var _0xce1131={};var _0x1c50d8={'count':0x0,'rows':[]};return db[_0x0671('0x23')][_0x0671('0x3f')]({'where':{'id':_0x38262c[_0x0671('0x2e')]['id']}})[_0x0671('0x1c')](handleEntityNotFound(_0x27e55b,null))[_0x0671('0x1c')](function(_0x27ed1b){if(_0x27ed1b){_0xce1131['model']=_[_0x0671('0x30')](db[_0x0671('0x3c')][_0x0671('0x24')]);_0xce1131[_0x0671('0x2c')]=_[_0x0671('0x30')](_0x38262c['query']);_0xce1131['filters']=_[_0x0671('0x32')](_0xce1131[_0x0671('0x2f')],_0xce1131[_0x0671('0x2c')]);_0x54efac[_0x0671('0x33')]=_['intersection'](_0xce1131[_0x0671('0x2f')],qs['fields'](_0x38262c[_0x0671('0x2c')]['fields']));_0x54efac[_0x0671('0x33')]=_0x54efac[_0x0671('0x33')][_0x0671('0x40')]?_0x54efac[_0x0671('0x33')]:_0xce1131['model'];if(!_0x38262c[_0x0671('0x2c')][_0x0671('0x41')](_0x0671('0x42'))){_0x54efac[_0x0671('0x15')]=qs[_0x0671('0x15')](_0x38262c[_0x0671('0x2c')][_0x0671('0x15')]);_0x54efac[_0x0671('0x14')]=qs['offset'](_0x38262c[_0x0671('0x2c')][_0x0671('0x14')]);}_0x54efac[_0x0671('0x43')]=qs['sort'](_0x38262c[_0x0671('0x2c')]['sort']);_0x54efac['where']=qs[_0x0671('0x31')](_[_0x0671('0x44')](_0x38262c[_0x0671('0x2c')],_0xce1131[_0x0671('0x31')]));_0x54efac[_0x0671('0x45')]['OpenchannelInteractionId']=_0x27ed1b['id'];if(_0x38262c['query']['filter']){_0x54efac[_0x0671('0x45')]=_[_0x0671('0x46')](_0x54efac[_0x0671('0x45')],{'$or':_[_0x0671('0x22')](_0x54efac[_0x0671('0x33')],function(_0x519237){var _0x5a1d11={};_0x5a1d11[_0x519237]={'$like':'%'+_0x38262c[_0x0671('0x2c')]['filter']+'%'};return _0x5a1d11;})});}if(_0x38262c[_0x0671('0x2c')][_0x0671('0x47')]){var _0x13012=_0x38262c[_0x0671('0x2c')][_0x0671('0x47')][_0x0671('0x48')](',');var _0xa3a29c={};_0xa3a29c[_0x13012[0x0]]={'$gte':moment(_0x13012[0x1])[_0x0671('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x54efac['where']=_['merge'](_0x54efac[_0x0671('0x45')],_0xa3a29c);}_0x54efac=_[_0x0671('0x46')]({},_0x54efac,_0x38262c['options']);return db[_0x0671('0x3c')]['count']({'where':_0x54efac['where']})[_0x0671('0x1c')](function(_0x199509){_0x1c50d8[_0x0671('0x4a')]=_0x199509;if(_0x38262c[_0x0671('0x2c')][_0x0671('0x35')]){_0x54efac[_0x0671('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0671('0x27')](_0x54efac);})['then'](function(_0x1e4c09){_0x1c50d8[_0x0671('0x4c')]=_0x1e4c09;return _0x1c50d8;});}})[_0x0671('0x1c')](respondWithFilteredResult(_0x27e55b,_0x54efac))['catch'](handleError(_0x27e55b,null));};exports['addTags']=function(_0x4c0b98,_0xb00ab2){return db['OpenchannelInteraction'][_0x0671('0x37')]({'where':{'id':_0x4c0b98[_0x0671('0x2e')]['id']}})['then'](handleEntityNotFound(_0xb00ab2,null))['then'](function(_0x28d9a7){if(_0x28d9a7){return _0x28d9a7[_0x0671('0x4d')](_0x4c0b98[_0x0671('0x39')]['ids'],_[_0x0671('0x4e')](_0x4c0b98[_0x0671('0x39')],[_0x0671('0x3d'),'id'])||{})[_0x0671('0x4f')](function(){return db[_0x0671('0x50')][_0x0671('0x27')]({'attributes':['id',_0x0671('0x1f'),_0x0671('0x51')],'where':{'id':_0x4c0b98['body'][_0x0671('0x3d')]}});})[_0x0671('0x1c')](function(_0x465640){socket[_0x0671('0x52')]('openchannelInteractionTags:save',{'id':Number(_0x4c0b98[_0x0671('0x2e')]['id']),'tags':_0x465640||[]});return{'id':Number(_0x4c0b98[_0x0671('0x2e')]['id']),'tags':_0x465640||[]};});}})[_0x0671('0x1c')](respondWithResult(_0xb00ab2,null))[_0x0671('0x2a')](handleError(_0xb00ab2,null));};exports[_0x0671('0x53')]=function(_0x2ccaf2,_0x2bd0e7){return db[_0x0671('0x23')][_0x0671('0x37')]({'where':{'id':_0x2ccaf2[_0x0671('0x2e')]['id']}})[_0x0671('0x1c')](handleEntityNotFound(_0x2bd0e7,null))[_0x0671('0x1c')](function(_0x43ecc2){if(_0x43ecc2){return _0x43ecc2[_0x0671('0x53')](_0x2ccaf2['query'][_0x0671('0x3d')]);}})[_0x0671('0x1c')](respondWithStatusCode(_0x2bd0e7,null))[_0x0671('0x2a')](handleError(_0x2bd0e7,null));};exports[_0x0671('0x54')]=function(_0x4cd218,_0x44791b){var _0x2ceff8=moment()['unix']()['toString']();var _0x3271b2=path[_0x0671('0x55')](config['root'],_0x0671('0x56'),'files',_0x0671('0x57'));var _0x142cf6=path['join'](config[_0x0671('0x58')],_0x0671('0x56'),_0x0671('0x59'),'attachments');var _0x11a7ae=path[_0x0671('0x55')](_0x3271b2,_0x2ceff8);var _0x2dc0b4=util[_0x0671('0x49')](_0x0671('0x5a'),_0x4cd218[_0x0671('0x2e')]['id'],_0x2ceff8);var _0x33afe8=path[_0x0671('0x55')](_0x3271b2,_0x2dc0b4);var _0x176579=[];_0x176579['push']({'model':db[_0x0671('0x5b')],'as':_0x0671('0x5b'),'attributes':['id',_0x0671('0x5c')],'raw':!![]});_0x176579['push']({'model':db[_0x0671('0x5d')],'as':'Contact','attributes':['id',_0x0671('0x5e'),'lastName'],'raw':!![]});if(_0x4cd218[_0x0671('0x2c')][_0x0671('0x5f')]){_0x176579[_0x0671('0x60')]({'model':db[_0x0671('0x61')],'as':_0x0671('0x61'),'raw':!![]});}var _0x2466c8=[{'model':db[_0x0671('0x3c')],'as':_0x0671('0x62'),'attributes':['id',_0x0671('0x39'),'createdAt',_0x0671('0x63'),_0x0671('0x64'),_0x0671('0x65')],'include':_0x176579}];_0x2466c8[_0x0671('0x60')]({'model':db[_0x0671('0x66')],'as':_0x0671('0x67'),'attributes':['id',_0x0671('0x1f')]});_0x2466c8[_0x0671('0x60')]({'model':db[_0x0671('0x5b')],'as':_0x0671('0x68'),'attributes':['id',_0x0671('0x5c')]});return db['OpenchannelInteraction'][_0x0671('0x37')]({'where':{'id':_0x4cd218[_0x0671('0x2e')]['id']},'include':_0x2466c8})['then'](handleEntityNotFound(_0x44791b,null))[_0x0671('0x1c')](function(_0x399478){if(_0x399478){var _0x29b7dc=_0x399478[_0x0671('0x69')]({'plain':!![]});fs[_0x0671('0x6a')](_0x11a7ae);var _0x16891f={'channel':'Openchannel','account':_0x29b7dc['Account'][_0x0671('0x1f')],'agent':_0x29b7dc[_0x0671('0x68')]?_0x29b7dc[_0x0671('0x68')][_0x0671('0x5c')]:'N.A.','createdAt':moment(_0x29b7dc[_0x0671('0x6b')])[_0x0671('0x49')](_0x0671('0x6c'))['toString'](),'closedAt':_0x29b7dc[_0x0671('0x6d')]?moment(_0x29b7dc[_0x0671('0x6e')])[_0x0671('0x49')](_0x0671('0x6c'))[_0x0671('0x6f')]():'','disposition':_0x29b7dc[_0x0671('0x70')],'visibility':_0x29b7dc['threadId']?'Public':_0x0671('0x71'),'messages':_(_0x29b7dc[_0x0671('0x62')])['filter']({'secret':![]})[_0x0671('0x22')](function(_0x3a570c){if(_0x3a570c[_0x0671('0x61')]){var _0x43ae2c=path[_0x0671('0x55')](_0x142cf6,_0x3a570c[_0x0671('0x61')]['basename']);if(fs[_0x0671('0x72')](_0x43ae2c)){fs[_0x0671('0x73')](_0x43ae2c)['pipe'](fs[_0x0671('0x74')](path[_0x0671('0x55')](_0x11a7ae,_0x3a570c[_0x0671('0x61')][_0x0671('0x75')])));}}return{'date':moment(_0x3a570c[_0x0671('0x6b')])[_0x0671('0x49')](_0x0671('0x6c'))[_0x0671('0x6f')](),'sender':_0x3a570c[_0x0671('0x63')]===_0x0671('0x76')?_0x3a570c[_0x0671('0x5b')]?_0x3a570c[_0x0671('0x5b')][_0x0671('0x5c')]:'System':_0x3a570c[_0x0671('0x77')]['firstName']+(_0x3a570c[_0x0671('0x77')][_0x0671('0x78')]?'\x20'+_0x3a570c[_0x0671('0x77')][_0x0671('0x78')]:''),'body':_0x3a570c['Attachment']?_0x3a570c[_0x0671('0x61')][_0x0671('0x75')]:_0x3a570c[_0x0671('0x39')],'direction':_0x3a570c['direction']===_0x0671('0x76')?'A':'C','secret':_0x3a570c[_0x0671('0x64')],'read':_0x3a570c[_0x0671('0x65')],'attachment':_0x3a570c['Attachment']};})[_0x0671('0x79')]()};return ejs['renderFile'](path[_0x0671('0x55')](config['root'],'server',_0x0671('0x7a'),_0x0671('0x7b')),{'interaction':_0x16891f})[_0x0671('0x1c')](function(_0x3a61ba){var _0x46cbd4=path[_0x0671('0x55')](_0x11a7ae,'transcript-'+_0x29b7dc['id']+'-'+_0x2ceff8+'.pdf');var _0xc7c91a={'path':_0x46cbd4,'channel':_0x0671('0x7c'),'interactionId':_0x29b7dc['id']};return pdf[_0x0671('0x7d')](_0x3a61ba,_0xc7c91a);})[_0x0671('0x1c')](function(){return new Promise(function(_0x1bfd05,_0x2c7e0a){zipdir(_0x11a7ae,{'saveTo':_0x33afe8},function(_0x27831b,_0x1ccd44){if(_0x27831b)return _0x2c7e0a(_0x27831b);return _0x1bfd05(_0x1ccd44);});})[_0x0671('0x1c')](function(){return new Promise(function(_0xa7b318,_0x5d9ff3){rimraf(_0x11a7ae,function(_0x56ab27){if(_0x56ab27)_0x5d9ff3(_0x56ab27);return _0xa7b318();});});})[_0x0671('0x1c')](function(){return _0x44791b[_0x0671('0x54')](_0x33afe8,_0x2dc0b4,function(_0x327a83){if(_0x327a83){logger[_0x0671('0x1d')](_0x0671('0x7e'),_0x327a83);}else{fs[_0x0671('0x7f')](_0x33afe8);}});});});}else{return _0x44791b[_0x0671('0x11')](0xc8);}})[_0x0671('0x2a')](handleError(_0x44791b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b660632..2bd00eb 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 _0xc03d=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','OpenchannelInteraction','setMaxListeners','save','update','then','setDataValue'];(function(_0x3c4bfa,_0x31d957){var _0x401e2d=function(_0x4e0d42){while(--_0x4e0d42){_0x3c4bfa['push'](_0x3c4bfa['shift']());}};_0x401e2d(++_0x31d957);}(_0xc03d,0x1bc));var _0xdc03=function(_0x219b9b,_0x2ac230){_0x219b9b=_0x219b9b-0x0;var _0x3a13ec=_0xc03d[_0x219b9b];return _0x3a13ec;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xdc03('0x0')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdc03('0x1')](0x0);var events={'afterCreate':_0xdc03('0x2'),'afterUpdate':_0xdc03('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5737c4){return function(_0x2f4892,_0x3d1045,_0x9c633){_0x2f4892['getUsers']({'attributes':['id'],'raw':!![]})[_0xdc03('0x4')](function(_0x5793f1){_0x2f4892[_0xdc03('0x5')](_0xdc03('0x6'),_0x5793f1[_0xdc03('0x7')](function(_0x55bd33){return{'id':_0x55bd33['id']};}));return OpenchannelMessage[_0xdc03('0x8')]({'where':{'OpenchannelInteractionId':_0x2f4892['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdc03('0x4')](function(_0x3bb292){_0x2f4892[_0xdc03('0x5')]('unreadMessages',_0x3bb292[_0xdc03('0x9')]);OpenchannelInteractionEvents[_0xdc03('0xa')](_0x5737c4+':'+_0x2f4892['id'],_0x2f4892);OpenchannelInteractionEvents[_0xdc03('0xa')](_0x5737c4,_0x2f4892);_0x9c633(null);})[_0xdc03('0xb')](_0x9c633(null));};}for(var e in events){if(events[_0xdc03('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xdc03('0xd')](e,emitEvent(event));}}module[_0xdc03('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xeff6=['update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x30ab4a,_0x42f874){var _0x18b5ec=function(_0x15a826){while(--_0x15a826){_0x30ab4a['push'](_0x30ab4a['shift']());}};_0x18b5ec(++_0x42f874);}(_0xeff6,0x1c7));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x6eff('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6eff('0x0'))['db'][_0x6eff('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6eff('0x2')](0x0);var events={'afterCreate':_0x6eff('0x3'),'afterUpdate':_0x6eff('0x4'),'afterDestroy':_0x6eff('0x5')};function emitEvent(_0x1a1763){return function(_0x15ff62,_0x32a6fd,_0x3b5e6b){_0x15ff62[_0x6eff('0x6')]({'attributes':['id'],'raw':!![]})[_0x6eff('0x7')](function(_0x4ce346){_0x15ff62['setDataValue'](_0x6eff('0x8'),_0x4ce346[_0x6eff('0x9')](function(_0x70bd4f){return{'id':_0x70bd4f['id']};}));return OpenchannelMessage[_0x6eff('0xa')]({'where':{'OpenchannelInteractionId':_0x15ff62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6eff('0x7')](function(_0x4c9019){_0x15ff62[_0x6eff('0xb')](_0x6eff('0xc'),_0x4c9019[_0x6eff('0xd')]);OpenchannelInteractionEvents[_0x6eff('0xe')](_0x1a1763+':'+_0x15ff62['id'],_0x15ff62);OpenchannelInteractionEvents[_0x6eff('0xe')](_0x1a1763,_0x15ff62);_0x3b5e6b(null);})['catch'](_0x3b5e6b(null));};}for(var e in events){if(events[_0x6eff('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x6eff('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 87e4509..154c222 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 _0x5bc1=['../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x5bc1,0xb5));var _0x15bc=function(_0x505241,_0x54a73d){_0x505241=_0x505241-0x0;var _0x1a1fcb=_0x5bc1[_0x505241];return _0x1a1fcb;};'use strict';var _=require('lodash');var util=require(_0x15bc('0x0'));var logger=require(_0x15bc('0x1'))(_0x15bc('0x2'));var moment=require(_0x15bc('0x3'));var BPromise=require(_0x15bc('0x4'));var rp=require(_0x15bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bc('0x6'));var attributes=require(_0x15bc('0x7'));module[_0x15bc('0x8')]=function(_0x52766f,_0x109031){return _0x52766f['define'](_0x15bc('0x9'),attributes,{'tableName':_0x15bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15bc('0xb'),'collate':_0x15bc('0xc'),'hooks':{'beforeUpdate':function(_0xb14f9d,_0x246d00,_0x2bc60a){if(_0xb14f9d[_0x15bc('0xd')](_0x15bc('0xe'))){_0xb14f9d[_0x15bc('0xf')]=moment()['format'](_0x15bc('0x10'));}_0x2bc60a(null,_0xb14f9d);}}});}; \ No newline at end of file +var _0x881e=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions','utf8mb4','changed'];(function(_0x54c32f,_0xbb8446){var _0x166a68=function(_0x300560){while(--_0x300560){_0x54c32f['push'](_0x54c32f['shift']());}};_0x166a68(++_0xbb8446);}(_0x881e,0x1c2));var _0xe881=function(_0x2ea486,_0x141dd8){_0x2ea486=_0x2ea486-0x0;var _0x37ebc9=_0x881e[_0x2ea486];return _0x37ebc9;};'use strict';var _=require(_0xe881('0x0'));var util=require('util');var logger=require(_0xe881('0x1'))(_0xe881('0x2'));var moment=require(_0xe881('0x3'));var BPromise=require('bluebird');var rp=require(_0xe881('0x4'));var fs=require('fs');var path=require(_0xe881('0x5'));var rimraf=require(_0xe881('0x6'));var config=require(_0xe881('0x7'));var attributes=require(_0xe881('0x8'));module['exports']=function(_0x4eb49b,_0x29ac02){return _0x4eb49b['define']('OpenchannelInteraction',attributes,{'tableName':_0xe881('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe881('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5df935,_0x7b8405,_0x4db8ff){if(_0x5df935[_0xe881('0xb')]('closed')){_0x5df935[_0xe881('0xc')]=moment()['format'](_0xe881('0xd'));}_0x4db8ff(null,_0x5df935);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ab4be3d..7f75a98 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 _0x6713=['redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter'];(function(_0xc3fabf,_0xe58a97){var _0x319fed=function(_0x174aa0){while(--_0x174aa0){_0xc3fabf['push'](_0xc3fabf['shift']());}};_0x319fed(++_0xe58a97);}(_0x6713,0x143));var _0x3671=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x6713[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0x3671('0x0'));var util=require('util');var moment=require(_0x3671('0x1'));var BPromise=require(_0x3671('0x2'));var rs=require(_0x3671('0x3'));var fs=require('fs');var Redis=require(_0x3671('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3671('0x5'));var logger=require('../../config/logger')(_0x3671('0x6'));var config=require(_0x3671('0x7'));var jayson=require(_0x3671('0x8'));var client=jayson['client'][_0x3671('0x9')]({'port':0x232a});config['redis']=_[_0x3671('0xa')](config['redis'],{'host':_0x3671('0xb'),'port':0x18eb});var socket=require(_0x3671('0xc'))(new Redis(config[_0x3671('0xd')]));require(_0x3671('0xe'))[_0x3671('0xf')](socket);function respondWithRpcPromise(_0x3711de,_0x23d8ca,_0x264ff0){return new BPromise(function(_0x2959de,_0x5bab2a){return client[_0x3671('0x10')](_0x3711de,_0x264ff0)[_0x3671('0x11')](function(_0x2633e1){logger[_0x3671('0x12')](_0x3671('0x13'),_0x23d8ca,'request\x20sent');logger[_0x3671('0x14')](_0x3671('0x15'),_0x23d8ca,_0x3671('0x16'),JSON[_0x3671('0x17')](_0x2633e1));if(_0x2633e1[_0x3671('0x18')]){if(_0x2633e1[_0x3671('0x18')][_0x3671('0x19')]===0x1f4){logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);return _0x5bab2a(_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);}logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x2633e1[_0x3671('0x18')][_0x3671('0x1a')]);return _0x2959de(_0x2633e1['error'][_0x3671('0x1a')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x23d8ca,_0x3671('0x16'));_0x2959de(_0x2633e1['result']['message']);}})[_0x3671('0x1b')](function(_0x22c1f0){logger[_0x3671('0x18')](_0x3671('0x13'),_0x23d8ca,_0x22c1f0);_0x5bab2a(_0x22c1f0);});});}exports[_0x3671('0x1c')]=function(_0x25d28d){var _0x6274c=this;return new Promise(function(_0x586ae2,_0x2fb9f3){return db[_0x3671('0x1d')][_0x3671('0x1e')](_0x25d28d[_0x3671('0x1f')],{'raw':_0x25d28d['options']?_0x25d28d[_0x3671('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')][_0x3671('0x21')]||null:null,'attributes':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')][_0x3671('0x22')]||null:null,'limit':_0x25d28d[_0x3671('0x20')]?_0x25d28d[_0x3671('0x20')]['limit']||null:null})[_0x3671('0x11')](function(_0x36c523){logger[_0x3671('0x12')](_0x3671('0x1c'),_0x25d28d);logger[_0x3671('0x14')](_0x3671('0x1c'),_0x25d28d,JSON[_0x3671('0x17')](_0x36c523));_0x586ae2(_0x36c523);})[_0x3671('0x1b')](function(_0x46af50){logger['error'](_0x3671('0x1c'),_0x46af50[_0x3671('0x1a')],_0x25d28d);_0x2fb9f3(_0x6274c['error'](0x1f4,_0x46af50[_0x3671('0x1a')]));});});};exports[_0x3671('0x23')]=function(_0x30e175){return new Promise(function(_0x3e7348,_0x15d457){return db['OpenchannelInteraction'][_0x3671('0x24')]({'where':_0x30e175[_0x3671('0x20')]?_0x30e175[_0x3671('0x20')][_0x3671('0x21')]||null:null})[_0x3671('0x11')](function(_0x49dc75){if(_0x49dc75){return _0x49dc75[_0x3671('0x25')](_0x30e175[_0x3671('0x1f')]['ids'],_[_0x3671('0x26')](_0x30e175['body'],[_0x3671('0x27'),'id'])||{});}})[_0x3671('0x28')](function(_0x45b9d0){logger[_0x3671('0x12')](_0x3671('0x29'),_0x30e175);logger[_0x3671('0x14')](_0x3671('0x29'),_0x30e175,JSON[_0x3671('0x17')](_0x45b9d0));_0x3e7348(_0x45b9d0);})['catch'](function(_0x3b768c){logger[_0x3671('0x18')](_0x3671('0x29'),_0x3b768c[_0x3671('0x1a')],_0x30e175);_0x15d457(_this[_0x3671('0x18')](0x1f4,_0x3b768c['message']));});});}; \ No newline at end of file +var _0x8b14=['where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw'];(function(_0x35a932,_0x4195a3){var _0x28910b=function(_0x1c406c){while(--_0x1c406c){_0x35a932['push'](_0x35a932['shift']());}};_0x28910b(++_0x4195a3);}(_0x8b14,0xa5));var _0x48b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b14[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x48b1('0x0'));var util=require(_0x48b1('0x1'));var moment=require(_0x48b1('0x2'));var BPromise=require(_0x48b1('0x3'));var rs=require(_0x48b1('0x4'));var fs=require('fs');var Redis=require(_0x48b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x48b1('0x6'));var logger=require('../../config/logger')(_0x48b1('0x7'));var config=require(_0x48b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x48b1('0x9')]({'port':0x232a});config[_0x48b1('0xa')]=_[_0x48b1('0xb')](config[_0x48b1('0xa')],{'host':_0x48b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48b1('0xa')]));require('./openchannelInteraction.socket')[_0x48b1('0xd')](socket);function respondWithRpcPromise(_0x347527,_0xd6aebf,_0x229cb4){return new BPromise(function(_0x262523,_0x486608){return client['request'](_0x347527,_0x229cb4)[_0x48b1('0xe')](function(_0x1ffa65){logger[_0x48b1('0xf')](_0x48b1('0x10'),_0xd6aebf,_0x48b1('0x11'));logger[_0x48b1('0x12')](_0x48b1('0x13'),_0xd6aebf,'request\x20sent',JSON[_0x48b1('0x14')](_0x1ffa65));if(_0x1ffa65[_0x48b1('0x15')]){if(_0x1ffa65[_0x48b1('0x15')][_0x48b1('0x16')]===0x1f4){logger[_0x48b1('0x15')](_0x48b1('0x10'),_0xd6aebf,_0x1ffa65[_0x48b1('0x15')][_0x48b1('0x17')]);return _0x486608(_0x1ffa65[_0x48b1('0x15')][_0x48b1('0x17')]);}logger[_0x48b1('0x15')](_0x48b1('0x10'),_0xd6aebf,_0x1ffa65['error'][_0x48b1('0x17')]);return _0x262523(_0x1ffa65['error']['message']);}else{logger['info'](_0x48b1('0x10'),_0xd6aebf,_0x48b1('0x11'));_0x262523(_0x1ffa65['result'][_0x48b1('0x17')]);}})[_0x48b1('0x18')](function(_0x334c11){logger[_0x48b1('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xd6aebf,_0x334c11);_0x486608(_0x334c11);});});}exports[_0x48b1('0x19')]=function(_0x239d0f){var _0x11246b=this;return new Promise(function(_0x4361a1,_0x23b0a3){return db[_0x48b1('0x1a')][_0x48b1('0x1b')](_0x239d0f['body'],{'raw':_0x239d0f[_0x48b1('0x1c')]?_0x239d0f[_0x48b1('0x1c')][_0x48b1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x239d0f['options']?_0x239d0f[_0x48b1('0x1c')][_0x48b1('0x1e')]||null:null,'attributes':_0x239d0f[_0x48b1('0x1c')]?_0x239d0f[_0x48b1('0x1c')][_0x48b1('0x1f')]||null:null,'limit':_0x239d0f['options']?_0x239d0f[_0x48b1('0x1c')][_0x48b1('0x20')]||null:null})[_0x48b1('0xe')](function(_0x47b43e){logger['info'](_0x48b1('0x19'),_0x239d0f);logger[_0x48b1('0x12')](_0x48b1('0x19'),_0x239d0f,JSON[_0x48b1('0x14')](_0x47b43e));_0x4361a1(_0x47b43e);})[_0x48b1('0x18')](function(_0x20d184){logger[_0x48b1('0x15')](_0x48b1('0x19'),_0x20d184[_0x48b1('0x17')],_0x239d0f);_0x23b0a3(_0x11246b[_0x48b1('0x15')](0x1f4,_0x20d184[_0x48b1('0x17')]));});});};exports[_0x48b1('0x21')]=function(_0x37ba4c){return new Promise(function(_0x50e9c3,_0x27185b){return db[_0x48b1('0x1a')][_0x48b1('0x22')]({'where':_0x37ba4c[_0x48b1('0x1c')]?_0x37ba4c[_0x48b1('0x1c')][_0x48b1('0x1e')]||null:null})['then'](function(_0x53f962){if(_0x53f962){return _0x53f962[_0x48b1('0x23')](_0x37ba4c[_0x48b1('0x24')]['ids'],_[_0x48b1('0x25')](_0x37ba4c[_0x48b1('0x24')],['ids','id'])||{});}})['spread'](function(_0x3e5970){logger[_0x48b1('0xf')](_0x48b1('0x26'),_0x37ba4c);logger[_0x48b1('0x12')]('AddTags',_0x37ba4c,JSON[_0x48b1('0x14')](_0x3e5970));_0x50e9c3(_0x3e5970);})[_0x48b1('0x18')](function(_0x502b64){logger[_0x48b1('0x15')](_0x48b1('0x26'),_0x502b64['message'],_0x37ba4c);_0x27185b(_this[_0x48b1('0x15')](0x1f4,_0x502b64[_0x48b1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 80eb468..91c762d 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 _0xc58a=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','openchannelInteraction:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc58a,0x1b0));var _0xac58=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xc58a[_0x5f3f88];return _0xd08119;};'use strict';var OpenchannelInteractionEvents=require(_0xac58('0x0'));var events=[_0xac58('0x1'),_0xac58('0x2'),_0xac58('0x3')];function createListener(_0x3cb6d1,_0x1ecac5){return function(_0x345185){_0x1ecac5[_0xac58('0x4')](_0x3cb6d1,_0x345185);};}function removeListener(_0x428035,_0x19b792){return function(){OpenchannelInteractionEvents[_0xac58('0x5')](_0x428035,_0x19b792);};}exports[_0xac58('0x6')]=function(_0x428c15){for(var _0x293992=0x0,_0x15cff0=events['length'];_0x293992<_0x15cff0;_0x293992++){var _0x3cc498=events[_0x293992];var _0x598bb9=createListener(_0xac58('0x7')+_0x3cc498,_0x428c15);OpenchannelInteractionEvents['on'](_0x3cc498,_0x598bb9);}}; \ No newline at end of file +var _0x482e=['update','emit','removeListener','length','openchannelInteraction:','save','remove'];(function(_0x56ef1e,_0x3226f2){var _0x19e171=function(_0x5d9414){while(--_0x5d9414){_0x56ef1e['push'](_0x56ef1e['shift']());}};_0x19e171(++_0x3226f2);}(_0x482e,0x12b));var _0xe482=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x482e[_0x5a776b];return _0xbbef59;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xe482('0x0'),_0xe482('0x1'),_0xe482('0x2')];function createListener(_0x39db40,_0x236ca5){return function(_0x1cd8b8){_0x236ca5[_0xe482('0x3')](_0x39db40,_0x1cd8b8);};}function removeListener(_0x3fca17,_0x1ab5d0){return function(){OpenchannelInteractionEvents[_0xe482('0x4')](_0x3fca17,_0x1ab5d0);};}exports['register']=function(_0x4f97a2){for(var _0x9e38ca=0x0,_0x1e7ffa=events[_0xe482('0x5')];_0x9e38ca<_0x1e7ffa;_0x9e38ca++){var _0x18530c=events[_0x9e38ca];var _0x5da1ae=createListener(_0xe482('0x6')+_0x18530c,_0x4f97a2);OpenchannelInteractionEvents['on'](_0x18530c,_0x5da1ae);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5c9a537..3710895 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x44f193,_0x1974b2){var _0x40eeb3=function(_0x1c0da8){while(--_0x1c0da8){_0x44f193['push'](_0x44f193['shift']());}};_0x40eeb3(++_0x1974b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +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(_0x4b11d8,_0x14aba9){var _0x3c09d5=function(_0x40cb5a){while(--_0x40cb5a){_0x4b11d8['push'](_0x4b11d8['shift']());}};_0x3c09d5(++_0x14aba9);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b5bc709..2f46543 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 _0x7497=['TEXT','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x59b930,_0x39aa63){var _0x1e88dd=function(_0x12260a){while(--_0x12260a){_0x59b930['push'](_0x59b930['shift']());}};_0x1e88dd(++_0x39aa63);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module[_0x7749('0x1')]={'body':{'type':Sequelize[_0x7749('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7749('0x3')]('in',_0x7749('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7749('0x5')]},'providerName':{'type':Sequelize[_0x7749('0x6')]},'providerResponse':{'type':Sequelize[_0x7749('0x2')]}}; \ No newline at end of file +var _0x94df=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3863a8,_0x54ea4e){var _0x2e3ce9=function(_0x3d5928){while(--_0x3d5928){_0x3863a8['push'](_0x3863a8['shift']());}};_0x2e3ce9(++_0x54ea4e);}(_0x94df,0xa3));var _0xf94d=function(_0xdb647a,_0x4ee8a5){_0xdb647a=_0xdb647a-0x0;var _0x152504=_0x94df[_0xdb647a];return _0x152504;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'body':{'type':Sequelize[_0xf94d('0x2')](_0xf94d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf94d('0x5')),'defaultValue':_0xf94d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf94d('0x6')]},'providerName':{'type':Sequelize[_0xf94d('0x7')]},'providerResponse':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4348500..515f28e 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 _0x157e=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','includeAll','include','OpenchannelMessage','findAll','rows','show','rawAttributes','merge','find','body','params','describe','../../config/logger','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','openchannel-interactions','rejectMessage','ContactId','motionChannel','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x157e,0x1d4));var _0xe157=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x157e[_0x254076];return _0x21a93e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe157('0x0'));var zipdir=require(_0xe157('0x1'));var jsonpatch=require(_0xe157('0x2'));var rp=require(_0xe157('0x3'));var moment=require('moment');var BPromise=require(_0xe157('0x4'));var Mustache=require(_0xe157('0x5'));var util=require(_0xe157('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe157('0x7'));var _=require(_0xe157('0x8'));var squel=require(_0xe157('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe157('0xa'));var toCsv=require(_0xe157('0xb'));var querystring=require(_0xe157('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe157('0xd'));var qs=require(_0xe157('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe157('0xf'));var licenseUtil=require(_0xe157('0x10'));var db=require(_0xe157('0x11'))['db'];config[_0xe157('0x12')]=_[_0xe157('0x13')](config[_0xe157('0x12')],{'host':_0xe157('0x14'),'port':0x18eb});var socket=require(_0xe157('0x15'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xe157('0x16')](socket);var jayson=require(_0xe157('0x17'));var client=jayson[_0xe157('0x18')][_0xe157('0x19')]({'port':0x232c});var client9002=jayson[_0xe157('0x18')][_0xe157('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a7a,_0x4c3e66,_0x449b44,_0x559d9c){return new BPromise(function(_0x369ad5,_0x4b81a7){var _0x1f1012=_0x559d9c||client;return _0x1f1012[_0xe157('0x1a')](_0x4a6a7a,_0x449b44)[_0xe157('0x1b')](function(_0x583b2b){logger['info'](_0xe157('0x1c'),_0x4c3e66,'request\x20sent');logger['debug'](_0xe157('0x1d'),_0x4c3e66,'request\x20sent',JSON['stringify'](_0x583b2b));if(_0x583b2b['error']){if(_0x583b2b[_0xe157('0x1e')][_0xe157('0x1f')]===0x1f4){logger[_0xe157('0x1e')](_0xe157('0x1c'),_0x4c3e66,_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);return _0x4b81a7(_0x583b2b['error'][_0xe157('0x20')]);}logger[_0xe157('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4c3e66,_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);return _0x369ad5(_0x583b2b[_0xe157('0x1e')][_0xe157('0x20')]);}else{logger[_0xe157('0x21')](_0xe157('0x1c'),_0x4c3e66,_0xe157('0x22'));_0x369ad5(_0x583b2b['result']['message']);}})[_0xe157('0x23')](function(_0x132ac6){logger['error'](_0xe157('0x1c'),_0x4c3e66,_0x132ac6);_0x4b81a7(_0x132ac6);});});}function respondWithStatusCode(_0x47d2b8,_0x4ac673){_0x4ac673=_0x4ac673||0xcc;return function(_0x45c2f2){if(_0x45c2f2){return _0x47d2b8[_0xe157('0x24')](_0x4ac673);}return _0x47d2b8[_0xe157('0x25')](_0x4ac673)[_0xe157('0x26')]();};}function respondWithResult(_0x6b87b3,_0x5579e4){_0x5579e4=_0x5579e4||0xc8;return function(_0x545c03){if(_0x545c03){return _0x6b87b3[_0xe157('0x25')](_0x5579e4)[_0xe157('0x27')](_0x545c03);}};}function respondWithFilteredResult(_0x2b239a,_0x5ec897){return function(_0x19b520){if(_0x19b520){var _0x2abe50=typeof _0x5ec897[_0xe157('0x28')]===_0xe157('0x29')&&typeof _0x5ec897['limit']===_0xe157('0x29');var _0x6a068b=_0x19b520[_0xe157('0x2a')];var _0x23cd98=_0x2abe50?0x0:_0x5ec897[_0xe157('0x28')];var _0x4ab756=_0x2abe50?_0x19b520[_0xe157('0x2a')]:_0x5ec897[_0xe157('0x28')]+_0x5ec897[_0xe157('0x2b')];var _0x409649;if(_0x4ab756>=_0x6a068b){_0x4ab756=_0x6a068b;_0x409649=0xc8;}else{_0x409649=0xce;}_0x2b239a['status'](_0x409649);return _0x2b239a[_0xe157('0x2c')](_0xe157('0x2d'),_0x23cd98+'-'+_0x4ab756+'/'+_0x6a068b)[_0xe157('0x27')](_0x19b520);}return null;};}function patchUpdates(_0x103787){return function(_0x32c9fc){try{jsonpatch[_0xe157('0x2e')](_0x32c9fc,_0x103787,!![]);}catch(_0xb3748c){return BPromise[_0xe157('0x2f')](_0xb3748c);}return _0x32c9fc['save']();};}function saveUpdates(_0x59de84,_0x47a781){return function(_0x58fac0){if(_0x58fac0){return _0x58fac0[_0xe157('0x30')](_0x59de84)['then'](function(_0x582bc6){return _0x582bc6;});}return null;};}function removeEntity(_0x114b3f,_0x3c7997){return function(_0x1ab7b1){if(_0x1ab7b1){return _0x1ab7b1[_0xe157('0x31')]()[_0xe157('0x1b')](function(){_0x114b3f[_0xe157('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc612b8,_0x33f802){return function(_0x38dd10){if(!_0x38dd10){_0xc612b8['sendStatus'](0x194);}return _0x38dd10;};}function handleError(_0x5900e3,_0x4bcd3b){_0x4bcd3b=_0x4bcd3b||0x1f4;return function(_0x5c8367){logger[_0xe157('0x1e')](_0x5c8367[_0xe157('0x32')]);if(_0x5c8367[_0xe157('0x33')]){delete _0x5c8367[_0xe157('0x33')];}_0x5900e3[_0xe157('0x25')](_0x4bcd3b)[_0xe157('0x34')](_0x5c8367);};}exports[_0xe157('0x35')]=function(_0xcc4f5b,_0x30af7a){var _0x44d1b1={},_0x19f1f5={},_0x16449f={'count':0x0,'rows':[]};var _0x253252=_[_0xe157('0x36')](db['OpenchannelMessage']['rawAttributes'],function(_0x252d3a){return{'name':_0x252d3a[_0xe157('0x37')],'type':_0x252d3a['type'][_0xe157('0x38')]};});_0x19f1f5[_0xe157('0x39')]=_['map'](_0x253252,_0xe157('0x33'));_0x19f1f5['query']=_[_0xe157('0x3a')](_0xcc4f5b[_0xe157('0x3b')]);_0x19f1f5[_0xe157('0x3c')]=_[_0xe157('0x3d')](_0x19f1f5['model'],_0x19f1f5[_0xe157('0x3b')]);_0x44d1b1[_0xe157('0x3e')]=_['intersection'](_0x19f1f5['model'],qs[_0xe157('0x3f')](_0xcc4f5b[_0xe157('0x3b')]['fields']));_0x44d1b1[_0xe157('0x3e')]=_0x44d1b1['attributes'][_0xe157('0x40')]?_0x44d1b1[_0xe157('0x3e')]:_0x19f1f5['model'];if(!_0xcc4f5b['query'][_0xe157('0x41')]('nolimit')){_0x44d1b1[_0xe157('0x2b')]=qs[_0xe157('0x2b')](_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x2b')]);_0x44d1b1[_0xe157('0x28')]=qs[_0xe157('0x28')](_0xcc4f5b['query']['offset']);}_0x44d1b1[_0xe157('0x42')]=qs[_0xe157('0x43')](_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x43')]);_0x44d1b1[_0xe157('0x44')]=qs[_0xe157('0x3c')](_[_0xe157('0x45')](_0xcc4f5b[_0xe157('0x3b')],_0x19f1f5[_0xe157('0x3c')]),_0x253252);if(_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x46')]){_0x44d1b1[_0xe157('0x44')]=_['merge'](_0x44d1b1[_0xe157('0x44')],{'$or':_[_0xe157('0x36')](_0x253252,function(_0x2ffef4){if(_0x2ffef4[_0xe157('0x47')]!=='VIRTUAL'){var _0x5da59e={};_0x5da59e[_0x2ffef4[_0xe157('0x33')]]={'$like':'%'+_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x46')]+'%'};return _0x5da59e;}})});}_0x44d1b1=_['merge']({},_0x44d1b1,_0xcc4f5b[_0xe157('0x48')]);var _0x46e744={'where':_0x44d1b1[_0xe157('0x44')]};return db['OpenchannelMessage'][_0xe157('0x2a')](_0x46e744)[_0xe157('0x1b')](function(_0x24afb9){_0x16449f[_0xe157('0x2a')]=_0x24afb9;if(_0xcc4f5b[_0xe157('0x3b')][_0xe157('0x49')]){_0x44d1b1[_0xe157('0x4a')]=[{'all':!![]}];}return db[_0xe157('0x4b')][_0xe157('0x4c')](_0x44d1b1);})['then'](function(_0x25d1d5){_0x16449f[_0xe157('0x4d')]=_0x25d1d5;return _0x16449f;})['then'](respondWithFilteredResult(_0x30af7a,_0x44d1b1))[_0xe157('0x23')](handleError(_0x30af7a,null));};exports[_0xe157('0x4e')]=function(_0x214aa7,_0xf15899){var _0x595434={'raw':!![],'where':{'id':_0x214aa7['params']['id']}},_0x44043c={};_0x44043c[_0xe157('0x39')]=_[_0xe157('0x3a')](db[_0xe157('0x4b')][_0xe157('0x4f')]);_0x44043c[_0xe157('0x3b')]=_[_0xe157('0x3a')](_0x214aa7[_0xe157('0x3b')]);_0x44043c['filters']=_[_0xe157('0x3d')](_0x44043c[_0xe157('0x39')],_0x44043c[_0xe157('0x3b')]);_0x595434[_0xe157('0x3e')]=_[_0xe157('0x3d')](_0x44043c[_0xe157('0x39')],qs[_0xe157('0x3f')](_0x214aa7[_0xe157('0x3b')][_0xe157('0x3f')]));_0x595434[_0xe157('0x3e')]=_0x595434[_0xe157('0x3e')][_0xe157('0x40')]?_0x595434[_0xe157('0x3e')]:_0x44043c[_0xe157('0x39')];if(_0x214aa7[_0xe157('0x3b')][_0xe157('0x49')]){_0x595434['include']=[{'all':!![]}];}_0x595434=_[_0xe157('0x50')]({},_0x595434,_0x214aa7[_0xe157('0x48')]);return db[_0xe157('0x4b')][_0xe157('0x51')](_0x595434)[_0xe157('0x1b')](handleEntityNotFound(_0xf15899,null))[_0xe157('0x1b')](respondWithResult(_0xf15899,null))[_0xe157('0x23')](handleError(_0xf15899,null));};exports['create']=function(_0x48fc50,_0x36e6eb){return db['OpenchannelMessage']['create'](_0x48fc50[_0xe157('0x52')],{})[_0xe157('0x1b')](respondWithResult(_0x36e6eb,0xc9))[_0xe157('0x23')](handleError(_0x36e6eb,null));};exports[_0xe157('0x30')]=function(_0x3d14cd,_0x26945c){if(_0x3d14cd[_0xe157('0x52')]['id']){delete _0x3d14cd['body']['id'];}return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x3d14cd[_0xe157('0x53')]['id']}})[_0xe157('0x1b')](handleEntityNotFound(_0x26945c,null))[_0xe157('0x1b')](saveUpdates(_0x3d14cd[_0xe157('0x52')],null))[_0xe157('0x1b')](respondWithResult(_0x26945c,null))[_0xe157('0x23')](handleError(_0x26945c,null));};exports[_0xe157('0x31')]=function(_0x3d7a8b,_0x591a74){return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x3d7a8b['params']['id']}})[_0xe157('0x1b')](handleEntityNotFound(_0x591a74,null))['then'](removeEntity(_0x591a74,null))[_0xe157('0x23')](handleError(_0x591a74,null));};exports[_0xe157('0x54')]=function(_0x13eda8,_0x522c48){return db[_0xe157('0x4b')][_0xe157('0x54')]()['then'](respondWithResult(_0x522c48,null))[_0xe157('0x23')](handleError(_0x522c48,null));};var interaction_log=require(_0xe157('0x55'))('openchannel-interactions');exports[_0xe157('0x56')]=function(_0x1cf0ac,_0x2a3a53,_0x19905a){var _0x18516d={'agent':{},'channel':_0xe157('0x57')};if(_0x1cf0ac[_0xe157('0x52')]['id']){delete _0x1cf0ac[_0xe157('0x52')]['id'];}_0x1cf0ac[_0xe157('0x52')][_0xe157('0x58')]=!![];_0x1cf0ac[_0xe157('0x52')]['readAt']=moment()[_0xe157('0x59')](_0xe157('0x5a'));_0x1cf0ac['body'][_0xe157('0x5b')]=_0x1cf0ac[_0xe157('0x52')]['UserId']||_0x1cf0ac['user']['id'];_0x18516d[_0xe157('0x5c')]['id']=_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')];return db[_0xe157('0x4b')][_0xe157('0x51')]({'where':{'id':_0x1cf0ac[_0xe157('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a3a53,null))[_0xe157('0x1b')](saveUpdates(_0x1cf0ac[_0xe157('0x52')],null))[_0xe157('0x1b')](function(_0x4a026a){if(_0x4a026a){_0x18516d['message']=_0x4a026a['get']({'plain':!![]});return db[_0xe157('0x5d')][_0xe157('0x51')]({'where':{'id':_0x4a026a[_0xe157('0x5e')]}});}return null;})[_0xe157('0x1b')](handleEntityNotFound(_0x2a3a53,null))[_0xe157('0x1b')](function(_0x15b80c){if(_0x15b80c){return _0x15b80c[_0xe157('0x30')]({'UserId':_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')],'read1stAt':_[_0xe157('0x5f')](_0x15b80c[_0xe157('0x60')])?moment()[_0xe157('0x59')](_0xe157('0x5a')):undefined});}return null;})['then'](function(_0x18ae4b){if(_0x18ae4b){_0x18516d[_0xe157('0x61')]=_0x18ae4b[_0xe157('0x62')]({'plain':!![]});interaction_log['info'](_0xe157('0x63'),_0x1cf0ac[_0xe157('0x64')]['id'],_0x1cf0ac[_0xe157('0x64')]['name'],_0x1cf0ac[_0xe157('0x64')][_0xe157('0x65')],_0x18516d[_0xe157('0x61')]['id'],_0x1cf0ac[_0xe157('0x52')]?JSON[_0xe157('0x66')](_0x1cf0ac['body']):_0xe157('0x67'));return respondWithRpcPromise(_0xe157('0x68'),_0xe157('0x69'),_0x18516d);}return null;})[_0xe157('0x1b')](function(_0x3c756f){var _0x48a71d=_0xe157('0x6a')+_0x3c756f[_0xe157('0x20')]['ContactId'];return db[_0xe157('0x6b')][_0xe157('0x3b')](_0x48a71d,{'type':db[_0xe157('0x6c')][_0xe157('0x6d')][_0xe157('0x6e')],'raw':!![]})[_0xe157('0x1b')](function(_0x430f48){return _0x430f48;});})[_0xe157('0x1b')](function(_0x6fe816){if(_0x6fe816){_0x18516d['message'][_0xe157('0x6f')]=_0x6fe816[0x0];if(!_0x1cf0ac[_0xe157('0x52')][_0xe157('0x5b')])return;return db['User'][_0xe157('0x51')]({'where':{'id':_0x1cf0ac['body'][_0xe157('0x5b')],'role':_0xe157('0x5c')},'attributes':['id',_0xe157('0x33'),_0xe157('0x70'),_0xe157('0x71'),_0xe157('0x72')],'raw':!![]});}return null;})[_0xe157('0x1b')](function(_0x1c536a){if(!_0x1c536a)return null;_0x18516d['message'][_0xe157('0x5c')]=_0x1c536a;return _0x18516d;})[_0xe157('0x1b')](function(_0x11eedc){if(_0x11eedc){if(_0x1cf0ac[_0xe157('0x52')][_0xe157('0x73')]){_0x18516d[_0xe157('0x20')][_0xe157('0x74')]=util[_0xe157('0x59')](_0xe157('0x75'),_0x1cf0ac['user']['name']);_0x18516d['message'][_0xe157('0x76')]=_0x18516d[_0xe157('0x76')];_0x18516d[_0xe157('0x20')]['motionChannel']=_0x18516d['channel'];_0x18516d[_0xe157('0x20')]['event']='accept';return respondWithRpcPromise(_0xe157('0x77'),_0xe157('0x77'),{'event':'acceptmessage','message':_0x18516d[_0xe157('0x20')]},client9002)[_0xe157('0x1b')](function(){return _0x18516d;});}return _0x18516d;}return null;})[_0xe157('0x1b')](respondWithResult(_0x2a3a53,null))[_0xe157('0x23')](handleError(_0x2a3a53,null));};var interaction_log=require('../../config/logger')(_0xe157('0x78'));exports['reject']=function(_0x176064,_0x13f283,_0x5aa21c){var _0x4cd4ce={'agent':{},'channel':_0xe157('0x57')};if(_0x176064[_0xe157('0x52')]['id']){delete _0x176064[_0xe157('0x52')]['id'];}_0x176064['body']['UserId']=_0x176064[_0xe157('0x52')][_0xe157('0x5b')]||_0x176064[_0xe157('0x64')]['id'];_0x4cd4ce['agent']['id']=_0x176064[_0xe157('0x52')][_0xe157('0x5b')];return db['OpenchannelMessage'][_0xe157('0x51')]({'where':{'id':_0x176064[_0xe157('0x53')]['id'],'UserId':null}})[_0xe157('0x1b')](handleEntityNotFound(_0x13f283,null))[_0xe157('0x1b')](function(_0x491b53){if(_0x491b53){_0x4cd4ce[_0xe157('0x20')]=_0x491b53[_0xe157('0x62')]({'plain':!![]});return db[_0xe157('0x5d')][_0xe157('0x51')]({'where':{'id':_0x491b53[_0xe157('0x5e')]}});}return null;})[_0xe157('0x1b')](handleEntityNotFound(_0x13f283,null))['then'](function(_0x42b586){if(_0x42b586){_0x4cd4ce['interaction']=_0x42b586[_0xe157('0x62')]({'plain':!![]});interaction_log[_0xe157('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x176064[_0xe157('0x64')]['id'],_0x176064[_0xe157('0x64')][_0xe157('0x33')],_0x176064[_0xe157('0x64')][_0xe157('0x65')],_0x4cd4ce[_0xe157('0x61')]['id'],_0x176064[_0xe157('0x52')]?JSON[_0xe157('0x66')](_0x176064[_0xe157('0x52')]):_0xe157('0x67'));return respondWithRpcPromise('RejectMessage',_0xe157('0x79'),_0x4cd4ce);}return null;})[_0xe157('0x1b')](function(_0x142261){var _0x41f9c1=_0xe157('0x6a')+_0x142261[_0xe157('0x20')][_0xe157('0x7a')];return db[_0xe157('0x6b')][_0xe157('0x3b')](_0x41f9c1,{'type':db[_0xe157('0x6c')][_0xe157('0x6d')][_0xe157('0x6e')],'raw':!![]})['then'](function(_0x4ec497){return _0x4ec497;});})[_0xe157('0x1b')](function(_0x3e850e){if(_0x3e850e){_0x4cd4ce[_0xe157('0x20')][_0xe157('0x6f')]=_0x3e850e[0x0];if(!_0x176064['body'][_0xe157('0x5b')])return;return db['User'][_0xe157('0x51')]({'where':{'id':_0x176064[_0xe157('0x52')][_0xe157('0x5b')],'role':'agent'},'attributes':['id',_0xe157('0x33'),_0xe157('0x70'),'email',_0xe157('0x72')],'raw':!![]});}return null;})[_0xe157('0x1b')](function(_0x16422d){if(!_0x16422d)return null;_0x4cd4ce['message']['agent']=_0x16422d;return _0x4cd4ce;})[_0xe157('0x1b')](function(_0x54f1ef){if(_0x54f1ef){_0x54f1ef[_0xe157('0x20')][_0xe157('0x74')]=util[_0xe157('0x59')](_0xe157('0x75'),_0x176064[_0xe157('0x64')][_0xe157('0x33')]);_0x54f1ef[_0xe157('0x20')][_0xe157('0x76')]=_0x4cd4ce['channel'];_0x54f1ef[_0xe157('0x20')][_0xe157('0x7b')]=_0x4cd4ce[_0xe157('0x76')];_0x54f1ef[_0xe157('0x20')][_0xe157('0x7c')]=_0xe157('0x2f');respondWithRpcPromise(_0xe157('0x77'),'EventManager',{'event':_0xe157('0x7d'),'message':_0x54f1ef['message']},client9002);return _0x4cd4ce;}return null;})[_0xe157('0x1b')](respondWithResult(_0x13f283,null))[_0xe157('0x23')](handleError(_0x13f283,null));}; \ No newline at end of file +var _0x6693=['end','status','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','map','OpenchannelMessage','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','params','rawAttributes','fields','options','create','body','find','describe','../../config/logger','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','message','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','internal','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','result','catch','sendStatus'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x6693,0x1e9));var _0x3669=function(_0x8bfb0b,_0x6e1c61){_0x8bfb0b=_0x8bfb0b-0x0;var _0x33241d=_0x6693[_0x8bfb0b];return _0x33241d;};'use strict';var emlformat=require(_0x3669('0x0'));var rimraf=require(_0x3669('0x1'));var zipdir=require(_0x3669('0x2'));var jsonpatch=require(_0x3669('0x3'));var rp=require(_0x3669('0x4'));var moment=require(_0x3669('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3669('0x6'));var util=require(_0x3669('0x7'));var path=require(_0x3669('0x8'));var sox=require(_0x3669('0x9'));var csv=require(_0x3669('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3669('0xb'));var crypto=require('crypto');var jsforce=require(_0x3669('0xc'));var deskjs=require(_0x3669('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3669('0xe'));var Papa=require('papaparse');var Redis=require(_0x3669('0xf'));var authService=require(_0x3669('0x10'));var qs=require(_0x3669('0x11'));var as=require(_0x3669('0x12'));var hardwareService=require(_0x3669('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3669('0x14'));var config=require(_0x3669('0x15'));var licenseUtil=require(_0x3669('0x16'));var db=require(_0x3669('0x17'))['db'];config[_0x3669('0x18')]=_[_0x3669('0x19')](config[_0x3669('0x18')],{'host':_0x3669('0x1a'),'port':0x18eb});var socket=require(_0x3669('0x1b'))(new Redis(config['redis']));require(_0x3669('0x1c'))['register'](socket);var jayson=require(_0x3669('0x1d'));var client=jayson[_0x3669('0x1e')][_0x3669('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x3669('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4c09c1,_0x1b32bf,_0x1ec9d1,_0x42f902){return new BPromise(function(_0x4e97f8,_0x4f8c47){var _0x71dbf0=_0x42f902||client;return _0x71dbf0[_0x3669('0x20')](_0x4c09c1,_0x1ec9d1)[_0x3669('0x21')](function(_0x2a7500){logger[_0x3669('0x22')](_0x3669('0x23'),_0x1b32bf,_0x3669('0x24'));logger[_0x3669('0x25')](_0x3669('0x26'),_0x1b32bf,'request\x20sent',JSON['stringify'](_0x2a7500));if(_0x2a7500['error']){if(_0x2a7500[_0x3669('0x27')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1b32bf,_0x2a7500['error']['message']);return _0x4f8c47(_0x2a7500[_0x3669('0x27')]['message']);}logger[_0x3669('0x27')](_0x3669('0x23'),_0x1b32bf,_0x2a7500['error']['message']);return _0x4e97f8(_0x2a7500[_0x3669('0x27')]['message']);}else{logger[_0x3669('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b32bf,'request\x20sent');_0x4e97f8(_0x2a7500[_0x3669('0x28')]['message']);}})[_0x3669('0x29')](function(_0x4ebad3){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1b32bf,_0x4ebad3);_0x4f8c47(_0x4ebad3);});});}function respondWithStatusCode(_0x1ed8f9,_0xccd525){_0xccd525=_0xccd525||0xcc;return function(_0x46357b){if(_0x46357b){return _0x1ed8f9[_0x3669('0x2a')](_0xccd525);}return _0x1ed8f9['status'](_0xccd525)[_0x3669('0x2b')]();};}function respondWithResult(_0x389ee4,_0x1e45ff){_0x1e45ff=_0x1e45ff||0xc8;return function(_0x3bd907){if(_0x3bd907){return _0x389ee4[_0x3669('0x2c')](_0x1e45ff)['json'](_0x3bd907);}};}function respondWithFilteredResult(_0x20809a,_0x47616b){return function(_0x3d2c54){if(_0x3d2c54){var _0x2d0862=typeof _0x47616b['offset']===_0x3669('0x2d')&&typeof _0x47616b[_0x3669('0x2e')]===_0x3669('0x2d');var _0x998d75=_0x3d2c54[_0x3669('0x2f')];var _0xa5c172=_0x2d0862?0x0:_0x47616b['offset'];var _0x2f9b21=_0x2d0862?_0x3d2c54['count']:_0x47616b[_0x3669('0x30')]+_0x47616b['limit'];var _0x7dc0d4;if(_0x2f9b21>=_0x998d75){_0x2f9b21=_0x998d75;_0x7dc0d4=0xc8;}else{_0x7dc0d4=0xce;}_0x20809a[_0x3669('0x2c')](_0x7dc0d4);return _0x20809a[_0x3669('0x31')](_0x3669('0x32'),_0xa5c172+'-'+_0x2f9b21+'/'+_0x998d75)['json'](_0x3d2c54);}return null;};}function patchUpdates(_0x1ff014){return function(_0x15c7d8){try{jsonpatch[_0x3669('0x33')](_0x15c7d8,_0x1ff014,!![]);}catch(_0x5232c8){return BPromise['reject'](_0x5232c8);}return _0x15c7d8[_0x3669('0x34')]();};}function saveUpdates(_0x42a59a,_0x3ebcc1){return function(_0x3ec99c){if(_0x3ec99c){return _0x3ec99c[_0x3669('0x35')](_0x42a59a)[_0x3669('0x21')](function(_0x3d6699){return _0x3d6699;});}return null;};}function removeEntity(_0x14e240,_0x522b6d){return function(_0x157bb9){if(_0x157bb9){return _0x157bb9[_0x3669('0x36')]()['then'](function(){_0x14e240[_0x3669('0x2c')](0xcc)[_0x3669('0x2b')]();});}};}function handleEntityNotFound(_0x34674e,_0x2be540){return function(_0x1b768d){if(!_0x1b768d){_0x34674e['sendStatus'](0x194);}return _0x1b768d;};}function handleError(_0x35ad9b,_0x317f8b){_0x317f8b=_0x317f8b||0x1f4;return function(_0x1dd010){logger[_0x3669('0x27')](_0x1dd010[_0x3669('0x37')]);if(_0x1dd010[_0x3669('0x38')]){delete _0x1dd010[_0x3669('0x38')];}_0x35ad9b[_0x3669('0x2c')](_0x317f8b)['send'](_0x1dd010);};}exports['index']=function(_0x326e09,_0x274fac){var _0x1a6ced={},_0x1ea7e9={},_0x2c8583={'count':0x0,'rows':[]};var _0x528405=_[_0x3669('0x39')](db[_0x3669('0x3a')]['rawAttributes'],function(_0x419b2e){return{'name':_0x419b2e[_0x3669('0x3b')],'type':_0x419b2e['type'][_0x3669('0x3c')]};});_0x1ea7e9[_0x3669('0x3d')]=_[_0x3669('0x39')](_0x528405,_0x3669('0x38'));_0x1ea7e9[_0x3669('0x3e')]=_[_0x3669('0x3f')](_0x326e09[_0x3669('0x3e')]);_0x1ea7e9[_0x3669('0x40')]=_[_0x3669('0x41')](_0x1ea7e9[_0x3669('0x3d')],_0x1ea7e9[_0x3669('0x3e')]);_0x1a6ced['attributes']=_[_0x3669('0x41')](_0x1ea7e9[_0x3669('0x3d')],qs['fields'](_0x326e09[_0x3669('0x3e')]['fields']));_0x1a6ced[_0x3669('0x42')]=_0x1a6ced['attributes'][_0x3669('0x43')]?_0x1a6ced[_0x3669('0x42')]:_0x1ea7e9[_0x3669('0x3d')];if(!_0x326e09[_0x3669('0x3e')][_0x3669('0x44')](_0x3669('0x45'))){_0x1a6ced[_0x3669('0x2e')]=qs[_0x3669('0x2e')](_0x326e09['query']['limit']);_0x1a6ced['offset']=qs[_0x3669('0x30')](_0x326e09[_0x3669('0x3e')][_0x3669('0x30')]);}_0x1a6ced[_0x3669('0x46')]=qs[_0x3669('0x47')](_0x326e09[_0x3669('0x3e')]['sort']);_0x1a6ced[_0x3669('0x48')]=qs[_0x3669('0x40')](_[_0x3669('0x49')](_0x326e09[_0x3669('0x3e')],_0x1ea7e9['filters']),_0x528405);if(_0x326e09[_0x3669('0x3e')][_0x3669('0x4a')]){_0x1a6ced[_0x3669('0x48')]=_[_0x3669('0x4b')](_0x1a6ced[_0x3669('0x48')],{'$or':_[_0x3669('0x39')](_0x528405,function(_0x229c23){if(_0x229c23[_0x3669('0x4c')]!==_0x3669('0x4d')){var _0x2cab4c={};_0x2cab4c[_0x229c23[_0x3669('0x38')]]={'$like':'%'+_0x326e09[_0x3669('0x3e')][_0x3669('0x4a')]+'%'};return _0x2cab4c;}})});}_0x1a6ced=_[_0x3669('0x4b')]({},_0x1a6ced,_0x326e09['options']);var _0x56a2aa={'where':_0x1a6ced[_0x3669('0x48')]};return db[_0x3669('0x3a')][_0x3669('0x2f')](_0x56a2aa)[_0x3669('0x21')](function(_0x51d063){_0x2c8583[_0x3669('0x2f')]=_0x51d063;if(_0x326e09['query'][_0x3669('0x4e')]){_0x1a6ced[_0x3669('0x4f')]=[{'all':!![]}];}return db[_0x3669('0x3a')][_0x3669('0x50')](_0x1a6ced);})[_0x3669('0x21')](function(_0x3b9235){_0x2c8583['rows']=_0x3b9235;return _0x2c8583;})[_0x3669('0x21')](respondWithFilteredResult(_0x274fac,_0x1a6ced))[_0x3669('0x29')](handleError(_0x274fac,null));};exports['show']=function(_0x3d7f7d,_0x42080f){var _0x3829bc={'raw':!![],'where':{'id':_0x3d7f7d[_0x3669('0x51')]['id']}},_0x2376a5={};_0x2376a5[_0x3669('0x3d')]=_[_0x3669('0x3f')](db[_0x3669('0x3a')][_0x3669('0x52')]);_0x2376a5[_0x3669('0x3e')]=_['keys'](_0x3d7f7d[_0x3669('0x3e')]);_0x2376a5[_0x3669('0x40')]=_[_0x3669('0x41')](_0x2376a5[_0x3669('0x3d')],_0x2376a5['query']);_0x3829bc[_0x3669('0x42')]=_[_0x3669('0x41')](_0x2376a5[_0x3669('0x3d')],qs[_0x3669('0x53')](_0x3d7f7d[_0x3669('0x3e')][_0x3669('0x53')]));_0x3829bc[_0x3669('0x42')]=_0x3829bc['attributes'][_0x3669('0x43')]?_0x3829bc['attributes']:_0x2376a5[_0x3669('0x3d')];if(_0x3d7f7d[_0x3669('0x3e')][_0x3669('0x4e')]){_0x3829bc[_0x3669('0x4f')]=[{'all':!![]}];}_0x3829bc=_[_0x3669('0x4b')]({},_0x3829bc,_0x3d7f7d[_0x3669('0x54')]);return db[_0x3669('0x3a')]['find'](_0x3829bc)[_0x3669('0x21')](handleEntityNotFound(_0x42080f,null))['then'](respondWithResult(_0x42080f,null))[_0x3669('0x29')](handleError(_0x42080f,null));};exports[_0x3669('0x55')]=function(_0x46fd04,_0x5df5e5){return db[_0x3669('0x3a')][_0x3669('0x55')](_0x46fd04[_0x3669('0x56')],{})[_0x3669('0x21')](respondWithResult(_0x5df5e5,0xc9))[_0x3669('0x29')](handleError(_0x5df5e5,null));};exports[_0x3669('0x35')]=function(_0x44d077,_0xedcfbf){if(_0x44d077['body']['id']){delete _0x44d077['body']['id'];}return db['OpenchannelMessage'][_0x3669('0x57')]({'where':{'id':_0x44d077[_0x3669('0x51')]['id']}})['then'](handleEntityNotFound(_0xedcfbf,null))[_0x3669('0x21')](saveUpdates(_0x44d077[_0x3669('0x56')],null))[_0x3669('0x21')](respondWithResult(_0xedcfbf,null))[_0x3669('0x29')](handleError(_0xedcfbf,null));};exports[_0x3669('0x36')]=function(_0x329bb0,_0x46d522){return db[_0x3669('0x3a')]['find']({'where':{'id':_0x329bb0['params']['id']}})[_0x3669('0x21')](handleEntityNotFound(_0x46d522,null))[_0x3669('0x21')](removeEntity(_0x46d522,null))[_0x3669('0x29')](handleError(_0x46d522,null));};exports[_0x3669('0x58')]=function(_0x5b0a7a,_0x565767){return db[_0x3669('0x3a')][_0x3669('0x58')]()['then'](respondWithResult(_0x565767,null))['catch'](handleError(_0x565767,null));};var interaction_log=require(_0x3669('0x59'))(_0x3669('0x5a'));exports['accept']=function(_0x1b2494,_0x5473d2,_0x39e7fa){var _0x2b8dd2={'agent':{},'channel':_0x3669('0x5b')};if(_0x1b2494['body']['id']){delete _0x1b2494[_0x3669('0x56')]['id'];}_0x1b2494[_0x3669('0x56')][_0x3669('0x5c')]=!![];_0x1b2494[_0x3669('0x56')]['readAt']=moment()[_0x3669('0x5d')](_0x3669('0x5e'));_0x1b2494[_0x3669('0x56')][_0x3669('0x5f')]=_0x1b2494[_0x3669('0x56')]['UserId']||_0x1b2494[_0x3669('0x60')]['id'];_0x2b8dd2[_0x3669('0x61')]['id']=_0x1b2494[_0x3669('0x56')]['UserId'];return db['OpenchannelMessage'][_0x3669('0x57')]({'where':{'id':_0x1b2494[_0x3669('0x51')]['id'],'UserId':null}})[_0x3669('0x21')](handleEntityNotFound(_0x5473d2,null))[_0x3669('0x21')](saveUpdates(_0x1b2494[_0x3669('0x56')],null))[_0x3669('0x21')](function(_0x5cc2d5){if(_0x5cc2d5){_0x2b8dd2['message']=_0x5cc2d5[_0x3669('0x62')]({'plain':!![]});return db[_0x3669('0x63')]['find']({'where':{'id':_0x5cc2d5[_0x3669('0x64')]}});}return null;})[_0x3669('0x21')](handleEntityNotFound(_0x5473d2,null))[_0x3669('0x21')](function(_0x51de4c){if(_0x51de4c){return _0x51de4c['update']({'UserId':_0x1b2494['body'][_0x3669('0x5f')],'read1stAt':_['isNil'](_0x51de4c[_0x3669('0x65')])?moment()[_0x3669('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x41d2ae){if(_0x41d2ae){_0x2b8dd2[_0x3669('0x66')]=_0x41d2ae[_0x3669('0x62')]({'plain':!![]});interaction_log[_0x3669('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b2494['user']['id'],_0x1b2494[_0x3669('0x60')][_0x3669('0x38')],_0x1b2494[_0x3669('0x60')]['role'],_0x2b8dd2[_0x3669('0x66')]['id'],_0x1b2494[_0x3669('0x56')]?JSON[_0x3669('0x67')](_0x1b2494['body']):_0x3669('0x68'));return respondWithRpcPromise(_0x3669('0x69'),_0x3669('0x6a'),_0x2b8dd2);}return null;})['then'](function(_0x29351a){var _0x220425=_0x3669('0x6b')+_0x29351a['message'][_0x3669('0x6c')];return db[_0x3669('0x6d')][_0x3669('0x3e')](_0x220425,{'type':db[_0x3669('0x6e')][_0x3669('0x6f')]['SELECT'],'raw':!![]})[_0x3669('0x21')](function(_0x4fd1e9){return _0x4fd1e9;});})[_0x3669('0x21')](function(_0x1b31c7){if(_0x1b31c7){_0x2b8dd2['message'][_0x3669('0x70')]=_0x1b31c7[0x0];if(!_0x1b2494[_0x3669('0x56')]['UserId'])return;return db[_0x3669('0x71')][_0x3669('0x57')]({'where':{'id':_0x1b2494[_0x3669('0x56')][_0x3669('0x5f')],'role':'agent'},'attributes':['id',_0x3669('0x38'),_0x3669('0x72'),_0x3669('0x73'),'internal'],'raw':!![]});}return null;})[_0x3669('0x21')](function(_0x3c8466){if(!_0x3c8466)return null;_0x2b8dd2[_0x3669('0x74')]['agent']=_0x3c8466;return _0x2b8dd2;})[_0x3669('0x21')](function(_0x51fe5f){if(_0x51fe5f){if(_0x1b2494[_0x3669('0x56')][_0x3669('0x75')]){_0x2b8dd2[_0x3669('0x74')][_0x3669('0x76')]=util[_0x3669('0x5d')](_0x3669('0x77'),_0x1b2494[_0x3669('0x60')][_0x3669('0x38')]);_0x2b8dd2['message']['channel']=_0x2b8dd2[_0x3669('0x78')];_0x2b8dd2[_0x3669('0x74')]['motionChannel']=_0x2b8dd2[_0x3669('0x78')];_0x2b8dd2[_0x3669('0x74')][_0x3669('0x79')]=_0x3669('0x7a');return respondWithRpcPromise(_0x3669('0x7b'),_0x3669('0x7b'),{'event':_0x3669('0x7c'),'message':_0x2b8dd2[_0x3669('0x74')]},client9002)[_0x3669('0x21')](function(){return _0x2b8dd2;});}return _0x2b8dd2;}return null;})[_0x3669('0x21')](respondWithResult(_0x5473d2,null))[_0x3669('0x29')](handleError(_0x5473d2,null));};var interaction_log=require('../../config/logger')(_0x3669('0x5a'));exports[_0x3669('0x7d')]=function(_0x3acaf6,_0x3353df,_0x409a54){var _0x360151={'agent':{},'channel':_0x3669('0x5b')};if(_0x3acaf6[_0x3669('0x56')]['id']){delete _0x3acaf6[_0x3669('0x56')]['id'];}_0x3acaf6[_0x3669('0x56')][_0x3669('0x5f')]=_0x3acaf6[_0x3669('0x56')][_0x3669('0x5f')]||_0x3acaf6[_0x3669('0x60')]['id'];_0x360151[_0x3669('0x61')]['id']=_0x3acaf6[_0x3669('0x56')][_0x3669('0x5f')];return db[_0x3669('0x3a')][_0x3669('0x57')]({'where':{'id':_0x3acaf6[_0x3669('0x51')]['id'],'UserId':null}})[_0x3669('0x21')](handleEntityNotFound(_0x3353df,null))[_0x3669('0x21')](function(_0x454ffb){if(_0x454ffb){_0x360151[_0x3669('0x74')]=_0x454ffb['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x3669('0x57')]({'where':{'id':_0x454ffb['OpenchannelInteractionId']}});}return null;})[_0x3669('0x21')](handleEntityNotFound(_0x3353df,null))['then'](function(_0x138e1b){if(_0x138e1b){_0x360151['interaction']=_0x138e1b['get']({'plain':!![]});interaction_log[_0x3669('0x22')](_0x3669('0x7e'),_0x3acaf6[_0x3669('0x60')]['id'],_0x3acaf6[_0x3669('0x60')][_0x3669('0x38')],_0x3acaf6[_0x3669('0x60')]['role'],_0x360151['interaction']['id'],_0x3acaf6[_0x3669('0x56')]?JSON[_0x3669('0x67')](_0x3acaf6['body']):_0x3669('0x68'));return respondWithRpcPromise(_0x3669('0x7f'),_0x3669('0x80'),_0x360151);}return null;})[_0x3669('0x21')](function(_0x1559b6){var _0x3f9ff9=_0x3669('0x6b')+_0x1559b6[_0x3669('0x74')][_0x3669('0x6c')];return db[_0x3669('0x6d')][_0x3669('0x3e')](_0x3f9ff9,{'type':db['Sequelize'][_0x3669('0x6f')][_0x3669('0x81')],'raw':!![]})[_0x3669('0x21')](function(_0x58bcbf){return _0x58bcbf;});})['then'](function(_0xad8fb5){if(_0xad8fb5){_0x360151['message'][_0x3669('0x70')]=_0xad8fb5[0x0];if(!_0x3acaf6[_0x3669('0x56')][_0x3669('0x5f')])return;return db[_0x3669('0x71')][_0x3669('0x57')]({'where':{'id':_0x3acaf6[_0x3669('0x56')][_0x3669('0x5f')],'role':_0x3669('0x61')},'attributes':['id','name',_0x3669('0x72'),_0x3669('0x73'),_0x3669('0x82')],'raw':!![]});}return null;})[_0x3669('0x21')](function(_0x1a0947){if(!_0x1a0947)return null;_0x360151[_0x3669('0x74')][_0x3669('0x61')]=_0x1a0947;return _0x360151;})[_0x3669('0x21')](function(_0x4e8af9){if(_0x4e8af9){_0x4e8af9[_0x3669('0x74')][_0x3669('0x76')]=util[_0x3669('0x5d')](_0x3669('0x77'),_0x3acaf6[_0x3669('0x60')][_0x3669('0x38')]);_0x4e8af9['message'][_0x3669('0x78')]=_0x360151[_0x3669('0x78')];_0x4e8af9['message'][_0x3669('0x83')]=_0x360151['channel'];_0x4e8af9[_0x3669('0x74')][_0x3669('0x79')]=_0x3669('0x7d');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3669('0x84'),'message':_0x4e8af9[_0x3669('0x74')]},client9002);return _0x360151;}return null;})[_0x3669('0x21')](respondWithResult(_0x3353df,null))[_0x3669('0x29')](handleError(_0x3353df,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 24b13f1..eaadab6 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 _0x22a7=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x4c1e32,_0x5764f4){var _0x5cab86=function(_0x42e0c9){while(--_0x42e0c9){_0x4c1e32['push'](_0x4c1e32['shift']());}};_0x5cab86(++_0x5764f4);}(_0x22a7,0x1b7));var _0x722a=function(_0x59e9f5,_0x430097){_0x59e9f5=_0x59e9f5-0x0;var _0x3fa278=_0x22a7[_0x59e9f5];return _0x3fa278;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x722a('0x0'))['db'][_0x722a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x722a('0x2')](0x0);var events={'afterCreate':_0x722a('0x3'),'afterUpdate':'update','afterDestroy':_0x722a('0x4')};function emitEvent(_0x2ae9fe){return function(_0x134099,_0x2e090a,_0x322cbc){OpenchannelMessageEvents['emit'](_0x2ae9fe+':'+_0x134099['id'],_0x134099);OpenchannelMessageEvents[_0x722a('0x5')](_0x2ae9fe,_0x134099);_0x322cbc(null);};}for(var e in events){if(events[_0x722a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x722a('0x7')](e,emitEvent(event));}}module[_0x722a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x58f4=['../../mysqldb','OpenchannelMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c3f62,_0x12b3e8){var _0x46e43f=function(_0x3c781b){while(--_0x3c781b){_0x4c3f62['push'](_0x4c3f62['shift']());}};_0x46e43f(++_0x12b3e8);}(_0x58f4,0xe0));var _0x458f=function(_0x2b5fa2,_0xf2d3bd){_0x2b5fa2=_0x2b5fa2-0x0;var _0x52834d=_0x58f4[_0x2b5fa2];return _0x52834d;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x458f('0x0'))['db'][_0x458f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x458f('0x2'),'afterUpdate':'update','afterDestroy':_0x458f('0x3')};function emitEvent(_0x4f7e0a){return function(_0x341f8c,_0x500bd4,_0x4ee74a){OpenchannelMessageEvents[_0x458f('0x4')](_0x4f7e0a+':'+_0x341f8c['id'],_0x341f8c);OpenchannelMessageEvents['emit'](_0x4f7e0a,_0x341f8c);_0x4ee74a(null);};}for(var e in events){if(events[_0x458f('0x5')](e)){var event=events[e];OpenchannelMessage[_0x458f('0x6')](e,emitEvent(event));}}module[_0x458f('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6c28c3e..8fed25f 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 _0x8201=['OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','error','secret','CmContact','describe'];(function(_0x2da1f9,_0x5e4269){var _0x22ef92=function(_0x1a152a){while(--_0x1a152a){_0x2da1f9['push'](_0x2da1f9['shift']());}};_0x22ef92(++_0x5e4269);}(_0x8201,0x1c1));var _0x1820=function(_0x306eb3,_0x3b1d96){_0x306eb3=_0x306eb3-0x0;var _0x352367=_0x8201[_0x306eb3];return _0x352367;};'use strict';var _=require(_0x1820('0x0'));var util=require('util');var logger=require(_0x1820('0x1'))(_0x1820('0x2'));var moment=require(_0x1820('0x3'));var BPromise=require(_0x1820('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1820('0x5'));var rimraf=require(_0x1820('0x6'));var config=require(_0x1820('0x7'));var attributes=require(_0x1820('0x8'));module[_0x1820('0x9')]=function(_0x14d492,_0x11ba8b){return _0x14d492['define'](_0x1820('0xa'),attributes,{'tableName':_0x1820('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1820('0xc')],'type':_0x1820('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2306a3,_0x201ba0,_0x439d54){var _0x52fb03=_0x14d492[_0x1820('0xe')];var _0x4b98cc=_0x2306a3['get']({'plain':!![]});if(_0x4b98cc['direction'][_0x1820('0xf')]()==='in'||_0x4b98cc[_0x1820('0x10')][_0x1820('0xf')]()===_0x1820('0x11')&&!_0x4b98cc['secret']&&!_[_0x1820('0x12')](_0x4b98cc[_0x1820('0x13')])){_0x52fb03['OpenchannelInteraction'][_0x1820('0x14')]({'where':{'id':_0x4b98cc[_0x1820('0x15')]}})[_0x1820('0x16')](function(_0x39c089){if(_0x39c089){_0x39c089['update']({'lastMsgAt':_0x4b98cc[_0x1820('0x17')],'lastMsgDirection':_0x4b98cc[_0x1820('0x10')][_0x1820('0xf')]()});}})['catch'](function(_0x1b0b90){console[_0x1820('0x18')](_0x1b0b90);});}if(_0x4b98cc[_0x1820('0x10')]===_0x1820('0x11')&&!_0x4b98cc[_0x1820('0x19')]){var _0x3e49d5;_0x52fb03[_0x1820('0x1a')][_0x1820('0x1b')]()[_0x1820('0x16')](function(_0x39b6da){return _0x52fb03[_0x1820('0x1c')][_0x1820('0x1d')]({'where':{'id':_0x4b98cc[_0x1820('0x1e')]},'include':[{'model':_0x52fb03[_0x1820('0x1f')],'as':_0x1820('0x20'),'where':{'id':_0x4b98cc[_0x1820('0x15')]},'limit':0x1,'include':[{'model':_0x52fb03[_0x1820('0x1a')],'as':_0x1820('0x21'),'attributes':_[_0x1820('0x22')](_0x39b6da)}]}]});})['then'](function(_0x35750f){_0x3e49d5=_0x35750f['get']({'plain':!![]});if(_0x3e49d5&&_0x3e49d5['replyUri']){logger[_0x1820('0x23')](_0x1820('0x24'),'afterCreate',util[_0x1820('0x25')](_0x1820('0x26'),_0x4b98cc['id'],_0x3e49d5[_0x1820('0x27')]));if(_0x3e49d5['Interactions']&&_0x3e49d5[_0x1820('0x20')][_0x1820('0x28')]){_0x4b98cc[_0x1820('0x29')]=_[_0x1820('0x2a')](_0x3e49d5[_0x1820('0x20')][0x0],_0x1820('0x21'));_0x4b98cc[_0x1820('0x21')]=_0x3e49d5['Interactions'][0x0][_0x1820('0x21')];}var _0x201ba0={'method':_0x1820('0x2b'),'uri':encodeURI(_0x3e49d5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x201ba0[_0x1820('0x2c')]){case'GET':_0x201ba0['qs']=_0x4b98cc;break;case _0x1820('0x2b'):_0x201ba0[_0x1820('0xc')]=_0x4b98cc;break;}return rp(_0x201ba0)['then'](function(_0x24ae3b){logger[_0x1820('0x23')](_0x1820('0x24'),'afterCreate',util[_0x1820('0x25')](_0x1820('0x2d'),_0x4b98cc['id'],_0x3e49d5['replyUri']));if(_0x24ae3b['body'][_0x1820('0x2e')]&&_0x24ae3b[_0x1820('0xc')]['threadId']!=_0x4b98cc[_0x1820('0x29')][_0x1820('0x2e')]){return _0x52fb03[_0x1820('0x1f')][_0x1820('0x2f')]({'threadId':_0x24ae3b[_0x1820('0xc')][_0x1820('0x2e')]},{'where':{'id':_0x4b98cc[_0x1820('0x29')]['id']}});}else{return;}})[_0x1820('0x16')](function(){return _0x2306a3[_0x1820('0x2f')]({'read':!![]});})[_0x1820('0x30')](function(_0x1bb9ac){logger[_0x1820('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x1820('0x31'),util['inspect'](_0x1bb9ac,{'showHidden':![],'depth':null}));_0x439d54();});}else{_0x439d54();}})[_0x1820('0x32')](function(){_0x439d54();});}else{_0x439d54();}}},'charset':_0x1820('0x33'),'collate':_0x1820('0x34')});}; \ No newline at end of file +var _0xdbab=['omit','POST','method','GET','format','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction'];(function(_0x306b8d,_0x1efb46){var _0x2e093a=function(_0xe62b50){while(--_0xe62b50){_0x306b8d['push'](_0x306b8d['shift']());}};_0x2e093a(++_0x1efb46);}(_0xdbab,0x179));var _0xbdba=function(_0x376160,_0x4852bd){_0x376160=_0x376160-0x0;var _0x48b138=_0xdbab[_0x376160];return _0x48b138;};'use strict';var _=require('lodash');var util=require(_0xbdba('0x0'));var logger=require(_0xbdba('0x1'))('api');var moment=require(_0xbdba('0x2'));var BPromise=require(_0xbdba('0x3'));var rp=require(_0xbdba('0x4'));var fs=require('fs');var path=require(_0xbdba('0x5'));var rimraf=require(_0xbdba('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x3b1249,_0x2a16f5){return _0x3b1249[_0xbdba('0x7')]('OpenchannelMessage',attributes,{'tableName':_0xbdba('0x8'),'paranoid':![],'indexes':[{'name':_0xbdba('0x9'),'fields':[_0xbdba('0xa')],'type':_0xbdba('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cd37c,_0x439475,_0x11e36d){var _0x3f05dc=_0x3b1249['models'];var _0x903724=_0x3cd37c[_0xbdba('0xc')]({'plain':!![]});if(_0x903724[_0xbdba('0xd')][_0xbdba('0xe')]()==='in'||_0x903724[_0xbdba('0xd')][_0xbdba('0xe')]()===_0xbdba('0xf')&&!_0x903724[_0xbdba('0x10')]&&!_[_0xbdba('0x11')](_0x903724[_0xbdba('0x12')])){_0x3f05dc[_0xbdba('0x13')]['findOne']({'where':{'id':_0x903724[_0xbdba('0x14')]}})[_0xbdba('0x15')](function(_0x416a3f){if(_0x416a3f){_0x416a3f[_0xbdba('0x16')]({'lastMsgAt':_0x903724['createdAt'],'lastMsgDirection':_0x903724[_0xbdba('0xd')][_0xbdba('0xe')]()});}})[_0xbdba('0x17')](function(_0x237a69){console[_0xbdba('0x18')](_0x237a69);});}if(_0x903724[_0xbdba('0xd')]===_0xbdba('0xf')&&!_0x903724[_0xbdba('0x10')]){var _0x27ad19;_0x3f05dc[_0xbdba('0x19')][_0xbdba('0x1a')]()[_0xbdba('0x15')](function(_0x478f95){return _0x3f05dc[_0xbdba('0x1b')]['find']({'where':{'id':_0x903724[_0xbdba('0x1c')]},'include':[{'model':_0x3f05dc['OpenchannelInteraction'],'as':_0xbdba('0x1d'),'where':{'id':_0x903724[_0xbdba('0x14')]},'limit':0x1,'include':[{'model':_0x3f05dc['CmContact'],'as':_0xbdba('0x1e'),'attributes':_['keys'](_0x478f95)}]}]});})[_0xbdba('0x15')](function(_0x442365){_0x27ad19=_0x442365['get']({'plain':!![]});if(_0x27ad19&&_0x27ad19[_0xbdba('0x1f')]){logger[_0xbdba('0x20')](_0xbdba('0x21'),_0xbdba('0x22'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x903724['id'],_0x27ad19[_0xbdba('0x1f')]));if(_0x27ad19[_0xbdba('0x1d')]&&_0x27ad19[_0xbdba('0x1d')][_0xbdba('0x23')]){_0x903724[_0xbdba('0x24')]=_[_0xbdba('0x25')](_0x27ad19['Interactions'][0x0],'Contact');_0x903724[_0xbdba('0x1e')]=_0x27ad19[_0xbdba('0x1d')][0x0]['Contact'];}var _0x439475={'method':_0xbdba('0x26'),'uri':encodeURI(_0x27ad19[_0xbdba('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x439475[_0xbdba('0x27')]){case _0xbdba('0x28'):_0x439475['qs']=_0x903724;break;case _0xbdba('0x26'):_0x439475[_0xbdba('0xa')]=_0x903724;break;}return rp(_0x439475)['then'](function(_0x523600){logger[_0xbdba('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xbdba('0x22'),util[_0xbdba('0x29')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x903724['id'],_0x27ad19[_0xbdba('0x1f')]));if(_0x523600[_0xbdba('0xa')][_0xbdba('0x2a')]&&_0x523600[_0xbdba('0xa')][_0xbdba('0x2a')]!=_0x903724[_0xbdba('0x24')][_0xbdba('0x2a')]){return _0x3f05dc[_0xbdba('0x13')][_0xbdba('0x16')]({'threadId':_0x523600[_0xbdba('0xa')][_0xbdba('0x2a')]},{'where':{'id':_0x903724[_0xbdba('0x24')]['id']}});}else{return;}})[_0xbdba('0x15')](function(){return _0x3cd37c[_0xbdba('0x16')]({'read':!![]});})[_0xbdba('0x17')](function(_0x27a359){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xbdba('0x22'),util[_0xbdba('0x2b')](_0x27a359,{'showHidden':![],'depth':null}));_0x11e36d();});}else{_0x11e36d();}})['finally'](function(){_0x11e36d();});}else{_0x11e36d();}}},'charset':_0xbdba('0x2c'),'collate':_0xbdba('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8759195..d721c92 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x105f9f,_0x34b44b){var _0x36256c=function(_0x33e81c){while(--_0x33e81c){_0x105f9f['push'](_0x105f9f['shift']());}};_0x36256c(++_0x34b44b);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x2ef3,0xba));var _0x32ef=function(_0x502844,_0x277051){_0x502844=_0x502844-0x0;var _0x358b99=_0x2ef3[_0x502844];return _0x358b99;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f3d3366..7a1be44 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 _0x242e=['emit','removeListener','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x242e,0x12f));var _0xe242=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x242e[_0x3e5086];return _0xfeb102;};'use strict';var OpenchannelMessageEvents=require(_0xe242('0x0'));var events=['save',_0xe242('0x1'),_0xe242('0x2')];function createListener(_0x5a24a7,_0x579440){return function(_0xf85009){_0x579440[_0xe242('0x3')](_0x5a24a7,_0xf85009);};}function removeListener(_0x35be65,_0x1da0f6){return function(){OpenchannelMessageEvents[_0xe242('0x4')](_0x35be65,_0x1da0f6);};}exports['register']=function(_0x53fdde){for(var _0x362bb0=0x0,_0x44a5a7=events['length'];_0x362bb0<_0x44a5a7;_0x362bb0++){var _0x28385b=events[_0x362bb0];var _0x1a4c05=createListener(_0xe242('0x5')+_0x28385b,_0x53fdde);OpenchannelMessageEvents['on'](_0x28385b,_0x1a4c05);}}; \ No newline at end of file +var _0x724d=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x2d8a95,_0x818e1b){var _0x3e1cd7=function(_0x3223e8){while(--_0x3223e8){_0x2d8a95['push'](_0x2d8a95['shift']());}};_0x3e1cd7(++_0x818e1b);}(_0x724d,0xe5));var _0xd724=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x724d[_0x4e783c];return _0x2fbd6d;};'use strict';var OpenchannelMessageEvents=require(_0xd724('0x0'));var events=[_0xd724('0x1'),_0xd724('0x2'),'update'];function createListener(_0x1fb96a,_0x1f5db6){return function(_0x46094e){_0x1f5db6[_0xd724('0x3')](_0x1fb96a,_0x46094e);};}function removeListener(_0x399665,_0x3012ba){return function(){OpenchannelMessageEvents[_0xd724('0x4')](_0x399665,_0x3012ba);};}exports[_0xd724('0x5')]=function(_0x4a7a6d){for(var _0xdb8f9f=0x0,_0x100428=events[_0xd724('0x6')];_0xdb8f9f<_0x100428;_0xdb8f9f++){var _0x37938f=events[_0xdb8f9f];var _0x53601e=createListener(_0xd724('0x7')+_0x37938f,_0x4a7a6d);OpenchannelMessageEvents['on'](_0x37938f,_0x53601e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 62064d4..133a7d0 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 _0x168e=['put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams'];(function(_0x3cd023,_0x545d9e){var _0x1a0163=function(_0xe7f852){while(--_0xe7f852){_0x3cd023['push'](_0x3cd023['shift']());}};_0x1a0163(++_0x545d9e);}(_0x168e,0x76));var _0xe168=function(_0x8a73d2,_0x78877b){_0x8a73d2=_0x8a73d2-0x0;var _0x506064=_0x168e[_0x8a73d2];return _0x506064;};'use strict';var multer=require(_0xe168('0x0'));var util=require(_0xe168('0x1'));var path=require(_0xe168('0x2'));var timeout=require(_0xe168('0x3'));var express=require(_0xe168('0x4'));var router=express['Router']();var fs_extra=require(_0xe168('0x5'));var auth=require(_0xe168('0x6'));var interaction=require(_0xe168('0x7'));var config=require(_0xe168('0x8'));var controller=require('./openchannelQueue.controller');router[_0xe168('0x9')]('/',auth[_0xe168('0xa')](),controller[_0xe168('0xb')]);router['get'](_0xe168('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe168('0x9')](_0xe168('0xd'),auth['isAuthenticated'](),controller[_0xe168('0xe')]);router[_0xe168('0x9')]('/:id/members',auth[_0xe168('0xa')](),controller[_0xe168('0xf')]);router[_0xe168('0x9')]('/:id/teams',auth[_0xe168('0xa')](),controller[_0xe168('0x10')]);router[_0xe168('0x9')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller[_0xe168('0x12')]);router[_0xe168('0x13')]('/',auth['isAuthenticated'](),controller[_0xe168('0x14')]);router[_0xe168('0x13')](_0xe168('0x15'),auth[_0xe168('0xa')](),controller['addTeams']);router[_0xe168('0x13')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller['addAgents']);router[_0xe168('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe168('0x17')]);router[_0xe168('0x18')](_0xe168('0xd'),auth[_0xe168('0xa')](),controller[_0xe168('0x19')]);router[_0xe168('0x18')]('/:id/teams',auth[_0xe168('0xa')](),controller[_0xe168('0x1a')]);router[_0xe168('0x18')](_0xe168('0x11'),auth[_0xe168('0xa')](),controller[_0xe168('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa0d9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents'];(function(_0x5e0d76,_0x3f593a){var _0x38a618=function(_0x111ce4){while(--_0x111ce4){_0x5e0d76['push'](_0x5e0d76['shift']());}};_0x38a618(++_0x3f593a);}(_0xa0d9,0x140));var _0x9a0d=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0xa0d9[_0x42bb6d];return _0x1db89b;};'use strict';var multer=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var path=require(_0x9a0d('0x2'));var timeout=require(_0x9a0d('0x3'));var express=require(_0x9a0d('0x4'));var router=express[_0x9a0d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9a0d('0x6'));var interaction=require(_0x9a0d('0x7'));var config=require(_0x9a0d('0x8'));var controller=require('./openchannelQueue.controller');router[_0x9a0d('0x9')]('/',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0xb')]);router[_0x9a0d('0x9')](_0x9a0d('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9a0d('0x9')](_0x9a0d('0xd'),auth['isAuthenticated'](),controller[_0x9a0d('0xe')]);router['get'](_0x9a0d('0xf'),auth[_0x9a0d('0xa')](),controller['getMembers']);router[_0x9a0d('0x9')](_0x9a0d('0x10'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x11')]);router[_0x9a0d('0x9')](_0x9a0d('0x12'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x13')]);router[_0x9a0d('0x14')]('/',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x15')]);router['post'](_0x9a0d('0x10'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x16')]);router['post'](_0x9a0d('0x12'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x17')]);router[_0x9a0d('0x18')](_0x9a0d('0xd'),auth[_0x9a0d('0xa')](),controller['update']);router[_0x9a0d('0x19')](_0x9a0d('0xd'),auth[_0x9a0d('0xa')](),controller['destroy']);router[_0x9a0d('0x19')](_0x9a0d('0x10'),auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x1a')]);router['delete']('/:id/users',auth[_0x9a0d('0xa')](),controller[_0x9a0d('0x1b')]);module[_0x9a0d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 30cb890..24f7a36 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 _0xb1f9=['INTEGER','ENUM','rrmemory','beepall','name','STRING'];(function(_0x7ad8f8,_0x145cba){var _0x2d23c6=function(_0x2e4135){while(--_0x2e4135){_0x7ad8f8['push'](_0x7ad8f8['shift']());}};_0x2d23c6(++_0x145cba);}(_0xb1f9,0xa6));var _0x9b1f=function(_0x26075b,_0x1b7450){_0x26075b=_0x26075b-0x0;var _0xdbc322=_0xb1f9[_0x26075b];return _0xdbc322;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9b1f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b1f('0x1')]},'timeout':{'type':Sequelize[_0x9b1f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b1f('0x3')](_0x9b1f('0x4'),_0x9b1f('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xf2d0=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0xf2d0,0x12c));var _0x0f2d=function(_0x2adb32,_0x47c0ed){_0x2adb32=_0x2adb32-0x0;var _0x39c434=_0xf2d0[_0x2adb32];return _0x39c434;};'use strict';var Sequelize=require(_0x0f2d('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f2d('0x1')],'unique':_0x0f2d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0f2d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f2d('0x4')](_0x0f2d('0x5'),_0x0f2d('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 532bc17..39d04b5 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 _0x737f=['addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','userOpenchannelQueue:remove'];(function(_0x18e564,_0x1cd5e2){var _0x214a7f=function(_0x4932c9){while(--_0x4932c9){_0x18e564['push'](_0x18e564['shift']());}};_0x214a7f(++_0x1cd5e2);}(_0x737f,0x1b8));var _0xf737=function(_0x1da881,_0x224365){_0x1da881=_0x1da881-0x0;var _0x5bc895=_0x737f[_0x1da881];return _0x5bc895;};'use strict';var emlformat=require(_0xf737('0x0'));var rimraf=require(_0xf737('0x1'));var zipdir=require(_0xf737('0x2'));var jsonpatch=require(_0xf737('0x3'));var rp=require(_0xf737('0x4'));var moment=require(_0xf737('0x5'));var BPromise=require(_0xf737('0x6'));var Mustache=require('mustache');var util=require(_0xf737('0x7'));var path=require(_0xf737('0x8'));var sox=require(_0xf737('0x9'));var csv=require(_0xf737('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf737('0xb'));var _=require(_0xf737('0xc'));var squel=require(_0xf737('0xd'));var crypto=require(_0xf737('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf737('0xf'));var toCsv=require(_0xf737('0xa'));var querystring=require(_0xf737('0x10'));var Papa=require('papaparse');var Redis=require(_0xf737('0x11'));var authService=require(_0xf737('0x12'));var qs=require(_0xf737('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf737('0x14'));var logger=require(_0xf737('0x15'))(_0xf737('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf737('0x17'));var db=require(_0xf737('0x18'))['db'];config[_0xf737('0x19')]=_[_0xf737('0x1a')](config[_0xf737('0x19')],{'host':_0xf737('0x1b'),'port':0x18eb});var socket=require(_0xf737('0x1c'))(new Redis(config[_0xf737('0x19')]));require(_0xf737('0x1d'))[_0xf737('0x1e')](socket);function respondWithStatusCode(_0x4093b4,_0x1dac0d){_0x1dac0d=_0x1dac0d||0xcc;return function(_0x299aaf){if(_0x299aaf){return _0x4093b4[_0xf737('0x1f')](_0x1dac0d);}return _0x4093b4[_0xf737('0x20')](_0x1dac0d)['end']();};}function respondWithResult(_0x55f70f,_0x199d6f){_0x199d6f=_0x199d6f||0xc8;return function(_0x492f59){if(_0x492f59){return _0x55f70f[_0xf737('0x20')](_0x199d6f)['json'](_0x492f59);}};}function respondWithFilteredResult(_0x2637fd,_0x3a17c6){return function(_0x262929){if(_0x262929){var _0x378bc6=typeof _0x3a17c6[_0xf737('0x21')]===_0xf737('0x22')&&typeof _0x3a17c6[_0xf737('0x23')]===_0xf737('0x22');var _0x129e30=_0x262929[_0xf737('0x24')];var _0x509621=_0x378bc6?0x0:_0x3a17c6['offset'];var _0x157941=_0x378bc6?_0x262929[_0xf737('0x24')]:_0x3a17c6[_0xf737('0x21')]+_0x3a17c6[_0xf737('0x23')];var _0x55d170;if(_0x157941>=_0x129e30){_0x157941=_0x129e30;_0x55d170=0xc8;}else{_0x55d170=0xce;}_0x2637fd[_0xf737('0x20')](_0x55d170);return _0x2637fd[_0xf737('0x25')]('Content-Range',_0x509621+'-'+_0x157941+'/'+_0x129e30)[_0xf737('0x26')](_0x262929);}return null;};}function patchUpdates(_0x7b524a){return function(_0x200a89){try{jsonpatch['apply'](_0x200a89,_0x7b524a,!![]);}catch(_0x32eb43){return BPromise[_0xf737('0x27')](_0x32eb43);}return _0x200a89['save']();};}function saveUpdates(_0x11470e,_0xfc736e){return function(_0x28fe69){if(_0x28fe69){return _0x28fe69[_0xf737('0x28')](_0x11470e)[_0xf737('0x29')](function(_0x98b164){return _0x98b164;});}return null;};}function removeEntity(_0x5c29e3,_0x5adade){return function(_0x3c2e25){if(_0x3c2e25){return _0x3c2e25[_0xf737('0x2a')]()[_0xf737('0x29')](function(){var _0x493500=_0x3c2e25[_0xf737('0x2b')]({'plain':!![]});var _0x55bf81=_0xf737('0x2c');return db[_0xf737('0x2d')][_0xf737('0x2a')]({'where':{'type':_0x55bf81,'resourceId':_0x493500['id']}})[_0xf737('0x29')](function(){return _0x3c2e25;});})['then'](function(){_0x5c29e3[_0xf737('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e62ea,_0x184455){return function(_0x4e89cb){if(!_0x4e89cb){_0x2e62ea[_0xf737('0x1f')](0x194);}return _0x4e89cb;};}function handleError(_0x30828a,_0x5c6d06){_0x5c6d06=_0x5c6d06||0x1f4;return function(_0x2b0140){logger[_0xf737('0x2e')](_0x2b0140[_0xf737('0x2f')]);if(_0x2b0140[_0xf737('0x30')]){delete _0x2b0140[_0xf737('0x30')];}_0x30828a['status'](_0x5c6d06)[_0xf737('0x31')](_0x2b0140);};}exports[_0xf737('0x32')]=function(_0x46b0f6,_0x1efd6c){var _0x1a17b7={},_0x4b8e7c={},_0x3fc2ed={'count':0x0,'rows':[]};var _0x14e9e9=_[_0xf737('0x33')](db[_0xf737('0x34')][_0xf737('0x35')],function(_0x50972f){return{'name':_0x50972f[_0xf737('0x36')],'type':_0x50972f[_0xf737('0x37')]['key']};});_0x4b8e7c[_0xf737('0x38')]=_[_0xf737('0x33')](_0x14e9e9,_0xf737('0x30'));_0x4b8e7c['query']=_[_0xf737('0x39')](_0x46b0f6['query']);_0x4b8e7c[_0xf737('0x3a')]=_['intersection'](_0x4b8e7c['model'],_0x4b8e7c[_0xf737('0x3b')]);_0x1a17b7[_0xf737('0x3c')]=_[_0xf737('0x3d')](_0x4b8e7c[_0xf737('0x38')],qs[_0xf737('0x3e')](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1a17b7[_0xf737('0x3c')]=_0x1a17b7['attributes'][_0xf737('0x3f')]?_0x1a17b7[_0xf737('0x3c')]:_0x4b8e7c[_0xf737('0x38')];if(!_0x46b0f6[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x1a17b7['limit']=qs['limit'](_0x46b0f6[_0xf737('0x3b')]['limit']);_0x1a17b7[_0xf737('0x21')]=qs['offset'](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x21')]);}_0x1a17b7['order']=qs['sort'](_0x46b0f6[_0xf737('0x3b')][_0xf737('0x42')]);_0x1a17b7['where']=qs[_0xf737('0x3a')](_['pick'](_0x46b0f6['query'],_0x4b8e7c['filters']),_0x14e9e9);if(_0x46b0f6['query']['filter']){_0x1a17b7[_0xf737('0x43')]=_['merge'](_0x1a17b7[_0xf737('0x43')],{'$or':_['map'](_0x14e9e9,function(_0x4188e3){if(_0x4188e3[_0xf737('0x37')]!==_0xf737('0x44')){var _0xef7c71={};_0xef7c71[_0x4188e3[_0xf737('0x30')]]={'$like':'%'+_0x46b0f6[_0xf737('0x3b')]['filter']+'%'};return _0xef7c71;}})});}_0x1a17b7=_[_0xf737('0x45')]({},_0x1a17b7,_0x46b0f6[_0xf737('0x46')]);var _0xfce7b7={'where':_0x1a17b7[_0xf737('0x43')]};return db['OpenchannelQueue'][_0xf737('0x24')](_0xfce7b7)[_0xf737('0x29')](function(_0x4a2d97){_0x3fc2ed[_0xf737('0x24')]=_0x4a2d97;if(_0x46b0f6[_0xf737('0x3b')][_0xf737('0x47')]){_0x1a17b7[_0xf737('0x48')]=[{'all':!![]}];}return db[_0xf737('0x34')]['findAll'](_0x1a17b7);})[_0xf737('0x29')](function(_0x220a03){_0x3fc2ed[_0xf737('0x49')]=_0x220a03;return _0x3fc2ed;})[_0xf737('0x29')](respondWithFilteredResult(_0x1efd6c,_0x1a17b7))[_0xf737('0x4a')](handleError(_0x1efd6c,null));};exports['show']=function(_0x291569,_0x8854a0){var _0x1da28c={'raw':!![],'where':{'id':_0x291569[_0xf737('0x4b')]['id']}},_0x44bd2d={};_0x44bd2d[_0xf737('0x38')]=_[_0xf737('0x39')](db[_0xf737('0x34')][_0xf737('0x35')]);_0x44bd2d[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x291569[_0xf737('0x3b')]);_0x44bd2d[_0xf737('0x3a')]=_['intersection'](_0x44bd2d[_0xf737('0x38')],_0x44bd2d['query']);_0x1da28c[_0xf737('0x3c')]=_[_0xf737('0x3d')](_0x44bd2d['model'],qs[_0xf737('0x3e')](_0x291569[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1da28c[_0xf737('0x3c')]=_0x1da28c[_0xf737('0x3c')][_0xf737('0x3f')]?_0x1da28c[_0xf737('0x3c')]:_0x44bd2d[_0xf737('0x38')];if(_0x291569['query'][_0xf737('0x47')]){_0x1da28c[_0xf737('0x48')]=[{'all':!![]}];}_0x1da28c=_[_0xf737('0x45')]({},_0x1da28c,_0x291569['options']);return db[_0xf737('0x34')][_0xf737('0x4c')](_0x1da28c)[_0xf737('0x29')](handleEntityNotFound(_0x8854a0,null))['then'](respondWithResult(_0x8854a0,null))[_0xf737('0x4a')](handleError(_0x8854a0,null));};exports[_0xf737('0x4d')]=function(_0x108ae5,_0x307e0a){return db[_0xf737('0x34')][_0xf737('0x4d')](_0x108ae5[_0xf737('0x4e')],{})[_0xf737('0x29')](function(_0x1d4bf1){var _0x2d82e7=_0x108ae5['user']['get']({'plain':!![]});if(!_0x2d82e7)throw new Error(_0xf737('0x4f'));if(_0x2d82e7[_0xf737('0x50')]===_0xf737('0x51')){var _0x1fc03c=_0x1d4bf1[_0xf737('0x2b')]({'plain':!![]});var _0x510ea9=_0xf737('0x2c');return db[_0xf737('0x52')]['find']({'where':{'name':_0x510ea9,'userProfileId':_0x2d82e7['userProfileId']},'raw':!![]})['then'](function(_0x20f1ee){if(_0x20f1ee&&_0x20f1ee[_0xf737('0x53')]===0x0){return db[_0xf737('0x2d')][_0xf737('0x4d')]({'name':_0x1fc03c[_0xf737('0x30')],'resourceId':_0x1fc03c['id'],'type':_0x20f1ee[_0xf737('0x30')],'sectionId':_0x20f1ee['id']},{})[_0xf737('0x29')](function(){return _0x1d4bf1;});}else{return _0x1d4bf1;}})[_0xf737('0x4a')](function(_0x254e05){logger['error'](_0xf737('0x54'),_0x254e05);throw _0x254e05;});}return _0x1d4bf1;})[_0xf737('0x29')](respondWithResult(_0x307e0a,0xc9))[_0xf737('0x4a')](handleError(_0x307e0a,null));};exports['update']=function(_0x2edc64,_0x4d117b){if(_0x2edc64[_0xf737('0x4e')]['id']){delete _0x2edc64[_0xf737('0x4e')]['id'];}return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x2edc64[_0xf737('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d117b,null))[_0xf737('0x29')](saveUpdates(_0x2edc64['body'],null))['then'](respondWithResult(_0x4d117b,null))['catch'](handleError(_0x4d117b,null));};exports['destroy']=function(_0x341acd,_0x2e025d){return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x341acd['params']['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x2e025d,null))[_0xf737('0x29')](removeEntity(_0x2e025d,null))[_0xf737('0x4a')](handleError(_0x2e025d,null));};exports[_0xf737('0x55')]=function(_0x53def2,_0x46eb7b){return db[_0xf737('0x34')][_0xf737('0x55')]()[_0xf737('0x29')](respondWithResult(_0x46eb7b,null))['catch'](handleError(_0x46eb7b,null));};exports[_0xf737('0x56')]=function(_0xfda803,_0x483590,_0x412def){var _0x5d5e5a={'raw':!![],'where':{}},_0x349449={},_0x551aa1;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0xfda803['params']['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x483590,null))[_0xf737('0x29')](function(_0x27f35b){if(_0x27f35b){_0x551aa1=_0x27f35b['get']({'plain':!![]});_0x349449[_0xf737('0x38')]=_['keys'](db[_0xf737('0x58')][_0xf737('0x35')]);_0x349449[_0xf737('0x3b')]=_[_0xf737('0x39')](_0xfda803['query']);_0x349449[_0xf737('0x3a')]=_['intersection'](_0x349449[_0xf737('0x38')],_0x349449[_0xf737('0x3b')]);_0x5d5e5a['attributes']=_[_0xf737('0x3d')](_0x349449[_0xf737('0x38')],qs[_0xf737('0x3e')](_0xfda803[_0xf737('0x3b')][_0xf737('0x3e')]));_0x5d5e5a['attributes']=_0x5d5e5a['attributes']['length']?_0x5d5e5a['attributes']:_0x349449['model'];if(!_0xfda803[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x5d5e5a['limit']=qs[_0xf737('0x23')](_0xfda803[_0xf737('0x3b')][_0xf737('0x23')]);_0x5d5e5a[_0xf737('0x21')]=qs['offset'](_0xfda803[_0xf737('0x3b')][_0xf737('0x21')]);}_0x5d5e5a['order']=qs['sort'](_0xfda803[_0xf737('0x3b')][_0xf737('0x42')]);_0x5d5e5a[_0xf737('0x43')]=qs['filters'](_[_0xf737('0x59')](_0xfda803['query'],_0x349449['filters']));_0x5d5e5a[_0xf737('0x43')][_0xf737('0x5a')]=_0x27f35b['id'];if(_0xfda803[_0xf737('0x3b')][_0xf737('0x5b')]){_0x5d5e5a[_0xf737('0x43')]=_[_0xf737('0x45')](_0x5d5e5a[_0xf737('0x43')],{'$or':_['map'](_0x5d5e5a[_0xf737('0x3c')],function(_0x43e587){var _0x513c70={};_0x513c70[_0x43e587]={'$like':'%'+_0xfda803[_0xf737('0x3b')]['filter']+'%'};return _0x513c70;})});}_0x5d5e5a=_['merge']({},_0x5d5e5a,_0xfda803['options']);return db[_0xf737('0x58')]['findAll'](_0x5d5e5a);}})[_0xf737('0x29')](function(_0x24b390){if(_0x24b390){return db[_0xf737('0x5c')][_0xf737('0x5d')]({'where':{'id':_[_0xf737('0x33')](_0x24b390,_0xf737('0x5e')),'role':_0xf737('0x5f')},'attributes':['id',_0xf737('0x30'),_0xf737('0x60'),_0xf737('0x61'),_0xf737('0x62')]});}})[_0xf737('0x29')](function(_0x3614b2){if(_0x3614b2){return{'count':_0x3614b2[_0xf737('0x24')],'rows':_[_0xf737('0x33')](_0x3614b2[_0xf737('0x49')],function(_0x505f40){return{'membername':_0x505f40[_0xf737('0x30')],'UserId':_0x505f40['id'],'queue_name':_0x551aa1['name'],'OpenchannelQueueId':_0x551aa1['id'],'interface':util[_0xf737('0x63')](_0xf737('0x64'),_0xf737('0x65'),_0x505f40[_0xf737('0x30')]),'penalty':0x0,'paused':_0x505f40['openchannelPause'],'createdAt':_0x505f40[_0xf737('0x62')],'updatedAt':_0x505f40[_0xf737('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x483590,_0x5d5e5a))['catch'](handleError(_0x483590,null));};exports[_0xf737('0x66')]=function(_0x23c7bc,_0x415647,_0x30af54){var _0x1a8d29={};var _0x33d827={};var _0x5ba5c0;var _0x371243;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0x23c7bc[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x415647,null))[_0xf737('0x29')](function(_0x15db12){if(_0x15db12){_0x5ba5c0=_0x15db12;_0x33d827['model']=_['keys'](db[_0xf737('0x67')]['rawAttributes']);_0x33d827[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x23c7bc[_0xf737('0x3b')]);_0x33d827[_0xf737('0x3a')]=_[_0xf737('0x3d')](_0x33d827[_0xf737('0x38')],_0x33d827[_0xf737('0x3b')]);_0x1a8d29['attributes']=_[_0xf737('0x3d')](_0x33d827[_0xf737('0x38')],qs[_0xf737('0x3e')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x3e')]));_0x1a8d29[_0xf737('0x3c')]=_0x1a8d29['attributes'][_0xf737('0x3f')]?_0x1a8d29['attributes']:_0x33d827[_0xf737('0x38')];_0x1a8d29[_0xf737('0x68')]=qs[_0xf737('0x42')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x42')]);_0x1a8d29['where']=qs[_0xf737('0x3a')](_[_0xf737('0x59')](_0x23c7bc[_0xf737('0x3b')],_0x33d827[_0xf737('0x3a')]));if(_0x23c7bc[_0xf737('0x3b')][_0xf737('0x5b')]){_0x1a8d29['where']=_[_0xf737('0x45')](_0x1a8d29[_0xf737('0x43')],{'$or':_['map'](_0x1a8d29['attributes'],function(_0x40d245){var _0x54ff06={};_0x54ff06[_0x40d245]={'$like':'%'+_0x23c7bc[_0xf737('0x3b')][_0xf737('0x5b')]+'%'};return _0x54ff06;})});}_0x1a8d29=_[_0xf737('0x45')]({},_0x1a8d29,_0x23c7bc[_0xf737('0x46')]);return _0x5ba5c0[_0xf737('0x66')](_0x1a8d29);}})[_0xf737('0x29')](function(_0x5a80ed){if(_0x5a80ed){_0x371243=_0x5a80ed[_0xf737('0x3f')];if(!_0x23c7bc[_0xf737('0x3b')][_0xf737('0x40')](_0xf737('0x41'))){_0x1a8d29['limit']=qs[_0xf737('0x23')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x23')]);_0x1a8d29[_0xf737('0x21')]=qs[_0xf737('0x21')](_0x23c7bc[_0xf737('0x3b')][_0xf737('0x21')]);}return _0x5ba5c0[_0xf737('0x66')](_0x1a8d29);}})[_0xf737('0x29')](function(_0x1efc3e){if(_0x1efc3e){return _0x1efc3e?{'count':_0x371243,'rows':_0x1efc3e}:null;}})[_0xf737('0x29')](respondWithResult(_0x415647,null))['catch'](handleError(_0x415647,null));};exports['addTeams']=function(_0x20cbaa,_0x13a5b0,_0x5651b4){var _0x90a248=_0x20cbaa[_0xf737('0x4e')][_0xf737('0x69')];return db[_0xf737('0x67')]['findAll']({'where':{'id':_0x90a248},'attributes':['id'],'include':[{'model':db[_0xf737('0x5c')],'as':_0xf737('0x6a'),'attributes':['id','name',_0xf737('0x6b'),'voicePause',_0xf737('0x6c')],'raw':!![]}]})[_0xf737('0x29')](function(_0x5788ff){if(_0x5788ff){var _0x2f9a68=_[_0xf737('0x6d')](_0x5788ff,function(_0x1a67ec){var _0x4a38f0=_0x1a67ec[_0xf737('0x2b')]({'plain':!![]});return _0x4a38f0[_0xf737('0x6a')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x20cbaa[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](function(_0x362ec5){return db[_0xf737('0x6e')][_0xf737('0x6f')](function(_0x32cdc7){return _0x362ec5[_0xf737('0x70')](_0x90a248,{'transaction':_0x32cdc7})[_0xf737('0x29')](function(){return BPromise[_0xf737('0x71')](_0x2f9a68,function(_0x231dca){return db['UserOpenchannelQueue'][_0xf737('0x72')]({'where':{'UserId':_0x231dca['id'],'OpenchannelQueueId':_0x20cbaa[_0xf737('0x4b')]['id']},'transaction':_0x32cdc7});});})[_0xf737('0x29')](function(){_0x2f9a68[_0xf737('0x73')](function(_0x3c64c3){socket[_0xf737('0x74')](_0xf737('0x75'),{'UserId':_0x3c64c3['id'],'OpenchannelQueueId':_0x362ec5['id']});});});});});}})[_0xf737('0x29')](respondWithStatusCode(_0x13a5b0,null))[_0xf737('0x4a')](handleError(_0x13a5b0,null));};exports[_0xf737('0x76')]=function(_0x1a847b,_0x127320,_0x5c7988){return db[_0xf737('0x67')][_0xf737('0x77')]({'where':{'id':_0x1a847b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf737('0x5c')],'as':_0xf737('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf737('0x29')](handleEntityNotFound(_0x127320,null))[_0xf737('0x29')](function(_0x5cd2ca){var _0x20b7ec=_[_0xf737('0x33')](_0x5cd2ca,'id');var _0x5299d9=[];var _0x4c59db=[];var _0x25809c=squel[_0xf737('0x78')]();_0x25809c[_0xf737('0x79')](_0xf737('0x7a'))[_0xf737('0x7b')](_0xf737('0x7c'),'tq')[_0xf737('0x7d')](_0xf737('0x7e'),'ut',_0xf737('0x7f'))[_0xf737('0x43')](_0xf737('0x80'),_0x1a847b[_0xf737('0x4b')]['id']);for(var _0x3d7b55=0x0;_0x3d7b55<_0x5cd2ca[_0xf737('0x3f')];_0x3d7b55+=0x1){let _0x3e06ae=_0x5cd2ca[_0x3d7b55];for(var _0x5cb698=0x0;_0x5cb698<_0x3e06ae[_0xf737('0x6a')][_0xf737('0x3f')];_0x5cb698+=0x1){let _0x1e3216=_0x3e06ae[_0xf737('0x6a')][_0x5cb698];var _0x5f44ae=_0x25809c['clone']();_0x5f44ae[_0xf737('0x43')](_0xf737('0x81'),_0x1e3216['id']);_0x4c59db['push'](db[_0xf737('0x6e')][_0xf737('0x3b')](_0x5f44ae[_0xf737('0x82')](),{'type':db[_0xf737('0x6e')][_0xf737('0x83')][_0xf737('0x84')]})[_0xf737('0x29')](function(_0x559d80){if(_0x559d80[_0xf737('0x3f')]===0x1){return _0x1e3216['id'];}else{var _0x382f30=_[_0xf737('0x85')](_[_0xf737('0x33')](_0x559d80,_0xf737('0x86')),function(_0x18a941){return _['includes'](_0x20b7ec,_0x18a941);});if(_0x382f30){return _0x1e3216['id'];}}}));}}return BPromise['all'](_0x4c59db)[_0xf737('0x29')](function(_0x46da80){_0x5299d9=_(_0x5299d9)[_0xf737('0x87')](_0x46da80)[_0xf737('0x88')]()[_0xf737('0x89')]();return db['OpenchannelQueue'][_0xf737('0x4c')]({'where':{'id':_0x1a847b[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](function(_0x9fa5fb){return db[_0xf737('0x6e')][_0xf737('0x6f')](function(_0x23354b){return _0x9fa5fb[_0xf737('0x76')](_0x1a847b[_0xf737('0x3b')][_0xf737('0x69')],{'transaction':_0x23354b})[_0xf737('0x29')](function(){if(!_[_0xf737('0x8a')](_0x5299d9)){return _0x9fa5fb['removeAgents'](_0x5299d9,{'transaction':_0x23354b});}})['then'](function(){_0x5299d9[_0xf737('0x73')](function(_0x3c995d){socket[_0xf737('0x74')](_0xf737('0x8b'),{'UserId':_0x3c995d,'OpenchannelQueueId':_0x9fa5fb['id']});});});});});});})[_0xf737('0x29')](respondWithStatusCode(_0x127320,null))[_0xf737('0x4a')](handleError(_0x127320,null));};exports[_0xf737('0x8c')]=function(_0x41ec83,_0x108af8,_0x5c4cfb){return db[_0xf737('0x34')][_0xf737('0x4c')]({'where':{'id':_0x41ec83[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x108af8,null))[_0xf737('0x29')](function(_0x3047c3){if(_0x3047c3){return _0x3047c3[_0xf737('0x8c')](_0x41ec83[_0xf737('0x4e')][_0xf737('0x69')],_[_0xf737('0x8d')](_0x41ec83[_0xf737('0x4e')],['ids','id'])||{})[_0xf737('0x8e')](function(_0x326c91){for(var _0x4e0004=0x0;_0x4e0004<_0x41ec83['body'][_0xf737('0x69')][_0xf737('0x3f')];_0x4e0004+=0x1){socket[_0xf737('0x74')](_0xf737('0x75'),{'UserId':Number(_0x41ec83[_0xf737('0x4e')][_0xf737('0x69')][_0x4e0004]),'OpenchannelQueueId':Number(_0x41ec83[_0xf737('0x4b')]['id'])});}return _0x326c91;});}})[_0xf737('0x29')](respondWithResult(_0x108af8,null))[_0xf737('0x4a')](handleError(_0x108af8,null));};exports[_0xf737('0x8f')]=function(_0x91467d,_0xf27eb0,_0x1014bb){return db[_0xf737('0x34')][_0xf737('0x4c')]({'where':{'id':_0x91467d[_0xf737('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf27eb0,null))['then'](function(_0x29b13f){if(_0x29b13f){return _0x29b13f[_0xf737('0x8f')](_0x91467d['query']['ids'])[_0xf737('0x29')](function(){if(_['isArray'](_0x91467d[_0xf737('0x3b')][_0xf737('0x69')])){for(var _0x5506a9=0x0;_0x5506a9<_0x91467d[_0xf737('0x3b')][_0xf737('0x69')][_0xf737('0x3f')];_0x5506a9+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x91467d['query'][_0xf737('0x69')][_0x5506a9]),'OpenchannelQueueId':Number(_0x91467d[_0xf737('0x4b')]['id'])});}}else{socket[_0xf737('0x74')](_0xf737('0x8b'),{'UserId':Number(_0x91467d['query'][_0xf737('0x69')]),'OpenchannelQueueId':Number(_0x91467d[_0xf737('0x4b')]['id'])});}});}})[_0xf737('0x29')](respondWithStatusCode(_0xf27eb0,null))['catch'](handleError(_0xf27eb0,null));};exports[_0xf737('0x90')]=function(_0x39e78d,_0x3a9d84,_0x1d3985){var _0x17ec93={};var _0x82d2={};var _0x3d7e01;var _0x309b42;return db[_0xf737('0x34')][_0xf737('0x57')]({'where':{'id':_0x39e78d[_0xf737('0x4b')]['id']}})[_0xf737('0x29')](handleEntityNotFound(_0x3a9d84,null))[_0xf737('0x29')](function(_0xce1fd1){if(_0xce1fd1){_0x3d7e01=_0xce1fd1;_0x82d2[_0xf737('0x38')]=_[_0xf737('0x39')](db[_0xf737('0x5c')]['rawAttributes']);_0x82d2[_0xf737('0x3b')]=_[_0xf737('0x39')](_0x39e78d[_0xf737('0x3b')]);_0x82d2['filters']=_[_0xf737('0x3d')](_0x82d2['model'],_0x82d2['query']);_0x17ec93['attributes']=_['intersection'](_0x82d2['model'],qs[_0xf737('0x3e')](_0x39e78d['query'][_0xf737('0x3e')]));_0x17ec93[_0xf737('0x3c')]=_0x17ec93[_0xf737('0x3c')][_0xf737('0x3f')]?_0x17ec93[_0xf737('0x3c')]:_0x82d2[_0xf737('0x38')];_0x17ec93['order']=qs[_0xf737('0x42')](_0x39e78d[_0xf737('0x3b')][_0xf737('0x42')]);_0x17ec93[_0xf737('0x43')]=qs['filters'](_['pick'](_0x39e78d['query'],_0x82d2[_0xf737('0x3a')]));if(_0x39e78d[_0xf737('0x3b')]['filter']){_0x17ec93['where']=_[_0xf737('0x45')](_0x17ec93[_0xf737('0x43')],{'$or':_[_0xf737('0x33')](_0x17ec93['attributes'],function(_0xb9cb9f){var _0x1b9c42={};_0x1b9c42[_0xb9cb9f]={'$like':'%'+_0x39e78d[_0xf737('0x3b')]['filter']+'%'};return _0x1b9c42;})});}_0x17ec93=_['merge']({},_0x17ec93,_0x39e78d[_0xf737('0x46')]);return _0x3d7e01[_0xf737('0x90')](_0x17ec93);}})[_0xf737('0x29')](function(_0x85c597){if(_0x85c597){_0x309b42=_0x85c597['length'];if(!_0x39e78d[_0xf737('0x3b')]['hasOwnProperty'](_0xf737('0x41'))){_0x17ec93[_0xf737('0x23')]=qs[_0xf737('0x23')](_0x39e78d[_0xf737('0x3b')]['limit']);_0x17ec93[_0xf737('0x21')]=qs['offset'](_0x39e78d[_0xf737('0x3b')][_0xf737('0x21')]);}return _0x3d7e01[_0xf737('0x90')](_0x17ec93);}})[_0xf737('0x29')](function(_0x2b3f0e){if(_0x2b3f0e){return _0x2b3f0e?{'count':_0x309b42,'rows':_0x2b3f0e}:null;}})[_0xf737('0x29')](respondWithResult(_0x3a9d84,null))[_0xf737('0x4a')](handleError(_0x3a9d84,null));}; \ No newline at end of file +var _0x9011=['filter','where','merge','options','includeAll','include','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','UserId','agent','updatedAt','rows','SIP','openchannelPause','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','findOrCreate','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x25608b,_0x2f94cd){var _0x3ce042=function(_0x1a8c0c){while(--_0x1a8c0c){_0x25608b['push'](_0x25608b['shift']());}};_0x3ce042(++_0x2f94cd);}(_0x9011,0x1ee));var _0x1901=function(_0xfa4074,_0x49a334){_0xfa4074=_0xfa4074-0x0;var _0x59f498=_0x9011[_0xfa4074];return _0x59f498;};'use strict';var emlformat=require(_0x1901('0x0'));var rimraf=require(_0x1901('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1901('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1901('0x3'));var Mustache=require('mustache');var util=require(_0x1901('0x4'));var path=require(_0x1901('0x5'));var sox=require('sox');var csv=require(_0x1901('0x6'));var ejs=require(_0x1901('0x7'));var fs=require('fs');var fs_extra=require(_0x1901('0x8'));var _=require(_0x1901('0x9'));var squel=require(_0x1901('0xa'));var crypto=require(_0x1901('0xb'));var jsforce=require(_0x1901('0xc'));var deskjs=require(_0x1901('0xd'));var toCsv=require(_0x1901('0x6'));var querystring=require(_0x1901('0xe'));var Papa=require(_0x1901('0xf'));var Redis=require(_0x1901('0x10'));var authService=require(_0x1901('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1901('0x12'))('api');var utils=require(_0x1901('0x13'));var config=require(_0x1901('0x14'));var licenseUtil=require(_0x1901('0x15'));var db=require('../../mysqldb')['db'];config[_0x1901('0x16')]=_[_0x1901('0x17')](config[_0x1901('0x16')],{'host':_0x1901('0x18'),'port':0x18eb});var socket=require(_0x1901('0x19'))(new Redis(config[_0x1901('0x16')]));require(_0x1901('0x1a'))[_0x1901('0x1b')](socket);function respondWithStatusCode(_0x440a12,_0x44069d){_0x44069d=_0x44069d||0xcc;return function(_0x572b2f){if(_0x572b2f){return _0x440a12[_0x1901('0x1c')](_0x44069d);}return _0x440a12[_0x1901('0x1d')](_0x44069d)[_0x1901('0x1e')]();};}function respondWithResult(_0xd399d3,_0xf5203a){_0xf5203a=_0xf5203a||0xc8;return function(_0x335458){if(_0x335458){return _0xd399d3[_0x1901('0x1d')](_0xf5203a)[_0x1901('0x1f')](_0x335458);}};}function respondWithFilteredResult(_0x42d0c4,_0x1d0b6e){return function(_0x1a94d6){if(_0x1a94d6){var _0x78c041=typeof _0x1d0b6e[_0x1901('0x20')]===_0x1901('0x21')&&typeof _0x1d0b6e[_0x1901('0x22')]===_0x1901('0x21');var _0x38df1f=_0x1a94d6[_0x1901('0x23')];var _0x3c725e=_0x78c041?0x0:_0x1d0b6e[_0x1901('0x20')];var _0x2f42b4=_0x78c041?_0x1a94d6[_0x1901('0x23')]:_0x1d0b6e[_0x1901('0x20')]+_0x1d0b6e['limit'];var _0x2bf111;if(_0x2f42b4>=_0x38df1f){_0x2f42b4=_0x38df1f;_0x2bf111=0xc8;}else{_0x2bf111=0xce;}_0x42d0c4['status'](_0x2bf111);return _0x42d0c4[_0x1901('0x24')](_0x1901('0x25'),_0x3c725e+'-'+_0x2f42b4+'/'+_0x38df1f)[_0x1901('0x1f')](_0x1a94d6);}return null;};}function patchUpdates(_0x547634){return function(_0x28866b){try{jsonpatch[_0x1901('0x26')](_0x28866b,_0x547634,!![]);}catch(_0x387464){return BPromise[_0x1901('0x27')](_0x387464);}return _0x28866b[_0x1901('0x28')]();};}function saveUpdates(_0x3e58a9,_0x9137c0){return function(_0x119caa){if(_0x119caa){return _0x119caa[_0x1901('0x29')](_0x3e58a9)[_0x1901('0x2a')](function(_0x27e1ff){return _0x27e1ff;});}return null;};}function removeEntity(_0x50836d,_0x3219f5){return function(_0x3bd829){if(_0x3bd829){return _0x3bd829[_0x1901('0x2b')]()[_0x1901('0x2a')](function(){var _0x1f47cf=_0x3bd829[_0x1901('0x2c')]({'plain':!![]});var _0x345acb=_0x1901('0x2d');return db[_0x1901('0x2e')][_0x1901('0x2b')]({'where':{'type':_0x345acb,'resourceId':_0x1f47cf['id']}})[_0x1901('0x2a')](function(){return _0x3bd829;});})[_0x1901('0x2a')](function(){_0x50836d[_0x1901('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bc982,_0x55d3bc){return function(_0x1afa7e){if(!_0x1afa7e){_0x4bc982['sendStatus'](0x194);}return _0x1afa7e;};}function handleError(_0x3ee6fc,_0x13ce1f){_0x13ce1f=_0x13ce1f||0x1f4;return function(_0x116f2e){logger['error'](_0x116f2e[_0x1901('0x2f')]);if(_0x116f2e[_0x1901('0x30')]){delete _0x116f2e[_0x1901('0x30')];}_0x3ee6fc[_0x1901('0x1d')](_0x13ce1f)[_0x1901('0x31')](_0x116f2e);};}exports[_0x1901('0x32')]=function(_0x5961f7,_0x54be5d){var _0x412e6f={},_0xd50f3={},_0x32da7b={'count':0x0,'rows':[]};var _0xd34371=_[_0x1901('0x33')](db[_0x1901('0x34')][_0x1901('0x35')],function(_0x167400){return{'name':_0x167400[_0x1901('0x36')],'type':_0x167400[_0x1901('0x37')][_0x1901('0x38')]};});_0xd50f3[_0x1901('0x39')]=_[_0x1901('0x33')](_0xd34371,_0x1901('0x30'));_0xd50f3[_0x1901('0x3a')]=_[_0x1901('0x3b')](_0x5961f7[_0x1901('0x3a')]);_0xd50f3[_0x1901('0x3c')]=_[_0x1901('0x3d')](_0xd50f3[_0x1901('0x39')],_0xd50f3[_0x1901('0x3a')]);_0x412e6f[_0x1901('0x3e')]=_[_0x1901('0x3d')](_0xd50f3[_0x1901('0x39')],qs[_0x1901('0x3f')](_0x5961f7[_0x1901('0x3a')]['fields']));_0x412e6f[_0x1901('0x3e')]=_0x412e6f[_0x1901('0x3e')][_0x1901('0x40')]?_0x412e6f[_0x1901('0x3e')]:_0xd50f3[_0x1901('0x39')];if(!_0x5961f7['query'][_0x1901('0x41')](_0x1901('0x42'))){_0x412e6f['limit']=qs[_0x1901('0x22')](_0x5961f7['query'][_0x1901('0x22')]);_0x412e6f[_0x1901('0x20')]=qs['offset'](_0x5961f7['query']['offset']);}_0x412e6f[_0x1901('0x43')]=qs[_0x1901('0x44')](_0x5961f7['query']['sort']);_0x412e6f['where']=qs[_0x1901('0x3c')](_[_0x1901('0x45')](_0x5961f7[_0x1901('0x3a')],_0xd50f3[_0x1901('0x3c')]),_0xd34371);if(_0x5961f7[_0x1901('0x3a')][_0x1901('0x46')]){_0x412e6f[_0x1901('0x47')]=_['merge'](_0x412e6f[_0x1901('0x47')],{'$or':_['map'](_0xd34371,function(_0x2392d5){if(_0x2392d5['type']!=='VIRTUAL'){var _0x5d2d50={};_0x5d2d50[_0x2392d5['name']]={'$like':'%'+_0x5961f7[_0x1901('0x3a')]['filter']+'%'};return _0x5d2d50;}})});}_0x412e6f=_[_0x1901('0x48')]({},_0x412e6f,_0x5961f7[_0x1901('0x49')]);var _0x230082={'where':_0x412e6f[_0x1901('0x47')]};return db['OpenchannelQueue']['count'](_0x230082)['then'](function(_0x1e53db){_0x32da7b['count']=_0x1e53db;if(_0x5961f7[_0x1901('0x3a')][_0x1901('0x4a')]){_0x412e6f[_0x1901('0x4b')]=[{'all':!![]}];}return db[_0x1901('0x34')]['findAll'](_0x412e6f);})[_0x1901('0x2a')](function(_0x45a5b1){_0x32da7b['rows']=_0x45a5b1;return _0x32da7b;})[_0x1901('0x2a')](respondWithFilteredResult(_0x54be5d,_0x412e6f))['catch'](handleError(_0x54be5d,null));};exports[_0x1901('0x4c')]=function(_0x217b60,_0x3ce7a4){var _0x4c4785={'raw':!![],'where':{'id':_0x217b60[_0x1901('0x4d')]['id']}},_0x31287f={};_0x31287f[_0x1901('0x39')]=_[_0x1901('0x3b')](db[_0x1901('0x34')][_0x1901('0x35')]);_0x31287f[_0x1901('0x3a')]=_[_0x1901('0x3b')](_0x217b60[_0x1901('0x3a')]);_0x31287f[_0x1901('0x3c')]=_[_0x1901('0x3d')](_0x31287f[_0x1901('0x39')],_0x31287f['query']);_0x4c4785[_0x1901('0x3e')]=_[_0x1901('0x3d')](_0x31287f[_0x1901('0x39')],qs[_0x1901('0x3f')](_0x217b60[_0x1901('0x3a')]['fields']));_0x4c4785[_0x1901('0x3e')]=_0x4c4785['attributes'][_0x1901('0x40')]?_0x4c4785[_0x1901('0x3e')]:_0x31287f[_0x1901('0x39')];if(_0x217b60[_0x1901('0x3a')][_0x1901('0x4a')]){_0x4c4785[_0x1901('0x4b')]=[{'all':!![]}];}_0x4c4785=_['merge']({},_0x4c4785,_0x217b60[_0x1901('0x49')]);return db[_0x1901('0x34')][_0x1901('0x4e')](_0x4c4785)[_0x1901('0x2a')](handleEntityNotFound(_0x3ce7a4,null))[_0x1901('0x2a')](respondWithResult(_0x3ce7a4,null))[_0x1901('0x4f')](handleError(_0x3ce7a4,null));};exports[_0x1901('0x50')]=function(_0x1ffb36,_0x2bc5f9){return db[_0x1901('0x34')][_0x1901('0x50')](_0x1ffb36[_0x1901('0x51')],{})['then'](function(_0x369221){var _0x166dc2=_0x1ffb36['user'][_0x1901('0x2c')]({'plain':!![]});if(!_0x166dc2)throw new Error(_0x1901('0x52'));if(_0x166dc2[_0x1901('0x53')]===_0x1901('0x54')){var _0x586003=_0x369221['get']({'plain':!![]});var _0x44a605='OpenchannelQueues';return db[_0x1901('0x55')][_0x1901('0x4e')]({'where':{'name':_0x44a605,'userProfileId':_0x166dc2['userProfileId']},'raw':!![]})[_0x1901('0x2a')](function(_0x4c12bb){if(_0x4c12bb&&_0x4c12bb['autoAssociation']===0x0){return db[_0x1901('0x2e')][_0x1901('0x50')]({'name':_0x586003['name'],'resourceId':_0x586003['id'],'type':_0x4c12bb['name'],'sectionId':_0x4c12bb['id']},{})[_0x1901('0x2a')](function(){return _0x369221;});}else{return _0x369221;}})['catch'](function(_0x2ea45a){logger[_0x1901('0x56')](_0x1901('0x57'),_0x2ea45a);throw _0x2ea45a;});}return _0x369221;})[_0x1901('0x2a')](respondWithResult(_0x2bc5f9,0xc9))['catch'](handleError(_0x2bc5f9,null));};exports[_0x1901('0x29')]=function(_0x592e92,_0xb369b8){if(_0x592e92[_0x1901('0x51')]['id']){delete _0x592e92['body']['id'];}return db[_0x1901('0x34')]['find']({'where':{'id':_0x592e92[_0x1901('0x4d')]['id']}})[_0x1901('0x2a')](handleEntityNotFound(_0xb369b8,null))[_0x1901('0x2a')](saveUpdates(_0x592e92[_0x1901('0x51')],null))[_0x1901('0x2a')](respondWithResult(_0xb369b8,null))[_0x1901('0x4f')](handleError(_0xb369b8,null));};exports[_0x1901('0x2b')]=function(_0x33fdce,_0x276e39){return db[_0x1901('0x34')][_0x1901('0x4e')]({'where':{'id':_0x33fdce[_0x1901('0x4d')]['id']}})[_0x1901('0x2a')](handleEntityNotFound(_0x276e39,null))[_0x1901('0x2a')](removeEntity(_0x276e39,null))[_0x1901('0x4f')](handleError(_0x276e39,null));};exports[_0x1901('0x58')]=function(_0x15f560,_0x2b4389){return db[_0x1901('0x34')][_0x1901('0x58')]()[_0x1901('0x2a')](respondWithResult(_0x2b4389,null))[_0x1901('0x4f')](handleError(_0x2b4389,null));};exports[_0x1901('0x59')]=function(_0x1d242e,_0x7ee11d,_0x13982d){var _0x1f523e={'raw':!![],'where':{}},_0x364ad6={},_0x118cfe;return db[_0x1901('0x34')][_0x1901('0x5a')]({'where':{'id':_0x1d242e['params']['id']}})['then'](handleEntityNotFound(_0x7ee11d,null))[_0x1901('0x2a')](function(_0x6078c3){if(_0x6078c3){_0x118cfe=_0x6078c3['get']({'plain':!![]});_0x364ad6[_0x1901('0x39')]=_[_0x1901('0x3b')](db[_0x1901('0x5b')][_0x1901('0x35')]);_0x364ad6[_0x1901('0x3a')]=_[_0x1901('0x3b')](_0x1d242e[_0x1901('0x3a')]);_0x364ad6[_0x1901('0x3c')]=_[_0x1901('0x3d')](_0x364ad6[_0x1901('0x39')],_0x364ad6[_0x1901('0x3a')]);_0x1f523e[_0x1901('0x3e')]=_['intersection'](_0x364ad6[_0x1901('0x39')],qs[_0x1901('0x3f')](_0x1d242e[_0x1901('0x3a')][_0x1901('0x3f')]));_0x1f523e['attributes']=_0x1f523e[_0x1901('0x3e')][_0x1901('0x40')]?_0x1f523e[_0x1901('0x3e')]:_0x364ad6[_0x1901('0x39')];if(!_0x1d242e[_0x1901('0x3a')]['hasOwnProperty'](_0x1901('0x42'))){_0x1f523e['limit']=qs[_0x1901('0x22')](_0x1d242e[_0x1901('0x3a')][_0x1901('0x22')]);_0x1f523e[_0x1901('0x20')]=qs[_0x1901('0x20')](_0x1d242e['query']['offset']);}_0x1f523e[_0x1901('0x43')]=qs[_0x1901('0x44')](_0x1d242e[_0x1901('0x3a')][_0x1901('0x44')]);_0x1f523e[_0x1901('0x47')]=qs['filters'](_[_0x1901('0x45')](_0x1d242e[_0x1901('0x3a')],_0x364ad6['filters']));_0x1f523e[_0x1901('0x47')][_0x1901('0x5c')]=_0x6078c3['id'];if(_0x1d242e['query'][_0x1901('0x46')]){_0x1f523e['where']=_[_0x1901('0x48')](_0x1f523e[_0x1901('0x47')],{'$or':_['map'](_0x1f523e['attributes'],function(_0x32ea04){var _0x4a502a={};_0x4a502a[_0x32ea04]={'$like':'%'+_0x1d242e[_0x1901('0x3a')]['filter']+'%'};return _0x4a502a;})});}_0x1f523e=_[_0x1901('0x48')]({},_0x1f523e,_0x1d242e[_0x1901('0x49')]);return db['UserOpenchannelQueue'][_0x1901('0x5d')](_0x1f523e);}})[_0x1901('0x2a')](function(_0x1a270a){if(_0x1a270a){return db[_0x1901('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x1a270a,_0x1901('0x5f')),'role':_0x1901('0x60')},'attributes':['id','name','openchannelPause',_0x1901('0x61'),'createdAt']});}})[_0x1901('0x2a')](function(_0x17905e){if(_0x17905e){return{'count':_0x17905e[_0x1901('0x23')],'rows':_['map'](_0x17905e[_0x1901('0x62')],function(_0x1d7a3e){return{'membername':_0x1d7a3e['name'],'UserId':_0x1d7a3e['id'],'queue_name':_0x118cfe[_0x1901('0x30')],'OpenchannelQueueId':_0x118cfe['id'],'interface':util['format']('%s/%s',_0x1901('0x63'),_0x1d7a3e['name']),'penalty':0x0,'paused':_0x1d7a3e[_0x1901('0x64')],'createdAt':_0x1d7a3e[_0x1901('0x65')],'updatedAt':_0x1d7a3e[_0x1901('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1901('0x2a')](respondWithFilteredResult(_0x7ee11d,_0x1f523e))[_0x1901('0x4f')](handleError(_0x7ee11d,null));};exports[_0x1901('0x66')]=function(_0x1c85eb,_0xd3837d,_0x1667fc){var _0x27e0dc={};var _0x47bdd0={};var _0x2068a2;var _0x149761;return db[_0x1901('0x34')][_0x1901('0x5a')]({'where':{'id':_0x1c85eb[_0x1901('0x4d')]['id']}})[_0x1901('0x2a')](handleEntityNotFound(_0xd3837d,null))[_0x1901('0x2a')](function(_0x5c7b41){if(_0x5c7b41){_0x2068a2=_0x5c7b41;_0x47bdd0[_0x1901('0x39')]=_[_0x1901('0x3b')](db[_0x1901('0x67')][_0x1901('0x35')]);_0x47bdd0[_0x1901('0x3a')]=_[_0x1901('0x3b')](_0x1c85eb[_0x1901('0x3a')]);_0x47bdd0['filters']=_[_0x1901('0x3d')](_0x47bdd0['model'],_0x47bdd0[_0x1901('0x3a')]);_0x27e0dc['attributes']=_[_0x1901('0x3d')](_0x47bdd0[_0x1901('0x39')],qs[_0x1901('0x3f')](_0x1c85eb[_0x1901('0x3a')][_0x1901('0x3f')]));_0x27e0dc[_0x1901('0x3e')]=_0x27e0dc[_0x1901('0x3e')]['length']?_0x27e0dc[_0x1901('0x3e')]:_0x47bdd0[_0x1901('0x39')];_0x27e0dc[_0x1901('0x43')]=qs['sort'](_0x1c85eb[_0x1901('0x3a')][_0x1901('0x44')]);_0x27e0dc[_0x1901('0x47')]=qs[_0x1901('0x3c')](_[_0x1901('0x45')](_0x1c85eb[_0x1901('0x3a')],_0x47bdd0[_0x1901('0x3c')]));if(_0x1c85eb[_0x1901('0x3a')]['filter']){_0x27e0dc[_0x1901('0x47')]=_[_0x1901('0x48')](_0x27e0dc['where'],{'$or':_[_0x1901('0x33')](_0x27e0dc[_0x1901('0x3e')],function(_0x372318){var _0x5e5bb4={};_0x5e5bb4[_0x372318]={'$like':'%'+_0x1c85eb[_0x1901('0x3a')]['filter']+'%'};return _0x5e5bb4;})});}_0x27e0dc=_['merge']({},_0x27e0dc,_0x1c85eb['options']);return _0x2068a2['getTeams'](_0x27e0dc);}})[_0x1901('0x2a')](function(_0x47669f){if(_0x47669f){_0x149761=_0x47669f[_0x1901('0x40')];if(!_0x1c85eb[_0x1901('0x3a')][_0x1901('0x41')](_0x1901('0x42'))){_0x27e0dc[_0x1901('0x22')]=qs[_0x1901('0x22')](_0x1c85eb[_0x1901('0x3a')]['limit']);_0x27e0dc[_0x1901('0x20')]=qs['offset'](_0x1c85eb[_0x1901('0x3a')][_0x1901('0x20')]);}return _0x2068a2[_0x1901('0x66')](_0x27e0dc);}})[_0x1901('0x2a')](function(_0x491e58){if(_0x491e58){return _0x491e58?{'count':_0x149761,'rows':_0x491e58}:null;}})[_0x1901('0x2a')](respondWithResult(_0xd3837d,null))['catch'](handleError(_0xd3837d,null));};exports[_0x1901('0x68')]=function(_0x313c2b,_0x35fb77,_0x430eb1){var _0x5129ae=_0x313c2b[_0x1901('0x51')][_0x1901('0x69')];return db[_0x1901('0x67')][_0x1901('0x5d')]({'where':{'id':_0x5129ae},'attributes':['id'],'include':[{'model':db[_0x1901('0x5e')],'as':_0x1901('0x6a'),'attributes':['id',_0x1901('0x30'),'online',_0x1901('0x6b'),'interface'],'raw':!![]}]})[_0x1901('0x2a')](function(_0x15ed4a){if(_0x15ed4a){var _0x5b49f4=_[_0x1901('0x6c')](_0x15ed4a,function(_0x1a2e35){var _0x44451b=_0x1a2e35[_0x1901('0x2c')]({'plain':!![]});return _0x44451b[_0x1901('0x6a')];});return db[_0x1901('0x34')][_0x1901('0x4e')]({'where':{'id':_0x313c2b[_0x1901('0x4d')]['id']}})['then'](function(_0x1779c9){return db[_0x1901('0x6d')][_0x1901('0x6e')](function(_0x1f27d9){return _0x1779c9[_0x1901('0x68')](_0x5129ae,{'transaction':_0x1f27d9})[_0x1901('0x2a')](function(){return BPromise['each'](_0x5b49f4,function(_0x457e9d){return db['UserOpenchannelQueue'][_0x1901('0x6f')]({'where':{'UserId':_0x457e9d['id'],'OpenchannelQueueId':_0x313c2b[_0x1901('0x4d')]['id']},'transaction':_0x1f27d9});});})[_0x1901('0x2a')](function(){_0x5b49f4['forEach'](function(_0xe80b19){socket['emit'](_0x1901('0x70'),{'UserId':_0xe80b19['id'],'OpenchannelQueueId':_0x1779c9['id']});});});});});}})[_0x1901('0x2a')](respondWithStatusCode(_0x35fb77,null))['catch'](handleError(_0x35fb77,null));};exports[_0x1901('0x71')]=function(_0x152c52,_0x95403e,_0x5e4adf){return db[_0x1901('0x67')][_0x1901('0x5d')]({'where':{'id':_0x152c52[_0x1901('0x3a')][_0x1901('0x69')]},'attributes':['id'],'include':[{'model':db[_0x1901('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1901('0x2a')](handleEntityNotFound(_0x95403e,null))[_0x1901('0x2a')](function(_0x44a897){var _0x15c7cb=_[_0x1901('0x33')](_0x44a897,'id');var _0x514f5e=[];var _0x1ca8d1=[];var _0x53d5b2=squel['select']();_0x53d5b2[_0x1901('0x72')](_0x1901('0x73'))[_0x1901('0x74')](_0x1901('0x75'),'tq')[_0x1901('0x76')]('user_has_teams','ut',_0x1901('0x77'))[_0x1901('0x47')](_0x1901('0x78'),_0x152c52[_0x1901('0x4d')]['id']);for(var _0x32a752=0x0;_0x32a752<_0x44a897[_0x1901('0x40')];_0x32a752+=0x1){let _0x4d332c=_0x44a897[_0x32a752];for(var _0x5f0a1c=0x0;_0x5f0a1c<_0x4d332c['Agents'][_0x1901('0x40')];_0x5f0a1c+=0x1){let _0x38e6a8=_0x4d332c[_0x1901('0x6a')][_0x5f0a1c];var _0x46ab06=_0x53d5b2[_0x1901('0x79')]();_0x46ab06['where']('ut.UserId\x20=\x20?',_0x38e6a8['id']);_0x1ca8d1['push'](db[_0x1901('0x6d')]['query'](_0x46ab06[_0x1901('0x7a')](),{'type':db['sequelize'][_0x1901('0x7b')][_0x1901('0x7c')]})[_0x1901('0x2a')](function(_0x5957fb){if(_0x5957fb[_0x1901('0x40')]===0x1){return _0x38e6a8['id'];}else{var _0x5bc630=_[_0x1901('0x7d')](_[_0x1901('0x33')](_0x5957fb,_0x1901('0x7e')),function(_0x57b9ad){return _[_0x1901('0x7f')](_0x15c7cb,_0x57b9ad);});if(_0x5bc630){return _0x38e6a8['id'];}}}));}}return BPromise[_0x1901('0x80')](_0x1ca8d1)[_0x1901('0x2a')](function(_0x4de7ad){_0x514f5e=_(_0x514f5e)['union'](_0x4de7ad)[_0x1901('0x81')]()[_0x1901('0x82')]();return db[_0x1901('0x34')][_0x1901('0x4e')]({'where':{'id':_0x152c52['params']['id']}})[_0x1901('0x2a')](function(_0x479abf){return db[_0x1901('0x6d')][_0x1901('0x6e')](function(_0x9f720a){return _0x479abf[_0x1901('0x71')](_0x152c52[_0x1901('0x3a')]['ids'],{'transaction':_0x9f720a})['then'](function(){if(!_[_0x1901('0x83')](_0x514f5e)){return _0x479abf[_0x1901('0x84')](_0x514f5e,{'transaction':_0x9f720a});}})[_0x1901('0x2a')](function(){_0x514f5e[_0x1901('0x85')](function(_0x3a3f6b){socket['emit'](_0x1901('0x86'),{'UserId':_0x3a3f6b,'OpenchannelQueueId':_0x479abf['id']});});});});});});})[_0x1901('0x2a')](respondWithStatusCode(_0x95403e,null))[_0x1901('0x4f')](handleError(_0x95403e,null));};exports[_0x1901('0x87')]=function(_0x1e01c2,_0x4b84da,_0x571a39){return db[_0x1901('0x34')]['find']({'where':{'id':_0x1e01c2[_0x1901('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4b84da,null))[_0x1901('0x2a')](function(_0x2a11c2){if(_0x2a11c2){return _0x2a11c2['addAgents'](_0x1e01c2[_0x1901('0x51')][_0x1901('0x69')],_[_0x1901('0x88')](_0x1e01c2[_0x1901('0x51')],[_0x1901('0x69'),'id'])||{})[_0x1901('0x89')](function(_0x44b739){for(var _0x4367ab=0x0;_0x4367ab<_0x1e01c2[_0x1901('0x51')]['ids']['length'];_0x4367ab+=0x1){socket[_0x1901('0x8a')](_0x1901('0x70'),{'UserId':Number(_0x1e01c2['body'][_0x1901('0x69')][_0x4367ab]),'OpenchannelQueueId':Number(_0x1e01c2[_0x1901('0x4d')]['id'])});}return _0x44b739;});}})[_0x1901('0x2a')](respondWithResult(_0x4b84da,null))[_0x1901('0x4f')](handleError(_0x4b84da,null));};exports[_0x1901('0x84')]=function(_0x63b5d0,_0x7be9c9,_0x2f3d98){return db[_0x1901('0x34')]['find']({'where':{'id':_0x63b5d0[_0x1901('0x4d')]['id']}})[_0x1901('0x2a')](handleEntityNotFound(_0x7be9c9,null))[_0x1901('0x2a')](function(_0x3b88ad){if(_0x3b88ad){return _0x3b88ad[_0x1901('0x84')](_0x63b5d0['query'][_0x1901('0x69')])[_0x1901('0x2a')](function(){if(_[_0x1901('0x8b')](_0x63b5d0[_0x1901('0x3a')][_0x1901('0x69')])){for(var _0x54ce61=0x0;_0x54ce61<_0x63b5d0[_0x1901('0x3a')][_0x1901('0x69')][_0x1901('0x40')];_0x54ce61+=0x1){socket[_0x1901('0x8a')](_0x1901('0x86'),{'UserId':Number(_0x63b5d0[_0x1901('0x3a')][_0x1901('0x69')][_0x54ce61]),'OpenchannelQueueId':Number(_0x63b5d0[_0x1901('0x4d')]['id'])});}}else{socket[_0x1901('0x8a')](_0x1901('0x86'),{'UserId':Number(_0x63b5d0[_0x1901('0x3a')]['ids']),'OpenchannelQueueId':Number(_0x63b5d0[_0x1901('0x4d')]['id'])});}});}})[_0x1901('0x2a')](respondWithStatusCode(_0x7be9c9,null))[_0x1901('0x4f')](handleError(_0x7be9c9,null));};exports[_0x1901('0x8c')]=function(_0x35220b,_0x146122,_0x4b06dc){var _0x54022a={};var _0xe09158={};var _0x83c960;var _0x45b8e0;return db['OpenchannelQueue'][_0x1901('0x5a')]({'where':{'id':_0x35220b[_0x1901('0x4d')]['id']}})[_0x1901('0x2a')](handleEntityNotFound(_0x146122,null))[_0x1901('0x2a')](function(_0x2b9c3c){if(_0x2b9c3c){_0x83c960=_0x2b9c3c;_0xe09158['model']=_[_0x1901('0x3b')](db[_0x1901('0x5e')][_0x1901('0x35')]);_0xe09158[_0x1901('0x3a')]=_['keys'](_0x35220b[_0x1901('0x3a')]);_0xe09158[_0x1901('0x3c')]=_['intersection'](_0xe09158['model'],_0xe09158[_0x1901('0x3a')]);_0x54022a[_0x1901('0x3e')]=_[_0x1901('0x3d')](_0xe09158[_0x1901('0x39')],qs[_0x1901('0x3f')](_0x35220b[_0x1901('0x3a')][_0x1901('0x3f')]));_0x54022a[_0x1901('0x3e')]=_0x54022a[_0x1901('0x3e')][_0x1901('0x40')]?_0x54022a[_0x1901('0x3e')]:_0xe09158[_0x1901('0x39')];_0x54022a[_0x1901('0x43')]=qs[_0x1901('0x44')](_0x35220b[_0x1901('0x3a')]['sort']);_0x54022a[_0x1901('0x47')]=qs[_0x1901('0x3c')](_[_0x1901('0x45')](_0x35220b[_0x1901('0x3a')],_0xe09158['filters']));if(_0x35220b[_0x1901('0x3a')][_0x1901('0x46')]){_0x54022a['where']=_['merge'](_0x54022a[_0x1901('0x47')],{'$or':_['map'](_0x54022a['attributes'],function(_0x332ff3){var _0x1068ec={};_0x1068ec[_0x332ff3]={'$like':'%'+_0x35220b[_0x1901('0x3a')][_0x1901('0x46')]+'%'};return _0x1068ec;})});}_0x54022a=_[_0x1901('0x48')]({},_0x54022a,_0x35220b[_0x1901('0x49')]);return _0x83c960[_0x1901('0x8c')](_0x54022a);}})[_0x1901('0x2a')](function(_0x507177){if(_0x507177){_0x45b8e0=_0x507177['length'];if(!_0x35220b[_0x1901('0x3a')]['hasOwnProperty'](_0x1901('0x42'))){_0x54022a['limit']=qs[_0x1901('0x22')](_0x35220b['query']['limit']);_0x54022a[_0x1901('0x20')]=qs[_0x1901('0x20')](_0x35220b[_0x1901('0x3a')][_0x1901('0x20')]);}return _0x83c960[_0x1901('0x8c')](_0x54022a);}})[_0x1901('0x2a')](function(_0x584f2f){if(_0x584f2f){return _0x584f2f?{'count':_0x45b8e0,'rows':_0x584f2f}:null;}})[_0x1901('0x2a')](respondWithResult(_0x146122,null))[_0x1901('0x4f')](handleError(_0x146122,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 67b5f6a..8dde06f 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 _0xa8ca=['hook','exports','events','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x1ba3a8,_0xc9b19f){var _0x3d17e6=function(_0x1b3cbc){while(--_0x1b3cbc){_0x1ba3a8['push'](_0x1ba3a8['shift']());}};_0x3d17e6(++_0xc9b19f);}(_0xa8ca,0x17a));var _0xaa8c=function(_0xedc108,_0x394f65){_0xedc108=_0xedc108-0x0;var _0x3b09eb=_0xa8ca[_0xedc108];return _0x3b09eb;};'use strict';var EventEmitter=require(_0xaa8c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xaa8c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaa8c('0x2')](0x0);var events={'afterCreate':_0xaa8c('0x3'),'afterUpdate':'update','afterDestroy':_0xaa8c('0x4')};function emitEvent(_0xbb5f4b){return function(_0x3e857a,_0x4c4e8c,_0x206914){OpenchannelQueueEvents[_0xaa8c('0x5')](_0xbb5f4b+':'+_0x3e857a['id'],_0x3e857a);OpenchannelQueueEvents['emit'](_0xbb5f4b,_0x3e857a);_0x206914(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xaa8c('0x6')](e,emitEvent(event));}}module[_0xaa8c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xbb5f=['events','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hook','exports'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xbb5f,0x19e));var _0xfbb5=function(_0x5af1b8,_0xc10b1c){_0x5af1b8=_0x5af1b8-0x0;var _0x341484=_0xbb5f[_0x5af1b8];return _0x341484;};'use strict';var EventEmitter=require(_0xfbb5('0x0'));var OpenchannelQueue=require(_0xfbb5('0x1'))['db'][_0xfbb5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbb5('0x3'),'afterUpdate':_0xfbb5('0x4'),'afterDestroy':_0xfbb5('0x5')};function emitEvent(_0x42eef4){return function(_0x12e1e8,_0x14853d,_0x5b77a1){OpenchannelQueueEvents[_0xfbb5('0x6')](_0x42eef4+':'+_0x12e1e8['id'],_0x12e1e8);OpenchannelQueueEvents[_0xfbb5('0x6')](_0x42eef4,_0x12e1e8);_0x5b77a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xfbb5('0x7')](e,emitEvent(event));}}module[_0xfbb5('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3f113f3..e86254e 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 _0xf0a6=['../../config/logger','bluebird','path','exports','define','OpenchannelQueue','lodash'];(function(_0x52090d,_0x42b4a7){var _0x1878f0=function(_0x506bc4){while(--_0x506bc4){_0x52090d['push'](_0x52090d['shift']());}};_0x1878f0(++_0x42b4a7);}(_0xf0a6,0x1d4));var _0x6f0a=function(_0x3e15f4,_0x2d29a1){_0x3e15f4=_0x3e15f4-0x0;var _0x3bb93d=_0xf0a6[_0x3e15f4];return _0x3bb93d;};'use strict';var _=require(_0x6f0a('0x0'));var util=require('util');var logger=require(_0x6f0a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6f0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f0a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x6f0a('0x4')]=function(_0x39ad6a,_0x112dd1){return _0x39ad6a[_0x6f0a('0x5')](_0x6f0a('0x6'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6efc=['exports','define','OpenchannelQueue','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4f9970,_0x2759db){var _0x5efd3e=function(_0x313095){while(--_0x313095){_0x4f9970['push'](_0x4f9970['shift']());}};_0x5efd3e(++_0x2759db);}(_0x6efc,0x99));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xc6ef('0x0'));var logger=require(_0xc6ef('0x1'))(_0xc6ef('0x2'));var moment=require(_0xc6ef('0x3'));var BPromise=require(_0xc6ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc6ef('0x5'));var config=require(_0xc6ef('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xc6ef('0x7')]=function(_0x485886,_0xd1b110){return _0x485886[_0xc6ef('0x8')](_0xc6ef('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 4b86889..410992c 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 _0xee9d=['OpenchannelQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x116b68,_0x110ad3){var _0x1ed2ab=function(_0x2291da){while(--_0x2291da){_0x116b68['push'](_0x116b68['shift']());}};_0x1ed2ab(++_0x110ad3);}(_0xee9d,0x11a));var _0xdee9=function(_0x1068e1,_0x510176){_0x1068e1=_0x1068e1-0x0;var _0x4c741a=_0xee9d[_0x1068e1];return _0x4c741a;};'use strict';var _=require('lodash');var util=require(_0xdee9('0x0'));var moment=require(_0xdee9('0x1'));var BPromise=require('bluebird');var rs=require(_0xdee9('0x2'));var fs=require('fs');var Redis=require(_0xdee9('0x3'));var db=require(_0xdee9('0x4'))['db'];var utils=require(_0xdee9('0x5'));var logger=require(_0xdee9('0x6'))(_0xdee9('0x7'));var config=require(_0xdee9('0x8'));var jayson=require(_0xdee9('0x9'));var client=jayson[_0xdee9('0xa')][_0xdee9('0xb')]({'port':0x232a});config[_0xdee9('0xc')]=_[_0xdee9('0xd')](config[_0xdee9('0xc')],{'host':_0xdee9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdee9('0xc')]));require('./openchannelQueue.socket')[_0xdee9('0xf')](socket);function respondWithRpcPromise(_0x31eec6,_0x23c350,_0x556094){return new BPromise(function(_0x46e99c,_0x432cce){return client['request'](_0x31eec6,_0x556094)[_0xdee9('0x10')](function(_0x29d933){logger[_0xdee9('0x11')](_0xdee9('0x12'),_0x23c350,'request\x20sent');logger[_0xdee9('0x13')](_0xdee9('0x14'),_0x23c350,_0xdee9('0x15'),JSON[_0xdee9('0x16')](_0x29d933));if(_0x29d933['error']){if(_0x29d933[_0xdee9('0x17')][_0xdee9('0x18')]===0x1f4){logger[_0xdee9('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x23c350,_0x29d933[_0xdee9('0x17')]['message']);return _0x432cce(_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);}logger[_0xdee9('0x17')](_0xdee9('0x12'),_0x23c350,_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);return _0x46e99c(_0x29d933[_0xdee9('0x17')][_0xdee9('0x19')]);}else{logger[_0xdee9('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x23c350,'request\x20sent');_0x46e99c(_0x29d933[_0xdee9('0x1a')][_0xdee9('0x19')]);}})['catch'](function(_0x40c96d){logger[_0xdee9('0x17')](_0xdee9('0x12'),_0x23c350,_0x40c96d);_0x432cce(_0x40c96d);});});}exports[_0xdee9('0x1b')]=function(_0xb5f9a5){var _0x53427d=this;return new Promise(function(_0x17e151,_0x3ed07e){return db['OpenchannelQueue'][_0xdee9('0x1c')]({'raw':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x1e')]===undefined?!![]:![]:!![],'where':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x1f')]||null:null,'attributes':_0xb5f9a5[_0xdee9('0x1d')]?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x20')]||null:null,'limit':_0xb5f9a5['options']?_0xb5f9a5['options'][_0xdee9('0x21')]||null:null,'include':_0xb5f9a5['options']?_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x22')]?_[_0xdee9('0x23')](_0xb5f9a5[_0xdee9('0x1d')][_0xdee9('0x22')],function(_0x2c163d){return{'model':db[_0x2c163d[_0xdee9('0x24')]],'as':_0x2c163d['as'],'attributes':_0x2c163d[_0xdee9('0x20')],'include':_0x2c163d[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x2c163d[_0xdee9('0x22')],function(_0x9e06ca){return{'model':db[_0x9e06ca['model']],'as':_0x9e06ca['as'],'attributes':_0x9e06ca['attributes'],'include':_0x9e06ca[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x9e06ca[_0xdee9('0x22')],function(_0x4d0ec0){return{'model':db[_0x4d0ec0['model']],'as':_0x4d0ec0['as'],'attributes':_0x4d0ec0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c75f1){logger[_0xdee9('0x11')](_0xdee9('0x1b'),_0xb5f9a5);logger[_0xdee9('0x13')]('GetOpenchannelQueue',_0xb5f9a5,JSON[_0xdee9('0x16')](_0x2c75f1));_0x17e151(_0x2c75f1);})['catch'](function(_0xa942d3){logger['error'](_0xdee9('0x1b'),_0xa942d3[_0xdee9('0x19')],_0xb5f9a5);_0x3ed07e(_0x53427d[_0xdee9('0x17')](0x1f4,_0xa942d3[_0xdee9('0x19')]));});});};exports[_0xdee9('0x25')]=function(_0x1ec5b6){var _0x3f6fff=this;return new Promise(function(_0x4c42b9,_0x5935e6){return db[_0xdee9('0x26')][_0xdee9('0x27')]({'raw':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6[_0xdee9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6['options'][_0xdee9('0x1f')]||null:null,'attributes':_0x1ec5b6[_0xdee9('0x1d')]?_0x1ec5b6['options'][_0xdee9('0x20')]||null:null,'include':_0x1ec5b6['options']?_0x1ec5b6[_0xdee9('0x1d')][_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x1ec5b6[_0xdee9('0x1d')][_0xdee9('0x22')],function(_0x302446){return{'model':db[_0x302446[_0xdee9('0x24')]],'as':_0x302446['as'],'attributes':_0x302446[_0xdee9('0x20')],'include':_0x302446[_0xdee9('0x22')]?_[_0xdee9('0x23')](_0x302446[_0xdee9('0x22')],function(_0x2c7948){return{'model':db[_0x2c7948[_0xdee9('0x24')]],'as':_0x2c7948['as'],'attributes':_0x2c7948[_0xdee9('0x20')],'include':_0x2c7948['include']?_['map'](_0x2c7948[_0xdee9('0x22')],function(_0xcf923){return{'model':db[_0xcf923[_0xdee9('0x24')]],'as':_0xcf923['as'],'attributes':_0xcf923[_0xdee9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdee9('0x10')](function(_0x483276){logger[_0xdee9('0x11')](_0xdee9('0x25'),_0x1ec5b6);logger['debug'](_0xdee9('0x25'),_0x1ec5b6,JSON[_0xdee9('0x16')](_0x483276));_0x4c42b9(_0x483276);})['catch'](function(_0x3e21f0){logger[_0xdee9('0x17')](_0xdee9('0x25'),_0x3e21f0['message'],_0x1ec5b6);_0x5935e6(_0x3f6fff['error'](0x1f4,_0x3e21f0[_0xdee9('0x19')]));});});}; \ No newline at end of file +var _0x7ea1=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','map','include','model','ShowOpenchannelQueue','find','where','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe0440b,_0x64035a){var _0x57acd5=function(_0x5d6c16){while(--_0x5d6c16){_0xe0440b['push'](_0xe0440b['shift']());}};_0x57acd5(++_0x64035a);}(_0x7ea1,0x1f1));var _0x17ea=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x7ea1[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0x17ea('0x0'));var util=require('util');var moment=require(_0x17ea('0x1'));var BPromise=require(_0x17ea('0x2'));var rs=require(_0x17ea('0x3'));var fs=require('fs');var Redis=require(_0x17ea('0x4'));var db=require(_0x17ea('0x5'))['db'];var utils=require(_0x17ea('0x6'));var logger=require(_0x17ea('0x7'))('rpc');var config=require(_0x17ea('0x8'));var jayson=require(_0x17ea('0x9'));var client=jayson[_0x17ea('0xa')][_0x17ea('0xb')]({'port':0x232a});config[_0x17ea('0xc')]=_['defaults'](config['redis'],{'host':_0x17ea('0xd'),'port':0x18eb});var socket=require(_0x17ea('0xe'))(new Redis(config['redis']));require(_0x17ea('0xf'))[_0x17ea('0x10')](socket);function respondWithRpcPromise(_0x4b3d60,_0x3d0e02,_0x3cc517){return new BPromise(function(_0x418d92,_0x33a06e){return client[_0x17ea('0x11')](_0x4b3d60,_0x3cc517)[_0x17ea('0x12')](function(_0x54de37){logger['info'](_0x17ea('0x13'),_0x3d0e02,_0x17ea('0x14'));logger[_0x17ea('0x15')](_0x17ea('0x16'),_0x3d0e02,'request\x20sent',JSON['stringify'](_0x54de37));if(_0x54de37[_0x17ea('0x17')]){if(_0x54de37[_0x17ea('0x17')][_0x17ea('0x18')]===0x1f4){logger['error'](_0x17ea('0x13'),_0x3d0e02,_0x54de37[_0x17ea('0x17')][_0x17ea('0x19')]);return _0x33a06e(_0x54de37[_0x17ea('0x17')][_0x17ea('0x19')]);}logger[_0x17ea('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d0e02,_0x54de37['error'][_0x17ea('0x19')]);return _0x418d92(_0x54de37[_0x17ea('0x17')][_0x17ea('0x19')]);}else{logger[_0x17ea('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d0e02,'request\x20sent');_0x418d92(_0x54de37[_0x17ea('0x1b')][_0x17ea('0x19')]);}})[_0x17ea('0x1c')](function(_0x14c4cd){logger[_0x17ea('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d0e02,_0x14c4cd);_0x33a06e(_0x14c4cd);});});}exports[_0x17ea('0x1d')]=function(_0x4ddd23){var _0x4d265a=this;return new Promise(function(_0x47dabb,_0x539f89){return db[_0x17ea('0x1e')][_0x17ea('0x1f')]({'raw':_0x4ddd23['options']?_0x4ddd23[_0x17ea('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4ddd23[_0x17ea('0x20')]?_0x4ddd23[_0x17ea('0x20')]['where']||null:null,'attributes':_0x4ddd23['options']?_0x4ddd23[_0x17ea('0x20')][_0x17ea('0x21')]||null:null,'limit':_0x4ddd23[_0x17ea('0x20')]?_0x4ddd23[_0x17ea('0x20')][_0x17ea('0x22')]||null:null,'include':_0x4ddd23['options']?_0x4ddd23[_0x17ea('0x20')]['include']?_[_0x17ea('0x23')](_0x4ddd23[_0x17ea('0x20')][_0x17ea('0x24')],function(_0x343dac){return{'model':db[_0x343dac[_0x17ea('0x25')]],'as':_0x343dac['as'],'attributes':_0x343dac['attributes'],'include':_0x343dac['include']?_[_0x17ea('0x23')](_0x343dac[_0x17ea('0x24')],function(_0x358d47){return{'model':db[_0x358d47[_0x17ea('0x25')]],'as':_0x358d47['as'],'attributes':_0x358d47['attributes'],'include':_0x358d47[_0x17ea('0x24')]?_['map'](_0x358d47[_0x17ea('0x24')],function(_0xc49765){return{'model':db[_0xc49765[_0x17ea('0x25')]],'as':_0xc49765['as'],'attributes':_0xc49765[_0x17ea('0x21')]};}):[]};}):[]};}):[]:[]})[_0x17ea('0x12')](function(_0x1a19db){logger[_0x17ea('0x1a')]('GetOpenchannelQueue',_0x4ddd23);logger[_0x17ea('0x15')]('GetOpenchannelQueue',_0x4ddd23,JSON['stringify'](_0x1a19db));_0x47dabb(_0x1a19db);})[_0x17ea('0x1c')](function(_0xa95472){logger[_0x17ea('0x17')](_0x17ea('0x1d'),_0xa95472[_0x17ea('0x19')],_0x4ddd23);_0x539f89(_0x4d265a[_0x17ea('0x17')](0x1f4,_0xa95472[_0x17ea('0x19')]));});});};exports[_0x17ea('0x26')]=function(_0x2bfdd9){var _0x34cd1e=this;return new Promise(function(_0x24a470,_0x2bc4e1){return db[_0x17ea('0x1e')][_0x17ea('0x27')]({'raw':_0x2bfdd9[_0x17ea('0x20')]?_0x2bfdd9[_0x17ea('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2bfdd9[_0x17ea('0x20')]?_0x2bfdd9[_0x17ea('0x20')][_0x17ea('0x28')]||null:null,'attributes':_0x2bfdd9[_0x17ea('0x20')]?_0x2bfdd9['options'][_0x17ea('0x21')]||null:null,'include':_0x2bfdd9[_0x17ea('0x20')]?_0x2bfdd9[_0x17ea('0x20')]['include']?_[_0x17ea('0x23')](_0x2bfdd9[_0x17ea('0x20')][_0x17ea('0x24')],function(_0x288145){return{'model':db[_0x288145[_0x17ea('0x25')]],'as':_0x288145['as'],'attributes':_0x288145[_0x17ea('0x21')],'include':_0x288145['include']?_[_0x17ea('0x23')](_0x288145[_0x17ea('0x24')],function(_0x19527c){return{'model':db[_0x19527c[_0x17ea('0x25')]],'as':_0x19527c['as'],'attributes':_0x19527c['attributes'],'include':_0x19527c['include']?_[_0x17ea('0x23')](_0x19527c[_0x17ea('0x24')],function(_0x3f7063){return{'model':db[_0x3f7063[_0x17ea('0x25')]],'as':_0x3f7063['as'],'attributes':_0x3f7063[_0x17ea('0x21')]};}):[]};}):[]};}):[]:[]})[_0x17ea('0x12')](function(_0x1f7c84){logger[_0x17ea('0x1a')](_0x17ea('0x26'),_0x2bfdd9);logger[_0x17ea('0x15')](_0x17ea('0x26'),_0x2bfdd9,JSON[_0x17ea('0x29')](_0x1f7c84));_0x24a470(_0x1f7c84);})[_0x17ea('0x1c')](function(_0x46e976){logger[_0x17ea('0x17')](_0x17ea('0x26'),_0x46e976['message'],_0x2bfdd9);_0x2bc4e1(_0x34cd1e[_0x17ea('0x17')](0x1f4,_0x46e976[_0x17ea('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9831f37..67b9c49 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 _0xe203=['./openchannelQueue.events','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0xe203,0x1b8));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x3e20('0x0'));var events=['save',_0x3e20('0x1'),_0x3e20('0x2')];function createListener(_0x131864,_0x5a80af){return function(_0x5f0245){_0x5a80af[_0x3e20('0x3')](_0x131864,_0x5f0245);};}function removeListener(_0x50ecd1,_0x394ba2){return function(){OpenchannelQueueEvents[_0x3e20('0x4')](_0x50ecd1,_0x394ba2);};}exports[_0x3e20('0x5')]=function(_0x36d42e){for(var _0x27faee=0x0,_0x347f10=events[_0x3e20('0x6')];_0x27faee<_0x347f10;_0x27faee++){var _0x1c3a2e=events[_0x27faee];var _0x34718f=createListener(_0x3e20('0x7')+_0x1c3a2e,_0x36d42e);OpenchannelQueueEvents['on'](_0x1c3a2e,_0x34718f);}}; \ No newline at end of file +var _0x3f0f=['save','remove','update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3f0f,0x86));var _0xf3f0=function(_0x5edf98,_0x2243c3){_0x5edf98=_0x5edf98-0x0;var _0x44dfe3=_0x3f0f[_0x5edf98];return _0x44dfe3;};'use strict';var OpenchannelQueueEvents=require(_0xf3f0('0x0'));var events=[_0xf3f0('0x1'),_0xf3f0('0x2'),_0xf3f0('0x3')];function createListener(_0x46855c,_0x1c95e0){return function(_0x4a5b7a){_0x1c95e0[_0xf3f0('0x4')](_0x46855c,_0x4a5b7a);};}function removeListener(_0x4e7061,_0x1b9575){return function(){OpenchannelQueueEvents[_0xf3f0('0x5')](_0x4e7061,_0x1b9575);};}exports[_0xf3f0('0x6')]=function(_0x2dee7f){for(var _0x44173a=0x0,_0x29bc94=events[_0xf3f0('0x7')];_0x44173a<_0x29bc94;_0x44173a++){var _0x314124=events[_0x44173a];var _0x3f8935=createListener(_0xf3f0('0x8')+_0x314124,_0x2dee7f);OpenchannelQueueEvents['on'](_0x314124,_0x3f8935);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 97ee494..9c94166 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 _0x4477=['../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4477,0x7e));var _0x7447=function(_0x410e3d,_0x1f3c75){_0x410e3d=_0x410e3d-0x0;var _0x50826a=_0x4477[_0x410e3d];return _0x50826a;};'use strict';var multer=require(_0x7447('0x0'));var util=require('util');var path=require(_0x7447('0x1'));var timeout=require(_0x7447('0x2'));var express=require(_0x7447('0x3'));var router=express[_0x7447('0x4')]();var fs_extra=require(_0x7447('0x5'));var auth=require(_0x7447('0x6'));var interaction=require(_0x7447('0x7'));var config=require('../../config/environment');var controller=require(_0x7447('0x8'));router[_0x7447('0x9')]('/',auth[_0x7447('0xa')](),controller[_0x7447('0xb')]);router[_0x7447('0x9')]('/describe',auth[_0x7447('0xa')](),controller[_0x7447('0xc')]);router['get'](_0x7447('0xd'),auth[_0x7447('0xa')](),controller[_0x7447('0xe')]);router[_0x7447('0xf')]('/',auth[_0x7447('0xa')](),controller['create']);router['put']('/:id',auth[_0x7447('0xa')](),controller[_0x7447('0x10')]);router[_0x7447('0x11')](_0x7447('0xd'),auth[_0x7447('0xa')](),controller['destroy']);module[_0x7447('0x12')]=router; \ No newline at end of file +var _0x1707=['show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','describe'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x1707,0x1bd));var _0x7170=function(_0x5e5d31,_0x976475){_0x5e5d31=_0x5e5d31-0x0;var _0x539c3d=_0x1707[_0x5e5d31];return _0x539c3d;};'use strict';var multer=require(_0x7170('0x0'));var util=require(_0x7170('0x1'));var path=require(_0x7170('0x2'));var timeout=require(_0x7170('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7170('0x4'));var auth=require(_0x7170('0x5'));var interaction=require(_0x7170('0x6'));var config=require('../../config/environment');var controller=require(_0x7170('0x7'));router[_0x7170('0x8')]('/',auth[_0x7170('0x9')](),controller['index']);router[_0x7170('0x8')]('/describe',auth[_0x7170('0x9')](),controller[_0x7170('0xa')]);router['get']('/:id',auth[_0x7170('0x9')](),controller[_0x7170('0xb')]);router[_0x7170('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7170('0xd')](_0x7170('0xe'),auth[_0x7170('0x9')](),controller[_0x7170('0xf')]);router[_0x7170('0x10')](_0x7170('0xe'),auth[_0x7170('0x9')](),controller[_0x7170('0x11')]);module[_0x7170('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f4a4bae..5efc5b0 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 _0x5381=['STRING','DATE','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5381,0x1ea));var _0x1538=function(_0x1ebf9c,_0x4033ed){_0x1ebf9c=_0x1ebf9c-0x0;var _0x4a6ed6=_0x5381[_0x1ebf9c];return _0x4a6ed6;};'use strict';var moment=require('moment');var Sequelize=require(_0x1538('0x0'));module[_0x1538('0x1')]={'uniqueid':{'type':Sequelize[_0x1538('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1538('0x2')]},'joinAt':{'type':Sequelize[_0x1538('0x3')]},'leaveAt':{'type':Sequelize[_0x1538('0x3')]},'acceptAt':{'type':Sequelize[_0x1538('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1538('0x2')]}}; \ No newline at end of file +var _0x8cc2=['STRING','DATE'];(function(_0x2390c6,_0x38b822){var _0x41a65b=function(_0x458afa){while(--_0x458afa){_0x2390c6['push'](_0x2390c6['shift']());}};_0x41a65b(++_0x38b822);}(_0x8cc2,0x148));var _0x28cc=function(_0xfcaccf,_0x5df859){_0xfcaccf=_0xfcaccf-0x0;var _0x404d3b=_0x8cc2[_0xfcaccf];return _0x404d3b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x28cc('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x28cc('0x0')]},'joinAt':{'type':Sequelize[_0x28cc('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x28cc('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x28cc('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 888b698..cdae495 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 _0xfb00=['destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xfb00,0x158));var _0x0fb0=function(_0x307c66,_0x4beee3){_0x307c66=_0x307c66-0x0;var _0x1d9cc2=_0xfb00[_0x307c66];return _0x1d9cc2;};'use strict';var emlformat=require(_0x0fb0('0x0'));var rimraf=require(_0x0fb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fb0('0x2'));var rp=require(_0x0fb0('0x3'));var moment=require(_0x0fb0('0x4'));var BPromise=require(_0x0fb0('0x5'));var Mustache=require(_0x0fb0('0x6'));var util=require(_0x0fb0('0x7'));var path=require(_0x0fb0('0x8'));var sox=require(_0x0fb0('0x9'));var csv=require('to-csv');var ejs=require(_0x0fb0('0xa'));var fs=require('fs');var fs_extra=require(_0x0fb0('0xb'));var _=require(_0x0fb0('0xc'));var squel=require(_0x0fb0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fb0('0xe'));var toCsv=require(_0x0fb0('0xf'));var querystring=require(_0x0fb0('0x10'));var Papa=require(_0x0fb0('0x11'));var Redis=require(_0x0fb0('0x12'));var authService=require(_0x0fb0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0fb0('0x14'));var hardwareService=require(_0x0fb0('0x15'));var logger=require(_0x0fb0('0x16'))('api');var utils=require(_0x0fb0('0x17'));var config=require(_0x0fb0('0x18'));var licenseUtil=require(_0x0fb0('0x19'));var db=require(_0x0fb0('0x1a'))['db'];function respondWithStatusCode(_0x21ff29,_0x122a31){_0x122a31=_0x122a31||0xcc;return function(_0x4ae066){if(_0x4ae066){return _0x21ff29[_0x0fb0('0x1b')](_0x122a31);}return _0x21ff29['status'](_0x122a31)[_0x0fb0('0x1c')]();};}function respondWithResult(_0x470f11,_0x5e35f8){_0x5e35f8=_0x5e35f8||0xc8;return function(_0x116466){if(_0x116466){return _0x470f11[_0x0fb0('0x1d')](_0x5e35f8)[_0x0fb0('0x1e')](_0x116466);}};}function respondWithFilteredResult(_0x2f3d2e,_0x3a6edc){return function(_0x272101){if(_0x272101){var _0x1f4348=typeof _0x3a6edc[_0x0fb0('0x1f')]===_0x0fb0('0x20')&&typeof _0x3a6edc[_0x0fb0('0x21')]===_0x0fb0('0x20');var _0x2e8adf=_0x272101[_0x0fb0('0x22')];var _0x16f555=_0x1f4348?0x0:_0x3a6edc['offset'];var _0x2915c5=_0x1f4348?_0x272101['count']:_0x3a6edc[_0x0fb0('0x1f')]+_0x3a6edc['limit'];var _0x5e38b1;if(_0x2915c5>=_0x2e8adf){_0x2915c5=_0x2e8adf;_0x5e38b1=0xc8;}else{_0x5e38b1=0xce;}_0x2f3d2e['status'](_0x5e38b1);return _0x2f3d2e[_0x0fb0('0x23')]('Content-Range',_0x16f555+'-'+_0x2915c5+'/'+_0x2e8adf)[_0x0fb0('0x1e')](_0x272101);}return null;};}function patchUpdates(_0x3f813b){return function(_0x5cfb48){try{jsonpatch[_0x0fb0('0x24')](_0x5cfb48,_0x3f813b,!![]);}catch(_0x54c365){return BPromise[_0x0fb0('0x25')](_0x54c365);}return _0x5cfb48[_0x0fb0('0x26')]();};}function saveUpdates(_0x16268e,_0x411b81){return function(_0x486009){if(_0x486009){return _0x486009[_0x0fb0('0x27')](_0x16268e)[_0x0fb0('0x28')](function(_0x3388aa){return _0x3388aa;});}return null;};}function removeEntity(_0x4f55af,_0x10fa6b){return function(_0x1c5782){if(_0x1c5782){return _0x1c5782[_0x0fb0('0x29')]()['then'](function(){_0x4f55af['status'](0xcc)[_0x0fb0('0x1c')]();});}};}function handleEntityNotFound(_0x4bc6ad,_0x5d0ac5){return function(_0x30e49b){if(!_0x30e49b){_0x4bc6ad[_0x0fb0('0x1b')](0x194);}return _0x30e49b;};}function handleError(_0x306e81,_0x117d55){_0x117d55=_0x117d55||0x1f4;return function(_0x3b6b65){logger[_0x0fb0('0x2a')](_0x3b6b65[_0x0fb0('0x2b')]);if(_0x3b6b65[_0x0fb0('0x2c')]){delete _0x3b6b65[_0x0fb0('0x2c')];}_0x306e81[_0x0fb0('0x1d')](_0x117d55)[_0x0fb0('0x2d')](_0x3b6b65);};}exports[_0x0fb0('0x2e')]=function(_0x46c1d7,_0x2e5c6c){var _0x370a20={},_0x500407={},_0x3d5474={'count':0x0,'rows':[]};var _0x3cb59f=_[_0x0fb0('0x2f')](db[_0x0fb0('0x30')]['rawAttributes'],function(_0xd8b2a1){return{'name':_0xd8b2a1[_0x0fb0('0x31')],'type':_0xd8b2a1[_0x0fb0('0x32')][_0x0fb0('0x33')]};});_0x500407[_0x0fb0('0x34')]=_[_0x0fb0('0x2f')](_0x3cb59f,_0x0fb0('0x2c'));_0x500407[_0x0fb0('0x35')]=_[_0x0fb0('0x36')](_0x46c1d7[_0x0fb0('0x35')]);_0x500407[_0x0fb0('0x37')]=_['intersection'](_0x500407[_0x0fb0('0x34')],_0x500407[_0x0fb0('0x35')]);_0x370a20[_0x0fb0('0x38')]=_[_0x0fb0('0x39')](_0x500407[_0x0fb0('0x34')],qs[_0x0fb0('0x3a')](_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x370a20[_0x0fb0('0x38')]=_0x370a20['attributes'][_0x0fb0('0x3b')]?_0x370a20[_0x0fb0('0x38')]:_0x500407[_0x0fb0('0x34')];if(!_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3c')]('nolimit')){_0x370a20['limit']=qs[_0x0fb0('0x21')](_0x46c1d7['query'][_0x0fb0('0x21')]);_0x370a20[_0x0fb0('0x1f')]=qs[_0x0fb0('0x1f')](_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x1f')]);}_0x370a20['order']=qs[_0x0fb0('0x3d')](_0x46c1d7[_0x0fb0('0x35')]['sort']);_0x370a20[_0x0fb0('0x3e')]=qs[_0x0fb0('0x37')](_['pick'](_0x46c1d7[_0x0fb0('0x35')],_0x500407['filters']),_0x3cb59f);if(_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3f')]){_0x370a20[_0x0fb0('0x3e')]=_['merge'](_0x370a20[_0x0fb0('0x3e')],{'$or':_[_0x0fb0('0x2f')](_0x3cb59f,function(_0x4a8083){if(_0x4a8083[_0x0fb0('0x32')]!==_0x0fb0('0x40')){var _0xe06aa7={};_0xe06aa7[_0x4a8083['name']]={'$like':'%'+_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x3f')]+'%'};return _0xe06aa7;}})});}_0x370a20=_[_0x0fb0('0x41')]({},_0x370a20,_0x46c1d7['options']);var _0x2d39bb={'where':_0x370a20[_0x0fb0('0x3e')]};return db[_0x0fb0('0x30')][_0x0fb0('0x22')](_0x2d39bb)[_0x0fb0('0x28')](function(_0x3c997a){_0x3d5474[_0x0fb0('0x22')]=_0x3c997a;if(_0x46c1d7[_0x0fb0('0x35')][_0x0fb0('0x42')]){_0x370a20[_0x0fb0('0x43')]=[{'all':!![]}];}return db[_0x0fb0('0x30')]['findAll'](_0x370a20);})[_0x0fb0('0x28')](function(_0x4f430){_0x3d5474['rows']=_0x4f430;return _0x3d5474;})['then'](respondWithFilteredResult(_0x2e5c6c,_0x370a20))[_0x0fb0('0x44')](handleError(_0x2e5c6c,null));};exports[_0x0fb0('0x45')]=function(_0x504e48,_0x46ac6f){var _0x3ac0c2={'raw':!![],'where':{'id':_0x504e48[_0x0fb0('0x46')]['id']}},_0x51273d={};_0x51273d[_0x0fb0('0x34')]=_[_0x0fb0('0x36')](db[_0x0fb0('0x30')][_0x0fb0('0x47')]);_0x51273d[_0x0fb0('0x35')]=_[_0x0fb0('0x36')](_0x504e48[_0x0fb0('0x35')]);_0x51273d[_0x0fb0('0x37')]=_['intersection'](_0x51273d[_0x0fb0('0x34')],_0x51273d[_0x0fb0('0x35')]);_0x3ac0c2[_0x0fb0('0x38')]=_[_0x0fb0('0x39')](_0x51273d[_0x0fb0('0x34')],qs[_0x0fb0('0x3a')](_0x504e48[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x3ac0c2[_0x0fb0('0x38')]=_0x3ac0c2[_0x0fb0('0x38')][_0x0fb0('0x3b')]?_0x3ac0c2[_0x0fb0('0x38')]:_0x51273d[_0x0fb0('0x34')];if(_0x504e48[_0x0fb0('0x35')][_0x0fb0('0x42')]){_0x3ac0c2['include']=[{'all':!![]}];}_0x3ac0c2=_[_0x0fb0('0x41')]({},_0x3ac0c2,_0x504e48[_0x0fb0('0x48')]);return db[_0x0fb0('0x30')][_0x0fb0('0x49')](_0x3ac0c2)[_0x0fb0('0x28')](handleEntityNotFound(_0x46ac6f,null))['then'](respondWithResult(_0x46ac6f,null))[_0x0fb0('0x44')](handleError(_0x46ac6f,null));};exports[_0x0fb0('0x4a')]=function(_0x2f44fa,_0x42a3d2){return db[_0x0fb0('0x30')]['create'](_0x2f44fa[_0x0fb0('0x4b')],{})['then'](respondWithResult(_0x42a3d2,0xc9))[_0x0fb0('0x44')](handleError(_0x42a3d2,null));};exports[_0x0fb0('0x27')]=function(_0x4e6afa,_0x36b149){if(_0x4e6afa[_0x0fb0('0x4b')]['id']){delete _0x4e6afa['body']['id'];}return db['OpenchannelQueueReport'][_0x0fb0('0x49')]({'where':{'id':_0x4e6afa[_0x0fb0('0x46')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x36b149,null))[_0x0fb0('0x28')](saveUpdates(_0x4e6afa[_0x0fb0('0x4b')],null))[_0x0fb0('0x28')](respondWithResult(_0x36b149,null))[_0x0fb0('0x44')](handleError(_0x36b149,null));};exports[_0x0fb0('0x29')]=function(_0x48f533,_0x23030){return db['OpenchannelQueueReport'][_0x0fb0('0x49')]({'where':{'id':_0x48f533[_0x0fb0('0x46')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x23030,null))[_0x0fb0('0x28')](removeEntity(_0x23030,null))['catch'](handleError(_0x23030,null));};exports[_0x0fb0('0x4c')]=function(_0x1c91b6,_0x1c8f90){return db['OpenchannelQueueReport'][_0x0fb0('0x4c')]()[_0x0fb0('0x28')](respondWithResult(_0x1c8f90,null))[_0x0fb0('0x44')](handleError(_0x1c8f90,null));}; \ No newline at end of file +var _0xa8d3=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','OpenchannelQueueReport','key','keys','filters','query','attributes','model','fields','hasOwnProperty','order','sort','pick','filter','VIRTUAL','merge','where','includeAll','include','rows','catch','show','params','intersection','length','body','find','destroy','describe'];(function(_0x4a73dd,_0x58e46c){var _0x279e6b=function(_0x25254b){while(--_0x25254b){_0x4a73dd['push'](_0x4a73dd['shift']());}};_0x279e6b(++_0x58e46c);}(_0xa8d3,0xc9));var _0x3a8d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa8d3[_0xbca1b1];return _0x4e1686;};'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(_0x3a8d('0x0'));var moment=require(_0x3a8d('0x1'));var BPromise=require(_0x3a8d('0x2'));var Mustache=require('mustache');var util=require(_0x3a8d('0x3'));var path=require(_0x3a8d('0x4'));var sox=require(_0x3a8d('0x5'));var csv=require(_0x3a8d('0x6'));var ejs=require(_0x3a8d('0x7'));var fs=require('fs');var fs_extra=require(_0x3a8d('0x8'));var _=require(_0x3a8d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a8d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3a8d('0x6'));var querystring=require(_0x3a8d('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3a8d('0xc'));var qs=require(_0x3a8d('0xd'));var as=require(_0x3a8d('0xe'));var hardwareService=require(_0x3a8d('0xf'));var logger=require(_0x3a8d('0x10'))(_0x3a8d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3a8d('0x12'));var db=require(_0x3a8d('0x13'))['db'];function respondWithStatusCode(_0x121169,_0x21d3f3){_0x21d3f3=_0x21d3f3||0xcc;return function(_0x4e13d6){if(_0x4e13d6){return _0x121169[_0x3a8d('0x14')](_0x21d3f3);}return _0x121169[_0x3a8d('0x15')](_0x21d3f3)[_0x3a8d('0x16')]();};}function respondWithResult(_0x5351df,_0x3017bd){_0x3017bd=_0x3017bd||0xc8;return function(_0x3f981e){if(_0x3f981e){return _0x5351df[_0x3a8d('0x15')](_0x3017bd)[_0x3a8d('0x17')](_0x3f981e);}};}function respondWithFilteredResult(_0x1365b3,_0x3ad338){return function(_0x13d26a){if(_0x13d26a){var _0x53da27=typeof _0x3ad338['offset']==='undefined'&&typeof _0x3ad338[_0x3a8d('0x18')]===_0x3a8d('0x19');var _0x22046e=_0x13d26a[_0x3a8d('0x1a')];var _0xe7d57=_0x53da27?0x0:_0x3ad338[_0x3a8d('0x1b')];var _0x5e2749=_0x53da27?_0x13d26a[_0x3a8d('0x1a')]:_0x3ad338[_0x3a8d('0x1b')]+_0x3ad338[_0x3a8d('0x18')];var _0x24f868;if(_0x5e2749>=_0x22046e){_0x5e2749=_0x22046e;_0x24f868=0xc8;}else{_0x24f868=0xce;}_0x1365b3[_0x3a8d('0x15')](_0x24f868);return _0x1365b3[_0x3a8d('0x1c')](_0x3a8d('0x1d'),_0xe7d57+'-'+_0x5e2749+'/'+_0x22046e)[_0x3a8d('0x17')](_0x13d26a);}return null;};}function patchUpdates(_0x4c40c0){return function(_0x701234){try{jsonpatch[_0x3a8d('0x1e')](_0x701234,_0x4c40c0,!![]);}catch(_0x1bb7cc){return BPromise[_0x3a8d('0x1f')](_0x1bb7cc);}return _0x701234[_0x3a8d('0x20')]();};}function saveUpdates(_0x243b8b,_0x3f8a5a){return function(_0x28d113){if(_0x28d113){return _0x28d113[_0x3a8d('0x21')](_0x243b8b)[_0x3a8d('0x22')](function(_0x7e08e7){return _0x7e08e7;});}return null;};}function removeEntity(_0x273b5e,_0x2e17a2){return function(_0x48fa7a){if(_0x48fa7a){return _0x48fa7a['destroy']()[_0x3a8d('0x22')](function(){_0x273b5e[_0x3a8d('0x15')](0xcc)[_0x3a8d('0x16')]();});}};}function handleEntityNotFound(_0x3d5aa2,_0x5b1888){return function(_0x1bb79a){if(!_0x1bb79a){_0x3d5aa2[_0x3a8d('0x14')](0x194);}return _0x1bb79a;};}function handleError(_0x13cb80,_0x221697){_0x221697=_0x221697||0x1f4;return function(_0x24bd41){logger[_0x3a8d('0x23')](_0x24bd41['stack']);if(_0x24bd41[_0x3a8d('0x24')]){delete _0x24bd41[_0x3a8d('0x24')];}_0x13cb80[_0x3a8d('0x15')](_0x221697)['send'](_0x24bd41);};}exports[_0x3a8d('0x25')]=function(_0x53e459,_0x1dc271){var _0x1d6527={},_0x18840f={},_0xe0a9e5={'count':0x0,'rows':[]};var _0x257d2f=_[_0x3a8d('0x26')](db[_0x3a8d('0x27')]['rawAttributes'],function(_0x5dddeb){return{'name':_0x5dddeb['fieldName'],'type':_0x5dddeb['type'][_0x3a8d('0x28')]};});_0x18840f['model']=_[_0x3a8d('0x26')](_0x257d2f,_0x3a8d('0x24'));_0x18840f['query']=_[_0x3a8d('0x29')](_0x53e459['query']);_0x18840f[_0x3a8d('0x2a')]=_['intersection'](_0x18840f['model'],_0x18840f[_0x3a8d('0x2b')]);_0x1d6527[_0x3a8d('0x2c')]=_['intersection'](_0x18840f[_0x3a8d('0x2d')],qs[_0x3a8d('0x2e')](_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x2e')]));_0x1d6527['attributes']=_0x1d6527[_0x3a8d('0x2c')]['length']?_0x1d6527[_0x3a8d('0x2c')]:_0x18840f[_0x3a8d('0x2d')];if(!_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x2f')]('nolimit')){_0x1d6527[_0x3a8d('0x18')]=qs['limit'](_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x18')]);_0x1d6527[_0x3a8d('0x1b')]=qs['offset'](_0x53e459['query']['offset']);}_0x1d6527[_0x3a8d('0x30')]=qs[_0x3a8d('0x31')](_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x31')]);_0x1d6527['where']=qs[_0x3a8d('0x2a')](_[_0x3a8d('0x32')](_0x53e459[_0x3a8d('0x2b')],_0x18840f['filters']),_0x257d2f);if(_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x33')]){_0x1d6527['where']=_['merge'](_0x1d6527['where'],{'$or':_['map'](_0x257d2f,function(_0xb1f9c5){if(_0xb1f9c5['type']!==_0x3a8d('0x34')){var _0x2f57a3={};_0x2f57a3[_0xb1f9c5[_0x3a8d('0x24')]]={'$like':'%'+_0x53e459[_0x3a8d('0x2b')]['filter']+'%'};return _0x2f57a3;}})});}_0x1d6527=_[_0x3a8d('0x35')]({},_0x1d6527,_0x53e459['options']);var _0x59e817={'where':_0x1d6527[_0x3a8d('0x36')]};return db['OpenchannelQueueReport'][_0x3a8d('0x1a')](_0x59e817)[_0x3a8d('0x22')](function(_0x21a017){_0xe0a9e5[_0x3a8d('0x1a')]=_0x21a017;if(_0x53e459[_0x3a8d('0x2b')][_0x3a8d('0x37')]){_0x1d6527[_0x3a8d('0x38')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x1d6527);})['then'](function(_0x53fc7c){_0xe0a9e5[_0x3a8d('0x39')]=_0x53fc7c;return _0xe0a9e5;})[_0x3a8d('0x22')](respondWithFilteredResult(_0x1dc271,_0x1d6527))[_0x3a8d('0x3a')](handleError(_0x1dc271,null));};exports[_0x3a8d('0x3b')]=function(_0x1b4bbe,_0x29c15f){var _0x3024a5={'raw':!![],'where':{'id':_0x1b4bbe[_0x3a8d('0x3c')]['id']}},_0x23b8c3={};_0x23b8c3[_0x3a8d('0x2d')]=_[_0x3a8d('0x29')](db['OpenchannelQueueReport']['rawAttributes']);_0x23b8c3['query']=_[_0x3a8d('0x29')](_0x1b4bbe[_0x3a8d('0x2b')]);_0x23b8c3[_0x3a8d('0x2a')]=_[_0x3a8d('0x3d')](_0x23b8c3['model'],_0x23b8c3['query']);_0x3024a5['attributes']=_[_0x3a8d('0x3d')](_0x23b8c3[_0x3a8d('0x2d')],qs['fields'](_0x1b4bbe[_0x3a8d('0x2b')]['fields']));_0x3024a5[_0x3a8d('0x2c')]=_0x3024a5[_0x3a8d('0x2c')][_0x3a8d('0x3e')]?_0x3024a5['attributes']:_0x23b8c3['model'];if(_0x1b4bbe[_0x3a8d('0x2b')][_0x3a8d('0x37')]){_0x3024a5['include']=[{'all':!![]}];}_0x3024a5=_[_0x3a8d('0x35')]({},_0x3024a5,_0x1b4bbe['options']);return db[_0x3a8d('0x27')]['find'](_0x3024a5)[_0x3a8d('0x22')](handleEntityNotFound(_0x29c15f,null))[_0x3a8d('0x22')](respondWithResult(_0x29c15f,null))[_0x3a8d('0x3a')](handleError(_0x29c15f,null));};exports['create']=function(_0x5c8735,_0x32ddff){return db[_0x3a8d('0x27')]['create'](_0x5c8735['body'],{})[_0x3a8d('0x22')](respondWithResult(_0x32ddff,0xc9))[_0x3a8d('0x3a')](handleError(_0x32ddff,null));};exports[_0x3a8d('0x21')]=function(_0x100571,_0x196f1f){if(_0x100571[_0x3a8d('0x3f')]['id']){delete _0x100571[_0x3a8d('0x3f')]['id'];}return db[_0x3a8d('0x27')][_0x3a8d('0x40')]({'where':{'id':_0x100571['params']['id']}})[_0x3a8d('0x22')](handleEntityNotFound(_0x196f1f,null))[_0x3a8d('0x22')](saveUpdates(_0x100571[_0x3a8d('0x3f')],null))[_0x3a8d('0x22')](respondWithResult(_0x196f1f,null))['catch'](handleError(_0x196f1f,null));};exports[_0x3a8d('0x41')]=function(_0x2f53cc,_0x369a3e){return db[_0x3a8d('0x27')][_0x3a8d('0x40')]({'where':{'id':_0x2f53cc[_0x3a8d('0x3c')]['id']}})[_0x3a8d('0x22')](handleEntityNotFound(_0x369a3e,null))[_0x3a8d('0x22')](removeEntity(_0x369a3e,null))['catch'](handleError(_0x369a3e,null));};exports[_0x3a8d('0x42')]=function(_0x3240b2,_0x11c3b9){return db[_0x3a8d('0x27')][_0x3a8d('0x42')]()['then'](respondWithResult(_0x11c3b9,null))[_0x3a8d('0x3a')](handleError(_0x11c3b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1be608f..45744b0 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1aea5c,_0x111b3f){var _0x5099ea=function(_0x3732d){while(--_0x3732d){_0x1aea5c['push'](_0x1aea5c['shift']());}};_0x5099ea(++_0x111b3f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x814b,0x1a2));var _0xb814=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0x814b[_0x4ded50];return _0xa92135;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ea769b8..cc41f6c 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 _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash'];(function(_0x3adcf3,_0x3646df){var _0x20513a=function(_0xbac72d){while(--_0xbac72d){_0x3adcf3['push'](_0x3adcf3['shift']());}};_0x20513a(++_0x3646df);}(_0x6cb4,0xff));var _0x46cb=function(_0x46e6db,_0x5a39e2){_0x46e6db=_0x46e6db-0x0;var _0x258059=_0x6cb4[_0x46e6db];return _0x258059;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateOpenchannelQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0xd824=['message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','debug','UpdateOpenchannelQueueReport','update','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43fcff,_0x8ed62d){var _0x1f759d=function(_0x5c7304){while(--_0x5c7304){_0x43fcff['push'](_0x43fcff['shift']());}};_0x1f759d(++_0x8ed62d);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![]})[_0x4d82('0x18')](function(_0x64669c){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x19')]('CreateOpenchannelQueueReport',_0x258c59,JSON[_0x4d82('0xe')](_0x64669c));_0x2f2127(_0x64669c);})[_0x4d82('0x11')](function(_0x5e5bdf){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x5e5bdf[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x5e5bdf[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1a')]=function(_0x11c043){var _0x462258=this;return new Promise(function(_0x12feab,_0x2df104){return db[_0x4d82('0x13')][_0x4d82('0x1b')](_0x11c043[_0x4d82('0x15')],{'raw':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c043['options']?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1c')]||null:null,'attributes':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x11c043[_0x4d82('0x16')]?_0x11c043[_0x4d82('0x16')][_0x4d82('0x1d')]||null:null})[_0x4d82('0x18')](function(_0x5ce98b){logger[_0x4d82('0xa')]('UpdateOpenchannelQueueReport',_0x11c043);logger['debug']('UpdateOpenchannelQueueReport',_0x11c043,JSON['stringify'](_0x5ce98b));_0x12feab(_0x5ce98b);})[_0x4d82('0x11')](function(_0x8cfbf1){logger[_0x4d82('0xf')]('UpdateOpenchannelQueueReport',_0x8cfbf1[_0x4d82('0x10')],_0x11c043);_0x2df104(_0x462258[_0x4d82('0xf')](0x1f4,_0x8cfbf1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0608a45..71cb76d 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 _0x3785=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3785,0x6a));var _0x5378=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3785[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x5378('0x0'));var util=require(_0x5378('0x1'));var path=require(_0x5378('0x2'));var timeout=require(_0x5378('0x3'));var express=require(_0x5378('0x4'));var router=express[_0x5378('0x5')]();var fs_extra=require(_0x5378('0x6'));var auth=require(_0x5378('0x7'));var interaction=require(_0x5378('0x8'));var config=require('../../config/environment');var controller=require(_0x5378('0x9'));router['get']('/',auth[_0x5378('0xa')](),controller[_0x5378('0xb')]);router[_0x5378('0xc')](_0x5378('0xd'),auth[_0x5378('0xa')](),controller[_0x5378('0xe')]);router[_0x5378('0xc')]('/:id',auth[_0x5378('0xa')](),controller[_0x5378('0xf')]);router[_0x5378('0x10')]('/',auth[_0x5378('0xa')](),controller['create']);router['put']('/:id',auth[_0x5378('0xa')](),controller[_0x5378('0x11')]);router[_0x5378('0x12')](_0x5378('0x13'),auth[_0x5378('0xa')](),controller[_0x5378('0x14')]);module[_0x5378('0x15')]=router; \ No newline at end of file +var _0x6cfc=['create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x16a7b5,_0x3305f3){var _0x32fd17=function(_0x589fe9){while(--_0x589fe9){_0x16a7b5['push'](_0x16a7b5['shift']());}};_0x32fd17(++_0x3305f3);}(_0x6cfc,0x180));var _0xc6cf=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x6cfc[_0x2d364e];return _0x1b9312;};'use strict';var multer=require('multer');var util=require(_0xc6cf('0x0'));var path=require(_0xc6cf('0x1'));var timeout=require(_0xc6cf('0x2'));var express=require(_0xc6cf('0x3'));var router=express[_0xc6cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc6cf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc6cf('0x6'));router['get']('/',auth[_0xc6cf('0x7')](),controller[_0xc6cf('0x8')]);router[_0xc6cf('0x9')](_0xc6cf('0xa'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xb')]);router['get'](_0xc6cf('0xc'),auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xd')]);router[_0xc6cf('0xe')]('/',auth[_0xc6cf('0x7')](),controller[_0xc6cf('0xf')]);router[_0xc6cf('0x10')](_0xc6cf('0xc'),auth['isAuthenticated'](),controller[_0xc6cf('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc6cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 94b2309..5830030 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3c043d,_0x259cb1){var _0x14ccaa=function(_0x5e0f22){while(--_0x5e0f22){_0x3c043d['push'](_0x3c043d['shift']());}};_0x14ccaa(++_0x259cb1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x397b07,_0xae18ab){_0x397b07=_0x397b07-0x0;var _0x508757=_0xf4eb[_0x397b07];return _0x508757;};'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(_0x494965,_0x48ace5){var _0x3e682e=function(_0x463373){while(--_0x463373){_0x494965['push'](_0x494965['shift']());}};_0x3e682e(++_0x48ace5);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index cc6579e..37aa2f4 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 _0x3710=['then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','options','include','catch','show','find','create','body','params','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','set','reject','save','update'];(function(_0x1b4ecb,_0x568d7a){var _0x48812f=function(_0x53d1e9){while(--_0x53d1e9){_0x1b4ecb['push'](_0x1b4ecb['shift']());}};_0x48812f(++_0x568d7a);}(_0x3710,0x17e));var _0x0371=function(_0x510e07,_0x30a6be){_0x510e07=_0x510e07-0x0;var _0x4ef0e7=_0x3710[_0x510e07];return _0x4ef0e7;};'use strict';var emlformat=require(_0x0371('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0371('0x1'));var rp=require(_0x0371('0x2'));var moment=require('moment');var BPromise=require(_0x0371('0x3'));var Mustache=require(_0x0371('0x4'));var util=require(_0x0371('0x5'));var path=require(_0x0371('0x6'));var sox=require(_0x0371('0x7'));var csv=require('to-csv');var ejs=require(_0x0371('0x8'));var fs=require('fs');var fs_extra=require(_0x0371('0x9'));var _=require(_0x0371('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0371('0xb'));var toCsv=require(_0x0371('0xc'));var querystring=require(_0x0371('0xd'));var Papa=require(_0x0371('0xe'));var Redis=require(_0x0371('0xf'));var authService=require(_0x0371('0x10'));var qs=require(_0x0371('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0371('0x12'));var logger=require('../../config/logger')(_0x0371('0x13'));var utils=require(_0x0371('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0371('0x15'))['db'];function respondWithStatusCode(_0x439cf8,_0x23a4c2){_0x23a4c2=_0x23a4c2||0xcc;return function(_0x2f3d11){if(_0x2f3d11){return _0x439cf8['sendStatus'](_0x23a4c2);}return _0x439cf8['status'](_0x23a4c2)[_0x0371('0x16')]();};}function respondWithResult(_0x11db23,_0x197e77){_0x197e77=_0x197e77||0xc8;return function(_0x384cb2){if(_0x384cb2){return _0x11db23[_0x0371('0x17')](_0x197e77)[_0x0371('0x18')](_0x384cb2);}};}function respondWithFilteredResult(_0x527b8f,_0x27a009){return function(_0x157fc1){if(_0x157fc1){var _0x2646b6=typeof _0x27a009[_0x0371('0x19')]===_0x0371('0x1a')&&typeof _0x27a009[_0x0371('0x1b')]==='undefined';var _0x27ad7f=_0x157fc1['count'];var _0x45881e=_0x2646b6?0x0:_0x27a009['offset'];var _0xa95f69=_0x2646b6?_0x157fc1['count']:_0x27a009[_0x0371('0x19')]+_0x27a009['limit'];var _0x4a9883;if(_0xa95f69>=_0x27ad7f){_0xa95f69=_0x27ad7f;_0x4a9883=0xc8;}else{_0x4a9883=0xce;}_0x527b8f[_0x0371('0x17')](_0x4a9883);return _0x527b8f[_0x0371('0x1c')]('Content-Range',_0x45881e+'-'+_0xa95f69+'/'+_0x27ad7f)[_0x0371('0x18')](_0x157fc1);}return null;};}function patchUpdates(_0x213939){return function(_0x3ec28b){try{jsonpatch['apply'](_0x3ec28b,_0x213939,!![]);}catch(_0x245204){return BPromise[_0x0371('0x1d')](_0x245204);}return _0x3ec28b[_0x0371('0x1e')]();};}function saveUpdates(_0x497cf2,_0x21bf4e){return function(_0xc41a7c){if(_0xc41a7c){return _0xc41a7c[_0x0371('0x1f')](_0x497cf2)[_0x0371('0x20')](function(_0x531c88){return _0x531c88;});}return null;};}function removeEntity(_0x472d27,_0x41b2a8){return function(_0x121486){if(_0x121486){return _0x121486['destroy']()[_0x0371('0x20')](function(){_0x472d27[_0x0371('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ebe9d,_0x57e21b){return function(_0x5913e9){if(!_0x5913e9){_0x7ebe9d[_0x0371('0x21')](0x194);}return _0x5913e9;};}function handleError(_0x277369,_0x1cae63){_0x1cae63=_0x1cae63||0x1f4;return function(_0x335c3b){logger[_0x0371('0x22')](_0x335c3b[_0x0371('0x23')]);if(_0x335c3b['name']){delete _0x335c3b[_0x0371('0x24')];}_0x277369[_0x0371('0x17')](_0x1cae63)[_0x0371('0x25')](_0x335c3b);};}exports[_0x0371('0x26')]=function(_0x5388c6,_0x1ea87c){var _0x503804={},_0x1db35d={},_0x46c92f={'count':0x0,'rows':[]};var _0x1f96ef=_[_0x0371('0x27')](db[_0x0371('0x28')][_0x0371('0x29')],function(_0x56ee66){return{'name':_0x56ee66[_0x0371('0x2a')],'type':_0x56ee66[_0x0371('0x2b')][_0x0371('0x2c')]};});_0x1db35d[_0x0371('0x2d')]=_[_0x0371('0x27')](_0x1f96ef,'name');_0x1db35d[_0x0371('0x2e')]=_[_0x0371('0x2f')](_0x5388c6[_0x0371('0x2e')]);_0x1db35d[_0x0371('0x30')]=_[_0x0371('0x31')](_0x1db35d[_0x0371('0x2d')],_0x1db35d[_0x0371('0x2e')]);_0x503804[_0x0371('0x32')]=_[_0x0371('0x31')](_0x1db35d[_0x0371('0x2d')],qs[_0x0371('0x33')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x33')]));_0x503804[_0x0371('0x32')]=_0x503804[_0x0371('0x32')][_0x0371('0x34')]?_0x503804[_0x0371('0x32')]:_0x1db35d[_0x0371('0x2d')];if(!_0x5388c6[_0x0371('0x2e')]['hasOwnProperty'](_0x0371('0x35'))){_0x503804['limit']=qs[_0x0371('0x1b')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x1b')]);_0x503804[_0x0371('0x19')]=qs[_0x0371('0x19')](_0x5388c6[_0x0371('0x2e')][_0x0371('0x19')]);}_0x503804[_0x0371('0x36')]=qs['sort'](_0x5388c6['query']['sort']);_0x503804[_0x0371('0x37')]=qs[_0x0371('0x30')](_[_0x0371('0x38')](_0x5388c6[_0x0371('0x2e')],_0x1db35d[_0x0371('0x30')]),_0x1f96ef);if(_0x5388c6['query']['filter']){_0x503804[_0x0371('0x37')]=_[_0x0371('0x39')](_0x503804[_0x0371('0x37')],{'$or':_[_0x0371('0x27')](_0x1f96ef,function(_0x3f5379){if(_0x3f5379[_0x0371('0x2b')]!==_0x0371('0x3a')){var _0x234104={};_0x234104[_0x3f5379['name']]={'$like':'%'+_0x5388c6[_0x0371('0x2e')]['filter']+'%'};return _0x234104;}})});}_0x503804=_[_0x0371('0x39')]({},_0x503804,_0x5388c6[_0x0371('0x3b')]);var _0x41284f={'where':_0x503804[_0x0371('0x37')]};return db[_0x0371('0x28')]['count'](_0x41284f)[_0x0371('0x20')](function(_0x4a1690){_0x46c92f['count']=_0x4a1690;if(_0x5388c6['query']['includeAll']){_0x503804[_0x0371('0x3c')]=[{'all':!![]}];}return db[_0x0371('0x28')]['findAll'](_0x503804);})['then'](function(_0x39dbac){_0x46c92f['rows']=_0x39dbac;return _0x46c92f;})['then'](respondWithFilteredResult(_0x1ea87c,_0x503804))[_0x0371('0x3d')](handleError(_0x1ea87c,null));};exports[_0x0371('0x3e')]=function(_0xc4ff9f,_0xc1b4c4){var _0x2db034={'raw':!![],'where':{'id':_0xc4ff9f['params']['id']}},_0x3d0b42={};_0x3d0b42[_0x0371('0x2d')]=_['keys'](db[_0x0371('0x28')][_0x0371('0x29')]);_0x3d0b42[_0x0371('0x2e')]=_[_0x0371('0x2f')](_0xc4ff9f[_0x0371('0x2e')]);_0x3d0b42[_0x0371('0x30')]=_['intersection'](_0x3d0b42[_0x0371('0x2d')],_0x3d0b42[_0x0371('0x2e')]);_0x2db034[_0x0371('0x32')]=_['intersection'](_0x3d0b42[_0x0371('0x2d')],qs[_0x0371('0x33')](_0xc4ff9f[_0x0371('0x2e')][_0x0371('0x33')]));_0x2db034[_0x0371('0x32')]=_0x2db034[_0x0371('0x32')][_0x0371('0x34')]?_0x2db034[_0x0371('0x32')]:_0x3d0b42[_0x0371('0x2d')];if(_0xc4ff9f[_0x0371('0x2e')]['includeAll']){_0x2db034['include']=[{'all':!![]}];}_0x2db034=_[_0x0371('0x39')]({},_0x2db034,_0xc4ff9f[_0x0371('0x3b')]);return db[_0x0371('0x28')][_0x0371('0x3f')](_0x2db034)[_0x0371('0x20')](handleEntityNotFound(_0xc1b4c4,null))['then'](respondWithResult(_0xc1b4c4,null))['catch'](handleError(_0xc1b4c4,null));};exports[_0x0371('0x40')]=function(_0x2f6541,_0x49412b){return db[_0x0371('0x28')][_0x0371('0x40')](_0x2f6541[_0x0371('0x41')],{})['then'](respondWithResult(_0x49412b,0xc9))[_0x0371('0x3d')](handleError(_0x49412b,null));};exports[_0x0371('0x1f')]=function(_0x17dbea,_0x18be05){if(_0x17dbea[_0x0371('0x41')]['id']){delete _0x17dbea['body']['id'];}return db[_0x0371('0x28')][_0x0371('0x3f')]({'where':{'id':_0x17dbea[_0x0371('0x42')]['id']}})[_0x0371('0x20')](handleEntityNotFound(_0x18be05,null))[_0x0371('0x20')](saveUpdates(_0x17dbea[_0x0371('0x41')],null))[_0x0371('0x20')](respondWithResult(_0x18be05,null))[_0x0371('0x3d')](handleError(_0x18be05,null));};exports[_0x0371('0x43')]=function(_0x5afb0e,_0x5b304c){return db[_0x0371('0x28')][_0x0371('0x3f')]({'where':{'id':_0x5afb0e[_0x0371('0x42')]['id']}})[_0x0371('0x20')](handleEntityNotFound(_0x5b304c,null))['then'](removeEntity(_0x5b304c,null))[_0x0371('0x3d')](handleError(_0x5b304c,null));};exports[_0x0371('0x44')]=function(_0x10010d,_0x3b7872){return db[_0x0371('0x28')]['describe']()[_0x0371('0x20')](respondWithResult(_0x3b7872,null))[_0x0371('0x3d')](handleError(_0x3b7872,null));}; \ No newline at end of file +var _0x4fb3=['sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','rows','show','params','rawAttributes','include','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','end','stack','name','map','OpenchannelTransferReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x7f6f03,_0x186d8f){var _0x25d943=function(_0x32df2b){while(--_0x32df2b){_0x7f6f03['push'](_0x7f6f03['shift']());}};_0x25d943(++_0x186d8f);}(_0x4fb3,0x1c8));var _0x34fb=function(_0x56cf26,_0x511d99){_0x56cf26=_0x56cf26-0x0;var _0x7b3f41=_0x4fb3[_0x56cf26];return _0x7b3f41;};'use strict';var emlformat=require(_0x34fb('0x0'));var rimraf=require(_0x34fb('0x1'));var zipdir=require(_0x34fb('0x2'));var jsonpatch=require(_0x34fb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34fb('0x4'));var Mustache=require(_0x34fb('0x5'));var util=require(_0x34fb('0x6'));var path=require(_0x34fb('0x7'));var sox=require('sox');var csv=require(_0x34fb('0x8'));var ejs=require(_0x34fb('0x9'));var fs=require('fs');var fs_extra=require(_0x34fb('0xa'));var _=require(_0x34fb('0xb'));var squel=require('squel');var crypto=require(_0x34fb('0xc'));var jsforce=require(_0x34fb('0xd'));var deskjs=require(_0x34fb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x34fb('0xf'));var Papa=require(_0x34fb('0x10'));var Redis=require(_0x34fb('0x11'));var authService=require(_0x34fb('0x12'));var qs=require(_0x34fb('0x13'));var as=require(_0x34fb('0x14'));var hardwareService=require(_0x34fb('0x15'));var logger=require(_0x34fb('0x16'))(_0x34fb('0x17'));var utils=require('../../config/utils');var config=require(_0x34fb('0x18'));var licenseUtil=require(_0x34fb('0x19'));var db=require(_0x34fb('0x1a'))['db'];function respondWithStatusCode(_0x2bd8d3,_0x5d2e6c){_0x5d2e6c=_0x5d2e6c||0xcc;return function(_0x3be4ca){if(_0x3be4ca){return _0x2bd8d3[_0x34fb('0x1b')](_0x5d2e6c);}return _0x2bd8d3[_0x34fb('0x1c')](_0x5d2e6c)['end']();};}function respondWithResult(_0x5f3ff8,_0x3b7fb7){_0x3b7fb7=_0x3b7fb7||0xc8;return function(_0x1d4641){if(_0x1d4641){return _0x5f3ff8['status'](_0x3b7fb7)[_0x34fb('0x1d')](_0x1d4641);}};}function respondWithFilteredResult(_0xde5bb6,_0x37c856){return function(_0x31ec85){if(_0x31ec85){var _0x331328=typeof _0x37c856[_0x34fb('0x1e')]===_0x34fb('0x1f')&&typeof _0x37c856[_0x34fb('0x20')]==='undefined';var _0x3fa9c1=_0x31ec85['count'];var _0x13a95c=_0x331328?0x0:_0x37c856[_0x34fb('0x1e')];var _0x183f13=_0x331328?_0x31ec85['count']:_0x37c856[_0x34fb('0x1e')]+_0x37c856[_0x34fb('0x20')];var _0x2d78e6;if(_0x183f13>=_0x3fa9c1){_0x183f13=_0x3fa9c1;_0x2d78e6=0xc8;}else{_0x2d78e6=0xce;}_0xde5bb6[_0x34fb('0x1c')](_0x2d78e6);return _0xde5bb6['set'](_0x34fb('0x21'),_0x13a95c+'-'+_0x183f13+'/'+_0x3fa9c1)[_0x34fb('0x1d')](_0x31ec85);}return null;};}function patchUpdates(_0x2d3ddc){return function(_0x2fccd0){try{jsonpatch[_0x34fb('0x22')](_0x2fccd0,_0x2d3ddc,!![]);}catch(_0x520b6a){return BPromise[_0x34fb('0x23')](_0x520b6a);}return _0x2fccd0['save']();};}function saveUpdates(_0x2094d1,_0x484e4d){return function(_0xe770ba){if(_0xe770ba){return _0xe770ba[_0x34fb('0x24')](_0x2094d1)[_0x34fb('0x25')](function(_0x521afb){return _0x521afb;});}return null;};}function removeEntity(_0x186388,_0x58f0b2){return function(_0x39e15b){if(_0x39e15b){return _0x39e15b['destroy']()['then'](function(){_0x186388[_0x34fb('0x1c')](0xcc)[_0x34fb('0x26')]();});}};}function handleEntityNotFound(_0x1d8d5a,_0x437904){return function(_0x478aee){if(!_0x478aee){_0x1d8d5a['sendStatus'](0x194);}return _0x478aee;};}function handleError(_0x50c663,_0x516166){_0x516166=_0x516166||0x1f4;return function(_0x2fdcd6){logger['error'](_0x2fdcd6[_0x34fb('0x27')]);if(_0x2fdcd6[_0x34fb('0x28')]){delete _0x2fdcd6['name'];}_0x50c663[_0x34fb('0x1c')](_0x516166)['send'](_0x2fdcd6);};}exports['index']=function(_0x311d7a,_0x14d231){var _0x1f10d8={},_0x27583e={},_0x5ec01d={'count':0x0,'rows':[]};var _0x57fb6d=_[_0x34fb('0x29')](db[_0x34fb('0x2a')]['rawAttributes'],function(_0x1f8cc7){return{'name':_0x1f8cc7[_0x34fb('0x2b')],'type':_0x1f8cc7[_0x34fb('0x2c')][_0x34fb('0x2d')]};});_0x27583e['model']=_[_0x34fb('0x29')](_0x57fb6d,'name');_0x27583e[_0x34fb('0x2e')]=_[_0x34fb('0x2f')](_0x311d7a['query']);_0x27583e['filters']=_[_0x34fb('0x30')](_0x27583e[_0x34fb('0x31')],_0x27583e['query']);_0x1f10d8[_0x34fb('0x32')]=_['intersection'](_0x27583e['model'],qs[_0x34fb('0x33')](_0x311d7a['query'][_0x34fb('0x33')]));_0x1f10d8[_0x34fb('0x32')]=_0x1f10d8[_0x34fb('0x32')][_0x34fb('0x34')]?_0x1f10d8[_0x34fb('0x32')]:_0x27583e[_0x34fb('0x31')];if(!_0x311d7a[_0x34fb('0x2e')][_0x34fb('0x35')]('nolimit')){_0x1f10d8['limit']=qs[_0x34fb('0x20')](_0x311d7a['query']['limit']);_0x1f10d8['offset']=qs[_0x34fb('0x1e')](_0x311d7a['query'][_0x34fb('0x1e')]);}_0x1f10d8[_0x34fb('0x36')]=qs['sort'](_0x311d7a[_0x34fb('0x2e')][_0x34fb('0x37')]);_0x1f10d8['where']=qs[_0x34fb('0x38')](_['pick'](_0x311d7a[_0x34fb('0x2e')],_0x27583e[_0x34fb('0x38')]),_0x57fb6d);if(_0x311d7a[_0x34fb('0x2e')][_0x34fb('0x39')]){_0x1f10d8[_0x34fb('0x3a')]=_[_0x34fb('0x3b')](_0x1f10d8[_0x34fb('0x3a')],{'$or':_[_0x34fb('0x29')](_0x57fb6d,function(_0x53a642){if(_0x53a642[_0x34fb('0x2c')]!==_0x34fb('0x3c')){var _0x3d13b1={};_0x3d13b1[_0x53a642[_0x34fb('0x28')]]={'$like':'%'+_0x311d7a[_0x34fb('0x2e')][_0x34fb('0x39')]+'%'};return _0x3d13b1;}})});}_0x1f10d8=_[_0x34fb('0x3b')]({},_0x1f10d8,_0x311d7a[_0x34fb('0x3d')]);var _0xa6b71a={'where':_0x1f10d8['where']};return db[_0x34fb('0x2a')][_0x34fb('0x3e')](_0xa6b71a)[_0x34fb('0x25')](function(_0x2ad823){_0x5ec01d[_0x34fb('0x3e')]=_0x2ad823;if(_0x311d7a[_0x34fb('0x2e')][_0x34fb('0x3f')]){_0x1f10d8['include']=[{'all':!![]}];}return db[_0x34fb('0x2a')]['findAll'](_0x1f10d8);})[_0x34fb('0x25')](function(_0xc22d9f){_0x5ec01d[_0x34fb('0x40')]=_0xc22d9f;return _0x5ec01d;})['then'](respondWithFilteredResult(_0x14d231,_0x1f10d8))['catch'](handleError(_0x14d231,null));};exports[_0x34fb('0x41')]=function(_0x529685,_0x4d3e1b){var _0x26762a={'raw':!![],'where':{'id':_0x529685[_0x34fb('0x42')]['id']}},_0x183a90={};_0x183a90['model']=_[_0x34fb('0x2f')](db['OpenchannelTransferReport'][_0x34fb('0x43')]);_0x183a90[_0x34fb('0x2e')]=_[_0x34fb('0x2f')](_0x529685['query']);_0x183a90[_0x34fb('0x38')]=_['intersection'](_0x183a90[_0x34fb('0x31')],_0x183a90['query']);_0x26762a[_0x34fb('0x32')]=_['intersection'](_0x183a90[_0x34fb('0x31')],qs[_0x34fb('0x33')](_0x529685['query'][_0x34fb('0x33')]));_0x26762a[_0x34fb('0x32')]=_0x26762a['attributes'][_0x34fb('0x34')]?_0x26762a[_0x34fb('0x32')]:_0x183a90[_0x34fb('0x31')];if(_0x529685[_0x34fb('0x2e')]['includeAll']){_0x26762a[_0x34fb('0x44')]=[{'all':!![]}];}_0x26762a=_[_0x34fb('0x3b')]({},_0x26762a,_0x529685['options']);return db[_0x34fb('0x2a')]['find'](_0x26762a)[_0x34fb('0x25')](handleEntityNotFound(_0x4d3e1b,null))[_0x34fb('0x25')](respondWithResult(_0x4d3e1b,null))['catch'](handleError(_0x4d3e1b,null));};exports['create']=function(_0x45200a,_0x30e1ee){return db[_0x34fb('0x2a')]['create'](_0x45200a[_0x34fb('0x45')],{})['then'](respondWithResult(_0x30e1ee,0xc9))[_0x34fb('0x46')](handleError(_0x30e1ee,null));};exports[_0x34fb('0x24')]=function(_0x4e7031,_0x18a36c){if(_0x4e7031[_0x34fb('0x45')]['id']){delete _0x4e7031[_0x34fb('0x45')]['id'];}return db[_0x34fb('0x2a')]['find']({'where':{'id':_0x4e7031[_0x34fb('0x42')]['id']}})['then'](handleEntityNotFound(_0x18a36c,null))[_0x34fb('0x25')](saveUpdates(_0x4e7031[_0x34fb('0x45')],null))[_0x34fb('0x25')](respondWithResult(_0x18a36c,null))[_0x34fb('0x46')](handleError(_0x18a36c,null));};exports[_0x34fb('0x47')]=function(_0x299b06,_0x20d446){return db[_0x34fb('0x2a')]['find']({'where':{'id':_0x299b06['params']['id']}})[_0x34fb('0x25')](handleEntityNotFound(_0x20d446,null))['then'](removeEntity(_0x20d446,null))['catch'](handleError(_0x20d446,null));};exports['describe']=function(_0x5b8b5e,_0x4f06e6){return db[_0x34fb('0x2a')][_0x34fb('0x48')]()[_0x34fb('0x25')](respondWithResult(_0x4f06e6,null))[_0x34fb('0x46')](handleError(_0x4f06e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1a5f927..949c5e8 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 _0x7051=['util','../../config/logger','api','moment','request-promise','path','rimraf','uniqueid','lodash'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x7051,0x1c1));var _0x1705=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x7051[_0x183b97];return _0x629cf7;};'use strict';var _=require(_0x1705('0x0'));var util=require(_0x1705('0x1'));var logger=require(_0x1705('0x2'))(_0x1705('0x3'));var moment=require(_0x1705('0x4'));var BPromise=require('bluebird');var rp=require(_0x1705('0x5'));var fs=require('fs');var path=require(_0x1705('0x6'));var rimraf=require(_0x1705('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x22d70e,_0x597acf){return _0x22d70e['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1705('0x8'),'fields':[_0x1705('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1186=['../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x572b2e,_0x3a3728){var _0x469a19=function(_0x210e7c){while(--_0x210e7c){_0x572b2e['push'](_0x572b2e['shift']());}};_0x469a19(++_0x3a3728);}(_0x1186,0x84));var _0x6118=function(_0x56e744,_0x1e3074){_0x56e744=_0x56e744-0x0;var _0x2896da=_0x1186[_0x56e744];return _0x2896da;};'use strict';var _=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var logger=require('../../config/logger')(_0x6118('0x2'));var moment=require(_0x6118('0x3'));var BPromise=require(_0x6118('0x4'));var rp=require(_0x6118('0x5'));var fs=require('fs');var path=require(_0x6118('0x6'));var rimraf=require(_0x6118('0x7'));var config=require(_0x6118('0x8'));var attributes=require(_0x6118('0x9'));module[_0x6118('0xa')]=function(_0xc89051,_0x42ddb3){return _0xc89051[_0x6118('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x6118('0xc'),'paranoid':![],'indexes':[{'name':_0x6118('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 102dedf..d0c4fde 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 _0xc818=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a782b,_0x55584a){var _0x5cb5a0=function(_0x3010ed){while(--_0x3010ed){_0x4a782b['push'](_0x4a782b['shift']());}};_0x5cb5a0(++_0x55584a);}(_0xc818,0x1e3));var _0x8c81=function(_0x3397bb,_0x44e1e4){_0x3397bb=_0x3397bb-0x0;var _0x1982d5=_0xc818[_0x3397bb];return _0x1982d5;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c81('0x4'));var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require(_0x8c81('0xa'));var client=jayson['client'][_0x8c81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d663e,_0x32cf31,_0x43d142){return new BPromise(function(_0x501240,_0x1173cf){return client[_0x8c81('0xc')](_0x3d663e,_0x43d142)[_0x8c81('0xd')](function(_0x15ebff){logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));logger['debug'](_0x8c81('0x11'),_0x32cf31,_0x8c81('0x10'),JSON[_0x8c81('0x12')](_0x15ebff));if(_0x15ebff[_0x8c81('0x13')]){if(_0x15ebff['error'][_0x8c81('0x14')]===0x1f4){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);return _0x1173cf(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x15ebff['error']['message']);return _0x501240(_0x15ebff[_0x8c81('0x13')][_0x8c81('0x15')]);}else{logger[_0x8c81('0xe')](_0x8c81('0xf'),_0x32cf31,_0x8c81('0x10'));_0x501240(_0x15ebff[_0x8c81('0x16')]['message']);}})[_0x8c81('0x17')](function(_0x29ccb0){logger[_0x8c81('0x13')](_0x8c81('0xf'),_0x32cf31,_0x29ccb0);_0x1173cf(_0x29ccb0);});});} \ No newline at end of file +var _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1efed4,_0x3e803b){var _0x2e76e9=function(_0x1305e1){while(--_0x1305e1){_0x1efed4['push'](_0x1efed4['shift']());}};_0x2e76e9(++_0x3e803b);}(_0xf69d,0xd3));var _0xdf69=function(_0xe8d42d,_0x339154){_0xe8d42d=_0xe8d42d-0x0;var _0x28b6ee=_0xf69d[_0xe8d42d];return _0x28b6ee;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a74f636..3553840 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 _0x7143=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x7143,0x12f));var _0x3714=function(_0x2b6f6a,_0x13e70a){_0x2b6f6a=_0x2b6f6a-0x0;var _0x457a1d=_0x7143[_0x2b6f6a];return _0x457a1d;};'use strict';var multer=require(_0x3714('0x0'));var util=require(_0x3714('0x1'));var path=require(_0x3714('0x2'));var timeout=require(_0x3714('0x3'));var express=require(_0x3714('0x4'));var router=express[_0x3714('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3714('0x6'));var interaction=require(_0x3714('0x7'));var config=require('../../config/environment');var controller=require(_0x3714('0x8'));router[_0x3714('0x9')]('/',auth[_0x3714('0xa')](),controller[_0x3714('0xb')]);router[_0x3714('0x9')](_0x3714('0xc'),auth[_0x3714('0xa')](),controller[_0x3714('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3714('0xe')]);router['put'](_0x3714('0xc'),auth['isAuthenticated'](),controller[_0x3714('0xf')]);router['delete']('/:id',auth[_0x3714('0xa')](),controller[_0x3714('0x10')]);module[_0x3714('0x11')]=router; \ No newline at end of file +var _0xfaae=['destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xfaae,0x1aa));var _0xefaa=function(_0x3a276f,_0xd78a7b){_0x3a276f=_0x3a276f-0x0;var _0x520616=_0xfaae[_0x3a276f];return _0x520616;};'use strict';var multer=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var path=require(_0xefaa('0x2'));var timeout=require(_0xefaa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefaa('0x4'));var auth=require(_0xefaa('0x5'));var interaction=require(_0xefaa('0x6'));var config=require(_0xefaa('0x7'));var controller=require('./pause.controller');router['get']('/',auth[_0xefaa('0x8')](),controller[_0xefaa('0x9')]);router['get'](_0xefaa('0xa'),auth[_0xefaa('0x8')](),controller[_0xefaa('0xb')]);router[_0xefaa('0xc')]('/',auth[_0xefaa('0x8')](),controller[_0xefaa('0xd')]);router['put'](_0xefaa('0xa'),auth['isAuthenticated'](),controller[_0xefaa('0xe')]);router[_0xefaa('0xf')](_0xefaa('0xa'),auth[_0xefaa('0x8')](),controller[_0xefaa('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ff0666d..06a2748 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 _0xcd5b=['sequelize','exports','STRING','name'];(function(_0x20bdee,_0x444dda){var _0x300fd5=function(_0x3afe82){while(--_0x3afe82){_0x20bdee['push'](_0x20bdee['shift']());}};_0x300fd5(++_0x444dda);}(_0xcd5b,0xcc));var _0xbcd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd5b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbcd5('0x0'));module[_0xbcd5('0x1')]={'name':{'type':Sequelize[_0xbcd5('0x2')],'unique':_0xbcd5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbcd5('0x2')]}}; \ No newline at end of file +var _0x8fc1=['STRING','name'];(function(_0x8c7ba1,_0x9d815a){var _0x55e2c2=function(_0x311c7a){while(--_0x311c7a){_0x8c7ba1['push'](_0x8c7ba1['shift']());}};_0x55e2c2(++_0x9d815a);}(_0x8fc1,0x178));var _0x18fc=function(_0x399f7b,_0x112455){_0x399f7b=_0x399f7b-0x0;var _0x1a7a4f=_0x8fc1[_0x399f7b];return _0x1a7a4f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x18fc('0x0')],'unique':_0x18fc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x18fc('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 320b25d..3764ebc 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 _0xbde1=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','Pause','includeAll','findAll','catch','show','params','filters','include','merge','find','create','body','get','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','Pauses','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection'];(function(_0x949dfa,_0x43772b){var _0x5c2156=function(_0x33913d){while(--_0x33913d){_0x949dfa['push'](_0x949dfa['shift']());}};_0x5c2156(++_0x43772b);}(_0xbde1,0x156));var _0x1bde=function(_0x2d54ba,_0x3e6ed6){_0x2d54ba=_0x2d54ba-0x0;var _0x1a133e=_0xbde1[_0x2d54ba];return _0x1a133e;};'use strict';var emlformat=require(_0x1bde('0x0'));var rimraf=require(_0x1bde('0x1'));var zipdir=require(_0x1bde('0x2'));var jsonpatch=require(_0x1bde('0x3'));var rp=require('request-promise');var moment=require(_0x1bde('0x4'));var BPromise=require(_0x1bde('0x5'));var Mustache=require(_0x1bde('0x6'));var util=require(_0x1bde('0x7'));var path=require(_0x1bde('0x8'));var sox=require(_0x1bde('0x9'));var csv=require(_0x1bde('0xa'));var ejs=require(_0x1bde('0xb'));var fs=require('fs');var fs_extra=require(_0x1bde('0xc'));var _=require('lodash');var squel=require(_0x1bde('0xd'));var crypto=require(_0x1bde('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1bde('0xa'));var querystring=require(_0x1bde('0xf'));var Papa=require('papaparse');var Redis=require(_0x1bde('0x10'));var authService=require(_0x1bde('0x11'));var qs=require(_0x1bde('0x12'));var as=require(_0x1bde('0x13'));var hardwareService=require(_0x1bde('0x14'));var logger=require('../../config/logger')(_0x1bde('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1bde('0x16'));var db=require(_0x1bde('0x17'))['db'];function respondWithStatusCode(_0x99abc,_0x5068df){_0x5068df=_0x5068df||0xcc;return function(_0x402254){if(_0x402254){return _0x99abc['sendStatus'](_0x5068df);}return _0x99abc[_0x1bde('0x18')](_0x5068df)['end']();};}function respondWithResult(_0x567ed0,_0x2e1276){_0x2e1276=_0x2e1276||0xc8;return function(_0xf1b9cf){if(_0xf1b9cf){return _0x567ed0['status'](_0x2e1276)[_0x1bde('0x19')](_0xf1b9cf);}};}function respondWithFilteredResult(_0x3d519f,_0x1ae42e){return function(_0x25da73){if(_0x25da73){var _0xca1c80=typeof _0x1ae42e['offset']===_0x1bde('0x1a')&&typeof _0x1ae42e[_0x1bde('0x1b')]===_0x1bde('0x1a');var _0x1f7641=_0x25da73[_0x1bde('0x1c')];var _0x17a347=_0xca1c80?0x0:_0x1ae42e['offset'];var _0x50fde8=_0xca1c80?_0x25da73[_0x1bde('0x1c')]:_0x1ae42e[_0x1bde('0x1d')]+_0x1ae42e['limit'];var _0x1feb33;if(_0x50fde8>=_0x1f7641){_0x50fde8=_0x1f7641;_0x1feb33=0xc8;}else{_0x1feb33=0xce;}_0x3d519f[_0x1bde('0x18')](_0x1feb33);return _0x3d519f[_0x1bde('0x1e')](_0x1bde('0x1f'),_0x17a347+'-'+_0x50fde8+'/'+_0x1f7641)[_0x1bde('0x19')](_0x25da73);}return null;};}function patchUpdates(_0x14dc2d){return function(_0x21310b){try{jsonpatch[_0x1bde('0x20')](_0x21310b,_0x14dc2d,!![]);}catch(_0x2518e8){return BPromise[_0x1bde('0x21')](_0x2518e8);}return _0x21310b['save']();};}function saveUpdates(_0x28ccd5,_0x49bfea){return function(_0xeba69a){if(_0xeba69a){return _0xeba69a[_0x1bde('0x22')](_0x28ccd5)['then'](function(_0x45e4ff){return _0x45e4ff;});}return null;};}function removeEntity(_0x180875,_0x3ec07f){return function(_0x321436){if(_0x321436){return _0x321436[_0x1bde('0x23')]()[_0x1bde('0x24')](function(){var _0x325528=_0x321436['get']({'plain':!![]});var _0xa315b2=_0x1bde('0x25');return db['UserProfileResource'][_0x1bde('0x23')]({'where':{'type':_0xa315b2,'resourceId':_0x325528['id']}})[_0x1bde('0x24')](function(){return _0x321436;});})[_0x1bde('0x24')](function(){_0x180875[_0x1bde('0x18')](0xcc)[_0x1bde('0x26')]();});}};}function handleEntityNotFound(_0x4abecb,_0x14f3a1){return function(_0x25ea62){if(!_0x25ea62){_0x4abecb[_0x1bde('0x27')](0x194);}return _0x25ea62;};}function handleError(_0x3add97,_0x46782e){_0x46782e=_0x46782e||0x1f4;return function(_0x82fbd9){logger[_0x1bde('0x28')](_0x82fbd9[_0x1bde('0x29')]);if(_0x82fbd9['name']){delete _0x82fbd9[_0x1bde('0x2a')];}_0x3add97['status'](_0x46782e)[_0x1bde('0x2b')](_0x82fbd9);};}exports[_0x1bde('0x2c')]=function(_0x2e6b07,_0x34e73e){var _0x38d783={},_0x3e4738={},_0x29ad41={'count':0x0,'rows':[]};var _0x4a4b53=_['map'](db['Pause'][_0x1bde('0x2d')],function(_0x50e9d9){return{'name':_0x50e9d9[_0x1bde('0x2e')],'type':_0x50e9d9['type'][_0x1bde('0x2f')]};});_0x3e4738[_0x1bde('0x30')]=_[_0x1bde('0x31')](_0x4a4b53,_0x1bde('0x2a'));_0x3e4738['query']=_[_0x1bde('0x32')](_0x2e6b07[_0x1bde('0x33')]);_0x3e4738['filters']=_[_0x1bde('0x34')](_0x3e4738['model'],_0x3e4738[_0x1bde('0x33')]);_0x38d783[_0x1bde('0x35')]=_[_0x1bde('0x34')](_0x3e4738[_0x1bde('0x30')],qs[_0x1bde('0x36')](_0x2e6b07['query'][_0x1bde('0x36')]));_0x38d783[_0x1bde('0x35')]=_0x38d783[_0x1bde('0x35')][_0x1bde('0x37')]?_0x38d783[_0x1bde('0x35')]:_0x3e4738[_0x1bde('0x30')];if(!_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x38')]('nolimit')){_0x38d783['limit']=qs[_0x1bde('0x1b')](_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x1b')]);_0x38d783['offset']=qs[_0x1bde('0x1d')](_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x1d')]);}_0x38d783[_0x1bde('0x39')]=qs[_0x1bde('0x3a')](_0x2e6b07['query'][_0x1bde('0x3a')]);_0x38d783[_0x1bde('0x3b')]=qs['filters'](_[_0x1bde('0x3c')](_0x2e6b07[_0x1bde('0x33')],_0x3e4738['filters']),_0x4a4b53);if(_0x2e6b07[_0x1bde('0x33')][_0x1bde('0x3d')]){_0x38d783[_0x1bde('0x3b')]=_['merge'](_0x38d783['where'],{'$or':_['map'](_0x4a4b53,function(_0x20bfe5){if(_0x20bfe5['type']!=='VIRTUAL'){var _0x51dec6={};_0x51dec6[_0x20bfe5[_0x1bde('0x2a')]]={'$like':'%'+_0x2e6b07['query']['filter']+'%'};return _0x51dec6;}})});}_0x38d783=_['merge']({},_0x38d783,_0x2e6b07[_0x1bde('0x3e')]);var _0x3df3f1={'where':_0x38d783[_0x1bde('0x3b')]};return db[_0x1bde('0x3f')][_0x1bde('0x1c')](_0x3df3f1)[_0x1bde('0x24')](function(_0x36d084){_0x29ad41[_0x1bde('0x1c')]=_0x36d084;if(_0x2e6b07['query'][_0x1bde('0x40')]){_0x38d783['include']=[{'all':!![]}];}return db[_0x1bde('0x3f')][_0x1bde('0x41')](_0x38d783);})['then'](function(_0x3514de){_0x29ad41['rows']=_0x3514de;return _0x29ad41;})[_0x1bde('0x24')](respondWithFilteredResult(_0x34e73e,_0x38d783))[_0x1bde('0x42')](handleError(_0x34e73e,null));};exports[_0x1bde('0x43')]=function(_0x35c67c,_0x4cc5ea){var _0x4529eb={'raw':!![],'where':{'id':_0x35c67c[_0x1bde('0x44')]['id']}},_0x1bb703={};_0x1bb703['model']=_[_0x1bde('0x32')](db[_0x1bde('0x3f')][_0x1bde('0x2d')]);_0x1bb703[_0x1bde('0x33')]=_[_0x1bde('0x32')](_0x35c67c[_0x1bde('0x33')]);_0x1bb703[_0x1bde('0x45')]=_[_0x1bde('0x34')](_0x1bb703['model'],_0x1bb703[_0x1bde('0x33')]);_0x4529eb[_0x1bde('0x35')]=_[_0x1bde('0x34')](_0x1bb703['model'],qs[_0x1bde('0x36')](_0x35c67c[_0x1bde('0x33')]['fields']));_0x4529eb['attributes']=_0x4529eb[_0x1bde('0x35')][_0x1bde('0x37')]?_0x4529eb['attributes']:_0x1bb703['model'];if(_0x35c67c['query'][_0x1bde('0x40')]){_0x4529eb[_0x1bde('0x46')]=[{'all':!![]}];}_0x4529eb=_[_0x1bde('0x47')]({},_0x4529eb,_0x35c67c[_0x1bde('0x3e')]);return db[_0x1bde('0x3f')][_0x1bde('0x48')](_0x4529eb)[_0x1bde('0x24')](handleEntityNotFound(_0x4cc5ea,null))[_0x1bde('0x24')](respondWithResult(_0x4cc5ea,null))['catch'](handleError(_0x4cc5ea,null));};exports[_0x1bde('0x49')]=function(_0x283eef,_0x5c1979){return db[_0x1bde('0x3f')][_0x1bde('0x49')](_0x283eef[_0x1bde('0x4a')],{})[_0x1bde('0x24')](function(_0x4801d5){var _0x5c1a97=_0x283eef['user'][_0x1bde('0x4b')]({'plain':!![]});if(!_0x5c1a97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c1a97[_0x1bde('0x4c')]==='user'){var _0x16d2ba=_0x4801d5[_0x1bde('0x4b')]({'plain':!![]});var _0x3d4621=_0x1bde('0x25');return db['UserProfileSection'][_0x1bde('0x48')]({'where':{'name':_0x3d4621,'userProfileId':_0x5c1a97['userProfileId']},'raw':!![]})['then'](function(_0x193703){if(_0x193703&&_0x193703['autoAssociation']===0x0){return db[_0x1bde('0x4d')][_0x1bde('0x49')]({'name':_0x16d2ba['name'],'resourceId':_0x16d2ba['id'],'type':_0x193703[_0x1bde('0x2a')],'sectionId':_0x193703['id']},{})[_0x1bde('0x24')](function(){return _0x4801d5;});}else{return _0x4801d5;}})[_0x1bde('0x42')](function(_0x445aae){logger[_0x1bde('0x28')](_0x1bde('0x4e'),_0x445aae);throw _0x445aae;});}return _0x4801d5;})['then'](respondWithResult(_0x5c1979,0xc9))[_0x1bde('0x42')](handleError(_0x5c1979,null));};exports['update']=function(_0x1bc801,_0x3aaa3f){if(_0x1bc801[_0x1bde('0x4a')]['id']){delete _0x1bc801[_0x1bde('0x4a')]['id'];}return db[_0x1bde('0x3f')][_0x1bde('0x48')]({'where':{'id':_0x1bc801[_0x1bde('0x44')]['id']}})['then'](handleEntityNotFound(_0x3aaa3f,null))[_0x1bde('0x24')](saveUpdates(_0x1bc801[_0x1bde('0x4a')],null))[_0x1bde('0x24')](respondWithResult(_0x3aaa3f,null))[_0x1bde('0x42')](handleError(_0x3aaa3f,null));};exports['destroy']=function(_0x2673d1,_0x503a3b){return db[_0x1bde('0x3f')][_0x1bde('0x48')]({'where':{'id':_0x2673d1[_0x1bde('0x44')]['id']}})['then'](handleEntityNotFound(_0x503a3b,null))[_0x1bde('0x24')](removeEntity(_0x503a3b,null))[_0x1bde('0x42')](handleError(_0x503a3b,null));}; \ No newline at end of file +var _0x4862=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','name','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','nolimit','sort','where','pick','filters','merge','filter','includeAll','rows','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xd25228,_0x19678b){var _0x2529dc=function(_0x3a53c7){while(--_0x3a53c7){_0xd25228['push'](_0xd25228['shift']());}};_0x2529dc(++_0x19678b);}(_0x4862,0x19f));var _0x2486=function(_0x32c48c,_0x5d669e){_0x32c48c=_0x32c48c-0x0;var _0x133729=_0x4862[_0x32c48c];return _0x133729;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2486('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2486('0x1'));var rp=require(_0x2486('0x2'));var moment=require(_0x2486('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2486('0x4'));var path=require(_0x2486('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2486('0x6'));var fs=require('fs');var fs_extra=require(_0x2486('0x7'));var _=require(_0x2486('0x8'));var squel=require('squel');var crypto=require(_0x2486('0x9'));var jsforce=require(_0x2486('0xa'));var deskjs=require(_0x2486('0xb'));var toCsv=require(_0x2486('0xc'));var querystring=require('querystring');var Papa=require(_0x2486('0xd'));var Redis=require(_0x2486('0xe'));var authService=require(_0x2486('0xf'));var qs=require(_0x2486('0x10'));var as=require(_0x2486('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2486('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2656f8,_0x450a2a){_0x450a2a=_0x450a2a||0xcc;return function(_0x57a167){if(_0x57a167){return _0x2656f8[_0x2486('0x13')](_0x450a2a);}return _0x2656f8[_0x2486('0x14')](_0x450a2a)['end']();};}function respondWithResult(_0x4d62ca,_0x22f681){_0x22f681=_0x22f681||0xc8;return function(_0x27ee32){if(_0x27ee32){return _0x4d62ca[_0x2486('0x14')](_0x22f681)[_0x2486('0x15')](_0x27ee32);}};}function respondWithFilteredResult(_0x3e80eb,_0x578479){return function(_0x2db08c){if(_0x2db08c){var _0x5e7676=typeof _0x578479['offset']===_0x2486('0x16')&&typeof _0x578479[_0x2486('0x17')]===_0x2486('0x16');var _0x281028=_0x2db08c['count'];var _0x23b128=_0x5e7676?0x0:_0x578479[_0x2486('0x18')];var _0x63d749=_0x5e7676?_0x2db08c[_0x2486('0x19')]:_0x578479[_0x2486('0x18')]+_0x578479[_0x2486('0x17')];var _0x16f38b;if(_0x63d749>=_0x281028){_0x63d749=_0x281028;_0x16f38b=0xc8;}else{_0x16f38b=0xce;}_0x3e80eb[_0x2486('0x14')](_0x16f38b);return _0x3e80eb['set'](_0x2486('0x1a'),_0x23b128+'-'+_0x63d749+'/'+_0x281028)['json'](_0x2db08c);}return null;};}function patchUpdates(_0x1416f0){return function(_0x1c5f0b){try{jsonpatch[_0x2486('0x1b')](_0x1c5f0b,_0x1416f0,!![]);}catch(_0x265ca4){return BPromise[_0x2486('0x1c')](_0x265ca4);}return _0x1c5f0b['save']();};}function saveUpdates(_0x3e32e7,_0x1543f0){return function(_0x339316){if(_0x339316){return _0x339316[_0x2486('0x1d')](_0x3e32e7)[_0x2486('0x1e')](function(_0x539699){return _0x539699;});}return null;};}function removeEntity(_0x258280,_0x46aa5d){return function(_0x298878){if(_0x298878){return _0x298878[_0x2486('0x1f')]()[_0x2486('0x1e')](function(){var _0x5e86cb=_0x298878[_0x2486('0x20')]({'plain':!![]});var _0x45cae4=_0x2486('0x21');return db[_0x2486('0x22')]['destroy']({'where':{'type':_0x45cae4,'resourceId':_0x5e86cb['id']}})[_0x2486('0x1e')](function(){return _0x298878;});})[_0x2486('0x1e')](function(){_0x258280[_0x2486('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a43f,_0x5ee84b){return function(_0x234474){if(!_0x234474){_0x39a43f[_0x2486('0x13')](0x194);}return _0x234474;};}function handleError(_0x4d7fb1,_0x256648){_0x256648=_0x256648||0x1f4;return function(_0x24bb38){logger[_0x2486('0x23')](_0x24bb38['stack']);if(_0x24bb38[_0x2486('0x24')]){delete _0x24bb38[_0x2486('0x24')];}_0x4d7fb1[_0x2486('0x14')](_0x256648)['send'](_0x24bb38);};}exports[_0x2486('0x25')]=function(_0x203bb1,_0x2a9251){var _0x539003={},_0x38ba3e={},_0x57e958={'count':0x0,'rows':[]};var _0x4f739b=_[_0x2486('0x26')](db[_0x2486('0x27')][_0x2486('0x28')],function(_0xfa12b0){return{'name':_0xfa12b0[_0x2486('0x29')],'type':_0xfa12b0['type'][_0x2486('0x2a')]};});_0x38ba3e[_0x2486('0x2b')]=_[_0x2486('0x26')](_0x4f739b,_0x2486('0x24'));_0x38ba3e[_0x2486('0x2c')]=_[_0x2486('0x2d')](_0x203bb1[_0x2486('0x2c')]);_0x38ba3e['filters']=_['intersection'](_0x38ba3e[_0x2486('0x2b')],_0x38ba3e[_0x2486('0x2c')]);_0x539003['attributes']=_[_0x2486('0x2e')](_0x38ba3e[_0x2486('0x2b')],qs[_0x2486('0x2f')](_0x203bb1[_0x2486('0x2c')]['fields']));_0x539003[_0x2486('0x30')]=_0x539003[_0x2486('0x30')]['length']?_0x539003[_0x2486('0x30')]:_0x38ba3e[_0x2486('0x2b')];if(!_0x203bb1[_0x2486('0x2c')]['hasOwnProperty'](_0x2486('0x31'))){_0x539003[_0x2486('0x17')]=qs[_0x2486('0x17')](_0x203bb1[_0x2486('0x2c')][_0x2486('0x17')]);_0x539003[_0x2486('0x18')]=qs[_0x2486('0x18')](_0x203bb1[_0x2486('0x2c')]['offset']);}_0x539003['order']=qs[_0x2486('0x32')](_0x203bb1[_0x2486('0x2c')][_0x2486('0x32')]);_0x539003[_0x2486('0x33')]=qs['filters'](_[_0x2486('0x34')](_0x203bb1[_0x2486('0x2c')],_0x38ba3e[_0x2486('0x35')]),_0x4f739b);if(_0x203bb1[_0x2486('0x2c')]['filter']){_0x539003[_0x2486('0x33')]=_[_0x2486('0x36')](_0x539003[_0x2486('0x33')],{'$or':_['map'](_0x4f739b,function(_0x389450){if(_0x389450['type']!=='VIRTUAL'){var _0x1fe867={};_0x1fe867[_0x389450['name']]={'$like':'%'+_0x203bb1[_0x2486('0x2c')][_0x2486('0x37')]+'%'};return _0x1fe867;}})});}_0x539003=_[_0x2486('0x36')]({},_0x539003,_0x203bb1['options']);var _0x1ca563={'where':_0x539003[_0x2486('0x33')]};return db[_0x2486('0x27')][_0x2486('0x19')](_0x1ca563)[_0x2486('0x1e')](function(_0x389f00){_0x57e958[_0x2486('0x19')]=_0x389f00;if(_0x203bb1[_0x2486('0x2c')][_0x2486('0x38')]){_0x539003['include']=[{'all':!![]}];}return db[_0x2486('0x27')]['findAll'](_0x539003);})[_0x2486('0x1e')](function(_0x25c762){_0x57e958[_0x2486('0x39')]=_0x25c762;return _0x57e958;})[_0x2486('0x1e')](respondWithFilteredResult(_0x2a9251,_0x539003))['catch'](handleError(_0x2a9251,null));};exports['show']=function(_0x56506b,_0x207e87){var _0x1fab0f={'raw':!![],'where':{'id':_0x56506b[_0x2486('0x3a')]['id']}},_0x12903d={};_0x12903d['model']=_[_0x2486('0x2d')](db['Pause'][_0x2486('0x28')]);_0x12903d[_0x2486('0x2c')]=_[_0x2486('0x2d')](_0x56506b['query']);_0x12903d['filters']=_[_0x2486('0x2e')](_0x12903d[_0x2486('0x2b')],_0x12903d['query']);_0x1fab0f[_0x2486('0x30')]=_['intersection'](_0x12903d['model'],qs[_0x2486('0x2f')](_0x56506b['query']['fields']));_0x1fab0f[_0x2486('0x30')]=_0x1fab0f[_0x2486('0x30')]['length']?_0x1fab0f[_0x2486('0x30')]:_0x12903d['model'];if(_0x56506b[_0x2486('0x2c')][_0x2486('0x38')]){_0x1fab0f['include']=[{'all':!![]}];}_0x1fab0f=_['merge']({},_0x1fab0f,_0x56506b['options']);return db[_0x2486('0x27')][_0x2486('0x3b')](_0x1fab0f)[_0x2486('0x1e')](handleEntityNotFound(_0x207e87,null))[_0x2486('0x1e')](respondWithResult(_0x207e87,null))[_0x2486('0x3c')](handleError(_0x207e87,null));};exports[_0x2486('0x3d')]=function(_0x9b0d6e,_0x27dcb1){return db[_0x2486('0x27')][_0x2486('0x3d')](_0x9b0d6e[_0x2486('0x3e')],{})['then'](function(_0x41ea43){var _0x48a436=_0x9b0d6e[_0x2486('0x3f')][_0x2486('0x20')]({'plain':!![]});if(!_0x48a436)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48a436[_0x2486('0x40')]===_0x2486('0x3f')){var _0x416f3d=_0x41ea43[_0x2486('0x20')]({'plain':!![]});var _0x31b88b=_0x2486('0x21');return db[_0x2486('0x41')][_0x2486('0x3b')]({'where':{'name':_0x31b88b,'userProfileId':_0x48a436[_0x2486('0x42')]},'raw':!![]})[_0x2486('0x1e')](function(_0x4d5d4e){if(_0x4d5d4e&&_0x4d5d4e[_0x2486('0x43')]===0x0){return db['UserProfileResource'][_0x2486('0x3d')]({'name':_0x416f3d[_0x2486('0x24')],'resourceId':_0x416f3d['id'],'type':_0x4d5d4e[_0x2486('0x24')],'sectionId':_0x4d5d4e['id']},{})['then'](function(){return _0x41ea43;});}else{return _0x41ea43;}})[_0x2486('0x3c')](function(_0x1b4b54){logger[_0x2486('0x23')](_0x2486('0x44'),_0x1b4b54);throw _0x1b4b54;});}return _0x41ea43;})['then'](respondWithResult(_0x27dcb1,0xc9))['catch'](handleError(_0x27dcb1,null));};exports[_0x2486('0x1d')]=function(_0x17f03c,_0x247dfd){if(_0x17f03c[_0x2486('0x3e')]['id']){delete _0x17f03c[_0x2486('0x3e')]['id'];}return db[_0x2486('0x27')][_0x2486('0x3b')]({'where':{'id':_0x17f03c[_0x2486('0x3a')]['id']}})[_0x2486('0x1e')](handleEntityNotFound(_0x247dfd,null))[_0x2486('0x1e')](saveUpdates(_0x17f03c[_0x2486('0x3e')],null))[_0x2486('0x1e')](respondWithResult(_0x247dfd,null))['catch'](handleError(_0x247dfd,null));};exports[_0x2486('0x1f')]=function(_0xd27962,_0xcab1b6){return db['Pause'][_0x2486('0x3b')]({'where':{'id':_0xd27962[_0x2486('0x3a')]['id']}})[_0x2486('0x1e')](handleEntityNotFound(_0xcab1b6,null))['then'](removeEntity(_0xcab1b6,null))[_0x2486('0x3c')](handleError(_0xcab1b6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c0fb135..e5f156e 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x55c72d,_0x5d7876){_0x55c72d=_0x55c72d-0x0;var _0x3b64b6=_0x7fbe[_0x55c72d];return _0x3b64b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x55ca,0x126));var _0xa55c=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x55ca[_0x59ae8f];return _0x3900b5;};'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')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'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 fe80b25..829a94e 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(_0x2c577d,_0x208432){var _0x5c980e=function(_0x2da4a9){while(--_0x2da4a9){_0x2c577d['push'](_0x2c577d['shift']());}};_0x5c980e(++_0x208432);}(_0xb10b,0x12a));var _0xbb10=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0xb10b[_0x515ae8];return _0x4cf66a;};'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(_0x1d6400,_0x3e3ce1){var _0x54bdce=function(_0x230578){while(--_0x230578){_0x1d6400['push'](_0x1d6400['shift']());}};_0x54bdce(++_0x3e3ce1);}(_0x7a54,0x106));var _0x47a5=function(_0x4ac6c8,_0x170266){_0x4ac6c8=_0x4ac6c8-0x0;var _0x434149=_0x7a54[_0x4ac6c8];return _0x434149;};'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 019156b..82342c2 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 _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x180664,_0x1639a6){var _0x4549b6=function(_0xcec3b2){while(--_0xcec3b2){_0x180664['push'](_0x180664['shift']());}};_0x4549b6(++_0x1639a6);}(_0x55e0,0xdc));var _0x055e=function(_0x297b8b,_0x10031d){_0x297b8b=_0x297b8b-0x0;var _0x4566e9=_0x55e0[_0x297b8b];return _0x4566e9;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x032e=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id'];(function(_0x49ea79,_0x57f562){var _0x764176=function(_0x35cb52){while(--_0x35cb52){_0x49ea79['push'](_0x49ea79['shift']());}};_0x764176(++_0x57f562);}(_0x032e,0x124));var _0xe032=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x032e[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),controller[_0xe032('0xc')]);router[_0xe032('0x8')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0x8')](_0xe032('0xf'),auth[_0xe032('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xe032('0x10')]({'destination':function(_0x1ce2ae,_0x13c126,_0x42e2ba){_0x42e2ba(null,path[_0xe032('0x11')](config[_0xe032('0x12')],_0xe032('0x13')));},'filename':function(_0x5bcb5b,_0x646979,_0x266d71){_0x646979[_0xe032('0x14')]=_0x646979[_0xe032('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x266d71(null,util[_0xe032('0x15')](_0xe032('0x16'),path[_0xe032('0x17')](_0x646979[_0xe032('0x14')],path[_0xe032('0x18')](_0x646979[_0xe032('0x14')])),Date[_0xe032('0x19')](),path['extname'](_0x646979[_0xe032('0x14')])));}})});router[_0xe032('0x1a')]('/',upload[_0xe032('0x1b')](_0xe032('0x1c')),controller[_0xe032('0x1d')]);router[_0xe032('0x1a')]('/webhook',controller[_0xe032('0x1e')]);router[_0xe032('0x1f')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe032('0x21')]);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 9c23459..3f54105 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 _0x62cb=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x2b12f7,_0x4033ac){var _0x8cb277=function(_0x713b37){while(--_0x713b37){_0x2b12f7['push'](_0x2b12f7['shift']());}};_0x8cb277(++_0x4033ac);}(_0x62cb,0x7f));var _0xb62c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x62cb[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xb62c('0x0'));module[_0xb62c('0x1')]={'name':{'type':Sequelize[_0xb62c('0x2')]},'type':{'type':Sequelize[_0xb62c('0x3')](_0xb62c('0x4'),_0xb62c('0x5'))},'description':{'type':Sequelize[_0xb62c('0x6')]},'version':{'type':Sequelize[_0xb62c('0x6')]},'path':{'type':Sequelize[_0xb62c('0x2')],'comment':_0xb62c('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb62c('0x3')](_0xb62c('0x8'),_0xb62c('0x9'),'always',_0xb62c('0xa')),'defaultValue':_0xb62c('0xb'),'comment':_0xb62c('0xc')},'icon':{'type':Sequelize[_0xb62c('0x2')]},'adminUrl':{'type':Sequelize[_0xb62c('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb62c('0x2')]},'scriptPath':{'type':Sequelize[_0xb62c('0x2')]}}; \ No newline at end of file +var _0x5547=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never'];(function(_0xc078aa,_0x522b2f){var _0x47617b=function(_0x5d403d){while(--_0x5d403d){_0xc078aa['push'](_0xc078aa['shift']());}};_0x47617b(++_0x522b2f);}(_0x5547,0x76));var _0x7554=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0x5547[_0x7729b1];return _0x349504;};'use strict';var Sequelize=require(_0x7554('0x0'));module[_0x7554('0x1')]={'name':{'type':Sequelize[_0x7554('0x2')]},'type':{'type':Sequelize[_0x7554('0x3')](_0x7554('0x4'),'script')},'description':{'type':Sequelize[_0x7554('0x5')]},'version':{'type':Sequelize[_0x7554('0x5')]},'path':{'type':Sequelize[_0x7554('0x2')],'comment':_0x7554('0x6')},'active':{'type':Sequelize[_0x7554('0x7')],'defaultValue':0x0,'comment':_0x7554('0x8')},'sidebar':{'type':Sequelize[_0x7554('0x3')](_0x7554('0x9'),'agentOnly',_0x7554('0xa'),_0x7554('0xb')),'defaultValue':_0x7554('0xa'),'comment':_0x7554('0xc')},'icon':{'type':Sequelize[_0x7554('0x2')]},'adminUrl':{'type':Sequelize[_0x7554('0x2')]},'agentUrl':{'type':Sequelize[_0x7554('0x2')]},'scriptName':{'type':Sequelize[_0x7554('0x2')]},'scriptPath':{'type':Sequelize[_0x7554('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d84ea01..ee3a73a 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 _0x1b3a=['close','Plugin\x20not\x20found','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','method','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','download','root','server/files/plugins','format','%s.zip','warning','code','Sequelize','Error','**/*','join','dirname','basename','attachments/**/*','finalize'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x1b3a,0x19b));var _0xa1b3=function(_0x18ca27,_0x251b56){_0x18ca27=_0x18ca27-0x0;var _0x2b0d36=_0x1b3a[_0x18ca27];return _0x2b0d36;};'use strict';var emlformat=require(_0xa1b3('0x0'));var rimraf=require(_0xa1b3('0x1'));var zipdir=require(_0xa1b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa1b3('0x3'));var BPromise=require(_0xa1b3('0x4'));var Mustache=require(_0xa1b3('0x5'));var util=require(_0xa1b3('0x6'));var path=require(_0xa1b3('0x7'));var sox=require(_0xa1b3('0x8'));var csv=require(_0xa1b3('0x9'));var ejs=require(_0xa1b3('0xa'));var fs=require('fs');var fs_extra=require(_0xa1b3('0xb'));var _=require('lodash');var squel=require(_0xa1b3('0xc'));var crypto=require(_0xa1b3('0xd'));var jsforce=require(_0xa1b3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa1b3('0x9'));var querystring=require(_0xa1b3('0xf'));var Papa=require('papaparse');var extract=require(_0xa1b3('0x10'));var rimraf=require('rimraf');var archiver=require(_0xa1b3('0x11'));var Redis=require(_0xa1b3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1b3('0x13'));var as=require(_0xa1b3('0x14'));var hardwareService=require(_0xa1b3('0x15'));var logger=require(_0xa1b3('0x16'))(_0xa1b3('0x17'));var utils=require('../../config/utils');var config=require(_0xa1b3('0x18'));var licenseUtil=require(_0xa1b3('0x19'));var db=require(_0xa1b3('0x1a'))['db'];config[_0xa1b3('0x1b')]=_[_0xa1b3('0x1c')](config[_0xa1b3('0x1b')],{'host':_0xa1b3('0x1d'),'port':0x18eb});var socket=require(_0xa1b3('0x1e'))(new Redis(config[_0xa1b3('0x1b')]));require(_0xa1b3('0x1f'))[_0xa1b3('0x20')](socket);function respondWithStatusCode(_0x1b64d5,_0x52849b){_0x52849b=_0x52849b||0xcc;return function(_0x5ac19e){if(_0x5ac19e){return _0x1b64d5[_0xa1b3('0x21')](_0x52849b);}return _0x1b64d5['status'](_0x52849b)[_0xa1b3('0x22')]();};}function respondWithResult(_0x456502,_0x35acc7){_0x35acc7=_0x35acc7||0xc8;return function(_0x3ef200){if(_0x3ef200){return _0x456502[_0xa1b3('0x23')](_0x35acc7)['json'](_0x3ef200);}};}function respondWithFilteredResult(_0x113f17,_0x354a8e){return function(_0xc7b996){if(_0xc7b996){var _0x11a8f7=typeof _0x354a8e[_0xa1b3('0x24')]==='undefined'&&typeof _0x354a8e['limit']===_0xa1b3('0x25');var _0x270e57=_0xc7b996['count'];var _0x1fb22b=_0x11a8f7?0x0:_0x354a8e[_0xa1b3('0x24')];var _0x239f88=_0x11a8f7?_0xc7b996[_0xa1b3('0x26')]:_0x354a8e['offset']+_0x354a8e[_0xa1b3('0x27')];var _0x3b3fe5;if(_0x239f88>=_0x270e57){_0x239f88=_0x270e57;_0x3b3fe5=0xc8;}else{_0x3b3fe5=0xce;}_0x113f17[_0xa1b3('0x23')](_0x3b3fe5);return _0x113f17[_0xa1b3('0x28')](_0xa1b3('0x29'),_0x1fb22b+'-'+_0x239f88+'/'+_0x270e57)['json'](_0xc7b996);}return null;};}function patchUpdates(_0x331e23){return function(_0x286bfa){try{jsonpatch[_0xa1b3('0x2a')](_0x286bfa,_0x331e23,!![]);}catch(_0x1144f4){return BPromise['reject'](_0x1144f4);}return _0x286bfa[_0xa1b3('0x2b')]();};}function saveUpdates(_0x40164e,_0x188ba7){return function(_0x5f212c){if(_0x5f212c){return _0x5f212c[_0xa1b3('0x2c')](_0x40164e)[_0xa1b3('0x2d')](function(_0x1f7d3e){return _0x1f7d3e;});}return null;};}function removeEntity(_0x529d35,_0x50c77d){return function(_0x32b4fd){if(_0x32b4fd){return _0x32b4fd[_0xa1b3('0x2e')]()['then'](function(){var _0x5ba697=_0x32b4fd['get']({'plain':!![]});var _0x287a6d='Plugins';return db[_0xa1b3('0x2f')]['destroy']({'where':{'type':_0x287a6d,'resourceId':_0x5ba697['id']}})['then'](function(){return _0x32b4fd;});})['then'](function(){_0x529d35[_0xa1b3('0x23')](0xcc)[_0xa1b3('0x22')]();});}};}function handleEntityNotFound(_0x522d2f,_0x24deff){return function(_0x5d0604){if(!_0x5d0604){_0x522d2f['sendStatus'](0x194);}return _0x5d0604;};}function handleError(_0x38ea0b,_0x3b31f6){_0x3b31f6=_0x3b31f6||0x1f4;return function(_0x517514){logger[_0xa1b3('0x30')](_0x517514['stack']);if(_0x517514['name']){delete _0x517514[_0xa1b3('0x31')];}_0x38ea0b[_0xa1b3('0x23')](_0x3b31f6)[_0xa1b3('0x32')](_0x517514);};}exports[_0xa1b3('0x33')]=function(_0x2f2639,_0xcecca1){var _0x9f9bee={},_0x10fb81={},_0x1642bf={'count':0x0,'rows':[]};var _0x4e0b75=_[_0xa1b3('0x34')](db[_0xa1b3('0x35')]['rawAttributes'],function(_0x484789){return{'name':_0x484789[_0xa1b3('0x36')],'type':_0x484789[_0xa1b3('0x37')][_0xa1b3('0x38')]};});_0x10fb81[_0xa1b3('0x39')]=_[_0xa1b3('0x34')](_0x4e0b75,_0xa1b3('0x31'));_0x10fb81[_0xa1b3('0x3a')]=_[_0xa1b3('0x3b')](_0x2f2639['query']);_0x10fb81[_0xa1b3('0x3c')]=_[_0xa1b3('0x3d')](_0x10fb81['model'],_0x10fb81[_0xa1b3('0x3a')]);_0x9f9bee['attributes']=_['intersection'](_0x10fb81[_0xa1b3('0x39')],qs[_0xa1b3('0x3e')](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x3e')]));_0x9f9bee[_0xa1b3('0x3f')]=_0x9f9bee[_0xa1b3('0x3f')][_0xa1b3('0x40')]?_0x9f9bee[_0xa1b3('0x3f')]:_0x10fb81['model'];if(!_0x2f2639['query'][_0xa1b3('0x41')](_0xa1b3('0x42'))){_0x9f9bee['limit']=qs[_0xa1b3('0x27')](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x27')]);_0x9f9bee[_0xa1b3('0x24')]=qs[_0xa1b3('0x24')](_0x2f2639[_0xa1b3('0x3a')]['offset']);}_0x9f9bee[_0xa1b3('0x43')]=qs['sort'](_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x44')]);_0x9f9bee[_0xa1b3('0x45')]=qs[_0xa1b3('0x3c')](_[_0xa1b3('0x46')](_0x2f2639['query'],_0x10fb81[_0xa1b3('0x3c')]),_0x4e0b75);if(_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x47')]){_0x9f9bee[_0xa1b3('0x45')]=_[_0xa1b3('0x48')](_0x9f9bee[_0xa1b3('0x45')],{'$or':_[_0xa1b3('0x34')](_0x4e0b75,function(_0x510b2c){if(_0x510b2c[_0xa1b3('0x37')]!==_0xa1b3('0x49')){var _0x48d552={};_0x48d552[_0x510b2c['name']]={'$like':'%'+_0x2f2639[_0xa1b3('0x3a')]['filter']+'%'};return _0x48d552;}})});}_0x9f9bee=_[_0xa1b3('0x48')]({},_0x9f9bee,_0x2f2639[_0xa1b3('0x4a')]);var _0x1c8c25={'where':_0x9f9bee[_0xa1b3('0x45')]};return db['Plugin']['count'](_0x1c8c25)[_0xa1b3('0x2d')](function(_0x19b06b){_0x1642bf[_0xa1b3('0x26')]=_0x19b06b;if(_0x2f2639[_0xa1b3('0x3a')][_0xa1b3('0x4b')]){_0x9f9bee[_0xa1b3('0x4c')]=[{'all':!![]}];}return db[_0xa1b3('0x35')][_0xa1b3('0x4d')](_0x9f9bee);})[_0xa1b3('0x2d')](function(_0x30a4a6){_0x1642bf[_0xa1b3('0x4e')]=_0x30a4a6;return _0x1642bf;})[_0xa1b3('0x2d')](respondWithFilteredResult(_0xcecca1,_0x9f9bee))[_0xa1b3('0x4f')](handleError(_0xcecca1,null));};exports[_0xa1b3('0x50')]=function(_0x72c896,_0x3a5596){var _0xa98814={'raw':!![],'where':{'id':_0x72c896[_0xa1b3('0x51')]['id']}},_0x213344={};_0x213344[_0xa1b3('0x39')]=_[_0xa1b3('0x3b')](db[_0xa1b3('0x35')][_0xa1b3('0x52')]);_0x213344[_0xa1b3('0x3a')]=_[_0xa1b3('0x3b')](_0x72c896[_0xa1b3('0x3a')]);_0x213344[_0xa1b3('0x3c')]=_[_0xa1b3('0x3d')](_0x213344[_0xa1b3('0x39')],_0x213344[_0xa1b3('0x3a')]);_0xa98814[_0xa1b3('0x3f')]=_[_0xa1b3('0x3d')](_0x213344[_0xa1b3('0x39')],qs[_0xa1b3('0x3e')](_0x72c896['query'][_0xa1b3('0x3e')]));_0xa98814[_0xa1b3('0x3f')]=_0xa98814[_0xa1b3('0x3f')]['length']?_0xa98814[_0xa1b3('0x3f')]:_0x213344[_0xa1b3('0x39')];if(_0x72c896[_0xa1b3('0x3a')][_0xa1b3('0x4b')]){_0xa98814['include']=[{'all':!![]}];}_0xa98814=_[_0xa1b3('0x48')]({},_0xa98814,_0x72c896['options']);return db['Plugin'][_0xa1b3('0x53')](_0xa98814)[_0xa1b3('0x2d')](handleEntityNotFound(_0x3a5596,null))[_0xa1b3('0x2d')](respondWithResult(_0x3a5596,null))['catch'](handleError(_0x3a5596,null));};exports[_0xa1b3('0x54')]=function(_0x5142c9,_0x53aeff,_0x19d3f5){return db[_0xa1b3('0x35')][_0xa1b3('0x53')]({'where':{'id':_0x5142c9[_0xa1b3('0x51')]['id']},'attributes':[_0xa1b3('0x31'),_0xa1b3('0x7')],'raw':!![]})[_0xa1b3('0x2d')](handleEntityNotFound(_0x53aeff,null))[_0xa1b3('0x2d')](function(_0xe13a84){if(_0xe13a84){var _0x5ab71d=path['join'](config[_0xa1b3('0x55')],_0xa1b3('0x56'),util[_0xa1b3('0x57')](_0xa1b3('0x58'),path['basename'](_0xe13a84[_0xa1b3('0x7')])));var _0x294996=fs['createWriteStream'](_0x5ab71d);var _0x58a96d=archiver('zip',{'zlib':{'level':0x9}});_0x58a96d['on'](_0xa1b3('0x59'),function(_0x3da66e){if(_0x3da66e[_0xa1b3('0x5a')]==='ENOENT'){logger[_0xa1b3('0x30')](_0x3da66e);}else{throw new db[(_0xa1b3('0x5b'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x58a96d['on'](_0xa1b3('0x30'),function(_0x403133){throw new db['Sequelize'][(_0xa1b3('0x5c'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x58a96d['pipe'](_0x294996);_0x58a96d['glob'](_0xa1b3('0x5d'),{'cwd':path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),path[_0xa1b3('0x5f')](_0xe13a84[_0xa1b3('0x7')])),'ignore':[path[_0xa1b3('0x5e')](path[_0xa1b3('0x60')](_0xe13a84[_0xa1b3('0x7')]),'node_modules/**/*'),path[_0xa1b3('0x5e')](path[_0xa1b3('0x60')](_0xe13a84['path']),_0xa1b3('0x61'))],'nodir':!![]})[_0xa1b3('0x62')]();_0x294996['on'](_0xa1b3('0x63'),function(){if(!fs['existsSync'](_0x5ab71d)){throw new db[(_0xa1b3('0x5b'))]['Error'](_0xa1b3('0x64'));}return _0x53aeff[_0xa1b3('0x54')](_0x5ab71d,util['format'](_0xa1b3('0x58'),path[_0xa1b3('0x60')](_0xe13a84[_0xa1b3('0x7')])),function(_0x19113e){if(_0x19113e){throw new db[(_0xa1b3('0x5b'))][(_0xa1b3('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x5ab71d);logger[_0xa1b3('0x65')]('Download\x20completed');logger[_0xa1b3('0x65')](_0xa1b3('0x66'));});});}return null;})['catch'](handleError(_0x53aeff,null));};exports['upload']=function(_0x3025af,_0x1aa6ef,_0x20467d){var _0xfcade0=path[_0xa1b3('0x60')](_0x3025af[_0xa1b3('0x67')][_0xa1b3('0x68')],path[_0xa1b3('0x69')](_0x3025af[_0xa1b3('0x67')][_0xa1b3('0x68')]));var _0x3a3a4b=path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),_0x3025af['file'][_0xa1b3('0x68')]);var _0x10d99b=path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],'server/files/plugins',_0xfcade0);logger[_0xa1b3('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x3a3a4b);logger['info'](_0xa1b3('0x6a'),_0x10d99b);try{fs[_0xa1b3('0x6b')](_0x3a3a4b,parseInt(_0xa1b3('0x6c'),0x8));extract(_0x3a3a4b,{'dir':_0x10d99b},function(_0x624249){if(_0x624249){logger[_0xa1b3('0x30')](_0x624249);handleError(_0x624249,!![]);};var _0x3a7e3d=fs[_0xa1b3('0x6d')](_0x10d99b);if(_0x3a7e3d[_0xa1b3('0x40')]>0x1){removeReferences(_0x3a3a4b,_0x10d99b);logger[_0xa1b3('0x30')](_0xa1b3('0x6e'));return _0x20467d(new Error(_0xa1b3('0x6e')));}var _0x1d725e=fs[_0xa1b3('0x6f')](path[_0xa1b3('0x5e')](_0x10d99b,_0x3a7e3d[0x0]));if(_0x1d725e[_0xa1b3('0x70')]()){removeReferences(_0x3a3a4b,_0x10d99b);logger['error']('Invalid\x20plugin\x20structure');return _0x20467d(new Error(_0xa1b3('0x6e')));}if(_0x1d725e[_0xa1b3('0x71')]()){var _0x2925cf=fs['readdirSync'](path['join'](_0x10d99b,_0x3a7e3d[0x0]));if(_0x2925cf[_0xa1b3('0x40')]===0x0){removeReferences(_0x3a3a4b,_0x10d99b);logger[_0xa1b3('0x30')]('Invalid\x20plugin\x20structure');return _0x20467d(new Error(_0xa1b3('0x6e')));}var _0x2baee2=_0x2925cf['some'](function(_0x140cf6){return _0x140cf6===_0xa1b3('0x72');});if(!_0x2baee2){return _0x20467d(new Error(_0xa1b3('0x73')));}var _0x470565=fs[_0xa1b3('0x74')](path[_0xa1b3('0x5e')](_0x10d99b,_0x3a7e3d[0x0],_0xa1b3('0x72')));var _0x49ab3f=JSON['parse'](_0x470565);if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x31')]){return _0x20467d(new Error(_0xa1b3('0x75')));}if('undefined'==typeof _0x49ab3f[_0xa1b3('0x37')]){return _0x20467d(new Error(_0xa1b3('0x76')));}if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x77')]){return _0x20467d(new Error(_0xa1b3('0x78')));}if('undefined'==typeof _0x49ab3f['parameters']){return _0x20467d(new Error(_0xa1b3('0x79')));}if(_0x49ab3f[_0xa1b3('0x37')]==='html'){if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x7a')]['views']){return _0x20467d(new Error(_0xa1b3('0x7b')));}if(_0xa1b3('0x25')==typeof _0x49ab3f['parameters']['views'][_0xa1b3('0x7c')]&&'undefined'==typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7e')]){return _0x20467d(new Error(_0xa1b3('0x7f')));}}else if(_0x49ab3f[_0xa1b3('0x37')]===_0xa1b3('0x80')){if(_0xa1b3('0x25')==typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x81')]){return _0x20467d(new Error(_0xa1b3('0x82')));}if('undefined'==typeof _0x49ab3f['parameters'][_0xa1b3('0x83')]){return _0x20467d(new Error(_0xa1b3('0x84')));}}else{return _0x20467d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xe50c53=_0x49ab3f['name'];var _0xc31d1c=_0x49ab3f['description'];var _0x284d40=_0x49ab3f[_0xa1b3('0x37')];var _0x47185b=_0x49ab3f[_0xa1b3('0x85')]?_0x49ab3f['sidebar']:_0xa1b3('0x86');var _0xf99090=_0x49ab3f['icon']?_0x49ab3f[_0xa1b3('0x87')]:'icon-apps';var _0x3b05fd='';var _0x128a7c='';var _0x30b0b4='';var _0x2d54e1='';var _0x49fd65=_0x49ab3f['version'];if(_0x284d40===_0xa1b3('0x88')){if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7c')]){var _0x447465=_0x49ab3f['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa1b3('0x89')](_0x447465)){_0x3b05fd=path['join'](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x447465);}else{_0x3b05fd=_0x447465;}}else{logger[_0xa1b3('0x65')](_0xa1b3('0x8b'));}if('undefined'!=typeof _0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent']){var _0x4f0227=_0x49ab3f['parameters']['views'][_0xa1b3('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xa1b3('0x89')](_0x4f0227)){_0x128a7c=path[_0xa1b3('0x5e')](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x4f0227);}else{_0x128a7c=_0x4f0227;}}else{logger[_0xa1b3('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x284d40===_0xa1b3('0x80')){_0x30b0b4=_0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x81')];_0x2d54e1=_0x49ab3f['parameters']['scriptPath'];if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')]){if(_0xa1b3('0x25')!=typeof _0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')]['admin']){var _0x447465=_0x49ab3f[_0xa1b3('0x7a')][_0xa1b3('0x7d')][_0xa1b3('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x447465)){_0x3b05fd=path[_0xa1b3('0x5e')](_0xa1b3('0x8a'),_0xfcade0,_0x3a7e3d[0x0],_0x447465);}else{_0x3b05fd=_0x447465;}}if('undefined'!=typeof _0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent']){var _0x4f0227=_0x49ab3f['parameters'][_0xa1b3('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4f0227)){_0x128a7c=path[_0xa1b3('0x5e')]('plugins',_0xfcade0,_0x3a7e3d[0x0],_0x4f0227);}else{_0x128a7c=_0x4f0227;}}}}var _0x12e99d={'name':_0xe50c53,'description':_0xc31d1c,'path':path[_0xa1b3('0x5e')](_0xfcade0,_0x3a7e3d[0x0]),'type':_0x284d40,'sidebar':_0x47185b,'icon':_0xf99090,'adminUrl':_0x3b05fd,'agentUrl':_0x128a7c,'scriptName':_0x30b0b4,'scriptPath':_0x2d54e1,'version':_0x49fd65};removeReferences(_0x3a3a4b,null);return db[_0xa1b3('0x35')][_0xa1b3('0x8c')](_0x12e99d)[_0xa1b3('0x2d')](function(_0x5b8cdb){var _0x435e67={'role':_0x3025af[_0xa1b3('0x8d')][_0xa1b3('0x8e')],'userProfileId':_0x3025af['body'][_0xa1b3('0x8f')]};if(!_0x435e67)throw new Error(_0xa1b3('0x90'));if(_0x435e67[_0xa1b3('0x8e')]===_0xa1b3('0x91')){var _0x1d864b=_0x5b8cdb[_0xa1b3('0x92')]({'plain':!![]});return db[_0xa1b3('0x93')]['find']({'where':{'name':_0xa1b3('0x94'),'userProfileId':_0x435e67['userProfileId']},'raw':!![]})[_0xa1b3('0x2d')](function(_0x4ea703){if(_0x4ea703&&_0x4ea703[_0xa1b3('0x95')]===0x0){return db[_0xa1b3('0x2f')][_0xa1b3('0x8c')]({'name':_0x1d864b['name'],'resourceId':_0x1d864b['id'],'type':_0x4ea703[_0xa1b3('0x31')],'sectionId':_0x4ea703['id']},{})['then'](function(){return _0x5b8cdb;});}else{return _0x5b8cdb;}})[_0xa1b3('0x4f')](function(_0x1bda43){logger[_0xa1b3('0x30')](_0xa1b3('0x96'),_0x1bda43);throw _0x1bda43;});}return _0x5b8cdb;})[_0xa1b3('0x2d')](respondWithResult(_0x1aa6ef,null))[_0xa1b3('0x4f')](handleError(_0x1aa6ef,null));}});}catch(_0x18d983){_0x1aa6ef[_0xa1b3('0x23')](0x1f4)['send'](_0x18d983);}};function removeReferences(_0x2c0c46,_0x43bbe9){try{if(_0x2c0c46){fs['unlinkSync'](_0x2c0c46);logger[_0xa1b3('0x65')](_0xa1b3('0x97'));}if(_0x43bbe9){rimraf(_0x43bbe9,function(){});logger['info'](_0xa1b3('0x98'));}}catch(_0x1bf55e){logger[_0xa1b3('0x30')](_0x1bf55e);}}exports['update']=function(_0x4fd475,_0x378da8,_0x3d2cd5){return db['Plugin'][_0xa1b3('0x53')]({'where':{'id':_0x4fd475['params']['id']}})[_0xa1b3('0x2d')](handleEntityNotFound(_0x378da8,null))[_0xa1b3('0x2d')](saveUpdates(_0x4fd475['body'],null))[_0xa1b3('0x2d')](respondWithResult(_0x378da8,null))['catch'](handleError(_0x378da8,null));};exports[_0xa1b3('0x99')]=function(_0xbd950f,_0x1a3679,_0x48ab2a){return db['Plugin'][_0xa1b3('0x53')]({'where':{'id':_0xbd950f[_0xa1b3('0x51')]['id']}})[_0xa1b3('0x2d')](function(_0x422ee4){if(_0x422ee4){return _0x422ee4['destroy']();}})[_0xa1b3('0x2d')](function(_0x439bb1){rimraf(path[_0xa1b3('0x5e')](config[_0xa1b3('0x55')],_0xa1b3('0x56'),path[_0xa1b3('0x5f')](_0x439bb1[_0xa1b3('0x7')])),function(){});return _0x439bb1;})[_0xa1b3('0x2d')](handleEntityNotFound(_0x1a3679,null))[_0xa1b3('0x2d')](respondWithStatusCode(_0x1a3679,null))[_0xa1b3('0x4f')](handleError(_0x1a3679,null));};exports[_0xa1b3('0x9a')]=function(_0x49fb34,_0x2433d2,_0x172750){return BPromise['resolve']()[_0xa1b3('0x2d')](function(){if(!_0x49fb34['query'][_0xa1b3('0x7')]){throw new Error(_0xa1b3('0x9b'));}if(!_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')]){throw new Error(_0xa1b3('0x9d'));}var _0x456a33=_0x49fb34[_0xa1b3('0x3a')]['hostname']?_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9e')]+':'+_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')]:_0xa1b3('0x9f')+_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x9c')];var _0x253dbe=_0x49fb34['query'][_0xa1b3('0xa0')]?_0x49fb34['query']['json']:!![];var _0x369f4a=_0x49fb34['query'][_0xa1b3('0xa1')]?_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0xa1')]:null;var _0x17e725={'method':_0x49fb34['method'],'uri':util[_0xa1b3('0x57')](_0xa1b3('0xa2'),_0x456a33,_0x49fb34['query'][_0xa1b3('0x7')]),'json':_0x253dbe,'resolveWithFullResponse':!![],'encoding':_0x369f4a,'qs':_0x49fb34[_0xa1b3('0x3a')]};if(_0x49fb34[_0xa1b3('0xa3')]){_0x17e725['headers']=_0x49fb34[_0xa1b3('0xa3')];if(_0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa4')]){delete _0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa4')];}}if(_0x17e725['headers'][_0xa1b3('0xa5')]){delete _0x17e725[_0xa1b3('0xa3')][_0xa1b3('0xa5')];}return rp(_0x17e725);})['then'](function(_0x3e0454){if(_0x3e0454){_0x2433d2[_0xa1b3('0x28')](_0x3e0454[_0xa1b3('0xa3')]);logger['info'](_0x3e0454['body']);if(_['endsWith'](_0x49fb34[_0xa1b3('0x3a')][_0xa1b3('0x7')],_0xa1b3('0x54'))&&_0x3e0454['statusCode']==0x1f4){return _0x2433d2[_0xa1b3('0x21')](_0x3e0454[_0xa1b3('0xa6')]);}else{return _0x2433d2[_0xa1b3('0x23')](_0x3e0454[_0xa1b3('0xa6')])[_0xa1b3('0x32')](_0x3e0454['body']);}}else{return _0x2433d2[_0xa1b3('0x21')](0xc8);}})[_0xa1b3('0x4f')](handleError(_0x2433d2,null));};exports[_0xa1b3('0xa7')]=function(_0x1de526,_0x1b448b,_0x38da4a){return BPromise[_0xa1b3('0xa8')]()['then'](function(){if(!_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x7')]){throw new Error(_0xa1b3('0x9b'));}if(!_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x9c')]){throw new Error(_0xa1b3('0x9d'));}var _0x1d5900=_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x9e')]?_0x1de526['query'][_0xa1b3('0x9e')]+':'+_0x1de526[_0xa1b3('0x3a')]['port']:'http://localhost:'+_0x1de526['query']['port'];var _0x4cff3b=_0x1de526['query'][_0xa1b3('0xa0')]?_0x1de526['query'][_0xa1b3('0xa0')]:!![];var _0x179f05=_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0xa1')]?_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0xa1')]:null;var _0x5229d7={'method':_0x1de526[_0xa1b3('0xa9')],'uri':util['format']('%s%s',_0x1d5900,_0x1de526[_0xa1b3('0x3a')][_0xa1b3('0x7')]),'json':_0x4cff3b,'resolveWithFullResponse':!![],'encoding':_0x179f05,'body':_0x1de526['body']};if(_0x1de526[_0xa1b3('0xa3')]){_0x5229d7['headers']=_0x1de526[_0xa1b3('0xa3')];if(_0x5229d7[_0xa1b3('0xa3')]['content-length']){delete _0x5229d7[_0xa1b3('0xa3')][_0xa1b3('0xa4')];}}if(_0x5229d7[_0xa1b3('0xa3')][_0xa1b3('0xa5')]){delete _0x5229d7['headers'][_0xa1b3('0xa5')];}return rp(_0x5229d7);})[_0xa1b3('0x2d')](function(_0x31cf2a){if(_0x31cf2a){_0x1b448b[_0xa1b3('0x28')](_0x31cf2a[_0xa1b3('0xa3')]);logger[_0xa1b3('0x65')](_0x31cf2a[_0xa1b3('0x8d')]);return _0x1b448b[_0xa1b3('0x23')](_0x31cf2a['statusCode'])[_0xa1b3('0x32')](_0x31cf2a['body']);}else{return _0x1b448b[_0xa1b3('0x21')](0xc8);}})[_0xa1b3('0x4f')](handleError(_0x1b448b,null));}; \ No newline at end of file +var _0x800a=['\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','get','Plugins','destroy','then','error','stack','name','send','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','rawAttributes','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve'];(function(_0x159968,_0x5adc0c){var _0x49556c=function(_0x26eadb){while(--_0x26eadb){_0x159968['push'](_0x159968['shift']());}};_0x49556c(++_0x5adc0c);}(_0x800a,0xbe));var _0xa800=function(_0x2486e8,_0x375b21){_0x2486e8=_0x2486e8-0x0;var _0xde5cd4=_0x800a[_0x2486e8];return _0xde5cd4;};'use strict';var emlformat=require(_0xa800('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa800('0x1'));var jsonpatch=require(_0xa800('0x2'));var rp=require(_0xa800('0x3'));var moment=require(_0xa800('0x4'));var BPromise=require(_0xa800('0x5'));var Mustache=require(_0xa800('0x6'));var util=require(_0xa800('0x7'));var path=require(_0xa800('0x8'));var sox=require(_0xa800('0x9'));var csv=require(_0xa800('0xa'));var ejs=require(_0xa800('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa800('0xc'));var squel=require(_0xa800('0xd'));var crypto=require(_0xa800('0xe'));var jsforce=require(_0xa800('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa800('0xa'));var querystring=require(_0xa800('0x10'));var Papa=require(_0xa800('0x11'));var extract=require('extract-zip');var rimraf=require(_0xa800('0x12'));var archiver=require(_0xa800('0x13'));var Redis=require(_0xa800('0x14'));var authService=require(_0xa800('0x15'));var qs=require(_0xa800('0x16'));var as=require(_0xa800('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa800('0x18'));var utils=require(_0xa800('0x19'));var config=require(_0xa800('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa800('0x1b'))['db'];config[_0xa800('0x1c')]=_['defaults'](config[_0xa800('0x1c')],{'host':_0xa800('0x1d'),'port':0x18eb});var socket=require(_0xa800('0x1e'))(new Redis(config['redis']));require(_0xa800('0x1f'))['register'](socket);function respondWithStatusCode(_0x3e7848,_0x4594ad){_0x4594ad=_0x4594ad||0xcc;return function(_0x571a7c){if(_0x571a7c){return _0x3e7848[_0xa800('0x20')](_0x4594ad);}return _0x3e7848[_0xa800('0x21')](_0x4594ad)[_0xa800('0x22')]();};}function respondWithResult(_0xfbb292,_0x51827a){_0x51827a=_0x51827a||0xc8;return function(_0x1f3a89){if(_0x1f3a89){return _0xfbb292['status'](_0x51827a)[_0xa800('0x23')](_0x1f3a89);}};}function respondWithFilteredResult(_0x5d3de5,_0x45f3cf){return function(_0x353bc1){if(_0x353bc1){var _0x27672e=typeof _0x45f3cf['offset']===_0xa800('0x24')&&typeof _0x45f3cf[_0xa800('0x25')]==='undefined';var _0x279995=_0x353bc1[_0xa800('0x26')];var _0x5d2466=_0x27672e?0x0:_0x45f3cf[_0xa800('0x27')];var _0x3f9771=_0x27672e?_0x353bc1['count']:_0x45f3cf[_0xa800('0x27')]+_0x45f3cf['limit'];var _0x269914;if(_0x3f9771>=_0x279995){_0x3f9771=_0x279995;_0x269914=0xc8;}else{_0x269914=0xce;}_0x5d3de5[_0xa800('0x21')](_0x269914);return _0x5d3de5[_0xa800('0x28')](_0xa800('0x29'),_0x5d2466+'-'+_0x3f9771+'/'+_0x279995)[_0xa800('0x23')](_0x353bc1);}return null;};}function patchUpdates(_0x5924dc){return function(_0x5b90ad){try{jsonpatch[_0xa800('0x2a')](_0x5b90ad,_0x5924dc,!![]);}catch(_0xb2f004){return BPromise[_0xa800('0x2b')](_0xb2f004);}return _0x5b90ad['save']();};}function saveUpdates(_0x5b5dee,_0x5e125d){return function(_0x54dd2c){if(_0x54dd2c){return _0x54dd2c['update'](_0x5b5dee)['then'](function(_0x4fd8ca){return _0x4fd8ca;});}return null;};}function removeEntity(_0x28671a,_0x5ac010){return function(_0x12c0c5){if(_0x12c0c5){return _0x12c0c5['destroy']()['then'](function(){var _0x332916=_0x12c0c5[_0xa800('0x2c')]({'plain':!![]});var _0x3e186f=_0xa800('0x2d');return db['UserProfileResource'][_0xa800('0x2e')]({'where':{'type':_0x3e186f,'resourceId':_0x332916['id']}})[_0xa800('0x2f')](function(){return _0x12c0c5;});})[_0xa800('0x2f')](function(){_0x28671a[_0xa800('0x21')](0xcc)[_0xa800('0x22')]();});}};}function handleEntityNotFound(_0x1b51e9,_0x4cddf7){return function(_0x34f560){if(!_0x34f560){_0x1b51e9[_0xa800('0x20')](0x194);}return _0x34f560;};}function handleError(_0x4fe632,_0x43f05b){_0x43f05b=_0x43f05b||0x1f4;return function(_0xb75e2){logger[_0xa800('0x30')](_0xb75e2[_0xa800('0x31')]);if(_0xb75e2[_0xa800('0x32')]){delete _0xb75e2[_0xa800('0x32')];}_0x4fe632[_0xa800('0x21')](_0x43f05b)[_0xa800('0x33')](_0xb75e2);};}exports['index']=function(_0x2d5ab5,_0x467a01){var _0x54d88f={},_0x559e0c={},_0x1de856={'count':0x0,'rows':[]};var _0x4267c2=_[_0xa800('0x34')](db[_0xa800('0x35')]['rawAttributes'],function(_0x12a196){return{'name':_0x12a196[_0xa800('0x36')],'type':_0x12a196[_0xa800('0x37')][_0xa800('0x38')]};});_0x559e0c[_0xa800('0x39')]=_[_0xa800('0x34')](_0x4267c2,_0xa800('0x32'));_0x559e0c[_0xa800('0x3a')]=_[_0xa800('0x3b')](_0x2d5ab5[_0xa800('0x3a')]);_0x559e0c[_0xa800('0x3c')]=_[_0xa800('0x3d')](_0x559e0c[_0xa800('0x39')],_0x559e0c[_0xa800('0x3a')]);_0x54d88f['attributes']=_['intersection'](_0x559e0c[_0xa800('0x39')],qs[_0xa800('0x3e')](_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x3e')]));_0x54d88f['attributes']=_0x54d88f[_0xa800('0x3f')][_0xa800('0x40')]?_0x54d88f[_0xa800('0x3f')]:_0x559e0c['model'];if(!_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x41')](_0xa800('0x42'))){_0x54d88f[_0xa800('0x25')]=qs[_0xa800('0x25')](_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x25')]);_0x54d88f['offset']=qs[_0xa800('0x27')](_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x27')]);}_0x54d88f['order']=qs[_0xa800('0x43')](_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x43')]);_0x54d88f[_0xa800('0x44')]=qs[_0xa800('0x3c')](_[_0xa800('0x45')](_0x2d5ab5[_0xa800('0x3a')],_0x559e0c[_0xa800('0x3c')]),_0x4267c2);if(_0x2d5ab5['query']['filter']){_0x54d88f[_0xa800('0x44')]=_[_0xa800('0x46')](_0x54d88f[_0xa800('0x44')],{'$or':_['map'](_0x4267c2,function(_0x3679a1){if(_0x3679a1[_0xa800('0x37')]!=='VIRTUAL'){var _0x5392d1={};_0x5392d1[_0x3679a1[_0xa800('0x32')]]={'$like':'%'+_0x2d5ab5[_0xa800('0x3a')][_0xa800('0x47')]+'%'};return _0x5392d1;}})});}_0x54d88f=_['merge']({},_0x54d88f,_0x2d5ab5[_0xa800('0x48')]);var _0x2f3f33={'where':_0x54d88f[_0xa800('0x44')]};return db[_0xa800('0x35')]['count'](_0x2f3f33)[_0xa800('0x2f')](function(_0x1bae5a){_0x1de856['count']=_0x1bae5a;if(_0x2d5ab5['query'][_0xa800('0x49')]){_0x54d88f[_0xa800('0x4a')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x54d88f);})[_0xa800('0x2f')](function(_0x1ef410){_0x1de856[_0xa800('0x4b')]=_0x1ef410;return _0x1de856;})[_0xa800('0x2f')](respondWithFilteredResult(_0x467a01,_0x54d88f))['catch'](handleError(_0x467a01,null));};exports[_0xa800('0x4c')]=function(_0x5b8524,_0x5b1efc){var _0x15a636={'raw':!![],'where':{'id':_0x5b8524[_0xa800('0x4d')]['id']}},_0x3f4d90={};_0x3f4d90['model']=_[_0xa800('0x3b')](db[_0xa800('0x35')][_0xa800('0x4e')]);_0x3f4d90['query']=_[_0xa800('0x3b')](_0x5b8524[_0xa800('0x3a')]);_0x3f4d90[_0xa800('0x3c')]=_[_0xa800('0x3d')](_0x3f4d90[_0xa800('0x39')],_0x3f4d90[_0xa800('0x3a')]);_0x15a636['attributes']=_[_0xa800('0x3d')](_0x3f4d90['model'],qs[_0xa800('0x3e')](_0x5b8524[_0xa800('0x3a')][_0xa800('0x3e')]));_0x15a636[_0xa800('0x3f')]=_0x15a636[_0xa800('0x3f')]['length']?_0x15a636[_0xa800('0x3f')]:_0x3f4d90['model'];if(_0x5b8524[_0xa800('0x3a')][_0xa800('0x49')]){_0x15a636[_0xa800('0x4a')]=[{'all':!![]}];}_0x15a636=_[_0xa800('0x46')]({},_0x15a636,_0x5b8524['options']);return db[_0xa800('0x35')]['find'](_0x15a636)[_0xa800('0x2f')](handleEntityNotFound(_0x5b1efc,null))[_0xa800('0x2f')](respondWithResult(_0x5b1efc,null))['catch'](handleError(_0x5b1efc,null));};exports['download']=function(_0x420a71,_0x30719f,_0x40ccef){return db[_0xa800('0x35')][_0xa800('0x4f')]({'where':{'id':_0x420a71[_0xa800('0x4d')]['id']},'attributes':['name',_0xa800('0x8')],'raw':!![]})[_0xa800('0x2f')](handleEntityNotFound(_0x30719f,null))[_0xa800('0x2f')](function(_0x36fa61){if(_0x36fa61){var _0xbd958c=path[_0xa800('0x50')](config[_0xa800('0x51')],_0xa800('0x52'),util[_0xa800('0x53')](_0xa800('0x54'),path[_0xa800('0x55')](_0x36fa61[_0xa800('0x8')])));var _0x5f4f07=fs[_0xa800('0x56')](_0xbd958c);var _0x3a2adb=archiver(_0xa800('0x57'),{'zlib':{'level':0x9}});_0x3a2adb['on'](_0xa800('0x58'),function(_0x151596){if(_0x151596[_0xa800('0x59')]===_0xa800('0x5a')){logger[_0xa800('0x30')](_0x151596);}else{throw new db['Sequelize'][(_0xa800('0x5b'))](_0xa800('0x5c'));}});_0x3a2adb['on'](_0xa800('0x30'),function(_0x18a05e){throw new db[(_0xa800('0x5d'))][(_0xa800('0x5b'))](_0xa800('0x5c'));});_0x3a2adb[_0xa800('0x5e')](_0x5f4f07);_0x3a2adb[_0xa800('0x5f')](_0xa800('0x60'),{'cwd':path['join'](config[_0xa800('0x51')],'server/files/plugins',path[_0xa800('0x61')](_0x36fa61['path'])),'ignore':[path[_0xa800('0x50')](path['basename'](_0x36fa61[_0xa800('0x8')]),_0xa800('0x62')),path[_0xa800('0x50')](path[_0xa800('0x55')](_0x36fa61[_0xa800('0x8')]),_0xa800('0x63'))],'nodir':!![]})[_0xa800('0x64')]();_0x5f4f07['on'](_0xa800('0x65'),function(){if(!fs['existsSync'](_0xbd958c)){throw new db[(_0xa800('0x5d'))]['Error'](_0xa800('0x66'));}return _0x30719f[_0xa800('0x67')](_0xbd958c,util[_0xa800('0x53')](_0xa800('0x54'),path[_0xa800('0x55')](_0x36fa61[_0xa800('0x8')])),function(_0x1678f4){if(_0x1678f4){throw new db[(_0xa800('0x5d'))][(_0xa800('0x5b'))](_0xa800('0x68'));}fs[_0xa800('0x69')](_0xbd958c);logger[_0xa800('0x6a')](_0xa800('0x6b'));logger[_0xa800('0x6a')](_0xa800('0x6c'));});});}return null;})[_0xa800('0x6d')](handleError(_0x30719f,null));};exports['upload']=function(_0x150f86,_0x29262b,_0x145eb3){var _0x348a86=path[_0xa800('0x55')](_0x150f86[_0xa800('0x6e')][_0xa800('0x6f')],path[_0xa800('0x70')](_0x150f86[_0xa800('0x6e')][_0xa800('0x6f')]));var _0x433f94=path[_0xa800('0x50')](config[_0xa800('0x51')],_0xa800('0x52'),_0x150f86[_0xa800('0x6e')][_0xa800('0x6f')]);var _0x14a618=path[_0xa800('0x50')](config[_0xa800('0x51')],_0xa800('0x52'),_0x348a86);logger[_0xa800('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x433f94);logger[_0xa800('0x6a')](_0xa800('0x71'),_0x14a618);try{fs[_0xa800('0x72')](_0x433f94,parseInt(_0xa800('0x73'),0x8));extract(_0x433f94,{'dir':_0x14a618},function(_0x94e2c7){if(_0x94e2c7){logger[_0xa800('0x30')](_0x94e2c7);handleError(_0x94e2c7,!![]);};var _0x4c0c63=fs['readdirSync'](_0x14a618);if(_0x4c0c63[_0xa800('0x40')]>0x1){removeReferences(_0x433f94,_0x14a618);logger['error'](_0xa800('0x74'));return _0x145eb3(new Error('Invalid\x20plugin\x20structure'));}var _0x1b2e15=fs['lstatSync'](path[_0xa800('0x50')](_0x14a618,_0x4c0c63[0x0]));if(_0x1b2e15[_0xa800('0x75')]()){removeReferences(_0x433f94,_0x14a618);logger[_0xa800('0x30')](_0xa800('0x74'));return _0x145eb3(new Error('Invalid\x20plugin\x20structure'));}if(_0x1b2e15[_0xa800('0x76')]()){var _0x371d5d=fs[_0xa800('0x77')](path[_0xa800('0x50')](_0x14a618,_0x4c0c63[0x0]));if(_0x371d5d[_0xa800('0x40')]===0x0){removeReferences(_0x433f94,_0x14a618);logger[_0xa800('0x30')](_0xa800('0x74'));return _0x145eb3(new Error(_0xa800('0x74')));}var _0x3d5eff=_0x371d5d[_0xa800('0x78')](function(_0x436be9){return _0x436be9===_0xa800('0x79');});if(!_0x3d5eff){return _0x145eb3(new Error(_0xa800('0x7a')));}var _0x48523e=fs[_0xa800('0x7b')](path[_0xa800('0x50')](_0x14a618,_0x4c0c63[0x0],'manifest.json'));var _0x267465=JSON['parse'](_0x48523e);if(_0xa800('0x24')==typeof _0x267465['name']){return _0x145eb3(new Error(_0xa800('0x7c')));}if(_0xa800('0x24')==typeof _0x267465['type']){return _0x145eb3(new Error(_0xa800('0x7d')));}if('undefined'==typeof _0x267465[_0xa800('0x7e')]){return _0x145eb3(new Error(_0xa800('0x7f')));}if(_0xa800('0x24')==typeof _0x267465[_0xa800('0x80')]){return _0x145eb3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x267465[_0xa800('0x37')]===_0xa800('0x81')){if('undefined'==typeof _0x267465['parameters'][_0xa800('0x82')]){return _0x145eb3(new Error(_0xa800('0x83')));}if('undefined'==typeof _0x267465[_0xa800('0x80')][_0xa800('0x82')]['admin']&&'undefined'==typeof _0x267465[_0xa800('0x80')]['views'][_0xa800('0x84')]){return _0x145eb3(new Error(_0xa800('0x85')));}}else if(_0x267465[_0xa800('0x37')]===_0xa800('0x86')){if(_0xa800('0x24')==typeof _0x267465[_0xa800('0x80')][_0xa800('0x87')]){return _0x145eb3(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x267465[_0xa800('0x80')][_0xa800('0x88')]){return _0x145eb3(new Error(_0xa800('0x89')));}}else{return _0x145eb3(new Error(_0xa800('0x8a')));}var _0x200061=_0x267465[_0xa800('0x32')];var _0x180e85=_0x267465[_0xa800('0x8b')];var _0x5e5444=_0x267465[_0xa800('0x37')];var _0x54a693=_0x267465[_0xa800('0x8c')]?_0x267465[_0xa800('0x8c')]:_0xa800('0x8d');var _0x4c88d6=_0x267465['icon']?_0x267465[_0xa800('0x8e')]:'icon-apps';var _0x55af73='';var _0x538184='';var _0x11f64e='';var _0x5d6d25='';var _0x26c128=_0x267465[_0xa800('0x7e')];if(_0x5e5444===_0xa800('0x81')){if(_0xa800('0x24')!=typeof _0x267465[_0xa800('0x80')]['views'][_0xa800('0x8f')]){var _0x20764e=_0x267465[_0xa800('0x80')][_0xa800('0x82')][_0xa800('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xa800('0x90')](_0x20764e)){_0x55af73=path[_0xa800('0x50')](_0xa800('0x91'),_0x348a86,_0x4c0c63[0x0],_0x20764e);}else{_0x55af73=_0x20764e;}}else{logger[_0xa800('0x6a')](_0xa800('0x92'));}if(_0xa800('0x24')!=typeof _0x267465[_0xa800('0x80')]['views'][_0xa800('0x84')]){var _0x3fb268=_0x267465[_0xa800('0x80')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3fb268)){_0x538184=path[_0xa800('0x50')](_0xa800('0x91'),_0x348a86,_0x4c0c63[0x0],_0x3fb268);}else{_0x538184=_0x3fb268;}}else{logger[_0xa800('0x6a')](_0xa800('0x93'));}}else if(_0x5e5444===_0xa800('0x86')){_0x11f64e=_0x267465[_0xa800('0x80')][_0xa800('0x87')];_0x5d6d25=_0x267465[_0xa800('0x80')]['scriptPath'];if(_0xa800('0x24')!=typeof _0x267465[_0xa800('0x80')]['views']){if(_0xa800('0x24')!=typeof _0x267465[_0xa800('0x80')][_0xa800('0x82')][_0xa800('0x8f')]){var _0x20764e=_0x267465[_0xa800('0x80')]['views'][_0xa800('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x20764e)){_0x55af73=path[_0xa800('0x50')](_0xa800('0x91'),_0x348a86,_0x4c0c63[0x0],_0x20764e);}else{_0x55af73=_0x20764e;}}if('undefined'!=typeof _0x267465[_0xa800('0x80')]['views'][_0xa800('0x84')]){var _0x3fb268=_0x267465[_0xa800('0x80')]['views'][_0xa800('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xa800('0x90')](_0x3fb268)){_0x538184=path['join'](_0xa800('0x91'),_0x348a86,_0x4c0c63[0x0],_0x3fb268);}else{_0x538184=_0x3fb268;}}}}var _0x1d8a7a={'name':_0x200061,'description':_0x180e85,'path':path[_0xa800('0x50')](_0x348a86,_0x4c0c63[0x0]),'type':_0x5e5444,'sidebar':_0x54a693,'icon':_0x4c88d6,'adminUrl':_0x55af73,'agentUrl':_0x538184,'scriptName':_0x11f64e,'scriptPath':_0x5d6d25,'version':_0x26c128};removeReferences(_0x433f94,null);return db[_0xa800('0x35')][_0xa800('0x94')](_0x1d8a7a)[_0xa800('0x2f')](function(_0x31ddb3){var _0x7e3764={'role':_0x150f86[_0xa800('0x95')][_0xa800('0x96')],'userProfileId':_0x150f86[_0xa800('0x95')][_0xa800('0x97')]};if(!_0x7e3764)throw new Error(_0xa800('0x98'));if(_0x7e3764[_0xa800('0x96')]===_0xa800('0x99')){var _0xbfec19=_0x31ddb3[_0xa800('0x2c')]({'plain':!![]});return db[_0xa800('0x9a')][_0xa800('0x4f')]({'where':{'name':_0xa800('0x2d'),'userProfileId':_0x7e3764['userProfileId']},'raw':!![]})[_0xa800('0x2f')](function(_0x3b8514){if(_0x3b8514&&_0x3b8514[_0xa800('0x9b')]===0x0){return db[_0xa800('0x9c')][_0xa800('0x94')]({'name':_0xbfec19['name'],'resourceId':_0xbfec19['id'],'type':_0x3b8514[_0xa800('0x32')],'sectionId':_0x3b8514['id']},{})[_0xa800('0x2f')](function(){return _0x31ddb3;});}else{return _0x31ddb3;}})[_0xa800('0x6d')](function(_0x6b2514){logger[_0xa800('0x30')](_0xa800('0x9d'),_0x6b2514);throw _0x6b2514;});}return _0x31ddb3;})['then'](respondWithResult(_0x29262b,null))['catch'](handleError(_0x29262b,null));}});}catch(_0x4c2257){_0x29262b['status'](0x1f4)[_0xa800('0x33')](_0x4c2257);}};function removeReferences(_0x3bb043,_0x232cda){try{if(_0x3bb043){fs[_0xa800('0x69')](_0x3bb043);logger['info'](_0xa800('0x9e'));}if(_0x232cda){rimraf(_0x232cda,function(){});logger[_0xa800('0x6a')](_0xa800('0x9f'));}}catch(_0x26bb07){logger[_0xa800('0x30')](_0x26bb07);}}exports[_0xa800('0xa0')]=function(_0x406dd3,_0x12ea16,_0x4016e5){return db[_0xa800('0x35')][_0xa800('0x4f')]({'where':{'id':_0x406dd3[_0xa800('0x4d')]['id']}})[_0xa800('0x2f')](handleEntityNotFound(_0x12ea16,null))[_0xa800('0x2f')](saveUpdates(_0x406dd3['body'],null))['then'](respondWithResult(_0x12ea16,null))['catch'](handleError(_0x12ea16,null));};exports[_0xa800('0xa1')]=function(_0x303472,_0x107bb2,_0x1937d8){return db['Plugin'][_0xa800('0x4f')]({'where':{'id':_0x303472['params']['id']}})['then'](function(_0x1f2bd9){if(_0x1f2bd9){return _0x1f2bd9[_0xa800('0x2e')]();}})[_0xa800('0x2f')](function(_0x17a0cb){rimraf(path['join'](config['root'],_0xa800('0x52'),path[_0xa800('0x61')](_0x17a0cb['path'])),function(){});return _0x17a0cb;})[_0xa800('0x2f')](handleEntityNotFound(_0x107bb2,null))['then'](respondWithStatusCode(_0x107bb2,null))[_0xa800('0x6d')](handleError(_0x107bb2,null));};exports[_0xa800('0xa2')]=function(_0x25fb49,_0x2455fe,_0x23b300){return BPromise[_0xa800('0xa3')]()[_0xa800('0x2f')](function(){if(!_0x25fb49[_0xa800('0x3a')]['path']){throw new Error(_0xa800('0xa4'));}if(!_0x25fb49[_0xa800('0x3a')][_0xa800('0xa5')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xd95de0=_0x25fb49[_0xa800('0x3a')]['hostname']?_0x25fb49[_0xa800('0x3a')][_0xa800('0xa6')]+':'+_0x25fb49[_0xa800('0x3a')][_0xa800('0xa5')]:_0xa800('0xa7')+_0x25fb49[_0xa800('0x3a')][_0xa800('0xa5')];var _0x91d94d=_0x25fb49[_0xa800('0x3a')][_0xa800('0x23')]?_0x25fb49[_0xa800('0x3a')][_0xa800('0x23')]:!![];var _0x387b25=_0x25fb49[_0xa800('0x3a')][_0xa800('0xa8')]?_0x25fb49[_0xa800('0x3a')][_0xa800('0xa8')]:null;var _0x21fee4={'method':_0x25fb49[_0xa800('0xa9')],'uri':util[_0xa800('0x53')]('%s%s',_0xd95de0,_0x25fb49['query']['path']),'json':_0x91d94d,'resolveWithFullResponse':!![],'encoding':_0x387b25,'qs':_0x25fb49['query']};if(_0x25fb49['headers']){_0x21fee4[_0xa800('0xaa')]=_0x25fb49[_0xa800('0xaa')];if(_0x21fee4[_0xa800('0xaa')][_0xa800('0xab')]){delete _0x21fee4['headers']['content-length'];}}if(_0x21fee4[_0xa800('0xaa')][_0xa800('0xac')]){delete _0x21fee4[_0xa800('0xaa')][_0xa800('0xac')];}return rp(_0x21fee4);})[_0xa800('0x2f')](function(_0x23cb31){if(_0x23cb31){_0x2455fe[_0xa800('0x28')](_0x23cb31[_0xa800('0xaa')]);logger[_0xa800('0x6a')](_0x23cb31[_0xa800('0x95')]);if(_[_0xa800('0xad')](_0x25fb49['query'][_0xa800('0x8')],_0xa800('0x67'))&&_0x23cb31[_0xa800('0xae')]==0x1f4){return _0x2455fe[_0xa800('0x20')](_0x23cb31[_0xa800('0xae')]);}else{return _0x2455fe[_0xa800('0x21')](_0x23cb31[_0xa800('0xae')])[_0xa800('0x33')](_0x23cb31[_0xa800('0x95')]);}}else{return _0x2455fe['sendStatus'](0xc8);}})[_0xa800('0x6d')](handleError(_0x2455fe,null));};exports[_0xa800('0xaf')]=function(_0xbc659b,_0xeb6e42,_0x81bde2){return BPromise[_0xa800('0xa3')]()[_0xa800('0x2f')](function(){if(!_0xbc659b[_0xa800('0x3a')][_0xa800('0x8')]){throw new Error(_0xa800('0xa4'));}if(!_0xbc659b[_0xa800('0x3a')][_0xa800('0xa5')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x35e84f=_0xbc659b[_0xa800('0x3a')][_0xa800('0xa6')]?_0xbc659b['query'][_0xa800('0xa6')]+':'+_0xbc659b[_0xa800('0x3a')][_0xa800('0xa5')]:_0xa800('0xa7')+_0xbc659b['query'][_0xa800('0xa5')];var _0x300880=_0xbc659b['query']['json']?_0xbc659b['query']['json']:!![];var _0x3e2146=_0xbc659b[_0xa800('0x3a')][_0xa800('0xa8')]?_0xbc659b[_0xa800('0x3a')][_0xa800('0xa8')]:null;var _0x340035={'method':_0xbc659b[_0xa800('0xa9')],'uri':util[_0xa800('0x53')](_0xa800('0xb0'),_0x35e84f,_0xbc659b[_0xa800('0x3a')][_0xa800('0x8')]),'json':_0x300880,'resolveWithFullResponse':!![],'encoding':_0x3e2146,'body':_0xbc659b[_0xa800('0x95')]};if(_0xbc659b['headers']){_0x340035[_0xa800('0xaa')]=_0xbc659b['headers'];if(_0x340035[_0xa800('0xaa')]['content-length']){delete _0x340035[_0xa800('0xaa')][_0xa800('0xab')];}}if(_0x340035[_0xa800('0xaa')]['content-type']){delete _0x340035['headers'][_0xa800('0xac')];}return rp(_0x340035);})['then'](function(_0x508b64){if(_0x508b64){_0xeb6e42['set'](_0x508b64[_0xa800('0xaa')]);logger[_0xa800('0x6a')](_0x508b64[_0xa800('0x95')]);return _0xeb6e42[_0xa800('0x21')](_0x508b64[_0xa800('0xae')])[_0xa800('0x33')](_0x508b64[_0xa800('0x95')]);}else{return _0xeb6e42['sendStatus'](0xc8);}})[_0xa800('0x6d')](handleError(_0xeb6e42,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a52a5ab..6c1edea 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 _0x8819=['remove','emit','hasOwnProperty','exports','Plugin','setMaxListeners','save','update'];(function(_0x229a03,_0x36fefc){var _0x2d6e11=function(_0x592d00){while(--_0x592d00){_0x229a03['push'](_0x229a03['shift']());}};_0x2d6e11(++_0x36fefc);}(_0x8819,0x94));var _0x9881=function(_0x3e3e03,_0x1107cc){_0x3e3e03=_0x3e3e03-0x0;var _0x2f9c36=_0x8819[_0x3e3e03];return _0x2f9c36;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x9881('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x9881('0x1')](0x0);var events={'afterCreate':_0x9881('0x2'),'afterUpdate':_0x9881('0x3'),'afterDestroy':_0x9881('0x4')};function emitEvent(_0x5e52c5){return function(_0x333d6f,_0x446deb,_0xf41442){PluginEvents[_0x9881('0x5')](_0x5e52c5+':'+_0x333d6f['id'],_0x333d6f);PluginEvents[_0x9881('0x5')](_0x5e52c5,_0x333d6f);_0xf41442(null);};}for(var e in events){if(events[_0x9881('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9881('0x7')]=PluginEvents; \ No newline at end of file +var _0x7c1f=['../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0xec6622,_0x2401a3){var _0x5e6408=function(_0x191c40){while(--_0x191c40){_0xec6622['push'](_0xec6622['shift']());}};_0x5e6408(++_0x2401a3);}(_0x7c1f,0x194));var _0xf7c1=function(_0x36d4c1,_0x162479){_0x36d4c1=_0x36d4c1-0x0;var _0x3da041=_0x7c1f[_0x36d4c1];return _0x3da041;};'use strict';var EventEmitter=require(_0xf7c1('0x0'));var Plugin=require(_0xf7c1('0x1'))['db'][_0xf7c1('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf7c1('0x3')](0x0);var events={'afterCreate':_0xf7c1('0x4'),'afterUpdate':'update','afterDestroy':_0xf7c1('0x5')};function emitEvent(_0x13f6da){return function(_0x18f5a9,_0x485d8d,_0x3082d6){PluginEvents[_0xf7c1('0x6')](_0x13f6da+':'+_0x18f5a9['id'],_0x18f5a9);PluginEvents[_0xf7c1('0x6')](_0x13f6da,_0x18f5a9);_0x3082d6(null);};}for(var e in events){if(events[_0xf7c1('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf7c1('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 826657c..d2e4f25 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 _0x352d=['api','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x44bb11,_0x406338){var _0x8be7d7=function(_0x3335fb){while(--_0x3335fb){_0x44bb11['push'](_0x44bb11['shift']());}};_0x8be7d7(++_0x406338);}(_0x352d,0xe1));var _0xd352=function(_0xd41b14,_0x2ac375){_0xd41b14=_0xd41b14-0x0;var _0x574c30=_0x352d[_0xd41b14];return _0x574c30;};'use strict';var _=require(_0xd352('0x0'));var util=require(_0xd352('0x1'));var logger=require(_0xd352('0x2'))(_0xd352('0x3'));var moment=require('moment');var BPromise=require(_0xd352('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd352('0x5'));var config=require(_0xd352('0x6'));var attributes=require(_0xd352('0x7'));module[_0xd352('0x8')]=function(_0x1f1e80,_0x5aa5b7){return _0x1f1e80[_0xd352('0x9')](_0xd352('0xa'),attributes,{'tableName':_0xd352('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cde=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','util'];(function(_0x105167,_0x1b71d0){var _0x14b1f0=function(_0x343e7b){while(--_0x343e7b){_0x105167['push'](_0x105167['shift']());}};_0x14b1f0(++_0x1b71d0);}(_0x0cde,0xb4));var _0xe0cd=function(_0x13c13f,_0x365b86){_0x13c13f=_0x13c13f-0x0;var _0x3e4a98=_0x0cde[_0x13c13f];return _0x3e4a98;};'use strict';var _=require(_0xe0cd('0x0'));var util=require(_0xe0cd('0x1'));var logger=require(_0xe0cd('0x2'))(_0xe0cd('0x3'));var moment=require(_0xe0cd('0x4'));var BPromise=require(_0xe0cd('0x5'));var rp=require(_0xe0cd('0x6'));var fs=require('fs');var path=require(_0xe0cd('0x7'));var rimraf=require(_0xe0cd('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0cd('0x9'));module[_0xe0cd('0xa')]=function(_0x2e1d26,_0x5202fc){return _0x2e1d26[_0xe0cd('0xb')](_0xe0cd('0xc'),attributes,{'tableName':_0xe0cd('0xd'),'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 849ac6c..ab20810 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 _0x477a=['then','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x3b29b9,_0x561ed5){var _0xaced28=function(_0x4a6f5a){while(--_0x4a6f5a){_0x3b29b9['push'](_0x3b29b9['shift']());}};_0xaced28(++_0x561ed5);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});config[_0xa477('0x9')]=_[_0xa477('0xa')](config[_0xa477('0x9')],{'host':_0xa477('0xb'),'port':0x18eb});var socket=require(_0xa477('0xc'))(new Redis(config[_0xa477('0x9')]));require(_0xa477('0xd'))['register'](socket);function respondWithRpcPromise(_0x210383,_0x3d46eb,_0x599eb7){return new BPromise(function(_0x4ce130,_0x559cb9){return client['request'](_0x210383,_0x599eb7)['then'](function(_0x3450d1){logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,'request\x20sent');logger[_0xa477('0x10')](_0xa477('0x11'),_0x3d46eb,_0xa477('0x12'),JSON['stringify'](_0x3450d1));if(_0x3450d1[_0xa477('0x13')]){if(_0x3450d1[_0xa477('0x13')][_0xa477('0x14')]===0x1f4){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1['error'][_0xa477('0x15')]);return _0x559cb9(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);return _0x4ce130(_0x3450d1[_0xa477('0x13')][_0xa477('0x15')]);}else{logger[_0xa477('0xe')](_0xa477('0xf'),_0x3d46eb,_0xa477('0x12'));_0x4ce130(_0x3450d1[_0xa477('0x16')]['message']);}})[_0xa477('0x17')](function(_0x16c31d){logger[_0xa477('0x13')](_0xa477('0xf'),_0x3d46eb,_0x16c31d);_0x559cb9(_0x16c31d);});});}exports[_0xa477('0x18')]=function(_0x265169){var _0x2a3f54=this;return new Promise(function(_0x2c245b,_0x5af670){return db[_0xa477('0x19')][_0xa477('0x1a')](_0x265169[_0xa477('0x1b')],{'raw':_0x265169['options']?_0x265169['options']['raw']===undefined?!![]:![]:!![]})[_0xa477('0x1c')](function(_0x2debae){logger['info'](_0xa477('0x18'),_0x265169);logger['debug']('CreatePlugin',_0x265169,JSON[_0xa477('0x1d')](_0x2debae));_0x2c245b(_0x2debae);})[_0xa477('0x17')](function(_0x1bb568){logger[_0xa477('0x13')](_0xa477('0x18'),_0x1bb568[_0xa477('0x15')],_0x265169);_0x5af670(_0x2a3f54[_0xa477('0x13')](0x1f4,_0x1bb568['message']));});});}; \ No newline at end of file +var _0x8594=['rpc','../../config/environment','client','redis','defaults','socket.io-emitter','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Plugin','create','body','options','raw','then','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x209439,_0x5bf7a2){var _0x2636ed=function(_0x21fa2b){while(--_0x21fa2b){_0x209439['push'](_0x209439['shift']());}};_0x2636ed(++_0x5bf7a2);}(_0x8594,0x94));var _0x4859=function(_0x2cc69e,_0x8679a6){_0x2cc69e=_0x2cc69e-0x0;var _0x33f20e=_0x8594[_0x2cc69e];return _0x33f20e;};'use strict';var _=require(_0x4859('0x0'));var util=require(_0x4859('0x1'));var moment=require('moment');var BPromise=require(_0x4859('0x2'));var rs=require(_0x4859('0x3'));var fs=require('fs');var Redis=require(_0x4859('0x4'));var db=require(_0x4859('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4859('0x6'))(_0x4859('0x7'));var config=require(_0x4859('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4859('0x9')]['http']({'port':0x232a});config[_0x4859('0xa')]=_[_0x4859('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4859('0xc'))(new Redis(config[_0x4859('0xa')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x2a370c,_0x110937,_0x1df37a){return new BPromise(function(_0xcd3675,_0xbb3cfa){return client[_0x4859('0xd')](_0x2a370c,_0x1df37a)['then'](function(_0x1dd74b){logger[_0x4859('0xe')](_0x4859('0xf'),_0x110937,_0x4859('0x10'));logger[_0x4859('0x11')](_0x4859('0x12'),_0x110937,_0x4859('0x10'),JSON[_0x4859('0x13')](_0x1dd74b));if(_0x1dd74b[_0x4859('0x14')]){if(_0x1dd74b[_0x4859('0x14')][_0x4859('0x15')]===0x1f4){logger[_0x4859('0x14')](_0x4859('0xf'),_0x110937,_0x1dd74b[_0x4859('0x14')][_0x4859('0x16')]);return _0xbb3cfa(_0x1dd74b[_0x4859('0x14')][_0x4859('0x16')]);}logger[_0x4859('0x14')]('Plugin,\x20%s,\x20%s',_0x110937,_0x1dd74b['error'][_0x4859('0x16')]);return _0xcd3675(_0x1dd74b[_0x4859('0x14')][_0x4859('0x16')]);}else{logger[_0x4859('0xe')]('Plugin,\x20%s,\x20%s',_0x110937,_0x4859('0x10'));_0xcd3675(_0x1dd74b['result'][_0x4859('0x16')]);}})[_0x4859('0x17')](function(_0x27bbfe){logger['error'](_0x4859('0xf'),_0x110937,_0x27bbfe);_0xbb3cfa(_0x27bbfe);});});}exports['CreatePlugin']=function(_0x6e36f5){var _0x249a9b=this;return new Promise(function(_0x4fc8b2,_0xeb49a){return db[_0x4859('0x18')][_0x4859('0x19')](_0x6e36f5[_0x4859('0x1a')],{'raw':_0x6e36f5['options']?_0x6e36f5[_0x4859('0x1b')][_0x4859('0x1c')]===undefined?!![]:![]:!![]})[_0x4859('0x1d')](function(_0x2fe28b){logger['info']('CreatePlugin',_0x6e36f5);logger['debug'](_0x4859('0x1e'),_0x6e36f5,JSON[_0x4859('0x13')](_0x2fe28b));_0x4fc8b2(_0x2fe28b);})[_0x4859('0x17')](function(_0x4aae49){logger[_0x4859('0x14')](_0x4859('0x1e'),_0x4aae49['message'],_0x6e36f5);_0xeb49a(_0x249a9b[_0x4859('0x14')](0x1f4,_0x4aae49[_0x4859('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b56b986..77b738c 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 _0x5095=['update','emit','plugin:','save'];(function(_0x56f632,_0x3f7f44){var _0x47fd94=function(_0x5032fc){while(--_0x5032fc){_0x56f632['push'](_0x56f632['shift']());}};_0x47fd94(++_0x3f7f44);}(_0x5095,0x177));var _0x5509=function(_0xa570e,_0x5cc29e){_0xa570e=_0xa570e-0x0;var _0x88ecc0=_0x5095[_0xa570e];return _0x88ecc0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5509('0x0'),'remove',_0x5509('0x1')];function createListener(_0x141bec,_0x4804fb){return function(_0x5c336f){_0x4804fb[_0x5509('0x2')](_0x141bec,_0x5c336f);};}function removeListener(_0xbad753,_0x1c2e7c){return function(){PluginEvents['removeListener'](_0xbad753,_0x1c2e7c);};}exports['register']=function(_0x5f347a){for(var _0x54f86f=0x0,_0x18eb28=events['length'];_0x54f86f<_0x18eb28;_0x54f86f++){var _0x451ce6=events[_0x54f86f];var _0x39e304=createListener(_0x5509('0x3')+_0x451ce6,_0x5f347a);PluginEvents['on'](_0x451ce6,_0x39e304);}}; \ No newline at end of file +var _0x98f6=['save','update','length','./plugin.events'];(function(_0x42bda2,_0x4106ca){var _0x625d2d=function(_0x47b4ba){while(--_0x47b4ba){_0x42bda2['push'](_0x42bda2['shift']());}};_0x625d2d(++_0x4106ca);}(_0x98f6,0x19f));var _0x698f=function(_0x597e38,_0x551ac2){_0x597e38=_0x597e38-0x0;var _0x5305d2=_0x98f6[_0x597e38];return _0x5305d2;};'use strict';var PluginEvents=require(_0x698f('0x0'));var events=[_0x698f('0x1'),'remove',_0x698f('0x2')];function createListener(_0x50afcb,_0x509001){return function(_0x43eb79){_0x509001['emit'](_0x50afcb,_0x43eb79);};}function removeListener(_0x22c772,_0x5ae884){return function(){PluginEvents['removeListener'](_0x22c772,_0x5ae884);};}exports['register']=function(_0x37f017){for(var _0x49412b=0x0,_0x588faf=events[_0x698f('0x3')];_0x49412b<_0x588faf;_0x49412b++){var _0x2b45ed=events[_0x49412b];var _0x74fef3=createListener('plugin:'+_0x2b45ed,_0x37f017);PluginEvents['on'](_0x2b45ed,_0x74fef3);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3fab7d0..296bd51 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(_0x203032,_0x62538e){var _0x231f9b=function(_0x2490a){while(--_0x2490a){_0x203032['push'](_0x203032['shift']());}};_0x231f9b(++_0x62538e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x53ba7a,_0x22737e){var _0x1dc1b9=function(_0x2adf46){while(--_0x2adf46){_0x53ba7a['push'](_0x53ba7a['shift']());}};_0x1dc1b9(++_0x22737e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 ff8c44b..2950c91 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 _0x4e81=['npm\x20install','info','index','then','express','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x3bddb1,_0x1306c7){var _0x977506=function(_0x77d9c1){while(--_0x77d9c1){_0x3bddb1['push'](_0x3bddb1['shift']());}};_0x977506(++_0x1306c7);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x4e81[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x14e8('0x0'));var pm2=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x14e8('0x3')];var BPromise=require(_0x14e8('0x4'));function handleEntityNotFound(_0x224121,_0x436444){return function(_0x325325){if(!_0x325325){_0x224121[_0x14e8('0x5')](0x194);;}return _0x325325;};}function respondWithResult(_0x56a266,_0x57c79b){_0x57c79b=_0x57c79b||0xc8;return function(_0x3e73d2){if(_0x3e73d2){return _0x56a266[_0x14e8('0x6')](_0x57c79b)[_0x14e8('0x7')](_0x3e73d2);}return null;};}function handleError(_0x3c1b93,_0x11ec3b){_0x11ec3b=_0x11ec3b||0x1f4;return function(_0x20f053){logger[_0x14e8('0x8')](_0x20f053[_0x14e8('0x9')]);if(_0x20f053[_0x14e8('0xa')]){delete _0x20f053['name'];}_0x3c1b93[_0x14e8('0x6')](_0x11ec3b)[_0x14e8('0xb')](_0x20f053);};}function execChildProcess(){return new BPromise(function(_0x43bfcd,_0x2906b3){exec(_0x14e8('0xc'),function(_0x3ce648,_0x3bed91,_0x30df66){logger['info'](_0x3bed91);logger[_0x14e8('0xd')](_0x30df66);if(_0x3ce648){logger['error'](_0x3ce648);return _0x2906b3(_0x3ce648);}return _0x43bfcd(_0x3bed91);});});}exports[_0x14e8('0xe')]=function(_0x341d40,_0x32a01d){return pm2['list']()[_0x14e8('0xf')](function(_0x4e1064){if(_0x4e1064){var _0x458e4a=_['reject'](_0x4e1064,function(_0x347216){return _0x347216[_0x14e8('0xa')]===_0x14e8('0x10')||_0x347216[_0x14e8('0xa')]==='motion2';});return{'rows':_0x458e4a,'count':_0x458e4a[_0x14e8('0x11')]};}return null;})[_0x14e8('0xf')](respondWithResult(_0x32a01d,null))[_0x14e8('0x12')](handleError(_0x32a01d,null));};exports[_0x14e8('0x13')]=function(_0xd4d6b2,_0x1f1a0d){return pm2[_0x14e8('0x14')](_0xd4d6b2[_0x14e8('0x15')]['id'])['then'](respondWithResult(_0x1f1a0d,null))[_0x14e8('0xf')](handleEntityNotFound(_0x1f1a0d,null))[_0x14e8('0x12')](handleError(_0x1f1a0d,null));};exports[_0x14e8('0x16')]=function(_0x7b10f2,_0x246c5d){if(_0x7b10f2['body'][_0x14e8('0xa')]&&_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]){var _0x48e30a=path[_0x14e8('0x19')](__dirname,'../../files/plugins',_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]);var _0x3e8d5c=process[_0x14e8('0x1a')]();process[_0x14e8('0x1b')](path['dirname'](_0x48e30a));return execChildProcess()[_0x14e8('0xf')](function(_0x5b11f9){process[_0x14e8('0x1b')](_0x3e8d5c);return pm2[_0x14e8('0x1c')]({'name':_0x7b10f2['body']['name'],'script':_0x48e30a});})['then'](function(_0x4a758c){pm2[_0x14e8('0x1d')]();return _0x4a758c[0x0];})[_0x14e8('0xf')](respondWithResult(_0x246c5d,0xc9))[_0x14e8('0x12')](handleError(_0x246c5d,null));}else{return _0x246c5d[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x1e')});}};exports[_0x14e8('0x1f')]=function(_0x3c09cb,_0x2f5818){if(_0x3c09cb[_0x14e8('0x17')]['id']){delete _0x3c09cb[_0x14e8('0x17')]['id'];}var _0x2813ae={'online':'restart','stopped':_0x14e8('0x20')};if(_0x2813ae[_0x14e8('0x21')](_0x3c09cb[_0x14e8('0x17')]['status'])){return pm2[_0x2813ae[_0x3c09cb['body']['status']]](_0x3c09cb[_0x14e8('0x15')]['id'])[_0x14e8('0xf')](respondWithResult(_0x2f5818,0xc8))['catch'](handleError(_0x2f5818,null));}else{return _0x2f5818[_0x14e8('0x6')](0x1f4)[_0x14e8('0xb')]({'message':_0x14e8('0x22')});}};exports[_0x14e8('0x23')]=function(_0x5c2635,_0x1f1259){if(_0x5c2635[_0x14e8('0x17')]['id']){delete _0x5c2635[_0x14e8('0x17')]['id'];}if(_0x5c2635[_0x14e8('0x15')]['id']){return pm2[_0x14e8('0x24')](_0x5c2635['params']['id'])[_0x14e8('0xf')](function(_0x29ee7a){pm2[_0x14e8('0x1d')]();return _0x29ee7a[0x0];})[_0x14e8('0xf')](respondWithResult(_0x1f1259,null))['catch'](handleError(_0x1f1259,null));}else{return _0x1f1259[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x25')});}}; \ No newline at end of file +var _0xbf6e=['start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname'];(function(_0x51e5d1,_0x324ded){var _0x30f398=function(_0x4a7bfe){while(--_0x4a7bfe){_0x51e5d1['push'](_0x51e5d1['shift']());}};_0x30f398(++_0x324ded);}(_0xbf6e,0x149));var _0xebf6=function(_0x5ce51d,_0x39f17c){_0x5ce51d=_0x5ce51d-0x0;var _0x835be7=_0xbf6e[_0x5ce51d];return _0x835be7;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));var path=require(_0xebf6('0x2'));var exec=require(_0xebf6('0x3'))[_0xebf6('0x4')];var BPromise=require(_0xebf6('0x5'));function handleEntityNotFound(_0x5c2323,_0x49de28){return function(_0x2b0c61){if(!_0x2b0c61){_0x5c2323[_0xebf6('0x6')](0x194);;}return _0x2b0c61;};}function respondWithResult(_0x3b2bb6,_0x1e15cf){_0x1e15cf=_0x1e15cf||0xc8;return function(_0x143344){if(_0x143344){return _0x3b2bb6[_0xebf6('0x7')](_0x1e15cf)[_0xebf6('0x8')](_0x143344);}return null;};}function handleError(_0x548e9e,_0x1d8035){_0x1d8035=_0x1d8035||0x1f4;return function(_0x40b28a){logger[_0xebf6('0x9')](_0x40b28a['stack']);if(_0x40b28a[_0xebf6('0xa')]){delete _0x40b28a[_0xebf6('0xa')];}_0x548e9e['status'](_0x1d8035)[_0xebf6('0xb')](_0x40b28a);};}function execChildProcess(){return new BPromise(function(_0x231d6b,_0x474dbe){exec(_0xebf6('0xc'),function(_0x1bd481,_0x36f588,_0x47ee12){logger[_0xebf6('0xd')](_0x36f588);logger[_0xebf6('0xd')](_0x47ee12);if(_0x1bd481){logger['error'](_0x1bd481);return _0x474dbe(_0x1bd481);}return _0x231d6b(_0x36f588);});});}exports[_0xebf6('0xe')]=function(_0x101a6c,_0x20c9ce){return pm2[_0xebf6('0xf')]()[_0xebf6('0x10')](function(_0x4dbf51){if(_0x4dbf51){var _0x4c01f4=_['reject'](_0x4dbf51,function(_0x4cecbc){return _0x4cecbc[_0xebf6('0xa')]==='express'||_0x4cecbc[_0xebf6('0xa')]===_0xebf6('0x11');});return{'rows':_0x4c01f4,'count':_0x4c01f4[_0xebf6('0x12')]};}return null;})[_0xebf6('0x10')](respondWithResult(_0x20c9ce,null))[_0xebf6('0x13')](handleError(_0x20c9ce,null));};exports[_0xebf6('0x14')]=function(_0x219621,_0x2dc96f){return pm2[_0xebf6('0x15')](_0x219621[_0xebf6('0x16')]['id'])['then'](respondWithResult(_0x2dc96f,null))['then'](handleEntityNotFound(_0x2dc96f,null))[_0xebf6('0x13')](handleError(_0x2dc96f,null));};exports[_0xebf6('0x17')]=function(_0x10051e,_0x410f06){if(_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')]&&_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]){var _0x4fb497=path[_0xebf6('0x1a')](__dirname,_0xebf6('0x1b'),_0x10051e[_0xebf6('0x18')][_0xebf6('0x19')]);var _0x6303ac=process[_0xebf6('0x1c')]();process[_0xebf6('0x1d')](path[_0xebf6('0x1e')](_0x4fb497));return execChildProcess()[_0xebf6('0x10')](function(_0x2e32c6){process[_0xebf6('0x1d')](_0x6303ac);return pm2[_0xebf6('0x1f')]({'name':_0x10051e[_0xebf6('0x18')][_0xebf6('0xa')],'script':_0x4fb497});})[_0xebf6('0x10')](function(_0x1d0078){pm2[_0xebf6('0x20')]();return _0x1d0078[0x0];})[_0xebf6('0x10')](respondWithResult(_0x410f06,0xc9))[_0xebf6('0x13')](handleError(_0x410f06,null));}else{return _0x410f06['status'](0x1f4)['send']({'message':_0xebf6('0x21')});}};exports['update']=function(_0x230d84,_0x430eb7){if(_0x230d84['body']['id']){delete _0x230d84['body']['id'];}var _0x37950c={'online':_0xebf6('0x22'),'stopped':_0xebf6('0x23')};if(_0x37950c[_0xebf6('0x24')](_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')])){return pm2[_0x37950c[_0x230d84[_0xebf6('0x18')][_0xebf6('0x7')]]](_0x230d84['params']['id'])[_0xebf6('0x10')](respondWithResult(_0x430eb7,0xc8))[_0xebf6('0x13')](handleError(_0x430eb7,null));}else{return _0x430eb7['status'](0x1f4)[_0xebf6('0xb')]({'message':_0xebf6('0x25')});}};exports['destroy']=function(_0x2901fc,_0x1fa407){if(_0x2901fc[_0xebf6('0x18')]['id']){delete _0x2901fc[_0xebf6('0x18')]['id'];}if(_0x2901fc[_0xebf6('0x16')]['id']){return pm2[_0xebf6('0x26')](_0x2901fc['params']['id'])[_0xebf6('0x10')](function(_0x34cc38){pm2['dump']();return _0x34cc38[0x0];})['then'](respondWithResult(_0x1fa407,null))[_0xebf6('0x13')](handleError(_0x1fa407,null));}else{return _0x1fa407[_0xebf6('0x7')](0x1f4)['send']({'message':_0xebf6('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d49a9bf..e6f90d0 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 _0xaff9=['express','Router','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues'];(function(_0x1b6aa3,_0x98f05c){var _0x2322f2=function(_0x239a7c){while(--_0x239a7c){_0x1b6aa3['push'](_0x1b6aa3['shift']());}};_0x2322f2(++_0x98f05c);}(_0xaff9,0x70));var _0x9aff=function(_0x15b50e,_0x398bda){_0x15b50e=_0x15b50e-0x0;var _0x9e8ffe=_0xaff9[_0x15b50e];return _0x9e8ffe;};'use strict';var express=require(_0x9aff('0x0'));var router=express[_0x9aff('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9aff('0x2'));router[_0x9aff('0x3')](_0x9aff('0x4'),auth[_0x9aff('0x5')](),controller['getAgents']);router[_0x9aff('0x3')](_0x9aff('0x6'),auth[_0x9aff('0x5')](),controller[_0x9aff('0x7')]);module['exports']=router; \ No newline at end of file +var _0xe2e3=['/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x987fe6,_0x24ac32){var _0x4fb549=function(_0x14a3d0){while(--_0x14a3d0){_0x987fe6['push'](_0x987fe6['shift']());}};_0x4fb549(++_0x24ac32);}(_0xe2e3,0x10b));var _0x3e2e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe2e3[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x3e2e('0x0'));var router=express[_0x3e2e('0x1')]();var auth=require(_0x3e2e('0x2'));var controller=require(_0x3e2e('0x3'));router[_0x3e2e('0x4')](_0x3e2e('0x5'),auth[_0x3e2e('0x6')](),controller[_0x3e2e('0x7')]);router[_0x3e2e('0x4')](_0x3e2e('0x8'),auth['isAuthenticated'](),controller[_0x3e2e('0x9')]);module[_0x3e2e('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 34e56b1..c6c9aa4 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 _0x15f3=['pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','User','rawAttributes','type','key','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','Agents','assign','UserProfile','getResources','findAndCountAll','map','filterAgentAttributes','globalStatus','getAgentStatus','Status','sortAgentsByStatus','split','pick','getQueues','startCase','Queue','fieldName','voice','dialActive','dialMethod','userProfileId','outbound','Queues','name','filter','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter'];(function(_0x12ce7b,_0x2daaee){var _0x4ee1b1=function(_0x398ac9){while(--_0x398ac9){_0x12ce7b['push'](_0x12ce7b['shift']());}};_0x4ee1b1(++_0x2daaee);}(_0x15f3,0x194));var _0x315f=function(_0xe47e10,_0x573228){_0xe47e10=_0xe47e10-0x0;var _0x683939=_0x15f3[_0xe47e10];return _0x683939;};'use strict';var _=require(_0x315f('0x0'));var util=require(_0x315f('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x315f('0x2'));var qs=require(_0x315f('0x3'));var utils=require(_0x315f('0x4'));var db=require(_0x315f('0x5'))['db'];var APIBadRequestError=require(_0x315f('0x6'))[_0x315f('0x7')];var APIHandleError=require('../../errors/api')[_0x315f('0x8')];function respondWithFilteredResult(_0x231dee,_0x3e4d8a){return function(_0xcd088a){if(_0xcd088a){var _0x445dd3=typeof _0x3e4d8a[_0x315f('0x9')]==='undefined'&&typeof _0x3e4d8a['limit']===_0x315f('0xa');var _0xf503ae=_0xcd088a[_0x315f('0xb')];var _0x3ce5b0=_0x445dd3?0x0:_0x3e4d8a[_0x315f('0x9')];var _0x1e37b0=_0x445dd3?_0xcd088a[_0x315f('0xb')]:_0x3e4d8a['offset']+_0x3e4d8a['limit'];var _0x1a8c65;if(_0x1e37b0>=_0xf503ae){_0x1e37b0=_0xf503ae;_0x1a8c65=0xc8;}else{_0x1a8c65=0xce;}_0x231dee[_0x315f('0xc')](_0x1a8c65);return _0x231dee[_0x315f('0xd')]('Content-Range',_0x3ce5b0+'-'+_0x1e37b0+'/'+_0xf503ae)[_0x315f('0xe')](_0xcd088a);}return null;};}exports[_0x315f('0xf')]=function(_0x58d3d7,_0x1c3f61){var _0x150bd7={'count':0x0,'rows':[]};var _0x4c1093={};var _0x58b2e9;var _0x39fb58=utils[_0x315f('0x10')]();var _0x480e27;var _0x51ae51;var _0x4502bd=_0x58d3d7[_0x315f('0x11')][_0x315f('0x12')];var _0x3a344e=_0x58d3d7[_0x315f('0x11')][_0x315f('0x13')];var _0x1b9d5a=_0x58d3d7[_0x315f('0x11')][_0x315f('0x14')];var _0x3a4317=_0x3a344e===_0x315f('0x15')||_0x3a344e===_0x315f('0x16')?!![]:![];var _0x515d5f=[];var _0x5c5edd;var _0x56cdb5;Promise[_0x315f('0x17')]()[_0x315f('0x18')](function(){if(_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')]){if(!utils[_0x315f('0x1a')](_0x58d3d7['query'][_0x315f('0x19')])){throw new APIBadRequestError(util['format'](_0x315f('0x1b'),_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')]));}_0x58b2e9=_0x58d3d7[_0x315f('0x11')][_0x315f('0x19')][_0x315f('0x1c')]();}if(!_0x58d3d7[_0x315f('0x11')][_0x315f('0x1d')]||!_0x58d3d7[_0x315f('0x11')]['sort'][_0x315f('0x1e')]('globalStatus')){_0x58d3d7['query'][_0x315f('0x1d')]=rta[_0x315f('0x1f')](_0x58d3d7['query'][_0x315f('0x1d')]);return;}var _0x36ea9a=rta['getUpdatedSortOptions'](_0x58d3d7['query']['sort']);_0x58d3d7[_0x315f('0x11')]['sort']=_0x36ea9a[_0x315f('0x20')][_0x315f('0x21')](',');_0x5c5edd=_0x36ea9a[_0x315f('0x22')];})[_0x315f('0x18')](function(){if(!_0x4502bd){return[];}return rta[_0x315f('0x23')](_0x4502bd,_0x58b2e9);})['then'](function(_0x2a8c54){_0x515d5f=_0x2a8c54;return rta[_0x315f('0x24')]();})[_0x315f('0x18')](function(_0x3ebcf4){_0x51ae51=_0x3ebcf4[_0x315f('0x25')];if((!_0x3a344e||_0x3a4317)&&!_0x5c5edd){return _0x515d5f;}if(_0x5c5edd&&!_0x3a344e){return rta[_0x315f('0x26')](_0x51ae51,_0x515d5f,_0x5c5edd);}else{return rta['getAgentIdsByStatus'](_0x51ae51,_0x515d5f,_0x3a344e);}})['then'](function(_0x15ec0f){_0x515d5f=_0x15ec0f;var _0x3f7755=![];if(_0x515d5f[_0x315f('0x27')]===0x0){if(_0x4502bd||_0x3a344e){_0x3f7755=!![];}if(_0x3a4317){_0x3f7755=![];}}if(_0x3f7755){return _0x150bd7;}var _0x4a13ff=_['map'](db[_0x315f('0x28')][_0x315f('0x29')],function(_0x529b0b){return{'name':_0x529b0b['fieldName'],'type':_0x529b0b[_0x315f('0x2a')][_0x315f('0x2b')]};});_0x58d3d7[_0x315f('0x11')][_0x315f('0x2c')]=_0x315f('0x2d');_0x58d3d7['query']['online']=!![];_0x4c1093=qs[_0x315f('0x2e')](_0x4a13ff,_0x58d3d7);_0x4c1093[_0x315f('0x2f')]=!![];var _0x2763b1=[];if(_0x515d5f[_0x315f('0x27')]>0x0){_0x2763b1[_0x315f('0x30')]({'id':{'$in':_0x515d5f}});if(_0x5c5edd&&!_0x3a344e){_0x56cdb5=[db[_0x315f('0x31')][_0x315f('0x32')](_0x315f('0x33')+_0x515d5f+')')];_0x4c1093[_0x315f('0x22')]=_0x56cdb5;}}if(_0x3a4317){_0x39fb58['forEach'](function(_0x2274ad){var _0x592f2c=!![];if(_0x3a344e==='*pause'&&_0x58b2e9!==_0x2274ad){_0x592f2c=![];}_0x2763b1[_0x315f('0x30')]({[_0x2274ad+'Pause']:_0x592f2c});});if(_0x1b9d5a){_0x2763b1[_0x315f('0x30')]({'pauseType':_0x1b9d5a});}}else if(_0x3a344e){_0x39fb58[_0x315f('0x34')](function(_0x4d3970){_0x2763b1[_0x315f('0x30')]({[_0x4d3970+_0x315f('0x35')]:![]});});}_0x4c1093[_0x315f('0x36')]=_[_0x315f('0x37')](_0x4c1093[_0x315f('0x36')],{'$and':_0x2763b1});if(_0x58d3d7[_0x315f('0x38')][_0x315f('0x2c')]===_0x315f('0x38')){var _0x822cd5={'params':{'id':_0x58d3d7[_0x315f('0x38')]['userProfileId']},'query':{'section':_0x315f('0x39'),'role':_0x315f('0x2d'),'online':!![],'raw':!![],'ids':_0x515d5f,'customSorting':_0x56cdb5}};if(_0x3a4317){_0x822cd5[_0x315f('0x11')]['extraQueryConditions']=_0x2763b1;}_0x822cd5[_0x315f('0x11')]=Object[_0x315f('0x3a')](_0x822cd5[_0x315f('0x11')],_0x58d3d7[_0x315f('0x11')]);delete _0x822cd5[_0x315f('0x11')]['id'];return db[_0x315f('0x3b')][_0x315f('0x3c')](_0x822cd5);}return db['User'][_0x315f('0x3d')](_0x4c1093);})[_0x315f('0x18')](function(_0x44303a){_0x150bd7['count']=_0x44303a[_0x315f('0xb')];_0x480e27=_0x44303a[_0x315f('0x25')];return _0x480e27[_0x315f('0x3e')](function(_0x556756){var _0x59fa78=_['find'](_0x51ae51,['id',_0x556756['id']]);if(_0x59fa78){var _0x354411=rta[_0x315f('0x3f')](_0x59fa78);_[_0x315f('0x37')](_0x556756,_0x354411);}_0x556756[_0x315f('0x40')]=rta[_0x315f('0x41')](_0x556756);if(_0x556756['globalStatus'][_0x315f('0x1e')](_0x315f('0x15'))){_0x39fb58['forEach'](function(_0x3ae9a1){if(_0x556756[_0x3ae9a1+'Pause']){_0x556756[_0x3ae9a1+_0x315f('0x42')]='pause';}});}return _0x556756;});})[_0x315f('0x18')](function(_0x26c52b){if(!_0x5c5edd||_0x56cdb5){return _0x26c52b;}return rta[_0x315f('0x43')](_0x26c52b,_0x5c5edd);})[_0x315f('0x18')](function(_0x538a0d){var _0x447854=null;if(_0x58d3d7[_0x315f('0x11')][_0x315f('0x20')]){var _0x2aa59e=_0x58d3d7['query'][_0x315f('0x20')][_0x315f('0x44')](',');_0x447854=_0x538a0d[_0x315f('0x3e')](function(_0x51b1f1){return _[_0x315f('0x45')](_0x51b1f1,_0x2aa59e);});}_0x150bd7[_0x315f('0x25')]=_0x447854||_0x538a0d;return _0x150bd7;})['then'](respondWithFilteredResult(_0x1c3f61,_0x4c1093))['catch'](APIHandleError(_0x1c3f61));};exports[_0x315f('0x46')]=function(_0x39a29c,_0x1572c9){var _0x12101b={'count':0x0,'rows':[]};var _0x2201ec={};var _0x502f41;var _0x5a9da5;var _0x530414;Promise[_0x315f('0x17')]()[_0x315f('0x18')](function(){if(_0x39a29c['query'][_0x315f('0x19')]){if(!utils[_0x315f('0x1a')](_0x39a29c[_0x315f('0x11')][_0x315f('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x39a29c[_0x315f('0x11')]['channel']));}_0x502f41=_0x39a29c[_0x315f('0x11')][_0x315f('0x19')][_0x315f('0x1c')]();}var _0x475289=_[_0x315f('0x47')](_0x502f41)+_0x315f('0x48');var _0x3676eb=_['map'](db[_0x475289]['rawAttributes'],function(_0x1a5a97){return{'name':_0x1a5a97[_0x315f('0x49')],'type':_0x1a5a97['type'][_0x315f('0x2b')]};});if(!_0x39a29c[_0x315f('0x11')][_0x315f('0x20')]){var _0x88a4c6=['id','name'];if(_0x502f41===_0x315f('0x4a')){_0x88a4c6['push'](_0x315f('0x2a'));if(_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]==='outbound'){_0x88a4c6[_0x315f('0x30')]([_0x315f('0x4b'),_0x315f('0x4c')]);}}_0x39a29c[_0x315f('0x11')][_0x315f('0x20')]=_0x88a4c6[_0x315f('0x21')](',');}_0x2201ec=qs[_0x315f('0x2e')](_0x3676eb,_0x39a29c);if(_0x39a29c[_0x315f('0x38')][_0x315f('0x2c')]==='user'){var _0x481b4a={'params':{'id':_0x39a29c[_0x315f('0x38')][_0x315f('0x4d')]},'query':{'section':_0x502f41===_0x315f('0x4a')&&_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]===_0x315f('0x4e')?'QueueCampaigns':_[_0x315f('0x47')](_0x502f41)+_0x315f('0x4f'),'type':_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')],'nolimit':!![],'sort':_0x315f('0x50'),'filter':_0x39a29c[_0x315f('0x11')][_0x315f('0x51')]}};return db['UserProfile']['getResources'](_0x481b4a);}return db[_0x475289][_0x315f('0x3d')](_0x2201ec);})['then'](function(_0xac33c9){_0x12101b[_0x315f('0xb')]=_0xac33c9[_0x315f('0xb')];_0x5a9da5=_0xac33c9[_0x315f('0x25')];return rtq[_0x315f('0x52')](_0x39a29c,_0x502f41);})[_0x315f('0x18')](function(_0x310ef6){_0x530414=_0x310ef6[_0x315f('0x25')];return rtq[_0x315f('0x53')](_0x5a9da5,_0x530414,_0x502f41,_0x39a29c[_0x315f('0x11')][_0x315f('0x2a')]);})[_0x315f('0x18')](function(_0x593a70){_0x12101b[_0x315f('0x25')]=_0x593a70;return _0x12101b;})[_0x315f('0x18')](respondWithFilteredResult(_0x1572c9,_0x2201ec))[_0x315f('0x54')](APIHandleError(_0x1572c9));}; \ No newline at end of file +var _0x1a1c=['undefined','limit','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','forEach','*pause','push','Pause','merge','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','User','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','Status','pause','sortAgentsByStatus','pick','getQueues','isValidChannel','startCase','name','voice','dialActive','dialMethod','outbound','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','initializeQueues','catch','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset'];(function(_0x32bab7,_0x3084b1){var _0x4729b5=function(_0x16d252){while(--_0x16d252){_0x32bab7['push'](_0x32bab7['shift']());}};_0x4729b5(++_0x3084b1);}(_0x1a1c,0x19a));var _0xc1a1=function(_0x12295a,_0x391899){_0x12295a=_0x12295a-0x0;var _0xc9c17a=_0x1a1c[_0x12295a];return _0xc9c17a;};'use strict';var _=require(_0xc1a1('0x0'));var util=require('util');var rta=require(_0xc1a1('0x1'));var rtq=require(_0xc1a1('0x2'));var qs=require(_0xc1a1('0x3'));var utils=require(_0xc1a1('0x4'));var db=require(_0xc1a1('0x5'))['db'];var APIBadRequestError=require(_0xc1a1('0x6'))[_0xc1a1('0x7')];var APIHandleError=require(_0xc1a1('0x6'))[_0xc1a1('0x8')];function respondWithFilteredResult(_0x3367b3,_0x7cdc9d){return function(_0x1b9053){if(_0x1b9053){var _0x5e2f35=typeof _0x7cdc9d[_0xc1a1('0x9')]===_0xc1a1('0xa')&&typeof _0x7cdc9d[_0xc1a1('0xb')]===_0xc1a1('0xa');var _0x86fdc0=_0x1b9053[_0xc1a1('0xc')];var _0x967e1f=_0x5e2f35?0x0:_0x7cdc9d[_0xc1a1('0x9')];var _0x2ec0a9=_0x5e2f35?_0x1b9053[_0xc1a1('0xc')]:_0x7cdc9d['offset']+_0x7cdc9d[_0xc1a1('0xb')];var _0x1af224;if(_0x2ec0a9>=_0x86fdc0){_0x2ec0a9=_0x86fdc0;_0x1af224=0xc8;}else{_0x1af224=0xce;}_0x3367b3[_0xc1a1('0xd')](_0x1af224);return _0x3367b3[_0xc1a1('0xe')]('Content-Range',_0x967e1f+'-'+_0x2ec0a9+'/'+_0x86fdc0)[_0xc1a1('0xf')](_0x1b9053);}return null;};}exports[_0xc1a1('0x10')]=function(_0x2a3fd0,_0x36012d){var _0x36da54={'count':0x0,'rows':[]};var _0x1b8a2e={};var _0x35323a;var _0x7540b9=utils[_0xc1a1('0x11')]();var _0xadb401;var _0x530694;var _0x39ae16=_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x13')];var _0x104bf8=_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x14')];var _0x436a3a=_0x2a3fd0['query'][_0xc1a1('0x15')];var _0x302d33=_0x104bf8==='pause'||_0x104bf8==='*pause'?!![]:![];var _0x1d8f7c=[];var _0x51b532;var _0x5e4b36;Promise['resolve']()[_0xc1a1('0x16')](function(){if(_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x17')]){if(!utils['isValidChannel'](_0x2a3fd0[_0xc1a1('0x12')]['channel'])){throw new APIBadRequestError(util[_0xc1a1('0x18')](_0xc1a1('0x19'),_0x2a3fd0['query'][_0xc1a1('0x17')]));}_0x35323a=_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x17')][_0xc1a1('0x1a')]();}if(!_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1b')]||!_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1b')][_0xc1a1('0x1c')](_0xc1a1('0x1d'))){_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1b')]=rta[_0xc1a1('0x1e')](_0x2a3fd0['query']['sort']);return;}var _0x225c2c=rta['getUpdatedSortOptions'](_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1b')]);_0x2a3fd0['query']['sort']=_0x225c2c[_0xc1a1('0x1f')][_0xc1a1('0x20')](',');_0x51b532=_0x225c2c[_0xc1a1('0x21')];})['then'](function(){if(!_0x39ae16){return[];}return rta['getAgentIdsByQueues'](_0x39ae16,_0x35323a);})['then'](function(_0x45ec1a){_0x1d8f7c=_0x45ec1a;return rta[_0xc1a1('0x22')]();})[_0xc1a1('0x16')](function(_0x39a31f){_0x530694=_0x39a31f['rows'];if((!_0x104bf8||_0x302d33)&&!_0x51b532){return _0x1d8f7c;}if(_0x51b532&&!_0x104bf8){return rta[_0xc1a1('0x23')](_0x530694,_0x1d8f7c,_0x51b532);}else{return rta[_0xc1a1('0x24')](_0x530694,_0x1d8f7c,_0x104bf8);}})['then'](function(_0x4ffe0a){_0x1d8f7c=_0x4ffe0a;var _0x326e87=![];if(_0x1d8f7c[_0xc1a1('0x25')]===0x0){if(_0x39ae16||_0x104bf8){_0x326e87=!![];}if(_0x302d33){_0x326e87=![];}}if(_0x326e87){return _0x36da54;}var _0x58565b=_[_0xc1a1('0x26')](db['User'][_0xc1a1('0x27')],function(_0x3bab0d){return{'name':_0x3bab0d[_0xc1a1('0x28')],'type':_0x3bab0d[_0xc1a1('0x29')][_0xc1a1('0x2a')]};});_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x2b')]=_0xc1a1('0x2c');_0x2a3fd0[_0xc1a1('0x12')]['online']=!![];_0x1b8a2e=qs[_0xc1a1('0x2d')](_0x58565b,_0x2a3fd0);_0x1b8a2e[_0xc1a1('0x2e')]=!![];var _0x39cb89=[];if(_0x1d8f7c[_0xc1a1('0x25')]>0x0){_0x39cb89['push']({'id':{'$in':_0x1d8f7c}});if(_0x51b532&&!_0x104bf8){_0x5e4b36=[db['sequelize']['literal']('FIELD(id,'+_0x1d8f7c+')')];_0x1b8a2e[_0xc1a1('0x21')]=_0x5e4b36;}}if(_0x302d33){_0x7540b9[_0xc1a1('0x2f')](function(_0x1a5001){var _0x5665f5=!![];if(_0x104bf8===_0xc1a1('0x30')&&_0x35323a!==_0x1a5001){_0x5665f5=![];}_0x39cb89[_0xc1a1('0x31')]({[_0x1a5001+_0xc1a1('0x32')]:_0x5665f5});});if(_0x436a3a){_0x39cb89['push']({'pauseType':_0x436a3a});}}else if(_0x104bf8){_0x7540b9[_0xc1a1('0x2f')](function(_0x4d4525){_0x39cb89[_0xc1a1('0x31')]({[_0x4d4525+'Pause']:![]});});}_0x1b8a2e['where']=_[_0xc1a1('0x33')](_0x1b8a2e[_0xc1a1('0x34')],{'$and':_0x39cb89});if(_0x2a3fd0[_0xc1a1('0x35')][_0xc1a1('0x2b')]===_0xc1a1('0x35')){var _0x19ba1c={'params':{'id':_0x2a3fd0[_0xc1a1('0x35')][_0xc1a1('0x36')]},'query':{'section':_0xc1a1('0x37'),'role':_0xc1a1('0x2c'),'online':!![],'raw':!![],'ids':_0x1d8f7c,'customSorting':_0x5e4b36}};if(_0x302d33){_0x19ba1c[_0xc1a1('0x12')][_0xc1a1('0x38')]=_0x39cb89;}_0x19ba1c[_0xc1a1('0x12')]=Object[_0xc1a1('0x39')](_0x19ba1c[_0xc1a1('0x12')],_0x2a3fd0[_0xc1a1('0x12')]);delete _0x19ba1c['query']['id'];return db[_0xc1a1('0x3a')]['getResources'](_0x19ba1c);}return db[_0xc1a1('0x3b')][_0xc1a1('0x3c')](_0x1b8a2e);})['then'](function(_0x498ff1){_0x36da54[_0xc1a1('0xc')]=_0x498ff1[_0xc1a1('0xc')];_0xadb401=_0x498ff1[_0xc1a1('0x3d')];return _0xadb401[_0xc1a1('0x26')](function(_0x3b1543){var _0x2f44ee=_[_0xc1a1('0x3e')](_0x530694,['id',_0x3b1543['id']]);if(_0x2f44ee){var _0x3becaa=rta[_0xc1a1('0x3f')](_0x2f44ee);_[_0xc1a1('0x33')](_0x3b1543,_0x3becaa);}_0x3b1543[_0xc1a1('0x1d')]=rta[_0xc1a1('0x40')](_0x3b1543);if(_0x3b1543[_0xc1a1('0x1d')]['includes']('pause')){_0x7540b9[_0xc1a1('0x2f')](function(_0x55b110){if(_0x3b1543[_0x55b110+_0xc1a1('0x32')]){_0x3b1543[_0x55b110+_0xc1a1('0x41')]=_0xc1a1('0x42');}});}return _0x3b1543;});})[_0xc1a1('0x16')](function(_0x446809){if(!_0x51b532||_0x5e4b36){return _0x446809;}return rta[_0xc1a1('0x43')](_0x446809,_0x51b532);})[_0xc1a1('0x16')](function(_0x5156ac){var _0x11fe72=null;if(_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1f')]){var _0x130ca5=_0x2a3fd0[_0xc1a1('0x12')][_0xc1a1('0x1f')]['split'](',');_0x11fe72=_0x5156ac[_0xc1a1('0x26')](function(_0x347e9e){return _[_0xc1a1('0x44')](_0x347e9e,_0x130ca5);});}_0x36da54['rows']=_0x11fe72||_0x5156ac;return _0x36da54;})[_0xc1a1('0x16')](respondWithFilteredResult(_0x36012d,_0x1b8a2e))['catch'](APIHandleError(_0x36012d));};exports[_0xc1a1('0x45')]=function(_0x488f9d,_0x2227cd){var _0x2f34e3={'count':0x0,'rows':[]};var _0x1c0309={};var _0x1d7149;var _0x532054;var _0x18b5a9;Promise['resolve']()[_0xc1a1('0x16')](function(){if(_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x17')]){if(!utils[_0xc1a1('0x46')](_0x488f9d[_0xc1a1('0x12')]['channel'])){throw new APIBadRequestError(util[_0xc1a1('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x488f9d[_0xc1a1('0x12')]['channel']));}_0x1d7149=_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x17')][_0xc1a1('0x1a')]();}var _0x128731=_[_0xc1a1('0x47')](_0x1d7149)+'Queue';var _0x4e3fab=_['map'](db[_0x128731][_0xc1a1('0x27')],function(_0xd9d003){return{'name':_0xd9d003[_0xc1a1('0x28')],'type':_0xd9d003[_0xc1a1('0x29')]['key']};});if(!_0x488f9d[_0xc1a1('0x12')]['fields']){var _0x3c37ec=['id',_0xc1a1('0x48')];if(_0x1d7149===_0xc1a1('0x49')){_0x3c37ec['push']('type');if(_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x29')]==='outbound'){_0x3c37ec[_0xc1a1('0x31')]([_0xc1a1('0x4a'),_0xc1a1('0x4b')]);}}_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x1f')]=_0x3c37ec[_0xc1a1('0x20')](',');}_0x1c0309=qs[_0xc1a1('0x2d')](_0x4e3fab,_0x488f9d);if(_0x488f9d[_0xc1a1('0x35')][_0xc1a1('0x2b')]==='user'){var _0x27cf13={'params':{'id':_0x488f9d[_0xc1a1('0x35')][_0xc1a1('0x36')]},'query':{'section':_0x1d7149===_0xc1a1('0x49')&&_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x29')]===_0xc1a1('0x4c')?_0xc1a1('0x4d'):_[_0xc1a1('0x47')](_0x1d7149)+_0xc1a1('0x4e'),'type':_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x29')],'nolimit':!![],'sort':_0xc1a1('0x48'),'filter':_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x4f')]}};return db[_0xc1a1('0x3a')][_0xc1a1('0x50')](_0x27cf13);}return db[_0x128731][_0xc1a1('0x3c')](_0x1c0309);})[_0xc1a1('0x16')](function(_0x84f900){_0x2f34e3['count']=_0x84f900[_0xc1a1('0xc')];_0x532054=_0x84f900[_0xc1a1('0x3d')];return rtq[_0xc1a1('0x51')](_0x488f9d,_0x1d7149);})['then'](function(_0x360af5){_0x18b5a9=_0x360af5[_0xc1a1('0x3d')];return rtq[_0xc1a1('0x52')](_0x532054,_0x18b5a9,_0x1d7149,_0x488f9d[_0xc1a1('0x12')][_0xc1a1('0x29')]);})[_0xc1a1('0x16')](function(_0x4bb003){_0x2f34e3[_0xc1a1('0x3d')]=_0x4bb003;return _0x2f34e3;})['then'](respondWithFilteredResult(_0x2227cd,_0x1c0309))[_0xc1a1('0x53')](APIHandleError(_0x2227cd));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 77552c5..2a1731a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x73265d,_0xb7bad2){var _0x1b1879=function(_0x5e9975){while(--_0x5e9975){_0x73265d['push'](_0x73265d['shift']());}};_0x1b1879(++_0xb7bad2);}(_0xedd9,0xfc));var _0x9edd=function(_0x1eb775,_0x2df8c9){_0x1eb775=_0x1eb775-0x0;var _0x5e0dd8=_0xedd9[_0x1eb775];return _0x5e0dd8;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 93709c5..f8a4ac0 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 _0xee4a=['STRING','DATE','sequelize','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xee4a,0x9e));var _0xaee4=function(_0x49544f,_0x591c82){_0x49544f=_0x49544f-0x0;var _0x35448f=_0xee4a[_0x49544f];return _0x35448f;};'use strict';var Sequelize=require(_0xaee4('0x0'));module['exports']={'state':{'type':Sequelize[_0xaee4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaee4('0x2')]},'scheduledat':{'type':Sequelize[_0xaee4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaee4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xaee4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xaee4('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0734=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0x0734,0xba));var _0x4073=function(_0x1bb345,_0x4266f6){_0x1bb345=_0x1bb345-0x0;var _0x1d82e8=_0x0734[_0x1bb345];return _0x1d82e8;};'use strict';var Sequelize=require(_0x4073('0x0'));module[_0x4073('0x1')]={'state':{'type':Sequelize[_0x4073('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4073('0x3')]},'scheduledat':{'type':Sequelize[_0x4073('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4073('0x4')]},'responsetime':{'type':Sequelize[_0x4073('0x4')]},'ringtime':{'type':Sequelize[_0x4073('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4073('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 88f01f5..eae8df9 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 _0xccac=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','api','path'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xccac,0x75));var _0xccca=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0xccac[_0x5bd4f6];return _0x33a165;};'use strict';var _=require(_0xccca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xccca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xccca('0x2'));var rimraf=require(_0xccca('0x3'));var config=require(_0xccca('0x4'));var attributes=require(_0xccca('0x5'));module[_0xccca('0x6')]=function(_0x2c4f4f,_0x4e9baf){return _0x2c4f4f[_0xccca('0x7')](_0xccca('0x8'),attributes,{'tableName':_0xccca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x209b=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','bluebird','path'];(function(_0x55f4b8,_0x3489a0){var _0x4ea0ab=function(_0x52cf33){while(--_0x52cf33){_0x55f4b8['push'](_0x55f4b8['shift']());}};_0x4ea0ab(++_0x3489a0);}(_0x209b,0x96));var _0xb209=function(_0x1cf600,_0x5445d0){_0x1cf600=_0x1cf600-0x0;var _0x2a474c=_0x209b[_0x1cf600];return _0x2a474c;};'use strict';var _=require(_0xb209('0x0'));var util=require(_0xb209('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb209('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb209('0x3'));var rimraf=require(_0xb209('0x4'));var config=require(_0xb209('0x5'));var attributes=require(_0xb209('0x6'));module[_0xb209('0x7')]=function(_0x4c439a,_0x30074a){return _0x4c439a[_0xb209('0x8')](_0xb209('0x9'),attributes,{'tableName':_0xb209('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 4349cdc..693044a 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 _0xe48f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','moment'];(function(_0x3848da,_0x32f1a3){var _0x3573ce=function(_0x15ecd9){while(--_0x15ecd9){_0x3848da['push'](_0x3848da['shift']());}};_0x3573ce(++_0x32f1a3);}(_0xe48f,0x1ca));var _0xfe48=function(_0x15e17c,_0x39f6c8){_0x15e17c=_0x15e17c-0x0;var _0x55d8c7=_0xe48f[_0x15e17c];return _0x55d8c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfe48('0x0'));var BPromise=require(_0xfe48('0x1'));var rs=require(_0xfe48('0x2'));var fs=require('fs');var Redis=require(_0xfe48('0x3'));var db=require(_0xfe48('0x4'))['db'];var utils=require(_0xfe48('0x5'));var logger=require(_0xfe48('0x6'))(_0xfe48('0x7'));var config=require(_0xfe48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe48('0x9')][_0xfe48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x129447,_0x2928e0,_0x88c426){return new BPromise(function(_0x1d717b,_0x227e60){return client[_0xfe48('0xb')](_0x129447,_0x88c426)[_0xfe48('0xc')](function(_0x58a784){logger['info'](_0xfe48('0xd'),_0x2928e0,_0xfe48('0xe'));logger[_0xfe48('0xf')](_0xfe48('0x10'),_0x2928e0,_0xfe48('0xe'),JSON[_0xfe48('0x11')](_0x58a784));if(_0x58a784[_0xfe48('0x12')]){if(_0x58a784[_0xfe48('0x12')][_0xfe48('0x13')]===0x1f4){logger[_0xfe48('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2928e0,_0x58a784['error']['message']);return _0x227e60(_0x58a784['error'][_0xfe48('0x14')]);}logger[_0xfe48('0x12')](_0xfe48('0xd'),_0x2928e0,_0x58a784[_0xfe48('0x12')][_0xfe48('0x14')]);return _0x1d717b(_0x58a784[_0xfe48('0x12')][_0xfe48('0x14')]);}else{logger[_0xfe48('0x15')](_0xfe48('0xd'),_0x2928e0,'request\x20sent');_0x1d717b(_0x58a784['result'][_0xfe48('0x14')]);}})[_0xfe48('0x16')](function(_0x174fb2){logger[_0xfe48('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2928e0,_0x174fb2);_0x227e60(_0x174fb2);});});}exports[_0xfe48('0x17')]=function(_0x204a4e){var _0x196f3e=this;return new Promise(function(_0x4fab29,_0x508fce){return db[_0xfe48('0x18')]['create'](_0x204a4e[_0xfe48('0x19')],{'raw':_0x204a4e[_0xfe48('0x1a')]?_0x204a4e[_0xfe48('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x560302){logger[_0xfe48('0x15')](_0xfe48('0x17'),_0x204a4e);logger[_0xfe48('0xf')](_0xfe48('0x17'),_0x204a4e,JSON[_0xfe48('0x11')](_0x560302));_0x4fab29(_0x560302);})[_0xfe48('0x16')](function(_0x2b1a21){logger[_0xfe48('0x12')]('CreateReportAgentPreview',_0x2b1a21[_0xfe48('0x14')],_0x204a4e);_0x508fce(_0x196f3e[_0xfe48('0x12')](0x1f4,_0x2b1a21[_0xfe48('0x14')]));});});}; \ No newline at end of file +var _0xc04a=['CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch'];(function(_0x2de667,_0xd0668a){var _0x16a11d=function(_0x45684d){while(--_0x45684d){_0x2de667['push'](_0x2de667['shift']());}};_0x16a11d(++_0xd0668a);}(_0xc04a,0x91));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac04('0x0'));var util=require(_0xac04('0x1'));var moment=require(_0xac04('0x2'));var BPromise=require(_0xac04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac04('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac04('0x5'))(_0xac04('0x6'));var config=require('../../config/environment');var jayson=require(_0xac04('0x7'));var client=jayson[_0xac04('0x8')][_0xac04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18ea97,_0x14c3d0,_0x5e137e){return new BPromise(function(_0xef5e40,_0x23d0f1){return client[_0xac04('0xa')](_0x18ea97,_0x5e137e)[_0xac04('0xb')](function(_0x518da9){logger[_0xac04('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x14c3d0,_0xac04('0xd'));logger[_0xac04('0xe')](_0xac04('0xf'),_0x14c3d0,_0xac04('0xd'),JSON[_0xac04('0x10')](_0x518da9));if(_0x518da9['error']){if(_0x518da9['error'][_0xac04('0x11')]===0x1f4){logger[_0xac04('0x12')](_0xac04('0x13'),_0x14c3d0,_0x518da9[_0xac04('0x12')][_0xac04('0x14')]);return _0x23d0f1(_0x518da9[_0xac04('0x12')][_0xac04('0x14')]);}logger[_0xac04('0x12')](_0xac04('0x13'),_0x14c3d0,_0x518da9[_0xac04('0x12')][_0xac04('0x14')]);return _0xef5e40(_0x518da9[_0xac04('0x12')][_0xac04('0x14')]);}else{logger[_0xac04('0xc')](_0xac04('0x13'),_0x14c3d0,_0xac04('0xd'));_0xef5e40(_0x518da9[_0xac04('0x15')][_0xac04('0x14')]);}})[_0xac04('0x16')](function(_0x4a1980){logger[_0xac04('0x12')](_0xac04('0x13'),_0x14c3d0,_0x4a1980);_0x23d0f1(_0x4a1980);});});}exports[_0xac04('0x17')]=function(_0x5b4275){var _0x5c3639=this;return new Promise(function(_0x25e744,_0x3fdff5){return db[_0xac04('0x18')][_0xac04('0x19')](_0x5b4275['body'],{'raw':_0x5b4275[_0xac04('0x1a')]?_0x5b4275['options'][_0xac04('0x1b')]===undefined?!![]:![]:!![]})[_0xac04('0xb')](function(_0x5190bf){logger['info']('CreateReportAgentPreview',_0x5b4275);logger['debug'](_0xac04('0x17'),_0x5b4275,JSON[_0xac04('0x10')](_0x5190bf));_0x25e744(_0x5190bf);})[_0xac04('0x16')](function(_0x5b9a93){logger[_0xac04('0x12')](_0xac04('0x17'),_0x5b9a93[_0xac04('0x14')],_0x5b4275);_0x3fdff5(_0x5c3639[_0xac04('0x12')](0x1f4,_0x5b9a93[_0xac04('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c41e865..7ca267f 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 _0xfff5=['/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x3c6108,_0x393228){var _0x2fcdc5=function(_0x1a5c02){while(--_0x1a5c02){_0x3c6108['push'](_0x3c6108['shift']());}};_0x2fcdc5(++_0x393228);}(_0xfff5,0xd5));var _0x5fff=function(_0x5a4dd4,_0x463991){_0x5a4dd4=_0x5a4dd4-0x0;var _0x2c9c2d=_0xfff5[_0x5a4dd4];return _0x2c9c2d;};'use strict';var multer=require(_0x5fff('0x0'));var util=require(_0x5fff('0x1'));var path=require('path');var express=require(_0x5fff('0x2'));var router=express[_0x5fff('0x3')]();var auth=require(_0x5fff('0x4'));var controller=require(_0x5fff('0x5'));router[_0x5fff('0x6')](_0x5fff('0x7'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x9')]);router['get'](_0x5fff('0xa'),auth[_0x5fff('0x8')](),controller[_0x5fff('0xb')]);router[_0x5fff('0x6')](_0x5fff('0xc'),auth[_0x5fff('0x8')](),controller[_0x5fff('0xd')]);router[_0x5fff('0x6')]('/voice/queues',auth[_0x5fff('0x8')](),controller[_0x5fff('0xe')]);router[_0x5fff('0x6')]('/chat/queues',auth[_0x5fff('0x8')](),controller[_0x5fff('0xf')]);router[_0x5fff('0x6')](_0x5fff('0x10'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x11')]);router[_0x5fff('0x6')]('/mail/accounts',auth[_0x5fff('0x8')](),controller[_0x5fff('0x12')]);router['get'](_0x5fff('0x13'),auth['isAuthenticated'](),controller[_0x5fff('0x14')]);router[_0x5fff('0x6')](_0x5fff('0x15'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x16')]);router['get'](_0x5fff('0x17'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x18')]);router[_0x5fff('0x6')](_0x5fff('0x19'),auth['isAuthenticated'](),controller[_0x5fff('0x1a')]);router[_0x5fff('0x6')](_0x5fff('0x1b'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x1c')]);router[_0x5fff('0x6')]('/voice/queues/channels',auth[_0x5fff('0x8')](),controller[_0x5fff('0x1d')]);router[_0x5fff('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x5fff('0x8')](),controller['voiceQueuesChannel']);router[_0x5fff('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x5fff('0x1e')]);router[_0x5fff('0x6')](_0x5fff('0x1f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x20')]);router[_0x5fff('0x6')](_0x5fff('0x21'),auth['isAuthenticated'](),controller[_0x5fff('0x22')]);router['put'](_0x5fff('0x21'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x23')]);router[_0x5fff('0x6')](_0x5fff('0x24'),auth[_0x5fff('0x8')](),controller['outbound']);router['get']('/outbound/channels',auth['isAuthenticated'](),controller[_0x5fff('0x25')]);router['get'](_0x5fff('0x26'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x27')]);router[_0x5fff('0x28')](_0x5fff('0x29'),auth['isAuthenticated'](),controller['agentCapacity']);router['get']('/telephones',auth[_0x5fff('0x8')](),controller[_0x5fff('0x2a')]);router['get'](_0x5fff('0x2b'),auth[_0x5fff('0x8')](),controller['trunks']);router[_0x5fff('0x6')](_0x5fff('0x2c'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x5fff('0x2e')]);router['get'](_0x5fff('0x2f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x30')]);router['get'](_0x5fff('0x31'),auth[_0x5fff('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x5fff('0x6')](_0x5fff('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x5fff('0x8')](),controller[_0x5fff('0x33')]);router[_0x5fff('0x6')](_0x5fff('0x34'),auth['isAuthenticated'](),controller[_0x5fff('0x35')]);router[_0x5fff('0x6')](_0x5fff('0x36'),auth['isAuthenticated'](),controller[_0x5fff('0x37')]);router[_0x5fff('0x6')](_0x5fff('0x38'),auth[_0x5fff('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x5fff('0x39')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x5fff('0x3a')]('mail'));router[_0x5fff('0x6')](_0x5fff('0x3b'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x3c')]);router[_0x5fff('0x39')]('/chat/queues/:id/notify',auth[_0x5fff('0x8')](),controller[_0x5fff('0x3a')](_0x5fff('0x3d')));router[_0x5fff('0x6')](_0x5fff('0x3e'),auth[_0x5fff('0x8')](),controller['showChatQueues']);router[_0x5fff('0x39')](_0x5fff('0x3f'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x3a')](_0x5fff('0x40')));router[_0x5fff('0x6')](_0x5fff('0x41'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x42')]);router[_0x5fff('0x39')](_0x5fff('0x43'),auth['isAuthenticated'](),controller[_0x5fff('0x3a')](_0x5fff('0x44')));router['get']('/openchannel/queues/:id',auth[_0x5fff('0x8')](),controller[_0x5fff('0x45')]);router[_0x5fff('0x39')](_0x5fff('0x46'),auth[_0x5fff('0x8')](),controller['queueNotify'](_0x5fff('0x47')));router[_0x5fff('0x39')](_0x5fff('0x48'),auth['isAuthenticated'](),controller[_0x5fff('0x3a')]('whatsapp'));router['get'](_0x5fff('0x49'),auth[_0x5fff('0x8')](),controller[_0x5fff('0x4a')]);router[_0x5fff('0x6')]('/whatsapp/queues/:id',auth[_0x5fff('0x8')](),controller[_0x5fff('0x4b')]);router[_0x5fff('0x39')](_0x5fff('0x4c'),auth[_0x5fff('0x8')](),controller['agentNotify']);module[_0x5fff('0x4d')]=router; \ No newline at end of file +var _0x9dc8=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel'];(function(_0x3581dd,_0x2104be){var _0x537064=function(_0x54efcb){while(--_0x54efcb){_0x3581dd['push'](_0x3581dd['shift']());}};_0x537064(++_0x2104be);}(_0x9dc8,0x135));var _0x89dc=function(_0x48fe5f,_0x2357e2){_0x48fe5f=_0x48fe5f-0x0;var _0x4dc972=_0x9dc8[_0x48fe5f];return _0x4dc972;};'use strict';var multer=require(_0x89dc('0x0'));var util=require(_0x89dc('0x1'));var path=require(_0x89dc('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x89dc('0x3'));router[_0x89dc('0x4')](_0x89dc('0x5'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x7')]);router[_0x89dc('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x89dc('0x4')](_0x89dc('0x8'),auth['isAuthenticated'](),controller[_0x89dc('0x9')]);router['get']('/voice/queues',auth[_0x89dc('0x6')](),controller[_0x89dc('0xa')]);router['get'](_0x89dc('0xb'),auth[_0x89dc('0x6')](),controller[_0x89dc('0xc')]);router[_0x89dc('0x4')](_0x89dc('0xd'),auth['isAuthenticated'](),controller[_0x89dc('0xe')]);router[_0x89dc('0x4')](_0x89dc('0xf'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x10')]);router[_0x89dc('0x4')](_0x89dc('0x11'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x12')]);router['get']('/sms/queues',auth[_0x89dc('0x6')](),controller[_0x89dc('0x13')]);router[_0x89dc('0x4')](_0x89dc('0x14'),auth['isAuthenticated'](),controller[_0x89dc('0x15')]);router[_0x89dc('0x4')](_0x89dc('0x16'),auth[_0x89dc('0x6')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0x89dc('0x6')](),controller[_0x89dc('0x17')]);router[_0x89dc('0x4')](_0x89dc('0x18'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x19')]);router[_0x89dc('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x89dc('0x6')](),controller[_0x89dc('0x1a')]);router[_0x89dc('0x4')](_0x89dc('0x1b'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x1c')]);router[_0x89dc('0x4')](_0x89dc('0x1d'),auth['isAuthenticated'](),controller[_0x89dc('0x1e')]);router[_0x89dc('0x4')](_0x89dc('0x1f'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x20')]);router[_0x89dc('0x21')]('/voice/queues/:id',auth[_0x89dc('0x6')](),controller[_0x89dc('0x22')]);router['get'](_0x89dc('0x23'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x24')]);router[_0x89dc('0x4')]('/outbound/channels',auth[_0x89dc('0x6')](),controller[_0x89dc('0x25')]);router[_0x89dc('0x4')]('/agents',auth[_0x89dc('0x6')](),controller[_0x89dc('0x26')]);router[_0x89dc('0x21')](_0x89dc('0x27'),auth[_0x89dc('0x6')](),controller['agentCapacity']);router[_0x89dc('0x4')]('/telephones',auth[_0x89dc('0x6')](),controller[_0x89dc('0x28')]);router[_0x89dc('0x4')]('/trunks',auth[_0x89dc('0x6')](),controller[_0x89dc('0x29')]);router['get'](_0x89dc('0x2a'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x2b')]);router[_0x89dc('0x4')](_0x89dc('0x2c'),auth['isAuthenticated'](),controller[_0x89dc('0x2d')]);router[_0x89dc('0x4')](_0x89dc('0x2e'),auth[_0x89dc('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x89dc('0x4')](_0x89dc('0x2f'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x30')]);router['get'](_0x89dc('0x31'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x32')]);router[_0x89dc('0x4')](_0x89dc('0x33'),auth['isAuthenticated'](),controller[_0x89dc('0x34')]);router[_0x89dc('0x4')]('/sms/queues/waitinginteractions',auth[_0x89dc('0x6')](),controller[_0x89dc('0x35')]);router[_0x89dc('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x89dc('0x6')](),controller[_0x89dc('0x36')]);router['get'](_0x89dc('0x37'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x38')]);router[_0x89dc('0x39')](_0x89dc('0x3a'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x3b')](_0x89dc('0x3c')));router[_0x89dc('0x4')](_0x89dc('0x3d'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x3e')]);router[_0x89dc('0x39')](_0x89dc('0x3f'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x3b')](_0x89dc('0x40')));router[_0x89dc('0x4')](_0x89dc('0x41'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x42')]);router['post'](_0x89dc('0x43'),auth['isAuthenticated'](),controller[_0x89dc('0x3b')](_0x89dc('0x44')));router[_0x89dc('0x4')](_0x89dc('0x45'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x89dc('0x39')](_0x89dc('0x46'),auth[_0x89dc('0x6')](),controller['queueNotify'](_0x89dc('0x47')));router['get'](_0x89dc('0x48'),auth[_0x89dc('0x6')](),controller['showOpenchannelQueues']);router[_0x89dc('0x39')](_0x89dc('0x49'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x3b')](_0x89dc('0x4a')));router[_0x89dc('0x39')](_0x89dc('0x4b'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x3b')](_0x89dc('0x4c')));router[_0x89dc('0x4')](_0x89dc('0x4d'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x4e')]);router[_0x89dc('0x4')](_0x89dc('0x4f'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x50')]);router[_0x89dc('0x39')](_0x89dc('0x51'),auth[_0x89dc('0x6')](),controller[_0x89dc('0x52')]);module[_0x89dc('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7ce3ad1..e9f15b4 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 _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x44e81b,_0x5251f6){var _0x2d5f8e=function(_0x584f8b){while(--_0x584f8b){_0x44e81b['push'](_0x44e81b['shift']());}};_0x2d5f8e(++_0x5251f6);}(_0x24ca,0x1bc));var _0xa24c=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x24ca[_0x398294];return _0x2a872d;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file +var _0xe14b=['MessageId','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Website','User','agent','Agent\x20not\x20found','Message','update','From','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found'];(function(_0x364808,_0x4b1e0d){var _0x249c3a=function(_0x61fb88){while(--_0x61fb88){_0x364808['push'](_0x364808['shift']());}};_0x249c3a(++_0x4b1e0d);}(_0xe14b,0x93));var _0xbe14=function(_0xdfa3b2,_0x5271ec){_0xdfa3b2=_0xdfa3b2-0x0;var _0x410477=_0xe14b[_0xdfa3b2];return _0x410477;};'use strict';var BPromise=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xbe14('0x2'))['db'];var logger=require(_0xbe14('0x3'))('api');var jayson=require(_0xbe14('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232b});var routingClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){var _0x496063=_0x196fca?_0x196fca:amiClient;return _0x496063[_0xbe14('0x7')](_0x1d9ade,_0x39387e)[_0xbe14('0x8')](function(_0xd68cd7){if(_0xd68cd7[_0xbe14('0x9')]){if(_0xd68cd7['error']['code']===0x1f4){return _0x50f909(_0xd68cd7[_0xbe14('0x9')][_0xbe14('0xa')]);}return _0x566ae7(_0xd68cd7['error'][_0xbe14('0xa')]);}else{_0x566ae7(_0xd68cd7[_0xbe14('0xb')]);}})[_0xbe14('0xc')](function(_0x3d38c2){_0x50f909(_0x3d38c2);});});}function respondWithResult(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xc8;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0xd')](_0x3b898d)[_0xbe14('0xe')](_0x23a730);}return _0x27792f[_0xbe14('0xf')](0x194);};}function handleError(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0x1f4;return function(_0x813399){logger['error'](_0x813399['stack']);if(_0x813399[_0xbe14('0x10')]){delete _0x813399[_0xbe14('0x10')];}_0x1e4826[_0xbe14('0xd')](_0x33fd54)[_0xbe14('0x11')](_0x813399);};}function findById(_0x4e8f34){return function(_0x21c789){if(!_[_0xbe14('0x12')](_0x4e8f34)&&!_[_0xbe14('0x12')](_0x21c789)&&!_[_0xbe14('0x12')](_0x21c789[_0xbe14('0x13')])){return _[_0xbe14('0x14')](_0x21c789[_0xbe14('0x13')],function(_0x5ea1f8){return _0x5ea1f8['id']==_0x4e8f34;});}return null;};}exports[_0xbe14('0x15')]=function(_0x456ca8,_0x329588){return respondWithRpcPromise(_0xbe14('0x16'),_0x456ca8[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x329588,null))['catch'](handleError(_0x329588,null));};exports[_0xbe14('0x18')]=function(_0x4a1bbd,_0x417c8d){return respondWithRpcPromise(_0xbe14('0x19'),_[_0xbe14('0x1a')](_0x4a1bbd['query'],_0x4a1bbd[_0xbe14('0x1b')]))['then'](respondWithResult(_0x417c8d,null))[_0xbe14('0xc')](handleError(_0x417c8d,null));};exports['voiceChannelStopMixMonitor']=function(_0x32e8eb,_0x4a25fa){return respondWithRpcPromise(_0xbe14('0x1c'),_[_0xbe14('0x1a')](_0x32e8eb['query'],_0x32e8eb[_0xbe14('0x1b')]))['then'](respondWithResult(_0x4a25fa,null))[_0xbe14('0xc')](handleError(_0x4a25fa,null));};exports['voiceQueues']=function(_0x36a21e,_0x5fa043){return respondWithRpcPromise(_0xbe14('0x1d'),_0x36a21e[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x5fa043,null))[_0xbe14('0xc')](handleError(_0x5fa043,null));};exports['showVoiceQueues']=function(_0x1822e0,_0x1ba46a){return respondWithRpcPromise(_0xbe14('0x1d'),_0x1822e0[_0xbe14('0x17')])['then'](findById(_0x1822e0[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x1ba46a,null))['catch'](handleError(_0x1ba46a,null));};exports[_0xbe14('0x1e')]=function(_0x3b3e84,_0x1c7cc7){return respondWithRpcPromise(_0xbe14('0x1f'),_[_0xbe14('0x1a')](_0x3b3e84[_0xbe14('0x20')],_0x3b3e84[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x1c7cc7,null))[_0xbe14('0xc')](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x21')]=function(_0x40538f,_0x3bf43c){return respondWithRpcPromise(_0xbe14('0x22'),_[_0xbe14('0x1a')](_0x40538f[_0xbe14('0x17')],_0x40538f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x3bf43c,null))[_0xbe14('0xc')](handleError(_0x3bf43c,null));};exports[_0xbe14('0x23')]=function(_0x14e7c4,_0x581e86){return respondWithRpcPromise(_0xbe14('0x24'),_0x14e7c4['query'])['then'](respondWithResult(_0x581e86,null))[_0xbe14('0xc')](handleError(_0x581e86,null));};exports['voiceQueuesChannel']=function(_0x243524,_0x345b0){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x243524['query'],_0x243524[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x345b0,null))['catch'](handleError(_0x345b0,null));};exports[_0xbe14('0x25')]=function(_0x1faf3e,_0x452635){return respondWithRpcPromise(_0xbe14('0x26'),_[_0xbe14('0x1a')](_0x1faf3e['query'],_0x1faf3e['params']))[_0xbe14('0x8')](respondWithResult(_0x452635,null))['catch'](handleError(_0x452635,null));};exports['voiceQueuesChannelRedirect']=function(_0x5c5e9f,_0x163ef7){return respondWithRpcPromise(_0xbe14('0x27'),_[_0xbe14('0x1a')](_0x5c5e9f[_0xbe14('0x17')],_0x5c5e9f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x163ef7,null))[_0xbe14('0xc')](handleError(_0x163ef7,null));};exports[_0xbe14('0x28')]=function(_0x2d9c12,_0x2dfd5a){return respondWithRpcPromise(_0xbe14('0x29'),_0x2d9c12[_0xbe14('0x17')])['then'](respondWithResult(_0x2dfd5a,null))['catch'](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x2a')]=function(_0x2951e1,_0x13bfcf){return respondWithRpcPromise('OutboundChannels',_0x2951e1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x13bfcf,null))[_0xbe14('0xc')](handleError(_0x13bfcf,null));};exports[_0xbe14('0x2b')]=function(_0x3bd454,_0x25ee1f){var _0x19fa30;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')])['then'](function(_0xe51424){_0x19fa30=_0xe51424;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')],routingClient);})[_0xbe14('0x8')](function(_0x3287b9){return _[_0xbe14('0x1a')]({},_0x3287b9,_0x19fa30);})['then'](respondWithResult(_0x25ee1f,null))[_0xbe14('0xc')](handleError(_0x25ee1f,null));};exports[_0xbe14('0x2d')]=function(_0x1220c9,_0x36263c){if(_0x1220c9['body']&&_0x1220c9['body'][_0xbe14('0x2e')]&&_0x1220c9[_0xbe14('0x2f')]&&_0x1220c9[_0xbe14('0x2f')]['name']){for(var _0x5d5318 in _0x1220c9[_0xbe14('0x20')]['interaction']){if(_0x1220c9['body'][_0xbe14('0x2e')][_0xbe14('0x30')](_0x5d5318)){db[_0xbe14('0x31')]['findAll']({'where':{'channel':_0x5d5318,'membername':_0x1220c9['user']['name'],'type':_0xbe14('0x32'),'exitAt':null,'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]&&_0x1220c9['body'][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')]?{'$notIn':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]}:{'$ne':null}}})['then'](function(_0x4a1a4b){var _0x3e2fd3=moment()[_0xbe14('0x34')](_0xbe14('0x35'));for(var _0xb2b285=0x0,_0x2550dc=_0x4a1a4b['length'];_0xb2b285<_0x2550dc;_0xb2b285+=0x1){_0x4a1a4b[_0xb2b285]['updateAttributes']({'exitAt':_0x3e2fd3});}});for(var _0x46af81=0x0;_0x46af81<_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')];_0x46af81+=0x1){db['MemberReport'][_0xbe14('0x36')]({'where':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'type':_0xbe14('0x32'),'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81],'exitAt':null},'defaults':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'interface':_['isNil'](_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')])?util['format']('SIP/%s',_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x10')]):_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')],'type':_0xbe14('0x32'),'enterAt':moment()[_0xbe14('0x34')](_0xbe14('0x35')),'role':'agent','internal':_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x38')],'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81]}});}}}}return respondWithRpcPromise(_0xbe14('0x39'),{'id':_0x1220c9['params']['id'],'capacity':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x3a')]},routingClient)[_0xbe14('0x8')](respondWithResult(_0x36263c,null))[_0xbe14('0xc')](handleError(_0x36263c,null));};exports[_0xbe14('0x3b')]=function(_0x2dbeb1,_0x505829){return respondWithRpcPromise('Telephones',_0x2dbeb1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x505829,null))[_0xbe14('0xc')](handleError(_0x505829,null));};exports['trunks']=function(_0x497b00,_0x44fe0d){return respondWithRpcPromise(_0xbe14('0x3c'),_0x497b00['query'])[_0xbe14('0x8')](respondWithResult(_0x44fe0d,null))[_0xbe14('0xc')](handleError(_0x44fe0d,null));};exports['campaigns']=function(_0x28f995,_0x4a40d2){return respondWithRpcPromise(_0xbe14('0x3d'),_0x28f995[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x4a40d2,null))['catch'](handleError(_0x4a40d2,null));};exports[_0xbe14('0x3e')]=function(_0x404212,_0x5dc78a){return respondWithRpcPromise(_0xbe14('0x3f'),_0x404212[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x5dc78a,null))[_0xbe14('0xc')](handleError(_0x5dc78a,null));};exports[_0xbe14('0x40')]=function(_0x4f06a3,_0x42a346){return respondWithRpcPromise(_0xbe14('0x3f'),_0x4f06a3[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x4f06a3[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x42a346,null))[_0xbe14('0xc')](handleError(_0x42a346,null));};exports['mailQueues']=function(_0x72c875,_0x1b47a4){return respondWithRpcPromise(_0xbe14('0x41'),_0x72c875[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1b47a4,null))[_0xbe14('0xc')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x42')]=function(_0x32df3c,_0x285b6e){return respondWithRpcPromise(_0xbe14('0x41'),_0x32df3c[_0xbe14('0x17')],routingClient)['then'](findById(_0x32df3c['params']['id']))['then'](respondWithResult(_0x285b6e,null))[_0xbe14('0xc')](handleError(_0x285b6e,null));};exports[_0xbe14('0x43')]=function(_0x2f4e52,_0xf79b21){return respondWithRpcPromise(_0xbe14('0x44'),_0x2f4e52[_0xbe14('0x17')],mailClient)[_0xbe14('0x8')](respondWithResult(_0xf79b21,null))[_0xbe14('0xc')](handleError(_0xf79b21,null));};exports[_0xbe14('0x45')]=function(_0x451b0b,_0x603816){return respondWithRpcPromise(_0xbe14('0x46'),_0x451b0b[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x603816,null))[_0xbe14('0xc')](handleError(_0x603816,null));};exports[_0xbe14('0x47')]=function(_0x179077,_0x2225d9){return respondWithRpcPromise(_0xbe14('0x46'),_0x179077[_0xbe14('0x17')],routingClient)['then'](findById(_0x179077[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x2225d9,null))[_0xbe14('0xc')](handleError(_0x2225d9,null));};exports[_0xbe14('0x48')]=function(_0x3ee6b7,_0x222944){return respondWithRpcPromise(_0xbe14('0x49'),_0x3ee6b7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x222944,null))[_0xbe14('0xc')](handleError(_0x222944,null));};exports['showSmsQueues']=function(_0x18be56,_0x442ec4){return respondWithRpcPromise(_0xbe14('0x49'),_0x18be56[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x18be56['params']['id']))[_0xbe14('0x8')](respondWithResult(_0x442ec4,null))[_0xbe14('0xc')](handleError(_0x442ec4,null));};exports[_0xbe14('0x4a')]=function(_0xd4e1c7,_0x46ac9c){return respondWithRpcPromise('WhatsappQueues',_0xd4e1c7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x46ac9c,null))[_0xbe14('0xc')](handleError(_0x46ac9c,null));};exports[_0xbe14('0x4b')]=function(_0xaebce8,_0x289c4d){return respondWithRpcPromise(_0xbe14('0x4c'),_0xaebce8[_0xbe14('0x17')],routingClient)['then'](findById(_0xaebce8[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x289c4d,null))[_0xbe14('0xc')](handleError(_0x289c4d,null));};exports[_0xbe14('0x4d')]=function(_0x5982b7,_0xa4b2a3){return respondWithRpcPromise(_0xbe14('0x4e'),_0x5982b7['query'],routingClient)['then'](respondWithResult(_0xa4b2a3,null))[_0xbe14('0xc')](handleError(_0xa4b2a3,null));};exports[_0xbe14('0x4f')]=function(_0x2d2643,_0x2510a0){return respondWithRpcPromise(_0xbe14('0x4e'),_0x2d2643[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x2d2643[_0xbe14('0x1b')]['id']))['then'](respondWithResult(_0x2510a0,null))['catch'](handleError(_0x2510a0,null));};exports[_0xbe14('0x50')]=function(_0x1c18b6,_0x29aa52){return respondWithRpcPromise('FaxAccounts',_0x1c18b6[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x29aa52,null))[_0xbe14('0xc')](handleError(_0x29aa52,null));};exports[_0xbe14('0x51')]=function(_0x468e9f,_0x1ef09b){return respondWithRpcPromise(_0xbe14('0x52'),_0x468e9f['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1ef09b,null))[_0xbe14('0xc')](handleError(_0x1ef09b,null));};exports[_0xbe14('0x53')]=function(_0x3afc5a,_0x469555){return respondWithRpcPromise(_0xbe14('0x54'),_0x3afc5a[_0xbe14('0x17')],routingClient)['then'](respondWithResult(_0x469555,null))[_0xbe14('0xc')](handleError(_0x469555,null));};exports[_0xbe14('0x55')]=function(_0x3cd17e,_0x1c0932){return respondWithRpcPromise(_0xbe14('0x56'),_0x3cd17e[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1c0932,null))[_0xbe14('0xc')](handleError(_0x1c0932,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x1e5ce1,_0x401968){return respondWithRpcPromise(_0xbe14('0x56'),_0x1e5ce1[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](function(_0x17576b){if(_0x1e5ce1['query'][_0xbe14('0x57')]!==undefined){var _0x175213=_(_0x17576b[_0xbe14('0x13')])[_0xbe14('0x58')]([_0x1e5ce1['query'][_0xbe14('0x57')],_0x1e5ce1[_0xbe14('0x1b')]['id']])[_0xbe14('0x59')](_0xbe14('0x5a'))[_0xbe14('0x5b')]()[_0xbe14('0x5c')]();return _0x17576b[_0xbe14('0x13')]['filter'](function(_0x70ed08){return _0x175213['indexOf'](_0x70ed08[_0xbe14('0x5a')])>-0x1;});}else{return _0x17576b['rows'][_0xbe14('0x58')](function(_0x21837c){return _0x21837c[_0xbe14('0x5a')]===parseInt(_0x1e5ce1['params']['id']);});}})[_0xbe14('0x8')](respondWithResult(_0x401968,null))[_0xbe14('0xc')](handleError(_0x401968,null));};exports[_0xbe14('0x5d')]=function(_0x546f22,_0x41a896){return respondWithRpcPromise(_0xbe14('0x5e'),_0x546f22[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x41a896,null))['catch'](handleError(_0x41a896,null));};exports[_0xbe14('0x5f')]=function(_0x39bc54,_0x34f90b){return respondWithRpcPromise(_0xbe14('0x60'),_0x39bc54[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x34f90b,null))[_0xbe14('0xc')](handleError(_0x34f90b,null));};exports['faxQueuesWaitingInteractions']=function(_0x2ff94c,_0x123f4f){return respondWithRpcPromise(_0xbe14('0x61'),_0x2ff94c['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x123f4f,null))[_0xbe14('0xc')](handleError(_0x123f4f,null));};exports[_0xbe14('0x62')]=function(_0x5bc52b){return function(_0xa53262,_0x1205d1){var _0x47d7bb,_0x2be969;var _0x49990b=_[_0xbe14('0x63')](_0x5bc52b);var _0x337073=_0x5bc52b==='chat'?'Website':_0xbe14('0x64');return db[_0x49990b+_0xbe14('0x65')][_0xbe14('0x66')]({'raw':!![],'where':{'id':_0xa53262['params']['id']}})[_0xbe14('0x8')](function(_0x30c03b){if(_[_0xbe14('0x12')](_0x30c03b)){throw new Error(_0x49990b+_0xbe14('0x67'));}_0x47d7bb=_0x30c03b;return db[_0x49990b+'Message']['findOne']({'where':{'id':_0xa53262[_0xbe14('0x20')][_0xbe14('0x68')]},'include':[{'model':db[_0x49990b+_0xbe14('0x69')],'as':_0xbe14('0x69')},{'model':db[_0x49990b+_0x337073],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x139aab){if(_['isNil'](_0x139aab)){throw new Error(_0x49990b+_0xbe14('0x6a'));}_0x2be969=_0x139aab;return _0x139aab['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x3a01bb={'uniqueid':_0x5bc52b+'.'+_0x2be969['id']+'.'+_0x2be969[_0xbe14('0x69')]['id'],'FromUserId':_0xa53262[_0xbe14('0x2f')]['id'],'type':'queue'};_0x3a01bb[_0x49990b+_0xbe14('0x6b')]=_0x2be969['id'];_0x3a01bb[_0x49990b+_0xbe14('0x6c')]=_0x2be969[_0xbe14('0x69')]['id'];_0x3a01bb['From'+_0x49990b+_0x337073+'Id']=_0x2be969[_0xbe14('0x64')]['id'];_0x3a01bb['To'+_0x49990b+_0xbe14('0x6d')]=_0x47d7bb['id'];return db[_0x49990b+_0xbe14('0x6e')][_0xbe14('0x6f')](_0x3a01bb);})[_0xbe14('0x8')](function(){return respondWithRpcPromise(_0xbe14('0x70'),{'channel':_0x5bc52b,'interaction':_0x2be969[_0xbe14('0x69')],'message':_0x2be969,'account':_0x2be969[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe14('0x71'),'appdata':_0x47d7bb[_0xbe14('0x10')]+','+(_0x2be969[_0xbe14('0x64')][_0xbe14('0x72')]||0x12c),'interval':_0xbe14('0x73')}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x1205d1,null))[_0xbe14('0xc')](handleError(_0x1205d1,null));};};exports[_0xbe14('0x74')]=function(_0x1de70d,_0x30be9e){var _0x1679bd,_0x2ca6e6;if(_['isNil'](_0x1de70d[_0xbe14('0x20')]['channel'])){throw new Error(_0xbe14('0x75'));}var _0x1b8733=_0x1de70d[_0xbe14('0x20')][_0xbe14('0x76')];var _0x1d7b08=_['capitalize'](_0x1b8733);var _0x5868d7=_0x1b8733===_0xbe14('0x77')?_0xbe14('0x78'):_0xbe14('0x64');return db[_0xbe14('0x79')]['findOne']({'raw':!![],'where':{'id':_0x1de70d[_0xbe14('0x1b')]['id'],'role':_0xbe14('0x7a')}})['then'](function(_0x186225){if(_[_0xbe14('0x12')](_0x186225)){throw new Error(_0xbe14('0x7b'));}_0x1679bd=_0x186225;return db[_0x1d7b08+_0xbe14('0x7c')]['findOne']({'where':{'id':_0x1de70d[_0xbe14('0x20')]['messageId']},'include':[{'model':db[_0x1d7b08+'Interaction'],'as':_0xbe14('0x69')},{'model':db[_0x1d7b08+_0x5868d7],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x3d890b){if(_[_0xbe14('0x12')](_0x3d890b)){throw new Error(_0x1d7b08+'\x20Message\x20not\x20found');}_0x2ca6e6=_0x3d890b;return _0x3d890b[_0xbe14('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x5dc793={'uniqueid':_0x1b8733+'.'+_0x2ca6e6['id']+'.'+_0x2ca6e6['Interaction']['id'],'FromUserId':_0x1de70d[_0xbe14('0x2f')]['id'],'type':_0xbe14('0x71'),'ToUserId':_0x1679bd['id']};_0x5dc793[_0x1d7b08+'MessageId']=_0x2ca6e6['id'];_0x5dc793[_0x1d7b08+_0xbe14('0x6c')]=_0x2ca6e6['Interaction']['id'];_0x5dc793[_0xbe14('0x7e')+_0x1d7b08+_0x5868d7+'Id']=_0x2ca6e6['Account']['id'];return db[_0x1d7b08+_0xbe14('0x6e')]['create'](_0x5dc793);})[_0xbe14('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1b8733,'interaction':_0x2ca6e6[_0xbe14('0x69')],'message':_0x2ca6e6,'account':_0x2ca6e6[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1679bd['name']+','+(_0x2ca6e6[_0xbe14('0x64')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x30be9e,null))[_0xbe14('0xc')](handleError(_0x30be9e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1d2dd86..278d595 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 _0xb2ff=['show','run','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id'];(function(_0x3f44b3,_0x6317e6){var _0x3a7ed1=function(_0x32ae91){while(--_0x32ae91){_0x3f44b3['push'](_0x3f44b3['shift']());}};_0x3a7ed1(++_0x6317e6);}(_0xb2ff,0xb0));var _0xfb2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2ff[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require(_0xfb2f('0x3'));var router=express['Router']();var fs_extra=require(_0xfb2f('0x4'));var auth=require(_0xfb2f('0x5'));var interaction=require(_0xfb2f('0x6'));var config=require(_0xfb2f('0x7'));var controller=require(_0xfb2f('0x8'));router['get']('/',auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xa')]);router[_0xfb2f('0xb')](_0xfb2f('0xc'),auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xd')]);router[_0xfb2f('0xb')]('/:id/run',auth[_0xfb2f('0x9')](),controller[_0xfb2f('0xe')]);router[_0xfb2f('0xf')]('/',auth['isAuthenticated'](),controller[_0xfb2f('0x10')]);router[_0xfb2f('0x11')](_0xfb2f('0xc'),auth['isAuthenticated'](),controller[_0xfb2f('0x12')]);router[_0xfb2f('0x13')](_0xfb2f('0xc'),auth[_0xfb2f('0x9')](),controller[_0xfb2f('0x14')]);module['exports']=router; \ No newline at end of file +var _0xebe0=['get','/:id','isAuthenticated','show','/:id/run','run','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xebe0,0xf2));var _0x0ebe=function(_0x18cad7,_0xfea050){_0x18cad7=_0x18cad7-0x0;var _0x463a0e=_0xebe0[_0x18cad7];return _0x463a0e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ebe('0x0'));var timeout=require(_0x0ebe('0x1'));var express=require(_0x0ebe('0x2'));var router=express[_0x0ebe('0x3')]();var fs_extra=require(_0x0ebe('0x4'));var auth=require(_0x0ebe('0x5'));var interaction=require(_0x0ebe('0x6'));var config=require(_0x0ebe('0x7'));var controller=require(_0x0ebe('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ebe('0x9')]);router[_0x0ebe('0xa')](_0x0ebe('0xb'),auth[_0x0ebe('0xc')](),controller[_0x0ebe('0xd')]);router[_0x0ebe('0xa')](_0x0ebe('0xe'),auth[_0x0ebe('0xc')](),controller[_0x0ebe('0xf')]);router[_0x0ebe('0x10')]('/',auth[_0x0ebe('0xc')](),controller[_0x0ebe('0x11')]);router['put'](_0x0ebe('0xb'),auth[_0x0ebe('0xc')](),controller['update']);router[_0x0ebe('0x12')]('/:id',auth[_0x0ebe('0xc')](),controller[_0x0ebe('0x13')]);module[_0x0ebe('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 352cb09..b6f0a78 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 _0x44ea=['INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','exports','STRING','BOOLEAN','DATE'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x44ea,0x12e));var _0xa44e=function(_0x4b6c4b,_0x3eefa4){_0x4b6c4b=_0x4b6c4b-0x0;var _0x2a2052=_0x44ea[_0x4b6c4b];return _0x2a2052;};'use strict';var Sequelize=require('sequelize');module[_0xa44e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa44e('0x1')]},'active':{'type':Sequelize[_0xa44e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa44e('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa44e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa44e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0x6'),_0xa44e('0x7'),_0xa44e('0x8'),'weeks',_0xa44e('0x9'),_0xa44e('0xa'),_0xa44e('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0xc'),_0xa44e('0xd'),_0xa44e('0xe')),'allowNull':![],'defaultValue':_0xa44e('0xc')},'type':{'type':Sequelize[_0xa44e('0x5')](_0xa44e('0xf'),'default'),'allowNull':![],'defaultValue':_0xa44e('0xf')},'sendMail':{'type':Sequelize[_0xa44e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa44e('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa44e('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3750=['DATE','INTEGER','ENUM','years','months','weeks','days','hours','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3750,0x8d));var _0x0375=function(_0xc694ff,_0x1498ad){_0xc694ff=_0xc694ff-0x0;var _0x59dba2=_0x3750[_0xc694ff];return _0x59dba2;};'use strict';var Sequelize=require(_0x0375('0x0'));module[_0x0375('0x1')]={'name':{'type':Sequelize[_0x0375('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0375('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x0375('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0375('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0375('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0375('0x5')](_0x0375('0x6'),'quarters',_0x0375('0x7'),_0x0375('0x8'),_0x0375('0x9'),_0x0375('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x0375('0x9')},'output':{'type':Sequelize['ENUM'](_0x0375('0xb'),_0x0375('0xc'),_0x0375('0xd')),'allowNull':![],'defaultValue':_0x0375('0xb')},'type':{'type':Sequelize[_0x0375('0x5')](_0x0375('0xe'),_0x0375('0xf')),'allowNull':![],'defaultValue':_0x0375('0xe')},'sendMail':{'type':Sequelize[_0x0375('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x0375('0x2')]},'cc':{'type':Sequelize[_0x0375('0x11')]},'bcc':{'type':Sequelize[_0x0375('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x0375('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index cccb27f..a6d200d 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 _0x0435=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','../../config/schedule','run','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','end','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0435,0x11c));var _0x5043=function(_0x1d3da4,_0x410e79){_0x1d3da4=_0x1d3da4-0x0;var _0x146c32=_0x0435[_0x1d3da4];return _0x146c32;};'use strict';var emlformat=require(_0x5043('0x0'));var rimraf=require(_0x5043('0x1'));var zipdir=require(_0x5043('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5043('0x3'));var moment=require('moment');var BPromise=require(_0x5043('0x4'));var Mustache=require(_0x5043('0x5'));var util=require(_0x5043('0x6'));var path=require(_0x5043('0x7'));var sox=require(_0x5043('0x8'));var csv=require(_0x5043('0x9'));var ejs=require(_0x5043('0xa'));var fs=require('fs');var fs_extra=require(_0x5043('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5043('0xc'));var jsforce=require(_0x5043('0xd'));var deskjs=require(_0x5043('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5043('0xf'));var Papa=require(_0x5043('0x10'));var Redis=require(_0x5043('0x11'));var authService=require(_0x5043('0x12'));var qs=require(_0x5043('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5043('0x14'));var logger=require(_0x5043('0x15'))(_0x5043('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5043('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e9531,_0x5094a4){_0x5094a4=_0x5094a4||0xcc;return function(_0x5a2719){if(_0x5a2719){return _0x2e9531[_0x5043('0x18')](_0x5094a4);}return _0x2e9531[_0x5043('0x19')](_0x5094a4)['end']();};}function respondWithResult(_0x5981a1,_0x5cd6fc){_0x5cd6fc=_0x5cd6fc||0xc8;return function(_0x5e1ae9){if(_0x5e1ae9){return _0x5981a1[_0x5043('0x19')](_0x5cd6fc)[_0x5043('0x1a')](_0x5e1ae9);}};}function respondWithFilteredResult(_0x5541d6,_0x765fbb){return function(_0x5d5e76){if(_0x5d5e76){var _0x477e9c=typeof _0x765fbb[_0x5043('0x1b')]==='undefined'&&typeof _0x765fbb[_0x5043('0x1c')]===_0x5043('0x1d');var _0x16ef33=_0x5d5e76['count'];var _0x4371c8=_0x477e9c?0x0:_0x765fbb[_0x5043('0x1b')];var _0x49f48a=_0x477e9c?_0x5d5e76[_0x5043('0x1e')]:_0x765fbb[_0x5043('0x1b')]+_0x765fbb[_0x5043('0x1c')];var _0x18d004;if(_0x49f48a>=_0x16ef33){_0x49f48a=_0x16ef33;_0x18d004=0xc8;}else{_0x18d004=0xce;}_0x5541d6[_0x5043('0x19')](_0x18d004);return _0x5541d6[_0x5043('0x1f')]('Content-Range',_0x4371c8+'-'+_0x49f48a+'/'+_0x16ef33)['json'](_0x5d5e76);}return null;};}function patchUpdates(_0x38e659){return function(_0x5781ed){try{jsonpatch['apply'](_0x5781ed,_0x38e659,!![]);}catch(_0x5ba261){return BPromise[_0x5043('0x20')](_0x5ba261);}return _0x5781ed[_0x5043('0x21')]();};}function saveUpdates(_0x4b7fb9,_0x28efda){return function(_0x4ab05e){if(_0x4ab05e){return _0x4ab05e[_0x5043('0x22')](_0x4b7fb9)['then'](function(_0x3f4564){return _0x3f4564;});}return null;};}function removeEntity(_0x2e141d,_0x53e55a){return function(_0xa11f3a){if(_0xa11f3a){return _0xa11f3a[_0x5043('0x23')]()[_0x5043('0x24')](function(){var _0x215a8c=_0xa11f3a[_0x5043('0x25')]({'plain':!![]});var _0x30810b=_0x5043('0x26');return db[_0x5043('0x27')][_0x5043('0x23')]({'where':{'type':_0x30810b,'resourceId':_0x215a8c['id']}})['then'](function(){return _0xa11f3a;});})[_0x5043('0x24')](function(){_0x2e141d['status'](0xcc)[_0x5043('0x28')]();});}};}function handleEntityNotFound(_0x1832c7,_0x39fc0d){return function(_0x16bfdf){if(!_0x16bfdf){_0x1832c7[_0x5043('0x18')](0x194);}return _0x16bfdf;};}function handleError(_0x229cec,_0xe1ec4c){_0xe1ec4c=_0xe1ec4c||0x1f4;return function(_0x5290da){logger['error'](_0x5290da[_0x5043('0x29')]);if(_0x5290da[_0x5043('0x2a')]){delete _0x5290da[_0x5043('0x2a')];}_0x229cec[_0x5043('0x19')](_0xe1ec4c)[_0x5043('0x2b')](_0x5290da);};}exports[_0x5043('0x2c')]=function(_0xd8f00b,_0x4f597a){var _0x50eece={},_0x54bca5={},_0x510bfb={'count':0x0,'rows':[]};var _0x4b63e5=_['map'](db[_0x5043('0x2d')][_0x5043('0x2e')],function(_0x180e27){return{'name':_0x180e27[_0x5043('0x2f')],'type':_0x180e27[_0x5043('0x30')][_0x5043('0x31')]};});_0x54bca5[_0x5043('0x32')]=_[_0x5043('0x33')](_0x4b63e5,'name');_0x54bca5['query']=_[_0x5043('0x34')](_0xd8f00b[_0x5043('0x35')]);_0x54bca5[_0x5043('0x36')]=_[_0x5043('0x37')](_0x54bca5[_0x5043('0x32')],_0x54bca5[_0x5043('0x35')]);_0x50eece[_0x5043('0x38')]=_['intersection'](_0x54bca5[_0x5043('0x32')],qs[_0x5043('0x39')](_0xd8f00b[_0x5043('0x35')][_0x5043('0x39')]));_0x50eece[_0x5043('0x38')]=_0x50eece[_0x5043('0x38')][_0x5043('0x3a')]?_0x50eece[_0x5043('0x38')]:_0x54bca5[_0x5043('0x32')];if(!_0xd8f00b[_0x5043('0x35')][_0x5043('0x3b')](_0x5043('0x3c'))){_0x50eece[_0x5043('0x1c')]=qs['limit'](_0xd8f00b[_0x5043('0x35')][_0x5043('0x1c')]);_0x50eece['offset']=qs['offset'](_0xd8f00b[_0x5043('0x35')]['offset']);}_0x50eece['order']=qs[_0x5043('0x3d')](_0xd8f00b[_0x5043('0x35')][_0x5043('0x3d')]);_0x50eece[_0x5043('0x3e')]=qs[_0x5043('0x36')](_[_0x5043('0x3f')](_0xd8f00b[_0x5043('0x35')],_0x54bca5[_0x5043('0x36')]),_0x4b63e5);if(_0xd8f00b[_0x5043('0x35')][_0x5043('0x40')]){_0x50eece[_0x5043('0x3e')]=_[_0x5043('0x41')](_0x50eece[_0x5043('0x3e')],{'$or':_[_0x5043('0x33')](_0x4b63e5,function(_0x1eb3ba){if(_0x1eb3ba[_0x5043('0x30')]!==_0x5043('0x42')){var _0x8130ab={};_0x8130ab[_0x1eb3ba['name']]={'$like':'%'+_0xd8f00b[_0x5043('0x35')][_0x5043('0x40')]+'%'};return _0x8130ab;}})});}_0x50eece=_[_0x5043('0x41')]({},_0x50eece,_0xd8f00b['options']);var _0x374e2f={'where':_0x50eece[_0x5043('0x3e')]};return db['Schedule'][_0x5043('0x1e')](_0x374e2f)[_0x5043('0x24')](function(_0x474fa5){_0x510bfb[_0x5043('0x1e')]=_0x474fa5;if(_0xd8f00b[_0x5043('0x35')][_0x5043('0x43')]){_0x50eece[_0x5043('0x44')]=[{'all':!![]}];}return db[_0x5043('0x2d')][_0x5043('0x45')](_0x50eece);})[_0x5043('0x24')](function(_0x1dc122){_0x510bfb[_0x5043('0x46')]=_0x1dc122;return _0x510bfb;})['then'](respondWithFilteredResult(_0x4f597a,_0x50eece))[_0x5043('0x47')](handleError(_0x4f597a,null));};exports[_0x5043('0x48')]=function(_0x72c84c,_0x4ce729){var _0x232438={'raw':![],'where':{'id':_0x72c84c['params']['id']}},_0x33a4c5={};_0x33a4c5[_0x5043('0x32')]=_[_0x5043('0x34')](db[_0x5043('0x2d')][_0x5043('0x2e')]);_0x33a4c5[_0x5043('0x35')]=_[_0x5043('0x34')](_0x72c84c['query']);_0x33a4c5[_0x5043('0x36')]=_[_0x5043('0x37')](_0x33a4c5[_0x5043('0x32')],_0x33a4c5[_0x5043('0x35')]);_0x232438['attributes']=_['intersection'](_0x33a4c5[_0x5043('0x32')],qs[_0x5043('0x39')](_0x72c84c[_0x5043('0x35')][_0x5043('0x39')]));_0x232438['attributes']=_0x232438[_0x5043('0x38')][_0x5043('0x3a')]?_0x232438[_0x5043('0x38')]:_0x33a4c5[_0x5043('0x32')];if(_0x72c84c[_0x5043('0x35')][_0x5043('0x43')]){_0x232438[_0x5043('0x44')]=[{'all':!![]}];}_0x232438=_[_0x5043('0x41')]({},_0x232438,_0x72c84c[_0x5043('0x49')]);return db['Schedule'][_0x5043('0x4a')](_0x232438)[_0x5043('0x24')](handleEntityNotFound(_0x4ce729,null))['then'](respondWithResult(_0x4ce729,null))[_0x5043('0x47')](handleError(_0x4ce729,null));};exports[_0x5043('0x4b')]=function(_0x31a737,_0x1d87cb){return db[_0x5043('0x2d')][_0x5043('0x4b')](_0x31a737[_0x5043('0x4c')],{})[_0x5043('0x24')](function(_0x26b468){var _0x86a210=_0x31a737['user'][_0x5043('0x25')]({'plain':!![]});if(!_0x86a210)throw new Error(_0x5043('0x4d'));if(_0x86a210[_0x5043('0x4e')]==='user'){var _0x1b0873=_0x26b468[_0x5043('0x25')]({'plain':!![]});var _0xe21fa3='Scheduler';return db[_0x5043('0x4f')][_0x5043('0x4a')]({'where':{'name':_0xe21fa3,'userProfileId':_0x86a210['userProfileId']},'raw':!![]})[_0x5043('0x24')](function(_0x328522){if(_0x328522&&_0x328522[_0x5043('0x50')]===0x0){return db[_0x5043('0x27')]['create']({'name':_0x1b0873[_0x5043('0x2a')],'resourceId':_0x1b0873['id'],'type':_0x328522[_0x5043('0x2a')],'sectionId':_0x328522['id']},{})['then'](function(){return _0x26b468;});}else{return _0x26b468;}})['catch'](function(_0x2be55b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be55b);throw _0x2be55b;});}return _0x26b468;})[_0x5043('0x24')](respondWithResult(_0x1d87cb,0xc9))[_0x5043('0x47')](handleError(_0x1d87cb,null));};exports['update']=function(_0x3b5dc0,_0x16ffde){if(_0x3b5dc0['body']['id']){delete _0x3b5dc0[_0x5043('0x4c')]['id'];}return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x3b5dc0[_0x5043('0x51')]['id']}})['then'](handleEntityNotFound(_0x16ffde,null))[_0x5043('0x24')](saveUpdates(_0x3b5dc0[_0x5043('0x4c')],null))[_0x5043('0x24')](respondWithResult(_0x16ffde,null))[_0x5043('0x47')](handleError(_0x16ffde,null));};exports['destroy']=function(_0x138c71,_0x56d068){return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x138c71[_0x5043('0x51')]['id']}})['then'](handleEntityNotFound(_0x56d068,null))[_0x5043('0x24')](removeEntity(_0x56d068,null))['catch'](handleError(_0x56d068,null));};exports['run']=function(_0x919ac7,_0x4a793b,_0x14444d){var _0x1185c1=require(_0x5043('0x52'));return db[_0x5043('0x2d')][_0x5043('0x4a')]({'where':{'id':_0x919ac7[_0x5043('0x51')]['id']},'raw':!![]})[_0x5043('0x24')](handleEntityNotFound(_0x4a793b,null))[_0x5043('0x24')](function(){_0x1185c1[_0x5043('0x53')](_0x919ac7[_0x5043('0x51')]['id']);})[_0x5043('0x24')](respondWithStatusCode(_0x4a793b,null))[_0x5043('0x47')](handleError(_0x4a793b,null));}; \ No newline at end of file +var _0x6dab=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','reject','update','destroy','then','Scheduler','error','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x1d2b66,_0x256c6e){var _0x445a66=function(_0x2e5845){while(--_0x2e5845){_0x1d2b66['push'](_0x1d2b66['shift']());}};_0x445a66(++_0x256c6e);}(_0x6dab,0xb9));var _0xb6da=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0x6dab[_0x42cc1f];return _0x175df5;};'use strict';var emlformat=require(_0xb6da('0x0'));var rimraf=require(_0xb6da('0x1'));var zipdir=require(_0xb6da('0x2'));var jsonpatch=require(_0xb6da('0x3'));var rp=require(_0xb6da('0x4'));var moment=require('moment');var BPromise=require(_0xb6da('0x5'));var Mustache=require('mustache');var util=require(_0xb6da('0x6'));var path=require(_0xb6da('0x7'));var sox=require(_0xb6da('0x8'));var csv=require(_0xb6da('0x9'));var ejs=require(_0xb6da('0xa'));var fs=require('fs');var fs_extra=require(_0xb6da('0xb'));var _=require('lodash');var squel=require(_0xb6da('0xc'));var crypto=require(_0xb6da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb6da('0xe'));var toCsv=require(_0xb6da('0x9'));var querystring=require('querystring');var Papa=require(_0xb6da('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb6da('0x10'));var as=require(_0xb6da('0x11'));var hardwareService=require(_0xb6da('0x12'));var logger=require(_0xb6da('0x13'))('api');var utils=require(_0xb6da('0x14'));var config=require(_0xb6da('0x15'));var licenseUtil=require(_0xb6da('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a300a,_0x15279a){_0x15279a=_0x15279a||0xcc;return function(_0x289614){if(_0x289614){return _0x5a300a[_0xb6da('0x17')](_0x15279a);}return _0x5a300a[_0xb6da('0x18')](_0x15279a)[_0xb6da('0x19')]();};}function respondWithResult(_0x1b8b3b,_0x3a57cc){_0x3a57cc=_0x3a57cc||0xc8;return function(_0x2b424f){if(_0x2b424f){return _0x1b8b3b[_0xb6da('0x18')](_0x3a57cc)['json'](_0x2b424f);}};}function respondWithFilteredResult(_0x3c26bd,_0x5b0836){return function(_0x387180){if(_0x387180){var _0x200e2e=typeof _0x5b0836['offset']==='undefined'&&typeof _0x5b0836[_0xb6da('0x1a')]===_0xb6da('0x1b');var _0xe30d6e=_0x387180[_0xb6da('0x1c')];var _0x58952b=_0x200e2e?0x0:_0x5b0836['offset'];var _0x5d205a=_0x200e2e?_0x387180[_0xb6da('0x1c')]:_0x5b0836[_0xb6da('0x1d')]+_0x5b0836[_0xb6da('0x1a')];var _0x52e404;if(_0x5d205a>=_0xe30d6e){_0x5d205a=_0xe30d6e;_0x52e404=0xc8;}else{_0x52e404=0xce;}_0x3c26bd[_0xb6da('0x18')](_0x52e404);return _0x3c26bd[_0xb6da('0x1e')](_0xb6da('0x1f'),_0x58952b+'-'+_0x5d205a+'/'+_0xe30d6e)['json'](_0x387180);}return null;};}function patchUpdates(_0x22b3a6){return function(_0x28d627){try{jsonpatch['apply'](_0x28d627,_0x22b3a6,!![]);}catch(_0x34295c){return BPromise[_0xb6da('0x20')](_0x34295c);}return _0x28d627['save']();};}function saveUpdates(_0x17888f,_0x4e9fe2){return function(_0x4fda2e){if(_0x4fda2e){return _0x4fda2e[_0xb6da('0x21')](_0x17888f)['then'](function(_0x37f92a){return _0x37f92a;});}return null;};}function removeEntity(_0x2e9040,_0xb1f350){return function(_0x41156e){if(_0x41156e){return _0x41156e[_0xb6da('0x22')]()[_0xb6da('0x23')](function(){var _0x3e0675=_0x41156e['get']({'plain':!![]});var _0x43d102=_0xb6da('0x24');return db['UserProfileResource'][_0xb6da('0x22')]({'where':{'type':_0x43d102,'resourceId':_0x3e0675['id']}})['then'](function(){return _0x41156e;});})[_0xb6da('0x23')](function(){_0x2e9040[_0xb6da('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a504c,_0x2ca846){return function(_0x1f7018){if(!_0x1f7018){_0x4a504c['sendStatus'](0x194);}return _0x1f7018;};}function handleError(_0x28e1fd,_0x2a72a1){_0x2a72a1=_0x2a72a1||0x1f4;return function(_0xe5b5d0){logger[_0xb6da('0x25')](_0xe5b5d0[_0xb6da('0x26')]);if(_0xe5b5d0[_0xb6da('0x27')]){delete _0xe5b5d0[_0xb6da('0x27')];}_0x28e1fd[_0xb6da('0x18')](_0x2a72a1)['send'](_0xe5b5d0);};}exports[_0xb6da('0x28')]=function(_0xb1b0cb,_0x31c6f1){var _0x1b5296={},_0x1f4af1={},_0x20d7e8={'count':0x0,'rows':[]};var _0x1f4c86=_[_0xb6da('0x29')](db['Schedule']['rawAttributes'],function(_0xb3d38b){return{'name':_0xb3d38b[_0xb6da('0x2a')],'type':_0xb3d38b[_0xb6da('0x2b')][_0xb6da('0x2c')]};});_0x1f4af1[_0xb6da('0x2d')]=_[_0xb6da('0x29')](_0x1f4c86,'name');_0x1f4af1[_0xb6da('0x2e')]=_[_0xb6da('0x2f')](_0xb1b0cb[_0xb6da('0x2e')]);_0x1f4af1['filters']=_[_0xb6da('0x30')](_0x1f4af1['model'],_0x1f4af1[_0xb6da('0x2e')]);_0x1b5296[_0xb6da('0x31')]=_['intersection'](_0x1f4af1[_0xb6da('0x2d')],qs[_0xb6da('0x32')](_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x32')]));_0x1b5296[_0xb6da('0x31')]=_0x1b5296['attributes']['length']?_0x1b5296[_0xb6da('0x31')]:_0x1f4af1[_0xb6da('0x2d')];if(!_0xb1b0cb['query'][_0xb6da('0x33')](_0xb6da('0x34'))){_0x1b5296[_0xb6da('0x1a')]=qs[_0xb6da('0x1a')](_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x1a')]);_0x1b5296[_0xb6da('0x1d')]=qs['offset'](_0xb1b0cb['query'][_0xb6da('0x1d')]);}_0x1b5296[_0xb6da('0x35')]=qs[_0xb6da('0x36')](_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x36')]);_0x1b5296[_0xb6da('0x37')]=qs[_0xb6da('0x38')](_[_0xb6da('0x39')](_0xb1b0cb[_0xb6da('0x2e')],_0x1f4af1[_0xb6da('0x38')]),_0x1f4c86);if(_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x3a')]){_0x1b5296[_0xb6da('0x37')]=_['merge'](_0x1b5296[_0xb6da('0x37')],{'$or':_[_0xb6da('0x29')](_0x1f4c86,function(_0x12f112){if(_0x12f112[_0xb6da('0x2b')]!==_0xb6da('0x3b')){var _0x2b5e78={};_0x2b5e78[_0x12f112['name']]={'$like':'%'+_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x3a')]+'%'};return _0x2b5e78;}})});}_0x1b5296=_[_0xb6da('0x3c')]({},_0x1b5296,_0xb1b0cb['options']);var _0x95ae12={'where':_0x1b5296[_0xb6da('0x37')]};return db[_0xb6da('0x3d')]['count'](_0x95ae12)[_0xb6da('0x23')](function(_0x20c150){_0x20d7e8[_0xb6da('0x1c')]=_0x20c150;if(_0xb1b0cb[_0xb6da('0x2e')][_0xb6da('0x3e')]){_0x1b5296[_0xb6da('0x3f')]=[{'all':!![]}];}return db[_0xb6da('0x3d')][_0xb6da('0x40')](_0x1b5296);})[_0xb6da('0x23')](function(_0x5c9e2e){_0x20d7e8[_0xb6da('0x41')]=_0x5c9e2e;return _0x20d7e8;})[_0xb6da('0x23')](respondWithFilteredResult(_0x31c6f1,_0x1b5296))[_0xb6da('0x42')](handleError(_0x31c6f1,null));};exports[_0xb6da('0x43')]=function(_0x5db780,_0x5d3ff8){var _0x9d6214={'raw':![],'where':{'id':_0x5db780[_0xb6da('0x44')]['id']}},_0x26755c={};_0x26755c['model']=_[_0xb6da('0x2f')](db[_0xb6da('0x3d')]['rawAttributes']);_0x26755c['query']=_[_0xb6da('0x2f')](_0x5db780['query']);_0x26755c[_0xb6da('0x38')]=_[_0xb6da('0x30')](_0x26755c[_0xb6da('0x2d')],_0x26755c[_0xb6da('0x2e')]);_0x9d6214['attributes']=_[_0xb6da('0x30')](_0x26755c[_0xb6da('0x2d')],qs[_0xb6da('0x32')](_0x5db780[_0xb6da('0x2e')][_0xb6da('0x32')]));_0x9d6214[_0xb6da('0x31')]=_0x9d6214[_0xb6da('0x31')][_0xb6da('0x45')]?_0x9d6214['attributes']:_0x26755c['model'];if(_0x5db780[_0xb6da('0x2e')]['includeAll']){_0x9d6214[_0xb6da('0x3f')]=[{'all':!![]}];}_0x9d6214=_[_0xb6da('0x3c')]({},_0x9d6214,_0x5db780['options']);return db[_0xb6da('0x3d')][_0xb6da('0x46')](_0x9d6214)[_0xb6da('0x23')](handleEntityNotFound(_0x5d3ff8,null))[_0xb6da('0x23')](respondWithResult(_0x5d3ff8,null))[_0xb6da('0x42')](handleError(_0x5d3ff8,null));};exports['create']=function(_0x417558,_0x4da971){return db[_0xb6da('0x3d')][_0xb6da('0x47')](_0x417558['body'],{})[_0xb6da('0x23')](function(_0x44511d){var _0x1b4e98=_0x417558[_0xb6da('0x48')][_0xb6da('0x49')]({'plain':!![]});if(!_0x1b4e98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b4e98['role']==='user'){var _0x2d6a4a=_0x44511d[_0xb6da('0x49')]({'plain':!![]});var _0x4a6295=_0xb6da('0x24');return db[_0xb6da('0x4a')][_0xb6da('0x46')]({'where':{'name':_0x4a6295,'userProfileId':_0x1b4e98['userProfileId']},'raw':!![]})[_0xb6da('0x23')](function(_0x39e321){if(_0x39e321&&_0x39e321['autoAssociation']===0x0){return db[_0xb6da('0x4b')][_0xb6da('0x47')]({'name':_0x2d6a4a[_0xb6da('0x27')],'resourceId':_0x2d6a4a['id'],'type':_0x39e321[_0xb6da('0x27')],'sectionId':_0x39e321['id']},{})['then'](function(){return _0x44511d;});}else{return _0x44511d;}})[_0xb6da('0x42')](function(_0x2152b6){logger[_0xb6da('0x25')](_0xb6da('0x4c'),_0x2152b6);throw _0x2152b6;});}return _0x44511d;})[_0xb6da('0x23')](respondWithResult(_0x4da971,0xc9))['catch'](handleError(_0x4da971,null));};exports[_0xb6da('0x21')]=function(_0x4fd15b,_0x348873){if(_0x4fd15b[_0xb6da('0x4d')]['id']){delete _0x4fd15b['body']['id'];}return db['Schedule'][_0xb6da('0x46')]({'where':{'id':_0x4fd15b[_0xb6da('0x44')]['id']}})[_0xb6da('0x23')](handleEntityNotFound(_0x348873,null))[_0xb6da('0x23')](saveUpdates(_0x4fd15b[_0xb6da('0x4d')],null))[_0xb6da('0x23')](respondWithResult(_0x348873,null))[_0xb6da('0x42')](handleError(_0x348873,null));};exports['destroy']=function(_0xd5e511,_0x421016){return db[_0xb6da('0x3d')][_0xb6da('0x46')]({'where':{'id':_0xd5e511[_0xb6da('0x44')]['id']}})[_0xb6da('0x23')](handleEntityNotFound(_0x421016,null))[_0xb6da('0x23')](removeEntity(_0x421016,null))[_0xb6da('0x42')](handleError(_0x421016,null));};exports[_0xb6da('0x4e')]=function(_0x2e9fff,_0x52353a,_0x1fa220){var _0x3523ad=require('../../config/schedule');return db[_0xb6da('0x3d')]['find']({'where':{'id':_0x2e9fff['params']['id']},'raw':!![]})[_0xb6da('0x23')](handleEntityNotFound(_0x52353a,null))['then'](function(){_0x3523ad[_0xb6da('0x4e')](_0x2e9fff[_0xb6da('0x44')]['id']);})[_0xb6da('0x23')](respondWithStatusCode(_0x52353a,null))[_0xb6da('0x42')](handleError(_0x52353a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 39b7a87..8876e7b 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 _0x1032=['api','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','../../config/logger'];(function(_0x1d4507,_0xfe68b4){var _0x2f230e=function(_0x4148a6){while(--_0x4148a6){_0x1d4507['push'](_0x1d4507['shift']());}};_0x2f230e(++_0xfe68b4);}(_0x1032,0xf1));var _0x2103=function(_0x1168ff,_0x6c619){_0x1168ff=_0x1168ff-0x0;var _0x2e7408=_0x1032[_0x1168ff];return _0x2e7408;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2103('0x0'))(_0x2103('0x1'));var moment=require('moment');var BPromise=require(_0x2103('0x2'));var rp=require(_0x2103('0x3'));var fs=require('fs');var path=require(_0x2103('0x4'));var rimraf=require('rimraf');var config=require(_0x2103('0x5'));var attributes=require(_0x2103('0x6'));module[_0x2103('0x7')]=function(_0x45c6a7,_0x26f359){return _0x45c6a7[_0x2103('0x8')](_0x2103('0x9'),attributes,{'tableName':_0x2103('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4435=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Schedule','tools_schedules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4435,0x90));var _0x5443=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x4435[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x5443('0x0'));var util=require('util');var logger=require(_0x5443('0x1'))(_0x5443('0x2'));var moment=require(_0x5443('0x3'));var BPromise=require(_0x5443('0x4'));var rp=require(_0x5443('0x5'));var fs=require('fs');var path=require(_0x5443('0x6'));var rimraf=require(_0x5443('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x5443('0x8')]=function(_0x53d6d1,_0x54923e){return _0x53d6d1[_0x5443('0x9')](_0x5443('0xa'),attributes,{'tableName':_0x5443('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 2b5094e..059669b 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 _0x9237=['info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9237,0xe1));var _0x7923=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x9237[_0x2fb87c];return _0x43038b;};'use strict';var _=require('lodash');var util=require(_0x7923('0x0'));var moment=require(_0x7923('0x1'));var BPromise=require(_0x7923('0x2'));var rs=require(_0x7923('0x3'));var fs=require('fs');var Redis=require(_0x7923('0x4'));var db=require(_0x7923('0x5'))['db'];var utils=require(_0x7923('0x6'));var logger=require(_0x7923('0x7'))(_0x7923('0x8'));var config=require(_0x7923('0x9'));var jayson=require(_0x7923('0xa'));var client=jayson[_0x7923('0xb')][_0x7923('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x500566,_0x1a65dd,_0x14a08a){return new BPromise(function(_0x71595c,_0x5ae496){return client[_0x7923('0xd')](_0x500566,_0x14a08a)[_0x7923('0xe')](function(_0x10a992){logger[_0x7923('0xf')](_0x7923('0x10'),_0x1a65dd,'request\x20sent');logger[_0x7923('0x11')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1a65dd,_0x7923('0x12'),JSON[_0x7923('0x13')](_0x10a992));if(_0x10a992[_0x7923('0x14')]){if(_0x10a992[_0x7923('0x14')]['code']===0x1f4){logger[_0x7923('0x14')](_0x7923('0x10'),_0x1a65dd,_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);return _0x5ae496(_0x10a992['error']['message']);}logger[_0x7923('0x14')](_0x7923('0x10'),_0x1a65dd,_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);return _0x71595c(_0x10a992[_0x7923('0x14')][_0x7923('0x15')]);}else{logger[_0x7923('0xf')](_0x7923('0x10'),_0x1a65dd,_0x7923('0x12'));_0x71595c(_0x10a992[_0x7923('0x16')][_0x7923('0x15')]);}})[_0x7923('0x17')](function(_0x3a70bf){logger[_0x7923('0x14')]('Schedule,\x20%s,\x20%s',_0x1a65dd,_0x3a70bf);_0x5ae496(_0x3a70bf);});});} \ No newline at end of file +var _0x4b24=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x437adb,_0x555b7d){var _0x5d9a27=function(_0x40576b){while(--_0x40576b){_0x437adb['push'](_0x437adb['shift']());}};_0x5d9a27(++_0x555b7d);}(_0x4b24,0xc3));var _0x44b2=function(_0x3320fb,_0x519c04){_0x3320fb=_0x3320fb-0x0;var _0x4329e9=_0x4b24[_0x3320fb];return _0x4329e9;};'use strict';var _=require('lodash');var util=require(_0x44b2('0x0'));var moment=require('moment');var BPromise=require(_0x44b2('0x1'));var rs=require(_0x44b2('0x2'));var fs=require('fs');var Redis=require(_0x44b2('0x3'));var db=require(_0x44b2('0x4'))['db'];var utils=require(_0x44b2('0x5'));var logger=require(_0x44b2('0x6'))(_0x44b2('0x7'));var config=require(_0x44b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x44b2('0x9')][_0x44b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf93894,_0x3c39c7,_0x85166){return new BPromise(function(_0x165b2c,_0x4991bc){return client[_0x44b2('0xb')](_0xf93894,_0x85166)[_0x44b2('0xc')](function(_0x13a1e3){logger[_0x44b2('0xd')](_0x44b2('0xe'),_0x3c39c7,_0x44b2('0xf'));logger[_0x44b2('0x10')](_0x44b2('0x11'),_0x3c39c7,_0x44b2('0xf'),JSON[_0x44b2('0x12')](_0x13a1e3));if(_0x13a1e3[_0x44b2('0x13')]){if(_0x13a1e3['error'][_0x44b2('0x14')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x3c39c7,_0x13a1e3['error'][_0x44b2('0x15')]);return _0x4991bc(_0x13a1e3['error']['message']);}logger[_0x44b2('0x13')](_0x44b2('0xe'),_0x3c39c7,_0x13a1e3[_0x44b2('0x13')]['message']);return _0x165b2c(_0x13a1e3[_0x44b2('0x13')][_0x44b2('0x15')]);}else{logger['info'](_0x44b2('0xe'),_0x3c39c7,_0x44b2('0xf'));_0x165b2c(_0x13a1e3[_0x44b2('0x16')]['message']);}})[_0x44b2('0x17')](function(_0x55a180){logger[_0x44b2('0x13')](_0x44b2('0xe'),_0x3c39c7,_0x55a180);_0x4991bc(_0x55a180);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f56b238..96f6f6d 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 _0xabbe=['../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xc7d00e,_0x53faef){var _0x39bf39=function(_0x19cbec){while(--_0x19cbec){_0xc7d00e['push'](_0xc7d00e['shift']());}};_0x39bf39(++_0x53faef);}(_0xabbe,0x1f4));var _0xeabb=function(_0x1f177c,_0x2c0d3a){_0x1f177c=_0x1f177c-0x0;var _0x17f3f2=_0xabbe[_0x1f177c];return _0x17f3f2;};'use strict';var multer=require(_0xeabb('0x0'));var util=require('util');var path=require(_0xeabb('0x1'));var timeout=require(_0xeabb('0x2'));var express=require(_0xeabb('0x3'));var router=express['Router']();var fs_extra=require(_0xeabb('0x4'));var auth=require(_0xeabb('0x5'));var interaction=require(_0xeabb('0x6'));var config=require(_0xeabb('0x7'));var controller=require(_0xeabb('0x8'));router['get']('/',auth[_0xeabb('0x9')](),controller[_0xeabb('0xa')]);router[_0xeabb('0xb')](_0xeabb('0xc'),auth[_0xeabb('0x9')](),controller['describe']);router[_0xeabb('0xb')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0xe')]);router[_0xeabb('0xb')]('/:id/download',auth[_0xeabb('0x9')](),controller[_0xeabb('0xf')]);router[_0xeabb('0x10')]('/',auth[_0xeabb('0x9')](),controller[_0xeabb('0x11')]);router[_0xeabb('0x12')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0x13')]);router[_0xeabb('0x14')](_0xeabb('0xd'),auth[_0xeabb('0x9')](),controller[_0xeabb('0x15')]);module[_0xeabb('0x16')]=router; \ No newline at end of file +var _0x7f2c=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/download','download','post','put','/:id','destroy'];(function(_0x895ea7,_0x3275a4){var _0xfe7424=function(_0x4458ac){while(--_0x4458ac){_0x895ea7['push'](_0x895ea7['shift']());}};_0xfe7424(++_0x3275a4);}(_0x7f2c,0x85));var _0xc7f2=function(_0x2a0755,_0xdf6bac){_0x2a0755=_0x2a0755-0x0;var _0x3eaf4f=_0x7f2c[_0x2a0755];return _0x3eaf4f;};'use strict';var multer=require(_0xc7f2('0x0'));var util=require('util');var path=require(_0xc7f2('0x1'));var timeout=require(_0xc7f2('0x2'));var express=require(_0xc7f2('0x3'));var router=express['Router']();var fs_extra=require(_0xc7f2('0x4'));var auth=require(_0xc7f2('0x5'));var interaction=require(_0xc7f2('0x6'));var config=require(_0xc7f2('0x7'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xc7f2('0x8')](),controller[_0xc7f2('0x9')]);router[_0xc7f2('0xa')](_0xc7f2('0xb'),auth[_0xc7f2('0x8')](),controller['describe']);router['get']('/:id',auth[_0xc7f2('0x8')](),controller[_0xc7f2('0xc')]);router[_0xc7f2('0xa')](_0xc7f2('0xd'),auth['isAuthenticated'](),controller[_0xc7f2('0xe')]);router[_0xc7f2('0xf')]('/',auth[_0xc7f2('0x8')](),controller['create']);router[_0xc7f2('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xc7f2('0x11'),auth[_0xc7f2('0x8')](),controller[_0xc7f2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index bf0201a..be0f67a 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 _0x81b7=['DATE','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','moment','path','../../config/environment','exports','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','format','toString'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x81b7,0x1f2));var _0x781b=function(_0x3c4b35,_0xc2d5af){_0x3c4b35=_0x3c4b35-0x0;var _0x41cf2f=_0x81b7[_0x3c4b35];return _0x41cf2f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x781b('0x0'));var path=require(_0x781b('0x1'));var config=require(_0x781b('0x2'));module[_0x781b('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x781b('0x4')]('value')?path[_0x781b('0x5')](this[_0x781b('0x4')](_0x781b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x781b('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x781b('0x7')],'set':function(_0xd9d633){var _0x482803=_0xd9d633['replace'](/\\/g,'/');this[_0x781b('0x8')](_0x781b('0x6'),_0x482803);}},'rating':{'type':Sequelize[_0x781b('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x781b('0x9')],'set':function(_0x5591d9){this[_0x781b('0x8')](_0x781b('0xa'),moment()['subtract'](_0x5591d9,'ms'));this['setDataValue'](_0x781b('0xb'),moment());this['setDataValue'](_0x781b('0xc'),_0x5591d9);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x781b('0x4')]('startedAt'))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'closedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0xb')))[_0x781b('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x781b('0xe')]();}},'createdAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x10')))['format'](_0x781b('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x781b('0xf')],'get':function(){return moment(this[_0x781b('0x4')](_0x781b('0x12')))['format'](_0x781b('0x11'))['toString']();}}}; \ No newline at end of file +var _0xed3c=['toString','closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','STRING','setDataValue','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm'];(function(_0x874a49,_0x5b07bc){var _0x343d2f=function(_0x351928){while(--_0x351928){_0x874a49['push'](_0x874a49['shift']());}};_0x343d2f(++_0x5b07bc);}(_0xed3c,0x1a6));var _0xced3=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0xed3c[_0x545a3a];return _0x5a5493;};'use strict';var Sequelize=require(_0xced3('0x0'));var moment=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var config=require(_0xced3('0x3'));module['exports']={'format':{'type':Sequelize[_0xced3('0x4')],'get':function(){return this[_0xced3('0x5')](_0xced3('0x6'))?path['extname'](this['getDataValue'](_0xced3('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xced3('0x7')]},'channel':{'type':Sequelize[_0xced3('0x7')]},'value':{'type':Sequelize[_0xced3('0x7')],'set':function(_0x4795cd){var _0x510164=_0x4795cd['replace'](/\\/g,'/');this[_0xced3('0x8')]('value',_0x510164);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x19a727){this[_0xced3('0x8')](_0xced3('0x9'),moment()[_0xced3('0xa')](_0x19a727,'ms'));this[_0xced3('0x8')]('closedAt',moment());this[_0xced3('0x8')](_0xced3('0xb'),_0x19a727);}},'startedAt':{'type':Sequelize[_0xced3('0xc')],'get':function(){return moment(this['getDataValue'](_0xced3('0x9')))[_0xced3('0xd')](_0xced3('0xe'))[_0xced3('0xf')]();}},'closedAt':{'type':Sequelize[_0xced3('0xc')],'get':function(){return moment(this[_0xced3('0x5')](_0xced3('0x10')))['format'](_0xced3('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xced3('0xc')],'get':function(){return moment(this[_0xced3('0x5')](_0xced3('0x11')))[_0xced3('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xced3('0xf')]();}},'updatedAt':{'type':Sequelize[_0xced3('0xc')],'get':function(){return moment(this['getDataValue'](_0xced3('0x12')))[_0xced3('0xd')](_0xced3('0xe'))[_0xced3('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e6c71d6..5a3700e 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 _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x2c3361,_0x1d4a37){var _0x3f4b67=function(_0x319cf1){while(--_0x319cf1){_0x2c3361['push'](_0x2c3361['shift']());}};_0x3f4b67(++_0x1d4a37);}(_0x5c12,0x188));var _0x25c1=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x5c12[_0x29c261];return _0x1a9335;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file +var _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x39c7c8,_0x13bad1){var _0x16392e=function(_0x522a1a){while(--_0x522a1a){_0x39c7c8['push'](_0x39c7c8['shift']());}};_0x16392e(++_0x13bad1);}(_0x3e74,0x175));var _0x43e7=function(_0x1ae48a,_0x284cf8){_0x1ae48a=_0x1ae48a-0x0;var _0x54ceb5=_0x3e74[_0x1ae48a];return _0x54ceb5;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 75422fa..9323296 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 _0xc994=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc994,0x8f));var _0x4c99=function(_0xb4d697,_0x272c87){_0xb4d697=_0xb4d697-0x0;var _0x723a7a=_0xc994[_0xb4d697];return _0x723a7a;};'use strict';var _=require(_0x4c99('0x0'));var util=require('util');var logger=require(_0x4c99('0x1'))(_0x4c99('0x2'));var moment=require(_0x4c99('0x3'));var BPromise=require(_0x4c99('0x4'));var rp=require(_0x4c99('0x5'));var fs=require('fs');var path=require(_0x4c99('0x6'));var rimraf=require(_0x4c99('0x7'));var config=require(_0x4c99('0x8'));var attributes=require(_0x4c99('0x9'));module[_0x4c99('0xa')]=function(_0x3a563c,_0x2f8fbf){return _0x3a563c[_0x4c99('0xb')](_0x4c99('0xc'),attributes,{'tableName':_0x4c99('0xd'),'paranoid':![],'indexes':[{'name':_0x4c99('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b33=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x373876,_0x37c91a){var _0x2219d9=function(_0x38a83c){while(--_0x38a83c){_0x373876['push'](_0x373876['shift']());}};_0x2219d9(++_0x37c91a);}(_0x5b33,0x1d1));var _0x35b3=function(_0x2a2821,_0x21c657){_0x2a2821=_0x2a2821-0x0;var _0x40b0b6=_0x5b33[_0x2a2821];return _0x40b0b6;};'use strict';var _=require(_0x35b3('0x0'));var util=require(_0x35b3('0x1'));var logger=require(_0x35b3('0x2'))(_0x35b3('0x3'));var moment=require(_0x35b3('0x4'));var BPromise=require(_0x35b3('0x5'));var rp=require(_0x35b3('0x6'));var fs=require('fs');var path=require(_0x35b3('0x7'));var rimraf=require('rimraf');var config=require(_0x35b3('0x8'));var attributes=require('./screenRecording.attributes');module[_0x35b3('0x9')]=function(_0x4295b8,_0x47b972){return _0x4295b8[_0x35b3('0xa')](_0x35b3('0xb'),attributes,{'tableName':_0x35b3('0xc'),'paranoid':![],'indexes':[{'name':_0x35b3('0xd'),'fields':[_0x35b3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8d89f5c..1b4b832 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 _0xa36d=['debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xa36d,0x118));var _0xda36=function(_0x168cdd,_0x342cc9){_0x168cdd=_0x168cdd-0x0;var _0x2dfc0c=_0xa36d[_0x168cdd];return _0x2dfc0c;};'use strict';var _=require(_0xda36('0x0'));var util=require(_0xda36('0x1'));var moment=require(_0xda36('0x2'));var BPromise=require('bluebird');var rs=require(_0xda36('0x3'));var fs=require('fs');var Redis=require(_0xda36('0x4'));var db=require(_0xda36('0x5'))['db'];var utils=require(_0xda36('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xda36('0x7'));var jayson=require(_0xda36('0x8'));var client=jayson[_0xda36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f68fb,_0x7097f4,_0x57984b){return new BPromise(function(_0x47289b,_0x3ed323){return client[_0xda36('0xa')](_0x1f68fb,_0x57984b)[_0xda36('0xb')](function(_0x14ad9f){logger['info'](_0xda36('0xc'),_0x7097f4,_0xda36('0xd'));logger[_0xda36('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x7097f4,_0xda36('0xd'),JSON[_0xda36('0xf')](_0x14ad9f));if(_0x14ad9f[_0xda36('0x10')]){if(_0x14ad9f[_0xda36('0x10')]['code']===0x1f4){logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x14ad9f['error']['message']);return _0x3ed323(_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);}logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);return _0x47289b(_0x14ad9f[_0xda36('0x10')][_0xda36('0x11')]);}else{logger[_0xda36('0x12')](_0xda36('0xc'),_0x7097f4,'request\x20sent');_0x47289b(_0x14ad9f[_0xda36('0x13')][_0xda36('0x11')]);}})[_0xda36('0x14')](function(_0x2016b4){logger[_0xda36('0x10')](_0xda36('0xc'),_0x7097f4,_0x2016b4);_0x3ed323(_0x2016b4);});});} \ No newline at end of file +var _0xa7f3=['message','ScreenRecording,\x20%s,\x20%s','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7f3,0x190));var _0x3a7f=function(_0x5f46a2,_0x24d125){_0x5f46a2=_0x5f46a2-0x0;var _0x273959=_0xa7f3[_0x5f46a2];return _0x273959;};'use strict';var _=require('lodash');var util=require(_0x3a7f('0x0'));var moment=require(_0x3a7f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a7f('0x2'))['db'];var utils=require(_0x3a7f('0x3'));var logger=require(_0x3a7f('0x4'))(_0x3a7f('0x5'));var config=require(_0x3a7f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a7f('0x7')][_0x3a7f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b70eb,_0x145ca8,_0x24a84c){return new BPromise(function(_0x562bc9,_0x5345cf){return client[_0x3a7f('0x9')](_0x1b70eb,_0x24a84c)[_0x3a7f('0xa')](function(_0xc86282){logger[_0x3a7f('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x145ca8,_0x3a7f('0xc'));logger[_0x3a7f('0xd')](_0x3a7f('0xe'),_0x145ca8,'request\x20sent',JSON[_0x3a7f('0xf')](_0xc86282));if(_0xc86282['error']){if(_0xc86282[_0x3a7f('0x10')][_0x3a7f('0x11')]===0x1f4){logger[_0x3a7f('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x145ca8,_0xc86282[_0x3a7f('0x10')][_0x3a7f('0x12')]);return _0x5345cf(_0xc86282[_0x3a7f('0x10')][_0x3a7f('0x12')]);}logger['error'](_0x3a7f('0x13'),_0x145ca8,_0xc86282['error'][_0x3a7f('0x12')]);return _0x562bc9(_0xc86282['error'][_0x3a7f('0x12')]);}else{logger['info'](_0x3a7f('0x13'),_0x145ca8,_0x3a7f('0xc'));_0x562bc9(_0xc86282[_0x3a7f('0x14')]['message']);}})[_0x3a7f('0x15')](function(_0x526bde){logger[_0x3a7f('0x10')](_0x3a7f('0x13'),_0x145ca8,_0x526bde);_0x5345cf(_0x526bde);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 81abecf..5fe5f78 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 _0x2e89=['post','single','file','addLogo','diskStorage','root','%s%s','logologin','originalname','addLogoLogin','join','server/files/images/logos/','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','/now','getDate','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','format','logo','extname'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0x2e89,0x11b));var _0x92e8=function(_0xfba164,_0x2e0f4f){_0xfba164=_0xfba164-0x0;var _0x1681dc=_0x2e89[_0xfba164];return _0x1681dc;};'use strict';var multer=require(_0x92e8('0x0'));var util=require('util');var path=require(_0x92e8('0x1'));var timeout=require(_0x92e8('0x2'));var express=require('express');var router=express[_0x92e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x92e8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x92e8('0x5'));var controller=require(_0x92e8('0x6'));router['get']('/',auth[_0x92e8('0x7')](),controller[_0x92e8('0x8')]);router['get'](_0x92e8('0x9'),controller[_0x92e8('0xa')]);router[_0x92e8('0xb')](_0x92e8('0xc'),controller[_0x92e8('0xd')]);router[_0x92e8('0xb')](_0x92e8('0xe'),controller[_0x92e8('0xf')]);router[_0x92e8('0xb')](_0x92e8('0x10'),controller[_0x92e8('0x11')]);router[_0x92e8('0xb')](_0x92e8('0x12'),controller['gdpr']);router[_0x92e8('0xb')](_0x92e8('0x13'),controller[_0x92e8('0x14')]);router['get'](_0x92e8('0x15'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15e0a5,_0xb1b6a4,_0x5950f0){_0x5950f0(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x35268d,_0x1698d6,_0x298ef2){_0x298ef2(null,util[_0x92e8('0x16')]('%s%s',_0x92e8('0x17'),path[_0x92e8('0x18')](_0x1698d6['originalname'])));}})});router[_0x92e8('0x19')](_0x92e8('0xe'),upload[_0x92e8('0x1a')](_0x92e8('0x1b')),controller[_0x92e8('0x1c')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0xffd218,_0x382ff0,_0x2fa672){_0x2fa672(null,path['join'](config[_0x92e8('0x1e')],'server/files/images/logos/'));},'filename':function(_0x3fe7ce,_0x26f99d,_0xf606a1){_0xf606a1(null,util[_0x92e8('0x16')](_0x92e8('0x1f'),_0x92e8('0x20'),path['extname'](_0x26f99d[_0x92e8('0x21')])));}})});router['post'](_0x92e8('0x10'),upload[_0x92e8('0x1a')]('file'),controller[_0x92e8('0x22')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0x46d7df,_0x2751a7,_0x4ff126){_0x4ff126(null,path[_0x92e8('0x23')](config[_0x92e8('0x1e')],_0x92e8('0x24')));},'filename':function(_0x5cf85e,_0x3c7d39,_0x482142){_0x482142(null,util['format'](_0x92e8('0x1f'),_0x92e8('0x25'),path[_0x92e8('0x18')](_0x3c7d39[_0x92e8('0x21')])));}})});router['post'](_0x92e8('0x13'),upload['single'](_0x92e8('0x1b')),controller[_0x92e8('0x26')]);var upload=multer({'storage':multer[_0x92e8('0x1d')]({'destination':function(_0x4934b4,_0x43d84d,_0x4e4495){_0x4e4495(null,path[_0x92e8('0x23')](config[_0x92e8('0x1e')],'server/files/images/logos/'));},'filename':function(_0x58b013,_0x295ba0,_0x5e9034){_0x5e9034(null,util['format'](_0x92e8('0x1f'),_0x92e8('0x27'),path['extname'](_0x295ba0[_0x92e8('0x21')])));}})});router[_0x92e8('0x19')](_0x92e8('0x15'),upload[_0x92e8('0x1a')](_0x92e8('0x1b')),controller[_0x92e8('0x28')]);router[_0x92e8('0x29')](_0x92e8('0xc'),auth[_0x92e8('0x7')](),controller[_0x92e8('0x2a')]);module[_0x92e8('0x2b')]=router; \ No newline at end of file +var _0x15d7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','diskStorage','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x15d7,0x1db));var _0x715d=function(_0x5ebb15,_0x5807dd){_0x5ebb15=_0x5ebb15-0x0;var _0x2b3160=_0x15d7[_0x5ebb15];return _0x2b3160;};'use strict';var multer=require(_0x715d('0x0'));var util=require(_0x715d('0x1'));var path=require(_0x715d('0x2'));var timeout=require(_0x715d('0x3'));var express=require('express');var router=express[_0x715d('0x4')]();var fs_extra=require(_0x715d('0x5'));var auth=require(_0x715d('0x6'));var interaction=require(_0x715d('0x7'));var config=require(_0x715d('0x8'));var controller=require(_0x715d('0x9'));router[_0x715d('0xa')]('/',auth[_0x715d('0xb')](),controller[_0x715d('0xc')]);router[_0x715d('0xa')](_0x715d('0xd'),controller[_0x715d('0xe')]);router[_0x715d('0xa')](_0x715d('0xf'),controller[_0x715d('0x10')]);router[_0x715d('0xa')](_0x715d('0x11'),controller[_0x715d('0x12')]);router[_0x715d('0xa')](_0x715d('0x13'),controller[_0x715d('0x14')]);router['get'](_0x715d('0x15'),controller[_0x715d('0x16')]);router[_0x715d('0xa')](_0x715d('0x17'),controller['getPreferred']);router[_0x715d('0xa')](_0x715d('0x18'),controller[_0x715d('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d7156,_0x37a7ad,_0xe6fe00){_0xe6fe00(null,path[_0x715d('0x1a')](config[_0x715d('0x1b')],_0x715d('0x1c')));},'filename':function(_0x1cffc2,_0x111842,_0x288eca){_0x288eca(null,util[_0x715d('0x1d')](_0x715d('0x1e'),_0x715d('0x1f'),path[_0x715d('0x20')](_0x111842[_0x715d('0x21')])));}})});router[_0x715d('0x22')]('/:id/logo',upload[_0x715d('0x23')](_0x715d('0x24')),controller[_0x715d('0x25')]);var upload=multer({'storage':multer[_0x715d('0x26')]({'destination':function(_0xa8a6e,_0x169510,_0x9cbc97){_0x9cbc97(null,path[_0x715d('0x1a')](config[_0x715d('0x1b')],_0x715d('0x1c')));},'filename':function(_0x4bb7ac,_0x2ecf0d,_0x3aaa86){_0x3aaa86(null,util[_0x715d('0x1d')](_0x715d('0x1e'),_0x715d('0x27'),path[_0x715d('0x20')](_0x2ecf0d[_0x715d('0x21')])));}})});router[_0x715d('0x22')](_0x715d('0x13'),upload[_0x715d('0x23')](_0x715d('0x24')),controller[_0x715d('0x28')]);var upload=multer({'storage':multer[_0x715d('0x26')]({'destination':function(_0xdaf4b6,_0x1f04f9,_0x1b7a77){_0x1b7a77(null,path[_0x715d('0x1a')](config[_0x715d('0x1b')],_0x715d('0x1c')));},'filename':function(_0x279130,_0x4120b7,_0x3faa45){_0x3faa45(null,util[_0x715d('0x1d')](_0x715d('0x1e'),_0x715d('0x29'),path[_0x715d('0x20')](_0x4120b7[_0x715d('0x21')])));}})});router[_0x715d('0x22')](_0x715d('0x17'),upload[_0x715d('0x23')](_0x715d('0x24')),controller[_0x715d('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4918d1,_0x3314fd,_0x32b1e6){_0x32b1e6(null,path['join'](config[_0x715d('0x1b')],_0x715d('0x1c')));},'filename':function(_0xaa28ff,_0x46e808,_0x1d8b5f){_0x1d8b5f(null,util['format'](_0x715d('0x1e'),_0x715d('0x2b'),path['extname'](_0x46e808[_0x715d('0x21')])));}})});router[_0x715d('0x22')](_0x715d('0x18'),upload['single'](_0x715d('0x24')),controller[_0x715d('0x2c')]);router[_0x715d('0x2d')](_0x715d('0xf'),auth[_0x715d('0xb')](),controller[_0x715d('0x2e')]);module[_0x715d('0x2f')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1c6826e..94624a6 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(_0x3d9591,_0x582e1d){var _0x190caf=function(_0x16a294){while(--_0x16a294){_0x3d9591['push'](_0x3d9591['shift']());}};_0x190caf(++_0x582e1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x32b79d,_0x5276a6){var _0xb45bb=function(_0x2905d3){while(--_0x2905d3){_0x32b79d['push'](_0x32b79d['shift']());}};_0xb45bb(++_0x5276a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 cc53bbf..398c02c 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 _0x0911=['pick','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','merge','find','body','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','default','ValidationError','gdpr','addPreferred','getPreferred','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','http','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fd89e,_0x22f444){var _0x2b1c6e=function(_0x2c0ee1){while(--_0x2c0ee1){_0x4fd89e['push'](_0x4fd89e['shift']());}};_0x2b1c6e(++_0x22f444);}(_0x0911,0x1a9));var _0x1091=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0x0911[_0x2336ea];return _0x216bf9;};'use strict';var emlformat=require(_0x1091('0x0'));var rimraf=require(_0x1091('0x1'));var zipdir=require(_0x1091('0x2'));var jsonpatch=require(_0x1091('0x3'));var rp=require(_0x1091('0x4'));var moment=require('moment');var BPromise=require(_0x1091('0x5'));var Mustache=require('mustache');var util=require(_0x1091('0x6'));var path=require(_0x1091('0x7'));var sox=require(_0x1091('0x8'));var csv=require(_0x1091('0x9'));var ejs=require(_0x1091('0xa'));var fs=require('fs');var fs_extra=require(_0x1091('0xb'));var _=require(_0x1091('0xc'));var squel=require(_0x1091('0xd'));var crypto=require(_0x1091('0xe'));var jsforce=require(_0x1091('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1091('0x9'));var querystring=require(_0x1091('0x10'));var Papa=require(_0x1091('0x11'));var Redis=require(_0x1091('0x12'));var authService=require(_0x1091('0x13'));var qs=require(_0x1091('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1091('0x15'));var logger=require(_0x1091('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1091('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1091('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1091('0x19')][_0x1091('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x390560,_0x3edbba,_0x5c3f22,_0x36aff0){return new BPromise(function(_0x11c894,_0x5d34e7){var _0x5815db=_0x36aff0||client;return _0x5815db['request'](_0x390560,_0x5c3f22)['then'](function(_0x4483c4){logger[_0x1091('0x1b')](_0x1091('0x1c'),_0x3edbba,'request\x20sent');logger[_0x1091('0x1d')](_0x1091('0x1e'),_0x3edbba,_0x1091('0x1f'),JSON[_0x1091('0x20')](_0x4483c4));if(_0x4483c4[_0x1091('0x21')]){if(_0x4483c4['error'][_0x1091('0x22')]===0x1f4){logger[_0x1091('0x21')](_0x1091('0x1c'),_0x3edbba,_0x4483c4[_0x1091('0x21')][_0x1091('0x23')]);return _0x5d34e7(_0x4483c4['error'][_0x1091('0x23')]);}logger[_0x1091('0x21')]('Setting,\x20%s,\x20%s',_0x3edbba,_0x4483c4['error']['message']);return _0x11c894(_0x4483c4[_0x1091('0x21')][_0x1091('0x23')]);}else{logger[_0x1091('0x1b')](_0x1091('0x1c'),_0x3edbba,_0x1091('0x1f'));_0x11c894(_0x4483c4[_0x1091('0x24')][_0x1091('0x23')]);}})[_0x1091('0x25')](function(_0x3daff2){logger[_0x1091('0x21')](_0x1091('0x1c'),_0x3edbba,_0x3daff2);_0x5d34e7(_0x3daff2);});});}function respondWithStatusCode(_0x197355,_0x1925fc){_0x1925fc=_0x1925fc||0xcc;return function(_0x142597){if(_0x142597){return _0x197355[_0x1091('0x26')](_0x1925fc);}return _0x197355[_0x1091('0x27')](_0x1925fc)['end']();};}function respondWithResult(_0xc14e93,_0x3667a7){_0x3667a7=_0x3667a7||0xc8;return function(_0x266d34){if(_0x266d34){return _0xc14e93['status'](_0x3667a7)[_0x1091('0x28')](_0x266d34);}};}function respondWithFilteredResult(_0x598216,_0x26c91b){return function(_0x306165){if(_0x306165){var _0x15eb8d=typeof _0x26c91b[_0x1091('0x29')]==='undefined'&&typeof _0x26c91b[_0x1091('0x2a')]===_0x1091('0x2b');var _0x35ecdc=_0x306165[_0x1091('0x2c')];var _0x17e118=_0x15eb8d?0x0:_0x26c91b[_0x1091('0x29')];var _0x56dc27=_0x15eb8d?_0x306165[_0x1091('0x2c')]:_0x26c91b[_0x1091('0x29')]+_0x26c91b[_0x1091('0x2a')];var _0x39326e;if(_0x56dc27>=_0x35ecdc){_0x56dc27=_0x35ecdc;_0x39326e=0xc8;}else{_0x39326e=0xce;}_0x598216['status'](_0x39326e);return _0x598216['set'](_0x1091('0x2d'),_0x17e118+'-'+_0x56dc27+'/'+_0x35ecdc)[_0x1091('0x28')](_0x306165);}return null;};}function patchUpdates(_0xa8d68e){return function(_0x4592d2){try{jsonpatch['apply'](_0x4592d2,_0xa8d68e,!![]);}catch(_0x5995ec){return BPromise[_0x1091('0x2e')](_0x5995ec);}return _0x4592d2['save']();};}function saveUpdates(_0x55e2d3,_0x109602){return function(_0xc5af40){if(_0xc5af40){return _0xc5af40[_0x1091('0x2f')](_0x55e2d3)[_0x1091('0x30')](function(_0x2a5f0a){return _0x2a5f0a;});}return null;};}function removeEntity(_0x1354d1,_0x5a6a15){return function(_0x3b739a){if(_0x3b739a){return _0x3b739a[_0x1091('0x31')]()[_0x1091('0x30')](function(){_0x1354d1[_0x1091('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x105204,_0x60eaa){return function(_0x4a4d88){if(!_0x4a4d88){_0x105204[_0x1091('0x26')](0x194);}return _0x4a4d88;};}function handleError(_0x3a2372,_0x3b552e){_0x3b552e=_0x3b552e||0x1f4;return function(_0x5bc0ba){logger[_0x1091('0x21')](_0x5bc0ba[_0x1091('0x32')]);if(_0x5bc0ba['name']){delete _0x5bc0ba[_0x1091('0x33')];}_0x3a2372[_0x1091('0x27')](_0x3b552e)[_0x1091('0x34')](_0x5bc0ba);};}exports[_0x1091('0x35')]=function(_0x59287c,_0x5abc3e){var _0x4759b7={},_0x8ff924={},_0x4bb745={'count':0x0,'rows':[]};var _0x1e09db=_[_0x1091('0x36')](db[_0x1091('0x37')]['rawAttributes'],function(_0x21a724){return{'name':_0x21a724[_0x1091('0x38')],'type':_0x21a724[_0x1091('0x39')][_0x1091('0x3a')]};});_0x8ff924[_0x1091('0x3b')]=_[_0x1091('0x36')](_0x1e09db,'name');_0x8ff924[_0x1091('0x3c')]=_[_0x1091('0x3d')](_0x59287c[_0x1091('0x3c')]);_0x8ff924['filters']=_[_0x1091('0x3e')](_0x8ff924[_0x1091('0x3b')],_0x8ff924[_0x1091('0x3c')]);_0x4759b7[_0x1091('0x3f')]=_[_0x1091('0x3e')](_0x8ff924[_0x1091('0x3b')],qs[_0x1091('0x40')](_0x59287c['query'][_0x1091('0x40')]));_0x4759b7[_0x1091('0x3f')]=_0x4759b7[_0x1091('0x3f')]['length']?_0x4759b7[_0x1091('0x3f')]:_0x8ff924['model'];if(!_0x59287c[_0x1091('0x3c')][_0x1091('0x41')](_0x1091('0x42'))){_0x4759b7[_0x1091('0x2a')]=qs[_0x1091('0x2a')](_0x59287c[_0x1091('0x3c')][_0x1091('0x2a')]);_0x4759b7['offset']=qs[_0x1091('0x29')](_0x59287c[_0x1091('0x3c')]['offset']);}_0x4759b7[_0x1091('0x43')]=qs[_0x1091('0x44')](_0x59287c[_0x1091('0x3c')]['sort']);_0x4759b7[_0x1091('0x45')]=qs[_0x1091('0x46')](_[_0x1091('0x47')](_0x59287c[_0x1091('0x3c')],_0x8ff924[_0x1091('0x46')]),_0x1e09db);if(_0x59287c['query']['filter']){_0x4759b7['where']=_['merge'](_0x4759b7[_0x1091('0x45')],{'$or':_[_0x1091('0x36')](_0x1e09db,function(_0x3074f3){if(_0x3074f3[_0x1091('0x39')]!==_0x1091('0x48')){var _0x316ffa={};_0x316ffa[_0x3074f3[_0x1091('0x33')]]={'$like':'%'+_0x59287c[_0x1091('0x3c')]['filter']+'%'};return _0x316ffa;}})});}_0x4759b7=_['merge']({},_0x4759b7,_0x59287c[_0x1091('0x49')]);var _0x2b90e5={'where':_0x4759b7[_0x1091('0x45')]};return db[_0x1091('0x37')][_0x1091('0x2c')](_0x2b90e5)['then'](function(_0x2e58aa){_0x4bb745['count']=_0x2e58aa;if(_0x59287c[_0x1091('0x3c')][_0x1091('0x4a')]){_0x4759b7[_0x1091('0x4b')]=[{'all':!![]}];}return db[_0x1091('0x37')][_0x1091('0x4c')](_0x4759b7);})[_0x1091('0x30')](function(_0x4fc761){_0x4bb745[_0x1091('0x4d')]=_0x4fc761;return _0x4bb745;})[_0x1091('0x30')](respondWithFilteredResult(_0x5abc3e,_0x4759b7))[_0x1091('0x25')](handleError(_0x5abc3e,null));};exports[_0x1091('0x4e')]=function(_0x120884,_0xd3e976){var _0x4bc74f={'raw':![],'where':{'id':_0x120884[_0x1091('0x4f')]['id']}},_0x36f93a={};_0x36f93a[_0x1091('0x3b')]=_[_0x1091('0x3d')](db[_0x1091('0x37')][_0x1091('0x50')]);_0x36f93a[_0x1091('0x3c')]=_[_0x1091('0x3d')](_0x120884[_0x1091('0x3c')]);_0x36f93a[_0x1091('0x46')]=_[_0x1091('0x3e')](_0x36f93a[_0x1091('0x3b')],_0x36f93a[_0x1091('0x3c')]);_0x4bc74f[_0x1091('0x3f')]=_[_0x1091('0x3e')](_0x36f93a[_0x1091('0x3b')],qs[_0x1091('0x40')](_0x120884[_0x1091('0x3c')][_0x1091('0x40')]));_0x4bc74f['attributes']=_0x4bc74f['attributes'][_0x1091('0x51')]?_0x4bc74f[_0x1091('0x3f')]:_0x36f93a[_0x1091('0x3b')];if(_0x120884[_0x1091('0x3c')][_0x1091('0x4a')]){_0x4bc74f['include']=[{'all':!![]}];}_0x4bc74f=_[_0x1091('0x52')]({},_0x4bc74f,_0x120884[_0x1091('0x49')]);return db[_0x1091('0x37')][_0x1091('0x53')](_0x4bc74f)[_0x1091('0x30')](handleEntityNotFound(_0xd3e976,null))['then'](respondWithResult(_0xd3e976,null))[_0x1091('0x25')](handleError(_0xd3e976,null));};exports[_0x1091('0x2f')]=function(_0x4aad78,_0x1bd8c0){if(_0x4aad78['body']['id']){delete _0x4aad78['body']['id'];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x4aad78[_0x1091('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1bd8c0,null))[_0x1091('0x30')](saveUpdates(_0x4aad78[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x1bd8c0,null))[_0x1091('0x25')](handleError(_0x1bd8c0,null));};exports[_0x1091('0x55')]=function(_0x34f2ae,_0x367cdf,_0x582111){if(_0x34f2ae[_0x1091('0x56')]&&_0x34f2ae[_0x1091('0x56')][_0x1091('0x57')]){_0x34f2ae[_0x1091('0x54')]['logo']=_0x34f2ae[_0x1091('0x56')][_0x1091('0x57')];}return db['Setting'][_0x1091('0x53')]({'where':{'id':_0x34f2ae['params']['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x367cdf,null))[_0x1091('0x30')](saveUpdates(_0x34f2ae[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x367cdf,null))[_0x1091('0x25')](handleError(_0x367cdf,null));};exports['addLogoLogin']=function(_0x1b6219,_0x165ca4,_0x4cafb2){if(_0x1b6219['file']&&_0x1b6219[_0x1091('0x56')]['filename']){_0x1b6219[_0x1091('0x54')][_0x1091('0x58')]=_0x1b6219[_0x1091('0x56')][_0x1091('0x57')];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x1b6219['params']['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x165ca4,null))[_0x1091('0x30')](saveUpdates(_0x1b6219[_0x1091('0x54')],null))['then'](respondWithResult(_0x165ca4,null))['catch'](handleError(_0x165ca4,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x5a')]=function(_0x201647,_0x27fd58,_0x109aa4){var _0x40fc12='server/files/images/logos';var _0x3fbf11={'custom':![]};return utilLicense[_0x1091('0x5b')]()['then'](function(_0x43d361){if(_0x43d361){_0x3fbf11=_0x43d361;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x201647['params']['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),_0x1091('0x5e'),_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x27fd58,null))['then'](function(_0x491e19){if(_0x491e19){var _0x2ea4cd=_0x491e19[_0x1091('0x5c')]&&fs[_0x1091('0x63')](path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x491e19[_0x1091('0x5c')])))?path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x491e19['logo'])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_[_0x1091('0x66')](_0x1091('0x67')));var _0x1e691b='default'+_[_0x1091('0x68')](_0x1091('0x5c'));if(_0x491e19[_0x1e691b]||!_0x3fbf11[_0x1091('0x69')]){_0x2ea4cd=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x40fc12,_['toLower']('default_logo.svg'));}if(!fs[_0x1091('0x63')](_0x2ea4cd)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')]('logo')+_0x1091('0x6b'));}return _0x27fd58[_0x1091('0x6c')](_0x2ea4cd);}})['catch'](handleError(_0x27fd58,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x6d')]=function(_0x3770a1,_0x33c4db,_0x2b24a0){var _0x2f905f=_0x1091('0x6e');var _0x3c5714={'custom':![]};return utilLicense[_0x1091('0x5b')]()[_0x1091('0x30')](function(_0x2df47a){if(_0x2df47a){_0x3c5714=_0x2df47a;}return db['Setting'][_0x1091('0x53')]({'where':{'id':_0x3770a1[_0x1091('0x4f')]['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),_0x1091('0x5e'),_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})[_0x1091('0x30')](handleEntityNotFound(_0x33c4db,null))[_0x1091('0x30')](function(_0x405674){if(_0x405674){var _0x408713=_0x405674[_0x1091('0x58')]&&fs[_0x1091('0x63')](path['join'](config[_0x1091('0x65')],_0x2f905f,_[_0x1091('0x66')](_0x405674['loginLogo'])))?path[_0x1091('0x64')](config['root'],_0x2f905f,_['toLower'](_0x405674[_0x1091('0x58')])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x2f905f,_[_0x1091('0x66')](_0x1091('0x6f')));var _0x39b3b2=_0x1091('0x70')+_[_0x1091('0x68')](_0x1091('0x58'));if(_0x405674[_0x39b3b2]||!_0x3c5714['custom']){_0x408713=path['join'](config[_0x1091('0x65')],_0x2f905f,_['toLower'](_0x1091('0x6f')));}if(!fs['existsSync'](_0x408713)){throw new db['Sequelize'][(_0x1091('0x71'))](_['upperFirst'](_0x1091('0x58'))+_0x1091('0x6b'));}return _0x33c4db[_0x1091('0x6c')](_0x408713);}})[_0x1091('0x25')](handleError(_0x33c4db,null));};exports[_0x1091('0x72')]=function(_0x2c320b,_0x305f8e){return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x2c320b[_0x1091('0x4f')]['id']},'attributes':['securePassword']})[_0x1091('0x30')](respondWithResult(_0x305f8e,null))[_0x1091('0x25')](handleError(_0x305f8e,null));};exports[_0x1091('0x73')]=function(_0x30d952,_0x3db063,_0x47353c){if(_0x30d952['file']&&_0x30d952['file'][_0x1091('0x57')]){_0x30d952[_0x1091('0x54')][_0x1091('0x5d')]=_0x30d952[_0x1091('0x56')][_0x1091('0x57')];}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x30d952[_0x1091('0x4f')]['id']}})[_0x1091('0x30')](handleEntityNotFound(_0x3db063,null))[_0x1091('0x30')](saveUpdates(_0x30d952[_0x1091('0x54')],null))[_0x1091('0x30')](respondWithResult(_0x3db063,null))[_0x1091('0x25')](handleError(_0x3db063,null));};var utilLicense=require(_0x1091('0x59'));exports[_0x1091('0x74')]=function(_0x8779fd,_0x260461,_0x54dbed){var _0x4d9ca9=_0x1091('0x6e');var _0x2dcbae={'custom':![]};return utilLicense[_0x1091('0x5b')]()['then'](function(_0x511132){if(_0x511132){_0x2dcbae=_0x511132;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x8779fd[_0x1091('0x4f')]['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),'favicon',_0x1091('0x5f'),'defaultLoginLogo',_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})[_0x1091('0x30')](handleEntityNotFound(_0x260461,null))[_0x1091('0x30')](function(_0x37c282){if(_0x37c282){var _0x313b37=_0x37c282[_0x1091('0x5d')]&&fs['existsSync'](path[_0x1091('0x64')](config['root'],_0x4d9ca9,_[_0x1091('0x66')](_0x37c282[_0x1091('0x5d')])))?path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_[_0x1091('0x66')](_0x37c282[_0x1091('0x5d')])):path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_[_0x1091('0x66')]('default_preferred.png'));var _0x449d94=_0x1091('0x70')+_['upperFirst']('preferred');if(_0x37c282[_0x449d94]||!_0x2dcbae[_0x1091('0x69')]||!_0x2dcbae[_0x1091('0x5d')]){_0x313b37=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x4d9ca9,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x313b37)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')]('preferred')+_0x1091('0x6b'));}return _0x260461[_0x1091('0x6c')](_0x313b37);}})['catch'](handleError(_0x260461,null));};exports[_0x1091('0x75')]=function(_0x4fdd36,_0x4dcdab,_0x52a5c6){if(_0x4fdd36[_0x1091('0x56')]&&_0x4fdd36[_0x1091('0x56')][_0x1091('0x57')]){_0x4fdd36[_0x1091('0x54')][_0x1091('0x5e')]=_0x4fdd36['file'][_0x1091('0x57')];}return db[_0x1091('0x37')]['find']({'where':{'id':_0x4fdd36[_0x1091('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4dcdab,null))[_0x1091('0x30')](saveUpdates(_0x4fdd36['body'],null))[_0x1091('0x30')](respondWithResult(_0x4dcdab,null))[_0x1091('0x25')](handleError(_0x4dcdab,null));};var utilLicense=require('../../config/license/util');exports[_0x1091('0x76')]=function(_0x4e8286,_0x4f3dc3,_0x38db2f){var _0x5342ab=_0x1091('0x6e');var _0x27a482={'custom':![]};return utilLicense[_0x1091('0x5b')]()[_0x1091('0x30')](function(_0x554660){if(_0x554660){_0x27a482=_0x554660;}return db[_0x1091('0x37')][_0x1091('0x53')]({'where':{'id':_0x4e8286['params']['id']},'attributes':[_0x1091('0x5c'),_0x1091('0x58'),_0x1091('0x5d'),'favicon',_0x1091('0x5f'),_0x1091('0x60'),_0x1091('0x61'),_0x1091('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x4f3dc3,null))['then'](function(_0xe3180c){if(_0xe3180c){var _0x33a6eb=_0xe3180c['favicon']&&fs[_0x1091('0x63')](path[_0x1091('0x64')](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0xe3180c[_0x1091('0x5e')])))?path[_0x1091('0x64')](config['root'],_0x5342ab,_[_0x1091('0x66')](_0xe3180c['favicon'])):path['join'](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0x1091('0x77')));var _0x5e1100=_0x1091('0x70')+_[_0x1091('0x68')](_0x1091('0x5e'));if(_0xe3180c[_0x5e1100]||!_0x27a482['custom']){_0x33a6eb=path[_0x1091('0x64')](config[_0x1091('0x65')],_0x5342ab,_[_0x1091('0x66')](_0x1091('0x77')));}if(!fs[_0x1091('0x63')](_0x33a6eb)){throw new db[(_0x1091('0x6a'))]['ValidationError'](_[_0x1091('0x68')](_0x1091('0x5e'))+_0x1091('0x6b'));}return _0x4f3dc3[_0x1091('0x6c')](_0x33a6eb);}})[_0x1091('0x25')](handleError(_0x4f3dc3,null));};exports[_0x1091('0x78')]=function(_0x42e50f,_0x2a1411){var _0x23828a={'offset':moment()['utcOffset']()};_0x23828a[_0x1091('0x79')]=moment()[_0x1091('0x7a')](_0x23828a[_0x1091('0x29')])[_0x1091('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2a1411[_0x1091('0x27')](0xc8)['send'](_0x23828a);}; \ No newline at end of file +var _0xfb58=['name','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','catch','body','find','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','root','join','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','upperFirst','download','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','request\x20sent','debug','stringify','code','error','message','Setting,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','destroy','stack'];(function(_0x14323d,_0x413eb4){var _0x297d77=function(_0x220e8d){while(--_0x220e8d){_0x14323d['push'](_0x14323d['shift']());}};_0x297d77(++_0x413eb4);}(_0xfb58,0x143));var _0x8fb5=function(_0x4182e5,_0x2cf7de){_0x4182e5=_0x4182e5-0x0;var _0x492d14=_0xfb58[_0x4182e5];return _0x492d14;};'use strict';var emlformat=require(_0x8fb5('0x0'));var rimraf=require(_0x8fb5('0x1'));var zipdir=require(_0x8fb5('0x2'));var jsonpatch=require(_0x8fb5('0x3'));var rp=require('request-promise');var moment=require(_0x8fb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8fb5('0x5'));var util=require('util');var path=require(_0x8fb5('0x6'));var sox=require('sox');var csv=require(_0x8fb5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fb5('0x8'));var _=require('lodash');var squel=require(_0x8fb5('0x9'));var crypto=require('crypto');var jsforce=require(_0x8fb5('0xa'));var deskjs=require(_0x8fb5('0xb'));var toCsv=require(_0x8fb5('0x7'));var querystring=require('querystring');var Papa=require(_0x8fb5('0xc'));var Redis=require(_0x8fb5('0xd'));var authService=require(_0x8fb5('0xe'));var qs=require(_0x8fb5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fb5('0x10'));var logger=require(_0x8fb5('0x11'))(_0x8fb5('0x12'));var utils=require(_0x8fb5('0x13'));var config=require(_0x8fb5('0x14'));var licenseUtil=require(_0x8fb5('0x15'));var db=require(_0x8fb5('0x16'))['db'];var jayson=require(_0x8fb5('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc1c1,_0x24363e,_0x5d237e,_0x4a2003){return new BPromise(function(_0x3b3c8a,_0x55cea1){var _0x4e9878=_0x4a2003||client;return _0x4e9878[_0x8fb5('0x18')](_0x3fc1c1,_0x5d237e)[_0x8fb5('0x19')](function(_0x2b54b0){logger[_0x8fb5('0x1a')]('Setting,\x20%s,\x20%s',_0x24363e,_0x8fb5('0x1b'));logger[_0x8fb5('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x24363e,_0x8fb5('0x1b'),JSON[_0x8fb5('0x1d')](_0x2b54b0));if(_0x2b54b0['error']){if(_0x2b54b0['error'][_0x8fb5('0x1e')]===0x1f4){logger[_0x8fb5('0x1f')]('Setting,\x20%s,\x20%s',_0x24363e,_0x2b54b0[_0x8fb5('0x1f')]['message']);return _0x55cea1(_0x2b54b0['error'][_0x8fb5('0x20')]);}logger[_0x8fb5('0x1f')](_0x8fb5('0x21'),_0x24363e,_0x2b54b0[_0x8fb5('0x1f')][_0x8fb5('0x20')]);return _0x3b3c8a(_0x2b54b0[_0x8fb5('0x1f')]['message']);}else{logger[_0x8fb5('0x1a')]('Setting,\x20%s,\x20%s',_0x24363e,_0x8fb5('0x1b'));_0x3b3c8a(_0x2b54b0[_0x8fb5('0x22')][_0x8fb5('0x20')]);}})['catch'](function(_0x3ff4a9){logger['error']('Setting,\x20%s,\x20%s',_0x24363e,_0x3ff4a9);_0x55cea1(_0x3ff4a9);});});}function respondWithStatusCode(_0x57f6dc,_0x4f4687){_0x4f4687=_0x4f4687||0xcc;return function(_0x28348f){if(_0x28348f){return _0x57f6dc[_0x8fb5('0x23')](_0x4f4687);}return _0x57f6dc[_0x8fb5('0x24')](_0x4f4687)[_0x8fb5('0x25')]();};}function respondWithResult(_0x3d8416,_0x292fad){_0x292fad=_0x292fad||0xc8;return function(_0x40ac62){if(_0x40ac62){return _0x3d8416['status'](_0x292fad)[_0x8fb5('0x26')](_0x40ac62);}};}function respondWithFilteredResult(_0x3957b8,_0xa34579){return function(_0x55b4ed){if(_0x55b4ed){var _0x37ec50=typeof _0xa34579[_0x8fb5('0x27')]==='undefined'&&typeof _0xa34579['limit']==='undefined';var _0x4a7d1b=_0x55b4ed[_0x8fb5('0x28')];var _0x2bec33=_0x37ec50?0x0:_0xa34579[_0x8fb5('0x27')];var _0x16ebb5=_0x37ec50?_0x55b4ed[_0x8fb5('0x28')]:_0xa34579[_0x8fb5('0x27')]+_0xa34579[_0x8fb5('0x29')];var _0x16a2ff;if(_0x16ebb5>=_0x4a7d1b){_0x16ebb5=_0x4a7d1b;_0x16a2ff=0xc8;}else{_0x16a2ff=0xce;}_0x3957b8[_0x8fb5('0x24')](_0x16a2ff);return _0x3957b8[_0x8fb5('0x2a')](_0x8fb5('0x2b'),_0x2bec33+'-'+_0x16ebb5+'/'+_0x4a7d1b)[_0x8fb5('0x26')](_0x55b4ed);}return null;};}function patchUpdates(_0x4596d8){return function(_0x3bc5c7){try{jsonpatch[_0x8fb5('0x2c')](_0x3bc5c7,_0x4596d8,!![]);}catch(_0x54a6c7){return BPromise[_0x8fb5('0x2d')](_0x54a6c7);}return _0x3bc5c7['save']();};}function saveUpdates(_0x3f3375,_0x404fcc){return function(_0x4fda2f){if(_0x4fda2f){return _0x4fda2f[_0x8fb5('0x2e')](_0x3f3375)[_0x8fb5('0x19')](function(_0x123b59){return _0x123b59;});}return null;};}function removeEntity(_0x2ca1ec,_0x1d6595){return function(_0x2b136a){if(_0x2b136a){return _0x2b136a[_0x8fb5('0x2f')]()['then'](function(){_0x2ca1ec[_0x8fb5('0x24')](0xcc)[_0x8fb5('0x25')]();});}};}function handleEntityNotFound(_0x498bae,_0x443b88){return function(_0x111bdf){if(!_0x111bdf){_0x498bae[_0x8fb5('0x23')](0x194);}return _0x111bdf;};}function handleError(_0x145570,_0x145745){_0x145745=_0x145745||0x1f4;return function(_0x22f1a1){logger[_0x8fb5('0x1f')](_0x22f1a1[_0x8fb5('0x30')]);if(_0x22f1a1[_0x8fb5('0x31')]){delete _0x22f1a1[_0x8fb5('0x31')];}_0x145570[_0x8fb5('0x24')](_0x145745)['send'](_0x22f1a1);};}exports['index']=function(_0x41444a,_0x36c5b2){var _0x1bf37b={},_0x2296e9={},_0x57cda5={'count':0x0,'rows':[]};var _0x52396f=_[_0x8fb5('0x32')](db[_0x8fb5('0x33')][_0x8fb5('0x34')],function(_0x52ec54){return{'name':_0x52ec54[_0x8fb5('0x35')],'type':_0x52ec54[_0x8fb5('0x36')][_0x8fb5('0x37')]};});_0x2296e9[_0x8fb5('0x38')]=_['map'](_0x52396f,_0x8fb5('0x31'));_0x2296e9[_0x8fb5('0x39')]=_[_0x8fb5('0x3a')](_0x41444a[_0x8fb5('0x39')]);_0x2296e9['filters']=_[_0x8fb5('0x3b')](_0x2296e9['model'],_0x2296e9[_0x8fb5('0x39')]);_0x1bf37b[_0x8fb5('0x3c')]=_[_0x8fb5('0x3b')](_0x2296e9[_0x8fb5('0x38')],qs['fields'](_0x41444a['query'][_0x8fb5('0x3d')]));_0x1bf37b['attributes']=_0x1bf37b['attributes']['length']?_0x1bf37b[_0x8fb5('0x3c')]:_0x2296e9[_0x8fb5('0x38')];if(!_0x41444a[_0x8fb5('0x39')]['hasOwnProperty'](_0x8fb5('0x3e'))){_0x1bf37b[_0x8fb5('0x29')]=qs[_0x8fb5('0x29')](_0x41444a['query'][_0x8fb5('0x29')]);_0x1bf37b[_0x8fb5('0x27')]=qs[_0x8fb5('0x27')](_0x41444a[_0x8fb5('0x39')]['offset']);}_0x1bf37b[_0x8fb5('0x3f')]=qs[_0x8fb5('0x40')](_0x41444a[_0x8fb5('0x39')][_0x8fb5('0x40')]);_0x1bf37b[_0x8fb5('0x41')]=qs[_0x8fb5('0x42')](_[_0x8fb5('0x43')](_0x41444a[_0x8fb5('0x39')],_0x2296e9['filters']),_0x52396f);if(_0x41444a[_0x8fb5('0x39')][_0x8fb5('0x44')]){_0x1bf37b[_0x8fb5('0x41')]=_['merge'](_0x1bf37b[_0x8fb5('0x41')],{'$or':_['map'](_0x52396f,function(_0x48ba26){if(_0x48ba26[_0x8fb5('0x36')]!==_0x8fb5('0x45')){var _0x64d32d={};_0x64d32d[_0x48ba26[_0x8fb5('0x31')]]={'$like':'%'+_0x41444a[_0x8fb5('0x39')]['filter']+'%'};return _0x64d32d;}})});}_0x1bf37b=_[_0x8fb5('0x46')]({},_0x1bf37b,_0x41444a[_0x8fb5('0x47')]);var _0x123678={'where':_0x1bf37b[_0x8fb5('0x41')]};return db[_0x8fb5('0x33')][_0x8fb5('0x28')](_0x123678)['then'](function(_0xaf0913){_0x57cda5['count']=_0xaf0913;if(_0x41444a['query']['includeAll']){_0x1bf37b[_0x8fb5('0x48')]=[{'all':!![]}];}return db[_0x8fb5('0x33')][_0x8fb5('0x49')](_0x1bf37b);})[_0x8fb5('0x19')](function(_0x11644e){_0x57cda5[_0x8fb5('0x4a')]=_0x11644e;return _0x57cda5;})[_0x8fb5('0x19')](respondWithFilteredResult(_0x36c5b2,_0x1bf37b))['catch'](handleError(_0x36c5b2,null));};exports[_0x8fb5('0x4b')]=function(_0x5d1925,_0x51ce13){var _0x4fd0d7={'raw':![],'where':{'id':_0x5d1925[_0x8fb5('0x4c')]['id']}},_0x4867e6={};_0x4867e6['model']=_[_0x8fb5('0x3a')](db[_0x8fb5('0x33')][_0x8fb5('0x34')]);_0x4867e6[_0x8fb5('0x39')]=_['keys'](_0x5d1925[_0x8fb5('0x39')]);_0x4867e6[_0x8fb5('0x42')]=_['intersection'](_0x4867e6[_0x8fb5('0x38')],_0x4867e6[_0x8fb5('0x39')]);_0x4fd0d7[_0x8fb5('0x3c')]=_[_0x8fb5('0x3b')](_0x4867e6[_0x8fb5('0x38')],qs[_0x8fb5('0x3d')](_0x5d1925[_0x8fb5('0x39')][_0x8fb5('0x3d')]));_0x4fd0d7[_0x8fb5('0x3c')]=_0x4fd0d7[_0x8fb5('0x3c')][_0x8fb5('0x4d')]?_0x4fd0d7[_0x8fb5('0x3c')]:_0x4867e6['model'];if(_0x5d1925[_0x8fb5('0x39')][_0x8fb5('0x4e')]){_0x4fd0d7[_0x8fb5('0x48')]=[{'all':!![]}];}_0x4fd0d7=_[_0x8fb5('0x46')]({},_0x4fd0d7,_0x5d1925[_0x8fb5('0x47')]);return db[_0x8fb5('0x33')]['find'](_0x4fd0d7)[_0x8fb5('0x19')](handleEntityNotFound(_0x51ce13,null))[_0x8fb5('0x19')](respondWithResult(_0x51ce13,null))[_0x8fb5('0x4f')](handleError(_0x51ce13,null));};exports[_0x8fb5('0x2e')]=function(_0x3667bd,_0x32d7aa){if(_0x3667bd[_0x8fb5('0x50')]['id']){delete _0x3667bd[_0x8fb5('0x50')]['id'];}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x3667bd[_0x8fb5('0x4c')]['id']}})[_0x8fb5('0x19')](handleEntityNotFound(_0x32d7aa,null))[_0x8fb5('0x19')](saveUpdates(_0x3667bd[_0x8fb5('0x50')],null))['then'](respondWithResult(_0x32d7aa,null))['catch'](handleError(_0x32d7aa,null));};exports[_0x8fb5('0x52')]=function(_0x1e8316,_0x47ba4d,_0x489a18){if(_0x1e8316[_0x8fb5('0x53')]&&_0x1e8316['file']['filename']){_0x1e8316[_0x8fb5('0x50')]['logo']=_0x1e8316[_0x8fb5('0x53')][_0x8fb5('0x54')];}return db['Setting'][_0x8fb5('0x51')]({'where':{'id':_0x1e8316['params']['id']}})[_0x8fb5('0x19')](handleEntityNotFound(_0x47ba4d,null))['then'](saveUpdates(_0x1e8316[_0x8fb5('0x50')],null))[_0x8fb5('0x19')](respondWithResult(_0x47ba4d,null))[_0x8fb5('0x4f')](handleError(_0x47ba4d,null));};exports[_0x8fb5('0x55')]=function(_0x3f7fc6,_0x1b6092,_0x1dc25b){if(_0x3f7fc6['file']&&_0x3f7fc6[_0x8fb5('0x53')][_0x8fb5('0x54')]){_0x3f7fc6[_0x8fb5('0x50')][_0x8fb5('0x56')]=_0x3f7fc6['file'][_0x8fb5('0x54')];}return db[_0x8fb5('0x33')]['find']({'where':{'id':_0x3f7fc6[_0x8fb5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b6092,null))[_0x8fb5('0x19')](saveUpdates(_0x3f7fc6[_0x8fb5('0x50')],null))[_0x8fb5('0x19')](respondWithResult(_0x1b6092,null))[_0x8fb5('0x4f')](handleError(_0x1b6092,null));};var utilLicense=require(_0x8fb5('0x15'));exports[_0x8fb5('0x57')]=function(_0x5c8b48,_0x167cf7,_0x1f819f){var _0x6c75fd=_0x8fb5('0x58');var _0x1fbacd={'custom':![]};return utilLicense[_0x8fb5('0x59')]()[_0x8fb5('0x19')](function(_0xd8b4df){if(_0xd8b4df){_0x1fbacd=_0xd8b4df;}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x5c8b48['params']['id']},'attributes':[_0x8fb5('0x5a'),'loginLogo',_0x8fb5('0x5b'),_0x8fb5('0x5c'),_0x8fb5('0x5d'),'defaultLoginLogo',_0x8fb5('0x5e'),_0x8fb5('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x167cf7,null))[_0x8fb5('0x19')](function(_0x44db31){if(_0x44db31){var _0x11bbc9=_0x44db31['logo']&&fs[_0x8fb5('0x60')](path['join'](config[_0x8fb5('0x61')],_0x6c75fd,_['toLower'](_0x44db31[_0x8fb5('0x5a')])))?path['join'](config[_0x8fb5('0x61')],_0x6c75fd,_['toLower'](_0x44db31[_0x8fb5('0x5a')])):path[_0x8fb5('0x62')](config['root'],_0x6c75fd,_[_0x8fb5('0x63')](_0x8fb5('0x64')));var _0x261f49=_0x8fb5('0x65')+_['upperFirst'](_0x8fb5('0x5a'));if(_0x44db31[_0x261f49]||!_0x1fbacd[_0x8fb5('0x66')]){_0x11bbc9=path[_0x8fb5('0x62')](config['root'],_0x6c75fd,_[_0x8fb5('0x63')](_0x8fb5('0x64')));}if(!fs[_0x8fb5('0x60')](_0x11bbc9)){throw new db[(_0x8fb5('0x67'))][(_0x8fb5('0x68'))](_['upperFirst'](_0x8fb5('0x5a'))+_0x8fb5('0x69'));}return _0x167cf7['download'](_0x11bbc9);}})[_0x8fb5('0x4f')](handleError(_0x167cf7,null));};var utilLicense=require(_0x8fb5('0x15'));exports[_0x8fb5('0x6a')]=function(_0x297de4,_0x8946be,_0x3b4381){var _0x3bcd86=_0x8fb5('0x58');var _0x36664f={'custom':![]};return utilLicense[_0x8fb5('0x59')]()[_0x8fb5('0x19')](function(_0x5b4384){if(_0x5b4384){_0x36664f=_0x5b4384;}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x297de4[_0x8fb5('0x4c')]['id']},'attributes':[_0x8fb5('0x5a'),_0x8fb5('0x56'),_0x8fb5('0x5b'),'favicon','defaultLogo',_0x8fb5('0x6b'),_0x8fb5('0x5e'),_0x8fb5('0x5f')],'raw':!![]});})[_0x8fb5('0x19')](handleEntityNotFound(_0x8946be,null))['then'](function(_0x2ca5d5){if(_0x2ca5d5){var _0xa053cc=_0x2ca5d5['loginLogo']&&fs[_0x8fb5('0x60')](path[_0x8fb5('0x62')](config[_0x8fb5('0x61')],_0x3bcd86,_[_0x8fb5('0x63')](_0x2ca5d5[_0x8fb5('0x56')])))?path['join'](config[_0x8fb5('0x61')],_0x3bcd86,_[_0x8fb5('0x63')](_0x2ca5d5[_0x8fb5('0x56')])):path['join'](config['root'],_0x3bcd86,_[_0x8fb5('0x63')](_0x8fb5('0x6c')));var _0x17ab41='default'+_[_0x8fb5('0x6d')](_0x8fb5('0x56'));if(_0x2ca5d5[_0x17ab41]||!_0x36664f[_0x8fb5('0x66')]){_0xa053cc=path['join'](config['root'],_0x3bcd86,_[_0x8fb5('0x63')](_0x8fb5('0x6c')));}if(!fs['existsSync'](_0xa053cc)){throw new db[(_0x8fb5('0x67'))]['ValidationError'](_[_0x8fb5('0x6d')](_0x8fb5('0x56'))+'\x20not\x20found');}return _0x8946be[_0x8fb5('0x6e')](_0xa053cc);}})[_0x8fb5('0x4f')](handleError(_0x8946be,null));};exports[_0x8fb5('0x6f')]=function(_0x49b303,_0x4b5113){return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x49b303[_0x8fb5('0x4c')]['id']},'attributes':[_0x8fb5('0x70')]})['then'](respondWithResult(_0x4b5113,null))[_0x8fb5('0x4f')](handleError(_0x4b5113,null));};exports['addPreferred']=function(_0x179ab0,_0x1150cd,_0x3f55e9){if(_0x179ab0[_0x8fb5('0x53')]&&_0x179ab0['file'][_0x8fb5('0x54')]){_0x179ab0[_0x8fb5('0x50')]['preferred']=_0x179ab0[_0x8fb5('0x53')][_0x8fb5('0x54')];}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x179ab0[_0x8fb5('0x4c')]['id']}})[_0x8fb5('0x19')](handleEntityNotFound(_0x1150cd,null))[_0x8fb5('0x19')](saveUpdates(_0x179ab0[_0x8fb5('0x50')],null))[_0x8fb5('0x19')](respondWithResult(_0x1150cd,null))['catch'](handleError(_0x1150cd,null));};var utilLicense=require(_0x8fb5('0x15'));exports[_0x8fb5('0x71')]=function(_0x503703,_0x3eeb7d,_0x28072a){var _0x3734c8='server/files/images/logos';var _0x35b3b2={'custom':![]};return utilLicense[_0x8fb5('0x59')]()[_0x8fb5('0x19')](function(_0x48f110){if(_0x48f110){_0x35b3b2=_0x48f110;}return db[_0x8fb5('0x33')]['find']({'where':{'id':_0x503703[_0x8fb5('0x4c')]['id']},'attributes':['logo',_0x8fb5('0x56'),_0x8fb5('0x5b'),_0x8fb5('0x5c'),'defaultLogo',_0x8fb5('0x6b'),_0x8fb5('0x5e'),_0x8fb5('0x5f')],'raw':!![]});})[_0x8fb5('0x19')](handleEntityNotFound(_0x3eeb7d,null))[_0x8fb5('0x19')](function(_0x38d869){if(_0x38d869){var _0x3fff32=_0x38d869[_0x8fb5('0x5b')]&&fs['existsSync'](path['join'](config[_0x8fb5('0x61')],_0x3734c8,_[_0x8fb5('0x63')](_0x38d869['preferred'])))?path[_0x8fb5('0x62')](config[_0x8fb5('0x61')],_0x3734c8,_[_0x8fb5('0x63')](_0x38d869[_0x8fb5('0x5b')])):path[_0x8fb5('0x62')](config['root'],_0x3734c8,_[_0x8fb5('0x63')](_0x8fb5('0x72')));var _0x8b6e07='default'+_[_0x8fb5('0x6d')](_0x8fb5('0x5b'));if(_0x38d869[_0x8b6e07]||!_0x35b3b2[_0x8fb5('0x66')]||!_0x35b3b2[_0x8fb5('0x5b')]){_0x3fff32=path[_0x8fb5('0x62')](config[_0x8fb5('0x61')],_0x3734c8,_[_0x8fb5('0x63')]('default_preferred.png'));}if(!fs[_0x8fb5('0x60')](_0x3fff32)){throw new db[(_0x8fb5('0x67'))][(_0x8fb5('0x68'))](_[_0x8fb5('0x6d')]('preferred')+_0x8fb5('0x69'));}return _0x3eeb7d[_0x8fb5('0x6e')](_0x3fff32);}})[_0x8fb5('0x4f')](handleError(_0x3eeb7d,null));};exports[_0x8fb5('0x73')]=function(_0x368705,_0x37078d,_0x2a9555){if(_0x368705[_0x8fb5('0x53')]&&_0x368705[_0x8fb5('0x53')][_0x8fb5('0x54')]){_0x368705[_0x8fb5('0x50')][_0x8fb5('0x5c')]=_0x368705[_0x8fb5('0x53')][_0x8fb5('0x54')];}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x368705[_0x8fb5('0x4c')]['id']}})[_0x8fb5('0x19')](handleEntityNotFound(_0x37078d,null))[_0x8fb5('0x19')](saveUpdates(_0x368705['body'],null))[_0x8fb5('0x19')](respondWithResult(_0x37078d,null))[_0x8fb5('0x4f')](handleError(_0x37078d,null));};var utilLicense=require(_0x8fb5('0x15'));exports[_0x8fb5('0x74')]=function(_0x4fb316,_0x2eaa49,_0x2428a3){var _0xf5263f='server/files/images/logos';var _0x36a868={'custom':![]};return utilLicense['getLicense']()[_0x8fb5('0x19')](function(_0x93e7a8){if(_0x93e7a8){_0x36a868=_0x93e7a8;}return db[_0x8fb5('0x33')][_0x8fb5('0x51')]({'where':{'id':_0x4fb316['params']['id']},'attributes':[_0x8fb5('0x5a'),_0x8fb5('0x56'),_0x8fb5('0x5b'),_0x8fb5('0x5c'),_0x8fb5('0x5d'),_0x8fb5('0x6b'),_0x8fb5('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x8fb5('0x19')](handleEntityNotFound(_0x2eaa49,null))[_0x8fb5('0x19')](function(_0x3a633f){if(_0x3a633f){var _0x216e5d=_0x3a633f[_0x8fb5('0x5c')]&&fs[_0x8fb5('0x60')](path['join'](config[_0x8fb5('0x61')],_0xf5263f,_[_0x8fb5('0x63')](_0x3a633f[_0x8fb5('0x5c')])))?path[_0x8fb5('0x62')](config[_0x8fb5('0x61')],_0xf5263f,_[_0x8fb5('0x63')](_0x3a633f[_0x8fb5('0x5c')])):path[_0x8fb5('0x62')](config['root'],_0xf5263f,_[_0x8fb5('0x63')](_0x8fb5('0x75')));var _0x5e7731=_0x8fb5('0x65')+_[_0x8fb5('0x6d')]('favicon');if(_0x3a633f[_0x5e7731]||!_0x36a868[_0x8fb5('0x66')]){_0x216e5d=path[_0x8fb5('0x62')](config[_0x8fb5('0x61')],_0xf5263f,_['toLower']('default_favicon.ico'));}if(!fs[_0x8fb5('0x60')](_0x216e5d)){throw new db[(_0x8fb5('0x67'))]['ValidationError'](_[_0x8fb5('0x6d')]('favicon')+'\x20not\x20found');}return _0x2eaa49[_0x8fb5('0x6e')](_0x216e5d);}})[_0x8fb5('0x4f')](handleError(_0x2eaa49,null));};exports[_0x8fb5('0x76')]=function(_0x13ec6b,_0x523386){var _0x4d1ec7={'offset':moment()[_0x8fb5('0x77')]()};_0x4d1ec7[_0x8fb5('0x78')]=moment()[_0x8fb5('0x77')](_0x4d1ec7[_0x8fb5('0x27')])[_0x8fb5('0x79')](_0x8fb5('0x7a'));return _0x523386[_0x8fb5('0x24')](0xc8)[_0x8fb5('0x7b')](_0x4d1ec7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 7d39b98..2f5cd4e 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(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0x55ca,0x126));var _0xa55c=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x55ca[_0x65cd03];return _0x21c579;};'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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0x7217,0x19e));var _0x7721=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7217[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f6aa33d..0c38adf 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 _0xd587=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','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','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xd587,0x171));var _0x7d58=function(_0x39ffad,_0x57c4a4){_0x39ffad=_0x39ffad-0x0;var _0x343224=_0xd587[_0x39ffad];return _0x343224;};'use strict';var _=require(_0x7d58('0x0'));var util=require('util');var moment=require(_0x7d58('0x1'));var BPromise=require(_0x7d58('0x2'));var rs=require(_0x7d58('0x3'));var fs=require('fs');var Redis=require(_0x7d58('0x4'));var db=require(_0x7d58('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d58('0x6'))('rpc');var config=require(_0x7d58('0x7'));var jayson=require(_0x7d58('0x8'));var client=jayson[_0x7d58('0x9')][_0x7d58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eeead,_0x564dd1,_0xa6507a){return new BPromise(function(_0x3e0323,_0x23edd1){return client[_0x7d58('0xb')](_0x4eeead,_0xa6507a)[_0x7d58('0xc')](function(_0x2d061c){logger[_0x7d58('0xd')](_0x7d58('0xe'),_0x564dd1,_0x7d58('0xf'));logger[_0x7d58('0x10')](_0x7d58('0x11'),_0x564dd1,_0x7d58('0xf'),JSON[_0x7d58('0x12')](_0x2d061c));if(_0x2d061c[_0x7d58('0x13')]){if(_0x2d061c[_0x7d58('0x13')][_0x7d58('0x14')]===0x1f4){logger[_0x7d58('0x13')]('Setting,\x20%s,\x20%s',_0x564dd1,_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);return _0x23edd1(_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);}logger[_0x7d58('0x13')](_0x7d58('0xe'),_0x564dd1,_0x2d061c[_0x7d58('0x13')][_0x7d58('0x15')]);return _0x3e0323(_0x2d061c[_0x7d58('0x13')]['message']);}else{logger['info'](_0x7d58('0xe'),_0x564dd1,'request\x20sent');_0x3e0323(_0x2d061c[_0x7d58('0x16')][_0x7d58('0x15')]);}})[_0x7d58('0x17')](function(_0x457bf3){logger[_0x7d58('0x13')](_0x7d58('0xe'),_0x564dd1,_0x457bf3);_0x23edd1(_0x457bf3);});});}exports[_0x7d58('0x18')]=function(_0x5b634d){var _0x208b38=this;return new Promise(function(_0x4064dc,_0x374b65){return db[_0x7d58('0x19')][_0x7d58('0x1a')]({'raw':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b634d['options']?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1d')]||null:null,'attributes':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1e')]||null:null,'include':_0x5b634d[_0x7d58('0x1b')]?_0x5b634d[_0x7d58('0x1b')][_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x5b634d['options'][_0x7d58('0x1f')],function(_0x1c4c40){return{'model':db[_0x1c4c40['model']],'as':_0x1c4c40['as'],'attributes':_0x1c4c40[_0x7d58('0x1e')],'include':_0x1c4c40[_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x1c4c40[_0x7d58('0x1f')],function(_0x4fe5a0){return{'model':db[_0x4fe5a0['model']],'as':_0x4fe5a0['as'],'attributes':_0x4fe5a0[_0x7d58('0x1e')],'include':_0x4fe5a0[_0x7d58('0x1f')]?_[_0x7d58('0x20')](_0x4fe5a0['include'],function(_0x1942c6){return{'model':db[_0x1942c6[_0x7d58('0x21')]],'as':_0x1942c6['as'],'attributes':_0x1942c6[_0x7d58('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7d58('0xc')](function(_0x5790b2){logger[_0x7d58('0xd')](_0x7d58('0x18'),_0x5b634d);logger['debug'](_0x7d58('0x18'),_0x5b634d,JSON[_0x7d58('0x12')](_0x5790b2));_0x4064dc(_0x5790b2);})[_0x7d58('0x17')](function(_0x27efbd){logger[_0x7d58('0x13')](_0x7d58('0x18'),_0x27efbd['message'],_0x5b634d);_0x374b65(_0x208b38[_0x7d58('0x13')](0x1f4,_0x27efbd[_0x7d58('0x15')]));});});}; \ No newline at end of file +var _0xcc48=['catch','ShowSetting','Setting','options','raw','where','attributes','map','include','model','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','info','result'];(function(_0x8efdd4,_0x1c86b4){var _0x3f2a0c=function(_0x3e7bc7){while(--_0x3e7bc7){_0x8efdd4['push'](_0x8efdd4['shift']());}};_0x3f2a0c(++_0x1c86b4);}(_0xcc48,0x1bc));var _0x8cc4=function(_0x25a964,_0x5f547f){_0x25a964=_0x25a964-0x0;var _0x49c085=_0xcc48[_0x25a964];return _0x49c085;};'use strict';var _=require(_0x8cc4('0x0'));var util=require(_0x8cc4('0x1'));var moment=require(_0x8cc4('0x2'));var BPromise=require('bluebird');var rs=require(_0x8cc4('0x3'));var fs=require('fs');var Redis=require(_0x8cc4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cc4('0x5'));var logger=require('../../config/logger')(_0x8cc4('0x6'));var config=require(_0x8cc4('0x7'));var jayson=require(_0x8cc4('0x8'));var client=jayson['client'][_0x8cc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d64a1,_0x45d507,_0x286378){return new BPromise(function(_0x3a8d2b,_0x332d79){return client[_0x8cc4('0xa')](_0x4d64a1,_0x286378)[_0x8cc4('0xb')](function(_0x66e967){logger['info']('Setting,\x20%s,\x20%s',_0x45d507,_0x8cc4('0xc'));logger[_0x8cc4('0xd')](_0x8cc4('0xe'),_0x45d507,_0x8cc4('0xc'),JSON[_0x8cc4('0xf')](_0x66e967));if(_0x66e967['error']){if(_0x66e967['error']['code']===0x1f4){logger[_0x8cc4('0x10')](_0x8cc4('0x11'),_0x45d507,_0x66e967[_0x8cc4('0x10')]['message']);return _0x332d79(_0x66e967['error'][_0x8cc4('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x45d507,_0x66e967[_0x8cc4('0x10')]['message']);return _0x3a8d2b(_0x66e967['error'][_0x8cc4('0x12')]);}else{logger[_0x8cc4('0x13')](_0x8cc4('0x11'),_0x45d507,_0x8cc4('0xc'));_0x3a8d2b(_0x66e967[_0x8cc4('0x14')]['message']);}})[_0x8cc4('0x15')](function(_0x4388cb){logger[_0x8cc4('0x10')](_0x8cc4('0x11'),_0x45d507,_0x4388cb);_0x332d79(_0x4388cb);});});}exports[_0x8cc4('0x16')]=function(_0x148d55){var _0x2def5a=this;return new Promise(function(_0xf1f4b,_0x138367){return db[_0x8cc4('0x17')]['find']({'raw':_0x148d55[_0x8cc4('0x18')]?_0x148d55[_0x8cc4('0x18')][_0x8cc4('0x19')]===undefined?!![]:![]:!![],'where':_0x148d55[_0x8cc4('0x18')]?_0x148d55[_0x8cc4('0x18')][_0x8cc4('0x1a')]||null:null,'attributes':_0x148d55[_0x8cc4('0x18')]?_0x148d55['options'][_0x8cc4('0x1b')]||null:null,'include':_0x148d55[_0x8cc4('0x18')]?_0x148d55[_0x8cc4('0x18')]['include']?_[_0x8cc4('0x1c')](_0x148d55[_0x8cc4('0x18')][_0x8cc4('0x1d')],function(_0xb6490d){return{'model':db[_0xb6490d[_0x8cc4('0x1e')]],'as':_0xb6490d['as'],'attributes':_0xb6490d['attributes'],'include':_0xb6490d[_0x8cc4('0x1d')]?_[_0x8cc4('0x1c')](_0xb6490d[_0x8cc4('0x1d')],function(_0x18db8a){return{'model':db[_0x18db8a['model']],'as':_0x18db8a['as'],'attributes':_0x18db8a[_0x8cc4('0x1b')],'include':_0x18db8a[_0x8cc4('0x1d')]?_['map'](_0x18db8a[_0x8cc4('0x1d')],function(_0x215fa8){return{'model':db[_0x215fa8['model']],'as':_0x215fa8['as'],'attributes':_0x215fa8[_0x8cc4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf4af2b){logger[_0x8cc4('0x13')](_0x8cc4('0x16'),_0x148d55);logger[_0x8cc4('0xd')](_0x8cc4('0x16'),_0x148d55,JSON[_0x8cc4('0xf')](_0xf4af2b));_0xf1f4b(_0xf4af2b);})[_0x8cc4('0x15')](function(_0x2ad28f){logger[_0x8cc4('0x10')](_0x8cc4('0x16'),_0x2ad28f[_0x8cc4('0x12')],_0x148d55);_0x138367(_0x2def5a[_0x8cc4('0x10')](0x1f4,_0x2ad28f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index dc6efd9..5846c9b 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x44a8d6,_0x325a4a){var _0x4858fa=function(_0x447e50){while(--_0x447e50){_0x44a8d6['push'](_0x44a8d6['shift']());}};_0x4858fa(++_0x325a4a);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ed0cd,_0x4e5354){_0x1ed0cd=_0x1ed0cd-0x0;var _0x4ecbc5=_0x6aa7[_0x1ed0cd];return _0x4ecbc5;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=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(_0x123d79,_0x3b5746){var _0x55120d=function(_0x52cf2b){while(--_0x52cf2b){_0x123d79['push'](_0x123d79['shift']());}};_0x55120d(++_0x3b5746);}(_0x53ec,0x192));var _0xc53e=function(_0x20a5df,_0x4e1567){_0x20a5df=_0x20a5df-0x0;var _0x2124e4=_0x53ec[_0x20a5df];return _0x2124e4;};'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 9eaa92a..5243c52 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 _0x1cc3=['randomstring','STRING','name','generate','ENUM','twilio','skebby','clicksend','clickatell','bandwidth','csc','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize'];(function(_0x3292cf,_0x5e444a){var _0x116acc=function(_0xdf90e5){while(--_0xdf90e5){_0x3292cf['push'](_0x3292cf['shift']());}};_0x116acc(++_0x5e444a);}(_0x1cc3,0xe9));var _0x31cc=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1cc3[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x31cc('0x0'));var rs=require(_0x31cc('0x1'));module['exports']={'name':{'type':Sequelize[_0x31cc('0x2')],'unique':_0x31cc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x31cc('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x31cc('0x2')],'defaultValue':function(){return rs[_0x31cc('0x4')]();}},'phone':{'type':Sequelize[_0x31cc('0x2')]},'type':{'type':Sequelize[_0x31cc('0x5')](_0x31cc('0x6'),_0x31cc('0x7'),'connectel',_0x31cc('0x8'),'plivo',_0x31cc('0x9'),_0x31cc('0xa'),_0x31cc('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x31cc('0x2')]},'authId':{'type':Sequelize[_0x31cc('0x2')]},'authToken':{'type':Sequelize[_0x31cc('0x2')]},'smsMethod':{'type':Sequelize[_0x31cc('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x31cc('0x2')]},'password':{'type':Sequelize[_0x31cc('0x2')]},'apiKey':{'type':Sequelize[_0x31cc('0x2')]},'applicationId':{'type':Sequelize[_0x31cc('0x2')]},'accountId':{'type':Sequelize[_0x31cc('0x2')]},'senderString':{'type':Sequelize[_0x31cc('0x2')]},'deliveryReport':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x31cc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x31cc('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x31cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31cc('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31cc('0xe')],'comment':_0x31cc('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x31cc('0xc')],'defaultValue':![],'comment':_0x31cc('0x10'),'set':function(_0x2ad2eb){if(!_0x2ad2eb)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x31cc('0x11'),_0x2ad2eb);}}}; \ No newline at end of file +var _0x8236=['randomstring','STRING','name','generate','clicksend','clickatell','bandwidth','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'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x8236,0xba));var _0x6823=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8236[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x6823('0x0'));var rs=require(_0x6823('0x1'));module['exports']={'name':{'type':Sequelize[_0x6823('0x2')],'unique':_0x6823('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6823('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6823('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6823('0x2')],'defaultValue':function(){return rs[_0x6823('0x4')]();}},'phone':{'type':Sequelize[_0x6823('0x2')]},'type':{'type':Sequelize['ENUM']('twilio','skebby','connectel',_0x6823('0x5'),'plivo',_0x6823('0x6'),_0x6823('0x7'),'csc','infobip',_0x6823('0x8'))},'accountSid':{'type':Sequelize[_0x6823('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6823('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x6823('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x6823('0x2')]},'senderString':{'type':Sequelize[_0x6823('0x2')]},'deliveryReport':{'type':Sequelize[_0x6823('0x9')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6823('0xa')],'defaultValue':function(){return _0x6823('0xb');}},'notificationSound':{'type':Sequelize[_0x6823('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6823('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6823('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6823('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6823('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6823('0xc')],'comment':_0x6823('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x6823('0x9')],'defaultValue':![],'comment':_0x6823('0xe'),'set':function(_0x3fefa5){if(!_0x3fefa5)this[_0x6823('0xf')](_0x6823('0x10'),null);this[_0x6823('0xf')]('mandatoryDisposition',_0x3fefa5);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e1b6cfe..8e6897b 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 _0xbdf1=['message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','find','create','body','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','CmContact','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','mobile','type','from','From','messageId','MessageSid','skebby','sender','text','clicksend','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','priority','stack','finally','sendStatus','getApplications','getInteractions','Contact','Tag','Tags','color','tag','List','DESC','dataValues','Messages','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','statusGet'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xbdf1,0x1d4));var _0x1bdf=function(_0x893c38,_0x3d6e5d){_0x893c38=_0x893c38-0x0;var _0x4401b6=_0xbdf1[_0x893c38];return _0x4401b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bdf('0x0'));var zipdir=require(_0x1bdf('0x1'));var jsonpatch=require(_0x1bdf('0x2'));var rp=require(_0x1bdf('0x3'));var moment=require(_0x1bdf('0x4'));var BPromise=require(_0x1bdf('0x5'));var Mustache=require('mustache');var util=require(_0x1bdf('0x6'));var path=require(_0x1bdf('0x7'));var sox=require(_0x1bdf('0x8'));var csv=require(_0x1bdf('0x9'));var ejs=require(_0x1bdf('0xa'));var fs=require('fs');var fs_extra=require(_0x1bdf('0xb'));var _=require(_0x1bdf('0xc'));var squel=require(_0x1bdf('0xd'));var crypto=require(_0x1bdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1bdf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1bdf('0x10'));var Papa=require('papaparse');var Redis=require(_0x1bdf('0x11'));var authService=require(_0x1bdf('0x12'));var qs=require(_0x1bdf('0x13'));var as=require(_0x1bdf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bdf('0x15'))(_0x1bdf('0x16'));var utils=require(_0x1bdf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1bdf('0x18'));var db=require(_0x1bdf('0x19'))['db'];config[_0x1bdf('0x1a')]=_[_0x1bdf('0x1b')](config[_0x1bdf('0x1a')],{'host':_0x1bdf('0x1c'),'port':0x18eb});var socket=require(_0x1bdf('0x1d'))(new Redis(config[_0x1bdf('0x1a')]));require(_0x1bdf('0x1e'))['register'](socket);var jayson=require(_0x1bdf('0x1f'));var client=jayson[_0x1bdf('0x20')][_0x1bdf('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x407d9b,_0x3c1f49,_0x174751,_0x4024d7){return new BPromise(function(_0x2715f5,_0x12a702){var _0x50c2af=_0x4024d7||client;return _0x50c2af[_0x1bdf('0x22')](_0x407d9b,_0x174751)[_0x1bdf('0x23')](function(_0x415939){logger['info'](_0x1bdf('0x24'),_0x3c1f49,'request\x20sent');logger[_0x1bdf('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c1f49,_0x1bdf('0x26'),JSON[_0x1bdf('0x27')](_0x415939));if(_0x415939['error']){if(_0x415939[_0x1bdf('0x28')][_0x1bdf('0x29')]===0x1f4){logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3c1f49,_0x415939['error']['message']);return _0x12a702(_0x415939[_0x1bdf('0x28')][_0x1bdf('0x2a')]);}logger[_0x1bdf('0x28')](_0x1bdf('0x24'),_0x3c1f49,_0x415939[_0x1bdf('0x28')][_0x1bdf('0x2a')]);return _0x2715f5(_0x415939['error']['message']);}else{logger[_0x1bdf('0x2b')](_0x1bdf('0x24'),_0x3c1f49,'request\x20sent');_0x2715f5(_0x415939[_0x1bdf('0x2c')][_0x1bdf('0x2a')]);}})[_0x1bdf('0x2d')](function(_0x555f94){logger[_0x1bdf('0x28')](_0x1bdf('0x24'),_0x3c1f49,_0x555f94);_0x12a702(_0x555f94);});});}function respondWithStatusCode(_0xf8b861,_0x58c0f7){_0x58c0f7=_0x58c0f7||0xcc;return function(_0x2abd2a){if(_0x2abd2a){return _0xf8b861['sendStatus'](_0x58c0f7);}return _0xf8b861[_0x1bdf('0x2e')](_0x58c0f7)[_0x1bdf('0x2f')]();};}function respondWithResult(_0x5067dc,_0x4de270){_0x4de270=_0x4de270||0xc8;return function(_0x4adc8d){if(_0x4adc8d){return _0x5067dc[_0x1bdf('0x2e')](_0x4de270)[_0x1bdf('0x30')](_0x4adc8d);}};}function respondWithFilteredResult(_0x330d92,_0x1e6839){return function(_0x9690bd){if(_0x9690bd){var _0x4b5120=typeof _0x1e6839[_0x1bdf('0x31')]===_0x1bdf('0x32')&&typeof _0x1e6839[_0x1bdf('0x33')]===_0x1bdf('0x32');var _0x231747=_0x9690bd[_0x1bdf('0x34')];var _0x5d0654=_0x4b5120?0x0:_0x1e6839['offset'];var _0x3a1728=_0x4b5120?_0x9690bd[_0x1bdf('0x34')]:_0x1e6839[_0x1bdf('0x31')]+_0x1e6839[_0x1bdf('0x33')];var _0x3e7c2a;if(_0x3a1728>=_0x231747){_0x3a1728=_0x231747;_0x3e7c2a=0xc8;}else{_0x3e7c2a=0xce;}_0x330d92[_0x1bdf('0x2e')](_0x3e7c2a);return _0x330d92['set'](_0x1bdf('0x35'),_0x5d0654+'-'+_0x3a1728+'/'+_0x231747)[_0x1bdf('0x30')](_0x9690bd);}return null;};}function patchUpdates(_0x177948){return function(_0x51b645){try{jsonpatch[_0x1bdf('0x36')](_0x51b645,_0x177948,!![]);}catch(_0x4a5ab7){return BPromise[_0x1bdf('0x37')](_0x4a5ab7);}return _0x51b645[_0x1bdf('0x38')]();};}function saveUpdates(_0x551c91,_0x3d4a67){return function(_0x3b6dff){if(_0x3b6dff){return _0x3b6dff[_0x1bdf('0x39')](_0x551c91)[_0x1bdf('0x23')](function(_0x5e0994){return _0x5e0994;});}return null;};}function removeEntity(_0x585db7,_0x3fe0c9){return function(_0xa6edfb){if(_0xa6edfb){return _0xa6edfb[_0x1bdf('0x3a')]()[_0x1bdf('0x23')](function(){var _0x590654=_0xa6edfb[_0x1bdf('0x3b')]({'plain':!![]});var _0x30a24f='SmsAccounts';return db[_0x1bdf('0x3c')]['destroy']({'where':{'type':_0x30a24f,'resourceId':_0x590654['id']}})[_0x1bdf('0x23')](function(){return _0xa6edfb;});})[_0x1bdf('0x23')](function(){_0x585db7[_0x1bdf('0x2e')](0xcc)[_0x1bdf('0x2f')]();});}};}function handleEntityNotFound(_0xcf2491,_0x133345){return function(_0x4c7f8e){if(!_0x4c7f8e){_0xcf2491['sendStatus'](0x194);}return _0x4c7f8e;};}function handleError(_0x510c65,_0x35664a){_0x35664a=_0x35664a||0x1f4;return function(_0xfb3c51){logger[_0x1bdf('0x28')](_0xfb3c51['stack']);if(_0xfb3c51[_0x1bdf('0x3d')]){delete _0xfb3c51[_0x1bdf('0x3d')];}_0x510c65[_0x1bdf('0x2e')](_0x35664a)[_0x1bdf('0x3e')](_0xfb3c51);};}exports['index']=function(_0x2a9f0c,_0x43a477){var _0x2f91c7={'include':[{'model':db[_0x1bdf('0x3f')],'as':_0x1bdf('0x40')}]},_0x829336={},_0x54cb6e={'count':0x0,'rows':[]};var _0x42b47e=_[_0x1bdf('0x41')](db[_0x1bdf('0x42')][_0x1bdf('0x43')],function(_0x5e3ad0){return{'name':_0x5e3ad0[_0x1bdf('0x44')],'type':_0x5e3ad0['type'][_0x1bdf('0x45')]};});_0x829336[_0x1bdf('0x46')]=_[_0x1bdf('0x41')](_0x42b47e,_0x1bdf('0x3d'));_0x829336[_0x1bdf('0x47')]=_['keys'](_0x2a9f0c['query']);_0x829336[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x829336[_0x1bdf('0x46')],_0x829336[_0x1bdf('0x47')]);_0x2f91c7[_0x1bdf('0x4a')]=_['intersection'](_0x829336[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x2f91c7[_0x1bdf('0x4a')]=_0x2f91c7['attributes'][_0x1bdf('0x4c')]?_0x2f91c7[_0x1bdf('0x4a')]:_0x829336[_0x1bdf('0x46')];if(!_0x2a9f0c['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x2f91c7[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x2a9f0c['query'][_0x1bdf('0x33')]);_0x2f91c7[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x2f91c7[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x2a9f0c[_0x1bdf('0x47')]['sort']);_0x2f91c7[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x2a9f0c[_0x1bdf('0x47')],_0x829336[_0x1bdf('0x48')]),_0x42b47e);if(_0x2a9f0c[_0x1bdf('0x47')]['filter']){_0x2f91c7[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x2f91c7[_0x1bdf('0x51')],{'$or':_['map'](_0x42b47e,function(_0x15378d){if(_0x15378d['type']!==_0x1bdf('0x54')){var _0x317b9c={};_0x317b9c[_0x15378d[_0x1bdf('0x3d')]]={'$like':'%'+_0x2a9f0c[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x317b9c;}})});}_0x2f91c7=_[_0x1bdf('0x53')]({},_0x2f91c7,_0x2a9f0c[_0x1bdf('0x56')]);var _0x1b99d9={'where':_0x2f91c7['where']};return db[_0x1bdf('0x42')][_0x1bdf('0x34')](_0x1b99d9)[_0x1bdf('0x23')](function(_0xd74db){_0x54cb6e[_0x1bdf('0x34')]=_0xd74db;if(_0x2a9f0c['query'][_0x1bdf('0x57')]){_0x2f91c7[_0x1bdf('0x58')]=[{'all':!![]}];}return db[_0x1bdf('0x42')][_0x1bdf('0x59')](_0x2f91c7);})[_0x1bdf('0x23')](function(_0x420eda){_0x54cb6e[_0x1bdf('0x5a')]=_0x420eda;return _0x54cb6e;})[_0x1bdf('0x23')](respondWithFilteredResult(_0x43a477,_0x2f91c7))[_0x1bdf('0x2d')](handleError(_0x43a477,null));};exports[_0x1bdf('0x5b')]=function(_0x4dad6e,_0x4a9ed7){var _0x54ceba={'raw':![],'where':{'id':_0x4dad6e['params']['id']},'include':[{'model':db[_0x1bdf('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1fe095={};_0x1fe095[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0x42')]['rawAttributes']);_0x1fe095[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x4dad6e[_0x1bdf('0x47')]);_0x1fe095[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x1fe095[_0x1bdf('0x46')],_0x1fe095[_0x1bdf('0x47')]);_0x54ceba[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x1fe095['model'],qs[_0x1bdf('0x4b')](_0x4dad6e[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x54ceba['attributes']=_0x54ceba[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x54ceba['attributes']:_0x1fe095[_0x1bdf('0x46')];if(_0x4dad6e[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x54ceba[_0x1bdf('0x58')]=[{'all':!![]}];}_0x54ceba=_['merge']({},_0x54ceba,_0x4dad6e[_0x1bdf('0x56')]);return db[_0x1bdf('0x42')][_0x1bdf('0x5d')](_0x54ceba)[_0x1bdf('0x23')](handleEntityNotFound(_0x4a9ed7,null))[_0x1bdf('0x23')](respondWithResult(_0x4a9ed7,null))[_0x1bdf('0x2d')](handleError(_0x4a9ed7,null));};exports[_0x1bdf('0x5e')]=function(_0x2e61ff,_0x3e6b41){return db[_0x1bdf('0x42')][_0x1bdf('0x5e')](_0x2e61ff[_0x1bdf('0x5f')],{})[_0x1bdf('0x23')](function(_0xbc028f){var _0xba68fe=_0x2e61ff['user'][_0x1bdf('0x3b')]({'plain':!![]});if(!_0xba68fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xba68fe[_0x1bdf('0x60')]===_0x1bdf('0x61')){var _0x415b93=_0xbc028f[_0x1bdf('0x3b')]({'plain':!![]});var _0x2bab20='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x2bab20,'userProfileId':_0xba68fe[_0x1bdf('0x62')]},'raw':!![]})[_0x1bdf('0x23')](function(_0x401a57){if(_0x401a57&&_0x401a57['autoAssociation']===0x0){return db[_0x1bdf('0x3c')][_0x1bdf('0x5e')]({'name':_0x415b93[_0x1bdf('0x3d')],'resourceId':_0x415b93['id'],'type':_0x401a57['name'],'sectionId':_0x401a57['id']},{})[_0x1bdf('0x23')](function(){return _0xbc028f;});}else{return _0xbc028f;}})['catch'](function(_0x559582){logger[_0x1bdf('0x28')](_0x1bdf('0x63'),_0x559582);throw _0x559582;});}return _0xbc028f;})[_0x1bdf('0x23')](respondWithResult(_0x3e6b41,0xc9))[_0x1bdf('0x2d')](handleError(_0x3e6b41,null));};exports[_0x1bdf('0x39')]=function(_0x27c222,_0x2b4fe7){if(_0x27c222[_0x1bdf('0x5f')]['id']){delete _0x27c222[_0x1bdf('0x5f')]['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x27c222[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x3f')],'as':_0x1bdf('0x40')}]})[_0x1bdf('0x23')](handleEntityNotFound(_0x2b4fe7,null))[_0x1bdf('0x23')](saveUpdates(_0x27c222[_0x1bdf('0x5f')],null))['then'](respondWithResult(_0x2b4fe7,null))[_0x1bdf('0x2d')](handleError(_0x2b4fe7,null));};exports[_0x1bdf('0x3a')]=function(_0x451b08,_0x3f9945){return db['SmsAccount']['find']({'where':{'id':_0x451b08[_0x1bdf('0x64')]['id']}})['then'](handleEntityNotFound(_0x3f9945,null))[_0x1bdf('0x23')](removeEntity(_0x3f9945,null))[_0x1bdf('0x2d')](handleError(_0x3f9945,null));};exports['describe']=function(_0x45b7da,_0x64d030){return db[_0x1bdf('0x42')][_0x1bdf('0x65')]()[_0x1bdf('0x23')](respondWithResult(_0x64d030,null))[_0x1bdf('0x2d')](handleError(_0x64d030,null));};exports[_0x1bdf('0x66')]=function(_0x18bb0f,_0x186c47,_0x224e15){if(_0x18bb0f[_0x1bdf('0x5f')]['id']){delete _0x18bb0f['body']['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x18bb0f[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x186c47,null))[_0x1bdf('0x23')](function(_0x131590){if(_0x131590){_0x18bb0f[_0x1bdf('0x5f')][_0x1bdf('0x67')]=_0x131590['id'];return db['Disposition'][_0x1bdf('0x5e')](_0x18bb0f[_0x1bdf('0x5f')]);}})[_0x1bdf('0x23')](respondWithResult(_0x186c47,null))[_0x1bdf('0x2d')](handleError(_0x186c47,null));};exports[_0x1bdf('0x68')]=function(_0x209767,_0x179352,_0x7167ba){var _0x37ee2b={'raw':![],'where':{}};var _0x6522e7={};var _0x262e50={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x209767[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x179352,null))[_0x1bdf('0x23')](function(_0x4a2935){if(_0x4a2935){_0x6522e7[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0x6a')][_0x1bdf('0x43')]);_0x6522e7[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x209767['query']);_0x6522e7[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x6522e7[_0x1bdf('0x46')],_0x6522e7['query']);_0x37ee2b['attributes']=_[_0x1bdf('0x49')](_0x6522e7[_0x1bdf('0x46')],qs['fields'](_0x209767[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x37ee2b['attributes']=_0x37ee2b[_0x1bdf('0x4a')]['length']?_0x37ee2b[_0x1bdf('0x4a')]:_0x6522e7[_0x1bdf('0x46')];if(!_0x209767[_0x1bdf('0x47')][_0x1bdf('0x4d')]('nolimit')){_0x37ee2b['limit']=qs['limit'](_0x209767['query']['limit']);_0x37ee2b['offset']=qs['offset'](_0x209767[_0x1bdf('0x47')]['offset']);}_0x37ee2b['order']=qs['sort'](_0x209767[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x37ee2b[_0x1bdf('0x51')]=qs['filters'](_[_0x1bdf('0x52')](_0x209767[_0x1bdf('0x47')],_0x6522e7[_0x1bdf('0x48')]));_0x37ee2b[_0x1bdf('0x51')]['SmsAccountId']=_0x4a2935['id'];if(_0x209767['query'][_0x1bdf('0x55')]){_0x37ee2b[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x37ee2b['where'],{'$or':_[_0x1bdf('0x41')](_0x37ee2b[_0x1bdf('0x4a')],function(_0x46ae4d){var _0x4d3686={};_0x4d3686[_0x46ae4d]={'$like':'%'+_0x209767['query']['filter']+'%'};return _0x4d3686;})});}_0x37ee2b=_[_0x1bdf('0x53')]({},_0x37ee2b,_0x209767[_0x1bdf('0x56')]);return db['Disposition'][_0x1bdf('0x34')]({'where':_0x37ee2b[_0x1bdf('0x51')]})[_0x1bdf('0x23')](function(_0x446abc){_0x262e50[_0x1bdf('0x34')]=_0x446abc;if(_0x209767[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x37ee2b[_0x1bdf('0x58')]=[{'all':!![]}];}return db[_0x1bdf('0x6a')][_0x1bdf('0x59')](_0x37ee2b);})['then'](function(_0x58baab){_0x262e50[_0x1bdf('0x5a')]=_0x58baab;return _0x262e50;});}})['then'](respondWithFilteredResult(_0x179352,_0x37ee2b))['catch'](handleError(_0x179352,null));};exports[_0x1bdf('0x6b')]=function(_0x2a223c,_0x2ddc2d,_0x49cf18){return db['SmsAccount'][_0x1bdf('0x5d')]({'where':{'id':_0x2a223c[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2ddc2d,null))[_0x1bdf('0x23')](function(_0x115d07){if(_0x115d07){return _0x115d07[_0x1bdf('0x6b')](_0x2a223c[_0x1bdf('0x47')][_0x1bdf('0x6c')]);}})['then'](respondWithStatusCode(_0x2ddc2d,null))['catch'](handleError(_0x2ddc2d,null));};exports[_0x1bdf('0x6d')]=function(_0x155ba1,_0x43b93c,_0x21bc81){if(_0x155ba1[_0x1bdf('0x5f')]['id']){delete _0x155ba1[_0x1bdf('0x5f')]['id'];}return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x155ba1['params']['id']}})['then'](handleEntityNotFound(_0x43b93c,null))[_0x1bdf('0x23')](function(_0x533fef){if(_0x533fef){_0x155ba1['body'][_0x1bdf('0x67')]=_0x533fef['id'];return db['CannedAnswer'][_0x1bdf('0x5e')](_0x155ba1[_0x1bdf('0x5f')]);}})[_0x1bdf('0x23')](respondWithResult(_0x43b93c,null))[_0x1bdf('0x2d')](handleError(_0x43b93c,null));};exports[_0x1bdf('0x6e')]=function(_0x3be617,_0x10b6a5,_0x183428){var _0x30ed15={'raw':![],'where':{}};var _0x71b8f7={};var _0x94481d={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x3be617['params']['id']}})['then'](handleEntityNotFound(_0x10b6a5,null))[_0x1bdf('0x23')](function(_0x5c379c){if(_0x5c379c){_0x71b8f7['model']=_['keys'](db['CannedAnswer'][_0x1bdf('0x43')]);_0x71b8f7[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x3be617['query']);_0x71b8f7[_0x1bdf('0x48')]=_[_0x1bdf('0x49')](_0x71b8f7[_0x1bdf('0x46')],_0x71b8f7['query']);_0x30ed15[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x71b8f7[_0x1bdf('0x46')],qs['fields'](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x4b')]));_0x30ed15[_0x1bdf('0x4a')]=_0x30ed15[_0x1bdf('0x4a')]['length']?_0x30ed15[_0x1bdf('0x4a')]:_0x71b8f7[_0x1bdf('0x46')];if(!_0x3be617['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x30ed15[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x30ed15['offset']=qs[_0x1bdf('0x31')](_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x30ed15[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x3be617['query'][_0x1bdf('0x50')]);_0x30ed15[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x3be617[_0x1bdf('0x47')],_0x71b8f7[_0x1bdf('0x48')]));_0x30ed15['where'][_0x1bdf('0x67')]=_0x5c379c['id'];if(_0x3be617[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x30ed15[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x30ed15[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x30ed15[_0x1bdf('0x4a')],function(_0x15e90d){var _0x5ca39c={};_0x5ca39c[_0x15e90d]={'$like':'%'+_0x3be617['query'][_0x1bdf('0x55')]+'%'};return _0x5ca39c;})});}_0x30ed15=_['merge']({},_0x30ed15,_0x3be617['options']);return db[_0x1bdf('0x6f')][_0x1bdf('0x34')]({'where':_0x30ed15[_0x1bdf('0x51')]})['then'](function(_0x70a9d6){_0x94481d[_0x1bdf('0x34')]=_0x70a9d6;if(_0x3be617[_0x1bdf('0x47')]['includeAll']){_0x30ed15['include']=[{'all':!![]}];}return db[_0x1bdf('0x6f')][_0x1bdf('0x59')](_0x30ed15);})[_0x1bdf('0x23')](function(_0x360586){_0x94481d[_0x1bdf('0x5a')]=_0x360586;return _0x94481d;});}})[_0x1bdf('0x23')](respondWithFilteredResult(_0x10b6a5,_0x30ed15))['catch'](handleError(_0x10b6a5,null));};exports['removeAnswers']=function(_0xfff106,_0x2c32ba,_0x3cdbb5){return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0xfff106[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2c32ba,null))[_0x1bdf('0x23')](function(_0x365b87){if(_0x365b87){return _0x365b87[_0x1bdf('0x70')](_0xfff106['query'][_0x1bdf('0x6c')]);}})[_0x1bdf('0x23')](respondWithStatusCode(_0x2c32ba,null))['catch'](handleError(_0x2c32ba,null));};exports[_0x1bdf('0x71')]=function(_0x50021e,_0xc57eb1,_0x5f0323){var _0x5a8fc1={'channel':_0x1bdf('0x72')};var _0x5766f4=[];var _0x34359d=[];var _0x28ce93={};return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x50021e[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x73')],'as':_0x1bdf('0x74')}]})['then'](handleEntityNotFound(_0xc57eb1,null))['then'](function(_0x101158){_0x5a8fc1[_0x1bdf('0x75')]=_0x101158;_0x5a8fc1[_0x1bdf('0x76')]=_[_0x1bdf('0x77')](_0x101158[_0x1bdf('0x74')],['priority'],['asc']);if(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x74')]){delete _0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x74')];}return db[_0x1bdf('0x78')][_0x1bdf('0x65')]();})[_0x1bdf('0x23')](function(_0x486b11){if(!_0x486b11){throw new db[(_0x1bdf('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x5766f4=_['difference'](_[_0x1bdf('0x5c')](_0x486b11),[_0x1bdf('0x7a'),_0x1bdf('0x7b')]);_0x34359d=_[_0x1bdf('0x7c')](_[_0x1bdf('0x5c')](_0x486b11),[_0x1bdf('0x7a'),'updatedAt',_0x1bdf('0x7d'),_0x1bdf('0x7e')]);_0x5a8fc1[_0x1bdf('0x5f')]={'mapKey':_0x1bdf('0x7f')};if(_0x5a8fc1['account']['type']){switch(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x80')]){case'twilio':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x82')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e['body']['Body'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x84')];break;case _0x1bdf('0x85'):_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]='+'+_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x86')];_0x5a8fc1[_0x1bdf('0x5f')]['body']=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x87')];break;case'connectel':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['message'];break;case _0x1bdf('0x88'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e['body']['from'];_0x5a8fc1['body'][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['body'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')]['message_id'];break;case'plivo':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x82')];_0x5a8fc1[_0x1bdf('0x5f')]['body']=_0x50021e[_0x1bdf('0x5f')]['Text'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x89')];break;case _0x1bdf('0x8a'):_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]='+'+_0x50021e[_0x1bdf('0x5f')]['results'][0x0][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')]['results'][0x0]['text'];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0][_0x1bdf('0x83')];break;case _0x1bdf('0x8c'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8d')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x8e')][_0x1bdf('0x2a')];break;case _0x1bdf('0x8f'):_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e['body'][_0x1bdf('0x90')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x87')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e['body'][_0x1bdf('0x91')];break;case _0x1bdf('0x92'):_0x5a8fc1[_0x1bdf('0x5f')]['messageId']=_0x50021e[_0x1bdf('0x5f')][0x0]['message']['id'];_0x5a8fc1['body'][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')][_0x1bdf('0x81')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][0x0]['message']['text'];break;case'intelepeer':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x81')];_0x5a8fc1['body'][_0x1bdf('0x5f')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x2a')];_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')]=_0x50021e[_0x1bdf('0x5f')][_0x1bdf('0x93')];break;}}if(_0x5a8fc1['body']['id']){delete _0x5a8fc1[_0x1bdf('0x5f')]['id'];}if(_[_0x1bdf('0x94')](_0x5a8fc1['body'][_0x1bdf('0x81')])){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x96'));}if(_[_0x1bdf('0x94')](_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')])||_0x5a8fc1[_0x1bdf('0x5f')]['body']===''){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x97'));}if(_[_0x1bdf('0x94')](_0x5a8fc1[_0x1bdf('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x1bdf('0x95'))](_0x1bdf('0x98')+_0x34359d);}if(!_[_0x1bdf('0x99')](_0x34359d,_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')])){throw new db['Sequelize'][(_0x1bdf('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34359d);}_0x28ce93[_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')]]=_0x5a8fc1['body']['from'];return db[_0x1bdf('0x9b')][_0x1bdf('0x5d')]({'where':{'id':_0x5a8fc1[_0x1bdf('0x75')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x1bdf('0x9c'),'where':_0x28ce93,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0xc57eb1,null))['then'](function(_0x492ba8){if(_0x492ba8){_0x5a8fc1[_0x1bdf('0x9d')]=_[_0x1bdf('0x9e')](_0x492ba8,[_0x1bdf('0x9c')]);if(_0x492ba8[_0x1bdf('0x9c')][_0x1bdf('0x4c')]){return _0x492ba8[_0x1bdf('0x9c')][0x0];}var _0x198993=_['defaults'](_0x5a8fc1['body'],{'firstName':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')],'ListId':_0x492ba8['id']});_0x198993[_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x9a')]]=_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')];return db[_0x1bdf('0x78')][_0x1bdf('0x5e')](_0x198993,{'fields':_0x5766f4,'raw':!![]});}})['then'](handleEntityNotFound(_0xc57eb1,null))[_0x1bdf('0x23')](function(_0x22efcb){if(_0x22efcb){_0x5a8fc1[_0x1bdf('0x9f')]=_0x22efcb;var _0x458989={'ContactId':_0x22efcb['id'],'phone':_0x5a8fc1[_0x1bdf('0x5f')]['from'],'SmsAccountId':_0x50021e[_0x1bdf('0x64')]['id']};var _0x368410={'ContactId':_0x22efcb['id'],'SmsAccountId':_0x50021e['params']['id'],'closed':![]};return db[_0x1bdf('0xa0')][_0x1bdf('0x5d')]({'where':_0x368410})['then'](function(_0x3989c3){if(_0x3989c3){return[_0x3989c3,![]];}return db[_0x1bdf('0xa0')]['create'](_0x458989)['then'](function(_0x1441d7){return[_0x1441d7,!![]];});});}})[_0x1bdf('0xa1')](function(_0x3c099f,_0xf19944){_0x5a8fc1[_0x1bdf('0xa2')]=_0x3c099f['get']({'plain':!![]});_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa3')]=![];if(_0xf19944){if(_0x5a8fc1[_0x1bdf('0x75')]['autoclose']){_0x5a8fc1[_0x1bdf('0x76')]['push']({'id':0x0,'priority':_0x5a8fc1[_0x1bdf('0x76')][_0x1bdf('0x4c')]+0x1,'app':'close','appdata':_0x1bdf('0xa4'),'interval':_0x1bdf('0xa5')});}_0x5a8fc1[_0x1bdf('0xa2')]['created']=!![];}return db[_0x1bdf('0xa6')][_0x1bdf('0x5e')]({'phone':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x81')],'messageId':_0x5a8fc1[_0x1bdf('0x5f')][_0x1bdf('0x83')],'body':_0x5a8fc1[_0x1bdf('0x5f')]['body'],'SmsAccountId':_0x50021e['params']['id'],'SmsInteractionId':_0x3c099f['id'],'direction':'in','ContactId':_0x3c099f[_0x1bdf('0xa7')],'AttachmentId':_0x5a8fc1['body'][_0x1bdf('0xa8')]});})[_0x1bdf('0x23')](function(_0x168f20){_0x5a8fc1[_0x1bdf('0x2a')]=_0x168f20;if(_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa9')]){return db[_0x1bdf('0xaa')][_0x1bdf('0x5d')]({'attributes':['id','name'],'where':{'id':_0x5a8fc1[_0x1bdf('0xa2')][_0x1bdf('0xa9')]}})[_0x1bdf('0x23')](function(_0x1eda5b){if(_0x1eda5b){_0x5a8fc1[_0x1bdf('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1bdf('0xab'),'appdata':_0x1eda5b[_0x1bdf('0x3d')]+','+(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0xac')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1bdf('0xad'),'startRouting',_0x5a8fc1);});}return respondWithRpcPromise(_0x1bdf('0xad'),_0x1bdf('0xae'),_0x5a8fc1);})[_0x1bdf('0x23')](function(_0x238c2c){if(_0x238c2c){var _0x1fc76b=0xc8;var _0x5f19b3=_0x1bdf('0xaf');logger['info'](_0x1bdf('0xb0'),_0x5f19b3,_0x1fc76b,_0x1bdf('0xb1'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5f19b3,_0x1fc76b,_0x1bdf('0xb1'),JSON[_0x1bdf('0x27')](_0x238c2c));if(_0x5a8fc1[_0x1bdf('0x75')][_0x1bdf('0x80')]===_0x1bdf('0xb2')){return _0xc57eb1[_0x1bdf('0x2e')](_0x1fc76b)[_0x1bdf('0xb3')](_0x1bdf('0xb4'),_0x1bdf('0xb5'))['send'](_0x1bdf('0xb6'));}else{return _0xc57eb1['status'](_0x1fc76b)[_0x1bdf('0x30')](_0x238c2c);}}})[_0x1bdf('0x2d')](handleError(_0xc57eb1,null));};exports[_0x1bdf('0xb7')]=function(_0x18ef53,_0x1c36b4){var _0x51889c=_0x18ef53[_0x1bdf('0x64')]['id'];var _0x2172e3=_0x18ef53[_0x1bdf('0x5f')];var _0x124ad3=0xc8;var _0x1ba35c=null;return db[_0x1bdf('0xb8')][_0x1bdf('0xb9')]({'isolationLevel':db[_0x1bdf('0xb8')]['Transaction']['ISOLATION_LEVELS'][_0x1bdf('0xba')]},function(_0x4cb17a){return db[_0x1bdf('0x42')]['findOne']({'where':{'id':_0x51889c},'transaction':_0x4cb17a})['then'](function(_0x492a63){if(_0x492a63){return db[_0x1bdf('0x73')][_0x1bdf('0x3a')]({'where':{'SmsAccountId':_0x51889c},'transaction':_0x4cb17a})['then'](function(){var _0x28df08=_[_0x1bdf('0x41')](_0x2172e3,function(_0x2ba1ba){_0x2ba1ba[_0x1bdf('0x67')]=_0x51889c;return _0x2ba1ba;});return db[_0x1bdf('0x73')][_0x1bdf('0xbb')](_0x28df08,{'transaction':_0x4cb17a});});}else{_0x124ad3=0x194;_0x1ba35c=[];}});})[_0x1bdf('0x23')](function(){if(_0x124ad3!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x51889c},'order':_0x1bdf('0xbc')})[_0x1bdf('0x23')](function(_0x3bdf86){_0x1ba35c=_0x3bdf86;});}})[_0x1bdf('0x2d')](function(_0x505f66){_0x124ad3=0x1f4;logger[_0x1bdf('0x28')](_0x505f66[_0x1bdf('0xbd')]);if(_0x505f66[_0x1bdf('0x3d')]){delete _0x505f66[_0x1bdf('0x3d')];}_0x1ba35c=_0x505f66;})[_0x1bdf('0xbe')](function(){if(_0x1ba35c===null){_0x1c36b4[_0x1bdf('0xbf')](_0x124ad3);}else{if(_0x124ad3===0x1f4){_0x1c36b4[_0x1bdf('0x2e')](_0x124ad3)[_0x1bdf('0x3e')](_0x1ba35c);}else{_0x1c36b4[_0x1bdf('0x2e')](_0x124ad3)[_0x1bdf('0x30')](_0x1ba35c);}}});};exports['getApplications']=function(_0x490f37,_0x55a4cd,_0x70fcb6){var _0x395a7c={};var _0x281211={};var _0x1d1691;var _0x5670d9;return db[_0x1bdf('0x42')]['findOne']({'where':{'id':_0x490f37[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x55a4cd,null))['then'](function(_0x5206d3){if(_0x5206d3){_0x1d1691=_0x5206d3;_0x281211['model']=_[_0x1bdf('0x5c')](db[_0x1bdf('0x73')]['rawAttributes']);_0x281211[_0x1bdf('0x47')]=_[_0x1bdf('0x5c')](_0x490f37[_0x1bdf('0x47')]);_0x281211[_0x1bdf('0x48')]=_['intersection'](_0x281211[_0x1bdf('0x46')],_0x281211[_0x1bdf('0x47')]);_0x395a7c[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x281211[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x490f37['query']['fields']));_0x395a7c[_0x1bdf('0x4a')]=_0x395a7c[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x395a7c[_0x1bdf('0x4a')]:_0x281211[_0x1bdf('0x46')];_0x395a7c[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x395a7c[_0x1bdf('0x51')]=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x490f37[_0x1bdf('0x47')],_0x281211[_0x1bdf('0x48')]));if(_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x395a7c[_0x1bdf('0x51')]=_['merge'](_0x395a7c[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x395a7c[_0x1bdf('0x4a')],function(_0x47bd4b){var _0x1413ee={};_0x1413ee[_0x47bd4b]={'$like':'%'+_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x1413ee;})});}_0x395a7c=_[_0x1bdf('0x53')]({},_0x395a7c,_0x490f37[_0x1bdf('0x56')]);return _0x1d1691[_0x1bdf('0xc0')](_0x395a7c);}})[_0x1bdf('0x23')](function(_0x40f8f8){if(_0x40f8f8){_0x5670d9=_0x40f8f8[_0x1bdf('0x4c')];if(!_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x395a7c[_0x1bdf('0x33')]=qs[_0x1bdf('0x33')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x395a7c[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x490f37[_0x1bdf('0x47')][_0x1bdf('0x31')]);}return _0x1d1691[_0x1bdf('0xc0')](_0x395a7c);}})['then'](function(_0xccd69e){if(_0xccd69e){return _0xccd69e?{'count':_0x5670d9,'rows':_0xccd69e}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x55a4cd,null))['catch'](handleError(_0x55a4cd,null));};exports[_0x1bdf('0xc1')]=function(_0x37e893,_0x48ca4d,_0x167c0f){var _0x3c47ad={'raw':![],'where':{}};var _0x1e0b00={};var _0x2af25b={'count':0x0,'rows':[]};return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x37e893[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x48ca4d,null))[_0x1bdf('0x23')](function(_0x57b960){if(_0x57b960){_0x1e0b00[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db['SmsInteraction'][_0x1bdf('0x43')]);_0x1e0b00[_0x1bdf('0x47')]=_['keys'](_0x37e893['query']);_0x1e0b00['filters']=_[_0x1bdf('0x49')](_0x1e0b00[_0x1bdf('0x46')],_0x1e0b00[_0x1bdf('0x47')]);_0x3c47ad[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x1e0b00[_0x1bdf('0x46')],qs[_0x1bdf('0x4b')](_0x37e893['query'][_0x1bdf('0x4b')]));_0x3c47ad['attributes']=_0x3c47ad[_0x1bdf('0x4a')][_0x1bdf('0x4c')]?_0x3c47ad[_0x1bdf('0x4a')]:_0x1e0b00[_0x1bdf('0x46')];if(!_0x37e893['query'][_0x1bdf('0x4d')](_0x1bdf('0x4e'))){_0x3c47ad['limit']=qs['limit'](_0x37e893['query'][_0x1bdf('0x33')]);_0x3c47ad['offset']=qs[_0x1bdf('0x31')](_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x31')]);}_0x3c47ad[_0x1bdf('0x4f')]=qs[_0x1bdf('0x50')](_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x50')]);_0x3c47ad[_0x1bdf('0x51')]=qs['filters'](_['pick'](_0x37e893[_0x1bdf('0x47')],_0x1e0b00[_0x1bdf('0x48')]));_0x3c47ad[_0x1bdf('0x51')]['SmsAccountId']=_0x57b960['id'];if(_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x3c47ad[_0x1bdf('0x51')]=_['merge'](_0x3c47ad['where'],{'$or':_[_0x1bdf('0x41')](_0x3c47ad['attributes'],function(_0x58cad1){var _0x56c69c={};_0x56c69c[_0x58cad1]={'$like':'%'+_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x56c69c;})});}_0x3c47ad=_['merge']({},_0x3c47ad,_0x37e893[_0x1bdf('0x56')]);return db['SmsInteraction'][_0x1bdf('0x34')]({'where':_0x3c47ad[_0x1bdf('0x51')]})[_0x1bdf('0x23')](function(_0x1f2444){_0x2af25b[_0x1bdf('0x34')]=_0x1f2444;if(_0x37e893[_0x1bdf('0x47')][_0x1bdf('0x57')]){_0x3c47ad['include']=[{'model':db['CmContact'],'as':_0x1bdf('0xc2'),'required':![]},{'model':db[_0x1bdf('0xaa')],'as':'Owner','attributes':[_0x1bdf('0x3d'),'fullname','internal'],'required':![]},{'model':db[_0x1bdf('0xc3')],'as':_0x1bdf('0xc4'),'attributes':['id',_0x1bdf('0x3d'),_0x1bdf('0xc5')],'where':_0x37e893[_0x1bdf('0x47')][_0x1bdf('0xc6')]?{'id':_0x37e893['query'][_0x1bdf('0xc6')]}:undefined,'required':_0x37e893[_0x1bdf('0x47')]['tag']?!![]:![]}];}return db[_0x1bdf('0xa0')][_0x1bdf('0x59')](_0x3c47ad);})['then'](function(_0x405785){_0x2af25b[_0x1bdf('0x5a')]=_0x405785;return _0x2af25b;});}})['then'](respondWithFilteredResult(_0x48ca4d,_0x3c47ad))['catch'](handleError(_0x48ca4d,null));};exports[_0x1bdf('0x3e')]=function(_0x3c9fc1,_0x32f8f0,_0x215d9c){var _0x9b9088,_0x1d7358,_0x15075a;if(_['isNil'](_0x3c9fc1[_0x1bdf('0x5f')]['body'])||_0x3c9fc1[_0x1bdf('0x5f')][_0x1bdf('0x5f')]===''){throw new db[(_0x1bdf('0x79'))][(_0x1bdf('0x95'))](_0x1bdf('0x97'));}if(_[_0x1bdf('0x94')](_0x3c9fc1[_0x1bdf('0x5f')]['to'])){throw new db[(_0x1bdf('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x9b9088=_0x3c9fc1[_0x1bdf('0x5f')]['to'];return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3c9fc1[_0x1bdf('0x64')]['id']},'include':[{'model':db[_0x1bdf('0x9b')],'as':_0x1bdf('0xc7'),'include':[{'model':db[_0x1bdf('0x78')],'as':_0x1bdf('0x9c'),'where':{'mobile':_0x9b9088},'limit':0x1,'order':[[_0x1bdf('0x7b'),_0x1bdf('0xc8')]]}]}]})['then'](handleEntityNotFound(_0x32f8f0,null))[_0x1bdf('0x23')](function(_0x516b56){if(_0x516b56&&_0x516b56[_0x1bdf('0xc7')]){_0x1d7358=_0x516b56[_0x1bdf('0x3b')]({'plain':!![]});if(_0x1d7358[_0x1bdf('0xc7')]&&_0x1d7358[_0x1bdf('0xc7')][_0x1bdf('0x9c')]['length']){return _0x1d7358['List'][_0x1bdf('0x9c')][0x0];}return db[_0x1bdf('0x78')][_0x1bdf('0x5e')](_['defaults'](_0x3c9fc1[_0x1bdf('0x5f')],{'firstName':_0x9b9088,'mobile':_0x9b9088,'phone':_0x9b9088,'ListId':_0x1d7358[_0x1bdf('0x7e')]}));}})['then'](handleEntityNotFound(_0x32f8f0,null))[_0x1bdf('0x23')](function(_0x5251f6){if(_0x5251f6){_0x15075a=_0x5251f6;return db[_0x1bdf('0xa0')]['find']({'where':{'ContactId':_0x15075a['id'],'closed':![],'SmsAccountId':_0x1d7358['id']}})[_0x1bdf('0x23')](function(_0x3e9a4a){if(_0x3e9a4a){return[_0x3e9a4a,![]];}return db[_0x1bdf('0xa0')]['create']({'UserId':_0x3c9fc1[_0x1bdf('0x61')]['id'],'ContactId':_0x15075a['id'],'SmsAccountId':_0x1d7358['id'],'phone':_0x9b9088,'firstMsgDirection':'out','Messages':[_[_0x1bdf('0x53')](_0x3c9fc1['body'],{'read':![],'body':_0x3c9fc1[_0x1bdf('0x5f')]['body'],'phone':_0x9b9088,'SmsAccountId':_0x1d7358['id'],'UserId':_0x3c9fc1[_0x1bdf('0x61')]['id'],'ContactId':_0x15075a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x11a8a4){return[_0x11a8a4,!![]];});});}})['spread'](function(_0x269fac,_0x44dbf4){if(_0x44dbf4){return _0x269fac;}return db[_0x1bdf('0xa6')]['create'](_[_0x1bdf('0x53')](_0x3c9fc1[_0x1bdf('0x5f')],{'read':![],'body':_0x3c9fc1[_0x1bdf('0x5f')]['body'],'phone':_0x9b9088,'SmsAccountId':_0x1d7358['id'],'SmsInteractionId':_0x269fac['id'],'UserId':_0x3c9fc1['user']['id'],'ContactId':_0x15075a['id']}))[_0x1bdf('0x23')](function(_0xbf4c21){_0x269fac[_0x1bdf('0xc9')][_0x1bdf('0xca')]=[];_0x269fac[_0x1bdf('0xc9')]['Messages'][_0x1bdf('0xcb')](_0xbf4c21[_0x1bdf('0xc9')]);return _0x269fac;});})['then'](respondWithResult(_0x32f8f0,null))[_0x1bdf('0x2d')](handleError(_0x32f8f0,null));};exports[_0x1bdf('0x2e')]=function(_0xdc17f4,_0xb00a86,_0xbddecd){if(_0xdc17f4[_0x1bdf('0x5f')]['id']){delete _0xdc17f4[_0x1bdf('0x5f')]['id'];}var _0x134951,_0x2042fc,_0x5c4299;return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0xdc17f4['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0xb00a86,null))[_0x1bdf('0x23')](function(_0x145054){if(_0x145054){_0x5c4299=_0x145054;logger[_0x1bdf('0x25')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0xcc'),_0x145054[_0x1bdf('0x80')],util[_0x1bdf('0xcd')](_0xdc17f4['body'],{'showHidden':![],'depth':null}));switch(_0x145054[_0x1bdf('0x80')]){case _0x1bdf('0x85'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xce')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xce')]}});}break;case _0x1bdf('0xcf'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd0')]&&_0xdc17f4['body'][_0x1bdf('0xd1')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd1')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd0')]}});}break;case _0x1bdf('0x88'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd2')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd3')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')]['status_code'];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4['body']['message_id']}});}break;case _0x1bdf('0x8a'):var _0x2c2b91=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0];if(_0x2c2b91[_0x1bdf('0x83')]&&_0x2c2b91[_0x1bdf('0x2e')][_0x1bdf('0xd4')]===_0x1bdf('0xd5')){_0x2042fc=_0x2c2b91[_0x1bdf('0x2e')][_0x1bdf('0xd4')];return db['SmsMessage']['find']({'where':{'messageId':_0x2c2b91[_0x1bdf('0x83')]}});}break;case _0x1bdf('0x8f'):if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x83')]&&_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')]){_0x2042fc=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x2e')];return db['SmsMessage'][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4['body']['messageId']}});}break;case _0x1bdf('0x92'):if(_0xdc17f4[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')]['id']){_0x2042fc=_0xdc17f4['body'][0x0][_0x1bdf('0x80')];return db[_0x1bdf('0xa6')]['find']({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][0x0][_0x1bdf('0x2a')]['id']}});}break;case'intelepeer':if(_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd6')]&&_0xdc17f4[_0x1bdf('0x5f')]['status']){_0x2042fc=_0xdc17f4['body']['status'];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0xd6')]}});}break;}}})[_0x1bdf('0x23')](handleEntityNotFound(_0xb00a86,null))['then'](function(_0x142703){if(_0x142703){_0x134951=_0x142703;switch(_0x5c4299['type']){case _0x1bdf('0x85'):if(_0x2042fc===_0x1bdf('0xd5')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x85'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2042fc==='1'){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1bdf('0x85'),util['inspect'](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x88'):if(!_0xdc17f4['body'][_0x1bdf('0xd7')]&&_0x2042fc>=0xc8&&_0x2042fc<=0xce){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),'status','clicksend',util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x8a'):var _0x578b83=_0xdc17f4[_0x1bdf('0x5f')][_0x1bdf('0x8b')][0x0];if(_0x578b83[_0x1bdf('0x2e')][_0x1bdf('0xd4')]===_0x1bdf('0xd5')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x8a'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0x8f'):if(_0x2042fc==_0x1bdf('0xd8')||_0x2042fc==_0x1bdf('0xd9')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bdf('0x2e'),_0x1bdf('0x8f'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2042fc==_0x1bdf('0xda')){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),'bandwidth',util['inspect'](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x1bdf('0xdb'):if(_0x2042fc===_0x1bdf('0xdc')||_0x2042fc==='ACCEPTD'){return _0x134951[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0xdb'),util[_0x1bdf('0xcd')](_0xdc17f4[_0x1bdf('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x134951;}})['then'](respondWithResult(_0xb00a86,null))['catch'](handleError(_0xb00a86,null));};exports[_0x1bdf('0xdd')]=function(_0x3abcb8,_0x1ae5de,_0x213216){var _0x45eada,_0x20fe3f,_0x37e76f;return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3abcb8['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x1ae5de,null))[_0x1bdf('0x23')](function(_0x5dc385){if(_0x5dc385){_0x37e76f=_0x5dc385;logger[_0x1bdf('0x25')](_0x1bdf('0xb0'),'status',_0x1bdf('0xcc'),_0x5dc385[_0x1bdf('0x80')],util['inspect'](_0x3abcb8[_0x1bdf('0x47')],{'showHidden':![],'depth':null}));switch(_0x5dc385[_0x1bdf('0x80')]){case _0x1bdf('0x8c'):if(_0x3abcb8['query'][_0x1bdf('0xde')]&&_0x3abcb8[_0x1bdf('0x47')][_0x1bdf('0xdf')]){_0x20fe3f=_0x3abcb8['query'][_0x1bdf('0xdf')];return db[_0x1bdf('0xa6')][_0x1bdf('0x5d')]({'where':{'messageId':_0x3abcb8[_0x1bdf('0x47')][_0x1bdf('0xde')]}});}break;}}})[_0x1bdf('0x23')](handleEntityNotFound(_0x1ae5de,null))[_0x1bdf('0x23')](function(_0x20939f){if(_0x20939f){_0x45eada=_0x20939f;switch(_0x37e76f[_0x1bdf('0x80')]){case _0x1bdf('0x8c'):if(_0x20fe3f==='2'||_0x20fe3f==='6'){return _0x45eada[_0x1bdf('0x39')]({'read':!![]});}else{logger[_0x1bdf('0x28')](_0x1bdf('0xb0'),_0x1bdf('0x2e'),_0x1bdf('0x8c'),util[_0x1bdf('0xcd')](_0x3abcb8['query'],{'showHidden':![],'depth':null}));};break;}return _0x45eada;}})[_0x1bdf('0x23')](respondWithResult(_0x1ae5de,null))[_0x1bdf('0x2d')](handleError(_0x1ae5de,null));};exports[_0x1bdf('0xe0')]=function(_0x4206a6,_0x247765,_0x55789f){return db[_0x1bdf('0x42')]['find']({'where':{'id':_0x4206a6['params']['id']}})['then'](handleEntityNotFound(_0x247765,null))[_0x1bdf('0x23')](function(_0x1cb7bc){if(_0x1cb7bc){return _0x1cb7bc[_0x1bdf('0xe0')](_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')],_[_0x1bdf('0x9e')](_0x4206a6[_0x1bdf('0x5f')],[_0x1bdf('0x6c'),'id'])||{})[_0x1bdf('0xa1')](function(_0x2ffd2b){for(var _0x24d9c9=0x0;_0x24d9c9<_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')][_0x1bdf('0x4c')];_0x24d9c9+=0x1){socket[_0x1bdf('0xe1')]('userSmsAccount:save',{'UserId':Number(_0x4206a6[_0x1bdf('0x5f')][_0x1bdf('0x6c')][_0x24d9c9]),'SmsAccountId':Number(_0x4206a6[_0x1bdf('0x64')]['id'])});}return _0x2ffd2b;});}})[_0x1bdf('0x23')](respondWithResult(_0x247765,null))[_0x1bdf('0x2d')](handleError(_0x247765,null));};exports[_0x1bdf('0xe2')]=function(_0x3e6756,_0x32978b,_0x25aa5d){return db[_0x1bdf('0x42')][_0x1bdf('0x5d')]({'where':{'id':_0x3e6756['params']['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x32978b,null))[_0x1bdf('0x23')](function(_0x48beb9){if(_0x48beb9){return _0x48beb9[_0x1bdf('0xe2')](_0x3e6756[_0x1bdf('0x47')]['ids'])[_0x1bdf('0x23')](function(){if(_[_0x1bdf('0xe3')](_0x3e6756['query'][_0x1bdf('0x6c')])){for(var _0x28f580=0x0;_0x28f580<_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')][_0x1bdf('0x4c')];_0x28f580+=0x1){socket[_0x1bdf('0xe1')](_0x1bdf('0xe4'),{'UserId':Number(_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')][_0x28f580]),'SmsAccountId':Number(_0x3e6756[_0x1bdf('0x64')]['id'])});}}else{socket[_0x1bdf('0xe1')](_0x1bdf('0xe4'),{'UserId':Number(_0x3e6756[_0x1bdf('0x47')][_0x1bdf('0x6c')]),'SmsAccountId':Number(_0x3e6756[_0x1bdf('0x64')]['id'])});}});}})[_0x1bdf('0x23')](respondWithStatusCode(_0x32978b,null))[_0x1bdf('0x2d')](handleError(_0x32978b,null));};exports[_0x1bdf('0xe5')]=function(_0x30abc2,_0x2cfcce,_0x1716a8){var _0x24392b={};var _0x5941be={};var _0x1f2a99;var _0x4f47a0;return db[_0x1bdf('0x42')][_0x1bdf('0x69')]({'where':{'id':_0x30abc2[_0x1bdf('0x64')]['id']}})[_0x1bdf('0x23')](handleEntityNotFound(_0x2cfcce,null))[_0x1bdf('0x23')](function(_0x3cad28){if(_0x3cad28){_0x1f2a99=_0x3cad28;_0x5941be[_0x1bdf('0x46')]=_[_0x1bdf('0x5c')](db[_0x1bdf('0xaa')]['rawAttributes']);_0x5941be['query']=_['keys'](_0x30abc2[_0x1bdf('0x47')]);_0x5941be[_0x1bdf('0x48')]=_['intersection'](_0x5941be[_0x1bdf('0x46')],_0x5941be[_0x1bdf('0x47')]);_0x24392b[_0x1bdf('0x4a')]=_[_0x1bdf('0x49')](_0x5941be[_0x1bdf('0x46')],qs['fields'](_0x30abc2[_0x1bdf('0x47')]['fields']));_0x24392b[_0x1bdf('0x4a')]=_0x24392b[_0x1bdf('0x4a')]['length']?_0x24392b[_0x1bdf('0x4a')]:_0x5941be[_0x1bdf('0x46')];_0x24392b['order']=qs['sort'](_0x30abc2['query']['sort']);_0x24392b['where']=qs[_0x1bdf('0x48')](_[_0x1bdf('0x52')](_0x30abc2[_0x1bdf('0x47')],_0x5941be['filters']));if(_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x55')]){_0x24392b[_0x1bdf('0x51')]=_[_0x1bdf('0x53')](_0x24392b[_0x1bdf('0x51')],{'$or':_[_0x1bdf('0x41')](_0x24392b['attributes'],function(_0x4c16c5){var _0x2565fd={};_0x2565fd[_0x4c16c5]={'$like':'%'+_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x55')]+'%'};return _0x2565fd;})});}_0x24392b=_['merge']({},_0x24392b,_0x30abc2[_0x1bdf('0x56')]);return _0x1f2a99[_0x1bdf('0xe5')](_0x24392b);}})[_0x1bdf('0x23')](function(_0x576302){if(_0x576302){_0x4f47a0=_0x576302[_0x1bdf('0x4c')];if(!_0x30abc2[_0x1bdf('0x47')]['hasOwnProperty'](_0x1bdf('0x4e'))){_0x24392b['limit']=qs[_0x1bdf('0x33')](_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x33')]);_0x24392b[_0x1bdf('0x31')]=qs[_0x1bdf('0x31')](_0x30abc2[_0x1bdf('0x47')][_0x1bdf('0x31')]);}return _0x1f2a99[_0x1bdf('0xe5')](_0x24392b);}})[_0x1bdf('0x23')](function(_0x303110){if(_0x303110){return _0x303110?{'count':_0x4f47a0,'rows':_0x303110}:null;}})[_0x1bdf('0x23')](respondWithResult(_0x2cfcce,null))[_0x1bdf('0x2d')](handleError(_0x2cfcce,null));}; \ No newline at end of file +var _0x7251=['DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','findAll','rows','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','mobile','type','twilio','From','Body','messageId','MessageSid','from','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','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','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','SmsApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','error_code'];(function(_0x2ae94e,_0x1fcb78){var _0x1dc97a=function(_0x44bca4){while(--_0x44bca4){_0x2ae94e['push'](_0x2ae94e['shift']());}};_0x1dc97a(++_0x1fcb78);}(_0x7251,0x1de));var _0x1725=function(_0x52682a,_0x17a655){_0x52682a=_0x52682a-0x0;var _0xcafd90=_0x7251[_0x52682a];return _0xcafd90;};'use strict';var emlformat=require(_0x1725('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1725('0x1'));var jsonpatch=require(_0x1725('0x2'));var rp=require(_0x1725('0x3'));var moment=require(_0x1725('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1725('0x5'));var util=require(_0x1725('0x6'));var path=require('path');var sox=require(_0x1725('0x7'));var csv=require(_0x1725('0x8'));var ejs=require(_0x1725('0x9'));var fs=require('fs');var fs_extra=require(_0x1725('0xa'));var _=require(_0x1725('0xb'));var squel=require(_0x1725('0xc'));var crypto=require(_0x1725('0xd'));var jsforce=require(_0x1725('0xe'));var deskjs=require(_0x1725('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1725('0x10'));var Papa=require(_0x1725('0x11'));var Redis=require('ioredis');var authService=require(_0x1725('0x12'));var qs=require(_0x1725('0x13'));var as=require(_0x1725('0x14'));var hardwareService=require(_0x1725('0x15'));var logger=require('../../config/logger')(_0x1725('0x16'));var utils=require(_0x1725('0x17'));var config=require(_0x1725('0x18'));var licenseUtil=require(_0x1725('0x19'));var db=require(_0x1725('0x1a'))['db'];config[_0x1725('0x1b')]=_[_0x1725('0x1c')](config[_0x1725('0x1b')],{'host':_0x1725('0x1d'),'port':0x18eb});var socket=require(_0x1725('0x1e'))(new Redis(config[_0x1725('0x1b')]));require(_0x1725('0x1f'))[_0x1725('0x20')](socket);var jayson=require(_0x1725('0x21'));var client=jayson['client'][_0x1725('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x501f91,_0x171453,_0x4ef052,_0x3576d8){return new BPromise(function(_0x588b24,_0x267913){var _0x456a69=_0x3576d8||client;return _0x456a69['request'](_0x501f91,_0x4ef052)[_0x1725('0x23')](function(_0x1dda50){logger[_0x1725('0x24')](_0x1725('0x25'),_0x171453,'request\x20sent');logger[_0x1725('0x26')](_0x1725('0x27'),_0x171453,_0x1725('0x28'),JSON[_0x1725('0x29')](_0x1dda50));if(_0x1dda50[_0x1725('0x2a')]){if(_0x1dda50[_0x1725('0x2a')][_0x1725('0x2b')]===0x1f4){logger[_0x1725('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x171453,_0x1dda50[_0x1725('0x2a')][_0x1725('0x2c')]);return _0x267913(_0x1dda50['error'][_0x1725('0x2c')]);}logger[_0x1725('0x2a')](_0x1725('0x25'),_0x171453,_0x1dda50[_0x1725('0x2a')][_0x1725('0x2c')]);return _0x588b24(_0x1dda50[_0x1725('0x2a')][_0x1725('0x2c')]);}else{logger[_0x1725('0x24')](_0x1725('0x25'),_0x171453,'request\x20sent');_0x588b24(_0x1dda50[_0x1725('0x2d')][_0x1725('0x2c')]);}})[_0x1725('0x2e')](function(_0x1e25dd){logger[_0x1725('0x2a')](_0x1725('0x25'),_0x171453,_0x1e25dd);_0x267913(_0x1e25dd);});});}function respondWithStatusCode(_0x4c95fb,_0x2f31a2){_0x2f31a2=_0x2f31a2||0xcc;return function(_0x5be0bf){if(_0x5be0bf){return _0x4c95fb[_0x1725('0x2f')](_0x2f31a2);}return _0x4c95fb[_0x1725('0x30')](_0x2f31a2)[_0x1725('0x31')]();};}function respondWithResult(_0x37043c,_0x5e55a3){_0x5e55a3=_0x5e55a3||0xc8;return function(_0x35c072){if(_0x35c072){return _0x37043c[_0x1725('0x30')](_0x5e55a3)[_0x1725('0x32')](_0x35c072);}};}function respondWithFilteredResult(_0x2583ad,_0x2082a8){return function(_0x6fd094){if(_0x6fd094){var _0x23aec7=typeof _0x2082a8['offset']==='undefined'&&typeof _0x2082a8[_0x1725('0x33')]===_0x1725('0x34');var _0x37df38=_0x6fd094[_0x1725('0x35')];var _0x400a2b=_0x23aec7?0x0:_0x2082a8[_0x1725('0x36')];var _0x86ab00=_0x23aec7?_0x6fd094[_0x1725('0x35')]:_0x2082a8[_0x1725('0x36')]+_0x2082a8['limit'];var _0x3c3de;if(_0x86ab00>=_0x37df38){_0x86ab00=_0x37df38;_0x3c3de=0xc8;}else{_0x3c3de=0xce;}_0x2583ad['status'](_0x3c3de);return _0x2583ad[_0x1725('0x37')]('Content-Range',_0x400a2b+'-'+_0x86ab00+'/'+_0x37df38)[_0x1725('0x32')](_0x6fd094);}return null;};}function patchUpdates(_0x5ca105){return function(_0x4389df){try{jsonpatch['apply'](_0x4389df,_0x5ca105,!![]);}catch(_0x328305){return BPromise[_0x1725('0x38')](_0x328305);}return _0x4389df['save']();};}function saveUpdates(_0x40dff8,_0x26495d){return function(_0x3d38a7){if(_0x3d38a7){return _0x3d38a7[_0x1725('0x39')](_0x40dff8)[_0x1725('0x23')](function(_0x11bf6c){return _0x11bf6c;});}return null;};}function removeEntity(_0x5b753c,_0x572c61){return function(_0x479d19){if(_0x479d19){return _0x479d19[_0x1725('0x3a')]()[_0x1725('0x23')](function(){var _0x3d6a59=_0x479d19['get']({'plain':!![]});var _0x59ad6f=_0x1725('0x3b');return db[_0x1725('0x3c')][_0x1725('0x3a')]({'where':{'type':_0x59ad6f,'resourceId':_0x3d6a59['id']}})[_0x1725('0x23')](function(){return _0x479d19;});})[_0x1725('0x23')](function(){_0x5b753c[_0x1725('0x30')](0xcc)[_0x1725('0x31')]();});}};}function handleEntityNotFound(_0x309921,_0x4fc8c6){return function(_0x1a16b2){if(!_0x1a16b2){_0x309921[_0x1725('0x2f')](0x194);}return _0x1a16b2;};}function handleError(_0x3f5bc9,_0x3c6a3b){_0x3c6a3b=_0x3c6a3b||0x1f4;return function(_0x15bfb2){logger[_0x1725('0x2a')](_0x15bfb2[_0x1725('0x3d')]);if(_0x15bfb2[_0x1725('0x3e')]){delete _0x15bfb2['name'];}_0x3f5bc9[_0x1725('0x30')](_0x3c6a3b)[_0x1725('0x3f')](_0x15bfb2);};}exports[_0x1725('0x40')]=function(_0x23a80b,_0x141dfb){var _0x1b3b45={'include':[{'model':db[_0x1725('0x41')],'as':_0x1725('0x42')}]},_0xeff06d={},_0x110965={'count':0x0,'rows':[]};var _0x4e1506=_['map'](db[_0x1725('0x43')]['rawAttributes'],function(_0x1fdcf6){return{'name':_0x1fdcf6[_0x1725('0x44')],'type':_0x1fdcf6['type'][_0x1725('0x45')]};});_0xeff06d[_0x1725('0x46')]=_[_0x1725('0x47')](_0x4e1506,_0x1725('0x3e'));_0xeff06d[_0x1725('0x48')]=_[_0x1725('0x49')](_0x23a80b[_0x1725('0x48')]);_0xeff06d[_0x1725('0x4a')]=_[_0x1725('0x4b')](_0xeff06d['model'],_0xeff06d[_0x1725('0x48')]);_0x1b3b45[_0x1725('0x4c')]=_[_0x1725('0x4b')](_0xeff06d[_0x1725('0x46')],qs['fields'](_0x23a80b[_0x1725('0x48')][_0x1725('0x4d')]));_0x1b3b45[_0x1725('0x4c')]=_0x1b3b45[_0x1725('0x4c')]['length']?_0x1b3b45[_0x1725('0x4c')]:_0xeff06d['model'];if(!_0x23a80b[_0x1725('0x48')][_0x1725('0x4e')](_0x1725('0x4f'))){_0x1b3b45[_0x1725('0x33')]=qs[_0x1725('0x33')](_0x23a80b[_0x1725('0x48')][_0x1725('0x33')]);_0x1b3b45[_0x1725('0x36')]=qs[_0x1725('0x36')](_0x23a80b[_0x1725('0x48')][_0x1725('0x36')]);}_0x1b3b45['order']=qs['sort'](_0x23a80b[_0x1725('0x48')][_0x1725('0x50')]);_0x1b3b45[_0x1725('0x51')]=qs[_0x1725('0x4a')](_[_0x1725('0x52')](_0x23a80b[_0x1725('0x48')],_0xeff06d['filters']),_0x4e1506);if(_0x23a80b[_0x1725('0x48')][_0x1725('0x53')]){_0x1b3b45[_0x1725('0x51')]=_[_0x1725('0x54')](_0x1b3b45[_0x1725('0x51')],{'$or':_[_0x1725('0x47')](_0x4e1506,function(_0x1f2c8f){if(_0x1f2c8f['type']!==_0x1725('0x55')){var _0x5c37f1={};_0x5c37f1[_0x1f2c8f[_0x1725('0x3e')]]={'$like':'%'+_0x23a80b[_0x1725('0x48')][_0x1725('0x53')]+'%'};return _0x5c37f1;}})});}_0x1b3b45=_[_0x1725('0x54')]({},_0x1b3b45,_0x23a80b[_0x1725('0x56')]);var _0x57f389={'where':_0x1b3b45[_0x1725('0x51')]};return db[_0x1725('0x43')][_0x1725('0x35')](_0x57f389)[_0x1725('0x23')](function(_0x145dda){_0x110965['count']=_0x145dda;if(_0x23a80b['query'][_0x1725('0x57')]){_0x1b3b45[_0x1725('0x58')]=[{'all':!![]}];}return db[_0x1725('0x43')]['findAll'](_0x1b3b45);})[_0x1725('0x23')](function(_0x32c9a7){_0x110965['rows']=_0x32c9a7;return _0x110965;})[_0x1725('0x23')](respondWithFilteredResult(_0x141dfb,_0x1b3b45))[_0x1725('0x2e')](handleError(_0x141dfb,null));};exports['show']=function(_0x5cee50,_0x3de928){var _0x1e9a62={'raw':![],'where':{'id':_0x5cee50['params']['id']},'include':[{'model':db[_0x1725('0x41')],'as':_0x1725('0x42')}]},_0x55d69f={};_0x55d69f[_0x1725('0x46')]=_[_0x1725('0x49')](db[_0x1725('0x43')][_0x1725('0x59')]);_0x55d69f[_0x1725('0x48')]=_['keys'](_0x5cee50[_0x1725('0x48')]);_0x55d69f['filters']=_[_0x1725('0x4b')](_0x55d69f[_0x1725('0x46')],_0x55d69f[_0x1725('0x48')]);_0x1e9a62[_0x1725('0x4c')]=_[_0x1725('0x4b')](_0x55d69f['model'],qs['fields'](_0x5cee50[_0x1725('0x48')][_0x1725('0x4d')]));_0x1e9a62[_0x1725('0x4c')]=_0x1e9a62['attributes'][_0x1725('0x5a')]?_0x1e9a62[_0x1725('0x4c')]:_0x55d69f[_0x1725('0x46')];if(_0x5cee50[_0x1725('0x48')]['includeAll']){_0x1e9a62['include']=[{'all':!![]}];}_0x1e9a62=_[_0x1725('0x54')]({},_0x1e9a62,_0x5cee50['options']);return db[_0x1725('0x43')][_0x1725('0x5b')](_0x1e9a62)[_0x1725('0x23')](handleEntityNotFound(_0x3de928,null))[_0x1725('0x23')](respondWithResult(_0x3de928,null))[_0x1725('0x2e')](handleError(_0x3de928,null));};exports[_0x1725('0x5c')]=function(_0x40b6c4,_0x59db7f){return db[_0x1725('0x43')][_0x1725('0x5c')](_0x40b6c4[_0x1725('0x5d')],{})[_0x1725('0x23')](function(_0x9dbe93){var _0x3375d8=_0x40b6c4[_0x1725('0x5e')]['get']({'plain':!![]});if(!_0x3375d8)throw new Error(_0x1725('0x5f'));if(_0x3375d8[_0x1725('0x60')]===_0x1725('0x5e')){var _0x5830f1=_0x9dbe93[_0x1725('0x61')]({'plain':!![]});var _0x5dc348='SmsAccounts';return db[_0x1725('0x62')][_0x1725('0x5b')]({'where':{'name':_0x5dc348,'userProfileId':_0x3375d8[_0x1725('0x63')]},'raw':!![]})[_0x1725('0x23')](function(_0x207675){if(_0x207675&&_0x207675[_0x1725('0x64')]===0x0){return db[_0x1725('0x3c')]['create']({'name':_0x5830f1[_0x1725('0x3e')],'resourceId':_0x5830f1['id'],'type':_0x207675['name'],'sectionId':_0x207675['id']},{})['then'](function(){return _0x9dbe93;});}else{return _0x9dbe93;}})[_0x1725('0x2e')](function(_0x18d6be){logger[_0x1725('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18d6be);throw _0x18d6be;});}return _0x9dbe93;})[_0x1725('0x23')](respondWithResult(_0x59db7f,0xc9))[_0x1725('0x2e')](handleError(_0x59db7f,null));};exports[_0x1725('0x39')]=function(_0xce0a0e,_0x1f8c95){if(_0xce0a0e[_0x1725('0x5d')]['id']){delete _0xce0a0e['body']['id'];}return db['SmsAccount'][_0x1725('0x5b')]({'where':{'id':_0xce0a0e[_0x1725('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x1725('0x42')}]})[_0x1725('0x23')](handleEntityNotFound(_0x1f8c95,null))[_0x1725('0x23')](saveUpdates(_0xce0a0e[_0x1725('0x5d')],null))['then'](respondWithResult(_0x1f8c95,null))[_0x1725('0x2e')](handleError(_0x1f8c95,null));};exports[_0x1725('0x3a')]=function(_0x28693d,_0x55a7f9){return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x28693d[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x55a7f9,null))['then'](removeEntity(_0x55a7f9,null))[_0x1725('0x2e')](handleError(_0x55a7f9,null));};exports['describe']=function(_0x5586d5,_0x46fc9d){return db[_0x1725('0x43')][_0x1725('0x66')]()[_0x1725('0x23')](respondWithResult(_0x46fc9d,null))[_0x1725('0x2e')](handleError(_0x46fc9d,null));};exports[_0x1725('0x67')]=function(_0x203561,_0x1c9009,_0xc40959){if(_0x203561[_0x1725('0x5d')]['id']){delete _0x203561['body']['id'];}return db[_0x1725('0x43')]['find']({'where':{'id':_0x203561[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x1c9009,null))[_0x1725('0x23')](function(_0x5eaac1){if(_0x5eaac1){_0x203561[_0x1725('0x5d')][_0x1725('0x68')]=_0x5eaac1['id'];return db[_0x1725('0x69')][_0x1725('0x5c')](_0x203561['body']);}})[_0x1725('0x23')](respondWithResult(_0x1c9009,null))['catch'](handleError(_0x1c9009,null));};exports[_0x1725('0x6a')]=function(_0x3ff9bf,_0x38a742,_0xdb4b8c){var _0x3e9de5={'raw':![],'where':{}};var _0x5cdf4f={};var _0x20f741={'count':0x0,'rows':[]};return db[_0x1725('0x43')][_0x1725('0x6b')]({'where':{'id':_0x3ff9bf[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x38a742,null))[_0x1725('0x23')](function(_0xc55256){if(_0xc55256){_0x5cdf4f['model']=_['keys'](db[_0x1725('0x69')][_0x1725('0x59')]);_0x5cdf4f[_0x1725('0x48')]=_['keys'](_0x3ff9bf[_0x1725('0x48')]);_0x5cdf4f[_0x1725('0x4a')]=_['intersection'](_0x5cdf4f[_0x1725('0x46')],_0x5cdf4f['query']);_0x3e9de5['attributes']=_['intersection'](_0x5cdf4f['model'],qs['fields'](_0x3ff9bf[_0x1725('0x48')]['fields']));_0x3e9de5[_0x1725('0x4c')]=_0x3e9de5[_0x1725('0x4c')][_0x1725('0x5a')]?_0x3e9de5['attributes']:_0x5cdf4f[_0x1725('0x46')];if(!_0x3ff9bf[_0x1725('0x48')][_0x1725('0x4e')](_0x1725('0x4f'))){_0x3e9de5['limit']=qs[_0x1725('0x33')](_0x3ff9bf['query'][_0x1725('0x33')]);_0x3e9de5[_0x1725('0x36')]=qs[_0x1725('0x36')](_0x3ff9bf[_0x1725('0x48')]['offset']);}_0x3e9de5[_0x1725('0x6c')]=qs['sort'](_0x3ff9bf[_0x1725('0x48')][_0x1725('0x50')]);_0x3e9de5[_0x1725('0x51')]=qs[_0x1725('0x4a')](_[_0x1725('0x52')](_0x3ff9bf[_0x1725('0x48')],_0x5cdf4f['filters']));_0x3e9de5[_0x1725('0x51')][_0x1725('0x68')]=_0xc55256['id'];if(_0x3ff9bf[_0x1725('0x48')][_0x1725('0x53')]){_0x3e9de5[_0x1725('0x51')]=_['merge'](_0x3e9de5[_0x1725('0x51')],{'$or':_[_0x1725('0x47')](_0x3e9de5[_0x1725('0x4c')],function(_0x473ad7){var _0x3842b6={};_0x3842b6[_0x473ad7]={'$like':'%'+_0x3ff9bf[_0x1725('0x48')]['filter']+'%'};return _0x3842b6;})});}_0x3e9de5=_[_0x1725('0x54')]({},_0x3e9de5,_0x3ff9bf[_0x1725('0x56')]);return db['Disposition']['count']({'where':_0x3e9de5[_0x1725('0x51')]})[_0x1725('0x23')](function(_0x105732){_0x20f741[_0x1725('0x35')]=_0x105732;if(_0x3ff9bf[_0x1725('0x48')][_0x1725('0x57')]){_0x3e9de5['include']=[{'all':!![]}];}return db[_0x1725('0x69')][_0x1725('0x6d')](_0x3e9de5);})[_0x1725('0x23')](function(_0x5c4ee8){_0x20f741[_0x1725('0x6e')]=_0x5c4ee8;return _0x20f741;});}})[_0x1725('0x23')](respondWithFilteredResult(_0x38a742,_0x3e9de5))[_0x1725('0x2e')](handleError(_0x38a742,null));};exports['removeDispositions']=function(_0x53bc7c,_0x51d3d5,_0x259ee1){return db['SmsAccount'][_0x1725('0x5b')]({'where':{'id':_0x53bc7c[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x51d3d5,null))[_0x1725('0x23')](function(_0x336bec){if(_0x336bec){return _0x336bec['removeDispositions'](_0x53bc7c[_0x1725('0x48')][_0x1725('0x6f')]);}})[_0x1725('0x23')](respondWithStatusCode(_0x51d3d5,null))[_0x1725('0x2e')](handleError(_0x51d3d5,null));};exports[_0x1725('0x70')]=function(_0x52d0e4,_0x11d7c9,_0x3266ff){if(_0x52d0e4[_0x1725('0x5d')]['id']){delete _0x52d0e4[_0x1725('0x5d')]['id'];}return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x52d0e4[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x11d7c9,null))[_0x1725('0x23')](function(_0x18c68f){if(_0x18c68f){_0x52d0e4[_0x1725('0x5d')][_0x1725('0x68')]=_0x18c68f['id'];return db['CannedAnswer']['create'](_0x52d0e4[_0x1725('0x5d')]);}})['then'](respondWithResult(_0x11d7c9,null))['catch'](handleError(_0x11d7c9,null));};exports[_0x1725('0x71')]=function(_0x217567,_0x23f326,_0x38c9a3){var _0xf7606={'raw':![],'where':{}};var _0x419b33={};var _0x3c8df7={'count':0x0,'rows':[]};return db[_0x1725('0x43')]['findOne']({'where':{'id':_0x217567[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x23f326,null))[_0x1725('0x23')](function(_0x1881e0){if(_0x1881e0){_0x419b33[_0x1725('0x46')]=_[_0x1725('0x49')](db[_0x1725('0x72')][_0x1725('0x59')]);_0x419b33[_0x1725('0x48')]=_['keys'](_0x217567[_0x1725('0x48')]);_0x419b33[_0x1725('0x4a')]=_[_0x1725('0x4b')](_0x419b33['model'],_0x419b33['query']);_0xf7606[_0x1725('0x4c')]=_[_0x1725('0x4b')](_0x419b33[_0x1725('0x46')],qs[_0x1725('0x4d')](_0x217567[_0x1725('0x48')][_0x1725('0x4d')]));_0xf7606[_0x1725('0x4c')]=_0xf7606[_0x1725('0x4c')][_0x1725('0x5a')]?_0xf7606['attributes']:_0x419b33['model'];if(!_0x217567[_0x1725('0x48')]['hasOwnProperty'](_0x1725('0x4f'))){_0xf7606[_0x1725('0x33')]=qs[_0x1725('0x33')](_0x217567[_0x1725('0x48')]['limit']);_0xf7606[_0x1725('0x36')]=qs[_0x1725('0x36')](_0x217567[_0x1725('0x48')][_0x1725('0x36')]);}_0xf7606[_0x1725('0x6c')]=qs['sort'](_0x217567[_0x1725('0x48')][_0x1725('0x50')]);_0xf7606[_0x1725('0x51')]=qs[_0x1725('0x4a')](_['pick'](_0x217567['query'],_0x419b33[_0x1725('0x4a')]));_0xf7606['where'][_0x1725('0x68')]=_0x1881e0['id'];if(_0x217567['query'][_0x1725('0x53')]){_0xf7606[_0x1725('0x51')]=_[_0x1725('0x54')](_0xf7606[_0x1725('0x51')],{'$or':_[_0x1725('0x47')](_0xf7606[_0x1725('0x4c')],function(_0x252bb5){var _0x17e635={};_0x17e635[_0x252bb5]={'$like':'%'+_0x217567[_0x1725('0x48')][_0x1725('0x53')]+'%'};return _0x17e635;})});}_0xf7606=_[_0x1725('0x54')]({},_0xf7606,_0x217567[_0x1725('0x56')]);return db[_0x1725('0x72')][_0x1725('0x35')]({'where':_0xf7606[_0x1725('0x51')]})[_0x1725('0x23')](function(_0xab9538){_0x3c8df7[_0x1725('0x35')]=_0xab9538;if(_0x217567[_0x1725('0x48')][_0x1725('0x57')]){_0xf7606[_0x1725('0x58')]=[{'all':!![]}];}return db[_0x1725('0x72')][_0x1725('0x6d')](_0xf7606);})['then'](function(_0x3060d1){_0x3c8df7['rows']=_0x3060d1;return _0x3c8df7;});}})['then'](respondWithFilteredResult(_0x23f326,_0xf7606))[_0x1725('0x2e')](handleError(_0x23f326,null));};exports[_0x1725('0x73')]=function(_0x1d6296,_0x3d0b72,_0x46a220){return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x1d6296[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x3d0b72,null))[_0x1725('0x23')](function(_0x3129eb){if(_0x3129eb){return _0x3129eb[_0x1725('0x73')](_0x1d6296[_0x1725('0x48')]['ids']);}})[_0x1725('0x23')](respondWithStatusCode(_0x3d0b72,null))['catch'](handleError(_0x3d0b72,null));};exports[_0x1725('0x74')]=function(_0x3bfc32,_0x1abf18,_0x57b825){var _0x3515fa={'channel':_0x1725('0x75')};var _0x28a835=[];var _0x424dbd=[];var _0x42034a={};return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x3bfc32[_0x1725('0x65')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x1725('0x76')}]})[_0x1725('0x23')](handleEntityNotFound(_0x1abf18,null))[_0x1725('0x23')](function(_0x4220f0){_0x3515fa[_0x1725('0x77')]=_0x4220f0;_0x3515fa[_0x1725('0x78')]=_['orderBy'](_0x4220f0[_0x1725('0x76')],['priority'],[_0x1725('0x79')]);if(_0x3515fa[_0x1725('0x77')]['Applications']){delete _0x3515fa[_0x1725('0x77')][_0x1725('0x76')];}return db[_0x1725('0x7a')][_0x1725('0x66')]();})[_0x1725('0x23')](function(_0x1c5c2c){if(!_0x1c5c2c){throw new db[(_0x1725('0x7b'))][(_0x1725('0x7c'))](_0x1725('0x7d'));}_0x28a835=_['difference'](_[_0x1725('0x49')](_0x1c5c2c),['createdAt',_0x1725('0x7e')]);_0x424dbd=_['difference'](_['keys'](_0x1c5c2c),[_0x1725('0x7f'),_0x1725('0x7e'),'CompanyId','ListId']);_0x3515fa[_0x1725('0x5d')]={'mapKey':_0x1725('0x80')};if(_0x3515fa[_0x1725('0x77')][_0x1725('0x81')]){switch(_0x3515fa[_0x1725('0x77')][_0x1725('0x81')]){case _0x1725('0x82'):_0x3515fa['body']['from']=_0x3bfc32['body'][_0x1725('0x83')];_0x3515fa['body']['body']=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x84')];_0x3515fa['body'][_0x1725('0x85')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x86')];break;case'skebby':_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]='+'+_0x3bfc32['body'][_0x1725('0x88')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]=_0x3bfc32[_0x1725('0x5d')]['text'];break;case _0x1725('0x89'):_0x3515fa[_0x1725('0x5d')]['from']=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x87')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]=_0x3bfc32['body'][_0x1725('0x2c')];break;case _0x1725('0x8a'):_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x87')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x5d')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x85')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x8b')];break;case _0x1725('0x8c'):_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x83')];_0x3515fa[_0x1725('0x5d')]['body']=_0x3bfc32['body'][_0x1725('0x8d')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x85')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x8e')];break;case _0x1725('0x8f'):_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]='+'+_0x3bfc32[_0x1725('0x5d')][_0x1725('0x90')][0x0][_0x1725('0x87')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x90')][0x0][_0x1725('0x91')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x85')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x90')][0x0][_0x1725('0x85')];break;case'csc':_0x3515fa[_0x1725('0x5d')]['from']=_0x3bfc32['body'][_0x1725('0x92')];_0x3515fa['body'][_0x1725('0x5d')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x93')][_0x1725('0x2c')];break;case _0x1725('0x94'):_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x95')];_0x3515fa[_0x1725('0x5d')]['body']=_0x3bfc32[_0x1725('0x5d')]['text'];_0x3515fa['body'][_0x1725('0x85')]=_0x3bfc32[_0x1725('0x5d')]['replyMessageId'];break;case _0x1725('0x96'):_0x3515fa[_0x1725('0x5d')]['messageId']=_0x3bfc32['body'][0x0][_0x1725('0x2c')]['id'];_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')]=_0x3bfc32[_0x1725('0x5d')][0x0][_0x1725('0x2c')][_0x1725('0x87')];_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]=_0x3bfc32['body'][0x0][_0x1725('0x2c')][_0x1725('0x91')];break;case _0x1725('0x97'):_0x3515fa['body']['from']=_0x3bfc32[_0x1725('0x5d')][_0x1725('0x87')];_0x3515fa[_0x1725('0x5d')]['body']=_0x3bfc32[_0x1725('0x5d')]['message'];_0x3515fa[_0x1725('0x5d')][_0x1725('0x85')]=_0x3bfc32['body']['refid'];break;}}if(_0x3515fa[_0x1725('0x5d')]['id']){delete _0x3515fa[_0x1725('0x5d')]['id'];}if(_[_0x1725('0x98')](_0x3515fa['body'][_0x1725('0x87')])){throw new db[(_0x1725('0x7b'))][(_0x1725('0x7c'))](_0x1725('0x99'));}if(_[_0x1725('0x98')](_0x3515fa[_0x1725('0x5d')]['body'])||_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')]===''){throw new db[(_0x1725('0x7b'))][(_0x1725('0x7c'))](_0x1725('0x9a'));}if(_[_0x1725('0x98')](_0x3515fa[_0x1725('0x5d')][_0x1725('0x9b')])){throw new db[(_0x1725('0x7b'))]['ValidationError'](_0x1725('0x9c')+_0x424dbd);}if(!_[_0x1725('0x9d')](_0x424dbd,_0x3515fa['body'][_0x1725('0x9b')])){throw new db[(_0x1725('0x7b'))]['ValidationError'](_0x1725('0x9e')+_0x424dbd);}_0x42034a[_0x3515fa['body']['mapKey']]=_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')];return db[_0x1725('0x9f')][_0x1725('0x5b')]({'where':{'id':_0x3515fa['account'][_0x1725('0xa0')]},'include':[{'model':db[_0x1725('0x7a')],'as':_0x1725('0xa1'),'where':_0x42034a,'limit':0x1,'order':[[_0x1725('0x7e'),_0x1725('0xa2')]]}]});})['then'](handleEntityNotFound(_0x1abf18,null))[_0x1725('0x23')](function(_0xd02b82){if(_0xd02b82){_0x3515fa[_0x1725('0xa3')]=_[_0x1725('0xa4')](_0xd02b82,[_0x1725('0xa1')]);if(_0xd02b82[_0x1725('0xa1')][_0x1725('0x5a')]){return _0xd02b82[_0x1725('0xa1')][0x0];}var _0x2fb1ac=_[_0x1725('0x1c')](_0x3515fa[_0x1725('0x5d')],{'firstName':_0x3515fa[_0x1725('0x5d')][_0x1725('0x87')],'ListId':_0xd02b82['id']});_0x2fb1ac[_0x3515fa[_0x1725('0x5d')]['mapKey']]=_0x3515fa['body'][_0x1725('0x87')];return db[_0x1725('0x7a')]['create'](_0x2fb1ac,{'fields':_0x28a835,'raw':!![]});}})[_0x1725('0x23')](handleEntityNotFound(_0x1abf18,null))[_0x1725('0x23')](function(_0x145a54){if(_0x145a54){_0x3515fa[_0x1725('0xa5')]=_0x145a54;var _0x3cbf02={'ContactId':_0x145a54['id'],'phone':_0x3515fa['body']['from'],'SmsAccountId':_0x3bfc32[_0x1725('0x65')]['id']};var _0x5d8d2c={'ContactId':_0x145a54['id'],'SmsAccountId':_0x3bfc32[_0x1725('0x65')]['id'],'closed':![]};return db[_0x1725('0xa6')][_0x1725('0x5b')]({'where':_0x5d8d2c})[_0x1725('0x23')](function(_0x24ae12){if(_0x24ae12){return[_0x24ae12,![]];}return db[_0x1725('0xa6')][_0x1725('0x5c')](_0x3cbf02)['then'](function(_0x2ca3c7){return[_0x2ca3c7,!![]];});});}})[_0x1725('0xa7')](function(_0x1112c8,_0x1a2bc5){_0x3515fa[_0x1725('0xa8')]=_0x1112c8[_0x1725('0x61')]({'plain':!![]});_0x3515fa[_0x1725('0xa8')]['created']=![];if(_0x1a2bc5){if(_0x3515fa[_0x1725('0x77')][_0x1725('0xa9')]){_0x3515fa[_0x1725('0x78')][_0x1725('0xaa')]({'id':0x0,'priority':_0x3515fa['applications'][_0x1725('0x5a')]+0x1,'app':_0x1725('0xab'),'appdata':'unmanaged','interval':_0x1725('0xac')});}_0x3515fa[_0x1725('0xa8')][_0x1725('0xad')]=!![];}return db[_0x1725('0xae')][_0x1725('0x5c')]({'phone':_0x3515fa['body']['from'],'messageId':_0x3515fa[_0x1725('0x5d')][_0x1725('0x85')],'body':_0x3515fa[_0x1725('0x5d')][_0x1725('0x5d')],'SmsAccountId':_0x3bfc32[_0x1725('0x65')]['id'],'SmsInteractionId':_0x1112c8['id'],'direction':'in','ContactId':_0x1112c8[_0x1725('0xaf')],'AttachmentId':_0x3515fa[_0x1725('0x5d')][_0x1725('0xb0')]});})[_0x1725('0x23')](function(_0x41b3b8){_0x3515fa[_0x1725('0x2c')]=_0x41b3b8;if(_0x3515fa[_0x1725('0xa8')][_0x1725('0xb1')]){return db['User'][_0x1725('0x5b')]({'attributes':['id',_0x1725('0x3e')],'where':{'id':_0x3515fa[_0x1725('0xa8')][_0x1725('0xb1')]}})[_0x1725('0x23')](function(_0x3510ba){if(_0x3510ba){_0x3515fa['applications'][_0x1725('0xb2')]({'id':0x0,'priority':0x0,'app':_0x1725('0xb3'),'appdata':_0x3510ba['name']+','+(_0x3515fa['account'][_0x1725('0xb4')]||0xa),'interval':_0x1725('0xac')});}return respondWithRpcPromise(_0x1725('0xb5'),_0x1725('0xb6'),_0x3515fa);});}return respondWithRpcPromise(_0x1725('0xb5'),_0x1725('0xb6'),_0x3515fa);})[_0x1725('0x23')](function(_0x108e00){if(_0x108e00){var _0x1698b9=0xc8;var _0x331c81='receiveMessage';logger[_0x1725('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x331c81,_0x1698b9,_0x1725('0xb7'));logger[_0x1725('0x26')](_0x1725('0xb8'),_0x331c81,_0x1698b9,'entity\x20found',JSON[_0x1725('0x29')](_0x108e00));if(_0x3515fa[_0x1725('0x77')][_0x1725('0x81')]===_0x1725('0x82')){return _0x1abf18[_0x1725('0x30')](_0x1698b9)[_0x1725('0x37')]('Content-Type','text/xml')[_0x1725('0x3f')]('\x0a');}else{return _0x1abf18[_0x1725('0x30')](_0x1698b9)['json'](_0x108e00);}}})['catch'](handleError(_0x1abf18,null));};exports['addApplications']=function(_0x32dcff,_0x170df5){var _0x5529aa=_0x32dcff[_0x1725('0x65')]['id'];var _0x3f2d21=_0x32dcff[_0x1725('0x5d')];var _0x3fbbc2=0xc8;var _0x454308=null;return db[_0x1725('0xb9')][_0x1725('0xba')]({'isolationLevel':db['sequelize']['Transaction'][_0x1725('0xbb')][_0x1725('0xbc')]},function(_0x106470){return db[_0x1725('0x43')]['findOne']({'where':{'id':_0x5529aa},'transaction':_0x106470})['then'](function(_0x35949f){if(_0x35949f){return db['SmsApplication'][_0x1725('0x3a')]({'where':{'SmsAccountId':_0x5529aa},'transaction':_0x106470})[_0x1725('0x23')](function(){var _0x5c910b=_[_0x1725('0x47')](_0x3f2d21,function(_0x5dd37c){_0x5dd37c[_0x1725('0x68')]=_0x5529aa;return _0x5dd37c;});return db['SmsApplication'][_0x1725('0xbd')](_0x5c910b,{'transaction':_0x106470});});}else{_0x3fbbc2=0x194;_0x454308=[];}});})[_0x1725('0x23')](function(){if(_0x3fbbc2!==0x194){return db[_0x1725('0xbe')][_0x1725('0xbf')]({'where':{'SmsAccountId':_0x5529aa},'order':_0x1725('0xc0')})['then'](function(_0x4cc3ba){_0x454308=_0x4cc3ba;});}})['catch'](function(_0x2fda2b){_0x3fbbc2=0x1f4;logger[_0x1725('0x2a')](_0x2fda2b[_0x1725('0x3d')]);if(_0x2fda2b[_0x1725('0x3e')]){delete _0x2fda2b[_0x1725('0x3e')];}_0x454308=_0x2fda2b;})['finally'](function(){if(_0x454308===null){_0x170df5[_0x1725('0x2f')](_0x3fbbc2);}else{if(_0x3fbbc2===0x1f4){_0x170df5[_0x1725('0x30')](_0x3fbbc2)['send'](_0x454308);}else{_0x170df5[_0x1725('0x30')](_0x3fbbc2)['json'](_0x454308);}}});};exports[_0x1725('0xc1')]=function(_0xe6f52d,_0xc774e0,_0x19900a){var _0x4497ca={};var _0x3b9b02={};var _0x332729;var _0x30747d;return db[_0x1725('0x43')][_0x1725('0x6b')]({'where':{'id':_0xe6f52d[_0x1725('0x65')]['id']}})['then'](handleEntityNotFound(_0xc774e0,null))[_0x1725('0x23')](function(_0x551b63){if(_0x551b63){_0x332729=_0x551b63;_0x3b9b02[_0x1725('0x46')]=_[_0x1725('0x49')](db[_0x1725('0xbe')][_0x1725('0x59')]);_0x3b9b02['query']=_['keys'](_0xe6f52d['query']);_0x3b9b02[_0x1725('0x4a')]=_[_0x1725('0x4b')](_0x3b9b02['model'],_0x3b9b02[_0x1725('0x48')]);_0x4497ca[_0x1725('0x4c')]=_[_0x1725('0x4b')](_0x3b9b02[_0x1725('0x46')],qs[_0x1725('0x4d')](_0xe6f52d[_0x1725('0x48')][_0x1725('0x4d')]));_0x4497ca['attributes']=_0x4497ca[_0x1725('0x4c')][_0x1725('0x5a')]?_0x4497ca['attributes']:_0x3b9b02[_0x1725('0x46')];_0x4497ca[_0x1725('0x6c')]=qs[_0x1725('0x50')](_0xe6f52d['query'][_0x1725('0x50')]);_0x4497ca[_0x1725('0x51')]=qs['filters'](_['pick'](_0xe6f52d[_0x1725('0x48')],_0x3b9b02['filters']));if(_0xe6f52d['query'][_0x1725('0x53')]){_0x4497ca[_0x1725('0x51')]=_[_0x1725('0x54')](_0x4497ca[_0x1725('0x51')],{'$or':_[_0x1725('0x47')](_0x4497ca['attributes'],function(_0x20abeb){var _0x329fa1={};_0x329fa1[_0x20abeb]={'$like':'%'+_0xe6f52d['query'][_0x1725('0x53')]+'%'};return _0x329fa1;})});}_0x4497ca=_['merge']({},_0x4497ca,_0xe6f52d[_0x1725('0x56')]);return _0x332729[_0x1725('0xc1')](_0x4497ca);}})[_0x1725('0x23')](function(_0x5e2add){if(_0x5e2add){_0x30747d=_0x5e2add[_0x1725('0x5a')];if(!_0xe6f52d[_0x1725('0x48')]['hasOwnProperty'](_0x1725('0x4f'))){_0x4497ca[_0x1725('0x33')]=qs['limit'](_0xe6f52d[_0x1725('0x48')]['limit']);_0x4497ca[_0x1725('0x36')]=qs[_0x1725('0x36')](_0xe6f52d['query'][_0x1725('0x36')]);}return _0x332729[_0x1725('0xc1')](_0x4497ca);}})['then'](function(_0x46432e){if(_0x46432e){return _0x46432e?{'count':_0x30747d,'rows':_0x46432e}:null;}})[_0x1725('0x23')](respondWithResult(_0xc774e0,null))[_0x1725('0x2e')](handleError(_0xc774e0,null));};exports[_0x1725('0xc2')]=function(_0x3b0b2a,_0x235f89,_0x31b4a6){var _0x33185f={'raw':![],'where':{}};var _0x2a8106={};var _0x39a698={'count':0x0,'rows':[]};return db[_0x1725('0x43')]['findOne']({'where':{'id':_0x3b0b2a['params']['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x235f89,null))['then'](function(_0x3bc03a){if(_0x3bc03a){_0x2a8106[_0x1725('0x46')]=_['keys'](db[_0x1725('0xa6')][_0x1725('0x59')]);_0x2a8106[_0x1725('0x48')]=_[_0x1725('0x49')](_0x3b0b2a[_0x1725('0x48')]);_0x2a8106[_0x1725('0x4a')]=_['intersection'](_0x2a8106[_0x1725('0x46')],_0x2a8106[_0x1725('0x48')]);_0x33185f['attributes']=_[_0x1725('0x4b')](_0x2a8106[_0x1725('0x46')],qs[_0x1725('0x4d')](_0x3b0b2a[_0x1725('0x48')][_0x1725('0x4d')]));_0x33185f[_0x1725('0x4c')]=_0x33185f['attributes']['length']?_0x33185f[_0x1725('0x4c')]:_0x2a8106[_0x1725('0x46')];if(!_0x3b0b2a[_0x1725('0x48')]['hasOwnProperty'](_0x1725('0x4f'))){_0x33185f[_0x1725('0x33')]=qs['limit'](_0x3b0b2a['query'][_0x1725('0x33')]);_0x33185f['offset']=qs[_0x1725('0x36')](_0x3b0b2a[_0x1725('0x48')][_0x1725('0x36')]);}_0x33185f[_0x1725('0x6c')]=qs[_0x1725('0x50')](_0x3b0b2a[_0x1725('0x48')][_0x1725('0x50')]);_0x33185f['where']=qs[_0x1725('0x4a')](_[_0x1725('0x52')](_0x3b0b2a[_0x1725('0x48')],_0x2a8106[_0x1725('0x4a')]));_0x33185f[_0x1725('0x51')]['SmsAccountId']=_0x3bc03a['id'];if(_0x3b0b2a[_0x1725('0x48')][_0x1725('0x53')]){_0x33185f[_0x1725('0x51')]=_[_0x1725('0x54')](_0x33185f['where'],{'$or':_[_0x1725('0x47')](_0x33185f[_0x1725('0x4c')],function(_0xedf0cb){var _0x4b8bee={};_0x4b8bee[_0xedf0cb]={'$like':'%'+_0x3b0b2a[_0x1725('0x48')]['filter']+'%'};return _0x4b8bee;})});}_0x33185f=_[_0x1725('0x54')]({},_0x33185f,_0x3b0b2a['options']);return db[_0x1725('0xa6')][_0x1725('0x35')]({'where':_0x33185f[_0x1725('0x51')]})[_0x1725('0x23')](function(_0x2cb15b){_0x39a698[_0x1725('0x35')]=_0x2cb15b;if(_0x3b0b2a['query']['includeAll']){_0x33185f[_0x1725('0x58')]=[{'model':db[_0x1725('0x7a')],'as':_0x1725('0xc3'),'required':![]},{'model':db['User'],'as':_0x1725('0xc4'),'attributes':[_0x1725('0x3e'),_0x1725('0xc5'),_0x1725('0xc6')],'required':![]},{'model':db[_0x1725('0xc7')],'as':_0x1725('0xc8'),'attributes':['id',_0x1725('0x3e'),_0x1725('0xc9')],'where':_0x3b0b2a[_0x1725('0x48')]['tag']?{'id':_0x3b0b2a[_0x1725('0x48')]['tag']}:undefined,'required':_0x3b0b2a[_0x1725('0x48')][_0x1725('0xca')]?!![]:![]}];}return db[_0x1725('0xa6')][_0x1725('0x6d')](_0x33185f);})['then'](function(_0x2cad42){_0x39a698[_0x1725('0x6e')]=_0x2cad42;return _0x39a698;});}})['then'](respondWithFilteredResult(_0x235f89,_0x33185f))[_0x1725('0x2e')](handleError(_0x235f89,null));};exports[_0x1725('0x3f')]=function(_0x1c3f4f,_0x19992,_0x48e8e6){var _0x113c10,_0x3b2ff8,_0x2a5696;if(_[_0x1725('0x98')](_0x1c3f4f['body']['body'])||_0x1c3f4f[_0x1725('0x5d')][_0x1725('0x5d')]===''){throw new db[(_0x1725('0x7b'))]['ValidationError'](_0x1725('0x9a'));}if(_[_0x1725('0x98')](_0x1c3f4f['body']['to'])){throw new db[(_0x1725('0x7b'))][(_0x1725('0x7c'))](_0x1725('0xcb'));}_0x113c10=_0x1c3f4f[_0x1725('0x5d')]['to'];return db[_0x1725('0x43')]['find']({'where':{'id':_0x1c3f4f[_0x1725('0x65')]['id']},'include':[{'model':db[_0x1725('0x9f')],'as':_0x1725('0xcc'),'include':[{'model':db[_0x1725('0x7a')],'as':_0x1725('0xa1'),'where':{'mobile':_0x113c10},'limit':0x1,'order':[['updatedAt',_0x1725('0xa2')]]}]}]})[_0x1725('0x23')](handleEntityNotFound(_0x19992,null))['then'](function(_0x5a5ed2){if(_0x5a5ed2&&_0x5a5ed2[_0x1725('0xcc')]){_0x3b2ff8=_0x5a5ed2['get']({'plain':!![]});if(_0x3b2ff8[_0x1725('0xcc')]&&_0x3b2ff8[_0x1725('0xcc')][_0x1725('0xa1')][_0x1725('0x5a')]){return _0x3b2ff8[_0x1725('0xcc')][_0x1725('0xa1')][0x0];}return db[_0x1725('0x7a')][_0x1725('0x5c')](_[_0x1725('0x1c')](_0x1c3f4f[_0x1725('0x5d')],{'firstName':_0x113c10,'mobile':_0x113c10,'phone':_0x113c10,'ListId':_0x3b2ff8[_0x1725('0xa0')]}));}})[_0x1725('0x23')](handleEntityNotFound(_0x19992,null))[_0x1725('0x23')](function(_0x3b564b){if(_0x3b564b){_0x2a5696=_0x3b564b;return db[_0x1725('0xa6')][_0x1725('0x5b')]({'where':{'ContactId':_0x2a5696['id'],'closed':![],'SmsAccountId':_0x3b2ff8['id']}})[_0x1725('0x23')](function(_0x2b0099){if(_0x2b0099){return[_0x2b0099,![]];}return db['SmsInteraction']['create']({'UserId':_0x1c3f4f[_0x1725('0x5e')]['id'],'ContactId':_0x2a5696['id'],'SmsAccountId':_0x3b2ff8['id'],'phone':_0x113c10,'firstMsgDirection':_0x1725('0xcd'),'Messages':[_[_0x1725('0x54')](_0x1c3f4f[_0x1725('0x5d')],{'read':![],'body':_0x1c3f4f[_0x1725('0x5d')]['body'],'phone':_0x113c10,'SmsAccountId':_0x3b2ff8['id'],'UserId':_0x1c3f4f['user']['id'],'ContactId':_0x2a5696['id']})]},{'include':[{'model':db[_0x1725('0xae')],'as':_0x1725('0xce')}]})[_0x1725('0x23')](function(_0x32d043){return[_0x32d043,!![]];});});}})['spread'](function(_0x337913,_0x5ef7fe){if(_0x5ef7fe){return _0x337913;}return db[_0x1725('0xae')][_0x1725('0x5c')](_[_0x1725('0x54')](_0x1c3f4f[_0x1725('0x5d')],{'read':![],'body':_0x1c3f4f[_0x1725('0x5d')][_0x1725('0x5d')],'phone':_0x113c10,'SmsAccountId':_0x3b2ff8['id'],'SmsInteractionId':_0x337913['id'],'UserId':_0x1c3f4f[_0x1725('0x5e')]['id'],'ContactId':_0x2a5696['id']}))[_0x1725('0x23')](function(_0x90c091){_0x337913[_0x1725('0xcf')][_0x1725('0xce')]=[];_0x337913[_0x1725('0xcf')]['Messages'][_0x1725('0xaa')](_0x90c091[_0x1725('0xcf')]);return _0x337913;});})[_0x1725('0x23')](respondWithResult(_0x19992,null))['catch'](handleError(_0x19992,null));};exports[_0x1725('0x30')]=function(_0x5c82d5,_0x271136,_0x3f2725){if(_0x5c82d5[_0x1725('0x5d')]['id']){delete _0x5c82d5[_0x1725('0x5d')]['id'];}var _0x5cb63e,_0x40df47,_0x4c874b;return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x5c82d5[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x271136,null))[_0x1725('0x23')](function(_0x2f81a0){if(_0x2f81a0){_0x4c874b=_0x2f81a0;logger[_0x1725('0x26')](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0xd0'),_0x2f81a0[_0x1725('0x81')],util[_0x1725('0xd1')](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));switch(_0x2f81a0[_0x1725('0x81')]){case _0x1725('0xd2'):if(_0x5c82d5[_0x1725('0x5d')][_0x1725('0xd3')]&&_0x5c82d5[_0x1725('0x5d')][_0x1725('0x30')]){_0x40df47=_0x5c82d5[_0x1725('0x5d')]['status'];return db[_0x1725('0xae')]['find']({'where':{'messageId':_0x5c82d5['body'][_0x1725('0xd3')]}});}break;case _0x1725('0x89'):if(_0x5c82d5['body'][_0x1725('0xd4')]&&_0x5c82d5['body'][_0x1725('0xd5')]){_0x40df47=_0x5c82d5['body'][_0x1725('0xd5')];return db[_0x1725('0xae')][_0x1725('0x5b')]({'where':{'messageId':_0x5c82d5[_0x1725('0x5d')]['requestid']}});}break;case _0x1725('0x8a'):if(_0x5c82d5[_0x1725('0x5d')][_0x1725('0x8b')]&&_0x5c82d5[_0x1725('0x5d')]['status_code']){_0x40df47=_0x5c82d5[_0x1725('0x5d')]['status_code'];return db['SmsMessage'][_0x1725('0x5b')]({'where':{'messageId':_0x5c82d5[_0x1725('0x5d')][_0x1725('0x8b')]}});}break;case _0x1725('0x8f'):var _0x1ba538=_0x5c82d5[_0x1725('0x5d')][_0x1725('0x90')][0x0];if(_0x1ba538[_0x1725('0x85')]&&_0x1ba538[_0x1725('0x30')][_0x1725('0xd6')]===_0x1725('0xd7')){_0x40df47=_0x1ba538[_0x1725('0x30')]['groupName'];return db[_0x1725('0xae')][_0x1725('0x5b')]({'where':{'messageId':_0x1ba538[_0x1725('0x85')]}});}break;case'clickatell':if(_0x5c82d5[_0x1725('0x5d')][_0x1725('0x85')]&&_0x5c82d5[_0x1725('0x5d')][_0x1725('0x30')]){_0x40df47=_0x5c82d5[_0x1725('0x5d')][_0x1725('0x30')];return db['SmsMessage'][_0x1725('0x5b')]({'where':{'messageId':_0x5c82d5[_0x1725('0x5d')][_0x1725('0x85')]}});}break;case _0x1725('0x96'):if(_0x5c82d5['body'][0x0][_0x1725('0x2c')]['id']){_0x40df47=_0x5c82d5['body'][0x0]['type'];return db[_0x1725('0xae')][_0x1725('0x5b')]({'where':{'messageId':_0x5c82d5[_0x1725('0x5d')][0x0][_0x1725('0x2c')]['id']}});}break;case _0x1725('0x97'):if(_0x5c82d5[_0x1725('0x5d')][_0x1725('0xd8')]&&_0x5c82d5[_0x1725('0x5d')][_0x1725('0x30')]){_0x40df47=_0x5c82d5['body'][_0x1725('0x30')];return db[_0x1725('0xae')][_0x1725('0x5b')]({'where':{'messageId':_0x5c82d5[_0x1725('0x5d')][_0x1725('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x271136,null))[_0x1725('0x23')](function(_0xf57f0a){if(_0xf57f0a){_0x5cb63e=_0xf57f0a;switch(_0x4c874b['type']){case _0x1725('0xd2'):if(_0x40df47===_0x1725('0xd7')){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger['error'](_0x1725('0x27'),_0x1725('0x30'),'skebby',util[_0x1725('0xd1')](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1725('0x89'):if(_0x40df47==='1'){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1725('0x30'),_0x1725('0xd2'),util['inspect'](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1725('0x8a'):if(!_0x5c82d5[_0x1725('0x5d')][_0x1725('0xd9')]&&_0x40df47>=0xc8&&_0x40df47<=0xce){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger[_0x1725('0x2a')](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0x8a'),util[_0x1725('0xd1')](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1725('0x8f'):var _0x53d84f=_0x5c82d5[_0x1725('0x5d')]['results'][0x0];if(_0x53d84f[_0x1725('0x30')][_0x1725('0xd6')]===_0x1725('0xd7')){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger['error'](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0x8f'),util[_0x1725('0xd1')](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1725('0x94'):if(_0x40df47==_0x1725('0xda')||_0x40df47==_0x1725('0xdb')){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger[_0x1725('0x2a')](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0x94'),util[_0x1725('0xd1')](_0x5c82d5['body'],{'showHidden':![],'depth':null}));}break;case _0x1725('0x96'):if(_0x40df47==_0x1725('0xdc')){return _0x5cb63e[_0x1725('0x39')]({'read':!![]});}else{logger[_0x1725('0x2a')](_0x1725('0x27'),'status',_0x1725('0x96'),util[_0x1725('0xd1')](_0x5c82d5[_0x1725('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1725('0x97'):if(_0x40df47===_0x1725('0xdd')||_0x40df47===_0x1725('0xde')){return _0x5cb63e['update']({'read':!![]});}else{logger[_0x1725('0x2a')](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0x97'),util[_0x1725('0xd1')](_0x5c82d5['body'],{'showHidden':![],'depth':null}));}break;}return _0x5cb63e;}})['then'](respondWithResult(_0x271136,null))['catch'](handleError(_0x271136,null));};exports['statusGet']=function(_0x3d867e,_0x19c87b,_0x5bc0b2){var _0xd9a0f6,_0x4084fd,_0x5e48bb;return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x3d867e['params']['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x19c87b,null))['then'](function(_0x512999){if(_0x512999){_0x5e48bb=_0x512999;logger[_0x1725('0x26')](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0xd0'),_0x512999[_0x1725('0x81')],util[_0x1725('0xd1')](_0x3d867e[_0x1725('0x48')],{'showHidden':![],'depth':null}));switch(_0x512999[_0x1725('0x81')]){case'csc':if(_0x3d867e[_0x1725('0x48')][_0x1725('0xdf')]&&_0x3d867e['query']['state']){_0x4084fd=_0x3d867e[_0x1725('0x48')][_0x1725('0xe0')];return db[_0x1725('0xae')][_0x1725('0x5b')]({'where':{'messageId':_0x3d867e[_0x1725('0x48')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x19c87b,null))[_0x1725('0x23')](function(_0x413862){if(_0x413862){_0xd9a0f6=_0x413862;switch(_0x5e48bb[_0x1725('0x81')]){case _0x1725('0xe1'):if(_0x4084fd==='2'||_0x4084fd==='6'){return _0xd9a0f6[_0x1725('0x39')]({'read':!![]});}else{logger['error'](_0x1725('0x27'),_0x1725('0x30'),_0x1725('0xe1'),util[_0x1725('0xd1')](_0x3d867e['query'],{'showHidden':![],'depth':null}));};break;}return _0xd9a0f6;}})[_0x1725('0x23')](respondWithResult(_0x19c87b,null))[_0x1725('0x2e')](handleError(_0x19c87b,null));};exports[_0x1725('0xe2')]=function(_0x447b8,_0x2d6fe0,_0x498ac1){return db[_0x1725('0x43')][_0x1725('0x5b')]({'where':{'id':_0x447b8[_0x1725('0x65')]['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x2d6fe0,null))[_0x1725('0x23')](function(_0x252716){if(_0x252716){return _0x252716[_0x1725('0xe2')](_0x447b8['body'][_0x1725('0x6f')],_[_0x1725('0xa4')](_0x447b8[_0x1725('0x5d')],[_0x1725('0x6f'),'id'])||{})[_0x1725('0xa7')](function(_0x57676a){for(var _0x293876=0x0;_0x293876<_0x447b8['body'][_0x1725('0x6f')][_0x1725('0x5a')];_0x293876+=0x1){socket[_0x1725('0xe3')](_0x1725('0xe4'),{'UserId':Number(_0x447b8[_0x1725('0x5d')][_0x1725('0x6f')][_0x293876]),'SmsAccountId':Number(_0x447b8[_0x1725('0x65')]['id'])});}return _0x57676a;});}})[_0x1725('0x23')](respondWithResult(_0x2d6fe0,null))[_0x1725('0x2e')](handleError(_0x2d6fe0,null));};exports[_0x1725('0xe5')]=function(_0x1cf9be,_0x3aec84,_0x53277f){return db['SmsAccount'][_0x1725('0x5b')]({'where':{'id':_0x1cf9be['params']['id']}})[_0x1725('0x23')](handleEntityNotFound(_0x3aec84,null))['then'](function(_0x3fb291){if(_0x3fb291){return _0x3fb291[_0x1725('0xe5')](_0x1cf9be[_0x1725('0x48')][_0x1725('0x6f')])[_0x1725('0x23')](function(){if(_['isArray'](_0x1cf9be['query']['ids'])){for(var _0x56cb40=0x0;_0x56cb40<_0x1cf9be['query']['ids'][_0x1725('0x5a')];_0x56cb40+=0x1){socket['emit'](_0x1725('0xe6'),{'UserId':Number(_0x1cf9be[_0x1725('0x48')][_0x1725('0x6f')][_0x56cb40]),'SmsAccountId':Number(_0x1cf9be[_0x1725('0x65')]['id'])});}}else{socket[_0x1725('0xe3')](_0x1725('0xe6'),{'UserId':Number(_0x1cf9be[_0x1725('0x48')]['ids']),'SmsAccountId':Number(_0x1cf9be[_0x1725('0x65')]['id'])});}});}})[_0x1725('0x23')](respondWithStatusCode(_0x3aec84,null))[_0x1725('0x2e')](handleError(_0x3aec84,null));};exports['getAgents']=function(_0x2c245e,_0x2a81dc,_0xf02759){var _0x467a81={};var _0x739a5c={};var _0x35699b;var _0x10efa8;return db[_0x1725('0x43')][_0x1725('0x6b')]({'where':{'id':_0x2c245e[_0x1725('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a81dc,null))[_0x1725('0x23')](function(_0xf6eb7d){if(_0xf6eb7d){_0x35699b=_0xf6eb7d;_0x739a5c[_0x1725('0x46')]=_['keys'](db[_0x1725('0xe7')][_0x1725('0x59')]);_0x739a5c['query']=_[_0x1725('0x49')](_0x2c245e[_0x1725('0x48')]);_0x739a5c[_0x1725('0x4a')]=_[_0x1725('0x4b')](_0x739a5c[_0x1725('0x46')],_0x739a5c[_0x1725('0x48')]);_0x467a81[_0x1725('0x4c')]=_[_0x1725('0x4b')](_0x739a5c[_0x1725('0x46')],qs[_0x1725('0x4d')](_0x2c245e['query'][_0x1725('0x4d')]));_0x467a81[_0x1725('0x4c')]=_0x467a81[_0x1725('0x4c')][_0x1725('0x5a')]?_0x467a81[_0x1725('0x4c')]:_0x739a5c['model'];_0x467a81[_0x1725('0x6c')]=qs[_0x1725('0x50')](_0x2c245e[_0x1725('0x48')]['sort']);_0x467a81[_0x1725('0x51')]=qs[_0x1725('0x4a')](_['pick'](_0x2c245e[_0x1725('0x48')],_0x739a5c[_0x1725('0x4a')]));if(_0x2c245e[_0x1725('0x48')][_0x1725('0x53')]){_0x467a81[_0x1725('0x51')]=_['merge'](_0x467a81[_0x1725('0x51')],{'$or':_[_0x1725('0x47')](_0x467a81['attributes'],function(_0x3c59a3){var _0x291b3e={};_0x291b3e[_0x3c59a3]={'$like':'%'+_0x2c245e[_0x1725('0x48')]['filter']+'%'};return _0x291b3e;})});}_0x467a81=_[_0x1725('0x54')]({},_0x467a81,_0x2c245e[_0x1725('0x56')]);return _0x35699b['getAgents'](_0x467a81);}})['then'](function(_0x4202af){if(_0x4202af){_0x10efa8=_0x4202af[_0x1725('0x5a')];if(!_0x2c245e[_0x1725('0x48')][_0x1725('0x4e')]('nolimit')){_0x467a81['limit']=qs[_0x1725('0x33')](_0x2c245e[_0x1725('0x48')]['limit']);_0x467a81[_0x1725('0x36')]=qs['offset'](_0x2c245e[_0x1725('0x48')]['offset']);}return _0x35699b['getAgents'](_0x467a81);}})[_0x1725('0x23')](function(_0xf10720){if(_0xf10720){return _0xf10720?{'count':_0x10efa8,'rows':_0xf10720}:null;}})[_0x1725('0x23')](respondWithResult(_0x2a81dc,null))[_0x1725('0x2e')](handleError(_0x2a81dc,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fdc9923..4fabf48 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 _0x045b=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x26a792,_0x94d0f){var _0x4471b6=function(_0xfadd8d){while(--_0xfadd8d){_0x26a792['push'](_0x26a792['shift']());}};_0x4471b6(++_0x94d0f);}(_0x045b,0x17e));var _0xb045=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x045b[_0x43e4b3];return _0x10c655;};'use strict';var EventEmitter=require(_0xb045('0x0'));var SmsAccount=require(_0xb045('0x1'))['db'][_0xb045('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb045('0x3')](0x0);var events={'afterCreate':_0xb045('0x4'),'afterUpdate':_0xb045('0x5'),'afterDestroy':_0xb045('0x6')};function emitEvent(_0x43cf33){return function(_0x160de6,_0x1403a6,_0x206579){SmsAccountEvents[_0xb045('0x7')](_0x43cf33+':'+_0x160de6['id'],_0x160de6);SmsAccountEvents[_0xb045('0x7')](_0x43cf33,_0x160de6);_0x206579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xb045('0x8')](e,emitEvent(event));}}module[_0xb045('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xb055=['hook','exports','events','SmsAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x172b82,_0x34b72e){var _0x14f297=function(_0x567194){while(--_0x567194){_0x172b82['push'](_0x172b82['shift']());}};_0x14f297(++_0x34b72e);}(_0xb055,0x13a));var _0x5b05=function(_0x451d03,_0x7b3706){_0x451d03=_0x451d03-0x0;var _0x48c53e=_0xb055[_0x451d03];return _0x48c53e;};'use strict';var EventEmitter=require(_0x5b05('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x5b05('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5b05('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b05('0x3'),'afterDestroy':'remove'};function emitEvent(_0xad8d6e){return function(_0x3fd2a6,_0x434688,_0x44146a){SmsAccountEvents[_0x5b05('0x4')](_0xad8d6e+':'+_0x3fd2a6['id'],_0x3fd2a6);SmsAccountEvents[_0x5b05('0x4')](_0xad8d6e,_0x3fd2a6);_0x44146a(null);};}for(var e in events){if(events[_0x5b05('0x5')](e)){var event=events[e];SmsAccount[_0x5b05('0x6')](e,emitEvent(event));}}module[_0x5b05('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1606f5b..a2a33c2 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 _0x8a6b=['rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x230d1c,_0x3a56df){var _0x2128e3=function(_0x1a8f86){while(--_0x1a8f86){_0x230d1c['push'](_0x230d1c['shift']());}};_0x2128e3(++_0x3a56df);}(_0x8a6b,0x180));var _0xb8a6=function(_0x3bc029,_0x50dddd){_0x3bc029=_0x3bc029-0x0;var _0x59e3fd=_0x8a6b[_0x3bc029];return _0x59e3fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8a6('0x0'))(_0xb8a6('0x1'));var moment=require(_0xb8a6('0x2'));var BPromise=require(_0xb8a6('0x3'));var rp=require(_0xb8a6('0x4'));var fs=require('fs');var path=require(_0xb8a6('0x5'));var rimraf=require(_0xb8a6('0x6'));var config=require(_0xb8a6('0x7'));var attributes=require(_0xb8a6('0x8'));module[_0xb8a6('0x9')]=function(_0x6e4cda,_0x5abdd5){return _0x6e4cda[_0xb8a6('0xa')](_0xb8a6('0xb'),attributes,{'tableName':_0xb8a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a3e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount','util','../../config/logger'];(function(_0x56d5d9,_0x4a24f7){var _0x13e1a4=function(_0x2faa23){while(--_0x2faa23){_0x56d5d9['push'](_0x56d5d9['shift']());}};_0x13e1a4(++_0x4a24f7);}(_0x6a3e,0x1ea));var _0xe6a3=function(_0x40f959,_0x440044){_0x40f959=_0x40f959-0x0;var _0x1b7228=_0x6a3e[_0x40f959];return _0x1b7228;};'use strict';var _=require('lodash');var util=require(_0xe6a3('0x0'));var logger=require(_0xe6a3('0x1'))(_0xe6a3('0x2'));var moment=require(_0xe6a3('0x3'));var BPromise=require(_0xe6a3('0x4'));var rp=require(_0xe6a3('0x5'));var fs=require('fs');var path=require(_0xe6a3('0x6'));var rimraf=require(_0xe6a3('0x7'));var config=require(_0xe6a3('0x8'));var attributes=require('./smsAccount.attributes');module[_0xe6a3('0x9')]=function(_0x4104a9,_0x42f8cc){return _0x4104a9[_0xe6a3('0xa')](_0xe6a3('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 64deeb7..a25c18b 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 _0x5961=['include','map','ShowSmsAccount','debug','lodash','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsAccount','find','options','where','attributes','model'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x5961,0x64));var _0x1596=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x5961[_0x4d79bc];return _0x4b4760;};'use strict';var _=require(_0x1596('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1596('0x1'));var rs=require(_0x1596('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1596('0x3'))('rpc');var config=require(_0x1596('0x4'));var jayson=require(_0x1596('0x5'));var client=jayson['client'][_0x1596('0x6')]({'port':0x232a});config[_0x1596('0x7')]=_[_0x1596('0x8')](config['redis'],{'host':_0x1596('0x9'),'port':0x18eb});var socket=require(_0x1596('0xa'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x1596('0xb')](socket);function respondWithRpcPromise(_0x98edd9,_0x511916,_0x5d5e32){return new BPromise(function(_0x22e159,_0x50ee9b){return client[_0x1596('0xc')](_0x98edd9,_0x5d5e32)[_0x1596('0xd')](function(_0x581671){logger[_0x1596('0xe')](_0x1596('0xf'),_0x511916,_0x1596('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x511916,'request\x20sent',JSON[_0x1596('0x11')](_0x581671));if(_0x581671['error']){if(_0x581671[_0x1596('0x12')]['code']===0x1f4){logger['error'](_0x1596('0xf'),_0x511916,_0x581671[_0x1596('0x12')][_0x1596('0x13')]);return _0x50ee9b(_0x581671[_0x1596('0x12')][_0x1596('0x13')]);}logger[_0x1596('0x12')](_0x1596('0xf'),_0x511916,_0x581671['error'][_0x1596('0x13')]);return _0x22e159(_0x581671[_0x1596('0x12')][_0x1596('0x13')]);}else{logger['info'](_0x1596('0xf'),_0x511916,_0x1596('0x10'));_0x22e159(_0x581671[_0x1596('0x14')][_0x1596('0x13')]);}})[_0x1596('0x15')](function(_0x2e4072){logger[_0x1596('0x12')](_0x1596('0xf'),_0x511916,_0x2e4072);_0x50ee9b(_0x2e4072);});});}exports['ShowSmsAccount']=function(_0x499092){var _0x3e4c02=this;return new Promise(function(_0x3593c6,_0x550dac){return db[_0x1596('0x16')][_0x1596('0x17')]({'raw':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')][_0x1596('0x19')]||null:null,'attributes':_0x499092[_0x1596('0x18')]?_0x499092[_0x1596('0x18')][_0x1596('0x1a')]||null:null,'include':_0x499092[_0x1596('0x18')]?_0x499092['options']['include']?_['map'](_0x499092[_0x1596('0x18')]['include'],function(_0x2fbb56){return{'model':db[_0x2fbb56[_0x1596('0x1b')]],'as':_0x2fbb56['as'],'attributes':_0x2fbb56[_0x1596('0x1a')],'include':_0x2fbb56[_0x1596('0x1c')]?_[_0x1596('0x1d')](_0x2fbb56['include'],function(_0x3d57c3){return{'model':db[_0x3d57c3[_0x1596('0x1b')]],'as':_0x3d57c3['as'],'attributes':_0x3d57c3[_0x1596('0x1a')],'include':_0x3d57c3[_0x1596('0x1c')]?_[_0x1596('0x1d')](_0x3d57c3['include'],function(_0x986910){return{'model':db[_0x986910[_0x1596('0x1b')]],'as':_0x986910['as'],'attributes':_0x986910['attributes']};}):[]};}):[]};}):[]:[]})[_0x1596('0xd')](function(_0x2e0449){logger['info'](_0x1596('0x1e'),_0x499092);logger[_0x1596('0x1f')](_0x1596('0x1e'),_0x499092,JSON['stringify'](_0x2e0449));_0x3593c6(_0x2e0449);})[_0x1596('0x15')](function(_0x13d69f){logger[_0x1596('0x12')](_0x1596('0x1e'),_0x13d69f[_0x1596('0x13')],_0x499092);_0x550dac(_0x3e4c02[_0x1596('0x12')](0x1f4,_0x13d69f['message']));});});}; \ No newline at end of file +var _0x573a=['redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x73d4f,_0x48c5d8){var _0x4313cb=function(_0x324380){while(--_0x324380){_0x73d4f['push'](_0x73d4f['shift']());}};_0x4313cb(++_0x48c5d8);}(_0x573a,0x91));var _0xa573=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x573a[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require(_0xa573('0x0'));var util=require(_0xa573('0x1'));var moment=require(_0xa573('0x2'));var BPromise=require(_0xa573('0x3'));var rs=require(_0xa573('0x4'));var fs=require('fs');var Redis=require(_0xa573('0x5'));var db=require(_0xa573('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa573('0x7'));var config=require('../../config/environment');var jayson=require(_0xa573('0x8'));var client=jayson[_0xa573('0x9')][_0xa573('0xa')]({'port':0x232a});config[_0xa573('0xb')]=_[_0xa573('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa573('0xd'))(new Redis(config[_0xa573('0xb')]));require(_0xa573('0xe'))[_0xa573('0xf')](socket);function respondWithRpcPromise(_0x1ce1a6,_0x55db8d,_0x4533a1){return new BPromise(function(_0x4b95b4,_0x2067d4){return client[_0xa573('0x10')](_0x1ce1a6,_0x4533a1)[_0xa573('0x11')](function(_0x4ec97c){logger[_0xa573('0x12')]('SmsAccount,\x20%s,\x20%s',_0x55db8d,_0xa573('0x13'));logger[_0xa573('0x14')](_0xa573('0x15'),_0x55db8d,'request\x20sent',JSON['stringify'](_0x4ec97c));if(_0x4ec97c[_0xa573('0x16')]){if(_0x4ec97c['error'][_0xa573('0x17')]===0x1f4){logger[_0xa573('0x16')]('SmsAccount,\x20%s,\x20%s',_0x55db8d,_0x4ec97c[_0xa573('0x16')][_0xa573('0x18')]);return _0x2067d4(_0x4ec97c[_0xa573('0x16')]['message']);}logger[_0xa573('0x16')](_0xa573('0x19'),_0x55db8d,_0x4ec97c['error'][_0xa573('0x18')]);return _0x4b95b4(_0x4ec97c[_0xa573('0x16')][_0xa573('0x18')]);}else{logger[_0xa573('0x12')](_0xa573('0x19'),_0x55db8d,_0xa573('0x13'));_0x4b95b4(_0x4ec97c[_0xa573('0x1a')][_0xa573('0x18')]);}})[_0xa573('0x1b')](function(_0x142a48){logger[_0xa573('0x16')](_0xa573('0x19'),_0x55db8d,_0x142a48);_0x2067d4(_0x142a48);});});}exports[_0xa573('0x1c')]=function(_0x9a8cc8){var _0x28a4c1=this;return new Promise(function(_0x378480,_0x1b9821){return db[_0xa573('0x1d')][_0xa573('0x1e')]({'raw':_0x9a8cc8[_0xa573('0x1f')]?_0x9a8cc8[_0xa573('0x1f')][_0xa573('0x20')]===undefined?!![]:![]:!![],'where':_0x9a8cc8[_0xa573('0x1f')]?_0x9a8cc8[_0xa573('0x1f')][_0xa573('0x21')]||null:null,'attributes':_0x9a8cc8['options']?_0x9a8cc8[_0xa573('0x1f')][_0xa573('0x22')]||null:null,'include':_0x9a8cc8[_0xa573('0x1f')]?_0x9a8cc8[_0xa573('0x1f')]['include']?_[_0xa573('0x23')](_0x9a8cc8[_0xa573('0x1f')][_0xa573('0x24')],function(_0x4479ac){return{'model':db[_0x4479ac[_0xa573('0x25')]],'as':_0x4479ac['as'],'attributes':_0x4479ac['attributes'],'include':_0x4479ac[_0xa573('0x24')]?_[_0xa573('0x23')](_0x4479ac[_0xa573('0x24')],function(_0x141471){return{'model':db[_0x141471[_0xa573('0x25')]],'as':_0x141471['as'],'attributes':_0x141471[_0xa573('0x22')],'include':_0x141471[_0xa573('0x24')]?_[_0xa573('0x23')](_0x141471[_0xa573('0x24')],function(_0x12b879){return{'model':db[_0x12b879[_0xa573('0x25')]],'as':_0x12b879['as'],'attributes':_0x12b879[_0xa573('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa573('0x11')](function(_0x2e0152){logger['info'](_0xa573('0x1c'),_0x9a8cc8);logger[_0xa573('0x14')](_0xa573('0x1c'),_0x9a8cc8,JSON[_0xa573('0x26')](_0x2e0152));_0x378480(_0x2e0152);})[_0xa573('0x1b')](function(_0x2bc770){logger[_0xa573('0x16')](_0xa573('0x1c'),_0x2bc770[_0xa573('0x18')],_0x9a8cc8);_0x1b9821(_0x28a4c1[_0xa573('0x16')](0x1f4,_0x2bc770[_0xa573('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fa492b3..668fbfe 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 65ef040..83655fc 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1683db,_0x8d3cb9){var _0x46f5f1=function(_0x1f59b8){while(--_0x1f59b8){_0x1683db['push'](_0x1683db['shift']());}};_0x46f5f1(++_0x8d3cb9);}(_0xedd9,0xfc));var _0x9edd=function(_0x5426af,_0x50755c){_0x5426af=_0x5426af-0x0;var _0x290f15=_0xedd9[_0x5426af];return _0x290f15;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +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(_0x22d52a,_0x26391f){var _0x2cf0e6=function(_0x2a7fdb){while(--_0x2a7fdb){_0x22d52a['push'](_0x22d52a['shift']());}};_0x2cf0e6(++_0x26391f);}(_0x008c,0x188));var _0xc008=function(_0x11babf,_0x2a02bb){_0x11babf=_0x11babf-0x0;var _0x3bcc27=_0x008c[_0x11babf];return _0x3bcc27;};'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 caf2d22..e3ce58a 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 _0x2b86=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5508db,_0x22ecbe){var _0x54ce94=function(_0x389047){while(--_0x389047){_0x5508db['push'](_0x5508db['shift']());}};_0x54ce94(++_0x22ecbe);}(_0x2b86,0x9c));var _0x62b8=function(_0x4a355b,_0x7ec0a5){_0x4a355b=_0x4a355b-0x0;var _0xd6c766=_0x2b86[_0x4a355b];return _0xd6c766;};'use strict';var Sequelize=require(_0x62b8('0x0'));module[_0x62b8('0x1')]={'priority':{'type':Sequelize[_0x62b8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x62b8('0x3')],'allowNull':![],'defaultValue':_0x62b8('0x4')},'appdata':{'type':Sequelize[_0x62b8('0x5')]()},'description':{'type':Sequelize[_0x62b8('0x3')]},'interval':{'type':Sequelize[_0x62b8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb6a4=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb6a4,0x11f));var _0x4b6a=function(_0x489a28,_0x50f7eb){_0x489a28=_0x489a28-0x0;var _0x2f826a=_0xb6a4[_0x489a28];return _0x2f826a;};'use strict';var Sequelize=require(_0x4b6a('0x0'));module[_0x4b6a('0x1')]={'priority':{'type':Sequelize[_0x4b6a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4b6a('0x3')],'allowNull':![],'defaultValue':_0x4b6a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4b6a('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1c2ae52..f0088e0 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 _0x8f32=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body'];(function(_0x234ef0,_0x54e309){var _0x35c801=function(_0x359e68){while(--_0x359e68){_0x234ef0['push'](_0x234ef0['shift']());}};_0x35c801(++_0x54e309);}(_0x8f32,0x16e));var _0x28f3=function(_0x21f0aa,_0x11401c){_0x21f0aa=_0x21f0aa-0x0;var _0x74a510=_0x8f32[_0x21f0aa];return _0x74a510;};'use strict';var emlformat=require(_0x28f3('0x0'));var rimraf=require(_0x28f3('0x1'));var zipdir=require(_0x28f3('0x2'));var jsonpatch=require(_0x28f3('0x3'));var rp=require(_0x28f3('0x4'));var moment=require(_0x28f3('0x5'));var BPromise=require(_0x28f3('0x6'));var Mustache=require(_0x28f3('0x7'));var util=require(_0x28f3('0x8'));var path=require(_0x28f3('0x9'));var sox=require(_0x28f3('0xa'));var csv=require(_0x28f3('0xb'));var ejs=require(_0x28f3('0xc'));var fs=require('fs');var fs_extra=require(_0x28f3('0xd'));var _=require('lodash');var squel=require(_0x28f3('0xe'));var crypto=require(_0x28f3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x28f3('0x10'));var toCsv=require(_0x28f3('0xb'));var querystring=require('querystring');var Papa=require(_0x28f3('0x11'));var Redis=require('ioredis');var authService=require(_0x28f3('0x12'));var qs=require(_0x28f3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28f3('0x14'));var logger=require(_0x28f3('0x15'))(_0x28f3('0x16'));var utils=require('../../config/utils');var config=require(_0x28f3('0x17'));var licenseUtil=require(_0x28f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca929,_0x528505){_0x528505=_0x528505||0xcc;return function(_0x5c75e5){if(_0x5c75e5){return _0x2ca929[_0x28f3('0x19')](_0x528505);}return _0x2ca929[_0x28f3('0x1a')](_0x528505)['end']();};}function respondWithResult(_0x149b2f,_0x502c27){_0x502c27=_0x502c27||0xc8;return function(_0xc02ae3){if(_0xc02ae3){return _0x149b2f[_0x28f3('0x1a')](_0x502c27)[_0x28f3('0x1b')](_0xc02ae3);}};}function respondWithFilteredResult(_0xc4c1e3,_0x1aaf51){return function(_0x3c58e4){if(_0x3c58e4){var _0x46ce97=typeof _0x1aaf51['offset']==='undefined'&&typeof _0x1aaf51['limit']===_0x28f3('0x1c');var _0x5d93d3=_0x3c58e4[_0x28f3('0x1d')];var _0x53f6a9=_0x46ce97?0x0:_0x1aaf51[_0x28f3('0x1e')];var _0x1eb5ab=_0x46ce97?_0x3c58e4[_0x28f3('0x1d')]:_0x1aaf51[_0x28f3('0x1e')]+_0x1aaf51[_0x28f3('0x1f')];var _0x11d586;if(_0x1eb5ab>=_0x5d93d3){_0x1eb5ab=_0x5d93d3;_0x11d586=0xc8;}else{_0x11d586=0xce;}_0xc4c1e3[_0x28f3('0x1a')](_0x11d586);return _0xc4c1e3['set'](_0x28f3('0x20'),_0x53f6a9+'-'+_0x1eb5ab+'/'+_0x5d93d3)[_0x28f3('0x1b')](_0x3c58e4);}return null;};}function patchUpdates(_0x5eb867){return function(_0x3a25b6){try{jsonpatch[_0x28f3('0x21')](_0x3a25b6,_0x5eb867,!![]);}catch(_0x2413a5){return BPromise[_0x28f3('0x22')](_0x2413a5);}return _0x3a25b6[_0x28f3('0x23')]();};}function saveUpdates(_0x47c1f2,_0x27c19b){return function(_0x54baaa){if(_0x54baaa){return _0x54baaa['update'](_0x47c1f2)[_0x28f3('0x24')](function(_0x2bde0a){return _0x2bde0a;});}return null;};}function removeEntity(_0x37f70e,_0x5556bd){return function(_0x2eb931){if(_0x2eb931){return _0x2eb931[_0x28f3('0x25')]()['then'](function(){_0x37f70e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13783e,_0x14d79a){return function(_0x4a38bd){if(!_0x4a38bd){_0x13783e[_0x28f3('0x19')](0x194);}return _0x4a38bd;};}function handleError(_0x488978,_0x46af27){_0x46af27=_0x46af27||0x1f4;return function(_0x2eeea0){logger[_0x28f3('0x26')](_0x2eeea0[_0x28f3('0x27')]);if(_0x2eeea0[_0x28f3('0x28')]){delete _0x2eeea0['name'];}_0x488978['status'](_0x46af27)['send'](_0x2eeea0);};}exports['index']=function(_0x329db1,_0x9265e1){var _0x6c3b50={},_0x66a391={},_0x14cd9e={'count':0x0,'rows':[]};var _0x35c1b6=_[_0x28f3('0x29')](db[_0x28f3('0x2a')][_0x28f3('0x2b')],function(_0x213877){return{'name':_0x213877[_0x28f3('0x2c')],'type':_0x213877[_0x28f3('0x2d')]['key']};});_0x66a391['model']=_['map'](_0x35c1b6,'name');_0x66a391[_0x28f3('0x2e')]=_['keys'](_0x329db1[_0x28f3('0x2e')]);_0x66a391[_0x28f3('0x2f')]=_['intersection'](_0x66a391[_0x28f3('0x30')],_0x66a391['query']);_0x6c3b50[_0x28f3('0x31')]=_[_0x28f3('0x32')](_0x66a391[_0x28f3('0x30')],qs[_0x28f3('0x33')](_0x329db1[_0x28f3('0x2e')]['fields']));_0x6c3b50[_0x28f3('0x31')]=_0x6c3b50[_0x28f3('0x31')][_0x28f3('0x34')]?_0x6c3b50['attributes']:_0x66a391[_0x28f3('0x30')];if(!_0x329db1[_0x28f3('0x2e')][_0x28f3('0x35')]('nolimit')){_0x6c3b50[_0x28f3('0x1f')]=qs[_0x28f3('0x1f')](_0x329db1[_0x28f3('0x2e')][_0x28f3('0x1f')]);_0x6c3b50[_0x28f3('0x1e')]=qs[_0x28f3('0x1e')](_0x329db1[_0x28f3('0x2e')][_0x28f3('0x1e')]);}_0x6c3b50[_0x28f3('0x36')]=qs[_0x28f3('0x37')](_0x329db1[_0x28f3('0x2e')]['sort']);_0x6c3b50[_0x28f3('0x38')]=qs[_0x28f3('0x2f')](_[_0x28f3('0x39')](_0x329db1[_0x28f3('0x2e')],_0x66a391[_0x28f3('0x2f')]),_0x35c1b6);if(_0x329db1[_0x28f3('0x2e')][_0x28f3('0x3a')]){_0x6c3b50[_0x28f3('0x38')]=_[_0x28f3('0x3b')](_0x6c3b50[_0x28f3('0x38')],{'$or':_[_0x28f3('0x29')](_0x35c1b6,function(_0x16931e){if(_0x16931e[_0x28f3('0x2d')]!==_0x28f3('0x3c')){var _0x437017={};_0x437017[_0x16931e[_0x28f3('0x28')]]={'$like':'%'+_0x329db1[_0x28f3('0x2e')]['filter']+'%'};return _0x437017;}})});}_0x6c3b50=_[_0x28f3('0x3b')]({},_0x6c3b50,_0x329db1[_0x28f3('0x3d')]);var _0x519396={'where':_0x6c3b50[_0x28f3('0x38')]};return db[_0x28f3('0x2a')][_0x28f3('0x1d')](_0x519396)[_0x28f3('0x24')](function(_0x47b677){_0x14cd9e[_0x28f3('0x1d')]=_0x47b677;if(_0x329db1['query'][_0x28f3('0x3e')]){_0x6c3b50[_0x28f3('0x3f')]=[{'all':!![]}];}return db[_0x28f3('0x2a')][_0x28f3('0x40')](_0x6c3b50);})[_0x28f3('0x24')](function(_0x4d690c){_0x14cd9e['rows']=_0x4d690c;return _0x14cd9e;})[_0x28f3('0x24')](respondWithFilteredResult(_0x9265e1,_0x6c3b50))[_0x28f3('0x41')](handleError(_0x9265e1,null));};exports[_0x28f3('0x42')]=function(_0x422e8f,_0x344c43){var _0x3f2a8a={'raw':!![],'where':{'id':_0x422e8f[_0x28f3('0x43')]['id']}},_0x114afc={};_0x114afc[_0x28f3('0x30')]=_['keys'](db['SmsApplication'][_0x28f3('0x2b')]);_0x114afc[_0x28f3('0x2e')]=_[_0x28f3('0x44')](_0x422e8f[_0x28f3('0x2e')]);_0x114afc['filters']=_[_0x28f3('0x32')](_0x114afc[_0x28f3('0x30')],_0x114afc['query']);_0x3f2a8a[_0x28f3('0x31')]=_[_0x28f3('0x32')](_0x114afc[_0x28f3('0x30')],qs[_0x28f3('0x33')](_0x422e8f[_0x28f3('0x2e')]['fields']));_0x3f2a8a[_0x28f3('0x31')]=_0x3f2a8a['attributes'][_0x28f3('0x34')]?_0x3f2a8a[_0x28f3('0x31')]:_0x114afc[_0x28f3('0x30')];if(_0x422e8f[_0x28f3('0x2e')][_0x28f3('0x3e')]){_0x3f2a8a[_0x28f3('0x3f')]=[{'all':!![]}];}_0x3f2a8a=_['merge']({},_0x3f2a8a,_0x422e8f[_0x28f3('0x3d')]);return db['SmsApplication'][_0x28f3('0x45')](_0x3f2a8a)[_0x28f3('0x24')](handleEntityNotFound(_0x344c43,null))[_0x28f3('0x24')](respondWithResult(_0x344c43,null))[_0x28f3('0x41')](handleError(_0x344c43,null));};exports[_0x28f3('0x46')]=function(_0x75532b,_0x370170){return db[_0x28f3('0x2a')][_0x28f3('0x46')](_0x75532b[_0x28f3('0x47')],{})[_0x28f3('0x24')](respondWithResult(_0x370170,0xc9))[_0x28f3('0x41')](handleError(_0x370170,null));};exports[_0x28f3('0x48')]=function(_0x54494e,_0x2e72e4){if(_0x54494e[_0x28f3('0x47')]['id']){delete _0x54494e[_0x28f3('0x47')]['id'];}return db[_0x28f3('0x2a')]['find']({'where':{'id':_0x54494e[_0x28f3('0x43')]['id']}})[_0x28f3('0x24')](handleEntityNotFound(_0x2e72e4,null))[_0x28f3('0x24')](saveUpdates(_0x54494e[_0x28f3('0x47')],null))[_0x28f3('0x24')](respondWithResult(_0x2e72e4,null))[_0x28f3('0x41')](handleError(_0x2e72e4,null));};exports[_0x28f3('0x25')]=function(_0x1bf8cc,_0x1a986b){return db[_0x28f3('0x2a')]['find']({'where':{'id':_0x1bf8cc[_0x28f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a986b,null))[_0x28f3('0x24')](removeEntity(_0x1a986b,null))[_0x28f3('0x41')](handleError(_0x1a986b,null));}; \ No newline at end of file +var _0xbb0e=['length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','apply','save','update','then','status','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes'];(function(_0x10424d,_0x137621){var _0x47b5a8=function(_0x482837){while(--_0x482837){_0x10424d['push'](_0x10424d['shift']());}};_0x47b5a8(++_0x137621);}(_0xbb0e,0x195));var _0xebb0=function(_0x294d75,_0x23f342){_0x294d75=_0x294d75-0x0;var _0x16c2c6=_0xbb0e[_0x294d75];return _0x16c2c6;};'use strict';var emlformat=require(_0xebb0('0x0'));var rimraf=require(_0xebb0('0x1'));var zipdir=require(_0xebb0('0x2'));var jsonpatch=require(_0xebb0('0x3'));var rp=require(_0xebb0('0x4'));var moment=require(_0xebb0('0x5'));var BPromise=require(_0xebb0('0x6'));var Mustache=require(_0xebb0('0x7'));var util=require(_0xebb0('0x8'));var path=require(_0xebb0('0x9'));var sox=require(_0xebb0('0xa'));var csv=require(_0xebb0('0xb'));var ejs=require(_0xebb0('0xc'));var fs=require('fs');var fs_extra=require(_0xebb0('0xd'));var _=require(_0xebb0('0xe'));var squel=require(_0xebb0('0xf'));var crypto=require(_0xebb0('0x10'));var jsforce=require(_0xebb0('0x11'));var deskjs=require(_0xebb0('0x12'));var toCsv=require(_0xebb0('0xb'));var querystring=require(_0xebb0('0x13'));var Papa=require(_0xebb0('0x14'));var Redis=require(_0xebb0('0x15'));var authService=require(_0xebb0('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xebb0('0x17'));var hardwareService=require(_0xebb0('0x18'));var logger=require(_0xebb0('0x19'))(_0xebb0('0x1a'));var utils=require('../../config/utils');var config=require(_0xebb0('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xebb0('0x1c'))['db'];function respondWithStatusCode(_0x42ee31,_0x5deeeb){_0x5deeeb=_0x5deeeb||0xcc;return function(_0x17461e){if(_0x17461e){return _0x42ee31['sendStatus'](_0x5deeeb);}return _0x42ee31['status'](_0x5deeeb)[_0xebb0('0x1d')]();};}function respondWithResult(_0x5c556a,_0x5cf139){_0x5cf139=_0x5cf139||0xc8;return function(_0x2c27de){if(_0x2c27de){return _0x5c556a['status'](_0x5cf139)[_0xebb0('0x1e')](_0x2c27de);}};}function respondWithFilteredResult(_0x111db2,_0x2d9407){return function(_0x12ce24){if(_0x12ce24){var _0x1d14a9=typeof _0x2d9407['offset']===_0xebb0('0x1f')&&typeof _0x2d9407[_0xebb0('0x20')]===_0xebb0('0x1f');var _0x269449=_0x12ce24[_0xebb0('0x21')];var _0x221386=_0x1d14a9?0x0:_0x2d9407[_0xebb0('0x22')];var _0x26ee69=_0x1d14a9?_0x12ce24[_0xebb0('0x21')]:_0x2d9407[_0xebb0('0x22')]+_0x2d9407[_0xebb0('0x20')];var _0x34ace1;if(_0x26ee69>=_0x269449){_0x26ee69=_0x269449;_0x34ace1=0xc8;}else{_0x34ace1=0xce;}_0x111db2['status'](_0x34ace1);return _0x111db2['set']('Content-Range',_0x221386+'-'+_0x26ee69+'/'+_0x269449)['json'](_0x12ce24);}return null;};}function patchUpdates(_0x51425c){return function(_0x59d472){try{jsonpatch[_0xebb0('0x23')](_0x59d472,_0x51425c,!![]);}catch(_0x2dcbf0){return BPromise['reject'](_0x2dcbf0);}return _0x59d472[_0xebb0('0x24')]();};}function saveUpdates(_0x465cc,_0x1dce5b){return function(_0x2bd50f){if(_0x2bd50f){return _0x2bd50f[_0xebb0('0x25')](_0x465cc)[_0xebb0('0x26')](function(_0x24867a){return _0x24867a;});}return null;};}function removeEntity(_0x3c874a,_0x4ad11b){return function(_0x30c5ac){if(_0x30c5ac){return _0x30c5ac['destroy']()[_0xebb0('0x26')](function(){_0x3c874a[_0xebb0('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370eee,_0x132a96){return function(_0x3cf3ad){if(!_0x3cf3ad){_0x370eee['sendStatus'](0x194);}return _0x3cf3ad;};}function handleError(_0x6859b1,_0x326068){_0x326068=_0x326068||0x1f4;return function(_0x51182d){logger['error'](_0x51182d[_0xebb0('0x28')]);if(_0x51182d[_0xebb0('0x29')]){delete _0x51182d['name'];}_0x6859b1['status'](_0x326068)[_0xebb0('0x2a')](_0x51182d);};}exports[_0xebb0('0x2b')]=function(_0x1b1bf5,_0xd7ec89){var _0x348b3f={},_0x5228da={},_0x1b7893={'count':0x0,'rows':[]};var _0x13eede=_[_0xebb0('0x2c')](db[_0xebb0('0x2d')][_0xebb0('0x2e')],function(_0x2654ac){return{'name':_0x2654ac[_0xebb0('0x2f')],'type':_0x2654ac[_0xebb0('0x30')][_0xebb0('0x31')]};});_0x5228da['model']=_['map'](_0x13eede,'name');_0x5228da['query']=_[_0xebb0('0x32')](_0x1b1bf5[_0xebb0('0x33')]);_0x5228da[_0xebb0('0x34')]=_[_0xebb0('0x35')](_0x5228da['model'],_0x5228da[_0xebb0('0x33')]);_0x348b3f['attributes']=_[_0xebb0('0x35')](_0x5228da[_0xebb0('0x36')],qs[_0xebb0('0x37')](_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x37')]));_0x348b3f[_0xebb0('0x38')]=_0x348b3f[_0xebb0('0x38')][_0xebb0('0x39')]?_0x348b3f[_0xebb0('0x38')]:_0x5228da['model'];if(!_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x3a')]('nolimit')){_0x348b3f[_0xebb0('0x20')]=qs[_0xebb0('0x20')](_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x20')]);_0x348b3f['offset']=qs[_0xebb0('0x22')](_0x1b1bf5[_0xebb0('0x33')]['offset']);}_0x348b3f[_0xebb0('0x3b')]=qs['sort'](_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x3c')]);_0x348b3f['where']=qs['filters'](_[_0xebb0('0x3d')](_0x1b1bf5[_0xebb0('0x33')],_0x5228da[_0xebb0('0x34')]),_0x13eede);if(_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x3e')]){_0x348b3f['where']=_[_0xebb0('0x3f')](_0x348b3f['where'],{'$or':_[_0xebb0('0x2c')](_0x13eede,function(_0x22eb47){if(_0x22eb47[_0xebb0('0x30')]!==_0xebb0('0x40')){var _0x182ca3={};_0x182ca3[_0x22eb47[_0xebb0('0x29')]]={'$like':'%'+_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x3e')]+'%'};return _0x182ca3;}})});}_0x348b3f=_[_0xebb0('0x3f')]({},_0x348b3f,_0x1b1bf5[_0xebb0('0x41')]);var _0x5b8ba5={'where':_0x348b3f[_0xebb0('0x42')]};return db['SmsApplication'][_0xebb0('0x21')](_0x5b8ba5)[_0xebb0('0x26')](function(_0x39b83c){_0x1b7893['count']=_0x39b83c;if(_0x1b1bf5[_0xebb0('0x33')][_0xebb0('0x43')]){_0x348b3f[_0xebb0('0x44')]=[{'all':!![]}];}return db['SmsApplication'][_0xebb0('0x45')](_0x348b3f);})['then'](function(_0x4eef31){_0x1b7893[_0xebb0('0x46')]=_0x4eef31;return _0x1b7893;})['then'](respondWithFilteredResult(_0xd7ec89,_0x348b3f))[_0xebb0('0x47')](handleError(_0xd7ec89,null));};exports[_0xebb0('0x48')]=function(_0x52c656,_0x2c31cd){var _0x1142bb={'raw':!![],'where':{'id':_0x52c656[_0xebb0('0x49')]['id']}},_0x46da28={};_0x46da28[_0xebb0('0x36')]=_[_0xebb0('0x32')](db[_0xebb0('0x2d')][_0xebb0('0x2e')]);_0x46da28[_0xebb0('0x33')]=_[_0xebb0('0x32')](_0x52c656[_0xebb0('0x33')]);_0x46da28[_0xebb0('0x34')]=_[_0xebb0('0x35')](_0x46da28[_0xebb0('0x36')],_0x46da28[_0xebb0('0x33')]);_0x1142bb[_0xebb0('0x38')]=_['intersection'](_0x46da28[_0xebb0('0x36')],qs['fields'](_0x52c656['query'][_0xebb0('0x37')]));_0x1142bb[_0xebb0('0x38')]=_0x1142bb[_0xebb0('0x38')][_0xebb0('0x39')]?_0x1142bb[_0xebb0('0x38')]:_0x46da28[_0xebb0('0x36')];if(_0x52c656[_0xebb0('0x33')][_0xebb0('0x43')]){_0x1142bb[_0xebb0('0x44')]=[{'all':!![]}];}_0x1142bb=_[_0xebb0('0x3f')]({},_0x1142bb,_0x52c656[_0xebb0('0x41')]);return db[_0xebb0('0x2d')][_0xebb0('0x4a')](_0x1142bb)[_0xebb0('0x26')](handleEntityNotFound(_0x2c31cd,null))[_0xebb0('0x26')](respondWithResult(_0x2c31cd,null))[_0xebb0('0x47')](handleError(_0x2c31cd,null));};exports[_0xebb0('0x4b')]=function(_0xe89768,_0xe7509f){return db['SmsApplication']['create'](_0xe89768[_0xebb0('0x4c')],{})[_0xebb0('0x26')](respondWithResult(_0xe7509f,0xc9))['catch'](handleError(_0xe7509f,null));};exports['update']=function(_0x1c78d8,_0x58644c){if(_0x1c78d8[_0xebb0('0x4c')]['id']){delete _0x1c78d8[_0xebb0('0x4c')]['id'];}return db[_0xebb0('0x2d')]['find']({'where':{'id':_0x1c78d8[_0xebb0('0x49')]['id']}})['then'](handleEntityNotFound(_0x58644c,null))['then'](saveUpdates(_0x1c78d8[_0xebb0('0x4c')],null))[_0xebb0('0x26')](respondWithResult(_0x58644c,null))[_0xebb0('0x47')](handleError(_0x58644c,null));};exports['destroy']=function(_0x132e0a,_0x4ee363){return db[_0xebb0('0x2d')]['find']({'where':{'id':_0x132e0a[_0xebb0('0x49')]['id']}})[_0xebb0('0x26')](handleEntityNotFound(_0x4ee363,null))[_0xebb0('0x26')](removeEntity(_0x4ee363,null))['catch'](handleError(_0x4ee363,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d0dbed4..e0901d9 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 _0x0c96=['../../config/logger','api','moment','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x864207,_0x3439ef){var _0x7542cb=function(_0x53b7e5){while(--_0x53b7e5){_0x864207['push'](_0x864207['shift']());}};_0x7542cb(++_0x3439ef);}(_0x0c96,0x177));var _0x60c9=function(_0x19eeb5,_0x5c2a2c){_0x19eeb5=_0x19eeb5-0x0;var _0x5bc38d=_0x0c96[_0x19eeb5];return _0x5bc38d;};'use strict';var _=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var logger=require(_0x60c9('0x2'))(_0x60c9('0x3'));var moment=require(_0x60c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c9('0x5'));var fs=require('fs');var path=require(_0x60c9('0x6'));var rimraf=require(_0x60c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x60c9('0x8'));module['exports']=function(_0x3c6667,_0x14d56e){return _0x3c6667[_0x60c9('0x9')](_0x60c9('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x60c9('0xb'),'collate':_0x60c9('0xc')});}; \ No newline at end of file +var _0x6d04=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6d04,0x11f));var _0x46d0=function(_0x1c98e2,_0x59f74c){_0x1c98e2=_0x1c98e2-0x0;var _0x1f045b=_0x6d04[_0x1c98e2];return _0x1f045b;};'use strict';var _=require('lodash');var util=require(_0x46d0('0x0'));var logger=require(_0x46d0('0x1'))(_0x46d0('0x2'));var moment=require(_0x46d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x46d0('0x4'));var fs=require('fs');var path=require(_0x46d0('0x5'));var rimraf=require(_0x46d0('0x6'));var config=require(_0x46d0('0x7'));var attributes=require(_0x46d0('0x8'));module[_0x46d0('0x9')]=function(_0x5e91fa,_0x1586cd){return _0x5e91fa[_0x46d0('0xa')](_0x46d0('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46d0('0xc'),'collate':_0x46d0('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e64a955..1a1c19e 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 _0x4f08=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x3a22e7,_0x2b4396){var _0x3e90f9=function(_0x3af31c){while(--_0x3af31c){_0x3a22e7['push'](_0x3a22e7['shift']());}};_0x3e90f9(++_0x2b4396);}(_0x4f08,0x194));var _0x84f0=function(_0xa8baab,_0xe87974){_0xa8baab=_0xa8baab-0x0;var _0x37bee8=_0x4f08[_0xa8baab];return _0x37bee8;};'use strict';var _=require(_0x84f0('0x0'));var util=require(_0x84f0('0x1'));var moment=require('moment');var BPromise=require(_0x84f0('0x2'));var rs=require(_0x84f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84f0('0x4'))['db'];var utils=require(_0x84f0('0x5'));var logger=require(_0x84f0('0x6'))('rpc');var config=require(_0x84f0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x84f0('0x8')][_0x84f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4548f3,_0x5a877f,_0x430993){return new BPromise(function(_0x42f42e,_0x15b01d){return client[_0x84f0('0xa')](_0x4548f3,_0x430993)[_0x84f0('0xb')](function(_0x1b256f){logger['info']('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x84f0('0xc'));logger[_0x84f0('0xd')](_0x84f0('0xe'),_0x5a877f,_0x84f0('0xc'),JSON[_0x84f0('0xf')](_0x1b256f));if(_0x1b256f[_0x84f0('0x10')]){if(_0x1b256f[_0x84f0('0x10')][_0x84f0('0x11')]===0x1f4){logger[_0x84f0('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x1b256f[_0x84f0('0x10')]['message']);return _0x15b01d(_0x1b256f[_0x84f0('0x10')]['message']);}logger[_0x84f0('0x10')](_0x84f0('0x12'),_0x5a877f,_0x1b256f[_0x84f0('0x10')][_0x84f0('0x13')]);return _0x42f42e(_0x1b256f[_0x84f0('0x10')][_0x84f0('0x13')]);}else{logger[_0x84f0('0x14')](_0x84f0('0x12'),_0x5a877f,_0x84f0('0xc'));_0x42f42e(_0x1b256f['result'][_0x84f0('0x13')]);}})[_0x84f0('0x15')](function(_0x9e40a8){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5a877f,_0x9e40a8);_0x15b01d(_0x9e40a8);});});} \ No newline at end of file +var _0xc7da=['request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7da,0xf2));var _0xac7d=function(_0x299fe0,_0x109329){_0x299fe0=_0x299fe0-0x0;var _0x38ead0=_0xc7da[_0x299fe0];return _0x38ead0;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('SmsApplication,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('SmsApplication,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('SmsApplication,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1668db7..2727941 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 _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2f421,_0x5144c4){var _0x27b4af=function(_0x119470){while(--_0x119470){_0x2f421['push'](_0x2f421['shift']());}};_0x27b4af(++_0x5144c4);}(_0x2032,0xd9));var _0x2203=function(_0x4c0952,_0x138fc3){_0x4c0952=_0x4c0952-0x0;var _0x17edf7=_0x2032[_0x4c0952];return _0x17edf7;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file +var _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x2e0975,_0x55d850){var _0x55af89=function(_0x12cc4c){while(--_0x12cc4c){_0x2e0975['push'](_0x2e0975['shift']());}};_0x55af89(++_0x55d850);}(_0xac4a,0x13f));var _0xaac4=function(_0x1a0cfe,_0x300d70){_0x1a0cfe=_0x1a0cfe-0x0;var _0x35fdfd=_0xac4a[_0x1a0cfe];return _0x35fdfd;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 22ceda5..a209079 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 _0x9305=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x4933c7,_0x5ed34){var _0x399728=function(_0x2af139){while(--_0x2af139){_0x4933c7['push'](_0x4933c7['shift']());}};_0x399728(++_0x5ed34);}(_0x9305,0x1e2));var _0x5930=function(_0x49236c,_0x1aa642){_0x49236c=_0x49236c-0x0;var _0x52442=_0x9305[_0x49236c];return _0x52442;};'use strict';var Sequelize=require(_0x5930('0x0'));var moment=require(_0x5930('0x1'));module[_0x5930('0x2')]={'closed':{'type':Sequelize[_0x5930('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5930('0x4')]},'secondDisposition':{'type':Sequelize[_0x5930('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5930('0x4')]},'note':{'type':Sequelize[_0x5930('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5930('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x5930('0x6')]('in',_0x5930('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5930('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5930('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf006=['ENUM','out','exports','BOOLEAN','STRING','DATE'];(function(_0x5942b2,_0x16dfa0){var _0x55b623=function(_0x2fefc8){while(--_0x2fefc8){_0x5942b2['push'](_0x5942b2['shift']());}};_0x55b623(++_0x16dfa0);}(_0xf006,0x146));var _0x6f00=function(_0x4432eb,_0x5c9aee){_0x4432eb=_0x4432eb-0x0;var _0x617774=_0xf006[_0x4432eb];return _0x617774;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6f00('0x0')]={'closed':{'type':Sequelize[_0x6f00('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6f00('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6f00('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6f00('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6f00('0x4')]('in',_0x6f00('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6f00('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6f00('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c050405..ac6ace5 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 _0x3645=['rawAttributes','fieldName','type','key','findAll','sms','query','user','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','params','describe','addMessage','SmsMessage','omit','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','color','emit','removeTags','download','toString','join','server','files','tmp','User','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','SmsAccount','push','Owner','get','Sms','Account','N.A.','closed','out','System','firstName','value','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','index','map','SmsInteraction'];(function(_0xd15610,_0x57b20f){var _0x136a18=function(_0x57a51f){while(--_0x57a51f){_0xd15610['push'](_0xd15610['shift']());}};_0x136a18(++_0x57b20f);}(_0x3645,0xc8));var _0x5364=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x3645[_0x502953];return _0x2fa32d;};'use strict';var rimraf=require(_0x5364('0x0'));var zipdir=require(_0x5364('0x1'));var moment=require(_0x5364('0x2'));var BPromise=require(_0x5364('0x3'));var util=require(_0x5364('0x4'));var path=require('path');var ejs=require(_0x5364('0x5'));var fs=require('fs');var _=require(_0x5364('0x6'));var Redis=require(_0x5364('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x5364('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x5364('0x9'))(_0x5364('0xa'));var config=require(_0x5364('0xb'));var db=require('../../mysqldb')['db'];config[_0x5364('0xc')]=_[_0x5364('0xd')](config[_0x5364('0xc')],{'host':_0x5364('0xe'),'port':0x18eb});var socket=require(_0x5364('0xf'))(new Redis(config[_0x5364('0xc')]));require(_0x5364('0x10'))[_0x5364('0x11')](socket);function respondWithStatusCode(_0x4ea69c,_0x497cc6){_0x497cc6=_0x497cc6||0xcc;return function(_0x20b105){if(_0x20b105){return _0x4ea69c[_0x5364('0x12')](_0x497cc6);}return _0x4ea69c[_0x5364('0x13')](_0x497cc6)[_0x5364('0x14')]();};}function respondWithResult(_0x5249da,_0x3e2bce){_0x3e2bce=_0x3e2bce||0xc8;return function(_0x27f6bb){if(_0x27f6bb){return _0x5249da[_0x5364('0x13')](_0x3e2bce)[_0x5364('0x15')](_0x27f6bb);}};}function respondWithFilteredResult(_0x159e0f,_0x25bd2d){return function(_0x14a95e){if(_0x14a95e){var _0x3cff5d=typeof _0x25bd2d[_0x5364('0x16')]===_0x5364('0x17')&&typeof _0x25bd2d[_0x5364('0x18')]===_0x5364('0x17');var _0x246c2e=_0x14a95e[_0x5364('0x19')];var _0x5773b7=_0x3cff5d?0x0:_0x25bd2d['offset'];var _0x4006f2=_0x3cff5d?_0x14a95e['count']:_0x25bd2d[_0x5364('0x16')]+_0x25bd2d[_0x5364('0x18')];var _0x418cbf;if(_0x4006f2>=_0x246c2e){_0x4006f2=_0x246c2e;_0x418cbf=0xc8;}else{_0x418cbf=0xce;}_0x159e0f[_0x5364('0x13')](_0x418cbf);return _0x159e0f[_0x5364('0x1a')](_0x5364('0x1b'),_0x5773b7+'-'+_0x4006f2+'/'+_0x246c2e)[_0x5364('0x15')](_0x14a95e);}return null;};}function saveUpdates(_0x628cd1){return function(_0x155b78){if(_0x155b78){return _0x155b78['update'](_0x628cd1)[_0x5364('0x1c')](function(_0x2f2e72){return _0x2f2e72;});}return null;};}function removeEntity(_0x312c0c){return function(_0x34e092){if(_0x34e092){return _0x34e092[_0x5364('0x1d')]()[_0x5364('0x1c')](function(){_0x312c0c[_0x5364('0x13')](0xcc)[_0x5364('0x14')]();});}};}function handleEntityNotFound(_0x517a62){return function(_0x43b574){if(!_0x43b574){_0x517a62[_0x5364('0x12')](0x194);}return _0x43b574;};}function handleError(_0x28b7b1,_0x58eb09){_0x58eb09=_0x58eb09||0x1f4;return function(_0x18763d){logger[_0x5364('0x1e')](_0x18763d['stack']);if(_0x18763d[_0x5364('0x1f')]){delete _0x18763d[_0x5364('0x1f')];}_0x28b7b1['status'](_0x58eb09)[_0x5364('0x20')](_0x18763d);};}exports[_0x5364('0x21')]=function(_0x1dac7d,_0x233b1d){var _0x41ab64={};var _0x358f5b=_[_0x5364('0x22')](db[_0x5364('0x23')][_0x5364('0x24')],function(_0x2660b6){return{'name':_0x2660b6[_0x5364('0x25')],'type':_0x2660b6[_0x5364('0x26')][_0x5364('0x27')]};});_0x41ab64=qs['getOptions'](_0x358f5b,_0x1dac7d);return interaction[_0x5364('0x28')](_0x5364('0x29'),_0x1dac7d[_0x5364('0x2a')],_0x1dac7d[_0x5364('0x2b')],_0x41ab64,_0x358f5b)[_0x5364('0x1c')](respondWithFilteredResult(_0x233b1d,_0x41ab64))['catch'](handleError(_0x233b1d,null));};exports[_0x5364('0x2c')]=function(_0x50b083,_0x157581){var _0x31e21a={'raw':![],'where':{'id':_0x50b083['params']['id']}},_0x51fafb={};_0x51fafb[_0x5364('0x2d')]=_[_0x5364('0x2e')](db[_0x5364('0x23')][_0x5364('0x24')]);_0x51fafb[_0x5364('0x2a')]=_[_0x5364('0x2e')](_0x50b083['query']);_0x51fafb[_0x5364('0x2f')]=_[_0x5364('0x30')](_0x51fafb[_0x5364('0x2d')],_0x51fafb[_0x5364('0x2a')]);_0x31e21a[_0x5364('0x31')]=_['intersection'](_0x51fafb['model'],qs['fields'](_0x50b083[_0x5364('0x2a')][_0x5364('0x32')]));_0x31e21a['attributes']=_0x31e21a[_0x5364('0x31')][_0x5364('0x33')]?_0x31e21a['attributes']:_0x51fafb[_0x5364('0x2d')];if(_0x50b083[_0x5364('0x2a')][_0x5364('0x34')]){_0x31e21a[_0x5364('0x35')]=[{'all':!![]}];}_0x31e21a=_[_0x5364('0x36')]({},_0x31e21a,_0x50b083[_0x5364('0x37')]);return db[_0x5364('0x23')][_0x5364('0x38')](_0x31e21a)[_0x5364('0x1c')](handleEntityNotFound(_0x157581,null))[_0x5364('0x1c')](respondWithResult(_0x157581,null))[_0x5364('0x39')](handleError(_0x157581,null));};exports[_0x5364('0x3a')]=function(_0x5c71fb,_0x2f1f01){return db[_0x5364('0x23')][_0x5364('0x3a')](_0x5c71fb[_0x5364('0x3b')],{})['then'](respondWithResult(_0x2f1f01,0xc9))[_0x5364('0x39')](handleError(_0x2f1f01,null));};exports[_0x5364('0x3c')]=function(_0x1205e2,_0x4aae5a){if(_0x1205e2[_0x5364('0x3b')]['id']){delete _0x1205e2[_0x5364('0x3b')]['id'];}return db[_0x5364('0x23')][_0x5364('0x38')]({'where':{'id':_0x1205e2[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4aae5a,null))[_0x5364('0x1c')](saveUpdates(_0x1205e2[_0x5364('0x3b')],null))[_0x5364('0x1c')](respondWithResult(_0x4aae5a,null))[_0x5364('0x39')](handleError(_0x4aae5a,null));};exports[_0x5364('0x1d')]=function(_0x2bc915,_0x4c07e2){return db['SmsInteraction'][_0x5364('0x38')]({'where':{'id':_0x2bc915['params']['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4c07e2,null))[_0x5364('0x1c')](removeEntity(_0x4c07e2,null))[_0x5364('0x39')](handleError(_0x4c07e2,null));};exports[_0x5364('0x3e')]=function(_0x3be4ef,_0x35d428){return db[_0x5364('0x23')][_0x5364('0x3e')]()['then'](respondWithResult(_0x35d428,null))['catch'](handleError(_0x35d428,null));};exports[_0x5364('0x3f')]=function(_0x52e8d3,_0x23df12){return db[_0x5364('0x40')][_0x5364('0x38')]({'where':{'id':_0x52e8d3['params']['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x23df12,null))[_0x5364('0x1c')](function(_0x22ed76){if(_0x22ed76){return _0x22ed76[_0x5364('0x3f')](_0x52e8d3[_0x5364('0x3b')]['ids'],_[_0x5364('0x41')](_0x52e8d3['body'],[_0x5364('0x42'),'id'])||{});}})[_0x5364('0x1c')](respondWithResult(_0x23df12,null))[_0x5364('0x39')](handleError(_0x23df12,null));};exports[_0x5364('0x43')]=function(_0x36c931,_0x4997b2){var _0x48b558={'raw':![],'where':{}};var _0x2278ad={};var _0x2491f7={'count':0x0,'rows':[]};return db[_0x5364('0x23')]['findOne']({'where':{'id':_0x36c931[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x4997b2,null))[_0x5364('0x1c')](function(_0x3d99e1){if(_0x3d99e1){_0x2278ad[_0x5364('0x2d')]=_[_0x5364('0x2e')](db[_0x5364('0x40')]['rawAttributes']);_0x2278ad[_0x5364('0x2a')]=_[_0x5364('0x2e')](_0x36c931[_0x5364('0x2a')]);_0x2278ad[_0x5364('0x2f')]=_[_0x5364('0x30')](_0x2278ad[_0x5364('0x2d')],_0x2278ad[_0x5364('0x2a')]);_0x48b558[_0x5364('0x31')]=_['intersection'](_0x2278ad[_0x5364('0x2d')],qs['fields'](_0x36c931['query'][_0x5364('0x32')]));_0x48b558[_0x5364('0x31')]=_0x48b558[_0x5364('0x31')][_0x5364('0x33')]?_0x48b558[_0x5364('0x31')]:_0x2278ad['model'];if(!_0x36c931[_0x5364('0x2a')][_0x5364('0x44')](_0x5364('0x45'))){_0x48b558[_0x5364('0x18')]=qs[_0x5364('0x18')](_0x36c931[_0x5364('0x2a')]['limit']);_0x48b558['offset']=qs[_0x5364('0x16')](_0x36c931[_0x5364('0x2a')][_0x5364('0x16')]);}_0x48b558[_0x5364('0x46')]=qs[_0x5364('0x47')](_0x36c931[_0x5364('0x2a')][_0x5364('0x47')]);_0x48b558[_0x5364('0x48')]=qs[_0x5364('0x2f')](_['pick'](_0x36c931[_0x5364('0x2a')],_0x2278ad['filters']));_0x48b558[_0x5364('0x48')]['SmsInteractionId']=_0x3d99e1['id'];if(_0x36c931[_0x5364('0x2a')][_0x5364('0x49')]){_0x48b558[_0x5364('0x48')]=_[_0x5364('0x36')](_0x48b558[_0x5364('0x48')],{'$or':_[_0x5364('0x22')](_0x48b558[_0x5364('0x31')],function(_0x3db5ec){var _0x3b006f={};_0x3b006f[_0x3db5ec]={'$like':'%'+_0x36c931[_0x5364('0x2a')]['filter']+'%'};return _0x3b006f;})});}if(_0x36c931[_0x5364('0x2a')][_0x5364('0x4a')]){var _0x11d6ac=_0x36c931[_0x5364('0x2a')][_0x5364('0x4a')]['split'](',');var _0x307a9b={};_0x307a9b[_0x11d6ac[0x0]]={'$gte':moment(_0x11d6ac[0x1])[_0x5364('0x4b')](_0x5364('0x4c'))};_0x48b558[_0x5364('0x48')]=_['merge'](_0x48b558[_0x5364('0x48')],_0x307a9b);}_0x48b558=_['merge']({},_0x48b558,_0x36c931[_0x5364('0x37')]);return db['SmsMessage']['count']({'where':_0x48b558[_0x5364('0x48')]})[_0x5364('0x1c')](function(_0x4a44f4){_0x2491f7[_0x5364('0x19')]=_0x4a44f4;if(_0x36c931[_0x5364('0x2a')][_0x5364('0x34')]){_0x48b558[_0x5364('0x35')]=[{'all':!![]}];}return db[_0x5364('0x40')][_0x5364('0x28')](_0x48b558);})['then'](function(_0x347e85){_0x2491f7[_0x5364('0x4d')]=_0x347e85;return _0x2491f7;});}})[_0x5364('0x1c')](respondWithFilteredResult(_0x4997b2,_0x48b558))[_0x5364('0x39')](handleError(_0x4997b2,null));};exports[_0x5364('0x4e')]=function(_0x2035d9,_0x18e364){return db[_0x5364('0x23')]['find']({'where':{'id':_0x2035d9[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x18e364,null))['then'](function(_0x17d642){if(_0x17d642){return _0x17d642['setTags'](_0x2035d9['body'][_0x5364('0x42')],_[_0x5364('0x41')](_0x2035d9['body'],[_0x5364('0x42'),'id'])||{})[_0x5364('0x4f')](function(){return db['Tag'][_0x5364('0x28')]({'attributes':['id',_0x5364('0x1f'),_0x5364('0x50')],'where':{'id':_0x2035d9['body'][_0x5364('0x42')]}});})[_0x5364('0x1c')](function(_0x182d6c){socket[_0x5364('0x51')]('smsInteractionTags:save',{'id':Number(_0x2035d9['params']['id']),'tags':_0x182d6c||[]});return{'id':Number(_0x2035d9[_0x5364('0x3d')]['id']),'tags':_0x182d6c||[]};});}})[_0x5364('0x1c')](respondWithResult(_0x18e364,null))[_0x5364('0x39')](handleError(_0x18e364,null));};exports[_0x5364('0x52')]=function(_0x4cd452,_0x3fab54){return db[_0x5364('0x23')][_0x5364('0x38')]({'where':{'id':_0x4cd452[_0x5364('0x3d')]['id']}})[_0x5364('0x1c')](handleEntityNotFound(_0x3fab54,null))[_0x5364('0x1c')](function(_0xd0030b){if(_0xd0030b){return _0xd0030b[_0x5364('0x52')](_0x4cd452[_0x5364('0x2a')][_0x5364('0x42')]);}})[_0x5364('0x1c')](respondWithStatusCode(_0x3fab54,null))[_0x5364('0x39')](handleError(_0x3fab54,null));};exports[_0x5364('0x53')]=function(_0x413e6,_0x5f50e9){var _0x30b0b6=moment()['unix']()[_0x5364('0x54')]();var _0x1da171=path[_0x5364('0x55')](config['root'],_0x5364('0x56'),_0x5364('0x57'),_0x5364('0x58'));var _0x594f14=path['join'](_0x1da171,_0x30b0b6);var _0x4dc17b=util['format']('transcript-%d-%s.zip',_0x413e6[_0x5364('0x3d')]['id'],_0x30b0b6);var _0x5a9d69=path[_0x5364('0x55')](_0x1da171,_0x4dc17b);var _0x2da983=[];_0x2da983['push']({'model':db[_0x5364('0x59')],'as':_0x5364('0x59'),'attributes':['id',_0x5364('0x5a')],'raw':!![]});_0x2da983['push']({'model':db[_0x5364('0x5b')],'as':_0x5364('0x5c'),'attributes':['id','firstName',_0x5364('0x5d')],'raw':!![]});var _0xf48de7=[{'model':db[_0x5364('0x40')],'as':_0x5364('0x5e'),'attributes':['id',_0x5364('0x3b'),_0x5364('0x5f'),_0x5364('0x60'),_0x5364('0x61'),'read'],'include':_0x2da983}];_0xf48de7['push']({'model':db[_0x5364('0x62')],'as':'Account','attributes':['id',_0x5364('0x1f')]});_0xf48de7[_0x5364('0x63')]({'model':db[_0x5364('0x59')],'as':_0x5364('0x64'),'attributes':['id',_0x5364('0x5a')]});return db['SmsInteraction'][_0x5364('0x38')]({'where':{'id':_0x413e6[_0x5364('0x3d')]['id']},'include':_0xf48de7})[_0x5364('0x1c')](handleEntityNotFound(_0x5f50e9,null))[_0x5364('0x1c')](function(_0x5485ec){if(_0x5485ec){var _0x5775b3=_0x5485ec[_0x5364('0x65')]({'plain':!![]});fs['mkdirSync'](_0x594f14);var _0x105bca={'channel':_0x5364('0x66'),'account':_0x5775b3[_0x5364('0x67')][_0x5364('0x1f')],'agent':_0x5775b3[_0x5364('0x64')]?_0x5775b3[_0x5364('0x64')][_0x5364('0x5a')]:_0x5364('0x68'),'createdAt':moment(_0x5775b3[_0x5364('0x5f')])[_0x5364('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5775b3[_0x5364('0x69')]?moment(_0x5775b3['closedAt'])[_0x5364('0x4b')](_0x5364('0x4c'))['toString']():'','disposition':_0x5775b3['disposition'],'messages':_(_0x5775b3['Messages'])[_0x5364('0x49')]({'secret':![]})[_0x5364('0x22')](function(_0x1ec379){return{'date':moment(_0x1ec379['createdAt'])['format'](_0x5364('0x4c'))[_0x5364('0x54')](),'sender':_0x1ec379[_0x5364('0x60')]===_0x5364('0x6a')?_0x1ec379['User']?_0x1ec379[_0x5364('0x59')][_0x5364('0x5a')]:_0x5364('0x6b'):_0x1ec379['Contact'][_0x5364('0x6c')]+(_0x1ec379['Contact'][_0x5364('0x5d')]?'\x20'+_0x1ec379['Contact'][_0x5364('0x5d')]:''),'body':_0x1ec379['body'],'direction':_0x1ec379[_0x5364('0x60')]===_0x5364('0x6a')?'A':'C','secret':_0x1ec379[_0x5364('0x61')],'read':_0x1ec379['read']};})[_0x5364('0x6d')]()};return ejs[_0x5364('0x6e')](path[_0x5364('0x55')](config[_0x5364('0x6f')],_0x5364('0x56'),_0x5364('0x70'),_0x5364('0x71')),{'interaction':_0x105bca})[_0x5364('0x1c')](function(_0x1ec8be){var _0x28719a=path[_0x5364('0x55')](_0x594f14,'transcript-'+_0x5775b3['id']+'-'+_0x30b0b6+_0x5364('0x72'));var _0xb09259={'path':_0x28719a,'channel':_0x5364('0x66'),'interactionId':_0x5775b3['id']};return pdf[_0x5364('0x73')](_0x1ec8be,_0xb09259);})[_0x5364('0x1c')](function(){return new BPromise(function(_0x22467c,_0x217aac){zipdir(_0x594f14,{'saveTo':_0x5a9d69},function(_0x5776f6,_0x10d1a7){if(_0x5776f6)return _0x217aac(_0x5776f6);return _0x22467c(_0x10d1a7);});})[_0x5364('0x1c')](function(){return new BPromise(function(_0x17c20b,_0x5ef43d){rimraf(_0x594f14,function(_0x48dfd8){if(_0x48dfd8)_0x5ef43d(_0x48dfd8);return _0x17c20b();});});})[_0x5364('0x1c')](function(){return _0x5f50e9[_0x5364('0x53')](_0x5a9d69,_0x4dc17b,function(_0x2773b5){if(_0x2773b5){console['log'](_0x5364('0x74'),_0x2773b5);}else{fs[_0x5364('0x75')](_0x5a9d69);}});});});}else{return _0x5f50e9[_0x5364('0x12')](0xc8);}})['catch'](handleError(_0x5f50e9,null));}; \ No newline at end of file +var _0xc6e7=['show','keys','filters','intersection','model','attributes','fields','length','include','merge','options','create','body','find','params','describe','SmsMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','removeTags','download','unix','toString','join','root','server','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','Sms','N.A.','format','closed','closedAt','User','System','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch'];(function(_0x439d77,_0x33d268){var _0x8858eb=function(_0x40711d){while(--_0x40711d){_0x439d77['push'](_0x439d77['shift']());}};_0x8858eb(++_0x33d268);}(_0xc6e7,0x1a4));var _0x7c6e=function(_0x2e42ea,_0x3859ec){_0x2e42ea=_0x2e42ea-0x0;var _0x3d8d2d=_0xc6e7[_0x2e42ea];return _0x3d8d2d;};'use strict';var rimraf=require(_0x7c6e('0x0'));var zipdir=require(_0x7c6e('0x1'));var moment=require('moment');var BPromise=require(_0x7c6e('0x2'));var util=require(_0x7c6e('0x3'));var path=require(_0x7c6e('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c6e('0x5'));var Redis=require(_0x7c6e('0x6'));var interaction=require(_0x7c6e('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7c6e('0x8'));var logger=require(_0x7c6e('0x9'))(_0x7c6e('0xa'));var config=require(_0x7c6e('0xb'));var db=require('../../mysqldb')['db'];config[_0x7c6e('0xc')]=_[_0x7c6e('0xd')](config['redis'],{'host':_0x7c6e('0xe'),'port':0x18eb});var socket=require(_0x7c6e('0xf'))(new Redis(config['redis']));require(_0x7c6e('0x10'))[_0x7c6e('0x11')](socket);function respondWithStatusCode(_0x2727e8,_0x22a4ea){_0x22a4ea=_0x22a4ea||0xcc;return function(_0x225ee1){if(_0x225ee1){return _0x2727e8[_0x7c6e('0x12')](_0x22a4ea);}return _0x2727e8[_0x7c6e('0x13')](_0x22a4ea)['end']();};}function respondWithResult(_0x289eb6,_0x5e6c8b){_0x5e6c8b=_0x5e6c8b||0xc8;return function(_0x21ec9e){if(_0x21ec9e){return _0x289eb6[_0x7c6e('0x13')](_0x5e6c8b)['json'](_0x21ec9e);}};}function respondWithFilteredResult(_0x582e0e,_0x413d4d){return function(_0x2bcfe4){if(_0x2bcfe4){var _0x5b8732=typeof _0x413d4d[_0x7c6e('0x14')]===_0x7c6e('0x15')&&typeof _0x413d4d[_0x7c6e('0x16')]===_0x7c6e('0x15');var _0x2750af=_0x2bcfe4['count'];var _0x3e7b04=_0x5b8732?0x0:_0x413d4d[_0x7c6e('0x14')];var _0x2ef1bd=_0x5b8732?_0x2bcfe4[_0x7c6e('0x17')]:_0x413d4d[_0x7c6e('0x14')]+_0x413d4d[_0x7c6e('0x16')];var _0x326c6b;if(_0x2ef1bd>=_0x2750af){_0x2ef1bd=_0x2750af;_0x326c6b=0xc8;}else{_0x326c6b=0xce;}_0x582e0e[_0x7c6e('0x13')](_0x326c6b);return _0x582e0e[_0x7c6e('0x18')]('Content-Range',_0x3e7b04+'-'+_0x2ef1bd+'/'+_0x2750af)[_0x7c6e('0x19')](_0x2bcfe4);}return null;};}function saveUpdates(_0xf6462c){return function(_0x122a59){if(_0x122a59){return _0x122a59[_0x7c6e('0x1a')](_0xf6462c)[_0x7c6e('0x1b')](function(_0x333d9e){return _0x333d9e;});}return null;};}function removeEntity(_0x1420f3){return function(_0x520d87){if(_0x520d87){return _0x520d87[_0x7c6e('0x1c')]()[_0x7c6e('0x1b')](function(){_0x1420f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f0eec){return function(_0x28a48d){if(!_0x28a48d){_0x2f0eec[_0x7c6e('0x12')](0x194);}return _0x28a48d;};}function handleError(_0x1d3046,_0x18e21b){_0x18e21b=_0x18e21b||0x1f4;return function(_0x2d0bf6){logger['error'](_0x2d0bf6[_0x7c6e('0x1d')]);if(_0x2d0bf6[_0x7c6e('0x1e')]){delete _0x2d0bf6[_0x7c6e('0x1e')];}_0x1d3046[_0x7c6e('0x13')](_0x18e21b)[_0x7c6e('0x1f')](_0x2d0bf6);};}exports[_0x7c6e('0x20')]=function(_0x2e67fc,_0x5f6b1f){var _0x314f17={};var _0x6e594f=_[_0x7c6e('0x21')](db[_0x7c6e('0x22')][_0x7c6e('0x23')],function(_0x1f382c){return{'name':_0x1f382c[_0x7c6e('0x24')],'type':_0x1f382c[_0x7c6e('0x25')][_0x7c6e('0x26')]};});_0x314f17=qs[_0x7c6e('0x27')](_0x6e594f,_0x2e67fc);return interaction[_0x7c6e('0x28')](_0x7c6e('0x29'),_0x2e67fc[_0x7c6e('0x2a')],_0x2e67fc['user'],_0x314f17,_0x6e594f)[_0x7c6e('0x1b')](respondWithFilteredResult(_0x5f6b1f,_0x314f17))[_0x7c6e('0x2b')](handleError(_0x5f6b1f,null));};exports[_0x7c6e('0x2c')]=function(_0x5b420f,_0x9df049){var _0x3351c9={'raw':![],'where':{'id':_0x5b420f['params']['id']}},_0x3ac7f0={};_0x3ac7f0['model']=_[_0x7c6e('0x2d')](db[_0x7c6e('0x22')]['rawAttributes']);_0x3ac7f0[_0x7c6e('0x2a')]=_['keys'](_0x5b420f[_0x7c6e('0x2a')]);_0x3ac7f0[_0x7c6e('0x2e')]=_[_0x7c6e('0x2f')](_0x3ac7f0[_0x7c6e('0x30')],_0x3ac7f0['query']);_0x3351c9[_0x7c6e('0x31')]=_[_0x7c6e('0x2f')](_0x3ac7f0[_0x7c6e('0x30')],qs[_0x7c6e('0x32')](_0x5b420f['query'][_0x7c6e('0x32')]));_0x3351c9[_0x7c6e('0x31')]=_0x3351c9['attributes'][_0x7c6e('0x33')]?_0x3351c9[_0x7c6e('0x31')]:_0x3ac7f0[_0x7c6e('0x30')];if(_0x5b420f[_0x7c6e('0x2a')]['includeAll']){_0x3351c9[_0x7c6e('0x34')]=[{'all':!![]}];}_0x3351c9=_[_0x7c6e('0x35')]({},_0x3351c9,_0x5b420f[_0x7c6e('0x36')]);return db['SmsInteraction']['find'](_0x3351c9)[_0x7c6e('0x1b')](handleEntityNotFound(_0x9df049,null))[_0x7c6e('0x1b')](respondWithResult(_0x9df049,null))[_0x7c6e('0x2b')](handleError(_0x9df049,null));};exports[_0x7c6e('0x37')]=function(_0x40a066,_0x27bb14){return db[_0x7c6e('0x22')][_0x7c6e('0x37')](_0x40a066['body'],{})[_0x7c6e('0x1b')](respondWithResult(_0x27bb14,0xc9))[_0x7c6e('0x2b')](handleError(_0x27bb14,null));};exports['update']=function(_0x24dbb9,_0x250518){if(_0x24dbb9[_0x7c6e('0x38')]['id']){delete _0x24dbb9[_0x7c6e('0x38')]['id'];}return db['SmsInteraction'][_0x7c6e('0x39')]({'where':{'id':_0x24dbb9['params']['id']}})[_0x7c6e('0x1b')](handleEntityNotFound(_0x250518,null))[_0x7c6e('0x1b')](saveUpdates(_0x24dbb9[_0x7c6e('0x38')],null))[_0x7c6e('0x1b')](respondWithResult(_0x250518,null))[_0x7c6e('0x2b')](handleError(_0x250518,null));};exports[_0x7c6e('0x1c')]=function(_0x5533fa,_0x4bcc7a){return db['SmsInteraction']['find']({'where':{'id':_0x5533fa[_0x7c6e('0x3a')]['id']}})[_0x7c6e('0x1b')](handleEntityNotFound(_0x4bcc7a,null))[_0x7c6e('0x1b')](removeEntity(_0x4bcc7a,null))[_0x7c6e('0x2b')](handleError(_0x4bcc7a,null));};exports[_0x7c6e('0x3b')]=function(_0x2683da,_0x5f1451){return db[_0x7c6e('0x22')]['describe']()['then'](respondWithResult(_0x5f1451,null))[_0x7c6e('0x2b')](handleError(_0x5f1451,null));};exports['addMessage']=function(_0xebdf50,_0x15b038){return db[_0x7c6e('0x3c')][_0x7c6e('0x39')]({'where':{'id':_0xebdf50[_0x7c6e('0x3a')]['id']}})[_0x7c6e('0x1b')](handleEntityNotFound(_0x15b038,null))[_0x7c6e('0x1b')](function(_0x4b5d9d){if(_0x4b5d9d){return _0x4b5d9d['addMessage'](_0xebdf50[_0x7c6e('0x38')]['ids'],_['omit'](_0xebdf50['body'],[_0x7c6e('0x3d'),'id'])||{});}})[_0x7c6e('0x1b')](respondWithResult(_0x15b038,null))[_0x7c6e('0x2b')](handleError(_0x15b038,null));};exports[_0x7c6e('0x3e')]=function(_0x2e49e2,_0x14258b){var _0x3097ef={'raw':![],'where':{}};var _0x3c412c={};var _0x4bf338={'count':0x0,'rows':[]};return db[_0x7c6e('0x22')][_0x7c6e('0x3f')]({'where':{'id':_0x2e49e2[_0x7c6e('0x3a')]['id']}})[_0x7c6e('0x1b')](handleEntityNotFound(_0x14258b,null))['then'](function(_0x20934f){if(_0x20934f){_0x3c412c[_0x7c6e('0x30')]=_[_0x7c6e('0x2d')](db[_0x7c6e('0x3c')]['rawAttributes']);_0x3c412c[_0x7c6e('0x2a')]=_[_0x7c6e('0x2d')](_0x2e49e2['query']);_0x3c412c[_0x7c6e('0x2e')]=_[_0x7c6e('0x2f')](_0x3c412c[_0x7c6e('0x30')],_0x3c412c[_0x7c6e('0x2a')]);_0x3097ef['attributes']=_[_0x7c6e('0x2f')](_0x3c412c['model'],qs['fields'](_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x32')]));_0x3097ef['attributes']=_0x3097ef[_0x7c6e('0x31')][_0x7c6e('0x33')]?_0x3097ef['attributes']:_0x3c412c[_0x7c6e('0x30')];if(!_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x40')](_0x7c6e('0x41'))){_0x3097ef[_0x7c6e('0x16')]=qs[_0x7c6e('0x16')](_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x16')]);_0x3097ef[_0x7c6e('0x14')]=qs['offset'](_0x2e49e2['query']['offset']);}_0x3097ef[_0x7c6e('0x42')]=qs['sort'](_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x43')]);_0x3097ef['where']=qs[_0x7c6e('0x2e')](_[_0x7c6e('0x44')](_0x2e49e2[_0x7c6e('0x2a')],_0x3c412c[_0x7c6e('0x2e')]));_0x3097ef[_0x7c6e('0x45')][_0x7c6e('0x46')]=_0x20934f['id'];if(_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x47')]){_0x3097ef[_0x7c6e('0x45')]=_[_0x7c6e('0x35')](_0x3097ef[_0x7c6e('0x45')],{'$or':_['map'](_0x3097ef['attributes'],function(_0x8f5759){var _0x50407d={};_0x50407d[_0x8f5759]={'$like':'%'+_0x2e49e2[_0x7c6e('0x2a')][_0x7c6e('0x47')]+'%'};return _0x50407d;})});}if(_0x2e49e2['query'][_0x7c6e('0x48')]){var _0x11458e=_0x2e49e2[_0x7c6e('0x2a')]['$gte']['split'](',');var _0x588f6a={};_0x588f6a[_0x11458e[0x0]]={'$gte':moment(_0x11458e[0x1])['format'](_0x7c6e('0x49'))};_0x3097ef[_0x7c6e('0x45')]=_[_0x7c6e('0x35')](_0x3097ef[_0x7c6e('0x45')],_0x588f6a);}_0x3097ef=_[_0x7c6e('0x35')]({},_0x3097ef,_0x2e49e2['options']);return db[_0x7c6e('0x3c')][_0x7c6e('0x17')]({'where':_0x3097ef[_0x7c6e('0x45')]})[_0x7c6e('0x1b')](function(_0x21e18e){_0x4bf338[_0x7c6e('0x17')]=_0x21e18e;if(_0x2e49e2[_0x7c6e('0x2a')]['includeAll']){_0x3097ef[_0x7c6e('0x34')]=[{'all':!![]}];}return db['SmsMessage'][_0x7c6e('0x28')](_0x3097ef);})['then'](function(_0x43ed5a){_0x4bf338[_0x7c6e('0x4a')]=_0x43ed5a;return _0x4bf338;});}})[_0x7c6e('0x1b')](respondWithFilteredResult(_0x14258b,_0x3097ef))['catch'](handleError(_0x14258b,null));};exports[_0x7c6e('0x4b')]=function(_0xfaa45f,_0x4e259a){return db[_0x7c6e('0x22')][_0x7c6e('0x39')]({'where':{'id':_0xfaa45f[_0x7c6e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4e259a,null))['then'](function(_0x2ee9e6){if(_0x2ee9e6){return _0x2ee9e6[_0x7c6e('0x4c')](_0xfaa45f[_0x7c6e('0x38')][_0x7c6e('0x3d')],_[_0x7c6e('0x4d')](_0xfaa45f[_0x7c6e('0x38')],[_0x7c6e('0x3d'),'id'])||{})[_0x7c6e('0x4e')](function(){return db['Tag'][_0x7c6e('0x28')]({'attributes':['id','name',_0x7c6e('0x4f')],'where':{'id':_0xfaa45f[_0x7c6e('0x38')][_0x7c6e('0x3d')]}});})[_0x7c6e('0x1b')](function(_0x7ded42){socket['emit']('smsInteractionTags:save',{'id':Number(_0xfaa45f['params']['id']),'tags':_0x7ded42||[]});return{'id':Number(_0xfaa45f[_0x7c6e('0x3a')]['id']),'tags':_0x7ded42||[]};});}})[_0x7c6e('0x1b')](respondWithResult(_0x4e259a,null))[_0x7c6e('0x2b')](handleError(_0x4e259a,null));};exports['removeTags']=function(_0x47d10c,_0x42135b){return db['SmsInteraction'][_0x7c6e('0x39')]({'where':{'id':_0x47d10c[_0x7c6e('0x3a')]['id']}})[_0x7c6e('0x1b')](handleEntityNotFound(_0x42135b,null))[_0x7c6e('0x1b')](function(_0x1178ce){if(_0x1178ce){return _0x1178ce[_0x7c6e('0x50')](_0x47d10c[_0x7c6e('0x2a')][_0x7c6e('0x3d')]);}})['then'](respondWithStatusCode(_0x42135b,null))[_0x7c6e('0x2b')](handleError(_0x42135b,null));};exports[_0x7c6e('0x51')]=function(_0x1b1e68,_0x539e77){var _0x9ed487=moment()[_0x7c6e('0x52')]()[_0x7c6e('0x53')]();var _0x5960d4=path[_0x7c6e('0x54')](config[_0x7c6e('0x55')],_0x7c6e('0x56'),'files','tmp');var _0x4c6295=path[_0x7c6e('0x54')](_0x5960d4,_0x9ed487);var _0x3f63ce=util['format'](_0x7c6e('0x57'),_0x1b1e68[_0x7c6e('0x3a')]['id'],_0x9ed487);var _0x3caf55=path['join'](_0x5960d4,_0x3f63ce);var _0x571f91=[];_0x571f91[_0x7c6e('0x58')]({'model':db['User'],'as':'User','attributes':['id',_0x7c6e('0x59')],'raw':!![]});_0x571f91[_0x7c6e('0x58')]({'model':db[_0x7c6e('0x5a')],'as':_0x7c6e('0x5b'),'attributes':['id',_0x7c6e('0x5c'),_0x7c6e('0x5d')],'raw':!![]});var _0x4ae8f0=[{'model':db[_0x7c6e('0x3c')],'as':'Messages','attributes':['id',_0x7c6e('0x38'),_0x7c6e('0x5e'),_0x7c6e('0x5f'),_0x7c6e('0x60'),_0x7c6e('0x61')],'include':_0x571f91}];_0x4ae8f0['push']({'model':db[_0x7c6e('0x62')],'as':_0x7c6e('0x63'),'attributes':['id','name']});_0x4ae8f0['push']({'model':db['User'],'as':_0x7c6e('0x64'),'attributes':['id',_0x7c6e('0x59')]});return db[_0x7c6e('0x22')]['find']({'where':{'id':_0x1b1e68[_0x7c6e('0x3a')]['id']},'include':_0x4ae8f0})[_0x7c6e('0x1b')](handleEntityNotFound(_0x539e77,null))['then'](function(_0x546b32){if(_0x546b32){var _0x2b5d33=_0x546b32[_0x7c6e('0x65')]({'plain':!![]});fs['mkdirSync'](_0x4c6295);var _0x3624c1={'channel':_0x7c6e('0x66'),'account':_0x2b5d33[_0x7c6e('0x63')][_0x7c6e('0x1e')],'agent':_0x2b5d33['Owner']?_0x2b5d33[_0x7c6e('0x64')]['fullname']:_0x7c6e('0x67'),'createdAt':moment(_0x2b5d33[_0x7c6e('0x5e')])[_0x7c6e('0x68')](_0x7c6e('0x49'))[_0x7c6e('0x53')](),'closedAt':_0x2b5d33[_0x7c6e('0x69')]?moment(_0x2b5d33[_0x7c6e('0x6a')])['format'](_0x7c6e('0x49'))[_0x7c6e('0x53')]():'','disposition':_0x2b5d33['disposition'],'messages':_(_0x2b5d33['Messages'])[_0x7c6e('0x47')]({'secret':![]})['map'](function(_0x3f66dd){return{'date':moment(_0x3f66dd[_0x7c6e('0x5e')])[_0x7c6e('0x68')](_0x7c6e('0x49'))[_0x7c6e('0x53')](),'sender':_0x3f66dd[_0x7c6e('0x5f')]==='out'?_0x3f66dd[_0x7c6e('0x6b')]?_0x3f66dd[_0x7c6e('0x6b')][_0x7c6e('0x59')]:_0x7c6e('0x6c'):_0x3f66dd[_0x7c6e('0x5b')][_0x7c6e('0x5c')]+(_0x3f66dd[_0x7c6e('0x5b')][_0x7c6e('0x5d')]?'\x20'+_0x3f66dd[_0x7c6e('0x5b')]['lastName']:''),'body':_0x3f66dd['body'],'direction':_0x3f66dd[_0x7c6e('0x5f')]===_0x7c6e('0x6d')?'A':'C','secret':_0x3f66dd['secret'],'read':_0x3f66dd[_0x7c6e('0x61')]};})['value']()};return ejs[_0x7c6e('0x6e')](path['join'](config[_0x7c6e('0x55')],_0x7c6e('0x56'),_0x7c6e('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x3624c1})[_0x7c6e('0x1b')](function(_0x53d209){var _0x47dda6=path[_0x7c6e('0x54')](_0x4c6295,_0x7c6e('0x70')+_0x2b5d33['id']+'-'+_0x9ed487+_0x7c6e('0x71'));var _0x4de24f={'path':_0x47dda6,'channel':_0x7c6e('0x66'),'interactionId':_0x2b5d33['id']};return pdf[_0x7c6e('0x72')](_0x53d209,_0x4de24f);})[_0x7c6e('0x1b')](function(){return new BPromise(function(_0x599801,_0x39d7eb){zipdir(_0x4c6295,{'saveTo':_0x3caf55},function(_0x3a3267,_0x2467cb){if(_0x3a3267)return _0x39d7eb(_0x3a3267);return _0x599801(_0x2467cb);});})['then'](function(){return new BPromise(function(_0x287f2f,_0x28188a){rimraf(_0x4c6295,function(_0x3c51ee){if(_0x3c51ee)_0x28188a(_0x3c51ee);return _0x287f2f();});});})[_0x7c6e('0x1b')](function(){return _0x539e77[_0x7c6e('0x51')](_0x3caf55,_0x3f63ce,function(_0x526c80){if(_0x526c80){console[_0x7c6e('0x73')]('err',_0x526c80);}else{fs['unlinkSync'](_0x3caf55);}});});});}else{return _0x539e77[_0x7c6e('0x12')](0xc8);}})[_0x7c6e('0x2b')](handleError(_0x539e77,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index af8f419..18a22e6 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 _0x958a=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x574a93,_0x59ded6){var _0x11046f=function(_0x3df923){while(--_0x3df923){_0x574a93['push'](_0x574a93['shift']());}};_0x11046f(++_0x59ded6);}(_0x958a,0x128));var _0xa958=function(_0xa1484e,_0x2a3562){_0xa1484e=_0xa1484e-0x0;var _0x404703=_0x958a[_0xa1484e];return _0x404703;};'use strict';var EventEmitter=require(_0xa958('0x0'));var SmsInteraction=require(_0xa958('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa958('0x1'))['db'][_0xa958('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa958('0x3')](0x0);var events={'afterCreate':_0xa958('0x4'),'afterUpdate':_0xa958('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3424b0){return function(_0x578481,_0x2024b8,_0x9b7d9e){_0x578481[_0xa958('0x6')]({'attributes':['id'],'raw':!![]})[_0xa958('0x7')](function(_0x3ca01f){_0x578481[_0xa958('0x8')](_0xa958('0x9'),_0x3ca01f['map'](function(_0x514b4f){return{'id':_0x514b4f['id']};}));return SmsMessage[_0xa958('0xa')]({'where':{'SmsInteractionId':_0x578481['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa958('0x7')](function(_0x11f090){_0x578481[_0xa958('0x8')](_0xa958('0xb'),_0x11f090[_0xa958('0xc')]);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0+':'+_0x578481['id'],_0x578481);SmsInteractionEvents[_0xa958('0xd')](_0x3424b0,_0x578481);_0x9b7d9e(null);})[_0xa958('0xe')](_0x9b7d9e(null));};}for(var e in events){if(events[_0xa958('0xf')](e)){var event=events[e];SmsInteraction[_0xa958('0x10')](e,emitEvent(event));}}module[_0xa958('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xea28=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xea28,0x13a));var _0x8ea2=function(_0x2e8c2a,_0x391d34){_0x2e8c2a=_0x2e8c2a-0x0;var _0x51c7ad=_0xea28[_0x2e8c2a];return _0x51c7ad;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var SmsInteraction=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var SmsMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8ea2('0x4')](0x0);var events={'afterCreate':_0x8ea2('0x5'),'afterUpdate':_0x8ea2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x9b45ab){return function(_0x23aaf1,_0x1ccf12,_0x513a0d){_0x23aaf1[_0x8ea2('0x7')]({'attributes':['id'],'raw':!![]})[_0x8ea2('0x8')](function(_0xb7f278){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xa'),_0xb7f278[_0x8ea2('0xb')](function(_0x19bd6c){return{'id':_0x19bd6c['id']};}));return SmsMessage[_0x8ea2('0xc')]({'where':{'SmsInteractionId':_0x23aaf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ea2('0x8')](function(_0x3000f9){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xd'),_0x3000f9['length']);SmsInteractionEvents['emit'](_0x9b45ab+':'+_0x23aaf1['id'],_0x23aaf1);SmsInteractionEvents[_0x8ea2('0xe')](_0x9b45ab,_0x23aaf1);_0x513a0d(null);})[_0x8ea2('0xf')](_0x513a0d(null));};}for(var e in events){if(events[_0x8ea2('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8ea2('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 27fafaa..e8cc3ed 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 _0x55b3=['../../config/environment','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x22b396,_0x5a848d){var _0x5e78b2=function(_0x151832){while(--_0x151832){_0x22b396['push'](_0x22b396['shift']());}};_0x5e78b2(++_0x5a848d);}(_0x55b3,0x1bc));var _0x355b=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x55b3[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x355b('0x0'));var util=require(_0x355b('0x1'));var logger=require(_0x355b('0x2'))(_0x355b('0x3'));var moment=require(_0x355b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x355b('0x5'));var config=require(_0x355b('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x355b('0x7')]=function(_0x20002c,_0x4b714f){return _0x20002c[_0x355b('0x8')]('SmsInteraction',attributes,{'tableName':_0x355b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b4539,_0x579794,_0x27242c){if(_0x3b4539[_0x355b('0xa')](_0x355b('0xb'))){_0x3b4539[_0x355b('0xc')]=moment()[_0x355b('0xd')](_0x355b('0xe'));}_0x27242c(null,_0x3b4539);}}});}; \ No newline at end of file +var _0x4547=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','changed','closed','closedAt'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x4547,0xc5));var _0x7454=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x4547[_0x38b14f];return _0x22a324;};'use strict';var _=require('lodash');var util=require(_0x7454('0x0'));var logger=require(_0x7454('0x1'))('api');var moment=require(_0x7454('0x2'));var BPromise=require(_0x7454('0x3'));var rp=require(_0x7454('0x4'));var fs=require('fs');var path=require(_0x7454('0x5'));var rimraf=require(_0x7454('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x2c1bf8,_0x312882){return _0x2c1bf8[_0x7454('0x7')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e487b,_0x246fa2,_0x2b32c8){if(_0x3e487b[_0x7454('0x8')](_0x7454('0x9'))){_0x3e487b[_0x7454('0xa')]=moment()[_0x7454('0xb')](_0x7454('0xc'));}_0x2b32c8(null,_0x3e487b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0ce3863..05bc7e4 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 _0xadd5=['AddTags','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread'];(function(_0x4a4927,_0x2310c1){var _0x1fca8e=function(_0x17aec8){while(--_0x17aec8){_0x4a4927['push'](_0x4a4927['shift']());}};_0x1fca8e(++_0x2310c1);}(_0xadd5,0x7d));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5add('0x0'));var util=require('util');var moment=require(_0x5add('0x1'));var BPromise=require(_0x5add('0x2'));var rs=require(_0x5add('0x3'));var fs=require('fs');var Redis=require(_0x5add('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5add('0x5'));var logger=require(_0x5add('0x6'))('rpc');var config=require(_0x5add('0x7'));var jayson=require(_0x5add('0x8'));var client=jayson[_0x5add('0x9')]['http']({'port':0x232a});config[_0x5add('0xa')]=_[_0x5add('0xb')](config['redis'],{'host':_0x5add('0xc'),'port':0x18eb});var socket=require(_0x5add('0xd'))(new Redis(config[_0x5add('0xa')]));require(_0x5add('0xe'))[_0x5add('0xf')](socket);function respondWithRpcPromise(_0x3d4e54,_0x30797c,_0x2a4efa){return new BPromise(function(_0x1379b0,_0x402c27){return client['request'](_0x3d4e54,_0x2a4efa)[_0x5add('0x10')](function(_0x1a58d3){logger['info'](_0x5add('0x11'),_0x30797c,'request\x20sent');logger[_0x5add('0x12')](_0x5add('0x13'),_0x30797c,'request\x20sent',JSON['stringify'](_0x1a58d3));if(_0x1a58d3['error']){if(_0x1a58d3[_0x5add('0x14')]['code']===0x1f4){logger[_0x5add('0x14')](_0x5add('0x11'),_0x30797c,_0x1a58d3[_0x5add('0x14')][_0x5add('0x15')]);return _0x402c27(_0x1a58d3['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x30797c,_0x1a58d3['error']['message']);return _0x1379b0(_0x1a58d3[_0x5add('0x14')][_0x5add('0x15')]);}else{logger[_0x5add('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x30797c,_0x5add('0x17'));_0x1379b0(_0x1a58d3['result'][_0x5add('0x15')]);}})['catch'](function(_0x444148){logger[_0x5add('0x14')](_0x5add('0x11'),_0x30797c,_0x444148);_0x402c27(_0x444148);});});}exports[_0x5add('0x18')]=function(_0x17dd64){var _0x463ff4=this;return new Promise(function(_0x367727,_0x596e19){return db[_0x5add('0x19')][_0x5add('0x1a')](_0x17dd64[_0x5add('0x1b')],{'raw':_0x17dd64[_0x5add('0x1c')]?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17dd64['options']?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1e')]||null:null,'attributes':_0x17dd64['options']?_0x17dd64[_0x5add('0x1c')]['attributes']||null:null,'limit':_0x17dd64[_0x5add('0x1c')]?_0x17dd64[_0x5add('0x1c')][_0x5add('0x1f')]||null:null})[_0x5add('0x10')](function(_0x9c606){logger[_0x5add('0x16')](_0x5add('0x18'),_0x17dd64);logger['debug'](_0x5add('0x18'),_0x17dd64,JSON['stringify'](_0x9c606));_0x367727(_0x9c606);})[_0x5add('0x20')](function(_0x5a797f){logger[_0x5add('0x14')](_0x5add('0x18'),_0x5a797f[_0x5add('0x15')],_0x17dd64);_0x596e19(_0x463ff4[_0x5add('0x14')](0x1f4,_0x5a797f['message']));});});};exports[_0x5add('0x21')]=function(_0x37b3af){return new Promise(function(_0x44c90c,_0x26921b){return db['SmsInteraction'][_0x5add('0x22')]({'where':_0x37b3af[_0x5add('0x1c')]?_0x37b3af[_0x5add('0x1c')][_0x5add('0x1e')]||null:null})[_0x5add('0x10')](function(_0x5c1a79){if(_0x5c1a79){return _0x5c1a79[_0x5add('0x23')](_0x37b3af[_0x5add('0x1b')][_0x5add('0x24')],_[_0x5add('0x25')](_0x37b3af[_0x5add('0x1b')],[_0x5add('0x24'),'id'])||{});}})[_0x5add('0x26')](function(_0xe4d68b){logger['info']('AddTags',_0x37b3af);logger[_0x5add('0x12')](_0x5add('0x27'),_0x37b3af,JSON[_0x5add('0x28')](_0xe4d68b));_0x44c90c(_0xe4d68b);})[_0x5add('0x20')](function(_0x47d309){logger['error'](_0x5add('0x27'),_0x47d309[_0x5add('0x15')],_0x37b3af);_0x26921b(_this[_0x5add('0x14')](0x1f4,_0x47d309[_0x5add('0x15')]));});});}; \ No newline at end of file +var _0x8304=['message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','info','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s'];(function(_0x4b5e1d,_0x39a146){var _0x37697f=function(_0x35e13f){while(--_0x35e13f){_0x4b5e1d['push'](_0x4b5e1d['shift']());}};_0x37697f(++_0x39a146);}(_0x8304,0x11d));var _0x4830=function(_0x59cfcb,_0x1c96d2){_0x59cfcb=_0x59cfcb-0x0;var _0x1efad9=_0x8304[_0x59cfcb];return _0x1efad9;};'use strict';var _=require(_0x4830('0x0'));var util=require(_0x4830('0x1'));var moment=require(_0x4830('0x2'));var BPromise=require(_0x4830('0x3'));var rs=require(_0x4830('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4830('0x5'))['db'];var utils=require(_0x4830('0x6'));var logger=require(_0x4830('0x7'))(_0x4830('0x8'));var config=require(_0x4830('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4830('0xa')][_0x4830('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4830('0xc')],{'host':_0x4830('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4830('0xe'))[_0x4830('0xf')](socket);function respondWithRpcPromise(_0x2a272d,_0x1ccf4e,_0x43b95c){return new BPromise(function(_0x3522f9,_0x35111d){return client[_0x4830('0x10')](_0x2a272d,_0x43b95c)[_0x4830('0x11')](function(_0x3cfe9c){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x1ccf4e,_0x4830('0x12'));logger[_0x4830('0x13')](_0x4830('0x14'),_0x1ccf4e,_0x4830('0x12'),JSON['stringify'](_0x3cfe9c));if(_0x3cfe9c['error']){if(_0x3cfe9c['error']['code']===0x1f4){logger[_0x4830('0x15')](_0x4830('0x16'),_0x1ccf4e,_0x3cfe9c['error'][_0x4830('0x17')]);return _0x35111d(_0x3cfe9c[_0x4830('0x15')][_0x4830('0x17')]);}logger[_0x4830('0x15')](_0x4830('0x16'),_0x1ccf4e,_0x3cfe9c[_0x4830('0x15')][_0x4830('0x17')]);return _0x3522f9(_0x3cfe9c[_0x4830('0x15')][_0x4830('0x17')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x1ccf4e,_0x4830('0x12'));_0x3522f9(_0x3cfe9c[_0x4830('0x18')][_0x4830('0x17')]);}})[_0x4830('0x19')](function(_0x5e688b){logger[_0x4830('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x1ccf4e,_0x5e688b);_0x35111d(_0x5e688b);});});}exports[_0x4830('0x1a')]=function(_0x571ce1){var _0x56d929=this;return new Promise(function(_0x36c57c,_0x53cb5e){return db[_0x4830('0x1b')][_0x4830('0x1c')](_0x571ce1[_0x4830('0x1d')],{'raw':_0x571ce1[_0x4830('0x1e')]?_0x571ce1[_0x4830('0x1e')][_0x4830('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571ce1['options']?_0x571ce1[_0x4830('0x1e')][_0x4830('0x20')]||null:null,'attributes':_0x571ce1[_0x4830('0x1e')]?_0x571ce1[_0x4830('0x1e')][_0x4830('0x21')]||null:null,'limit':_0x571ce1[_0x4830('0x1e')]?_0x571ce1[_0x4830('0x1e')][_0x4830('0x22')]||null:null})['then'](function(_0xe8d8d8){logger[_0x4830('0x23')](_0x4830('0x1a'),_0x571ce1);logger['debug'](_0x4830('0x1a'),_0x571ce1,JSON[_0x4830('0x24')](_0xe8d8d8));_0x36c57c(_0xe8d8d8);})[_0x4830('0x19')](function(_0x52e30d){logger[_0x4830('0x15')](_0x4830('0x1a'),_0x52e30d[_0x4830('0x17')],_0x571ce1);_0x53cb5e(_0x56d929[_0x4830('0x15')](0x1f4,_0x52e30d[_0x4830('0x17')]));});});};exports[_0x4830('0x25')]=function(_0x41bc65){return new Promise(function(_0x385fc1,_0x5afc84){return db['SmsInteraction'][_0x4830('0x26')]({'where':_0x41bc65[_0x4830('0x1e')]?_0x41bc65[_0x4830('0x1e')]['where']||null:null})[_0x4830('0x11')](function(_0x40d4b8){if(_0x40d4b8){return _0x40d4b8[_0x4830('0x27')](_0x41bc65[_0x4830('0x1d')][_0x4830('0x28')],_[_0x4830('0x29')](_0x41bc65[_0x4830('0x1d')],[_0x4830('0x28'),'id'])||{});}})[_0x4830('0x2a')](function(_0x1d212b){logger[_0x4830('0x23')](_0x4830('0x2b'),_0x41bc65);logger[_0x4830('0x13')]('AddTags',_0x41bc65,JSON[_0x4830('0x24')](_0x1d212b));_0x385fc1(_0x1d212b);})[_0x4830('0x19')](function(_0x31ac76){logger['error'](_0x4830('0x2b'),_0x31ac76[_0x4830('0x17')],_0x41bc65);_0x5afc84(_this[_0x4830('0x15')](0x1f4,_0x31ac76['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e963e87..dd6ab21 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 _0x410d=['save','remove','update','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x465fc9,_0x15f960){var _0xd4b04f=function(_0x44fdc8){while(--_0x44fdc8){_0x465fc9['push'](_0x465fc9['shift']());}};_0xd4b04f(++_0x15f960);}(_0x410d,0x117));var _0xd410=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x410d[_0x4bd950];return _0x5dc59a;};'use strict';var SmsInteractionEvents=require(_0xd410('0x0'));var events=[_0xd410('0x1'),_0xd410('0x2'),_0xd410('0x3')];function createListener(_0x104e1f,_0x4683ba){return function(_0x1be8c9){_0x4683ba['emit'](_0x104e1f,_0x1be8c9);};}function removeListener(_0x2c074b,_0x3f1b1e){return function(){SmsInteractionEvents[_0xd410('0x4')](_0x2c074b,_0x3f1b1e);};}exports[_0xd410('0x5')]=function(_0x1978fd){for(var _0x3ed3da=0x0,_0x1eeaf1=events[_0xd410('0x6')];_0x3ed3da<_0x1eeaf1;_0x3ed3da++){var _0x5a2750=events[_0x3ed3da];var _0x3d9815=createListener(_0xd410('0x7')+_0x5a2750,_0x1978fd);SmsInteractionEvents['on'](_0x5a2750,_0x3d9815);}}; \ No newline at end of file +var _0x9a33=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x2cc0d0,_0x1c55f1){var _0x770bb8=function(_0x18c3f8){while(--_0x18c3f8){_0x2cc0d0['push'](_0x2cc0d0['shift']());}};_0x770bb8(++_0x1c55f1);}(_0x9a33,0x184));var _0x39a3=function(_0x1c6bcd,_0x107272){_0x1c6bcd=_0x1c6bcd-0x0;var _0x16f7de=_0x9a33[_0x1c6bcd];return _0x16f7de;};'use strict';var SmsInteractionEvents=require(_0x39a3('0x0'));var events=['save',_0x39a3('0x1'),_0x39a3('0x2')];function createListener(_0x2c343c,_0x39f4d7){return function(_0x149af6){_0x39f4d7[_0x39a3('0x3')](_0x2c343c,_0x149af6);};}function removeListener(_0x365a20,_0x343ce1){return function(){SmsInteractionEvents[_0x39a3('0x4')](_0x365a20,_0x343ce1);};}exports[_0x39a3('0x5')]=function(_0x4d0879){for(var _0x1ab78a=0x0,_0x5983c5=events[_0x39a3('0x6')];_0x1ab78a<_0x5983c5;_0x1ab78a++){var _0x5c78dc=events[_0x1ab78a];var _0x19de56=createListener(_0x39a3('0x7')+_0x5c78dc,_0x4d0879);SmsInteractionEvents['on'](_0x5c78dc,_0x19de56);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e9564a5..3cadad4 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 _0x1a4d=['isAuthenticated','index','get','/describe','describe','/:id','show','sms','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x243189,_0x1e7b75){var _0x372755=function(_0x5e976b){while(--_0x5e976b){_0x243189['push'](_0x243189['shift']());}};_0x372755(++_0x1e7b75);}(_0x1a4d,0x189));var _0xd1a4=function(_0x2ea103,_0x54e454){_0x2ea103=_0x2ea103-0x0;var _0x1c5b5d=_0x1a4d[_0x2ea103];return _0x1c5b5d;};'use strict';var multer=require(_0xd1a4('0x0'));var util=require(_0xd1a4('0x1'));var path=require('path');var timeout=require(_0xd1a4('0x2'));var express=require(_0xd1a4('0x3'));var router=express[_0xd1a4('0x4')]();var fs_extra=require(_0xd1a4('0x5'));var auth=require(_0xd1a4('0x6'));var interaction=require(_0xd1a4('0x7'));var config=require(_0xd1a4('0x8'));var controller=require(_0xd1a4('0x9'));router['get']('/',auth[_0xd1a4('0xa')](),controller[_0xd1a4('0xb')]);router[_0xd1a4('0xc')](_0xd1a4('0xd'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0xe')]);router[_0xd1a4('0xc')](_0xd1a4('0xf'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0x10')]);router['post']('/',auth[_0xd1a4('0xa')](),interaction['tracked'](_0xd1a4('0x11'),_0xd1a4('0x12')),controller[_0xd1a4('0x13')]);router[_0xd1a4('0x14')](_0xd1a4('0x15'),controller[_0xd1a4('0x16')]);router[_0xd1a4('0x17')](_0xd1a4('0xf'),auth[_0xd1a4('0xa')](),controller[_0xd1a4('0x18')]);router['put'](_0xd1a4('0x19'),auth['isAuthenticated'](),controller[_0xd1a4('0x1a')]);router[_0xd1a4('0x17')](_0xd1a4('0x1b'),auth['isAuthenticated'](),controller[_0xd1a4('0x1c')]);router[_0xd1a4('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd1a4('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xedf3=['show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x7a6bb9,_0x2db05d){var _0x1af513=function(_0x7502e2){while(--_0x7502e2){_0x7a6bb9['push'](_0x7a6bb9['shift']());}};_0x1af513(++_0x2db05d);}(_0xedf3,0x17a));var _0x3edf=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xedf3[_0x525af9];return _0x129fbf;};'use strict';var multer=require('multer');var util=require(_0x3edf('0x0'));var path=require(_0x3edf('0x1'));var timeout=require(_0x3edf('0x2'));var express=require(_0x3edf('0x3'));var router=express[_0x3edf('0x4')]();var fs_extra=require(_0x3edf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3edf('0x6'));var config=require(_0x3edf('0x7'));var controller=require(_0x3edf('0x8'));router[_0x3edf('0x9')]('/',auth['isAuthenticated'](),controller[_0x3edf('0xa')]);router['get']('/describe',auth[_0x3edf('0xb')](),controller[_0x3edf('0xc')]);router[_0x3edf('0x9')](_0x3edf('0xd'),auth[_0x3edf('0xb')](),controller[_0x3edf('0xe')]);router[_0x3edf('0xf')]('/',auth['isAuthenticated'](),interaction[_0x3edf('0x10')](_0x3edf('0x11'),_0x3edf('0x12')),controller[_0x3edf('0x13')]);router[_0x3edf('0xf')](_0x3edf('0x14'),controller[_0x3edf('0x15')]);router[_0x3edf('0x16')](_0x3edf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3edf('0x16')]('/:id/accept',auth[_0x3edf('0xb')](),controller[_0x3edf('0x17')]);router['put'](_0x3edf('0x18'),auth[_0x3edf('0xb')](),controller['reject']);router[_0x3edf('0x19')](_0x3edf('0xd'),auth[_0x3edf('0xb')](),controller[_0x3edf('0x1a')]);module[_0x3edf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2390cf5..b8c1618 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 _0xcdc2=['sequelize','TEXT','BOOLEAN','out','STRING','DATE'];(function(_0x70fce,_0x59f234){var _0x4d69eb=function(_0x1ab5e1){while(--_0x1ab5e1){_0x70fce['push'](_0x70fce['shift']());}};_0x4d69eb(++_0x59f234);}(_0xcdc2,0xae));var _0x2cdc=function(_0x55689e,_0x54b22e){_0x55689e=_0x55689e-0x0;var _0x21ffde=_0xcdc2[_0x55689e];return _0x21ffde;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cdc('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cdc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2cdc('0x3')),'defaultValue':_0x2cdc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2cdc('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2cdc('0x5')]},'secret':{'type':Sequelize[_0x2cdc('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2cdc('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9143=['exports','medium','out','STRING','DATE','BOOLEAN','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9143,0x107));var _0x3914=function(_0x569539,_0x3eb9f4){_0x569539=_0x569539-0x0;var _0x12d621=_0x9143[_0x569539];return _0x12d621;};'use strict';var Sequelize=require(_0x3914('0x0'));module[_0x3914('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3914('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3914('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3914('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3914('0x5')]},'secret':{'type':Sequelize[_0x3914('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3914('0x4')]},'providerResponse':{'type':Sequelize[_0x3914('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a21df04..472d1f2 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 _0xa282=['filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','accept','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','delivered','inspect','infobip','eml-format','fast-json-patch','moment','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/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys'];(function(_0x241bd4,_0x5756e5){var _0x195f33=function(_0x3f4dee){while(--_0x3f4dee){_0x241bd4['push'](_0x241bd4['shift']());}};_0x195f33(++_0x5756e5);}(_0xa282,0x1f3));var _0x2a28=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xa282[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x2a28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a28('0x1'));var rp=require('request-promise');var moment=require(_0x2a28('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2a28('0x3'));var util=require(_0x2a28('0x4'));var path=require(_0x2a28('0x5'));var sox=require(_0x2a28('0x6'));var csv=require(_0x2a28('0x7'));var ejs=require(_0x2a28('0x8'));var fs=require('fs');var fs_extra=require(_0x2a28('0x9'));var _=require(_0x2a28('0xa'));var squel=require(_0x2a28('0xb'));var crypto=require(_0x2a28('0xc'));var jsforce=require(_0x2a28('0xd'));var deskjs=require(_0x2a28('0xe'));var toCsv=require(_0x2a28('0x7'));var querystring=require('querystring');var Papa=require(_0x2a28('0xf'));var Redis=require('ioredis');var authService=require(_0x2a28('0x10'));var qs=require(_0x2a28('0x11'));var as=require(_0x2a28('0x12'));var hardwareService=require(_0x2a28('0x13'));var logger=require(_0x2a28('0x14'))(_0x2a28('0x15'));var utils=require(_0x2a28('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2a28('0x17'))['db'];config['redis']=_[_0x2a28('0x18')](config[_0x2a28('0x19')],{'host':_0x2a28('0x1a'),'port':0x18eb});var socket=require(_0x2a28('0x1b'))(new Redis(config[_0x2a28('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x2a28('0x1c'));var client=jayson[_0x2a28('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x2a28('0x1d')][_0x2a28('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4fd15c,_0x5e6257,_0x575294,_0x13751d){return new BPromise(function(_0x506493,_0x45b810){var _0x1ecad=_0x13751d||client;return _0x1ecad['request'](_0x4fd15c,_0x575294)[_0x2a28('0x1f')](function(_0xced0d4){logger['info'](_0x2a28('0x20'),_0x5e6257,'request\x20sent');logger[_0x2a28('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e6257,_0x2a28('0x22'),JSON[_0x2a28('0x23')](_0xced0d4));if(_0xced0d4[_0x2a28('0x24')]){if(_0xced0d4[_0x2a28('0x24')][_0x2a28('0x25')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5e6257,_0xced0d4[_0x2a28('0x24')]['message']);return _0x45b810(_0xced0d4['error'][_0x2a28('0x26')]);}logger['error'](_0x2a28('0x20'),_0x5e6257,_0xced0d4[_0x2a28('0x24')][_0x2a28('0x26')]);return _0x506493(_0xced0d4[_0x2a28('0x24')]['message']);}else{logger['info'](_0x2a28('0x20'),_0x5e6257,_0x2a28('0x22'));_0x506493(_0xced0d4[_0x2a28('0x27')]['message']);}})[_0x2a28('0x28')](function(_0x3f2255){logger[_0x2a28('0x24')](_0x2a28('0x20'),_0x5e6257,_0x3f2255);_0x45b810(_0x3f2255);});});}function respondWithStatusCode(_0x185d9c,_0x13d489){_0x13d489=_0x13d489||0xcc;return function(_0x263758){if(_0x263758){return _0x185d9c[_0x2a28('0x29')](_0x13d489);}return _0x185d9c[_0x2a28('0x2a')](_0x13d489)[_0x2a28('0x2b')]();};}function respondWithResult(_0xfe8d51,_0x59a857){_0x59a857=_0x59a857||0xc8;return function(_0x408539){if(_0x408539){return _0xfe8d51[_0x2a28('0x2a')](_0x59a857)['json'](_0x408539);}};}function respondWithFilteredResult(_0x146dfb,_0x52349d){return function(_0x452cd0){if(_0x452cd0){var _0x4124c0=typeof _0x52349d[_0x2a28('0x2c')]===_0x2a28('0x2d')&&typeof _0x52349d['limit']===_0x2a28('0x2d');var _0x4b0d15=_0x452cd0[_0x2a28('0x2e')];var _0x284e92=_0x4124c0?0x0:_0x52349d[_0x2a28('0x2c')];var _0x111ae1=_0x4124c0?_0x452cd0['count']:_0x52349d[_0x2a28('0x2c')]+_0x52349d[_0x2a28('0x2f')];var _0x43f8ba;if(_0x111ae1>=_0x4b0d15){_0x111ae1=_0x4b0d15;_0x43f8ba=0xc8;}else{_0x43f8ba=0xce;}_0x146dfb[_0x2a28('0x2a')](_0x43f8ba);return _0x146dfb[_0x2a28('0x30')](_0x2a28('0x31'),_0x284e92+'-'+_0x111ae1+'/'+_0x4b0d15)['json'](_0x452cd0);}return null;};}function patchUpdates(_0x2fd4ee){return function(_0x4f3321){try{jsonpatch[_0x2a28('0x32')](_0x4f3321,_0x2fd4ee,!![]);}catch(_0x15e3fb){return BPromise['reject'](_0x15e3fb);}return _0x4f3321['save']();};}function saveUpdates(_0x2aa9ba,_0x3924a9){return function(_0x2242cb){if(_0x2242cb){return _0x2242cb[_0x2a28('0x33')](_0x2aa9ba)[_0x2a28('0x1f')](function(_0x192112){return _0x192112;});}return null;};}function removeEntity(_0x1f5115,_0x2a3498){return function(_0x33e7f7){if(_0x33e7f7){return _0x33e7f7[_0x2a28('0x34')]()[_0x2a28('0x1f')](function(){_0x1f5115[_0x2a28('0x2a')](0xcc)[_0x2a28('0x2b')]();});}};}function handleEntityNotFound(_0x36ed95,_0x47a671){return function(_0x26c89f){if(!_0x26c89f){_0x36ed95[_0x2a28('0x29')](0x194);}return _0x26c89f;};}function handleError(_0x11be0a,_0x552bae){_0x552bae=_0x552bae||0x1f4;return function(_0x5c7809){logger['error'](_0x5c7809[_0x2a28('0x35')]);if(_0x5c7809[_0x2a28('0x36')]){delete _0x5c7809[_0x2a28('0x36')];}_0x11be0a['status'](_0x552bae)[_0x2a28('0x37')](_0x5c7809);};}exports[_0x2a28('0x38')]=function(_0x33cb23,_0x513ca0){var _0x29342d={},_0x1f5755={},_0x1ab7e3={'count':0x0,'rows':[]};var _0x1cd9a2=_[_0x2a28('0x39')](db[_0x2a28('0x3a')][_0x2a28('0x3b')],function(_0xd1dc4d){return{'name':_0xd1dc4d[_0x2a28('0x3c')],'type':_0xd1dc4d['type'][_0x2a28('0x3d')]};});_0x1f5755[_0x2a28('0x3e')]=_['map'](_0x1cd9a2,_0x2a28('0x36'));_0x1f5755[_0x2a28('0x3f')]=_[_0x2a28('0x40')](_0x33cb23['query']);_0x1f5755[_0x2a28('0x41')]=_[_0x2a28('0x42')](_0x1f5755['model'],_0x1f5755['query']);_0x29342d[_0x2a28('0x43')]=_[_0x2a28('0x42')](_0x1f5755[_0x2a28('0x3e')],qs[_0x2a28('0x44')](_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x44')]));_0x29342d[_0x2a28('0x43')]=_0x29342d[_0x2a28('0x43')][_0x2a28('0x45')]?_0x29342d[_0x2a28('0x43')]:_0x1f5755[_0x2a28('0x3e')];if(!_0x33cb23[_0x2a28('0x3f')]['hasOwnProperty'](_0x2a28('0x46'))){_0x29342d[_0x2a28('0x2f')]=qs[_0x2a28('0x2f')](_0x33cb23['query'][_0x2a28('0x2f')]);_0x29342d[_0x2a28('0x2c')]=qs[_0x2a28('0x2c')](_0x33cb23['query'][_0x2a28('0x2c')]);}_0x29342d[_0x2a28('0x47')]=qs[_0x2a28('0x48')](_0x33cb23['query'][_0x2a28('0x48')]);_0x29342d['where']=qs[_0x2a28('0x41')](_[_0x2a28('0x49')](_0x33cb23[_0x2a28('0x3f')],_0x1f5755['filters']),_0x1cd9a2);if(_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x4a')]){_0x29342d['where']=_[_0x2a28('0x4b')](_0x29342d[_0x2a28('0x4c')],{'$or':_[_0x2a28('0x39')](_0x1cd9a2,function(_0x18af34){if(_0x18af34[_0x2a28('0x4d')]!=='VIRTUAL'){var _0x314abe={};_0x314abe[_0x18af34[_0x2a28('0x36')]]={'$like':'%'+_0x33cb23['query'][_0x2a28('0x4a')]+'%'};return _0x314abe;}})});}_0x29342d=_['merge']({},_0x29342d,_0x33cb23[_0x2a28('0x4e')]);var _0x2fdcbf={'where':_0x29342d[_0x2a28('0x4c')]};return db[_0x2a28('0x3a')][_0x2a28('0x2e')](_0x2fdcbf)['then'](function(_0x235d00){_0x1ab7e3['count']=_0x235d00;if(_0x33cb23[_0x2a28('0x3f')][_0x2a28('0x4f')]){_0x29342d[_0x2a28('0x50')]=[{'all':!![]}];}return db[_0x2a28('0x3a')][_0x2a28('0x51')](_0x29342d);})[_0x2a28('0x1f')](function(_0x4e9571){_0x1ab7e3['rows']=_0x4e9571;return _0x1ab7e3;})[_0x2a28('0x1f')](respondWithFilteredResult(_0x513ca0,_0x29342d))[_0x2a28('0x28')](handleError(_0x513ca0,null));};exports[_0x2a28('0x52')]=function(_0xb3fa4f,_0xd0b472){var _0x314a40={'raw':!![],'where':{'id':_0xb3fa4f[_0x2a28('0x53')]['id']}},_0x1f7006={};_0x1f7006['model']=_['keys'](db[_0x2a28('0x3a')][_0x2a28('0x3b')]);_0x1f7006['query']=_['keys'](_0xb3fa4f[_0x2a28('0x3f')]);_0x1f7006[_0x2a28('0x41')]=_[_0x2a28('0x42')](_0x1f7006[_0x2a28('0x3e')],_0x1f7006[_0x2a28('0x3f')]);_0x314a40['attributes']=_[_0x2a28('0x42')](_0x1f7006[_0x2a28('0x3e')],qs['fields'](_0xb3fa4f['query'][_0x2a28('0x44')]));_0x314a40[_0x2a28('0x43')]=_0x314a40[_0x2a28('0x43')][_0x2a28('0x45')]?_0x314a40['attributes']:_0x1f7006[_0x2a28('0x3e')];if(_0xb3fa4f[_0x2a28('0x3f')][_0x2a28('0x4f')]){_0x314a40[_0x2a28('0x50')]=[{'all':!![]}];}_0x314a40=_['merge']({},_0x314a40,_0xb3fa4f[_0x2a28('0x4e')]);return db[_0x2a28('0x3a')][_0x2a28('0x54')](_0x314a40)['then'](handleEntityNotFound(_0xd0b472,null))[_0x2a28('0x1f')](respondWithResult(_0xd0b472,null))[_0x2a28('0x28')](handleError(_0xd0b472,null));};exports['create']=function(_0x20057,_0x48eb47){return db[_0x2a28('0x3a')][_0x2a28('0x55')](_0x20057[_0x2a28('0x56')],{})[_0x2a28('0x1f')](respondWithResult(_0x48eb47,0xc9))[_0x2a28('0x28')](handleError(_0x48eb47,null));};exports['update']=function(_0x24b2fc,_0x33edca){if(_0x24b2fc[_0x2a28('0x56')]['id']){delete _0x24b2fc[_0x2a28('0x56')]['id'];}return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x24b2fc[_0x2a28('0x53')]['id']}})['then'](handleEntityNotFound(_0x33edca,null))[_0x2a28('0x1f')](saveUpdates(_0x24b2fc[_0x2a28('0x56')],null))[_0x2a28('0x1f')](respondWithResult(_0x33edca,null))['catch'](handleError(_0x33edca,null));};exports[_0x2a28('0x34')]=function(_0x52a4c6,_0x27ee55){return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x52a4c6[_0x2a28('0x53')]['id']}})[_0x2a28('0x1f')](handleEntityNotFound(_0x27ee55,null))[_0x2a28('0x1f')](removeEntity(_0x27ee55,null))[_0x2a28('0x28')](handleError(_0x27ee55,null));};exports[_0x2a28('0x57')]=function(_0x158e3a,_0x388aa4){return db[_0x2a28('0x3a')][_0x2a28('0x57')]()['then'](respondWithResult(_0x388aa4,null))[_0x2a28('0x28')](handleError(_0x388aa4,null));};var interaction_log=require(_0x2a28('0x14'))(_0x2a28('0x58'));exports[_0x2a28('0x59')]=function(_0x3e1aad,_0x3c09ee,_0x487f60){var _0x24320b={'agent':{},'channel':'sms'};if(_0x3e1aad[_0x2a28('0x56')]['id']){delete _0x3e1aad[_0x2a28('0x56')]['id'];}_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5a')]=!![];_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5b')]=moment()[_0x2a28('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1aad['body'][_0x2a28('0x5d')]=_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')]||_0x3e1aad[_0x2a28('0x5e')]['id'];_0x24320b[_0x2a28('0x5f')]['id']=_0x3e1aad[_0x2a28('0x56')]['UserId'];return db[_0x2a28('0x3a')][_0x2a28('0x54')]({'where':{'id':_0x3e1aad[_0x2a28('0x53')]['id'],'UserId':null}})[_0x2a28('0x1f')](handleEntityNotFound(_0x3c09ee,null))[_0x2a28('0x1f')](saveUpdates(_0x3e1aad[_0x2a28('0x56')],null))[_0x2a28('0x1f')](function(_0x6a87f0){if(_0x6a87f0){_0x24320b['message']=_0x6a87f0[_0x2a28('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x2a28('0x54')]({'where':{'id':_0x6a87f0[_0x2a28('0x61')]}});}return null;})[_0x2a28('0x1f')](handleEntityNotFound(_0x3c09ee,null))['then'](function(_0x2df8b0){if(_0x2df8b0){return _0x2df8b0[_0x2a28('0x33')]({'UserId':_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')],'read1stAt':_[_0x2a28('0x62')](_0x2df8b0[_0x2a28('0x63')])?moment()['format'](_0x2a28('0x64')):undefined});}return null;})[_0x2a28('0x1f')](function(_0x2975a4){if(_0x2975a4){_0x24320b['interaction']=_0x2975a4[_0x2a28('0x60')]({'plain':!![]});interaction_log[_0x2a28('0x65')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e1aad[_0x2a28('0x5e')]['id'],_0x3e1aad[_0x2a28('0x5e')]['name'],_0x3e1aad[_0x2a28('0x5e')]['role'],_0x24320b[_0x2a28('0x66')]['id'],_0x3e1aad['body']?JSON[_0x2a28('0x23')](_0x3e1aad[_0x2a28('0x56')]):_0x2a28('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2a28('0x68'),_0x24320b);}return null;})[_0x2a28('0x1f')](function(_0x4fe440){var _0xc5797c=_0x2a28('0x69')+_0x4fe440['message'][_0x2a28('0x6a')];return db[_0x2a28('0x6b')][_0x2a28('0x3f')](_0xc5797c,{'type':db[_0x2a28('0x6c')]['QueryTypes'][_0x2a28('0x6d')],'raw':!![]})[_0x2a28('0x1f')](function(_0xe8c77f){return _0xe8c77f;});})[_0x2a28('0x1f')](function(_0x5dbb49){if(_0x5dbb49){_0x24320b[_0x2a28('0x26')][_0x2a28('0x6e')]=_0x5dbb49[0x0];if(!_0x3e1aad[_0x2a28('0x56')][_0x2a28('0x5d')])return;return db['User']['find']({'where':{'id':_0x3e1aad[_0x2a28('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x2a28('0x36'),_0x2a28('0x6f'),_0x2a28('0x70'),_0x2a28('0x71')],'raw':!![]});}return null;})[_0x2a28('0x1f')](function(_0x39e8f4){if(!_0x39e8f4)return null;_0x24320b[_0x2a28('0x26')]['agent']=_0x39e8f4;return _0x24320b;})['then'](function(_0xcc9717){if(_0xcc9717){if(_0x3e1aad['body'][_0x2a28('0x72')]){_0x24320b[_0x2a28('0x26')][_0x2a28('0x73')]=util[_0x2a28('0x5c')](_0x2a28('0x74'),_0x3e1aad[_0x2a28('0x5e')][_0x2a28('0x36')]);_0x24320b[_0x2a28('0x26')]['channel']=_0x24320b[_0x2a28('0x75')];_0x24320b[_0x2a28('0x26')][_0x2a28('0x76')]=_0x24320b[_0x2a28('0x75')];_0x24320b[_0x2a28('0x26')][_0x2a28('0x77')]=_0x2a28('0x59');return respondWithRpcPromise(_0x2a28('0x78'),'EventManager',{'event':_0x2a28('0x79'),'message':_0x24320b[_0x2a28('0x26')]},client9002)[_0x2a28('0x1f')](function(){return _0x24320b;});}return _0x24320b;}return null;})['then'](respondWithResult(_0x3c09ee,null))[_0x2a28('0x28')](handleError(_0x3c09ee,null));};var interaction_log=require(_0x2a28('0x14'))('sms-interactions');exports['reject']=function(_0x2d41db,_0x44dfc9,_0x405d87){var _0x15bbaf={'agent':{},'channel':_0x2a28('0x7a')};if(_0x2d41db['body']['id']){delete _0x2d41db[_0x2a28('0x56')]['id'];}_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')]=_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')]||_0x2d41db[_0x2a28('0x5e')]['id'];_0x15bbaf[_0x2a28('0x5f')]['id']=_0x2d41db['body'][_0x2a28('0x5d')];return db['SmsMessage'][_0x2a28('0x54')]({'where':{'id':_0x2d41db['params']['id'],'UserId':null}})[_0x2a28('0x1f')](handleEntityNotFound(_0x44dfc9,null))[_0x2a28('0x1f')](function(_0x3b2e2f){if(_0x3b2e2f){_0x15bbaf[_0x2a28('0x26')]=_0x3b2e2f['get']({'plain':!![]});return db[_0x2a28('0x7b')][_0x2a28('0x54')]({'where':{'id':_0x3b2e2f[_0x2a28('0x61')]}});}return null;})[_0x2a28('0x1f')](handleEntityNotFound(_0x44dfc9,null))[_0x2a28('0x1f')](function(_0x4e6d10){if(_0x4e6d10){_0x15bbaf[_0x2a28('0x66')]=_0x4e6d10[_0x2a28('0x60')]({'plain':!![]});interaction_log[_0x2a28('0x65')](_0x2a28('0x7c'),_0x2d41db[_0x2a28('0x5e')]['id'],_0x2d41db['user']['name'],_0x2d41db[_0x2a28('0x5e')][_0x2a28('0x7d')],_0x15bbaf[_0x2a28('0x66')]['id'],_0x2d41db['body']?JSON[_0x2a28('0x23')](_0x2d41db[_0x2a28('0x56')]):_0x2a28('0x67'));return respondWithRpcPromise(_0x2a28('0x7e'),_0x2a28('0x7f'),_0x15bbaf);}return null;})[_0x2a28('0x1f')](function(_0x39b91d){var _0x3c2a8f=_0x2a28('0x69')+_0x39b91d[_0x2a28('0x26')]['ContactId'];return db[_0x2a28('0x6b')][_0x2a28('0x3f')](_0x3c2a8f,{'type':db[_0x2a28('0x6c')]['QueryTypes'][_0x2a28('0x6d')],'raw':!![]})['then'](function(_0x579a26){return _0x579a26;});})[_0x2a28('0x1f')](function(_0x16f055){if(_0x16f055){_0x15bbaf[_0x2a28('0x26')][_0x2a28('0x6e')]=_0x16f055[0x0];if(!_0x2d41db['body']['UserId'])return;return db[_0x2a28('0x80')][_0x2a28('0x54')]({'where':{'id':_0x2d41db[_0x2a28('0x56')][_0x2a28('0x5d')],'role':'agent'},'attributes':['id',_0x2a28('0x36'),'fullname',_0x2a28('0x70'),_0x2a28('0x71')],'raw':!![]});}return null;})[_0x2a28('0x1f')](function(_0x1a1298){if(!_0x1a1298)return null;_0x15bbaf[_0x2a28('0x26')]['agent']=_0x1a1298;return _0x15bbaf;})[_0x2a28('0x1f')](function(_0x5f5461){if(_0x5f5461){_0x5f5461[_0x2a28('0x26')][_0x2a28('0x73')]=util['format'](_0x2a28('0x74'),_0x2d41db[_0x2a28('0x5e')][_0x2a28('0x36')]);_0x5f5461['message'][_0x2a28('0x75')]=_0x15bbaf['channel'];_0x5f5461[_0x2a28('0x26')][_0x2a28('0x76')]=_0x15bbaf[_0x2a28('0x75')];_0x5f5461['message'][_0x2a28('0x77')]='reject';respondWithRpcPromise(_0x2a28('0x78'),_0x2a28('0x78'),{'event':_0x2a28('0x81'),'message':_0x5f5461['message']},client9002);return _0x15bbaf;}return null;})[_0x2a28('0x1f')](respondWithResult(_0x44dfc9,null))[_0x2a28('0x28')](handleError(_0x44dfc9,null));};exports[_0x2a28('0x2a')]=function(_0x161841,_0x340385,_0x4888bf){if(_0x161841[_0x2a28('0x56')]['id']){delete _0x161841[_0x2a28('0x56')]['id'];}var _0x42cedc;return db[_0x2a28('0x3a')][_0x2a28('0x54')]({'where':{'id':_0x161841[_0x2a28('0x53')]['id']}})[_0x2a28('0x1f')](handleEntityNotFound(_0x340385,null))[_0x2a28('0x1f')](function(_0x787e26){if(_0x787e26){_0x42cedc=_0x787e26;return db[_0x2a28('0x82')][_0x2a28('0x54')]({'where':{'id':_0x787e26['SmsAccountId']}});}})[_0x2a28('0x1f')](handleEntityNotFound(_0x340385,null))['then'](function(_0x411b6a){if(_0x411b6a){logger[_0x2a28('0x21')](_0x2a28('0x83'),'status','received\x20delivery\x20report\x20from',_0x411b6a[_0x2a28('0x4d')],util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));switch(_0x411b6a[_0x2a28('0x4d')]){case _0x2a28('0x84'):if(_0x161841[_0x2a28('0x56')]['MessageSid']&&_0x161841[_0x2a28('0x56')][_0x2a28('0x85')]===_0x42cedc[_0x2a28('0x86')]){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger[_0x2a28('0x24')](_0x2a28('0x87'),_0x2a28('0x2a'),'twilio',util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x161841[_0x2a28('0x56')][_0x2a28('0x88')]&&_0x161841[_0x2a28('0x56')][_0x2a28('0x88')]===_0x42cedc[_0x2a28('0x86')]&&_['indexOf']([_0x2a28('0x89'),_0x2a28('0x8a')],_0x161841[_0x2a28('0x56')]['Status'])>=0x0){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a28('0x2a'),'plivio',util[_0x2a28('0x8b')](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;case _0x2a28('0x8c'):var _0x979d70=_0x161841['body']['results'][0x0];if(_0x979d70[_0x2a28('0x2a')]['groupName']==='DELIVERED'){return _0x42cedc[_0x2a28('0x33')]({'read':!![]});}else{logger[_0x2a28('0x24')](_0x2a28('0x87'),_0x2a28('0x2a'),'infobip',util['inspect'](_0x161841[_0x2a28('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x42cedc;}})[_0x2a28('0x1f')](respondWithResult(_0x340385,null))['catch'](handleError(_0x340385,null));}; \ No newline at end of file +var _0x0a48=['MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','map','type','key','model','query','keys','intersection','fields','length','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','rawAttributes','create','body','find','params','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','EventManager','reject','sms','null','RejectMessage','ContactId','sequelize','Sequelize','motionChannel','channel','event','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo'];(function(_0x5a08b3,_0x411f06){var _0x5b9283=function(_0x4dd789){while(--_0x4dd789){_0x5a08b3['push'](_0x5a08b3['shift']());}};_0x5b9283(++_0x411f06);}(_0x0a48,0x95));var _0x80a4=function(_0x34eb20,_0x276d5a){_0x34eb20=_0x34eb20-0x0;var _0x42e34a=_0x0a48[_0x34eb20];return _0x42e34a;};'use strict';var emlformat=require(_0x80a4('0x0'));var rimraf=require(_0x80a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80a4('0x2'));var rp=require(_0x80a4('0x3'));var moment=require(_0x80a4('0x4'));var BPromise=require(_0x80a4('0x5'));var Mustache=require(_0x80a4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x80a4('0x7'));var csv=require(_0x80a4('0x8'));var ejs=require(_0x80a4('0x9'));var fs=require('fs');var fs_extra=require(_0x80a4('0xa'));var _=require('lodash');var squel=require(_0x80a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x80a4('0xc'));var deskjs=require(_0x80a4('0xd'));var toCsv=require(_0x80a4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80a4('0xe'));var authService=require(_0x80a4('0xf'));var qs=require(_0x80a4('0x10'));var as=require(_0x80a4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80a4('0x12'))('api');var utils=require(_0x80a4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x80a4('0x14'));var db=require(_0x80a4('0x15'))['db'];config['redis']=_[_0x80a4('0x16')](config[_0x80a4('0x17')],{'host':_0x80a4('0x18'),'port':0x18eb});var socket=require(_0x80a4('0x19'))(new Redis(config[_0x80a4('0x17')]));require(_0x80a4('0x1a'))[_0x80a4('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x80a4('0x1c')]({'port':0x232c});var client9002=jayson[_0x80a4('0x1d')][_0x80a4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x24485a,_0x55923c,_0x125654,_0x46aeab){return new BPromise(function(_0x38ba44,_0x3c19ea){var _0x3a4df7=_0x46aeab||client;return _0x3a4df7[_0x80a4('0x1e')](_0x24485a,_0x125654)[_0x80a4('0x1f')](function(_0x239e9e){logger[_0x80a4('0x20')](_0x80a4('0x21'),_0x55923c,_0x80a4('0x22'));logger[_0x80a4('0x23')](_0x80a4('0x24'),_0x55923c,_0x80a4('0x22'),JSON[_0x80a4('0x25')](_0x239e9e));if(_0x239e9e['error']){if(_0x239e9e[_0x80a4('0x26')][_0x80a4('0x27')]===0x1f4){logger['error'](_0x80a4('0x21'),_0x55923c,_0x239e9e[_0x80a4('0x26')]['message']);return _0x3c19ea(_0x239e9e[_0x80a4('0x26')]['message']);}logger[_0x80a4('0x26')](_0x80a4('0x21'),_0x55923c,_0x239e9e[_0x80a4('0x26')][_0x80a4('0x28')]);return _0x38ba44(_0x239e9e[_0x80a4('0x26')][_0x80a4('0x28')]);}else{logger[_0x80a4('0x20')](_0x80a4('0x21'),_0x55923c,'request\x20sent');_0x38ba44(_0x239e9e[_0x80a4('0x29')][_0x80a4('0x28')]);}})[_0x80a4('0x2a')](function(_0x5a41b6){logger['error'](_0x80a4('0x21'),_0x55923c,_0x5a41b6);_0x3c19ea(_0x5a41b6);});});}function respondWithStatusCode(_0x2d1752,_0x4d4113){_0x4d4113=_0x4d4113||0xcc;return function(_0x31865b){if(_0x31865b){return _0x2d1752[_0x80a4('0x2b')](_0x4d4113);}return _0x2d1752[_0x80a4('0x2c')](_0x4d4113)[_0x80a4('0x2d')]();};}function respondWithResult(_0x3954f0,_0x472668){_0x472668=_0x472668||0xc8;return function(_0x1b0834){if(_0x1b0834){return _0x3954f0['status'](_0x472668)[_0x80a4('0x2e')](_0x1b0834);}};}function respondWithFilteredResult(_0x458c4c,_0x1b3c1e){return function(_0xe2c292){if(_0xe2c292){var _0x27ab9b=typeof _0x1b3c1e[_0x80a4('0x2f')]===_0x80a4('0x30')&&typeof _0x1b3c1e[_0x80a4('0x31')]===_0x80a4('0x30');var _0x23822f=_0xe2c292[_0x80a4('0x32')];var _0x173ff4=_0x27ab9b?0x0:_0x1b3c1e[_0x80a4('0x2f')];var _0x5894b9=_0x27ab9b?_0xe2c292['count']:_0x1b3c1e['offset']+_0x1b3c1e[_0x80a4('0x31')];var _0x32291e;if(_0x5894b9>=_0x23822f){_0x5894b9=_0x23822f;_0x32291e=0xc8;}else{_0x32291e=0xce;}_0x458c4c[_0x80a4('0x2c')](_0x32291e);return _0x458c4c[_0x80a4('0x33')](_0x80a4('0x34'),_0x173ff4+'-'+_0x5894b9+'/'+_0x23822f)[_0x80a4('0x2e')](_0xe2c292);}return null;};}function patchUpdates(_0x1701ad){return function(_0x45db37){try{jsonpatch[_0x80a4('0x35')](_0x45db37,_0x1701ad,!![]);}catch(_0x2a76f5){return BPromise['reject'](_0x2a76f5);}return _0x45db37[_0x80a4('0x36')]();};}function saveUpdates(_0x5f0cdf,_0xc26e11){return function(_0x4b1806){if(_0x4b1806){return _0x4b1806[_0x80a4('0x37')](_0x5f0cdf)[_0x80a4('0x1f')](function(_0x190a1e){return _0x190a1e;});}return null;};}function removeEntity(_0x155358,_0x1fc0fa){return function(_0x14abae){if(_0x14abae){return _0x14abae[_0x80a4('0x38')]()['then'](function(){_0x155358[_0x80a4('0x2c')](0xcc)[_0x80a4('0x2d')]();});}};}function handleEntityNotFound(_0x2d3b26,_0x3b1e03){return function(_0x3d0506){if(!_0x3d0506){_0x2d3b26[_0x80a4('0x2b')](0x194);}return _0x3d0506;};}function handleError(_0x3143f1,_0x150e3c){_0x150e3c=_0x150e3c||0x1f4;return function(_0x3ccc55){logger[_0x80a4('0x26')](_0x3ccc55[_0x80a4('0x39')]);if(_0x3ccc55[_0x80a4('0x3a')]){delete _0x3ccc55[_0x80a4('0x3a')];}_0x3143f1['status'](_0x150e3c)['send'](_0x3ccc55);};}exports['index']=function(_0x5531c9,_0x254d66){var _0x7c34c3={},_0x54a34d={},_0x4daf04={'count':0x0,'rows':[]};var _0x32cdfc=_[_0x80a4('0x3b')](db['SmsMessage']['rawAttributes'],function(_0xc5215){return{'name':_0xc5215['fieldName'],'type':_0xc5215[_0x80a4('0x3c')][_0x80a4('0x3d')]};});_0x54a34d[_0x80a4('0x3e')]=_[_0x80a4('0x3b')](_0x32cdfc,_0x80a4('0x3a'));_0x54a34d[_0x80a4('0x3f')]=_[_0x80a4('0x40')](_0x5531c9[_0x80a4('0x3f')]);_0x54a34d['filters']=_['intersection'](_0x54a34d['model'],_0x54a34d[_0x80a4('0x3f')]);_0x7c34c3['attributes']=_[_0x80a4('0x41')](_0x54a34d['model'],qs['fields'](_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x42')]));_0x7c34c3['attributes']=_0x7c34c3['attributes'][_0x80a4('0x43')]?_0x7c34c3[_0x80a4('0x44')]:_0x54a34d['model'];if(!_0x5531c9[_0x80a4('0x3f')]['hasOwnProperty'](_0x80a4('0x45'))){_0x7c34c3[_0x80a4('0x31')]=qs[_0x80a4('0x31')](_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x31')]);_0x7c34c3[_0x80a4('0x2f')]=qs[_0x80a4('0x2f')](_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x2f')]);}_0x7c34c3['order']=qs[_0x80a4('0x46')](_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x46')]);_0x7c34c3[_0x80a4('0x47')]=qs[_0x80a4('0x48')](_[_0x80a4('0x49')](_0x5531c9['query'],_0x54a34d['filters']),_0x32cdfc);if(_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x4a')]){_0x7c34c3[_0x80a4('0x47')]=_[_0x80a4('0x4b')](_0x7c34c3[_0x80a4('0x47')],{'$or':_[_0x80a4('0x3b')](_0x32cdfc,function(_0x5180f0){if(_0x5180f0[_0x80a4('0x3c')]!==_0x80a4('0x4c')){var _0x220974={};_0x220974[_0x5180f0[_0x80a4('0x3a')]]={'$like':'%'+_0x5531c9['query'][_0x80a4('0x4a')]+'%'};return _0x220974;}})});}_0x7c34c3=_['merge']({},_0x7c34c3,_0x5531c9[_0x80a4('0x4d')]);var _0xc08950={'where':_0x7c34c3[_0x80a4('0x47')]};return db[_0x80a4('0x4e')][_0x80a4('0x32')](_0xc08950)[_0x80a4('0x1f')](function(_0x45d562){_0x4daf04[_0x80a4('0x32')]=_0x45d562;if(_0x5531c9[_0x80a4('0x3f')][_0x80a4('0x4f')]){_0x7c34c3[_0x80a4('0x50')]=[{'all':!![]}];}return db[_0x80a4('0x4e')][_0x80a4('0x51')](_0x7c34c3);})[_0x80a4('0x1f')](function(_0x50ad9f){_0x4daf04[_0x80a4('0x52')]=_0x50ad9f;return _0x4daf04;})[_0x80a4('0x1f')](respondWithFilteredResult(_0x254d66,_0x7c34c3))[_0x80a4('0x2a')](handleError(_0x254d66,null));};exports[_0x80a4('0x53')]=function(_0x3a4b83,_0x1e0dad){var _0x1761aa={'raw':!![],'where':{'id':_0x3a4b83['params']['id']}},_0x6238eb={};_0x6238eb[_0x80a4('0x3e')]=_[_0x80a4('0x40')](db[_0x80a4('0x4e')][_0x80a4('0x54')]);_0x6238eb[_0x80a4('0x3f')]=_[_0x80a4('0x40')](_0x3a4b83['query']);_0x6238eb[_0x80a4('0x48')]=_[_0x80a4('0x41')](_0x6238eb[_0x80a4('0x3e')],_0x6238eb[_0x80a4('0x3f')]);_0x1761aa['attributes']=_[_0x80a4('0x41')](_0x6238eb[_0x80a4('0x3e')],qs[_0x80a4('0x42')](_0x3a4b83[_0x80a4('0x3f')]['fields']));_0x1761aa[_0x80a4('0x44')]=_0x1761aa[_0x80a4('0x44')][_0x80a4('0x43')]?_0x1761aa[_0x80a4('0x44')]:_0x6238eb['model'];if(_0x3a4b83[_0x80a4('0x3f')][_0x80a4('0x4f')]){_0x1761aa['include']=[{'all':!![]}];}_0x1761aa=_[_0x80a4('0x4b')]({},_0x1761aa,_0x3a4b83['options']);return db[_0x80a4('0x4e')]['find'](_0x1761aa)[_0x80a4('0x1f')](handleEntityNotFound(_0x1e0dad,null))[_0x80a4('0x1f')](respondWithResult(_0x1e0dad,null))[_0x80a4('0x2a')](handleError(_0x1e0dad,null));};exports[_0x80a4('0x55')]=function(_0x583863,_0x3a3fc6){return db[_0x80a4('0x4e')][_0x80a4('0x55')](_0x583863['body'],{})[_0x80a4('0x1f')](respondWithResult(_0x3a3fc6,0xc9))[_0x80a4('0x2a')](handleError(_0x3a3fc6,null));};exports[_0x80a4('0x37')]=function(_0x3997be,_0x3c3674){if(_0x3997be[_0x80a4('0x56')]['id']){delete _0x3997be[_0x80a4('0x56')]['id'];}return db['SmsMessage'][_0x80a4('0x57')]({'where':{'id':_0x3997be['params']['id']}})[_0x80a4('0x1f')](handleEntityNotFound(_0x3c3674,null))[_0x80a4('0x1f')](saveUpdates(_0x3997be[_0x80a4('0x56')],null))[_0x80a4('0x1f')](respondWithResult(_0x3c3674,null))[_0x80a4('0x2a')](handleError(_0x3c3674,null));};exports[_0x80a4('0x38')]=function(_0x308d3a,_0x2d9484){return db['SmsMessage'][_0x80a4('0x57')]({'where':{'id':_0x308d3a[_0x80a4('0x58')]['id']}})[_0x80a4('0x1f')](handleEntityNotFound(_0x2d9484,null))['then'](removeEntity(_0x2d9484,null))[_0x80a4('0x2a')](handleError(_0x2d9484,null));};exports[_0x80a4('0x59')]=function(_0x2c5cbf,_0x5ebbdb){return db[_0x80a4('0x4e')][_0x80a4('0x59')]()['then'](respondWithResult(_0x5ebbdb,null))[_0x80a4('0x2a')](handleError(_0x5ebbdb,null));};var interaction_log=require(_0x80a4('0x12'))(_0x80a4('0x5a'));exports[_0x80a4('0x5b')]=function(_0x3fba04,_0x347a9b,_0x4c4908){var _0x649fd9={'agent':{},'channel':'sms'};if(_0x3fba04[_0x80a4('0x56')]['id']){delete _0x3fba04[_0x80a4('0x56')]['id'];}_0x3fba04[_0x80a4('0x56')][_0x80a4('0x5c')]=!![];_0x3fba04[_0x80a4('0x56')][_0x80a4('0x5d')]=moment()[_0x80a4('0x5e')](_0x80a4('0x5f'));_0x3fba04[_0x80a4('0x56')][_0x80a4('0x60')]=_0x3fba04[_0x80a4('0x56')]['UserId']||_0x3fba04[_0x80a4('0x61')]['id'];_0x649fd9[_0x80a4('0x62')]['id']=_0x3fba04[_0x80a4('0x56')][_0x80a4('0x60')];return db['SmsMessage'][_0x80a4('0x57')]({'where':{'id':_0x3fba04[_0x80a4('0x58')]['id'],'UserId':null}})[_0x80a4('0x1f')](handleEntityNotFound(_0x347a9b,null))[_0x80a4('0x1f')](saveUpdates(_0x3fba04[_0x80a4('0x56')],null))[_0x80a4('0x1f')](function(_0x3023df){if(_0x3023df){_0x649fd9[_0x80a4('0x28')]=_0x3023df[_0x80a4('0x63')]({'plain':!![]});return db[_0x80a4('0x64')][_0x80a4('0x57')]({'where':{'id':_0x3023df[_0x80a4('0x65')]}});}return null;})[_0x80a4('0x1f')](handleEntityNotFound(_0x347a9b,null))['then'](function(_0x51ef91){if(_0x51ef91){return _0x51ef91[_0x80a4('0x37')]({'UserId':_0x3fba04[_0x80a4('0x56')][_0x80a4('0x60')],'read1stAt':_['isNil'](_0x51ef91[_0x80a4('0x66')])?moment()[_0x80a4('0x5e')](_0x80a4('0x5f')):undefined});}return null;})[_0x80a4('0x1f')](function(_0x15fee7){if(_0x15fee7){_0x649fd9[_0x80a4('0x67')]=_0x15fee7['get']({'plain':!![]});interaction_log[_0x80a4('0x20')](_0x80a4('0x68'),_0x3fba04[_0x80a4('0x61')]['id'],_0x3fba04['user']['name'],_0x3fba04['user'][_0x80a4('0x69')],_0x649fd9[_0x80a4('0x67')]['id'],_0x3fba04['body']?JSON[_0x80a4('0x25')](_0x3fba04[_0x80a4('0x56')]):'null');return respondWithRpcPromise(_0x80a4('0x6a'),'acceptMessage',_0x649fd9);}return null;})[_0x80a4('0x1f')](function(_0x3cc52b){var _0x5dddfd=_0x80a4('0x6b')+_0x3cc52b['message']['ContactId'];return db['sequelize'][_0x80a4('0x3f')](_0x5dddfd,{'type':db['Sequelize'][_0x80a4('0x6c')][_0x80a4('0x6d')],'raw':!![]})['then'](function(_0x334800){return _0x334800;});})[_0x80a4('0x1f')](function(_0x29cac2){if(_0x29cac2){_0x649fd9[_0x80a4('0x28')][_0x80a4('0x6e')]=_0x29cac2[0x0];if(!_0x3fba04[_0x80a4('0x56')]['UserId'])return;return db['User'][_0x80a4('0x57')]({'where':{'id':_0x3fba04[_0x80a4('0x56')][_0x80a4('0x60')],'role':'agent'},'attributes':['id','name',_0x80a4('0x6f'),_0x80a4('0x70'),_0x80a4('0x71')],'raw':!![]});}return null;})[_0x80a4('0x1f')](function(_0x941549){if(!_0x941549)return null;_0x649fd9[_0x80a4('0x28')]['agent']=_0x941549;return _0x649fd9;})[_0x80a4('0x1f')](function(_0x161093){if(_0x161093){if(_0x3fba04[_0x80a4('0x56')]['manual']){_0x649fd9['message'][_0x80a4('0x72')]=util['format'](_0x80a4('0x73'),_0x3fba04[_0x80a4('0x61')][_0x80a4('0x3a')]);_0x649fd9[_0x80a4('0x28')]['channel']=_0x649fd9['channel'];_0x649fd9[_0x80a4('0x28')]['motionChannel']=_0x649fd9['channel'];_0x649fd9['message']['event']='accept';return respondWithRpcPromise(_0x80a4('0x74'),_0x80a4('0x74'),{'event':'acceptmessage','message':_0x649fd9[_0x80a4('0x28')]},client9002)[_0x80a4('0x1f')](function(){return _0x649fd9;});}return _0x649fd9;}return null;})[_0x80a4('0x1f')](respondWithResult(_0x347a9b,null))['catch'](handleError(_0x347a9b,null));};var interaction_log=require(_0x80a4('0x12'))(_0x80a4('0x5a'));exports[_0x80a4('0x75')]=function(_0x3858e7,_0x58e042,_0x85c755){var _0x1e4c85={'agent':{},'channel':_0x80a4('0x76')};if(_0x3858e7[_0x80a4('0x56')]['id']){delete _0x3858e7[_0x80a4('0x56')]['id'];}_0x3858e7[_0x80a4('0x56')][_0x80a4('0x60')]=_0x3858e7['body'][_0x80a4('0x60')]||_0x3858e7['user']['id'];_0x1e4c85[_0x80a4('0x62')]['id']=_0x3858e7[_0x80a4('0x56')][_0x80a4('0x60')];return db[_0x80a4('0x4e')]['find']({'where':{'id':_0x3858e7[_0x80a4('0x58')]['id'],'UserId':null}})[_0x80a4('0x1f')](handleEntityNotFound(_0x58e042,null))[_0x80a4('0x1f')](function(_0x3ba5e2){if(_0x3ba5e2){_0x1e4c85['message']=_0x3ba5e2[_0x80a4('0x63')]({'plain':!![]});return db[_0x80a4('0x64')][_0x80a4('0x57')]({'where':{'id':_0x3ba5e2[_0x80a4('0x65')]}});}return null;})[_0x80a4('0x1f')](handleEntityNotFound(_0x58e042,null))[_0x80a4('0x1f')](function(_0x3af843){if(_0x3af843){_0x1e4c85[_0x80a4('0x67')]=_0x3af843[_0x80a4('0x63')]({'plain':!![]});interaction_log[_0x80a4('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3858e7['user']['id'],_0x3858e7['user'][_0x80a4('0x3a')],_0x3858e7['user'][_0x80a4('0x69')],_0x1e4c85[_0x80a4('0x67')]['id'],_0x3858e7[_0x80a4('0x56')]?JSON[_0x80a4('0x25')](_0x3858e7[_0x80a4('0x56')]):_0x80a4('0x77'));return respondWithRpcPromise(_0x80a4('0x78'),'rejectMessage',_0x1e4c85);}return null;})[_0x80a4('0x1f')](function(_0x1d6cae){var _0x13f425=_0x80a4('0x6b')+_0x1d6cae[_0x80a4('0x28')][_0x80a4('0x79')];return db[_0x80a4('0x7a')]['query'](_0x13f425,{'type':db[_0x80a4('0x7b')][_0x80a4('0x6c')][_0x80a4('0x6d')],'raw':!![]})[_0x80a4('0x1f')](function(_0x2ec093){return _0x2ec093;});})[_0x80a4('0x1f')](function(_0x118f67){if(_0x118f67){_0x1e4c85[_0x80a4('0x28')]['contact']=_0x118f67[0x0];if(!_0x3858e7[_0x80a4('0x56')][_0x80a4('0x60')])return;return db['User'][_0x80a4('0x57')]({'where':{'id':_0x3858e7[_0x80a4('0x56')][_0x80a4('0x60')],'role':_0x80a4('0x62')},'attributes':['id',_0x80a4('0x3a'),_0x80a4('0x6f'),_0x80a4('0x70'),_0x80a4('0x71')],'raw':!![]});}return null;})[_0x80a4('0x1f')](function(_0x12ec84){if(!_0x12ec84)return null;_0x1e4c85[_0x80a4('0x28')][_0x80a4('0x62')]=_0x12ec84;return _0x1e4c85;})[_0x80a4('0x1f')](function(_0x2728bd){if(_0x2728bd){_0x2728bd[_0x80a4('0x28')][_0x80a4('0x72')]=util[_0x80a4('0x5e')](_0x80a4('0x73'),_0x3858e7[_0x80a4('0x61')][_0x80a4('0x3a')]);_0x2728bd['message']['channel']=_0x1e4c85['channel'];_0x2728bd['message'][_0x80a4('0x7c')]=_0x1e4c85[_0x80a4('0x7d')];_0x2728bd[_0x80a4('0x28')][_0x80a4('0x7e')]=_0x80a4('0x75');respondWithRpcPromise(_0x80a4('0x74'),'EventManager',{'event':'rejectmessage','message':_0x2728bd['message']},client9002);return _0x1e4c85;}return null;})[_0x80a4('0x1f')](respondWithResult(_0x58e042,null))['catch'](handleError(_0x58e042,null));};exports[_0x80a4('0x2c')]=function(_0xbdc39b,_0x679417,_0x465602){if(_0xbdc39b[_0x80a4('0x56')]['id']){delete _0xbdc39b[_0x80a4('0x56')]['id'];}var _0x53cf9f;return db[_0x80a4('0x4e')][_0x80a4('0x57')]({'where':{'id':_0xbdc39b[_0x80a4('0x58')]['id']}})['then'](handleEntityNotFound(_0x679417,null))[_0x80a4('0x1f')](function(_0x44a1b7){if(_0x44a1b7){_0x53cf9f=_0x44a1b7;return db['SmsAccount']['find']({'where':{'id':_0x44a1b7['SmsAccountId']}});}})[_0x80a4('0x1f')](handleEntityNotFound(_0x679417,null))[_0x80a4('0x1f')](function(_0x1a19f7){if(_0x1a19f7){logger[_0x80a4('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x80a4('0x2c'),_0x80a4('0x7f'),_0x1a19f7[_0x80a4('0x3c')],util['inspect'](_0xbdc39b[_0x80a4('0x56')],{'showHidden':![],'depth':null}));switch(_0x1a19f7[_0x80a4('0x3c')]){case'twilio':if(_0xbdc39b[_0x80a4('0x56')][_0x80a4('0x80')]&&_0xbdc39b[_0x80a4('0x56')]['MessageSid']===_0x53cf9f[_0x80a4('0x81')]){return _0x53cf9f[_0x80a4('0x37')]({'read':!![]});}else{logger[_0x80a4('0x26')](_0x80a4('0x82'),_0x80a4('0x2c'),_0x80a4('0x83'),util['inspect'](_0xbdc39b[_0x80a4('0x56')],{'showHidden':![],'depth':null}));}break;case _0x80a4('0x84'):if(_0xbdc39b[_0x80a4('0x56')][_0x80a4('0x85')]&&_0xbdc39b['body'][_0x80a4('0x85')]===_0x53cf9f[_0x80a4('0x81')]&&_[_0x80a4('0x86')]([_0x80a4('0x87'),_0x80a4('0x88')],_0xbdc39b[_0x80a4('0x56')][_0x80a4('0x89')])>=0x0){return _0x53cf9f[_0x80a4('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x80a4('0x2c'),_0x80a4('0x8a'),util['inspect'](_0xbdc39b['body'],{'showHidden':![],'depth':null}));}break;case _0x80a4('0x8b'):var _0x3859aa=_0xbdc39b[_0x80a4('0x56')]['results'][0x0];if(_0x3859aa[_0x80a4('0x2c')]['groupName']===_0x80a4('0x8c')){return _0x53cf9f[_0x80a4('0x37')]({'read':!![]});}else{logger['error'](_0x80a4('0x82'),_0x80a4('0x2c'),_0x80a4('0x8b'),util['inspect'](_0xbdc39b[_0x80a4('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x53cf9f;}})[_0x80a4('0x1f')](respondWithResult(_0x679417,null))['catch'](handleError(_0x679417,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 98cdd79..f29010f 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 _0xadb6=['events','../../mysqldb','SmsMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4d6830,_0x417314){var _0x3e9a0a=function(_0x1274e1){while(--_0x1274e1){_0x4d6830['push'](_0x4d6830['shift']());}};_0x3e9a0a(++_0x417314);}(_0xadb6,0x195));var _0x6adb=function(_0xafc18a,_0x337135){_0xafc18a=_0xafc18a-0x0;var _0x54d2df=_0xadb6[_0xafc18a];return _0x54d2df;};'use strict';var EventEmitter=require(_0x6adb('0x0'));var SmsMessage=require(_0x6adb('0x1'))['db'][_0x6adb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6adb('0x3'),'afterUpdate':'update','afterDestroy':_0x6adb('0x4')};function emitEvent(_0x2a4a85){return function(_0x2c27d2,_0x4f19b6,_0x352b0e){SmsMessageEvents[_0x6adb('0x5')](_0x2a4a85+':'+_0x2c27d2['id'],_0x2c27d2);SmsMessageEvents[_0x6adb('0x5')](_0x2a4a85,_0x2c27d2);_0x352b0e(null);};}for(var e in events){if(events[_0x6adb('0x6')](e)){var event=events[e];SmsMessage[_0x6adb('0x7')](e,emitEvent(event));}}module[_0x6adb('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x097c=['setMaxListeners','save','update','remove','emit','hook','exports','events','SmsMessage'];(function(_0x5e8a48,_0x5cb9e8){var _0x4d8e56=function(_0x2f4b2b){while(--_0x2f4b2b){_0x5e8a48['push'](_0x5e8a48['shift']());}};_0x4d8e56(++_0x5cb9e8);}(_0x097c,0x103));var _0xc097=function(_0x3702fc,_0x5985fa){_0x3702fc=_0x3702fc-0x0;var _0x3df5f7=_0x097c[_0x3702fc];return _0x3df5f7;};'use strict';var EventEmitter=require(_0xc097('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xc097('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc097('0x2')](0x0);var events={'afterCreate':_0xc097('0x3'),'afterUpdate':_0xc097('0x4'),'afterDestroy':_0xc097('0x5')};function emitEvent(_0x1c03e0){return function(_0x5b7b27,_0x4bb146,_0x3df4f8){SmsMessageEvents['emit'](_0x1c03e0+':'+_0x5b7b27['id'],_0x5b7b27);SmsMessageEvents[_0xc097('0x6')](_0x1c03e0,_0x5b7b27);_0x3df4f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc097('0x7')](e,emitEvent(event));}}module[_0xc097('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d0145be..7928d20 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 _0xc7e2=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','out','find','SmsAccountId','type','twilio','accountSid','phone','authToken','create','remote','/api/sms/messages/','/status?token=','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','sms','POST','user_key','session_key','total_sent','deliveryReport','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','apiKey','text','timestamp','keys','sort','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/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x386005,_0x42b8ae){var _0x5e9626=function(_0x792625){while(--_0x792625){_0x386005['push'](_0x386005['shift']());}};_0x5e9626(++_0x42b8ae);}(_0xc7e2,0xf4));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c7e('0x0'));var util=require('util');var logger=require(_0x2c7e('0x1'))(_0x2c7e('0x2'));var moment=require(_0x2c7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c7e('0x4'));var fs=require('fs');var path=require(_0x2c7e('0x5'));var rimraf=require(_0x2c7e('0x6'));var config=require(_0x2c7e('0x7'));var attributes=require(_0x2c7e('0x8'));module[_0x2c7e('0x9')]=function(_0x4cdd62,_0x4ce1d4){return _0x4cdd62['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2c7e('0xa')]},{'name':'fti_sms_messages','fields':[_0x2c7e('0xb')],'type':_0x2c7e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x425142,_0x541708,_0x55718f){var _0x473016=_0x4cdd62[_0x2c7e('0xd')];var _0x15abd8=_0x425142[_0x2c7e('0xe')]({'plain':!![]});if(_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()==='in'||_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()==='out'&&!_0x15abd8[_0x2c7e('0x11')]&&!_[_0x2c7e('0x12')](_0x15abd8[_0x2c7e('0x13')])&&!_[_0x2c7e('0x12')](_0x15abd8[_0x2c7e('0x14')])){_0x473016['SmsInteraction'][_0x2c7e('0x15')]({'where':{'id':_0x15abd8[_0x2c7e('0x14')]}})[_0x2c7e('0x16')](function(_0x446ada){if(_0x446ada){_0x446ada[_0x2c7e('0x17')]({'lastMsgAt':_0x15abd8[_0x2c7e('0x18')],'lastMsgDirection':_0x15abd8[_0x2c7e('0xf')][_0x2c7e('0x10')]()});}})[_0x2c7e('0x19')](function(_0xb1ad9){console[_0x2c7e('0x1a')](_0xb1ad9);});}if(_0x15abd8['direction']===_0x2c7e('0x1b')&&!_0x15abd8[_0x2c7e('0x11')]){var _0x3b3c46;_0x473016['SmsAccount'][_0x2c7e('0x1c')]({'where':{'id':_0x15abd8[_0x2c7e('0x1d')]},'raw':!![]})[_0x2c7e('0x16')](function(_0x4ea4b3){_0x3b3c46=_0x4ea4b3;if(_0x3b3c46&&_0x3b3c46[_0x2c7e('0x1e')]){switch(_0x3b3c46[_0x2c7e('0x1e')]){case _0x2c7e('0x1f'):var _0x13f9e5=require('twilio');if(_0x3b3c46[_0x2c7e('0x20')]&&_0x3b3c46['authToken']&&_0x3b3c46[_0x2c7e('0x21')]){var _0x25b97d=new _0x13f9e5(_0x3b3c46[_0x2c7e('0x20')],_0x3b3c46[_0x2c7e('0x22')]);_0x25b97d['messages'][_0x2c7e('0x23')]({'body':_0x15abd8['body'],'to':_0x15abd8[_0x2c7e('0x21')],'from':_0x3b3c46[_0x2c7e('0x21')],'statusCallback':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46['token']})[_0x2c7e('0x16')](function(_0x3ea068){if(_0x3ea068[_0x2c7e('0x27')]){return _0x425142[_0x2c7e('0x17')]({'messageId':_0x3ea068[_0x2c7e('0x27')]});}})['catch'](function(_0x20b3f3){logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x1f'),util['inspect'](_0x20b3f3,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'twilio',_0x2c7e('0x2a'));}break;case _0x2c7e('0x2b'):var _0x1a2918=_0x2c7e('0x2c');if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46['password']){var _0x15c51c={'recipient':[_0x15abd8[_0x2c7e('0x21')]],'message':_0x15abd8[_0x2c7e('0xb')],'message_type':_0x3b3c46[_0x2c7e('0x2e')]};if(_0x3b3c46['smsMethod']&&_0x3b3c46[_0x2c7e('0x2e')]!=='SI'){_0x15c51c[_0x2c7e('0x2f')]=_0x3b3c46[_0x2c7e('0x21')];}var _0x1f7b78={'url':_0x1a2918+_0x2c7e('0x30')+_0x3b3c46[_0x2c7e('0x2d')]+_0x2c7e('0x31')+_0x3b3c46[_0x2c7e('0x32')],'method':_0x2c7e('0x33')};rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1e6bc2){var _0x4ebde8=_0x1e6bc2['split'](';');var _0x5e742e={'user_key':_0x4ebde8[0x0],'session_key':_0x4ebde8[0x1]};_0x1f7b78={'url':_0x1a2918+_0x2c7e('0x34'),'method':_0x2c7e('0x35'),'headers':{'user_key':_0x5e742e[_0x2c7e('0x36')],'Session_key':_0x5e742e[_0x2c7e('0x37')]},'json':!![],'body':_0x15c51c};return rp(_0x1f7b78);})[_0x2c7e('0x16')](function(_0x5799c1){if(_0x5799c1[_0x2c7e('0x38')]>=0x1){var _0x5673bb={'messageId':_0x5799c1['internal_order_id']};if(_0x3b3c46[_0x2c7e('0x2e')]!=='GP'||!_0x3b3c46[_0x2c7e('0x39')]){_0x5673bb['read']=!![];}return _0x425142[_0x2c7e('0x17')](_0x5673bb);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'skebby',util[_0x2c7e('0x3a')](_0x5799c1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x442268){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x2b'),util['inspect'](_0x442268,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2c7e('0x3b'):if(_0x3b3c46[_0x2c7e('0x22')]){var _0xa9e34e={'recipient':_0x15abd8[_0x2c7e('0x21')],'message':_0x15abd8[_0x2c7e('0xb')],'sender':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')],'authorization':_0x3b3c46[_0x2c7e('0x22')]};var _0x541708={'method':'POST','uri':_0x2c7e('0x3d'),'body':_0xa9e34e,'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0xe9f108){var _0x6586e4={'messageId':_0xe9f108[_0x2c7e('0x3e')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x6586e4[_0x2c7e('0x3f')]=!![];}return _0x425142['update'](_0x6586e4);})[_0x2c7e('0x19')](function(_0x1effd6){logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'connectel',util[_0x2c7e('0x3a')](_0x1effd6,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x3b'),_0x2c7e('0x40'));}break;case'clicksend':if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){var _0xa9e34e={'messages':[{'source':'xCALLY\x20Motion','to':_0x15abd8[_0x2c7e('0x21')],'body':_0x15abd8['body'],'from':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')]}]};var _0x3a0f1e=util[_0x2c7e('0x41')](_0x2c7e('0x42'),_0x3b3c46[_0x2c7e('0x2d')],_0x3b3c46['password']);var _0x541708={'method':'POST','uri':_0x2c7e('0x43'),'body':_0xa9e34e,'headers':{'Authorization':util[_0x2c7e('0x41')](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')](_0x2c7e('0x46')))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x4493e7){if(_0x4493e7[_0x2c7e('0x47')]>=0xc8&&_0x4493e7[_0x2c7e('0x47')]<=0xce){if(_0x4493e7[_0x2c7e('0x48')]&&_0x4493e7[_0x2c7e('0x48')][_0x2c7e('0x49')]>0x0){var _0x5a4dbd=_[_0x2c7e('0x4a')](_0x4493e7[_0x2c7e('0x48')][_0x2c7e('0x4b')]);var _0x3abe58={'messageId':_0x5a4dbd[_0x2c7e('0x4c')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x3abe58[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x3abe58);}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x4493e7,{'showHidden':![],'depth':null}));}}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x4493e7,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x5b1c90){logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x4d'),util[_0x2c7e('0x3a')](_0x5b1c90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),'clickSend',_0x2c7e('0x4e'));}break;case'plivo':if(_0x3b3c46[_0x2c7e('0x4f')]&&_0x3b3c46[_0x2c7e('0x22')]){var _0xa9e34e={'dst':_0x15abd8['phone'],'text':_0x15abd8[_0x2c7e('0xb')],'src':_0x3b3c46[_0x2c7e('0x3c')]||_0x3b3c46[_0x2c7e('0x21')],'url':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46['token']};var _0x3a0f1e=util['format'](_0x2c7e('0x42'),_0x3b3c46['authId'],_0x3b3c46[_0x2c7e('0x22')]);var _0x541708={'method':_0x2c7e('0x35'),'uri':util[_0x2c7e('0x41')](_0x2c7e('0x50'),_0x3b3c46['authId']),'body':_0xa9e34e,'headers':{'Authorization':util['format'](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')](_0x2c7e('0x46')))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x197a09){var _0xd563a7={'messageId':_0x197a09[_0x2c7e('0x51')][0x0]};return _0x425142[_0x2c7e('0x17')](_0xd563a7);})[_0x2c7e('0x19')](function(_0x5dc06d){logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x52'),util['inspect'](_0x5dc06d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x52'),_0x2c7e('0x53'));}break;case _0x2c7e('0x54'):if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){if(_0x3b3c46[_0x2c7e('0x55')]){var _0x2b8746={'method':_0x2c7e('0x35'),'uri':_0x3b3c46[_0x2c7e('0x55')]+_0x2c7e('0x56'),'body':{'username':_0x3b3c46['username'],'password':_0x3b3c46[_0x2c7e('0x32')]},'json':!![]};return rp(_0x2b8746)[_0x2c7e('0x16')](function(_0x3a9e5d){var _0x1fa157={'method':_0x2c7e('0x35'),'uri':_0x3b3c46[_0x2c7e('0x55')]+_0x2c7e('0x57'),'body':{'messages':[{'from':_0x3b3c46['phone'],'destinations':[{'to':_0x15abd8[_0x2c7e('0x21')]}],'text':_0x15abd8[_0x2c7e('0xb')],'notifyUrl':_0x3b3c46[_0x2c7e('0x24')]+_0x2c7e('0x25')+_0x15abd8['id']+_0x2c7e('0x26')+_0x3b3c46[_0x2c7e('0x58')],'notifyContentType':_0x2c7e('0x59'),'callbackData':_0x3b3c46['phone']+';'+_0x15abd8[_0x2c7e('0xb')]}]},'headers':{'Authorization':_0x2c7e('0x5a')+_0x3a9e5d[_0x2c7e('0x58')]},'json':!![]};return rp(_0x1fa157)[_0x2c7e('0x16')](function(_0x234a39){if(_0x234a39[_0x2c7e('0x4b')]){var _0x49bba9={'messageId':_0x234a39['messages'][0x0][_0x2c7e('0xa')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x49bba9[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x49bba9);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x54'),util[_0x2c7e('0x3a')](_0x234a39,{'showHidden':![],'depth':null}));}});})[_0x2c7e('0x19')](function(_0xd66b37){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x54'),util[_0x2c7e('0x3a')](_0xd66b37,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c7e('0x54'),_0x2c7e('0x4e'));}break;case'csc':var _0x5bc3ef=require('crypto');if(_0x3b3c46[_0x2c7e('0x5b')]){var _0x2b7ef0={};_0x2b7ef0['login']=_0x3b3c46[_0x2c7e('0x2d')];_0x2b7ef0[_0x2c7e('0x21')]=_0x15abd8[_0x2c7e('0x21')];_0x2b7ef0['sender']=_0x3b3c46[_0x2c7e('0x21')];_0x2b7ef0[_0x2c7e('0x5c')]=_0x15abd8[_0x2c7e('0xb')];_0x2b7ef0[_0x2c7e('0x5d')]=+new Date();var _0x7b07ef='';var _0x26ec1e='';var _0x1fd5ba=Object[_0x2c7e('0x5e')](_0x2b7ef0);_0x1fd5ba[_0x2c7e('0x5f')]();for(var _0x4c576b=0x0;_0x4c576b<_0x1fd5ba['length'];_0x4c576b++){if(_0x7b07ef!=''){_0x7b07ef+='&';}_0x7b07ef+=_0x1fd5ba[_0x4c576b]+'='+encodeURIComponent(_0x2b7ef0[_0x1fd5ba[_0x4c576b]]);_0x26ec1e+=_0x2b7ef0[_0x1fd5ba[_0x4c576b]];}_0x26ec1e+=_0x3b3c46['apiKey'];_0x26ec1e=_0x5bc3ef[_0x2c7e('0x60')](_0x2c7e('0x61'))[_0x2c7e('0x17')](_0x26ec1e)[_0x2c7e('0x62')](_0x2c7e('0x63'));if(_0x7b07ef!==''){_0x7b07ef+='&';}_0x7b07ef+=_0x2c7e('0x64')+_0x26ec1e;var _0x1f7b78={'method':_0x2c7e('0x33'),'uri':_0x3b3c46['baseUrl']+_0x2c7e('0x65')+_0x7b07ef,'json':!![]};return rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1c6589){var _0x2ced4f=Object[_0x2c7e('0x5e')](_0x1c6589);if(_0x1c6589[_0x2ced4f[0x0]][_0x2c7e('0x1a')]&&parseInt(_0x1c6589[_0x2ced4f[0x0]][_0x2c7e('0x1a')])===0x0){var _0x1db1a9={'messageId':_0x1c6589[_0x2ced4f[0x0]]['id_sms']};if(!_0x3b3c46['deliveryReport']){_0x1db1a9[_0x2c7e('0x3f')]=!![];}return _0x425142[_0x2c7e('0x17')](_0x1db1a9);}else{return logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),'csc',util['inspect'](_0x1c6589[_0x2c7e('0x1a')],{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x3bdc5e){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x66'),util[_0x2c7e('0x3a')](_0x3bdc5e,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate',_0x2c7e('0x66'),_0x2c7e('0x67'));}break;case _0x2c7e('0x68'):if(_0x3b3c46['apiKey']){var _0x53541c={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x69'),'headers':{'Authorization':_0x3b3c46['apiKey']},'body':{'content':_0x15abd8[_0x2c7e('0xb')],'to':[_0x15abd8['phone']],'from':_0x3b3c46['phone'],'binary':![],'clientMessageId':_0x2c7e('0x6a'),'charset':_0x2c7e('0x6b')},'json':!![]};rp(_0x53541c)[_0x2c7e('0x16')](function(_0xf1d3ec){if(!_0xf1d3ec[_0x2c7e('0x1a')]){var _0x44465c={'messageId':_0xf1d3ec[_0x2c7e('0x4b')][0x0][_0x2c7e('0x6c')]};if(!_0x3b3c46[_0x2c7e('0x39')]){_0x44465c['read']=!![];}return _0x425142[_0x2c7e('0x17')](_0x44465c);}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),util[_0x2c7e('0x3a')](_0xf1d3ec[_0x2c7e('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x565aa5){return logger['error'](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),util[_0x2c7e('0x3a')](_0x565aa5,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x68'),_0x2c7e('0x67'));}break;case _0x2c7e('0x6d'):if(_0x3b3c46[_0x2c7e('0x2d')]&&_0x3b3c46[_0x2c7e('0x32')]){var _0x3a0f1e=util[_0x2c7e('0x41')](_0x2c7e('0x42'),_0x3b3c46[_0x2c7e('0x2d')],_0x3b3c46[_0x2c7e('0x32')]);var _0x541708={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x6e')+_0x3b3c46['accountId']+_0x2c7e('0x6f'),'body':{'to':[_0x15abd8[_0x2c7e('0x21')]],'text':_0x15abd8[_0x2c7e('0xb')],'from':_0x3b3c46['phone'],'applicationId':_0x3b3c46[_0x2c7e('0x70')]},'headers':{'Authorization':util[_0x2c7e('0x41')](_0x2c7e('0x44'),new Buffer(_0x3a0f1e)[_0x2c7e('0x45')]('base64'))},'json':!![]};rp(_0x541708)[_0x2c7e('0x16')](function(_0x58574b){if(_0x58574b['id']){var _0x1d936f={'messageId':_0x58574b['id']};return _0x425142[_0x2c7e('0x17')](_0x1d936f);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x6d'),util['inspect'](_0x58574b,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x27a88f){logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7e('0x28'),_0x2c7e('0x6d'),util[_0x2c7e('0x3a')](_0x27a88f,{'showHidden':![],'depth':null}));});}else{logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),_0x2c7e('0x6d'),_0x2c7e('0x4e'));}break;case _0x2c7e('0x71'):if(_0x3b3c46['apiKey']){var _0x26c8e2={};var _0x1f7b78={'method':_0x2c7e('0x35'),'uri':_0x2c7e('0x72'),'headers':{'Authorization':_0x2c7e('0x73')+_0x3b3c46['apiKey'],'Content-Type':_0x2c7e('0x59')},'body':{'from':_0x3b3c46[_0x2c7e('0x21')],'to':_0x15abd8[_0x2c7e('0x21')],'text':_0x15abd8[_0x2c7e('0xb')]},'json':!![]};return rp(_0x1f7b78)[_0x2c7e('0x16')](function(_0x1ca251){if(_0x1ca251['code']==0xca){_0x26c8e2[_0x2c7e('0x74')]=_0x1ca251;var _0x533f0a={'method':_0x2c7e('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2c7e('0x73')+_0x3b3c46[_0x2c7e('0x5b')],'Content-Type':_0x2c7e('0x59')},'body':{'refid':_0x26c8e2['message'][_0x2c7e('0x75')]},'json':!![]};return rp(_0x533f0a)[_0x2c7e('0x16')](function(_0x3fb8e3){_0x26c8e2[_0x2c7e('0x76')]=_0x3fb8e3;var _0x38fa90={'messageId':_0x26c8e2[_0x2c7e('0x74')][_0x2c7e('0x75')],'read':!![]};return _0x425142['update'](_0x38fa90);});}else{return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),'afterCreate','intelepeer',util['inspect'](_0x1ca251,{'showHidden':![],'depth':null}));}})[_0x2c7e('0x19')](function(_0x54eaef){return logger[_0x2c7e('0x1a')](_0x2c7e('0x29'),_0x2c7e('0x28'),'intelepeer',util[_0x2c7e('0x3a')](_0x54eaef,{'showHidden':![],'depth':null}));});}else{return logger[_0x2c7e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c7e('0x71'),'Token\x20not\x20received');}break;}}})[_0x2c7e('0x77')](function(){_0x55718f();});}else{_0x55718f();}}},'charset':_0x2c7e('0x78'),'collate':_0x2c7e('0x79')});}; \ No newline at end of file +var _0x9406=['authToken','phone','accountSid','messages','create','body','remote','/status?token=','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','get','direction','toLowerCase','secret','UserId','isNil','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','type','twilio'];(function(_0xf8e0c5,_0x226f29){var _0x1d0875=function(_0x5c9f38){while(--_0x5c9f38){_0xf8e0c5['push'](_0xf8e0c5['shift']());}};_0x1d0875(++_0x226f29);}(_0x9406,0xcb));var _0x6940=function(_0x9446f3,_0x189997){_0x9446f3=_0x9446f3-0x0;var _0x12e78f=_0x9406[_0x9446f3];return _0x12e78f;};'use strict';var _=require(_0x6940('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6940('0x1'));var moment=require(_0x6940('0x2'));var BPromise=require(_0x6940('0x3'));var rp=require(_0x6940('0x4'));var fs=require('fs');var path=require(_0x6940('0x5'));var rimraf=require(_0x6940('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x6940('0x7')]=function(_0x50f1a1,_0x1a6b1d){return _0x50f1a1[_0x6940('0x8')](_0x6940('0x9'),attributes,{'tableName':_0x6940('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6940('0xb')]},{'name':_0x6940('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49c39c,_0x18d2b1,_0x4daaa7){var _0x100b9f=_0x50f1a1['models'];var _0x1b3ea1=_0x49c39c[_0x6940('0xd')]({'plain':!![]});if(_0x1b3ea1[_0x6940('0xe')][_0x6940('0xf')]()==='in'||_0x1b3ea1[_0x6940('0xe')]['toLowerCase']()==='out'&&!_0x1b3ea1[_0x6940('0x10')]&&!_['isNil'](_0x1b3ea1[_0x6940('0x11')])&&!_[_0x6940('0x12')](_0x1b3ea1['SmsInteractionId'])){_0x100b9f[_0x6940('0x13')][_0x6940('0x14')]({'where':{'id':_0x1b3ea1[_0x6940('0x15')]}})['then'](function(_0x5d5987){if(_0x5d5987){_0x5d5987[_0x6940('0x16')]({'lastMsgAt':_0x1b3ea1[_0x6940('0x17')],'lastMsgDirection':_0x1b3ea1[_0x6940('0xe')]['toLowerCase']()});}})[_0x6940('0x18')](function(_0x4e0241){console[_0x6940('0x19')](_0x4e0241);});}if(_0x1b3ea1['direction']==='out'&&!_0x1b3ea1['secret']){var _0x4918e0;_0x100b9f[_0x6940('0x1a')]['find']({'where':{'id':_0x1b3ea1['SmsAccountId']},'raw':!![]})['then'](function(_0x5a73e6){_0x4918e0=_0x5a73e6;if(_0x4918e0&&_0x4918e0[_0x6940('0x1b')]){switch(_0x4918e0[_0x6940('0x1b')]){case _0x6940('0x1c'):var _0xe398c3=require('twilio');if(_0x4918e0['accountSid']&&_0x4918e0[_0x6940('0x1d')]&&_0x4918e0[_0x6940('0x1e')]){var _0x4fe02f=new _0xe398c3(_0x4918e0[_0x6940('0x1f')],_0x4918e0[_0x6940('0x1d')]);_0x4fe02f[_0x6940('0x20')][_0x6940('0x21')]({'body':_0x1b3ea1[_0x6940('0x22')],'to':_0x1b3ea1['phone'],'from':_0x4918e0[_0x6940('0x1e')],'statusCallback':_0x4918e0[_0x6940('0x23')]+'/api/sms/messages/'+_0x1b3ea1['id']+_0x6940('0x24')+_0x4918e0[_0x6940('0x25')]})[_0x6940('0x26')](function(_0x448c37){if(_0x448c37[_0x6940('0x27')]){return _0x49c39c[_0x6940('0x16')]({'messageId':_0x448c37[_0x6940('0x27')]});}})['catch'](function(_0x120223){logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6940('0x1c'),util['inspect'](_0x120223,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6940('0x28'),_0x6940('0x29'),'twilio',_0x6940('0x2a'));}break;case _0x6940('0x2b'):var _0x101ce4='https://api.skebby.it/API/v1.0/REST/';if(_0x4918e0[_0x6940('0x2c')]&&_0x4918e0[_0x6940('0x2d')]){var _0x45c72d={'recipient':[_0x1b3ea1[_0x6940('0x1e')]],'message':_0x1b3ea1[_0x6940('0x22')],'message_type':_0x4918e0['smsMethod']};if(_0x4918e0[_0x6940('0x2e')]&&_0x4918e0['smsMethod']!=='SI'){_0x45c72d[_0x6940('0x2f')]=_0x4918e0[_0x6940('0x1e')];}var _0x3718ab={'url':_0x101ce4+_0x6940('0x30')+_0x4918e0[_0x6940('0x2c')]+_0x6940('0x31')+_0x4918e0[_0x6940('0x2d')],'method':_0x6940('0x32')};rp(_0x3718ab)['then'](function(_0xe4b767){var _0x367a04=_0xe4b767[_0x6940('0x33')](';');var _0x30e91a={'user_key':_0x367a04[0x0],'session_key':_0x367a04[0x1]};_0x3718ab={'url':_0x101ce4+'sms','method':_0x6940('0x34'),'headers':{'user_key':_0x30e91a[_0x6940('0x35')],'Session_key':_0x30e91a['session_key']},'json':!![],'body':_0x45c72d};return rp(_0x3718ab);})[_0x6940('0x26')](function(_0x503b5f){if(_0x503b5f[_0x6940('0x36')]>=0x1){var _0x524959={'messageId':_0x503b5f[_0x6940('0x37')]};if(_0x4918e0[_0x6940('0x2e')]!=='GP'||!_0x4918e0[_0x6940('0x38')]){_0x524959[_0x6940('0x39')]=!![];}return _0x49c39c['update'](_0x524959);}else{return logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x2b'),util['inspect'](_0x503b5f,{'showHidden':![],'depth':null}));}})[_0x6940('0x18')](function(_0x5c1e61){return logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x2b'),util[_0x6940('0x3a')](_0x5c1e61,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6940('0x28'),'afterCreate',_0x6940('0x2b'),_0x6940('0x3b'));}break;case _0x6940('0x3c'):if(_0x4918e0[_0x6940('0x1d')]){var _0x100c2c={'recipient':_0x1b3ea1['phone'],'message':_0x1b3ea1['body'],'sender':_0x4918e0[_0x6940('0x3d')]||_0x4918e0[_0x6940('0x1e')],'authorization':_0x4918e0[_0x6940('0x1d')]};var _0x18d2b1={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x100c2c,'json':!![]};rp(_0x18d2b1)[_0x6940('0x26')](function(_0x4246ef){var _0x494cca={'messageId':_0x4246ef['requestid']};if(!_0x4918e0[_0x6940('0x38')]){_0x494cca[_0x6940('0x39')]=!![];}return _0x49c39c[_0x6940('0x16')](_0x494cca);})[_0x6940('0x18')](function(_0x574c13){logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x3c'),util[_0x6940('0x3a')](_0x574c13,{'showHidden':![],'depth':null}));});}else{logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x3c'),_0x6940('0x3e'));}break;case'clicksend':if(_0x4918e0[_0x6940('0x2c')]&&_0x4918e0[_0x6940('0x2d')]){var _0x100c2c={'messages':[{'source':'xCALLY\x20Motion','to':_0x1b3ea1[_0x6940('0x1e')],'body':_0x1b3ea1[_0x6940('0x22')],'from':_0x4918e0['senderString']||_0x4918e0['phone']}]};var _0x52c04c=util[_0x6940('0x3f')](_0x6940('0x40'),_0x4918e0[_0x6940('0x2c')],_0x4918e0[_0x6940('0x2d')]);var _0x18d2b1={'method':_0x6940('0x34'),'uri':_0x6940('0x41'),'body':_0x100c2c,'headers':{'Authorization':util['format'](_0x6940('0x42'),new Buffer(_0x52c04c)[_0x6940('0x43')]('base64'))},'json':!![]};rp(_0x18d2b1)['then'](function(_0x4e8e1c){if(_0x4e8e1c[_0x6940('0x44')]>=0xc8&&_0x4e8e1c[_0x6940('0x44')]<=0xce){if(_0x4e8e1c[_0x6940('0x45')]&&_0x4e8e1c[_0x6940('0x45')][_0x6940('0x46')]>0x0){var _0x27b12b=_[_0x6940('0x47')](_0x4e8e1c[_0x6940('0x45')][_0x6940('0x20')]);var _0x417c53={'messageId':_0x27b12b['message_id']};if(!_0x4918e0[_0x6940('0x38')]){_0x417c53[_0x6940('0x39')]=!![];}return _0x49c39c[_0x6940('0x16')](_0x417c53);}else{logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),'clickSend',util[_0x6940('0x3a')](_0x4e8e1c,{'showHidden':![],'depth':null}));}}else{logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6940('0x29'),_0x6940('0x48'),util[_0x6940('0x3a')](_0x4e8e1c,{'showHidden':![],'depth':null}));}})[_0x6940('0x18')](function(_0x1e1e51){logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x48'),util[_0x6940('0x3a')](_0x1e1e51,{'showHidden':![],'depth':null}));});}else{logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x48'),_0x6940('0x3b'));}break;case _0x6940('0x49'):if(_0x4918e0[_0x6940('0x4a')]&&_0x4918e0[_0x6940('0x1d')]){var _0x100c2c={'dst':_0x1b3ea1[_0x6940('0x1e')],'text':_0x1b3ea1[_0x6940('0x22')],'src':_0x4918e0[_0x6940('0x3d')]||_0x4918e0[_0x6940('0x1e')],'url':_0x4918e0[_0x6940('0x23')]+_0x6940('0x4b')+_0x1b3ea1['id']+'/status?token='+_0x4918e0[_0x6940('0x25')]};var _0x52c04c=util['format']('%s:%s',_0x4918e0[_0x6940('0x4a')],_0x4918e0[_0x6940('0x1d')]);var _0x18d2b1={'method':_0x6940('0x34'),'uri':util[_0x6940('0x3f')](_0x6940('0x4c'),_0x4918e0[_0x6940('0x4a')]),'body':_0x100c2c,'headers':{'Authorization':util['format'](_0x6940('0x42'),new Buffer(_0x52c04c)[_0x6940('0x43')](_0x6940('0x4d')))},'json':!![]};rp(_0x18d2b1)[_0x6940('0x26')](function(_0x3d4771){var _0x3bde19={'messageId':_0x3d4771[_0x6940('0x4e')][0x0]};return _0x49c39c[_0x6940('0x16')](_0x3bde19);})['catch'](function(_0x41c1f5){logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6940('0x29'),'plivo',util[_0x6940('0x3a')](_0x41c1f5,{'showHidden':![],'depth':null}));});}else{logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x49'),_0x6940('0x4f'));}break;case _0x6940('0x50'):if(_0x4918e0[_0x6940('0x2c')]&&_0x4918e0[_0x6940('0x2d')]){if(_0x4918e0[_0x6940('0x51')]){var _0x286bc8={'method':_0x6940('0x34'),'uri':_0x4918e0[_0x6940('0x51')]+'/auth/1/session','body':{'username':_0x4918e0['username'],'password':_0x4918e0[_0x6940('0x2d')]},'json':!![]};return rp(_0x286bc8)[_0x6940('0x26')](function(_0x540f76){var _0x2820f9={'method':_0x6940('0x34'),'uri':_0x4918e0[_0x6940('0x51')]+_0x6940('0x52'),'body':{'messages':[{'from':_0x4918e0[_0x6940('0x1e')],'destinations':[{'to':_0x1b3ea1['phone']}],'text':_0x1b3ea1['body'],'notifyUrl':_0x4918e0[_0x6940('0x23')]+'/api/sms/messages/'+_0x1b3ea1['id']+_0x6940('0x24')+_0x4918e0['token'],'notifyContentType':_0x6940('0x53'),'callbackData':_0x4918e0[_0x6940('0x1e')]+';'+_0x1b3ea1[_0x6940('0x22')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x540f76['token']},'json':!![]};return rp(_0x2820f9)['then'](function(_0x37cea8){if(_0x37cea8[_0x6940('0x20')]){var _0x1d8b41={'messageId':_0x37cea8['messages'][0x0]['messageId']};if(!_0x4918e0[_0x6940('0x38')]){_0x1d8b41[_0x6940('0x39')]=!![];}return _0x49c39c[_0x6940('0x16')](_0x1d8b41);}else{return logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x50'),util['inspect'](_0x37cea8,{'showHidden':![],'depth':null}));}});})[_0x6940('0x18')](function(_0x46af42){return logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x50'),util[_0x6940('0x3a')](_0x46af42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6940('0x28'),'afterCreate',_0x6940('0x50'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x50'),_0x6940('0x3b'));}break;case _0x6940('0x54'):var _0x16fea1=require(_0x6940('0x55'));if(_0x4918e0[_0x6940('0x56')]){var _0x5ed2ad={};_0x5ed2ad[_0x6940('0x57')]=_0x4918e0['username'];_0x5ed2ad[_0x6940('0x1e')]=_0x1b3ea1['phone'];_0x5ed2ad[_0x6940('0x2f')]=_0x4918e0[_0x6940('0x1e')];_0x5ed2ad[_0x6940('0x58')]=_0x1b3ea1[_0x6940('0x22')];_0x5ed2ad[_0x6940('0x59')]=+new Date();var _0x145360='';var _0x2c09b4='';var _0x49b122=Object[_0x6940('0x5a')](_0x5ed2ad);_0x49b122[_0x6940('0x5b')]();for(var _0x480965=0x0;_0x480965<_0x49b122[_0x6940('0x5c')];_0x480965++){if(_0x145360!=''){_0x145360+='&';}_0x145360+=_0x49b122[_0x480965]+'='+encodeURIComponent(_0x5ed2ad[_0x49b122[_0x480965]]);_0x2c09b4+=_0x5ed2ad[_0x49b122[_0x480965]];}_0x2c09b4+=_0x4918e0['apiKey'];_0x2c09b4=_0x16fea1[_0x6940('0x5d')](_0x6940('0x5e'))[_0x6940('0x16')](_0x2c09b4)[_0x6940('0x5f')](_0x6940('0x60'));if(_0x145360!==''){_0x145360+='&';}_0x145360+=_0x6940('0x61')+_0x2c09b4;var _0x3718ab={'method':'GET','uri':_0x4918e0[_0x6940('0x51')]+'/external/get/send.php?'+_0x145360,'json':!![]};return rp(_0x3718ab)[_0x6940('0x26')](function(_0x40053c){var _0x1d6d0e=Object[_0x6940('0x5a')](_0x40053c);if(_0x40053c[_0x1d6d0e[0x0]]['error']&&parseInt(_0x40053c[_0x1d6d0e[0x0]]['error'])===0x0){var _0x3d193d={'messageId':_0x40053c[_0x1d6d0e[0x0]][_0x6940('0x62')]};if(!_0x4918e0[_0x6940('0x38')]){_0x3d193d[_0x6940('0x39')]=!![];}return _0x49c39c[_0x6940('0x16')](_0x3d193d);}else{return logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x54'),util[_0x6940('0x3a')](_0x40053c['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x132e76){return logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6940('0x29'),'csc',util[_0x6940('0x3a')](_0x132e76,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6940('0x29'),_0x6940('0x54'),_0x6940('0x63'));}break;case'clickatell':if(_0x4918e0['apiKey']){var _0x10b20a={'method':_0x6940('0x34'),'uri':_0x6940('0x64'),'headers':{'Authorization':_0x4918e0['apiKey']},'body':{'content':_0x1b3ea1[_0x6940('0x22')],'to':[_0x1b3ea1[_0x6940('0x1e')]],'from':_0x4918e0['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x6940('0x65')},'json':!![]};rp(_0x10b20a)[_0x6940('0x26')](function(_0x1b6ae8){if(!_0x1b6ae8['error']){var _0x32b001={'messageId':_0x1b6ae8[_0x6940('0x20')][0x0][_0x6940('0x66')]};if(!_0x4918e0[_0x6940('0x38')]){_0x32b001['read']=!![];}return _0x49c39c['update'](_0x32b001);}else{return logger['error'](_0x6940('0x28'),_0x6940('0x29'),'clickatell',util[_0x6940('0x3a')](_0x1b6ae8[_0x6940('0x19')],{'showHidden':![],'depth':null}));}})[_0x6940('0x18')](function(_0x587d1a){return logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x67'),util[_0x6940('0x3a')](_0x587d1a,{'showHidden':![],'depth':null}));});}else{logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate','clickatell',_0x6940('0x63'));}break;case _0x6940('0x68'):if(_0x4918e0[_0x6940('0x2c')]&&_0x4918e0['password']){var _0x52c04c=util[_0x6940('0x3f')](_0x6940('0x40'),_0x4918e0[_0x6940('0x2c')],_0x4918e0[_0x6940('0x2d')]);var _0x18d2b1={'method':_0x6940('0x34'),'uri':_0x6940('0x69')+_0x4918e0[_0x6940('0x6a')]+'/messages','body':{'to':[_0x1b3ea1[_0x6940('0x1e')]],'text':_0x1b3ea1[_0x6940('0x22')],'from':_0x4918e0['phone'],'applicationId':_0x4918e0['applicationId']},'headers':{'Authorization':util[_0x6940('0x3f')](_0x6940('0x42'),new Buffer(_0x52c04c)[_0x6940('0x43')]('base64'))},'json':!![]};rp(_0x18d2b1)['then'](function(_0x4c0515){if(_0x4c0515['id']){var _0x3c42b2={'messageId':_0x4c0515['id']};return _0x49c39c[_0x6940('0x16')](_0x3c42b2);}else{logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),'bandwidth',util[_0x6940('0x3a')](_0x4c0515,{'showHidden':![],'depth':null}));}})[_0x6940('0x18')](function(_0x3a26f0){logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util['inspect'](_0x3a26f0,{'showHidden':![],'depth':null}));});}else{logger[_0x6940('0x19')](_0x6940('0x28'),'afterCreate',_0x6940('0x68'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x4918e0['apiKey']){var _0x1f6776={};var _0x3718ab={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x6940('0x6b')+_0x4918e0[_0x6940('0x56')],'Content-Type':'application/json'},'body':{'from':_0x4918e0['phone'],'to':_0x1b3ea1[_0x6940('0x1e')],'text':_0x1b3ea1[_0x6940('0x22')]},'json':!![]};return rp(_0x3718ab)[_0x6940('0x26')](function(_0x3e743d){if(_0x3e743d[_0x6940('0x6c')]==0xca){_0x1f6776[_0x6940('0x6d')]=_0x3e743d;var _0xfa4b08={'method':'POST','uri':_0x6940('0x6e'),'headers':{'Authorization':_0x6940('0x6b')+_0x4918e0[_0x6940('0x56')],'Content-Type':'application/json'},'body':{'refid':_0x1f6776[_0x6940('0x6d')][_0x6940('0x6f')]},'json':!![]};return rp(_0xfa4b08)[_0x6940('0x26')](function(_0x1cfbc0){_0x1f6776['status']=_0x1cfbc0;var _0x545dd9={'messageId':_0x1f6776[_0x6940('0x6d')][_0x6940('0x6f')],'read':!![]};return _0x49c39c['update'](_0x545dd9);});}else{return logger[_0x6940('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6940('0x29'),_0x6940('0x70'),util[_0x6940('0x3a')](_0x3e743d,{'showHidden':![],'depth':null}));}})[_0x6940('0x18')](function(_0x2aaede){return logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x70'),util['inspect'](_0x2aaede,{'showHidden':![],'depth':null}));});}else{return logger[_0x6940('0x19')](_0x6940('0x28'),_0x6940('0x29'),_0x6940('0x70'),_0x6940('0x71'));}break;}}})[_0x6940('0x72')](function(){_0x4daaa7();});}else{_0x4daaa7();}}},'charset':_0x6940('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 8568441..73308bb 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 _0xe6b3=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6b3,0x8c));var _0x3e6b=function(_0x5af5b2,_0xa9ea50){_0x5af5b2=_0x5af5b2-0x0;var _0x5dc8b9=_0xe6b3[_0x5af5b2];return _0x5dc8b9;};'use strict';var _=require(_0x3e6b('0x0'));var util=require(_0x3e6b('0x1'));var moment=require(_0x3e6b('0x2'));var BPromise=require(_0x3e6b('0x3'));var rs=require(_0x3e6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e6b('0x5'))['db'];var utils=require(_0x3e6b('0x6'));var logger=require('../../config/logger')(_0x3e6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e6b('0x8'));var client=jayson['client'][_0x3e6b('0x9')]({'port':0x232a});config[_0x3e6b('0xa')]=_[_0x3e6b('0xb')](config['redis'],{'host':_0x3e6b('0xc'),'port':0x18eb});var socket=require(_0x3e6b('0xd'))(new Redis(config[_0x3e6b('0xa')]));require(_0x3e6b('0xe'))[_0x3e6b('0xf')](socket);function respondWithRpcPromise(_0x26b238,_0xb28235,_0x27f693){return new BPromise(function(_0x3ef3a8,_0x1de3f6){return client[_0x3e6b('0x10')](_0x26b238,_0x27f693)[_0x3e6b('0x11')](function(_0x2e6012){logger[_0x3e6b('0x12')](_0x3e6b('0x13'),_0xb28235,'request\x20sent');logger['debug'](_0x3e6b('0x14'),_0xb28235,_0x3e6b('0x15'),JSON[_0x3e6b('0x16')](_0x2e6012));if(_0x2e6012['error']){if(_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x18')]===0x1f4){logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x2e6012[_0x3e6b('0x17')]['message']);return _0x1de3f6(_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x19')]);}logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x2e6012[_0x3e6b('0x17')][_0x3e6b('0x19')]);return _0x3ef3a8(_0x2e6012['error'][_0x3e6b('0x19')]);}else{logger[_0x3e6b('0x12')](_0x3e6b('0x13'),_0xb28235,_0x3e6b('0x15'));_0x3ef3a8(_0x2e6012[_0x3e6b('0x1a')][_0x3e6b('0x19')]);}})[_0x3e6b('0x1b')](function(_0x45f056){logger[_0x3e6b('0x17')](_0x3e6b('0x13'),_0xb28235,_0x45f056);_0x1de3f6(_0x45f056);});});}exports[_0x3e6b('0x1c')]=function(_0x23aa36){var _0x256d7a=this;return new Promise(function(_0x1f3f77,_0xd103d8){return db[_0x3e6b('0x1d')][_0x3e6b('0x1e')](_0x23aa36[_0x3e6b('0x1f')],{'raw':_0x23aa36[_0x3e6b('0x20')]?_0x23aa36[_0x3e6b('0x20')][_0x3e6b('0x21')]===undefined?!![]:![]:!![]})[_0x3e6b('0x11')](function(_0x304ef7){logger[_0x3e6b('0x12')](_0x3e6b('0x1c'),_0x23aa36);logger[_0x3e6b('0x22')](_0x3e6b('0x1c'),_0x23aa36,JSON['stringify'](_0x304ef7));_0x1f3f77(_0x304ef7);})[_0x3e6b('0x1b')](function(_0x384756){logger[_0x3e6b('0x17')]('CreateSmsMessage',_0x384756[_0x3e6b('0x19')],_0x23aa36);_0xd103d8(_0x256d7a[_0x3e6b('0x17')](0x1f4,_0x384756[_0x3e6b('0x19')]));});});}; \ No newline at end of file +var _0x814f=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options'];(function(_0x1e3540,_0x5621b3){var _0x5d9373=function(_0xdceff6){while(--_0xdceff6){_0x1e3540['push'](_0x1e3540['shift']());}};_0x5d9373(++_0x5621b3);}(_0x814f,0x145));var _0xf814=function(_0x886e13,_0x3d68b3){_0x886e13=_0x886e13-0x0;var _0x476d89=_0x814f[_0x886e13];return _0x476d89;};'use strict';var _=require(_0xf814('0x0'));var util=require(_0xf814('0x1'));var moment=require(_0xf814('0x2'));var BPromise=require(_0xf814('0x3'));var rs=require(_0xf814('0x4'));var fs=require('fs');var Redis=require(_0xf814('0x5'));var db=require(_0xf814('0x6'))['db'];var utils=require(_0xf814('0x7'));var logger=require('../../config/logger')(_0xf814('0x8'));var config=require(_0xf814('0x9'));var jayson=require(_0xf814('0xa'));var client=jayson[_0xf814('0xb')][_0xf814('0xc')]({'port':0x232a});config[_0xf814('0xd')]=_[_0xf814('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf814('0xf'))(new Redis(config[_0xf814('0xd')]));require(_0xf814('0x10'))[_0xf814('0x11')](socket);function respondWithRpcPromise(_0x187bf8,_0x422064,_0x5176d2){return new BPromise(function(_0x14db80,_0x693b0){return client[_0xf814('0x12')](_0x187bf8,_0x5176d2)[_0xf814('0x13')](function(_0x28e5ce){logger[_0xf814('0x14')](_0xf814('0x15'),_0x422064,_0xf814('0x16'));logger[_0xf814('0x17')](_0xf814('0x18'),_0x422064,'request\x20sent',JSON[_0xf814('0x19')](_0x28e5ce));if(_0x28e5ce['error']){if(_0x28e5ce[_0xf814('0x1a')][_0xf814('0x1b')]===0x1f4){logger['error'](_0xf814('0x15'),_0x422064,_0x28e5ce[_0xf814('0x1a')]['message']);return _0x693b0(_0x28e5ce[_0xf814('0x1a')][_0xf814('0x1c')]);}logger['error'](_0xf814('0x15'),_0x422064,_0x28e5ce[_0xf814('0x1a')][_0xf814('0x1c')]);return _0x14db80(_0x28e5ce[_0xf814('0x1a')][_0xf814('0x1c')]);}else{logger[_0xf814('0x14')](_0xf814('0x15'),_0x422064,'request\x20sent');_0x14db80(_0x28e5ce['result']['message']);}})[_0xf814('0x1d')](function(_0x4e1f91){logger[_0xf814('0x1a')](_0xf814('0x15'),_0x422064,_0x4e1f91);_0x693b0(_0x4e1f91);});});}exports[_0xf814('0x1e')]=function(_0x2df442){var _0x4fa34a=this;return new Promise(function(_0x22d25e,_0x1c44f8){return db[_0xf814('0x1f')][_0xf814('0x20')](_0x2df442[_0xf814('0x21')],{'raw':_0x2df442[_0xf814('0x22')]?_0x2df442[_0xf814('0x22')][_0xf814('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x1a23f8){logger['info'](_0xf814('0x1e'),_0x2df442);logger[_0xf814('0x17')](_0xf814('0x1e'),_0x2df442,JSON[_0xf814('0x19')](_0x1a23f8));_0x22d25e(_0x1a23f8);})[_0xf814('0x1d')](function(_0x29c239){logger[_0xf814('0x1a')](_0xf814('0x1e'),_0x29c239[_0xf814('0x1c')],_0x2df442);_0x1c44f8(_0x4fa34a['error'](0x1f4,_0x29c239[_0xf814('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e74e683..b44b96e 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 _0xaaa2=['remove','update','emit','register','length','./smsMessage.events','save'];(function(_0xbca96f,_0x266b8a){var _0x16807e=function(_0x3c4763){while(--_0x3c4763){_0xbca96f['push'](_0xbca96f['shift']());}};_0x16807e(++_0x266b8a);}(_0xaaa2,0x1cc));var _0x2aaa=function(_0x4778b1,_0x21bcf0){_0x4778b1=_0x4778b1-0x0;var _0x331a17=_0xaaa2[_0x4778b1];return _0x331a17;};'use strict';var SmsMessageEvents=require(_0x2aaa('0x0'));var events=[_0x2aaa('0x1'),_0x2aaa('0x2'),_0x2aaa('0x3')];function createListener(_0x450f4d,_0x32fa4e){return function(_0x23cead){_0x32fa4e[_0x2aaa('0x4')](_0x450f4d,_0x23cead);};}function removeListener(_0x3ea758,_0x129ed2){return function(){SmsMessageEvents['removeListener'](_0x3ea758,_0x129ed2);};}exports[_0x2aaa('0x5')]=function(_0x22146b){for(var _0x572020=0x0,_0x150032=events[_0x2aaa('0x6')];_0x572020<_0x150032;_0x572020++){var _0x55ee41=events[_0x572020];var _0x41cb5d=createListener('smsMessage:'+_0x55ee41,_0x22146b);SmsMessageEvents['on'](_0x55ee41,_0x41cb5d);}}; \ No newline at end of file +var _0x8157=['length','smsMessage:','./smsMessage.events','remove','emit','register'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x8157,0xe0));var _0x7815=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0x8157[_0x3eb630];return _0x1b840d;};'use strict';var SmsMessageEvents=require(_0x7815('0x0'));var events=['save',_0x7815('0x1'),'update'];function createListener(_0x36c61b,_0x2a7578){return function(_0x166bdf){_0x2a7578[_0x7815('0x2')](_0x36c61b,_0x166bdf);};}function removeListener(_0x4697f6,_0x38127e){return function(){SmsMessageEvents['removeListener'](_0x4697f6,_0x38127e);};}exports[_0x7815('0x3')]=function(_0x35d55f){for(var _0x3d1202=0x0,_0xd6de34=events[_0x7815('0x4')];_0x3d1202<_0xd6de34;_0x3d1202++){var _0x39f0ad=events[_0x3d1202];var _0x5243f6=createListener(_0x7815('0x5')+_0x39f0ad,_0x35d55f);SmsMessageEvents['on'](_0x39f0ad,_0x5243f6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2df92a6..5a619af 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 _0xac6c=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','destroy','removeTeams','delete','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xac6c,0xe4));var _0xcac6=function(_0x2238db,_0xe23c3a){_0x2238db=_0x2238db-0x0;var _0x203149=_0xac6c[_0x2238db];return _0x203149;};'use strict';var multer=require(_0xcac6('0x0'));var util=require(_0xcac6('0x1'));var path=require('path');var timeout=require(_0xcac6('0x2'));var express=require(_0xcac6('0x3'));var router=express[_0xcac6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcac6('0x5'));var interaction=require(_0xcac6('0x6'));var config=require(_0xcac6('0x7'));var controller=require(_0xcac6('0x8'));router[_0xcac6('0x9')]('/',auth[_0xcac6('0xa')](),controller['index']);router[_0xcac6('0x9')](_0xcac6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xcac6('0x9')](_0xcac6('0xc'),auth[_0xcac6('0xa')](),controller[_0xcac6('0xd')]);router[_0xcac6('0x9')](_0xcac6('0xe'),auth[_0xcac6('0xa')](),controller[_0xcac6('0xf')]);router[_0xcac6('0x9')](_0xcac6('0x10'),auth[_0xcac6('0xa')](),controller['getTeams']);router[_0xcac6('0x9')](_0xcac6('0x11'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x12')]);router[_0xcac6('0x13')]('/',auth['isAuthenticated'](),controller[_0xcac6('0x14')]);router[_0xcac6('0x13')](_0xcac6('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0xcac6('0x13')]('/:id/users',auth[_0xcac6('0xa')](),controller['addAgents']);router[_0xcac6('0x15')](_0xcac6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcac6('0xc'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x16')]);router['delete']('/:id/teams',auth[_0xcac6('0xa')](),controller[_0xcac6('0x17')]);router[_0xcac6('0x18')](_0xcac6('0x11'),auth[_0xcac6('0xa')](),controller[_0xcac6('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9bd8=['update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','put','/:id'];(function(_0x5886dd,_0xd953d8){var _0x20be26=function(_0x8ab4d){while(--_0x8ab4d){_0x5886dd['push'](_0x5886dd['shift']());}};_0x20be26(++_0xd953d8);}(_0x9bd8,0xe6));var _0x89bd=function(_0xd723,_0x164010){_0xd723=_0xd723-0x0;var _0x5179d2=_0x9bd8[_0xd723];return _0x5179d2;};'use strict';var multer=require(_0x89bd('0x0'));var util=require(_0x89bd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89bd('0x2'));var router=express[_0x89bd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x89bd('0x4'));var config=require(_0x89bd('0x5'));var controller=require('./smsQueue.controller');router[_0x89bd('0x6')]('/',auth[_0x89bd('0x7')](),controller[_0x89bd('0x8')]);router[_0x89bd('0x6')]('/describe',auth[_0x89bd('0x7')](),controller[_0x89bd('0x9')]);router['get']('/:id',auth[_0x89bd('0x7')](),controller[_0x89bd('0xa')]);router[_0x89bd('0x6')](_0x89bd('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0x89bd('0x6')](_0x89bd('0xc'),auth[_0x89bd('0x7')](),controller[_0x89bd('0xd')]);router['get']('/:id/users',auth[_0x89bd('0x7')](),controller[_0x89bd('0xe')]);router[_0x89bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x89bd('0xf')](_0x89bd('0xc'),auth[_0x89bd('0x7')](),controller[_0x89bd('0x10')]);router[_0x89bd('0xf')](_0x89bd('0x11'),auth[_0x89bd('0x7')](),controller['addAgents']);router[_0x89bd('0x12')](_0x89bd('0x13'),auth[_0x89bd('0x7')](),controller[_0x89bd('0x14')]);router[_0x89bd('0x15')](_0x89bd('0x13'),auth[_0x89bd('0x7')](),controller[_0x89bd('0x16')]);router[_0x89bd('0x15')](_0x89bd('0xc'),auth['isAuthenticated'](),controller[_0x89bd('0x17')]);router[_0x89bd('0x15')](_0x89bd('0x11'),auth[_0x89bd('0x7')](),controller[_0x89bd('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5075b96..634f2ff 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 _0x329e=['STRING','INTEGER','exports'];(function(_0x558848,_0x14ab59){var _0x59b175=function(_0x371728){while(--_0x371728){_0x558848['push'](_0x558848['shift']());}};_0x59b175(++_0x14ab59);}(_0x329e,0x15e));var _0xe329=function(_0x1337db,_0x328318){_0x1337db=_0x1337db-0x0;var _0x38cf62=_0x329e[_0x1337db];return _0x38cf62;};'use strict';var Sequelize=require('sequelize');module[_0xe329('0x0')]={'name':{'type':Sequelize[_0xe329('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe329('0x1')]},'timeout':{'type':Sequelize[_0xe329('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x9346=['rrmemory','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x57047f,_0x464b06){var _0x2b691f=function(_0x4b1a0a){while(--_0x4b1a0a){_0x57047f['push'](_0x57047f['shift']());}};_0x2b691f(++_0x464b06);}(_0x9346,0x1b1));var _0x6934=function(_0x59e05f,_0x20cae1){_0x59e05f=_0x59e05f-0x0;var _0x2f97ac=_0x9346[_0x59e05f];return _0x2f97ac;};'use strict';var Sequelize=require(_0x6934('0x0'));module['exports']={'name':{'type':Sequelize[_0x6934('0x1')],'unique':_0x6934('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6934('0x1')]},'timeout':{'type':Sequelize[_0x6934('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6934('0x4')](_0x6934('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0352664..474c9bf 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 _0xad04=['every','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','bluebird','mustache','util','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserSmsQueue','order','SmsQueueId','User','UserId','agent','smsPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','ids','Agents','interface','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','Team','select','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xad04,0x96));var _0x4ad0=function(_0x1d4517,_0x4170e4){_0x1d4517=_0x1d4517-0x0;var _0x4b106d=_0xad04[_0x1d4517];return _0x4b106d;};'use strict';var emlformat=require(_0x4ad0('0x0'));var rimraf=require(_0x4ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ad0('0x2'));var Mustache=require(_0x4ad0('0x3'));var util=require(_0x4ad0('0x4'));var path=require('path');var sox=require(_0x4ad0('0x5'));var csv=require(_0x4ad0('0x6'));var ejs=require(_0x4ad0('0x7'));var fs=require('fs');var fs_extra=require(_0x4ad0('0x8'));var _=require(_0x4ad0('0x9'));var squel=require(_0x4ad0('0xa'));var crypto=require(_0x4ad0('0xb'));var jsforce=require(_0x4ad0('0xc'));var deskjs=require(_0x4ad0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ad0('0xe'));var Redis=require(_0x4ad0('0xf'));var authService=require(_0x4ad0('0x10'));var qs=require(_0x4ad0('0x11'));var as=require(_0x4ad0('0x12'));var hardwareService=require(_0x4ad0('0x13'));var logger=require(_0x4ad0('0x14'))(_0x4ad0('0x15'));var utils=require('../../config/utils');var config=require(_0x4ad0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ad0('0x17'))['db'];config[_0x4ad0('0x18')]=_[_0x4ad0('0x19')](config['redis'],{'host':_0x4ad0('0x1a'),'port':0x18eb});var socket=require(_0x4ad0('0x1b'))(new Redis(config['redis']));require(_0x4ad0('0x1c'))[_0x4ad0('0x1d')](socket);function respondWithStatusCode(_0x1ee87f,_0x1b18b1){_0x1b18b1=_0x1b18b1||0xcc;return function(_0x4d5272){if(_0x4d5272){return _0x1ee87f[_0x4ad0('0x1e')](_0x1b18b1);}return _0x1ee87f[_0x4ad0('0x1f')](_0x1b18b1)[_0x4ad0('0x20')]();};}function respondWithResult(_0x3b5001,_0x1c3065){_0x1c3065=_0x1c3065||0xc8;return function(_0x88383c){if(_0x88383c){return _0x3b5001['status'](_0x1c3065)[_0x4ad0('0x21')](_0x88383c);}};}function respondWithFilteredResult(_0x3a634c,_0x53c63b){return function(_0xcadde5){if(_0xcadde5){var _0x1a0a58=typeof _0x53c63b[_0x4ad0('0x22')]===_0x4ad0('0x23')&&typeof _0x53c63b['limit']===_0x4ad0('0x23');var _0x34317e=_0xcadde5['count'];var _0x5a5802=_0x1a0a58?0x0:_0x53c63b[_0x4ad0('0x22')];var _0x39e58b=_0x1a0a58?_0xcadde5[_0x4ad0('0x24')]:_0x53c63b[_0x4ad0('0x22')]+_0x53c63b[_0x4ad0('0x25')];var _0x2a45f6;if(_0x39e58b>=_0x34317e){_0x39e58b=_0x34317e;_0x2a45f6=0xc8;}else{_0x2a45f6=0xce;}_0x3a634c[_0x4ad0('0x1f')](_0x2a45f6);return _0x3a634c[_0x4ad0('0x26')](_0x4ad0('0x27'),_0x5a5802+'-'+_0x39e58b+'/'+_0x34317e)[_0x4ad0('0x21')](_0xcadde5);}return null;};}function patchUpdates(_0x5af5cf){return function(_0x106222){try{jsonpatch['apply'](_0x106222,_0x5af5cf,!![]);}catch(_0x1299ea){return BPromise[_0x4ad0('0x28')](_0x1299ea);}return _0x106222[_0x4ad0('0x29')]();};}function saveUpdates(_0x1f2398,_0x17274c){return function(_0x2f2e6b){if(_0x2f2e6b){return _0x2f2e6b[_0x4ad0('0x2a')](_0x1f2398)[_0x4ad0('0x2b')](function(_0x3b880c){return _0x3b880c;});}return null;};}function removeEntity(_0x56012d,_0x305cbc){return function(_0x263726){if(_0x263726){return _0x263726['destroy']()[_0x4ad0('0x2b')](function(){var _0x550f35=_0x263726[_0x4ad0('0x2c')]({'plain':!![]});var _0x3426a8=_0x4ad0('0x2d');return db[_0x4ad0('0x2e')][_0x4ad0('0x2f')]({'where':{'type':_0x3426a8,'resourceId':_0x550f35['id']}})[_0x4ad0('0x2b')](function(){return _0x263726;});})[_0x4ad0('0x2b')](function(){_0x56012d[_0x4ad0('0x1f')](0xcc)[_0x4ad0('0x20')]();});}};}function handleEntityNotFound(_0x692799,_0x4ec496){return function(_0x5df6c6){if(!_0x5df6c6){_0x692799[_0x4ad0('0x1e')](0x194);}return _0x5df6c6;};}function handleError(_0x5f1b23,_0x34cfc2){_0x34cfc2=_0x34cfc2||0x1f4;return function(_0x489d87){logger[_0x4ad0('0x30')](_0x489d87[_0x4ad0('0x31')]);if(_0x489d87[_0x4ad0('0x32')]){delete _0x489d87[_0x4ad0('0x32')];}_0x5f1b23[_0x4ad0('0x1f')](_0x34cfc2)[_0x4ad0('0x33')](_0x489d87);};}exports[_0x4ad0('0x34')]=function(_0xd4164b,_0x297712){var _0x1191d9={},_0x13e30c={},_0x1cbe18={'count':0x0,'rows':[]};var _0x5618d3=_[_0x4ad0('0x35')](db[_0x4ad0('0x36')][_0x4ad0('0x37')],function(_0x524d60){return{'name':_0x524d60['fieldName'],'type':_0x524d60[_0x4ad0('0x38')][_0x4ad0('0x39')]};});_0x13e30c['model']=_[_0x4ad0('0x35')](_0x5618d3,_0x4ad0('0x32'));_0x13e30c[_0x4ad0('0x3a')]=_['keys'](_0xd4164b[_0x4ad0('0x3a')]);_0x13e30c[_0x4ad0('0x3b')]=_['intersection'](_0x13e30c[_0x4ad0('0x3c')],_0x13e30c['query']);_0x1191d9['attributes']=_[_0x4ad0('0x3d')](_0x13e30c[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x1191d9[_0x4ad0('0x3f')]=_0x1191d9[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x1191d9[_0x4ad0('0x3f')]:_0x13e30c['model'];if(!_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x41')](_0x4ad0('0x42'))){_0x1191d9['limit']=qs[_0x4ad0('0x25')](_0xd4164b['query'][_0x4ad0('0x25')]);_0x1191d9[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}_0x1191d9['order']=qs[_0x4ad0('0x43')](_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x1191d9[_0x4ad0('0x44')]=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0xd4164b[_0x4ad0('0x3a')],_0x13e30c['filters']),_0x5618d3);if(_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x1191d9[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x1191d9[_0x4ad0('0x44')],{'$or':_['map'](_0x5618d3,function(_0x1203a4){if(_0x1203a4[_0x4ad0('0x38')]!=='VIRTUAL'){var _0xc9bc9e={};_0xc9bc9e[_0x1203a4[_0x4ad0('0x32')]]={'$like':'%'+_0xd4164b['query'][_0x4ad0('0x46')]+'%'};return _0xc9bc9e;}})});}_0x1191d9=_['merge']({},_0x1191d9,_0xd4164b[_0x4ad0('0x48')]);var _0xde843b={'where':_0x1191d9[_0x4ad0('0x44')]};return db[_0x4ad0('0x36')][_0x4ad0('0x24')](_0xde843b)[_0x4ad0('0x2b')](function(_0x417ef8){_0x1cbe18[_0x4ad0('0x24')]=_0x417ef8;if(_0xd4164b[_0x4ad0('0x3a')][_0x4ad0('0x49')]){_0x1191d9['include']=[{'all':!![]}];}return db[_0x4ad0('0x36')][_0x4ad0('0x4a')](_0x1191d9);})['then'](function(_0x56c2aa){_0x1cbe18[_0x4ad0('0x4b')]=_0x56c2aa;return _0x1cbe18;})[_0x4ad0('0x2b')](respondWithFilteredResult(_0x297712,_0x1191d9))[_0x4ad0('0x4c')](handleError(_0x297712,null));};exports[_0x4ad0('0x4d')]=function(_0x5470a1,_0x27ad09){var _0x35e0a4={'raw':!![],'where':{'id':_0x5470a1['params']['id']}},_0x1314f4={};_0x1314f4[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db[_0x4ad0('0x36')]['rawAttributes']);_0x1314f4[_0x4ad0('0x3a')]=_['keys'](_0x5470a1[_0x4ad0('0x3a')]);_0x1314f4['filters']=_[_0x4ad0('0x3d')](_0x1314f4[_0x4ad0('0x3c')],_0x1314f4[_0x4ad0('0x3a')]);_0x35e0a4[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x1314f4['model'],qs['fields'](_0x5470a1[_0x4ad0('0x3a')]['fields']));_0x35e0a4[_0x4ad0('0x3f')]=_0x35e0a4[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x35e0a4['attributes']:_0x1314f4[_0x4ad0('0x3c')];if(_0x5470a1[_0x4ad0('0x3a')]['includeAll']){_0x35e0a4[_0x4ad0('0x4f')]=[{'all':!![]}];}_0x35e0a4=_['merge']({},_0x35e0a4,_0x5470a1[_0x4ad0('0x48')]);return db[_0x4ad0('0x36')]['find'](_0x35e0a4)[_0x4ad0('0x2b')](handleEntityNotFound(_0x27ad09,null))[_0x4ad0('0x2b')](respondWithResult(_0x27ad09,null))[_0x4ad0('0x4c')](handleError(_0x27ad09,null));};exports[_0x4ad0('0x50')]=function(_0x2dc8e0,_0x23cbf8){return db[_0x4ad0('0x36')][_0x4ad0('0x50')](_0x2dc8e0[_0x4ad0('0x51')],{})['then'](function(_0x37d816){var _0x4a38ab=_0x2dc8e0[_0x4ad0('0x52')]['get']({'plain':!![]});if(!_0x4a38ab)throw new Error(_0x4ad0('0x53'));if(_0x4a38ab[_0x4ad0('0x54')]===_0x4ad0('0x52')){var _0x5355ab=_0x37d816[_0x4ad0('0x2c')]({'plain':!![]});var _0x21a1ac=_0x4ad0('0x2d');return db[_0x4ad0('0x55')][_0x4ad0('0x56')]({'where':{'name':_0x21a1ac,'userProfileId':_0x4a38ab['userProfileId']},'raw':!![]})[_0x4ad0('0x2b')](function(_0x20db34){if(_0x20db34&&_0x20db34[_0x4ad0('0x57')]===0x0){return db[_0x4ad0('0x2e')][_0x4ad0('0x50')]({'name':_0x5355ab[_0x4ad0('0x32')],'resourceId':_0x5355ab['id'],'type':_0x20db34[_0x4ad0('0x32')],'sectionId':_0x20db34['id']},{})[_0x4ad0('0x2b')](function(){return _0x37d816;});}else{return _0x37d816;}})[_0x4ad0('0x4c')](function(_0x5a4bc2){logger[_0x4ad0('0x30')](_0x4ad0('0x58'),_0x5a4bc2);throw _0x5a4bc2;});}return _0x37d816;})[_0x4ad0('0x2b')](respondWithResult(_0x23cbf8,0xc9))['catch'](handleError(_0x23cbf8,null));};exports[_0x4ad0('0x2a')]=function(_0x37664e,_0x959612){if(_0x37664e[_0x4ad0('0x51')]['id']){delete _0x37664e[_0x4ad0('0x51')]['id'];}return db[_0x4ad0('0x36')][_0x4ad0('0x56')]({'where':{'id':_0x37664e[_0x4ad0('0x59')]['id']}})['then'](handleEntityNotFound(_0x959612,null))[_0x4ad0('0x2b')](saveUpdates(_0x37664e[_0x4ad0('0x51')],null))['then'](respondWithResult(_0x959612,null))[_0x4ad0('0x4c')](handleError(_0x959612,null));};exports[_0x4ad0('0x2f')]=function(_0x4aead4,_0x23030e){return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x4aead4[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x23030e,null))[_0x4ad0('0x2b')](removeEntity(_0x23030e,null))[_0x4ad0('0x4c')](handleError(_0x23030e,null));};exports[_0x4ad0('0x5a')]=function(_0x3cdd2b,_0x315abf){return db[_0x4ad0('0x36')][_0x4ad0('0x5a')]()[_0x4ad0('0x2b')](respondWithResult(_0x315abf,null))[_0x4ad0('0x4c')](handleError(_0x315abf,null));};exports[_0x4ad0('0x5b')]=function(_0x1e25a2,_0x179647,_0x50a18f){var _0x6f80e3={'raw':!![],'where':{}},_0x509fd0={},_0x24a233;return db['SmsQueue']['findOne']({'where':{'id':_0x1e25a2['params']['id']}})['then'](handleEntityNotFound(_0x179647,null))[_0x4ad0('0x2b')](function(_0x2e0540){if(_0x2e0540){_0x24a233=_0x2e0540[_0x4ad0('0x2c')]({'plain':!![]});_0x509fd0[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db[_0x4ad0('0x5c')][_0x4ad0('0x37')]);_0x509fd0[_0x4ad0('0x3a')]=_[_0x4ad0('0x4e')](_0x1e25a2[_0x4ad0('0x3a')]);_0x509fd0[_0x4ad0('0x3b')]=_[_0x4ad0('0x3d')](_0x509fd0[_0x4ad0('0x3c')],_0x509fd0[_0x4ad0('0x3a')]);_0x6f80e3[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x509fd0[_0x4ad0('0x3c')],qs['fields'](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x6f80e3[_0x4ad0('0x3f')]=_0x6f80e3['attributes'][_0x4ad0('0x40')]?_0x6f80e3['attributes']:_0x509fd0[_0x4ad0('0x3c')];if(!_0x1e25a2[_0x4ad0('0x3a')]['hasOwnProperty']('nolimit')){_0x6f80e3[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x25')]);_0x6f80e3[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}_0x6f80e3[_0x4ad0('0x5d')]=qs[_0x4ad0('0x43')](_0x1e25a2['query'][_0x4ad0('0x43')]);_0x6f80e3['where']=qs['filters'](_[_0x4ad0('0x45')](_0x1e25a2['query'],_0x509fd0[_0x4ad0('0x3b')]));_0x6f80e3[_0x4ad0('0x44')][_0x4ad0('0x5e')]=_0x2e0540['id'];if(_0x1e25a2[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x6f80e3[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x6f80e3[_0x4ad0('0x44')],{'$or':_[_0x4ad0('0x35')](_0x6f80e3[_0x4ad0('0x3f')],function(_0x2afbc4){var _0xeab59={};_0xeab59[_0x2afbc4]={'$like':'%'+_0x1e25a2['query']['filter']+'%'};return _0xeab59;})});}_0x6f80e3=_[_0x4ad0('0x47')]({},_0x6f80e3,_0x1e25a2['options']);return db['UserSmsQueue'][_0x4ad0('0x4a')](_0x6f80e3);}})['then'](function(_0x379913){if(_0x379913){return db[_0x4ad0('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x379913,_0x4ad0('0x60')),'role':_0x4ad0('0x61')},'attributes':['id',_0x4ad0('0x32'),_0x4ad0('0x62'),'updatedAt','createdAt']});}})['then'](function(_0x5ec857){if(_0x5ec857){return{'count':_0x5ec857['count'],'rows':_[_0x4ad0('0x35')](_0x5ec857[_0x4ad0('0x4b')],function(_0x246ac0){return{'membername':_0x246ac0['name'],'UserId':_0x246ac0['id'],'queue_name':_0x24a233[_0x4ad0('0x32')],'SmsQueueId':_0x24a233['id'],'interface':util[_0x4ad0('0x63')](_0x4ad0('0x64'),_0x4ad0('0x65'),_0x246ac0[_0x4ad0('0x32')]),'penalty':0x0,'paused':_0x246ac0[_0x4ad0('0x62')],'createdAt':_0x246ac0[_0x4ad0('0x66')],'updatedAt':_0x246ac0[_0x4ad0('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ad0('0x2b')](respondWithFilteredResult(_0x179647,_0x6f80e3))['catch'](handleError(_0x179647,null));};exports[_0x4ad0('0x68')]=function(_0x5869eb,_0x445013,_0x55d603){var _0x5363a3={};var _0x28a731={};var _0x266138;var _0x44ede8;return db[_0x4ad0('0x36')][_0x4ad0('0x69')]({'where':{'id':_0x5869eb['params']['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x445013,null))['then'](function(_0x4e5b7d){if(_0x4e5b7d){_0x266138=_0x4e5b7d;_0x28a731[_0x4ad0('0x3c')]=_[_0x4ad0('0x4e')](db['Team'][_0x4ad0('0x37')]);_0x28a731[_0x4ad0('0x3a')]=_[_0x4ad0('0x4e')](_0x5869eb[_0x4ad0('0x3a')]);_0x28a731['filters']=_[_0x4ad0('0x3d')](_0x28a731[_0x4ad0('0x3c')],_0x28a731[_0x4ad0('0x3a')]);_0x5363a3['attributes']=_['intersection'](_0x28a731[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x5363a3[_0x4ad0('0x3f')]=_0x5363a3[_0x4ad0('0x3f')]['length']?_0x5363a3[_0x4ad0('0x3f')]:_0x28a731[_0x4ad0('0x3c')];_0x5363a3['order']=qs[_0x4ad0('0x43')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x5363a3['where']=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0x5869eb[_0x4ad0('0x3a')],_0x28a731[_0x4ad0('0x3b')]));if(_0x5869eb[_0x4ad0('0x3a')]['filter']){_0x5363a3['where']=_[_0x4ad0('0x47')](_0x5363a3[_0x4ad0('0x44')],{'$or':_['map'](_0x5363a3[_0x4ad0('0x3f')],function(_0x33c17a){var _0x4ed51c={};_0x4ed51c[_0x33c17a]={'$like':'%'+_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x46')]+'%'};return _0x4ed51c;})});}_0x5363a3=_[_0x4ad0('0x47')]({},_0x5363a3,_0x5869eb[_0x4ad0('0x48')]);return _0x266138[_0x4ad0('0x68')](_0x5363a3);}})[_0x4ad0('0x2b')](function(_0x11ede4){if(_0x11ede4){_0x44ede8=_0x11ede4[_0x4ad0('0x40')];if(!_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x41')]('nolimit')){_0x5363a3[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0x5869eb[_0x4ad0('0x3a')]['limit']);_0x5363a3[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0x5869eb[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}return _0x266138[_0x4ad0('0x68')](_0x5363a3);}})[_0x4ad0('0x2b')](function(_0x47f1ea){if(_0x47f1ea){return _0x47f1ea?{'count':_0x44ede8,'rows':_0x47f1ea}:null;}})[_0x4ad0('0x2b')](respondWithResult(_0x445013,null))['catch'](handleError(_0x445013,null));};exports['addTeams']=function(_0xf79e0b,_0x8d0787,_0x2ea500){var _0x411f95=_0xf79e0b[_0x4ad0('0x51')][_0x4ad0('0x6a')];return db['Team'][_0x4ad0('0x4a')]({'where':{'id':_0x411f95},'attributes':['id'],'include':[{'model':db[_0x4ad0('0x5f')],'as':_0x4ad0('0x6b'),'attributes':['id',_0x4ad0('0x32'),'online','voicePause',_0x4ad0('0x6c')],'raw':!![]}]})[_0x4ad0('0x2b')](function(_0x50b1dd){if(_0x50b1dd){var _0x3723fa=_['flatMap'](_0x50b1dd,function(_0x160c8d){var _0x240f7b=_0x160c8d['get']({'plain':!![]});return _0x240f7b[_0x4ad0('0x6b')];});return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0xf79e0b[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](function(_0x42f9eb){return db[_0x4ad0('0x6d')][_0x4ad0('0x6e')](function(_0x5a13e5){return _0x42f9eb[_0x4ad0('0x6f')](_0x411f95,{'transaction':_0x5a13e5})[_0x4ad0('0x2b')](function(){return BPromise['each'](_0x3723fa,function(_0x58da96){return db[_0x4ad0('0x5c')][_0x4ad0('0x70')]({'where':{'UserId':_0x58da96['id'],'SmsQueueId':_0xf79e0b[_0x4ad0('0x59')]['id']},'transaction':_0x5a13e5});});})['then'](function(){_0x3723fa[_0x4ad0('0x71')](function(_0x20c7d5){socket[_0x4ad0('0x72')](_0x4ad0('0x73'),{'UserId':_0x20c7d5['id'],'SmsQueueId':_0x42f9eb['id']});});});});});}})['then'](respondWithStatusCode(_0x8d0787,null))[_0x4ad0('0x4c')](handleError(_0x8d0787,null));};exports['removeTeams']=function(_0x2f0466,_0x3dae30,_0x4ae528){return db[_0x4ad0('0x74')][_0x4ad0('0x4a')]({'where':{'id':_0x2f0466[_0x4ad0('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4ad0('0x5f')],'as':_0x4ad0('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4ad0('0x2b')](handleEntityNotFound(_0x3dae30,null))[_0x4ad0('0x2b')](function(_0x57ee56){var _0xea8717=_[_0x4ad0('0x35')](_0x57ee56,'id');var _0x4ff155=[];var _0x50420a=[];var _0x1c0d06=squel[_0x4ad0('0x75')]();_0x1c0d06['field']('tq.TeamId')[_0x4ad0('0x76')](_0x4ad0('0x77'),'tq')[_0x4ad0('0x78')]('user_has_teams','ut',_0x4ad0('0x79'))[_0x4ad0('0x44')](_0x4ad0('0x7a'),_0x2f0466[_0x4ad0('0x59')]['id']);for(var _0x1461ad=0x0;_0x1461ad<_0x57ee56[_0x4ad0('0x40')];_0x1461ad+=0x1){let _0x18ed03=_0x57ee56[_0x1461ad];for(var _0x1d884=0x0;_0x1d884<_0x18ed03['Agents'][_0x4ad0('0x40')];_0x1d884+=0x1){let _0x4b2262=_0x18ed03[_0x4ad0('0x6b')][_0x1d884];var _0x2b3c76=_0x1c0d06[_0x4ad0('0x7b')]();_0x2b3c76[_0x4ad0('0x44')](_0x4ad0('0x7c'),_0x4b2262['id']);_0x50420a[_0x4ad0('0x7d')](db['sequelize'][_0x4ad0('0x3a')](_0x2b3c76[_0x4ad0('0x7e')](),{'type':db[_0x4ad0('0x6d')]['QueryTypes'][_0x4ad0('0x7f')]})['then'](function(_0x26efc3){if(_0x26efc3[_0x4ad0('0x40')]===0x1){return _0x4b2262['id'];}else{var _0x559a69=_[_0x4ad0('0x80')](_[_0x4ad0('0x35')](_0x26efc3,'TeamId'),function(_0x422ea6){return _['includes'](_0xea8717,_0x422ea6);});if(_0x559a69){return _0x4b2262['id'];}}}));}}return BPromise[_0x4ad0('0x81')](_0x50420a)[_0x4ad0('0x2b')](function(_0x21b6d0){_0x4ff155=_(_0x4ff155)[_0x4ad0('0x82')](_0x21b6d0)['compact']()[_0x4ad0('0x83')]();return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x2f0466['params']['id']}})[_0x4ad0('0x2b')](function(_0x47e51f){return db[_0x4ad0('0x6d')][_0x4ad0('0x6e')](function(_0x20b5a){return _0x47e51f[_0x4ad0('0x84')](_0x2f0466[_0x4ad0('0x3a')][_0x4ad0('0x6a')],{'transaction':_0x20b5a})[_0x4ad0('0x2b')](function(){if(!_[_0x4ad0('0x85')](_0x4ff155)){return _0x47e51f[_0x4ad0('0x86')](_0x4ff155,{'transaction':_0x20b5a});}})[_0x4ad0('0x2b')](function(){_0x4ff155[_0x4ad0('0x71')](function(_0xa3e3dc){socket['emit'](_0x4ad0('0x87'),{'UserId':_0xa3e3dc,'SmsQueueId':_0x47e51f['id']});});});});});});})[_0x4ad0('0x2b')](respondWithStatusCode(_0x3dae30,null))['catch'](handleError(_0x3dae30,null));};exports[_0x4ad0('0x88')]=function(_0x131080,_0x324f4b,_0x3159e0){return db[_0x4ad0('0x36')][_0x4ad0('0x56')]({'where':{'id':_0x131080[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x324f4b,null))['then'](function(_0x3a5c63){if(_0x3a5c63){return _0x3a5c63[_0x4ad0('0x88')](_0x131080[_0x4ad0('0x51')][_0x4ad0('0x6a')],_[_0x4ad0('0x89')](_0x131080['body'],['ids','id'])||{})['spread'](function(_0x25cf29){for(var _0x1b317c=0x0;_0x1b317c<_0x131080['body'][_0x4ad0('0x6a')]['length'];_0x1b317c+=0x1){socket[_0x4ad0('0x72')](_0x4ad0('0x73'),{'UserId':Number(_0x131080['body'][_0x4ad0('0x6a')][_0x1b317c]),'SmsQueueId':Number(_0x131080[_0x4ad0('0x59')]['id'])});}return _0x25cf29;});}})[_0x4ad0('0x2b')](respondWithResult(_0x324f4b,null))['catch'](handleError(_0x324f4b,null));};exports[_0x4ad0('0x86')]=function(_0x6c4639,_0x248fb2,_0x45d169){return db['SmsQueue'][_0x4ad0('0x56')]({'where':{'id':_0x6c4639[_0x4ad0('0x59')]['id']}})[_0x4ad0('0x2b')](handleEntityNotFound(_0x248fb2,null))['then'](function(_0x4a221a){if(_0x4a221a){return _0x4a221a[_0x4ad0('0x86')](_0x6c4639[_0x4ad0('0x3a')]['ids'])[_0x4ad0('0x2b')](function(){if(_['isArray'](_0x6c4639[_0x4ad0('0x3a')]['ids'])){for(var _0x129e9a=0x0;_0x129e9a<_0x6c4639[_0x4ad0('0x3a')][_0x4ad0('0x6a')][_0x4ad0('0x40')];_0x129e9a+=0x1){socket[_0x4ad0('0x72')](_0x4ad0('0x87'),{'UserId':Number(_0x6c4639[_0x4ad0('0x3a')][_0x4ad0('0x6a')][_0x129e9a]),'SmsQueueId':Number(_0x6c4639[_0x4ad0('0x59')]['id'])});}}else{socket[_0x4ad0('0x72')](_0x4ad0('0x87'),{'UserId':Number(_0x6c4639['query'][_0x4ad0('0x6a')]),'SmsQueueId':Number(_0x6c4639[_0x4ad0('0x59')]['id'])});}});}})[_0x4ad0('0x2b')](respondWithStatusCode(_0x248fb2,null))['catch'](handleError(_0x248fb2,null));};exports['getAgents']=function(_0xb0b73d,_0x1ac763,_0x15a8fe){var _0x4ce3c8={};var _0x503ddb={};var _0x2e7940;var _0x3d86fa;return db[_0x4ad0('0x36')]['findOne']({'where':{'id':_0xb0b73d[_0x4ad0('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ac763,null))[_0x4ad0('0x2b')](function(_0x2a915b){if(_0x2a915b){_0x2e7940=_0x2a915b;_0x503ddb['model']=_[_0x4ad0('0x4e')](db[_0x4ad0('0x5f')]['rawAttributes']);_0x503ddb[_0x4ad0('0x3a')]=_['keys'](_0xb0b73d[_0x4ad0('0x3a')]);_0x503ddb[_0x4ad0('0x3b')]=_[_0x4ad0('0x3d')](_0x503ddb[_0x4ad0('0x3c')],_0x503ddb['query']);_0x4ce3c8[_0x4ad0('0x3f')]=_[_0x4ad0('0x3d')](_0x503ddb[_0x4ad0('0x3c')],qs[_0x4ad0('0x3e')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x3e')]));_0x4ce3c8[_0x4ad0('0x3f')]=_0x4ce3c8[_0x4ad0('0x3f')][_0x4ad0('0x40')]?_0x4ce3c8['attributes']:_0x503ddb[_0x4ad0('0x3c')];_0x4ce3c8['order']=qs[_0x4ad0('0x43')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x43')]);_0x4ce3c8[_0x4ad0('0x44')]=qs[_0x4ad0('0x3b')](_[_0x4ad0('0x45')](_0xb0b73d[_0x4ad0('0x3a')],_0x503ddb[_0x4ad0('0x3b')]));if(_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x46')]){_0x4ce3c8[_0x4ad0('0x44')]=_[_0x4ad0('0x47')](_0x4ce3c8[_0x4ad0('0x44')],{'$or':_[_0x4ad0('0x35')](_0x4ce3c8[_0x4ad0('0x3f')],function(_0x438142){var _0x59b690={};_0x59b690[_0x438142]={'$like':'%'+_0xb0b73d['query'][_0x4ad0('0x46')]+'%'};return _0x59b690;})});}_0x4ce3c8=_[_0x4ad0('0x47')]({},_0x4ce3c8,_0xb0b73d[_0x4ad0('0x48')]);return _0x2e7940['getAgents'](_0x4ce3c8);}})['then'](function(_0x144a23){if(_0x144a23){_0x3d86fa=_0x144a23[_0x4ad0('0x40')];if(!_0xb0b73d[_0x4ad0('0x3a')]['hasOwnProperty'](_0x4ad0('0x42'))){_0x4ce3c8[_0x4ad0('0x25')]=qs[_0x4ad0('0x25')](_0xb0b73d['query'][_0x4ad0('0x25')]);_0x4ce3c8[_0x4ad0('0x22')]=qs[_0x4ad0('0x22')](_0xb0b73d[_0x4ad0('0x3a')][_0x4ad0('0x22')]);}return _0x2e7940[_0x4ad0('0x8a')](_0x4ce3c8);}})[_0x4ad0('0x2b')](function(_0x2915f2){if(_0x2915f2){return _0x2915f2?{'count':_0x3d86fa,'rows':_0x2915f2}:null;}})[_0x4ad0('0x2b')](respondWithResult(_0x1ac763,null))['catch'](handleError(_0x1ac763,null));}; \ No newline at end of file +var _0xcc6d=['push','SELECT','every','TeamId','includes','all','compact','value','sequelize','removeAgents','emit','userSmsQueue:remove','omit','spread','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','where','merge','VIRTUAL','filter','count','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','hasOwnProperty','sort','pick','SmsQueueId','options','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','SIP','createdAt','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x2c718a,_0x3f7e23){var _0x32ab8f=function(_0x3149d7){while(--_0x3149d7){_0x2c718a['push'](_0x2c718a['shift']());}};_0x32ab8f(++_0x3f7e23);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x123ce8,_0x5822c8){_0x123ce8=_0x123ce8-0x0;var _0x56b4ae=_0xcc6d[_0x123ce8];return _0x56b4ae;};'use strict';var emlformat=require(_0xdcc6('0x0'));var rimraf=require(_0xdcc6('0x1'));var zipdir=require(_0xdcc6('0x2'));var jsonpatch=require(_0xdcc6('0x3'));var rp=require(_0xdcc6('0x4'));var moment=require('moment');var BPromise=require(_0xdcc6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcc6('0x6'));var sox=require('sox');var csv=require(_0xdcc6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdcc6('0x8'));var crypto=require('crypto');var jsforce=require(_0xdcc6('0x9'));var deskjs=require(_0xdcc6('0xa'));var toCsv=require(_0xdcc6('0x7'));var querystring=require(_0xdcc6('0xb'));var Papa=require(_0xdcc6('0xc'));var Redis=require('ioredis');var authService=require(_0xdcc6('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdcc6('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdcc6('0xf'));var db=require(_0xdcc6('0x10'))['db'];config[_0xdcc6('0x11')]=_[_0xdcc6('0x12')](config[_0xdcc6('0x11')],{'host':_0xdcc6('0x13'),'port':0x18eb});var socket=require(_0xdcc6('0x14'))(new Redis(config[_0xdcc6('0x11')]));require(_0xdcc6('0x15'))[_0xdcc6('0x16')](socket);function respondWithStatusCode(_0x499d96,_0x5eb4b7){_0x5eb4b7=_0x5eb4b7||0xcc;return function(_0x38be0c){if(_0x38be0c){return _0x499d96['sendStatus'](_0x5eb4b7);}return _0x499d96[_0xdcc6('0x17')](_0x5eb4b7)[_0xdcc6('0x18')]();};}function respondWithResult(_0x18bf22,_0x403eef){_0x403eef=_0x403eef||0xc8;return function(_0x57b2aa){if(_0x57b2aa){return _0x18bf22[_0xdcc6('0x17')](_0x403eef)[_0xdcc6('0x19')](_0x57b2aa);}};}function respondWithFilteredResult(_0xf21a04,_0x1ce49e){return function(_0x2d0743){if(_0x2d0743){var _0x5d2858=typeof _0x1ce49e[_0xdcc6('0x1a')]===_0xdcc6('0x1b')&&typeof _0x1ce49e[_0xdcc6('0x1c')]===_0xdcc6('0x1b');var _0xb20c60=_0x2d0743['count'];var _0x51ef83=_0x5d2858?0x0:_0x1ce49e[_0xdcc6('0x1a')];var _0x108b81=_0x5d2858?_0x2d0743['count']:_0x1ce49e['offset']+_0x1ce49e['limit'];var _0x27f067;if(_0x108b81>=_0xb20c60){_0x108b81=_0xb20c60;_0x27f067=0xc8;}else{_0x27f067=0xce;}_0xf21a04[_0xdcc6('0x17')](_0x27f067);return _0xf21a04[_0xdcc6('0x1d')](_0xdcc6('0x1e'),_0x51ef83+'-'+_0x108b81+'/'+_0xb20c60)['json'](_0x2d0743);}return null;};}function patchUpdates(_0x4d6942){return function(_0x17cf5d){try{jsonpatch[_0xdcc6('0x1f')](_0x17cf5d,_0x4d6942,!![]);}catch(_0x4115fd){return BPromise['reject'](_0x4115fd);}return _0x17cf5d['save']();};}function saveUpdates(_0x516122,_0xca305e){return function(_0x1b8397){if(_0x1b8397){return _0x1b8397['update'](_0x516122)[_0xdcc6('0x20')](function(_0x126df5){return _0x126df5;});}return null;};}function removeEntity(_0x5166f4,_0x5920e5){return function(_0x449a78){if(_0x449a78){return _0x449a78[_0xdcc6('0x21')]()[_0xdcc6('0x20')](function(){var _0x13cf21=_0x449a78[_0xdcc6('0x22')]({'plain':!![]});var _0x3b8a83=_0xdcc6('0x23');return db[_0xdcc6('0x24')][_0xdcc6('0x21')]({'where':{'type':_0x3b8a83,'resourceId':_0x13cf21['id']}})['then'](function(){return _0x449a78;});})['then'](function(){_0x5166f4[_0xdcc6('0x17')](0xcc)[_0xdcc6('0x18')]();});}};}function handleEntityNotFound(_0x6aa6f9,_0xfd50e1){return function(_0x372c95){if(!_0x372c95){_0x6aa6f9[_0xdcc6('0x25')](0x194);}return _0x372c95;};}function handleError(_0x41f13b,_0x29019d){_0x29019d=_0x29019d||0x1f4;return function(_0x32dec7){logger['error'](_0x32dec7[_0xdcc6('0x26')]);if(_0x32dec7['name']){delete _0x32dec7[_0xdcc6('0x27')];}_0x41f13b['status'](_0x29019d)[_0xdcc6('0x28')](_0x32dec7);};}exports[_0xdcc6('0x29')]=function(_0x57adf2,_0x2b1e27){var _0x4d6330={},_0x568797={},_0x7b2773={'count':0x0,'rows':[]};var _0x152f41=_['map'](db[_0xdcc6('0x2a')][_0xdcc6('0x2b')],function(_0x3f97ff){return{'name':_0x3f97ff[_0xdcc6('0x2c')],'type':_0x3f97ff[_0xdcc6('0x2d')][_0xdcc6('0x2e')]};});_0x568797[_0xdcc6('0x2f')]=_[_0xdcc6('0x30')](_0x152f41,_0xdcc6('0x27'));_0x568797['query']=_[_0xdcc6('0x31')](_0x57adf2[_0xdcc6('0x32')]);_0x568797[_0xdcc6('0x33')]=_[_0xdcc6('0x34')](_0x568797['model'],_0x568797['query']);_0x4d6330[_0xdcc6('0x35')]=_[_0xdcc6('0x34')](_0x568797[_0xdcc6('0x2f')],qs['fields'](_0x57adf2[_0xdcc6('0x32')][_0xdcc6('0x36')]));_0x4d6330[_0xdcc6('0x35')]=_0x4d6330['attributes'][_0xdcc6('0x37')]?_0x4d6330[_0xdcc6('0x35')]:_0x568797['model'];if(!_0x57adf2[_0xdcc6('0x32')]['hasOwnProperty']('nolimit')){_0x4d6330[_0xdcc6('0x1c')]=qs['limit'](_0x57adf2[_0xdcc6('0x32')]['limit']);_0x4d6330[_0xdcc6('0x1a')]=qs[_0xdcc6('0x1a')](_0x57adf2[_0xdcc6('0x32')][_0xdcc6('0x1a')]);}_0x4d6330[_0xdcc6('0x38')]=qs['sort'](_0x57adf2[_0xdcc6('0x32')]['sort']);_0x4d6330[_0xdcc6('0x39')]=qs[_0xdcc6('0x33')](_['pick'](_0x57adf2[_0xdcc6('0x32')],_0x568797[_0xdcc6('0x33')]),_0x152f41);if(_0x57adf2[_0xdcc6('0x32')]['filter']){_0x4d6330[_0xdcc6('0x39')]=_[_0xdcc6('0x3a')](_0x4d6330[_0xdcc6('0x39')],{'$or':_[_0xdcc6('0x30')](_0x152f41,function(_0x1c40a3){if(_0x1c40a3[_0xdcc6('0x2d')]!==_0xdcc6('0x3b')){var _0x5518ca={};_0x5518ca[_0x1c40a3[_0xdcc6('0x27')]]={'$like':'%'+_0x57adf2['query'][_0xdcc6('0x3c')]+'%'};return _0x5518ca;}})});}_0x4d6330=_['merge']({},_0x4d6330,_0x57adf2['options']);var _0x303132={'where':_0x4d6330['where']};return db['SmsQueue']['count'](_0x303132)[_0xdcc6('0x20')](function(_0x13e2ea){_0x7b2773[_0xdcc6('0x3d')]=_0x13e2ea;if(_0x57adf2[_0xdcc6('0x32')]['includeAll']){_0x4d6330[_0xdcc6('0x3e')]=[{'all':!![]}];}return db[_0xdcc6('0x2a')][_0xdcc6('0x3f')](_0x4d6330);})[_0xdcc6('0x20')](function(_0x57ee41){_0x7b2773[_0xdcc6('0x40')]=_0x57ee41;return _0x7b2773;})[_0xdcc6('0x20')](respondWithFilteredResult(_0x2b1e27,_0x4d6330))[_0xdcc6('0x41')](handleError(_0x2b1e27,null));};exports[_0xdcc6('0x42')]=function(_0x39448f,_0x117311){var _0xf4078c={'raw':!![],'where':{'id':_0x39448f['params']['id']}},_0xd8e54a={};_0xd8e54a[_0xdcc6('0x2f')]=_[_0xdcc6('0x31')](db['SmsQueue'][_0xdcc6('0x2b')]);_0xd8e54a[_0xdcc6('0x32')]=_[_0xdcc6('0x31')](_0x39448f[_0xdcc6('0x32')]);_0xd8e54a[_0xdcc6('0x33')]=_[_0xdcc6('0x34')](_0xd8e54a[_0xdcc6('0x2f')],_0xd8e54a[_0xdcc6('0x32')]);_0xf4078c[_0xdcc6('0x35')]=_[_0xdcc6('0x34')](_0xd8e54a[_0xdcc6('0x2f')],qs['fields'](_0x39448f[_0xdcc6('0x32')][_0xdcc6('0x36')]));_0xf4078c[_0xdcc6('0x35')]=_0xf4078c[_0xdcc6('0x35')]['length']?_0xf4078c[_0xdcc6('0x35')]:_0xd8e54a[_0xdcc6('0x2f')];if(_0x39448f[_0xdcc6('0x32')]['includeAll']){_0xf4078c[_0xdcc6('0x3e')]=[{'all':!![]}];}_0xf4078c=_[_0xdcc6('0x3a')]({},_0xf4078c,_0x39448f['options']);return db['SmsQueue'][_0xdcc6('0x43')](_0xf4078c)[_0xdcc6('0x20')](handleEntityNotFound(_0x117311,null))[_0xdcc6('0x20')](respondWithResult(_0x117311,null))[_0xdcc6('0x41')](handleError(_0x117311,null));};exports['create']=function(_0x154d8c,_0x35300f){return db[_0xdcc6('0x2a')][_0xdcc6('0x44')](_0x154d8c[_0xdcc6('0x45')],{})[_0xdcc6('0x20')](function(_0x4c2334){var _0x3dea7a=_0x154d8c['user'][_0xdcc6('0x22')]({'plain':!![]});if(!_0x3dea7a)throw new Error(_0xdcc6('0x46'));if(_0x3dea7a[_0xdcc6('0x47')]===_0xdcc6('0x48')){var _0x384fc6=_0x4c2334['get']({'plain':!![]});var _0x265f03=_0xdcc6('0x23');return db[_0xdcc6('0x49')][_0xdcc6('0x43')]({'where':{'name':_0x265f03,'userProfileId':_0x3dea7a[_0xdcc6('0x4a')]},'raw':!![]})[_0xdcc6('0x20')](function(_0x300ca3){if(_0x300ca3&&_0x300ca3['autoAssociation']===0x0){return db[_0xdcc6('0x24')][_0xdcc6('0x44')]({'name':_0x384fc6[_0xdcc6('0x27')],'resourceId':_0x384fc6['id'],'type':_0x300ca3['name'],'sectionId':_0x300ca3['id']},{})[_0xdcc6('0x20')](function(){return _0x4c2334;});}else{return _0x4c2334;}})[_0xdcc6('0x41')](function(_0x53d162){logger[_0xdcc6('0x4b')](_0xdcc6('0x4c'),_0x53d162);throw _0x53d162;});}return _0x4c2334;})[_0xdcc6('0x20')](respondWithResult(_0x35300f,0xc9))[_0xdcc6('0x41')](handleError(_0x35300f,null));};exports[_0xdcc6('0x4d')]=function(_0x127bc0,_0x107c76){if(_0x127bc0[_0xdcc6('0x45')]['id']){delete _0x127bc0['body']['id'];}return db[_0xdcc6('0x2a')][_0xdcc6('0x43')]({'where':{'id':_0x127bc0[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x107c76,null))['then'](saveUpdates(_0x127bc0['body'],null))[_0xdcc6('0x20')](respondWithResult(_0x107c76,null))[_0xdcc6('0x41')](handleError(_0x107c76,null));};exports[_0xdcc6('0x21')]=function(_0x3f0ae0,_0x2aa5d5){return db[_0xdcc6('0x2a')]['find']({'where':{'id':_0x3f0ae0[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x2aa5d5,null))['then'](removeEntity(_0x2aa5d5,null))[_0xdcc6('0x41')](handleError(_0x2aa5d5,null));};exports[_0xdcc6('0x4f')]=function(_0x247fff,_0x52b5c8){return db[_0xdcc6('0x2a')][_0xdcc6('0x4f')]()[_0xdcc6('0x20')](respondWithResult(_0x52b5c8,null))[_0xdcc6('0x41')](handleError(_0x52b5c8,null));};exports[_0xdcc6('0x50')]=function(_0x110957,_0x82513d,_0x53e1c1){var _0x5e5321={'raw':!![],'where':{}},_0x2d4657={},_0x8f1034;return db[_0xdcc6('0x2a')]['findOne']({'where':{'id':_0x110957[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x82513d,null))['then'](function(_0x1b6a8b){if(_0x1b6a8b){_0x8f1034=_0x1b6a8b[_0xdcc6('0x22')]({'plain':!![]});_0x2d4657[_0xdcc6('0x2f')]=_[_0xdcc6('0x31')](db['UserSmsQueue'][_0xdcc6('0x2b')]);_0x2d4657[_0xdcc6('0x32')]=_[_0xdcc6('0x31')](_0x110957['query']);_0x2d4657[_0xdcc6('0x33')]=_[_0xdcc6('0x34')](_0x2d4657[_0xdcc6('0x2f')],_0x2d4657[_0xdcc6('0x32')]);_0x5e5321[_0xdcc6('0x35')]=_['intersection'](_0x2d4657['model'],qs[_0xdcc6('0x36')](_0x110957[_0xdcc6('0x32')][_0xdcc6('0x36')]));_0x5e5321[_0xdcc6('0x35')]=_0x5e5321['attributes'][_0xdcc6('0x37')]?_0x5e5321[_0xdcc6('0x35')]:_0x2d4657[_0xdcc6('0x2f')];if(!_0x110957[_0xdcc6('0x32')][_0xdcc6('0x51')]('nolimit')){_0x5e5321[_0xdcc6('0x1c')]=qs['limit'](_0x110957[_0xdcc6('0x32')][_0xdcc6('0x1c')]);_0x5e5321[_0xdcc6('0x1a')]=qs[_0xdcc6('0x1a')](_0x110957['query'][_0xdcc6('0x1a')]);}_0x5e5321[_0xdcc6('0x38')]=qs[_0xdcc6('0x52')](_0x110957['query'][_0xdcc6('0x52')]);_0x5e5321[_0xdcc6('0x39')]=qs['filters'](_[_0xdcc6('0x53')](_0x110957[_0xdcc6('0x32')],_0x2d4657['filters']));_0x5e5321[_0xdcc6('0x39')][_0xdcc6('0x54')]=_0x1b6a8b['id'];if(_0x110957['query'][_0xdcc6('0x3c')]){_0x5e5321[_0xdcc6('0x39')]=_['merge'](_0x5e5321[_0xdcc6('0x39')],{'$or':_['map'](_0x5e5321[_0xdcc6('0x35')],function(_0x14d7cb){var _0x4f6c38={};_0x4f6c38[_0x14d7cb]={'$like':'%'+_0x110957[_0xdcc6('0x32')][_0xdcc6('0x3c')]+'%'};return _0x4f6c38;})});}_0x5e5321=_[_0xdcc6('0x3a')]({},_0x5e5321,_0x110957[_0xdcc6('0x55')]);return db[_0xdcc6('0x56')][_0xdcc6('0x3f')](_0x5e5321);}})[_0xdcc6('0x20')](function(_0x5c874e){if(_0x5c874e){return db[_0xdcc6('0x57')][_0xdcc6('0x58')]({'where':{'id':_[_0xdcc6('0x30')](_0x5c874e,_0xdcc6('0x59')),'role':_0xdcc6('0x5a')},'attributes':['id',_0xdcc6('0x27'),_0xdcc6('0x5b'),_0xdcc6('0x5c'),'createdAt']});}})['then'](function(_0x405c73){if(_0x405c73){return{'count':_0x405c73[_0xdcc6('0x3d')],'rows':_[_0xdcc6('0x30')](_0x405c73[_0xdcc6('0x40')],function(_0x19543e){return{'membername':_0x19543e['name'],'UserId':_0x19543e['id'],'queue_name':_0x8f1034[_0xdcc6('0x27')],'SmsQueueId':_0x8f1034['id'],'interface':util[_0xdcc6('0x5d')]('%s/%s',_0xdcc6('0x5e'),_0x19543e[_0xdcc6('0x27')]),'penalty':0x0,'paused':_0x19543e['smsPause'],'createdAt':_0x19543e[_0xdcc6('0x5f')],'updatedAt':_0x19543e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x82513d,_0x5e5321))[_0xdcc6('0x41')](handleError(_0x82513d,null));};exports[_0xdcc6('0x60')]=function(_0x1e0efa,_0x31af39,_0x5f56d6){var _0x4a0145={};var _0x17dd36={};var _0x4d19be;var _0x39ef8e;return db['SmsQueue'][_0xdcc6('0x61')]({'where':{'id':_0x1e0efa[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x31af39,null))[_0xdcc6('0x20')](function(_0x3b46ff){if(_0x3b46ff){_0x4d19be=_0x3b46ff;_0x17dd36['model']=_[_0xdcc6('0x31')](db[_0xdcc6('0x62')][_0xdcc6('0x2b')]);_0x17dd36[_0xdcc6('0x32')]=_[_0xdcc6('0x31')](_0x1e0efa[_0xdcc6('0x32')]);_0x17dd36[_0xdcc6('0x33')]=_[_0xdcc6('0x34')](_0x17dd36[_0xdcc6('0x2f')],_0x17dd36[_0xdcc6('0x32')]);_0x4a0145['attributes']=_[_0xdcc6('0x34')](_0x17dd36['model'],qs[_0xdcc6('0x36')](_0x1e0efa[_0xdcc6('0x32')][_0xdcc6('0x36')]));_0x4a0145[_0xdcc6('0x35')]=_0x4a0145[_0xdcc6('0x35')][_0xdcc6('0x37')]?_0x4a0145[_0xdcc6('0x35')]:_0x17dd36[_0xdcc6('0x2f')];_0x4a0145[_0xdcc6('0x38')]=qs['sort'](_0x1e0efa[_0xdcc6('0x32')][_0xdcc6('0x52')]);_0x4a0145[_0xdcc6('0x39')]=qs['filters'](_[_0xdcc6('0x53')](_0x1e0efa['query'],_0x17dd36[_0xdcc6('0x33')]));if(_0x1e0efa[_0xdcc6('0x32')]['filter']){_0x4a0145[_0xdcc6('0x39')]=_[_0xdcc6('0x3a')](_0x4a0145[_0xdcc6('0x39')],{'$or':_[_0xdcc6('0x30')](_0x4a0145['attributes'],function(_0x29067a){var _0x68f8e7={};_0x68f8e7[_0x29067a]={'$like':'%'+_0x1e0efa[_0xdcc6('0x32')][_0xdcc6('0x3c')]+'%'};return _0x68f8e7;})});}_0x4a0145=_[_0xdcc6('0x3a')]({},_0x4a0145,_0x1e0efa['options']);return _0x4d19be[_0xdcc6('0x60')](_0x4a0145);}})[_0xdcc6('0x20')](function(_0x200c4f){if(_0x200c4f){_0x39ef8e=_0x200c4f[_0xdcc6('0x37')];if(!_0x1e0efa[_0xdcc6('0x32')][_0xdcc6('0x51')](_0xdcc6('0x63'))){_0x4a0145[_0xdcc6('0x1c')]=qs[_0xdcc6('0x1c')](_0x1e0efa['query']['limit']);_0x4a0145[_0xdcc6('0x1a')]=qs[_0xdcc6('0x1a')](_0x1e0efa[_0xdcc6('0x32')][_0xdcc6('0x1a')]);}return _0x4d19be['getTeams'](_0x4a0145);}})[_0xdcc6('0x20')](function(_0xf748fe){if(_0xf748fe){return _0xf748fe?{'count':_0x39ef8e,'rows':_0xf748fe}:null;}})[_0xdcc6('0x20')](respondWithResult(_0x31af39,null))[_0xdcc6('0x41')](handleError(_0x31af39,null));};exports[_0xdcc6('0x64')]=function(_0x162f34,_0x36299c,_0x138bb6){var _0x197926=_0x162f34[_0xdcc6('0x45')][_0xdcc6('0x65')];return db[_0xdcc6('0x62')][_0xdcc6('0x3f')]({'where':{'id':_0x197926},'attributes':['id'],'include':[{'model':db[_0xdcc6('0x57')],'as':_0xdcc6('0x66'),'attributes':['id',_0xdcc6('0x27'),'online','voicePause',_0xdcc6('0x67')],'raw':!![]}]})[_0xdcc6('0x20')](function(_0x10f2d9){if(_0x10f2d9){var _0x3005a8=_[_0xdcc6('0x68')](_0x10f2d9,function(_0x1a9e76){var _0x460024=_0x1a9e76[_0xdcc6('0x22')]({'plain':!![]});return _0x460024[_0xdcc6('0x66')];});return db['SmsQueue'][_0xdcc6('0x43')]({'where':{'id':_0x162f34[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](function(_0x73234c){return db['sequelize'][_0xdcc6('0x69')](function(_0x3881f6){return _0x73234c['addTeams'](_0x197926,{'transaction':_0x3881f6})[_0xdcc6('0x20')](function(){return BPromise[_0xdcc6('0x6a')](_0x3005a8,function(_0x2a8fbf){return db[_0xdcc6('0x56')][_0xdcc6('0x6b')]({'where':{'UserId':_0x2a8fbf['id'],'SmsQueueId':_0x162f34[_0xdcc6('0x4e')]['id']},'transaction':_0x3881f6});});})[_0xdcc6('0x20')](function(){_0x3005a8[_0xdcc6('0x6c')](function(_0x397706){socket['emit']('userSmsQueue:save',{'UserId':_0x397706['id'],'SmsQueueId':_0x73234c['id']});});});});});}})[_0xdcc6('0x20')](respondWithStatusCode(_0x36299c,null))[_0xdcc6('0x41')](handleError(_0x36299c,null));};exports[_0xdcc6('0x6d')]=function(_0x1adcaa,_0xc9f71,_0x254962){return db['Team'][_0xdcc6('0x3f')]({'where':{'id':_0x1adcaa[_0xdcc6('0x32')][_0xdcc6('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdcc6('0x66'),'attributes':['id'],'raw':!![]}]})[_0xdcc6('0x20')](handleEntityNotFound(_0xc9f71,null))['then'](function(_0x192094){var _0x2e7c9c=_['map'](_0x192094,'id');var _0x327753=[];var _0x28cfbc=[];var _0x17aa61=squel[_0xdcc6('0x6e')]();_0x17aa61[_0xdcc6('0x6f')](_0xdcc6('0x70'))[_0xdcc6('0x71')](_0xdcc6('0x72'),'tq')[_0xdcc6('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdcc6('0x39')](_0xdcc6('0x74'),_0x1adcaa[_0xdcc6('0x4e')]['id']);for(var _0x21836b=0x0;_0x21836b<_0x192094[_0xdcc6('0x37')];_0x21836b+=0x1){let _0x5c1e7f=_0x192094[_0x21836b];for(var _0x2c8da6=0x0;_0x2c8da6<_0x5c1e7f[_0xdcc6('0x66')][_0xdcc6('0x37')];_0x2c8da6+=0x1){let _0x4d97cd=_0x5c1e7f[_0xdcc6('0x66')][_0x2c8da6];var _0x20b562=_0x17aa61[_0xdcc6('0x75')]();_0x20b562[_0xdcc6('0x39')](_0xdcc6('0x76'),_0x4d97cd['id']);_0x28cfbc[_0xdcc6('0x77')](db['sequelize'][_0xdcc6('0x32')](_0x20b562['toString'](),{'type':db['sequelize']['QueryTypes'][_0xdcc6('0x78')]})[_0xdcc6('0x20')](function(_0x248ec8){if(_0x248ec8['length']===0x1){return _0x4d97cd['id'];}else{var _0x51207f=_[_0xdcc6('0x79')](_[_0xdcc6('0x30')](_0x248ec8,_0xdcc6('0x7a')),function(_0x280de2){return _[_0xdcc6('0x7b')](_0x2e7c9c,_0x280de2);});if(_0x51207f){return _0x4d97cd['id'];}}}));}}return BPromise[_0xdcc6('0x7c')](_0x28cfbc)['then'](function(_0x336c46){_0x327753=_(_0x327753)['union'](_0x336c46)[_0xdcc6('0x7d')]()[_0xdcc6('0x7e')]();return db[_0xdcc6('0x2a')][_0xdcc6('0x43')]({'where':{'id':_0x1adcaa[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](function(_0xe0b1c1){return db[_0xdcc6('0x7f')][_0xdcc6('0x69')](function(_0x2bc6f6){return _0xe0b1c1[_0xdcc6('0x6d')](_0x1adcaa[_0xdcc6('0x32')]['ids'],{'transaction':_0x2bc6f6})[_0xdcc6('0x20')](function(){if(!_['isEmpty'](_0x327753)){return _0xe0b1c1[_0xdcc6('0x80')](_0x327753,{'transaction':_0x2bc6f6});}})[_0xdcc6('0x20')](function(){_0x327753[_0xdcc6('0x6c')](function(_0x1db77b){socket[_0xdcc6('0x81')](_0xdcc6('0x82'),{'UserId':_0x1db77b,'SmsQueueId':_0xe0b1c1['id']});});});});});});})[_0xdcc6('0x20')](respondWithStatusCode(_0xc9f71,null))[_0xdcc6('0x41')](handleError(_0xc9f71,null));};exports['addAgents']=function(_0x35ace4,_0x51ed33,_0x1ecd92){return db[_0xdcc6('0x2a')][_0xdcc6('0x43')]({'where':{'id':_0x35ace4[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x51ed33,null))[_0xdcc6('0x20')](function(_0x5d8332){if(_0x5d8332){return _0x5d8332['addAgents'](_0x35ace4[_0xdcc6('0x45')][_0xdcc6('0x65')],_[_0xdcc6('0x83')](_0x35ace4['body'],[_0xdcc6('0x65'),'id'])||{})[_0xdcc6('0x84')](function(_0x4d958a){for(var _0x5e2680=0x0;_0x5e2680<_0x35ace4[_0xdcc6('0x45')][_0xdcc6('0x65')]['length'];_0x5e2680+=0x1){socket['emit'](_0xdcc6('0x85'),{'UserId':Number(_0x35ace4[_0xdcc6('0x45')][_0xdcc6('0x65')][_0x5e2680]),'SmsQueueId':Number(_0x35ace4[_0xdcc6('0x4e')]['id'])});}return _0x4d958a;});}})['then'](respondWithResult(_0x51ed33,null))[_0xdcc6('0x41')](handleError(_0x51ed33,null));};exports[_0xdcc6('0x80')]=function(_0x2c9838,_0x11f617,_0x2dfe76){return db[_0xdcc6('0x2a')][_0xdcc6('0x43')]({'where':{'id':_0x2c9838[_0xdcc6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11f617,null))[_0xdcc6('0x20')](function(_0xb77687){if(_0xb77687){return _0xb77687[_0xdcc6('0x80')](_0x2c9838[_0xdcc6('0x32')][_0xdcc6('0x65')])[_0xdcc6('0x20')](function(){if(_[_0xdcc6('0x86')](_0x2c9838['query'][_0xdcc6('0x65')])){for(var _0x302a35=0x0;_0x302a35<_0x2c9838[_0xdcc6('0x32')]['ids'][_0xdcc6('0x37')];_0x302a35+=0x1){socket[_0xdcc6('0x81')](_0xdcc6('0x82'),{'UserId':Number(_0x2c9838[_0xdcc6('0x32')]['ids'][_0x302a35]),'SmsQueueId':Number(_0x2c9838[_0xdcc6('0x4e')]['id'])});}}else{socket[_0xdcc6('0x81')](_0xdcc6('0x82'),{'UserId':Number(_0x2c9838['query'][_0xdcc6('0x65')]),'SmsQueueId':Number(_0x2c9838['params']['id'])});}});}})[_0xdcc6('0x20')](respondWithStatusCode(_0x11f617,null))[_0xdcc6('0x41')](handleError(_0x11f617,null));};exports['getAgents']=function(_0x49ec86,_0x1914b7,_0x4f6896){var _0x805279={};var _0x25ad6b={};var _0x32d48e;var _0x133fa4;return db[_0xdcc6('0x2a')]['findOne']({'where':{'id':_0x49ec86[_0xdcc6('0x4e')]['id']}})[_0xdcc6('0x20')](handleEntityNotFound(_0x1914b7,null))['then'](function(_0x34ec7c){if(_0x34ec7c){_0x32d48e=_0x34ec7c;_0x25ad6b['model']=_[_0xdcc6('0x31')](db[_0xdcc6('0x57')][_0xdcc6('0x2b')]);_0x25ad6b[_0xdcc6('0x32')]=_[_0xdcc6('0x31')](_0x49ec86[_0xdcc6('0x32')]);_0x25ad6b[_0xdcc6('0x33')]=_[_0xdcc6('0x34')](_0x25ad6b[_0xdcc6('0x2f')],_0x25ad6b[_0xdcc6('0x32')]);_0x805279[_0xdcc6('0x35')]=_[_0xdcc6('0x34')](_0x25ad6b[_0xdcc6('0x2f')],qs[_0xdcc6('0x36')](_0x49ec86[_0xdcc6('0x32')][_0xdcc6('0x36')]));_0x805279['attributes']=_0x805279[_0xdcc6('0x35')]['length']?_0x805279[_0xdcc6('0x35')]:_0x25ad6b[_0xdcc6('0x2f')];_0x805279[_0xdcc6('0x38')]=qs[_0xdcc6('0x52')](_0x49ec86[_0xdcc6('0x32')][_0xdcc6('0x52')]);_0x805279[_0xdcc6('0x39')]=qs['filters'](_[_0xdcc6('0x53')](_0x49ec86[_0xdcc6('0x32')],_0x25ad6b['filters']));if(_0x49ec86['query'][_0xdcc6('0x3c')]){_0x805279[_0xdcc6('0x39')]=_[_0xdcc6('0x3a')](_0x805279[_0xdcc6('0x39')],{'$or':_[_0xdcc6('0x30')](_0x805279[_0xdcc6('0x35')],function(_0x91bc60){var _0x311a5b={};_0x311a5b[_0x91bc60]={'$like':'%'+_0x49ec86[_0xdcc6('0x32')][_0xdcc6('0x3c')]+'%'};return _0x311a5b;})});}_0x805279=_[_0xdcc6('0x3a')]({},_0x805279,_0x49ec86['options']);return _0x32d48e[_0xdcc6('0x87')](_0x805279);}})['then'](function(_0x42a24a){if(_0x42a24a){_0x133fa4=_0x42a24a[_0xdcc6('0x37')];if(!_0x49ec86[_0xdcc6('0x32')]['hasOwnProperty'](_0xdcc6('0x63'))){_0x805279[_0xdcc6('0x1c')]=qs[_0xdcc6('0x1c')](_0x49ec86[_0xdcc6('0x32')][_0xdcc6('0x1c')]);_0x805279[_0xdcc6('0x1a')]=qs['offset'](_0x49ec86[_0xdcc6('0x32')]['offset']);}return _0x32d48e[_0xdcc6('0x87')](_0x805279);}})[_0xdcc6('0x20')](function(_0x3472b4){if(_0x3472b4){return _0x3472b4?{'count':_0x133fa4,'rows':_0x3472b4}:null;}})[_0xdcc6('0x20')](respondWithResult(_0x1914b7,null))[_0xdcc6('0x41')](handleError(_0x1914b7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c223e0c..19b4d53 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 _0x6ba3=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x4e36f2,_0xac97f0){var _0x53a43=function(_0x30c337){while(--_0x30c337){_0x4e36f2['push'](_0x4e36f2['shift']());}};_0x53a43(++_0xac97f0);}(_0x6ba3,0x1d2));var _0x36ba=function(_0x2af235,_0x45f664){_0x2af235=_0x2af235-0x0;var _0x593c0e=_0x6ba3[_0x2af235];return _0x593c0e;};'use strict';var EventEmitter=require(_0x36ba('0x0'));var SmsQueue=require(_0x36ba('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36ba('0x2'),'afterUpdate':'update','afterDestroy':_0x36ba('0x3')};function emitEvent(_0x2dc57e){return function(_0x56d763,_0x45ff1e,_0x15afa4){SmsQueueEvents[_0x36ba('0x4')](_0x2dc57e+':'+_0x56d763['id'],_0x56d763);SmsQueueEvents[_0x36ba('0x4')](_0x2dc57e,_0x56d763);_0x15afa4(null);};}for(var e in events){if(events[_0x36ba('0x5')](e)){var event=events[e];SmsQueue[_0x36ba('0x6')](e,emitEvent(event));}}module[_0x36ba('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x2efc=['update','emit','hook','events','../../mysqldb','SmsQueue','save'];(function(_0x1a7947,_0x2dd8e9){var _0x8b86f=function(_0x173e4c){while(--_0x173e4c){_0x1a7947['push'](_0x1a7947['shift']());}};_0x8b86f(++_0x2dd8e9);}(_0x2efc,0x81));var _0xc2ef=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x2efc[_0x10b317];return _0x1e3054;};'use strict';var EventEmitter=require(_0xc2ef('0x0'));var SmsQueue=require(_0xc2ef('0x1'))['db'][_0xc2ef('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc2ef('0x3'),'afterUpdate':_0xc2ef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5692ad){return function(_0x38a516,_0x12b02f,_0x54f4cd){SmsQueueEvents[_0xc2ef('0x5')](_0x5692ad+':'+_0x38a516['id'],_0x38a516);SmsQueueEvents[_0xc2ef('0x5')](_0x5692ad,_0x38a516);_0x54f4cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc2ef('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c1c169b..ecf96cd 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 _0x9d5b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x436da3,_0x4fa9da){var _0x40627c=function(_0x129285){while(--_0x129285){_0x436da3['push'](_0x436da3['shift']());}};_0x40627c(++_0x4fa9da);}(_0x9d5b,0x1d4));var _0xb9d5=function(_0x33cd54,_0x10f85d){_0x33cd54=_0x33cd54-0x0;var _0x48285a=_0x9d5b[_0x33cd54];return _0x48285a;};'use strict';var _=require(_0xb9d5('0x0'));var util=require('util');var logger=require(_0xb9d5('0x1'))('api');var moment=require(_0xb9d5('0x2'));var BPromise=require(_0xb9d5('0x3'));var rp=require(_0xb9d5('0x4'));var fs=require('fs');var path=require(_0xb9d5('0x5'));var rimraf=require(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var attributes=require(_0xb9d5('0x8'));module[_0xb9d5('0x9')]=function(_0x3ba55f,_0x12cd83){return _0x3ba55f[_0xb9d5('0xa')](_0xb9d5('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x353313,_0x5c3686){var _0x4cb750=function(_0x17ac7e){while(--_0x17ac7e){_0x353313['push'](_0x353313['shift']());}};_0x4cb750(++_0x5c3686);}(_0x6c76,0x1d9));var _0x66c7=function(_0x1f1bf8,_0x48c57d){_0x1f1bf8=_0x1f1bf8-0x0;var _0xcefd99=_0x6c76[_0x1f1bf8];return _0xcefd99;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require(_0x66c7('0x5'));var rp=require(_0x66c7('0x6'));var fs=require('fs');var path=require(_0x66c7('0x7'));var rimraf=require(_0x66c7('0x8'));var config=require(_0x66c7('0x9'));var attributes=require(_0x66c7('0xa'));module[_0x66c7('0xb')]=function(_0x487744,_0x3dd2f0){return _0x487744[_0x66c7('0xc')](_0x66c7('0xd'),attributes,{'tableName':_0x66c7('0xe'),'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 bb51a3c..815a4c0 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 _0xe330=['./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetSmsQueue','findAll','options','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xe330,0x1d1));var _0x0e33=function(_0x1a1240,_0x1ce040){_0x1a1240=_0x1a1240-0x0;var _0x2f5d6b=_0xe330[_0x1a1240];return _0x2f5d6b;};'use strict';var _=require(_0x0e33('0x0'));var util=require(_0x0e33('0x1'));var moment=require(_0x0e33('0x2'));var BPromise=require(_0x0e33('0x3'));var rs=require(_0x0e33('0x4'));var fs=require('fs');var Redis=require(_0x0e33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e33('0x6'));var logger=require(_0x0e33('0x7'))('rpc');var config=require(_0x0e33('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0e33('0x9')][_0x0e33('0xa')]({'port':0x232a});config['redis']=_[_0x0e33('0xb')](config['redis'],{'host':_0x0e33('0xc'),'port':0x18eb});var socket=require(_0x0e33('0xd'))(new Redis(config[_0x0e33('0xe')]));require(_0x0e33('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d1e30,_0x38fbec,_0x47714a){return new BPromise(function(_0x153f90,_0x30a618){return client[_0x0e33('0x10')](_0x5d1e30,_0x47714a)[_0x0e33('0x11')](function(_0x6a9860){logger['info'](_0x0e33('0x12'),_0x38fbec,'request\x20sent');logger[_0x0e33('0x13')](_0x0e33('0x14'),_0x38fbec,_0x0e33('0x15'),JSON[_0x0e33('0x16')](_0x6a9860));if(_0x6a9860[_0x0e33('0x17')]){if(_0x6a9860[_0x0e33('0x17')]['code']===0x1f4){logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);return _0x30a618(_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);}logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);return _0x153f90(_0x6a9860[_0x0e33('0x17')][_0x0e33('0x18')]);}else{logger[_0x0e33('0x19')](_0x0e33('0x12'),_0x38fbec,_0x0e33('0x15'));_0x153f90(_0x6a9860['result']['message']);}})[_0x0e33('0x1a')](function(_0x4d7237){logger[_0x0e33('0x17')](_0x0e33('0x12'),_0x38fbec,_0x4d7237);_0x30a618(_0x4d7237);});});}exports[_0x0e33('0x1b')]=function(_0x37bc5a){var _0x5eb435=this;return new Promise(function(_0x4c32d3,_0x46ab62){return db['SmsQueue'][_0x0e33('0x1c')]({'raw':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a['options']['raw']===undefined?!![]:![]:!![],'where':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a['options']['where']||null:null,'attributes':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x1e')]||null:null,'limit':_0x37bc5a['options']?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x1f')]||null:null,'include':_0x37bc5a[_0x0e33('0x1d')]?_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x37bc5a[_0x0e33('0x1d')][_0x0e33('0x20')],function(_0x319388){return{'model':db[_0x319388[_0x0e33('0x22')]],'as':_0x319388['as'],'attributes':_0x319388[_0x0e33('0x1e')],'include':_0x319388[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x319388['include'],function(_0xba1a7a){return{'model':db[_0xba1a7a[_0x0e33('0x22')]],'as':_0xba1a7a['as'],'attributes':_0xba1a7a['attributes'],'include':_0xba1a7a[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0xba1a7a[_0x0e33('0x20')],function(_0x5874f1){return{'model':db[_0x5874f1['model']],'as':_0x5874f1['as'],'attributes':_0x5874f1[_0x0e33('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5597){logger[_0x0e33('0x19')]('GetSmsQueue',_0x37bc5a);logger['debug'](_0x0e33('0x1b'),_0x37bc5a,JSON['stringify'](_0x4b5597));_0x4c32d3(_0x4b5597);})[_0x0e33('0x1a')](function(_0x2f2ce1){logger['error'](_0x0e33('0x1b'),_0x2f2ce1[_0x0e33('0x18')],_0x37bc5a);_0x46ab62(_0x5eb435[_0x0e33('0x17')](0x1f4,_0x2f2ce1[_0x0e33('0x18')]));});});};exports[_0x0e33('0x23')]=function(_0x430ba2){var _0x43dbfc=this;return new Promise(function(_0x5e445c,_0x392c29){return db[_0x0e33('0x24')][_0x0e33('0x25')]({'raw':_0x430ba2['options']?_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x26')]===undefined?!![]:![]:!![],'where':_0x430ba2[_0x0e33('0x1d')]?_0x430ba2['options'][_0x0e33('0x27')]||null:null,'attributes':_0x430ba2['options']?_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x1e')]||null:null,'include':_0x430ba2['options']?_0x430ba2['options'][_0x0e33('0x20')]?_['map'](_0x430ba2[_0x0e33('0x1d')][_0x0e33('0x20')],function(_0x502048){return{'model':db[_0x502048[_0x0e33('0x22')]],'as':_0x502048['as'],'attributes':_0x502048[_0x0e33('0x1e')],'include':_0x502048[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x502048[_0x0e33('0x20')],function(_0x22bb87){return{'model':db[_0x22bb87[_0x0e33('0x22')]],'as':_0x22bb87['as'],'attributes':_0x22bb87[_0x0e33('0x1e')],'include':_0x22bb87[_0x0e33('0x20')]?_[_0x0e33('0x21')](_0x22bb87[_0x0e33('0x20')],function(_0x320793){return{'model':db[_0x320793[_0x0e33('0x22')]],'as':_0x320793['as'],'attributes':_0x320793[_0x0e33('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0e33('0x11')](function(_0x54b7d2){logger[_0x0e33('0x19')](_0x0e33('0x23'),_0x430ba2);logger[_0x0e33('0x13')](_0x0e33('0x23'),_0x430ba2,JSON[_0x0e33('0x16')](_0x54b7d2));_0x5e445c(_0x54b7d2);})['catch'](function(_0x2954cb){logger[_0x0e33('0x17')](_0x0e33('0x23'),_0x2954cb[_0x0e33('0x18')],_0x430ba2);_0x392c29(_0x43dbfc[_0x0e33('0x17')](0x1f4,_0x2954cb[_0x0e33('0x18')]));});});}; \ No newline at end of file +var _0x405a=['raw','attributes','include','map','model','ShowSmsQueue','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','request','then','info','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','catch','GetSmsQueue','SmsQueue','options'];(function(_0x5c6af3,_0x579177){var _0x492c35=function(_0x29756b){while(--_0x29756b){_0x5c6af3['push'](_0x5c6af3['shift']());}};_0x492c35(++_0x579177);}(_0x405a,0x94));var _0xa405=function(_0x3cadbd,_0x12bc43){_0x3cadbd=_0x3cadbd-0x0;var _0x296da9=_0x405a[_0x3cadbd];return _0x296da9;};'use strict';var _=require(_0xa405('0x0'));var util=require(_0xa405('0x1'));var moment=require(_0xa405('0x2'));var BPromise=require('bluebird');var rs=require(_0xa405('0x3'));var fs=require('fs');var Redis=require(_0xa405('0x4'));var db=require(_0xa405('0x5'))['db'];var utils=require(_0xa405('0x6'));var logger=require(_0xa405('0x7'))(_0xa405('0x8'));var config=require('../../config/environment');var jayson=require(_0xa405('0x9'));var client=jayson[_0xa405('0xa')]['http']({'port':0x232a});config[_0xa405('0xb')]=_['defaults'](config[_0xa405('0xb')],{'host':_0xa405('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa405('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3ac7ed,_0x15733d,_0x1f1a6d){return new BPromise(function(_0x48ed1c,_0x3cb0e2){return client[_0xa405('0xd')](_0x3ac7ed,_0x1f1a6d)[_0xa405('0xe')](function(_0x5c2bc6){logger[_0xa405('0xf')]('SmsQueue,\x20%s,\x20%s',_0x15733d,'request\x20sent');logger[_0xa405('0x10')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x15733d,'request\x20sent',JSON[_0xa405('0x11')](_0x5c2bc6));if(_0x5c2bc6[_0xa405('0x12')]){if(_0x5c2bc6[_0xa405('0x12')][_0xa405('0x13')]===0x1f4){logger[_0xa405('0x12')](_0xa405('0x14'),_0x15733d,_0x5c2bc6[_0xa405('0x12')][_0xa405('0x15')]);return _0x3cb0e2(_0x5c2bc6[_0xa405('0x12')][_0xa405('0x15')]);}logger['error'](_0xa405('0x14'),_0x15733d,_0x5c2bc6[_0xa405('0x12')][_0xa405('0x15')]);return _0x48ed1c(_0x5c2bc6[_0xa405('0x12')][_0xa405('0x15')]);}else{logger[_0xa405('0xf')](_0xa405('0x14'),_0x15733d,_0xa405('0x16'));_0x48ed1c(_0x5c2bc6['result'][_0xa405('0x15')]);}})[_0xa405('0x17')](function(_0xb3d4a2){logger['error']('SmsQueue,\x20%s,\x20%s',_0x15733d,_0xb3d4a2);_0x3cb0e2(_0xb3d4a2);});});}exports[_0xa405('0x18')]=function(_0x1dc338){var _0x4d2243=this;return new Promise(function(_0x187efa,_0x49ba55){return db[_0xa405('0x19')]['findAll']({'raw':_0x1dc338[_0xa405('0x1a')]?_0x1dc338['options'][_0xa405('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dc338['options']?_0x1dc338['options']['where']||null:null,'attributes':_0x1dc338['options']?_0x1dc338[_0xa405('0x1a')][_0xa405('0x1c')]||null:null,'limit':_0x1dc338[_0xa405('0x1a')]?_0x1dc338['options']['limit']||null:null,'include':_0x1dc338[_0xa405('0x1a')]?_0x1dc338[_0xa405('0x1a')][_0xa405('0x1d')]?_[_0xa405('0x1e')](_0x1dc338['options'][_0xa405('0x1d')],function(_0x1c53d1){return{'model':db[_0x1c53d1['model']],'as':_0x1c53d1['as'],'attributes':_0x1c53d1[_0xa405('0x1c')],'include':_0x1c53d1['include']?_[_0xa405('0x1e')](_0x1c53d1['include'],function(_0x4e3b09){return{'model':db[_0x4e3b09[_0xa405('0x1f')]],'as':_0x4e3b09['as'],'attributes':_0x4e3b09[_0xa405('0x1c')],'include':_0x4e3b09['include']?_[_0xa405('0x1e')](_0x4e3b09[_0xa405('0x1d')],function(_0x19c2c8){return{'model':db[_0x19c2c8[_0xa405('0x1f')]],'as':_0x19c2c8['as'],'attributes':_0x19c2c8['attributes']};}):[]};}):[]};}):[]:[]})[_0xa405('0xe')](function(_0x339255){logger[_0xa405('0xf')](_0xa405('0x18'),_0x1dc338);logger['debug'](_0xa405('0x18'),_0x1dc338,JSON['stringify'](_0x339255));_0x187efa(_0x339255);})[_0xa405('0x17')](function(_0x19c29d){logger[_0xa405('0x12')](_0xa405('0x18'),_0x19c29d[_0xa405('0x15')],_0x1dc338);_0x49ba55(_0x4d2243['error'](0x1f4,_0x19c29d[_0xa405('0x15')]));});});};exports[_0xa405('0x20')]=function(_0xcb2ba6){var _0x31ec97=this;return new Promise(function(_0x49da8e,_0x468d8a){return db[_0xa405('0x19')][_0xa405('0x21')]({'raw':_0xcb2ba6[_0xa405('0x1a')]?_0xcb2ba6['options']['raw']===undefined?!![]:![]:!![],'where':_0xcb2ba6[_0xa405('0x1a')]?_0xcb2ba6[_0xa405('0x1a')][_0xa405('0x22')]||null:null,'attributes':_0xcb2ba6['options']?_0xcb2ba6[_0xa405('0x1a')][_0xa405('0x1c')]||null:null,'include':_0xcb2ba6[_0xa405('0x1a')]?_0xcb2ba6['options'][_0xa405('0x1d')]?_[_0xa405('0x1e')](_0xcb2ba6[_0xa405('0x1a')][_0xa405('0x1d')],function(_0x5acdc8){return{'model':db[_0x5acdc8['model']],'as':_0x5acdc8['as'],'attributes':_0x5acdc8[_0xa405('0x1c')],'include':_0x5acdc8[_0xa405('0x1d')]?_[_0xa405('0x1e')](_0x5acdc8[_0xa405('0x1d')],function(_0x374372){return{'model':db[_0x374372[_0xa405('0x1f')]],'as':_0x374372['as'],'attributes':_0x374372[_0xa405('0x1c')],'include':_0x374372['include']?_[_0xa405('0x1e')](_0x374372[_0xa405('0x1d')],function(_0xa29115){return{'model':db[_0xa29115['model']],'as':_0xa29115['as'],'attributes':_0xa29115[_0xa405('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa405('0xe')](function(_0x8a846c){logger['info']('ShowSmsQueue',_0xcb2ba6);logger[_0xa405('0x10')](_0xa405('0x20'),_0xcb2ba6,JSON[_0xa405('0x11')](_0x8a846c));_0x49da8e(_0x8a846c);})[_0xa405('0x17')](function(_0xda1b56){logger[_0xa405('0x12')](_0xa405('0x20'),_0xda1b56[_0xa405('0x15')],_0xcb2ba6);_0x468d8a(_0x31ec97[_0xa405('0x12')](0x1f4,_0xda1b56[_0xa405('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 32929b2..82d9026 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 _0xbb8c=['register','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8c,0x7f));var _0xcbb8=function(_0x25405b,_0x2da050){_0x25405b=_0x25405b-0x0;var _0x2c64cf=_0xbb8c[_0x25405b];return _0x2c64cf;};'use strict';var SmsQueueEvents=require(_0xcbb8('0x0'));var events=[_0xcbb8('0x1'),_0xcbb8('0x2'),_0xcbb8('0x3')];function createListener(_0x548c54,_0xdca7d2){return function(_0x4d8aa2){_0xdca7d2[_0xcbb8('0x4')](_0x548c54,_0x4d8aa2);};}function removeListener(_0x9bb5b,_0xa1a291){return function(){SmsQueueEvents[_0xcbb8('0x5')](_0x9bb5b,_0xa1a291);};}exports[_0xcbb8('0x6')]=function(_0x2703bc){for(var _0x1b81c0=0x0,_0xbaa04c=events['length'];_0x1b81c0<_0xbaa04c;_0x1b81c0++){var _0x59c3b3=events[_0x1b81c0];var _0x4f3a58=createListener('smsQueue:'+_0x59c3b3,_0x2703bc);SmsQueueEvents['on'](_0x59c3b3,_0x4f3a58);}}; \ No newline at end of file +var _0x2223=['remove','update','emit','smsQueue:','./smsQueue.events','save'];(function(_0x13002e,_0x206d65){var _0x473dbb=function(_0x23aa9d){while(--_0x23aa9d){_0x13002e['push'](_0x13002e['shift']());}};_0x473dbb(++_0x206d65);}(_0x2223,0x1d2));var _0x3222=function(_0x8c8d05,_0x2fc750){_0x8c8d05=_0x8c8d05-0x0;var _0xb3ac68=_0x2223[_0x8c8d05];return _0xb3ac68;};'use strict';var SmsQueueEvents=require(_0x3222('0x0'));var events=[_0x3222('0x1'),_0x3222('0x2'),_0x3222('0x3')];function createListener(_0x1e15c9,_0x290281){return function(_0x3e19e9){_0x290281[_0x3222('0x4')](_0x1e15c9,_0x3e19e9);};}function removeListener(_0xe2d395,_0x4eb8ab){return function(){SmsQueueEvents['removeListener'](_0xe2d395,_0x4eb8ab);};}exports['register']=function(_0x301a95){for(var _0x452af6=0x0,_0x2901c9=events['length'];_0x452af6<_0x2901c9;_0x452af6++){var _0xa4689a=events[_0x452af6];var _0x50783d=createListener(_0x3222('0x5')+_0xa4689a,_0x301a95);SmsQueueEvents['on'](_0xa4689a,_0x50783d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1222d88..58d8d1e 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 _0x229e=['describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3cedb6,_0x4f0538){var _0x451d5b=function(_0x97d0db){while(--_0x97d0db){_0x3cedb6['push'](_0x3cedb6['shift']());}};_0x451d5b(++_0x4f0538);}(_0x229e,0xbd));var _0xe229=function(_0x4a4384,_0x37ce4c){_0x4a4384=_0x4a4384-0x0;var _0x2d3903=_0x229e[_0x4a4384];return _0x2d3903;};'use strict';var multer=require('multer');var util=require(_0xe229('0x0'));var path=require(_0xe229('0x1'));var timeout=require(_0xe229('0x2'));var express=require(_0xe229('0x3'));var router=express[_0xe229('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe229('0x5'));var interaction=require(_0xe229('0x6'));var config=require(_0xe229('0x7'));var controller=require('./smsQueueReport.controller');router[_0xe229('0x8')]('/',auth[_0xe229('0x9')](),controller[_0xe229('0xa')]);router['get']('/describe',auth[_0xe229('0x9')](),controller[_0xe229('0xb')]);router[_0xe229('0x8')](_0xe229('0xc'),auth[_0xe229('0x9')](),controller['show']);router[_0xe229('0xd')]('/',auth['isAuthenticated'](),controller[_0xe229('0xe')]);router[_0xe229('0xf')]('/:id',auth[_0xe229('0x9')](),controller[_0xe229('0x10')]);router[_0xe229('0x11')](_0xe229('0xc'),auth[_0xe229('0x9')](),controller[_0xe229('0x12')]);module[_0xe229('0x13')]=router; \ No newline at end of file +var _0x45aa=['delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update'];(function(_0xfbc750,_0x147015){var _0x2335f5=function(_0x16b7d2){while(--_0x16b7d2){_0xfbc750['push'](_0xfbc750['shift']());}};_0x2335f5(++_0x147015);}(_0x45aa,0xdf));var _0xa45a=function(_0x2f34d2,_0x236793){_0x2f34d2=_0x2f34d2-0x0;var _0x25e904=_0x45aa[_0x2f34d2];return _0x25e904;};'use strict';var multer=require('multer');var util=require(_0xa45a('0x0'));var path=require(_0xa45a('0x1'));var timeout=require(_0xa45a('0x2'));var express=require(_0xa45a('0x3'));var router=express['Router']();var fs_extra=require(_0xa45a('0x4'));var auth=require(_0xa45a('0x5'));var interaction=require(_0xa45a('0x6'));var config=require(_0xa45a('0x7'));var controller=require(_0xa45a('0x8'));router[_0xa45a('0x9')]('/',auth[_0xa45a('0xa')](),controller['index']);router[_0xa45a('0x9')](_0xa45a('0xb'),auth[_0xa45a('0xa')](),controller['describe']);router[_0xa45a('0x9')](_0xa45a('0xc'),auth[_0xa45a('0xa')](),controller['show']);router[_0xa45a('0xd')]('/',auth[_0xa45a('0xa')](),controller[_0xa45a('0xe')]);router[_0xa45a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa45a('0x10')]);router[_0xa45a('0x11')](_0xa45a('0xc'),auth[_0xa45a('0xa')](),controller[_0xa45a('0x12')]);module[_0xa45a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index adfd7c0..5a3c29e 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 _0x0af1=['exports','STRING','DATE'];(function(_0x101971,_0x371c09){var _0x107dcb=function(_0x2141bd){while(--_0x2141bd){_0x101971['push'](_0x101971['shift']());}};_0x107dcb(++_0x371c09);}(_0x0af1,0x135));var _0x10af=function(_0x5951d6,_0x384ad7){_0x5951d6=_0x5951d6-0x0;var _0x36ecde=_0x0af1[_0x5951d6];return _0x36ecde;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x10af('0x0')]={'uniqueid':{'type':Sequelize[_0x10af('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x10af('0x1')]},'joinAt':{'type':Sequelize[_0x10af('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x10af('0x2')]},'exitAt':{'type':Sequelize[_0x10af('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a6b=['sequelize','exports','STRING','DATE','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9a6b,0x77));var _0xb9a6=function(_0x531ee2,_0x48c7ff){_0x531ee2=_0x531ee2-0x0;var _0x4e2fc8=_0x9a6b[_0x531ee2];return _0x4e2fc8;};'use strict';var moment=require(_0xb9a6('0x0'));var Sequelize=require(_0xb9a6('0x1'));module[_0xb9a6('0x2')]={'uniqueid':{'type':Sequelize[_0xb9a6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb9a6('0x3')]},'joinAt':{'type':Sequelize[_0xb9a6('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb9a6('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb9a6('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b8b9f9b..50e55a6 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 _0x272e=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','SmsQueueReport','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x272e,0x91));var _0xe272=function(_0x286ac9,_0x407bc1){_0x286ac9=_0x286ac9-0x0;var _0x3158b5=_0x272e[_0x286ac9];return _0x3158b5;};'use strict';var emlformat=require(_0xe272('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe272('0x1'));var rp=require(_0xe272('0x2'));var moment=require(_0xe272('0x3'));var BPromise=require(_0xe272('0x4'));var Mustache=require(_0xe272('0x5'));var util=require(_0xe272('0x6'));var path=require('path');var sox=require(_0xe272('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe272('0x8'));var _=require(_0xe272('0x9'));var squel=require('squel');var crypto=require(_0xe272('0xa'));var jsforce=require(_0xe272('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe272('0xc'));var querystring=require(_0xe272('0xd'));var Papa=require(_0xe272('0xe'));var Redis=require('ioredis');var authService=require(_0xe272('0xf'));var qs=require(_0xe272('0x10'));var as=require(_0xe272('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe272('0x12'))(_0xe272('0x13'));var utils=require(_0xe272('0x14'));var config=require(_0xe272('0x15'));var licenseUtil=require(_0xe272('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a4af7,_0x43488e){_0x43488e=_0x43488e||0xcc;return function(_0x52d4b7){if(_0x52d4b7){return _0x2a4af7['sendStatus'](_0x43488e);}return _0x2a4af7[_0xe272('0x17')](_0x43488e)[_0xe272('0x18')]();};}function respondWithResult(_0x226029,_0x309a85){_0x309a85=_0x309a85||0xc8;return function(_0x583082){if(_0x583082){return _0x226029[_0xe272('0x17')](_0x309a85)[_0xe272('0x19')](_0x583082);}};}function respondWithFilteredResult(_0x1280b3,_0xab9039){return function(_0x3b71c4){if(_0x3b71c4){var _0x125222=typeof _0xab9039[_0xe272('0x1a')]==='undefined'&&typeof _0xab9039[_0xe272('0x1b')]===_0xe272('0x1c');var _0x150e8f=_0x3b71c4[_0xe272('0x1d')];var _0x3cee62=_0x125222?0x0:_0xab9039[_0xe272('0x1a')];var _0x2b1bcb=_0x125222?_0x3b71c4[_0xe272('0x1d')]:_0xab9039[_0xe272('0x1a')]+_0xab9039['limit'];var _0x23be05;if(_0x2b1bcb>=_0x150e8f){_0x2b1bcb=_0x150e8f;_0x23be05=0xc8;}else{_0x23be05=0xce;}_0x1280b3['status'](_0x23be05);return _0x1280b3[_0xe272('0x1e')](_0xe272('0x1f'),_0x3cee62+'-'+_0x2b1bcb+'/'+_0x150e8f)[_0xe272('0x19')](_0x3b71c4);}return null;};}function patchUpdates(_0x3cbcd7){return function(_0x495bb1){try{jsonpatch[_0xe272('0x20')](_0x495bb1,_0x3cbcd7,!![]);}catch(_0x46d307){return BPromise[_0xe272('0x21')](_0x46d307);}return _0x495bb1[_0xe272('0x22')]();};}function saveUpdates(_0x40538a,_0xf7128){return function(_0x594741){if(_0x594741){return _0x594741[_0xe272('0x23')](_0x40538a)[_0xe272('0x24')](function(_0x692940){return _0x692940;});}return null;};}function removeEntity(_0x58db1a,_0x29edfb){return function(_0x18abec){if(_0x18abec){return _0x18abec[_0xe272('0x25')]()[_0xe272('0x24')](function(){_0x58db1a[_0xe272('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577a36,_0x4e5d9f){return function(_0x488603){if(!_0x488603){_0x577a36['sendStatus'](0x194);}return _0x488603;};}function handleError(_0x266e1d,_0x2dff4f){_0x2dff4f=_0x2dff4f||0x1f4;return function(_0x34ab90){logger[_0xe272('0x26')](_0x34ab90[_0xe272('0x27')]);if(_0x34ab90['name']){delete _0x34ab90[_0xe272('0x28')];}_0x266e1d[_0xe272('0x17')](_0x2dff4f)[_0xe272('0x29')](_0x34ab90);};}exports[_0xe272('0x2a')]=function(_0x29aba3,_0x1022d2){var _0xbec8ba={},_0x329486={},_0x3ed7e6={'count':0x0,'rows':[]};var _0x151f2a=_[_0xe272('0x2b')](db['SmsQueueReport'][_0xe272('0x2c')],function(_0x386a66){return{'name':_0x386a66[_0xe272('0x2d')],'type':_0x386a66['type'][_0xe272('0x2e')]};});_0x329486[_0xe272('0x2f')]=_[_0xe272('0x2b')](_0x151f2a,'name');_0x329486['query']=_[_0xe272('0x30')](_0x29aba3[_0xe272('0x31')]);_0x329486[_0xe272('0x32')]=_[_0xe272('0x33')](_0x329486[_0xe272('0x2f')],_0x329486[_0xe272('0x31')]);_0xbec8ba['attributes']=_[_0xe272('0x33')](_0x329486[_0xe272('0x2f')],qs['fields'](_0x29aba3['query'][_0xe272('0x34')]));_0xbec8ba[_0xe272('0x35')]=_0xbec8ba[_0xe272('0x35')][_0xe272('0x36')]?_0xbec8ba['attributes']:_0x329486['model'];if(!_0x29aba3[_0xe272('0x31')][_0xe272('0x37')](_0xe272('0x38'))){_0xbec8ba[_0xe272('0x1b')]=qs['limit'](_0x29aba3['query'][_0xe272('0x1b')]);_0xbec8ba[_0xe272('0x1a')]=qs[_0xe272('0x1a')](_0x29aba3[_0xe272('0x31')][_0xe272('0x1a')]);}_0xbec8ba[_0xe272('0x39')]=qs[_0xe272('0x3a')](_0x29aba3[_0xe272('0x31')][_0xe272('0x3a')]);_0xbec8ba[_0xe272('0x3b')]=qs['filters'](_[_0xe272('0x3c')](_0x29aba3[_0xe272('0x31')],_0x329486[_0xe272('0x32')]),_0x151f2a);if(_0x29aba3['query'][_0xe272('0x3d')]){_0xbec8ba[_0xe272('0x3b')]=_['merge'](_0xbec8ba[_0xe272('0x3b')],{'$or':_[_0xe272('0x2b')](_0x151f2a,function(_0x4e1ed1){if(_0x4e1ed1[_0xe272('0x3e')]!==_0xe272('0x3f')){var _0x577810={};_0x577810[_0x4e1ed1[_0xe272('0x28')]]={'$like':'%'+_0x29aba3[_0xe272('0x31')]['filter']+'%'};return _0x577810;}})});}_0xbec8ba=_[_0xe272('0x40')]({},_0xbec8ba,_0x29aba3['options']);var _0x217cb4={'where':_0xbec8ba[_0xe272('0x3b')]};return db[_0xe272('0x41')][_0xe272('0x1d')](_0x217cb4)['then'](function(_0x38d687){_0x3ed7e6[_0xe272('0x1d')]=_0x38d687;if(_0x29aba3['query']['includeAll']){_0xbec8ba[_0xe272('0x42')]=[{'all':!![]}];}return db[_0xe272('0x41')][_0xe272('0x43')](_0xbec8ba);})[_0xe272('0x24')](function(_0x782bef){_0x3ed7e6[_0xe272('0x44')]=_0x782bef;return _0x3ed7e6;})[_0xe272('0x24')](respondWithFilteredResult(_0x1022d2,_0xbec8ba))[_0xe272('0x45')](handleError(_0x1022d2,null));};exports[_0xe272('0x46')]=function(_0x4df05a,_0x4d8fdb){var _0x474b20={'raw':!![],'where':{'id':_0x4df05a[_0xe272('0x47')]['id']}},_0x45c049={};_0x45c049['model']=_['keys'](db['SmsQueueReport'][_0xe272('0x2c')]);_0x45c049[_0xe272('0x31')]=_[_0xe272('0x30')](_0x4df05a[_0xe272('0x31')]);_0x45c049[_0xe272('0x32')]=_[_0xe272('0x33')](_0x45c049['model'],_0x45c049[_0xe272('0x31')]);_0x474b20['attributes']=_[_0xe272('0x33')](_0x45c049[_0xe272('0x2f')],qs['fields'](_0x4df05a['query'][_0xe272('0x34')]));_0x474b20[_0xe272('0x35')]=_0x474b20[_0xe272('0x35')][_0xe272('0x36')]?_0x474b20['attributes']:_0x45c049['model'];if(_0x4df05a[_0xe272('0x31')][_0xe272('0x48')]){_0x474b20[_0xe272('0x42')]=[{'all':!![]}];}_0x474b20=_[_0xe272('0x40')]({},_0x474b20,_0x4df05a[_0xe272('0x49')]);return db[_0xe272('0x41')][_0xe272('0x4a')](_0x474b20)[_0xe272('0x24')](handleEntityNotFound(_0x4d8fdb,null))[_0xe272('0x24')](respondWithResult(_0x4d8fdb,null))[_0xe272('0x45')](handleError(_0x4d8fdb,null));};exports[_0xe272('0x4b')]=function(_0x249c06,_0x74bcb0){return db[_0xe272('0x41')][_0xe272('0x4b')](_0x249c06[_0xe272('0x4c')],{})[_0xe272('0x24')](respondWithResult(_0x74bcb0,0xc9))['catch'](handleError(_0x74bcb0,null));};exports[_0xe272('0x23')]=function(_0x218112,_0x17430d){if(_0x218112['body']['id']){delete _0x218112[_0xe272('0x4c')]['id'];}return db[_0xe272('0x41')][_0xe272('0x4a')]({'where':{'id':_0x218112['params']['id']}})[_0xe272('0x24')](handleEntityNotFound(_0x17430d,null))[_0xe272('0x24')](saveUpdates(_0x218112['body'],null))[_0xe272('0x24')](respondWithResult(_0x17430d,null))[_0xe272('0x45')](handleError(_0x17430d,null));};exports[_0xe272('0x25')]=function(_0x2646a8,_0x2de927){return db[_0xe272('0x41')][_0xe272('0x4a')]({'where':{'id':_0x2646a8[_0xe272('0x47')]['id']}})['then'](handleEntityNotFound(_0x2de927,null))['then'](removeEntity(_0x2de927,null))[_0xe272('0x45')](handleError(_0x2de927,null));};exports[_0xe272('0x4d')]=function(_0x39f7d4,_0x477d6c){return db['SmsQueueReport']['describe']()[_0xe272('0x24')](respondWithResult(_0x477d6c,null))['catch'](handleError(_0x477d6c,null));}; \ No newline at end of file +var _0xbc6f=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsQueueReport','include','findAll','show','params','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x45c420,_0x200686){var _0x1ecc91=function(_0xf86b82){while(--_0xf86b82){_0x45c420['push'](_0x45c420['shift']());}};_0x1ecc91(++_0x200686);}(_0xbc6f,0x90));var _0xfbc6=function(_0x69b0bf,_0x248a70){_0x69b0bf=_0x69b0bf-0x0;var _0x53a201=_0xbc6f[_0x69b0bf];return _0x53a201;};'use strict';var emlformat=require(_0xfbc6('0x0'));var rimraf=require(_0xfbc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbc6('0x2'));var rp=require(_0xfbc6('0x3'));var moment=require(_0xfbc6('0x4'));var BPromise=require(_0xfbc6('0x5'));var Mustache=require(_0xfbc6('0x6'));var util=require('util');var path=require(_0xfbc6('0x7'));var sox=require(_0xfbc6('0x8'));var csv=require(_0xfbc6('0x9'));var ejs=require(_0xfbc6('0xa'));var fs=require('fs');var fs_extra=require(_0xfbc6('0xb'));var _=require(_0xfbc6('0xc'));var squel=require(_0xfbc6('0xd'));var crypto=require(_0xfbc6('0xe'));var jsforce=require(_0xfbc6('0xf'));var deskjs=require(_0xfbc6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfbc6('0x11'));var Papa=require(_0xfbc6('0x12'));var Redis=require(_0xfbc6('0x13'));var authService=require(_0xfbc6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfbc6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfbc6('0x16'));var utils=require(_0xfbc6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfbc6('0x18'))['db'];function respondWithStatusCode(_0x2b663b,_0x40af06){_0x40af06=_0x40af06||0xcc;return function(_0x1b9a26){if(_0x1b9a26){return _0x2b663b[_0xfbc6('0x19')](_0x40af06);}return _0x2b663b[_0xfbc6('0x1a')](_0x40af06)[_0xfbc6('0x1b')]();};}function respondWithResult(_0x3db84a,_0x36fa39){_0x36fa39=_0x36fa39||0xc8;return function(_0x162ca0){if(_0x162ca0){return _0x3db84a[_0xfbc6('0x1a')](_0x36fa39)[_0xfbc6('0x1c')](_0x162ca0);}};}function respondWithFilteredResult(_0x3a6c4e,_0x3caabf){return function(_0x168cf0){if(_0x168cf0){var _0x391211=typeof _0x3caabf[_0xfbc6('0x1d')]==='undefined'&&typeof _0x3caabf['limit']===_0xfbc6('0x1e');var _0x497b59=_0x168cf0[_0xfbc6('0x1f')];var _0x208e6a=_0x391211?0x0:_0x3caabf[_0xfbc6('0x1d')];var _0x8ea380=_0x391211?_0x168cf0[_0xfbc6('0x1f')]:_0x3caabf[_0xfbc6('0x1d')]+_0x3caabf[_0xfbc6('0x20')];var _0x347060;if(_0x8ea380>=_0x497b59){_0x8ea380=_0x497b59;_0x347060=0xc8;}else{_0x347060=0xce;}_0x3a6c4e[_0xfbc6('0x1a')](_0x347060);return _0x3a6c4e[_0xfbc6('0x21')]('Content-Range',_0x208e6a+'-'+_0x8ea380+'/'+_0x497b59)[_0xfbc6('0x1c')](_0x168cf0);}return null;};}function patchUpdates(_0x3d57c7){return function(_0x301fb5){try{jsonpatch[_0xfbc6('0x22')](_0x301fb5,_0x3d57c7,!![]);}catch(_0x36ca32){return BPromise['reject'](_0x36ca32);}return _0x301fb5[_0xfbc6('0x23')]();};}function saveUpdates(_0x189c13,_0x10b95b){return function(_0x132fe1){if(_0x132fe1){return _0x132fe1[_0xfbc6('0x24')](_0x189c13)[_0xfbc6('0x25')](function(_0xafa0ca){return _0xafa0ca;});}return null;};}function removeEntity(_0x41c5f2,_0x33544d){return function(_0x40aedd){if(_0x40aedd){return _0x40aedd[_0xfbc6('0x26')]()['then'](function(){_0x41c5f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5974d7,_0x13d5ef){return function(_0xb4f95b){if(!_0xb4f95b){_0x5974d7[_0xfbc6('0x19')](0x194);}return _0xb4f95b;};}function handleError(_0xdb87c5,_0x1d15ed){_0x1d15ed=_0x1d15ed||0x1f4;return function(_0x2e8d21){logger[_0xfbc6('0x27')](_0x2e8d21['stack']);if(_0x2e8d21[_0xfbc6('0x28')]){delete _0x2e8d21[_0xfbc6('0x28')];}_0xdb87c5[_0xfbc6('0x1a')](_0x1d15ed)[_0xfbc6('0x29')](_0x2e8d21);};}exports[_0xfbc6('0x2a')]=function(_0x416e64,_0x1f801a){var _0x3346c1={},_0x206a60={},_0x3a7e47={'count':0x0,'rows':[]};var _0x5bcba9=_['map'](db['SmsQueueReport'][_0xfbc6('0x2b')],function(_0x3f6655){return{'name':_0x3f6655['fieldName'],'type':_0x3f6655[_0xfbc6('0x2c')][_0xfbc6('0x2d')]};});_0x206a60['model']=_[_0xfbc6('0x2e')](_0x5bcba9,'name');_0x206a60[_0xfbc6('0x2f')]=_[_0xfbc6('0x30')](_0x416e64['query']);_0x206a60['filters']=_[_0xfbc6('0x31')](_0x206a60[_0xfbc6('0x32')],_0x206a60[_0xfbc6('0x2f')]);_0x3346c1[_0xfbc6('0x33')]=_[_0xfbc6('0x31')](_0x206a60['model'],qs[_0xfbc6('0x34')](_0x416e64['query'][_0xfbc6('0x34')]));_0x3346c1[_0xfbc6('0x33')]=_0x3346c1[_0xfbc6('0x33')]['length']?_0x3346c1['attributes']:_0x206a60['model'];if(!_0x416e64[_0xfbc6('0x2f')][_0xfbc6('0x35')](_0xfbc6('0x36'))){_0x3346c1['limit']=qs[_0xfbc6('0x20')](_0x416e64['query'][_0xfbc6('0x20')]);_0x3346c1[_0xfbc6('0x1d')]=qs[_0xfbc6('0x1d')](_0x416e64[_0xfbc6('0x2f')][_0xfbc6('0x1d')]);}_0x3346c1[_0xfbc6('0x37')]=qs[_0xfbc6('0x38')](_0x416e64[_0xfbc6('0x2f')][_0xfbc6('0x38')]);_0x3346c1[_0xfbc6('0x39')]=qs[_0xfbc6('0x3a')](_[_0xfbc6('0x3b')](_0x416e64['query'],_0x206a60['filters']),_0x5bcba9);if(_0x416e64['query'][_0xfbc6('0x3c')]){_0x3346c1[_0xfbc6('0x39')]=_[_0xfbc6('0x3d')](_0x3346c1[_0xfbc6('0x39')],{'$or':_[_0xfbc6('0x2e')](_0x5bcba9,function(_0x3f840a){if(_0x3f840a[_0xfbc6('0x2c')]!==_0xfbc6('0x3e')){var _0x3beb42={};_0x3beb42[_0x3f840a[_0xfbc6('0x28')]]={'$like':'%'+_0x416e64[_0xfbc6('0x2f')][_0xfbc6('0x3c')]+'%'};return _0x3beb42;}})});}_0x3346c1=_['merge']({},_0x3346c1,_0x416e64[_0xfbc6('0x3f')]);var _0x514e69={'where':_0x3346c1[_0xfbc6('0x39')]};return db[_0xfbc6('0x40')][_0xfbc6('0x1f')](_0x514e69)['then'](function(_0x688a2f){_0x3a7e47[_0xfbc6('0x1f')]=_0x688a2f;if(_0x416e64['query']['includeAll']){_0x3346c1[_0xfbc6('0x41')]=[{'all':!![]}];}return db[_0xfbc6('0x40')][_0xfbc6('0x42')](_0x3346c1);})[_0xfbc6('0x25')](function(_0x2f852f){_0x3a7e47['rows']=_0x2f852f;return _0x3a7e47;})['then'](respondWithFilteredResult(_0x1f801a,_0x3346c1))['catch'](handleError(_0x1f801a,null));};exports[_0xfbc6('0x43')]=function(_0xeba43f,_0x303a0c){var _0xbca84d={'raw':!![],'where':{'id':_0xeba43f[_0xfbc6('0x44')]['id']}},_0x9e9244={};_0x9e9244[_0xfbc6('0x32')]=_[_0xfbc6('0x30')](db[_0xfbc6('0x40')]['rawAttributes']);_0x9e9244[_0xfbc6('0x2f')]=_[_0xfbc6('0x30')](_0xeba43f[_0xfbc6('0x2f')]);_0x9e9244[_0xfbc6('0x3a')]=_[_0xfbc6('0x31')](_0x9e9244[_0xfbc6('0x32')],_0x9e9244['query']);_0xbca84d[_0xfbc6('0x33')]=_[_0xfbc6('0x31')](_0x9e9244[_0xfbc6('0x32')],qs[_0xfbc6('0x34')](_0xeba43f[_0xfbc6('0x2f')][_0xfbc6('0x34')]));_0xbca84d[_0xfbc6('0x33')]=_0xbca84d[_0xfbc6('0x33')][_0xfbc6('0x45')]?_0xbca84d['attributes']:_0x9e9244[_0xfbc6('0x32')];if(_0xeba43f[_0xfbc6('0x2f')][_0xfbc6('0x46')]){_0xbca84d[_0xfbc6('0x41')]=[{'all':!![]}];}_0xbca84d=_[_0xfbc6('0x3d')]({},_0xbca84d,_0xeba43f[_0xfbc6('0x3f')]);return db[_0xfbc6('0x40')][_0xfbc6('0x47')](_0xbca84d)['then'](handleEntityNotFound(_0x303a0c,null))[_0xfbc6('0x25')](respondWithResult(_0x303a0c,null))[_0xfbc6('0x48')](handleError(_0x303a0c,null));};exports[_0xfbc6('0x49')]=function(_0xa89dc0,_0x32d73c){return db[_0xfbc6('0x40')]['create'](_0xa89dc0[_0xfbc6('0x4a')],{})[_0xfbc6('0x25')](respondWithResult(_0x32d73c,0xc9))[_0xfbc6('0x48')](handleError(_0x32d73c,null));};exports['update']=function(_0x123aeb,_0x1a8e49){if(_0x123aeb['body']['id']){delete _0x123aeb[_0xfbc6('0x4a')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x123aeb[_0xfbc6('0x44')]['id']}})[_0xfbc6('0x25')](handleEntityNotFound(_0x1a8e49,null))[_0xfbc6('0x25')](saveUpdates(_0x123aeb[_0xfbc6('0x4a')],null))[_0xfbc6('0x25')](respondWithResult(_0x1a8e49,null))[_0xfbc6('0x48')](handleError(_0x1a8e49,null));};exports['destroy']=function(_0x2f5dd6,_0x296ea5){return db[_0xfbc6('0x40')][_0xfbc6('0x47')]({'where':{'id':_0x2f5dd6[_0xfbc6('0x44')]['id']}})[_0xfbc6('0x25')](handleEntityNotFound(_0x296ea5,null))[_0xfbc6('0x25')](removeEntity(_0x296ea5,null))['catch'](handleError(_0x296ea5,null));};exports[_0xfbc6('0x4b')]=function(_0x4620ba,_0x28326c){return db[_0xfbc6('0x40')]['describe']()[_0xfbc6('0x25')](respondWithResult(_0x28326c,null))[_0xfbc6('0x48')](handleError(_0x28326c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5edf579..1e6dfa1 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(_0x172298,_0x542449){var _0x44856d=function(_0xa648ba){while(--_0xa648ba){_0x172298['push'](_0x172298['shift']());}};_0x44856d(++_0x542449);}(_0xe706,0xa3));var _0x6e70=function(_0x4788ca,_0x5cda70){_0x4788ca=_0x4788ca-0x0;var _0x28a6f5=_0xe706[_0x4788ca];return _0x28a6f5;};'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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x48e87e,_0x492815){var _0xfb5245=function(_0x54f995){while(--_0x54f995){_0x48e87e['push'](_0x48e87e['shift']());}};_0xfb5245(++_0x492815);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xcb91[_0x3b4b1d];return _0x488c36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f0e0f12..7f627e4 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 _0xee91=['info','SmsQueueReport','where','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','create','body','options','raw'];(function(_0x48ac5b,_0x35e340){var _0x557609=function(_0x53036f){while(--_0x53036f){_0x48ac5b['push'](_0x48ac5b['shift']());}};_0x557609(++_0x35e340);}(_0xee91,0x198));var _0x1ee9=function(_0x2eb034,_0x52f134){_0x2eb034=_0x2eb034-0x0;var _0x1a2d29=_0xee91[_0x2eb034];return _0x1a2d29;};'use strict';var _=require(_0x1ee9('0x0'));var util=require(_0x1ee9('0x1'));var moment=require(_0x1ee9('0x2'));var BPromise=require(_0x1ee9('0x3'));var rs=require(_0x1ee9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ee9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ee9('0x6'))(_0x1ee9('0x7'));var config=require(_0x1ee9('0x8'));var jayson=require(_0x1ee9('0x9'));var client=jayson[_0x1ee9('0xa')][_0x1ee9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x223da4,_0x2aee09,_0x2c8d7c){return new BPromise(function(_0x50f616,_0x42526c){return client['request'](_0x223da4,_0x2c8d7c)[_0x1ee9('0xc')](function(_0x35bb40){logger['info'](_0x1ee9('0xd'),_0x2aee09,_0x1ee9('0xe'));logger[_0x1ee9('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2aee09,_0x1ee9('0xe'),JSON[_0x1ee9('0x10')](_0x35bb40));if(_0x35bb40[_0x1ee9('0x11')]){if(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x12')]===0x1f4){logger[_0x1ee9('0x11')](_0x1ee9('0xd'),_0x2aee09,_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);return _0x42526c(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);}logger[_0x1ee9('0x11')](_0x1ee9('0xd'),_0x2aee09,_0x35bb40[_0x1ee9('0x11')]['message']);return _0x50f616(_0x35bb40[_0x1ee9('0x11')][_0x1ee9('0x13')]);}else{logger['info'](_0x1ee9('0xd'),_0x2aee09,_0x1ee9('0xe'));_0x50f616(_0x35bb40['result'][_0x1ee9('0x13')]);}})[_0x1ee9('0x14')](function(_0x245295){logger[_0x1ee9('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x2aee09,_0x245295);_0x42526c(_0x245295);});});}exports[_0x1ee9('0x15')]=function(_0x115415){var _0x198539=this;return new Promise(function(_0x320468,_0xf57521){return db['SmsQueueReport'][_0x1ee9('0x16')](_0x115415[_0x1ee9('0x17')],{'raw':_0x115415[_0x1ee9('0x18')]?_0x115415[_0x1ee9('0x18')][_0x1ee9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x50b448){logger[_0x1ee9('0x1a')](_0x1ee9('0x15'),_0x115415);logger[_0x1ee9('0xf')](_0x1ee9('0x15'),_0x115415,JSON['stringify'](_0x50b448));_0x320468(_0x50b448);})[_0x1ee9('0x14')](function(_0x2173d7){logger[_0x1ee9('0x11')]('CreateSmsQueueReport',_0x2173d7[_0x1ee9('0x13')],_0x115415);_0xf57521(_0x198539[_0x1ee9('0x11')](0x1f4,_0x2173d7[_0x1ee9('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x4af197){var _0x2126ea=this;return new Promise(function(_0x1fd3c5,_0x44ea90){return db[_0x1ee9('0x1b')]['update'](_0x4af197[_0x1ee9('0x17')],{'raw':_0x4af197[_0x1ee9('0x18')]?_0x4af197[_0x1ee9('0x18')][_0x1ee9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af197[_0x1ee9('0x18')]?_0x4af197['options'][_0x1ee9('0x1c')]||null:null,'attributes':_0x4af197['options']?_0x4af197[_0x1ee9('0x18')][_0x1ee9('0x1d')]||null:null,'limit':_0x4af197[_0x1ee9('0x18')]?_0x4af197[_0x1ee9('0x18')]['limit']||null:null})['then'](function(_0x418be6){logger[_0x1ee9('0x1a')](_0x1ee9('0x1e'),_0x4af197);logger['debug']('UpdateSmsQueueReport',_0x4af197,JSON[_0x1ee9('0x10')](_0x418be6));_0x1fd3c5(_0x418be6);})[_0x1ee9('0x14')](function(_0x3099d5){logger[_0x1ee9('0x11')](_0x1ee9('0x1e'),_0x3099d5[_0x1ee9('0x13')],_0x4af197);_0x44ea90(_0x2126ea['error'](0x1f4,_0x3099d5[_0x1ee9('0x13')]));});});}; \ No newline at end of file +var _0xc938=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsQueueReport','create','body','options','raw','debug','SmsQueueReport','update','where','attributes','limit','then','UpdateSmsQueueReport','stringify','lodash','moment','bluebird'];(function(_0xf53329,_0x2e0648){var _0x4917db=function(_0x89ce54){while(--_0x89ce54){_0xf53329['push'](_0xf53329['shift']());}};_0x4917db(++_0x2e0648);}(_0xc938,0x1c4));var _0x8c93=function(_0x55a511,_0x2ec93d){_0x55a511=_0x55a511-0x0;var _0x52dc79=_0xc938[_0x55a511];return _0x52dc79;};'use strict';var _=require(_0x8c93('0x0'));var util=require('util');var moment=require(_0x8c93('0x1'));var BPromise=require(_0x8c93('0x2'));var rs=require(_0x8c93('0x3'));var fs=require('fs');var Redis=require(_0x8c93('0x4'));var db=require(_0x8c93('0x5'))['db'];var utils=require(_0x8c93('0x6'));var logger=require(_0x8c93('0x7'))(_0x8c93('0x8'));var config=require(_0x8c93('0x9'));var jayson=require(_0x8c93('0xa'));var client=jayson[_0x8c93('0xb')][_0x8c93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x256910,_0x2d651e,_0x1956df){return new BPromise(function(_0xaf7cf9,_0x19a34d){return client['request'](_0x256910,_0x1956df)['then'](function(_0x7c36bc){logger[_0x8c93('0xd')](_0x8c93('0xe'),_0x2d651e,_0x8c93('0xf'));logger['debug'](_0x8c93('0x10'),_0x2d651e,_0x8c93('0xf'),JSON['stringify'](_0x7c36bc));if(_0x7c36bc['error']){if(_0x7c36bc[_0x8c93('0x11')]['code']===0x1f4){logger['error'](_0x8c93('0xe'),_0x2d651e,_0x7c36bc['error']['message']);return _0x19a34d(_0x7c36bc[_0x8c93('0x11')][_0x8c93('0x12')]);}logger[_0x8c93('0x11')](_0x8c93('0xe'),_0x2d651e,_0x7c36bc[_0x8c93('0x11')][_0x8c93('0x12')]);return _0xaf7cf9(_0x7c36bc[_0x8c93('0x11')][_0x8c93('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2d651e,_0x8c93('0xf'));_0xaf7cf9(_0x7c36bc[_0x8c93('0x13')]['message']);}})[_0x8c93('0x14')](function(_0x3fcafe){logger[_0x8c93('0x11')](_0x8c93('0xe'),_0x2d651e,_0x3fcafe);_0x19a34d(_0x3fcafe);});});}exports[_0x8c93('0x15')]=function(_0xe5f273){var _0x2592b2=this;return new Promise(function(_0x11783d,_0xfa22a0){return db['SmsQueueReport'][_0x8c93('0x16')](_0xe5f273[_0x8c93('0x17')],{'raw':_0xe5f273[_0x8c93('0x18')]?_0xe5f273[_0x8c93('0x18')][_0x8c93('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x314249){logger['info'](_0x8c93('0x15'),_0xe5f273);logger[_0x8c93('0x1a')](_0x8c93('0x15'),_0xe5f273,JSON['stringify'](_0x314249));_0x11783d(_0x314249);})[_0x8c93('0x14')](function(_0x5720ab){logger['error'](_0x8c93('0x15'),_0x5720ab[_0x8c93('0x12')],_0xe5f273);_0xfa22a0(_0x2592b2['error'](0x1f4,_0x5720ab['message']));});});};exports['UpdateSmsQueueReport']=function(_0x123a02){var _0x33a2fb=this;return new Promise(function(_0x537a8c,_0x41f217){return db[_0x8c93('0x1b')][_0x8c93('0x1c')](_0x123a02[_0x8c93('0x17')],{'raw':_0x123a02['options']?_0x123a02['options'][_0x8c93('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x123a02[_0x8c93('0x18')]?_0x123a02[_0x8c93('0x18')][_0x8c93('0x1d')]||null:null,'attributes':_0x123a02['options']?_0x123a02[_0x8c93('0x18')][_0x8c93('0x1e')]||null:null,'limit':_0x123a02[_0x8c93('0x18')]?_0x123a02[_0x8c93('0x18')][_0x8c93('0x1f')]||null:null})[_0x8c93('0x20')](function(_0x35e628){logger['info'](_0x8c93('0x21'),_0x123a02);logger['debug']('UpdateSmsQueueReport',_0x123a02,JSON[_0x8c93('0x22')](_0x35e628));_0x537a8c(_0x35e628);})[_0x8c93('0x14')](function(_0x48d93d){logger['error'](_0x8c93('0x21'),_0x48d93d[_0x8c93('0x12')],_0x123a02);_0x41f217(_0x33a2fb[_0x8c93('0x11')](0x1f4,_0x48d93d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4986a22..2996fbf 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 _0x2eb2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete'];(function(_0x26b2db,_0x46dcb4){var _0x5eb8ed=function(_0x2a9ef8){while(--_0x2a9ef8){_0x26b2db['push'](_0x26b2db['shift']());}};_0x5eb8ed(++_0x46dcb4);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x2eb2[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x7')](_0x22eb('0xc'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')]('/',auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['put']('/:id',auth[_0x22eb('0x8')](),controller['update']);router[_0x22eb('0x10')](_0x22eb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x22eb('0x11')]=router; \ No newline at end of file +var _0xfd20=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xfd20,0x66));var _0x0fd2=function(_0x4c3766,_0x3325bf){_0x4c3766=_0x4c3766-0x0;var _0x423d11=_0xfd20[_0x4c3766];return _0x423d11;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/describe',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0x6')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')]('/',auth['isAuthenticated'](),controller[_0x0fd2('0xd')]);router[_0x0fd2('0xe')]('/:id',auth[_0x0fd2('0x7')](),controller['update']);router[_0x0fd2('0xf')](_0x0fd2('0xa'),auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x10')]);module[_0x0fd2('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f2716c1..e9f0a5c 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xddc012,_0x5cf07a){var _0x395581=function(_0x483e9d){while(--_0x483e9d){_0xddc012['push'](_0xddc012['shift']());}};_0x395581(++_0x5cf07a);}(_0x34e8,0x12c));var _0x834e=function(_0x54d663,_0x51e9aa){_0x54d663=_0x54d663-0x0;var _0x3b97a0=_0x34e8[_0x54d663];return _0x3b97a0;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 61126df..92dab22 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 _0x1e68=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','includeAll','findAll','catch','show','include','find','create','body','params','describe','rimraf','zip-dir','moment','bluebird'];(function(_0x8162aa,_0x184ded){var _0x51f45b=function(_0x3b1620){while(--_0x3b1620){_0x8162aa['push'](_0x8162aa['shift']());}};_0x51f45b(++_0x184ded);}(_0x1e68,0xd1));var _0x81e6=function(_0x2500e5,_0x5090b4){_0x2500e5=_0x2500e5-0x0;var _0x305619=_0x1e68[_0x2500e5];return _0x305619;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81e6('0x0'));var zipdir=require(_0x81e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81e6('0x2'));var BPromise=require(_0x81e6('0x3'));var Mustache=require(_0x81e6('0x4'));var util=require(_0x81e6('0x5'));var path=require('path');var sox=require(_0x81e6('0x6'));var csv=require(_0x81e6('0x7'));var ejs=require(_0x81e6('0x8'));var fs=require('fs');var fs_extra=require(_0x81e6('0x9'));var _=require('lodash');var squel=require(_0x81e6('0xa'));var crypto=require(_0x81e6('0xb'));var jsforce=require(_0x81e6('0xc'));var deskjs=require(_0x81e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x81e6('0xe'));var Papa=require(_0x81e6('0xf'));var Redis=require(_0x81e6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x81e6('0x11'));var as=require(_0x81e6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81e6('0x13'));var utils=require(_0x81e6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81e6('0x15'))['db'];function respondWithStatusCode(_0x557fa0,_0x17dc2c){_0x17dc2c=_0x17dc2c||0xcc;return function(_0x3bd381){if(_0x3bd381){return _0x557fa0[_0x81e6('0x16')](_0x17dc2c);}return _0x557fa0[_0x81e6('0x17')](_0x17dc2c)[_0x81e6('0x18')]();};}function respondWithResult(_0x2a07f7,_0x5119a4){_0x5119a4=_0x5119a4||0xc8;return function(_0x52372f){if(_0x52372f){return _0x2a07f7[_0x81e6('0x17')](_0x5119a4)[_0x81e6('0x19')](_0x52372f);}};}function respondWithFilteredResult(_0x5d34ee,_0x1f9983){return function(_0x3dec5f){if(_0x3dec5f){var _0x7e8677=typeof _0x1f9983['offset']===_0x81e6('0x1a')&&typeof _0x1f9983[_0x81e6('0x1b')]==='undefined';var _0x48bc0b=_0x3dec5f[_0x81e6('0x1c')];var _0x5a6d69=_0x7e8677?0x0:_0x1f9983[_0x81e6('0x1d')];var _0xc61a92=_0x7e8677?_0x3dec5f[_0x81e6('0x1c')]:_0x1f9983['offset']+_0x1f9983['limit'];var _0x1281ac;if(_0xc61a92>=_0x48bc0b){_0xc61a92=_0x48bc0b;_0x1281ac=0xc8;}else{_0x1281ac=0xce;}_0x5d34ee['status'](_0x1281ac);return _0x5d34ee[_0x81e6('0x1e')](_0x81e6('0x1f'),_0x5a6d69+'-'+_0xc61a92+'/'+_0x48bc0b)[_0x81e6('0x19')](_0x3dec5f);}return null;};}function patchUpdates(_0x226e4f){return function(_0x49baa5){try{jsonpatch[_0x81e6('0x20')](_0x49baa5,_0x226e4f,!![]);}catch(_0x55d4fb){return BPromise[_0x81e6('0x21')](_0x55d4fb);}return _0x49baa5[_0x81e6('0x22')]();};}function saveUpdates(_0x140026,_0x2ecce5){return function(_0x30b0c7){if(_0x30b0c7){return _0x30b0c7['update'](_0x140026)[_0x81e6('0x23')](function(_0x409fa2){return _0x409fa2;});}return null;};}function removeEntity(_0x319660,_0x15882b){return function(_0x188648){if(_0x188648){return _0x188648[_0x81e6('0x24')]()[_0x81e6('0x23')](function(){_0x319660[_0x81e6('0x17')](0xcc)[_0x81e6('0x18')]();});}};}function handleEntityNotFound(_0x1af7fd,_0x412585){return function(_0x54b9e8){if(!_0x54b9e8){_0x1af7fd[_0x81e6('0x16')](0x194);}return _0x54b9e8;};}function handleError(_0x3773a8,_0x3db496){_0x3db496=_0x3db496||0x1f4;return function(_0x458fcd){logger[_0x81e6('0x25')](_0x458fcd[_0x81e6('0x26')]);if(_0x458fcd[_0x81e6('0x27')]){delete _0x458fcd[_0x81e6('0x27')];}_0x3773a8[_0x81e6('0x17')](_0x3db496)['send'](_0x458fcd);};}exports[_0x81e6('0x28')]=function(_0x17b0ae,_0x2f814f){var _0x502fed={},_0x414190={},_0x37e69c={'count':0x0,'rows':[]};var _0x4209a6=_[_0x81e6('0x29')](db[_0x81e6('0x2a')][_0x81e6('0x2b')],function(_0x40a124){return{'name':_0x40a124[_0x81e6('0x2c')],'type':_0x40a124['type'][_0x81e6('0x2d')]};});_0x414190['model']=_[_0x81e6('0x29')](_0x4209a6,_0x81e6('0x27'));_0x414190[_0x81e6('0x2e')]=_[_0x81e6('0x2f')](_0x17b0ae[_0x81e6('0x2e')]);_0x414190[_0x81e6('0x30')]=_[_0x81e6('0x31')](_0x414190[_0x81e6('0x32')],_0x414190['query']);_0x502fed[_0x81e6('0x33')]=_[_0x81e6('0x31')](_0x414190['model'],qs[_0x81e6('0x34')](_0x17b0ae['query'][_0x81e6('0x34')]));_0x502fed[_0x81e6('0x33')]=_0x502fed[_0x81e6('0x33')][_0x81e6('0x35')]?_0x502fed['attributes']:_0x414190[_0x81e6('0x32')];if(!_0x17b0ae[_0x81e6('0x2e')][_0x81e6('0x36')](_0x81e6('0x37'))){_0x502fed['limit']=qs['limit'](_0x17b0ae[_0x81e6('0x2e')][_0x81e6('0x1b')]);_0x502fed[_0x81e6('0x1d')]=qs['offset'](_0x17b0ae['query'][_0x81e6('0x1d')]);}_0x502fed[_0x81e6('0x38')]=qs['sort'](_0x17b0ae[_0x81e6('0x2e')]['sort']);_0x502fed[_0x81e6('0x39')]=qs[_0x81e6('0x30')](_[_0x81e6('0x3a')](_0x17b0ae[_0x81e6('0x2e')],_0x414190[_0x81e6('0x30')]),_0x4209a6);if(_0x17b0ae[_0x81e6('0x2e')]['filter']){_0x502fed['where']=_['merge'](_0x502fed[_0x81e6('0x39')],{'$or':_[_0x81e6('0x29')](_0x4209a6,function(_0x3b15ab){if(_0x3b15ab['type']!=='VIRTUAL'){var _0xd3bad7={};_0xd3bad7[_0x3b15ab[_0x81e6('0x27')]]={'$like':'%'+_0x17b0ae['query']['filter']+'%'};return _0xd3bad7;}})});}_0x502fed=_[_0x81e6('0x3b')]({},_0x502fed,_0x17b0ae[_0x81e6('0x3c')]);var _0x4a1bb1={'where':_0x502fed[_0x81e6('0x39')]};return db[_0x81e6('0x2a')][_0x81e6('0x1c')](_0x4a1bb1)['then'](function(_0x990f72){_0x37e69c[_0x81e6('0x1c')]=_0x990f72;if(_0x17b0ae['query'][_0x81e6('0x3d')]){_0x502fed['include']=[{'all':!![]}];}return db[_0x81e6('0x2a')][_0x81e6('0x3e')](_0x502fed);})[_0x81e6('0x23')](function(_0x1750e8){_0x37e69c['rows']=_0x1750e8;return _0x37e69c;})[_0x81e6('0x23')](respondWithFilteredResult(_0x2f814f,_0x502fed))[_0x81e6('0x3f')](handleError(_0x2f814f,null));};exports[_0x81e6('0x40')]=function(_0x3b5e71,_0x1088fd){var _0x5067ef={'raw':!![],'where':{'id':_0x3b5e71['params']['id']}},_0x35cfe4={};_0x35cfe4[_0x81e6('0x32')]=_[_0x81e6('0x2f')](db[_0x81e6('0x2a')][_0x81e6('0x2b')]);_0x35cfe4[_0x81e6('0x2e')]=_[_0x81e6('0x2f')](_0x3b5e71[_0x81e6('0x2e')]);_0x35cfe4[_0x81e6('0x30')]=_[_0x81e6('0x31')](_0x35cfe4[_0x81e6('0x32')],_0x35cfe4[_0x81e6('0x2e')]);_0x5067ef[_0x81e6('0x33')]=_[_0x81e6('0x31')](_0x35cfe4[_0x81e6('0x32')],qs[_0x81e6('0x34')](_0x3b5e71[_0x81e6('0x2e')][_0x81e6('0x34')]));_0x5067ef[_0x81e6('0x33')]=_0x5067ef[_0x81e6('0x33')]['length']?_0x5067ef[_0x81e6('0x33')]:_0x35cfe4[_0x81e6('0x32')];if(_0x3b5e71[_0x81e6('0x2e')][_0x81e6('0x3d')]){_0x5067ef[_0x81e6('0x41')]=[{'all':!![]}];}_0x5067ef=_[_0x81e6('0x3b')]({},_0x5067ef,_0x3b5e71[_0x81e6('0x3c')]);return db[_0x81e6('0x2a')][_0x81e6('0x42')](_0x5067ef)['then'](handleEntityNotFound(_0x1088fd,null))[_0x81e6('0x23')](respondWithResult(_0x1088fd,null))['catch'](handleError(_0x1088fd,null));};exports['create']=function(_0x5877a7,_0x4c4afa){return db[_0x81e6('0x2a')][_0x81e6('0x43')](_0x5877a7[_0x81e6('0x44')],{})[_0x81e6('0x23')](respondWithResult(_0x4c4afa,0xc9))[_0x81e6('0x3f')](handleError(_0x4c4afa,null));};exports['update']=function(_0x43c71c,_0x5b9e4f){if(_0x43c71c[_0x81e6('0x44')]['id']){delete _0x43c71c[_0x81e6('0x44')]['id'];}return db[_0x81e6('0x2a')]['find']({'where':{'id':_0x43c71c[_0x81e6('0x45')]['id']}})[_0x81e6('0x23')](handleEntityNotFound(_0x5b9e4f,null))[_0x81e6('0x23')](saveUpdates(_0x43c71c[_0x81e6('0x44')],null))['then'](respondWithResult(_0x5b9e4f,null))[_0x81e6('0x3f')](handleError(_0x5b9e4f,null));};exports[_0x81e6('0x24')]=function(_0x49afb5,_0x5af4bb){return db[_0x81e6('0x2a')]['find']({'where':{'id':_0x49afb5[_0x81e6('0x45')]['id']}})[_0x81e6('0x23')](handleEntityNotFound(_0x5af4bb,null))[_0x81e6('0x23')](removeEntity(_0x5af4bb,null))[_0x81e6('0x3f')](handleError(_0x5af4bb,null));};exports[_0x81e6('0x46')]=function(_0x4ee7bb,_0x2fe391){return db[_0x81e6('0x2a')][_0x81e6('0x46')]()[_0x81e6('0x23')](respondWithResult(_0x2fe391,null))[_0x81e6('0x3f')](handleError(_0x2fe391,null));}; \ No newline at end of file +var _0x9482=['create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','../../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','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','merge','find'];(function(_0x3a5062,_0x135eee){var _0x3ecc6d=function(_0xc64382){while(--_0xc64382){_0x3a5062['push'](_0x3a5062['shift']());}};_0x3ecc6d(++_0x135eee);}(_0x9482,0x9f));var _0x2948=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9482[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2948('0x0'));var rimraf=require(_0x2948('0x1'));var zipdir=require(_0x2948('0x2'));var jsonpatch=require(_0x2948('0x3'));var rp=require(_0x2948('0x4'));var moment=require(_0x2948('0x5'));var BPromise=require(_0x2948('0x6'));var Mustache=require(_0x2948('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2948('0x8'));var csv=require(_0x2948('0x9'));var ejs=require(_0x2948('0xa'));var fs=require('fs');var fs_extra=require(_0x2948('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2948('0xc'));var deskjs=require(_0x2948('0xd'));var toCsv=require(_0x2948('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2948('0xe'));var qs=require(_0x2948('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2948('0x10'));var logger=require(_0x2948('0x11'))(_0x2948('0x12'));var utils=require(_0x2948('0x13'));var config=require(_0x2948('0x14'));var licenseUtil=require(_0x2948('0x15'));var db=require(_0x2948('0x16'))['db'];function respondWithStatusCode(_0x555b42,_0x396875){_0x396875=_0x396875||0xcc;return function(_0x9d1066){if(_0x9d1066){return _0x555b42[_0x2948('0x17')](_0x396875);}return _0x555b42[_0x2948('0x18')](_0x396875)['end']();};}function respondWithResult(_0x29f421,_0x237d57){_0x237d57=_0x237d57||0xc8;return function(_0x176565){if(_0x176565){return _0x29f421[_0x2948('0x18')](_0x237d57)[_0x2948('0x19')](_0x176565);}};}function respondWithFilteredResult(_0xf32b2b,_0x514e01){return function(_0x4dd676){if(_0x4dd676){var _0x5b6f8f=typeof _0x514e01[_0x2948('0x1a')]===_0x2948('0x1b')&&typeof _0x514e01[_0x2948('0x1c')]===_0x2948('0x1b');var _0x146cec=_0x4dd676[_0x2948('0x1d')];var _0x3b3577=_0x5b6f8f?0x0:_0x514e01[_0x2948('0x1a')];var _0x34b85c=_0x5b6f8f?_0x4dd676[_0x2948('0x1d')]:_0x514e01[_0x2948('0x1a')]+_0x514e01['limit'];var _0x527ff2;if(_0x34b85c>=_0x146cec){_0x34b85c=_0x146cec;_0x527ff2=0xc8;}else{_0x527ff2=0xce;}_0xf32b2b['status'](_0x527ff2);return _0xf32b2b[_0x2948('0x1e')](_0x2948('0x1f'),_0x3b3577+'-'+_0x34b85c+'/'+_0x146cec)[_0x2948('0x19')](_0x4dd676);}return null;};}function patchUpdates(_0x39ded3){return function(_0x460085){try{jsonpatch[_0x2948('0x20')](_0x460085,_0x39ded3,!![]);}catch(_0x597184){return BPromise[_0x2948('0x21')](_0x597184);}return _0x460085[_0x2948('0x22')]();};}function saveUpdates(_0x1fcae0,_0x57a0e2){return function(_0x4dd1b5){if(_0x4dd1b5){return _0x4dd1b5['update'](_0x1fcae0)[_0x2948('0x23')](function(_0x13ad20){return _0x13ad20;});}return null;};}function removeEntity(_0x4d9af1,_0x1f9b94){return function(_0x54e1fc){if(_0x54e1fc){return _0x54e1fc[_0x2948('0x24')]()['then'](function(){_0x4d9af1[_0x2948('0x18')](0xcc)[_0x2948('0x25')]();});}};}function handleEntityNotFound(_0x4c0eff,_0x4f6e68){return function(_0x5e7416){if(!_0x5e7416){_0x4c0eff['sendStatus'](0x194);}return _0x5e7416;};}function handleError(_0x218435,_0x420358){_0x420358=_0x420358||0x1f4;return function(_0x3b7895){logger[_0x2948('0x26')](_0x3b7895[_0x2948('0x27')]);if(_0x3b7895['name']){delete _0x3b7895[_0x2948('0x28')];}_0x218435[_0x2948('0x18')](_0x420358)[_0x2948('0x29')](_0x3b7895);};}exports[_0x2948('0x2a')]=function(_0x404597,_0x55fc7a){var _0x461da4={},_0x5ea19c={},_0x11d52c={'count':0x0,'rows':[]};var _0x312714=_['map'](db[_0x2948('0x2b')]['rawAttributes'],function(_0x4dcdc0){return{'name':_0x4dcdc0[_0x2948('0x2c')],'type':_0x4dcdc0[_0x2948('0x2d')][_0x2948('0x2e')]};});_0x5ea19c[_0x2948('0x2f')]=_[_0x2948('0x30')](_0x312714,_0x2948('0x28'));_0x5ea19c[_0x2948('0x31')]=_[_0x2948('0x32')](_0x404597[_0x2948('0x31')]);_0x5ea19c['filters']=_['intersection'](_0x5ea19c[_0x2948('0x2f')],_0x5ea19c['query']);_0x461da4[_0x2948('0x33')]=_[_0x2948('0x34')](_0x5ea19c['model'],qs[_0x2948('0x35')](_0x404597[_0x2948('0x31')][_0x2948('0x35')]));_0x461da4[_0x2948('0x33')]=_0x461da4['attributes'][_0x2948('0x36')]?_0x461da4[_0x2948('0x33')]:_0x5ea19c[_0x2948('0x2f')];if(!_0x404597[_0x2948('0x31')]['hasOwnProperty'](_0x2948('0x37'))){_0x461da4['limit']=qs[_0x2948('0x1c')](_0x404597['query']['limit']);_0x461da4[_0x2948('0x1a')]=qs[_0x2948('0x1a')](_0x404597[_0x2948('0x31')][_0x2948('0x1a')]);}_0x461da4[_0x2948('0x38')]=qs[_0x2948('0x39')](_0x404597[_0x2948('0x31')][_0x2948('0x39')]);_0x461da4[_0x2948('0x3a')]=qs['filters'](_[_0x2948('0x3b')](_0x404597[_0x2948('0x31')],_0x5ea19c[_0x2948('0x3c')]),_0x312714);if(_0x404597[_0x2948('0x31')][_0x2948('0x3d')]){_0x461da4['where']=_['merge'](_0x461da4['where'],{'$or':_[_0x2948('0x30')](_0x312714,function(_0x5ba010){if(_0x5ba010[_0x2948('0x2d')]!==_0x2948('0x3e')){var _0x308597={};_0x308597[_0x5ba010[_0x2948('0x28')]]={'$like':'%'+_0x404597[_0x2948('0x31')][_0x2948('0x3d')]+'%'};return _0x308597;}})});}_0x461da4=_['merge']({},_0x461da4,_0x404597[_0x2948('0x3f')]);var _0x31e0e7={'where':_0x461da4[_0x2948('0x3a')]};return db[_0x2948('0x2b')][_0x2948('0x1d')](_0x31e0e7)[_0x2948('0x23')](function(_0x53ea40){_0x11d52c[_0x2948('0x1d')]=_0x53ea40;if(_0x404597[_0x2948('0x31')]['includeAll']){_0x461da4[_0x2948('0x40')]=[{'all':!![]}];}return db[_0x2948('0x2b')][_0x2948('0x41')](_0x461da4);})[_0x2948('0x23')](function(_0x305959){_0x11d52c[_0x2948('0x42')]=_0x305959;return _0x11d52c;})[_0x2948('0x23')](respondWithFilteredResult(_0x55fc7a,_0x461da4))[_0x2948('0x43')](handleError(_0x55fc7a,null));};exports[_0x2948('0x44')]=function(_0x140d24,_0x5d64cb){var _0x8785dc={'raw':!![],'where':{'id':_0x140d24['params']['id']}},_0xc7d426={};_0xc7d426[_0x2948('0x2f')]=_[_0x2948('0x32')](db[_0x2948('0x2b')][_0x2948('0x45')]);_0xc7d426[_0x2948('0x31')]=_[_0x2948('0x32')](_0x140d24[_0x2948('0x31')]);_0xc7d426[_0x2948('0x3c')]=_['intersection'](_0xc7d426[_0x2948('0x2f')],_0xc7d426['query']);_0x8785dc[_0x2948('0x33')]=_['intersection'](_0xc7d426[_0x2948('0x2f')],qs[_0x2948('0x35')](_0x140d24[_0x2948('0x31')]['fields']));_0x8785dc[_0x2948('0x33')]=_0x8785dc[_0x2948('0x33')][_0x2948('0x36')]?_0x8785dc[_0x2948('0x33')]:_0xc7d426['model'];if(_0x140d24[_0x2948('0x31')]['includeAll']){_0x8785dc[_0x2948('0x40')]=[{'all':!![]}];}_0x8785dc=_[_0x2948('0x46')]({},_0x8785dc,_0x140d24['options']);return db[_0x2948('0x2b')][_0x2948('0x47')](_0x8785dc)[_0x2948('0x23')](handleEntityNotFound(_0x5d64cb,null))[_0x2948('0x23')](respondWithResult(_0x5d64cb,null))[_0x2948('0x43')](handleError(_0x5d64cb,null));};exports[_0x2948('0x48')]=function(_0x248163,_0x18f875){return db['SmsTransferReport']['create'](_0x248163[_0x2948('0x49')],{})['then'](respondWithResult(_0x18f875,0xc9))[_0x2948('0x43')](handleError(_0x18f875,null));};exports[_0x2948('0x4a')]=function(_0x5e6028,_0x55cb90){if(_0x5e6028[_0x2948('0x49')]['id']){delete _0x5e6028[_0x2948('0x49')]['id'];}return db[_0x2948('0x2b')][_0x2948('0x47')]({'where':{'id':_0x5e6028[_0x2948('0x4b')]['id']}})[_0x2948('0x23')](handleEntityNotFound(_0x55cb90,null))[_0x2948('0x23')](saveUpdates(_0x5e6028[_0x2948('0x49')],null))[_0x2948('0x23')](respondWithResult(_0x55cb90,null))[_0x2948('0x43')](handleError(_0x55cb90,null));};exports[_0x2948('0x24')]=function(_0x4cfeab,_0x148122){return db[_0x2948('0x2b')][_0x2948('0x47')]({'where':{'id':_0x4cfeab[_0x2948('0x4b')]['id']}})[_0x2948('0x23')](handleEntityNotFound(_0x148122,null))['then'](removeEntity(_0x148122,null))[_0x2948('0x43')](handleError(_0x148122,null));};exports[_0x2948('0x4c')]=function(_0x2c5ea6,_0x2952be){return db[_0x2948('0x2b')][_0x2948('0x4c')]()[_0x2948('0x23')](respondWithResult(_0x2952be,null))['catch'](handleError(_0x2952be,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 958c856..4cc832c 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 _0x4d9e=['rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','api','bluebird','path'];(function(_0x42265f,_0x3537f8){var _0x125660=function(_0xe24f8c){while(--_0xe24f8c){_0x42265f['push'](_0x42265f['shift']());}};_0x125660(++_0x3537f8);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x463ff3,_0x3ccd7e){_0x463ff3=_0x463ff3-0x0;var _0x409d33=_0x4d9e[_0x463ff3];return _0x409d33;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe4d9('0x9'),'fields':[_0xe4d9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe747=['api','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util'];(function(_0x32f063,_0x73bda3){var _0x434d9f=function(_0x166a7b){while(--_0x166a7b){_0x32f063['push'](_0x32f063['shift']());}};_0x434d9f(++_0x73bda3);}(_0xe747,0x13d));var _0x7e74=function(_0xf4cdc4,_0x1b6254){_0xf4cdc4=_0xf4cdc4-0x0;var _0x500088=_0xe747[_0xf4cdc4];return _0x500088;};'use strict';var _=require(_0x7e74('0x0'));var util=require(_0x7e74('0x1'));var logger=require('../../config/logger')(_0x7e74('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e74('0x3'));var fs=require('fs');var path=require(_0x7e74('0x4'));var rimraf=require(_0x7e74('0x5'));var config=require(_0x7e74('0x6'));var attributes=require(_0x7e74('0x7'));module['exports']=function(_0x33b887,_0x141853){return _0x33b887[_0x7e74('0x8')](_0x7e74('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x7e74('0xa'),'fields':[_0x7e74('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 7e40c8b..27c1bd5 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 _0x9a22=['debug','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x209360,_0x2cd574){var _0x5060cd=function(_0x4fa41c){while(--_0x4fa41c){_0x209360['push'](_0x209360['shift']());}};_0x5060cd(++_0x2cd574);}(_0x9a22,0x75));var _0x29a2=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x9a22[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var moment=require(_0x29a2('0x2'));var BPromise=require(_0x29a2('0x3'));var rs=require(_0x29a2('0x4'));var fs=require('fs');var Redis=require(_0x29a2('0x5'));var db=require(_0x29a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29a2('0x7'));var config=require(_0x29a2('0x8'));var jayson=require(_0x29a2('0x9'));var client=jayson[_0x29a2('0xa')][_0x29a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfb91e8,_0x41ea7c,_0x2887e1){return new BPromise(function(_0x4b55de,_0x2d7d97){return client[_0x29a2('0xc')](_0xfb91e8,_0x2887e1)['then'](function(_0x3d9a5c){logger[_0x29a2('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x41ea7c,_0x29a2('0xe'));logger[_0x29a2('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x41ea7c,_0x29a2('0xe'),JSON[_0x29a2('0x10')](_0x3d9a5c));if(_0x3d9a5c[_0x29a2('0x11')]){if(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x12')]===0x1f4){logger[_0x29a2('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x41ea7c,_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);return _0x2d7d97(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);}logger[_0x29a2('0x11')](_0x29a2('0x14'),_0x41ea7c,_0x3d9a5c[_0x29a2('0x11')]['message']);return _0x4b55de(_0x3d9a5c[_0x29a2('0x11')][_0x29a2('0x13')]);}else{logger[_0x29a2('0xd')](_0x29a2('0x14'),_0x41ea7c,'request\x20sent');_0x4b55de(_0x3d9a5c['result'][_0x29a2('0x13')]);}})[_0x29a2('0x15')](function(_0x1b712c){logger[_0x29a2('0x11')](_0x29a2('0x14'),_0x41ea7c,_0x1b712c);_0x2d7d97(_0x1b712c);});});} \ No newline at end of file +var _0x950a=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsTransferReport,\x20%s,\x20%s','request\x20sent','result'];(function(_0x42cd0d,_0x229cb3){var _0x1f0de8=function(_0x19de7e){while(--_0x19de7e){_0x42cd0d['push'](_0x42cd0d['shift']());}};_0x1f0de8(++_0x229cb3);}(_0x950a,0x111));var _0xa950=function(_0x57df1b,_0x57c7dd){_0x57df1b=_0x57df1b-0x0;var _0x476a12=_0x950a[_0x57df1b];return _0x476a12;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var moment=require(_0xa950('0x2'));var BPromise=require(_0xa950('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa950('0x4'));var db=require(_0xa950('0x5'))['db'];var utils=require(_0xa950('0x6'));var logger=require(_0xa950('0x7'))('rpc');var config=require(_0xa950('0x8'));var jayson=require(_0xa950('0x9'));var client=jayson['client'][_0xa950('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3645b6,_0x5ba2da,_0x5675f8){return new BPromise(function(_0x26e05c,_0x12ef5a){return client[_0xa950('0xb')](_0x3645b6,_0x5675f8)[_0xa950('0xc')](function(_0x274d9a){logger[_0xa950('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x5ba2da,'request\x20sent');logger['debug'](_0xa950('0xe'),_0x5ba2da,'request\x20sent',JSON[_0xa950('0xf')](_0x274d9a));if(_0x274d9a[_0xa950('0x10')]){if(_0x274d9a[_0xa950('0x10')]['code']===0x1f4){logger[_0xa950('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5ba2da,_0x274d9a[_0xa950('0x10')][_0xa950('0x11')]);return _0x12ef5a(_0x274d9a[_0xa950('0x10')]['message']);}logger[_0xa950('0x10')](_0xa950('0x12'),_0x5ba2da,_0x274d9a[_0xa950('0x10')]['message']);return _0x26e05c(_0x274d9a[_0xa950('0x10')][_0xa950('0x11')]);}else{logger[_0xa950('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x5ba2da,_0xa950('0x13'));_0x26e05c(_0x274d9a[_0xa950('0x14')][_0xa950('0x11')]);}})['catch'](function(_0x146361){logger[_0xa950('0x10')](_0xa950('0x12'),_0x5ba2da,_0x146361);_0x12ef5a(_0x146361);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0ea4fdb..b0c2d1c 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 _0xc9e0=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','get','/:id','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x169cb6,_0x4dc0e5){var _0x1bd03e=function(_0x144b19){while(--_0x144b19){_0x169cb6['push'](_0x169cb6['shift']());}};_0x1bd03e(++_0x4dc0e5);}(_0xc9e0,0x159));var _0x0c9e=function(_0x1a5f94,_0x19b888){_0x1a5f94=_0x1a5f94-0x0;var _0x352348=_0xc9e0[_0x1a5f94];return _0x352348;};'use strict';var multer=require(_0x0c9e('0x0'));var util=require(_0x0c9e('0x1'));var path=require(_0x0c9e('0x2'));var timeout=require(_0x0c9e('0x3'));var express=require(_0x0c9e('0x4'));var router=express[_0x0c9e('0x5')]();var fs_extra=require(_0x0c9e('0x6'));var auth=require(_0x0c9e('0x7'));var interaction=require(_0x0c9e('0x8'));var config=require('../../config/environment');var controller=require(_0x0c9e('0x9'));router['get']('/',auth[_0x0c9e('0xa')](),controller[_0x0c9e('0xb')]);router[_0x0c9e('0xc')](_0x0c9e('0xd'),auth[_0x0c9e('0xa')](),controller['show']);router[_0x0c9e('0xc')](_0x0c9e('0xe'),auth[_0x0c9e('0xa')](),controller[_0x0c9e('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x269d0f,_0x1a9698,_0x4261e6){_0x4261e6(null,path[_0x0c9e('0x10')](config[_0x0c9e('0x11')],_0x0c9e('0x12')));},'filename':function(_0x58ea6a,_0x27d218,_0x45fa39){_0x27d218[_0x0c9e('0x13')]=_0x27d218[_0x0c9e('0x13')][_0x0c9e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45fa39(null,util[_0x0c9e('0x15')](_0x0c9e('0x16'),path[_0x0c9e('0x17')](_0x27d218[_0x0c9e('0x13')],path[_0x0c9e('0x18')](_0x27d218[_0x0c9e('0x13')])),Date[_0x0c9e('0x19')](),path[_0x0c9e('0x18')](_0x27d218['originalname'])));}})});router[_0x0c9e('0x1a')]('/',upload[_0x0c9e('0x1b')](_0x0c9e('0x1c')),controller[_0x0c9e('0x1d')]);router[_0x0c9e('0x1e')](_0x0c9e('0xd'),auth[_0x0c9e('0xa')](),controller[_0x0c9e('0x1f')]);router[_0x0c9e('0x20')](_0x0c9e('0xd'),auth['isAuthenticated'](),controller[_0x0c9e('0x20')]);module[_0x0c9e('0x21')]=router; \ No newline at end of file +var _0x2517=['show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id'];(function(_0x2a6fc9,_0x1023cd){var _0x124d45=function(_0x40c381){while(--_0x40c381){_0x2a6fc9['push'](_0x2a6fc9['shift']());}};_0x124d45(++_0x1023cd);}(_0x2517,0x90));var _0x7251=function(_0x385b60,_0x9362d3){_0x385b60=_0x385b60-0x0;var _0x459acb=_0x2517[_0x385b60];return _0x459acb;};'use strict';var multer=require(_0x7251('0x0'));var util=require(_0x7251('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7251('0x2'));var router=express[_0x7251('0x3')]();var fs_extra=require(_0x7251('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7251('0x5'));var config=require(_0x7251('0x6'));var controller=require(_0x7251('0x7'));router['get']('/',auth[_0x7251('0x8')](),controller[_0x7251('0x9')]);router['get'](_0x7251('0xa'),auth[_0x7251('0x8')](),controller[_0x7251('0xb')]);router['get'](_0x7251('0xc'),auth['isAuthenticated'](),controller[_0x7251('0xd')]);var upload=multer({'storage':multer[_0x7251('0xe')]({'destination':function(_0x5494d9,_0x557120,_0x3ae859){_0x3ae859(null,path[_0x7251('0xf')](config[_0x7251('0x10')],_0x7251('0x11')));},'filename':function(_0x5171d8,_0x50eba4,_0x159178){_0x50eba4[_0x7251('0x12')]=_0x50eba4[_0x7251('0x12')][_0x7251('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x159178(null,util[_0x7251('0x14')](_0x7251('0x15'),path[_0x7251('0x16')](_0x50eba4[_0x7251('0x12')],path[_0x7251('0x17')](_0x50eba4['originalname'])),Date[_0x7251('0x18')](),path[_0x7251('0x17')](_0x50eba4[_0x7251('0x12')])));}})});router['post']('/',upload[_0x7251('0x19')](_0x7251('0x1a')),controller[_0x7251('0x1b')]);router['put'](_0x7251('0xa'),auth[_0x7251('0x8')](),controller[_0x7251('0x1c')]);router['delete'](_0x7251('0xa'),auth[_0x7251('0x8')](),controller[_0x7251('0x1d')]);module[_0x7251('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f42df27..69deb37 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 _0xbde1=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x6444ab,_0x3b0492){var _0x593c06=function(_0x3b4957){while(--_0x3b4957){_0x6444ab['push'](_0x6444ab['shift']());}};_0x593c06(++_0x3b0492);}(_0xbde1,0x6f));var _0x1bde=function(_0x36574b,_0x19a083){_0x36574b=_0x36574b-0x0;var _0x3c97aa=_0xbde1[_0x36574b];return _0x3c97aa;};'use strict';var Sequelize=require('sequelize');module[_0x1bde('0x0')]={'name':{'type':Sequelize[_0x1bde('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x1bde('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1bde('0x1')]},'original_format':{'type':Sequelize[_0x1bde('0x1')]},'original_duration':{'type':Sequelize[_0x1bde('0x2')]},'original_sampleCount':{'type':Sequelize[_0x1bde('0x3')]},'original_channelCount':{'type':Sequelize[_0x1bde('0x4')]},'original_bitRate':{'type':Sequelize[_0x1bde('0x3')]},'original_sampleRate':{'type':Sequelize[_0x1bde('0x4')]},'converted_format':{'type':Sequelize[_0x1bde('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x1bde('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x1bde('0x4')]}}; \ No newline at end of file +var _0x8a72=['INTEGER','STRING','name','FLOAT','BIGINT'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8a72,0x1eb));var _0x28a7=function(_0x56778a,_0xac4b6){_0x56778a=_0x56778a-0x0;var _0x268d60=_0x8a72[_0x56778a];return _0x268d60;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x28a7('0x0')],'unique':_0x28a7('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x28a7('0x0')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x28a7('0x0')]},'original_format':{'type':Sequelize[_0x28a7('0x0')]},'original_duration':{'type':Sequelize[_0x28a7('0x2')]},'original_sampleCount':{'type':Sequelize[_0x28a7('0x3')]},'original_channelCount':{'type':Sequelize[_0x28a7('0x4')]},'original_bitRate':{'type':Sequelize[_0x28a7('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x28a7('0x0')]},'converted_duration':{'type':Sequelize[_0x28a7('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x28a7('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x28a7('0x3')]},'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 d25e14f..d245191 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 _0xd635=['keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','Sound','includeAll','include','findAll','rows','catch','params','download','find','save_name','converted_format','existsSync','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','error','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','Sounds','UserProfileResource','stack','name','map','key','query'];(function(_0x161ab6,_0x51ee5c){var _0x437d12=function(_0x38002d){while(--_0x38002d){_0x161ab6['push'](_0x161ab6['shift']());}};_0x437d12(++_0x51ee5c);}(_0xd635,0x147));var _0x5d63=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xd635[_0xcfd89f];return _0x59acd4;};'use strict';var emlformat=require(_0x5d63('0x0'));var rimraf=require(_0x5d63('0x1'));var zipdir=require(_0x5d63('0x2'));var jsonpatch=require(_0x5d63('0x3'));var rp=require(_0x5d63('0x4'));var moment=require(_0x5d63('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5d63('0x6'));var util=require(_0x5d63('0x7'));var path=require(_0x5d63('0x8'));var sox=require(_0x5d63('0x9'));var csv=require(_0x5d63('0xa'));var ejs=require(_0x5d63('0xb'));var fs=require('fs');var fs_extra=require(_0x5d63('0xc'));var _=require(_0x5d63('0xd'));var squel=require(_0x5d63('0xe'));var crypto=require(_0x5d63('0xf'));var jsforce=require(_0x5d63('0x10'));var deskjs=require(_0x5d63('0x11'));var toCsv=require(_0x5d63('0xa'));var querystring=require(_0x5d63('0x12'));var Papa=require(_0x5d63('0x13'));var Redis=require(_0x5d63('0x14'));var authService=require(_0x5d63('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5d63('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d63('0x17'))(_0x5d63('0x18'));var utils=require(_0x5d63('0x19'));var config=require(_0x5d63('0x1a'));var licenseUtil=require(_0x5d63('0x1b'));var db=require(_0x5d63('0x1c'))['db'];function respondWithStatusCode(_0x1a4197,_0x43a37c){_0x43a37c=_0x43a37c||0xcc;return function(_0x112ee5){if(_0x112ee5){return _0x1a4197[_0x5d63('0x1d')](_0x43a37c);}return _0x1a4197[_0x5d63('0x1e')](_0x43a37c)[_0x5d63('0x1f')]();};}function respondWithResult(_0x167c39,_0x310e80){_0x310e80=_0x310e80||0xc8;return function(_0x376943){if(_0x376943){return _0x167c39[_0x5d63('0x1e')](_0x310e80)[_0x5d63('0x20')](_0x376943);}};}function respondWithFilteredResult(_0x4ea356,_0x184fb0){return function(_0x200d92){if(_0x200d92){var _0x4f92c8=typeof _0x184fb0[_0x5d63('0x21')]===_0x5d63('0x22')&&typeof _0x184fb0[_0x5d63('0x23')]==='undefined';var _0x7561c5=_0x200d92[_0x5d63('0x24')];var _0x4bf5a2=_0x4f92c8?0x0:_0x184fb0['offset'];var _0x379da7=_0x4f92c8?_0x200d92[_0x5d63('0x24')]:_0x184fb0['offset']+_0x184fb0[_0x5d63('0x23')];var _0x1ccd04;if(_0x379da7>=_0x7561c5){_0x379da7=_0x7561c5;_0x1ccd04=0xc8;}else{_0x1ccd04=0xce;}_0x4ea356[_0x5d63('0x1e')](_0x1ccd04);return _0x4ea356[_0x5d63('0x25')](_0x5d63('0x26'),_0x4bf5a2+'-'+_0x379da7+'/'+_0x7561c5)['json'](_0x200d92);}return null;};}function patchUpdates(_0x1cafeb){return function(_0x31b9e){try{jsonpatch[_0x5d63('0x27')](_0x31b9e,_0x1cafeb,!![]);}catch(_0x35baef){return BPromise['reject'](_0x35baef);}return _0x31b9e[_0x5d63('0x28')]();};}function saveUpdates(_0x5cf981,_0x52ba75){return function(_0x1b1660){if(_0x1b1660){return _0x1b1660['update'](_0x5cf981)['then'](function(_0x7dac17){return _0x7dac17;});}return null;};}function removeEntity(_0x142c1b,_0x391132){return function(_0x2637b2){if(_0x2637b2){return _0x2637b2[_0x5d63('0x29')]()[_0x5d63('0x2a')](function(){var _0x14c8f9=_0x2637b2[_0x5d63('0x2b')]({'plain':!![]});var _0x491b71=_0x5d63('0x2c');return db[_0x5d63('0x2d')]['destroy']({'where':{'type':_0x491b71,'resourceId':_0x14c8f9['id']}})[_0x5d63('0x2a')](function(){return _0x2637b2;});})[_0x5d63('0x2a')](function(){_0x142c1b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11166a,_0x4e8f51){return function(_0x8ac6d2){if(!_0x8ac6d2){_0x11166a['sendStatus'](0x194);}return _0x8ac6d2;};}function handleError(_0x25bc5c,_0xa1933f){_0xa1933f=_0xa1933f||0x1f4;return function(_0x3493ff){logger['error'](_0x3493ff[_0x5d63('0x2e')]);if(_0x3493ff[_0x5d63('0x2f')]){delete _0x3493ff[_0x5d63('0x2f')];}_0x25bc5c[_0x5d63('0x1e')](_0xa1933f)['send'](_0x3493ff);};}exports['index']=function(_0x5967a4,_0x5c6ae1){var _0x19e107={},_0x26481e={},_0x3e9e19={'count':0x0,'rows':[]};var _0x5aae6a=_[_0x5d63('0x30')](db['Sound']['rawAttributes'],function(_0x5fbfb1){return{'name':_0x5fbfb1['fieldName'],'type':_0x5fbfb1['type'][_0x5d63('0x31')]};});_0x26481e['model']=_[_0x5d63('0x30')](_0x5aae6a,_0x5d63('0x2f'));_0x26481e[_0x5d63('0x32')]=_[_0x5d63('0x33')](_0x5967a4[_0x5d63('0x32')]);_0x26481e['filters']=_[_0x5d63('0x34')](_0x26481e[_0x5d63('0x35')],_0x26481e[_0x5d63('0x32')]);_0x19e107[_0x5d63('0x36')]=_[_0x5d63('0x34')](_0x26481e[_0x5d63('0x35')],qs[_0x5d63('0x37')](_0x5967a4['query'][_0x5d63('0x37')]));_0x19e107[_0x5d63('0x36')]=_0x19e107[_0x5d63('0x36')][_0x5d63('0x38')]?_0x19e107['attributes']:_0x26481e[_0x5d63('0x35')];if(!_0x5967a4[_0x5d63('0x32')][_0x5d63('0x39')](_0x5d63('0x3a'))){_0x19e107[_0x5d63('0x23')]=qs[_0x5d63('0x23')](_0x5967a4[_0x5d63('0x32')][_0x5d63('0x23')]);_0x19e107[_0x5d63('0x21')]=qs[_0x5d63('0x21')](_0x5967a4['query'][_0x5d63('0x21')]);}_0x19e107['order']=qs[_0x5d63('0x3b')](_0x5967a4['query'][_0x5d63('0x3b')]);_0x19e107[_0x5d63('0x3c')]=qs[_0x5d63('0x3d')](_[_0x5d63('0x3e')](_0x5967a4[_0x5d63('0x32')],_0x26481e[_0x5d63('0x3d')]),_0x5aae6a);if(_0x5967a4['query'][_0x5d63('0x3f')]){_0x19e107[_0x5d63('0x3c')]=_[_0x5d63('0x40')](_0x19e107[_0x5d63('0x3c')],{'$or':_[_0x5d63('0x30')](_0x5aae6a,function(_0x3062c9){if(_0x3062c9[_0x5d63('0x41')]!=='VIRTUAL'){var _0x17ad14={};_0x17ad14[_0x3062c9[_0x5d63('0x2f')]]={'$like':'%'+_0x5967a4['query'][_0x5d63('0x3f')]+'%'};return _0x17ad14;}})});}_0x19e107=_[_0x5d63('0x40')]({},_0x19e107,_0x5967a4[_0x5d63('0x42')]);var _0x5191c3={'where':_0x19e107[_0x5d63('0x3c')]};return db[_0x5d63('0x43')][_0x5d63('0x24')](_0x5191c3)['then'](function(_0x1f6434){_0x3e9e19[_0x5d63('0x24')]=_0x1f6434;if(_0x5967a4[_0x5d63('0x32')][_0x5d63('0x44')]){_0x19e107[_0x5d63('0x45')]=[{'all':!![]}];}return db[_0x5d63('0x43')][_0x5d63('0x46')](_0x19e107);})[_0x5d63('0x2a')](function(_0x8c7342){_0x3e9e19[_0x5d63('0x47')]=_0x8c7342;return _0x3e9e19;})[_0x5d63('0x2a')](respondWithFilteredResult(_0x5c6ae1,_0x19e107))[_0x5d63('0x48')](handleError(_0x5c6ae1,null));};exports['show']=function(_0x4738e1,_0x13c83e){var _0x186178={'raw':!![],'where':{'id':_0x4738e1[_0x5d63('0x49')]['id']}},_0x548ef0={};_0x548ef0[_0x5d63('0x35')]=_[_0x5d63('0x33')](db[_0x5d63('0x43')]['rawAttributes']);_0x548ef0[_0x5d63('0x32')]=_[_0x5d63('0x33')](_0x4738e1['query']);_0x548ef0[_0x5d63('0x3d')]=_['intersection'](_0x548ef0['model'],_0x548ef0[_0x5d63('0x32')]);_0x186178['attributes']=_['intersection'](_0x548ef0[_0x5d63('0x35')],qs[_0x5d63('0x37')](_0x4738e1[_0x5d63('0x32')][_0x5d63('0x37')]));_0x186178[_0x5d63('0x36')]=_0x186178[_0x5d63('0x36')]['length']?_0x186178[_0x5d63('0x36')]:_0x548ef0[_0x5d63('0x35')];if(_0x4738e1['query'][_0x5d63('0x44')]){_0x186178[_0x5d63('0x45')]=[{'all':!![]}];}_0x186178=_[_0x5d63('0x40')]({},_0x186178,_0x4738e1[_0x5d63('0x42')]);return db[_0x5d63('0x43')]['find'](_0x186178)[_0x5d63('0x2a')](handleEntityNotFound(_0x13c83e,null))['then'](respondWithResult(_0x13c83e,null))[_0x5d63('0x48')](handleError(_0x13c83e,null));};exports[_0x5d63('0x4a')]=function(_0x22fafb,_0x54523e,_0x3b4d9f){return db[_0x5d63('0x43')][_0x5d63('0x4b')]({'where':{'id':_0x22fafb[_0x5d63('0x49')]['id']},'attributes':[_0x5d63('0x2f'),_0x5d63('0x4c'),_0x5d63('0x4d')],'raw':!![]})[_0x5d63('0x2a')](handleEntityNotFound(_0x54523e,null))[_0x5d63('0x2a')](function(_0x1c70b7){if(_0x1c70b7){if(!fs[_0x5d63('0x4e')](path['join'](config[_0x5d63('0x4f')],'server/files/sounds/converted',_0x1c70b7[_0x5d63('0x4c')]+'.'+_0x1c70b7[_0x5d63('0x4d')]))){throw new db[(_0x5d63('0x50'))][(_0x5d63('0x51'))](_0x5d63('0x52'));}return _0x54523e[_0x5d63('0x4a')](path['join'](config[_0x5d63('0x4f')],_0x5d63('0x53'),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x1c70b7[_0x5d63('0x4c')],_0x1c70b7[_0x5d63('0x4d')])),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x1c70b7[_0x5d63('0x2f')],_0x1c70b7[_0x5d63('0x4d')]));}return null;})['catch'](handleError(_0x54523e,null));};exports[_0x5d63('0x56')]=function(_0x2577b4,_0x3e762d,_0x3d7e93){var _0x42381d={'name':path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x59')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')]['originalname'])),'save_name':path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')])),'original_format':path['extname'](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x59')])[_0x5d63('0x5c')](0x1),'converted_format':_0x5d63('0x5d')};var _0x13f5af=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x5f'),_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')]);var _0x291747=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],'server/files/sounds/converted',util[_0x5d63('0x54')](_0x5d63('0x55'),path[_0x5d63('0x57')](_0x2577b4[_0x5d63('0x58')][_0x5d63('0x5b')],path[_0x5d63('0x5a')](_0x2577b4[_0x5d63('0x58')]['filename'])),_0x42381d[_0x5d63('0x4d')]));logger[_0x5d63('0x60')](_0x5d63('0x61'),_0x13f5af);logger[_0x5d63('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x291747);try{fs[_0x5d63('0x62')](_0x13f5af,parseInt(_0x5d63('0x63'),0x8));var _0x48ef50=sox[_0x5d63('0x64')](_0x13f5af,_0x291747,{'sampleRate':0x1f40,'format':_0x5d63('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48ef50['on'](_0x5d63('0x65'),function(_0x32dbf6){fs['unlinkSync'](_0x13f5af);_0x3e762d['status'](0x1f4)[_0x5d63('0x66')](_0x32dbf6);});_0x48ef50['on']('src',function(_0x374a8f){_0x42381d[_0x5d63('0x67')]=isNaN(_0x374a8f['duration'])?null:_0x374a8f[_0x5d63('0x68')]*0x3e8;_0x42381d[_0x5d63('0x69')]=isNaN(_0x374a8f[_0x5d63('0x6a')])?null:_0x374a8f[_0x5d63('0x6a')];_0x42381d[_0x5d63('0x6b')]=isNaN(_0x374a8f[_0x5d63('0x6c')])?null:_0x374a8f['channelCount'];_0x42381d[_0x5d63('0x6d')]=isNaN(_0x374a8f[_0x5d63('0x6e')])?null:_0x374a8f[_0x5d63('0x6e')];_0x42381d[_0x5d63('0x6f')]=isNaN(_0x374a8f[_0x5d63('0x70')])?null:_0x374a8f[_0x5d63('0x70')];});_0x48ef50['on'](_0x5d63('0x71'),function(_0x30651c){_0x42381d['converted_duration']=isNaN(_0x30651c[_0x5d63('0x68')])?null:_0x30651c[_0x5d63('0x68')]*0x3e8;_0x42381d[_0x5d63('0x72')]=isNaN(_0x30651c[_0x5d63('0x6a')])?null:_0x30651c[_0x5d63('0x6a')];_0x42381d[_0x5d63('0x73')]=isNaN(_0x30651c[_0x5d63('0x6c')])?null:_0x30651c[_0x5d63('0x6c')];_0x42381d['converted_bitRate']=isNaN(_0x30651c[_0x5d63('0x6e')])?null:_0x30651c[_0x5d63('0x6e')];_0x42381d['converted_sampleRate']=isNaN(_0x30651c[_0x5d63('0x70')])?null:_0x30651c[_0x5d63('0x70')];});_0x48ef50['on'](_0x5d63('0x1f'),function(){fs[_0x5d63('0x62')](_0x291747,parseInt('0777',0x8));return db['Sound']['create'](_0x42381d)[_0x5d63('0x2a')](function(_0xdfa5b0){var _0x559a42={'role':_0x2577b4[_0x5d63('0x74')][_0x5d63('0x75')],'userProfileId':_0x2577b4['body']['userProfileId']};if(!_0x559a42)throw new Error(_0x5d63('0x76'));if(_0x559a42['role']===_0x5d63('0x77')){var _0x4aad8e=_0xdfa5b0[_0x5d63('0x2b')]({'plain':!![]});return db[_0x5d63('0x78')][_0x5d63('0x4b')]({'where':{'name':_0x5d63('0x2c'),'userProfileId':_0x559a42['userProfileId']},'raw':!![]})[_0x5d63('0x2a')](function(_0x5d2817){if(_0x5d2817&&_0x5d2817[_0x5d63('0x79')]===0x0){return db['UserProfileResource'][_0x5d63('0x56')]({'name':_0x4aad8e['name'],'resourceId':_0x4aad8e['id'],'type':_0x5d2817[_0x5d63('0x2f')],'sectionId':_0x5d2817['id']},{})['then'](function(){return _0xdfa5b0;});}else{return _0xdfa5b0;}})[_0x5d63('0x48')](function(_0x1ab87a){logger[_0x5d63('0x65')](_0x5d63('0x7a'),_0x1ab87a);throw _0x1ab87a;});}return _0xdfa5b0;})['then'](respondWithResult(_0x3e762d,null))['catch'](handleError(_0x3e762d,null));});_0x48ef50[_0x5d63('0x7b')]();}catch(_0x190593){_0x3e762d[_0x5d63('0x1e')](0x1f4)[_0x5d63('0x66')](_0x190593);}};exports[_0x5d63('0x7c')]=function(_0x1fe950,_0x39fd63,_0x874efe){return db[_0x5d63('0x43')][_0x5d63('0x4b')]({'where':{'id':_0x1fe950['params']['id']}})[_0x5d63('0x2a')](handleEntityNotFound(_0x39fd63,null))[_0x5d63('0x2a')](saveUpdates(_['pick'](_0x1fe950['body'],['name','description']),null))[_0x5d63('0x2a')](respondWithResult(_0x39fd63,null))[_0x5d63('0x48')](handleError(_0x39fd63,null));};exports['delete']=function(_0x2fd55b,_0x56ac4d,_0x3627b9){return db[_0x5d63('0x43')]['find']({'where':{'id':_0x2fd55b[_0x5d63('0x49')]['id']}})[_0x5d63('0x2a')](function(_0x3653f8){if(_0x3653f8){return _0x3653f8[_0x5d63('0x29')]();}})[_0x5d63('0x2a')](function(_0x2ba83a){var _0x1d0452=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x5f'),util[_0x5d63('0x54')](_0x5d63('0x55'),_0x2ba83a[_0x5d63('0x4c')],_0x2ba83a['original_format']));var _0x4afe63=path[_0x5d63('0x5e')](config[_0x5d63('0x4f')],_0x5d63('0x53'),util['format'](_0x5d63('0x55'),_0x2ba83a[_0x5d63('0x4c')],_0x2ba83a[_0x5d63('0x4d')]));fs['unlinkSync'](_0x1d0452);fs[_0x5d63('0x7d')](_0x4afe63);return _0x2ba83a;})[_0x5d63('0x2a')](function(_0x3cdff6){if(_0x3cdff6){return _0x56ac4d[_0x5d63('0x1e')](0xcc)[_0x5d63('0x1f')]();}})[_0x5d63('0x2a')](handleEntityNotFound(_0x56ac4d,null))[_0x5d63('0x48')](handleError(_0x56ac4d,null));}; \ No newline at end of file +var _0xb7a0=['to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','status','name','send','index','map','Sound','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','params','keys','options','find','download','save_name','existsSync','join','root','converted_format','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','format','basename','originalname','file','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','0777','body','role','userProfileId','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','fast-json-patch','bluebird','util','path'];(function(_0x594f28,_0x5ebee8){var _0x7dce12=function(_0x49b3c7){while(--_0x49b3c7){_0x594f28['push'](_0x594f28['shift']());}};_0x7dce12(++_0x5ebee8);}(_0xb7a0,0xee));var _0x0b7a=function(_0x1cebd0,_0x328b12){_0x1cebd0=_0x1cebd0-0x0;var _0x2f9ed8=_0xb7a0[_0x1cebd0];return _0x2f9ed8;};'use strict';var emlformat=require(_0x0b7a('0x0'));var rimraf=require(_0x0b7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b7a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b7a('0x3'));var Mustache=require('mustache');var util=require(_0x0b7a('0x4'));var path=require(_0x0b7a('0x5'));var sox=require('sox');var csv=require(_0x0b7a('0x6'));var ejs=require(_0x0b7a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b7a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0b7a('0x9'));var deskjs=require(_0x0b7a('0xa'));var toCsv=require(_0x0b7a('0x6'));var querystring=require(_0x0b7a('0xb'));var Papa=require(_0x0b7a('0xc'));var Redis=require(_0x0b7a('0xd'));var authService=require(_0x0b7a('0xe'));var qs=require(_0x0b7a('0xf'));var as=require(_0x0b7a('0x10'));var hardwareService=require(_0x0b7a('0x11'));var logger=require(_0x0b7a('0x12'))(_0x0b7a('0x13'));var utils=require(_0x0b7a('0x14'));var config=require(_0x0b7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b7a('0x16'))['db'];function respondWithStatusCode(_0x1b88ce,_0x142b11){_0x142b11=_0x142b11||0xcc;return function(_0x5ea015){if(_0x5ea015){return _0x1b88ce['sendStatus'](_0x142b11);}return _0x1b88ce['status'](_0x142b11)[_0x0b7a('0x17')]();};}function respondWithResult(_0x187dca,_0x58d8ae){_0x58d8ae=_0x58d8ae||0xc8;return function(_0x5b71c0){if(_0x5b71c0){return _0x187dca['status'](_0x58d8ae)[_0x0b7a('0x18')](_0x5b71c0);}};}function respondWithFilteredResult(_0x55f10a,_0x301a2d){return function(_0x6094a1){if(_0x6094a1){var _0x30465b=typeof _0x301a2d['offset']===_0x0b7a('0x19')&&typeof _0x301a2d['limit']===_0x0b7a('0x19');var _0x5e994c=_0x6094a1[_0x0b7a('0x1a')];var _0x4b0619=_0x30465b?0x0:_0x301a2d[_0x0b7a('0x1b')];var _0x42cb17=_0x30465b?_0x6094a1['count']:_0x301a2d['offset']+_0x301a2d[_0x0b7a('0x1c')];var _0x4ffdec;if(_0x42cb17>=_0x5e994c){_0x42cb17=_0x5e994c;_0x4ffdec=0xc8;}else{_0x4ffdec=0xce;}_0x55f10a['status'](_0x4ffdec);return _0x55f10a['set'](_0x0b7a('0x1d'),_0x4b0619+'-'+_0x42cb17+'/'+_0x5e994c)['json'](_0x6094a1);}return null;};}function patchUpdates(_0x109f30){return function(_0x51f5ea){try{jsonpatch[_0x0b7a('0x1e')](_0x51f5ea,_0x109f30,!![]);}catch(_0x1892a9){return BPromise[_0x0b7a('0x1f')](_0x1892a9);}return _0x51f5ea[_0x0b7a('0x20')]();};}function saveUpdates(_0x58a7aa,_0x2d9e25){return function(_0x5cd624){if(_0x5cd624){return _0x5cd624[_0x0b7a('0x21')](_0x58a7aa)[_0x0b7a('0x22')](function(_0x24f608){return _0x24f608;});}return null;};}function removeEntity(_0x45d182,_0xfbe60){return function(_0x4a5e76){if(_0x4a5e76){return _0x4a5e76[_0x0b7a('0x23')]()['then'](function(){var _0x54206e=_0x4a5e76['get']({'plain':!![]});var _0x395c1c=_0x0b7a('0x24');return db[_0x0b7a('0x25')]['destroy']({'where':{'type':_0x395c1c,'resourceId':_0x54206e['id']}})[_0x0b7a('0x22')](function(){return _0x4a5e76;});})['then'](function(){_0x45d182[_0x0b7a('0x26')](0xcc)[_0x0b7a('0x17')]();});}};}function handleEntityNotFound(_0x5e14f5,_0x192c87){return function(_0x280ab9){if(!_0x280ab9){_0x5e14f5['sendStatus'](0x194);}return _0x280ab9;};}function handleError(_0x162751,_0x1eb591){_0x1eb591=_0x1eb591||0x1f4;return function(_0x141097){logger['error'](_0x141097['stack']);if(_0x141097[_0x0b7a('0x27')]){delete _0x141097[_0x0b7a('0x27')];}_0x162751[_0x0b7a('0x26')](_0x1eb591)[_0x0b7a('0x28')](_0x141097);};}exports[_0x0b7a('0x29')]=function(_0x263ca2,_0x286b06){var _0x50593f={},_0x559b3b={},_0x16ac63={'count':0x0,'rows':[]};var _0xf3fe31=_[_0x0b7a('0x2a')](db[_0x0b7a('0x2b')][_0x0b7a('0x2c')],function(_0x5885b8){return{'name':_0x5885b8[_0x0b7a('0x2d')],'type':_0x5885b8['type'][_0x0b7a('0x2e')]};});_0x559b3b['model']=_['map'](_0xf3fe31,'name');_0x559b3b['query']=_['keys'](_0x263ca2[_0x0b7a('0x2f')]);_0x559b3b[_0x0b7a('0x30')]=_[_0x0b7a('0x31')](_0x559b3b[_0x0b7a('0x32')],_0x559b3b[_0x0b7a('0x2f')]);_0x50593f[_0x0b7a('0x33')]=_['intersection'](_0x559b3b[_0x0b7a('0x32')],qs[_0x0b7a('0x34')](_0x263ca2[_0x0b7a('0x2f')][_0x0b7a('0x34')]));_0x50593f[_0x0b7a('0x33')]=_0x50593f['attributes'][_0x0b7a('0x35')]?_0x50593f[_0x0b7a('0x33')]:_0x559b3b[_0x0b7a('0x32')];if(!_0x263ca2[_0x0b7a('0x2f')]['hasOwnProperty'](_0x0b7a('0x36'))){_0x50593f[_0x0b7a('0x1c')]=qs[_0x0b7a('0x1c')](_0x263ca2[_0x0b7a('0x2f')][_0x0b7a('0x1c')]);_0x50593f[_0x0b7a('0x1b')]=qs[_0x0b7a('0x1b')](_0x263ca2[_0x0b7a('0x2f')]['offset']);}_0x50593f[_0x0b7a('0x37')]=qs[_0x0b7a('0x38')](_0x263ca2[_0x0b7a('0x2f')]['sort']);_0x50593f[_0x0b7a('0x39')]=qs['filters'](_[_0x0b7a('0x3a')](_0x263ca2[_0x0b7a('0x2f')],_0x559b3b['filters']),_0xf3fe31);if(_0x263ca2['query'][_0x0b7a('0x3b')]){_0x50593f[_0x0b7a('0x39')]=_[_0x0b7a('0x3c')](_0x50593f[_0x0b7a('0x39')],{'$or':_['map'](_0xf3fe31,function(_0x2a2abc){if(_0x2a2abc[_0x0b7a('0x3d')]!=='VIRTUAL'){var _0x189a1e={};_0x189a1e[_0x2a2abc[_0x0b7a('0x27')]]={'$like':'%'+_0x263ca2[_0x0b7a('0x2f')]['filter']+'%'};return _0x189a1e;}})});}_0x50593f=_[_0x0b7a('0x3c')]({},_0x50593f,_0x263ca2['options']);var _0x19fa3f={'where':_0x50593f[_0x0b7a('0x39')]};return db['Sound'][_0x0b7a('0x1a')](_0x19fa3f)[_0x0b7a('0x22')](function(_0x427116){_0x16ac63[_0x0b7a('0x1a')]=_0x427116;if(_0x263ca2[_0x0b7a('0x2f')][_0x0b7a('0x3e')]){_0x50593f[_0x0b7a('0x3f')]=[{'all':!![]}];}return db['Sound'][_0x0b7a('0x40')](_0x50593f);})[_0x0b7a('0x22')](function(_0xc9f49d){_0x16ac63['rows']=_0xc9f49d;return _0x16ac63;})[_0x0b7a('0x22')](respondWithFilteredResult(_0x286b06,_0x50593f))[_0x0b7a('0x41')](handleError(_0x286b06,null));};exports['show']=function(_0x4310c7,_0x3d0292){var _0x5506d4={'raw':!![],'where':{'id':_0x4310c7[_0x0b7a('0x42')]['id']}},_0x21c466={};_0x21c466[_0x0b7a('0x32')]=_[_0x0b7a('0x43')](db[_0x0b7a('0x2b')][_0x0b7a('0x2c')]);_0x21c466[_0x0b7a('0x2f')]=_['keys'](_0x4310c7[_0x0b7a('0x2f')]);_0x21c466[_0x0b7a('0x30')]=_[_0x0b7a('0x31')](_0x21c466[_0x0b7a('0x32')],_0x21c466[_0x0b7a('0x2f')]);_0x5506d4[_0x0b7a('0x33')]=_[_0x0b7a('0x31')](_0x21c466[_0x0b7a('0x32')],qs[_0x0b7a('0x34')](_0x4310c7[_0x0b7a('0x2f')][_0x0b7a('0x34')]));_0x5506d4['attributes']=_0x5506d4['attributes']['length']?_0x5506d4[_0x0b7a('0x33')]:_0x21c466[_0x0b7a('0x32')];if(_0x4310c7['query'][_0x0b7a('0x3e')]){_0x5506d4[_0x0b7a('0x3f')]=[{'all':!![]}];}_0x5506d4=_[_0x0b7a('0x3c')]({},_0x5506d4,_0x4310c7[_0x0b7a('0x44')]);return db[_0x0b7a('0x2b')][_0x0b7a('0x45')](_0x5506d4)[_0x0b7a('0x22')](handleEntityNotFound(_0x3d0292,null))[_0x0b7a('0x22')](respondWithResult(_0x3d0292,null))['catch'](handleError(_0x3d0292,null));};exports[_0x0b7a('0x46')]=function(_0x170288,_0x5858af,_0x287ef0){return db[_0x0b7a('0x2b')][_0x0b7a('0x45')]({'where':{'id':_0x170288['params']['id']},'attributes':['name',_0x0b7a('0x47'),'converted_format'],'raw':!![]})[_0x0b7a('0x22')](handleEntityNotFound(_0x5858af,null))[_0x0b7a('0x22')](function(_0x369189){if(_0x369189){if(!fs[_0x0b7a('0x48')](path[_0x0b7a('0x49')](config[_0x0b7a('0x4a')],'server/files/sounds/converted',_0x369189['save_name']+'.'+_0x369189[_0x0b7a('0x4b')]))){throw new db[(_0x0b7a('0x4c'))]['ValidationError'](_0x0b7a('0x4d'));}return _0x5858af[_0x0b7a('0x46')](path[_0x0b7a('0x49')](config[_0x0b7a('0x4a')],_0x0b7a('0x4e'),util['format'](_0x0b7a('0x4f'),_0x369189['save_name'],_0x369189[_0x0b7a('0x4b')])),util[_0x0b7a('0x50')](_0x0b7a('0x4f'),_0x369189[_0x0b7a('0x27')],_0x369189['converted_format']));}return null;})['catch'](handleError(_0x5858af,null));};exports['create']=function(_0x4160ea,_0x4be53d,_0x565d04){var _0x3a4658={'name':path[_0x0b7a('0x51')](_0x4160ea['file'][_0x0b7a('0x52')],path['extname'](_0x4160ea[_0x0b7a('0x53')]['originalname'])),'save_name':path[_0x0b7a('0x51')](_0x4160ea['file'][_0x0b7a('0x54')],path[_0x0b7a('0x55')](_0x4160ea[_0x0b7a('0x53')][_0x0b7a('0x54')])),'original_format':path['extname'](_0x4160ea[_0x0b7a('0x53')][_0x0b7a('0x52')])[_0x0b7a('0x56')](0x1),'converted_format':_0x0b7a('0x57')};var _0x259d6d=path[_0x0b7a('0x49')](config['root'],_0x0b7a('0x58'),_0x4160ea[_0x0b7a('0x53')][_0x0b7a('0x54')]);var _0x1d2edc=path[_0x0b7a('0x49')](config['root'],_0x0b7a('0x4e'),util[_0x0b7a('0x50')](_0x0b7a('0x4f'),path[_0x0b7a('0x51')](_0x4160ea['file'][_0x0b7a('0x54')],path[_0x0b7a('0x55')](_0x4160ea[_0x0b7a('0x53')][_0x0b7a('0x54')])),_0x3a4658[_0x0b7a('0x4b')]));logger[_0x0b7a('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x259d6d);logger['info'](_0x0b7a('0x5a'),_0x1d2edc);try{fs[_0x0b7a('0x5b')](_0x259d6d,parseInt('0777',0x8));var _0x246040=sox[_0x0b7a('0x5c')](_0x259d6d,_0x1d2edc,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x246040['on'](_0x0b7a('0x5d'),function(_0x209084){fs[_0x0b7a('0x5e')](_0x259d6d);_0x4be53d[_0x0b7a('0x26')](0x1f4)[_0x0b7a('0x28')](_0x209084);});_0x246040['on'](_0x0b7a('0x5f'),function(_0x6e72c1){_0x3a4658[_0x0b7a('0x60')]=isNaN(_0x6e72c1[_0x0b7a('0x61')])?null:_0x6e72c1[_0x0b7a('0x61')]*0x3e8;_0x3a4658[_0x0b7a('0x62')]=isNaN(_0x6e72c1[_0x0b7a('0x63')])?null:_0x6e72c1[_0x0b7a('0x63')];_0x3a4658[_0x0b7a('0x64')]=isNaN(_0x6e72c1[_0x0b7a('0x65')])?null:_0x6e72c1[_0x0b7a('0x65')];_0x3a4658[_0x0b7a('0x66')]=isNaN(_0x6e72c1[_0x0b7a('0x67')])?null:_0x6e72c1[_0x0b7a('0x67')];_0x3a4658['original_sampleRate']=isNaN(_0x6e72c1[_0x0b7a('0x68')])?null:_0x6e72c1[_0x0b7a('0x68')];});_0x246040['on'](_0x0b7a('0x69'),function(_0x3fea10){_0x3a4658[_0x0b7a('0x6a')]=isNaN(_0x3fea10['duration'])?null:_0x3fea10[_0x0b7a('0x61')]*0x3e8;_0x3a4658['converted_sampleCount']=isNaN(_0x3fea10['sampleCount'])?null:_0x3fea10['sampleCount'];_0x3a4658[_0x0b7a('0x6b')]=isNaN(_0x3fea10[_0x0b7a('0x65')])?null:_0x3fea10[_0x0b7a('0x65')];_0x3a4658[_0x0b7a('0x6c')]=isNaN(_0x3fea10['bitRate'])?null:_0x3fea10[_0x0b7a('0x67')];_0x3a4658['converted_sampleRate']=isNaN(_0x3fea10['sampleRate'])?null:_0x3fea10['sampleRate'];});_0x246040['on'](_0x0b7a('0x17'),function(){fs['chmodSync'](_0x1d2edc,parseInt(_0x0b7a('0x6d'),0x8));return db[_0x0b7a('0x2b')]['create'](_0x3a4658)['then'](function(_0xbc5b07){var _0x1aafc3={'role':_0x4160ea[_0x0b7a('0x6e')][_0x0b7a('0x6f')],'userProfileId':_0x4160ea[_0x0b7a('0x6e')][_0x0b7a('0x70')]};if(!_0x1aafc3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aafc3[_0x0b7a('0x6f')]===_0x0b7a('0x71')){var _0x58aa18=_0xbc5b07[_0x0b7a('0x72')]({'plain':!![]});return db[_0x0b7a('0x73')][_0x0b7a('0x45')]({'where':{'name':'Sounds','userProfileId':_0x1aafc3[_0x0b7a('0x70')]},'raw':!![]})['then'](function(_0x534cb6){if(_0x534cb6&&_0x534cb6['autoAssociation']===0x0){return db[_0x0b7a('0x25')][_0x0b7a('0x74')]({'name':_0x58aa18['name'],'resourceId':_0x58aa18['id'],'type':_0x534cb6['name'],'sectionId':_0x534cb6['id']},{})[_0x0b7a('0x22')](function(){return _0xbc5b07;});}else{return _0xbc5b07;}})['catch'](function(_0x386fad){logger[_0x0b7a('0x5d')](_0x0b7a('0x75'),_0x386fad);throw _0x386fad;});}return _0xbc5b07;})['then'](respondWithResult(_0x4be53d,null))[_0x0b7a('0x41')](handleError(_0x4be53d,null));});_0x246040[_0x0b7a('0x76')]();}catch(_0x4d3619){_0x4be53d[_0x0b7a('0x26')](0x1f4)[_0x0b7a('0x28')](_0x4d3619);}};exports['update']=function(_0x1bc0f6,_0x59e61c,_0x2786b9){return db[_0x0b7a('0x2b')][_0x0b7a('0x45')]({'where':{'id':_0x1bc0f6['params']['id']}})['then'](handleEntityNotFound(_0x59e61c,null))[_0x0b7a('0x22')](saveUpdates(_[_0x0b7a('0x3a')](_0x1bc0f6[_0x0b7a('0x6e')],[_0x0b7a('0x27'),_0x0b7a('0x77')]),null))[_0x0b7a('0x22')](respondWithResult(_0x59e61c,null))[_0x0b7a('0x41')](handleError(_0x59e61c,null));};exports[_0x0b7a('0x78')]=function(_0x1a44c3,_0x3a4348,_0x28d827){return db[_0x0b7a('0x2b')]['find']({'where':{'id':_0x1a44c3[_0x0b7a('0x42')]['id']}})[_0x0b7a('0x22')](function(_0x26d6dc){if(_0x26d6dc){return _0x26d6dc[_0x0b7a('0x23')]();}})[_0x0b7a('0x22')](function(_0x4a6e39){var _0x4d1e80=path[_0x0b7a('0x49')](config[_0x0b7a('0x4a')],'server/files/sounds/original',util['format'](_0x0b7a('0x4f'),_0x4a6e39[_0x0b7a('0x47')],_0x4a6e39[_0x0b7a('0x79')]));var _0x16d888=path[_0x0b7a('0x49')](config[_0x0b7a('0x4a')],'server/files/sounds/converted',util[_0x0b7a('0x50')]('%s.%s',_0x4a6e39[_0x0b7a('0x47')],_0x4a6e39[_0x0b7a('0x4b')]));fs[_0x0b7a('0x5e')](_0x4d1e80);fs['unlinkSync'](_0x16d888);return _0x4a6e39;})[_0x0b7a('0x22')](function(_0x325757){if(_0x325757){return _0x3a4348[_0x0b7a('0x26')](0xcc)[_0x0b7a('0x17')]();}})[_0x0b7a('0x22')](handleEntityNotFound(_0x3a4348,null))[_0x0b7a('0x41')](handleError(_0x3a4348,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 507c4c5..ebc4eaf 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 _0x0e49=['request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','../../config/logger','moment','bluebird'];(function(_0x2799d9,_0x474c60){var _0xa614e6=function(_0x30612b){while(--_0x30612b){_0x2799d9['push'](_0x2799d9['shift']());}};_0xa614e6(++_0x474c60);}(_0x0e49,0x104));var _0x90e4=function(_0x385497,_0x120e2e){_0x385497=_0x385497-0x0;var _0x5b5317=_0x0e49[_0x385497];return _0x5b5317;};'use strict';var _=require(_0x90e4('0x0'));var util=require('util');var logger=require(_0x90e4('0x1'))('api');var moment=require(_0x90e4('0x2'));var BPromise=require(_0x90e4('0x3'));var rp=require(_0x90e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90e4('0x5'));var config=require(_0x90e4('0x6'));var attributes=require(_0x90e4('0x7'));module[_0x90e4('0x8')]=function(_0x4db523,_0x2aae7a){return _0x4db523[_0x90e4('0x9')](_0x90e4('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ddd=['define','tools_sounds','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x245b57,_0x420f33){var _0x1d07d9=function(_0x3cbd7b){while(--_0x3cbd7b){_0x245b57['push'](_0x245b57['shift']());}};_0x1d07d9(++_0x420f33);}(_0x4ddd,0x146));var _0xd4dd=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x4ddd[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd4dd('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd4dd('0x1'));var rp=require(_0xd4dd('0x2'));var fs=require('fs');var path=require(_0xd4dd('0x3'));var rimraf=require(_0xd4dd('0x4'));var config=require(_0xd4dd('0x5'));var attributes=require(_0xd4dd('0x6'));module['exports']=function(_0x4b6d72,_0x5b2d32){return _0x4b6d72[_0xd4dd('0x7')]('Sound',attributes,{'tableName':_0xd4dd('0x8'),'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 8b97885..2e9e4e9 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 _0x4dcf=['stringify','error','code','message','result','ShowSound','Sound','options','raw','include','map','model','attributes','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4dcf,0x1d9));var _0xf4dc=function(_0x4032d4,_0x4f09aa){_0x4032d4=_0x4032d4-0x0;var _0x40f143=_0x4dcf[_0x4032d4];return _0x40f143;};'use strict';var _=require(_0xf4dc('0x0'));var util=require('util');var moment=require(_0xf4dc('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4dc('0x2'));var fs=require('fs');var Redis=require(_0xf4dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4dc('0x4'));var logger=require(_0xf4dc('0x5'))('rpc');var config=require(_0xf4dc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf4dc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x342869,_0x585c65,_0x212c46){return new BPromise(function(_0x4ba42e,_0x2d5d6d){return client['request'](_0x342869,_0x212c46)[_0xf4dc('0x8')](function(_0x4d1828){logger[_0xf4dc('0x9')](_0xf4dc('0xa'),_0x585c65,_0xf4dc('0xb'));logger[_0xf4dc('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x585c65,_0xf4dc('0xb'),JSON[_0xf4dc('0xd')](_0x4d1828));if(_0x4d1828[_0xf4dc('0xe')]){if(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0xf')]===0x1f4){logger[_0xf4dc('0xe')](_0xf4dc('0xa'),_0x585c65,_0x4d1828['error'][_0xf4dc('0x10')]);return _0x2d5d6d(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);}logger[_0xf4dc('0xe')]('Sound,\x20%s,\x20%s',_0x585c65,_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);return _0x4ba42e(_0x4d1828[_0xf4dc('0xe')][_0xf4dc('0x10')]);}else{logger[_0xf4dc('0x9')]('Sound,\x20%s,\x20%s',_0x585c65,_0xf4dc('0xb'));_0x4ba42e(_0x4d1828[_0xf4dc('0x11')][_0xf4dc('0x10')]);}})['catch'](function(_0x2669b6){logger['error'](_0xf4dc('0xa'),_0x585c65,_0x2669b6);_0x2d5d6d(_0x2669b6);});});}exports[_0xf4dc('0x12')]=function(_0xda0e10){var _0x5f1496=this;return new Promise(function(_0x3b086b,_0x1175bc){return db[_0xf4dc('0x13')]['find']({'raw':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10['options'][_0xf4dc('0x15')]===undefined?!![]:![]:!![],'where':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10[_0xf4dc('0x14')]['where']||null:null,'attributes':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10['options']['attributes']||null:null,'include':_0xda0e10[_0xf4dc('0x14')]?_0xda0e10[_0xf4dc('0x14')][_0xf4dc('0x16')]?_[_0xf4dc('0x17')](_0xda0e10['options'][_0xf4dc('0x16')],function(_0x5ab02d){return{'model':db[_0x5ab02d[_0xf4dc('0x18')]],'as':_0x5ab02d['as'],'attributes':_0x5ab02d[_0xf4dc('0x19')],'include':_0x5ab02d['include']?_[_0xf4dc('0x17')](_0x5ab02d[_0xf4dc('0x16')],function(_0x4bc91f){return{'model':db[_0x4bc91f[_0xf4dc('0x18')]],'as':_0x4bc91f['as'],'attributes':_0x4bc91f['attributes'],'include':_0x4bc91f[_0xf4dc('0x16')]?_[_0xf4dc('0x17')](_0x4bc91f[_0xf4dc('0x16')],function(_0x1ade44){return{'model':db[_0x1ade44['model']],'as':_0x1ade44['as'],'attributes':_0x1ade44[_0xf4dc('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf4dc('0x8')](function(_0xf3cced){logger[_0xf4dc('0x9')]('ShowSound',_0xda0e10);logger[_0xf4dc('0xc')](_0xf4dc('0x12'),_0xda0e10,JSON[_0xf4dc('0xd')](_0xf3cced));_0x3b086b(_0xf3cced);})[_0xf4dc('0x1a')](function(_0x54e534){logger[_0xf4dc('0xe')](_0xf4dc('0x12'),_0x54e534['message'],_0xda0e10);_0x1175bc(_0x5f1496[_0xf4dc('0xe')](0x1f4,_0x54e534[_0xf4dc('0x10')]));});});}; \ No newline at end of file +var _0xfb97=['options','raw','where','include','map','model','attributes','ShowSound','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','Sound','find'];(function(_0x5e875d,_0x50a096){var _0x556c37=function(_0x3aabdc){while(--_0x3aabdc){_0x5e875d['push'](_0x5e875d['shift']());}};_0x556c37(++_0x50a096);}(_0xfb97,0x1ca));var _0x7fb9=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0xfb97[_0x34bbd5];return _0x46244f;};'use strict';var _=require('lodash');var util=require(_0x7fb9('0x0'));var moment=require(_0x7fb9('0x1'));var BPromise=require('bluebird');var rs=require(_0x7fb9('0x2'));var fs=require('fs');var Redis=require(_0x7fb9('0x3'));var db=require(_0x7fb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fb9('0x5'))('rpc');var config=require(_0x7fb9('0x6'));var jayson=require(_0x7fb9('0x7'));var client=jayson[_0x7fb9('0x8')][_0x7fb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdd82d5,_0x104362,_0x1db250){return new BPromise(function(_0x749bd5,_0x5a842c){return client[_0x7fb9('0xa')](_0xdd82d5,_0x1db250)[_0x7fb9('0xb')](function(_0x3cb75a){logger[_0x7fb9('0xc')](_0x7fb9('0xd'),_0x104362,_0x7fb9('0xe'));logger['debug'](_0x7fb9('0xf'),_0x104362,_0x7fb9('0xe'),JSON['stringify'](_0x3cb75a));if(_0x3cb75a[_0x7fb9('0x10')]){if(_0x3cb75a[_0x7fb9('0x10')]['code']===0x1f4){logger[_0x7fb9('0x10')]('Sound,\x20%s,\x20%s',_0x104362,_0x3cb75a[_0x7fb9('0x10')]['message']);return _0x5a842c(_0x3cb75a[_0x7fb9('0x10')][_0x7fb9('0x11')]);}logger['error'](_0x7fb9('0xd'),_0x104362,_0x3cb75a[_0x7fb9('0x10')][_0x7fb9('0x11')]);return _0x749bd5(_0x3cb75a[_0x7fb9('0x10')][_0x7fb9('0x11')]);}else{logger[_0x7fb9('0xc')](_0x7fb9('0xd'),_0x104362,'request\x20sent');_0x749bd5(_0x3cb75a[_0x7fb9('0x12')][_0x7fb9('0x11')]);}})[_0x7fb9('0x13')](function(_0x478359){logger['error']('Sound,\x20%s,\x20%s',_0x104362,_0x478359);_0x5a842c(_0x478359);});});}exports['ShowSound']=function(_0x477ca3){var _0x132367=this;return new Promise(function(_0x3da2d1,_0x3b08e7){return db[_0x7fb9('0x14')][_0x7fb9('0x15')]({'raw':_0x477ca3[_0x7fb9('0x16')]?_0x477ca3['options'][_0x7fb9('0x17')]===undefined?!![]:![]:!![],'where':_0x477ca3['options']?_0x477ca3[_0x7fb9('0x16')][_0x7fb9('0x18')]||null:null,'attributes':_0x477ca3[_0x7fb9('0x16')]?_0x477ca3[_0x7fb9('0x16')]['attributes']||null:null,'include':_0x477ca3[_0x7fb9('0x16')]?_0x477ca3[_0x7fb9('0x16')][_0x7fb9('0x19')]?_[_0x7fb9('0x1a')](_0x477ca3[_0x7fb9('0x16')][_0x7fb9('0x19')],function(_0x475e3c){return{'model':db[_0x475e3c[_0x7fb9('0x1b')]],'as':_0x475e3c['as'],'attributes':_0x475e3c[_0x7fb9('0x1c')],'include':_0x475e3c[_0x7fb9('0x19')]?_[_0x7fb9('0x1a')](_0x475e3c[_0x7fb9('0x19')],function(_0x43419e){return{'model':db[_0x43419e[_0x7fb9('0x1b')]],'as':_0x43419e['as'],'attributes':_0x43419e[_0x7fb9('0x1c')],'include':_0x43419e[_0x7fb9('0x19')]?_['map'](_0x43419e[_0x7fb9('0x19')],function(_0x544723){return{'model':db[_0x544723[_0x7fb9('0x1b')]],'as':_0x544723['as'],'attributes':_0x544723[_0x7fb9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7fb9('0xb')](function(_0x438a67){logger[_0x7fb9('0xc')](_0x7fb9('0x1d'),_0x477ca3);logger[_0x7fb9('0x1e')](_0x7fb9('0x1d'),_0x477ca3,JSON[_0x7fb9('0x1f')](_0x438a67));_0x3da2d1(_0x438a67);})[_0x7fb9('0x13')](function(_0x36c657){logger['error'](_0x7fb9('0x1d'),_0x36c657[_0x7fb9('0x11')],_0x477ca3);_0x3b08e7(_0x132367[_0x7fb9('0x10')](0x1f4,_0x36c657['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7ef03f1..30f1ef3 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8dd419,_0x58acff){var _0x4fadf8=function(_0x47a697){while(--_0x47a697){_0x8dd419['push'](_0x8dd419['shift']());}};_0x4fadf8(++_0x58acff);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x0b0e[_0x27ddf5];return _0x26e74a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0x4fc2,0x111));var _0x24fc=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x4fc2[_0x3f55de];return _0x2698de;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index eda572a..37eb030 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 _0xa606=['TEXT','medium','out','sequelize','exports','STRING'];(function(_0x353340,_0x4ccba7){var _0x5439ec=function(_0x22a2b7){while(--_0x22a2b7){_0x353340['push'](_0x353340['shift']());}};_0x5439ec(++_0x4ccba7);}(_0xa606,0x10b));var _0x6a60=function(_0x5b7ee0,_0x3ae8d8){_0x5b7ee0=_0x5b7ee0-0x0;var _0x3c3548=_0xa606[_0x5b7ee0];return _0x3c3548;};'use strict';var Sequelize=require(_0x6a60('0x0'));module[_0x6a60('0x1')]={'uniqueid':{'type':Sequelize[_0x6a60('0x2')]},'body':{'type':Sequelize[_0x6a60('0x3')](_0x6a60('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6a60('0x5')),'defaultValue':_0x6a60('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6a60('0x2')]},'providerResponse':{'type':Sequelize[_0x6a60('0x3')]}}; \ No newline at end of file +var _0x4f45=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0x1ddb21,_0x2ca30c){var _0x40d18a=function(_0x3a04bf){while(--_0x3a04bf){_0x1ddb21['push'](_0x1ddb21['shift']());}};_0x40d18a(++_0x2ca30c);}(_0x4f45,0x147));var _0x54f4=function(_0x4e9a54,_0x539da2){_0x4e9a54=_0x4e9a54-0x0;var _0x42c16e=_0x4f45[_0x4e9a54];return _0x42c16e;};'use strict';var Sequelize=require(_0x54f4('0x0'));module[_0x54f4('0x1')]={'uniqueid':{'type':Sequelize[_0x54f4('0x2')]},'body':{'type':Sequelize['TEXT'](_0x54f4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x54f4('0x4')]('in',_0x54f4('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x54f4('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0828e2a..11cd5d3 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 _0xb694=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','SquareMessage','rawAttributes','type','model','query','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','destroy','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x260004,_0x5cb01c){var _0x51d2c7=function(_0x527918){while(--_0x527918){_0x260004['push'](_0x260004['shift']());}};_0x51d2c7(++_0x5cb01c);}(_0xb694,0x1ef));var _0x4b69=function(_0x390d77,_0x327b7f){_0x390d77=_0x390d77-0x0;var _0xb95abd=_0xb694[_0x390d77];return _0xb95abd;};'use strict';var emlformat=require(_0x4b69('0x0'));var rimraf=require(_0x4b69('0x1'));var zipdir=require(_0x4b69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b69('0x3'));var BPromise=require(_0x4b69('0x4'));var Mustache=require(_0x4b69('0x5'));var util=require('util');var path=require(_0x4b69('0x6'));var sox=require(_0x4b69('0x7'));var csv=require(_0x4b69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b69('0x9'));var _=require(_0x4b69('0xa'));var squel=require(_0x4b69('0xb'));var crypto=require(_0x4b69('0xc'));var jsforce=require(_0x4b69('0xd'));var deskjs=require(_0x4b69('0xe'));var toCsv=require(_0x4b69('0x8'));var querystring=require(_0x4b69('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b69('0x10'));var authService=require(_0x4b69('0x11'));var qs=require(_0x4b69('0x12'));var as=require(_0x4b69('0x13'));var hardwareService=require(_0x4b69('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4b69('0x15'));var config=require(_0x4b69('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1e1a,_0x124ec9){_0x124ec9=_0x124ec9||0xcc;return function(_0x1682b5){if(_0x1682b5){return _0x2a1e1a[_0x4b69('0x17')](_0x124ec9);}return _0x2a1e1a[_0x4b69('0x18')](_0x124ec9)['end']();};}function respondWithResult(_0x3048c7,_0x2847d3){_0x2847d3=_0x2847d3||0xc8;return function(_0x2077d5){if(_0x2077d5){return _0x3048c7[_0x4b69('0x18')](_0x2847d3)['json'](_0x2077d5);}};}function respondWithFilteredResult(_0x39065e,_0x23c106){return function(_0x2a330f){if(_0x2a330f){var _0x123e7c=typeof _0x23c106[_0x4b69('0x19')]===_0x4b69('0x1a')&&typeof _0x23c106[_0x4b69('0x1b')]==='undefined';var _0x303049=_0x2a330f[_0x4b69('0x1c')];var _0x348181=_0x123e7c?0x0:_0x23c106[_0x4b69('0x19')];var _0x387a3e=_0x123e7c?_0x2a330f[_0x4b69('0x1c')]:_0x23c106[_0x4b69('0x19')]+_0x23c106['limit'];var _0x59467f;if(_0x387a3e>=_0x303049){_0x387a3e=_0x303049;_0x59467f=0xc8;}else{_0x59467f=0xce;}_0x39065e['status'](_0x59467f);return _0x39065e['set'](_0x4b69('0x1d'),_0x348181+'-'+_0x387a3e+'/'+_0x303049)[_0x4b69('0x1e')](_0x2a330f);}return null;};}function patchUpdates(_0x213899){return function(_0x34b7ee){try{jsonpatch[_0x4b69('0x1f')](_0x34b7ee,_0x213899,!![]);}catch(_0x877f64){return BPromise[_0x4b69('0x20')](_0x877f64);}return _0x34b7ee[_0x4b69('0x21')]();};}function saveUpdates(_0x43af06,_0x379da9){return function(_0x94fe73){if(_0x94fe73){return _0x94fe73[_0x4b69('0x22')](_0x43af06)['then'](function(_0x56889b){return _0x56889b;});}return null;};}function removeEntity(_0x4d34db,_0x190cfc){return function(_0x4129b3){if(_0x4129b3){return _0x4129b3['destroy']()[_0x4b69('0x23')](function(){_0x4d34db[_0x4b69('0x18')](0xcc)[_0x4b69('0x24')]();});}};}function handleEntityNotFound(_0x40e5d4,_0x54c7b3){return function(_0x3dfcc6){if(!_0x3dfcc6){_0x40e5d4[_0x4b69('0x17')](0x194);}return _0x3dfcc6;};}function handleError(_0x4b3e54,_0x4e0b82){_0x4e0b82=_0x4e0b82||0x1f4;return function(_0x67027e){logger[_0x4b69('0x25')](_0x67027e[_0x4b69('0x26')]);if(_0x67027e[_0x4b69('0x27')]){delete _0x67027e['name'];}_0x4b3e54[_0x4b69('0x18')](_0x4e0b82)[_0x4b69('0x28')](_0x67027e);};}exports['index']=function(_0x363f76,_0x2f2409){var _0x4c71ab={},_0x4893bf={},_0x351273={'count':0x0,'rows':[]};var _0x4cea32=_[_0x4b69('0x29')](db[_0x4b69('0x2a')][_0x4b69('0x2b')],function(_0x116821){return{'name':_0x116821['fieldName'],'type':_0x116821[_0x4b69('0x2c')]['key']};});_0x4893bf[_0x4b69('0x2d')]=_[_0x4b69('0x29')](_0x4cea32,_0x4b69('0x27'));_0x4893bf[_0x4b69('0x2e')]=_['keys'](_0x363f76[_0x4b69('0x2e')]);_0x4893bf['filters']=_[_0x4b69('0x2f')](_0x4893bf[_0x4b69('0x2d')],_0x4893bf[_0x4b69('0x2e')]);_0x4c71ab['attributes']=_['intersection'](_0x4893bf['model'],qs[_0x4b69('0x30')](_0x363f76['query'][_0x4b69('0x30')]));_0x4c71ab[_0x4b69('0x31')]=_0x4c71ab[_0x4b69('0x31')]['length']?_0x4c71ab[_0x4b69('0x31')]:_0x4893bf[_0x4b69('0x2d')];if(!_0x363f76['query']['hasOwnProperty'](_0x4b69('0x32'))){_0x4c71ab[_0x4b69('0x1b')]=qs[_0x4b69('0x1b')](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x1b')]);_0x4c71ab['offset']=qs['offset'](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x19')]);}_0x4c71ab[_0x4b69('0x33')]=qs[_0x4b69('0x34')](_0x363f76[_0x4b69('0x2e')][_0x4b69('0x34')]);_0x4c71ab[_0x4b69('0x35')]=qs['filters'](_[_0x4b69('0x36')](_0x363f76['query'],_0x4893bf[_0x4b69('0x37')]),_0x4cea32);if(_0x363f76[_0x4b69('0x2e')][_0x4b69('0x38')]){_0x4c71ab[_0x4b69('0x35')]=_[_0x4b69('0x39')](_0x4c71ab[_0x4b69('0x35')],{'$or':_[_0x4b69('0x29')](_0x4cea32,function(_0x3dd8d0){if(_0x3dd8d0[_0x4b69('0x2c')]!==_0x4b69('0x3a')){var _0x15db55={};_0x15db55[_0x3dd8d0[_0x4b69('0x27')]]={'$like':'%'+_0x363f76['query']['filter']+'%'};return _0x15db55;}})});}_0x4c71ab=_['merge']({},_0x4c71ab,_0x363f76[_0x4b69('0x3b')]);var _0x44a82a={'where':_0x4c71ab[_0x4b69('0x35')]};return db['SquareMessage'][_0x4b69('0x1c')](_0x44a82a)['then'](function(_0x413873){_0x351273[_0x4b69('0x1c')]=_0x413873;if(_0x363f76[_0x4b69('0x2e')]['includeAll']){_0x4c71ab[_0x4b69('0x3c')]=[{'all':!![]}];}return db[_0x4b69('0x2a')][_0x4b69('0x3d')](_0x4c71ab);})[_0x4b69('0x23')](function(_0x2a6fe9){_0x351273[_0x4b69('0x3e')]=_0x2a6fe9;return _0x351273;})[_0x4b69('0x23')](respondWithFilteredResult(_0x2f2409,_0x4c71ab))[_0x4b69('0x3f')](handleError(_0x2f2409,null));};exports[_0x4b69('0x40')]=function(_0x236af9,_0x2658c3){var _0x59f2e1={'raw':!![],'where':{'id':_0x236af9['params']['id']}},_0x1057f4={};_0x1057f4['model']=_[_0x4b69('0x41')](db[_0x4b69('0x2a')]['rawAttributes']);_0x1057f4[_0x4b69('0x2e')]=_[_0x4b69('0x41')](_0x236af9[_0x4b69('0x2e')]);_0x1057f4[_0x4b69('0x37')]=_[_0x4b69('0x2f')](_0x1057f4[_0x4b69('0x2d')],_0x1057f4[_0x4b69('0x2e')]);_0x59f2e1[_0x4b69('0x31')]=_[_0x4b69('0x2f')](_0x1057f4[_0x4b69('0x2d')],qs[_0x4b69('0x30')](_0x236af9['query']['fields']));_0x59f2e1[_0x4b69('0x31')]=_0x59f2e1[_0x4b69('0x31')]['length']?_0x59f2e1[_0x4b69('0x31')]:_0x1057f4['model'];if(_0x236af9[_0x4b69('0x2e')][_0x4b69('0x42')]){_0x59f2e1[_0x4b69('0x3c')]=[{'all':!![]}];}_0x59f2e1=_['merge']({},_0x59f2e1,_0x236af9[_0x4b69('0x3b')]);return db['SquareMessage'][_0x4b69('0x43')](_0x59f2e1)[_0x4b69('0x23')](handleEntityNotFound(_0x2658c3,null))[_0x4b69('0x23')](respondWithResult(_0x2658c3,null))[_0x4b69('0x3f')](handleError(_0x2658c3,null));};exports['create']=function(_0x19ac5,_0x493156){return db[_0x4b69('0x2a')][_0x4b69('0x44')](_0x19ac5[_0x4b69('0x45')],{})['then'](respondWithResult(_0x493156,0xc9))[_0x4b69('0x3f')](handleError(_0x493156,null));};exports['update']=function(_0x265a46,_0x5851d8){if(_0x265a46['body']['id']){delete _0x265a46[_0x4b69('0x45')]['id'];}return db[_0x4b69('0x2a')]['find']({'where':{'id':_0x265a46['params']['id']}})[_0x4b69('0x23')](handleEntityNotFound(_0x5851d8,null))[_0x4b69('0x23')](saveUpdates(_0x265a46[_0x4b69('0x45')],null))[_0x4b69('0x23')](respondWithResult(_0x5851d8,null))['catch'](handleError(_0x5851d8,null));};exports[_0x4b69('0x46')]=function(_0x489405,_0x3f44b1){return db[_0x4b69('0x2a')][_0x4b69('0x43')]({'where':{'id':_0x489405[_0x4b69('0x47')]['id']}})[_0x4b69('0x23')](handleEntityNotFound(_0x3f44b1,null))[_0x4b69('0x23')](removeEntity(_0x3f44b1,null))[_0x4b69('0x3f')](handleError(_0x3f44b1,null));}; \ No newline at end of file +var _0xb338=['catch','show','create','body','find','params','eml-format','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dbf1c,_0x5df2ed){var _0x58700c=function(_0x36e011){while(--_0x36e011){_0x3dbf1c['push'](_0x3dbf1c['shift']());}};_0x58700c(++_0x5df2ed);}(_0xb338,0x16e));var _0x8b33=function(_0x46ae87,_0x4bd053){_0x46ae87=_0x46ae87-0x0;var _0x303fcc=_0xb338[_0x46ae87];return _0x303fcc;};'use strict';var emlformat=require(_0x8b33('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b33('0x1'));var rp=require(_0x8b33('0x2'));var moment=require(_0x8b33('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8b33('0x4'));var sox=require(_0x8b33('0x5'));var csv=require('to-csv');var ejs=require(_0x8b33('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b33('0x7'));var squel=require(_0x8b33('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b33('0x9'));var toCsv=require(_0x8b33('0xa'));var querystring=require(_0x8b33('0xb'));var Papa=require(_0x8b33('0xc'));var Redis=require(_0x8b33('0xd'));var authService=require(_0x8b33('0xe'));var qs=require(_0x8b33('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b33('0x10'));var logger=require(_0x8b33('0x11'))(_0x8b33('0x12'));var utils=require(_0x8b33('0x13'));var config=require(_0x8b33('0x14'));var licenseUtil=require(_0x8b33('0x15'));var db=require(_0x8b33('0x16'))['db'];function respondWithStatusCode(_0x23044f,_0x480377){_0x480377=_0x480377||0xcc;return function(_0xc04542){if(_0xc04542){return _0x23044f[_0x8b33('0x17')](_0x480377);}return _0x23044f[_0x8b33('0x18')](_0x480377)[_0x8b33('0x19')]();};}function respondWithResult(_0x23c9ea,_0x2f30a7){_0x2f30a7=_0x2f30a7||0xc8;return function(_0x3ad42b){if(_0x3ad42b){return _0x23c9ea[_0x8b33('0x18')](_0x2f30a7)[_0x8b33('0x1a')](_0x3ad42b);}};}function respondWithFilteredResult(_0x4caa9a,_0xc92ef6){return function(_0x50d538){if(_0x50d538){var _0x3ac8d8=typeof _0xc92ef6[_0x8b33('0x1b')]===_0x8b33('0x1c')&&typeof _0xc92ef6['limit']===_0x8b33('0x1c');var _0x1e9730=_0x50d538['count'];var _0x7dbc6=_0x3ac8d8?0x0:_0xc92ef6[_0x8b33('0x1b')];var _0x3d6c87=_0x3ac8d8?_0x50d538[_0x8b33('0x1d')]:_0xc92ef6[_0x8b33('0x1b')]+_0xc92ef6['limit'];var _0x1bc04e;if(_0x3d6c87>=_0x1e9730){_0x3d6c87=_0x1e9730;_0x1bc04e=0xc8;}else{_0x1bc04e=0xce;}_0x4caa9a[_0x8b33('0x18')](_0x1bc04e);return _0x4caa9a[_0x8b33('0x1e')](_0x8b33('0x1f'),_0x7dbc6+'-'+_0x3d6c87+'/'+_0x1e9730)[_0x8b33('0x1a')](_0x50d538);}return null;};}function patchUpdates(_0x5c3040){return function(_0x164433){try{jsonpatch['apply'](_0x164433,_0x5c3040,!![]);}catch(_0x36df3b){return BPromise[_0x8b33('0x20')](_0x36df3b);}return _0x164433[_0x8b33('0x21')]();};}function saveUpdates(_0x645aab,_0x2e9032){return function(_0x16c7c4){if(_0x16c7c4){return _0x16c7c4[_0x8b33('0x22')](_0x645aab)['then'](function(_0x205db7){return _0x205db7;});}return null;};}function removeEntity(_0x4bdfcd,_0x6197ca){return function(_0x2a9c57){if(_0x2a9c57){return _0x2a9c57[_0x8b33('0x23')]()[_0x8b33('0x24')](function(){_0x4bdfcd[_0x8b33('0x18')](0xcc)[_0x8b33('0x19')]();});}};}function handleEntityNotFound(_0x29f7ce,_0x5e410e){return function(_0x2c01a1){if(!_0x2c01a1){_0x29f7ce[_0x8b33('0x17')](0x194);}return _0x2c01a1;};}function handleError(_0x5c7677,_0x2a204b){_0x2a204b=_0x2a204b||0x1f4;return function(_0x2dc4f0){logger['error'](_0x2dc4f0['stack']);if(_0x2dc4f0['name']){delete _0x2dc4f0[_0x8b33('0x25')];}_0x5c7677[_0x8b33('0x18')](_0x2a204b)[_0x8b33('0x26')](_0x2dc4f0);};}exports['index']=function(_0x3a3dce,_0x3295d3){var _0x29fd87={},_0x265f4c={},_0x208883={'count':0x0,'rows':[]};var _0x46e29a=_['map'](db[_0x8b33('0x27')][_0x8b33('0x28')],function(_0x12f8c1){return{'name':_0x12f8c1[_0x8b33('0x29')],'type':_0x12f8c1[_0x8b33('0x2a')][_0x8b33('0x2b')]};});_0x265f4c[_0x8b33('0x2c')]=_[_0x8b33('0x2d')](_0x46e29a,'name');_0x265f4c[_0x8b33('0x2e')]=_[_0x8b33('0x2f')](_0x3a3dce['query']);_0x265f4c[_0x8b33('0x30')]=_[_0x8b33('0x31')](_0x265f4c[_0x8b33('0x2c')],_0x265f4c[_0x8b33('0x2e')]);_0x29fd87['attributes']=_['intersection'](_0x265f4c['model'],qs[_0x8b33('0x32')](_0x3a3dce[_0x8b33('0x2e')][_0x8b33('0x32')]));_0x29fd87[_0x8b33('0x33')]=_0x29fd87[_0x8b33('0x33')][_0x8b33('0x34')]?_0x29fd87['attributes']:_0x265f4c[_0x8b33('0x2c')];if(!_0x3a3dce[_0x8b33('0x2e')][_0x8b33('0x35')](_0x8b33('0x36'))){_0x29fd87['limit']=qs[_0x8b33('0x37')](_0x3a3dce[_0x8b33('0x2e')][_0x8b33('0x37')]);_0x29fd87[_0x8b33('0x1b')]=qs[_0x8b33('0x1b')](_0x3a3dce['query'][_0x8b33('0x1b')]);}_0x29fd87[_0x8b33('0x38')]=qs[_0x8b33('0x39')](_0x3a3dce[_0x8b33('0x2e')][_0x8b33('0x39')]);_0x29fd87[_0x8b33('0x3a')]=qs['filters'](_['pick'](_0x3a3dce[_0x8b33('0x2e')],_0x265f4c[_0x8b33('0x30')]),_0x46e29a);if(_0x3a3dce[_0x8b33('0x2e')][_0x8b33('0x3b')]){_0x29fd87[_0x8b33('0x3a')]=_[_0x8b33('0x3c')](_0x29fd87[_0x8b33('0x3a')],{'$or':_['map'](_0x46e29a,function(_0x17a21b){if(_0x17a21b[_0x8b33('0x2a')]!==_0x8b33('0x3d')){var _0xd5d3c9={};_0xd5d3c9[_0x17a21b[_0x8b33('0x25')]]={'$like':'%'+_0x3a3dce[_0x8b33('0x2e')]['filter']+'%'};return _0xd5d3c9;}})});}_0x29fd87=_['merge']({},_0x29fd87,_0x3a3dce[_0x8b33('0x3e')]);var _0x223488={'where':_0x29fd87[_0x8b33('0x3a')]};return db[_0x8b33('0x27')][_0x8b33('0x1d')](_0x223488)[_0x8b33('0x24')](function(_0x4f48fa){_0x208883[_0x8b33('0x1d')]=_0x4f48fa;if(_0x3a3dce['query'][_0x8b33('0x3f')]){_0x29fd87[_0x8b33('0x40')]=[{'all':!![]}];}return db[_0x8b33('0x27')][_0x8b33('0x41')](_0x29fd87);})[_0x8b33('0x24')](function(_0x1af733){_0x208883['rows']=_0x1af733;return _0x208883;})[_0x8b33('0x24')](respondWithFilteredResult(_0x3295d3,_0x29fd87))[_0x8b33('0x42')](handleError(_0x3295d3,null));};exports[_0x8b33('0x43')]=function(_0x4fa911,_0x8ae5f){var _0x14bbfb={'raw':!![],'where':{'id':_0x4fa911['params']['id']}},_0x53abbc={};_0x53abbc[_0x8b33('0x2c')]=_[_0x8b33('0x2f')](db['SquareMessage']['rawAttributes']);_0x53abbc[_0x8b33('0x2e')]=_[_0x8b33('0x2f')](_0x4fa911[_0x8b33('0x2e')]);_0x53abbc[_0x8b33('0x30')]=_[_0x8b33('0x31')](_0x53abbc[_0x8b33('0x2c')],_0x53abbc[_0x8b33('0x2e')]);_0x14bbfb[_0x8b33('0x33')]=_[_0x8b33('0x31')](_0x53abbc[_0x8b33('0x2c')],qs[_0x8b33('0x32')](_0x4fa911[_0x8b33('0x2e')][_0x8b33('0x32')]));_0x14bbfb[_0x8b33('0x33')]=_0x14bbfb['attributes'][_0x8b33('0x34')]?_0x14bbfb['attributes']:_0x53abbc[_0x8b33('0x2c')];if(_0x4fa911[_0x8b33('0x2e')]['includeAll']){_0x14bbfb[_0x8b33('0x40')]=[{'all':!![]}];}_0x14bbfb=_[_0x8b33('0x3c')]({},_0x14bbfb,_0x4fa911[_0x8b33('0x3e')]);return db[_0x8b33('0x27')]['find'](_0x14bbfb)['then'](handleEntityNotFound(_0x8ae5f,null))[_0x8b33('0x24')](respondWithResult(_0x8ae5f,null))['catch'](handleError(_0x8ae5f,null));};exports['create']=function(_0x257155,_0x462cb7){return db[_0x8b33('0x27')][_0x8b33('0x44')](_0x257155[_0x8b33('0x45')],{})[_0x8b33('0x24')](respondWithResult(_0x462cb7,0xc9))['catch'](handleError(_0x462cb7,null));};exports[_0x8b33('0x22')]=function(_0x3b94ca,_0x13cbf0){if(_0x3b94ca[_0x8b33('0x45')]['id']){delete _0x3b94ca['body']['id'];}return db['SquareMessage'][_0x8b33('0x46')]({'where':{'id':_0x3b94ca[_0x8b33('0x47')]['id']}})[_0x8b33('0x24')](handleEntityNotFound(_0x13cbf0,null))[_0x8b33('0x24')](saveUpdates(_0x3b94ca[_0x8b33('0x45')],null))[_0x8b33('0x24')](respondWithResult(_0x13cbf0,null))[_0x8b33('0x42')](handleError(_0x13cbf0,null));};exports[_0x8b33('0x23')]=function(_0x1cab58,_0x4f3778){return db['SquareMessage']['find']({'where':{'id':_0x1cab58[_0x8b33('0x47')]['id']}})[_0x8b33('0x24')](handleEntityNotFound(_0x4f3778,null))['then'](removeEntity(_0x4f3778,null))[_0x8b33('0x42')](handleError(_0x4f3778,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5c3e172..d83db71 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 _0xc85d=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','api','request-promise','path'];(function(_0x58af8b,_0x31beb7){var _0x56bc0a=function(_0x36e40b){while(--_0x36e40b){_0x58af8b['push'](_0x58af8b['shift']());}};_0x56bc0a(++_0x31beb7);}(_0xc85d,0x192));var _0xdc85=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc85d[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0xdc85('0x0'));var logger=require(_0xdc85('0x1'))(_0xdc85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdc85('0x3'));var fs=require('fs');var path=require(_0xdc85('0x4'));var rimraf=require(_0xdc85('0x5'));var config=require(_0xdc85('0x6'));var attributes=require(_0xdc85('0x7'));module[_0xdc85('0x8')]=function(_0x3aef2c,_0xe494e9){return _0x3aef2c[_0xdc85('0x9')](_0xdc85('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd28=['define','SquareMessage','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5a8611,_0x515fba){var _0x325dcf=function(_0x691c86){while(--_0x691c86){_0x5a8611['push'](_0x5a8611['shift']());}};_0x325dcf(++_0x515fba);}(_0xdd28,0x1d8));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var util=require('util');var logger=require(_0x8dd2('0x1'))(_0x8dd2('0x2'));var moment=require('moment');var BPromise=require(_0x8dd2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dd2('0x4'));var rimraf=require(_0x8dd2('0x5'));var config=require(_0x8dd2('0x6'));var attributes=require('./squareMessage.attributes');module[_0x8dd2('0x7')]=function(_0x184303,_0x1b89b1){return _0x184303[_0x8dd2('0x8')](_0x8dd2('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index b775418..9abfe9a 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 _0x1010=['catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0x1010,0x9e));var _0x0101=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x1010[_0x22b8a3];return _0x199a0c;};'use strict';var _=require(_0x0101('0x0'));var util=require(_0x0101('0x1'));var moment=require(_0x0101('0x2'));var BPromise=require(_0x0101('0x3'));var rs=require(_0x0101('0x4'));var fs=require('fs');var Redis=require(_0x0101('0x5'));var db=require(_0x0101('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0101('0x7'))(_0x0101('0x8'));var config=require(_0x0101('0x9'));var jayson=require(_0x0101('0xa'));var client=jayson[_0x0101('0xb')][_0x0101('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x595a7e,_0x41dc6d,_0x1ef034){return new BPromise(function(_0x5c4eb8,_0x8c183e){return client['request'](_0x595a7e,_0x1ef034)[_0x0101('0xd')](function(_0x201166){logger['info'](_0x0101('0xe'),_0x41dc6d,_0x0101('0xf'));logger[_0x0101('0x10')](_0x0101('0x11'),_0x41dc6d,_0x0101('0xf'),JSON['stringify'](_0x201166));if(_0x201166[_0x0101('0x12')]){if(_0x201166['error'][_0x0101('0x13')]===0x1f4){logger[_0x0101('0x12')](_0x0101('0xe'),_0x41dc6d,_0x201166[_0x0101('0x12')][_0x0101('0x14')]);return _0x8c183e(_0x201166['error'][_0x0101('0x14')]);}logger[_0x0101('0x12')](_0x0101('0xe'),_0x41dc6d,_0x201166['error'][_0x0101('0x14')]);return _0x5c4eb8(_0x201166[_0x0101('0x12')][_0x0101('0x14')]);}else{logger[_0x0101('0x15')](_0x0101('0xe'),_0x41dc6d,_0x0101('0xf'));_0x5c4eb8(_0x201166['result'][_0x0101('0x14')]);}})[_0x0101('0x16')](function(_0xf2233c){logger[_0x0101('0x12')]('SquareMessage,\x20%s,\x20%s',_0x41dc6d,_0xf2233c);_0x8c183e(_0xf2233c);});});}exports[_0x0101('0x17')]=function(_0x599ca1){var _0x260978=this;return new Promise(function(_0x4a4513,_0x8e5d1e){return db[_0x0101('0x18')][_0x0101('0x19')](_0x599ca1[_0x0101('0x1a')],{'raw':_0x599ca1[_0x0101('0x1b')]?_0x599ca1[_0x0101('0x1b')][_0x0101('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2ccc37){logger[_0x0101('0x15')](_0x0101('0x17'),_0x599ca1);logger[_0x0101('0x10')](_0x0101('0x17'),_0x599ca1,JSON[_0x0101('0x1d')](_0x2ccc37));_0x4a4513(_0x2ccc37);})[_0x0101('0x16')](function(_0x3fb029){logger[_0x0101('0x12')](_0x0101('0x17'),_0x3fb029['message'],_0x599ca1);_0x8e5d1e(_0x260978[_0x0101('0x12')](0x1f4,_0x3fb029['message']));});});}; \ No newline at end of file +var _0x9ce9=['rpc','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x9ce9,0x1e5));var _0x99ce=function(_0x4d9dc7,_0x38ee05){_0x4d9dc7=_0x4d9dc7-0x0;var _0x18780a=_0x9ce9[_0x4d9dc7];return _0x18780a;};'use strict';var _=require(_0x99ce('0x0'));var util=require(_0x99ce('0x1'));var moment=require(_0x99ce('0x2'));var BPromise=require(_0x99ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99ce('0x4'));var db=require(_0x99ce('0x5'))['db'];var utils=require(_0x99ce('0x6'));var logger=require(_0x99ce('0x7'))(_0x99ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c47b7,_0x5b302f,_0x55f99c){return new BPromise(function(_0x4a9fb1,_0xa63661){return client[_0x99ce('0xa')](_0x5c47b7,_0x55f99c)[_0x99ce('0xb')](function(_0x26f6a7){logger[_0x99ce('0xc')](_0x99ce('0xd'),_0x5b302f,_0x99ce('0xe'));logger[_0x99ce('0xf')](_0x99ce('0x10'),_0x5b302f,_0x99ce('0xe'),JSON[_0x99ce('0x11')](_0x26f6a7));if(_0x26f6a7[_0x99ce('0x12')]){if(_0x26f6a7[_0x99ce('0x12')][_0x99ce('0x13')]===0x1f4){logger['error'](_0x99ce('0xd'),_0x5b302f,_0x26f6a7['error'][_0x99ce('0x14')]);return _0xa63661(_0x26f6a7[_0x99ce('0x12')][_0x99ce('0x14')]);}logger[_0x99ce('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5b302f,_0x26f6a7[_0x99ce('0x12')]['message']);return _0x4a9fb1(_0x26f6a7['error']['message']);}else{logger[_0x99ce('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5b302f,'request\x20sent');_0x4a9fb1(_0x26f6a7[_0x99ce('0x15')][_0x99ce('0x14')]);}})['catch'](function(_0x5a464c){logger[_0x99ce('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5b302f,_0x5a464c);_0xa63661(_0x5a464c);});});}exports[_0x99ce('0x16')]=function(_0x269283){var _0x38e380=this;return new Promise(function(_0x2f534f,_0x466028){return db[_0x99ce('0x17')][_0x99ce('0x18')](_0x269283[_0x99ce('0x19')],{'raw':_0x269283[_0x99ce('0x1a')]?_0x269283[_0x99ce('0x1a')][_0x99ce('0x1b')]===undefined?!![]:![]:!![]})[_0x99ce('0xb')](function(_0x3f5466){logger[_0x99ce('0xc')](_0x99ce('0x16'),_0x269283);logger['debug']('CreateSquareMessage',_0x269283,JSON[_0x99ce('0x11')](_0x3f5466));_0x2f534f(_0x3f5466);})[_0x99ce('0x1c')](function(_0x518a43){logger[_0x99ce('0x12')]('CreateSquareMessage',_0x518a43['message'],_0x269283);_0x466028(_0x38e380[_0x99ce('0x12')](0x1f4,_0x518a43[_0x99ce('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 40dec9c..b0cdb26 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 _0xce35=['isAuthenticated','index','/:id','show','/:id/test','15s','post','create','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x52c57d,_0x5dfc48){var _0x396c26=function(_0x42c546){while(--_0x42c546){_0x52c57d['push'](_0x52c57d['shift']());}};_0x396c26(++_0x5dfc48);}(_0xce35,0x11b));var _0x5ce3=function(_0x2e1f5e,_0x52de01){_0x2e1f5e=_0x2e1f5e-0x0;var _0x3812b0=_0xce35[_0x2e1f5e];return _0x3812b0;};'use strict';var multer=require(_0x5ce3('0x0'));var util=require('util');var path=require(_0x5ce3('0x1'));var timeout=require(_0x5ce3('0x2'));var express=require(_0x5ce3('0x3'));var router=express[_0x5ce3('0x4')]();var fs_extra=require(_0x5ce3('0x5'));var auth=require(_0x5ce3('0x6'));var interaction=require(_0x5ce3('0x7'));var config=require(_0x5ce3('0x8'));var controller=require(_0x5ce3('0x9'));router[_0x5ce3('0xa')]('/',auth[_0x5ce3('0xb')](),controller[_0x5ce3('0xc')]);router['get'](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller[_0x5ce3('0xe')]);router[_0x5ce3('0xa')](_0x5ce3('0xf'),auth[_0x5ce3('0xb')](),timeout(_0x5ce3('0x10')),controller['test']);router[_0x5ce3('0x11')]('/',auth[_0x5ce3('0xb')](),controller[_0x5ce3('0x12')]);router[_0x5ce3('0x13')](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller['update']);router['delete'](_0x5ce3('0xd'),auth[_0x5ce3('0xb')](),controller['destroy']);module[_0x5ce3('0x14')]=router; \ No newline at end of file +var _0x8400=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','test','create','put','delete','destroy','multer','util'];(function(_0x335bb4,_0x58cecd){var _0x3a12a9=function(_0x2a188a){while(--_0x2a188a){_0x335bb4['push'](_0x335bb4['shift']());}};_0x3a12a9(++_0x58cecd);}(_0x8400,0xc4));var _0x0840=function(_0x45124a,_0x5dec8a){_0x45124a=_0x45124a-0x0;var _0x39d1e4=_0x8400[_0x45124a];return _0x39d1e4;};'use strict';var multer=require(_0x0840('0x0'));var util=require(_0x0840('0x1'));var path=require(_0x0840('0x2'));var timeout=require(_0x0840('0x3'));var express=require(_0x0840('0x4'));var router=express[_0x0840('0x5')]();var fs_extra=require(_0x0840('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0840('0x7'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x0840('0x8')]('/',auth['isAuthenticated'](),controller[_0x0840('0x9')]);router[_0x0840('0x8')](_0x0840('0xa'),auth[_0x0840('0xb')](),controller[_0x0840('0xc')]);router[_0x0840('0x8')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller[_0x0840('0xd')]);router['post']('/',auth[_0x0840('0xb')](),controller[_0x0840('0xe')]);router[_0x0840('0xf')](_0x0840('0xa'),auth[_0x0840('0xb')](),controller['update']);router[_0x0840('0x10')](_0x0840('0xa'),auth[_0x0840('0xb')](),controller[_0x0840('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 907f723..87eaa4e 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 _0x5594=['STRING','name','sequelize','exports'];(function(_0x3f3de4,_0x4cc947){var _0x34e5eb=function(_0x5e09a3){while(--_0x5e09a3){_0x3f3de4['push'](_0x3f3de4['shift']());}};_0x34e5eb(++_0x4cc947);}(_0x5594,0xea));var _0x4559=function(_0x2bbb49,_0x13bc74){_0x2bbb49=_0x2bbb49-0x0;var _0x276690=_0x5594[_0x2bbb49];return _0x276690;};'use strict';var Sequelize=require(_0x4559('0x0'));module[_0x4559('0x1')]={'name':{'type':Sequelize[_0x4559('0x2')],'unique':_0x4559('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4559('0x2')]},'description':{'type':Sequelize[_0x4559('0x2')]}}; \ No newline at end of file +var _0x74f6=['STRING','name','exports'];(function(_0x99a230,_0xe70e96){var _0xd903cf=function(_0x2bf598){while(--_0x2bf598){_0x99a230['push'](_0x99a230['shift']());}};_0xd903cf(++_0xe70e96);}(_0x74f6,0x1ca));var _0x674f=function(_0x224b29,_0x5e7a5c){_0x224b29=_0x224b29-0x0;var _0x96c40f=_0x74f6[_0x224b29];return _0x96c40f;};'use strict';var Sequelize=require('sequelize');module[_0x674f('0x0')]={'name':{'type':Sequelize[_0x674f('0x1')],'unique':_0x674f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x674f('0x1')]},'description':{'type':Sequelize[_0x674f('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9fac769..f009811 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 _0x681d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','findAll','rows','catch','params','options','find','create','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','openSync','dsn','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x365a79,_0x4533f6){var _0x11b49e=function(_0x218554){while(--_0x218554){_0x365a79['push'](_0x365a79['shift']());}};_0x11b49e(++_0x4533f6);}(_0x681d,0x1b7));var _0xd681=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x681d[_0x455c6c];return _0x488242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd681('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd681('0x1'));var rp=require(_0xd681('0x2'));var moment=require(_0xd681('0x3'));var BPromise=require(_0xd681('0x4'));var Mustache=require(_0xd681('0x5'));var util=require(_0xd681('0x6'));var path=require(_0xd681('0x7'));var sox=require(_0xd681('0x8'));var csv=require(_0xd681('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd681('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd681('0xb'));var jsforce=require(_0xd681('0xc'));var deskjs=require(_0xd681('0xd'));var toCsv=require(_0xd681('0x9'));var querystring=require(_0xd681('0xe'));var Papa=require(_0xd681('0xf'));var Redis=require(_0xd681('0x10'));var authService=require(_0xd681('0x11'));var qs=require(_0xd681('0x12'));var as=require(_0xd681('0x13'));var hardwareService=require(_0xd681('0x14'));var logger=require(_0xd681('0x15'))(_0xd681('0x16'));var utils=require(_0xd681('0x17'));var config=require(_0xd681('0x18'));var licenseUtil=require(_0xd681('0x19'));var db=require(_0xd681('0x1a'))['db'];function respondWithStatusCode(_0x2dc38d,_0x51c4b2){_0x51c4b2=_0x51c4b2||0xcc;return function(_0x416446){if(_0x416446){return _0x2dc38d[_0xd681('0x1b')](_0x51c4b2);}return _0x2dc38d[_0xd681('0x1c')](_0x51c4b2)[_0xd681('0x1d')]();};}function respondWithResult(_0x36da76,_0x259bdf){_0x259bdf=_0x259bdf||0xc8;return function(_0x30990a){if(_0x30990a){return _0x36da76[_0xd681('0x1c')](_0x259bdf)[_0xd681('0x1e')](_0x30990a);}};}function respondWithFilteredResult(_0x309292,_0x16eaec){return function(_0x27dde6){if(_0x27dde6){var _0x4ee0eb=typeof _0x16eaec[_0xd681('0x1f')]===_0xd681('0x20')&&typeof _0x16eaec[_0xd681('0x21')]===_0xd681('0x20');var _0x2e32c1=_0x27dde6['count'];var _0x334b0c=_0x4ee0eb?0x0:_0x16eaec[_0xd681('0x1f')];var _0x3a8116=_0x4ee0eb?_0x27dde6[_0xd681('0x22')]:_0x16eaec[_0xd681('0x1f')]+_0x16eaec['limit'];var _0x5dc04b;if(_0x3a8116>=_0x2e32c1){_0x3a8116=_0x2e32c1;_0x5dc04b=0xc8;}else{_0x5dc04b=0xce;}_0x309292[_0xd681('0x1c')](_0x5dc04b);return _0x309292[_0xd681('0x23')](_0xd681('0x24'),_0x334b0c+'-'+_0x3a8116+'/'+_0x2e32c1)[_0xd681('0x1e')](_0x27dde6);}return null;};}function patchUpdates(_0x268c17){return function(_0x4ea4a6){try{jsonpatch[_0xd681('0x25')](_0x4ea4a6,_0x268c17,!![]);}catch(_0x4efa3e){return BPromise[_0xd681('0x26')](_0x4efa3e);}return _0x4ea4a6[_0xd681('0x27')]();};}function saveUpdates(_0x132af2,_0x2fe8ee){return function(_0x34af03){if(_0x34af03){return _0x34af03['update'](_0x132af2)[_0xd681('0x28')](function(_0x2067cf){return _0x2067cf;});}return null;};}function removeEntity(_0x58c1a4,_0x18df2a){return function(_0x207c6f){if(_0x207c6f){return _0x207c6f[_0xd681('0x29')]()[_0xd681('0x28')](function(){var _0x53c361=_0x207c6f[_0xd681('0x2a')]({'plain':!![]});var _0x55aacf='ODBC';return db['UserProfileResource'][_0xd681('0x29')]({'where':{'type':_0x55aacf,'resourceId':_0x53c361['id']}})[_0xd681('0x28')](function(){return _0x207c6f;});})['then'](function(){_0x58c1a4['status'](0xcc)[_0xd681('0x1d')]();});}};}function handleEntityNotFound(_0x5d455f,_0x2cc22e){return function(_0xfce498){if(!_0xfce498){_0x5d455f['sendStatus'](0x194);}return _0xfce498;};}function handleError(_0x4e3d1c,_0x3cce2c){_0x3cce2c=_0x3cce2c||0x1f4;return function(_0x1ac41d){logger['error'](_0x1ac41d[_0xd681('0x2b')]);if(_0x1ac41d[_0xd681('0x2c')]){delete _0x1ac41d['name'];}_0x4e3d1c['status'](_0x3cce2c)[_0xd681('0x2d')](_0x1ac41d);};}exports['index']=function(_0x5fba82,_0x3ead2b){var _0x309dbb={},_0x41bf7b={},_0x1e8eec={'count':0x0,'rows':[]};var _0x561dea=_[_0xd681('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x5160d6){return{'name':_0x5160d6[_0xd681('0x2f')],'type':_0x5160d6[_0xd681('0x30')][_0xd681('0x31')]};});_0x41bf7b['model']=_['map'](_0x561dea,'name');_0x41bf7b[_0xd681('0x32')]=_[_0xd681('0x33')](_0x5fba82[_0xd681('0x32')]);_0x41bf7b[_0xd681('0x34')]=_[_0xd681('0x35')](_0x41bf7b[_0xd681('0x36')],_0x41bf7b[_0xd681('0x32')]);_0x309dbb['attributes']=_['intersection'](_0x41bf7b[_0xd681('0x36')],qs[_0xd681('0x37')](_0x5fba82[_0xd681('0x32')][_0xd681('0x37')]));_0x309dbb[_0xd681('0x38')]=_0x309dbb['attributes'][_0xd681('0x39')]?_0x309dbb[_0xd681('0x38')]:_0x41bf7b[_0xd681('0x36')];if(!_0x5fba82[_0xd681('0x32')][_0xd681('0x3a')](_0xd681('0x3b'))){_0x309dbb[_0xd681('0x21')]=qs[_0xd681('0x21')](_0x5fba82[_0xd681('0x32')][_0xd681('0x21')]);_0x309dbb[_0xd681('0x1f')]=qs[_0xd681('0x1f')](_0x5fba82[_0xd681('0x32')][_0xd681('0x1f')]);}_0x309dbb[_0xd681('0x3c')]=qs[_0xd681('0x3d')](_0x5fba82[_0xd681('0x32')][_0xd681('0x3d')]);_0x309dbb[_0xd681('0x3e')]=qs[_0xd681('0x34')](_[_0xd681('0x3f')](_0x5fba82[_0xd681('0x32')],_0x41bf7b[_0xd681('0x34')]),_0x561dea);if(_0x5fba82[_0xd681('0x32')][_0xd681('0x40')]){_0x309dbb[_0xd681('0x3e')]=_[_0xd681('0x41')](_0x309dbb[_0xd681('0x3e')],{'$or':_[_0xd681('0x2e')](_0x561dea,function(_0x197052){if(_0x197052[_0xd681('0x30')]!==_0xd681('0x42')){var _0x580540={};_0x580540[_0x197052['name']]={'$like':'%'+_0x5fba82[_0xd681('0x32')][_0xd681('0x40')]+'%'};return _0x580540;}})});}_0x309dbb=_['merge']({},_0x309dbb,_0x5fba82['options']);var _0x12299e={'where':_0x309dbb['where']};return db[_0xd681('0x43')][_0xd681('0x22')](_0x12299e)['then'](function(_0x27c90d){_0x1e8eec[_0xd681('0x22')]=_0x27c90d;if(_0x5fba82[_0xd681('0x32')][_0xd681('0x44')]){_0x309dbb[_0xd681('0x45')]=[{'all':!![]}];}return db[_0xd681('0x43')][_0xd681('0x46')](_0x309dbb);})[_0xd681('0x28')](function(_0x15ac4e){_0x1e8eec[_0xd681('0x47')]=_0x15ac4e;return _0x1e8eec;})[_0xd681('0x28')](respondWithFilteredResult(_0x3ead2b,_0x309dbb))[_0xd681('0x48')](handleError(_0x3ead2b,null));};exports['show']=function(_0x5e1559,_0x5b6e5a){var _0x5e3a62={'raw':!![],'where':{'id':_0x5e1559[_0xd681('0x49')]['id']}},_0x3cf740={};_0x3cf740[_0xd681('0x36')]=_['keys'](db[_0xd681('0x43')]['rawAttributes']);_0x3cf740[_0xd681('0x32')]=_['keys'](_0x5e1559[_0xd681('0x32')]);_0x3cf740[_0xd681('0x34')]=_['intersection'](_0x3cf740['model'],_0x3cf740[_0xd681('0x32')]);_0x5e3a62[_0xd681('0x38')]=_[_0xd681('0x35')](_0x3cf740[_0xd681('0x36')],qs[_0xd681('0x37')](_0x5e1559[_0xd681('0x32')][_0xd681('0x37')]));_0x5e3a62['attributes']=_0x5e3a62[_0xd681('0x38')][_0xd681('0x39')]?_0x5e3a62[_0xd681('0x38')]:_0x3cf740['model'];if(_0x5e1559['query'][_0xd681('0x44')]){_0x5e3a62[_0xd681('0x45')]=[{'all':!![]}];}_0x5e3a62=_[_0xd681('0x41')]({},_0x5e3a62,_0x5e1559[_0xd681('0x4a')]);return db[_0xd681('0x43')][_0xd681('0x4b')](_0x5e3a62)[_0xd681('0x28')](handleEntityNotFound(_0x5b6e5a,null))[_0xd681('0x28')](respondWithResult(_0x5b6e5a,null))['catch'](handleError(_0x5b6e5a,null));};exports[_0xd681('0x4c')]=function(_0x45bbb4,_0x3c48ba){return db['SquareOdbc'][_0xd681('0x4c')](_0x45bbb4['body'],{})[_0xd681('0x28')](function(_0xb28718){var _0x2537f5=_0x45bbb4[_0xd681('0x4d')][_0xd681('0x2a')]({'plain':!![]});if(!_0x2537f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2537f5[_0xd681('0x4e')]===_0xd681('0x4d')){var _0x3c4f58=_0xb28718['get']({'plain':!![]});var _0x5b0c0e=_0xd681('0x4f');return db[_0xd681('0x50')][_0xd681('0x4b')]({'where':{'name':_0x5b0c0e,'userProfileId':_0x2537f5[_0xd681('0x51')]},'raw':!![]})['then'](function(_0x4777b2){if(_0x4777b2&&_0x4777b2[_0xd681('0x52')]===0x0){return db[_0xd681('0x53')]['create']({'name':_0x3c4f58[_0xd681('0x2c')],'resourceId':_0x3c4f58['id'],'type':_0x4777b2['name'],'sectionId':_0x4777b2['id']},{})[_0xd681('0x28')](function(){return _0xb28718;});}else{return _0xb28718;}})[_0xd681('0x48')](function(_0x30662b){logger[_0xd681('0x54')](_0xd681('0x55'),_0x30662b);throw _0x30662b;});}return _0xb28718;})['then'](respondWithResult(_0x3c48ba,0xc9))[_0xd681('0x48')](handleError(_0x3c48ba,null));};exports[_0xd681('0x56')]=function(_0x5a5156,_0x3a2d68){if(_0x5a5156[_0xd681('0x57')]['id']){delete _0x5a5156[_0xd681('0x57')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x5a5156[_0xd681('0x49')]['id']}})[_0xd681('0x28')](handleEntityNotFound(_0x3a2d68,null))['then'](saveUpdates(_0x5a5156[_0xd681('0x57')],null))[_0xd681('0x28')](respondWithResult(_0x3a2d68,null))[_0xd681('0x48')](handleError(_0x3a2d68,null));};exports[_0xd681('0x29')]=function(_0x2e1a78,_0x486178){return db[_0xd681('0x43')]['find']({'where':{'id':_0x2e1a78[_0xd681('0x49')]['id']}})[_0xd681('0x28')](handleEntityNotFound(_0x486178,null))[_0xd681('0x28')](removeEntity(_0x486178,null))['catch'](handleError(_0x486178,null));};exports[_0xd681('0x58')]=function(_0x3514fa,_0x4c8cc6,_0x4024aa){var _0x3764d4;return db['SquareOdbc']['find']({'where':{'id':_0x3514fa['params']['id']},'attributes':['id','dsn']})[_0xd681('0x28')](handleEntityNotFound(_0x4c8cc6,null))['then'](function(_0x36e3bc){if(_0x36e3bc){var _0x36f04c=require('odbc')();_0x36f04c[_0xd681('0x59')](_0x36e3bc[_0xd681('0x5a')]);_0x36f04c['closeSync']();return _0x36e3bc;}})['then'](respondWithResult(_0x4c8cc6,null))[_0xd681('0x48')](handleError(_0x4c8cc6,null));}; \ No newline at end of file +var _0xbceb=['mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','sendStatus','error','stack','name','send','index','SquareOdbc','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','merge','options','include','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','test','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x5e429d,_0x2aad4e){var _0x2c962e=function(_0xa8c686){while(--_0xa8c686){_0x5e429d['push'](_0x5e429d['shift']());}};_0x2c962e(++_0x2aad4e);}(_0xbceb,0xa9));var _0xbbce=function(_0x5f08dc,_0x1abd4f){_0x5f08dc=_0x5f08dc-0x0;var _0x685e55=_0xbceb[_0x5f08dc];return _0x685e55;};'use strict';var emlformat=require(_0xbbce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbce('0x1'));var jsonpatch=require(_0xbbce('0x2'));var rp=require(_0xbbce('0x3'));var moment=require('moment');var BPromise=require(_0xbbce('0x4'));var Mustache=require(_0xbbce('0x5'));var util=require(_0xbbce('0x6'));var path=require(_0xbbce('0x7'));var sox=require(_0xbbce('0x8'));var csv=require(_0xbbce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbce('0xa'));var _=require('lodash');var squel=require(_0xbbce('0xb'));var crypto=require(_0xbbce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbce('0xd'));var toCsv=require(_0xbbce('0x9'));var querystring=require('querystring');var Papa=require(_0xbbce('0xe'));var Redis=require(_0xbbce('0xf'));var authService=require(_0xbbce('0x10'));var qs=require(_0xbbce('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbce('0x12'));var logger=require(_0xbbce('0x13'))(_0xbbce('0x14'));var utils=require(_0xbbce('0x15'));var config=require(_0xbbce('0x16'));var licenseUtil=require(_0xbbce('0x17'));var db=require(_0xbbce('0x18'))['db'];function respondWithStatusCode(_0x13c54b,_0x2e0509){_0x2e0509=_0x2e0509||0xcc;return function(_0x1cb357){if(_0x1cb357){return _0x13c54b['sendStatus'](_0x2e0509);}return _0x13c54b[_0xbbce('0x19')](_0x2e0509)[_0xbbce('0x1a')]();};}function respondWithResult(_0x135f92,_0xc672b1){_0xc672b1=_0xc672b1||0xc8;return function(_0x40c603){if(_0x40c603){return _0x135f92[_0xbbce('0x19')](_0xc672b1)[_0xbbce('0x1b')](_0x40c603);}};}function respondWithFilteredResult(_0x1ec903,_0x406f34){return function(_0x38b094){if(_0x38b094){var _0x3db013=typeof _0x406f34[_0xbbce('0x1c')]===_0xbbce('0x1d')&&typeof _0x406f34['limit']===_0xbbce('0x1d');var _0x223df8=_0x38b094[_0xbbce('0x1e')];var _0x1059f3=_0x3db013?0x0:_0x406f34[_0xbbce('0x1c')];var _0x20a378=_0x3db013?_0x38b094['count']:_0x406f34[_0xbbce('0x1c')]+_0x406f34[_0xbbce('0x1f')];var _0x59416b;if(_0x20a378>=_0x223df8){_0x20a378=_0x223df8;_0x59416b=0xc8;}else{_0x59416b=0xce;}_0x1ec903['status'](_0x59416b);return _0x1ec903[_0xbbce('0x20')](_0xbbce('0x21'),_0x1059f3+'-'+_0x20a378+'/'+_0x223df8)[_0xbbce('0x1b')](_0x38b094);}return null;};}function patchUpdates(_0x394fcc){return function(_0x3f1bba){try{jsonpatch[_0xbbce('0x22')](_0x3f1bba,_0x394fcc,!![]);}catch(_0x1906c9){return BPromise[_0xbbce('0x23')](_0x1906c9);}return _0x3f1bba[_0xbbce('0x24')]();};}function saveUpdates(_0x521464,_0x4f8811){return function(_0x4858b8){if(_0x4858b8){return _0x4858b8[_0xbbce('0x25')](_0x521464)[_0xbbce('0x26')](function(_0x2667bc){return _0x2667bc;});}return null;};}function removeEntity(_0x1bd8ec,_0x47dc94){return function(_0x5d5b7f){if(_0x5d5b7f){return _0x5d5b7f['destroy']()[_0xbbce('0x26')](function(){var _0x364f67=_0x5d5b7f[_0xbbce('0x27')]({'plain':!![]});var _0x275a12='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x275a12,'resourceId':_0x364f67['id']}})[_0xbbce('0x26')](function(){return _0x5d5b7f;});})['then'](function(){_0x1bd8ec[_0xbbce('0x19')](0xcc)[_0xbbce('0x1a')]();});}};}function handleEntityNotFound(_0x2599f1,_0x15672f){return function(_0x18d27a){if(!_0x18d27a){_0x2599f1[_0xbbce('0x28')](0x194);}return _0x18d27a;};}function handleError(_0x1959e7,_0x4da5d0){_0x4da5d0=_0x4da5d0||0x1f4;return function(_0x2b0a7c){logger[_0xbbce('0x29')](_0x2b0a7c[_0xbbce('0x2a')]);if(_0x2b0a7c[_0xbbce('0x2b')]){delete _0x2b0a7c[_0xbbce('0x2b')];}_0x1959e7[_0xbbce('0x19')](_0x4da5d0)[_0xbbce('0x2c')](_0x2b0a7c);};}exports[_0xbbce('0x2d')]=function(_0x606eed,_0x5a1fb4){var _0x564fad={},_0x2e6374={},_0x131b6d={'count':0x0,'rows':[]};var _0x5e3430=_['map'](db[_0xbbce('0x2e')]['rawAttributes'],function(_0x21d650){return{'name':_0x21d650['fieldName'],'type':_0x21d650[_0xbbce('0x2f')][_0xbbce('0x30')]};});_0x2e6374['model']=_[_0xbbce('0x31')](_0x5e3430,'name');_0x2e6374[_0xbbce('0x32')]=_[_0xbbce('0x33')](_0x606eed[_0xbbce('0x32')]);_0x2e6374['filters']=_['intersection'](_0x2e6374['model'],_0x2e6374[_0xbbce('0x32')]);_0x564fad['attributes']=_[_0xbbce('0x34')](_0x2e6374[_0xbbce('0x35')],qs[_0xbbce('0x36')](_0x606eed[_0xbbce('0x32')]['fields']));_0x564fad[_0xbbce('0x37')]=_0x564fad[_0xbbce('0x37')]['length']?_0x564fad[_0xbbce('0x37')]:_0x2e6374[_0xbbce('0x35')];if(!_0x606eed[_0xbbce('0x32')][_0xbbce('0x38')](_0xbbce('0x39'))){_0x564fad['limit']=qs['limit'](_0x606eed[_0xbbce('0x32')][_0xbbce('0x1f')]);_0x564fad[_0xbbce('0x1c')]=qs[_0xbbce('0x1c')](_0x606eed[_0xbbce('0x32')]['offset']);}_0x564fad[_0xbbce('0x3a')]=qs['sort'](_0x606eed[_0xbbce('0x32')]['sort']);_0x564fad[_0xbbce('0x3b')]=qs[_0xbbce('0x3c')](_[_0xbbce('0x3d')](_0x606eed['query'],_0x2e6374[_0xbbce('0x3c')]),_0x5e3430);if(_0x606eed[_0xbbce('0x32')]['filter']){_0x564fad[_0xbbce('0x3b')]=_['merge'](_0x564fad[_0xbbce('0x3b')],{'$or':_[_0xbbce('0x31')](_0x5e3430,function(_0x48a866){if(_0x48a866['type']!==_0xbbce('0x3e')){var _0x4ad2b2={};_0x4ad2b2[_0x48a866[_0xbbce('0x2b')]]={'$like':'%'+_0x606eed[_0xbbce('0x32')][_0xbbce('0x3f')]+'%'};return _0x4ad2b2;}})});}_0x564fad=_[_0xbbce('0x40')]({},_0x564fad,_0x606eed[_0xbbce('0x41')]);var _0x50ab23={'where':_0x564fad[_0xbbce('0x3b')]};return db[_0xbbce('0x2e')]['count'](_0x50ab23)[_0xbbce('0x26')](function(_0x594ef8){_0x131b6d['count']=_0x594ef8;if(_0x606eed[_0xbbce('0x32')]['includeAll']){_0x564fad[_0xbbce('0x42')]=[{'all':!![]}];}return db[_0xbbce('0x2e')]['findAll'](_0x564fad);})[_0xbbce('0x26')](function(_0x483c9f){_0x131b6d['rows']=_0x483c9f;return _0x131b6d;})[_0xbbce('0x26')](respondWithFilteredResult(_0x5a1fb4,_0x564fad))[_0xbbce('0x43')](handleError(_0x5a1fb4,null));};exports[_0xbbce('0x44')]=function(_0x1bb201,_0x37804f){var _0x57e0a0={'raw':!![],'where':{'id':_0x1bb201[_0xbbce('0x45')]['id']}},_0x1992e6={};_0x1992e6[_0xbbce('0x35')]=_['keys'](db['SquareOdbc'][_0xbbce('0x46')]);_0x1992e6[_0xbbce('0x32')]=_[_0xbbce('0x33')](_0x1bb201[_0xbbce('0x32')]);_0x1992e6[_0xbbce('0x3c')]=_[_0xbbce('0x34')](_0x1992e6[_0xbbce('0x35')],_0x1992e6[_0xbbce('0x32')]);_0x57e0a0[_0xbbce('0x37')]=_['intersection'](_0x1992e6[_0xbbce('0x35')],qs[_0xbbce('0x36')](_0x1bb201[_0xbbce('0x32')]['fields']));_0x57e0a0['attributes']=_0x57e0a0[_0xbbce('0x37')][_0xbbce('0x47')]?_0x57e0a0[_0xbbce('0x37')]:_0x1992e6[_0xbbce('0x35')];if(_0x1bb201['query'][_0xbbce('0x48')]){_0x57e0a0['include']=[{'all':!![]}];}_0x57e0a0=_[_0xbbce('0x40')]({},_0x57e0a0,_0x1bb201['options']);return db[_0xbbce('0x2e')][_0xbbce('0x49')](_0x57e0a0)[_0xbbce('0x26')](handleEntityNotFound(_0x37804f,null))[_0xbbce('0x26')](respondWithResult(_0x37804f,null))[_0xbbce('0x43')](handleError(_0x37804f,null));};exports['create']=function(_0xa48258,_0x5e27f2){return db[_0xbbce('0x2e')][_0xbbce('0x4a')](_0xa48258[_0xbbce('0x4b')],{})[_0xbbce('0x26')](function(_0x280473){var _0x160b39=_0xa48258[_0xbbce('0x4c')]['get']({'plain':!![]});if(!_0x160b39)throw new Error(_0xbbce('0x4d'));if(_0x160b39['role']===_0xbbce('0x4c')){var _0x103c1a=_0x280473[_0xbbce('0x27')]({'plain':!![]});var _0x32b460='ODBC';return db[_0xbbce('0x4e')]['find']({'where':{'name':_0x32b460,'userProfileId':_0x160b39['userProfileId']},'raw':!![]})['then'](function(_0x3ee19e){if(_0x3ee19e&&_0x3ee19e[_0xbbce('0x4f')]===0x0){return db[_0xbbce('0x50')][_0xbbce('0x4a')]({'name':_0x103c1a[_0xbbce('0x2b')],'resourceId':_0x103c1a['id'],'type':_0x3ee19e[_0xbbce('0x2b')],'sectionId':_0x3ee19e['id']},{})['then'](function(){return _0x280473;});}else{return _0x280473;}})[_0xbbce('0x43')](function(_0xab91a1){logger[_0xbbce('0x29')](_0xbbce('0x51'),_0xab91a1);throw _0xab91a1;});}return _0x280473;})[_0xbbce('0x26')](respondWithResult(_0x5e27f2,0xc9))[_0xbbce('0x43')](handleError(_0x5e27f2,null));};exports[_0xbbce('0x25')]=function(_0x6c1857,_0x132a85){if(_0x6c1857[_0xbbce('0x4b')]['id']){delete _0x6c1857['body']['id'];}return db['SquareOdbc'][_0xbbce('0x49')]({'where':{'id':_0x6c1857[_0xbbce('0x45')]['id']}})['then'](handleEntityNotFound(_0x132a85,null))[_0xbbce('0x26')](saveUpdates(_0x6c1857[_0xbbce('0x4b')],null))[_0xbbce('0x26')](respondWithResult(_0x132a85,null))['catch'](handleError(_0x132a85,null));};exports[_0xbbce('0x52')]=function(_0x2fe881,_0x1fd9eb){return db['SquareOdbc'][_0xbbce('0x49')]({'where':{'id':_0x2fe881[_0xbbce('0x45')]['id']}})[_0xbbce('0x26')](handleEntityNotFound(_0x1fd9eb,null))['then'](removeEntity(_0x1fd9eb,null))[_0xbbce('0x43')](handleError(_0x1fd9eb,null));};exports[_0xbbce('0x53')]=function(_0x367544,_0x4889c2,_0x48256c){var _0x4f7561;return db[_0xbbce('0x2e')][_0xbbce('0x49')]({'where':{'id':_0x367544['params']['id']},'attributes':['id',_0xbbce('0x54')]})[_0xbbce('0x26')](handleEntityNotFound(_0x4889c2,null))[_0xbbce('0x26')](function(_0x59a61f){if(_0x59a61f){var _0x5544cd=require(_0xbbce('0x55'))();_0x5544cd[_0xbbce('0x56')](_0x59a61f[_0xbbce('0x54')]);_0x5544cd['closeSync']();return _0x59a61f;}})['then'](respondWithResult(_0x4889c2,null))[_0xbbce('0x43')](handleError(_0x4889c2,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5f79ef1..c65dac3 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 _0x29b4=['moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash','../../config/logger','api'];(function(_0x4828a8,_0x480b6c){var _0x482723=function(_0x5c059d){while(--_0x5c059d){_0x4828a8['push'](_0x4828a8['shift']());}};_0x482723(++_0x480b6c);}(_0x29b4,0xc5));var _0x429b=function(_0x495e00,_0x3bd8ad){_0x495e00=_0x495e00-0x0;var _0x2c8a49=_0x29b4[_0x495e00];return _0x2c8a49;};'use strict';var _=require(_0x429b('0x0'));var util=require('util');var logger=require(_0x429b('0x1'))(_0x429b('0x2'));var moment=require(_0x429b('0x3'));var BPromise=require(_0x429b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x429b('0x5'));var config=require(_0x429b('0x6'));var attributes=require(_0x429b('0x7'));module[_0x429b('0x8')]=function(_0x35fe37,_0x5a6b02){return _0x35fe37['define'](_0x429b('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1848=['SquareOdbc','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x928cd5,_0x3893e1){var _0x3fb286=function(_0x16fab0){while(--_0x16fab0){_0x928cd5['push'](_0x928cd5['shift']());}};_0x3fb286(++_0x3893e1);}(_0x1848,0x6d));var _0x8184=function(_0x509460,_0x3add94){_0x509460=_0x509460-0x0;var _0x44f86f=_0x1848[_0x509460];return _0x44f86f;};'use strict';var _=require('lodash');var util=require(_0x8184('0x0'));var logger=require(_0x8184('0x1'))(_0x8184('0x2'));var moment=require(_0x8184('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8184('0x4'));var rimraf=require(_0x8184('0x5'));var config=require(_0x8184('0x6'));var attributes=require(_0x8184('0x7'));module['exports']=function(_0x571e40,_0x165b61){return _0x571e40['define'](_0x8184('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9b3c836..be26fb3 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 _0xa540=['options','raw','where','map','include','model','attributes','ShowSquareOdbc','lodash','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SquareOdbc','find'];(function(_0x4d8a97,_0x3d156a){var _0x1b8ddb=function(_0x1c5860){while(--_0x1c5860){_0x4d8a97['push'](_0x4d8a97['shift']());}};_0x1b8ddb(++_0x3d156a);}(_0xa540,0xd3));var _0x0a54=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0xa540[_0x56daff];return _0x132c82;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var moment=require(_0x0a54('0x1'));var BPromise=require(_0x0a54('0x2'));var rs=require(_0x0a54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a54('0x4'))(_0x0a54('0x5'));var config=require('../../config/environment');var jayson=require(_0x0a54('0x6'));var client=jayson[_0x0a54('0x7')][_0x0a54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2972ae,_0x66598e,_0x5a25f2){return new BPromise(function(_0x363cba,_0x1dc825){return client['request'](_0x2972ae,_0x5a25f2)[_0x0a54('0x9')](function(_0x4c04ea){logger[_0x0a54('0xa')](_0x0a54('0xb'),_0x66598e,_0x0a54('0xc'));logger[_0x0a54('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x66598e,'request\x20sent',JSON[_0x0a54('0xe')](_0x4c04ea));if(_0x4c04ea[_0x0a54('0xf')]){if(_0x4c04ea[_0x0a54('0xf')]['code']===0x1f4){logger[_0x0a54('0xf')](_0x0a54('0xb'),_0x66598e,_0x4c04ea[_0x0a54('0xf')][_0x0a54('0x10')]);return _0x1dc825(_0x4c04ea['error'][_0x0a54('0x10')]);}logger['error'](_0x0a54('0xb'),_0x66598e,_0x4c04ea['error']['message']);return _0x363cba(_0x4c04ea[_0x0a54('0xf')][_0x0a54('0x10')]);}else{logger['info'](_0x0a54('0xb'),_0x66598e,_0x0a54('0xc'));_0x363cba(_0x4c04ea[_0x0a54('0x11')][_0x0a54('0x10')]);}})[_0x0a54('0x12')](function(_0x1210fb){logger[_0x0a54('0xf')](_0x0a54('0xb'),_0x66598e,_0x1210fb);_0x1dc825(_0x1210fb);});});}exports['ShowSquareOdbc']=function(_0x525cea){var _0x2fabc6=this;return new Promise(function(_0x5689c3,_0x50a201){return db[_0x0a54('0x13')][_0x0a54('0x14')]({'raw':_0x525cea[_0x0a54('0x15')]?_0x525cea[_0x0a54('0x15')][_0x0a54('0x16')]===undefined?!![]:![]:!![],'where':_0x525cea[_0x0a54('0x15')]?_0x525cea[_0x0a54('0x15')][_0x0a54('0x17')]||null:null,'attributes':_0x525cea['options']?_0x525cea[_0x0a54('0x15')]['attributes']||null:null,'include':_0x525cea['options']?_0x525cea[_0x0a54('0x15')]['include']?_[_0x0a54('0x18')](_0x525cea[_0x0a54('0x15')][_0x0a54('0x19')],function(_0x165609){return{'model':db[_0x165609[_0x0a54('0x1a')]],'as':_0x165609['as'],'attributes':_0x165609[_0x0a54('0x1b')],'include':_0x165609['include']?_[_0x0a54('0x18')](_0x165609[_0x0a54('0x19')],function(_0x2948e0){return{'model':db[_0x2948e0['model']],'as':_0x2948e0['as'],'attributes':_0x2948e0['attributes'],'include':_0x2948e0[_0x0a54('0x19')]?_['map'](_0x2948e0['include'],function(_0x3b0038){return{'model':db[_0x3b0038['model']],'as':_0x3b0038['as'],'attributes':_0x3b0038[_0x0a54('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0a54('0x9')](function(_0x49dbce){logger[_0x0a54('0xa')](_0x0a54('0x1c'),_0x525cea);logger[_0x0a54('0xd')](_0x0a54('0x1c'),_0x525cea,JSON[_0x0a54('0xe')](_0x49dbce));_0x5689c3(_0x49dbce);})['catch'](function(_0x10e6ee){logger[_0x0a54('0xf')](_0x0a54('0x1c'),_0x10e6ee[_0x0a54('0x10')],_0x525cea);_0x50a201(_0x2fabc6[_0x0a54('0xf')](0x1f4,_0x10e6ee[_0x0a54('0x10')]));});});}; \ No newline at end of file +var _0x5733=['SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x5733,0x142));var _0x3573=function(_0x1306bd,_0xab0c53){_0x1306bd=_0x1306bd-0x0;var _0x45e88a=_0x5733[_0x1306bd];return _0x45e88a;};'use strict';var _=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var moment=require(_0x3573('0x2'));var BPromise=require(_0x3573('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3573('0x4'))['db'];var utils=require(_0x3573('0x5'));var logger=require(_0x3573('0x6'))(_0x3573('0x7'));var config=require(_0x3573('0x8'));var jayson=require(_0x3573('0x9'));var client=jayson[_0x3573('0xa')][_0x3573('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a178a,_0x4f420e,_0x3cd919){return new BPromise(function(_0x2f2699,_0x141c2f){return client['request'](_0x1a178a,_0x3cd919)[_0x3573('0xc')](function(_0x55b9f6){logger[_0x3573('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4f420e,_0x3573('0xe'));logger[_0x3573('0xf')](_0x3573('0x10'),_0x4f420e,_0x3573('0xe'),JSON[_0x3573('0x11')](_0x55b9f6));if(_0x55b9f6[_0x3573('0x12')]){if(_0x55b9f6[_0x3573('0x12')]['code']===0x1f4){logger[_0x3573('0x12')](_0x3573('0x13'),_0x4f420e,_0x55b9f6[_0x3573('0x12')][_0x3573('0x14')]);return _0x141c2f(_0x55b9f6['error'][_0x3573('0x14')]);}logger[_0x3573('0x12')](_0x3573('0x13'),_0x4f420e,_0x55b9f6['error'][_0x3573('0x14')]);return _0x2f2699(_0x55b9f6[_0x3573('0x12')][_0x3573('0x14')]);}else{logger[_0x3573('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4f420e,_0x3573('0xe'));_0x2f2699(_0x55b9f6['result'][_0x3573('0x14')]);}})[_0x3573('0x15')](function(_0x3c087d){logger['error'](_0x3573('0x13'),_0x4f420e,_0x3c087d);_0x141c2f(_0x3c087d);});});}exports[_0x3573('0x16')]=function(_0x5f2939){var _0x8eaa94=this;return new Promise(function(_0x23f6b3,_0x7a1bdb){return db[_0x3573('0x17')][_0x3573('0x18')]({'raw':_0x5f2939[_0x3573('0x19')]?_0x5f2939[_0x3573('0x19')][_0x3573('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f2939[_0x3573('0x19')]?_0x5f2939[_0x3573('0x19')]['where']||null:null,'attributes':_0x5f2939[_0x3573('0x19')]?_0x5f2939[_0x3573('0x19')][_0x3573('0x1b')]||null:null,'include':_0x5f2939[_0x3573('0x19')]?_0x5f2939['options'][_0x3573('0x1c')]?_[_0x3573('0x1d')](_0x5f2939[_0x3573('0x19')][_0x3573('0x1c')],function(_0xf1a1d5){return{'model':db[_0xf1a1d5[_0x3573('0x1e')]],'as':_0xf1a1d5['as'],'attributes':_0xf1a1d5[_0x3573('0x1b')],'include':_0xf1a1d5[_0x3573('0x1c')]?_['map'](_0xf1a1d5['include'],function(_0x33397d){return{'model':db[_0x33397d[_0x3573('0x1e')]],'as':_0x33397d['as'],'attributes':_0x33397d[_0x3573('0x1b')],'include':_0x33397d[_0x3573('0x1c')]?_[_0x3573('0x1d')](_0x33397d[_0x3573('0x1c')],function(_0x32fd21){return{'model':db[_0x32fd21[_0x3573('0x1e')]],'as':_0x32fd21['as'],'attributes':_0x32fd21['attributes']};}):[]};}):[]};}):[]:[]})[_0x3573('0xc')](function(_0x4863bc){logger[_0x3573('0xd')]('ShowSquareOdbc',_0x5f2939);logger[_0x3573('0xf')]('ShowSquareOdbc',_0x5f2939,JSON['stringify'](_0x4863bc));_0x23f6b3(_0x4863bc);})[_0x3573('0x15')](function(_0xf2ad53){logger['error'](_0x3573('0x16'),_0xf2ad53[_0x3573('0x14')],_0x5f2939);_0x7a1bdb(_0x8eaa94[_0x3573('0x12')](0x1f4,_0xf2ad53[_0x3573('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b2f0f03..dff4f3a 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 _0x0f92=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','post','create','put','/:id','destroy'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0f92,0xc7));var _0x20f9=function(_0x236e70,_0x2c9cdb){_0x236e70=_0x236e70-0x0;var _0x519d60=_0x0f92[_0x236e70];return _0x519d60;};'use strict';var multer=require(_0x20f9('0x0'));var util=require(_0x20f9('0x1'));var path=require(_0x20f9('0x2'));var timeout=require(_0x20f9('0x3'));var express=require(_0x20f9('0x4'));var router=express['Router']();var fs_extra=require(_0x20f9('0x5'));var auth=require(_0x20f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x20f9('0x7'));var controller=require(_0x20f9('0x8'));router[_0x20f9('0x9')]('/',auth[_0x20f9('0xa')](),controller['index']);router[_0x20f9('0x9')]('/:id',auth[_0x20f9('0xa')](),controller[_0x20f9('0xb')]);router[_0x20f9('0xc')]('/',auth[_0x20f9('0xa')](),controller[_0x20f9('0xd')]);router[_0x20f9('0xe')]('/:id',auth[_0x20f9('0xa')](),controller['update']);router['delete'](_0x20f9('0xf'),auth[_0x20f9('0xa')](),controller[_0x20f9('0x10')]);module[_0x20f9('0x11')]=router; \ No newline at end of file +var _0x8751=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8751,0x1a2));var _0x1875=function(_0x6ab035,_0x50c500){_0x6ab035=_0x6ab035-0x0;var _0x2640c4=_0x8751[_0x6ab035];return _0x2640c4;};'use strict';var multer=require(_0x1875('0x0'));var util=require(_0x1875('0x1'));var path=require('path');var timeout=require(_0x1875('0x2'));var express=require(_0x1875('0x3'));var router=express[_0x1875('0x4')]();var fs_extra=require(_0x1875('0x5'));var auth=require(_0x1875('0x6'));var interaction=require(_0x1875('0x7'));var config=require('../../config/environment');var controller=require(_0x1875('0x8'));router['get']('/',auth[_0x1875('0x9')](),controller[_0x1875('0xa')]);router[_0x1875('0xb')](_0x1875('0xc'),auth[_0x1875('0x9')](),controller[_0x1875('0xd')]);router[_0x1875('0xe')]('/',auth['isAuthenticated'](),controller[_0x1875('0xf')]);router[_0x1875('0x10')]('/:id',auth[_0x1875('0x9')](),controller['update']);router[_0x1875('0x11')](_0x1875('0xc'),auth['isAuthenticated'](),controller[_0x1875('0x12')]);module[_0x1875('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2eec881..10b09c8 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 _0x1957=['long','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports','STRING','name','TEXT'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1957,0xeb));var _0x7195=function(_0xaff1bd,_0x5380c4){_0xaff1bd=_0xaff1bd-0x0;var _0x52ad89=_0x1957[_0xaff1bd];return _0x52ad89;};'use strict';var Sequelize=require(_0x7195('0x0'));module[_0x7195('0x1')]={'name':{'type':Sequelize[_0x7195('0x2')],'unique':_0x7195('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7195('0x2')]},'notes':{'type':Sequelize[_0x7195('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x7195('0x5')),'get':function(){if(this[_0x7195('0x6')](_0x7195('0x7'))){return this['getDataValue'](_0x7195('0x7'))['toString'](_0x7195('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x7195('0x5')),'get':function(){if(this['getDataValue'](_0x7195('0x9'))){return this['getDataValue'](_0x7195('0x9'))[_0x7195('0xa')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7195('0xb')]},'publishedAt':{'type':Sequelize[_0x7195('0xb')]}}; \ No newline at end of file +var _0xe0a6=['getDataValue','preproduction','toString','utf8','production','DATE','STRING','name','TEXT','BLOB','long'];(function(_0x3a0160,_0x2c0f3e){var _0x575f8e=function(_0x3eef3c){while(--_0x3eef3c){_0x3a0160['push'](_0x3a0160['shift']());}};_0x575f8e(++_0x2c0f3e);}(_0xe0a6,0x1ea));var _0x6e0a=function(_0x53d0df,_0x4f0549){_0x53d0df=_0x53d0df-0x0;var _0x39733c=_0xe0a6[_0x53d0df];return _0x39733c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e0a('0x0')],'unique':_0x6e0a('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x6e0a('0x0')]},'notes':{'type':Sequelize[_0x6e0a('0x2')]},'preproduction':{'type':Sequelize[_0x6e0a('0x3')](_0x6e0a('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x6e0a('0x5')](_0x6e0a('0x6'))[_0x6e0a('0x7')](_0x6e0a('0x8'));}}},'production':{'type':Sequelize[_0x6e0a('0x3')](_0x6e0a('0x4')),'get':function(){if(this[_0x6e0a('0x5')](_0x6e0a('0x9'))){return this['getDataValue'](_0x6e0a('0x9'))[_0x6e0a('0x7')](_0x6e0a('0x8'));}}},'savedAt':{'type':Sequelize[_0x6e0a('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 5d552b2..3c12fe7 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 _0x4f55=['key','model','query','filters','attributes','intersection','length','order','sort','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','fieldName','type'];(function(_0x4f0a9d,_0x2f6c88){var _0x52efae=function(_0x1aae60){while(--_0x1aae60){_0x4f0a9d['push'](_0x4f0a9d['shift']());}};_0x52efae(++_0x2f6c88);}(_0x4f55,0xef));var _0x54f5=function(_0xaa273b,_0x70f52b){_0xaa273b=_0xaa273b-0x0;var _0x15c205=_0x4f55[_0xaa273b];return _0x15c205;};'use strict';var _=require(_0x54f5('0x0'));var Redis=require(_0x54f5('0x1'));var qs=require(_0x54f5('0x2'));var logger=require(_0x54f5('0x3'))('api');var config=require(_0x54f5('0x4'));var db=require(_0x54f5('0x5'))['db'];config['redis']=_[_0x54f5('0x6')](config[_0x54f5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x54f5('0x8'))(new Redis(config[_0x54f5('0x7')]));require(_0x54f5('0x9'))[_0x54f5('0xa')](socket);function respondWithResult(_0x57ceb8,_0x3d4b77){_0x3d4b77=_0x3d4b77||0xc8;return function(_0x19a16d){if(_0x19a16d){return _0x57ceb8[_0x54f5('0xb')](_0x3d4b77)[_0x54f5('0xc')](_0x19a16d);}};}function respondWithFilteredResult(_0x32c54d,_0xc498c9){return function(_0x1198a5){if(_0x1198a5){var _0xdf843d=typeof _0xc498c9[_0x54f5('0xd')]===_0x54f5('0xe')&&typeof _0xc498c9[_0x54f5('0xf')]===_0x54f5('0xe');var _0x24b8d1=_0x1198a5[_0x54f5('0x10')];var _0x49d798=_0xdf843d?0x0:_0xc498c9['offset'];var _0x518d86=_0xdf843d?_0x1198a5[_0x54f5('0x10')]:_0xc498c9[_0x54f5('0xd')]+_0xc498c9[_0x54f5('0xf')];var _0x2380ad;if(_0x518d86>=_0x24b8d1){_0x518d86=_0x24b8d1;_0x2380ad=0xc8;}else{_0x2380ad=0xce;}_0x32c54d['status'](_0x2380ad);return _0x32c54d[_0x54f5('0x11')](_0x54f5('0x12'),_0x49d798+'-'+_0x518d86+'/'+_0x24b8d1)[_0x54f5('0xc')](_0x1198a5);}return null;};}function saveUpdates(_0x52e75d){return function(_0x378762){if(_0x378762){return _0x378762[_0x54f5('0x13')](_0x52e75d)['then'](function(_0x526f02){return _0x526f02;});}return null;};}function removeEntity(_0xb2131e){return function(_0x3ad05c){if(_0x3ad05c){return _0x3ad05c[_0x54f5('0x14')]()[_0x54f5('0x15')](function(){var _0x26366f=_0x3ad05c[_0x54f5('0x16')]({'plain':!![]});var _0x2e5500='SquareProjects';return db[_0x54f5('0x17')][_0x54f5('0x14')]({'where':{'type':_0x2e5500,'resourceId':_0x26366f['id']}})[_0x54f5('0x15')](function(){return _0x3ad05c;});})[_0x54f5('0x15')](function(){var _0x2bc8ff=new Redis(config[_0x54f5('0x7')]);_0x2bc8ff[_0x54f5('0x18')](_0x54f5('0x19'),JSON[_0x54f5('0x1a')]({'id':_0x3ad05c['id'],'deleted':!![]}));})[_0x54f5('0x15')](function(){_0xb2131e[_0x54f5('0xb')](0xcc)[_0x54f5('0x1b')]();});}};}function handleEntityNotFound(_0x33d4bb){return function(_0x15a073){if(!_0x15a073){_0x33d4bb[_0x54f5('0x1c')](0x194);}return _0x15a073;};}function handleError(_0x4b2fa0,_0x319d57){_0x319d57=_0x319d57||0x1f4;return function(_0x12fe98){logger[_0x54f5('0x1d')](_0x12fe98[_0x54f5('0x1e')]);if(_0x12fe98['name']){delete _0x12fe98[_0x54f5('0x1f')];}_0x4b2fa0[_0x54f5('0xb')](_0x319d57)['send'](_0x12fe98);};}exports[_0x54f5('0x20')]=function(_0x5e8815,_0x180bec){var _0x3be1cc={},_0x15676e={},_0x4dfceb={'count':0x0,'rows':[]};var _0x114242=_[_0x54f5('0x21')](db[_0x54f5('0x22')]['rawAttributes'],function(_0x30e915){return{'name':_0x30e915[_0x54f5('0x23')],'type':_0x30e915[_0x54f5('0x24')][_0x54f5('0x25')]};});_0x15676e[_0x54f5('0x26')]=_[_0x54f5('0x21')](_0x114242,_0x54f5('0x1f'));_0x15676e[_0x54f5('0x27')]=_['keys'](_0x5e8815['query']);_0x15676e[_0x54f5('0x28')]=_['intersection'](_0x15676e[_0x54f5('0x26')],_0x15676e['query']);_0x3be1cc[_0x54f5('0x29')]=_[_0x54f5('0x2a')](_0x15676e[_0x54f5('0x26')],qs['fields'](_0x5e8815['query']['fields']));_0x3be1cc[_0x54f5('0x29')]=_0x3be1cc[_0x54f5('0x29')][_0x54f5('0x2b')]?_0x3be1cc[_0x54f5('0x29')]:_0x15676e[_0x54f5('0x26')];if(!_0x5e8815[_0x54f5('0x27')]['hasOwnProperty']('nolimit')){_0x3be1cc[_0x54f5('0xf')]=qs[_0x54f5('0xf')](_0x5e8815[_0x54f5('0x27')]['limit']);_0x3be1cc[_0x54f5('0xd')]=qs['offset'](_0x5e8815[_0x54f5('0x27')][_0x54f5('0xd')]);}_0x3be1cc[_0x54f5('0x2c')]=qs[_0x54f5('0x2d')](_0x5e8815[_0x54f5('0x27')][_0x54f5('0x2d')]);_0x3be1cc['where']=qs[_0x54f5('0x28')](_[_0x54f5('0x2e')](_0x5e8815[_0x54f5('0x27')],_0x15676e['filters']),_0x114242);if(_0x5e8815[_0x54f5('0x27')]['filter']){_0x3be1cc['where']=_[_0x54f5('0x2f')](_0x3be1cc['where'],{'$or':_['map'](_0x114242,function(_0x4b0f48){if(_0x4b0f48[_0x54f5('0x24')]!==_0x54f5('0x30')){var _0x25b5af={};_0x25b5af[_0x4b0f48[_0x54f5('0x1f')]]={'$like':'%'+_0x5e8815['query']['filter']+'%'};return _0x25b5af;}})});}_0x3be1cc=_['merge']({},_0x3be1cc,_0x5e8815[_0x54f5('0x31')]);var _0x539763={'where':_0x3be1cc['where']};return db[_0x54f5('0x22')][_0x54f5('0x10')](_0x539763)[_0x54f5('0x15')](function(_0x95706b){_0x4dfceb[_0x54f5('0x10')]=_0x95706b;if(_0x5e8815[_0x54f5('0x27')][_0x54f5('0x32')]){_0x3be1cc[_0x54f5('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x54f5('0x34')](_0x3be1cc);})['then'](function(_0x1f4d57){_0x4dfceb[_0x54f5('0x35')]=_0x1f4d57;return _0x4dfceb;})['then'](respondWithFilteredResult(_0x180bec,_0x3be1cc))[_0x54f5('0x36')](handleError(_0x180bec,null));};exports['show']=function(_0x4ded92,_0x169b9e){var _0x13541d={'raw':![],'where':{'id':_0x4ded92['params']['id']}},_0x67e6df={};_0x67e6df[_0x54f5('0x26')]=_[_0x54f5('0x37')](db[_0x54f5('0x22')]['rawAttributes']);_0x67e6df[_0x54f5('0x27')]=_[_0x54f5('0x37')](_0x4ded92[_0x54f5('0x27')]);_0x67e6df['filters']=_[_0x54f5('0x2a')](_0x67e6df[_0x54f5('0x26')],_0x67e6df['query']);_0x13541d[_0x54f5('0x29')]=_['intersection'](_0x67e6df['model'],qs[_0x54f5('0x38')](_0x4ded92[_0x54f5('0x27')][_0x54f5('0x38')]));_0x13541d['attributes']=_0x13541d[_0x54f5('0x29')][_0x54f5('0x2b')]?_0x13541d['attributes']:_0x67e6df[_0x54f5('0x26')];if(_0x4ded92[_0x54f5('0x27')][_0x54f5('0x32')]){_0x13541d[_0x54f5('0x33')]=[{'all':!![]}];}_0x13541d=_[_0x54f5('0x2f')]({},_0x13541d,_0x4ded92['options']);return db[_0x54f5('0x22')]['find'](_0x13541d)[_0x54f5('0x15')](handleEntityNotFound(_0x169b9e,null))['then'](respondWithResult(_0x169b9e,null))[_0x54f5('0x36')](handleError(_0x169b9e,null));};exports[_0x54f5('0x39')]=function(_0x562f48,_0x2be8d0){return db[_0x54f5('0x22')][_0x54f5('0x39')](_0x562f48['body'],{})['then'](function(_0x2367f1){var _0x42b002=_0x562f48[_0x54f5('0x3a')][_0x54f5('0x16')]({'plain':!![]});if(!_0x42b002)throw new Error(_0x54f5('0x3b'));if(_0x42b002[_0x54f5('0x3c')]===_0x54f5('0x3a')){var _0xcc5d51=_0x2367f1[_0x54f5('0x16')]({'plain':!![]});var _0x55b36b=_0x54f5('0x3d');return db[_0x54f5('0x3e')][_0x54f5('0x3f')]({'where':{'name':_0x55b36b,'userProfileId':_0x42b002[_0x54f5('0x40')]},'raw':!![]})[_0x54f5('0x15')](function(_0x16fa40){if(_0x16fa40&&_0x16fa40[_0x54f5('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0xcc5d51[_0x54f5('0x1f')],'resourceId':_0xcc5d51['id'],'type':_0x16fa40[_0x54f5('0x1f')],'sectionId':_0x16fa40['id']},{})['then'](function(){return _0x2367f1;});}else{return _0x2367f1;}})[_0x54f5('0x36')](function(_0x2dd1d9){logger[_0x54f5('0x1d')](_0x54f5('0x42'),_0x2dd1d9);throw _0x2dd1d9;});}return _0x2367f1;})[_0x54f5('0x15')](respondWithResult(_0x2be8d0,0xc9))[_0x54f5('0x36')](handleError(_0x2be8d0,null));};exports[_0x54f5('0x13')]=function(_0x5d3d18,_0x2e4451){if(_0x5d3d18[_0x54f5('0x43')]['id']){delete _0x5d3d18[_0x54f5('0x43')]['id'];}return db[_0x54f5('0x22')]['find']({'where':{'id':_0x5d3d18[_0x54f5('0x44')]['id']}})[_0x54f5('0x15')](handleEntityNotFound(_0x2e4451,null))['then'](saveUpdates(_0x5d3d18[_0x54f5('0x43')],null))[_0x54f5('0x15')](function(_0x1fbe53){if(!_0x1fbe53)return;var _0x31d902=_0x1fbe53['get']({'plain':!![]});return _0x31d902;})[_0x54f5('0x15')](function(_0x517bda){var _0x55f7a4=new Redis(config[_0x54f5('0x7')]);_0x55f7a4[_0x54f5('0x18')](_0x54f5('0x19'),JSON[_0x54f5('0x1a')](_[_0x54f5('0x2e')](_0x517bda,['id',_0x54f5('0x1f'),'production'])));return _0x517bda;})[_0x54f5('0x15')](respondWithResult(_0x2e4451,null))[_0x54f5('0x36')](handleError(_0x2e4451,null));};exports[_0x54f5('0x14')]=function(_0x2afe7a,_0x30a253){return db[_0x54f5('0x22')][_0x54f5('0x3f')]({'where':{'id':_0x2afe7a[_0x54f5('0x44')]['id']}})[_0x54f5('0x15')](handleEntityNotFound(_0x30a253,null))[_0x54f5('0x15')](removeEntity(_0x30a253,null))[_0x54f5('0x36')](handleError(_0x30a253,null));}; \ No newline at end of file +var _0xbe9c=['stringify','end','sendStatus','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','production','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','get','SquareProjects','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe9c,0xb1));var _0xcbe9=function(_0x2b6c12,_0x251158){_0x2b6c12=_0x2b6c12-0x0;var _0x395413=_0xbe9c[_0x2b6c12];return _0x395413;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xcbe9('0x0'));var logger=require(_0xcbe9('0x1'))(_0xcbe9('0x2'));var config=require('../../config/environment');var db=require(_0xcbe9('0x3'))['db'];config[_0xcbe9('0x4')]=_[_0xcbe9('0x5')](config[_0xcbe9('0x4')],{'host':_0xcbe9('0x6'),'port':0x18eb});var socket=require(_0xcbe9('0x7'))(new Redis(config[_0xcbe9('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x50cc3d,_0x4b1f5d){_0x4b1f5d=_0x4b1f5d||0xc8;return function(_0x3fb030){if(_0x3fb030){return _0x50cc3d['status'](_0x4b1f5d)['json'](_0x3fb030);}};}function respondWithFilteredResult(_0x4bd55e,_0x49ee73){return function(_0x111350){if(_0x111350){var _0x42b1fb=typeof _0x49ee73[_0xcbe9('0x8')]===_0xcbe9('0x9')&&typeof _0x49ee73[_0xcbe9('0xa')]===_0xcbe9('0x9');var _0x367ecd=_0x111350[_0xcbe9('0xb')];var _0x4fd5c4=_0x42b1fb?0x0:_0x49ee73[_0xcbe9('0x8')];var _0x1cd157=_0x42b1fb?_0x111350[_0xcbe9('0xb')]:_0x49ee73[_0xcbe9('0x8')]+_0x49ee73[_0xcbe9('0xa')];var _0xdfc418;if(_0x1cd157>=_0x367ecd){_0x1cd157=_0x367ecd;_0xdfc418=0xc8;}else{_0xdfc418=0xce;}_0x4bd55e[_0xcbe9('0xc')](_0xdfc418);return _0x4bd55e[_0xcbe9('0xd')](_0xcbe9('0xe'),_0x4fd5c4+'-'+_0x1cd157+'/'+_0x367ecd)[_0xcbe9('0xf')](_0x111350);}return null;};}function saveUpdates(_0x19309c){return function(_0x40df5f){if(_0x40df5f){return _0x40df5f[_0xcbe9('0x10')](_0x19309c)['then'](function(_0x3a5b9f){return _0x3a5b9f;});}return null;};}function removeEntity(_0x1a624c){return function(_0x264e27){if(_0x264e27){return _0x264e27[_0xcbe9('0x11')]()['then'](function(){var _0x2c0b44=_0x264e27[_0xcbe9('0x12')]({'plain':!![]});var _0x1a63a3=_0xcbe9('0x13');return db['UserProfileResource'][_0xcbe9('0x11')]({'where':{'type':_0x1a63a3,'resourceId':_0x2c0b44['id']}})[_0xcbe9('0x14')](function(){return _0x264e27;});})[_0xcbe9('0x14')](function(){var _0x15a0b4=new Redis(config[_0xcbe9('0x4')]);_0x15a0b4['publish']('agi',JSON[_0xcbe9('0x15')]({'id':_0x264e27['id'],'deleted':!![]}));})[_0xcbe9('0x14')](function(){_0x1a624c['status'](0xcc)[_0xcbe9('0x16')]();});}};}function handleEntityNotFound(_0x7fc22e){return function(_0x4cc8b7){if(!_0x4cc8b7){_0x7fc22e[_0xcbe9('0x17')](0x194);}return _0x4cc8b7;};}function handleError(_0x5b4d48,_0x414b7d){_0x414b7d=_0x414b7d||0x1f4;return function(_0x261fc7){logger[_0xcbe9('0x18')](_0x261fc7[_0xcbe9('0x19')]);if(_0x261fc7['name']){delete _0x261fc7['name'];}_0x5b4d48[_0xcbe9('0xc')](_0x414b7d)[_0xcbe9('0x1a')](_0x261fc7);};}exports[_0xcbe9('0x1b')]=function(_0x5eadfc,_0x1ef2da){var _0x3a44cd={},_0x3205a6={},_0x53be61={'count':0x0,'rows':[]};var _0x5d234c=_[_0xcbe9('0x1c')](db[_0xcbe9('0x1d')][_0xcbe9('0x1e')],function(_0x21ebe5){return{'name':_0x21ebe5[_0xcbe9('0x1f')],'type':_0x21ebe5[_0xcbe9('0x20')]['key']};});_0x3205a6[_0xcbe9('0x21')]=_[_0xcbe9('0x1c')](_0x5d234c,_0xcbe9('0x22'));_0x3205a6['query']=_[_0xcbe9('0x23')](_0x5eadfc[_0xcbe9('0x24')]);_0x3205a6['filters']=_[_0xcbe9('0x25')](_0x3205a6[_0xcbe9('0x21')],_0x3205a6[_0xcbe9('0x24')]);_0x3a44cd[_0xcbe9('0x26')]=_[_0xcbe9('0x25')](_0x3205a6['model'],qs['fields'](_0x5eadfc[_0xcbe9('0x24')][_0xcbe9('0x27')]));_0x3a44cd[_0xcbe9('0x26')]=_0x3a44cd[_0xcbe9('0x26')][_0xcbe9('0x28')]?_0x3a44cd[_0xcbe9('0x26')]:_0x3205a6[_0xcbe9('0x21')];if(!_0x5eadfc[_0xcbe9('0x24')][_0xcbe9('0x29')](_0xcbe9('0x2a'))){_0x3a44cd[_0xcbe9('0xa')]=qs[_0xcbe9('0xa')](_0x5eadfc['query'][_0xcbe9('0xa')]);_0x3a44cd[_0xcbe9('0x8')]=qs[_0xcbe9('0x8')](_0x5eadfc[_0xcbe9('0x24')][_0xcbe9('0x8')]);}_0x3a44cd[_0xcbe9('0x2b')]=qs[_0xcbe9('0x2c')](_0x5eadfc[_0xcbe9('0x24')][_0xcbe9('0x2c')]);_0x3a44cd[_0xcbe9('0x2d')]=qs[_0xcbe9('0x2e')](_[_0xcbe9('0x2f')](_0x5eadfc[_0xcbe9('0x24')],_0x3205a6[_0xcbe9('0x2e')]),_0x5d234c);if(_0x5eadfc[_0xcbe9('0x24')]['filter']){_0x3a44cd[_0xcbe9('0x2d')]=_[_0xcbe9('0x30')](_0x3a44cd[_0xcbe9('0x2d')],{'$or':_[_0xcbe9('0x1c')](_0x5d234c,function(_0x89405a){if(_0x89405a['type']!=='VIRTUAL'){var _0x55fe4d={};_0x55fe4d[_0x89405a[_0xcbe9('0x22')]]={'$like':'%'+_0x5eadfc[_0xcbe9('0x24')][_0xcbe9('0x31')]+'%'};return _0x55fe4d;}})});}_0x3a44cd=_[_0xcbe9('0x30')]({},_0x3a44cd,_0x5eadfc[_0xcbe9('0x32')]);var _0x5cce08={'where':_0x3a44cd['where']};return db[_0xcbe9('0x1d')][_0xcbe9('0xb')](_0x5cce08)['then'](function(_0x5302a7){_0x53be61[_0xcbe9('0xb')]=_0x5302a7;if(_0x5eadfc['query']['includeAll']){_0x3a44cd[_0xcbe9('0x33')]=[{'all':!![]}];}return db[_0xcbe9('0x1d')][_0xcbe9('0x34')](_0x3a44cd);})[_0xcbe9('0x14')](function(_0x4c0016){_0x53be61['rows']=_0x4c0016;return _0x53be61;})[_0xcbe9('0x14')](respondWithFilteredResult(_0x1ef2da,_0x3a44cd))[_0xcbe9('0x35')](handleError(_0x1ef2da,null));};exports[_0xcbe9('0x36')]=function(_0x38fd58,_0x4f0ca2){var _0x3664e6={'raw':![],'where':{'id':_0x38fd58[_0xcbe9('0x37')]['id']}},_0x99a658={};_0x99a658[_0xcbe9('0x21')]=_[_0xcbe9('0x23')](db[_0xcbe9('0x1d')][_0xcbe9('0x1e')]);_0x99a658[_0xcbe9('0x24')]=_[_0xcbe9('0x23')](_0x38fd58[_0xcbe9('0x24')]);_0x99a658[_0xcbe9('0x2e')]=_[_0xcbe9('0x25')](_0x99a658[_0xcbe9('0x21')],_0x99a658[_0xcbe9('0x24')]);_0x3664e6['attributes']=_[_0xcbe9('0x25')](_0x99a658[_0xcbe9('0x21')],qs['fields'](_0x38fd58[_0xcbe9('0x24')][_0xcbe9('0x27')]));_0x3664e6[_0xcbe9('0x26')]=_0x3664e6[_0xcbe9('0x26')]['length']?_0x3664e6['attributes']:_0x99a658[_0xcbe9('0x21')];if(_0x38fd58[_0xcbe9('0x24')][_0xcbe9('0x38')]){_0x3664e6[_0xcbe9('0x33')]=[{'all':!![]}];}_0x3664e6=_[_0xcbe9('0x30')]({},_0x3664e6,_0x38fd58[_0xcbe9('0x32')]);return db[_0xcbe9('0x1d')][_0xcbe9('0x39')](_0x3664e6)['then'](handleEntityNotFound(_0x4f0ca2,null))[_0xcbe9('0x14')](respondWithResult(_0x4f0ca2,null))[_0xcbe9('0x35')](handleError(_0x4f0ca2,null));};exports[_0xcbe9('0x3a')]=function(_0x16f1f7,_0x3e2fbd){return db['SquareProject'][_0xcbe9('0x3a')](_0x16f1f7[_0xcbe9('0x3b')],{})[_0xcbe9('0x14')](function(_0x1fc266){var _0x1deed5=_0x16f1f7['user'][_0xcbe9('0x12')]({'plain':!![]});if(!_0x1deed5)throw new Error(_0xcbe9('0x3c'));if(_0x1deed5[_0xcbe9('0x3d')]===_0xcbe9('0x3e')){var _0x4ccf2b=_0x1fc266[_0xcbe9('0x12')]({'plain':!![]});var _0x18dbe3='SquareProjects';return db[_0xcbe9('0x3f')]['find']({'where':{'name':_0x18dbe3,'userProfileId':_0x1deed5['userProfileId']},'raw':!![]})['then'](function(_0x584d02){if(_0x584d02&&_0x584d02[_0xcbe9('0x40')]===0x0){return db['UserProfileResource'][_0xcbe9('0x3a')]({'name':_0x4ccf2b[_0xcbe9('0x22')],'resourceId':_0x4ccf2b['id'],'type':_0x584d02[_0xcbe9('0x22')],'sectionId':_0x584d02['id']},{})[_0xcbe9('0x14')](function(){return _0x1fc266;});}else{return _0x1fc266;}})[_0xcbe9('0x35')](function(_0x474dc5){logger[_0xcbe9('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474dc5);throw _0x474dc5;});}return _0x1fc266;})['then'](respondWithResult(_0x3e2fbd,0xc9))['catch'](handleError(_0x3e2fbd,null));};exports[_0xcbe9('0x10')]=function(_0x390d4c,_0x56ab51){if(_0x390d4c[_0xcbe9('0x3b')]['id']){delete _0x390d4c[_0xcbe9('0x3b')]['id'];}return db[_0xcbe9('0x1d')]['find']({'where':{'id':_0x390d4c[_0xcbe9('0x37')]['id']}})['then'](handleEntityNotFound(_0x56ab51,null))[_0xcbe9('0x14')](saveUpdates(_0x390d4c[_0xcbe9('0x3b')],null))['then'](function(_0xea49ed){if(!_0xea49ed)return;var _0x1c787b=_0xea49ed['get']({'plain':!![]});return _0x1c787b;})[_0xcbe9('0x14')](function(_0x5be029){var _0x2211e7=new Redis(config[_0xcbe9('0x4')]);_0x2211e7['publish']('agi',JSON[_0xcbe9('0x15')](_[_0xcbe9('0x2f')](_0x5be029,['id',_0xcbe9('0x22'),_0xcbe9('0x41')])));return _0x5be029;})[_0xcbe9('0x14')](respondWithResult(_0x56ab51,null))['catch'](handleError(_0x56ab51,null));};exports[_0xcbe9('0x11')]=function(_0x3f72da,_0x5239c8){return db[_0xcbe9('0x1d')]['find']({'where':{'id':_0x3f72da[_0xcbe9('0x37')]['id']}})['then'](handleEntityNotFound(_0x5239c8,null))['then'](removeEntity(_0x5239c8,null))[_0xcbe9('0x35')](handleError(_0x5239c8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index eecbbf0..5b84a53 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 _0x0f31=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x3d16c7,_0xd9ff64){var _0x5e7214=function(_0x5aaffd){while(--_0x5aaffd){_0x3d16c7['push'](_0x3d16c7['shift']());}};_0x5e7214(++_0xd9ff64);}(_0x0f31,0x1bf));var _0x10f3=function(_0x195b14,_0x2f8fda){_0x195b14=_0x195b14-0x0;var _0x378f4b=_0x0f31[_0x195b14];return _0x378f4b;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x10f3('0x0'))['db'][_0x10f3('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x10f3('0x2')](0x0);var events={'afterCreate':_0x10f3('0x3'),'afterUpdate':_0x10f3('0x4'),'afterDestroy':_0x10f3('0x5')};function emitEvent(_0x4d4f7c){return function(_0x1af92a,_0x5c5d22,_0x1c3c45){SquareProjectEvents[_0x10f3('0x6')](_0x4d4f7c+':'+_0x1af92a['id'],_0x1af92a);SquareProjectEvents[_0x10f3('0x6')](_0x4d4f7c,_0x1af92a);_0x1c3c45(null);};}for(var e in events){if(events[_0x10f3('0x7')](e)){var event=events[e];SquareProject[_0x10f3('0x8')](e,emitEvent(event));}}module[_0x10f3('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xda7a=['hasOwnProperty','exports','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0xfc600d,_0x42c951){var _0xae26d6=function(_0x46dbd3){while(--_0x46dbd3){_0xfc600d['push'](_0xfc600d['shift']());}};_0xae26d6(++_0x42c951);}(_0xda7a,0x1e8));var _0xada7=function(_0x59653d,_0x325aca){_0x59653d=_0x59653d-0x0;var _0x2d857d=_0xda7a[_0x59653d];return _0x2d857d;};'use strict';var EventEmitter=require(_0xada7('0x0'));var SquareProject=require(_0xada7('0x1'))['db'][_0xada7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xada7('0x3'),'afterUpdate':_0xada7('0x4'),'afterDestroy':_0xada7('0x5')};function emitEvent(_0x273b0e){return function(_0x4092cd,_0x132b2c,_0x45b233){SquareProjectEvents[_0xada7('0x6')](_0x273b0e+':'+_0x4092cd['id'],_0x4092cd);SquareProjectEvents[_0xada7('0x6')](_0x273b0e,_0x4092cd);_0x45b233(null);};}for(var e in events){if(events[_0xada7('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xada7('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index fbff989..267acd2 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 _0xc227=['../../config/logger','bluebird','request-promise','path','rimraf','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x1c84d1,_0x59ae04){var _0x2ac1ca=function(_0x3be10b){while(--_0x3be10b){_0x1c84d1['push'](_0x1c84d1['shift']());}};_0x2ac1ca(++_0x59ae04);}(_0xc227,0x179));var _0x7c22=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xc227[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7c22('0x0'))('api');var moment=require('moment');var BPromise=require(_0x7c22('0x1'));var rp=require(_0x7c22('0x2'));var fs=require('fs');var path=require(_0x7c22('0x3'));var rimraf=require(_0x7c22('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x7c22('0x5')]=function(_0x550592,_0x2d5c91){return _0x550592[_0x7c22('0x6')]('SquareProject',attributes,{'tableName':_0x7c22('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ae31,_0x1361f8,_0x15b8d0){if(_0x15ae31[_0x7c22('0x8')]('preproduction')){_0x15ae31['savedAt']=moment()[_0x7c22('0x9')](_0x7c22('0xa'));}if(_0x15ae31[_0x7c22('0x8')](_0x7c22('0xb'))){_0x15ae31[_0x7c22('0xc')]=moment()[_0x7c22('0x9')](_0x7c22('0xa'));}_0x15b8d0(null,_0x15ae31);}}});}; \ No newline at end of file +var _0xc263=['util','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash'];(function(_0x35cf54,_0x3a5c53){var _0x1f6b70=function(_0x44440c){while(--_0x44440c){_0x35cf54['push'](_0x35cf54['shift']());}};_0x1f6b70(++_0x3a5c53);}(_0xc263,0x179));var _0x3c26=function(_0x5c4a51,_0x4aef65){_0x5c4a51=_0x5c4a51-0x0;var _0x223393=_0xc263[_0x5c4a51];return _0x223393;};'use strict';var _=require(_0x3c26('0x0'));var util=require(_0x3c26('0x1'));var logger=require('../../config/logger')(_0x3c26('0x2'));var moment=require(_0x3c26('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c26('0x4'));var fs=require('fs');var path=require(_0x3c26('0x5'));var rimraf=require(_0x3c26('0x6'));var config=require(_0x3c26('0x7'));var attributes=require(_0x3c26('0x8'));module['exports']=function(_0x13a1d9,_0xc9af50){return _0x13a1d9[_0x3c26('0x9')](_0x3c26('0xa'),attributes,{'tableName':_0x3c26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x106c08,_0x500e48,_0x4ad48e){if(_0x106c08[_0x3c26('0xc')](_0x3c26('0xd'))){_0x106c08[_0x3c26('0xe')]=moment()[_0x3c26('0xf')](_0x3c26('0x10'));}if(_0x106c08['changed']('production')){_0x106c08[_0x3c26('0x11')]=moment()['format'](_0x3c26('0x10'));}_0x4ad48e(null,_0x106c08);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index dd2d6f8..31a309b 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 _0x029f=['model','then','info','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','raw','where','limit','include','map','attributes'];(function(_0x1f2efd,_0x3d1d9e){var _0x19d2a8=function(_0x5b60aa){while(--_0x5b60aa){_0x1f2efd['push'](_0x1f2efd['shift']());}};_0x19d2a8(++_0x3d1d9e);}(_0x029f,0xcf));var _0xf029=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x029f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf029('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf029('0x1'));var config=require(_0xf029('0x2'));config[_0xf029('0x3')]=_[_0xf029('0x4')](config['redis'],{'host':_0xf029('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf029('0x3')]));require(_0xf029('0x6'))[_0xf029('0x7')](socket);exports['GetSquareProjects']=function(_0x479a37){var _0x1cb24f=this;return new Promise(function(_0x3c38f2,_0x316f94){return db[_0xf029('0x8')][_0xf029('0x9')]({'raw':_0x479a37[_0xf029('0xa')]?_0x479a37[_0xf029('0xa')][_0xf029('0xb')]===undefined?!![]:![]:!![],'where':_0x479a37[_0xf029('0xa')]?_0x479a37[_0xf029('0xa')][_0xf029('0xc')]||null:null,'attributes':_0x479a37['options']?_0x479a37[_0xf029('0xa')]['attributes']||null:null,'limit':_0x479a37[_0xf029('0xa')]?_0x479a37['options'][_0xf029('0xd')]||null:null,'include':_0x479a37['options']?_0x479a37['options'][_0xf029('0xe')]?_[_0xf029('0xf')](_0x479a37[_0xf029('0xa')][_0xf029('0xe')],function(_0xae3b0e){return{'model':db[_0xae3b0e['model']],'as':_0xae3b0e['as'],'attributes':_0xae3b0e[_0xf029('0x10')],'include':_0xae3b0e[_0xf029('0xe')]?_[_0xf029('0xf')](_0xae3b0e['include'],function(_0x1314a5){return{'model':db[_0x1314a5[_0xf029('0x11')]],'as':_0x1314a5['as'],'attributes':_0x1314a5[_0xf029('0x10')],'include':_0x1314a5[_0xf029('0xe')]?_[_0xf029('0xf')](_0x1314a5['include'],function(_0x5c848c){return{'model':db[_0x5c848c[_0xf029('0x11')]],'as':_0x5c848c['as'],'attributes':_0x5c848c[_0xf029('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf029('0x12')](function(_0x258d5c){logger[_0xf029('0x13')](_0xf029('0x14'),_0x479a37);logger[_0xf029('0x15')](_0xf029('0x14'),_0x479a37,JSON[_0xf029('0x16')](_0x258d5c));_0x3c38f2(_0x258d5c);})[_0xf029('0x17')](function(_0x17d38e){logger[_0xf029('0x18')](_0xf029('0x14'),_0x17d38e[_0xf029('0x19')],_0x479a37);_0x316f94(_0x1cb24f[_0xf029('0x18')](0x1f4,_0x17d38e[_0xf029('0x19')]));});});};exports[_0xf029('0x1a')]=function(_0x4be501){var _0x136cf6=this;return new Promise(function(_0x135228,_0x83d1f9){return db['SquareProject'][_0xf029('0x1b')]({'raw':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')][_0xf029('0xc')]||null:null,'attributes':_0x4be501[_0xf029('0xa')]?_0x4be501['options'][_0xf029('0x10')]||null:null,'include':_0x4be501[_0xf029('0xa')]?_0x4be501[_0xf029('0xa')][_0xf029('0xe')]?_[_0xf029('0xf')](_0x4be501[_0xf029('0xa')][_0xf029('0xe')],function(_0xbf1601){return{'model':db[_0xbf1601['model']],'as':_0xbf1601['as'],'attributes':_0xbf1601[_0xf029('0x10')],'include':_0xbf1601[_0xf029('0xe')]?_[_0xf029('0xf')](_0xbf1601[_0xf029('0xe')],function(_0x2559f0){return{'model':db[_0x2559f0[_0xf029('0x11')]],'as':_0x2559f0['as'],'attributes':_0x2559f0[_0xf029('0x10')],'include':_0x2559f0['include']?_[_0xf029('0xf')](_0x2559f0[_0xf029('0xe')],function(_0x3f90b0){return{'model':db[_0x3f90b0[_0xf029('0x11')]],'as':_0x3f90b0['as'],'attributes':_0x3f90b0[_0xf029('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf029('0x12')](function(_0x49ce0b){logger['info'](_0xf029('0x1a'),_0x4be501);logger[_0xf029('0x15')](_0xf029('0x1a'),_0x4be501,JSON[_0xf029('0x16')](_0x49ce0b));_0x135228(_0x49ce0b);})['catch'](function(_0x3a8176){logger[_0xf029('0x18')](_0xf029('0x1a'),_0x3a8176[_0xf029('0x19')],_0x4be501);_0x83d1f9(_0x136cf6[_0xf029('0x18')](0x1f4,_0x3a8176[_0xf029('0x19')]));});});}; \ No newline at end of file +var _0x26d9=['model','then','info','debug','stringify','catch','error','message','find','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1b98a9,_0xe87929){var _0x2bf1ca=function(_0x3d44b3){while(--_0x3d44b3){_0x1b98a9['push'](_0x1b98a9['shift']());}};_0x2bf1ca(++_0xe87929);}(_0x26d9,0x168));var _0x926d=function(_0x32254d,_0x26e475){_0x32254d=_0x32254d-0x0;var _0xe04654=_0x26d9[_0x32254d];return _0xe04654;};'use strict';var _=require('lodash');var Redis=require(_0x926d('0x0'));var db=require(_0x926d('0x1'))['db'];var logger=require('../../config/logger')(_0x926d('0x2'));var config=require(_0x926d('0x3'));config[_0x926d('0x4')]=_[_0x926d('0x5')](config[_0x926d('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x926d('0x6'))(new Redis(config[_0x926d('0x4')]));require('./squareProject.socket')[_0x926d('0x7')](socket);exports[_0x926d('0x8')]=function(_0x29aeae){var _0x5f1e6e=this;return new Promise(function(_0x302a33,_0x30dd63){return db[_0x926d('0x9')][_0x926d('0xa')]({'raw':_0x29aeae[_0x926d('0xb')]?_0x29aeae['options'][_0x926d('0xc')]===undefined?!![]:![]:!![],'where':_0x29aeae[_0x926d('0xb')]?_0x29aeae[_0x926d('0xb')][_0x926d('0xd')]||null:null,'attributes':_0x29aeae[_0x926d('0xb')]?_0x29aeae[_0x926d('0xb')][_0x926d('0xe')]||null:null,'limit':_0x29aeae[_0x926d('0xb')]?_0x29aeae[_0x926d('0xb')][_0x926d('0xf')]||null:null,'include':_0x29aeae[_0x926d('0xb')]?_0x29aeae['options'][_0x926d('0x10')]?_[_0x926d('0x11')](_0x29aeae[_0x926d('0xb')][_0x926d('0x10')],function(_0x2f31a7){return{'model':db[_0x2f31a7[_0x926d('0x12')]],'as':_0x2f31a7['as'],'attributes':_0x2f31a7[_0x926d('0xe')],'include':_0x2f31a7['include']?_[_0x926d('0x11')](_0x2f31a7[_0x926d('0x10')],function(_0xd5dc3c){return{'model':db[_0xd5dc3c[_0x926d('0x12')]],'as':_0xd5dc3c['as'],'attributes':_0xd5dc3c[_0x926d('0xe')],'include':_0xd5dc3c[_0x926d('0x10')]?_[_0x926d('0x11')](_0xd5dc3c[_0x926d('0x10')],function(_0x5242ea){return{'model':db[_0x5242ea[_0x926d('0x12')]],'as':_0x5242ea['as'],'attributes':_0x5242ea[_0x926d('0xe')]};}):[]};}):[]};}):[]:[]})[_0x926d('0x13')](function(_0x579c87){logger[_0x926d('0x14')](_0x926d('0x8'),_0x29aeae);logger[_0x926d('0x15')](_0x926d('0x8'),_0x29aeae,JSON[_0x926d('0x16')](_0x579c87));_0x302a33(_0x579c87);})[_0x926d('0x17')](function(_0x393b55){logger[_0x926d('0x18')]('GetSquareProjects',_0x393b55[_0x926d('0x19')],_0x29aeae);_0x30dd63(_0x5f1e6e[_0x926d('0x18')](0x1f4,_0x393b55['message']));});});};exports['ShowSquareProject']=function(_0x35a53c){var _0x1f41da=this;return new Promise(function(_0x3d9718,_0x274487){return db[_0x926d('0x9')][_0x926d('0x1a')]({'raw':_0x35a53c[_0x926d('0xb')]?_0x35a53c[_0x926d('0xb')][_0x926d('0xc')]===undefined?!![]:![]:!![],'where':_0x35a53c[_0x926d('0xb')]?_0x35a53c[_0x926d('0xb')][_0x926d('0xd')]||null:null,'attributes':_0x35a53c[_0x926d('0xb')]?_0x35a53c['options'][_0x926d('0xe')]||null:null,'include':_0x35a53c[_0x926d('0xb')]?_0x35a53c[_0x926d('0xb')][_0x926d('0x10')]?_[_0x926d('0x11')](_0x35a53c[_0x926d('0xb')][_0x926d('0x10')],function(_0x4919c4){return{'model':db[_0x4919c4[_0x926d('0x12')]],'as':_0x4919c4['as'],'attributes':_0x4919c4[_0x926d('0xe')],'include':_0x4919c4[_0x926d('0x10')]?_[_0x926d('0x11')](_0x4919c4['include'],function(_0x1be035){return{'model':db[_0x1be035[_0x926d('0x12')]],'as':_0x1be035['as'],'attributes':_0x1be035[_0x926d('0xe')],'include':_0x1be035[_0x926d('0x10')]?_[_0x926d('0x11')](_0x1be035[_0x926d('0x10')],function(_0x3d8504){return{'model':db[_0x3d8504[_0x926d('0x12')]],'as':_0x3d8504['as'],'attributes':_0x3d8504[_0x926d('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8e3ffb){logger[_0x926d('0x14')]('ShowSquareProject',_0x35a53c);logger['debug']('ShowSquareProject',_0x35a53c,JSON[_0x926d('0x16')](_0x8e3ffb));_0x3d9718(_0x8e3ffb);})[_0x926d('0x17')](function(_0x317753){logger[_0x926d('0x18')]('ShowSquareProject',_0x317753[_0x926d('0x19')],_0x35a53c);_0x274487(_0x1f41da[_0x926d('0x18')](0x1f4,_0x317753[_0x926d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 938a0d0..bd86c8c 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 _0x876e=['squareProject:','remove','emit','register','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x876e,0x17d));var _0xe876=function(_0x488884,_0x30f62f){_0x488884=_0x488884-0x0;var _0x5cccc7=_0x876e[_0x488884];return _0x5cccc7;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xe876('0x0'),'update'];function createListener(_0x235788,_0x1db281){return function(_0x308795){_0x1db281[_0xe876('0x1')](_0x235788,_0x308795);};}function removeListener(_0x17d094,_0x1ce745){return function(){SquareProjectEvents['removeListener'](_0x17d094,_0x1ce745);};}exports[_0xe876('0x2')]=function(_0x45ab9c){for(var _0x2182cc=0x0,_0x2f05eb=events[_0xe876('0x3')];_0x2182cc<_0x2f05eb;_0x2182cc++){var _0x14177f=events[_0x2182cc];var _0x2b114c=createListener(_0xe876('0x4')+_0x14177f,_0x45ab9c);SquareProjectEvents['on'](_0x14177f,_0x2b114c);}}; \ No newline at end of file +var _0x1267=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x498834,_0x57c709){var _0x2fc7ef=function(_0x393556){while(--_0x393556){_0x498834['push'](_0x498834['shift']());}};_0x2fc7ef(++_0x57c709);}(_0x1267,0x1dc));var _0x7126=function(_0xe4e251,_0x6829b9){_0xe4e251=_0xe4e251-0x0;var _0x3aae3e=_0x1267[_0xe4e251];return _0x3aae3e;};'use strict';var SquareProjectEvents=require(_0x7126('0x0'));var events=[_0x7126('0x1'),_0x7126('0x2'),_0x7126('0x3')];function createListener(_0x1d6075,_0x5b863f){return function(_0x8f1b10){_0x5b863f[_0x7126('0x4')](_0x1d6075,_0x8f1b10);};}function removeListener(_0x572aae,_0x5cec27){return function(){SquareProjectEvents[_0x7126('0x5')](_0x572aae,_0x5cec27);};}exports[_0x7126('0x6')]=function(_0x52e412){for(var _0x5f564a=0x0,_0x1d0641=events[_0x7126('0x7')];_0x5f564a<_0x1d0641;_0x5f564a++){var _0x2af2e2=events[_0x5f564a];var _0x357c15=createListener(_0x7126('0x8')+_0x2af2e2,_0x52e412);SquareProjectEvents['on'](_0x2af2e2,_0x357c15);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f05b5d4..6411f8e 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x2245b8,_0x5284fc){var _0x407de6=function(_0x4b470e){while(--_0x4b470e){_0x2245b8['push'](_0x2245b8['shift']());}};_0x407de6(++_0x5284fc);}(_0x5fab,0x177));var _0xb5fa=function(_0x46827d,_0x1c6b7a){_0x46827d=_0x46827d-0x0;var _0x38d03e=_0x5fab[_0x46827d];return _0x38d03e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x16e2a1,_0x20a360){var _0xf426be=function(_0x3443bd){while(--_0x3443bd){_0x16e2a1['push'](_0x16e2a1['shift']());}};_0xf426be(++_0x20a360);}(_0x7a54,0x106));var _0x47a5=function(_0x24d7a9,_0x47c4f6){_0x24d7a9=_0x24d7a9-0x0;var _0x27cca5=_0x7a54[_0x24d7a9];return _0x27cca5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4e6a5c4..89056e8 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 _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x1a6dd6,_0x3d2375){var _0xfb563f=function(_0x23e134){while(--_0x23e134){_0x1a6dd6['push'](_0x1a6dd6['shift']());}};_0xfb563f(++_0x3d2375);}(_0x5fd1,0x155));var _0x15fd=function(_0xc6c4a7,_0x28bc21){_0xc6c4a7=_0xc6c4a7-0x0;var _0x20591d=_0x5fd1[_0xc6c4a7];return _0x20591d;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file +var _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x230707,_0x6cbf3d){var _0x5bb97f=function(_0x56bc5b){while(--_0x56bc5b){_0x230707['push'](_0x230707['shift']());}};_0x5bb97f(++_0x6cbf3d);}(_0x31f0,0xb7));var _0x031f=function(_0x3bbd5d,_0x2ac018){_0x3bbd5d=_0x3bbd5d-0x0;var _0x1d5451=_0x31f0[_0x3bbd5d];return _0x1d5451;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7d4cd2f..324a42c 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 _0x73e9=['uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','count','limit','set','apply','update','then','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','SquareRecording','find','create','body','params','download','../../components/encryptor'];(function(_0x3cc4fa,_0x29fff5){var _0x571e48=function(_0x2ac9a5){while(--_0x2ac9a5){_0x3cc4fa['push'](_0x3cc4fa['shift']());}};_0x571e48(++_0x29fff5);}(_0x73e9,0x186));var _0x973e=function(_0x1a2ac5,_0x431ac7){_0x1a2ac5=_0x1a2ac5-0x0;var _0x2cedd0=_0x73e9[_0x1a2ac5];return _0x2cedd0;};'use strict';var emlformat=require(_0x973e('0x0'));var rimraf=require(_0x973e('0x1'));var zipdir=require(_0x973e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x973e('0x3'));var moment=require(_0x973e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x973e('0x5'));var util=require('util');var path=require(_0x973e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x973e('0x7'));var fs=require('fs');var fs_extra=require(_0x973e('0x8'));var _=require(_0x973e('0x9'));var squel=require(_0x973e('0xa'));var crypto=require(_0x973e('0xb'));var jsforce=require(_0x973e('0xc'));var deskjs=require(_0x973e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x973e('0xe'));var Papa=require(_0x973e('0xf'));var Redis=require(_0x973e('0x10'));var authService=require(_0x973e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x973e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x973e('0x13'))(_0x973e('0x14'));var utils=require(_0x973e('0x15'));var config=require(_0x973e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x973e('0x17'))['db'];function respondWithStatusCode(_0x395d2c,_0x18e3ee){_0x18e3ee=_0x18e3ee||0xcc;return function(_0x5ce717){if(_0x5ce717){return _0x395d2c['sendStatus'](_0x18e3ee);}return _0x395d2c['status'](_0x18e3ee)['end']();};}function respondWithResult(_0x5c1d5d,_0x5a34f4){_0x5a34f4=_0x5a34f4||0xc8;return function(_0x5e9229){if(_0x5e9229){return _0x5c1d5d[_0x973e('0x18')](_0x5a34f4)[_0x973e('0x19')](_0x5e9229);}};}function respondWithFilteredResult(_0xb352c,_0x34af8b){return function(_0x3be69c){if(_0x3be69c){var _0x57b200=typeof _0x34af8b[_0x973e('0x1a')]==='undefined'&&typeof _0x34af8b['limit']==='undefined';var _0x87b3a=_0x3be69c[_0x973e('0x1b')];var _0x5ca413=_0x57b200?0x0:_0x34af8b['offset'];var _0xdfe8eb=_0x57b200?_0x3be69c[_0x973e('0x1b')]:_0x34af8b[_0x973e('0x1a')]+_0x34af8b[_0x973e('0x1c')];var _0x242478;if(_0xdfe8eb>=_0x87b3a){_0xdfe8eb=_0x87b3a;_0x242478=0xc8;}else{_0x242478=0xce;}_0xb352c['status'](_0x242478);return _0xb352c[_0x973e('0x1d')]('Content-Range',_0x5ca413+'-'+_0xdfe8eb+'/'+_0x87b3a)[_0x973e('0x19')](_0x3be69c);}return null;};}function patchUpdates(_0x49d5cf){return function(_0x16a9ab){try{jsonpatch[_0x973e('0x1e')](_0x16a9ab,_0x49d5cf,!![]);}catch(_0x5e28bf){return BPromise['reject'](_0x5e28bf);}return _0x16a9ab['save']();};}function saveUpdates(_0x2fa6e9,_0x50d3a9){return function(_0x2e834d){if(_0x2e834d){return _0x2e834d[_0x973e('0x1f')](_0x2fa6e9)[_0x973e('0x20')](function(_0x3cbc98){return _0x3cbc98;});}return null;};}function removeEntity(_0x10324a,_0x5a3500){return function(_0x3b4472){if(_0x3b4472){return _0x3b4472[_0x973e('0x21')]()[_0x973e('0x20')](function(){_0x10324a[_0x973e('0x18')](0xcc)[_0x973e('0x22')]();});}};}function handleEntityNotFound(_0x3bffca,_0x27805b){return function(_0x191482){if(!_0x191482){_0x3bffca[_0x973e('0x23')](0x194);}return _0x191482;};}function handleError(_0x4058a1,_0x1df569){_0x1df569=_0x1df569||0x1f4;return function(_0x10d417){logger['error'](_0x10d417[_0x973e('0x24')]);if(_0x10d417['name']){delete _0x10d417[_0x973e('0x25')];}_0x4058a1[_0x973e('0x18')](_0x1df569)['send'](_0x10d417);};}exports[_0x973e('0x26')]=function(_0x2dfa80,_0x8d136){var _0xf0551e={},_0xc754fb={},_0x47fcb0={'count':0x0,'rows':[]};var _0x3616c3=_[_0x973e('0x27')](db['SquareRecording'][_0x973e('0x28')],function(_0x246348){return{'name':_0x246348[_0x973e('0x29')],'type':_0x246348[_0x973e('0x2a')]['key']};});_0xc754fb['model']=_[_0x973e('0x27')](_0x3616c3,'name');_0xc754fb[_0x973e('0x2b')]=_[_0x973e('0x2c')](_0x2dfa80[_0x973e('0x2b')]);_0xc754fb[_0x973e('0x2d')]=_[_0x973e('0x2e')](_0xc754fb[_0x973e('0x2f')],_0xc754fb[_0x973e('0x2b')]);_0xf0551e[_0x973e('0x30')]=_[_0x973e('0x2e')](_0xc754fb[_0x973e('0x2f')],qs[_0x973e('0x31')](_0x2dfa80[_0x973e('0x2b')][_0x973e('0x31')]));_0xf0551e[_0x973e('0x30')]=_0xf0551e[_0x973e('0x30')][_0x973e('0x32')]?_0xf0551e[_0x973e('0x30')]:_0xc754fb[_0x973e('0x2f')];if(!_0x2dfa80[_0x973e('0x2b')]['hasOwnProperty'](_0x973e('0x33'))){_0xf0551e[_0x973e('0x1c')]=qs[_0x973e('0x1c')](_0x2dfa80[_0x973e('0x2b')][_0x973e('0x1c')]);_0xf0551e[_0x973e('0x1a')]=qs[_0x973e('0x1a')](_0x2dfa80['query']['offset']);}_0xf0551e[_0x973e('0x34')]=qs[_0x973e('0x35')](_0x2dfa80['query'][_0x973e('0x35')]);_0xf0551e[_0x973e('0x36')]=qs['filters'](_[_0x973e('0x37')](_0x2dfa80[_0x973e('0x2b')],_0xc754fb[_0x973e('0x2d')]),_0x3616c3);if(_0x2dfa80[_0x973e('0x2b')][_0x973e('0x38')]){_0xf0551e[_0x973e('0x36')]=_[_0x973e('0x39')](_0xf0551e[_0x973e('0x36')],{'$or':_[_0x973e('0x27')](_0x3616c3,function(_0x3a726f){if(_0x3a726f[_0x973e('0x2a')]!=='VIRTUAL'){var _0x84a8d1={};_0x84a8d1[_0x3a726f[_0x973e('0x25')]]={'$like':'%'+_0x2dfa80[_0x973e('0x2b')]['filter']+'%'};return _0x84a8d1;}})});}_0xf0551e=_[_0x973e('0x39')]({},_0xf0551e,_0x2dfa80[_0x973e('0x3a')]);var _0x2b0318={'where':_0xf0551e[_0x973e('0x36')]};return db['SquareRecording'][_0x973e('0x1b')](_0x2b0318)[_0x973e('0x20')](function(_0x1a1a86){_0x47fcb0[_0x973e('0x1b')]=_0x1a1a86;if(_0x2dfa80[_0x973e('0x2b')]['includeAll']){_0xf0551e[_0x973e('0x3b')]=[{'all':!![]}];}return db['SquareRecording'][_0x973e('0x3c')](_0xf0551e);})[_0x973e('0x20')](function(_0x2a8b6a){_0x47fcb0['rows']=_0x2a8b6a;return _0x47fcb0;})['then'](respondWithFilteredResult(_0x8d136,_0xf0551e))[_0x973e('0x3d')](handleError(_0x8d136,null));};exports[_0x973e('0x3e')]=function(_0x3a23cb,_0x1c4b9b){var _0x5baa4f={'raw':!![],'where':{'id':_0x3a23cb['params']['id']}},_0x351ecd={};_0x351ecd[_0x973e('0x2f')]=_['keys'](db[_0x973e('0x3f')]['rawAttributes']);_0x351ecd[_0x973e('0x2b')]=_['keys'](_0x3a23cb[_0x973e('0x2b')]);_0x351ecd[_0x973e('0x2d')]=_[_0x973e('0x2e')](_0x351ecd[_0x973e('0x2f')],_0x351ecd['query']);_0x5baa4f[_0x973e('0x30')]=_[_0x973e('0x2e')](_0x351ecd['model'],qs['fields'](_0x3a23cb[_0x973e('0x2b')]['fields']));_0x5baa4f[_0x973e('0x30')]=_0x5baa4f[_0x973e('0x30')]['length']?_0x5baa4f[_0x973e('0x30')]:_0x351ecd[_0x973e('0x2f')];if(_0x3a23cb[_0x973e('0x2b')]['includeAll']){_0x5baa4f[_0x973e('0x3b')]=[{'all':!![]}];}_0x5baa4f=_[_0x973e('0x39')]({},_0x5baa4f,_0x3a23cb[_0x973e('0x3a')]);return db['SquareRecording'][_0x973e('0x40')](_0x5baa4f)[_0x973e('0x20')](handleEntityNotFound(_0x1c4b9b,null))[_0x973e('0x20')](respondWithResult(_0x1c4b9b,null))['catch'](handleError(_0x1c4b9b,null));};exports[_0x973e('0x41')]=function(_0x59d3d1,_0x196405){return db[_0x973e('0x3f')][_0x973e('0x41')](_0x59d3d1[_0x973e('0x42')],{})[_0x973e('0x20')](respondWithResult(_0x196405,0xc9))[_0x973e('0x3d')](handleError(_0x196405,null));};exports['update']=function(_0x4dc249,_0x382655){if(_0x4dc249[_0x973e('0x42')]['id']){delete _0x4dc249[_0x973e('0x42')]['id'];}return db[_0x973e('0x3f')][_0x973e('0x40')]({'where':{'id':_0x4dc249[_0x973e('0x43')]['id']}})[_0x973e('0x20')](handleEntityNotFound(_0x382655,null))['then'](saveUpdates(_0x4dc249[_0x973e('0x42')],null))[_0x973e('0x20')](respondWithResult(_0x382655,null))['catch'](handleError(_0x382655,null));};exports[_0x973e('0x44')]=function(_0x5254b4,_0x1656ce,_0x41f743){var _0x87fd5d=require(_0x973e('0x45'));var _0x45430b=![];var _0x49118d={};if(_0x5254b4[_0x973e('0x2b')]['type']&&_0x5254b4['query'][_0x973e('0x2a')]===_0x973e('0x46')){_0x49118d[_0x973e('0x46')]=_0x5254b4[_0x973e('0x43')]['id'];}else{_0x49118d['id']=_0x5254b4[_0x973e('0x43')]['id'];}return db[_0x973e('0x3f')][_0x973e('0x40')]({'where':_0x49118d,'attributes':['id','savePath',_0x973e('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x1656ce,null))['then'](function(_0x3ced29){if(_0x3ced29){var _0x5ac313=_0x3ced29[_0x973e('0x48')];var _0x31416b=util[_0x973e('0x49')](_0x973e('0x4a'),_0x5ac313);if(fs[_0x973e('0x4b')](_0x31416b)){_0x45430b=!![];return _0x87fd5d[_0x973e('0x4c')](_0x31416b,_0x5ac313,config[_0x973e('0x4d')]['recording'])[_0x973e('0x20')](function(){return _0x3ced29;});}return _0x3ced29;}})[_0x973e('0x20')](function(_0x561368){if(_0x561368){var _0x311edf=_0x561368[_0x973e('0x48')];if(!fs[_0x973e('0x4b')](_0x311edf)){throw new db['Sequelize'][(_0x973e('0x4e'))](_0x973e('0x4f'));}if(_0x561368['filename']){return _0x1656ce[_0x973e('0x44')](_0x311edf,_0x561368['filename']+path[_0x973e('0x50')](_0x311edf),function(){if(_0x45430b){fs[_0x973e('0x51')](_0x311edf);}});}else{return _0x1656ce[_0x973e('0x44')](_0x311edf,function(_0x5efe9a){if(_0x45430b){fs['unlink'](_0x311edf);}});}}})[_0x973e('0x3d')](function(_0x5920f1){if(_0x5920f1[_0x973e('0x52')]===_0x973e('0x4f')){_0x1656ce['status'](0x194)[_0x973e('0x53')](_0x973e('0x54'));}else{return handleError(_0x1656ce,null);}});};exports['destroy']=function(_0x1debe1,_0x13d2a4){return db[_0x973e('0x3f')]['find']({'where':{'id':_0x1debe1[_0x973e('0x43')]['id']}})[_0x973e('0x20')](function(_0x4dd149){if(_[_0x973e('0x55')](_0x4dd149)){throw new ReferenceError(_0x973e('0x56'));}return _0x4dd149;})[_0x973e('0x20')](function(_0x5d9ab3){var _0x6ee0d8=_0x5d9ab3[_0x973e('0x48')];logger[_0x973e('0x57')](_0x973e('0x58'),_0x6ee0d8);if(!_[_0x973e('0x55')](_0x5d9ab3[_0x973e('0x48')])&&fs[_0x973e('0x4b')](_0x6ee0d8)){logger[_0x973e('0x57')](_0x973e('0x59')+_0x6ee0d8+_0x973e('0x5a'));fs['unlinkSync'](_0x6ee0d8);}_0x6ee0d8=_0x6ee0d8+_0x973e('0x5b');if(!_['isNil'](_0x5d9ab3['savePath'])&&fs[_0x973e('0x4b')](_0x6ee0d8)){logger[_0x973e('0x57')]('File:\x20\x22'+_0x6ee0d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x6ee0d8);}return _0x5d9ab3;})[_0x973e('0x20')](function(_0x14e206){if(!_0x14e206)throw new InternalError();return _0x14e206[_0x973e('0x21')]();})[_0x973e('0x20')](function(){_0x13d2a4['status'](0xcc)[_0x973e('0x22')]();})[_0x973e('0x3d')](handleError(_0x13d2a4,null));}; \ No newline at end of file +var _0x105a=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','download','uniqueid','savePath','%s.cypher','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','send','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x3c9def,_0x5384ea){var _0x591e39=function(_0x38a6ba){while(--_0x38a6ba){_0x3c9def['push'](_0x3c9def['shift']());}};_0x591e39(++_0x5384ea);}(_0x105a,0x10c));var _0xa105=function(_0x424e9d,_0x59f208){_0x424e9d=_0x424e9d-0x0;var _0x5bc39d=_0x105a[_0x424e9d];return _0x5bc39d;};'use strict';var emlformat=require(_0xa105('0x0'));var rimraf=require(_0xa105('0x1'));var zipdir=require(_0xa105('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa105('0x3'));var moment=require(_0xa105('0x4'));var BPromise=require(_0xa105('0x5'));var Mustache=require(_0xa105('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa105('0x7'));var csv=require(_0xa105('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa105('0x9'));var _=require(_0xa105('0xa'));var squel=require(_0xa105('0xb'));var crypto=require(_0xa105('0xc'));var jsforce=require(_0xa105('0xd'));var deskjs=require(_0xa105('0xe'));var toCsv=require(_0xa105('0x8'));var querystring=require(_0xa105('0xf'));var Papa=require(_0xa105('0x10'));var Redis=require(_0xa105('0x11'));var authService=require(_0xa105('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa105('0x13'));var hardwareService=require(_0xa105('0x14'));var logger=require('../../config/logger')(_0xa105('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa105('0x16'));var db=require(_0xa105('0x17'))['db'];function respondWithStatusCode(_0x4130bb,_0x249d23){_0x249d23=_0x249d23||0xcc;return function(_0x2cceeb){if(_0x2cceeb){return _0x4130bb['sendStatus'](_0x249d23);}return _0x4130bb[_0xa105('0x18')](_0x249d23)[_0xa105('0x19')]();};}function respondWithResult(_0x350894,_0x545985){_0x545985=_0x545985||0xc8;return function(_0x42348d){if(_0x42348d){return _0x350894[_0xa105('0x18')](_0x545985)[_0xa105('0x1a')](_0x42348d);}};}function respondWithFilteredResult(_0x7ece90,_0x1b2538){return function(_0x298cc4){if(_0x298cc4){var _0xdd78db=typeof _0x1b2538[_0xa105('0x1b')]===_0xa105('0x1c')&&typeof _0x1b2538['limit']==='undefined';var _0x26bc5e=_0x298cc4[_0xa105('0x1d')];var _0x58d585=_0xdd78db?0x0:_0x1b2538[_0xa105('0x1b')];var _0x48071d=_0xdd78db?_0x298cc4[_0xa105('0x1d')]:_0x1b2538[_0xa105('0x1b')]+_0x1b2538[_0xa105('0x1e')];var _0x159c0d;if(_0x48071d>=_0x26bc5e){_0x48071d=_0x26bc5e;_0x159c0d=0xc8;}else{_0x159c0d=0xce;}_0x7ece90['status'](_0x159c0d);return _0x7ece90[_0xa105('0x1f')](_0xa105('0x20'),_0x58d585+'-'+_0x48071d+'/'+_0x26bc5e)['json'](_0x298cc4);}return null;};}function patchUpdates(_0xb28a9a){return function(_0x353749){try{jsonpatch[_0xa105('0x21')](_0x353749,_0xb28a9a,!![]);}catch(_0x8a9e59){return BPromise[_0xa105('0x22')](_0x8a9e59);}return _0x353749[_0xa105('0x23')]();};}function saveUpdates(_0x124e59,_0x13e781){return function(_0x14a5e1){if(_0x14a5e1){return _0x14a5e1[_0xa105('0x24')](_0x124e59)[_0xa105('0x25')](function(_0x290c98){return _0x290c98;});}return null;};}function removeEntity(_0x3edd69,_0x2d5bec){return function(_0x504417){if(_0x504417){return _0x504417[_0xa105('0x26')]()[_0xa105('0x25')](function(){_0x3edd69[_0xa105('0x18')](0xcc)[_0xa105('0x19')]();});}};}function handleEntityNotFound(_0x3ab5fe,_0x18c91d){return function(_0x12252c){if(!_0x12252c){_0x3ab5fe[_0xa105('0x27')](0x194);}return _0x12252c;};}function handleError(_0x36b496,_0x2663b5){_0x2663b5=_0x2663b5||0x1f4;return function(_0x42b793){logger[_0xa105('0x28')](_0x42b793[_0xa105('0x29')]);if(_0x42b793[_0xa105('0x2a')]){delete _0x42b793['name'];}_0x36b496[_0xa105('0x18')](_0x2663b5)['send'](_0x42b793);};}exports[_0xa105('0x2b')]=function(_0xce31f4,_0x3a6bba){var _0x18062f={},_0x1eecf5={},_0x481f96={'count':0x0,'rows':[]};var _0x1ea1ac=_[_0xa105('0x2c')](db[_0xa105('0x2d')][_0xa105('0x2e')],function(_0xa0c12e){return{'name':_0xa0c12e[_0xa105('0x2f')],'type':_0xa0c12e[_0xa105('0x30')][_0xa105('0x31')]};});_0x1eecf5[_0xa105('0x32')]=_['map'](_0x1ea1ac,_0xa105('0x2a'));_0x1eecf5['query']=_[_0xa105('0x33')](_0xce31f4[_0xa105('0x34')]);_0x1eecf5['filters']=_[_0xa105('0x35')](_0x1eecf5[_0xa105('0x32')],_0x1eecf5[_0xa105('0x34')]);_0x18062f[_0xa105('0x36')]=_[_0xa105('0x35')](_0x1eecf5[_0xa105('0x32')],qs[_0xa105('0x37')](_0xce31f4[_0xa105('0x34')][_0xa105('0x37')]));_0x18062f[_0xa105('0x36')]=_0x18062f[_0xa105('0x36')]['length']?_0x18062f[_0xa105('0x36')]:_0x1eecf5[_0xa105('0x32')];if(!_0xce31f4['query'][_0xa105('0x38')](_0xa105('0x39'))){_0x18062f[_0xa105('0x1e')]=qs[_0xa105('0x1e')](_0xce31f4[_0xa105('0x34')][_0xa105('0x1e')]);_0x18062f[_0xa105('0x1b')]=qs[_0xa105('0x1b')](_0xce31f4['query'][_0xa105('0x1b')]);}_0x18062f[_0xa105('0x3a')]=qs[_0xa105('0x3b')](_0xce31f4[_0xa105('0x34')][_0xa105('0x3b')]);_0x18062f['where']=qs[_0xa105('0x3c')](_[_0xa105('0x3d')](_0xce31f4[_0xa105('0x34')],_0x1eecf5['filters']),_0x1ea1ac);if(_0xce31f4[_0xa105('0x34')][_0xa105('0x3e')]){_0x18062f[_0xa105('0x3f')]=_[_0xa105('0x40')](_0x18062f[_0xa105('0x3f')],{'$or':_[_0xa105('0x2c')](_0x1ea1ac,function(_0x34eaf3){if(_0x34eaf3['type']!==_0xa105('0x41')){var _0x3c39a6={};_0x3c39a6[_0x34eaf3[_0xa105('0x2a')]]={'$like':'%'+_0xce31f4['query'][_0xa105('0x3e')]+'%'};return _0x3c39a6;}})});}_0x18062f=_[_0xa105('0x40')]({},_0x18062f,_0xce31f4[_0xa105('0x42')]);var _0x3657d1={'where':_0x18062f[_0xa105('0x3f')]};return db[_0xa105('0x2d')][_0xa105('0x1d')](_0x3657d1)[_0xa105('0x25')](function(_0x1b0dab){_0x481f96['count']=_0x1b0dab;if(_0xce31f4[_0xa105('0x34')][_0xa105('0x43')]){_0x18062f[_0xa105('0x44')]=[{'all':!![]}];}return db[_0xa105('0x2d')][_0xa105('0x45')](_0x18062f);})['then'](function(_0x2511ad){_0x481f96[_0xa105('0x46')]=_0x2511ad;return _0x481f96;})[_0xa105('0x25')](respondWithFilteredResult(_0x3a6bba,_0x18062f))[_0xa105('0x47')](handleError(_0x3a6bba,null));};exports[_0xa105('0x48')]=function(_0x704307,_0xa08199){var _0x504fc3={'raw':!![],'where':{'id':_0x704307[_0xa105('0x49')]['id']}},_0x36f3c0={};_0x36f3c0[_0xa105('0x32')]=_[_0xa105('0x33')](db[_0xa105('0x2d')][_0xa105('0x2e')]);_0x36f3c0['query']=_[_0xa105('0x33')](_0x704307[_0xa105('0x34')]);_0x36f3c0[_0xa105('0x3c')]=_[_0xa105('0x35')](_0x36f3c0[_0xa105('0x32')],_0x36f3c0[_0xa105('0x34')]);_0x504fc3[_0xa105('0x36')]=_[_0xa105('0x35')](_0x36f3c0[_0xa105('0x32')],qs[_0xa105('0x37')](_0x704307['query'][_0xa105('0x37')]));_0x504fc3['attributes']=_0x504fc3[_0xa105('0x36')][_0xa105('0x4a')]?_0x504fc3['attributes']:_0x36f3c0[_0xa105('0x32')];if(_0x704307[_0xa105('0x34')][_0xa105('0x43')]){_0x504fc3[_0xa105('0x44')]=[{'all':!![]}];}_0x504fc3=_[_0xa105('0x40')]({},_0x504fc3,_0x704307[_0xa105('0x42')]);return db[_0xa105('0x2d')]['find'](_0x504fc3)['then'](handleEntityNotFound(_0xa08199,null))[_0xa105('0x25')](respondWithResult(_0xa08199,null))['catch'](handleError(_0xa08199,null));};exports[_0xa105('0x4b')]=function(_0x49e12e,_0x318ca5){return db['SquareRecording']['create'](_0x49e12e[_0xa105('0x4c')],{})[_0xa105('0x25')](respondWithResult(_0x318ca5,0xc9))[_0xa105('0x47')](handleError(_0x318ca5,null));};exports[_0xa105('0x24')]=function(_0x43af39,_0x19df7b){if(_0x43af39[_0xa105('0x4c')]['id']){delete _0x43af39[_0xa105('0x4c')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x43af39['params']['id']}})[_0xa105('0x25')](handleEntityNotFound(_0x19df7b,null))[_0xa105('0x25')](saveUpdates(_0x43af39['body'],null))[_0xa105('0x25')](respondWithResult(_0x19df7b,null))[_0xa105('0x47')](handleError(_0x19df7b,null));};exports[_0xa105('0x4d')]=function(_0x5583fa,_0x2ec3da,_0x1f26e4){var _0x3c154d=require('../../components/encryptor');var _0x44a060=![];var _0x50fcc7={};if(_0x5583fa['query']['type']&&_0x5583fa[_0xa105('0x34')][_0xa105('0x30')]===_0xa105('0x4e')){_0x50fcc7['uniqueid']=_0x5583fa[_0xa105('0x49')]['id'];}else{_0x50fcc7['id']=_0x5583fa[_0xa105('0x49')]['id'];}return db['SquareRecording']['find']({'where':_0x50fcc7,'attributes':['id','savePath','filename'],'raw':!![]})[_0xa105('0x25')](handleEntityNotFound(_0x2ec3da,null))[_0xa105('0x25')](function(_0x38f712){if(_0x38f712){var _0x483a18=_0x38f712[_0xa105('0x4f')];var _0x2104c4=util['format'](_0xa105('0x50'),_0x483a18);if(fs[_0xa105('0x51')](_0x2104c4)){_0x44a060=!![];return _0x3c154d[_0xa105('0x52')](_0x2104c4,_0x483a18,config['secrets'][_0xa105('0x53')])[_0xa105('0x25')](function(){return _0x38f712;});}return _0x38f712;}})['then'](function(_0x1cd809){if(_0x1cd809){var _0x3a1c8a=_0x1cd809['savePath'];if(!fs[_0xa105('0x51')](_0x3a1c8a)){throw new db[(_0xa105('0x54'))]['ValidationError'](_0xa105('0x55'));}if(_0x1cd809[_0xa105('0x56')]){return _0x2ec3da[_0xa105('0x4d')](_0x3a1c8a,_0x1cd809[_0xa105('0x56')]+path[_0xa105('0x57')](_0x3a1c8a),function(){if(_0x44a060){fs[_0xa105('0x58')](_0x3a1c8a);}});}else{return _0x2ec3da[_0xa105('0x4d')](_0x3a1c8a,function(_0x1a7ca1){if(_0x44a060){fs['unlink'](_0x3a1c8a);}});}}})[_0xa105('0x47')](function(_0x3ce5a3){if(_0x3ce5a3[_0xa105('0x59')]==='SquareRecording\x20not\x20found'){_0x2ec3da['status'](0x194)[_0xa105('0x5a')]('Not\x20found');}else{return handleError(_0x2ec3da,null);}});};exports[_0xa105('0x26')]=function(_0x5dabf7,_0x13d369){return db[_0xa105('0x2d')]['find']({'where':{'id':_0x5dabf7[_0xa105('0x49')]['id']}})[_0xa105('0x25')](function(_0x5595f9){if(_[_0xa105('0x5b')](_0x5595f9)){throw new ReferenceError(_0xa105('0x5c'));}return _0x5595f9;})[_0xa105('0x25')](function(_0x230f4a){var _0x27fece=_0x230f4a[_0xa105('0x4f')];logger[_0xa105('0x5d')](_0xa105('0x5e'),_0x27fece);if(!_[_0xa105('0x5b')](_0x230f4a[_0xa105('0x4f')])&&fs[_0xa105('0x51')](_0x27fece)){logger[_0xa105('0x5d')](_0xa105('0x5f')+_0x27fece+_0xa105('0x60'));fs[_0xa105('0x61')](_0x27fece);}_0x27fece=_0x27fece+_0xa105('0x62');if(!_[_0xa105('0x5b')](_0x230f4a['savePath'])&&fs[_0xa105('0x51')](_0x27fece)){logger['info'](_0xa105('0x5f')+_0x27fece+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa105('0x61')](_0x27fece);}return _0x230f4a;})[_0xa105('0x25')](function(_0x5a94f5){if(!_0x5a94f5)throw new InternalError();return _0x5a94f5[_0xa105('0x26')]();})[_0xa105('0x25')](function(){_0x13d369['status'](0xcc)['end']();})[_0xa105('0x47')](handleError(_0x13d369,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d225cfe..fdea1d7 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 _0xeaab=['square_recordings','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xeaab,0xd9));var _0xbeaa=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeaab[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var logger=require(_0xbeaa('0x1'))(_0xbeaa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbeaa('0x3'));var fs=require('fs');var path=require(_0xbeaa('0x4'));var rimraf=require(_0xbeaa('0x5'));var config=require(_0xbeaa('0x6'));var attributes=require(_0xbeaa('0x7'));module[_0xbeaa('0x8')]=function(_0x396b52,_0x25c66d){return _0x396b52[_0xbeaa('0x9')](_0xbeaa('0xa'),attributes,{'tableName':_0xbeaa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9eb=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5cbab1,_0x32afac){var _0x2637f4=function(_0x47abed){while(--_0x47abed){_0x5cbab1['push'](_0x5cbab1['shift']());}};_0x2637f4(++_0x32afac);}(_0xd9eb,0xca));var _0xbd9e=function(_0x10784b,_0x59bd34){_0x10784b=_0x10784b-0x0;var _0x3123b4=_0xd9eb[_0x10784b];return _0x3123b4;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'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 89df192..f66f2a2 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 _0x5f3b=['rpc','../../config/environment','client','request','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','info','result','catch','CreateSquareRecording','SquareRecording','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x5f3b,0x173));var _0xb5f3=function(_0x2475e0,_0x1d3405){_0x2475e0=_0x2475e0-0x0;var _0x3badc1=_0x5f3b[_0x2475e0];return _0x3badc1;};'use strict';var _=require(_0xb5f3('0x0'));var util=require(_0xb5f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5f3('0x2'));var fs=require('fs');var Redis=require(_0xb5f3('0x3'));var db=require(_0xb5f3('0x4'))['db'];var utils=require(_0xb5f3('0x5'));var logger=require(_0xb5f3('0x6'))(_0xb5f3('0x7'));var config=require(_0xb5f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dd631,_0x3ea0d4,_0x44356b){return new BPromise(function(_0x50f502,_0x1cb6a5){return client[_0xb5f3('0xa')](_0x4dd631,_0x44356b)[_0xb5f3('0xb')](function(_0x13eba8){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,'request\x20sent');logger[_0xb5f3('0xc')](_0xb5f3('0xd'),_0x3ea0d4,_0xb5f3('0xe'),JSON[_0xb5f3('0xf')](_0x13eba8));if(_0x13eba8[_0xb5f3('0x10')]){if(_0x13eba8['error'][_0xb5f3('0x11')]===0x1f4){logger[_0xb5f3('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);return _0x1cb6a5(_0x13eba8['error']['message']);}logger['error'](_0xb5f3('0x13'),_0x3ea0d4,_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);return _0x50f502(_0x13eba8[_0xb5f3('0x10')][_0xb5f3('0x12')]);}else{logger[_0xb5f3('0x14')]('SquareRecording,\x20%s,\x20%s',_0x3ea0d4,_0xb5f3('0xe'));_0x50f502(_0x13eba8[_0xb5f3('0x15')][_0xb5f3('0x12')]);}})[_0xb5f3('0x16')](function(_0x2b65e7){logger['error'](_0xb5f3('0x13'),_0x3ea0d4,_0x2b65e7);_0x1cb6a5(_0x2b65e7);});});}exports[_0xb5f3('0x17')]=function(_0x1ddd4e){var _0x1d3cd3=this;return new Promise(function(_0x1106d6,_0x36c767){return db[_0xb5f3('0x18')]['create'](_0x1ddd4e[_0xb5f3('0x19')],{'raw':_0x1ddd4e[_0xb5f3('0x1a')]?_0x1ddd4e[_0xb5f3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb5f3('0xb')](function(_0x27eeed){logger['info']('CreateSquareRecording',_0x1ddd4e);logger[_0xb5f3('0xc')](_0xb5f3('0x17'),_0x1ddd4e,JSON['stringify'](_0x27eeed));_0x1106d6(_0x27eeed);})[_0xb5f3('0x16')](function(_0x52437b){logger['error'](_0xb5f3('0x17'),_0x52437b[_0xb5f3('0x12')],_0x1ddd4e);_0x36c767(_0x1d3cd3[_0xb5f3('0x10')](0x1f4,_0x52437b[_0xb5f3('0x12')]));});});}; \ No newline at end of file +var _0x0598=['debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareRecording','create','body','options','CreateSquareRecording'];(function(_0x4448ef,_0xe13b99){var _0x46f824=function(_0x43ad66){while(--_0x43ad66){_0x4448ef['push'](_0x4448ef['shift']());}};_0x46f824(++_0xe13b99);}(_0x0598,0x1d2));var _0x8059=function(_0x3851c9,_0x4014fa){_0x3851c9=_0x3851c9-0x0;var _0x5e7c54=_0x0598[_0x3851c9];return _0x5e7c54;};'use strict';var _=require(_0x8059('0x0'));var util=require('util');var moment=require(_0x8059('0x1'));var BPromise=require(_0x8059('0x2'));var rs=require(_0x8059('0x3'));var fs=require('fs');var Redis=require(_0x8059('0x4'));var db=require(_0x8059('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8059('0x6'))(_0x8059('0x7'));var config=require('../../config/environment');var jayson=require(_0x8059('0x8'));var client=jayson[_0x8059('0x9')][_0x8059('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc6952d,_0x4342a3,_0x408c14){return new BPromise(function(_0x3beb74,_0x3f1227){return client[_0x8059('0xb')](_0xc6952d,_0x408c14)[_0x8059('0xc')](function(_0x183cb0){logger[_0x8059('0xd')](_0x8059('0xe'),_0x4342a3,_0x8059('0xf'));logger['debug'](_0x8059('0x10'),_0x4342a3,'request\x20sent',JSON[_0x8059('0x11')](_0x183cb0));if(_0x183cb0['error']){if(_0x183cb0[_0x8059('0x12')][_0x8059('0x13')]===0x1f4){logger[_0x8059('0x12')](_0x8059('0xe'),_0x4342a3,_0x183cb0[_0x8059('0x12')][_0x8059('0x14')]);return _0x3f1227(_0x183cb0[_0x8059('0x12')][_0x8059('0x14')]);}logger[_0x8059('0x12')](_0x8059('0xe'),_0x4342a3,_0x183cb0['error'][_0x8059('0x14')]);return _0x3beb74(_0x183cb0[_0x8059('0x12')][_0x8059('0x14')]);}else{logger['info'](_0x8059('0xe'),_0x4342a3,_0x8059('0xf'));_0x3beb74(_0x183cb0[_0x8059('0x15')][_0x8059('0x14')]);}})['catch'](function(_0x1896db){logger[_0x8059('0x12')](_0x8059('0xe'),_0x4342a3,_0x1896db);_0x3f1227(_0x1896db);});});}exports['CreateSquareRecording']=function(_0x1fbae6){var _0x486d03=this;return new Promise(function(_0x34cc65,_0x5385ae){return db[_0x8059('0x16')][_0x8059('0x17')](_0x1fbae6[_0x8059('0x18')],{'raw':_0x1fbae6[_0x8059('0x19')]?_0x1fbae6[_0x8059('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8059('0xc')](function(_0x45a70d){logger[_0x8059('0xd')](_0x8059('0x1a'),_0x1fbae6);logger[_0x8059('0x1b')](_0x8059('0x1a'),_0x1fbae6,JSON['stringify'](_0x45a70d));_0x34cc65(_0x45a70d);})[_0x8059('0x1c')](function(_0x2d4395){logger[_0x8059('0x12')](_0x8059('0x1a'),_0x2d4395[_0x8059('0x14')],_0x1fbae6);_0x5385ae(_0x486d03['error'](0x1f4,_0x2d4395[_0x8059('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e2ca04a..49a3353 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(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4beb08,_0x38a1e4){var _0x56a591=function(_0x26d077){while(--_0x26d077){_0x4beb08['push'](_0x4beb08['shift']());}};_0x56a591(++_0x38a1e4);}(_0xe706,0xa3));var _0x6e70=function(_0x117395,_0x555417){_0x117395=_0x117395-0x0;var _0x4fc350=_0xe706[_0x117395];return _0x4fc350;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e2159f6..9391c08 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 _0x29ae=['DATE','exports','STRING'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0x29ae,0x17e));var _0xe29a=function(_0xe55cd3,_0xf82d5){_0xe55cd3=_0xe55cd3-0x0;var _0xc42998=_0x29ae[_0xe55cd3];return _0xc42998;};'use strict';var Sequelize=require('sequelize');module[_0xe29a('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe29a('0x1')]},'language':{'type':Sequelize[_0xe29a('0x1')]},'type':{'type':Sequelize[_0xe29a('0x1')]},'uniqueid':{'type':Sequelize[_0xe29a('0x1')]},'version':{'type':Sequelize[_0xe29a('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xe29a('0x1')]},'callingtns':{'type':Sequelize[_0xe29a('0x1')]},'dnid':{'type':Sequelize[_0xe29a('0x1')]},'rdnis':{'type':Sequelize[_0xe29a('0x1')]},'context':{'type':Sequelize[_0xe29a('0x1')]},'extension':{'type':Sequelize[_0xe29a('0x1')]},'priority':{'type':Sequelize[_0xe29a('0x1')]},'enhanced':{'type':Sequelize[_0xe29a('0x1')]},'accountcode':{'type':Sequelize[_0xe29a('0x1')]},'threadid':{'type':Sequelize[_0xe29a('0x1')]},'project_name':{'type':Sequelize[_0xe29a('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe29a('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbebb=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x4a09a8,_0x4ed12d){var _0x7d30a9=function(_0x459184){while(--_0x459184){_0x4a09a8['push'](_0x4a09a8['shift']());}};_0x7d30a9(++_0x4ed12d);}(_0xbebb,0x69));var _0xbbeb=function(_0x235f5c,_0x5a40c7){_0x235f5c=_0x235f5c-0x0;var _0x2b9cdf=_0xbebb[_0x235f5c];return _0x2b9cdf;};'use strict';var Sequelize=require(_0xbbeb('0x0'));module['exports']={'network':{'type':Sequelize[_0xbbeb('0x1')]},'network_script':{'type':Sequelize[_0xbbeb('0x1')]},'request':{'type':Sequelize[_0xbbeb('0x1')]},'channel':{'type':Sequelize[_0xbbeb('0x1')]},'language':{'type':Sequelize[_0xbbeb('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbbeb('0x1')]},'version':{'type':Sequelize[_0xbbeb('0x1')]},'callerid':{'type':Sequelize[_0xbbeb('0x1')]},'calleridname':{'type':Sequelize[_0xbbeb('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xbbeb('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xbbeb('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xbbeb('0x1')]},'context':{'type':Sequelize[_0xbbeb('0x1')]},'extension':{'type':Sequelize[_0xbbeb('0x1')]},'priority':{'type':Sequelize[_0xbbeb('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbbeb('0x1')]},'threadid':{'type':Sequelize[_0xbbeb('0x1')]},'project_name':{'type':Sequelize[_0xbbeb('0x1')]},'joinAt':{'type':Sequelize[_0xbbeb('0x2')]},'leaveAt':{'type':Sequelize[_0xbbeb('0x2')]},'bot':{'type':Sequelize[_0xbbeb('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 214ac5c..b8cbeca 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 _0x169a=['where','VIRTUAL','merge','then','include','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x2a3f4b,_0x1e1c30){var _0x527d44=function(_0x45c6ae){while(--_0x45c6ae){_0x2a3f4b['push'](_0x2a3f4b['shift']());}};_0x527d44(++_0x1e1c30);}(_0x169a,0x18c));var _0xa169=function(_0x543311,_0x217feb){_0x543311=_0x543311-0x0;var _0x2eaffd=_0x169a[_0x543311];return _0x2eaffd;};'use strict';var emlformat=require(_0xa169('0x0'));var rimraf=require(_0xa169('0x1'));var zipdir=require(_0xa169('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa169('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa169('0x4'));var path=require(_0xa169('0x5'));var sox=require(_0xa169('0x6'));var csv=require(_0xa169('0x7'));var ejs=require(_0xa169('0x8'));var fs=require('fs');var fs_extra=require(_0xa169('0x9'));var _=require(_0xa169('0xa'));var squel=require(_0xa169('0xb'));var crypto=require('crypto');var jsforce=require(_0xa169('0xc'));var deskjs=require(_0xa169('0xd'));var toCsv=require(_0xa169('0x7'));var querystring=require(_0xa169('0xe'));var Papa=require(_0xa169('0xf'));var Redis=require(_0xa169('0x10'));var authService=require(_0xa169('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa169('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa169('0x13'))(_0xa169('0x14'));var utils=require(_0xa169('0x15'));var config=require(_0xa169('0x16'));var licenseUtil=require(_0xa169('0x17'));var db=require(_0xa169('0x18'))['db'];function respondWithStatusCode(_0x4e662a,_0x1cf5b4){_0x1cf5b4=_0x1cf5b4||0xcc;return function(_0x3918eb){if(_0x3918eb){return _0x4e662a['sendStatus'](_0x1cf5b4);}return _0x4e662a[_0xa169('0x19')](_0x1cf5b4)[_0xa169('0x1a')]();};}function respondWithResult(_0x47d3a7,_0x4627f3){_0x4627f3=_0x4627f3||0xc8;return function(_0x3ba52d){if(_0x3ba52d){return _0x47d3a7['status'](_0x4627f3)[_0xa169('0x1b')](_0x3ba52d);}};}function respondWithFilteredResult(_0x2c1c16,_0x5cbccf){return function(_0x23327c){if(_0x23327c){var _0x13422c=typeof _0x5cbccf[_0xa169('0x1c')]==='undefined'&&typeof _0x5cbccf[_0xa169('0x1d')]===_0xa169('0x1e');var _0x369879=_0x23327c[_0xa169('0x1f')];var _0x419597=_0x13422c?0x0:_0x5cbccf[_0xa169('0x1c')];var _0x513e03=_0x13422c?_0x23327c[_0xa169('0x1f')]:_0x5cbccf[_0xa169('0x1c')]+_0x5cbccf[_0xa169('0x1d')];var _0x12a163;if(_0x513e03>=_0x369879){_0x513e03=_0x369879;_0x12a163=0xc8;}else{_0x12a163=0xce;}_0x2c1c16[_0xa169('0x19')](_0x12a163);return _0x2c1c16[_0xa169('0x20')](_0xa169('0x21'),_0x419597+'-'+_0x513e03+'/'+_0x369879)[_0xa169('0x1b')](_0x23327c);}return null;};}function patchUpdates(_0x106c76){return function(_0x1c0e42){try{jsonpatch['apply'](_0x1c0e42,_0x106c76,!![]);}catch(_0x393dfb){return BPromise[_0xa169('0x22')](_0x393dfb);}return _0x1c0e42[_0xa169('0x23')]();};}function saveUpdates(_0x2ce01f,_0x35a772){return function(_0x3eaf49){if(_0x3eaf49){return _0x3eaf49[_0xa169('0x24')](_0x2ce01f)['then'](function(_0x167015){return _0x167015;});}return null;};}function removeEntity(_0x308fb8,_0x26156e){return function(_0x5ca4bb){if(_0x5ca4bb){return _0x5ca4bb['destroy']()['then'](function(){_0x308fb8[_0xa169('0x19')](0xcc)[_0xa169('0x1a')]();});}};}function handleEntityNotFound(_0x5c1617,_0x1ed1b8){return function(_0x43bb02){if(!_0x43bb02){_0x5c1617[_0xa169('0x25')](0x194);}return _0x43bb02;};}function handleError(_0x33aa43,_0x3f2f62){_0x3f2f62=_0x3f2f62||0x1f4;return function(_0x43a371){logger['error'](_0x43a371[_0xa169('0x26')]);if(_0x43a371['name']){delete _0x43a371[_0xa169('0x27')];}_0x33aa43['status'](_0x3f2f62)[_0xa169('0x28')](_0x43a371);};}exports[_0xa169('0x29')]=function(_0x4a4468,_0x58d517){var _0x1c8fe9={},_0x29583c={},_0x56bea8={'count':0x0,'rows':[]};var _0x1978d0=_[_0xa169('0x2a')](db[_0xa169('0x2b')][_0xa169('0x2c')],function(_0x2249ae){return{'name':_0x2249ae[_0xa169('0x2d')],'type':_0x2249ae[_0xa169('0x2e')][_0xa169('0x2f')]};});_0x29583c[_0xa169('0x30')]=_[_0xa169('0x2a')](_0x1978d0,'name');_0x29583c['query']=_[_0xa169('0x31')](_0x4a4468[_0xa169('0x32')]);_0x29583c[_0xa169('0x33')]=_['intersection'](_0x29583c[_0xa169('0x30')],_0x29583c[_0xa169('0x32')]);_0x1c8fe9[_0xa169('0x34')]=_[_0xa169('0x35')](_0x29583c[_0xa169('0x30')],qs['fields'](_0x4a4468[_0xa169('0x32')][_0xa169('0x36')]));_0x1c8fe9[_0xa169('0x34')]=_0x1c8fe9[_0xa169('0x34')]['length']?_0x1c8fe9['attributes']:_0x29583c[_0xa169('0x30')];if(!_0x4a4468['query'][_0xa169('0x37')]('nolimit')){_0x1c8fe9[_0xa169('0x1d')]=qs[_0xa169('0x1d')](_0x4a4468[_0xa169('0x32')]['limit']);_0x1c8fe9[_0xa169('0x1c')]=qs['offset'](_0x4a4468['query'][_0xa169('0x1c')]);}_0x1c8fe9[_0xa169('0x38')]=qs[_0xa169('0x39')](_0x4a4468[_0xa169('0x32')][_0xa169('0x39')]);_0x1c8fe9['where']=qs[_0xa169('0x33')](_[_0xa169('0x3a')](_0x4a4468['query'],_0x29583c[_0xa169('0x33')]),_0x1978d0);if(_0x4a4468[_0xa169('0x32')][_0xa169('0x3b')]){_0x1c8fe9[_0xa169('0x3c')]=_['merge'](_0x1c8fe9[_0xa169('0x3c')],{'$or':_['map'](_0x1978d0,function(_0x48dc08){if(_0x48dc08[_0xa169('0x2e')]!==_0xa169('0x3d')){var _0x23bbf1={};_0x23bbf1[_0x48dc08[_0xa169('0x27')]]={'$like':'%'+_0x4a4468[_0xa169('0x32')]['filter']+'%'};return _0x23bbf1;}})});}_0x1c8fe9=_[_0xa169('0x3e')]({},_0x1c8fe9,_0x4a4468['options']);var _0x4eddbc={'where':_0x1c8fe9[_0xa169('0x3c')]};return db[_0xa169('0x2b')]['count'](_0x4eddbc)[_0xa169('0x3f')](function(_0x444b22){_0x56bea8[_0xa169('0x1f')]=_0x444b22;if(_0x4a4468[_0xa169('0x32')]['includeAll']){_0x1c8fe9[_0xa169('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x1c8fe9);})[_0xa169('0x3f')](function(_0x172c2d){_0x56bea8[_0xa169('0x41')]=_0x172c2d;return _0x56bea8;})[_0xa169('0x3f')](respondWithFilteredResult(_0x58d517,_0x1c8fe9))[_0xa169('0x42')](handleError(_0x58d517,null));};exports[_0xa169('0x43')]=function(_0x3769fc,_0x572f23){var _0x15805e={'raw':!![],'where':{'id':_0x3769fc[_0xa169('0x44')]['id']}},_0x6b5afe={};_0x6b5afe[_0xa169('0x30')]=_[_0xa169('0x31')](db['SquareReport']['rawAttributes']);_0x6b5afe['query']=_[_0xa169('0x31')](_0x3769fc[_0xa169('0x32')]);_0x6b5afe[_0xa169('0x33')]=_[_0xa169('0x35')](_0x6b5afe[_0xa169('0x30')],_0x6b5afe[_0xa169('0x32')]);_0x15805e[_0xa169('0x34')]=_[_0xa169('0x35')](_0x6b5afe[_0xa169('0x30')],qs[_0xa169('0x36')](_0x3769fc[_0xa169('0x32')][_0xa169('0x36')]));_0x15805e[_0xa169('0x34')]=_0x15805e[_0xa169('0x34')][_0xa169('0x45')]?_0x15805e[_0xa169('0x34')]:_0x6b5afe[_0xa169('0x30')];if(_0x3769fc[_0xa169('0x32')][_0xa169('0x46')]){_0x15805e['include']=[{'all':!![]}];}_0x15805e=_[_0xa169('0x3e')]({},_0x15805e,_0x3769fc['options']);return db[_0xa169('0x2b')][_0xa169('0x47')](_0x15805e)[_0xa169('0x3f')](handleEntityNotFound(_0x572f23,null))[_0xa169('0x3f')](respondWithResult(_0x572f23,null))[_0xa169('0x42')](handleError(_0x572f23,null));};exports['create']=function(_0x1e16ab,_0x37ebe4){return db[_0xa169('0x2b')][_0xa169('0x48')](_0x1e16ab[_0xa169('0x49')],{})[_0xa169('0x3f')](respondWithResult(_0x37ebe4,0xc9))[_0xa169('0x42')](handleError(_0x37ebe4,null));};exports[_0xa169('0x24')]=function(_0xbb5faa,_0x59c8cb){if(_0xbb5faa[_0xa169('0x49')]['id']){delete _0xbb5faa[_0xa169('0x49')]['id'];}return db[_0xa169('0x2b')][_0xa169('0x47')]({'where':{'id':_0xbb5faa[_0xa169('0x44')]['id']}})[_0xa169('0x3f')](handleEntityNotFound(_0x59c8cb,null))[_0xa169('0x3f')](saveUpdates(_0xbb5faa[_0xa169('0x49')],null))[_0xa169('0x3f')](respondWithResult(_0x59c8cb,null))[_0xa169('0x42')](handleError(_0x59c8cb,null));};exports[_0xa169('0x4a')]=function(_0x184e54,_0x1f0450){return db['SquareReport'][_0xa169('0x47')]({'where':{'id':_0x184e54[_0xa169('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f0450,null))[_0xa169('0x3f')](removeEntity(_0x1f0450,null))[_0xa169('0x42')](handleError(_0x1f0450,null));};exports['describe']=function(_0x1e0681,_0x3eea74){return db[_0xa169('0x2b')][_0xa169('0x4b')]()[_0xa169('0x3f')](respondWithResult(_0x3eea74,null))[_0xa169('0x42')](handleError(_0x3eea74,null));}; \ No newline at end of file +var _0xa1c6=['order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','apply','save','update','then','end','sendStatus','stack','name','send','map','SquareReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x52ead0,_0x5bd6de){var _0x3c0098=function(_0x57eba7){while(--_0x57eba7){_0x52ead0['push'](_0x52ead0['shift']());}};_0x3c0098(++_0x5bd6de);}(_0xa1c6,0x135));var _0x6a1c=function(_0x136715,_0x2d0231){_0x136715=_0x136715-0x0;var _0x312959=_0xa1c6[_0x136715];return _0x312959;};'use strict';var emlformat=require(_0x6a1c('0x0'));var rimraf=require(_0x6a1c('0x1'));var zipdir=require(_0x6a1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a1c('0x3'));var moment=require(_0x6a1c('0x4'));var BPromise=require(_0x6a1c('0x5'));var Mustache=require(_0x6a1c('0x6'));var util=require(_0x6a1c('0x7'));var path=require(_0x6a1c('0x8'));var sox=require(_0x6a1c('0x9'));var csv=require(_0x6a1c('0xa'));var ejs=require(_0x6a1c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a1c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a1c('0xa'));var querystring=require(_0x6a1c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a1c('0xe'));var as=require(_0x6a1c('0xf'));var hardwareService=require(_0x6a1c('0x10'));var logger=require('../../config/logger')(_0x6a1c('0x11'));var utils=require(_0x6a1c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6a1c('0x13'));var db=require(_0x6a1c('0x14'))['db'];function respondWithStatusCode(_0x6fca9e,_0x532043){_0x532043=_0x532043||0xcc;return function(_0x165881){if(_0x165881){return _0x6fca9e['sendStatus'](_0x532043);}return _0x6fca9e['status'](_0x532043)['end']();};}function respondWithResult(_0x3cd26d,_0x312402){_0x312402=_0x312402||0xc8;return function(_0x5b6646){if(_0x5b6646){return _0x3cd26d['status'](_0x312402)[_0x6a1c('0x15')](_0x5b6646);}};}function respondWithFilteredResult(_0x5c46ee,_0x45fbae){return function(_0x5ab2bb){if(_0x5ab2bb){var _0x569c6c=typeof _0x45fbae[_0x6a1c('0x16')]===_0x6a1c('0x17')&&typeof _0x45fbae[_0x6a1c('0x18')]===_0x6a1c('0x17');var _0xbaf24e=_0x5ab2bb[_0x6a1c('0x19')];var _0x1dd376=_0x569c6c?0x0:_0x45fbae[_0x6a1c('0x16')];var _0x5cba0e=_0x569c6c?_0x5ab2bb[_0x6a1c('0x19')]:_0x45fbae[_0x6a1c('0x16')]+_0x45fbae[_0x6a1c('0x18')];var _0x43cd97;if(_0x5cba0e>=_0xbaf24e){_0x5cba0e=_0xbaf24e;_0x43cd97=0xc8;}else{_0x43cd97=0xce;}_0x5c46ee[_0x6a1c('0x1a')](_0x43cd97);return _0x5c46ee[_0x6a1c('0x1b')]('Content-Range',_0x1dd376+'-'+_0x5cba0e+'/'+_0xbaf24e)[_0x6a1c('0x15')](_0x5ab2bb);}return null;};}function patchUpdates(_0x48581e){return function(_0x3e9dcc){try{jsonpatch[_0x6a1c('0x1c')](_0x3e9dcc,_0x48581e,!![]);}catch(_0x11ca4){return BPromise['reject'](_0x11ca4);}return _0x3e9dcc[_0x6a1c('0x1d')]();};}function saveUpdates(_0x527726,_0x30f277){return function(_0x1722e5){if(_0x1722e5){return _0x1722e5[_0x6a1c('0x1e')](_0x527726)[_0x6a1c('0x1f')](function(_0x4fef56){return _0x4fef56;});}return null;};}function removeEntity(_0x3f33f9,_0x307b59){return function(_0x150dc7){if(_0x150dc7){return _0x150dc7['destroy']()[_0x6a1c('0x1f')](function(){_0x3f33f9['status'](0xcc)[_0x6a1c('0x20')]();});}};}function handleEntityNotFound(_0x3f09a1,_0x1545c9){return function(_0x177641){if(!_0x177641){_0x3f09a1[_0x6a1c('0x21')](0x194);}return _0x177641;};}function handleError(_0x5103f3,_0x46efe5){_0x46efe5=_0x46efe5||0x1f4;return function(_0x50d9d9){logger['error'](_0x50d9d9[_0x6a1c('0x22')]);if(_0x50d9d9[_0x6a1c('0x23')]){delete _0x50d9d9[_0x6a1c('0x23')];}_0x5103f3['status'](_0x46efe5)[_0x6a1c('0x24')](_0x50d9d9);};}exports['index']=function(_0x56db75,_0x951c84){var _0x457fbc={},_0x53fb5d={},_0x126c53={'count':0x0,'rows':[]};var _0x5b9de6=_[_0x6a1c('0x25')](db[_0x6a1c('0x26')]['rawAttributes'],function(_0xaa7ead){return{'name':_0xaa7ead[_0x6a1c('0x27')],'type':_0xaa7ead[_0x6a1c('0x28')][_0x6a1c('0x29')]};});_0x53fb5d[_0x6a1c('0x2a')]=_[_0x6a1c('0x25')](_0x5b9de6,_0x6a1c('0x23'));_0x53fb5d[_0x6a1c('0x2b')]=_[_0x6a1c('0x2c')](_0x56db75[_0x6a1c('0x2b')]);_0x53fb5d['filters']=_[_0x6a1c('0x2d')](_0x53fb5d[_0x6a1c('0x2a')],_0x53fb5d[_0x6a1c('0x2b')]);_0x457fbc[_0x6a1c('0x2e')]=_[_0x6a1c('0x2d')](_0x53fb5d[_0x6a1c('0x2a')],qs[_0x6a1c('0x2f')](_0x56db75[_0x6a1c('0x2b')]['fields']));_0x457fbc['attributes']=_0x457fbc[_0x6a1c('0x2e')][_0x6a1c('0x30')]?_0x457fbc[_0x6a1c('0x2e')]:_0x53fb5d[_0x6a1c('0x2a')];if(!_0x56db75[_0x6a1c('0x2b')][_0x6a1c('0x31')](_0x6a1c('0x32'))){_0x457fbc[_0x6a1c('0x18')]=qs['limit'](_0x56db75[_0x6a1c('0x2b')][_0x6a1c('0x18')]);_0x457fbc['offset']=qs[_0x6a1c('0x16')](_0x56db75[_0x6a1c('0x2b')]['offset']);}_0x457fbc[_0x6a1c('0x33')]=qs[_0x6a1c('0x34')](_0x56db75['query'][_0x6a1c('0x34')]);_0x457fbc[_0x6a1c('0x35')]=qs[_0x6a1c('0x36')](_['pick'](_0x56db75[_0x6a1c('0x2b')],_0x53fb5d[_0x6a1c('0x36')]),_0x5b9de6);if(_0x56db75[_0x6a1c('0x2b')][_0x6a1c('0x37')]){_0x457fbc[_0x6a1c('0x35')]=_[_0x6a1c('0x38')](_0x457fbc[_0x6a1c('0x35')],{'$or':_[_0x6a1c('0x25')](_0x5b9de6,function(_0x2a5d5f){if(_0x2a5d5f[_0x6a1c('0x28')]!==_0x6a1c('0x39')){var _0x1f6a18={};_0x1f6a18[_0x2a5d5f[_0x6a1c('0x23')]]={'$like':'%'+_0x56db75['query']['filter']+'%'};return _0x1f6a18;}})});}_0x457fbc=_[_0x6a1c('0x38')]({},_0x457fbc,_0x56db75[_0x6a1c('0x3a')]);var _0x48bfda={'where':_0x457fbc[_0x6a1c('0x35')]};return db[_0x6a1c('0x26')][_0x6a1c('0x19')](_0x48bfda)[_0x6a1c('0x1f')](function(_0xd1d760){_0x126c53[_0x6a1c('0x19')]=_0xd1d760;if(_0x56db75['query'][_0x6a1c('0x3b')]){_0x457fbc['include']=[{'all':!![]}];}return db['SquareReport'][_0x6a1c('0x3c')](_0x457fbc);})[_0x6a1c('0x1f')](function(_0x24f38e){_0x126c53[_0x6a1c('0x3d')]=_0x24f38e;return _0x126c53;})[_0x6a1c('0x1f')](respondWithFilteredResult(_0x951c84,_0x457fbc))['catch'](handleError(_0x951c84,null));};exports[_0x6a1c('0x3e')]=function(_0x1e222a,_0x1bab61){var _0x37b92f={'raw':!![],'where':{'id':_0x1e222a[_0x6a1c('0x3f')]['id']}},_0x5bb4fd={};_0x5bb4fd[_0x6a1c('0x2a')]=_[_0x6a1c('0x2c')](db[_0x6a1c('0x26')][_0x6a1c('0x40')]);_0x5bb4fd[_0x6a1c('0x2b')]=_[_0x6a1c('0x2c')](_0x1e222a['query']);_0x5bb4fd['filters']=_[_0x6a1c('0x2d')](_0x5bb4fd[_0x6a1c('0x2a')],_0x5bb4fd['query']);_0x37b92f[_0x6a1c('0x2e')]=_[_0x6a1c('0x2d')](_0x5bb4fd[_0x6a1c('0x2a')],qs['fields'](_0x1e222a[_0x6a1c('0x2b')][_0x6a1c('0x2f')]));_0x37b92f[_0x6a1c('0x2e')]=_0x37b92f[_0x6a1c('0x2e')][_0x6a1c('0x30')]?_0x37b92f[_0x6a1c('0x2e')]:_0x5bb4fd[_0x6a1c('0x2a')];if(_0x1e222a[_0x6a1c('0x2b')]['includeAll']){_0x37b92f[_0x6a1c('0x41')]=[{'all':!![]}];}_0x37b92f=_[_0x6a1c('0x38')]({},_0x37b92f,_0x1e222a[_0x6a1c('0x3a')]);return db[_0x6a1c('0x26')][_0x6a1c('0x42')](_0x37b92f)['then'](handleEntityNotFound(_0x1bab61,null))[_0x6a1c('0x1f')](respondWithResult(_0x1bab61,null))[_0x6a1c('0x43')](handleError(_0x1bab61,null));};exports[_0x6a1c('0x44')]=function(_0x4198f5,_0x31c3ce){return db[_0x6a1c('0x26')][_0x6a1c('0x44')](_0x4198f5[_0x6a1c('0x45')],{})[_0x6a1c('0x1f')](respondWithResult(_0x31c3ce,0xc9))[_0x6a1c('0x43')](handleError(_0x31c3ce,null));};exports[_0x6a1c('0x1e')]=function(_0x5c06e7,_0x5b5d6a){if(_0x5c06e7[_0x6a1c('0x45')]['id']){delete _0x5c06e7[_0x6a1c('0x45')]['id'];}return db[_0x6a1c('0x26')][_0x6a1c('0x42')]({'where':{'id':_0x5c06e7['params']['id']}})[_0x6a1c('0x1f')](handleEntityNotFound(_0x5b5d6a,null))[_0x6a1c('0x1f')](saveUpdates(_0x5c06e7['body'],null))[_0x6a1c('0x1f')](respondWithResult(_0x5b5d6a,null))[_0x6a1c('0x43')](handleError(_0x5b5d6a,null));};exports[_0x6a1c('0x46')]=function(_0x3105c9,_0x2abb9e){return db[_0x6a1c('0x26')][_0x6a1c('0x42')]({'where':{'id':_0x3105c9[_0x6a1c('0x3f')]['id']}})[_0x6a1c('0x1f')](handleEntityNotFound(_0x2abb9e,null))[_0x6a1c('0x1f')](removeEntity(_0x2abb9e,null))[_0x6a1c('0x43')](handleError(_0x2abb9e,null));};exports[_0x6a1c('0x47')]=function(_0x118e05,_0x41778f){return db['SquareReport'][_0x6a1c('0x47')]()[_0x6a1c('0x1f')](respondWithResult(_0x41778f,null))[_0x6a1c('0x43')](handleError(_0x41778f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d27dd69..2c156a3 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 _0xb88b=['../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xb88b,0x89));var _0xbb88=function(_0x1c02e1,_0x89b77b){_0x1c02e1=_0x1c02e1-0x0;var _0x2542f5=_0xb88b[_0x1c02e1];return _0x2542f5;};'use strict';var _=require(_0xbb88('0x0'));var util=require(_0xbb88('0x1'));var logger=require('../../config/logger')(_0xbb88('0x2'));var moment=require(_0xbb88('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb88('0x4'));var fs=require('fs');var path=require(_0xbb88('0x5'));var rimraf=require(_0xbb88('0x6'));var config=require(_0xbb88('0x7'));var attributes=require('./squareReport.attributes');module[_0xbb88('0x8')]=function(_0x453070,_0x162584){return _0x453070[_0xbb88('0x9')](_0xbb88('0xa'),attributes,{'tableName':_0xbb88('0xb'),'paranoid':![],'indexes':[{'name':_0xbb88('0xc'),'fields':[_0xbb88('0xd'),_0xbb88('0xe')]},{'name':_0xbb88('0xf'),'fields':[_0xbb88('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x566d=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareReport','report_square','uniqueid'];(function(_0x15c079,_0x37306c){var _0x58f240=function(_0x757d98){while(--_0x757d98){_0x15c079['push'](_0x15c079['shift']());}};_0x58f240(++_0x37306c);}(_0x566d,0x192));var _0xd566=function(_0x32dc88,_0x18577a){_0x32dc88=_0x32dc88-0x0;var _0x12c67=_0x566d[_0x32dc88];return _0x12c67;};'use strict';var _=require(_0xd566('0x0'));var util=require(_0xd566('0x1'));var logger=require(_0xd566('0x2'))(_0xd566('0x3'));var moment=require(_0xd566('0x4'));var BPromise=require(_0xd566('0x5'));var rp=require(_0xd566('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd566('0x7'));var config=require(_0xd566('0x8'));var attributes=require('./squareReport.attributes');module[_0xd566('0x9')]=function(_0x59b0a,_0x2d7678){return _0x59b0a[_0xd566('0xa')](_0xd566('0xb'),attributes,{'tableName':_0xd566('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xd566('0xd'),_0xd566('0xe')]},{'name':_0xd566('0xf'),'fields':[_0xd566('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6bed106..6981d6f 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 _0x09a7=['request\x20sent','stringify','error','message','catch','CreateSquareReport','SquareReport','create','options','UpdateSquareReport','raw','where','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x156e31,_0x5684ed){var _0x40c4df=function(_0x15a98d){while(--_0x15a98d){_0x156e31['push'](_0x156e31['shift']());}};_0x40c4df(++_0x5684ed);}(_0x09a7,0x196));var _0x709a=function(_0x43a5e2,_0x1ce9d1){_0x43a5e2=_0x43a5e2-0x0;var _0x2252a9=_0x09a7[_0x43a5e2];return _0x2252a9;};'use strict';var _=require(_0x709a('0x0'));var util=require(_0x709a('0x1'));var moment=require(_0x709a('0x2'));var BPromise=require(_0x709a('0x3'));var rs=require(_0x709a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x709a('0x5'))['db'];var utils=require(_0x709a('0x6'));var logger=require('../../config/logger')(_0x709a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x709a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545aa7,_0x4d4b5b,_0x37b26f){return new BPromise(function(_0x258b54,_0x2091e5){return client[_0x709a('0x9')](_0x545aa7,_0x37b26f)[_0x709a('0xa')](function(_0x3aaf80){logger[_0x709a('0xb')](_0x709a('0xc'),_0x4d4b5b,'request\x20sent');logger['debug'](_0x709a('0xd'),_0x4d4b5b,_0x709a('0xe'),JSON[_0x709a('0xf')](_0x3aaf80));if(_0x3aaf80[_0x709a('0x10')]){if(_0x3aaf80[_0x709a('0x10')]['code']===0x1f4){logger[_0x709a('0x10')](_0x709a('0xc'),_0x4d4b5b,_0x3aaf80[_0x709a('0x10')][_0x709a('0x11')]);return _0x2091e5(_0x3aaf80[_0x709a('0x10')]['message']);}logger[_0x709a('0x10')](_0x709a('0xc'),_0x4d4b5b,_0x3aaf80['error']['message']);return _0x258b54(_0x3aaf80[_0x709a('0x10')][_0x709a('0x11')]);}else{logger[_0x709a('0xb')]('SquareReport,\x20%s,\x20%s',_0x4d4b5b,'request\x20sent');_0x258b54(_0x3aaf80['result'][_0x709a('0x11')]);}})[_0x709a('0x12')](function(_0x38789d){logger['error'](_0x709a('0xc'),_0x4d4b5b,_0x38789d);_0x2091e5(_0x38789d);});});}exports[_0x709a('0x13')]=function(_0x5641cb){var _0x54e3da=this;return new Promise(function(_0xa0b929,_0x3a8678){return db[_0x709a('0x14')][_0x709a('0x15')](_0x5641cb['body'],{'raw':_0x5641cb[_0x709a('0x16')]?_0x5641cb[_0x709a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x709a('0xa')](function(_0x4defd0){logger[_0x709a('0xb')]('CreateSquareReport',_0x5641cb);logger['debug'](_0x709a('0x13'),_0x5641cb,JSON['stringify'](_0x4defd0));_0xa0b929(_0x4defd0);})[_0x709a('0x12')](function(_0x132872){logger['error'](_0x709a('0x13'),_0x132872[_0x709a('0x11')],_0x5641cb);_0x3a8678(_0x54e3da[_0x709a('0x10')](0x1f4,_0x132872[_0x709a('0x11')]));});});};exports[_0x709a('0x17')]=function(_0x3aaf2f){var _0x10e789=this;return new Promise(function(_0x34ba98,_0x74ded1){return db['SquareReport']['update'](_0x3aaf2f['body'],{'raw':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f['options'][_0x709a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aaf2f['options']?_0x3aaf2f['options'][_0x709a('0x19')]||null:null,'attributes':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f[_0x709a('0x16')][_0x709a('0x1a')]||null:null,'limit':_0x3aaf2f[_0x709a('0x16')]?_0x3aaf2f['options']['limit']||null:null})[_0x709a('0xa')](function(_0xae2c3f){logger[_0x709a('0xb')](_0x709a('0x17'),_0x3aaf2f);logger[_0x709a('0x1b')](_0x709a('0x17'),_0x3aaf2f,JSON['stringify'](_0xae2c3f));_0x34ba98(_0xae2c3f);})['catch'](function(_0x535192){logger[_0x709a('0x10')]('UpdateSquareReport',_0x535192['message'],_0x3aaf2f);_0x74ded1(_0x10e789[_0x709a('0x10')](0x1f4,_0x535192[_0x709a('0x11')]));});});}; \ No newline at end of file +var _0xe4b5=['options','then','debug','UpdateSquareReport','update','raw','where','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body'];(function(_0x28619e,_0x2466d7){var _0x1f4df4=function(_0x398f34){while(--_0x398f34){_0x28619e['push'](_0x28619e['shift']());}};_0x1f4df4(++_0x2466d7);}(_0xe4b5,0x19e));var _0x5e4b=function(_0x1522f7,_0x3e83d5){_0x1522f7=_0x1522f7-0x0;var _0x3a2c34=_0xe4b5[_0x1522f7];return _0x3a2c34;};'use strict';var _=require(_0x5e4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5e4b('0x1'));var rs=require(_0x5e4b('0x2'));var fs=require('fs');var Redis=require(_0x5e4b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e4b('0x4'));var logger=require(_0x5e4b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e4b('0x6'));var client=jayson['client'][_0x5e4b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b275f,_0x41bc0a,_0x2937c3){return new BPromise(function(_0x1eae39,_0x205f75){return client['request'](_0x1b275f,_0x2937c3)['then'](function(_0x210b52){logger[_0x5e4b('0x8')](_0x5e4b('0x9'),_0x41bc0a,_0x5e4b('0xa'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x41bc0a,_0x5e4b('0xa'),JSON[_0x5e4b('0xb')](_0x210b52));if(_0x210b52[_0x5e4b('0xc')]){if(_0x210b52[_0x5e4b('0xc')][_0x5e4b('0xd')]===0x1f4){logger[_0x5e4b('0xc')]('SquareReport,\x20%s,\x20%s',_0x41bc0a,_0x210b52['error'][_0x5e4b('0xe')]);return _0x205f75(_0x210b52[_0x5e4b('0xc')][_0x5e4b('0xe')]);}logger[_0x5e4b('0xc')]('SquareReport,\x20%s,\x20%s',_0x41bc0a,_0x210b52[_0x5e4b('0xc')][_0x5e4b('0xe')]);return _0x1eae39(_0x210b52[_0x5e4b('0xc')][_0x5e4b('0xe')]);}else{logger[_0x5e4b('0x8')](_0x5e4b('0x9'),_0x41bc0a,_0x5e4b('0xa'));_0x1eae39(_0x210b52[_0x5e4b('0xf')][_0x5e4b('0xe')]);}})[_0x5e4b('0x10')](function(_0x2dbe10){logger[_0x5e4b('0xc')](_0x5e4b('0x9'),_0x41bc0a,_0x2dbe10);_0x205f75(_0x2dbe10);});});}exports[_0x5e4b('0x11')]=function(_0x3b78ca){var _0x16d76d=this;return new Promise(function(_0x2dc559,_0x1791eb){return db[_0x5e4b('0x12')][_0x5e4b('0x13')](_0x3b78ca[_0x5e4b('0x14')],{'raw':_0x3b78ca['options']?_0x3b78ca[_0x5e4b('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x5e4b('0x16')](function(_0x2595a6){logger[_0x5e4b('0x8')](_0x5e4b('0x11'),_0x3b78ca);logger[_0x5e4b('0x17')](_0x5e4b('0x11'),_0x3b78ca,JSON['stringify'](_0x2595a6));_0x2dc559(_0x2595a6);})[_0x5e4b('0x10')](function(_0x74b6d2){logger[_0x5e4b('0xc')](_0x5e4b('0x11'),_0x74b6d2[_0x5e4b('0xe')],_0x3b78ca);_0x1791eb(_0x16d76d[_0x5e4b('0xc')](0x1f4,_0x74b6d2[_0x5e4b('0xe')]));});});};exports[_0x5e4b('0x18')]=function(_0x4c36d0){var _0x17fce8=this;return new Promise(function(_0x8275d9,_0x40ffc3){return db['SquareReport'][_0x5e4b('0x19')](_0x4c36d0[_0x5e4b('0x14')],{'raw':_0x4c36d0['options']?_0x4c36d0[_0x5e4b('0x15')][_0x5e4b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c36d0[_0x5e4b('0x15')]?_0x4c36d0[_0x5e4b('0x15')][_0x5e4b('0x1b')]||null:null,'attributes':_0x4c36d0['options']?_0x4c36d0[_0x5e4b('0x15')]['attributes']||null:null,'limit':_0x4c36d0[_0x5e4b('0x15')]?_0x4c36d0[_0x5e4b('0x15')][_0x5e4b('0x1c')]||null:null})[_0x5e4b('0x16')](function(_0x3fe5da){logger[_0x5e4b('0x8')]('UpdateSquareReport',_0x4c36d0);logger[_0x5e4b('0x17')]('UpdateSquareReport',_0x4c36d0,JSON[_0x5e4b('0xb')](_0x3fe5da));_0x8275d9(_0x3fe5da);})['catch'](function(_0x586e9f){logger[_0x5e4b('0xc')]('UpdateSquareReport',_0x586e9f[_0x5e4b('0xe')],_0x4c36d0);_0x40ffc3(_0x17fce8['error'](0x1f4,_0x586e9f[_0x5e4b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c80aacc..a8e55fd 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 _0x8220=['express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','create','put','update','delete','util'];(function(_0x12e908,_0x1094f4){var _0x27985b=function(_0x1b5ded){while(--_0x1b5ded){_0x12e908['push'](_0x12e908['shift']());}};_0x27985b(++_0x1094f4);}(_0x8220,0x1df));var _0x0822=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0x8220[_0x1b0c08];return _0x123dbf;};'use strict';var multer=require('multer');var util=require(_0x0822('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0822('0x1'));var router=express[_0x0822('0x2')]();var fs_extra=require(_0x0822('0x3'));var auth=require(_0x0822('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0822('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x0822('0x6')](),controller[_0x0822('0x7')]);router['get']('/describe',auth[_0x0822('0x6')](),controller[_0x0822('0x8')]);router[_0x0822('0x9')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller[_0x0822('0xb')]);router['post']('/',auth[_0x0822('0x6')](),controller[_0x0822('0xc')]);router[_0x0822('0xd')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller[_0x0822('0xe')]);router[_0x0822('0xf')](_0x0822('0xa'),auth[_0x0822('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbb16=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x913b85,_0x213182){var _0x1ce434=function(_0x4c9c8b){while(--_0x4c9c8b){_0x913b85['push'](_0x913b85['shift']());}};_0x1ce434(++_0x213182);}(_0xbb16,0x125));var _0x6bb1=function(_0x2f1383,_0x1aded6){_0x2f1383=_0x2f1383-0x0;var _0x928e32=_0xbb16[_0x2f1383];return _0x928e32;};'use strict';var multer=require(_0x6bb1('0x0'));var util=require('util');var path=require(_0x6bb1('0x1'));var timeout=require(_0x6bb1('0x2'));var express=require('express');var router=express[_0x6bb1('0x3')]();var fs_extra=require(_0x6bb1('0x4'));var auth=require(_0x6bb1('0x5'));var interaction=require(_0x6bb1('0x6'));var config=require(_0x6bb1('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x6bb1('0x8')](),controller[_0x6bb1('0x9')]);router[_0x6bb1('0xa')](_0x6bb1('0xb'),auth['isAuthenticated'](),controller[_0x6bb1('0xc')]);router['get'](_0x6bb1('0xd'),auth[_0x6bb1('0x8')](),controller[_0x6bb1('0xe')]);router['post']('/',auth[_0x6bb1('0x8')](),controller[_0x6bb1('0xf')]);router[_0x6bb1('0x10')](_0x6bb1('0xd'),auth[_0x6bb1('0x8')](),controller[_0x6bb1('0x11')]);router['delete']('/:id',auth[_0x6bb1('0x8')](),controller[_0x6bb1('0x12')]);module[_0x6bb1('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4f18a25..ff3e244 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 _0xde8b=['TEXT','STRING'];(function(_0x102e5e,_0x2a74e0){var _0x43ecab=function(_0xb94a70){while(--_0xb94a70){_0x102e5e['push'](_0x102e5e['shift']());}};_0x43ecab(++_0x2a74e0);}(_0xde8b,0xa3));var _0xbde8=function(_0x506067,_0xda5c79){_0x506067=_0x506067-0x0;var _0x3a3ff1=_0xde8b[_0x506067];return _0x3a3ff1;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbde8('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xbde8('0x0')]},'data':{'type':Sequelize[_0xbde8('0x1')]},'project_name':{'type':Sequelize[_0xbde8('0x0')]},'callerid':{'type':Sequelize[_0xbde8('0x0')]}}; \ No newline at end of file +var _0x8285=['STRING','TEXT','exports'];(function(_0x5169a5,_0x230269){var _0x453558=function(_0x4d8cc6){while(--_0x4d8cc6){_0x5169a5['push'](_0x5169a5['shift']());}};_0x453558(++_0x230269);}(_0x8285,0x1cd));var _0x5828=function(_0x4163fd,_0x1da4ce){_0x4163fd=_0x4163fd-0x0;var _0xbc0548=_0x8285[_0x4163fd];return _0xbc0548;};'use strict';var Sequelize=require('sequelize');module[_0x5828('0x0')]={'uniqueid':{'type':Sequelize[_0x5828('0x1')]},'node':{'type':Sequelize[_0x5828('0x1')]},'application':{'type':Sequelize[_0x5828('0x1')]},'data':{'type':Sequelize[_0x5828('0x2')]},'project_name':{'type':Sequelize[_0x5828('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index eac1da1..d9addd3 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 _0x69a8=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','apply','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','order','sort','where','VIRTUAL','merge','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body'];(function(_0x1be137,_0x3f1753){var _0x4d9d09=function(_0x3b4dd8){while(--_0x3b4dd8){_0x1be137['push'](_0x1be137['shift']());}};_0x4d9d09(++_0x3f1753);}(_0x69a8,0x1c2));var _0x869a=function(_0x41fbb1,_0x1a226b){_0x41fbb1=_0x41fbb1-0x0;var _0x3ddd72=_0x69a8[_0x41fbb1];return _0x3ddd72;};'use strict';var emlformat=require(_0x869a('0x0'));var rimraf=require(_0x869a('0x1'));var zipdir=require(_0x869a('0x2'));var jsonpatch=require(_0x869a('0x3'));var rp=require(_0x869a('0x4'));var moment=require(_0x869a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x869a('0x6'));var path=require(_0x869a('0x7'));var sox=require(_0x869a('0x8'));var csv=require(_0x869a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x869a('0xa'));var _=require(_0x869a('0xb'));var squel=require(_0x869a('0xc'));var crypto=require(_0x869a('0xd'));var jsforce=require(_0x869a('0xe'));var deskjs=require(_0x869a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x869a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x869a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x869a('0x12'));var hardwareService=require(_0x869a('0x13'));var logger=require(_0x869a('0x14'))(_0x869a('0x15'));var utils=require(_0x869a('0x16'));var config=require(_0x869a('0x17'));var licenseUtil=require(_0x869a('0x18'));var db=require(_0x869a('0x19'))['db'];function respondWithStatusCode(_0xa4a9a7,_0x3c587f){_0x3c587f=_0x3c587f||0xcc;return function(_0x52656e){if(_0x52656e){return _0xa4a9a7[_0x869a('0x1a')](_0x3c587f);}return _0xa4a9a7[_0x869a('0x1b')](_0x3c587f)['end']();};}function respondWithResult(_0x4a7f7b,_0x5d94ad){_0x5d94ad=_0x5d94ad||0xc8;return function(_0x2cb89a){if(_0x2cb89a){return _0x4a7f7b[_0x869a('0x1b')](_0x5d94ad)[_0x869a('0x1c')](_0x2cb89a);}};}function respondWithFilteredResult(_0x1f6669,_0x23bdec){return function(_0x45bece){if(_0x45bece){var _0xcad7f4=typeof _0x23bdec['offset']==='undefined'&&typeof _0x23bdec[_0x869a('0x1d')]===_0x869a('0x1e');var _0x173a9a=_0x45bece['count'];var _0x225619=_0xcad7f4?0x0:_0x23bdec[_0x869a('0x1f')];var _0x5317bc=_0xcad7f4?_0x45bece[_0x869a('0x20')]:_0x23bdec[_0x869a('0x1f')]+_0x23bdec[_0x869a('0x1d')];var _0x1fe01f;if(_0x5317bc>=_0x173a9a){_0x5317bc=_0x173a9a;_0x1fe01f=0xc8;}else{_0x1fe01f=0xce;}_0x1f6669[_0x869a('0x1b')](_0x1fe01f);return _0x1f6669[_0x869a('0x21')]('Content-Range',_0x225619+'-'+_0x5317bc+'/'+_0x173a9a)[_0x869a('0x1c')](_0x45bece);}return null;};}function patchUpdates(_0x3e93e1){return function(_0x2c199f){try{jsonpatch[_0x869a('0x22')](_0x2c199f,_0x3e93e1,!![]);}catch(_0x56eef6){return BPromise['reject'](_0x56eef6);}return _0x2c199f[_0x869a('0x23')]();};}function saveUpdates(_0x5d5104,_0x4992db){return function(_0x57adea){if(_0x57adea){return _0x57adea[_0x869a('0x24')](_0x5d5104)[_0x869a('0x25')](function(_0x3ac8d5){return _0x3ac8d5;});}return null;};}function removeEntity(_0xa32ea5,_0x5a4521){return function(_0x5f3bac){if(_0x5f3bac){return _0x5f3bac[_0x869a('0x26')]()[_0x869a('0x25')](function(){_0xa32ea5[_0x869a('0x1b')](0xcc)[_0x869a('0x27')]();});}};}function handleEntityNotFound(_0x367926,_0x492cc0){return function(_0x1310cc){if(!_0x1310cc){_0x367926[_0x869a('0x1a')](0x194);}return _0x1310cc;};}function handleError(_0xd45fc8,_0x5a70ad){_0x5a70ad=_0x5a70ad||0x1f4;return function(_0xba8714){logger[_0x869a('0x28')](_0xba8714[_0x869a('0x29')]);if(_0xba8714[_0x869a('0x2a')]){delete _0xba8714[_0x869a('0x2a')];}_0xd45fc8[_0x869a('0x1b')](_0x5a70ad)['send'](_0xba8714);};}exports[_0x869a('0x2b')]=function(_0x505e27,_0x48fed1){var _0x38004d={},_0x6b8bc4={},_0x43464e={'count':0x0,'rows':[]};var _0x5538f3=_[_0x869a('0x2c')](db['SquareDetailsReport'][_0x869a('0x2d')],function(_0x24db3c){return{'name':_0x24db3c[_0x869a('0x2e')],'type':_0x24db3c[_0x869a('0x2f')][_0x869a('0x30')]};});_0x6b8bc4['model']=_['map'](_0x5538f3,_0x869a('0x2a'));_0x6b8bc4[_0x869a('0x31')]=_[_0x869a('0x32')](_0x505e27[_0x869a('0x31')]);_0x6b8bc4[_0x869a('0x33')]=_['intersection'](_0x6b8bc4[_0x869a('0x34')],_0x6b8bc4[_0x869a('0x31')]);_0x38004d[_0x869a('0x35')]=_[_0x869a('0x36')](_0x6b8bc4[_0x869a('0x34')],qs['fields'](_0x505e27[_0x869a('0x31')]['fields']));_0x38004d['attributes']=_0x38004d[_0x869a('0x35')][_0x869a('0x37')]?_0x38004d[_0x869a('0x35')]:_0x6b8bc4['model'];if(!_0x505e27[_0x869a('0x31')]['hasOwnProperty'](_0x869a('0x38'))){_0x38004d['limit']=qs[_0x869a('0x1d')](_0x505e27[_0x869a('0x31')][_0x869a('0x1d')]);_0x38004d['offset']=qs['offset'](_0x505e27[_0x869a('0x31')]['offset']);}_0x38004d[_0x869a('0x39')]=qs[_0x869a('0x3a')](_0x505e27[_0x869a('0x31')][_0x869a('0x3a')]);_0x38004d[_0x869a('0x3b')]=qs[_0x869a('0x33')](_['pick'](_0x505e27[_0x869a('0x31')],_0x6b8bc4[_0x869a('0x33')]),_0x5538f3);if(_0x505e27[_0x869a('0x31')]['filter']){_0x38004d[_0x869a('0x3b')]=_['merge'](_0x38004d['where'],{'$or':_['map'](_0x5538f3,function(_0x2b76d2){if(_0x2b76d2[_0x869a('0x2f')]!==_0x869a('0x3c')){var _0x644c8a={};_0x644c8a[_0x2b76d2['name']]={'$like':'%'+_0x505e27[_0x869a('0x31')]['filter']+'%'};return _0x644c8a;}})});}_0x38004d=_[_0x869a('0x3d')]({},_0x38004d,_0x505e27[_0x869a('0x3e')]);var _0x14477b={'where':_0x38004d[_0x869a('0x3b')]};return db[_0x869a('0x3f')][_0x869a('0x20')](_0x14477b)[_0x869a('0x25')](function(_0x58a5b7){_0x43464e[_0x869a('0x20')]=_0x58a5b7;if(_0x505e27[_0x869a('0x31')][_0x869a('0x40')]){_0x38004d['include']=[{'all':!![]}];}return db[_0x869a('0x3f')][_0x869a('0x41')](_0x38004d);})[_0x869a('0x25')](function(_0x451583){_0x43464e[_0x869a('0x42')]=_0x451583;return _0x43464e;})[_0x869a('0x25')](respondWithFilteredResult(_0x48fed1,_0x38004d))[_0x869a('0x43')](handleError(_0x48fed1,null));};exports[_0x869a('0x44')]=function(_0x2d1c92,_0x4d35b6){var _0x66c5b4={'raw':!![],'where':{'id':_0x2d1c92[_0x869a('0x45')]['id']}},_0x3e1a7b={};_0x3e1a7b[_0x869a('0x34')]=_[_0x869a('0x32')](db[_0x869a('0x3f')][_0x869a('0x2d')]);_0x3e1a7b[_0x869a('0x31')]=_[_0x869a('0x32')](_0x2d1c92['query']);_0x3e1a7b['filters']=_[_0x869a('0x36')](_0x3e1a7b[_0x869a('0x34')],_0x3e1a7b[_0x869a('0x31')]);_0x66c5b4['attributes']=_[_0x869a('0x36')](_0x3e1a7b[_0x869a('0x34')],qs[_0x869a('0x46')](_0x2d1c92[_0x869a('0x31')][_0x869a('0x46')]));_0x66c5b4['attributes']=_0x66c5b4[_0x869a('0x35')][_0x869a('0x37')]?_0x66c5b4[_0x869a('0x35')]:_0x3e1a7b[_0x869a('0x34')];if(_0x2d1c92['query'][_0x869a('0x40')]){_0x66c5b4[_0x869a('0x47')]=[{'all':!![]}];}_0x66c5b4=_[_0x869a('0x3d')]({},_0x66c5b4,_0x2d1c92[_0x869a('0x3e')]);return db[_0x869a('0x3f')][_0x869a('0x48')](_0x66c5b4)[_0x869a('0x25')](handleEntityNotFound(_0x4d35b6,null))[_0x869a('0x25')](respondWithResult(_0x4d35b6,null))[_0x869a('0x43')](handleError(_0x4d35b6,null));};exports[_0x869a('0x49')]=function(_0x28abac,_0x4cd8b7){return db[_0x869a('0x3f')][_0x869a('0x49')](_0x28abac['body'],{})['then'](respondWithResult(_0x4cd8b7,0xc9))[_0x869a('0x43')](handleError(_0x4cd8b7,null));};exports[_0x869a('0x24')]=function(_0x467667,_0x528b76){if(_0x467667[_0x869a('0x4a')]['id']){delete _0x467667['body']['id'];}return db[_0x869a('0x3f')][_0x869a('0x48')]({'where':{'id':_0x467667[_0x869a('0x45')]['id']}})[_0x869a('0x25')](handleEntityNotFound(_0x528b76,null))[_0x869a('0x25')](saveUpdates(_0x467667['body'],null))[_0x869a('0x25')](respondWithResult(_0x528b76,null))[_0x869a('0x43')](handleError(_0x528b76,null));};exports[_0x869a('0x26')]=function(_0x5c8a33,_0x204d32){return db[_0x869a('0x3f')]['find']({'where':{'id':_0x5c8a33[_0x869a('0x45')]['id']}})[_0x869a('0x25')](handleEntityNotFound(_0x204d32,null))[_0x869a('0x25')](removeEntity(_0x204d32,null))[_0x869a('0x43')](handleError(_0x204d32,null));};exports['describe']=function(_0x3dbccb,_0x2bbed0){return db[_0x869a('0x3f')]['describe']()[_0x869a('0x25')](respondWithResult(_0x2bbed0,null))['catch'](handleError(_0x2bbed0,null));}; \ No newline at end of file +var _0x7bff=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7bff,0x16b));var _0xf7bf=function(_0x223abd,_0x1e9176){_0x223abd=_0x223abd-0x0;var _0x325643=_0x7bff[_0x223abd];return _0x325643;};'use strict';var emlformat=require(_0xf7bf('0x0'));var rimraf=require(_0xf7bf('0x1'));var zipdir=require(_0xf7bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7bf('0x3'));var moment=require('moment');var BPromise=require(_0xf7bf('0x4'));var Mustache=require(_0xf7bf('0x5'));var util=require(_0xf7bf('0x6'));var path=require(_0xf7bf('0x7'));var sox=require(_0xf7bf('0x8'));var csv=require(_0xf7bf('0x9'));var ejs=require(_0xf7bf('0xa'));var fs=require('fs');var fs_extra=require(_0xf7bf('0xb'));var _=require(_0xf7bf('0xc'));var squel=require('squel');var crypto=require(_0xf7bf('0xd'));var jsforce=require(_0xf7bf('0xe'));var deskjs=require(_0xf7bf('0xf'));var toCsv=require(_0xf7bf('0x9'));var querystring=require(_0xf7bf('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7bf('0x11'));var qs=require(_0xf7bf('0x12'));var as=require(_0xf7bf('0x13'));var hardwareService=require(_0xf7bf('0x14'));var logger=require(_0xf7bf('0x15'))(_0xf7bf('0x16'));var utils=require('../../config/utils');var config=require(_0xf7bf('0x17'));var licenseUtil=require(_0xf7bf('0x18'));var db=require(_0xf7bf('0x19'))['db'];function respondWithStatusCode(_0x53dd22,_0x5c1418){_0x5c1418=_0x5c1418||0xcc;return function(_0x541251){if(_0x541251){return _0x53dd22[_0xf7bf('0x1a')](_0x5c1418);}return _0x53dd22[_0xf7bf('0x1b')](_0x5c1418)[_0xf7bf('0x1c')]();};}function respondWithResult(_0x237269,_0x293f71){_0x293f71=_0x293f71||0xc8;return function(_0x496acc){if(_0x496acc){return _0x237269[_0xf7bf('0x1b')](_0x293f71)[_0xf7bf('0x1d')](_0x496acc);}};}function respondWithFilteredResult(_0x53a8b8,_0x3b7ca2){return function(_0x249adb){if(_0x249adb){var _0x289e33=typeof _0x3b7ca2[_0xf7bf('0x1e')]===_0xf7bf('0x1f')&&typeof _0x3b7ca2[_0xf7bf('0x20')]===_0xf7bf('0x1f');var _0x2917db=_0x249adb['count'];var _0x37a1fb=_0x289e33?0x0:_0x3b7ca2['offset'];var _0x341320=_0x289e33?_0x249adb[_0xf7bf('0x21')]:_0x3b7ca2[_0xf7bf('0x1e')]+_0x3b7ca2[_0xf7bf('0x20')];var _0x116b95;if(_0x341320>=_0x2917db){_0x341320=_0x2917db;_0x116b95=0xc8;}else{_0x116b95=0xce;}_0x53a8b8['status'](_0x116b95);return _0x53a8b8[_0xf7bf('0x22')](_0xf7bf('0x23'),_0x37a1fb+'-'+_0x341320+'/'+_0x2917db)[_0xf7bf('0x1d')](_0x249adb);}return null;};}function patchUpdates(_0x2b35c5){return function(_0xf0cef0){try{jsonpatch[_0xf7bf('0x24')](_0xf0cef0,_0x2b35c5,!![]);}catch(_0x5e306a){return BPromise['reject'](_0x5e306a);}return _0xf0cef0[_0xf7bf('0x25')]();};}function saveUpdates(_0x4e0d3d,_0x193ad0){return function(_0x451243){if(_0x451243){return _0x451243[_0xf7bf('0x26')](_0x4e0d3d)[_0xf7bf('0x27')](function(_0xe207ee){return _0xe207ee;});}return null;};}function removeEntity(_0x3a3ff5,_0x33bd3a){return function(_0x2063da){if(_0x2063da){return _0x2063da['destroy']()[_0xf7bf('0x27')](function(){_0x3a3ff5[_0xf7bf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aafd2,_0x446c02){return function(_0x620fc8){if(!_0x620fc8){_0x3aafd2[_0xf7bf('0x1a')](0x194);}return _0x620fc8;};}function handleError(_0x35095c,_0x50bfdc){_0x50bfdc=_0x50bfdc||0x1f4;return function(_0x139366){logger[_0xf7bf('0x28')](_0x139366['stack']);if(_0x139366['name']){delete _0x139366[_0xf7bf('0x29')];}_0x35095c['status'](_0x50bfdc)[_0xf7bf('0x2a')](_0x139366);};}exports[_0xf7bf('0x2b')]=function(_0x25b658,_0x2d5f29){var _0xa4c95b={},_0x4efaf2={},_0x2714dc={'count':0x0,'rows':[]};var _0x57b062=_[_0xf7bf('0x2c')](db[_0xf7bf('0x2d')][_0xf7bf('0x2e')],function(_0x3a236a){return{'name':_0x3a236a[_0xf7bf('0x2f')],'type':_0x3a236a[_0xf7bf('0x30')]['key']};});_0x4efaf2[_0xf7bf('0x31')]=_['map'](_0x57b062,_0xf7bf('0x29'));_0x4efaf2[_0xf7bf('0x32')]=_['keys'](_0x25b658[_0xf7bf('0x32')]);_0x4efaf2[_0xf7bf('0x33')]=_[_0xf7bf('0x34')](_0x4efaf2['model'],_0x4efaf2[_0xf7bf('0x32')]);_0xa4c95b[_0xf7bf('0x35')]=_[_0xf7bf('0x34')](_0x4efaf2[_0xf7bf('0x31')],qs[_0xf7bf('0x36')](_0x25b658['query'][_0xf7bf('0x36')]));_0xa4c95b['attributes']=_0xa4c95b[_0xf7bf('0x35')]['length']?_0xa4c95b[_0xf7bf('0x35')]:_0x4efaf2[_0xf7bf('0x31')];if(!_0x25b658[_0xf7bf('0x32')][_0xf7bf('0x37')](_0xf7bf('0x38'))){_0xa4c95b[_0xf7bf('0x20')]=qs[_0xf7bf('0x20')](_0x25b658[_0xf7bf('0x32')][_0xf7bf('0x20')]);_0xa4c95b[_0xf7bf('0x1e')]=qs['offset'](_0x25b658['query'][_0xf7bf('0x1e')]);}_0xa4c95b['order']=qs[_0xf7bf('0x39')](_0x25b658[_0xf7bf('0x32')][_0xf7bf('0x39')]);_0xa4c95b[_0xf7bf('0x3a')]=qs[_0xf7bf('0x33')](_[_0xf7bf('0x3b')](_0x25b658[_0xf7bf('0x32')],_0x4efaf2[_0xf7bf('0x33')]),_0x57b062);if(_0x25b658[_0xf7bf('0x32')][_0xf7bf('0x3c')]){_0xa4c95b['where']=_[_0xf7bf('0x3d')](_0xa4c95b[_0xf7bf('0x3a')],{'$or':_[_0xf7bf('0x2c')](_0x57b062,function(_0x331060){if(_0x331060[_0xf7bf('0x30')]!==_0xf7bf('0x3e')){var _0xc7facd={};_0xc7facd[_0x331060[_0xf7bf('0x29')]]={'$like':'%'+_0x25b658[_0xf7bf('0x32')]['filter']+'%'};return _0xc7facd;}})});}_0xa4c95b=_[_0xf7bf('0x3d')]({},_0xa4c95b,_0x25b658[_0xf7bf('0x3f')]);var _0x3815cf={'where':_0xa4c95b[_0xf7bf('0x3a')]};return db[_0xf7bf('0x2d')]['count'](_0x3815cf)[_0xf7bf('0x27')](function(_0x3c64f3){_0x2714dc[_0xf7bf('0x21')]=_0x3c64f3;if(_0x25b658[_0xf7bf('0x32')][_0xf7bf('0x40')]){_0xa4c95b[_0xf7bf('0x41')]=[{'all':!![]}];}return db[_0xf7bf('0x2d')][_0xf7bf('0x42')](_0xa4c95b);})[_0xf7bf('0x27')](function(_0x48fb31){_0x2714dc[_0xf7bf('0x43')]=_0x48fb31;return _0x2714dc;})['then'](respondWithFilteredResult(_0x2d5f29,_0xa4c95b))[_0xf7bf('0x44')](handleError(_0x2d5f29,null));};exports[_0xf7bf('0x45')]=function(_0x1aaa40,_0x1a5dc9){var _0xea27fa={'raw':!![],'where':{'id':_0x1aaa40['params']['id']}},_0x46ee24={};_0x46ee24[_0xf7bf('0x31')]=_[_0xf7bf('0x46')](db['SquareDetailsReport'][_0xf7bf('0x2e')]);_0x46ee24[_0xf7bf('0x32')]=_[_0xf7bf('0x46')](_0x1aaa40[_0xf7bf('0x32')]);_0x46ee24[_0xf7bf('0x33')]=_[_0xf7bf('0x34')](_0x46ee24[_0xf7bf('0x31')],_0x46ee24[_0xf7bf('0x32')]);_0xea27fa[_0xf7bf('0x35')]=_[_0xf7bf('0x34')](_0x46ee24['model'],qs['fields'](_0x1aaa40[_0xf7bf('0x32')]['fields']));_0xea27fa[_0xf7bf('0x35')]=_0xea27fa['attributes'][_0xf7bf('0x47')]?_0xea27fa[_0xf7bf('0x35')]:_0x46ee24[_0xf7bf('0x31')];if(_0x1aaa40[_0xf7bf('0x32')]['includeAll']){_0xea27fa[_0xf7bf('0x41')]=[{'all':!![]}];}_0xea27fa=_[_0xf7bf('0x3d')]({},_0xea27fa,_0x1aaa40['options']);return db['SquareDetailsReport']['find'](_0xea27fa)[_0xf7bf('0x27')](handleEntityNotFound(_0x1a5dc9,null))[_0xf7bf('0x27')](respondWithResult(_0x1a5dc9,null))['catch'](handleError(_0x1a5dc9,null));};exports[_0xf7bf('0x48')]=function(_0x27dd5b,_0x3cd7b3){return db[_0xf7bf('0x2d')]['create'](_0x27dd5b['body'],{})[_0xf7bf('0x27')](respondWithResult(_0x3cd7b3,0xc9))[_0xf7bf('0x44')](handleError(_0x3cd7b3,null));};exports['update']=function(_0x2ebc95,_0x341032){if(_0x2ebc95[_0xf7bf('0x49')]['id']){delete _0x2ebc95['body']['id'];}return db[_0xf7bf('0x2d')][_0xf7bf('0x4a')]({'where':{'id':_0x2ebc95[_0xf7bf('0x4b')]['id']}})[_0xf7bf('0x27')](handleEntityNotFound(_0x341032,null))[_0xf7bf('0x27')](saveUpdates(_0x2ebc95[_0xf7bf('0x49')],null))[_0xf7bf('0x27')](respondWithResult(_0x341032,null))[_0xf7bf('0x44')](handleError(_0x341032,null));};exports[_0xf7bf('0x4c')]=function(_0x5845d3,_0x18310e){return db['SquareDetailsReport'][_0xf7bf('0x4a')]({'where':{'id':_0x5845d3[_0xf7bf('0x4b')]['id']}})[_0xf7bf('0x27')](handleEntityNotFound(_0x18310e,null))[_0xf7bf('0x27')](removeEntity(_0x18310e,null))['catch'](handleError(_0x18310e,null));};exports[_0xf7bf('0x4d')]=function(_0x434d7e,_0x5eda00){return db['SquareDetailsReport'][_0xf7bf('0x4d')]()[_0xf7bf('0x27')](respondWithResult(_0x5eda00,null))[_0xf7bf('0x44')](handleError(_0x5eda00,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a1aa28b..520ef1b 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 _0xc549=['bluebird','request-promise','path','rimraf','exports','SquareDetailsReport','report_square_details','util','api'];(function(_0x5e1800,_0x4dc976){var _0x3bf794=function(_0x3aed5c){while(--_0x3aed5c){_0x5e1800['push'](_0x5e1800['shift']());}};_0x3bf794(++_0x4dc976);}(_0xc549,0x14b));var _0x9c54=function(_0x4962aa,_0x238b33){_0x4962aa=_0x4962aa-0x0;var _0x3684d7=_0xc549[_0x4962aa];return _0x3684d7;};'use strict';var _=require('lodash');var util=require(_0x9c54('0x0'));var logger=require('../../config/logger')(_0x9c54('0x1'));var moment=require('moment');var BPromise=require(_0x9c54('0x2'));var rp=require(_0x9c54('0x3'));var fs=require('fs');var path=require(_0x9c54('0x4'));var rimraf=require(_0x9c54('0x5'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x9c54('0x6')]=function(_0x1fc1cf,_0x5aed42){return _0x1fc1cf['define'](_0x9c54('0x7'),attributes,{'tableName':_0x9c54('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66a1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger'];(function(_0x3db18a,_0x4a5d1b){var _0x389b16=function(_0x58fd70){while(--_0x58fd70){_0x3db18a['push'](_0x3db18a['shift']());}};_0x389b16(++_0x4a5d1b);}(_0x66a1,0xc1));var _0x166a=function(_0x3e6db2,_0x1872db){_0x3e6db2=_0x3e6db2-0x0;var _0x48806f=_0x66a1[_0x3e6db2];return _0x48806f;};'use strict';var _=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var logger=require(_0x166a('0x2'))(_0x166a('0x3'));var moment=require(_0x166a('0x4'));var BPromise=require(_0x166a('0x5'));var rp=require(_0x166a('0x6'));var fs=require('fs');var path=require(_0x166a('0x7'));var rimraf=require(_0x166a('0x8'));var config=require(_0x166a('0x9'));var attributes=require(_0x166a('0xa'));module[_0x166a('0xb')]=function(_0x554b81,_0x7d6c51){return _0x554b81[_0x166a('0xc')](_0x166a('0xd'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 83bb0c8..d99fb80 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 _0x253d=['create','options','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SquareDetailsReport,\x20%s,\x20%s','CreateSquareDetailsReport'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x253d,0x1b3));var _0xd253=function(_0x1ef98e,_0x2433ad){_0x1ef98e=_0x1ef98e-0x0;var _0x4a11e9=_0x253d[_0x1ef98e];return _0x4a11e9;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd253('0x1'));var db=require(_0xd253('0x2'))['db'];var utils=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var jayson=require(_0xd253('0x6'));var client=jayson[_0xd253('0x7')][_0xd253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17589a,_0xf4b457,_0x487f4e){return new BPromise(function(_0x2c4de4,_0x712c81){return client[_0xd253('0x9')](_0x17589a,_0x487f4e)[_0xd253('0xa')](function(_0x351047){logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,'request\x20sent');logger[_0xd253('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'),JSON[_0xd253('0xe')](_0x351047));if(_0x351047[_0xd253('0xf')]){if(_0x351047[_0xd253('0xf')][_0xd253('0x10')]===0x1f4){logger[_0xd253('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047['error'][_0xd253('0x11')]);return _0x712c81(_0x351047[_0xd253('0xf')][_0xd253('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0x351047[_0xd253('0xf')][_0xd253('0x11')]);return _0x2c4de4(_0x351047[_0xd253('0xf')]['message']);}else{logger[_0xd253('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'));_0x2c4de4(_0x351047[_0xd253('0x12')][_0xd253('0x11')]);}})['catch'](function(_0x1b7ed1){logger['error'](_0xd253('0x13'),_0xf4b457,_0x1b7ed1);_0x712c81(_0x1b7ed1);});});}exports[_0xd253('0x14')]=function(_0x5e4051){var _0x2496cb=this;return new Promise(function(_0x2a2adc,_0x5b24ff){return db['SquareDetailsReport'][_0xd253('0x15')](_0x5e4051['body'],{'raw':_0x5e4051['options']?_0x5e4051[_0xd253('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd253('0xa')](function(_0x1e48c3){logger[_0xd253('0xb')](_0xd253('0x14'),_0x5e4051);logger['debug'](_0xd253('0x14'),_0x5e4051,JSON['stringify'](_0x1e48c3));_0x2a2adc(_0x1e48c3);})[_0xd253('0x17')](function(_0x50f8b5){logger[_0xd253('0xf')](_0xd253('0x14'),_0x50f8b5[_0xd253('0x11')],_0x5e4051);_0x5b24ff(_0x2496cb[_0xd253('0xf')](0x1f4,_0x50f8b5['message']));});});}; \ No newline at end of file +var _0x531a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x4bbb98,_0x595f4c){var _0x4a6258=function(_0xb785e2){while(--_0xb785e2){_0x4bbb98['push'](_0x4bbb98['shift']());}};_0x4a6258(++_0x595f4c);}(_0x531a,0x100));var _0xa531=function(_0x386078,_0x49ad4f){_0x386078=_0x386078-0x0;var _0xd6675c=_0x531a[_0x386078];return _0xd6675c;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['SquareDetailsReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateSquareDetailsReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7a4d163..09c17a4 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 _0x5174=['get','isAuthenticated','killProcess','exports','express','../../components/auth/service','./system.controller'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x5174,0x154));var _0x4517=function(_0x190c22,_0x34e16c){_0x190c22=_0x190c22-0x0;var _0x453a4b=_0x5174[_0x190c22];return _0x453a4b;};'use strict';var express=require(_0x4517('0x0'));var router=express['Router']();var auth=require(_0x4517('0x1'));var controller=require(_0x4517('0x2'));router[_0x4517('0x3')]('/',auth[_0x4517('0x4')](),controller['index']);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x4517('0x5')]);module[_0x4517('0x6')]=router; \ No newline at end of file +var _0x628f=['get','/process/:pid/kill','Router','./system.controller','isAuthenticated'];(function(_0x16b55f,_0x301c6c){var _0x391c2f=function(_0x4f1941){while(--_0x4f1941){_0x16b55f['push'](_0x16b55f['shift']());}};_0x391c2f(++_0x301c6c);}(_0x628f,0x15b));var _0xf628=function(_0x3a9d05,_0x367e7c){_0x3a9d05=_0x3a9d05-0x0;var _0x3b9c5e=_0x628f[_0x3a9d05];return _0x3b9c5e;};'use strict';var express=require('express');var router=express[_0xf628('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xf628('0x1'));router['get']('/',auth[_0xf628('0x2')](),controller['index']);router[_0xf628('0x3')](_0xf628('0x4'),auth[_0xf628('0x2')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 79a8482..4aa57d9 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 _0x331f=['pid','split','length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','util','bluebird','error','inspect','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x45fb04,_0x573d03){var _0x353dae=function(_0x3fdc31){while(--_0x3fdc31){_0x45fb04['push'](_0x45fb04['shift']());}};_0x353dae(++_0x573d03);}(_0x331f,0x10d));var _0xf331=function(_0x3d4698,_0x2c9d8c){_0x3d4698=_0x3d4698-0x0;var _0x58c0f9=_0x331f[_0x3d4698];return _0x58c0f9;};'use strict';var info=require(_0xf331('0x0'));var exec=require(_0xf331('0x1'))[_0xf331('0x2')];var logger=require('../../config/logger')('api');var util=require(_0xf331('0x3'));var BPromise=require(_0xf331('0x4'));var _=require('lodash');function handleError(_0x4a157c,_0x13d5f0,_0x44567b){_0x13d5f0=_0x13d5f0||0x1f4;return function(_0x2d5cc3){logger[_0xf331('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x44567b,_0x13d5f0,util[_0xf331('0x6')](_0x2d5cc3,{'showHidden':![],'depth':null}));delete _0x2d5cc3[_0xf331('0x7')];_0x4a157c[_0xf331('0x8')](_0x13d5f0)[_0xf331('0x9')](_0x2d5cc3);};}exports[_0xf331('0xa')]=function(_0x5b901c,_0x5a7002){return info[_0xf331('0xb')]()['then'](function(_0x5f43dc){return _0x5a7002[_0xf331('0x8')](0xc8)[_0xf331('0xc')](_0x5f43dc);})[_0xf331('0xd')](function(_0x18a19a){return _0x5a7002[_0xf331('0x8')](0x1f4)[_0xf331('0xc')](_0x18a19a);});};exports[_0xf331('0xe')]=function(_0x3a868c,_0x289ef1){var _0x3427f8=[_0xf331('0xf')];return new BPromise(function(_0x5b3858,_0x47ece9){return exec(util[_0xf331('0x10')](_0xf331('0x11'),_0x3a868c[_0xf331('0x12')][_0xf331('0x13')]),function(_0x2e909b,_0x577525,_0x492cd2){if(_0x2e909b){return _0x47ece9(_0x2e909b);}return _0x5b3858(_0x577525);});})['then'](function(_0x6ce266){var _0x206a0b=![];var _0x3911a2=_0x6ce266[_0xf331('0x14')](/\n/);for(var _0x440698=0x0,_0x52c75c=_0x3427f8[_0xf331('0x15')];_0x440698<_0x52c75c,_0x206a0b===![];_0x440698+=0x1){if(_0x6ce266['indexOf'](_0x3427f8[_0x440698])>=0x0){_0x206a0b=!![];}}if(!_0x206a0b){throw new Error(util[_0xf331('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3a868c[_0xf331('0x12')][_0xf331('0x13')]));}process[_0xf331('0x16')](_0x3a868c[_0xf331('0x12')][_0xf331('0x13')],'SIGINT');return _0x289ef1['status'](0xc8)[_0xf331('0xc')]({'message':util[_0xf331('0x10')](_0xf331('0x17'),_0x3a868c[_0xf331('0x12')][_0xf331('0x13')])});})[_0xf331('0xd')](handleError(_0x289ef1,null,_0xf331('0xe')));}; \ No newline at end of file +var _0x8779=['pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8779,0x14b));var _0x9877=function(_0x20f87e,_0x34d6dd){_0x20f87e=_0x20f87e-0x0;var _0x168a8d=_0x8779[_0x20f87e];return _0x168a8d;};'use strict';var info=require('systeminformation');var exec=require(_0x9877('0x0'))[_0x9877('0x1')];var logger=require(_0x9877('0x2'))('api');var util=require(_0x9877('0x3'));var BPromise=require(_0x9877('0x4'));var _=require(_0x9877('0x5'));function handleError(_0x18ecaa,_0x312c89,_0x50ef74){_0x312c89=_0x312c89||0x1f4;return function(_0xfbe3c7){logger[_0x9877('0x6')](_0x9877('0x7'),_0x50ef74,_0x312c89,util['inspect'](_0xfbe3c7,{'showHidden':![],'depth':null}));delete _0xfbe3c7[_0x9877('0x8')];_0x18ecaa[_0x9877('0x9')](_0x312c89)[_0x9877('0xa')](_0xfbe3c7);};}exports[_0x9877('0xb')]=function(_0x1c09d0,_0x486a30){return info[_0x9877('0xc')]()[_0x9877('0xd')](function(_0x30c1d7){return _0x486a30[_0x9877('0x9')](0xc8)[_0x9877('0xe')](_0x30c1d7);})[_0x9877('0xf')](function(_0x37073c){return _0x486a30[_0x9877('0x9')](0x1f4)[_0x9877('0xe')](_0x37073c);});};exports['killProcess']=function(_0x2662b2,_0x573b23){var _0x101d6e=[_0x9877('0x10')];return new BPromise(function(_0x3587ff,_0x4ceec3){return exec(util[_0x9877('0x11')](_0x9877('0x12'),_0x2662b2['params'][_0x9877('0x13')]),function(_0x3d466d,_0x21a80f,_0x2e642c){if(_0x3d466d){return _0x4ceec3(_0x3d466d);}return _0x3587ff(_0x21a80f);});})[_0x9877('0xd')](function(_0x5158ff){var _0x4ed39d=![];var _0x345799=_0x5158ff['split'](/\n/);for(var _0x5e7f14=0x0,_0x109fd3=_0x101d6e['length'];_0x5e7f14<_0x109fd3,_0x4ed39d===![];_0x5e7f14+=0x1){if(_0x5158ff[_0x9877('0x14')](_0x101d6e[_0x5e7f14])>=0x0){_0x4ed39d=!![];}}if(!_0x4ed39d){throw new Error(util[_0x9877('0x11')](_0x9877('0x15'),_0x2662b2[_0x9877('0x16')]['pid']));}process['kill'](_0x2662b2[_0x9877('0x16')][_0x9877('0x13')],'SIGINT');return _0x573b23[_0x9877('0x9')](0xc8)['json']({'message':util[_0x9877('0x11')](_0x9877('0x17'),_0x2662b2['params'][_0x9877('0x13')])});})[_0x9877('0xf')](handleError(_0x573b23,null,_0x9877('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6837b1f..6088ea2 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 _0x1219=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x368684,_0x538fe0){var _0x4871a7=function(_0x483c55){while(--_0x483c55){_0x368684['push'](_0x368684['shift']());}};_0x4871a7(++_0x538fe0);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var path=require(_0x9121('0x2'));var timeout=require(_0x9121('0x3'));var express=require(_0x9121('0x4'));var router=express['Router']();var fs_extra=require(_0x9121('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var controller=require(_0x9121('0x8'));router[_0x9121('0x9')]('/',auth[_0x9121('0xa')](),controller[_0x9121('0xb')]);router[_0x9121('0x9')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0xd')]);router[_0x9121('0xe')]('/',auth['isAuthenticated'](),controller[_0x9121('0xf')]);router[_0x9121('0x10')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller['update']);router[_0x9121('0x11')](_0x9121('0xc'),auth[_0x9121('0xa')](),controller[_0x9121('0x12')]);module[_0x9121('0x13')]=router; \ No newline at end of file +var _0x3696=['connect-timeout','express','Router','./tag.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','multer','path'];(function(_0x4b3611,_0x459582){var _0x3bb412=function(_0x44c31b){while(--_0x44c31b){_0x4b3611['push'](_0x4b3611['shift']());}};_0x3bb412(++_0x459582);}(_0x3696,0x7e));var _0x6369=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x3696[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x6369('0x0'));var util=require('util');var path=require(_0x6369('0x1'));var timeout=require(_0x6369('0x2'));var express=require(_0x6369('0x3'));var router=express[_0x6369('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(_0x6369('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6369('0x6')]);router[_0x6369('0x7')](_0x6369('0x8'),auth['isAuthenticated'](),controller[_0x6369('0x9')]);router[_0x6369('0xa')]('/',auth[_0x6369('0xb')](),controller['create']);router[_0x6369('0xc')](_0x6369('0x8'),auth[_0x6369('0xb')](),controller[_0x6369('0xd')]);router[_0x6369('0xe')](_0x6369('0x8'),auth[_0x6369('0xb')](),controller[_0x6369('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 490bb41..2effbd9 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 _0xe511=['#0091EA','STRING','sequelize','exports','name'];(function(_0x334d69,_0x1e9842){var _0x3e7b10=function(_0x548a13){while(--_0x548a13){_0x334d69['push'](_0x334d69['shift']());}};_0x3e7b10(++_0x1e9842);}(_0xe511,0x16f));var _0x1e51=function(_0x344089,_0x481955){_0x344089=_0x344089-0x0;var _0x27b276=_0xe511[_0x344089];return _0x27b276;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e51('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x1e51('0x3')},'description':{'type':Sequelize[_0x1e51('0x4')]}}; \ No newline at end of file +var _0x2977=['#0091EA','sequelize','STRING','name'];(function(_0x4e2a44,_0x5bc594){var _0x30dbcc=function(_0x594986){while(--_0x594986){_0x4e2a44['push'](_0x4e2a44['shift']());}};_0x30dbcc(++_0x5bc594);}(_0x2977,0xa5));var _0x7297=function(_0x27e805,_0x460233){_0x27e805=_0x27e805-0x0;var _0x5181bb=_0x2977[_0x27e805];return _0x5181bb;};'use strict';var Sequelize=require(_0x7297('0x0'));module['exports']={'name':{'type':Sequelize[_0x7297('0x1')],'unique':_0x7297('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7297('0x1')],'defaultValue':_0x7297('0x3')},'description':{'type':Sequelize[_0x7297('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7537a1d..561358a 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 _0x524a=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','Tags','UserProfileResource','destroy','stack','name','index','map','Tag','fieldName','model','query','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x6c6d75,_0xef7deb){var _0x48a161=function(_0xf0fba0){while(--_0xf0fba0){_0x6c6d75['push'](_0x6c6d75['shift']());}};_0x48a161(++_0xef7deb);}(_0x524a,0xf5));var _0xa524=function(_0x5f2cf0,_0x357be6){_0x5f2cf0=_0x5f2cf0-0x0;var _0x7d9266=_0x524a[_0x5f2cf0];return _0x7d9266;};'use strict';var emlformat=require(_0xa524('0x0'));var rimraf=require(_0xa524('0x1'));var zipdir=require(_0xa524('0x2'));var jsonpatch=require(_0xa524('0x3'));var rp=require('request-promise');var moment=require(_0xa524('0x4'));var BPromise=require(_0xa524('0x5'));var Mustache=require(_0xa524('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa524('0x7'));var csv=require(_0xa524('0x8'));var ejs=require(_0xa524('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa524('0xa'));var squel=require('squel');var crypto=require(_0xa524('0xb'));var jsforce=require(_0xa524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa524('0x8'));var querystring=require(_0xa524('0xd'));var Papa=require(_0xa524('0xe'));var Redis=require(_0xa524('0xf'));var authService=require(_0xa524('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa524('0x11'));var hardwareService=require(_0xa524('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa524('0x13'));var config=require(_0xa524('0x14'));var licenseUtil=require(_0xa524('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55117f,_0x14a0d6){_0x14a0d6=_0x14a0d6||0xcc;return function(_0x4aa46d){if(_0x4aa46d){return _0x55117f[_0xa524('0x16')](_0x14a0d6);}return _0x55117f['status'](_0x14a0d6)[_0xa524('0x17')]();};}function respondWithResult(_0x5c7e6a,_0x75bfe8){_0x75bfe8=_0x75bfe8||0xc8;return function(_0x281137){if(_0x281137){return _0x5c7e6a['status'](_0x75bfe8)[_0xa524('0x18')](_0x281137);}};}function respondWithFilteredResult(_0x15b14c,_0xe85361){return function(_0x1de01e){if(_0x1de01e){var _0x45347f=typeof _0xe85361[_0xa524('0x19')]===_0xa524('0x1a')&&typeof _0xe85361['limit']===_0xa524('0x1a');var _0x3d8494=_0x1de01e[_0xa524('0x1b')];var _0x3d6a0d=_0x45347f?0x0:_0xe85361[_0xa524('0x19')];var _0x805b93=_0x45347f?_0x1de01e[_0xa524('0x1b')]:_0xe85361[_0xa524('0x19')]+_0xe85361['limit'];var _0x304dea;if(_0x805b93>=_0x3d8494){_0x805b93=_0x3d8494;_0x304dea=0xc8;}else{_0x304dea=0xce;}_0x15b14c[_0xa524('0x1c')](_0x304dea);return _0x15b14c[_0xa524('0x1d')](_0xa524('0x1e'),_0x3d6a0d+'-'+_0x805b93+'/'+_0x3d8494)['json'](_0x1de01e);}return null;};}function patchUpdates(_0x5510fa){return function(_0x40f4bd){try{jsonpatch[_0xa524('0x1f')](_0x40f4bd,_0x5510fa,!![]);}catch(_0x21e114){return BPromise[_0xa524('0x20')](_0x21e114);}return _0x40f4bd[_0xa524('0x21')]();};}function saveUpdates(_0x3866e2,_0x4abffe){return function(_0x262eac){if(_0x262eac){return _0x262eac[_0xa524('0x22')](_0x3866e2)[_0xa524('0x23')](function(_0x40fb4b){return _0x40fb4b;});}return null;};}function removeEntity(_0x226784,_0x45cdcc){return function(_0x26e931){if(_0x26e931){return _0x26e931['destroy']()[_0xa524('0x23')](function(){var _0x221bf=_0x26e931['get']({'plain':!![]});var _0x47efb3=_0xa524('0x24');return db[_0xa524('0x25')][_0xa524('0x26')]({'where':{'type':_0x47efb3,'resourceId':_0x221bf['id']}})[_0xa524('0x23')](function(){return _0x26e931;});})[_0xa524('0x23')](function(){_0x226784['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeabc,_0x869b22){return function(_0x1582fa){if(!_0x1582fa){_0x1aeabc[_0xa524('0x16')](0x194);}return _0x1582fa;};}function handleError(_0x505c42,_0x1c84c6){_0x1c84c6=_0x1c84c6||0x1f4;return function(_0x32ba03){logger['error'](_0x32ba03[_0xa524('0x27')]);if(_0x32ba03[_0xa524('0x28')]){delete _0x32ba03['name'];}_0x505c42[_0xa524('0x1c')](_0x1c84c6)['send'](_0x32ba03);};}exports[_0xa524('0x29')]=function(_0x38e051,_0x45b846){var _0x238133={},_0x136e83={},_0x1c706b={'count':0x0,'rows':[]};var _0x4f6133=_[_0xa524('0x2a')](db[_0xa524('0x2b')]['rawAttributes'],function(_0x535e41){return{'name':_0x535e41[_0xa524('0x2c')],'type':_0x535e41['type']['key']};});_0x136e83[_0xa524('0x2d')]=_[_0xa524('0x2a')](_0x4f6133,_0xa524('0x28'));_0x136e83[_0xa524('0x2e')]=_['keys'](_0x38e051['query']);_0x136e83[_0xa524('0x2f')]=_['intersection'](_0x136e83['model'],_0x136e83[_0xa524('0x2e')]);_0x238133[_0xa524('0x30')]=_[_0xa524('0x31')](_0x136e83[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x38e051[_0xa524('0x2e')][_0xa524('0x32')]));_0x238133[_0xa524('0x30')]=_0x238133[_0xa524('0x30')][_0xa524('0x33')]?_0x238133[_0xa524('0x30')]:_0x136e83[_0xa524('0x2d')];if(!_0x38e051['query']['hasOwnProperty']('nolimit')){_0x238133[_0xa524('0x34')]=qs[_0xa524('0x34')](_0x38e051['query'][_0xa524('0x34')]);_0x238133['offset']=qs[_0xa524('0x19')](_0x38e051[_0xa524('0x2e')]['offset']);}_0x238133[_0xa524('0x35')]=qs[_0xa524('0x36')](_0x38e051[_0xa524('0x2e')]['sort']);_0x238133[_0xa524('0x37')]=qs[_0xa524('0x2f')](_['pick'](_0x38e051[_0xa524('0x2e')],_0x136e83[_0xa524('0x2f')]),_0x4f6133);if(_0x38e051['query'][_0xa524('0x38')]){_0x238133[_0xa524('0x37')]=_['merge'](_0x238133[_0xa524('0x37')],{'$or':_[_0xa524('0x2a')](_0x4f6133,function(_0x186395){if(_0x186395[_0xa524('0x39')]!==_0xa524('0x3a')){var _0x38f87a={};_0x38f87a[_0x186395[_0xa524('0x28')]]={'$like':'%'+_0x38e051[_0xa524('0x2e')][_0xa524('0x38')]+'%'};return _0x38f87a;}})});}_0x238133=_[_0xa524('0x3b')]({},_0x238133,_0x38e051[_0xa524('0x3c')]);var _0x51cd09={'where':_0x238133[_0xa524('0x37')]};return db['Tag'][_0xa524('0x1b')](_0x51cd09)[_0xa524('0x23')](function(_0x35d92d){_0x1c706b[_0xa524('0x1b')]=_0x35d92d;if(_0x38e051[_0xa524('0x2e')][_0xa524('0x3d')]){_0x238133[_0xa524('0x3e')]=[{'all':!![]}];}return db[_0xa524('0x2b')][_0xa524('0x3f')](_0x238133);})[_0xa524('0x23')](function(_0x4a87d4){_0x1c706b[_0xa524('0x40')]=_0x4a87d4;return _0x1c706b;})[_0xa524('0x23')](respondWithFilteredResult(_0x45b846,_0x238133))['catch'](handleError(_0x45b846,null));};exports[_0xa524('0x41')]=function(_0x3f5564,_0x4885a4){var _0x492851={'raw':!![],'where':{'id':_0x3f5564['params']['id']}},_0x4dff4b={};_0x4dff4b['model']=_[_0xa524('0x42')](db[_0xa524('0x2b')][_0xa524('0x43')]);_0x4dff4b[_0xa524('0x2e')]=_['keys'](_0x3f5564[_0xa524('0x2e')]);_0x4dff4b[_0xa524('0x2f')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],_0x4dff4b['query']);_0x492851[_0xa524('0x30')]=_[_0xa524('0x31')](_0x4dff4b[_0xa524('0x2d')],qs[_0xa524('0x32')](_0x3f5564[_0xa524('0x2e')]['fields']));_0x492851[_0xa524('0x30')]=_0x492851[_0xa524('0x30')][_0xa524('0x33')]?_0x492851[_0xa524('0x30')]:_0x4dff4b[_0xa524('0x2d')];if(_0x3f5564[_0xa524('0x2e')][_0xa524('0x3d')]){_0x492851[_0xa524('0x3e')]=[{'all':!![]}];}_0x492851=_[_0xa524('0x3b')]({},_0x492851,_0x3f5564['options']);return db['Tag'][_0xa524('0x44')](_0x492851)[_0xa524('0x23')](handleEntityNotFound(_0x4885a4,null))[_0xa524('0x23')](respondWithResult(_0x4885a4,null))[_0xa524('0x45')](handleError(_0x4885a4,null));};exports[_0xa524('0x46')]=function(_0xddc80,_0x56e570){return db[_0xa524('0x2b')][_0xa524('0x46')](_0xddc80[_0xa524('0x47')],{})[_0xa524('0x23')](function(_0x24c7ef){var _0x451bbe=_0xddc80['user'][_0xa524('0x48')]({'plain':!![]});if(!_0x451bbe)throw new Error(_0xa524('0x49'));if(_0x451bbe[_0xa524('0x4a')]===_0xa524('0x4b')){var _0x25ffbd=_0x24c7ef[_0xa524('0x48')]({'plain':!![]});var _0xef18b7=_0xa524('0x24');return db[_0xa524('0x4c')][_0xa524('0x44')]({'where':{'name':_0xef18b7,'userProfileId':_0x451bbe[_0xa524('0x4d')]},'raw':!![]})[_0xa524('0x23')](function(_0x3a374f){if(_0x3a374f&&_0x3a374f[_0xa524('0x4e')]===0x0){return db[_0xa524('0x25')]['create']({'name':_0x25ffbd[_0xa524('0x28')],'resourceId':_0x25ffbd['id'],'type':_0x3a374f[_0xa524('0x28')],'sectionId':_0x3a374f['id']},{})['then'](function(){return _0x24c7ef;});}else{return _0x24c7ef;}})['catch'](function(_0x32844c){logger[_0xa524('0x4f')](_0xa524('0x50'),_0x32844c);throw _0x32844c;});}return _0x24c7ef;})[_0xa524('0x23')](respondWithResult(_0x56e570,0xc9))[_0xa524('0x45')](handleError(_0x56e570,null));};exports[_0xa524('0x22')]=function(_0x121fc5,_0x4e3709){if(_0x121fc5[_0xa524('0x47')]['id']){delete _0x121fc5[_0xa524('0x47')]['id'];}return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x121fc5[_0xa524('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e3709,null))[_0xa524('0x23')](saveUpdates(_0x121fc5['body'],null))[_0xa524('0x23')](respondWithResult(_0x4e3709,null))[_0xa524('0x45')](handleError(_0x4e3709,null));};exports[_0xa524('0x26')]=function(_0x3f5694,_0x161393){return db[_0xa524('0x2b')][_0xa524('0x44')]({'where':{'id':_0x3f5694['params']['id']}})['then'](handleEntityNotFound(_0x161393,null))[_0xa524('0x23')](removeEntity(_0x161393,null))[_0xa524('0x45')](handleError(_0x161393,null));}; \ No newline at end of file +var _0x9b9b=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','autoAssociation','error','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','type','key'];(function(_0x3f761d,_0x5d907d){var _0x49d6e3=function(_0x39ab43){while(--_0x39ab43){_0x3f761d['push'](_0x3f761d['shift']());}};_0x49d6e3(++_0x5d907d);}(_0x9b9b,0x114));var _0xb9b9=function(_0x459573,_0x35679e){_0x459573=_0x459573-0x0;var _0x51ffcd=_0x9b9b[_0x459573];return _0x51ffcd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x1'));var moment=require(_0xb9b9('0x2'));var BPromise=require(_0xb9b9('0x3'));var Mustache=require(_0xb9b9('0x4'));var util=require(_0xb9b9('0x5'));var path=require(_0xb9b9('0x6'));var sox=require(_0xb9b9('0x7'));var csv=require(_0xb9b9('0x8'));var ejs=require(_0xb9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xb9b9('0xa'));var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];function respondWithStatusCode(_0x26fa04,_0x230fea){_0x230fea=_0x230fea||0xcc;return function(_0x135cdc){if(_0x135cdc){return _0x26fa04['sendStatus'](_0x230fea);}return _0x26fa04['status'](_0x230fea)[_0xb9b9('0x19')]();};}function respondWithResult(_0x4ef543,_0xe78d58){_0xe78d58=_0xe78d58||0xc8;return function(_0x50e5d6){if(_0x50e5d6){return _0x4ef543[_0xb9b9('0x1a')](_0xe78d58)[_0xb9b9('0x1b')](_0x50e5d6);}};}function respondWithFilteredResult(_0x21fa2a,_0x29794c){return function(_0x177ad9){if(_0x177ad9){var _0x3fd09c=typeof _0x29794c[_0xb9b9('0x1c')]===_0xb9b9('0x1d')&&typeof _0x29794c['limit']===_0xb9b9('0x1d');var _0x48d9ae=_0x177ad9[_0xb9b9('0x1e')];var _0x3e6d23=_0x3fd09c?0x0:_0x29794c[_0xb9b9('0x1c')];var _0x11bb05=_0x3fd09c?_0x177ad9['count']:_0x29794c[_0xb9b9('0x1c')]+_0x29794c[_0xb9b9('0x1f')];var _0x398f3d;if(_0x11bb05>=_0x48d9ae){_0x11bb05=_0x48d9ae;_0x398f3d=0xc8;}else{_0x398f3d=0xce;}_0x21fa2a[_0xb9b9('0x1a')](_0x398f3d);return _0x21fa2a[_0xb9b9('0x20')](_0xb9b9('0x21'),_0x3e6d23+'-'+_0x11bb05+'/'+_0x48d9ae)[_0xb9b9('0x1b')](_0x177ad9);}return null;};}function patchUpdates(_0x3d0edb){return function(_0xb16391){try{jsonpatch[_0xb9b9('0x22')](_0xb16391,_0x3d0edb,!![]);}catch(_0xbf7c16){return BPromise[_0xb9b9('0x23')](_0xbf7c16);}return _0xb16391[_0xb9b9('0x24')]();};}function saveUpdates(_0x4e33a0,_0x10b7e1){return function(_0xe1e1d7){if(_0xe1e1d7){return _0xe1e1d7[_0xb9b9('0x25')](_0x4e33a0)['then'](function(_0x9898bc){return _0x9898bc;});}return null;};}function removeEntity(_0x46525d,_0x5efa01){return function(_0x18e2ca){if(_0x18e2ca){return _0x18e2ca[_0xb9b9('0x26')]()[_0xb9b9('0x27')](function(){var _0x40b801=_0x18e2ca[_0xb9b9('0x28')]({'plain':!![]});var _0x5299fb='Tags';return db[_0xb9b9('0x29')][_0xb9b9('0x26')]({'where':{'type':_0x5299fb,'resourceId':_0x40b801['id']}})['then'](function(){return _0x18e2ca;});})[_0xb9b9('0x27')](function(){_0x46525d[_0xb9b9('0x1a')](0xcc)[_0xb9b9('0x19')]();});}};}function handleEntityNotFound(_0x21f68f,_0x125f6c){return function(_0x54bf18){if(!_0x54bf18){_0x21f68f[_0xb9b9('0x2a')](0x194);}return _0x54bf18;};}function handleError(_0x554850,_0x1e0c5e){_0x1e0c5e=_0x1e0c5e||0x1f4;return function(_0xe28f3c){logger['error'](_0xe28f3c[_0xb9b9('0x2b')]);if(_0xe28f3c[_0xb9b9('0x2c')]){delete _0xe28f3c[_0xb9b9('0x2c')];}_0x554850['status'](_0x1e0c5e)[_0xb9b9('0x2d')](_0xe28f3c);};}exports[_0xb9b9('0x2e')]=function(_0x2e1d12,_0x300453){var _0x4f002a={},_0xc40dda={},_0xdbc1f1={'count':0x0,'rows':[]};var _0x49757e=_[_0xb9b9('0x2f')](db[_0xb9b9('0x30')][_0xb9b9('0x31')],function(_0xc47845){return{'name':_0xc47845['fieldName'],'type':_0xc47845[_0xb9b9('0x32')][_0xb9b9('0x33')]};});_0xc40dda[_0xb9b9('0x34')]=_[_0xb9b9('0x2f')](_0x49757e,'name');_0xc40dda[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0x2e1d12['query']);_0xc40dda[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0xc40dda[_0xb9b9('0x34')],_0xc40dda[_0xb9b9('0x35')]);_0x4f002a[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0xc40dda['model'],qs[_0xb9b9('0x3a')](_0x2e1d12[_0xb9b9('0x35')]['fields']));_0x4f002a[_0xb9b9('0x39')]=_0x4f002a[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x4f002a['attributes']:_0xc40dda[_0xb9b9('0x34')];if(!_0x2e1d12['query'][_0xb9b9('0x3c')]('nolimit')){_0x4f002a[_0xb9b9('0x1f')]=qs[_0xb9b9('0x1f')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x1f')]);_0x4f002a[_0xb9b9('0x1c')]=qs[_0xb9b9('0x1c')](_0x2e1d12[_0xb9b9('0x35')]['offset']);}_0x4f002a['order']=qs[_0xb9b9('0x3d')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3d')]);_0x4f002a['where']=qs[_0xb9b9('0x37')](_['pick'](_0x2e1d12[_0xb9b9('0x35')],_0xc40dda[_0xb9b9('0x37')]),_0x49757e);if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]){_0x4f002a[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x4f002a[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x2f')](_0x49757e,function(_0x496cf){if(_0x496cf[_0xb9b9('0x32')]!=='VIRTUAL'){var _0xf484fd={};_0xf484fd[_0x496cf[_0xb9b9('0x2c')]]={'$like':'%'+_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]+'%'};return _0xf484fd;}})});}_0x4f002a=_[_0xb9b9('0x40')]({},_0x4f002a,_0x2e1d12[_0xb9b9('0x41')]);var _0x36717c={'where':_0x4f002a[_0xb9b9('0x3f')]};return db[_0xb9b9('0x30')][_0xb9b9('0x1e')](_0x36717c)['then'](function(_0x357b9c){_0xdbc1f1[_0xb9b9('0x1e')]=_0x357b9c;if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x42')]){_0x4f002a['include']=[{'all':!![]}];}return db[_0xb9b9('0x30')]['findAll'](_0x4f002a);})['then'](function(_0x3e374e){_0xdbc1f1[_0xb9b9('0x43')]=_0x3e374e;return _0xdbc1f1;})['then'](respondWithFilteredResult(_0x300453,_0x4f002a))['catch'](handleError(_0x300453,null));};exports[_0xb9b9('0x44')]=function(_0x1a5888,_0x375543){var _0x3f4388={'raw':!![],'where':{'id':_0x1a5888[_0xb9b9('0x45')]['id']}},_0x493786={};_0x493786[_0xb9b9('0x34')]=_[_0xb9b9('0x36')](db['Tag']['rawAttributes']);_0x493786[_0xb9b9('0x35')]=_['keys'](_0x1a5888[_0xb9b9('0x35')]);_0x493786[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],_0x493786['query']);_0x3f4388[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],qs[_0xb9b9('0x3a')](_0x1a5888[_0xb9b9('0x35')][_0xb9b9('0x3a')]));_0x3f4388[_0xb9b9('0x39')]=_0x3f4388[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x3f4388[_0xb9b9('0x39')]:_0x493786[_0xb9b9('0x34')];if(_0x1a5888[_0xb9b9('0x35')]['includeAll']){_0x3f4388[_0xb9b9('0x46')]=[{'all':!![]}];}_0x3f4388=_['merge']({},_0x3f4388,_0x1a5888[_0xb9b9('0x41')]);return db[_0xb9b9('0x30')][_0xb9b9('0x47')](_0x3f4388)[_0xb9b9('0x27')](handleEntityNotFound(_0x375543,null))['then'](respondWithResult(_0x375543,null))[_0xb9b9('0x48')](handleError(_0x375543,null));};exports['create']=function(_0x2b3e22,_0x576c06){return db[_0xb9b9('0x30')][_0xb9b9('0x49')](_0x2b3e22[_0xb9b9('0x4a')],{})[_0xb9b9('0x27')](function(_0x25bfa1){var _0x1a406c=_0x2b3e22[_0xb9b9('0x4b')][_0xb9b9('0x28')]({'plain':!![]});if(!_0x1a406c)throw new Error(_0xb9b9('0x4c'));if(_0x1a406c['role']==='user'){var _0x4da7d8=_0x25bfa1[_0xb9b9('0x28')]({'plain':!![]});var _0x504c1d=_0xb9b9('0x4d');return db[_0xb9b9('0x4e')][_0xb9b9('0x47')]({'where':{'name':_0x504c1d,'userProfileId':_0x1a406c[_0xb9b9('0x4f')]},'raw':!![]})['then'](function(_0x39c444){if(_0x39c444&&_0x39c444[_0xb9b9('0x50')]===0x0){return db['UserProfileResource'][_0xb9b9('0x49')]({'name':_0x4da7d8[_0xb9b9('0x2c')],'resourceId':_0x4da7d8['id'],'type':_0x39c444['name'],'sectionId':_0x39c444['id']},{})['then'](function(){return _0x25bfa1;});}else{return _0x25bfa1;}})[_0xb9b9('0x48')](function(_0x2bbe9f){logger[_0xb9b9('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbe9f);throw _0x2bbe9f;});}return _0x25bfa1;})[_0xb9b9('0x27')](respondWithResult(_0x576c06,0xc9))[_0xb9b9('0x48')](handleError(_0x576c06,null));};exports['update']=function(_0x17b032,_0xb0b883){if(_0x17b032[_0xb9b9('0x4a')]['id']){delete _0x17b032[_0xb9b9('0x4a')]['id'];}return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x17b032[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0xb0b883,null))['then'](saveUpdates(_0x17b032[_0xb9b9('0x4a')],null))[_0xb9b9('0x27')](respondWithResult(_0xb0b883,null))[_0xb9b9('0x48')](handleError(_0xb0b883,null));};exports[_0xb9b9('0x26')]=function(_0x1e88f1,_0x49956d){return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x1e88f1[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0x49956d,null))[_0xb9b9('0x27')](removeEntity(_0x49956d,null))[_0xb9b9('0x48')](handleError(_0x49956d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9acccd2..4c8d679 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 _0x938b=['api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash'];(function(_0x378e5f,_0x404e88){var _0x4cfd4a=function(_0x42cee8){while(--_0x42cee8){_0x378e5f['push'](_0x378e5f['shift']());}};_0x4cfd4a(++_0x404e88);}(_0x938b,0x1cd));var _0xb938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb938('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb938('0x1'));var moment=require(_0xb938('0x2'));var BPromise=require('bluebird');var rp=require(_0xb938('0x3'));var fs=require('fs');var path=require(_0xb938('0x4'));var rimraf=require(_0xb938('0x5'));var config=require(_0xb938('0x6'));var attributes=require(_0xb938('0x7'));module[_0xb938('0x8')]=function(_0x317569,_0x39af3e){return _0x317569['define'](_0xb938('0x9'),attributes,{'tableName':_0xb938('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe062=['define','Tag','lodash','util','bluebird','rimraf','../../config/environment','./tag.attributes'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xe062,0x7a));var _0x2e06=function(_0x438ca4,_0x519d95){_0x438ca4=_0x438ca4-0x0;var _0x14ac44=_0xe062[_0x438ca4];return _0x14ac44;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2e06('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e06('0x3'));var config=require(_0x2e06('0x4'));var attributes=require(_0x2e06('0x5'));module['exports']=function(_0x369dc7,_0x3f66d9){return _0x369dc7[_0x2e06('0x6')](_0x2e06('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ee89d15..c68aab4 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 _0xaba6=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaba6,0xe2));var _0x6aba=function(_0x38bce7,_0x366405){_0x38bce7=_0x38bce7-0x0;var _0x4f8b4e=_0xaba6[_0x38bce7];return _0x4f8b4e;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6aba('0x2'))['db'];var utils=require(_0x6aba('0x3'));var logger=require('../../config/logger')(_0x6aba('0x4'));var config=require(_0x6aba('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39c32a,_0x54416a,_0x3766d4){return new BPromise(function(_0x1a4fbc,_0x508dff){return client[_0x6aba('0x6')](_0x39c32a,_0x3766d4)[_0x6aba('0x7')](function(_0x4ea8eb){logger[_0x6aba('0x8')](_0x6aba('0x9'),_0x54416a,_0x6aba('0xa'));logger[_0x6aba('0xb')](_0x6aba('0xc'),_0x54416a,_0x6aba('0xa'),JSON[_0x6aba('0xd')](_0x4ea8eb));if(_0x4ea8eb['error']){if(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0xf')]===0x1f4){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb['error'][_0x6aba('0x10')]);return _0x508dff(_0x4ea8eb[_0x6aba('0xe')]['message']);}logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb[_0x6aba('0xe')]['message']);return _0x1a4fbc(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0x10')]);}else{logger[_0x6aba('0x8')]('Tag,\x20%s,\x20%s',_0x54416a,_0x6aba('0xa'));_0x1a4fbc(_0x4ea8eb[_0x6aba('0x11')][_0x6aba('0x10')]);}})[_0x6aba('0x12')](function(_0x379b17){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x379b17);_0x508dff(_0x379b17);});});} \ No newline at end of file +var _0xcb81=['lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x107a84,_0xc698f8){var _0x3eea3e=function(_0x59ee56){while(--_0x59ee56){_0x107a84['push'](_0x107a84['shift']());}};_0x3eea3e(++_0xc698f8);}(_0xcb81,0x154));var _0x1cb8=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xcb81[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var moment=require('moment');var BPromise=require(_0x1cb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb8('0x3'));var logger=require(_0x1cb8('0x4'))(_0x1cb8('0x5'));var config=require(_0x1cb8('0x6'));var jayson=require(_0x1cb8('0x7'));var client=jayson['client'][_0x1cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac2d6,_0x584b16,_0x2408c2){return new BPromise(function(_0x39b4ad,_0x282fd8){return client['request'](_0x2ac2d6,_0x2408c2)[_0x1cb8('0x9')](function(_0x51dc9e){logger['info'](_0x1cb8('0xa'),_0x584b16,_0x1cb8('0xb'));logger[_0x1cb8('0xc')](_0x1cb8('0xd'),_0x584b16,_0x1cb8('0xb'),JSON[_0x1cb8('0xe')](_0x51dc9e));if(_0x51dc9e[_0x1cb8('0xf')]){if(_0x51dc9e[_0x1cb8('0xf')]['code']===0x1f4){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x282fd8(_0x51dc9e[_0x1cb8('0xf')]['message']);}logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x39b4ad(_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);}else{logger[_0x1cb8('0x11')](_0x1cb8('0xa'),_0x584b16,'request\x20sent');_0x39b4ad(_0x51dc9e[_0x1cb8('0x12')]['message']);}})[_0x1cb8('0x13')](function(_0x28b8ff){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x28b8ff);_0x282fd8(_0x28b8ff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4a91924..6bfa39c 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(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 72d58a0..97c9fee 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 _0xd8b0=['exports','sequelize'];(function(_0x19ca3c,_0xba828){var _0x271ce=function(_0x3e36b9){while(--_0x3e36b9){_0x19ca3c['push'](_0x19ca3c['shift']());}};_0x271ce(++_0xba828);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 95a95af..8b6e7c4 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 _0xbcee=['stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','Team','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','user','role','get','Teams','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','getQueues','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queue','pick','addQueues','findOne','Unknown\x20channel','add','ids','removeQueues','Queues','addAgents','isArray','Voice','Chat','Sms','Fax','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','interface','SIP/%s','all','TeamVoicePrefix','UserVoicePrefix','removeAgents','Mail','Openchannel','getAgents','rimraf','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','undefined','count','set','apply','save','update','then','sendStatus','error'];(function(_0x337b9c,_0x3afc9c){var _0x211ae3=function(_0x40150a){while(--_0x40150a){_0x337b9c['push'](_0x337b9c['shift']());}};_0x211ae3(++_0x3afc9c);}(_0xbcee,0x196));var _0xebce=function(_0x1ecd14,_0x1e2b1f){_0x1ecd14=_0x1ecd14-0x0;var _0x32e56d=_0xbcee[_0x1ecd14];return _0x32e56d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xebce('0x1'));var BPromise=require(_0xebce('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xebce('0x3'));var csv=require(_0xebce('0x4'));var ejs=require(_0xebce('0x5'));var fs=require('fs');var fs_extra=require(_0xebce('0x6'));var _=require(_0xebce('0x7'));var squel=require(_0xebce('0x8'));var crypto=require(_0xebce('0x9'));var jsforce=require(_0xebce('0xa'));var deskjs=require(_0xebce('0xb'));var toCsv=require(_0xebce('0x4'));var querystring=require(_0xebce('0xc'));var Papa=require('papaparse');var Redis=require(_0xebce('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xebce('0xe'));var hardwareService=require(_0xebce('0xf'));var logger=require(_0xebce('0x10'))(_0xebce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebce('0x12'));var db=require(_0xebce('0x13'))['db'];config[_0xebce('0x14')]=_[_0xebce('0x15')](config[_0xebce('0x14')],{'host':_0xebce('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebce('0x14')]));require(_0xebce('0x17'))[_0xebce('0x18')](socket);function respondWithStatusCode(_0x4bddd3,_0x51628a){_0x51628a=_0x51628a||0xcc;return function(_0x25425b){if(_0x25425b){return _0x4bddd3['sendStatus'](_0x51628a);}return _0x4bddd3[_0xebce('0x19')](_0x51628a)[_0xebce('0x1a')]();};}function respondWithResult(_0x5861f0,_0x2e150f){_0x2e150f=_0x2e150f||0xc8;return function(_0x15990a){if(_0x15990a){return _0x5861f0[_0xebce('0x19')](_0x2e150f)[_0xebce('0x1b')](_0x15990a);}};}function respondWithFilteredResult(_0x58eaa0,_0x51c044){return function(_0x3364a1){if(_0x3364a1){var _0x3ac5d5=typeof _0x51c044[_0xebce('0x1c')]===_0xebce('0x1d')&&typeof _0x51c044['limit']===_0xebce('0x1d');var _0x392837=_0x3364a1[_0xebce('0x1e')];var _0x13658e=_0x3ac5d5?0x0:_0x51c044[_0xebce('0x1c')];var _0x5a478a=_0x3ac5d5?_0x3364a1[_0xebce('0x1e')]:_0x51c044[_0xebce('0x1c')]+_0x51c044['limit'];var _0x55f43f;if(_0x5a478a>=_0x392837){_0x5a478a=_0x392837;_0x55f43f=0xc8;}else{_0x55f43f=0xce;}_0x58eaa0[_0xebce('0x19')](_0x55f43f);return _0x58eaa0[_0xebce('0x1f')]('Content-Range',_0x13658e+'-'+_0x5a478a+'/'+_0x392837)[_0xebce('0x1b')](_0x3364a1);}return null;};}function patchUpdates(_0x43142e){return function(_0x5a1e2b){try{jsonpatch[_0xebce('0x20')](_0x5a1e2b,_0x43142e,!![]);}catch(_0x8b049c){return BPromise['reject'](_0x8b049c);}return _0x5a1e2b[_0xebce('0x21')]();};}function saveUpdates(_0xcd528e,_0x1c1ff8){return function(_0x4bfb50){if(_0x4bfb50){return _0x4bfb50[_0xebce('0x22')](_0xcd528e)[_0xebce('0x23')](function(_0x53f0df){return _0x53f0df;});}return null;};}function handleEntityNotFound(_0x50362b,_0x3aac9b){return function(_0x4711fa){if(!_0x4711fa){_0x50362b[_0xebce('0x24')](0x194);}return _0x4711fa;};}function handleError(_0x4f1b17,_0x58da34){_0x58da34=_0x58da34||0x1f4;return function(_0xc3a4fc){logger[_0xebce('0x25')](_0xc3a4fc[_0xebce('0x26')]);if(_0xc3a4fc[_0xebce('0x27')]){delete _0xc3a4fc[_0xebce('0x27')];}_0x4f1b17[_0xebce('0x19')](_0x58da34)[_0xebce('0x28')](_0xc3a4fc);};}exports[_0xebce('0x29')]=function(_0x3d18f5,_0x4e55bc){var _0x18c48b={},_0x40cbef={},_0x4eb8ee={'count':0x0,'rows':[]};var _0x197e69=_[_0xebce('0x2a')](db['Team']['rawAttributes'],function(_0x470a2d){return{'name':_0x470a2d[_0xebce('0x2b')],'type':_0x470a2d[_0xebce('0x2c')][_0xebce('0x2d')]};});_0x40cbef[_0xebce('0x2e')]=_[_0xebce('0x2a')](_0x197e69,'name');_0x40cbef[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x3d18f5[_0xebce('0x2f')]);_0x40cbef['filters']=_[_0xebce('0x31')](_0x40cbef[_0xebce('0x2e')],_0x40cbef['query']);_0x18c48b['attributes']=_[_0xebce('0x31')](_0x40cbef['model'],qs['fields'](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x32')]));_0x18c48b[_0xebce('0x33')]=_0x18c48b[_0xebce('0x33')][_0xebce('0x34')]?_0x18c48b[_0xebce('0x33')]:_0x40cbef[_0xebce('0x2e')];if(!_0x3d18f5['query']['hasOwnProperty'](_0xebce('0x35'))){_0x18c48b[_0xebce('0x36')]=qs[_0xebce('0x36')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x36')]);_0x18c48b[_0xebce('0x1c')]=qs[_0xebce('0x1c')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x1c')]);}_0x18c48b[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x3d18f5[_0xebce('0x2f')][_0xebce('0x38')]);_0x18c48b[_0xebce('0x39')]=qs[_0xebce('0x3a')](_['pick'](_0x3d18f5[_0xebce('0x2f')],_0x40cbef['filters']),_0x197e69);if(_0x3d18f5[_0xebce('0x2f')][_0xebce('0x3b')]){_0x18c48b[_0xebce('0x39')]=_[_0xebce('0x3c')](_0x18c48b[_0xebce('0x39')],{'$or':_[_0xebce('0x2a')](_0x197e69,function(_0x240f55){if(_0x240f55[_0xebce('0x2c')]!==_0xebce('0x3d')){var _0x14039a={};_0x14039a[_0x240f55[_0xebce('0x27')]]={'$like':'%'+_0x3d18f5[_0xebce('0x2f')]['filter']+'%'};return _0x14039a;}})});}_0x18c48b=_[_0xebce('0x3c')]({},_0x18c48b,_0x3d18f5[_0xebce('0x3e')]);var _0x3b069e={'where':_0x18c48b[_0xebce('0x39')]};return db[_0xebce('0x3f')][_0xebce('0x1e')](_0x3b069e)[_0xebce('0x23')](function(_0x47cfd3){_0x4eb8ee[_0xebce('0x1e')]=_0x47cfd3;if(_0x3d18f5[_0xebce('0x2f')]['includeAll']){_0x18c48b[_0xebce('0x40')]=[{'all':!![]}];}return db['Team'][_0xebce('0x41')](_0x18c48b);})[_0xebce('0x23')](function(_0x57192b){_0x4eb8ee[_0xebce('0x42')]=_0x57192b;return _0x4eb8ee;})[_0xebce('0x23')](respondWithFilteredResult(_0x4e55bc,_0x18c48b))[_0xebce('0x43')](handleError(_0x4e55bc,null));};exports[_0xebce('0x44')]=function(_0x1d48e8,_0x42aab4){var _0xb6490e={'raw':![],'where':{'id':_0x1d48e8[_0xebce('0x45')]['id']}},_0x16bf4b={};_0x16bf4b[_0xebce('0x2e')]=_[_0xebce('0x30')](db[_0xebce('0x3f')][_0xebce('0x46')]);_0x16bf4b[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x1d48e8['query']);_0x16bf4b[_0xebce('0x3a')]=_[_0xebce('0x31')](_0x16bf4b[_0xebce('0x2e')],_0x16bf4b[_0xebce('0x2f')]);_0xb6490e[_0xebce('0x33')]=_[_0xebce('0x31')](_0x16bf4b['model'],qs[_0xebce('0x32')](_0x1d48e8[_0xebce('0x2f')][_0xebce('0x32')]));_0xb6490e[_0xebce('0x33')]=_0xb6490e['attributes']['length']?_0xb6490e['attributes']:_0x16bf4b[_0xebce('0x2e')];if(_0x1d48e8['query'][_0xebce('0x47')]){_0xb6490e[_0xebce('0x40')]=[{'all':!![]}];}_0xb6490e=_[_0xebce('0x3c')]({},_0xb6490e,_0x1d48e8[_0xebce('0x3e')]);return db[_0xebce('0x3f')]['find'](_0xb6490e)[_0xebce('0x23')](handleEntityNotFound(_0x42aab4,null))[_0xebce('0x23')](respondWithResult(_0x42aab4,null))[_0xebce('0x43')](handleError(_0x42aab4,null));};exports[_0xebce('0x48')]=function(_0x51f896,_0x43c5e2){return db['Team'][_0xebce('0x48')](_0x51f896[_0xebce('0x49')],{})[_0xebce('0x23')](function(_0x4d0600){var _0x1b0740=_0x51f896[_0xebce('0x4a')]['get']({'plain':!![]});if(!_0x1b0740)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b0740[_0xebce('0x4b')]===_0xebce('0x4a')){var _0x44d802=_0x4d0600[_0xebce('0x4c')]({'plain':!![]});var _0x290fcc=_0xebce('0x4d');return db['UserProfileSection'][_0xebce('0x4e')]({'where':{'name':_0x290fcc,'userProfileId':_0x1b0740[_0xebce('0x4f')]},'raw':!![]})[_0xebce('0x23')](function(_0x376659){if(_0x376659&&_0x376659['autoAssociation']===0x0){return db[_0xebce('0x50')]['create']({'name':_0x44d802['name'],'resourceId':_0x44d802['id'],'type':_0x376659['name'],'sectionId':_0x376659['id']},{})[_0xebce('0x23')](function(){return _0x4d0600;});}else{return _0x4d0600;}})[_0xebce('0x43')](function(_0x44aa3e){logger[_0xebce('0x25')](_0xebce('0x51'),_0x44aa3e);throw _0x44aa3e;});}return _0x4d0600;})[_0xebce('0x23')](respondWithResult(_0x43c5e2,0xc9))[_0xebce('0x43')](handleError(_0x43c5e2,null));};exports[_0xebce('0x22')]=function(_0x4c11bc,_0x2f56ab){if(_0x4c11bc['body']['id']){delete _0x4c11bc['body']['id'];}return db[_0xebce('0x3f')][_0xebce('0x4e')]({'where':{'id':_0x4c11bc[_0xebce('0x45')]['id']}})[_0xebce('0x23')](handleEntityNotFound(_0x2f56ab,null))['then'](saveUpdates(_0x4c11bc[_0xebce('0x49')],null))['then'](respondWithResult(_0x2f56ab,null))['catch'](handleError(_0x2f56ab,null));};exports['destroy']=function(_0x1f40d4,_0x3cf28c){var _0xa48786=_0x1f40d4['params']['id'];var _0x2da844=[];return db[_0xebce('0x52')][_0xebce('0x53')](function(_0x54b99f){var _0x595caa=_0xebce('0x54')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x595caa,{'type':db['Sequelize'][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f})[_0xebce('0x23')](function(_0x2683fe){_0x2da844=_[_0xebce('0x2a')](_0x2683fe,function(_0x16a4db){return Number(_0x16a4db[_0xebce('0x57')]);});})['then'](function(){var _0x478301=_0xebce('0x58')+_0xa48786;return db['sequelize'][_0xebce('0x2f')](_0x478301,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0xecd27d){var _0x6b1c96=_[_0xebce('0x2a')](_0xecd27d,function(_0x1c25f3){return Number(_0x1c25f3[_0xebce('0x5a')]);});return db[_0xebce('0x5b')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'VoiceQueueId':{'$in':_0x6b1c96}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x4bd7ee=_0xebce('0x5d')+_0xa48786;return db[_0xebce('0x52')]['query'](_0x4bd7ee,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x5493f6){var _0x574dbd=_['map'](_0x5493f6,function(_0x4f1901){return Number(_0x4f1901[_0xebce('0x5e')]);});return db['UserMailQueue'][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'MailQueueId':{'$in':_0x574dbd}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x2dbfb0='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x2dbfb0,{'type':db[_0xebce('0x59')][_0xebce('0x55')]['SELECT'],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x218fcf){var _0x3d40e1=_[_0xebce('0x2a')](_0x218fcf,function(_0x1b99a6){return Number(_0x1b99a6[_0xebce('0x5f')]);});return db[_0xebce('0x60')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'SmsQueueId':{'$in':_0x3d40e1}},'transaction':_0x54b99f});})['then'](function(){var _0x3eb0aa=_0xebce('0x61')+_0xa48786;return db['sequelize'][_0xebce('0x2f')](_0x3eb0aa,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x229d81){var _0x17f840=_['map'](_0x229d81,function(_0x421723){return Number(_0x421723['ChatQueueId']);});return db[_0xebce('0x62')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'ChatQueueId':{'$in':_0x17f840}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x3c26ce=_0xebce('0x63')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x3c26ce,{'type':db[_0xebce('0x59')][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})['then'](function(_0x31d5f6){var _0x5d42a8=_[_0xebce('0x2a')](_0x31d5f6,function(_0x4fcd49){return Number(_0x4fcd49['FaxQueueId']);});return db[_0xebce('0x64')][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'FaxQueueId':{'$in':_0x5d42a8}},'transaction':_0x54b99f});})['then'](function(){var _0x340ed9=_0xebce('0x65')+_0xa48786;return db[_0xebce('0x52')]['query'](_0x340ed9,{'type':db['Sequelize'][_0xebce('0x55')][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x113b1f){var _0xfb47d7=_['map'](_0x113b1f,function(_0xad24b8){return Number(_0xad24b8['OpenchannelQueueId']);});return db[_0xebce('0x66')]['destroy']({'where':{'UserId':{'$in':_0x2da844},'OpenchannelQueueId':{'$in':_0xfb47d7}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){var _0x42cc4e=_0xebce('0x67')+_0xa48786;return db[_0xebce('0x52')][_0xebce('0x2f')](_0x42cc4e,{'type':db[_0xebce('0x59')]['QueryTypes'][_0xebce('0x56')],'raw':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x77021d){var _0x3293ac=_[_0xebce('0x2a')](_0x77021d,function(_0x14ec5b){return Number(_0x14ec5b['WhatsappQueueId']);});return db[_0xebce('0x68')]['destroy']({'where':{'UserId':{'$in':_0x2da844},'WhatsappQueueId':{'$in':_0x3293ac}},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){return db['TeamVoicePrefix'][_0xebce('0x4e')]({'where':{'TeamId':_0xa48786}});})[_0xebce('0x23')](function(_0x354c13){if(_0x354c13===null){return;}return db['UserVoicePrefix'][_0xebce('0x5c')]({'where':{'UserId':{'$in':_0x2da844},'VoicePrefixId':_0x354c13[_0xebce('0x69')]},'transaction':_0x54b99f});})[_0xebce('0x23')](function(){return db[_0xebce('0x3f')][_0xebce('0x5c')]({'where':{'id':_0xa48786},'cascade':!![],'transaction':_0x54b99f});})[_0xebce('0x23')](function(_0x2784c8){if(_0x2784c8===0x0){_0x3cf28c[_0xebce('0x24')](0x194);}else{return db['UserProfileResource'][_0xebce('0x5c')]({'where':{'type':_0xebce('0x4d'),'resourceId':_0xa48786},'cascade':!![],'transaction':_0x54b99f})[_0xebce('0x23')](function(){_0x3cf28c[_0xebce('0x19')](0xcc)[_0xebce('0x1a')]();});}})[_0xebce('0x43')](function(_0x2e85d1){_0x3cf28c['status'](0x1f4)['send'](_0x2e85d1);});});};exports[_0xebce('0x6a')]=function(_0x5c28c3,_0x38cc0b,_0x46808b){return db[_0xebce('0x3f')]['findOne']({'where':{'id':_0x5c28c3['params']['id']}})['then'](handleEntityNotFound(_0x38cc0b,null))['then'](function(_0x1c6f3c){if(!_0x5c28c3[_0xebce('0x2f')]['channel']||!utils[_0xebce('0x6b')](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x6c')])){throw new db[(_0xebce('0x59'))][(_0xebce('0x6d'))]('Unknown\x20channel');}var _0x23e320={};var _0x300c3b={};_0x300c3b[_0xebce('0x2e')]=_[_0xebce('0x30')](db[_[_0xebce('0x6e')](_0x5c28c3['query']['channel'][_0xebce('0x6f')]())+_0xebce('0x70')][_0xebce('0x46')]);_0x300c3b[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x5c28c3[_0xebce('0x2f')]);_0x300c3b['filters']=_['intersection'](_0x300c3b['model'],_0x300c3b[_0xebce('0x2f')]);_0x23e320[_0xebce('0x33')]=_[_0xebce('0x31')](_0x300c3b[_0xebce('0x2e')],qs['fields'](_0x5c28c3[_0xebce('0x2f')]['fields']));_0x23e320['attributes']=_0x23e320[_0xebce('0x33')][_0xebce('0x34')]?_0x23e320[_0xebce('0x33')]:_0x300c3b[_0xebce('0x2e')];_0x23e320[_0xebce('0x36')]=qs['limit'](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x36')]);_0x23e320[_0xebce('0x1c')]=qs[_0xebce('0x1c')](_0x5c28c3[_0xebce('0x2f')]['offset']);_0x23e320[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x5c28c3[_0xebce('0x2f')][_0xebce('0x38')]);_0x23e320[_0xebce('0x39')]=qs[_0xebce('0x3a')](_[_0xebce('0x71')](_0x5c28c3[_0xebce('0x2f')],_0x300c3b['filters']));_0x23e320=_[_0xebce('0x3c')]({},_0x23e320,_0x5c28c3[_0xebce('0x3e')]);return _0x1c6f3c['get'+_[_0xebce('0x6e')](_0x5c28c3['query'][_0xebce('0x6c')][_0xebce('0x6f')]())+'Queues'](_0x23e320);})[_0xebce('0x23')](respondWithResult(_0x38cc0b,null))[_0xebce('0x43')](handleError(_0x38cc0b,null));};exports[_0xebce('0x72')]=function(_0x485ef5,_0x4fb69b,_0x14033c){return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x485ef5[_0xebce('0x45')]['id']}})[_0xebce('0x23')](function(_0x328a8a){if(_0x328a8a){if(!_0x485ef5['body'][_0xebce('0x6c')]||!utils[_0xebce('0x6b')](_0x485ef5[_0xebce('0x49')][_0xebce('0x6c')])){throw new db[(_0xebce('0x59'))][(_0xebce('0x6d'))](_0xebce('0x74'));}return _0x328a8a[_0xebce('0x75')+_[_0xebce('0x6e')](_0x485ef5[_0xebce('0x49')]['channel'][_0xebce('0x6f')]())+'Queues'](_0x485ef5[_0xebce('0x49')][_0xebce('0x76')]);}return null;})[_0xebce('0x23')](handleEntityNotFound(_0x4fb69b,null))[_0xebce('0x23')](respondWithStatusCode(_0x4fb69b,null))[_0xebce('0x43')](handleError(_0x4fb69b,null));};exports[_0xebce('0x77')]=function(_0x16f431,_0x3d3415,_0x293a40){return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x16f431[_0xebce('0x45')]['id']}})[_0xebce('0x23')](function(_0x121eda){if(_0x121eda){if(!_0x16f431[_0xebce('0x2f')]['channel']||!utils[_0xebce('0x6b')](_0x16f431[_0xebce('0x2f')]['channel'])){throw new db[(_0xebce('0x59'))]['ValidationError'](_0xebce('0x74'));}return _0x121eda['remove'+_['capitalize'](_0x16f431[_0xebce('0x2f')]['channel'][_0xebce('0x6f')]())+_0xebce('0x78')](_0x16f431[_0xebce('0x2f')][_0xebce('0x76')]);}return null;})[_0xebce('0x23')](handleEntityNotFound(_0x3d3415,null))[_0xebce('0x23')](respondWithStatusCode(_0x3d3415,null))[_0xebce('0x43')](handleError(_0x3d3415,null));};exports[_0xebce('0x79')]=function(_0x1f9e25,_0x1558a3){var _0x26b1f1=_[_0xebce('0x7a')](_0x1f9e25[_0xebce('0x49')]['ids'])?_0x1f9e25['body']['ids']:[_0x1f9e25[_0xebce('0x49')][_0xebce('0x76')]];var _0xd39ea4=_0x1f9e25[_0xebce('0x45')]['id'];return db['Team'][_0xebce('0x4e')]({'where':{'id':_0xd39ea4}})[_0xebce('0x23')](handleEntityNotFound(_0x1558a3,null))[_0xebce('0x23')](function(_0x4c119a){if(_0x4c119a){var _0x51c0fb=[_0xebce('0x7b'),_0xebce('0x7c'),'Mail',_0xebce('0x7d'),_0xebce('0x7e'),'Openchannel',_0xebce('0x7f')];return db[_0xebce('0x52')][_0xebce('0x53')](function(_0x3f9e9f){var _0x4c8ba8=_['map'](_0x51c0fb,function(_0x54949a){var _0x3c3467={'attributes':['id',_0xebce('0x27')]};if(_0x54949a===_0xebce('0x7b')){_0x3c3467['through']={'attributes':[_0xebce('0x80')]};}return _0x4c119a['get'+_0x54949a+'Queues'](_0x3c3467)[_0xebce('0x23')](function(_0x3694ff){var _0xf4d4b=_[_0xebce('0x2a')](_0x3694ff,function(_0x118451){var _0x53dc7a=_[_0xebce('0x2a')](_0x26b1f1,function(_0x1175af){var _0x1346a3={'where':{'UserId':_0x1175af,[_0x54949a+_0xebce('0x81')]:_0x118451['id']},'transaction':_0x3f9e9f};if(_0x54949a===_0xebce('0x7b')){_0x1346a3[_0xebce('0x15')]={'penalty':_0x118451[_0xebce('0x82')][_0xebce('0x80')]};}return db[_0xebce('0x83')+_0x54949a+_0xebce('0x70')][_0xebce('0x84')](_0x1346a3)[_0xebce('0x23')](function(){socket[_0xebce('0x85')](_0xebce('0x4a')+_0x54949a+_0xebce('0x86'),{'UserId':_0x1175af,[_0x54949a+'QueueId']:_0x118451['id']});if(_0x54949a!==_0xebce('0x7b')){return;}return db[_0xebce('0x83')][_0xebce('0x41')]({'where':{'id':_0x26b1f1,'online':0x1},'attributes':['id','name',_0xebce('0x87'),_0xebce('0x88'),'interface'],'raw':!![]})[_0xebce('0x23')](function(_0x415b87){var _0x519e06=_[_0xebce('0x2a')](_0x415b87,function(_0x3bc442){return db[_0xebce('0x89')][_0xebce('0x8a')]({'membername':_0x3bc442[_0xebce('0x27')],'UserId':_0x3bc442['id'],'queue_name':_0x118451[_0xebce('0x27')],'VoiceQueueId':_0x118451['id'],'interface':_['isNil'](_0x3bc442[_0xebce('0x8b')])?util['format'](_0xebce('0x8c'),_0x3bc442['name']):_0x3bc442[_0xebce('0x8b')],'paused':_0x3bc442[_0xebce('0x88')]||![],'penalty':_0x118451[_0xebce('0x82')][_0xebce('0x80')]},{'transaction':_0x3f9e9f});});return Promise[_0xebce('0x8d')](_0x519e06);});});});return Promise[_0xebce('0x8d')](_0x53dc7a);});return Promise[_0xebce('0x8d')](_0xf4d4b);})[_0xebce('0x23')](function(){return db[_0xebce('0x8e')][_0xebce('0x73')]({'where':{'teamId':_0xd39ea4}})[_0xebce('0x23')](function(_0xda9ef9){if(_0xda9ef9){var _0x4d6c72=_[_0xebce('0x2a')](_0x26b1f1,function(_0x144e90){db[_0xebce('0x8f')][_0xebce('0x8a')]({'UserId':_0x144e90,'VoicePrefixId':_0xda9ef9[_0xebce('0x69')]});});return Promise[_0xebce('0x8d')](_0x4d6c72);}});});});return Promise[_0xebce('0x8d')](_0x4c8ba8)['then'](function(){return _0x4c119a[_0xebce('0x79')](_0x26b1f1,{'transaction':_0x3f9e9f})['spread'](function(_0x3c6556){return _0x3c6556;});});});}})[_0xebce('0x23')](respondWithResult(_0x1558a3,null))[_0xebce('0x43')](handleError(_0x1558a3,null));};exports[_0xebce('0x90')]=function(_0x367320,_0x519d45){var _0x50aff1=_[_0xebce('0x7a')](_0x367320[_0xebce('0x2f')][_0xebce('0x76')])?_0x367320[_0xebce('0x2f')][_0xebce('0x76')]:[_0x367320[_0xebce('0x2f')][_0xebce('0x76')]];var _0x1a25fa=_0x367320[_0xebce('0x45')]['id'];return db[_0xebce('0x3f')][_0xebce('0x4e')]({'where':{'id':_0x1a25fa}})[_0xebce('0x23')](handleEntityNotFound(_0x519d45,null))[_0xebce('0x23')](function(_0x32f5cc){if(_0x32f5cc){var _0x3e18e2=['Voice','Chat',_0xebce('0x91'),_0xebce('0x7d'),_0xebce('0x7e'),_0xebce('0x92'),_0xebce('0x7f')];return db[_0xebce('0x52')]['transaction'](function(_0x4c7343){var _0x8c92fb=_[_0xebce('0x2a')](_0x3e18e2,function(_0x4c3607){var _0x14c7fd={'attributes':['id',_0xebce('0x27')]};return _0x32f5cc[_0xebce('0x4c')+_0x4c3607+_0xebce('0x78')](_0x14c7fd)[_0xebce('0x23')](function(_0x11e17e){var _0x54f689=_['map'](_0x11e17e,function(_0x59a95e){return _0x59a95e[_0xebce('0x90')](_0x50aff1,{'transaction':_0x4c7343})[_0xebce('0x23')](function(){var _0x320a32=_[_0xebce('0x2a')](_0x50aff1,function(_0x87411f){socket[_0xebce('0x85')]('user'+_0x4c3607+'Queue:remove',{'UserId':Number(_0x87411f),[_0x4c3607+_0xebce('0x81')]:_0x59a95e['id']});if(_0x4c3607!==_0xebce('0x7b')){return;}return db[_0xebce('0x89')][_0xebce('0x5c')]({'where':{'VoiceQueueId':_0x59a95e['id'],'UserId':_0x87411f},'transaction':_0x4c7343});});return Promise[_0xebce('0x8d')](_0x320a32);});});return Promise[_0xebce('0x8d')](_0x54f689);});});return Promise[_0xebce('0x8d')](_0x8c92fb)[_0xebce('0x23')](function(){return _0x32f5cc[_0xebce('0x90')](_0x50aff1,{'transaction':_0x4c7343});})[_0xebce('0x23')](function(){return db[_0xebce('0x8e')][_0xebce('0x73')]({'where':{'teamId':_0x1a25fa}})['then'](function(_0x51ee3a){if(_0x51ee3a){var _0xce128d=_[_0xebce('0x2a')](_0x50aff1,function(_0x2e6474){db['UserVoicePrefix'][_0xebce('0x5c')]({'where':{'UserId':_0x2e6474,'VoicePrefixId':_0x51ee3a[_0xebce('0x69')]}});});return Promise[_0xebce('0x8d')](_0xce128d);}});});});}})[_0xebce('0x23')](respondWithStatusCode(_0x519d45,null))[_0xebce('0x43')](handleError(_0x519d45,null));};exports[_0xebce('0x93')]=function(_0x412571,_0x3cc5d2,_0x2444bd){var _0x3a3960={};var _0x283eb2={};var _0x17b8d2;var _0x51adb3;return db[_0xebce('0x3f')][_0xebce('0x73')]({'where':{'id':_0x412571[_0xebce('0x45')]['id']}})[_0xebce('0x23')](handleEntityNotFound(_0x3cc5d2,null))[_0xebce('0x23')](function(_0x31888d){if(_0x31888d){_0x17b8d2=_0x31888d;_0x283eb2['model']=_[_0xebce('0x30')](db[_0xebce('0x83')][_0xebce('0x46')]);_0x283eb2[_0xebce('0x2f')]=_['keys'](_0x412571[_0xebce('0x2f')]);_0x283eb2[_0xebce('0x3a')]=_[_0xebce('0x31')](_0x283eb2[_0xebce('0x2e')],_0x283eb2[_0xebce('0x2f')]);_0x3a3960[_0xebce('0x33')]=_['intersection'](_0x283eb2[_0xebce('0x2e')],qs[_0xebce('0x32')](_0x412571[_0xebce('0x2f')][_0xebce('0x32')]));_0x3a3960[_0xebce('0x33')]=_0x3a3960[_0xebce('0x33')]['length']?_0x3a3960[_0xebce('0x33')]:_0x283eb2[_0xebce('0x2e')];_0x3a3960[_0xebce('0x37')]=qs[_0xebce('0x38')](_0x412571['query'][_0xebce('0x38')]);_0x3a3960[_0xebce('0x39')]=qs[_0xebce('0x3a')](_[_0xebce('0x71')](_0x412571[_0xebce('0x2f')],_0x283eb2[_0xebce('0x3a')]));if(_0x412571[_0xebce('0x2f')][_0xebce('0x3b')]){_0x3a3960['where']=_['merge'](_0x3a3960['where'],{'$or':_[_0xebce('0x2a')](_0x3a3960[_0xebce('0x33')],function(_0x1b6a94){var _0x25cbe8={};_0x25cbe8[_0x1b6a94]={'$like':'%'+_0x412571[_0xebce('0x2f')][_0xebce('0x3b')]+'%'};return _0x25cbe8;})});}_0x3a3960=_['merge']({},_0x3a3960,_0x412571[_0xebce('0x3e')]);return _0x17b8d2[_0xebce('0x93')](_0x3a3960);}})[_0xebce('0x23')](function(_0x44d8b2){if(_0x44d8b2){_0x51adb3=_0x44d8b2[_0xebce('0x34')];if(!_0x412571[_0xebce('0x2f')]['hasOwnProperty'](_0xebce('0x35'))){_0x3a3960['limit']=qs[_0xebce('0x36')](_0x412571[_0xebce('0x2f')][_0xebce('0x36')]);_0x3a3960['offset']=qs['offset'](_0x412571[_0xebce('0x2f')][_0xebce('0x1c')]);}return _0x17b8d2[_0xebce('0x93')](_0x3a3960);}})[_0xebce('0x23')](function(_0x2c2309){if(_0x2c2309){return _0x2c2309?{'count':_0x51adb3,'rows':_0x2c2309}:null;}})[_0xebce('0x23')](respondWithResult(_0x3cc5d2,null))[_0xebce('0x43')](handleError(_0x3cc5d2,null));}; \ No newline at end of file +var _0xe884=['findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','UserVoicePrefix','addAgents','spread','Chat','Fax','Queue:remove','removeAgents','getAgents','eml-format','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserMailQueue','destroy','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','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','Unknown\x20channel','add','ids','removeQueues','remove','isArray','Voice','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User'];(function(_0x263418,_0x2555a9){var _0x2a66c4=function(_0x304fd2){while(--_0x304fd2){_0x263418['push'](_0x263418['shift']());}};_0x2a66c4(++_0x2555a9);}(_0xe884,0xa9));var _0x4e88=function(_0x10a213,_0x47c5ca){_0x10a213=_0x10a213-0x0;var _0x3955e4=_0xe884[_0x10a213];return _0x3955e4;};'use strict';var emlformat=require(_0x4e88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e88('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4e88('0x2'));var util=require(_0x4e88('0x3'));var path=require(_0x4e88('0x4'));var sox=require(_0x4e88('0x5'));var csv=require(_0x4e88('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e88('0x7'));var _=require(_0x4e88('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e88('0x9'));var deskjs=require(_0x4e88('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e88('0xb'));var authService=require(_0x4e88('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4e88('0xd'));var hardwareService=require(_0x4e88('0xe'));var logger=require(_0x4e88('0xf'))(_0x4e88('0x10'));var utils=require(_0x4e88('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4e88('0x12'));var db=require(_0x4e88('0x13'))['db'];config[_0x4e88('0x14')]=_[_0x4e88('0x15')](config[_0x4e88('0x14')],{'host':_0x4e88('0x16'),'port':0x18eb});var socket=require(_0x4e88('0x17'))(new Redis(config[_0x4e88('0x14')]));require(_0x4e88('0x18'))[_0x4e88('0x19')](socket);function respondWithStatusCode(_0x431c7c,_0x1e791d){_0x1e791d=_0x1e791d||0xcc;return function(_0x1cac03){if(_0x1cac03){return _0x431c7c[_0x4e88('0x1a')](_0x1e791d);}return _0x431c7c[_0x4e88('0x1b')](_0x1e791d)[_0x4e88('0x1c')]();};}function respondWithResult(_0x81a29e,_0xa7f5c4){_0xa7f5c4=_0xa7f5c4||0xc8;return function(_0x3ad447){if(_0x3ad447){return _0x81a29e[_0x4e88('0x1b')](_0xa7f5c4)[_0x4e88('0x1d')](_0x3ad447);}};}function respondWithFilteredResult(_0x361eca,_0x5484c2){return function(_0x3b2d10){if(_0x3b2d10){var _0x435692=typeof _0x5484c2[_0x4e88('0x1e')]==='undefined'&&typeof _0x5484c2[_0x4e88('0x1f')]==='undefined';var _0x3f219b=_0x3b2d10['count'];var _0x5d88b7=_0x435692?0x0:_0x5484c2[_0x4e88('0x1e')];var _0x1d3abd=_0x435692?_0x3b2d10[_0x4e88('0x20')]:_0x5484c2[_0x4e88('0x1e')]+_0x5484c2[_0x4e88('0x1f')];var _0x1ed509;if(_0x1d3abd>=_0x3f219b){_0x1d3abd=_0x3f219b;_0x1ed509=0xc8;}else{_0x1ed509=0xce;}_0x361eca[_0x4e88('0x1b')](_0x1ed509);return _0x361eca[_0x4e88('0x21')](_0x4e88('0x22'),_0x5d88b7+'-'+_0x1d3abd+'/'+_0x3f219b)[_0x4e88('0x1d')](_0x3b2d10);}return null;};}function patchUpdates(_0x36ed9f){return function(_0x4d2c10){try{jsonpatch['apply'](_0x4d2c10,_0x36ed9f,!![]);}catch(_0x45b89b){return BPromise[_0x4e88('0x23')](_0x45b89b);}return _0x4d2c10['save']();};}function saveUpdates(_0x3f11f8,_0x409011){return function(_0x357afe){if(_0x357afe){return _0x357afe[_0x4e88('0x24')](_0x3f11f8)[_0x4e88('0x25')](function(_0x2524e0){return _0x2524e0;});}return null;};}function handleEntityNotFound(_0x23f22e,_0x13a7d0){return function(_0x2e732c){if(!_0x2e732c){_0x23f22e[_0x4e88('0x1a')](0x194);}return _0x2e732c;};}function handleError(_0x1cad1b,_0x119fa9){_0x119fa9=_0x119fa9||0x1f4;return function(_0xda2e91){logger[_0x4e88('0x26')](_0xda2e91[_0x4e88('0x27')]);if(_0xda2e91[_0x4e88('0x28')]){delete _0xda2e91[_0x4e88('0x28')];}_0x1cad1b['status'](_0x119fa9)[_0x4e88('0x29')](_0xda2e91);};}exports[_0x4e88('0x2a')]=function(_0x28bbfb,_0x3d7708){var _0x42356e={},_0x12bd80={},_0x195eb5={'count':0x0,'rows':[]};var _0x4955fa=_[_0x4e88('0x2b')](db[_0x4e88('0x2c')][_0x4e88('0x2d')],function(_0x3c34f5){return{'name':_0x3c34f5['fieldName'],'type':_0x3c34f5[_0x4e88('0x2e')][_0x4e88('0x2f')]};});_0x12bd80[_0x4e88('0x30')]=_[_0x4e88('0x2b')](_0x4955fa,_0x4e88('0x28'));_0x12bd80['query']=_[_0x4e88('0x31')](_0x28bbfb[_0x4e88('0x32')]);_0x12bd80[_0x4e88('0x33')]=_[_0x4e88('0x34')](_0x12bd80[_0x4e88('0x30')],_0x12bd80[_0x4e88('0x32')]);_0x42356e['attributes']=_[_0x4e88('0x34')](_0x12bd80[_0x4e88('0x30')],qs['fields'](_0x28bbfb[_0x4e88('0x32')][_0x4e88('0x35')]));_0x42356e[_0x4e88('0x36')]=_0x42356e[_0x4e88('0x36')]['length']?_0x42356e[_0x4e88('0x36')]:_0x12bd80[_0x4e88('0x30')];if(!_0x28bbfb[_0x4e88('0x32')][_0x4e88('0x37')](_0x4e88('0x38'))){_0x42356e[_0x4e88('0x1f')]=qs[_0x4e88('0x1f')](_0x28bbfb['query'][_0x4e88('0x1f')]);_0x42356e['offset']=qs['offset'](_0x28bbfb[_0x4e88('0x32')]['offset']);}_0x42356e[_0x4e88('0x39')]=qs[_0x4e88('0x3a')](_0x28bbfb[_0x4e88('0x32')][_0x4e88('0x3a')]);_0x42356e['where']=qs['filters'](_[_0x4e88('0x3b')](_0x28bbfb['query'],_0x12bd80[_0x4e88('0x33')]),_0x4955fa);if(_0x28bbfb['query'][_0x4e88('0x3c')]){_0x42356e[_0x4e88('0x3d')]=_[_0x4e88('0x3e')](_0x42356e['where'],{'$or':_[_0x4e88('0x2b')](_0x4955fa,function(_0x5e60a9){if(_0x5e60a9['type']!==_0x4e88('0x3f')){var _0x1d098f={};_0x1d098f[_0x5e60a9[_0x4e88('0x28')]]={'$like':'%'+_0x28bbfb[_0x4e88('0x32')][_0x4e88('0x3c')]+'%'};return _0x1d098f;}})});}_0x42356e=_['merge']({},_0x42356e,_0x28bbfb[_0x4e88('0x40')]);var _0x10294c={'where':_0x42356e[_0x4e88('0x3d')]};return db[_0x4e88('0x2c')][_0x4e88('0x20')](_0x10294c)[_0x4e88('0x25')](function(_0x1b66de){_0x195eb5['count']=_0x1b66de;if(_0x28bbfb['query'][_0x4e88('0x41')]){_0x42356e[_0x4e88('0x42')]=[{'all':!![]}];}return db[_0x4e88('0x2c')][_0x4e88('0x43')](_0x42356e);})['then'](function(_0x51c7ce){_0x195eb5[_0x4e88('0x44')]=_0x51c7ce;return _0x195eb5;})[_0x4e88('0x25')](respondWithFilteredResult(_0x3d7708,_0x42356e))[_0x4e88('0x45')](handleError(_0x3d7708,null));};exports[_0x4e88('0x46')]=function(_0x2090e2,_0x2846e0){var _0x348289={'raw':![],'where':{'id':_0x2090e2[_0x4e88('0x47')]['id']}},_0x997467={};_0x997467[_0x4e88('0x30')]=_['keys'](db['Team'][_0x4e88('0x2d')]);_0x997467['query']=_['keys'](_0x2090e2[_0x4e88('0x32')]);_0x997467[_0x4e88('0x33')]=_[_0x4e88('0x34')](_0x997467[_0x4e88('0x30')],_0x997467[_0x4e88('0x32')]);_0x348289['attributes']=_['intersection'](_0x997467['model'],qs[_0x4e88('0x35')](_0x2090e2[_0x4e88('0x32')]['fields']));_0x348289[_0x4e88('0x36')]=_0x348289[_0x4e88('0x36')][_0x4e88('0x48')]?_0x348289['attributes']:_0x997467[_0x4e88('0x30')];if(_0x2090e2['query'][_0x4e88('0x41')]){_0x348289[_0x4e88('0x42')]=[{'all':!![]}];}_0x348289=_[_0x4e88('0x3e')]({},_0x348289,_0x2090e2['options']);return db['Team'][_0x4e88('0x49')](_0x348289)[_0x4e88('0x25')](handleEntityNotFound(_0x2846e0,null))[_0x4e88('0x25')](respondWithResult(_0x2846e0,null))[_0x4e88('0x45')](handleError(_0x2846e0,null));};exports[_0x4e88('0x4a')]=function(_0x281e01,_0x543bd8){return db['Team']['create'](_0x281e01[_0x4e88('0x4b')],{})[_0x4e88('0x25')](function(_0x294652){var _0x4fd31a=_0x281e01['user'][_0x4e88('0x4c')]({'plain':!![]});if(!_0x4fd31a)throw new Error(_0x4e88('0x4d'));if(_0x4fd31a[_0x4e88('0x4e')]===_0x4e88('0x4f')){var _0x642d72=_0x294652[_0x4e88('0x4c')]({'plain':!![]});var _0x19718c=_0x4e88('0x50');return db[_0x4e88('0x51')][_0x4e88('0x49')]({'where':{'name':_0x19718c,'userProfileId':_0x4fd31a[_0x4e88('0x52')]},'raw':!![]})[_0x4e88('0x25')](function(_0x4b48ff){if(_0x4b48ff&&_0x4b48ff[_0x4e88('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x642d72[_0x4e88('0x28')],'resourceId':_0x642d72['id'],'type':_0x4b48ff['name'],'sectionId':_0x4b48ff['id']},{})[_0x4e88('0x25')](function(){return _0x294652;});}else{return _0x294652;}})['catch'](function(_0x53821a){logger[_0x4e88('0x26')](_0x4e88('0x54'),_0x53821a);throw _0x53821a;});}return _0x294652;})[_0x4e88('0x25')](respondWithResult(_0x543bd8,0xc9))[_0x4e88('0x45')](handleError(_0x543bd8,null));};exports[_0x4e88('0x24')]=function(_0x103ba3,_0x30f7d3){if(_0x103ba3['body']['id']){delete _0x103ba3[_0x4e88('0x4b')]['id'];}return db[_0x4e88('0x2c')][_0x4e88('0x49')]({'where':{'id':_0x103ba3[_0x4e88('0x47')]['id']}})[_0x4e88('0x25')](handleEntityNotFound(_0x30f7d3,null))[_0x4e88('0x25')](saveUpdates(_0x103ba3[_0x4e88('0x4b')],null))[_0x4e88('0x25')](respondWithResult(_0x30f7d3,null))[_0x4e88('0x45')](handleError(_0x30f7d3,null));};exports['destroy']=function(_0x17a925,_0x108e7c){var _0x46ef74=_0x17a925[_0x4e88('0x47')]['id'];var _0x34dfe0=[];return db[_0x4e88('0x55')][_0x4e88('0x56')](function(_0x4a9b88){var _0x16721f='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x46ef74;return db['sequelize'][_0x4e88('0x32')](_0x16721f,{'type':db[_0x4e88('0x57')]['QueryTypes'][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88})['then'](function(_0x4a82a8){_0x34dfe0=_[_0x4e88('0x2b')](_0x4a82a8,function(_0x1aec64){return Number(_0x1aec64[_0x4e88('0x59')]);});})[_0x4e88('0x25')](function(){var _0x127fa8=_0x4e88('0x5a')+_0x46ef74;return db['sequelize'][_0x4e88('0x32')](_0x127fa8,{'type':db[_0x4e88('0x57')]['QueryTypes'][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})['then'](function(_0x309ed0){var _0x1b8edf=_[_0x4e88('0x2b')](_0x309ed0,function(_0x21a3fb){return Number(_0x21a3fb['VoiceQueueId']);});return db[_0x4e88('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x34dfe0},'VoiceQueueId':{'$in':_0x1b8edf}},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){var _0x72668b=_0x4e88('0x5c')+_0x46ef74;return db[_0x4e88('0x55')][_0x4e88('0x32')](_0x72668b,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(_0x17ee7d){var _0x1a9715=_[_0x4e88('0x2b')](_0x17ee7d,function(_0x1a82f1){return Number(_0x1a82f1['MailQueueId']);});return db[_0x4e88('0x5e')][_0x4e88('0x5f')]({'where':{'UserId':{'$in':_0x34dfe0},'MailQueueId':{'$in':_0x1a9715}},'transaction':_0x4a9b88});})['then'](function(){var _0x425441='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46ef74;return db['sequelize'][_0x4e88('0x32')](_0x425441,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(_0xdbbdb9){var _0x4c27f0=_[_0x4e88('0x2b')](_0xdbbdb9,function(_0x2bb5cb){return Number(_0x2bb5cb['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x34dfe0},'SmsQueueId':{'$in':_0x4c27f0}},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){var _0x5ae51e='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46ef74;return db[_0x4e88('0x55')][_0x4e88('0x32')](_0x5ae51e,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})['then'](function(_0xbbf1da){var _0x2f45ea=_['map'](_0xbbf1da,function(_0x236ab3){return Number(_0x236ab3['ChatQueueId']);});return db[_0x4e88('0x60')][_0x4e88('0x5f')]({'where':{'UserId':{'$in':_0x34dfe0},'ChatQueueId':{'$in':_0x2f45ea}},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){var _0x459431=_0x4e88('0x61')+_0x46ef74;return db[_0x4e88('0x55')][_0x4e88('0x32')](_0x459431,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(_0x1975bd){var _0x4a89ff=_[_0x4e88('0x2b')](_0x1975bd,function(_0x3c3b88){return Number(_0x3c3b88[_0x4e88('0x62')]);});return db[_0x4e88('0x63')]['destroy']({'where':{'UserId':{'$in':_0x34dfe0},'FaxQueueId':{'$in':_0x4a89ff}},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){var _0x327d2c=_0x4e88('0x64')+_0x46ef74;return db['sequelize'][_0x4e88('0x32')](_0x327d2c,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})['then'](function(_0x3fac0f){var _0x906438=_[_0x4e88('0x2b')](_0x3fac0f,function(_0x182fb8){return Number(_0x182fb8[_0x4e88('0x65')]);});return db['UserOpenchannelQueue'][_0x4e88('0x5f')]({'where':{'UserId':{'$in':_0x34dfe0},'OpenchannelQueueId':{'$in':_0x906438}},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){var _0x17227a=_0x4e88('0x66')+_0x46ef74;return db['sequelize'][_0x4e88('0x32')](_0x17227a,{'type':db[_0x4e88('0x57')][_0x4e88('0x5d')][_0x4e88('0x58')],'raw':!![],'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(_0x5e05a2){var _0x3d3996=_[_0x4e88('0x2b')](_0x5e05a2,function(_0x5a0f05){return Number(_0x5a0f05[_0x4e88('0x67')]);});return db['UserWhatsappQueue'][_0x4e88('0x5f')]({'where':{'UserId':{'$in':_0x34dfe0},'WhatsappQueueId':{'$in':_0x3d3996}},'transaction':_0x4a9b88});})['then'](function(){return db[_0x4e88('0x68')]['find']({'where':{'TeamId':_0x46ef74}});})[_0x4e88('0x25')](function(_0x28a5d1){if(_0x28a5d1===null){return;}return db['UserVoicePrefix'][_0x4e88('0x5f')]({'where':{'UserId':{'$in':_0x34dfe0},'VoicePrefixId':_0x28a5d1[_0x4e88('0x69')]},'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(){return db[_0x4e88('0x2c')][_0x4e88('0x5f')]({'where':{'id':_0x46ef74},'cascade':!![],'transaction':_0x4a9b88});})[_0x4e88('0x25')](function(_0x3f7614){if(_0x3f7614===0x0){_0x108e7c[_0x4e88('0x1a')](0x194);}else{return db[_0x4e88('0x6a')][_0x4e88('0x5f')]({'where':{'type':'Teams','resourceId':_0x46ef74},'cascade':!![],'transaction':_0x4a9b88})['then'](function(){_0x108e7c['status'](0xcc)[_0x4e88('0x1c')]();});}})[_0x4e88('0x45')](function(_0x59ac3b){_0x108e7c['status'](0x1f4)[_0x4e88('0x29')](_0x59ac3b);});});};exports[_0x4e88('0x6b')]=function(_0x3b496e,_0x358f35,_0x57a182){return db['Team'][_0x4e88('0x6c')]({'where':{'id':_0x3b496e[_0x4e88('0x47')]['id']}})[_0x4e88('0x25')](handleEntityNotFound(_0x358f35,null))[_0x4e88('0x25')](function(_0x36f25f){if(!_0x3b496e[_0x4e88('0x32')][_0x4e88('0x6d')]||!utils['isValidChannel'](_0x3b496e[_0x4e88('0x32')]['channel'])){throw new db[(_0x4e88('0x57'))][(_0x4e88('0x6e'))]('Unknown\x20channel');}var _0x394435={};var _0x4955c6={};_0x4955c6[_0x4e88('0x30')]=_[_0x4e88('0x31')](db[_[_0x4e88('0x6f')](_0x3b496e[_0x4e88('0x32')]['channel'][_0x4e88('0x70')]())+_0x4e88('0x71')][_0x4e88('0x2d')]);_0x4955c6['query']=_[_0x4e88('0x31')](_0x3b496e[_0x4e88('0x32')]);_0x4955c6[_0x4e88('0x33')]=_['intersection'](_0x4955c6[_0x4e88('0x30')],_0x4955c6[_0x4e88('0x32')]);_0x394435[_0x4e88('0x36')]=_[_0x4e88('0x34')](_0x4955c6[_0x4e88('0x30')],qs[_0x4e88('0x35')](_0x3b496e['query'][_0x4e88('0x35')]));_0x394435[_0x4e88('0x36')]=_0x394435[_0x4e88('0x36')]['length']?_0x394435['attributes']:_0x4955c6['model'];_0x394435[_0x4e88('0x1f')]=qs[_0x4e88('0x1f')](_0x3b496e[_0x4e88('0x32')][_0x4e88('0x1f')]);_0x394435['offset']=qs[_0x4e88('0x1e')](_0x3b496e[_0x4e88('0x32')]['offset']);_0x394435['order']=qs[_0x4e88('0x3a')](_0x3b496e[_0x4e88('0x32')][_0x4e88('0x3a')]);_0x394435[_0x4e88('0x3d')]=qs[_0x4e88('0x33')](_[_0x4e88('0x3b')](_0x3b496e[_0x4e88('0x32')],_0x4955c6[_0x4e88('0x33')]));_0x394435=_[_0x4e88('0x3e')]({},_0x394435,_0x3b496e[_0x4e88('0x40')]);return _0x36f25f[_0x4e88('0x4c')+_[_0x4e88('0x6f')](_0x3b496e['query'][_0x4e88('0x6d')][_0x4e88('0x70')]())+_0x4e88('0x72')](_0x394435);})['then'](respondWithResult(_0x358f35,null))['catch'](handleError(_0x358f35,null));};exports[_0x4e88('0x73')]=function(_0x24c3de,_0x44544d,_0x4ad187){return db[_0x4e88('0x2c')][_0x4e88('0x6c')]({'where':{'id':_0x24c3de[_0x4e88('0x47')]['id']}})[_0x4e88('0x25')](function(_0x31f62c){if(_0x31f62c){if(!_0x24c3de[_0x4e88('0x4b')][_0x4e88('0x6d')]||!utils[_0x4e88('0x74')](_0x24c3de[_0x4e88('0x4b')][_0x4e88('0x6d')])){throw new db[(_0x4e88('0x57'))]['ValidationError'](_0x4e88('0x75'));}return _0x31f62c[_0x4e88('0x76')+_[_0x4e88('0x6f')](_0x24c3de[_0x4e88('0x4b')][_0x4e88('0x6d')]['toLowerCase']())+_0x4e88('0x72')](_0x24c3de['body'][_0x4e88('0x77')]);}return null;})[_0x4e88('0x25')](handleEntityNotFound(_0x44544d,null))[_0x4e88('0x25')](respondWithStatusCode(_0x44544d,null))[_0x4e88('0x45')](handleError(_0x44544d,null));};exports[_0x4e88('0x78')]=function(_0xeb20da,_0x2fbc08,_0x226c18){return db[_0x4e88('0x2c')][_0x4e88('0x6c')]({'where':{'id':_0xeb20da[_0x4e88('0x47')]['id']}})[_0x4e88('0x25')](function(_0x1c9b04){if(_0x1c9b04){if(!_0xeb20da[_0x4e88('0x32')]['channel']||!utils[_0x4e88('0x74')](_0xeb20da['query']['channel'])){throw new db[(_0x4e88('0x57'))][(_0x4e88('0x6e'))](_0x4e88('0x75'));}return _0x1c9b04[_0x4e88('0x79')+_['capitalize'](_0xeb20da[_0x4e88('0x32')]['channel'][_0x4e88('0x70')]())+_0x4e88('0x72')](_0xeb20da[_0x4e88('0x32')][_0x4e88('0x77')]);}return null;})[_0x4e88('0x25')](handleEntityNotFound(_0x2fbc08,null))[_0x4e88('0x25')](respondWithStatusCode(_0x2fbc08,null))[_0x4e88('0x45')](handleError(_0x2fbc08,null));};exports['addAgents']=function(_0x4c0511,_0x28ac46){var _0x17b44a=_[_0x4e88('0x7a')](_0x4c0511[_0x4e88('0x4b')][_0x4e88('0x77')])?_0x4c0511['body']['ids']:[_0x4c0511[_0x4e88('0x4b')]['ids']];var _0x4c126a=_0x4c0511['params']['id'];return db[_0x4e88('0x2c')]['find']({'where':{'id':_0x4c126a}})['then'](handleEntityNotFound(_0x28ac46,null))[_0x4e88('0x25')](function(_0x17c20e){if(_0x17c20e){var _0x190b49=[_0x4e88('0x7b'),'Chat',_0x4e88('0x7c'),_0x4e88('0x7d'),'Fax',_0x4e88('0x7e'),_0x4e88('0x7f')];return db[_0x4e88('0x55')][_0x4e88('0x56')](function(_0x55c360){var _0x40b91f=_[_0x4e88('0x2b')](_0x190b49,function(_0x4beea4){var _0x4bb160={'attributes':['id',_0x4e88('0x28')]};if(_0x4beea4===_0x4e88('0x7b')){_0x4bb160[_0x4e88('0x80')]={'attributes':[_0x4e88('0x81')]};}return _0x17c20e[_0x4e88('0x4c')+_0x4beea4+_0x4e88('0x72')](_0x4bb160)[_0x4e88('0x25')](function(_0x5491c6){var _0x306cf9=_[_0x4e88('0x2b')](_0x5491c6,function(_0x3b255b){var _0x294a7c=_[_0x4e88('0x2b')](_0x17b44a,function(_0x486701){var _0x7f1fba={'where':{'UserId':_0x486701,[_0x4beea4+_0x4e88('0x82')]:_0x3b255b['id']},'transaction':_0x55c360};if(_0x4beea4===_0x4e88('0x7b')){_0x7f1fba[_0x4e88('0x15')]={'penalty':_0x3b255b[_0x4e88('0x83')][_0x4e88('0x81')]};}return db[_0x4e88('0x84')+_0x4beea4+_0x4e88('0x71')][_0x4e88('0x85')](_0x7f1fba)[_0x4e88('0x25')](function(){socket[_0x4e88('0x86')]('user'+_0x4beea4+_0x4e88('0x87'),{'UserId':_0x486701,[_0x4beea4+'QueueId']:_0x3b255b['id']});if(_0x4beea4!==_0x4e88('0x7b')){return;}return db[_0x4e88('0x84')]['findAll']({'where':{'id':_0x17b44a,'online':0x1},'attributes':['id',_0x4e88('0x28'),'online',_0x4e88('0x88'),_0x4e88('0x89')],'raw':!![]})[_0x4e88('0x25')](function(_0x2dfba7){var _0x590824=_['map'](_0x2dfba7,function(_0x5659a6){return db[_0x4e88('0x8a')][_0x4e88('0x8b')]({'membername':_0x5659a6[_0x4e88('0x28')],'UserId':_0x5659a6['id'],'queue_name':_0x3b255b['name'],'VoiceQueueId':_0x3b255b['id'],'interface':_[_0x4e88('0x8c')](_0x5659a6[_0x4e88('0x89')])?util[_0x4e88('0x8d')]('SIP/%s',_0x5659a6[_0x4e88('0x28')]):_0x5659a6['interface'],'paused':_0x5659a6[_0x4e88('0x88')]||![],'penalty':_0x3b255b[_0x4e88('0x83')]['penalty']},{'transaction':_0x55c360});});return Promise[_0x4e88('0x8e')](_0x590824);});});});return Promise['all'](_0x294a7c);});return Promise['all'](_0x306cf9);})[_0x4e88('0x25')](function(){return db[_0x4e88('0x68')][_0x4e88('0x6c')]({'where':{'teamId':_0x4c126a}})[_0x4e88('0x25')](function(_0x1b607d){if(_0x1b607d){var _0xa2a227=_[_0x4e88('0x2b')](_0x17b44a,function(_0x460fe3){db[_0x4e88('0x8f')][_0x4e88('0x8b')]({'UserId':_0x460fe3,'VoicePrefixId':_0x1b607d[_0x4e88('0x69')]});});return Promise[_0x4e88('0x8e')](_0xa2a227);}});});});return Promise[_0x4e88('0x8e')](_0x40b91f)[_0x4e88('0x25')](function(){return _0x17c20e[_0x4e88('0x90')](_0x17b44a,{'transaction':_0x55c360})[_0x4e88('0x91')](function(_0x638cee){return _0x638cee;});});});}})[_0x4e88('0x25')](respondWithResult(_0x28ac46,null))['catch'](handleError(_0x28ac46,null));};exports['removeAgents']=function(_0x1660af,_0x17fd2f){var _0x3a3cc2=_[_0x4e88('0x7a')](_0x1660af['query'][_0x4e88('0x77')])?_0x1660af[_0x4e88('0x32')][_0x4e88('0x77')]:[_0x1660af['query'][_0x4e88('0x77')]];var _0x169b4f=_0x1660af[_0x4e88('0x47')]['id'];return db[_0x4e88('0x2c')][_0x4e88('0x49')]({'where':{'id':_0x169b4f}})['then'](handleEntityNotFound(_0x17fd2f,null))[_0x4e88('0x25')](function(_0x5d259c){if(_0x5d259c){var _0x210ffc=[_0x4e88('0x7b'),_0x4e88('0x92'),_0x4e88('0x7c'),'Sms',_0x4e88('0x93'),_0x4e88('0x7e'),_0x4e88('0x7f')];return db['sequelize'][_0x4e88('0x56')](function(_0x4f2323){var _0x20f236=_[_0x4e88('0x2b')](_0x210ffc,function(_0x144502){var _0x51ef18={'attributes':['id','name']};return _0x5d259c['get'+_0x144502+_0x4e88('0x72')](_0x51ef18)[_0x4e88('0x25')](function(_0x50537a){var _0x4b99aa=_[_0x4e88('0x2b')](_0x50537a,function(_0xbe9fe7){return _0xbe9fe7['removeAgents'](_0x3a3cc2,{'transaction':_0x4f2323})[_0x4e88('0x25')](function(){var _0x17a1c0=_[_0x4e88('0x2b')](_0x3a3cc2,function(_0x1c349a){socket[_0x4e88('0x86')](_0x4e88('0x4f')+_0x144502+_0x4e88('0x94'),{'UserId':Number(_0x1c349a),[_0x144502+_0x4e88('0x82')]:_0xbe9fe7['id']});if(_0x144502!==_0x4e88('0x7b')){return;}return db[_0x4e88('0x8a')][_0x4e88('0x5f')]({'where':{'VoiceQueueId':_0xbe9fe7['id'],'UserId':_0x1c349a},'transaction':_0x4f2323});});return Promise[_0x4e88('0x8e')](_0x17a1c0);});});return Promise[_0x4e88('0x8e')](_0x4b99aa);});});return Promise[_0x4e88('0x8e')](_0x20f236)[_0x4e88('0x25')](function(){return _0x5d259c[_0x4e88('0x95')](_0x3a3cc2,{'transaction':_0x4f2323});})[_0x4e88('0x25')](function(){return db[_0x4e88('0x68')]['findOne']({'where':{'teamId':_0x169b4f}})['then'](function(_0x53bb60){if(_0x53bb60){var _0x452fb2=_[_0x4e88('0x2b')](_0x3a3cc2,function(_0x24ffa7){db[_0x4e88('0x8f')][_0x4e88('0x5f')]({'where':{'UserId':_0x24ffa7,'VoicePrefixId':_0x53bb60[_0x4e88('0x69')]}});});return Promise['all'](_0x452fb2);}});});});}})[_0x4e88('0x25')](respondWithStatusCode(_0x17fd2f,null))[_0x4e88('0x45')](handleError(_0x17fd2f,null));};exports['getAgents']=function(_0x3101fb,_0xd97542,_0x598fca){var _0x45a548={};var _0xa50809={};var _0x6df367;var _0x77d86a;return db[_0x4e88('0x2c')][_0x4e88('0x6c')]({'where':{'id':_0x3101fb[_0x4e88('0x47')]['id']}})['then'](handleEntityNotFound(_0xd97542,null))[_0x4e88('0x25')](function(_0x35e83a){if(_0x35e83a){_0x6df367=_0x35e83a;_0xa50809[_0x4e88('0x30')]=_[_0x4e88('0x31')](db[_0x4e88('0x84')][_0x4e88('0x2d')]);_0xa50809[_0x4e88('0x32')]=_['keys'](_0x3101fb[_0x4e88('0x32')]);_0xa50809[_0x4e88('0x33')]=_[_0x4e88('0x34')](_0xa50809['model'],_0xa50809[_0x4e88('0x32')]);_0x45a548[_0x4e88('0x36')]=_[_0x4e88('0x34')](_0xa50809[_0x4e88('0x30')],qs[_0x4e88('0x35')](_0x3101fb[_0x4e88('0x32')][_0x4e88('0x35')]));_0x45a548['attributes']=_0x45a548['attributes'][_0x4e88('0x48')]?_0x45a548[_0x4e88('0x36')]:_0xa50809[_0x4e88('0x30')];_0x45a548['order']=qs[_0x4e88('0x3a')](_0x3101fb[_0x4e88('0x32')][_0x4e88('0x3a')]);_0x45a548['where']=qs[_0x4e88('0x33')](_[_0x4e88('0x3b')](_0x3101fb[_0x4e88('0x32')],_0xa50809[_0x4e88('0x33')]));if(_0x3101fb[_0x4e88('0x32')]['filter']){_0x45a548[_0x4e88('0x3d')]=_[_0x4e88('0x3e')](_0x45a548[_0x4e88('0x3d')],{'$or':_[_0x4e88('0x2b')](_0x45a548[_0x4e88('0x36')],function(_0xfd42a4){var _0x326e65={};_0x326e65[_0xfd42a4]={'$like':'%'+_0x3101fb['query'][_0x4e88('0x3c')]+'%'};return _0x326e65;})});}_0x45a548=_['merge']({},_0x45a548,_0x3101fb['options']);return _0x6df367[_0x4e88('0x96')](_0x45a548);}})[_0x4e88('0x25')](function(_0x177d37){if(_0x177d37){_0x77d86a=_0x177d37[_0x4e88('0x48')];if(!_0x3101fb['query'][_0x4e88('0x37')](_0x4e88('0x38'))){_0x45a548[_0x4e88('0x1f')]=qs[_0x4e88('0x1f')](_0x3101fb['query'][_0x4e88('0x1f')]);_0x45a548['offset']=qs['offset'](_0x3101fb[_0x4e88('0x32')][_0x4e88('0x1e')]);}return _0x6df367['getAgents'](_0x45a548);}})[_0x4e88('0x25')](function(_0x22195a){if(_0x22195a){return _0x22195a?{'count':_0x77d86a,'rows':_0x22195a}:null;}})[_0x4e88('0x25')](respondWithResult(_0xd97542,null))[_0x4e88('0x45')](handleError(_0xd97542,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e51b35e..8cce484 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 _0xf3f7=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xf3f7,0x19e));var _0x7f3f=function(_0x1b173a,_0x2ff8fa){_0x1b173a=_0x1b173a-0x0;var _0x582217=_0xf3f7[_0x1b173a];return _0x582217;};'use strict';var EventEmitter=require('events');var Team=require(_0x7f3f('0x0'))['db'][_0x7f3f('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f3f('0x2'),'afterUpdate':'update','afterDestroy':_0x7f3f('0x3')};function emitEvent(_0x6daef3){return function(_0x2a60dd,_0x5ec53d,_0x34c3fd){TeamEvents['emit'](_0x6daef3+':'+_0x2a60dd['id'],_0x2a60dd);TeamEvents[_0x7f3f('0x4')](_0x6daef3,_0x2a60dd);_0x34c3fd(null);};}for(var e in events){if(events[_0x7f3f('0x5')](e)){var event=events[e];Team[_0x7f3f('0x6')](e,emitEvent(event));}}module[_0x7f3f('0x7')]=TeamEvents; \ No newline at end of file +var _0x1a5b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3590c9,_0x38995d){var _0x4134ef=function(_0xd0da23){while(--_0xd0da23){_0x3590c9['push'](_0x3590c9['shift']());}};_0x4134ef(++_0x38995d);}(_0x1a5b,0xa4));var _0xb1a5=function(_0xceb88b,_0x1a4001){_0xceb88b=_0xceb88b-0x0;var _0x10b013=_0x1a5b[_0xceb88b];return _0x10b013;};'use strict';var EventEmitter=require(_0xb1a5('0x0'));var Team=require(_0xb1a5('0x1'))['db'][_0xb1a5('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb1a5('0x3')](0x0);var events={'afterCreate':_0xb1a5('0x4'),'afterUpdate':_0xb1a5('0x5'),'afterDestroy':_0xb1a5('0x6')};function emitEvent(_0x34ec13){return function(_0x25e3d5,_0x4bf3db,_0x521d22){TeamEvents[_0xb1a5('0x7')](_0x34ec13+':'+_0x25e3d5['id'],_0x25e3d5);TeamEvents[_0xb1a5('0x7')](_0x34ec13,_0x25e3d5);_0x521d22(null);};}for(var e in events){if(events[_0xb1a5('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb1a5('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 742915a..6e79e8b 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 _0xe569=['Voice','Whatsapp','resolve','map','all','./team.attributes','get','Queues','then','setDataValue','channel','exports','define','Team','teams','Chat','Mail','Openchannel'];(function(_0x5a8600,_0x277861){var _0x5ab160=function(_0x1c3269){while(--_0x1c3269){_0x5a8600['push'](_0x5a8600['shift']());}};_0x5ab160(++_0x277861);}(_0xe569,0x149));var _0x9e56=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xe569[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var attributes=require(_0x9e56('0x0'));function getQueuesByChannel(_0x3dfd41,_0x31c452){var _0x3bf55a=_0x9e56('0x1')+_0x31c452+_0x9e56('0x2');return _0x3dfd41[_0x3bf55a]()[_0x9e56('0x3')](function(_0x2bd0f6){return _['map'](_0x2bd0f6,function(_0x1f890a){_0x1f890a[_0x9e56('0x4')](_0x9e56('0x5'),_0x31c452);return _0x1f890a;});})['catch'](function(_0x3efb19){throw _0x3efb19;});}module[_0x9e56('0x6')]=function(_0x410d78){return _0x410d78[_0x9e56('0x7')](_0x9e56('0x8'),attributes,{'tableName':_0x9e56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x37d2f2=this;var _0x36ca0e=[_0x9e56('0xa'),'Fax',_0x9e56('0xb'),_0x9e56('0xc'),'Sms',_0x9e56('0xd'),_0x9e56('0xe')];return Promise[_0x9e56('0xf')]()['then'](function(){var _0x25c86e=_[_0x9e56('0x10')](_0x36ca0e,function(_0x507e50){return getQueuesByChannel(_0x37d2f2,_0x507e50);});return Promise[_0x9e56('0x11')](_0x25c86e);})['catch'](function(_0x2d6b97){throw _0x2d6b97;});}}});}; \ No newline at end of file +var _0x5974=['get','Queues','then','map','setDataValue','channel','catch','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Whatsapp','all','./team.attributes'];(function(_0x24ddfb,_0x26e98e){var _0x11df37=function(_0xa13bb2){while(--_0xa13bb2){_0x24ddfb['push'](_0x24ddfb['shift']());}};_0x11df37(++_0x26e98e);}(_0x5974,0x7d));var _0x4597=function(_0x2515a3,_0x356de5){_0x2515a3=_0x2515a3-0x0;var _0xe8bbb=_0x5974[_0x2515a3];return _0xe8bbb;};'use strict';var _=require('lodash');var attributes=require(_0x4597('0x0'));function getQueuesByChannel(_0x4d94d9,_0x3ee2d1){var _0x1605d0=_0x4597('0x1')+_0x3ee2d1+_0x4597('0x2');return _0x4d94d9[_0x1605d0]()[_0x4597('0x3')](function(_0x395b29){return _[_0x4597('0x4')](_0x395b29,function(_0x25d933){_0x25d933[_0x4597('0x5')](_0x4597('0x6'),_0x3ee2d1);return _0x25d933;});})[_0x4597('0x7')](function(_0x528c0b){throw _0x528c0b;});}module['exports']=function(_0x4cd0eb){return _0x4cd0eb[_0x4597('0x8')](_0x4597('0x9'),attributes,{'tableName':_0x4597('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x41f28e=this;var _0x34ac0e=[_0x4597('0xb'),_0x4597('0xc'),_0x4597('0xd'),_0x4597('0xe'),_0x4597('0xf'),'Voice',_0x4597('0x10')];return Promise['resolve']()['then'](function(){var _0x570aec=_[_0x4597('0x4')](_0x34ac0e,function(_0x4bd03a){return getQueuesByChannel(_0x41f28e,_0x4bd03a);});return Promise[_0x4597('0x11')](_0x570aec);})['catch'](function(_0x3203d7){throw _0x3203d7;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 0483083..26710b0 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 _0x68c3=['http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x68c3,0x1db));var _0x368c=function(_0x1a4c39,_0x13aade){_0x1a4c39=_0x1a4c39-0x0;var _0x55b641=_0x68c3[_0x1a4c39];return _0x55b641;};'use strict';var _=require(_0x368c('0x0'));var util=require(_0x368c('0x1'));var moment=require(_0x368c('0x2'));var BPromise=require(_0x368c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x368c('0x4'));var db=require(_0x368c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x368c('0x6'))(_0x368c('0x7'));var config=require(_0x368c('0x8'));var jayson=require(_0x368c('0x9'));var client=jayson[_0x368c('0xa')][_0x368c('0xb')]({'port':0x232a});config['redis']=_[_0x368c('0xc')](config[_0x368c('0xd')],{'host':_0x368c('0xe'),'port':0x18eb});var socket=require(_0x368c('0xf'))(new Redis(config[_0x368c('0xd')]));require(_0x368c('0x10'))[_0x368c('0x11')](socket);function respondWithRpcPromise(_0x48593d,_0x2f217d,_0xe5762e){return new BPromise(function(_0x471b94,_0x215bd){return client['request'](_0x48593d,_0xe5762e)['then'](function(_0x1e429d){logger[_0x368c('0x12')]('Team,\x20%s,\x20%s',_0x2f217d,_0x368c('0x13'));logger[_0x368c('0x14')](_0x368c('0x15'),_0x2f217d,_0x368c('0x13'),JSON['stringify'](_0x1e429d));if(_0x1e429d[_0x368c('0x16')]){if(_0x1e429d['error'][_0x368c('0x17')]===0x1f4){logger[_0x368c('0x16')]('Team,\x20%s,\x20%s',_0x2f217d,_0x1e429d[_0x368c('0x16')]['message']);return _0x215bd(_0x1e429d['error'][_0x368c('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x2f217d,_0x1e429d['error'][_0x368c('0x18')]);return _0x471b94(_0x1e429d[_0x368c('0x16')]['message']);}else{logger[_0x368c('0x12')]('Team,\x20%s,\x20%s',_0x2f217d,_0x368c('0x13'));_0x471b94(_0x1e429d[_0x368c('0x19')][_0x368c('0x18')]);}})[_0x368c('0x1a')](function(_0x191a6a){logger['error']('Team,\x20%s,\x20%s',_0x2f217d,_0x191a6a);_0x215bd(_0x191a6a);});});} \ No newline at end of file +var _0x650e=['then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./team.socket','register'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x650e,0x15b));var _0xe650=function(_0x2480b3,_0x186e9b){_0x2480b3=_0x2480b3-0x0;var _0x293a02=_0x650e[_0x2480b3];return _0x293a02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe650('0x0'));var BPromise=require(_0xe650('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe650('0x2'))['db'];var utils=require(_0xe650('0x3'));var logger=require('../../config/logger')(_0xe650('0x4'));var config=require(_0xe650('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe650('0x6')][_0xe650('0x7')]({'port':0x232a});config[_0xe650('0x8')]=_[_0xe650('0x9')](config['redis'],{'host':_0xe650('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe650('0x8')]));require(_0xe650('0xb'))[_0xe650('0xc')](socket);function respondWithRpcPromise(_0x21db81,_0x170268,_0x5e191f){return new BPromise(function(_0x4ff227,_0x2729e0){return client['request'](_0x21db81,_0x5e191f)[_0xe650('0xd')](function(_0x56a464){logger[_0xe650('0xe')](_0xe650('0xf'),_0x170268,'request\x20sent');logger[_0xe650('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x170268,_0xe650('0x11'),JSON[_0xe650('0x12')](_0x56a464));if(_0x56a464['error']){if(_0x56a464['error'][_0xe650('0x13')]===0x1f4){logger[_0xe650('0x14')](_0xe650('0xf'),_0x170268,_0x56a464[_0xe650('0x14')][_0xe650('0x15')]);return _0x2729e0(_0x56a464[_0xe650('0x14')][_0xe650('0x15')]);}logger[_0xe650('0x14')](_0xe650('0xf'),_0x170268,_0x56a464[_0xe650('0x14')][_0xe650('0x15')]);return _0x4ff227(_0x56a464['error'][_0xe650('0x15')]);}else{logger[_0xe650('0xe')](_0xe650('0xf'),_0x170268,'request\x20sent');_0x4ff227(_0x56a464[_0xe650('0x16')][_0xe650('0x15')]);}})[_0xe650('0x17')](function(_0x3e6d7e){logger[_0xe650('0x14')]('Team,\x20%s,\x20%s',_0x170268,_0x3e6d7e);_0x2729e0(_0x3e6d7e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2f9f90e..233576d 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 _0x5a1c=['save','emit','register','length','team:','./team.events'];(function(_0x422524,_0x1c4311){var _0x450526=function(_0x4d897e){while(--_0x4d897e){_0x422524['push'](_0x422524['shift']());}};_0x450526(++_0x1c4311);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0xa58a3e,_0x115109){_0xa58a3e=_0xa58a3e-0x0;var _0x4f6cd2=_0x5a1c[_0xa58a3e];return _0x4f6cd2;};'use strict';var TeamEvents=require(_0xc5a1('0x0'));var events=[_0xc5a1('0x1'),'remove','update'];function createListener(_0x196f8b,_0x4b9c2c){return function(_0x1d1f86){_0x4b9c2c[_0xc5a1('0x2')](_0x196f8b,_0x1d1f86);};}function removeListener(_0x71fc1,_0x5c3f2d){return function(){TeamEvents['removeListener'](_0x71fc1,_0x5c3f2d);};}exports[_0xc5a1('0x3')]=function(_0x3d356e){for(var _0x1ed54a=0x0,_0x5782b9=events[_0xc5a1('0x4')];_0x1ed54a<_0x5782b9;_0x1ed54a++){var _0x159ed5=events[_0x1ed54a];var _0x1ce1df=createListener(_0xc5a1('0x5')+_0x159ed5,_0x3d356e);TeamEvents['on'](_0x159ed5,_0x1ce1df);}}; \ No newline at end of file +var _0x1ab1=['register','length','team:','save','remove','update','emit','removeListener'];(function(_0x5e8a6d,_0x195df3){var _0x14c536=function(_0x180f27){while(--_0x180f27){_0x5e8a6d['push'](_0x5e8a6d['shift']());}};_0x14c536(++_0x195df3);}(_0x1ab1,0x83));var _0x11ab=function(_0x1f76d3,_0x162da6){_0x1f76d3=_0x1f76d3-0x0;var _0xca00a5=_0x1ab1[_0x1f76d3];return _0xca00a5;};'use strict';var TeamEvents=require('./team.events');var events=[_0x11ab('0x0'),_0x11ab('0x1'),_0x11ab('0x2')];function createListener(_0x1ef542,_0x3886bf){return function(_0x2562ac){_0x3886bf[_0x11ab('0x3')](_0x1ef542,_0x2562ac);};}function removeListener(_0x5729b9,_0xded89b){return function(){TeamEvents[_0x11ab('0x4')](_0x5729b9,_0xded89b);};}exports[_0x11ab('0x5')]=function(_0x173e17){for(var _0x643c32=0x0,_0x531999=events[_0x11ab('0x6')];_0x643c32<_0x531999;_0x643c32++){var _0x26c091=events[_0x643c32];var _0x4702b2=createListener(_0x11ab('0x7')+_0x26c091,_0x173e17);TeamEvents['on'](_0x26c091,_0x4702b2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index d52ce02..8229c16 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 _0x643f=['exports'];(function(_0x2e6e9c,_0x3f6a11){var _0xac3b79=function(_0x2e922e){while(--_0x2e922e){_0x2e6e9c['push'](_0x2e6e9c['shift']());}};_0xac3b79(++_0x3f6a11);}(_0x643f,0x1e6));var _0xf643=function(_0x20ef42,_0x511459){_0x20ef42=_0x20ef42-0x0;var _0x509694=_0x643f[_0x20ef42];return _0x509694;};'use strict';var Sequelize=require('sequelize');module[_0xf643('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6719=['sequelize','exports','INTEGER'];(function(_0x293a98,_0x2cc3ea){var _0x15ba5f=function(_0x3fb556){while(--_0x3fb556){_0x293a98['push'](_0x293a98['shift']());}};_0x15ba5f(++_0x2cc3ea);}(_0x6719,0xf6));var _0x9671=function(_0x593a37,_0x20ac5b){_0x593a37=_0x593a37-0x0;var _0x4bde96=_0x6719[_0x593a37];return _0x4bde96;};'use strict';var Sequelize=require(_0x9671('0x0'));module[_0x9671('0x1')]={'TeamId':{'type':Sequelize[_0x9671('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x9671('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 3accc3d..82b73fc 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 _0x065e=['moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','define','team_has_voice_prefixes','lodash'];(function(_0x43a62a,_0x3e8935){var _0x3c5d0b=function(_0x5e3815){while(--_0x5e3815){_0x43a62a['push'](_0x43a62a['shift']());}};_0x3c5d0b(++_0x3e8935);}(_0x065e,0x1a7));var _0xe065=function(_0x1184e6,_0x567817){_0x1184e6=_0x1184e6-0x0;var _0x52052d=_0x065e[_0x1184e6];return _0x52052d;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0xe065('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger'];(function(_0x3280d4,_0x1d5984){var _0x527bc9=function(_0xc21ab5){while(--_0xc21ab5){_0x3280d4['push'](_0x3280d4['shift']());}};_0x527bc9(++_0x1d5984);}(_0xb515,0x1b8));var _0x5b51=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xb515[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c06e1cb..c61a9a3 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41137f,_0x59cf71){var _0x152edc=function(_0xddb05c){while(--_0xddb05c){_0x41137f['push'](_0x41137f['shift']());}};_0x152edc(++_0x59cf71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x284f73,_0x5535cd){var _0x23ff27=function(_0x1e0c17){while(--_0x1e0c17){_0x284f73['push'](_0x284f73['shift']());}};_0x23ff27(++_0x5535cd);}(_0x70e0,0x17b));var _0x070e=function(_0x57b075,_0x4a5d8f){_0x57b075=_0x57b075-0x0;var _0x535edf=_0x70e0[_0x57b075];return _0x535edf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 7811e1d..521a6fa 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 _0xebba=['sequelize','exports'];(function(_0x31990f,_0x531d99){var _0x3b1368=function(_0x25e875){while(--_0x25e875){_0x31990f['push'](_0x31990f['shift']());}};_0x3b1368(++_0x531d99);}(_0xebba,0x14e));var _0xaebb=function(_0x22d663,_0x98ae13){_0x22d663=_0x22d663-0x0;var _0x4e9227=_0xebba[_0x22d663];return _0x4e9227;};'use strict';var Sequelize=require(_0xaebb('0x0'));module[_0xaebb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8db9=['exports','INTEGER','sequelize'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x8db9,0x1a0));var _0x98db=function(_0x30806e,_0x41bb0d){_0x30806e=_0x30806e-0x0;var _0x2777c6=_0x8db9[_0x30806e];return _0x2777c6;};'use strict';var Sequelize=require(_0x98db('0x0'));module[_0x98db('0x1')]={'penalty':{'type':Sequelize[_0x98db('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 b6cf979..3b6c586 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 _0xb3ea=['../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x49cac1,_0x52dc7f){var _0x1f9987=function(_0x4153b5){while(--_0x4153b5){_0x49cac1['push'](_0x49cac1['shift']());}};_0x1f9987(++_0x52dc7f);}(_0xb3ea,0x10d));var _0xab3e=function(_0x13545c,_0x1e11c8){_0x13545c=_0x13545c-0x0;var _0x30176e=_0xb3ea[_0x13545c];return _0x30176e;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var logger=require(_0xab3e('0x2'))('api');var moment=require(_0xab3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var attributes=require(_0xab3e('0x7'));module[_0xab3e('0x8')]=function(_0x135941,_0x570744){return _0x135941[_0xab3e('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xab3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4bb055,_0x48257a){_0x4bb055=_0x4bb055-0x0;var _0x2ab87e=_0xd2ea[_0x4bb055];return _0x2ab87e;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 95a8398..6db8718 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 _0x9428=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x19b1b4,_0x245bb5){var _0x456196=function(_0x4d726c){while(--_0x4d726c){_0x19b1b4['push'](_0x19b1b4['shift']());}};_0x456196(++_0x245bb5);}(_0x9428,0xa5));var _0x8942=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x9428[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0x8942('0x0'));var util=require(_0x8942('0x1'));var moment=require(_0x8942('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8942('0x3'))['db'];var utils=require(_0x8942('0x4'));var logger=require('../../config/logger')(_0x8942('0x5'));var config=require(_0x8942('0x6'));var jayson=require(_0x8942('0x7'));var client=jayson[_0x8942('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3880,_0x33bb4f,_0x22fc26){return new BPromise(function(_0x4a3651,_0x58d649){return client[_0x8942('0x9')](_0x1b3880,_0x22fc26)[_0x8942('0xa')](function(_0x29a04e){logger['info'](_0x8942('0xb'),_0x33bb4f,_0x8942('0xc'));logger[_0x8942('0xd')](_0x8942('0xe'),_0x33bb4f,_0x8942('0xc'),JSON[_0x8942('0xf')](_0x29a04e));if(_0x29a04e[_0x8942('0x10')]){if(_0x29a04e[_0x8942('0x10')][_0x8942('0x11')]===0x1f4){logger[_0x8942('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33bb4f,_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);return _0x58d649(_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);}logger[_0x8942('0x10')](_0x8942('0xb'),_0x33bb4f,_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);return _0x4a3651(_0x29a04e[_0x8942('0x10')][_0x8942('0x12')]);}else{logger[_0x8942('0x13')](_0x8942('0xb'),_0x33bb4f,_0x8942('0xc'));_0x4a3651(_0x29a04e[_0x8942('0x14')]['message']);}})[_0x8942('0x15')](function(_0x5ee430){logger[_0x8942('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x33bb4f,_0x5ee430);_0x58d649(_0x5ee430);});});} \ No newline at end of file +var _0x9aea=['result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x32de8f,_0x1e96ff){var _0x4db29c=function(_0x28ce48){while(--_0x28ce48){_0x32de8f['push'](_0x32de8f['shift']());}};_0x4db29c(++_0x1e96ff);}(_0x9aea,0xdd));var _0xa9ae=function(_0x372294,_0x20d631){_0x372294=_0x372294-0x0;var _0x390610=_0x9aea[_0x372294];return _0x390610;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var moment=require(_0xa9ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9ae('0x2'));var fs=require('fs');var Redis=require(_0xa9ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ae('0x4'));var logger=require(_0xa9ae('0x5'))(_0xa9ae('0x6'));var config=require(_0xa9ae('0x7'));var jayson=require(_0xa9ae('0x8'));var client=jayson['client'][_0xa9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22734b,_0x1e57c4,_0x53e52c){return new BPromise(function(_0x1f2e4b,_0x3917f0){return client[_0xa9ae('0xa')](_0x22734b,_0x53e52c)[_0xa9ae('0xb')](function(_0x1882dc){logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));logger[_0xa9ae('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1e57c4,_0xa9ae('0xe'),JSON['stringify'](_0x1882dc));if(_0x1882dc[_0xa9ae('0x10')]){if(_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x11')]===0x1f4){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x3917f0(_0x1882dc[_0xa9ae('0x10')]['message']);}logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x1882dc[_0xa9ae('0x10')][_0xa9ae('0x12')]);return _0x1f2e4b(_0x1882dc['error'][_0xa9ae('0x12')]);}else{logger[_0xa9ae('0xc')](_0xa9ae('0xd'),_0x1e57c4,_0xa9ae('0xe'));_0x1f2e4b(_0x1882dc[_0xa9ae('0x13')][_0xa9ae('0x12')]);}})['catch'](function(_0x3e4810){logger[_0xa9ae('0x10')](_0xa9ae('0xd'),_0x1e57c4,_0x3e4810);_0x3917f0(_0x3e4810);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e8b7010..768a2eb 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 _0xd4ad=['isAuthenticated','get','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./template.controller'];(function(_0xd5fb24,_0x577953){var _0x59ad67=function(_0x4a86bf){while(--_0x4a86bf){_0xd5fb24['push'](_0xd5fb24['shift']());}};_0x59ad67(++_0x577953);}(_0xd4ad,0x158));var _0xdd4a=function(_0x2aa9a7,_0x5a32ea){_0x2aa9a7=_0x2aa9a7-0x0;var _0x3c99c0=_0xd4ad[_0x2aa9a7];return _0x3c99c0;};'use strict';var multer=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var path=require(_0xdd4a('0x2'));var timeout=require(_0xdd4a('0x3'));var express=require('express');var router=express[_0xdd4a('0x4')]();var fs_extra=require(_0xdd4a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd4a('0x6'));var controller=require(_0xdd4a('0x7'));router['get']('/',auth[_0xdd4a('0x8')](),controller['index']);router[_0xdd4a('0x9')](_0xdd4a('0xa'),auth['isAuthenticated'](),controller[_0xdd4a('0xb')]);router['post']('/',auth[_0xdd4a('0x8')](),controller[_0xdd4a('0xc')]);router[_0xdd4a('0xd')](_0xdd4a('0xa'),auth[_0xdd4a('0x8')](),controller[_0xdd4a('0xe')]);router['delete']('/:id',auth[_0xdd4a('0x8')](),controller['destroy']);module[_0xdd4a('0xf')]=router; \ No newline at end of file +var _0x2ffe=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x370455,_0x58d0d5){var _0x11a022=function(_0x39f4d0){while(--_0x39f4d0){_0x370455['push'](_0x370455['shift']());}};_0x11a022(++_0x58d0d5);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x90af6,_0x18eb83){_0x90af6=_0x90af6-0x0;var _0x1cf1a3=_0x2ffe[_0x90af6];return _0x1cf1a3;};'use strict';var multer=require('multer');var util=require(_0xe2ff('0x0'));var path=require(_0xe2ff('0x1'));var timeout=require(_0xe2ff('0x2'));var express=require(_0xe2ff('0x3'));var router=express[_0xe2ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe2ff('0x5'));var interaction=require(_0xe2ff('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xe2ff('0x7')]('/',auth[_0xe2ff('0x8')](),controller[_0xe2ff('0x9')]);router['get'](_0xe2ff('0xa'),auth[_0xe2ff('0x8')](),controller[_0xe2ff('0xb')]);router[_0xe2ff('0xc')]('/',auth[_0xe2ff('0x8')](),controller[_0xe2ff('0xd')]);router[_0xe2ff('0xe')](_0xe2ff('0xa'),auth[_0xe2ff('0x8')](),controller[_0xe2ff('0xf')]);router[_0xe2ff('0x10')](_0xe2ff('0xa'),auth[_0xe2ff('0x8')](),controller[_0xe2ff('0x11')]);module[_0xe2ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a5ef591..188c895 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 _0xb12e=['exports','STRING','TEXT'];(function(_0x4cebf3,_0x2d3fd1){var _0x51a440=function(_0x513e8c){while(--_0x513e8c){_0x4cebf3['push'](_0x4cebf3['shift']());}};_0x51a440(++_0x2d3fd1);}(_0xb12e,0xb7));var _0xeb12=function(_0x2a5c60,_0xac1569){_0x2a5c60=_0x2a5c60-0x0;var _0xe2e9a2=_0xb12e[_0x2a5c60];return _0xe2e9a2;};'use strict';var Sequelize=require('sequelize');module[_0xeb12('0x0')]={'name':{'type':Sequelize[_0xeb12('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xeb12('0x2')]}}; \ No newline at end of file +var _0xccac=['exports','STRING','TEXT'];(function(_0x2141fe,_0x4012b9){var _0x57f097=function(_0x13a7c7){while(--_0x13a7c7){_0x2141fe['push'](_0x2141fe['shift']());}};_0x57f097(++_0x4012b9);}(_0xccac,0x1a7));var _0xccca=function(_0x135aa2,_0x4d6596){_0x135aa2=_0x135aa2-0x0;var _0x38a99a=_0xccac[_0x135aa2];return _0x38a99a;};'use strict';var Sequelize=require('sequelize');module[_0xccca('0x0')]={'name':{'type':Sequelize[_0xccca('0x1')]},'description':{'type':Sequelize[_0xccca('0x1')]},'html':{'type':Sequelize[_0xccca('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 407ddfe..092e537 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 _0x16c7=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','send','index','Template','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x16c7,0xe1));var _0x716c=function(_0x4cb47f,_0x53123c){_0x4cb47f=_0x4cb47f-0x0;var _0x1e576a=_0x16c7[_0x4cb47f];return _0x1e576a;};'use strict';var emlformat=require(_0x716c('0x0'));var rimraf=require(_0x716c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716c('0x2'));var rp=require('request-promise');var moment=require(_0x716c('0x3'));var BPromise=require(_0x716c('0x4'));var Mustache=require('mustache');var util=require(_0x716c('0x5'));var path=require(_0x716c('0x6'));var sox=require(_0x716c('0x7'));var csv=require(_0x716c('0x8'));var ejs=require(_0x716c('0x9'));var fs=require('fs');var fs_extra=require(_0x716c('0xa'));var _=require(_0x716c('0xb'));var squel=require(_0x716c('0xc'));var crypto=require('crypto');var jsforce=require(_0x716c('0xd'));var deskjs=require(_0x716c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x716c('0xf'));var Papa=require(_0x716c('0x10'));var Redis=require('ioredis');var authService=require(_0x716c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x716c('0x12'));var hardwareService=require(_0x716c('0x13'));var logger=require('../../config/logger')(_0x716c('0x14'));var utils=require(_0x716c('0x15'));var config=require(_0x716c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x716c('0x17'))['db'];function respondWithStatusCode(_0x2bb8be,_0x1423d7){_0x1423d7=_0x1423d7||0xcc;return function(_0xfe37e2){if(_0xfe37e2){return _0x2bb8be[_0x716c('0x18')](_0x1423d7);}return _0x2bb8be[_0x716c('0x19')](_0x1423d7)[_0x716c('0x1a')]();};}function respondWithResult(_0x24e10f,_0x52fbd4){_0x52fbd4=_0x52fbd4||0xc8;return function(_0x5d6a93){if(_0x5d6a93){return _0x24e10f[_0x716c('0x19')](_0x52fbd4)[_0x716c('0x1b')](_0x5d6a93);}};}function respondWithFilteredResult(_0x2d4788,_0x221e4c){return function(_0x540deb){if(_0x540deb){var _0x3b2a4e=typeof _0x221e4c[_0x716c('0x1c')]==='undefined'&&typeof _0x221e4c[_0x716c('0x1d')]===_0x716c('0x1e');var _0x3a595c=_0x540deb['count'];var _0x46df9f=_0x3b2a4e?0x0:_0x221e4c[_0x716c('0x1c')];var _0x3e8fe2=_0x3b2a4e?_0x540deb[_0x716c('0x1f')]:_0x221e4c[_0x716c('0x1c')]+_0x221e4c[_0x716c('0x1d')];var _0x46ab33;if(_0x3e8fe2>=_0x3a595c){_0x3e8fe2=_0x3a595c;_0x46ab33=0xc8;}else{_0x46ab33=0xce;}_0x2d4788[_0x716c('0x19')](_0x46ab33);return _0x2d4788[_0x716c('0x20')](_0x716c('0x21'),_0x46df9f+'-'+_0x3e8fe2+'/'+_0x3a595c)[_0x716c('0x1b')](_0x540deb);}return null;};}function patchUpdates(_0x211427){return function(_0x14dd4a){try{jsonpatch[_0x716c('0x22')](_0x14dd4a,_0x211427,!![]);}catch(_0x29ce35){return BPromise[_0x716c('0x23')](_0x29ce35);}return _0x14dd4a[_0x716c('0x24')]();};}function saveUpdates(_0x5e4ccd,_0x538e14){return function(_0x24f59e){if(_0x24f59e){return _0x24f59e[_0x716c('0x25')](_0x5e4ccd)[_0x716c('0x26')](function(_0x34e355){return _0x34e355;});}return null;};}function removeEntity(_0x3b013a,_0xfcd4d0){return function(_0x3a97d4){if(_0x3a97d4){return _0x3a97d4[_0x716c('0x27')]()[_0x716c('0x26')](function(){var _0x11bf8b=_0x3a97d4[_0x716c('0x28')]({'plain':!![]});var _0x354d3c=_0x716c('0x29');return db[_0x716c('0x2a')][_0x716c('0x27')]({'where':{'type':_0x354d3c,'resourceId':_0x11bf8b['id']}})['then'](function(){return _0x3a97d4;});})['then'](function(){_0x3b013a[_0x716c('0x19')](0xcc)[_0x716c('0x1a')]();});}};}function handleEntityNotFound(_0xdc55d0,_0x1cd7a4){return function(_0xaaf7ef){if(!_0xaaf7ef){_0xdc55d0['sendStatus'](0x194);}return _0xaaf7ef;};}function handleError(_0x3fa03e,_0x317d23){_0x317d23=_0x317d23||0x1f4;return function(_0x5aecb5){logger[_0x716c('0x2b')](_0x5aecb5[_0x716c('0x2c')]);if(_0x5aecb5['name']){delete _0x5aecb5['name'];}_0x3fa03e[_0x716c('0x19')](_0x317d23)[_0x716c('0x2d')](_0x5aecb5);};}exports[_0x716c('0x2e')]=function(_0x42a929,_0x521e41){var _0x2cb239={},_0x3c2e52={},_0x159015={'count':0x0,'rows':[]};var _0x1d07d8=_['map'](db[_0x716c('0x2f')][_0x716c('0x30')],function(_0x1d7f66){return{'name':_0x1d7f66[_0x716c('0x31')],'type':_0x1d7f66[_0x716c('0x32')][_0x716c('0x33')]};});_0x3c2e52[_0x716c('0x34')]=_['map'](_0x1d07d8,_0x716c('0x35'));_0x3c2e52[_0x716c('0x36')]=_[_0x716c('0x37')](_0x42a929['query']);_0x3c2e52[_0x716c('0x38')]=_['intersection'](_0x3c2e52[_0x716c('0x34')],_0x3c2e52[_0x716c('0x36')]);_0x2cb239[_0x716c('0x39')]=_[_0x716c('0x3a')](_0x3c2e52['model'],qs[_0x716c('0x3b')](_0x42a929[_0x716c('0x36')]['fields']));_0x2cb239[_0x716c('0x39')]=_0x2cb239[_0x716c('0x39')][_0x716c('0x3c')]?_0x2cb239[_0x716c('0x39')]:_0x3c2e52[_0x716c('0x34')];if(!_0x42a929[_0x716c('0x36')][_0x716c('0x3d')](_0x716c('0x3e'))){_0x2cb239[_0x716c('0x1d')]=qs[_0x716c('0x1d')](_0x42a929[_0x716c('0x36')]['limit']);_0x2cb239[_0x716c('0x1c')]=qs[_0x716c('0x1c')](_0x42a929[_0x716c('0x36')]['offset']);}_0x2cb239['order']=qs[_0x716c('0x3f')](_0x42a929[_0x716c('0x36')]['sort']);_0x2cb239[_0x716c('0x40')]=qs[_0x716c('0x38')](_[_0x716c('0x41')](_0x42a929[_0x716c('0x36')],_0x3c2e52[_0x716c('0x38')]),_0x1d07d8);if(_0x42a929[_0x716c('0x36')][_0x716c('0x42')]){_0x2cb239[_0x716c('0x40')]=_[_0x716c('0x43')](_0x2cb239[_0x716c('0x40')],{'$or':_['map'](_0x1d07d8,function(_0x3aecd7){if(_0x3aecd7[_0x716c('0x32')]!=='VIRTUAL'){var _0x5258e3={};_0x5258e3[_0x3aecd7[_0x716c('0x35')]]={'$like':'%'+_0x42a929[_0x716c('0x36')]['filter']+'%'};return _0x5258e3;}})});}_0x2cb239=_[_0x716c('0x43')]({},_0x2cb239,_0x42a929[_0x716c('0x44')]);var _0x9c7632={'where':_0x2cb239['where']};return db[_0x716c('0x2f')][_0x716c('0x1f')](_0x9c7632)[_0x716c('0x26')](function(_0x40fc7f){_0x159015['count']=_0x40fc7f;if(_0x42a929['query'][_0x716c('0x45')]){_0x2cb239[_0x716c('0x46')]=[{'all':!![]}];}return db[_0x716c('0x2f')][_0x716c('0x47')](_0x2cb239);})[_0x716c('0x26')](function(_0x1def34){_0x159015[_0x716c('0x48')]=_0x1def34;return _0x159015;})[_0x716c('0x26')](respondWithFilteredResult(_0x521e41,_0x2cb239))[_0x716c('0x49')](handleError(_0x521e41,null));};exports[_0x716c('0x4a')]=function(_0x2bdf85,_0x3c9215){var _0x4413d6={'raw':!![],'where':{'id':_0x2bdf85['params']['id']}},_0x4b7cd0={};_0x4b7cd0[_0x716c('0x34')]=_[_0x716c('0x37')](db[_0x716c('0x2f')][_0x716c('0x30')]);_0x4b7cd0[_0x716c('0x36')]=_[_0x716c('0x37')](_0x2bdf85[_0x716c('0x36')]);_0x4b7cd0[_0x716c('0x38')]=_['intersection'](_0x4b7cd0['model'],_0x4b7cd0[_0x716c('0x36')]);_0x4413d6[_0x716c('0x39')]=_[_0x716c('0x3a')](_0x4b7cd0[_0x716c('0x34')],qs[_0x716c('0x3b')](_0x2bdf85[_0x716c('0x36')][_0x716c('0x3b')]));_0x4413d6[_0x716c('0x39')]=_0x4413d6[_0x716c('0x39')][_0x716c('0x3c')]?_0x4413d6['attributes']:_0x4b7cd0[_0x716c('0x34')];if(_0x2bdf85[_0x716c('0x36')]['includeAll']){_0x4413d6[_0x716c('0x46')]=[{'all':!![]}];}_0x4413d6=_[_0x716c('0x43')]({},_0x4413d6,_0x2bdf85[_0x716c('0x44')]);return db[_0x716c('0x2f')]['find'](_0x4413d6)[_0x716c('0x26')](handleEntityNotFound(_0x3c9215,null))[_0x716c('0x26')](respondWithResult(_0x3c9215,null))[_0x716c('0x49')](handleError(_0x3c9215,null));};exports[_0x716c('0x4b')]=function(_0x46ff2b,_0x19d2c2){return db[_0x716c('0x2f')][_0x716c('0x4b')](_0x46ff2b[_0x716c('0x4c')],{})[_0x716c('0x26')](function(_0x4c5d8a){var _0x26015a=_0x46ff2b[_0x716c('0x4d')][_0x716c('0x28')]({'plain':!![]});if(!_0x26015a)throw new Error(_0x716c('0x4e'));if(_0x26015a['role']===_0x716c('0x4d')){var _0x5d65f4=_0x4c5d8a[_0x716c('0x28')]({'plain':!![]});var _0x50bc19=_0x716c('0x29');return db[_0x716c('0x4f')]['find']({'where':{'name':_0x50bc19,'userProfileId':_0x26015a[_0x716c('0x50')]},'raw':!![]})[_0x716c('0x26')](function(_0x1ca7a8){if(_0x1ca7a8&&_0x1ca7a8[_0x716c('0x51')]===0x0){return db[_0x716c('0x2a')][_0x716c('0x4b')]({'name':_0x5d65f4[_0x716c('0x35')],'resourceId':_0x5d65f4['id'],'type':_0x1ca7a8[_0x716c('0x35')],'sectionId':_0x1ca7a8['id']},{})['then'](function(){return _0x4c5d8a;});}else{return _0x4c5d8a;}})['catch'](function(_0x3baba3){logger[_0x716c('0x2b')](_0x716c('0x52'),_0x3baba3);throw _0x3baba3;});}return _0x4c5d8a;})[_0x716c('0x26')](respondWithResult(_0x19d2c2,0xc9))[_0x716c('0x49')](handleError(_0x19d2c2,null));};exports[_0x716c('0x25')]=function(_0x48d706,_0x1197f7){if(_0x48d706['body']['id']){delete _0x48d706[_0x716c('0x4c')]['id'];}return db[_0x716c('0x2f')]['find']({'where':{'id':_0x48d706[_0x716c('0x53')]['id']}})[_0x716c('0x26')](handleEntityNotFound(_0x1197f7,null))[_0x716c('0x26')](saveUpdates(_0x48d706[_0x716c('0x4c')],null))[_0x716c('0x26')](respondWithResult(_0x1197f7,null))[_0x716c('0x49')](handleError(_0x1197f7,null));};exports['destroy']=function(_0xf209e8,_0x5588fa){return db[_0x716c('0x2f')][_0x716c('0x54')]({'where':{'id':_0xf209e8['params']['id']}})[_0x716c('0x26')](handleEntityNotFound(_0x5588fa,null))[_0x716c('0x26')](removeEntity(_0x5588fa,null))['catch'](handleError(_0x5588fa,null));}; \ No newline at end of file +var _0x296d=['params','keys','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','Templates','error','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','options','Template','includeAll','include','catch','show'];(function(_0x3aec71,_0x1a4524){var _0x439c96=function(_0x536fba){while(--_0x536fba){_0x3aec71['push'](_0x3aec71['shift']());}};_0x439c96(++_0x1a4524);}(_0x296d,0xaa));var _0xd296=function(_0x10bae6,_0x41d85f){_0x10bae6=_0x10bae6-0x0;var _0x251123=_0x296d[_0x10bae6];return _0x251123;};'use strict';var emlformat=require(_0xd296('0x0'));var rimraf=require(_0xd296('0x1'));var zipdir=require(_0xd296('0x2'));var jsonpatch=require(_0xd296('0x3'));var rp=require(_0xd296('0x4'));var moment=require(_0xd296('0x5'));var BPromise=require(_0xd296('0x6'));var Mustache=require(_0xd296('0x7'));var util=require('util');var path=require(_0xd296('0x8'));var sox=require(_0xd296('0x9'));var csv=require('to-csv');var ejs=require(_0xd296('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd296('0xb'));var squel=require(_0xd296('0xc'));var crypto=require(_0xd296('0xd'));var jsforce=require(_0xd296('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd296('0xf'));var querystring=require(_0xd296('0x10'));var Papa=require('papaparse');var Redis=require(_0xd296('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd296('0x12'));var as=require(_0xd296('0x13'));var hardwareService=require(_0xd296('0x14'));var logger=require('../../config/logger')(_0xd296('0x15'));var utils=require(_0xd296('0x16'));var config=require(_0xd296('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd296('0x18'))['db'];function respondWithStatusCode(_0x5e4879,_0x57611c){_0x57611c=_0x57611c||0xcc;return function(_0x48169b){if(_0x48169b){return _0x5e4879[_0xd296('0x19')](_0x57611c);}return _0x5e4879[_0xd296('0x1a')](_0x57611c)[_0xd296('0x1b')]();};}function respondWithResult(_0x12e89a,_0x528e3f){_0x528e3f=_0x528e3f||0xc8;return function(_0x5ebe86){if(_0x5ebe86){return _0x12e89a[_0xd296('0x1a')](_0x528e3f)[_0xd296('0x1c')](_0x5ebe86);}};}function respondWithFilteredResult(_0x30ebd3,_0x5aaa0c){return function(_0x2e4e92){if(_0x2e4e92){var _0x48d34e=typeof _0x5aaa0c[_0xd296('0x1d')]==='undefined'&&typeof _0x5aaa0c[_0xd296('0x1e')]==='undefined';var _0x2ac90d=_0x2e4e92['count'];var _0x418aed=_0x48d34e?0x0:_0x5aaa0c[_0xd296('0x1d')];var _0x14b2ea=_0x48d34e?_0x2e4e92[_0xd296('0x1f')]:_0x5aaa0c[_0xd296('0x1d')]+_0x5aaa0c[_0xd296('0x1e')];var _0x465cec;if(_0x14b2ea>=_0x2ac90d){_0x14b2ea=_0x2ac90d;_0x465cec=0xc8;}else{_0x465cec=0xce;}_0x30ebd3[_0xd296('0x1a')](_0x465cec);return _0x30ebd3[_0xd296('0x20')](_0xd296('0x21'),_0x418aed+'-'+_0x14b2ea+'/'+_0x2ac90d)[_0xd296('0x1c')](_0x2e4e92);}return null;};}function patchUpdates(_0x335414){return function(_0x4de7eb){try{jsonpatch[_0xd296('0x22')](_0x4de7eb,_0x335414,!![]);}catch(_0x3bf61c){return BPromise[_0xd296('0x23')](_0x3bf61c);}return _0x4de7eb['save']();};}function saveUpdates(_0x29cb89,_0x4583e4){return function(_0x58e407){if(_0x58e407){return _0x58e407[_0xd296('0x24')](_0x29cb89)[_0xd296('0x25')](function(_0x5141ff){return _0x5141ff;});}return null;};}function removeEntity(_0x40aee5,_0x383997){return function(_0x4bcf47){if(_0x4bcf47){return _0x4bcf47[_0xd296('0x26')]()[_0xd296('0x25')](function(){var _0x32bd32=_0x4bcf47['get']({'plain':!![]});var _0x1827f5=_0xd296('0x27');return db['UserProfileResource'][_0xd296('0x26')]({'where':{'type':_0x1827f5,'resourceId':_0x32bd32['id']}})['then'](function(){return _0x4bcf47;});})[_0xd296('0x25')](function(){_0x40aee5[_0xd296('0x1a')](0xcc)[_0xd296('0x1b')]();});}};}function handleEntityNotFound(_0x1c02d0,_0x566cfb){return function(_0x3dbb68){if(!_0x3dbb68){_0x1c02d0[_0xd296('0x19')](0x194);}return _0x3dbb68;};}function handleError(_0x21e47a,_0x55e2bb){_0x55e2bb=_0x55e2bb||0x1f4;return function(_0x1ebb0b){logger[_0xd296('0x28')](_0x1ebb0b[_0xd296('0x29')]);if(_0x1ebb0b['name']){delete _0x1ebb0b['name'];}_0x21e47a['status'](_0x55e2bb)[_0xd296('0x2a')](_0x1ebb0b);};}exports[_0xd296('0x2b')]=function(_0x76cb23,_0x21baad){var _0x4af633={},_0x4f0aa2={},_0x37fc87={'count':0x0,'rows':[]};var _0x4416a8=_['map'](db['Template'][_0xd296('0x2c')],function(_0x10fe2e){return{'name':_0x10fe2e[_0xd296('0x2d')],'type':_0x10fe2e[_0xd296('0x2e')]['key']};});_0x4f0aa2[_0xd296('0x2f')]=_[_0xd296('0x30')](_0x4416a8,_0xd296('0x31'));_0x4f0aa2[_0xd296('0x32')]=_['keys'](_0x76cb23[_0xd296('0x32')]);_0x4f0aa2[_0xd296('0x33')]=_[_0xd296('0x34')](_0x4f0aa2['model'],_0x4f0aa2[_0xd296('0x32')]);_0x4af633[_0xd296('0x35')]=_[_0xd296('0x34')](_0x4f0aa2[_0xd296('0x2f')],qs[_0xd296('0x36')](_0x76cb23[_0xd296('0x32')][_0xd296('0x36')]));_0x4af633[_0xd296('0x35')]=_0x4af633['attributes'][_0xd296('0x37')]?_0x4af633['attributes']:_0x4f0aa2['model'];if(!_0x76cb23[_0xd296('0x32')][_0xd296('0x38')]('nolimit')){_0x4af633[_0xd296('0x1e')]=qs[_0xd296('0x1e')](_0x76cb23[_0xd296('0x32')][_0xd296('0x1e')]);_0x4af633[_0xd296('0x1d')]=qs[_0xd296('0x1d')](_0x76cb23[_0xd296('0x32')][_0xd296('0x1d')]);}_0x4af633['order']=qs[_0xd296('0x39')](_0x76cb23[_0xd296('0x32')][_0xd296('0x39')]);_0x4af633[_0xd296('0x3a')]=qs[_0xd296('0x33')](_['pick'](_0x76cb23[_0xd296('0x32')],_0x4f0aa2[_0xd296('0x33')]),_0x4416a8);if(_0x76cb23[_0xd296('0x32')][_0xd296('0x3b')]){_0x4af633[_0xd296('0x3a')]=_['merge'](_0x4af633['where'],{'$or':_[_0xd296('0x30')](_0x4416a8,function(_0x2cbc87){if(_0x2cbc87[_0xd296('0x2e')]!==_0xd296('0x3c')){var _0x4cecaa={};_0x4cecaa[_0x2cbc87['name']]={'$like':'%'+_0x76cb23['query'][_0xd296('0x3b')]+'%'};return _0x4cecaa;}})});}_0x4af633=_['merge']({},_0x4af633,_0x76cb23[_0xd296('0x3d')]);var _0x1c821a={'where':_0x4af633[_0xd296('0x3a')]};return db[_0xd296('0x3e')][_0xd296('0x1f')](_0x1c821a)[_0xd296('0x25')](function(_0x532bcf){_0x37fc87[_0xd296('0x1f')]=_0x532bcf;if(_0x76cb23[_0xd296('0x32')][_0xd296('0x3f')]){_0x4af633[_0xd296('0x40')]=[{'all':!![]}];}return db[_0xd296('0x3e')]['findAll'](_0x4af633);})['then'](function(_0x4a9784){_0x37fc87['rows']=_0x4a9784;return _0x37fc87;})[_0xd296('0x25')](respondWithFilteredResult(_0x21baad,_0x4af633))[_0xd296('0x41')](handleError(_0x21baad,null));};exports[_0xd296('0x42')]=function(_0x34b5ce,_0x250001){var _0x5667ee={'raw':!![],'where':{'id':_0x34b5ce[_0xd296('0x43')]['id']}},_0x5b2803={};_0x5b2803[_0xd296('0x2f')]=_[_0xd296('0x44')](db[_0xd296('0x3e')][_0xd296('0x2c')]);_0x5b2803[_0xd296('0x32')]=_['keys'](_0x34b5ce[_0xd296('0x32')]);_0x5b2803['filters']=_[_0xd296('0x34')](_0x5b2803[_0xd296('0x2f')],_0x5b2803[_0xd296('0x32')]);_0x5667ee[_0xd296('0x35')]=_[_0xd296('0x34')](_0x5b2803[_0xd296('0x2f')],qs['fields'](_0x34b5ce['query']['fields']));_0x5667ee[_0xd296('0x35')]=_0x5667ee['attributes'][_0xd296('0x37')]?_0x5667ee[_0xd296('0x35')]:_0x5b2803[_0xd296('0x2f')];if(_0x34b5ce[_0xd296('0x32')][_0xd296('0x3f')]){_0x5667ee[_0xd296('0x40')]=[{'all':!![]}];}_0x5667ee=_['merge']({},_0x5667ee,_0x34b5ce['options']);return db[_0xd296('0x3e')][_0xd296('0x45')](_0x5667ee)[_0xd296('0x25')](handleEntityNotFound(_0x250001,null))['then'](respondWithResult(_0x250001,null))['catch'](handleError(_0x250001,null));};exports[_0xd296('0x46')]=function(_0x33f911,_0x187fe6){return db[_0xd296('0x3e')]['create'](_0x33f911['body'],{})[_0xd296('0x25')](function(_0x3e1819){var _0x510dae=_0x33f911[_0xd296('0x47')][_0xd296('0x48')]({'plain':!![]});if(!_0x510dae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x510dae[_0xd296('0x49')]==='user'){var _0x1d273d=_0x3e1819['get']({'plain':!![]});var _0x40ba82=_0xd296('0x27');return db[_0xd296('0x4a')][_0xd296('0x45')]({'where':{'name':_0x40ba82,'userProfileId':_0x510dae[_0xd296('0x4b')]},'raw':!![]})['then'](function(_0x1baa18){if(_0x1baa18&&_0x1baa18[_0xd296('0x4c')]===0x0){return db[_0xd296('0x4d')]['create']({'name':_0x1d273d[_0xd296('0x31')],'resourceId':_0x1d273d['id'],'type':_0x1baa18[_0xd296('0x31')],'sectionId':_0x1baa18['id']},{})[_0xd296('0x25')](function(){return _0x3e1819;});}else{return _0x3e1819;}})[_0xd296('0x41')](function(_0x11dc41){logger[_0xd296('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11dc41);throw _0x11dc41;});}return _0x3e1819;})[_0xd296('0x25')](respondWithResult(_0x187fe6,0xc9))[_0xd296('0x41')](handleError(_0x187fe6,null));};exports[_0xd296('0x24')]=function(_0x563309,_0x3f53e9){if(_0x563309[_0xd296('0x4e')]['id']){delete _0x563309[_0xd296('0x4e')]['id'];}return db[_0xd296('0x3e')][_0xd296('0x45')]({'where':{'id':_0x563309[_0xd296('0x43')]['id']}})[_0xd296('0x25')](handleEntityNotFound(_0x3f53e9,null))[_0xd296('0x25')](saveUpdates(_0x563309[_0xd296('0x4e')],null))[_0xd296('0x25')](respondWithResult(_0x3f53e9,null))[_0xd296('0x41')](handleError(_0x3f53e9,null));};exports[_0xd296('0x26')]=function(_0x3cd761,_0xba1433){return db[_0xd296('0x3e')][_0xd296('0x45')]({'where':{'id':_0x3cd761[_0xd296('0x43')]['id']}})['then'](handleEntityNotFound(_0xba1433,null))[_0xd296('0x25')](removeEntity(_0xba1433,null))[_0xd296('0x41')](handleError(_0xba1433,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f7115cb..00eb2fa 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 _0x15e8=['bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x5b5d20,_0x4bf336){var _0x47c48f=function(_0x4976f5){while(--_0x4976f5){_0x5b5d20['push'](_0x5b5d20['shift']());}};_0x47c48f(++_0x4bf336);}(_0x15e8,0x130));var _0x815e=function(_0x2a4c2b,_0x1ce4a3){_0x2a4c2b=_0x2a4c2b-0x0;var _0x5c5cd1=_0x15e8[_0x2a4c2b];return _0x5c5cd1;};'use strict';var _=require(_0x815e('0x0'));var util=require('util');var logger=require(_0x815e('0x1'))(_0x815e('0x2'));var moment=require(_0x815e('0x3'));var BPromise=require(_0x815e('0x4'));var rp=require(_0x815e('0x5'));var fs=require('fs');var path=require(_0x815e('0x6'));var rimraf=require('rimraf');var config=require(_0x815e('0x7'));var attributes=require(_0x815e('0x8'));module[_0x815e('0x9')]=function(_0x384a2b,_0x1fe695){return _0x384a2b[_0x815e('0xa')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc4e=['../../config/logger','moment','request-promise','path','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util'];(function(_0x46f247,_0x233408){var _0x47170d=function(_0x58280d){while(--_0x58280d){_0x46f247['push'](_0x46f247['shift']());}};_0x47170d(++_0x233408);}(_0xdc4e,0x1e2));var _0xedc4=function(_0x12d39b,_0x153dca){_0x12d39b=_0x12d39b-0x0;var _0x2da792=_0xdc4e[_0x12d39b];return _0x2da792;};'use strict';var _=require(_0xedc4('0x0'));var util=require(_0xedc4('0x1'));var logger=require(_0xedc4('0x2'))('api');var moment=require(_0xedc4('0x3'));var BPromise=require('bluebird');var rp=require(_0xedc4('0x4'));var fs=require('fs');var path=require(_0xedc4('0x5'));var rimraf=require('rimraf');var config=require(_0xedc4('0x6'));var attributes=require(_0xedc4('0x7'));module[_0xedc4('0x8')]=function(_0x406a1b,_0x4d8204){return _0x406a1b['define'](_0xedc4('0x9'),attributes,{'tableName':_0xedc4('0xa'),'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 4b3b972..a3b3fac 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 _0x06a1=['include','map','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x1d59e7,_0x54e8ed){var _0x5355d9=function(_0x4bab0c){while(--_0x4bab0c){_0x1d59e7['push'](_0x1d59e7['shift']());}};_0x5355d9(++_0x54e8ed);}(_0x06a1,0x14d));var _0x106a=function(_0x4d65b1,_0x424678){_0x4d65b1=_0x4d65b1-0x0;var _0x4a0286=_0x06a1[_0x4d65b1];return _0x4a0286;};'use strict';var _=require(_0x106a('0x0'));var util=require(_0x106a('0x1'));var moment=require('moment');var BPromise=require(_0x106a('0x2'));var rs=require(_0x106a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x106a('0x4'));var logger=require(_0x106a('0x5'))(_0x106a('0x6'));var config=require(_0x106a('0x7'));var jayson=require(_0x106a('0x8'));var client=jayson[_0x106a('0x9')][_0x106a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x222f7e,_0x4e0b7d,_0xf871cb){return new BPromise(function(_0x24b030,_0x4f44f9){return client['request'](_0x222f7e,_0xf871cb)['then'](function(_0x2fb511){logger['info'](_0x106a('0xb'),_0x4e0b7d,_0x106a('0xc'));logger[_0x106a('0xd')](_0x106a('0xe'),_0x4e0b7d,'request\x20sent',JSON[_0x106a('0xf')](_0x2fb511));if(_0x2fb511[_0x106a('0x10')]){if(_0x2fb511[_0x106a('0x10')]['code']===0x1f4){logger[_0x106a('0x10')](_0x106a('0xb'),_0x4e0b7d,_0x2fb511[_0x106a('0x10')]['message']);return _0x4f44f9(_0x2fb511[_0x106a('0x10')]['message']);}logger['error'](_0x106a('0xb'),_0x4e0b7d,_0x2fb511['error'][_0x106a('0x11')]);return _0x24b030(_0x2fb511[_0x106a('0x10')][_0x106a('0x11')]);}else{logger['info'](_0x106a('0xb'),_0x4e0b7d,_0x106a('0xc'));_0x24b030(_0x2fb511['result'][_0x106a('0x11')]);}})[_0x106a('0x12')](function(_0x96d14d){logger[_0x106a('0x10')]('Template,\x20%s,\x20%s',_0x4e0b7d,_0x96d14d);_0x4f44f9(_0x96d14d);});});}exports[_0x106a('0x13')]=function(_0x4c8c6d){var _0x3c7787=this;return new Promise(function(_0x25d948,_0x2b662a){return db[_0x106a('0x14')][_0x106a('0x15')]({'raw':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x17')]===undefined?!![]:![]:!![],'where':_0x4c8c6d['options']?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x18')]||null:null,'attributes':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x19')]||null:null,'limit':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d[_0x106a('0x16')][_0x106a('0x1a')]||null:null,'include':_0x4c8c6d[_0x106a('0x16')]?_0x4c8c6d['options'][_0x106a('0x1b')]?_[_0x106a('0x1c')](_0x4c8c6d[_0x106a('0x16')][_0x106a('0x1b')],function(_0x531ac5){return{'model':db[_0x531ac5[_0x106a('0x1d')]],'as':_0x531ac5['as'],'attributes':_0x531ac5[_0x106a('0x19')],'include':_0x531ac5[_0x106a('0x1b')]?_['map'](_0x531ac5[_0x106a('0x1b')],function(_0x4d61d1){return{'model':db[_0x4d61d1[_0x106a('0x1d')]],'as':_0x4d61d1['as'],'attributes':_0x4d61d1[_0x106a('0x19')],'include':_0x4d61d1[_0x106a('0x1b')]?_[_0x106a('0x1c')](_0x4d61d1[_0x106a('0x1b')],function(_0xbae5c1){return{'model':db[_0xbae5c1['model']],'as':_0xbae5c1['as'],'attributes':_0xbae5c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d39cb){logger['info'](_0x106a('0x13'),_0x4c8c6d);logger['debug']('GetTemplate',_0x4c8c6d,JSON[_0x106a('0xf')](_0x1d39cb));_0x25d948(_0x1d39cb);})[_0x106a('0x12')](function(_0x2f41d1){logger['error'](_0x106a('0x13'),_0x2f41d1['message'],_0x4c8c6d);_0x2b662a(_0x3c7787['error'](0x1f4,_0x2f41d1['message']));});});}; \ No newline at end of file +var _0x2d00=['jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTemplate','Template','findAll','options','where','include','map','model','attributes','debug','stringify','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d00,0x139));var _0x02d0=function(_0x2f070e,_0x746f67){_0x2f070e=_0x2f070e-0x0;var _0x4c2618=_0x2d00[_0x2f070e];return _0x4c2618;};'use strict';var _=require('lodash');var util=require(_0x02d0('0x0'));var moment=require(_0x02d0('0x1'));var BPromise=require(_0x02d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02d0('0x3'));var logger=require(_0x02d0('0x4'))(_0x02d0('0x5'));var config=require(_0x02d0('0x6'));var jayson=require(_0x02d0('0x7'));var client=jayson[_0x02d0('0x8')][_0x02d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5733a5,_0x58f5f6,_0x358c50){return new BPromise(function(_0x56dc3c,_0x8afa2c){return client[_0x02d0('0xa')](_0x5733a5,_0x358c50)[_0x02d0('0xb')](function(_0xd2a081){logger[_0x02d0('0xc')](_0x02d0('0xd'),_0x58f5f6,'request\x20sent');logger['debug'](_0x02d0('0xe'),_0x58f5f6,_0x02d0('0xf'),JSON['stringify'](_0xd2a081));if(_0xd2a081[_0x02d0('0x10')]){if(_0xd2a081['error'][_0x02d0('0x11')]===0x1f4){logger[_0x02d0('0x10')](_0x02d0('0xd'),_0x58f5f6,_0xd2a081[_0x02d0('0x10')]['message']);return _0x8afa2c(_0xd2a081['error'][_0x02d0('0x12')]);}logger[_0x02d0('0x10')](_0x02d0('0xd'),_0x58f5f6,_0xd2a081[_0x02d0('0x10')][_0x02d0('0x12')]);return _0x56dc3c(_0xd2a081[_0x02d0('0x10')]['message']);}else{logger[_0x02d0('0xc')]('Template,\x20%s,\x20%s',_0x58f5f6,'request\x20sent');_0x56dc3c(_0xd2a081[_0x02d0('0x13')][_0x02d0('0x12')]);}})[_0x02d0('0x14')](function(_0x51c5f0){logger['error'](_0x02d0('0xd'),_0x58f5f6,_0x51c5f0);_0x8afa2c(_0x51c5f0);});});}exports[_0x02d0('0x15')]=function(_0x5e70bc){var _0x111b9f=this;return new Promise(function(_0x480933,_0x2851ef){return db[_0x02d0('0x16')][_0x02d0('0x17')]({'raw':_0x5e70bc[_0x02d0('0x18')]?_0x5e70bc[_0x02d0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5e70bc[_0x02d0('0x18')]?_0x5e70bc[_0x02d0('0x18')][_0x02d0('0x19')]||null:null,'attributes':_0x5e70bc[_0x02d0('0x18')]?_0x5e70bc['options']['attributes']||null:null,'limit':_0x5e70bc[_0x02d0('0x18')]?_0x5e70bc['options']['limit']||null:null,'include':_0x5e70bc[_0x02d0('0x18')]?_0x5e70bc[_0x02d0('0x18')][_0x02d0('0x1a')]?_[_0x02d0('0x1b')](_0x5e70bc[_0x02d0('0x18')][_0x02d0('0x1a')],function(_0x3769eb){return{'model':db[_0x3769eb[_0x02d0('0x1c')]],'as':_0x3769eb['as'],'attributes':_0x3769eb[_0x02d0('0x1d')],'include':_0x3769eb[_0x02d0('0x1a')]?_[_0x02d0('0x1b')](_0x3769eb[_0x02d0('0x1a')],function(_0x288059){return{'model':db[_0x288059['model']],'as':_0x288059['as'],'attributes':_0x288059[_0x02d0('0x1d')],'include':_0x288059[_0x02d0('0x1a')]?_[_0x02d0('0x1b')](_0x288059[_0x02d0('0x1a')],function(_0x33ca26){return{'model':db[_0x33ca26[_0x02d0('0x1c')]],'as':_0x33ca26['as'],'attributes':_0x33ca26[_0x02d0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02d0('0xb')](function(_0x18ce11){logger[_0x02d0('0xc')](_0x02d0('0x15'),_0x5e70bc);logger[_0x02d0('0x1e')](_0x02d0('0x15'),_0x5e70bc,JSON[_0x02d0('0x1f')](_0x18ce11));_0x480933(_0x18ce11);})['catch'](function(_0x1006de){logger['error'](_0x02d0('0x15'),_0x1006de[_0x02d0('0x12')],_0x5e70bc);_0x2851ef(_0x111b9f[_0x02d0('0x10')](0x1f4,_0x1006de[_0x02d0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c176aa8..5e06f16 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 _0x9172=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','exports','multer','util'];(function(_0x486a19,_0xa9059c){var _0x10b0f4=function(_0x58b4b6){while(--_0x58b4b6){_0x486a19['push'](_0x486a19['shift']());}};_0x10b0f4(++_0xa9059c);}(_0x9172,0x19e));var _0x2917=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x9172[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x2917('0x0'));var util=require(_0x2917('0x1'));var path=require('path');var timeout=require(_0x2917('0x2'));var express=require('express');var router=express[_0x2917('0x3')]();var fs_extra=require(_0x2917('0x4'));var auth=require(_0x2917('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2917('0x6'));var controller=require(_0x2917('0x7'));router[_0x2917('0x8')]('/',auth['isAuthenticated'](),controller[_0x2917('0x9')]);router[_0x2917('0x8')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller[_0x2917('0xc')]);router[_0x2917('0x8')](_0x2917('0xd'),auth[_0x2917('0xb')](),controller[_0x2917('0xe')]);router[_0x2917('0x8')](_0x2917('0xf'),auth[_0x2917('0xb')](),controller['getAnyConditions']);router[_0x2917('0x8')](_0x2917('0x10'),auth[_0x2917('0xb')](),controller[_0x2917('0x11')]);router[_0x2917('0x12')]('/',auth[_0x2917('0xb')](),controller[_0x2917('0x13')]);router[_0x2917('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2917('0x14')]);router[_0x2917('0x12')]('/:id/any_conditions',auth[_0x2917('0xb')](),controller[_0x2917('0x15')]);router[_0x2917('0x12')](_0x2917('0x10'),auth['isAuthenticated'](),controller['addAction']);router[_0x2917('0x16')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller[_0x2917('0x17')]);router[_0x2917('0x18')](_0x2917('0xa'),auth[_0x2917('0xb')](),controller['destroy']);module[_0x2917('0x19')]=router; \ No newline at end of file +var _0xe6f6=['index','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated'];(function(_0x2341f3,_0x167b36){var _0x4d06c6=function(_0x283f03){while(--_0x283f03){_0x2341f3['push'](_0x2341f3['shift']());}};_0x4d06c6(++_0x167b36);}(_0xe6f6,0x13b));var _0x6e6f=function(_0x584fd9,_0x23bcba){_0x584fd9=_0x584fd9-0x0;var _0x2cce30=_0xe6f6[_0x584fd9];return _0x2cce30;};'use strict';var multer=require('multer');var util=require(_0x6e6f('0x0'));var path=require(_0x6e6f('0x1'));var timeout=require(_0x6e6f('0x2'));var express=require('express');var router=express[_0x6e6f('0x3')]();var fs_extra=require(_0x6e6f('0x4'));var auth=require(_0x6e6f('0x5'));var interaction=require(_0x6e6f('0x6'));var config=require(_0x6e6f('0x7'));var controller=require(_0x6e6f('0x8'));router['get']('/',auth[_0x6e6f('0x9')](),controller[_0x6e6f('0xa')]);router[_0x6e6f('0xb')]('/:id',auth[_0x6e6f('0x9')](),controller['show']);router[_0x6e6f('0xb')](_0x6e6f('0xc'),auth['isAuthenticated'](),controller[_0x6e6f('0xd')]);router[_0x6e6f('0xb')](_0x6e6f('0xe'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0xf')]);router[_0x6e6f('0xb')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x6e6f('0x10')]('/',auth[_0x6e6f('0x9')](),controller[_0x6e6f('0x11')]);router['post'](_0x6e6f('0xc'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0x12')]);router[_0x6e6f('0x10')](_0x6e6f('0xe'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0x13')]);router['post'](_0x6e6f('0x14'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0x15')]);router['put'](_0x6e6f('0x16'),auth[_0x6e6f('0x9')](),controller['update']);router['delete'](_0x6e6f('0x16'),auth[_0x6e6f('0x9')](),controller[_0x6e6f('0x17')]);module[_0x6e6f('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 7064a68..e936612 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 _0x8d8e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x24b04c,_0x3f6761){var _0x1728ca=function(_0x48cf21){while(--_0x48cf21){_0x24b04c['push'](_0x24b04c['shift']());}};_0x1728ca(++_0x3f6761);}(_0x8d8e,0xd9));var _0xe8d8=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x8d8e[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xe8d8('0x0'));module[_0xe8d8('0x1')]={'name':{'type':Sequelize[_0xe8d8('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe8d8('0x2')]},'status':{'type':Sequelize[_0xe8d8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9319=['STRING','BOOLEAN','sequelize','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9319,0x8a));var _0x9931=function(_0x939b70,_0x5c9c25){_0x939b70=_0x939b70-0x0;var _0xb5b55b=_0x9319[_0x939b70];return _0xb5b55b;};'use strict';var Sequelize=require(_0x9931('0x0'));module[_0x9931('0x1')]={'name':{'type':Sequelize[_0x9931('0x2')]},'channel':{'type':Sequelize[_0x9931('0x2')]},'description':{'type':Sequelize[_0x9931('0x2')]},'status':{'type':Sequelize[_0x9931('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 2fe5861..ff5bd6b 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 _0xc5f9=['nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','Trigger','findAll','rows','catch','show','params','include','find','create','user','get','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty'];(function(_0x2702f5,_0x5d5195){var _0x51c631=function(_0x1e81b0){while(--_0x1e81b0){_0x2702f5['push'](_0x2702f5['shift']());}};_0x51c631(++_0x5d5195);}(_0xc5f9,0xdb));var _0x9c5f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc5f9[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x9c5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c5f('0x1'));var jsonpatch=require(_0x9c5f('0x2'));var rp=require(_0x9c5f('0x3'));var moment=require(_0x9c5f('0x4'));var BPromise=require(_0x9c5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c5f('0x6'));var sox=require(_0x9c5f('0x7'));var csv=require('to-csv');var ejs=require(_0x9c5f('0x8'));var fs=require('fs');var fs_extra=require(_0x9c5f('0x9'));var _=require(_0x9c5f('0xa'));var squel=require(_0x9c5f('0xb'));var crypto=require('crypto');var jsforce=require(_0x9c5f('0xc'));var deskjs=require(_0x9c5f('0xd'));var toCsv=require(_0x9c5f('0xe'));var querystring=require('querystring');var Papa=require(_0x9c5f('0xf'));var Redis=require(_0x9c5f('0x10'));var authService=require(_0x9c5f('0x11'));var qs=require(_0x9c5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c5f('0x13'))(_0x9c5f('0x14'));var utils=require(_0x9c5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c5f('0x16'))['db'];function respondWithStatusCode(_0x48e4c5,_0x31b9bf){_0x31b9bf=_0x31b9bf||0xcc;return function(_0x14f466){if(_0x14f466){return _0x48e4c5[_0x9c5f('0x17')](_0x31b9bf);}return _0x48e4c5[_0x9c5f('0x18')](_0x31b9bf)[_0x9c5f('0x19')]();};}function respondWithResult(_0x594a44,_0x394aa6){_0x394aa6=_0x394aa6||0xc8;return function(_0x45fdc3){if(_0x45fdc3){return _0x594a44['status'](_0x394aa6)[_0x9c5f('0x1a')](_0x45fdc3);}};}function respondWithFilteredResult(_0x8641c5,_0x3b4c13){return function(_0x17a225){if(_0x17a225){var _0x25a88b=typeof _0x3b4c13[_0x9c5f('0x1b')]===_0x9c5f('0x1c')&&typeof _0x3b4c13[_0x9c5f('0x1d')]===_0x9c5f('0x1c');var _0x358758=_0x17a225[_0x9c5f('0x1e')];var _0x4906b4=_0x25a88b?0x0:_0x3b4c13['offset'];var _0x568dd2=_0x25a88b?_0x17a225[_0x9c5f('0x1e')]:_0x3b4c13['offset']+_0x3b4c13[_0x9c5f('0x1d')];var _0x20a290;if(_0x568dd2>=_0x358758){_0x568dd2=_0x358758;_0x20a290=0xc8;}else{_0x20a290=0xce;}_0x8641c5['status'](_0x20a290);return _0x8641c5['set'](_0x9c5f('0x1f'),_0x4906b4+'-'+_0x568dd2+'/'+_0x358758)['json'](_0x17a225);}return null;};}function patchUpdates(_0x3ce950){return function(_0x2b6866){try{jsonpatch[_0x9c5f('0x20')](_0x2b6866,_0x3ce950,!![]);}catch(_0x408435){return BPromise[_0x9c5f('0x21')](_0x408435);}return _0x2b6866[_0x9c5f('0x22')]();};}function saveUpdates(_0x4d7c5a,_0xfe855e){return function(_0x17a194){if(_0x17a194){return _0x17a194[_0x9c5f('0x23')](_0x4d7c5a)[_0x9c5f('0x24')](function(_0x527ad1){return _0x527ad1;});}return null;};}function removeEntity(_0xc80be1,_0x95625f){return function(_0x2e7991){if(_0x2e7991){return _0x2e7991['destroy']()[_0x9c5f('0x24')](function(){var _0xe3b5f3=_0x2e7991['get']({'plain':!![]});var _0x5d8e80='Triggers';return db['UserProfileResource'][_0x9c5f('0x25')]({'where':{'type':_0x5d8e80,'resourceId':_0xe3b5f3['id']}})[_0x9c5f('0x24')](function(){return _0x2e7991;});})[_0x9c5f('0x24')](function(){_0xc80be1[_0x9c5f('0x18')](0xcc)[_0x9c5f('0x19')]();});}};}function handleEntityNotFound(_0x547f52,_0x4725d9){return function(_0x3bb6de){if(!_0x3bb6de){_0x547f52['sendStatus'](0x194);}return _0x3bb6de;};}function handleError(_0x7ba27d,_0x43c52d){_0x43c52d=_0x43c52d||0x1f4;return function(_0x143585){logger['error'](_0x143585[_0x9c5f('0x26')]);if(_0x143585[_0x9c5f('0x27')]){delete _0x143585[_0x9c5f('0x27')];}_0x7ba27d[_0x9c5f('0x18')](_0x43c52d)['send'](_0x143585);};}exports[_0x9c5f('0x28')]=function(_0x3a650d,_0x3dc135){var _0xbf0b24={},_0x1155b3={},_0x3fb009={'count':0x0,'rows':[]};var _0x15d481=_[_0x9c5f('0x29')](db['Trigger'][_0x9c5f('0x2a')],function(_0x218e29){return{'name':_0x218e29[_0x9c5f('0x2b')],'type':_0x218e29[_0x9c5f('0x2c')]['key']};});_0x1155b3['model']=_['map'](_0x15d481,'name');_0x1155b3['query']=_[_0x9c5f('0x2d')](_0x3a650d['query']);_0x1155b3[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x1155b3[_0x9c5f('0x30')],_0x1155b3['query']);_0xbf0b24[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x1155b3[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x32')]));_0xbf0b24[_0x9c5f('0x31')]=_0xbf0b24['attributes'][_0x9c5f('0x34')]?_0xbf0b24['attributes']:_0x1155b3[_0x9c5f('0x30')];if(!_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0xbf0b24[_0x9c5f('0x1d')]=qs[_0x9c5f('0x1d')](_0x3a650d['query'][_0x9c5f('0x1d')]);_0xbf0b24[_0x9c5f('0x1b')]=qs[_0x9c5f('0x1b')](_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}_0xbf0b24['order']=qs[_0x9c5f('0x37')](_0x3a650d[_0x9c5f('0x33')]['sort']);_0xbf0b24['where']=qs[_0x9c5f('0x2e')](_['pick'](_0x3a650d[_0x9c5f('0x33')],_0x1155b3[_0x9c5f('0x2e')]),_0x15d481);if(_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0xbf0b24['where']=_[_0x9c5f('0x39')](_0xbf0b24[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x15d481,function(_0x45bad6){if(_0x45bad6[_0x9c5f('0x2c')]!==_0x9c5f('0x3b')){var _0x3f381a={};_0x3f381a[_0x45bad6['name']]={'$like':'%'+_0x3a650d[_0x9c5f('0x33')][_0x9c5f('0x38')]+'%'};return _0x3f381a;}})});}_0xbf0b24=_['merge']({},_0xbf0b24,_0x3a650d[_0x9c5f('0x3c')]);var _0x1914a6={'where':_0xbf0b24[_0x9c5f('0x3a')]};return db['Trigger'][_0x9c5f('0x1e')](_0x1914a6)[_0x9c5f('0x24')](function(_0x468107){_0x3fb009[_0x9c5f('0x1e')]=_0x468107;if(_0x3a650d['query'][_0x9c5f('0x3d')]){_0xbf0b24['include']=[{'all':!![]}];}return db[_0x9c5f('0x3e')][_0x9c5f('0x3f')](_0xbf0b24);})[_0x9c5f('0x24')](function(_0x46d063){_0x3fb009[_0x9c5f('0x40')]=_0x46d063;return _0x3fb009;})['then'](respondWithFilteredResult(_0x3dc135,_0xbf0b24))[_0x9c5f('0x41')](handleError(_0x3dc135,null));};exports[_0x9c5f('0x42')]=function(_0x3e84f0,_0x3a3214){var _0x57fde7={'raw':![],'where':{'id':_0x3e84f0[_0x9c5f('0x43')]['id']}},_0x5a6402={};_0x5a6402['model']=_[_0x9c5f('0x2d')](db[_0x9c5f('0x3e')][_0x9c5f('0x2a')]);_0x5a6402['query']=_['keys'](_0x3e84f0['query']);_0x5a6402[_0x9c5f('0x2e')]=_['intersection'](_0x5a6402[_0x9c5f('0x30')],_0x5a6402['query']);_0x57fde7[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x5a6402[_0x9c5f('0x30')],qs['fields'](_0x3e84f0[_0x9c5f('0x33')]['fields']));_0x57fde7[_0x9c5f('0x31')]=_0x57fde7[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x57fde7[_0x9c5f('0x31')]:_0x5a6402[_0x9c5f('0x30')];if(_0x3e84f0['query'][_0x9c5f('0x3d')]){_0x57fde7[_0x9c5f('0x44')]=[{'all':!![]}];}_0x57fde7=_[_0x9c5f('0x39')]({},_0x57fde7,_0x3e84f0[_0x9c5f('0x3c')]);return db[_0x9c5f('0x3e')][_0x9c5f('0x45')](_0x57fde7)[_0x9c5f('0x24')](handleEntityNotFound(_0x3a3214,null))[_0x9c5f('0x24')](respondWithResult(_0x3a3214,null))['catch'](handleError(_0x3a3214,null));};exports[_0x9c5f('0x46')]=function(_0x2cc5aa,_0x3f8ff4){return db[_0x9c5f('0x3e')][_0x9c5f('0x46')](_0x2cc5aa['body'],{})[_0x9c5f('0x24')](function(_0x197344){var _0x2644d7=_0x2cc5aa[_0x9c5f('0x47')][_0x9c5f('0x48')]({'plain':!![]});if(!_0x2644d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2644d7['role']===_0x9c5f('0x47')){var _0x389800=_0x197344[_0x9c5f('0x48')]({'plain':!![]});var _0x1fdc0e=_0x9c5f('0x49');return db[_0x9c5f('0x4a')][_0x9c5f('0x45')]({'where':{'name':_0x1fdc0e,'userProfileId':_0x2644d7[_0x9c5f('0x4b')]},'raw':!![]})['then'](function(_0x5686a0){if(_0x5686a0&&_0x5686a0[_0x9c5f('0x4c')]===0x0){return db['UserProfileResource'][_0x9c5f('0x46')]({'name':_0x389800['name'],'resourceId':_0x389800['id'],'type':_0x5686a0[_0x9c5f('0x27')],'sectionId':_0x5686a0['id']},{})[_0x9c5f('0x24')](function(){return _0x197344;});}else{return _0x197344;}})[_0x9c5f('0x41')](function(_0x20f85a){logger[_0x9c5f('0x4d')](_0x9c5f('0x4e'),_0x20f85a);throw _0x20f85a;});}return _0x197344;})[_0x9c5f('0x24')](respondWithResult(_0x3f8ff4,0xc9))[_0x9c5f('0x41')](handleError(_0x3f8ff4,null));};exports[_0x9c5f('0x23')]=function(_0x4f155a,_0x484968){if(_0x4f155a[_0x9c5f('0x4f')]['id']){delete _0x4f155a[_0x9c5f('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4f155a[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x484968,null))[_0x9c5f('0x24')](saveUpdates(_0x4f155a['body'],null))[_0x9c5f('0x24')](respondWithResult(_0x484968,null))[_0x9c5f('0x41')](handleError(_0x484968,null));};exports[_0x9c5f('0x25')]=function(_0x180dd6,_0x48c5aa){return db['Trigger'][_0x9c5f('0x45')]({'where':{'id':_0x180dd6[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x48c5aa,null))[_0x9c5f('0x24')](removeEntity(_0x48c5aa,null))['catch'](handleError(_0x48c5aa,null));};exports['addAllCondition']=function(_0x22da94,_0x2f0860,_0x20dc0a){if(_0x22da94[_0x9c5f('0x4f')]['id']){delete _0x22da94[_0x9c5f('0x4f')]['id'];}return db[_0x9c5f('0x3e')]['find']({'where':{'id':_0x22da94[_0x9c5f('0x43')]['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x2f0860,null))[_0x9c5f('0x24')](function(_0x21e90e){if(_0x21e90e){_0x22da94[_0x9c5f('0x4f')]['TriggerAllId']=_0x21e90e['id'];return db[_0x9c5f('0x50')]['create'](_0x22da94[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x2f0860,null))[_0x9c5f('0x41')](handleError(_0x2f0860,null));};exports[_0x9c5f('0x51')]=function(_0x3344a2,_0x1c28a3,_0x3b18e0){if(_0x3344a2[_0x9c5f('0x4f')]['id']){delete _0x3344a2[_0x9c5f('0x4f')]['id'];}return db['Trigger'][_0x9c5f('0x45')]({'where':{'id':_0x3344a2[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c28a3,null))[_0x9c5f('0x24')](function(_0x293b1a){if(_0x293b1a){_0x3344a2[_0x9c5f('0x4f')][_0x9c5f('0x52')]=_0x293b1a['id'];return db[_0x9c5f('0x50')][_0x9c5f('0x46')](_0x3344a2[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x1c28a3,null))[_0x9c5f('0x41')](handleError(_0x1c28a3,null));};exports[_0x9c5f('0x53')]=function(_0x5495eb,_0x1b7121,_0x15b427){var _0x753d40={};var _0x2dc3d1={};var _0x4cbba0;var _0x5d6829;return db[_0x9c5f('0x3e')][_0x9c5f('0x54')]({'where':{'id':_0x5495eb['params']['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x1b7121,null))[_0x9c5f('0x24')](function(_0x2740ec){if(_0x2740ec){_0x4cbba0=_0x2740ec;_0x2dc3d1['model']=_['keys'](db['Condition'][_0x9c5f('0x2a')]);_0x2dc3d1[_0x9c5f('0x33')]=_['keys'](_0x5495eb['query']);_0x2dc3d1[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x2dc3d1['model'],_0x2dc3d1[_0x9c5f('0x33')]);_0x753d40[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x2dc3d1[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x5495eb['query'][_0x9c5f('0x32')]));_0x753d40[_0x9c5f('0x31')]=_0x753d40[_0x9c5f('0x31')]['length']?_0x753d40[_0x9c5f('0x31')]:_0x2dc3d1[_0x9c5f('0x30')];_0x753d40[_0x9c5f('0x55')]=qs[_0x9c5f('0x37')](_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x753d40['where']=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x5495eb[_0x9c5f('0x33')],_0x2dc3d1['filters']));if(_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0x753d40['where']=_[_0x9c5f('0x39')](_0x753d40[_0x9c5f('0x3a')],{'$or':_['map'](_0x753d40[_0x9c5f('0x31')],function(_0x1373d6){var _0x1c476f={};_0x1c476f[_0x1373d6]={'$like':'%'+_0x5495eb[_0x9c5f('0x33')]['filter']+'%'};return _0x1c476f;})});}_0x753d40=_[_0x9c5f('0x39')]({},_0x753d40,_0x5495eb['options']);return _0x4cbba0['getAllConditions'](_0x753d40);}})[_0x9c5f('0x24')](function(_0x4800a7){if(_0x4800a7){_0x5d6829=_0x4800a7[_0x9c5f('0x34')];if(!_0x5495eb['query'][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0x753d40['limit']=qs['limit'](_0x5495eb['query'][_0x9c5f('0x1d')]);_0x753d40[_0x9c5f('0x1b')]=qs['offset'](_0x5495eb[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}return _0x4cbba0[_0x9c5f('0x53')](_0x753d40);}})[_0x9c5f('0x24')](function(_0x3f4179){if(_0x3f4179){return _0x3f4179?{'count':_0x5d6829,'rows':_0x3f4179}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x1b7121,null))[_0x9c5f('0x41')](handleError(_0x1b7121,null));};exports[_0x9c5f('0x57')]=function(_0x144896,_0x2fd102,_0x5f438f){var _0x3b0529={};var _0x38dbce={};var _0x58b9fc;var _0x3ea56f;return db[_0x9c5f('0x3e')]['findOne']({'where':{'id':_0x144896['params']['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x2fd102,null))[_0x9c5f('0x24')](function(_0x50760a){if(_0x50760a){_0x58b9fc=_0x50760a;_0x38dbce[_0x9c5f('0x30')]=_['keys'](db[_0x9c5f('0x50')]['rawAttributes']);_0x38dbce[_0x9c5f('0x33')]=_['keys'](_0x144896['query']);_0x38dbce[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x38dbce['model'],_0x38dbce[_0x9c5f('0x33')]);_0x3b0529[_0x9c5f('0x31')]=_[_0x9c5f('0x2f')](_0x38dbce[_0x9c5f('0x30')],qs[_0x9c5f('0x32')](_0x144896['query'][_0x9c5f('0x32')]));_0x3b0529[_0x9c5f('0x31')]=_0x3b0529[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x3b0529[_0x9c5f('0x31')]:_0x38dbce[_0x9c5f('0x30')];_0x3b0529[_0x9c5f('0x55')]=qs['sort'](_0x144896[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x3b0529[_0x9c5f('0x3a')]=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x144896[_0x9c5f('0x33')],_0x38dbce[_0x9c5f('0x2e')]));if(_0x144896[_0x9c5f('0x33')][_0x9c5f('0x38')]){_0x3b0529[_0x9c5f('0x3a')]=_['merge'](_0x3b0529[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x3b0529[_0x9c5f('0x31')],function(_0x230900){var _0x7f2af4={};_0x7f2af4[_0x230900]={'$like':'%'+_0x144896['query'][_0x9c5f('0x38')]+'%'};return _0x7f2af4;})});}_0x3b0529=_[_0x9c5f('0x39')]({},_0x3b0529,_0x144896[_0x9c5f('0x3c')]);return _0x58b9fc[_0x9c5f('0x57')](_0x3b0529);}})[_0x9c5f('0x24')](function(_0x1e6132){if(_0x1e6132){_0x3ea56f=_0x1e6132['length'];if(!_0x144896[_0x9c5f('0x33')]['hasOwnProperty']('nolimit')){_0x3b0529['limit']=qs[_0x9c5f('0x1d')](_0x144896[_0x9c5f('0x33')][_0x9c5f('0x1d')]);_0x3b0529[_0x9c5f('0x1b')]=qs['offset'](_0x144896[_0x9c5f('0x33')]['offset']);}return _0x58b9fc[_0x9c5f('0x57')](_0x3b0529);}})[_0x9c5f('0x24')](function(_0x166d07){if(_0x166d07){return _0x166d07?{'count':_0x3ea56f,'rows':_0x166d07}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x2fd102,null))[_0x9c5f('0x41')](handleError(_0x2fd102,null));};exports['addAction']=function(_0x225cc0,_0x2211b1,_0xe18034){if(_0x225cc0['body']['id']){delete _0x225cc0[_0x9c5f('0x4f')]['id'];}return db[_0x9c5f('0x3e')][_0x9c5f('0x45')]({'where':{'id':_0x225cc0[_0x9c5f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2211b1,null))['then'](function(_0x1b0385){if(_0x1b0385){_0x225cc0[_0x9c5f('0x4f')][_0x9c5f('0x58')]=_0x1b0385['id'];return db[_0x9c5f('0x59')][_0x9c5f('0x46')](_0x225cc0[_0x9c5f('0x4f')]);}})[_0x9c5f('0x24')](respondWithResult(_0x2211b1,null))[_0x9c5f('0x41')](handleError(_0x2211b1,null));};exports[_0x9c5f('0x5a')]=function(_0x3837aa,_0x56203c,_0x2bff03){var _0x40eeda={};var _0x5b7710={};var _0x1fa4c1;var _0x3fadf5;return db[_0x9c5f('0x3e')][_0x9c5f('0x54')]({'where':{'id':_0x3837aa[_0x9c5f('0x43')]['id']}})[_0x9c5f('0x24')](handleEntityNotFound(_0x56203c,null))['then'](function(_0x53ae3f){if(_0x53ae3f){_0x1fa4c1=_0x53ae3f;_0x5b7710[_0x9c5f('0x30')]=_[_0x9c5f('0x2d')](db[_0x9c5f('0x59')][_0x9c5f('0x2a')]);_0x5b7710['query']=_['keys'](_0x3837aa['query']);_0x5b7710[_0x9c5f('0x2e')]=_[_0x9c5f('0x2f')](_0x5b7710[_0x9c5f('0x30')],_0x5b7710[_0x9c5f('0x33')]);_0x40eeda[_0x9c5f('0x31')]=_['intersection'](_0x5b7710['model'],qs[_0x9c5f('0x32')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x32')]));_0x40eeda['attributes']=_0x40eeda[_0x9c5f('0x31')][_0x9c5f('0x34')]?_0x40eeda[_0x9c5f('0x31')]:_0x5b7710[_0x9c5f('0x30')];_0x40eeda[_0x9c5f('0x55')]=qs[_0x9c5f('0x37')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x37')]);_0x40eeda[_0x9c5f('0x3a')]=qs[_0x9c5f('0x2e')](_[_0x9c5f('0x56')](_0x3837aa[_0x9c5f('0x33')],_0x5b7710[_0x9c5f('0x2e')]));if(_0x3837aa['query'][_0x9c5f('0x38')]){_0x40eeda[_0x9c5f('0x3a')]=_[_0x9c5f('0x39')](_0x40eeda[_0x9c5f('0x3a')],{'$or':_[_0x9c5f('0x29')](_0x40eeda['attributes'],function(_0x1d2f5e){var _0x2c0772={};_0x2c0772[_0x1d2f5e]={'$like':'%'+_0x3837aa['query'][_0x9c5f('0x38')]+'%'};return _0x2c0772;})});}_0x40eeda=_['merge']({},_0x40eeda,_0x3837aa[_0x9c5f('0x3c')]);return _0x1fa4c1[_0x9c5f('0x5a')](_0x40eeda);}})[_0x9c5f('0x24')](function(_0x1bf0cf){if(_0x1bf0cf){_0x3fadf5=_0x1bf0cf['length'];if(!_0x3837aa['query'][_0x9c5f('0x35')](_0x9c5f('0x36'))){_0x40eeda[_0x9c5f('0x1d')]=qs[_0x9c5f('0x1d')](_0x3837aa[_0x9c5f('0x33')]['limit']);_0x40eeda[_0x9c5f('0x1b')]=qs[_0x9c5f('0x1b')](_0x3837aa[_0x9c5f('0x33')][_0x9c5f('0x1b')]);}return _0x1fa4c1[_0x9c5f('0x5a')](_0x40eeda);}})[_0x9c5f('0x24')](function(_0x3e6818){if(_0x3e6818){return _0x3e6818?{'count':_0x3fadf5,'rows':_0x3e6818}:null;}})[_0x9c5f('0x24')](respondWithResult(_0x56203c,null))[_0x9c5f('0x41')](handleError(_0x56203c,null));}; \ No newline at end of file +var _0xaacc=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x42ec68,_0x5c6137){var _0x33a856=function(_0x33a6e0){while(--_0x33a6e0){_0x42ec68['push'](_0x42ec68['shift']());}};_0x33a856(++_0x5c6137);}(_0xaacc,0x161));var _0xcaac=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xaacc[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0xcaac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcaac('0x1'));var rp=require(_0xcaac('0x2'));var moment=require(_0xcaac('0x3'));var BPromise=require(_0xcaac('0x4'));var Mustache=require(_0xcaac('0x5'));var util=require(_0xcaac('0x6'));var path=require(_0xcaac('0x7'));var sox=require(_0xcaac('0x8'));var csv=require(_0xcaac('0x9'));var ejs=require(_0xcaac('0xa'));var fs=require('fs');var fs_extra=require(_0xcaac('0xb'));var _=require('lodash');var squel=require(_0xcaac('0xc'));var crypto=require(_0xcaac('0xd'));var jsforce=require(_0xcaac('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcaac('0x9'));var querystring=require(_0xcaac('0xf'));var Papa=require('papaparse');var Redis=require(_0xcaac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcaac('0x11'));var as=require(_0xcaac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaac('0x13'))(_0xcaac('0x14'));var utils=require(_0xcaac('0x15'));var config=require(_0xcaac('0x16'));var licenseUtil=require(_0xcaac('0x17'));var db=require(_0xcaac('0x18'))['db'];function respondWithStatusCode(_0x304502,_0x5211cd){_0x5211cd=_0x5211cd||0xcc;return function(_0x416229){if(_0x416229){return _0x304502[_0xcaac('0x19')](_0x5211cd);}return _0x304502[_0xcaac('0x1a')](_0x5211cd)[_0xcaac('0x1b')]();};}function respondWithResult(_0x534c74,_0x3dfc62){_0x3dfc62=_0x3dfc62||0xc8;return function(_0x3083b2){if(_0x3083b2){return _0x534c74['status'](_0x3dfc62)[_0xcaac('0x1c')](_0x3083b2);}};}function respondWithFilteredResult(_0x3183d8,_0x4f0f8e){return function(_0x563836){if(_0x563836){var _0x22a141=typeof _0x4f0f8e['offset']===_0xcaac('0x1d')&&typeof _0x4f0f8e[_0xcaac('0x1e')]===_0xcaac('0x1d');var _0x40470d=_0x563836[_0xcaac('0x1f')];var _0x3be05e=_0x22a141?0x0:_0x4f0f8e['offset'];var _0x2533c1=_0x22a141?_0x563836[_0xcaac('0x1f')]:_0x4f0f8e[_0xcaac('0x20')]+_0x4f0f8e[_0xcaac('0x1e')];var _0x4ca44a;if(_0x2533c1>=_0x40470d){_0x2533c1=_0x40470d;_0x4ca44a=0xc8;}else{_0x4ca44a=0xce;}_0x3183d8[_0xcaac('0x1a')](_0x4ca44a);return _0x3183d8[_0xcaac('0x21')](_0xcaac('0x22'),_0x3be05e+'-'+_0x2533c1+'/'+_0x40470d)[_0xcaac('0x1c')](_0x563836);}return null;};}function patchUpdates(_0x1fa2fd){return function(_0x46271d){try{jsonpatch[_0xcaac('0x23')](_0x46271d,_0x1fa2fd,!![]);}catch(_0x5f3cb4){return BPromise['reject'](_0x5f3cb4);}return _0x46271d['save']();};}function saveUpdates(_0x13b4fb,_0x42871e){return function(_0x2457c9){if(_0x2457c9){return _0x2457c9['update'](_0x13b4fb)[_0xcaac('0x24')](function(_0x1f4103){return _0x1f4103;});}return null;};}function removeEntity(_0x4ba166,_0xa9fa70){return function(_0x503bec){if(_0x503bec){return _0x503bec[_0xcaac('0x25')]()[_0xcaac('0x24')](function(){var _0x51b34f=_0x503bec[_0xcaac('0x26')]({'plain':!![]});var _0x92441a=_0xcaac('0x27');return db[_0xcaac('0x28')]['destroy']({'where':{'type':_0x92441a,'resourceId':_0x51b34f['id']}})[_0xcaac('0x24')](function(){return _0x503bec;});})[_0xcaac('0x24')](function(){_0x4ba166[_0xcaac('0x1a')](0xcc)[_0xcaac('0x1b')]();});}};}function handleEntityNotFound(_0x1aeb3f,_0x1748b2){return function(_0x27203b){if(!_0x27203b){_0x1aeb3f[_0xcaac('0x19')](0x194);}return _0x27203b;};}function handleError(_0x568905,_0x14b1a1){_0x14b1a1=_0x14b1a1||0x1f4;return function(_0x2fae5b){logger[_0xcaac('0x29')](_0x2fae5b[_0xcaac('0x2a')]);if(_0x2fae5b[_0xcaac('0x2b')]){delete _0x2fae5b[_0xcaac('0x2b')];}_0x568905[_0xcaac('0x1a')](_0x14b1a1)[_0xcaac('0x2c')](_0x2fae5b);};}exports[_0xcaac('0x2d')]=function(_0x31dcd8,_0x32a71d){var _0xcbdc87={},_0x2b4b37={},_0x51af26={'count':0x0,'rows':[]};var _0x5af090=_[_0xcaac('0x2e')](db[_0xcaac('0x2f')][_0xcaac('0x30')],function(_0x110144){return{'name':_0x110144[_0xcaac('0x31')],'type':_0x110144['type']['key']};});_0x2b4b37[_0xcaac('0x32')]=_[_0xcaac('0x2e')](_0x5af090,_0xcaac('0x2b'));_0x2b4b37['query']=_[_0xcaac('0x33')](_0x31dcd8[_0xcaac('0x34')]);_0x2b4b37['filters']=_[_0xcaac('0x35')](_0x2b4b37[_0xcaac('0x32')],_0x2b4b37[_0xcaac('0x34')]);_0xcbdc87[_0xcaac('0x36')]=_['intersection'](_0x2b4b37[_0xcaac('0x32')],qs[_0xcaac('0x37')](_0x31dcd8['query'][_0xcaac('0x37')]));_0xcbdc87[_0xcaac('0x36')]=_0xcbdc87[_0xcaac('0x36')][_0xcaac('0x38')]?_0xcbdc87['attributes']:_0x2b4b37['model'];if(!_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x39')](_0xcaac('0x3a'))){_0xcbdc87[_0xcaac('0x1e')]=qs[_0xcaac('0x1e')](_0x31dcd8['query'][_0xcaac('0x1e')]);_0xcbdc87[_0xcaac('0x20')]=qs[_0xcaac('0x20')](_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x20')]);}_0xcbdc87[_0xcaac('0x3b')]=qs[_0xcaac('0x3c')](_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x3c')]);_0xcbdc87[_0xcaac('0x3d')]=qs[_0xcaac('0x3e')](_[_0xcaac('0x3f')](_0x31dcd8['query'],_0x2b4b37[_0xcaac('0x3e')]),_0x5af090);if(_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x40')]){_0xcbdc87[_0xcaac('0x3d')]=_[_0xcaac('0x41')](_0xcbdc87[_0xcaac('0x3d')],{'$or':_[_0xcaac('0x2e')](_0x5af090,function(_0x4165a2){if(_0x4165a2[_0xcaac('0x42')]!==_0xcaac('0x43')){var _0x183b00={};_0x183b00[_0x4165a2[_0xcaac('0x2b')]]={'$like':'%'+_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x40')]+'%'};return _0x183b00;}})});}_0xcbdc87=_[_0xcaac('0x41')]({},_0xcbdc87,_0x31dcd8[_0xcaac('0x44')]);var _0x57efdf={'where':_0xcbdc87['where']};return db[_0xcaac('0x2f')][_0xcaac('0x1f')](_0x57efdf)[_0xcaac('0x24')](function(_0x43ca0a){_0x51af26[_0xcaac('0x1f')]=_0x43ca0a;if(_0x31dcd8[_0xcaac('0x34')][_0xcaac('0x45')]){_0xcbdc87[_0xcaac('0x46')]=[{'all':!![]}];}return db[_0xcaac('0x2f')][_0xcaac('0x47')](_0xcbdc87);})['then'](function(_0x454e19){_0x51af26[_0xcaac('0x48')]=_0x454e19;return _0x51af26;})[_0xcaac('0x24')](respondWithFilteredResult(_0x32a71d,_0xcbdc87))['catch'](handleError(_0x32a71d,null));};exports[_0xcaac('0x49')]=function(_0x5ea5cc,_0x15001b){var _0x4242d2={'raw':![],'where':{'id':_0x5ea5cc['params']['id']}},_0xe7c220={};_0xe7c220[_0xcaac('0x32')]=_['keys'](db[_0xcaac('0x2f')]['rawAttributes']);_0xe7c220[_0xcaac('0x34')]=_[_0xcaac('0x33')](_0x5ea5cc[_0xcaac('0x34')]);_0xe7c220['filters']=_['intersection'](_0xe7c220['model'],_0xe7c220[_0xcaac('0x34')]);_0x4242d2[_0xcaac('0x36')]=_[_0xcaac('0x35')](_0xe7c220[_0xcaac('0x32')],qs[_0xcaac('0x37')](_0x5ea5cc[_0xcaac('0x34')][_0xcaac('0x37')]));_0x4242d2[_0xcaac('0x36')]=_0x4242d2[_0xcaac('0x36')][_0xcaac('0x38')]?_0x4242d2[_0xcaac('0x36')]:_0xe7c220[_0xcaac('0x32')];if(_0x5ea5cc[_0xcaac('0x34')]['includeAll']){_0x4242d2[_0xcaac('0x46')]=[{'all':!![]}];}_0x4242d2=_[_0xcaac('0x41')]({},_0x4242d2,_0x5ea5cc[_0xcaac('0x44')]);return db['Trigger']['find'](_0x4242d2)[_0xcaac('0x24')](handleEntityNotFound(_0x15001b,null))[_0xcaac('0x24')](respondWithResult(_0x15001b,null))[_0xcaac('0x4a')](handleError(_0x15001b,null));};exports[_0xcaac('0x4b')]=function(_0x2bd56c,_0x4feaa5){return db[_0xcaac('0x2f')][_0xcaac('0x4b')](_0x2bd56c[_0xcaac('0x4c')],{})[_0xcaac('0x24')](function(_0x5c51f1){var _0x48879f=_0x2bd56c['user']['get']({'plain':!![]});if(!_0x48879f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48879f[_0xcaac('0x4d')]===_0xcaac('0x4e')){var _0x3b610e=_0x5c51f1[_0xcaac('0x26')]({'plain':!![]});var _0x189456='Triggers';return db['UserProfileSection'][_0xcaac('0x4f')]({'where':{'name':_0x189456,'userProfileId':_0x48879f['userProfileId']},'raw':!![]})['then'](function(_0x31a04a){if(_0x31a04a&&_0x31a04a['autoAssociation']===0x0){return db[_0xcaac('0x28')]['create']({'name':_0x3b610e[_0xcaac('0x2b')],'resourceId':_0x3b610e['id'],'type':_0x31a04a[_0xcaac('0x2b')],'sectionId':_0x31a04a['id']},{})[_0xcaac('0x24')](function(){return _0x5c51f1;});}else{return _0x5c51f1;}})[_0xcaac('0x4a')](function(_0x280770){logger[_0xcaac('0x29')](_0xcaac('0x50'),_0x280770);throw _0x280770;});}return _0x5c51f1;})['then'](respondWithResult(_0x4feaa5,0xc9))[_0xcaac('0x4a')](handleError(_0x4feaa5,null));};exports['update']=function(_0x27f5ed,_0x139907){if(_0x27f5ed[_0xcaac('0x4c')]['id']){delete _0x27f5ed[_0xcaac('0x4c')]['id'];}return db[_0xcaac('0x2f')][_0xcaac('0x4f')]({'where':{'id':_0x27f5ed['params']['id']}})[_0xcaac('0x24')](handleEntityNotFound(_0x139907,null))[_0xcaac('0x24')](saveUpdates(_0x27f5ed[_0xcaac('0x4c')],null))[_0xcaac('0x24')](respondWithResult(_0x139907,null))[_0xcaac('0x4a')](handleError(_0x139907,null));};exports[_0xcaac('0x25')]=function(_0x352278,_0x256240){return db['Trigger'][_0xcaac('0x4f')]({'where':{'id':_0x352278[_0xcaac('0x51')]['id']}})[_0xcaac('0x24')](handleEntityNotFound(_0x256240,null))['then'](removeEntity(_0x256240,null))[_0xcaac('0x4a')](handleError(_0x256240,null));};exports[_0xcaac('0x52')]=function(_0x57ca44,_0x58f7d6,_0x149fd4){if(_0x57ca44[_0xcaac('0x4c')]['id']){delete _0x57ca44[_0xcaac('0x4c')]['id'];}return db[_0xcaac('0x2f')][_0xcaac('0x4f')]({'where':{'id':_0x57ca44['params']['id']}})['then'](handleEntityNotFound(_0x58f7d6,null))[_0xcaac('0x24')](function(_0x3025c5){if(_0x3025c5){_0x57ca44[_0xcaac('0x4c')][_0xcaac('0x53')]=_0x3025c5['id'];return db['Condition']['create'](_0x57ca44['body']);}})['then'](respondWithResult(_0x58f7d6,null))[_0xcaac('0x4a')](handleError(_0x58f7d6,null));};exports[_0xcaac('0x54')]=function(_0x236500,_0x1d85bb,_0x5557ad){if(_0x236500[_0xcaac('0x4c')]['id']){delete _0x236500[_0xcaac('0x4c')]['id'];}return db[_0xcaac('0x2f')]['find']({'where':{'id':_0x236500[_0xcaac('0x51')]['id']}})[_0xcaac('0x24')](handleEntityNotFound(_0x1d85bb,null))['then'](function(_0x3086ad){if(_0x3086ad){_0x236500[_0xcaac('0x4c')]['TriggerAnyId']=_0x3086ad['id'];return db[_0xcaac('0x55')][_0xcaac('0x4b')](_0x236500[_0xcaac('0x4c')]);}})[_0xcaac('0x24')](respondWithResult(_0x1d85bb,null))[_0xcaac('0x4a')](handleError(_0x1d85bb,null));};exports[_0xcaac('0x56')]=function(_0x141fe4,_0x3fbfa2,_0x2908f0){var _0x54f615={};var _0x1d5294={};var _0x21da3f;var _0x13690b;return db[_0xcaac('0x2f')]['findOne']({'where':{'id':_0x141fe4['params']['id']}})[_0xcaac('0x24')](handleEntityNotFound(_0x3fbfa2,null))[_0xcaac('0x24')](function(_0x70a855){if(_0x70a855){_0x21da3f=_0x70a855;_0x1d5294[_0xcaac('0x32')]=_[_0xcaac('0x33')](db['Condition']['rawAttributes']);_0x1d5294['query']=_['keys'](_0x141fe4[_0xcaac('0x34')]);_0x1d5294[_0xcaac('0x3e')]=_[_0xcaac('0x35')](_0x1d5294[_0xcaac('0x32')],_0x1d5294[_0xcaac('0x34')]);_0x54f615['attributes']=_[_0xcaac('0x35')](_0x1d5294[_0xcaac('0x32')],qs[_0xcaac('0x37')](_0x141fe4[_0xcaac('0x34')][_0xcaac('0x37')]));_0x54f615[_0xcaac('0x36')]=_0x54f615[_0xcaac('0x36')][_0xcaac('0x38')]?_0x54f615[_0xcaac('0x36')]:_0x1d5294[_0xcaac('0x32')];_0x54f615[_0xcaac('0x3b')]=qs[_0xcaac('0x3c')](_0x141fe4['query'][_0xcaac('0x3c')]);_0x54f615[_0xcaac('0x3d')]=qs['filters'](_[_0xcaac('0x3f')](_0x141fe4[_0xcaac('0x34')],_0x1d5294[_0xcaac('0x3e')]));if(_0x141fe4[_0xcaac('0x34')][_0xcaac('0x40')]){_0x54f615[_0xcaac('0x3d')]=_[_0xcaac('0x41')](_0x54f615['where'],{'$or':_['map'](_0x54f615['attributes'],function(_0x1d3f15){var _0xbe3bd8={};_0xbe3bd8[_0x1d3f15]={'$like':'%'+_0x141fe4[_0xcaac('0x34')]['filter']+'%'};return _0xbe3bd8;})});}_0x54f615=_[_0xcaac('0x41')]({},_0x54f615,_0x141fe4['options']);return _0x21da3f['getAllConditions'](_0x54f615);}})[_0xcaac('0x24')](function(_0x435bcb){if(_0x435bcb){_0x13690b=_0x435bcb[_0xcaac('0x38')];if(!_0x141fe4[_0xcaac('0x34')][_0xcaac('0x39')]('nolimit')){_0x54f615['limit']=qs['limit'](_0x141fe4[_0xcaac('0x34')]['limit']);_0x54f615[_0xcaac('0x20')]=qs[_0xcaac('0x20')](_0x141fe4[_0xcaac('0x34')]['offset']);}return _0x21da3f[_0xcaac('0x56')](_0x54f615);}})[_0xcaac('0x24')](function(_0x53d027){if(_0x53d027){return _0x53d027?{'count':_0x13690b,'rows':_0x53d027}:null;}})[_0xcaac('0x24')](respondWithResult(_0x3fbfa2,null))[_0xcaac('0x4a')](handleError(_0x3fbfa2,null));};exports[_0xcaac('0x57')]=function(_0x2d919e,_0x4fdaf2,_0x3a3e14){var _0x209341={};var _0x1211e7={};var _0x2a756c;var _0x589ed3;return db[_0xcaac('0x2f')][_0xcaac('0x58')]({'where':{'id':_0x2d919e[_0xcaac('0x51')]['id']}})['then'](handleEntityNotFound(_0x4fdaf2,null))['then'](function(_0x76bb15){if(_0x76bb15){_0x2a756c=_0x76bb15;_0x1211e7[_0xcaac('0x32')]=_[_0xcaac('0x33')](db[_0xcaac('0x55')]['rawAttributes']);_0x1211e7[_0xcaac('0x34')]=_[_0xcaac('0x33')](_0x2d919e[_0xcaac('0x34')]);_0x1211e7['filters']=_[_0xcaac('0x35')](_0x1211e7[_0xcaac('0x32')],_0x1211e7[_0xcaac('0x34')]);_0x209341[_0xcaac('0x36')]=_[_0xcaac('0x35')](_0x1211e7['model'],qs[_0xcaac('0x37')](_0x2d919e[_0xcaac('0x34')][_0xcaac('0x37')]));_0x209341[_0xcaac('0x36')]=_0x209341[_0xcaac('0x36')][_0xcaac('0x38')]?_0x209341[_0xcaac('0x36')]:_0x1211e7['model'];_0x209341[_0xcaac('0x3b')]=qs[_0xcaac('0x3c')](_0x2d919e[_0xcaac('0x34')]['sort']);_0x209341[_0xcaac('0x3d')]=qs['filters'](_[_0xcaac('0x3f')](_0x2d919e[_0xcaac('0x34')],_0x1211e7['filters']));if(_0x2d919e[_0xcaac('0x34')]['filter']){_0x209341[_0xcaac('0x3d')]=_[_0xcaac('0x41')](_0x209341[_0xcaac('0x3d')],{'$or':_[_0xcaac('0x2e')](_0x209341[_0xcaac('0x36')],function(_0x4d688c){var _0x1cc243={};_0x1cc243[_0x4d688c]={'$like':'%'+_0x2d919e[_0xcaac('0x34')][_0xcaac('0x40')]+'%'};return _0x1cc243;})});}_0x209341=_[_0xcaac('0x41')]({},_0x209341,_0x2d919e[_0xcaac('0x44')]);return _0x2a756c[_0xcaac('0x57')](_0x209341);}})[_0xcaac('0x24')](function(_0x281398){if(_0x281398){_0x589ed3=_0x281398[_0xcaac('0x38')];if(!_0x2d919e['query']['hasOwnProperty'](_0xcaac('0x3a'))){_0x209341[_0xcaac('0x1e')]=qs[_0xcaac('0x1e')](_0x2d919e[_0xcaac('0x34')]['limit']);_0x209341['offset']=qs[_0xcaac('0x20')](_0x2d919e[_0xcaac('0x34')][_0xcaac('0x20')]);}return _0x2a756c['getAnyConditions'](_0x209341);}})[_0xcaac('0x24')](function(_0x2482fd){if(_0x2482fd){return _0x2482fd?{'count':_0x589ed3,'rows':_0x2482fd}:null;}})[_0xcaac('0x24')](respondWithResult(_0x4fdaf2,null))[_0xcaac('0x4a')](handleError(_0x4fdaf2,null));};exports[_0xcaac('0x59')]=function(_0x437628,_0x291403,_0x6f2a19){if(_0x437628[_0xcaac('0x4c')]['id']){delete _0x437628[_0xcaac('0x4c')]['id'];}return db['Trigger'][_0xcaac('0x4f')]({'where':{'id':_0x437628[_0xcaac('0x51')]['id']}})[_0xcaac('0x24')](handleEntityNotFound(_0x291403,null))[_0xcaac('0x24')](function(_0x4a3172){if(_0x4a3172){_0x437628['body'][_0xcaac('0x5a')]=_0x4a3172['id'];return db['Action'][_0xcaac('0x4b')](_0x437628['body']);}})[_0xcaac('0x24')](respondWithResult(_0x291403,null))['catch'](handleError(_0x291403,null));};exports[_0xcaac('0x5b')]=function(_0x463600,_0xc08690,_0x2f6fd2){var _0x35fe09={};var _0x355aa0={};var _0x245890;var _0x2caa14;return db['Trigger'][_0xcaac('0x58')]({'where':{'id':_0x463600[_0xcaac('0x51')]['id']}})['then'](handleEntityNotFound(_0xc08690,null))[_0xcaac('0x24')](function(_0x5b4689){if(_0x5b4689){_0x245890=_0x5b4689;_0x355aa0['model']=_['keys'](db['Action'][_0xcaac('0x30')]);_0x355aa0[_0xcaac('0x34')]=_['keys'](_0x463600[_0xcaac('0x34')]);_0x355aa0['filters']=_[_0xcaac('0x35')](_0x355aa0[_0xcaac('0x32')],_0x355aa0['query']);_0x35fe09[_0xcaac('0x36')]=_[_0xcaac('0x35')](_0x355aa0[_0xcaac('0x32')],qs[_0xcaac('0x37')](_0x463600[_0xcaac('0x34')]['fields']));_0x35fe09['attributes']=_0x35fe09[_0xcaac('0x36')][_0xcaac('0x38')]?_0x35fe09[_0xcaac('0x36')]:_0x355aa0[_0xcaac('0x32')];_0x35fe09[_0xcaac('0x3b')]=qs[_0xcaac('0x3c')](_0x463600[_0xcaac('0x34')][_0xcaac('0x3c')]);_0x35fe09[_0xcaac('0x3d')]=qs['filters'](_[_0xcaac('0x3f')](_0x463600['query'],_0x355aa0[_0xcaac('0x3e')]));if(_0x463600['query'][_0xcaac('0x40')]){_0x35fe09[_0xcaac('0x3d')]=_[_0xcaac('0x41')](_0x35fe09['where'],{'$or':_['map'](_0x35fe09[_0xcaac('0x36')],function(_0x548b14){var _0x1bac60={};_0x1bac60[_0x548b14]={'$like':'%'+_0x463600[_0xcaac('0x34')]['filter']+'%'};return _0x1bac60;})});}_0x35fe09=_[_0xcaac('0x41')]({},_0x35fe09,_0x463600[_0xcaac('0x44')]);return _0x245890[_0xcaac('0x5b')](_0x35fe09);}})['then'](function(_0x1150eb){if(_0x1150eb){_0x2caa14=_0x1150eb[_0xcaac('0x38')];if(!_0x463600['query'][_0xcaac('0x39')](_0xcaac('0x3a'))){_0x35fe09[_0xcaac('0x1e')]=qs[_0xcaac('0x1e')](_0x463600[_0xcaac('0x34')][_0xcaac('0x1e')]);_0x35fe09[_0xcaac('0x20')]=qs[_0xcaac('0x20')](_0x463600['query'][_0xcaac('0x20')]);}return _0x245890[_0xcaac('0x5b')](_0x35fe09);}})[_0xcaac('0x24')](function(_0x21a5cb){if(_0x21a5cb){return _0x21a5cb?{'count':_0x2caa14,'rows':_0x21a5cb}:null;}})[_0xcaac('0x24')](respondWithResult(_0xc08690,null))['catch'](handleError(_0xc08690,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 06e4cbe..0e7f926 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 _0x6ec9=['exports','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1420fc,_0x485b44){var _0x2e155d=function(_0x35e0e0){while(--_0x35e0e0){_0x1420fc['push'](_0x1420fc['shift']());}};_0x2e155d(++_0x485b44);}(_0x6ec9,0x174));var _0x96ec=function(_0x161593,_0x212b7e){_0x161593=_0x161593-0x0;var _0x1ab1e2=_0x6ec9[_0x161593];return _0x1ab1e2;};'use strict';var _=require(_0x96ec('0x0'));var util=require('util');var logger=require(_0x96ec('0x1'))('api');var moment=require(_0x96ec('0x2'));var BPromise=require('bluebird');var rp=require(_0x96ec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var attributes=require('./trigger.attributes');module[_0x96ec('0x6')]=function(_0x41a215,_0x2fcbb7){return _0x41a215['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fed=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','./trigger.attributes'];(function(_0x3febf8,_0x3a20b1){var _0x56b67d=function(_0x123166){while(--_0x123166){_0x3febf8['push'](_0x3febf8['shift']());}};_0x56b67d(++_0x3a20b1);}(_0x2fed,0x7c));var _0xd2fe=function(_0x47ff09,_0x3a3a95){_0x47ff09=_0x47ff09-0x0;var _0xc7aa14=_0x2fed[_0x47ff09];return _0xc7aa14;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('0xb'),'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 96aca05..dc57455 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 _0x1099=['message','result','catch','Trigger','findAll','options','raw','attributes','include','model','map','then','GetTrigger','debug','ShowTrigger','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x389bac,_0xa87c5d){var _0x29d99c=function(_0x173690){while(--_0x173690){_0x389bac['push'](_0x389bac['shift']());}};_0x29d99c(++_0xa87c5d);}(_0x1099,0x141));var _0x9109=function(_0x595288,_0x41d340){_0x595288=_0x595288-0x0;var _0x50cdda=_0x1099[_0x595288];return _0x50cdda;};'use strict';var _=require(_0x9109('0x0'));var util=require(_0x9109('0x1'));var moment=require(_0x9109('0x2'));var BPromise=require(_0x9109('0x3'));var rs=require(_0x9109('0x4'));var fs=require('fs');var Redis=require(_0x9109('0x5'));var db=require(_0x9109('0x6'))['db'];var utils=require(_0x9109('0x7'));var logger=require(_0x9109('0x8'))('rpc');var config=require(_0x9109('0x9'));var jayson=require(_0x9109('0xa'));var client=jayson[_0x9109('0xb')][_0x9109('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe91af3,_0x571f8e,_0xd7d752){return new BPromise(function(_0x263a1b,_0xfb3629){return client[_0x9109('0xd')](_0xe91af3,_0xd7d752)['then'](function(_0x459844){logger[_0x9109('0xe')](_0x9109('0xf'),_0x571f8e,_0x9109('0x10'));logger['debug'](_0x9109('0x11'),_0x571f8e,_0x9109('0x10'),JSON[_0x9109('0x12')](_0x459844));if(_0x459844[_0x9109('0x13')]){if(_0x459844[_0x9109('0x13')][_0x9109('0x14')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x571f8e,_0x459844[_0x9109('0x13')][_0x9109('0x15')]);return _0xfb3629(_0x459844[_0x9109('0x13')][_0x9109('0x15')]);}logger[_0x9109('0x13')](_0x9109('0xf'),_0x571f8e,_0x459844[_0x9109('0x13')][_0x9109('0x15')]);return _0x263a1b(_0x459844[_0x9109('0x13')][_0x9109('0x15')]);}else{logger[_0x9109('0xe')]('Trigger,\x20%s,\x20%s',_0x571f8e,_0x9109('0x10'));_0x263a1b(_0x459844[_0x9109('0x16')]['message']);}})[_0x9109('0x17')](function(_0x21cb2b){logger[_0x9109('0x13')]('Trigger,\x20%s,\x20%s',_0x571f8e,_0x21cb2b);_0xfb3629(_0x21cb2b);});});}exports['GetTrigger']=function(_0x2ca2d6){var _0x45c4c7=this;return new Promise(function(_0x43e81c,_0x11f33c){return db[_0x9109('0x18')][_0x9109('0x19')]({'raw':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6['options'][_0x9109('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')]['where']||null:null,'attributes':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')][_0x9109('0x1c')]||null:null,'limit':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')]['limit']||null:null,'include':_0x2ca2d6[_0x9109('0x1a')]?_0x2ca2d6[_0x9109('0x1a')][_0x9109('0x1d')]?_['map'](_0x2ca2d6['options'][_0x9109('0x1d')],function(_0x17f130){return{'model':db[_0x17f130[_0x9109('0x1e')]],'as':_0x17f130['as'],'attributes':_0x17f130[_0x9109('0x1c')],'include':_0x17f130['include']?_[_0x9109('0x1f')](_0x17f130[_0x9109('0x1d')],function(_0x55ffc8){return{'model':db[_0x55ffc8[_0x9109('0x1e')]],'as':_0x55ffc8['as'],'attributes':_0x55ffc8[_0x9109('0x1c')],'include':_0x55ffc8['include']?_['map'](_0x55ffc8[_0x9109('0x1d')],function(_0x2122b4){return{'model':db[_0x2122b4[_0x9109('0x1e')]],'as':_0x2122b4['as'],'attributes':_0x2122b4[_0x9109('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9109('0x20')](function(_0x3a639d){logger[_0x9109('0xe')](_0x9109('0x21'),_0x2ca2d6);logger[_0x9109('0x22')](_0x9109('0x21'),_0x2ca2d6,JSON[_0x9109('0x12')](_0x3a639d));_0x43e81c(_0x3a639d);})[_0x9109('0x17')](function(_0x70327c){logger[_0x9109('0x13')]('GetTrigger',_0x70327c[_0x9109('0x15')],_0x2ca2d6);_0x11f33c(_0x45c4c7[_0x9109('0x13')](0x1f4,_0x70327c[_0x9109('0x15')]));});});};exports[_0x9109('0x23')]=function(_0x4d9f72){var _0x11c7d2=this;return new Promise(function(_0x49c31d,_0x1b798e){return db[_0x9109('0x18')][_0x9109('0x24')]({'raw':_0x4d9f72['options']?_0x4d9f72['options'][_0x9109('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72['options'][_0x9109('0x25')]||null:null,'attributes':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72['options']['attributes']||null:null,'include':_0x4d9f72[_0x9109('0x1a')]?_0x4d9f72[_0x9109('0x1a')][_0x9109('0x1d')]?_[_0x9109('0x1f')](_0x4d9f72[_0x9109('0x1a')]['include'],function(_0x226e0b){return{'model':db[_0x226e0b[_0x9109('0x1e')]],'as':_0x226e0b['as'],'attributes':_0x226e0b[_0x9109('0x1c')],'include':_0x226e0b[_0x9109('0x1d')]?_['map'](_0x226e0b[_0x9109('0x1d')],function(_0x255616){return{'model':db[_0x255616[_0x9109('0x1e')]],'as':_0x255616['as'],'attributes':_0x255616[_0x9109('0x1c')],'include':_0x255616[_0x9109('0x1d')]?_[_0x9109('0x1f')](_0x255616['include'],function(_0x1d0d42){return{'model':db[_0x1d0d42[_0x9109('0x1e')]],'as':_0x1d0d42['as'],'attributes':_0x1d0d42[_0x9109('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9109('0x20')](function(_0x18f9b9){logger[_0x9109('0xe')](_0x9109('0x23'),_0x4d9f72);logger[_0x9109('0x22')](_0x9109('0x23'),_0x4d9f72,JSON[_0x9109('0x12')](_0x18f9b9));_0x49c31d(_0x18f9b9);})[_0x9109('0x17')](function(_0x5996dd){logger['error'](_0x9109('0x23'),_0x5996dd['message'],_0x4d9f72);_0x1b798e(_0x11c7d2['error'](0x1f4,_0x5996dd[_0x9109('0x15')]));});});}; \ No newline at end of file +var _0x689e=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','ShowTrigger','find','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x2c0109,_0x491b4c){var _0x1203e4=function(_0x40a651){while(--_0x40a651){_0x2c0109['push'](_0x2c0109['shift']());}};_0x1203e4(++_0x491b4c);}(_0x689e,0x126));var _0xe689=function(_0x3a2575,_0x456f90){_0x3a2575=_0x3a2575-0x0;var _0x4c822e=_0x689e[_0x3a2575];return _0x4c822e;};'use strict';var _=require('lodash');var util=require(_0xe689('0x0'));var moment=require(_0xe689('0x1'));var BPromise=require(_0xe689('0x2'));var rs=require(_0xe689('0x3'));var fs=require('fs');var Redis=require(_0xe689('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe689('0x5'))(_0xe689('0x6'));var config=require(_0xe689('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe689('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37cef1,_0x4f9d53,_0x371d9b){return new BPromise(function(_0x390cf4,_0x350e74){return client[_0xe689('0x9')](_0x37cef1,_0x371d9b)[_0xe689('0xa')](function(_0xb54963){logger[_0xe689('0xb')](_0xe689('0xc'),_0x4f9d53,_0xe689('0xd'));logger[_0xe689('0xe')](_0xe689('0xf'),_0x4f9d53,_0xe689('0xd'),JSON['stringify'](_0xb54963));if(_0xb54963[_0xe689('0x10')]){if(_0xb54963[_0xe689('0x10')][_0xe689('0x11')]===0x1f4){logger[_0xe689('0x10')](_0xe689('0xc'),_0x4f9d53,_0xb54963[_0xe689('0x10')][_0xe689('0x12')]);return _0x350e74(_0xb54963['error'][_0xe689('0x12')]);}logger[_0xe689('0x10')](_0xe689('0xc'),_0x4f9d53,_0xb54963[_0xe689('0x10')][_0xe689('0x12')]);return _0x390cf4(_0xb54963[_0xe689('0x10')][_0xe689('0x12')]);}else{logger[_0xe689('0xb')](_0xe689('0xc'),_0x4f9d53,_0xe689('0xd'));_0x390cf4(_0xb54963[_0xe689('0x13')]['message']);}})[_0xe689('0x14')](function(_0x1a8f3e){logger['error'](_0xe689('0xc'),_0x4f9d53,_0x1a8f3e);_0x350e74(_0x1a8f3e);});});}exports[_0xe689('0x15')]=function(_0x39301a){var _0x360954=this;return new Promise(function(_0x28e47b,_0xf60524){return db[_0xe689('0x16')]['findAll']({'raw':_0x39301a['options']?_0x39301a[_0xe689('0x17')][_0xe689('0x18')]===undefined?!![]:![]:!![],'where':_0x39301a[_0xe689('0x17')]?_0x39301a[_0xe689('0x17')][_0xe689('0x19')]||null:null,'attributes':_0x39301a[_0xe689('0x17')]?_0x39301a[_0xe689('0x17')][_0xe689('0x1a')]||null:null,'limit':_0x39301a[_0xe689('0x17')]?_0x39301a['options'][_0xe689('0x1b')]||null:null,'include':_0x39301a[_0xe689('0x17')]?_0x39301a[_0xe689('0x17')]['include']?_['map'](_0x39301a[_0xe689('0x17')][_0xe689('0x1c')],function(_0x1f391d){return{'model':db[_0x1f391d[_0xe689('0x1d')]],'as':_0x1f391d['as'],'attributes':_0x1f391d['attributes'],'include':_0x1f391d[_0xe689('0x1c')]?_[_0xe689('0x1e')](_0x1f391d['include'],function(_0x5b1dcf){return{'model':db[_0x5b1dcf[_0xe689('0x1d')]],'as':_0x5b1dcf['as'],'attributes':_0x5b1dcf[_0xe689('0x1a')],'include':_0x5b1dcf[_0xe689('0x1c')]?_[_0xe689('0x1e')](_0x5b1dcf[_0xe689('0x1c')],function(_0x398c61){return{'model':db[_0x398c61[_0xe689('0x1d')]],'as':_0x398c61['as'],'attributes':_0x398c61[_0xe689('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe689('0xa')](function(_0x35abc9){logger[_0xe689('0xb')](_0xe689('0x15'),_0x39301a);logger[_0xe689('0xe')](_0xe689('0x15'),_0x39301a,JSON['stringify'](_0x35abc9));_0x28e47b(_0x35abc9);})[_0xe689('0x14')](function(_0x9a5058){logger[_0xe689('0x10')]('GetTrigger',_0x9a5058[_0xe689('0x12')],_0x39301a);_0xf60524(_0x360954['error'](0x1f4,_0x9a5058[_0xe689('0x12')]));});});};exports[_0xe689('0x1f')]=function(_0xcfa10c){var _0x1944a9=this;return new Promise(function(_0x4538ef,_0x5f4ce9){return db[_0xe689('0x16')][_0xe689('0x20')]({'raw':_0xcfa10c[_0xe689('0x17')]?_0xcfa10c['options'][_0xe689('0x18')]===undefined?!![]:![]:!![],'where':_0xcfa10c[_0xe689('0x17')]?_0xcfa10c[_0xe689('0x17')]['where']||null:null,'attributes':_0xcfa10c[_0xe689('0x17')]?_0xcfa10c['options'][_0xe689('0x1a')]||null:null,'include':_0xcfa10c[_0xe689('0x17')]?_0xcfa10c[_0xe689('0x17')][_0xe689('0x1c')]?_[_0xe689('0x1e')](_0xcfa10c[_0xe689('0x17')][_0xe689('0x1c')],function(_0x7edaa8){return{'model':db[_0x7edaa8[_0xe689('0x1d')]],'as':_0x7edaa8['as'],'attributes':_0x7edaa8['attributes'],'include':_0x7edaa8['include']?_[_0xe689('0x1e')](_0x7edaa8[_0xe689('0x1c')],function(_0x3d6de0){return{'model':db[_0x3d6de0[_0xe689('0x1d')]],'as':_0x3d6de0['as'],'attributes':_0x3d6de0['attributes'],'include':_0x3d6de0[_0xe689('0x1c')]?_[_0xe689('0x1e')](_0x3d6de0[_0xe689('0x1c')],function(_0x4fc316){return{'model':db[_0x4fc316['model']],'as':_0x4fc316['as'],'attributes':_0x4fc316['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bd8d6){logger['info']('ShowTrigger',_0xcfa10c);logger[_0xe689('0xe')](_0xe689('0x1f'),_0xcfa10c,JSON[_0xe689('0x21')](_0x5bd8d6));_0x4538ef(_0x5bd8d6);})['catch'](function(_0x2da1f8){logger[_0xe689('0x10')](_0xe689('0x1f'),_0x2da1f8[_0xe689('0x12')],_0xcfa10c);_0x5f4ce9(_0x1944a9[_0xe689('0x10')](0x1f4,_0x2da1f8['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index efc10b7..88ff760 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 _0xf6e0=['isAuthenticated','index','get','/:id','post','/:id/clone','clone','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0xf6e0,0x9a));var _0x0f6e=function(_0x3b11d0,_0x43cc28){_0x3b11d0=_0x3b11d0-0x0;var _0x29f83d=_0xf6e0[_0x3b11d0];return _0x29f83d;};'use strict';var multer=require(_0x0f6e('0x0'));var util=require('util');var path=require(_0x0f6e('0x1'));var timeout=require(_0x0f6e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0f6e('0x3'));var auth=require(_0x0f6e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f6e('0x5'));var controller=require('./trunk.controller');router['get']('/',auth[_0x0f6e('0x6')](),controller[_0x0f6e('0x7')]);router[_0x0f6e('0x8')](_0x0f6e('0x9'),auth[_0x0f6e('0x6')](),controller['show']);router[_0x0f6e('0xa')](_0x0f6e('0xb'),auth[_0x0f6e('0x6')](),controller[_0x0f6e('0xc')]);router[_0x0f6e('0xa')]('/',auth[_0x0f6e('0x6')](),controller['create']);router['put'](_0x0f6e('0x9'),auth['isAuthenticated'](),controller[_0x0f6e('0xd')]);router[_0x0f6e('0xe')](_0x0f6e('0x9'),auth['isAuthenticated'](),controller[_0x0f6e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x780d=['update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put'];(function(_0x4e9c66,_0x38ecd5){var _0x3f0eb3=function(_0x344a49){while(--_0x344a49){_0x4e9c66['push'](_0x4e9c66['shift']());}};_0x3f0eb3(++_0x38ecd5);}(_0x780d,0x71));var _0xd780=function(_0x31e147,_0x146784){_0x31e147=_0x31e147-0x0;var _0x4fead9=_0x780d[_0x31e147];return _0x4fead9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd780('0x0'));var timeout=require(_0xd780('0x1'));var express=require(_0xd780('0x2'));var router=express[_0xd780('0x3')]();var fs_extra=require(_0xd780('0x4'));var auth=require(_0xd780('0x5'));var interaction=require(_0xd780('0x6'));var config=require(_0xd780('0x7'));var controller=require(_0xd780('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd780('0x9')]);router[_0xd780('0xa')](_0xd780('0xb'),auth[_0xd780('0xc')](),controller[_0xd780('0xd')]);router[_0xd780('0xe')](_0xd780('0xf'),auth[_0xd780('0xc')](),controller[_0xd780('0x10')]);router['post']('/',auth[_0xd780('0xc')](),controller[_0xd780('0x11')]);router[_0xd780('0x12')]('/:id',auth[_0xd780('0xc')](),controller[_0xd780('0x13')]);router[_0xd780('0x14')](_0xd780('0xb'),auth[_0xd780('0xc')](),controller['destroy']);module[_0xd780('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6124c88..ec32881 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 _0x0802=['active','passive','actpass','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','INTEGER','uac','uas','fingerprint','certificate'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x0802,0x117));var _0x2080=function(_0x4ee651,_0xe3dfe3){_0x4ee651=_0x4ee651-0x0;var _0x351f0e=_0x0802[_0x4ee651];return _0x351f0e;};'use strict';var Sequelize=require(_0x2080('0x0'));module[_0x2080('0x1')]={'name':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'unique':_0x2080('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2080('0x4'),_0x2080('0x5'),_0x2080('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'defaultValue':_0x2080('0x7')},'callingpres':{'type':Sequelize[_0x2080('0x8')]('ALLOWED_NOT_SCREENED',_0x2080('0x9'),_0x2080('0xa'),_0x2080('0xb'),_0x2080('0xc'),_0x2080('0xd'),_0x2080('0xe'),_0x2080('0xf'))},'deny':{'type':Sequelize[_0x2080('0x2')]},'permit':{'type':Sequelize[_0x2080('0x2')]},'secret':{'type':Sequelize[_0x2080('0x2')]},'md5secret':{'type':Sequelize[_0x2080('0x2')]},'remotesecret':{'type':Sequelize[_0x2080('0x2')]},'transport':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x10'),'set':function(_0x2dc87a){this['setDataValue'](_0x2080('0x11'),_0x2dc87a?_0x2dc87a['join'](','):null);},'get':function(){return this['getDataValue'](_0x2080('0x11'))?this[_0x2080('0x12')](_0x2080('0x11'))[_0x2080('0x13')](','):null;},'comment':_0x2080('0x14')},'dtmfmode':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x15'),_0x2080('0x16'),'shortinfo',_0x2080('0x17'),_0x2080('0x18')),'defaultValue':_0x2080('0x15')},'directmedia':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x1a'),_0x2080('0x1b'),_0x2080('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2080('0x2')]},'directmediadeny':{'type':Sequelize[_0x2080('0x2')]},'nat':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x1d'),'set':function(_0x588ed2){this['setDataValue'](_0x2080('0x1e'),_0x588ed2?_0x588ed2[_0x2080('0x1f')](','):null);},'get':function(){return this[_0x2080('0x12')](_0x2080('0x1e'))?this['getDataValue']('nat')[_0x2080('0x13')](','):null;},'comment':_0x2080('0x20')},'callgroup':{'type':Sequelize[_0x2080('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2080('0x2')]},'pickupgroup':{'type':Sequelize[_0x2080('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2080('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2080('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2080('0x2')],'defaultValue':_0x2080('0x21')},'allow':{'type':Sequelize[_0x2080('0x2')],'allowNull':![],'defaultValue':_0x2080('0x22'),'set':function(_0x5c052c){this[_0x2080('0x23')]('allow',_0x5c052c?_0x5c052c[_0x2080('0x1f')](';'):_0x2080('0x22'));},'get':function(){return this[_0x2080('0x12')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x2080('0x24')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2080('0x25'),'set':function(_0x1bacae){this[_0x2080('0x23')](_0x2080('0x26'),_0x1bacae?_0x1bacae['join'](','):null);},'get':function(){return this[_0x2080('0x12')]('insecure')?this[_0x2080('0x12')](_0x2080('0x26'))['split'](','):null;},'comment':_0x2080('0x27')},'trustrpid':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2080('0x8')]('yes','no',_0x2080('0x28'))},'promiscredir':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2080('0x29')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no'),'defaultValue':_0x2080('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2080('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2080('0x2')]},'session_timers':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x2b'),_0x2080('0x2c'),_0x2080('0x2d'))},'session_expires':{'type':Sequelize[_0x2080('0x2e')](0xb)},'session_minse':{'type':Sequelize[_0x2080('0x2e')](0xb)},'session_refresher':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x2f'),_0x2080('0x30')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2080('0x2')]},'fromdomain':{'type':Sequelize[_0x2080('0x2')]},'fromuser':{'type':Sequelize[_0x2080('0x2')]},'port':{'type':Sequelize[_0x2080('0x2e')](0x5)},'qualify':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':_0x2080('0x19')},'keepalive':{'type':Sequelize[_0x2080('0x2e')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2080('0x2')]},'rtptimeout':{'type':Sequelize[_0x2080('0x2e')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2080('0x2e')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2080('0x2e')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2080('0x2')]},'callbackextension':{'type':Sequelize[_0x2080('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2080('0x2e')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2080('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2080('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2080('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2080('0x2')]},'maxforwards':{'type':Sequelize[_0x2080('0x2e')](0xb)},'encryption':{'type':Sequelize[_0x2080('0x8')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'force_avp':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2080('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x2080('0x8')]('yes','no',_0x2080('0x31'),_0x2080('0x32'))},'dtlsrekey':{'type':Sequelize[_0x2080('0x2e')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2080('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2080('0x2')]},'dtlscipher':{'type':Sequelize[_0x2080('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2080('0x2')]},'dtlssetup':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x33'),_0x2080('0x34'),_0x2080('0x35')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2080('0x2')]},'usereqphone':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2080('0x2')]},'recordofffeature':{'type':Sequelize[_0x2080('0x2')]},'call_limit':{'type':Sequelize[_0x2080('0x2e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x2080('0x8')]('yes','no')},'vmexten':{'type':Sequelize[_0x2080('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x2080('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2080('0x8')](_0x2080('0x19'),'no',_0x2080('0x1a'),_0x2080('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2080('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2080('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfa38=['uac','uas','pai','fingerprint','certificate','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate'];(function(_0x593cbe,_0x517511){var _0x463d2a=function(_0x32d054){while(--_0x32d054){_0x593cbe['push'](_0x593cbe['shift']());}};_0x463d2a(++_0x517511);}(_0xfa38,0x77));var _0x8fa3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfa38[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x8fa3('0x0'));module[_0x8fa3('0x1')]={'name':{'type':Sequelize[_0x8fa3('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x4'),'user',_0x8fa3('0x5')),'allowNull':![],'defaultValue':_0x8fa3('0x4')},'context':{'type':Sequelize[_0x8fa3('0x2')],'allowNull':![],'defaultValue':_0x8fa3('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x8fa3('0x7'),_0x8fa3('0x8'),_0x8fa3('0x9'),_0x8fa3('0xa'),_0x8fa3('0xb'),_0x8fa3('0xc'),_0x8fa3('0xd'),_0x8fa3('0xe'))},'deny':{'type':Sequelize[_0x8fa3('0x2')]},'permit':{'type':Sequelize[_0x8fa3('0x2')]},'secret':{'type':Sequelize[_0x8fa3('0x2')]},'md5secret':{'type':Sequelize[_0x8fa3('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x8fa3('0x2')],'defaultValue':_0x8fa3('0xf'),'set':function(_0x1357ed){this[_0x8fa3('0x10')](_0x8fa3('0x11'),_0x1357ed?_0x1357ed[_0x8fa3('0x12')](','):null);},'get':function(){return this[_0x8fa3('0x13')]('transport')?this[_0x8fa3('0x13')](_0x8fa3('0x11'))[_0x8fa3('0x14')](','):null;},'comment':_0x8fa3('0x15')},'dtmfmode':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x16'),'info',_0x8fa3('0x17'),'inband',_0x8fa3('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no',_0x8fa3('0x1a'),_0x8fa3('0x1b'),_0x8fa3('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8fa3('0x2')]},'directmediadeny':{'type':Sequelize[_0x8fa3('0x2')]},'nat':{'type':Sequelize[_0x8fa3('0x2')],'defaultValue':_0x8fa3('0x1d'),'set':function(_0x9cea63){this['setDataValue'](_0x8fa3('0x1e'),_0x9cea63?_0x9cea63[_0x8fa3('0x12')](','):null);},'get':function(){return this[_0x8fa3('0x13')](_0x8fa3('0x1e'))?this['getDataValue'](_0x8fa3('0x1e'))[_0x8fa3('0x14')](','):null;},'comment':_0x8fa3('0x1f')},'callgroup':{'type':Sequelize[_0x8fa3('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8fa3('0x2')]},'pickupgroup':{'type':Sequelize[_0x8fa3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8fa3('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x8fa3('0x20')},'allow':{'type':Sequelize[_0x8fa3('0x2')],'allowNull':![],'defaultValue':_0x8fa3('0x21'),'set':function(_0x322e53){this['setDataValue'](_0x8fa3('0x22'),_0x322e53?_0x322e53[_0x8fa3('0x12')](';'):_0x8fa3('0x21'));},'get':function(){return this[_0x8fa3('0x13')](_0x8fa3('0x22'))?this[_0x8fa3('0x13')](_0x8fa3('0x22'))[_0x8fa3('0x14')](';'):null;},'comment':_0x8fa3('0x23')},'autoframing':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'insecure':{'type':Sequelize[_0x8fa3('0x2')],'defaultValue':_0x8fa3('0x24'),'set':function(_0x221036){this[_0x8fa3('0x10')]('insecure',_0x221036?_0x221036['join'](','):null);},'get':function(){return this[_0x8fa3('0x13')](_0x8fa3('0x25'))?this[_0x8fa3('0x13')](_0x8fa3('0x25'))['split'](','):null;},'comment':_0x8fa3('0x26')},'trustrpid':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no',_0x8fa3('0x27'))},'promiscredir':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x8fa3('0x2')]},'callerid':{'type':Sequelize[_0x8fa3('0x2')],'defaultValue':_0x8fa3('0x28')},'amaflags':{'type':Sequelize[_0x8fa3('0x2')]},'callcounter':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x8fa3('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no',_0x8fa3('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x2b'),_0x8fa3('0x2c'),_0x8fa3('0x2d'))},'session_expires':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x2e'),_0x8fa3('0x2f')),'defaultValue':_0x8fa3('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0x8fa3('0x2')]},'regexten':{'type':Sequelize[_0x8fa3('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x8fa3('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':_0x8fa3('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x8fa3('0x2')]},'defaultuser':{'type':Sequelize[_0x8fa3('0x2')]},'rtptimeout':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no',_0x8fa3('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8fa3('0x2')]},'callbackextension':{'type':Sequelize[_0x8fa3('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8fa3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8fa3('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x8fa3('0x29')](0xb)},'encryption':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no')},'icesupport':{'type':Sequelize[_0x8fa3('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x8fa3('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no',_0x8fa3('0x31'),_0x8fa3('0x32'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x8fa3('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x8fa3('0x2')]},'dtlscipher':{'type':Sequelize[_0x8fa3('0x2')]},'dtlscafile':{'type':Sequelize[_0x8fa3('0x2')]},'dtlscapath':{'type':Sequelize[_0x8fa3('0x2')]},'dtlssetup':{'type':Sequelize[_0x8fa3('0x3')]('active','passive',_0x8fa3('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8fa3('0x2')]},'usereqphone':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8fa3('0x2')]},'call_limit':{'type':Sequelize[_0x8fa3('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no')},'vmexten':{'type':Sequelize[_0x8fa3('0x2')]},'mohinterpret':{'type':Sequelize[_0x8fa3('0x2')]},'mohsuggest':{'type':Sequelize[_0x8fa3('0x2')]},'parkinglot':{'type':Sequelize[_0x8fa3('0x2')]},'description':{'type':Sequelize[_0x8fa3('0x2')]},'host':{'type':Sequelize[_0x8fa3('0x2')],'defaultValue':_0x8fa3('0x34')},'canreinvite':{'type':Sequelize[_0x8fa3('0x3')](_0x8fa3('0x19'),'no',_0x8fa3('0x1a'),_0x8fa3('0x1b'),_0x8fa3('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8fa3('0x2')]},'otherFields':{'type':Sequelize[_0x8fa3('0x2')]},'active':{'type':Sequelize[_0x8fa3('0x36')],'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 d6da867..5070668 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x151583,_0x4ee353){var _0x36661c=function(_0x37889a){while(--_0x37889a){_0x151583['push'](_0x151583['shift']());}};_0x36661c(++_0x4ee353);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5f1885,_0x4bc2e6){_0x5f1885=_0x5f1885-0x0;var _0x51c92b=_0x8ef6[_0x5f1885];return _0x51c92b;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x3726e8,_0x16fb90){var _0x37ec42=function(_0x474c27){while(--_0x474c27){_0x3726e8['push'](_0x3726e8['shift']());}};_0x37ec42(++_0x16fb90);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1026fc,_0x2154ea){_0x1026fc=_0x1026fc-0x0;var _0x3752ca=_0x6f0d[_0x1026fc];return _0x3752ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e7b798d..4bf34e9 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 _0x7ff7=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x572b48,_0x59136f){var _0x20891c=function(_0x5ec467){while(--_0x5ec467){_0x572b48['push'](_0x572b48['shift']());}};_0x20891c(++_0x59136f);}(_0x7ff7,0xf3));var _0x77ff=function(_0x5fdb22,_0x24aaf9){_0x5fdb22=_0x5fdb22-0x0;var _0xaa6d7e=_0x7ff7[_0x5fdb22];return _0xaa6d7e;};'use strict';var _=require(_0x77ff('0x0'));var util=require(_0x77ff('0x1'));var logger=require(_0x77ff('0x2'))(_0x77ff('0x3'));var moment=require(_0x77ff('0x4'));var BPromise=require(_0x77ff('0x5'));var rp=require(_0x77ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77ff('0x7'));var config=require(_0x77ff('0x8'));var attributes=require('./trunk.attributes');module[_0x77ff('0x9')]=function(_0x320c4f,_0x1d00ff){return _0x320c4f[_0x77ff('0xa')](_0x77ff('0xb'),attributes,{'tableName':_0x77ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e09=['../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x30ebbc,_0x481b0f){var _0x2fd850=function(_0xbf7c65){while(--_0xbf7c65){_0x30ebbc['push'](_0x30ebbc['shift']());}};_0x2fd850(++_0x481b0f);}(_0x9e09,0x191));var _0x99e0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9e09[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x99e0('0x0'));var util=require('util');var logger=require(_0x99e0('0x1'))('api');var moment=require(_0x99e0('0x2'));var BPromise=require(_0x99e0('0x3'));var rp=require(_0x99e0('0x4'));var fs=require('fs');var path=require(_0x99e0('0x5'));var rimraf=require(_0x99e0('0x6'));var config=require(_0x99e0('0x7'));var attributes=require(_0x99e0('0x8'));module['exports']=function(_0x54781f,_0x38c130){return _0x54781f[_0x99e0('0x9')](_0x99e0('0xa'),attributes,{'tableName':_0x99e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 425ef48..677da5d 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 _0x0157=['options','raw','where','attributes','limit','include','model','map','catch','ShowTrunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetTrunk','Trunk'];(function(_0x4f380b,_0x5ce6ea){var _0x3958bf=function(_0x11437a){while(--_0x11437a){_0x4f380b['push'](_0x4f380b['shift']());}};_0x3958bf(++_0x5ce6ea);}(_0x0157,0xf9));var _0x7015=function(_0x594966,_0x50d223){_0x594966=_0x594966-0x0;var _0x186138=_0x0157[_0x594966];return _0x186138;};'use strict';var _=require(_0x7015('0x0'));var util=require('util');var moment=require(_0x7015('0x1'));var BPromise=require(_0x7015('0x2'));var rs=require(_0x7015('0x3'));var fs=require('fs');var Redis=require(_0x7015('0x4'));var db=require(_0x7015('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7015('0x6'))(_0x7015('0x7'));var config=require(_0x7015('0x8'));var jayson=require(_0x7015('0x9'));var client=jayson[_0x7015('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37d143,_0x4a2931,_0x3d06fc){return new BPromise(function(_0x43b84e,_0x46db77){return client[_0x7015('0xb')](_0x37d143,_0x3d06fc)[_0x7015('0xc')](function(_0x232eed){logger[_0x7015('0xd')](_0x7015('0xe'),_0x4a2931,_0x7015('0xf'));logger[_0x7015('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4a2931,_0x7015('0xf'),JSON[_0x7015('0x11')](_0x232eed));if(_0x232eed[_0x7015('0x12')]){if(_0x232eed['error']['code']===0x1f4){logger[_0x7015('0x12')]('Trunk,\x20%s,\x20%s',_0x4a2931,_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);return _0x46db77(_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);}logger[_0x7015('0x12')](_0x7015('0xe'),_0x4a2931,_0x232eed[_0x7015('0x12')]['message']);return _0x43b84e(_0x232eed[_0x7015('0x12')][_0x7015('0x13')]);}else{logger[_0x7015('0xd')](_0x7015('0xe'),_0x4a2931,_0x7015('0xf'));_0x43b84e(_0x232eed[_0x7015('0x14')][_0x7015('0x13')]);}})['catch'](function(_0x30625e){logger[_0x7015('0x12')](_0x7015('0xe'),_0x4a2931,_0x30625e);_0x46db77(_0x30625e);});});}exports[_0x7015('0x15')]=function(_0x1156f8){var _0x330b12=this;return new Promise(function(_0x41ee98,_0x5bf7e1){return db[_0x7015('0x16')]['findAll']({'raw':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x18')]===undefined?!![]:![]:!![],'where':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x19')]||null:null,'attributes':_0x1156f8[_0x7015('0x17')]?_0x1156f8['options'][_0x7015('0x1a')]||null:null,'limit':_0x1156f8['options']?_0x1156f8['options'][_0x7015('0x1b')]||null:null,'include':_0x1156f8[_0x7015('0x17')]?_0x1156f8[_0x7015('0x17')][_0x7015('0x1c')]?_['map'](_0x1156f8[_0x7015('0x17')]['include'],function(_0x276fad){return{'model':db[_0x276fad[_0x7015('0x1d')]],'as':_0x276fad['as'],'attributes':_0x276fad[_0x7015('0x1a')],'include':_0x276fad[_0x7015('0x1c')]?_['map'](_0x276fad[_0x7015('0x1c')],function(_0x5866dc){return{'model':db[_0x5866dc[_0x7015('0x1d')]],'as':_0x5866dc['as'],'attributes':_0x5866dc[_0x7015('0x1a')],'include':_0x5866dc[_0x7015('0x1c')]?_[_0x7015('0x1e')](_0x5866dc['include'],function(_0x4454a6){return{'model':db[_0x4454a6[_0x7015('0x1d')]],'as':_0x4454a6['as'],'attributes':_0x4454a6[_0x7015('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b217){logger['info']('GetTrunk',_0x1156f8);logger[_0x7015('0x10')](_0x7015('0x15'),_0x1156f8,JSON[_0x7015('0x11')](_0x20b217));_0x41ee98(_0x20b217);})[_0x7015('0x1f')](function(_0xf982df){logger['error'](_0x7015('0x15'),_0xf982df[_0x7015('0x13')],_0x1156f8);_0x5bf7e1(_0x330b12['error'](0x1f4,_0xf982df['message']));});});};exports[_0x7015('0x20')]=function(_0x51cb57){var _0x4013b0=this;return new Promise(function(_0xd61dc7,_0x31c569){return db['Trunk'][_0x7015('0x21')]({'raw':_0x51cb57[_0x7015('0x17')]?_0x51cb57['options'][_0x7015('0x18')]===undefined?!![]:![]:!![],'where':_0x51cb57[_0x7015('0x17')]?_0x51cb57[_0x7015('0x17')][_0x7015('0x19')]||null:null,'attributes':_0x51cb57['options']?_0x51cb57[_0x7015('0x17')][_0x7015('0x1a')]||null:null,'include':_0x51cb57['options']?_0x51cb57['options']['include']?_[_0x7015('0x1e')](_0x51cb57[_0x7015('0x17')][_0x7015('0x1c')],function(_0x5efa9e){return{'model':db[_0x5efa9e[_0x7015('0x1d')]],'as':_0x5efa9e['as'],'attributes':_0x5efa9e['attributes'],'include':_0x5efa9e['include']?_[_0x7015('0x1e')](_0x5efa9e[_0x7015('0x1c')],function(_0x18976b){return{'model':db[_0x18976b[_0x7015('0x1d')]],'as':_0x18976b['as'],'attributes':_0x18976b[_0x7015('0x1a')],'include':_0x18976b[_0x7015('0x1c')]?_[_0x7015('0x1e')](_0x18976b['include'],function(_0x391507){return{'model':db[_0x391507[_0x7015('0x1d')]],'as':_0x391507['as'],'attributes':_0x391507[_0x7015('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7015('0xc')](function(_0x32d0b4){logger[_0x7015('0xd')]('ShowTrunk',_0x51cb57);logger[_0x7015('0x10')]('ShowTrunk',_0x51cb57,JSON['stringify'](_0x32d0b4));_0xd61dc7(_0x32d0b4);})[_0x7015('0x1f')](function(_0x225ec3){logger['error'](_0x7015('0x20'),_0x225ec3[_0x7015('0x13')],_0x51cb57);_0x31c569(_0x4013b0[_0x7015('0x12')](0x1f4,_0x225ec3['message']));});});}; \ No newline at end of file +var _0x5464=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','find','ShowTrunk','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','request','then'];(function(_0x154ea1,_0x7032c7){var _0xf34639=function(_0x1985d0){while(--_0x1985d0){_0x154ea1['push'](_0x154ea1['shift']());}};_0xf34639(++_0x7032c7);}(_0x5464,0x171));var _0x4546=function(_0x5e1d83,_0x23aed0){_0x5e1d83=_0x5e1d83-0x0;var _0x1b68bb=_0x5464[_0x5e1d83];return _0x1b68bb;};'use strict';var _=require('lodash');var util=require(_0x4546('0x0'));var moment=require(_0x4546('0x1'));var BPromise=require('bluebird');var rs=require(_0x4546('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4546('0x4'));var config=require(_0x4546('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xda0e05,_0x88efd3,_0x96817c){return new BPromise(function(_0x4cfdf2,_0x520076){return client[_0x4546('0x6')](_0xda0e05,_0x96817c)[_0x4546('0x7')](function(_0x43446e){logger['info'](_0x4546('0x8'),_0x88efd3,_0x4546('0x9'));logger[_0x4546('0xa')](_0x4546('0xb'),_0x88efd3,_0x4546('0x9'),JSON[_0x4546('0xc')](_0x43446e));if(_0x43446e[_0x4546('0xd')]){if(_0x43446e[_0x4546('0xd')]['code']===0x1f4){logger[_0x4546('0xd')]('Trunk,\x20%s,\x20%s',_0x88efd3,_0x43446e[_0x4546('0xd')][_0x4546('0xe')]);return _0x520076(_0x43446e[_0x4546('0xd')][_0x4546('0xe')]);}logger[_0x4546('0xd')](_0x4546('0x8'),_0x88efd3,_0x43446e[_0x4546('0xd')][_0x4546('0xe')]);return _0x4cfdf2(_0x43446e[_0x4546('0xd')][_0x4546('0xe')]);}else{logger[_0x4546('0xf')](_0x4546('0x8'),_0x88efd3,_0x4546('0x9'));_0x4cfdf2(_0x43446e['result'][_0x4546('0xe')]);}})[_0x4546('0x10')](function(_0x3be9b9){logger['error'](_0x4546('0x8'),_0x88efd3,_0x3be9b9);_0x520076(_0x3be9b9);});});}exports[_0x4546('0x11')]=function(_0x588345){var _0x33f1af=this;return new Promise(function(_0x572c17,_0x3512c9){return db[_0x4546('0x12')]['findAll']({'raw':_0x588345[_0x4546('0x13')]?_0x588345[_0x4546('0x13')][_0x4546('0x14')]===undefined?!![]:![]:!![],'where':_0x588345[_0x4546('0x13')]?_0x588345[_0x4546('0x13')][_0x4546('0x15')]||null:null,'attributes':_0x588345[_0x4546('0x13')]?_0x588345[_0x4546('0x13')][_0x4546('0x16')]||null:null,'limit':_0x588345[_0x4546('0x13')]?_0x588345['options'][_0x4546('0x17')]||null:null,'include':_0x588345['options']?_0x588345[_0x4546('0x13')]['include']?_['map'](_0x588345[_0x4546('0x13')][_0x4546('0x18')],function(_0x1d74c1){return{'model':db[_0x1d74c1[_0x4546('0x19')]],'as':_0x1d74c1['as'],'attributes':_0x1d74c1[_0x4546('0x16')],'include':_0x1d74c1[_0x4546('0x18')]?_[_0x4546('0x1a')](_0x1d74c1['include'],function(_0x478d3a){return{'model':db[_0x478d3a['model']],'as':_0x478d3a['as'],'attributes':_0x478d3a[_0x4546('0x16')],'include':_0x478d3a['include']?_['map'](_0x478d3a[_0x4546('0x18')],function(_0x1f0ad9){return{'model':db[_0x1f0ad9[_0x4546('0x19')]],'as':_0x1f0ad9['as'],'attributes':_0x1f0ad9[_0x4546('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21988f){logger[_0x4546('0xf')](_0x4546('0x11'),_0x588345);logger['debug']('GetTrunk',_0x588345,JSON[_0x4546('0xc')](_0x21988f));_0x572c17(_0x21988f);})['catch'](function(_0xd1e238){logger[_0x4546('0xd')](_0x4546('0x11'),_0xd1e238[_0x4546('0xe')],_0x588345);_0x3512c9(_0x33f1af['error'](0x1f4,_0xd1e238['message']));});});};exports['ShowTrunk']=function(_0x37b6df){var _0x364470=this;return new Promise(function(_0xbf94ce,_0xe06e19){return db[_0x4546('0x12')][_0x4546('0x1b')]({'raw':_0x37b6df[_0x4546('0x13')]?_0x37b6df[_0x4546('0x13')][_0x4546('0x14')]===undefined?!![]:![]:!![],'where':_0x37b6df['options']?_0x37b6df['options'][_0x4546('0x15')]||null:null,'attributes':_0x37b6df[_0x4546('0x13')]?_0x37b6df[_0x4546('0x13')][_0x4546('0x16')]||null:null,'include':_0x37b6df[_0x4546('0x13')]?_0x37b6df[_0x4546('0x13')]['include']?_[_0x4546('0x1a')](_0x37b6df[_0x4546('0x13')]['include'],function(_0x242ade){return{'model':db[_0x242ade['model']],'as':_0x242ade['as'],'attributes':_0x242ade[_0x4546('0x16')],'include':_0x242ade[_0x4546('0x18')]?_[_0x4546('0x1a')](_0x242ade['include'],function(_0xb882d){return{'model':db[_0xb882d[_0x4546('0x19')]],'as':_0xb882d['as'],'attributes':_0xb882d[_0x4546('0x16')],'include':_0xb882d[_0x4546('0x18')]?_[_0x4546('0x1a')](_0xb882d['include'],function(_0x305b7b){return{'model':db[_0x305b7b['model']],'as':_0x305b7b['as'],'attributes':_0x305b7b[_0x4546('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4546('0x7')](function(_0x410e94){logger['info'](_0x4546('0x1c'),_0x37b6df);logger[_0x4546('0xa')]('ShowTrunk',_0x37b6df,JSON[_0x4546('0xc')](_0x410e94));_0xbf94ce(_0x410e94);})['catch'](function(_0x2127c2){logger['error'](_0x4546('0x1c'),_0x2127c2[_0x4546('0xe')],_0x37b6df);_0xe06e19(_0x364470[_0x4546('0xd')](0x1f4,_0x2127c2['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f38d3ec..e5e32c0 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 _0x4da8=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x1dd385,_0x3610ec){var _0x1f0a4a=function(_0x15ebd0){while(--_0x15ebd0){_0x1dd385['push'](_0x1dd385['shift']());}};_0x1f0a4a(++_0x3610ec);}(_0x4da8,0x197));var _0x84da=function(_0x1cad56,_0x454803){_0x1cad56=_0x1cad56-0x0;var _0x552e0b=_0x4da8[_0x1cad56];return _0x552e0b;};'use strict';var express=require(_0x84da('0x0'));var router=express['Router']();var auth=require(_0x84da('0x1'));var controller=require(_0x84da('0x2'));router[_0x84da('0x3')](_0x84da('0x4'),auth[_0x84da('0x5')](),controller[_0x84da('0x6')]);module[_0x84da('0x7')]=router; \ No newline at end of file +var _0x6035=['./user-setting.controller','/:id','isAuthenticated','update','exports','Router','../../components/auth/service'];(function(_0x45f1e4,_0x25cf61){var _0x1de51d=function(_0x10907c){while(--_0x10907c){_0x45f1e4['push'](_0x45f1e4['shift']());}};_0x1de51d(++_0x25cf61);}(_0x6035,0x18d));var _0x5603=function(_0x2ed289,_0x3b8426){_0x2ed289=_0x2ed289-0x0;var _0x467bde=_0x6035[_0x2ed289];return _0x467bde;};'use strict';var express=require('express');var router=express[_0x5603('0x0')]();var auth=require(_0x5603('0x1'));var controller=require(_0x5603('0x2'));router['put'](_0x5603('0x3'),auth[_0x5603('0x4')](),controller[_0x5603('0x5')]);module[_0x5603('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 6dee0f5..4716218 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 _0x1b23=['ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x37ab65,_0x2e824d){var _0x5a7ea8=function(_0x10c08c){while(--_0x10c08c){_0x37ab65['push'](_0x37ab65['shift']());}};_0x5a7ea8(++_0x2e824d);}(_0x1b23,0x1e5));var _0x31b2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1b23[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x31b2('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x31b2('0x1'),_0x31b2('0x2'),_0x31b2('0x3'),_0x31b2('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x31b2('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x31b2('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x31b2('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x31b2('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x31b2('0x8')],'unique':_0x31b2('0x9')}}; \ No newline at end of file +var _0xd64f=['warning','info','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error'];(function(_0x16460a,_0x1962ce){var _0x1b274b=function(_0x59fc1a){while(--_0x59fc1a){_0x16460a['push'](_0x16460a['shift']());}};_0x1b274b(++_0x1962ce);}(_0xd64f,0x1f3));var _0xfd64=function(_0x3082e2,_0x37cdcf){_0x3082e2=_0x3082e2-0x0;var _0x450368=_0xd64f[_0x3082e2];return _0x450368;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xfd64('0x0'),_0xfd64('0x1'),_0xfd64('0x2'),'debug'];module[_0xfd64('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfd64('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfd64('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfd64('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfd64('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfd64('0x8')],'unique':_0xfd64('0x9')}}; \ 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 1997167..28afbeb 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 _0xa588=['ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','name','send','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa588,0xe1));var _0x8a58=function(_0x31de3d,_0x3e858e){_0x31de3d=_0x31de3d-0x0;var _0x3e717a=_0xa588[_0x31de3d];return _0x3e717a;};'use strict';var _=require('lodash');var Redis=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var config=require(_0x8a58('0x3'));var db=require(_0x8a58('0x4'))['db'];var socket=require(_0x8a58('0x5'))(new Redis(config[_0x8a58('0x6')]));require(_0x8a58('0x7'))[_0x8a58('0x8')](socket);config['redis']=_[_0x8a58('0x9')](config[_0x8a58('0x6')],{'host':_0x8a58('0xa'),'port':0x18eb});function respondWithResult(_0x35d5ad,_0xe0af18){_0xe0af18=_0xe0af18||0xc8;return function(_0x140f99){if(_0x140f99){return _0x35d5ad[_0x8a58('0xb')](_0xe0af18)[_0x8a58('0xc')](_0x140f99);}};}function saveUpdates(_0x49acb3){return function(_0x336276){if(_0x336276){return _0x336276[_0x8a58('0xd')](_0x49acb3)[_0x8a58('0xe')](function(_0x214351){return _0x214351;});}return null;};}function handleEntityNotFound(_0x1a43e3){return function(_0x4eab6a){if(!_0x4eab6a){_0x1a43e3[_0x8a58('0xf')](0x194);}return _0x4eab6a;};}function handleError(_0x469d66,_0x143805){_0x143805=_0x143805||0x1f4;return function(_0x290c17){logger['error'](_0x290c17['stack']);if(_0x290c17[_0x8a58('0x10')]){delete _0x290c17['name'];}_0x469d66[_0x8a58('0xb')](_0x143805)[_0x8a58('0x11')](_0x290c17);};}exports['update']=function(_0xf98b8d,_0x15b0d2){if(_0xf98b8d['user'][_0x8a58('0x12')]!==_0x8a58('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0xf98b8d[_0x8a58('0x14')]['id'])))throw new Error(_0x8a58('0x15'));return db[_0x8a58('0x16')][_0x8a58('0x17')]({'where':{'id':_0xf98b8d[_0x8a58('0x14')]['id']}})[_0x8a58('0xe')](handleEntityNotFound(_0x15b0d2,null))[_0x8a58('0xe')](saveUpdates(_0xf98b8d['body'],null))['then'](respondWithResult(_0x15b0d2,null))[_0x8a58('0x18')](handleError(_0x15b0d2,null));}; \ No newline at end of file +var _0x8c25=['update','then','sendStatus','error','name','send','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status'];(function(_0x1a48ed,_0x25ed85){var _0x3e2975=function(_0x3dc48c){while(--_0x3dc48c){_0x1a48ed['push'](_0x1a48ed['shift']());}};_0x3e2975(++_0x25ed85);}(_0x8c25,0x15e));var _0x58c2=function(_0x321fe4,_0x195b10){_0x321fe4=_0x321fe4-0x0;var _0x5655ab=_0x8c25[_0x321fe4];return _0x5655ab;};'use strict';var _=require(_0x58c2('0x0'));var Redis=require(_0x58c2('0x1'));var logger=require(_0x58c2('0x2'))(_0x58c2('0x3'));var config=require(_0x58c2('0x4'));var db=require(_0x58c2('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x58c2('0x6')]));require('./user-setting.socket')['register'](socket);config['redis']=_[_0x58c2('0x7')](config['redis'],{'host':_0x58c2('0x8'),'port':0x18eb});function respondWithResult(_0x4be512,_0x5f3536){_0x5f3536=_0x5f3536||0xc8;return function(_0x331863){if(_0x331863){return _0x4be512[_0x58c2('0x9')](_0x5f3536)['json'](_0x331863);}};}function saveUpdates(_0x3fa02e){return function(_0x13f737){if(_0x13f737){return _0x13f737[_0x58c2('0xa')](_0x3fa02e)[_0x58c2('0xb')](function(_0x208e78){return _0x208e78;});}return null;};}function handleEntityNotFound(_0x269465){return function(_0x32f05c){if(!_0x32f05c){_0x269465[_0x58c2('0xc')](0x194);}return _0x32f05c;};}function handleError(_0x4f1dfc,_0x1727f3){_0x1727f3=_0x1727f3||0x1f4;return function(_0x1854ae){logger[_0x58c2('0xd')](_0x1854ae['stack']);if(_0x1854ae[_0x58c2('0xe')]){delete _0x1854ae[_0x58c2('0xe')];}_0x4f1dfc[_0x58c2('0x9')](_0x1727f3)[_0x58c2('0xf')](_0x1854ae);};}exports[_0x58c2('0xa')]=function(_0x248bd9,_0x317830){if(_0x248bd9[_0x58c2('0x10')][_0x58c2('0x11')]!==_0x58c2('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x248bd9['params']['id'])))throw new Error(_0x58c2('0x13'));return db[_0x58c2('0x14')][_0x58c2('0x15')]({'where':{'id':_0x248bd9[_0x58c2('0x16')]['id']}})[_0x58c2('0xb')](handleEntityNotFound(_0x317830,null))['then'](saveUpdates(_0x248bd9[_0x58c2('0x17')],null))[_0x58c2('0xb')](respondWithResult(_0x317830,null))['catch'](handleError(_0x317830,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 ee58678..b2a515c 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 _0x49d6=['UserSetting','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46e9dd,_0x1c3a1c){var _0xfe5a27=function(_0x419eaa){while(--_0x419eaa){_0x46e9dd['push'](_0x46e9dd['shift']());}};_0xfe5a27(++_0x1c3a1c);}(_0x49d6,0xee));var _0x649d=function(_0x31c2c8,_0x49a32b){_0x31c2c8=_0x31c2c8-0x0;var _0x468426=_0x49d6[_0x31c2c8];return _0x468426;};'use strict';var EventEmitter=require(_0x649d('0x0'));var UserSetting=require(_0x649d('0x1'))['db'][_0x649d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x649d('0x3'),'afterDestroy':_0x649d('0x4')};function emitEvent(_0x1d6f8b){return function(_0x5a7f46,_0x13e0ce,_0x53ccf3){UserSettingEvents['emit'](_0x1d6f8b+':'+_0x5a7f46['id'],_0x5a7f46);UserSettingEvents['emit'](_0x1d6f8b,_0x5a7f46);_0x53ccf3(null);};}for(var e in events){if(events[_0x649d('0x5')](e)){var event=events[e];UserSetting[_0x649d('0x6')](e,emitEvent(event));}}module[_0x649d('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xd855=['UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd855,0xff));var _0x5d85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd855[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x5d85('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x5d85('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5d85('0x2')](0x0);var events={'afterCreate':_0x5d85('0x3'),'afterUpdate':'update','afterDestroy':_0x5d85('0x4')};function emitEvent(_0x3af6e0){return function(_0x3f84e0,_0x15ffc0,_0x593121){UserSettingEvents[_0x5d85('0x5')](_0x3af6e0+':'+_0x3f84e0['id'],_0x3f84e0);UserSettingEvents[_0x5d85('0x5')](_0x3af6e0,_0x3f84e0);_0x593121(null);};}for(var e in events){if(events[_0x5d85('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x5d85('0x7')]=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 e3f6c93..82530e9 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 _0xefe3=['./user-setting.attributes','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x12bfdf,_0x53e41d){var _0x4ce841=function(_0x323e62){while(--_0x323e62){_0x12bfdf['push'](_0x12bfdf['shift']());}};_0x4ce841(++_0x53e41d);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x3efe('0x0'));module['exports']=function(_0x5b1924){return _0x5b1924['define'](_0x3efe('0x1'),attributes,{'tableName':_0x3efe('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28c2d6){if(!_0x28c2d6[_0x3efe('0x3')])_0x28c2d6['clientSideLoggingEnabledSince']=null;else if(_0x28c2d6[_0x3efe('0x4')]===null)_0x28c2d6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x3a25=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x3a25,0x15d));var _0x53a2=function(_0x2929af,_0x8e7366){_0x2929af=_0x2929af-0x0;var _0x4acde2=_0x3a25[_0x2929af];return _0x4acde2;};'use strict';var attributes=require(_0x53a2('0x0'));module[_0x53a2('0x1')]=function(_0x200e41){return _0x200e41[_0x53a2('0x2')](_0x53a2('0x3'),attributes,{'tableName':_0x53a2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x119389){if(!_0x119389[_0x53a2('0x5')])_0x119389[_0x53a2('0x6')]=null;else if(_0x119389[_0x53a2('0x6')]===null)_0x119389[_0x53a2('0x6')]=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 8972221..0fe1263 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 _0x0cf1=['emit','length','./user-setting.events','remove','update','user-setting:update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0cf1,0xb0));var _0x10cf=function(_0x1b780c,_0x241b93){_0x1b780c=_0x1b780c-0x0;var _0x4c2b0d=_0x0cf1[_0x1b780c];return _0x4c2b0d;};'use strict';var UserSettingEvents=require(_0x10cf('0x0'));var events=['save',_0x10cf('0x1'),_0x10cf('0x2')];function createListener(_0x47ed2c,_0x52d5be){return function(_0x32efc4){_0x52d5be['emit'](_0x47ed2c,_0x32efc4);if(_0x47ed2c===_0x10cf('0x3')){_0x52d5be[_0x10cf('0x4')]('user-setting:update:user-'+_0x32efc4['UserId'],_0x32efc4);}};}exports['register']=function(_0x5097d8){for(var _0x543af9=0x0,_0x5e2051=events[_0x10cf('0x5')];_0x543af9<_0x5e2051;_0x543af9++){var _0x33aca3=events[_0x543af9];var _0x1ae1fb=createListener('user-setting:'+_0x33aca3,_0x5097d8);UserSettingEvents['on'](_0x33aca3,_0x1ae1fb);}}; \ No newline at end of file +var _0x315d=['register','length','remove','update','emit','user-setting:update','UserId'];(function(_0x6b9ab1,_0x34e628){var _0x4e3f2a=function(_0x3f63b1){while(--_0x3f63b1){_0x6b9ab1['push'](_0x6b9ab1['shift']());}};_0x4e3f2a(++_0x34e628);}(_0x315d,0xb1));var _0xd315=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x315d[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xd315('0x0'),_0xd315('0x1')];function createListener(_0x3606d7,_0x14a877){return function(_0x5c308e){_0x14a877[_0xd315('0x2')](_0x3606d7,_0x5c308e);if(_0x3606d7===_0xd315('0x3')){_0x14a877[_0xd315('0x2')]('user-setting:update:user-'+_0x5c308e[_0xd315('0x4')],_0x5c308e);}};}exports[_0xd315('0x5')]=function(_0x51b3cc){for(var _0x40354e=0x0,_0x4a5a2f=events[_0xd315('0x6')];_0x40354e<_0x4a5a2f;_0x40354e++){var _0x391ff6=events[_0x40354e];var _0x4754b1=createListener('user-setting:'+_0x391ff6,_0x51b3cc);UserSettingEvents['on'](_0x391ff6,_0x4754b1);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3ae6c2f..ab5b245 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 _0xb11e=['createApiKey','put','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/fax_accounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','/describe','get','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb11e,0x7d));var _0xeb11=function(_0x3b7554,_0x2e36e5){_0x3b7554=_0x3b7554-0x0;var _0x58f1d3=_0xb11e[_0x3b7554];return _0x58f1d3;};'use strict';var multer=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var path=require(_0xeb11('0x2'));var timeout=require(_0xeb11('0x3'));var express=require(_0xeb11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb11('0x5'));var interaction=require(_0xeb11('0x6'));var config=require(_0xeb11('0x7'));var controller=require(_0xeb11('0x8'));router['get']('/',auth[_0xeb11('0x9')](),controller['index']);router['get'](_0xeb11('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xeb11('0xb')](_0xeb11('0xc'),auth[_0xeb11('0x9')](),controller['whoami']);router[_0xeb11('0xb')](_0xeb11('0xd'),auth[_0xeb11('0x9')](),controller[_0xeb11('0xe')]);router[_0xeb11('0xb')](_0xeb11('0xf'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x10')]);router['get'](_0xeb11('0x11'),controller[_0xeb11('0x12')]);router[_0xeb11('0xb')]('/:id/open_tabs',auth[_0xeb11('0x9')](),controller['getOpenTabs']);router[_0xeb11('0xb')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xeb11('0x13')]);router[_0xeb11('0xb')](_0xeb11('0x14'),auth[_0xeb11('0x9')](),controller['getQueues']);router['get'](_0xeb11('0x15'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x16')]);router['get'](_0xeb11('0x17'),auth['isAuthenticated'](),controller[_0xeb11('0x18')]);router[_0xeb11('0xb')](_0xeb11('0x19'),auth['isAuthenticated'](),controller[_0xeb11('0x1a')]);router[_0xeb11('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xeb11('0x1b')]);router[_0xeb11('0xb')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1c')]);router[_0xeb11('0xb')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1d')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xeb11('0x1e')]);router[_0xeb11('0xb')]('/:id/sms/interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x1f')]);router['get'](_0xeb11('0x20'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x21')]);router['get'](_0xeb11('0x22'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xeb11('0xb')](_0xeb11('0x23'),auth[_0xeb11('0x9')](),controller['getTeams']);router['get'](_0xeb11('0x24'),auth['isAuthenticated'](),controller[_0xeb11('0x25')]);router[_0xeb11('0xb')](_0xeb11('0x26'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x27')]);router['get'](_0xeb11('0x28'),auth[_0xeb11('0x9')](),controller['getVoicePrefixes']);router[_0xeb11('0xb')]('/:id/fax_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x29')]);router[_0xeb11('0xb')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x2b')]);router[_0xeb11('0xb')](_0xeb11('0x2c'),auth[_0xeb11('0x9')](),controller['getOpenchannelAccounts']);router[_0xeb11('0xb')]('/:id/sms_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x2d')]);router[_0xeb11('0xb')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xeb11('0x2e')]);router[_0xeb11('0xb')](_0xeb11('0x2f'),auth[_0xeb11('0x9')](),controller['getWhatsappAccounts']);router[_0xeb11('0xb')](_0xeb11('0x30'),auth[_0xeb11('0x9')](),controller['getScheduledCalls']);router[_0xeb11('0xb')]('/:id/api_key',auth[_0xeb11('0x9')](),controller['getApiKey']);router[_0xeb11('0x31')](_0xeb11('0x32'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x33')]);router[_0xeb11('0x31')]('/',auth[_0xeb11('0x9')](),controller[_0xeb11('0x34')]);router['post'](_0xeb11('0x35'),auth['isAuthenticated'](),controller[_0xeb11('0x36')]);router['post'](_0xeb11('0x14'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x37')]);var upload=multer({'storage':multer[_0xeb11('0x38')]({'destination':function(_0x53a811,_0x149431,_0x22f116){_0x22f116(null,path[_0xeb11('0x39')](config[_0xeb11('0x3a')],_0xeb11('0x3b')));},'filename':function(_0x5ba5b6,_0x320afc,_0x3a462a){_0x3a462a(null,util[_0xeb11('0x3c')](_0xeb11('0x3d'),Date[_0xeb11('0x3e')](),_0x320afc[_0xeb11('0x3f')]));}})});router[_0xeb11('0x31')](_0xeb11('0x11'),upload[_0xeb11('0x40')]('file'),controller[_0xeb11('0x41')]);router['post'](_0xeb11('0x42'),auth[_0xeb11('0x9')](),controller['login']);router['post'](_0xeb11('0x43'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x44')]);router[_0xeb11('0x31')]('/:id/pause',auth[_0xeb11('0x9')](),controller[_0xeb11('0x45')]);router[_0xeb11('0x31')](_0xeb11('0x46'),auth['isAuthenticated'](),controller['unpause']);router[_0xeb11('0x31')]('/:id/teams',auth[_0xeb11('0x9')](),controller[_0xeb11('0x47')]);router[_0xeb11('0x31')](_0xeb11('0x48'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x49')]);router['post']('/:id/mail_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x4a')]);router[_0xeb11('0x31')]('/:id/fax_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x4b')]);router[_0xeb11('0x31')](_0xeb11('0x4c'),auth[_0xeb11('0x9')](),controller['addSmsInteractions']);router['post'](_0xeb11('0x4d'),auth['isAuthenticated'](),controller[_0xeb11('0x4e')]);router[_0xeb11('0x31')](_0xeb11('0x4f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x50')]);router[_0xeb11('0x31')]('/:id/fax_accounts',auth[_0xeb11('0x9')](),controller[_0xeb11('0x51')]);router[_0xeb11('0x31')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller['addMailAccounts']);router[_0xeb11('0x31')](_0xeb11('0x2c'),auth['isAuthenticated'](),controller[_0xeb11('0x52')]);router[_0xeb11('0x31')](_0xeb11('0x53'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x54')]);router['post']('/:id/chat_websites',auth[_0xeb11('0x9')](),controller['addChatWebsites']);router[_0xeb11('0x31')](_0xeb11('0x2f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x55')]);router['post'](_0xeb11('0x56'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x57')]);router[_0xeb11('0x58')](_0xeb11('0xf'),auth['isAuthenticated'](),controller['update']);router['put'](_0xeb11('0x59'),auth[_0xeb11('0x9')](),controller['changePassword']);router['delete'](_0xeb11('0x14'),auth['isAuthenticated'](),controller[_0xeb11('0x5a')]);router[_0xeb11('0x5b')](_0xeb11('0x23'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5c')]);router[_0xeb11('0x5b')](_0xeb11('0xf'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5d')]);router[_0xeb11('0x5b')](_0xeb11('0x48'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x5e')]);router[_0xeb11('0x5b')](_0xeb11('0x5f'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x60')]);router[_0xeb11('0x5b')]('/:id/fax_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x61')]);router[_0xeb11('0x5b')]('/:id/sms_interactions',auth[_0xeb11('0x9')](),controller[_0xeb11('0x62')]);router[_0xeb11('0x5b')](_0xeb11('0x4d'),auth['isAuthenticated'](),controller[_0xeb11('0x63')]);router[_0xeb11('0x5b')](_0xeb11('0x4f'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xeb11('0x5b')](_0xeb11('0x64'),auth[_0xeb11('0x9')](),controller['removeFaxAccounts']);router[_0xeb11('0x5b')](_0xeb11('0x2a'),auth[_0xeb11('0x9')](),controller['removeMailAccounts']);router[_0xeb11('0x5b')](_0xeb11('0x2c'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x65')]);router['delete'](_0xeb11('0x53'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x66')]);router[_0xeb11('0x5b')](_0xeb11('0x67'),auth[_0xeb11('0x9')](),controller[_0xeb11('0x68')]);router[_0xeb11('0x5b')](_0xeb11('0x2f'),auth['isAuthenticated'](),controller[_0xeb11('0x69')]);router[_0xeb11('0x5b')](_0xeb11('0x56'),auth['isAuthenticated'](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x5c68=['/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','getPresence','/:id','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','addContacts','post','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions'];(function(_0x511acc,_0x3a6081){var _0x2fede6=function(_0x2bf7c9){while(--_0x2bf7c9){_0x511acc['push'](_0x511acc['shift']());}};_0x2fede6(++_0x3a6081);}(_0x5c68,0x1e9));var _0x85c6=function(_0x2f590c,_0x45fa8d){_0x2f590c=_0x2f590c-0x0;var _0x17f83d=_0x5c68[_0x2f590c];return _0x17f83d;};'use strict';var multer=require(_0x85c6('0x0'));var util=require(_0x85c6('0x1'));var path=require(_0x85c6('0x2'));var timeout=require(_0x85c6('0x3'));var express=require(_0x85c6('0x4'));var router=express[_0x85c6('0x5')]();var fs_extra=require(_0x85c6('0x6'));var auth=require(_0x85c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x85c6('0x8'));var controller=require(_0x85c6('0x9'));router[_0x85c6('0xa')]('/',auth[_0x85c6('0xb')](),controller[_0x85c6('0xc')]);router[_0x85c6('0xa')](_0x85c6('0xd'),auth[_0x85c6('0xb')](),controller['describe']);router[_0x85c6('0xa')](_0x85c6('0xe'),auth[_0x85c6('0xb')](),controller['whoami']);router[_0x85c6('0xa')]('/presence',auth[_0x85c6('0xb')](),controller[_0x85c6('0xf')]);router[_0x85c6('0xa')](_0x85c6('0x10'),auth[_0x85c6('0xb')](),controller['show']);router[_0x85c6('0xa')]('/:id/avatar',controller['getAvatar']);router[_0x85c6('0xa')](_0x85c6('0x11'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x12')]);router['get'](_0x85c6('0x13'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x14')]);router[_0x85c6('0xa')](_0x85c6('0x15'),auth['isAuthenticated'](),controller[_0x85c6('0x16')]);router[_0x85c6('0xa')](_0x85c6('0x17'),auth['isAuthenticated'](),controller[_0x85c6('0x18')]);router[_0x85c6('0xa')](_0x85c6('0x19'),auth['isAuthenticated'](),controller[_0x85c6('0x1a')]);router[_0x85c6('0xa')]('/:id/recordings',auth[_0x85c6('0xb')](),controller['getRecordings']);router[_0x85c6('0xa')]('/:id/screen_recordings',auth[_0x85c6('0xb')](),controller[_0x85c6('0x1b')]);router[_0x85c6('0xa')](_0x85c6('0x1c'),auth['isAuthenticated'](),controller[_0x85c6('0x1d')]);router[_0x85c6('0xa')](_0x85c6('0x1e'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x1f')]);router[_0x85c6('0xa')]('/:id/mail/interactions',auth[_0x85c6('0xb')](),controller['getMailInteractions']);router[_0x85c6('0xa')](_0x85c6('0x20'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x21')]);router['get'](_0x85c6('0x22'),auth['isAuthenticated'](),controller[_0x85c6('0x23')]);router[_0x85c6('0xa')](_0x85c6('0x24'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x25')]);router['get'](_0x85c6('0x26'),auth['isAuthenticated'](),controller[_0x85c6('0x27')]);router['get']('/:id/lists',auth[_0x85c6('0xb')](),controller[_0x85c6('0x28')]);router[_0x85c6('0xa')]('/:id/agents',auth[_0x85c6('0xb')](),controller[_0x85c6('0x29')]);router[_0x85c6('0xa')]('/:id/prefixes',auth[_0x85c6('0xb')](),controller['getVoicePrefixes']);router[_0x85c6('0xa')](_0x85c6('0x2a'),auth['isAuthenticated'](),controller[_0x85c6('0x2b')]);router[_0x85c6('0xa')](_0x85c6('0x2c'),auth[_0x85c6('0xb')](),controller['getMailAccounts']);router[_0x85c6('0xa')](_0x85c6('0x2d'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x2e')]);router[_0x85c6('0xa')](_0x85c6('0x2f'),auth[_0x85c6('0xb')](),controller['getSmsAccounts']);router[_0x85c6('0xa')](_0x85c6('0x30'),auth['isAuthenticated'](),controller[_0x85c6('0x31')]);router['get'](_0x85c6('0x32'),auth[_0x85c6('0xb')](),controller['getWhatsappAccounts']);router[_0x85c6('0xa')](_0x85c6('0x33'),auth['isAuthenticated'](),controller[_0x85c6('0x34')]);router[_0x85c6('0xa')]('/:id/api_key',auth[_0x85c6('0xb')](),controller['getApiKey']);router['post'](_0x85c6('0x13'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x35')]);router[_0x85c6('0x36')]('/',auth[_0x85c6('0xb')](),controller[_0x85c6('0x37')]);router[_0x85c6('0x36')](_0x85c6('0x38'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x39')]);router[_0x85c6('0x36')](_0x85c6('0x15'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49a3e0,_0x17e82d,_0x559898){_0x559898(null,path[_0x85c6('0x3b')](config[_0x85c6('0x3c')],_0x85c6('0x3d')));},'filename':function(_0x37b602,_0x1f8f55,_0x4979b9){_0x4979b9(null,util[_0x85c6('0x3e')](_0x85c6('0x3f'),Date[_0x85c6('0x40')](),_0x1f8f55[_0x85c6('0x41')]));}})});router['post'](_0x85c6('0x42'),upload[_0x85c6('0x43')](_0x85c6('0x44')),controller['addAvatar']);router[_0x85c6('0x36')](_0x85c6('0x45'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x46')]);router[_0x85c6('0x36')](_0x85c6('0x47'),auth['isAuthenticated'](),controller[_0x85c6('0x48')]);router[_0x85c6('0x36')](_0x85c6('0x49'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x4a')]);router['post'](_0x85c6('0x4b'),auth[_0x85c6('0xb')](),controller['unpause']);router['post'](_0x85c6('0x26'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x4c')]);router[_0x85c6('0x36')]('/:id/chat_interactions',auth[_0x85c6('0xb')](),controller['addChatInteractions']);router[_0x85c6('0x36')](_0x85c6('0x4d'),auth[_0x85c6('0xb')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x85c6('0xb')](),controller[_0x85c6('0x4e')]);router[_0x85c6('0x36')](_0x85c6('0x4f'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x50')]);router['post'](_0x85c6('0x51'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x52')]);router[_0x85c6('0x36')](_0x85c6('0x53'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x54')]);router[_0x85c6('0x36')](_0x85c6('0x2a'),auth['isAuthenticated'](),controller[_0x85c6('0x55')]);router[_0x85c6('0x36')](_0x85c6('0x2c'),auth['isAuthenticated'](),controller[_0x85c6('0x56')]);router[_0x85c6('0x36')](_0x85c6('0x2d'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x57')]);router[_0x85c6('0x36')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x85c6('0x58')]);router[_0x85c6('0x36')](_0x85c6('0x30'),auth[_0x85c6('0xb')](),controller['addChatWebsites']);router[_0x85c6('0x36')](_0x85c6('0x32'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x59')]);router[_0x85c6('0x36')](_0x85c6('0x5a'),auth['isAuthenticated'](),controller[_0x85c6('0x5b')]);router[_0x85c6('0x5c')](_0x85c6('0x10'),auth['isAuthenticated'](),controller[_0x85c6('0x5d')]);router[_0x85c6('0x5c')](_0x85c6('0x5e'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x5f')]);router[_0x85c6('0x60')](_0x85c6('0x15'),auth[_0x85c6('0xb')](),controller['removeQueues']);router[_0x85c6('0x60')](_0x85c6('0x26'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x61')]);router[_0x85c6('0x60')](_0x85c6('0x10'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x62')]);router[_0x85c6('0x60')](_0x85c6('0x63'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x64')]);router[_0x85c6('0x60')](_0x85c6('0x4d'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x65')]);router[_0x85c6('0x60')](_0x85c6('0x66'),auth['isAuthenticated'](),controller[_0x85c6('0x67')]);router[_0x85c6('0x60')](_0x85c6('0x4f'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x68')]);router[_0x85c6('0x60')](_0x85c6('0x51'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x69')]);router['delete'](_0x85c6('0x53'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x85c6('0x60')](_0x85c6('0x2a'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x6a')]);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x85c6('0x6b')]);router[_0x85c6('0x60')](_0x85c6('0x2d'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x6c')]);router[_0x85c6('0x60')](_0x85c6('0x2f'),auth['isAuthenticated'](),controller[_0x85c6('0x6d')]);router['delete'](_0x85c6('0x30'),auth['isAuthenticated'](),controller[_0x85c6('0x6e')]);router[_0x85c6('0x60')](_0x85c6('0x32'),auth['isAuthenticated'](),controller[_0x85c6('0x6f')]);router[_0x85c6('0x60')](_0x85c6('0x5a'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x70')]);module[_0x85c6('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6aae119..8d793b4 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 _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'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 d36cd7b..f5d2b5f 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 _0x8e7e=['Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','UserVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$like','$iLike','$notILike','$contained','firstName','phone','Contact','dialActive','getApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','token','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','VoiceQueue','inbound','flatten','col','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','http','offline','idle','unknown','ringing','voiceStatus','busy','slice','charAt','select','field','ui.','user_has_','_interactions','toString','OpenTabs','moment','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','../../mysqldb','socket.io-emitter','register','redis','defaults','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','count','limit','set','Content-Range','json','then','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','Telephones','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','send','fieldName','type','key','password','salt','where','User','query','true','include','UserSetting','userSetting','attributes','push','findAll','openTabs','rows','length','chat','dataValues','sms','fax','mail','openchannel','show','params','model','differenceBy','rawAttributes','keys','filters','intersection','fields','includeAll','options','all','update','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','QueryTypes','SELECT','from','fullname','permissions','101','102','103','113','110','104','106','107','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','VoiceMail','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','UserProfileSection','userProfileId','isEmpty','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','voicePause','interface','isValidChannel','add','toLowerCase','Queues','capitalize','QueueId','voice','online','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','channel','Unknown\x20channel','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','order','sort','pick','merge','CmList','List','Tags','color','tag','hasOwnProperty','nolimit','offset','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','mobile','loginInPause','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','forEach','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','getDataValue','Voice','upsert','TeamVoicePrefix','VoicePrefixId'];(function(_0x2f6b1f,_0x368020){var _0x5bcb88=function(_0x38b2cc){while(--_0x38b2cc){_0x2f6b1f['push'](_0x2f6b1f['shift']());}};_0x5bcb88(++_0x368020);}(_0x8e7e,0x77));var _0xe8e7=function(_0x1ae303,_0x416f2b){_0x1ae303=_0x1ae303-0x0;var _0x55ec6c=_0x8e7e[_0x1ae303];return _0x55ec6c;};'use strict';var moment=require(_0xe8e7('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe8e7('0x1'));var squel=require('squel');var jayson=require(_0xe8e7('0x2'));var Redis=require(_0xe8e7('0x3'));var authService=require(_0xe8e7('0x4'));var qs=require(_0xe8e7('0x5'));var logger=require('../../config/logger')(_0xe8e7('0x6'));var utils=require('../../config/utils');var config=require(_0xe8e7('0x7'));var licenseUtil=require(_0xe8e7('0x8'));var APIBadRequestError=require('../../errors/api')[_0xe8e7('0x9')];var APINotFoundError=require(_0xe8e7('0xa'))[_0xe8e7('0xb')];var APIHandleError=require(_0xe8e7('0xa'))['handleError'];var db=require(_0xe8e7('0xc'))['db'];var socket=require(_0xe8e7('0xd'))(new Redis(config['redis']));require('./user.socket')[_0xe8e7('0xe')](socket);config[_0xe8e7('0xf')]=_[_0xe8e7('0x10')](config[_0xe8e7('0xf')],{'host':'localhost','port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x3aa403,_0x3743c8,_0x2736e5,_0x24a37e){return new Promise(function(_0x254ffe,_0x525925){var _0x7edf41=_0x24a37e||amiClient;return _0x7edf41[_0xe8e7('0x11')](_0x3aa403,_0x2736e5)['then'](function(_0x5d923b){logger[_0xe8e7('0x12')](_0xe8e7('0x13'),_0x3743c8,_0xe8e7('0x14'));logger[_0xe8e7('0x15')](_0xe8e7('0x16'),_0x3743c8,_0xe8e7('0x14'),JSON['stringify'](_0x5d923b));if(_0x5d923b[_0xe8e7('0x17')]){if(_0x5d923b[_0xe8e7('0x17')][_0xe8e7('0x18')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x3743c8,_0x5d923b[_0xe8e7('0x17')][_0xe8e7('0x19')]);return _0x525925(_0x5d923b['error'][_0xe8e7('0x19')]);}logger[_0xe8e7('0x17')](_0xe8e7('0x13'),_0x3743c8,_0x5d923b[_0xe8e7('0x17')][_0xe8e7('0x19')]);return _0x254ffe(_0x5d923b['error']['message']);}else{logger[_0xe8e7('0x12')](_0xe8e7('0x13'),_0x3743c8,'request\x20sent');_0x254ffe(_0x5d923b[_0xe8e7('0x1a')][_0xe8e7('0x19')]);}})[_0xe8e7('0x1b')](function(_0x328f8d){logger[_0xe8e7('0x17')](_0xe8e7('0x13'),_0x3743c8,_0x328f8d);_0x525925(_0x328f8d);});});}function respondWithStatusCode(_0x585f4c,_0x588bf0){_0x588bf0=_0x588bf0||0xcc;return function(_0x473f7f){if(_0x473f7f){return _0x585f4c[_0xe8e7('0x1c')](_0x588bf0);}return _0x585f4c[_0xe8e7('0x1d')](_0x588bf0)[_0xe8e7('0x1e')]();};}function respondWithResult(_0xd2a158,_0x129990){_0x129990=_0x129990||0xc8;return function(_0x16f087){if(_0x16f087){return _0xd2a158[_0xe8e7('0x1d')](_0x129990)['json'](_0x16f087);}};}function respondWithFilteredResult(_0xff48d1,_0x42650b){return function(_0x4716af){if(_0x4716af){var _0x4a271f=typeof _0x42650b['offset']==='undefined'&&typeof _0x42650b['limit']===_0xe8e7('0x1f');var _0x59777b=_0x4716af[_0xe8e7('0x20')];var _0x9b04b4=_0x4a271f?0x0:_0x42650b['offset'];var _0x1bc7f4=_0x4a271f?_0x4716af[_0xe8e7('0x20')]:_0x42650b['offset']+_0x42650b[_0xe8e7('0x21')];var _0x3947ba;if(_0x1bc7f4>=_0x59777b){_0x1bc7f4=_0x59777b;_0x3947ba=0xc8;}else{_0x3947ba=0xce;}_0xff48d1['status'](_0x3947ba);return _0xff48d1[_0xe8e7('0x22')](_0xe8e7('0x23'),_0x9b04b4+'-'+_0x1bc7f4+'/'+_0x59777b)[_0xe8e7('0x24')](_0x4716af);}return null;};}function saveUpdates(_0x47bec1){return function(_0x5da6bf){if(_0x5da6bf){return _0x5da6bf['update'](_0x47bec1)[_0xe8e7('0x25')](function(_0x5dbe0e){if(_0x5dbe0e[_0xe8e7('0x26')]===_0xe8e7('0x27')){socket[_0xe8e7('0x28')](_0xe8e7('0x29')+_0x5dbe0e['id'],_0x5dbe0e);}return _0x5dbe0e;});}return null;};}function removeEntity(_0xb4bcec){return function(_0x24fe81){if(_0x24fe81){return _0x24fe81[_0xe8e7('0x2a')]()[_0xe8e7('0x25')](function(){var _0x506b6b=_0x24fe81[_0xe8e7('0x2b')]({'plain':!![]});if(_0x506b6b[_0xe8e7('0x26')]===_0xe8e7('0x2c'))return;var _0x459651=[{'name':_0xe8e7('0x2d'),'value':_0xe8e7('0x2e'),'ignore':!![]},{'name':_0xe8e7('0x2f'),'value':_0xe8e7('0x27'),'ignore':![]},{'name':_0xe8e7('0x30'),'value':'telephone','ignore':![]}];var _0x4d81c3=_(_0x459651)[_0xe8e7('0x31')](_0xe8e7('0x32'))[_0xe8e7('0x33')](_0xe8e7('0x34'))['value']();if(_[_0xe8e7('0x35')](_0x4d81c3,_0x506b6b['role'])){return;}var _0x536e4b=_[_0xe8e7('0x36')](_0x459651,[_0xe8e7('0x34'),_0x506b6b[_0xe8e7('0x26')]])['name'];return db[_0xe8e7('0x37')]['destroy']({'where':{'type':_0x536e4b,'resourceId':_0x506b6b['id']}})[_0xe8e7('0x25')](function(){return _0x24fe81;});})[_0xe8e7('0x25')](function(){_0xb4bcec[_0xe8e7('0x1d')](0xcc)[_0xe8e7('0x1e')]();});}};}function handleEntityNotFound(_0x5e4947){return function(_0x45e2cd){if(!_0x45e2cd){_0x5e4947[_0xe8e7('0x1c')](0x194);}return _0x45e2cd;};}function handleError(_0x4247c4,_0xccc623){_0xccc623=_0xccc623||0x1f4;return function(_0x3cdafb){logger[_0xe8e7('0x17')](_0x3cdafb[_0xe8e7('0x38')]);if(_0x3cdafb[_0xe8e7('0x39')]){delete _0x3cdafb[_0xe8e7('0x39')];}_0x4247c4[_0xe8e7('0x1d')](_0xccc623)[_0xe8e7('0x3a')](_0x3cdafb);};}exports['index']=function(_0x5f20e7,_0x53755d){var _0x35986d={},_0x299834={'count':0x0,'rows':[]};var _0x5d7202=_(db['User']['rawAttributes'])[_0xe8e7('0x33')](function(_0x4da139){return{'name':_0x4da139[_0xe8e7('0x3b')],'type':_0x4da139[_0xe8e7('0x3c')][_0xe8e7('0x3d')]};})[_0xe8e7('0x31')](function(_0x4745bb){return!_[_0xe8e7('0x35')]([_0xe8e7('0x3e'),_0xe8e7('0x3f')],_0x4745bb[_0xe8e7('0x39')]);})['value']();_0x35986d=qs['getOptions'](_0x5d7202,_0x5f20e7);var _0x3cb44a={'where':_0x35986d[_0xe8e7('0x40')]};return db[_0xe8e7('0x41')][_0xe8e7('0x20')](_0x3cb44a)[_0xe8e7('0x25')](function(_0x245fa2){_0x299834['count']=_0x245fa2;if(_0x5f20e7[_0xe8e7('0x42')]['includeAll']){_0x35986d['include']=[{'all':!![]}];}if(_0x5f20e7[_0xe8e7('0x42')]['userSetting']===_0xe8e7('0x43')){_0x35986d[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0x45')],'as':_0xe8e7('0x46')}];}if(!_[_0xe8e7('0x35')](_0x35986d[_0xe8e7('0x47')],'id')){_0x35986d['attributes'][_0xe8e7('0x48')]('id');}return db['User'][_0xe8e7('0x49')](_0x35986d);})[_0xe8e7('0x25')](function(_0x3f9645){_0x299834['rows']=_0x3f9645;if(_0x5f20e7[_0xe8e7('0x42')][_0xe8e7('0x4a')]===_0xe8e7('0x43')){var _0x174cbc=[];for(var _0x297947=0x0;_0x297947<_0x299834[_0xe8e7('0x4b')][_0xe8e7('0x4c')];_0x297947++){_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc['push'](get_open_tabs(_0xe8e7('0x4f'),_0x299834[_0xe8e7('0x4b')][_0x297947]['dataValues']));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x50'),_0x299834['rows'][_0x297947][_0xe8e7('0x4e')]));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x51'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x52'),_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));_0x174cbc['push'](get_open_tabs('whatsapp',_0x299834[_0xe8e7('0x4b')][_0x297947][_0xe8e7('0x4e')]));}return Promise['all'](_0x174cbc)['then'](function(){return _0x299834;});}else{return _0x299834;}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x53755d,_0x35986d))[_0xe8e7('0x1b')](handleError(_0x53755d,null));};exports[_0xe8e7('0x53')]=function(_0x505dcd,_0x45df42){var _0x2cde86={'raw':![],'where':{'id':_0x505dcd[_0xe8e7('0x54')]['id']}},_0x3d468f={};_0x3d468f[_0xe8e7('0x55')]=_[_0xe8e7('0x56')](_['keys'](db[_0xe8e7('0x41')][_0xe8e7('0x57')]),[_0xe8e7('0x3e'),_0xe8e7('0x3f')]);_0x3d468f['query']=_[_0xe8e7('0x58')](_0x505dcd[_0xe8e7('0x42')]);_0x3d468f[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3d468f[_0xe8e7('0x55')],_0x3d468f[_0xe8e7('0x42')]);_0x2cde86['attributes']=_[_0xe8e7('0x5a')](_0x3d468f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x2cde86['attributes']=_0x2cde86[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x2cde86['attributes']:_0x3d468f[_0xe8e7('0x55')];if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x2cde86[_0xe8e7('0x44')]=[{'all':!![]}];}if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x46')]===_0xe8e7('0x43')){_0x2cde86[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0x45')],'as':_0xe8e7('0x46')}];}_0x2cde86=_['merge']({},_0x2cde86,_0x505dcd[_0xe8e7('0x5d')]);if(!_[_0xe8e7('0x35')](_0x2cde86['attributes'],'id')){_0x2cde86[_0xe8e7('0x47')]['push']('id');}return db[_0xe8e7('0x41')][_0xe8e7('0x36')](_0x2cde86)[_0xe8e7('0x25')](handleEntityNotFound(_0x45df42,null))[_0xe8e7('0x25')](function(_0x32a688){var _0x16deb3=[];values=_0x32a688;if(_0x505dcd[_0xe8e7('0x42')][_0xe8e7('0x4a')]===_0xe8e7('0x43')){_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x32a688['dataValues']));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4f'),_0x32a688[_0xe8e7('0x4e')]));_0x16deb3[_0xe8e7('0x48')](get_open_tabs('openchannel',_0x32a688[_0xe8e7('0x4e')]));_0x16deb3['push'](get_open_tabs('whatsapp',_0x32a688[_0xe8e7('0x4e')]));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x50'),_0x32a688['dataValues']));_0x16deb3[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x51'),_0x32a688[_0xe8e7('0x4e')]));return Promise[_0xe8e7('0x5e')](_0x16deb3);}else{return values;}})['then'](function(){return values;})[_0xe8e7('0x25')](respondWithResult(_0x45df42,null))[_0xe8e7('0x1b')](handleError(_0x45df42,null));};exports[_0xe8e7('0x5f')]=function(_0x4cf499,_0x2181af){if(_0x4cf499[_0xe8e7('0x60')]['id']){delete _0x4cf499['body']['id'];}delete _0x4cf499['body'][_0xe8e7('0x26')];return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x4cf499[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x2181af,null))['then'](saveUpdates(_0x4cf499[_0xe8e7('0x60')],null))[_0xe8e7('0x25')](respondWithResult(_0x2181af,null))['catch'](handleError(_0x2181af,null));};exports['describe']=function(_0x3b4c38,_0x5bdd76){return db[_0xe8e7('0x41')][_0xe8e7('0x61')]()[_0xe8e7('0x25')](respondWithResult(_0x5bdd76,null))[_0xe8e7('0x1b')](handleError(_0x5bdd76,null));};exports[_0xe8e7('0x62')]=function(_0x3cc77c,_0x4f8a20){return db[_0xe8e7('0x41')]['find']({'where':{'id':_0x3cc77c[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f8a20,null))[_0xe8e7('0x25')](function(_0x3f259e){if(_0x3f259e){return _0x3f259e[_0xe8e7('0x62')](_0x3cc77c[_0xe8e7('0x60')][_0xe8e7('0x63')],_[_0xe8e7('0x64')](_0x3cc77c[_0xe8e7('0x60')],[_0xe8e7('0x63'),'id'])||{});}})[_0xe8e7('0x25')](respondWithResult(_0x4f8a20,null))[_0xe8e7('0x1b')](handleError(_0x4f8a20,null));};function validateUser(_0x245b44){return new Promise(function(_0x5bfec4,_0x4fdcd8){if(_0x245b44[_0xe8e7('0x65')])return _0x5bfec4(_0x245b44);return db[_0xe8e7('0x66')]['findById'](0x1)[_0xe8e7('0x25')](function(_0x9d4261){if(_0x9d4261[_0xe8e7('0x67')])authService[_0xe8e7('0x68')](_0x245b44[_0xe8e7('0x3e')]);db[_0xe8e7('0x41')][_0xe8e7('0x69')](_0xe8e7('0x65'))[_0xe8e7('0x25')](function(_0x552259){if(_['isNil'](_0x552259)){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')]||0x1;return;}if(_[_0xe8e7('0x6b')](_0x9d4261['min_internal'])||_0x9d4261['min_internal']===_0x552259){_0x245b44[_0xe8e7('0x65')]=_0x552259+0x1;return;}if(_0x9d4261['min_internal']>_0x552259){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')];return;}return db[_0xe8e7('0x6c')][_0xe8e7('0x42')]('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[_0xe8e7('0x6c')][_0xe8e7('0x6d')][_0xe8e7('0x6e')]})[_0xe8e7('0x25')](function(_0x8c02f8){if(_0x8c02f8&&_0x8c02f8[_0xe8e7('0x4c')]){for(var _0xe0e041=0x0,_0x51eebf=_0x8c02f8['length'];_0xe0e041<_0x51eebf&&_[_0xe8e7('0x6b')](_0x245b44[_0xe8e7('0x65')]);_0xe0e041++){if(_0x9d4261[_0xe8e7('0x6a')]<=_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')]){_0x245b44[_0xe8e7('0x65')]=_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')];}else if(_0x9d4261[_0xe8e7('0x6a')]>_0x8c02f8[_0xe0e041][_0xe8e7('0x6f')]&&_0x9d4261[_0xe8e7('0x6a')]<=_0x8c02f8[_0xe0e041]['to']){_0x245b44[_0xe8e7('0x65')]=_0x9d4261[_0xe8e7('0x6a')];}}}if(_['isNil'](_0x245b44[_0xe8e7('0x65')])){_0x245b44['internal']=_0x552259+0x1;}return _0x5bfec4(_0x245b44);});});})[_0xe8e7('0x1b')](function(_0x1865e1){_0x4fdcd8(_0x1865e1);});});}function updateUser(_0x2fb8ee){return new Promise(function(_0x3c504e,_0x414c68){try{if(_0x2fb8ee['voicemail']){_0x2fb8ee['mailbox']=_0x2fb8ee[_0xe8e7('0x65')];_0x2fb8ee['VoiceMail']={'mailbox':_0x2fb8ee['internal'],'password':_0x2fb8ee[_0xe8e7('0x3e')],'fullname':_0x2fb8ee[_0xe8e7('0x70')],'email':_0x2fb8ee['email']};}if(_0x2fb8ee[_0xe8e7('0x26')]===_0xe8e7('0x27')){if(!_0x2fb8ee[_0xe8e7('0x71')])_0x2fb8ee[_0xe8e7('0x71')]=[_0xe8e7('0x72'),_0xe8e7('0x73'),_0xe8e7('0x74'),_0xe8e7('0x75'),_0xe8e7('0x76'),_0xe8e7('0x77'),'105',_0xe8e7('0x78'),_0xe8e7('0x79'),_0xe8e7('0x7a'),'109',_0xe8e7('0x7b'),_0xe8e7('0x7c'),_0xe8e7('0x7d'),_0xe8e7('0x7e')];}_0x3c504e(_0x2fb8ee);}catch(_0x1d4901){_0x414c68(_0x1d4901);}});}exports[_0xe8e7('0x7f')]=function(_0x1d2695,_0x5d3b3d){if(_0x1d2695[_0xe8e7('0x2e')][_0xe8e7('0x26')]===_0xe8e7('0x27'))throw new Error(_0xe8e7('0x80'));if(_0x1d2695[_0xe8e7('0x60')][_0xe8e7('0x26')]==='user'&&_0x1d2695[_0xe8e7('0x2e')][_0xe8e7('0x26')]!=='admin'){throw new Error(_0xe8e7('0x81'));}if(_0x1d2695[_0xe8e7('0x60')]['role']===_0xe8e7('0x2c')&&_0x1d2695[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xe8e7('0x82')]([_0x1d2695[_0xe8e7('0x60')]])[_0xe8e7('0x25')](function(){return validateUser(_0x1d2695['body']);})[_0xe8e7('0x25')](function(_0x59817a){return updateUser(_0x59817a)['then'](function(_0x1fc667){if(_0x1fc667['role']===_0xe8e7('0x2c')){_0x1fc667[_0xe8e7('0x83')]=_0x1d2695['user'][_0xe8e7('0x83')];delete _0x1fc667['userProfileId'];}return _0x1fc667;});})[_0xe8e7('0x25')](function(_0x1729d7){return db[_0xe8e7('0x41')][_0xe8e7('0x7f')](_0x1729d7,{'include':[{'model':db[_0xe8e7('0x84')],'as':_0xe8e7('0x84')}]});})['then'](function(_0x5ad2be){if(_0x1d2695[_0xe8e7('0x60')][_0xe8e7('0x26')]==='user')return _0x5ad2be;if(_0x1d2695['user']['role']!==_0xe8e7('0x2e'))return _0x5ad2be;return db['UserProfileSection']['find']({'where':{'name':_0x5ad2be[_0xe8e7('0x26')]==='agent'?_0xe8e7('0x2f'):_0xe8e7('0x30'),'userProfileId':_0x1d2695['user']['userProfileId']},'raw':!![]})['then'](function(_0x319ac7){if(!_0x319ac7||_0x319ac7[_0xe8e7('0x85')]!=0x0)return _0x5ad2be;return db[_0xe8e7('0x37')][_0xe8e7('0x7f')]({'name':_0x5ad2be[_0xe8e7('0x39')],'resourceId':_0x5ad2be['id'],'type':_0x319ac7[_0xe8e7('0x39')],'sectionId':_0x319ac7['id']},{})[_0xe8e7('0x25')](function(){return _0x5ad2be;});})[_0xe8e7('0x1b')](function(_0x3e94a7){logger[_0xe8e7('0x17')](_0xe8e7('0x86'),_0x3e94a7);throw _0x3e94a7;});})[_0xe8e7('0x25')](respondWithResult(_0x5d3b3d,0xc9))[_0xe8e7('0x1b')](handleError(_0x5d3b3d,null));};exports['bulkCreate']=function(_0xee9214,_0x5a4439){var _0x8a10a3=_0xee9214[_0xe8e7('0x60')];var _0x379789=[];if(_0xee9214['user']['role']===_0xe8e7('0x27'))throw new Error(_0xe8e7('0x80'));if(_[_0xe8e7('0x87')](_0x8a10a3,['role',_0xe8e7('0x2e')])&&_0xee9214[_0xe8e7('0x2e')][_0xe8e7('0x26')]!==_0xe8e7('0x2c')){throw new Error(_0xe8e7('0x81'));}if(_[_0xe8e7('0x87')](_0x8a10a3,['role','admin'])&&_0xee9214[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2c')){throw new Error(_0xe8e7('0x88'));}return licenseUtil['checkUserLimits'](_0x8a10a3)['then'](function(){return validateUser(_0x8a10a3[0x0]);})[_0xe8e7('0x25')](function(){for(var _0x4d0d07=0x1;_0x4d0d07<_0x8a10a3[_0xe8e7('0x4c')];_0x4d0d07++){var _0x2d9541=_0x8a10a3[_0x4d0d07-0x1][_0xe8e7('0x65')];if(!_0x8a10a3[_0x4d0d07][_0xe8e7('0x65')])_0x8a10a3[_0x4d0d07][_0xe8e7('0x65')]=_0x2d9541+0x1;_0x379789[_0xe8e7('0x48')](validateUser(_0x8a10a3[_0x4d0d07]));}return Promise[_0xe8e7('0x5e')](_0x379789);})[_0xe8e7('0x25')](function(){_0x379789=[];for(var _0x5c728a=0x0;_0x5c728a<_0x8a10a3[_0xe8e7('0x4c')];_0x5c728a++){_0x379789[_0xe8e7('0x48')](updateUser(_0x8a10a3[_0x5c728a]));}return Promise[_0xe8e7('0x5e')](_0x379789);})[_0xe8e7('0x25')](function(){_0x379789=_0x8a10a3['map'](function(_0x4cb8b7){return db[_0xe8e7('0x41')][_0xe8e7('0x7f')](_0x4cb8b7,{'include':[{'model':db[_0xe8e7('0x84')],'as':'VoiceMail'}]})[_0xe8e7('0x25')](function(_0x56b40d){_0x4cb8b7['id']=_0x56b40d['id'];return _0x4cb8b7;});});return Promise['all'](_0x379789);})['then'](function(_0x194a79){if(_0xee9214[_0xe8e7('0x60')][_0xe8e7('0x26')]===_0xe8e7('0x2e'))return _0x194a79;if(_0xee9214[_0xe8e7('0x2e')]['role']!==_0xe8e7('0x2e'))return _0x194a79;var _0x556c47=_[_0xe8e7('0x87')](_0x194a79,function(_0x1b6d40){return _0x1b6d40[_0xe8e7('0x26')]===_0xe8e7('0x27')||_0x1b6d40[_0xe8e7('0x26')]===_0xe8e7('0x89');});if(!_0x556c47)return _0x194a79;return db[_0xe8e7('0x8a')][_0xe8e7('0x49')]({'where':{'name':{'$or':['Agents',_0xe8e7('0x30')]},'userProfileId':_0xee9214[_0xe8e7('0x2e')][_0xe8e7('0x8b')]},'raw':!![]})[_0xe8e7('0x25')](function(_0x120caa){if(_[_0xe8e7('0x8c')](_0x120caa)||!_[_0xe8e7('0x87')](_0x120caa,['autoAssociation',0x0]))return _0x194a79;_0x379789=[];var _0xbb1e3a=_(_0x120caa)[_0xe8e7('0x33')](function(_0x26f53d){if(_0x26f53d['autoAssociation']===0x1)return;return _0x26f53d[_0xe8e7('0x39')]==='Agents'?_0xe8e7('0x27'):_0xe8e7('0x89');})['compact']()[_0xe8e7('0x34')]();for(var _0x5202ee=0x0;_0x5202ee<_0x194a79[_0xe8e7('0x4c')];_0x5202ee++){if(!_[_0xe8e7('0x35')](_0xbb1e3a,_0x194a79[_0x5202ee]['role']))return;var _0x5c85c8=_0x194a79[_0x5202ee]['role']===_0xe8e7('0x27')?_0xe8e7('0x2f'):_0xe8e7('0x30');_0x379789[_0xe8e7('0x48')](db[_0xe8e7('0x37')][_0xe8e7('0x7f')]({'name':_0x194a79[_0x5202ee]['name'],'resourceId':_0x194a79[_0x5202ee]['id'],'type':_0x5c85c8,'sectionId':_[_0xe8e7('0x36')](_0x120caa,[_0xe8e7('0x39'),_0x5c85c8])['id']},{}));}return Promise['all'](_0x379789);});})['then'](respondWithResult(_0x5a4439,0xc9))[_0xe8e7('0x1b')](handleError(_0x5a4439,null));};exports['changePassword']=function(_0x17e4f5,_0x1ee283){if(_0x17e4f5['body']['id']){delete _0x17e4f5[_0xe8e7('0x60')]['id'];}return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x17e4f5[_0xe8e7('0x54')]['id']}})['then'](function(_0x36ec41){if(!_0x36ec41)return null;if(_0x36ec41['id']===_0x17e4f5[_0xe8e7('0x2e')]['id']){if(!_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x8d')]||!_0x17e4f5[_0xe8e7('0x60')]['newPassword']){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0x90'));}if(!_0x36ec41[_0xe8e7('0x91')](_0x17e4f5['body'][_0xe8e7('0x8d')])){throw new db[(_0xe8e7('0x8e'))]['ValidationError']('Wrong\x20credentials');}if(_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x8d')]===_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]){throw new db['Sequelize'][(_0xe8e7('0x8f'))](_0xe8e7('0x93'));}}else if(_0x17e4f5[_0xe8e7('0x2e')][_0xe8e7('0x26')]==='admin'){if(!_0x17e4f5['body'][_0xe8e7('0x92')]){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x17e4f5[_0xe8e7('0x2e')][_0xe8e7('0x26')]===_0xe8e7('0x2e')){if(!_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]){throw new db['Sequelize']['ValidationError'](_0xe8e7('0x94'));}if(_0x36ec41[_0xe8e7('0x26')]!==_0xe8e7('0x27')){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0x80'));}}else{throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Unauthorized');}return _0x36ec41;})[_0xe8e7('0x25')](handleEntityNotFound(_0x1ee283,null))[_0xe8e7('0x25')](function(_0x56e02f){return db[_0xe8e7('0x66')][_0xe8e7('0x95')]({'attributes':['id',_0xe8e7('0x67'),_0xe8e7('0x96'),_0xe8e7('0x97')]})[_0xe8e7('0x25')](function(_0x18d07b){if(_0x18d07b[_0xe8e7('0x67')])authService[_0xe8e7('0x68')](_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')]);if(!_0x18d07b[_0xe8e7('0x96')]||!_0x56e02f[_0xe8e7('0x98')])return _0x56e02f;authService[_0xe8e7('0x99')](_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')],_0x56e02f[_0xe8e7('0x98')],_0x18d07b[_0xe8e7('0x97')]);return _0x56e02f;})[_0xe8e7('0x25')](saveUpdates({'password':_0x17e4f5[_0xe8e7('0x60')][_0xe8e7('0x92')],'passwordResetAt':_0x17e4f5[_0xe8e7('0x2e')]['id']==_0x17e4f5[_0xe8e7('0x54')]['id']?moment():null,'previousPasswords':authService[_0xe8e7('0x9a')](_0x17e4f5['body'][_0xe8e7('0x92')],_0x56e02f[_0xe8e7('0x98')])},null));})[_0xe8e7('0x25')](respondWithResult(_0x1ee283,null))['catch'](handleError(_0x1ee283,null));};exports[_0xe8e7('0x9b')]=function(_0x344deb,_0x4f5303){var _0x56fd5d=_0x344deb[_0xe8e7('0x60')]['channel'];return db['User']['find']({'where':{'id':_0x344deb[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26'),'online','loginInPause',_0xe8e7('0x9c'),_0xe8e7('0x9d')]})['then'](handleEntityNotFound(_0x4f5303,null))[_0xe8e7('0x25')](function(_0x3515bc){if(_0x3515bc){if(!utils[_0xe8e7('0x9e')](_0x56fd5d)){throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))]('Unknown\x20channel');}return _0x3515bc[_0xe8e7('0x9f')+_['capitalize'](_0x56fd5d[_0xe8e7('0xa0')]())+_0xe8e7('0xa1')](_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')],{'penalty':_0x344deb[_0xe8e7('0x60')]['penalty']||0x0})['spread'](function(_0x3e4247){for(var _0x5d9613=0x0;_0x5d9613<_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')][_0xe8e7('0x4c')];_0x5d9613+=0x1){var _0x57cdab={'UserId':Number(_0x344deb[_0xe8e7('0x54')]['id'])};_0x57cdab[_[_0xe8e7('0xa2')](_0x56fd5d[_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')][_0x5d9613]);socket['emit'](_0xe8e7('0x2e')+_['capitalize'](_0x56fd5d[_0xe8e7('0xa0')]())+'Queue:save',_0x57cdab);}return _0x3e4247;})[_0xe8e7('0x25')](function(){if(_0x56fd5d===_0xe8e7('0xa4')){return db['VoiceQueue'][_0xe8e7('0x49')]({'where':{'id':_0x344deb[_0xe8e7('0x60')][_0xe8e7('0x63')]||[]},'raw':!![],'attributes':['id',_0xe8e7('0x39')]});}})[_0xe8e7('0x25')](function(_0x341001){var _0x3cc60b=_0x3515bc[_0xe8e7('0x2b')]({'plain':!![]});var _0x566d67=[];if(_0x56fd5d===_0xe8e7('0xa4')&&_0x3cc60b[_0xe8e7('0x26')]===_0xe8e7('0x27')&&_0x3cc60b[_0xe8e7('0xa5')]){for(let _0x50bf39=0x0;_0x50bf39<_0x341001[_0xe8e7('0x4c')];_0x50bf39+=0x1){_0x566d67[_0xe8e7('0x48')]({'membername':_0x3cc60b[_0xe8e7('0x39')],'UserId':_0x3cc60b['id'],'queue_name':_0x341001[_0x50bf39]['name'],'VoiceQueueId':_0x341001[_0x50bf39]['id'],'interface':_[_0xe8e7('0x6b')](_0x3cc60b['interface'])?util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x3cc60b[_0xe8e7('0x39')]):_0x3cc60b['interface'],'paused':_0x3cc60b[_0xe8e7('0x9c')]||![],'penalty':_0x344deb['body'][_0xe8e7('0xa8')]||0x0});}return Promise[_0xe8e7('0x5e')](_0x566d67[_0xe8e7('0x33')](function(_0x5ec42c){return db[_0xe8e7('0xa9')]['upsert'](_0x5ec42c);}));}return _0x3515bc;});}})[_0xe8e7('0x25')](respondWithStatusCode(_0x4f5303,null))[_0xe8e7('0x1b')](handleError(_0x4f5303,null));};exports[_0xe8e7('0xaa')]=function(_0x2051cb,_0x5f4e96){var _0x310bfd,_0x15b442;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x2051cb[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26')]})[_0xe8e7('0x25')](handleEntityNotFound(_0x5f4e96,null))[_0xe8e7('0x25')](function(_0x162ef9){if(_0x162ef9){_0x310bfd=_0x162ef9;if(!_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')]||!utils['isValidChannel'](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')])){throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xac'));}return _0x162ef9[_0xe8e7('0xad')+_[_0xe8e7('0xa2')](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+'Queues'](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]);}})['then'](function(_0x1c0cb1){if(_[_0xe8e7('0xae')](_0x2051cb[_0xe8e7('0x42')]['ids'])){for(var _0x100a0b=0x0;_0x100a0b<_0x2051cb['query'][_0xe8e7('0x63')][_0xe8e7('0x4c')];_0x100a0b+=0x1){_0x15b442={'UserId':Number(_0x2051cb[_0xe8e7('0x54')]['id'])};_0x15b442[_[_0xe8e7('0xa2')](_0x2051cb['query']['channel'][_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x2051cb['query'][_0xe8e7('0x63')][_0x100a0b]);socket['emit'](_0xe8e7('0x2e')+_[_0xe8e7('0xa2')](_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+_0xe8e7('0xaf'),_0x15b442);}}else{_0x15b442={'UserId':Number(_0x2051cb[_0xe8e7('0x54')]['id'])};_0x15b442[_[_0xe8e7('0xa2')](_0x2051cb['query']['channel'][_0xe8e7('0xa0')]())+_0xe8e7('0xa3')]=Number(_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]);socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_[_0xe8e7('0xa2')](_0x2051cb['query'][_0xe8e7('0xab')][_0xe8e7('0xa0')]())+_0xe8e7('0xaf'),_0x15b442);}return _0x1c0cb1;})[_0xe8e7('0x25')](function(){if(_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0xab')]===_0xe8e7('0xa4')){return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'UserId':_0x2051cb['params']['id'],'VoiceQueueId':_0x2051cb[_0xe8e7('0x42')][_0xe8e7('0x63')]},'individualHooks':!![]})[_0xe8e7('0x25')](function(){return _0x310bfd;});}return _0x310bfd;})[_0xe8e7('0x25')](respondWithStatusCode(_0x5f4e96,null))['catch'](handleError(_0x5f4e96,null));};exports[_0xe8e7('0xb0')]=function(_0x362c00,_0x1d9570){_0x362c00[_0xe8e7('0x60')][_0xe8e7('0xb1')]=_0x362c00[_0xe8e7('0xb2')][_0xe8e7('0xb3')];return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x362c00[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x1d9570,null))[_0xe8e7('0x25')](saveUpdates(_0x362c00['body'],null))['then'](respondWithResult(_0x1d9570,null))[_0xe8e7('0x1b')](handleError(_0x1d9570,null));};exports[_0xe8e7('0xb4')]=function(_0x4d7408,_0x382e16){var _0x3593c1=path[_0xe8e7('0xb5')](config[_0xe8e7('0xb6')],_0xe8e7('0xb7'));return db['User'][_0xe8e7('0x36')]({'where':{'id':_0x4d7408[_0xe8e7('0x54')]['id']},'attributes':['id',_0xe8e7('0xb1')],'raw':!![]})[_0xe8e7('0x25')](handleEntityNotFound(_0x382e16,null))[_0xe8e7('0x25')](function(_0x1a66b7){if(_0x1a66b7){if(_['isNil'](_0x1a66b7[_0xe8e7('0xb1')])){return _0x382e16[_0xe8e7('0xb8')](_0x3593c1);}else{if(!fs[_0xe8e7('0xb9')](path[_0xe8e7('0xb5')](config[_0xe8e7('0xb6')],_0xe8e7('0xba'),_0x1a66b7[_0xe8e7('0xb1')]))){return _0x382e16[_0xe8e7('0xb8')](_0x3593c1);}return _0x382e16[_0xe8e7('0xb8')](path[_0xe8e7('0xb5')](config['root'],'server/files/images/',_0x1a66b7[_0xe8e7('0xb1')]));}}})[_0xe8e7('0x1b')](handleError(_0x382e16,null));};exports[_0xe8e7('0xbb')]=function(_0x3d1dbd,_0x2acdab){return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x3d1dbd['params']['id']},'attributes':['id']})[_0xe8e7('0x25')](handleEntityNotFound(_0x2acdab,null))[_0xe8e7('0x25')](function(_0x1f1c41){var _0x1c01eb=[];values=_0x1f1c41[_0xe8e7('0x4e')];_0x1c01eb[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0x4d'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('sms',_0x1f1c41['dataValues']));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('openchannel',_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs(_0xe8e7('0xbc'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb['push'](get_open_tabs(_0xe8e7('0x50'),_0x1f1c41[_0xe8e7('0x4e')]));_0x1c01eb[_0xe8e7('0x48')](get_open_tabs('mail',_0x1f1c41[_0xe8e7('0x4e')]));return Promise[_0xe8e7('0x5e')](_0x1c01eb);})[_0xe8e7('0x25')](function(_0x3506cc){if(_0x3506cc){var _0x4e4e36=_[_0xe8e7('0x33')](values[_0xe8e7('0xbd')],function(_0x2df3cb){return{'channel':_0xe8e7('0xbe'),'id':_0x2df3cb['id'],'createdAt':_0x2df3cb[_0xe8e7('0xbf')]};});var _0x1e8341=_[_0xe8e7('0x33')](values[_0xe8e7('0xc0')],function(_0x4c0d01){return{'channel':_0xe8e7('0xc1'),'id':_0x4c0d01['id'],'createdAt':_0x4c0d01[_0xe8e7('0xbf')]};});var _0x15393f=_['map'](values[_0xe8e7('0xc2')],function(_0x46b7f9){return{'channel':'OPENCHANNEL','id':_0x46b7f9['id'],'createdAt':_0x46b7f9[_0xe8e7('0xbf')]};});var _0x36e462=_[_0xe8e7('0x33')](values[_0xe8e7('0xc3')],function(_0x307b03){return{'channel':_0xe8e7('0xc4'),'id':_0x307b03['id'],'createdAt':_0x307b03['createdAt']};});var _0x4d0b2f=_[_0xe8e7('0x33')](values[_0xe8e7('0xc5')],function(_0x5557de){return{'channel':_0xe8e7('0xc6'),'id':_0x5557de['id'],'createdAt':_0x5557de[_0xe8e7('0xbf')]};});var _0x27e422=_[_0xe8e7('0x33')](values[_0xe8e7('0xc7')],function(_0x110a6a){return{'channel':_0xe8e7('0xc8'),'id':_0x110a6a['id'],'createdAt':_0x110a6a['createdAt']};});var _0x4c2f0f=_[_0xe8e7('0xc9')](_0x4e4e36,_0x1e8341,_0x15393f,_0x36e462,_0x4d0b2f,_0x27e422);var _0x3b8f06={'count':_0x4c2f0f[_0xe8e7('0x4c')],'rows':_0x4c2f0f};return _0x3b8f06;}else return null;})[_0xe8e7('0x25')](respondWithResult(_0x2acdab,null))[_0xe8e7('0x1b')](handleError(_0x2acdab,null));};exports[_0xe8e7('0xca')]=function(_0x3fc96a,_0x4429a2){var _0x4e537d={};var _0x5e77f4={};var _0x80cb76;var _0x4f688e;return db['User'][_0xe8e7('0x95')]({'where':{'id':_0x3fc96a[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x4429a2,null))[_0xe8e7('0x25')](function(_0x2bbbd8){if(_0x2bbbd8){_0x80cb76=_0x2bbbd8;_0x5e77f4[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['CmContact'][_0xe8e7('0x57')]);_0x5e77f4[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x3fc96a['query']);_0x5e77f4[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x5e77f4[_0xe8e7('0x55')],_0x5e77f4['query']);_0x4e537d[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x5e77f4[_0xe8e7('0x55')],qs['fields'](_0x3fc96a[_0xe8e7('0x42')]['fields']));_0x4e537d[_0xe8e7('0x47')]=_0x4e537d[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x4e537d['attributes']:_0x5e77f4[_0xe8e7('0x55')];_0x4e537d[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3fc96a['query'][_0xe8e7('0xcc')]);_0x4e537d[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x3fc96a[_0xe8e7('0x42')],_0x5e77f4[_0xe8e7('0x59')]));if(_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x4e537d[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x4e537d[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x4e537d['attributes'],function(_0x4bb68a){var _0x67c290={};_0x67c290[_0x4bb68a]={'$like':'%'+_0x3fc96a[_0xe8e7('0x42')]['filter']+'%'};return _0x67c290;})});}_0x4e537d=_[_0xe8e7('0xce')]({},_0x4e537d,_0x3fc96a[_0xe8e7('0x5d')]);return _0x80cb76[_0xe8e7('0xca')](_0x4e537d);}})['then'](function(_0x2c8e94){if(_0x2c8e94){_0x4f688e=_0x2c8e94[_0xe8e7('0x4c')];if(_0x3fc96a['query']['hasOwnProperty']('includeAll')){_0x4e537d[_0xe8e7('0x44')]=[{'model':db[_0xe8e7('0xcf')],'as':_0xe8e7('0xd0'),'required':![]},{'model':db['Tag'],'as':_0xe8e7('0xd1'),'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0xd2')],'where':_0x3fc96a['query']['tag']?{'id':_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd3')]}:undefined,'required':_0x3fc96a['query'][_0xe8e7('0xd3')]?!![]:![]}];}if(!_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x4e537d[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x3fc96a[_0xe8e7('0x42')]['limit']);_0x4e537d[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x3fc96a[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x80cb76[_0xe8e7('0xca')](_0x4e537d);}})[_0xe8e7('0x25')](function(_0x225895){if(_0x225895){return _0x225895?{'count':_0x4f688e,'rows':_0x225895}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x4429a2,null))[_0xe8e7('0x1b')](handleError(_0x4429a2,null));};exports[_0xe8e7('0xd7')]=function(_0x1c920c,_0x4920e4){var _0x34f679;var _0x2299c7={};var _0x5a7968;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x1c920c[_0xe8e7('0x54')]['id']},'attributes':['id','name','role']})[_0xe8e7('0x25')](handleEntityNotFound(_0x4920e4,null))[_0xe8e7('0x25')](function(_0x303ae4){if(!utils[_0xe8e7('0x9e')](_0x1c920c[_0xe8e7('0x42')]['channel'])){throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xac'));}_0x34f679=_0x303ae4;var _0x2cf2b3={};_0x2cf2b3[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_[_0xe8e7('0xa2')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xab')])+_0xe8e7('0xd8')][_0xe8e7('0x57')]);_0x2cf2b3['query']=_[_0xe8e7('0x58')](_0x1c920c[_0xe8e7('0x42')]);_0x2cf2b3[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2cf2b3[_0xe8e7('0x55')],_0x2cf2b3[_0xe8e7('0x42')]);_0x2299c7['attributes']=_[_0xe8e7('0x5a')](_0x2cf2b3[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x2299c7['attributes']=_0x2299c7['attributes'][_0xe8e7('0x4c')]?_0x2299c7[_0xe8e7('0x47')]:_0x2cf2b3['model'];_0x2299c7[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x1c920c['query'][_0xe8e7('0xcc')]);_0x2299c7[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x1c920c[_0xe8e7('0x42')],_0x2cf2b3[_0xe8e7('0x59')]));if(_0x1c920c['query'][_0xe8e7('0x31')]){_0x2299c7[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2299c7[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2299c7['attributes'],function(_0x23bb99){var _0x33db56={};_0x33db56[_0x23bb99]={'$like':'%'+_0x1c920c['query'][_0xe8e7('0x31')]+'%'};return _0x33db56;})});}_0x2299c7=_[_0xe8e7('0xce')]({},_0x2299c7,_0x1c920c[_0xe8e7('0x5d')]);switch(_0x34f679[_0xe8e7('0x26')]){case _0xe8e7('0x2c'):return db[_[_0xe8e7('0xa2')](_0x1c920c['query'][_0xe8e7('0xab')])+_0xe8e7('0xd8')][_0xe8e7('0x49')](_0x2299c7);case'user':case'agent':return _0x34f679['get'+_['capitalize'](_0x1c920c['query'][_0xe8e7('0xab')])+'Queues'](_0x2299c7);default:throw new db[(_0xe8e7('0x8e'))][(_0xe8e7('0x8f'))](_0xe8e7('0xd9'));}})[_0xe8e7('0x25')](function(_0x4979b1){_0x5a7968=_0x4979b1[_0xe8e7('0x4c')];if(!_0x1c920c[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x2299c7['limit']=qs[_0xe8e7('0x21')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x2299c7[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}switch(_0x34f679[_0xe8e7('0x26')]){case'admin':return db[_[_0xe8e7('0xa2')](_0x1c920c[_0xe8e7('0x42')][_0xe8e7('0xab')])+'Queue']['findAll'](_0x2299c7);case _0xe8e7('0x2e'):case _0xe8e7('0x27'):return _0x34f679[_0xe8e7('0x2b')+_['capitalize'](_0x1c920c['query']['channel'])+'Queues'](_0x2299c7);}})[_0xe8e7('0x25')](function(_0x2b9735){return{'count':_0x5a7968,'rows':_0x2b9735};})[_0xe8e7('0x25')](respondWithResult(_0x4920e4,null))[_0xe8e7('0x1b')](handleError(_0x4920e4,null));};exports[_0xe8e7('0xda')]=function(_0x53df12,_0x36e546){var _0x705b65={};var _0x376c8f={};var _0x11e236;var _0x486b45;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x53df12[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x36e546,null))[_0xe8e7('0x25')](function(_0x46492e){if(_0x46492e){_0x11e236=_0x46492e;_0x376c8f[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xa9')]['rawAttributes']);_0x376c8f[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x53df12[_0xe8e7('0x42')]);_0x376c8f['filters']=_['intersection'](_0x376c8f[_0xe8e7('0x55')],_0x376c8f[_0xe8e7('0x42')]);_0x705b65['attributes']=_[_0xe8e7('0x5a')](_0x376c8f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x53df12[_0xe8e7('0x42')]['fields']));_0x705b65[_0xe8e7('0x47')]=_0x705b65[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x705b65[_0xe8e7('0x47')]:_0x376c8f['model'];_0x705b65[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x53df12[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x705b65[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x53df12[_0xe8e7('0x42')],_0x376c8f[_0xe8e7('0x59')]));if(_0x53df12[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x705b65[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x705b65[_0xe8e7('0x40')],{'$or':_['map'](_0x705b65[_0xe8e7('0x47')],function(_0x36b20a){var _0x1559bb={};_0x1559bb[_0x36b20a]={'$like':'%'+_0x53df12['query']['filter']+'%'};return _0x1559bb;})});}_0x705b65=_[_0xe8e7('0xce')]({},_0x705b65,_0x53df12[_0xe8e7('0x5d')]);return _0x11e236[_0xe8e7('0xda')](_0x705b65);}})[_0xe8e7('0x25')](function(_0x1154a5){if(_0x1154a5){_0x486b45=_0x1154a5[_0xe8e7('0x4c')];if(!_0x53df12[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x705b65['limit']=qs[_0xe8e7('0x21')](_0x53df12[_0xe8e7('0x42')]['limit']);_0x705b65[_0xe8e7('0xd6')]=qs['offset'](_0x53df12[_0xe8e7('0x42')]['offset']);}return _0x11e236[_0xe8e7('0xda')](_0x705b65);}})['then'](function(_0x4e1217){if(_0x4e1217){return _0x4e1217?{'count':_0x486b45,'rows':_0x4e1217}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x36e546,null))[_0xe8e7('0x1b')](handleError(_0x36e546,null));};exports['getGroups']=function(_0x2fa070,_0xe5dcdf){var _0x2c7129={};var _0xbf4de={};var _0x49a74a;var _0x281e9d;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x2fa070['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0xe5dcdf,null))[_0xe8e7('0x25')](function(_0xa0fb0f){if(_0xa0fb0f){_0x49a74a=_0xa0fb0f;_0xbf4de[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['ChatGroup']['rawAttributes']);_0xbf4de[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x2fa070[_0xe8e7('0x42')]);_0xbf4de[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0xbf4de[_0xe8e7('0x55')],_0xbf4de[_0xe8e7('0x42')]);_0x2c7129['attributes']=_['intersection'](_0xbf4de[_0xe8e7('0x55')],qs['fields'](_0x2fa070['query'][_0xe8e7('0x5b')]));_0x2c7129[_0xe8e7('0x47')]=_0x2c7129['attributes'][_0xe8e7('0x4c')]?_0x2c7129['attributes']:_0xbf4de[_0xe8e7('0x55')];_0x2c7129['order']=qs[_0xe8e7('0xcc')](_0x2fa070[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x2c7129['where']=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x2fa070['query'],_0xbf4de['filters']));if(_0x2fa070['query'][_0xe8e7('0x31')]){_0x2c7129[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2c7129[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2c7129['attributes'],function(_0x1ac8df){var _0x3ec85b={};_0x3ec85b[_0x1ac8df]={'$like':'%'+_0x2fa070[_0xe8e7('0x42')]['filter']+'%'};return _0x3ec85b;})});}_0x2c7129=_[_0xe8e7('0xce')]({},_0x2c7129,_0x2fa070['options']);return _0x49a74a['getGroups'](_0x2c7129);}})[_0xe8e7('0x25')](function(_0xc55e14){if(_0xc55e14){_0x281e9d=_0xc55e14['length'];if(!_0x2fa070[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x2c7129[_0xe8e7('0x21')]=qs['limit'](_0x2fa070[_0xe8e7('0x42')]['limit']);_0x2c7129[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x2fa070[_0xe8e7('0x42')]['offset']);}return _0x49a74a[_0xe8e7('0xdb')](_0x2c7129);}})['then'](function(_0x2612bd){if(_0x2612bd){return _0x2612bd?{'count':_0x281e9d,'rows':_0x2612bd}:null;}})[_0xe8e7('0x25')](respondWithResult(_0xe5dcdf,null))[_0xe8e7('0x1b')](handleError(_0xe5dcdf,null));};exports[_0xe8e7('0xdc')]=function(_0x5db166,_0x2e95d8){var _0x5829e5={'raw':!![],'where':{}};var _0x13bf51={};var _0x58b014={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x5db166['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x2e95d8,null))[_0xe8e7('0x25')](function(_0x5c1367){if(_0x5c1367){_0x13bf51[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db['VoiceRecording'][_0xe8e7('0x57')]);_0x13bf51[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x5db166[_0xe8e7('0x42')]);_0x13bf51[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x13bf51[_0xe8e7('0x55')],_0x13bf51[_0xe8e7('0x42')]);_0x5829e5['attributes']=_[_0xe8e7('0x5a')](_0x13bf51['model'],qs[_0xe8e7('0x5b')](_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x5829e5[_0xe8e7('0x47')]=_0x5829e5[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x5829e5[_0xe8e7('0x47')]:_0x13bf51['model'];if(!_0x5db166[_0xe8e7('0x42')][_0xe8e7('0xd4')]('nolimit')){_0x5829e5[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x5829e5['offset']=qs[_0xe8e7('0xd6')](_0x5db166['query'][_0xe8e7('0xd6')]);}_0x5829e5[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x5db166[_0xe8e7('0x42')]['sort']);_0x5829e5[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x5db166[_0xe8e7('0x42')],_0x13bf51[_0xe8e7('0x59')]));_0x5829e5[_0xe8e7('0x40')]['UserId']=_0x5c1367['id'];if(_0x5db166[_0xe8e7('0x42')]['filter']){_0x5829e5[_0xe8e7('0x40')]=_['merge'](_0x5829e5[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x5829e5[_0xe8e7('0x47')],function(_0x6a42cb){var _0x127f64={};_0x127f64[_0x6a42cb]={'$like':'%'+_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x127f64;})});}_0x5829e5=_[_0xe8e7('0xce')]({},_0x5829e5,_0x5db166[_0xe8e7('0x5d')]);return db[_0xe8e7('0xdd')][_0xe8e7('0x20')]({'where':_0x5829e5[_0xe8e7('0x40')]})[_0xe8e7('0x25')](function(_0x565556){_0x58b014['count']=_0x565556;if(_0x5db166[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x5829e5[_0xe8e7('0x44')]=[{'all':!![]}];}return db[_0xe8e7('0xdd')][_0xe8e7('0x49')](_0x5829e5);})[_0xe8e7('0x25')](function(_0x707f09){_0x58b014[_0xe8e7('0x4b')]=_0x707f09;return _0x58b014;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x2e95d8,_0x5829e5))[_0xe8e7('0x1b')](handleError(_0x2e95d8,null));};exports['getScreenRecordings']=function(_0x186e23,_0x1aefcc){var _0x40e8d2={'raw':!![],'where':{}};var _0x2e4d20={};var _0x13b200={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x186e23[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x1aefcc,null))[_0xe8e7('0x25')](function(_0x4bc3de){if(_0x4bc3de){_0x2e4d20[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xde')][_0xe8e7('0x57')]);_0x2e4d20[_0xe8e7('0x42')]=_['keys'](_0x186e23['query']);_0x2e4d20[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2e4d20[_0xe8e7('0x55')],_0x2e4d20['query']);_0x40e8d2[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x2e4d20['model'],qs[_0xe8e7('0x5b')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x40e8d2['attributes']=_0x40e8d2[_0xe8e7('0x47')]['length']?_0x40e8d2[_0xe8e7('0x47')]:_0x2e4d20['model'];if(!_0x186e23['query'][_0xe8e7('0xd4')]('nolimit')){_0x40e8d2[_0xe8e7('0x21')]=qs['limit'](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x40e8d2[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}_0x40e8d2[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x186e23[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x40e8d2[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x186e23['query'],_0x2e4d20['filters']));_0x40e8d2['where'][_0xe8e7('0xdf')]=_0x4bc3de['id'];if(_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x40e8d2['where']=_['merge'](_0x40e8d2['where'],{'$or':_['map'](_0x40e8d2['attributes'],function(_0x35e844){var _0x9c7263={};_0x9c7263[_0x35e844]={'$like':'%'+_0x186e23['query'][_0xe8e7('0x31')]+'%'};return _0x9c7263;})});}_0x40e8d2=_['merge']({},_0x40e8d2,_0x186e23[_0xe8e7('0x5d')]);return db['ScreenRecording'][_0xe8e7('0x20')]({'where':_0x40e8d2['where']})[_0xe8e7('0x25')](function(_0x321bdf){_0x13b200['count']=_0x321bdf;if(_0x186e23[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x40e8d2[_0xe8e7('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe8e7('0x49')](_0x40e8d2);})[_0xe8e7('0x25')](function(_0x4bb1f6){_0x13b200[_0xe8e7('0x4b')]=_0x4bb1f6;return _0x13b200;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x1aefcc,_0x40e8d2))['catch'](handleError(_0x1aefcc,null));};exports[_0xe8e7('0xe0')]=function(_0xaffd1b,_0x2b35b1){var _0x3bf01a={};var _0x305260={};var _0x27f4d2;var _0x53a188;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0xaffd1b[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b35b1,null))[_0xe8e7('0x25')](function(_0x34a4fa){if(_0x34a4fa){_0x27f4d2=_0x34a4fa;_0x305260[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xe1')][_0xe8e7('0x57')]);_0x305260[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0xaffd1b[_0xe8e7('0x42')]);_0x305260['filters']=_[_0xe8e7('0x5a')](_0x305260[_0xe8e7('0x55')],_0x305260[_0xe8e7('0x42')]);_0x3bf01a[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x305260[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0xaffd1b['query'][_0xe8e7('0x5b')]));_0x3bf01a[_0xe8e7('0x47')]=_0x3bf01a[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3bf01a[_0xe8e7('0x47')]:_0x305260[_0xe8e7('0x55')];_0x3bf01a[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0xaffd1b['query'][_0xe8e7('0xcc')]);_0x3bf01a[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0xaffd1b[_0xe8e7('0x42')],_0x305260[_0xe8e7('0x59')]));if(_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3bf01a[_0xe8e7('0x40')]=_['merge'](_0x3bf01a['where'],{'$or':_['map'](_0x3bf01a['attributes'],function(_0x5dbf59){var _0x4b4fc7={};_0x4b4fc7[_0x5dbf59]={'$like':'%'+_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x4b4fc7;})});}_0x3bf01a=_['merge']({},_0x3bf01a,_0xaffd1b[_0xe8e7('0x5d')]);return _0x27f4d2['getChatInteractions'](_0x3bf01a);}})['then'](function(_0x42be48){if(_0x42be48){_0x53a188=_0x42be48[_0xe8e7('0x4c')];if(!_0xaffd1b['query']['hasOwnProperty']('nolimit')){_0x3bf01a[_0xe8e7('0x21')]=qs['limit'](_0xaffd1b[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x3bf01a[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0xaffd1b[_0xe8e7('0x42')]['offset']);}return _0x27f4d2[_0xe8e7('0xe0')](_0x3bf01a);}})[_0xe8e7('0x25')](function(_0xbcbeb6){if(_0xbcbeb6){return _0xbcbeb6?{'count':_0x53a188,'rows':_0xbcbeb6}:null;}})['then'](respondWithResult(_0x2b35b1,null))['catch'](handleError(_0x2b35b1,null));};exports[_0xe8e7('0xe2')]=function(_0x2f37ae,_0x33196f){var _0x172050={};var _0x4d351d={};var _0x140203;var _0x16ee68;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x2f37ae['params']['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x33196f,null))[_0xe8e7('0x25')](function(_0x53cf30){if(_0x53cf30){_0x140203=_0x53cf30;_0x4d351d['model']=_[_0xe8e7('0x58')](db[_0xe8e7('0xe3')][_0xe8e7('0x57')]);_0x4d351d['query']=_[_0xe8e7('0x58')](_0x2f37ae[_0xe8e7('0x42')]);_0x4d351d[_0xe8e7('0x59')]=_['intersection'](_0x4d351d[_0xe8e7('0x55')],_0x4d351d[_0xe8e7('0x42')]);_0x172050[_0xe8e7('0x47')]=_['intersection'](_0x4d351d[_0xe8e7('0x55')],qs['fields'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x172050[_0xe8e7('0x47')]=_0x172050[_0xe8e7('0x47')]['length']?_0x172050[_0xe8e7('0x47')]:_0x4d351d[_0xe8e7('0x55')];_0x172050['order']=qs['sort'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x172050[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x2f37ae[_0xe8e7('0x42')],_0x4d351d['filters']));if(_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x172050[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x172050[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x172050['attributes'],function(_0x197559){var _0x59ab0a={};_0x59ab0a[_0x197559]={'$like':'%'+_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x59ab0a;})});}_0x172050=_[_0xe8e7('0xce')]({},_0x172050,_0x2f37ae['options']);return _0x140203[_0xe8e7('0xe2')](_0x172050);}})[_0xe8e7('0x25')](function(_0x56d786){if(_0x56d786){_0x16ee68=_0x56d786[_0xe8e7('0x4c')];if(!_0x2f37ae['query'][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x172050['limit']=qs['limit'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x172050['offset']=qs['offset'](_0x2f37ae[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x140203['getOpenchannelInteractions'](_0x172050);}})[_0xe8e7('0x25')](function(_0x4f6b74){if(_0x4f6b74){return _0x4f6b74?{'count':_0x16ee68,'rows':_0x4f6b74}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x33196f,null))[_0xe8e7('0x1b')](handleError(_0x33196f,null));};exports[_0xe8e7('0xe4')]=function(_0x359705,_0x3b098a){var _0x29eba4={'raw':!![],'where':{}};var _0x28be8b={};var _0x3765c7={'count':0x0,'rows':[]};return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x359705[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x3b098a,null))[_0xe8e7('0x25')](function(_0x258a9a){if(_0x258a9a){_0x28be8b[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xe5')]['rawAttributes']);_0x28be8b['query']=_['keys'](_0x359705['query']);_0x28be8b['filters']=_[_0xe8e7('0x5a')](_0x28be8b[_0xe8e7('0x55')],_0x28be8b[_0xe8e7('0x42')]);_0x29eba4[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x28be8b[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x359705[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x29eba4[_0xe8e7('0x47')]=_0x29eba4[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x29eba4[_0xe8e7('0x47')]:_0x28be8b[_0xe8e7('0x55')];if(!_0x359705[_0xe8e7('0x42')][_0xe8e7('0xd4')]('nolimit')){_0x29eba4[_0xe8e7('0x21')]=qs['limit'](_0x359705[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x29eba4[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x359705['query'][_0xe8e7('0xd6')]);}_0x29eba4[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x359705[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x29eba4[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x359705['query'],_0x28be8b[_0xe8e7('0x59')]));_0x29eba4[_0xe8e7('0x40')][_0xe8e7('0xdf')]=_0x258a9a['id'];if(_0x359705[_0xe8e7('0x42')]['filter']){_0x29eba4['where']=_[_0xe8e7('0xce')](_0x29eba4[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x29eba4[_0xe8e7('0x47')],function(_0x1499d8){var _0x40ab38={};_0x40ab38[_0x1499d8]={'$like':'%'+_0x359705[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x40ab38;})});}_0x29eba4=_[_0xe8e7('0xce')]({},_0x29eba4,_0x359705['options']);return db[_0xe8e7('0xe5')][_0xe8e7('0x20')]({'where':_0x29eba4[_0xe8e7('0x40')]})[_0xe8e7('0x25')](function(_0x315208){_0x3765c7['count']=_0x315208;if(_0x359705[_0xe8e7('0x42')][_0xe8e7('0x5c')]){_0x29eba4[_0xe8e7('0x44')]=[{'all':!![]}];}return db[_0xe8e7('0xe5')][_0xe8e7('0x49')](_0x29eba4);})['then'](function(_0x19e4ff){_0x3765c7['rows']=_0x19e4ff;return _0x3765c7;});}})[_0xe8e7('0x25')](respondWithFilteredResult(_0x3b098a,_0x29eba4))['catch'](handleError(_0x3b098a,null));};exports[_0xe8e7('0xe6')]=function(_0x3eaa45,_0x17b159){var _0x20a8a1={};var _0x3018c7={};var _0x312b89;var _0x4fccd1;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x3eaa45[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x17b159,null))[_0xe8e7('0x25')](function(_0x474a13){if(_0x474a13){_0x312b89=_0x474a13;_0x3018c7['model']=_['keys'](db[_0xe8e7('0xe7')][_0xe8e7('0x57')]);_0x3018c7['query']=_['keys'](_0x3eaa45['query']);_0x3018c7[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3018c7[_0xe8e7('0x55')],_0x3018c7['query']);_0x20a8a1[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x3018c7['model'],qs[_0xe8e7('0x5b')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x20a8a1['attributes']=_0x20a8a1[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x20a8a1[_0xe8e7('0x47')]:_0x3018c7['model'];_0x20a8a1[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x20a8a1[_0xe8e7('0x40')]=qs['filters'](_['pick'](_0x3eaa45[_0xe8e7('0x42')],_0x3018c7['filters']));if(_0x3eaa45['query'][_0xe8e7('0x31')]){_0x20a8a1[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x20a8a1[_0xe8e7('0x40')],{'$or':_['map'](_0x20a8a1['attributes'],function(_0x5e4ab4){var _0x1ec6ba={};_0x1ec6ba[_0x5e4ab4]={'$like':'%'+_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x1ec6ba;})});}_0x20a8a1=_[_0xe8e7('0xce')]({},_0x20a8a1,_0x3eaa45[_0xe8e7('0x5d')]);return _0x312b89[_0xe8e7('0xe6')](_0x20a8a1);}})['then'](function(_0x5267a3){if(_0x5267a3){_0x4fccd1=_0x5267a3[_0xe8e7('0x4c')];if(!_0x3eaa45['query'][_0xe8e7('0xd4')]('nolimit')){_0x20a8a1['limit']=qs[_0xe8e7('0x21')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0x21')]);_0x20a8a1[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x3eaa45[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x312b89[_0xe8e7('0xe6')](_0x20a8a1);}})[_0xe8e7('0x25')](function(_0x3ce287){if(_0x3ce287){return _0x3ce287?{'count':_0x4fccd1,'rows':_0x3ce287}:null;}})['then'](respondWithResult(_0x17b159,null))[_0xe8e7('0x1b')](handleError(_0x17b159,null));};exports[_0xe8e7('0xe8')]=function(_0x127a13,_0x3b4107){var _0x5145d9={};var _0x2c62f3={};var _0x162571;var _0x4b0ab9;return db[_0xe8e7('0x41')]['findOne']({'where':{'id':_0x127a13[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b4107,null))['then'](function(_0x321935){if(_0x321935){_0x162571=_0x321935;_0x2c62f3[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0xe9')][_0xe8e7('0x57')]);_0x2c62f3['query']=_[_0xe8e7('0x58')](_0x127a13['query']);_0x2c62f3[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x2c62f3['model'],_0x2c62f3[_0xe8e7('0x42')]);_0x5145d9[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x2c62f3[_0xe8e7('0x55')],qs['fields'](_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x5145d9[_0xe8e7('0x47')]=_0x5145d9[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x5145d9[_0xe8e7('0x47')]:_0x2c62f3['model'];_0x5145d9['order']=qs[_0xe8e7('0xcc')](_0x127a13[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x5145d9[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x127a13[_0xe8e7('0x42')],_0x2c62f3['filters']));if(_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x5145d9[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x5145d9[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x5145d9[_0xe8e7('0x47')],function(_0xc6d851){var _0x3fd742={};_0x3fd742[_0xc6d851]={'$like':'%'+_0x127a13[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x3fd742;})});}_0x5145d9=_['merge']({},_0x5145d9,_0x127a13[_0xe8e7('0x5d')]);return _0x162571[_0xe8e7('0xe8')](_0x5145d9);}})['then'](function(_0x43b190){if(_0x43b190){_0x4b0ab9=_0x43b190[_0xe8e7('0x4c')];if(!_0x127a13[_0xe8e7('0x42')]['hasOwnProperty']('nolimit')){_0x5145d9[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x127a13[_0xe8e7('0x42')]['limit']);_0x5145d9[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x127a13['query'][_0xe8e7('0xd6')]);}return _0x162571['getFaxInteractions'](_0x5145d9);}})[_0xe8e7('0x25')](function(_0x4ef4f3){if(_0x4ef4f3){return _0x4ef4f3?{'count':_0x4b0ab9,'rows':_0x4ef4f3}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x3b4107,null))['catch'](handleError(_0x3b4107,null));};exports[_0xe8e7('0xea')]=function(_0x3541ef,_0x5a350c){var _0x2960ba={};var _0x57af18={};var _0x599acc;var _0x42c4d3;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x3541ef[_0xe8e7('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a350c,null))[_0xe8e7('0x25')](function(_0x10db42){if(_0x10db42){_0x599acc=_0x10db42;_0x57af18[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xeb')][_0xe8e7('0x57')]);_0x57af18[_0xe8e7('0x42')]=_['keys'](_0x3541ef[_0xe8e7('0x42')]);_0x57af18[_0xe8e7('0x59')]=_['intersection'](_0x57af18[_0xe8e7('0x55')],_0x57af18['query']);_0x2960ba[_0xe8e7('0x47')]=_['intersection'](_0x57af18[_0xe8e7('0x55')],qs['fields'](_0x3541ef['query'][_0xe8e7('0x5b')]));_0x2960ba['attributes']=_0x2960ba[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x2960ba[_0xe8e7('0x47')]:_0x57af18[_0xe8e7('0x55')];_0x2960ba[_0xe8e7('0xcb')]=qs[_0xe8e7('0xcc')](_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0xcc')]);_0x2960ba[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x3541ef['query'],_0x57af18[_0xe8e7('0x59')]));if(_0x3541ef[_0xe8e7('0x42')]['filter']){_0x2960ba[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x2960ba[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x2960ba['attributes'],function(_0x34d737){var _0x5cf371={};_0x5cf371[_0x34d737]={'$like':'%'+_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x5cf371;})});}_0x2960ba=_[_0xe8e7('0xce')]({},_0x2960ba,_0x3541ef['options']);return _0x599acc[_0xe8e7('0xea')](_0x2960ba);}})[_0xe8e7('0x25')](function(_0x33ac91){if(_0x33ac91){_0x42c4d3=_0x33ac91[_0xe8e7('0x4c')];if(!_0x3541ef[_0xe8e7('0x42')]['hasOwnProperty'](_0xe8e7('0xd5'))){_0x2960ba[_0xe8e7('0x21')]=qs[_0xe8e7('0x21')](_0x3541ef[_0xe8e7('0x42')]['limit']);_0x2960ba['offset']=qs['offset'](_0x3541ef[_0xe8e7('0x42')][_0xe8e7('0xd6')]);}return _0x599acc[_0xe8e7('0xea')](_0x2960ba);}})[_0xe8e7('0x25')](function(_0x470ab1){if(_0x470ab1){return _0x470ab1?{'count':_0x42c4d3,'rows':_0x470ab1}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x5a350c,null))['catch'](handleError(_0x5a350c,null));};exports['login']=function(_0x56c7fa,_0x2e2d64,_0x677b14){var _0x165aed;var _0x1f09f8;var _0x38914a;var _0x5109ab=!_['isNil'](_0x56c7fa[_0xe8e7('0x54')]['id'])?_0x56c7fa[_0xe8e7('0x54')]['id']:!_[_0xe8e7('0x6b')](_0x56c7fa['user']['id'])?_0x56c7fa[_0xe8e7('0x2e')]['id']:null;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x5109ab,'role':{'$or':['admin',_0xe8e7('0x2e'),_0xe8e7('0x27')]}},'attributes':['id',_0xe8e7('0x39'),'phone',_0xe8e7('0xec'),'role','internal',_0xe8e7('0xed')]})[_0xe8e7('0x25')](function(_0x4e30da){if(_0x4e30da){if(_0x4e30da[_0xe8e7('0x26')]==='agent'){_0x165aed=_0x4e30da;if(_0x56c7fa[_0xe8e7('0x60')]['interface']){_0x38914a=util[_0xe8e7('0xa6')]('LOCAL/%s@from-sip/n',_0x165aed[_0x56c7fa[_0xe8e7('0x60')]['interface']]);}else if(_0x56c7fa[_0xe8e7('0x60')][_0xe8e7('0xee')]){_0x38914a=util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x56c7fa[_0xe8e7('0x60')][_0xe8e7('0xee')]);}else{_0x38914a=util[_0xe8e7('0xa6')]('SIP/%s',_0x165aed[_0xe8e7('0x39')]);}socket['to'](util[_0xe8e7('0xa6')](_0xe8e7('0xef'),_0x165aed['name']))['emit'](_0xe8e7('0xf0'),{'user':{'id':_0x165aed['id'],'name':_0x165aed[_0xe8e7('0x39')]},'ip':_0x56c7fa[_0xe8e7('0xf1')][_0xe8e7('0xf2')]||_0x56c7fa[_0xe8e7('0xf3')][_0xe8e7('0xf4')]||_0x56c7fa[_0xe8e7('0xf5')][_0xe8e7('0xf4')]||_0x56c7fa[_0xe8e7('0xf3')][_0xe8e7('0xf5')][_0xe8e7('0xf4')]});return db[_0xe8e7('0xa9')]['destroy']({'where':{'membername':_0x165aed[_0xe8e7('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0xe8e7('0x8e'))]['ValidationError'](_0xe8e7('0xf6'));}})[_0xe8e7('0x25')](function(){if(_0x165aed){return _0x165aed[_0xe8e7('0xf7')]({'raw':!![]});}})[_0xe8e7('0x25')](function(_0x367dfb){if(_0x165aed){if(_0x367dfb){_0x1f09f8=_0x367dfb;if(_0x1f09f8[_0xe8e7('0x4c')]){var _0x526c56=_0x1f09f8[_0xe8e7('0x33')](function(_0xf7109a){var _0x44233c={'membername':_0x165aed['name'],'UserId':_0x165aed['id'],'queue_name':_0xf7109a[_0xe8e7('0x39')],'VoiceQueueId':_0xf7109a['id'],'interface':_0x38914a,'paused':_0x165aed[_0xe8e7('0xed')]||![],'penalty':_0xf7109a[_0xe8e7('0xf8')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x44233c);});return Promise[_0xe8e7('0x5e')](_0x526c56);}}}})[_0xe8e7('0x25')](function(){if(_0x165aed){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x165aed[_0xe8e7('0x39')],'exitAt':null}});}})[_0xe8e7('0x25')](function(_0x5de938){if(_0x165aed){var _0x273643=[];_0x5de938['forEach'](function(_0x5aaa50){_0x273643['push'](_0x5aaa50[_0xe8e7('0x5f')]({'exitAt':moment()[_0xe8e7('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe8e7('0x5e')](_0x273643);}})[_0xe8e7('0x25')](function(){if(_0x165aed){var _0xe4992b=[];var _0x11ede6=[];var _0x3cd004=utils[_0xe8e7('0xfa')]();var _0x444230={'membername':_0x165aed[_0xe8e7('0x39')],'interface':_0x38914a,'enterAt':moment()['format'](_0xe8e7('0xfb')),'role':_0x165aed[_0xe8e7('0x26')],'internal':_0x165aed[_0xe8e7('0x65')]};_0x3cd004['forEach'](function(_0x1e4fb6){_0xe4992b['push'](_[_0xe8e7('0xce')]({'channel':_0x1e4fb6,'type':_0xe8e7('0xfc'),'data1':_0x56c7fa['body'][_0xe8e7('0xfd')],'data2':_0x38914a},_0x444230));if(_0x165aed[_0xe8e7('0xed')]){_0x11ede6['push'](_[_0xe8e7('0xce')]({'channel':_0x1e4fb6,'type':_0xe8e7('0xfe'),'data1':_0xe8e7('0xff')},_0x444230));}});return db['MemberReport'][_0xe8e7('0x100')](_0xe4992b[_0xe8e7('0xc9')](_0x11ede6),{'individualHooks':!![]});}})[_0xe8e7('0x25')](function(){if(_0x165aed){return _0x165aed[_0xe8e7('0x5f')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x165aed[_0xe8e7('0xed')]||![],'mailPause':_0x165aed['loginInPause']||![],'chatPause':_0x165aed[_0xe8e7('0xed')]||![],'faxPause':_0x165aed[_0xe8e7('0xed')]||![],'smsPause':_0x165aed['loginInPause']||![],'openchannelPause':_0x165aed[_0xe8e7('0xed')]||![],'whatsappPause':_0x165aed['loginInPause']||![],'pauseType':_0x165aed[_0xe8e7('0xed')]?'LOGININPAUSE':null,'interface':_0x38914a,'lastPauseAt':moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb'))});}})['then'](function(_0x430ee8){if(_0x56c7fa[_0xe8e7('0x101')]){return _0x677b14();}else{return Promise[_0xe8e7('0x102')](_0x430ee8)['then'](respondWithResult(_0x2e2d64,null));}})[_0xe8e7('0x1b')](handleError(_0x2e2d64,null));};exports[_0xe8e7('0x103')]=function(_0x209e3f,_0x3c51dd){var _0x38e2d1;return db[_0xe8e7('0x41')][_0xe8e7('0x36')]({'where':{'id':_0x209e3f[_0xe8e7('0x54')]['id'],'role':'agent'},'attributes':['id',_0xe8e7('0x39'),_0xe8e7('0x26')]})['then'](handleEntityNotFound(_0x3c51dd,null))[_0xe8e7('0x25')](function(_0x214a0e){if(_0x214a0e){_0x38e2d1=_0x214a0e;return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'membername':_0x38e2d1[_0xe8e7('0x39')]},'individualHooks':!![]});}})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x38e2d1[_0xe8e7('0x39')],'exitAt':null}});})[_0xe8e7('0x25')](function(_0x15227c){var _0x3eea29=[];_0x15227c['forEach'](function(_0x4a4d96){_0x3eea29[_0xe8e7('0x48')](_0x4a4d96[_0xe8e7('0x5f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe8e7('0x5e')](_0x3eea29);})['then'](function(){return _0x38e2d1[_0xe8e7('0x5f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe8e7('0x25')](respondWithResult(_0x3c51dd,null))['catch'](handleError(_0x3c51dd,null));};exports[_0xe8e7('0x104')]=function(_0xf18d10,_0x42a601){var _0x29b273;return db[_0xe8e7('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0xf18d10[_0xe8e7('0x54')]['id']},'individualHooks':!![]})[_0xe8e7('0x25')](function(){return db['User']['find']({'where':{'id':_0xf18d10[_0xe8e7('0x54')]['id'],'role':_0xe8e7('0x27')},'attributes':['id',_0xe8e7('0x39'),'role',_0xe8e7('0x65'),_0xe8e7('0x9d'),_0xe8e7('0xa5')]});})[_0xe8e7('0x25')](handleEntityNotFound(_0x42a601,null))[_0xe8e7('0x25')](function(_0xa9e390){if(_0xa9e390){_0x29b273=_0xa9e390;return respondWithRpcPromise('QueuePause',_0xe8e7('0x104'),{'id':_0x29b273['id'],'name':_0x29b273[_0xe8e7('0x39')],'pause':!![]});}})[_0xe8e7('0x25')](function(){if(_0x29b273){return db[_0xe8e7('0xf9')][_0xe8e7('0x49')]({'where':{'membername':_0x29b273['name'],'type':_0xe8e7('0xfe'),'exitAt':null}});}})[_0xe8e7('0x25')](function(_0x4064be){if(_0x4064be[_0xe8e7('0x4c')]){var _0x2a495a=moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb'));for(var _0x47cb41=0x0,_0x107e8d=_0x4064be[_0xe8e7('0x4c')];_0x47cb41<_0x107e8d;_0x47cb41++){_0x4064be[_0x47cb41][_0xe8e7('0x105')]({'exitAt':_0x2a495a});}}})[_0xe8e7('0x25')](function(){var _0x1ef194=[];var _0x680ce1=utils[_0xe8e7('0xfa')]();_0x680ce1[_0xe8e7('0x106')](function(_0x47ada8){_0x1ef194[_0xe8e7('0x48')]({'channel':_0x47ada8,'membername':_0x29b273[_0xe8e7('0x39')],'interface':_[_0xe8e7('0x6b')](_0x29b273[_0xe8e7('0x9d')])?util[_0xe8e7('0xa6')](_0xe8e7('0xa7'),_0x29b273[_0xe8e7('0x39')]):_0x29b273[_0xe8e7('0x9d')],'type':_0xe8e7('0xfe'),'enterAt':moment()[_0xe8e7('0xa6')](_0xe8e7('0xfb')),'data1':_0xf18d10['body'][_0xe8e7('0x3c')]||_0xe8e7('0x107'),'role':_0x29b273[_0xe8e7('0x26')],'internal':_0x29b273[_0xe8e7('0x65')]});});return db[_0xe8e7('0xf9')][_0xe8e7('0x100')](_0x1ef194,{'individualHooks':!![]});})['then'](function(){return _0x29b273[_0xe8e7('0x5f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf18d10[_0xe8e7('0x60')][_0xe8e7('0x3c')]||_0xe8e7('0x107'),'lastPauseAt':moment()['format'](_0xe8e7('0xfb'))});})[_0xe8e7('0x25')](respondWithResult(_0x42a601,null))[_0xe8e7('0x1b')](handleError(_0x42a601,null));};exports[_0xe8e7('0x108')]=function(_0x12aa06,_0x438127){if(_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]&&!utils[_0xe8e7('0x9e')](_0x12aa06[_0xe8e7('0x60')]['channel'])){throw new APIBadRequestError(util[_0xe8e7('0xa6')](_0xe8e7('0x109'),_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]));}return db['User'][_0xe8e7('0x36')]({'where':{'id':_0x12aa06[_0xe8e7('0x54')]['id']},'attributes':['id','name',_0xe8e7('0x26'),_0xe8e7('0x65'),_0xe8e7('0x9d'),'online','voicePause','mailPause',_0xe8e7('0x10a'),_0xe8e7('0x10b'),_0xe8e7('0x10c'),_0xe8e7('0x10d'),_0xe8e7('0x10e'),_0xe8e7('0x10f'),_0xe8e7('0x110')]})['then'](function(_0x1b6e4c){if(!_0x1b6e4c){throw new APINotFoundError(util[_0xe8e7('0xa6')](_0xe8e7('0x111'),_0x12aa06[_0xe8e7('0x54')]['id']));}return _0x1b6e4c['unpause'](_0x12aa06[_0xe8e7('0x60')][_0xe8e7('0xab')]);})[_0xe8e7('0x25')](respondWithResult(_0x438127,null))[_0xe8e7('0x1b')](APIHandleError(_0x438127));};exports[_0xe8e7('0x112')]=function(_0x431439,_0xa7a786){var _0x20f246={};var _0x5f547f={};var _0x109d67;var _0x3c9e32;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x431439[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0xa7a786,null))[_0xe8e7('0x25')](function(_0x2e9a0a){if(_0x2e9a0a){_0x109d67=_0x2e9a0a;_0x5f547f[_0xe8e7('0x55')]=_[_0xe8e7('0x58')](db[_0xe8e7('0x113')][_0xe8e7('0x57')]);_0x5f547f['query']=_['keys'](_0x431439['query']);_0x5f547f[_0xe8e7('0x59')]=_['intersection'](_0x5f547f[_0xe8e7('0x55')],_0x5f547f['query']);_0x20f246[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x5f547f[_0xe8e7('0x55')],qs[_0xe8e7('0x5b')](_0x431439[_0xe8e7('0x42')]['fields']));_0x20f246[_0xe8e7('0x47')]=_0x20f246[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x20f246['attributes']:_0x5f547f[_0xe8e7('0x55')];_0x20f246[_0xe8e7('0xcb')]=qs['sort'](_0x431439[_0xe8e7('0x42')]['sort']);_0x20f246[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_['pick'](_0x431439['query'],_0x5f547f[_0xe8e7('0x59')]));if(_0x431439[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x20f246[_0xe8e7('0x40')]=_['merge'](_0x20f246[_0xe8e7('0x40')],{'$or':_['map'](_0x20f246[_0xe8e7('0x47')],function(_0x2c9fb8){var _0x21bf6c={};_0x21bf6c[_0x2c9fb8]={'$like':'%'+_0x431439[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x21bf6c;})});}_0x20f246=_[_0xe8e7('0xce')]({},_0x20f246,_0x431439[_0xe8e7('0x5d')]);return _0x109d67[_0xe8e7('0x112')](_0x20f246);}})[_0xe8e7('0x25')](function(_0x323245){if(_0x323245){_0x3c9e32=_0x323245[_0xe8e7('0x4c')];if(!_0x431439[_0xe8e7('0x42')][_0xe8e7('0xd4')](_0xe8e7('0xd5'))){_0x20f246['limit']=qs[_0xe8e7('0x21')](_0x431439[_0xe8e7('0x42')]['limit']);_0x20f246[_0xe8e7('0xd6')]=qs[_0xe8e7('0xd6')](_0x431439[_0xe8e7('0x42')]['offset']);}return _0x109d67['getTeams'](_0x20f246);}})['then'](function(_0x35868c){if(_0x35868c){return _0x35868c?{'count':_0x3c9e32,'rows':_0x35868c}:null;}})[_0xe8e7('0x25')](respondWithResult(_0xa7a786,null))[_0xe8e7('0x1b')](handleError(_0xa7a786,null));};exports[_0xe8e7('0x114')]=function(_0x8a8dea,_0x2d70ec){var _0x356b1a=_0x8a8dea[_0xe8e7('0x54')]['id'];var _0x5cf1db=_0x8a8dea[_0xe8e7('0x60')]?_0x8a8dea['body'][_0xe8e7('0x63')]:null;var _0x369530=[];return Promise[_0xe8e7('0x102')]()[_0xe8e7('0x25')](function(){if(!_0x5cf1db)throw new APIBadRequestError(_0xe8e7('0x115'));})[_0xe8e7('0x25')](function(){return db['User']['findOne']({'where':{'id':_0x356b1a}});})['then'](function(_0xb3857d){if(!_0xb3857d)throw new APINotFoundError(util[_0xe8e7('0xa6')](_0xe8e7('0x111'),_0x8a8dea[_0xe8e7('0x54')]['id']));return db[_0xe8e7('0x6c')][_0xe8e7('0x116')](function(_0x39347e){return _0xb3857d[_0xe8e7('0x114')](_0x5cf1db,{'transaction':_0x39347e})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0x113')][_0xe8e7('0x49')]({'where':{'id':{'$in':_0x5cf1db}}});})[_0xe8e7('0x25')](function(_0x31b915){var _0x72249e=_['map'](_0x31b915,function(_0x2ed10d){return _0x2ed10d['getAssociatedQueues']();});return Promise['all'](_0x72249e);})[_0xe8e7('0x25')](function(_0x30ef6f){_0x369530=_[_0xe8e7('0x117')](_0x30ef6f);var _0x504888=_[_0xe8e7('0x33')](_0x369530,function(_0x274a40){return _0x274a40['addAgent'](_0xb3857d['id'],{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0x504888);})[_0xe8e7('0x25')](function(){if(!_0xb3857d['online'])return;var _0x401e12=_['filter'](_0x369530,function(_0x23f6a4){return _0x23f6a4[_0xe8e7('0x118')](_0xe8e7('0xab'))===_0xe8e7('0x119');});var _0xb4104d=_[_0xe8e7('0x33')](_0x401e12,function(_0x3071da){return db[_0xe8e7('0xa9')][_0xe8e7('0x11a')]({'membername':_0xb3857d['name'],'UserId':_0xb3857d['id'],'queue_name':_0x3071da['name'],'VoiceQueueId':_0x3071da['id'],'interface':_['isNil'](_0xb3857d[_0xe8e7('0x9d')])?util['format'](_0xe8e7('0xa7'),_0xb3857d['name']):_0xb3857d[_0xe8e7('0x9d')],'paused':_0xb3857d[_0xe8e7('0x9c')]||![],'penalty':_0xb3857d[_0xe8e7('0xa8')]},{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0xb4104d);})[_0xe8e7('0x25')](function(){return db[_0xe8e7('0x11b')][_0xe8e7('0x49')]({'where':{'teamId':{'$in':_0x5cf1db}}});})[_0xe8e7('0x25')](function(_0xc478f3){var _0x6594f=_[_0xe8e7('0x33')](_0xc478f3,function(_0x4da3ca){return db['UserVoicePrefix'][_0xe8e7('0x7f')]({'UserId':_0xb3857d['id'],'VoicePrefixId':_0x4da3ca[_0xe8e7('0x11c')]},{'transaction':_0x39347e});});return Promise[_0xe8e7('0x5e')](_0x6594f);});});})[_0xe8e7('0x25')](function(){for(var _0x5dca26=0x0;_0x5dca26<_0x369530['length'];_0x5dca26++){var _0x19b552=_0x369530[_0x5dca26][_0xe8e7('0x118')]('channel');var _0x9d8374=_0x19b552+'QueueId';socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_0x19b552+_0xe8e7('0x11d'),{'UserId':_0x356b1a,['queueField']:_0x369530[_0x5dca26]['id']});}})[_0xe8e7('0x25')](respondWithStatusCode(_0x2d70ec,null))[_0xe8e7('0x1b')](APIHandleError(_0x2d70ec));};exports[_0xe8e7('0x11e')]=function(_0x21cd73,_0x2ddc98){var _0x32d829=_0x21cd73[_0xe8e7('0x54')]['id'];var _0x1da0df=null;if(_0x21cd73['query'][_0xe8e7('0x63')]){_0x1da0df=_[_0xe8e7('0xae')](_0x21cd73['query']['ids'])?_0x21cd73[_0xe8e7('0x42')][_0xe8e7('0x63')]:[_0x21cd73['query'][_0xe8e7('0x63')]];}var _0x599acb=[];return Promise[_0xe8e7('0x102')]()[_0xe8e7('0x25')](function(){if(!_0x1da0df)throw new APIBadRequestError(_0xe8e7('0x11f'));})['then'](function(){return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x32d829}});})[_0xe8e7('0x25')](function(_0x1d0994){if(!_0x1d0994)throw new APINotFoundError(util[_0xe8e7('0xa6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x21cd73[_0xe8e7('0x54')]['id']));return db[_0xe8e7('0x6c')]['transaction'](function(_0x224389){return _0x1d0994['removeTeams'](_0x1da0df,{'transaction':_0x224389})[_0xe8e7('0x25')](function(){return db['Team'][_0xe8e7('0x49')]({'where':{'id':{'$in':_0x1da0df}}});})['then'](function(_0x223558){var _0x3c40e3=_['map'](_0x223558,function(_0x57ed36){return _0x57ed36[_0xe8e7('0x120')]();});return Promise[_0xe8e7('0x5e')](_0x3c40e3);})[_0xe8e7('0x25')](function(_0x568049){_0x599acb=_[_0xe8e7('0x117')](_0x568049);var _0x5b437c=_[_0xe8e7('0x33')](_0x599acb,function(_0x1dfd96){return _0x1dfd96[_0xe8e7('0x121')](_0x1d0994['id'],{'transaction':_0x224389});});return Promise[_0xe8e7('0x5e')](_0x5b437c);})[_0xe8e7('0x25')](function(){if(!_0x1d0994[_0xe8e7('0xa5')])return;var _0x3ff635=_[_0xe8e7('0x31')](_0x599acb,function(_0x50e9c3){return _0x50e9c3['getDataValue'](_0xe8e7('0xab'))===_0xe8e7('0x119');});var _0x1c57e7=_['map'](_0x3ff635,function(_0x4079e7){return db[_0xe8e7('0xa9')][_0xe8e7('0x2a')]({'where':{'VoiceQueueId':_0x4079e7['id'],'UserId':_0x1d0994['id']},'transaction':_0x224389});});return Promise[_0xe8e7('0x5e')](_0x1c57e7);})['then'](function(){return db[_0xe8e7('0x11b')][_0xe8e7('0x49')]({'where':{'teamId':{'$in':_0x1da0df}}});})[_0xe8e7('0x25')](function(_0x1e6e57){var _0x40b6f2=_[_0xe8e7('0x33')](_0x1e6e57,function(_0x2cd672){return db[_0xe8e7('0x122')][_0xe8e7('0x2a')]({'where':{'UserId':_0x1d0994['id'],'VoicePrefixId':_0x2cd672[_0xe8e7('0x11c')]}},{'transaction':_0x224389});});return Promise['all'](_0x40b6f2);});});})['then'](function(){for(var _0x27788c=0x0;_0x27788c<_0x599acb[_0xe8e7('0x4c')];_0x27788c++){var _0x329829=_0x599acb[_0x27788c][_0xe8e7('0x118')](_0xe8e7('0xab'));var _0xfcc534=_0x329829+_0xe8e7('0xa3');socket[_0xe8e7('0x28')](_0xe8e7('0x2e')+_0x329829+_0xe8e7('0xaf'),{'UserId':_0x32d829,['queueField']:_0x599acb[_0x27788c]['id']});}})['then'](respondWithStatusCode(_0x2ddc98,null))[_0xe8e7('0x1b')](APIHandleError(_0x2ddc98));};exports['getLists']=function(_0x1a7254,_0x4ce087){var _0x3fb437={};var _0x3f5573={};var _0x4eb79b;var _0x47cf91;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x1a7254[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x4ce087,null))[_0xe8e7('0x25')](function(_0x2095bd){if(_0x2095bd){_0x4eb79b=_0x2095bd;_0x3f5573[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0xcf')][_0xe8e7('0x57')]);_0x3f5573[_0xe8e7('0x42')]=_[_0xe8e7('0x58')](_0x1a7254[_0xe8e7('0x42')]);_0x3f5573[_0xe8e7('0x59')]=_[_0xe8e7('0x5a')](_0x3f5573[_0xe8e7('0x55')],_0x3f5573[_0xe8e7('0x42')]);_0x3fb437[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x3f5573['model'],qs['fields'](_0x1a7254[_0xe8e7('0x42')]['fields']));_0x3fb437['attributes']=_0x3fb437[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3fb437['attributes']:_0x3f5573[_0xe8e7('0x55')];_0x3fb437['order']=qs[_0xe8e7('0xcc')](_0x1a7254['query'][_0xe8e7('0xcc')]);_0x3fb437[_0xe8e7('0x40')]=qs['filters'](_[_0xe8e7('0xcd')](_0x1a7254[_0xe8e7('0x42')],_0x3f5573[_0xe8e7('0x59')]));if(_0x1a7254[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3fb437['where']=_[_0xe8e7('0xce')](_0x3fb437[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x3fb437['attributes'],function(_0x4febd6){var _0x530da4={};_0x530da4[_0x4febd6]={'$like':'%'+_0x1a7254[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x530da4;})});}_0x3fb437=_[_0xe8e7('0xce')]({},_0x3fb437,_0x1a7254[_0xe8e7('0x5d')]);return _0x4eb79b[_0xe8e7('0x123')](_0x3fb437);}})[_0xe8e7('0x25')](function(_0x188fed){if(_0x188fed){_0x47cf91=_0x188fed[_0xe8e7('0x4c')];if(!_0x1a7254['query']['hasOwnProperty'](_0xe8e7('0xd5'))){_0x3fb437['limit']=qs[_0xe8e7('0x21')](_0x1a7254[_0xe8e7('0x42')]['limit']);_0x3fb437['offset']=qs[_0xe8e7('0xd6')](_0x1a7254['query'][_0xe8e7('0xd6')]);}return _0x4eb79b[_0xe8e7('0x123')](_0x3fb437);}})[_0xe8e7('0x25')](function(_0x538781){if(_0x538781){return _0x538781?{'count':_0x47cf91,'rows':_0x538781}:null;}})[_0xe8e7('0x25')](respondWithResult(_0x4ce087,null))[_0xe8e7('0x1b')](handleError(_0x4ce087,null));};exports[_0xe8e7('0x124')]=function(_0x810320,_0x9c0aec){var _0x3c9b1c={};var _0x160ce0={};var _0x1e810d;return db[_0xe8e7('0x41')][_0xe8e7('0x95')]({'where':{'id':_0x810320[_0xe8e7('0x54')]['id']}})[_0xe8e7('0x25')](handleEntityNotFound(_0x9c0aec,null))[_0xe8e7('0x25')](function(_0x247f02){if(_0x247f02){_0x1e810d=_0x247f02;_0x160ce0[_0xe8e7('0x55')]=_['keys'](db[_0xe8e7('0x41')]['rawAttributes']);_0x160ce0[_0xe8e7('0x42')]=_['keys'](_0x810320['query']);_0x160ce0[_0xe8e7('0x59')]=_['intersection'](_0x160ce0[_0xe8e7('0x55')],_0x160ce0[_0xe8e7('0x42')]);_0x3c9b1c[_0xe8e7('0x47')]=_[_0xe8e7('0x5a')](_0x160ce0[_0xe8e7('0x55')],qs['fields'](_0x810320[_0xe8e7('0x42')][_0xe8e7('0x5b')]));_0x3c9b1c[_0xe8e7('0x47')]=_0x3c9b1c[_0xe8e7('0x47')][_0xe8e7('0x4c')]?_0x3c9b1c[_0xe8e7('0x47')]:_0x160ce0[_0xe8e7('0x55')];_0x3c9b1c['order']=qs['sort'](_0x810320[_0xe8e7('0x42')]['sort']);_0x3c9b1c[_0xe8e7('0x40')]=qs[_0xe8e7('0x59')](_[_0xe8e7('0xcd')](_0x810320[_0xe8e7('0x42')],_0x160ce0[_0xe8e7('0x59')]));if(_0x810320[_0xe8e7('0x42')][_0xe8e7('0x31')]){_0x3c9b1c[_0xe8e7('0x40')]=_[_0xe8e7('0xce')](_0x3c9b1c[_0xe8e7('0x40')],{'$or':_[_0xe8e7('0x33')](_0x3c9b1c['attributes'],function(_0x5aaa0e){var _0x5a56cb={};_0x5a56cb[_0x5aaa0e]={'$like':'%'+_0x810320[_0xe8e7('0x42')][_0xe8e7('0x31')]+'%'};return _0x5a56cb;})});}_0x3c9b1c[_0xe8e7('0x55')]=db['User'];_0x3c9b1c['as']='Agents';_0x3c9b1c=_['merge']({},_0x3c9b1c,_0x810320[_0xe8e7('0x5d')]);return _0x1e810d[_0xe8e7('0xf7')]({'include':[_0x3c9b1c]});}})[_0xe8e7('0x25')](function(_0x40119b){if(_0x40119b){var _0x58e25f={},_0x3c65fe=[];for(var _0x4104a1=0x0;_0x4104a1<_0x40119b[_0xe8e7('0x4c')];_0x4104a1+=0x1){for(var _0x58d6d8=0x0,_0x3b3435;_0x58d6d8<_0x40119b[_0x4104a1][_0xe8e7('0x2f')][_0xe8e7('0x4c')];_0x58d6d8+=0x1){_0x3b3435=_0x40119b[_0x4104a1][_0xe8e7('0x2f')][_0x58d6d8][_0xe8e7('0x2b')]({'plain':!![]});_0x58e25f[_0x3b3435['id']]=_0x3b3435;}}_0x58e25f=_['values'](_0x58e25f);for(var _0x3e36c2=qs[_0xe8e7('0xd6')](_0x810320[_0xe8e7('0x42')][_0xe8e7('0xd6')]);_0x3e36c2<_0x58e25f[_0xe8e7('0x4c')]&&_0x3c65fe['length']=_0x32eb96){_0x153736=_0x32eb96;_0x585dae=0xc8;}else{_0x585dae=0xce;}_0x12e262['status'](_0x585dae);return _0x12e262[_0xd380('0x2b')](_0xd380('0x2c'),_0x5c4109+'-'+_0x153736+'/'+_0x32eb96)[_0xd380('0x26')](_0x25673f);}return null;};}function saveUpdates(_0x3935b7){return function(_0x4227a1){if(_0x4227a1){return _0x4227a1[_0xd380('0x2d')](_0x3935b7)[_0xd380('0x17')](function(_0x2514d6){if(_0x2514d6[_0xd380('0x2e')]===_0xd380('0x2f')){socket[_0xd380('0x30')](_0xd380('0x31')+_0x2514d6['id'],_0x2514d6);}return _0x2514d6;});}return null;};}function removeEntity(_0x36f315){return function(_0x56c051){if(_0x56c051){return _0x56c051[_0xd380('0x32')]()[_0xd380('0x17')](function(){var _0x13be41=_0x56c051[_0xd380('0x33')]({'plain':!![]});if(_0x13be41[_0xd380('0x2e')]===_0xd380('0x34'))return;var _0x3f48a6=[{'name':_0xd380('0x35'),'value':_0xd380('0x36'),'ignore':!![]},{'name':'Agents','value':_0xd380('0x2f'),'ignore':![]},{'name':_0xd380('0x37'),'value':_0xd380('0x38'),'ignore':![]}];var _0x2e669a=_(_0x3f48a6)[_0xd380('0x39')](_0xd380('0x3a'))[_0xd380('0x3b')]('value')[_0xd380('0x3c')]();if(_[_0xd380('0x3d')](_0x2e669a,_0x13be41[_0xd380('0x2e')])){return;}var _0x2899f4=_[_0xd380('0x3e')](_0x3f48a6,['value',_0x13be41['role']])[_0xd380('0x3f')];return db['UserProfileResource'][_0xd380('0x32')]({'where':{'type':_0x2899f4,'resourceId':_0x13be41['id']}})['then'](function(){return _0x56c051;});})[_0xd380('0x17')](function(){_0x36f315['status'](0xcc)[_0xd380('0x24')]();});}};}function handleEntityNotFound(_0x349c66){return function(_0x1ad877){if(!_0x1ad877){_0x349c66[_0xd380('0x23')](0x194);}return _0x1ad877;};}function handleError(_0x1b308f,_0x30b2ba){_0x30b2ba=_0x30b2ba||0x1f4;return function(_0x3293ac){logger[_0xd380('0x1e')](_0x3293ac['stack']);if(_0x3293ac[_0xd380('0x3f')]){delete _0x3293ac[_0xd380('0x3f')];}_0x1b308f[_0xd380('0x25')](_0x30b2ba)[_0xd380('0x40')](_0x3293ac);};}exports[_0xd380('0x41')]=function(_0x7b0e5c,_0x427c4c){var _0x34d84d={},_0x58eb34={'count':0x0,'rows':[]};var _0x5e36ed=_(db[_0xd380('0x42')][_0xd380('0x43')])[_0xd380('0x3b')](function(_0x447d56){return{'name':_0x447d56[_0xd380('0x44')],'type':_0x447d56[_0xd380('0x45')][_0xd380('0x46')]};})[_0xd380('0x39')](function(_0x3bdc51){return!_[_0xd380('0x3d')](['password','salt'],_0x3bdc51['name']);})[_0xd380('0x3c')]();_0x34d84d=qs['getOptions'](_0x5e36ed,_0x7b0e5c);var _0x434b30={'where':_0x34d84d[_0xd380('0x47')]};return db[_0xd380('0x42')]['count'](_0x434b30)[_0xd380('0x17')](function(_0x25d99d){_0x58eb34[_0xd380('0x2a')]=_0x25d99d;if(_0x7b0e5c[_0xd380('0x48')][_0xd380('0x49')]){_0x34d84d[_0xd380('0x4a')]=[{'all':!![]}];}if(_0x7b0e5c[_0xd380('0x48')][_0xd380('0x4b')]===_0xd380('0x4c')){_0x34d84d[_0xd380('0x4a')]=[{'model':db[_0xd380('0x4d')],'as':_0xd380('0x4b')}];}if(!_[_0xd380('0x3d')](_0x34d84d[_0xd380('0x4e')],'id')){_0x34d84d[_0xd380('0x4e')]['push']('id');}return db['User'][_0xd380('0x4f')](_0x34d84d);})[_0xd380('0x17')](function(_0x328dda){_0x58eb34[_0xd380('0x50')]=_0x328dda;if(_0x7b0e5c[_0xd380('0x48')][_0xd380('0x51')]===_0xd380('0x4c')){var _0x58f471=[];for(var _0x2b12a5=0x0;_0x2b12a5<_0x58eb34[_0xd380('0x50')]['length'];_0x2b12a5++){_0x58f471[_0xd380('0x52')](get_open_tabs(_0xd380('0x53'),_0x58eb34[_0xd380('0x50')][_0x2b12a5][_0xd380('0x54')]));_0x58f471[_0xd380('0x52')](get_open_tabs(_0xd380('0x55'),_0x58eb34[_0xd380('0x50')][_0x2b12a5][_0xd380('0x54')]));_0x58f471['push'](get_open_tabs('fax',_0x58eb34[_0xd380('0x50')][_0x2b12a5][_0xd380('0x54')]));_0x58f471[_0xd380('0x52')](get_open_tabs('mail',_0x58eb34['rows'][_0x2b12a5]['dataValues']));_0x58f471[_0xd380('0x52')](get_open_tabs(_0xd380('0x56'),_0x58eb34[_0xd380('0x50')][_0x2b12a5][_0xd380('0x54')]));_0x58f471[_0xd380('0x52')](get_open_tabs(_0xd380('0x57'),_0x58eb34[_0xd380('0x50')][_0x2b12a5][_0xd380('0x54')]));}return Promise[_0xd380('0x58')](_0x58f471)['then'](function(){return _0x58eb34;});}else{return _0x58eb34;}})[_0xd380('0x17')](respondWithFilteredResult(_0x427c4c,_0x34d84d))[_0xd380('0x22')](handleError(_0x427c4c,null));};exports[_0xd380('0x59')]=function(_0x2d0cc0,_0x202956){var _0x1dd432={'raw':![],'where':{'id':_0x2d0cc0[_0xd380('0x5a')]['id']}},_0x525c6b={};_0x525c6b[_0xd380('0x5b')]=_[_0xd380('0x5c')](_[_0xd380('0x5d')](db[_0xd380('0x42')]['rawAttributes']),[_0xd380('0x5e'),_0xd380('0x5f')]);_0x525c6b[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x2d0cc0[_0xd380('0x48')]);_0x525c6b[_0xd380('0x60')]=_['intersection'](_0x525c6b[_0xd380('0x5b')],_0x525c6b['query']);_0x1dd432[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x525c6b[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x2d0cc0[_0xd380('0x48')][_0xd380('0x62')]));_0x1dd432[_0xd380('0x4e')]=_0x1dd432['attributes']['length']?_0x1dd432['attributes']:_0x525c6b[_0xd380('0x5b')];if(_0x2d0cc0[_0xd380('0x48')][_0xd380('0x49')]){_0x1dd432['include']=[{'all':!![]}];}if(_0x2d0cc0[_0xd380('0x48')][_0xd380('0x4b')]==='true'){_0x1dd432[_0xd380('0x4a')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x1dd432=_[_0xd380('0x63')]({},_0x1dd432,_0x2d0cc0['options']);if(!_[_0xd380('0x3d')](_0x1dd432[_0xd380('0x4e')],'id')){_0x1dd432[_0xd380('0x4e')][_0xd380('0x52')]('id');}return db['User'][_0xd380('0x3e')](_0x1dd432)[_0xd380('0x17')](handleEntityNotFound(_0x202956,null))[_0xd380('0x17')](function(_0x17a286){var _0x4e64f8=[];values=_0x17a286;if(_0x2d0cc0[_0xd380('0x48')][_0xd380('0x51')]===_0xd380('0x4c')){_0x4e64f8[_0xd380('0x52')](get_open_tabs(_0xd380('0x53'),_0x17a286[_0xd380('0x54')]));_0x4e64f8[_0xd380('0x52')](get_open_tabs(_0xd380('0x55'),_0x17a286[_0xd380('0x54')]));_0x4e64f8[_0xd380('0x52')](get_open_tabs('openchannel',_0x17a286[_0xd380('0x54')]));_0x4e64f8[_0xd380('0x52')](get_open_tabs(_0xd380('0x57'),_0x17a286[_0xd380('0x54')]));_0x4e64f8[_0xd380('0x52')](get_open_tabs(_0xd380('0x64'),_0x17a286['dataValues']));_0x4e64f8[_0xd380('0x52')](get_open_tabs(_0xd380('0x65'),_0x17a286[_0xd380('0x54')]));return Promise[_0xd380('0x58')](_0x4e64f8);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x202956,null))[_0xd380('0x22')](handleError(_0x202956,null));};exports[_0xd380('0x2d')]=function(_0x574610,_0x468f0c){if(_0x574610['body']['id']){delete _0x574610[_0xd380('0x66')]['id'];}delete _0x574610[_0xd380('0x66')][_0xd380('0x2e')];return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x574610[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x468f0c,null))[_0xd380('0x17')](saveUpdates(_0x574610[_0xd380('0x66')],null))[_0xd380('0x17')](respondWithResult(_0x468f0c,null))['catch'](handleError(_0x468f0c,null));};exports['describe']=function(_0x1835c6,_0x3234fc){return db[_0xd380('0x42')][_0xd380('0x67')]()[_0xd380('0x17')](respondWithResult(_0x3234fc,null))['catch'](handleError(_0x3234fc,null));};exports[_0xd380('0x68')]=function(_0x50a7d6,_0x4dcf43){return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x50a7d6['params']['id']}})['then'](handleEntityNotFound(_0x4dcf43,null))[_0xd380('0x17')](function(_0x30bbcb){if(_0x30bbcb){return _0x30bbcb[_0xd380('0x68')](_0x50a7d6[_0xd380('0x66')][_0xd380('0x69')],_['omit'](_0x50a7d6[_0xd380('0x66')],[_0xd380('0x69'),'id'])||{});}})[_0xd380('0x17')](respondWithResult(_0x4dcf43,null))[_0xd380('0x22')](handleError(_0x4dcf43,null));};function validateUser(_0x5cb535){return new Promise(function(_0x569a2f,_0x11d667){if(_0x5cb535[_0xd380('0x6a')])return _0x569a2f(_0x5cb535);return db['Setting'][_0xd380('0x6b')](0x1)[_0xd380('0x17')](function(_0x2eacab){if(_0x2eacab[_0xd380('0x6c')])authService[_0xd380('0x6d')](_0x5cb535[_0xd380('0x5e')]);db[_0xd380('0x42')][_0xd380('0x6e')](_0xd380('0x6a'))[_0xd380('0x17')](function(_0x4bb6da){if(_[_0xd380('0x6f')](_0x4bb6da)){_0x5cb535[_0xd380('0x6a')]=_0x2eacab['min_internal']||0x1;return;}if(_[_0xd380('0x6f')](_0x2eacab['min_internal'])||_0x2eacab['min_internal']===_0x4bb6da){_0x5cb535[_0xd380('0x6a')]=_0x4bb6da+0x1;return;}if(_0x2eacab[_0xd380('0x70')]>_0x4bb6da){_0x5cb535[_0xd380('0x6a')]=_0x2eacab['min_internal'];return;}return db['sequelize'][_0xd380('0x48')]('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['sequelize']['QueryTypes'][_0xd380('0x71')]})[_0xd380('0x17')](function(_0x400664){if(_0x400664&&_0x400664[_0xd380('0x72')]){for(var _0xdc2226=0x0,_0x1cfa3e=_0x400664[_0xd380('0x72')];_0xdc2226<_0x1cfa3e&&_[_0xd380('0x6f')](_0x5cb535[_0xd380('0x6a')]);_0xdc2226++){if(_0x2eacab[_0xd380('0x70')]<=_0x400664[_0xdc2226]['from']){_0x5cb535[_0xd380('0x6a')]=_0x400664[_0xdc2226]['from'];}else if(_0x2eacab['min_internal']>_0x400664[_0xdc2226]['from']&&_0x2eacab[_0xd380('0x70')]<=_0x400664[_0xdc2226]['to']){_0x5cb535[_0xd380('0x6a')]=_0x2eacab[_0xd380('0x70')];}}}if(_[_0xd380('0x6f')](_0x5cb535[_0xd380('0x6a')])){_0x5cb535['internal']=_0x4bb6da+0x1;}return _0x569a2f(_0x5cb535);});});})[_0xd380('0x22')](function(_0xe7ab05){_0x11d667(_0xe7ab05);});});}function updateUser(_0x20b575){return new Promise(function(_0x59c16c,_0x4f83f7){try{if(_0x20b575[_0xd380('0x73')]){_0x20b575[_0xd380('0x74')]=_0x20b575[_0xd380('0x6a')];_0x20b575[_0xd380('0x75')]={'mailbox':_0x20b575[_0xd380('0x6a')],'password':_0x20b575[_0xd380('0x5e')],'fullname':_0x20b575[_0xd380('0x76')],'email':_0x20b575[_0xd380('0x77')]};}if(_0x20b575[_0xd380('0x2e')]===_0xd380('0x2f')){if(!_0x20b575[_0xd380('0x78')])_0x20b575[_0xd380('0x78')]=[_0xd380('0x79'),_0xd380('0x7a'),_0xd380('0x7b'),_0xd380('0x7c'),_0xd380('0x7d'),_0xd380('0x7e'),_0xd380('0x7f'),'106',_0xd380('0x80'),_0xd380('0x81'),_0xd380('0x82'),_0xd380('0x83'),_0xd380('0x84'),_0xd380('0x85'),'115'];}_0x59c16c(_0x20b575);}catch(_0x4d16dc){_0x4f83f7(_0x4d16dc);}});}exports['create']=function(_0x248db8,_0x21d55f){if(_0x248db8['user']['role']==='agent')throw new Error('Unauthorized');if(_0x248db8[_0xd380('0x66')]['role']==='user'&&_0x248db8[_0xd380('0x36')][_0xd380('0x2e')]!==_0xd380('0x34')){throw new Error(_0xd380('0x86'));}if(_0x248db8['body'][_0xd380('0x2e')]===_0xd380('0x34')&&_0x248db8[_0xd380('0x36')][_0xd380('0x2e')]!=='admin'){throw new Error(_0xd380('0x87'));}return licenseUtil[_0xd380('0x88')]([_0x248db8[_0xd380('0x66')]])[_0xd380('0x17')](function(){return validateUser(_0x248db8[_0xd380('0x66')]);})[_0xd380('0x17')](function(_0x54617d){return updateUser(_0x54617d)[_0xd380('0x17')](function(_0x9898d7){if(_0x9898d7['role']===_0xd380('0x34')){_0x9898d7[_0xd380('0x89')]=_0x248db8[_0xd380('0x36')]['settingsEnabled'];delete _0x9898d7[_0xd380('0x8a')];}return _0x9898d7;});})[_0xd380('0x17')](function(_0x30a4d0){return db['User'][_0xd380('0x8b')](_0x30a4d0,{'include':[{'model':db[_0xd380('0x75')],'as':_0xd380('0x75')}]});})[_0xd380('0x17')](function(_0x55fbdd){if(_0x248db8[_0xd380('0x66')][_0xd380('0x2e')]==='user')return _0x55fbdd;if(_0x248db8[_0xd380('0x36')][_0xd380('0x2e')]!==_0xd380('0x36'))return _0x55fbdd;return db[_0xd380('0x8c')][_0xd380('0x3e')]({'where':{'name':_0x55fbdd[_0xd380('0x2e')]===_0xd380('0x2f')?'Agents':'Telephones','userProfileId':_0x248db8[_0xd380('0x36')][_0xd380('0x8a')]},'raw':!![]})[_0xd380('0x17')](function(_0x48732a){if(!_0x48732a||_0x48732a[_0xd380('0x8d')]!=0x0)return _0x55fbdd;return db[_0xd380('0x8e')][_0xd380('0x8b')]({'name':_0x55fbdd['name'],'resourceId':_0x55fbdd['id'],'type':_0x48732a['name'],'sectionId':_0x48732a['id']},{})['then'](function(){return _0x55fbdd;});})['catch'](function(_0x74f7fe){logger[_0xd380('0x1e')](_0xd380('0x8f'),_0x74f7fe);throw _0x74f7fe;});})[_0xd380('0x17')](respondWithResult(_0x21d55f,0xc9))[_0xd380('0x22')](handleError(_0x21d55f,null));};exports[_0xd380('0x90')]=function(_0x7a8e69,_0x4da790){var _0x5a7dad=_0x7a8e69[_0xd380('0x66')];var _0x3c2953=[];if(_0x7a8e69[_0xd380('0x36')]['role']===_0xd380('0x2f'))throw new Error('Unauthorized');if(_[_0xd380('0x91')](_0x5a7dad,[_0xd380('0x2e'),_0xd380('0x36')])&&_0x7a8e69['user'][_0xd380('0x2e')]!==_0xd380('0x34')){throw new Error(_0xd380('0x86'));}if(_[_0xd380('0x91')](_0x5a7dad,[_0xd380('0x2e'),_0xd380('0x34')])&&_0x7a8e69[_0xd380('0x36')][_0xd380('0x2e')]!==_0xd380('0x34')){throw new Error(_0xd380('0x92'));}return licenseUtil[_0xd380('0x88')](_0x5a7dad)[_0xd380('0x17')](function(){return validateUser(_0x5a7dad[0x0]);})[_0xd380('0x17')](function(){for(var _0x288ecf=0x1;_0x288ecf<_0x5a7dad[_0xd380('0x72')];_0x288ecf++){var _0x128585=_0x5a7dad[_0x288ecf-0x1]['internal'];if(!_0x5a7dad[_0x288ecf][_0xd380('0x6a')])_0x5a7dad[_0x288ecf][_0xd380('0x6a')]=_0x128585+0x1;_0x3c2953[_0xd380('0x52')](validateUser(_0x5a7dad[_0x288ecf]));}return Promise[_0xd380('0x58')](_0x3c2953);})['then'](function(){_0x3c2953=[];for(var _0x7d82c0=0x0;_0x7d82c0<_0x5a7dad[_0xd380('0x72')];_0x7d82c0++){_0x3c2953[_0xd380('0x52')](updateUser(_0x5a7dad[_0x7d82c0]));}return Promise[_0xd380('0x58')](_0x3c2953);})['then'](function(){_0x3c2953=_0x5a7dad['map'](function(_0x40c4bf){return db[_0xd380('0x42')][_0xd380('0x8b')](_0x40c4bf,{'include':[{'model':db['VoiceMail'],'as':_0xd380('0x75')}]})[_0xd380('0x17')](function(_0x5b3e38){_0x40c4bf['id']=_0x5b3e38['id'];return _0x40c4bf;});});return Promise[_0xd380('0x58')](_0x3c2953);})[_0xd380('0x17')](function(_0x52af76){if(_0x7a8e69[_0xd380('0x66')]['role']===_0xd380('0x36'))return _0x52af76;if(_0x7a8e69[_0xd380('0x36')]['role']!==_0xd380('0x36'))return _0x52af76;var _0xc87dcb=_[_0xd380('0x91')](_0x52af76,function(_0x2f7f93){return _0x2f7f93[_0xd380('0x2e')]===_0xd380('0x2f')||_0x2f7f93[_0xd380('0x2e')]===_0xd380('0x38');});if(!_0xc87dcb)return _0x52af76;return db['UserProfileSection'][_0xd380('0x4f')]({'where':{'name':{'$or':['Agents',_0xd380('0x37')]},'userProfileId':_0x7a8e69[_0xd380('0x36')][_0xd380('0x8a')]},'raw':!![]})[_0xd380('0x17')](function(_0xd65419){if(_['isEmpty'](_0xd65419)||!_[_0xd380('0x91')](_0xd65419,[_0xd380('0x8d'),0x0]))return _0x52af76;_0x3c2953=[];var _0x1c5b1f=_(_0xd65419)[_0xd380('0x3b')](function(_0x419492){if(_0x419492[_0xd380('0x8d')]===0x1)return;return _0x419492[_0xd380('0x3f')]===_0xd380('0x93')?_0xd380('0x2f'):_0xd380('0x38');})['compact']()[_0xd380('0x3c')]();for(var _0x2bf870=0x0;_0x2bf870<_0x52af76[_0xd380('0x72')];_0x2bf870++){if(!_['includes'](_0x1c5b1f,_0x52af76[_0x2bf870]['role']))return;var _0x759d42=_0x52af76[_0x2bf870][_0xd380('0x2e')]===_0xd380('0x2f')?_0xd380('0x93'):'Telephones';_0x3c2953[_0xd380('0x52')](db['UserProfileResource'][_0xd380('0x8b')]({'name':_0x52af76[_0x2bf870]['name'],'resourceId':_0x52af76[_0x2bf870]['id'],'type':_0x759d42,'sectionId':_[_0xd380('0x3e')](_0xd65419,[_0xd380('0x3f'),_0x759d42])['id']},{}));}return Promise[_0xd380('0x58')](_0x3c2953);});})['then'](respondWithResult(_0x4da790,0xc9))[_0xd380('0x22')](handleError(_0x4da790,null));};exports[_0xd380('0x94')]=function(_0x3acc49,_0xed787f){if(_0x3acc49[_0xd380('0x66')]['id']){delete _0x3acc49['body']['id'];}return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x3acc49['params']['id']}})['then'](function(_0x592b5f){if(!_0x592b5f)return null;if(_0x592b5f['id']===_0x3acc49[_0xd380('0x36')]['id']){if(!_0x3acc49[_0xd380('0x66')][_0xd380('0x95')]||!_0x3acc49[_0xd380('0x66')][_0xd380('0x96')]){throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0x99'));}if(!_0x592b5f[_0xd380('0x9a')](_0x3acc49[_0xd380('0x66')][_0xd380('0x95')])){throw new db[(_0xd380('0x97'))]['ValidationError']('Wrong\x20credentials');}if(_0x3acc49[_0xd380('0x66')][_0xd380('0x95')]===_0x3acc49[_0xd380('0x66')][_0xd380('0x96')]){throw new db[(_0xd380('0x97'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x3acc49['user'][_0xd380('0x2e')]===_0xd380('0x34')){if(!_0x3acc49[_0xd380('0x66')][_0xd380('0x96')]){throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0x9b'));}}else if(_0x3acc49['user'][_0xd380('0x2e')]===_0xd380('0x36')){if(!_0x3acc49[_0xd380('0x66')][_0xd380('0x96')]){throw new db['Sequelize'][(_0xd380('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x592b5f[_0xd380('0x2e')]!==_0xd380('0x2f')){throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))]('Unauthorized');}}else{throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0x9c'));}return _0x592b5f;})['then'](handleEntityNotFound(_0xed787f,null))['then'](function(_0x5b38d9){return db[_0xd380('0x9d')][_0xd380('0x9e')]({'attributes':['id',_0xd380('0x6c'),'enforcePasswordHistory',_0xd380('0x9f')]})['then'](function(_0x257cf2){if(_0x257cf2[_0xd380('0x6c')])authService[_0xd380('0x6d')](_0x3acc49[_0xd380('0x66')][_0xd380('0x96')]);if(!_0x257cf2[_0xd380('0xa0')]||!_0x5b38d9[_0xd380('0xa1')])return _0x5b38d9;authService['validatePasswordHistory'](_0x3acc49[_0xd380('0x66')][_0xd380('0x96')],_0x5b38d9['previousPasswords'],_0x257cf2[_0xd380('0x9f')]);return _0x5b38d9;})[_0xd380('0x17')](saveUpdates({'password':_0x3acc49[_0xd380('0x66')]['newPassword'],'passwordResetAt':_0x3acc49['user']['id']==_0x3acc49['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3acc49[_0xd380('0x66')][_0xd380('0x96')],_0x5b38d9[_0xd380('0xa1')])},null));})[_0xd380('0x17')](respondWithResult(_0xed787f,null))[_0xd380('0x22')](handleError(_0xed787f,null));};exports[_0xd380('0xa2')]=function(_0x4569d6,_0x40d0f6){var _0x3a464a=_0x4569d6['body'][_0xd380('0xa3')];return db[_0xd380('0x42')]['find']({'where':{'id':_0x4569d6[_0xd380('0x5a')]['id']},'attributes':['id','name',_0xd380('0x2e'),'online',_0xd380('0xa4'),_0xd380('0xa5'),_0xd380('0xa6')]})[_0xd380('0x17')](handleEntityNotFound(_0x40d0f6,null))[_0xd380('0x17')](function(_0x5d0c12){if(_0x5d0c12){if(!utils[_0xd380('0xa7')](_0x3a464a)){throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0xa8'));}return _0x5d0c12[_0xd380('0xa9')+_['capitalize'](_0x3a464a[_0xd380('0xaa')]())+'Queues'](_0x4569d6[_0xd380('0x66')][_0xd380('0x69')],{'penalty':_0x4569d6[_0xd380('0x66')][_0xd380('0xab')]||0x0})[_0xd380('0xac')](function(_0x2a4fc3){for(var _0x4267a8=0x0;_0x4267a8<_0x4569d6['body']['ids']['length'];_0x4267a8+=0x1){var _0xfd21f0={'UserId':Number(_0x4569d6[_0xd380('0x5a')]['id'])};_0xfd21f0[_[_0xd380('0xad')](_0x3a464a['toLowerCase']())+_0xd380('0xae')]=Number(_0x4569d6[_0xd380('0x66')]['ids'][_0x4267a8]);socket[_0xd380('0x30')](_0xd380('0x36')+_[_0xd380('0xad')](_0x3a464a[_0xd380('0xaa')]())+_0xd380('0xaf'),_0xfd21f0);}return _0x2a4fc3;})[_0xd380('0x17')](function(){if(_0x3a464a===_0xd380('0xb0')){return db[_0xd380('0xb1')][_0xd380('0x4f')]({'where':{'id':_0x4569d6[_0xd380('0x66')]['ids']||[]},'raw':!![],'attributes':['id',_0xd380('0x3f')]});}})[_0xd380('0x17')](function(_0x8ad7e1){var _0x2f2162=_0x5d0c12[_0xd380('0x33')]({'plain':!![]});var _0x970c43=[];if(_0x3a464a===_0xd380('0xb0')&&_0x2f2162[_0xd380('0x2e')]===_0xd380('0x2f')&&_0x2f2162[_0xd380('0xb2')]){for(let _0x2d1942=0x0;_0x2d1942<_0x8ad7e1[_0xd380('0x72')];_0x2d1942+=0x1){_0x970c43[_0xd380('0x52')]({'membername':_0x2f2162[_0xd380('0x3f')],'UserId':_0x2f2162['id'],'queue_name':_0x8ad7e1[_0x2d1942][_0xd380('0x3f')],'VoiceQueueId':_0x8ad7e1[_0x2d1942]['id'],'interface':_[_0xd380('0x6f')](_0x2f2162[_0xd380('0xa6')])?util[_0xd380('0xb3')](_0xd380('0xb4'),_0x2f2162[_0xd380('0x3f')]):_0x2f2162['interface'],'paused':_0x2f2162[_0xd380('0xa5')]||![],'penalty':_0x4569d6[_0xd380('0x66')][_0xd380('0xab')]||0x0});}return Promise[_0xd380('0x58')](_0x970c43[_0xd380('0x3b')](function(_0x26adbf){return db[_0xd380('0xb5')][_0xd380('0xb6')](_0x26adbf);}));}return _0x5d0c12;});}})[_0xd380('0x17')](respondWithStatusCode(_0x40d0f6,null))[_0xd380('0x22')](handleError(_0x40d0f6,null));};exports[_0xd380('0xb7')]=function(_0x37e2fa,_0x308cba){var _0x2aed27,_0x2ef002;return db['User']['find']({'where':{'id':_0x37e2fa[_0xd380('0x5a')]['id']},'attributes':['id','name',_0xd380('0x2e')]})[_0xd380('0x17')](handleEntityNotFound(_0x308cba,null))['then'](function(_0x4c362c){if(_0x4c362c){_0x2aed27=_0x4c362c;if(!_0x37e2fa['query'][_0xd380('0xa3')]||!utils[_0xd380('0xa7')](_0x37e2fa[_0xd380('0x48')]['channel'])){throw new db[(_0xd380('0x97'))]['ValidationError']('Unknown\x20channel');}return _0x4c362c[_0xd380('0xb8')+_[_0xd380('0xad')](_0x37e2fa[_0xd380('0x48')][_0xd380('0xa3')][_0xd380('0xaa')]())+_0xd380('0xb9')](_0x37e2fa[_0xd380('0x48')][_0xd380('0x69')]);}})[_0xd380('0x17')](function(_0x4c77ca){if(_[_0xd380('0xba')](_0x37e2fa[_0xd380('0x48')][_0xd380('0x69')])){for(var _0x2874b8=0x0;_0x2874b8<_0x37e2fa[_0xd380('0x48')]['ids']['length'];_0x2874b8+=0x1){_0x2ef002={'UserId':Number(_0x37e2fa['params']['id'])};_0x2ef002[_['capitalize'](_0x37e2fa[_0xd380('0x48')]['channel']['toLowerCase']())+_0xd380('0xae')]=Number(_0x37e2fa[_0xd380('0x48')]['ids'][_0x2874b8]);socket['emit'](_0xd380('0x36')+_[_0xd380('0xad')](_0x37e2fa[_0xd380('0x48')]['channel'][_0xd380('0xaa')]())+_0xd380('0xbb'),_0x2ef002);}}else{_0x2ef002={'UserId':Number(_0x37e2fa['params']['id'])};_0x2ef002[_[_0xd380('0xad')](_0x37e2fa[_0xd380('0x48')][_0xd380('0xa3')][_0xd380('0xaa')]())+_0xd380('0xae')]=Number(_0x37e2fa[_0xd380('0x48')][_0xd380('0x69')]);socket[_0xd380('0x30')](_0xd380('0x36')+_[_0xd380('0xad')](_0x37e2fa[_0xd380('0x48')][_0xd380('0xa3')][_0xd380('0xaa')]())+'Queue:remove',_0x2ef002);}return _0x4c77ca;})[_0xd380('0x17')](function(){if(_0x37e2fa[_0xd380('0x48')][_0xd380('0xa3')]===_0xd380('0xb0')){return db[_0xd380('0xb5')][_0xd380('0x32')]({'where':{'UserId':_0x37e2fa[_0xd380('0x5a')]['id'],'VoiceQueueId':_0x37e2fa[_0xd380('0x48')][_0xd380('0x69')]},'individualHooks':!![]})[_0xd380('0x17')](function(){return _0x2aed27;});}return _0x2aed27;})['then'](respondWithStatusCode(_0x308cba,null))['catch'](handleError(_0x308cba,null));};exports[_0xd380('0xbc')]=function(_0x18e108,_0x19b27b){_0x18e108[_0xd380('0x66')][_0xd380('0xbd')]=_0x18e108[_0xd380('0xbe')][_0xd380('0xbf')];return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x18e108[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x19b27b,null))[_0xd380('0x17')](saveUpdates(_0x18e108['body'],null))[_0xd380('0x17')](respondWithResult(_0x19b27b,null))[_0xd380('0x22')](handleError(_0x19b27b,null));};exports[_0xd380('0xc0')]=function(_0x282622,_0x3504f0){var _0x2c91a7=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x282622[_0xd380('0x5a')]['id']},'attributes':['id',_0xd380('0xbd')],'raw':!![]})[_0xd380('0x17')](handleEntityNotFound(_0x3504f0,null))[_0xd380('0x17')](function(_0x1adce8){if(_0x1adce8){if(_[_0xd380('0x6f')](_0x1adce8[_0xd380('0xbd')])){return _0x3504f0['download'](_0x2c91a7);}else{if(!fs[_0xd380('0xc1')](path[_0xd380('0xc2')](config[_0xd380('0xc3')],_0xd380('0xc4'),_0x1adce8['userpic']))){return _0x3504f0[_0xd380('0xc5')](_0x2c91a7);}return _0x3504f0[_0xd380('0xc5')](path['join'](config[_0xd380('0xc3')],_0xd380('0xc4'),_0x1adce8['userpic']));}}})[_0xd380('0x22')](handleError(_0x3504f0,null));};exports[_0xd380('0xc6')]=function(_0x4647c8,_0x2b2f33){return db[_0xd380('0x42')]['find']({'where':{'id':_0x4647c8[_0xd380('0x5a')]['id']},'attributes':['id']})[_0xd380('0x17')](handleEntityNotFound(_0x2b2f33,null))['then'](function(_0x26424c){var _0x581d47=[];values=_0x26424c[_0xd380('0x54')];_0x581d47['push'](get_open_tabs('chat',_0x26424c[_0xd380('0x54')]));_0x581d47['push'](get_open_tabs(_0xd380('0x55'),_0x26424c[_0xd380('0x54')]));_0x581d47[_0xd380('0x52')](get_open_tabs(_0xd380('0x56'),_0x26424c['dataValues']));_0x581d47[_0xd380('0x52')](get_open_tabs(_0xd380('0x57'),_0x26424c[_0xd380('0x54')]));_0x581d47[_0xd380('0x52')](get_open_tabs(_0xd380('0x64'),_0x26424c[_0xd380('0x54')]));_0x581d47['push'](get_open_tabs(_0xd380('0x65'),_0x26424c['dataValues']));return Promise['all'](_0x581d47);})[_0xd380('0x17')](function(_0x67d874){if(_0x67d874){var _0x480e7f=_[_0xd380('0x3b')](values[_0xd380('0xc7')],function(_0x4d7664){return{'channel':_0xd380('0xc8'),'id':_0x4d7664['id'],'createdAt':_0x4d7664['createdAt']};});var _0x386144=_['map'](values[_0xd380('0xc9')],function(_0x19784f){return{'channel':_0xd380('0xca'),'id':_0x19784f['id'],'createdAt':_0x19784f['createdAt']};});var _0xbe17bf=_[_0xd380('0x3b')](values['OpenchannelOpenTabs'],function(_0x38c2b8){return{'channel':_0xd380('0xcb'),'id':_0x38c2b8['id'],'createdAt':_0x38c2b8[_0xd380('0xcc')]};});var _0x5bca54=_[_0xd380('0x3b')](values[_0xd380('0xcd')],function(_0x1dbc67){return{'channel':_0xd380('0xce'),'id':_0x1dbc67['id'],'createdAt':_0x1dbc67['createdAt']};});var _0x1155e5=_[_0xd380('0x3b')](values[_0xd380('0xcf')],function(_0x38be5f){return{'channel':_0xd380('0xd0'),'id':_0x38be5f['id'],'createdAt':_0x38be5f[_0xd380('0xcc')]};});var _0x5647b7=_['map'](values['WhatsappOpenTabs'],function(_0x312409){return{'channel':'WHATSAPP','id':_0x312409['id'],'createdAt':_0x312409[_0xd380('0xcc')]};});var _0x555edf=_['concat'](_0x480e7f,_0x386144,_0xbe17bf,_0x5bca54,_0x1155e5,_0x5647b7);var _0x281c7c={'count':_0x555edf[_0xd380('0x72')],'rows':_0x555edf};return _0x281c7c;}else return null;})[_0xd380('0x17')](respondWithResult(_0x2b2f33,null))['catch'](handleError(_0x2b2f33,null));};exports[_0xd380('0xd1')]=function(_0x3f8c75,_0x520810){var _0x120f1f={};return db[_0xd380('0x42')]['findOne']({'where':{'id':_0x3f8c75[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](function(_0x556b1c){if(!_0x556b1c){throw new APINotFoundError(util['format'](_0xd380('0xd2'),_0x3f8c75[_0xd380('0x5a')]['id']));}return contacts['describe']();})[_0xd380('0x17')](function(_0x724230){_0x3f8c75[_0xd380('0x48')][_0xd380('0x42')]=_0x3f8c75[_0xd380('0x5a')]['id'];_0x120f1f=qs[_0xd380('0xd3')](_0x724230,_0x3f8c75);if(_0x3f8c75['query'][_0xd380('0xd4')](_0xd380('0x49'))){_0x120f1f['include']=[{'model':db['CmList'],'as':_0xd380('0xd5'),'required':![]},{'model':db[_0xd380('0xd6')],'as':_0xd380('0xd7'),'attributes':['id',_0xd380('0x3f'),_0xd380('0xd8')],'where':_0x3f8c75[_0xd380('0x48')][_0xd380('0xd9')]?{'id':_0x3f8c75[_0xd380('0x48')][_0xd380('0xd9')]}:undefined,'required':_0x3f8c75[_0xd380('0x48')][_0xd380('0xd9')]?!![]:![]}];}return contacts[_0xd380('0x4f')](_0x3f8c75['query'],_0x3f8c75[_0xd380('0x36')],_0x120f1f,_0x724230);})[_0xd380('0x17')](respondWithFilteredResult(_0x520810,_0x120f1f))[_0xd380('0x22')](APIHandleError(_0x520810));};exports[_0xd380('0xda')]=function(_0x1a9259,_0x3bf8ef){var _0xa99672;var _0x2a50a5={};var _0x588fce;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x1a9259[_0xd380('0x5a')]['id']},'attributes':['id',_0xd380('0x3f'),_0xd380('0x2e')]})['then'](handleEntityNotFound(_0x3bf8ef,null))[_0xd380('0x17')](function(_0x27d84d){if(!utils['isValidChannel'](_0x1a9259['query']['channel'])){throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0xa8'));}_0xa99672=_0x27d84d;var _0x19d572={};_0x19d572[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_[_0xd380('0xad')](_0x1a9259[_0xd380('0x48')][_0xd380('0xa3')])+_0xd380('0xdb')]['rawAttributes']);_0x19d572['query']=_[_0xd380('0x5d')](_0x1a9259[_0xd380('0x48')]);_0x19d572[_0xd380('0x60')]=_[_0xd380('0x61')](_0x19d572[_0xd380('0x5b')],_0x19d572[_0xd380('0x48')]);_0x2a50a5[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x19d572[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x1a9259[_0xd380('0x48')][_0xd380('0x62')]));_0x2a50a5['attributes']=_0x2a50a5[_0xd380('0x4e')][_0xd380('0x72')]?_0x2a50a5[_0xd380('0x4e')]:_0x19d572[_0xd380('0x5b')];_0x2a50a5['order']=qs[_0xd380('0xdc')](_0x1a9259[_0xd380('0x48')][_0xd380('0xdc')]);_0x2a50a5['where']=qs['filters'](_[_0xd380('0xdd')](_0x1a9259['query'],_0x19d572['filters']));if(_0x1a9259['query'][_0xd380('0x39')]){_0x2a50a5[_0xd380('0x47')]=_['merge'](_0x2a50a5[_0xd380('0x47')],{'$or':_['map'](_0x2a50a5['attributes'],function(_0x114097){var _0x55cb90={};_0x55cb90[_0x114097]={'$like':'%'+_0x1a9259[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x55cb90;})});}_0x2a50a5=_[_0xd380('0x63')]({},_0x2a50a5,_0x1a9259[_0xd380('0xde')]);switch(_0xa99672[_0xd380('0x2e')]){case _0xd380('0x34'):return db[_[_0xd380('0xad')](_0x1a9259[_0xd380('0x48')][_0xd380('0xa3')])+_0xd380('0xdb')]['findAll'](_0x2a50a5);case _0xd380('0x36'):case _0xd380('0x2f'):return _0xa99672['get'+_[_0xd380('0xad')](_0x1a9259[_0xd380('0x48')][_0xd380('0xa3')])+_0xd380('0xb9')](_0x2a50a5);default:throw new db[(_0xd380('0x97'))]['ValidationError'](_0xd380('0xdf'));}})[_0xd380('0x17')](function(_0x2e4874){_0x588fce=_0x2e4874[_0xd380('0x72')];if(!_0x1a9259[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x2a50a5[_0xd380('0x29')]=qs['limit'](_0x1a9259[_0xd380('0x48')][_0xd380('0x29')]);_0x2a50a5['offset']=qs['offset'](_0x1a9259['query'][_0xd380('0x27')]);}switch(_0xa99672[_0xd380('0x2e')]){case _0xd380('0x34'):return db[_[_0xd380('0xad')](_0x1a9259[_0xd380('0x48')][_0xd380('0xa3')])+_0xd380('0xdb')]['findAll'](_0x2a50a5);case _0xd380('0x36'):case _0xd380('0x2f'):return _0xa99672['get'+_[_0xd380('0xad')](_0x1a9259[_0xd380('0x48')][_0xd380('0xa3')])+_0xd380('0xb9')](_0x2a50a5);}})[_0xd380('0x17')](function(_0x21caae){return{'count':_0x588fce,'rows':_0x21caae};})[_0xd380('0x17')](respondWithResult(_0x3bf8ef,null))['catch'](handleError(_0x3bf8ef,null));};exports['getVoiceQueuesRt']=function(_0xb7d1e,_0x1733a4){var _0x306c97={};var _0x57fd00={};var _0x5a1d14;var _0x2d46ed;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0xb7d1e[_0xd380('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1733a4,null))[_0xd380('0x17')](function(_0x5a8dd6){if(_0x5a8dd6){_0x5a1d14=_0x5a8dd6;_0x57fd00[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0xb5')][_0xd380('0x43')]);_0x57fd00['query']=_[_0xd380('0x5d')](_0xb7d1e[_0xd380('0x48')]);_0x57fd00[_0xd380('0x60')]=_[_0xd380('0x61')](_0x57fd00['model'],_0x57fd00[_0xd380('0x48')]);_0x306c97[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x57fd00[_0xd380('0x5b')],qs[_0xd380('0x62')](_0xb7d1e[_0xd380('0x48')][_0xd380('0x62')]));_0x306c97[_0xd380('0x4e')]=_0x306c97[_0xd380('0x4e')][_0xd380('0x72')]?_0x306c97[_0xd380('0x4e')]:_0x57fd00[_0xd380('0x5b')];_0x306c97[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0xb7d1e[_0xd380('0x48')]['sort']);_0x306c97['where']=qs[_0xd380('0x60')](_['pick'](_0xb7d1e[_0xd380('0x48')],_0x57fd00['filters']));if(_0xb7d1e['query'][_0xd380('0x39')]){_0x306c97[_0xd380('0x47')]=_[_0xd380('0x63')](_0x306c97['where'],{'$or':_['map'](_0x306c97[_0xd380('0x4e')],function(_0x27ab64){var _0x3a690a={};_0x3a690a[_0x27ab64]={'$like':'%'+_0xb7d1e['query'][_0xd380('0x39')]+'%'};return _0x3a690a;})});}_0x306c97=_[_0xd380('0x63')]({},_0x306c97,_0xb7d1e[_0xd380('0xde')]);return _0x5a1d14['getVoiceQueuesRt'](_0x306c97);}})[_0xd380('0x17')](function(_0x4b38fd){if(_0x4b38fd){_0x2d46ed=_0x4b38fd['length'];if(!_0xb7d1e['query'][_0xd380('0xd4')](_0xd380('0xe0'))){_0x306c97['limit']=qs['limit'](_0xb7d1e[_0xd380('0x48')]['limit']);_0x306c97[_0xd380('0x27')]=qs[_0xd380('0x27')](_0xb7d1e[_0xd380('0x48')][_0xd380('0x27')]);}return _0x5a1d14['getVoiceQueuesRt'](_0x306c97);}})[_0xd380('0x17')](function(_0x4369a9){if(_0x4369a9){return _0x4369a9?{'count':_0x2d46ed,'rows':_0x4369a9}:null;}})['then'](respondWithResult(_0x1733a4,null))['catch'](handleError(_0x1733a4,null));};exports[_0xd380('0xe2')]=function(_0x39f466,_0x3e46fc){var _0x357cca={};var _0x9ed8da={};var _0x8d708a;var _0x2fa71a;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x39f466[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x3e46fc,null))[_0xd380('0x17')](function(_0x3739c2){if(_0x3739c2){_0x8d708a=_0x3739c2;_0x9ed8da[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0xe3')][_0xd380('0x43')]);_0x9ed8da[_0xd380('0x48')]=_['keys'](_0x39f466[_0xd380('0x48')]);_0x9ed8da[_0xd380('0x60')]=_[_0xd380('0x61')](_0x9ed8da[_0xd380('0x5b')],_0x9ed8da[_0xd380('0x48')]);_0x357cca[_0xd380('0x4e')]=_['intersection'](_0x9ed8da['model'],qs[_0xd380('0x62')](_0x39f466[_0xd380('0x48')][_0xd380('0x62')]));_0x357cca['attributes']=_0x357cca[_0xd380('0x4e')][_0xd380('0x72')]?_0x357cca[_0xd380('0x4e')]:_0x9ed8da['model'];_0x357cca[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0x39f466[_0xd380('0x48')][_0xd380('0xdc')]);_0x357cca[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x39f466[_0xd380('0x48')],_0x9ed8da[_0xd380('0x60')]));if(_0x39f466[_0xd380('0x48')][_0xd380('0x39')]){_0x357cca[_0xd380('0x47')]=_['merge'](_0x357cca[_0xd380('0x47')],{'$or':_['map'](_0x357cca['attributes'],function(_0x330657){var _0x19e5b0={};_0x19e5b0[_0x330657]={'$like':'%'+_0x39f466[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x19e5b0;})});}_0x357cca=_[_0xd380('0x63')]({},_0x357cca,_0x39f466[_0xd380('0xde')]);return _0x8d708a[_0xd380('0xe2')](_0x357cca);}})[_0xd380('0x17')](function(_0x3fb87a){if(_0x3fb87a){_0x2fa71a=_0x3fb87a[_0xd380('0x72')];if(!_0x39f466[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x357cca[_0xd380('0x29')]=qs[_0xd380('0x29')](_0x39f466['query'][_0xd380('0x29')]);_0x357cca['offset']=qs[_0xd380('0x27')](_0x39f466[_0xd380('0x48')][_0xd380('0x27')]);}return _0x8d708a[_0xd380('0xe2')](_0x357cca);}})[_0xd380('0x17')](function(_0x5939f3){if(_0x5939f3){return _0x5939f3?{'count':_0x2fa71a,'rows':_0x5939f3}:null;}})['then'](respondWithResult(_0x3e46fc,null))[_0xd380('0x22')](handleError(_0x3e46fc,null));};exports['getRecordings']=function(_0x48736e,_0x52a0d1){var _0x4baf49={'raw':!![],'where':{}};var _0x2f22b0={};var _0x4199c5={'count':0x0,'rows':[]};return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x48736e[_0xd380('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52a0d1,null))['then'](function(_0xa36ec8){if(_0xa36ec8){_0x2f22b0[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0xe4')][_0xd380('0x43')]);_0x2f22b0['query']=_[_0xd380('0x5d')](_0x48736e['query']);_0x2f22b0['filters']=_[_0xd380('0x61')](_0x2f22b0[_0xd380('0x5b')],_0x2f22b0[_0xd380('0x48')]);_0x4baf49[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x2f22b0['model'],qs[_0xd380('0x62')](_0x48736e[_0xd380('0x48')]['fields']));_0x4baf49['attributes']=_0x4baf49[_0xd380('0x4e')][_0xd380('0x72')]?_0x4baf49[_0xd380('0x4e')]:_0x2f22b0[_0xd380('0x5b')];if(!_0x48736e[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x4baf49[_0xd380('0x29')]=qs[_0xd380('0x29')](_0x48736e[_0xd380('0x48')]['limit']);_0x4baf49[_0xd380('0x27')]=qs['offset'](_0x48736e[_0xd380('0x48')][_0xd380('0x27')]);}_0x4baf49[_0xd380('0xe1')]=qs['sort'](_0x48736e[_0xd380('0x48')]['sort']);_0x4baf49['where']=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x48736e[_0xd380('0x48')],_0x2f22b0['filters']));_0x4baf49[_0xd380('0x47')][_0xd380('0xe5')]=_0xa36ec8['id'];if(_0x48736e[_0xd380('0x48')][_0xd380('0x39')]){_0x4baf49[_0xd380('0x47')]=_[_0xd380('0x63')](_0x4baf49['where'],{'$or':_[_0xd380('0x3b')](_0x4baf49[_0xd380('0x4e')],function(_0x26af9f){var _0x4d6e8e={};_0x4d6e8e[_0x26af9f]={'$like':'%'+_0x48736e[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x4d6e8e;})});}_0x4baf49=_[_0xd380('0x63')]({},_0x4baf49,_0x48736e['options']);return db[_0xd380('0xe4')][_0xd380('0x2a')]({'where':_0x4baf49[_0xd380('0x47')]})[_0xd380('0x17')](function(_0x1e0289){_0x4199c5[_0xd380('0x2a')]=_0x1e0289;if(_0x48736e[_0xd380('0x48')]['includeAll']){_0x4baf49[_0xd380('0x4a')]=[{'all':!![]}];}return db['VoiceRecording'][_0xd380('0x4f')](_0x4baf49);})[_0xd380('0x17')](function(_0x510a43){_0x4199c5[_0xd380('0x50')]=_0x510a43;return _0x4199c5;});}})[_0xd380('0x17')](respondWithFilteredResult(_0x52a0d1,_0x4baf49))[_0xd380('0x22')](handleError(_0x52a0d1,null));};exports[_0xd380('0xe6')]=function(_0x5390ef,_0x11d437){var _0x20c67c={'raw':!![],'where':{}};var _0xb59fec={};var _0x40367c={'count':0x0,'rows':[]};return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x5390ef[_0xd380('0x5a')]['id']}})['then'](handleEntityNotFound(_0x11d437,null))['then'](function(_0x3b1101){if(_0x3b1101){_0xb59fec['model']=_[_0xd380('0x5d')](db[_0xd380('0xe7')][_0xd380('0x43')]);_0xb59fec[_0xd380('0x48')]=_['keys'](_0x5390ef[_0xd380('0x48')]);_0xb59fec['filters']=_[_0xd380('0x61')](_0xb59fec['model'],_0xb59fec[_0xd380('0x48')]);_0x20c67c['attributes']=_[_0xd380('0x61')](_0xb59fec['model'],qs[_0xd380('0x62')](_0x5390ef[_0xd380('0x48')][_0xd380('0x62')]));_0x20c67c[_0xd380('0x4e')]=_0x20c67c['attributes'][_0xd380('0x72')]?_0x20c67c[_0xd380('0x4e')]:_0xb59fec['model'];if(!_0x5390ef['query'][_0xd380('0xd4')]('nolimit')){_0x20c67c[_0xd380('0x29')]=qs[_0xd380('0x29')](_0x5390ef[_0xd380('0x48')][_0xd380('0x29')]);_0x20c67c[_0xd380('0x27')]=qs[_0xd380('0x27')](_0x5390ef['query']['offset']);}_0x20c67c['order']=qs[_0xd380('0xdc')](_0x5390ef[_0xd380('0x48')][_0xd380('0xdc')]);_0x20c67c[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x5390ef[_0xd380('0x48')],_0xb59fec[_0xd380('0x60')]));_0x20c67c[_0xd380('0x47')][_0xd380('0xe5')]=_0x3b1101['id'];if(_0x5390ef['query']['filter']){_0x20c67c[_0xd380('0x47')]=_['merge'](_0x20c67c['where'],{'$or':_[_0xd380('0x3b')](_0x20c67c[_0xd380('0x4e')],function(_0x4545ee){var _0x42f261={};_0x42f261[_0x4545ee]={'$like':'%'+_0x5390ef[_0xd380('0x48')]['filter']+'%'};return _0x42f261;})});}_0x20c67c=_[_0xd380('0x63')]({},_0x20c67c,_0x5390ef[_0xd380('0xde')]);return db['ScreenRecording'][_0xd380('0x2a')]({'where':_0x20c67c['where']})[_0xd380('0x17')](function(_0x46c25e){_0x40367c['count']=_0x46c25e;if(_0x5390ef[_0xd380('0x48')]['includeAll']){_0x20c67c['include']=[{'all':!![]}];}return db[_0xd380('0xe7')][_0xd380('0x4f')](_0x20c67c);})['then'](function(_0x2764b2){_0x40367c[_0xd380('0x50')]=_0x2764b2;return _0x40367c;});}})[_0xd380('0x17')](respondWithFilteredResult(_0x11d437,_0x20c67c))[_0xd380('0x22')](handleError(_0x11d437,null));};exports['getChatInteractions']=function(_0x2fa566,_0x423013){var _0x11657f={};var _0x8fe63b={};var _0x35e15f;var _0x49337b;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x2fa566[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x423013,null))['then'](function(_0x4cfb18){if(_0x4cfb18){_0x35e15f=_0x4cfb18;_0x8fe63b['model']=_[_0xd380('0x5d')](db[_0xd380('0xe8')]['rawAttributes']);_0x8fe63b[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x2fa566[_0xd380('0x48')]);_0x8fe63b[_0xd380('0x60')]=_[_0xd380('0x61')](_0x8fe63b[_0xd380('0x5b')],_0x8fe63b[_0xd380('0x48')]);_0x11657f[_0xd380('0x4e')]=_['intersection'](_0x8fe63b[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x2fa566[_0xd380('0x48')][_0xd380('0x62')]));_0x11657f['attributes']=_0x11657f['attributes'][_0xd380('0x72')]?_0x11657f[_0xd380('0x4e')]:_0x8fe63b[_0xd380('0x5b')];_0x11657f[_0xd380('0xe1')]=qs['sort'](_0x2fa566[_0xd380('0x48')][_0xd380('0xdc')]);_0x11657f['where']=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x2fa566[_0xd380('0x48')],_0x8fe63b[_0xd380('0x60')]));if(_0x2fa566[_0xd380('0x48')][_0xd380('0x39')]){_0x11657f[_0xd380('0x47')]=_[_0xd380('0x63')](_0x11657f['where'],{'$or':_['map'](_0x11657f[_0xd380('0x4e')],function(_0x37b657){var _0x59788c={};_0x59788c[_0x37b657]={'$like':'%'+_0x2fa566[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x59788c;})});}_0x11657f=_['merge']({},_0x11657f,_0x2fa566[_0xd380('0xde')]);return _0x35e15f[_0xd380('0xe9')](_0x11657f);}})[_0xd380('0x17')](function(_0x112c72){if(_0x112c72){_0x49337b=_0x112c72['length'];if(!_0x2fa566[_0xd380('0x48')][_0xd380('0xd4')]('nolimit')){_0x11657f[_0xd380('0x29')]=qs[_0xd380('0x29')](_0x2fa566['query'][_0xd380('0x29')]);_0x11657f[_0xd380('0x27')]=qs[_0xd380('0x27')](_0x2fa566[_0xd380('0x48')][_0xd380('0x27')]);}return _0x35e15f[_0xd380('0xe9')](_0x11657f);}})[_0xd380('0x17')](function(_0x509b0d){if(_0x509b0d){return _0x509b0d?{'count':_0x49337b,'rows':_0x509b0d}:null;}})[_0xd380('0x17')](respondWithResult(_0x423013,null))['catch'](handleError(_0x423013,null));};exports['getOpenchannelInteractions']=function(_0x3d26c2,_0x54cbf8){var _0x52dd1f={};var _0x41555e={};var _0x30d6a2;var _0x474f40;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x3d26c2['params']['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x54cbf8,null))[_0xd380('0x17')](function(_0x35e37f){if(_0x35e37f){_0x30d6a2=_0x35e37f;_0x41555e[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0xea')]['rawAttributes']);_0x41555e[_0xd380('0x48')]=_['keys'](_0x3d26c2[_0xd380('0x48')]);_0x41555e['filters']=_[_0xd380('0x61')](_0x41555e[_0xd380('0x5b')],_0x41555e['query']);_0x52dd1f['attributes']=_[_0xd380('0x61')](_0x41555e[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x3d26c2[_0xd380('0x48')][_0xd380('0x62')]));_0x52dd1f[_0xd380('0x4e')]=_0x52dd1f[_0xd380('0x4e')][_0xd380('0x72')]?_0x52dd1f[_0xd380('0x4e')]:_0x41555e[_0xd380('0x5b')];_0x52dd1f['order']=qs['sort'](_0x3d26c2[_0xd380('0x48')][_0xd380('0xdc')]);_0x52dd1f[_0xd380('0x47')]=qs['filters'](_[_0xd380('0xdd')](_0x3d26c2['query'],_0x41555e[_0xd380('0x60')]));if(_0x3d26c2[_0xd380('0x48')][_0xd380('0x39')]){_0x52dd1f[_0xd380('0x47')]=_[_0xd380('0x63')](_0x52dd1f['where'],{'$or':_[_0xd380('0x3b')](_0x52dd1f['attributes'],function(_0x154113){var _0x70a6b8={};_0x70a6b8[_0x154113]={'$like':'%'+_0x3d26c2['query'][_0xd380('0x39')]+'%'};return _0x70a6b8;})});}_0x52dd1f=_[_0xd380('0x63')]({},_0x52dd1f,_0x3d26c2[_0xd380('0xde')]);return _0x30d6a2[_0xd380('0xeb')](_0x52dd1f);}})[_0xd380('0x17')](function(_0x465c89){if(_0x465c89){_0x474f40=_0x465c89[_0xd380('0x72')];if(!_0x3d26c2[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x52dd1f['limit']=qs['limit'](_0x3d26c2[_0xd380('0x48')][_0xd380('0x29')]);_0x52dd1f['offset']=qs[_0xd380('0x27')](_0x3d26c2[_0xd380('0x48')]['offset']);}return _0x30d6a2[_0xd380('0xeb')](_0x52dd1f);}})['then'](function(_0x2ce985){if(_0x2ce985){return _0x2ce985?{'count':_0x474f40,'rows':_0x2ce985}:null;}})[_0xd380('0x17')](respondWithResult(_0x54cbf8,null))[_0xd380('0x22')](handleError(_0x54cbf8,null));};exports[_0xd380('0xec')]=function(_0x3e5546,_0x2736de){var _0x3d19ab={'raw':!![],'where':{}};var _0x2a8ff9={};var _0x3e53b7={'count':0x0,'rows':[]};return db['User'][_0xd380('0x9e')]({'where':{'id':_0x3e5546['params']['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x2736de,null))['then'](function(_0x26cec3){if(_0x26cec3){_0x2a8ff9[_0xd380('0x5b')]=_['keys'](db[_0xd380('0xed')][_0xd380('0x43')]);_0x2a8ff9['query']=_[_0xd380('0x5d')](_0x3e5546[_0xd380('0x48')]);_0x2a8ff9[_0xd380('0x60')]=_[_0xd380('0x61')](_0x2a8ff9[_0xd380('0x5b')],_0x2a8ff9['query']);_0x3d19ab[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x2a8ff9[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x3e5546[_0xd380('0x48')][_0xd380('0x62')]));_0x3d19ab[_0xd380('0x4e')]=_0x3d19ab['attributes'][_0xd380('0x72')]?_0x3d19ab[_0xd380('0x4e')]:_0x2a8ff9[_0xd380('0x5b')];if(!_0x3e5546[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x3d19ab[_0xd380('0x29')]=qs[_0xd380('0x29')](_0x3e5546[_0xd380('0x48')][_0xd380('0x29')]);_0x3d19ab[_0xd380('0x27')]=qs['offset'](_0x3e5546[_0xd380('0x48')]['offset']);}_0x3d19ab[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0x3e5546['query']['sort']);_0x3d19ab['where']=qs['filters'](_[_0xd380('0xdd')](_0x3e5546[_0xd380('0x48')],_0x2a8ff9[_0xd380('0x60')]));_0x3d19ab[_0xd380('0x47')][_0xd380('0xe5')]=_0x26cec3['id'];if(_0x3e5546[_0xd380('0x48')][_0xd380('0x39')]){_0x3d19ab[_0xd380('0x47')]=_[_0xd380('0x63')](_0x3d19ab['where'],{'$or':_['map'](_0x3d19ab['attributes'],function(_0x20f65b){var _0x105a47={};_0x105a47[_0x20f65b]={'$like':'%'+_0x3e5546[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x105a47;})});}_0x3d19ab=_['merge']({},_0x3d19ab,_0x3e5546[_0xd380('0xde')]);return db['MailInteraction']['count']({'where':_0x3d19ab['where']})[_0xd380('0x17')](function(_0x4cc5f3){_0x3e53b7[_0xd380('0x2a')]=_0x4cc5f3;if(_0x3e5546[_0xd380('0x48')][_0xd380('0x49')]){_0x3d19ab[_0xd380('0x4a')]=[{'all':!![]}];}return db[_0xd380('0xed')][_0xd380('0x4f')](_0x3d19ab);})[_0xd380('0x17')](function(_0x5702ae){_0x3e53b7[_0xd380('0x50')]=_0x5702ae;return _0x3e53b7;});}})[_0xd380('0x17')](respondWithFilteredResult(_0x2736de,_0x3d19ab))['catch'](handleError(_0x2736de,null));};exports[_0xd380('0xee')]=function(_0x5b7cf8,_0x227cf6){var _0x564f19={};var _0xac03a5={};var _0x4284e2;var _0x112119;return db[_0xd380('0x42')]['findOne']({'where':{'id':_0x5b7cf8[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x227cf6,null))[_0xd380('0x17')](function(_0x4d3636){if(_0x4d3636){_0x4284e2=_0x4d3636;_0xac03a5[_0xd380('0x5b')]=_[_0xd380('0x5d')](db['SmsInteraction'][_0xd380('0x43')]);_0xac03a5[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x5b7cf8[_0xd380('0x48')]);_0xac03a5[_0xd380('0x60')]=_[_0xd380('0x61')](_0xac03a5[_0xd380('0x5b')],_0xac03a5['query']);_0x564f19[_0xd380('0x4e')]=_[_0xd380('0x61')](_0xac03a5[_0xd380('0x5b')],qs['fields'](_0x5b7cf8[_0xd380('0x48')]['fields']));_0x564f19['attributes']=_0x564f19['attributes'][_0xd380('0x72')]?_0x564f19[_0xd380('0x4e')]:_0xac03a5['model'];_0x564f19[_0xd380('0xe1')]=qs['sort'](_0x5b7cf8[_0xd380('0x48')][_0xd380('0xdc')]);_0x564f19[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x5b7cf8[_0xd380('0x48')],_0xac03a5['filters']));if(_0x5b7cf8[_0xd380('0x48')]['filter']){_0x564f19[_0xd380('0x47')]=_[_0xd380('0x63')](_0x564f19['where'],{'$or':_[_0xd380('0x3b')](_0x564f19[_0xd380('0x4e')],function(_0x5e1090){var _0x5c5a73={};_0x5c5a73[_0x5e1090]={'$like':'%'+_0x5b7cf8[_0xd380('0x48')]['filter']+'%'};return _0x5c5a73;})});}_0x564f19=_[_0xd380('0x63')]({},_0x564f19,_0x5b7cf8['options']);return _0x4284e2[_0xd380('0xee')](_0x564f19);}})[_0xd380('0x17')](function(_0x2105ba){if(_0x2105ba){_0x112119=_0x2105ba['length'];if(!_0x5b7cf8[_0xd380('0x48')][_0xd380('0xd4')]('nolimit')){_0x564f19['limit']=qs['limit'](_0x5b7cf8[_0xd380('0x48')][_0xd380('0x29')]);_0x564f19[_0xd380('0x27')]=qs['offset'](_0x5b7cf8[_0xd380('0x48')][_0xd380('0x27')]);}return _0x4284e2[_0xd380('0xee')](_0x564f19);}})[_0xd380('0x17')](function(_0xd0d7b4){if(_0xd0d7b4){return _0xd0d7b4?{'count':_0x112119,'rows':_0xd0d7b4}:null;}})['then'](respondWithResult(_0x227cf6,null))[_0xd380('0x22')](handleError(_0x227cf6,null));};exports[_0xd380('0xef')]=function(_0xf20a,_0x817d9e){var _0x4b33a6={};var _0x306621={};var _0x53f4b1;var _0x1eb399;return db['User'][_0xd380('0x9e')]({'where':{'id':_0xf20a[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x817d9e,null))[_0xd380('0x17')](function(_0x5068d7){if(_0x5068d7){_0x53f4b1=_0x5068d7;_0x306621[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0xf0')][_0xd380('0x43')]);_0x306621[_0xd380('0x48')]=_['keys'](_0xf20a[_0xd380('0x48')]);_0x306621[_0xd380('0x60')]=_[_0xd380('0x61')](_0x306621['model'],_0x306621[_0xd380('0x48')]);_0x4b33a6[_0xd380('0x4e')]=_['intersection'](_0x306621[_0xd380('0x5b')],qs[_0xd380('0x62')](_0xf20a[_0xd380('0x48')][_0xd380('0x62')]));_0x4b33a6['attributes']=_0x4b33a6['attributes'][_0xd380('0x72')]?_0x4b33a6[_0xd380('0x4e')]:_0x306621[_0xd380('0x5b')];_0x4b33a6[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0xf20a[_0xd380('0x48')]['sort']);_0x4b33a6[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0xf20a[_0xd380('0x48')],_0x306621[_0xd380('0x60')]));if(_0xf20a[_0xd380('0x48')]['filter']){_0x4b33a6[_0xd380('0x47')]=_[_0xd380('0x63')](_0x4b33a6['where'],{'$or':_[_0xd380('0x3b')](_0x4b33a6[_0xd380('0x4e')],function(_0x511992){var _0x31badd={};_0x31badd[_0x511992]={'$like':'%'+_0xf20a['query']['filter']+'%'};return _0x31badd;})});}_0x4b33a6=_[_0xd380('0x63')]({},_0x4b33a6,_0xf20a[_0xd380('0xde')]);return _0x53f4b1[_0xd380('0xef')](_0x4b33a6);}})[_0xd380('0x17')](function(_0x122aee){if(_0x122aee){_0x1eb399=_0x122aee['length'];if(!_0xf20a[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x4b33a6[_0xd380('0x29')]=qs[_0xd380('0x29')](_0xf20a['query'][_0xd380('0x29')]);_0x4b33a6[_0xd380('0x27')]=qs['offset'](_0xf20a[_0xd380('0x48')][_0xd380('0x27')]);}return _0x53f4b1['getFaxInteractions'](_0x4b33a6);}})[_0xd380('0x17')](function(_0x24dd40){if(_0x24dd40){return _0x24dd40?{'count':_0x1eb399,'rows':_0x24dd40}:null;}})[_0xd380('0x17')](respondWithResult(_0x817d9e,null))[_0xd380('0x22')](handleError(_0x817d9e,null));};exports[_0xd380('0xf1')]=function(_0x4f9422,_0xa81509){var _0x5b9443={};var _0x909760={};var _0x3695ba;var _0x42ea02;return db['User'][_0xd380('0x9e')]({'where':{'id':_0x4f9422[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0xa81509,null))['then'](function(_0x5c01fc){if(_0x5c01fc){_0x3695ba=_0x5c01fc;_0x909760[_0xd380('0x5b')]=_['keys'](db['WhatsappInteraction'][_0xd380('0x43')]);_0x909760[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x4f9422[_0xd380('0x48')]);_0x909760[_0xd380('0x60')]=_[_0xd380('0x61')](_0x909760[_0xd380('0x5b')],_0x909760['query']);_0x5b9443[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x909760[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x4f9422['query'][_0xd380('0x62')]));_0x5b9443[_0xd380('0x4e')]=_0x5b9443[_0xd380('0x4e')][_0xd380('0x72')]?_0x5b9443['attributes']:_0x909760[_0xd380('0x5b')];_0x5b9443[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0x4f9422[_0xd380('0x48')][_0xd380('0xdc')]);_0x5b9443[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x4f9422[_0xd380('0x48')],_0x909760[_0xd380('0x60')]));if(_0x4f9422[_0xd380('0x48')][_0xd380('0x39')]){_0x5b9443[_0xd380('0x47')]=_[_0xd380('0x63')](_0x5b9443[_0xd380('0x47')],{'$or':_[_0xd380('0x3b')](_0x5b9443[_0xd380('0x4e')],function(_0x441891){var _0x4e3e14={};_0x4e3e14[_0x441891]={'$like':'%'+_0x4f9422[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x4e3e14;})});}_0x5b9443=_[_0xd380('0x63')]({},_0x5b9443,_0x4f9422[_0xd380('0xde')]);return _0x3695ba[_0xd380('0xf1')](_0x5b9443);}})[_0xd380('0x17')](function(_0x54103b){if(_0x54103b){_0x42ea02=_0x54103b[_0xd380('0x72')];if(!_0x4f9422[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x5b9443['limit']=qs[_0xd380('0x29')](_0x4f9422[_0xd380('0x48')][_0xd380('0x29')]);_0x5b9443[_0xd380('0x27')]=qs[_0xd380('0x27')](_0x4f9422[_0xd380('0x48')]['offset']);}return _0x3695ba['getWhatsappInteractions'](_0x5b9443);}})['then'](function(_0x1e86a1){if(_0x1e86a1){return _0x1e86a1?{'count':_0x42ea02,'rows':_0x1e86a1}:null;}})['then'](respondWithResult(_0xa81509,null))[_0xd380('0x22')](handleError(_0xa81509,null));};exports['login']=function(_0x2c8d38,_0x33dbd9,_0x15a001){var _0x125a86;var _0x2c5925;var _0x4fa8ce;var _0x213da5=!_[_0xd380('0x6f')](_0x2c8d38['params']['id'])?_0x2c8d38['params']['id']:!_[_0xd380('0x6f')](_0x2c8d38['user']['id'])?_0x2c8d38['user']['id']:null;return db[_0xd380('0x42')]['find']({'where':{'id':_0x213da5,'role':{'$or':[_0xd380('0x34'),'user',_0xd380('0x2f')]}},'attributes':['id',_0xd380('0x3f'),_0xd380('0xf2'),'mobile',_0xd380('0x2e'),_0xd380('0x6a'),'loginInPause']})['then'](function(_0x26edcd){if(_0x26edcd){if(_0x26edcd['role']===_0xd380('0x2f')){_0x125a86=_0x26edcd;if(_0x2c8d38[_0xd380('0x66')]['interface']){_0x4fa8ce=util[_0xd380('0xb3')](_0xd380('0xf3'),_0x125a86[_0x2c8d38[_0xd380('0x66')][_0xd380('0xa6')]]);}else if(_0x2c8d38['body'][_0xd380('0xf4')]){_0x4fa8ce=util[_0xd380('0xb3')](_0xd380('0xb4'),_0x2c8d38[_0xd380('0x66')][_0xd380('0xf4')]);}else{_0x4fa8ce=util['format'](_0xd380('0xb4'),_0x125a86[_0xd380('0x3f')]);}socket['to'](util[_0xd380('0xb3')](_0xd380('0xf5'),_0x125a86[_0xd380('0x3f')]))[_0xd380('0x30')](_0xd380('0xf6'),{'user':{'id':_0x125a86['id'],'name':_0x125a86[_0xd380('0x3f')]},'ip':_0x2c8d38[_0xd380('0xf7')][_0xd380('0xf8')]||_0x2c8d38['connection'][_0xd380('0xf9')]||_0x2c8d38[_0xd380('0xfa')][_0xd380('0xf9')]||_0x2c8d38[_0xd380('0xfb')][_0xd380('0xfa')]['remoteAddress']});return db[_0xd380('0xb5')]['destroy']({'where':{'membername':_0x125a86['name']},'individualHooks':!![]});}}else{throw new db[(_0xd380('0x97'))][(_0xd380('0x98'))](_0xd380('0xfc'));}})[_0xd380('0x17')](function(){if(_0x125a86){return _0x125a86[_0xd380('0xfd')]({'raw':!![]});}})[_0xd380('0x17')](function(_0x41dde5){if(_0x125a86){if(_0x41dde5){_0x2c5925=_0x41dde5;if(_0x2c5925['length']){var _0x2e7b73=_0x2c5925[_0xd380('0x3b')](function(_0x1a3db7){var _0x4614d1={'membername':_0x125a86['name'],'UserId':_0x125a86['id'],'queue_name':_0x1a3db7[_0xd380('0x3f')],'VoiceQueueId':_0x1a3db7['id'],'interface':_0x4fa8ce,'paused':_0x125a86[_0xd380('0xa4')]||![],'penalty':_0x1a3db7['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0xd380('0xb6')](_0x4614d1);});return Promise[_0xd380('0x58')](_0x2e7b73);}}}})['then'](function(){if(_0x125a86){return db['MemberReport'][_0xd380('0x4f')]({'where':{'membername':_0x125a86[_0xd380('0x3f')],'exitAt':null}});}})[_0xd380('0x17')](function(_0xe356e0){if(_0x125a86){var _0x23dec8=[];_0xe356e0['forEach'](function(_0xa4259b){_0x23dec8['push'](_0xa4259b['update']({'exitAt':moment()[_0xd380('0xb3')](_0xd380('0xfe'))}));});return Promise[_0xd380('0x58')](_0x23dec8);}})[_0xd380('0x17')](function(){if(_0x125a86){var _0x3e5af4=[];var _0xf1f880=[];var _0x323ee0=utils[_0xd380('0xff')]();var _0x33b089={'membername':_0x125a86[_0xd380('0x3f')],'interface':_0x4fa8ce,'enterAt':moment()[_0xd380('0xb3')](_0xd380('0xfe')),'role':_0x125a86[_0xd380('0x2e')],'internal':_0x125a86[_0xd380('0x6a')]};_0x323ee0['forEach'](function(_0x2927e7){_0x3e5af4[_0xd380('0x52')](_['merge']({'channel':_0x2927e7,'type':'LOGIN','data1':_0x2c8d38['body'][_0xd380('0x100')],'data2':_0x4fa8ce},_0x33b089));if(_0x125a86[_0xd380('0xa4')]){_0xf1f880[_0xd380('0x52')](_['merge']({'channel':_0x2927e7,'type':'PAUSE','data1':_0xd380('0x101')},_0x33b089));}});return db['MemberReport'][_0xd380('0x90')](_0x3e5af4['concat'](_0xf1f880),{'individualHooks':!![]});}})['then'](function(){if(_0x125a86){return _0x125a86[_0xd380('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xd380('0xb3')](_0xd380('0xfe')),'voicePause':_0x125a86['loginInPause']||![],'mailPause':_0x125a86[_0xd380('0xa4')]||![],'chatPause':_0x125a86['loginInPause']||![],'faxPause':_0x125a86['loginInPause']||![],'smsPause':_0x125a86['loginInPause']||![],'openchannelPause':_0x125a86[_0xd380('0xa4')]||![],'whatsappPause':_0x125a86[_0xd380('0xa4')]||![],'pauseType':_0x125a86[_0xd380('0xa4')]?_0xd380('0x101'):null,'interface':_0x4fa8ce,'lastPauseAt':moment()[_0xd380('0xb3')](_0xd380('0xfe'))});}})[_0xd380('0x17')](function(_0x42266a){if(_0x2c8d38[_0xd380('0x102')]){return _0x15a001();}else{return Promise['resolve'](_0x42266a)[_0xd380('0x17')](respondWithResult(_0x33dbd9,null));}})[_0xd380('0x22')](handleError(_0x33dbd9,null));};exports['logout']=function(_0x21e0b6,_0x1208ba){var _0x3a267c;return db['User'][_0xd380('0x3e')]({'where':{'id':_0x21e0b6['params']['id'],'role':'agent'},'attributes':['id',_0xd380('0x3f'),_0xd380('0x2e')]})['then'](handleEntityNotFound(_0x1208ba,null))[_0xd380('0x17')](function(_0x22c8f0){if(_0x22c8f0){_0x3a267c=_0x22c8f0;return db['UserVoiceQueueRt'][_0xd380('0x32')]({'where':{'membername':_0x3a267c[_0xd380('0x3f')]},'individualHooks':!![]});}})[_0xd380('0x17')](function(){return db[_0xd380('0x103')][_0xd380('0x4f')]({'where':{'membername':_0x3a267c[_0xd380('0x3f')],'exitAt':null}});})['then'](function(_0x5576be){var _0xf41c8f=[];_0x5576be[_0xd380('0x104')](function(_0x35cd0a){_0xf41c8f['push'](_0x35cd0a['update']({'exitAt':moment()[_0xd380('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0xf41c8f);})[_0xd380('0x17')](function(){return _0x3a267c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd380('0x17')](respondWithResult(_0x1208ba,null))[_0xd380('0x22')](handleError(_0x1208ba,null));};exports['pause']=function(_0x1e7f82,_0x7ad824){var _0x56b639;return db[_0xd380('0xb5')][_0xd380('0x2d')]({'paused':0x1},{'where':{'UserId':_0x1e7f82[_0xd380('0x5a')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x1e7f82[_0xd380('0x5a')]['id'],'role':'agent'},'attributes':['id','name',_0xd380('0x2e'),_0xd380('0x6a'),_0xd380('0xa6'),_0xd380('0xb2')]});})['then'](handleEntityNotFound(_0x7ad824,null))['then'](function(_0x9c0bcc){if(_0x9c0bcc){_0x56b639=_0x9c0bcc;return respondWithRpcPromise(_0xd380('0x105'),_0xd380('0x106'),{'id':_0x56b639['id'],'name':_0x56b639[_0xd380('0x3f')],'pause':!![]});}})[_0xd380('0x17')](function(){if(_0x56b639){return db['MemberReport'][_0xd380('0x4f')]({'where':{'membername':_0x56b639[_0xd380('0x3f')],'type':'PAUSE','exitAt':null}});}})[_0xd380('0x17')](function(_0x264bbd){if(_0x264bbd[_0xd380('0x72')]){var _0x511b07=moment()[_0xd380('0xb3')](_0xd380('0xfe'));for(var _0xfb44fb=0x0,_0x4b9596=_0x264bbd[_0xd380('0x72')];_0xfb44fb<_0x4b9596;_0xfb44fb++){_0x264bbd[_0xfb44fb][_0xd380('0x107')]({'exitAt':_0x511b07});}}})[_0xd380('0x17')](function(){var _0x47fdda=[];var _0xdd5248=utils[_0xd380('0xff')]();_0xdd5248['forEach'](function(_0x223df3){_0x47fdda['push']({'channel':_0x223df3,'membername':_0x56b639[_0xd380('0x3f')],'interface':_[_0xd380('0x6f')](_0x56b639[_0xd380('0xa6')])?util[_0xd380('0xb3')]('SIP/%s',_0x56b639[_0xd380('0x3f')]):_0x56b639[_0xd380('0xa6')],'type':_0xd380('0x108'),'enterAt':moment()[_0xd380('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1e7f82['body']['type']||_0xd380('0x109'),'role':_0x56b639[_0xd380('0x2e')],'internal':_0x56b639['internal']});});return db[_0xd380('0x103')][_0xd380('0x90')](_0x47fdda,{'individualHooks':!![]});})[_0xd380('0x17')](function(){return _0x56b639['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1e7f82[_0xd380('0x66')][_0xd380('0x45')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd380('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x7ad824,null))[_0xd380('0x22')](handleError(_0x7ad824,null));};exports[_0xd380('0x10a')]=function(_0x217b8c,_0x1a0d37){if(_0x217b8c[_0xd380('0x66')][_0xd380('0xa3')]&&!utils['isValidChannel'](_0x217b8c[_0xd380('0x66')]['channel'])){throw new APIBadRequestError(util[_0xd380('0xb3')](_0xd380('0x10b'),_0x217b8c['body'][_0xd380('0xa3')]));}return db[_0xd380('0x42')][_0xd380('0x3e')]({'where':{'id':_0x217b8c[_0xd380('0x5a')]['id']},'attributes':['id',_0xd380('0x3f'),_0xd380('0x2e'),'internal',_0xd380('0xa6'),_0xd380('0xb2'),'voicePause',_0xd380('0x10c'),_0xd380('0x10d'),_0xd380('0x10e'),_0xd380('0x10f'),_0xd380('0x110'),_0xd380('0x111'),_0xd380('0x112'),'lastPauseAt']})[_0xd380('0x17')](function(_0x35e345){if(!_0x35e345){throw new APINotFoundError(util[_0xd380('0xb3')](_0xd380('0xd2'),_0x217b8c[_0xd380('0x5a')]['id']));}return _0x35e345[_0xd380('0x10a')](_0x217b8c[_0xd380('0x66')][_0xd380('0xa3')]);})[_0xd380('0x17')](respondWithResult(_0x1a0d37,null))[_0xd380('0x22')](APIHandleError(_0x1a0d37));};exports['getTeams']=function(_0x50f50b,_0x7ca7d6){var _0x194ae9={};var _0x5b333f={};var _0x2a6ad2;var _0x34aed4;return db[_0xd380('0x42')][_0xd380('0x9e')]({'where':{'id':_0x50f50b[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x7ca7d6,null))[_0xd380('0x17')](function(_0x5adbf3){if(_0x5adbf3){_0x2a6ad2=_0x5adbf3;_0x5b333f['model']=_['keys'](db[_0xd380('0x113')]['rawAttributes']);_0x5b333f[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x50f50b[_0xd380('0x48')]);_0x5b333f['filters']=_[_0xd380('0x61')](_0x5b333f[_0xd380('0x5b')],_0x5b333f[_0xd380('0x48')]);_0x194ae9[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x5b333f[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x50f50b[_0xd380('0x48')][_0xd380('0x62')]));_0x194ae9[_0xd380('0x4e')]=_0x194ae9[_0xd380('0x4e')][_0xd380('0x72')]?_0x194ae9[_0xd380('0x4e')]:_0x5b333f[_0xd380('0x5b')];_0x194ae9[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0x50f50b[_0xd380('0x48')][_0xd380('0xdc')]);_0x194ae9[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x50f50b[_0xd380('0x48')],_0x5b333f[_0xd380('0x60')]));if(_0x50f50b[_0xd380('0x48')][_0xd380('0x39')]){_0x194ae9[_0xd380('0x47')]=_[_0xd380('0x63')](_0x194ae9[_0xd380('0x47')],{'$or':_[_0xd380('0x3b')](_0x194ae9[_0xd380('0x4e')],function(_0x4413bc){var _0x104f58={};_0x104f58[_0x4413bc]={'$like':'%'+_0x50f50b[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x104f58;})});}_0x194ae9=_[_0xd380('0x63')]({},_0x194ae9,_0x50f50b['options']);return _0x2a6ad2[_0xd380('0x114')](_0x194ae9);}})[_0xd380('0x17')](function(_0x36b742){if(_0x36b742){_0x34aed4=_0x36b742['length'];if(!_0x50f50b[_0xd380('0x48')][_0xd380('0xd4')](_0xd380('0xe0'))){_0x194ae9[_0xd380('0x29')]=qs['limit'](_0x50f50b[_0xd380('0x48')][_0xd380('0x29')]);_0x194ae9['offset']=qs[_0xd380('0x27')](_0x50f50b[_0xd380('0x48')]['offset']);}return _0x2a6ad2['getTeams'](_0x194ae9);}})[_0xd380('0x17')](function(_0x595f79){if(_0x595f79){return _0x595f79?{'count':_0x34aed4,'rows':_0x595f79}:null;}})[_0xd380('0x17')](respondWithResult(_0x7ca7d6,null))[_0xd380('0x22')](handleError(_0x7ca7d6,null));};exports[_0xd380('0x115')]=function(_0x54496e,_0x3d023a){var _0x406a45=_0x54496e[_0xd380('0x5a')]['id'];var _0x1aa1cb=_0x54496e[_0xd380('0x66')]?_0x54496e[_0xd380('0x66')][_0xd380('0x69')]:null;var _0x29f0eb=[];return Promise[_0xd380('0x116')]()[_0xd380('0x17')](function(){if(!_0x1aa1cb)throw new APIBadRequestError(_0xd380('0x117'));})[_0xd380('0x17')](function(){return db['User'][_0xd380('0x9e')]({'where':{'id':_0x406a45}});})[_0xd380('0x17')](function(_0x7b1271){if(!_0x7b1271)throw new APINotFoundError(util[_0xd380('0xb3')](_0xd380('0xd2'),_0x54496e['params']['id']));return db['sequelize'][_0xd380('0x118')](function(_0xd8e52e){return _0x7b1271[_0xd380('0x115')](_0x1aa1cb,{'transaction':_0xd8e52e})[_0xd380('0x17')](function(){return db['Team'][_0xd380('0x4f')]({'where':{'id':{'$in':_0x1aa1cb}}});})[_0xd380('0x17')](function(_0x19299d){var _0x4f888d=_[_0xd380('0x3b')](_0x19299d,function(_0x3c3027){return _0x3c3027[_0xd380('0x119')]();});return Promise[_0xd380('0x58')](_0x4f888d);})[_0xd380('0x17')](function(_0x2ba4a0){_0x29f0eb=_[_0xd380('0x11a')](_0x2ba4a0);var _0x549548=_['map'](_0x29f0eb,function(_0x5da2dd){return _0x5da2dd[_0xd380('0x11b')](_0x7b1271['id'],{'transaction':_0xd8e52e});});return Promise[_0xd380('0x58')](_0x549548);})[_0xd380('0x17')](function(){if(!_0x7b1271[_0xd380('0xb2')])return;var _0x55d998=_[_0xd380('0x39')](_0x29f0eb,function(_0x3622b5){return _0x3622b5[_0xd380('0x11c')](_0xd380('0xa3'))===_0xd380('0x11d');});var _0x3df04b=_['map'](_0x55d998,function(_0x2d6c4b){return db['UserVoiceQueueRt'][_0xd380('0xb6')]({'membername':_0x7b1271['name'],'UserId':_0x7b1271['id'],'queue_name':_0x2d6c4b[_0xd380('0x3f')],'VoiceQueueId':_0x2d6c4b['id'],'interface':_[_0xd380('0x6f')](_0x7b1271[_0xd380('0xa6')])?util[_0xd380('0xb3')](_0xd380('0xb4'),_0x7b1271[_0xd380('0x3f')]):_0x7b1271[_0xd380('0xa6')],'paused':_0x7b1271[_0xd380('0xa5')]||![],'penalty':_0x7b1271['penalty']},{'transaction':_0xd8e52e});});return Promise[_0xd380('0x58')](_0x3df04b);})['then'](function(){return db[_0xd380('0x11e')]['findAll']({'where':{'teamId':{'$in':_0x1aa1cb}}});})[_0xd380('0x17')](function(_0x235db6){var _0x281f53=_[_0xd380('0x3b')](_0x235db6,function(_0x2d4c31){return db['UserVoicePrefix']['create']({'UserId':_0x7b1271['id'],'VoicePrefixId':_0x2d4c31['VoicePrefixId']},{'transaction':_0xd8e52e});});return Promise['all'](_0x281f53);});});})['then'](function(){for(var _0x30ee25=0x0;_0x30ee25<_0x29f0eb['length'];_0x30ee25++){var _0x3ada99=_0x29f0eb[_0x30ee25][_0xd380('0x11c')](_0xd380('0xa3'));var _0x223c16=_0x3ada99+_0xd380('0xae');socket[_0xd380('0x30')](_0xd380('0x36')+_0x3ada99+_0xd380('0xaf'),{'UserId':_0x406a45,['queueField']:_0x29f0eb[_0x30ee25]['id']});}})[_0xd380('0x17')](respondWithStatusCode(_0x3d023a,null))[_0xd380('0x22')](APIHandleError(_0x3d023a));};exports[_0xd380('0x11f')]=function(_0x1b4adc,_0x5eaab3){var _0x1c2d53=_0x1b4adc[_0xd380('0x5a')]['id'];var _0x17df3c=null;if(_0x1b4adc[_0xd380('0x48')][_0xd380('0x69')]){_0x17df3c=_[_0xd380('0xba')](_0x1b4adc[_0xd380('0x48')][_0xd380('0x69')])?_0x1b4adc[_0xd380('0x48')][_0xd380('0x69')]:[_0x1b4adc[_0xd380('0x48')][_0xd380('0x69')]];}var _0xa52940=[];return Promise[_0xd380('0x116')]()[_0xd380('0x17')](function(){if(!_0x17df3c)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd380('0x17')](function(){return db['User'][_0xd380('0x9e')]({'where':{'id':_0x1c2d53}});})[_0xd380('0x17')](function(_0x23e79c){if(!_0x23e79c)throw new APINotFoundError(util['format'](_0xd380('0xd2'),_0x1b4adc[_0xd380('0x5a')]['id']));return db[_0xd380('0x120')][_0xd380('0x118')](function(_0x6d5794){return _0x23e79c['removeTeams'](_0x17df3c,{'transaction':_0x6d5794})[_0xd380('0x17')](function(){return db['Team'][_0xd380('0x4f')]({'where':{'id':{'$in':_0x17df3c}}});})[_0xd380('0x17')](function(_0x5a14bb){var _0x4a68e8=_['map'](_0x5a14bb,function(_0x1746fc){return _0x1746fc[_0xd380('0x119')]();});return Promise[_0xd380('0x58')](_0x4a68e8);})[_0xd380('0x17')](function(_0x57da25){_0xa52940=_[_0xd380('0x11a')](_0x57da25);var _0x5bfaec=_[_0xd380('0x3b')](_0xa52940,function(_0x59052a){return _0x59052a[_0xd380('0x121')](_0x23e79c['id'],{'transaction':_0x6d5794});});return Promise[_0xd380('0x58')](_0x5bfaec);})[_0xd380('0x17')](function(){if(!_0x23e79c[_0xd380('0xb2')])return;var _0x5cda61=_[_0xd380('0x39')](_0xa52940,function(_0x39b47c){return _0x39b47c[_0xd380('0x11c')]('channel')===_0xd380('0x11d');});var _0x2de13e=_[_0xd380('0x3b')](_0x5cda61,function(_0x138420){return db[_0xd380('0xb5')][_0xd380('0x32')]({'where':{'VoiceQueueId':_0x138420['id'],'UserId':_0x23e79c['id']},'transaction':_0x6d5794});});return Promise[_0xd380('0x58')](_0x2de13e);})[_0xd380('0x17')](function(){return db[_0xd380('0x11e')][_0xd380('0x4f')]({'where':{'teamId':{'$in':_0x17df3c}}});})[_0xd380('0x17')](function(_0x4cf7ab){var _0x1cbf0d=_[_0xd380('0x3b')](_0x4cf7ab,function(_0x49f596){return db['UserVoicePrefix'][_0xd380('0x32')]({'where':{'UserId':_0x23e79c['id'],'VoicePrefixId':_0x49f596[_0xd380('0x122')]}},{'transaction':_0x6d5794});});return Promise[_0xd380('0x58')](_0x1cbf0d);});});})['then'](function(){for(var _0x33a0d9=0x0;_0x33a0d9<_0xa52940[_0xd380('0x72')];_0x33a0d9++){var _0xcfda43=_0xa52940[_0x33a0d9][_0xd380('0x11c')](_0xd380('0xa3'));var _0x460be7=_0xcfda43+_0xd380('0xae');socket['emit']('user'+_0xcfda43+_0xd380('0xbb'),{'UserId':_0x1c2d53,['queueField']:_0xa52940[_0x33a0d9]['id']});}})[_0xd380('0x17')](respondWithStatusCode(_0x5eaab3,null))[_0xd380('0x22')](APIHandleError(_0x5eaab3));};exports[_0xd380('0x123')]=function(_0x1fcbc8,_0x1faf9b){var _0x5f5996={};var _0x5292fd={};var _0x1023f5;var _0x48b6f5;return db['User'][_0xd380('0x9e')]({'where':{'id':_0x1fcbc8[_0xd380('0x5a')]['id']}})[_0xd380('0x17')](handleEntityNotFound(_0x1faf9b,null))[_0xd380('0x17')](function(_0x1e7e9e){if(_0x1e7e9e){_0x1023f5=_0x1e7e9e;_0x5292fd[_0xd380('0x5b')]=_[_0xd380('0x5d')](db[_0xd380('0x124')][_0xd380('0x43')]);_0x5292fd[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x1fcbc8[_0xd380('0x48')]);_0x5292fd[_0xd380('0x60')]=_[_0xd380('0x61')](_0x5292fd['model'],_0x5292fd[_0xd380('0x48')]);_0x5f5996[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x5292fd['model'],qs[_0xd380('0x62')](_0x1fcbc8[_0xd380('0x48')]['fields']));_0x5f5996[_0xd380('0x4e')]=_0x5f5996[_0xd380('0x4e')][_0xd380('0x72')]?_0x5f5996[_0xd380('0x4e')]:_0x5292fd[_0xd380('0x5b')];_0x5f5996['order']=qs['sort'](_0x1fcbc8[_0xd380('0x48')][_0xd380('0xdc')]);_0x5f5996[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x1fcbc8[_0xd380('0x48')],_0x5292fd[_0xd380('0x60')]));if(_0x1fcbc8['query'][_0xd380('0x39')]){_0x5f5996[_0xd380('0x47')]=_['merge'](_0x5f5996['where'],{'$or':_[_0xd380('0x3b')](_0x5f5996[_0xd380('0x4e')],function(_0x28bf2e){var _0x1ef295={};_0x1ef295[_0x28bf2e]={'$like':'%'+_0x1fcbc8[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x1ef295;})});}_0x5f5996=_[_0xd380('0x63')]({},_0x5f5996,_0x1fcbc8[_0xd380('0xde')]);return _0x1023f5[_0xd380('0x123')](_0x5f5996);}})[_0xd380('0x17')](function(_0xdca4f3){if(_0xdca4f3){_0x48b6f5=_0xdca4f3[_0xd380('0x72')];if(!_0x1fcbc8['query'][_0xd380('0xd4')](_0xd380('0xe0'))){_0x5f5996[_0xd380('0x29')]=qs['limit'](_0x1fcbc8[_0xd380('0x48')][_0xd380('0x29')]);_0x5f5996[_0xd380('0x27')]=qs[_0xd380('0x27')](_0x1fcbc8[_0xd380('0x48')][_0xd380('0x27')]);}return _0x1023f5[_0xd380('0x123')](_0x5f5996);}})[_0xd380('0x17')](function(_0x3faeb4){if(_0x3faeb4){return _0x3faeb4?{'count':_0x48b6f5,'rows':_0x3faeb4}:null;}})[_0xd380('0x17')](respondWithResult(_0x1faf9b,null))[_0xd380('0x22')](handleError(_0x1faf9b,null));};exports[_0xd380('0x125')]=function(_0x1b23b9,_0x36893f){var _0x399ead={};var _0x4e8b7c={};var _0x3ab18c;return db['User'][_0xd380('0x9e')]({'where':{'id':_0x1b23b9[_0xd380('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36893f,null))[_0xd380('0x17')](function(_0x5903a4){if(_0x5903a4){_0x3ab18c=_0x5903a4;_0x4e8b7c[_0xd380('0x5b')]=_[_0xd380('0x5d')](db['User'][_0xd380('0x43')]);_0x4e8b7c[_0xd380('0x48')]=_[_0xd380('0x5d')](_0x1b23b9['query']);_0x4e8b7c['filters']=_[_0xd380('0x61')](_0x4e8b7c[_0xd380('0x5b')],_0x4e8b7c[_0xd380('0x48')]);_0x399ead[_0xd380('0x4e')]=_[_0xd380('0x61')](_0x4e8b7c[_0xd380('0x5b')],qs[_0xd380('0x62')](_0x1b23b9['query'][_0xd380('0x62')]));_0x399ead[_0xd380('0x4e')]=_0x399ead['attributes'][_0xd380('0x72')]?_0x399ead['attributes']:_0x4e8b7c[_0xd380('0x5b')];_0x399ead[_0xd380('0xe1')]=qs[_0xd380('0xdc')](_0x1b23b9[_0xd380('0x48')][_0xd380('0xdc')]);_0x399ead[_0xd380('0x47')]=qs[_0xd380('0x60')](_[_0xd380('0xdd')](_0x1b23b9['query'],_0x4e8b7c[_0xd380('0x60')]));if(_0x1b23b9['query'][_0xd380('0x39')]){_0x399ead[_0xd380('0x47')]=_['merge'](_0x399ead[_0xd380('0x47')],{'$or':_['map'](_0x399ead[_0xd380('0x4e')],function(_0x536a41){var _0x5ea3d9={};_0x5ea3d9[_0x536a41]={'$like':'%'+_0x1b23b9[_0xd380('0x48')][_0xd380('0x39')]+'%'};return _0x5ea3d9;})});}_0x399ead[_0xd380('0x5b')]=db[_0xd380('0x42')];_0x399ead['as']=_0xd380('0x93');_0x399ead=_[_0xd380('0x63')]({},_0x399ead,_0x1b23b9[_0xd380('0xde')]);return _0x3ab18c[_0xd380('0xfd')]({'include':[_0x399ead]});}})[_0xd380('0x17')](function(_0x3c79e0){if(_0x3c79e0){var _0x27bbe0={},_0x54bf1b=[];for(var _0x2e9e8e=0x0;_0x2e9e8e<_0x3c79e0[_0xd380('0x72')];_0x2e9e8e+=0x1){for(var _0x25d6e6=0x0,_0x6c527f;_0x25d6e6<_0x3c79e0[_0x2e9e8e][_0xd380('0x93')][_0xd380('0x72')];_0x25d6e6+=0x1){_0x6c527f=_0x3c79e0[_0x2e9e8e][_0xd380('0x93')][_0x25d6e6][_0xd380('0x33')]({'plain':!![]});_0x27bbe0[_0x6c527f['id']]=_0x6c527f;}}_0x27bbe0=_[_0xd380('0x126')](_0x27bbe0);for(var _0x5867ea=qs[_0xd380('0x27')](_0x1b23b9[_0xd380('0x48')][_0xd380('0x27')]);_0x5867ea<_0x27bbe0[_0xd380('0x72')]&&_0x54bf1b[_0xd380('0x72')]=_0x512291[_0x9ec1('0x4d')]){throw new Error(_0x9ec1('0x4e'));}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return db['UserVoiceQueueRt'][_0x9ec1('0x4f')]({'where':{'membername':_0x1ceab7[_0x9ec1('0x24')]},'individualHooks':!![]});}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return _0x1ceab7['getVoiceQueues']({'raw':!![]});}})[_0x9ec1('0x15')](function(_0x1cecf2){if(_0x1ceab7){if(_0x1cecf2){var _0x83bdae=[];_0x4f6802=_0x1cecf2;if(_0x4f6802[_0x9ec1('0x26')]){for(var _0x4d4894=0x0;_0x4d4894<_0x4f6802['length'];_0x4d4894++){_0x83bdae['push'](db['UserVoiceQueueRt'][_0x9ec1('0x50')]({'membername':_0x1ceab7[_0x9ec1('0x24')],'UserId':_0x1ceab7['id'],'queue_name':_0x4f6802[_0x4d4894]['name'],'VoiceQueueId':_0x4f6802[_0x4d4894]['id'],'interface':_0x465344,'paused':_0x1ceab7[_0x9ec1('0x48')]||![],'penalty':_0x4f6802[_0x4d4894][_0x9ec1('0x51')]||0x0}));}return BPromise[_0x9ec1('0x45')](_0x83bdae);}}}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return db[_0x9ec1('0x33')]['findAll']({'where':{'membername':_0x1ceab7['name'],'exitAt':null}});}})['then'](function(_0x5dcd6a){if(_0x1ceab7){if(_0x5dcd6a&&_0x5dcd6a[_0x9ec1('0x26')]){var _0x3f4c6c=[];_0x5dcd6a[_0x9ec1('0x44')](function(_0x13f701){_0x3f4c6c['push'](_0x13f701[_0x9ec1('0x23')]({'exitAt':moment()[_0x9ec1('0x2c')](_0x9ec1('0x27'))}));});return BPromise[_0x9ec1('0x45')](_0x3f4c6c);}}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){var _0x432c3b=[];var _0x2f4984=[];var _0x25367c=utils[_0x9ec1('0x29')]();var _0x3393a3={'membername':_0x1ceab7[_0x9ec1('0x24')],'interface':_0x465344,'enterAt':moment()[_0x9ec1('0x2c')](_0x9ec1('0x27')),'role':_0x1ceab7['role'],'internal':_0x1ceab7['internal']};_0x25367c[_0x9ec1('0x44')](function(_0x1208b8){_0x432c3b['push'](_[_0x9ec1('0x52')]({'channel':_0x1208b8,'type':_0x9ec1('0x53'),'data1':_0x9ec1('0x54'),'data2':_0x465344},_0x3393a3));if(_0x1ceab7[_0x9ec1('0x48')]){_0x2f4984[_0x9ec1('0x2a')](_[_0x9ec1('0x52')]({'channel':_0x1208b8,'type':_0x9ec1('0x25'),'data1':_0x9ec1('0x55')},_0x3393a3));}});return db[_0x9ec1('0x33')][_0x9ec1('0x56')](_0x432c3b[_0x9ec1('0x57')](_0x2f4984),{'individualHooks':!![]});}})[_0x9ec1('0x15')](function(){if(_0x1ceab7){return _0x1ceab7['update']({'online':!![],'lastLoginAt':moment()['format'](_0x9ec1('0x27')),'voicePause':_0x1ceab7['loginInPause']||![],'mailPause':_0x1ceab7[_0x9ec1('0x48')]||![],'chatPause':_0x1ceab7['loginInPause']||![],'faxPause':_0x1ceab7[_0x9ec1('0x48')]||![],'smsPause':_0x1ceab7[_0x9ec1('0x48')]||![],'openchannelPause':_0x1ceab7[_0x9ec1('0x48')]||![],'pauseType':_0x1ceab7[_0x9ec1('0x48')]?_0x9ec1('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x465344});}})['then'](function(_0x3292aa){_0x3ec2c3(_0x3292aa);})[_0x9ec1('0x19')](function(_0x22de08){_0x570a71(_0x3c5393[_0x9ec1('0x1a')](0x1f4,_0x22de08['message']));});});}; \ No newline at end of file +var _0x4434=['forEach','isNil','type','DEFAULT\x20PAUSE','internal','body','uniqueid','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','push','all','catch','LoginUser','mobile','phone','count','agent','../../config/license/util','agents','loginInPause','merge','LOGIN','callysquare','concat','lodash','util','bluebird','ioredis','../../config/logger','rpc','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','attributes','limit','include','map','model','then','debug','stringify','error','message','ShowUser','where','PauseUser','find','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','getChannels'];(function(_0x36fb3e,_0xd9f3a5){var _0x257cfd=function(_0x253fc4){while(--_0x253fc4){_0x36fb3e['push'](_0x36fb3e['shift']());}};_0x257cfd(++_0xd9f3a5);}(_0x4434,0x7b));var _0x4443=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4434[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var moment=require('moment');var BPromise=require(_0x4443('0x2'));var Redis=require(_0x4443('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4443('0x4'))(_0x4443('0x5'));var config=require('../../config/environment');config[_0x4443('0x6')]=_[_0x4443('0x7')](config[_0x4443('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x4443('0x8'))(new Redis(config[_0x4443('0x6')]));require(_0x4443('0x9'))[_0x4443('0xa')](socket);exports[_0x4443('0xb')]=function(_0x2ab9ec){var _0x769ccd=this;return new Promise(function(_0xa7ff07,_0x155b45){return db[_0x4443('0xc')][_0x4443('0xd')]({'raw':_0x2ab9ec[_0x4443('0xe')]?_0x2ab9ec[_0x4443('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x2ab9ec[_0x4443('0xe')]?_0x2ab9ec[_0x4443('0xe')]['where']||null:null,'attributes':_0x2ab9ec['options']?_0x2ab9ec[_0x4443('0xe')][_0x4443('0xf')]||null:null,'limit':_0x2ab9ec[_0x4443('0xe')]?_0x2ab9ec[_0x4443('0xe')][_0x4443('0x10')]||null:null,'include':_0x2ab9ec[_0x4443('0xe')]?_0x2ab9ec[_0x4443('0xe')]['include']?_['map'](_0x2ab9ec['options'][_0x4443('0x11')],function(_0x50801e){return{'model':db[_0x50801e['model']],'as':_0x50801e['as'],'attributes':_0x50801e[_0x4443('0xf')],'include':_0x50801e['include']?_[_0x4443('0x12')](_0x50801e['include'],function(_0x33f271){return{'model':db[_0x33f271['model']],'as':_0x33f271['as'],'attributes':_0x33f271[_0x4443('0xf')],'include':_0x33f271[_0x4443('0x11')]?_[_0x4443('0x12')](_0x33f271[_0x4443('0x11')],function(_0x4f1816){return{'model':db[_0x4f1816[_0x4443('0x13')]],'as':_0x4f1816['as'],'attributes':_0x4f1816[_0x4443('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4443('0x14')](function(_0x272ba9){logger['info'](_0x4443('0xb'),_0x2ab9ec);logger[_0x4443('0x15')](_0x4443('0xb'),_0x2ab9ec,JSON[_0x4443('0x16')](_0x272ba9));_0xa7ff07(_0x272ba9);})['catch'](function(_0x10e87a){logger[_0x4443('0x17')]('GetUser',_0x10e87a['message'],_0x2ab9ec);_0x155b45(_0x769ccd[_0x4443('0x17')](0x1f4,_0x10e87a[_0x4443('0x18')]));});});};exports[_0x4443('0x19')]=function(_0x5d4aca){var _0x3cdf3a=this;return new Promise(function(_0x8e3851,_0x366b9a){return db[_0x4443('0xc')]['find']({'raw':_0x5d4aca[_0x4443('0xe')]?_0x5d4aca[_0x4443('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x5d4aca['options']?_0x5d4aca['options'][_0x4443('0x1a')]||null:null,'attributes':_0x5d4aca[_0x4443('0xe')]?_0x5d4aca['options'][_0x4443('0xf')]||null:null,'include':_0x5d4aca[_0x4443('0xe')]?_0x5d4aca[_0x4443('0xe')][_0x4443('0x11')]?_[_0x4443('0x12')](_0x5d4aca[_0x4443('0xe')][_0x4443('0x11')],function(_0x3619a4){return{'model':db[_0x3619a4[_0x4443('0x13')]],'as':_0x3619a4['as'],'attributes':_0x3619a4[_0x4443('0xf')],'include':_0x3619a4[_0x4443('0x11')]?_[_0x4443('0x12')](_0x3619a4[_0x4443('0x11')],function(_0x50acb6){return{'model':db[_0x50acb6[_0x4443('0x13')]],'as':_0x50acb6['as'],'attributes':_0x50acb6[_0x4443('0xf')],'include':_0x50acb6['include']?_['map'](_0x50acb6[_0x4443('0x11')],function(_0x162c73){return{'model':db[_0x162c73[_0x4443('0x13')]],'as':_0x162c73['as'],'attributes':_0x162c73[_0x4443('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4443('0x14')](function(_0x1d381e){logger['info'](_0x4443('0x19'),_0x5d4aca);logger[_0x4443('0x15')](_0x4443('0x19'),_0x5d4aca,JSON[_0x4443('0x16')](_0x1d381e));_0x8e3851(_0x1d381e);})['catch'](function(_0x4b1df7){logger[_0x4443('0x17')]('ShowUser',_0x4b1df7[_0x4443('0x18')],_0x5d4aca);_0x366b9a(_0x3cdf3a[_0x4443('0x17')](0x1f4,_0x4b1df7[_0x4443('0x18')]));});});};exports[_0x4443('0x1b')]=function(_0xbf88d2){var _0x47c5ed;return db[_0x4443('0xc')][_0x4443('0x1c')]({'where':_0xbf88d2[_0x4443('0xe')][_0x4443('0x1a')]||{},'attributes':['id',_0x4443('0x1d'),_0x4443('0x1e'),'internal',_0x4443('0x1f')]})[_0x4443('0x14')](function(_0x2125c3){if(!_0x2125c3){throw new Error(util[_0x4443('0x20')](_0x4443('0x21'),_0xbf88d2[_0x4443('0x22')]['id']));}_0x47c5ed=_0x2125c3;return db['UserVoiceQueueRt'][_0x4443('0x23')]({'paused':0x1},{'where':{'UserId':_0x47c5ed['id']},'individualHooks':!![]});})[_0x4443('0x14')](function(){return db[_0x4443('0x24')]['findAll']({'where':{'membername':_0x47c5ed['name'],'type':_0x4443('0x25'),'exitAt':null}});})['then'](function(_0x715471){if(_0x715471&&_0x715471[_0x4443('0x26')]){var _0x3cc27f=moment()[_0x4443('0x20')](_0x4443('0x27'));for(var _0x152166=0x0,_0x470581=_0x715471[_0x4443('0x26')];_0x152166<_0x470581;_0x152166++){_0x715471[_0x152166]['updateAttributes']({'exitAt':_0x3cc27f});}}})[_0x4443('0x14')](function(){var _0x1f78e5=[];var _0x4dae9d=utils[_0x4443('0x28')]();_0x4dae9d[_0x4443('0x29')](function(_0x4cfb5c){_0x1f78e5['push']({'channel':_0x4cfb5c,'membername':_0x47c5ed[_0x4443('0x1d')],'interface':_[_0x4443('0x2a')](_0x47c5ed[_0x4443('0x1f')])?util['format']('SIP/%s',_0x47c5ed[_0x4443('0x1d')]):_0x47c5ed[_0x4443('0x1f')],'type':'PAUSE','enterAt':moment()['format'](_0x4443('0x27')),'data1':_0xbf88d2['body'][_0x4443('0x2b')]||_0x4443('0x2c'),'role':_0x47c5ed[_0x4443('0x1e')],'internal':_0x47c5ed[_0x4443('0x2d')],'uniqueid':_0xbf88d2[_0x4443('0x2e')][_0x4443('0x2f')]||null});});return db[_0x4443('0x24')][_0x4443('0x30')](_0x1f78e5,{'individualHooks':!![]});})[_0x4443('0x14')](function(){return _0x47c5ed[_0x4443('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xbf88d2[_0x4443('0x2e')][_0x4443('0x2b')]||_0x4443('0x2c'),'lastPauseAt':moment()[_0x4443('0x20')](_0x4443('0x27'))});})['catch'](function(_0x4b2fe3){throw _0x4b2fe3;});};exports[_0x4443('0x31')]=function(_0x5ddf6a){return Promise[_0x4443('0x32')]()[_0x4443('0x14')](function(){if(_0x5ddf6a[_0x4443('0x2e')][_0x4443('0x33')]&&!utils[_0x4443('0x34')](_0x5ddf6a[_0x4443('0x2e')][_0x4443('0x33')])){throw new Error(util[_0x4443('0x20')](_0x4443('0x35'),_0x5ddf6a[_0x4443('0x2e')][_0x4443('0x33')]));}return db['User'][_0x4443('0x36')]({'where':_0x5ddf6a[_0x4443('0xe')][_0x4443('0x1a')]||{},'attributes':['id',_0x4443('0x1d'),'role',_0x4443('0x2d'),_0x4443('0x1f'),_0x4443('0x37'),_0x4443('0x38'),_0x4443('0x39'),'chatPause','faxPause',_0x4443('0x3a'),_0x4443('0x3b'),_0x4443('0x3c'),_0x4443('0x3d'),'lastPauseAt']});})[_0x4443('0x14')](function(_0x4b78ac){if(!_0x4b78ac){throw new Error(util[_0x4443('0x20')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5ddf6a[_0x4443('0x22')]['id']));}return _0x4b78ac[_0x4443('0x3e')](_0x5ddf6a[_0x4443('0x2e')][_0x4443('0x33')],_0x4443('0x3f'));})['catch'](function(_0x27d6c){throw _0x27d6c;});};exports[_0x4443('0x40')]=function(_0x5d36dd){var _0x5e8ba9=this;return new Promise(function(_0x24e5e2,_0xf5f1b8){var _0x17134c;return db['User'][_0x4443('0x36')]({'where':_0x5d36dd[_0x4443('0xe')]['where']||{},'attributes':['id',_0x4443('0x1d')]})[_0x4443('0x14')](function(_0x151536){if(_0x151536){_0x17134c=_0x151536;return db[_0x4443('0x41')][_0x4443('0x42')]({'where':{'membername':_0x17134c['name']},'individualHooks':!![]});}})['then'](function(){if(_0x17134c){return db[_0x4443('0x24')][_0x4443('0xd')]({'where':{'membername':_0x17134c[_0x4443('0x1d')],'exitAt':null}});}})[_0x4443('0x14')](function(_0x236d56){if(_0x17134c){if(_0x236d56&&_0x236d56[_0x4443('0x26')]){var _0x3df36d=[];_0x236d56[_0x4443('0x29')](function(_0xfd4866){_0x3df36d[_0x4443('0x43')](_0xfd4866[_0x4443('0x23')]({'exitAt':moment()[_0x4443('0x20')](_0x4443('0x27'))}));});return BPromise[_0x4443('0x44')](_0x3df36d);}}})[_0x4443('0x14')](function(){if(_0x17134c){return _0x17134c[_0x4443('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4443('0x14')](function(_0x4fcea6){_0x24e5e2(_0x4fcea6);})[_0x4443('0x45')](function(_0x25d009){_0xf5f1b8(_0x5e8ba9[_0x4443('0x17')](0x1f4,_0x25d009[_0x4443('0x18')]));});});};exports[_0x4443('0x46')]=function(_0xf3b5d0){var _0x285ac2=this;return new Promise(function(_0x394808,_0x488359){var _0x2b0f0f;var _0x2e4ba8;var _0x4834cb;var _0x3f1188;return db[_0x4443('0xc')][_0x4443('0x36')]({'where':_0xf3b5d0['options'][_0x4443('0x1a')]||{},'attributes':['id',_0x4443('0x1d'),_0x4443('0x1e'),_0x4443('0x47'),_0x4443('0x48'),_0x4443('0x2d'),'loginInPause',_0x4443('0x1f')]})[_0x4443('0x14')](function(_0x506790){if(_0x506790){_0x2b0f0f=_0x506790;_0x3f1188=_0xf3b5d0[_0x4443('0x2e')][_0x4443('0x1f')]?_0xf3b5d0['body'][_0x4443('0x1f')]:util[_0x4443('0x20')]('SIP/%s',_0x2b0f0f[_0x4443('0x1d')]);return db[_0x4443('0xc')][_0x4443('0x49')]({'where':{'role':_0x4443('0x4a'),'online':!![],'id':{'$ne':_0x2b0f0f['id']}}});}})['then'](function(_0x517179){if(_0x517179){_0x4834cb=_0x517179;return require(_0x4443('0x4b'))['getLicense']();}})[_0x4443('0x14')](function(_0x58614e){if(_0x58614e&&_0x58614e[_0x4443('0x4c')]&&_0x4834cb>=_0x58614e['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4443('0x14')](function(){if(_0x2b0f0f){return db[_0x4443('0x41')][_0x4443('0x42')]({'where':{'membername':_0x2b0f0f['name']},'individualHooks':!![]});}})[_0x4443('0x14')](function(){if(_0x2b0f0f){return _0x2b0f0f['getVoiceQueues']({'raw':!![]});}})[_0x4443('0x14')](function(_0x37dfa4){if(_0x2b0f0f){if(_0x37dfa4){var _0x5a0e50=[];_0x2e4ba8=_0x37dfa4;if(_0x2e4ba8[_0x4443('0x26')]){for(var _0x146a19=0x0;_0x146a19<_0x2e4ba8[_0x4443('0x26')];_0x146a19++){_0x5a0e50[_0x4443('0x43')](db[_0x4443('0x41')]['upsert']({'membername':_0x2b0f0f[_0x4443('0x1d')],'UserId':_0x2b0f0f['id'],'queue_name':_0x2e4ba8[_0x146a19][_0x4443('0x1d')],'VoiceQueueId':_0x2e4ba8[_0x146a19]['id'],'interface':_0x3f1188,'paused':_0x2b0f0f[_0x4443('0x4d')]||![],'penalty':_0x2e4ba8[_0x146a19]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x5a0e50);}}}})[_0x4443('0x14')](function(){if(_0x2b0f0f){return db[_0x4443('0x24')][_0x4443('0xd')]({'where':{'membername':_0x2b0f0f[_0x4443('0x1d')],'exitAt':null}});}})[_0x4443('0x14')](function(_0xcfc251){if(_0x2b0f0f){if(_0xcfc251&&_0xcfc251[_0x4443('0x26')]){var _0x32de5e=[];_0xcfc251[_0x4443('0x29')](function(_0x466826){_0x32de5e[_0x4443('0x43')](_0x466826[_0x4443('0x23')]({'exitAt':moment()['format'](_0x4443('0x27'))}));});return BPromise[_0x4443('0x44')](_0x32de5e);}}})[_0x4443('0x14')](function(){if(_0x2b0f0f){var _0x4d02b7=[];var _0x150bf8=[];var _0x62643e=utils['getChannels']();var _0x35acab={'membername':_0x2b0f0f[_0x4443('0x1d')],'interface':_0x3f1188,'enterAt':moment()[_0x4443('0x20')](_0x4443('0x27')),'role':_0x2b0f0f[_0x4443('0x1e')],'internal':_0x2b0f0f[_0x4443('0x2d')]};_0x62643e[_0x4443('0x29')](function(_0x40b75a){_0x4d02b7[_0x4443('0x43')](_[_0x4443('0x4e')]({'channel':_0x40b75a,'type':_0x4443('0x4f'),'data1':_0x4443('0x50'),'data2':_0x3f1188},_0x35acab));if(_0x2b0f0f['loginInPause']){_0x150bf8[_0x4443('0x43')](_['merge']({'channel':_0x40b75a,'type':_0x4443('0x25'),'data1':'LOGININPAUSE'},_0x35acab));}});return db[_0x4443('0x24')][_0x4443('0x30')](_0x4d02b7[_0x4443('0x51')](_0x150bf8),{'individualHooks':!![]});}})[_0x4443('0x14')](function(){if(_0x2b0f0f){return _0x2b0f0f['update']({'online':!![],'lastLoginAt':moment()[_0x4443('0x20')](_0x4443('0x27')),'voicePause':_0x2b0f0f[_0x4443('0x4d')]||![],'mailPause':_0x2b0f0f[_0x4443('0x4d')]||![],'chatPause':_0x2b0f0f[_0x4443('0x4d')]||![],'faxPause':_0x2b0f0f[_0x4443('0x4d')]||![],'smsPause':_0x2b0f0f[_0x4443('0x4d')]||![],'openchannelPause':_0x2b0f0f[_0x4443('0x4d')]||![],'pauseType':_0x2b0f0f[_0x4443('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x4443('0x20')](_0x4443('0x27')),'interface':_0x3f1188});}})[_0x4443('0x14')](function(_0x383018){_0x394808(_0x383018);})[_0x4443('0x45')](function(_0x3ee396){_0x488359(_0x285ac2[_0x4443('0x17')](0x1f4,_0x3ee396[_0x4443('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8a2af5b..5ac547b 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 _0x4493=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x4493,0xcc));var _0x3449=function(_0x493c48,_0x1cde2b){_0x493c48=_0x493c48-0x0;var _0x322f84=_0x4493[_0x493c48];return _0x322f84;};'use strict';var UserEvents=require(_0x3449('0x0'));var events=[_0x3449('0x1'),_0x3449('0x2'),_0x3449('0x3')];function createListener(_0x12345a,_0x97c63c){return function(_0x176883){_0x97c63c[_0x3449('0x4')](_0x12345a,_0x176883);};}function removeListener(_0x58dc71,_0x571fcc){return function(){UserEvents[_0x3449('0x5')](_0x58dc71,_0x571fcc);};}exports[_0x3449('0x6')]=function(_0x2d2d20){for(var _0x2a0aca=0x0,_0x6c3fff=events[_0x3449('0x7')];_0x2a0aca<_0x6c3fff;_0x2a0aca++){var _0xdca3c1=events[_0x2a0aca];var _0x4e5f6d=createListener(_0x3449('0x8')+_0xdca3c1,_0x2d2d20);UserEvents['on'](_0xdca3c1,_0x4e5f6d);}}; \ No newline at end of file +var _0x4400=['save','remove','update','register','user:','./user.events'];(function(_0x117784,_0x55af7a){var _0x4c16c9=function(_0x498eab){while(--_0x498eab){_0x117784['push'](_0x117784['shift']());}};_0x4c16c9(++_0x55af7a);}(_0x4400,0x197));var _0x0440=function(_0x3f6d09,_0x589577){_0x3f6d09=_0x3f6d09-0x0;var _0x88a425=_0x4400[_0x3f6d09];return _0x88a425;};'use strict';var UserEvents=require(_0x0440('0x0'));var events=[_0x0440('0x1'),_0x0440('0x2'),_0x0440('0x3')];function createListener(_0x4842ee,_0x70a317){return function(_0x5ce102){_0x70a317['emit'](_0x4842ee,_0x5ce102);};}function removeListener(_0x4bec03,_0x4f0965){return function(){UserEvents['removeListener'](_0x4bec03,_0x4f0965);};}exports[_0x0440('0x4')]=function(_0xdc1980){for(var _0x3d2d6b=0x0,_0x471454=events['length'];_0x3d2d6b<_0x471454;_0x3d2d6b++){var _0x567d3a=events[_0x3d2d6b];var _0x18ff20=createListener(_0x0440('0x5')+_0x567d3a,_0xdc1980);UserEvents['on'](_0x567d3a,_0x18ff20);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ff135b3..acc9a0a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x25f5f2,_0x2739a3){var _0x250d44=function(_0x42c225){while(--_0x42c225){_0x25f5f2['push'](_0x25f5f2['shift']());}};_0x250d44(++_0x2739a3);}(_0x70e0,0x17b));var _0x070e=function(_0x51f4bb,_0x18fd79){_0x51f4bb=_0x51f4bb-0x0;var _0x5b86fc=_0x70e0[_0x51f4bb];return _0x5b86fc;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x24f084,_0x3e6313){var _0x299919=function(_0x4b66a2){while(--_0x4b66a2){_0x24f084['push'](_0x24f084['shift']());}};_0x299919(++_0x3e6313);}(_0x70e0,0x17b));var _0x070e=function(_0x2d94bd,_0x26b19d){_0x2d94bd=_0x2d94bd-0x0;var _0x1d429c=_0x70e0[_0x2d94bd];return _0x1d429c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3ed3e0f..d872378 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 _0x2732=['sequelize','exports','INTEGER'];(function(_0x5b7b03,_0x49c653){var _0x4dd9c6=function(_0x16176b){while(--_0x16176b){_0x5b7b03['push'](_0x5b7b03['shift']());}};_0x4dd9c6(++_0x49c653);}(_0x2732,0x1ce));var _0x2273=function(_0x1e4656,_0x37d354){_0x1e4656=_0x1e4656-0x0;var _0x9e88af=_0x2732[_0x1e4656];return _0x9e88af;};'use strict';var Sequelize=require(_0x2273('0x0'));module[_0x2273('0x1')]={'penalty':{'type':Sequelize[_0x2273('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfab5=['INTEGER','exports'];(function(_0xfcd223,_0x3f5fd4){var _0x3fc71c=function(_0x2be6f1){while(--_0x2be6f1){_0xfcd223['push'](_0xfcd223['shift']());}};_0x3fc71c(++_0x3f5fd4);}(_0xfab5,0x199));var _0x5fab=function(_0x4862de,_0x3ea85f){_0x4862de=_0x4862de-0x0;var _0x59c5b0=_0xfab5[_0x4862de];return _0x59c5b0;};'use strict';var Sequelize=require('sequelize');module[_0x5fab('0x0')]={'penalty':{'type':Sequelize[_0x5fab('0x1')],'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 3b0f1d5..edd7a47 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 _0x37c1=['request-promise','path','rimraf','./userChatQueue.attributes','exports','user_has_chat_queues','lodash','util','../../config/logger','bluebird'];(function(_0x453074,_0x4cd4e2){var _0x29c129=function(_0x564fba){while(--_0x564fba){_0x453074['push'](_0x453074['shift']());}};_0x29c129(++_0x4cd4e2);}(_0x37c1,0xa6));var _0x137c=function(_0x3ea891,_0x3316a9){_0x3ea891=_0x3ea891-0x0;var _0x2ff698=_0x37c1[_0x3ea891];return _0x2ff698;};'use strict';var _=require(_0x137c('0x0'));var util=require(_0x137c('0x1'));var logger=require(_0x137c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x137c('0x3'));var rp=require(_0x137c('0x4'));var fs=require('fs');var path=require(_0x137c('0x5'));var rimraf=require(_0x137c('0x6'));var config=require('../../config/environment');var attributes=require(_0x137c('0x7'));module[_0x137c('0x8')]=function(_0x25de31,_0x4bdbba){return _0x25de31['define']('UserChatQueue',attributes,{'tableName':_0x137c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8dc=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserChatQueue','user_has_chat_queues','util'];(function(_0x55d7b0,_0x2a82dc){var _0x2a376c=function(_0x367662){while(--_0x367662){_0x55d7b0['push'](_0x55d7b0['shift']());}};_0x2a376c(++_0x2a82dc);}(_0xb8dc,0x81));var _0xcb8d=function(_0x1aff20,_0x5c2c5c){_0x1aff20=_0x1aff20-0x0;var _0x537ac0=_0xb8dc[_0x1aff20];return _0x537ac0;};'use strict';var _=require('lodash');var util=require(_0xcb8d('0x0'));var logger=require(_0xcb8d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcb8d('0x2'));var rp=require(_0xcb8d('0x3'));var fs=require('fs');var path=require(_0xcb8d('0x4'));var rimraf=require(_0xcb8d('0x5'));var config=require(_0xcb8d('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xcb8d('0x7')]=function(_0x2b714c,_0x3aa8ed){return _0x2b714c['define'](_0xcb8d('0x8'),attributes,{'tableName':_0xcb8d('0x9'),'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 66aaeb8..d4cd36c 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 _0xb086=['rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x421143,_0x48a1df){var _0x4cdab8=function(_0x4d703e){while(--_0x4d703e){_0x421143['push'](_0x421143['shift']());}};_0x4cdab8(++_0x48a1df);}(_0xb086,0x1ad));var _0x6b08=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb086[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6b08('0x0'));var util=require('util');var moment=require(_0x6b08('0x1'));var BPromise=require(_0x6b08('0x2'));var rs=require(_0x6b08('0x3'));var fs=require('fs');var Redis=require(_0x6b08('0x4'));var db=require(_0x6b08('0x5'))['db'];var utils=require(_0x6b08('0x6'));var logger=require(_0x6b08('0x7'))(_0x6b08('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b08('0x9'));var client=jayson[_0x6b08('0xa')][_0x6b08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x273f42,_0x2c7e5f,_0x2162ff){return new BPromise(function(_0x162416,_0x4884fb){return client[_0x6b08('0xc')](_0x273f42,_0x2162ff)[_0x6b08('0xd')](function(_0xa81e73){logger[_0x6b08('0xe')](_0x6b08('0xf'),_0x2c7e5f,_0x6b08('0x10'));logger['debug'](_0x6b08('0x11'),_0x2c7e5f,'request\x20sent',JSON[_0x6b08('0x12')](_0xa81e73));if(_0xa81e73[_0x6b08('0x13')]){if(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x14')]===0x1f4){logger[_0x6b08('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2c7e5f,_0xa81e73['error'][_0x6b08('0x15')]);return _0x4884fb(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x15')]);}logger[_0x6b08('0x13')](_0x6b08('0xf'),_0x2c7e5f,_0xa81e73['error'][_0x6b08('0x15')]);return _0x162416(_0xa81e73[_0x6b08('0x13')][_0x6b08('0x15')]);}else{logger[_0x6b08('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2c7e5f,_0x6b08('0x10'));_0x162416(_0xa81e73['result'][_0x6b08('0x15')]);}})[_0x6b08('0x16')](function(_0x490ec5){logger[_0x6b08('0x13')](_0x6b08('0xf'),_0x2c7e5f,_0x490ec5);_0x4884fb(_0x490ec5);});});} \ No newline at end of file +var _0x4f25=['UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x4f25,0xcb));var _0x54f2=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x4f25[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0x54f2('0x0'));var util=require(_0x54f2('0x1'));var moment=require(_0x54f2('0x2'));var BPromise=require(_0x54f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54f2('0x5'));var logger=require('../../config/logger')(_0x54f2('0x6'));var config=require(_0x54f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54f2('0x8')][_0x54f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b803d,_0x152ad6,_0x3a55a0){return new BPromise(function(_0x533e65,_0x15f1c0){return client['request'](_0x3b803d,_0x3a55a0)['then'](function(_0x4086ef){logger[_0x54f2('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x152ad6,_0x54f2('0xb'));logger['debug'](_0x54f2('0xc'),_0x152ad6,_0x54f2('0xb'),JSON[_0x54f2('0xd')](_0x4086ef));if(_0x4086ef[_0x54f2('0xe')]){if(_0x4086ef[_0x54f2('0xe')][_0x54f2('0xf')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x152ad6,_0x4086ef['error'][_0x54f2('0x10')]);return _0x15f1c0(_0x4086ef[_0x54f2('0xe')]['message']);}logger[_0x54f2('0xe')](_0x54f2('0x11'),_0x152ad6,_0x4086ef[_0x54f2('0xe')][_0x54f2('0x10')]);return _0x533e65(_0x4086ef[_0x54f2('0xe')][_0x54f2('0x10')]);}else{logger[_0x54f2('0xa')](_0x54f2('0x11'),_0x152ad6,_0x54f2('0xb'));_0x533e65(_0x4086ef[_0x54f2('0x12')]['message']);}})[_0x54f2('0x13')](function(_0x386b23){logger[_0x54f2('0xe')](_0x54f2('0x11'),_0x152ad6,_0x386b23);_0x15f1c0(_0x386b23);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5074326..9f44d8a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4c6c2d,_0x4401d4){var _0x49622e=function(_0x3ac235){while(--_0x3ac235){_0x4c6c2d['push'](_0x4c6c2d['shift']());}};_0x49622e(++_0x4401d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xcb91[_0x381379];return _0x3e1063;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x27c60e,_0x5c6e87){var _0x3dfaaf=function(_0x3d2e65){while(--_0x3d2e65){_0x27c60e['push'](_0x27c60e['shift']());}};_0x3dfaaf(++_0x5c6e87);}(_0xe706,0xa3));var _0x6e70=function(_0x51b861,_0xb480d3){_0x51b861=_0x51b861-0x0;var _0x52401b=_0xe706[_0x51b861];return _0x52401b;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 730318b..5db2b69 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 _0x0ba0=['INTEGER','STRING','sequelize'];(function(_0x152664,_0x2f5173){var _0x51d153=function(_0xde49d4){while(--_0xde49d4){_0x152664['push'](_0x152664['shift']());}};_0x51d153(++_0x2f5173);}(_0x0ba0,0x167));var _0x00ba=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0ba0[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x00ba('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x00ba('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x00ba('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x00ba('0x2')]}}; \ No newline at end of file +var _0x13cc=['exports','INTEGER'];(function(_0x17c632,_0x59bddb){var _0x4a6a9a=function(_0x44b7db){while(--_0x44b7db){_0x17c632['push'](_0x17c632['shift']());}};_0x4a6a9a(++_0x59bddb);}(_0x13cc,0x126));var _0xc13c=function(_0x29ef0e,_0x28a1db){_0x29ef0e=_0x29ef0e-0x0;var _0x136d72=_0x13cc[_0x29ef0e];return _0x136d72;};'use strict';var Sequelize=require('sequelize');module[_0xc13c('0x0')]={'penalty':{'type':Sequelize[_0xc13c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc13c('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3e61748..50ed8e9 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 _0x1224=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','util'];(function(_0x19e2af,_0x483b5f){var _0x3ab1e1=function(_0x48f8c4){while(--_0x48f8c4){_0x19e2af['push'](_0x19e2af['shift']());}};_0x3ab1e1(++_0x483b5f);}(_0x1224,0x137));var _0x4122=function(_0x3a54c1,_0x1b19a7){_0x3a54c1=_0x3a54c1-0x0;var _0x532e71=_0x1224[_0x3a54c1];return _0x532e71;};'use strict';var _=require('lodash');var util=require(_0x4122('0x0'));var logger=require(_0x4122('0x1'))(_0x4122('0x2'));var moment=require(_0x4122('0x3'));var BPromise=require(_0x4122('0x4'));var rp=require(_0x4122('0x5'));var fs=require('fs');var path=require(_0x4122('0x6'));var rimraf=require(_0x4122('0x7'));var config=require(_0x4122('0x8'));var attributes=require(_0x4122('0x9'));module[_0x4122('0xa')]=function(_0x25a573,_0x543549){return _0x25a573[_0x4122('0xb')](_0x4122('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd8=['exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5fd8,0xf6));var _0x85fd=function(_0x54d0b5,_0x566bd5){_0x54d0b5=_0x54d0b5-0x0;var _0x4a64fa=_0x5fd8[_0x54d0b5];return _0x4a64fa;};'use strict';var _=require(_0x85fd('0x0'));var util=require(_0x85fd('0x1'));var logger=require(_0x85fd('0x2'))(_0x85fd('0x3'));var moment=require(_0x85fd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85fd('0x5'));var attributes=require('./userFaxQueue.attributes');module[_0x85fd('0x6')]=function(_0x2f1965,_0x3cf627){return _0x2f1965[_0x85fd('0x7')](_0x85fd('0x8'),attributes,{'tableName':'user_has_fax_queues','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 83866ea..b42d323 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 _0xa4d0=['message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x412ab8,_0x3703d3){var _0x10c4f2=function(_0x2e17e4){while(--_0x2e17e4){_0x412ab8['push'](_0x412ab8['shift']());}};_0x10c4f2(++_0x3703d3);}(_0xa4d0,0x1b2));var _0x0a4d=function(_0x5a93d9,_0x467244){_0x5a93d9=_0x5a93d9-0x0;var _0x417b68=_0xa4d0[_0x5a93d9];return _0x417b68;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a4d('0x0'));var BPromise=require(_0x0a4d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4d('0x2'));var db=require(_0x0a4d('0x3'))['db'];var utils=require(_0x0a4d('0x4'));var logger=require('../../config/logger')(_0x0a4d('0x5'));var config=require(_0x0a4d('0x6'));var jayson=require(_0x0a4d('0x7'));var client=jayson['client'][_0x0a4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44fcf5,_0x49a802,_0x2485e3){return new BPromise(function(_0x33a069,_0x22bdbd){return client['request'](_0x44fcf5,_0x2485e3)['then'](function(_0x41f728){logger[_0x0a4d('0x9')](_0x0a4d('0xa'),_0x49a802,_0x0a4d('0xb'));logger[_0x0a4d('0xc')](_0x0a4d('0xd'),_0x49a802,_0x0a4d('0xb'),JSON['stringify'](_0x41f728));if(_0x41f728[_0x0a4d('0xe')]){if(_0x41f728['error'][_0x0a4d('0xf')]===0x1f4){logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);return _0x22bdbd(_0x41f728[_0x0a4d('0xe')]['message']);}logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);return _0x33a069(_0x41f728[_0x0a4d('0xe')][_0x0a4d('0x10')]);}else{logger[_0x0a4d('0x9')](_0x0a4d('0xa'),_0x49a802,_0x0a4d('0xb'));_0x33a069(_0x41f728['result'][_0x0a4d('0x10')]);}})[_0x0a4d('0x11')](function(_0x4de682){logger[_0x0a4d('0xe')](_0x0a4d('0xa'),_0x49a802,_0x4de682);_0x22bdbd(_0x4de682);});});} \ No newline at end of file +var _0x6d08=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3809f0,_0x358391){var _0x406d8f=function(_0x21f253){while(--_0x21f253){_0x3809f0['push'](_0x3809f0['shift']());}};_0x406d8f(++_0x358391);}(_0x6d08,0xf9));var _0x86d0=function(_0x1441ff,_0x448d62){_0x1441ff=_0x1441ff-0x0;var _0x5b6657=_0x6d08[_0x1441ff];return _0x5b6657;};'use strict';var _=require(_0x86d0('0x0'));var util=require(_0x86d0('0x1'));var moment=require(_0x86d0('0x2'));var BPromise=require(_0x86d0('0x3'));var rs=require(_0x86d0('0x4'));var fs=require('fs');var Redis=require(_0x86d0('0x5'));var db=require(_0x86d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x86d0('0x7'));var config=require(_0x86d0('0x8'));var jayson=require(_0x86d0('0x9'));var client=jayson[_0x86d0('0xa')][_0x86d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c649e,_0x59d306,_0x259a4a){return new BPromise(function(_0x16e4bb,_0x13c3ef){return client[_0x86d0('0xc')](_0x5c649e,_0x259a4a)[_0x86d0('0xd')](function(_0x2f9700){logger[_0x86d0('0xe')](_0x86d0('0xf'),_0x59d306,_0x86d0('0x10'));logger[_0x86d0('0x11')](_0x86d0('0x12'),_0x59d306,_0x86d0('0x10'),JSON[_0x86d0('0x13')](_0x2f9700));if(_0x2f9700['error']){if(_0x2f9700[_0x86d0('0x14')][_0x86d0('0x15')]===0x1f4){logger[_0x86d0('0x14')](_0x86d0('0xf'),_0x59d306,_0x2f9700[_0x86d0('0x14')][_0x86d0('0x16')]);return _0x13c3ef(_0x2f9700[_0x86d0('0x14')][_0x86d0('0x16')]);}logger[_0x86d0('0x14')](_0x86d0('0xf'),_0x59d306,_0x2f9700['error'][_0x86d0('0x16')]);return _0x16e4bb(_0x2f9700[_0x86d0('0x14')]['message']);}else{logger[_0x86d0('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x59d306,'request\x20sent');_0x16e4bb(_0x2f9700[_0x86d0('0x17')][_0x86d0('0x16')]);}})[_0x86d0('0x18')](function(_0x5e60b8){logger['error'](_0x86d0('0xf'),_0x59d306,_0x5e60b8);_0x13c3ef(_0x5e60b8);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 899ee50..7103425 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x97f5f7,_0x3fdd1a){var _0x2fda22=function(_0x2b0847){while(--_0x2b0847){_0x97f5f7['push'](_0x97f5f7['shift']());}};_0x2fda22(++_0x3fdd1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xcb91[_0x20a558];return _0x53d3f7;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37be37,_0x191fc3){var _0x3f94f7=function(_0x5c2cac){while(--_0x5c2cac){_0x37be37['push'](_0x37be37['shift']());}};_0x3f94f7(++_0x191fc3);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ef564f0..aabffc7 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 _0xe617=['exports','INTEGER','sequelize'];(function(_0x32439d,_0x304a85){var _0x5b9a18=function(_0x459753){while(--_0x459753){_0x32439d['push'](_0x32439d['shift']());}};_0x5b9a18(++_0x304a85);}(_0xe617,0x17c));var _0x7e61=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe617[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7e61('0x0'));module[_0x7e61('0x1')]={'penalty':{'type':Sequelize[_0x7e61('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe0b5=['INTEGER','sequelize','exports'];(function(_0x5251ea,_0x181a72){var _0x241390=function(_0x674306){while(--_0x674306){_0x5251ea['push'](_0x5251ea['shift']());}};_0x241390(++_0x181a72);}(_0xe0b5,0xe2));var _0x5e0b=function(_0x100bd0,_0x1fcc23){_0x100bd0=_0x100bd0-0x0;var _0x17eff6=_0xe0b5[_0x100bd0];return _0x17eff6;};'use strict';var Sequelize=require(_0x5e0b('0x0'));module[_0x5e0b('0x1')]={'penalty':{'type':Sequelize[_0x5e0b('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 856a282..84d38ba 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 _0x5b89=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','../../config/logger','moment','bluebird'];(function(_0x478219,_0x28aa3d){var _0x4ff324=function(_0x226fb8){while(--_0x226fb8){_0x478219['push'](_0x478219['shift']());}};_0x4ff324(++_0x28aa3d);}(_0x5b89,0xbb));var _0x95b8=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x5b89[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x95b8('0x0'))('api');var moment=require(_0x95b8('0x1'));var BPromise=require(_0x95b8('0x2'));var rp=require(_0x95b8('0x3'));var fs=require('fs');var path=require(_0x95b8('0x4'));var rimraf=require(_0x95b8('0x5'));var config=require(_0x95b8('0x6'));var attributes=require(_0x95b8('0x7'));module['exports']=function(_0x5e3ab1,_0x572d35){return _0x5e3ab1[_0x95b8('0x8')]('UserMailQueue',attributes,{'tableName':_0x95b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x119d=['exports','define','user_has_mail_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x13980c,_0x4231ae){var _0x1b96c5=function(_0x49539e){while(--_0x49539e){_0x13980c['push'](_0x13980c['shift']());}};_0x1b96c5(++_0x4231ae);}(_0x119d,0x19d));var _0xd119=function(_0x461969,_0x15e4ab){_0x461969=_0x461969-0x0;var _0x57f10e=_0x119d[_0x461969];return _0x57f10e;};'use strict';var _=require(_0xd119('0x0'));var util=require(_0xd119('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd119('0x2'));var BPromise=require(_0xd119('0x3'));var rp=require(_0xd119('0x4'));var fs=require('fs');var path=require(_0xd119('0x5'));var rimraf=require(_0xd119('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xd119('0x7')]=function(_0x250fda,_0x39a28f){return _0x250fda[_0xd119('0x8')]('UserMailQueue',attributes,{'tableName':_0xd119('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 24b2f5c..35cd4b8 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x48fca4,_0x4f50a4){var _0x5b52ed=function(_0x3000ef){while(--_0x3000ef){_0x48fca4['push'](_0x48fca4['shift']());}};_0x5b52ed(++_0x4f50a4);}(_0x34e8,0x12c));var _0x834e=function(_0x321260,_0x3c3824){_0x321260=_0x321260-0x0;var _0x2ceec0=_0x34e8[_0x321260];return _0x2ceec0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x008c,0x188));var _0xc008=function(_0x2d3df2,_0x2f9498){_0x2d3df2=_0x2d3df2-0x0;var _0x347bda=_0x008c[_0x2d3df2];return _0x347bda;};'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 2072fff..5479b9a 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 _0xdf98=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout'];(function(_0x57ec11,_0x539404){var _0x19805d=function(_0x571c86){while(--_0x571c86){_0x57ec11['push'](_0x57ec11['shift']());}};_0x19805d(++_0x539404);}(_0xdf98,0x8d));var _0x8df9=function(_0x56b794,_0x50003f){_0x56b794=_0x56b794-0x0;var _0x80c80=_0xdf98[_0x56b794];return _0x80c80;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8df9('0x1'));var express=require(_0x8df9('0x2'));var router=express[_0x8df9('0x3')]();var fs_extra=require(_0x8df9('0x4'));var auth=require(_0x8df9('0x5'));var interaction=require(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var controller=require(_0x8df9('0x8'));router[_0x8df9('0x9')]('/',auth[_0x8df9('0xa')](),controller[_0x8df9('0xb')]);module[_0x8df9('0xc')]=router; \ No newline at end of file +var _0x8b9d=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x8b9d,0x141));var _0xd8b9=function(_0x13b70f,_0x5c1116){_0x13b70f=_0x13b70f-0x0;var _0x51427c=_0x8b9d[_0x13b70f];return _0x51427c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd8b9('0x0'));var timeout=require(_0xd8b9('0x1'));var express=require(_0xd8b9('0x2'));var router=express['Router']();var fs_extra=require(_0xd8b9('0x3'));var auth=require(_0xd8b9('0x4'));var interaction=require(_0xd8b9('0x5'));var config=require(_0xd8b9('0x6'));var controller=require(_0xd8b9('0x7'));router['post']('/',auth[_0xd8b9('0x8')](),controller['sendUserNotification']);module[_0xd8b9('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index dd317f5..b1b453b 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 _0x0abc=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4f1dbd,_0x36bfba){var _0x44e6c5=function(_0x210bb9){while(--_0x210bb9){_0x4f1dbd['push'](_0x4f1dbd['shift']());}};_0x44e6c5(++_0x36bfba);}(_0x0abc,0xcf));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0ab('0x0'));module[_0xc0ab('0x1')]={'body':{'type':Sequelize[_0xc0ab('0x2')]},'senderName':{'type':Sequelize[_0xc0ab('0x3')]},'recipientsId':{'type':Sequelize[_0xc0ab('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc0ab('0x3')]},'beep':{'type':Sequelize[_0xc0ab('0x4')]}}; \ No newline at end of file +var _0xf903=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x13ad99,_0x49c6ba){var _0x517fe2=function(_0x9eb60f){while(--_0x9eb60f){_0x13ad99['push'](_0x13ad99['shift']());}};_0x517fe2(++_0x49c6ba);}(_0xf903,0x153));var _0x3f90=function(_0x5622d6,_0x40809a){_0x5622d6=_0x5622d6-0x0;var _0x411cae=_0xf903[_0x5622d6];return _0x411cae;};'use strict';var Sequelize=require(_0x3f90('0x0'));module[_0x3f90('0x1')]={'body':{'type':Sequelize[_0x3f90('0x2')]},'senderName':{'type':Sequelize[_0x3f90('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x3f90('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 38575eb..2d42ac6 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 _0xf5fb=['queue','replace','push','flatten','findOne','map','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xf5fb,0x117));var _0xbf5f=function(_0x145630,_0x19b3bd){_0x145630=_0x145630-0x0;var _0x4c8ebf=_0xf5fb[_0x145630];return _0x4c8ebf;};'use strict';var emlformat=require(_0xbf5f('0x0'));var rimraf=require(_0xbf5f('0x1'));var zipdir=require(_0xbf5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf5f('0x3'));var moment=require('moment');var BPromise=require(_0xbf5f('0x4'));var Mustache=require('mustache');var util=require(_0xbf5f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbf5f('0x6'));var ejs=require(_0xbf5f('0x7'));var fs=require('fs');var fs_extra=require(_0xbf5f('0x8'));var _=require(_0xbf5f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf5f('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf5f('0xb'));var hardwareService=require(_0xbf5f('0xc'));var logger=require(_0xbf5f('0xd'))(_0xbf5f('0xe'));var utils=require(_0xbf5f('0xf'));var config=require(_0xbf5f('0x10'));var licenseUtil=require(_0xbf5f('0x11'));var db=require(_0xbf5f('0x12'))['db'];config[_0xbf5f('0x13')]=_[_0xbf5f('0x14')](config[_0xbf5f('0x13')],{'host':_0xbf5f('0x15'),'port':0x18eb});var socket=require(_0xbf5f('0x16'))(new Redis(config['redis']));require(_0xbf5f('0x17'))[_0xbf5f('0x18')](socket);function respondWithStatusCode(_0x54bdd8,_0x5d1aed){_0x5d1aed=_0x5d1aed||0xcc;return function(_0x4b9233){if(_0x4b9233){return _0x54bdd8[_0xbf5f('0x19')](_0x5d1aed);}return _0x54bdd8[_0xbf5f('0x1a')](_0x5d1aed)[_0xbf5f('0x1b')]();};}function respondWithResult(_0x5ec4fd,_0x396204){_0x396204=_0x396204||0xc8;return function(_0x15a010){if(_0x15a010){return _0x5ec4fd['status'](_0x396204)[_0xbf5f('0x1c')](_0x15a010);}};}function respondWithFilteredResult(_0x27fcda,_0x4f9c45){return function(_0x338541){if(_0x338541){var _0x143d51=typeof _0x4f9c45['offset']===_0xbf5f('0x1d')&&typeof _0x4f9c45['limit']===_0xbf5f('0x1d');var _0x16dc28=_0x338541['count'];var _0x4f419d=_0x143d51?0x0:_0x4f9c45[_0xbf5f('0x1e')];var _0x59f021=_0x143d51?_0x338541[_0xbf5f('0x1f')]:_0x4f9c45[_0xbf5f('0x1e')]+_0x4f9c45[_0xbf5f('0x20')];var _0x1112b9;if(_0x59f021>=_0x16dc28){_0x59f021=_0x16dc28;_0x1112b9=0xc8;}else{_0x1112b9=0xce;}_0x27fcda['status'](_0x1112b9);return _0x27fcda[_0xbf5f('0x21')](_0xbf5f('0x22'),_0x4f419d+'-'+_0x59f021+'/'+_0x16dc28)['json'](_0x338541);}return null;};}function patchUpdates(_0x25a668){return function(_0x36f931){try{jsonpatch['apply'](_0x36f931,_0x25a668,!![]);}catch(_0x5d9037){return BPromise['reject'](_0x5d9037);}return _0x36f931[_0xbf5f('0x23')]();};}function saveUpdates(_0x4f4f0c,_0x4a9347){return function(_0x3e4455){if(_0x3e4455){return _0x3e4455[_0xbf5f('0x24')](_0x4f4f0c)[_0xbf5f('0x25')](function(_0x4464d8){return _0x4464d8;});}return null;};}function removeEntity(_0x5eccf6,_0x2f9b50){return function(_0x48913f){if(_0x48913f){return _0x48913f[_0xbf5f('0x26')]()['then'](function(){_0x5eccf6[_0xbf5f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4caf3a,_0x10a475){return function(_0x5e9c58){if(!_0x5e9c58){_0x4caf3a[_0xbf5f('0x19')](0x194);}return _0x5e9c58;};}function handleError(_0x562f39,_0x477b0c){_0x477b0c=_0x477b0c||0x1f4;return function(_0x2dfe0d){logger[_0xbf5f('0x27')](_0x2dfe0d[_0xbf5f('0x28')]);if(_0x2dfe0d[_0xbf5f('0x29')]){delete _0x2dfe0d[_0xbf5f('0x29')];}_0x562f39[_0xbf5f('0x1a')](_0x477b0c)[_0xbf5f('0x2a')](_0x2dfe0d);};}exports['sendUserNotification']=function(_0x6814e9,_0x39a706,_0x2320a8){if(!_0x6814e9[_0xbf5f('0x2b')]['hasOwnProperty'](_0xbf5f('0x2c'))&&!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x2e'))){throw new db[(_0xbf5f('0x2f'))]['ValidationError'](_0xbf5f('0x30'));}else{if(_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x2e'))&&!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x31'))){throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x33'));}if(!_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x34'))){throw new db['Sequelize'][(_0xbf5f('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x428861=JSON[_0xbf5f('0x35')](_0x6814e9['body']['recipients']);}catch(_0xaf59d7){logger[_0xbf5f('0x27')](_0xaf59d7);throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x36'));}var _0x2571ec=[_0xbf5f('0x37'),'faxqueue','mailqueue','openchannelqueue',_0xbf5f('0x38'),'voicequeue','whatsappqueue',_0xbf5f('0x39'),_0xbf5f('0x3a')];if(_['some'](_0x428861,function(_0x37286c){return!_[_0xbf5f('0x3b')](_0x2571ec,_0x37286c[_0xbf5f('0x3c')][_0xbf5f('0x3d')]());})){throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x3e'));}}}var _0x54adee={};_0x54adee[_0xbf5f('0x3f')]=_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x2d')](_0xbf5f('0x3f'))?_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x3f')]:_0x6814e9[_0xbf5f('0x3a')][_0xbf5f('0x40')];_0x54adee[_0xbf5f('0x41')]=_[_0xbf5f('0x42')](_0x6814e9[_0xbf5f('0x2b')][_0xbf5f('0x41')])?null:_0x6814e9['body'][_0xbf5f('0x41')];_0x54adee['beep']=_0x6814e9['body'][_0xbf5f('0x43')]||![];_0x54adee[_0xbf5f('0x44')]=_0x6814e9[_0xbf5f('0x3a')]['id'];return getContent(_0x6814e9[_0xbf5f('0x2b')])[_0xbf5f('0x25')](function(_0x4d7679){_0x54adee[_0xbf5f('0x2b')]=_0x4d7679;return getRecipients(_0x428861);})[_0xbf5f('0x25')](function(_0x2c7958){_0x54adee['recipientsId']=_[_0xbf5f('0x45')](_0x2c7958)[_0xbf5f('0x46')](',');return db[_0xbf5f('0x47')][_0xbf5f('0x48')](function(_0x44b4d5){return db[_0xbf5f('0x49')][_0xbf5f('0x4a')](_0x54adee,{'raw':!![],'transaction':_0x44b4d5})[_0xbf5f('0x25')](function(_0x4f849b){var _0x4b3191={'sender':_0x54adee['senderName'],'description':_0x54adee[_0xbf5f('0x41')],'content':_0x54adee[_0xbf5f('0x2b')],'beep':_0x54adee[_0xbf5f('0x43')]};_0x2c7958[_0xbf5f('0x4b')](function(_0x599a67){_0x4b3191[_0xbf5f('0x4c')]=_0x599a67;socket[_0xbf5f('0x4d')]('userNotification:send',_0x4b3191);});return _0x4f849b;});});})[_0xbf5f('0x25')](respondWithResult(_0x39a706,0xc9))[_0xbf5f('0x4e')](handleError(_0x39a706,null));};function getContent(_0x3cf318){return new BPromise(function(_0x21b38c,_0x205053){if(_0x3cf318[_0xbf5f('0x2c')]){_0x21b38c(_0x3cf318[_0xbf5f('0x2c')]);return;}return db[_0xbf5f('0x4f')]['findOne']({'attributes':['html'],'where':{'id':_0x3cf318['TemplateId']},'raw':!![]})[_0xbf5f('0x25')](function(_0xdda552){if(!_0xdda552)throw new db[(_0xbf5f('0x2f'))][(_0xbf5f('0x32'))](_0xbf5f('0x50'));var _0x42ad60=Mustache[_0xbf5f('0x51')](_0xdda552['html'],_0x3cf318['view']);_0x21b38c(_0x42ad60);})[_0xbf5f('0x4e')](function(_0x42d856){_0x205053(_0x42d856);});});}function getRecipients(_0x4288ea){return new BPromise(function(_0x25903f,_0x2d3f77){var _0x299352=[];var _0x2f9077=[];_0x4288ea[_0xbf5f('0x4b')](function(_0x11088d){var _0x4898e7=_[_0xbf5f('0x52')](_0x11088d[_0xbf5f('0x3c')][_0xbf5f('0x3d')]());if(_0x4898e7==='User'){_0x299352=_[_0xbf5f('0x53')](_0x299352,_0x11088d[_0xbf5f('0x54')]);}else{if(_[_0xbf5f('0x3b')](_0x4898e7,_0xbf5f('0x55')))_0x4898e7=_0x4898e7[_0xbf5f('0x56')](_0xbf5f('0x55'),'Queue');_0x11088d[_0xbf5f('0x54')][_0xbf5f('0x4b')](function(_0x28fa0c){_0x2f9077[_0xbf5f('0x57')](getAgents(_0x4898e7,_0x28fa0c));});}});return BPromise['all'](_0x2f9077)[_0xbf5f('0x25')](function(_0x4674c9){_0x299352=_['union'](_0x299352,_[_0xbf5f('0x58')](_0x4674c9));_0x25903f(_0x299352);})[_0xbf5f('0x4e')](function(_0x2b511c){_0x2d3f77(_0x2b511c);});});}function getAgents(_0x3460d6,_0x311708){return new BPromise(function(_0x4cf30c,_0x37394a){return db[_0x3460d6][_0xbf5f('0x59')]({'where':{'id':_0x311708}})[_0xbf5f('0x25')](function(_0x506908){return _0x506908['getAgents']({'attributes':['id'],'raw':!![]})[_0xbf5f('0x25')](function(_0x447efc){var _0x42062f=_[_0xbf5f('0x5a')](_0x447efc,'id');_0x4cf30c(_0x42062f);});})[_0xbf5f('0x4e')](function(_0x1af1fa){_0x37394a(_0x1af1fa);});});} \ No newline at end of file +var _0xd3c0=['toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','emit','userNotification:send','Template','findOne','html','render','catch','startCase','User','union','ids','replace','queue','all','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','team','user','includes','model'];(function(_0x5b83eb,_0x31c546){var _0xc8ee04=function(_0x11ffca){while(--_0x11ffca){_0x5b83eb['push'](_0x5b83eb['shift']());}};_0xc8ee04(++_0x31c546);}(_0xd3c0,0xe9));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0d3c('0x0'));var rimraf=require(_0x0d3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d3c('0x2'));var moment=require(_0x0d3c('0x3'));var BPromise=require(_0x0d3c('0x4'));var Mustache=require(_0x0d3c('0x5'));var util=require(_0x0d3c('0x6'));var path=require(_0x0d3c('0x7'));var sox=require(_0x0d3c('0x8'));var csv=require(_0x0d3c('0x9'));var ejs=require(_0x0d3c('0xa'));var fs=require('fs');var fs_extra=require(_0x0d3c('0xb'));var _=require(_0x0d3c('0xc'));var squel=require(_0x0d3c('0xd'));var crypto=require(_0x0d3c('0xe'));var jsforce=require(_0x0d3c('0xf'));var deskjs=require(_0x0d3c('0x10'));var toCsv=require(_0x0d3c('0x9'));var querystring=require(_0x0d3c('0x11'));var Papa=require(_0x0d3c('0x12'));var Redis=require(_0x0d3c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0d3c('0x14'));var as=require(_0x0d3c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d3c('0x16'));var utils=require(_0x0d3c('0x17'));var config=require(_0x0d3c('0x18'));var licenseUtil=require(_0x0d3c('0x19'));var db=require(_0x0d3c('0x1a'))['db'];config[_0x0d3c('0x1b')]=_['defaults'](config[_0x0d3c('0x1b')],{'host':_0x0d3c('0x1c'),'port':0x18eb});var socket=require(_0x0d3c('0x1d'))(new Redis(config[_0x0d3c('0x1b')]));require(_0x0d3c('0x1e'))[_0x0d3c('0x1f')](socket);function respondWithStatusCode(_0x97993e,_0x364639){_0x364639=_0x364639||0xcc;return function(_0x44eb87){if(_0x44eb87){return _0x97993e[_0x0d3c('0x20')](_0x364639);}return _0x97993e[_0x0d3c('0x21')](_0x364639)[_0x0d3c('0x22')]();};}function respondWithResult(_0x521f73,_0x14b624){_0x14b624=_0x14b624||0xc8;return function(_0x1ab50d){if(_0x1ab50d){return _0x521f73[_0x0d3c('0x21')](_0x14b624)[_0x0d3c('0x23')](_0x1ab50d);}};}function respondWithFilteredResult(_0x1a91db,_0x5dade4){return function(_0x48bca0){if(_0x48bca0){var _0x5e3f71=typeof _0x5dade4[_0x0d3c('0x24')]==='undefined'&&typeof _0x5dade4[_0x0d3c('0x25')]===_0x0d3c('0x26');var _0x2cd6d5=_0x48bca0[_0x0d3c('0x27')];var _0x9fa0d4=_0x5e3f71?0x0:_0x5dade4[_0x0d3c('0x24')];var _0x8105f8=_0x5e3f71?_0x48bca0[_0x0d3c('0x27')]:_0x5dade4[_0x0d3c('0x24')]+_0x5dade4[_0x0d3c('0x25')];var _0x4409bf;if(_0x8105f8>=_0x2cd6d5){_0x8105f8=_0x2cd6d5;_0x4409bf=0xc8;}else{_0x4409bf=0xce;}_0x1a91db[_0x0d3c('0x21')](_0x4409bf);return _0x1a91db[_0x0d3c('0x28')](_0x0d3c('0x29'),_0x9fa0d4+'-'+_0x8105f8+'/'+_0x2cd6d5)[_0x0d3c('0x23')](_0x48bca0);}return null;};}function patchUpdates(_0x1aabc2){return function(_0x3f2ddf){try{jsonpatch[_0x0d3c('0x2a')](_0x3f2ddf,_0x1aabc2,!![]);}catch(_0x583789){return BPromise[_0x0d3c('0x2b')](_0x583789);}return _0x3f2ddf[_0x0d3c('0x2c')]();};}function saveUpdates(_0x43cbad,_0x27bad3){return function(_0x2b89a2){if(_0x2b89a2){return _0x2b89a2[_0x0d3c('0x2d')](_0x43cbad)[_0x0d3c('0x2e')](function(_0x573687){return _0x573687;});}return null;};}function removeEntity(_0x544f37,_0x13156a){return function(_0x45a687){if(_0x45a687){return _0x45a687[_0x0d3c('0x2f')]()[_0x0d3c('0x2e')](function(){_0x544f37['status'](0xcc)[_0x0d3c('0x22')]();});}};}function handleEntityNotFound(_0x24d9cf,_0x27f85a){return function(_0x2655ee){if(!_0x2655ee){_0x24d9cf[_0x0d3c('0x20')](0x194);}return _0x2655ee;};}function handleError(_0x22860e,_0x4dde41){_0x4dde41=_0x4dde41||0x1f4;return function(_0x20a57d){logger[_0x0d3c('0x30')](_0x20a57d[_0x0d3c('0x31')]);if(_0x20a57d[_0x0d3c('0x32')]){delete _0x20a57d[_0x0d3c('0x32')];}_0x22860e[_0x0d3c('0x21')](_0x4dde41)[_0x0d3c('0x33')](_0x20a57d);};}exports[_0x0d3c('0x34')]=function(_0x2c4e52,_0x5e79b6,_0x1041dd){if(!_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x36')](_0x0d3c('0x37'))&&!_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x36')](_0x0d3c('0x38'))){throw new db['Sequelize'][(_0x0d3c('0x39'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2c4e52['body']['hasOwnProperty'](_0x0d3c('0x38'))&&!_0x2c4e52['body'][_0x0d3c('0x36')](_0x0d3c('0x3a'))){throw new db[(_0x0d3c('0x3b'))]['ValidationError'](_0x0d3c('0x3c'));}if(!_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x36')](_0x0d3c('0x3d'))){throw new db['Sequelize'][(_0x0d3c('0x39'))](_0x0d3c('0x3e'));}else{try{var _0x4a1628=JSON[_0x0d3c('0x3f')](_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x3d')]);}catch(_0x815ac2){logger['error'](_0x815ac2);throw new db['Sequelize'][(_0x0d3c('0x39'))](_0x0d3c('0x40'));}var _0x486742=[_0x0d3c('0x41'),_0x0d3c('0x42'),_0x0d3c('0x43'),_0x0d3c('0x44'),'smsqueue','voicequeue','whatsappqueue',_0x0d3c('0x45'),_0x0d3c('0x46')];if(_['some'](_0x4a1628,function(_0x2df49e){return!_[_0x0d3c('0x47')](_0x486742,_0x2df49e[_0x0d3c('0x48')][_0x0d3c('0x49')]());})){throw new db[(_0x0d3c('0x3b'))][(_0x0d3c('0x39'))](_0x0d3c('0x4a'));}}}var _0x43e7a4={};_0x43e7a4[_0x0d3c('0x4b')]=_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x36')](_0x0d3c('0x4b'))?_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x4b')]:_0x2c4e52[_0x0d3c('0x46')][_0x0d3c('0x4c')];_0x43e7a4[_0x0d3c('0x4d')]=_['isEmpty'](_0x2c4e52[_0x0d3c('0x35')]['recipientsDescription'])?null:_0x2c4e52[_0x0d3c('0x35')]['recipientsDescription'];_0x43e7a4[_0x0d3c('0x4e')]=_0x2c4e52[_0x0d3c('0x35')][_0x0d3c('0x4e')]||![];_0x43e7a4[_0x0d3c('0x4f')]=_0x2c4e52[_0x0d3c('0x46')]['id'];return getContent(_0x2c4e52['body'])['then'](function(_0x1e7679){_0x43e7a4[_0x0d3c('0x35')]=_0x1e7679;return getRecipients(_0x4a1628);})[_0x0d3c('0x2e')](function(_0x414dc4){_0x43e7a4[_0x0d3c('0x50')]=_[_0x0d3c('0x51')](_0x414dc4)[_0x0d3c('0x52')](',');return db[_0x0d3c('0x53')][_0x0d3c('0x54')](function(_0x3e340f){return db[_0x0d3c('0x55')]['create'](_0x43e7a4,{'raw':!![],'transaction':_0x3e340f})[_0x0d3c('0x2e')](function(_0x57195e){var _0x365ec2={'sender':_0x43e7a4[_0x0d3c('0x4b')],'description':_0x43e7a4[_0x0d3c('0x4d')],'content':_0x43e7a4[_0x0d3c('0x35')],'beep':_0x43e7a4[_0x0d3c('0x4e')]};_0x414dc4[_0x0d3c('0x56')](function(_0x181c7e){_0x365ec2['recipient']=_0x181c7e;socket[_0x0d3c('0x57')](_0x0d3c('0x58'),_0x365ec2);});return _0x57195e;});});})[_0x0d3c('0x2e')](respondWithResult(_0x5e79b6,0xc9))['catch'](handleError(_0x5e79b6,null));};function getContent(_0x48819d){return new BPromise(function(_0x12da95,_0x4a56ce){if(_0x48819d[_0x0d3c('0x37')]){_0x12da95(_0x48819d[_0x0d3c('0x37')]);return;}return db[_0x0d3c('0x59')][_0x0d3c('0x5a')]({'attributes':[_0x0d3c('0x5b')],'where':{'id':_0x48819d[_0x0d3c('0x38')]},'raw':!![]})[_0x0d3c('0x2e')](function(_0xa6e71b){if(!_0xa6e71b)throw new db['Sequelize'][(_0x0d3c('0x39'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4dde50=Mustache[_0x0d3c('0x5c')](_0xa6e71b[_0x0d3c('0x5b')],_0x48819d[_0x0d3c('0x3a')]);_0x12da95(_0x4dde50);})[_0x0d3c('0x5d')](function(_0x2983c9){_0x4a56ce(_0x2983c9);});});}function getRecipients(_0x1b4cc8){return new BPromise(function(_0x49f10d,_0x513550){var _0x50fee1=[];var _0x4233a3=[];_0x1b4cc8[_0x0d3c('0x56')](function(_0x5a132b){var _0x964cbf=_[_0x0d3c('0x5e')](_0x5a132b[_0x0d3c('0x48')][_0x0d3c('0x49')]());if(_0x964cbf===_0x0d3c('0x5f')){_0x50fee1=_[_0x0d3c('0x60')](_0x50fee1,_0x5a132b[_0x0d3c('0x61')]);}else{if(_['includes'](_0x964cbf,'queue'))_0x964cbf=_0x964cbf[_0x0d3c('0x62')](_0x0d3c('0x63'),'Queue');_0x5a132b['ids'][_0x0d3c('0x56')](function(_0x451a0f){_0x4233a3['push'](getAgents(_0x964cbf,_0x451a0f));});}});return BPromise[_0x0d3c('0x64')](_0x4233a3)[_0x0d3c('0x2e')](function(_0x2b853d){_0x50fee1=_[_0x0d3c('0x60')](_0x50fee1,_['flatten'](_0x2b853d));_0x49f10d(_0x50fee1);})[_0x0d3c('0x5d')](function(_0x4f1704){_0x513550(_0x4f1704);});});}function getAgents(_0x177f0a,_0x48c1ff){return new BPromise(function(_0x5ef349,_0x4f83d4){return db[_0x177f0a][_0x0d3c('0x5a')]({'where':{'id':_0x48c1ff}})[_0x0d3c('0x2e')](function(_0x247d89){return _0x247d89[_0x0d3c('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3fc18b){var _0x343b07=_['map'](_0x3fc18b,'id');_0x5ef349(_0x343b07);});})[_0x0d3c('0x5d')](function(_0x2522c4){_0x4f83d4(_0x2522c4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a2c3fbb..c3d4fd1 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 _0xc659=['save','update','emit','hasOwnProperty','hook','exports','UserNotification','setMaxListeners'];(function(_0x1a1149,_0x33be22){var _0x12887f=function(_0x5be9a6){while(--_0x5be9a6){_0x1a1149['push'](_0x1a1149['shift']());}};_0x12887f(++_0x33be22);}(_0xc659,0x7e));var _0x9c65=function(_0x51bcd4,_0x397b28){_0x51bcd4=_0x51bcd4-0x0;var _0x38c609=_0xc659[_0x51bcd4];return _0x38c609;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x9c65('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9c65('0x1')](0x0);var events={'afterCreate':_0x9c65('0x2'),'afterUpdate':_0x9c65('0x3'),'afterDestroy':'remove'};function emitEvent(_0x393774){return function(_0x3376b3,_0x210759,_0x2f4a77){UserNotificationEvents[_0x9c65('0x4')](_0x393774+':'+_0x3376b3['id'],_0x3376b3);UserNotificationEvents[_0x9c65('0x4')](_0x393774,_0x3376b3);_0x2f4a77(null);};}for(var e in events){if(events[_0x9c65('0x5')](e)){var event=events[e];UserNotification[_0x9c65('0x6')](e,emitEvent(event));}}module[_0x9c65('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xf033=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf033,0x136));var _0x3f03=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xf033[_0x2431d6];return _0x4d0f9b;};'use strict';var EventEmitter=require(_0x3f03('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3f03('0x1')](0x0);var events={'afterCreate':_0x3f03('0x2'),'afterUpdate':_0x3f03('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1859e8){return function(_0x62eed1,_0x1d55b5,_0x5a39f0){UserNotificationEvents[_0x3f03('0x4')](_0x1859e8+':'+_0x62eed1['id'],_0x62eed1);UserNotificationEvents[_0x3f03('0x4')](_0x1859e8,_0x62eed1);_0x5a39f0(null);};}for(var e in events){if(events[_0x3f03('0x5')](e)){var event=events[e];UserNotification[_0x3f03('0x6')](e,emitEvent(event));}}module[_0x3f03('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ff455f5..c3f50ae 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 _0x3cb6=['userNotifications','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x3cb6,0x121));var _0x63cb=function(_0x176996,_0x71174e){_0x176996=_0x176996-0x0;var _0x2ba772=_0x3cb6[_0x176996];return _0x2ba772;};'use strict';var _=require('lodash');var util=require(_0x63cb('0x0'));var logger=require(_0x63cb('0x1'))(_0x63cb('0x2'));var moment=require(_0x63cb('0x3'));var BPromise=require(_0x63cb('0x4'));var rp=require(_0x63cb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63cb('0x6'));var config=require(_0x63cb('0x7'));var attributes=require('./userNotification.attributes');module[_0x63cb('0x8')]=function(_0x20bc29,_0x4dd8a0){return _0x20bc29[_0x63cb('0x9')](_0x63cb('0xa'),attributes,{'tableName':_0x63cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2af3=['../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5d8807,_0x260d34){var _0x55d64c=function(_0x40f501){while(--_0x40f501){_0x5d8807['push'](_0x5d8807['shift']());}};_0x55d64c(++_0x260d34);}(_0x2af3,0x1c7));var _0x32af=function(_0x314d1d,_0x1211b8){_0x314d1d=_0x314d1d-0x0;var _0x31e31d=_0x2af3[_0x314d1d];return _0x31e31d;};'use strict';var _=require('lodash');var util=require(_0x32af('0x0'));var logger=require(_0x32af('0x1'))(_0x32af('0x2'));var moment=require(_0x32af('0x3'));var BPromise=require(_0x32af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32af('0x5'));var rimraf=require(_0x32af('0x6'));var config=require(_0x32af('0x7'));var attributes=require(_0x32af('0x8'));module[_0x32af('0x9')]=function(_0x621757,_0x5937b9){return _0x621757[_0x32af('0xa')](_0x32af('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32af('0xc'),'collate':_0x32af('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 27a6537..a0b2a13 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 _0xf9fd=['info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then'];(function(_0x18ee27,_0x2908d8){var _0x37db04=function(_0x56e95c){while(--_0x56e95c){_0x18ee27['push'](_0x18ee27['shift']());}};_0x37db04(++_0x2908d8);}(_0xf9fd,0x78));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf9f('0x3'));var fs=require('fs');var Redis=require(_0xdf9f('0x4'));var db=require(_0xdf9f('0x5'))['db'];var utils=require(_0xdf9f('0x6'));var logger=require(_0xdf9f('0x7'))(_0xdf9f('0x8'));var config=require(_0xdf9f('0x9'));var jayson=require(_0xdf9f('0xa'));var client=jayson['client'][_0xdf9f('0xb')]({'port':0x232a});config[_0xdf9f('0xc')]=_[_0xdf9f('0xd')](config[_0xdf9f('0xc')],{'host':_0xdf9f('0xe'),'port':0x18eb});var socket=require(_0xdf9f('0xf'))(new Redis(config['redis']));require(_0xdf9f('0x10'))[_0xdf9f('0x11')](socket);function respondWithRpcPromise(_0xbbc3f1,_0x5a3653,_0x42b16b){return new BPromise(function(_0x3dbccd,_0x1cfdeb){return client[_0xdf9f('0x12')](_0xbbc3f1,_0x42b16b)[_0xdf9f('0x13')](function(_0x13c531){logger[_0xdf9f('0x14')](_0xdf9f('0x15'),_0x5a3653,_0xdf9f('0x16'));logger[_0xdf9f('0x17')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5a3653,_0xdf9f('0x16'),JSON[_0xdf9f('0x18')](_0x13c531));if(_0x13c531[_0xdf9f('0x19')]){if(_0x13c531[_0xdf9f('0x19')]['code']===0x1f4){logger[_0xdf9f('0x19')](_0xdf9f('0x15'),_0x5a3653,_0x13c531[_0xdf9f('0x19')][_0xdf9f('0x1a')]);return _0x1cfdeb(_0x13c531[_0xdf9f('0x19')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x5a3653,_0x13c531[_0xdf9f('0x19')]['message']);return _0x3dbccd(_0x13c531[_0xdf9f('0x19')][_0xdf9f('0x1a')]);}else{logger['info'](_0xdf9f('0x15'),_0x5a3653,_0xdf9f('0x16'));_0x3dbccd(_0x13c531['result'][_0xdf9f('0x1a')]);}})[_0xdf9f('0x1b')](function(_0x2cadfe){logger[_0xdf9f('0x19')]('UserNotification,\x20%s,\x20%s',_0x5a3653,_0x2cadfe);_0x1cfdeb(_0x2cadfe);});});} \ No newline at end of file +var _0x9a65=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x9a65,0x1de));var _0x59a6=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x9a65[_0x56740a];return _0x257144;};'use strict';var _=require(_0x59a6('0x0'));var util=require(_0x59a6('0x1'));var moment=require(_0x59a6('0x2'));var BPromise=require(_0x59a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59a6('0x4'))['db'];var utils=require(_0x59a6('0x5'));var logger=require(_0x59a6('0x6'))(_0x59a6('0x7'));var config=require(_0x59a6('0x8'));var jayson=require(_0x59a6('0x9'));var client=jayson[_0x59a6('0xa')][_0x59a6('0xb')]({'port':0x232a});config[_0x59a6('0xc')]=_[_0x59a6('0xd')](config[_0x59a6('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59a6('0xc')]));require(_0x59a6('0xe'))['register'](socket);function respondWithRpcPromise(_0x1fab2e,_0x56cfa4,_0x4a1c4a){return new BPromise(function(_0x4f6676,_0x236e2f){return client[_0x59a6('0xf')](_0x1fab2e,_0x4a1c4a)['then'](function(_0x4d073c){logger[_0x59a6('0x10')](_0x59a6('0x11'),_0x56cfa4,_0x59a6('0x12'));logger[_0x59a6('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x56cfa4,_0x59a6('0x12'),JSON[_0x59a6('0x14')](_0x4d073c));if(_0x4d073c[_0x59a6('0x15')]){if(_0x4d073c[_0x59a6('0x15')][_0x59a6('0x16')]===0x1f4){logger['error'](_0x59a6('0x11'),_0x56cfa4,_0x4d073c[_0x59a6('0x15')]['message']);return _0x236e2f(_0x4d073c['error'][_0x59a6('0x17')]);}logger[_0x59a6('0x15')](_0x59a6('0x11'),_0x56cfa4,_0x4d073c[_0x59a6('0x15')][_0x59a6('0x17')]);return _0x4f6676(_0x4d073c[_0x59a6('0x15')][_0x59a6('0x17')]);}else{logger['info'](_0x59a6('0x11'),_0x56cfa4,_0x59a6('0x12'));_0x4f6676(_0x4d073c['result']['message']);}})['catch'](function(_0x3c0843){logger[_0x59a6('0x15')](_0x59a6('0x11'),_0x56cfa4,_0x3c0843);_0x236e2f(_0x3c0843);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 82227dc..ef1ec1d 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 _0x8e77=['register','userNotification:','./userNotification.events','save','remove','update','removeListener'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8e77,0x79));var _0x78e7=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0x8e77[_0x4131da];return _0x583242;};'use strict';var UserNotificationEvents=require(_0x78e7('0x0'));var events=[_0x78e7('0x1'),_0x78e7('0x2'),_0x78e7('0x3')];function createListener(_0x3ef899,_0x1335c8){return function(_0xeffd52){_0x1335c8['emit'](_0x3ef899,_0xeffd52);};}function removeListener(_0x27fd29,_0x458ed7){return function(){UserNotificationEvents[_0x78e7('0x4')](_0x27fd29,_0x458ed7);};}exports[_0x78e7('0x5')]=function(_0x13ae91){for(var _0x2d01b4=0x0,_0x1dfcf9=events['length'];_0x2d01b4<_0x1dfcf9;_0x2d01b4++){var _0xf9ff6b=events[_0x2d01b4];var _0x322914=createListener(_0x78e7('0x6')+_0xf9ff6b,_0x13ae91);UserNotificationEvents['on'](_0xf9ff6b,_0x322914);}}; \ No newline at end of file +var _0x12b5=['length','./userNotification.events','remove','emit','removeListener'];(function(_0x101155,_0x4906f2){var _0x2efaf6=function(_0x31c46e){while(--_0x31c46e){_0x101155['push'](_0x101155['shift']());}};_0x2efaf6(++_0x4906f2);}(_0x12b5,0x14b));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x512b('0x0'));var events=['save',_0x512b('0x1'),'update'];function createListener(_0x52d98b,_0x41f3f7){return function(_0x59e3c3){_0x41f3f7[_0x512b('0x2')](_0x52d98b,_0x59e3c3);};}function removeListener(_0x408cb5,_0x15c795){return function(){UserNotificationEvents[_0x512b('0x3')](_0x408cb5,_0x15c795);};}exports['register']=function(_0x8bdfc0){for(var _0x7b4181=0x0,_0x3e4699=events[_0x512b('0x4')];_0x7b4181<_0x3e4699;_0x7b4181++){var _0x25b4f7=events[_0x7b4181];var _0x46d95b=createListener('userNotification:'+_0x25b4f7,_0x8bdfc0);UserNotificationEvents['on'](_0x25b4f7,_0x46d95b);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b4f776f..91d7495 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31929b,_0x5edd81){var _0x13fdff=function(_0xe8e2fa){while(--_0xe8e2fa){_0x31929b['push'](_0x31929b['shift']());}};_0x13fdff(++_0x5edd81);}(_0xe706,0xa3));var _0x6e70=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0xe706[_0x132b71];return _0x224664;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xce0957,_0x26d76e){var _0x285890=function(_0xc1aa2d){while(--_0xc1aa2d){_0xce0957['push'](_0xce0957['shift']());}};_0x285890(++_0x26d76e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 949935a..a270668 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 _0xb4b7=['sequelize','INTEGER'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xb4b7,0x6a));var _0x7b4b=function(_0x440d29,_0x13f33d){_0x440d29=_0x440d29-0x0;var _0xeb2d67=_0xb4b7[_0x440d29];return _0xeb2d67;};'use strict';var Sequelize=require(_0x7b4b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7b4b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd464=['exports'];(function(_0x56718e,_0x13d207){var _0x2c9e5a=function(_0x33a703){while(--_0x33a703){_0x56718e['push'](_0x56718e['shift']());}};_0x2c9e5a(++_0x13d207);}(_0xd464,0x1f1));var _0x4d46=function(_0x1d923d,_0x2d6c62){_0x1d923d=_0x1d923d-0x0;var _0x1d1493=_0xd464[_0x1d923d];return _0x1d1493;};'use strict';var Sequelize=require('sequelize');module[_0x4d46('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 cd4a47b..ffb1c43 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 _0xe6eb=['path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2ffc82,_0x4938e8){var _0x1ddef0=function(_0x8217c4){while(--_0x8217c4){_0x2ffc82['push'](_0x2ffc82['shift']());}};_0x1ddef0(++_0x4938e8);}(_0xe6eb,0x13e));var _0xbe6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6eb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbe6e('0x0'));var util=require(_0xbe6e('0x1'));var logger=require(_0xbe6e('0x2'))(_0xbe6e('0x3'));var moment=require(_0xbe6e('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe6e('0x5'));var fs=require('fs');var path=require(_0xbe6e('0x6'));var rimraf=require(_0xbe6e('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe6e('0x8'));module['exports']=function(_0x3d5c2f,_0x129ee6){return _0x3d5c2f[_0xbe6e('0x9')](_0xbe6e('0xa'),attributes,{'tableName':_0xbe6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd541=['path','../../config/environment','define','UserOpenchannelQueue','util','../../config/logger','api','moment','request-promise'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd541,0x1a2));var _0x1d54=function(_0xea4f3a,_0x46d2e6){_0xea4f3a=_0xea4f3a-0x0;var _0x88e3dd=_0xd541[_0xea4f3a];return _0x88e3dd;};'use strict';var _=require('lodash');var util=require(_0x1d54('0x0'));var logger=require(_0x1d54('0x1'))(_0x1d54('0x2'));var moment=require(_0x1d54('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d54('0x4'));var fs=require('fs');var path=require(_0x1d54('0x5'));var rimraf=require('rimraf');var config=require(_0x1d54('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x40d113,_0x5293d6){return _0x40d113[_0x1d54('0x7')](_0x1d54('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 641db0d..48fc95f 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 _0xf43c=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x39ae1e,_0x4f6690){var _0x3683f5=function(_0x4b7b15){while(--_0x4b7b15){_0x39ae1e['push'](_0x39ae1e['shift']());}};_0x3683f5(++_0x4f6690);}(_0xf43c,0x123));var _0xcf43=function(_0x55e962,_0xa4721f){_0x55e962=_0x55e962-0x0;var _0x2564d6=_0xf43c[_0x55e962];return _0x2564d6;};'use strict';var _=require(_0xcf43('0x0'));var util=require(_0xcf43('0x1'));var moment=require(_0xcf43('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf43('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf43('0x4'))['db'];var utils=require(_0xcf43('0x5'));var logger=require(_0xcf43('0x6'))(_0xcf43('0x7'));var config=require(_0xcf43('0x8'));var jayson=require(_0xcf43('0x9'));var client=jayson[_0xcf43('0xa')][_0xcf43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e8e9,_0x524b0f,_0x2b1c80){return new BPromise(function(_0x1d2907,_0x57d3b4){return client[_0xcf43('0xc')](_0x37e8e9,_0x2b1c80)[_0xcf43('0xd')](function(_0x18afa1){logger[_0xcf43('0xe')](_0xcf43('0xf'),_0x524b0f,_0xcf43('0x10'));logger[_0xcf43('0x11')](_0xcf43('0x12'),_0x524b0f,_0xcf43('0x10'),JSON[_0xcf43('0x13')](_0x18afa1));if(_0x18afa1[_0xcf43('0x14')]){if(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x15')]===0x1f4){logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0x18afa1['error'][_0xcf43('0x16')]);return _0x57d3b4(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x16')]);}logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0x18afa1[_0xcf43('0x14')]['message']);return _0x1d2907(_0x18afa1[_0xcf43('0x14')][_0xcf43('0x16')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x524b0f,_0xcf43('0x10'));_0x1d2907(_0x18afa1[_0xcf43('0x17')][_0xcf43('0x16')]);}})[_0xcf43('0x18')](function(_0xbe1275){logger[_0xcf43('0x14')](_0xcf43('0xf'),_0x524b0f,_0xbe1275);_0x57d3b4(_0xbe1275);});});} \ No newline at end of file +var _0x82ae=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x424a50,_0x1fd66d){var _0x1427b2=function(_0x35f2a0){while(--_0x35f2a0){_0x424a50['push'](_0x424a50['shift']());}};_0x1427b2(++_0x1fd66d);}(_0x82ae,0x1d6));var _0xe82a=function(_0x38327e,_0x1f2424){_0x38327e=_0x38327e-0x0;var _0x20cc79=_0x82ae[_0x38327e];return _0x20cc79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe82a('0x0'));var BPromise=require('bluebird');var rs=require(_0xe82a('0x1'));var fs=require('fs');var Redis=require(_0xe82a('0x2'));var db=require(_0xe82a('0x3'))['db'];var utils=require(_0xe82a('0x4'));var logger=require(_0xe82a('0x5'))(_0xe82a('0x6'));var config=require(_0xe82a('0x7'));var jayson=require(_0xe82a('0x8'));var client=jayson[_0xe82a('0x9')][_0xe82a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428b58,_0x36ec4c,_0x28b10a){return new BPromise(function(_0x14583,_0x535aff){return client[_0xe82a('0xb')](_0x428b58,_0x28b10a)[_0xe82a('0xc')](function(_0x56507f){logger[_0xe82a('0xd')](_0xe82a('0xe'),_0x36ec4c,_0xe82a('0xf'));logger['debug'](_0xe82a('0x10'),_0x36ec4c,_0xe82a('0xf'),JSON[_0xe82a('0x11')](_0x56507f));if(_0x56507f['error']){if(_0x56507f[_0xe82a('0x12')]['code']===0x1f4){logger['error'](_0xe82a('0xe'),_0x36ec4c,_0x56507f[_0xe82a('0x12')]['message']);return _0x535aff(_0x56507f[_0xe82a('0x12')][_0xe82a('0x13')]);}logger[_0xe82a('0x12')](_0xe82a('0xe'),_0x36ec4c,_0x56507f[_0xe82a('0x12')][_0xe82a('0x13')]);return _0x14583(_0x56507f[_0xe82a('0x12')][_0xe82a('0x13')]);}else{logger[_0xe82a('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x36ec4c,_0xe82a('0xf'));_0x14583(_0x56507f[_0xe82a('0x14')][_0xe82a('0x13')]);}})[_0xe82a('0x15')](function(_0x288fc4){logger[_0xe82a('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x36ec4c,_0x288fc4);_0x535aff(_0x288fc4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b04c203..3b352d0 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 _0x1140=['getResources','post','create','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe','isAuthenticated','describe','/:id/sections','/:id/resources'];(function(_0x78d813,_0xc8740f){var _0x4c2647=function(_0x343eef){while(--_0x343eef){_0x78d813['push'](_0x78d813['shift']());}};_0x4c2647(++_0xc8740f);}(_0x1140,0xfe));var _0x0114=function(_0x5ba661,_0x4a7854){_0x5ba661=_0x5ba661-0x0;var _0x179abb=_0x1140[_0x5ba661];return _0x179abb;};'use strict';var multer=require(_0x0114('0x0'));var util=require('util');var path=require(_0x0114('0x1'));var timeout=require(_0x0114('0x2'));var express=require(_0x0114('0x3'));var router=express[_0x0114('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0114('0x5'));var interaction=require(_0x0114('0x6'));var config=require(_0x0114('0x7'));var controller=require(_0x0114('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0114('0x9')]);router[_0x0114('0xa')](_0x0114('0xb'),auth[_0x0114('0xc')](),controller[_0x0114('0xd')]);router['get']('/:id',auth[_0x0114('0xc')](),controller['show']);router[_0x0114('0xa')](_0x0114('0xe'),auth[_0x0114('0xc')](),controller['getSections']);router['get'](_0x0114('0xf'),auth[_0x0114('0xc')](),controller[_0x0114('0x10')]);router[_0x0114('0x11')]('/',auth['isAuthenticated'](),controller[_0x0114('0x12')]);router[_0x0114('0x11')](_0x0114('0x13'),auth[_0x0114('0xc')](),controller[_0x0114('0x14')]);router[_0x0114('0x11')](_0x0114('0xe'),auth[_0x0114('0xc')](),controller[_0x0114('0x15')]);router[_0x0114('0x11')](_0x0114('0xf'),auth['isAuthenticated'](),controller[_0x0114('0x16')]);router['put'](_0x0114('0x17'),auth['isAuthenticated'](),controller[_0x0114('0x18')]);router[_0x0114('0x19')](_0x0114('0x17'),auth[_0x0114('0xc')](),controller[_0x0114('0x1a')]);router['delete'](_0x0114('0xe'),auth[_0x0114('0xc')](),controller[_0x0114('0x1b')]);router[_0x0114('0x19')](_0x0114('0xf'),auth[_0x0114('0xc')](),controller[_0x0114('0x1c')]);module[_0x0114('0x1d')]=router; \ No newline at end of file +var _0x91ed=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update'];(function(_0x316098,_0xb6a02c){var _0x44bb13=function(_0x2df9ed){while(--_0x2df9ed){_0x316098['push'](_0x316098['shift']());}};_0x44bb13(++_0xb6a02c);}(_0x91ed,0x7f));var _0xd91e=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x91ed[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xd91e('0x0'));var path=require(_0xd91e('0x1'));var timeout=require('connect-timeout');var express=require(_0xd91e('0x2'));var router=express[_0xd91e('0x3')]();var fs_extra=require(_0xd91e('0x4'));var auth=require(_0xd91e('0x5'));var interaction=require(_0xd91e('0x6'));var config=require(_0xd91e('0x7'));var controller=require(_0xd91e('0x8'));router[_0xd91e('0x9')]('/',auth[_0xd91e('0xa')](),controller[_0xd91e('0xb')]);router[_0xd91e('0x9')](_0xd91e('0xc'),auth['isAuthenticated'](),controller[_0xd91e('0xd')]);router[_0xd91e('0x9')](_0xd91e('0xe'),auth[_0xd91e('0xa')](),controller[_0xd91e('0xf')]);router['get'](_0xd91e('0x10'),auth['isAuthenticated'](),controller[_0xd91e('0x11')]);router[_0xd91e('0x9')](_0xd91e('0x12'),auth['isAuthenticated'](),controller[_0xd91e('0x13')]);router[_0xd91e('0x14')]('/',auth[_0xd91e('0xa')](),controller[_0xd91e('0x15')]);router[_0xd91e('0x14')](_0xd91e('0x16'),auth[_0xd91e('0xa')](),controller[_0xd91e('0x17')]);router[_0xd91e('0x14')]('/:id/sections',auth[_0xd91e('0xa')](),controller[_0xd91e('0x18')]);router[_0xd91e('0x14')](_0xd91e('0x12'),auth[_0xd91e('0xa')](),controller[_0xd91e('0x19')]);router[_0xd91e('0x1a')](_0xd91e('0xe'),auth[_0xd91e('0xa')](),controller[_0xd91e('0x1b')]);router[_0xd91e('0x1c')](_0xd91e('0xe'),auth[_0xd91e('0xa')](),controller[_0xd91e('0x1d')]);router[_0xd91e('0x1c')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0xd91e('0x1c')](_0xd91e('0x12'),auth[_0xd91e('0xa')](),controller['removeResources']);module[_0xd91e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5e30aad..0e66574 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 _0xf919=['BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x25b186,_0x230363){var _0x5b3392=function(_0x131859){while(--_0x131859){_0x25b186['push'](_0x25b186['shift']());}};_0x5b3392(++_0x230363);}(_0xf919,0x1c3));var _0x9f91=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xf919[_0x2adfb1];return _0xa52d45;};'use strict';var Sequelize=require('sequelize');module[_0x9f91('0x0')]={'name':{'type':Sequelize[_0x9f91('0x1')],'allowNull':![],'unique':_0x9f91('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3ea08b){this[_0x9f91('0x3')](_0x9f91('0x4'),_0x3ea08b?_0x3ea08b[_0x9f91('0x5')](''):[]);},'get':function(){return this[_0x9f91('0x6')](_0x9f91('0x4'))?this[_0x9f91('0x6')](_0x9f91('0x4'))[_0x9f91('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9f91('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9f91('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8ad9=['split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x7775a2,_0x277471){var _0x541c68=function(_0x5a4ad0){while(--_0x5a4ad0){_0x7775a2['push'](_0x7775a2['shift']());}};_0x541c68(++_0x277471);}(_0x8ad9,0x1c4));var _0x98ad=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x8ad9[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x98ad('0x0'));module['exports']={'name':{'type':Sequelize[_0x98ad('0x1')],'allowNull':![],'unique':_0x98ad('0x2')},'crudPermissions':{'type':Sequelize[_0x98ad('0x1')],'set':function(_0x33dbb5){this[_0x98ad('0x3')](_0x98ad('0x4'),_0x33dbb5?_0x33dbb5[_0x98ad('0x5')](''):[]);},'get':function(){return this[_0x98ad('0x6')](_0x98ad('0x4'))?this[_0x98ad('0x6')]('crudPermissions')[_0x98ad('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x98ad('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x98ad('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d0b077e..689200f 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 _0x5341=['then','destroy','sendStatus','name','send','index','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','clone','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update'];(function(_0x99f811,_0x44d59e){var _0x37ba7f=function(_0x3f3961){while(--_0x3f3961){_0x99f811['push'](_0x99f811['shift']());}};_0x37ba7f(++_0x44d59e);}(_0x5341,0xbb));var _0x1534=function(_0x1bfe4e,_0x5ba960){_0x1bfe4e=_0x1bfe4e-0x0;var _0x575316=_0x5341[_0x1bfe4e];return _0x575316;};'use strict';var emlformat=require(_0x1534('0x0'));var rimraf=require(_0x1534('0x1'));var zipdir=require(_0x1534('0x2'));var jsonpatch=require(_0x1534('0x3'));var rp=require(_0x1534('0x4'));var moment=require(_0x1534('0x5'));var BPromise=require(_0x1534('0x6'));var Mustache=require(_0x1534('0x7'));var util=require('util');var path=require(_0x1534('0x8'));var sox=require('sox');var csv=require(_0x1534('0x9'));var ejs=require(_0x1534('0xa'));var fs=require('fs');var fs_extra=require(_0x1534('0xb'));var _=require(_0x1534('0xc'));var squel=require(_0x1534('0xd'));var crypto=require('crypto');var jsforce=require(_0x1534('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1534('0x9'));var querystring=require('querystring');var Papa=require(_0x1534('0xf'));var Redis=require(_0x1534('0x10'));var authService=require(_0x1534('0x11'));var qs=require(_0x1534('0x12'));var as=require(_0x1534('0x13'));var hardwareService=require(_0x1534('0x14'));var logger=require(_0x1534('0x15'))('api');var utils=require(_0x1534('0x16'));var config=require(_0x1534('0x17'));var licenseUtil=require(_0x1534('0x18'));var db=require(_0x1534('0x19'))['db'];config[_0x1534('0x1a')]=_['defaults'](config[_0x1534('0x1a')],{'host':_0x1534('0x1b'),'port':0x18eb});var socket=require(_0x1534('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x1534('0x1d')](socket);function respondWithStatusCode(_0x42d504,_0x16570c){_0x16570c=_0x16570c||0xcc;return function(_0x23a515){if(_0x23a515){return _0x42d504['sendStatus'](_0x16570c);}return _0x42d504[_0x1534('0x1e')](_0x16570c)[_0x1534('0x1f')]();};}function respondWithResult(_0x46074d,_0x2c34c5){_0x2c34c5=_0x2c34c5||0xc8;return function(_0x13ee42){if(_0x13ee42){return _0x46074d[_0x1534('0x1e')](_0x2c34c5)['json'](_0x13ee42);}};}function respondWithFilteredResult(_0x2292fd,_0x22a9b3){return function(_0x31c5f9){if(_0x31c5f9){var _0x39d5cb=typeof _0x22a9b3[_0x1534('0x20')]===_0x1534('0x21')&&typeof _0x22a9b3['limit']===_0x1534('0x21');var _0x4dfb05=_0x31c5f9[_0x1534('0x22')];var _0x5c9041=_0x39d5cb?0x0:_0x22a9b3[_0x1534('0x20')];var _0x23e3f9=_0x39d5cb?_0x31c5f9[_0x1534('0x22')]:_0x22a9b3[_0x1534('0x20')]+_0x22a9b3[_0x1534('0x23')];var _0x1645f5;if(_0x23e3f9>=_0x4dfb05){_0x23e3f9=_0x4dfb05;_0x1645f5=0xc8;}else{_0x1645f5=0xce;}_0x2292fd['status'](_0x1645f5);return _0x2292fd[_0x1534('0x24')](_0x1534('0x25'),_0x5c9041+'-'+_0x23e3f9+'/'+_0x4dfb05)[_0x1534('0x26')](_0x31c5f9);}return null;};}function patchUpdates(_0x5e1733){return function(_0x2003d7){try{jsonpatch[_0x1534('0x27')](_0x2003d7,_0x5e1733,!![]);}catch(_0x22ec6d){return BPromise[_0x1534('0x28')](_0x22ec6d);}return _0x2003d7[_0x1534('0x29')]();};}function saveUpdates(_0x19b424,_0x1a08dd){return function(_0x408d34){if(_0x408d34){return _0x408d34[_0x1534('0x2a')](_0x19b424)[_0x1534('0x2b')](function(_0x467f59){return _0x467f59;});}return null;};}function removeEntity(_0x2b3cbe,_0x11fe23){return function(_0x8f8614){if(_0x8f8614){return _0x8f8614[_0x1534('0x2c')]()[_0x1534('0x2b')](function(){_0x2b3cbe[_0x1534('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2935d6,_0x107113){return function(_0x194932){if(!_0x194932){_0x2935d6[_0x1534('0x2d')](0x194);}return _0x194932;};}function handleError(_0x31a201,_0x157889){_0x157889=_0x157889||0x1f4;return function(_0x44fcb1){logger['error'](_0x44fcb1['stack']);if(_0x44fcb1[_0x1534('0x2e')]){delete _0x44fcb1['name'];}_0x31a201['status'](_0x157889)[_0x1534('0x2f')](_0x44fcb1);};}exports[_0x1534('0x30')]=function(_0x312635,_0x2768e9){var _0x2d7bbd={},_0x3ff721={},_0x372dec={'count':0x0,'rows':[]};var _0x1e193e=_[_0x1534('0x31')](db[_0x1534('0x32')]['rawAttributes'],function(_0x2e37be){return{'name':_0x2e37be[_0x1534('0x33')],'type':_0x2e37be['type'][_0x1534('0x34')]};});_0x3ff721[_0x1534('0x35')]=_['map'](_0x1e193e,'name');_0x3ff721[_0x1534('0x36')]=_[_0x1534('0x37')](_0x312635[_0x1534('0x36')]);_0x3ff721[_0x1534('0x38')]=_[_0x1534('0x39')](_0x3ff721[_0x1534('0x35')],_0x3ff721[_0x1534('0x36')]);_0x2d7bbd[_0x1534('0x3a')]=_[_0x1534('0x39')](_0x3ff721[_0x1534('0x35')],qs['fields'](_0x312635['query'][_0x1534('0x3b')]));_0x2d7bbd['attributes']=_0x2d7bbd['attributes'][_0x1534('0x3c')]?_0x2d7bbd['attributes']:_0x3ff721['model'];if(!_0x312635[_0x1534('0x36')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x2d7bbd[_0x1534('0x23')]=qs['limit'](_0x312635[_0x1534('0x36')][_0x1534('0x23')]);_0x2d7bbd[_0x1534('0x20')]=qs['offset'](_0x312635[_0x1534('0x36')][_0x1534('0x20')]);}_0x2d7bbd[_0x1534('0x3f')]=qs[_0x1534('0x40')](_0x312635[_0x1534('0x36')][_0x1534('0x40')]);_0x2d7bbd[_0x1534('0x41')]=qs[_0x1534('0x38')](_['pick'](_0x312635[_0x1534('0x36')],_0x3ff721['filters']),_0x1e193e);if(_0x312635['query'][_0x1534('0x42')]){_0x2d7bbd[_0x1534('0x41')]=_[_0x1534('0x43')](_0x2d7bbd[_0x1534('0x41')],{'$or':_[_0x1534('0x31')](_0x1e193e,function(_0x199e2){if(_0x199e2[_0x1534('0x44')]!=='VIRTUAL'){var _0x5eec43={};_0x5eec43[_0x199e2[_0x1534('0x2e')]]={'$like':'%'+_0x312635[_0x1534('0x36')]['filter']+'%'};return _0x5eec43;}})});}_0x2d7bbd=_[_0x1534('0x43')]({},_0x2d7bbd,_0x312635['options']);var _0x36e49b={'where':_0x2d7bbd[_0x1534('0x41')]};return db[_0x1534('0x32')][_0x1534('0x22')](_0x36e49b)[_0x1534('0x2b')](function(_0x8ab61e){_0x372dec[_0x1534('0x22')]=_0x8ab61e;if(_0x312635[_0x1534('0x36')][_0x1534('0x45')]){_0x2d7bbd[_0x1534('0x46')]=[{'all':!![]}];}return db[_0x1534('0x32')][_0x1534('0x47')](_0x2d7bbd);})['then'](function(_0x475abb){_0x372dec[_0x1534('0x48')]=_0x475abb;return _0x372dec;})[_0x1534('0x2b')](respondWithFilteredResult(_0x2768e9,_0x2d7bbd))[_0x1534('0x49')](handleError(_0x2768e9,null));};exports[_0x1534('0x4a')]=function(_0x28aa0e,_0x418f96){var _0x3cbe19={'raw':![],'where':{'id':_0x28aa0e[_0x1534('0x4b')]['id']}},_0x2d87df={};_0x2d87df['model']=_[_0x1534('0x37')](db['UserProfile'][_0x1534('0x4c')]);_0x2d87df[_0x1534('0x36')]=_[_0x1534('0x37')](_0x28aa0e[_0x1534('0x36')]);_0x2d87df[_0x1534('0x38')]=_[_0x1534('0x39')](_0x2d87df[_0x1534('0x35')],_0x2d87df[_0x1534('0x36')]);_0x3cbe19[_0x1534('0x3a')]=_[_0x1534('0x39')](_0x2d87df['model'],qs['fields'](_0x28aa0e[_0x1534('0x36')][_0x1534('0x3b')]));_0x3cbe19['attributes']=_0x3cbe19[_0x1534('0x3a')]['length']?_0x3cbe19[_0x1534('0x3a')]:_0x2d87df[_0x1534('0x35')];if(_0x28aa0e[_0x1534('0x36')][_0x1534('0x45')]){_0x3cbe19[_0x1534('0x46')]=[{'all':!![]}];}_0x3cbe19=_['merge']({},_0x3cbe19,_0x28aa0e[_0x1534('0x4d')]);return db[_0x1534('0x32')]['find'](_0x3cbe19)['then'](handleEntityNotFound(_0x418f96,null))['then'](respondWithResult(_0x418f96,null))['catch'](handleError(_0x418f96,null));};exports[_0x1534('0x4e')]=function(_0x5ca63c,_0x2a4307){return db[_0x1534('0x32')][_0x1534('0x4e')](_0x5ca63c[_0x1534('0x4f')],{})[_0x1534('0x2b')](respondWithResult(_0x2a4307,0xc9))[_0x1534('0x49')](handleError(_0x2a4307,null));};exports[_0x1534('0x50')]=function(_0x41bd08,_0x404b83){var _0x3781d3={'where':{'id':_0x41bd08[_0x1534('0x4b')]['id']}},_0x3f556d={};_0x3f556d['model']=_[_0x1534('0x37')](db[_0x1534('0x32')][_0x1534('0x4c')]);_0x3781d3['attributes']=_[_0x1534('0x39')](_0x3f556d[_0x1534('0x35')],qs[_0x1534('0x3b')](_0x41bd08[_0x1534('0x36')][_0x1534('0x3b')]));_0x3781d3[_0x1534('0x3a')]=_0x3781d3['attributes'][_0x1534('0x3c')]?_0x3781d3[_0x1534('0x3a')]:_0x3f556d[_0x1534('0x35')];if(_0x41bd08['query'][_0x1534('0x45')]){_0x3781d3[_0x1534('0x46')]=[{'all':!![]}];}_0x3781d3=_[_0x1534('0x43')]({},_0x3781d3,_0x41bd08['options']);return db[_0x1534('0x32')][_0x1534('0x51')](_0x3781d3)[_0x1534('0x2b')](handleEntityNotFound(_0x404b83,null))[_0x1534('0x2b')](function(_0x28bf34){if(_0x28bf34){var _0x4e716d=_0x28bf34[_0x1534('0x52')]({'plain':!![]});_0x4e716d=qs[_0x1534('0x53')](_0x4e716d,['id','createdAt',_0x1534('0x54'),_0x1534('0x55')]);_0x41bd08['body']=_[_0x1534('0x53')](_0x41bd08[_0x1534('0x4f')],['id',_0x1534('0x56'),_0x1534('0x54')]);return db[_0x1534('0x57')][_0x1534('0x58')](function(_0x3949be){return db[_0x1534('0x32')][_0x1534('0x4e')](_['merge'](_0x4e716d,_0x41bd08[_0x1534('0x4f')]),{'include':_0x41bd08[_0x1534('0x36')][_0x1534('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3949be})[_0x1534('0x2b')](function(_0x474180){var _0x1d8d40=_0x474180['get']({'plain':!![]});return db[_0x1534('0x59')][_0x1534('0x47')]({'where':{'userProfileId':_0x41bd08[_0x1534('0x4b')]['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x3b85ae){if(_0x3b85ae){return BPromise[_0x1534('0x5a')](_0x3b85ae,function(_0x96945b){return new BPromise(function(_0xc7a02d,_0x285f86){if(_0x96945b[_0x1534('0x5b')]===null||_0x96945b[_0x1534('0x5b')]===0x1)_0xc7a02d(null);return db[_0x1534('0x5c')]['findAll']({'where':{'sectionId':_0x96945b['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x4a5e92){var _0x2cb86b=_[_0x1534('0x31')](_0x4a5e92,function(_0x362c01){return qs[_0x1534('0x53')](_0x362c01,['id',_0x1534('0x56'),'updatedAt',_0x1534('0x5d')]);});_0xc7a02d(_0x2cb86b);})[_0x1534('0x49')](function(_0x5e7edd){_0x285f86(_0x5e7edd);});})[_0x1534('0x2b')](function(_0x1d6313){var _0x7caa7b=qs[_0x1534('0x53')](_0x96945b,['id','createdAt',_0x1534('0x54')]);_0x7caa7b[_0x1534('0x5e')]=_0x1d8d40['id'];if(_0x1d6313)_0x7caa7b[_0x1534('0x5f')]=_0x1d6313;return _0x7caa7b;})[_0x1534('0x2b')](function(_0x525eb0){return db[_0x1534('0x59')][_0x1534('0x4e')](_0x525eb0,{'include':[{'model':db['UserProfileResource'],'as':_0x1534('0x5f')}],'raw':!![],'transaction':_0x3949be});});})[_0x1534('0x2b')](function(){return _0x1d8d40;});}});});});}})[_0x1534('0x2b')](respondWithResult(_0x404b83,0xc9))[_0x1534('0x49')](handleError(_0x404b83,null));};exports[_0x1534('0x2a')]=function(_0xaf7079,_0x5de5b2){if(_0xaf7079[_0x1534('0x4f')]['id']){delete _0xaf7079[_0x1534('0x4f')]['id'];}return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0xaf7079[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x5de5b2,null))[_0x1534('0x2b')](saveUpdates(_0xaf7079[_0x1534('0x4f')],null))[_0x1534('0x2b')](respondWithResult(_0x5de5b2,null))[_0x1534('0x49')](handleError(_0x5de5b2,null));};exports[_0x1534('0x2c')]=function(_0x146454,_0x55df0c){return db[_0x1534('0x32')]['find']({'where':{'id':_0x146454[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x55df0c,null))[_0x1534('0x2b')](removeEntity(_0x55df0c,null))[_0x1534('0x49')](handleError(_0x55df0c,null));};exports[_0x1534('0x60')]=function(_0x5264f9,_0x1113e5){return db['UserProfile']['describe']()[_0x1534('0x2b')](respondWithResult(_0x1113e5,null))[_0x1534('0x49')](handleError(_0x1113e5,null));};exports['addSections']=function(_0x425267,_0x4283e0){var _0x364e8a=_0x425267['body'];return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0x425267['params']['id']}})['then'](handleEntityNotFound(_0x4283e0,null))['then'](function(_0x58b2a2){if(_0x58b2a2){return db['sequelize'][_0x1534('0x58')](function(_0x514d06){return db[_0x1534('0x59')]['destroy']({'where':{'userProfileId':_0x425267['params']['id'],'sectionId':_[_0x1534('0x31')](_0x364e8a,function(_0x548f98){return _0x548f98['sectionId'];})},'transaction':_0x514d06})[_0x1534('0x2b')](function(){var _0x14e384=_['map'](_0x364e8a,function(_0xf32170){_0xf32170[_0x1534('0x5e')]=_0x425267[_0x1534('0x4b')]['id'];return _0xf32170;});var _0x1c27c6=[];return BPromise[_0x1534('0x5a')](_0x14e384,function(_0x16705f){return db['UserProfileSection'][_0x1534('0x4e')](_0x16705f,{'include':[{'model':db['UserProfileResource'],'as':_0x1534('0x5f')}],'raw':!![],'transaction':_0x514d06})[_0x1534('0x2b')](function(_0x46c9f7){_0x1c27c6[_0x1534('0x61')](_0x46c9f7[_0x1534('0x52')]({'plain':!![]}));});})[_0x1534('0x2b')](function(){return _0x1c27c6;});});});}})[_0x1534('0x2b')](function(_0x62a479){return _0x62a479;})[_0x1534('0x2b')](respondWithResult(_0x4283e0,null))['catch'](handleError(_0x4283e0,null));};exports[_0x1534('0x62')]=function(_0x4931f1,_0x6788c3){var _0x2f1cfa;return db[_0x1534('0x32')]['find']({'where':{'id':_0x4931f1[_0x1534('0x4b')]['id']},'attributes':['id',_0x1534('0x2e')]})['then'](handleEntityNotFound(_0x6788c3,null))['then'](function(_0xe9a103){if(_0xe9a103){_0x2f1cfa=_0xe9a103;return db[_0x1534('0x59')][_0x1534('0x2c')]({'where':{'userProfileId':_0x4931f1[_0x1534('0x4b')]['id'],'sectionId':_0x4931f1[_0x1534('0x36')]['ids']}});}})[_0x1534('0x2b')](function(){return _0x2f1cfa;})[_0x1534('0x2b')](respondWithStatusCode(_0x6788c3,null))[_0x1534('0x49')](handleError(_0x6788c3,null));};exports[_0x1534('0x63')]=function(_0x53cf8b,_0x55c210){var _0xa37ab1=[];var _0x15c1d4=[];return db[_0x1534('0x59')]['findAll']({'where':{'userProfileId':_0x53cf8b['params']['id']},'raw':!![]})['then'](function(_0x132b0f){_0xa37ab1=_[_0x1534('0x42')](_0x132b0f,function(_0x1f40d4){return _0x1f40d4['enabled']===0x1||_[_0x1534('0x64')]([0x3eb,0x709],_0x1f40d4[_0x1534('0x5d')]);});if(!_[_0x1534('0x65')](_0xa37ab1)){return _[_0x1534('0x31')](_0xa37ab1,function(_0x3f591a){return _0x3f591a[_0x1534('0x5d')];});}else{return;}})['then'](function(_0x1dca2f){if(_0x1dca2f)_0x15c1d4=_0x1dca2f;if(_[_0x1534('0x64')](_0x15c1d4,0x64)){var _0x44d0e3=_[_0x1534('0x51')](_0xa37ab1,{'sectionId':0x64});return hasDefaultDashboard(_0x44d0e3)[_0x1534('0x2b')](function(_0x5d9e94){return _[_0x1534('0x31')](_0xa37ab1,function(_0x38cd09){if(_0x38cd09['sectionId']===0x64){_0x38cd09[_0x1534('0x66')]=_0x5d9e94;}return _0x38cd09;});});}else{return;}})['then'](function(_0x48824a){if(_0x48824a)_0xa37ab1=_0x48824a;if(_[_0x1534('0x64')](_0x15c1d4,0x3eb)){var _0x56c903=_[_0x1534('0x51')](_0xa37ab1,{'sectionId':0x3eb});return getCustomDashboards(_0x56c903)['then'](function(_0x5cc909){return _[_0x1534('0x31')](_0xa37ab1,function(_0xf85f55){if(_0x56c903[_0x1534('0x67')]){if(_0xf85f55[_0x1534('0x5d')]===0x3eb){_0xf85f55[_0x1534('0x66')]=_0x5cc909;}}else{if(_0xf85f55[_0x1534('0x5d')]===0x64){if(!_0xf85f55[_0x1534('0x66')]){_0xf85f55[_0x1534('0x66')]=[];}_0xf85f55[_0x1534('0x66')]=_0xf85f55[_0x1534('0x66')]['concat'](_0x5cc909);}}return _0xf85f55;});});}else{return;}})[_0x1534('0x2b')](function(_0x33b9a2){if(_0x33b9a2)_0xa37ab1=_0x33b9a2;if(_[_0x1534('0x64')](_0x15c1d4,0x709)){var _0x159551=_['find'](_0xa37ab1,{'sectionId':0x709});return getPlugins(_0x159551)['then'](function(_0xc239de){if(_0x159551[_0x1534('0x67')]){return _[_0x1534('0x31')](_0xa37ab1,function(_0x5a8fe6){if(_0x5a8fe6[_0x1534('0x5d')]===0x709){_0x5a8fe6['subsections']=_0xc239de;}return _0x5a8fe6;});}else{var _0x3ecaef={'sectionId':0x76c,'enabled':0x1,'subsections':_0xc239de};var _0x4ef90b=_[_0x1534('0x31')](_0xa37ab1);_0x4ef90b['push'](_0x3ecaef);return _0x4ef90b;}});}else{return;}})[_0x1534('0x2b')](function(_0x24b39d){if(_0x24b39d)_0xa37ab1=_0x24b39d;return _['filter'](_0xa37ab1,[_0x1534('0x67'),0x1]);})[_0x1534('0x2b')](respondWithResult(_0x55c210,null))[_0x1534('0x49')](handleError(_0x55c210,null));};function hasDefaultDashboard(_0x2382a1){var _0x1b6277=[0x65];return new BPromise(function(_0x1aa3b8,_0x3a487b){try{if(_0x2382a1[_0x1534('0x5b')]){_0x1aa3b8(_0x1b6277);}else{return db[_0x1534('0x5c')][_0x1534('0x68')]({'where':{'sectionId':_0x2382a1['id']},'raw':!![]})['then'](function(_0x495799){_0x495799?_0x1aa3b8(_0x1b6277):_0x1aa3b8();});}}catch(_0x5e31fc){_0x3a487b(_0x5e31fc);}});}function getCustomDashboards(_0x1648bf){var _0xe85ec4=[];return new BPromise(function(_0x23af5f,_0x3dd084){try{if(_0x1648bf['autoAssociation']){return db[_0x1534('0x69')]['findAll']({'raw':!![]})[_0x1534('0x2b')](function(_0x2098fa){_0x2098fa[_0x1534('0x6a')](function(_0x3b498f){_0xe85ec4[_0x1534('0x61')](_0x3b498f['id']+0x1869f);});_0x23af5f(_0xe85ec4);});}else{return db['UserProfileResource'][_0x1534('0x47')]({'where':{'sectionId':_0x1648bf['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x136fc3){_0x136fc3[_0x1534('0x6a')](function(_0x50e339){_0xe85ec4[_0x1534('0x61')](_0x50e339['resourceId']+0x1869f);});_0x23af5f(_0xe85ec4);});}}catch(_0x2949db){_0x3dd084(_0x2949db);}});}function getPlugins(_0x2dc96c){var _0x5a50ef=[];return new BPromise(function(_0x105e3f,_0x8f888b){try{if(_0x2dc96c[_0x1534('0x5b')]){return db['Plugin'][_0x1534('0x47')]({'raw':!![]})['then'](function(_0x119dd4){_0x119dd4[_0x1534('0x6a')](function(_0x1cec0b){_0x5a50ef[_0x1534('0x61')](_0x1cec0b['id']+0x15b38);});_0x105e3f(_0x5a50ef);});}else{return db[_0x1534('0x5c')]['findAll']({'where':{'sectionId':_0x2dc96c['id']},'raw':!![]})[_0x1534('0x2b')](function(_0x1a1794){_0x1a1794[_0x1534('0x6a')](function(_0x35fcae){_0x5a50ef['push'](_0x35fcae[_0x1534('0x6b')]+0x15b38);});_0x105e3f(_0x5a50ef);});}}catch(_0x15c23a){_0x8f888b(_0x15c23a);}});}exports[_0x1534('0x6c')]=function(_0x226958,_0x439e08){return db[_0x1534('0x32')][_0x1534('0x51')]({'where':{'id':_0x226958[_0x1534('0x4b')]['id']}})['then'](handleEntityNotFound(_0x439e08,null))[_0x1534('0x2b')](function(_0x2e0636){if(_0x2e0636){return db[_0x1534('0x57')]['transaction'](function(_0x4ab2b7){return db[_0x1534('0x59')]['findAll']({'where':{'userProfileId':_0x226958[_0x1534('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x1534('0x2b')](function(_0x9a6c44){if(_0x9a6c44){return db[_0x1534('0x59')][_0x1534('0x2c')]({'where':{'userProfileId':_0x226958['params']['id'],'id':_[_0x1534('0x31')](_0x9a6c44,function(_0x2437ce){return _0x2437ce['id'];})},'transaction':_0x4ab2b7});}})[_0x1534('0x2b')](function(_0xf44891){var _0x224f5b=_[_0x1534('0x31')](_0x226958[_0x1534('0x4f')],function(_0x496343){_0x496343[_0x1534('0x5e')]=_0x226958[_0x1534('0x4b')]['id'];return _0x496343;});return db[_0x1534('0x59')]['bulkCreate'](_0x224f5b,{'raw':!![],'transaction':_0x4ab2b7});})[_0x1534('0x2b')](function(_0x27b23b){var _0x98c9ed=_[_0x1534('0x42')](_['map'](_0x27b23b,function(_0x30525e){return _0x30525e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x98c9ed){return db[_0x1534('0x59')][_0x1534('0x47')]({'where':{'userProfileId':_0x226958['params']['id'],'sectionId':_[_0x1534('0x31')](_0x98c9ed,function(_0x2c01ae){return _0x2c01ae[_0x1534('0x5d')];})},'attributes':['id',_0x1534('0x5d')],'raw':!![]})[_0x1534('0x2b')](function(_0x190490){var _0x176e05=_['map'](_0x226958[_0x1534('0x4f')],function(_0x3a1ee3){_0x3a1ee3[_0x1534('0x5e')]=_0x226958[_0x1534('0x4b')]['id'];return _0x3a1ee3;});return db['UserProfileResource']['bulkCreate'](_0x176e05,{'raw':!![],'transaction':_0x4ab2b7});});}})[_0x1534('0x49')](handleError(_0x439e08,null));});}})[_0x1534('0x2b')](function(_0x106fc8){var _0x307347=_[_0x1534('0x31')](_0x106fc8,function(_0xe400c7){return _0xe400c7[_0x1534('0x52')]({'plain':!![]});});})[_0x1534('0x2b')](respondWithResult(_0x439e08,null))['catch'](handleError(_0x439e08,null));};exports[_0x1534('0x6d')]=function(_0x475c8a,_0x3bd222,_0x1f2aa5){return db['UserProfile'][_0x1534('0x51')]({'where':{'id':_0x475c8a[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](handleEntityNotFound(_0x3bd222,null))[_0x1534('0x2b')](function(_0x2fdabb){if(_0x2fdabb){return _0x2fdabb[_0x1534('0x6d')](_0x475c8a[_0x1534('0x36')][_0x1534('0x6e')]);}})[_0x1534('0x2b')](respondWithStatusCode(_0x3bd222,null))[_0x1534('0x49')](handleError(_0x3bd222,null));};exports[_0x1534('0x6f')]=function(_0x565d19,_0x390edc){var _0x196804={};if(!_0x565d19[_0x1534('0x36')][_0x1534('0x70')])throw new Error(_0x1534('0x71'));if(!_0x565d19[_0x1534('0x36')][_0x1534('0x3d')](_0x1534('0x3e'))){_0x196804[_0x1534('0x23')]=qs[_0x1534('0x23')](_0x565d19['query']['limit']);_0x196804['offset']=qs[_0x1534('0x20')](_0x565d19[_0x1534('0x36')][_0x1534('0x20')]);}return db['UserProfile'][_0x1534('0x51')]({'where':{'id':_0x565d19[_0x1534('0x4b')]['id']}})[_0x1534('0x2b')](function(_0x2a27b3){if(!_0x2a27b3)throw new Error(_0x1534('0x72')+_0x565d19['params']['id']);return db[_0x1534('0x32')][_0x1534('0x6f')](_0x565d19);})[_0x1534('0x2b')](respondWithFilteredResult(_0x390edc,_0x196804))[_0x1534('0x49')](handleError(_0x390edc,null));}; \ No newline at end of file +var _0x5f55=['type','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','socket.io-emitter','./userProfile.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x22b8cb,_0x261624){var _0x433876=function(_0x3b0a07){while(--_0x3b0a07){_0x22b8cb['push'](_0x22b8cb['shift']());}};_0x433876(++_0x261624);}(_0x5f55,0x1f1));var _0x55f5=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0x5f55[_0x67c7e2];return _0x52b665;};'use strict';var emlformat=require(_0x55f5('0x0'));var rimraf=require(_0x55f5('0x1'));var zipdir=require(_0x55f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55f5('0x3'));var moment=require(_0x55f5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x55f5('0x5'));var csv=require(_0x55f5('0x6'));var ejs=require(_0x55f5('0x7'));var fs=require('fs');var fs_extra=require(_0x55f5('0x8'));var _=require('lodash');var squel=require(_0x55f5('0x9'));var crypto=require(_0x55f5('0xa'));var jsforce=require(_0x55f5('0xb'));var deskjs=require(_0x55f5('0xc'));var toCsv=require(_0x55f5('0x6'));var querystring=require(_0x55f5('0xd'));var Papa=require(_0x55f5('0xe'));var Redis=require(_0x55f5('0xf'));var authService=require(_0x55f5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x55f5('0x11'));var hardwareService=require(_0x55f5('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x55f5('0x13'));var licenseUtil=require(_0x55f5('0x14'));var db=require('../../mysqldb')['db'];config[_0x55f5('0x15')]=_['defaults'](config[_0x55f5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x55f5('0x16'))(new Redis(config['redis']));require(_0x55f5('0x17'))[_0x55f5('0x18')](socket);function respondWithStatusCode(_0x14c270,_0x2371f9){_0x2371f9=_0x2371f9||0xcc;return function(_0x34b1ee){if(_0x34b1ee){return _0x14c270['sendStatus'](_0x2371f9);}return _0x14c270[_0x55f5('0x19')](_0x2371f9)[_0x55f5('0x1a')]();};}function respondWithResult(_0x4f26f3,_0x1ca94c){_0x1ca94c=_0x1ca94c||0xc8;return function(_0x3860b5){if(_0x3860b5){return _0x4f26f3['status'](_0x1ca94c)[_0x55f5('0x1b')](_0x3860b5);}};}function respondWithFilteredResult(_0x3acce6,_0x3f4a71){return function(_0x4994fa){if(_0x4994fa){var _0xfaba00=typeof _0x3f4a71['offset']===_0x55f5('0x1c')&&typeof _0x3f4a71['limit']===_0x55f5('0x1c');var _0xc13011=_0x4994fa[_0x55f5('0x1d')];var _0x3af5ab=_0xfaba00?0x0:_0x3f4a71[_0x55f5('0x1e')];var _0x9150fd=_0xfaba00?_0x4994fa[_0x55f5('0x1d')]:_0x3f4a71[_0x55f5('0x1e')]+_0x3f4a71[_0x55f5('0x1f')];var _0x4f9b83;if(_0x9150fd>=_0xc13011){_0x9150fd=_0xc13011;_0x4f9b83=0xc8;}else{_0x4f9b83=0xce;}_0x3acce6[_0x55f5('0x19')](_0x4f9b83);return _0x3acce6[_0x55f5('0x20')](_0x55f5('0x21'),_0x3af5ab+'-'+_0x9150fd+'/'+_0xc13011)[_0x55f5('0x1b')](_0x4994fa);}return null;};}function patchUpdates(_0x2b78ce){return function(_0x46e944){try{jsonpatch['apply'](_0x46e944,_0x2b78ce,!![]);}catch(_0x1e44b6){return BPromise[_0x55f5('0x22')](_0x1e44b6);}return _0x46e944[_0x55f5('0x23')]();};}function saveUpdates(_0x15ffd9,_0x2d81f3){return function(_0x498dd2){if(_0x498dd2){return _0x498dd2[_0x55f5('0x24')](_0x15ffd9)[_0x55f5('0x25')](function(_0x53087a){return _0x53087a;});}return null;};}function removeEntity(_0x4a8a8b,_0x383762){return function(_0x22e58f){if(_0x22e58f){return _0x22e58f[_0x55f5('0x26')]()[_0x55f5('0x25')](function(){_0x4a8a8b[_0x55f5('0x19')](0xcc)[_0x55f5('0x1a')]();});}};}function handleEntityNotFound(_0x49b5dc,_0x1a40c8){return function(_0x4fec82){if(!_0x4fec82){_0x49b5dc[_0x55f5('0x27')](0x194);}return _0x4fec82;};}function handleError(_0x4b23bd,_0x31951e){_0x31951e=_0x31951e||0x1f4;return function(_0x15002b){logger[_0x55f5('0x28')](_0x15002b[_0x55f5('0x29')]);if(_0x15002b['name']){delete _0x15002b[_0x55f5('0x2a')];}_0x4b23bd[_0x55f5('0x19')](_0x31951e)[_0x55f5('0x2b')](_0x15002b);};}exports[_0x55f5('0x2c')]=function(_0x2b9d3c,_0x104a73){var _0x530df4={},_0x4b151e={},_0x3489fd={'count':0x0,'rows':[]};var _0x2e0c9e=_[_0x55f5('0x2d')](db['UserProfile'][_0x55f5('0x2e')],function(_0xa708ba){return{'name':_0xa708ba['fieldName'],'type':_0xa708ba['type'][_0x55f5('0x2f')]};});_0x4b151e['model']=_['map'](_0x2e0c9e,'name');_0x4b151e[_0x55f5('0x30')]=_[_0x55f5('0x31')](_0x2b9d3c['query']);_0x4b151e[_0x55f5('0x32')]=_['intersection'](_0x4b151e[_0x55f5('0x33')],_0x4b151e[_0x55f5('0x30')]);_0x530df4[_0x55f5('0x34')]=_[_0x55f5('0x35')](_0x4b151e[_0x55f5('0x33')],qs['fields'](_0x2b9d3c['query']['fields']));_0x530df4[_0x55f5('0x34')]=_0x530df4[_0x55f5('0x34')][_0x55f5('0x36')]?_0x530df4[_0x55f5('0x34')]:_0x4b151e[_0x55f5('0x33')];if(!_0x2b9d3c[_0x55f5('0x30')][_0x55f5('0x37')](_0x55f5('0x38'))){_0x530df4[_0x55f5('0x1f')]=qs[_0x55f5('0x1f')](_0x2b9d3c[_0x55f5('0x30')]['limit']);_0x530df4['offset']=qs[_0x55f5('0x1e')](_0x2b9d3c[_0x55f5('0x30')]['offset']);}_0x530df4[_0x55f5('0x39')]=qs['sort'](_0x2b9d3c[_0x55f5('0x30')][_0x55f5('0x3a')]);_0x530df4[_0x55f5('0x3b')]=qs[_0x55f5('0x32')](_[_0x55f5('0x3c')](_0x2b9d3c[_0x55f5('0x30')],_0x4b151e[_0x55f5('0x32')]),_0x2e0c9e);if(_0x2b9d3c[_0x55f5('0x30')][_0x55f5('0x3d')]){_0x530df4['where']=_[_0x55f5('0x3e')](_0x530df4[_0x55f5('0x3b')],{'$or':_[_0x55f5('0x2d')](_0x2e0c9e,function(_0x5ecea3){if(_0x5ecea3[_0x55f5('0x3f')]!==_0x55f5('0x40')){var _0xb1a7f={};_0xb1a7f[_0x5ecea3['name']]={'$like':'%'+_0x2b9d3c[_0x55f5('0x30')][_0x55f5('0x3d')]+'%'};return _0xb1a7f;}})});}_0x530df4=_[_0x55f5('0x3e')]({},_0x530df4,_0x2b9d3c[_0x55f5('0x41')]);var _0x4937a1={'where':_0x530df4['where']};return db[_0x55f5('0x42')]['count'](_0x4937a1)['then'](function(_0x350aad){_0x3489fd[_0x55f5('0x1d')]=_0x350aad;if(_0x2b9d3c[_0x55f5('0x30')][_0x55f5('0x43')]){_0x530df4[_0x55f5('0x44')]=[{'all':!![]}];}return db[_0x55f5('0x42')][_0x55f5('0x45')](_0x530df4);})[_0x55f5('0x25')](function(_0x30d7b3){_0x3489fd[_0x55f5('0x46')]=_0x30d7b3;return _0x3489fd;})[_0x55f5('0x25')](respondWithFilteredResult(_0x104a73,_0x530df4))[_0x55f5('0x47')](handleError(_0x104a73,null));};exports[_0x55f5('0x48')]=function(_0x1c7667,_0x1514c3){var _0x2aee1b={'raw':![],'where':{'id':_0x1c7667[_0x55f5('0x49')]['id']}},_0x42a443={};_0x42a443['model']=_['keys'](db[_0x55f5('0x42')][_0x55f5('0x2e')]);_0x42a443[_0x55f5('0x30')]=_[_0x55f5('0x31')](_0x1c7667[_0x55f5('0x30')]);_0x42a443[_0x55f5('0x32')]=_[_0x55f5('0x35')](_0x42a443[_0x55f5('0x33')],_0x42a443[_0x55f5('0x30')]);_0x2aee1b[_0x55f5('0x34')]=_[_0x55f5('0x35')](_0x42a443[_0x55f5('0x33')],qs[_0x55f5('0x4a')](_0x1c7667['query'][_0x55f5('0x4a')]));_0x2aee1b['attributes']=_0x2aee1b[_0x55f5('0x34')]['length']?_0x2aee1b['attributes']:_0x42a443[_0x55f5('0x33')];if(_0x1c7667['query'][_0x55f5('0x43')]){_0x2aee1b[_0x55f5('0x44')]=[{'all':!![]}];}_0x2aee1b=_[_0x55f5('0x3e')]({},_0x2aee1b,_0x1c7667[_0x55f5('0x41')]);return db['UserProfile'][_0x55f5('0x4b')](_0x2aee1b)[_0x55f5('0x25')](handleEntityNotFound(_0x1514c3,null))['then'](respondWithResult(_0x1514c3,null))['catch'](handleError(_0x1514c3,null));};exports[_0x55f5('0x4c')]=function(_0x438723,_0x2bcdf9){return db[_0x55f5('0x42')]['create'](_0x438723[_0x55f5('0x4d')],{})[_0x55f5('0x25')](respondWithResult(_0x2bcdf9,0xc9))[_0x55f5('0x47')](handleError(_0x2bcdf9,null));};exports[_0x55f5('0x4e')]=function(_0x41c085,_0x50fbdf){var _0x144f86={'where':{'id':_0x41c085[_0x55f5('0x49')]['id']}},_0x412ea2={};_0x412ea2['model']=_[_0x55f5('0x31')](db['UserProfile']['rawAttributes']);_0x144f86[_0x55f5('0x34')]=_['intersection'](_0x412ea2[_0x55f5('0x33')],qs['fields'](_0x41c085['query'][_0x55f5('0x4a')]));_0x144f86[_0x55f5('0x34')]=_0x144f86[_0x55f5('0x34')][_0x55f5('0x36')]?_0x144f86[_0x55f5('0x34')]:_0x412ea2['model'];if(_0x41c085[_0x55f5('0x30')][_0x55f5('0x43')]){_0x144f86[_0x55f5('0x44')]=[{'all':!![]}];}_0x144f86=_[_0x55f5('0x3e')]({},_0x144f86,_0x41c085['options']);return db[_0x55f5('0x42')][_0x55f5('0x4b')](_0x144f86)['then'](handleEntityNotFound(_0x50fbdf,null))[_0x55f5('0x25')](function(_0x3e1c50){if(_0x3e1c50){var _0x53e3d8=_0x3e1c50[_0x55f5('0x4f')]({'plain':!![]});_0x53e3d8=qs[_0x55f5('0x50')](_0x53e3d8,['id',_0x55f5('0x51'),_0x55f5('0x52'),'crudPermissions']);_0x41c085[_0x55f5('0x4d')]=_[_0x55f5('0x50')](_0x41c085['body'],['id','createdAt',_0x55f5('0x52')]);return db[_0x55f5('0x53')]['transaction'](function(_0x159a48){return db[_0x55f5('0x42')][_0x55f5('0x4c')](_[_0x55f5('0x3e')](_0x53e3d8,_0x41c085[_0x55f5('0x4d')]),{'include':_0x41c085['query'][_0x55f5('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x159a48})['then'](function(_0x3cd296){var _0x566b0c=_0x3cd296[_0x55f5('0x4f')]({'plain':!![]});return db[_0x55f5('0x54')][_0x55f5('0x45')]({'where':{'userProfileId':_0x41c085[_0x55f5('0x49')]['id']},'raw':!![]})[_0x55f5('0x25')](function(_0xabc50){if(_0xabc50){return BPromise[_0x55f5('0x55')](_0xabc50,function(_0x32023d){return new BPromise(function(_0x91fb31,_0x517032){if(_0x32023d[_0x55f5('0x56')]===null||_0x32023d['autoAssociation']===0x1)_0x91fb31(null);return db[_0x55f5('0x57')]['findAll']({'where':{'sectionId':_0x32023d['id']},'raw':!![]})[_0x55f5('0x25')](function(_0x592491){var _0x43cf82=_[_0x55f5('0x2d')](_0x592491,function(_0x5aa5c2){return qs[_0x55f5('0x50')](_0x5aa5c2,['id',_0x55f5('0x51'),_0x55f5('0x52'),_0x55f5('0x58')]);});_0x91fb31(_0x43cf82);})[_0x55f5('0x47')](function(_0x24c3ab){_0x517032(_0x24c3ab);});})[_0x55f5('0x25')](function(_0xefc420){var _0x553cf1=qs[_0x55f5('0x50')](_0x32023d,['id','createdAt','updatedAt']);_0x553cf1[_0x55f5('0x59')]=_0x566b0c['id'];if(_0xefc420)_0x553cf1[_0x55f5('0x5a')]=_0xefc420;return _0x553cf1;})['then'](function(_0x14829c){return db['UserProfileSection'][_0x55f5('0x4c')](_0x14829c,{'include':[{'model':db[_0x55f5('0x57')],'as':_0x55f5('0x5a')}],'raw':!![],'transaction':_0x159a48});});})[_0x55f5('0x25')](function(){return _0x566b0c;});}});});});}})[_0x55f5('0x25')](respondWithResult(_0x50fbdf,0xc9))['catch'](handleError(_0x50fbdf,null));};exports[_0x55f5('0x24')]=function(_0x378845,_0x4ec808){if(_0x378845['body']['id']){delete _0x378845[_0x55f5('0x4d')]['id'];}return db['UserProfile'][_0x55f5('0x4b')]({'where':{'id':_0x378845[_0x55f5('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ec808,null))[_0x55f5('0x25')](saveUpdates(_0x378845[_0x55f5('0x4d')],null))[_0x55f5('0x25')](respondWithResult(_0x4ec808,null))[_0x55f5('0x47')](handleError(_0x4ec808,null));};exports[_0x55f5('0x26')]=function(_0x5b5f9c,_0x39f302){return db[_0x55f5('0x42')]['find']({'where':{'id':_0x5b5f9c[_0x55f5('0x49')]['id']}})[_0x55f5('0x25')](handleEntityNotFound(_0x39f302,null))[_0x55f5('0x25')](removeEntity(_0x39f302,null))['catch'](handleError(_0x39f302,null));};exports['describe']=function(_0x3c97ea,_0x3a2db4){return db[_0x55f5('0x42')][_0x55f5('0x5b')]()['then'](respondWithResult(_0x3a2db4,null))['catch'](handleError(_0x3a2db4,null));};exports[_0x55f5('0x5c')]=function(_0x14ef28,_0x19204a){var _0x39db0a=_0x14ef28[_0x55f5('0x4d')];return db[_0x55f5('0x42')][_0x55f5('0x4b')]({'where':{'id':_0x14ef28['params']['id']}})[_0x55f5('0x25')](handleEntityNotFound(_0x19204a,null))['then'](function(_0x82e4ef){if(_0x82e4ef){return db[_0x55f5('0x53')][_0x55f5('0x5d')](function(_0x8e506e){return db[_0x55f5('0x54')]['destroy']({'where':{'userProfileId':_0x14ef28[_0x55f5('0x49')]['id'],'sectionId':_['map'](_0x39db0a,function(_0x322422){return _0x322422[_0x55f5('0x58')];})},'transaction':_0x8e506e})[_0x55f5('0x25')](function(){var _0x156416=_['map'](_0x39db0a,function(_0x47bc0f){_0x47bc0f[_0x55f5('0x59')]=_0x14ef28[_0x55f5('0x49')]['id'];return _0x47bc0f;});var _0x3215bd=[];return BPromise[_0x55f5('0x55')](_0x156416,function(_0x3b6da2){return db['UserProfileSection'][_0x55f5('0x4c')](_0x3b6da2,{'include':[{'model':db[_0x55f5('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x8e506e})['then'](function(_0x45f374){_0x3215bd[_0x55f5('0x5e')](_0x45f374[_0x55f5('0x4f')]({'plain':!![]}));});})[_0x55f5('0x25')](function(){return _0x3215bd;});});});}})['then'](function(_0x214294){return _0x214294;})['then'](respondWithResult(_0x19204a,null))[_0x55f5('0x47')](handleError(_0x19204a,null));};exports[_0x55f5('0x5f')]=function(_0x447128,_0x2fe9d3){var _0x314630;return db[_0x55f5('0x42')][_0x55f5('0x4b')]({'where':{'id':_0x447128['params']['id']},'attributes':['id',_0x55f5('0x2a')]})[_0x55f5('0x25')](handleEntityNotFound(_0x2fe9d3,null))['then'](function(_0x546bb2){if(_0x546bb2){_0x314630=_0x546bb2;return db[_0x55f5('0x54')]['destroy']({'where':{'userProfileId':_0x447128[_0x55f5('0x49')]['id'],'sectionId':_0x447128[_0x55f5('0x30')][_0x55f5('0x60')]}});}})[_0x55f5('0x25')](function(){return _0x314630;})[_0x55f5('0x25')](respondWithStatusCode(_0x2fe9d3,null))[_0x55f5('0x47')](handleError(_0x2fe9d3,null));};exports['getSections']=function(_0x4a34e1,_0x364f1a){var _0x15dbb3=[];var _0x574d20=[];return db[_0x55f5('0x54')][_0x55f5('0x45')]({'where':{'userProfileId':_0x4a34e1[_0x55f5('0x49')]['id']},'raw':!![]})['then'](function(_0x489ee3){_0x15dbb3=_[_0x55f5('0x3d')](_0x489ee3,function(_0x2f448e){return _0x2f448e[_0x55f5('0x61')]===0x1||_[_0x55f5('0x62')]([0x3eb,0x709],_0x2f448e[_0x55f5('0x58')]);});if(!_[_0x55f5('0x63')](_0x15dbb3)){return _['map'](_0x15dbb3,function(_0x5f1df2){return _0x5f1df2['sectionId'];});}else{return;}})[_0x55f5('0x25')](function(_0x34c549){if(_0x34c549)_0x574d20=_0x34c549;if(_[_0x55f5('0x62')](_0x574d20,0x64)){var _0x319f79=_[_0x55f5('0x4b')](_0x15dbb3,{'sectionId':0x64});return hasDefaultDashboard(_0x319f79)[_0x55f5('0x25')](function(_0x3b81f4){return _[_0x55f5('0x2d')](_0x15dbb3,function(_0x2ebaf4){if(_0x2ebaf4[_0x55f5('0x58')]===0x64){_0x2ebaf4[_0x55f5('0x64')]=_0x3b81f4;}return _0x2ebaf4;});});}else{return;}})[_0x55f5('0x25')](function(_0x1e8123){if(_0x1e8123)_0x15dbb3=_0x1e8123;if(_[_0x55f5('0x62')](_0x574d20,0x3eb)){var _0x1bc8dd=_['find'](_0x15dbb3,{'sectionId':0x3eb});return getCustomDashboards(_0x1bc8dd)['then'](function(_0x43db13){return _['map'](_0x15dbb3,function(_0x3dfcd2){if(_0x1bc8dd[_0x55f5('0x61')]){if(_0x3dfcd2['sectionId']===0x3eb){_0x3dfcd2['subsections']=_0x43db13;}}else{if(_0x3dfcd2[_0x55f5('0x58')]===0x64){if(!_0x3dfcd2[_0x55f5('0x64')]){_0x3dfcd2['subsections']=[];}_0x3dfcd2[_0x55f5('0x64')]=_0x3dfcd2[_0x55f5('0x64')][_0x55f5('0x65')](_0x43db13);}}return _0x3dfcd2;});});}else{return;}})['then'](function(_0x48187b){if(_0x48187b)_0x15dbb3=_0x48187b;if(_[_0x55f5('0x62')](_0x574d20,0x709)){var _0x1430ea=_[_0x55f5('0x4b')](_0x15dbb3,{'sectionId':0x709});return getPlugins(_0x1430ea)[_0x55f5('0x25')](function(_0x290fea){if(_0x1430ea[_0x55f5('0x61')]){return _[_0x55f5('0x2d')](_0x15dbb3,function(_0x3380e){if(_0x3380e[_0x55f5('0x58')]===0x709){_0x3380e[_0x55f5('0x64')]=_0x290fea;}return _0x3380e;});}else{var _0x52e404={'sectionId':0x76c,'enabled':0x1,'subsections':_0x290fea};var _0x41bf52=_[_0x55f5('0x2d')](_0x15dbb3);_0x41bf52['push'](_0x52e404);return _0x41bf52;}});}else{return;}})['then'](function(_0x425434){if(_0x425434)_0x15dbb3=_0x425434;return _['filter'](_0x15dbb3,[_0x55f5('0x61'),0x1]);})[_0x55f5('0x25')](respondWithResult(_0x364f1a,null))[_0x55f5('0x47')](handleError(_0x364f1a,null));};function hasDefaultDashboard(_0x46cdd4){var _0x59dd73=[0x65];return new BPromise(function(_0x59b8bb,_0x4ba0ce){try{if(_0x46cdd4[_0x55f5('0x56')]){_0x59b8bb(_0x59dd73);}else{return db[_0x55f5('0x57')][_0x55f5('0x66')]({'where':{'sectionId':_0x46cdd4['id']},'raw':!![]})[_0x55f5('0x25')](function(_0x376f88){_0x376f88?_0x59b8bb(_0x59dd73):_0x59b8bb();});}}catch(_0x5022ec){_0x4ba0ce(_0x5022ec);}});}function getCustomDashboards(_0x3eef30){var _0x1dbf11=[];return new BPromise(function(_0x446f15,_0x5a3401){try{if(_0x3eef30['autoAssociation']){return db[_0x55f5('0x67')][_0x55f5('0x45')]({'raw':!![]})[_0x55f5('0x25')](function(_0x26c0ed){_0x26c0ed[_0x55f5('0x68')](function(_0x149ad3){_0x1dbf11['push'](_0x149ad3['id']+0x1869f);});_0x446f15(_0x1dbf11);});}else{return db[_0x55f5('0x57')]['findAll']({'where':{'sectionId':_0x3eef30['id']},'raw':!![]})[_0x55f5('0x25')](function(_0x24cf7b){_0x24cf7b['forEach'](function(_0x435da2){_0x1dbf11['push'](_0x435da2['resourceId']+0x1869f);});_0x446f15(_0x1dbf11);});}}catch(_0x2c8e30){_0x5a3401(_0x2c8e30);}});}function getPlugins(_0x2ab785){var _0x18663e=[];return new BPromise(function(_0x3bff5b,_0x24d10b){try{if(_0x2ab785[_0x55f5('0x56')]){return db[_0x55f5('0x69')][_0x55f5('0x45')]({'raw':!![]})[_0x55f5('0x25')](function(_0x4ee516){_0x4ee516[_0x55f5('0x68')](function(_0x12eff3){_0x18663e[_0x55f5('0x5e')](_0x12eff3['id']+0x15b38);});_0x3bff5b(_0x18663e);});}else{return db[_0x55f5('0x57')]['findAll']({'where':{'sectionId':_0x2ab785['id']},'raw':!![]})['then'](function(_0x3a5af7){_0x3a5af7['forEach'](function(_0x4a7281){_0x18663e['push'](_0x4a7281['resourceId']+0x15b38);});_0x3bff5b(_0x18663e);});}}catch(_0x112269){_0x24d10b(_0x112269);}});}exports[_0x55f5('0x6a')]=function(_0x221d01,_0x5f348a){return db[_0x55f5('0x42')]['find']({'where':{'id':_0x221d01['params']['id']}})[_0x55f5('0x25')](handleEntityNotFound(_0x5f348a,null))[_0x55f5('0x25')](function(_0x31882a){if(_0x31882a){return db[_0x55f5('0x53')][_0x55f5('0x5d')](function(_0x510f0a){return db[_0x55f5('0x54')][_0x55f5('0x45')]({'where':{'userProfileId':_0x221d01[_0x55f5('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x55f5('0x25')](function(_0x354e6b){if(_0x354e6b){return db[_0x55f5('0x54')]['destroy']({'where':{'userProfileId':_0x221d01[_0x55f5('0x49')]['id'],'id':_[_0x55f5('0x2d')](_0x354e6b,function(_0xe9b5e5){return _0xe9b5e5['id'];})},'transaction':_0x510f0a});}})[_0x55f5('0x25')](function(_0x329e22){var _0x5047c1=_[_0x55f5('0x2d')](_0x221d01['body'],function(_0x235ddc){_0x235ddc[_0x55f5('0x59')]=_0x221d01[_0x55f5('0x49')]['id'];return _0x235ddc;});return db[_0x55f5('0x54')]['bulkCreate'](_0x5047c1,{'raw':!![],'transaction':_0x510f0a});})['then'](function(_0xad16fc){var _0x5b30a4=_['filter'](_[_0x55f5('0x2d')](_0xad16fc,function(_0x42b315){return _0x42b315[_0x55f5('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x5b30a4){return db[_0x55f5('0x54')][_0x55f5('0x45')]({'where':{'userProfileId':_0x221d01['params']['id'],'sectionId':_[_0x55f5('0x2d')](_0x5b30a4,function(_0x326015){return _0x326015[_0x55f5('0x58')];})},'attributes':['id',_0x55f5('0x58')],'raw':!![]})[_0x55f5('0x25')](function(_0x2b41d9){var _0x23b284=_[_0x55f5('0x2d')](_0x221d01['body'],function(_0x30af83){_0x30af83[_0x55f5('0x59')]=_0x221d01['params']['id'];return _0x30af83;});return db[_0x55f5('0x57')][_0x55f5('0x6b')](_0x23b284,{'raw':!![],'transaction':_0x510f0a});});}})['catch'](handleError(_0x5f348a,null));});}})[_0x55f5('0x25')](function(_0x3559ac){var _0x295dea=_[_0x55f5('0x2d')](_0x3559ac,function(_0x5b5b4a){return _0x5b5b4a[_0x55f5('0x4f')]({'plain':!![]});});})[_0x55f5('0x25')](respondWithResult(_0x5f348a,null))['catch'](handleError(_0x5f348a,null));};exports['removeResources']=function(_0x159e42,_0x52b03d,_0x4ed46b){return db['UserProfile']['find']({'where':{'id':_0x159e42[_0x55f5('0x49')]['id']}})[_0x55f5('0x25')](handleEntityNotFound(_0x52b03d,null))[_0x55f5('0x25')](function(_0x240316){if(_0x240316){return _0x240316[_0x55f5('0x6c')](_0x159e42[_0x55f5('0x30')][_0x55f5('0x60')]);}})[_0x55f5('0x25')](respondWithStatusCode(_0x52b03d,null))[_0x55f5('0x47')](handleError(_0x52b03d,null));};exports[_0x55f5('0x6d')]=function(_0x5665a3,_0x3c3142){var _0x5ca6d1={};if(!_0x5665a3[_0x55f5('0x30')]['section'])throw new Error(_0x55f5('0x6e'));if(!_0x5665a3[_0x55f5('0x30')]['hasOwnProperty'](_0x55f5('0x38'))){_0x5ca6d1['limit']=qs[_0x55f5('0x1f')](_0x5665a3['query'][_0x55f5('0x1f')]);_0x5ca6d1[_0x55f5('0x1e')]=qs['offset'](_0x5665a3[_0x55f5('0x30')]['offset']);}return db['UserProfile'][_0x55f5('0x4b')]({'where':{'id':_0x5665a3[_0x55f5('0x49')]['id']}})[_0x55f5('0x25')](function(_0xebd44){if(!_0xebd44)throw new Error(_0x55f5('0x6f')+_0x5665a3[_0x55f5('0x49')]['id']);return db[_0x55f5('0x42')]['getResources'](_0x5665a3);})[_0x55f5('0x25')](respondWithFilteredResult(_0x3c3142,_0x5ca6d1))[_0x55f5('0x47')](handleError(_0x3c3142,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index deefa97..75dcf9b 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 _0xc359=['save','update','emit','../../mysqldb','setMaxListeners'];(function(_0x7f4255,_0xac7471){var _0x437103=function(_0x308f9f){while(--_0x308f9f){_0x7f4255['push'](_0x7f4255['shift']());}};_0x437103(++_0xac7471);}(_0xc359,0x1d9));var _0x9c35=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0xc359[_0x2c8b7a];return _0x1c1cf9;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x9c35('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9c35('0x1')](0x0);var events={'afterCreate':_0x9c35('0x2'),'afterUpdate':_0x9c35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cfffd){return function(_0x53a490,_0x1540b4,_0x5d4ee8){UserProfileEvents[_0x9c35('0x4')](_0x3cfffd+':'+_0x53a490['id'],_0x53a490);UserProfileEvents['emit'](_0x3cfffd,_0x53a490);_0x5d4ee8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x39e6=['update','remove','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x4976d7,_0x1e5b51){var _0x3f9937=function(_0x44abaf){while(--_0x44abaf){_0x4976d7['push'](_0x4976d7['shift']());}};_0x3f9937(++_0x1e5b51);}(_0x39e6,0x9e));var _0x639e=function(_0xf50cd,_0x2dd188){_0xf50cd=_0xf50cd-0x0;var _0x113a21=_0x39e6[_0xf50cd];return _0x113a21;};'use strict';var EventEmitter=require(_0x639e('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x639e('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x639e('0x2'),'afterDestroy':_0x639e('0x3')};function emitEvent(_0x529394){return function(_0x467229,_0x207d6a,_0x199e72){UserProfileEvents[_0x639e('0x4')](_0x529394+':'+_0x467229['id'],_0x467229);UserProfileEvents[_0x639e('0x4')](_0x529394,_0x467229);_0x199e72(null);};}for(var e in events){if(events[_0x639e('0x5')](e)){var event=events[e];UserProfile[_0x639e('0x6')](e,emitEvent(event));}}module[_0x639e('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2f420ea..364da2c 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 _0xf40d=['sort','filters','merge','key','VIRTUAL','foreignKey','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','Tags','color','tag','ThroughTags','true','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','SquareOdbc','SquareRecording','SquareProjects','name','projectName','JscriptyProject','contacts','CmContact','parentSections','Lists','lists','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','Telephones','User','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','Plugin','Reports','reportId','metrics','charAt','toUpperCase','slice','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','all','ignore','isEmpty','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order'];(function(_0x59808b,_0x448eac){var _0x32e13a=function(_0x20c6b0){while(--_0x20c6b0){_0x59808b['push'](_0x59808b['shift']());}};_0x32e13a(++_0x448eac);}(_0xf40d,0xda));var _0xdf40=function(_0x581f33,_0x3bd481){_0x581f33=_0x581f33-0x0;var _0x5c26a0=_0xf40d[_0x581f33];return _0x5c26a0;};'use strict';var _=require(_0xdf40('0x0'));var attributes=require(_0xdf40('0x1'));var qs=require(_0xdf40('0x2'));var squel=require(_0xdf40('0x3'));module[_0xdf40('0x4')]=function(_0x7a9753){var _0x1ace6c=_0x7a9753['models'];function _0x5580c4(_0x972cab,_0x3f30cd){return new Promise(function(_0x35c469,_0x379606){if(!_0x3f30cd)return _0x35c469(null);var _0x4d92f1=_0x3f30cd[_0xdf40('0x5')]?{[_0x3f30cd[_0xdf40('0x5')][_0xdf40('0x6')]]:_0x3f30cd[_0xdf40('0x5')][_0xdf40('0x7')]}:undefined;return _0x1ace6c[_0x972cab][_0xdf40('0x8')]({'where':_0x4d92f1,'raw':!![]})[_0xdf40('0x9')](function(_0xb35f14){_0x3f30cd[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0xb35f14,'id');_0x35c469(_0x3f30cd);})[_0xdf40('0xc')](function(_0x583c09){_0x379606(_0x583c09);});});}function _0x7437d2(_0x8c22bc,_0x21f905){return new Promise(function(_0xcb133c,_0x3f7b17){var _0x219ba7=_0x8c22bc[_0xdf40('0x5')]?{[_0x8c22bc['filter'][_0xdf40('0x6')]]:_0x8c22bc['filter'][_0xdf40('0x7')]}:undefined;return _0x1ace6c[_0x8c22bc[_0xdf40('0xd')]][_0xdf40('0x8')]({'where':_0x219ba7,'raw':!![]})[_0xdf40('0x9')](function(_0x4be9fc){_0x21f905[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x4be9fc,function(_0x9e5f9f){return _0x9e5f9f['name'];});_0xcb133c(_0x21f905);})[_0xdf40('0xc')](function(_0x22d7a6){_0x3f7b17(_0x22d7a6);});});}function _0x5678a6(_0x1b3582,_0x105e51,_0x1408d0){if(!_0x105e51)return Promise['resolve'](null);return new Promise(function(_0x9b4757,_0x22b9b2){return _0x1ace6c[_0xdf40('0xe')][_0xdf40('0x8')]({'where':{'sectionId':_0x105e51['id']},'raw':!![]})[_0xdf40('0x9')](function(_0x36b975){if(_0x1b3582[_0xdf40('0x6')]&&_0x1b3582['field']!=='id'){_0x105e51['associatedResources']=_['map'](_0x36b975,function(_0x52067a){return _0x52067a[_0x1b3582[_0xdf40('0x6')]];});}else{if(_0x1408d0===_0xdf40('0xf')){_0x105e51[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x36b975,function(_0xc53db0){return{'id':_0xc53db0[_0xdf40('0x10')],'type':_0xc53db0['type']};});}else{_0x105e51[_0xdf40('0xa')]=_[_0xdf40('0xb')](_0x36b975,function(_0x42662b){return _0x42662b[_0xdf40('0x10')];});}}_0x9b4757(_0x105e51);})[_0xdf40('0xc')](function(_0x56bbce){_0x22b9b2(_0x56bbce);});});}function _0x26cb31(_0x3102e2,_0x51f592){var _0x57a3e2={'parentSections':[]};switch(_0x3102e2[_0xdf40('0x11')]()){case'squareprojects':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x13');break;case'odbc':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x14');break;case'squarerecordings':_0x57a3e2['childModel']=_0xdf40('0x15');_0x57a3e2['parentSections']=[{'name':_0xdf40('0x16'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x18')}];break;case'projects':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x19');break;case _0xdf40('0x1a'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x1b');_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0xdf40('0x1e'):_0x57a3e2['childModel']='CmList';break;case'companies':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x1f');break;case'globalcustomfields':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x20');break;case _0xdf40('0x21'):_0x57a3e2['childModel']=_0xdf40('0x22');break;case _0xdf40('0x23'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x24');break;case'faxqueues':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x25');break;case _0xdf40('0x26'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x27');break;case _0xdf40('0x28'):case _0xdf40('0x29'):case _0xdf40('0x2a'):_0x57a3e2['childModel']='VoiceExtension';break;case _0xdf40('0x2b'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x2c');break;case _0xdf40('0x2d'):_0x57a3e2[_0xdf40('0x12')]='VoiceMail';break;case'voicerecordings':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x2e');_0x57a3e2['parentSections']=[{'name':_0xdf40('0x2f'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x30'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0xdf40('0x31'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x30'),'model':_0xdf40('0x32'),'filter':{'field':_0xdf40('0x33'),'value':[_0xdf40('0x34')]}},{'name':_0xdf40('0x35'),'field':_0xdf40('0x17'),'foreignKey':_0xdf40('0x36'),'model':_0xdf40('0x37'),'filter':{'field':_0xdf40('0x38'),'value':[_0xdf40('0x39')]}},{'name':_0xdf40('0x3a'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xdf40('0x38'),'value':[_0xdf40('0x3b')]}}];break;case _0xdf40('0x3c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x3d');break;case'chanspies':_0x57a3e2['childModel']=_0xdf40('0x3e');break;case _0xdf40('0x3f'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x40');break;case _0xdf40('0x41'):_0x57a3e2[_0xdf40('0x12')]='Campaign';break;case _0xdf40('0x42'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x43');break;case _0xdf40('0x44'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x45');break;case _0xdf40('0x46'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x47');break;case _0xdf40('0x48'):_0x57a3e2[_0xdf40('0x12')]='OpenchannelQueue';break;case _0xdf40('0x49'):_0x57a3e2['childModel']=_0xdf40('0x4a');break;case _0xdf40('0x4b'):_0x57a3e2[_0xdf40('0x12')]='SmsQueue';break;case _0xdf40('0x4c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x4d');break;case _0xdf40('0x4e'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x4f');break;case _0xdf40('0x50'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x51');break;case'teams':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x52');break;case'voicequeues':case _0xdf40('0x53'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x37');if(_0x51f592){_0x57a3e2[_0xdf40('0x1c')]=[{'name':'VoiceQueues'},{'name':_0xdf40('0x3a')}];}break;case _0xdf40('0x54'):case _0xdf40('0x55'):case _0xdf40('0x56'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x32');if(_0x51f592){_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x57'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xdf40('0x31')}];}break;case _0xdf40('0x58'):_0x57a3e2['childModel']=_0xdf40('0x59');break;case _0xdf40('0x5a'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5b');break;case _0xdf40('0x5c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5d');break;case _0xdf40('0x5e'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x5f');break;case'deskaccounts':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x60');break;case'zohoaccounts':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x61');break;case _0xdf40('0x62'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x32');break;case'cannedanswers':_0x57a3e2['childModel']='CannedAnswer';break;case _0xdf40('0x63'):_0x57a3e2['childModel']=_0xdf40('0x64');break;case _0xdf40('0x65'):_0x57a3e2['childModel']='Dashboard';break;case _0xdf40('0x66'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x67');break;case'pauses':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x68');break;case _0xdf40('0x69'):_0x57a3e2['childModel']=_0xdf40('0x6a');break;case'sounds':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x6b');break;case _0xdf40('0x6c'):_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x6d');break;case _0xdf40('0x6e'):_0x57a3e2['childModel']=_0xdf40('0x6f');break;case _0xdf40('0x70'):_0x57a3e2[_0xdf40('0x12')]='Trigger';break;case _0xdf40('0x71'):_0x57a3e2['childModel']=_0xdf40('0x72');break;case _0xdf40('0x73'):_0x57a3e2['childModel']=_0xdf40('0x74');break;case'plugins':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0x75');break;case'extractedreports':_0x57a3e2[_0xdf40('0x12')]=_0xdf40('0xf');_0x57a3e2[_0xdf40('0x1c')]=[{'name':_0xdf40('0x76'),'field':'id','foreignKey':_0xdf40('0x77')}];break;case _0xdf40('0x78'):_0x57a3e2[_0xdf40('0x12')]='AnalyticMetric';break;}return _0x57a3e2;}function _0x11059f(_0xe5df97,_0x233fa0){var _0x5bd382=_0xe5df97[_0xdf40('0x79')](0x0)[_0xdf40('0x7a')]()+_0xe5df97[_0xdf40('0x7b')](0x1);var _0x1c1213={'type':_0x1ace6c['Sequelize'][_0xdf40('0x7c')][_0xdf40('0x7d')],'raw':!![]};return new Promise(function(_0x2528e7,_0x276d75){var _0x8e46f2=squel[_0xdf40('0x7e')]()[_0xdf40('0x6')]('ui.'+_0x5bd382+_0xdf40('0x7f'),'id')[_0xdf40('0x6')]('ui.createdAt')[_0xdf40('0x80')](_0xdf40('0x81')+_0xe5df97+_0xdf40('0x82'),'ui')[_0xdf40('0x83')](_0xdf40('0x84'),_0x233fa0['id']);return _0x1ace6c[_0xdf40('0x85')][_0xdf40('0x86')](_0x8e46f2[_0xdf40('0x87')](),_0x1c1213)[_0xdf40('0x9')](function(_0x3c5fbb){_0x233fa0[_0x5bd382+'OpenTabs']=_0x3c5fbb;_0x2528e7(_0x3c5fbb);})[_0xdf40('0xc')](function(_0x562875){_0x276d75(_0x562875);});});}return _0x7a9753['define'](_0xdf40('0x88'),attributes,{'tableName':_0xdf40('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x436c29){var _0x2b7531={'raw':_0x436c29[_0xdf40('0x86')][_0xdf40('0x8a')],'where':{}};var _0x4b068c={};var _0x3b012c={'count':0x0,'rows':[]};var _0x4e6da7=_0x436c29[_0xdf40('0x86')][_0xdf40('0x8b')];var _0x25fb8a=_0x436c29[_0xdf40('0x86')][_0xdf40('0x8c')]||![];var _0x301088=_0x26cb31(_0x4e6da7,_0x25fb8a);if(!_0x301088[_0xdf40('0x12')])throw new Error(_0xdf40('0x8d')+_0x4e6da7+'\x27');var _0x3f8d89=[{'name':_0x4e6da7}];if(!_['isEmpty'](_0x301088[_0xdf40('0x1c')]))_0x3f8d89=_0x301088[_0xdf40('0x1c')];var _0x2d2664=[];for(var _0x135a4f=0x0;_0x135a4f<_0x3f8d89[_0xdf40('0x8e')];_0x135a4f++){_0x2d2664[_0xdf40('0x8f')](_0x1ace6c['UserProfileSection'][_0xdf40('0x90')]({'where':{'userProfileId':_0x436c29[_0xdf40('0x91')]['id'],'name':_0x3f8d89[_0x135a4f][_0xdf40('0x17')]},'raw':!![]}));}return Promise[_0xdf40('0x92')](_0x2d2664)[_0xdf40('0x9')](function(_0x774497){var _0x102ee3=_[_0xdf40('0x5')](_0x774497,function(_0x538173){return _0x538173?_0x538173:undefined;});var _0x45ae4d=_[_0xdf40('0x5')](_0x3f8d89,[_0xdf40('0x93'),!![]]);var _0x2e306e=_[_0xdf40('0x94')](_0x102ee3)&&_[_0xdf40('0x94')](_0x45ae4d)?null:_['union'](_0x45ae4d,_0x102ee3);if(!_0x2e306e)return null;var _0x7ea394=[];for(var _0x493d52=0x0;_0x493d52<_0x2e306e['length'];_0x493d52++){var _0x529d89=_[_0xdf40('0x90')](_0x3f8d89,function(_0xbf4ef9){return _0x2e306e[_0x493d52]?_0xbf4ef9[_0xdf40('0x17')]===_0x2e306e[_0x493d52][_0xdf40('0x17')]:null;});if(_0x529d89){if(_0x2e306e[_0x493d52][_0xdf40('0x93')]){_0x7ea394[_0xdf40('0x8f')](_0x5580c4(_0x301088[_0xdf40('0x12')],_0x2e306e[_0x493d52]));}else{if(!_0x2e306e[_0x493d52][_0xdf40('0x95')]){_0x7ea394['push'](_0x5678a6(_0x529d89,_0x2e306e[_0x493d52],_0x301088[_0xdf40('0x12')]));}else{if(_0x529d89[_0xdf40('0xd')]){_0x7ea394[_0xdf40('0x8f')](_0x7437d2(_0x529d89,_0x2e306e[_0x493d52]));}}}}}return Promise[_0xdf40('0x92')](_0x7ea394);})['then'](function(_0x527be5){var _0x370b22=_0x527be5;var _0x50575b=null;if(_0x370b22){_0x50575b=_0x370b22[_0xdf40('0x8e')]===0x1?_0x370b22[0x0]:null;}if(!_0x50575b&&!_0x370b22)return _0x3b012c;var _0x443a06=_0x1ace6c[_0x301088['childModel']][_0xdf40('0x96')];_0x4b068c[_0xdf40('0xd')]=_[_0xdf40('0x97')](_0x443a06);_0x4b068c['query']=_[_0xdf40('0x97')](_0x436c29['query']);_0x4b068c['filters']=_[_0xdf40('0x98')](_0x4b068c[_0xdf40('0xd')],_0x4b068c['query']);_0x2b7531[_0xdf40('0x99')]=_[_0xdf40('0x98')](_0x4b068c[_0xdf40('0xd')],qs['fields'](_0x436c29[_0xdf40('0x86')][_0xdf40('0x9a')]));_0x2b7531[_0xdf40('0x99')]=_0x2b7531[_0xdf40('0x99')]['length']?_0x2b7531['attributes']:_0x4b068c[_0xdf40('0xd')];if(!_0x436c29['query'][_0xdf40('0x9b')](_0xdf40('0x9c'))){_0x2b7531[_0xdf40('0x9d')]=qs[_0xdf40('0x9d')](_0x436c29[_0xdf40('0x86')]['limit']);_0x2b7531[_0xdf40('0x9e')]=qs['offset'](_0x436c29[_0xdf40('0x86')][_0xdf40('0x9e')]);}_0x2b7531[_0xdf40('0x9f')]=qs[_0xdf40('0xa0')](_0x436c29[_0xdf40('0x86')][_0xdf40('0xa0')]);_0x2b7531[_0xdf40('0x83')]=qs[_0xdf40('0xa1')](_['pick'](_0x436c29['query'],_0x4b068c['filters']));if(_0x436c29['query'][_0xdf40('0x5')]){_0x2b7531[_0xdf40('0x83')]=_[_0xdf40('0xa2')](_0x2b7531['where'],{'$or':_[_0xdf40('0xb')](_0x443a06,function(_0x22af50){if(_0x22af50['type'][_0xdf40('0xa3')]!==_0xdf40('0xa4')){var _0x33d514={};_0x33d514[_0x22af50[_0xdf40('0x6')]]={'$like':'%'+_0x436c29[_0xdf40('0x86')][_0xdf40('0x5')]+'%'};return _0x33d514;}})});}var _0x34db95=[];var _0x476434=null;var _0x2f821d={};if(_0x50575b){_0x476434=_[_0xdf40('0x90')](_0x3f8d89,[_0xdf40('0x17'),_0x50575b[_0xdf40('0x17')]]);if(_0x476434[_0xdf40('0x6')]){_0x2f821d={};if(_0x301088[_0xdf40('0x12')]===_0xdf40('0xf')){_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_[_0xdf40('0xb')](_0x50575b[_0xdf40('0xa')],'id');}else{_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_0x50575b[_0xdf40('0xa')];}_0x34db95[_0xdf40('0x8f')](_0x2f821d);}else{_0x2b7531[_0xdf40('0x83')]['id']=_0x50575b[_0xdf40('0xa')];}}else{for(var _0x1ab27f=0x0;_0x1ab27f<_0x370b22['length'];_0x1ab27f++){_0x476434=_[_0xdf40('0x90')](_0x3f8d89,[_0xdf40('0x17'),_0x370b22[_0x1ab27f][_0xdf40('0x17')]]);if(_0x476434['field']){_0x2f821d={};_0x2f821d[_0x476434[_0xdf40('0xa5')]]=_0x370b22[_0x1ab27f][_0xdf40('0xa')];_0x34db95[_0xdf40('0x8f')](_0x2f821d);}else{if(!_0x2b7531[_0xdf40('0x83')]['id'])_0x2b7531[_0xdf40('0x83')]['id']=[];_0x370b22[_0x1ab27f]['associatedResources']['forEach'](function(_0x5a1e35){_0x2b7531['where']['id'][_0xdf40('0x8f')](_0x5a1e35);});}}}if(!_[_0xdf40('0x94')](_0x34db95)){_0x2b7531[_0xdf40('0x83')]=_[_0xdf40('0xa2')](_0x2b7531[_0xdf40('0x83')],{'$and':{'$or':_0x34db95}});}_0x2b7531=_[_0xdf40('0xa2')]({},_0x2b7531,_0x436c29[_0xdf40('0xa6')]);if(_0x50575b&&!_0x50575b[_0xdf40('0x95')]&&_0x301088['childModel']===_0xdf40('0xf')){if(_0x436c29[_0xdf40('0x86')][_0xdf40('0xa7')]){_0x2b7531['include']=[{'all':!![]}];}return _0x1ace6c[_0x301088[_0xdf40('0x12')]]['findAll'](_0x2b7531)['then'](function(_0x123d1c){var _0x169457=[];_0x123d1c['forEach'](function(_0x20bf00){var _0x21a4a4;switch(_0x20bf00[_0xdf40('0xa8')]){case _0xdf40('0xa9'):_0x21a4a4=_[_0xdf40('0x90')](_0x50575b[_0xdf40('0xa')],function(_0x289375){return _0x289375['id']===_0x20bf00[_0xdf40('0x77')]&&_0x289375[_0xdf40('0x38')]===_0xdf40('0xaa');});break;case _0xdf40('0xab'):_0x21a4a4=_[_0xdf40('0x90')](_0x50575b['associatedResources'],function(_0x2d48a8){return _0x2d48a8['id']===_0x20bf00[_0xdf40('0x77')]&&_0x2d48a8[_0xdf40('0x38')]===_0xdf40('0xac');});break;}if(_0x21a4a4)_0x169457['push'](_0x20bf00);});_0x3b012c['count']=_0x169457[_0xdf40('0x8e')];_0x3b012c[_0xdf40('0xad')]=_0x169457;return _0x3b012c;});}else{if(!_[_0xdf40('0x94')](_0x436c29[_0xdf40('0x86')][_0xdf40('0xae')])){_0x2b7531[_0xdf40('0x83')]['id']=_0x2b7531['where']['id']?_[_0xdf40('0x98')](_0x2b7531[_0xdf40('0x83')]['id'],_0x436c29['query'][_0xdf40('0xae')]):_0x436c29['query'][_0xdf40('0xae')];if(_0x436c29['query'][_0xdf40('0xaf')]){_0x2b7531[_0xdf40('0x9f')]=_0x436c29[_0xdf40('0x86')]['customSorting'];}}if(_0x436c29['query'][_0xdf40('0xb0')]){_0x2b7531[_0xdf40('0x83')]=_['merge'](_0x2b7531[_0xdf40('0x83')],{'$and':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb0')]});}return _0x1ace6c[_0x301088[_0xdf40('0x12')]][_0xdf40('0xb1')]({'where':_0x2b7531[_0xdf40('0x83')]})[_0xdf40('0x9')](function(_0x5d4c78){_0x3b012c[_0xdf40('0xb1')]=_0x5d4c78;if(_0x436c29[_0xdf40('0x86')][_0xdf40('0xa7')]){if(_0x301088[_0xdf40('0x12')]===_0xdf40('0x1b')){_0x2b7531[_0xdf40('0xb2')]=[{'model':_0x1ace6c[_0xdf40('0x6d')],'as':_0xdf40('0xb3'),'attributes':['id','name',_0xdf40('0xb4')],'required':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]?!![]:![]},{'model':_0x1ace6c['Tag'],'as':_0xdf40('0xb6'),'attributes':['id',_0xdf40('0x17'),'color'],'through':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]?{'attributes':[],'where':{'TagId':_0x436c29[_0xdf40('0x86')][_0xdf40('0xb5')]||undefined}}:{},'required':_0x436c29[_0xdf40('0x86')]['tag']?!![]:![]}];}else{_0x2b7531[_0xdf40('0xb2')]=[{'all':!![]}];}}return _0x1ace6c[_0x301088[_0xdf40('0x12')]][_0xdf40('0x8')](_0x2b7531);})[_0xdf40('0x9')](function(_0x556f41){_0x3b012c[_0xdf40('0xad')]=_0x556f41;if(_0x4e6da7===_0xdf40('0x2f')&&_0x436c29[_0xdf40('0x86')]['openTabs']===_0xdf40('0xb7')){var _0x231a27=[];for(var _0x18c67f=0x0;_0x18c67f<_0x3b012c['rows'][_0xdf40('0x8e')];_0x18c67f++){_0x231a27[_0xdf40('0x8f')](_0x11059f('chat',_0x3b012c[_0xdf40('0xad')][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xb9'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27['push'](_0x11059f(_0xdf40('0xba'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xbb'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f('openchannel',_0x3b012c[_0xdf40('0xad')][_0x18c67f][_0xdf40('0xb8')]));_0x231a27[_0xdf40('0x8f')](_0x11059f(_0xdf40('0xbc'),_0x3b012c['rows'][_0x18c67f][_0xdf40('0xb8')]));}return Promise[_0xdf40('0x92')](_0x231a27)[_0xdf40('0x9')](function(){return _0x3b012c;});}return _0x3b012c;});}});}}});}; \ No newline at end of file +var _0xe57b=['models','field','filter','findAll','then','map','catch','value','model','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','name','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize','query','OpenTabs','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','pick','merge','VIRTUAL','find','foreignKey','options','include','forEach','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','includeAll','Tag','Tags','tag','color','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports'];(function(_0x23cec7,_0x481f5e){var _0x34df07=function(_0x347ffd){while(--_0x347ffd){_0x23cec7['push'](_0x23cec7['shift']());}};_0x34df07(++_0x481f5e);}(_0xe57b,0xc5));var _0xbe57=function(_0x3e86e2,_0x2ce366){_0x3e86e2=_0x3e86e2-0x0;var _0x5eb2e3=_0xe57b[_0x3e86e2];return _0x5eb2e3;};'use strict';var _=require(_0xbe57('0x0'));var attributes=require(_0xbe57('0x1'));var qs=require(_0xbe57('0x2'));var squel=require(_0xbe57('0x3'));module[_0xbe57('0x4')]=function(_0x5000ad){var _0x18bf6c=_0x5000ad[_0xbe57('0x5')];function _0x254934(_0x474be8,_0x5bad89){return new Promise(function(_0x41e15a,_0x1e896a){if(!_0x5bad89)return _0x41e15a(null);var _0x4b7d50=_0x5bad89['filter']?{[_0x5bad89['filter'][_0xbe57('0x6')]]:_0x5bad89[_0xbe57('0x7')]['value']}:undefined;return _0x18bf6c[_0x474be8][_0xbe57('0x8')]({'where':_0x4b7d50,'raw':!![]})[_0xbe57('0x9')](function(_0x257ac4){_0x5bad89['associatedResources']=_[_0xbe57('0xa')](_0x257ac4,'id');_0x41e15a(_0x5bad89);})[_0xbe57('0xb')](function(_0x3b63e5){_0x1e896a(_0x3b63e5);});});}function _0xfc04dd(_0x479fac,_0x32fff8){return new Promise(function(_0x4232b6,_0x5f3eb9){var _0x5aefa2=_0x479fac[_0xbe57('0x7')]?{[_0x479fac[_0xbe57('0x7')][_0xbe57('0x6')]]:_0x479fac[_0xbe57('0x7')][_0xbe57('0xc')]}:undefined;return _0x18bf6c[_0x479fac[_0xbe57('0xd')]]['findAll']({'where':_0x5aefa2,'raw':!![]})[_0xbe57('0x9')](function(_0x2c65a9){_0x32fff8[_0xbe57('0xe')]=_['map'](_0x2c65a9,function(_0x307bcf){return _0x307bcf['name'];});_0x4232b6(_0x32fff8);})[_0xbe57('0xb')](function(_0x10a123){_0x5f3eb9(_0x10a123);});});}function _0x897d87(_0x5a5dab,_0x1b5b74,_0xfd4ae0){if(!_0x1b5b74)return Promise[_0xbe57('0xf')](null);return new Promise(function(_0x3b3612,_0x3117d7){return _0x18bf6c[_0xbe57('0x10')]['findAll']({'where':{'sectionId':_0x1b5b74['id']},'raw':!![]})[_0xbe57('0x9')](function(_0x4a850e){if(_0x5a5dab[_0xbe57('0x6')]&&_0x5a5dab[_0xbe57('0x6')]!=='id'){_0x1b5b74[_0xbe57('0xe')]=_[_0xbe57('0xa')](_0x4a850e,function(_0x5061ae){return _0x5061ae[_0x5a5dab[_0xbe57('0x6')]];});}else{if(_0xfd4ae0===_0xbe57('0x11')){_0x1b5b74[_0xbe57('0xe')]=_['map'](_0x4a850e,function(_0x40722){return{'id':_0x40722[_0xbe57('0x12')],'type':_0x40722[_0xbe57('0x13')]};});}else{_0x1b5b74[_0xbe57('0xe')]=_[_0xbe57('0xa')](_0x4a850e,function(_0x9d18d1){return _0x9d18d1[_0xbe57('0x12')];});}}_0x3b3612(_0x1b5b74);})[_0xbe57('0xb')](function(_0x3287a5){_0x3117d7(_0x3287a5);});});}function _0x31f863(_0x1d2927,_0x11fbcb){var _0x1fa82b={'parentSections':[]};switch(_0x1d2927[_0xbe57('0x14')]()){case _0xbe57('0x15'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x17');break;case _0xbe57('0x18'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x19');break;case _0xbe57('0x1a'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x1b');_0x1fa82b[_0xbe57('0x1c')]=[{'name':_0xbe57('0x1d'),'field':'name','foreignKey':_0xbe57('0x1e')}];break;case _0xbe57('0x1f'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x20');break;case _0xbe57('0x21'):_0x1fa82b[_0xbe57('0x16')]='CmContact';_0x1fa82b['parentSections']=[{'name':_0xbe57('0x22'),'field':'id','foreignKey':_0xbe57('0x23')}];break;case'lists':_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x24');break;case _0xbe57('0x25'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x26');break;case'globalcustomfields':_0x1fa82b['childModel']=_0xbe57('0x27');break;case _0xbe57('0x28'):_0x1fa82b[_0xbe57('0x16')]='ChatQueue';break;case _0xbe57('0x29'):_0x1fa82b['childModel']='ChatWebsite';break;case _0xbe57('0x2a'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x2b');break;case _0xbe57('0x2c'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x2d');break;case _0xbe57('0x2e'):case'internalroutes':case _0xbe57('0x2f'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x30');break;case _0xbe57('0x31'):_0x1fa82b['childModel']=_0xbe57('0x32');break;case _0xbe57('0x33'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x34');break;case _0xbe57('0x35'):_0x1fa82b['childModel']=_0xbe57('0x36');_0x1fa82b['parentSections']=[{'name':'Agents','field':_0xbe57('0x37'),'foreignKey':_0xbe57('0x38'),'model':_0xbe57('0x39'),'filter':{'field':_0xbe57('0x3a'),'value':[_0xbe57('0x3b')]}},{'name':_0xbe57('0x3c'),'field':_0xbe57('0x37'),'foreignKey':'membername','model':_0xbe57('0x39'),'filter':{'field':_0xbe57('0x3a'),'value':[_0xbe57('0x3d')]}},{'name':_0xbe57('0x3e'),'field':_0xbe57('0x37'),'foreignKey':_0xbe57('0x3f'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xbe57('0x40')]}},{'name':_0xbe57('0x41'),'field':_0xbe57('0x37'),'foreignKey':_0xbe57('0x3f'),'model':_0xbe57('0x42'),'filter':{'field':_0xbe57('0x13'),'value':[_0xbe57('0x43')]}}];break;case _0xbe57('0x44'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x45');break;case _0xbe57('0x46'):_0x1fa82b['childModel']=_0xbe57('0x47');break;case _0xbe57('0x48'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x49');break;case _0xbe57('0x4a'):_0x1fa82b['childModel']=_0xbe57('0x4b');break;case _0xbe57('0x4c'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x4d');break;case _0xbe57('0x4e'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x4f');break;case _0xbe57('0x50'):_0x1fa82b[_0xbe57('0x16')]='MailSubstatus';break;case _0xbe57('0x51'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x52');break;case _0xbe57('0x53'):_0x1fa82b[_0xbe57('0x16')]='OpenchannelAccount';break;case _0xbe57('0x54'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x55');break;case'smsaccounts':_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x56');break;case _0xbe57('0x57'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x58');break;case _0xbe57('0x59'):_0x1fa82b['childModel']=_0xbe57('0x5a');break;case _0xbe57('0x5b'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x5c');break;case'voicequeues':case _0xbe57('0x5d'):_0x1fa82b[_0xbe57('0x16')]='VoiceQueue';if(_0x11fbcb){_0x1fa82b[_0xbe57('0x1c')]=[{'name':'VoiceQueues'},{'name':_0xbe57('0x41')}];}break;case _0xbe57('0x5e'):case _0xbe57('0x5f'):case _0xbe57('0x60'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x39');if(_0x11fbcb){_0x1fa82b['parentSections']=[{'name':_0xbe57('0x61'),'filter':{'field':'role','value':[_0xbe57('0x62'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xbe57('0x3c')}];}break;case _0xbe57('0x63'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x64');break;case _0xbe57('0x65'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x66');break;case _0xbe57('0x67'):_0x1fa82b[_0xbe57('0x16')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x68');break;case _0xbe57('0x69'):_0x1fa82b['childModel']=_0xbe57('0x6a');break;case _0xbe57('0x6b'):_0x1fa82b[_0xbe57('0x16')]='ZohoAccount';break;case'vtigeraccounts':_0x1fa82b[_0xbe57('0x16')]='User';break;case _0xbe57('0x6c'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x6d');break;case _0xbe57('0x6e'):_0x1fa82b['childModel']=_0xbe57('0x6f');break;case _0xbe57('0x70'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x71');break;case _0xbe57('0x72'):_0x1fa82b[_0xbe57('0x16')]='Interval';break;case'pauses':_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x73');break;case _0xbe57('0x74'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x75');break;case _0xbe57('0x76'):_0x1fa82b['childModel']=_0xbe57('0x77');break;case _0xbe57('0x78'):_0x1fa82b[_0xbe57('0x16')]='Tag';break;case _0xbe57('0x79'):_0x1fa82b[_0xbe57('0x16')]='Template';break;case _0xbe57('0x7a'):_0x1fa82b['childModel']='Trigger';break;case _0xbe57('0x7b'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x7c');break;case _0xbe57('0x7d'):_0x1fa82b[_0xbe57('0x16')]='Variable';break;case _0xbe57('0x7e'):_0x1fa82b['childModel']=_0xbe57('0x7f');break;case _0xbe57('0x80'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x11');_0x1fa82b[_0xbe57('0x1c')]=[{'name':_0xbe57('0x81'),'field':'id','foreignKey':_0xbe57('0x82')}];break;case _0xbe57('0x83'):_0x1fa82b[_0xbe57('0x16')]=_0xbe57('0x84');break;}return _0x1fa82b;}function _0x234409(_0x2ddfd8,_0x3fb3d9){var _0x31fb65=_0x2ddfd8[_0xbe57('0x85')](0x0)['toUpperCase']()+_0x2ddfd8['slice'](0x1);var _0x565212={'type':_0x18bf6c[_0xbe57('0x86')][_0xbe57('0x87')][_0xbe57('0x88')],'raw':!![]};return new Promise(function(_0x26b717,_0x403460){var _0x561247=squel[_0xbe57('0x89')]()[_0xbe57('0x6')](_0xbe57('0x8a')+_0x31fb65+_0xbe57('0x8b'),'id')[_0xbe57('0x6')](_0xbe57('0x8c'))['from'](_0xbe57('0x8d')+_0x2ddfd8+_0xbe57('0x8e'),'ui')[_0xbe57('0x8f')]('ui.UserId\x20=\x20?',_0x3fb3d9['id']);return _0x18bf6c[_0xbe57('0x90')][_0xbe57('0x91')](_0x561247['toString'](),_0x565212)[_0xbe57('0x9')](function(_0x4b5fa4){_0x3fb3d9[_0x31fb65+_0xbe57('0x92')]=_0x4b5fa4;_0x26b717(_0x4b5fa4);})['catch'](function(_0x1ea5d0){_0x403460(_0x1ea5d0);});});}return _0x5000ad['define'](_0xbe57('0x93'),attributes,{'tableName':_0xbe57('0x94'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x54e8c0){var _0x3fed61={'raw':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0x95')],'where':{}};var _0x2f1dd8={};var _0x497802={'count':0x0,'rows':[]};var _0x2e9d9f=_0x54e8c0['query']['section'];var _0x2d11c3=_0x54e8c0['query'][_0xbe57('0x96')]||![];var _0x46f7a2=_0x31f863(_0x2e9d9f,_0x2d11c3);if(!_0x46f7a2[_0xbe57('0x16')])throw new Error(_0xbe57('0x97')+_0x2e9d9f+'\x27');var _0x5b40b6=[{'name':_0x2e9d9f}];if(!_[_0xbe57('0x98')](_0x46f7a2[_0xbe57('0x1c')]))_0x5b40b6=_0x46f7a2['parentSections'];var _0x1e114c=[];for(var _0xe80716=0x0;_0xe80716<_0x5b40b6[_0xbe57('0x99')];_0xe80716++){_0x1e114c[_0xbe57('0x9a')](_0x18bf6c[_0xbe57('0x9b')]['find']({'where':{'userProfileId':_0x54e8c0[_0xbe57('0x9c')]['id'],'name':_0x5b40b6[_0xe80716][_0xbe57('0x37')]},'raw':!![]}));}return Promise[_0xbe57('0x9d')](_0x1e114c)[_0xbe57('0x9')](function(_0x19db35){var _0x28c1b5=_['filter'](_0x19db35,function(_0x126278){return _0x126278?_0x126278:undefined;});var _0xe7c91f=_[_0xbe57('0x7')](_0x5b40b6,[_0xbe57('0x9e'),!![]]);var _0x169e61=_[_0xbe57('0x98')](_0x28c1b5)&&_[_0xbe57('0x98')](_0xe7c91f)?null:_[_0xbe57('0x9f')](_0xe7c91f,_0x28c1b5);if(!_0x169e61)return null;var _0x1b1f21=[];for(var _0x405c69=0x0;_0x405c69<_0x169e61['length'];_0x405c69++){var _0x3d7552=_['find'](_0x5b40b6,function(_0x2aa2c9){return _0x169e61[_0x405c69]?_0x2aa2c9[_0xbe57('0x37')]===_0x169e61[_0x405c69][_0xbe57('0x37')]:null;});if(_0x3d7552){if(_0x169e61[_0x405c69][_0xbe57('0x9e')]){_0x1b1f21[_0xbe57('0x9a')](_0x254934(_0x46f7a2[_0xbe57('0x16')],_0x169e61[_0x405c69]));}else{if(!_0x169e61[_0x405c69][_0xbe57('0xa0')]){_0x1b1f21[_0xbe57('0x9a')](_0x897d87(_0x3d7552,_0x169e61[_0x405c69],_0x46f7a2[_0xbe57('0x16')]));}else{if(_0x3d7552['model']){_0x1b1f21[_0xbe57('0x9a')](_0xfc04dd(_0x3d7552,_0x169e61[_0x405c69]));}}}}}return Promise[_0xbe57('0x9d')](_0x1b1f21);})[_0xbe57('0x9')](function(_0x53ccc5){var _0x50af36=_0x53ccc5;var _0x15ec08=null;if(_0x50af36){_0x15ec08=_0x50af36[_0xbe57('0x99')]===0x1?_0x50af36[0x0]:null;}if(!_0x15ec08&&!_0x50af36)return _0x497802;var _0x6cf5b5=_0x18bf6c[_0x46f7a2[_0xbe57('0x16')]][_0xbe57('0xa1')];_0x2f1dd8['model']=_[_0xbe57('0xa2')](_0x6cf5b5);_0x2f1dd8[_0xbe57('0x91')]=_['keys'](_0x54e8c0['query']);_0x2f1dd8[_0xbe57('0xa3')]=_[_0xbe57('0xa4')](_0x2f1dd8[_0xbe57('0xd')],_0x2f1dd8[_0xbe57('0x91')]);_0x3fed61['attributes']=_[_0xbe57('0xa4')](_0x2f1dd8[_0xbe57('0xd')],qs[_0xbe57('0xa5')](_0x54e8c0[_0xbe57('0x91')]['fields']));_0x3fed61[_0xbe57('0xa6')]=_0x3fed61['attributes']['length']?_0x3fed61[_0xbe57('0xa6')]:_0x2f1dd8[_0xbe57('0xd')];if(!_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xa7')]('nolimit')){_0x3fed61[_0xbe57('0xa8')]=qs[_0xbe57('0xa8')](_0x54e8c0[_0xbe57('0x91')]['limit']);_0x3fed61[_0xbe57('0xa9')]=qs[_0xbe57('0xa9')](_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xa9')]);}_0x3fed61['order']=qs[_0xbe57('0xaa')](_0x54e8c0['query'][_0xbe57('0xaa')]);_0x3fed61[_0xbe57('0x8f')]=qs[_0xbe57('0xa3')](_[_0xbe57('0xab')](_0x54e8c0[_0xbe57('0x91')],_0x2f1dd8[_0xbe57('0xa3')]));if(_0x54e8c0[_0xbe57('0x91')][_0xbe57('0x7')]){_0x3fed61[_0xbe57('0x8f')]=_[_0xbe57('0xac')](_0x3fed61[_0xbe57('0x8f')],{'$or':_[_0xbe57('0xa')](_0x6cf5b5,function(_0x2367d3){if(_0x2367d3[_0xbe57('0x13')]['key']!==_0xbe57('0xad')){var _0x3f90df={};_0x3f90df[_0x2367d3[_0xbe57('0x6')]]={'$like':'%'+_0x54e8c0[_0xbe57('0x91')][_0xbe57('0x7')]+'%'};return _0x3f90df;}})});}var _0x2506aa=[];var _0x8f97d8=null;var _0x4055de={};if(_0x15ec08){_0x8f97d8=_[_0xbe57('0xae')](_0x5b40b6,[_0xbe57('0x37'),_0x15ec08['name']]);if(_0x8f97d8[_0xbe57('0x6')]){_0x4055de={};if(_0x46f7a2[_0xbe57('0x16')]===_0xbe57('0x11')){_0x4055de[_0x8f97d8[_0xbe57('0xaf')]]=_[_0xbe57('0xa')](_0x15ec08['associatedResources'],'id');}else{_0x4055de[_0x8f97d8[_0xbe57('0xaf')]]=_0x15ec08['associatedResources'];}_0x2506aa['push'](_0x4055de);}else{_0x3fed61[_0xbe57('0x8f')]['id']=_0x15ec08[_0xbe57('0xe')];}}else{for(var _0x52d338=0x0;_0x52d338<_0x50af36[_0xbe57('0x99')];_0x52d338++){_0x8f97d8=_[_0xbe57('0xae')](_0x5b40b6,['name',_0x50af36[_0x52d338][_0xbe57('0x37')]]);if(_0x8f97d8[_0xbe57('0x6')]){_0x4055de={};_0x4055de[_0x8f97d8[_0xbe57('0xaf')]]=_0x50af36[_0x52d338]['associatedResources'];_0x2506aa['push'](_0x4055de);}else{if(!_0x3fed61[_0xbe57('0x8f')]['id'])_0x3fed61[_0xbe57('0x8f')]['id']=[];_0x50af36[_0x52d338][_0xbe57('0xe')]['forEach'](function(_0x1112a4){_0x3fed61[_0xbe57('0x8f')]['id'][_0xbe57('0x9a')](_0x1112a4);});}}}if(!_[_0xbe57('0x98')](_0x2506aa)){_0x3fed61[_0xbe57('0x8f')]=_['merge'](_0x3fed61[_0xbe57('0x8f')],{'$and':{'$or':_0x2506aa}});}_0x3fed61=_['merge']({},_0x3fed61,_0x54e8c0[_0xbe57('0xb0')]);if(_0x15ec08&&!_0x15ec08['autoAssociation']&&_0x46f7a2['childModel']===_0xbe57('0x11')){if(_0x54e8c0[_0xbe57('0x91')]['includeAll']){_0x3fed61[_0xbe57('0xb1')]=[{'all':!![]}];}return _0x18bf6c[_0x46f7a2[_0xbe57('0x16')]][_0xbe57('0x8')](_0x3fed61)[_0xbe57('0x9')](function(_0x126fd8){var _0x57d67b=[];_0x126fd8[_0xbe57('0xb2')](function(_0x3fad1f){var _0x2573b0;switch(_0x3fad1f['reportType']){case _0xbe57('0xb3'):_0x2573b0=_['find'](_0x15ec08[_0xbe57('0xe')],function(_0x3199a4){return _0x3199a4['id']===_0x3fad1f[_0xbe57('0x82')]&&_0x3199a4[_0xbe57('0x13')]===_0xbe57('0xb4');});break;case _0xbe57('0xb5'):_0x2573b0=_[_0xbe57('0xae')](_0x15ec08[_0xbe57('0xe')],function(_0x4df999){return _0x4df999['id']===_0x3fad1f[_0xbe57('0x82')]&&_0x4df999[_0xbe57('0x13')]===_0xbe57('0xb6');});break;}if(_0x2573b0)_0x57d67b['push'](_0x3fad1f);});_0x497802[_0xbe57('0xb7')]=_0x57d67b[_0xbe57('0x99')];_0x497802[_0xbe57('0xb8')]=_0x57d67b;return _0x497802;});}else{if(!_[_0xbe57('0x98')](_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xb9')])){_0x3fed61[_0xbe57('0x8f')]['id']=_0x3fed61[_0xbe57('0x8f')]['id']?_['intersection'](_0x3fed61['where']['id'],_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xb9')]):_0x54e8c0['query'][_0xbe57('0xb9')];if(_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xba')]){_0x3fed61[_0xbe57('0xbb')]=_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xba')];}}if(_0x54e8c0[_0xbe57('0x91')]['extraQueryConditions']){_0x3fed61[_0xbe57('0x8f')]=_['merge'](_0x3fed61[_0xbe57('0x8f')],{'$and':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xbc')]});}return _0x18bf6c[_0x46f7a2[_0xbe57('0x16')]][_0xbe57('0xb7')]({'where':_0x3fed61[_0xbe57('0x8f')]})['then'](function(_0x12f987){_0x497802[_0xbe57('0xb7')]=_0x12f987;if(_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xbd')]){if(_0x46f7a2[_0xbe57('0x16')]==='CmContact'){_0x3fed61[_0xbe57('0xb1')]=[{'model':_0x18bf6c[_0xbe57('0xbe')],'as':_0xbe57('0xbf'),'attributes':['id',_0xbe57('0x37'),'color'],'required':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xc0')]?!![]:![]},{'model':_0x18bf6c[_0xbe57('0xbe')],'as':'ThroughTags','attributes':['id',_0xbe57('0x37'),_0xbe57('0xc1')],'through':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xc0')]?{'attributes':[],'where':{'TagId':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xc0')]||undefined}}:{},'required':_0x54e8c0[_0xbe57('0x91')][_0xbe57('0xc0')]?!![]:![]}];}else{_0x3fed61[_0xbe57('0xb1')]=[{'all':!![]}];}}return _0x18bf6c[_0x46f7a2[_0xbe57('0x16')]][_0xbe57('0x8')](_0x3fed61);})[_0xbe57('0x9')](function(_0x5d495e){_0x497802[_0xbe57('0xb8')]=_0x5d495e;if(_0x2e9d9f==='Agents'&&_0x54e8c0['query']['openTabs']===_0xbe57('0xc2')){var _0x952d07=[];for(var _0x235501=0x0;_0x235501<_0x497802[_0xbe57('0xb8')]['length'];_0x235501++){_0x952d07[_0xbe57('0x9a')](_0x234409(_0xbe57('0xc3'),_0x497802[_0xbe57('0xb8')][_0x235501][_0xbe57('0xc4')]));_0x952d07[_0xbe57('0x9a')](_0x234409(_0xbe57('0xc5'),_0x497802[_0xbe57('0xb8')][_0x235501][_0xbe57('0xc4')]));_0x952d07[_0xbe57('0x9a')](_0x234409(_0xbe57('0xc6'),_0x497802[_0xbe57('0xb8')][_0x235501]['dataValues']));_0x952d07['push'](_0x234409(_0xbe57('0xc7'),_0x497802[_0xbe57('0xb8')][_0x235501][_0xbe57('0xc4')]));_0x952d07['push'](_0x234409(_0xbe57('0xc8'),_0x497802[_0xbe57('0xb8')][_0x235501][_0xbe57('0xc4')]));_0x952d07[_0xbe57('0x9a')](_0x234409(_0xbe57('0xc9'),_0x497802['rows'][_0x235501][_0xbe57('0xc4')]));}return Promise[_0xbe57('0x9d')](_0x952d07)[_0xbe57('0x9')](function(){return _0x497802;});}return _0x497802;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 830e018..d939915 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 _0x6337=['http','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x6337,0x18a));var _0x7633=function(_0xa9fc2d,_0x24d396){_0xa9fc2d=_0xa9fc2d-0x0;var _0x154e79=_0x6337[_0xa9fc2d];return _0x154e79;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require(_0x7633('0x3'));var fs=require('fs');var Redis=require(_0x7633('0x4'));var db=require(_0x7633('0x5'))['db'];var utils=require(_0x7633('0x6'));var logger=require(_0x7633('0x7'))(_0x7633('0x8'));var config=require('../../config/environment');var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});config['redis']=_[_0x7633('0xc')](config['redis'],{'host':_0x7633('0xd'),'port':0x18eb});var socket=require(_0x7633('0xe'))(new Redis(config['redis']));require(_0x7633('0xf'))['register'](socket);function respondWithRpcPromise(_0x35a196,_0x4c0f0a,_0x174d9f){return new BPromise(function(_0x2404e4,_0x59e518){return client[_0x7633('0x10')](_0x35a196,_0x174d9f)[_0x7633('0x11')](function(_0x332283){logger['info'](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));logger[_0x7633('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4c0f0a,_0x7633('0x13'),JSON[_0x7633('0x15')](_0x332283));if(_0x332283[_0x7633('0x16')]){if(_0x332283['error']['code']===0x1f4){logger['error'](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x59e518(_0x332283[_0x7633('0x16')][_0x7633('0x17')]);}logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x332283[_0x7633('0x16')][_0x7633('0x17')]);return _0x2404e4(_0x332283['error'][_0x7633('0x17')]);}else{logger[_0x7633('0x18')](_0x7633('0x12'),_0x4c0f0a,_0x7633('0x13'));_0x2404e4(_0x332283[_0x7633('0x19')]['message']);}})[_0x7633('0x1a')](function(_0x30b58b){logger[_0x7633('0x16')](_0x7633('0x12'),_0x4c0f0a,_0x30b58b);_0x59e518(_0x30b58b);});});} \ No newline at end of file +var _0x16ce=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x410ded,_0x545b33){var _0x350d24=function(_0x49c614){while(--_0x49c614){_0x410ded['push'](_0x410ded['shift']());}};_0x350d24(++_0x545b33);}(_0x16ce,0xfb));var _0xe16c=function(_0x2cc733,_0x353ea3){_0x2cc733=_0x2cc733-0x0;var _0x47e0c6=_0x16ce[_0x2cc733];return _0x47e0c6;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});config[_0xe16c('0x9')]=_[_0xe16c('0xa')](config[_0xe16c('0x9')],{'host':_0xe16c('0xb'),'port':0x18eb});var socket=require(_0xe16c('0xc'))(new Redis(config[_0xe16c('0x9')]));require('./userProfile.socket')[_0xe16c('0xd')](socket);function respondWithRpcPromise(_0x1dfa84,_0x3cc96b,_0x2e59ad){return new BPromise(function(_0x1b7da7,_0x280e21){return client[_0xe16c('0xe')](_0x1dfa84,_0x2e59ad)[_0xe16c('0xf')](function(_0x1b460c){logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,'request\x20sent');logger[_0xe16c('0x12')](_0xe16c('0x13'),_0x3cc96b,_0xe16c('0x14'),JSON[_0xe16c('0x15')](_0x1b460c));if(_0x1b460c['error']){if(_0x1b460c['error'][_0xe16c('0x16')]===0x1f4){logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x280e21(_0x1b460c[_0xe16c('0x17')]['message']);}logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x1b7da7(_0x1b460c[_0xe16c('0x17')][_0xe16c('0x18')]);}else{logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,_0xe16c('0x14'));_0x1b7da7(_0x1b460c['result'][_0xe16c('0x18')]);}})[_0xe16c('0x19')](function(_0x22fe04){logger['error']('UserProfile,\x20%s,\x20%s',_0x3cc96b,_0x22fe04);_0x280e21(_0x22fe04);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3c2c2cc..8e8270e 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 _0xbd21=['userProfile:','./userProfile.events','remove','update','emit','removeListener','register','length'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xbd21,0xe1));var _0x1bd2=function(_0x56bcf2,_0x265052){_0x56bcf2=_0x56bcf2-0x0;var _0x53b4c9=_0xbd21[_0x56bcf2];return _0x53b4c9;};'use strict';var UserProfileEvents=require(_0x1bd2('0x0'));var events=['save',_0x1bd2('0x1'),_0x1bd2('0x2')];function createListener(_0x165523,_0x4433c3){return function(_0x13a0ab){_0x4433c3[_0x1bd2('0x3')](_0x165523,_0x13a0ab);};}function removeListener(_0x3ad898,_0x4227a7){return function(){UserProfileEvents[_0x1bd2('0x4')](_0x3ad898,_0x4227a7);};}exports[_0x1bd2('0x5')]=function(_0x1f509f){for(var _0x2c4301=0x0,_0x434b89=events[_0x1bd2('0x6')];_0x2c4301<_0x434b89;_0x2c4301++){var _0xeed9ac=events[_0x2c4301];var _0x21b65a=createListener(_0x1bd2('0x7')+_0xeed9ac,_0x1f509f);UserProfileEvents['on'](_0xeed9ac,_0x21b65a);}}; \ No newline at end of file +var _0x625d=['length','./userProfile.events','register'];(function(_0x3179e8,_0x22f6af){var _0x45b28a=function(_0x4ca895){while(--_0x4ca895){_0x3179e8['push'](_0x3179e8['shift']());}};_0x45b28a(++_0x22f6af);}(_0x625d,0x181));var _0xd625=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x625d[_0x474bc0];return _0x4b24cf;};'use strict';var UserProfileEvents=require(_0xd625('0x0'));var events=['save','remove','update'];function createListener(_0x3c34ea,_0xbd8674){return function(_0x4ca358){_0xbd8674['emit'](_0x3c34ea,_0x4ca358);};}function removeListener(_0x408215,_0x56b9c5){return function(){UserProfileEvents['removeListener'](_0x408215,_0x56b9c5);};}exports[_0xd625('0x1')]=function(_0x3a9208){for(var _0x9f02d9=0x0,_0xc265e7=events[_0xd625('0x2')];_0x9f02d9<_0xc265e7;_0x9f02d9++){var _0x25ed97=events[_0x9f02d9];var _0x398ab1=createListener('userProfile:'+_0x25ed97,_0x3a9208);UserProfileEvents['on'](_0x25ed97,_0x398ab1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4179c36..64970b8 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 _0xa6fe=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x57e618,_0x2aaa01){var _0x2718f2=function(_0x3c467e){while(--_0x3c467e){_0x57e618['push'](_0x57e618['shift']());}};_0x2718f2(++_0x2aaa01);}(_0xa6fe,0xc0));var _0xea6f=function(_0x7cc48b,_0x238e60){_0x7cc48b=_0x7cc48b-0x0;var _0xc94ef5=_0xa6fe[_0x7cc48b];return _0xc94ef5;};'use strict';var multer=require(_0xea6f('0x0'));var util=require(_0xea6f('0x1'));var path=require('path');var timeout=require(_0xea6f('0x2'));var express=require(_0xea6f('0x3'));var router=express[_0xea6f('0x4')]();var fs_extra=require(_0xea6f('0x5'));var auth=require(_0xea6f('0x6'));var interaction=require(_0xea6f('0x7'));var config=require(_0xea6f('0x8'));var controller=require(_0xea6f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xea6f('0xa')]);router[_0xea6f('0xb')](_0xea6f('0xc'),auth[_0xea6f('0xd')](),controller[_0xea6f('0xe')]);router[_0xea6f('0xb')](_0xea6f('0xf'),auth[_0xea6f('0xd')](),controller[_0xea6f('0x10')]);router[_0xea6f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xea6f('0x12')](_0xea6f('0xf'),auth[_0xea6f('0xd')](),controller[_0xea6f('0x13')]);router[_0xea6f('0x14')]('/:id',auth[_0xea6f('0xd')](),controller[_0xea6f('0x15')]);module[_0xea6f('0x16')]=router; \ No newline at end of file +var _0x813a=['../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x28caf4,_0x797e55){var _0x503f93=function(_0x1dca13){while(--_0x1dca13){_0x28caf4['push'](_0x28caf4['shift']());}};_0x503f93(++_0x797e55);}(_0x813a,0x73));var _0xa813=function(_0x1d30a4,_0x2f796c){_0x1d30a4=_0x1d30a4-0x0;var _0x25c7a8=_0x813a[_0x1d30a4];return _0x25c7a8;};'use strict';var multer=require('multer');var util=require(_0xa813('0x0'));var path=require('path');var timeout=require(_0xa813('0x1'));var express=require(_0xa813('0x2'));var router=express[_0xa813('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa813('0x4'));var config=require(_0xa813('0x5'));var controller=require(_0xa813('0x6'));router[_0xa813('0x7')]('/',auth[_0xa813('0x8')](),controller['index']);router[_0xa813('0x7')](_0xa813('0x9'),auth[_0xa813('0x8')](),controller[_0xa813('0xa')]);router[_0xa813('0x7')](_0xa813('0xb'),auth[_0xa813('0x8')](),controller[_0xa813('0xc')]);router[_0xa813('0xd')]('/',auth[_0xa813('0x8')](),controller[_0xa813('0xe')]);router[_0xa813('0xf')](_0xa813('0xb'),auth[_0xa813('0x8')](),controller[_0xa813('0x10')]);router[_0xa813('0x11')](_0xa813('0xb'),auth[_0xa813('0x8')](),controller[_0xa813('0x12')]);module[_0xa813('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index db3952b..48ca226 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 _0xf24e=['STRING','sequelize','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf24e,0x13c));var _0xef24=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xf24e[_0x3d2e4b];return _0x509e78;};'use strict';var Sequelize=require(_0xef24('0x0'));module[_0xef24('0x1')]={'name':{'type':Sequelize[_0xef24('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa87d=['exports','STRING','INTEGER','sequelize'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0xa87d,0xb3));var _0xda87=function(_0x1229bf,_0x6c5d70){_0x1229bf=_0x1229bf-0x0;var _0x1b2cbd=_0xa87d[_0x1229bf];return _0x1b2cbd;};'use strict';var Sequelize=require(_0xda87('0x0'));module[_0xda87('0x1')]={'name':{'type':Sequelize[_0xda87('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xda87('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xda87('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index cbc0b99..b9f6b71 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 _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1623,0xab));var _0x3162=function(_0x575012,_0x257234){_0x575012=_0x575012-0x0;var _0xccbdb4=_0x1623[_0x575012];return _0xccbdb4;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file +var _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x8952,0x17e));var _0x2895=function(_0x598bd2,_0x5764c3){_0x598bd2=_0x598bd2-0x0;var _0x4471e5=_0x8952[_0x598bd2];return _0x4471e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5cf5ebf..720bdd7 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 _0x063b=['user_profile_has_resources','compositeIndex','sectionId','lodash','util','api','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','define','UserProfileResource'];(function(_0x550f20,_0x3412bc){var _0x2ca4b8=function(_0x24f5dd){while(--_0x24f5dd){_0x550f20['push'](_0x550f20['shift']());}};_0x2ca4b8(++_0x3412bc);}(_0x063b,0x15f));var _0xb063=function(_0x5aa387,_0xa4581d){_0x5aa387=_0x5aa387-0x0;var _0x1a14fe=_0x063b[_0x5aa387];return _0x1a14fe;};'use strict';var _=require(_0xb063('0x0'));var util=require(_0xb063('0x1'));var logger=require('../../config/logger')(_0xb063('0x2'));var moment=require('moment');var BPromise=require(_0xb063('0x3'));var rp=require(_0xb063('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb063('0x5'));var attributes=require(_0xb063('0x6'));module['exports']=function(_0x3fa248,_0x4dba23){return _0x3fa248[_0xb063('0x7')](_0xb063('0x8'),attributes,{'tableName':_0xb063('0x9'),'paranoid':![],'indexes':[{'name':_0xb063('0xa'),'fields':['resourceId',_0xb063('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe52e=['resourceId','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources'];(function(_0x19d637,_0x35047a){var _0x49364c=function(_0x4adcef){while(--_0x4adcef){_0x19d637['push'](_0x19d637['shift']());}};_0x49364c(++_0x35047a);}(_0xe52e,0x8e));var _0xee52=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xe52e[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0xee52('0x0'));var util=require(_0xee52('0x1'));var logger=require(_0xee52('0x2'))(_0xee52('0x3'));var moment=require(_0xee52('0x4'));var BPromise=require('bluebird');var rp=require(_0xee52('0x5'));var fs=require('fs');var path=require(_0xee52('0x6'));var rimraf=require(_0xee52('0x7'));var config=require('../../config/environment');var attributes=require(_0xee52('0x8'));module['exports']=function(_0x422a26,_0x337c71){return _0x422a26[_0xee52('0x9')](_0xee52('0xa'),attributes,{'tableName':_0xee52('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xee52('0xc'),_0xee52('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c8841d6..65be503 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 _0xb5a2=['error','message','info','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xb5a2,0xa6));var _0x2b5a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb5a2[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2b5a('0x0'));var util=require(_0x2b5a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2b5a('0x2'));var fs=require('fs');var Redis=require(_0x2b5a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b5a('0x4'));var logger=require('../../config/logger')(_0x2b5a('0x5'));var config=require(_0x2b5a('0x6'));var jayson=require(_0x2b5a('0x7'));var client=jayson['client'][_0x2b5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a65cb,_0x140ea1,_0x20a64e){return new BPromise(function(_0x512ecb,_0x7f7f1e){return client[_0x2b5a('0x9')](_0x5a65cb,_0x20a64e)[_0x2b5a('0xa')](function(_0x1986a3){logger['info'](_0x2b5a('0xb'),_0x140ea1,'request\x20sent');logger['debug'](_0x2b5a('0xc'),_0x140ea1,'request\x20sent',JSON[_0x2b5a('0xd')](_0x1986a3));if(_0x1986a3[_0x2b5a('0xe')]){if(_0x1986a3['error']['code']===0x1f4){logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);return _0x7f7f1e(_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);}logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x1986a3[_0x2b5a('0xe')][_0x2b5a('0xf')]);return _0x512ecb(_0x1986a3['error'][_0x2b5a('0xf')]);}else{logger[_0x2b5a('0x10')](_0x2b5a('0xb'),_0x140ea1,_0x2b5a('0x11'));_0x512ecb(_0x1986a3[_0x2b5a('0x12')][_0x2b5a('0xf')]);}})[_0x2b5a('0x13')](function(_0x3ea488){logger[_0x2b5a('0xe')](_0x2b5a('0xb'),_0x140ea1,_0x3ea488);_0x7f7f1e(_0x3ea488);});});} \ No newline at end of file +var _0xfec8=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x20c0af,_0x5d2561){var _0x5b8435=function(_0x391a1d){while(--_0x391a1d){_0x20c0af['push'](_0x20c0af['shift']());}};_0x5b8435(++_0x5d2561);}(_0xfec8,0x107));var _0x8fec=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xfec8[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x8fec('0x0'));var util=require(_0x8fec('0x1'));var moment=require('moment');var BPromise=require(_0x8fec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8fec('0x4'))(_0x8fec('0x5'));var config=require(_0x8fec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8fec('0x7')][_0x8fec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44fcaa,_0x363b54,_0x45c40c){return new BPromise(function(_0x528a,_0x27bcf9){return client['request'](_0x44fcaa,_0x45c40c)[_0x8fec('0x9')](function(_0x59bdab){logger[_0x8fec('0xa')](_0x8fec('0xb'),_0x363b54,_0x8fec('0xc'));logger[_0x8fec('0xd')](_0x8fec('0xe'),_0x363b54,_0x8fec('0xc'),JSON[_0x8fec('0xf')](_0x59bdab));if(_0x59bdab[_0x8fec('0x10')]){if(_0x59bdab[_0x8fec('0x10')][_0x8fec('0x11')]===0x1f4){logger[_0x8fec('0x10')](_0x8fec('0xb'),_0x363b54,_0x59bdab['error'][_0x8fec('0x12')]);return _0x27bcf9(_0x59bdab[_0x8fec('0x10')][_0x8fec('0x12')]);}logger[_0x8fec('0x10')](_0x8fec('0xb'),_0x363b54,_0x59bdab[_0x8fec('0x10')][_0x8fec('0x12')]);return _0x528a(_0x59bdab['error']['message']);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x363b54,_0x8fec('0xc'));_0x528a(_0x59bdab[_0x8fec('0x13')][_0x8fec('0x12')]);}})[_0x8fec('0x14')](function(_0x45f3cb){logger[_0x8fec('0x10')](_0x8fec('0xb'),_0x363b54,_0x45f3cb);_0x27bcf9(_0x45f3cb);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3a7d43a..82f5ba7 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 _0x3a6d=['./userProfileSection.controller','/describe','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0xe7));var _0xd3a6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3a6d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require(_0xd3a6('0x2'));var timeout=require(_0xd3a6('0x3'));var express=require(_0xd3a6('0x4'));var router=express[_0xd3a6('0x5')]();var fs_extra=require(_0xd3a6('0x6'));var auth=require(_0xd3a6('0x7'));var interaction=require(_0xd3a6('0x8'));var config=require('../../config/environment');var controller=require(_0xd3a6('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd3a6('0xa'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xc')]);router['get']('/:id',auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xd')]);router['post']('/',auth[_0xd3a6('0xb')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0x10'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')](_0xd3a6('0x10'),auth[_0xd3a6('0xb')](),controller[_0xd3a6('0x13')]);module['exports']=router; \ No newline at end of file +var _0x749a=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0x347af9,_0x4a3180){var _0xbd7a46=function(_0x42cc74){while(--_0x42cc74){_0x347af9['push'](_0x347af9['shift']());}};_0xbd7a46(++_0x4a3180);}(_0x749a,0xd4));var _0xa749=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x749a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa749('0x0'));var util=require(_0xa749('0x1'));var path=require(_0xa749('0x2'));var timeout=require(_0xa749('0x3'));var express=require(_0xa749('0x4'));var router=express[_0xa749('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa749('0x6'));var controller=require(_0xa749('0x7'));router[_0xa749('0x8')]('/',auth[_0xa749('0x9')](),controller[_0xa749('0xa')]);router['get'](_0xa749('0xb'),auth[_0xa749('0x9')](),controller[_0xa749('0xc')]);router[_0xa749('0x8')]('/:id',auth[_0xa749('0x9')](),controller[_0xa749('0xd')]);router[_0xa749('0xe')]('/',auth['isAuthenticated'](),controller[_0xa749('0xf')]);router[_0xa749('0x10')](_0xa749('0x11'),auth[_0xa749('0x9')](),controller[_0xa749('0x12')]);router[_0xa749('0x13')](_0xa749('0x11'),auth[_0xa749('0x9')](),controller[_0xa749('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 58164aa..712efad 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 _0x1eba=['join','getDataValue','split','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x2b7d52,_0x23cc7d){var _0x1f8c53=function(_0x3982a0){while(--_0x3982a0){_0x2b7d52['push'](_0x2b7d52['shift']());}};_0x1f8c53(++_0x23cc7d);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x1eba[_0x3cb3ca];return _0x214366;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1eb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa1eb('0x2')],'set':function(_0x34be5a){this[_0xa1eb('0x4')](_0xa1eb('0x5'),_0x34be5a?_0x34be5a[_0xa1eb('0x6')](''):[]);},'get':function(){return this[_0xa1eb('0x7')](_0xa1eb('0x5'))?this[_0xa1eb('0x7')](_0xa1eb('0x5'))[_0xa1eb('0x8')](''):[];}}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x3e2f47,_0x155bf5){var _0x4ab177=function(_0x115a52){while(--_0x115a52){_0x3e2f47['push'](_0x3e2f47['shift']());}};_0x4ab177(++_0x155bf5);}(_0xe820,0xd2));var _0x0e82=function(_0x3620bd,_0x7d28dd){_0x3620bd=_0x3620bd-0x0;var _0x1febe2=_0xe820[_0x3620bd];return _0x1febe2;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5c3e0b8..bd01688 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 _0x5e1b=['params','rawAttributes','includeAll','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','key','map','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch'];(function(_0xbd2356,_0x441dc9){var _0xf0b100=function(_0x5eb948){while(--_0x5eb948){_0xbd2356['push'](_0xbd2356['shift']());}};_0xf0b100(++_0x441dc9);}(_0x5e1b,0x17e));var _0xb5e1=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x5e1b[_0x35e92e];return _0x1205a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5e1('0x0'));var zipdir=require(_0xb5e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5e1('0x2'));var moment=require(_0xb5e1('0x3'));var BPromise=require(_0xb5e1('0x4'));var Mustache=require(_0xb5e1('0x5'));var util=require('util');var path=require(_0xb5e1('0x6'));var sox=require(_0xb5e1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5e1('0x8'));var _=require('lodash');var squel=require(_0xb5e1('0x9'));var crypto=require(_0xb5e1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb5e1('0xb'));var toCsv=require(_0xb5e1('0xc'));var querystring=require(_0xb5e1('0xd'));var Papa=require(_0xb5e1('0xe'));var Redis=require('ioredis');var authService=require(_0xb5e1('0xf'));var qs=require(_0xb5e1('0x10'));var as=require(_0xb5e1('0x11'));var hardwareService=require(_0xb5e1('0x12'));var logger=require(_0xb5e1('0x13'))(_0xb5e1('0x14'));var utils=require(_0xb5e1('0x15'));var config=require(_0xb5e1('0x16'));var licenseUtil=require(_0xb5e1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457ecb,_0x25714a){_0x25714a=_0x25714a||0xcc;return function(_0x4eb8b5){if(_0x4eb8b5){return _0x457ecb[_0xb5e1('0x18')](_0x25714a);}return _0x457ecb[_0xb5e1('0x19')](_0x25714a)[_0xb5e1('0x1a')]();};}function respondWithResult(_0x51cd96,_0xf372d2){_0xf372d2=_0xf372d2||0xc8;return function(_0x126f82){if(_0x126f82){return _0x51cd96[_0xb5e1('0x19')](_0xf372d2)['json'](_0x126f82);}};}function respondWithFilteredResult(_0x372566,_0x25c957){return function(_0x1903a5){if(_0x1903a5){var _0x4780aa=typeof _0x25c957[_0xb5e1('0x1b')]==='undefined'&&typeof _0x25c957[_0xb5e1('0x1c')]===_0xb5e1('0x1d');var _0x2a2b0d=_0x1903a5[_0xb5e1('0x1e')];var _0x5ab389=_0x4780aa?0x0:_0x25c957[_0xb5e1('0x1b')];var _0x26f86e=_0x4780aa?_0x1903a5[_0xb5e1('0x1e')]:_0x25c957['offset']+_0x25c957[_0xb5e1('0x1c')];var _0x4b3519;if(_0x26f86e>=_0x2a2b0d){_0x26f86e=_0x2a2b0d;_0x4b3519=0xc8;}else{_0x4b3519=0xce;}_0x372566[_0xb5e1('0x19')](_0x4b3519);return _0x372566[_0xb5e1('0x1f')](_0xb5e1('0x20'),_0x5ab389+'-'+_0x26f86e+'/'+_0x2a2b0d)[_0xb5e1('0x21')](_0x1903a5);}return null;};}function patchUpdates(_0x385d4d){return function(_0x39f77c){try{jsonpatch[_0xb5e1('0x22')](_0x39f77c,_0x385d4d,!![]);}catch(_0xd12538){return BPromise[_0xb5e1('0x23')](_0xd12538);}return _0x39f77c[_0xb5e1('0x24')]();};}function saveUpdates(_0x46b4ec,_0x3fd3fd){return function(_0x569e37){if(_0x569e37){return _0x569e37[_0xb5e1('0x25')](_0x46b4ec)[_0xb5e1('0x26')](function(_0x3a45a2){return _0x3a45a2;});}return null;};}function removeEntity(_0x293a68,_0x4ac25a){return function(_0x5d63cb){if(_0x5d63cb){return _0x5d63cb[_0xb5e1('0x27')]()[_0xb5e1('0x26')](function(){_0x293a68[_0xb5e1('0x19')](0xcc)[_0xb5e1('0x1a')]();});}};}function handleEntityNotFound(_0x545163,_0x5270ad){return function(_0x4d964b){if(!_0x4d964b){_0x545163[_0xb5e1('0x18')](0x194);}return _0x4d964b;};}function handleError(_0x4ec60b,_0x13ed3c){_0x13ed3c=_0x13ed3c||0x1f4;return function(_0x4eccd2){logger[_0xb5e1('0x28')](_0x4eccd2[_0xb5e1('0x29')]);if(_0x4eccd2[_0xb5e1('0x2a')]){delete _0x4eccd2['name'];}_0x4ec60b['status'](_0x13ed3c)[_0xb5e1('0x2b')](_0x4eccd2);};}exports[_0xb5e1('0x2c')]=function(_0x50915d,_0x308fd7){var _0x441379={},_0x4f8656={},_0x1a5ec0={'count':0x0,'rows':[]};var _0x59e3fc=_['map'](db[_0xb5e1('0x2d')]['rawAttributes'],function(_0x55b442){return{'name':_0x55b442['fieldName'],'type':_0x55b442['type'][_0xb5e1('0x2e')]};});_0x4f8656['model']=_[_0xb5e1('0x2f')](_0x59e3fc,'name');_0x4f8656[_0xb5e1('0x30')]=_[_0xb5e1('0x31')](_0x50915d['query']);_0x4f8656[_0xb5e1('0x32')]=_['intersection'](_0x4f8656['model'],_0x4f8656[_0xb5e1('0x30')]);_0x441379[_0xb5e1('0x33')]=_[_0xb5e1('0x34')](_0x4f8656[_0xb5e1('0x35')],qs[_0xb5e1('0x36')](_0x50915d[_0xb5e1('0x30')]['fields']));_0x441379[_0xb5e1('0x33')]=_0x441379[_0xb5e1('0x33')][_0xb5e1('0x37')]?_0x441379[_0xb5e1('0x33')]:_0x4f8656[_0xb5e1('0x35')];if(!_0x50915d[_0xb5e1('0x30')]['hasOwnProperty'](_0xb5e1('0x38'))){_0x441379[_0xb5e1('0x1c')]=qs[_0xb5e1('0x1c')](_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x1c')]);_0x441379[_0xb5e1('0x1b')]=qs[_0xb5e1('0x1b')](_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x1b')]);}_0x441379['order']=qs[_0xb5e1('0x39')](_0x50915d[_0xb5e1('0x30')]['sort']);_0x441379[_0xb5e1('0x3a')]=qs[_0xb5e1('0x32')](_[_0xb5e1('0x3b')](_0x50915d['query'],_0x4f8656[_0xb5e1('0x32')]),_0x59e3fc);if(_0x50915d['query']['filter']){_0x441379['where']=_['merge'](_0x441379['where'],{'$or':_[_0xb5e1('0x2f')](_0x59e3fc,function(_0x1dc9be){if(_0x1dc9be['type']!==_0xb5e1('0x3c')){var _0x422191={};_0x422191[_0x1dc9be[_0xb5e1('0x2a')]]={'$like':'%'+_0x50915d[_0xb5e1('0x30')][_0xb5e1('0x3d')]+'%'};return _0x422191;}})});}_0x441379=_[_0xb5e1('0x3e')]({},_0x441379,_0x50915d[_0xb5e1('0x3f')]);var _0x44d3d8={'where':_0x441379[_0xb5e1('0x3a')]};return db[_0xb5e1('0x2d')][_0xb5e1('0x1e')](_0x44d3d8)[_0xb5e1('0x26')](function(_0x3315e5){_0x1a5ec0[_0xb5e1('0x1e')]=_0x3315e5;if(_0x50915d[_0xb5e1('0x30')]['includeAll']){_0x441379[_0xb5e1('0x40')]=[{'all':!![]}];}return db[_0xb5e1('0x2d')][_0xb5e1('0x41')](_0x441379);})[_0xb5e1('0x26')](function(_0x318055){_0x1a5ec0[_0xb5e1('0x42')]=_0x318055;return _0x1a5ec0;})[_0xb5e1('0x26')](respondWithFilteredResult(_0x308fd7,_0x441379))[_0xb5e1('0x43')](handleError(_0x308fd7,null));};exports['show']=function(_0x349a34,_0xd9ec95){var _0x2ee402={'raw':![],'where':{'id':_0x349a34[_0xb5e1('0x44')]['id']}},_0x42e0f5={};_0x42e0f5['model']=_[_0xb5e1('0x31')](db[_0xb5e1('0x2d')][_0xb5e1('0x45')]);_0x42e0f5[_0xb5e1('0x30')]=_[_0xb5e1('0x31')](_0x349a34['query']);_0x42e0f5[_0xb5e1('0x32')]=_[_0xb5e1('0x34')](_0x42e0f5[_0xb5e1('0x35')],_0x42e0f5[_0xb5e1('0x30')]);_0x2ee402[_0xb5e1('0x33')]=_[_0xb5e1('0x34')](_0x42e0f5[_0xb5e1('0x35')],qs[_0xb5e1('0x36')](_0x349a34[_0xb5e1('0x30')][_0xb5e1('0x36')]));_0x2ee402[_0xb5e1('0x33')]=_0x2ee402[_0xb5e1('0x33')][_0xb5e1('0x37')]?_0x2ee402[_0xb5e1('0x33')]:_0x42e0f5['model'];if(_0x349a34[_0xb5e1('0x30')][_0xb5e1('0x46')]){_0x2ee402[_0xb5e1('0x40')]=[{'all':!![]}];}_0x2ee402=_[_0xb5e1('0x3e')]({},_0x2ee402,_0x349a34[_0xb5e1('0x3f')]);return db[_0xb5e1('0x2d')][_0xb5e1('0x47')](_0x2ee402)[_0xb5e1('0x26')](handleEntityNotFound(_0xd9ec95,null))['then'](respondWithResult(_0xd9ec95,null))[_0xb5e1('0x43')](handleError(_0xd9ec95,null));};exports[_0xb5e1('0x48')]=function(_0x233b5e,_0x463a54){return db[_0xb5e1('0x2d')]['create'](_0x233b5e[_0xb5e1('0x49')],{})[_0xb5e1('0x26')](respondWithResult(_0x463a54,0xc9))['catch'](handleError(_0x463a54,null));};exports[_0xb5e1('0x25')]=function(_0x147a37,_0x2e3721){if(_0x147a37[_0xb5e1('0x49')]['id']){delete _0x147a37[_0xb5e1('0x49')]['id'];}return db['UserProfileSection'][_0xb5e1('0x47')]({'where':{'id':_0x147a37['params']['id']}})[_0xb5e1('0x26')](handleEntityNotFound(_0x2e3721,null))['then'](saveUpdates(_0x147a37[_0xb5e1('0x49')],null))[_0xb5e1('0x26')](respondWithResult(_0x2e3721,null))['catch'](handleError(_0x2e3721,null));};exports[_0xb5e1('0x27')]=function(_0x2cdefa,_0x3638a7){return db[_0xb5e1('0x2d')][_0xb5e1('0x47')]({'where':{'id':_0x2cdefa['params']['id']}})[_0xb5e1('0x26')](handleEntityNotFound(_0x3638a7,null))[_0xb5e1('0x26')](removeEntity(_0x3638a7,null))['catch'](handleError(_0x3638a7,null));};exports['describe']=function(_0x568436,_0x10ca42){return db[_0xb5e1('0x2d')][_0xb5e1('0x4a')]()[_0xb5e1('0x26')](respondWithResult(_0x10ca42,null))[_0xb5e1('0x43')](handleError(_0x10ca42,null));}; \ No newline at end of file +var _0xfb14=['name','send','UserProfileSection','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','sendStatus','error','stack'];(function(_0x1fefd2,_0x12a82d){var _0x132432=function(_0x4e7974){while(--_0x4e7974){_0x1fefd2['push'](_0x1fefd2['shift']());}};_0x132432(++_0x12a82d);}(_0xfb14,0x195));var _0x4fb1=function(_0x55ecd8,_0x2f2b58){_0x55ecd8=_0x55ecd8-0x0;var _0x17af76=_0xfb14[_0x55ecd8];return _0x17af76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fb1('0x0'));var zipdir=require(_0x4fb1('0x1'));var jsonpatch=require(_0x4fb1('0x2'));var rp=require('request-promise');var moment=require(_0x4fb1('0x3'));var BPromise=require(_0x4fb1('0x4'));var Mustache=require(_0x4fb1('0x5'));var util=require(_0x4fb1('0x6'));var path=require(_0x4fb1('0x7'));var sox=require(_0x4fb1('0x8'));var csv=require(_0x4fb1('0x9'));var ejs=require(_0x4fb1('0xa'));var fs=require('fs');var fs_extra=require(_0x4fb1('0xb'));var _=require(_0x4fb1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fb1('0x9'));var querystring=require(_0x4fb1('0xd'));var Papa=require(_0x4fb1('0xe'));var Redis=require(_0x4fb1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4fb1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fb1('0x11'));var logger=require(_0x4fb1('0x12'))('api');var utils=require(_0x4fb1('0x13'));var config=require(_0x4fb1('0x14'));var licenseUtil=require(_0x4fb1('0x15'));var db=require(_0x4fb1('0x16'))['db'];function respondWithStatusCode(_0x1ea94d,_0x3d7967){_0x3d7967=_0x3d7967||0xcc;return function(_0x1b8ff2){if(_0x1b8ff2){return _0x1ea94d['sendStatus'](_0x3d7967);}return _0x1ea94d[_0x4fb1('0x17')](_0x3d7967)[_0x4fb1('0x18')]();};}function respondWithResult(_0x2711a8,_0x584204){_0x584204=_0x584204||0xc8;return function(_0x43d64b){if(_0x43d64b){return _0x2711a8[_0x4fb1('0x17')](_0x584204)[_0x4fb1('0x19')](_0x43d64b);}};}function respondWithFilteredResult(_0x20c252,_0x23a5cc){return function(_0x241cd7){if(_0x241cd7){var _0x43dca2=typeof _0x23a5cc[_0x4fb1('0x1a')]==='undefined'&&typeof _0x23a5cc[_0x4fb1('0x1b')]===_0x4fb1('0x1c');var _0x13acff=_0x241cd7[_0x4fb1('0x1d')];var _0x280314=_0x43dca2?0x0:_0x23a5cc[_0x4fb1('0x1a')];var _0x4b8641=_0x43dca2?_0x241cd7[_0x4fb1('0x1d')]:_0x23a5cc['offset']+_0x23a5cc['limit'];var _0x2ab70d;if(_0x4b8641>=_0x13acff){_0x4b8641=_0x13acff;_0x2ab70d=0xc8;}else{_0x2ab70d=0xce;}_0x20c252[_0x4fb1('0x17')](_0x2ab70d);return _0x20c252[_0x4fb1('0x1e')]('Content-Range',_0x280314+'-'+_0x4b8641+'/'+_0x13acff)['json'](_0x241cd7);}return null;};}function patchUpdates(_0x556bb6){return function(_0x5f4ce1){try{jsonpatch[_0x4fb1('0x1f')](_0x5f4ce1,_0x556bb6,!![]);}catch(_0x3b7b5d){return BPromise[_0x4fb1('0x20')](_0x3b7b5d);}return _0x5f4ce1[_0x4fb1('0x21')]();};}function saveUpdates(_0x4ece3a,_0x33297d){return function(_0x3a9d73){if(_0x3a9d73){return _0x3a9d73['update'](_0x4ece3a)['then'](function(_0x4b3133){return _0x4b3133;});}return null;};}function removeEntity(_0xadff73,_0x12acbe){return function(_0x2bea8f){if(_0x2bea8f){return _0x2bea8f[_0x4fb1('0x22')]()[_0x4fb1('0x23')](function(){_0xadff73[_0x4fb1('0x17')](0xcc)[_0x4fb1('0x18')]();});}};}function handleEntityNotFound(_0xc3e13e,_0x3075f2){return function(_0x36ff6a){if(!_0x36ff6a){_0xc3e13e[_0x4fb1('0x24')](0x194);}return _0x36ff6a;};}function handleError(_0x31387f,_0x40ade1){_0x40ade1=_0x40ade1||0x1f4;return function(_0x3dbac7){logger[_0x4fb1('0x25')](_0x3dbac7[_0x4fb1('0x26')]);if(_0x3dbac7[_0x4fb1('0x27')]){delete _0x3dbac7[_0x4fb1('0x27')];}_0x31387f[_0x4fb1('0x17')](_0x40ade1)[_0x4fb1('0x28')](_0x3dbac7);};}exports['index']=function(_0xf8dbaa,_0x2dcda3){var _0x573b95={},_0x50220f={},_0x35c556={'count':0x0,'rows':[]};var _0x12ba3b=_['map'](db[_0x4fb1('0x29')][_0x4fb1('0x2a')],function(_0x5ccd94){return{'name':_0x5ccd94[_0x4fb1('0x2b')],'type':_0x5ccd94[_0x4fb1('0x2c')][_0x4fb1('0x2d')]};});_0x50220f['model']=_[_0x4fb1('0x2e')](_0x12ba3b,_0x4fb1('0x27'));_0x50220f[_0x4fb1('0x2f')]=_['keys'](_0xf8dbaa[_0x4fb1('0x2f')]);_0x50220f['filters']=_[_0x4fb1('0x30')](_0x50220f['model'],_0x50220f[_0x4fb1('0x2f')]);_0x573b95[_0x4fb1('0x31')]=_[_0x4fb1('0x30')](_0x50220f[_0x4fb1('0x32')],qs['fields'](_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x33')]));_0x573b95[_0x4fb1('0x31')]=_0x573b95['attributes'][_0x4fb1('0x34')]?_0x573b95[_0x4fb1('0x31')]:_0x50220f[_0x4fb1('0x32')];if(!_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x35')]('nolimit')){_0x573b95[_0x4fb1('0x1b')]=qs[_0x4fb1('0x1b')](_0xf8dbaa[_0x4fb1('0x2f')]['limit']);_0x573b95[_0x4fb1('0x1a')]=qs[_0x4fb1('0x1a')](_0xf8dbaa['query']['offset']);}_0x573b95[_0x4fb1('0x36')]=qs[_0x4fb1('0x37')](_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x37')]);_0x573b95['where']=qs[_0x4fb1('0x38')](_['pick'](_0xf8dbaa['query'],_0x50220f['filters']),_0x12ba3b);if(_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x39')]){_0x573b95[_0x4fb1('0x3a')]=_[_0x4fb1('0x3b')](_0x573b95[_0x4fb1('0x3a')],{'$or':_[_0x4fb1('0x2e')](_0x12ba3b,function(_0x49ee98){if(_0x49ee98[_0x4fb1('0x2c')]!=='VIRTUAL'){var _0x7c33ff={};_0x7c33ff[_0x49ee98[_0x4fb1('0x27')]]={'$like':'%'+_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x39')]+'%'};return _0x7c33ff;}})});}_0x573b95=_['merge']({},_0x573b95,_0xf8dbaa['options']);var _0x327fd5={'where':_0x573b95[_0x4fb1('0x3a')]};return db[_0x4fb1('0x29')]['count'](_0x327fd5)[_0x4fb1('0x23')](function(_0x45fd56){_0x35c556[_0x4fb1('0x1d')]=_0x45fd56;if(_0xf8dbaa[_0x4fb1('0x2f')][_0x4fb1('0x3c')]){_0x573b95[_0x4fb1('0x3d')]=[{'all':!![]}];}return db[_0x4fb1('0x29')][_0x4fb1('0x3e')](_0x573b95);})[_0x4fb1('0x23')](function(_0x4e85cb){_0x35c556[_0x4fb1('0x3f')]=_0x4e85cb;return _0x35c556;})['then'](respondWithFilteredResult(_0x2dcda3,_0x573b95))[_0x4fb1('0x40')](handleError(_0x2dcda3,null));};exports[_0x4fb1('0x41')]=function(_0x337643,_0x521ff2){var _0x546624={'raw':![],'where':{'id':_0x337643[_0x4fb1('0x42')]['id']}},_0x2f4652={};_0x2f4652['model']=_[_0x4fb1('0x43')](db['UserProfileSection'][_0x4fb1('0x2a')]);_0x2f4652['query']=_['keys'](_0x337643['query']);_0x2f4652['filters']=_['intersection'](_0x2f4652[_0x4fb1('0x32')],_0x2f4652[_0x4fb1('0x2f')]);_0x546624['attributes']=_['intersection'](_0x2f4652[_0x4fb1('0x32')],qs['fields'](_0x337643[_0x4fb1('0x2f')]['fields']));_0x546624[_0x4fb1('0x31')]=_0x546624[_0x4fb1('0x31')][_0x4fb1('0x34')]?_0x546624[_0x4fb1('0x31')]:_0x2f4652[_0x4fb1('0x32')];if(_0x337643[_0x4fb1('0x2f')]['includeAll']){_0x546624[_0x4fb1('0x3d')]=[{'all':!![]}];}_0x546624=_['merge']({},_0x546624,_0x337643[_0x4fb1('0x44')]);return db[_0x4fb1('0x29')]['find'](_0x546624)[_0x4fb1('0x23')](handleEntityNotFound(_0x521ff2,null))[_0x4fb1('0x23')](respondWithResult(_0x521ff2,null))[_0x4fb1('0x40')](handleError(_0x521ff2,null));};exports['create']=function(_0xa04287,_0x5d553e){return db['UserProfileSection'][_0x4fb1('0x45')](_0xa04287[_0x4fb1('0x46')],{})[_0x4fb1('0x23')](respondWithResult(_0x5d553e,0xc9))['catch'](handleError(_0x5d553e,null));};exports[_0x4fb1('0x47')]=function(_0x22a98d,_0x45d1b7){if(_0x22a98d[_0x4fb1('0x46')]['id']){delete _0x22a98d[_0x4fb1('0x46')]['id'];}return db['UserProfileSection'][_0x4fb1('0x48')]({'where':{'id':_0x22a98d['params']['id']}})[_0x4fb1('0x23')](handleEntityNotFound(_0x45d1b7,null))[_0x4fb1('0x23')](saveUpdates(_0x22a98d[_0x4fb1('0x46')],null))[_0x4fb1('0x23')](respondWithResult(_0x45d1b7,null))['catch'](handleError(_0x45d1b7,null));};exports[_0x4fb1('0x22')]=function(_0x46eec7,_0x56ce76){return db[_0x4fb1('0x29')]['find']({'where':{'id':_0x46eec7[_0x4fb1('0x42')]['id']}})[_0x4fb1('0x23')](handleEntityNotFound(_0x56ce76,null))[_0x4fb1('0x23')](removeEntity(_0x56ce76,null))['catch'](handleError(_0x56ce76,null));};exports[_0x4fb1('0x49')]=function(_0x297167,_0x25ccbd){return db[_0x4fb1('0x29')][_0x4fb1('0x49')]()[_0x4fb1('0x23')](respondWithResult(_0x25ccbd,null))[_0x4fb1('0x40')](handleError(_0x25ccbd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1bde459..4a8ed56 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 _0x0ac5=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x326bc4,_0x4a925d){var _0xc42f1a=function(_0x1d9d7d){while(--_0x1d9d7d){_0x326bc4['push'](_0x326bc4['shift']());}};_0xc42f1a(++_0x4a925d);}(_0x0ac5,0x151));var _0x50ac=function(_0x1374cd,_0x239113){_0x1374cd=_0x1374cd-0x0;var _0x69a754=_0x0ac5[_0x1374cd];return _0x69a754;};'use strict';var _=require(_0x50ac('0x0'));var util=require(_0x50ac('0x1'));var logger=require(_0x50ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x50ac('0x3'));var rp=require(_0x50ac('0x4'));var fs=require('fs');var path=require(_0x50ac('0x5'));var rimraf=require(_0x50ac('0x6'));var config=require(_0x50ac('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x50ac('0x8')]=function(_0xd80659,_0x59150f){return _0xd80659['define'](_0x50ac('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x50ac('0xa'),'fields':[_0x50ac('0xb'),_0x50ac('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3a5=['path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x912d6a,_0x4a3be8){var _0x1b7df1=function(_0x4884d7){while(--_0x4884d7){_0x912d6a['push'](_0x912d6a['shift']());}};_0x1b7df1(++_0x4a3be8);}(_0xe3a5,0x127));var _0x5e3a=function(_0x1ed778,_0x461d6c){_0x1ed778=_0x1ed778-0x0;var _0x5b1388=_0xe3a5[_0x1ed778];return _0x5b1388;};'use strict';var _=require(_0x5e3a('0x0'));var util=require(_0x5e3a('0x1'));var logger=require(_0x5e3a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e3a('0x3'));var rp=require(_0x5e3a('0x4'));var fs=require('fs');var path=require(_0x5e3a('0x5'));var rimraf=require('rimraf');var config=require(_0x5e3a('0x6'));var attributes=require(_0x5e3a('0x7'));module[_0x5e3a('0x8')]=function(_0x195c9e,_0x3e39e5){return _0x195c9e['define'](_0x5e3a('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5e3a('0xa'),'fields':['sectionId',_0x5e3a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b426933..95ffb3a 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 _0x6ca1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0xe43a77,_0x5d8c78){var _0x3a7d24=function(_0x1286dd){while(--_0x1286dd){_0xe43a77['push'](_0xe43a77['shift']());}};_0x3a7d24(++_0x5d8c78);}(_0x6ca1,0x13e));var _0x16ca=function(_0x9ce14,_0x922b2e){_0x9ce14=_0x9ce14-0x0;var _0x17a5b3=_0x6ca1[_0x9ce14];return _0x17a5b3;};'use strict';var _=require(_0x16ca('0x0'));var util=require(_0x16ca('0x1'));var moment=require(_0x16ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16ca('0x3'));var db=require(_0x16ca('0x4'))['db'];var utils=require(_0x16ca('0x5'));var logger=require(_0x16ca('0x6'))(_0x16ca('0x7'));var config=require(_0x16ca('0x8'));var jayson=require(_0x16ca('0x9'));var client=jayson[_0x16ca('0xa')][_0x16ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c2a0c,_0x5d5888,_0x19dc33){return new BPromise(function(_0x3764b6,_0x229fef){return client['request'](_0x4c2a0c,_0x19dc33)[_0x16ca('0xc')](function(_0x404c9e){logger[_0x16ca('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5d5888,_0x16ca('0xe'));logger[_0x16ca('0xf')](_0x16ca('0x10'),_0x5d5888,_0x16ca('0xe'),JSON[_0x16ca('0x11')](_0x404c9e));if(_0x404c9e[_0x16ca('0x12')]){if(_0x404c9e[_0x16ca('0x12')][_0x16ca('0x13')]===0x1f4){logger[_0x16ca('0x12')](_0x16ca('0x14'),_0x5d5888,_0x404c9e['error'][_0x16ca('0x15')]);return _0x229fef(_0x404c9e[_0x16ca('0x12')]['message']);}logger['error'](_0x16ca('0x14'),_0x5d5888,_0x404c9e[_0x16ca('0x12')]['message']);return _0x3764b6(_0x404c9e[_0x16ca('0x12')][_0x16ca('0x15')]);}else{logger[_0x16ca('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5d5888,'request\x20sent');_0x3764b6(_0x404c9e['result']['message']);}})[_0x16ca('0x16')](function(_0x26201e){logger[_0x16ca('0x12')](_0x16ca('0x14'),_0x5d5888,_0x26201e);_0x229fef(_0x26201e);});});} \ No newline at end of file +var _0x317a=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x3b1659,_0x3994e5){var _0x1913b5=function(_0x3edc76){while(--_0x3edc76){_0x3b1659['push'](_0x3b1659['shift']());}};_0x1913b5(++_0x3994e5);}(_0x317a,0x1d5));var _0xa317=function(_0x36acc5,_0x27b43a){_0x36acc5=_0x36acc5-0x0;var _0x528065=_0x317a[_0x36acc5];return _0x528065;};'use strict';var _=require(_0xa317('0x0'));var util=require(_0xa317('0x1'));var moment=require(_0xa317('0x2'));var BPromise=require(_0xa317('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa317('0x4'));var db=require(_0xa317('0x5'))['db'];var utils=require(_0xa317('0x6'));var logger=require(_0xa317('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa317('0x8'));var client=jayson[_0xa317('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe40da0,_0x285ec1,_0x13cf3a){return new BPromise(function(_0x4aa30a,_0xebce12){return client[_0xa317('0xa')](_0xe40da0,_0x13cf3a)[_0xa317('0xb')](function(_0x455fdb){logger[_0xa317('0xc')](_0xa317('0xd'),_0x285ec1,_0xa317('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x285ec1,_0xa317('0xe'),JSON['stringify'](_0x455fdb));if(_0x455fdb[_0xa317('0xf')]){if(_0x455fdb[_0xa317('0xf')][_0xa317('0x10')]===0x1f4){logger[_0xa317('0xf')](_0xa317('0xd'),_0x285ec1,_0x455fdb[_0xa317('0xf')][_0xa317('0x11')]);return _0xebce12(_0x455fdb[_0xa317('0xf')][_0xa317('0x11')]);}logger[_0xa317('0xf')](_0xa317('0xd'),_0x285ec1,_0x455fdb[_0xa317('0xf')]['message']);return _0x4aa30a(_0x455fdb[_0xa317('0xf')][_0xa317('0x11')]);}else{logger[_0xa317('0xc')](_0xa317('0xd'),_0x285ec1,_0xa317('0xe'));_0x4aa30a(_0x455fdb[_0xa317('0x12')]['message']);}})[_0xa317('0x13')](function(_0x29a6d0){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x285ec1,_0x29a6d0);_0xebce12(_0x29a6d0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 0cec7a2..a794258 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1a2d32,_0x49462d){var _0x1bb782=function(_0x2e1d20){while(--_0x2e1d20){_0x1a2d32['push'](_0x1a2d32['shift']());}};_0x1bb782(++_0x49462d);}(_0x70e0,0x17b));var _0x070e=function(_0x1bd6d6,_0x1f731e){_0x1bd6d6=_0x1bd6d6-0x0;var _0x5b527b=_0x70e0[_0x1bd6d6];return _0x5b527b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a275947..a6f402e 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 _0xc627=['exports','INTEGER'];(function(_0x2a518e,_0x5e7939){var _0x4e8da0=function(_0xbe809a){while(--_0xbe809a){_0x2a518e['push'](_0x2a518e['shift']());}};_0x4e8da0(++_0x5e7939);}(_0xc627,0x14a));var _0x7c62=function(_0x54f6bd,_0x170176){_0x54f6bd=_0x54f6bd-0x0;var _0x11dd90=_0xc627[_0x54f6bd];return _0x11dd90;};'use strict';var Sequelize=require('sequelize');module[_0x7c62('0x0')]={'penalty':{'type':Sequelize[_0x7c62('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x44d0=['INTEGER','sequelize'];(function(_0x46a426,_0xf6b8e1){var _0x1af1cb=function(_0x575a){while(--_0x575a){_0x46a426['push'](_0x46a426['shift']());}};_0x1af1cb(++_0xf6b8e1);}(_0x44d0,0x187));var _0x044d=function(_0x1b4cd2,_0x5a01a3){_0x1b4cd2=_0x1b4cd2-0x0;var _0x53c88e=_0x44d0[_0x1b4cd2];return _0x53c88e;};'use strict';var Sequelize=require(_0x044d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x044d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index d9e432c..06b35d7 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 _0xce68=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','user_has_sms_queues','lodash','../../config/logger'];(function(_0x1da53d,_0x4ce99c){var _0x2e6382=function(_0x1a96a6){while(--_0x1a96a6){_0x1da53d['push'](_0x1da53d['shift']());}};_0x2e6382(++_0x4ce99c);}(_0xce68,0x10c));var _0x8ce6=function(_0x3ce9b2,_0x186535){_0x3ce9b2=_0x3ce9b2-0x0;var _0x3ab4f2=_0xce68[_0x3ce9b2];return _0x3ab4f2;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var logger=require(_0x8ce6('0x1'))(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var BPromise=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require(_0x8ce6('0x8'));module['exports']=function(_0x116e0a,_0x10b3ca){return _0x116e0a['define']('UserSmsQueue',attributes,{'tableName':_0x8ce6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf562=['moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x5ee626,_0x27485e){var _0x115d9c=function(_0xe386d4){while(--_0xe386d4){_0x5ee626['push'](_0x5ee626['shift']());}};_0x115d9c(++_0x27485e);}(_0xf562,0x100));var _0x2f56=function(_0x2b44bd,_0x488772){_0x2b44bd=_0x2b44bd-0x0;var _0x2c222a=_0xf562[_0x2b44bd];return _0x2c222a;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'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 d7de7cb..2780edf 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 _0x15d8=['request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x15d8,0xdc));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x815d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x815d('0x1'));var rs=require(_0x815d('0x2'));var fs=require('fs');var Redis=require(_0x815d('0x3'));var db=require(_0x815d('0x4'))['db'];var utils=require(_0x815d('0x5'));var logger=require('../../config/logger')(_0x815d('0x6'));var config=require(_0x815d('0x7'));var jayson=require(_0x815d('0x8'));var client=jayson[_0x815d('0x9')][_0x815d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169fcf,_0x383834,_0x2be71e){return new BPromise(function(_0x265271,_0x273a82){return client[_0x815d('0xb')](_0x169fcf,_0x2be71e)['then'](function(_0x1ad76f){logger[_0x815d('0xc')](_0x815d('0xd'),_0x383834,_0x815d('0xe'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x383834,'request\x20sent',JSON[_0x815d('0xf')](_0x1ad76f));if(_0x1ad76f[_0x815d('0x10')]){if(_0x1ad76f[_0x815d('0x10')][_0x815d('0x11')]===0x1f4){logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x1ad76f[_0x815d('0x10')][_0x815d('0x12')]);return _0x273a82(_0x1ad76f['error'][_0x815d('0x12')]);}logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x1ad76f[_0x815d('0x10')][_0x815d('0x12')]);return _0x265271(_0x1ad76f[_0x815d('0x10')]['message']);}else{logger[_0x815d('0xc')](_0x815d('0xd'),_0x383834,_0x815d('0xe'));_0x265271(_0x1ad76f[_0x815d('0x13')][_0x815d('0x12')]);}})[_0x815d('0x14')](function(_0x7ca30c){logger[_0x815d('0x10')](_0x815d('0xd'),_0x383834,_0x7ca30c);_0x273a82(_0x7ca30c);});});} \ No newline at end of file +var _0x772d=['UserSmsQueue,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x3e6e19,_0x78d16d){var _0x2392ce=function(_0x42b591){while(--_0x42b591){_0x3e6e19['push'](_0x3e6e19['shift']());}};_0x2392ce(++_0x78d16d);}(_0x772d,0x1ab));var _0xd772=function(_0x25e8fd,_0x409eaa){_0x25e8fd=_0x25e8fd-0x0;var _0xa9ccab=_0x772d[_0x25e8fd];return _0xa9ccab;};'use strict';var _=require(_0xd772('0x0'));var util=require(_0xd772('0x1'));var moment=require(_0xd772('0x2'));var BPromise=require(_0xd772('0x3'));var rs=require(_0xd772('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd772('0x5'))['db'];var utils=require(_0xd772('0x6'));var logger=require(_0xd772('0x7'))(_0xd772('0x8'));var config=require(_0xd772('0x9'));var jayson=require(_0xd772('0xa'));var client=jayson[_0xd772('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9faad,_0x508481,_0x2d18d8){return new BPromise(function(_0x5f3757,_0x16ea52){return client['request'](_0xd9faad,_0x2d18d8)[_0xd772('0xc')](function(_0x3a8f60){logger['info'](_0xd772('0xd'),_0x508481,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x508481,'request\x20sent',JSON[_0xd772('0xe')](_0x3a8f60));if(_0x3a8f60['error']){if(_0x3a8f60[_0xd772('0xf')][_0xd772('0x10')]===0x1f4){logger['error'](_0xd772('0xd'),_0x508481,_0x3a8f60['error'][_0xd772('0x11')]);return _0x16ea52(_0x3a8f60[_0xd772('0xf')][_0xd772('0x11')]);}logger[_0xd772('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x508481,_0x3a8f60[_0xd772('0xf')][_0xd772('0x11')]);return _0x5f3757(_0x3a8f60[_0xd772('0xf')][_0xd772('0x11')]);}else{logger[_0xd772('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x508481,_0xd772('0x13'));_0x5f3757(_0x3a8f60[_0xd772('0x14')]['message']);}})[_0xd772('0x15')](function(_0x4b9848){logger['error'](_0xd772('0xd'),_0x508481,_0x4b9848);_0x16ea52(_0x4b9848);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 91e374a..cc3b7c9 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 _0xe64b=['INTEGER','sequelize','exports'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe64b,0xee));var _0xbe64=function(_0x7a6bef,_0x145158){_0x7a6bef=_0x7a6bef-0x0;var _0x58cc4f=_0xe64b[_0x7a6bef];return _0x58cc4f;};'use strict';var Sequelize=require(_0xbe64('0x0'));module[_0xbe64('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xbe64('0x2')]}}; \ No newline at end of file +var _0x3bd6=['INTEGER','sequelize','exports'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x3bd6,0x15a));var _0x63bd=function(_0x42b871,_0x245a76){_0x42b871=_0x42b871-0x0;var _0x15b0d8=_0x3bd6[_0x42b871];return _0x15b0d8;};'use strict';var Sequelize=require(_0x63bd('0x0'));module[_0x63bd('0x1')]={'UserId':{'type':Sequelize[_0x63bd('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x63bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4741f78..6854e94 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(_0x5e2e40,_0x1bff26){var _0x20ee19=function(_0x5d0a1d){while(--_0x5d0a1d){_0x5e2e40['push'](_0x5e2e40['shift']());}};_0x20ee19(++_0x1bff26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x2fde81,_0x533fa1){var _0x45ee6b=function(_0x5e24bc){while(--_0x5e24bc){_0x2fde81['push'](_0x2fde81['shift']());}};_0x45ee6b(++_0x533fa1);}(_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 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 8ba4160..3ef159a 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x59d980,_0x1f2185){var _0x505478=function(_0x4c775a){while(--_0x4c775a){_0x59d980['push'](_0x59d980['shift']());}};_0x505478(++_0x1f2185);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 0d70ccf..dcfc049 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 _0xa271=['exports','INTEGER'];(function(_0x53b52d,_0x2f2bff){var _0x2a12c0=function(_0x496f5c){while(--_0x496f5c){_0x53b52d['push'](_0x53b52d['shift']());}};_0x2a12c0(++_0x2f2bff);}(_0xa271,0xe8));var _0x1a27=function(_0x1cac3b,_0x344896){_0x1cac3b=_0x1cac3b-0x0;var _0x36c22b=_0xa271[_0x1cac3b];return _0x36c22b;};'use strict';var Sequelize=require('sequelize');module[_0x1a27('0x0')]={'penalty':{'type':Sequelize[_0x1a27('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd1a=['INTEGER','sequelize'];(function(_0x34c52e,_0xb44845){var _0x273eed=function(_0xd602a4){while(--_0xd602a4){_0x34c52e['push'](_0x34c52e['shift']());}};_0x273eed(++_0xb44845);}(_0xdd1a,0x1dd));var _0xadd1=function(_0x25fead,_0x39809d){_0x25fead=_0x25fead-0x0;var _0x50af82=_0xdd1a[_0x25fead];return _0x50af82;};'use strict';var Sequelize=require(_0xadd1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xadd1('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index f98436d..bd1ecc1 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 _0x0820=['request-promise','path','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x309f89,_0x4dcee4){var _0xbbbf35=function(_0x5461c4){while(--_0x5461c4){_0x309f89['push'](_0x309f89['shift']());}};_0xbbbf35(++_0x4dcee4);}(_0x0820,0x103));var _0x0082=function(_0x11f92a,_0x67abff){_0x11f92a=_0x11f92a-0x0;var _0x4a5c6c=_0x0820[_0x11f92a];return _0x4a5c6c;};'use strict';var _=require(_0x0082('0x0'));var util=require('util');var logger=require(_0x0082('0x1'))(_0x0082('0x2'));var moment=require(_0x0082('0x3'));var BPromise=require(_0x0082('0x4'));var rp=require(_0x0082('0x5'));var fs=require('fs');var path=require(_0x0082('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x0082('0x7')]=function(_0x5501e6,_0x59c844){return _0x5501e6[_0x0082('0x8')](_0x0082('0x9'),attributes,{'tableName':_0x0082('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x941c=['../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x941c,0xa1));var _0xc941=function(_0x2ad870,_0x201e38){_0x2ad870=_0x2ad870-0x0;var _0x84b464=_0x941c[_0x2ad870];return _0x84b464;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var logger=require(_0xc941('0x2'))(_0xc941('0x3'));var moment=require(_0xc941('0x4'));var BPromise=require(_0xc941('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc941('0x6'));var rimraf=require(_0xc941('0x7'));var config=require(_0xc941('0x8'));var attributes=require(_0xc941('0x9'));module['exports']=function(_0x3199f7,_0x2e442a){return _0x3199f7[_0xc941('0xa')](_0xc941('0xb'),attributes,{'tableName':_0xc941('0xc'),'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 4875452..c463cdf 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 _0x2944=['code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x23f19e,_0x4d583b){var _0x2a95d4=function(_0x5bb558){while(--_0x5bb558){_0x23f19e['push'](_0x23f19e['shift']());}};_0x2a95d4(++_0x4d583b);}(_0x2944,0x8c));var _0x4294=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x2944[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require(_0x4294('0x0'));var moment=require('moment');var BPromise=require(_0x4294('0x1'));var rs=require(_0x4294('0x2'));var fs=require('fs');var Redis=require(_0x4294('0x3'));var db=require(_0x4294('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4294('0x5'));var config=require(_0x4294('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4294('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x133d9f,_0x41e0d3,_0x170b7f){return new BPromise(function(_0x4aeba6,_0x1422f3){return client[_0x4294('0x8')](_0x133d9f,_0x170b7f)['then'](function(_0x254f0a){logger['info'](_0x4294('0x9'),_0x41e0d3,'request\x20sent');logger[_0x4294('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x41e0d3,_0x4294('0xb'),JSON['stringify'](_0x254f0a));if(_0x254f0a[_0x4294('0xc')]){if(_0x254f0a['error'][_0x4294('0xd')]===0x1f4){logger[_0x4294('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x41e0d3,_0x254f0a[_0x4294('0xc')][_0x4294('0xe')]);return _0x1422f3(_0x254f0a[_0x4294('0xc')]['message']);}logger[_0x4294('0xc')](_0x4294('0x9'),_0x41e0d3,_0x254f0a[_0x4294('0xc')]['message']);return _0x4aeba6(_0x254f0a['error'][_0x4294('0xe')]);}else{logger[_0x4294('0xf')](_0x4294('0x9'),_0x41e0d3,_0x4294('0xb'));_0x4aeba6(_0x254f0a[_0x4294('0x10')][_0x4294('0xe')]);}})['catch'](function(_0x461de5){logger[_0x4294('0xc')](_0x4294('0x9'),_0x41e0d3,_0x461de5);_0x1422f3(_0x461de5);});});} \ No newline at end of file +var _0x78e2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','moment'];(function(_0x3ea959,_0x5b354d){var _0x18c554=function(_0x4f7099){while(--_0x4f7099){_0x3ea959['push'](_0x3ea959['shift']());}};_0x18c554(++_0x5b354d);}(_0x78e2,0x140));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x278e('0x0'));var util=require('util');var moment=require(_0x278e('0x1'));var BPromise=require(_0x278e('0x2'));var rs=require(_0x278e('0x3'));var fs=require('fs');var Redis=require(_0x278e('0x4'));var db=require(_0x278e('0x5'))['db'];var utils=require(_0x278e('0x6'));var logger=require(_0x278e('0x7'))(_0x278e('0x8'));var config=require(_0x278e('0x9'));var jayson=require(_0x278e('0xa'));var client=jayson['client'][_0x278e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x122e82,_0x523e5c,_0x4b1345){return new BPromise(function(_0x435237,_0x15a0b7){return client[_0x278e('0xc')](_0x122e82,_0x4b1345)[_0x278e('0xd')](function(_0x42de36){logger[_0x278e('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x523e5c,_0x278e('0xf'));logger[_0x278e('0x10')](_0x278e('0x11'),_0x523e5c,_0x278e('0xf'),JSON['stringify'](_0x42de36));if(_0x42de36[_0x278e('0x12')]){if(_0x42de36[_0x278e('0x12')][_0x278e('0x13')]===0x1f4){logger[_0x278e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x523e5c,_0x42de36[_0x278e('0x12')][_0x278e('0x14')]);return _0x15a0b7(_0x42de36[_0x278e('0x12')][_0x278e('0x14')]);}logger[_0x278e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x523e5c,_0x42de36[_0x278e('0x12')]['message']);return _0x435237(_0x42de36[_0x278e('0x12')][_0x278e('0x14')]);}else{logger[_0x278e('0xe')](_0x278e('0x15'),_0x523e5c,'request\x20sent');_0x435237(_0x42de36['result']['message']);}})[_0x278e('0x16')](function(_0xb76a7d){logger[_0x278e('0x12')](_0x278e('0x15'),_0x523e5c,_0xb76a7d);_0x15a0b7(_0xb76a7d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index afd6692..9bb0798 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ce575,_0xbcf48f){var _0x20118a=function(_0x2a44e4){while(--_0x2a44e4){_0x1ce575['push'](_0x1ce575['shift']());}};_0x20118a(++_0xbcf48f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a20b55c..a31ca19 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 _0xba77=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x4eda15,_0x28fa8c){var _0x292fe7=function(_0x2474f4){while(--_0x2474f4){_0x4eda15['push'](_0x4eda15['shift']());}};_0x292fe7(++_0x28fa8c);}(_0xba77,0x133));var _0x7ba7=function(_0x51c52b,_0x147712){_0x51c52b=_0x51c52b-0x0;var _0x581ce3=_0xba77[_0x51c52b];return _0x581ce3;};'use strict';var Sequelize=require(_0x7ba7('0x0'));module[_0x7ba7('0x1')]={'uniqueid':{'type':Sequelize[_0x7ba7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7ba7('0x3')},'membername':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x7ba7('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'unique':_0x7ba7('0x5'),'comment':_0x7ba7('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7ba7('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7ba7('0x4')],'allowNull':![],'unique':_0x7ba7('0x5'),'comment':_0x7ba7('0x3')},'penalty':{'type':Sequelize[_0x7ba7('0x2')](0xb),'defaultValue':0x0,'comment':_0x7ba7('0x3')},'paused':{'type':Sequelize[_0x7ba7('0x2')](0xb),'defaultValue':0x0,'comment':_0x7ba7('0x3')}}; \ No newline at end of file +var _0x1b29=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0xce240f,_0xe1f8c9){var _0x294d6d=function(_0x57feb9){while(--_0x57feb9){_0xce240f['push'](_0xce240f['shift']());}};_0x294d6d(++_0xe1f8c9);}(_0x1b29,0x116));var _0x91b2=function(_0x2bc112,_0x1cbe58){_0x2bc112=_0x2bc112-0x0;var _0x57bd63=_0x1b29[_0x2bc112];return _0x57bd63;};'use strict';var Sequelize=require(_0x91b2('0x0'));module[_0x91b2('0x1')]={'uniqueid':{'type':Sequelize[_0x91b2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x91b2('0x3')},'membername':{'type':Sequelize[_0x91b2('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x91b2('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x91b2('0x4')],'allowNull':![],'unique':_0x91b2('0x5'),'comment':_0x91b2('0x3')},'penalty':{'type':Sequelize[_0x91b2('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x91b2('0x2')](0xb),'defaultValue':0x0,'comment':_0x91b2('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6999113..9eb0118 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 _0xe4a3=['save','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe4a3,0xad));var _0x3e4a=function(_0x22e11c,_0x32ef49){_0x22e11c=_0x22e11c-0x0;var _0x4fd8ed=_0xe4a3[_0x22e11c];return _0x4fd8ed;};'use strict';var EventEmitter=require(_0x3e4a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x3e4a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3e4a('0x2')](0x0);var events={'afterCreate':_0x3e4a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f7f26){return function(_0x3d01fe,_0x4e2cd9,_0x49ed0d){UserVoiceQueueRtEvents[_0x3e4a('0x4')](_0x4f7f26+':'+_0x3d01fe['id'],_0x3d01fe);UserVoiceQueueRtEvents[_0x3e4a('0x4')](_0x4f7f26,_0x3d01fe);_0x49ed0d(null);};}for(var e in events){if(events[_0x3e4a('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x3e4a('0x6')](e,emitEvent(event));}}module[_0x3e4a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc1cd=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x42b594,_0x289981){var _0x86e5ad=function(_0x179592){while(--_0x179592){_0x42b594['push'](_0x42b594['shift']());}};_0x86e5ad(++_0x289981);}(_0xc1cd,0x150));var _0xdc1c=function(_0xd6c001,_0x38f624){_0xd6c001=_0xd6c001-0x0;var _0x52072c=_0xc1cd[_0xd6c001];return _0x52072c;};'use strict';var EventEmitter=require(_0xdc1c('0x0'));var UserVoiceQueueRt=require(_0xdc1c('0x1'))['db'][_0xdc1c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xdc1c('0x3')](0x0);var events={'afterCreate':_0xdc1c('0x4'),'afterUpdate':'update','afterDestroy':_0xdc1c('0x5')};function emitEvent(_0x3051f6){return function(_0x5359da,_0x2c4df4,_0x3644d5){UserVoiceQueueRtEvents[_0xdc1c('0x6')](_0x3051f6+':'+_0x5359da['id'],_0x5359da);UserVoiceQueueRtEvents[_0xdc1c('0x6')](_0x3051f6,_0x5359da);_0x3644d5(null);};}for(var e in events){if(events[_0xdc1c('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xdc1c('0x8')](e,emitEvent(event));}}module[_0xdc1c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a9756a8..0a38460 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 _0x2171=['bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x2171,0xbf));var _0x1217=function(_0x599b95,_0x309373){_0x599b95=_0x599b95-0x0;var _0x36f888=_0x2171[_0x599b95];return _0x36f888;};'use strict';var _=require(_0x1217('0x0'));var util=require(_0x1217('0x1'));var logger=require(_0x1217('0x2'))(_0x1217('0x3'));var moment=require(_0x1217('0x4'));var BPromise=require(_0x1217('0x5'));var rp=require(_0x1217('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1217('0x7'));var config=require(_0x1217('0x8'));var attributes=require(_0x1217('0x9'));module[_0x1217('0xa')]=function(_0x178683,_0x2a2207){return _0x178683[_0x1217('0xb')](_0x1217('0xc'),attributes,{'tableName':_0x1217('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e2b=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x6e2b,0x11e));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb6e2('0x0'));var util=require(_0xb6e2('0x1'));var logger=require(_0xb6e2('0x2'))(_0xb6e2('0x3'));var moment=require('moment');var BPromise=require(_0xb6e2('0x4'));var rp=require(_0xb6e2('0x5'));var fs=require('fs');var path=require(_0xb6e2('0x6'));var rimraf=require(_0xb6e2('0x7'));var config=require(_0xb6e2('0x8'));var attributes=require(_0xb6e2('0x9'));module['exports']=function(_0x5c2a4c,_0x1dc3fa){return _0x5c2a4c[_0xb6e2('0xa')](_0xb6e2('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 4613f36..1f8ec4f 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 _0x28b7=['GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x8bad6f,_0x15b2e4){var _0x2dd542=function(_0x42228a){while(--_0x42228a){_0x8bad6f['push'](_0x8bad6f['shift']());}};_0x2dd542(++_0x15b2e4);}(_0x28b7,0x1a0));var _0x728b=function(_0x43b9af,_0x2c8316){_0x43b9af=_0x43b9af-0x0;var _0x1df62e=_0x28b7[_0x43b9af];return _0x1df62e;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var moment=require(_0x728b('0x2'));var BPromise=require(_0x728b('0x3'));var rs=require(_0x728b('0x4'));var fs=require('fs');var Redis=require(_0x728b('0x5'));var db=require(_0x728b('0x6'))['db'];var utils=require(_0x728b('0x7'));var logger=require(_0x728b('0x8'))('rpc');var config=require(_0x728b('0x9'));var jayson=require(_0x728b('0xa'));var client=jayson[_0x728b('0xb')][_0x728b('0xc')]({'port':0x232a});config[_0x728b('0xd')]=_[_0x728b('0xe')](config[_0x728b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x728b('0xf'))(new Redis(config[_0x728b('0xd')]));require(_0x728b('0x10'))['register'](socket);function respondWithRpcPromise(_0x5e6a25,_0x44b88c,_0x177e7d){return new BPromise(function(_0x5a2377,_0x2ed167){return client[_0x728b('0x11')](_0x5e6a25,_0x177e7d)[_0x728b('0x12')](function(_0x13f849){logger['info'](_0x728b('0x13'),_0x44b88c,_0x728b('0x14'));logger[_0x728b('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x44b88c,'request\x20sent',JSON[_0x728b('0x16')](_0x13f849));if(_0x13f849['error']){if(_0x13f849[_0x728b('0x17')][_0x728b('0x18')]===0x1f4){logger[_0x728b('0x17')](_0x728b('0x13'),_0x44b88c,_0x13f849['error']['message']);return _0x2ed167(_0x13f849[_0x728b('0x17')][_0x728b('0x19')]);}logger[_0x728b('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x44b88c,_0x13f849['error'][_0x728b('0x19')]);return _0x5a2377(_0x13f849['error'][_0x728b('0x19')]);}else{logger[_0x728b('0x1a')](_0x728b('0x13'),_0x44b88c,_0x728b('0x14'));_0x5a2377(_0x13f849['result'][_0x728b('0x19')]);}})[_0x728b('0x1b')](function(_0x1e5931){logger['error'](_0x728b('0x13'),_0x44b88c,_0x1e5931);_0x2ed167(_0x1e5931);});});}exports[_0x728b('0x1c')]=function(_0x3fb4bf){var _0x22aa03=this;return new Promise(function(_0x3ba4f6,_0x5efc98){return db['UserVoiceQueueRt'][_0x728b('0x1d')]({'raw':_0x3fb4bf['options']?_0x3fb4bf[_0x728b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb4bf[_0x728b('0x1e')]?_0x3fb4bf[_0x728b('0x1e')][_0x728b('0x1f')]||null:null,'attributes':[[db[_0x728b('0x20')]['fn'](_0x728b('0x21'),db[_0x728b('0x20')]['fn']('IF',db[_0x728b('0x20')][_0x728b('0x22')](_0x728b('0x23')))),_0x728b('0x24')]]})[_0x728b('0x12')](function(_0x1a5f14){logger['info'](_0x728b('0x1c'),_0x3fb4bf);logger['debug']('GetVoiceQueueRtPauses',_0x3fb4bf,JSON['stringify'](_0x1a5f14));_0x3ba4f6(_0x1a5f14);})[_0x728b('0x1b')](function(_0x3f54bb){logger[_0x728b('0x17')](_0x728b('0x1c'),_0x3f54bb[_0x728b('0x19')],_0x3fb4bf);_0x5efc98(_0x22aa03['error'](0x1f4,_0x3f54bb[_0x728b('0x19')]));});});}; \ No newline at end of file +var _0x7f9e=['options','where','COUNT','sequelize','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x7f9e,0xdd));var _0xe7f9=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x7f9e[_0x3fba9f];return _0x192cf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7f9('0x0'));var BPromise=require(_0xe7f9('0x1'));var rs=require(_0xe7f9('0x2'));var fs=require('fs');var Redis=require(_0xe7f9('0x3'));var db=require(_0xe7f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe7f9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe7f9('0x6')][_0xe7f9('0x7')]({'port':0x232a});config[_0xe7f9('0x8')]=_[_0xe7f9('0x9')](config[_0xe7f9('0x8')],{'host':_0xe7f9('0xa'),'port':0x18eb});var socket=require(_0xe7f9('0xb'))(new Redis(config[_0xe7f9('0x8')]));require(_0xe7f9('0xc'))[_0xe7f9('0xd')](socket);function respondWithRpcPromise(_0x58567b,_0x4c23c7,_0x566a83){return new BPromise(function(_0x452504,_0xea1f55){return client['request'](_0x58567b,_0x566a83)[_0xe7f9('0xe')](function(_0x273315){logger[_0xe7f9('0xf')](_0xe7f9('0x10'),_0x4c23c7,_0xe7f9('0x11'));logger[_0xe7f9('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4c23c7,'request\x20sent',JSON[_0xe7f9('0x13')](_0x273315));if(_0x273315['error']){if(_0x273315['error'][_0xe7f9('0x14')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4c23c7,_0x273315[_0xe7f9('0x15')][_0xe7f9('0x16')]);return _0xea1f55(_0x273315[_0xe7f9('0x15')]['message']);}logger['error'](_0xe7f9('0x10'),_0x4c23c7,_0x273315[_0xe7f9('0x15')]['message']);return _0x452504(_0x273315[_0xe7f9('0x15')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4c23c7,_0xe7f9('0x11'));_0x452504(_0x273315[_0xe7f9('0x17')]['message']);}})[_0xe7f9('0x18')](function(_0x6e1417){logger[_0xe7f9('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4c23c7,_0x6e1417);_0xea1f55(_0x6e1417);});});}exports[_0xe7f9('0x19')]=function(_0x7b0918){var _0x5ee4af=this;return new Promise(function(_0x5e38f6,_0x21cc7d){return db[_0xe7f9('0x1a')]['findAll']({'raw':_0x7b0918['options']?_0x7b0918[_0xe7f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x7b0918[_0xe7f9('0x1b')]?_0x7b0918[_0xe7f9('0x1b')][_0xe7f9('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe7f9('0x1d'),db[_0xe7f9('0x1e')]['fn']('IF',db[_0xe7f9('0x1e')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xe7f9('0xe')](function(_0x42ef29){logger[_0xe7f9('0xf')](_0xe7f9('0x19'),_0x7b0918);logger[_0xe7f9('0x12')](_0xe7f9('0x19'),_0x7b0918,JSON[_0xe7f9('0x13')](_0x42ef29));_0x5e38f6(_0x42ef29);})[_0xe7f9('0x18')](function(_0x597ad3){logger[_0xe7f9('0x15')](_0xe7f9('0x19'),_0x597ad3[_0xe7f9('0x16')],_0x7b0918);_0x21cc7d(_0x5ee4af[_0xe7f9('0x15')](0x1f4,_0x597ad3[_0xe7f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index df56608..186fafd 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 _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x038b,0x114));var _0xb038=function(_0x5eb8d6,_0x5cbbad){_0x5eb8d6=_0x5eb8d6-0x0;var _0x591d44=_0x038b[_0x5eb8d6];return _0x591d44;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){UserVoiceQueueRtEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('userVoiceQueueRt:'+_0x1534a9,_0x4fe092);UserVoiceQueueRtEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file +var _0xe225=['userVoiceQueueRt:','save','remove','length'];(function(_0x40ced5,_0x2b8fe9){var _0x51024e=function(_0xa97f42){while(--_0xa97f42){_0x40ced5['push'](_0x40ced5['shift']());}};_0x51024e(++_0x2b8fe9);}(_0xe225,0x1bd));var _0x5e22=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xe225[_0x291f8b];return _0x275171;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5e22('0x0'),_0x5e22('0x1'),'update'];function createListener(_0x503eba,_0x4c55ed){return function(_0x39f972){_0x4c55ed['emit'](_0x503eba,_0x39f972);};}function removeListener(_0x45790b,_0x4e0d42){return function(){UserVoiceQueueRtEvents['removeListener'](_0x45790b,_0x4e0d42);};}exports['register']=function(_0x45595c){for(var _0x35248d=0x0,_0x35736b=events[_0x5e22('0x2')];_0x35248d<_0x35736b;_0x35248d++){var _0x465536=events[_0x35248d];var _0x36ad4d=createListener(_0x5e22('0x3')+_0x465536,_0x45595c);UserVoiceQueueRtEvents['on'](_0x465536,_0x36ad4d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index fc5cb0f..9a6ec10 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x440237,_0x403080){var _0x59c5b8=function(_0x4740a5){while(--_0x4740a5){_0x440237['push'](_0x440237['shift']());}};_0x59c5b8(++_0x403080);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x33d86c,_0x5a19e5){var _0x32bac2=function(_0x18130c){while(--_0x18130c){_0x33d86c['push'](_0x33d86c['shift']());}};_0x32bac2(++_0x5a19e5);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 180d725..bc54eef 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 _0x374a=['sequelize','INTEGER'];(function(_0x1d9962,_0x1812b0){var _0x4b2463=function(_0xa5a845){while(--_0xa5a845){_0x1d9962['push'](_0x1d9962['shift']());}};_0x4b2463(++_0x1812b0);}(_0x374a,0x122));var _0xa374=function(_0xaa8be9,_0x568c26){_0xaa8be9=_0xaa8be9-0x0;var _0x22e504=_0x374a[_0xaa8be9];return _0x22e504;};'use strict';var Sequelize=require(_0xa374('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa374('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89db=['exports'];(function(_0x47368f,_0x3c510f){var _0x2e7bfe=function(_0x25edf3){while(--_0x25edf3){_0x47368f['push'](_0x47368f['shift']());}};_0x2e7bfe(++_0x3c510f);}(_0x89db,0xdf));var _0xb89d=function(_0xd4d341,_0x8ca852){_0xd4d341=_0xd4d341-0x0;var _0x37f331=_0x89db[_0xd4d341];return _0x37f331;};'use strict';var Sequelize=require('sequelize');module[_0xb89d('0x0')]={'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 c9c8ea9..1c4407d 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 _0x3b6a=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','define','UserWhatsappQueue'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x3b6a,0x105));var _0xa3b6=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0x3b6a[_0x5ba513];return _0x1132a0;};'use strict';var _=require(_0xa3b6('0x0'));var util=require(_0xa3b6('0x1'));var logger=require(_0xa3b6('0x2'))(_0xa3b6('0x3'));var moment=require(_0xa3b6('0x4'));var BPromise=require('bluebird');var rp=require(_0xa3b6('0x5'));var fs=require('fs');var path=require(_0xa3b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x45f9fd,_0x40ccfb){return _0x45f9fd[_0xa3b6('0x7')](_0xa3b6('0x8'),attributes,{'tableName':_0xa3b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe7b=['exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x1e3e59,_0x596d22){var _0x4cdd16=function(_0xec196f){while(--_0xec196f){_0x1e3e59['push'](_0x1e3e59['shift']());}};_0x4cdd16(++_0x596d22);}(_0xbe7b,0xfa));var _0xbbe7=function(_0x3a41fb,_0x2a9a6d){_0x3a41fb=_0x3a41fb-0x0;var _0x27b6c0=_0xbe7b[_0x3a41fb];return _0x27b6c0;};'use strict';var _=require(_0xbbe7('0x0'));var util=require(_0xbbe7('0x1'));var logger=require(_0xbbe7('0x2'))(_0xbbe7('0x3'));var moment=require(_0xbbe7('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbe7('0x5'));var fs=require('fs');var path=require(_0xbbe7('0x6'));var rimraf=require(_0xbbe7('0x7'));var config=require(_0xbbe7('0x8'));var attributes=require(_0xbbe7('0x9'));module[_0xbbe7('0xa')]=function(_0x17ad30,_0x43b3b0){return _0x17ad30['define'](_0xbbe7('0xb'),attributes,{'tableName':_0xbbe7('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 5792bd8..d60dcb6 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 _0xfc99=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xfc99,0x93));var _0x9fc9=function(_0x1bb7f8,_0x57b7c0){_0x1bb7f8=_0x1bb7f8-0x0;var _0x5912d4=_0xfc99[_0x1bb7f8];return _0x5912d4;};'use strict';var _=require(_0x9fc9('0x0'));var util=require(_0x9fc9('0x1'));var moment=require(_0x9fc9('0x2'));var BPromise=require(_0x9fc9('0x3'));var rs=require(_0x9fc9('0x4'));var fs=require('fs');var Redis=require(_0x9fc9('0x5'));var db=require(_0x9fc9('0x6'))['db'];var utils=require(_0x9fc9('0x7'));var logger=require(_0x9fc9('0x8'))(_0x9fc9('0x9'));var config=require(_0x9fc9('0xa'));var jayson=require(_0x9fc9('0xb'));var client=jayson[_0x9fc9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c82b6,_0x1893fb,_0x38b21f){return new BPromise(function(_0x2b69a4,_0x53296b){return client[_0x9fc9('0xd')](_0x5c82b6,_0x38b21f)['then'](function(_0x31037a){logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x1893fb,_0x9fc9('0x10'));logger[_0x9fc9('0x11')](_0x9fc9('0x12'),_0x1893fb,_0x9fc9('0x10'),JSON[_0x9fc9('0x13')](_0x31037a));if(_0x31037a['error']){if(_0x31037a[_0x9fc9('0x14')]['code']===0x1f4){logger[_0x9fc9('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1893fb,_0x31037a[_0x9fc9('0x14')]['message']);return _0x53296b(_0x31037a[_0x9fc9('0x14')][_0x9fc9('0x15')]);}logger['error'](_0x9fc9('0xf'),_0x1893fb,_0x31037a[_0x9fc9('0x14')][_0x9fc9('0x15')]);return _0x2b69a4(_0x31037a['error']['message']);}else{logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x1893fb,_0x9fc9('0x10'));_0x2b69a4(_0x31037a[_0x9fc9('0x16')]['message']);}})[_0x9fc9('0x17')](function(_0x2fa504){logger[_0x9fc9('0x14')](_0x9fc9('0xf'),_0x1893fb,_0x2fa504);_0x53296b(_0x2fa504);});});} \ No newline at end of file +var _0x396c=['request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x329e57,_0x465bb7){var _0x5f4579=function(_0x499046){while(--_0x499046){_0x329e57['push'](_0x329e57['shift']());}};_0x5f4579(++_0x465bb7);}(_0x396c,0xfc));var _0xc396=function(_0x7becdb,_0x369b47){_0x7becdb=_0x7becdb-0x0;var _0x53be28=_0x396c[_0x7becdb];return _0x53be28;};'use strict';var _=require('lodash');var util=require(_0xc396('0x0'));var moment=require(_0xc396('0x1'));var BPromise=require(_0xc396('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc396('0x3'));var db=require(_0xc396('0x4'))['db'];var utils=require(_0xc396('0x5'));var logger=require(_0xc396('0x6'))(_0xc396('0x7'));var config=require(_0xc396('0x8'));var jayson=require(_0xc396('0x9'));var client=jayson[_0xc396('0xa')][_0xc396('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3ab6,_0x5a587b,_0x3c11c6){return new BPromise(function(_0xc05544,_0x3623cb){return client[_0xc396('0xc')](_0x4f3ab6,_0x3c11c6)[_0xc396('0xd')](function(_0x55ae8c){logger[_0xc396('0xe')](_0xc396('0xf'),_0x5a587b,_0xc396('0x10'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5a587b,_0xc396('0x10'),JSON[_0xc396('0x11')](_0x55ae8c));if(_0x55ae8c[_0xc396('0x12')]){if(_0x55ae8c[_0xc396('0x12')][_0xc396('0x13')]===0x1f4){logger[_0xc396('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5a587b,_0x55ae8c[_0xc396('0x12')][_0xc396('0x14')]);return _0x3623cb(_0x55ae8c[_0xc396('0x12')][_0xc396('0x14')]);}logger['error'](_0xc396('0xf'),_0x5a587b,_0x55ae8c[_0xc396('0x12')]['message']);return _0xc05544(_0x55ae8c['error'][_0xc396('0x14')]);}else{logger['info'](_0xc396('0xf'),_0x5a587b,'request\x20sent');_0xc05544(_0x55ae8c[_0xc396('0x15')][_0xc396('0x14')]);}})['catch'](function(_0x436068){logger[_0xc396('0x12')](_0xc396('0xf'),_0x5a587b,_0x436068);_0x3623cb(_0x436068);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b655282..fb4d354 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 _0x032a=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','put','/:id','update'];(function(_0x272b07,_0x48c104){var _0xcca884=function(_0x3ee3ba){while(--_0x3ee3ba){_0x272b07['push'](_0x272b07['shift']());}};_0xcca884(++_0x48c104);}(_0x032a,0xf0));var _0xa032=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x032a[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require('multer');var util=require(_0xa032('0x0'));var path=require('path');var timeout=require(_0xa032('0x1'));var express=require(_0xa032('0x2'));var router=express[_0xa032('0x3')]();var fs_extra=require(_0xa032('0x4'));var auth=require(_0xa032('0x5'));var interaction=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var controller=require(_0xa032('0x8'));router[_0xa032('0x9')]('/',auth[_0xa032('0xa')](),controller[_0xa032('0xb')]);router[_0xa032('0x9')]('/:id',auth[_0xa032('0xa')](),controller['show']);router['post']('/',auth[_0xa032('0xa')](),controller['create']);router[_0xa032('0xc')](_0xa032('0xd'),auth[_0xa032('0xa')](),controller[_0xa032('0xe')]);router[_0xa032('0xf')]('/:id',auth[_0xa032('0xa')](),controller[_0xa032('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd73a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0xd73a,0x171));var _0xad73=function(_0x2c73de,_0x5d48e1){_0x2c73de=_0x2c73de-0x0;var _0x24e253=_0xd73a[_0x2c73de];return _0x24e253;};'use strict';var multer=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var path=require(_0xad73('0x2'));var timeout=require(_0xad73('0x3'));var express=require(_0xad73('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad73('0x5'));var interaction=require(_0xad73('0x6'));var config=require(_0xad73('0x7'));var controller=require(_0xad73('0x8'));router[_0xad73('0x9')]('/',auth[_0xad73('0xa')](),controller[_0xad73('0xb')]);router[_0xad73('0x9')](_0xad73('0xc'),auth[_0xad73('0xa')](),controller[_0xad73('0xd')]);router['post']('/',auth[_0xad73('0xa')](),controller['create']);router[_0xad73('0xe')](_0xad73('0xc'),auth[_0xad73('0xa')](),controller['update']);router[_0xad73('0xf')]('/:id',auth[_0xad73('0xa')](),controller['destroy']);module[_0xad73('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 ef3451f..a100816 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 _0x255c=['STRING','sequelize','name'];(function(_0x553579,_0x269bd9){var _0x156ea3=function(_0x3bd6bb){while(--_0x3bd6bb){_0x553579['push'](_0x553579['shift']());}};_0x156ea3(++_0x269bd9);}(_0x255c,0x1bd));var _0xc255=function(_0xc817a7,_0x235e01){_0xc817a7=_0xc817a7-0x0;var _0x5c8426=_0x255c[_0xc817a7];return _0x5c8426;};'use strict';var Sequelize=require(_0xc255('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc255('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc255('0x2')]}}; \ No newline at end of file +var _0xa120=['sequelize','exports','STRING','name'];(function(_0x1eebef,_0x160c1b){var _0x40f085=function(_0x3e9936){while(--_0x3e9936){_0x1eebef['push'](_0x1eebef['shift']());}};_0x40f085(++_0x160c1b);}(_0xa120,0x168));var _0x0a12=function(_0x81c885,_0x43ba66){_0x81c885=_0x81c885-0x0;var _0x3ca69e=_0xa120[_0x81c885];return _0x3ca69e;};'use strict';var Sequelize=require(_0x0a12('0x0'));module[_0x0a12('0x1')]={'name':{'type':Sequelize[_0x0a12('0x2')],'unique':_0x0a12('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0a12('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bc8d105..d834148 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 _0x3c4c=['userProfileId','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1db254,_0xd3194a){var _0x3cf061=function(_0x18d5b0){while(--_0x18d5b0){_0x1db254['push'](_0x1db254['shift']());}};_0x3cf061(++_0xd3194a);}(_0x3c4c,0x146));var _0xc3c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3c4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc3c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3c4('0x1'));var jsonpatch=require(_0xc3c4('0x2'));var rp=require(_0xc3c4('0x3'));var moment=require(_0xc3c4('0x4'));var BPromise=require(_0xc3c4('0x5'));var Mustache=require(_0xc3c4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc3c4('0x7'));var csv=require(_0xc3c4('0x8'));var ejs=require(_0xc3c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3c4('0xa'));var squel=require(_0xc3c4('0xb'));var crypto=require(_0xc3c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc3c4('0xe'));var Papa=require(_0xc3c4('0xf'));var Redis=require(_0xc3c4('0x10'));var authService=require(_0xc3c4('0x11'));var qs=require(_0xc3c4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3c4('0x13'));var logger=require(_0xc3c4('0x14'))('api');var utils=require(_0xc3c4('0x15'));var config=require(_0xc3c4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3c4('0x17'))['db'];function respondWithStatusCode(_0x224b66,_0x50b1cb){_0x50b1cb=_0x50b1cb||0xcc;return function(_0x2493f0){if(_0x2493f0){return _0x224b66[_0xc3c4('0x18')](_0x50b1cb);}return _0x224b66[_0xc3c4('0x19')](_0x50b1cb)['end']();};}function respondWithResult(_0x322af0,_0x11b9e3){_0x11b9e3=_0x11b9e3||0xc8;return function(_0x7455bc){if(_0x7455bc){return _0x322af0[_0xc3c4('0x19')](_0x11b9e3)['json'](_0x7455bc);}};}function respondWithFilteredResult(_0x1e061b,_0x2b0d16){return function(_0x2b7d00){if(_0x2b7d00){var _0x42be08=typeof _0x2b0d16[_0xc3c4('0x1a')]===_0xc3c4('0x1b')&&typeof _0x2b0d16[_0xc3c4('0x1c')]===_0xc3c4('0x1b');var _0x39994a=_0x2b7d00[_0xc3c4('0x1d')];var _0xd2cc73=_0x42be08?0x0:_0x2b0d16['offset'];var _0x129a3b=_0x42be08?_0x2b7d00[_0xc3c4('0x1d')]:_0x2b0d16['offset']+_0x2b0d16[_0xc3c4('0x1c')];var _0x27e222;if(_0x129a3b>=_0x39994a){_0x129a3b=_0x39994a;_0x27e222=0xc8;}else{_0x27e222=0xce;}_0x1e061b['status'](_0x27e222);return _0x1e061b[_0xc3c4('0x1e')](_0xc3c4('0x1f'),_0xd2cc73+'-'+_0x129a3b+'/'+_0x39994a)['json'](_0x2b7d00);}return null;};}function patchUpdates(_0x19839c){return function(_0x424f89){try{jsonpatch[_0xc3c4('0x20')](_0x424f89,_0x19839c,!![]);}catch(_0x2138a7){return BPromise[_0xc3c4('0x21')](_0x2138a7);}return _0x424f89[_0xc3c4('0x22')]();};}function saveUpdates(_0x222c5a,_0x14b14d){return function(_0x261ab3){if(_0x261ab3){return _0x261ab3[_0xc3c4('0x23')](_0x222c5a)['then'](function(_0x1268a5){return _0x1268a5;});}return null;};}function removeEntity(_0x28935f,_0x3dae1f){return function(_0x3cf762){if(_0x3cf762){return _0x3cf762[_0xc3c4('0x24')]()[_0xc3c4('0x25')](function(){var _0x405584=_0x3cf762[_0xc3c4('0x26')]({'plain':!![]});var _0x78e6c6='Variables';return db[_0xc3c4('0x27')][_0xc3c4('0x24')]({'where':{'type':_0x78e6c6,'resourceId':_0x405584['id']}})[_0xc3c4('0x25')](function(){return _0x3cf762;});})[_0xc3c4('0x25')](function(){_0x28935f[_0xc3c4('0x19')](0xcc)[_0xc3c4('0x28')]();});}};}function handleEntityNotFound(_0x3f599e,_0x3ae076){return function(_0x37b621){if(!_0x37b621){_0x3f599e[_0xc3c4('0x18')](0x194);}return _0x37b621;};}function handleError(_0x2fef18,_0x1e16ca){_0x1e16ca=_0x1e16ca||0x1f4;return function(_0x37b5dd){logger[_0xc3c4('0x29')](_0x37b5dd[_0xc3c4('0x2a')]);if(_0x37b5dd['name']){delete _0x37b5dd[_0xc3c4('0x2b')];}_0x2fef18['status'](_0x1e16ca)[_0xc3c4('0x2c')](_0x37b5dd);};}exports[_0xc3c4('0x2d')]=function(_0x348ca4,_0x4015e0){var _0x33f63e={},_0x10c62f={},_0x4225cd={'count':0x0,'rows':[]};var _0x524492=_[_0xc3c4('0x2e')](db['Variable']['rawAttributes'],function(_0x40296c){return{'name':_0x40296c[_0xc3c4('0x2f')],'type':_0x40296c[_0xc3c4('0x30')][_0xc3c4('0x31')]};});_0x10c62f[_0xc3c4('0x32')]=_['map'](_0x524492,_0xc3c4('0x2b'));_0x10c62f['query']=_['keys'](_0x348ca4['query']);_0x10c62f['filters']=_[_0xc3c4('0x33')](_0x10c62f['model'],_0x10c62f[_0xc3c4('0x34')]);_0x33f63e['attributes']=_['intersection'](_0x10c62f[_0xc3c4('0x32')],qs[_0xc3c4('0x35')](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x35')]));_0x33f63e['attributes']=_0x33f63e[_0xc3c4('0x36')][_0xc3c4('0x37')]?_0x33f63e[_0xc3c4('0x36')]:_0x10c62f['model'];if(!_0x348ca4['query'][_0xc3c4('0x38')]('nolimit')){_0x33f63e[_0xc3c4('0x1c')]=qs[_0xc3c4('0x1c')](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x1c')]);_0x33f63e[_0xc3c4('0x1a')]=qs['offset'](_0x348ca4[_0xc3c4('0x34')]['offset']);}_0x33f63e['order']=qs['sort'](_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x39')]);_0x33f63e[_0xc3c4('0x3a')]=qs[_0xc3c4('0x3b')](_[_0xc3c4('0x3c')](_0x348ca4[_0xc3c4('0x34')],_0x10c62f[_0xc3c4('0x3b')]),_0x524492);if(_0x348ca4['query'][_0xc3c4('0x3d')]){_0x33f63e[_0xc3c4('0x3a')]=_[_0xc3c4('0x3e')](_0x33f63e[_0xc3c4('0x3a')],{'$or':_[_0xc3c4('0x2e')](_0x524492,function(_0x539e30){if(_0x539e30[_0xc3c4('0x30')]!==_0xc3c4('0x3f')){var _0x1e2dce={};_0x1e2dce[_0x539e30['name']]={'$like':'%'+_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x3d')]+'%'};return _0x1e2dce;}})});}_0x33f63e=_[_0xc3c4('0x3e')]({},_0x33f63e,_0x348ca4[_0xc3c4('0x40')]);var _0x2f99f7={'where':_0x33f63e[_0xc3c4('0x3a')]};return db[_0xc3c4('0x41')][_0xc3c4('0x1d')](_0x2f99f7)['then'](function(_0x289646){_0x4225cd['count']=_0x289646;if(_0x348ca4[_0xc3c4('0x34')][_0xc3c4('0x42')]){_0x33f63e[_0xc3c4('0x43')]=[{'all':!![]}];}return db[_0xc3c4('0x41')][_0xc3c4('0x44')](_0x33f63e);})[_0xc3c4('0x25')](function(_0x12e127){_0x4225cd['rows']=_0x12e127;return _0x4225cd;})[_0xc3c4('0x25')](respondWithFilteredResult(_0x4015e0,_0x33f63e))[_0xc3c4('0x45')](handleError(_0x4015e0,null));};exports[_0xc3c4('0x46')]=function(_0x5c0476,_0x103134){var _0x2e3320={'raw':!![],'where':{'id':_0x5c0476['params']['id']}},_0x21fe04={};_0x21fe04[_0xc3c4('0x32')]=_[_0xc3c4('0x47')](db['Variable'][_0xc3c4('0x48')]);_0x21fe04['query']=_[_0xc3c4('0x47')](_0x5c0476[_0xc3c4('0x34')]);_0x21fe04[_0xc3c4('0x3b')]=_[_0xc3c4('0x33')](_0x21fe04[_0xc3c4('0x32')],_0x21fe04['query']);_0x2e3320['attributes']=_[_0xc3c4('0x33')](_0x21fe04['model'],qs[_0xc3c4('0x35')](_0x5c0476[_0xc3c4('0x34')]['fields']));_0x2e3320[_0xc3c4('0x36')]=_0x2e3320[_0xc3c4('0x36')][_0xc3c4('0x37')]?_0x2e3320[_0xc3c4('0x36')]:_0x21fe04[_0xc3c4('0x32')];if(_0x5c0476[_0xc3c4('0x34')][_0xc3c4('0x42')]){_0x2e3320[_0xc3c4('0x43')]=[{'all':!![]}];}_0x2e3320=_[_0xc3c4('0x3e')]({},_0x2e3320,_0x5c0476[_0xc3c4('0x40')]);return db[_0xc3c4('0x41')][_0xc3c4('0x49')](_0x2e3320)['then'](handleEntityNotFound(_0x103134,null))['then'](respondWithResult(_0x103134,null))[_0xc3c4('0x45')](handleError(_0x103134,null));};exports[_0xc3c4('0x4a')]=function(_0x50b113,_0x5b0255){return db[_0xc3c4('0x41')][_0xc3c4('0x4a')](_0x50b113[_0xc3c4('0x4b')],{})[_0xc3c4('0x25')](function(_0x12f4d1){var _0x485518=_0x50b113[_0xc3c4('0x4c')][_0xc3c4('0x26')]({'plain':!![]});if(!_0x485518)throw new Error(_0xc3c4('0x4d'));if(_0x485518[_0xc3c4('0x4e')]==='user'){var _0xb14697=_0x12f4d1[_0xc3c4('0x26')]({'plain':!![]});var _0x2a49ef='Variables';return db['UserProfileSection'][_0xc3c4('0x49')]({'where':{'name':_0x2a49ef,'userProfileId':_0x485518[_0xc3c4('0x4f')]},'raw':!![]})['then'](function(_0x14a433){if(_0x14a433&&_0x14a433['autoAssociation']===0x0){return db[_0xc3c4('0x27')]['create']({'name':_0xb14697['name'],'resourceId':_0xb14697['id'],'type':_0x14a433[_0xc3c4('0x2b')],'sectionId':_0x14a433['id']},{})['then'](function(){return _0x12f4d1;});}else{return _0x12f4d1;}})[_0xc3c4('0x45')](function(_0x354281){logger[_0xc3c4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x354281);throw _0x354281;});}return _0x12f4d1;})[_0xc3c4('0x25')](respondWithResult(_0x5b0255,0xc9))[_0xc3c4('0x45')](handleError(_0x5b0255,null));};exports[_0xc3c4('0x23')]=function(_0x4a3d85,_0x435065){if(_0x4a3d85[_0xc3c4('0x4b')]['id']){delete _0x4a3d85[_0xc3c4('0x4b')]['id'];}return db[_0xc3c4('0x41')]['find']({'where':{'id':_0x4a3d85[_0xc3c4('0x50')]['id']}})[_0xc3c4('0x25')](handleEntityNotFound(_0x435065,null))[_0xc3c4('0x25')](saveUpdates(_0x4a3d85[_0xc3c4('0x4b')],null))['then'](respondWithResult(_0x435065,null))[_0xc3c4('0x45')](handleError(_0x435065,null));};exports[_0xc3c4('0x24')]=function(_0x4d332b,_0x5261fd){return db[_0xc3c4('0x41')][_0xc3c4('0x49')]({'where':{'id':_0x4d332b['params']['id']}})[_0xc3c4('0x25')](handleEntityNotFound(_0x5261fd,null))[_0xc3c4('0x25')](removeEntity(_0x5261fd,null))[_0xc3c4('0x45')](handleError(_0x5261fd,null));}; \ No newline at end of file +var _0xf7a3=['Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','Variables','UserProfileResource','stack','name','send','map'];(function(_0x3842e2,_0xe44a33){var _0x3e0fef=function(_0x34a85c){while(--_0x34a85c){_0x3842e2['push'](_0x3842e2['shift']());}};_0x3e0fef(++_0xe44a33);}(_0xf7a3,0x16d));var _0x3f7a=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xf7a3[_0xb8cfbe];return _0x227d51;};'use strict';var emlformat=require(_0x3f7a('0x0'));var rimraf=require(_0x3f7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f7a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f7a('0x3'));var Mustache=require(_0x3f7a('0x4'));var util=require(_0x3f7a('0x5'));var path=require(_0x3f7a('0x6'));var sox=require(_0x3f7a('0x7'));var csv=require('to-csv');var ejs=require(_0x3f7a('0x8'));var fs=require('fs');var fs_extra=require(_0x3f7a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f7a('0xa'));var jsforce=require(_0x3f7a('0xb'));var deskjs=require(_0x3f7a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f7a('0xd'));var Papa=require('papaparse');var Redis=require(_0x3f7a('0xe'));var authService=require(_0x3f7a('0xf'));var qs=require(_0x3f7a('0x10'));var as=require(_0x3f7a('0x11'));var hardwareService=require(_0x3f7a('0x12'));var logger=require(_0x3f7a('0x13'))(_0x3f7a('0x14'));var utils=require(_0x3f7a('0x15'));var config=require(_0x3f7a('0x16'));var licenseUtil=require(_0x3f7a('0x17'));var db=require(_0x3f7a('0x18'))['db'];function respondWithStatusCode(_0x1d975e,_0x953db6){_0x953db6=_0x953db6||0xcc;return function(_0x177c9a){if(_0x177c9a){return _0x1d975e[_0x3f7a('0x19')](_0x953db6);}return _0x1d975e[_0x3f7a('0x1a')](_0x953db6)[_0x3f7a('0x1b')]();};}function respondWithResult(_0x596ab8,_0x35c50b){_0x35c50b=_0x35c50b||0xc8;return function(_0xfb6369){if(_0xfb6369){return _0x596ab8['status'](_0x35c50b)[_0x3f7a('0x1c')](_0xfb6369);}};}function respondWithFilteredResult(_0x23b6dc,_0x36ecf7){return function(_0x450c28){if(_0x450c28){var _0x50197e=typeof _0x36ecf7[_0x3f7a('0x1d')]==='undefined'&&typeof _0x36ecf7[_0x3f7a('0x1e')]===_0x3f7a('0x1f');var _0x44a8c3=_0x450c28[_0x3f7a('0x20')];var _0x39cb2f=_0x50197e?0x0:_0x36ecf7['offset'];var _0xe3e2cd=_0x50197e?_0x450c28[_0x3f7a('0x20')]:_0x36ecf7[_0x3f7a('0x1d')]+_0x36ecf7['limit'];var _0x2d8509;if(_0xe3e2cd>=_0x44a8c3){_0xe3e2cd=_0x44a8c3;_0x2d8509=0xc8;}else{_0x2d8509=0xce;}_0x23b6dc[_0x3f7a('0x1a')](_0x2d8509);return _0x23b6dc['set'](_0x3f7a('0x21'),_0x39cb2f+'-'+_0xe3e2cd+'/'+_0x44a8c3)[_0x3f7a('0x1c')](_0x450c28);}return null;};}function patchUpdates(_0x3d1454){return function(_0x571a22){try{jsonpatch[_0x3f7a('0x22')](_0x571a22,_0x3d1454,!![]);}catch(_0x27c05a){return BPromise[_0x3f7a('0x23')](_0x27c05a);}return _0x571a22[_0x3f7a('0x24')]();};}function saveUpdates(_0x4e8ec6,_0x49c6d){return function(_0x553530){if(_0x553530){return _0x553530['update'](_0x4e8ec6)[_0x3f7a('0x25')](function(_0x5464f9){return _0x5464f9;});}return null;};}function removeEntity(_0x2160d1,_0x22a5f1){return function(_0x144616){if(_0x144616){return _0x144616[_0x3f7a('0x26')]()['then'](function(){var _0x339657=_0x144616['get']({'plain':!![]});var _0x5e809d=_0x3f7a('0x27');return db[_0x3f7a('0x28')][_0x3f7a('0x26')]({'where':{'type':_0x5e809d,'resourceId':_0x339657['id']}})[_0x3f7a('0x25')](function(){return _0x144616;});})['then'](function(){_0x2160d1[_0x3f7a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc6c71,_0x258715){return function(_0x1cae77){if(!_0x1cae77){_0xdc6c71['sendStatus'](0x194);}return _0x1cae77;};}function handleError(_0x1765b4,_0x55eae5){_0x55eae5=_0x55eae5||0x1f4;return function(_0x3c06e2){logger['error'](_0x3c06e2[_0x3f7a('0x29')]);if(_0x3c06e2['name']){delete _0x3c06e2[_0x3f7a('0x2a')];}_0x1765b4[_0x3f7a('0x1a')](_0x55eae5)[_0x3f7a('0x2b')](_0x3c06e2);};}exports['index']=function(_0x46030c,_0x3113df){var _0x291d96={},_0x35de6e={},_0x125511={'count':0x0,'rows':[]};var _0x5398eb=_[_0x3f7a('0x2c')](db[_0x3f7a('0x2d')][_0x3f7a('0x2e')],function(_0x268ec6){return{'name':_0x268ec6[_0x3f7a('0x2f')],'type':_0x268ec6[_0x3f7a('0x30')][_0x3f7a('0x31')]};});_0x35de6e[_0x3f7a('0x32')]=_['map'](_0x5398eb,_0x3f7a('0x2a'));_0x35de6e['query']=_[_0x3f7a('0x33')](_0x46030c[_0x3f7a('0x34')]);_0x35de6e[_0x3f7a('0x35')]=_[_0x3f7a('0x36')](_0x35de6e[_0x3f7a('0x32')],_0x35de6e[_0x3f7a('0x34')]);_0x291d96[_0x3f7a('0x37')]=_[_0x3f7a('0x36')](_0x35de6e[_0x3f7a('0x32')],qs[_0x3f7a('0x38')](_0x46030c[_0x3f7a('0x34')][_0x3f7a('0x38')]));_0x291d96[_0x3f7a('0x37')]=_0x291d96[_0x3f7a('0x37')]['length']?_0x291d96['attributes']:_0x35de6e['model'];if(!_0x46030c[_0x3f7a('0x34')]['hasOwnProperty'](_0x3f7a('0x39'))){_0x291d96['limit']=qs[_0x3f7a('0x1e')](_0x46030c['query'][_0x3f7a('0x1e')]);_0x291d96[_0x3f7a('0x1d')]=qs[_0x3f7a('0x1d')](_0x46030c['query']['offset']);}_0x291d96[_0x3f7a('0x3a')]=qs['sort'](_0x46030c[_0x3f7a('0x34')]['sort']);_0x291d96['where']=qs[_0x3f7a('0x35')](_[_0x3f7a('0x3b')](_0x46030c[_0x3f7a('0x34')],_0x35de6e[_0x3f7a('0x35')]),_0x5398eb);if(_0x46030c[_0x3f7a('0x34')][_0x3f7a('0x3c')]){_0x291d96[_0x3f7a('0x3d')]=_['merge'](_0x291d96[_0x3f7a('0x3d')],{'$or':_[_0x3f7a('0x2c')](_0x5398eb,function(_0x33f701){if(_0x33f701[_0x3f7a('0x30')]!==_0x3f7a('0x3e')){var _0x393cdf={};_0x393cdf[_0x33f701[_0x3f7a('0x2a')]]={'$like':'%'+_0x46030c[_0x3f7a('0x34')]['filter']+'%'};return _0x393cdf;}})});}_0x291d96=_['merge']({},_0x291d96,_0x46030c['options']);var _0x3fffc4={'where':_0x291d96[_0x3f7a('0x3d')]};return db[_0x3f7a('0x2d')]['count'](_0x3fffc4)[_0x3f7a('0x25')](function(_0x13e253){_0x125511[_0x3f7a('0x20')]=_0x13e253;if(_0x46030c['query']['includeAll']){_0x291d96[_0x3f7a('0x3f')]=[{'all':!![]}];}return db[_0x3f7a('0x2d')][_0x3f7a('0x40')](_0x291d96);})[_0x3f7a('0x25')](function(_0x341a54){_0x125511[_0x3f7a('0x41')]=_0x341a54;return _0x125511;})[_0x3f7a('0x25')](respondWithFilteredResult(_0x3113df,_0x291d96))[_0x3f7a('0x42')](handleError(_0x3113df,null));};exports[_0x3f7a('0x43')]=function(_0x1fcd26,_0x3f8d8b){var _0x5336c7={'raw':!![],'where':{'id':_0x1fcd26[_0x3f7a('0x44')]['id']}},_0x587e4f={};_0x587e4f[_0x3f7a('0x32')]=_[_0x3f7a('0x33')](db[_0x3f7a('0x2d')]['rawAttributes']);_0x587e4f[_0x3f7a('0x34')]=_[_0x3f7a('0x33')](_0x1fcd26[_0x3f7a('0x34')]);_0x587e4f[_0x3f7a('0x35')]=_[_0x3f7a('0x36')](_0x587e4f[_0x3f7a('0x32')],_0x587e4f[_0x3f7a('0x34')]);_0x5336c7[_0x3f7a('0x37')]=_[_0x3f7a('0x36')](_0x587e4f[_0x3f7a('0x32')],qs[_0x3f7a('0x38')](_0x1fcd26[_0x3f7a('0x34')][_0x3f7a('0x38')]));_0x5336c7[_0x3f7a('0x37')]=_0x5336c7[_0x3f7a('0x37')][_0x3f7a('0x45')]?_0x5336c7[_0x3f7a('0x37')]:_0x587e4f[_0x3f7a('0x32')];if(_0x1fcd26['query'][_0x3f7a('0x46')]){_0x5336c7['include']=[{'all':!![]}];}_0x5336c7=_['merge']({},_0x5336c7,_0x1fcd26[_0x3f7a('0x47')]);return db[_0x3f7a('0x2d')]['find'](_0x5336c7)['then'](handleEntityNotFound(_0x3f8d8b,null))['then'](respondWithResult(_0x3f8d8b,null))[_0x3f7a('0x42')](handleError(_0x3f8d8b,null));};exports[_0x3f7a('0x48')]=function(_0x33226c,_0x17d475){return db[_0x3f7a('0x2d')]['create'](_0x33226c['body'],{})[_0x3f7a('0x25')](function(_0x209366){var _0x1973e0=_0x33226c['user'][_0x3f7a('0x49')]({'plain':!![]});if(!_0x1973e0)throw new Error(_0x3f7a('0x4a'));if(_0x1973e0[_0x3f7a('0x4b')]===_0x3f7a('0x4c')){var _0xbd844c=_0x209366['get']({'plain':!![]});var _0x57ca2f=_0x3f7a('0x27');return db['UserProfileSection'][_0x3f7a('0x4d')]({'where':{'name':_0x57ca2f,'userProfileId':_0x1973e0['userProfileId']},'raw':!![]})[_0x3f7a('0x25')](function(_0x3dc5db){if(_0x3dc5db&&_0x3dc5db[_0x3f7a('0x4e')]===0x0){return db[_0x3f7a('0x28')][_0x3f7a('0x48')]({'name':_0xbd844c['name'],'resourceId':_0xbd844c['id'],'type':_0x3dc5db[_0x3f7a('0x2a')],'sectionId':_0x3dc5db['id']},{})['then'](function(){return _0x209366;});}else{return _0x209366;}})[_0x3f7a('0x42')](function(_0x40fbd8){logger[_0x3f7a('0x4f')](_0x3f7a('0x50'),_0x40fbd8);throw _0x40fbd8;});}return _0x209366;})[_0x3f7a('0x25')](respondWithResult(_0x17d475,0xc9))[_0x3f7a('0x42')](handleError(_0x17d475,null));};exports['update']=function(_0x366903,_0x3fc7d0){if(_0x366903['body']['id']){delete _0x366903[_0x3f7a('0x51')]['id'];}return db[_0x3f7a('0x2d')][_0x3f7a('0x4d')]({'where':{'id':_0x366903[_0x3f7a('0x44')]['id']}})[_0x3f7a('0x25')](handleEntityNotFound(_0x3fc7d0,null))['then'](saveUpdates(_0x366903[_0x3f7a('0x51')],null))[_0x3f7a('0x25')](respondWithResult(_0x3fc7d0,null))[_0x3f7a('0x42')](handleError(_0x3fc7d0,null));};exports[_0x3f7a('0x26')]=function(_0x2f7506,_0xbc3955){return db[_0x3f7a('0x2d')][_0x3f7a('0x4d')]({'where':{'id':_0x2f7506[_0x3f7a('0x44')]['id']}})['then'](handleEntityNotFound(_0xbc3955,null))[_0x3f7a('0x25')](removeEntity(_0xbc3955,null))[_0x3f7a('0x42')](handleError(_0xbc3955,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dfcfaf8..584478c 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 _0xd358=['util','../../config/logger','api','moment','bluebird','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x526da2,_0x54996e){var _0x11390c=function(_0x21f3d1){while(--_0x21f3d1){_0x526da2['push'](_0x526da2['shift']());}};_0x11390c(++_0x54996e);}(_0xd358,0x1eb));var _0x8d35=function(_0x4069b3,_0x1ffd97){_0x4069b3=_0x4069b3-0x0;var _0x4fec1e=_0xd358[_0x4069b3];return _0x4fec1e;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var logger=require(_0x8d35('0x2'))(_0x8d35('0x3'));var moment=require(_0x8d35('0x4'));var BPromise=require(_0x8d35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d35('0x6'));var config=require('../../config/environment');var attributes=require(_0x8d35('0x7'));module[_0x8d35('0x8')]=function(_0xdeb097,_0x366997){return _0xdeb097[_0x8d35('0x9')](_0x8d35('0xa'),attributes,{'tableName':_0x8d35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x872b=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','path','../../config/environment','./variable.attributes'];(function(_0x267f04,_0x18005d){var _0x324621=function(_0x3ef6a9){while(--_0x3ef6a9){_0x267f04['push'](_0x267f04['shift']());}};_0x324621(++_0x18005d);}(_0x872b,0x16c));var _0xb872=function(_0x1e91e4,_0xc69763){_0x1e91e4=_0x1e91e4-0x0;var _0x47cfe6=_0x872b[_0x1e91e4];return _0x47cfe6;};'use strict';var _=require(_0xb872('0x0'));var util=require(_0xb872('0x1'));var logger=require(_0xb872('0x2'))(_0xb872('0x3'));var moment=require(_0xb872('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb872('0x5'));var rimraf=require('rimraf');var config=require(_0xb872('0x6'));var attributes=require(_0xb872('0x7'));module[_0xb872('0x8')]=function(_0x430a78,_0x1e84d9){return _0x430a78[_0xb872('0x9')](_0xb872('0xa'),attributes,{'tableName':_0xb872('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 ce1b6fe..8f4a3e9 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x644f39,_0x29de5a){var _0x153f00=function(_0x5505ef){while(--_0x5505ef){_0x644f39['push'](_0x644f39['shift']());}};_0x153f00(++_0x29de5a);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x1278c4,_0x5c2d2d){var _0x365887=function(_0x316fc4){while(--_0x316fc4){_0x1278c4['push'](_0x1278c4['shift']());}};_0x365887(++_0x5c2d2d);}(_0x55ca,0x126));var _0xa55c=function(_0xe56790,_0x5f304d){_0xe56790=_0xe56790-0x0;var _0x145cf7=_0x55ca[_0xe56790];return _0x145cf7;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 9f9a178..9eecebf 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 _0xb11d=['migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','/reset','reset','/pull','canUpdate','/restart','restart'];(function(_0x305542,_0x4b921a){var _0x413821=function(_0x4c1204){while(--_0x4c1204){_0x305542['push'](_0x305542['shift']());}};_0x413821(++_0x4b921a);}(_0xb11d,0x179));var _0xdb11=function(_0x4c465a,_0x59403a){_0x4c465a=_0x4c465a-0x0;var _0x5223cb=_0xb11d[_0x4c465a];return _0x5223cb;};'use strict';var express=require(_0xdb11('0x0'));var router=express[_0xdb11('0x1')]();var auth=require(_0xdb11('0x2'));var controller=require(_0xdb11('0x3'));router[_0xdb11('0x4')]('/',controller['index']);router[_0xdb11('0x4')](_0xdb11('0x5'),auth[_0xdb11('0x6')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xdb11('0x7'),auth[_0xdb11('0x6')](),auth['canUpdate'](),controller[_0xdb11('0x8')]);router[_0xdb11('0x4')](_0xdb11('0x9'),auth['isAuthenticated'](),auth[_0xdb11('0xa')](),controller['pull']);router[_0xdb11('0x4')](_0xdb11('0xb'),auth['isAuthenticated'](),controller[_0xdb11('0xc')]);router[_0xdb11('0x4')]('/migrations',controller[_0xdb11('0xd')]);module[_0xdb11('0xe')]=router; \ No newline at end of file +var _0x143b=['../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router'];(function(_0xb949a9,_0x2f948a){var _0x31932b=function(_0x1e7414){while(--_0x1e7414){_0xb949a9['push'](_0xb949a9['shift']());}};_0x31932b(++_0x2f948a);}(_0x143b,0x196));var _0xb143=function(_0xdf5ec7,_0x467ae0){_0xdf5ec7=_0xdf5ec7-0x0;var _0x56ae65=_0x143b[_0xdf5ec7];return _0x56ae65;};'use strict';var express=require(_0xb143('0x0'));var router=express[_0xb143('0x1')]();var auth=require(_0xb143('0x2'));var controller=require(_0xb143('0x3'));router[_0xb143('0x4')]('/',controller[_0xb143('0x5')]);router['get'](_0xb143('0x6'),auth[_0xb143('0x7')](),auth['canUpdate'](),controller[_0xb143('0x8')]);router[_0xb143('0x4')]('/reset',auth[_0xb143('0x7')](),auth[_0xb143('0x9')](),controller[_0xb143('0xa')]);router[_0xb143('0x4')](_0xb143('0xb'),auth['isAuthenticated'](),auth[_0xb143('0x9')](),controller[_0xb143('0xc')]);router['get']('/restart',auth[_0xb143('0x7')](),controller[_0xb143('0xd')]);router['get'](_0xb143('0xe'),controller[_0xb143('0xf')]);module[_0xb143('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d5db7b2..6498136 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 _0x48ab=['readdirSync','server','length','.js','exports','push','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','tags','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x336abc,_0x176943){var _0xfb2174=function(_0x50e553){while(--_0x50e553){_0x336abc['push'](_0x336abc['shift']());}};_0xfb2174(++_0x176943);}(_0x48ab,0x1db));var _0xb48a=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x48ab[_0x3ff085];return _0x2b68c3;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xb48a('0x0'));var pkginfo=require(_0xb48a('0x1'))(module,_0xb48a('0x2'));var compareVersions=require('compare-versions');var exec=require(_0xb48a('0x3'))[_0xb48a('0x4')];var db=require(_0xb48a('0x5'))['db'];var config=require(_0xb48a('0x6'));var pm2=require(_0xb48a('0x7'));var logger=require(_0xb48a('0x8'))(_0xb48a('0x9'));var git=require('simple-git')(config[_0xb48a('0xa')]);exports[_0xb48a('0xb')]=function(_0x2594e1,_0x4a8cd5){var _0x395403={'current':module['exports'][_0xb48a('0x2')],'phonebar':0x2};if(_0x2594e1[_0xb48a('0xc')]&&_0x2594e1[_0xb48a('0xc')][_0xb48a('0xd')]){return git['fetch']()[_0xb48a('0xe')](function(_0x3e0749,_0xd0d44d){_0x395403[_0xb48a('0xd')]=(_0x3e0749?module['exports'][_0xb48a('0x2')]:_0xd0d44d['latest'])||'2.0.0';return _0x4a8cd5[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')](_0x395403);});}else{return _0x4a8cd5[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')](_0x395403);}};exports[_0xb48a('0x11')]=function(_0xf1c629,_0x3142a8){return git[_0xb48a('0x11')]([_0xb48a('0x12'),_0xb48a('0x13')],function(_0x2c6abe){if(_0x2c6abe){logger[_0xb48a('0x14')](_0x2c6abe);return _0x3142a8[_0xb48a('0xf')](0x1f4)['json'](_0x2c6abe);}logger[_0xb48a('0x15')](_0xb48a('0x16'));return _0x3142a8[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x17')});});};exports[_0xb48a('0x18')]=function(_0x3521c8,_0x1e20c3){return git[_0xb48a('0x18')](['--hard',_0xb48a('0x19')],function(_0x107b11){if(_0x107b11){logger[_0xb48a('0x14')](_0x107b11);return _0x1e20c3[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x107b11);}logger[_0xb48a('0x15')](_0xb48a('0x1a'));return _0x1e20c3[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x1b')});});};exports[_0xb48a('0x1c')]=function(_0x52ce8a,_0xf40c57){exec(_0xb48a('0x1d'),function(_0xde97d0,_0x43797e,_0x28caf7){logger[_0xb48a('0x15')](_0x43797e);logger[_0xb48a('0x15')](_0x28caf7);if(_0xde97d0){logger[_0xb48a('0x14')](_0xde97d0);return _0xf40c57[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0xde97d0);}return _0xf40c57[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0x43797e});});};exports[_0xb48a('0x1e')]=function(_0x503d5e,_0x213682){return pm2[_0xb48a('0x1e')](_0xb48a('0x1f'))[_0xb48a('0x20')](function(_0x309d56){logger[_0xb48a('0x15')](_0xb48a('0x21'),_0x309d56);return _0x213682[_0xb48a('0xf')](0xc8)['json']({'output':_0xb48a('0x22')});})['catch'](function(_0x3c5325){logger['error'](_0x3c5325);return _0x213682[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x3c5325);});};exports['migrations']=function(_0x293817,_0x3045b7){var _0x4e3c57=fs[_0xb48a('0x23')](path['join'](config['root'],_0xb48a('0x24'),'migrations'));var _0x2c72c7=[];for(var _0x114261=0x0;_0x114261<_0x4e3c57[_0xb48a('0x25')];_0x114261++){var _0x116601=_0x4e3c57[_0x114261]['replace'](_0xb48a('0x26'),'');if(compareVersions(module[_0xb48a('0x27')]['version'],_0x116601)===-0x1){_0x2c72c7[_0xb48a('0x28')](_0x116601);}}if(_0x2c72c7[_0xb48a('0x25')]){var _0x4b8813=_0x2c72c7[_0xb48a('0x29')](compareVersions);var _0x33ee6d=new Umzug({'storage':_0xb48a('0x2a'),'storageOptions':{'model':db[_0xb48a('0x2b')],'modelName':_0xb48a('0x2b'),'columnName':_0xb48a('0x2')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0xb48a('0x2a')]['constructor'],function(){throw new Error(_0xb48a('0x2c'));}],'path':path['join'](config['root'],_0xb48a('0x24'),_0xb48a('0x2d')),'pattern':/\.js$/}});_0x33ee6d['up']({'migrations':_[_0xb48a('0x2e')](_0x4b8813,function(_0x4bdb9a){return _0x4bdb9a+_0xb48a('0x26');})})['then'](function(){return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xb48a('0x2')]+'\x20to\x20'+_[_0xb48a('0x2f')](_0x4b8813),'migrations':_[_0xb48a('0x30')](_0x4b8813)});})['catch'](function(_0x4481c1){if(_0x4481c1 instanceof db[_0xb48a('0x2a')][_0xb48a('0x31')]){return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x32')});}else{return _0x3045b7[_0xb48a('0xf')](0x1f4)[_0xb48a('0x10')](_0x4481c1);}});}else{return _0x3045b7[_0xb48a('0xf')](0xc8)[_0xb48a('0x10')]({'output':_0xb48a('0x32')});}}; \ No newline at end of file +var _0xfaf3=['origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','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.','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json'];(function(_0x252b15,_0x2a818d){var _0x32907d=function(_0x5b9ffb){while(--_0x5b9ffb){_0x252b15['push'](_0x252b15['shift']());}};_0x32907d(++_0x2a818d);}(_0xfaf3,0x11e));var _0x3faf=function(_0x2f34f6,_0x35e15c){_0x2f34f6=_0x2f34f6-0x0;var _0x10ac55=_0xfaf3[_0x2f34f6];return _0x10ac55;};'use strict';var Umzug=require(_0x3faf('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x3faf('0x1'));var pkginfo=require(_0x3faf('0x2'))(module,_0x3faf('0x3'));var compareVersions=require(_0x3faf('0x4'));var exec=require(_0x3faf('0x5'))[_0x3faf('0x6')];var db=require(_0x3faf('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x3faf('0x8'));var git=require(_0x3faf('0x9'))(config[_0x3faf('0xa')]);exports[_0x3faf('0xb')]=function(_0x27ecc6,_0x755e2f){var _0x18e0cc={'current':module[_0x3faf('0xc')][_0x3faf('0x3')],'phonebar':0x2};if(_0x27ecc6[_0x3faf('0xd')]&&_0x27ecc6['query']['latest']){return git[_0x3faf('0xe')]()[_0x3faf('0xf')](function(_0x16582e,_0x3fa0b2){_0x18e0cc['latest']=(_0x16582e?module[_0x3faf('0xc')]['version']:_0x3fa0b2[_0x3faf('0x10')])||_0x3faf('0x11');return _0x755e2f[_0x3faf('0x12')](0xc8)[_0x3faf('0x13')](_0x18e0cc);});}else{return _0x755e2f[_0x3faf('0x12')](0xc8)['json'](_0x18e0cc);}};exports[_0x3faf('0xe')]=function(_0x1349eb,_0x608470){return git['fetch']([_0x3faf('0x14'),'master'],function(_0x42db10){if(_0x42db10){logger[_0x3faf('0x15')](_0x42db10);return _0x608470[_0x3faf('0x12')](0x1f4)['json'](_0x42db10);}logger[_0x3faf('0x16')](_0x3faf('0x17'));return _0x608470[_0x3faf('0x12')](0xc8)[_0x3faf('0x13')]({'output':_0x3faf('0x18')});});};exports[_0x3faf('0x19')]=function(_0x2a5dd1,_0x191321){return git['reset']([_0x3faf('0x1a'),'FETCH_HEAD'],function(_0x2b64fe){if(_0x2b64fe){logger[_0x3faf('0x15')](_0x2b64fe);return _0x191321[_0x3faf('0x12')](0x1f4)['json'](_0x2b64fe);}logger[_0x3faf('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x191321[_0x3faf('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x3faf('0x1b')]=function(_0x5df367,_0x20a530){exec(_0x3faf('0x1c'),function(_0x2d5670,_0x37ea22,_0x117a89){logger['info'](_0x37ea22);logger[_0x3faf('0x16')](_0x117a89);if(_0x2d5670){logger[_0x3faf('0x15')](_0x2d5670);return _0x20a530['status'](0x1f4)['json'](_0x2d5670);}return _0x20a530[_0x3faf('0x12')](0xc8)[_0x3faf('0x13')]({'output':_0x37ea22});});};exports['restart']=function(_0x35c17a,_0x5a0590){return pm2[_0x3faf('0x1d')](_0x3faf('0x1e'))[_0x3faf('0x1f')](function(_0x1fdac2){logger[_0x3faf('0x16')](_0x3faf('0x20'),_0x1fdac2);return _0x5a0590['status'](0xc8)['json']({'output':_0x3faf('0x21')});})[_0x3faf('0x22')](function(_0x260fd7){logger[_0x3faf('0x15')](_0x260fd7);return _0x5a0590[_0x3faf('0x12')](0x1f4)[_0x3faf('0x13')](_0x260fd7);});};exports[_0x3faf('0x23')]=function(_0x3348d1,_0x2636b3){var _0x14fd16=fs[_0x3faf('0x24')](path[_0x3faf('0x25')](config[_0x3faf('0xa')],_0x3faf('0x26'),_0x3faf('0x23')));var _0x2b510e=[];for(var _0x15f370=0x0;_0x15f370<_0x14fd16[_0x3faf('0x27')];_0x15f370++){var _0x188674=_0x14fd16[_0x15f370]['replace']('.js','');if(compareVersions(module['exports'][_0x3faf('0x3')],_0x188674)===-0x1){_0x2b510e[_0x3faf('0x28')](_0x188674);}}if(_0x2b510e[_0x3faf('0x27')]){var _0x1b554=_0x2b510e[_0x3faf('0x29')](compareVersions);var _0x5eeab2=new Umzug({'storage':_0x3faf('0x2a'),'storageOptions':{'model':db[_0x3faf('0x2b')],'modelName':_0x3faf('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x3faf('0x2a')]['getQueryInterface'](),db['sequelize'][_0x3faf('0x2c')],function(){throw new Error(_0x3faf('0x2d'));}],'path':path[_0x3faf('0x25')](config[_0x3faf('0xa')],_0x3faf('0x26'),'migrations'),'pattern':/\.js$/}});_0x5eeab2['up']({'migrations':_['map'](_0x1b554,function(_0x4eb559){return _0x4eb559+_0x3faf('0x2e');})})[_0x3faf('0x1f')](function(){return _0x2636b3['status'](0xc8)['json']({'output':_0x3faf('0x2f')+module[_0x3faf('0xc')]['version']+'\x20to\x20'+_[_0x3faf('0x30')](_0x1b554),'migrations':_[_0x3faf('0x25')](_0x1b554)});})[_0x3faf('0x22')](function(_0x189a4f){if(_0x189a4f instanceof db[_0x3faf('0x2a')][_0x3faf('0x31')]){return _0x2636b3[_0x3faf('0x12')](0xc8)[_0x3faf('0x13')]({'output':_0x3faf('0x32')});}else{return _0x2636b3[_0x3faf('0x12')](0x1f4)[_0x3faf('0x13')](_0x189a4f);}});}else{return _0x2636b3[_0x3faf('0x12')](0xc8)[_0x3faf('0x13')]({'output':_0x3faf('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9159bc5..e97d148 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 _0xf6e4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0xf6e4,0xcb));var _0x4f6e=function(_0x45b5cd,_0x27abdf){_0x45b5cd=_0x45b5cd-0x0;var _0x10945e=_0xf6e4[_0x45b5cd];return _0x10945e;};'use strict';var multer=require(_0x4f6e('0x0'));var util=require('util');var path=require(_0x4f6e('0x1'));var timeout=require(_0x4f6e('0x2'));var express=require(_0x4f6e('0x3'));var router=express[_0x4f6e('0x4')]();var fs_extra=require(_0x4f6e('0x5'));var auth=require(_0x4f6e('0x6'));var interaction=require(_0x4f6e('0x7'));var config=require(_0x4f6e('0x8'));var controller=require(_0x4f6e('0x9'));router[_0x4f6e('0xa')]('/',auth[_0x4f6e('0xb')](),controller['index']);router[_0x4f6e('0xa')](_0x4f6e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4f6e('0xa')](_0x4f6e('0xd'),auth['isAuthenticated'](),controller[_0x4f6e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f6e('0xf')]);router[_0x4f6e('0x10')]('/:id',auth[_0x4f6e('0xb')](),controller['update']);router[_0x4f6e('0x11')](_0x4f6e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f6e('0x12')]=router; \ No newline at end of file +var _0x1599=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4cebf0,_0xf2a205){var _0x2f8b96=function(_0x111acf){while(--_0x111acf){_0x4cebf0['push'](_0x4cebf0['shift']());}};_0x2f8b96(++_0xf2a205);}(_0x1599,0xd8));var _0x9159=function(_0x5d819c,_0x42e044){_0x5d819c=_0x5d819c-0x0;var _0x2278c1=_0x1599[_0x5d819c];return _0x2278c1;};'use strict';var multer=require(_0x9159('0x0'));var util=require(_0x9159('0x1'));var path=require(_0x9159('0x2'));var timeout=require(_0x9159('0x3'));var express=require(_0x9159('0x4'));var router=express[_0x9159('0x5')]();var fs_extra=require(_0x9159('0x6'));var auth=require(_0x9159('0x7'));var interaction=require(_0x9159('0x8'));var config=require(_0x9159('0x9'));var controller=require(_0x9159('0xa'));router[_0x9159('0xb')]('/',auth['isAuthenticated'](),controller[_0x9159('0xc')]);router['get'](_0x9159('0xd'),auth[_0x9159('0xe')](),controller[_0x9159('0xf')]);router['get'](_0x9159('0x10'),auth[_0x9159('0xe')](),controller[_0x9159('0x11')]);router[_0x9159('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9159('0x13')](_0x9159('0x10'),auth[_0x9159('0xe')](),controller['update']);router['delete'](_0x9159('0x10'),auth['isAuthenticated'](),controller[_0x9159('0x14')]);module[_0x9159('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 f7d846e..ef5d916 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 _0xe9e8=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x9f37f1,_0x55f13c){var _0x47419b=function(_0x4b9e72){while(--_0x4b9e72){_0x9f37f1['push'](_0x9f37f1['shift']());}};_0x47419b(++_0x55f13c);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x64f489,_0x58f52a){_0x64f489=_0x64f489-0x0;var _0x255951=_0xe9e8[_0x64f489];return _0x255951;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'type':{'type':Sequelize[_0x8e9e('0x2')]},'uniqueid':{'type':Sequelize[_0x8e9e('0x2')]},'calleridnum':{'type':Sequelize[_0x8e9e('0x2')]},'calleridname':{'type':Sequelize[_0x8e9e('0x2')]},'queue':{'type':Sequelize[_0x8e9e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8e9e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8e9e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8e9e('0x3')]},'holdtime':{'type':Sequelize[_0x8e9e('0x4')]},'agentcomplete':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8e9e('0x4')]},'agentacw':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8e9e('0x2')]},'lastevent':{'type':Sequelize[_0x8e9e('0x2')]},'channel':{'type':Sequelize[_0x8e9e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8e9e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8e9e('0x2')]},'connectedlinename':{'type':Sequelize[_0x8e9e('0x2')]},'language':{'type':Sequelize[_0x8e9e('0x2')]},'accountcode':{'type':Sequelize[_0x8e9e('0x2')]},'context':{'type':Sequelize[_0x8e9e('0x2')]},'exten':{'type':Sequelize[_0x8e9e('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x8e9e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8e9e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8e9e('0x2')]},'destcalleridname':{'type':Sequelize[_0x8e9e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8e9e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8e9e('0x2')]},'destlanguage':{'type':Sequelize[_0x8e9e('0x2')]},'destaccountcode':{'type':Sequelize[_0x8e9e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x8e9e('0x2')]},'destuniqueid':{'type':Sequelize[_0x8e9e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8e9e('0x2')]},'transfer':{'type':Sequelize[_0x8e9e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8e9e('0x2')],'comment':_0x8e9e('0x6')},'transferexten':{'type':Sequelize[_0x8e9e('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x47d6=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x47d6,0x13f));var _0x647d=function(_0x334d68,_0x5151bf){_0x334d68=_0x334d68-0x0;var _0x6ad64b=_0x47d6[_0x334d68];return _0x6ad64b;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'type':{'type':Sequelize[_0x647d('0x2')]},'uniqueid':{'type':Sequelize[_0x647d('0x2')]},'calleridnum':{'type':Sequelize[_0x647d('0x2')]},'calleridname':{'type':Sequelize[_0x647d('0x2')]},'queue':{'type':Sequelize[_0x647d('0x2')]},'interface':{'type':Sequelize[_0x647d('0x2')]},'membername':{'type':Sequelize[_0x647d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x647d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x647d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x647d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x647d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x647d('0x3')]},'holdtime':{'type':Sequelize[_0x647d('0x4')]},'agentcomplete':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x647d('0x4')]},'agentacw':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x647d('0x4')]},'reason':{'type':Sequelize[_0x647d('0x2')]},'lastevent':{'type':Sequelize[_0x647d('0x2')]},'channel':{'type':Sequelize[_0x647d('0x2')]},'channelstate':{'type':Sequelize[_0x647d('0x4')]},'channelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'connectedlinename':{'type':Sequelize[_0x647d('0x2')]},'language':{'type':Sequelize[_0x647d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x647d('0x2')]},'priority':{'type':Sequelize[_0x647d('0x2')]},'destchannel':{'type':Sequelize[_0x647d('0x2')]},'destchannelstate':{'type':Sequelize[_0x647d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x647d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x647d('0x2')]},'destcalleridname':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x647d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x647d('0x2')]},'destaccountcode':{'type':Sequelize[_0x647d('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x647d('0x2')]},'destpriority':{'type':Sequelize[_0x647d('0x2')]},'destuniqueid':{'type':Sequelize[_0x647d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x647d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x647d('0x2')],'comment':_0x647d('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x647d('0x2')]},'agententerreason':{'type':Sequelize[_0x647d('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a60bf49..5691f7e 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 6b2e81a..f924bc3 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 _0x8784=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x8784,0x172));var _0x4878=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x8784[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var logger=require('../../config/logger')(_0x4878('0x2'));var moment=require(_0x4878('0x3'));var BPromise=require(_0x4878('0x4'));var rp=require(_0x4878('0x5'));var fs=require('fs');var path=require(_0x4878('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4878('0x7'));module[_0x4878('0x8')]=function(_0x158bc8,_0xdf70f){return _0x158bc8[_0x4878('0x9')](_0x4878('0xa'),attributes,{'tableName':_0x4878('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4878('0xc'),_0x4878('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41fe=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x41fe,0xd1));var _0xe41f=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x41fe[_0x26b80e];return _0x84a8a8;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var logger=require(_0xe41f('0x2'))(_0xe41f('0x3'));var moment=require(_0xe41f('0x4'));var BPromise=require(_0xe41f('0x5'));var rp=require(_0xe41f('0x6'));var fs=require('fs');var path=require(_0xe41f('0x7'));var rimraf=require(_0xe41f('0x8'));var config=require(_0xe41f('0x9'));var attributes=require(_0xe41f('0xa'));module[_0xe41f('0xb')]=function(_0xd3c763,_0x370385){return _0xd3c763[_0xe41f('0xc')](_0xe41f('0xd'),attributes,{'tableName':_0xe41f('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xe41f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 7b1cf7f..a2de64a 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 _0xa565=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis'];(function(_0x1e6d6b,_0x20bb9a){var _0x19aea8=function(_0x14b054){while(--_0x14b054){_0x1e6d6b['push'](_0x1e6d6b['shift']());}};_0x19aea8(++_0x20bb9a);}(_0xa565,0x9c));var _0x5a56=function(_0x47a389,_0x499c1f){_0x47a389=_0x47a389-0x0;var _0x7b01e=_0xa565[_0x47a389];return _0x7b01e;};'use strict';var _=require(_0x5a56('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5a56('0x1'));var rs=require(_0x5a56('0x2'));var fs=require('fs');var Redis=require(_0x5a56('0x3'));var db=require(_0x5a56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a56('0x5'))(_0x5a56('0x6'));var config=require(_0x5a56('0x7'));var jayson=require(_0x5a56('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49487d,_0x24f91c,_0x4d6e07){return new BPromise(function(_0x201684,_0x239790){return client['request'](_0x49487d,_0x4d6e07)[_0x5a56('0x9')](function(_0x381073){logger[_0x5a56('0xa')](_0x5a56('0xb'),_0x24f91c,_0x5a56('0xc'));logger[_0x5a56('0xd')](_0x5a56('0xe'),_0x24f91c,_0x5a56('0xc'),JSON[_0x5a56('0xf')](_0x381073));if(_0x381073['error']){if(_0x381073[_0x5a56('0x10')][_0x5a56('0x11')]===0x1f4){logger[_0x5a56('0x10')](_0x5a56('0xb'),_0x24f91c,_0x381073[_0x5a56('0x10')][_0x5a56('0x12')]);return _0x239790(_0x381073['error'][_0x5a56('0x12')]);}logger[_0x5a56('0x10')](_0x5a56('0xb'),_0x24f91c,_0x381073[_0x5a56('0x10')][_0x5a56('0x12')]);return _0x201684(_0x381073['error']['message']);}else{logger[_0x5a56('0xa')](_0x5a56('0xb'),_0x24f91c,'request\x20sent');_0x201684(_0x381073[_0x5a56('0x13')][_0x5a56('0x12')]);}})[_0x5a56('0x14')](function(_0x2c195e){logger[_0x5a56('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x24f91c,_0x2c195e);_0x239790(_0x2c195e);});});}exports[_0x5a56('0x15')]=function(_0x21ec91){var _0x314644=this;return new Promise(function(_0x236e7b,_0x24a3d8){return db[_0x5a56('0x16')][_0x5a56('0x17')](_0x21ec91[_0x5a56('0x18')],{'raw':_0x21ec91[_0x5a56('0x19')]?_0x21ec91[_0x5a56('0x19')][_0x5a56('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x96cec6){logger[_0x5a56('0xa')](_0x5a56('0x15'),_0x21ec91);logger[_0x5a56('0xd')]('CreateVoiceAgentReport',_0x21ec91,JSON['stringify'](_0x96cec6));_0x236e7b(_0x96cec6);})[_0x5a56('0x14')](function(_0x148687){logger['error'](_0x5a56('0x15'),_0x148687[_0x5a56('0x12')],_0x21ec91);_0x24a3d8(_0x314644[_0x5a56('0x10')](0x1f4,_0x148687['message']));});});};exports[_0x5a56('0x1b')]=function(_0x27dce0){var _0x2ad469=this;return new Promise(function(_0x361e67,_0x377fe1){return db['VoiceAgentReport'][_0x5a56('0x1c')](_0x27dce0[_0x5a56('0x18')],{'raw':_0x27dce0['options']?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27dce0[_0x5a56('0x19')]?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1d')]||null:null,'attributes':_0x27dce0['options']?_0x27dce0[_0x5a56('0x19')][_0x5a56('0x1e')]||null:null,'limit':_0x27dce0[_0x5a56('0x19')]?_0x27dce0['options'][_0x5a56('0x1f')]||null:null})[_0x5a56('0x9')](function(_0x5e258e){logger[_0x5a56('0xa')](_0x5a56('0x1b'),_0x27dce0);logger['debug']('UpdateVoiceAgentReport',_0x27dce0,JSON[_0x5a56('0xf')](_0x5e258e));_0x361e67(_0x5e258e);})['catch'](function(_0x30cc9b){logger[_0x5a56('0x10')](_0x5a56('0x1b'),_0x30cc9b['message'],_0x27dce0);_0x377fe1(_0x2ad469['error'](0x1f4,_0x30cc9b[_0x5a56('0x12')]));});});}; \ No newline at end of file +var _0xc333=['VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0xc333,0xde));var _0x3c33=function(_0x188ad4,_0x7b0305){_0x188ad4=_0x188ad4-0x0;var _0xe77f4a=_0xc333[_0x188ad4];return _0xe77f4a;};'use strict';var _=require(_0x3c33('0x0'));var util=require(_0x3c33('0x1'));var moment=require(_0x3c33('0x2'));var BPromise=require(_0x3c33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c33('0x4'));var db=require(_0x3c33('0x5'))['db'];var utils=require(_0x3c33('0x6'));var logger=require(_0x3c33('0x7'))(_0x3c33('0x8'));var config=require(_0x3c33('0x9'));var jayson=require(_0x3c33('0xa'));var client=jayson['client'][_0x3c33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x393536,_0x22cff7,_0x86730a){return new BPromise(function(_0x37a934,_0x24c847){return client[_0x3c33('0xc')](_0x393536,_0x86730a)[_0x3c33('0xd')](function(_0x1a69bd){logger[_0x3c33('0xe')](_0x3c33('0xf'),_0x22cff7,_0x3c33('0x10'));logger['debug'](_0x3c33('0x11'),_0x22cff7,_0x3c33('0x10'),JSON['stringify'](_0x1a69bd));if(_0x1a69bd[_0x3c33('0x12')]){if(_0x1a69bd[_0x3c33('0x12')][_0x3c33('0x13')]===0x1f4){logger[_0x3c33('0x12')](_0x3c33('0xf'),_0x22cff7,_0x1a69bd['error'][_0x3c33('0x14')]);return _0x24c847(_0x1a69bd[_0x3c33('0x12')][_0x3c33('0x14')]);}logger[_0x3c33('0x12')](_0x3c33('0xf'),_0x22cff7,_0x1a69bd[_0x3c33('0x12')][_0x3c33('0x14')]);return _0x37a934(_0x1a69bd[_0x3c33('0x12')][_0x3c33('0x14')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x22cff7,_0x3c33('0x10'));_0x37a934(_0x1a69bd[_0x3c33('0x15')]['message']);}})[_0x3c33('0x16')](function(_0x459551){logger['error'](_0x3c33('0xf'),_0x22cff7,_0x459551);_0x24c847(_0x459551);});});}exports['CreateVoiceAgentReport']=function(_0x1a092c){var _0x5eb9af=this;return new Promise(function(_0x12b406,_0x4124f7){return db[_0x3c33('0x17')][_0x3c33('0x18')](_0x1a092c[_0x3c33('0x19')],{'raw':_0x1a092c[_0x3c33('0x1a')]?_0x1a092c['options'][_0x3c33('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x241976){logger[_0x3c33('0xe')](_0x3c33('0x1c'),_0x1a092c);logger['debug'](_0x3c33('0x1c'),_0x1a092c,JSON['stringify'](_0x241976));_0x12b406(_0x241976);})[_0x3c33('0x16')](function(_0x25eb4d){logger[_0x3c33('0x12')](_0x3c33('0x1c'),_0x25eb4d[_0x3c33('0x14')],_0x1a092c);_0x4124f7(_0x5eb9af[_0x3c33('0x12')](0x1f4,_0x25eb4d[_0x3c33('0x14')]));});});};exports[_0x3c33('0x1d')]=function(_0x481c2c){var _0x67a238=this;return new Promise(function(_0x238207,_0x5d6deb){return db[_0x3c33('0x17')][_0x3c33('0x1e')](_0x481c2c[_0x3c33('0x19')],{'raw':_0x481c2c[_0x3c33('0x1a')]?_0x481c2c[_0x3c33('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x481c2c[_0x3c33('0x1a')]?_0x481c2c[_0x3c33('0x1a')][_0x3c33('0x1f')]||null:null,'attributes':_0x481c2c['options']?_0x481c2c[_0x3c33('0x1a')][_0x3c33('0x20')]||null:null,'limit':_0x481c2c[_0x3c33('0x1a')]?_0x481c2c[_0x3c33('0x1a')][_0x3c33('0x21')]||null:null})[_0x3c33('0xd')](function(_0x2f52ff){logger[_0x3c33('0xe')](_0x3c33('0x1d'),_0x481c2c);logger[_0x3c33('0x22')](_0x3c33('0x1d'),_0x481c2c,JSON['stringify'](_0x2f52ff));_0x238207(_0x2f52ff);})[_0x3c33('0x16')](function(_0x41cb8b){logger[_0x3c33('0x12')](_0x3c33('0x1d'),_0x41cb8b[_0x3c33('0x14')],_0x481c2c);_0x5d6deb(_0x67a238[_0x3c33('0x12')](0x1f4,_0x41cb8b[_0x3c33('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c054f31..1e88ac7 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 _0x8ef6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x196054,_0x36712b){var _0x3ef8b7=function(_0x276a0f){while(--_0x276a0f){_0x196054['push'](_0x196054['shift']());}};_0x3ef8b7(++_0x36712b);}(_0x8ef6,0xf2));var _0x68ef=function(_0x142487,_0x3ae69b){_0x142487=_0x142487-0x0;var _0x4b605b=_0x8ef6[_0x142487];return _0x4b605b;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/:id',auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file +var _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x5b19ae,_0x2fef9e){var _0x367f6a=function(_0x1bcbf1){while(--_0x1bcbf1){_0x5b19ae['push'](_0x5b19ae['shift']());}};_0x367f6a(++_0x2fef9e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x4b84[_0x4c73ac];return _0x9839ee;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('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 bc2d33e..104118a 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 _0xb98e=['TEXT','DATE','INTEGER','sequelize','exports','inbound','internal','outbound','outbound-fax','dialer','STRING'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xb98e,0x184));var _0xeb98=function(_0x1ba32d,_0x40fc84){_0x1ba32d=_0x1ba32d-0x0;var _0x2fb7f7=_0xb98e[_0x1ba32d];return _0x2fb7f7;};'use strict';var Sequelize=require(_0xeb98('0x0'));module[_0xeb98('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xeb98('0x2'),_0xeb98('0x3'),_0xeb98('0x4'),'inbound-fax',_0xeb98('0x5'),_0xeb98('0x6'))},'tag':{'type':Sequelize[_0xeb98('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xeb98('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xeb98('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeb98('0x7')]},'destinationchannel':{'type':Sequelize[_0xeb98('0x7')]},'lastapplication':{'type':Sequelize[_0xeb98('0x7')]},'lastdata':{'type':Sequelize[_0xeb98('0x8')]},'starttime':{'type':Sequelize[_0xeb98('0x9')]},'systemanswertime':{'type':Sequelize[_0xeb98('0x9')]},'answertime':{'type':Sequelize[_0xeb98('0x9')]},'endtime':{'type':Sequelize[_0xeb98('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xeb98('0xa')]},'mohtime':{'type':Sequelize[_0xeb98('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeb98('0x7')]},'amaflags':{'type':Sequelize[_0xeb98('0x7')]},'userfield':{'type':Sequelize[_0xeb98('0x7')]},'userDisposition':{'type':Sequelize[_0xeb98('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xeb98('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xeb98('0x7')]},'note':{'type':Sequelize[_0xeb98('0x7')]},'prefix':{'type':Sequelize[_0xeb98('0x7')]},'routeid':{'type':Sequelize[_0xeb98('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa72d=['TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING'];(function(_0x7d12d4,_0x2868f6){var _0x324c83=function(_0x4345fb){while(--_0x4345fb){_0x7d12d4['push'](_0x7d12d4['shift']());}};_0x324c83(++_0x2868f6);}(_0xa72d,0x1bf));var _0xda72=function(_0x23bcef,_0x27a92a){_0x23bcef=_0x23bcef-0x0;var _0x4a635b=_0xa72d[_0x23bcef];return _0x4a635b;};'use strict';var Sequelize=require(_0xda72('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xda72('0x1')](_0xda72('0x2'),_0xda72('0x3'),_0xda72('0x4'),_0xda72('0x5'),_0xda72('0x6'),_0xda72('0x7'))},'tag':{'type':Sequelize[_0xda72('0x8')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xda72('0x8')]},'destination':{'type':Sequelize[_0xda72('0x8')]},'destinationcontext':{'type':Sequelize[_0xda72('0x8')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda72('0x8')]},'destinationchannel':{'type':Sequelize[_0xda72('0x8')]},'lastapplication':{'type':Sequelize[_0xda72('0x8')]},'lastdata':{'type':Sequelize[_0xda72('0x9')]},'starttime':{'type':Sequelize[_0xda72('0xa')]},'systemanswertime':{'type':Sequelize[_0xda72('0xa')]},'answertime':{'type':Sequelize[_0xda72('0xa')]},'endtime':{'type':Sequelize[_0xda72('0xa')]},'duration':{'type':Sequelize[_0xda72('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xda72('0x8')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xda72('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xda72('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xda72('0x8')]},'prefix':{'type':Sequelize[_0xda72('0x8')]},'routeid':{'type':Sequelize[_0xda72('0xb')]},'sipcallid':{'type':Sequelize[_0xda72('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ae5bd80..bfd5077 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 _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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1cd5858..455dda2 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 _0x4baf=['define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x525fef,_0xd49ded){var _0x2333bb=function(_0x2ba5c6){while(--_0x2ba5c6){_0x525fef['push'](_0x525fef['shift']());}};_0x2333bb(++_0xd49ded);}(_0x4baf,0x14d));var _0xf4ba=function(_0x49cd8a,_0x4b95f3){_0x49cd8a=_0x49cd8a-0x0;var _0x489f31=_0x4baf[_0x49cd8a];return _0x489f31;};'use strict';var _=require(_0xf4ba('0x0'));var util=require(_0xf4ba('0x1'));var logger=require(_0xf4ba('0x2'))(_0xf4ba('0x3'));var moment=require(_0xf4ba('0x4'));var BPromise=require(_0xf4ba('0x5'));var rp=require(_0xf4ba('0x6'));var fs=require('fs');var path=require(_0xf4ba('0x7'));var rimraf=require(_0xf4ba('0x8'));var config=require(_0xf4ba('0x9'));var attributes=require(_0xf4ba('0xa'));module[_0xf4ba('0xb')]=function(_0x4f6dda,_0x149233){return _0x4f6dda[_0xf4ba('0xc')](_0xf4ba('0xd'),attributes,{'tableName':_0xf4ba('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcdf=['path','rimraf','../../config/environment','exports','define','report_call','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0xdcdf,0x1c3));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdcd('0x0'));var util=require('util');var logger=require(_0xfdcd('0x1'))('api');var moment=require(_0xfdcd('0x2'));var BPromise=require(_0xfdcd('0x3'));var rp=require(_0xfdcd('0x4'));var fs=require('fs');var path=require(_0xfdcd('0x5'));var rimraf=require(_0xfdcd('0x6'));var config=require(_0xfdcd('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xfdcd('0x8')]=function(_0x1ae763,_0x530260){return _0x1ae763[_0xfdcd('0x9')]('VoiceCallReport',attributes,{'tableName':_0xfdcd('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfdcd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 201fd40..4be7675 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 _0xe0b5=['VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','stringify','create','CreateVoiceCallReport','body','then','UpdateVoiceCallReport','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe0b5,0x14b));var _0x5e0b=function(_0x1daa83,_0x5642e2){_0x1daa83=_0x1daa83-0x0;var _0x428708=_0xe0b5[_0x1daa83];return _0x428708;};'use strict';var _=require('lodash');var util=require(_0x5e0b('0x0'));var moment=require('moment');var BPromise=require(_0x5e0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e0b('0x2'));var db=require(_0x5e0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e0b('0x4'))(_0x5e0b('0x5'));var config=require(_0x5e0b('0x6'));var jayson=require(_0x5e0b('0x7'));var client=jayson['client'][_0x5e0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f6cdd,_0x5ce1f7,_0x407469){return new BPromise(function(_0x147059,_0x127502){return client['request'](_0x1f6cdd,_0x407469)['then'](function(_0x47358a){logger['info'](_0x5e0b('0x9'),_0x5ce1f7,_0x5e0b('0xa'));logger[_0x5e0b('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5ce1f7,_0x5e0b('0xa'),JSON['stringify'](_0x47358a));if(_0x47358a[_0x5e0b('0xc')]){if(_0x47358a[_0x5e0b('0xc')]['code']===0x1f4){logger['error'](_0x5e0b('0x9'),_0x5ce1f7,_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);return _0x127502(_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);}logger[_0x5e0b('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x5ce1f7,_0x47358a[_0x5e0b('0xc')][_0x5e0b('0xd')]);return _0x147059(_0x47358a['error'][_0x5e0b('0xd')]);}else{logger[_0x5e0b('0xe')](_0x5e0b('0x9'),_0x5ce1f7,_0x5e0b('0xa'));_0x147059(_0x47358a[_0x5e0b('0xf')][_0x5e0b('0xd')]);}})[_0x5e0b('0x10')](function(_0x250cb8){logger['error'](_0x5e0b('0x9'),_0x5ce1f7,_0x250cb8);_0x127502(_0x250cb8);});});}exports[_0x5e0b('0x11')]=function(_0x26fde4){var _0x361e00=this;return new Promise(function(_0x1084e6,_0x7b2b1e){return db[_0x5e0b('0x12')][_0x5e0b('0x13')]({'raw':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![],'where':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x16')]||null:null,'attributes':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4[_0x5e0b('0x14')][_0x5e0b('0x17')]||null:null,'limit':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4['options'][_0x5e0b('0x18')]||null:null,'include':_0x26fde4[_0x5e0b('0x14')]?_0x26fde4['options'][_0x5e0b('0x19')]?_['map'](_0x26fde4[_0x5e0b('0x14')]['include'],function(_0x51ece3){return{'model':db[_0x51ece3[_0x5e0b('0x1a')]],'as':_0x51ece3['as'],'attributes':_0x51ece3[_0x5e0b('0x17')],'include':_0x51ece3[_0x5e0b('0x19')]?_[_0x5e0b('0x1b')](_0x51ece3[_0x5e0b('0x19')],function(_0x5752af){return{'model':db[_0x5752af[_0x5e0b('0x1a')]],'as':_0x5752af['as'],'attributes':_0x5752af[_0x5e0b('0x17')],'include':_0x5752af['include']?_[_0x5e0b('0x1b')](_0x5752af[_0x5e0b('0x19')],function(_0x28e755){return{'model':db[_0x28e755[_0x5e0b('0x1a')]],'as':_0x28e755['as'],'attributes':_0x28e755['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd98b){logger[_0x5e0b('0xe')](_0x5e0b('0x11'),_0x26fde4);logger[_0x5e0b('0xb')]('GetVoiceCallReport',_0x26fde4,JSON[_0x5e0b('0x1c')](_0x3cd98b));_0x1084e6(_0x3cd98b);})[_0x5e0b('0x10')](function(_0xc8d8d3){logger[_0x5e0b('0xc')]('GetVoiceCallReport',_0xc8d8d3[_0x5e0b('0xd')],_0x26fde4);_0x7b2b1e(_0x361e00[_0x5e0b('0xc')](0x1f4,_0xc8d8d3[_0x5e0b('0xd')]));});});};exports['CreateVoiceCallReport']=function(_0x5c26d1){var _0xf1d381=this;return new Promise(function(_0x4a4c33,_0xda3a9f){return db[_0x5e0b('0x12')][_0x5e0b('0x1d')](_0x5c26d1['body'],{'raw':_0x5c26d1[_0x5e0b('0x14')]?_0x5c26d1[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x56878b){logger[_0x5e0b('0xe')](_0x5e0b('0x1e'),_0x5c26d1);logger[_0x5e0b('0xb')](_0x5e0b('0x1e'),_0x5c26d1,JSON[_0x5e0b('0x1c')](_0x56878b));_0x4a4c33(_0x56878b);})[_0x5e0b('0x10')](function(_0x39bd6f){logger['error'](_0x5e0b('0x1e'),_0x39bd6f[_0x5e0b('0xd')],_0x5c26d1);_0xda3a9f(_0xf1d381['error'](0x1f4,_0x39bd6f[_0x5e0b('0xd')]));});});};exports['UpdateVoiceCallReport']=function(_0x2e9cae){var _0x3167a8=this;return new Promise(function(_0xfb420d,_0x409167){return db[_0x5e0b('0x12')]['update'](_0x2e9cae[_0x5e0b('0x1f')],{'raw':_0x2e9cae[_0x5e0b('0x14')]?_0x2e9cae[_0x5e0b('0x14')][_0x5e0b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9cae[_0x5e0b('0x14')]?_0x2e9cae['options'][_0x5e0b('0x16')]||null:null,'attributes':_0x2e9cae['options']?_0x2e9cae[_0x5e0b('0x14')][_0x5e0b('0x17')]||null:null,'limit':_0x2e9cae['options']?_0x2e9cae[_0x5e0b('0x14')]['limit']||null:null})[_0x5e0b('0x20')](function(_0x10b2e3){logger['info'](_0x5e0b('0x21'),_0x2e9cae);logger['debug']('UpdateVoiceCallReport',_0x2e9cae,JSON[_0x5e0b('0x1c')](_0x10b2e3));_0xfb420d(_0x10b2e3);})[_0x5e0b('0x10')](function(_0x49c55f){logger[_0x5e0b('0xc')](_0x5e0b('0x21'),_0x49c55f[_0x5e0b('0xd')],_0x2e9cae);_0x409167(_0x3167a8['error'](0x1f4,_0x49c55f['message']));});});}; \ No newline at end of file +var _0xf980=['UpdateVoiceCallReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','then','debug','catch','create','CreateVoiceCallReport','update','body','limit'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xf980,0x104));var _0x0f98=function(_0x51057a,_0x2c8c27){_0x51057a=_0x51057a-0x0;var _0x3cbdaa=_0xf980[_0x51057a];return _0x3cbdaa;};'use strict';var _=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var moment=require('moment');var BPromise=require(_0x0f98('0x2'));var rs=require(_0x0f98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f98('0x4'))['db'];var utils=require(_0x0f98('0x5'));var logger=require('../../config/logger')(_0x0f98('0x6'));var config=require(_0x0f98('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0f98('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x375e51,_0x39d524,_0x53aef3){return new BPromise(function(_0x772355,_0x2ff1a2){return client[_0x0f98('0x9')](_0x375e51,_0x53aef3)['then'](function(_0x1e62af){logger['info'](_0x0f98('0xa'),_0x39d524,'request\x20sent');logger['debug'](_0x0f98('0xb'),_0x39d524,_0x0f98('0xc'),JSON[_0x0f98('0xd')](_0x1e62af));if(_0x1e62af['error']){if(_0x1e62af['error']['code']===0x1f4){logger['error'](_0x0f98('0xa'),_0x39d524,_0x1e62af[_0x0f98('0xe')][_0x0f98('0xf')]);return _0x2ff1a2(_0x1e62af[_0x0f98('0xe')][_0x0f98('0xf')]);}logger[_0x0f98('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x39d524,_0x1e62af[_0x0f98('0xe')][_0x0f98('0xf')]);return _0x772355(_0x1e62af[_0x0f98('0xe')][_0x0f98('0xf')]);}else{logger[_0x0f98('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x39d524,_0x0f98('0xc'));_0x772355(_0x1e62af[_0x0f98('0x11')][_0x0f98('0xf')]);}})['catch'](function(_0x5d4310){logger[_0x0f98('0xe')](_0x0f98('0xa'),_0x39d524,_0x5d4310);_0x2ff1a2(_0x5d4310);});});}exports[_0x0f98('0x12')]=function(_0x2b97f2){var _0x404a5e=this;return new Promise(function(_0x1f41aa,_0x17ebb0){return db[_0x0f98('0x13')][_0x0f98('0x14')]({'raw':_0x2b97f2[_0x0f98('0x15')]?_0x2b97f2[_0x0f98('0x15')][_0x0f98('0x16')]===undefined?!![]:![]:!![],'where':_0x2b97f2[_0x0f98('0x15')]?_0x2b97f2[_0x0f98('0x15')][_0x0f98('0x17')]||null:null,'attributes':_0x2b97f2[_0x0f98('0x15')]?_0x2b97f2[_0x0f98('0x15')][_0x0f98('0x18')]||null:null,'limit':_0x2b97f2['options']?_0x2b97f2[_0x0f98('0x15')]['limit']||null:null,'include':_0x2b97f2[_0x0f98('0x15')]?_0x2b97f2[_0x0f98('0x15')][_0x0f98('0x19')]?_[_0x0f98('0x1a')](_0x2b97f2['options'][_0x0f98('0x19')],function(_0x522eaf){return{'model':db[_0x522eaf[_0x0f98('0x1b')]],'as':_0x522eaf['as'],'attributes':_0x522eaf[_0x0f98('0x18')],'include':_0x522eaf['include']?_[_0x0f98('0x1a')](_0x522eaf[_0x0f98('0x19')],function(_0x2cda6a){return{'model':db[_0x2cda6a[_0x0f98('0x1b')]],'as':_0x2cda6a['as'],'attributes':_0x2cda6a[_0x0f98('0x18')],'include':_0x2cda6a['include']?_[_0x0f98('0x1a')](_0x2cda6a[_0x0f98('0x19')],function(_0x424b94){return{'model':db[_0x424b94[_0x0f98('0x1b')]],'as':_0x424b94['as'],'attributes':_0x424b94[_0x0f98('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0f98('0x1c')](function(_0xf1f85f){logger['info'](_0x0f98('0x12'),_0x2b97f2);logger[_0x0f98('0x1d')]('GetVoiceCallReport',_0x2b97f2,JSON[_0x0f98('0xd')](_0xf1f85f));_0x1f41aa(_0xf1f85f);})[_0x0f98('0x1e')](function(_0x1efe04){logger[_0x0f98('0xe')](_0x0f98('0x12'),_0x1efe04['message'],_0x2b97f2);_0x17ebb0(_0x404a5e[_0x0f98('0xe')](0x1f4,_0x1efe04[_0x0f98('0xf')]));});});};exports['CreateVoiceCallReport']=function(_0x2f885f){var _0x38aef5=this;return new Promise(function(_0x1a3ff2,_0x11cf2c){return db[_0x0f98('0x13')][_0x0f98('0x1f')](_0x2f885f['body'],{'raw':_0x2f885f[_0x0f98('0x15')]?_0x2f885f['options'][_0x0f98('0x16')]===undefined?!![]:![]:!![]})[_0x0f98('0x1c')](function(_0x2ab9cd){logger['info'](_0x0f98('0x20'),_0x2f885f);logger['debug']('CreateVoiceCallReport',_0x2f885f,JSON[_0x0f98('0xd')](_0x2ab9cd));_0x1a3ff2(_0x2ab9cd);})[_0x0f98('0x1e')](function(_0x1cace8){logger[_0x0f98('0xe')](_0x0f98('0x20'),_0x1cace8[_0x0f98('0xf')],_0x2f885f);_0x11cf2c(_0x38aef5['error'](0x1f4,_0x1cace8[_0x0f98('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x495719){var _0x387a1b=this;return new Promise(function(_0x36dab1,_0x1e941a){return db['VoiceCallReport'][_0x0f98('0x21')](_0x495719[_0x0f98('0x22')],{'raw':_0x495719[_0x0f98('0x15')]?_0x495719['options'][_0x0f98('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x495719[_0x0f98('0x15')]?_0x495719[_0x0f98('0x15')][_0x0f98('0x17')]||null:null,'attributes':_0x495719['options']?_0x495719[_0x0f98('0x15')][_0x0f98('0x18')]||null:null,'limit':_0x495719[_0x0f98('0x15')]?_0x495719[_0x0f98('0x15')][_0x0f98('0x23')]||null:null})[_0x0f98('0x1c')](function(_0x26bc14){logger['info'](_0x0f98('0x24'),_0x495719);logger[_0x0f98('0x1d')](_0x0f98('0x24'),_0x495719,JSON[_0x0f98('0xd')](_0x26bc14));_0x36dab1(_0x26bc14);})[_0x0f98('0x1e')](function(_0x360414){logger['error'](_0x0f98('0x24'),_0x360414['message'],_0x495719);_0x1e941a(_0x387a1b[_0x0f98('0xe')](0x1f4,_0x360414[_0x0f98('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 19ad20f..4452c7b 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 _0x386b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x386b,0x178));var _0xb386=function(_0x1c6f43,_0xfcb4e7){_0x1c6f43=_0x1c6f43-0x0;var _0x5adba5=_0x386b[_0x1c6f43];return _0x5adba5;};'use strict';var multer=require(_0xb386('0x0'));var util=require(_0xb386('0x1'));var path=require(_0xb386('0x2'));var timeout=require(_0xb386('0x3'));var express=require(_0xb386('0x4'));var router=express[_0xb386('0x5')]();var fs_extra=require(_0xb386('0x6'));var auth=require(_0xb386('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb386('0x8'));router[_0xb386('0x9')]('/',auth[_0xb386('0xa')](),controller[_0xb386('0xb')]);router[_0xb386('0x9')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0xd')]);router[_0xb386('0xe')]('/',auth[_0xb386('0xa')](),controller[_0xb386('0xf')]);router[_0xb386('0x10')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0x11')]);router[_0xb386('0x12')](_0xb386('0xc'),auth[_0xb386('0xa')](),controller[_0xb386('0x13')]);module[_0xb386('0x14')]=router; \ No newline at end of file +var _0xee76=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0xd1391e,_0xdc7351){var _0x17799a=function(_0x120f60){while(--_0x120f60){_0xd1391e['push'](_0xd1391e['shift']());}};_0x17799a(++_0xdc7351);}(_0xee76,0xfa));var _0x6ee7=function(_0x389a03,_0x380e6c){_0x389a03=_0x389a03-0x0;var _0xaf19ea=_0xee76[_0x389a03];return _0xaf19ea;};'use strict';var multer=require(_0x6ee7('0x0'));var util=require(_0x6ee7('0x1'));var path=require(_0x6ee7('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ee7('0x3'));var router=express[_0x6ee7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ee7('0x5'));var interaction=require(_0x6ee7('0x6'));var config=require('../../config/environment');var controller=require(_0x6ee7('0x7'));router[_0x6ee7('0x8')]('/',auth[_0x6ee7('0x9')](),controller[_0x6ee7('0xa')]);router[_0x6ee7('0x8')](_0x6ee7('0xb'),auth[_0x6ee7('0x9')](),controller[_0x6ee7('0xc')]);router[_0x6ee7('0xd')]('/',auth['isAuthenticated'](),controller[_0x6ee7('0xe')]);router[_0x6ee7('0xf')](_0x6ee7('0xb'),auth[_0x6ee7('0x9')](),controller[_0x6ee7('0x10')]);router[_0x6ee7('0x11')](_0x6ee7('0xb'),auth[_0x6ee7('0x9')](),controller[_0x6ee7('0x12')]);module[_0x6ee7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1e75172..d635c0a 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 _0x8580=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options'];(function(_0x1766bd,_0x3e0cb3){var _0x136a2a=function(_0x2699d8){while(--_0x2699d8){_0x1766bd['push'](_0x1766bd['shift']());}};_0x136a2a(++_0x3e0cb3);}(_0x8580,0x163));var _0x0858=function(_0xc204bc,_0x42a9af){_0xc204bc=_0xc204bc-0x0;var _0x291021=_0x8580[_0xc204bc];return _0x291021;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'name':{'type':Sequelize[_0x0858('0x1')]},'prefix':{'type':Sequelize[_0x0858('0x1')],'unique':_0x0858('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5b63bd){this[_0x0858('0x3')](_0x0858('0x4'),_0x5b63bd?_0x5b63bd[_0x0858('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0858('0x4'))?this[_0x0858('0x6')](_0x0858('0x4'))[_0x0858('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0858('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x0858('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0858('0x1')]},'description':{'type':Sequelize[_0x0858('0x1')]}}; \ No newline at end of file +var _0xc7b9=['split','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x5c22b0,_0x330534){var _0x1d5a5b=function(_0x45f263){while(--_0x45f263){_0x5c22b0['push'](_0x5c22b0['shift']());}};_0x1d5a5b(++_0x330534);}(_0xc7b9,0x1b1));var _0x9c7b=function(_0x374631,_0x2c94ca){_0x374631=_0x374631-0x0;var _0x39a56f=_0xc7b9[_0x374631];return _0x39a56f;};'use strict';var Sequelize=require('sequelize');module[_0x9c7b('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9c7b('0x1')],'unique':_0x9c7b('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9c7b('0x1')],'set':function(_0x39cf9e){this[_0x9c7b('0x3')](_0x9c7b('0x4'),_0x39cf9e?_0x39cf9e[_0x9c7b('0x5')](''):[]);},'get':function(){return this[_0x9c7b('0x6')](_0x9c7b('0x4'))?this[_0x9c7b('0x6')](_0x9c7b('0x4'))[_0x9c7b('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9c7b('0x1')]},'description':{'type':Sequelize[_0x9c7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 67b0b4d..e05da53 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 _0x9c2c=['moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9c2('0x0'));var rimraf=require(_0xc9c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9c2('0x3'));var util=require(_0xc9c2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc9c2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9c2('0x6'));var _=require(_0xc9c2('0x7'));var squel=require(_0xc9c2('0x8'));var crypto=require(_0xc9c2('0x9'));var jsforce=require(_0xc9c2('0xa'));var deskjs=require(_0xc9c2('0xb'));var toCsv=require(_0xc9c2('0x5'));var querystring=require(_0xc9c2('0xc'));var Papa=require(_0xc9c2('0xd'));var Redis=require('ioredis');var authService=require(_0xc9c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc9c2('0xf'));var hardwareService=require(_0xc9c2('0x10'));var logger=require(_0xc9c2('0x11'))(_0xc9c2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9c2('0x13'));var db=require(_0xc9c2('0x14'))['db'];function respondWithStatusCode(_0x568f69,_0x7ec780){_0x7ec780=_0x7ec780||0xcc;return function(_0x1f08a7){if(_0x1f08a7){return _0x568f69[_0xc9c2('0x15')](_0x7ec780);}return _0x568f69[_0xc9c2('0x16')](_0x7ec780)[_0xc9c2('0x17')]();};}function respondWithResult(_0x3b0058,_0x33b288){_0x33b288=_0x33b288||0xc8;return function(_0x132702){if(_0x132702){return _0x3b0058[_0xc9c2('0x16')](_0x33b288)[_0xc9c2('0x18')](_0x132702);}};}function respondWithFilteredResult(_0xf94209,_0x383667){return function(_0x480d7c){if(_0x480d7c){var _0x27840d=typeof _0x383667[_0xc9c2('0x19')]===_0xc9c2('0x1a')&&typeof _0x383667[_0xc9c2('0x1b')]===_0xc9c2('0x1a');var _0x49413b=_0x480d7c[_0xc9c2('0x1c')];var _0x37c027=_0x27840d?0x0:_0x383667[_0xc9c2('0x19')];var _0x4e4ded=_0x27840d?_0x480d7c[_0xc9c2('0x1c')]:_0x383667[_0xc9c2('0x19')]+_0x383667[_0xc9c2('0x1b')];var _0x484ca3;if(_0x4e4ded>=_0x49413b){_0x4e4ded=_0x49413b;_0x484ca3=0xc8;}else{_0x484ca3=0xce;}_0xf94209[_0xc9c2('0x16')](_0x484ca3);return _0xf94209[_0xc9c2('0x1d')]('Content-Range',_0x37c027+'-'+_0x4e4ded+'/'+_0x49413b)['json'](_0x480d7c);}return null;};}function patchUpdates(_0x37e3){return function(_0x50f280){try{jsonpatch[_0xc9c2('0x1e')](_0x50f280,_0x37e3,!![]);}catch(_0x140c8a){return BPromise[_0xc9c2('0x1f')](_0x140c8a);}return _0x50f280[_0xc9c2('0x20')]();};}function saveUpdates(_0x3e1774,_0x53c460){return function(_0x1fbac4){if(_0x1fbac4){return _0x1fbac4[_0xc9c2('0x21')](_0x3e1774)[_0xc9c2('0x22')](function(_0x11cc07){return _0x11cc07;});}return null;};}function removeEntity(_0x32c372,_0x385030){return function(_0x56e515){if(_0x56e515){return _0x56e515[_0xc9c2('0x23')]()[_0xc9c2('0x22')](function(){var _0x5e47c2=_0x56e515[_0xc9c2('0x24')]({'plain':!![]});var _0x4b3b97=_0xc9c2('0x25');return db[_0xc9c2('0x26')][_0xc9c2('0x23')]({'where':{'type':_0x4b3b97,'resourceId':_0x5e47c2['id']}})[_0xc9c2('0x22')](function(){return _0x56e515;});})['then'](function(){_0x32c372[_0xc9c2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fcaa3,_0x3bd8e8){return function(_0x41f3e8){if(!_0x41f3e8){_0x2fcaa3[_0xc9c2('0x15')](0x194);}return _0x41f3e8;};}function handleError(_0x2119c6,_0x4cf642){_0x4cf642=_0x4cf642||0x1f4;return function(_0x3cedb5){logger[_0xc9c2('0x27')](_0x3cedb5[_0xc9c2('0x28')]);if(_0x3cedb5[_0xc9c2('0x29')]){delete _0x3cedb5[_0xc9c2('0x29')];}_0x2119c6[_0xc9c2('0x16')](_0x4cf642)[_0xc9c2('0x2a')](_0x3cedb5);};}exports['index']=function(_0x55b9c6,_0x4a9fca){var _0x228971={},_0x17d174={},_0x49fcd3={'count':0x0,'rows':[]};var _0xefbf7a=_[_0xc9c2('0x2b')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')],function(_0x5ccb7a){return{'name':_0x5ccb7a[_0xc9c2('0x2e')],'type':_0x5ccb7a[_0xc9c2('0x2f')]['key']};});_0x17d174['model']=_[_0xc9c2('0x2b')](_0xefbf7a,_0xc9c2('0x29'));_0x17d174[_0xc9c2('0x30')]=_['keys'](_0x55b9c6['query']);_0x17d174[_0xc9c2('0x31')]=_[_0xc9c2('0x32')](_0x17d174['model'],_0x17d174[_0xc9c2('0x30')]);_0x228971['attributes']=_[_0xc9c2('0x32')](_0x17d174[_0xc9c2('0x33')],qs[_0xc9c2('0x34')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x228971[_0xc9c2('0x35')]=_0x228971[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x228971[_0xc9c2('0x35')]:_0x17d174['model'];if(!_0x55b9c6[_0xc9c2('0x30')]['hasOwnProperty'](_0xc9c2('0x37'))){_0x228971[_0xc9c2('0x1b')]=qs['limit'](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x1b')]);_0x228971['offset']=qs[_0xc9c2('0x19')](_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x19')]);}_0x228971['order']=qs[_0xc9c2('0x38')](_0x55b9c6['query'][_0xc9c2('0x38')]);_0x228971[_0xc9c2('0x39')]=qs['filters'](_[_0xc9c2('0x3a')](_0x55b9c6[_0xc9c2('0x30')],_0x17d174[_0xc9c2('0x31')]),_0xefbf7a);if(_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]){_0x228971[_0xc9c2('0x39')]=_[_0xc9c2('0x3c')](_0x228971[_0xc9c2('0x39')],{'$or':_[_0xc9c2('0x2b')](_0xefbf7a,function(_0x42b8ec){if(_0x42b8ec[_0xc9c2('0x2f')]!=='VIRTUAL'){var _0x4c3bc0={};_0x4c3bc0[_0x42b8ec[_0xc9c2('0x29')]]={'$like':'%'+_0x55b9c6[_0xc9c2('0x30')][_0xc9c2('0x3b')]+'%'};return _0x4c3bc0;}})});}_0x228971=_[_0xc9c2('0x3c')]({},_0x228971,_0x55b9c6[_0xc9c2('0x3d')]);var _0x394050={'where':_0x228971['where']};return db[_0xc9c2('0x2c')][_0xc9c2('0x1c')](_0x394050)[_0xc9c2('0x22')](function(_0x46c740){_0x49fcd3[_0xc9c2('0x1c')]=_0x46c740;if(_0x55b9c6['query'][_0xc9c2('0x3e')]){_0x228971[_0xc9c2('0x3f')]=[{'all':!![]}];}return db[_0xc9c2('0x2c')]['findAll'](_0x228971);})[_0xc9c2('0x22')](function(_0xd3d946){_0x49fcd3[_0xc9c2('0x40')]=_0xd3d946;return _0x49fcd3;})[_0xc9c2('0x22')](respondWithFilteredResult(_0x4a9fca,_0x228971))[_0xc9c2('0x41')](handleError(_0x4a9fca,null));};exports['show']=function(_0x54857b,_0x136dfb){var _0x75de3={'raw':![],'where':{'id':_0x54857b[_0xc9c2('0x42')]['id']}},_0x4df180={};_0x4df180[_0xc9c2('0x33')]=_[_0xc9c2('0x43')](db[_0xc9c2('0x2c')][_0xc9c2('0x2d')]);_0x4df180[_0xc9c2('0x30')]=_[_0xc9c2('0x43')](_0x54857b['query']);_0x4df180[_0xc9c2('0x31')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],_0x4df180['query']);_0x75de3[_0xc9c2('0x35')]=_['intersection'](_0x4df180[_0xc9c2('0x33')],qs['fields'](_0x54857b[_0xc9c2('0x30')][_0xc9c2('0x34')]));_0x75de3[_0xc9c2('0x35')]=_0x75de3[_0xc9c2('0x35')][_0xc9c2('0x36')]?_0x75de3[_0xc9c2('0x35')]:_0x4df180[_0xc9c2('0x33')];if(_0x54857b['query'][_0xc9c2('0x3e')]){_0x75de3[_0xc9c2('0x3f')]=[{'all':!![]}];}_0x75de3=_[_0xc9c2('0x3c')]({},_0x75de3,_0x54857b[_0xc9c2('0x3d')]);return db[_0xc9c2('0x2c')][_0xc9c2('0x44')](_0x75de3)['then'](handleEntityNotFound(_0x136dfb,null))[_0xc9c2('0x22')](respondWithResult(_0x136dfb,null))[_0xc9c2('0x41')](handleError(_0x136dfb,null));};exports[_0xc9c2('0x45')]=function(_0x88fa84,_0x2e9925){return db[_0xc9c2('0x2c')][_0xc9c2('0x45')](_0x88fa84[_0xc9c2('0x46')],{})['then'](function(_0x44d1bb){var _0x7aff01=_0x88fa84[_0xc9c2('0x47')][_0xc9c2('0x24')]({'plain':!![]});if(!_0x7aff01)throw new Error(_0xc9c2('0x48'));if(_0x7aff01['role']===_0xc9c2('0x47')){var _0x4e2589=_0x44d1bb[_0xc9c2('0x24')]({'plain':!![]});var _0x5c8933=_0xc9c2('0x25');return db['UserProfileSection'][_0xc9c2('0x44')]({'where':{'name':_0x5c8933,'userProfileId':_0x7aff01['userProfileId']},'raw':!![]})['then'](function(_0x13bcbd){if(_0x13bcbd&&_0x13bcbd[_0xc9c2('0x49')]===0x0){return db[_0xc9c2('0x26')][_0xc9c2('0x45')]({'name':_0x4e2589[_0xc9c2('0x29')],'resourceId':_0x4e2589['id'],'type':_0x13bcbd[_0xc9c2('0x29')],'sectionId':_0x13bcbd['id']},{})[_0xc9c2('0x22')](function(){return _0x44d1bb;});}else{return _0x44d1bb;}})[_0xc9c2('0x41')](function(_0x3f8fce){logger[_0xc9c2('0x27')](_0xc9c2('0x4a'),_0x3f8fce);throw _0x3f8fce;});}return _0x44d1bb;})['then'](respondWithResult(_0x2e9925,0xc9))[_0xc9c2('0x41')](handleError(_0x2e9925,null));};exports[_0xc9c2('0x21')]=function(_0x568de4,_0x8a840){if(_0x568de4[_0xc9c2('0x46')]['id']){delete _0x568de4[_0xc9c2('0x46')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x568de4[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x8a840,null))[_0xc9c2('0x22')](saveUpdates(_0x568de4[_0xc9c2('0x46')],null))[_0xc9c2('0x22')](respondWithResult(_0x8a840,null))[_0xc9c2('0x41')](handleError(_0x8a840,null));};exports[_0xc9c2('0x23')]=function(_0x42905b,_0x158632){return db[_0xc9c2('0x2c')][_0xc9c2('0x44')]({'where':{'id':_0x42905b[_0xc9c2('0x42')]['id']}})[_0xc9c2('0x22')](handleEntityNotFound(_0x158632,null))[_0xc9c2('0x22')](removeEntity(_0x158632,null))[_0xc9c2('0x41')](handleError(_0x158632,null));}; \ No newline at end of file +var _0xc3b0=['pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where'];(function(_0x2e0bed,_0x24b28d){var _0x45e74e=function(_0x36166d){while(--_0x36166d){_0x2e0bed['push'](_0x2e0bed['shift']());}};_0x45e74e(++_0x24b28d);}(_0xc3b0,0x166));var _0x0c3b=function(_0xa8b6f0,_0x403daf){_0xa8b6f0=_0xa8b6f0-0x0;var _0x57caed=_0xc3b0[_0xa8b6f0];return _0x57caed;};'use strict';var emlformat=require(_0x0c3b('0x0'));var rimraf=require(_0x0c3b('0x1'));var zipdir=require(_0x0c3b('0x2'));var jsonpatch=require(_0x0c3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c3b('0x4'));var Mustache=require(_0x0c3b('0x5'));var util=require('util');var path=require(_0x0c3b('0x6'));var sox=require(_0x0c3b('0x7'));var csv=require(_0x0c3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c3b('0x9'));var _=require(_0x0c3b('0xa'));var squel=require(_0x0c3b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c3b('0x8'));var querystring=require(_0x0c3b('0xc'));var Papa=require(_0x0c3b('0xd'));var Redis=require(_0x0c3b('0xe'));var authService=require(_0x0c3b('0xf'));var qs=require(_0x0c3b('0x10'));var as=require(_0x0c3b('0x11'));var hardwareService=require(_0x0c3b('0x12'));var logger=require(_0x0c3b('0x13'))(_0x0c3b('0x14'));var utils=require(_0x0c3b('0x15'));var config=require(_0x0c3b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c3b('0x17'))['db'];function respondWithStatusCode(_0x5ba38d,_0x46ccb2){_0x46ccb2=_0x46ccb2||0xcc;return function(_0x4a6eff){if(_0x4a6eff){return _0x5ba38d[_0x0c3b('0x18')](_0x46ccb2);}return _0x5ba38d[_0x0c3b('0x19')](_0x46ccb2)[_0x0c3b('0x1a')]();};}function respondWithResult(_0x2bbfd1,_0x8bf2fd){_0x8bf2fd=_0x8bf2fd||0xc8;return function(_0x7a0b0a){if(_0x7a0b0a){return _0x2bbfd1['status'](_0x8bf2fd)[_0x0c3b('0x1b')](_0x7a0b0a);}};}function respondWithFilteredResult(_0x5b6e54,_0x57d16c){return function(_0x292e67){if(_0x292e67){var _0x35f261=typeof _0x57d16c[_0x0c3b('0x1c')]===_0x0c3b('0x1d')&&typeof _0x57d16c[_0x0c3b('0x1e')]==='undefined';var _0x5aedbd=_0x292e67[_0x0c3b('0x1f')];var _0xeaeeca=_0x35f261?0x0:_0x57d16c[_0x0c3b('0x1c')];var _0x55c08d=_0x35f261?_0x292e67[_0x0c3b('0x1f')]:_0x57d16c[_0x0c3b('0x1c')]+_0x57d16c[_0x0c3b('0x1e')];var _0x1e8ae4;if(_0x55c08d>=_0x5aedbd){_0x55c08d=_0x5aedbd;_0x1e8ae4=0xc8;}else{_0x1e8ae4=0xce;}_0x5b6e54[_0x0c3b('0x19')](_0x1e8ae4);return _0x5b6e54[_0x0c3b('0x20')](_0x0c3b('0x21'),_0xeaeeca+'-'+_0x55c08d+'/'+_0x5aedbd)['json'](_0x292e67);}return null;};}function patchUpdates(_0x31bdf3){return function(_0x55072f){try{jsonpatch[_0x0c3b('0x22')](_0x55072f,_0x31bdf3,!![]);}catch(_0x2a6913){return BPromise[_0x0c3b('0x23')](_0x2a6913);}return _0x55072f[_0x0c3b('0x24')]();};}function saveUpdates(_0x56a97e,_0x1932b3){return function(_0x1f9f16){if(_0x1f9f16){return _0x1f9f16[_0x0c3b('0x25')](_0x56a97e)[_0x0c3b('0x26')](function(_0x57b63b){return _0x57b63b;});}return null;};}function removeEntity(_0x30a2e0,_0x4453fd){return function(_0x413cc9){if(_0x413cc9){return _0x413cc9[_0x0c3b('0x27')]()[_0x0c3b('0x26')](function(){var _0x54fba6=_0x413cc9[_0x0c3b('0x28')]({'plain':!![]});var _0x50b315=_0x0c3b('0x29');return db[_0x0c3b('0x2a')][_0x0c3b('0x27')]({'where':{'type':_0x50b315,'resourceId':_0x54fba6['id']}})['then'](function(){return _0x413cc9;});})[_0x0c3b('0x26')](function(){_0x30a2e0[_0x0c3b('0x19')](0xcc)[_0x0c3b('0x1a')]();});}};}function handleEntityNotFound(_0x10b0fd,_0x2d5f44){return function(_0x1272ea){if(!_0x1272ea){_0x10b0fd['sendStatus'](0x194);}return _0x1272ea;};}function handleError(_0x4ff915,_0x55d021){_0x55d021=_0x55d021||0x1f4;return function(_0x4a78f9){logger[_0x0c3b('0x2b')](_0x4a78f9[_0x0c3b('0x2c')]);if(_0x4a78f9['name']){delete _0x4a78f9[_0x0c3b('0x2d')];}_0x4ff915[_0x0c3b('0x19')](_0x55d021)[_0x0c3b('0x2e')](_0x4a78f9);};}exports['index']=function(_0x1b221b,_0x4694c3){var _0x1dd8d6={},_0x29c775={},_0x5c50e1={'count':0x0,'rows':[]};var _0x3a9eac=_[_0x0c3b('0x2f')](db[_0x0c3b('0x30')][_0x0c3b('0x31')],function(_0x27137c){return{'name':_0x27137c['fieldName'],'type':_0x27137c[_0x0c3b('0x32')][_0x0c3b('0x33')]};});_0x29c775[_0x0c3b('0x34')]=_[_0x0c3b('0x2f')](_0x3a9eac,_0x0c3b('0x2d'));_0x29c775[_0x0c3b('0x35')]=_[_0x0c3b('0x36')](_0x1b221b['query']);_0x29c775[_0x0c3b('0x37')]=_['intersection'](_0x29c775[_0x0c3b('0x34')],_0x29c775[_0x0c3b('0x35')]);_0x1dd8d6['attributes']=_[_0x0c3b('0x38')](_0x29c775[_0x0c3b('0x34')],qs[_0x0c3b('0x39')](_0x1b221b[_0x0c3b('0x35')]['fields']));_0x1dd8d6[_0x0c3b('0x3a')]=_0x1dd8d6[_0x0c3b('0x3a')]['length']?_0x1dd8d6[_0x0c3b('0x3a')]:_0x29c775[_0x0c3b('0x34')];if(!_0x1b221b[_0x0c3b('0x35')]['hasOwnProperty'](_0x0c3b('0x3b'))){_0x1dd8d6['limit']=qs[_0x0c3b('0x1e')](_0x1b221b['query'][_0x0c3b('0x1e')]);_0x1dd8d6[_0x0c3b('0x1c')]=qs[_0x0c3b('0x1c')](_0x1b221b['query']['offset']);}_0x1dd8d6['order']=qs[_0x0c3b('0x3c')](_0x1b221b[_0x0c3b('0x35')][_0x0c3b('0x3c')]);_0x1dd8d6[_0x0c3b('0x3d')]=qs['filters'](_[_0x0c3b('0x3e')](_0x1b221b[_0x0c3b('0x35')],_0x29c775[_0x0c3b('0x37')]),_0x3a9eac);if(_0x1b221b[_0x0c3b('0x35')][_0x0c3b('0x3f')]){_0x1dd8d6[_0x0c3b('0x3d')]=_[_0x0c3b('0x40')](_0x1dd8d6[_0x0c3b('0x3d')],{'$or':_[_0x0c3b('0x2f')](_0x3a9eac,function(_0x42dfc8){if(_0x42dfc8[_0x0c3b('0x32')]!==_0x0c3b('0x41')){var _0x28391c={};_0x28391c[_0x42dfc8[_0x0c3b('0x2d')]]={'$like':'%'+_0x1b221b['query'][_0x0c3b('0x3f')]+'%'};return _0x28391c;}})});}_0x1dd8d6=_[_0x0c3b('0x40')]({},_0x1dd8d6,_0x1b221b[_0x0c3b('0x42')]);var _0x1d66f1={'where':_0x1dd8d6[_0x0c3b('0x3d')]};return db[_0x0c3b('0x30')][_0x0c3b('0x1f')](_0x1d66f1)[_0x0c3b('0x26')](function(_0x4290c5){_0x5c50e1[_0x0c3b('0x1f')]=_0x4290c5;if(_0x1b221b[_0x0c3b('0x35')]['includeAll']){_0x1dd8d6[_0x0c3b('0x43')]=[{'all':!![]}];}return db[_0x0c3b('0x30')][_0x0c3b('0x44')](_0x1dd8d6);})[_0x0c3b('0x26')](function(_0x50878b){_0x5c50e1[_0x0c3b('0x45')]=_0x50878b;return _0x5c50e1;})[_0x0c3b('0x26')](respondWithFilteredResult(_0x4694c3,_0x1dd8d6))[_0x0c3b('0x46')](handleError(_0x4694c3,null));};exports['show']=function(_0x271553,_0x1f6fbc){var _0x55b912={'raw':![],'where':{'id':_0x271553[_0x0c3b('0x47')]['id']}},_0x1e924f={};_0x1e924f[_0x0c3b('0x34')]=_['keys'](db['VoiceChanSpy'][_0x0c3b('0x31')]);_0x1e924f[_0x0c3b('0x35')]=_[_0x0c3b('0x36')](_0x271553[_0x0c3b('0x35')]);_0x1e924f[_0x0c3b('0x37')]=_[_0x0c3b('0x38')](_0x1e924f[_0x0c3b('0x34')],_0x1e924f[_0x0c3b('0x35')]);_0x55b912['attributes']=_[_0x0c3b('0x38')](_0x1e924f[_0x0c3b('0x34')],qs['fields'](_0x271553[_0x0c3b('0x35')][_0x0c3b('0x39')]));_0x55b912['attributes']=_0x55b912[_0x0c3b('0x3a')][_0x0c3b('0x48')]?_0x55b912[_0x0c3b('0x3a')]:_0x1e924f[_0x0c3b('0x34')];if(_0x271553[_0x0c3b('0x35')][_0x0c3b('0x49')]){_0x55b912[_0x0c3b('0x43')]=[{'all':!![]}];}_0x55b912=_[_0x0c3b('0x40')]({},_0x55b912,_0x271553[_0x0c3b('0x42')]);return db[_0x0c3b('0x30')][_0x0c3b('0x4a')](_0x55b912)[_0x0c3b('0x26')](handleEntityNotFound(_0x1f6fbc,null))['then'](respondWithResult(_0x1f6fbc,null))['catch'](handleError(_0x1f6fbc,null));};exports[_0x0c3b('0x4b')]=function(_0x171118,_0xe6b22a){return db[_0x0c3b('0x30')]['create'](_0x171118['body'],{})[_0x0c3b('0x26')](function(_0x41c26b){var _0x3bf159=_0x171118[_0x0c3b('0x4c')]['get']({'plain':!![]});if(!_0x3bf159)throw new Error(_0x0c3b('0x4d'));if(_0x3bf159[_0x0c3b('0x4e')]===_0x0c3b('0x4c')){var _0x4809a2=_0x41c26b[_0x0c3b('0x28')]({'plain':!![]});var _0x3413e8=_0x0c3b('0x29');return db[_0x0c3b('0x4f')][_0x0c3b('0x4a')]({'where':{'name':_0x3413e8,'userProfileId':_0x3bf159[_0x0c3b('0x50')]},'raw':!![]})[_0x0c3b('0x26')](function(_0x111314){if(_0x111314&&_0x111314[_0x0c3b('0x51')]===0x0){return db[_0x0c3b('0x2a')][_0x0c3b('0x4b')]({'name':_0x4809a2[_0x0c3b('0x2d')],'resourceId':_0x4809a2['id'],'type':_0x111314['name'],'sectionId':_0x111314['id']},{})[_0x0c3b('0x26')](function(){return _0x41c26b;});}else{return _0x41c26b;}})['catch'](function(_0x66c545){logger[_0x0c3b('0x2b')](_0x0c3b('0x52'),_0x66c545);throw _0x66c545;});}return _0x41c26b;})[_0x0c3b('0x26')](respondWithResult(_0xe6b22a,0xc9))[_0x0c3b('0x46')](handleError(_0xe6b22a,null));};exports[_0x0c3b('0x25')]=function(_0x59c375,_0x20e33e){if(_0x59c375[_0x0c3b('0x53')]['id']){delete _0x59c375[_0x0c3b('0x53')]['id'];}return db[_0x0c3b('0x30')][_0x0c3b('0x4a')]({'where':{'id':_0x59c375[_0x0c3b('0x47')]['id']}})[_0x0c3b('0x26')](handleEntityNotFound(_0x20e33e,null))['then'](saveUpdates(_0x59c375[_0x0c3b('0x53')],null))['then'](respondWithResult(_0x20e33e,null))['catch'](handleError(_0x20e33e,null));};exports[_0x0c3b('0x27')]=function(_0x12fc5a,_0x10f703){return db['VoiceChanSpy'][_0x0c3b('0x4a')]({'where':{'id':_0x12fc5a[_0x0c3b('0x47')]['id']}})[_0x0c3b('0x26')](handleEntityNotFound(_0x10f703,null))[_0x0c3b('0x26')](removeEntity(_0x10f703,null))['catch'](handleError(_0x10f703,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 3010119..80bf84d 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 _0xf83b=['bluebird','context','from-sip','%s%s','Set','format','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','join','concat','internal','User','findAll','agent','then','catch','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','lodash'];(function(_0x15b344,_0x3dcb66){var _0x37022c=function(_0xfa6558){while(--_0xfa6558){_0x15b344['push'](_0x15b344['shift']());}};_0x37022c(++_0x3dcb66);}(_0xf83b,0xe6));var _0xbf83=function(_0x19d347,_0x4da4cc){_0x19d347=_0x19d347-0x0;var _0x286d56=_0xf83b[_0x19d347];return _0x286d56;};'use strict';var _=require(_0xbf83('0x0'));var util=require('util');var BPromise=require(_0xbf83('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x175b1d,_0x320bf1,_0x531da8){var _0x1adc51=0x1;var _0x17acdf=[];var _0x114d11={'context':_0x320bf1[_0xbf83('0x2')]||_0xbf83('0x3'),'exten':util['format'](_0xbf83('0x4'),_0x175b1d['prefix'],_0x531da8),'type':'system','isApp':![],'ChanSpyId':_0x175b1d['id'],'UserId':_0x320bf1['id']};_0x17acdf['push'](_['merge']({'app':_0xbf83('0x5'),'appdata':util[_0xbf83('0x6')](_0xbf83('0x7'),_0xbf83('0x8')),'priority':_0x1adc51++},_0x114d11));if(_0x175b1d[_0xbf83('0x9')]){_0x17acdf[_0xbf83('0xa')](_[_0xbf83('0xb')]({'app':_0xbf83('0xc'),'appdata':util[_0xbf83('0x6')]('${UNIQUEID}.%s,a',_0x175b1d[_0xbf83('0xd')]),'priority':_0x1adc51++},_0x114d11));}if(_0x175b1d['auth']){_0x17acdf[_0xbf83('0xa')](_[_0xbf83('0xb')]({'app':_0xbf83('0xe'),'appdata':_0x175b1d[_0xbf83('0xf')],'priority':_0x1adc51++},_0x114d11));}_0x17acdf[_0xbf83('0xa')](_['merge']({'app':'ChanSpy','appdata':util[_0xbf83('0x6')](_0xbf83('0x10'),_0x320bf1[_0xbf83('0x11')],_0x175b1d[_0xbf83('0x12')]?_0x175b1d['options'][_0xbf83('0x13')](''):''),'priority':_0x1adc51++},_0x114d11));if(_0x175b1d[_0xbf83('0x9')]){_0x17acdf['push'](_['merge']({'app':'StopMixMonitor','priority':_0x1adc51++},_0x114d11));}return _0x17acdf;};var getChanSpyApplications=function(_0x48408e,_0x573983){var _0x398611=[];for(var _0x1c3e18=0x0,_0x35cda5=0x1;_0x1c3e18<_0x573983['length'];_0x1c3e18++,_0x35cda5=0x1){_0x398611=_0x398611[_0xbf83('0x14')](getUserApplications(_0x48408e,_0x573983[_0x1c3e18],_0x573983[_0x1c3e18][_0xbf83('0x15')]));if(_0x573983[_0x1c3e18]['internal']!=_0x573983[_0x1c3e18][_0xbf83('0x11')]){_0x398611=_0x398611['concat'](getUserApplications(_0x48408e,_0x573983[_0x1c3e18],_0x573983[_0x1c3e18][_0xbf83('0x11')]));}}return _0x398611;};var getChanSpyPromise=function(_0x14c68c,_0x196a9d){return new BPromise(function(_0x23fdb8,_0x2c13ad){return _0x14c68c[_0xbf83('0x16')][_0xbf83('0x17')]({'attributes':['id','name',_0xbf83('0x15')],'where':{'role':_0xbf83('0x18'),'chanspy':!![]},'raw':!![]})[_0xbf83('0x19')](function(_0x288f2b){if(_0x288f2b){return _0x23fdb8(getChanSpyApplications(_0x196a9d,_0x288f2b));}return _0x23fdb8([]);})[_0xbf83('0x1a')](function(_0x33bde9){_0x2c13ad(_0x33bde9);});});};module['exports']=function(_0x58e14f,_0x5f851a){var _0x48db78=_0x58e14f['models'];return _0x58e14f['define'](_0xbf83('0x1b'),attributes,{'tableName':_0xbf83('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f0c15,_0x10c607,_0x443897){return getChanSpyPromise(_0x48db78,_0x4f0c15)['then'](function(_0x3346cb){if(_0x3346cb&&_0x3346cb[_0xbf83('0x1d')]){return _0x48db78['VoiceExtension'][_0xbf83('0x1e')](_0x3346cb);}})['then'](function(){_0x443897();})['catch'](function(_0x31fb8a){_0x443897(_0x31fb8a);});},'afterUpdate':function(_0x4e0ba2,_0x4bb9be,_0x2d98d7){return _0x48db78[_0xbf83('0x1f')]['destroy']({'where':{'ChanSpyId':_0x4e0ba2['id']}})[_0xbf83('0x19')](function(){return getChanSpyPromise(_0x48db78,_0x4e0ba2);})[_0xbf83('0x19')](function(_0x2f69ff){if(_0x2f69ff&&_0x2f69ff['length']){return _0x48db78[_0xbf83('0x1f')]['bulkCreate'](_0x2f69ff);}})[_0xbf83('0x19')](function(){_0x2d98d7();})[_0xbf83('0x1a')](function(_0x56a482){_0x2d98d7(_0x56a482);});},'afterDestroy':function(_0x35218b,_0x2deb67,_0x544c57){return _0x48db78['VoiceExtension'][_0xbf83('0x20')]({'where':{'ChanSpyId':_0x35218b['id']}})['then'](function(){_0x544c57();})[_0xbf83('0x1a')](function(_0x212663){_0x544c57(_0x212663);});}}});}; \ No newline at end of file +var _0x72a1=['bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','util'];(function(_0x2b5d2c,_0x2819ac){var _0x4ab6a3=function(_0x1b8fe5){while(--_0x1b8fe5){_0x2b5d2c['push'](_0x2b5d2c['shift']());}};_0x4ab6a3(++_0x2819ac);}(_0x72a1,0x96));var _0x172a=function(_0x4c07a8,_0x443826){_0x4c07a8=_0x4c07a8-0x0;var _0xd99a9=_0x72a1[_0x4c07a8];return _0xd99a9;};'use strict';var _=require(_0x172a('0x0'));var util=require(_0x172a('0x1'));var BPromise=require(_0x172a('0x2'));var attributes=require(_0x172a('0x3'));var getUserApplications=function(_0x31bcdc,_0x5e90e6,_0x5e7127){var _0x5ddbd9=0x1;var _0xbc7c7a=[];var _0x486ae7={'context':_0x5e90e6['context']||_0x172a('0x4'),'exten':util[_0x172a('0x5')](_0x172a('0x6'),_0x31bcdc['prefix'],_0x5e7127),'type':_0x172a('0x7'),'isApp':![],'ChanSpyId':_0x31bcdc['id'],'UserId':_0x5e90e6['id']};_0xbc7c7a[_0x172a('0x8')](_[_0x172a('0x9')]({'app':_0x172a('0xa'),'appdata':util[_0x172a('0x5')]('CDR(type)=%s',_0x172a('0xb')),'priority':_0x5ddbd9++},_0x486ae7));if(_0x31bcdc[_0x172a('0xc')]){_0xbc7c7a[_0x172a('0x8')](_[_0x172a('0x9')]({'app':_0x172a('0xd'),'appdata':util[_0x172a('0x5')](_0x172a('0xe'),_0x31bcdc[_0x172a('0xf')]),'priority':_0x5ddbd9++},_0x486ae7));}if(_0x31bcdc[_0x172a('0x10')]){_0xbc7c7a[_0x172a('0x8')](_[_0x172a('0x9')]({'app':_0x172a('0x11'),'appdata':_0x31bcdc[_0x172a('0x12')],'priority':_0x5ddbd9++},_0x486ae7));}_0xbc7c7a['push'](_[_0x172a('0x9')]({'app':'ChanSpy','appdata':util[_0x172a('0x5')](_0x172a('0x13'),_0x5e90e6[_0x172a('0x14')],_0x31bcdc[_0x172a('0x15')]?_0x31bcdc['options'][_0x172a('0x16')](''):''),'priority':_0x5ddbd9++},_0x486ae7));if(_0x31bcdc[_0x172a('0xc')]){_0xbc7c7a[_0x172a('0x8')](_[_0x172a('0x9')]({'app':_0x172a('0x17'),'priority':_0x5ddbd9++},_0x486ae7));}return _0xbc7c7a;};var getChanSpyApplications=function(_0x18e21a,_0x61a875){var _0x37ab33=[];for(var _0x24cee8=0x0,_0x5ab91b=0x1;_0x24cee8<_0x61a875[_0x172a('0x18')];_0x24cee8++,_0x5ab91b=0x1){_0x37ab33=_0x37ab33[_0x172a('0x19')](getUserApplications(_0x18e21a,_0x61a875[_0x24cee8],_0x61a875[_0x24cee8][_0x172a('0x1a')]));if(_0x61a875[_0x24cee8][_0x172a('0x1a')]!=_0x61a875[_0x24cee8][_0x172a('0x14')]){_0x37ab33=_0x37ab33[_0x172a('0x19')](getUserApplications(_0x18e21a,_0x61a875[_0x24cee8],_0x61a875[_0x24cee8][_0x172a('0x14')]));}}return _0x37ab33;};var getChanSpyPromise=function(_0x137ae1,_0x55393b){return new BPromise(function(_0x50e13f,_0x2de9f0){return _0x137ae1['User'][_0x172a('0x1b')]({'attributes':['id',_0x172a('0x14'),_0x172a('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x5d2783){if(_0x5d2783){return _0x50e13f(getChanSpyApplications(_0x55393b,_0x5d2783));}return _0x50e13f([]);})[_0x172a('0x1c')](function(_0x814d86){_0x2de9f0(_0x814d86);});});};module[_0x172a('0x1d')]=function(_0x1ced8c,_0x488637){var _0x2b8940=_0x1ced8c[_0x172a('0x1e')];return _0x1ced8c[_0x172a('0x1f')](_0x172a('0x20'),attributes,{'tableName':_0x172a('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1492c5,_0x41f8dd,_0x362655){return getChanSpyPromise(_0x2b8940,_0x1492c5)[_0x172a('0x22')](function(_0x1c9222){if(_0x1c9222&&_0x1c9222['length']){return _0x2b8940['VoiceExtension'][_0x172a('0x23')](_0x1c9222);}})[_0x172a('0x22')](function(){_0x362655();})[_0x172a('0x1c')](function(_0x11e603){_0x362655(_0x11e603);});},'afterUpdate':function(_0x553518,_0x3ad171,_0x323e0a){return _0x2b8940[_0x172a('0x24')][_0x172a('0x25')]({'where':{'ChanSpyId':_0x553518['id']}})[_0x172a('0x22')](function(){return getChanSpyPromise(_0x2b8940,_0x553518);})[_0x172a('0x22')](function(_0x4790b6){if(_0x4790b6&&_0x4790b6['length']){return _0x2b8940['VoiceExtension'][_0x172a('0x23')](_0x4790b6);}})['then'](function(){_0x323e0a();})['catch'](function(_0x46c3da){_0x323e0a(_0x46c3da);});},'afterDestroy':function(_0x46a294,_0x52e8ee,_0x3f2eae){return _0x2b8940['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x46a294['id']}})[_0x172a('0x22')](function(){_0x3f2eae();})[_0x172a('0x1c')](function(_0x31dae5){_0x3f2eae(_0x31dae5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4914f5c..f8fb8f9 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 _0xa25c=['message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x579daf,_0x2f946e){var _0x46078f=function(_0x11282c){while(--_0x11282c){_0x579daf['push'](_0x579daf['shift']());}};_0x46078f(++_0x2f946e);}(_0xa25c,0x13f));var _0xca25=function(_0x383f90,_0x42edf5){_0x383f90=_0x383f90-0x0;var _0x101752=_0xa25c[_0x383f90];return _0x101752;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9352,_0xb2fc94,_0x3cee89){return new BPromise(function(_0x2c0b8c,_0x42a97a){return client[_0xca25('0xa')](_0x4e9352,_0x3cee89)['then'](function(_0x5d820c){logger[_0xca25('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0xca25('0xc'));logger[_0xca25('0xd')](_0xca25('0xe'),_0xb2fc94,'request\x20sent',JSON['stringify'](_0x5d820c));if(_0x5d820c['error']){if(_0x5d820c[_0xca25('0xf')][_0xca25('0x10')]===0x1f4){logger[_0xca25('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xb2fc94,_0x5d820c['error'][_0xca25('0x11')]);return _0x42a97a(_0x5d820c['error'][_0xca25('0x11')]);}logger[_0xca25('0xf')](_0xca25('0x12'),_0xb2fc94,_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);return _0x2c0b8c(_0x5d820c[_0xca25('0xf')][_0xca25('0x11')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0xb2fc94,_0xca25('0xc'));_0x2c0b8c(_0x5d820c[_0xca25('0x13')]['message']);}})[_0xca25('0x14')](function(_0x340c9b){logger['error'](_0xca25('0x12'),_0xb2fc94,_0x340c9b);_0x42a97a(_0x340c9b);});});} \ No newline at end of file +var _0x5db8=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5db8,0xbb));var _0x85db=function(_0x23c651,_0x143982){_0x23c651=_0x23c651-0x0;var _0xbe7bdb=_0x5db8[_0x23c651];return _0xbe7bdb;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index dbebc42..30bfae3 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 _0x8513=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','delete','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8513,0x12e));var _0x3851=function(_0x9c31b0,_0x448ee5){_0x9c31b0=_0x9c31b0-0x0;var _0x3113bd=_0x8513[_0x9c31b0];return _0x3113bd;};'use strict';var multer=require(_0x3851('0x0'));var util=require(_0x3851('0x1'));var path=require(_0x3851('0x2'));var timeout=require(_0x3851('0x3'));var express=require(_0x3851('0x4'));var router=express[_0x3851('0x5')]();var fs_extra=require(_0x3851('0x6'));var auth=require(_0x3851('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3851('0x8'));var controller=require('./voiceContext.controller');router[_0x3851('0x9')]('/',auth['isAuthenticated'](),controller[_0x3851('0xa')]);router[_0x3851('0x9')](_0x3851('0xb'),auth[_0x3851('0xc')](),controller['show']);router['post']('/',auth[_0x3851('0xc')](),controller['create']);router[_0x3851('0xd')](_0x3851('0xb'),auth['isAuthenticated'](),controller[_0x3851('0xe')]);router[_0x3851('0xf')](_0x3851('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd1c4=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd1c4,0x16a));var _0x4d1c=function(_0x5a7a3f,_0x5cfe61){_0x5a7a3f=_0x5a7a3f-0x0;var _0x5c6278=_0xd1c4[_0x5a7a3f];return _0x5c6278;};'use strict';var multer=require(_0x4d1c('0x0'));var util=require(_0x4d1c('0x1'));var path=require(_0x4d1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d1c('0x3'));var router=express[_0x4d1c('0x4')]();var fs_extra=require(_0x4d1c('0x5'));var auth=require(_0x4d1c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4d1c('0x7'));var controller=require(_0x4d1c('0x8'));router[_0x4d1c('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d1c('0xa')]);router[_0x4d1c('0x9')]('/:id',auth[_0x4d1c('0xb')](),controller[_0x4d1c('0xc')]);router[_0x4d1c('0xd')]('/',auth[_0x4d1c('0xb')](),controller[_0x4d1c('0xe')]);router['put'](_0x4d1c('0xf'),auth[_0x4d1c('0xb')](),controller[_0x4d1c('0x10')]);router[_0x4d1c('0x11')](_0x4d1c('0xf'),auth[_0x4d1c('0xb')](),controller[_0x4d1c('0x12')]);module[_0x4d1c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 5674ac4..bbc9955 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 _0x8ae8=['name','BOOLEAN','sequelize','STRING'];(function(_0x336b65,_0x3f857a){var _0xb8017f=function(_0x332113){while(--_0x332113){_0x336b65['push'](_0x336b65['shift']());}};_0xb8017f(++_0x3f857a);}(_0x8ae8,0xd2));var _0x88ae=function(_0x553145,_0x4f9ab8){_0x553145=_0x553145-0x0;var _0x11cfbd=_0x8ae8[_0x553145];return _0x11cfbd;};'use strict';var Sequelize=require(_0x88ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x88ae('0x1')],'unique':_0x88ae('0x2')},'description':{'type':Sequelize[_0x88ae('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x88ae('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea88=['exports','STRING','name'];(function(_0x202191,_0x8fafbc){var _0x3a4bc9=function(_0x127674){while(--_0x127674){_0x202191['push'](_0x202191['shift']());}};_0x3a4bc9(++_0x8fafbc);}(_0xea88,0x153));var _0x8ea8=function(_0x185c84,_0x552840){_0x185c84=_0x185c84-0x0;var _0x196be2=_0xea88[_0x185c84];return _0x196be2;};'use strict';var Sequelize=require('sequelize');module[_0x8ea8('0x0')]={'name':{'type':Sequelize[_0x8ea8('0x1')],'unique':_0x8ea8('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 49f9fd5..4419c6e 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 _0x6b6d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','UserProfileResource','end','stack','name','index','map','VoiceContext','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','show','params','length','includeAll','include','create','readFileSync','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','get','UserProfileSection','find','Contexts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b6d,0x1ee));var _0xd6b6=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x6b6d[_0x5ac84c];return _0x3c53d2;};'use strict';var emlformat=require(_0xd6b6('0x0'));var rimraf=require(_0xd6b6('0x1'));var zipdir=require(_0xd6b6('0x2'));var jsonpatch=require(_0xd6b6('0x3'));var rp=require(_0xd6b6('0x4'));var moment=require(_0xd6b6('0x5'));var BPromise=require(_0xd6b6('0x6'));var Mustache=require('mustache');var util=require(_0xd6b6('0x7'));var path=require(_0xd6b6('0x8'));var sox=require(_0xd6b6('0x9'));var csv=require('to-csv');var ejs=require(_0xd6b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6b6('0xb'));var squel=require('squel');var crypto=require(_0xd6b6('0xc'));var jsforce=require(_0xd6b6('0xd'));var deskjs=require(_0xd6b6('0xe'));var toCsv=require(_0xd6b6('0xf'));var querystring=require(_0xd6b6('0x10'));var Papa=require(_0xd6b6('0x11'));var Redis=require(_0xd6b6('0x12'));var authService=require(_0xd6b6('0x13'));var qs=require(_0xd6b6('0x14'));var as=require(_0xd6b6('0x15'));var hardwareService=require(_0xd6b6('0x16'));var logger=require(_0xd6b6('0x17'))('api');var utils=require(_0xd6b6('0x18'));var config=require(_0xd6b6('0x19'));var licenseUtil=require(_0xd6b6('0x1a'));var db=require(_0xd6b6('0x1b'))['db'];var jayson=require(_0xd6b6('0x1c'));var client=jayson[_0xd6b6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a685a,_0x1d5a96,_0x2f8295,_0x6f9e52){return new BPromise(function(_0x4b3d0a,_0x4d27f8){var _0x373666=_0x6f9e52||client;return _0x373666[_0xd6b6('0x1e')](_0x2a685a,_0x2f8295)[_0xd6b6('0x1f')](function(_0x4d7e89){logger['info'](_0xd6b6('0x20'),_0x1d5a96,_0xd6b6('0x21'));logger[_0xd6b6('0x22')](_0xd6b6('0x23'),_0x1d5a96,_0xd6b6('0x21'),JSON[_0xd6b6('0x24')](_0x4d7e89));if(_0x4d7e89[_0xd6b6('0x25')]){if(_0x4d7e89['error'][_0xd6b6('0x26')]===0x1f4){logger['error'](_0xd6b6('0x20'),_0x1d5a96,_0x4d7e89['error']['message']);return _0x4d27f8(_0x4d7e89[_0xd6b6('0x25')]['message']);}logger[_0xd6b6('0x25')](_0xd6b6('0x20'),_0x1d5a96,_0x4d7e89[_0xd6b6('0x25')]['message']);return _0x4b3d0a(_0x4d7e89['error'][_0xd6b6('0x27')]);}else{logger[_0xd6b6('0x28')](_0xd6b6('0x20'),_0x1d5a96,'request\x20sent');_0x4b3d0a(_0x4d7e89['result'][_0xd6b6('0x27')]);}})[_0xd6b6('0x29')](function(_0x5a762c){logger[_0xd6b6('0x25')](_0xd6b6('0x20'),_0x1d5a96,_0x5a762c);_0x4d27f8(_0x5a762c);});});}function respondWithStatusCode(_0x3b1837,_0x1b12ae){_0x1b12ae=_0x1b12ae||0xcc;return function(_0x4ebf36){if(_0x4ebf36){return _0x3b1837[_0xd6b6('0x2a')](_0x1b12ae);}return _0x3b1837[_0xd6b6('0x2b')](_0x1b12ae)['end']();};}function respondWithResult(_0x43ca1b,_0x46c02a){_0x46c02a=_0x46c02a||0xc8;return function(_0x594941){if(_0x594941){return _0x43ca1b[_0xd6b6('0x2b')](_0x46c02a)[_0xd6b6('0x2c')](_0x594941);}};}function respondWithFilteredResult(_0x5df5dd,_0x2aa075){return function(_0x315e5d){if(_0x315e5d){var _0x3a2805=typeof _0x2aa075['offset']==='undefined'&&typeof _0x2aa075['limit']==='undefined';var _0x17a263=_0x315e5d[_0xd6b6('0x2d')];var _0x535674=_0x3a2805?0x0:_0x2aa075[_0xd6b6('0x2e')];var _0x3707d8=_0x3a2805?_0x315e5d[_0xd6b6('0x2d')]:_0x2aa075[_0xd6b6('0x2e')]+_0x2aa075[_0xd6b6('0x2f')];var _0x1c1faa;if(_0x3707d8>=_0x17a263){_0x3707d8=_0x17a263;_0x1c1faa=0xc8;}else{_0x1c1faa=0xce;}_0x5df5dd['status'](_0x1c1faa);return _0x5df5dd['set'](_0xd6b6('0x30'),_0x535674+'-'+_0x3707d8+'/'+_0x17a263)[_0xd6b6('0x2c')](_0x315e5d);}return null;};}function patchUpdates(_0x479f12){return function(_0x3b0a46){try{jsonpatch[_0xd6b6('0x31')](_0x3b0a46,_0x479f12,!![]);}catch(_0x340e82){return BPromise[_0xd6b6('0x32')](_0x340e82);}return _0x3b0a46[_0xd6b6('0x33')]();};}function saveUpdates(_0x3f187d,_0x26c306){return function(_0xafb930){if(_0xafb930){return _0xafb930['update'](_0x3f187d)[_0xd6b6('0x1f')](function(_0x2b94a2){return _0x2b94a2;});}return null;};}function removeEntity(_0x4ff466,_0x1a96d4){return function(_0x2e3ca0){if(_0x2e3ca0){return _0x2e3ca0[_0xd6b6('0x34')]()['then'](function(){var _0x5dc67a=_0x2e3ca0['get']({'plain':!![]});var _0x449e82='Contexts';return db[_0xd6b6('0x35')][_0xd6b6('0x34')]({'where':{'type':_0x449e82,'resourceId':_0x5dc67a['id']}})['then'](function(){return _0x2e3ca0;});})['then'](function(){_0x4ff466[_0xd6b6('0x2b')](0xcc)[_0xd6b6('0x36')]();});}};}function handleEntityNotFound(_0x26ddaa,_0x191a1c){return function(_0x27f62b){if(!_0x27f62b){_0x26ddaa['sendStatus'](0x194);}return _0x27f62b;};}function handleError(_0x5e02c7,_0x49ab0c){_0x49ab0c=_0x49ab0c||0x1f4;return function(_0x4e30a7){logger[_0xd6b6('0x25')](_0x4e30a7[_0xd6b6('0x37')]);if(_0x4e30a7[_0xd6b6('0x38')]){delete _0x4e30a7[_0xd6b6('0x38')];}_0x5e02c7['status'](_0x49ab0c)['send'](_0x4e30a7);};}exports[_0xd6b6('0x39')]=function(_0x1d5849,_0x737404){var _0xfd856b={},_0x3bcbd4={},_0x37e203={'count':0x0,'rows':[]};var _0x33af7f=_[_0xd6b6('0x3a')](db[_0xd6b6('0x3b')]['rawAttributes'],function(_0x1b27a6){return{'name':_0x1b27a6['fieldName'],'type':_0x1b27a6[_0xd6b6('0x3c')][_0xd6b6('0x3d')]};});_0x3bcbd4[_0xd6b6('0x3e')]=_[_0xd6b6('0x3a')](_0x33af7f,_0xd6b6('0x38'));_0x3bcbd4['query']=_[_0xd6b6('0x3f')](_0x1d5849[_0xd6b6('0x40')]);_0x3bcbd4[_0xd6b6('0x41')]=_[_0xd6b6('0x42')](_0x3bcbd4[_0xd6b6('0x3e')],_0x3bcbd4[_0xd6b6('0x40')]);_0xfd856b[_0xd6b6('0x43')]=_['intersection'](_0x3bcbd4[_0xd6b6('0x3e')],qs[_0xd6b6('0x44')](_0x1d5849[_0xd6b6('0x40')]['fields']));_0xfd856b[_0xd6b6('0x43')]=_0xfd856b[_0xd6b6('0x43')]['length']?_0xfd856b['attributes']:_0x3bcbd4['model'];if(!_0x1d5849[_0xd6b6('0x40')]['hasOwnProperty'](_0xd6b6('0x45'))){_0xfd856b[_0xd6b6('0x2f')]=qs[_0xd6b6('0x2f')](_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x2f')]);_0xfd856b[_0xd6b6('0x2e')]=qs[_0xd6b6('0x2e')](_0x1d5849[_0xd6b6('0x40')]['offset']);}_0xfd856b[_0xd6b6('0x46')]=qs['sort'](_0x1d5849['query'][_0xd6b6('0x47')]);_0xfd856b['where']=qs[_0xd6b6('0x41')](_[_0xd6b6('0x48')](_0x1d5849[_0xd6b6('0x40')],_0x3bcbd4[_0xd6b6('0x41')]),_0x33af7f);if(_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x49')]){_0xfd856b[_0xd6b6('0x4a')]=_[_0xd6b6('0x4b')](_0xfd856b[_0xd6b6('0x4a')],{'$or':_['map'](_0x33af7f,function(_0xc33707){if(_0xc33707[_0xd6b6('0x3c')]!==_0xd6b6('0x4c')){var _0x3cb81f={};_0x3cb81f[_0xc33707[_0xd6b6('0x38')]]={'$like':'%'+_0x1d5849[_0xd6b6('0x40')][_0xd6b6('0x49')]+'%'};return _0x3cb81f;}})});}_0xfd856b=_[_0xd6b6('0x4b')]({},_0xfd856b,_0x1d5849[_0xd6b6('0x4d')]);var _0x102786={'where':_0xfd856b[_0xd6b6('0x4a')]};return db['VoiceContext'][_0xd6b6('0x2d')](_0x102786)[_0xd6b6('0x1f')](function(_0x5edd15){_0x37e203[_0xd6b6('0x2d')]=_0x5edd15;if(_0x1d5849[_0xd6b6('0x40')]['includeAll']){_0xfd856b['include']=[{'all':!![]}];}return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')](_0xfd856b);})[_0xd6b6('0x1f')](function(_0x1c3b54){_0x37e203['rows']=_0x1c3b54;return _0x37e203;})[_0xd6b6('0x1f')](respondWithFilteredResult(_0x737404,_0xfd856b))[_0xd6b6('0x29')](handleError(_0x737404,null));};exports[_0xd6b6('0x4f')]=function(_0x571c6a,_0xbb1e2){var _0x17ed51={'raw':![],'where':{'id':_0x571c6a[_0xd6b6('0x50')]['id']}},_0x4c2635={};_0x4c2635[_0xd6b6('0x3e')]=_[_0xd6b6('0x3f')](db[_0xd6b6('0x3b')]['rawAttributes']);_0x4c2635['query']=_[_0xd6b6('0x3f')](_0x571c6a['query']);_0x4c2635[_0xd6b6('0x41')]=_[_0xd6b6('0x42')](_0x4c2635[_0xd6b6('0x3e')],_0x4c2635[_0xd6b6('0x40')]);_0x17ed51[_0xd6b6('0x43')]=_[_0xd6b6('0x42')](_0x4c2635[_0xd6b6('0x3e')],qs[_0xd6b6('0x44')](_0x571c6a[_0xd6b6('0x40')][_0xd6b6('0x44')]));_0x17ed51[_0xd6b6('0x43')]=_0x17ed51[_0xd6b6('0x43')][_0xd6b6('0x51')]?_0x17ed51[_0xd6b6('0x43')]:_0x4c2635[_0xd6b6('0x3e')];if(_0x571c6a[_0xd6b6('0x40')][_0xd6b6('0x52')]){_0x17ed51[_0xd6b6('0x53')]=[{'all':!![]}];}_0x17ed51=_[_0xd6b6('0x4b')]({},_0x17ed51,_0x571c6a['options']);return db[_0xd6b6('0x3b')]['find'](_0x17ed51)[_0xd6b6('0x1f')](handleEntityNotFound(_0xbb1e2,null))[_0xd6b6('0x1f')](respondWithResult(_0xbb1e2,null))[_0xd6b6('0x29')](handleError(_0xbb1e2,null));};exports['create']=function(_0x58c768,_0x2fac6b,_0x4ed53d){var _0x2afceb;return db[_0xd6b6('0x3b')][_0xd6b6('0x54')](_0x58c768['body'],{'raw':!![]})['then'](function(_0x5d49fb){_0x2afceb=_0x5d49fb;return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')]({'raw':!![]});})[_0xd6b6('0x1f')](function(_0x21e1be){var _0x479ebd=fs[_0xd6b6('0x55')](path['join'](config[_0xd6b6('0x56')],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x2d90ca=ejs[_0xd6b6('0x58')](_0x479ebd,{'contexts':_0x21e1be||[]});fs['writeFileSync'](_0xd6b6('0x59'),_0x2d90ca);})[_0xd6b6('0x1f')](function(){return respondWithRpcPromise(_0xd6b6('0x5a'),_0xd6b6('0x54'),{'module':_0xd6b6('0x5b')});})['then'](function(){var _0x378f91=_0x58c768[_0xd6b6('0x5c')]['get']({'plain':!![]});if(!_0x378f91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378f91[_0xd6b6('0x5d')]===_0xd6b6('0x5c')){var _0x265c00=_0x2afceb[_0xd6b6('0x5e')]({'plain':!![]});return db[_0xd6b6('0x5f')][_0xd6b6('0x60')]({'where':{'name':_0xd6b6('0x61'),'userProfileId':_0x378f91['userProfileId']},'raw':!![]})[_0xd6b6('0x1f')](function(_0x5bb593){if(_0x5bb593&&_0x5bb593['autoAssociation']===0x0){return db[_0xd6b6('0x35')][_0xd6b6('0x54')]({'name':_0x265c00[_0xd6b6('0x38')],'resourceId':_0x265c00['id'],'type':_0x5bb593[_0xd6b6('0x38')],'sectionId':_0x5bb593['id']},{})[_0xd6b6('0x1f')](function(){return _0x2afceb;});}else{return _0x2afceb;}})[_0xd6b6('0x29')](function(_0x43eda5){logger[_0xd6b6('0x25')](_0xd6b6('0x62'),_0x43eda5);throw _0x43eda5;});}return _0x2afceb;})[_0xd6b6('0x1f')](respondWithResult(_0x2fac6b,0xc9))['catch'](handleError(_0x2fac6b,null));};exports[_0xd6b6('0x63')]=function(_0x527316,_0x5b6573,_0xd6c447){var _0x2a716f;return db['VoiceContext'][_0xd6b6('0x60')]({'where':{'id':_0x527316['params']['id']}})['then'](handleEntityNotFound(_0x5b6573,null))[_0xd6b6('0x1f')](saveUpdates(_0x527316[_0xd6b6('0x64')],null))['then'](function(_0x3c19aa){if(_0x3c19aa){_0x2a716f=_0x3c19aa;return db[_0xd6b6('0x3b')][_0xd6b6('0x4e')]({'raw':!![]});}})[_0xd6b6('0x1f')](function(_0x10e5e1){var _0xfc39ff=fs[_0xd6b6('0x55')](path[_0xd6b6('0x65')](config[_0xd6b6('0x56')],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x504fda=ejs['render'](_0xfc39ff,{'contexts':_0x10e5e1||[]});fs[_0xd6b6('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x504fda);})[_0xd6b6('0x1f')](function(){return respondWithRpcPromise(_0xd6b6('0x5a'),_0xd6b6('0x63'),{'module':_0xd6b6('0x5b')});})[_0xd6b6('0x1f')](function(){return _0x2a716f;})[_0xd6b6('0x1f')](respondWithResult(_0x5b6573,null))[_0xd6b6('0x29')](handleError(_0x5b6573,null));};exports[_0xd6b6('0x34')]=function(_0x49f275,_0x3bf6af,_0x1a8cda){var _0x24d8cf;return db['VoiceContext'][_0xd6b6('0x60')]({'where':{'id':_0x49f275[_0xd6b6('0x50')]['id']}})['then'](handleEntityNotFound(_0x3bf6af,null))['then'](removeEntity(_0x3bf6af,null))[_0xd6b6('0x1f')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x314ce0){var _0x501cf5=fs[_0xd6b6('0x55')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xd6b6('0x57'));var _0x2322d8=ejs[_0xd6b6('0x58')](_0x501cf5,{'contexts':_0x314ce0});fs['writeFileSync'](_0xd6b6('0x59'),_0x2322d8);return respondWithRpcPromise('Reload',_0xd6b6('0x34'),{'module':_0xd6b6('0x5b')});})['catch'](handleError(_0x3bf6af,null));}; \ No newline at end of file +var _0xe505=['UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','render','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','Contexts','UserProfileResource','destroy','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','intersection','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','role','user'];(function(_0x48243f,_0x28a63b){var _0x1fa5ff=function(_0xe4c1c3){while(--_0xe4c1c3){_0x48243f['push'](_0x48243f['shift']());}};_0x1fa5ff(++_0x28a63b);}(_0xe505,0x6c));var _0x5e50=function(_0x2dc53c,_0x4a29ce){_0x2dc53c=_0x2dc53c-0x0;var _0x32ea88=_0xe505[_0x2dc53c];return _0x32ea88;};'use strict';var emlformat=require(_0x5e50('0x0'));var rimraf=require(_0x5e50('0x1'));var zipdir=require(_0x5e50('0x2'));var jsonpatch=require(_0x5e50('0x3'));var rp=require('request-promise');var moment=require(_0x5e50('0x4'));var BPromise=require(_0x5e50('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5e50('0x6'));var ejs=require(_0x5e50('0x7'));var fs=require('fs');var fs_extra=require(_0x5e50('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e50('0x9'));var jsforce=require(_0x5e50('0xa'));var deskjs=require(_0x5e50('0xb'));var toCsv=require(_0x5e50('0x6'));var querystring=require(_0x5e50('0xc'));var Papa=require(_0x5e50('0xd'));var Redis=require('ioredis');var authService=require(_0x5e50('0xe'));var qs=require(_0x5e50('0xf'));var as=require(_0x5e50('0x10'));var hardwareService=require(_0x5e50('0x11'));var logger=require(_0x5e50('0x12'))(_0x5e50('0x13'));var utils=require(_0x5e50('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5e50('0x15'));var db=require(_0x5e50('0x16'))['db'];var jayson=require(_0x5e50('0x17'));var client=jayson[_0x5e50('0x18')][_0x5e50('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x44bf01,_0x1afc64,_0x581fd6,_0xaad077){return new BPromise(function(_0x34ce38,_0x393b69){var _0x5dc3d7=_0xaad077||client;return _0x5dc3d7[_0x5e50('0x1a')](_0x44bf01,_0x581fd6)['then'](function(_0x36ed3c){logger[_0x5e50('0x1b')](_0x5e50('0x1c'),_0x1afc64,_0x5e50('0x1d'));logger[_0x5e50('0x1e')](_0x5e50('0x1f'),_0x1afc64,_0x5e50('0x1d'),JSON[_0x5e50('0x20')](_0x36ed3c));if(_0x36ed3c[_0x5e50('0x21')]){if(_0x36ed3c[_0x5e50('0x21')]['code']===0x1f4){logger[_0x5e50('0x21')]('VoiceContext,\x20%s,\x20%s',_0x1afc64,_0x36ed3c[_0x5e50('0x21')][_0x5e50('0x22')]);return _0x393b69(_0x36ed3c['error'][_0x5e50('0x22')]);}logger['error'](_0x5e50('0x1c'),_0x1afc64,_0x36ed3c['error']['message']);return _0x34ce38(_0x36ed3c[_0x5e50('0x21')][_0x5e50('0x22')]);}else{logger[_0x5e50('0x1b')](_0x5e50('0x1c'),_0x1afc64,_0x5e50('0x1d'));_0x34ce38(_0x36ed3c[_0x5e50('0x23')][_0x5e50('0x22')]);}})[_0x5e50('0x24')](function(_0x59f391){logger[_0x5e50('0x21')](_0x5e50('0x1c'),_0x1afc64,_0x59f391);_0x393b69(_0x59f391);});});}function respondWithStatusCode(_0x9a8312,_0x400df0){_0x400df0=_0x400df0||0xcc;return function(_0x2b6a6c){if(_0x2b6a6c){return _0x9a8312[_0x5e50('0x25')](_0x400df0);}return _0x9a8312[_0x5e50('0x26')](_0x400df0)[_0x5e50('0x27')]();};}function respondWithResult(_0x1d931f,_0x50676e){_0x50676e=_0x50676e||0xc8;return function(_0xbaf0bc){if(_0xbaf0bc){return _0x1d931f['status'](_0x50676e)['json'](_0xbaf0bc);}};}function respondWithFilteredResult(_0x58db57,_0x3c51e1){return function(_0x34cd81){if(_0x34cd81){var _0xb78202=typeof _0x3c51e1[_0x5e50('0x28')]===_0x5e50('0x29')&&typeof _0x3c51e1['limit']===_0x5e50('0x29');var _0x156e6f=_0x34cd81['count'];var _0x40dd6f=_0xb78202?0x0:_0x3c51e1[_0x5e50('0x28')];var _0x280e47=_0xb78202?_0x34cd81[_0x5e50('0x2a')]:_0x3c51e1['offset']+_0x3c51e1[_0x5e50('0x2b')];var _0x762f19;if(_0x280e47>=_0x156e6f){_0x280e47=_0x156e6f;_0x762f19=0xc8;}else{_0x762f19=0xce;}_0x58db57['status'](_0x762f19);return _0x58db57[_0x5e50('0x2c')](_0x5e50('0x2d'),_0x40dd6f+'-'+_0x280e47+'/'+_0x156e6f)[_0x5e50('0x2e')](_0x34cd81);}return null;};}function patchUpdates(_0x3a77c4){return function(_0x3889b6){try{jsonpatch[_0x5e50('0x2f')](_0x3889b6,_0x3a77c4,!![]);}catch(_0x45899e){return BPromise['reject'](_0x45899e);}return _0x3889b6['save']();};}function saveUpdates(_0x17f66f,_0x417c13){return function(_0xf8020){if(_0xf8020){return _0xf8020[_0x5e50('0x30')](_0x17f66f)[_0x5e50('0x31')](function(_0x1121db){return _0x1121db;});}return null;};}function removeEntity(_0x539809,_0x2db097){return function(_0x36b96a){if(_0x36b96a){return _0x36b96a['destroy']()[_0x5e50('0x31')](function(){var _0x5b0dc8=_0x36b96a['get']({'plain':!![]});var _0x4c3947=_0x5e50('0x32');return db[_0x5e50('0x33')][_0x5e50('0x34')]({'where':{'type':_0x4c3947,'resourceId':_0x5b0dc8['id']}})[_0x5e50('0x31')](function(){return _0x36b96a;});})[_0x5e50('0x31')](function(){_0x539809['status'](0xcc)[_0x5e50('0x27')]();});}};}function handleEntityNotFound(_0x160569,_0x3cd489){return function(_0x2f0ae8){if(!_0x2f0ae8){_0x160569[_0x5e50('0x25')](0x194);}return _0x2f0ae8;};}function handleError(_0x59fd5f,_0x390951){_0x390951=_0x390951||0x1f4;return function(_0x17a497){logger[_0x5e50('0x21')](_0x17a497['stack']);if(_0x17a497['name']){delete _0x17a497[_0x5e50('0x35')];}_0x59fd5f[_0x5e50('0x26')](_0x390951)[_0x5e50('0x36')](_0x17a497);};}exports['index']=function(_0x1bf8f4,_0x3079cf){var _0x19ed7b={},_0x47868e={},_0x344531={'count':0x0,'rows':[]};var _0x28a130=_[_0x5e50('0x37')](db[_0x5e50('0x38')]['rawAttributes'],function(_0x3162ed){return{'name':_0x3162ed[_0x5e50('0x39')],'type':_0x3162ed[_0x5e50('0x3a')][_0x5e50('0x3b')]};});_0x47868e[_0x5e50('0x3c')]=_[_0x5e50('0x37')](_0x28a130,_0x5e50('0x35'));_0x47868e[_0x5e50('0x3d')]=_[_0x5e50('0x3e')](_0x1bf8f4['query']);_0x47868e[_0x5e50('0x3f')]=_['intersection'](_0x47868e[_0x5e50('0x3c')],_0x47868e['query']);_0x19ed7b['attributes']=_['intersection'](_0x47868e[_0x5e50('0x3c')],qs['fields'](_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x40')]));_0x19ed7b[_0x5e50('0x41')]=_0x19ed7b[_0x5e50('0x41')][_0x5e50('0x42')]?_0x19ed7b[_0x5e50('0x41')]:_0x47868e[_0x5e50('0x3c')];if(!_0x1bf8f4[_0x5e50('0x3d')]['hasOwnProperty'](_0x5e50('0x43'))){_0x19ed7b[_0x5e50('0x2b')]=qs[_0x5e50('0x2b')](_0x1bf8f4['query']['limit']);_0x19ed7b['offset']=qs[_0x5e50('0x28')](_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x28')]);}_0x19ed7b[_0x5e50('0x44')]=qs[_0x5e50('0x45')](_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x45')]);_0x19ed7b[_0x5e50('0x46')]=qs['filters'](_[_0x5e50('0x47')](_0x1bf8f4[_0x5e50('0x3d')],_0x47868e[_0x5e50('0x3f')]),_0x28a130);if(_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x48')]){_0x19ed7b[_0x5e50('0x46')]=_[_0x5e50('0x49')](_0x19ed7b[_0x5e50('0x46')],{'$or':_[_0x5e50('0x37')](_0x28a130,function(_0x112bc9){if(_0x112bc9['type']!==_0x5e50('0x4a')){var _0x2ac23e={};_0x2ac23e[_0x112bc9[_0x5e50('0x35')]]={'$like':'%'+_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x48')]+'%'};return _0x2ac23e;}})});}_0x19ed7b=_[_0x5e50('0x49')]({},_0x19ed7b,_0x1bf8f4[_0x5e50('0x4b')]);var _0x2a898c={'where':_0x19ed7b[_0x5e50('0x46')]};return db['VoiceContext'][_0x5e50('0x2a')](_0x2a898c)[_0x5e50('0x31')](function(_0x20bb77){_0x344531[_0x5e50('0x2a')]=_0x20bb77;if(_0x1bf8f4[_0x5e50('0x3d')][_0x5e50('0x4c')]){_0x19ed7b[_0x5e50('0x4d')]=[{'all':!![]}];}return db[_0x5e50('0x38')]['findAll'](_0x19ed7b);})[_0x5e50('0x31')](function(_0x3a11bb){_0x344531[_0x5e50('0x4e')]=_0x3a11bb;return _0x344531;})['then'](respondWithFilteredResult(_0x3079cf,_0x19ed7b))[_0x5e50('0x24')](handleError(_0x3079cf,null));};exports[_0x5e50('0x4f')]=function(_0x39377d,_0x31e544){var _0x326ee4={'raw':![],'where':{'id':_0x39377d[_0x5e50('0x50')]['id']}},_0x396457={};_0x396457[_0x5e50('0x3c')]=_[_0x5e50('0x3e')](db[_0x5e50('0x38')][_0x5e50('0x51')]);_0x396457['query']=_['keys'](_0x39377d[_0x5e50('0x3d')]);_0x396457['filters']=_['intersection'](_0x396457[_0x5e50('0x3c')],_0x396457[_0x5e50('0x3d')]);_0x326ee4[_0x5e50('0x41')]=_[_0x5e50('0x52')](_0x396457[_0x5e50('0x3c')],qs[_0x5e50('0x40')](_0x39377d['query'][_0x5e50('0x40')]));_0x326ee4[_0x5e50('0x41')]=_0x326ee4['attributes'][_0x5e50('0x42')]?_0x326ee4[_0x5e50('0x41')]:_0x396457[_0x5e50('0x3c')];if(_0x39377d['query'][_0x5e50('0x4c')]){_0x326ee4[_0x5e50('0x4d')]=[{'all':!![]}];}_0x326ee4=_['merge']({},_0x326ee4,_0x39377d[_0x5e50('0x4b')]);return db['VoiceContext']['find'](_0x326ee4)[_0x5e50('0x31')](handleEntityNotFound(_0x31e544,null))['then'](respondWithResult(_0x31e544,null))[_0x5e50('0x24')](handleError(_0x31e544,null));};exports[_0x5e50('0x53')]=function(_0x2401a,_0x19aed6,_0x413cb1){var _0xa43072;return db['VoiceContext']['create'](_0x2401a[_0x5e50('0x54')],{'raw':!![]})[_0x5e50('0x31')](function(_0x3cc4be){_0xa43072=_0x3cc4be;return db[_0x5e50('0x38')]['findAll']({'raw':!![]});})[_0x5e50('0x31')](function(_0x27e41d){var _0x49c2ba=fs[_0x5e50('0x55')](path[_0x5e50('0x56')](config['root'],_0x5e50('0x57')),_0x5e50('0x58'));var _0x1faaf3=ejs['render'](_0x49c2ba,{'contexts':_0x27e41d||[]});fs[_0x5e50('0x59')](_0x5e50('0x5a'),_0x1faaf3);})[_0x5e50('0x31')](function(){return respondWithRpcPromise(_0x5e50('0x5b'),_0x5e50('0x53'),{'module':_0x5e50('0x5c')});})[_0x5e50('0x31')](function(){var _0x37a409=_0x2401a['user'][_0x5e50('0x5d')]({'plain':!![]});if(!_0x37a409)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37a409[_0x5e50('0x5e')]===_0x5e50('0x5f')){var _0x108927=_0xa43072[_0x5e50('0x5d')]({'plain':!![]});return db[_0x5e50('0x60')][_0x5e50('0x61')]({'where':{'name':_0x5e50('0x32'),'userProfileId':_0x37a409[_0x5e50('0x62')]},'raw':!![]})[_0x5e50('0x31')](function(_0x235c55){if(_0x235c55&&_0x235c55['autoAssociation']===0x0){return db[_0x5e50('0x33')][_0x5e50('0x53')]({'name':_0x108927[_0x5e50('0x35')],'resourceId':_0x108927['id'],'type':_0x235c55[_0x5e50('0x35')],'sectionId':_0x235c55['id']},{})[_0x5e50('0x31')](function(){return _0xa43072;});}else{return _0xa43072;}})[_0x5e50('0x24')](function(_0x1616a4){logger[_0x5e50('0x21')](_0x5e50('0x63'),_0x1616a4);throw _0x1616a4;});}return _0xa43072;})[_0x5e50('0x31')](respondWithResult(_0x19aed6,0xc9))[_0x5e50('0x24')](handleError(_0x19aed6,null));};exports[_0x5e50('0x30')]=function(_0x2ec3b2,_0x83df79,_0x4eb699){var _0xb530d4;return db[_0x5e50('0x38')][_0x5e50('0x61')]({'where':{'id':_0x2ec3b2['params']['id']}})[_0x5e50('0x31')](handleEntityNotFound(_0x83df79,null))[_0x5e50('0x31')](saveUpdates(_0x2ec3b2[_0x5e50('0x54')],null))[_0x5e50('0x31')](function(_0x7145f7){if(_0x7145f7){_0xb530d4=_0x7145f7;return db[_0x5e50('0x38')][_0x5e50('0x64')]({'raw':!![]});}})[_0x5e50('0x31')](function(_0x4646d6){var _0x18175e=fs['readFileSync'](path[_0x5e50('0x56')](config['root'],_0x5e50('0x57')),'utf8');var _0x8edb4=ejs[_0x5e50('0x65')](_0x18175e,{'contexts':_0x4646d6||[]});fs[_0x5e50('0x59')](_0x5e50('0x5a'),_0x8edb4);})['then'](function(){return respondWithRpcPromise(_0x5e50('0x5b'),_0x5e50('0x30'),{'module':_0x5e50('0x5c')});})[_0x5e50('0x31')](function(){return _0xb530d4;})[_0x5e50('0x31')](respondWithResult(_0x83df79,null))['catch'](handleError(_0x83df79,null));};exports[_0x5e50('0x34')]=function(_0x3929bf,_0x41fdd6,_0x6af4d5){var _0x116368;return db[_0x5e50('0x38')][_0x5e50('0x61')]({'where':{'id':_0x3929bf[_0x5e50('0x50')]['id']}})[_0x5e50('0x31')](handleEntityNotFound(_0x41fdd6,null))[_0x5e50('0x31')](removeEntity(_0x41fdd6,null))[_0x5e50('0x31')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x5e50('0x31')](function(_0x42a86b){var _0x231ea2=fs[_0x5e50('0x55')](path[_0x5e50('0x56')](config['root'],_0x5e50('0x57')),_0x5e50('0x58'));var _0x3770e6=ejs[_0x5e50('0x65')](_0x231ea2,{'contexts':_0x42a86b});fs[_0x5e50('0x59')](_0x5e50('0x5a'),_0x3770e6);return respondWithRpcPromise('Reload',_0x5e50('0x34'),{'module':'chan_sip.so'});})['catch'](handleError(_0x41fdd6,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3da0268..58e08f1 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 _0xcbb8=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f042d,_0x487095){var _0x191268=function(_0x462ce7){while(--_0x462ce7){_0x5f042d['push'](_0x5f042d['shift']());}};_0x191268(++_0x487095);}(_0xcbb8,0x77));var _0x8cbb=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xcbb8[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x8cbb('0x0'));var util=require(_0x8cbb('0x1'));var logger=require(_0x8cbb('0x2'))(_0x8cbb('0x3'));var moment=require(_0x8cbb('0x4'));var BPromise=require(_0x8cbb('0x5'));var rp=require(_0x8cbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cbb('0x7'));var config=require(_0x8cbb('0x8'));var attributes=require(_0x8cbb('0x9'));module[_0x8cbb('0xa')]=function(_0x1e4a47,_0x541cd7){return _0x1e4a47[_0x8cbb('0xb')](_0x8cbb('0xc'),attributes,{'tableName':_0x8cbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdae=['util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x41e223,_0x225640){var _0x1a0698=function(_0x6f5015){while(--_0x6f5015){_0x41e223['push'](_0x41e223['shift']());}};_0x1a0698(++_0x225640);}(_0xfdae,0x176));var _0xefda=function(_0x4e010e,_0x4b8070){_0x4e010e=_0x4e010e-0x0;var _0x494416=_0xfdae[_0x4e010e];return _0x494416;};'use strict';var _=require('lodash');var util=require(_0xefda('0x0'));var logger=require(_0xefda('0x1'))('api');var moment=require(_0xefda('0x2'));var BPromise=require(_0xefda('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefda('0x4'));var rimraf=require('rimraf');var config=require(_0xefda('0x5'));var attributes=require(_0xefda('0x6'));module[_0xefda('0x7')]=function(_0x3b5042,_0xd89aac){return _0x3b5042[_0xefda('0x8')](_0xefda('0x9'),attributes,{'tableName':_0xefda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index eab790f..3d63976 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 _0xf7b4=['result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message'];(function(_0x1ed791,_0x3c86aa){var _0xea6482=function(_0x168cc9){while(--_0x168cc9){_0x1ed791['push'](_0x1ed791['shift']());}};_0xea6482(++_0x3c86aa);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5db20e,_0x58b0b3){_0x5db20e=_0x5db20e-0x0;var _0xba0729=_0xf7b4[_0x5db20e];return _0xba0729;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VoiceContext,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VoiceContext,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});} \ No newline at end of file +var _0x0d90=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59acd1,_0x4cedcd){var _0x2b5c71=function(_0x24719a){while(--_0x24719a){_0x59acd1['push'](_0x59acd1['shift']());}};_0x2b5c71(++_0x4cedcd);}(_0x0d90,0xa0));var _0x00d9=function(_0x4d721c,_0x19bd35){_0x4d721c=_0x4d721c-0x0;var _0x10fff3=_0x0d90[_0x4d721c];return _0x10fff3;};'use strict';var _=require(_0x00d9('0x0'));var util=require(_0x00d9('0x1'));var moment=require(_0x00d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x00d9('0x3'));var fs=require('fs');var Redis=require(_0x00d9('0x4'));var db=require(_0x00d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00d9('0x6'))(_0x00d9('0x7'));var config=require(_0x00d9('0x8'));var jayson=require(_0x00d9('0x9'));var client=jayson[_0x00d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b71b,_0x1f6457,_0x3935cd){return new BPromise(function(_0x5cedd0,_0x215dbd){return client[_0x00d9('0xb')](_0x39b71b,_0x3935cd)['then'](function(_0x214015){logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));logger[_0x00d9('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1f6457,_0x00d9('0xe'),JSON[_0x00d9('0x10')](_0x214015));if(_0x214015[_0x00d9('0x11')]){if(_0x214015[_0x00d9('0x11')][_0x00d9('0x12')]===0x1f4){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015[_0x00d9('0x11')]['message']);return _0x215dbd(_0x214015['error']['message']);}logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x214015['error'][_0x00d9('0x13')]);return _0x5cedd0(_0x214015['error']['message']);}else{logger[_0x00d9('0xc')](_0x00d9('0xd'),_0x1f6457,_0x00d9('0xe'));_0x5cedd0(_0x214015[_0x00d9('0x14')][_0x00d9('0x13')]);}})[_0x00d9('0x15')](function(_0x4e8e2b){logger[_0x00d9('0x11')](_0x00d9('0xd'),_0x1f6457,_0x4e8e2b);_0x215dbd(_0x4e8e2b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e4617a8..918ffbd 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 _0x644a=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4052bc,_0x2bc3de){var _0x28410a=function(_0x5d4d99){while(--_0x5d4d99){_0x4052bc['push'](_0x4052bc['shift']());}};_0x28410a(++_0x2bc3de);}(_0x644a,0xfd));var _0xa644=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0x644a[_0x24d711];return _0x3491b4;};'use strict';var multer=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var path=require(_0xa644('0x2'));var timeout=require(_0xa644('0x3'));var express=require(_0xa644('0x4'));var router=express['Router']();var fs_extra=require(_0xa644('0x5'));var auth=require(_0xa644('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa644('0x7'));router[_0xa644('0x8')]('/',auth[_0xa644('0x9')](),controller['index']);router[_0xa644('0x8')](_0xa644('0xa'),auth['isAuthenticated'](),controller[_0xa644('0xb')]);router[_0xa644('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa644('0xc')]);router[_0xa644('0xd')]('/',auth['isAuthenticated'](),controller[_0xa644('0xe')]);router[_0xa644('0xf')](_0xa644('0x10'),auth[_0xa644('0x9')](),controller[_0xa644('0x11')]);router['delete'](_0xa644('0x10'),auth[_0xa644('0x9')](),controller[_0xa644('0x12')]);module[_0xa644('0x13')]=router; \ No newline at end of file +var _0x7837=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post'];(function(_0x1a5cd7,_0x3811e9){var _0x399402=function(_0x2b388c){while(--_0x2b388c){_0x1a5cd7['push'](_0x1a5cd7['shift']());}};_0x399402(++_0x3811e9);}(_0x7837,0x69));var _0x7783=function(_0xdfd450,_0x17cc9b){_0xdfd450=_0xdfd450-0x0;var _0x6e2793=_0x7837[_0xdfd450];return _0x6e2793;};'use strict';var multer=require('multer');var util=require(_0x7783('0x0'));var path=require(_0x7783('0x1'));var timeout=require(_0x7783('0x2'));var express=require(_0x7783('0x3'));var router=express[_0x7783('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7783('0x5'));var interaction=require(_0x7783('0x6'));var config=require(_0x7783('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x7783('0x8')](),controller[_0x7783('0x9')]);router[_0x7783('0xa')]('/describe',auth[_0x7783('0x8')](),controller[_0x7783('0xb')]);router['get'](_0x7783('0xc'),auth['isAuthenticated'](),controller[_0x7783('0xd')]);router[_0x7783('0xe')]('/',auth[_0x7783('0x8')](),controller[_0x7783('0xf')]);router['put'](_0x7783('0xc'),auth['isAuthenticated'](),controller[_0x7783('0x10')]);router[_0x7783('0x11')](_0x7783('0xc'),auth[_0x7783('0x8')](),controller[_0x7783('0x12')]);module[_0x7783('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a2820e5..087d21c 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x381694,_0x22054c){var _0x129eea=function(_0x5e7a9d){while(--_0x5e7a9d){_0x381694['push'](_0x381694['shift']());}};_0x129eea(++_0x22054c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cbc398a..609830d 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 _0x5c04=['VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x2c17dd,_0x28b928){var _0x2398ea=function(_0x4bfb23){while(--_0x4bfb23){_0x2c17dd['push'](_0x2c17dd['shift']());}};_0x2398ea(++_0x28b928);}(_0x5c04,0xa6));var _0x45c0=function(_0x2e0603,_0x39f7df){_0x2e0603=_0x2e0603-0x0;var _0x2cb9ac=_0x5c04[_0x2e0603];return _0x2cb9ac;};'use strict';var emlformat=require(_0x45c0('0x0'));var rimraf=require(_0x45c0('0x1'));var zipdir=require(_0x45c0('0x2'));var jsonpatch=require(_0x45c0('0x3'));var rp=require('request-promise');var moment=require(_0x45c0('0x4'));var BPromise=require(_0x45c0('0x5'));var Mustache=require('mustache');var util=require(_0x45c0('0x6'));var path=require('path');var sox=require(_0x45c0('0x7'));var csv=require(_0x45c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45c0('0x9'));var _=require(_0x45c0('0xa'));var squel=require(_0x45c0('0xb'));var crypto=require(_0x45c0('0xc'));var jsforce=require(_0x45c0('0xd'));var deskjs=require(_0x45c0('0xe'));var toCsv=require(_0x45c0('0x8'));var querystring=require(_0x45c0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45c0('0x10'));var qs=require(_0x45c0('0x11'));var as=require(_0x45c0('0x12'));var hardwareService=require(_0x45c0('0x13'));var logger=require(_0x45c0('0x14'))(_0x45c0('0x15'));var utils=require(_0x45c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x45c0('0x17'));var db=require(_0x45c0('0x18'))['db'];function respondWithStatusCode(_0xafa086,_0x5c022f){_0x5c022f=_0x5c022f||0xcc;return function(_0x9f7303){if(_0x9f7303){return _0xafa086[_0x45c0('0x19')](_0x5c022f);}return _0xafa086[_0x45c0('0x1a')](_0x5c022f)[_0x45c0('0x1b')]();};}function respondWithResult(_0x566e50,_0x196352){_0x196352=_0x196352||0xc8;return function(_0x525576){if(_0x525576){return _0x566e50['status'](_0x196352)[_0x45c0('0x1c')](_0x525576);}};}function respondWithFilteredResult(_0xccf4f6,_0x3a6a94){return function(_0x13818c){if(_0x13818c){var _0x1b4f01=typeof _0x3a6a94[_0x45c0('0x1d')]===_0x45c0('0x1e')&&typeof _0x3a6a94['limit']===_0x45c0('0x1e');var _0x5a7f2b=_0x13818c[_0x45c0('0x1f')];var _0x40197a=_0x1b4f01?0x0:_0x3a6a94[_0x45c0('0x1d')];var _0x35e844=_0x1b4f01?_0x13818c[_0x45c0('0x1f')]:_0x3a6a94[_0x45c0('0x1d')]+_0x3a6a94['limit'];var _0x372688;if(_0x35e844>=_0x5a7f2b){_0x35e844=_0x5a7f2b;_0x372688=0xc8;}else{_0x372688=0xce;}_0xccf4f6[_0x45c0('0x1a')](_0x372688);return _0xccf4f6['set'](_0x45c0('0x20'),_0x40197a+'-'+_0x35e844+'/'+_0x5a7f2b)[_0x45c0('0x1c')](_0x13818c);}return null;};}function patchUpdates(_0x24caa3){return function(_0x31b2d2){try{jsonpatch[_0x45c0('0x21')](_0x31b2d2,_0x24caa3,!![]);}catch(_0x5d32f1){return BPromise[_0x45c0('0x22')](_0x5d32f1);}return _0x31b2d2[_0x45c0('0x23')]();};}function saveUpdates(_0x19bae1,_0x4d7987){return function(_0x34272e){if(_0x34272e){return _0x34272e[_0x45c0('0x24')](_0x19bae1)[_0x45c0('0x25')](function(_0x1f8f4c){return _0x1f8f4c;});}return null;};}function removeEntity(_0x2175d2,_0x193db8){return function(_0x13ebd7){if(_0x13ebd7){return _0x13ebd7[_0x45c0('0x26')]()[_0x45c0('0x25')](function(){_0x2175d2['status'](0xcc)[_0x45c0('0x1b')]();});}};}function handleEntityNotFound(_0x5d4f3c,_0x32a52e){return function(_0x4d2cd0){if(!_0x4d2cd0){_0x5d4f3c['sendStatus'](0x194);}return _0x4d2cd0;};}function handleError(_0x3e1d95,_0x5ad7a0){_0x5ad7a0=_0x5ad7a0||0x1f4;return function(_0x5bfa9e){logger[_0x45c0('0x27')](_0x5bfa9e['stack']);if(_0x5bfa9e[_0x45c0('0x28')]){delete _0x5bfa9e[_0x45c0('0x28')];}_0x3e1d95[_0x45c0('0x1a')](_0x5ad7a0)[_0x45c0('0x29')](_0x5bfa9e);};}exports[_0x45c0('0x2a')]=function(_0x2648e4,_0x2886b6){var _0x2c8854={},_0x16d6c1={},_0x187f1b={'count':0x0,'rows':[]};var _0x255234=_[_0x45c0('0x2b')](db[_0x45c0('0x2c')][_0x45c0('0x2d')],function(_0x4e67d4){return{'name':_0x4e67d4['fieldName'],'type':_0x4e67d4[_0x45c0('0x2e')]['key']};});_0x16d6c1['model']=_[_0x45c0('0x2b')](_0x255234,_0x45c0('0x28'));_0x16d6c1[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x2648e4[_0x45c0('0x2f')]);_0x16d6c1[_0x45c0('0x31')]=_[_0x45c0('0x32')](_0x16d6c1[_0x45c0('0x33')],_0x16d6c1[_0x45c0('0x2f')]);_0x2c8854[_0x45c0('0x34')]=_[_0x45c0('0x32')](_0x16d6c1[_0x45c0('0x33')],qs['fields'](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x2c8854[_0x45c0('0x34')]=_0x2c8854[_0x45c0('0x34')]['length']?_0x2c8854[_0x45c0('0x34')]:_0x16d6c1['model'];if(!_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x36')](_0x45c0('0x37'))){_0x2c8854[_0x45c0('0x38')]=qs[_0x45c0('0x38')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x38')]);_0x2c8854[_0x45c0('0x1d')]=qs[_0x45c0('0x1d')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x1d')]);}_0x2c8854['order']=qs[_0x45c0('0x39')](_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x39')]);_0x2c8854[_0x45c0('0x3a')]=qs['filters'](_[_0x45c0('0x3b')](_0x2648e4[_0x45c0('0x2f')],_0x16d6c1[_0x45c0('0x31')]),_0x255234);if(_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x3c')]){_0x2c8854[_0x45c0('0x3a')]=_[_0x45c0('0x3d')](_0x2c8854['where'],{'$or':_[_0x45c0('0x2b')](_0x255234,function(_0x1fd3be){if(_0x1fd3be[_0x45c0('0x2e')]!==_0x45c0('0x3e')){var _0xc2d3c9={};_0xc2d3c9[_0x1fd3be[_0x45c0('0x28')]]={'$like':'%'+_0x2648e4['query'][_0x45c0('0x3c')]+'%'};return _0xc2d3c9;}})});}_0x2c8854=_[_0x45c0('0x3d')]({},_0x2c8854,_0x2648e4[_0x45c0('0x3f')]);var _0x3de92c={'where':_0x2c8854[_0x45c0('0x3a')]};return db[_0x45c0('0x2c')][_0x45c0('0x1f')](_0x3de92c)[_0x45c0('0x25')](function(_0xdececd){_0x187f1b[_0x45c0('0x1f')]=_0xdececd;if(_0x2648e4[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x2c8854[_0x45c0('0x41')]=[{'all':!![]}];}return db[_0x45c0('0x2c')][_0x45c0('0x42')](_0x2c8854);})['then'](function(_0x58ec64){_0x187f1b[_0x45c0('0x43')]=_0x58ec64;return _0x187f1b;})[_0x45c0('0x25')](respondWithFilteredResult(_0x2886b6,_0x2c8854))['catch'](handleError(_0x2886b6,null));};exports[_0x45c0('0x44')]=function(_0x5c3187,_0x44d93e){var _0x48de76={'raw':!![],'where':{'id':_0x5c3187['params']['id']}},_0x13f048={};_0x13f048[_0x45c0('0x33')]=_[_0x45c0('0x30')](db[_0x45c0('0x2c')][_0x45c0('0x2d')]);_0x13f048[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x5c3187[_0x45c0('0x2f')]);_0x13f048['filters']=_['intersection'](_0x13f048['model'],_0x13f048[_0x45c0('0x2f')]);_0x48de76[_0x45c0('0x34')]=_['intersection'](_0x13f048[_0x45c0('0x33')],qs[_0x45c0('0x35')](_0x5c3187[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x48de76[_0x45c0('0x34')]=_0x48de76[_0x45c0('0x34')][_0x45c0('0x45')]?_0x48de76[_0x45c0('0x34')]:_0x13f048['model'];if(_0x5c3187[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x48de76['include']=[{'all':!![]}];}_0x48de76=_[_0x45c0('0x3d')]({},_0x48de76,_0x5c3187[_0x45c0('0x3f')]);return db[_0x45c0('0x2c')][_0x45c0('0x46')](_0x48de76)[_0x45c0('0x25')](handleEntityNotFound(_0x44d93e,null))[_0x45c0('0x25')](respondWithResult(_0x44d93e,null))[_0x45c0('0x47')](handleError(_0x44d93e,null));};exports[_0x45c0('0x48')]=function(_0x51baa0,_0x20652e){return db[_0x45c0('0x2c')][_0x45c0('0x48')](_0x51baa0[_0x45c0('0x49')],{})[_0x45c0('0x25')](respondWithResult(_0x20652e,0xc9))[_0x45c0('0x47')](handleError(_0x20652e,null));};exports[_0x45c0('0x24')]=function(_0x43094f,_0x200076){if(_0x43094f[_0x45c0('0x49')]['id']){delete _0x43094f[_0x45c0('0x49')]['id'];}return db[_0x45c0('0x2c')][_0x45c0('0x46')]({'where':{'id':_0x43094f[_0x45c0('0x4a')]['id']}})[_0x45c0('0x25')](handleEntityNotFound(_0x200076,null))[_0x45c0('0x25')](saveUpdates(_0x43094f['body'],null))['then'](respondWithResult(_0x200076,null))[_0x45c0('0x47')](handleError(_0x200076,null));};exports[_0x45c0('0x26')]=function(_0x174b8a,_0x52e272){return db[_0x45c0('0x2c')][_0x45c0('0x46')]({'where':{'id':_0x174b8a[_0x45c0('0x4a')]['id']}})[_0x45c0('0x25')](handleEntityNotFound(_0x52e272,null))[_0x45c0('0x25')](removeEntity(_0x52e272,null))[_0x45c0('0x47')](handleError(_0x52e272,null));};exports[_0x45c0('0x4b')]=function(_0x286ddd,_0x221b39){return db[_0x45c0('0x2c')][_0x45c0('0x4b')]()[_0x45c0('0x25')](respondWithResult(_0x221b39,null))[_0x45c0('0x47')](handleError(_0x221b39,null));}; \ No newline at end of file +var _0x315c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4c32f5,_0x3dbbf1){var _0x19cae9=function(_0x3c77cd){while(--_0x3c77cd){_0x4c32f5['push'](_0x4c32f5['shift']());}};_0x19cae9(++_0x3dbbf1);}(_0x315c,0x1ba));var _0xc315=function(_0x5b6cc3,_0x39a928){_0x5b6cc3=_0x5b6cc3-0x0;var _0x45e13f=_0x315c[_0x5b6cc3];return _0x45e13f;};'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(_0xc315('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xc315('0x1'));var util=require('util');var path=require(_0xc315('0x2'));var sox=require('sox');var csv=require(_0xc315('0x3'));var ejs=require(_0xc315('0x4'));var fs=require('fs');var fs_extra=require(_0xc315('0x5'));var _=require(_0xc315('0x6'));var squel=require('squel');var crypto=require(_0xc315('0x7'));var jsforce=require(_0xc315('0x8'));var deskjs=require(_0xc315('0x9'));var toCsv=require(_0xc315('0x3'));var querystring=require(_0xc315('0xa'));var Papa=require(_0xc315('0xb'));var Redis=require(_0xc315('0xc'));var authService=require(_0xc315('0xd'));var qs=require(_0xc315('0xe'));var as=require(_0xc315('0xf'));var hardwareService=require(_0xc315('0x10'));var logger=require(_0xc315('0x11'))(_0xc315('0x12'));var utils=require(_0xc315('0x13'));var config=require(_0xc315('0x14'));var licenseUtil=require(_0xc315('0x15'));var db=require(_0xc315('0x16'))['db'];function respondWithStatusCode(_0xf91692,_0x7e6901){_0x7e6901=_0x7e6901||0xcc;return function(_0x2bd3c0){if(_0x2bd3c0){return _0xf91692[_0xc315('0x17')](_0x7e6901);}return _0xf91692[_0xc315('0x18')](_0x7e6901)['end']();};}function respondWithResult(_0x98da02,_0xc663ef){_0xc663ef=_0xc663ef||0xc8;return function(_0x3ec37f){if(_0x3ec37f){return _0x98da02['status'](_0xc663ef)[_0xc315('0x19')](_0x3ec37f);}};}function respondWithFilteredResult(_0x24eaea,_0x4c7ed7){return function(_0x1f9b1d){if(_0x1f9b1d){var _0x24ad7f=typeof _0x4c7ed7[_0xc315('0x1a')]===_0xc315('0x1b')&&typeof _0x4c7ed7[_0xc315('0x1c')]===_0xc315('0x1b');var _0x31f3=_0x1f9b1d['count'];var _0x375b94=_0x24ad7f?0x0:_0x4c7ed7[_0xc315('0x1a')];var _0x2ca2ed=_0x24ad7f?_0x1f9b1d[_0xc315('0x1d')]:_0x4c7ed7['offset']+_0x4c7ed7[_0xc315('0x1c')];var _0xf334bd;if(_0x2ca2ed>=_0x31f3){_0x2ca2ed=_0x31f3;_0xf334bd=0xc8;}else{_0xf334bd=0xce;}_0x24eaea[_0xc315('0x18')](_0xf334bd);return _0x24eaea[_0xc315('0x1e')](_0xc315('0x1f'),_0x375b94+'-'+_0x2ca2ed+'/'+_0x31f3)[_0xc315('0x19')](_0x1f9b1d);}return null;};}function patchUpdates(_0x4bdae6){return function(_0x4ec20e){try{jsonpatch[_0xc315('0x20')](_0x4ec20e,_0x4bdae6,!![]);}catch(_0xa34ef7){return BPromise[_0xc315('0x21')](_0xa34ef7);}return _0x4ec20e['save']();};}function saveUpdates(_0x5d8235,_0x59e83a){return function(_0x3c3ff6){if(_0x3c3ff6){return _0x3c3ff6[_0xc315('0x22')](_0x5d8235)[_0xc315('0x23')](function(_0x4f468d){return _0x4f468d;});}return null;};}function removeEntity(_0x1c8c8d,_0x355ee6){return function(_0x12d469){if(_0x12d469){return _0x12d469[_0xc315('0x24')]()[_0xc315('0x23')](function(){_0x1c8c8d[_0xc315('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e682,_0x5866d8){return function(_0x28e408){if(!_0x28e408){_0x38e682['sendStatus'](0x194);}return _0x28e408;};}function handleError(_0x17c2e6,_0x41aeb3){_0x41aeb3=_0x41aeb3||0x1f4;return function(_0x3c9164){logger[_0xc315('0x25')](_0x3c9164[_0xc315('0x26')]);if(_0x3c9164[_0xc315('0x27')]){delete _0x3c9164['name'];}_0x17c2e6[_0xc315('0x18')](_0x41aeb3)[_0xc315('0x28')](_0x3c9164);};}exports[_0xc315('0x29')]=function(_0x383199,_0x1a7c16){var _0x59ba4a={},_0x53140c={},_0x5269ac={'count':0x0,'rows':[]};var _0xdf63c2=_[_0xc315('0x2a')](db[_0xc315('0x2b')][_0xc315('0x2c')],function(_0x14b13f){return{'name':_0x14b13f[_0xc315('0x2d')],'type':_0x14b13f[_0xc315('0x2e')][_0xc315('0x2f')]};});_0x53140c['model']=_['map'](_0xdf63c2,_0xc315('0x27'));_0x53140c[_0xc315('0x30')]=_[_0xc315('0x31')](_0x383199[_0xc315('0x30')]);_0x53140c[_0xc315('0x32')]=_[_0xc315('0x33')](_0x53140c[_0xc315('0x34')],_0x53140c[_0xc315('0x30')]);_0x59ba4a['attributes']=_[_0xc315('0x33')](_0x53140c[_0xc315('0x34')],qs['fields'](_0x383199[_0xc315('0x30')][_0xc315('0x35')]));_0x59ba4a[_0xc315('0x36')]=_0x59ba4a['attributes'][_0xc315('0x37')]?_0x59ba4a[_0xc315('0x36')]:_0x53140c[_0xc315('0x34')];if(!_0x383199[_0xc315('0x30')][_0xc315('0x38')](_0xc315('0x39'))){_0x59ba4a[_0xc315('0x1c')]=qs['limit'](_0x383199[_0xc315('0x30')][_0xc315('0x1c')]);_0x59ba4a[_0xc315('0x1a')]=qs[_0xc315('0x1a')](_0x383199['query'][_0xc315('0x1a')]);}_0x59ba4a[_0xc315('0x3a')]=qs[_0xc315('0x3b')](_0x383199[_0xc315('0x30')][_0xc315('0x3b')]);_0x59ba4a[_0xc315('0x3c')]=qs['filters'](_[_0xc315('0x3d')](_0x383199['query'],_0x53140c[_0xc315('0x32')]),_0xdf63c2);if(_0x383199[_0xc315('0x30')][_0xc315('0x3e')]){_0x59ba4a[_0xc315('0x3c')]=_[_0xc315('0x3f')](_0x59ba4a[_0xc315('0x3c')],{'$or':_[_0xc315('0x2a')](_0xdf63c2,function(_0x2bc43f){if(_0x2bc43f[_0xc315('0x2e')]!=='VIRTUAL'){var _0x1c3c5f={};_0x1c3c5f[_0x2bc43f[_0xc315('0x27')]]={'$like':'%'+_0x383199[_0xc315('0x30')][_0xc315('0x3e')]+'%'};return _0x1c3c5f;}})});}_0x59ba4a=_[_0xc315('0x3f')]({},_0x59ba4a,_0x383199['options']);var _0x693f65={'where':_0x59ba4a[_0xc315('0x3c')]};return db[_0xc315('0x2b')][_0xc315('0x1d')](_0x693f65)[_0xc315('0x23')](function(_0x540942){_0x5269ac[_0xc315('0x1d')]=_0x540942;if(_0x383199[_0xc315('0x30')][_0xc315('0x40')]){_0x59ba4a[_0xc315('0x41')]=[{'all':!![]}];}return db[_0xc315('0x2b')][_0xc315('0x42')](_0x59ba4a);})[_0xc315('0x23')](function(_0x334fb9){_0x5269ac[_0xc315('0x43')]=_0x334fb9;return _0x5269ac;})['then'](respondWithFilteredResult(_0x1a7c16,_0x59ba4a))[_0xc315('0x44')](handleError(_0x1a7c16,null));};exports[_0xc315('0x45')]=function(_0x60c2bd,_0x4a8d87){var _0x11fa10={'raw':!![],'where':{'id':_0x60c2bd[_0xc315('0x46')]['id']}},_0x62adbc={};_0x62adbc[_0xc315('0x34')]=_[_0xc315('0x31')](db[_0xc315('0x2b')]['rawAttributes']);_0x62adbc[_0xc315('0x30')]=_[_0xc315('0x31')](_0x60c2bd[_0xc315('0x30')]);_0x62adbc['filters']=_['intersection'](_0x62adbc['model'],_0x62adbc['query']);_0x11fa10['attributes']=_[_0xc315('0x33')](_0x62adbc[_0xc315('0x34')],qs[_0xc315('0x35')](_0x60c2bd[_0xc315('0x30')][_0xc315('0x35')]));_0x11fa10['attributes']=_0x11fa10[_0xc315('0x36')][_0xc315('0x37')]?_0x11fa10[_0xc315('0x36')]:_0x62adbc[_0xc315('0x34')];if(_0x60c2bd['query']['includeAll']){_0x11fa10[_0xc315('0x41')]=[{'all':!![]}];}_0x11fa10=_[_0xc315('0x3f')]({},_0x11fa10,_0x60c2bd[_0xc315('0x47')]);return db['VoiceDialReport'][_0xc315('0x48')](_0x11fa10)['then'](handleEntityNotFound(_0x4a8d87,null))[_0xc315('0x23')](respondWithResult(_0x4a8d87,null))[_0xc315('0x44')](handleError(_0x4a8d87,null));};exports[_0xc315('0x49')]=function(_0x3f3507,_0x5e4ebf){return db['VoiceDialReport'][_0xc315('0x49')](_0x3f3507[_0xc315('0x4a')],{})['then'](respondWithResult(_0x5e4ebf,0xc9))[_0xc315('0x44')](handleError(_0x5e4ebf,null));};exports[_0xc315('0x22')]=function(_0x3c6556,_0x1f078e){if(_0x3c6556[_0xc315('0x4a')]['id']){delete _0x3c6556['body']['id'];}return db['VoiceDialReport'][_0xc315('0x48')]({'where':{'id':_0x3c6556['params']['id']}})[_0xc315('0x23')](handleEntityNotFound(_0x1f078e,null))[_0xc315('0x23')](saveUpdates(_0x3c6556[_0xc315('0x4a')],null))[_0xc315('0x23')](respondWithResult(_0x1f078e,null))[_0xc315('0x44')](handleError(_0x1f078e,null));};exports['destroy']=function(_0x376225,_0x4f4486){return db[_0xc315('0x2b')][_0xc315('0x48')]({'where':{'id':_0x376225[_0xc315('0x46')]['id']}})[_0xc315('0x23')](handleEntityNotFound(_0x4f4486,null))[_0xc315('0x23')](removeEntity(_0x4f4486,null))['catch'](handleError(_0x4f4486,null));};exports[_0xc315('0x4b')]=function(_0x410b7f,_0x1502ab){return db[_0xc315('0x2b')][_0xc315('0x4b')]()[_0xc315('0x23')](respondWithResult(_0x1502ab,null))[_0xc315('0x44')](handleError(_0x1502ab,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 79a50d0..6757aac 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 _0x65eb=['uniqueid','lodash','util','api','moment','bluebird','request-promise','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x27fb22,_0xab9f66){var _0x2046fc=function(_0x1a692c){while(--_0x1a692c){_0x27fb22['push'](_0x27fb22['shift']());}};_0x2046fc(++_0xab9f66);}(_0x65eb,0x1a3));var _0xb65e=function(_0x4ec145,_0x46c110){_0x4ec145=_0x4ec145-0x0;var _0x36bf68=_0x65eb[_0x4ec145];return _0x36bf68;};'use strict';var _=require(_0xb65e('0x0'));var util=require(_0xb65e('0x1'));var logger=require('../../config/logger')(_0xb65e('0x2'));var moment=require(_0xb65e('0x3'));var BPromise=require(_0xb65e('0x4'));var rp=require(_0xb65e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb65e('0x6'));module[_0xb65e('0x7')]=function(_0x3acce1,_0x3ce1db){return _0x3acce1[_0xb65e('0x8')](_0xb65e('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xb65e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49c4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x33b436,_0xd27939){var _0x19ec35=function(_0x11bcb7){while(--_0x11bcb7){_0x33b436['push'](_0x33b436['shift']());}};_0x19ec35(++_0xd27939);}(_0x49c4,0x9b));var _0x449c=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x49c4[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x449c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 827aba8..76d4211 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 _0xd45e=['raw','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options'];(function(_0xefcad4,_0x5cba66){var _0x1dfc41=function(_0x72457){while(--_0x72457){_0xefcad4['push'](_0xefcad4['shift']());}};_0x1dfc41(++_0x5cba66);}(_0xd45e,0xd0));var _0xed45=function(_0xf41c8e,_0x391401){_0xf41c8e=_0xf41c8e-0x0;var _0x1e7529=_0xd45e[_0xf41c8e];return _0x1e7529;};'use strict';var _=require('lodash');var util=require(_0xed45('0x0'));var moment=require(_0xed45('0x1'));var BPromise=require(_0xed45('0x2'));var rs=require(_0xed45('0x3'));var fs=require('fs');var Redis=require(_0xed45('0x4'));var db=require(_0xed45('0x5'))['db'];var utils=require(_0xed45('0x6'));var logger=require(_0xed45('0x7'))(_0xed45('0x8'));var config=require(_0xed45('0x9'));var jayson=require(_0xed45('0xa'));var client=jayson[_0xed45('0xb')][_0xed45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15e86e,_0x264f6d,_0x5a8977){return new BPromise(function(_0x2b3b44,_0x54db29){return client[_0xed45('0xd')](_0x15e86e,_0x5a8977)[_0xed45('0xe')](function(_0x18891d){logger[_0xed45('0xf')](_0xed45('0x10'),_0x264f6d,'request\x20sent');logger[_0xed45('0x11')](_0xed45('0x12'),_0x264f6d,_0xed45('0x13'),JSON[_0xed45('0x14')](_0x18891d));if(_0x18891d['error']){if(_0x18891d[_0xed45('0x15')][_0xed45('0x16')]===0x1f4){logger['error'](_0xed45('0x10'),_0x264f6d,_0x18891d[_0xed45('0x15')][_0xed45('0x17')]);return _0x54db29(_0x18891d[_0xed45('0x15')]['message']);}logger[_0xed45('0x15')](_0xed45('0x10'),_0x264f6d,_0x18891d['error'][_0xed45('0x17')]);return _0x2b3b44(_0x18891d[_0xed45('0x15')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x264f6d,_0xed45('0x13'));_0x2b3b44(_0x18891d[_0xed45('0x18')][_0xed45('0x17')]);}})[_0xed45('0x19')](function(_0xa63732){logger[_0xed45('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x264f6d,_0xa63732);_0x54db29(_0xa63732);});});}exports[_0xed45('0x1a')]=function(_0x26758a){var _0x32ca91=this;return new Promise(function(_0x38ad43,_0x1091b3){return db[_0xed45('0x1b')]['create'](_0x26758a[_0xed45('0x1c')],{'raw':_0x26758a['options']?_0x26758a[_0xed45('0x1d')][_0xed45('0x1e')]===undefined?!![]:![]:!![]})[_0xed45('0xe')](function(_0x19f581){logger[_0xed45('0xf')](_0xed45('0x1a'),_0x26758a);logger[_0xed45('0x11')](_0xed45('0x1a'),_0x26758a,JSON['stringify'](_0x19f581));_0x38ad43(_0x19f581);})['catch'](function(_0x30bc3c){logger[_0xed45('0x15')](_0xed45('0x1a'),_0x30bc3c['message'],_0x26758a);_0x1091b3(_0x32ca91[_0xed45('0x15')](0x1f4,_0x30bc3c[_0xed45('0x17')]));});});};exports[_0xed45('0x1f')]=function(_0x49bd6c){var _0x337e7b=this;return new Promise(function(_0x5d71fe,_0x2ae456){return db[_0xed45('0x1b')][_0xed45('0x20')](_0x49bd6c[_0xed45('0x1c')],{'raw':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c['options'][_0xed45('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c['options']['where']||null:null,'attributes':_0x49bd6c['options']?_0x49bd6c[_0xed45('0x1d')][_0xed45('0x21')]||null:null,'limit':_0x49bd6c[_0xed45('0x1d')]?_0x49bd6c[_0xed45('0x1d')]['limit']||null:null})[_0xed45('0xe')](function(_0x427f92){logger[_0xed45('0xf')](_0xed45('0x1f'),_0x49bd6c);logger[_0xed45('0x11')](_0xed45('0x1f'),_0x49bd6c,JSON[_0xed45('0x14')](_0x427f92));_0x5d71fe(_0x427f92);})[_0xed45('0x19')](function(_0xb61813){logger[_0xed45('0x15')](_0xed45('0x1f'),_0xb61813[_0xed45('0x17')],_0x49bd6c);_0x2ae456(_0x337e7b['error'](0x1f4,_0xb61813[_0xed45('0x17')]));});});}; \ No newline at end of file +var _0xe81d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateVoiceDialReport','VoiceDialReport','options','raw','then','catch','UpdateVoiceDialReport','update','body','where','attributes','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe81d,0x1d0));var _0xde81=function(_0x34f88c,_0x5962fd){_0x34f88c=_0x34f88c-0x0;var _0x410c7b=_0xe81d[_0x34f88c];return _0x410c7b;};'use strict';var _=require(_0xde81('0x0'));var util=require('util');var moment=require(_0xde81('0x1'));var BPromise=require(_0xde81('0x2'));var rs=require(_0xde81('0x3'));var fs=require('fs');var Redis=require(_0xde81('0x4'));var db=require(_0xde81('0x5'))['db'];var utils=require(_0xde81('0x6'));var logger=require(_0xde81('0x7'))('rpc');var config=require(_0xde81('0x8'));var jayson=require(_0xde81('0x9'));var client=jayson['client'][_0xde81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aa53c,_0x48d42d,_0x10d72b){return new BPromise(function(_0x14eab4,_0x1d6149){return client[_0xde81('0xb')](_0x1aa53c,_0x10d72b)['then'](function(_0x51e8ba){logger[_0xde81('0xc')](_0xde81('0xd'),_0x48d42d,_0xde81('0xe'));logger[_0xde81('0xf')](_0xde81('0x10'),_0x48d42d,_0xde81('0xe'),JSON[_0xde81('0x11')](_0x51e8ba));if(_0x51e8ba[_0xde81('0x12')]){if(_0x51e8ba[_0xde81('0x12')]['code']===0x1f4){logger['error'](_0xde81('0xd'),_0x48d42d,_0x51e8ba[_0xde81('0x12')]['message']);return _0x1d6149(_0x51e8ba['error'][_0xde81('0x13')]);}logger['error'](_0xde81('0xd'),_0x48d42d,_0x51e8ba[_0xde81('0x12')][_0xde81('0x13')]);return _0x14eab4(_0x51e8ba[_0xde81('0x12')]['message']);}else{logger[_0xde81('0xc')](_0xde81('0xd'),_0x48d42d,_0xde81('0xe'));_0x14eab4(_0x51e8ba['result'][_0xde81('0x13')]);}})['catch'](function(_0x33c175){logger['error'](_0xde81('0xd'),_0x48d42d,_0x33c175);_0x1d6149(_0x33c175);});});}exports[_0xde81('0x14')]=function(_0x3d0b4d){var _0x442ef2=this;return new Promise(function(_0x3ab4ac,_0x5771de){return db[_0xde81('0x15')]['create'](_0x3d0b4d['body'],{'raw':_0x3d0b4d[_0xde81('0x16')]?_0x3d0b4d['options'][_0xde81('0x17')]===undefined?!![]:![]:!![]})[_0xde81('0x18')](function(_0x32148e){logger[_0xde81('0xc')](_0xde81('0x14'),_0x3d0b4d);logger[_0xde81('0xf')](_0xde81('0x14'),_0x3d0b4d,JSON[_0xde81('0x11')](_0x32148e));_0x3ab4ac(_0x32148e);})[_0xde81('0x19')](function(_0x2f19ab){logger[_0xde81('0x12')](_0xde81('0x14'),_0x2f19ab['message'],_0x3d0b4d);_0x5771de(_0x442ef2['error'](0x1f4,_0x2f19ab[_0xde81('0x13')]));});});};exports[_0xde81('0x1a')]=function(_0x3647b7){var _0x1f6258=this;return new Promise(function(_0x2ccb9f,_0x2079c8){return db[_0xde81('0x15')][_0xde81('0x1b')](_0x3647b7[_0xde81('0x1c')],{'raw':_0x3647b7[_0xde81('0x16')]?_0x3647b7[_0xde81('0x16')][_0xde81('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3647b7[_0xde81('0x16')]?_0x3647b7[_0xde81('0x16')][_0xde81('0x1d')]||null:null,'attributes':_0x3647b7['options']?_0x3647b7[_0xde81('0x16')][_0xde81('0x1e')]||null:null,'limit':_0x3647b7[_0xde81('0x16')]?_0x3647b7[_0xde81('0x16')]['limit']||null:null})[_0xde81('0x18')](function(_0x1da6fb){logger[_0xde81('0xc')](_0xde81('0x1a'),_0x3647b7);logger[_0xde81('0xf')](_0xde81('0x1a'),_0x3647b7,JSON[_0xde81('0x11')](_0x1da6fb));_0x2ccb9f(_0x1da6fb);})[_0xde81('0x19')](function(_0x16127e){logger[_0xde81('0x12')](_0xde81('0x1a'),_0x16127e['message'],_0x3647b7);_0x2079c8(_0x1f6258[_0xde81('0x12')](0x1f4,_0x16127e[_0xde81('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8b6b78b..f810893 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 _0xcb43=['create','addApplications','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xcb43,0x148));var _0x3cb4=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcb43[_0x456fb1];return _0x4083d6;};'use strict';var multer=require(_0x3cb4('0x0'));var util=require(_0x3cb4('0x1'));var path=require(_0x3cb4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cb4('0x3'));var router=express[_0x3cb4('0x4')]();var fs_extra=require(_0x3cb4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cb4('0x6'));var config=require(_0x3cb4('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0x9')]);router[_0x3cb4('0xa')](_0x3cb4('0xb'),auth['isAuthenticated'](),controller[_0x3cb4('0xc')]);router[_0x3cb4('0xd')]('/',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0xe')]);router[_0x3cb4('0xd')]('/:id/applications',auth[_0x3cb4('0x8')](),controller[_0x3cb4('0xf')]);router[_0x3cb4('0x10')](_0x3cb4('0xb'),auth[_0x3cb4('0x8')](),controller[_0x3cb4('0x11')]);router['delete'](_0x3cb4('0xb'),auth[_0x3cb4('0x8')](),controller['destroy']);module[_0x3cb4('0x12')]=router; \ No newline at end of file +var _0x25cc=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy'];(function(_0x4a8359,_0x30ab0d){var _0x152188=function(_0x4266e5){while(--_0x4266e5){_0x4a8359['push'](_0x4a8359['shift']());}};_0x152188(++_0x30ab0d);}(_0x25cc,0x1cd));var _0xc25c=function(_0x2634c7,_0x16cec4){_0x2634c7=_0x2634c7-0x0;var _0x5a3316=_0x25cc[_0x2634c7];return _0x5a3316;};'use strict';var multer=require(_0xc25c('0x0'));var util=require(_0xc25c('0x1'));var path=require(_0xc25c('0x2'));var timeout=require(_0xc25c('0x3'));var express=require(_0xc25c('0x4'));var router=express['Router']();var fs_extra=require(_0xc25c('0x5'));var auth=require(_0xc25c('0x6'));var interaction=require(_0xc25c('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xc25c('0x8')](),controller['index']);router[_0xc25c('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc25c('0xa')]('/',auth[_0xc25c('0x8')](),controller[_0xc25c('0xb')]);router['post'](_0xc25c('0xc'),auth['isAuthenticated'](),controller[_0xc25c('0xd')]);router[_0xc25c('0xe')](_0xc25c('0xf'),auth['isAuthenticated'](),controller[_0xc25c('0x10')]);router[_0xc25c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc25c('0x12')]);module[_0xc25c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index bda1cb7..f53a9f8 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 _0x0c0c=['INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0c0c,0xaa));var _0xc0c0=function(_0x3ddfc8,_0xc7ea18){_0x3ddfc8=_0x3ddfc8-0x0;var _0x8a9392=_0x0c0c[_0x3ddfc8];return _0x8a9392;};'use strict';var Sequelize=require(_0xc0c0('0x0'));module[_0xc0c0('0x1')]={'context':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'unique':_0xc0c0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'unique':_0xc0c0('0x3')},'priority':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xc0c0('0x3')},'tag':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'defaultValue':_0xc0c0('0x4')},'appdata':{'type':Sequelize[_0xc0c0('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc0c0('0x5')]('inbound','outbound','internal',_0xc0c0('0x6'),_0xc0c0('0x7'),_0xc0c0('0x8'),_0xc0c0('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc0c0('0xa')]},'isApp':{'type':Sequelize[_0xc0c0('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc0c0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc0c0('0xa')]},'recordingFormat':{'type':Sequelize[_0xc0c0('0x2')],'defaultValue':_0xc0c0('0xc')},'answer':{'type':Sequelize[_0xc0c0('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc0c0('0xd')],'get':function(_0x437f33){return this[_0xc0c0('0xe')]('exten');}},'alias':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8a3e=['BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','compositeIndex','STRING','ENUM','inbound','inbound-fax','system','any','*,*,*,*'];(function(_0x5e2fff,_0x3e9064){var _0x22a821=function(_0x8e7aad){while(--_0x8e7aad){_0x5e2fff['push'](_0x5e2fff['shift']());}};_0x22a821(++_0x3e9064);}(_0x8a3e,0xc9));var _0xe8a3=function(_0x4bf290,_0x4e3a7b){_0x4bf290=_0x4bf290-0x0;var _0x280b74=_0x8a3e[_0x4bf290];return _0x280b74;};'use strict';var Sequelize=require(_0xe8a3('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe8a3('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe8a3('0x1')},'priority':{'type':Sequelize[_0xe8a3('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xe8a3('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xe8a3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe8a3('0x3')](_0xe8a3('0x4'),'outbound','internal',_0xe8a3('0x5'),'outbound-fax',_0xe8a3('0x6'),_0xe8a3('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0xe8a3('0x2')]},'interval':{'type':Sequelize[_0xe8a3('0x2')],'allowNull':![],'defaultValue':_0xe8a3('0x8')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xe8a3('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe8a3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe8a3('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xe8a3('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe8a3('0xa')]},'recordingFormat':{'type':Sequelize[_0xe8a3('0x2')],'defaultValue':_0xe8a3('0xb')},'answer':{'type':Sequelize[_0xe8a3('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe8a3('0xc')],'get':function(_0x570c5b){return this[_0xe8a3('0xd')](_0xe8a3('0xe'));}},'alias':{'type':Sequelize[_0xe8a3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 40acb62..e7af9af 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 _0x11b7=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','find','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11b7,0xd6));var _0x711b=function(_0x508fa4,_0x36dd59){_0x508fa4=_0x508fa4-0x0;var _0x3b0bd4=_0x11b7[_0x508fa4];return _0x3b0bd4;};'use strict';var _=require(_0x711b('0x0'));var Redis=require(_0x711b('0x1'));var qs=require(_0x711b('0x2'));var logger=require(_0x711b('0x3'))(_0x711b('0x4'));var config=require('../../config/environment');var db=require(_0x711b('0x5'))['db'];config[_0x711b('0x6')]=_[_0x711b('0x7')](config[_0x711b('0x6')],{'host':_0x711b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x711b('0x6')]));require(_0x711b('0x9'))[_0x711b('0xa')](socket);function respondWithStatusCode(_0x18a21f,_0x1e365f){_0x1e365f=_0x1e365f||0xcc;return function(_0x2dc370){if(_0x2dc370){return _0x18a21f['sendStatus'](_0x1e365f);}return _0x18a21f[_0x711b('0xb')](_0x1e365f)[_0x711b('0xc')]();};}function respondWithResult(_0x1f009b,_0x534341){_0x534341=_0x534341||0xc8;return function(_0x7da8f6){if(_0x7da8f6){return _0x1f009b['status'](_0x534341)[_0x711b('0xd')](_0x7da8f6);}};}function respondWithFilteredResult(_0x315cd5,_0x32692b){return function(_0x5ae0db){if(_0x5ae0db){var _0x2bcf10=typeof _0x32692b[_0x711b('0xe')]===_0x711b('0xf')&&typeof _0x32692b[_0x711b('0x10')]===_0x711b('0xf');var _0x57db08=_0x5ae0db[_0x711b('0x11')];var _0x526230=_0x2bcf10?0x0:_0x32692b[_0x711b('0xe')];var _0x2e93d0=_0x2bcf10?_0x5ae0db['count']:_0x32692b['offset']+_0x32692b[_0x711b('0x10')];var _0x4625be;if(_0x2e93d0>=_0x57db08){_0x2e93d0=_0x57db08;_0x4625be=0xc8;}else{_0x4625be=0xce;}_0x315cd5[_0x711b('0xb')](_0x4625be);return _0x315cd5[_0x711b('0x12')](_0x711b('0x13'),_0x526230+'-'+_0x2e93d0+'/'+_0x57db08)[_0x711b('0xd')](_0x5ae0db);}return null;};}function removeEntity(_0x1919d4){return function(_0x58dea5){if(_0x58dea5){return _0x58dea5[_0x711b('0x14')]()['then'](function(){var _0x284db3=_0x58dea5[_0x711b('0x15')]({'plain':!![]});var _0x87d66a=[{'name':_0x711b('0x16'),'value':'inbound','ignore':![]},{'name':_0x711b('0x17'),'value':_0x711b('0x18'),'ignore':![]},{'name':_0x711b('0x19'),'value':_0x711b('0x1a'),'ignore':![]}];var _0x4bb428=_(_0x87d66a)[_0x711b('0x1b')](_0x711b('0x1c'))['map'](_0x711b('0x1d'))['value']();if(_[_0x711b('0x1e')](_0x4bb428,_0x284db3[_0x711b('0x1f')])){return;}var _0x34b26d=_['find'](_0x87d66a,['value',_0x284db3[_0x711b('0x1f')]])['name'];return db[_0x711b('0x20')][_0x711b('0x14')]({'where':{'type':_0x34b26d,'resourceId':_0x284db3['id']}})[_0x711b('0x21')](function(){return _0x58dea5;});})[_0x711b('0x21')](function(){_0x1919d4[_0x711b('0xb')](0xcc)[_0x711b('0xc')]();});}};}function handleEntityNotFound(_0x5cd4f2){return function(_0x4cfbbf){if(!_0x4cfbbf){_0x5cd4f2[_0x711b('0x22')](0x194);}return _0x4cfbbf;};}function handleError(_0x4a0aff,_0x191f39){_0x191f39=_0x191f39||0x1f4;return function(_0x5df301){logger[_0x711b('0x23')](_0x5df301[_0x711b('0x24')]);if(_0x5df301['name']){delete _0x5df301[_0x711b('0x25')];}_0x4a0aff['status'](_0x191f39)[_0x711b('0x26')](_0x5df301);};}exports[_0x711b('0x27')]=function(_0x2b78f8,_0x36c30c){var _0x3309e0={},_0x3febd0={},_0x2d016b={'count':0x0,'rows':[]};var _0x16d5e5=_[_0x711b('0x28')](db['VoiceExtension'][_0x711b('0x29')],function(_0x2c72de){return{'name':_0x2c72de[_0x711b('0x2a')],'type':_0x2c72de['type'][_0x711b('0x2b')]};});_0x3febd0['model']=_[_0x711b('0x28')](_0x16d5e5,_0x711b('0x25'));_0x3febd0[_0x711b('0x2c')]=_[_0x711b('0x2d')](_0x2b78f8[_0x711b('0x2c')]);_0x3febd0[_0x711b('0x2e')]=_[_0x711b('0x2f')](_0x3febd0[_0x711b('0x30')],_0x3febd0[_0x711b('0x2c')]);_0x3309e0[_0x711b('0x31')]=_[_0x711b('0x2f')](_0x3febd0[_0x711b('0x30')],qs['fields'](_0x2b78f8[_0x711b('0x2c')][_0x711b('0x32')]));_0x3309e0[_0x711b('0x31')]=_0x3309e0[_0x711b('0x31')][_0x711b('0x33')]?_0x3309e0[_0x711b('0x31')]:_0x3febd0[_0x711b('0x30')];if(!_0x2b78f8[_0x711b('0x2c')][_0x711b('0x34')](_0x711b('0x35'))){_0x3309e0[_0x711b('0x10')]=qs['limit'](_0x2b78f8['query'][_0x711b('0x10')]);_0x3309e0[_0x711b('0xe')]=qs[_0x711b('0xe')](_0x2b78f8['query'][_0x711b('0xe')]);}_0x3309e0[_0x711b('0x36')]=qs['sort'](_0x2b78f8[_0x711b('0x2c')][_0x711b('0x37')]);_0x3309e0[_0x711b('0x38')]=qs[_0x711b('0x2e')](_[_0x711b('0x39')](_0x2b78f8[_0x711b('0x2c')],_0x3febd0[_0x711b('0x2e')]),_0x16d5e5);if(_0x2b78f8['query']['filter']){_0x3309e0[_0x711b('0x38')]=_[_0x711b('0x3a')](_0x3309e0[_0x711b('0x38')],{'$or':_[_0x711b('0x28')](_0x16d5e5,function(_0x535bde){if(_0x535bde[_0x711b('0x1f')]!==_0x711b('0x3b')){var _0x19da65={};_0x19da65[_0x535bde[_0x711b('0x25')]]={'$like':'%'+_0x2b78f8['query'][_0x711b('0x1b')]+'%'};return _0x19da65;}})});}_0x3309e0=_[_0x711b('0x3a')]({},_0x3309e0,_0x2b78f8[_0x711b('0x3c')]);var _0x24ce59={'where':_0x3309e0[_0x711b('0x38')]};return db[_0x711b('0x3d')]['count'](_0x24ce59)[_0x711b('0x21')](function(_0x38a9fe){_0x2d016b['count']=_0x38a9fe;if(_0x2b78f8[_0x711b('0x2c')][_0x711b('0x3e')]){_0x3309e0[_0x711b('0x3f')]=[{'all':!![]}];}return db['VoiceExtension'][_0x711b('0x40')](_0x3309e0);})[_0x711b('0x21')](function(_0x4a8b90){_0x2d016b[_0x711b('0x41')]=_0x4a8b90;return _0x2d016b;})['then'](respondWithFilteredResult(_0x36c30c,_0x3309e0))[_0x711b('0x42')](handleError(_0x36c30c,null));};exports[_0x711b('0x43')]=function(_0xf55286,_0x1e635a){var _0x573147={'raw':![],'where':{'id':_0xf55286[_0x711b('0x44')]['id']}},_0x50dd0b={};_0x50dd0b[_0x711b('0x30')]=_['keys'](db['VoiceExtension'][_0x711b('0x29')]);_0x50dd0b[_0x711b('0x2c')]=_[_0x711b('0x2d')](_0xf55286['query']);_0x50dd0b[_0x711b('0x2e')]=_[_0x711b('0x2f')](_0x50dd0b[_0x711b('0x30')],_0x50dd0b[_0x711b('0x2c')]);_0x573147['attributes']=_[_0x711b('0x2f')](_0x50dd0b[_0x711b('0x30')],qs['fields'](_0xf55286[_0x711b('0x2c')][_0x711b('0x32')]));_0x573147[_0x711b('0x31')]=_0x573147[_0x711b('0x31')][_0x711b('0x33')]?_0x573147[_0x711b('0x31')]:_0x50dd0b[_0x711b('0x30')];if(_0xf55286[_0x711b('0x2c')]['includeAll']){_0x573147[_0x711b('0x3f')]=[{'all':!![]}];}_0x573147=_['merge']({},_0x573147,_0xf55286['options']);return db[_0x711b('0x3d')][_0x711b('0x45')](_0x573147)[_0x711b('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x711b('0x21')](respondWithResult(_0x1e635a,null))[_0x711b('0x42')](handleError(_0x1e635a,null));};exports[_0x711b('0x14')]=function(_0xc9dcf2,_0x25466f){return db[_0x711b('0x3d')]['find']({'where':{'id':_0xc9dcf2[_0x711b('0x44')]['id']}})[_0x711b('0x21')](handleEntityNotFound(_0x25466f,null))[_0x711b('0x21')](removeEntity(_0x25466f,null))[_0x711b('0x42')](handleError(_0x25466f,null));};exports[_0x711b('0x46')]=function(_0xc07f4d,_0x4839a3){if(_0xc07f4d['body'][_0x711b('0x1f')]===_0x711b('0x18')&&!_['startsWith'](_0xc07f4d[_0x711b('0x47')][_0x711b('0x48')],'_')){_0xc07f4d[_0x711b('0x47')]['exten']='_'[_0x711b('0x49')](_0xc07f4d[_0x711b('0x47')][_0x711b('0x48')]);}return db['VoiceExtension'][_0x711b('0x46')](_0xc07f4d[_0x711b('0x47')],{'raw':![]})[_0x711b('0x21')](function(_0x39b84c){var _0x395e42=_0xc07f4d[_0x711b('0x4a')]['get']({'plain':!![]});if(!_0x395e42)throw new Error(_0x711b('0x4b'));if(_0x395e42[_0x711b('0x4c')]==='user'){var _0x34d6d7=_0x39b84c[_0x711b('0x15')]({'plain':!![]});var _0x438736=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x711b('0x17'),'value':_0x711b('0x18')},{'name':_0x711b('0x19'),'value':'internal'}];var _0x5b15bc=_['find'](_0x438736,['value',_0x34d6d7[_0x711b('0x1f')]])['name'];return db[_0x711b('0x4d')]['find']({'where':{'name':_0x5b15bc,'userProfileId':_0x395e42[_0x711b('0x4e')]},'raw':!![]})[_0x711b('0x21')](function(_0x562aaf){if(_0x562aaf&&_0x562aaf[_0x711b('0x4f')]===0x0){return db[_0x711b('0x20')][_0x711b('0x46')]({'name':_0x34d6d7[_0x711b('0x25')],'resourceId':_0x34d6d7['id'],'type':_0x562aaf[_0x711b('0x25')],'sectionId':_0x562aaf['id']},{})['then'](function(){return _0x39b84c;});}else{return _0x39b84c;}})[_0x711b('0x42')](function(_0xc0cfbb){logger[_0x711b('0x23')](_0x711b('0x50'),_0xc0cfbb);throw _0xc0cfbb;});}return _0x39b84c;})[_0x711b('0x21')](respondWithResult(_0x4839a3,0xc9))['catch'](handleError(_0x4839a3,null));};exports[_0x711b('0x51')]=function(_0x4c11fa,_0x529948){if(_0x4c11fa[_0x711b('0x47')]['id']){delete _0x4c11fa[_0x711b('0x47')]['id'];}return db[_0x711b('0x3d')][_0x711b('0x45')]({'where':{'id':_0x4c11fa[_0x711b('0x44')]['id']}})[_0x711b('0x21')](handleEntityNotFound(_0x529948,null))[_0x711b('0x21')](function(_0x3ba185){if(_0x3ba185){return db[_0x711b('0x3d')][_0x711b('0x51')](_['pick'](_0x4c11fa[_0x711b('0x47')],[_0x711b('0x48'),'context',_0x711b('0x52'),_0x711b('0x53'),_0x711b('0x54'),_0x711b('0x55'),_0x711b('0x56')]),{'where':{'context':_0x3ba185[_0x711b('0x57')],'exten':_0x3ba185['exten']},'individualHooks':!![]})[_0x711b('0x21')](function(_0x5a692a){return _0x5a692a;});}return null;})[_0x711b('0x21')](respondWithStatusCode(_0x529948,null))[_0x711b('0x42')](handleError(_0x529948,null));};exports['addApplications']=function(_0x1643ea,_0x49a4a9){var _0x38ce38=_0x1643ea[_0x711b('0x44')]['id'];var _0x45715f=_0x1643ea[_0x711b('0x47')];var _0x360db2=0xc8;var _0xf9fdb=null;return db[_0x711b('0x58')][_0x711b('0x59')]({'isolationLevel':db['sequelize'][_0x711b('0x5a')][_0x711b('0x5b')][_0x711b('0x5c')]},function(_0x40b5fd){return db[_0x711b('0x3d')][_0x711b('0x5d')]({'where':{'id':_0x38ce38},'transaction':_0x40b5fd})[_0x711b('0x21')](function(_0x5b2cd4){if(_0x5b2cd4){return db[_0x711b('0x3d')]['destroy']({'where':{'VoiceExtensionId':_0x38ce38},'transaction':_0x40b5fd})[_0x711b('0x21')](function(){var _0x3819ab=_[_0x711b('0x28')](_0x45715f,function(_0x29c8ae){_0x29c8ae[_0x711b('0x5e')]=_0x38ce38;_0x29c8ae['isApp']=!![];return _0x29c8ae;});return _0x5b2cd4['createRouting'](_0x3819ab);})['then'](function(_0x14ecd2){return db['VoiceExtension'][_0x711b('0x5f')](_0x14ecd2,{'transaction':_0x40b5fd});});}else{_0x360db2=0x194;_0xf9fdb=[];}});})['then'](function(){if(_0x360db2!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x38ce38},'order':_0x711b('0x60')})[_0x711b('0x21')](function(_0x3af5a4){_0xf9fdb=_0x3af5a4;});}})['catch'](function(_0x4dece8){_0x360db2=0x1f4;logger[_0x711b('0x23')](_0x4dece8[_0x711b('0x24')]);if(_0x4dece8[_0x711b('0x25')]){delete _0x4dece8['name'];}_0xf9fdb=_0x4dece8;})['finally'](function(){if(_0xf9fdb===null){_0x49a4a9[_0x711b('0x22')](_0x360db2);}else{if(_0x360db2===0x1f4){_0x49a4a9[_0x711b('0xb')](_0x360db2)[_0x711b('0x26')](_0xf9fdb);}else{_0x49a4a9[_0x711b('0xb')](_0x360db2)['json'](_0xf9fdb);}}});}; \ No newline at end of file +var _0xa8a5=['ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','then','include','findAll','rows','show','params','keys','includeAll','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xa8a5,0x195));var _0x5a8a=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa8a5[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x5a8a('0x0'));var Redis=require(_0x5a8a('0x1'));var qs=require(_0x5a8a('0x2'));var logger=require(_0x5a8a('0x3'))(_0x5a8a('0x4'));var config=require(_0x5a8a('0x5'));var db=require(_0x5a8a('0x6'))['db'];config[_0x5a8a('0x7')]=_[_0x5a8a('0x8')](config[_0x5a8a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a8a('0x9'))(new Redis(config[_0x5a8a('0x7')]));require(_0x5a8a('0xa'))[_0x5a8a('0xb')](socket);function respondWithStatusCode(_0x4082cf,_0x1807d7){_0x1807d7=_0x1807d7||0xcc;return function(_0x4a305d){if(_0x4a305d){return _0x4082cf[_0x5a8a('0xc')](_0x1807d7);}return _0x4082cf[_0x5a8a('0xd')](_0x1807d7)[_0x5a8a('0xe')]();};}function respondWithResult(_0x4e3e10,_0x48c2fa){_0x48c2fa=_0x48c2fa||0xc8;return function(_0x30c258){if(_0x30c258){return _0x4e3e10[_0x5a8a('0xd')](_0x48c2fa)[_0x5a8a('0xf')](_0x30c258);}};}function respondWithFilteredResult(_0x30f2c8,_0x5b4eb){return function(_0x1d8e07){if(_0x1d8e07){var _0xfb4440=typeof _0x5b4eb[_0x5a8a('0x10')]===_0x5a8a('0x11')&&typeof _0x5b4eb[_0x5a8a('0x12')]===_0x5a8a('0x11');var _0x2d6555=_0x1d8e07[_0x5a8a('0x13')];var _0x458e90=_0xfb4440?0x0:_0x5b4eb[_0x5a8a('0x10')];var _0x4eeb3a=_0xfb4440?_0x1d8e07['count']:_0x5b4eb[_0x5a8a('0x10')]+_0x5b4eb[_0x5a8a('0x12')];var _0x5b590b;if(_0x4eeb3a>=_0x2d6555){_0x4eeb3a=_0x2d6555;_0x5b590b=0xc8;}else{_0x5b590b=0xce;}_0x30f2c8[_0x5a8a('0xd')](_0x5b590b);return _0x30f2c8[_0x5a8a('0x14')](_0x5a8a('0x15'),_0x458e90+'-'+_0x4eeb3a+'/'+_0x2d6555)[_0x5a8a('0xf')](_0x1d8e07);}return null;};}function removeEntity(_0x4c3072){return function(_0x2176c8){if(_0x2176c8){return _0x2176c8[_0x5a8a('0x16')]()['then'](function(){var _0xe729fc=_0x2176c8[_0x5a8a('0x17')]({'plain':!![]});var _0x67d947=[{'name':_0x5a8a('0x18'),'value':'inbound','ignore':![]},{'name':_0x5a8a('0x19'),'value':_0x5a8a('0x1a'),'ignore':![]},{'name':_0x5a8a('0x1b'),'value':_0x5a8a('0x1c'),'ignore':![]}];var _0x10c55b=_(_0x67d947)[_0x5a8a('0x1d')](_0x5a8a('0x1e'))[_0x5a8a('0x1f')]('value')[_0x5a8a('0x20')]();if(_[_0x5a8a('0x21')](_0x10c55b,_0xe729fc[_0x5a8a('0x22')])){return;}var _0x4e7f78=_[_0x5a8a('0x23')](_0x67d947,['value',_0xe729fc[_0x5a8a('0x22')]])[_0x5a8a('0x24')];return db[_0x5a8a('0x25')][_0x5a8a('0x16')]({'where':{'type':_0x4e7f78,'resourceId':_0xe729fc['id']}})['then'](function(){return _0x2176c8;});})['then'](function(){_0x4c3072['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2012ff){return function(_0x399097){if(!_0x399097){_0x2012ff[_0x5a8a('0xc')](0x194);}return _0x399097;};}function handleError(_0x54b0ce,_0x373f61){_0x373f61=_0x373f61||0x1f4;return function(_0x4ee739){logger[_0x5a8a('0x26')](_0x4ee739[_0x5a8a('0x27')]);if(_0x4ee739[_0x5a8a('0x24')]){delete _0x4ee739['name'];}_0x54b0ce[_0x5a8a('0xd')](_0x373f61)[_0x5a8a('0x28')](_0x4ee739);};}exports[_0x5a8a('0x29')]=function(_0x582e0a,_0x1248cb){var _0x33c2c2={},_0x4c65c0={},_0x3f5488={'count':0x0,'rows':[]};var _0x149d01=_[_0x5a8a('0x1f')](db[_0x5a8a('0x2a')][_0x5a8a('0x2b')],function(_0x35a531){return{'name':_0x35a531[_0x5a8a('0x2c')],'type':_0x35a531[_0x5a8a('0x22')][_0x5a8a('0x2d')]};});_0x4c65c0[_0x5a8a('0x2e')]=_[_0x5a8a('0x1f')](_0x149d01,_0x5a8a('0x24'));_0x4c65c0[_0x5a8a('0x2f')]=_['keys'](_0x582e0a['query']);_0x4c65c0[_0x5a8a('0x30')]=_[_0x5a8a('0x31')](_0x4c65c0[_0x5a8a('0x2e')],_0x4c65c0[_0x5a8a('0x2f')]);_0x33c2c2[_0x5a8a('0x32')]=_[_0x5a8a('0x31')](_0x4c65c0[_0x5a8a('0x2e')],qs[_0x5a8a('0x33')](_0x582e0a['query'][_0x5a8a('0x33')]));_0x33c2c2[_0x5a8a('0x32')]=_0x33c2c2['attributes'][_0x5a8a('0x34')]?_0x33c2c2[_0x5a8a('0x32')]:_0x4c65c0['model'];if(!_0x582e0a[_0x5a8a('0x2f')][_0x5a8a('0x35')](_0x5a8a('0x36'))){_0x33c2c2['limit']=qs[_0x5a8a('0x12')](_0x582e0a[_0x5a8a('0x2f')]['limit']);_0x33c2c2[_0x5a8a('0x10')]=qs['offset'](_0x582e0a[_0x5a8a('0x2f')][_0x5a8a('0x10')]);}_0x33c2c2[_0x5a8a('0x37')]=qs[_0x5a8a('0x38')](_0x582e0a[_0x5a8a('0x2f')][_0x5a8a('0x38')]);_0x33c2c2[_0x5a8a('0x39')]=qs[_0x5a8a('0x30')](_[_0x5a8a('0x3a')](_0x582e0a[_0x5a8a('0x2f')],_0x4c65c0[_0x5a8a('0x30')]),_0x149d01);if(_0x582e0a[_0x5a8a('0x2f')][_0x5a8a('0x1d')]){_0x33c2c2[_0x5a8a('0x39')]=_[_0x5a8a('0x3b')](_0x33c2c2[_0x5a8a('0x39')],{'$or':_[_0x5a8a('0x1f')](_0x149d01,function(_0xa293e1){if(_0xa293e1[_0x5a8a('0x22')]!=='VIRTUAL'){var _0x3d55f3={};_0x3d55f3[_0xa293e1[_0x5a8a('0x24')]]={'$like':'%'+_0x582e0a[_0x5a8a('0x2f')][_0x5a8a('0x1d')]+'%'};return _0x3d55f3;}})});}_0x33c2c2=_[_0x5a8a('0x3b')]({},_0x33c2c2,_0x582e0a['options']);var _0x484370={'where':_0x33c2c2[_0x5a8a('0x39')]};return db[_0x5a8a('0x2a')][_0x5a8a('0x13')](_0x484370)[_0x5a8a('0x3c')](function(_0xcd3298){_0x3f5488[_0x5a8a('0x13')]=_0xcd3298;if(_0x582e0a[_0x5a8a('0x2f')]['includeAll']){_0x33c2c2[_0x5a8a('0x3d')]=[{'all':!![]}];}return db[_0x5a8a('0x2a')][_0x5a8a('0x3e')](_0x33c2c2);})[_0x5a8a('0x3c')](function(_0x2b0714){_0x3f5488[_0x5a8a('0x3f')]=_0x2b0714;return _0x3f5488;})['then'](respondWithFilteredResult(_0x1248cb,_0x33c2c2))['catch'](handleError(_0x1248cb,null));};exports[_0x5a8a('0x40')]=function(_0x348c59,_0x1d4052){var _0x32ff10={'raw':![],'where':{'id':_0x348c59[_0x5a8a('0x41')]['id']}},_0x590fe0={};_0x590fe0['model']=_[_0x5a8a('0x42')](db['VoiceExtension']['rawAttributes']);_0x590fe0[_0x5a8a('0x2f')]=_[_0x5a8a('0x42')](_0x348c59[_0x5a8a('0x2f')]);_0x590fe0[_0x5a8a('0x30')]=_[_0x5a8a('0x31')](_0x590fe0[_0x5a8a('0x2e')],_0x590fe0[_0x5a8a('0x2f')]);_0x32ff10[_0x5a8a('0x32')]=_[_0x5a8a('0x31')](_0x590fe0[_0x5a8a('0x2e')],qs[_0x5a8a('0x33')](_0x348c59[_0x5a8a('0x2f')][_0x5a8a('0x33')]));_0x32ff10[_0x5a8a('0x32')]=_0x32ff10[_0x5a8a('0x32')]['length']?_0x32ff10['attributes']:_0x590fe0[_0x5a8a('0x2e')];if(_0x348c59[_0x5a8a('0x2f')][_0x5a8a('0x43')]){_0x32ff10[_0x5a8a('0x3d')]=[{'all':!![]}];}_0x32ff10=_['merge']({},_0x32ff10,_0x348c59['options']);return db['VoiceExtension'][_0x5a8a('0x23')](_0x32ff10)[_0x5a8a('0x3c')](handleEntityNotFound(_0x1d4052,null))[_0x5a8a('0x3c')](respondWithResult(_0x1d4052,null))['catch'](handleError(_0x1d4052,null));};exports[_0x5a8a('0x16')]=function(_0x3a7aee,_0x47a2d2){return db[_0x5a8a('0x2a')]['find']({'where':{'id':_0x3a7aee[_0x5a8a('0x41')]['id']}})['then'](handleEntityNotFound(_0x47a2d2,null))[_0x5a8a('0x3c')](removeEntity(_0x47a2d2,null))['catch'](handleError(_0x47a2d2,null));};exports['create']=function(_0x18db4c,_0x3f133d){if(_0x18db4c['body'][_0x5a8a('0x22')]===_0x5a8a('0x1a')&&!_[_0x5a8a('0x44')](_0x18db4c[_0x5a8a('0x45')][_0x5a8a('0x46')],'_')){_0x18db4c[_0x5a8a('0x45')][_0x5a8a('0x46')]='_'[_0x5a8a('0x47')](_0x18db4c[_0x5a8a('0x45')]['exten']);}return db[_0x5a8a('0x2a')]['create'](_0x18db4c['body'],{'raw':![]})[_0x5a8a('0x3c')](function(_0x144a06){var _0x507b05=_0x18db4c[_0x5a8a('0x48')]['get']({'plain':!![]});if(!_0x507b05)throw new Error(_0x5a8a('0x49'));if(_0x507b05[_0x5a8a('0x4a')]===_0x5a8a('0x48')){var _0x5cad4f=_0x144a06[_0x5a8a('0x17')]({'plain':!![]});var _0x226837=[{'name':_0x5a8a('0x18'),'value':_0x5a8a('0x4b')},{'name':_0x5a8a('0x19'),'value':_0x5a8a('0x1a')},{'name':_0x5a8a('0x1b'),'value':_0x5a8a('0x1c')}];var _0x3268be=_[_0x5a8a('0x23')](_0x226837,[_0x5a8a('0x20'),_0x5cad4f[_0x5a8a('0x22')]])[_0x5a8a('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x3268be,'userProfileId':_0x507b05[_0x5a8a('0x4c')]},'raw':!![]})['then'](function(_0x3fccef){if(_0x3fccef&&_0x3fccef['autoAssociation']===0x0){return db[_0x5a8a('0x25')][_0x5a8a('0x4d')]({'name':_0x5cad4f[_0x5a8a('0x24')],'resourceId':_0x5cad4f['id'],'type':_0x3fccef[_0x5a8a('0x24')],'sectionId':_0x3fccef['id']},{})[_0x5a8a('0x3c')](function(){return _0x144a06;});}else{return _0x144a06;}})[_0x5a8a('0x4e')](function(_0x1bd08c){logger[_0x5a8a('0x26')](_0x5a8a('0x4f'),_0x1bd08c);throw _0x1bd08c;});}return _0x144a06;})[_0x5a8a('0x3c')](respondWithResult(_0x3f133d,0xc9))[_0x5a8a('0x4e')](handleError(_0x3f133d,null));};exports['update']=function(_0x317492,_0x48ac48){if(_0x317492[_0x5a8a('0x45')]['id']){delete _0x317492[_0x5a8a('0x45')]['id'];}return db[_0x5a8a('0x2a')]['find']({'where':{'id':_0x317492['params']['id']}})[_0x5a8a('0x3c')](handleEntityNotFound(_0x48ac48,null))[_0x5a8a('0x3c')](function(_0x2c6633){if(_0x2c6633){return db[_0x5a8a('0x2a')][_0x5a8a('0x50')](_['pick'](_0x317492[_0x5a8a('0x45')],[_0x5a8a('0x46'),'context',_0x5a8a('0x51'),_0x5a8a('0x52'),_0x5a8a('0x53'),_0x5a8a('0x54'),_0x5a8a('0x55')]),{'where':{'context':_0x2c6633[_0x5a8a('0x56')],'exten':_0x2c6633['exten']},'individualHooks':!![]})[_0x5a8a('0x3c')](function(_0xad2e79){return _0xad2e79;});}return null;})[_0x5a8a('0x3c')](respondWithStatusCode(_0x48ac48,null))[_0x5a8a('0x4e')](handleError(_0x48ac48,null));};exports[_0x5a8a('0x57')]=function(_0x188826,_0x4a893a){var _0x5082e5=_0x188826[_0x5a8a('0x41')]['id'];var _0x1b7947=_0x188826[_0x5a8a('0x45')];var _0x2cb5c6=0xc8;var _0x3a3c7f=null;return db[_0x5a8a('0x58')]['transaction']({'isolationLevel':db[_0x5a8a('0x58')][_0x5a8a('0x59')][_0x5a8a('0x5a')][_0x5a8a('0x5b')]},function(_0x58745e){return db['VoiceExtension'][_0x5a8a('0x5c')]({'where':{'id':_0x5082e5},'transaction':_0x58745e})[_0x5a8a('0x3c')](function(_0x347d0d){if(_0x347d0d){return db[_0x5a8a('0x2a')]['destroy']({'where':{'VoiceExtensionId':_0x5082e5},'transaction':_0x58745e})[_0x5a8a('0x3c')](function(){var _0x4cb81a=_[_0x5a8a('0x1f')](_0x1b7947,function(_0x2c11da){_0x2c11da[_0x5a8a('0x5d')]=_0x5082e5;_0x2c11da[_0x5a8a('0x5e')]=!![];return _0x2c11da;});return _0x347d0d[_0x5a8a('0x5f')](_0x4cb81a);})[_0x5a8a('0x3c')](function(_0x1f2c36){return db[_0x5a8a('0x2a')][_0x5a8a('0x60')](_0x1f2c36,{'transaction':_0x58745e});});}else{_0x2cb5c6=0x194;_0x3a3c7f=[];}});})[_0x5a8a('0x3c')](function(){if(_0x2cb5c6!==0x194){return db[_0x5a8a('0x2a')][_0x5a8a('0x61')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5082e5},'order':'cast(priority\x20as\x20unsigned)'})[_0x5a8a('0x3c')](function(_0x10e2ea){_0x3a3c7f=_0x10e2ea;});}})[_0x5a8a('0x4e')](function(_0x338f77){_0x2cb5c6=0x1f4;logger[_0x5a8a('0x26')](_0x338f77[_0x5a8a('0x27')]);if(_0x338f77[_0x5a8a('0x24')]){delete _0x338f77[_0x5a8a('0x24')];}_0x3a3c7f=_0x338f77;})[_0x5a8a('0x62')](function(){if(_0x3a3c7f===null){_0x4a893a['sendStatus'](_0x2cb5c6);}else{if(_0x2cb5c6===0x1f4){_0x4a893a[_0x5a8a('0xd')](_0x2cb5c6)[_0x5a8a('0x28')](_0x3a3c7f);}else{_0x4a893a[_0x5a8a('0xd')](_0x2cb5c6)[_0x5a8a('0xf')](_0x3a3c7f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9dd0ccc..47c3d0f 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 _0xa867=['update','remove','emit','hasOwnProperty','hook','VoiceExtension','setMaxListeners'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa867,0x15c));var _0x7a86=function(_0x19e7a2,_0x2da155){_0x19e7a2=_0x19e7a2-0x0;var _0xf04960=_0xa867[_0x19e7a2];return _0xf04960;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x7a86('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7a86('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a86('0x2'),'afterDestroy':_0x7a86('0x3')};function emitEvent(_0x101d36){return function(_0xb0fc56,_0x579d75,_0x34783b){VoiceExtensionEvents['emit'](_0x101d36+':'+_0xb0fc56['id'],_0xb0fc56);VoiceExtensionEvents[_0x7a86('0x4')](_0x101d36,_0xb0fc56);_0x34783b(null);};}for(var e in events){if(events[_0x7a86('0x5')](e)){var event=events[e];VoiceExtension[_0x7a86('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x65ff=['VoiceExtension','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x65ff,0x166));var _0xf65f=function(_0x12d034,_0x430f51){_0x12d034=_0x12d034-0x0;var _0x39d6e5=_0x65ff[_0x12d034];return _0x39d6e5;};'use strict';var EventEmitter=require(_0xf65f('0x0'));var VoiceExtension=require(_0xf65f('0x1'))['db'][_0xf65f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf65f('0x3'),'afterUpdate':_0xf65f('0x4'),'afterDestroy':_0xf65f('0x5')};function emitEvent(_0x2cec56){return function(_0x31ff48,_0x371d45,_0x94cb6c){VoiceExtensionEvents[_0xf65f('0x6')](_0x2cec56+':'+_0x31ff48['id'],_0x31ff48);VoiceExtensionEvents[_0xf65f('0x6')](_0x2cec56,_0x31ff48);_0x94cb6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xf65f('0x7')](e,emitEvent(event));}}module[_0xf65f('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7d26c4d..6236911 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 _0xc4a1=['Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','VoiceExtension','get','Hangup','lodash','exports','type'];(function(_0x23be0b,_0x95d7d0){var _0x4af33b=function(_0x5cd56a){while(--_0x5cd56a){_0x23be0b['push'](_0x23be0b['shift']());}};_0x4af33b(++_0x95d7d0);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x46dc08,_0x398f4b){_0x46dc08=_0x46dc08-0x0;var _0x3f067e=_0xc4a1[_0x46dc08];return _0x3f067e;};'use strict';var _=require(_0x1c4a('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x1c4a('0x1')]=function(_0xab754c){var _0x2e5eea=_0xab754c['models'];function _0x105b6f(_0x1b0091){var _0x132b97=0x2;var _0x3a1a32=[{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x4')+_0x1b0091[_0x1c4a('0x2')],'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1b0091[_0x1c4a('0x7')]?_0x1c4a('0x3'):'NoOp','appdata':_0x1b0091[_0x1c4a('0x7')]?_0x1c4a('0x8')+_0x1b0091['alias']:_0x1c4a('0x9'),'context':_0x1b0091['context'],'exten':_0x1b0091['exten'],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']}];if(_0x1b0091[_0x1c4a('0x2')]===_0x1c4a('0xa')){_0x3a1a32['push']({'type':_0x1c4a('0xa'),'app':_0x1c4a('0x3'),'appdata':'CDR(routeid)='+_0x1b0091['id'],'context':_0x1b0091['context'],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']});}_0x3a1a32[_0x1c4a('0xb')]({'type':_0x1b0091['type'],'app':'Set','appdata':_0x1c4a('0xc'),'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xd'),'context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']},{'type':_0x1b0091[_0x1c4a('0x2')],'app':_0x1c4a('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1b0091[_0x1c4a('0x5')],'exten':_0x1b0091[_0x1c4a('0x6')],'priority':_0x132b97++,'VoiceExtensionId':_0x1b0091['id']});return _0x3a1a32;}function _0x1b1358(_0x36be47){var _0x4e7781=0x2;var _0x57a68a=[{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xf'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x36be47[_0x1c4a('0x7')]?'Set':_0x1c4a('0x10'),'appdata':_0x36be47[_0x1c4a('0x7')]?_0x1c4a('0x8')+_0x36be47['alias']:'No\x20alias\x20set','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':'outbound','app':'Set','appdata':_0x1c4a('0x11')+(_0x36be47[_0x1c4a('0x12')]?_0x1c4a('0x13')+_0x36be47[_0x1c4a('0x12')]+'}':'${EXTEN}'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x14')+_0x36be47['id'],'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x16')+(_0x4e7781+0x2)+_0x1c4a('0x17')+(_0x4e7781+0x1)+')','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x36be47[_0x1c4a('0x12')]?_0x1c4a('0x18')+_0x36be47[_0x1c4a('0x12')]+'}':_0x1c4a('0x19'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xc'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0xd'),'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':'Set','appdata':_0x1c4a('0x1a'),'context':_0x36be47['context'],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':'outboundrouteid='+_0x36be47['id'],'context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47['exten'],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']}];if(_0x36be47[_0x1c4a('0x1b')](_0x1c4a('0x1c'))&&_0x36be47[_0x1c4a('0x1c')]!==_0x1c4a('0x1d')){_0x57a68a[_0x1c4a('0xb')]({'type':'outbound','app':'Set','appdata':_0x1c4a('0x1e'),'context':_0x36be47['context'],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']},{'type':_0x1c4a('0xe'),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x1f')+_0x36be47['recordingFormat']||'wav','context':_0x36be47[_0x1c4a('0x5')],'exten':_0x36be47[_0x1c4a('0x6')],'priority':_0x4e7781++,'VoiceExtensionId':_0x36be47['id']});}return _0x57a68a;}function _0xba2cfa(_0x2c2b99,_0x2640e0){var _0x5d2da2=[{'name':_0x1c4a('0x20'),'param':0x0},{'name':_0x1c4a('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x1c4a('0x22'),'param':0x3}];var _0x2965a2={};var _0x48b4d5=_0x2640e0['split'](',');var _0x596f60=[];for(var _0x45a66f=0x0;_0x45a66f<_0x5d2da2[_0x1c4a('0x23')];_0x45a66f++){switch(_0x5d2da2[_0x45a66f][_0x1c4a('0x24')]){case'trunk':_0x2965a2[_0x1c4a('0x20')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]][_0x1c4a('0x26')]('/')[0x1];_0x2965a2[_0x1c4a('0x27')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]][_0x1c4a('0x26')]('/')[0x2];_0x2965a2['prefix']=_0x2965a2['phone']?_0x2965a2[_0x1c4a('0x27')][_0x1c4a('0x26')]('$')[0x0]:undefined;_0x2965a2['phone']=_0x2c2b99[_0x1c4a('0x12')]?(_0x2965a2[_0x1c4a('0x28')]||'')+_0x1c4a('0x13')+_0x2c2b99['cutdigits']+'}':(_0x2965a2[_0x1c4a('0x28')]||'')+'${EXTEN}';_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=[_0x1c4a('0x29'),_0x2965a2[_0x1c4a('0x20')],_0x2965a2[_0x1c4a('0x27')]][_0x1c4a('0x2a')]('/');break;case _0x1c4a('0x2b'):_0x2965a2[_0x1c4a('0x2b')]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]];if(_0x2c2b99[_0x1c4a('0x1c')]!=='none'){if(_0x2965a2[_0x1c4a('0x2b')]['indexOf'](_0x1c4a('0x2c'))<0x0){_0x2965a2[_0x1c4a('0x2b')]+=_0x1c4a('0x2c');}}else{_0x2965a2[_0x1c4a('0x2b')]=_0x2965a2[_0x1c4a('0x2b')][_0x1c4a('0x2d')](_0x1c4a('0x2c'),'');}_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=_0x2965a2[_0x1c4a('0x2b')];break;default:_0x596f60[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]]=_0x48b4d5[_0x5d2da2[_0x45a66f][_0x1c4a('0x25')]];}}return _0x596f60[_0x1c4a('0x2a')](',');}function _0x269feb(_0x3388c6,_0x2f98e1,_0x77d8f6){return new Promise(function(_0x4beea0,_0xce3e09){var _0x38be7d=[];if(_[_0x1c4a('0x2e')](_0x2f98e1))return _0x4beea0(_0x38be7d);_0x2e5eea[_0x1c4a('0x2f')][_0x1c4a('0x30')]({'attributes':['id',_0x1c4a('0x31'),_0x1c4a('0x32')],'raw':!![]})[_0x1c4a('0x33')](function(_0x260748){for(var _0x3d7e00=0x0,_0xac60c6=0x0;_0x3d7e00<_0x2f98e1[_0x1c4a('0x23')];_0x3d7e00++,_0xac60c6=0x0){var _0x155059=_0x2f98e1[_0x3d7e00];var _0x5ed4be=[];var _0x5615c0=[];delete _0x155059['id'];if(_0x155059[_0x1c4a('0x31')]!==_0x1c4a('0x34')){_0x155059[_0x1c4a('0x35')]=[_0x155059[_0x1c4a('0x31')]];}else{_0x155059[_0x1c4a('0x35')]=_0x155059['IntervalId']?_[_0x1c4a('0x36')](_['filter'](_0x260748,{'IntervalId':_0x155059['IntervalId']}),_0x1c4a('0x31')):[];}_0x155059[_0x1c4a('0x5')]=_0x3388c6[_0x1c4a('0x5')];_0x155059[_0x1c4a('0x6')]=_0x3388c6[_0x1c4a('0x6')];if(_0x155059[_0x1c4a('0x2')])_0x155059[_0x1c4a('0x2')]=_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')]();if(_0x3388c6[_0x1c4a('0x2')]===_0x1c4a('0xe')){if(_0x155059[_0x1c4a('0x1b')](_0x1c4a('0x38'))&&_0x155059[_0x1c4a('0x38')]&&_0x155059[_0x1c4a('0x38')]!=='--'){_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059['type'][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x39')+_0x155059[_0x1c4a('0x38')],'context':_0x3388c6['context'],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}_0x5ed4be['push']({'type':_0x155059['type'][_0x1c4a('0x37')](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x3a')+(_0x155059['callerID']?'Set(CALLERID(all)='+_0x155059[_0x1c4a('0x3b')]+')':_0x1c4a('0x3c')),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')]['length']+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}else{if(_0x155059[_0x1c4a('0x1b')](_0x1c4a('0x3d'))){if([_0x1c4a('0x3e'),_0x1c4a('0x3f')][_0x1c4a('0x40')](_0x155059[_0x1c4a('0x41')][_0x1c4a('0x37')]())&&_0x155059[_0x1c4a('0x42')]!==_0x1c4a('0x43')){if(_0x155059[_0x1c4a('0x3d')]){_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x44'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x45'),'context':_0x3388c6['context'],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}else{_0x5ed4be['push']({'type':_0x155059[_0x1c4a('0x2')]['toLowerCase'](),'app':_0x1c4a('0x15'),'appdata':_0x1c4a('0x46'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6[_0x1c4a('0x6')],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});_0x5ed4be[_0x1c4a('0xb')]({'type':_0x155059[_0x1c4a('0x2')][_0x1c4a('0x37')](),'app':_0x1c4a('0x3'),'appdata':_0x1c4a('0x47'),'context':_0x3388c6[_0x1c4a('0x5')],'exten':_0x3388c6['exten'],'priority':_0x155059[_0x1c4a('0x35')][_0x1c4a('0x23')]+_0x77d8f6+_0xac60c6++,'VoiceExtensionId':_0x3388c6['id']});}}}}for(var _0x2d3d0a=0x0;_0x2d3d0a<_0x155059[_0x1c4a('0x35')]['length'];_0x2d3d0a++){var _0x5ded2f=_0x77d8f6+_0x155059['intervals'][_0x1c4a('0x23')];var _0xb32d4c=_0x2d3d0a===_0x155059[_0x1c4a('0x35')]['length']-0x1?_0x77d8f6+_0x5ed4be[_0x1c4a('0x23')]+_0x5615c0[_0x1c4a('0x23')]+0x2:_0x77d8f6+_0x2d3d0a+0x1;_0x5ed4be[_0x1c4a('0x48')](_0x2d3d0a,0x0,{'type':_0x3388c6[_0x1c4a('0x2')],'app':_0x1c4a('0x49'),'appdata':_0x155059[_0x1c4a('0x35')][_0x2d3d0a]+'?'+_0x3388c6[_0x1c4a('0x5')]+_0x1c4a('0x4a')+_0x5ded2f+':'+_0x3388c6[_0x1c4a('0x5')]+',${EXTEN},'+_0xb32d4c,'exten':_0x3388c6[_0x1c4a('0x6')],'context':_0x3388c6[_0x1c4a('0x5')],'priority':_0x77d8f6+_0x2d3d0a,'VoiceExtensionId':_0x3388c6['id']});}if(_0x155059['appType']===_0x1c4a('0x4b'))_0x155059[_0x1c4a('0x4c')]=_0xba2cfa(_0x3388c6,_0x155059['appdata']);_0x155059[_0x1c4a('0x4d')]=_0x5ed4be[_0x1c4a('0x23')]?_[_0x1c4a('0x4e')](_0x5ed4be)[_0x1c4a('0x4d')]+0x1:_0x77d8f6;_0x38be7d=_[_0x1c4a('0x4f')](_0x38be7d,_0x5ed4be,[_0x155059],_0x5615c0);_0x77d8f6=_['last'](_0x38be7d)[_0x1c4a('0x4d')]+0x1;}return _0x4beea0(_0x38be7d);})['catch'](function(_0x424613){_0xce3e09(_0x424613);});});}return _0xab754c['define'](_0x1c4a('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4dd257){var _0x7a8533=this[_0x1c4a('0x51')]({'plain':!![]});var _0x3bef10=_0x7a8533[_0x1c4a('0x2')]===_0x1c4a('0xe')?_0x1b1358(_0x7a8533):_0x105b6f(_0x7a8533);return _0x269feb(_0x7a8533,_0x4dd257,_[_0x1c4a('0x4e')](_0x3bef10)[_0x1c4a('0x4d')]+0x1)['then'](function(_0x49b655){var _0x294890=_[_0x1c4a('0x4f')](_0x3bef10,_0x49b655);_0x294890[_0x1c4a('0xb')]({'type':_0x7a8533[_0x1c4a('0x2')],'app':_0x1c4a('0x52'),'exten':_0x7a8533[_0x1c4a('0x6')],'context':_0x7a8533[_0x1c4a('0x5')],'priority':_['last'](_0x294890)[_0x1c4a('0x4d')]+0x1,'VoiceExtensionId':_0x7a8533['id']});return _0x294890;});}}});}; \ No newline at end of file +var _0x2fa9=['lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x2fa9,0x144));var _0x92fa=function(_0x28070f,_0xb37cbe){_0x28070f=_0x28070f-0x0;var _0x468f3e=_0x2fa9[_0x28070f];return _0x468f3e;};'use strict';var _=require(_0x92fa('0x0'));var attributes=require(_0x92fa('0x1'));module[_0x92fa('0x2')]=function(_0x11e61c){var _0x103ebe=_0x11e61c[_0x92fa('0x3')];function _0x5d24db(_0x112ee1){var _0x2f9f15=0x2;var _0x361e63=[{'type':_0x112ee1['type'],'app':_0x92fa('0x4'),'appdata':_0x92fa('0x5')+_0x112ee1[_0x92fa('0x6')],'context':_0x112ee1['context'],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']},{'type':_0x112ee1[_0x92fa('0x6')],'app':_0x112ee1[_0x92fa('0x8')]?_0x92fa('0x4'):'NoOp','appdata':_0x112ee1[_0x92fa('0x8')]?_0x92fa('0x9')+_0x112ee1['alias']:_0x92fa('0xa'),'context':_0x112ee1[_0x92fa('0xb')],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']}];if(_0x112ee1[_0x92fa('0x6')]===_0x92fa('0xc')){_0x361e63[_0x92fa('0xd')]({'type':_0x92fa('0xc'),'app':_0x92fa('0x4'),'appdata':_0x92fa('0xe')+_0x112ee1['id'],'context':_0x112ee1[_0x92fa('0xb')],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']});}_0x361e63[_0x92fa('0xd')]({'type':_0x112ee1[_0x92fa('0x6')],'app':'Set','appdata':_0x92fa('0xf'),'context':_0x112ee1[_0x92fa('0xb')],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']},{'type':_0x112ee1[_0x92fa('0x6')],'app':_0x92fa('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x112ee1[_0x92fa('0xb')],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']},{'type':_0x112ee1[_0x92fa('0x6')],'app':_0x92fa('0x4'),'appdata':_0x92fa('0x10'),'context':_0x112ee1['context'],'exten':_0x112ee1[_0x92fa('0x7')],'priority':_0x2f9f15++,'VoiceExtensionId':_0x112ee1['id']});return _0x361e63;}function _0xe7a253(_0x387f2e){var _0x5e887e=0x2;var _0x477afc=[{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':_0x92fa('0x12'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x387f2e['alias']?'Set':'NoOp','appdata':_0x387f2e['alias']?_0x92fa('0x9')+_0x387f2e['alias']:_0x92fa('0xa'),'context':_0x387f2e['context'],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':'Set','appdata':_0x92fa('0x13')+(_0x387f2e['cutdigits']?_0x92fa('0x14')+_0x387f2e[_0x92fa('0x15')]+'}':_0x92fa('0x16')),'context':_0x387f2e['context'],'exten':_0x387f2e['exten'],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x387f2e['id'],'context':_0x387f2e['context'],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':'outbound','app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5e887e+0x2)+_0x92fa('0x17')+(_0x5e887e+0x1)+')','context':_0x387f2e['context'],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':_0x387f2e['cutdigits']?_0x92fa('0x18')+_0x387f2e[_0x92fa('0x15')]+'}':_0x92fa('0x19'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e['exten'],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':_0x92fa('0xf'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':_0x92fa('0x10'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':_0x92fa('0x11'),'app':_0x92fa('0x4'),'appdata':_0x92fa('0x1a')+_0x387f2e['id'],'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e['exten'],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']}];if(_0x387f2e[_0x92fa('0x1b')](_0x92fa('0x1c'))&&_0x387f2e['recordingFormat']!==_0x92fa('0x1d')){_0x477afc[_0x92fa('0xd')]({'type':_0x92fa('0x11'),'app':'Set','appdata':_0x92fa('0x1e'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']},{'type':'outbound','app':_0x92fa('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x387f2e[_0x92fa('0x1c')]||_0x92fa('0x1f'),'context':_0x387f2e[_0x92fa('0xb')],'exten':_0x387f2e[_0x92fa('0x7')],'priority':_0x5e887e++,'VoiceExtensionId':_0x387f2e['id']});}return _0x477afc;}function _0x24a4f2(_0x4202d5,_0x5d4ef0){var _0x242e83=[{'name':_0x92fa('0x20'),'param':0x0},{'name':_0x92fa('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x92fa('0x22'),'param':0x3}];var _0x24339d={};var _0x337f24=_0x5d4ef0[_0x92fa('0x23')](',');var _0x318ad7=[];for(var _0x483c71=0x0;_0x483c71<_0x242e83[_0x92fa('0x24')];_0x483c71++){switch(_0x242e83[_0x483c71][_0x92fa('0x25')]){case _0x92fa('0x20'):_0x24339d[_0x92fa('0x20')]=_0x337f24[_0x242e83[_0x483c71][_0x92fa('0x26')]][_0x92fa('0x23')]('/')[0x1];_0x24339d[_0x92fa('0x27')]=_0x337f24[_0x242e83[_0x483c71][_0x92fa('0x26')]][_0x92fa('0x23')]('/')[0x2];_0x24339d[_0x92fa('0x28')]=_0x24339d[_0x92fa('0x27')]?_0x24339d[_0x92fa('0x27')][_0x92fa('0x23')]('$')[0x0]:undefined;_0x24339d[_0x92fa('0x27')]=_0x4202d5[_0x92fa('0x15')]?(_0x24339d['prefix']||'')+_0x92fa('0x14')+_0x4202d5[_0x92fa('0x15')]+'}':(_0x24339d['prefix']||'')+_0x92fa('0x16');_0x318ad7[_0x242e83[_0x483c71][_0x92fa('0x26')]]=[_0x92fa('0x29'),_0x24339d[_0x92fa('0x20')],_0x24339d['phone']][_0x92fa('0x2a')]('/');break;case _0x92fa('0x2b'):_0x24339d[_0x92fa('0x2b')]=_0x337f24[_0x242e83[_0x483c71][_0x92fa('0x26')]];if(_0x4202d5[_0x92fa('0x1c')]!==_0x92fa('0x1d')){if(_0x24339d[_0x92fa('0x2b')]['indexOf'](_0x92fa('0x2c'))<0x0){_0x24339d['options']+=_0x92fa('0x2c');}}else{_0x24339d[_0x92fa('0x2b')]=_0x24339d[_0x92fa('0x2b')][_0x92fa('0x2d')](_0x92fa('0x2c'),'');}_0x318ad7[_0x242e83[_0x483c71]['param']]=_0x24339d['options'];break;default:_0x318ad7[_0x242e83[_0x483c71][_0x92fa('0x26')]]=_0x337f24[_0x242e83[_0x483c71][_0x92fa('0x26')]];}}return _0x318ad7[_0x92fa('0x2a')](',');}function _0x3e91a2(_0x1c215d,_0x450c13,_0x5b451e){return new Promise(function(_0x46a3ec,_0x43c3e8){var _0x350f6a=[];if(_[_0x92fa('0x2e')](_0x450c13))return _0x46a3ec(_0x350f6a);_0x103ebe[_0x92fa('0x2f')]['findAll']({'attributes':['id',_0x92fa('0x30'),'IntervalId'],'raw':!![]})[_0x92fa('0x31')](function(_0x346bbf){for(var _0x471eb3=0x0,_0x51afd7=0x0;_0x471eb3<_0x450c13['length'];_0x471eb3++,_0x51afd7=0x0){var _0x580f29=_0x450c13[_0x471eb3];var _0x48d82e=[];var _0x44c5d4=[];delete _0x580f29['id'];if(_0x580f29[_0x92fa('0x30')]!==_0x92fa('0x32')){_0x580f29[_0x92fa('0x33')]=[_0x580f29[_0x92fa('0x30')]];}else{_0x580f29[_0x92fa('0x33')]=_0x580f29[_0x92fa('0x34')]?_[_0x92fa('0x35')](_[_0x92fa('0x36')](_0x346bbf,{'IntervalId':_0x580f29[_0x92fa('0x34')]}),'interval'):[];}_0x580f29['context']=_0x1c215d[_0x92fa('0xb')];_0x580f29[_0x92fa('0x7')]=_0x1c215d[_0x92fa('0x7')];if(_0x580f29['type'])_0x580f29['type']=_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')]();if(_0x1c215d[_0x92fa('0x6')]==='outbound'){if(_0x580f29['hasOwnProperty'](_0x92fa('0x38'))&&_0x580f29['tag']&&_0x580f29[_0x92fa('0x38')]!=='--'){_0x48d82e['push']({'type':_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')](),'app':_0x92fa('0x4'),'appdata':_0x92fa('0x39')+_0x580f29[_0x92fa('0x38')],'context':_0x1c215d[_0x92fa('0xb')],'exten':_0x1c215d[_0x92fa('0x7')],'priority':_0x580f29[_0x92fa('0x33')][_0x92fa('0x24')]+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});}_0x48d82e[_0x92fa('0xd')]({'type':_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')](),'app':_0x92fa('0x3a'),'appdata':_0x92fa('0x3b')+(_0x580f29[_0x92fa('0x3c')]?_0x92fa('0x3d')+_0x580f29[_0x92fa('0x3c')]+')':_0x92fa('0x3e')),'context':_0x1c215d[_0x92fa('0xb')],'exten':_0x1c215d[_0x92fa('0x7')],'priority':_0x580f29[_0x92fa('0x33')][_0x92fa('0x24')]+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});}else{if(_0x580f29['hasOwnProperty'](_0x92fa('0x3f'))){if([_0x92fa('0x40'),_0x92fa('0x41')]['includes'](_0x580f29[_0x92fa('0x42')][_0x92fa('0x37')]())&&_0x580f29['appType']!==_0x92fa('0x43')){if(_0x580f29[_0x92fa('0x3f')]){_0x48d82e[_0x92fa('0xd')]({'type':_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')](),'app':_0x92fa('0x3a'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1c215d['context'],'exten':_0x1c215d[_0x92fa('0x7')],'priority':_0x580f29[_0x92fa('0x33')]['length']+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});_0x48d82e[_0x92fa('0xd')]({'type':_0x580f29[_0x92fa('0x6')]['toLowerCase'](),'app':'Set','appdata':_0x92fa('0x44'),'context':_0x1c215d[_0x92fa('0xb')],'exten':_0x1c215d['exten'],'priority':_0x580f29['intervals'][_0x92fa('0x24')]+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});}else{_0x48d82e[_0x92fa('0xd')]({'type':_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')](),'app':_0x92fa('0x3a'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1c215d['context'],'exten':_0x1c215d[_0x92fa('0x7')],'priority':_0x580f29[_0x92fa('0x33')]['length']+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});_0x48d82e[_0x92fa('0xd')]({'type':_0x580f29[_0x92fa('0x6')][_0x92fa('0x37')](),'app':_0x92fa('0x4'),'appdata':_0x92fa('0x45'),'context':_0x1c215d[_0x92fa('0xb')],'exten':_0x1c215d[_0x92fa('0x7')],'priority':_0x580f29[_0x92fa('0x33')][_0x92fa('0x24')]+_0x5b451e+_0x51afd7++,'VoiceExtensionId':_0x1c215d['id']});}}}}for(var _0x57174b=0x0;_0x57174b<_0x580f29['intervals'][_0x92fa('0x24')];_0x57174b++){var _0x15a066=_0x5b451e+_0x580f29[_0x92fa('0x33')]['length'];var _0x1e7dca=_0x57174b===_0x580f29[_0x92fa('0x33')][_0x92fa('0x24')]-0x1?_0x5b451e+_0x48d82e[_0x92fa('0x24')]+_0x44c5d4[_0x92fa('0x24')]+0x2:_0x5b451e+_0x57174b+0x1;_0x48d82e['splice'](_0x57174b,0x0,{'type':_0x1c215d[_0x92fa('0x6')],'app':_0x92fa('0x46'),'appdata':_0x580f29['intervals'][_0x57174b]+'?'+_0x1c215d[_0x92fa('0xb')]+',${EXTEN},'+_0x15a066+':'+_0x1c215d[_0x92fa('0xb')]+',${EXTEN},'+_0x1e7dca,'exten':_0x1c215d[_0x92fa('0x7')],'context':_0x1c215d['context'],'priority':_0x5b451e+_0x57174b,'VoiceExtensionId':_0x1c215d['id']});}if(_0x580f29['appType']===_0x92fa('0x47'))_0x580f29['appdata']=_0x24a4f2(_0x1c215d,_0x580f29[_0x92fa('0x48')]);_0x580f29[_0x92fa('0x49')]=_0x48d82e['length']?_[_0x92fa('0x4a')](_0x48d82e)[_0x92fa('0x49')]+0x1:_0x5b451e;_0x350f6a=_[_0x92fa('0x4b')](_0x350f6a,_0x48d82e,[_0x580f29],_0x44c5d4);_0x5b451e=_[_0x92fa('0x4a')](_0x350f6a)[_0x92fa('0x49')]+0x1;}return _0x46a3ec(_0x350f6a);})[_0x92fa('0x4c')](function(_0x2daba5){_0x43c3e8(_0x2daba5);});});}return _0x11e61c[_0x92fa('0x4d')](_0x92fa('0x4e'),attributes,{'tableName':_0x92fa('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x496102){var _0x1ad6d4=this['get']({'plain':!![]});var _0x2a4b71=_0x1ad6d4['type']===_0x92fa('0x11')?_0xe7a253(_0x1ad6d4):_0x5d24db(_0x1ad6d4);return _0x3e91a2(_0x1ad6d4,_0x496102,_[_0x92fa('0x4a')](_0x2a4b71)['priority']+0x1)[_0x92fa('0x31')](function(_0x364693){var _0x2d883e=_[_0x92fa('0x4b')](_0x2a4b71,_0x364693);_0x2d883e[_0x92fa('0xd')]({'type':_0x1ad6d4[_0x92fa('0x6')],'app':_0x92fa('0x50'),'exten':_0x1ad6d4[_0x92fa('0x7')],'context':_0x1ad6d4['context'],'priority':_['last'](_0x2d883e)['priority']+0x1,'VoiceExtensionId':_0x1ad6d4['id']});return _0x2d883e;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7504916..f39c7bb 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 _0x3595=['stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','options','where','limit','include','map','attributes','model','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x1768f0,_0x24083a){var _0xaf56f=function(_0x16b3a5){while(--_0x16b3a5){_0x1768f0['push'](_0x1768f0['shift']());}};_0xaf56f(++_0x24083a);}(_0x3595,0x147));var _0x5359=function(_0x4cfbc1,_0x19582b){_0x4cfbc1=_0x4cfbc1-0x0;var _0x4b951d=_0x3595[_0x4cfbc1];return _0x4b951d;};'use strict';var _=require(_0x5359('0x0'));var util=require(_0x5359('0x1'));var moment=require(_0x5359('0x2'));var BPromise=require('bluebird');var rs=require(_0x5359('0x3'));var fs=require('fs');var Redis=require(_0x5359('0x4'));var db=require(_0x5359('0x5'))['db'];var utils=require(_0x5359('0x6'));var logger=require(_0x5359('0x7'))(_0x5359('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5359('0x9')][_0x5359('0xa')]({'port':0x232a});config[_0x5359('0xb')]=_[_0x5359('0xc')](config[_0x5359('0xb')],{'host':_0x5359('0xd'),'port':0x18eb});var socket=require(_0x5359('0xe'))(new Redis(config[_0x5359('0xb')]));require(_0x5359('0xf'))[_0x5359('0x10')](socket);function respondWithRpcPromise(_0x5d33a0,_0x4804bb,_0x4c70d7){return new BPromise(function(_0x541386,_0x1496b5){return client[_0x5359('0x11')](_0x5d33a0,_0x4c70d7)[_0x5359('0x12')](function(_0x2f7a5b){logger[_0x5359('0x13')](_0x5359('0x14'),_0x4804bb,_0x5359('0x15'));logger[_0x5359('0x16')](_0x5359('0x17'),_0x4804bb,_0x5359('0x15'),JSON[_0x5359('0x18')](_0x2f7a5b));if(_0x2f7a5b[_0x5359('0x19')]){if(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x4804bb,_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);return _0x1496b5(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);}logger[_0x5359('0x19')](_0x5359('0x14'),_0x4804bb,_0x2f7a5b['error']['message']);return _0x541386(_0x2f7a5b[_0x5359('0x19')][_0x5359('0x1b')]);}else{logger['info'](_0x5359('0x14'),_0x4804bb,_0x5359('0x15'));_0x541386(_0x2f7a5b[_0x5359('0x1c')][_0x5359('0x1b')]);}})['catch'](function(_0x50d158){logger['error'](_0x5359('0x14'),_0x4804bb,_0x50d158);_0x1496b5(_0x50d158);});});}exports[_0x5359('0x1d')]=function(_0x53f00f){var _0x35e920=this;return new Promise(function(_0x211580,_0x45bf1c){return db[_0x5359('0x1e')]['findAll']({'raw':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')][_0x5359('0x20')]||null:null,'attributes':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')]['attributes']||null:null,'limit':_0x53f00f['options']?_0x53f00f[_0x5359('0x1f')][_0x5359('0x21')]||null:null,'include':_0x53f00f[_0x5359('0x1f')]?_0x53f00f[_0x5359('0x1f')][_0x5359('0x22')]?_[_0x5359('0x23')](_0x53f00f[_0x5359('0x1f')][_0x5359('0x22')],function(_0x3fea11){return{'model':db[_0x3fea11['model']],'as':_0x3fea11['as'],'attributes':_0x3fea11[_0x5359('0x24')],'include':_0x3fea11[_0x5359('0x22')]?_[_0x5359('0x23')](_0x3fea11[_0x5359('0x22')],function(_0x234c96){return{'model':db[_0x234c96[_0x5359('0x25')]],'as':_0x234c96['as'],'attributes':_0x234c96['attributes'],'include':_0x234c96[_0x5359('0x22')]?_['map'](_0x234c96[_0x5359('0x22')],function(_0x4b130a){return{'model':db[_0x4b130a[_0x5359('0x25')]],'as':_0x4b130a['as'],'attributes':_0x4b130a[_0x5359('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fc4a){logger['info'](_0x5359('0x1d'),_0x53f00f);logger[_0x5359('0x16')](_0x5359('0x1d'),_0x53f00f,JSON[_0x5359('0x18')](_0x9fc4a));_0x211580(_0x9fc4a);})[_0x5359('0x26')](function(_0x3a2552){logger[_0x5359('0x19')](_0x5359('0x1d'),_0x3a2552[_0x5359('0x1b')],_0x53f00f);_0x45bf1c(_0x35e920[_0x5359('0x19')](0x1f4,_0x3a2552[_0x5359('0x1b')]));});});}; \ No newline at end of file +var _0xd8a5=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','model','map','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58f9df,_0x30eb6e){var _0x933c13=function(_0x3f611a){while(--_0x3f611a){_0x58f9df['push'](_0x58f9df['shift']());}};_0x933c13(++_0x30eb6e);}(_0xd8a5,0x160));var _0x5d8a=function(_0x2a60a4,_0x266ac9){_0x2a60a4=_0x2a60a4-0x0;var _0x45350c=_0xd8a5[_0x2a60a4];return _0x45350c;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var moment=require(_0x5d8a('0x1'));var BPromise=require(_0x5d8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d8a('0x3'));var db=require(_0x5d8a('0x4'))['db'];var utils=require(_0x5d8a('0x5'));var logger=require(_0x5d8a('0x6'))(_0x5d8a('0x7'));var config=require(_0x5d8a('0x8'));var jayson=require(_0x5d8a('0x9'));var client=jayson[_0x5d8a('0xa')][_0x5d8a('0xb')]({'port':0x232a});config[_0x5d8a('0xc')]=_[_0x5d8a('0xd')](config[_0x5d8a('0xc')],{'host':_0x5d8a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d8a('0xc')]));require(_0x5d8a('0xf'))[_0x5d8a('0x10')](socket);function respondWithRpcPromise(_0x6de8fa,_0x3392cf,_0x5a0eb7){return new BPromise(function(_0x40ae14,_0xf20ccb){return client[_0x5d8a('0x11')](_0x6de8fa,_0x5a0eb7)[_0x5d8a('0x12')](function(_0x5219aa){logger[_0x5d8a('0x13')](_0x5d8a('0x14'),_0x3392cf,'request\x20sent');logger[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x3392cf,_0x5d8a('0x17'),JSON[_0x5d8a('0x18')](_0x5219aa));if(_0x5219aa[_0x5d8a('0x19')]){if(_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1a')]===0x1f4){logger[_0x5d8a('0x19')](_0x5d8a('0x14'),_0x3392cf,_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1b')]);return _0xf20ccb(_0x5219aa[_0x5d8a('0x19')]['message']);}logger['error'](_0x5d8a('0x14'),_0x3392cf,_0x5219aa[_0x5d8a('0x19')]['message']);return _0x40ae14(_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1b')]);}else{logger[_0x5d8a('0x13')](_0x5d8a('0x14'),_0x3392cf,'request\x20sent');_0x40ae14(_0x5219aa[_0x5d8a('0x1c')]['message']);}})[_0x5d8a('0x1d')](function(_0x380e52){logger[_0x5d8a('0x19')](_0x5d8a('0x14'),_0x3392cf,_0x380e52);_0xf20ccb(_0x380e52);});});}exports[_0x5d8a('0x1e')]=function(_0x478612){var _0x2004e4=this;return new Promise(function(_0x48fc2b,_0x460e95){return db[_0x5d8a('0x1f')][_0x5d8a('0x20')]({'raw':_0x478612[_0x5d8a('0x21')]?_0x478612['options'][_0x5d8a('0x22')]===undefined?!![]:![]:!![],'where':_0x478612[_0x5d8a('0x21')]?_0x478612[_0x5d8a('0x21')]['where']||null:null,'attributes':_0x478612[_0x5d8a('0x21')]?_0x478612[_0x5d8a('0x21')][_0x5d8a('0x23')]||null:null,'limit':_0x478612[_0x5d8a('0x21')]?_0x478612['options'][_0x5d8a('0x24')]||null:null,'include':_0x478612[_0x5d8a('0x21')]?_0x478612['options'][_0x5d8a('0x25')]?_['map'](_0x478612[_0x5d8a('0x21')][_0x5d8a('0x25')],function(_0x2f57da){return{'model':db[_0x2f57da['model']],'as':_0x2f57da['as'],'attributes':_0x2f57da[_0x5d8a('0x23')],'include':_0x2f57da[_0x5d8a('0x25')]?_['map'](_0x2f57da['include'],function(_0x3a637f){return{'model':db[_0x3a637f[_0x5d8a('0x26')]],'as':_0x3a637f['as'],'attributes':_0x3a637f[_0x5d8a('0x23')],'include':_0x3a637f['include']?_[_0x5d8a('0x27')](_0x3a637f[_0x5d8a('0x25')],function(_0x4e4c43){return{'model':db[_0x4e4c43[_0x5d8a('0x26')]],'as':_0x4e4c43['as'],'attributes':_0x4e4c43[_0x5d8a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5d8a('0x12')](function(_0x136150){logger[_0x5d8a('0x13')]('GetVoiceExtension',_0x478612);logger[_0x5d8a('0x15')](_0x5d8a('0x1e'),_0x478612,JSON[_0x5d8a('0x18')](_0x136150));_0x48fc2b(_0x136150);})[_0x5d8a('0x1d')](function(_0x2b10e6){logger[_0x5d8a('0x19')](_0x5d8a('0x1e'),_0x2b10e6[_0x5d8a('0x1b')],_0x478612);_0x460e95(_0x2004e4['error'](0x1f4,_0x2b10e6[_0x5d8a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1b10bd4..a746fb4 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x39c2fa,_0x393904){var _0x4ea5cf=function(_0x1abf55){while(--_0x1abf55){_0x39c2fa['push'](_0x39c2fa['shift']());}};_0x4ea5cf(++_0x393904);}(_0xabce,0x103));var _0xeabc=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xabce[_0x481bf7];return _0x461787;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x86938f,_0x5801d2){var _0x37db36=function(_0x22a9c2){while(--_0x22a9c2){_0x86938f['push'](_0x86938f['shift']());}};_0x37db36(++_0x5801d2);}(_0xe14b,0x93));var _0xbe14=function(_0x3527ed,_0x69375){_0x3527ed=_0x3527ed-0x0;var _0x5d8a9a=_0xe14b[_0x3527ed];return _0x5d8a9a;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 718deac..f20a47e 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 _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x79ac23,_0x42956a){var _0x2837eb=function(_0x160ec2){while(--_0x160ec2){_0x79ac23['push'](_0x79ac23['shift']());}};_0x2837eb(++_0x42956a);}(_0xed1c,0xe4));var _0xced1=function(_0x3c6eba,_0x2a7a77){_0x3c6eba=_0x3c6eba-0x0;var _0x40c865=_0xed1c[_0x3c6eba];return _0x40c865;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xdb28,0x106));var _0x8db2=function(_0x36542b,_0x283438){_0x36542b=_0x36542b-0x0;var _0x1e13e4=_0xdb28[_0x36542b];return _0x1e13e4;};'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('./voiceMail.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index beccac8..dd54b6f 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 _0xf4fb=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central','yes','ENUM','TINYINT(4)'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf4fb,0x14b));var _0xbf4f=function(_0x559985,_0x920257){_0x559985=_0x559985-0x0;var _0x449cdf=_0xf4fb[_0x559985];return _0x449cdf;};'use strict';var Sequelize=require(_0xbf4f('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbf4f('0x1')]},'context':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':_0xbf4f('0x2'),'unique':_0xbf4f('0x3')},'mailbox':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xbf4f('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4ae8e2){this['setDataValue'](_0xbf4f('0x4'),typeof _0x4ae8e2===_0xbf4f('0x5')&&_0x4ae8e2[_0xbf4f('0x6')]()?_0x4ae8e2['trim']():null);}},'pager':{'type':Sequelize[_0xbf4f('0x1')]},'tz':{'type':Sequelize[_0xbf4f('0x1')],'defaultValue':_0xbf4f('0x7')},'attach':{'type':Sequelize['ENUM'](_0xbf4f('0x8'),'no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbf4f('0x1')]},'callback':{'type':Sequelize[_0xbf4f('0x1')]},'review':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbf4f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbf4f('0x9')](_0xbf4f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbf4f('0x9')]('yes','no'),'defaultValue':_0xbf4f('0x8'),'allowNull':![]},'stamp':{'type':_0xbf4f('0xb')},'emailsubject':{'type':Sequelize[_0xbf4f('0x1')]},'emailbody':{'type':Sequelize[_0xbf4f('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbf4f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbf4f('0xd')],'get':function(){return this['getDataValue'](_0xbf4f('0xe'))+_0xbf4f('0xf')+this[_0xbf4f('0x10')](_0xbf4f('0x11'));}}}; \ No newline at end of file +var _0x737c=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize'];(function(_0x1f75e6,_0x3a39bf){var _0x35a21b=function(_0x4b46fb){while(--_0x4b46fb){_0x1f75e6['push'](_0x1f75e6['shift']());}};_0x35a21b(++_0x3a39bf);}(_0x737c,0xed));var _0xc737=function(_0x4552ea,_0x5607ea){_0x4552ea=_0x4552ea-0x0;var _0x28fec0=_0x737c[_0x4552ea];return _0x28fec0;};'use strict';var Sequelize=require(_0xc737('0x0'));module[_0xc737('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc737('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc737('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xc737('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2b95af){this[_0xc737('0x4')](_0xc737('0x5'),typeof _0x2b95af===_0xc737('0x6')&&_0x2b95af[_0xc737('0x7')]()?_0x2b95af['trim']():null);}},'pager':{'type':Sequelize[_0xc737('0x2')]},'tz':{'type':Sequelize[_0xc737('0x2')],'defaultValue':_0xc737('0x8')},'attach':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':_0xc737('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':_0xc737('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc737('0x2')]},'callback':{'type':Sequelize[_0xc737('0x2')]},'review':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc737('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc737('0x9')]('yes','no'),'defaultValue':_0xc737('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc737('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc737('0x9')](_0xc737('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xc737('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xc737('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc737('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc737('0xd')],'get':function(){return this[_0xc737('0xe')](_0xc737('0xf'))+_0xc737('0x10')+this[_0xc737('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index bc0cd71..3410194 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 _0x9ffd=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','body','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise'];(function(_0x57f88a,_0xb91046){var _0x4f8813=function(_0x1e9591){while(--_0x1e9591){_0x57f88a['push'](_0x57f88a['shift']());}};_0x4f8813(++_0xb91046);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1eb7a8,_0x36b24a){_0x1eb7a8=_0x1eb7a8-0x0;var _0x175a88=_0x9ffd[_0x1eb7a8];return _0x175a88;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Voicemails';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['VoiceMail'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':!![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['VoiceMail'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['VoiceMail'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x24')]=function(_0x49623d,_0xc82610){if(_0x49623d['body']['id']){delete _0x49623d[_0xd9ff('0x4f')]['id'];}return db['VoiceMail'][_0xd9ff('0x47')]({'where':{'id':_0x49623d['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))['then'](saveUpdates(_0x49623d[_0xd9ff('0x4f')],null))[_0xd9ff('0x25')](respondWithResult(_0xc82610,null))[_0xd9ff('0x45')](handleError(_0xc82610,null));};exports[_0xd9ff('0x50')]=function(_0x4df17b,_0x8c136b){return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x4df17b['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x8c136b,null))[_0xd9ff('0x25')](removeEntity(_0x8c136b,null))[_0xd9ff('0x45')](handleError(_0x8c136b,null));};exports[_0xd9ff('0x51')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){return db[_0xd9ff('0x40')][_0xd9ff('0x52')]({'where':{'id':_0x11dd0c[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x56e8e8,null))[_0xd9ff('0x25')](function(_0x458fd4){var _0x5bac6f;var _0x3be850={},_0x11251f={};_0x11251f['model']=_[_0xd9ff('0x32')](db[_0xd9ff('0x53')]['rawAttributes']);_0x11251f[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x11dd0c[_0xd9ff('0x31')]);_0x11251f['filters']=_['intersection'](_0x11251f[_0xd9ff('0x30')],_0x11251f['query']);_0x3be850[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x11251f[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x11dd0c['query']['fields']));_0x3be850['attributes']=_0x3be850[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x3be850[_0xd9ff('0x35')]:_0x11251f[_0xd9ff('0x30')];if(!_0x11dd0c[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x3be850['limit']=qs[_0xd9ff('0x20')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x3be850[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x3be850[_0xd9ff('0x54')]=qs['sort'](_0x11dd0c[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x3be850['where']=qs['filters'](_[_0xd9ff('0x3b')](_0x11dd0c['query'],_0x11251f[_0xd9ff('0x33')]));if(_0x11dd0c[_0xd9ff('0x31')]['filter']){_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x3be850[_0xd9ff('0x35')],function(_0x49c5fa){var _0x12a8d7={};_0x12a8d7[_0x49c5fa]={'$like':'%'+_0x11dd0c['query']['filter']+'%'};return _0x12a8d7;})});}_0x3be850[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x3be850[_0xd9ff('0x3a')],{'mailboxuser':_0x458fd4[_0xd9ff('0x55')]});_0x3be850=_['merge']({},_0x3be850,_0x11dd0c[_0xd9ff('0x3f')]);return db[_0xd9ff('0x53')][_0xd9ff('0x56')](_0x3be850)[_0xd9ff('0x25')](respondWithFilteredResult(_0x56e8e8,_0x3be850));})[_0xd9ff('0x45')](handleError(_0x56e8e8,null));}; \ No newline at end of file +var _0x4fc2=['nolimit','mailbox','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','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','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Voicemails','UserProfileResource','stack','name','send','map','VoiceMail','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne'];(function(_0x577764,_0x4f11b9){var _0x15f43e=function(_0x9576f2){while(--_0x9576f2){_0x577764['push'](_0x577764['shift']());}};_0x15f43e(++_0x4f11b9);}(_0x4fc2,0x111));var _0x24fc=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x4fc2[_0x1417c6];return _0x44db97;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['VoiceMail'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](removeEntity(_0x11690f,null))[_0x24fc('0x51')](handleError(_0x11690f,null));};exports[_0x24fc('0x55')]=function(_0x50302e,_0x28a44c,_0x4a0524){return db[_0x24fc('0x2f')][_0x24fc('0x56')]({'where':{'id':_0x50302e['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x28a44c,null))['then'](function(_0x1c1f74){var _0x595c47;var _0xdff811={},_0x27b612={};_0x27b612['model']=_[_0x24fc('0x47')](db['VoiceMailMessage'][_0x24fc('0x48')]);_0x27b612[_0x24fc('0x33')]=_['keys'](_0x50302e[_0x24fc('0x33')]);_0x27b612[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],_0x27b612[_0x24fc('0x33')]);_0xdff811['attributes']=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x37')]));_0xdff811['attributes']=_0xdff811['attributes'][_0x24fc('0x38')]?_0xdff811[_0x24fc('0x35')]:_0x27b612['model'];if(!_0x50302e['query'][_0x24fc('0x39')](_0x24fc('0x57'))){_0xdff811[_0x24fc('0x21')]=qs[_0x24fc('0x21')](_0x50302e['query'][_0x24fc('0x21')]);_0xdff811[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x1f')]);}_0xdff811[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x3b')]);_0xdff811[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x50302e[_0x24fc('0x33')],_0x27b612[_0x24fc('0x34')]));if(_0x50302e[_0x24fc('0x33')]['filter']){_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0xdff811[_0x24fc('0x35')],function(_0x2eb6dc){var _0x10d148={};_0x10d148[_0x2eb6dc]={'$like':'%'+_0x50302e[_0x24fc('0x33')]['filter']+'%'};return _0x10d148;})});}_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'mailboxuser':_0x1c1f74[_0x24fc('0x58')]});_0xdff811=_['merge']({},_0xdff811,_0x50302e[_0x24fc('0x41')]);return db[_0x24fc('0x59')]['findAndCountAll'](_0xdff811)['then'](respondWithFilteredResult(_0x28a44c,_0xdff811));})['catch'](handleError(_0x28a44c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2d5ad29..e6a5ca0 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 _0x320e=['define','VoiceMail','mailbox_context','mailbox','context','lodash','util','api','bluebird','request-promise','path','./voiceMail.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x320e,0x1a5));var _0xe320=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x320e[_0x241424];return _0x3da798;};'use strict';var _=require(_0xe320('0x0'));var util=require(_0xe320('0x1'));var logger=require('../../config/logger')(_0xe320('0x2'));var moment=require('moment');var BPromise=require(_0xe320('0x3'));var rp=require(_0xe320('0x4'));var fs=require('fs');var path=require(_0xe320('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe320('0x6'));module[_0xe320('0x7')]=function(_0x29bb48,_0x183f60){return _0x29bb48[_0xe320('0x8')](_0xe320('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xe320('0xa'),'fields':[_0xe320('0xb'),_0xe320('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9908=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9908,0x18d));var _0x8990=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0x9908[_0x2bfa06];return _0x58811b;};'use strict';var _=require(_0x8990('0x0'));var util=require(_0x8990('0x1'));var logger=require(_0x8990('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8990('0x3'));var rimraf=require(_0x8990('0x4'));var config=require(_0x8990('0x5'));var attributes=require(_0x8990('0x6'));module[_0x8990('0x7')]=function(_0x70ab30,_0x327ab7){return _0x70ab30[_0x8990('0x8')](_0x8990('0x9'),attributes,{'tableName':_0x8990('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8990('0xb'),_0x8990('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a73e82e..eaa45c2 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 _0x7624=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash'];(function(_0x31621f,_0x1bf7e4){var _0x5f3de0=function(_0x5ec3af){while(--_0x5ec3af){_0x31621f['push'](_0x31621f['shift']());}};_0x5f3de0(++_0x1bf7e4);}(_0x7624,0x1cd));var _0x4762=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7624[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4762('0x0'));var util=require('util');var moment=require(_0x4762('0x1'));var BPromise=require(_0x4762('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4762('0x3'))['db'];var utils=require(_0x4762('0x4'));var logger=require(_0x4762('0x5'))(_0x4762('0x6'));var config=require(_0x4762('0x7'));var jayson=require(_0x4762('0x8'));var client=jayson['client'][_0x4762('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x458e28,_0x4bb7e3,_0x3edefd){return new BPromise(function(_0x312120,_0x105f83){return client[_0x4762('0xa')](_0x458e28,_0x3edefd)[_0x4762('0xb')](function(_0x5d71ca){logger[_0x4762('0xc')](_0x4762('0xd'),_0x4bb7e3,_0x4762('0xe'));logger[_0x4762('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4bb7e3,_0x4762('0xe'),JSON['stringify'](_0x5d71ca));if(_0x5d71ca[_0x4762('0x10')]){if(_0x5d71ca[_0x4762('0x10')][_0x4762('0x11')]===0x1f4){logger[_0x4762('0x10')](_0x4762('0xd'),_0x4bb7e3,_0x5d71ca[_0x4762('0x10')]['message']);return _0x105f83(_0x5d71ca['error'][_0x4762('0x12')]);}logger[_0x4762('0x10')](_0x4762('0xd'),_0x4bb7e3,_0x5d71ca['error'][_0x4762('0x12')]);return _0x312120(_0x5d71ca[_0x4762('0x10')][_0x4762('0x12')]);}else{logger[_0x4762('0xc')](_0x4762('0xd'),_0x4bb7e3,'request\x20sent');_0x312120(_0x5d71ca[_0x4762('0x13')][_0x4762('0x12')]);}})[_0x4762('0x14')](function(_0x5103de){logger[_0x4762('0x10')]('VoiceMail,\x20%s,\x20%s',_0x4bb7e3,_0x5103de);_0x105f83(_0x5103de);});});} \ No newline at end of file +var _0xf926=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf926,0x166));var _0x6f92=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf926[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x6f92('0x0'));var util=require(_0x6f92('0x1'));var moment=require(_0x6f92('0x2'));var BPromise=require(_0x6f92('0x3'));var rs=require(_0x6f92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f92('0x5'))['db'];var utils=require(_0x6f92('0x6'));var logger=require('../../config/logger')(_0x6f92('0x7'));var config=require(_0x6f92('0x8'));var jayson=require(_0x6f92('0x9'));var client=jayson['client'][_0x6f92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e7888,_0x1e4b47,_0x11dec5){return new BPromise(function(_0x46cad8,_0x5c15b1){return client[_0x6f92('0xb')](_0x4e7888,_0x11dec5)['then'](function(_0x26ebe2){logger[_0x6f92('0xc')](_0x6f92('0xd'),_0x1e4b47,'request\x20sent');logger['debug'](_0x6f92('0xe'),_0x1e4b47,_0x6f92('0xf'),JSON['stringify'](_0x26ebe2));if(_0x26ebe2[_0x6f92('0x10')]){if(_0x26ebe2[_0x6f92('0x10')]['code']===0x1f4){logger[_0x6f92('0x10')](_0x6f92('0xd'),_0x1e4b47,_0x26ebe2[_0x6f92('0x10')][_0x6f92('0x11')]);return _0x5c15b1(_0x26ebe2[_0x6f92('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x1e4b47,_0x26ebe2['error'][_0x6f92('0x11')]);return _0x46cad8(_0x26ebe2[_0x6f92('0x10')][_0x6f92('0x11')]);}else{logger[_0x6f92('0xc')](_0x6f92('0xd'),_0x1e4b47,_0x6f92('0xf'));_0x46cad8(_0x26ebe2['result'][_0x6f92('0x11')]);}})['catch'](function(_0x443999){logger['error'](_0x6f92('0xd'),_0x1e4b47,_0x443999);_0x5c15b1(_0x443999);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8184355..1bd386c 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 _0x53c5=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x27c1ab,_0x3734be){var _0x5087a3=function(_0x471a6a){while(--_0x471a6a){_0x27c1ab['push'](_0x27c1ab['shift']());}};_0x5087a3(++_0x3734be);}(_0x53c5,0x137));var _0x553c=function(_0x2b4d83,_0x1b2963){_0x2b4d83=_0x2b4d83-0x0;var _0x29c658=_0x53c5[_0x2b4d83];return _0x29c658;};'use strict';var multer=require(_0x553c('0x0'));var util=require(_0x553c('0x1'));var path=require(_0x553c('0x2'));var timeout=require(_0x553c('0x3'));var express=require(_0x553c('0x4'));var router=express[_0x553c('0x5')]();var fs_extra=require(_0x553c('0x6'));var auth=require(_0x553c('0x7'));var interaction=require(_0x553c('0x8'));var config=require(_0x553c('0x9'));var controller=require(_0x553c('0xa'));router['get']('/',auth[_0x553c('0xb')](),controller[_0x553c('0xc')]);router[_0x553c('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x553c('0xd')](_0x553c('0xe'),auth['isAuthenticated'](),controller[_0x553c('0xf')]);router[_0x553c('0x10')]('/',auth['isAuthenticated'](),controller[_0x553c('0x11')]);router[_0x553c('0x12')](_0x553c('0x13'),auth['isAuthenticated'](),controller[_0x553c('0x14')]);router[_0x553c('0x15')](_0x553c('0x13'),auth[_0x553c('0xb')](),controller[_0x553c('0x16')]);module[_0x553c('0x17')]=router; \ No newline at end of file +var _0x1b13=['show','get','/:id/download','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/:id'];(function(_0x9c2bff,_0x45d88d){var _0x4ec763=function(_0x2f68e6){while(--_0x2f68e6){_0x9c2bff['push'](_0x9c2bff['shift']());}};_0x4ec763(++_0x45d88d);}(_0x1b13,0x112));var _0x31b1=function(_0x34bf52,_0x277087){_0x34bf52=_0x34bf52-0x0;var _0x3fdd10=_0x1b13[_0x34bf52];return _0x3fdd10;};'use strict';var multer=require(_0x31b1('0x0'));var util=require(_0x31b1('0x1'));var path=require(_0x31b1('0x2'));var timeout=require(_0x31b1('0x3'));var express=require(_0x31b1('0x4'));var router=express[_0x31b1('0x5')]();var fs_extra=require(_0x31b1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x31b1('0x7'));var config=require(_0x31b1('0x8'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x31b1('0x9')](),controller['index']);router['get'](_0x31b1('0xa'),auth[_0x31b1('0x9')](),controller[_0x31b1('0xb')]);router[_0x31b1('0xc')](_0x31b1('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x31b1('0xe')]('/',auth[_0x31b1('0x9')](),controller[_0x31b1('0xf')]);router[_0x31b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x31b1('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x31b1('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 692adf6..30d4192 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 _0x5e50=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x5ecc4d,_0x192051){var _0x5412f3=function(_0xd38f1b){while(--_0xd38f1b){_0x5ecc4d['push'](_0x5ecc4d['shift']());}};_0x5412f3(++_0x192051);}(_0x5e50,0xb2));var _0x05e5=function(_0x15ced4,_0x14b0f1){_0x15ced4=_0x15ced4-0x0;var _0x12a26f=_0x5e50[_0x15ced4];return _0x12a26f;};'use strict';var Sequelize=require(_0x05e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x05e5('0x1')],'get':function(_0x5e2496){return this[_0x05e5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x05e5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x05e5('0x5')](_0x05e5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x05e5('0x4')],'defaultValue':''},'stamp':{'type':_0x05e5('0x7'),'defaultValue':Sequelize[_0x05e5('0x8')](_0x05e5('0x9'))}}; \ No newline at end of file +var _0x7245=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING'];(function(_0x255036,_0xf94145){var _0x3c4c56=function(_0x50a35c){while(--_0x50a35c){_0x255036['push'](_0x255036['shift']());}};_0x3c4c56(++_0xf94145);}(_0x7245,0x7c));var _0x5724=function(_0x27d27a,_0x359150){_0x27d27a=_0x27d27a-0x0;var _0x72788e=_0x7245[_0x27d27a];return _0x72788e;};'use strict';var Sequelize=require(_0x5724('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45863c){return this[_0x5724('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x5724('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x5724('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5724('0x3')],'defaultValue':''},'stamp':{'type':_0x5724('0x5'),'defaultValue':Sequelize[_0x5724('0x6')](_0x5724('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f8fd547..8070e1b 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 _0x1711=['fieldName','type','key','model','differenceBy','keys','intersection','query','attributes','length','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','fields','includeAll','options','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','msg_id','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes'];(function(_0x5900b6,_0x542703){var _0x33347b=function(_0x4971d6){while(--_0x4971d6){_0x5900b6['push'](_0x5900b6['shift']());}};_0x33347b(++_0x542703);}(_0x1711,0x134));var _0x1171=function(_0x58790b,_0x4f2c3e){_0x58790b=_0x58790b-0x0;var _0x51820d=_0x1711[_0x58790b];return _0x51820d;};'use strict';var emlformat=require(_0x1171('0x0'));var rimraf=require(_0x1171('0x1'));var zipdir=require(_0x1171('0x2'));var jsonpatch=require(_0x1171('0x3'));var rp=require(_0x1171('0x4'));var moment=require('moment');var BPromise=require(_0x1171('0x5'));var Mustache=require(_0x1171('0x6'));var util=require(_0x1171('0x7'));var path=require(_0x1171('0x8'));var sox=require(_0x1171('0x9'));var csv=require(_0x1171('0xa'));var ejs=require(_0x1171('0xb'));var fs=require('fs');var fs_extra=require(_0x1171('0xc'));var _=require(_0x1171('0xd'));var squel=require(_0x1171('0xe'));var crypto=require(_0x1171('0xf'));var jsforce=require(_0x1171('0x10'));var deskjs=require(_0x1171('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1171('0x12'));var Papa=require(_0x1171('0x13'));var Redis=require(_0x1171('0x14'));var authService=require(_0x1171('0x15'));var qs=require(_0x1171('0x16'));var as=require(_0x1171('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1171('0x18'))(_0x1171('0x19'));var utils=require(_0x1171('0x1a'));var config=require(_0x1171('0x1b'));var licenseUtil=require(_0x1171('0x1c'));var db=require(_0x1171('0x1d'))['db'];function respondWithStatusCode(_0x4b5f05,_0x198de4){_0x198de4=_0x198de4||0xcc;return function(_0x3e8889){if(_0x3e8889){return _0x4b5f05[_0x1171('0x1e')](_0x198de4);}return _0x4b5f05[_0x1171('0x1f')](_0x198de4)[_0x1171('0x20')]();};}function respondWithResult(_0x4a721e,_0xff6cca){_0xff6cca=_0xff6cca||0xc8;return function(_0x3dc38e){if(_0x3dc38e){return _0x4a721e[_0x1171('0x1f')](_0xff6cca)['json'](_0x3dc38e);}};}function respondWithFilteredResult(_0x36f243,_0x4a0b47){return function(_0x3f2f75){if(_0x3f2f75){var _0x5430b9=typeof _0x4a0b47[_0x1171('0x21')]==='undefined'&&typeof _0x4a0b47[_0x1171('0x22')]===_0x1171('0x23');var _0x8b8fca=_0x3f2f75[_0x1171('0x24')];var _0x4e3057=_0x5430b9?0x0:_0x4a0b47['offset'];var _0x4e92d9=_0x5430b9?_0x3f2f75[_0x1171('0x24')]:_0x4a0b47[_0x1171('0x21')]+_0x4a0b47[_0x1171('0x22')];var _0x278f0d;if(_0x4e92d9>=_0x8b8fca){_0x4e92d9=_0x8b8fca;_0x278f0d=0xc8;}else{_0x278f0d=0xce;}_0x36f243['status'](_0x278f0d);return _0x36f243[_0x1171('0x25')]('Content-Range',_0x4e3057+'-'+_0x4e92d9+'/'+_0x8b8fca)[_0x1171('0x26')](_0x3f2f75);}return null;};}function patchUpdates(_0x107db8){return function(_0x45acb1){try{jsonpatch[_0x1171('0x27')](_0x45acb1,_0x107db8,!![]);}catch(_0x19a6e4){return BPromise[_0x1171('0x28')](_0x19a6e4);}return _0x45acb1[_0x1171('0x29')]();};}function saveUpdates(_0x1c06f6,_0x1ab230){return function(_0x23c8ab){if(_0x23c8ab){return _0x23c8ab[_0x1171('0x2a')](_0x1c06f6)[_0x1171('0x2b')](function(_0x37a36e){return _0x37a36e;});}return null;};}function removeEntity(_0xc39264,_0x70b233){return function(_0x3d3f58){if(_0x3d3f58){return _0x3d3f58[_0x1171('0x2c')]()[_0x1171('0x2b')](function(){_0xc39264[_0x1171('0x1f')](0xcc)[_0x1171('0x20')]();});}};}function handleEntityNotFound(_0x30894e,_0x188bd2){return function(_0x566b00){if(!_0x566b00){_0x30894e[_0x1171('0x1e')](0x194);}return _0x566b00;};}function handleError(_0x52b6e2,_0xeeee32){_0xeeee32=_0xeeee32||0x1f4;return function(_0x12fa5c){logger[_0x1171('0x2d')](_0x12fa5c[_0x1171('0x2e')]);if(_0x12fa5c[_0x1171('0x2f')]){delete _0x12fa5c[_0x1171('0x2f')];}_0x52b6e2[_0x1171('0x1f')](_0xeeee32)['send'](_0x12fa5c);};}exports[_0x1171('0x30')]=function(_0x3a22b6,_0x4c3ded){var _0x35da79={},_0x28cdf1={},_0x186505={'count':0x0,'rows':[]};var _0x1e72f0=_[_0x1171('0x31')](db[_0x1171('0x32')][_0x1171('0x33')],function(_0x53a966){return{'name':_0x53a966[_0x1171('0x34')],'type':_0x53a966[_0x1171('0x35')][_0x1171('0x36')]};});_0x28cdf1[_0x1171('0x37')]=_[_0x1171('0x38')](_['map'](_0x1e72f0,_0x1171('0x2f')),[_0x1171('0x2f')]);_0x28cdf1['query']=_[_0x1171('0x39')](_0x3a22b6['query']);_0x28cdf1['filters']=_[_0x1171('0x3a')](_0x28cdf1[_0x1171('0x37')],_0x28cdf1[_0x1171('0x3b')]);_0x35da79[_0x1171('0x3c')]=_[_0x1171('0x3a')](_0x28cdf1['model'],qs['fields'](_0x3a22b6['query']['fields']));_0x35da79[_0x1171('0x3c')]=_0x35da79['attributes'][_0x1171('0x3d')]?_0x35da79[_0x1171('0x3c')]:_0x28cdf1[_0x1171('0x37')];if(!_0x3a22b6['query'][_0x1171('0x3e')]('nolimit')){_0x35da79[_0x1171('0x22')]=qs[_0x1171('0x22')](_0x3a22b6[_0x1171('0x3b')][_0x1171('0x22')]);_0x35da79['offset']=qs['offset'](_0x3a22b6[_0x1171('0x3b')][_0x1171('0x21')]);}_0x35da79['order']=qs['sort'](_0x3a22b6['query']['sort']);_0x35da79[_0x1171('0x3f')]=qs[_0x1171('0x40')](_[_0x1171('0x41')](_0x3a22b6[_0x1171('0x3b')],_0x28cdf1[_0x1171('0x40')]),_0x1e72f0);if(_0x3a22b6[_0x1171('0x3b')][_0x1171('0x42')]){_0x35da79[_0x1171('0x3f')]=_[_0x1171('0x43')](_0x35da79[_0x1171('0x3f')],{'$or':_['map'](_0x1e72f0,function(_0x1903fc){if(_0x1903fc[_0x1171('0x35')]!==_0x1171('0x44')){var _0x4d1e5f={};_0x4d1e5f[_0x1903fc[_0x1171('0x2f')]]={'$like':'%'+_0x3a22b6[_0x1171('0x3b')][_0x1171('0x42')]+'%'};return _0x4d1e5f;}})});}_0x35da79=_[_0x1171('0x43')]({},_0x35da79,_0x3a22b6['options']);var _0x9d1c2a={'where':_0x35da79[_0x1171('0x3f')]};return db[_0x1171('0x32')]['count'](_0x9d1c2a)[_0x1171('0x2b')](function(_0x2cbf5b){_0x186505['count']=_0x2cbf5b;if(_0x3a22b6[_0x1171('0x3b')]['includeAll']){_0x35da79[_0x1171('0x45')]=[{'all':!![]}];}return db[_0x1171('0x32')][_0x1171('0x46')](_0x35da79);})[_0x1171('0x2b')](function(_0x26372c){_0x186505[_0x1171('0x47')]=_0x26372c;return _0x186505;})['then'](respondWithFilteredResult(_0x4c3ded,_0x35da79))[_0x1171('0x48')](handleError(_0x4c3ded,null));};exports['show']=function(_0x25f413,_0x7d2f5e){var _0x37283d={'raw':!![],'where':{'id':_0x25f413[_0x1171('0x49')]['id']}},_0x49dabb={};_0x49dabb['model']=_['keys'](db[_0x1171('0x32')][_0x1171('0x33')]);_0x49dabb['query']=_[_0x1171('0x39')](_0x25f413[_0x1171('0x3b')]);_0x49dabb[_0x1171('0x40')]=_['intersection'](_0x49dabb['model'],_0x49dabb[_0x1171('0x3b')]);_0x37283d[_0x1171('0x3c')]=_['intersection'](_0x49dabb[_0x1171('0x37')],qs[_0x1171('0x4a')](_0x25f413['query'][_0x1171('0x4a')]));_0x37283d[_0x1171('0x3c')]=_0x37283d[_0x1171('0x3c')][_0x1171('0x3d')]?_0x37283d[_0x1171('0x3c')]:_0x49dabb[_0x1171('0x37')];if(_0x25f413['query'][_0x1171('0x4b')]){_0x37283d[_0x1171('0x45')]=[{'all':!![]}];}_0x37283d=_[_0x1171('0x43')]({},_0x37283d,_0x25f413[_0x1171('0x4c')]);return db[_0x1171('0x32')][_0x1171('0x4d')](_0x37283d)[_0x1171('0x2b')](handleEntityNotFound(_0x7d2f5e,null))[_0x1171('0x2b')](respondWithResult(_0x7d2f5e,null))[_0x1171('0x48')](handleError(_0x7d2f5e,null));};exports[_0x1171('0x4e')]=function(_0x2b274a,_0x3c84ae){return db[_0x1171('0x32')][_0x1171('0x4e')](_0x2b274a[_0x1171('0x4f')],{})['then'](respondWithResult(_0x3c84ae,0xc9))[_0x1171('0x48')](handleError(_0x3c84ae,null));};exports[_0x1171('0x2a')]=function(_0x1317cd,_0x266052){if(_0x1317cd[_0x1171('0x4f')]['id']){delete _0x1317cd[_0x1171('0x4f')]['id'];}return db['VoiceMailMessage'][_0x1171('0x4d')]({'where':{'id':_0x1317cd[_0x1171('0x49')]['id']}})[_0x1171('0x2b')](handleEntityNotFound(_0x266052,null))['then'](saveUpdates(_0x1317cd['body'],null))[_0x1171('0x2b')](respondWithResult(_0x266052,null))[_0x1171('0x48')](handleError(_0x266052,null));};exports['destroy']=function(_0x37b0ab,_0x59a53f){return db[_0x1171('0x32')][_0x1171('0x4d')]({'where':{'id':_0x37b0ab['params']['id']}})[_0x1171('0x2b')](handleEntityNotFound(_0x59a53f,null))[_0x1171('0x2b')](removeEntity(_0x59a53f,null))[_0x1171('0x48')](handleError(_0x59a53f,null));};exports[_0x1171('0x50')]=function(_0x1509ef,_0x464611,_0x2f319e){return db['VoiceMailMessage'][_0x1171('0x4d')]({'where':{'id':_0x1509ef['params']['id']},'attributes':['id',_0x1171('0x51'),'msg_id']})[_0x1171('0x2b')](handleEntityNotFound(_0x464611,null))[_0x1171('0x2b')](function(_0x8c34bf){if(_0x8c34bf){if(!_0x8c34bf[_0x1171('0x51')]){throw new db[(_0x1171('0x52'))][(_0x1171('0x53'))](_0x1171('0x54'));}var _0x4e48b8={'Content-Type':_0x1171('0x55'),'Content-Disposition':_0x1171('0x56')};if(_0x8c34bf['msg_id']){_0x4e48b8['Content-Disposition']=_0x1171('0x57')+_0x8c34bf[_0x1171('0x58')]+'.wav\x22';}_0x464611['set'](_0x4e48b8);return _0x464611[_0x1171('0x59')](new Buffer(_0x8c34bf[_0x1171('0x51')]));}})[_0x1171('0x48')](handleError(_0x464611,null));}; \ No newline at end of file +var _0x2816=['find','download','recording','msg_id','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','rawAttributes','fieldName','model','differenceBy','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2816,0x15e));var _0x6281=function(_0x9f765a,_0x261519){_0x9f765a=_0x9f765a-0x0;var _0x446c48=_0x2816[_0x9f765a];return _0x446c48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6281('0x0'));var zipdir=require(_0x6281('0x1'));var jsonpatch=require(_0x6281('0x2'));var rp=require(_0x6281('0x3'));var moment=require(_0x6281('0x4'));var BPromise=require(_0x6281('0x5'));var Mustache=require(_0x6281('0x6'));var util=require(_0x6281('0x7'));var path=require(_0x6281('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6281('0x9'));var fs=require('fs');var fs_extra=require(_0x6281('0xa'));var _=require(_0x6281('0xb'));var squel=require(_0x6281('0xc'));var crypto=require(_0x6281('0xd'));var jsforce=require(_0x6281('0xe'));var deskjs=require(_0x6281('0xf'));var toCsv=require(_0x6281('0x10'));var querystring=require(_0x6281('0x11'));var Papa=require(_0x6281('0x12'));var Redis=require(_0x6281('0x13'));var authService=require(_0x6281('0x14'));var qs=require(_0x6281('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6281('0x16'));var logger=require(_0x6281('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6281('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6281('0x19'))['db'];function respondWithStatusCode(_0x58a60c,_0x3d1010){_0x3d1010=_0x3d1010||0xcc;return function(_0x5b0166){if(_0x5b0166){return _0x58a60c[_0x6281('0x1a')](_0x3d1010);}return _0x58a60c['status'](_0x3d1010)[_0x6281('0x1b')]();};}function respondWithResult(_0x58dbc6,_0x6132c2){_0x6132c2=_0x6132c2||0xc8;return function(_0x367499){if(_0x367499){return _0x58dbc6[_0x6281('0x1c')](_0x6132c2)['json'](_0x367499);}};}function respondWithFilteredResult(_0x4d60c6,_0x572488){return function(_0x1fb719){if(_0x1fb719){var _0x11c0c2=typeof _0x572488['offset']===_0x6281('0x1d')&&typeof _0x572488[_0x6281('0x1e')]===_0x6281('0x1d');var _0x5b8b8f=_0x1fb719[_0x6281('0x1f')];var _0x31716f=_0x11c0c2?0x0:_0x572488['offset'];var _0x169f0f=_0x11c0c2?_0x1fb719[_0x6281('0x1f')]:_0x572488[_0x6281('0x20')]+_0x572488[_0x6281('0x1e')];var _0x4b2ea5;if(_0x169f0f>=_0x5b8b8f){_0x169f0f=_0x5b8b8f;_0x4b2ea5=0xc8;}else{_0x4b2ea5=0xce;}_0x4d60c6[_0x6281('0x1c')](_0x4b2ea5);return _0x4d60c6['set'](_0x6281('0x21'),_0x31716f+'-'+_0x169f0f+'/'+_0x5b8b8f)[_0x6281('0x22')](_0x1fb719);}return null;};}function patchUpdates(_0x556af4){return function(_0x39955d){try{jsonpatch[_0x6281('0x23')](_0x39955d,_0x556af4,!![]);}catch(_0x537d8e){return BPromise[_0x6281('0x24')](_0x537d8e);}return _0x39955d['save']();};}function saveUpdates(_0x309aaa,_0x38470a){return function(_0x11a4be){if(_0x11a4be){return _0x11a4be[_0x6281('0x25')](_0x309aaa)[_0x6281('0x26')](function(_0x78cc30){return _0x78cc30;});}return null;};}function removeEntity(_0x3b80c2,_0x1acf3a){return function(_0x3836c6){if(_0x3836c6){return _0x3836c6[_0x6281('0x27')]()[_0x6281('0x26')](function(){_0x3b80c2[_0x6281('0x1c')](0xcc)[_0x6281('0x1b')]();});}};}function handleEntityNotFound(_0x394a01,_0x2aaa1c){return function(_0x28bedf){if(!_0x28bedf){_0x394a01[_0x6281('0x1a')](0x194);}return _0x28bedf;};}function handleError(_0x5c1457,_0x1c2915){_0x1c2915=_0x1c2915||0x1f4;return function(_0x46990b){logger['error'](_0x46990b[_0x6281('0x28')]);if(_0x46990b[_0x6281('0x29')]){delete _0x46990b[_0x6281('0x29')];}_0x5c1457[_0x6281('0x1c')](_0x1c2915)[_0x6281('0x2a')](_0x46990b);};}exports['index']=function(_0x443efe,_0x17d395){var _0x4abdeb={},_0x4ad4b4={},_0x588e9b={'count':0x0,'rows':[]};var _0x3dbc36=_['map'](db['VoiceMailMessage'][_0x6281('0x2b')],function(_0x13c078){return{'name':_0x13c078[_0x6281('0x2c')],'type':_0x13c078['type']['key']};});_0x4ad4b4[_0x6281('0x2d')]=_[_0x6281('0x2e')](_[_0x6281('0x2f')](_0x3dbc36,'name'),[_0x6281('0x29')]);_0x4ad4b4[_0x6281('0x30')]=_[_0x6281('0x31')](_0x443efe[_0x6281('0x30')]);_0x4ad4b4[_0x6281('0x32')]=_[_0x6281('0x33')](_0x4ad4b4['model'],_0x4ad4b4['query']);_0x4abdeb[_0x6281('0x34')]=_['intersection'](_0x4ad4b4[_0x6281('0x2d')],qs['fields'](_0x443efe[_0x6281('0x30')]['fields']));_0x4abdeb[_0x6281('0x34')]=_0x4abdeb[_0x6281('0x34')][_0x6281('0x35')]?_0x4abdeb[_0x6281('0x34')]:_0x4ad4b4['model'];if(!_0x443efe[_0x6281('0x30')][_0x6281('0x36')](_0x6281('0x37'))){_0x4abdeb[_0x6281('0x1e')]=qs[_0x6281('0x1e')](_0x443efe['query'][_0x6281('0x1e')]);_0x4abdeb['offset']=qs[_0x6281('0x20')](_0x443efe['query'][_0x6281('0x20')]);}_0x4abdeb['order']=qs[_0x6281('0x38')](_0x443efe['query']['sort']);_0x4abdeb['where']=qs[_0x6281('0x32')](_[_0x6281('0x39')](_0x443efe[_0x6281('0x30')],_0x4ad4b4[_0x6281('0x32')]),_0x3dbc36);if(_0x443efe[_0x6281('0x30')]['filter']){_0x4abdeb[_0x6281('0x3a')]=_[_0x6281('0x3b')](_0x4abdeb['where'],{'$or':_[_0x6281('0x2f')](_0x3dbc36,function(_0x4f685b){if(_0x4f685b[_0x6281('0x3c')]!==_0x6281('0x3d')){var _0x32423={};_0x32423[_0x4f685b[_0x6281('0x29')]]={'$like':'%'+_0x443efe['query'][_0x6281('0x3e')]+'%'};return _0x32423;}})});}_0x4abdeb=_['merge']({},_0x4abdeb,_0x443efe['options']);var _0x11ba6a={'where':_0x4abdeb[_0x6281('0x3a')]};return db[_0x6281('0x3f')][_0x6281('0x1f')](_0x11ba6a)[_0x6281('0x26')](function(_0x4040a2){_0x588e9b[_0x6281('0x1f')]=_0x4040a2;if(_0x443efe[_0x6281('0x30')][_0x6281('0x40')]){_0x4abdeb[_0x6281('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x6281('0x42')](_0x4abdeb);})[_0x6281('0x26')](function(_0x34ca58){_0x588e9b[_0x6281('0x43')]=_0x34ca58;return _0x588e9b;})[_0x6281('0x26')](respondWithFilteredResult(_0x17d395,_0x4abdeb))[_0x6281('0x44')](handleError(_0x17d395,null));};exports[_0x6281('0x45')]=function(_0x427b8f,_0xa2d4ec){var _0x19533a={'raw':!![],'where':{'id':_0x427b8f[_0x6281('0x46')]['id']}},_0x496c07={};_0x496c07[_0x6281('0x2d')]=_[_0x6281('0x31')](db[_0x6281('0x3f')][_0x6281('0x2b')]);_0x496c07[_0x6281('0x30')]=_[_0x6281('0x31')](_0x427b8f[_0x6281('0x30')]);_0x496c07['filters']=_[_0x6281('0x33')](_0x496c07[_0x6281('0x2d')],_0x496c07[_0x6281('0x30')]);_0x19533a[_0x6281('0x34')]=_[_0x6281('0x33')](_0x496c07['model'],qs[_0x6281('0x47')](_0x427b8f[_0x6281('0x30')][_0x6281('0x47')]));_0x19533a[_0x6281('0x34')]=_0x19533a['attributes']['length']?_0x19533a[_0x6281('0x34')]:_0x496c07[_0x6281('0x2d')];if(_0x427b8f[_0x6281('0x30')][_0x6281('0x40')]){_0x19533a[_0x6281('0x41')]=[{'all':!![]}];}_0x19533a=_[_0x6281('0x3b')]({},_0x19533a,_0x427b8f[_0x6281('0x48')]);return db[_0x6281('0x3f')]['find'](_0x19533a)['then'](handleEntityNotFound(_0xa2d4ec,null))[_0x6281('0x26')](respondWithResult(_0xa2d4ec,null))[_0x6281('0x44')](handleError(_0xa2d4ec,null));};exports[_0x6281('0x49')]=function(_0x5e8e43,_0x201bf9){return db[_0x6281('0x3f')][_0x6281('0x49')](_0x5e8e43[_0x6281('0x4a')],{})[_0x6281('0x26')](respondWithResult(_0x201bf9,0xc9))['catch'](handleError(_0x201bf9,null));};exports[_0x6281('0x25')]=function(_0x3819b1,_0x1138fa){if(_0x3819b1[_0x6281('0x4a')]['id']){delete _0x3819b1[_0x6281('0x4a')]['id'];}return db[_0x6281('0x3f')][_0x6281('0x4b')]({'where':{'id':_0x3819b1[_0x6281('0x46')]['id']}})[_0x6281('0x26')](handleEntityNotFound(_0x1138fa,null))[_0x6281('0x26')](saveUpdates(_0x3819b1[_0x6281('0x4a')],null))[_0x6281('0x26')](respondWithResult(_0x1138fa,null))[_0x6281('0x44')](handleError(_0x1138fa,null));};exports[_0x6281('0x27')]=function(_0x3c81ff,_0x577613){return db[_0x6281('0x3f')][_0x6281('0x4b')]({'where':{'id':_0x3c81ff[_0x6281('0x46')]['id']}})['then'](handleEntityNotFound(_0x577613,null))[_0x6281('0x26')](removeEntity(_0x577613,null))[_0x6281('0x44')](handleError(_0x577613,null));};exports[_0x6281('0x4c')]=function(_0x28387b,_0x1d3ca5,_0x5f327f){return db[_0x6281('0x3f')][_0x6281('0x4b')]({'where':{'id':_0x28387b['params']['id']},'attributes':['id',_0x6281('0x4d'),_0x6281('0x4e')]})[_0x6281('0x26')](handleEntityNotFound(_0x1d3ca5,null))[_0x6281('0x26')](function(_0xc6dca3){if(_0xc6dca3){if(!_0xc6dca3['recording']){throw new db['Sequelize']['ValidationError'](_0x6281('0x4f'));}var _0x66a9bd={'Content-Type':'audio/wav','Content-Disposition':_0x6281('0x50')};if(_0xc6dca3['msg_id']){_0x66a9bd[_0x6281('0x51')]=_0x6281('0x52')+_0xc6dca3['msg_id']+_0x6281('0x53');}_0x1d3ca5[_0x6281('0x54')](_0x66a9bd);return _0x1d3ca5[_0x6281('0x2a')](new Buffer(_0xc6dca3[_0x6281('0x4d')]));}})[_0x6281('0x44')](handleError(_0x1d3ca5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b175770..4a10cf7 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 _0xab21=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMailMessage','dir'];(function(_0x3c6554,_0x2822e2){var _0x4111b3=function(_0x16aa41){while(--_0x16aa41){_0x3c6554['push'](_0x3c6554['shift']());}};_0x4111b3(++_0x2822e2);}(_0xab21,0x193));var _0x1ab2=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xab21[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x1ab2('0x0'));var util=require(_0x1ab2('0x1'));var logger=require(_0x1ab2('0x2'))(_0x1ab2('0x3'));var moment=require(_0x1ab2('0x4'));var BPromise=require(_0x1ab2('0x5'));var rp=require(_0x1ab2('0x6'));var fs=require('fs');var path=require(_0x1ab2('0x7'));var rimraf=require('rimraf');var config=require(_0x1ab2('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x1ab2('0x9')]=function(_0x3d4905,_0x228ef9){return _0x3d4905[_0x1ab2('0xa')](_0x1ab2('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1ab2('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x08be=['rimraf','exports','define','voice_voicemail_messages','dir','lodash','util','moment','request-promise','path'];(function(_0x2e80d6,_0x4e228a){var _0x3660eb=function(_0x39d206){while(--_0x39d206){_0x2e80d6['push'](_0x2e80d6['shift']());}};_0x3660eb(++_0x4e228a);}(_0x08be,0x73));var _0xe08b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x08be[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe08b('0x0'));var util=require(_0xe08b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe08b('0x2'));var BPromise=require('bluebird');var rp=require(_0xe08b('0x3'));var fs=require('fs');var path=require(_0xe08b('0x4'));var rimraf=require(_0xe08b('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe08b('0x6')]=function(_0xe0b17a,_0x556cf9){return _0xe0b17a[_0xe08b('0x7')]('VoiceMailMessage',attributes,{'tableName':_0xe08b('0x8'),'paranoid':![],'indexes':[{'name':_0xe08b('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 62a7894..892298a 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 _0xe7f1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xe7f1,0x1ae));var _0x1e7f=function(_0x267cfa,_0x2bf8b0){_0x267cfa=_0x267cfa-0x0;var _0x20d10d=_0xe7f1[_0x267cfa];return _0x20d10d;};'use strict';var _=require(_0x1e7f('0x0'));var util=require(_0x1e7f('0x1'));var moment=require(_0x1e7f('0x2'));var BPromise=require(_0x1e7f('0x3'));var rs=require(_0x1e7f('0x4'));var fs=require('fs');var Redis=require(_0x1e7f('0x5'));var db=require(_0x1e7f('0x6'))['db'];var utils=require(_0x1e7f('0x7'));var logger=require(_0x1e7f('0x8'))(_0x1e7f('0x9'));var config=require('../../config/environment');var jayson=require(_0x1e7f('0xa'));var client=jayson[_0x1e7f('0xb')][_0x1e7f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c37b9,_0xdd8b28,_0x3bb7e9){return new BPromise(function(_0x115de1,_0x4136be){return client[_0x1e7f('0xd')](_0x4c37b9,_0x3bb7e9)[_0x1e7f('0xe')](function(_0x2ca38a){logger['info'](_0x1e7f('0xf'),_0xdd8b28,'request\x20sent');logger[_0x1e7f('0x10')](_0x1e7f('0x11'),_0xdd8b28,_0x1e7f('0x12'),JSON[_0x1e7f('0x13')](_0x2ca38a));if(_0x2ca38a[_0x1e7f('0x14')]){if(_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x15')]===0x1f4){logger[_0x1e7f('0x14')](_0x1e7f('0xf'),_0xdd8b28,_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x16')]);return _0x4136be(_0x2ca38a[_0x1e7f('0x14')][_0x1e7f('0x16')]);}logger['error'](_0x1e7f('0xf'),_0xdd8b28,_0x2ca38a['error'][_0x1e7f('0x16')]);return _0x115de1(_0x2ca38a[_0x1e7f('0x14')]['message']);}else{logger['info'](_0x1e7f('0xf'),_0xdd8b28,_0x1e7f('0x12'));_0x115de1(_0x2ca38a['result'][_0x1e7f('0x16')]);}})[_0x1e7f('0x17')](function(_0xf92204){logger['error'](_0x1e7f('0xf'),_0xdd8b28,_0xf92204);_0x4136be(_0xf92204);});});} \ No newline at end of file +var _0x8a45=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a45,0x160));var _0x58a4=function(_0x21cb11,_0x5c7d29){_0x21cb11=_0x21cb11-0x0;var _0x1033e9=_0x8a45[_0x21cb11];return _0x1033e9;};'use strict';var _=require(_0x58a4('0x0'));var util=require(_0x58a4('0x1'));var moment=require('moment');var BPromise=require(_0x58a4('0x2'));var rs=require(_0x58a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58a4('0x4'))['db'];var utils=require(_0x58a4('0x5'));var logger=require(_0x58a4('0x6'))(_0x58a4('0x7'));var config=require(_0x58a4('0x8'));var jayson=require(_0x58a4('0x9'));var client=jayson[_0x58a4('0xa')][_0x58a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55c226,_0x288d32,_0x4de3f8){return new BPromise(function(_0x46db6d,_0x40409a){return client[_0x58a4('0xc')](_0x55c226,_0x4de3f8)[_0x58a4('0xd')](function(_0x2e1f73){logger[_0x58a4('0xe')](_0x58a4('0xf'),_0x288d32,'request\x20sent');logger['debug'](_0x58a4('0x10'),_0x288d32,_0x58a4('0x11'),JSON['stringify'](_0x2e1f73));if(_0x2e1f73[_0x58a4('0x12')]){if(_0x2e1f73['error'][_0x58a4('0x13')]===0x1f4){logger[_0x58a4('0x12')](_0x58a4('0xf'),_0x288d32,_0x2e1f73[_0x58a4('0x12')]['message']);return _0x40409a(_0x2e1f73[_0x58a4('0x12')][_0x58a4('0x14')]);}logger[_0x58a4('0x12')](_0x58a4('0xf'),_0x288d32,_0x2e1f73[_0x58a4('0x12')][_0x58a4('0x14')]);return _0x46db6d(_0x2e1f73[_0x58a4('0x12')][_0x58a4('0x14')]);}else{logger[_0x58a4('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x288d32,_0x58a4('0x11'));_0x46db6d(_0x2e1f73[_0x58a4('0x15')][_0x58a4('0x14')]);}})['catch'](function(_0x436f1c){logger[_0x58a4('0x12')](_0x58a4('0xf'),_0x288d32,_0x436f1c);_0x40409a(_0x436f1c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 855dc51..767e348 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 _0xa4ec=['post','addSound','put','update','destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','/:id/sounds','getSounds'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa4ec,0x184));var _0xca4e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa4ec[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca4e('0x0'));var timeout=require(_0xca4e('0x1'));var express=require('express');var router=express[_0xca4e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xca4e('0x3'));var interaction=require(_0xca4e('0x4'));var config=require(_0xca4e('0x5'));var controller=require(_0xca4e('0x6'));router['get']('/',auth[_0xca4e('0x7')](),controller['index']);router[_0xca4e('0x8')](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller['show']);router[_0xca4e('0x8')](_0xca4e('0xa'),auth[_0xca4e('0x7')](),controller[_0xca4e('0xb')]);router[_0xca4e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xca4e('0xa'),auth['isAuthenticated'](),controller[_0xca4e('0xd')]);router[_0xca4e('0xe')](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller[_0xca4e('0xf')]);router['delete'](_0xca4e('0x9'),auth[_0xca4e('0x7')](),controller[_0xca4e('0x10')]);router['delete'](_0xca4e('0x11'),auth['isAuthenticated'](),controller[_0xca4e('0x12')]);module[_0xca4e('0x13')]=router; \ No newline at end of file +var _0x7fa7=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','removeSound'];(function(_0x33f5f9,_0x3898eb){var _0x646bd8=function(_0x1a449f){while(--_0x1a449f){_0x33f5f9['push'](_0x33f5f9['shift']());}};_0x646bd8(++_0x3898eb);}(_0x7fa7,0x74));var _0x77fa=function(_0x139a23,_0x184a3f){_0x139a23=_0x139a23-0x0;var _0x4da424=_0x7fa7[_0x139a23];return _0x4da424;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77fa('0x0'));var timeout=require(_0x77fa('0x1'));var express=require(_0x77fa('0x2'));var router=express[_0x77fa('0x3')]();var fs_extra=require(_0x77fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77fa('0x5'));var config=require(_0x77fa('0x6'));var controller=require(_0x77fa('0x7'));router[_0x77fa('0x8')]('/',auth[_0x77fa('0x9')](),controller[_0x77fa('0xa')]);router['get']('/:id',auth[_0x77fa('0x9')](),controller['show']);router[_0x77fa('0x8')](_0x77fa('0xb'),auth[_0x77fa('0x9')](),controller[_0x77fa('0xc')]);router[_0x77fa('0xd')]('/',auth[_0x77fa('0x9')](),controller[_0x77fa('0xe')]);router[_0x77fa('0xd')]('/:id/sounds',auth[_0x77fa('0x9')](),controller[_0x77fa('0xf')]);router[_0x77fa('0x10')](_0x77fa('0x11'),auth[_0x77fa('0x9')](),controller['update']);router[_0x77fa('0x12')](_0x77fa('0x11'),auth[_0x77fa('0x9')](),controller[_0x77fa('0x13')]);router[_0x77fa('0x12')](_0x77fa('0x14'),auth['isAuthenticated'](),controller[_0x77fa('0x15')]);module[_0x77fa('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8ec7698..c7ff46f 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 _0xecbf=['BOOLEAN','STRING','custom','mp3nb','quietmp3nb','alpha','TIMESTAMP'];(function(_0x1bd6d2,_0x20cb59){var _0x5378c6=function(_0x2582ec){while(--_0x2582ec){_0x1bd6d2['push'](_0x1bd6d2['shift']());}};_0x5378c6(++_0x20cb59);}(_0xecbf,0x6a));var _0xfecb=function(_0x33c835,_0x5a6b5a){_0x33c835=_0x33c835-0x0;var _0x32503d=_0xecbf[_0x33c835];return _0x32503d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfecb('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xfecb('0x1'),'files',_0xfecb('0x2'),_0xfecb('0x3'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![],'defaultValue':_0xfecb('0x4')},'format':{'type':Sequelize[_0xfecb('0x0')],'allowNull':!![]},'stamp':{'type':_0xfecb('0x5')},'defaultEntry':{'type':Sequelize[_0xfecb('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9228=['files','mp3nb','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x37593d,_0x20990f){var _0x5e2c62=function(_0x3d7a1e){while(--_0x3d7a1e){_0x37593d['push'](_0x37593d['shift']());}};_0x5e2c62(++_0x20990f);}(_0x9228,0xf1));var _0x8922=function(_0x5d1d25,_0x763b36){_0x5d1d25=_0x5d1d25-0x0;var _0x5d5dce=_0x9228[_0x5d1d25];return _0x5d5dce;};'use strict';var Sequelize=require(_0x8922('0x0'));module[_0x8922('0x1')]={'name':{'type':Sequelize[_0x8922('0x2')],'allowNull':![],'unique':_0x8922('0x3')},'mode':{'type':Sequelize[_0x8922('0x4')](_0x8922('0x5'),_0x8922('0x6'),_0x8922('0x7'),_0x8922('0x8'),_0x8922('0x9'),_0x8922('0xa')),'allowNull':!![],'defaultValue':_0x8922('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8922('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8922('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8922('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x8922('0x2')],'allowNull':!![]},'stamp':{'type':_0x8922('0xb')},'defaultEntry':{'type':Sequelize[_0x8922('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 20db8fe..6f1d4c7 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 _0x876e=['%s.%s','symlinkSync','message','removeSound','id2','createdAt','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','body','find','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','userProfileId','params','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','server/files/sounds/converted','basename','extname','converted_format','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x876e,0xe2));var _0xe876=function(_0x18e0b5,_0x29c8e1){_0x18e0b5=_0x18e0b5-0x0;var _0x32fa5d=_0x876e[_0x18e0b5];return _0x32fa5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe876('0x0'));var zipdir=require(_0xe876('0x1'));var jsonpatch=require(_0xe876('0x2'));var rp=require(_0xe876('0x3'));var moment=require(_0xe876('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe876('0x5'));var util=require(_0xe876('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe876('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe876('0x8'));var _=require('lodash');var squel=require(_0xe876('0x9'));var crypto=require(_0xe876('0xa'));var jsforce=require(_0xe876('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe876('0x7'));var querystring=require('querystring');var Papa=require(_0xe876('0xc'));var Redis=require('ioredis');var authService=require(_0xe876('0xd'));var qs=require(_0xe876('0xe'));var as=require(_0xe876('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe876('0x10'));var utils=require(_0xe876('0x11'));var config=require(_0xe876('0x12'));var licenseUtil=require(_0xe876('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6dd1,_0x416fd9){_0x416fd9=_0x416fd9||0xcc;return function(_0xf90944){if(_0xf90944){return _0x4c6dd1[_0xe876('0x14')](_0x416fd9);}return _0x4c6dd1[_0xe876('0x15')](_0x416fd9)['end']();};}function respondWithResult(_0x19fd36,_0xf3ee71){_0xf3ee71=_0xf3ee71||0xc8;return function(_0x357214){if(_0x357214){return _0x19fd36[_0xe876('0x15')](_0xf3ee71)[_0xe876('0x16')](_0x357214);}};}function respondWithFilteredResult(_0x43383e,_0x3dd630){return function(_0x377458){if(_0x377458){var _0x3dc7a8=typeof _0x3dd630['offset']===_0xe876('0x17')&&typeof _0x3dd630['limit']===_0xe876('0x17');var _0x445685=_0x377458[_0xe876('0x18')];var _0x3b0fa3=_0x3dc7a8?0x0:_0x3dd630['offset'];var _0x1708f6=_0x3dc7a8?_0x377458[_0xe876('0x18')]:_0x3dd630['offset']+_0x3dd630[_0xe876('0x19')];var _0x5d3652;if(_0x1708f6>=_0x445685){_0x1708f6=_0x445685;_0x5d3652=0xc8;}else{_0x5d3652=0xce;}_0x43383e['status'](_0x5d3652);return _0x43383e[_0xe876('0x1a')](_0xe876('0x1b'),_0x3b0fa3+'-'+_0x1708f6+'/'+_0x445685)['json'](_0x377458);}return null;};}function patchUpdates(_0x2bfce3){return function(_0x9ff7a4){try{jsonpatch[_0xe876('0x1c')](_0x9ff7a4,_0x2bfce3,!![]);}catch(_0x110461){return BPromise[_0xe876('0x1d')](_0x110461);}return _0x9ff7a4[_0xe876('0x1e')]();};}function saveUpdates(_0x35f3bf,_0x57ab68){return function(_0x16769a){if(_0x16769a){return _0x16769a[_0xe876('0x1f')](_0x35f3bf)[_0xe876('0x20')](function(_0x58b053){return _0x58b053;});}return null;};}function removeEntity(_0x327901,_0x1b67ac){return function(_0x2b6b3a){if(_0x2b6b3a){return _0x2b6b3a[_0xe876('0x21')]()[_0xe876('0x20')](function(){var _0x17df98=_0x2b6b3a[_0xe876('0x22')]({'plain':!![]});var _0x2ba094=_0xe876('0x23');return db[_0xe876('0x24')][_0xe876('0x21')]({'where':{'type':_0x2ba094,'resourceId':_0x17df98['id']}})['then'](function(){return _0x2b6b3a;});})[_0xe876('0x20')](function(){_0x327901[_0xe876('0x15')](0xcc)[_0xe876('0x25')]();});}};}function handleEntityNotFound(_0x51b9f9,_0x3de96d){return function(_0x69a2a0){if(!_0x69a2a0){_0x51b9f9['sendStatus'](0x194);}return _0x69a2a0;};}function handleError(_0xeb990c,_0x1789d9){_0x1789d9=_0x1789d9||0x1f4;return function(_0x125af6){logger[_0xe876('0x26')](_0x125af6[_0xe876('0x27')]);if(_0x125af6[_0xe876('0x28')]){delete _0x125af6[_0xe876('0x28')];}_0xeb990c[_0xe876('0x15')](_0x1789d9)['send'](_0x125af6);};}exports[_0xe876('0x29')]=function(_0x2130ed,_0x2b4671){var _0x5e6020={},_0x557215={},_0x399fad={'count':0x0,'rows':[]};var _0x5bd172=_[_0xe876('0x2a')](db[_0xe876('0x2b')][_0xe876('0x2c')],function(_0x3abcc3){return{'name':_0x3abcc3[_0xe876('0x2d')],'type':_0x3abcc3['type']['key']};});_0x557215[_0xe876('0x2e')]=_[_0xe876('0x2a')](_0x5bd172,'name');_0x557215[_0xe876('0x2f')]=_[_0xe876('0x30')](_0x2130ed[_0xe876('0x2f')]);_0x557215[_0xe876('0x31')]=_[_0xe876('0x32')](_0x557215[_0xe876('0x2e')],_0x557215[_0xe876('0x2f')]);_0x5e6020[_0xe876('0x33')]=_[_0xe876('0x32')](_0x557215[_0xe876('0x2e')],qs['fields'](_0x2130ed['query'][_0xe876('0x34')]));_0x5e6020[_0xe876('0x33')]=_0x5e6020['attributes'][_0xe876('0x35')]?_0x5e6020[_0xe876('0x33')]:_0x557215['model'];if(!_0x2130ed[_0xe876('0x2f')][_0xe876('0x36')](_0xe876('0x37'))){_0x5e6020['limit']=qs['limit'](_0x2130ed[_0xe876('0x2f')]['limit']);_0x5e6020[_0xe876('0x38')]=qs[_0xe876('0x38')](_0x2130ed[_0xe876('0x2f')][_0xe876('0x38')]);}_0x5e6020['order']=qs[_0xe876('0x39')](_0x2130ed[_0xe876('0x2f')][_0xe876('0x39')]);delete _0x2130ed[_0xe876('0x2f')][_0xe876('0x39')];_0x5e6020['where']=qs[_0xe876('0x31')](_[_0xe876('0x3a')](_0x2130ed[_0xe876('0x2f')],_0x557215[_0xe876('0x31')]),_0x5bd172);if(_0x2130ed[_0xe876('0x2f')][_0xe876('0x3b')]){_0x5e6020[_0xe876('0x3c')]=_['merge'](_0x5e6020[_0xe876('0x3c')],{'$or':_[_0xe876('0x2a')](_0x5bd172,function(_0x3fe4f5){if(_0x3fe4f5[_0xe876('0x3d')]!=='VIRTUAL'){var _0x2242e2={};_0x2242e2[_0x3fe4f5[_0xe876('0x28')]]={'$like':'%'+_0x2130ed[_0xe876('0x2f')][_0xe876('0x3b')]+'%'};return _0x2242e2;}})});}_0x5e6020=_[_0xe876('0x3e')]({},_0x5e6020,_0x2130ed[_0xe876('0x3f')]);var _0xe9d224={'where':_0x5e6020[_0xe876('0x3c')]};return db[_0xe876('0x2b')][_0xe876('0x18')](_0xe9d224)[_0xe876('0x20')](function(_0x247eb0){_0x399fad[_0xe876('0x18')]=_0x247eb0;if(_0x2130ed[_0xe876('0x2f')][_0xe876('0x40')]){_0x5e6020[_0xe876('0x41')]=[{'all':!![]}];}return db[_0xe876('0x2b')][_0xe876('0x42')](_0x5e6020);})[_0xe876('0x20')](function(_0x4bb55d){_0x399fad[_0xe876('0x43')]=_0x4bb55d;return _0x399fad;})[_0xe876('0x20')](respondWithFilteredResult(_0x2b4671,_0x5e6020))[_0xe876('0x44')](handleError(_0x2b4671,null));};exports[_0xe876('0x45')]=function(_0x4b174b,_0x4d1ab2){var _0x1d7e81={'raw':![],'where':{'id':_0x4b174b['params']['id']}},_0x65da49={};_0x65da49[_0xe876('0x2e')]=_[_0xe876('0x30')](db[_0xe876('0x2b')]['rawAttributes']);_0x65da49['query']=_[_0xe876('0x30')](_0x4b174b[_0xe876('0x2f')]);_0x65da49[_0xe876('0x31')]=_[_0xe876('0x32')](_0x65da49['model'],_0x65da49[_0xe876('0x2f')]);_0x1d7e81['attributes']=_[_0xe876('0x32')](_0x65da49[_0xe876('0x2e')],qs[_0xe876('0x34')](_0x4b174b['query'][_0xe876('0x34')]));_0x1d7e81['attributes']=_0x1d7e81['attributes'][_0xe876('0x35')]?_0x1d7e81['attributes']:_0x65da49[_0xe876('0x2e')];if(_0x4b174b[_0xe876('0x2f')][_0xe876('0x40')]){_0x1d7e81[_0xe876('0x41')]=[{'all':!![]}];}_0x1d7e81=_[_0xe876('0x3e')]({},_0x1d7e81,_0x4b174b[_0xe876('0x3f')]);return db['VoiceMusicOnHold']['find'](_0x1d7e81)['then'](handleEntityNotFound(_0x4d1ab2,null))[_0xe876('0x20')](respondWithResult(_0x4d1ab2,null))['catch'](handleError(_0x4d1ab2,null));};exports[_0xe876('0x1f')]=function(_0x3f9512,_0x182b2c){if(_0x3f9512['body']['id']){delete _0x3f9512[_0xe876('0x46')]['id'];}return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x3f9512['params']['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x182b2c,null))[_0xe876('0x20')](saveUpdates(_0x3f9512[_0xe876('0x46')],null))[_0xe876('0x20')](respondWithResult(_0x182b2c,null))[_0xe876('0x44')](handleError(_0x182b2c,null));};exports[_0xe876('0x48')]=function(_0x41be92,_0x1bc4e7,_0x1bcfc9){return db['sequelize'][_0xe876('0x49')](function(_0xb52d4b){if(_0x41be92[_0xe876('0x46')][_0xe876('0x4a')]===_0xe876('0x4b')){_0x41be92['body'][_0xe876('0x4c')]=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x4f'),_0x41be92[_0xe876('0x46')][_0xe876('0x28')]);}return db['VoiceMusicOnHold'][_0xe876('0x48')](_0x41be92[_0xe876('0x46')],{'transaction':_0xb52d4b})['then'](function(_0x153484){if(_0x41be92[_0xe876('0x46')][_0xe876('0x4a')]==='files'){fs[_0xe876('0x50')](_0x153484[_0xe876('0x4c')],parseInt(_0xe876('0x51'),0x8));}var _0x539eb4=_0x41be92[_0xe876('0x52')][_0xe876('0x22')]({'plain':!![]});if(!_0x539eb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x539eb4[_0xe876('0x53')]===_0xe876('0x52')){var _0x9957f2=_0x153484[_0xe876('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xe876('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x539eb4[_0xe876('0x54')]},'raw':!![]})[_0xe876('0x20')](function(_0x4c1543){if(_0x4c1543&&_0x4c1543['autoAssociation']===0x0){return db[_0xe876('0x24')][_0xe876('0x48')]({'name':_0x9957f2['name'],'resourceId':_0x9957f2['id'],'type':_0x4c1543[_0xe876('0x28')],'sectionId':_0x4c1543['id']},{})[_0xe876('0x20')](function(){return _0x153484;});}else{return _0x153484;}})[_0xe876('0x44')](function(_0x5ab1c2){logger[_0xe876('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ab1c2);});}return _0x153484;});})[_0xe876('0x20')](respondWithResult(_0x1bc4e7,0xc9))[_0xe876('0x44')](handleError(_0x1bc4e7,null));};exports['destroy']=function(_0x52610f,_0x12140e,_0x489b65){var _0x2d7de5;return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x52610f[_0xe876('0x55')]['id']}})[_0xe876('0x20')](function(_0x199ccc){if(_0x199ccc){return db[_0xe876('0x56')]['transaction'](function(_0xca7e48){return _0x199ccc[_0xe876('0x21')]({'transaction':_0xca7e48,'raw':!![]})['then'](function(_0x58c720){if(_0x58c720[_0xe876('0x4c')]){fs[_0xe876('0x57')](_0x58c720[_0xe876('0x4c')])['forEach'](function(_0x3b4dea){fs[_0xe876('0x58')](path['join'](_0x58c720[_0xe876('0x4c')],_0x3b4dea));});fs[_0xe876('0x59')](_0x58c720[_0xe876('0x4c')]);}return _0x58c720;});})[_0xe876('0x44')](function(_0x5096f1){throw new db[(_0xe876('0x5a'))][(_0xe876('0x5b'))](_0x5096f1['message']);});}})['then'](handleEntityNotFound(_0x12140e,null))[_0xe876('0x20')](removeEntity(_0x12140e,null))['catch'](handleError(_0x12140e,null));};exports['addSound']=function(_0x2c7353,_0x24d91c,_0xc25e61){return db[_0xe876('0x56')][_0xe876('0x49')](function(_0x2682a7){var _0x2c20ca;return db[_0xe876('0x2b')][_0xe876('0x47')]({'where':{'id':_0x2c7353['params']['id']}})['then'](function(_0x3e0b5f){if(_0x3e0b5f){_0x2c20ca=_0x3e0b5f;return _0x3e0b5f[_0xe876('0x5c')](_0x2c7353[_0xe876('0x46')]['id'],{'transaction':_0x2682a7});}})[_0xe876('0x20')](function(_0x23e26f){if(_0x23e26f){return db[_0xe876('0x5d')][_0xe876('0x5e')]({'where':{'id':_0x2c7353['body']['id']},'attributes':['id',_0xe876('0x28'),_0xe876('0x5f'),'converted_format','createdAt'],'raw':!![]});}})[_0xe876('0x20')](function(_0x562d92){if(_0x562d92){var _0x214e87=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x60'),util['format']('%s.%s',path[_0xe876('0x61')](_0x562d92[_0xe876('0x5f')],path[_0xe876('0x62')](_0x562d92[_0xe876('0x5f')])),_0x562d92[_0xe876('0x63')]));var _0x210419=path[_0xe876('0x4d')](config[_0xe876('0x4e')],_0xe876('0x4f'),_0x2c20ca['name'],util[_0xe876('0x64')](_0xe876('0x65'),_0x562d92[_0xe876('0x28')],_0x562d92[_0xe876('0x63')]));fs[_0xe876('0x66')](_0x214e87,_0x210419);return _0x562d92;}})['catch'](function(_0x300aad){throw new db['Sequelize'][(_0xe876('0x5b'))](_0x300aad[_0xe876('0x67')]);});})[_0xe876('0x20')](handleEntityNotFound(_0x24d91c,null))['then'](respondWithResult(_0x24d91c,0xc9))['catch'](handleError(_0x24d91c,null));};exports[_0xe876('0x68')]=function(_0x59e8e1,_0x195e0a,_0x522798){return db[_0xe876('0x56')][_0xe876('0x49')](function(_0x1d07f5){var _0x560dd7;return db[_0xe876('0x2b')]['findOne']({'where':{'id':_0x59e8e1[_0xe876('0x55')]['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x195e0a,null))[_0xe876('0x20')](function(_0x4d71b8){if(_0x4d71b8){_0x560dd7=_0x4d71b8;return _0x4d71b8['removeSound'](_0x59e8e1[_0xe876('0x55')][_0xe876('0x69')]);}})[_0xe876('0x20')](function(_0x1ae459){if(_0x1ae459){return db[_0xe876('0x5d')][_0xe876('0x5e')]({'where':{'id':_0x59e8e1['params'][_0xe876('0x69')]},'attributes':['id',_0xe876('0x28'),_0xe876('0x5f'),_0xe876('0x63'),_0xe876('0x6a')],'raw':!![]});}})[_0xe876('0x20')](function(_0x356e58){if(_0x356e58){fs[_0xe876('0x58')](path['join'](_0x560dd7[_0xe876('0x4c')],util['format']('%s.%s',_0x356e58['name'],_0x356e58[_0xe876('0x63')])));return _0x356e58;}})[_0xe876('0x44')](function(_0x5309b3){throw new db[(_0xe876('0x5a'))][(_0xe876('0x5b'))](_0x5309b3[_0xe876('0x67')]);});})['then'](handleEntityNotFound(_0x195e0a,null))[_0xe876('0x20')](respondWithStatusCode(_0x195e0a,0xcc))[_0xe876('0x44')](handleError(_0x195e0a,null));};exports[_0xe876('0x6b')]=function(_0x4bd2d4,_0x2a40fa,_0x580a50){var _0x49fa0b={};var _0x298f5c={};var _0x40d342;var _0x58ed46;return db[_0xe876('0x2b')][_0xe876('0x5e')]({'where':{'id':_0x4bd2d4[_0xe876('0x55')]['id']}})[_0xe876('0x20')](handleEntityNotFound(_0x2a40fa,null))[_0xe876('0x20')](function(_0x507846){if(_0x507846){_0x40d342=_0x507846;_0x298f5c[_0xe876('0x2e')]=_[_0xe876('0x30')](db['Sound']['rawAttributes']);_0x298f5c[_0xe876('0x2f')]=_['keys'](_0x4bd2d4['query']);_0x298f5c[_0xe876('0x31')]=_['intersection'](_0x298f5c[_0xe876('0x2e')],_0x298f5c[_0xe876('0x2f')]);_0x49fa0b[_0xe876('0x33')]=_[_0xe876('0x32')](_0x298f5c[_0xe876('0x2e')],qs['fields'](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x34')]));_0x49fa0b['attributes']=_0x49fa0b[_0xe876('0x33')][_0xe876('0x35')]?_0x49fa0b[_0xe876('0x33')]:_0x298f5c[_0xe876('0x2e')];_0x49fa0b[_0xe876('0x6c')]=qs[_0xe876('0x39')](_0x4bd2d4[_0xe876('0x2f')]['sort']);_0x49fa0b[_0xe876('0x3c')]=qs['filters'](_[_0xe876('0x3a')](_0x4bd2d4[_0xe876('0x2f')],_0x298f5c[_0xe876('0x31')]));if(_0x4bd2d4['query'][_0xe876('0x3b')]){_0x49fa0b[_0xe876('0x3c')]=_[_0xe876('0x3e')](_0x49fa0b[_0xe876('0x3c')],{'$or':_[_0xe876('0x2a')](_0x49fa0b[_0xe876('0x33')],function(_0xbebe49){var _0x237a29={};_0x237a29[_0xbebe49]={'$like':'%'+_0x4bd2d4['query']['filter']+'%'};return _0x237a29;})});}_0x49fa0b=_['merge']({},_0x49fa0b,_0x4bd2d4[_0xe876('0x3f')]);return _0x40d342[_0xe876('0x6b')](_0x49fa0b);}})[_0xe876('0x20')](function(_0x5bef6e){if(_0x5bef6e){_0x58ed46=_0x5bef6e[_0xe876('0x35')];if(!_0x4bd2d4['query'][_0xe876('0x36')](_0xe876('0x37'))){_0x49fa0b['limit']=qs[_0xe876('0x19')](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x19')]);_0x49fa0b[_0xe876('0x38')]=qs[_0xe876('0x38')](_0x4bd2d4[_0xe876('0x2f')][_0xe876('0x38')]);}return _0x40d342[_0xe876('0x6b')](_0x49fa0b);}})[_0xe876('0x20')](function(_0x48c7d4){if(_0x48c7d4){return _0x48c7d4?{'count':_0x58ed46,'rows':_0x48c7d4}:null;}})[_0xe876('0x20')](respondWithResult(_0x2a40fa,null))['catch'](handleError(_0x2a40fa,null));}; \ No newline at end of file +var _0x0cbc=['save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','message','removeSound','rawAttributes','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','mode','files','directory','root','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','forEach','unlinkSync','join','Sequelize','ValidationError','addSound','Sound','findOne'];(function(_0x5801f9,_0x516fd7){var _0x3e96f8=function(_0x333786){while(--_0x333786){_0x5801f9['push'](_0x5801f9['shift']());}};_0x3e96f8(++_0x516fd7);}(_0x0cbc,0x7a));var _0xc0cb=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x0cbc[_0xe45118];return _0x15e15d;};'use strict';var emlformat=require(_0xc0cb('0x0'));var rimraf=require(_0xc0cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0cb('0x2'));var rp=require(_0xc0cb('0x3'));var moment=require(_0xc0cb('0x4'));var BPromise=require(_0xc0cb('0x5'));var Mustache=require(_0xc0cb('0x6'));var util=require('util');var path=require(_0xc0cb('0x7'));var sox=require(_0xc0cb('0x8'));var csv=require('to-csv');var ejs=require(_0xc0cb('0x9'));var fs=require('fs');var fs_extra=require(_0xc0cb('0xa'));var _=require(_0xc0cb('0xb'));var squel=require(_0xc0cb('0xc'));var crypto=require(_0xc0cb('0xd'));var jsforce=require(_0xc0cb('0xe'));var deskjs=require(_0xc0cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc0cb('0x10'));var Papa=require('papaparse');var Redis=require(_0xc0cb('0x11'));var authService=require(_0xc0cb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc0cb('0x13'));var hardwareService=require(_0xc0cb('0x14'));var logger=require(_0xc0cb('0x15'))(_0xc0cb('0x16'));var utils=require('../../config/utils');var config=require(_0xc0cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0cb('0x18'))['db'];function respondWithStatusCode(_0x482182,_0x25169a){_0x25169a=_0x25169a||0xcc;return function(_0x525e86){if(_0x525e86){return _0x482182[_0xc0cb('0x19')](_0x25169a);}return _0x482182[_0xc0cb('0x1a')](_0x25169a)[_0xc0cb('0x1b')]();};}function respondWithResult(_0x5b3b7e,_0x49d821){_0x49d821=_0x49d821||0xc8;return function(_0x4dd8c7){if(_0x4dd8c7){return _0x5b3b7e['status'](_0x49d821)[_0xc0cb('0x1c')](_0x4dd8c7);}};}function respondWithFilteredResult(_0x521c6f,_0xfcec59){return function(_0x4004d9){if(_0x4004d9){var _0x5cc139=typeof _0xfcec59['offset']===_0xc0cb('0x1d')&&typeof _0xfcec59[_0xc0cb('0x1e')]===_0xc0cb('0x1d');var _0x5744b7=_0x4004d9[_0xc0cb('0x1f')];var _0x5d2e31=_0x5cc139?0x0:_0xfcec59[_0xc0cb('0x20')];var _0x20f9dc=_0x5cc139?_0x4004d9[_0xc0cb('0x1f')]:_0xfcec59['offset']+_0xfcec59[_0xc0cb('0x1e')];var _0x76acb5;if(_0x20f9dc>=_0x5744b7){_0x20f9dc=_0x5744b7;_0x76acb5=0xc8;}else{_0x76acb5=0xce;}_0x521c6f[_0xc0cb('0x1a')](_0x76acb5);return _0x521c6f['set'](_0xc0cb('0x21'),_0x5d2e31+'-'+_0x20f9dc+'/'+_0x5744b7)[_0xc0cb('0x1c')](_0x4004d9);}return null;};}function patchUpdates(_0x47ee11){return function(_0x1b2985){try{jsonpatch[_0xc0cb('0x22')](_0x1b2985,_0x47ee11,!![]);}catch(_0x176be8){return BPromise[_0xc0cb('0x23')](_0x176be8);}return _0x1b2985[_0xc0cb('0x24')]();};}function saveUpdates(_0x1a3422,_0x437221){return function(_0x36a3bd){if(_0x36a3bd){return _0x36a3bd[_0xc0cb('0x25')](_0x1a3422)[_0xc0cb('0x26')](function(_0x29ac60){return _0x29ac60;});}return null;};}function removeEntity(_0x11126a,_0x27a0c5){return function(_0x3346b9){if(_0x3346b9){return _0x3346b9[_0xc0cb('0x27')]()[_0xc0cb('0x26')](function(){var _0x26c0e5=_0x3346b9[_0xc0cb('0x28')]({'plain':!![]});var _0x51e3b7='MusicOnHolds';return db[_0xc0cb('0x29')]['destroy']({'where':{'type':_0x51e3b7,'resourceId':_0x26c0e5['id']}})['then'](function(){return _0x3346b9;});})[_0xc0cb('0x26')](function(){_0x11126a[_0xc0cb('0x1a')](0xcc)[_0xc0cb('0x1b')]();});}};}function handleEntityNotFound(_0x53929c,_0x2042a2){return function(_0x217ef6){if(!_0x217ef6){_0x53929c['sendStatus'](0x194);}return _0x217ef6;};}function handleError(_0x40c0bf,_0x1bf342){_0x1bf342=_0x1bf342||0x1f4;return function(_0x5045cf){logger['error'](_0x5045cf[_0xc0cb('0x2a')]);if(_0x5045cf[_0xc0cb('0x2b')]){delete _0x5045cf[_0xc0cb('0x2b')];}_0x40c0bf['status'](_0x1bf342)['send'](_0x5045cf);};}exports[_0xc0cb('0x2c')]=function(_0x4d98d8,_0x1f35c5){var _0x341cdd={},_0x29dc62={},_0x229bd7={'count':0x0,'rows':[]};var _0x5bfbb2=_[_0xc0cb('0x2d')](db[_0xc0cb('0x2e')]['rawAttributes'],function(_0x352d5c){return{'name':_0x352d5c[_0xc0cb('0x2f')],'type':_0x352d5c[_0xc0cb('0x30')][_0xc0cb('0x31')]};});_0x29dc62[_0xc0cb('0x32')]=_[_0xc0cb('0x2d')](_0x5bfbb2,_0xc0cb('0x2b'));_0x29dc62[_0xc0cb('0x33')]=_[_0xc0cb('0x34')](_0x4d98d8[_0xc0cb('0x33')]);_0x29dc62['filters']=_[_0xc0cb('0x35')](_0x29dc62[_0xc0cb('0x32')],_0x29dc62['query']);_0x341cdd['attributes']=_[_0xc0cb('0x35')](_0x29dc62['model'],qs['fields'](_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x36')]));_0x341cdd[_0xc0cb('0x37')]=_0x341cdd[_0xc0cb('0x37')][_0xc0cb('0x38')]?_0x341cdd['attributes']:_0x29dc62[_0xc0cb('0x32')];if(!_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x39')](_0xc0cb('0x3a'))){_0x341cdd[_0xc0cb('0x1e')]=qs[_0xc0cb('0x1e')](_0x4d98d8[_0xc0cb('0x33')]['limit']);_0x341cdd[_0xc0cb('0x20')]=qs['offset'](_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x20')]);}_0x341cdd[_0xc0cb('0x3b')]=qs[_0xc0cb('0x3c')](_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x3c')]);delete _0x4d98d8['query'][_0xc0cb('0x3c')];_0x341cdd[_0xc0cb('0x3d')]=qs[_0xc0cb('0x3e')](_[_0xc0cb('0x3f')](_0x4d98d8[_0xc0cb('0x33')],_0x29dc62[_0xc0cb('0x3e')]),_0x5bfbb2);if(_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x40')]){_0x341cdd['where']=_[_0xc0cb('0x41')](_0x341cdd[_0xc0cb('0x3d')],{'$or':_[_0xc0cb('0x2d')](_0x5bfbb2,function(_0x6e8cad){if(_0x6e8cad[_0xc0cb('0x30')]!==_0xc0cb('0x42')){var _0x3e52e0={};_0x3e52e0[_0x6e8cad[_0xc0cb('0x2b')]]={'$like':'%'+_0x4d98d8[_0xc0cb('0x33')][_0xc0cb('0x40')]+'%'};return _0x3e52e0;}})});}_0x341cdd=_['merge']({},_0x341cdd,_0x4d98d8[_0xc0cb('0x43')]);var _0x579fc9={'where':_0x341cdd[_0xc0cb('0x3d')]};return db[_0xc0cb('0x2e')][_0xc0cb('0x1f')](_0x579fc9)[_0xc0cb('0x26')](function(_0x4da563){_0x229bd7[_0xc0cb('0x1f')]=_0x4da563;if(_0x4d98d8['query'][_0xc0cb('0x44')]){_0x341cdd[_0xc0cb('0x45')]=[{'all':!![]}];}return db[_0xc0cb('0x2e')][_0xc0cb('0x46')](_0x341cdd);})['then'](function(_0x1d9705){_0x229bd7[_0xc0cb('0x47')]=_0x1d9705;return _0x229bd7;})[_0xc0cb('0x26')](respondWithFilteredResult(_0x1f35c5,_0x341cdd))[_0xc0cb('0x48')](handleError(_0x1f35c5,null));};exports[_0xc0cb('0x49')]=function(_0x228675,_0x491c7d){var _0x2079c9={'raw':![],'where':{'id':_0x228675[_0xc0cb('0x4a')]['id']}},_0x34f068={};_0x34f068[_0xc0cb('0x32')]=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x34f068[_0xc0cb('0x33')]=_['keys'](_0x228675[_0xc0cb('0x33')]);_0x34f068['filters']=_['intersection'](_0x34f068[_0xc0cb('0x32')],_0x34f068[_0xc0cb('0x33')]);_0x2079c9[_0xc0cb('0x37')]=_[_0xc0cb('0x35')](_0x34f068['model'],qs['fields'](_0x228675[_0xc0cb('0x33')][_0xc0cb('0x36')]));_0x2079c9[_0xc0cb('0x37')]=_0x2079c9[_0xc0cb('0x37')][_0xc0cb('0x38')]?_0x2079c9[_0xc0cb('0x37')]:_0x34f068[_0xc0cb('0x32')];if(_0x228675[_0xc0cb('0x33')][_0xc0cb('0x44')]){_0x2079c9[_0xc0cb('0x45')]=[{'all':!![]}];}_0x2079c9=_[_0xc0cb('0x41')]({},_0x2079c9,_0x228675[_0xc0cb('0x43')]);return db[_0xc0cb('0x2e')][_0xc0cb('0x4b')](_0x2079c9)[_0xc0cb('0x26')](handleEntityNotFound(_0x491c7d,null))[_0xc0cb('0x26')](respondWithResult(_0x491c7d,null))[_0xc0cb('0x48')](handleError(_0x491c7d,null));};exports[_0xc0cb('0x25')]=function(_0x4e9e9f,_0x456941){if(_0x4e9e9f[_0xc0cb('0x4c')]['id']){delete _0x4e9e9f[_0xc0cb('0x4c')]['id'];}return db[_0xc0cb('0x2e')][_0xc0cb('0x4b')]({'where':{'id':_0x4e9e9f[_0xc0cb('0x4a')]['id']}})[_0xc0cb('0x26')](handleEntityNotFound(_0x456941,null))[_0xc0cb('0x26')](saveUpdates(_0x4e9e9f[_0xc0cb('0x4c')],null))['then'](respondWithResult(_0x456941,null))[_0xc0cb('0x48')](handleError(_0x456941,null));};exports['create']=function(_0x59bcd2,_0x3b1372,_0x1b0a99){return db['sequelize']['transaction'](function(_0x41956a){if(_0x59bcd2[_0xc0cb('0x4c')][_0xc0cb('0x4d')]===_0xc0cb('0x4e')){_0x59bcd2[_0xc0cb('0x4c')][_0xc0cb('0x4f')]=path['join'](config[_0xc0cb('0x50')],_0xc0cb('0x51'),_0x59bcd2[_0xc0cb('0x4c')][_0xc0cb('0x2b')]);}return db['VoiceMusicOnHold']['create'](_0x59bcd2['body'],{'transaction':_0x41956a})[_0xc0cb('0x26')](function(_0x35a7a0){if(_0x59bcd2['body'][_0xc0cb('0x4d')]===_0xc0cb('0x4e')){fs[_0xc0cb('0x52')](_0x35a7a0[_0xc0cb('0x4f')],parseInt('0777',0x8));}var _0x391707=_0x59bcd2['user'][_0xc0cb('0x28')]({'plain':!![]});if(!_0x391707)throw new Error(_0xc0cb('0x53'));if(_0x391707[_0xc0cb('0x54')]==='user'){var _0x4bf8ed=_0x35a7a0['get']({'plain':!![]});return db[_0xc0cb('0x55')][_0xc0cb('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x391707['userProfileId']},'raw':!![]})[_0xc0cb('0x26')](function(_0x97eba2){if(_0x97eba2&&_0x97eba2['autoAssociation']===0x0){return db[_0xc0cb('0x29')][_0xc0cb('0x56')]({'name':_0x4bf8ed[_0xc0cb('0x2b')],'resourceId':_0x4bf8ed['id'],'type':_0x97eba2[_0xc0cb('0x2b')],'sectionId':_0x97eba2['id']},{})[_0xc0cb('0x26')](function(){return _0x35a7a0;});}else{return _0x35a7a0;}})[_0xc0cb('0x48')](function(_0x129f29){logger[_0xc0cb('0x57')](_0xc0cb('0x58'),_0x129f29);});}return _0x35a7a0;});})[_0xc0cb('0x26')](respondWithResult(_0x3b1372,0xc9))[_0xc0cb('0x48')](handleError(_0x3b1372,null));};exports[_0xc0cb('0x27')]=function(_0x50dec6,_0x2ff28f,_0x6f4b37){var _0x3a7fdc;return db['VoiceMusicOnHold'][_0xc0cb('0x4b')]({'where':{'id':_0x50dec6[_0xc0cb('0x4a')]['id']}})[_0xc0cb('0x26')](function(_0x5029a0){if(_0x5029a0){return db[_0xc0cb('0x59')][_0xc0cb('0x5a')](function(_0x676dfc){return _0x5029a0[_0xc0cb('0x27')]({'transaction':_0x676dfc,'raw':!![]})[_0xc0cb('0x26')](function(_0x174a01){if(_0x174a01['directory']){fs[_0xc0cb('0x5b')](_0x174a01['directory'])[_0xc0cb('0x5c')](function(_0x251a08){fs[_0xc0cb('0x5d')](path[_0xc0cb('0x5e')](_0x174a01[_0xc0cb('0x4f')],_0x251a08));});fs['rmdirSync'](_0x174a01[_0xc0cb('0x4f')]);}return _0x174a01;});})[_0xc0cb('0x48')](function(_0x4dad3d){throw new db[(_0xc0cb('0x5f'))][(_0xc0cb('0x60'))](_0x4dad3d['message']);});}})['then'](handleEntityNotFound(_0x2ff28f,null))[_0xc0cb('0x26')](removeEntity(_0x2ff28f,null))[_0xc0cb('0x48')](handleError(_0x2ff28f,null));};exports[_0xc0cb('0x61')]=function(_0x482f91,_0x28d50d,_0x44deda){return db['sequelize'][_0xc0cb('0x5a')](function(_0x244b2f){var _0x2ccc01;return db[_0xc0cb('0x2e')][_0xc0cb('0x4b')]({'where':{'id':_0x482f91[_0xc0cb('0x4a')]['id']}})[_0xc0cb('0x26')](function(_0x2555b3){if(_0x2555b3){_0x2ccc01=_0x2555b3;return _0x2555b3[_0xc0cb('0x61')](_0x482f91['body']['id'],{'transaction':_0x244b2f});}})[_0xc0cb('0x26')](function(_0x38c8f6){if(_0x38c8f6){return db[_0xc0cb('0x62')][_0xc0cb('0x63')]({'where':{'id':_0x482f91[_0xc0cb('0x4c')]['id']},'attributes':['id',_0xc0cb('0x2b'),_0xc0cb('0x64'),_0xc0cb('0x65'),_0xc0cb('0x66')],'raw':!![]});}})[_0xc0cb('0x26')](function(_0x341474){if(_0x341474){var _0x1455b6=path[_0xc0cb('0x5e')](config['root'],_0xc0cb('0x67'),util[_0xc0cb('0x68')]('%s.%s',path[_0xc0cb('0x69')](_0x341474[_0xc0cb('0x64')],path['extname'](_0x341474[_0xc0cb('0x64')])),_0x341474[_0xc0cb('0x65')]));var _0x263901=path['join'](config[_0xc0cb('0x50')],_0xc0cb('0x51'),_0x2ccc01['name'],util['format'](_0xc0cb('0x6a'),_0x341474[_0xc0cb('0x2b')],_0x341474[_0xc0cb('0x65')]));fs['symlinkSync'](_0x1455b6,_0x263901);return _0x341474;}})['catch'](function(_0x9977a8){throw new db['Sequelize'][(_0xc0cb('0x60'))](_0x9977a8[_0xc0cb('0x6b')]);});})[_0xc0cb('0x26')](handleEntityNotFound(_0x28d50d,null))['then'](respondWithResult(_0x28d50d,0xc9))[_0xc0cb('0x48')](handleError(_0x28d50d,null));};exports[_0xc0cb('0x6c')]=function(_0x5e325c,_0x432f7e,_0x4de102){return db[_0xc0cb('0x59')][_0xc0cb('0x5a')](function(_0x104556){var _0x106df8;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5e325c[_0xc0cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x432f7e,null))['then'](function(_0x24306c){if(_0x24306c){_0x106df8=_0x24306c;return _0x24306c['removeSound'](_0x5e325c[_0xc0cb('0x4a')]['id2']);}})['then'](function(_0x5b38b6){if(_0x5b38b6){return db[_0xc0cb('0x62')][_0xc0cb('0x63')]({'where':{'id':_0x5e325c[_0xc0cb('0x4a')]['id2']},'attributes':['id',_0xc0cb('0x2b'),_0xc0cb('0x64'),_0xc0cb('0x65'),_0xc0cb('0x66')],'raw':!![]});}})['then'](function(_0x5326d0){if(_0x5326d0){fs[_0xc0cb('0x5d')](path['join'](_0x106df8[_0xc0cb('0x4f')],util[_0xc0cb('0x68')](_0xc0cb('0x6a'),_0x5326d0['name'],_0x5326d0[_0xc0cb('0x65')])));return _0x5326d0;}})[_0xc0cb('0x48')](function(_0x4d86f2){throw new db['Sequelize'][(_0xc0cb('0x60'))](_0x4d86f2['message']);});})[_0xc0cb('0x26')](handleEntityNotFound(_0x432f7e,null))['then'](respondWithStatusCode(_0x432f7e,0xcc))[_0xc0cb('0x48')](handleError(_0x432f7e,null));};exports['getSounds']=function(_0x2f93d3,_0x5ee4d4,_0x33b7d8){var _0x26fb23={};var _0x52b310={};var _0x357e31;var _0x199a87;return db['VoiceMusicOnHold'][_0xc0cb('0x63')]({'where':{'id':_0x2f93d3[_0xc0cb('0x4a')]['id']}})[_0xc0cb('0x26')](handleEntityNotFound(_0x5ee4d4,null))[_0xc0cb('0x26')](function(_0x3806fb){if(_0x3806fb){_0x357e31=_0x3806fb;_0x52b310[_0xc0cb('0x32')]=_['keys'](db[_0xc0cb('0x62')][_0xc0cb('0x6d')]);_0x52b310['query']=_['keys'](_0x2f93d3[_0xc0cb('0x33')]);_0x52b310[_0xc0cb('0x3e')]=_[_0xc0cb('0x35')](_0x52b310[_0xc0cb('0x32')],_0x52b310['query']);_0x26fb23[_0xc0cb('0x37')]=_[_0xc0cb('0x35')](_0x52b310[_0xc0cb('0x32')],qs[_0xc0cb('0x36')](_0x2f93d3[_0xc0cb('0x33')][_0xc0cb('0x36')]));_0x26fb23[_0xc0cb('0x37')]=_0x26fb23[_0xc0cb('0x37')][_0xc0cb('0x38')]?_0x26fb23[_0xc0cb('0x37')]:_0x52b310[_0xc0cb('0x32')];_0x26fb23[_0xc0cb('0x3b')]=qs[_0xc0cb('0x3c')](_0x2f93d3[_0xc0cb('0x33')]['sort']);_0x26fb23[_0xc0cb('0x3d')]=qs[_0xc0cb('0x3e')](_[_0xc0cb('0x3f')](_0x2f93d3[_0xc0cb('0x33')],_0x52b310[_0xc0cb('0x3e')]));if(_0x2f93d3['query'][_0xc0cb('0x40')]){_0x26fb23[_0xc0cb('0x3d')]=_[_0xc0cb('0x41')](_0x26fb23[_0xc0cb('0x3d')],{'$or':_['map'](_0x26fb23[_0xc0cb('0x37')],function(_0x2d4368){var _0x2d7a02={};_0x2d7a02[_0x2d4368]={'$like':'%'+_0x2f93d3[_0xc0cb('0x33')][_0xc0cb('0x40')]+'%'};return _0x2d7a02;})});}_0x26fb23=_['merge']({},_0x26fb23,_0x2f93d3['options']);return _0x357e31[_0xc0cb('0x6e')](_0x26fb23);}})[_0xc0cb('0x26')](function(_0x4a3166){if(_0x4a3166){_0x199a87=_0x4a3166[_0xc0cb('0x38')];if(!_0x2f93d3[_0xc0cb('0x33')]['hasOwnProperty'](_0xc0cb('0x3a'))){_0x26fb23[_0xc0cb('0x1e')]=qs[_0xc0cb('0x1e')](_0x2f93d3['query'][_0xc0cb('0x1e')]);_0x26fb23[_0xc0cb('0x20')]=qs['offset'](_0x2f93d3['query']['offset']);}return _0x357e31[_0xc0cb('0x6e')](_0x26fb23);}})[_0xc0cb('0x26')](function(_0xd6d7a5){if(_0xd6d7a5){return _0xd6d7a5?{'count':_0x199a87,'rows':_0xd6d7a5}:null;}})[_0xc0cb('0x26')](respondWithResult(_0x5ee4d4,null))['catch'](handleError(_0x5ee4d4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0e8dceb..424464d 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 _0x3b8e=['voice_musiconhold','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x1bf81c,_0x4a3ad2){var _0x4c531e=function(_0x2d8d65){while(--_0x2d8d65){_0x1bf81c['push'](_0x1bf81c['shift']());}};_0x4c531e(++_0x4a3ad2);}(_0x3b8e,0x10b));var _0xe3b8=function(_0x273e94,_0x2814d8){_0x273e94=_0x273e94-0x0;var _0x2adb36=_0x3b8e[_0x273e94];return _0x2adb36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b8('0x0'))('api');var moment=require(_0xe3b8('0x1'));var BPromise=require(_0xe3b8('0x2'));var rp=require(_0xe3b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3b8('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xe3b8('0x5')]=function(_0x4b0bf0,_0x540432){return _0x4b0bf0['define']('VoiceMusicOnHold',attributes,{'tableName':_0xe3b8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b13=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','VoiceMusicOnHold','lodash','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3b13,0xe4));var _0x33b1=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x3b13[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var logger=require(_0x33b1('0x2'))(_0x33b1('0x3'));var moment=require(_0x33b1('0x4'));var BPromise=require(_0x33b1('0x5'));var rp=require(_0x33b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33b1('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x1c05d5,_0x1babba){return _0x1c05d5[_0x33b1('0x8')](_0x33b1('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 54b4c27..490e153 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x42dbf6,_0x280468){var _0x10e43d=function(_0x3d12f4){while(--_0x3d12f4){_0x42dbf6['push'](_0x42dbf6['shift']());}};_0x10e43d(++_0x280468);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x192f4f,_0x2a078d){var _0x16d1f2=function(_0x800adc){while(--_0x800adc){_0x192f4f['push'](_0x192f4f['shift']());}};_0x16d1f2(++_0x2a078d);}(_0x70e0,0x17b));var _0x070e=function(_0x4d956c,_0x2fabb5){_0x4d956c=_0x4d956c-0x0;var _0x8c484c=_0x70e0[_0x4d956c];return _0x8c484c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3270774..4af9914 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 _0xd6bb=['show','getAgents','/:id/teams','post','create','/:id/users','addAgents','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xd6bb[_0xaf29da];return _0x295c51;};'use strict';var multer=require(_0xbd6b('0x0'));var util=require('util');var path=require(_0xbd6b('0x1'));var timeout=require(_0xbd6b('0x2'));var express=require(_0xbd6b('0x3'));var router=express[_0xbd6b('0x4')]();var fs_extra=require(_0xbd6b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbd6b('0x6'));var config=require(_0xbd6b('0x7'));var controller=require(_0xbd6b('0x8'));router['get']('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xa')]);router[_0xbd6b('0xb')](_0xbd6b('0xc'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xd')]);router[_0xbd6b('0xb')](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0xf')]);router[_0xbd6b('0xb')]('/:id/users',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x10')]);router['get'](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['getTeams']);router[_0xbd6b('0x12')]('/',auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x13')]);router[_0xbd6b('0x12')](_0xbd6b('0x14'),auth['isAuthenticated'](),controller[_0xbd6b('0x15')]);router[_0xbd6b('0x12')](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['addTeams']);router['put'](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller[_0xbd6b('0x16')]);router[_0xbd6b('0x17')](_0xbd6b('0xe'),auth[_0xbd6b('0x9')](),controller['destroy']);router[_0xbd6b('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router[_0xbd6b('0x17')](_0xbd6b('0x11'),auth[_0xbd6b('0x9')](),controller['removeTeams']);module[_0xbd6b('0x18')]=router; \ No newline at end of file +var _0x5294=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id/users','/:id/teams','getTeams','post','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','util'];(function(_0x4f2c54,_0x215e6c){var _0x35d53e=function(_0x1b0f9c){while(--_0x1b0f9c){_0x4f2c54['push'](_0x4f2c54['shift']());}};_0x35d53e(++_0x215e6c);}(_0x5294,0x111));var _0x4529=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5294[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var path=require(_0x4529('0x2'));var timeout=require(_0x4529('0x3'));var express=require(_0x4529('0x4'));var router=express[_0x4529('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4529('0x6'));var interaction=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var controller=require('./voicePrefix.controller');router[_0x4529('0x9')]('/',auth[_0x4529('0xa')](),controller[_0x4529('0xb')]);router[_0x4529('0x9')]('/describe',auth[_0x4529('0xa')](),controller[_0x4529('0xc')]);router[_0x4529('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4529('0x9')](_0x4529('0xd'),auth[_0x4529('0xa')](),controller['getAgents']);router[_0x4529('0x9')](_0x4529('0xe'),auth[_0x4529('0xa')](),controller[_0x4529('0xf')]);router[_0x4529('0x10')]('/',auth[_0x4529('0xa')](),controller['create']);router['post'](_0x4529('0xd'),auth[_0x4529('0xa')](),controller['addAgents']);router[_0x4529('0x10')]('/:id/teams',auth[_0x4529('0xa')](),controller[_0x4529('0x11')]);router[_0x4529('0x12')](_0x4529('0x13'),auth['isAuthenticated'](),controller[_0x4529('0x14')]);router[_0x4529('0x15')](_0x4529('0x13'),auth['isAuthenticated'](),controller[_0x4529('0x16')]);router[_0x4529('0x15')](_0x4529('0xd'),auth[_0x4529('0xa')](),controller['removeAgents']);router[_0x4529('0x15')](_0x4529('0xe'),auth['isAuthenticated'](),controller[_0x4529('0x17')]);module[_0x4529('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a41ad43..c738147 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 _0xb915=['STRING','VIRTUAL','system-','getDataValue','name','INTEGER','sequelize'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xb915,0xf4));var _0x5b91=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb915[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x5b91('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b91('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5b91('0x2')],'get':function(_0x149179){return _0x5b91('0x3')+this[_0x5b91('0x4')](_0x5b91('0x5'))+'-';}},'description':{'type':Sequelize[_0x5b91('0x1')]},'callerIdAll':{'type':Sequelize[_0x5b91('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5b91('0x6')]}}; \ No newline at end of file +var _0xd362=['getDataValue','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x3fbdcc,_0x20f5de){var _0x53cba8=function(_0x3de174){while(--_0x3de174){_0x3fbdcc['push'](_0x3fbdcc['shift']());}};_0x53cba8(++_0x20f5de);}(_0xd362,0x151));var _0x2d36=function(_0x2181e0,_0x165371){_0x2181e0=_0x2181e0-0x0;var _0x10137e=_0xd362[_0x2181e0];return _0x10137e;};'use strict';var Sequelize=require(_0x2d36('0x0'));module[_0x2d36('0x1')]={'name':{'type':Sequelize[_0x2d36('0x2')],'allowNull':![],'unique':_0x2d36('0x3')},'prefix':{'type':Sequelize[_0x2d36('0x4')],'get':function(_0x3415cc){return _0x2d36('0x5')+this[_0x2d36('0x6')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2d36('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f54ce8d..3b5ea3c 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x958a,0x128));var _0xa958=function(_0x519272,_0x22f519){_0x519272=_0x519272-0x0;var _0x32ee57=_0x958a[_0x519272];return _0x32ee57;};'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 _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x5f93f7,_0x36c026){var _0xfcebc4=function(_0x3205aa){while(--_0x3205aa){_0x5f93f7['push'](_0x5f93f7['shift']());}};_0xfcebc4(++_0x36c026);}(_0x7916,0x128));var _0x6791=function(_0x525d72,_0x35b601){_0x525d72=_0x525d72-0x0;var _0x455cf0=_0x7916[_0x525d72];return _0x455cf0;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e97fe00..5c31a6c 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 _0x2539=['emit','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x55a618,_0x9379b2){var _0x282149=function(_0x4bbf69){while(--_0x4bbf69){_0x55a618['push'](_0x55a618['shift']());}};_0x282149(++_0x9379b2);}(_0x2539,0x166));var _0x9253=function(_0x2ef52c,_0x4ff712){_0x2ef52c=_0x2ef52c-0x0;var _0x33b34f=_0x2539[_0x2ef52c];return _0x33b34f;};'use strict';var EventEmitter=require(_0x9253('0x0'));var VoicePrefix=require(_0x9253('0x1'))['db'][_0x9253('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9253('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9253('0x4'),'afterDestroy':_0x9253('0x5')};function emitEvent(_0x43a105){return function(_0x472842,_0x27862a,_0x11e071){VoicePrefixEvents[_0x9253('0x6')](_0x43a105+':'+_0x472842['id'],_0x472842);VoicePrefixEvents[_0x9253('0x6')](_0x43a105,_0x472842);_0x11e071(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x97ee=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x48895e,_0x37a982){var _0x1717cf=function(_0x178eaf){while(--_0x178eaf){_0x48895e['push'](_0x48895e['shift']());}};_0x1717cf(++_0x37a982);}(_0x97ee,0x1b5));var _0xe97e=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x97ee[_0x4c6d6f];return _0x2d4478;};'use strict';var EventEmitter=require(_0xe97e('0x0'));var VoicePrefix=require(_0xe97e('0x1'))['db'][_0xe97e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe97e('0x3')](0x0);var events={'afterCreate':_0xe97e('0x4'),'afterUpdate':_0xe97e('0x5'),'afterDestroy':_0xe97e('0x6')};function emitEvent(_0x3422f5){return function(_0x3ace94,_0x1ad28a,_0xef4e4){VoicePrefixEvents[_0xe97e('0x7')](_0x3422f5+':'+_0x3ace94['id'],_0x3ace94);VoicePrefixEvents[_0xe97e('0x7')](_0x3422f5,_0x3ace94);_0xef4e4(null);};}for(var e in events){if(events[_0xe97e('0x8')](e)){var event=events[e];VoicePrefix[_0xe97e('0x9')](e,emitEvent(event));}}module[_0xe97e('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1846e17..0f04d9b 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 _0x67be=['api','bluebird','request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3440aa,_0x5375d9){var _0x4de467=function(_0x126ef5){while(--_0x126ef5){_0x3440aa['push'](_0x3440aa['shift']());}};_0x4de467(++_0x5375d9);}(_0x67be,0x8d));var _0xe67b=function(_0x123ea3,_0x5cb1a6){_0x123ea3=_0x123ea3-0x0;var _0x5e741e=_0x67be[_0x123ea3];return _0x5e741e;};'use strict';var _=require(_0xe67b('0x0'));var util=require(_0xe67b('0x1'));var logger=require(_0xe67b('0x2'))(_0xe67b('0x3'));var moment=require('moment');var BPromise=require(_0xe67b('0x4'));var rp=require(_0xe67b('0x5'));var fs=require('fs');var path=require(_0xe67b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe67b('0x7'));module[_0xe67b('0x8')]=function(_0x212774,_0x5a9390){return _0x212774[_0xe67b('0x9')](_0xe67b('0xa'),attributes,{'tableName':_0xe67b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a9=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x53d37b,_0x3ed058){var _0x3f485e=function(_0x5eac6f){while(--_0x5eac6f){_0x53d37b['push'](_0x53d37b['shift']());}};_0x3f485e(++_0x3ed058);}(_0x97a9,0x79));var _0x997a=function(_0x248835,_0x54f7e5){_0x248835=_0x248835-0x0;var _0x200e95=_0x97a9[_0x248835];return _0x200e95;};'use strict';var _=require('lodash');var util=require(_0x997a('0x0'));var logger=require(_0x997a('0x1'))(_0x997a('0x2'));var moment=require(_0x997a('0x3'));var BPromise=require(_0x997a('0x4'));var rp=require(_0x997a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x997a('0x6'));var attributes=require(_0x997a('0x7'));module[_0x997a('0x8')]=function(_0x2f0bec,_0x325671){return _0x2f0bec[_0x997a('0x9')](_0x997a('0xa'),attributes,{'tableName':'voice_prefixes','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 3109ac5..b456cc7 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 _0xd26f=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x10fd77,_0x2a09da){var _0x14c34e=function(_0x559833){while(--_0x559833){_0x10fd77['push'](_0x10fd77['shift']());}};_0x14c34e(++_0x2a09da);}(_0xd26f,0x113));var _0xfd26=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xd26f[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});config[_0xfd26('0xb')]=_[_0xfd26('0xc')](config[_0xfd26('0xb')],{'host':_0xfd26('0xd'),'port':0x18eb});var socket=require(_0xfd26('0xe'))(new Redis(config[_0xfd26('0xb')]));require('./voicePrefix.socket')[_0xfd26('0xf')](socket);function respondWithRpcPromise(_0x3b74d7,_0x1e01bf,_0x43e9b3){return new BPromise(function(_0x13719f,_0x1aa684){return client['request'](_0x3b74d7,_0x43e9b3)[_0xfd26('0x10')](function(_0x5144d1){logger[_0xfd26('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1e01bf,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1e01bf,'request\x20sent',JSON[_0xfd26('0x12')](_0x5144d1));if(_0x5144d1[_0xfd26('0x13')]){if(_0x5144d1[_0xfd26('0x13')][_0xfd26('0x14')]===0x1f4){logger[_0xfd26('0x13')](_0xfd26('0x15'),_0x1e01bf,_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);return _0x1aa684(_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);}logger[_0xfd26('0x13')](_0xfd26('0x15'),_0x1e01bf,_0x5144d1[_0xfd26('0x13')][_0xfd26('0x16')]);return _0x13719f(_0x5144d1[_0xfd26('0x13')]['message']);}else{logger[_0xfd26('0x11')](_0xfd26('0x15'),_0x1e01bf,_0xfd26('0x17'));_0x13719f(_0x5144d1[_0xfd26('0x18')][_0xfd26('0x16')]);}})['catch'](function(_0x3a2725){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1e01bf,_0x3a2725);_0x1aa684(_0x3a2725);});});} \ No newline at end of file +var _0x0e56=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f7e8b,_0x7291d1){var _0x4eb892=function(_0x4ed54e){while(--_0x4ed54e){_0x3f7e8b['push'](_0x3f7e8b['shift']());}};_0x4eb892(++_0x7291d1);}(_0x0e56,0xf5));var _0x60e5=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0x0e56[_0x53eeac];return _0x41dddf;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});config[_0x60e5('0xb')]=_[_0x60e5('0xc')](config[_0x60e5('0xb')],{'host':_0x60e5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60e5('0xb')]));require(_0x60e5('0xe'))[_0x60e5('0xf')](socket);function respondWithRpcPromise(_0x2cebba,_0xcd22d5,_0x2b90dc){return new BPromise(function(_0x2336be,_0x6a1719){return client[_0x60e5('0x10')](_0x2cebba,_0x2b90dc)[_0x60e5('0x11')](function(_0x2a6cae){logger[_0x60e5('0x12')](_0x60e5('0x13'),_0xcd22d5,_0x60e5('0x14'));logger[_0x60e5('0x15')](_0x60e5('0x16'),_0xcd22d5,'request\x20sent',JSON[_0x60e5('0x17')](_0x2a6cae));if(_0x2a6cae['error']){if(_0x2a6cae['error'][_0x60e5('0x18')]===0x1f4){logger[_0x60e5('0x19')]('VoicePrefix,\x20%s,\x20%s',_0xcd22d5,_0x2a6cae[_0x60e5('0x19')][_0x60e5('0x1a')]);return _0x6a1719(_0x2a6cae[_0x60e5('0x19')][_0x60e5('0x1a')]);}logger['error'](_0x60e5('0x13'),_0xcd22d5,_0x2a6cae[_0x60e5('0x19')][_0x60e5('0x1a')]);return _0x2336be(_0x2a6cae[_0x60e5('0x19')][_0x60e5('0x1a')]);}else{logger[_0x60e5('0x12')](_0x60e5('0x13'),_0xcd22d5,_0x60e5('0x14'));_0x2336be(_0x2a6cae[_0x60e5('0x1b')]['message']);}})['catch'](function(_0x55038c){logger['error'](_0x60e5('0x13'),_0xcd22d5,_0x55038c);_0x6a1719(_0x55038c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c57c922..3f11072 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 _0x878f=['save','remove','update','emit','removeListener','register','length'];(function(_0xa14363,_0x5f52dd){var _0x2462bc=function(_0x28802a){while(--_0x28802a){_0xa14363['push'](_0xa14363['shift']());}};_0x2462bc(++_0x5f52dd);}(_0x878f,0x173));var _0xf878=function(_0x51230d,_0x4b618a){_0x51230d=_0x51230d-0x0;var _0xf9448e=_0x878f[_0x51230d];return _0xf9448e;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xf878('0x0'),_0xf878('0x1'),_0xf878('0x2')];function createListener(_0x12df2b,_0x1b3d0b){return function(_0x3d74cf){_0x1b3d0b[_0xf878('0x3')](_0x12df2b,_0x3d74cf);};}function removeListener(_0x45a37b,_0x240b48){return function(){VoicePrefixEvents[_0xf878('0x4')](_0x45a37b,_0x240b48);};}exports[_0xf878('0x5')]=function(_0x4bc9aa){for(var _0x4ac8d8=0x0,_0x3c5f5c=events[_0xf878('0x6')];_0x4ac8d8<_0x3c5f5c;_0x4ac8d8++){var _0x59e564=events[_0x4ac8d8];var _0x52851e=createListener('voicePrefix:'+_0x59e564,_0x4bc9aa);VoicePrefixEvents['on'](_0x59e564,_0x52851e);}}; \ No newline at end of file +var _0x26bc=['update','emit','removeListener','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x333615,_0x303515){var _0x348205=function(_0x201c16){while(--_0x201c16){_0x333615['push'](_0x333615['shift']());}};_0x348205(++_0x303515);}(_0x26bc,0x162));var _0xc26b=function(_0x3b3edb,_0x1ab826){_0x3b3edb=_0x3b3edb-0x0;var _0x2e0346=_0x26bc[_0x3b3edb];return _0x2e0346;};'use strict';var VoicePrefixEvents=require(_0xc26b('0x0'));var events=[_0xc26b('0x1'),_0xc26b('0x2'),_0xc26b('0x3')];function createListener(_0x115778,_0x4eda53){return function(_0x21c373){_0x4eda53[_0xc26b('0x4')](_0x115778,_0x21c373);};}function removeListener(_0x381ceb,_0x4d8d28){return function(){VoicePrefixEvents[_0xc26b('0x5')](_0x381ceb,_0x4d8d28);};}exports['register']=function(_0x299ad8){for(var _0x212243=0x0,_0x13d90e=events['length'];_0x212243<_0x13d90e;_0x212243++){var _0x11c6f5=events[_0x212243];var _0x453491=createListener(_0xc26b('0x6')+_0x11c6f5,_0x299ad8);VoicePrefixEvents['on'](_0x11c6f5,_0x453491);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 365268b..1620ab4 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(_0x1da827,_0x37b758){var _0x13cd71=function(_0x285b3e){while(--_0x285b3e){_0x1da827['push'](_0x1da827['shift']());}};_0x13cd71(++_0x37b758);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x3f655d,_0x5783fd){var _0x4acdbf=function(_0x1a6caa){while(--_0x1a6caa){_0x3f655d['push'](_0x3f655d['shift']());}};_0x4acdbf(++_0x5783fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 c226586..1e13470 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 _0x17ba=['includes','setDataValue','INTEGER','yes','once','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','progressive','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','linear','strategy','rrmemory','getDataValue','type','dialMethod','preview','roundrobin'];(function(_0x27bcf5,_0x236765){var _0x4ce4cf=function(_0x4864ea){while(--_0x4864ea){_0x27bcf5['push'](_0x27bcf5['shift']());}};_0x4ce4cf(++_0x236765);}(_0x17ba,0xd6));var _0xa17b=function(_0xa3ba6e,_0x322e2a){_0xa3ba6e=_0xa3ba6e-0x0;var _0x88c2fc=_0x17ba[_0xa3ba6e];return _0x88c2fc;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa17b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x4'),_0xa17b('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':_0xa17b('0x7')},'announce':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa17b('0x3')]('rr',_0xa17b('0x8'),_0xa17b('0x9'),_0xa17b('0xa'),_0xa17b('0xb'),'rrmemory',_0xa17b('0xc'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0xa17b('0x8'),'set':function(_0x27b6ec){this['setDataValue'](_0xa17b('0xd'),_0x27b6ec?_0x27b6ec:_0xa17b('0xe'));},'get':function(){var _0x176560=this[_0xa17b('0xf')](_0xa17b('0x10'));var _0x33547d=this[_0xa17b('0xf')](_0xa17b('0x11'));var _0x5c55cf=this[_0xa17b('0xf')](_0xa17b('0xd'));if(_0x176560===_0xa17b('0x5')){if(_0x33547d===_0xa17b('0x12')){return null;}if(_0x33547d==='booked'&&![_0xa17b('0xe'),_0xa17b('0x13')][_0xa17b('0x14')](_0x5c55cf)){this[_0xa17b('0x15')](_0xa17b('0xd'),_0xa17b('0xe'));}}return _0x5c55cf;}},'servicelevel':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa17b('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa17b('0x6')]},'weight':{'type':Sequelize[_0xa17b('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa17b('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa17b('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa17b('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa17b('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xa17b('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa17b('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no',_0xa17b('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa17b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa17b('0x6')]},'queue_youarenext':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa17b('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa17b('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xa17b('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x447a2e){this[_0xa17b('0x15')](_0xa17b('0x19'),_0x447a2e?_0x447a2e[_0xa17b('0x1a')](','):[]);},'get':function(){return this[_0xa17b('0xf')](_0xa17b('0x19'))?this[_0xa17b('0xf')]('periodic_announce')[_0xa17b('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x17'),'set':function(_0x48a2df){this[_0xa17b('0x15')](_0xa17b('0x1c'),_0x48a2df?_0x48a2df[_0xa17b('0x1a')](','):undefined);},'get':function(){return this[_0xa17b('0xf')](_0xa17b('0x1c'))?this['getDataValue']('joinempty')[_0xa17b('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x336f6d){this[_0xa17b('0x15')](_0xa17b('0x1d'),_0x336f6d?_0x336f6d[_0xa17b('0x1a')](','):undefined);},'get':function(){return this[_0xa17b('0xf')]('leavewhenempty')?this[_0xa17b('0xf')](_0xa17b('0x1d'))[_0xa17b('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa17b('0x6')]},'description':{'type':Sequelize[_0xa17b('0x6')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3cada1){this['setDataValue']('acw',_0x3cada1);if(_0x3cada1){if(this[_0xa17b('0xf')]('wrapuptime')<0x2){this[_0xa17b('0x15')](_0xa17b('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x12'),_0xa17b('0x1f'),'power',_0xa17b('0x20'),_0xa17b('0x21')),'defaultValue':_0xa17b('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xa17b('0x16')](0x4)[_0xa17b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa17b('0x23')},'dialLimitQueue':{'type':Sequelize[_0xa17b('0x16')](0x4)[_0xa17b('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa17b('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xa17b('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa17b('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xa17b('0x3')]('agentBusyFactor',_0xa17b('0x26')),'defaultValue':_0xa17b('0x26'),'comment':_0xa17b('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa17b('0x28')](0x2)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa17b('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xa17b('0x6')],'defaultValue':_0xa17b('0x2b'),'comment':_0xa17b('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2d')},'dialQueueProject':{'type':Sequelize[_0xa17b('0x6')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'comment':_0xa17b('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa17b('0x31')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x32')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x33'),_0xa17b('0x34'),'onlyIfOpen'),'defaultValue':_0xa17b('0x33')},'dialAMDActive':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':0x0,'comment':_0xa17b('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa17b('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xa17b('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa17b('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa17b('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa17b('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa17b('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa17b('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa17b('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa17b('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa17b('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa17b('0x16')](0x9)[_0xa17b('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa17b('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa17b('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':0x0,'comment':_0xa17b('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa17b('0x3')]('DESC',_0xa17b('0x41')),'defaultValue':_0xa17b('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xa17b('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa17b('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa17b('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa17b('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa17b('0x16')](0x5)[_0xa17b('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0x16')],'allowNull':!![],'comment':_0xa17b('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![],'comment':_0xa17b('0x4b'),'set':function(_0x16cec4){if(!_0x16cec4)this[_0xa17b('0x15')](_0xa17b('0x4c'),null);this[_0xa17b('0x15')](_0xa17b('0x4d'),_0x16cec4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa17b('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa17b('0x16')](0x3)[_0xa17b('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa17b('0x35')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3e0=['name','outbound','inbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','preview','booked','roundrobin','INTEGER','ENUM','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','power','predictive','progressive','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x35232d,_0x199b56){var _0x340579=function(_0x320fde){while(--_0x320fde){_0x35232d['push'](_0x35232d['shift']());}};_0x340579(++_0x199b56);}(_0xf3e0,0x1d7));var _0x0f3e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf3e0[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x0f3e('0x0'));module[_0x0f3e('0x1')]={'name':{'type':Sequelize[_0x0f3e('0x2')],'allowNull':![],'unique':_0x0f3e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x0f3e('0x4')),'allowNull':![],'defaultValue':_0x0f3e('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x0f3e('0x6')},'announce':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x0f3e('0x7'),_0x0f3e('0x8'),'fewestcalls',_0x0f3e('0x9'),_0x0f3e('0xa'),_0x0f3e('0xb'),_0x0f3e('0xc'),_0x0f3e('0xd')),'allowNull':![],'defaultValue':_0x0f3e('0x7'),'set':function(_0x36990e){this[_0x0f3e('0xe')](_0x0f3e('0xf'),_0x36990e?_0x36990e:'rrmemory');},'get':function(){var _0x558517=this['getDataValue'](_0x0f3e('0x10'));var _0x560fdc=this[_0x0f3e('0x11')](_0x0f3e('0x12'));var _0x42b48d=this[_0x0f3e('0x11')](_0x0f3e('0xf'));if(_0x558517===_0x0f3e('0x4')){if(_0x560fdc===_0x0f3e('0x13')){return null;}if(_0x560fdc===_0x0f3e('0x14')&&![_0x0f3e('0xa'),_0x0f3e('0x15')]['includes'](_0x42b48d)){this[_0x0f3e('0xe')](_0x0f3e('0xf'),_0x0f3e('0xa'));}}return _0x42b48d;}},'servicelevel':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0f3e('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x0f3e('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x0f3e('0x18'),'no',_0x0f3e('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0f3e('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0f3e('0x17')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0f3e('0x17')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0f3e('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0f3e('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no',_0x0f3e('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x0f3e('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0f3e('0x17')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0f3e('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0f3e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x0f3e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0f3e('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x0f3e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0f3e('0x1b')],'set':function(_0x11213c){this[_0x0f3e('0xe')](_0x0f3e('0x1c'),_0x11213c?_0x11213c['join'](','):[]);},'get':function(){return this[_0x0f3e('0x11')](_0x0f3e('0x1c'))?this[_0x0f3e('0x11')]('periodic_announce')[_0x0f3e('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':_0x0f3e('0x18'),'set':function(_0x4ea0a9){this[_0x0f3e('0xe')](_0x0f3e('0x1e'),_0x4ea0a9?_0x4ea0a9[_0x0f3e('0x1f')](','):undefined);},'get':function(){return this[_0x0f3e('0x11')](_0x0f3e('0x1e'))?this[_0x0f3e('0x11')](_0x0f3e('0x1e'))[_0x0f3e('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':'no','set':function(_0x24d990){this['setDataValue'](_0x0f3e('0x20'),_0x24d990?_0x24d990[_0x0f3e('0x1f')](','):undefined);},'get':function(){return this['getDataValue'](_0x0f3e('0x20'))?this[_0x0f3e('0x11')]('leavewhenempty')[_0x0f3e('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f3e('0x2')]},'acw':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':0x0,'set':function(_0x4d8777){this[_0x0f3e('0xe')](_0x0f3e('0x22'),_0x4d8777);if(_0x4d8777){if(this[_0x0f3e('0x11')]('wrapuptime')<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0f3e('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':0x0,'comment':_0x0f3e('0x23')},'dialMethod':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x13'),'progressive',_0x0f3e('0x24'),_0x0f3e('0x25'),_0x0f3e('0x14')),'defaultValue':_0x0f3e('0x26'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x0f3e('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0f3e('0x27')},'dialLimitQueue':{'type':Sequelize[_0x0f3e('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0f3e('0x28')},'dialPowerLevel':{'type':Sequelize[_0x0f3e('0x29')](0x2)[_0x0f3e('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x0f3e('0x17')]('agentBusyFactor',_0x0f3e('0x2b')),'defaultValue':_0x0f3e('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0f3e('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0f3e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0f3e('0x2e'),'comment':_0x0f3e('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x0f3e('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'comment':_0x0f3e('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0f3e('0x36')},'dialTimezone':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x0f3e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0f3e('0x37'),_0x0f3e('0x38'),'onlyIfOpen'),'defaultValue':_0x0f3e('0x37')},'dialAMDActive':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0f3e('0x16')](0x9)[_0x0f3e('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0f3e('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x0f3e('0x16')](0x9)[_0x0f3e('0x2a')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0f3e('0x16')](0x9)[_0x0f3e('0x2a')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0f3e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0f3e('0x16')](0x9)[_0x0f3e('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0f3e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0f3e('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0f3e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0f3e('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0f3e('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0f3e('0x16')](0x9)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0f3e('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0f3e('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0f3e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0f3e('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0f3e('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0f3e('0x17')](_0x0f3e('0x41'),_0x0f3e('0x42')),'defaultValue':_0x0f3e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0f3e('0x2')],'comment':_0x0f3e('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0f3e('0x16')](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0f3e('0x16')](0x3)[_0x0f3e('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3e('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f3e('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3e('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x0f3e('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':![],'comment':_0x0f3e('0x4d'),'set':function(_0x2aa102){if(!_0x2aa102)this[_0x0f3e('0xe')](_0x0f3e('0x4e'),null);this[_0x0f3e('0xe')]('mandatoryDisposition',_0x2aa102);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0f3e('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0f3e('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0f3e('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 173288a..174aa13 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 _0x49e5=['create','body','get','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','length','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','interface','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','field','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','every','TeamId','includes','all','union','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isNil','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','insert','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','type','find','name','UserProfileResource','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0xd5fbdb,_0x592fcc){var _0x44166a=function(_0x1e3de0){while(--_0x1e3de0){_0xd5fbdb['push'](_0xd5fbdb['shift']());}};_0x44166a(++_0x592fcc);}(_0x49e5,0x71));var _0x549e=function(_0x50a9de,_0xa5cc8e){_0x50a9de=_0x50a9de-0x0;var _0x4d6259=_0x49e5[_0x50a9de];return _0x4d6259;};'use strict';var emlformat=require(_0x549e('0x0'));var rimraf=require(_0x549e('0x1'));var zipdir=require(_0x549e('0x2'));var jsonpatch=require(_0x549e('0x3'));var rp=require(_0x549e('0x4'));var moment=require('moment');var BPromise=require(_0x549e('0x5'));var Mustache=require(_0x549e('0x6'));var util=require(_0x549e('0x7'));var path=require(_0x549e('0x8'));var sox=require(_0x549e('0x9'));var csv=require('to-csv');var ejs=require(_0x549e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x549e('0xb'));var crypto=require(_0x549e('0xc'));var jsforce=require(_0x549e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x549e('0xe'));var Redis=require(_0x549e('0xf'));var authService=require(_0x549e('0x10'));var qs=require(_0x549e('0x11'));var as=require(_0x549e('0x12'));var hardwareService=require(_0x549e('0x13'));var logger=require('../../config/logger')(_0x549e('0x14'));var utils=require('../../config/utils');var config=require(_0x549e('0x15'));var licenseUtil=require(_0x549e('0x16'));var db=require(_0x549e('0x17'))['db'];config['redis']=_[_0x549e('0x18')](config[_0x549e('0x19')],{'host':_0x549e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x549e('0x19')]));require(_0x549e('0x1b'))[_0x549e('0x1c')](socket);function respondWithStatusCode(_0x2b7310,_0x1b06d7){_0x1b06d7=_0x1b06d7||0xcc;return function(_0xea1957){if(_0xea1957){return _0x2b7310[_0x549e('0x1d')](_0x1b06d7);}return _0x2b7310[_0x549e('0x1e')](_0x1b06d7)[_0x549e('0x1f')]();};}function respondWithResult(_0x3636f9,_0x240e70){_0x240e70=_0x240e70||0xc8;return function(_0x207fe0){if(_0x207fe0){return _0x3636f9[_0x549e('0x1e')](_0x240e70)[_0x549e('0x20')](_0x207fe0);}};}function respondWithFilteredResult(_0x347f67,_0x48c662){return function(_0x294cb3){if(_0x294cb3){var _0x233a69=typeof _0x48c662['offset']===_0x549e('0x21')&&typeof _0x48c662[_0x549e('0x22')]===_0x549e('0x21');var _0xe8fa08=_0x294cb3[_0x549e('0x23')];var _0x10cdbe=_0x233a69?0x0:_0x48c662[_0x549e('0x24')];var _0x3dd01a=_0x233a69?_0x294cb3[_0x549e('0x23')]:_0x48c662[_0x549e('0x24')]+_0x48c662[_0x549e('0x22')];var _0x20378b;if(_0x3dd01a>=_0xe8fa08){_0x3dd01a=_0xe8fa08;_0x20378b=0xc8;}else{_0x20378b=0xce;}_0x347f67[_0x549e('0x1e')](_0x20378b);return _0x347f67['set']('Content-Range',_0x10cdbe+'-'+_0x3dd01a+'/'+_0xe8fa08)['json'](_0x294cb3);}return null;};}function patchUpdates(_0x393eb0){return function(_0x22ef6f){try{jsonpatch[_0x549e('0x25')](_0x22ef6f,_0x393eb0,!![]);}catch(_0x5e152a){return BPromise['reject'](_0x5e152a);}return _0x22ef6f[_0x549e('0x26')]();};}function saveUpdates(_0x58c4f2,_0x138ac4){return function(_0x3f06e2){if(_0x3f06e2){return _0x3f06e2[_0x549e('0x27')](_0x58c4f2)[_0x549e('0x28')](function(_0xabf2dc){return _0xabf2dc;});}return null;};}function removeEntity(_0x4adba5,_0x48e480){return function(_0x2cd6a3){if(_0x2cd6a3){return _0x2cd6a3[_0x549e('0x29')]()[_0x549e('0x28')](function(){var _0x425f53=_0x2cd6a3['get']({'plain':!![]});var _0x4d54a3=[{'name':_0x549e('0x2a'),'value':_0x549e('0x2b'),'ignore':![]},{'name':_0x549e('0x2c'),'value':_0x549e('0x2d'),'ignore':![]}];var _0x2c2064=_(_0x4d54a3)['filter'](_0x549e('0x2e'))[_0x549e('0x2f')](_0x549e('0x30'))['value']();if(_['includes'](_0x2c2064,_0x425f53[_0x549e('0x31')])){return;}var _0x1921e3=_[_0x549e('0x32')](_0x4d54a3,[_0x549e('0x30'),_0x425f53[_0x549e('0x31')]])[_0x549e('0x33')];return db[_0x549e('0x34')][_0x549e('0x29')]({'where':{'type':_0x1921e3,'resourceId':_0x425f53['id']}})[_0x549e('0x28')](function(){return _0x2cd6a3;});})[_0x549e('0x28')](function(){_0x4adba5['status'](0xcc)[_0x549e('0x1f')]();});}};}function handleEntityNotFound(_0x3492d5,_0x18f077){return function(_0x163a6b){if(!_0x163a6b){_0x3492d5[_0x549e('0x1d')](0x194);}return _0x163a6b;};}function handleError(_0x1e29d8,_0x5dd388){_0x5dd388=_0x5dd388||0x1f4;return function(_0xac391e){logger['error'](_0xac391e['stack']);if(_0xac391e[_0x549e('0x33')]){delete _0xac391e[_0x549e('0x33')];}_0x1e29d8[_0x549e('0x1e')](_0x5dd388)['send'](_0xac391e);};}exports[_0x549e('0x35')]=function(_0x6435d7,_0x310f55){var _0x228036={},_0x1007a1={},_0x5bd5e5={'count':0x0,'rows':[]};var _0x18740d=_[_0x549e('0x2f')](db[_0x549e('0x36')][_0x549e('0x37')],function(_0x5a49af){return{'name':_0x5a49af[_0x549e('0x38')],'type':_0x5a49af[_0x549e('0x31')]['key']};});_0x1007a1[_0x549e('0x39')]=_[_0x549e('0x2f')](_0x18740d,_0x549e('0x33'));_0x1007a1[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x6435d7[_0x549e('0x3a')]);_0x1007a1[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x1007a1['model'],_0x1007a1[_0x549e('0x3a')]);_0x228036[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x1007a1['model'],qs[_0x549e('0x3f')](_0x6435d7[_0x549e('0x3a')][_0x549e('0x3f')]));_0x228036['attributes']=_0x228036[_0x549e('0x3e')]['length']?_0x228036[_0x549e('0x3e')]:_0x1007a1[_0x549e('0x39')];if(!_0x6435d7[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x228036[_0x549e('0x22')]=qs['limit'](_0x6435d7[_0x549e('0x3a')][_0x549e('0x22')]);_0x228036['offset']=qs[_0x549e('0x24')](_0x6435d7['query'][_0x549e('0x24')]);}_0x228036['order']=qs[_0x549e('0x42')](_0x6435d7['query']['sort']);_0x228036['where']=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x6435d7['query'],_0x1007a1[_0x549e('0x3c')]),_0x18740d);if(_0x6435d7[_0x549e('0x3a')][_0x549e('0x44')]){_0x228036['where']=_['merge'](_0x228036[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0x18740d,function(_0xef7c1a){if(_0xef7c1a[_0x549e('0x31')]!==_0x549e('0x46')){var _0x55bd5e={};_0x55bd5e[_0xef7c1a[_0x549e('0x33')]]={'$like':'%'+_0x6435d7['query'][_0x549e('0x44')]+'%'};return _0x55bd5e;}})});}_0x228036=_[_0x549e('0x47')]({},_0x228036,_0x6435d7[_0x549e('0x48')]);var _0x123864={'where':_0x228036['where']};return db[_0x549e('0x36')]['count'](_0x123864)[_0x549e('0x28')](function(_0x20b523){_0x5bd5e5[_0x549e('0x23')]=_0x20b523;if(_0x6435d7[_0x549e('0x3a')][_0x549e('0x49')]){_0x228036[_0x549e('0x4a')]=[{'all':!![]}];}return db[_0x549e('0x36')][_0x549e('0x4b')](_0x228036);})['then'](function(_0x9b64ef){_0x5bd5e5[_0x549e('0x4c')]=_0x9b64ef;return _0x5bd5e5;})[_0x549e('0x28')](respondWithFilteredResult(_0x310f55,_0x228036))[_0x549e('0x4d')](handleError(_0x310f55,null));};exports[_0x549e('0x4e')]=function(_0x330dc0,_0x1c8d47){var _0x141333={'raw':![],'where':{'id':_0x330dc0['params']['id']}},_0xea952f={};_0xea952f[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x36')][_0x549e('0x37')]);_0xea952f['query']=_[_0x549e('0x3b')](_0x330dc0['query']);_0xea952f['filters']=_[_0x549e('0x3d')](_0xea952f[_0x549e('0x39')],_0xea952f[_0x549e('0x3a')]);_0x141333['attributes']=_[_0x549e('0x3d')](_0xea952f[_0x549e('0x39')],qs['fields'](_0x330dc0[_0x549e('0x3a')]['fields']));_0x141333[_0x549e('0x3e')]=_0x141333[_0x549e('0x3e')]['length']?_0x141333[_0x549e('0x3e')]:_0xea952f['model'];if(_0x330dc0['query']['includeAll']){_0x141333[_0x549e('0x4a')]=[{'all':!![]}];}_0x141333=_[_0x549e('0x47')]({},_0x141333,_0x330dc0[_0x549e('0x48')]);return db[_0x549e('0x36')][_0x549e('0x32')](_0x141333)[_0x549e('0x28')](handleEntityNotFound(_0x1c8d47,null))[_0x549e('0x28')](respondWithResult(_0x1c8d47,null))[_0x549e('0x4d')](handleError(_0x1c8d47,null));};exports[_0x549e('0x4f')]=function(_0x2f0036,_0x1c7431){return db[_0x549e('0x36')]['create'](_0x2f0036[_0x549e('0x50')],{})[_0x549e('0x28')](function(_0x27dcf6){var _0xe403b2=_0x2f0036['user'][_0x549e('0x51')]({'plain':!![]});if(!_0xe403b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe403b2['role']===_0x549e('0x52')){var _0x32b253=_0x27dcf6[_0x549e('0x51')]({'plain':!![]});var _0x2e4032=[{'name':'VoiceQueues','value':_0x549e('0x2b')},{'name':'QueueCampaigns','value':_0x549e('0x2d')}];var _0x15ec63=_[_0x549e('0x32')](_0x2e4032,[_0x549e('0x30'),_0x32b253[_0x549e('0x31')]])[_0x549e('0x33')];return db[_0x549e('0x53')][_0x549e('0x32')]({'where':{'name':_0x15ec63,'userProfileId':_0xe403b2[_0x549e('0x54')]},'raw':!![]})['then'](function(_0x320994){if(_0x320994&&_0x320994[_0x549e('0x55')]===0x0){return db[_0x549e('0x34')][_0x549e('0x4f')]({'name':_0x32b253[_0x549e('0x33')],'resourceId':_0x32b253['id'],'type':_0x320994[_0x549e('0x33')],'sectionId':_0x320994['id']},{})[_0x549e('0x28')](function(){return _0x27dcf6;});}else{return _0x27dcf6;}})[_0x549e('0x4d')](function(_0x46a131){logger['error'](_0x549e('0x56'),_0x46a131);throw _0x46a131;});}return _0x27dcf6;})[_0x549e('0x28')](respondWithResult(_0x1c7431,0xc9))[_0x549e('0x4d')](handleError(_0x1c7431,null));};exports[_0x549e('0x57')]=function(_0x18edb0,_0x56950f){var _0x22ad7f={'where':{'id':_0x18edb0[_0x549e('0x58')]['id']}},_0x2d7bf8={};_0x2d7bf8[_0x549e('0x39')]=_['keys'](db['VoiceQueue'][_0x549e('0x37')]);_0x22ad7f[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x2d7bf8['model'],qs[_0x549e('0x3f')](_0x18edb0[_0x549e('0x3a')][_0x549e('0x3f')]));_0x22ad7f[_0x549e('0x3e')]=_0x22ad7f[_0x549e('0x3e')][_0x549e('0x59')]?_0x22ad7f[_0x549e('0x3e')]:_0x2d7bf8[_0x549e('0x39')];if(_0x18edb0[_0x549e('0x3a')]['includeAll']){_0x22ad7f[_0x549e('0x4a')]=[{'all':!![]}];}_0x22ad7f=_[_0x549e('0x47')]({},_0x22ad7f,_0x18edb0[_0x549e('0x48')]);return db[_0x549e('0x36')][_0x549e('0x32')](_0x22ad7f)[_0x549e('0x28')](handleEntityNotFound(_0x56950f,null))[_0x549e('0x28')](function(_0x41c258){if(_0x41c258){var _0x3dbb32=_0x41c258[_0x549e('0x51')]({'plain':!![]});_0x3dbb32=qs[_0x549e('0x5a')](_0x3dbb32,['id',_0x549e('0x5b'),_0x549e('0x5c')]);_0x18edb0[_0x549e('0x50')]=_[_0x549e('0x5a')](_0x18edb0[_0x549e('0x50')],['id',_0x549e('0x5b'),_0x549e('0x5c')]);return db['VoiceQueue'][_0x549e('0x4f')](_[_0x549e('0x47')](_0x3dbb32,_0x18edb0[_0x549e('0x50')]),{'include':_0x18edb0[_0x549e('0x3a')][_0x549e('0x49')]?[{'all':!![]}]:undefined})[_0x549e('0x28')](function(_0x36e2e1){var _0x298d89=_0x18edb0['user']['get']({'plain':!![]});if(!_0x298d89)throw new Error(_0x549e('0x5d'));if(_0x298d89[_0x549e('0x5e')]==='user'){var _0x5025de=_0x36e2e1['get']({'plain':!![]});var _0x47ce57=[{'name':_0x549e('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x549e('0x2d')}];var _0x2440de=_[_0x549e('0x32')](_0x47ce57,[_0x549e('0x30'),_0x5025de[_0x549e('0x31')]])[_0x549e('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x2440de,'userProfileId':_0x298d89[_0x549e('0x54')]},'raw':!![]})[_0x549e('0x28')](function(_0x1e1e7f){if(_0x1e1e7f&&_0x1e1e7f['autoAssociation']===0x0){return db[_0x549e('0x34')][_0x549e('0x4f')]({'name':_0x5025de[_0x549e('0x33')],'resourceId':_0x5025de['id'],'type':_0x1e1e7f['name'],'sectionId':_0x1e1e7f['id']},{})[_0x549e('0x28')](function(){return _0x36e2e1;});}else{return _0x36e2e1;}})[_0x549e('0x4d')](function(_0x256c8a){logger[_0x549e('0x5f')](_0x549e('0x56'),_0x256c8a);throw _0x256c8a;});}return _0x36e2e1;});}})['then'](respondWithResult(_0x56950f,0xc9))[_0x549e('0x4d')](handleError(_0x56950f,null));};exports['update']=function(_0x17cb76,_0x3ce722){if(_0x17cb76['body']['id']){delete _0x17cb76[_0x549e('0x50')]['id'];}return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x17cb76[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x3ce722,null))[_0x549e('0x28')](saveUpdates(_0x17cb76['body'],null))[_0x549e('0x28')](respondWithResult(_0x3ce722,null))[_0x549e('0x4d')](handleError(_0x3ce722,null));};exports['destroy']=function(_0x44166f,_0x2b801e){return db['VoiceQueue'][_0x549e('0x32')]({'where':{'id':_0x44166f[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x2b801e,null))[_0x549e('0x28')](removeEntity(_0x2b801e,null))[_0x549e('0x4d')](handleError(_0x2b801e,null));};exports['getHoppers']=function(_0x3da5ef,_0x426652,_0x392fe5){var _0x893916={'raw':![],'where':{}};var _0x42f17f={};var _0x256430={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x3da5ef['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x426652,null))[_0x549e('0x28')](function(_0x3dcffa){if(_0x3dcffa){_0x42f17f[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x61')][_0x549e('0x37')]);_0x42f17f[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x3da5ef[_0x549e('0x3a')]);_0x42f17f[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x42f17f[_0x549e('0x39')],_0x42f17f[_0x549e('0x3a')]);_0x893916[_0x549e('0x3e')]=_['intersection'](_0x42f17f[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x3da5ef[_0x549e('0x3a')]['fields']));_0x893916['attributes']=_0x893916[_0x549e('0x3e')][_0x549e('0x59')]?_0x893916[_0x549e('0x3e')]:_0x42f17f[_0x549e('0x39')];if(!_0x3da5ef[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x893916[_0x549e('0x22')]=qs['limit'](_0x3da5ef['query'][_0x549e('0x22')]);_0x893916[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x3da5ef[_0x549e('0x3a')][_0x549e('0x24')]);}_0x893916['order']=qs[_0x549e('0x42')](_0x3da5ef[_0x549e('0x3a')][_0x549e('0x42')]);_0x893916[_0x549e('0x45')]=qs['filters'](_[_0x549e('0x43')](_0x3da5ef[_0x549e('0x3a')],_0x42f17f[_0x549e('0x3c')]));_0x893916[_0x549e('0x45')][_0x549e('0x62')]=_0x3dcffa['id'];if(_0x3da5ef['query']['filter']){_0x893916['where']=_[_0x549e('0x47')](_0x893916['where'],{'$or':_['map'](_0x893916['attributes'],function(_0x52d6f2){var _0x46559d={};_0x46559d[_0x52d6f2]={'$like':'%'+_0x3da5ef['query']['filter']+'%'};return _0x46559d;})});}_0x893916=_[_0x549e('0x47')]({},_0x893916,_0x3da5ef[_0x549e('0x48')]);return db[_0x549e('0x61')][_0x549e('0x23')]({'where':_0x893916[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x37dfb1){_0x256430[_0x549e('0x23')]=_0x37dfb1;if(_0x3da5ef['query'][_0x549e('0x49')]){_0x893916['include']=[{'all':!![]}];}return db[_0x549e('0x61')][_0x549e('0x4b')](_0x893916);})[_0x549e('0x28')](function(_0x18da4f){_0x256430[_0x549e('0x4c')]=_0x18da4f;return _0x256430;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x426652,_0x893916))[_0x549e('0x4d')](handleError(_0x426652,null));};exports[_0x549e('0x63')]=function(_0x4de3ad,_0xaa132f,_0x32c62e){var _0x1dfe3d={'raw':!![],'where':{}};var _0x1f266a={};var _0x550182={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x4de3ad['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0xaa132f,null))[_0x549e('0x28')](function(_0x177627){if(_0x177627){_0x1f266a[_0x549e('0x39')]=_['keys'](db[_0x549e('0x64')][_0x549e('0x37')]);_0x1f266a[_0x549e('0x3a')]=_['keys'](_0x4de3ad[_0x549e('0x3a')]);_0x1f266a[_0x549e('0x3c')]=_['intersection'](_0x1f266a[_0x549e('0x39')],_0x1f266a[_0x549e('0x3a')]);_0x1dfe3d[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x1f266a[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x3f')]));_0x1dfe3d[_0x549e('0x3e')]=_0x1dfe3d[_0x549e('0x3e')][_0x549e('0x59')]?_0x1dfe3d['attributes']:_0x1f266a[_0x549e('0x39')];if(!_0x4de3ad['query'][_0x549e('0x40')]('nolimit')){_0x1dfe3d[_0x549e('0x22')]=qs['limit'](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x22')]);_0x1dfe3d['offset']=qs[_0x549e('0x24')](_0x4de3ad[_0x549e('0x3a')][_0x549e('0x24')]);}_0x1dfe3d[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x4de3ad['query'][_0x549e('0x42')]);_0x1dfe3d[_0x549e('0x45')]=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x4de3ad[_0x549e('0x3a')],_0x1f266a['filters']));_0x1dfe3d[_0x549e('0x45')][_0x549e('0x62')]=_0x177627['id'];if(_0x4de3ad[_0x549e('0x3a')][_0x549e('0x44')]){_0x1dfe3d['where']=_['merge'](_0x1dfe3d['where'],{'$or':_['map'](_0x1dfe3d[_0x549e('0x3e')],function(_0x55c686){var _0x391244={};_0x391244[_0x55c686]={'$like':'%'+_0x4de3ad[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x391244;})});}_0x1dfe3d=_[_0x549e('0x47')]({},_0x1dfe3d,_0x4de3ad[_0x549e('0x48')]);return db[_0x549e('0x64')][_0x549e('0x23')]({'where':_0x1dfe3d[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x1c9104){_0x550182[_0x549e('0x23')]=_0x1c9104;if(_0x4de3ad[_0x549e('0x3a')][_0x549e('0x49')]){_0x1dfe3d[_0x549e('0x4a')]=[{'all':!![]}];}return db[_0x549e('0x64')][_0x549e('0x4b')](_0x1dfe3d);})[_0x549e('0x28')](function(_0x477e23){_0x550182[_0x549e('0x4c')]=_0x477e23;return _0x550182;});}})['then'](respondWithFilteredResult(_0xaa132f,_0x1dfe3d))[_0x549e('0x4d')](handleError(_0xaa132f,null));};exports[_0x549e('0x66')]=function(_0x54c12c,_0x101e50,_0x1b5321){var _0x127497={'raw':!![],'where':{}};var _0x209649={};var _0x51a1cc={'count':0x0,'rows':[]};return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x54c12c['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x101e50,null))[_0x549e('0x28')](function(_0x5aaa57){if(_0x5aaa57){_0x209649[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x67')][_0x549e('0x37')]);_0x209649['query']=_['keys'](_0x54c12c[_0x549e('0x3a')]);_0x209649[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x209649[_0x549e('0x39')],_0x209649[_0x549e('0x3a')]);_0x127497[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x209649[_0x549e('0x39')],qs['fields'](_0x54c12c[_0x549e('0x3a')][_0x549e('0x3f')]));_0x127497[_0x549e('0x3e')]=_0x127497['attributes'][_0x549e('0x59')]?_0x127497['attributes']:_0x209649[_0x549e('0x39')];if(!_0x54c12c['query'][_0x549e('0x40')]('nolimit')){_0x127497[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x54c12c[_0x549e('0x3a')]['limit']);_0x127497[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x54c12c[_0x549e('0x3a')][_0x549e('0x24')]);}_0x127497['order']=qs['sort'](_0x54c12c[_0x549e('0x3a')]['sort']);_0x127497[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0x54c12c[_0x549e('0x3a')],_0x209649[_0x549e('0x3c')]));_0x127497['where'][_0x549e('0x62')]=_0x5aaa57['id'];if(_0x54c12c[_0x549e('0x3a')]['filter']){_0x127497[_0x549e('0x45')]=_[_0x549e('0x47')](_0x127497[_0x549e('0x45')],{'$or':_['map'](_0x127497[_0x549e('0x3e')],function(_0x55c652){var _0x25445e={};_0x25445e[_0x55c652]={'$like':'%'+_0x54c12c[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x25445e;})});}_0x127497=_[_0x549e('0x47')]({},_0x127497,_0x54c12c['options']);return db[_0x549e('0x67')][_0x549e('0x23')]({'where':_0x127497[_0x549e('0x45')]})[_0x549e('0x28')](function(_0x1555ce){_0x51a1cc[_0x549e('0x23')]=_0x1555ce;if(_0x54c12c[_0x549e('0x3a')][_0x549e('0x49')]){_0x127497['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x549e('0x4b')](_0x127497);})[_0x549e('0x28')](function(_0x24d6c3){_0x51a1cc[_0x549e('0x4c')]=_0x24d6c3;return _0x51a1cc;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x101e50,_0x127497))[_0x549e('0x4d')](handleError(_0x101e50,null));};exports[_0x549e('0x68')]=function(_0x401a7e,_0x43a4dc,_0x3c17d8){var _0x23bd4b={'raw':!![],'where':{}};var _0x26086b={};var _0x3a2569={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x401a7e[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x43a4dc,null))['then'](function(_0x375afb){if(_0x375afb){_0x26086b[_0x549e('0x39')]=_[_0x549e('0x3b')](db['CmHopperBlack'][_0x549e('0x37')]);_0x26086b['query']=_[_0x549e('0x3b')](_0x401a7e['query']);_0x26086b[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x26086b[_0x549e('0x39')],_0x26086b['query']);_0x23bd4b[_0x549e('0x3e')]=_['intersection'](_0x26086b[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x401a7e[_0x549e('0x3a')][_0x549e('0x3f')]));_0x23bd4b[_0x549e('0x3e')]=_0x23bd4b['attributes'][_0x549e('0x59')]?_0x23bd4b['attributes']:_0x26086b[_0x549e('0x39')];if(!_0x401a7e[_0x549e('0x3a')]['hasOwnProperty']('nolimit')){_0x23bd4b[_0x549e('0x22')]=qs['limit'](_0x401a7e[_0x549e('0x3a')]['limit']);_0x23bd4b['offset']=qs[_0x549e('0x24')](_0x401a7e['query'][_0x549e('0x24')]);}_0x23bd4b['order']=qs[_0x549e('0x42')](_0x401a7e[_0x549e('0x3a')][_0x549e('0x42')]);_0x23bd4b['where']=qs['filters'](_[_0x549e('0x43')](_0x401a7e['query'],_0x26086b['filters']));_0x23bd4b['where'][_0x549e('0x62')]=_0x375afb['id'];if(_0x401a7e[_0x549e('0x3a')][_0x549e('0x44')]){_0x23bd4b[_0x549e('0x45')]=_[_0x549e('0x47')](_0x23bd4b[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0x23bd4b[_0x549e('0x3e')],function(_0x41d724){var _0x51197c={};_0x51197c[_0x41d724]={'$like':'%'+_0x401a7e[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x51197c;})});}_0x23bd4b=_[_0x549e('0x47')]({},_0x23bd4b,_0x401a7e[_0x549e('0x48')]);return db[_0x549e('0x69')]['count']({'where':_0x23bd4b[_0x549e('0x45')]})['then'](function(_0x2cbe92){_0x3a2569[_0x549e('0x23')]=_0x2cbe92;if(_0x401a7e[_0x549e('0x3a')][_0x549e('0x49')]){_0x23bd4b[_0x549e('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x549e('0x4b')](_0x23bd4b);})['then'](function(_0x273c62){_0x3a2569[_0x549e('0x4c')]=_0x273c62;return _0x3a2569;});}})[_0x549e('0x28')](respondWithFilteredResult(_0x43a4dc,_0x23bd4b))[_0x549e('0x4d')](handleError(_0x43a4dc,null));};exports[_0x549e('0x6a')]=function(_0xb6f6c1,_0x4d70bd,_0xaaf56c){var _0xf68546={};var _0x4dc5f3={};var _0x42b0c8;var _0x3ebebf;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0xb6f6c1[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x4d70bd,null))['then'](function(_0xfd2ebe){if(_0xfd2ebe){_0x42b0c8=_0xfd2ebe;_0x4dc5f3['model']=_[_0x549e('0x3b')](db[_0x549e('0x6b')]['rawAttributes']);_0x4dc5f3['query']=_[_0x549e('0x3b')](_0xb6f6c1[_0x549e('0x3a')]);_0x4dc5f3['filters']=_[_0x549e('0x3d')](_0x4dc5f3[_0x549e('0x39')],_0x4dc5f3[_0x549e('0x3a')]);_0xf68546[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x4dc5f3[_0x549e('0x39')],qs['fields'](_0xb6f6c1['query'][_0x549e('0x3f')]));_0xf68546[_0x549e('0x3e')]=_0xf68546[_0x549e('0x3e')][_0x549e('0x59')]?_0xf68546[_0x549e('0x3e')]:_0x4dc5f3[_0x549e('0x39')];_0xf68546['order']=qs[_0x549e('0x42')](_0xb6f6c1[_0x549e('0x3a')]['sort']);_0xf68546[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0xb6f6c1[_0x549e('0x3a')],_0x4dc5f3[_0x549e('0x3c')]));if(_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x44')]){_0xf68546[_0x549e('0x45')]=_[_0x549e('0x47')](_0xf68546[_0x549e('0x45')],{'$or':_[_0x549e('0x2f')](_0xf68546[_0x549e('0x3e')],function(_0x1a4047){var _0x28bf27={};_0x28bf27[_0x1a4047]={'$like':'%'+_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x28bf27;})});}_0xf68546=_['merge']({},_0xf68546,_0xb6f6c1[_0x549e('0x48')]);return _0x42b0c8[_0x549e('0x6a')](_0xf68546);}})['then'](function(_0x15dfcc){if(_0x15dfcc){_0x3ebebf=_0x15dfcc[_0x549e('0x59')];if(!_0xb6f6c1['query'][_0x549e('0x40')](_0x549e('0x41'))){_0xf68546[_0x549e('0x22')]=qs['limit'](_0xb6f6c1['query'][_0x549e('0x22')]);_0xf68546[_0x549e('0x24')]=qs[_0x549e('0x24')](_0xb6f6c1[_0x549e('0x3a')][_0x549e('0x24')]);}return _0x42b0c8['getTeams'](_0xf68546);}})['then'](function(_0x21aaf9){if(_0x21aaf9){return _0x21aaf9?{'count':_0x3ebebf,'rows':_0x21aaf9}:null;}})[_0x549e('0x28')](respondWithResult(_0x4d70bd,null))['catch'](handleError(_0x4d70bd,null));};exports[_0x549e('0x6c')]=function(_0x52dbcf,_0x498124,_0x446726){var _0x4a20be=_0x52dbcf['body'][_0x549e('0x6d')];var _0x282316=_['map'](_0x4a20be,'id');return db['Team'][_0x549e('0x4b')]({'where':{'id':_0x282316},'attributes':['id'],'include':[{'model':db['User'],'as':_0x549e('0x6e'),'attributes':['id','name',_0x549e('0x6f'),'voicePause',_0x549e('0x70')],'raw':!![]}]})[_0x549e('0x28')](function(_0x1dd77d){if(_0x1dd77d){var _0x4eb07b=_['flatMap'](_0x1dd77d,function(_0x26414f){var _0x460b44=_0x26414f[_0x549e('0x51')]({'plain':!![]});_0x460b44[_0x549e('0x6e')][_0x549e('0x71')](function(_0x29937e){_0x29937e[_0x549e('0x72')]=_[_0x549e('0x32')](_0x4a20be,{'id':_0x460b44['id']})[_0x549e('0x72')];});return _0x460b44[_0x549e('0x6e')];});return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x52dbcf[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(_0x5e17b5){return db[_0x549e('0x73')][_0x549e('0x74')](function(_0x4693fa){return _0x5e17b5['addTeams'](_0x282316,{'transaction':_0x4693fa})[_0x549e('0x28')](function(){return BPromise['each'](_0x4a20be,function(_0x345398){return db[_0x549e('0x75')][_0x549e('0x76')]({'TeamId':_0x345398['id'],'VoiceQueueId':_0x52dbcf[_0x549e('0x58')]['id'],'penalty':_0x345398[_0x549e('0x72')]},{'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){return BPromise[_0x549e('0x77')](_0x4eb07b,function(_0x3eefcf){return db['UserVoiceQueue'][_0x549e('0x78')]({'where':{'UserId':_0x3eefcf['id'],'VoiceQueueId':_0x52dbcf[_0x549e('0x58')]['id']},'defaults':{'penalty':_0x3eefcf[_0x549e('0x72')]},'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){return BPromise[_0x549e('0x77')](_[_0x549e('0x44')](_0x4eb07b,{'online':!![]}),function(_0xece09){return db[_0x549e('0x79')][_0x549e('0x76')]({'membername':_0xece09[_0x549e('0x33')],'UserId':_0xece09['id'],'queue_name':_0x5e17b5[_0x549e('0x33')],'VoiceQueueId':_0x5e17b5['id'],'interface':_['isNil'](_0xece09['interface'])?util[_0x549e('0x7a')](_0x549e('0x7b'),_0xece09['name']):_0xece09['interface'],'paused':_0xece09['voicePause']||![],'penalty':_0xece09[_0x549e('0x72')]},{'transaction':_0x4693fa});});})[_0x549e('0x28')](function(){_0x4eb07b[_0x549e('0x71')](function(_0x418bf6){socket['emit'](_0x549e('0x7c'),{'UserId':_0x418bf6['id'],'VoiceQueueId':_0x5e17b5['id']});});});});});}})[_0x549e('0x28')](respondWithStatusCode(_0x498124,null))[_0x549e('0x4d')](handleError(_0x498124,null));};exports[_0x549e('0x7d')]=function(_0x87743f,_0xc573a5,_0x5423c8){return db[_0x549e('0x6b')][_0x549e('0x4b')]({'where':{'id':_0x87743f['query'][_0x549e('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x549e('0x7f')],'as':_0x549e('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x549e('0x28')](handleEntityNotFound(_0xc573a5,null))[_0x549e('0x28')](function(_0x50d9df){var _0xc085d5=_['map'](_0x50d9df,'id');var _0x300215=[];var _0x556cd8=[];var _0x27edbe=squel[_0x549e('0x80')]();_0x27edbe[_0x549e('0x81')]('tq.TeamId')[_0x549e('0x82')](_0x549e('0x83'),'tq')[_0x549e('0x84')](_0x549e('0x85'),'ut',_0x549e('0x86'))[_0x549e('0x45')](_0x549e('0x87'),_0x87743f[_0x549e('0x58')]['id']);for(var _0x1f11a6=0x0;_0x1f11a6<_0x50d9df[_0x549e('0x59')];_0x1f11a6+=0x1){let _0x10a48d=_0x50d9df[_0x1f11a6];for(var _0x1d151d=0x0;_0x1d151d<_0x10a48d['Agents'][_0x549e('0x59')];_0x1d151d+=0x1){let _0x5beeec=_0x10a48d[_0x549e('0x6e')][_0x1d151d];var _0x3eac30=_0x27edbe[_0x549e('0x57')]();_0x3eac30['where'](_0x549e('0x88'),_0x5beeec['id']);_0x556cd8[_0x549e('0x89')](db[_0x549e('0x73')][_0x549e('0x3a')](_0x3eac30[_0x549e('0x8a')](),{'type':db['sequelize'][_0x549e('0x8b')][_0x549e('0x8c')]})[_0x549e('0x28')](function(_0x2f586b){if(_0x2f586b[_0x549e('0x59')]===0x1){return _0x5beeec['id'];}else{var _0x3101fa=_[_0x549e('0x8d')](_[_0x549e('0x2f')](_0x2f586b,_0x549e('0x8e')),function(_0x1cc48e){return _[_0x549e('0x8f')](_0xc085d5,_0x1cc48e);});if(_0x3101fa){return _0x5beeec['id'];}}}));}}return BPromise[_0x549e('0x90')](_0x556cd8)[_0x549e('0x28')](function(_0x233fb8){_0x300215=_(_0x300215)[_0x549e('0x91')](_0x233fb8)['compact']()[_0x549e('0x30')]();return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x87743f[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(_0x3eef76){return db[_0x549e('0x73')][_0x549e('0x74')](function(_0x4dff4d){return _0x3eef76[_0x549e('0x7d')](_0x87743f['query'][_0x549e('0x7e')],{'transaction':_0x4dff4d})[_0x549e('0x28')](function(){if(!_[_0x549e('0x92')](_0x300215)){return _0x3eef76[_0x549e('0x93')](_0x300215,{'transaction':_0x4dff4d})['then'](function(){return db[_0x549e('0x79')]['destroy']({'where':{'VoiceQueueId':_0x87743f[_0x549e('0x58')]['id'],'UserId':_0x300215},'transaction':_0x4dff4d});});}})[_0x549e('0x28')](function(){_0x300215[_0x549e('0x71')](function(_0x4b23c0){socket[_0x549e('0x94')](_0x549e('0x95'),{'UserId':_0x4b23c0,'VoiceQueueId':_0x3eef76['id']});});});});});});})['then'](respondWithStatusCode(_0xc573a5,null))[_0x549e('0x4d')](handleError(_0xc573a5,null));};exports[_0x549e('0x96')]=function(_0x4acc29,_0x353241,_0x43a17a){var _0x1d629f,_0x19ecc5;return db[_0x549e('0x36')]['find']({'where':{'id':_0x4acc29[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x353241,null))[_0x549e('0x28')](function(_0x481a8d){if(_0x481a8d){_0x19ecc5=_0x481a8d;return _0x481a8d[_0x549e('0x96')](_0x4acc29['body']['ids'],_[_0x549e('0x5a')](_0x4acc29[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{})[_0x549e('0x97')](function(_0x5af996){for(var _0x2c68ff=0x0;_0x2c68ff<_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')][_0x549e('0x59')];_0x2c68ff+=0x1){socket[_0x549e('0x94')]('userVoiceQueue:save',{'UserId':Number(_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')][_0x2c68ff]),'VoiceQueueId':Number(_0x4acc29[_0x549e('0x58')]['id'])});}return _0x5af996;});}})[_0x549e('0x28')](function(_0x4daf87){_0x1d629f=_0x4daf87||[];if(_0x19ecc5){return db[_0x549e('0x7f')]['findAll']({'where':{'id':_0x4acc29[_0x549e('0x50')][_0x549e('0x7e')]},'attributes':['id',_0x549e('0x33'),_0x549e('0x6f'),'voicePause','interface'],'raw':!![]});}})[_0x549e('0x28')](function(_0x2a38af){if(!_['isEmpty'](_0x2a38af)){var _0x278325=[];for(var _0x8509cd=0x0;_0x8509cd<_0x2a38af[_0x549e('0x59')];_0x8509cd++){if(_0x2a38af[_0x8509cd][_0x549e('0x6f')]){_0x278325[_0x549e('0x89')](db[_0x549e('0x79')][_0x549e('0x76')]({'membername':_0x2a38af[_0x8509cd][_0x549e('0x33')],'UserId':_0x2a38af[_0x8509cd]['id'],'queue_name':_0x19ecc5[_0x549e('0x33')],'VoiceQueueId':_0x19ecc5['id'],'interface':_[_0x549e('0x98')](_0x2a38af[_0x8509cd][_0x549e('0x70')])?util['format'](_0x549e('0x7b'),_0x2a38af[_0x8509cd][_0x549e('0x33')]):_0x2a38af[_0x8509cd][_0x549e('0x70')],'paused':_0x2a38af[_0x8509cd][_0x549e('0x99')]||![],'penalty':_0x4acc29[_0x549e('0x50')][_0x549e('0x72')]||0x0}));}}return BPromise['all'](_0x278325);}})['then'](function(){return _0x1d629f;})[_0x549e('0x28')](respondWithResult(_0x353241,null))[_0x549e('0x4d')](handleError(_0x353241,null));};exports[_0x549e('0x93')]=function(_0x3d3bca,_0x1df785,_0x23bc2c){return db['VoiceQueue'][_0x549e('0x32')]({'where':{'id':_0x3d3bca[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x1df785,null))[_0x549e('0x28')](function(_0x5c884a){if(_0x5c884a){return _0x5c884a[_0x549e('0x93')](_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')])['then'](function(){if(_[_0x549e('0x9a')](_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')])){for(var _0x49fd12=0x0;_0x49fd12<_0x3d3bca[_0x549e('0x3a')]['ids'][_0x549e('0x59')];_0x49fd12+=0x1){socket[_0x549e('0x94')](_0x549e('0x95'),{'UserId':Number(_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')][_0x49fd12]),'VoiceQueueId':Number(_0x3d3bca['params']['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3d3bca[_0x549e('0x3a')][_0x549e('0x7e')]),'VoiceQueueId':Number(_0x3d3bca[_0x549e('0x58')]['id'])});}});}})['then'](function(_0x379124){return db['UserVoiceQueueRt'][_0x549e('0x29')]({'where':{'VoiceQueueId':_0x3d3bca[_0x549e('0x58')]['id'],'UserId':_0x3d3bca['query'][_0x549e('0x7e')]}})[_0x549e('0x28')](function(){return _0x379124;});})['then'](respondWithStatusCode(_0x1df785,null))[_0x549e('0x4d')](handleError(_0x1df785,null));};exports[_0x549e('0x9b')]=function(_0x56b097,_0x27abe8,_0x595080){var _0x14e462={};var _0x40e3d9={};var _0x460f1f;var _0x547adf;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x56b097[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x27abe8,null))[_0x549e('0x28')](function(_0x4934af){if(_0x4934af){_0x460f1f=_0x4934af;_0x40e3d9['model']=_[_0x549e('0x3b')](db['User']['rawAttributes']);_0x40e3d9[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x56b097[_0x549e('0x3a')]);_0x40e3d9[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x40e3d9[_0x549e('0x39')],_0x40e3d9[_0x549e('0x3a')]);_0x14e462['attributes']=_['intersection'](_0x40e3d9[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x56b097[_0x549e('0x3a')]['fields']));_0x14e462[_0x549e('0x3e')]=_0x14e462[_0x549e('0x3e')][_0x549e('0x59')]?_0x14e462[_0x549e('0x3e')]:_0x40e3d9[_0x549e('0x39')];_0x14e462[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x56b097[_0x549e('0x3a')]['sort']);_0x14e462[_0x549e('0x45')]=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x56b097[_0x549e('0x3a')],_0x40e3d9[_0x549e('0x3c')]));if(_0x56b097[_0x549e('0x3a')][_0x549e('0x44')]){_0x14e462[_0x549e('0x45')]=_[_0x549e('0x47')](_0x14e462['where'],{'$or':_['map'](_0x14e462[_0x549e('0x3e')],function(_0x208b77){var _0x33f583={};_0x33f583[_0x208b77]={'$like':'%'+_0x56b097[_0x549e('0x3a')]['filter']+'%'};return _0x33f583;})});}_0x14e462=_[_0x549e('0x47')]({},_0x14e462,_0x56b097['options']);return _0x460f1f[_0x549e('0x9b')](_0x14e462);}})[_0x549e('0x28')](function(_0x59a9ef){if(_0x59a9ef){_0x547adf=_0x59a9ef['length'];if(!_0x56b097[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x14e462[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x56b097[_0x549e('0x3a')][_0x549e('0x22')]);_0x14e462[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x56b097['query'][_0x549e('0x24')]);}return _0x460f1f['getAgents'](_0x14e462);}})[_0x549e('0x28')](function(_0x38e2f6){if(_0x38e2f6){return _0x38e2f6?{'count':_0x547adf,'rows':_0x38e2f6}:null;}})[_0x549e('0x28')](respondWithResult(_0x27abe8,null))['catch'](handleError(_0x27abe8,null));};exports[_0x549e('0x9c')]=function(_0x2c1ef6,_0x347cec,_0x465061){var _0x522828={};var _0x3ed6f6={};var _0x560c85;var _0x3419b6;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x2c1ef6[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x347cec,null))[_0x549e('0x28')](function(_0x283c75){if(_0x283c75){_0x560c85=_0x283c75;_0x3ed6f6[_0x549e('0x39')]=_[_0x549e('0x3b')](db[_0x549e('0x79')][_0x549e('0x37')]);_0x3ed6f6['query']=_[_0x549e('0x3b')](_0x2c1ef6[_0x549e('0x3a')]);_0x3ed6f6[_0x549e('0x3c')]=_[_0x549e('0x3d')](_0x3ed6f6['model'],_0x3ed6f6['query']);_0x522828['attributes']=_['intersection'](_0x3ed6f6[_0x549e('0x39')],qs['fields'](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x3f')]));_0x522828['attributes']=_0x522828['attributes'][_0x549e('0x59')]?_0x522828['attributes']:_0x3ed6f6['model'];_0x522828[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x42')]);_0x522828[_0x549e('0x45')]=qs[_0x549e('0x3c')](_['pick'](_0x2c1ef6[_0x549e('0x3a')],_0x3ed6f6[_0x549e('0x3c')]));if(_0x2c1ef6[_0x549e('0x3a')]['filter']){_0x522828[_0x549e('0x45')]=_[_0x549e('0x47')](_0x522828[_0x549e('0x45')],{'$or':_['map'](_0x522828[_0x549e('0x3e')],function(_0x4e5988){var _0x53ac31={};_0x53ac31[_0x4e5988]={'$like':'%'+_0x2c1ef6['query']['filter']+'%'};return _0x53ac31;})});}_0x522828=_['merge']({},_0x522828,_0x2c1ef6['options']);return _0x560c85[_0x549e('0x9c')](_0x522828);}})[_0x549e('0x28')](function(_0x3b68bb){if(_0x3b68bb){_0x3419b6=_0x3b68bb[_0x549e('0x59')];if(!_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x522828[_0x549e('0x22')]=qs['limit'](_0x2c1ef6[_0x549e('0x3a')]['limit']);_0x522828[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x2c1ef6[_0x549e('0x3a')][_0x549e('0x24')]);}return _0x560c85['getMembers'](_0x522828);}})['then'](function(_0x909d53){return _0x909d53?{'count':_0x3419b6,'rows':_0x909d53}:null;})[_0x549e('0x28')](respondWithResult(_0x347cec,null))[_0x549e('0x4d')](handleError(_0x347cec,null));};exports[_0x549e('0x9d')]=function(_0x31a961,_0x17cd7a,_0x535fe8){var _0xbfb44={};var _0x203e96={};var _0xe523f;var _0x1182fb;return db[_0x549e('0x36')][_0x549e('0x60')]({'where':{'id':_0x31a961['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x17cd7a,null))['then'](function(_0x5b276e){if(_0x5b276e){_0xe523f=_0x5b276e;_0x203e96[_0x549e('0x39')]=_['keys'](db[_0x549e('0x9e')][_0x549e('0x37')]);_0x203e96['query']=_[_0x549e('0x3b')](_0x31a961[_0x549e('0x3a')]);_0x203e96['filters']=_['intersection'](_0x203e96[_0x549e('0x39')],_0x203e96['query']);_0xbfb44[_0x549e('0x3e')]=_[_0x549e('0x3d')](_0x203e96[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x31a961[_0x549e('0x3a')]['fields']));_0xbfb44[_0x549e('0x3e')]=_0xbfb44[_0x549e('0x3e')][_0x549e('0x59')]?_0xbfb44['attributes']:_0x203e96[_0x549e('0x39')];_0xbfb44[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x31a961[_0x549e('0x3a')][_0x549e('0x42')]);_0xbfb44[_0x549e('0x45')]=qs['filters'](_[_0x549e('0x43')](_0x31a961[_0x549e('0x3a')],_0x203e96[_0x549e('0x3c')]));if(_0x31a961[_0x549e('0x3a')][_0x549e('0x44')]){_0xbfb44[_0x549e('0x45')]=_[_0x549e('0x47')](_0xbfb44[_0x549e('0x45')],{'$or':_['map'](_0xbfb44[_0x549e('0x3e')],function(_0xd6337d){var _0x1dfe81={};_0x1dfe81[_0xd6337d]={'$like':'%'+_0x31a961[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x1dfe81;})});}_0xbfb44=_['merge']({},_0xbfb44,_0x31a961['options']);return _0xe523f[_0x549e('0x9d')](_0xbfb44);}})[_0x549e('0x28')](function(_0x1383ee){if(_0x1383ee){_0x1182fb=_0x1383ee[_0x549e('0x59')];if(!_0x31a961['query'][_0x549e('0x40')](_0x549e('0x41'))){_0xbfb44[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x31a961['query'][_0x549e('0x22')]);_0xbfb44[_0x549e('0x24')]=qs[_0x549e('0x24')](_0x31a961['query'][_0x549e('0x24')]);}return _0xe523f[_0x549e('0x9d')](_0xbfb44);}})[_0x549e('0x28')](function(_0x92512b){if(_0x92512b){return _0x92512b?{'count':_0x1182fb,'rows':_0x92512b}:null;}})[_0x549e('0x28')](respondWithResult(_0x17cd7a,null))[_0x549e('0x4d')](handleError(_0x17cd7a,null));};exports[_0x549e('0x9f')]=function(_0x511715,_0x37dc1a,_0x308913){var _0x2c320e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1225df,_0xdb6fa3;return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x511715['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x37dc1a,null))['then'](function(_0xf1b7cb){if(_0xf1b7cb){_0xdb6fa3=_0xf1b7cb;return _0xf1b7cb['addLists'](_0x511715[_0x549e('0x50')][_0x549e('0x7e')],_[_0x549e('0x5a')](_0x511715[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{});}return null;})[_0x549e('0x97')](function(_0x2e1900){var _0x5d41f9;_0x1225df=_0x2e1900||[];var _0x5ddbb4=[];if(_0x2e1900){for(var _0x1219d4=0x0;_0x1219d4<_0x2e1900[_0x549e('0x59')];_0x1219d4+=0x1){var _0x57bc78=_0x2e1900[_0x1219d4][_0x549e('0x51')]({'plain':!![]});_0xdb6fa3[_0x549e('0xa0')]=_0x511715['body'][_0x549e('0xa0')]?_0x511715['body'][_0x549e('0xa0')]:_0xdb6fa3[_0x549e('0xa0')];switch(_0xdb6fa3[_0x549e('0xa0')]){case _0x549e('0xa1'):_0x5d41f9=squel['insert']()[_0x549e('0xa2')](_0x549e('0xa3'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),'VoiceQueueId',_0x549e('0x5b'),'updatedAt'],squel['select']()[_0x549e('0x81')](_0x549e('0xa5'),_0x549e('0xa5'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0xa6'))[_0x549e('0x81')]('id',_0x549e('0xa7'))['field'](_0x57bc78['CmListId'][_0x549e('0x8a')](),_0x549e('0xa8'))[_0x549e('0x81')](_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))['where'](_0x549e('0xaa'))[_0x549e('0x45')]('ListId\x20=\x20?',_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac'))[_0x549e('0x45')](_0x549e('0xad'),squel[_0x549e('0x80')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x549e('0x82')](_0x549e('0xae'))['where'](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')]()))['where'](_0x549e('0xad'),squel[_0x549e('0x80')]()[_0x549e('0x81')]('COALESCE(phone,\x27\x27)')[_0x549e('0x82')](_0x549e('0xa3'))['where'](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')]())))[_0x549e('0x8a')]();break;case _0x549e('0xaf'):_0x5d41f9=squel[_0x549e('0xb0')]()[_0x549e('0xa2')](_0x549e('0xa3'))['fromQuery']([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),'createdAt',_0x549e('0x5c')],squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xa5'),'phone')[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27','scheduledAt')[_0x549e('0x81')]('id','ContactId')['field'](_0x57bc78['CmListId']['toString'](),_0x549e('0xa8'))['field'](_0x511715[_0x549e('0x58')]['id']['toString'](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x549e('0x45')](_0x549e('0xad'),squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xb1'))['from'](_0x549e('0xa3'))[_0x549e('0x45')](_0x549e('0x87'),_0x511715[_0x549e('0x58')]['id']['toString']())))[_0x549e('0x8a')]();break;default:_0x5d41f9=squel[_0x549e('0xb0')]()[_0x549e('0xa2')](_0x549e('0xa3'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa6'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),_0x549e('0x5b'),'updatedAt'],squel[_0x549e('0x80')]()[_0x549e('0x81')](_0x549e('0xa5'),'phone')['field']('\x27'+_0x2c320e+'\x27',_0x549e('0xa6'))[_0x549e('0x81')]('id','ContactId')[_0x549e('0x81')](_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')](),_0x549e('0xa8'))['field'](_0x511715[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field']('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xa9'))[_0x549e('0x45')](_0x549e('0xaa'))['where'](_0x549e('0xb2'),_0x57bc78[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac')))['toString']();}_0x5ddbb4['push'](db[_0x549e('0x73')][_0x549e('0x3a')](_0x5d41f9));}return BPromise[_0x549e('0x90')](_0x5ddbb4);}})[_0x549e('0x28')](function(){var _0x381668=[];var _0x1fd074=squel[_0x549e('0xb0')]()[_0x549e('0xa2')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x549e('0xa5'),_0x549e('0xb3'),'createdAt',_0x549e('0x5c')],squel['select']()['field']('h.id')['field'](_0x549e('0xb4'))['field'](_0x549e('0xb5'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5b'))[_0x549e('0x81')]('\x27'+_0x2c320e+'\x27',_0x549e('0x5c'))[_0x549e('0x82')](_0x549e('0xb6'),'ci')[_0x549e('0x84')](_0x549e('0xa3'),'h',_0x549e('0xb7'))['where'](_0x549e('0xb8'),_0x2c320e)['where']('ci.ItemClass=?',_0x549e('0xb9')))['toString']();_0x381668['push'](db['sequelize'][_0x549e('0x3a')](_0x1fd074));return BPromise['all'](_0x381668);})['then'](function(){return _0x1225df;})[_0x549e('0x28')](respondWithResult(_0x37dc1a,null))[_0x549e('0x4d')](handleError(_0x37dc1a,null));};exports[_0x549e('0xba')]=function(_0x591f68,_0x474cb4,_0x5c045f){return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x591f68['params']['id']}})['then'](handleEntityNotFound(_0x474cb4,null))[_0x549e('0x28')](function(_0x486e54){if(_0x486e54){return _0x486e54['removeLists'](_0x591f68[_0x549e('0x3a')][_0x549e('0x7e')]);}})['then'](function(_0x5eed5d){if(_0x5eed5d){return db[_0x549e('0x61')][_0x549e('0x29')]({'where':{'ListId':_0x591f68[_0x549e('0x3a')]['ids'],'VoiceQueueId':_0x591f68['params']['id']}})[_0x549e('0x28')](function(){return _0x5eed5d;});}})[_0x549e('0x28')](respondWithStatusCode(_0x474cb4,null))['catch'](handleError(_0x474cb4,null));};exports[_0x549e('0xbb')]=function(_0x7e6ae3,_0x35b880,_0x3995cf){var _0x211c7c={};var _0x35bbf8={};var _0x806c1f;var _0x2999d2;return db[_0x549e('0x36')]['findOne']({'where':{'id':_0x7e6ae3['params']['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x35b880,null))['then'](function(_0x3159f5){if(_0x3159f5){_0x806c1f=_0x3159f5;_0x35bbf8[_0x549e('0x39')]=_['keys'](db[_0x549e('0x9e')][_0x549e('0x37')]);_0x35bbf8[_0x549e('0x3a')]=_[_0x549e('0x3b')](_0x7e6ae3[_0x549e('0x3a')]);_0x35bbf8[_0x549e('0x3c')]=_['intersection'](_0x35bbf8['model'],_0x35bbf8['query']);_0x211c7c[_0x549e('0x3e')]=_['intersection'](_0x35bbf8[_0x549e('0x39')],qs[_0x549e('0x3f')](_0x7e6ae3[_0x549e('0x3a')]['fields']));_0x211c7c['attributes']=_0x211c7c['attributes']['length']?_0x211c7c[_0x549e('0x3e')]:_0x35bbf8[_0x549e('0x39')];_0x211c7c[_0x549e('0x65')]=qs[_0x549e('0x42')](_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x42')]);_0x211c7c['where']=qs[_0x549e('0x3c')](_[_0x549e('0x43')](_0x7e6ae3[_0x549e('0x3a')],_0x35bbf8['filters']));if(_0x7e6ae3['query'][_0x549e('0x44')]){_0x211c7c[_0x549e('0x45')]=_[_0x549e('0x47')](_0x211c7c['where'],{'$or':_[_0x549e('0x2f')](_0x211c7c[_0x549e('0x3e')],function(_0x2abda1){var _0x51b294={};_0x51b294[_0x2abda1]={'$like':'%'+_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x44')]+'%'};return _0x51b294;})});}_0x211c7c=_[_0x549e('0x47')]({},_0x211c7c,_0x7e6ae3[_0x549e('0x48')]);return _0x806c1f[_0x549e('0xbb')](_0x211c7c);}})[_0x549e('0x28')](function(_0x34bcbe){if(_0x34bcbe){_0x2999d2=_0x34bcbe[_0x549e('0x59')];if(!_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x40')](_0x549e('0x41'))){_0x211c7c[_0x549e('0x22')]=qs[_0x549e('0x22')](_0x7e6ae3[_0x549e('0x3a')][_0x549e('0x22')]);_0x211c7c[_0x549e('0x24')]=qs['offset'](_0x7e6ae3[_0x549e('0x3a')]['offset']);}return _0x806c1f[_0x549e('0xbb')](_0x211c7c);}})['then'](function(_0x53f5af){if(_0x53f5af){return _0x53f5af?{'count':_0x2999d2,'rows':_0x53f5af}:null;}})['then'](respondWithResult(_0x35b880,null))[_0x549e('0x4d')](handleError(_0x35b880,null));};exports[_0x549e('0xbc')]=function(_0x44e499,_0x4b935e,_0x4a312d){var _0x3fc56b,_0x4493e7;return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x44e499[_0x549e('0x58')]['id']}})[_0x549e('0x28')](handleEntityNotFound(_0x4b935e,null))[_0x549e('0x28')](function(_0x53a77b){if(_0x53a77b){_0x4493e7=_0x53a77b;return _0x53a77b[_0x549e('0xbc')](_0x44e499[_0x549e('0x50')]['ids'],_[_0x549e('0x5a')](_0x44e499[_0x549e('0x50')],[_0x549e('0x7e'),'id'])||{});}return null;})[_0x549e('0x97')](function(_0x4b5070){var _0x227e82;_0x3fc56b=_0x4b5070||[];var _0x4fe4dc=[];if(_0x4b5070){for(var _0x25f82b=0x0;_0x25f82b<_0x4b5070[_0x549e('0x59')];_0x25f82b+=0x1){var _0x30214b=_0x4b5070[_0x25f82b][_0x549e('0x51')]({'plain':!![]});_0x227e82=squel['insert']()[_0x549e('0xa2')](_0x549e('0xbd'))[_0x549e('0xa4')]([_0x549e('0xa5'),_0x549e('0xa7'),_0x549e('0xa8'),_0x549e('0x62'),'createdAt',_0x549e('0x5c')],squel['select']()[_0x549e('0x81')](_0x549e('0xa5'),_0x549e('0xa5'))[_0x549e('0x81')]('id',_0x549e('0xa7'))[_0x549e('0x81')](_0x30214b[_0x549e('0xab')][_0x549e('0x8a')](),'ListId')['field'](_0x44e499[_0x549e('0x58')]['id'][_0x549e('0x8a')](),_0x549e('0x62'))['field'](_0x549e('0xbe'),_0x549e('0x5b'))[_0x549e('0x81')](_0x549e('0xbe'),'updatedAt')[_0x549e('0x82')](_0x549e('0xa9'))[_0x549e('0x45')](_0x549e('0xaa'))[_0x549e('0x45')]('ListId\x20=\x20?',_0x30214b[_0x549e('0xab')][_0x549e('0x8a')]())[_0x549e('0x45')](_0x549e('0xac')))[_0x549e('0x8a')]();_0x4fe4dc['push'](db[_0x549e('0x73')]['query'](_0x227e82));}return BPromise[_0x549e('0x90')](_0x4fe4dc);}})[_0x549e('0x28')](function(){return _0x3fc56b;})['then'](respondWithResult(_0x4b935e,null))[_0x549e('0x4d')](handleError(_0x4b935e,null));};exports[_0x549e('0xbf')]=function(_0x32cdef,_0x4bb7f,_0x153d63){return db[_0x549e('0x36')][_0x549e('0x32')]({'where':{'id':_0x32cdef['params']['id']}})['then'](handleEntityNotFound(_0x4bb7f,null))[_0x549e('0x28')](function(_0x58514c){if(_0x58514c){return _0x58514c[_0x549e('0xbf')](_0x32cdef['query'][_0x549e('0x7e')]);}})['then'](function(_0x329de2){if(_0x329de2){return db[_0x549e('0x69')][_0x549e('0x29')]({'where':{'ListId':_0x32cdef['query'][_0x549e('0x7e')],'VoiceQueueId':_0x32cdef[_0x549e('0x58')]['id']}})[_0x549e('0x28')](function(){return _0x329de2;});}})[_0x549e('0x28')](respondWithStatusCode(_0x4bb7f,null))[_0x549e('0x4d')](handleError(_0x4bb7f,null));}; \ No newline at end of file +var _0x3dba=['params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','userProfileId','update','findOne','CmHopper','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','emit','addAgents','spread','push','upsert','format','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','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','localhost','./voiceQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','error','stack','send','VoiceQueue','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3dba,0x73));var _0xa3db=function(_0xf0330b,_0x814253){_0xf0330b=_0xf0330b-0x0;var _0x538518=_0x3dba[_0xf0330b];return _0x538518;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3db('0x0'));var rp=require(_0xa3db('0x1'));var moment=require('moment');var BPromise=require(_0xa3db('0x2'));var Mustache=require(_0xa3db('0x3'));var util=require(_0xa3db('0x4'));var path=require(_0xa3db('0x5'));var sox=require(_0xa3db('0x6'));var csv=require(_0xa3db('0x7'));var ejs=require(_0xa3db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3db('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa3db('0xa'));var Redis=require(_0xa3db('0xb'));var authService=require(_0xa3db('0xc'));var qs=require(_0xa3db('0xd'));var as=require(_0xa3db('0xe'));var hardwareService=require(_0xa3db('0xf'));var logger=require(_0xa3db('0x10'))(_0xa3db('0x11'));var utils=require(_0xa3db('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa3db('0x13'));var db=require(_0xa3db('0x14'))['db'];config[_0xa3db('0x15')]=_[_0xa3db('0x16')](config[_0xa3db('0x15')],{'host':_0xa3db('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa3db('0x18'))[_0xa3db('0x19')](socket);function respondWithStatusCode(_0x4f323b,_0x3da006){_0x3da006=_0x3da006||0xcc;return function(_0x4474db){if(_0x4474db){return _0x4f323b[_0xa3db('0x1a')](_0x3da006);}return _0x4f323b[_0xa3db('0x1b')](_0x3da006)[_0xa3db('0x1c')]();};}function respondWithResult(_0xd53611,_0x2712e3){_0x2712e3=_0x2712e3||0xc8;return function(_0x119589){if(_0x119589){return _0xd53611[_0xa3db('0x1b')](_0x2712e3)['json'](_0x119589);}};}function respondWithFilteredResult(_0x558581,_0xb24083){return function(_0x278c2a){if(_0x278c2a){var _0x3f701c=typeof _0xb24083[_0xa3db('0x1d')]==='undefined'&&typeof _0xb24083[_0xa3db('0x1e')]===_0xa3db('0x1f');var _0x356f63=_0x278c2a[_0xa3db('0x20')];var _0x2cdd17=_0x3f701c?0x0:_0xb24083[_0xa3db('0x1d')];var _0x439bb2=_0x3f701c?_0x278c2a[_0xa3db('0x20')]:_0xb24083[_0xa3db('0x1d')]+_0xb24083[_0xa3db('0x1e')];var _0x2581e2;if(_0x439bb2>=_0x356f63){_0x439bb2=_0x356f63;_0x2581e2=0xc8;}else{_0x2581e2=0xce;}_0x558581[_0xa3db('0x1b')](_0x2581e2);return _0x558581[_0xa3db('0x21')](_0xa3db('0x22'),_0x2cdd17+'-'+_0x439bb2+'/'+_0x356f63)[_0xa3db('0x23')](_0x278c2a);}return null;};}function patchUpdates(_0x16bc03){return function(_0x19bc90){try{jsonpatch[_0xa3db('0x24')](_0x19bc90,_0x16bc03,!![]);}catch(_0x989eed){return BPromise['reject'](_0x989eed);}return _0x19bc90[_0xa3db('0x25')]();};}function saveUpdates(_0x49bc1b,_0x1be23b){return function(_0x1ff18b){if(_0x1ff18b){return _0x1ff18b['update'](_0x49bc1b)[_0xa3db('0x26')](function(_0xe0be83){return _0xe0be83;});}return null;};}function removeEntity(_0x415d61,_0x5e71f2){return function(_0x312b44){if(_0x312b44){return _0x312b44[_0xa3db('0x27')]()[_0xa3db('0x26')](function(){var _0x1f0d0e=_0x312b44[_0xa3db('0x28')]({'plain':!![]});var _0x53e89f=[{'name':_0xa3db('0x29'),'value':_0xa3db('0x2a'),'ignore':![]},{'name':_0xa3db('0x2b'),'value':_0xa3db('0x2c'),'ignore':![]}];var _0x244d2c=_(_0x53e89f)[_0xa3db('0x2d')](_0xa3db('0x2e'))[_0xa3db('0x2f')](_0xa3db('0x30'))[_0xa3db('0x30')]();if(_['includes'](_0x244d2c,_0x1f0d0e[_0xa3db('0x31')])){return;}var _0x45fbdb=_[_0xa3db('0x32')](_0x53e89f,['value',_0x1f0d0e[_0xa3db('0x31')]])[_0xa3db('0x33')];return db['UserProfileResource'][_0xa3db('0x27')]({'where':{'type':_0x45fbdb,'resourceId':_0x1f0d0e['id']}})[_0xa3db('0x26')](function(){return _0x312b44;});})[_0xa3db('0x26')](function(){_0x415d61['status'](0xcc)[_0xa3db('0x1c')]();});}};}function handleEntityNotFound(_0x1b40d1,_0x482928){return function(_0x5397fc){if(!_0x5397fc){_0x1b40d1[_0xa3db('0x1a')](0x194);}return _0x5397fc;};}function handleError(_0x34df17,_0x407b68){_0x407b68=_0x407b68||0x1f4;return function(_0x4369f5){logger[_0xa3db('0x34')](_0x4369f5[_0xa3db('0x35')]);if(_0x4369f5[_0xa3db('0x33')]){delete _0x4369f5[_0xa3db('0x33')];}_0x34df17['status'](_0x407b68)[_0xa3db('0x36')](_0x4369f5);};}exports['index']=function(_0xb042b6,_0x642a06){var _0x3f7cd7={},_0x1d5050={},_0xb5fd8c={'count':0x0,'rows':[]};var _0xc761f4=_[_0xa3db('0x2f')](db[_0xa3db('0x37')]['rawAttributes'],function(_0x189fb6){return{'name':_0x189fb6[_0xa3db('0x38')],'type':_0x189fb6[_0xa3db('0x31')]['key']};});_0x1d5050[_0xa3db('0x39')]=_[_0xa3db('0x2f')](_0xc761f4,_0xa3db('0x33'));_0x1d5050[_0xa3db('0x3a')]=_[_0xa3db('0x3b')](_0xb042b6['query']);_0x1d5050[_0xa3db('0x3c')]=_['intersection'](_0x1d5050['model'],_0x1d5050[_0xa3db('0x3a')]);_0x3f7cd7[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x1d5050[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0xb042b6[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x3f7cd7[_0xa3db('0x3d')]=_0x3f7cd7[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x3f7cd7[_0xa3db('0x3d')]:_0x1d5050[_0xa3db('0x39')];if(!_0xb042b6['query'][_0xa3db('0x41')](_0xa3db('0x42'))){_0x3f7cd7[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0xb042b6[_0xa3db('0x3a')]['limit']);_0x3f7cd7['offset']=qs[_0xa3db('0x1d')](_0xb042b6[_0xa3db('0x3a')][_0xa3db('0x1d')]);}_0x3f7cd7[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0xb042b6[_0xa3db('0x3a')][_0xa3db('0x44')]);_0x3f7cd7[_0xa3db('0x45')]=qs['filters'](_['pick'](_0xb042b6[_0xa3db('0x3a')],_0x1d5050[_0xa3db('0x3c')]),_0xc761f4);if(_0xb042b6[_0xa3db('0x3a')]['filter']){_0x3f7cd7['where']=_[_0xa3db('0x46')](_0x3f7cd7['where'],{'$or':_[_0xa3db('0x2f')](_0xc761f4,function(_0x4c7e96){if(_0x4c7e96[_0xa3db('0x31')]!==_0xa3db('0x47')){var _0x4455c5={};_0x4455c5[_0x4c7e96[_0xa3db('0x33')]]={'$like':'%'+_0xb042b6[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x4455c5;}})});}_0x3f7cd7=_[_0xa3db('0x46')]({},_0x3f7cd7,_0xb042b6['options']);var _0x4058bd={'where':_0x3f7cd7[_0xa3db('0x45')]};return db[_0xa3db('0x37')][_0xa3db('0x20')](_0x4058bd)['then'](function(_0x14cb47){_0xb5fd8c['count']=_0x14cb47;if(_0xb042b6[_0xa3db('0x3a')][_0xa3db('0x48')]){_0x3f7cd7['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xa3db('0x49')](_0x3f7cd7);})['then'](function(_0x107cbc){_0xb5fd8c[_0xa3db('0x4a')]=_0x107cbc;return _0xb5fd8c;})[_0xa3db('0x26')](respondWithFilteredResult(_0x642a06,_0x3f7cd7))[_0xa3db('0x4b')](handleError(_0x642a06,null));};exports['show']=function(_0x478383,_0x2913fe){var _0x3012e7={'raw':![],'where':{'id':_0x478383[_0xa3db('0x4c')]['id']}},_0x294971={};_0x294971[_0xa3db('0x39')]=_['keys'](db[_0xa3db('0x37')][_0xa3db('0x4d')]);_0x294971['query']=_[_0xa3db('0x3b')](_0x478383['query']);_0x294971[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x294971[_0xa3db('0x39')],_0x294971['query']);_0x3012e7[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x294971[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x478383['query'][_0xa3db('0x3f')]));_0x3012e7[_0xa3db('0x3d')]=_0x3012e7[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x3012e7[_0xa3db('0x3d')]:_0x294971[_0xa3db('0x39')];if(_0x478383[_0xa3db('0x3a')][_0xa3db('0x48')]){_0x3012e7['include']=[{'all':!![]}];}_0x3012e7=_['merge']({},_0x3012e7,_0x478383[_0xa3db('0x4e')]);return db[_0xa3db('0x37')][_0xa3db('0x32')](_0x3012e7)[_0xa3db('0x26')](handleEntityNotFound(_0x2913fe,null))['then'](respondWithResult(_0x2913fe,null))[_0xa3db('0x4b')](handleError(_0x2913fe,null));};exports[_0xa3db('0x4f')]=function(_0x102930,_0x204f49){return db[_0xa3db('0x37')]['create'](_0x102930[_0xa3db('0x50')],{})[_0xa3db('0x26')](function(_0x25ac91){var _0x56bb4f=_0x102930[_0xa3db('0x51')][_0xa3db('0x28')]({'plain':!![]});if(!_0x56bb4f)throw new Error(_0xa3db('0x52'));if(_0x56bb4f[_0xa3db('0x53')]===_0xa3db('0x51')){var _0x48597c=_0x25ac91[_0xa3db('0x28')]({'plain':!![]});var _0x507adf=[{'name':_0xa3db('0x29'),'value':_0xa3db('0x2a')},{'name':_0xa3db('0x2b'),'value':_0xa3db('0x2c')}];var _0x461b12=_[_0xa3db('0x32')](_0x507adf,[_0xa3db('0x30'),_0x48597c['type']])[_0xa3db('0x33')];return db['UserProfileSection'][_0xa3db('0x32')]({'where':{'name':_0x461b12,'userProfileId':_0x56bb4f['userProfileId']},'raw':!![]})[_0xa3db('0x26')](function(_0x40a6e0){if(_0x40a6e0&&_0x40a6e0[_0xa3db('0x54')]===0x0){return db[_0xa3db('0x55')]['create']({'name':_0x48597c['name'],'resourceId':_0x48597c['id'],'type':_0x40a6e0[_0xa3db('0x33')],'sectionId':_0x40a6e0['id']},{})['then'](function(){return _0x25ac91;});}else{return _0x25ac91;}})[_0xa3db('0x4b')](function(_0xffcb7e){logger['error'](_0xa3db('0x56'),_0xffcb7e);throw _0xffcb7e;});}return _0x25ac91;})[_0xa3db('0x26')](respondWithResult(_0x204f49,0xc9))[_0xa3db('0x4b')](handleError(_0x204f49,null));};exports[_0xa3db('0x57')]=function(_0x526c30,_0x23a0a2){var _0x45ea68={'where':{'id':_0x526c30['params']['id']}},_0x1c32c1={};_0x1c32c1[_0xa3db('0x39')]=_[_0xa3db('0x3b')](db[_0xa3db('0x37')][_0xa3db('0x4d')]);_0x45ea68[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x1c32c1['model'],qs['fields'](_0x526c30[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x45ea68['attributes']=_0x45ea68[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x45ea68['attributes']:_0x1c32c1[_0xa3db('0x39')];if(_0x526c30['query'][_0xa3db('0x48')]){_0x45ea68[_0xa3db('0x58')]=[{'all':!![]}];}_0x45ea68=_[_0xa3db('0x46')]({},_0x45ea68,_0x526c30[_0xa3db('0x4e')]);return db[_0xa3db('0x37')][_0xa3db('0x32')](_0x45ea68)[_0xa3db('0x26')](handleEntityNotFound(_0x23a0a2,null))[_0xa3db('0x26')](function(_0x31ebed){if(_0x31ebed){var _0x15fef6=_0x31ebed[_0xa3db('0x28')]({'plain':!![]});_0x15fef6=qs[_0xa3db('0x59')](_0x15fef6,['id',_0xa3db('0x5a'),_0xa3db('0x5b')]);_0x526c30['body']=_[_0xa3db('0x59')](_0x526c30[_0xa3db('0x50')],['id',_0xa3db('0x5a'),_0xa3db('0x5b')]);return db['VoiceQueue'][_0xa3db('0x4f')](_['merge'](_0x15fef6,_0x526c30[_0xa3db('0x50')]),{'include':_0x526c30[_0xa3db('0x3a')][_0xa3db('0x48')]?[{'all':!![]}]:undefined})[_0xa3db('0x26')](function(_0x1373c4){var _0x4202ae=_0x526c30[_0xa3db('0x51')][_0xa3db('0x28')]({'plain':!![]});if(!_0x4202ae)throw new Error(_0xa3db('0x52'));if(_0x4202ae[_0xa3db('0x53')]===_0xa3db('0x51')){var _0x8450ec=_0x1373c4[_0xa3db('0x28')]({'plain':!![]});var _0x1d760a=[{'name':_0xa3db('0x29'),'value':_0xa3db('0x2a')},{'name':_0xa3db('0x2b'),'value':'outbound'}];var _0x534d78=_['find'](_0x1d760a,[_0xa3db('0x30'),_0x8450ec[_0xa3db('0x31')]])[_0xa3db('0x33')];return db['UserProfileSection'][_0xa3db('0x32')]({'where':{'name':_0x534d78,'userProfileId':_0x4202ae[_0xa3db('0x5c')]},'raw':!![]})[_0xa3db('0x26')](function(_0x2381fa){if(_0x2381fa&&_0x2381fa[_0xa3db('0x54')]===0x0){return db[_0xa3db('0x55')]['create']({'name':_0x8450ec['name'],'resourceId':_0x8450ec['id'],'type':_0x2381fa[_0xa3db('0x33')],'sectionId':_0x2381fa['id']},{})[_0xa3db('0x26')](function(){return _0x1373c4;});}else{return _0x1373c4;}})[_0xa3db('0x4b')](function(_0x1287a9){logger[_0xa3db('0x34')](_0xa3db('0x56'),_0x1287a9);throw _0x1287a9;});}return _0x1373c4;});}})[_0xa3db('0x26')](respondWithResult(_0x23a0a2,0xc9))['catch'](handleError(_0x23a0a2,null));};exports[_0xa3db('0x5d')]=function(_0x2f2d91,_0x34e1a0){if(_0x2f2d91[_0xa3db('0x50')]['id']){delete _0x2f2d91[_0xa3db('0x50')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2f2d91[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x34e1a0,null))[_0xa3db('0x26')](saveUpdates(_0x2f2d91[_0xa3db('0x50')],null))[_0xa3db('0x26')](respondWithResult(_0x34e1a0,null))[_0xa3db('0x4b')](handleError(_0x34e1a0,null));};exports['destroy']=function(_0xc3d722,_0x247320){return db['VoiceQueue'][_0xa3db('0x32')]({'where':{'id':_0xc3d722[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x247320,null))[_0xa3db('0x26')](removeEntity(_0x247320,null))[_0xa3db('0x4b')](handleError(_0x247320,null));};exports['getHoppers']=function(_0x48cd5c,_0x1f20c6,_0x4d4c3d){var _0x3ab88e={'raw':![],'where':{}};var _0x2d16ae={};var _0x324e18={'count':0x0,'rows':[]};return db[_0xa3db('0x37')][_0xa3db('0x5e')]({'where':{'id':_0x48cd5c[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x1f20c6,null))[_0xa3db('0x26')](function(_0xbbafaa){if(_0xbbafaa){_0x2d16ae[_0xa3db('0x39')]=_['keys'](db[_0xa3db('0x5f')][_0xa3db('0x4d')]);_0x2d16ae[_0xa3db('0x3a')]=_[_0xa3db('0x3b')](_0x48cd5c['query']);_0x2d16ae[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x2d16ae[_0xa3db('0x39')],_0x2d16ae[_0xa3db('0x3a')]);_0x3ab88e[_0xa3db('0x3d')]=_['intersection'](_0x2d16ae[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x48cd5c[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x3ab88e[_0xa3db('0x3d')]=_0x3ab88e['attributes'][_0xa3db('0x40')]?_0x3ab88e[_0xa3db('0x3d')]:_0x2d16ae[_0xa3db('0x39')];if(!_0x48cd5c[_0xa3db('0x3a')]['hasOwnProperty'](_0xa3db('0x42'))){_0x3ab88e[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x48cd5c['query'][_0xa3db('0x1e')]);_0x3ab88e[_0xa3db('0x1d')]=qs[_0xa3db('0x1d')](_0x48cd5c[_0xa3db('0x3a')][_0xa3db('0x1d')]);}_0x3ab88e[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x48cd5c[_0xa3db('0x3a')]['sort']);_0x3ab88e['where']=qs['filters'](_[_0xa3db('0x60')](_0x48cd5c[_0xa3db('0x3a')],_0x2d16ae[_0xa3db('0x3c')]));_0x3ab88e[_0xa3db('0x45')][_0xa3db('0x61')]=_0xbbafaa['id'];if(_0x48cd5c[_0xa3db('0x3a')][_0xa3db('0x2d')]){_0x3ab88e[_0xa3db('0x45')]=_['merge'](_0x3ab88e[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x3ab88e[_0xa3db('0x3d')],function(_0x19cd8d){var _0x29f60a={};_0x29f60a[_0x19cd8d]={'$like':'%'+_0x48cd5c[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x29f60a;})});}_0x3ab88e=_[_0xa3db('0x46')]({},_0x3ab88e,_0x48cd5c['options']);return db['CmHopper']['count']({'where':_0x3ab88e[_0xa3db('0x45')]})[_0xa3db('0x26')](function(_0x5be8cc){_0x324e18['count']=_0x5be8cc;if(_0x48cd5c[_0xa3db('0x3a')][_0xa3db('0x48')]){_0x3ab88e['include']=[{'all':!![]}];}return db[_0xa3db('0x5f')][_0xa3db('0x49')](_0x3ab88e);})[_0xa3db('0x26')](function(_0x11f617){_0x324e18[_0xa3db('0x4a')]=_0x11f617;return _0x324e18;});}})['then'](respondWithFilteredResult(_0x1f20c6,_0x3ab88e))[_0xa3db('0x4b')](handleError(_0x1f20c6,null));};exports[_0xa3db('0x62')]=function(_0x179d97,_0x3a4968,_0x32a053){var _0x489326={'raw':!![],'where':{}};var _0x1531ee={};var _0x504ae7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa3db('0x5e')]({'where':{'id':_0x179d97[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x3a4968,null))[_0xa3db('0x26')](function(_0x8f091e){if(_0x8f091e){_0x1531ee[_0xa3db('0x39')]=_[_0xa3db('0x3b')](db[_0xa3db('0x63')][_0xa3db('0x4d')]);_0x1531ee[_0xa3db('0x3a')]=_['keys'](_0x179d97[_0xa3db('0x3a')]);_0x1531ee[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x1531ee[_0xa3db('0x39')],_0x1531ee['query']);_0x489326[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x1531ee['model'],qs[_0xa3db('0x3f')](_0x179d97['query']['fields']));_0x489326[_0xa3db('0x3d')]=_0x489326[_0xa3db('0x3d')]['length']?_0x489326[_0xa3db('0x3d')]:_0x1531ee[_0xa3db('0x39')];if(!_0x179d97[_0xa3db('0x3a')][_0xa3db('0x41')]('nolimit')){_0x489326[_0xa3db('0x1e')]=qs['limit'](_0x179d97['query']['limit']);_0x489326[_0xa3db('0x1d')]=qs[_0xa3db('0x1d')](_0x179d97['query']['offset']);}_0x489326[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x179d97[_0xa3db('0x3a')][_0xa3db('0x44')]);_0x489326[_0xa3db('0x45')]=qs['filters'](_[_0xa3db('0x60')](_0x179d97[_0xa3db('0x3a')],_0x1531ee[_0xa3db('0x3c')]));_0x489326[_0xa3db('0x45')]['VoiceQueueId']=_0x8f091e['id'];if(_0x179d97[_0xa3db('0x3a')]['filter']){_0x489326[_0xa3db('0x45')]=_[_0xa3db('0x46')](_0x489326['where'],{'$or':_[_0xa3db('0x2f')](_0x489326['attributes'],function(_0x164f4a){var _0x244828={};_0x244828[_0x164f4a]={'$like':'%'+_0x179d97[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x244828;})});}_0x489326=_[_0xa3db('0x46')]({},_0x489326,_0x179d97[_0xa3db('0x4e')]);return db[_0xa3db('0x63')][_0xa3db('0x20')]({'where':_0x489326[_0xa3db('0x45')]})[_0xa3db('0x26')](function(_0x409b17){_0x504ae7['count']=_0x409b17;if(_0x179d97['query'][_0xa3db('0x48')]){_0x489326[_0xa3db('0x58')]=[{'all':!![]}];}return db[_0xa3db('0x63')][_0xa3db('0x49')](_0x489326);})['then'](function(_0x302aab){_0x504ae7['rows']=_0x302aab;return _0x504ae7;});}})[_0xa3db('0x26')](respondWithFilteredResult(_0x3a4968,_0x489326))['catch'](handleError(_0x3a4968,null));};exports[_0xa3db('0x64')]=function(_0x577f97,_0x44d2ee,_0x42089b){var _0x34af09={'raw':!![],'where':{}};var _0xcf8a21={};var _0x121d32={'count':0x0,'rows':[]};return db[_0xa3db('0x37')][_0xa3db('0x5e')]({'where':{'id':_0x577f97['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x44d2ee,null))[_0xa3db('0x26')](function(_0x3a1c14){if(_0x3a1c14){_0xcf8a21[_0xa3db('0x39')]=_['keys'](db['CmHopperFinal'][_0xa3db('0x4d')]);_0xcf8a21[_0xa3db('0x3a')]=_['keys'](_0x577f97['query']);_0xcf8a21[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0xcf8a21['model'],_0xcf8a21[_0xa3db('0x3a')]);_0x34af09[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0xcf8a21[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x577f97['query'][_0xa3db('0x3f')]));_0x34af09[_0xa3db('0x3d')]=_0x34af09['attributes'][_0xa3db('0x40')]?_0x34af09['attributes']:_0xcf8a21[_0xa3db('0x39')];if(!_0x577f97[_0xa3db('0x3a')]['hasOwnProperty'](_0xa3db('0x42'))){_0x34af09[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x577f97[_0xa3db('0x3a')][_0xa3db('0x1e')]);_0x34af09['offset']=qs[_0xa3db('0x1d')](_0x577f97['query'][_0xa3db('0x1d')]);}_0x34af09[_0xa3db('0x43')]=qs['sort'](_0x577f97[_0xa3db('0x3a')]['sort']);_0x34af09['where']=qs[_0xa3db('0x3c')](_[_0xa3db('0x60')](_0x577f97[_0xa3db('0x3a')],_0xcf8a21[_0xa3db('0x3c')]));_0x34af09[_0xa3db('0x45')][_0xa3db('0x61')]=_0x3a1c14['id'];if(_0x577f97['query'][_0xa3db('0x2d')]){_0x34af09['where']=_[_0xa3db('0x46')](_0x34af09[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x34af09[_0xa3db('0x3d')],function(_0x254d13){var _0x5a1f0e={};_0x5a1f0e[_0x254d13]={'$like':'%'+_0x577f97[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x5a1f0e;})});}_0x34af09=_['merge']({},_0x34af09,_0x577f97[_0xa3db('0x4e')]);return db[_0xa3db('0x65')][_0xa3db('0x20')]({'where':_0x34af09['where']})[_0xa3db('0x26')](function(_0xe6320){_0x121d32[_0xa3db('0x20')]=_0xe6320;if(_0x577f97[_0xa3db('0x3a')][_0xa3db('0x48')]){_0x34af09[_0xa3db('0x58')]=[{'all':!![]}];}return db[_0xa3db('0x65')][_0xa3db('0x49')](_0x34af09);})[_0xa3db('0x26')](function(_0x557608){_0x121d32[_0xa3db('0x4a')]=_0x557608;return _0x121d32;});}})['then'](respondWithFilteredResult(_0x44d2ee,_0x34af09))['catch'](handleError(_0x44d2ee,null));};exports[_0xa3db('0x66')]=function(_0x566bc1,_0x3df2ca,_0x5bdb14){var _0x582568={'raw':!![],'where':{}};var _0x765d7={};var _0x4a6ec1={'count':0x0,'rows':[]};return db[_0xa3db('0x37')][_0xa3db('0x5e')]({'where':{'id':_0x566bc1[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x3df2ca,null))['then'](function(_0x4abc13){if(_0x4abc13){_0x765d7[_0xa3db('0x39')]=_[_0xa3db('0x3b')](db[_0xa3db('0x67')][_0xa3db('0x4d')]);_0x765d7[_0xa3db('0x3a')]=_['keys'](_0x566bc1[_0xa3db('0x3a')]);_0x765d7[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x765d7[_0xa3db('0x39')],_0x765d7[_0xa3db('0x3a')]);_0x582568['attributes']=_[_0xa3db('0x3e')](_0x765d7[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x566bc1['query'][_0xa3db('0x3f')]));_0x582568[_0xa3db('0x3d')]=_0x582568[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x582568['attributes']:_0x765d7['model'];if(!_0x566bc1['query'][_0xa3db('0x41')](_0xa3db('0x42'))){_0x582568[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x566bc1['query'][_0xa3db('0x1e')]);_0x582568[_0xa3db('0x1d')]=qs['offset'](_0x566bc1[_0xa3db('0x3a')][_0xa3db('0x1d')]);}_0x582568[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x566bc1[_0xa3db('0x3a')]['sort']);_0x582568[_0xa3db('0x45')]=qs[_0xa3db('0x3c')](_['pick'](_0x566bc1['query'],_0x765d7[_0xa3db('0x3c')]));_0x582568[_0xa3db('0x45')][_0xa3db('0x61')]=_0x4abc13['id'];if(_0x566bc1[_0xa3db('0x3a')]['filter']){_0x582568[_0xa3db('0x45')]=_[_0xa3db('0x46')](_0x582568[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x582568[_0xa3db('0x3d')],function(_0x228670){var _0x2b7d6d={};_0x2b7d6d[_0x228670]={'$like':'%'+_0x566bc1['query']['filter']+'%'};return _0x2b7d6d;})});}_0x582568=_[_0xa3db('0x46')]({},_0x582568,_0x566bc1[_0xa3db('0x4e')]);return db[_0xa3db('0x67')]['count']({'where':_0x582568[_0xa3db('0x45')]})['then'](function(_0x4eeddd){_0x4a6ec1[_0xa3db('0x20')]=_0x4eeddd;if(_0x566bc1[_0xa3db('0x3a')][_0xa3db('0x48')]){_0x582568[_0xa3db('0x58')]=[{'all':!![]}];}return db[_0xa3db('0x67')]['findAll'](_0x582568);})[_0xa3db('0x26')](function(_0x144f3d){_0x4a6ec1['rows']=_0x144f3d;return _0x4a6ec1;});}})[_0xa3db('0x26')](respondWithFilteredResult(_0x3df2ca,_0x582568))[_0xa3db('0x4b')](handleError(_0x3df2ca,null));};exports[_0xa3db('0x68')]=function(_0x3af283,_0x42d884,_0x3ab13f){var _0x4e52ea={};var _0x55e6aa={};var _0x254415;var _0x56175c;return db[_0xa3db('0x37')][_0xa3db('0x5e')]({'where':{'id':_0x3af283[_0xa3db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42d884,null))[_0xa3db('0x26')](function(_0xa51c0c){if(_0xa51c0c){_0x254415=_0xa51c0c;_0x55e6aa[_0xa3db('0x39')]=_[_0xa3db('0x3b')](db[_0xa3db('0x69')]['rawAttributes']);_0x55e6aa[_0xa3db('0x3a')]=_[_0xa3db('0x3b')](_0x3af283[_0xa3db('0x3a')]);_0x55e6aa[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x55e6aa[_0xa3db('0x39')],_0x55e6aa[_0xa3db('0x3a')]);_0x4e52ea[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x55e6aa['model'],qs[_0xa3db('0x3f')](_0x3af283[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x4e52ea['attributes']=_0x4e52ea['attributes'][_0xa3db('0x40')]?_0x4e52ea[_0xa3db('0x3d')]:_0x55e6aa[_0xa3db('0x39')];_0x4e52ea[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x3af283[_0xa3db('0x3a')][_0xa3db('0x44')]);_0x4e52ea['where']=qs[_0xa3db('0x3c')](_[_0xa3db('0x60')](_0x3af283[_0xa3db('0x3a')],_0x55e6aa['filters']));if(_0x3af283[_0xa3db('0x3a')][_0xa3db('0x2d')]){_0x4e52ea[_0xa3db('0x45')]=_[_0xa3db('0x46')](_0x4e52ea[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x4e52ea[_0xa3db('0x3d')],function(_0x293a2b){var _0x2a50cd={};_0x2a50cd[_0x293a2b]={'$like':'%'+_0x3af283[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x2a50cd;})});}_0x4e52ea=_['merge']({},_0x4e52ea,_0x3af283['options']);return _0x254415[_0xa3db('0x68')](_0x4e52ea);}})[_0xa3db('0x26')](function(_0x45436b){if(_0x45436b){_0x56175c=_0x45436b[_0xa3db('0x40')];if(!_0x3af283[_0xa3db('0x3a')]['hasOwnProperty'](_0xa3db('0x42'))){_0x4e52ea['limit']=qs[_0xa3db('0x1e')](_0x3af283['query'][_0xa3db('0x1e')]);_0x4e52ea[_0xa3db('0x1d')]=qs['offset'](_0x3af283['query'][_0xa3db('0x1d')]);}return _0x254415[_0xa3db('0x68')](_0x4e52ea);}})[_0xa3db('0x26')](function(_0x43306e){if(_0x43306e){return _0x43306e?{'count':_0x56175c,'rows':_0x43306e}:null;}})[_0xa3db('0x26')](respondWithResult(_0x42d884,null))[_0xa3db('0x4b')](handleError(_0x42d884,null));};exports[_0xa3db('0x6a')]=function(_0x436b2b,_0x561839,_0x3c24c){var _0x20af7f=_0x436b2b[_0xa3db('0x50')]['teams'];var _0x17abed=_['map'](_0x20af7f,'id');return db['Team'][_0xa3db('0x49')]({'where':{'id':_0x17abed},'attributes':['id'],'include':[{'model':db[_0xa3db('0x6b')],'as':'Agents','attributes':['id',_0xa3db('0x33'),_0xa3db('0x6c'),'voicePause',_0xa3db('0x6d')],'raw':!![]}]})['then'](function(_0x2b866d){if(_0x2b866d){var _0x484458=_[_0xa3db('0x6e')](_0x2b866d,function(_0x2718f0){var _0x472207=_0x2718f0[_0xa3db('0x28')]({'plain':!![]});_0x472207[_0xa3db('0x6f')][_0xa3db('0x70')](function(_0x1219c6){_0x1219c6['penalty']=_['find'](_0x20af7f,{'id':_0x472207['id']})[_0xa3db('0x71')];});return _0x472207[_0xa3db('0x6f')];});return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x436b2b['params']['id']}})[_0xa3db('0x26')](function(_0x48cadf){return db[_0xa3db('0x72')][_0xa3db('0x73')](function(_0x5303fa){return _0x48cadf[_0xa3db('0x6a')](_0x17abed,{'transaction':_0x5303fa})[_0xa3db('0x26')](function(){return BPromise['each'](_0x20af7f,function(_0x2c11c9){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x2c11c9['id'],'VoiceQueueId':_0x436b2b['params']['id'],'penalty':_0x2c11c9[_0xa3db('0x71')]},{'transaction':_0x5303fa});});})[_0xa3db('0x26')](function(){return BPromise[_0xa3db('0x74')](_0x484458,function(_0x4bf7be){return db[_0xa3db('0x75')][_0xa3db('0x76')]({'where':{'UserId':_0x4bf7be['id'],'VoiceQueueId':_0x436b2b['params']['id']},'defaults':{'penalty':_0x4bf7be[_0xa3db('0x71')]},'transaction':_0x5303fa});});})[_0xa3db('0x26')](function(){return BPromise[_0xa3db('0x74')](_[_0xa3db('0x2d')](_0x484458,{'online':!![]}),function(_0x58a014){return db[_0xa3db('0x77')]['upsert']({'membername':_0x58a014[_0xa3db('0x33')],'UserId':_0x58a014['id'],'queue_name':_0x48cadf['name'],'VoiceQueueId':_0x48cadf['id'],'interface':_[_0xa3db('0x78')](_0x58a014['interface'])?util['format'](_0xa3db('0x79'),_0x58a014['name']):_0x58a014[_0xa3db('0x6d')],'paused':_0x58a014[_0xa3db('0x7a')]||![],'penalty':_0x58a014[_0xa3db('0x71')]},{'transaction':_0x5303fa});});})['then'](function(){_0x484458[_0xa3db('0x70')](function(_0x5d9616){socket['emit'](_0xa3db('0x7b'),{'UserId':_0x5d9616['id'],'VoiceQueueId':_0x48cadf['id']});});});});});}})['then'](respondWithStatusCode(_0x561839,null))[_0xa3db('0x4b')](handleError(_0x561839,null));};exports[_0xa3db('0x7c')]=function(_0x1bf5ee,_0x2b84b6,_0x288b46){return db[_0xa3db('0x69')]['findAll']({'where':{'id':_0x1bf5ee[_0xa3db('0x3a')][_0xa3db('0x7d')]},'attributes':['id'],'include':[{'model':db[_0xa3db('0x6b')],'as':_0xa3db('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa3db('0x26')](handleEntityNotFound(_0x2b84b6,null))[_0xa3db('0x26')](function(_0x5a8018){var _0x5b3abe=_[_0xa3db('0x2f')](_0x5a8018,'id');var _0x1800a6=[];var _0x532d93=[];var _0x5227c6=squel['select']();_0x5227c6['field'](_0xa3db('0x7e'))[_0xa3db('0x7f')](_0xa3db('0x80'),'tq')['join'](_0xa3db('0x81'),'ut',_0xa3db('0x82'))[_0xa3db('0x45')](_0xa3db('0x83'),_0x1bf5ee[_0xa3db('0x4c')]['id']);for(var _0x499d53=0x0;_0x499d53<_0x5a8018[_0xa3db('0x40')];_0x499d53+=0x1){let _0x36a4aa=_0x5a8018[_0x499d53];for(var _0x45097d=0x0;_0x45097d<_0x36a4aa['Agents'][_0xa3db('0x40')];_0x45097d+=0x1){let _0x2e5b89=_0x36a4aa[_0xa3db('0x6f')][_0x45097d];var _0x466f6d=_0x5227c6[_0xa3db('0x57')]();_0x466f6d[_0xa3db('0x45')](_0xa3db('0x84'),_0x2e5b89['id']);_0x532d93['push'](db[_0xa3db('0x72')]['query'](_0x466f6d[_0xa3db('0x85')](),{'type':db['sequelize']['QueryTypes'][_0xa3db('0x86')]})[_0xa3db('0x26')](function(_0x1168e3){if(_0x1168e3['length']===0x1){return _0x2e5b89['id'];}else{var _0x137556=_[_0xa3db('0x87')](_[_0xa3db('0x2f')](_0x1168e3,_0xa3db('0x88')),function(_0xe1de2b){return _['includes'](_0x5b3abe,_0xe1de2b);});if(_0x137556){return _0x2e5b89['id'];}}}));}}return BPromise[_0xa3db('0x89')](_0x532d93)[_0xa3db('0x26')](function(_0x263513){_0x1800a6=_(_0x1800a6)[_0xa3db('0x8a')](_0x263513)[_0xa3db('0x8b')]()[_0xa3db('0x30')]();return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x1bf5ee['params']['id']}})[_0xa3db('0x26')](function(_0x305852){return db['sequelize'][_0xa3db('0x73')](function(_0x52fde6){return _0x305852[_0xa3db('0x7c')](_0x1bf5ee['query'][_0xa3db('0x7d')],{'transaction':_0x52fde6})[_0xa3db('0x26')](function(){if(!_[_0xa3db('0x8c')](_0x1800a6)){return _0x305852[_0xa3db('0x8d')](_0x1800a6,{'transaction':_0x52fde6})[_0xa3db('0x26')](function(){return db[_0xa3db('0x77')][_0xa3db('0x27')]({'where':{'VoiceQueueId':_0x1bf5ee[_0xa3db('0x4c')]['id'],'UserId':_0x1800a6},'transaction':_0x52fde6});});}})[_0xa3db('0x26')](function(){_0x1800a6['forEach'](function(_0x472be9){socket[_0xa3db('0x8e')]('userVoiceQueue:remove',{'UserId':_0x472be9,'VoiceQueueId':_0x305852['id']});});});});});});})[_0xa3db('0x26')](respondWithStatusCode(_0x2b84b6,null))[_0xa3db('0x4b')](handleError(_0x2b84b6,null));};exports[_0xa3db('0x8f')]=function(_0x3f4998,_0x3658cf,_0x811887){var _0x37b074,_0x1c0c68;return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x3f4998['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x3658cf,null))[_0xa3db('0x26')](function(_0x30e292){if(_0x30e292){_0x1c0c68=_0x30e292;return _0x30e292[_0xa3db('0x8f')](_0x3f4998[_0xa3db('0x50')][_0xa3db('0x7d')],_[_0xa3db('0x59')](_0x3f4998[_0xa3db('0x50')],[_0xa3db('0x7d'),'id'])||{})[_0xa3db('0x90')](function(_0xdd6fcc){for(var _0x336f31=0x0;_0x336f31<_0x3f4998['body'][_0xa3db('0x7d')][_0xa3db('0x40')];_0x336f31+=0x1){socket[_0xa3db('0x8e')]('userVoiceQueue:save',{'UserId':Number(_0x3f4998[_0xa3db('0x50')][_0xa3db('0x7d')][_0x336f31]),'VoiceQueueId':Number(_0x3f4998[_0xa3db('0x4c')]['id'])});}return _0xdd6fcc;});}})[_0xa3db('0x26')](function(_0x4aed99){_0x37b074=_0x4aed99||[];if(_0x1c0c68){return db[_0xa3db('0x6b')]['findAll']({'where':{'id':_0x3f4998[_0xa3db('0x50')][_0xa3db('0x7d')]},'attributes':['id',_0xa3db('0x33'),_0xa3db('0x6c'),_0xa3db('0x7a'),_0xa3db('0x6d')],'raw':!![]});}})['then'](function(_0x161bf2){if(!_[_0xa3db('0x8c')](_0x161bf2)){var _0x3bf31f=[];for(var _0x15cb72=0x0;_0x15cb72<_0x161bf2['length'];_0x15cb72++){if(_0x161bf2[_0x15cb72][_0xa3db('0x6c')]){_0x3bf31f[_0xa3db('0x91')](db['UserVoiceQueueRt'][_0xa3db('0x92')]({'membername':_0x161bf2[_0x15cb72][_0xa3db('0x33')],'UserId':_0x161bf2[_0x15cb72]['id'],'queue_name':_0x1c0c68['name'],'VoiceQueueId':_0x1c0c68['id'],'interface':_['isNil'](_0x161bf2[_0x15cb72]['interface'])?util[_0xa3db('0x93')](_0xa3db('0x79'),_0x161bf2[_0x15cb72][_0xa3db('0x33')]):_0x161bf2[_0x15cb72][_0xa3db('0x6d')],'paused':_0x161bf2[_0x15cb72][_0xa3db('0x7a')]||![],'penalty':_0x3f4998[_0xa3db('0x50')]['penalty']||0x0}));}}return BPromise[_0xa3db('0x89')](_0x3bf31f);}})[_0xa3db('0x26')](function(){return _0x37b074;})['then'](respondWithResult(_0x3658cf,null))[_0xa3db('0x4b')](handleError(_0x3658cf,null));};exports[_0xa3db('0x8d')]=function(_0x5d0ebc,_0x41d91b,_0x3f029f){return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x5d0ebc[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x41d91b,null))[_0xa3db('0x26')](function(_0xffba5c){if(_0xffba5c){return _0xffba5c[_0xa3db('0x8d')](_0x5d0ebc[_0xa3db('0x3a')][_0xa3db('0x7d')])[_0xa3db('0x26')](function(){if(_[_0xa3db('0x94')](_0x5d0ebc[_0xa3db('0x3a')][_0xa3db('0x7d')])){for(var _0x723e32=0x0;_0x723e32<_0x5d0ebc[_0xa3db('0x3a')]['ids'][_0xa3db('0x40')];_0x723e32+=0x1){socket['emit'](_0xa3db('0x95'),{'UserId':Number(_0x5d0ebc[_0xa3db('0x3a')]['ids'][_0x723e32]),'VoiceQueueId':Number(_0x5d0ebc[_0xa3db('0x4c')]['id'])});}}else{socket[_0xa3db('0x8e')](_0xa3db('0x95'),{'UserId':Number(_0x5d0ebc['query'][_0xa3db('0x7d')]),'VoiceQueueId':Number(_0x5d0ebc[_0xa3db('0x4c')]['id'])});}});}})['then'](function(_0x3fe11b){return db[_0xa3db('0x77')]['destroy']({'where':{'VoiceQueueId':_0x5d0ebc['params']['id'],'UserId':_0x5d0ebc[_0xa3db('0x3a')]['ids']}})[_0xa3db('0x26')](function(){return _0x3fe11b;});})[_0xa3db('0x26')](respondWithStatusCode(_0x41d91b,null))[_0xa3db('0x4b')](handleError(_0x41d91b,null));};exports[_0xa3db('0x96')]=function(_0x3a1f1c,_0x5e0558,_0x4337ca){var _0xc0ffeb={};var _0x521311={};var _0xeefc31;var _0x33d486;return db['VoiceQueue'][_0xa3db('0x5e')]({'where':{'id':_0x3a1f1c['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x5e0558,null))[_0xa3db('0x26')](function(_0x3005c2){if(_0x3005c2){_0xeefc31=_0x3005c2;_0x521311[_0xa3db('0x39')]=_['keys'](db[_0xa3db('0x6b')][_0xa3db('0x4d')]);_0x521311[_0xa3db('0x3a')]=_[_0xa3db('0x3b')](_0x3a1f1c['query']);_0x521311[_0xa3db('0x3c')]=_['intersection'](_0x521311['model'],_0x521311[_0xa3db('0x3a')]);_0xc0ffeb[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x521311[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x3a1f1c[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0xc0ffeb[_0xa3db('0x3d')]=_0xc0ffeb[_0xa3db('0x3d')][_0xa3db('0x40')]?_0xc0ffeb[_0xa3db('0x3d')]:_0x521311[_0xa3db('0x39')];_0xc0ffeb['order']=qs[_0xa3db('0x44')](_0x3a1f1c[_0xa3db('0x3a')][_0xa3db('0x44')]);_0xc0ffeb[_0xa3db('0x45')]=qs['filters'](_[_0xa3db('0x60')](_0x3a1f1c[_0xa3db('0x3a')],_0x521311[_0xa3db('0x3c')]));if(_0x3a1f1c[_0xa3db('0x3a')]['filter']){_0xc0ffeb[_0xa3db('0x45')]=_[_0xa3db('0x46')](_0xc0ffeb[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0xc0ffeb['attributes'],function(_0x262ce4){var _0x23a6f6={};_0x23a6f6[_0x262ce4]={'$like':'%'+_0x3a1f1c[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0x23a6f6;})});}_0xc0ffeb=_[_0xa3db('0x46')]({},_0xc0ffeb,_0x3a1f1c[_0xa3db('0x4e')]);return _0xeefc31[_0xa3db('0x96')](_0xc0ffeb);}})['then'](function(_0x467279){if(_0x467279){_0x33d486=_0x467279['length'];if(!_0x3a1f1c[_0xa3db('0x3a')]['hasOwnProperty']('nolimit')){_0xc0ffeb[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x3a1f1c[_0xa3db('0x3a')]['limit']);_0xc0ffeb['offset']=qs['offset'](_0x3a1f1c['query'][_0xa3db('0x1d')]);}return _0xeefc31[_0xa3db('0x96')](_0xc0ffeb);}})[_0xa3db('0x26')](function(_0x31c9b3){if(_0x31c9b3){return _0x31c9b3?{'count':_0x33d486,'rows':_0x31c9b3}:null;}})['then'](respondWithResult(_0x5e0558,null))['catch'](handleError(_0x5e0558,null));};exports[_0xa3db('0x97')]=function(_0x57350e,_0x52b1db,_0x197d7a){var _0x3367f7={};var _0x1e2077={};var _0x49aecd;var _0x5940ef;return db[_0xa3db('0x37')]['findOne']({'where':{'id':_0x57350e['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x52b1db,null))[_0xa3db('0x26')](function(_0x3dde95){if(_0x3dde95){_0x49aecd=_0x3dde95;_0x1e2077[_0xa3db('0x39')]=_['keys'](db[_0xa3db('0x77')][_0xa3db('0x4d')]);_0x1e2077['query']=_[_0xa3db('0x3b')](_0x57350e['query']);_0x1e2077[_0xa3db('0x3c')]=_['intersection'](_0x1e2077[_0xa3db('0x39')],_0x1e2077[_0xa3db('0x3a')]);_0x3367f7[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x1e2077[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x57350e['query'][_0xa3db('0x3f')]));_0x3367f7[_0xa3db('0x3d')]=_0x3367f7[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x3367f7[_0xa3db('0x3d')]:_0x1e2077[_0xa3db('0x39')];_0x3367f7[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x57350e[_0xa3db('0x3a')]['sort']);_0x3367f7['where']=qs['filters'](_[_0xa3db('0x60')](_0x57350e[_0xa3db('0x3a')],_0x1e2077[_0xa3db('0x3c')]));if(_0x57350e[_0xa3db('0x3a')]['filter']){_0x3367f7[_0xa3db('0x45')]=_[_0xa3db('0x46')](_0x3367f7[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x3367f7[_0xa3db('0x3d')],function(_0x39aa00){var _0x126f45={};_0x126f45[_0x39aa00]={'$like':'%'+_0x57350e[_0xa3db('0x3a')]['filter']+'%'};return _0x126f45;})});}_0x3367f7=_[_0xa3db('0x46')]({},_0x3367f7,_0x57350e['options']);return _0x49aecd['getMembers'](_0x3367f7);}})[_0xa3db('0x26')](function(_0x29c172){if(_0x29c172){_0x5940ef=_0x29c172[_0xa3db('0x40')];if(!_0x57350e[_0xa3db('0x3a')][_0xa3db('0x41')]('nolimit')){_0x3367f7[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x57350e[_0xa3db('0x3a')][_0xa3db('0x1e')]);_0x3367f7['offset']=qs[_0xa3db('0x1d')](_0x57350e['query'][_0xa3db('0x1d')]);}return _0x49aecd['getMembers'](_0x3367f7);}})[_0xa3db('0x26')](function(_0x47a07e){return _0x47a07e?{'count':_0x5940ef,'rows':_0x47a07e}:null;})['then'](respondWithResult(_0x52b1db,null))[_0xa3db('0x4b')](handleError(_0x52b1db,null));};exports[_0xa3db('0x98')]=function(_0x9d72fe,_0xc7376e,_0x4529c9){var _0x263a23={};var _0x3f2a0f={};var _0x6b8e97;var _0x3ab14d;return db[_0xa3db('0x37')]['findOne']({'where':{'id':_0x9d72fe[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0xc7376e,null))[_0xa3db('0x26')](function(_0x32a13b){if(_0x32a13b){_0x6b8e97=_0x32a13b;_0x3f2a0f['model']=_[_0xa3db('0x3b')](db[_0xa3db('0x99')][_0xa3db('0x4d')]);_0x3f2a0f['query']=_['keys'](_0x9d72fe['query']);_0x3f2a0f[_0xa3db('0x3c')]=_['intersection'](_0x3f2a0f[_0xa3db('0x39')],_0x3f2a0f[_0xa3db('0x3a')]);_0x263a23[_0xa3db('0x3d')]=_[_0xa3db('0x3e')](_0x3f2a0f[_0xa3db('0x39')],qs[_0xa3db('0x3f')](_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x263a23[_0xa3db('0x3d')]=_0x263a23[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x263a23[_0xa3db('0x3d')]:_0x3f2a0f['model'];_0x263a23[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x44')]);_0x263a23[_0xa3db('0x45')]=qs[_0xa3db('0x3c')](_[_0xa3db('0x60')](_0x9d72fe['query'],_0x3f2a0f['filters']));if(_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x2d')]){_0x263a23['where']=_[_0xa3db('0x46')](_0x263a23[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x263a23['attributes'],function(_0x35a593){var _0x2de7ce={};_0x2de7ce[_0x35a593]={'$like':'%'+_0x9d72fe[_0xa3db('0x3a')]['filter']+'%'};return _0x2de7ce;})});}_0x263a23=_[_0xa3db('0x46')]({},_0x263a23,_0x9d72fe[_0xa3db('0x4e')]);return _0x6b8e97[_0xa3db('0x98')](_0x263a23);}})[_0xa3db('0x26')](function(_0x1aaeec){if(_0x1aaeec){_0x3ab14d=_0x1aaeec[_0xa3db('0x40')];if(!_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x41')]('nolimit')){_0x263a23[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x1e')]);_0x263a23[_0xa3db('0x1d')]=qs[_0xa3db('0x1d')](_0x9d72fe[_0xa3db('0x3a')][_0xa3db('0x1d')]);}return _0x6b8e97[_0xa3db('0x98')](_0x263a23);}})[_0xa3db('0x26')](function(_0x137c52){if(_0x137c52){return _0x137c52?{'count':_0x3ab14d,'rows':_0x137c52}:null;}})[_0xa3db('0x26')](respondWithResult(_0xc7376e,null))[_0xa3db('0x4b')](handleError(_0xc7376e,null));};exports[_0xa3db('0x9a')]=function(_0x33930f,_0x19af57,_0xca124){var _0x5a1529=moment()[_0xa3db('0x93')](_0xa3db('0x9b'));var _0x15c0fb,_0x2b2ca8;return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x33930f[_0xa3db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x19af57,null))[_0xa3db('0x26')](function(_0x48f7b7){if(_0x48f7b7){_0x2b2ca8=_0x48f7b7;return _0x48f7b7[_0xa3db('0x9a')](_0x33930f[_0xa3db('0x50')][_0xa3db('0x7d')],_[_0xa3db('0x59')](_0x33930f['body'],[_0xa3db('0x7d'),'id'])||{});}return null;})[_0xa3db('0x90')](function(_0x49fac3){var _0x40a3c5;_0x15c0fb=_0x49fac3||[];var _0x3ab352=[];if(_0x49fac3){for(var _0x134137=0x0;_0x134137<_0x49fac3[_0xa3db('0x40')];_0x134137+=0x1){var _0x4e5f08=_0x49fac3[_0x134137][_0xa3db('0x28')]({'plain':!![]});_0x2b2ca8[_0xa3db('0x9c')]=_0x33930f[_0xa3db('0x50')][_0xa3db('0x9c')]?_0x33930f[_0xa3db('0x50')][_0xa3db('0x9c')]:_0x2b2ca8['dialCheckDuplicateType'];switch(_0x2b2ca8[_0xa3db('0x9c')]){case'always':_0x40a3c5=squel[_0xa3db('0x9d')]()['into'](_0xa3db('0x9e'))[_0xa3db('0x9f')]([_0xa3db('0xa0'),_0xa3db('0xa1'),_0xa3db('0xa2'),'ListId',_0xa3db('0x61'),_0xa3db('0x5a'),_0xa3db('0x5b')],squel['select']()[_0xa3db('0xa3')](_0xa3db('0xa0'),_0xa3db('0xa0'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0xa1'))[_0xa3db('0xa3')]('id',_0xa3db('0xa2'))[_0xa3db('0xa3')](_0x4e5f08[_0xa3db('0xa4')][_0xa3db('0x85')](),_0xa3db('0xa5'))[_0xa3db('0xa3')](_0x33930f['params']['id'][_0xa3db('0x85')](),'VoiceQueueId')[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0x5a'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27','updatedAt')[_0xa3db('0x7f')](_0xa3db('0xa6'))[_0xa3db('0x45')](_0xa3db('0xa7'))[_0xa3db('0x45')](_0xa3db('0xa8'),_0x4e5f08[_0xa3db('0xa4')][_0xa3db('0x85')]())[_0xa3db('0x45')](_0xa3db('0xa9'))[_0xa3db('0x45')](_0xa3db('0xaa'),squel[_0xa3db('0xab')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0xa3db('0xac'))[_0xa3db('0x45')]('VoiceQueueId\x20=\x20?',_0x33930f['params']['id'][_0xa3db('0x85')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa3db('0xad'))[_0xa3db('0x7f')](_0xa3db('0x9e'))[_0xa3db('0x45')]('VoiceQueueId\x20=\x20?',_0x33930f[_0xa3db('0x4c')]['id']['toString']())))[_0xa3db('0x85')]();break;case _0xa3db('0xae'):_0x40a3c5=squel[_0xa3db('0x9d')]()[_0xa3db('0xaf')](_0xa3db('0x9e'))[_0xa3db('0x9f')]([_0xa3db('0xa0'),_0xa3db('0xa1'),_0xa3db('0xa2'),'ListId',_0xa3db('0x61'),'createdAt',_0xa3db('0x5b')],squel[_0xa3db('0xab')]()[_0xa3db('0xa3')](_0xa3db('0xa0'),_0xa3db('0xa0'))['field']('\x27'+_0x5a1529+'\x27',_0xa3db('0xa1'))[_0xa3db('0xa3')]('id',_0xa3db('0xa2'))[_0xa3db('0xa3')](_0x4e5f08[_0xa3db('0xa4')]['toString'](),'ListId')[_0xa3db('0xa3')](_0x33930f['params']['id'][_0xa3db('0x85')](),_0xa3db('0x61'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0x5a'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0x5b'))[_0xa3db('0x7f')](_0xa3db('0xa6'))[_0xa3db('0x45')](_0xa3db('0xa7'))['where']('ListId\x20=\x20?',_0x4e5f08[_0xa3db('0xa4')][_0xa3db('0x85')]())['where'](_0xa3db('0xa9'))['where'](_0xa3db('0xaa'),squel[_0xa3db('0xab')]()[_0xa3db('0xa3')](_0xa3db('0xad'))['from'](_0xa3db('0x9e'))[_0xa3db('0x45')](_0xa3db('0x83'),_0x33930f['params']['id']['toString']())))[_0xa3db('0x85')]();break;default:_0x40a3c5=squel[_0xa3db('0x9d')]()[_0xa3db('0xaf')](_0xa3db('0x9e'))[_0xa3db('0x9f')]([_0xa3db('0xa0'),_0xa3db('0xa1'),_0xa3db('0xa2'),'ListId',_0xa3db('0x61'),'createdAt',_0xa3db('0x5b')],squel[_0xa3db('0xab')]()[_0xa3db('0xa3')]('phone',_0xa3db('0xa0'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0xa1'))[_0xa3db('0xa3')]('id',_0xa3db('0xa2'))[_0xa3db('0xa3')](_0x4e5f08['CmListId'][_0xa3db('0x85')](),'ListId')[_0xa3db('0xa3')](_0x33930f[_0xa3db('0x4c')]['id'][_0xa3db('0x85')](),_0xa3db('0x61'))['field']('\x27'+_0x5a1529+'\x27',_0xa3db('0x5a'))[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0x5b'))[_0xa3db('0x7f')](_0xa3db('0xa6'))[_0xa3db('0x45')]('deletedAt\x20IS\x20NULL')[_0xa3db('0x45')](_0xa3db('0xa8'),_0x4e5f08['CmListId'][_0xa3db('0x85')]())[_0xa3db('0x45')](_0xa3db('0xa9')))[_0xa3db('0x85')]();}_0x3ab352[_0xa3db('0x91')](db[_0xa3db('0x72')][_0xa3db('0x3a')](_0x40a3c5));}return BPromise['all'](_0x3ab352);}})['then'](function(){var _0x5758ff=[];var _0x47a991=squel[_0xa3db('0x9d')]()['into'](_0xa3db('0xb0'))[_0xa3db('0x9f')]([_0xa3db('0xb1'),_0xa3db('0xa0'),'OrderBy',_0xa3db('0x5a'),'updatedAt'],squel[_0xa3db('0xab')]()[_0xa3db('0xa3')](_0xa3db('0xb2'))['field'](_0xa3db('0xb3'))[_0xa3db('0xa3')](_0xa3db('0xb4'))['field']('\x27'+_0x5a1529+'\x27','createdAt')[_0xa3db('0xa3')]('\x27'+_0x5a1529+'\x27',_0xa3db('0x5b'))[_0xa3db('0x7f')]('cm_contact_has_items','ci')[_0xa3db('0xb5')]('cm_hopper','h',_0xa3db('0xb6'))[_0xa3db('0x45')](_0xa3db('0xb7'),_0x5a1529)[_0xa3db('0x45')](_0xa3db('0xb8'),_0xa3db('0xb9')))['toString']();_0x5758ff[_0xa3db('0x91')](db[_0xa3db('0x72')][_0xa3db('0x3a')](_0x47a991));return BPromise['all'](_0x5758ff);})['then'](function(){return _0x15c0fb;})[_0xa3db('0x26')](respondWithResult(_0x19af57,null))[_0xa3db('0x4b')](handleError(_0x19af57,null));};exports[_0xa3db('0xba')]=function(_0x1a8196,_0x1de32d,_0x138daa){return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x1a8196['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x1de32d,null))['then'](function(_0x26e09d){if(_0x26e09d){return _0x26e09d['removeLists'](_0x1a8196['query'][_0xa3db('0x7d')]);}})[_0xa3db('0x26')](function(_0x2fae28){if(_0x2fae28){return db[_0xa3db('0x5f')][_0xa3db('0x27')]({'where':{'ListId':_0x1a8196[_0xa3db('0x3a')][_0xa3db('0x7d')],'VoiceQueueId':_0x1a8196['params']['id']}})[_0xa3db('0x26')](function(){return _0x2fae28;});}})[_0xa3db('0x26')](respondWithStatusCode(_0x1de32d,null))[_0xa3db('0x4b')](handleError(_0x1de32d,null));};exports[_0xa3db('0xbb')]=function(_0xcfaa7c,_0x28a258,_0x511db9){var _0x55ab8d={};var _0x124323={};var _0x41d6a8;var _0xff4d30;return db['VoiceQueue'][_0xa3db('0x5e')]({'where':{'id':_0xcfaa7c[_0xa3db('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28a258,null))['then'](function(_0x335105){if(_0x335105){_0x41d6a8=_0x335105;_0x124323[_0xa3db('0x39')]=_[_0xa3db('0x3b')](db['CmList'][_0xa3db('0x4d')]);_0x124323[_0xa3db('0x3a')]=_[_0xa3db('0x3b')](_0xcfaa7c['query']);_0x124323[_0xa3db('0x3c')]=_[_0xa3db('0x3e')](_0x124323[_0xa3db('0x39')],_0x124323[_0xa3db('0x3a')]);_0x55ab8d[_0xa3db('0x3d')]=_['intersection'](_0x124323['model'],qs[_0xa3db('0x3f')](_0xcfaa7c[_0xa3db('0x3a')][_0xa3db('0x3f')]));_0x55ab8d[_0xa3db('0x3d')]=_0x55ab8d[_0xa3db('0x3d')][_0xa3db('0x40')]?_0x55ab8d[_0xa3db('0x3d')]:_0x124323[_0xa3db('0x39')];_0x55ab8d[_0xa3db('0x43')]=qs[_0xa3db('0x44')](_0xcfaa7c['query'][_0xa3db('0x44')]);_0x55ab8d[_0xa3db('0x45')]=qs[_0xa3db('0x3c')](_[_0xa3db('0x60')](_0xcfaa7c[_0xa3db('0x3a')],_0x124323[_0xa3db('0x3c')]));if(_0xcfaa7c[_0xa3db('0x3a')]['filter']){_0x55ab8d[_0xa3db('0x45')]=_['merge'](_0x55ab8d[_0xa3db('0x45')],{'$or':_[_0xa3db('0x2f')](_0x55ab8d[_0xa3db('0x3d')],function(_0x5459fb){var _0xbd1ccd={};_0xbd1ccd[_0x5459fb]={'$like':'%'+_0xcfaa7c[_0xa3db('0x3a')][_0xa3db('0x2d')]+'%'};return _0xbd1ccd;})});}_0x55ab8d=_[_0xa3db('0x46')]({},_0x55ab8d,_0xcfaa7c[_0xa3db('0x4e')]);return _0x41d6a8[_0xa3db('0xbb')](_0x55ab8d);}})[_0xa3db('0x26')](function(_0x159d65){if(_0x159d65){_0xff4d30=_0x159d65['length'];if(!_0xcfaa7c[_0xa3db('0x3a')]['hasOwnProperty']('nolimit')){_0x55ab8d[_0xa3db('0x1e')]=qs[_0xa3db('0x1e')](_0xcfaa7c[_0xa3db('0x3a')][_0xa3db('0x1e')]);_0x55ab8d[_0xa3db('0x1d')]=qs[_0xa3db('0x1d')](_0xcfaa7c['query']['offset']);}return _0x41d6a8[_0xa3db('0xbb')](_0x55ab8d);}})[_0xa3db('0x26')](function(_0x3feae1){if(_0x3feae1){return _0x3feae1?{'count':_0xff4d30,'rows':_0x3feae1}:null;}})[_0xa3db('0x26')](respondWithResult(_0x28a258,null))[_0xa3db('0x4b')](handleError(_0x28a258,null));};exports['addBlackLists']=function(_0x4697be,_0x1cd967,_0x34d728){var _0x3d838d,_0x37481e;return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x4697be['params']['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x1cd967,null))['then'](function(_0x5ea68e){if(_0x5ea68e){_0x37481e=_0x5ea68e;return _0x5ea68e['addBlackLists'](_0x4697be[_0xa3db('0x50')][_0xa3db('0x7d')],_[_0xa3db('0x59')](_0x4697be['body'],['ids','id'])||{});}return null;})[_0xa3db('0x90')](function(_0x24ebdb){var _0x356ae4;_0x3d838d=_0x24ebdb||[];var _0x13a915=[];if(_0x24ebdb){for(var _0x2d106e=0x0;_0x2d106e<_0x24ebdb['length'];_0x2d106e+=0x1){var _0x41bdff=_0x24ebdb[_0x2d106e][_0xa3db('0x28')]({'plain':!![]});_0x356ae4=squel[_0xa3db('0x9d')]()['into'](_0xa3db('0xbc'))['fromQuery']([_0xa3db('0xa0'),_0xa3db('0xa2'),_0xa3db('0xa5'),_0xa3db('0x61'),_0xa3db('0x5a'),_0xa3db('0x5b')],squel[_0xa3db('0xab')]()[_0xa3db('0xa3')](_0xa3db('0xa0'),_0xa3db('0xa0'))[_0xa3db('0xa3')]('id','ContactId')[_0xa3db('0xa3')](_0x41bdff[_0xa3db('0xa4')][_0xa3db('0x85')](),_0xa3db('0xa5'))[_0xa3db('0xa3')](_0x4697be[_0xa3db('0x4c')]['id']['toString'](),_0xa3db('0x61'))[_0xa3db('0xa3')](_0xa3db('0xbd'),_0xa3db('0x5a'))[_0xa3db('0xa3')]('NOW()','updatedAt')[_0xa3db('0x7f')](_0xa3db('0xa6'))['where']('deletedAt\x20IS\x20NULL')[_0xa3db('0x45')](_0xa3db('0xa8'),_0x41bdff[_0xa3db('0xa4')][_0xa3db('0x85')]())[_0xa3db('0x45')](_0xa3db('0xa9')))[_0xa3db('0x85')]();_0x13a915[_0xa3db('0x91')](db[_0xa3db('0x72')][_0xa3db('0x3a')](_0x356ae4));}return BPromise['all'](_0x13a915);}})[_0xa3db('0x26')](function(){return _0x3d838d;})[_0xa3db('0x26')](respondWithResult(_0x1cd967,null))[_0xa3db('0x4b')](handleError(_0x1cd967,null));};exports[_0xa3db('0xbe')]=function(_0x2a585c,_0x95953e,_0xa79516){return db[_0xa3db('0x37')][_0xa3db('0x32')]({'where':{'id':_0x2a585c[_0xa3db('0x4c')]['id']}})[_0xa3db('0x26')](handleEntityNotFound(_0x95953e,null))['then'](function(_0x1c56a7){if(_0x1c56a7){return _0x1c56a7['removeBlackLists'](_0x2a585c[_0xa3db('0x3a')]['ids']);}})[_0xa3db('0x26')](function(_0x47a634){if(_0x47a634){return db[_0xa3db('0x67')][_0xa3db('0x27')]({'where':{'ListId':_0x2a585c[_0xa3db('0x3a')][_0xa3db('0x7d')],'VoiceQueueId':_0x2a585c['params']['id']}})[_0xa3db('0x26')](function(){return _0x47a634;});}})[_0xa3db('0x26')](respondWithStatusCode(_0x95953e,null))['catch'](handleError(_0x95953e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5335f4a..089c976 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 _0x8997=['emit','hasOwnProperty','hook','../../mysqldb','VoiceQueue','update'];(function(_0x22cff2,_0x5ad3ed){var _0x27b388=function(_0x1146d0){while(--_0x1146d0){_0x22cff2['push'](_0x22cff2['shift']());}};_0x27b388(++_0x5ad3ed);}(_0x8997,0x15f));var _0x7899=function(_0x4798d3,_0x1a3419){_0x4798d3=_0x4798d3-0x0;var _0x45b361=_0x8997[_0x4798d3];return _0x45b361;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x7899('0x0'))['db'][_0x7899('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7899('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5759b8){return function(_0x463d7b,_0x51c9b0,_0x105f01){VoiceQueueEvents[_0x7899('0x3')](_0x5759b8+':'+_0x463d7b['id'],_0x463d7b);VoiceQueueEvents[_0x7899('0x3')](_0x5759b8,_0x463d7b);_0x105f01(null);};}for(var e in events){if(events[_0x7899('0x4')](e)){var event=events[e];VoiceQueue[_0x7899('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xdd93=['setMaxListeners','update','remove','hasOwnProperty','hook','exports','VoiceQueue'];(function(_0x27d616,_0x7e0d30){var _0x531895=function(_0x41e63f){while(--_0x41e63f){_0x27d616['push'](_0x27d616['shift']());}};_0x531895(++_0x7e0d30);}(_0xdd93,0x109));var _0x3dd9=function(_0x2760be,_0x37056d){_0x2760be=_0x2760be-0x0;var _0x2b89dc=_0xdd93[_0x2760be];return _0x2b89dc;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x3dd9('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3dd9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dd9('0x2'),'afterDestroy':_0x3dd9('0x3')};function emitEvent(_0x1e6698){return function(_0x2f72a0,_0x2d0f7b,_0x40bbe1){VoiceQueueEvents['emit'](_0x1e6698+':'+_0x2f72a0['id'],_0x2f72a0);VoiceQueueEvents['emit'](_0x1e6698,_0x2f72a0);_0x40bbe1(null);};}for(var e in events){if(events[_0x3dd9('0x4')](e)){var event=events[e];VoiceQueue[_0x3dd9('0x5')](e,emitEvent(event));}}module[_0x3dd9('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b479a76..7ff2f4f 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x45cb2b,_0x285349){var _0x9411a6=function(_0x15da36){while(--_0x15da36){_0x45cb2b['push'](_0x45cb2b['shift']());}};_0x9411a6(++_0x285349);}(_0x3e74,0x175));var _0x43e7=function(_0x2030cc,_0x37589b){_0x2030cc=_0x2030cc-0x0;var _0x231c13=_0x3e74[_0x2030cc];return _0x231c13;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x327a24,_0x21d480){var _0x5c7643=function(_0x5a3bf5){while(--_0x5a3bf5){_0x327a24['push'](_0x327a24['shift']());}};_0x5c7643(++_0x21d480);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 065a716..782413c 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 _0xd8de=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','raw','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x25683f,_0x4c732a){var _0x1c5f7b=function(_0x3ae9f8){while(--_0x3ae9f8){_0x25683f['push'](_0x25683f['shift']());}};_0x1c5f7b(++_0x4c732a);}(_0xd8de,0xf3));var _0xed8d=function(_0xc6a0a3,_0x2b2b99){_0xc6a0a3=_0xc6a0a3-0x0;var _0x5eaee8=_0xd8de[_0xc6a0a3];return _0x5eaee8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed8d('0x0'));var db=require(_0xed8d('0x1'))['db'];var utils=require(_0xed8d('0x2'));var logger=require('../../config/logger')(_0xed8d('0x3'));var config=require(_0xed8d('0x4'));var jayson=require(_0xed8d('0x5'));var client=jayson['client'][_0xed8d('0x6')]({'port':0x232a});config['redis']=_[_0xed8d('0x7')](config['redis'],{'host':_0xed8d('0x8'),'port':0x18eb});var socket=require(_0xed8d('0x9'))(new Redis(config[_0xed8d('0xa')]));require(_0xed8d('0xb'))['register'](socket);function respondWithRpcPromise(_0x534c42,_0x4d44a0,_0x51ee46){return new BPromise(function(_0x2b8ac8,_0xbd5a4){return client['request'](_0x534c42,_0x51ee46)[_0xed8d('0xc')](function(_0x58065a){logger[_0xed8d('0xd')](_0xed8d('0xe'),_0x4d44a0,_0xed8d('0xf'));logger[_0xed8d('0x10')](_0xed8d('0x11'),_0x4d44a0,'request\x20sent',JSON[_0xed8d('0x12')](_0x58065a));if(_0x58065a[_0xed8d('0x13')]){if(_0x58065a['error'][_0xed8d('0x14')]===0x1f4){logger['error'](_0xed8d('0xe'),_0x4d44a0,_0x58065a['error'][_0xed8d('0x15')]);return _0xbd5a4(_0x58065a[_0xed8d('0x13')][_0xed8d('0x15')]);}logger['error'](_0xed8d('0xe'),_0x4d44a0,_0x58065a['error'][_0xed8d('0x15')]);return _0x2b8ac8(_0x58065a['error']['message']);}else{logger[_0xed8d('0xd')](_0xed8d('0xe'),_0x4d44a0,_0xed8d('0xf'));_0x2b8ac8(_0x58065a[_0xed8d('0x16')]['message']);}})[_0xed8d('0x17')](function(_0x5d52d1){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x4d44a0,_0x5d52d1);_0xbd5a4(_0x5d52d1);});});}exports['GetVoiceQueue']=function(_0x41776e){var _0x4c5d4f=this;return new Promise(function(_0x553232,_0x14bb68){return db[_0xed8d('0x18')][_0xed8d('0x19')]({'raw':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1b')]||null:null,'attributes':_0x41776e['options']?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1c')]||null:null,'limit':_0x41776e['options']?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1d')]||null:null,'include':_0x41776e[_0xed8d('0x1a')]?_0x41776e[_0xed8d('0x1a')][_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x41776e['options'][_0xed8d('0x1e')],function(_0x2a1ae1){return{'model':db[_0x2a1ae1[_0xed8d('0x20')]],'as':_0x2a1ae1['as'],'attributes':_0x2a1ae1['attributes'],'include':_0x2a1ae1['include']?_[_0xed8d('0x1f')](_0x2a1ae1[_0xed8d('0x1e')],function(_0x2970e3){return{'model':db[_0x2970e3[_0xed8d('0x20')]],'as':_0x2970e3['as'],'attributes':_0x2970e3['attributes'],'include':_0x2970e3['include']?_['map'](_0x2970e3[_0xed8d('0x1e')],function(_0x331904){return{'model':db[_0x331904['model']],'as':_0x331904['as'],'attributes':_0x331904[_0xed8d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xed8d('0xc')](function(_0x52164a){logger[_0xed8d('0xd')](_0xed8d('0x21'),_0x41776e);logger[_0xed8d('0x10')](_0xed8d('0x21'),_0x41776e,JSON[_0xed8d('0x12')](_0x52164a));_0x553232(_0x52164a);})[_0xed8d('0x17')](function(_0x4d0254){logger[_0xed8d('0x13')]('GetVoiceQueue',_0x4d0254[_0xed8d('0x15')],_0x41776e);_0x14bb68(_0x4c5d4f[_0xed8d('0x13')](0x1f4,_0x4d0254[_0xed8d('0x15')]));});});};exports[_0xed8d('0x22')]=function(_0x3c8115){var _0x3d0c8b=this;return new Promise(function(_0x118c5b,_0x3d37f8){return db['VoiceQueue'][_0xed8d('0x23')]({'raw':_0x3c8115[_0xed8d('0x1a')]?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x24')]===undefined?!![]:![]:!![],'where':_0x3c8115[_0xed8d('0x1a')]?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1b')]||null:null,'attributes':_0x3c8115['options']?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1c')]||null:null,'include':_0x3c8115['options']?_0x3c8115[_0xed8d('0x1a')][_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x3c8115[_0xed8d('0x1a')]['include'],function(_0x4345cb){return{'model':db[_0x4345cb['model']],'as':_0x4345cb['as'],'attributes':_0x4345cb['attributes'],'include':_0x4345cb[_0xed8d('0x1e')]?_[_0xed8d('0x1f')](_0x4345cb['include'],function(_0x1c2eb4){return{'model':db[_0x1c2eb4[_0xed8d('0x20')]],'as':_0x1c2eb4['as'],'attributes':_0x1c2eb4[_0xed8d('0x1c')],'include':_0x1c2eb4[_0xed8d('0x1e')]?_['map'](_0x1c2eb4[_0xed8d('0x1e')],function(_0x177b39){return{'model':db[_0x177b39['model']],'as':_0x177b39['as'],'attributes':_0x177b39[_0xed8d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xed8d('0xc')](function(_0x16b5e6){logger[_0xed8d('0xd')]('ShowVoiceQueue',_0x3c8115);logger[_0xed8d('0x10')]('ShowVoiceQueue',_0x3c8115,JSON[_0xed8d('0x12')](_0x16b5e6));_0x118c5b(_0x16b5e6);})[_0xed8d('0x17')](function(_0x518681){logger[_0xed8d('0x13')](_0xed8d('0x22'),_0x518681[_0xed8d('0x15')],_0x3c8115);_0x3d37f8(_0x3d0c8b[_0xed8d('0x13')](0x1f4,_0x518681[_0xed8d('0x15')]));});});}; \ No newline at end of file +var _0x31e5=['message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','catch','ShowVoiceQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x31e5,0xff));var _0x531e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x31e5[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x531e('0x0'));var moment=require(_0x531e('0x1'));var BPromise=require('bluebird');var rs=require(_0x531e('0x2'));var fs=require('fs');var Redis=require(_0x531e('0x3'));var db=require(_0x531e('0x4'))['db'];var utils=require(_0x531e('0x5'));var logger=require(_0x531e('0x6'))(_0x531e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x531e('0x8')][_0x531e('0x9')]({'port':0x232a});config['redis']=_[_0x531e('0xa')](config[_0x531e('0xb')],{'host':_0x531e('0xc'),'port':0x18eb});var socket=require(_0x531e('0xd'))(new Redis(config[_0x531e('0xb')]));require(_0x531e('0xe'))[_0x531e('0xf')](socket);function respondWithRpcPromise(_0x54412f,_0x27a307,_0x2f78d7){return new BPromise(function(_0x43d31b,_0x19e5a2){return client[_0x531e('0x10')](_0x54412f,_0x2f78d7)['then'](function(_0x476e1b){logger[_0x531e('0x11')](_0x531e('0x12'),_0x27a307,_0x531e('0x13'));logger[_0x531e('0x14')](_0x531e('0x15'),_0x27a307,_0x531e('0x13'),JSON[_0x531e('0x16')](_0x476e1b));if(_0x476e1b[_0x531e('0x17')]){if(_0x476e1b['error'][_0x531e('0x18')]===0x1f4){logger[_0x531e('0x17')](_0x531e('0x12'),_0x27a307,_0x476e1b['error'][_0x531e('0x19')]);return _0x19e5a2(_0x476e1b['error'][_0x531e('0x19')]);}logger[_0x531e('0x17')](_0x531e('0x12'),_0x27a307,_0x476e1b[_0x531e('0x17')][_0x531e('0x19')]);return _0x43d31b(_0x476e1b[_0x531e('0x17')][_0x531e('0x19')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x27a307,_0x531e('0x13'));_0x43d31b(_0x476e1b[_0x531e('0x1a')][_0x531e('0x19')]);}})['catch'](function(_0x2da727){logger[_0x531e('0x17')](_0x531e('0x12'),_0x27a307,_0x2da727);_0x19e5a2(_0x2da727);});});}exports[_0x531e('0x1b')]=function(_0x1d5cae){var _0x1df6d9=this;return new Promise(function(_0x38f8d9,_0x54e1e3){return db[_0x531e('0x1c')][_0x531e('0x1d')]({'raw':_0x1d5cae['options']?_0x1d5cae[_0x531e('0x1e')][_0x531e('0x1f')]===undefined?!![]:![]:!![],'where':_0x1d5cae[_0x531e('0x1e')]?_0x1d5cae[_0x531e('0x1e')]['where']||null:null,'attributes':_0x1d5cae[_0x531e('0x1e')]?_0x1d5cae['options'][_0x531e('0x20')]||null:null,'limit':_0x1d5cae[_0x531e('0x1e')]?_0x1d5cae[_0x531e('0x1e')]['limit']||null:null,'include':_0x1d5cae[_0x531e('0x1e')]?_0x1d5cae[_0x531e('0x1e')][_0x531e('0x21')]?_[_0x531e('0x22')](_0x1d5cae['options'][_0x531e('0x21')],function(_0x5ecd2a){return{'model':db[_0x5ecd2a[_0x531e('0x23')]],'as':_0x5ecd2a['as'],'attributes':_0x5ecd2a[_0x531e('0x20')],'include':_0x5ecd2a[_0x531e('0x21')]?_['map'](_0x5ecd2a[_0x531e('0x21')],function(_0x33012a){return{'model':db[_0x33012a['model']],'as':_0x33012a['as'],'attributes':_0x33012a[_0x531e('0x20')],'include':_0x33012a['include']?_[_0x531e('0x22')](_0x33012a[_0x531e('0x21')],function(_0x5be2ed){return{'model':db[_0x5be2ed[_0x531e('0x23')]],'as':_0x5be2ed['as'],'attributes':_0x5be2ed[_0x531e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e7cc3){logger[_0x531e('0x11')](_0x531e('0x1b'),_0x1d5cae);logger[_0x531e('0x14')]('GetVoiceQueue',_0x1d5cae,JSON[_0x531e('0x16')](_0x2e7cc3));_0x38f8d9(_0x2e7cc3);})[_0x531e('0x24')](function(_0x2e0ada){logger[_0x531e('0x17')](_0x531e('0x1b'),_0x2e0ada[_0x531e('0x19')],_0x1d5cae);_0x54e1e3(_0x1df6d9[_0x531e('0x17')](0x1f4,_0x2e0ada[_0x531e('0x19')]));});});};exports[_0x531e('0x25')]=function(_0xb28bca){var _0x40250e=this;return new Promise(function(_0x42a181,_0x39ed18){return db[_0x531e('0x1c')][_0x531e('0x26')]({'raw':_0xb28bca[_0x531e('0x1e')]?_0xb28bca[_0x531e('0x1e')][_0x531e('0x1f')]===undefined?!![]:![]:!![],'where':_0xb28bca['options']?_0xb28bca['options'][_0x531e('0x27')]||null:null,'attributes':_0xb28bca[_0x531e('0x1e')]?_0xb28bca[_0x531e('0x1e')][_0x531e('0x20')]||null:null,'include':_0xb28bca[_0x531e('0x1e')]?_0xb28bca['options'][_0x531e('0x21')]?_['map'](_0xb28bca['options']['include'],function(_0xe525fb){return{'model':db[_0xe525fb[_0x531e('0x23')]],'as':_0xe525fb['as'],'attributes':_0xe525fb['attributes'],'include':_0xe525fb[_0x531e('0x21')]?_[_0x531e('0x22')](_0xe525fb[_0x531e('0x21')],function(_0x576110){return{'model':db[_0x576110[_0x531e('0x23')]],'as':_0x576110['as'],'attributes':_0x576110[_0x531e('0x20')],'include':_0x576110[_0x531e('0x21')]?_[_0x531e('0x22')](_0x576110[_0x531e('0x21')],function(_0x308147){return{'model':db[_0x308147[_0x531e('0x23')]],'as':_0x308147['as'],'attributes':_0x308147[_0x531e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x654f6e){logger['info'](_0x531e('0x25'),_0xb28bca);logger[_0x531e('0x14')]('ShowVoiceQueue',_0xb28bca,JSON[_0x531e('0x16')](_0x654f6e));_0x42a181(_0x654f6e);})[_0x531e('0x24')](function(_0xf6fdb5){logger[_0x531e('0x17')]('ShowVoiceQueue',_0xf6fdb5[_0x531e('0x19')],_0xb28bca);_0x39ed18(_0x40250e[_0x531e('0x17')](0x1f4,_0xf6fdb5[_0x531e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1f5e775..279d09b 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 _0x2047=['register','length','voiceQueue:','save','remove','removeListener'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x2047,0x8d));var _0x7204=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x2047[_0x13ea00];return _0x1f7347;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7204('0x0'),_0x7204('0x1'),'update'];function createListener(_0xdc209c,_0x1847c4){return function(_0x3074ba){_0x1847c4['emit'](_0xdc209c,_0x3074ba);};}function removeListener(_0x5819eb,_0xbff9b3){return function(){VoiceQueueEvents[_0x7204('0x2')](_0x5819eb,_0xbff9b3);};}exports[_0x7204('0x3')]=function(_0x104737){for(var _0x24db7=0x0,_0x57e35f=events[_0x7204('0x4')];_0x24db7<_0x57e35f;_0x24db7++){var _0x1ec2a3=events[_0x24db7];var _0x1cdb1a=createListener(_0x7204('0x5')+_0x1ec2a3,_0x104737);VoiceQueueEvents['on'](_0x1ec2a3,_0x1cdb1a);}}; \ No newline at end of file +var _0xd970=['length','voiceQueue:','save','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd970,0x14a));var _0x0d97=function(_0x3e6dc7,_0x20d358){_0x3e6dc7=_0x3e6dc7-0x0;var _0x49a4a8=_0xd970[_0x3e6dc7];return _0x49a4a8;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0d97('0x0'),'remove',_0x0d97('0x1')];function createListener(_0x6af94d,_0x5e721a){return function(_0x442535){_0x5e721a['emit'](_0x6af94d,_0x442535);};}function removeListener(_0x522f39,_0x2628c4){return function(){VoiceQueueEvents['removeListener'](_0x522f39,_0x2628c4);};}exports['register']=function(_0x415659){for(var _0x2ad988=0x0,_0x374eef=events[_0x0d97('0x2')];_0x2ad988<_0x374eef;_0x2ad988++){var _0x2b8868=events[_0x2ad988];var _0x174712=createListener(_0x0d97('0x3')+_0x2b8868,_0x415659);VoiceQueueEvents['on'](_0x2b8868,_0x174712);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c965aa8..7b5aba2 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 _0xa4be=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','describe','/index','getVoiceQueuesReport','get','/:id','post','create','update','destroy','multer','util','fs-extra'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa4be,0xa7));var _0xea4b=function(_0x4ee7be,_0x22c019){_0x4ee7be=_0x4ee7be-0x0;var _0x97db86=_0xa4be[_0x4ee7be];return _0x97db86;};'use strict';var multer=require(_0xea4b('0x0'));var util=require(_0xea4b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xea4b('0x2'));var auth=require(_0xea4b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xea4b('0x4'));var controller=require(_0xea4b('0x5'));router['get']('/',auth[_0xea4b('0x6')](),controller[_0xea4b('0x7')]);router['get']('/describe',auth[_0xea4b('0x6')](),controller[_0xea4b('0x8')]);router['get'](_0xea4b('0x9'),auth[_0xea4b('0x6')](),controller[_0xea4b('0xa')]);router[_0xea4b('0xb')](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller['show']);router[_0xea4b('0xd')]('/',auth[_0xea4b('0x6')](),controller[_0xea4b('0xe')]);router['put'](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller[_0xea4b('0xf')]);router['delete'](_0xea4b('0xc'),auth[_0xea4b('0x6')](),controller[_0xea4b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeebe=['isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x168478,_0x323a27){var _0x29c2f8=function(_0x4f7a8a){while(--_0x4f7a8a){_0x168478['push'](_0x168478['shift']());}};_0x29c2f8(++_0x323a27);}(_0xeebe,0xb6));var _0xeeeb=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xeebe[_0x187ee1];return _0x388160;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xeeeb('0x0'));var express=require(_0xeeeb('0x1'));var router=express[_0xeeeb('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeeeb('0x3'));var config=require(_0xeeeb('0x4'));var controller=require(_0xeeeb('0x5'));router[_0xeeeb('0x6')]('/',auth[_0xeeeb('0x7')](),controller[_0xeeeb('0x8')]);router[_0xeeeb('0x6')](_0xeeeb('0x9'),auth[_0xeeeb('0x7')](),controller[_0xeeeb('0xa')]);router[_0xeeeb('0x6')](_0xeeeb('0xb'),auth['isAuthenticated'](),controller[_0xeeeb('0xc')]);router[_0xeeeb('0x6')](_0xeeeb('0xd'),auth[_0xeeeb('0x7')](),controller[_0xeeeb('0xe')]);router[_0xeeeb('0xf')]('/',auth['isAuthenticated'](),controller[_0xeeeb('0x10')]);router[_0xeeeb('0x11')]('/:id',auth[_0xeeeb('0x7')](),controller[_0xeeeb('0x12')]);router['delete'](_0xeeeb('0xd'),auth[_0xeeeb('0x7')](),controller[_0xeeeb('0x13')]);module[_0xeeeb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index fe49d3f..86b9383 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 _0xd6ac=['BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','format','diff','setDataValue','holdtime','INTEGER'];(function(_0x4ff596,_0x3210c3){var _0x1a0c8b=function(_0x3bd519){while(--_0x3bd519){_0x4ff596['push'](_0x4ff596['shift']());}};_0x1a0c8b(++_0x3210c3);}(_0xd6ac,0x111));var _0xcd6a=function(_0x117ad0,_0x395fee){_0x117ad0=_0x117ad0-0x0;var _0x20f1b7=_0xd6ac[_0x117ad0];return _0x20f1b7;};'use strict';var Sequelize=require(_0xcd6a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xcd6a('0x1')]},'uniqueid':{'type':Sequelize[_0xcd6a('0x1')]},'calleridnum':{'type':Sequelize[_0xcd6a('0x1')]},'calleridname':{'type':Sequelize[_0xcd6a('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2f4811){var _0x12a4a0=moment(_0x2f4811);var _0x1f38ac=moment(this['getDataValue']('queuecallerjoinAt'))[_0xcd6a('0x2')]('YYYY-MM-DD\x20HH:mm:ss');var _0x247e47=_0x12a4a0[_0xcd6a('0x3')](_0x1f38ac,'seconds');this[_0xcd6a('0x4')]('queuecallerleaveAt',_0x2f4811);this['setDataValue'](_0xcd6a('0x5'),_0x247e47||null);}},'position':{'type':Sequelize[_0xcd6a('0x6')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcd6a('0x8')]},'queuecallerexit':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcd6a('0x8')]},'queuecallerexitreason':{'type':Sequelize[_0xcd6a('0x1')],'comment':_0xcd6a('0x9')},'originalposition':{'type':Sequelize[_0xcd6a('0x6')]},'channel':{'type':Sequelize[_0xcd6a('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcd6a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcd6a('0x1')]},'context':{'type':Sequelize[_0xcd6a('0x1')]},'exten':{'type':Sequelize[_0xcd6a('0x1')]},'priority':{'type':Sequelize[_0xcd6a('0x1')]},'holdtime':{'type':Sequelize[_0xcd6a('0x6')]},'mohtime':{'type':Sequelize[_0xcd6a('0x6')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcd6a('0x1')]},'transfer':{'type':Sequelize[_0xcd6a('0x7')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcd6a('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xcd6a('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcd6a('0x1')]},'thirdDisposition':{'type':Sequelize[_0xcd6a('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xcd6a('0x1')]}}; \ No newline at end of file +var _0x1b95=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b95,0x14f));var _0x51b9=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x1b95[_0x22f8ab];return _0x2a70e5;};'use strict';var Sequelize=require(_0x51b9('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x51b9('0x1')]},'uniqueid':{'type':Sequelize[_0x51b9('0x1')]},'calleridnum':{'type':Sequelize[_0x51b9('0x1')]},'calleridname':{'type':Sequelize[_0x51b9('0x1')]},'queue':{'type':Sequelize[_0x51b9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x51b9('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x51b9('0x2')],'set':function(_0x208152){var _0xa5b221=moment(_0x208152);var _0x4bd9f1=moment(this['getDataValue']('queuecallerjoinAt'))[_0x51b9('0x3')](_0x51b9('0x4'));var _0x12928c=_0xa5b221[_0x51b9('0x5')](_0x4bd9f1,'seconds');this['setDataValue']('queuecallerleaveAt',_0x208152);this[_0x51b9('0x6')](_0x51b9('0x7'),_0x12928c||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x51b9('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x51b9('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x51b9('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x51b9('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x51b9('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x51b9('0xa')},'originalposition':{'type':Sequelize[_0x51b9('0x8')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x51b9('0x1')]},'connectedlinename':{'type':Sequelize[_0x51b9('0x1')]},'accountcode':{'type':Sequelize[_0x51b9('0x1')]},'context':{'type':Sequelize[_0x51b9('0x1')]},'exten':{'type':Sequelize[_0x51b9('0x1')]},'priority':{'type':Sequelize[_0x51b9('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x51b9('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x51b9('0x1')]},'transfer':{'type':Sequelize[_0x51b9('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x51b9('0x1')],'comment':_0x51b9('0xb')},'transferexten':{'type':Sequelize[_0x51b9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x51b9('0x1')]},'disposition':{'type':Sequelize[_0x51b9('0x1')]},'secondDisposition':{'type':Sequelize[_0x51b9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x51b9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x51b9('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0x51b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 1f8ac78..b7639bd 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 _0x4209=['params','describe','hasOwnProperty','include','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','find','create','body'];(function(_0x9d86e5,_0x5ee78f){var _0x461d8e=function(_0x52ccb5){while(--_0x52ccb5){_0x9d86e5['push'](_0x9d86e5['shift']());}};_0x461d8e(++_0x5ee78f);}(_0x4209,0xa9));var _0x9420=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x4209[_0x549278];return _0x1ea9a1;};'use strict';var emlformat=require(_0x9420('0x0'));var rimraf=require(_0x9420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9420('0x2'));var rp=require(_0x9420('0x3'));var moment=require(_0x9420('0x4'));var BPromise=require(_0x9420('0x5'));var Mustache=require('mustache');var util=require(_0x9420('0x6'));var path=require(_0x9420('0x7'));var sox=require(_0x9420('0x8'));var csv=require(_0x9420('0x9'));var ejs=require(_0x9420('0xa'));var fs=require('fs');var fs_extra=require(_0x9420('0xb'));var _=require(_0x9420('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9420('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9420('0xe'));var Papa=require(_0x9420('0xf'));var Redis=require(_0x9420('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9420('0x11'));var as=require(_0x9420('0x12'));var hardwareService=require(_0x9420('0x13'));var logger=require('../../config/logger')(_0x9420('0x14'));var utils=require(_0x9420('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9420('0x16'));var db=require(_0x9420('0x17'))['db'];config[_0x9420('0x18')]=_[_0x9420('0x19')](config[_0x9420('0x18')],{'host':_0x9420('0x1a'),'port':0x18eb});var socket=require(_0x9420('0x1b'))(new Redis(config[_0x9420('0x18')]));require('./voiceQueueReport.socket')[_0x9420('0x1c')](socket);function respondWithStatusCode(_0x91a58f,_0x534990){_0x534990=_0x534990||0xcc;return function(_0x546d86){if(_0x546d86){return _0x91a58f['sendStatus'](_0x534990);}return _0x91a58f[_0x9420('0x1d')](_0x534990)[_0x9420('0x1e')]();};}function respondWithResult(_0x4a3dae,_0x3d8de6){_0x3d8de6=_0x3d8de6||0xc8;return function(_0x5458f4){if(_0x5458f4){return _0x4a3dae['status'](_0x3d8de6)['json'](_0x5458f4);}};}function respondWithFilteredResult(_0x4b41d4,_0x208c82){return function(_0x2261e4){if(_0x2261e4){var _0x1f0f3b=typeof _0x208c82[_0x9420('0x1f')]===_0x9420('0x20')&&typeof _0x208c82[_0x9420('0x21')]===_0x9420('0x20');var _0x1441c9=_0x2261e4[_0x9420('0x22')];var _0x35d948=_0x1f0f3b?0x0:_0x208c82[_0x9420('0x1f')];var _0x10ddb5=_0x1f0f3b?_0x2261e4[_0x9420('0x22')]:_0x208c82[_0x9420('0x1f')]+_0x208c82[_0x9420('0x21')];var _0x40c5d6;if(_0x10ddb5>=_0x1441c9){_0x10ddb5=_0x1441c9;_0x40c5d6=0xc8;}else{_0x40c5d6=0xce;}_0x4b41d4[_0x9420('0x1d')](_0x40c5d6);return _0x4b41d4[_0x9420('0x23')](_0x9420('0x24'),_0x35d948+'-'+_0x10ddb5+'/'+_0x1441c9)[_0x9420('0x25')](_0x2261e4);}return null;};}function patchUpdates(_0x561963){return function(_0x3d5394){try{jsonpatch[_0x9420('0x26')](_0x3d5394,_0x561963,!![]);}catch(_0x23b343){return BPromise[_0x9420('0x27')](_0x23b343);}return _0x3d5394[_0x9420('0x28')]();};}function saveUpdates(_0x18a094,_0x4604e6){return function(_0x5c2417){if(_0x5c2417){return _0x5c2417[_0x9420('0x29')](_0x18a094)[_0x9420('0x2a')](function(_0xf5ac0e){return _0xf5ac0e;});}return null;};}function removeEntity(_0x4fbab9,_0x1419b0){return function(_0x1fe113){if(_0x1fe113){return _0x1fe113['destroy']()[_0x9420('0x2a')](function(){_0x4fbab9[_0x9420('0x1d')](0xcc)[_0x9420('0x1e')]();});}};}function handleEntityNotFound(_0x49b06b,_0x49de5c){return function(_0x3b7342){if(!_0x3b7342){_0x49b06b[_0x9420('0x2b')](0x194);}return _0x3b7342;};}function handleError(_0x3cfc1c,_0x59a72a){_0x59a72a=_0x59a72a||0x1f4;return function(_0x5d95c3){logger[_0x9420('0x2c')](_0x5d95c3['stack']);if(_0x5d95c3[_0x9420('0x2d')]){delete _0x5d95c3['name'];}_0x3cfc1c['status'](_0x59a72a)[_0x9420('0x2e')](_0x5d95c3);};}exports[_0x9420('0x2f')]=function(_0x5e9d8b,_0x19952c){var _0x332640={},_0x3038af={},_0x175a29={'count':0x0,'rows':[]};var _0xe49438=_[_0x9420('0x30')](db[_0x9420('0x31')][_0x9420('0x32')],function(_0x37e95a){return{'name':_0x37e95a[_0x9420('0x33')],'type':_0x37e95a['type'][_0x9420('0x34')]};});_0x3038af[_0x9420('0x35')]=_[_0x9420('0x30')](_0xe49438,_0x9420('0x2d'));_0x3038af[_0x9420('0x36')]=_[_0x9420('0x37')](_0x5e9d8b[_0x9420('0x36')]);_0x3038af[_0x9420('0x38')]=_[_0x9420('0x39')](_0x3038af[_0x9420('0x35')],_0x3038af['query']);_0x332640['attributes']=_['intersection'](_0x3038af['model'],qs[_0x9420('0x3a')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x3a')]));_0x332640[_0x9420('0x3b')]=_0x332640['attributes'][_0x9420('0x3c')]?_0x332640['attributes']:_0x3038af[_0x9420('0x35')];if(!_0x5e9d8b['query']['hasOwnProperty'](_0x9420('0x3d'))){_0x332640[_0x9420('0x21')]=qs[_0x9420('0x21')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x21')]);_0x332640[_0x9420('0x1f')]=qs[_0x9420('0x1f')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x1f')]);}_0x332640[_0x9420('0x3e')]=qs[_0x9420('0x3f')](_0x5e9d8b[_0x9420('0x36')][_0x9420('0x3f')]);_0x332640['where']=qs[_0x9420('0x38')](_[_0x9420('0x40')](_0x5e9d8b['query'],_0x3038af[_0x9420('0x38')]),_0xe49438);if(_0x5e9d8b[_0x9420('0x36')][_0x9420('0x41')]){_0x332640[_0x9420('0x42')]=_[_0x9420('0x43')](_0x332640['where'],{'$or':_[_0x9420('0x30')](_0xe49438,function(_0x48305c){if(_0x48305c['type']!=='VIRTUAL'){var _0x3209d7={};_0x3209d7[_0x48305c['name']]={'$like':'%'+_0x5e9d8b['query'][_0x9420('0x41')]+'%'};return _0x3209d7;}})});}_0x332640=_['merge']({},_0x332640,_0x5e9d8b[_0x9420('0x44')]);var _0xcbb997={'where':_0x332640['where']};return db[_0x9420('0x31')]['count'](_0xcbb997)[_0x9420('0x2a')](function(_0xaee3){_0x175a29[_0x9420('0x22')]=_0xaee3;if(_0x5e9d8b['query'][_0x9420('0x45')]){_0x332640['include']=[{'all':!![]}];}return db[_0x9420('0x31')][_0x9420('0x46')](_0x332640);})[_0x9420('0x2a')](function(_0x37d78a){_0x175a29[_0x9420('0x47')]=_0x37d78a;return _0x175a29;})['then'](respondWithFilteredResult(_0x19952c,_0x332640))[_0x9420('0x48')](handleError(_0x19952c,null));};exports[_0x9420('0x49')]=function(_0x20374e,_0x4c61f5){var _0x2489a4={'raw':![],'where':{'id':_0x20374e['params']['id']}},_0x192bb5={};_0x192bb5[_0x9420('0x35')]=_[_0x9420('0x37')](db['VoiceQueueReport'][_0x9420('0x32')]);_0x192bb5['query']=_[_0x9420('0x37')](_0x20374e[_0x9420('0x36')]);_0x192bb5[_0x9420('0x38')]=_[_0x9420('0x39')](_0x192bb5[_0x9420('0x35')],_0x192bb5[_0x9420('0x36')]);_0x2489a4[_0x9420('0x3b')]=_['intersection'](_0x192bb5[_0x9420('0x35')],qs[_0x9420('0x3a')](_0x20374e['query'][_0x9420('0x3a')]));_0x2489a4[_0x9420('0x3b')]=_0x2489a4[_0x9420('0x3b')][_0x9420('0x3c')]?_0x2489a4[_0x9420('0x3b')]:_0x192bb5[_0x9420('0x35')];if(_0x20374e[_0x9420('0x36')]['includeAll']){_0x2489a4['include']=[{'all':!![]}];}_0x2489a4=_['merge']({},_0x2489a4,_0x20374e['options']);return db[_0x9420('0x31')][_0x9420('0x4a')](_0x2489a4)[_0x9420('0x2a')](handleEntityNotFound(_0x4c61f5,null))[_0x9420('0x2a')](respondWithResult(_0x4c61f5,null))['catch'](handleError(_0x4c61f5,null));};exports[_0x9420('0x4b')]=function(_0x4808cc,_0x38876f){return db[_0x9420('0x31')][_0x9420('0x4b')](_0x4808cc[_0x9420('0x4c')],{})[_0x9420('0x2a')](respondWithResult(_0x38876f,0xc9))[_0x9420('0x48')](handleError(_0x38876f,null));};exports[_0x9420('0x29')]=function(_0x4e6d1a,_0x4bb680){if(_0x4e6d1a[_0x9420('0x4c')]['id']){delete _0x4e6d1a[_0x9420('0x4c')]['id'];}return db[_0x9420('0x31')]['find']({'where':{'id':_0x4e6d1a[_0x9420('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4bb680,null))[_0x9420('0x2a')](saveUpdates(_0x4e6d1a[_0x9420('0x4c')],null))[_0x9420('0x2a')](respondWithResult(_0x4bb680,null))[_0x9420('0x48')](handleError(_0x4bb680,null));};exports['destroy']=function(_0x3120ad,_0x1fb25c){return db[_0x9420('0x31')][_0x9420('0x4a')]({'where':{'id':_0x3120ad['params']['id']}})[_0x9420('0x2a')](handleEntityNotFound(_0x1fb25c,null))[_0x9420('0x2a')](removeEntity(_0x1fb25c,null))[_0x9420('0x48')](handleError(_0x1fb25c,null));};exports[_0x9420('0x4e')]=function(_0x59118a,_0x473801){return db[_0x9420('0x31')]['describe']()[_0x9420('0x2a')](respondWithResult(_0x473801,null))['catch'](handleError(_0x473801,null));};exports['getVoiceQueuesReport']=function(_0xb4d24a,_0x390094){var _0x250ab5={},_0x2c15f0={},_0x3519a8={'count':0x0,'rows':[]};_0x2c15f0[_0x9420('0x35')]=_[_0x9420('0x37')](db[_0x9420('0x31')][_0x9420('0x32')]);_0x2c15f0[_0x9420('0x36')]=_[_0x9420('0x37')](_0xb4d24a[_0x9420('0x36')]);_0x2c15f0[_0x9420('0x38')]=_['intersection'](_0x2c15f0[_0x9420('0x35')],_0x2c15f0[_0x9420('0x36')]);_0x250ab5['attributes']=_['intersection'](_0x2c15f0['model'],qs[_0x9420('0x3a')](_0xb4d24a[_0x9420('0x36')][_0x9420('0x3a')]));_0x250ab5[_0x9420('0x3b')]=_0x250ab5[_0x9420('0x3b')][_0x9420('0x3c')]?_0x250ab5[_0x9420('0x3b')]:_0x2c15f0[_0x9420('0x35')];if(!_0xb4d24a[_0x9420('0x36')][_0x9420('0x4f')](_0x9420('0x3d'))){_0x250ab5[_0x9420('0x21')]=qs[_0x9420('0x21')](_0xb4d24a[_0x9420('0x36')][_0x9420('0x21')]);_0x250ab5['offset']=qs['offset'](_0xb4d24a[_0x9420('0x36')][_0x9420('0x1f')]);}_0x250ab5[_0x9420('0x3e')]=qs[_0x9420('0x3f')](_0xb4d24a['query'][_0x9420('0x3f')]);_0x250ab5['where']=qs['filters'](_[_0x9420('0x40')](_0xb4d24a[_0x9420('0x36')],_0x2c15f0[_0x9420('0x38')]));if(_0xb4d24a[_0x9420('0x36')][_0x9420('0x41')]){_0x250ab5[_0x9420('0x42')]=_['merge'](_0x250ab5['where'],{'$or':_[_0x9420('0x30')](_0x250ab5[_0x9420('0x3b')],function(_0x5f3393){var _0x3d56e1={};_0x3d56e1[_0x5f3393]={'$like':'%'+_0xb4d24a['query'][_0x9420('0x41')]+'%'};return _0x3d56e1;})});}_0x250ab5=_[_0x9420('0x43')]({},_0x250ab5,_0xb4d24a[_0x9420('0x44')]);var _0x3c313b={'where':_0x250ab5['where']};return db['VoiceQueueReport'][_0x9420('0x22')](_0x3c313b)[_0x9420('0x2a')](function(_0x5103d7){_0x3519a8[_0x9420('0x22')]=_0x5103d7;if(_0xb4d24a['query'][_0x9420('0x45')]){_0x250ab5[_0x9420('0x50')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9420('0x46')](_0x250ab5);})[_0x9420('0x2a')](function(_0x15140b){_0x3519a8[_0x9420('0x47')]=_0x15140b;return _0x3519a8;})[_0x9420('0x2a')](respondWithFilteredResult(_0x390094,_0x250ab5,'getVoiceQueuesReport'))['catch'](handleError(_0x390094,null,_0x9420('0x51')));}; \ No newline at end of file +var _0x78e0=['register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','VoiceQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','destroy','describe','getVoiceQueuesReport','filter','map','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x78e0,0x13d));var _0x078e=function(_0x4e0964,_0x4c179b){_0x4e0964=_0x4e0964-0x0;var _0x34eadf=_0x78e0[_0x4e0964];return _0x34eadf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x078e('0x0'));var zipdir=require(_0x078e('0x1'));var jsonpatch=require(_0x078e('0x2'));var rp=require(_0x078e('0x3'));var moment=require('moment');var BPromise=require(_0x078e('0x4'));var Mustache=require('mustache');var util=require(_0x078e('0x5'));var path=require(_0x078e('0x6'));var sox=require(_0x078e('0x7'));var csv=require(_0x078e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x078e('0x9'));var _=require(_0x078e('0xa'));var squel=require(_0x078e('0xb'));var crypto=require(_0x078e('0xc'));var jsforce=require(_0x078e('0xd'));var deskjs=require(_0x078e('0xe'));var toCsv=require(_0x078e('0x8'));var querystring=require(_0x078e('0xf'));var Papa=require(_0x078e('0x10'));var Redis=require(_0x078e('0x11'));var authService=require(_0x078e('0x12'));var qs=require(_0x078e('0x13'));var as=require(_0x078e('0x14'));var hardwareService=require(_0x078e('0x15'));var logger=require('../../config/logger')(_0x078e('0x16'));var utils=require(_0x078e('0x17'));var config=require(_0x078e('0x18'));var licenseUtil=require(_0x078e('0x19'));var db=require(_0x078e('0x1a'))['db'];config[_0x078e('0x1b')]=_[_0x078e('0x1c')](config[_0x078e('0x1b')],{'host':_0x078e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x078e('0x1b')]));require(_0x078e('0x1e'))[_0x078e('0x1f')](socket);function respondWithStatusCode(_0x2105dd,_0x2e50a6){_0x2e50a6=_0x2e50a6||0xcc;return function(_0x512c0f){if(_0x512c0f){return _0x2105dd[_0x078e('0x20')](_0x2e50a6);}return _0x2105dd[_0x078e('0x21')](_0x2e50a6)[_0x078e('0x22')]();};}function respondWithResult(_0x48ae4d,_0x1750b5){_0x1750b5=_0x1750b5||0xc8;return function(_0x3b4ae7){if(_0x3b4ae7){return _0x48ae4d[_0x078e('0x21')](_0x1750b5)[_0x078e('0x23')](_0x3b4ae7);}};}function respondWithFilteredResult(_0x410637,_0x6135f1){return function(_0x4a536e){if(_0x4a536e){var _0x344fbb=typeof _0x6135f1['offset']===_0x078e('0x24')&&typeof _0x6135f1[_0x078e('0x25')]===_0x078e('0x24');var _0x2a35fa=_0x4a536e[_0x078e('0x26')];var _0x1f56dd=_0x344fbb?0x0:_0x6135f1[_0x078e('0x27')];var _0x11ea14=_0x344fbb?_0x4a536e['count']:_0x6135f1['offset']+_0x6135f1['limit'];var _0xfb4570;if(_0x11ea14>=_0x2a35fa){_0x11ea14=_0x2a35fa;_0xfb4570=0xc8;}else{_0xfb4570=0xce;}_0x410637[_0x078e('0x21')](_0xfb4570);return _0x410637[_0x078e('0x28')](_0x078e('0x29'),_0x1f56dd+'-'+_0x11ea14+'/'+_0x2a35fa)[_0x078e('0x23')](_0x4a536e);}return null;};}function patchUpdates(_0x141eac){return function(_0x20f43a){try{jsonpatch['apply'](_0x20f43a,_0x141eac,!![]);}catch(_0x119553){return BPromise[_0x078e('0x2a')](_0x119553);}return _0x20f43a[_0x078e('0x2b')]();};}function saveUpdates(_0x55540c,_0x3c7f25){return function(_0x1a9cad){if(_0x1a9cad){return _0x1a9cad[_0x078e('0x2c')](_0x55540c)[_0x078e('0x2d')](function(_0x57307c){return _0x57307c;});}return null;};}function removeEntity(_0x1d3782,_0x4fb18e){return function(_0x732b07){if(_0x732b07){return _0x732b07['destroy']()['then'](function(){_0x1d3782[_0x078e('0x21')](0xcc)[_0x078e('0x22')]();});}};}function handleEntityNotFound(_0x112220,_0x29ae10){return function(_0x43fd2c){if(!_0x43fd2c){_0x112220[_0x078e('0x20')](0x194);}return _0x43fd2c;};}function handleError(_0x571f09,_0x1338c6){_0x1338c6=_0x1338c6||0x1f4;return function(_0x50f361){logger[_0x078e('0x2e')](_0x50f361[_0x078e('0x2f')]);if(_0x50f361[_0x078e('0x30')]){delete _0x50f361[_0x078e('0x30')];}_0x571f09[_0x078e('0x21')](_0x1338c6)[_0x078e('0x31')](_0x50f361);};}exports[_0x078e('0x32')]=function(_0x2f7d62,_0x5a10f5){var _0x455180={},_0x50967a={},_0x52db05={'count':0x0,'rows':[]};var _0x3b8559=_['map'](db[_0x078e('0x33')]['rawAttributes'],function(_0x19782f){return{'name':_0x19782f[_0x078e('0x34')],'type':_0x19782f[_0x078e('0x35')][_0x078e('0x36')]};});_0x50967a[_0x078e('0x37')]=_['map'](_0x3b8559,'name');_0x50967a[_0x078e('0x38')]=_[_0x078e('0x39')](_0x2f7d62['query']);_0x50967a['filters']=_[_0x078e('0x3a')](_0x50967a[_0x078e('0x37')],_0x50967a[_0x078e('0x38')]);_0x455180[_0x078e('0x3b')]=_[_0x078e('0x3a')](_0x50967a['model'],qs['fields'](_0x2f7d62[_0x078e('0x38')][_0x078e('0x3c')]));_0x455180['attributes']=_0x455180['attributes'][_0x078e('0x3d')]?_0x455180[_0x078e('0x3b')]:_0x50967a[_0x078e('0x37')];if(!_0x2f7d62['query'][_0x078e('0x3e')](_0x078e('0x3f'))){_0x455180[_0x078e('0x25')]=qs['limit'](_0x2f7d62[_0x078e('0x38')]['limit']);_0x455180[_0x078e('0x27')]=qs['offset'](_0x2f7d62[_0x078e('0x38')][_0x078e('0x27')]);}_0x455180[_0x078e('0x40')]=qs[_0x078e('0x41')](_0x2f7d62[_0x078e('0x38')][_0x078e('0x41')]);_0x455180[_0x078e('0x42')]=qs[_0x078e('0x43')](_[_0x078e('0x44')](_0x2f7d62[_0x078e('0x38')],_0x50967a[_0x078e('0x43')]),_0x3b8559);if(_0x2f7d62[_0x078e('0x38')]['filter']){_0x455180['where']=_[_0x078e('0x45')](_0x455180[_0x078e('0x42')],{'$or':_['map'](_0x3b8559,function(_0x13140d){if(_0x13140d[_0x078e('0x35')]!==_0x078e('0x46')){var _0x3379f={};_0x3379f[_0x13140d[_0x078e('0x30')]]={'$like':'%'+_0x2f7d62[_0x078e('0x38')]['filter']+'%'};return _0x3379f;}})});}_0x455180=_['merge']({},_0x455180,_0x2f7d62['options']);var _0x77d8f4={'where':_0x455180[_0x078e('0x42')]};return db[_0x078e('0x33')][_0x078e('0x26')](_0x77d8f4)['then'](function(_0x2ce10d){_0x52db05[_0x078e('0x26')]=_0x2ce10d;if(_0x2f7d62['query']['includeAll']){_0x455180[_0x078e('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x078e('0x48')](_0x455180);})[_0x078e('0x2d')](function(_0x17a087){_0x52db05[_0x078e('0x49')]=_0x17a087;return _0x52db05;})['then'](respondWithFilteredResult(_0x5a10f5,_0x455180))[_0x078e('0x4a')](handleError(_0x5a10f5,null));};exports['show']=function(_0x8610a0,_0x339144){var _0x534071={'raw':![],'where':{'id':_0x8610a0[_0x078e('0x4b')]['id']}},_0x1f61ad={};_0x1f61ad[_0x078e('0x37')]=_[_0x078e('0x39')](db[_0x078e('0x33')][_0x078e('0x4c')]);_0x1f61ad[_0x078e('0x38')]=_['keys'](_0x8610a0['query']);_0x1f61ad['filters']=_[_0x078e('0x3a')](_0x1f61ad[_0x078e('0x37')],_0x1f61ad['query']);_0x534071[_0x078e('0x3b')]=_[_0x078e('0x3a')](_0x1f61ad['model'],qs[_0x078e('0x3c')](_0x8610a0[_0x078e('0x38')][_0x078e('0x3c')]));_0x534071['attributes']=_0x534071['attributes'][_0x078e('0x3d')]?_0x534071[_0x078e('0x3b')]:_0x1f61ad['model'];if(_0x8610a0[_0x078e('0x38')][_0x078e('0x4d')]){_0x534071[_0x078e('0x47')]=[{'all':!![]}];}_0x534071=_[_0x078e('0x45')]({},_0x534071,_0x8610a0[_0x078e('0x4e')]);return db[_0x078e('0x33')][_0x078e('0x4f')](_0x534071)[_0x078e('0x2d')](handleEntityNotFound(_0x339144,null))[_0x078e('0x2d')](respondWithResult(_0x339144,null))[_0x078e('0x4a')](handleError(_0x339144,null));};exports[_0x078e('0x50')]=function(_0xdc927,_0x4ecaa8){return db[_0x078e('0x33')]['create'](_0xdc927['body'],{})[_0x078e('0x2d')](respondWithResult(_0x4ecaa8,0xc9))['catch'](handleError(_0x4ecaa8,null));};exports[_0x078e('0x2c')]=function(_0x2c3a11,_0x2d11b2){if(_0x2c3a11[_0x078e('0x51')]['id']){delete _0x2c3a11[_0x078e('0x51')]['id'];}return db[_0x078e('0x33')][_0x078e('0x4f')]({'where':{'id':_0x2c3a11['params']['id']}})[_0x078e('0x2d')](handleEntityNotFound(_0x2d11b2,null))[_0x078e('0x2d')](saveUpdates(_0x2c3a11['body'],null))[_0x078e('0x2d')](respondWithResult(_0x2d11b2,null))[_0x078e('0x4a')](handleError(_0x2d11b2,null));};exports[_0x078e('0x52')]=function(_0x84407,_0x1ba212){return db['VoiceQueueReport'][_0x078e('0x4f')]({'where':{'id':_0x84407['params']['id']}})[_0x078e('0x2d')](handleEntityNotFound(_0x1ba212,null))[_0x078e('0x2d')](removeEntity(_0x1ba212,null))['catch'](handleError(_0x1ba212,null));};exports[_0x078e('0x53')]=function(_0x1fbada,_0x3a02d8){return db[_0x078e('0x33')][_0x078e('0x53')]()[_0x078e('0x2d')](respondWithResult(_0x3a02d8,null))['catch'](handleError(_0x3a02d8,null));};exports[_0x078e('0x54')]=function(_0x27cd9f,_0x5471c7){var _0x5ccfd7={},_0x1a49eb={},_0x575bb0={'count':0x0,'rows':[]};_0x1a49eb['model']=_[_0x078e('0x39')](db[_0x078e('0x33')]['rawAttributes']);_0x1a49eb[_0x078e('0x38')]=_['keys'](_0x27cd9f[_0x078e('0x38')]);_0x1a49eb[_0x078e('0x43')]=_[_0x078e('0x3a')](_0x1a49eb[_0x078e('0x37')],_0x1a49eb[_0x078e('0x38')]);_0x5ccfd7[_0x078e('0x3b')]=_[_0x078e('0x3a')](_0x1a49eb['model'],qs[_0x078e('0x3c')](_0x27cd9f['query']['fields']));_0x5ccfd7['attributes']=_0x5ccfd7['attributes'][_0x078e('0x3d')]?_0x5ccfd7[_0x078e('0x3b')]:_0x1a49eb[_0x078e('0x37')];if(!_0x27cd9f[_0x078e('0x38')]['hasOwnProperty'](_0x078e('0x3f'))){_0x5ccfd7['limit']=qs[_0x078e('0x25')](_0x27cd9f[_0x078e('0x38')][_0x078e('0x25')]);_0x5ccfd7['offset']=qs[_0x078e('0x27')](_0x27cd9f[_0x078e('0x38')]['offset']);}_0x5ccfd7[_0x078e('0x40')]=qs[_0x078e('0x41')](_0x27cd9f[_0x078e('0x38')][_0x078e('0x41')]);_0x5ccfd7[_0x078e('0x42')]=qs['filters'](_['pick'](_0x27cd9f[_0x078e('0x38')],_0x1a49eb[_0x078e('0x43')]));if(_0x27cd9f[_0x078e('0x38')][_0x078e('0x55')]){_0x5ccfd7[_0x078e('0x42')]=_['merge'](_0x5ccfd7['where'],{'$or':_[_0x078e('0x56')](_0x5ccfd7[_0x078e('0x3b')],function(_0x5b007f){var _0xaa9aa1={};_0xaa9aa1[_0x5b007f]={'$like':'%'+_0x27cd9f[_0x078e('0x38')][_0x078e('0x55')]+'%'};return _0xaa9aa1;})});}_0x5ccfd7=_[_0x078e('0x45')]({},_0x5ccfd7,_0x27cd9f[_0x078e('0x4e')]);var _0x589b9b={'where':_0x5ccfd7[_0x078e('0x42')]};return db[_0x078e('0x33')][_0x078e('0x26')](_0x589b9b)[_0x078e('0x2d')](function(_0x459f85){_0x575bb0[_0x078e('0x26')]=_0x459f85;if(_0x27cd9f[_0x078e('0x38')][_0x078e('0x4d')]){_0x5ccfd7[_0x078e('0x47')]=[{'all':!![]}];}return db[_0x078e('0x33')][_0x078e('0x48')](_0x5ccfd7);})[_0x078e('0x2d')](function(_0x1d47ff){_0x575bb0['rows']=_0x1d47ff;return _0x575bb0;})['then'](respondWithFilteredResult(_0x5471c7,_0x5ccfd7,_0x078e('0x54')))[_0x078e('0x4a')](handleError(_0x5471c7,null,_0x078e('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7ae4271..7755c49 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 _0xe634=['hook','exports','events','../../mysqldb','VoiceQueueReport','save','update','emit','hasOwnProperty'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xe634,0x1c4));var _0x4e63=function(_0x222aed,_0x5b9158){_0x222aed=_0x222aed-0x0;var _0x44b98e=_0xe634[_0x222aed];return _0x44b98e;};'use strict';var EventEmitter=require(_0x4e63('0x0'));var VoiceQueueReport=require(_0x4e63('0x1'))['db'][_0x4e63('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e63('0x3'),'afterUpdate':_0x4e63('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b1964){return function(_0x46bfbe,_0x28f849,_0x3507ba){VoiceQueueReportEvents[_0x4e63('0x5')](_0x2b1964+':'+_0x46bfbe['id'],_0x46bfbe);VoiceQueueReportEvents[_0x4e63('0x5')](_0x2b1964,_0x46bfbe);_0x3507ba(null);};}for(var e in events){if(events[_0x4e63('0x6')](e)){var event=events[e];VoiceQueueReport[_0x4e63('0x7')](e,emitEvent(event));}}module[_0x4e63('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf0b3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3b728f,_0x2ab124){var _0xf7b775=function(_0x45f640){while(--_0x45f640){_0x3b728f['push'](_0x3b728f['shift']());}};_0xf7b775(++_0x2ab124);}(_0xf0b3,0x92));var _0x3f0b=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xf0b3[_0x47e549];return _0x251374;};'use strict';var EventEmitter=require(_0x3f0b('0x0'));var VoiceQueueReport=require(_0x3f0b('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3f0b('0x2')](0x0);var events={'afterCreate':_0x3f0b('0x3'),'afterUpdate':_0x3f0b('0x4'),'afterDestroy':_0x3f0b('0x5')};function emitEvent(_0x1e4d19){return function(_0x2c586a,_0x448173,_0x165e84){VoiceQueueReportEvents[_0x3f0b('0x6')](_0x1e4d19+':'+_0x2c586a['id'],_0x2c586a);VoiceQueueReportEvents['emit'](_0x1e4d19,_0x2c586a);_0x165e84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x3f0b('0x7')](e,emitEvent(event));}}module[_0x3f0b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 04b8922..25fe5fd 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 _0xac75=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x253f27,_0x559d16){var _0x6a46e8=function(_0xefcd7e){while(--_0xefcd7e){_0x253f27['push'](_0x253f27['shift']());}};_0x6a46e8(++_0x559d16);}(_0xac75,0x18c));var _0x5ac7=function(_0x3a658e,_0x42e82c){_0x3a658e=_0x3a658e-0x0;var _0x46ca59=_0xac75[_0x3a658e];return _0x46ca59;};'use strict';var _=require('lodash');var util=require(_0x5ac7('0x0'));var logger=require(_0x5ac7('0x1'))(_0x5ac7('0x2'));var moment=require(_0x5ac7('0x3'));var BPromise=require(_0x5ac7('0x4'));var rp=require(_0x5ac7('0x5'));var fs=require('fs');var path=require(_0x5ac7('0x6'));var rimraf=require(_0x5ac7('0x7'));var config=require(_0x5ac7('0x8'));var attributes=require(_0x5ac7('0x9'));module[_0x5ac7('0xa')]=function(_0x376337,_0x200a74){return _0x376337['define'](_0x5ac7('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5ac7('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5021=['../../config/environment','exports','define','uniqueid','calleridnum','lodash','util','api','bluebird','path','rimraf'];(function(_0x3e9613,_0x171ad5){var _0x40c7b7=function(_0x45affd){while(--_0x45affd){_0x3e9613['push'](_0x3e9613['shift']());}};_0x40c7b7(++_0x171ad5);}(_0x5021,0xaa));var _0x1502=function(_0x22e420,_0x13de97){_0x22e420=_0x22e420-0x0;var _0x45eb85=_0x5021[_0x22e420];return _0x45eb85;};'use strict';var _=require(_0x1502('0x0'));var util=require(_0x1502('0x1'));var logger=require('../../config/logger')(_0x1502('0x2'));var moment=require('moment');var BPromise=require(_0x1502('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1502('0x4'));var rimraf=require(_0x1502('0x5'));var config=require(_0x1502('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x1502('0x7')]=function(_0x4942cf,_0x49b75e){return _0x4942cf[_0x1502('0x8')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1502('0x9')]},{'fields':[_0x1502('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 8f18f13..50c1f98 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 _0x87d3=['error','code','message','catch','VoiceQueueReport','findAll','options','where','attributes','include','model','map','then','debug','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21dc0c,_0x64bb32){var _0x57d588=function(_0x62a3f4){while(--_0x62a3f4){_0x21dc0c['push'](_0x21dc0c['shift']());}};_0x57d588(++_0x64bb32);}(_0x87d3,0x13a));var _0x387d=function(_0x49e6db,_0x1a4546){_0x49e6db=_0x49e6db-0x0;var _0x5a6137=_0x87d3[_0x49e6db];return _0x5a6137;};'use strict';var _=require(_0x387d('0x0'));var util=require(_0x387d('0x1'));var moment=require(_0x387d('0x2'));var BPromise=require('bluebird');var rs=require(_0x387d('0x3'));var fs=require('fs');var Redis=require(_0x387d('0x4'));var db=require(_0x387d('0x5'))['db'];var utils=require(_0x387d('0x6'));var logger=require(_0x387d('0x7'))(_0x387d('0x8'));var config=require('../../config/environment');var jayson=require(_0x387d('0x9'));var client=jayson[_0x387d('0xa')][_0x387d('0xb')]({'port':0x232a});config[_0x387d('0xc')]=_[_0x387d('0xd')](config['redis'],{'host':_0x387d('0xe'),'port':0x18eb});var socket=require(_0x387d('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x387d('0x10')](socket);function respondWithRpcPromise(_0x51467a,_0x474a9b,_0x2901ad){return new BPromise(function(_0x2c6d22,_0x515f8f){return client['request'](_0x51467a,_0x2901ad)['then'](function(_0x87e367){logger[_0x387d('0x11')](_0x387d('0x12'),_0x474a9b,_0x387d('0x13'));logger['debug'](_0x387d('0x14'),_0x474a9b,_0x387d('0x13'),JSON[_0x387d('0x15')](_0x87e367));if(_0x87e367[_0x387d('0x16')]){if(_0x87e367[_0x387d('0x16')][_0x387d('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x87e367[_0x387d('0x16')][_0x387d('0x18')]);return _0x515f8f(_0x87e367[_0x387d('0x16')]['message']);}logger[_0x387d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x87e367['error'][_0x387d('0x18')]);return _0x2c6d22(_0x87e367[_0x387d('0x16')]['message']);}else{logger[_0x387d('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x474a9b,_0x387d('0x13'));_0x2c6d22(_0x87e367['result'][_0x387d('0x18')]);}})[_0x387d('0x19')](function(_0x22d582){logger['error'](_0x387d('0x12'),_0x474a9b,_0x22d582);_0x515f8f(_0x22d582);});});}exports['GetVoiceQueueReport']=function(_0x1a9ef2){var _0x7dc2db=this;return new Promise(function(_0x218023,_0x53933e){return db[_0x387d('0x1a')][_0x387d('0x1b')]({'raw':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2[_0x387d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2[_0x387d('0x1c')][_0x387d('0x1d')]||null:null,'attributes':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2['options'][_0x387d('0x1e')]||null:null,'limit':_0x1a9ef2[_0x387d('0x1c')]?_0x1a9ef2['options']['limit']||null:null,'include':_0x1a9ef2['options']?_0x1a9ef2[_0x387d('0x1c')][_0x387d('0x1f')]?_['map'](_0x1a9ef2[_0x387d('0x1c')]['include'],function(_0x17d51e){return{'model':db[_0x17d51e[_0x387d('0x20')]],'as':_0x17d51e['as'],'attributes':_0x17d51e[_0x387d('0x1e')],'include':_0x17d51e[_0x387d('0x1f')]?_[_0x387d('0x21')](_0x17d51e['include'],function(_0x2547c4){return{'model':db[_0x2547c4[_0x387d('0x20')]],'as':_0x2547c4['as'],'attributes':_0x2547c4[_0x387d('0x1e')],'include':_0x2547c4[_0x387d('0x1f')]?_[_0x387d('0x21')](_0x2547c4[_0x387d('0x1f')],function(_0x38c77a){return{'model':db[_0x38c77a['model']],'as':_0x38c77a['as'],'attributes':_0x38c77a[_0x387d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x387d('0x22')](function(_0x568a42){logger[_0x387d('0x11')]('GetVoiceQueueReport',_0x1a9ef2);logger[_0x387d('0x23')]('GetVoiceQueueReport',_0x1a9ef2,JSON['stringify'](_0x568a42));_0x218023(_0x568a42);})[_0x387d('0x19')](function(_0x358ac6){logger[_0x387d('0x16')](_0x387d('0x24'),_0x358ac6[_0x387d('0x18')],_0x1a9ef2);_0x53933e(_0x7dc2db[_0x387d('0x16')](0x1f4,_0x358ac6[_0x387d('0x18')]));});});};exports[_0x387d('0x25')]=function(_0x42bcf7){var _0x54029c=this;return new Promise(function(_0x269a24,_0x306767){return db[_0x387d('0x1a')][_0x387d('0x26')](_0x42bcf7[_0x387d('0x27')],{'raw':_0x42bcf7['options']?_0x42bcf7[_0x387d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x387d('0x22')](function(_0x46305d){logger[_0x387d('0x11')](_0x387d('0x25'),_0x42bcf7);logger['debug']('CreateVoiceQueueReport',_0x42bcf7,JSON[_0x387d('0x15')](_0x46305d));_0x269a24(_0x46305d);})[_0x387d('0x19')](function(_0x33e5e2){logger[_0x387d('0x16')](_0x387d('0x25'),_0x33e5e2['message'],_0x42bcf7);_0x306767(_0x54029c[_0x387d('0x16')](0x1f4,_0x33e5e2[_0x387d('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1df6a5){var _0x18a588=this;return new Promise(function(_0x35deb6,_0x522681){return db['VoiceQueueReport']['update'](_0x1df6a5[_0x387d('0x27')],{'raw':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')][_0x387d('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')][_0x387d('0x1d')]||null:null,'attributes':_0x1df6a5['options']?_0x1df6a5[_0x387d('0x1c')]['attributes']||null:null,'limit':_0x1df6a5[_0x387d('0x1c')]?_0x1df6a5[_0x387d('0x1c')]['limit']||null:null})[_0x387d('0x22')](function(_0x4ab136){logger['info'](_0x387d('0x29'),_0x1df6a5);logger[_0x387d('0x23')](_0x387d('0x29'),_0x1df6a5,JSON[_0x387d('0x15')](_0x4ab136));_0x35deb6(_0x4ab136);})[_0x387d('0x19')](function(_0x385627){logger[_0x387d('0x16')](_0x387d('0x29'),_0x385627[_0x387d('0x18')],_0x1df6a5);_0x522681(_0x18a588[_0x387d('0x16')](0x1f4,_0x385627[_0x387d('0x18')]));});});}; \ No newline at end of file +var _0xb238=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','include','map','model','attributes','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','lodash','moment'];(function(_0x24e064,_0x240373){var _0x34abec=function(_0x244b5d){while(--_0x244b5d){_0x24e064['push'](_0x24e064['shift']());}};_0x34abec(++_0x240373);}(_0xb238,0x96));var _0x8b23=function(_0x400635,_0x49a764){_0x400635=_0x400635-0x0;var _0x5b0c61=_0xb238[_0x400635];return _0x5b0c61;};'use strict';var _=require(_0x8b23('0x0'));var util=require('util');var moment=require(_0x8b23('0x1'));var BPromise=require(_0x8b23('0x2'));var rs=require(_0x8b23('0x3'));var fs=require('fs');var Redis=require(_0x8b23('0x4'));var db=require(_0x8b23('0x5'))['db'];var utils=require(_0x8b23('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b23('0x7'));var jayson=require(_0x8b23('0x8'));var client=jayson[_0x8b23('0x9')][_0x8b23('0xa')]({'port':0x232a});config[_0x8b23('0xb')]=_['defaults'](config[_0x8b23('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b23('0xc'))(new Redis(config['redis']));require(_0x8b23('0xd'))['register'](socket);function respondWithRpcPromise(_0x150fce,_0x58bacc,_0x6975d){return new BPromise(function(_0x2a507f,_0x166f35){return client['request'](_0x150fce,_0x6975d)[_0x8b23('0xe')](function(_0x31957b){logger[_0x8b23('0xf')](_0x8b23('0x10'),_0x58bacc,_0x8b23('0x11'));logger[_0x8b23('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x58bacc,_0x8b23('0x11'),JSON[_0x8b23('0x13')](_0x31957b));if(_0x31957b['error']){if(_0x31957b[_0x8b23('0x14')][_0x8b23('0x15')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x58bacc,_0x31957b['error'][_0x8b23('0x16')]);return _0x166f35(_0x31957b[_0x8b23('0x14')]['message']);}logger[_0x8b23('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x58bacc,_0x31957b[_0x8b23('0x14')]['message']);return _0x2a507f(_0x31957b[_0x8b23('0x14')][_0x8b23('0x16')]);}else{logger[_0x8b23('0xf')](_0x8b23('0x10'),_0x58bacc,_0x8b23('0x11'));_0x2a507f(_0x31957b['result']['message']);}})[_0x8b23('0x17')](function(_0x157822){logger[_0x8b23('0x14')](_0x8b23('0x10'),_0x58bacc,_0x157822);_0x166f35(_0x157822);});});}exports[_0x8b23('0x18')]=function(_0x1ff53d){var _0x319662=this;return new Promise(function(_0x16832a,_0x117053){return db[_0x8b23('0x19')]['findAll']({'raw':_0x1ff53d[_0x8b23('0x1a')]?_0x1ff53d[_0x8b23('0x1a')][_0x8b23('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ff53d[_0x8b23('0x1a')]?_0x1ff53d['options'][_0x8b23('0x1c')]||null:null,'attributes':_0x1ff53d[_0x8b23('0x1a')]?_0x1ff53d[_0x8b23('0x1a')]['attributes']||null:null,'limit':_0x1ff53d[_0x8b23('0x1a')]?_0x1ff53d[_0x8b23('0x1a')]['limit']||null:null,'include':_0x1ff53d[_0x8b23('0x1a')]?_0x1ff53d['options'][_0x8b23('0x1d')]?_[_0x8b23('0x1e')](_0x1ff53d[_0x8b23('0x1a')]['include'],function(_0x1cfd5d){return{'model':db[_0x1cfd5d['model']],'as':_0x1cfd5d['as'],'attributes':_0x1cfd5d['attributes'],'include':_0x1cfd5d['include']?_[_0x8b23('0x1e')](_0x1cfd5d['include'],function(_0x4c4147){return{'model':db[_0x4c4147[_0x8b23('0x1f')]],'as':_0x4c4147['as'],'attributes':_0x4c4147[_0x8b23('0x20')],'include':_0x4c4147[_0x8b23('0x1d')]?_[_0x8b23('0x1e')](_0x4c4147[_0x8b23('0x1d')],function(_0x3e9906){return{'model':db[_0x3e9906[_0x8b23('0x1f')]],'as':_0x3e9906['as'],'attributes':_0x3e9906[_0x8b23('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b23('0xe')](function(_0x2b41de){logger[_0x8b23('0xf')]('GetVoiceQueueReport',_0x1ff53d);logger[_0x8b23('0x12')]('GetVoiceQueueReport',_0x1ff53d,JSON[_0x8b23('0x13')](_0x2b41de));_0x16832a(_0x2b41de);})[_0x8b23('0x17')](function(_0x4618fa){logger['error']('GetVoiceQueueReport',_0x4618fa['message'],_0x1ff53d);_0x117053(_0x319662[_0x8b23('0x14')](0x1f4,_0x4618fa[_0x8b23('0x16')]));});});};exports[_0x8b23('0x21')]=function(_0x206ff6){var _0x1cb096=this;return new Promise(function(_0x1e20fd,_0x5c51c6){return db[_0x8b23('0x19')][_0x8b23('0x22')](_0x206ff6[_0x8b23('0x23')],{'raw':_0x206ff6[_0x8b23('0x1a')]?_0x206ff6[_0x8b23('0x1a')][_0x8b23('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x18a7ba){logger['info'](_0x8b23('0x21'),_0x206ff6);logger[_0x8b23('0x12')](_0x8b23('0x21'),_0x206ff6,JSON['stringify'](_0x18a7ba));_0x1e20fd(_0x18a7ba);})[_0x8b23('0x17')](function(_0x84e616){logger[_0x8b23('0x14')](_0x8b23('0x21'),_0x84e616[_0x8b23('0x16')],_0x206ff6);_0x5c51c6(_0x1cb096[_0x8b23('0x14')](0x1f4,_0x84e616[_0x8b23('0x16')]));});});};exports[_0x8b23('0x24')]=function(_0x70c069){var _0xff3ae2=this;return new Promise(function(_0x1e85e2,_0xe3d12){return db[_0x8b23('0x19')]['update'](_0x70c069[_0x8b23('0x23')],{'raw':_0x70c069[_0x8b23('0x1a')]?_0x70c069['options'][_0x8b23('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x70c069[_0x8b23('0x1a')]?_0x70c069[_0x8b23('0x1a')][_0x8b23('0x1c')]||null:null,'attributes':_0x70c069['options']?_0x70c069[_0x8b23('0x1a')][_0x8b23('0x20')]||null:null,'limit':_0x70c069[_0x8b23('0x1a')]?_0x70c069[_0x8b23('0x1a')][_0x8b23('0x25')]||null:null})[_0x8b23('0xe')](function(_0x594edb){logger[_0x8b23('0xf')]('UpdateVoiceQueueReport',_0x70c069);logger[_0x8b23('0x12')](_0x8b23('0x24'),_0x70c069,JSON[_0x8b23('0x13')](_0x594edb));_0x1e85e2(_0x594edb);})[_0x8b23('0x17')](function(_0x9cfdb8){logger['error']('UpdateVoiceQueueReport',_0x9cfdb8[_0x8b23('0x16')],_0x70c069);_0xe3d12(_0xff3ae2[_0x8b23('0x14')](0x1f4,_0x9cfdb8[_0x8b23('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b27a181..b94c670 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 _0xbc61=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x79fb36,_0x2f6c6f){var _0x536c1d=function(_0x452815){while(--_0x452815){_0x79fb36['push'](_0x79fb36['shift']());}};_0x536c1d(++_0x2f6c6f);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x4cd78d,_0x4e15ea){_0x4cd78d=_0x4cd78d-0x0;var _0x58d8d1=_0xbc61[_0x4cd78d];return _0x58d8d1;};'use strict';var VoiceQueueReportEvents=require(_0x1bc6('0x0'));var events=[_0x1bc6('0x1'),_0x1bc6('0x2'),_0x1bc6('0x3')];function createListener(_0x5ad531,_0x20d016){return function(_0x5945ee){_0x20d016[_0x1bc6('0x4')](_0x5ad531,_0x5945ee);};}function removeListener(_0x2416a1,_0x571edc){return function(){VoiceQueueReportEvents[_0x1bc6('0x5')](_0x2416a1,_0x571edc);};}exports[_0x1bc6('0x6')]=function(_0x23c00e){for(var _0x15da49=0x0,_0x51c8c7=events[_0x1bc6('0x7')];_0x15da49<_0x51c8c7;_0x15da49++){var _0xeb728e=events[_0x15da49];var _0x3112bc=createListener(_0x1bc6('0x8')+_0xeb728e,_0x23c00e);VoiceQueueReportEvents['on'](_0xeb728e,_0x3112bc);}}; \ No newline at end of file +var _0xdcf0=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','removeListener','register'];(function(_0x2ed08d,_0xed55cf){var _0x1e6057=function(_0x572efa){while(--_0x572efa){_0x2ed08d['push'](_0x2ed08d['shift']());}};_0x1e6057(++_0xed55cf);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x4d21a9,_0x31f5e0){_0x4d21a9=_0x4d21a9-0x0;var _0x317659=_0xdcf0[_0x4d21a9];return _0x317659;};'use strict';var VoiceQueueReportEvents=require(_0x0dcf('0x0'));var events=[_0x0dcf('0x1'),'remove',_0x0dcf('0x2')];function createListener(_0x4390bb,_0x53ce12){return function(_0x41aea7){_0x53ce12['emit'](_0x4390bb,_0x41aea7);};}function removeListener(_0x4b1323,_0x388fc3){return function(){VoiceQueueReportEvents[_0x0dcf('0x3')](_0x4b1323,_0x388fc3);};}exports[_0x0dcf('0x4')]=function(_0x2586c8){for(var _0x1367df=0x0,_0x598cf5=events[_0x0dcf('0x5')];_0x1367df<_0x598cf5;_0x1367df++){var _0x4ea8e2=events[_0x1367df];var _0x37871c=createListener(_0x0dcf('0x6')+_0x4ea8e2,_0x2586c8);VoiceQueueReportEvents['on'](_0x4ea8e2,_0x37871c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8ef82d0..6862dd0 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 _0xa71e=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x414c77,_0x17b360){var _0x937a24=function(_0x3a135a){while(--_0x3a135a){_0x414c77['push'](_0x414c77['shift']());}};_0x937a24(++_0x17b360);}(_0xa71e,0x7b));var _0xea71=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0xa71e[_0x35a779];return _0xca723b;};'use strict';var multer=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var path=require('path');var timeout=require(_0xea71('0x2'));var express=require('express');var router=express[_0xea71('0x3')]();var fs_extra=require(_0xea71('0x4'));var auth=require(_0xea71('0x5'));var interaction=require(_0xea71('0x6'));var config=require(_0xea71('0x7'));var controller=require(_0xea71('0x8'));router[_0xea71('0x9')]('/',auth[_0xea71('0xa')](),controller[_0xea71('0xb')]);router['get'](_0xea71('0xc'),auth[_0xea71('0xa')](),controller[_0xea71('0xd')]);router[_0xea71('0xe')]('/',auth[_0xea71('0xa')](),controller['create']);router[_0xea71('0xf')](_0xea71('0xc'),auth['isAuthenticated'](),controller[_0xea71('0x10')]);router[_0xea71('0x11')](_0xea71('0xc'),auth[_0xea71('0xa')](),controller[_0xea71('0x12')]);module[_0xea71('0x13')]=router; \ No newline at end of file +var _0x63e4=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2942b8,_0x4dea93){var _0x285d17=function(_0x4e208e){while(--_0x4e208e){_0x2942b8['push'](_0x2942b8['shift']());}};_0x285d17(++_0x4dea93);}(_0x63e4,0x12a));var _0x463e=function(_0x436404,_0x1b1a49){_0x436404=_0x436404-0x0;var _0x28c660=_0x63e4[_0x436404];return _0x28c660;};'use strict';var multer=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var path=require(_0x463e('0x2'));var timeout=require(_0x463e('0x3'));var express=require(_0x463e('0x4'));var router=express[_0x463e('0x5')]();var fs_extra=require(_0x463e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x463e('0x7'));var config=require(_0x463e('0x8'));var controller=require(_0x463e('0x9'));router[_0x463e('0xa')]('/',auth[_0x463e('0xb')](),controller[_0x463e('0xc')]);router[_0x463e('0xa')](_0x463e('0xd'),auth[_0x463e('0xb')](),controller[_0x463e('0xe')]);router[_0x463e('0xf')]('/',auth[_0x463e('0xb')](),controller[_0x463e('0x10')]);router[_0x463e('0x11')](_0x463e('0xd'),auth['isAuthenticated'](),controller[_0x463e('0x12')]);router[_0x463e('0x13')](_0x463e('0xd'),auth[_0x463e('0xb')](),controller['destroy']);module[_0x463e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 00f41a6..e425bd8 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 _0x1cbc=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x3416c3,_0x314646){var _0x2934d1=function(_0x107488){while(--_0x107488){_0x3416c3['push'](_0x3416c3['shift']());}};_0x2934d1(++_0x314646);}(_0x1cbc,0x1cc));var _0xc1cb=function(_0x45283b,_0xe68902){_0x45283b=_0x45283b-0x0;var _0x1b23f9=_0x1cbc[_0x45283b];return _0x1b23f9;};'use strict';var Sequelize=require(_0xc1cb('0x0'));var moment=require(_0xc1cb('0x1'));module[_0xc1cb('0x2')]={'time':{'type':Sequelize[_0xc1cb('0x3')]},'callid':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc1cb('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc1cb('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc1cb('0x5')](_0xc1cb('0x6'))}}; \ No newline at end of file +var _0xe6b5=['exports','STRING','sequelize','moment'];(function(_0x3d9e56,_0x27ddb8){var _0xf036a5=function(_0x1e4523){while(--_0x1e4523){_0x3d9e56['push'](_0x3d9e56['shift']());}};_0xf036a5(++_0x27ddb8);}(_0xe6b5,0xde));var _0x5e6b=function(_0x265f20,_0x49e16b){_0x265f20=_0x265f20-0x0;var _0x59d620=_0xe6b5[_0x265f20];return _0x59d620;};'use strict';var Sequelize=require(_0x5e6b('0x0'));var moment=require(_0x5e6b('0x1'));module[_0x5e6b('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5e6b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('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 dde6076..9afd403 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 _0x5e23=['keys','attributes','fields','length','nolimit','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','intersection','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','name','query'];(function(_0x5d2c85,_0x50b8e7){var _0x5d59ff=function(_0x3371b6){while(--_0x3371b6){_0x5d2c85['push'](_0x5d2c85['shift']());}};_0x5d59ff(++_0x50b8e7);}(_0x5e23,0xe4));var _0x35e2=function(_0x57a1bf,_0x3b3732){_0x57a1bf=_0x57a1bf-0x0;var _0xb1facb=_0x5e23[_0x57a1bf];return _0xb1facb;};'use strict';var emlformat=require(_0x35e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x35e2('0x2'));var BPromise=require(_0x35e2('0x3'));var Mustache=require(_0x35e2('0x4'));var util=require(_0x35e2('0x5'));var path=require(_0x35e2('0x6'));var sox=require(_0x35e2('0x7'));var csv=require('to-csv');var ejs=require(_0x35e2('0x8'));var fs=require('fs');var fs_extra=require(_0x35e2('0x9'));var _=require(_0x35e2('0xa'));var squel=require(_0x35e2('0xb'));var crypto=require(_0x35e2('0xc'));var jsforce=require(_0x35e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x35e2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x35e2('0xf'));var authService=require(_0x35e2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35e2('0x11'));var hardwareService=require(_0x35e2('0x12'));var logger=require(_0x35e2('0x13'))(_0x35e2('0x14'));var utils=require('../../config/utils');var config=require(_0x35e2('0x15'));var licenseUtil=require(_0x35e2('0x16'));var db=require(_0x35e2('0x17'))['db'];function respondWithStatusCode(_0xef95f3,_0x3f75cb){_0x3f75cb=_0x3f75cb||0xcc;return function(_0x5def34){if(_0x5def34){return _0xef95f3['sendStatus'](_0x3f75cb);}return _0xef95f3['status'](_0x3f75cb)['end']();};}function respondWithResult(_0x12c638,_0x840e03){_0x840e03=_0x840e03||0xc8;return function(_0x5f04fa){if(_0x5f04fa){return _0x12c638[_0x35e2('0x18')](_0x840e03)[_0x35e2('0x19')](_0x5f04fa);}};}function respondWithFilteredResult(_0x43e526,_0x198762){return function(_0x190cfe){if(_0x190cfe){var _0xe6cda4=typeof _0x198762[_0x35e2('0x1a')]==='undefined'&&typeof _0x198762[_0x35e2('0x1b')]===_0x35e2('0x1c');var _0x58aace=_0x190cfe[_0x35e2('0x1d')];var _0x731585=_0xe6cda4?0x0:_0x198762[_0x35e2('0x1a')];var _0x3c0247=_0xe6cda4?_0x190cfe[_0x35e2('0x1d')]:_0x198762['offset']+_0x198762['limit'];var _0x365f6a;if(_0x3c0247>=_0x58aace){_0x3c0247=_0x58aace;_0x365f6a=0xc8;}else{_0x365f6a=0xce;}_0x43e526['status'](_0x365f6a);return _0x43e526[_0x35e2('0x1e')]('Content-Range',_0x731585+'-'+_0x3c0247+'/'+_0x58aace)['json'](_0x190cfe);}return null;};}function patchUpdates(_0x591456){return function(_0x23deaa){try{jsonpatch[_0x35e2('0x1f')](_0x23deaa,_0x591456,!![]);}catch(_0x1f4660){return BPromise[_0x35e2('0x20')](_0x1f4660);}return _0x23deaa[_0x35e2('0x21')]();};}function saveUpdates(_0x58297d,_0x36505c){return function(_0x3d73a9){if(_0x3d73a9){return _0x3d73a9[_0x35e2('0x22')](_0x58297d)[_0x35e2('0x23')](function(_0x225b15){return _0x225b15;});}return null;};}function removeEntity(_0x2665d4,_0x5091e9){return function(_0x146f8d){if(_0x146f8d){return _0x146f8d[_0x35e2('0x24')]()[_0x35e2('0x23')](function(){_0x2665d4[_0x35e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9ced,_0x52e99e){return function(_0x2a303e){if(!_0x2a303e){_0x3c9ced['sendStatus'](0x194);}return _0x2a303e;};}function handleError(_0x7d36ae,_0x224601){_0x224601=_0x224601||0x1f4;return function(_0x5c6f59){logger['error'](_0x5c6f59['stack']);if(_0x5c6f59['name']){delete _0x5c6f59['name'];}_0x7d36ae[_0x35e2('0x18')](_0x224601)[_0x35e2('0x25')](_0x5c6f59);};}exports[_0x35e2('0x26')]=function(_0xb6f55d,_0x138478){var _0x681815={},_0x3ddc7a={},_0x2d5e6d={'count':0x0,'rows':[]};var _0x4e7beb=_['map'](db[_0x35e2('0x27')][_0x35e2('0x28')],function(_0x2a4f66){return{'name':_0x2a4f66[_0x35e2('0x29')],'type':_0x2a4f66[_0x35e2('0x2a')][_0x35e2('0x2b')]};});_0x3ddc7a[_0x35e2('0x2c')]=_[_0x35e2('0x2d')](_0x4e7beb,_0x35e2('0x2e'));_0x3ddc7a[_0x35e2('0x2f')]=_[_0x35e2('0x30')](_0xb6f55d[_0x35e2('0x2f')]);_0x3ddc7a['filters']=_['intersection'](_0x3ddc7a[_0x35e2('0x2c')],_0x3ddc7a[_0x35e2('0x2f')]);_0x681815[_0x35e2('0x31')]=_['intersection'](_0x3ddc7a[_0x35e2('0x2c')],qs[_0x35e2('0x32')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x32')]));_0x681815[_0x35e2('0x31')]=_0x681815[_0x35e2('0x31')][_0x35e2('0x33')]?_0x681815[_0x35e2('0x31')]:_0x3ddc7a[_0x35e2('0x2c')];if(!_0xb6f55d[_0x35e2('0x2f')]['hasOwnProperty'](_0x35e2('0x34'))){_0x681815[_0x35e2('0x1b')]=qs[_0x35e2('0x1b')](_0xb6f55d['query'][_0x35e2('0x1b')]);_0x681815['offset']=qs[_0x35e2('0x1a')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x1a')]);}_0x681815['order']=qs[_0x35e2('0x35')](_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x35')]);_0x681815['where']=qs[_0x35e2('0x36')](_['pick'](_0xb6f55d[_0x35e2('0x2f')],_0x3ddc7a[_0x35e2('0x36')]),_0x4e7beb);if(_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x37')]){_0x681815[_0x35e2('0x38')]=_[_0x35e2('0x39')](_0x681815['where'],{'$or':_['map'](_0x4e7beb,function(_0x431047){if(_0x431047[_0x35e2('0x2a')]!=='VIRTUAL'){var _0x2f8032={};_0x2f8032[_0x431047[_0x35e2('0x2e')]]={'$like':'%'+_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x37')]+'%'};return _0x2f8032;}})});}_0x681815=_['merge']({},_0x681815,_0xb6f55d[_0x35e2('0x3a')]);var _0x3c6541={'where':_0x681815['where']};return db['VoiceQueuesLog'][_0x35e2('0x1d')](_0x3c6541)[_0x35e2('0x23')](function(_0x49e8b4){_0x2d5e6d[_0x35e2('0x1d')]=_0x49e8b4;if(_0xb6f55d[_0x35e2('0x2f')][_0x35e2('0x3b')]){_0x681815['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x35e2('0x3c')](_0x681815);})[_0x35e2('0x23')](function(_0x440389){_0x2d5e6d[_0x35e2('0x3d')]=_0x440389;return _0x2d5e6d;})[_0x35e2('0x23')](respondWithFilteredResult(_0x138478,_0x681815))[_0x35e2('0x3e')](handleError(_0x138478,null));};exports[_0x35e2('0x3f')]=function(_0xa7466e,_0x81c711){var _0x460a27={'raw':!![],'where':{'id':_0xa7466e['params']['id']}},_0x5d118d={};_0x5d118d[_0x35e2('0x2c')]=_['keys'](db[_0x35e2('0x27')][_0x35e2('0x28')]);_0x5d118d['query']=_[_0x35e2('0x30')](_0xa7466e[_0x35e2('0x2f')]);_0x5d118d['filters']=_['intersection'](_0x5d118d['model'],_0x5d118d[_0x35e2('0x2f')]);_0x460a27[_0x35e2('0x31')]=_[_0x35e2('0x40')](_0x5d118d['model'],qs['fields'](_0xa7466e[_0x35e2('0x2f')][_0x35e2('0x32')]));_0x460a27[_0x35e2('0x31')]=_0x460a27[_0x35e2('0x31')][_0x35e2('0x33')]?_0x460a27[_0x35e2('0x31')]:_0x5d118d[_0x35e2('0x2c')];if(_0xa7466e[_0x35e2('0x2f')]['includeAll']){_0x460a27['include']=[{'all':!![]}];}_0x460a27=_[_0x35e2('0x39')]({},_0x460a27,_0xa7466e['options']);return db[_0x35e2('0x27')][_0x35e2('0x41')](_0x460a27)[_0x35e2('0x23')](handleEntityNotFound(_0x81c711,null))[_0x35e2('0x23')](respondWithResult(_0x81c711,null))['catch'](handleError(_0x81c711,null));};exports[_0x35e2('0x42')]=function(_0x292c05,_0xf61d4f){return db[_0x35e2('0x27')][_0x35e2('0x42')](_0x292c05[_0x35e2('0x43')],{})[_0x35e2('0x23')](respondWithResult(_0xf61d4f,0xc9))[_0x35e2('0x3e')](handleError(_0xf61d4f,null));};exports[_0x35e2('0x22')]=function(_0x11c9dc,_0x351303){if(_0x11c9dc[_0x35e2('0x43')]['id']){delete _0x11c9dc[_0x35e2('0x43')]['id'];}return db[_0x35e2('0x27')][_0x35e2('0x41')]({'where':{'id':_0x11c9dc[_0x35e2('0x44')]['id']}})[_0x35e2('0x23')](handleEntityNotFound(_0x351303,null))[_0x35e2('0x23')](saveUpdates(_0x11c9dc[_0x35e2('0x43')],null))[_0x35e2('0x23')](respondWithResult(_0x351303,null))[_0x35e2('0x3e')](handleError(_0x351303,null));};exports['destroy']=function(_0x3aa410,_0x28a239){return db[_0x35e2('0x27')][_0x35e2('0x41')]({'where':{'id':_0x3aa410[_0x35e2('0x44')]['id']}})[_0x35e2('0x23')](handleEntityNotFound(_0x28a239,null))[_0x35e2('0x23')](removeEntity(_0x28a239,null))[_0x35e2('0x3e')](handleError(_0x28a239,null));}; \ No newline at end of file +var _0xebf6=['set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','VoiceQueuesLog','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xebf6,0xc5));var _0x6ebf=function(_0x19d09f,_0x2bd6d6){_0x19d09f=_0x19d09f-0x0;var _0x178b15=_0xebf6[_0x19d09f];return _0x178b15;};'use strict';var emlformat=require(_0x6ebf('0x0'));var rimraf=require(_0x6ebf('0x1'));var zipdir=require(_0x6ebf('0x2'));var jsonpatch=require(_0x6ebf('0x3'));var rp=require('request-promise');var moment=require(_0x6ebf('0x4'));var BPromise=require(_0x6ebf('0x5'));var Mustache=require(_0x6ebf('0x6'));var util=require(_0x6ebf('0x7'));var path=require('path');var sox=require(_0x6ebf('0x8'));var csv=require('to-csv');var ejs=require(_0x6ebf('0x9'));var fs=require('fs');var fs_extra=require(_0x6ebf('0xa'));var _=require('lodash');var squel=require(_0x6ebf('0xb'));var crypto=require(_0x6ebf('0xc'));var jsforce=require(_0x6ebf('0xd'));var deskjs=require(_0x6ebf('0xe'));var toCsv=require(_0x6ebf('0xf'));var querystring=require(_0x6ebf('0x10'));var Papa=require(_0x6ebf('0x11'));var Redis=require(_0x6ebf('0x12'));var authService=require(_0x6ebf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6ebf('0x14'));var hardwareService=require(_0x6ebf('0x15'));var logger=require('../../config/logger')(_0x6ebf('0x16'));var utils=require(_0x6ebf('0x17'));var config=require(_0x6ebf('0x18'));var licenseUtil=require(_0x6ebf('0x19'));var db=require(_0x6ebf('0x1a'))['db'];function respondWithStatusCode(_0x59445d,_0x474905){_0x474905=_0x474905||0xcc;return function(_0x43f220){if(_0x43f220){return _0x59445d[_0x6ebf('0x1b')](_0x474905);}return _0x59445d['status'](_0x474905)['end']();};}function respondWithResult(_0x1cc036,_0x7b4fe4){_0x7b4fe4=_0x7b4fe4||0xc8;return function(_0x360f72){if(_0x360f72){return _0x1cc036['status'](_0x7b4fe4)[_0x6ebf('0x1c')](_0x360f72);}};}function respondWithFilteredResult(_0x5d47fe,_0x45d662){return function(_0x566e66){if(_0x566e66){var _0x52dc05=typeof _0x45d662[_0x6ebf('0x1d')]===_0x6ebf('0x1e')&&typeof _0x45d662['limit']===_0x6ebf('0x1e');var _0x5e351c=_0x566e66[_0x6ebf('0x1f')];var _0x40df25=_0x52dc05?0x0:_0x45d662['offset'];var _0x46107b=_0x52dc05?_0x566e66['count']:_0x45d662['offset']+_0x45d662[_0x6ebf('0x20')];var _0x364b21;if(_0x46107b>=_0x5e351c){_0x46107b=_0x5e351c;_0x364b21=0xc8;}else{_0x364b21=0xce;}_0x5d47fe[_0x6ebf('0x21')](_0x364b21);return _0x5d47fe[_0x6ebf('0x22')](_0x6ebf('0x23'),_0x40df25+'-'+_0x46107b+'/'+_0x5e351c)['json'](_0x566e66);}return null;};}function patchUpdates(_0xea4e37){return function(_0x1fe851){try{jsonpatch[_0x6ebf('0x24')](_0x1fe851,_0xea4e37,!![]);}catch(_0x48462c){return BPromise[_0x6ebf('0x25')](_0x48462c);}return _0x1fe851[_0x6ebf('0x26')]();};}function saveUpdates(_0xf4b9c2,_0x39a832){return function(_0x49bc66){if(_0x49bc66){return _0x49bc66[_0x6ebf('0x27')](_0xf4b9c2)[_0x6ebf('0x28')](function(_0x1a4311){return _0x1a4311;});}return null;};}function removeEntity(_0x237b36,_0x10b205){return function(_0x313b85){if(_0x313b85){return _0x313b85['destroy']()[_0x6ebf('0x28')](function(){_0x237b36[_0x6ebf('0x21')](0xcc)[_0x6ebf('0x29')]();});}};}function handleEntityNotFound(_0x482fa6,_0x370a1a){return function(_0x360f16){if(!_0x360f16){_0x482fa6['sendStatus'](0x194);}return _0x360f16;};}function handleError(_0x1af009,_0x2ddea2){_0x2ddea2=_0x2ddea2||0x1f4;return function(_0x49c716){logger[_0x6ebf('0x2a')](_0x49c716[_0x6ebf('0x2b')]);if(_0x49c716[_0x6ebf('0x2c')]){delete _0x49c716[_0x6ebf('0x2c')];}_0x1af009[_0x6ebf('0x21')](_0x2ddea2)[_0x6ebf('0x2d')](_0x49c716);};}exports[_0x6ebf('0x2e')]=function(_0x3fcb71,_0x226738){var _0x3619a2={},_0x2fdc7f={},_0xa6d7c9={'count':0x0,'rows':[]};var _0x10107b=_['map'](db[_0x6ebf('0x2f')]['rawAttributes'],function(_0x408a04){return{'name':_0x408a04[_0x6ebf('0x30')],'type':_0x408a04[_0x6ebf('0x31')][_0x6ebf('0x32')]};});_0x2fdc7f['model']=_['map'](_0x10107b,_0x6ebf('0x2c'));_0x2fdc7f[_0x6ebf('0x33')]=_[_0x6ebf('0x34')](_0x3fcb71[_0x6ebf('0x33')]);_0x2fdc7f[_0x6ebf('0x35')]=_[_0x6ebf('0x36')](_0x2fdc7f[_0x6ebf('0x37')],_0x2fdc7f[_0x6ebf('0x33')]);_0x3619a2[_0x6ebf('0x38')]=_[_0x6ebf('0x36')](_0x2fdc7f['model'],qs[_0x6ebf('0x39')](_0x3fcb71['query'][_0x6ebf('0x39')]));_0x3619a2[_0x6ebf('0x38')]=_0x3619a2[_0x6ebf('0x38')][_0x6ebf('0x3a')]?_0x3619a2[_0x6ebf('0x38')]:_0x2fdc7f[_0x6ebf('0x37')];if(!_0x3fcb71[_0x6ebf('0x33')]['hasOwnProperty'](_0x6ebf('0x3b'))){_0x3619a2['limit']=qs['limit'](_0x3fcb71[_0x6ebf('0x33')][_0x6ebf('0x20')]);_0x3619a2[_0x6ebf('0x1d')]=qs[_0x6ebf('0x1d')](_0x3fcb71[_0x6ebf('0x33')]['offset']);}_0x3619a2[_0x6ebf('0x3c')]=qs['sort'](_0x3fcb71[_0x6ebf('0x33')]['sort']);_0x3619a2[_0x6ebf('0x3d')]=qs[_0x6ebf('0x35')](_[_0x6ebf('0x3e')](_0x3fcb71[_0x6ebf('0x33')],_0x2fdc7f[_0x6ebf('0x35')]),_0x10107b);if(_0x3fcb71[_0x6ebf('0x33')][_0x6ebf('0x3f')]){_0x3619a2[_0x6ebf('0x3d')]=_['merge'](_0x3619a2['where'],{'$or':_[_0x6ebf('0x40')](_0x10107b,function(_0x2776a5){if(_0x2776a5[_0x6ebf('0x31')]!==_0x6ebf('0x41')){var _0x474506={};_0x474506[_0x2776a5[_0x6ebf('0x2c')]]={'$like':'%'+_0x3fcb71['query'][_0x6ebf('0x3f')]+'%'};return _0x474506;}})});}_0x3619a2=_[_0x6ebf('0x42')]({},_0x3619a2,_0x3fcb71['options']);var _0x7d02a3={'where':_0x3619a2[_0x6ebf('0x3d')]};return db[_0x6ebf('0x2f')]['count'](_0x7d02a3)[_0x6ebf('0x28')](function(_0x44334e){_0xa6d7c9['count']=_0x44334e;if(_0x3fcb71[_0x6ebf('0x33')][_0x6ebf('0x43')]){_0x3619a2[_0x6ebf('0x44')]=[{'all':!![]}];}return db[_0x6ebf('0x2f')][_0x6ebf('0x45')](_0x3619a2);})[_0x6ebf('0x28')](function(_0x548d29){_0xa6d7c9[_0x6ebf('0x46')]=_0x548d29;return _0xa6d7c9;})[_0x6ebf('0x28')](respondWithFilteredResult(_0x226738,_0x3619a2))[_0x6ebf('0x47')](handleError(_0x226738,null));};exports['show']=function(_0x321a4f,_0x10a1f6){var _0x427fe7={'raw':!![],'where':{'id':_0x321a4f[_0x6ebf('0x48')]['id']}},_0x238cc3={};_0x238cc3[_0x6ebf('0x37')]=_[_0x6ebf('0x34')](db[_0x6ebf('0x2f')]['rawAttributes']);_0x238cc3[_0x6ebf('0x33')]=_[_0x6ebf('0x34')](_0x321a4f[_0x6ebf('0x33')]);_0x238cc3[_0x6ebf('0x35')]=_[_0x6ebf('0x36')](_0x238cc3['model'],_0x238cc3[_0x6ebf('0x33')]);_0x427fe7[_0x6ebf('0x38')]=_['intersection'](_0x238cc3['model'],qs[_0x6ebf('0x39')](_0x321a4f[_0x6ebf('0x33')][_0x6ebf('0x39')]));_0x427fe7['attributes']=_0x427fe7['attributes']['length']?_0x427fe7['attributes']:_0x238cc3['model'];if(_0x321a4f[_0x6ebf('0x33')][_0x6ebf('0x43')]){_0x427fe7[_0x6ebf('0x44')]=[{'all':!![]}];}_0x427fe7=_[_0x6ebf('0x42')]({},_0x427fe7,_0x321a4f[_0x6ebf('0x49')]);return db[_0x6ebf('0x2f')][_0x6ebf('0x4a')](_0x427fe7)[_0x6ebf('0x28')](handleEntityNotFound(_0x10a1f6,null))[_0x6ebf('0x28')](respondWithResult(_0x10a1f6,null))[_0x6ebf('0x47')](handleError(_0x10a1f6,null));};exports['create']=function(_0x4a1b67,_0xde34f7){return db['VoiceQueuesLog'][_0x6ebf('0x4b')](_0x4a1b67['body'],{})[_0x6ebf('0x28')](respondWithResult(_0xde34f7,0xc9))[_0x6ebf('0x47')](handleError(_0xde34f7,null));};exports[_0x6ebf('0x27')]=function(_0x13b29a,_0x1e4743){if(_0x13b29a[_0x6ebf('0x4c')]['id']){delete _0x13b29a[_0x6ebf('0x4c')]['id'];}return db[_0x6ebf('0x2f')]['find']({'where':{'id':_0x13b29a[_0x6ebf('0x48')]['id']}})[_0x6ebf('0x28')](handleEntityNotFound(_0x1e4743,null))[_0x6ebf('0x28')](saveUpdates(_0x13b29a[_0x6ebf('0x4c')],null))[_0x6ebf('0x28')](respondWithResult(_0x1e4743,null))['catch'](handleError(_0x1e4743,null));};exports['destroy']=function(_0x7b38b4,_0x5c4284){return db[_0x6ebf('0x2f')][_0x6ebf('0x4a')]({'where':{'id':_0x7b38b4[_0x6ebf('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c4284,null))[_0x6ebf('0x28')](removeEntity(_0x5c4284,null))[_0x6ebf('0x47')](handleError(_0x5c4284,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a9e9360..5806067 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 _0xc130=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5dca1c,_0x4d4281){var _0x5ce01c=function(_0x100860){while(--_0x100860){_0x5dca1c['push'](_0x5dca1c['shift']());}};_0x5ce01c(++_0x4d4281);}(_0xc130,0x115));var _0x0c13=function(_0x41911b,_0x4068c4){_0x41911b=_0x41911b-0x0;var _0x4c9e16=_0xc130[_0x41911b];return _0x4c9e16;};'use strict';var _=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var logger=require(_0x0c13('0x2'))(_0x0c13('0x3'));var moment=require(_0x0c13('0x4'));var BPromise=require(_0x0c13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c13('0x6'));var rimraf=require(_0x0c13('0x7'));var config=require('../../config/environment');var attributes=require(_0x0c13('0x8'));module[_0x0c13('0x9')]=function(_0x5e1fa9,_0x502fee){return _0x5e1fa9[_0x0c13('0xa')](_0x0c13('0xb'),attributes,{'tableName':_0x0c13('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0c13('0xd'),_0x0c13('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb498=['./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x549f91,_0x33965c){var _0x37d07e=function(_0x412adb){while(--_0x412adb){_0x549f91['push'](_0x549f91['shift']());}};_0x37d07e(++_0x33965c);}(_0xb498,0x12b));var _0x8b49=function(_0x320fbe,_0x28a0b4){_0x320fbe=_0x320fbe-0x0;var _0x39a4c3=_0xb498[_0x320fbe];return _0x39a4c3;};'use strict';var _=require(_0x8b49('0x0'));var util=require('util');var logger=require(_0x8b49('0x1'))(_0x8b49('0x2'));var moment=require(_0x8b49('0x3'));var BPromise=require(_0x8b49('0x4'));var rp=require(_0x8b49('0x5'));var fs=require('fs');var path=require(_0x8b49('0x6'));var rimraf=require(_0x8b49('0x7'));var config=require(_0x8b49('0x8'));var attributes=require(_0x8b49('0x9'));module['exports']=function(_0x56a198,_0x5c0f82){return _0x56a198[_0x8b49('0xa')](_0x8b49('0xb'),attributes,{'tableName':_0x8b49('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x8b49('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9d9c9ce..75b9dc1 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 _0xd4f8=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xd4f8,0xae));var _0x8d4f=function(_0x5a13ba,_0x4702e9){_0x5a13ba=_0x5a13ba-0x0;var _0x425288=_0xd4f8[_0x5a13ba];return _0x425288;};'use strict';var _=require(_0x8d4f('0x0'));var util=require(_0x8d4f('0x1'));var moment=require('moment');var BPromise=require(_0x8d4f('0x2'));var rs=require(_0x8d4f('0x3'));var fs=require('fs');var Redis=require(_0x8d4f('0x4'));var db=require(_0x8d4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d4f('0x6'))('rpc');var config=require(_0x8d4f('0x7'));var jayson=require(_0x8d4f('0x8'));var client=jayson[_0x8d4f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adc56,_0x2f81dc,_0x590e61){return new BPromise(function(_0x2ed4c0,_0xc84d4e){return client[_0x8d4f('0xa')](_0x2adc56,_0x590e61)[_0x8d4f('0xb')](function(_0x44c119){logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x2f81dc,_0x8d4f('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2f81dc,_0x8d4f('0xe'),JSON[_0x8d4f('0xf')](_0x44c119));if(_0x44c119[_0x8d4f('0x10')]){if(_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x11')]===0x1f4){logger['error'](_0x8d4f('0xd'),_0x2f81dc,_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);return _0xc84d4e(_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);}logger[_0x8d4f('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2f81dc,_0x44c119[_0x8d4f('0x10')][_0x8d4f('0x12')]);return _0x2ed4c0(_0x44c119['error'][_0x8d4f('0x12')]);}else{logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x2f81dc,_0x8d4f('0xe'));_0x2ed4c0(_0x44c119['result'][_0x8d4f('0x12')]);}})[_0x8d4f('0x13')](function(_0x1cd78a){logger['error'](_0x8d4f('0xd'),_0x2f81dc,_0x1cd78a);_0xc84d4e(_0x1cd78a);});});} \ No newline at end of file +var _0x0187=['code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1bb5eb,_0x48eccd){var _0x287d85=function(_0x46aa81){while(--_0x46aa81){_0x1bb5eb['push'](_0x1bb5eb['shift']());}};_0x287d85(++_0x48eccd);}(_0x0187,0x158));var _0x7018=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x0187[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x7018('0x0'));var util=require(_0x7018('0x1'));var moment=require(_0x7018('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7018('0x3'))['db'];var utils=require(_0x7018('0x4'));var logger=require(_0x7018('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7018('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xadb814,_0x4162f7,_0x14f0f1){return new BPromise(function(_0x323113,_0x47c06d){return client[_0x7018('0x7')](_0xadb814,_0x14f0f1)[_0x7018('0x8')](function(_0x4d1da2){logger[_0x7018('0x9')](_0x7018('0xa'),_0x4162f7,_0x7018('0xb'));logger[_0x7018('0xc')](_0x7018('0xd'),_0x4162f7,_0x7018('0xb'),JSON[_0x7018('0xe')](_0x4d1da2));if(_0x4d1da2[_0x7018('0xf')]){if(_0x4d1da2[_0x7018('0xf')][_0x7018('0x10')]===0x1f4){logger[_0x7018('0xf')](_0x7018('0xa'),_0x4162f7,_0x4d1da2[_0x7018('0xf')][_0x7018('0x11')]);return _0x47c06d(_0x4d1da2['error'][_0x7018('0x11')]);}logger['error'](_0x7018('0xa'),_0x4162f7,_0x4d1da2[_0x7018('0xf')][_0x7018('0x11')]);return _0x323113(_0x4d1da2[_0x7018('0xf')][_0x7018('0x11')]);}else{logger[_0x7018('0x9')](_0x7018('0xa'),_0x4162f7,'request\x20sent');_0x323113(_0x4d1da2[_0x7018('0x12')][_0x7018('0x11')]);}})[_0x7018('0x13')](function(_0xf623c9){logger['error'](_0x7018('0xa'),_0x4162f7,_0xf623c9);_0x47c06d(_0xf623c9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9025147..b08f593 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 _0x46cb=['index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','create','runTranscribe','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0x46cb,0x127));var _0xb46c=function(_0x17a0a0,_0x1befaa){_0x17a0a0=_0x17a0a0-0x0;var _0x4da752=_0x46cb[_0x17a0a0];return _0x4da752;};'use strict';var multer=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var path=require(_0xb46c('0x2'));var timeout=require(_0xb46c('0x3'));var express=require(_0xb46c('0x4'));var router=express[_0xb46c('0x5')]();var fs_extra=require(_0xb46c('0x6'));var auth=require(_0xb46c('0x7'));var interaction=require(_0xb46c('0x8'));var config=require(_0xb46c('0x9'));var controller=require(_0xb46c('0xa'));router[_0xb46c('0xb')]('/',auth[_0xb46c('0xc')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xb')](_0xb46c('0xe'),auth[_0xb46c('0xc')](),controller[_0xb46c('0xf')]);router[_0xb46c('0xb')](_0xb46c('0x10'),auth['isAuthenticated'](),controller[_0xb46c('0x11')]);router[_0xb46c('0xb')](_0xb46c('0x12'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x13')]);router['get']('/:id/downloads',controller[_0xb46c('0x14')]);router[_0xb46c('0xb')](_0xb46c('0x15'),auth[_0xb46c('0xc')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xb46c('0x16')]);router['post'](_0xb46c('0x15'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x17')]);router[_0xb46c('0x18')]('/:id',auth[_0xb46c('0xc')](),controller[_0xb46c('0x19')]);router[_0xb46c('0x1a')](_0xb46c('0x10'),auth[_0xb46c('0xc')](),controller[_0xb46c('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x9f3c=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x30190a,_0x5350d6){var _0x59e9b2=function(_0x31c41e){while(--_0x31c41e){_0x30190a['push'](_0x30190a['shift']());}};_0x59e9b2(++_0x5350d6);}(_0x9f3c,0x123));var _0xc9f3=function(_0x40f791,_0x3903cd){_0x40f791=_0x40f791-0x0;var _0x55d1e7=_0x9f3c[_0x40f791];return _0x55d1e7;};'use strict';var multer=require(_0xc9f3('0x0'));var util=require(_0xc9f3('0x1'));var path=require(_0xc9f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9f3('0x3')]();var fs_extra=require(_0xc9f3('0x4'));var auth=require(_0xc9f3('0x5'));var interaction=require(_0xc9f3('0x6'));var config=require(_0xc9f3('0x7'));var controller=require(_0xc9f3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc9f3('0x9')]);router[_0xc9f3('0xa')](_0xc9f3('0xb'),auth[_0xc9f3('0xc')](),controller[_0xc9f3('0xd')]);router[_0xc9f3('0xa')](_0xc9f3('0xe'),auth[_0xc9f3('0xc')](),controller[_0xc9f3('0xf')]);router[_0xc9f3('0xa')](_0xc9f3('0x10'),auth[_0xc9f3('0xc')](),controller[_0xc9f3('0x11')]);router[_0xc9f3('0xa')](_0xc9f3('0x12'),controller[_0xc9f3('0x13')]);router[_0xc9f3('0xa')](_0xc9f3('0x14'),auth[_0xc9f3('0xc')](),controller['downloadTranscribe']);router[_0xc9f3('0x15')]('/',auth['isAuthenticated'](),controller[_0xc9f3('0x16')]);router[_0xc9f3('0x15')](_0xc9f3('0x14'),auth[_0xc9f3('0xc')](),controller[_0xc9f3('0x17')]);router['put'](_0xc9f3('0xe'),auth[_0xc9f3('0xc')](),controller[_0xc9f3('0x18')]);router[_0xc9f3('0x19')]('/:id',auth[_0xc9f3('0xc')](),controller['destroy']);module[_0xc9f3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 303705c..9ce92aa 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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 903b5ee..151930a 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 _0x3c7e=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','show','params','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','MD5','sequelize','col','$and','push','existsSync','recording','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','differenceBy','format','keys','query','filters','attributes'];(function(_0x483f13,_0x100cdf){var _0xf62bd0=function(_0x426aee){while(--_0x426aee){_0x483f13['push'](_0x483f13['shift']());}};_0xf62bd0(++_0x100cdf);}(_0x3c7e,0x101));var _0xe3c7=function(_0x430e15,_0x4ae0f2){_0x430e15=_0x430e15-0x0;var _0x16c170=_0x3c7e[_0x430e15];return _0x16c170;};'use strict';var emlformat=require(_0xe3c7('0x0'));var rimraf=require(_0xe3c7('0x1'));var zipdir=require(_0xe3c7('0x2'));var jsonpatch=require(_0xe3c7('0x3'));var rp=require('request-promise');var moment=require(_0xe3c7('0x4'));var BPromise=require(_0xe3c7('0x5'));var Mustache=require(_0xe3c7('0x6'));var util=require(_0xe3c7('0x7'));var path=require(_0xe3c7('0x8'));var sox=require('sox');var csv=require(_0xe3c7('0x9'));var ejs=require(_0xe3c7('0xa'));var fs=require('fs');var fs_extra=require(_0xe3c7('0xb'));var _=require(_0xe3c7('0xc'));var squel=require('squel');var crypto=require(_0xe3c7('0xd'));var jsforce=require(_0xe3c7('0xe'));var deskjs=require(_0xe3c7('0xf'));var toCsv=require(_0xe3c7('0x9'));var querystring=require(_0xe3c7('0x10'));var Papa=require(_0xe3c7('0x11'));var AWS=require(_0xe3c7('0x12'));var uuidv4=require(_0xe3c7('0x13'));var Redis=require('ioredis');var authService=require(_0xe3c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe3c7('0x15'));var hardwareService=require(_0xe3c7('0x16'));var logger=require(_0xe3c7('0x17'))(_0xe3c7('0x18'));var utils=require(_0xe3c7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe3c7('0x1a'))['db'];function respondWithStatusCode(_0x702329,_0x177da2){_0x177da2=_0x177da2||0xcc;return function(_0x284cf0){if(_0x284cf0){return _0x702329[_0xe3c7('0x1b')](_0x177da2);}return _0x702329[_0xe3c7('0x1c')](_0x177da2)[_0xe3c7('0x1d')]();};}function respondWithResult(_0x47bc9d,_0x6e19ad){_0x6e19ad=_0x6e19ad||0xc8;return function(_0x3a4abc){if(_0x3a4abc){return _0x47bc9d[_0xe3c7('0x1c')](_0x6e19ad)['json'](_0x3a4abc);}};}function respondWithFilteredResult(_0x23ede8,_0x275f81){return function(_0x3ea169){if(_0x3ea169){var _0x237c7d=typeof _0x275f81[_0xe3c7('0x1e')]==='undefined'&&typeof _0x275f81['limit']==='undefined';var _0x2d593b=_0x3ea169[_0xe3c7('0x1f')];var _0x44c26a=_0x237c7d?0x0:_0x275f81[_0xe3c7('0x1e')];var _0x980038=_0x237c7d?_0x3ea169[_0xe3c7('0x1f')]:_0x275f81[_0xe3c7('0x1e')]+_0x275f81[_0xe3c7('0x20')];var _0x5d5cfa;if(_0x980038>=_0x2d593b){_0x980038=_0x2d593b;_0x5d5cfa=0xc8;}else{_0x5d5cfa=0xce;}_0x23ede8[_0xe3c7('0x1c')](_0x5d5cfa);return _0x23ede8[_0xe3c7('0x21')](_0xe3c7('0x22'),_0x44c26a+'-'+_0x980038+'/'+_0x2d593b)[_0xe3c7('0x23')](_0x3ea169);}return null;};}function patchUpdates(_0xe34bef){return function(_0x44080c){try{jsonpatch[_0xe3c7('0x24')](_0x44080c,_0xe34bef,!![]);}catch(_0x1a434d){return BPromise[_0xe3c7('0x25')](_0x1a434d);}return _0x44080c[_0xe3c7('0x26')]();};}function saveUpdates(_0x62af3d,_0x13c6e7){return function(_0x511ddc){if(_0x511ddc){return _0x511ddc[_0xe3c7('0x27')](_0x62af3d)[_0xe3c7('0x28')](function(_0x3ff93a){return _0x3ff93a;});}return null;};}function removeEntity(_0x3f9577,_0x28bf92){return function(_0x3fb2a2){if(_0x3fb2a2){return _0x3fb2a2[_0xe3c7('0x29')]()[_0xe3c7('0x28')](function(){_0x3f9577[_0xe3c7('0x1c')](0xcc)[_0xe3c7('0x1d')]();});}};}function handleEntityNotFound(_0x124c76,_0x1784bc){return function(_0x502213){if(!_0x502213){_0x124c76[_0xe3c7('0x1b')](0x194);}return _0x502213;};}function handleError(_0x41683,_0x217998){_0x217998=_0x217998||0x1f4;return function(_0x5630b3){logger[_0xe3c7('0x2a')](_0x5630b3['stack']);if(_0x5630b3[_0xe3c7('0x2b')]){delete _0x5630b3['name'];}_0x41683[_0xe3c7('0x1c')](_0x217998)[_0xe3c7('0x2c')](_0x5630b3);};}exports[_0xe3c7('0x2d')]=function(_0x2fcc23,_0x33cc60){var _0x381679={},_0x54bf7e={},_0x2df42a={'count':0x0,'rows':[]};var _0x4d8621=_[_0xe3c7('0x2e')](db['VoiceRecording']['rawAttributes'],function(_0xc68983){return{'name':_0xc68983[_0xe3c7('0x2f')],'type':_0xc68983[_0xe3c7('0x30')][_0xe3c7('0x31')]};});_0x54bf7e[_0xe3c7('0x32')]=_[_0xe3c7('0x33')](_[_0xe3c7('0x2e')](_0x4d8621,_0xe3c7('0x2b')),[_0xe3c7('0x34')]);_0x54bf7e['query']=_[_0xe3c7('0x35')](_0x2fcc23[_0xe3c7('0x36')]);_0x54bf7e[_0xe3c7('0x37')]=_['intersection'](_0x54bf7e['model'],_0x54bf7e[_0xe3c7('0x36')]);_0x381679[_0xe3c7('0x38')]=_[_0xe3c7('0x39')](_0x54bf7e['model'],qs[_0xe3c7('0x3a')](_0x2fcc23[_0xe3c7('0x36')]['fields']));_0x381679[_0xe3c7('0x38')]=_0x381679['attributes'][_0xe3c7('0x3b')]?_0x381679[_0xe3c7('0x38')]:_0x54bf7e[_0xe3c7('0x32')];if(!_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x3c')](_0xe3c7('0x3d'))){_0x381679['limit']=qs[_0xe3c7('0x20')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x20')]);_0x381679[_0xe3c7('0x1e')]=qs[_0xe3c7('0x1e')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x1e')]);}_0x381679[_0xe3c7('0x3e')]=qs[_0xe3c7('0x3f')](_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x3f')]);_0x381679[_0xe3c7('0x40')]=qs[_0xe3c7('0x37')](_[_0xe3c7('0x41')](_0x2fcc23[_0xe3c7('0x36')],_0x54bf7e['filters']),_0x4d8621);if(_0x2fcc23[_0xe3c7('0x36')][_0xe3c7('0x42')]){_0x381679[_0xe3c7('0x40')]=_[_0xe3c7('0x43')](_0x381679['where'],{'$or':_[_0xe3c7('0x2e')](_0x4d8621,function(_0x5876d8){if(_0x5876d8[_0xe3c7('0x30')]!==_0xe3c7('0x44')){var _0x1734a3={};_0x1734a3[_0x5876d8[_0xe3c7('0x2b')]]={'$like':'%'+_0x2fcc23[_0xe3c7('0x36')]['filter']+'%'};return _0x1734a3;}})});}_0x381679=_[_0xe3c7('0x43')]({},_0x381679,_0x2fcc23[_0xe3c7('0x45')]);var _0x48e823={'where':_0x381679[_0xe3c7('0x40')]};return db[_0xe3c7('0x46')][_0xe3c7('0x1f')](_0x48e823)['then'](function(_0x1d5459){_0x2df42a['count']=_0x1d5459;if(_0x2fcc23['query']['includeAll']){_0x381679[_0xe3c7('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe3c7('0x48')](_0x381679);})[_0xe3c7('0x28')](function(_0x1bf218){_0x2df42a[_0xe3c7('0x49')]=_0x1bf218;return _0x2df42a;})['then'](respondWithFilteredResult(_0x33cc60,_0x381679))['catch'](handleError(_0x33cc60,null));};exports[_0xe3c7('0x4a')]=function(_0x23a53e,_0x2b4f54){var _0xaee45c={'raw':![],'where':{'id':_0x23a53e[_0xe3c7('0x4b')]['id']}},_0x3d344a={};_0x3d344a[_0xe3c7('0x32')]=_[_0xe3c7('0x35')](db[_0xe3c7('0x46')]['rawAttributes']);_0x3d344a[_0xe3c7('0x36')]=_[_0xe3c7('0x35')](_0x23a53e[_0xe3c7('0x36')]);_0x3d344a[_0xe3c7('0x37')]=_[_0xe3c7('0x39')](_0x3d344a[_0xe3c7('0x32')],_0x3d344a[_0xe3c7('0x36')]);_0xaee45c[_0xe3c7('0x38')]=_[_0xe3c7('0x39')](_0x3d344a[_0xe3c7('0x32')],qs['fields'](_0x23a53e[_0xe3c7('0x36')][_0xe3c7('0x3a')]));_0xaee45c['attributes']=_0xaee45c['attributes'][_0xe3c7('0x3b')]?_0xaee45c['attributes']:_0x3d344a[_0xe3c7('0x32')];if(_0x23a53e[_0xe3c7('0x36')]['includeAll']){_0xaee45c[_0xe3c7('0x47')]=[{'all':!![]}];}_0xaee45c=_[_0xe3c7('0x43')]({},_0xaee45c,_0x23a53e['options']);return db['VoiceRecording'][_0xe3c7('0x4c')](_0xaee45c)[_0xe3c7('0x28')](handleEntityNotFound(_0x2b4f54,null))['then'](respondWithResult(_0x2b4f54,null))[_0xe3c7('0x4d')](handleError(_0x2b4f54,null));};exports['create']=function(_0x4e11c9,_0x5a3cfb){return db[_0xe3c7('0x46')][_0xe3c7('0x4e')](_0x4e11c9[_0xe3c7('0x4f')],{})[_0xe3c7('0x28')](respondWithResult(_0x5a3cfb,0xc9))['catch'](handleError(_0x5a3cfb,null));};exports[_0xe3c7('0x27')]=function(_0xd81634,_0x363bbc){if(_0xd81634[_0xe3c7('0x4f')]['id']){delete _0xd81634[_0xe3c7('0x4f')]['id'];}return db[_0xe3c7('0x46')]['find']({'where':{'id':_0xd81634['params']['id']}})[_0xe3c7('0x28')](handleEntityNotFound(_0x363bbc,null))['then'](saveUpdates(_0xd81634['body'],null))[_0xe3c7('0x28')](respondWithResult(_0x363bbc,null))['catch'](handleError(_0x363bbc,null));};exports[_0xe3c7('0x50')]=function(_0x129e66,_0x2e818a){return db[_0xe3c7('0x46')][_0xe3c7('0x50')]()[_0xe3c7('0x28')](respondWithResult(_0x2e818a,null))[_0xe3c7('0x4d')](handleError(_0x2e818a,null));};exports[_0xe3c7('0x51')]=function(_0x470023,_0x582fea,_0x1478f9){var _0x1c8b59=require(_0xe3c7('0x52'));var _0x1a3098=![];var _0x457405={};if(_0x470023[_0xe3c7('0x36')]['type']&&_0x470023['query'][_0xe3c7('0x30')]===_0xe3c7('0x53')){_0x457405[_0xe3c7('0x53')]=_0x470023[_0xe3c7('0x4b')]['id'];}else{_0x457405['id']=_0x470023[_0xe3c7('0x4b')]['id'];}return db['VoiceRecording'][_0xe3c7('0x4c')]({'where':_0x457405,'attributes':['id',_0xe3c7('0x54')],'raw':!![]})[_0xe3c7('0x28')](handleEntityNotFound(_0x582fea,null))['then'](function(_0x542e2a){if(_0x542e2a){var _0x3ea450=_0x542e2a[_0xe3c7('0x54')];var _0x5929c8=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x3ea450);if(fs['existsSync'](_0x5929c8)){_0x1a3098=!![];return _0x1c8b59[_0xe3c7('0x56')](_0x5929c8,_0x3ea450,config[_0xe3c7('0x57')]['recording'])[_0xe3c7('0x28')](function(){return _0x542e2a;});}return _0x542e2a;}})['then'](function(_0x1997f4){if(_0x1997f4){var _0x585a5b=_0x1997f4['value'];if(!fs['existsSync'](_0x585a5b)){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x5a'));}if(_0x1997f4[_0xe3c7('0x5b')]){return _0x582fea['download'](_0x585a5b,_0x1997f4[_0xe3c7('0x5b')]+path[_0xe3c7('0x5c')](_0x585a5b),function(){if(_0x1a3098){fs[_0xe3c7('0x5d')](_0x585a5b);}});}else{return _0x582fea[_0xe3c7('0x51')](_0x585a5b,function(_0x277165){if(_0x1a3098){fs[_0xe3c7('0x5d')](_0x585a5b);}});}}})[_0xe3c7('0x4d')](function(_0x4c6d35){if(_0x4c6d35[_0xe3c7('0x5e')]===_0xe3c7('0x5a')){_0x582fea['status'](0x194)[_0xe3c7('0x2c')](_0xe3c7('0x5f'));}else{return handleError(_0x582fea,null);}});};exports[_0xe3c7('0x60')]=function(_0x36a2a0,_0x272406,_0xa0a302){var _0x50515d=require(_0xe3c7('0x52'));var _0x3694ca=![];var _0x1309d9={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0xe3c7('0x61'),db[_0xe3c7('0x62')][_0xe3c7('0x63')]('uniqueid')),_0x36a2a0[_0xe3c7('0x36')]['token'])]};if(_0x36a2a0[_0xe3c7('0x36')][_0xe3c7('0x30')]&&_0x36a2a0[_0xe3c7('0x36')][_0xe3c7('0x30')]==='uniqueid'){_0x1309d9['$and']['push']({'uniqueid':_0x36a2a0[_0xe3c7('0x4b')]['id']});}else{_0x1309d9[_0xe3c7('0x64')][_0xe3c7('0x65')]({'id':_0x36a2a0['params']['id']});}return db[_0xe3c7('0x46')][_0xe3c7('0x4c')]({'where':_0x1309d9,'attributes':['id',_0xe3c7('0x54')],'raw':!![]})[_0xe3c7('0x28')](handleEntityNotFound(_0x272406,null))[_0xe3c7('0x28')](function(_0x235204){if(_0x235204){var _0x59d569=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x235204['value']);if(fs[_0xe3c7('0x66')](_0x59d569)){_0x3694ca=!![];return _0x50515d[_0xe3c7('0x56')](_0x59d569,_0x235204['value'],config[_0xe3c7('0x57')][_0xe3c7('0x67')])['then'](function(){return _0x235204;});}return _0x235204;}})[_0xe3c7('0x28')](function(_0x3eb19f){if(_0x3eb19f){if(!fs[_0xe3c7('0x66')](_0x3eb19f['value'])){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x5a'));}if(_0x3eb19f['filename']){return _0x272406[_0xe3c7('0x51')](_0x3eb19f['value'],_0x3eb19f[_0xe3c7('0x5b')]+path[_0xe3c7('0x5c')](_0x3eb19f['value']),function(){if(_0x3694ca){fs[_0xe3c7('0x5d')](_0x3eb19f['value']);}});}else{return _0x272406[_0xe3c7('0x51')](_0x3eb19f[_0xe3c7('0x54')],function(_0x54ab43){if(_0x3694ca){fs['unlink'](_0x3eb19f[_0xe3c7('0x54')]);}});}}})[_0xe3c7('0x4d')](handleError(_0x272406,null));};exports[_0xe3c7('0x29')]=function(_0x33b060,_0x48dd66){return db['VoiceRecording'][_0xe3c7('0x4c')]({'where':{'id':_0x33b060[_0xe3c7('0x4b')]['id']}})['then'](function(_0x1bc612){if(_[_0xe3c7('0x68')](_0x1bc612)){throw new ReferenceError(_0xe3c7('0x69'));}return _0x1bc612;})['then'](function(_0x41b500){var _0x29e1d8=_0x41b500[_0xe3c7('0x54')];logger['info'](_0xe3c7('0x6a'),_0x29e1d8);if(!_['isNil'](_0x41b500['value'])&&fs[_0xe3c7('0x66')](_0x29e1d8)){logger[_0xe3c7('0x6b')](_0xe3c7('0x6c')+_0x29e1d8+_0xe3c7('0x6d'));fs['unlinkSync'](_0x29e1d8);}_0x29e1d8=_0x29e1d8+_0xe3c7('0x6e');if(!_[_0xe3c7('0x68')](_0x41b500[_0xe3c7('0x54')])&&fs[_0xe3c7('0x66')](_0x29e1d8)){logger[_0xe3c7('0x6b')]('File:\x20\x22'+_0x29e1d8+_0xe3c7('0x6d'));fs['unlinkSync'](_0x29e1d8);}return _0x41b500;})['then'](function(_0x1f2c8c){if(!_0x1f2c8c)throw new InternalError();return _0x1f2c8c[_0xe3c7('0x29')]();})[_0xe3c7('0x28')](function(){_0x48dd66[_0xe3c7('0x1c')](0xcc)[_0xe3c7('0x1d')]();})['catch'](handleError(_0x48dd66,null));};function getBucketslist(_0x259500,_0x3f498c,_0x3bc679){return new Promise(function(_0x395f9f,_0x3fa54b){var _0x4d7a82=new AWS['S3']({'accessKeyId':_0x3f498c,'secretAccessKey':_0x259500,'region':_0x3bc679});_0x4d7a82['listBuckets']({},function(_0x5c7035,_0x278d56){if(_0x5c7035){return _0x3fa54b(_0x5c7035);}else{return _0x395f9f(_0x278d56);}});});}function createBucket(_0x272bb4,_0x480b49,_0x492cad,_0x5667cb){return new Promise(function(_0x4718c4,_0xb770d8){var _0x1001ca=new AWS['S3']({'accessKeyId':_0x480b49,'secretAccessKey':_0x272bb4,'region':_0x492cad});_0x1001ca[_0xe3c7('0x6f')]({'Bucket':_0x5667cb},function(_0x371c98,_0x2f1af8){if(_0x371c98){return _0xb770d8(_0x371c98);}else{return _0x4718c4(_0x2f1af8);}});});}function uploadFile(_0x4394ae,_0x4e287e,_0x1d59ed,_0x327525,_0x43b5e1,_0x45ce1c){return new Promise(function(_0x36624c,_0x25aad1){var _0x15b447=new AWS['S3']({'accessKeyId':_0x4e287e,'secretAccessKey':_0x4394ae,'region':_0x1d59ed});_0x15b447[_0xe3c7('0x70')]({'Bucket':_0x327525,'Key':_0x43b5e1,'Body':_0x45ce1c},function(_0xf52766,_0x227a4e){if(_0xf52766){return _0x25aad1(_0xf52766);}else{return _0x36624c(_0x227a4e);}});});}function startTranscribe(_0x224042,_0x4994a1,_0x4deed3,_0x34cc27,_0x19d5cf,_0x527f44){return new Promise(function(_0x1f3435,_0x9a1e1d){var _0x44a556=new AWS[(_0xe3c7('0x71'))]({'accessKeyId':_0x4994a1,'secretAccessKey':_0x224042,'region':_0x4deed3});_0x44a556[_0xe3c7('0x72')]({'TranscriptionJobName':_0x34cc27,'LanguageCode':_0x19d5cf,'Media':{'MediaFileUri':_0x527f44}},function(_0x165801,_0x254a67){if(_0x165801){return _0x9a1e1d(_0x165801);}else{return _0x1f3435(_0x254a67);}});});}function transcribe(_0x561207,_0x284e28,_0xc90b34,_0x30c34d,_0xcbcfa4,_0x1d8526,_0x33fc62){return new Promise(function(_0x175bd4,_0x498a98){var _0x128ec6={};logger[_0xe3c7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x561207,_0xcbcfa4));return uploadFile(_0x284e28,_0xc90b34,_0x30c34d,_0xcbcfa4,path[_0xe3c7('0x73')](_0x1d8526),fs[_0xe3c7('0x74')](_0x1d8526))['then'](function(_0x497a87){logger[_0xe3c7('0x6b')](util['format'](_0xe3c7('0x75'),_0x561207,_0xcbcfa4,_0x497a87['Location']));_0x128ec6['bucket']=_0x497a87[_0xe3c7('0x76')];_0x128ec6[_0xe3c7('0x77')]=_0x497a87[_0xe3c7('0x78')];logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x561207));return startTranscribe(_0x284e28,_0xc90b34,_0x30c34d,uuidv4(),_0x33fc62,_0x497a87[_0xe3c7('0x78')]);})[_0xe3c7('0x28')](function(_0x4df5b4){logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')](_0xe3c7('0x79'),_0x561207,_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7a')]));_0x128ec6[_0xe3c7('0x7b')]=_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7a')];_0x128ec6['transcribeStatus']=_0x4df5b4['TranscriptionJob'][_0xe3c7('0x7c')];return _0x175bd4(_0x128ec6);})[_0xe3c7('0x4d')](function(_0x232dd8){return _0x498a98(_0x232dd8);});});}exports[_0xe3c7('0x7d')]=function(_0xc25d35,_0x596105,_0x330f49){var _0x15db9b;var _0x2de7c6;var _0x204e38;var _0x38e73f=require(_0xe3c7('0x52'));return db[_0xe3c7('0x46')]['findOne']({'where':{'id':_0xc25d35[_0xe3c7('0x4b')]['id']}})[_0xe3c7('0x28')](function(_0x4d62b1){if(_0x4d62b1){var _0x387331=util[_0xe3c7('0x34')](_0xe3c7('0x55'),_0x4d62b1[_0xe3c7('0x54')]);if(fs[_0xe3c7('0x66')](_0x387331)){cypher=!![];return _0x38e73f[_0xe3c7('0x56')](_0x387331,_0x4d62b1[_0xe3c7('0x54')],config[_0xe3c7('0x57')][_0xe3c7('0x67')])[_0xe3c7('0x28')](function(){return _0x4d62b1;});}return _0x4d62b1;}})['then'](function(_0x48af7e){if(!_0x48af7e){throw new db['Sequelize'][(_0xe3c7('0x59'))](_0xe3c7('0x7e'));}_0x2de7c6=_0x48af7e;return db[_0xe3c7('0x7f')][_0xe3c7('0x80')]({'where':{'id':0x1}});})[_0xe3c7('0x28')](handleEntityNotFound(_0x596105,null))[_0xe3c7('0x28')](function(_0x5bac3b){if(_0x5bac3b){_0x15db9b=_0x5bac3b;if(!_0x15db9b[_0xe3c7('0x81')]||!_0x15db9b['transcribeAccountId']||!_0x15db9b[_0xe3c7('0x82')]||!_0x15db9b['language']||!_0x15db9b[_0xe3c7('0x83')]){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x84'));}if(_0xc25d35[_0xe3c7('0x4f')][_0xe3c7('0x85')]&&(!_0x15db9b[_0xe3c7('0x86')]||!_0x15db9b[_0xe3c7('0x87')]||!_0x15db9b[_0xe3c7('0x88')]||!_0x15db9b[_0xe3c7('0x89')]||!_0x15db9b[_0xe3c7('0x83')])){throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x8a'));}return db[_0xe3c7('0x8b')]['findOne']({'where':{'id':_0x15db9b[_0xe3c7('0x8c')]}});}})['then'](function(_0x415dd2){if(!_0x415dd2){throw new db['Sequelize'][(_0xe3c7('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x415dd2[_0xe3c7('0x8d')]||!_0x415dd2[_0xe3c7('0x8e')]){throw new db[(_0xe3c7('0x58'))]['ValidationError'](_0xe3c7('0x8f'));}_0x204e38=_0x415dd2;return getBucketslist(_0x204e38[_0xe3c7('0x8d')],_0x204e38[_0xe3c7('0x8e')],_0x15db9b['transcribeRegion']);})['then'](function(_0x5329da){if(_0x5329da&&_0x5329da[_0xe3c7('0x90')]){var _0x1ef396=_[_0xe3c7('0x4c')](_0x5329da['Buckets'],function(_0x3edab2){return _0x3edab2['Name']===_0x15db9b[_0xe3c7('0x83')];});if(!_0x1ef396){logger['info'](util[_0xe3c7('0x34')](_0xe3c7('0x91'),_0xc25d35['params']['id'],_0x15db9b[_0xe3c7('0x83')]));return createBucket(_0x204e38[_0xe3c7('0x8d')],_0x204e38[_0xe3c7('0x8e')],_0x15db9b[_0xe3c7('0x82')],_0x15db9b[_0xe3c7('0x83')]);}logger[_0xe3c7('0x6b')](util[_0xe3c7('0x34')](_0xe3c7('0x92'),_0xc25d35[_0xe3c7('0x4b')]['id'],_0x15db9b[_0xe3c7('0x83')]));return;}})[_0xe3c7('0x28')](function(_0x3d1955){if(_0x2de7c6[_0xe3c7('0x93')]===_0xe3c7('0x94')){return transcribe(_0xc25d35['params']['id'],_0x204e38['data1'],_0x204e38[_0xe3c7('0x8e')],_0x15db9b['transcribeRegion'],_0x15db9b['bucket'],_0x2de7c6[_0xe3c7('0x54')],_0x15db9b[_0xe3c7('0x89')]);}else{logger['info'](util[_0xe3c7('0x34')](_0xe3c7('0x95'),_0xc25d35[_0xe3c7('0x4b')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x26ce23){if(_0x26ce23){_0x26ce23['tempSentiment']=_0xc25d35[_0xe3c7('0x4f')][_0xe3c7('0x85')];return _0x2de7c6[_0xe3c7('0x96')](_0x26ce23);}})[_0xe3c7('0x28')](respondWithResult(_0x596105,null))[_0xe3c7('0x4d')](handleError(_0x596105,null));};function writeFile(_0x1ece51,_0x51ad08){return new Promise(function(_0x1732e1,_0x3d50a8){fs[_0xe3c7('0x97')](_0x51ad08,_0x1ece51,function(_0x4460b0,_0x5064a1){if(_0x4460b0){return _0x3d50a8(_0x4460b0);}else{return _0x1732e1(_0x5064a1);}});});}exports['downloadTranscribe']=function(_0x5508f3,_0x550903,_0x375c87){return db[_0xe3c7('0x46')][_0xe3c7('0x80')]({'where':{'id':_0x5508f3[_0xe3c7('0x4b')]['id']}})[_0xe3c7('0x28')](handleEntityNotFound(_0x550903))['then'](function(_0x3d84f7){if(_0x3d84f7&&_0x3d84f7['fileText']){var _0x9974cd=_0x3d84f7[_0xe3c7('0x98')];var _0x1056dd=config[_0xe3c7('0x99')]+_0xe3c7('0x9a')+_0x3d84f7['id']+_0xe3c7('0x9b');if(fs[_0xe3c7('0x66')](_0x1056dd)){return _0x1056dd;}return writeFile(_0x9974cd,_0x1056dd)[_0xe3c7('0x28')](function(){return _0x1056dd;});}else{throw new db[(_0xe3c7('0x58'))][(_0xe3c7('0x59'))](_0xe3c7('0x9c'));}})[_0xe3c7('0x28')](function(_0x18cf41){return _0x550903['download'](_0x18cf41);})[_0xe3c7('0x4d')](handleError(_0x550903));}; \ No newline at end of file +var _0x18b5=['listBuckets','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','transcribeStatus','decryptFile','Sequelize','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','type','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x18b5,0xc8));var _0x518b=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x18b5[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require(_0x518b('0x0'));var rimraf=require(_0x518b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x518b('0x2'));var moment=require(_0x518b('0x3'));var BPromise=require(_0x518b('0x4'));var Mustache=require(_0x518b('0x5'));var util=require(_0x518b('0x6'));var path=require(_0x518b('0x7'));var sox=require(_0x518b('0x8'));var csv=require(_0x518b('0x9'));var ejs=require(_0x518b('0xa'));var fs=require('fs');var fs_extra=require(_0x518b('0xb'));var _=require(_0x518b('0xc'));var squel=require(_0x518b('0xd'));var crypto=require(_0x518b('0xe'));var jsforce=require(_0x518b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x518b('0x9'));var querystring=require('querystring');var Papa=require(_0x518b('0x10'));var AWS=require(_0x518b('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0x518b('0x12'));var authService=require(_0x518b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x518b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x518b('0x15'))(_0x518b('0x16'));var utils=require('../../config/utils');var config=require(_0x518b('0x17'));var licenseUtil=require(_0x518b('0x18'));var db=require(_0x518b('0x19'))['db'];function respondWithStatusCode(_0x3c1009,_0x249ccb){_0x249ccb=_0x249ccb||0xcc;return function(_0x47b580){if(_0x47b580){return _0x3c1009[_0x518b('0x1a')](_0x249ccb);}return _0x3c1009[_0x518b('0x1b')](_0x249ccb)[_0x518b('0x1c')]();};}function respondWithResult(_0x9257d0,_0x29055d){_0x29055d=_0x29055d||0xc8;return function(_0x5c89dc){if(_0x5c89dc){return _0x9257d0[_0x518b('0x1b')](_0x29055d)[_0x518b('0x1d')](_0x5c89dc);}};}function respondWithFilteredResult(_0x45625a,_0x25ba6b){return function(_0x11075b){if(_0x11075b){var _0x622f08=typeof _0x25ba6b['offset']===_0x518b('0x1e')&&typeof _0x25ba6b['limit']===_0x518b('0x1e');var _0x3342d0=_0x11075b[_0x518b('0x1f')];var _0x564f42=_0x622f08?0x0:_0x25ba6b[_0x518b('0x20')];var _0x5b277d=_0x622f08?_0x11075b[_0x518b('0x1f')]:_0x25ba6b['offset']+_0x25ba6b['limit'];var _0x275f1d;if(_0x5b277d>=_0x3342d0){_0x5b277d=_0x3342d0;_0x275f1d=0xc8;}else{_0x275f1d=0xce;}_0x45625a[_0x518b('0x1b')](_0x275f1d);return _0x45625a[_0x518b('0x21')]('Content-Range',_0x564f42+'-'+_0x5b277d+'/'+_0x3342d0)['json'](_0x11075b);}return null;};}function patchUpdates(_0x2e9ce2){return function(_0x9eb538){try{jsonpatch[_0x518b('0x22')](_0x9eb538,_0x2e9ce2,!![]);}catch(_0x280a02){return BPromise[_0x518b('0x23')](_0x280a02);}return _0x9eb538['save']();};}function saveUpdates(_0x4e7bd6,_0x22e182){return function(_0x249918){if(_0x249918){return _0x249918[_0x518b('0x24')](_0x4e7bd6)[_0x518b('0x25')](function(_0x4eb58b){return _0x4eb58b;});}return null;};}function removeEntity(_0x2f5b6e,_0x19c586){return function(_0x17abf3){if(_0x17abf3){return _0x17abf3[_0x518b('0x26')]()['then'](function(){_0x2f5b6e[_0x518b('0x1b')](0xcc)[_0x518b('0x1c')]();});}};}function handleEntityNotFound(_0x3f4060,_0x34cbae){return function(_0x134da2){if(!_0x134da2){_0x3f4060[_0x518b('0x1a')](0x194);}return _0x134da2;};}function handleError(_0x4d29e9,_0x5c173d){_0x5c173d=_0x5c173d||0x1f4;return function(_0x1544e9){logger['error'](_0x1544e9[_0x518b('0x27')]);if(_0x1544e9[_0x518b('0x28')]){delete _0x1544e9[_0x518b('0x28')];}_0x4d29e9[_0x518b('0x1b')](_0x5c173d)[_0x518b('0x29')](_0x1544e9);};}exports[_0x518b('0x2a')]=function(_0x1563ec,_0x31364f){var _0x3fa078={},_0x294d07={},_0x224aa3={'count':0x0,'rows':[]};var _0x4e4259=_[_0x518b('0x2b')](db['VoiceRecording'][_0x518b('0x2c')],function(_0x257d02){return{'name':_0x257d02[_0x518b('0x2d')],'type':_0x257d02['type'][_0x518b('0x2e')]};});_0x294d07['model']=_[_0x518b('0x2f')](_[_0x518b('0x2b')](_0x4e4259,_0x518b('0x28')),['format']);_0x294d07[_0x518b('0x30')]=_[_0x518b('0x31')](_0x1563ec[_0x518b('0x30')]);_0x294d07[_0x518b('0x32')]=_[_0x518b('0x33')](_0x294d07[_0x518b('0x34')],_0x294d07['query']);_0x3fa078[_0x518b('0x35')]=_[_0x518b('0x33')](_0x294d07[_0x518b('0x34')],qs[_0x518b('0x36')](_0x1563ec[_0x518b('0x30')][_0x518b('0x36')]));_0x3fa078[_0x518b('0x35')]=_0x3fa078[_0x518b('0x35')][_0x518b('0x37')]?_0x3fa078[_0x518b('0x35')]:_0x294d07[_0x518b('0x34')];if(!_0x1563ec[_0x518b('0x30')][_0x518b('0x38')](_0x518b('0x39'))){_0x3fa078[_0x518b('0x3a')]=qs[_0x518b('0x3a')](_0x1563ec[_0x518b('0x30')][_0x518b('0x3a')]);_0x3fa078['offset']=qs[_0x518b('0x20')](_0x1563ec[_0x518b('0x30')][_0x518b('0x20')]);}_0x3fa078[_0x518b('0x3b')]=qs['sort'](_0x1563ec['query'][_0x518b('0x3c')]);_0x3fa078['where']=qs[_0x518b('0x32')](_[_0x518b('0x3d')](_0x1563ec[_0x518b('0x30')],_0x294d07[_0x518b('0x32')]),_0x4e4259);if(_0x1563ec[_0x518b('0x30')][_0x518b('0x3e')]){_0x3fa078[_0x518b('0x3f')]=_[_0x518b('0x40')](_0x3fa078[_0x518b('0x3f')],{'$or':_[_0x518b('0x2b')](_0x4e4259,function(_0x47eacd){if(_0x47eacd['type']!==_0x518b('0x41')){var _0x23d88c={};_0x23d88c[_0x47eacd[_0x518b('0x28')]]={'$like':'%'+_0x1563ec[_0x518b('0x30')][_0x518b('0x3e')]+'%'};return _0x23d88c;}})});}_0x3fa078=_[_0x518b('0x40')]({},_0x3fa078,_0x1563ec[_0x518b('0x42')]);var _0x2ee37c={'where':_0x3fa078[_0x518b('0x3f')]};return db[_0x518b('0x43')]['count'](_0x2ee37c)[_0x518b('0x25')](function(_0x1c97c6){_0x224aa3[_0x518b('0x1f')]=_0x1c97c6;if(_0x1563ec['query'][_0x518b('0x44')]){_0x3fa078[_0x518b('0x45')]=[{'all':!![]}];}return db[_0x518b('0x43')][_0x518b('0x46')](_0x3fa078);})['then'](function(_0x1ef715){_0x224aa3[_0x518b('0x47')]=_0x1ef715;return _0x224aa3;})[_0x518b('0x25')](respondWithFilteredResult(_0x31364f,_0x3fa078))[_0x518b('0x48')](handleError(_0x31364f,null));};exports[_0x518b('0x49')]=function(_0x42a18b,_0x48cac5){var _0x2b9f6f={'raw':![],'where':{'id':_0x42a18b[_0x518b('0x4a')]['id']}},_0x12f277={};_0x12f277[_0x518b('0x34')]=_[_0x518b('0x31')](db['VoiceRecording']['rawAttributes']);_0x12f277[_0x518b('0x30')]=_['keys'](_0x42a18b[_0x518b('0x30')]);_0x12f277[_0x518b('0x32')]=_[_0x518b('0x33')](_0x12f277[_0x518b('0x34')],_0x12f277[_0x518b('0x30')]);_0x2b9f6f[_0x518b('0x35')]=_[_0x518b('0x33')](_0x12f277[_0x518b('0x34')],qs[_0x518b('0x36')](_0x42a18b[_0x518b('0x30')]['fields']));_0x2b9f6f[_0x518b('0x35')]=_0x2b9f6f[_0x518b('0x35')][_0x518b('0x37')]?_0x2b9f6f[_0x518b('0x35')]:_0x12f277['model'];if(_0x42a18b[_0x518b('0x30')]['includeAll']){_0x2b9f6f[_0x518b('0x45')]=[{'all':!![]}];}_0x2b9f6f=_[_0x518b('0x40')]({},_0x2b9f6f,_0x42a18b[_0x518b('0x42')]);return db['VoiceRecording'][_0x518b('0x4b')](_0x2b9f6f)['then'](handleEntityNotFound(_0x48cac5,null))[_0x518b('0x25')](respondWithResult(_0x48cac5,null))['catch'](handleError(_0x48cac5,null));};exports[_0x518b('0x4c')]=function(_0x2a8ebe,_0x43f813){return db[_0x518b('0x43')][_0x518b('0x4c')](_0x2a8ebe[_0x518b('0x4d')],{})[_0x518b('0x25')](respondWithResult(_0x43f813,0xc9))['catch'](handleError(_0x43f813,null));};exports['update']=function(_0x4511b3,_0x260751){if(_0x4511b3[_0x518b('0x4d')]['id']){delete _0x4511b3[_0x518b('0x4d')]['id'];}return db[_0x518b('0x43')]['find']({'where':{'id':_0x4511b3[_0x518b('0x4a')]['id']}})[_0x518b('0x25')](handleEntityNotFound(_0x260751,null))[_0x518b('0x25')](saveUpdates(_0x4511b3['body'],null))[_0x518b('0x25')](respondWithResult(_0x260751,null))[_0x518b('0x48')](handleError(_0x260751,null));};exports[_0x518b('0x4e')]=function(_0x7b3e3d,_0x5245dc){return db[_0x518b('0x43')][_0x518b('0x4e')]()[_0x518b('0x25')](respondWithResult(_0x5245dc,null))[_0x518b('0x48')](handleError(_0x5245dc,null));};exports[_0x518b('0x4f')]=function(_0x104de9,_0x222c2d,_0x1fc6a2){var _0x49b029=require('../../components/encryptor');var _0x4e121d=![];var _0x1ffa70={};if(_0x104de9[_0x518b('0x30')][_0x518b('0x50')]&&_0x104de9[_0x518b('0x30')][_0x518b('0x50')]===_0x518b('0x51')){_0x1ffa70['uniqueid']=_0x104de9[_0x518b('0x4a')]['id'];}else{_0x1ffa70['id']=_0x104de9[_0x518b('0x4a')]['id'];}return db[_0x518b('0x43')][_0x518b('0x4b')]({'where':_0x1ffa70,'attributes':['id','value'],'raw':!![]})[_0x518b('0x25')](handleEntityNotFound(_0x222c2d,null))[_0x518b('0x25')](function(_0x575732){if(_0x575732){var _0x2102f9=_0x575732[_0x518b('0x52')];var _0x15e4de=util[_0x518b('0x53')](_0x518b('0x54'),_0x2102f9);if(fs['existsSync'](_0x15e4de)){_0x4e121d=!![];return _0x49b029['decryptFile'](_0x15e4de,_0x2102f9,config[_0x518b('0x55')][_0x518b('0x56')])[_0x518b('0x25')](function(){return _0x575732;});}return _0x575732;}})[_0x518b('0x25')](function(_0x284111){if(_0x284111){var _0x54109e=_0x284111['value'];if(!fs[_0x518b('0x57')](_0x54109e)){throw new db['Sequelize'][(_0x518b('0x58'))](_0x518b('0x59'));}if(_0x284111['filename']){return _0x222c2d[_0x518b('0x4f')](_0x54109e,_0x284111[_0x518b('0x5a')]+path[_0x518b('0x5b')](_0x54109e),function(){if(_0x4e121d){fs[_0x518b('0x5c')](_0x54109e);}});}else{return _0x222c2d[_0x518b('0x4f')](_0x54109e,function(_0x1f3635){if(_0x4e121d){fs['unlink'](_0x54109e);}});}}})[_0x518b('0x48')](function(_0x3a126d){if(_0x3a126d['message']===_0x518b('0x59')){_0x222c2d[_0x518b('0x1b')](0x194)[_0x518b('0x29')](_0x518b('0x5d'));}else{return handleError(_0x222c2d,null);}});};exports[_0x518b('0x5e')]=function(_0x1b482f,_0x4362eb,_0x2078a0){var _0xcab5a2=require('../../components/encryptor');var _0x1a4e9e=![];var _0xf02bf2={'$and':[db[_0x518b('0x5f')][_0x518b('0x3f')](db['sequelize']['fn'](_0x518b('0x60'),db[_0x518b('0x5f')][_0x518b('0x61')](_0x518b('0x51'))),_0x1b482f['query'][_0x518b('0x62')])]};if(_0x1b482f[_0x518b('0x30')][_0x518b('0x50')]&&_0x1b482f[_0x518b('0x30')][_0x518b('0x50')]===_0x518b('0x51')){_0xf02bf2[_0x518b('0x63')][_0x518b('0x64')]({'uniqueid':_0x1b482f[_0x518b('0x4a')]['id']});}else{_0xf02bf2[_0x518b('0x63')][_0x518b('0x64')]({'id':_0x1b482f[_0x518b('0x4a')]['id']});}return db[_0x518b('0x43')][_0x518b('0x4b')]({'where':_0xf02bf2,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4362eb,null))[_0x518b('0x25')](function(_0x32012a){if(_0x32012a){var _0x116dde=util[_0x518b('0x53')](_0x518b('0x54'),_0x32012a[_0x518b('0x52')]);if(fs[_0x518b('0x57')](_0x116dde)){_0x1a4e9e=!![];return _0xcab5a2['decryptFile'](_0x116dde,_0x32012a[_0x518b('0x52')],config[_0x518b('0x55')]['recording'])[_0x518b('0x25')](function(){return _0x32012a;});}return _0x32012a;}})[_0x518b('0x25')](function(_0x2970f0){if(_0x2970f0){if(!fs[_0x518b('0x57')](_0x2970f0[_0x518b('0x52')])){throw new db['Sequelize'][(_0x518b('0x58'))](_0x518b('0x59'));}if(_0x2970f0['filename']){return _0x4362eb[_0x518b('0x4f')](_0x2970f0[_0x518b('0x52')],_0x2970f0['filename']+path[_0x518b('0x5b')](_0x2970f0[_0x518b('0x52')]),function(){if(_0x1a4e9e){fs[_0x518b('0x5c')](_0x2970f0[_0x518b('0x52')]);}});}else{return _0x4362eb['download'](_0x2970f0[_0x518b('0x52')],function(_0x1ee2ba){if(_0x1a4e9e){fs[_0x518b('0x5c')](_0x2970f0[_0x518b('0x52')]);}});}}})[_0x518b('0x48')](handleError(_0x4362eb,null));};exports[_0x518b('0x26')]=function(_0x297573,_0x4f7075){return db[_0x518b('0x43')][_0x518b('0x4b')]({'where':{'id':_0x297573['params']['id']}})['then'](function(_0xb1c52a){if(_[_0x518b('0x65')](_0xb1c52a)){throw new ReferenceError('Entity\x20not\x20found');}return _0xb1c52a;})[_0x518b('0x25')](function(_0x2d85d9){var _0x6b1cb=_0x2d85d9[_0x518b('0x52')];logger[_0x518b('0x66')](_0x518b('0x67'),_0x6b1cb);if(!_[_0x518b('0x65')](_0x2d85d9[_0x518b('0x52')])&&fs[_0x518b('0x57')](_0x6b1cb)){logger['info'](_0x518b('0x68')+_0x6b1cb+_0x518b('0x69'));fs[_0x518b('0x6a')](_0x6b1cb);}_0x6b1cb=_0x6b1cb+_0x518b('0x6b');if(!_[_0x518b('0x65')](_0x2d85d9[_0x518b('0x52')])&&fs[_0x518b('0x57')](_0x6b1cb)){logger[_0x518b('0x66')](_0x518b('0x68')+_0x6b1cb+_0x518b('0x69'));fs[_0x518b('0x6a')](_0x6b1cb);}return _0x2d85d9;})[_0x518b('0x25')](function(_0x476c6f){if(!_0x476c6f)throw new InternalError();return _0x476c6f[_0x518b('0x26')]();})['then'](function(){_0x4f7075[_0x518b('0x1b')](0xcc)[_0x518b('0x1c')]();})[_0x518b('0x48')](handleError(_0x4f7075,null));};function getBucketslist(_0x508e18,_0x3afcdf,_0x2db4f8){return new Promise(function(_0x5b8fa0,_0x384449){var _0x2fb1ed=new AWS['S3']({'accessKeyId':_0x3afcdf,'secretAccessKey':_0x508e18,'region':_0x2db4f8});_0x2fb1ed[_0x518b('0x6c')]({},function(_0x19446b,_0x189ea7){if(_0x19446b){return _0x384449(_0x19446b);}else{return _0x5b8fa0(_0x189ea7);}});});}function createBucket(_0x4034d6,_0x4c89c4,_0x449f90,_0x295417){return new Promise(function(_0x57d21b,_0x39dc0a){var _0x207b7b=new AWS['S3']({'accessKeyId':_0x4c89c4,'secretAccessKey':_0x4034d6,'region':_0x449f90});_0x207b7b['createBucket']({'Bucket':_0x295417},function(_0x24f11e,_0x7e7f57){if(_0x24f11e){return _0x39dc0a(_0x24f11e);}else{return _0x57d21b(_0x7e7f57);}});});}function uploadFile(_0x313910,_0x5b5457,_0xacc85c,_0x1e973a,_0x2ee728,_0x274fbe){return new Promise(function(_0x106296,_0x21d0cf){var _0x5578cf=new AWS['S3']({'accessKeyId':_0x5b5457,'secretAccessKey':_0x313910,'region':_0xacc85c});_0x5578cf['upload']({'Bucket':_0x1e973a,'Key':_0x2ee728,'Body':_0x274fbe},function(_0x480a3f,_0x518b05){if(_0x480a3f){return _0x21d0cf(_0x480a3f);}else{return _0x106296(_0x518b05);}});});}function startTranscribe(_0x43b964,_0x39aa4b,_0x52ad74,_0x1cc23b,_0x140667,_0x438682){return new Promise(function(_0x54de95,_0x5e81d3){var _0x3bdd32=new AWS[(_0x518b('0x6d'))]({'accessKeyId':_0x39aa4b,'secretAccessKey':_0x43b964,'region':_0x52ad74});_0x3bdd32[_0x518b('0x6e')]({'TranscriptionJobName':_0x1cc23b,'LanguageCode':_0x140667,'Media':{'MediaFileUri':_0x438682}},function(_0x1f65e7,_0xcae658){if(_0x1f65e7){return _0x5e81d3(_0x1f65e7);}else{return _0x54de95(_0xcae658);}});});}function transcribe(_0x4553b9,_0x5781a4,_0x42b8b4,_0x44959a,_0xf56dea,_0x11fa59,_0x1bba44){return new Promise(function(_0x13978e,_0x533be8){var _0x2e9056={};logger[_0x518b('0x66')](util[_0x518b('0x53')](_0x518b('0x6f'),_0x4553b9,_0xf56dea));return uploadFile(_0x5781a4,_0x42b8b4,_0x44959a,_0xf56dea,path[_0x518b('0x70')](_0x11fa59),fs[_0x518b('0x71')](_0x11fa59))[_0x518b('0x25')](function(_0x3654a9){logger[_0x518b('0x66')](util['format'](_0x518b('0x72'),_0x4553b9,_0xf56dea,_0x3654a9['Location']));_0x2e9056[_0x518b('0x73')]=_0x3654a9[_0x518b('0x74')];_0x2e9056['location']=_0x3654a9[_0x518b('0x75')];logger[_0x518b('0x66')](util[_0x518b('0x53')](_0x518b('0x76'),_0x4553b9));return startTranscribe(_0x5781a4,_0x42b8b4,_0x44959a,uuidv4(),_0x1bba44,_0x3654a9[_0x518b('0x75')]);})[_0x518b('0x25')](function(_0x31d359){logger[_0x518b('0x66')](util[_0x518b('0x53')](_0x518b('0x77'),_0x4553b9,_0x31d359['TranscriptionJob']['TranscriptionJobName']));_0x2e9056[_0x518b('0x78')]=_0x31d359[_0x518b('0x79')]['TranscriptionJobName'];_0x2e9056[_0x518b('0x7a')]=_0x31d359[_0x518b('0x79')]['TranscriptionJobStatus'];return _0x13978e(_0x2e9056);})['catch'](function(_0x159978){return _0x533be8(_0x159978);});});}exports['runTranscribe']=function(_0x3a349b,_0x101f62,_0x571c86){var _0x3a1fff;var _0x37f72c;var _0x1e3161;var _0x50a9ad=require('../../components/encryptor');return db[_0x518b('0x43')]['findOne']({'where':{'id':_0x3a349b[_0x518b('0x4a')]['id']}})['then'](function(_0x3df220){if(_0x3df220){var _0x471146=util[_0x518b('0x53')](_0x518b('0x54'),_0x3df220['value']);if(fs['existsSync'](_0x471146)){cypher=!![];return _0x50a9ad[_0x518b('0x7b')](_0x471146,_0x3df220[_0x518b('0x52')],config[_0x518b('0x55')]['recording'])[_0x518b('0x25')](function(){return _0x3df220;});}return _0x3df220;}})[_0x518b('0x25')](function(_0x2d3851){if(!_0x2d3851){throw new db[(_0x518b('0x7c'))][(_0x518b('0x58'))](_0x518b('0x7d'));}_0x37f72c=_0x2d3851;return db[_0x518b('0x7e')][_0x518b('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x101f62,null))[_0x518b('0x25')](function(_0x2b2f67){if(_0x2b2f67){_0x3a1fff=_0x2b2f67;if(!_0x3a1fff[_0x518b('0x80')]||!_0x3a1fff[_0x518b('0x81')]||!_0x3a1fff[_0x518b('0x82')]||!_0x3a1fff[_0x518b('0x83')]||!_0x3a1fff['bucket']){throw new db[(_0x518b('0x7c'))][(_0x518b('0x58'))](_0x518b('0x84'));}if(_0x3a349b['body']['runSentiment']&&(!_0x3a1fff[_0x518b('0x85')]||!_0x3a1fff['sentimentAccountId']||!_0x3a1fff['sentimentRegion']||!_0x3a1fff['language']||!_0x3a1fff[_0x518b('0x73')])){throw new db['Sequelize']['ValidationError'](_0x518b('0x86'));}return db[_0x518b('0x87')][_0x518b('0x7f')]({'where':{'id':_0x3a1fff[_0x518b('0x81')]}});}})[_0x518b('0x25')](function(_0x2fab98){if(!_0x2fab98){throw new db[(_0x518b('0x7c'))]['ValidationError'](_0x518b('0x88'));}if(!_0x2fab98[_0x518b('0x89')]||!_0x2fab98[_0x518b('0x8a')]){throw new db[(_0x518b('0x7c'))]['ValidationError'](_0x518b('0x8b'));}_0x1e3161=_0x2fab98;return getBucketslist(_0x1e3161[_0x518b('0x89')],_0x1e3161[_0x518b('0x8a')],_0x3a1fff['transcribeRegion']);})[_0x518b('0x25')](function(_0x2def44){if(_0x2def44&&_0x2def44[_0x518b('0x8c')]){var _0x1fb92a=_[_0x518b('0x4b')](_0x2def44[_0x518b('0x8c')],function(_0xbb72b4){return _0xbb72b4[_0x518b('0x8d')]===_0x3a1fff['bucket'];});if(!_0x1fb92a){logger[_0x518b('0x66')](util[_0x518b('0x53')](_0x518b('0x8e'),_0x3a349b[_0x518b('0x4a')]['id'],_0x3a1fff[_0x518b('0x73')]));return createBucket(_0x1e3161[_0x518b('0x89')],_0x1e3161[_0x518b('0x8a')],_0x3a1fff[_0x518b('0x82')],_0x3a1fff[_0x518b('0x73')]);}logger[_0x518b('0x66')](util[_0x518b('0x53')](_0x518b('0x8f'),_0x3a349b[_0x518b('0x4a')]['id'],_0x3a1fff[_0x518b('0x73')]));return;}})['then'](function(_0x1bc1fd){if(_0x37f72c['transcribeStatus']==='NEW'){return transcribe(_0x3a349b['params']['id'],_0x1e3161[_0x518b('0x89')],_0x1e3161[_0x518b('0x8a')],_0x3a1fff[_0x518b('0x82')],_0x3a1fff[_0x518b('0x73')],_0x37f72c[_0x518b('0x52')],_0x3a1fff[_0x518b('0x83')]);}else{logger[_0x518b('0x66')](util[_0x518b('0x53')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3a349b[_0x518b('0x4a')]['id']));return{'transcribeStatus':_0x518b('0x90')};}})['then'](function(_0x9b4ba){if(_0x9b4ba){_0x9b4ba[_0x518b('0x91')]=_0x3a349b[_0x518b('0x4d')][_0x518b('0x92')];return _0x37f72c[_0x518b('0x93')](_0x9b4ba);}})[_0x518b('0x25')](respondWithResult(_0x101f62,null))['catch'](handleError(_0x101f62,null));};function writeFile(_0x2ef70e,_0x4ff506){return new Promise(function(_0x2abbf7,_0x422807){fs[_0x518b('0x94')](_0x4ff506,_0x2ef70e,function(_0x313579,_0x2f600d){if(_0x313579){return _0x422807(_0x313579);}else{return _0x2abbf7(_0x2f600d);}});});}exports['downloadTranscribe']=function(_0x524c6b,_0x14f198,_0x20d400){return db[_0x518b('0x43')][_0x518b('0x7f')]({'where':{'id':_0x524c6b['params']['id']}})['then'](handleEntityNotFound(_0x14f198))[_0x518b('0x25')](function(_0x5ac0f9){if(_0x5ac0f9&&_0x5ac0f9['fileText']){var _0x1a1b55=_0x5ac0f9[_0x518b('0x95')];var _0x449bb0=config[_0x518b('0x96')]+_0x518b('0x97')+_0x5ac0f9['id']+_0x518b('0x98');if(fs[_0x518b('0x57')](_0x449bb0)){return _0x449bb0;}return writeFile(_0x1a1b55,_0x449bb0)[_0x518b('0x25')](function(){return _0x449bb0;});}else{throw new db[(_0x518b('0x7c'))][(_0x518b('0x58'))](_0x518b('0x99'));}})[_0x518b('0x25')](function(_0x3247e1){return _0x14f198[_0x518b('0x4f')](_0x3247e1);})[_0x518b('0x48')](handleError(_0x14f198));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2de3e85..cdbe82a 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 _0xd6d6=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0xf7224d,_0x2b8c21){var _0x525740=function(_0x10278d){while(--_0x10278d){_0xf7224d['push'](_0xf7224d['shift']());}};_0x525740(++_0x2b8c21);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x7b0715,_0x239b8f){_0x7b0715=_0x7b0715-0x0;var _0x4ec3a6=_0xd6d6[_0x7b0715];return _0x4ec3a6;};'use strict';var attributes=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]=function(_0x24bd2a,_0x33226e){return _0x24bd2a['define'](_0x6d6d('0x2'),attributes,{'tableName':_0x6d6d('0x3'),'paranoid':![],'indexes':[{'name':_0x6d6d('0x4'),'fields':[_0x6d6d('0x4')]},{'name':_0x6d6d('0x5'),'fields':[_0x6d6d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccdc=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xccdc,0x1c4));var _0xcccd=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xccdc[_0x1992f1];return _0x413dfe;};'use strict';var attributes=require(_0xcccd('0x0'));module[_0xcccd('0x1')]=function(_0x48efea,_0x4a4fa5){return _0x48efea[_0xcccd('0x2')](_0xcccd('0x3'),attributes,{'tableName':_0xcccd('0x4'),'paranoid':![],'indexes':[{'name':_0xcccd('0x5'),'fields':[_0xcccd('0x5')]},{'name':_0xcccd('0x6'),'fields':[_0xcccd('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 8187d7f..ceefdea 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 _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x345e1b,_0x5151c2){var _0x454302=function(_0x1eb18c){while(--_0x1eb18c){_0x345e1b['push'](_0x345e1b['shift']());}};_0x454302(++_0x5151c2);}(_0x5204,0xdf));var _0x4520=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x5204[_0xc5a279];return _0xc755d3;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','callRecordingEncryption','create','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x32d01c,_0x26c32d){var _0x15f85d=function(_0x4da77b){while(--_0x4da77b){_0x32d01c['push'](_0x32d01c['shift']());}};_0x15f85d(++_0x26c32d);}(_0x9536,0x179));var _0x6953=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x9536[_0x22377a];return _0x36f105;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da771[_0x6953('0x1b')]?_0x2da771[_0x6953('0x1b')][_0x6953('0x1d')]||null:null,'attributes':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'limit':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1f')]||null:null})[_0x6953('0xc')](function(_0x171dd8){logger['info'](_0x6953('0x17'),_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x171dd8));_0x10858a(_0x171dd8);})['catch'](function(_0x5a4cd7){logger[_0x6953('0x12')](_0x6953('0x17'),_0x5a4cd7['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x5a4cd7['message']));});});};exports[_0x6953('0x20')]=function(_0x2bf39b){var _0xcdbce8=this;return new Promise(function(_0x2cc01e,_0x191d80){var _0x1497e3=require('../../components/encryptor');var _0x3dd890;return db[_0x6953('0x21')]['findOne']({'attributes':['id',_0x6953('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x173b3c){_0x3dd890=_0x173b3c;return db[_0x6953('0x18')][_0x6953('0x23')](_0x2bf39b['body']);})[_0x6953('0xc')](function(_0x3d7b04){if(_0x3dd890[_0x6953('0x22')]&&fs['existsSync'](_0x3d7b04[_0x6953('0x24')])){var _0x132a71=util['format']('%s.cypher',_0x3d7b04[_0x6953('0x24')]);return _0x1497e3[_0x6953('0x25')](_0x3d7b04[_0x6953('0x24')],_0x132a71,config[_0x6953('0x26')][_0x6953('0x27')])['then'](function(){fs[_0x6953('0x28')](_0x3d7b04['value']);logger[_0x6953('0x15')](_0x6953('0x29'));return _0x3d7b04;});}return _0x3d7b04;})['then'](function(_0x4a4d41){logger[_0x6953('0x15')](_0x6953('0x20'),_0x2bf39b);logger[_0x6953('0xf')]('CreateVoiceRecording',_0x2bf39b,JSON[_0x6953('0x11')](_0x4a4d41));_0x2cc01e(_0x4a4d41);})['catch'](function(_0x4e95f1){logger['error']('CreateVoiceRecording',_0x4e95f1[_0x6953('0x14')],_0x2bf39b);_0x191d80(_0xcdbce8[_0x6953('0x12')](0x1f4,_0x4e95f1[_0x6953('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d8fb4bb..09c7eff 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 _0xc584=['isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xc584,0x82));var _0x4c58=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xc584[_0x1655bb];return _0x5e2020;};'use strict';var multer=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var path=require(_0x4c58('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c58('0x3'));var router=express[_0x4c58('0x4')]();var fs_extra=require(_0x4c58('0x5'));var auth=require(_0x4c58('0x6'));var interaction=require(_0x4c58('0x7'));var config=require(_0x4c58('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x4c58('0x9')]('/',auth[_0x4c58('0xa')](),controller[_0x4c58('0xb')]);router[_0x4c58('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4c58('0xc')]);router[_0x4c58('0x9')](_0x4c58('0xd'),auth[_0x4c58('0xa')](),controller[_0x4c58('0xe')]);router['post']('/',auth[_0x4c58('0xa')](),controller[_0x4c58('0xf')]);router['put'](_0x4c58('0xd'),auth[_0x4c58('0xa')](),controller[_0x4c58('0x10')]);router[_0x4c58('0x11')](_0x4c58('0xd'),auth['isAuthenticated'](),controller[_0x4c58('0x12')]);module[_0x4c58('0x13')]=router; \ No newline at end of file +var _0xdff5=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x446d6d,_0x5aa756){var _0x22364d=function(_0x4322f3){while(--_0x4322f3){_0x446d6d['push'](_0x446d6d['shift']());}};_0x22364d(++_0x5aa756);}(_0xdff5,0xcd));var _0x5dff=function(_0x3be070,_0x1b0aad){_0x3be070=_0x3be070-0x0;var _0x25ead5=_0xdff5[_0x3be070];return _0x25ead5;};'use strict';var multer=require(_0x5dff('0x0'));var util=require(_0x5dff('0x1'));var path=require(_0x5dff('0x2'));var timeout=require(_0x5dff('0x3'));var express=require('express');var router=express[_0x5dff('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5dff('0x5'));var config=require(_0x5dff('0x6'));var controller=require(_0x5dff('0x7'));router[_0x5dff('0x8')]('/',auth['isAuthenticated'](),controller[_0x5dff('0x9')]);router[_0x5dff('0x8')](_0x5dff('0xa'),auth[_0x5dff('0xb')](),controller['describe']);router[_0x5dff('0x8')](_0x5dff('0xc'),auth[_0x5dff('0xb')](),controller[_0x5dff('0xd')]);router[_0x5dff('0xe')]('/',auth[_0x5dff('0xb')](),controller[_0x5dff('0xf')]);router[_0x5dff('0x10')](_0x5dff('0xc'),auth[_0x5dff('0xb')](),controller[_0x5dff('0x11')]);router[_0x5dff('0x12')]('/:id',auth[_0x5dff('0xb')](),controller[_0x5dff('0x13')]);module[_0x5dff('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 40b5822..f5d8987 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 _0xbe71=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xbe71,0x12e));var _0x1be7=function(_0x49b7ed,_0x4877fe){_0x49b7ed=_0x49b7ed-0x0;var _0x296dc9=_0xbe71[_0x49b7ed];return _0x296dc9;};'use strict';var Sequelize=require(_0x1be7('0x0'));var moment=require(_0x1be7('0x1'));module[_0x1be7('0x2')]={'type':{'type':Sequelize[_0x1be7('0x3')](_0x1be7('0x4'),_0x1be7('0x5'))},'result':{'type':Sequelize[_0x1be7('0x6')]},'transfererchannel':{'type':Sequelize[_0x1be7('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x1be7('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x1be7('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1be7('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1be7('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x1be7('0x6')]},'transfereechannel':{'type':Sequelize[_0x1be7('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x1be7('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x1be7('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1be7('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1be7('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x1be7('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1be7('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x1be7('0x6')]},'isexternal':{'type':Sequelize[_0x1be7('0x3')](_0x1be7('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x1be7('0x6')]}}; \ No newline at end of file +var _0xe32d=['sequelize','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x4b4293,_0x3e3af9){var _0x554ca3=function(_0x9660fc){while(--_0x9660fc){_0x4b4293['push'](_0x4b4293['shift']());}};_0x554ca3(++_0x3e3af9);}(_0xe32d,0x1ab));var _0xde32=function(_0x44a1ec,_0x2acea5){_0x44a1ec=_0x44a1ec-0x0;var _0x2be209=_0xe32d[_0x44a1ec];return _0x2be209;};'use strict';var Sequelize=require(_0xde32('0x0'));var moment=require('moment');module[_0xde32('0x1')]={'type':{'type':Sequelize[_0xde32('0x2')](_0xde32('0x3'),_0xde32('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xde32('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xde32('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xde32('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xde32('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xde32('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xde32('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xde32('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xde32('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xde32('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xde32('0x5')]},'transfereecontext':{'type':Sequelize[_0xde32('0x5')]},'transfereeexten':{'type':Sequelize[_0xde32('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xde32('0x2')](_0xde32('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index fe3581b..26c4723 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 _0x3ee9=['error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','then','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy'];(function(_0x11c47d,_0x58930b){var _0x4305e1=function(_0x1dde01){while(--_0x1dde01){_0x11c47d['push'](_0x11c47d['shift']());}};_0x4305e1(++_0x58930b);}(_0x3ee9,0x73));var _0x93ee=function(_0x481e35,_0x3ec80b){_0x481e35=_0x481e35-0x0;var _0x1dd292=_0x3ee9[_0x481e35];return _0x1dd292;};'use strict';var emlformat=require(_0x93ee('0x0'));var rimraf=require(_0x93ee('0x1'));var zipdir=require(_0x93ee('0x2'));var jsonpatch=require(_0x93ee('0x3'));var rp=require('request-promise');var moment=require(_0x93ee('0x4'));var BPromise=require(_0x93ee('0x5'));var Mustache=require('mustache');var util=require(_0x93ee('0x6'));var path=require(_0x93ee('0x7'));var sox=require(_0x93ee('0x8'));var csv=require(_0x93ee('0x9'));var ejs=require(_0x93ee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93ee('0xb'));var squel=require(_0x93ee('0xc'));var crypto=require(_0x93ee('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x93ee('0x9'));var querystring=require(_0x93ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x93ee('0xf'));var authService=require(_0x93ee('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93ee('0x11'))('api');var utils=require(_0x93ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x93ee('0x13'));var db=require(_0x93ee('0x14'))['db'];function respondWithStatusCode(_0x2f721c,_0x2febe1){_0x2febe1=_0x2febe1||0xcc;return function(_0x11639e){if(_0x11639e){return _0x2f721c[_0x93ee('0x15')](_0x2febe1);}return _0x2f721c[_0x93ee('0x16')](_0x2febe1)[_0x93ee('0x17')]();};}function respondWithResult(_0x1962d3,_0x235833){_0x235833=_0x235833||0xc8;return function(_0x484880){if(_0x484880){return _0x1962d3[_0x93ee('0x16')](_0x235833)[_0x93ee('0x18')](_0x484880);}};}function respondWithFilteredResult(_0x5c3e1d,_0x3ec524){return function(_0x124e09){if(_0x124e09){var _0x5e192c=typeof _0x3ec524['offset']===_0x93ee('0x19')&&typeof _0x3ec524[_0x93ee('0x1a')]===_0x93ee('0x19');var _0x4d4802=_0x124e09['count'];var _0x64fd7a=_0x5e192c?0x0:_0x3ec524[_0x93ee('0x1b')];var _0x55aa4b=_0x5e192c?_0x124e09[_0x93ee('0x1c')]:_0x3ec524[_0x93ee('0x1b')]+_0x3ec524[_0x93ee('0x1a')];var _0x458db7;if(_0x55aa4b>=_0x4d4802){_0x55aa4b=_0x4d4802;_0x458db7=0xc8;}else{_0x458db7=0xce;}_0x5c3e1d['status'](_0x458db7);return _0x5c3e1d[_0x93ee('0x1d')](_0x93ee('0x1e'),_0x64fd7a+'-'+_0x55aa4b+'/'+_0x4d4802)[_0x93ee('0x18')](_0x124e09);}return null;};}function patchUpdates(_0x4daca5){return function(_0x49e26f){try{jsonpatch[_0x93ee('0x1f')](_0x49e26f,_0x4daca5,!![]);}catch(_0x1bbded){return BPromise[_0x93ee('0x20')](_0x1bbded);}return _0x49e26f[_0x93ee('0x21')]();};}function saveUpdates(_0x156a12,_0x3cfdc3){return function(_0x3aa704){if(_0x3aa704){return _0x3aa704['update'](_0x156a12)['then'](function(_0x16fe47){return _0x16fe47;});}return null;};}function removeEntity(_0x20b122,_0x4d663a){return function(_0x2b449b){if(_0x2b449b){return _0x2b449b[_0x93ee('0x22')]()['then'](function(){_0x20b122[_0x93ee('0x16')](0xcc)[_0x93ee('0x17')]();});}};}function handleEntityNotFound(_0x41962c,_0x2a28c7){return function(_0x1933b6){if(!_0x1933b6){_0x41962c[_0x93ee('0x15')](0x194);}return _0x1933b6;};}function handleError(_0x5d82ac,_0x1f0bd4){_0x1f0bd4=_0x1f0bd4||0x1f4;return function(_0x1909de){logger[_0x93ee('0x23')](_0x1909de[_0x93ee('0x24')]);if(_0x1909de[_0x93ee('0x25')]){delete _0x1909de[_0x93ee('0x25')];}_0x5d82ac[_0x93ee('0x16')](_0x1f0bd4)[_0x93ee('0x26')](_0x1909de);};}exports[_0x93ee('0x27')]=function(_0x4e5a0f,_0x5d7c8c){var _0x1b4761={},_0x131ee8={},_0x3eaf50={'count':0x0,'rows':[]};var _0x1369af=_[_0x93ee('0x28')](db[_0x93ee('0x29')][_0x93ee('0x2a')],function(_0x4f7ce7){return{'name':_0x4f7ce7[_0x93ee('0x2b')],'type':_0x4f7ce7[_0x93ee('0x2c')][_0x93ee('0x2d')]};});_0x131ee8[_0x93ee('0x2e')]=_[_0x93ee('0x28')](_0x1369af,_0x93ee('0x25'));_0x131ee8[_0x93ee('0x2f')]=_[_0x93ee('0x30')](_0x4e5a0f['query']);_0x131ee8[_0x93ee('0x31')]=_[_0x93ee('0x32')](_0x131ee8[_0x93ee('0x2e')],_0x131ee8[_0x93ee('0x2f')]);_0x1b4761['attributes']=_[_0x93ee('0x32')](_0x131ee8[_0x93ee('0x2e')],qs['fields'](_0x4e5a0f['query'][_0x93ee('0x33')]));_0x1b4761[_0x93ee('0x34')]=_0x1b4761[_0x93ee('0x34')][_0x93ee('0x35')]?_0x1b4761['attributes']:_0x131ee8[_0x93ee('0x2e')];if(!_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x36')]('nolimit')){_0x1b4761[_0x93ee('0x1a')]=qs[_0x93ee('0x1a')](_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x1a')]);_0x1b4761[_0x93ee('0x1b')]=qs[_0x93ee('0x1b')](_0x4e5a0f['query'][_0x93ee('0x1b')]);}_0x1b4761[_0x93ee('0x37')]=qs[_0x93ee('0x38')](_0x4e5a0f['query'][_0x93ee('0x38')]);_0x1b4761[_0x93ee('0x39')]=qs[_0x93ee('0x31')](_[_0x93ee('0x3a')](_0x4e5a0f['query'],_0x131ee8[_0x93ee('0x31')]),_0x1369af);if(_0x4e5a0f[_0x93ee('0x2f')]['filter']){_0x1b4761[_0x93ee('0x39')]=_[_0x93ee('0x3b')](_0x1b4761[_0x93ee('0x39')],{'$or':_[_0x93ee('0x28')](_0x1369af,function(_0x5ca17c){if(_0x5ca17c[_0x93ee('0x2c')]!==_0x93ee('0x3c')){var _0x518070={};_0x518070[_0x5ca17c[_0x93ee('0x25')]]={'$like':'%'+_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x3d')]+'%'};return _0x518070;}})});}_0x1b4761=_[_0x93ee('0x3b')]({},_0x1b4761,_0x4e5a0f[_0x93ee('0x3e')]);var _0x2dd9a5={'where':_0x1b4761[_0x93ee('0x39')]};return db['VoiceTransferReport'][_0x93ee('0x1c')](_0x2dd9a5)['then'](function(_0x4fecb0){_0x3eaf50[_0x93ee('0x1c')]=_0x4fecb0;if(_0x4e5a0f[_0x93ee('0x2f')][_0x93ee('0x3f')]){_0x1b4761[_0x93ee('0x40')]=[{'all':!![]}];}return db[_0x93ee('0x29')]['findAll'](_0x1b4761);})[_0x93ee('0x41')](function(_0x473342){_0x3eaf50[_0x93ee('0x42')]=_0x473342;return _0x3eaf50;})[_0x93ee('0x41')](respondWithFilteredResult(_0x5d7c8c,_0x1b4761))[_0x93ee('0x43')](handleError(_0x5d7c8c,null));};exports[_0x93ee('0x44')]=function(_0x2bb601,_0xef1e1f){var _0x544957={'raw':!![],'where':{'id':_0x2bb601[_0x93ee('0x45')]['id']}},_0x5d3801={};_0x5d3801['model']=_[_0x93ee('0x30')](db['VoiceTransferReport'][_0x93ee('0x2a')]);_0x5d3801['query']=_[_0x93ee('0x30')](_0x2bb601[_0x93ee('0x2f')]);_0x5d3801[_0x93ee('0x31')]=_['intersection'](_0x5d3801[_0x93ee('0x2e')],_0x5d3801[_0x93ee('0x2f')]);_0x544957[_0x93ee('0x34')]=_[_0x93ee('0x32')](_0x5d3801[_0x93ee('0x2e')],qs[_0x93ee('0x33')](_0x2bb601[_0x93ee('0x2f')][_0x93ee('0x33')]));_0x544957[_0x93ee('0x34')]=_0x544957[_0x93ee('0x34')][_0x93ee('0x35')]?_0x544957['attributes']:_0x5d3801['model'];if(_0x2bb601[_0x93ee('0x2f')]['includeAll']){_0x544957[_0x93ee('0x40')]=[{'all':!![]}];}_0x544957=_[_0x93ee('0x3b')]({},_0x544957,_0x2bb601[_0x93ee('0x3e')]);return db[_0x93ee('0x29')][_0x93ee('0x46')](_0x544957)[_0x93ee('0x41')](handleEntityNotFound(_0xef1e1f,null))[_0x93ee('0x41')](respondWithResult(_0xef1e1f,null))[_0x93ee('0x43')](handleError(_0xef1e1f,null));};exports[_0x93ee('0x47')]=function(_0x1d2f97,_0x391140){return db[_0x93ee('0x29')]['create'](_0x1d2f97['body'],{})[_0x93ee('0x41')](respondWithResult(_0x391140,0xc9))[_0x93ee('0x43')](handleError(_0x391140,null));};exports[_0x93ee('0x48')]=function(_0x276140,_0x103a8b){if(_0x276140[_0x93ee('0x49')]['id']){delete _0x276140[_0x93ee('0x49')]['id'];}return db['VoiceTransferReport'][_0x93ee('0x46')]({'where':{'id':_0x276140[_0x93ee('0x45')]['id']}})[_0x93ee('0x41')](handleEntityNotFound(_0x103a8b,null))[_0x93ee('0x41')](saveUpdates(_0x276140['body'],null))[_0x93ee('0x41')](respondWithResult(_0x103a8b,null))['catch'](handleError(_0x103a8b,null));};exports[_0x93ee('0x22')]=function(_0x3eddb4,_0x1dc496){return db[_0x93ee('0x29')][_0x93ee('0x46')]({'where':{'id':_0x3eddb4[_0x93ee('0x45')]['id']}})[_0x93ee('0x41')](handleEntityNotFound(_0x1dc496,null))[_0x93ee('0x41')](removeEntity(_0x1dc496,null))['catch'](handleError(_0x1dc496,null));};exports[_0x93ee('0x4a')]=function(_0x1157e9,_0x8995ac){return db[_0x93ee('0x29')][_0x93ee('0x4a')]()[_0x93ee('0x41')](respondWithResult(_0x8995ac,null))[_0x93ee('0x43')](handleError(_0x8995ac,null));}; \ No newline at end of file +var _0xaebd=['sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','map','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0xac1d19,_0x447fa8){var _0x1133e0=function(_0x44a661){while(--_0x44a661){_0xac1d19['push'](_0xac1d19['shift']());}};_0x1133e0(++_0x447fa8);}(_0xaebd,0x123));var _0xdaeb=function(_0x589836,_0x14d7fc){_0x589836=_0x589836-0x0;var _0x12b6ff=_0xaebd[_0x589836];return _0x12b6ff;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdaeb('0x1'));var rp=require(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdaeb('0x5'));var csv=require(_0xdaeb('0x6'));var ejs=require(_0xdaeb('0x7'));var fs=require('fs');var fs_extra=require(_0xdaeb('0x8'));var _=require(_0xdaeb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaeb('0xa'));var deskjs=require(_0xdaeb('0xb'));var toCsv=require(_0xdaeb('0x6'));var querystring=require('querystring');var Papa=require(_0xdaeb('0xc'));var Redis=require(_0xdaeb('0xd'));var authService=require(_0xdaeb('0xe'));var qs=require(_0xdaeb('0xf'));var as=require(_0xdaeb('0x10'));var hardwareService=require(_0xdaeb('0x11'));var logger=require(_0xdaeb('0x12'))(_0xdaeb('0x13'));var utils=require(_0xdaeb('0x14'));var config=require(_0xdaeb('0x15'));var licenseUtil=require(_0xdaeb('0x16'));var db=require(_0xdaeb('0x17'))['db'];function respondWithStatusCode(_0x3a8c23,_0x2a6d66){_0x2a6d66=_0x2a6d66||0xcc;return function(_0x534427){if(_0x534427){return _0x3a8c23[_0xdaeb('0x18')](_0x2a6d66);}return _0x3a8c23[_0xdaeb('0x19')](_0x2a6d66)[_0xdaeb('0x1a')]();};}function respondWithResult(_0x1f33db,_0x4d5fdd){_0x4d5fdd=_0x4d5fdd||0xc8;return function(_0x483363){if(_0x483363){return _0x1f33db['status'](_0x4d5fdd)[_0xdaeb('0x1b')](_0x483363);}};}function respondWithFilteredResult(_0x32f14b,_0x411f26){return function(_0x3aef0f){if(_0x3aef0f){var _0x3b9df2=typeof _0x411f26[_0xdaeb('0x1c')]===_0xdaeb('0x1d')&&typeof _0x411f26['limit']===_0xdaeb('0x1d');var _0x1d97fe=_0x3aef0f[_0xdaeb('0x1e')];var _0x23510a=_0x3b9df2?0x0:_0x411f26[_0xdaeb('0x1c')];var _0x12d481=_0x3b9df2?_0x3aef0f['count']:_0x411f26['offset']+_0x411f26[_0xdaeb('0x1f')];var _0x481355;if(_0x12d481>=_0x1d97fe){_0x12d481=_0x1d97fe;_0x481355=0xc8;}else{_0x481355=0xce;}_0x32f14b[_0xdaeb('0x19')](_0x481355);return _0x32f14b[_0xdaeb('0x20')](_0xdaeb('0x21'),_0x23510a+'-'+_0x12d481+'/'+_0x1d97fe)[_0xdaeb('0x1b')](_0x3aef0f);}return null;};}function patchUpdates(_0x423eaa){return function(_0x199491){try{jsonpatch['apply'](_0x199491,_0x423eaa,!![]);}catch(_0x3064e7){return BPromise[_0xdaeb('0x22')](_0x3064e7);}return _0x199491[_0xdaeb('0x23')]();};}function saveUpdates(_0x35843a,_0x590bce){return function(_0x20c867){if(_0x20c867){return _0x20c867[_0xdaeb('0x24')](_0x35843a)[_0xdaeb('0x25')](function(_0x5d439b){return _0x5d439b;});}return null;};}function removeEntity(_0x52f701,_0x7a07a6){return function(_0xb24396){if(_0xb24396){return _0xb24396[_0xdaeb('0x26')]()[_0xdaeb('0x25')](function(){_0x52f701[_0xdaeb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199e99,_0x41f80d){return function(_0xb78542){if(!_0xb78542){_0x199e99[_0xdaeb('0x18')](0x194);}return _0xb78542;};}function handleError(_0x5f35a5,_0x20a73d){_0x20a73d=_0x20a73d||0x1f4;return function(_0x1f73b2){logger[_0xdaeb('0x27')](_0x1f73b2[_0xdaeb('0x28')]);if(_0x1f73b2[_0xdaeb('0x29')]){delete _0x1f73b2[_0xdaeb('0x29')];}_0x5f35a5[_0xdaeb('0x19')](_0x20a73d)[_0xdaeb('0x2a')](_0x1f73b2);};}exports[_0xdaeb('0x2b')]=function(_0x29ad67,_0x2109a2){var _0x3fde7c={},_0xedf743={},_0x59d638={'count':0x0,'rows':[]};var _0x47b8cb=_['map'](db[_0xdaeb('0x2c')][_0xdaeb('0x2d')],function(_0x15eb8d){return{'name':_0x15eb8d[_0xdaeb('0x2e')],'type':_0x15eb8d[_0xdaeb('0x2f')]['key']};});_0xedf743['model']=_['map'](_0x47b8cb,'name');_0xedf743[_0xdaeb('0x30')]=_['keys'](_0x29ad67[_0xdaeb('0x30')]);_0xedf743[_0xdaeb('0x31')]=_['intersection'](_0xedf743[_0xdaeb('0x32')],_0xedf743[_0xdaeb('0x30')]);_0x3fde7c[_0xdaeb('0x33')]=_[_0xdaeb('0x34')](_0xedf743[_0xdaeb('0x32')],qs[_0xdaeb('0x35')](_0x29ad67['query'][_0xdaeb('0x35')]));_0x3fde7c[_0xdaeb('0x33')]=_0x3fde7c[_0xdaeb('0x33')][_0xdaeb('0x36')]?_0x3fde7c[_0xdaeb('0x33')]:_0xedf743['model'];if(!_0x29ad67[_0xdaeb('0x30')]['hasOwnProperty'](_0xdaeb('0x37'))){_0x3fde7c[_0xdaeb('0x1f')]=qs[_0xdaeb('0x1f')](_0x29ad67['query'][_0xdaeb('0x1f')]);_0x3fde7c[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x29ad67['query']['offset']);}_0x3fde7c['order']=qs[_0xdaeb('0x38')](_0x29ad67[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x3fde7c[_0xdaeb('0x39')]=qs[_0xdaeb('0x31')](_[_0xdaeb('0x3a')](_0x29ad67[_0xdaeb('0x30')],_0xedf743['filters']),_0x47b8cb);if(_0x29ad67['query']['filter']){_0x3fde7c['where']=_[_0xdaeb('0x3b')](_0x3fde7c[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x3c')](_0x47b8cb,function(_0x376e6c){if(_0x376e6c[_0xdaeb('0x2f')]!=='VIRTUAL'){var _0x3f31ec={};_0x3f31ec[_0x376e6c[_0xdaeb('0x29')]]={'$like':'%'+_0x29ad67[_0xdaeb('0x30')]['filter']+'%'};return _0x3f31ec;}})});}_0x3fde7c=_[_0xdaeb('0x3b')]({},_0x3fde7c,_0x29ad67[_0xdaeb('0x3d')]);var _0x5867c5={'where':_0x3fde7c[_0xdaeb('0x39')]};return db[_0xdaeb('0x2c')][_0xdaeb('0x1e')](_0x5867c5)[_0xdaeb('0x25')](function(_0x23ae10){_0x59d638['count']=_0x23ae10;if(_0x29ad67[_0xdaeb('0x30')][_0xdaeb('0x3e')]){_0x3fde7c['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xdaeb('0x3f')](_0x3fde7c);})['then'](function(_0x1898c8){_0x59d638[_0xdaeb('0x40')]=_0x1898c8;return _0x59d638;})['then'](respondWithFilteredResult(_0x2109a2,_0x3fde7c))[_0xdaeb('0x41')](handleError(_0x2109a2,null));};exports[_0xdaeb('0x42')]=function(_0x40f72c,_0x5cda27){var _0x2b4c41={'raw':!![],'where':{'id':_0x40f72c[_0xdaeb('0x43')]['id']}},_0x3757e4={};_0x3757e4['model']=_[_0xdaeb('0x44')](db[_0xdaeb('0x2c')][_0xdaeb('0x2d')]);_0x3757e4[_0xdaeb('0x30')]=_[_0xdaeb('0x44')](_0x40f72c['query']);_0x3757e4[_0xdaeb('0x31')]=_[_0xdaeb('0x34')](_0x3757e4[_0xdaeb('0x32')],_0x3757e4[_0xdaeb('0x30')]);_0x2b4c41['attributes']=_['intersection'](_0x3757e4[_0xdaeb('0x32')],qs[_0xdaeb('0x35')](_0x40f72c[_0xdaeb('0x30')][_0xdaeb('0x35')]));_0x2b4c41[_0xdaeb('0x33')]=_0x2b4c41['attributes'][_0xdaeb('0x36')]?_0x2b4c41[_0xdaeb('0x33')]:_0x3757e4[_0xdaeb('0x32')];if(_0x40f72c['query'][_0xdaeb('0x3e')]){_0x2b4c41[_0xdaeb('0x45')]=[{'all':!![]}];}_0x2b4c41=_[_0xdaeb('0x3b')]({},_0x2b4c41,_0x40f72c['options']);return db[_0xdaeb('0x2c')]['find'](_0x2b4c41)[_0xdaeb('0x25')](handleEntityNotFound(_0x5cda27,null))['then'](respondWithResult(_0x5cda27,null))[_0xdaeb('0x41')](handleError(_0x5cda27,null));};exports['create']=function(_0x49d2d5,_0x40c632){return db['VoiceTransferReport'][_0xdaeb('0x46')](_0x49d2d5[_0xdaeb('0x47')],{})[_0xdaeb('0x25')](respondWithResult(_0x40c632,0xc9))['catch'](handleError(_0x40c632,null));};exports[_0xdaeb('0x24')]=function(_0x309402,_0x3857bf){if(_0x309402[_0xdaeb('0x47')]['id']){delete _0x309402[_0xdaeb('0x47')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x309402[_0xdaeb('0x43')]['id']}})[_0xdaeb('0x25')](handleEntityNotFound(_0x3857bf,null))['then'](saveUpdates(_0x309402[_0xdaeb('0x47')],null))[_0xdaeb('0x25')](respondWithResult(_0x3857bf,null))[_0xdaeb('0x41')](handleError(_0x3857bf,null));};exports[_0xdaeb('0x26')]=function(_0x2a740c,_0x29da2c){return db[_0xdaeb('0x2c')][_0xdaeb('0x48')]({'where':{'id':_0x2a740c[_0xdaeb('0x43')]['id']}})[_0xdaeb('0x25')](handleEntityNotFound(_0x29da2c,null))[_0xdaeb('0x25')](removeEntity(_0x29da2c,null))[_0xdaeb('0x41')](handleError(_0x29da2c,null));};exports['describe']=function(_0x250ac3,_0x3680ed){return db[_0xdaeb('0x2c')][_0xdaeb('0x49')]()[_0xdaeb('0x25')](respondWithResult(_0x3680ed,null))[_0xdaeb('0x41')](handleError(_0x3680ed,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index cc04f8d..be62d46 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 _0xacf6=['moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x47f728,_0x41987f){var _0x427ab2=function(_0x13d8c5){while(--_0x13d8c5){_0x47f728['push'](_0x47f728['shift']());}};_0x427ab2(++_0x41987f);}(_0xacf6,0x19c));var _0x6acf=function(_0x181fba,_0x468f0c){_0x181fba=_0x181fba-0x0;var _0x346036=_0xacf6[_0x181fba];return _0x346036;};'use strict';var _=require(_0x6acf('0x0'));var util=require(_0x6acf('0x1'));var logger=require(_0x6acf('0x2'))(_0x6acf('0x3'));var moment=require(_0x6acf('0x4'));var BPromise=require(_0x6acf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6acf('0x6'));var rimraf=require(_0x6acf('0x7'));var config=require(_0x6acf('0x8'));var attributes=require(_0x6acf('0x9'));module['exports']=function(_0x2fcfbc,_0xea1acf){return _0x2fcfbc[_0x6acf('0xa')](_0x6acf('0xb'),attributes,{'tableName':_0x6acf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75d9=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','report_call_transfer','lodash'];(function(_0x5f0f3f,_0x4a63ae){var _0x2545cc=function(_0x14447f){while(--_0x14447f){_0x5f0f3f['push'](_0x5f0f3f['shift']());}};_0x2545cc(++_0x4a63ae);}(_0x75d9,0x81));var _0x975d=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x75d9[_0x3747ae];return _0x339035;};'use strict';var _=require(_0x975d('0x0'));var util=require('util');var logger=require(_0x975d('0x1'))(_0x975d('0x2'));var moment=require(_0x975d('0x3'));var BPromise=require('bluebird');var rp=require(_0x975d('0x4'));var fs=require('fs');var path=require(_0x975d('0x5'));var rimraf=require('rimraf');var config=require(_0x975d('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x975d('0x7')]=function(_0x143575,_0x244842){return _0x143575[_0x975d('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x975d('0x9'),'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 548ae7e..1fcf08b 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 _0x63e4=['request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x229532,_0x1c0e67){var _0x598c8a=function(_0x3e25ac){while(--_0x3e25ac){_0x229532['push'](_0x229532['shift']());}};_0x598c8a(++_0x1c0e67);}(_0x63e4,0xd6));var _0x463e=function(_0x19ab22,_0x3c15c8){_0x19ab22=_0x19ab22-0x0;var _0x228117=_0x63e4[_0x19ab22];return _0x228117;};'use strict';var _=require('lodash');var util=require(_0x463e('0x0'));var moment=require(_0x463e('0x1'));var BPromise=require(_0x463e('0x2'));var rs=require(_0x463e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x463e('0x4'))['db'];var utils=require(_0x463e('0x5'));var logger=require(_0x463e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x463e('0x7'));var client=jayson[_0x463e('0x8')][_0x463e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x741609,_0x45f666,_0x19dc1c){return new BPromise(function(_0x47c591,_0x25ce2b){return client[_0x463e('0xa')](_0x741609,_0x19dc1c)[_0x463e('0xb')](function(_0x4c0bc7){logger[_0x463e('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x45f666,'request\x20sent');logger[_0x463e('0xd')](_0x463e('0xe'),_0x45f666,_0x463e('0xf'),JSON[_0x463e('0x10')](_0x4c0bc7));if(_0x4c0bc7[_0x463e('0x11')]){if(_0x4c0bc7[_0x463e('0x11')]['code']===0x1f4){logger['error'](_0x463e('0x12'),_0x45f666,_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);return _0x25ce2b(_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);}logger['error'](_0x463e('0x12'),_0x45f666,_0x4c0bc7['error'][_0x463e('0x13')]);return _0x47c591(_0x4c0bc7[_0x463e('0x11')][_0x463e('0x13')]);}else{logger[_0x463e('0xc')](_0x463e('0x12'),_0x45f666,_0x463e('0xf'));_0x47c591(_0x4c0bc7[_0x463e('0x14')][_0x463e('0x13')]);}})[_0x463e('0x15')](function(_0x26e2a8){logger[_0x463e('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x45f666,_0x26e2a8);_0x25ce2b(_0x26e2a8);});});}exports[_0x463e('0x16')]=function(_0x17a94c){var _0xe5907a=this;return new Promise(function(_0x24df8d,_0x1ddff8){return db[_0x463e('0x17')][_0x463e('0x18')](_0x17a94c[_0x463e('0x19')],{'raw':_0x17a94c[_0x463e('0x1a')]?_0x17a94c[_0x463e('0x1a')][_0x463e('0x1b')]===undefined?!![]:![]:!![]})[_0x463e('0xb')](function(_0x51a080){logger[_0x463e('0xc')](_0x463e('0x16'),_0x17a94c);logger['debug'](_0x463e('0x16'),_0x17a94c,JSON[_0x463e('0x10')](_0x51a080));_0x24df8d(_0x51a080);})[_0x463e('0x15')](function(_0x32fe01){logger['error'](_0x463e('0x16'),_0x32fe01[_0x463e('0x13')],_0x17a94c);_0x1ddff8(_0xe5907a[_0x463e('0x11')](0x1f4,_0x32fe01['message']));});});}; \ No newline at end of file +var _0x0cd3=['debug','stringify','error','code','message','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x31d598,_0x13feaa){var _0x2d7c10=function(_0x3eaa19){while(--_0x3eaa19){_0x31d598['push'](_0x31d598['shift']());}};_0x2d7c10(++_0x13feaa);}(_0x0cd3,0xff));var _0x30cd=function(_0x48a9a0,_0x393c1e){_0x48a9a0=_0x48a9a0-0x0;var _0x3103c3=_0x0cd3[_0x48a9a0];return _0x3103c3;};'use strict';var _=require('lodash');var util=require(_0x30cd('0x0'));var moment=require(_0x30cd('0x1'));var BPromise=require(_0x30cd('0x2'));var rs=require(_0x30cd('0x3'));var fs=require('fs');var Redis=require(_0x30cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30cd('0x5'))(_0x30cd('0x6'));var config=require(_0x30cd('0x7'));var jayson=require(_0x30cd('0x8'));var client=jayson[_0x30cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c7b01,_0x2cce18,_0x297f3a){return new BPromise(function(_0x521541,_0x14ea2e){return client[_0x30cd('0xa')](_0x1c7b01,_0x297f3a)[_0x30cd('0xb')](function(_0x4e36b1){logger[_0x30cd('0xc')](_0x30cd('0xd'),_0x2cce18,_0x30cd('0xe'));logger[_0x30cd('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2cce18,_0x30cd('0xe'),JSON[_0x30cd('0x10')](_0x4e36b1));if(_0x4e36b1[_0x30cd('0x11')]){if(_0x4e36b1[_0x30cd('0x11')][_0x30cd('0x12')]===0x1f4){logger[_0x30cd('0x11')](_0x30cd('0xd'),_0x2cce18,_0x4e36b1[_0x30cd('0x11')][_0x30cd('0x13')]);return _0x14ea2e(_0x4e36b1[_0x30cd('0x11')]['message']);}logger[_0x30cd('0x11')](_0x30cd('0xd'),_0x2cce18,_0x4e36b1[_0x30cd('0x11')]['message']);return _0x521541(_0x4e36b1[_0x30cd('0x11')][_0x30cd('0x13')]);}else{logger[_0x30cd('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x2cce18,_0x30cd('0xe'));_0x521541(_0x4e36b1['result']['message']);}})['catch'](function(_0x16eb26){logger['error'](_0x30cd('0xd'),_0x2cce18,_0x16eb26);_0x14ea2e(_0x16eb26);});});}exports[_0x30cd('0x14')]=function(_0x2ffa95){var _0x43932c=this;return new Promise(function(_0xde296b,_0x14ca24){return db[_0x30cd('0x15')][_0x30cd('0x16')](_0x2ffa95[_0x30cd('0x17')],{'raw':_0x2ffa95[_0x30cd('0x18')]?_0x2ffa95[_0x30cd('0x18')][_0x30cd('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2b0889){logger[_0x30cd('0xc')](_0x30cd('0x14'),_0x2ffa95);logger[_0x30cd('0xf')](_0x30cd('0x14'),_0x2ffa95,JSON[_0x30cd('0x10')](_0x2b0889));_0xde296b(_0x2b0889);})[_0x30cd('0x1a')](function(_0x5e5584){logger[_0x30cd('0x11')](_0x30cd('0x14'),_0x5e5584[_0x30cd('0x13')],_0x2ffa95);_0x14ca24(_0x43932c[_0x30cd('0x11')](0x1f4,_0x5e5584['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c64aa71..3556021 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 _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x442c90,_0x4bf71f){var _0x642cd2=function(_0x5dffb7){while(--_0x5dffb7){_0x442c90['push'](_0x442c90['shift']());}};_0x642cd2(++_0x4bf71f);}(_0x54ef,0x112));var _0xf54e=function(_0x22235e,_0x5a2d61){_0x22235e=_0x22235e-0x0;var _0x5ded42=_0x54ef[_0x22235e];return _0x5ded42;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0x34e8,0x12c));var _0x834e=function(_0x41ce24,_0xa6f36){_0x41ce24=_0x41ce24-0x0;var _0x3e01cd=_0x34e8[_0x41ce24];return _0x3e01cd;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 26a2737..dc1b41b 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 _0x6953=['calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','path','lodash','bluebird','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','message','catch','findOne','then','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','json','body','userId','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','webbar:unhold','unhold\x20executed!'];(function(_0x3ccaf9,_0xe61c96){var _0x778007=function(_0x1d198f){while(--_0x1d198f){_0x3ccaf9['push'](_0x3ccaf9['shift']());}};_0x778007(++_0xe61c96);}(_0x6953,0x91));var _0x3695=function(_0x1dfbdf,_0x459d58){_0x1dfbdf=_0x1dfbdf-0x0;var _0x2893a6=_0x6953[_0x1dfbdf];return _0x2893a6;};'use strict';var path=require(_0x3695('0x0'));var fs=require('fs');var _=require(_0x3695('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x3695('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3695('0x3')][_0x3695('0x4')]({'port':0x232a});var logger=require(_0x3695('0x5'))('webbarapi');var Redis=require(_0x3695('0x6'));config['redis']=_[_0x3695('0x7')](config[_0x3695('0x8')],{'host':_0x3695('0x9'),'port':0x18eb});var io=require(_0x3695('0xa'))(new Redis(config[_0x3695('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x3695('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x3695('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xe')]},'transferNumber':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]}});function emit(_0x2cdd3,_0x3cb320,_0x367191){logger[_0x3695('0x10')](_0x2cdd3,_0x3cb320,JSON[_0x3695('0x11')](_0x367191));io['to'](_0x2cdd3)['emit'](_0x3cb320,_0x367191);}function handleError(_0x717ee4){return function(_0x5edf8d){console[_0x3695('0x12')](_0x3695('0x13'),_0x5edf8d,_0x5edf8d instanceof RangeError);logger[_0x3695('0x14')](_0x5edf8d[_0x3695('0x15')]);if(_0x5edf8d instanceof RangeError){if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d['name'];}_0x717ee4[_0x3695('0x17')](0x194)[_0x3695('0x18')](_0x5edf8d);}else{if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d[_0x3695('0x16')];}_0x717ee4[_0x3695('0x17')](0x1f4)[_0x3695('0x18')](_0x5edf8d);}};}function checkError(){return function(_0x34b0fc){if(!_0x34b0fc){throw new RangeError(_0x3695('0x19'));}return _0x34b0fc;};}function respondWithRpcPromise(_0x1f267a,_0xbbffe2){return new BPromise(function(_0x1b97d2,_0xf2c747){var _0x459f33=amiClient;return _0x459f33[_0x3695('0x1a')](_0x1f267a,_0xbbffe2)['then'](function(_0x42648c){if(_0x42648c[_0x3695('0x14')]){if(_0x42648c['error']['code']===0x1f4){return _0xf2c747(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}return _0x1b97d2(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}else{_0x1b97d2(_0x42648c['result']);}})[_0x3695('0x1c')](function(_0x48c2fd){_0xf2c747(_0x48c2fd);});});}function getAgent(_0xeddb06){return db['User'][_0x3695('0x1d')]({'where':{'id':_0xeddb06,'role':'agent'}})[_0x3695('0x1e')](checkError());}function getAgentCheckSession(_0x19f834,_0x462ff0){return new BPromise(function(_0x18a474,_0x3d4442){var _0x31fdf3=respondWithRpcPromise('VoiceChannels');var _0x2be6ee=getAgent(_0x19f834);Promise[_0x3695('0x1f')]([_0x31fdf3,_0x2be6ee])['then'](function(_0x392107){var _0x4d0742=_0x392107[0x0];var _0x39c39f=_0x392107[0x1];var _0x399bc6=_[_0x3695('0x20')](_0x4d0742[_0x3695('0x21')],function(_0x30a5ba){return _0x30a5ba[_0x3695('0x22')]==_0x39c39f['id']&&_0x30a5ba[_0x3695('0x23')]==_0x462ff0;});if(_0x399bc6[_0x3695('0x24')]==0x1){_0x18a474(_0x39c39f);}else{_0x3d4442(new RangeError('sessionId\x20'+_0x462ff0+_0x3695('0x25')));}});});}exports[_0x3695('0x26')]=function(_0xe6455e,_0x4c604f){logger['info'](_0x3695('0x27'),_0xe6455e['body']);var _0x12dbce=originateValidation[_0x3695('0x28')](_0xe6455e['body']);if(_0x12dbce[_0x3695('0x24')]>0x0){return _0x4c604f['status'](0x190)[_0x3695('0x29')](_0x12dbce);}var _0x197396=_0xe6455e[_0x3695('0x2a')][_0x3695('0x2b')];var _0x30eab2=_0xe6455e[_0x3695('0x2a')]['callNumber'];var _0x3ab2a0=_0xe6455e[_0x3695('0x2a')]['callerId'];var _0x2e657e=_0xe6455e[_0x3695('0x2a')]['callbackUrl'];return getAgent(_0x197396)['then'](function(_0x4c359d){logger['info'](_0x3695('0x2c'),_0x4c359d[_0x3695('0x16')]);emit(util['format'](_0x3695('0x2d'),_0x4c359d[_0x3695('0x16')]),_0x3695('0x2e'),{'callNumber':_0x30eab2,'callerId':_0x3ab2a0,'callbackUrl':_0x2e657e});return _0x4c604f[_0x3695('0x17')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x3695('0x1c')](handleError(_0x4c604f));};exports[_0x3695('0x2f')]=function(_0x59c271,_0x12ebe9){logger[_0x3695('0x10')](_0x3695('0x30'),_0x59c271[_0x3695('0x2a')]);var _0xaee5e8=hangupValidation[_0x3695('0x28')](_0x59c271[_0x3695('0x2a')]);if(_0xaee5e8[_0x3695('0x24')]>0x0){return _0x12ebe9[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0xaee5e8);}var _0x460b49=_0x59c271[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1d0fa0=_0x59c271[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x460b49)['then'](function(_0x775d39){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x775d39[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x775d39[_0x3695('0x16')]),'webbar:hangup',{'sessionId':_0x1d0fa0});return _0x12ebe9[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x32')});})['catch'](handleError(_0x12ebe9));};exports[_0x3695('0x33')]=function(_0x454e86,_0x3ffc79){logger[_0x3695('0x10')](_0x3695('0x34'),_0x454e86[_0x3695('0x2a')]);var _0x4261d1=answerValidation['validate'](_0x454e86[_0x3695('0x2a')]);if(_0x4261d1['length']>0x0){return _0x3ffc79['status'](0x190)[_0x3695('0x29')](_0x4261d1);}var _0x51f403=_0x454e86[_0x3695('0x2a')][_0x3695('0x2b')];var _0x65f4b3=_0x454e86[_0x3695('0x2a')]['sessionId'];return getAgent(_0x51f403)[_0x3695('0x1e')](function(_0x34cbd8){logger[_0x3695('0x10')]('entityFound:',_0x34cbd8[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x34cbd8[_0x3695('0x16')]),_0x3695('0x35'),{'sessionId':_0x65f4b3});return _0x3ffc79[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x36')});})[_0x3695('0x1c')](handleError(_0x3ffc79));};exports['hold']=function(_0x57bf10,_0x1a021e){logger[_0x3695('0x10')](_0x3695('0x37'),_0x57bf10['body']);var _0x1c8fc3=holdValidation[_0x3695('0x28')](_0x57bf10[_0x3695('0x2a')]);if(_0x1c8fc3['length']>0x0){return _0x1a021e[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x1c8fc3);}var _0x3d6a61=_0x57bf10[_0x3695('0x2a')][_0x3695('0x2b')];var _0x567d5e=_0x57bf10[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x3d6a61)[_0x3695('0x1e')](function(_0x361a9f){logger['info'](_0x3695('0x2c'),_0x361a9f['name']);emit(util['format'](_0x3695('0x2d'),_0x361a9f[_0x3695('0x16')]),_0x3695('0x38'),{'sessionId':_0x567d5e});return _0x1a021e[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1a021e));};exports['unhold']=function(_0x5173b8,_0x5eeaca){logger['info']('unhold\x20fired:',_0x5173b8['body']);var _0x3b1c1c=unholdValidation[_0x3695('0x28')](_0x5173b8['body']);if(_0x3b1c1c[_0x3695('0x24')]>0x0){return _0x5eeaca[_0x3695('0x17')](0x190)['json'](_0x3b1c1c);}var _0x4a0a78=_0x5173b8[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1a61d6=_0x5173b8['body'][_0x3695('0x23')];return getAgent(_0x4a0a78)[_0x3695('0x1e')](function(_0x1422f0){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1422f0[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x1422f0[_0x3695('0x16')]),_0x3695('0x39'),{'sessionId':_0x1a61d6});return _0x5eeaca[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x3a')});})[_0x3695('0x1c')](handleError(_0x5eeaca));};exports[_0x3695('0x3b')]=function(_0x63771a,_0x441997){logger[_0x3695('0x10')](_0x3695('0x3c'),_0x441997[_0x3695('0x2a')]);var _0x42a960=callsValidation[_0x3695('0x28')](_0x63771a[_0x3695('0x2a')]);if(_0x42a960['length']>0x0){return _0x441997['status'](0x190)[_0x3695('0x29')](_0x42a960);}var _0xea6f22=_0x63771a['body'][_0x3695('0x2b')];var _0x43f6f5=respondWithRpcPromise(_0x3695('0x3d'));var _0x357564=getAgent(_0xea6f22);return Promise[_0x3695('0x1f')]([_0x43f6f5,_0x357564])[_0x3695('0x1e')](function(_0x38d20c){var _0x9a8d31=_0x38d20c[0x0];var _0x520fd3=_0x38d20c[0x1];var _0x29c8a3=_['filter'](_0x9a8d31[_0x3695('0x21')],function(_0x3098f7){return _0x3098f7[_0x3695('0x22')]==_0x520fd3['id'];});return _0x441997[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'count':_0x29c8a3['length'],'rows':_0x29c8a3});})[_0x3695('0x1c')](handleError(_0x441997));};exports[_0x3695('0x3e')]=function(_0xf18f60,_0x55f673){logger[_0x3695('0x10')](_0x3695('0x3f'),_0xf18f60['body']);var _0x47cd30=conferenceValidation[_0x3695('0x28')](_0xf18f60['body']);if(_0x47cd30['length']>0x0){return _0x55f673[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x47cd30);}var _0xade517=_0xf18f60[_0x3695('0x2a')][_0x3695('0x2b')];return getAgent(_0xade517)['then'](function(_0x3250f1){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x3250f1['name']);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x3250f1[_0x3695('0x16')]),_0x3695('0x40'));return _0x55f673[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'conference\x20executed!'});})[_0x3695('0x1c')](handleError(_0x55f673));};exports[_0x3695('0x41')]=function(_0x41e8de,_0x2551fd){logger[_0x3695('0x10')]('transfer\x20fired:',_0x41e8de[_0x3695('0x2a')]);var _0x19b3e3=transferValidation[_0x3695('0x28')](_0x41e8de[_0x3695('0x2a')]);if(_0x19b3e3[_0x3695('0x24')]>0x0){return _0x2551fd[_0x3695('0x17')](0x190)['json'](_0x19b3e3);}var _0x1effea=_0x41e8de[_0x3695('0x2a')]['userId'];var _0x4e7d7a=_0x41e8de[_0x3695('0x2a')][_0x3695('0x23')];var _0x1b500b=_0x41e8de['body'][_0x3695('0x42')];return getAgent(_0x1effea)[_0x3695('0x1e')](function(_0x1bd95d){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1bd95d['name']);emit(util[_0x3695('0x31')]('user:%s',_0x1bd95d['name']),'webbar:transfer',{'sessionId':_0x4e7d7a,'transferNumber':_0x1b500b});return _0x2551fd[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x43')});})[_0x3695('0x1c')](handleError(_0x2551fd));}; \ No newline at end of file +var _0x3e5c=['../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','status','send','request','then','error','code','message','result','findOne','agent','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','entityFound:','user:%s','webbar:originate','json','catch','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash'];(function(_0x157902,_0xff4831){var _0x492f2d=function(_0x277599){while(--_0x277599){_0x157902['push'](_0x157902['shift']());}};_0x492f2d(++_0xff4831);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x14e81f,_0x5de33f){_0x14e81f=_0x14e81f-0x0;var _0x4b9ab6=_0x3e5c[_0x14e81f];return _0x4b9ab6;};'use strict';var path=require(_0xc3e5('0x0'));var fs=require('fs');var _=require(_0xc3e5('0x1'));var db=require(_0xc3e5('0x2'))['db'];var config=require(_0xc3e5('0x3'));var util=require('util');var BPromise=require(_0xc3e5('0x4'));var jayson=require(_0xc3e5('0x5'));var amiClient=jayson[_0xc3e5('0x6')][_0xc3e5('0x7')]({'port':0x232a});var logger=require(_0xc3e5('0x8'))(_0xc3e5('0x9'));var Redis=require('ioredis');config[_0xc3e5('0xa')]=_[_0xc3e5('0xb')](config[_0xc3e5('0xa')],{'host':_0xc3e5('0xc'),'port':0x18eb});var io=require(_0xc3e5('0xd'))(new Redis(config['redis']));var Schema=require(_0xc3e5('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'callNumber':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x12')]},'callerId':{'type':_0xc3e5('0x11')},'callbackUrl':{'type':_0xc3e5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':_0xc3e5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x13')]},'transferNumber':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc3e5('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]}});function emit(_0x2cc476,_0x1829f9,_0x43abef){logger['info'](_0x2cc476,_0x1829f9,JSON[_0xc3e5('0x15')](_0x43abef));io['to'](_0x2cc476)[_0xc3e5('0x16')](_0x1829f9,_0x43abef);}function handleError(_0xa7357b){return function(_0xa33d84){console[_0xc3e5('0x17')](_0xc3e5('0x18'),_0xa33d84,_0xa33d84 instanceof RangeError);logger['error'](_0xa33d84[_0xc3e5('0x19')]);if(_0xa33d84 instanceof RangeError){if(_0xa33d84[_0xc3e5('0x1a')]){delete _0xa33d84['name'];}_0xa7357b[_0xc3e5('0x1b')](0x194)['send'](_0xa33d84);}else{if(_0xa33d84[_0xc3e5('0x1a')]){delete _0xa33d84[_0xc3e5('0x1a')];}_0xa7357b[_0xc3e5('0x1b')](0x1f4)[_0xc3e5('0x1c')](_0xa33d84);}};}function checkError(){return function(_0x26d31c){if(!_0x26d31c){throw new RangeError('NotFound');}return _0x26d31c;};}function respondWithRpcPromise(_0x161ee1,_0x3051a5){return new BPromise(function(_0x2d8c6f,_0x3eb513){var _0x414ba9=amiClient;return _0x414ba9[_0xc3e5('0x1d')](_0x161ee1,_0x3051a5)[_0xc3e5('0x1e')](function(_0x47f344){if(_0x47f344[_0xc3e5('0x1f')]){if(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x20')]===0x1f4){return _0x3eb513(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x21')]);}return _0x2d8c6f(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x21')]);}else{_0x2d8c6f(_0x47f344[_0xc3e5('0x22')]);}})['catch'](function(_0x25d3a3){_0x3eb513(_0x25d3a3);});});}function getAgent(_0x4c33d9){return db['User'][_0xc3e5('0x23')]({'where':{'id':_0x4c33d9,'role':_0xc3e5('0x24')}})[_0xc3e5('0x1e')](checkError());}function getAgentCheckSession(_0x59dcff,_0x31f49b){return new BPromise(function(_0x38a961,_0x2d3702){var _0x3ad580=respondWithRpcPromise('VoiceChannels');var _0xa6766d=getAgent(_0x59dcff);Promise['all']([_0x3ad580,_0xa6766d])[_0xc3e5('0x1e')](function(_0xc0e6e7){var _0xc58f2b=_0xc0e6e7[0x0];var _0x5a2d41=_0xc0e6e7[0x1];var _0x5ada1c=_['filter'](_0xc58f2b[_0xc3e5('0x25')],function(_0x45cd9c){return _0x45cd9c[_0xc3e5('0x26')]==_0x5a2d41['id']&&_0x45cd9c[_0xc3e5('0x27')]==_0x31f49b;});if(_0x5ada1c[_0xc3e5('0x28')]==0x1){_0x38a961(_0x5a2d41);}else{_0x2d3702(new RangeError(_0xc3e5('0x29')+_0x31f49b+'\x20not\x20found!'));}});});}exports[_0xc3e5('0x2a')]=function(_0x2ecda2,_0x440617){logger[_0xc3e5('0x2b')](_0xc3e5('0x2c'),_0x2ecda2[_0xc3e5('0x2d')]);var _0x471317=originateValidation[_0xc3e5('0xe')](_0x2ecda2[_0xc3e5('0x2d')]);if(_0x471317[_0xc3e5('0x28')]>0x0){return _0x440617[_0xc3e5('0x1b')](0x190)['json'](_0x471317);}var _0x3d7b87=_0x2ecda2['body'][_0xc3e5('0x2e')];var _0x1b310a=_0x2ecda2[_0xc3e5('0x2d')][_0xc3e5('0x2f')];var _0x5af959=_0x2ecda2[_0xc3e5('0x2d')]['callerId'];var _0x54f79b=_0x2ecda2[_0xc3e5('0x2d')]['callbackUrl'];return getAgent(_0x3d7b87)[_0xc3e5('0x1e')](function(_0x3952dd){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x3952dd[_0xc3e5('0x1a')]);emit(util['format'](_0xc3e5('0x31'),_0x3952dd[_0xc3e5('0x1a')]),_0xc3e5('0x32'),{'callNumber':_0x1b310a,'callerId':_0x5af959,'callbackUrl':_0x54f79b});return _0x440617[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':'originate\x20executed!'});})[_0xc3e5('0x34')](handleError(_0x440617));};exports['hangup']=function(_0x219ca5,_0x29ea43){logger['info'](_0xc3e5('0x35'),_0x219ca5['body']);var _0xd2b224=hangupValidation[_0xc3e5('0xe')](_0x219ca5[_0xc3e5('0x2d')]);if(_0xd2b224['length']>0x0){return _0x29ea43[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0xd2b224);}var _0xc410aa=_0x219ca5[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0x5eb2d2=_0x219ca5['body']['sessionId'];return getAgent(_0xc410aa)[_0xc3e5('0x1e')](function(_0x383ced){logger['info'](_0xc3e5('0x30'),_0x383ced['name']);emit(util[_0xc3e5('0x36')]('user:%s',_0x383ced[_0xc3e5('0x1a')]),'webbar:hangup',{'sessionId':_0x5eb2d2});return _0x29ea43[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x37')});})[_0xc3e5('0x34')](handleError(_0x29ea43));};exports[_0xc3e5('0x38')]=function(_0x260ab4,_0x5dd895){logger['info'](_0xc3e5('0x39'),_0x260ab4['body']);var _0x3f0887=answerValidation[_0xc3e5('0xe')](_0x260ab4[_0xc3e5('0x2d')]);if(_0x3f0887[_0xc3e5('0x28')]>0x0){return _0x5dd895[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x3f0887);}var _0x49b123=_0x260ab4[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0xbbfcad=_0x260ab4[_0xc3e5('0x2d')][_0xc3e5('0x27')];return getAgent(_0x49b123)[_0xc3e5('0x1e')](function(_0x2d98fd){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x2d98fd[_0xc3e5('0x1a')]);emit(util['format']('user:%s',_0x2d98fd['name']),_0xc3e5('0x3a'),{'sessionId':_0xbbfcad});return _0x5dd895['status'](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x3b')});})[_0xc3e5('0x34')](handleError(_0x5dd895));};exports[_0xc3e5('0x3c')]=function(_0x49d5d9,_0x432574){logger[_0xc3e5('0x2b')](_0xc3e5('0x3d'),_0x49d5d9[_0xc3e5('0x2d')]);var _0x55ab15=holdValidation['validate'](_0x49d5d9[_0xc3e5('0x2d')]);if(_0x55ab15[_0xc3e5('0x28')]>0x0){return _0x432574['status'](0x190)[_0xc3e5('0x33')](_0x55ab15);}var _0x4c9b0b=_0x49d5d9[_0xc3e5('0x2d')]['userId'];var _0x17e12f=_0x49d5d9['body']['sessionId'];return getAgent(_0x4c9b0b)['then'](function(_0x87855d){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x87855d['name']);emit(util['format'](_0xc3e5('0x31'),_0x87855d['name']),_0xc3e5('0x3e'),{'sessionId':_0x17e12f});return _0x432574[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x3f')});})[_0xc3e5('0x34')](handleError(_0x432574));};exports[_0xc3e5('0x40')]=function(_0x5cd31c,_0x27924f){logger['info']('unhold\x20fired:',_0x5cd31c[_0xc3e5('0x2d')]);var _0x5c7fc8=unholdValidation[_0xc3e5('0xe')](_0x5cd31c['body']);if(_0x5c7fc8['length']>0x0){return _0x27924f[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x5c7fc8);}var _0x525e5a=_0x5cd31c['body'][_0xc3e5('0x2e')];var _0x38e722=_0x5cd31c['body'][_0xc3e5('0x27')];return getAgent(_0x525e5a)[_0xc3e5('0x1e')](function(_0xbae80a){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0xbae80a[_0xc3e5('0x1a')]);emit(util[_0xc3e5('0x36')]('user:%s',_0xbae80a[_0xc3e5('0x1a')]),_0xc3e5('0x41'),{'sessionId':_0x38e722});return _0x27924f['status'](0xc8)['json']({'error':![],'message':_0xc3e5('0x42')});})[_0xc3e5('0x34')](handleError(_0x27924f));};exports['calls']=function(_0x50f6b7,_0x566ed0){logger['info'](_0xc3e5('0x43'),_0x566ed0[_0xc3e5('0x2d')]);var _0x474891=callsValidation[_0xc3e5('0xe')](_0x50f6b7[_0xc3e5('0x2d')]);if(_0x474891['length']>0x0){return _0x566ed0[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x474891);}var _0x2d62b7=_0x50f6b7['body'][_0xc3e5('0x2e')];var _0x4079ef=respondWithRpcPromise(_0xc3e5('0x44'));var _0x1f32ee=getAgent(_0x2d62b7);return Promise[_0xc3e5('0x45')]([_0x4079ef,_0x1f32ee])['then'](function(_0x52be13){var _0x2a4396=_0x52be13[0x0];var _0x2efe19=_0x52be13[0x1];var _0x5c0f97=_[_0xc3e5('0x46')](_0x2a4396[_0xc3e5('0x25')],function(_0x5c8060){return _0x5c8060[_0xc3e5('0x26')]==_0x2efe19['id'];});return _0x566ed0[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'count':_0x5c0f97[_0xc3e5('0x28')],'rows':_0x5c0f97});})[_0xc3e5('0x34')](handleError(_0x566ed0));};exports[_0xc3e5('0x47')]=function(_0x1fe284,_0xb132b4){logger['info'](_0xc3e5('0x48'),_0x1fe284[_0xc3e5('0x2d')]);var _0x3db9ac=conferenceValidation['validate'](_0x1fe284['body']);if(_0x3db9ac[_0xc3e5('0x28')]>0x0){return _0xb132b4[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x3db9ac);}var _0x27157c=_0x1fe284[_0xc3e5('0x2d')][_0xc3e5('0x2e')];return getAgent(_0x27157c)['then'](function(_0x3876a5){logger['info'](_0xc3e5('0x30'),_0x3876a5[_0xc3e5('0x1a')]);emit(util[_0xc3e5('0x36')](_0xc3e5('0x31'),_0x3876a5[_0xc3e5('0x1a')]),_0xc3e5('0x49'));return _0xb132b4[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x4a')});})[_0xc3e5('0x34')](handleError(_0xb132b4));};exports['transfer']=function(_0x5ee3f6,_0x281415){logger[_0xc3e5('0x2b')](_0xc3e5('0x4b'),_0x5ee3f6[_0xc3e5('0x2d')]);var _0x198e90=transferValidation[_0xc3e5('0xe')](_0x5ee3f6[_0xc3e5('0x2d')]);if(_0x198e90[_0xc3e5('0x28')]>0x0){return _0x281415[_0xc3e5('0x1b')](0x190)['json'](_0x198e90);}var _0x5f2a1f=_0x5ee3f6[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0x44bf4f=_0x5ee3f6[_0xc3e5('0x2d')]['sessionId'];var _0x2d184a=_0x5ee3f6[_0xc3e5('0x2d')]['transferNumber'];return getAgent(_0x5f2a1f)[_0xc3e5('0x1e')](function(_0x447bdc){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x447bdc['name']);emit(util[_0xc3e5('0x36')](_0xc3e5('0x31'),_0x447bdc['name']),_0xc3e5('0x4c'),{'sessionId':_0x44bf4f,'transferNumber':_0x2d184a});return _0x281415[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x4d')});})[_0xc3e5('0x34')](handleError(_0x281415));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d91fd95..0886910 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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x5a516a,_0x541200){var _0x38c0d9=function(_0x4d2d8f){while(--_0x4d2d8f){_0x5a516a['push'](_0x5a516a['shift']());}};_0x38c0d9(++_0x541200);}(_0x430c,0x1a1));var _0xc430=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x430c[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x93e9=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x93e9,0xcc));var _0x993e=function(_0x1e2625,_0x5b03d4){_0x1e2625=_0x1e2625-0x0;var _0x1687fd=_0x93e9[_0x1e2625];return _0x1687fd;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getDispositions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x993e('0x9')]('/:id/users',auth[_0x993e('0xa')](),controller['getAgents']);router['get'](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x13')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x13')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x16')]);router[_0x993e('0x13')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller['addAgents']);router[_0x993e('0x13')](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x18')]);router[_0x993e('0x13')](_0x993e('0x19'),controller['notify']);router[_0x993e('0x13')](_0x993e('0x1a'),auth[_0x993e('0xa')](),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0x1d')]);router['delete'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x1e')]);router[_0x993e('0x1f')](_0x993e('0xf'),auth['isAuthenticated'](),controller[_0x993e('0x20')]);router[_0x993e('0x1f')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x21')]);router[_0x993e('0x1f')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller[_0x993e('0x22')]);module[_0x993e('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7eac557..f1b5903 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 _0xea8d=['mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xea8d,0x71));var _0xdea8=function(_0x41a782,_0x127c91){_0x41a782=_0x41a782-0x0;var _0x49e3f8=_0xea8d[_0x41a782];return _0x49e3f8;};'use strict';var Sequelize=require(_0xdea8('0x0'));var rs=require(_0xdea8('0x1'));module['exports']={'name':{'type':Sequelize[_0xdea8('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdea8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xdea8('0x2')],'defaultValue':function(){return rs[_0xdea8('0x3')]();}},'phone':{'type':Sequelize[_0xdea8('0x2')]},'type':{'type':Sequelize[_0xdea8('0x4')]('twilio',_0xdea8('0x5'))},'accountSid':{'type':Sequelize[_0xdea8('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdea8('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdea8('0x6');}},'notificationSound':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdea8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdea8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdea8('0x8')],'comment':_0xdea8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xdea8('0x7')],'defaultValue':![],'comment':_0xdea8('0xa'),'set':function(_0x1b85ac){if(!_0x1b85ac){this[_0xdea8('0xb')](_0xdea8('0xc'),null);}this[_0xdea8('0xb')](_0xdea8('0xd'),_0x1b85ac);}},'description':{'type':Sequelize[_0xdea8('0x2')]}}; \ No newline at end of file +var _0x16b6=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5fdf3d,_0x784e59){var _0x1d607c=function(_0x87f733){while(--_0x87f733){_0x5fdf3d['push'](_0x5fdf3d['shift']());}};_0x1d607c(++_0x784e59);}(_0x16b6,0x182));var _0x616b=function(_0x408934,_0x3048a){_0x408934=_0x408934-0x0;var _0x458ddf=_0x16b6[_0x408934];return _0x458ddf;};'use strict';var Sequelize=require(_0x616b('0x0'));var rs=require(_0x616b('0x1'));module['exports']={'name':{'type':Sequelize[_0x616b('0x2')],'unique':_0x616b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x616b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x616b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x616b('0x2')],'defaultValue':function(){return rs[_0x616b('0x4')]();}},'phone':{'type':Sequelize[_0x616b('0x2')]},'type':{'type':Sequelize[_0x616b('0x5')](_0x616b('0x6'),_0x616b('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x616b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x616b('0x8')],'defaultValue':function(){return _0x616b('0x9');}},'notificationSound':{'type':Sequelize[_0x616b('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x616b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x616b('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x616b('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x616b('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x616b('0xc'),'set':function(_0x29f3e9){if(!_0x29f3e9){this[_0x616b('0xd')](_0x616b('0xe'),null);}this['setDataValue'](_0x616b('0xf'),_0x29f3e9);}},'description':{'type':Sequelize[_0x616b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 74f9d00..12769f2 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 _0xd0fb=['get','WhatsappAccounts','name','index','Pause','map','WhatsappAccount','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','WhatsappAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','send','json','getApplications','notify','whatsapp','Applications','account','statuses','WhatsappMessage','message_id','applications','orderBy','priority','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','replace','Body','messageId','notifications','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','DESC','List','defaults','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','count','set','apply','reject','save','destroy'];(function(_0x546a54,_0x45462e){var _0x3e71f3=function(_0x5517e6){while(--_0x5517e6){_0x546a54['push'](_0x546a54['shift']());}};_0x3e71f3(++_0x45462e);}(_0xd0fb,0x8a));var _0xbd0f=function(_0x618b7,_0x3c05b2){_0x618b7=_0x618b7-0x0;var _0x2992e8=_0xd0fb[_0x618b7];return _0x2992e8;};'use strict';var emlformat=require(_0xbd0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbd0f('0x2'));var BPromise=require(_0xbd0f('0x3'));var Mustache=require(_0xbd0f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbd0f('0x5'));var csv=require('to-csv');var ejs=require(_0xbd0f('0x6'));var fs=require('fs');var fs_extra=require(_0xbd0f('0x7'));var _=require(_0xbd0f('0x8'));var squel=require(_0xbd0f('0x9'));var crypto=require(_0xbd0f('0xa'));var jsforce=require(_0xbd0f('0xb'));var deskjs=require(_0xbd0f('0xc'));var toCsv=require(_0xbd0f('0xd'));var querystring=require('querystring');var Papa=require(_0xbd0f('0xe'));var Redis=require(_0xbd0f('0xf'));var authService=require(_0xbd0f('0x10'));var qs=require(_0xbd0f('0x11'));var as=require(_0xbd0f('0x12'));var hardwareService=require(_0xbd0f('0x13'));var logger=require(_0xbd0f('0x14'))('api');var utils=require(_0xbd0f('0x15'));var config=require(_0xbd0f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd0f('0x17'))['db'];config[_0xbd0f('0x18')]=_['defaults'](config['redis'],{'host':_0xbd0f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xbd0f('0x1a')](socket);var jayson=require(_0xbd0f('0x1b'));var client=jayson['client'][_0xbd0f('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x275ea3,_0x3e949b,_0x466c79,_0x34c8df){return new BPromise(function(_0x3e48ba,_0x2f1a8a){var _0x511541=_0x34c8df||client;return _0x511541['request'](_0x275ea3,_0x466c79)[_0xbd0f('0x1d')](function(_0x1374e2){logger[_0xbd0f('0x1e')](_0xbd0f('0x1f'),_0x3e949b,_0xbd0f('0x20'));logger[_0xbd0f('0x21')](_0xbd0f('0x22'),_0x3e949b,_0xbd0f('0x20'),JSON[_0xbd0f('0x23')](_0x1374e2));if(_0x1374e2[_0xbd0f('0x24')]){if(_0x1374e2['error'][_0xbd0f('0x25')]===0x1f4){logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);return _0x2f1a8a(_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);}logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x1374e2['error'][_0xbd0f('0x26')]);return _0x3e48ba(_0x1374e2[_0xbd0f('0x24')][_0xbd0f('0x26')]);}else{logger[_0xbd0f('0x1e')](_0xbd0f('0x1f'),_0x3e949b,_0xbd0f('0x20'));_0x3e48ba(_0x1374e2[_0xbd0f('0x27')][_0xbd0f('0x26')]);}})['catch'](function(_0x10c9fb){logger[_0xbd0f('0x24')](_0xbd0f('0x1f'),_0x3e949b,_0x10c9fb);_0x2f1a8a(_0x10c9fb);});});}function respondWithStatusCode(_0x2975da,_0x120f8c){_0x120f8c=_0x120f8c||0xcc;return function(_0x46051d){if(_0x46051d){return _0x2975da[_0xbd0f('0x28')](_0x120f8c);}return _0x2975da[_0xbd0f('0x29')](_0x120f8c)[_0xbd0f('0x2a')]();};}function respondWithResult(_0x1cc0a2,_0xa6a1fe){_0xa6a1fe=_0xa6a1fe||0xc8;return function(_0x17dacb){if(_0x17dacb){return _0x1cc0a2[_0xbd0f('0x29')](_0xa6a1fe)['json'](_0x17dacb);}};}function respondWithFilteredResult(_0x41eaaf,_0x5bd41f){return function(_0x123fd2){if(_0x123fd2){var _0x434311=typeof _0x5bd41f[_0xbd0f('0x2b')]==='undefined'&&typeof _0x5bd41f[_0xbd0f('0x2c')]==='undefined';var _0x11f439=_0x123fd2[_0xbd0f('0x2d')];var _0x44276e=_0x434311?0x0:_0x5bd41f['offset'];var _0x3cb2d5=_0x434311?_0x123fd2['count']:_0x5bd41f[_0xbd0f('0x2b')]+_0x5bd41f[_0xbd0f('0x2c')];var _0xde58e5;if(_0x3cb2d5>=_0x11f439){_0x3cb2d5=_0x11f439;_0xde58e5=0xc8;}else{_0xde58e5=0xce;}_0x41eaaf[_0xbd0f('0x29')](_0xde58e5);return _0x41eaaf[_0xbd0f('0x2e')]('Content-Range',_0x44276e+'-'+_0x3cb2d5+'/'+_0x11f439)['json'](_0x123fd2);}return null;};}function patchUpdates(_0x462169){return function(_0x56aa4d){try{jsonpatch[_0xbd0f('0x2f')](_0x56aa4d,_0x462169,!![]);}catch(_0x1efe8d){return BPromise[_0xbd0f('0x30')](_0x1efe8d);}return _0x56aa4d[_0xbd0f('0x31')]();};}function saveUpdates(_0x131f35,_0x1870e7){return function(_0xeaa28e){if(_0xeaa28e){return _0xeaa28e['update'](_0x131f35)[_0xbd0f('0x1d')](function(_0x2f5856){return _0x2f5856;});}return null;};}function removeEntity(_0x5df05c,_0x450580){return function(_0x23ff8c){if(_0x23ff8c){return _0x23ff8c[_0xbd0f('0x32')]()[_0xbd0f('0x1d')](function(){var _0x71b177=_0x23ff8c[_0xbd0f('0x33')]({'plain':!![]});var _0x1d3de4=_0xbd0f('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d3de4,'resourceId':_0x71b177['id']}})[_0xbd0f('0x1d')](function(){return _0x23ff8c;});})[_0xbd0f('0x1d')](function(){_0x5df05c[_0xbd0f('0x29')](0xcc)[_0xbd0f('0x2a')]();});}};}function handleEntityNotFound(_0x39f4b6,_0x336cde){return function(_0x2833b6){if(!_0x2833b6){_0x39f4b6['sendStatus'](0x194);}return _0x2833b6;};}function handleError(_0x409afe,_0x379ac9){_0x379ac9=_0x379ac9||0x1f4;return function(_0x37cc9c){logger[_0xbd0f('0x24')](_0x37cc9c['stack']);if(_0x37cc9c['name']){delete _0x37cc9c[_0xbd0f('0x35')];}_0x409afe[_0xbd0f('0x29')](_0x379ac9)['send'](_0x37cc9c);};}exports[_0xbd0f('0x36')]=function(_0x68cf3d,_0x48caae){var _0x208448={'include':[{'model':db[_0xbd0f('0x37')],'as':'mandatoryDispositionPause'}]},_0x4dbfd7={},_0x401846={'count':0x0,'rows':[]};var _0x3619f2=_[_0xbd0f('0x38')](db[_0xbd0f('0x39')][_0xbd0f('0x3a')],function(_0x12ea4c){return{'name':_0x12ea4c['fieldName'],'type':_0x12ea4c[_0xbd0f('0x3b')]['key']};});_0x4dbfd7['model']=_['map'](_0x3619f2,_0xbd0f('0x35'));_0x4dbfd7[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x68cf3d['query']);_0x4dbfd7['filters']=_[_0xbd0f('0x3e')](_0x4dbfd7[_0xbd0f('0x3f')],_0x4dbfd7[_0xbd0f('0x3c')]);_0x208448[_0xbd0f('0x40')]=_['intersection'](_0x4dbfd7[_0xbd0f('0x3f')],qs[_0xbd0f('0x41')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x208448[_0xbd0f('0x40')]=_0x208448[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x208448[_0xbd0f('0x40')]:_0x4dbfd7[_0xbd0f('0x3f')];if(!_0x68cf3d[_0xbd0f('0x3c')]['hasOwnProperty']('nolimit')){_0x208448[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x208448[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x2b')]);}_0x208448[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x208448[_0xbd0f('0x45')]=qs['filters'](_[_0xbd0f('0x46')](_0x68cf3d[_0xbd0f('0x3c')],_0x4dbfd7[_0xbd0f('0x47')]),_0x3619f2);if(_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x208448[_0xbd0f('0x45')]=_['merge'](_0x208448[_0xbd0f('0x45')],{'$or':_[_0xbd0f('0x38')](_0x3619f2,function(_0x110c06){if(_0x110c06[_0xbd0f('0x3b')]!=='VIRTUAL'){var _0xc7bb83={};_0xc7bb83[_0x110c06[_0xbd0f('0x35')]]={'$like':'%'+_0x68cf3d[_0xbd0f('0x3c')][_0xbd0f('0x48')]+'%'};return _0xc7bb83;}})});}_0x208448=_[_0xbd0f('0x49')]({},_0x208448,_0x68cf3d[_0xbd0f('0x4a')]);var _0x83e104={'where':_0x208448[_0xbd0f('0x45')]};return db[_0xbd0f('0x39')][_0xbd0f('0x2d')](_0x83e104)[_0xbd0f('0x1d')](function(_0x73d63b){_0x401846['count']=_0x73d63b;if(_0x68cf3d[_0xbd0f('0x3c')]['includeAll']){_0x208448[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x39')][_0xbd0f('0x4c')](_0x208448);})['then'](function(_0x1f37e1){_0x401846[_0xbd0f('0x4d')]=_0x1f37e1;return _0x401846;})[_0xbd0f('0x1d')](respondWithFilteredResult(_0x48caae,_0x208448))[_0xbd0f('0x4e')](handleError(_0x48caae,null));};exports[_0xbd0f('0x4f')]=function(_0x3260d6,_0x18ae6e){var _0x470544={'raw':![],'where':{'id':_0x3260d6[_0xbd0f('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xbd0f('0x51')}]},_0x4c5cfb={};_0x4c5cfb[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x39')][_0xbd0f('0x3a')]);_0x4c5cfb['query']=_[_0xbd0f('0x3d')](_0x3260d6[_0xbd0f('0x3c')]);_0x4c5cfb[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x4c5cfb[_0xbd0f('0x3f')],_0x4c5cfb[_0xbd0f('0x3c')]);_0x470544[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x4c5cfb['model'],qs['fields'](_0x3260d6[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x470544[_0xbd0f('0x40')]=_0x470544[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x470544[_0xbd0f('0x40')]:_0x4c5cfb[_0xbd0f('0x3f')];if(_0x3260d6[_0xbd0f('0x3c')][_0xbd0f('0x52')]){_0x470544[_0xbd0f('0x4b')]=[{'all':!![]}];}_0x470544=_[_0xbd0f('0x49')]({},_0x470544,_0x3260d6[_0xbd0f('0x4a')]);return db['WhatsappAccount']['find'](_0x470544)[_0xbd0f('0x1d')](handleEntityNotFound(_0x18ae6e,null))[_0xbd0f('0x1d')](respondWithResult(_0x18ae6e,null))[_0xbd0f('0x4e')](handleError(_0x18ae6e,null));};exports['create']=function(_0x107089,_0x58b22b){return db['WhatsappAccount'][_0xbd0f('0x53')](_0x107089[_0xbd0f('0x54')],{})[_0xbd0f('0x1d')](function(_0x11d53e){var _0x3a9aee=_0x107089[_0xbd0f('0x55')][_0xbd0f('0x33')]({'plain':!![]});if(!_0x3a9aee)throw new Error(_0xbd0f('0x56'));if(_0x3a9aee[_0xbd0f('0x57')]===_0xbd0f('0x55')){var _0x2f0faa=_0x11d53e[_0xbd0f('0x33')]({'plain':!![]});var _0x244d07='WhatsappAccounts';return db[_0xbd0f('0x58')]['find']({'where':{'name':_0x244d07,'userProfileId':_0x3a9aee[_0xbd0f('0x59')]},'raw':!![]})[_0xbd0f('0x1d')](function(_0x1e2ac7){if(_0x1e2ac7&&_0x1e2ac7[_0xbd0f('0x5a')]===0x0){return db[_0xbd0f('0x5b')][_0xbd0f('0x53')]({'name':_0x2f0faa['name'],'resourceId':_0x2f0faa['id'],'type':_0x1e2ac7[_0xbd0f('0x35')],'sectionId':_0x1e2ac7['id']},{})[_0xbd0f('0x1d')](function(){return _0x11d53e;});}else{return _0x11d53e;}})['catch'](function(_0x5f3364){logger[_0xbd0f('0x24')](_0xbd0f('0x5c'),_0x5f3364);throw _0x5f3364;});}return _0x11d53e;})['then'](respondWithResult(_0x58b22b,0xc9))['catch'](handleError(_0x58b22b,null));};exports[_0xbd0f('0x5d')]=function(_0x526fc3,_0x4a94af){if(_0x526fc3[_0xbd0f('0x54')]['id']){delete _0x526fc3[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')]['find']({'where':{'id':_0x526fc3[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x37')],'as':_0xbd0f('0x51')}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x4a94af,null))[_0xbd0f('0x1d')](saveUpdates(_0x526fc3[_0xbd0f('0x54')],null))['then'](respondWithResult(_0x4a94af,null))[_0xbd0f('0x4e')](handleError(_0x4a94af,null));};exports['destroy']=function(_0x3a90d2,_0xd45fe5){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x3a90d2[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0xd45fe5,null))[_0xbd0f('0x1d')](removeEntity(_0xd45fe5,null))[_0xbd0f('0x4e')](handleError(_0xd45fe5,null));};exports['describe']=function(_0x2a0439,_0x20a0fd){return db[_0xbd0f('0x39')][_0xbd0f('0x5f')]()[_0xbd0f('0x1d')](respondWithResult(_0x20a0fd,null))[_0xbd0f('0x4e')](handleError(_0x20a0fd,null));};exports[_0xbd0f('0x60')]=function(_0x43cdfe,_0x3edc89,_0x492570){if(_0x43cdfe[_0xbd0f('0x54')]['id']){delete _0x43cdfe[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')]['find']({'where':{'id':_0x43cdfe[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x3edc89,null))[_0xbd0f('0x1d')](function(_0x23924b){if(_0x23924b){_0x43cdfe[_0xbd0f('0x54')]['WhatsappAccountId']=_0x23924b['id'];return db[_0xbd0f('0x61')][_0xbd0f('0x53')](_0x43cdfe[_0xbd0f('0x54')]);}})['then'](respondWithResult(_0x3edc89,null))[_0xbd0f('0x4e')](handleError(_0x3edc89,null));};exports[_0xbd0f('0x62')]=function(_0x5a8ba5,_0x2a14bb,_0x32bc16){var _0x7bda0d={'raw':![],'where':{}};var _0x3d31c1={};var _0x4d3cdd={'count':0x0,'rows':[]};return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x5a8ba5[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x2a14bb,null))[_0xbd0f('0x1d')](function(_0x4fac83){if(_0x4fac83){_0x3d31c1[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x61')][_0xbd0f('0x3a')]);_0x3d31c1[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x5a8ba5[_0xbd0f('0x3c')]);_0x3d31c1[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x3d31c1['model'],_0x3d31c1[_0xbd0f('0x3c')]);_0x7bda0d[_0xbd0f('0x40')]=_['intersection'](_0x3d31c1[_0xbd0f('0x3f')],qs['fields'](_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x7bda0d['attributes']=_0x7bda0d[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x7bda0d[_0xbd0f('0x40')]:_0x3d31c1[_0xbd0f('0x3f')];if(!_0x5a8ba5['query'][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x7bda0d[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x5a8ba5['query']['limit']);_0x7bda0d[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x5a8ba5[_0xbd0f('0x3c')]['offset']);}_0x7bda0d[_0xbd0f('0x43')]=qs['sort'](_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x7bda0d[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x5a8ba5[_0xbd0f('0x3c')],_0x3d31c1[_0xbd0f('0x47')]));_0x7bda0d[_0xbd0f('0x45')][_0xbd0f('0x66')]=_0x4fac83['id'];if(_0x5a8ba5['query'][_0xbd0f('0x48')]){_0x7bda0d[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x7bda0d['where'],{'$or':_[_0xbd0f('0x38')](_0x7bda0d['attributes'],function(_0x250105){var _0x367176={};_0x367176[_0x250105]={'$like':'%'+_0x5a8ba5['query'][_0xbd0f('0x48')]+'%'};return _0x367176;})});}_0x7bda0d=_['merge']({},_0x7bda0d,_0x5a8ba5['options']);return db[_0xbd0f('0x61')][_0xbd0f('0x2d')]({'where':_0x7bda0d[_0xbd0f('0x45')]})['then'](function(_0x723883){_0x4d3cdd[_0xbd0f('0x2d')]=_0x723883;if(_0x5a8ba5[_0xbd0f('0x3c')][_0xbd0f('0x52')]){_0x7bda0d[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x61')][_0xbd0f('0x4c')](_0x7bda0d);})[_0xbd0f('0x1d')](function(_0x2b7a06){_0x4d3cdd[_0xbd0f('0x4d')]=_0x2b7a06;return _0x4d3cdd;});}})['then'](respondWithFilteredResult(_0x2a14bb,_0x7bda0d))[_0xbd0f('0x4e')](handleError(_0x2a14bb,null));};exports[_0xbd0f('0x67')]=function(_0xf8f8fb,_0x3adac6,_0x509fdd){return db['WhatsappAccount'][_0xbd0f('0x5e')]({'where':{'id':_0xf8f8fb[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x3adac6,null))[_0xbd0f('0x1d')](function(_0x6106de){if(_0x6106de){return _0x6106de[_0xbd0f('0x67')](_0xf8f8fb[_0xbd0f('0x3c')][_0xbd0f('0x68')]);}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x3adac6,null))[_0xbd0f('0x4e')](handleError(_0x3adac6,null));};exports['addAnswer']=function(_0x58d4ff,_0x233dc8,_0x92009b){if(_0x58d4ff[_0xbd0f('0x54')]['id']){delete _0x58d4ff[_0xbd0f('0x54')]['id'];}return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x58d4ff[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x233dc8,null))[_0xbd0f('0x1d')](function(_0x110f23){if(_0x110f23){_0x58d4ff[_0xbd0f('0x54')]['WhatsappAccountId']=_0x110f23['id'];return db[_0xbd0f('0x69')]['create'](_0x58d4ff['body']);}})['then'](respondWithResult(_0x233dc8,null))[_0xbd0f('0x4e')](handleError(_0x233dc8,null));};exports[_0xbd0f('0x6a')]=function(_0x31c17f,_0x5851e6,_0x484081){var _0x25fc8e={'raw':![],'where':{}};var _0x3fa253={};var _0x50df3d={'count':0x0,'rows':[]};return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x31c17f['params']['id']}})['then'](handleEntityNotFound(_0x5851e6,null))[_0xbd0f('0x1d')](function(_0x3bfe70){if(_0x3bfe70){_0x3fa253['model']=_[_0xbd0f('0x3d')](db[_0xbd0f('0x69')][_0xbd0f('0x3a')]);_0x3fa253[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x31c17f['query']);_0x3fa253['filters']=_[_0xbd0f('0x3e')](_0x3fa253[_0xbd0f('0x3f')],_0x3fa253['query']);_0x25fc8e['attributes']=_['intersection'](_0x3fa253[_0xbd0f('0x3f')],qs[_0xbd0f('0x41')](_0x31c17f[_0xbd0f('0x3c')]['fields']));_0x25fc8e[_0xbd0f('0x40')]=_0x25fc8e['attributes'][_0xbd0f('0x42')]?_0x25fc8e[_0xbd0f('0x40')]:_0x3fa253[_0xbd0f('0x3f')];if(!_0x31c17f[_0xbd0f('0x3c')]['hasOwnProperty'](_0xbd0f('0x65'))){_0x25fc8e['limit']=qs['limit'](_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x25fc8e[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x31c17f['query'][_0xbd0f('0x2b')]);}_0x25fc8e[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x25fc8e[_0xbd0f('0x45')]=qs['filters'](_['pick'](_0x31c17f[_0xbd0f('0x3c')],_0x3fa253['filters']));_0x25fc8e['where'][_0xbd0f('0x66')]=_0x3bfe70['id'];if(_0x31c17f[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x25fc8e[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x25fc8e[_0xbd0f('0x45')],{'$or':_[_0xbd0f('0x38')](_0x25fc8e['attributes'],function(_0x10ba26){var _0xbb9904={};_0xbb9904[_0x10ba26]={'$like':'%'+_0x31c17f['query'][_0xbd0f('0x48')]+'%'};return _0xbb9904;})});}_0x25fc8e=_[_0xbd0f('0x49')]({},_0x25fc8e,_0x31c17f['options']);return db[_0xbd0f('0x69')]['count']({'where':_0x25fc8e[_0xbd0f('0x45')]})['then'](function(_0x40879d){_0x50df3d[_0xbd0f('0x2d')]=_0x40879d;if(_0x31c17f[_0xbd0f('0x3c')]['includeAll']){_0x25fc8e[_0xbd0f('0x4b')]=[{'all':!![]}];}return db[_0xbd0f('0x69')][_0xbd0f('0x4c')](_0x25fc8e);})[_0xbd0f('0x1d')](function(_0x3ba464){_0x50df3d[_0xbd0f('0x4d')]=_0x3ba464;return _0x50df3d;});}})[_0xbd0f('0x1d')](respondWithFilteredResult(_0x5851e6,_0x25fc8e))[_0xbd0f('0x4e')](handleError(_0x5851e6,null));};exports[_0xbd0f('0x6b')]=function(_0x228507,_0x1f224a,_0x262f69){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x228507[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f224a,null))[_0xbd0f('0x1d')](function(_0x3c1d3d){if(_0x3c1d3d){return _0x3c1d3d['removeAnswers'](_0x228507['query']['ids']);}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x1f224a,null))[_0xbd0f('0x4e')](handleError(_0x1f224a,null));};exports[_0xbd0f('0x6c')]=function(_0x25efba,_0x5252d3,_0x3bcbf7){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x25efba[_0xbd0f('0x50')]['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x5252d3,null))[_0xbd0f('0x1d')](function(_0x1dbad6){if(_0x1dbad6){return _0x1dbad6[_0xbd0f('0x6c')](_0x25efba[_0xbd0f('0x54')]['ids'],_[_0xbd0f('0x6d')](_0x25efba['body'],[_0xbd0f('0x68'),'id'])||{})[_0xbd0f('0x6e')](function(_0x1d4f71){for(var _0x371a67=0x0;_0x371a67<_0x25efba[_0xbd0f('0x54')][_0xbd0f('0x68')][_0xbd0f('0x42')];_0x371a67+=0x1){socket[_0xbd0f('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x25efba[_0xbd0f('0x54')][_0xbd0f('0x68')][_0x371a67]),'WhatsappAccountId':Number(_0x25efba[_0xbd0f('0x50')]['id'])});}return _0x1d4f71;});}})[_0xbd0f('0x1d')](respondWithResult(_0x5252d3,null))[_0xbd0f('0x4e')](handleError(_0x5252d3,null));};exports['removeAgents']=function(_0x48bb25,_0x356409,_0x43b2fb){return db[_0xbd0f('0x39')][_0xbd0f('0x5e')]({'where':{'id':_0x48bb25[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x356409,null))['then'](function(_0x50a35a){if(_0x50a35a){return _0x50a35a['removeAgents'](_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')])['then'](function(){if(_['isArray'](_0x48bb25['query'][_0xbd0f('0x68')])){for(var _0x40718b=0x0;_0x40718b<_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')]['length'];_0x40718b+=0x1){socket['emit'](_0xbd0f('0x70'),{'UserId':Number(_0x48bb25[_0xbd0f('0x3c')][_0xbd0f('0x68')][_0x40718b]),'WhatsappAccountId':Number(_0x48bb25['params']['id'])});}}else{socket[_0xbd0f('0x6f')](_0xbd0f('0x70'),{'UserId':Number(_0x48bb25['query'][_0xbd0f('0x68')]),'WhatsappAccountId':Number(_0x48bb25[_0xbd0f('0x50')]['id'])});}});}})[_0xbd0f('0x1d')](respondWithStatusCode(_0x356409,null))[_0xbd0f('0x4e')](handleError(_0x356409,null));};exports[_0xbd0f('0x71')]=function(_0x13a58c,_0xb425c5,_0x3840ed){var _0x10bd7={};var _0x2dc4cc={};var _0x3cb23d;var _0x58a008;return db[_0xbd0f('0x39')][_0xbd0f('0x63')]({'where':{'id':_0x13a58c['params']['id']}})[_0xbd0f('0x1d')](handleEntityNotFound(_0xb425c5,null))['then'](function(_0x3c85f8){if(_0x3c85f8){_0x3cb23d=_0x3c85f8;_0x2dc4cc[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x72')][_0xbd0f('0x3a')]);_0x2dc4cc[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x13a58c[_0xbd0f('0x3c')]);_0x2dc4cc['filters']=_['intersection'](_0x2dc4cc[_0xbd0f('0x3f')],_0x2dc4cc['query']);_0x10bd7[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x2dc4cc[_0xbd0f('0x3f')],qs['fields'](_0x13a58c[_0xbd0f('0x3c')]['fields']));_0x10bd7[_0xbd0f('0x40')]=_0x10bd7[_0xbd0f('0x40')][_0xbd0f('0x42')]?_0x10bd7['attributes']:_0x2dc4cc[_0xbd0f('0x3f')];_0x10bd7[_0xbd0f('0x43')]=qs['sort'](_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x10bd7[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x13a58c['query'],_0x2dc4cc[_0xbd0f('0x47')]));if(_0x13a58c['query']['filter']){_0x10bd7[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x10bd7[_0xbd0f('0x45')],{'$or':_['map'](_0x10bd7[_0xbd0f('0x40')],function(_0x55f2f6){var _0x2f1936={};_0x2f1936[_0x55f2f6]={'$like':'%'+_0x13a58c[_0xbd0f('0x3c')]['filter']+'%'};return _0x2f1936;})});}_0x10bd7=_['merge']({},_0x10bd7,_0x13a58c[_0xbd0f('0x4a')]);return _0x3cb23d[_0xbd0f('0x71')](_0x10bd7);}})[_0xbd0f('0x1d')](function(_0x2a6a69){if(_0x2a6a69){_0x58a008=_0x2a6a69[_0xbd0f('0x42')];if(!_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x10bd7[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x13a58c[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x10bd7[_0xbd0f('0x2b')]=qs[_0xbd0f('0x2b')](_0x13a58c['query'][_0xbd0f('0x2b')]);}return _0x3cb23d[_0xbd0f('0x71')](_0x10bd7);}})[_0xbd0f('0x1d')](function(_0x393a59){if(_0x393a59){return _0x393a59?{'count':_0x58a008,'rows':_0x393a59}:null;}})[_0xbd0f('0x1d')](respondWithResult(_0xb425c5,null))[_0xbd0f('0x4e')](handleError(_0xb425c5,null));};exports[_0xbd0f('0x73')]=function(_0x27a3d6,_0x50d1ca){var _0x5992dd=_0x27a3d6[_0xbd0f('0x50')]['id'];var _0x163c3e=_0x27a3d6[_0xbd0f('0x54')];var _0x479efb=0xc8;var _0x47a448=null;return db[_0xbd0f('0x74')][_0xbd0f('0x75')]({'isolationLevel':db[_0xbd0f('0x74')][_0xbd0f('0x76')][_0xbd0f('0x77')][_0xbd0f('0x78')]},function(_0xbbb3fc){return db[_0xbd0f('0x39')]['findOne']({'where':{'id':_0x5992dd},'transaction':_0xbbb3fc})[_0xbd0f('0x1d')](function(_0x366028){if(_0x366028){return db[_0xbd0f('0x79')][_0xbd0f('0x32')]({'where':{'WhatsappAccountId':_0x5992dd},'transaction':_0xbbb3fc})[_0xbd0f('0x1d')](function(){var _0x18b0fa=_[_0xbd0f('0x38')](_0x163c3e,function(_0x21f377){_0x21f377[_0xbd0f('0x66')]=_0x5992dd;return _0x21f377;});return db[_0xbd0f('0x79')][_0xbd0f('0x7a')](_0x18b0fa,{'transaction':_0xbbb3fc});});}else{_0x479efb=0x194;_0x47a448=[];}});})[_0xbd0f('0x1d')](function(){if(_0x479efb!==0x194){return db[_0xbd0f('0x79')][_0xbd0f('0x7b')]({'where':{'WhatsappAccountId':_0x5992dd},'order':'priority'})[_0xbd0f('0x1d')](function(_0x5869f5){_0x47a448=_0x5869f5;});}})['catch'](function(_0x1217fd){_0x479efb=0x1f4;logger['error'](_0x1217fd['stack']);if(_0x1217fd[_0xbd0f('0x35')]){delete _0x1217fd['name'];}_0x47a448=_0x1217fd;})[_0xbd0f('0x7c')](function(){if(_0x47a448===null){_0x50d1ca[_0xbd0f('0x28')](_0x479efb);}else{if(_0x479efb===0x1f4){_0x50d1ca[_0xbd0f('0x29')](_0x479efb)[_0xbd0f('0x7d')](_0x47a448);}else{_0x50d1ca[_0xbd0f('0x29')](_0x479efb)[_0xbd0f('0x7e')](_0x47a448);}}});};exports['getApplications']=function(_0x14b8f0,_0x474761,_0x39f8e5){var _0x1ae307={};var _0x278080={};var _0x57918d;var _0x170d22;return db[_0xbd0f('0x39')]['findOne']({'where':{'id':_0x14b8f0[_0xbd0f('0x50')]['id']}})['then'](handleEntityNotFound(_0x474761,null))[_0xbd0f('0x1d')](function(_0x19604e){if(_0x19604e){_0x57918d=_0x19604e;_0x278080[_0xbd0f('0x3f')]=_[_0xbd0f('0x3d')](db[_0xbd0f('0x79')][_0xbd0f('0x3a')]);_0x278080[_0xbd0f('0x3c')]=_[_0xbd0f('0x3d')](_0x14b8f0['query']);_0x278080[_0xbd0f('0x47')]=_[_0xbd0f('0x3e')](_0x278080[_0xbd0f('0x3f')],_0x278080[_0xbd0f('0x3c')]);_0x1ae307[_0xbd0f('0x40')]=_[_0xbd0f('0x3e')](_0x278080['model'],qs[_0xbd0f('0x41')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x41')]));_0x1ae307[_0xbd0f('0x40')]=_0x1ae307['attributes'][_0xbd0f('0x42')]?_0x1ae307['attributes']:_0x278080[_0xbd0f('0x3f')];_0x1ae307[_0xbd0f('0x43')]=qs[_0xbd0f('0x44')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x44')]);_0x1ae307[_0xbd0f('0x45')]=qs[_0xbd0f('0x47')](_['pick'](_0x14b8f0[_0xbd0f('0x3c')],_0x278080[_0xbd0f('0x47')]));if(_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x48')]){_0x1ae307[_0xbd0f('0x45')]=_[_0xbd0f('0x49')](_0x1ae307[_0xbd0f('0x45')],{'$or':_['map'](_0x1ae307[_0xbd0f('0x40')],function(_0x32fcf9){var _0x323918={};_0x323918[_0x32fcf9]={'$like':'%'+_0x14b8f0['query'][_0xbd0f('0x48')]+'%'};return _0x323918;})});}_0x1ae307=_['merge']({},_0x1ae307,_0x14b8f0[_0xbd0f('0x4a')]);return _0x57918d[_0xbd0f('0x7f')](_0x1ae307);}})[_0xbd0f('0x1d')](function(_0x1018de){if(_0x1018de){_0x170d22=_0x1018de['length'];if(!_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x64')](_0xbd0f('0x65'))){_0x1ae307[_0xbd0f('0x2c')]=qs[_0xbd0f('0x2c')](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x2c')]);_0x1ae307[_0xbd0f('0x2b')]=qs['offset'](_0x14b8f0[_0xbd0f('0x3c')][_0xbd0f('0x2b')]);}return _0x57918d[_0xbd0f('0x7f')](_0x1ae307);}})[_0xbd0f('0x1d')](function(_0x4f10a4){if(_0x4f10a4){return _0x4f10a4?{'count':_0x170d22,'rows':_0x4f10a4}:null;}})[_0xbd0f('0x1d')](respondWithResult(_0x474761,null))[_0xbd0f('0x4e')](handleError(_0x474761,null));};exports[_0xbd0f('0x80')]=function(_0x46f254,_0x381025,_0x34f8d6){var _0x179062={'channel':_0xbd0f('0x81')};var _0x51df6d=[];var _0x5c00ec=[];var _0x2b087f={};return db['WhatsappAccount']['find']({'where':{'id':_0x46f254[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x79')],'as':_0xbd0f('0x82')}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x381025,null))[_0xbd0f('0x1d')](function(_0x1b7440){_0x179062['account']=_0x1b7440;if(_0x179062[_0xbd0f('0x83')]&&_0x179062['account'][_0xbd0f('0x3b')]==='sinch'&&_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x84')]){if(_0x46f254[_0xbd0f('0x54')]['statuses'][_0xbd0f('0x42')]===0x0)return;if(_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x84')][0x0]['state']!=='read')return;return db[_0xbd0f('0x85')][_0xbd0f('0x5d')]({'read':!![],'readAt':_0x46f254['body'][_0xbd0f('0x84')][0x0]['timestamp']},{'where':{'messageId':_0x46f254['body'][_0xbd0f('0x84')][0x0][_0xbd0f('0x86')]},'individualHooks':!![]})[_0xbd0f('0x1d')](function(_0x2d7aaa){return _0x381025[_0xbd0f('0x29')](0xc8)[_0xbd0f('0x7e')](_0x2d7aaa);});}_0x179062[_0xbd0f('0x87')]=_[_0xbd0f('0x88')](_0x1b7440[_0xbd0f('0x82')],[_0xbd0f('0x89')],['asc']);if(_0x179062['account']['Applications']){delete _0x179062[_0xbd0f('0x83')][_0xbd0f('0x82')];}return db['CmContact'][_0xbd0f('0x5f')]()[_0xbd0f('0x1d')](function(_0x495664){if(!_0x495664){throw new db[(_0xbd0f('0x8a'))]['ValidationError'](_0xbd0f('0x8b'));}_0x51df6d=_['difference'](_[_0xbd0f('0x3d')](_0x495664),[_0xbd0f('0x8c'),_0xbd0f('0x8d')]);_0x5c00ec=_[_0xbd0f('0x8e')](_[_0xbd0f('0x3d')](_0x495664),[_0xbd0f('0x8c'),_0xbd0f('0x8d'),_0xbd0f('0x8f'),'ListId']);_0x179062[_0xbd0f('0x54')]={'mapKey':_0xbd0f('0x90')};if(_0x179062['account']&&_0x179062[_0xbd0f('0x83')][_0xbd0f('0x3b')]===_0xbd0f('0x91')){_0x179062['body'][_0xbd0f('0x92')]=_0x46f254['body']['From'][_0xbd0f('0x93')]('whatsapp:','');_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]=_0x46f254['body'][_0xbd0f('0x94')];_0x179062[_0xbd0f('0x54')][_0xbd0f('0x95')]=_0x46f254[_0xbd0f('0x54')]['MessageSid'];}if(_0x179062[_0xbd0f('0x83')]&&_0x179062[_0xbd0f('0x83')]['type']==='sinch'){_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')]=_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x96')][0x0][_0xbd0f('0x92')];_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]=_0x46f254['body'][_0xbd0f('0x96')][0x0][_0xbd0f('0x26')][_0xbd0f('0x54')];_0x179062['body'][_0xbd0f('0x95')]=_0x46f254[_0xbd0f('0x54')][_0xbd0f('0x96')][0x0][_0xbd0f('0x86')];}if(_0x179062[_0xbd0f('0x54')]['id']){delete _0x179062['body']['id'];}if(_[_0xbd0f('0x97')](_0x179062['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xbd0f('0x98'));}if(_[_0xbd0f('0x97')](_0x179062[_0xbd0f('0x54')]['body'])||_0x179062[_0xbd0f('0x54')][_0xbd0f('0x54')]===''){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9a'));}if(_[_0xbd0f('0x97')](_0x179062['body'][_0xbd0f('0x9b')])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9c')+_0x5c00ec);}if(!_['includes'](_0x5c00ec,_0x179062[_0xbd0f('0x54')]['mapKey'])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))](_0xbd0f('0x9d')+_0x5c00ec);}_0x2b087f[_0x179062[_0xbd0f('0x54')][_0xbd0f('0x9b')]]=_0x179062['body']['from'];return db[_0xbd0f('0x9e')]['find']({'where':{'id':_0x179062['account'][_0xbd0f('0x9f')]},'include':[{'model':db[_0xbd0f('0xa0')],'as':_0xbd0f('0xa1'),'where':_0x2b087f,'limit':0x1,'order':[[_0xbd0f('0x8d'),'DESC']]}]});})[_0xbd0f('0x1d')](handleEntityNotFound(_0x381025,null))[_0xbd0f('0x1d')](function(_0x3df416){if(_0x3df416){_0x179062[_0xbd0f('0xa2')]=_[_0xbd0f('0x6d')](_0x3df416,[_0xbd0f('0xa1')]);if(_0x3df416[_0xbd0f('0xa1')][_0xbd0f('0x42')]){return _0x3df416['Contacts'][0x0];}var _0x4ddbf1=_['defaults'](_0x179062['body'],{'firstName':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'ListId':_0x3df416['id']});_0x4ddbf1[_0x179062['body'][_0xbd0f('0x9b')]]=_0x179062[_0xbd0f('0x54')]['from'];return db[_0xbd0f('0xa0')]['create'](_0x4ddbf1,{'fields':_0x51df6d,'raw':!![]});}})['then'](handleEntityNotFound(_0x381025,null))['then'](function(_0xc252d9){if(_0xc252d9){_0x179062[_0xbd0f('0xa3')]=_0xc252d9;var _0x71539e={'ContactId':_0xc252d9['id'],'phone':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'WhatsappAccountId':_0x46f254['params']['id']};var _0x2a337d={'ContactId':_0xc252d9['id'],'WhatsappAccountId':_0x46f254[_0xbd0f('0x50')]['id'],'closed':![]};return db[_0xbd0f('0xa4')]['find']({'where':_0x2a337d})[_0xbd0f('0x1d')](function(_0x3aee4c){if(_0x3aee4c){return[_0x3aee4c,![]];}return db[_0xbd0f('0xa4')][_0xbd0f('0x53')](_0x71539e)[_0xbd0f('0x1d')](function(_0xcf5330){return[_0xcf5330,!![]];});});}})[_0xbd0f('0x6e')](function(_0x9c17f5,_0xa3522){_0x179062[_0xbd0f('0xa5')]=_0x9c17f5['get']({'plain':!![]});_0x179062['interaction'][_0xbd0f('0xa6')]=![];if(_0xa3522){if(_0x179062[_0xbd0f('0x83')]['autoclose']){_0x179062['applications'][_0xbd0f('0xa7')]({'id':0x0,'priority':_0x179062[_0xbd0f('0x87')][_0xbd0f('0x42')]+0x1,'app':_0xbd0f('0xa8'),'appdata':_0xbd0f('0xa9'),'interval':'*,*,*,*'});}_0x179062['interaction']['created']=!![];}return db['WhatsappMessage'][_0xbd0f('0x53')]({'phone':_0x179062[_0xbd0f('0x54')][_0xbd0f('0x92')],'messageId':_0x179062['body']['messageId'],'body':_0x179062['body'][_0xbd0f('0x54')],'WhatsappAccountId':_0x46f254[_0xbd0f('0x50')]['id'],'WhatsappInteractionId':_0x9c17f5['id'],'direction':'in','ContactId':_0x9c17f5[_0xbd0f('0xaa')],'AttachmentId':_0x179062[_0xbd0f('0x54')][_0xbd0f('0xab')]});})['then'](function(_0x5460ed){_0x179062[_0xbd0f('0x26')]=_0x5460ed;if(_0x179062[_0xbd0f('0xa5')][_0xbd0f('0xac')]){return db[_0xbd0f('0x72')][_0xbd0f('0x5e')]({'attributes':['id',_0xbd0f('0x35')],'where':{'id':_0x179062[_0xbd0f('0xa5')][_0xbd0f('0xac')]}})[_0xbd0f('0x1d')](function(_0x160006){if(_0x160006){_0x179062[_0xbd0f('0x87')][_0xbd0f('0xad')]({'id':0x0,'priority':0x0,'app':_0xbd0f('0xae'),'appdata':_0x160006[_0xbd0f('0x35')]+','+(_0x179062[_0xbd0f('0x83')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xbd0f('0xaf'),_0x179062);});}return respondWithRpcPromise(_0xbd0f('0xb0'),_0xbd0f('0xaf'),_0x179062);})[_0xbd0f('0x1d')](function(_0x378dab){if(_0x378dab){var _0x1d31d3=0xc8;var _0x2c5835=_0xbd0f('0xb1');logger[_0xbd0f('0x1e')](_0xbd0f('0x22'),_0x2c5835,_0x1d31d3,'entity\x20found');logger[_0xbd0f('0x21')](_0xbd0f('0xb2'),_0x2c5835,_0x1d31d3,_0xbd0f('0xb3'),JSON[_0xbd0f('0x23')](_0x378dab));if(_0x179062[_0xbd0f('0x83')][_0xbd0f('0x3b')]==='twilio'){return _0x381025[_0xbd0f('0x29')](_0x1d31d3)[_0xbd0f('0x2e')](_0xbd0f('0xb4'),_0xbd0f('0xb5'))[_0xbd0f('0x7d')](_0xbd0f('0xb6'));}else{return _0x381025[_0xbd0f('0x29')](_0x1d31d3)[_0xbd0f('0x7e')](_0x378dab);}}});})[_0xbd0f('0x4e')](handleError(_0x381025,null));};exports['send']=function(_0x30c11a,_0x84527,_0xfd41c2){var _0x5cf308,_0x487385,_0x319bf1;if(_['isNil'](_0x30c11a['body'][_0xbd0f('0x54')])||_0x30c11a['body'][_0xbd0f('0x54')]===''){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd0f('0x97')](_0x30c11a[_0xbd0f('0x54')]['to'])){throw new db[(_0xbd0f('0x8a'))][(_0xbd0f('0x99'))]('to\x20is\x20mandatory');}_0x5cf308=_0x30c11a['body']['to'];return db['WhatsappAccount'][_0xbd0f('0x5e')]({'where':{'id':_0x30c11a[_0xbd0f('0x50')]['id']},'include':[{'model':db[_0xbd0f('0x9e')],'as':'List','include':[{'model':db[_0xbd0f('0xa0')],'as':_0xbd0f('0xa1'),'where':{'mobile':_0x5cf308},'limit':0x1,'order':[[_0xbd0f('0x8d'),_0xbd0f('0xb7')]]}]}]})[_0xbd0f('0x1d')](handleEntityNotFound(_0x84527,null))[_0xbd0f('0x1d')](function(_0x2b5f69){if(_0x2b5f69&&_0x2b5f69[_0xbd0f('0xb8')]){_0x487385=_0x2b5f69['get']({'plain':!![]});if(_0x487385[_0xbd0f('0xb8')]&&_0x487385[_0xbd0f('0xb8')][_0xbd0f('0xa1')][_0xbd0f('0x42')]){return _0x487385[_0xbd0f('0xb8')][_0xbd0f('0xa1')][0x0];}return db[_0xbd0f('0xa0')][_0xbd0f('0x53')](_[_0xbd0f('0xb9')](_0x30c11a[_0xbd0f('0x54')],{'firstName':_0x5cf308,'mobile':_0x5cf308,'phone':_0x5cf308,'ListId':_0x487385[_0xbd0f('0x9f')]}));}})[_0xbd0f('0x1d')](handleEntityNotFound(_0x84527,null))[_0xbd0f('0x1d')](function(_0x1a9a0f){if(_0x1a9a0f){_0x319bf1=_0x1a9a0f;return db[_0xbd0f('0xa4')]['find']({'where':{'ContactId':_0x319bf1['id'],'closed':![],'WhatsappAccountId':_0x487385['id']}})[_0xbd0f('0x1d')](function(_0x485cbf){if(_0x485cbf){return[_0x485cbf,![]];}return db[_0xbd0f('0xa4')][_0xbd0f('0x53')]({'UserId':_0x30c11a['user']['id'],'ContactId':_0x319bf1['id'],'WhatsappAccountId':_0x487385['id'],'phone':_0x5cf308,'firstMsgDirection':_0xbd0f('0xba'),'Messages':[_[_0xbd0f('0x49')](_0x30c11a[_0xbd0f('0x54')],{'read':![],'body':_0x30c11a[_0xbd0f('0x54')][_0xbd0f('0x54')],'phone':_0x5cf308,'WhatsappAccountId':_0x487385['id'],'UserId':_0x30c11a['user']['id'],'ContactId':_0x319bf1['id']})]},{'include':[{'model':db[_0xbd0f('0x85')],'as':'Messages'}]})[_0xbd0f('0x1d')](function(_0x3e2ba1){return[_0x3e2ba1,!![]];});});}})[_0xbd0f('0x6e')](function(_0x38098d,_0x105b49){if(_0x105b49){return _0x38098d;}return db[_0xbd0f('0x85')][_0xbd0f('0x53')](_[_0xbd0f('0x49')](_0x30c11a[_0xbd0f('0x54')],{'read':![],'body':_0x30c11a[_0xbd0f('0x54')]['body'],'phone':_0x5cf308,'WhatsappAccountId':_0x487385['id'],'WhatsappInteractionId':_0x38098d['id'],'UserId':_0x30c11a[_0xbd0f('0x55')]['id'],'ContactId':_0x319bf1['id']}))[_0xbd0f('0x1d')](function(_0x345925){_0x38098d['dataValues'][_0xbd0f('0xbb')]=[];_0x38098d['dataValues'][_0xbd0f('0xbb')][_0xbd0f('0xa7')](_0x345925[_0xbd0f('0xbc')]);return _0x38098d;});})[_0xbd0f('0x1d')](respondWithResult(_0x84527,null))['catch'](handleError(_0x84527,null));}; \ No newline at end of file +var _0x9d57=['List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','filter','where','includeAll','include','findAll','rows','catch','show','Pause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','WhatsappAccountId','Disposition','findOne','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','applications','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9d57,0x186));var _0x79d5=function(_0x246500,_0x5e0e19){_0x246500=_0x246500-0x0;var _0x4ef559=_0x9d57[_0x246500];return _0x4ef559;};'use strict';var emlformat=require(_0x79d5('0x0'));var rimraf=require(_0x79d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79d5('0x2'));var rp=require(_0x79d5('0x3'));var moment=require(_0x79d5('0x4'));var BPromise=require(_0x79d5('0x5'));var Mustache=require(_0x79d5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79d5('0x7'));var csv=require(_0x79d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x79d5('0x9'));var crypto=require('crypto');var jsforce=require(_0x79d5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x79d5('0x8'));var querystring=require(_0x79d5('0xb'));var Papa=require(_0x79d5('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x79d5('0xd'));var as=require(_0x79d5('0xe'));var hardwareService=require(_0x79d5('0xf'));var logger=require(_0x79d5('0x10'))(_0x79d5('0x11'));var utils=require(_0x79d5('0x12'));var config=require(_0x79d5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x79d5('0x14'))['db'];config[_0x79d5('0x15')]=_[_0x79d5('0x16')](config[_0x79d5('0x15')],{'host':_0x79d5('0x17'),'port':0x18eb});var socket=require(_0x79d5('0x18'))(new Redis(config[_0x79d5('0x15')]));require(_0x79d5('0x19'))[_0x79d5('0x1a')](socket);var jayson=require(_0x79d5('0x1b'));var client=jayson[_0x79d5('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5106fc,_0x3f892a,_0x269193,_0x379127){return new BPromise(function(_0x590428,_0x266bbf){var _0x45de1a=_0x379127||client;return _0x45de1a['request'](_0x5106fc,_0x269193)[_0x79d5('0x1d')](function(_0x20964c){logger[_0x79d5('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x3f892a,_0x79d5('0x1f'));logger[_0x79d5('0x20')](_0x79d5('0x21'),_0x3f892a,_0x79d5('0x1f'),JSON[_0x79d5('0x22')](_0x20964c));if(_0x20964c[_0x79d5('0x23')]){if(_0x20964c[_0x79d5('0x23')][_0x79d5('0x24')]===0x1f4){logger[_0x79d5('0x23')](_0x79d5('0x25'),_0x3f892a,_0x20964c[_0x79d5('0x23')][_0x79d5('0x26')]);return _0x266bbf(_0x20964c['error']['message']);}logger[_0x79d5('0x23')](_0x79d5('0x25'),_0x3f892a,_0x20964c[_0x79d5('0x23')]['message']);return _0x590428(_0x20964c[_0x79d5('0x23')][_0x79d5('0x26')]);}else{logger[_0x79d5('0x1e')](_0x79d5('0x25'),_0x3f892a,_0x79d5('0x1f'));_0x590428(_0x20964c['result'][_0x79d5('0x26')]);}})['catch'](function(_0x1ecd84){logger['error'](_0x79d5('0x25'),_0x3f892a,_0x1ecd84);_0x266bbf(_0x1ecd84);});});}function respondWithStatusCode(_0xe98c21,_0x3fb101){_0x3fb101=_0x3fb101||0xcc;return function(_0x2888d2){if(_0x2888d2){return _0xe98c21[_0x79d5('0x27')](_0x3fb101);}return _0xe98c21['status'](_0x3fb101)[_0x79d5('0x28')]();};}function respondWithResult(_0x14aec5,_0xea5458){_0xea5458=_0xea5458||0xc8;return function(_0x548d42){if(_0x548d42){return _0x14aec5[_0x79d5('0x29')](_0xea5458)[_0x79d5('0x2a')](_0x548d42);}};}function respondWithFilteredResult(_0x28c89c,_0x5460f0){return function(_0x256d6a){if(_0x256d6a){var _0x59dd0a=typeof _0x5460f0['offset']===_0x79d5('0x2b')&&typeof _0x5460f0[_0x79d5('0x2c')]===_0x79d5('0x2b');var _0x4264f9=_0x256d6a[_0x79d5('0x2d')];var _0x126ae4=_0x59dd0a?0x0:_0x5460f0[_0x79d5('0x2e')];var _0x30817e=_0x59dd0a?_0x256d6a[_0x79d5('0x2d')]:_0x5460f0['offset']+_0x5460f0['limit'];var _0x4ed4b0;if(_0x30817e>=_0x4264f9){_0x30817e=_0x4264f9;_0x4ed4b0=0xc8;}else{_0x4ed4b0=0xce;}_0x28c89c[_0x79d5('0x29')](_0x4ed4b0);return _0x28c89c[_0x79d5('0x2f')](_0x79d5('0x30'),_0x126ae4+'-'+_0x30817e+'/'+_0x4264f9)[_0x79d5('0x2a')](_0x256d6a);}return null;};}function patchUpdates(_0x12f0ca){return function(_0x20ede4){try{jsonpatch[_0x79d5('0x31')](_0x20ede4,_0x12f0ca,!![]);}catch(_0x39bcf2){return BPromise[_0x79d5('0x32')](_0x39bcf2);}return _0x20ede4[_0x79d5('0x33')]();};}function saveUpdates(_0x358665,_0xea8eb0){return function(_0x452409){if(_0x452409){return _0x452409[_0x79d5('0x34')](_0x358665)[_0x79d5('0x1d')](function(_0x192bb3){return _0x192bb3;});}return null;};}function removeEntity(_0x4c83d9,_0x429db6){return function(_0x24c9ae){if(_0x24c9ae){return _0x24c9ae['destroy']()[_0x79d5('0x1d')](function(){var _0x49fdef=_0x24c9ae[_0x79d5('0x35')]({'plain':!![]});var _0x291a5f='WhatsappAccounts';return db[_0x79d5('0x36')][_0x79d5('0x37')]({'where':{'type':_0x291a5f,'resourceId':_0x49fdef['id']}})[_0x79d5('0x1d')](function(){return _0x24c9ae;});})[_0x79d5('0x1d')](function(){_0x4c83d9[_0x79d5('0x29')](0xcc)[_0x79d5('0x28')]();});}};}function handleEntityNotFound(_0x308c19,_0x43964e){return function(_0x527927){if(!_0x527927){_0x308c19[_0x79d5('0x27')](0x194);}return _0x527927;};}function handleError(_0x468c98,_0x3447ad){_0x3447ad=_0x3447ad||0x1f4;return function(_0x37717a){logger[_0x79d5('0x23')](_0x37717a[_0x79d5('0x38')]);if(_0x37717a[_0x79d5('0x39')]){delete _0x37717a[_0x79d5('0x39')];}_0x468c98[_0x79d5('0x29')](_0x3447ad)['send'](_0x37717a);};}exports['index']=function(_0x2aa32e,_0x36b45c){var _0x6b2fc0={'include':[{'model':db['Pause'],'as':_0x79d5('0x3a')}]},_0x4c9fec={},_0x5eebb0={'count':0x0,'rows':[]};var _0x1be768=_[_0x79d5('0x3b')](db[_0x79d5('0x3c')][_0x79d5('0x3d')],function(_0xc36244){return{'name':_0xc36244[_0x79d5('0x3e')],'type':_0xc36244[_0x79d5('0x3f')][_0x79d5('0x40')]};});_0x4c9fec[_0x79d5('0x41')]=_[_0x79d5('0x3b')](_0x1be768,'name');_0x4c9fec[_0x79d5('0x42')]=_[_0x79d5('0x43')](_0x2aa32e['query']);_0x4c9fec[_0x79d5('0x44')]=_['intersection'](_0x4c9fec[_0x79d5('0x41')],_0x4c9fec[_0x79d5('0x42')]);_0x6b2fc0['attributes']=_[_0x79d5('0x45')](_0x4c9fec[_0x79d5('0x41')],qs[_0x79d5('0x46')](_0x2aa32e[_0x79d5('0x42')][_0x79d5('0x46')]));_0x6b2fc0[_0x79d5('0x47')]=_0x6b2fc0[_0x79d5('0x47')][_0x79d5('0x48')]?_0x6b2fc0[_0x79d5('0x47')]:_0x4c9fec[_0x79d5('0x41')];if(!_0x2aa32e[_0x79d5('0x42')][_0x79d5('0x49')]('nolimit')){_0x6b2fc0[_0x79d5('0x2c')]=qs['limit'](_0x2aa32e[_0x79d5('0x42')]['limit']);_0x6b2fc0['offset']=qs[_0x79d5('0x2e')](_0x2aa32e[_0x79d5('0x42')]['offset']);}_0x6b2fc0['order']=qs[_0x79d5('0x4a')](_0x2aa32e[_0x79d5('0x42')]['sort']);_0x6b2fc0['where']=qs[_0x79d5('0x44')](_[_0x79d5('0x4b')](_0x2aa32e['query'],_0x4c9fec[_0x79d5('0x44')]),_0x1be768);if(_0x2aa32e[_0x79d5('0x42')]['filter']){_0x6b2fc0['where']=_[_0x79d5('0x4c')](_0x6b2fc0['where'],{'$or':_[_0x79d5('0x3b')](_0x1be768,function(_0x3bf72c){if(_0x3bf72c[_0x79d5('0x3f')]!=='VIRTUAL'){var _0x58f6e8={};_0x58f6e8[_0x3bf72c[_0x79d5('0x39')]]={'$like':'%'+_0x2aa32e[_0x79d5('0x42')][_0x79d5('0x4d')]+'%'};return _0x58f6e8;}})});}_0x6b2fc0=_[_0x79d5('0x4c')]({},_0x6b2fc0,_0x2aa32e['options']);var _0x1e64f5={'where':_0x6b2fc0[_0x79d5('0x4e')]};return db['WhatsappAccount']['count'](_0x1e64f5)[_0x79d5('0x1d')](function(_0x431f18){_0x5eebb0[_0x79d5('0x2d')]=_0x431f18;if(_0x2aa32e[_0x79d5('0x42')][_0x79d5('0x4f')]){_0x6b2fc0[_0x79d5('0x50')]=[{'all':!![]}];}return db[_0x79d5('0x3c')][_0x79d5('0x51')](_0x6b2fc0);})[_0x79d5('0x1d')](function(_0x3d3d7e){_0x5eebb0[_0x79d5('0x52')]=_0x3d3d7e;return _0x5eebb0;})[_0x79d5('0x1d')](respondWithFilteredResult(_0x36b45c,_0x6b2fc0))[_0x79d5('0x53')](handleError(_0x36b45c,null));};exports[_0x79d5('0x54')]=function(_0x440540,_0x4b03bb){var _0x3ae7e3={'raw':![],'where':{'id':_0x440540['params']['id']},'include':[{'model':db[_0x79d5('0x55')],'as':_0x79d5('0x3a')}]},_0x16a086={};_0x16a086[_0x79d5('0x41')]=_[_0x79d5('0x43')](db['WhatsappAccount'][_0x79d5('0x3d')]);_0x16a086[_0x79d5('0x42')]=_[_0x79d5('0x43')](_0x440540[_0x79d5('0x42')]);_0x16a086[_0x79d5('0x44')]=_[_0x79d5('0x45')](_0x16a086[_0x79d5('0x41')],_0x16a086[_0x79d5('0x42')]);_0x3ae7e3[_0x79d5('0x47')]=_[_0x79d5('0x45')](_0x16a086['model'],qs[_0x79d5('0x46')](_0x440540[_0x79d5('0x42')]['fields']));_0x3ae7e3[_0x79d5('0x47')]=_0x3ae7e3['attributes'][_0x79d5('0x48')]?_0x3ae7e3[_0x79d5('0x47')]:_0x16a086[_0x79d5('0x41')];if(_0x440540[_0x79d5('0x42')][_0x79d5('0x4f')]){_0x3ae7e3['include']=[{'all':!![]}];}_0x3ae7e3=_[_0x79d5('0x4c')]({},_0x3ae7e3,_0x440540[_0x79d5('0x56')]);return db['WhatsappAccount'][_0x79d5('0x57')](_0x3ae7e3)[_0x79d5('0x1d')](handleEntityNotFound(_0x4b03bb,null))[_0x79d5('0x1d')](respondWithResult(_0x4b03bb,null))[_0x79d5('0x53')](handleError(_0x4b03bb,null));};exports[_0x79d5('0x58')]=function(_0x31302f,_0x288f24){return db[_0x79d5('0x3c')][_0x79d5('0x58')](_0x31302f['body'],{})['then'](function(_0x35a936){var _0x260770=_0x31302f[_0x79d5('0x59')][_0x79d5('0x35')]({'plain':!![]});if(!_0x260770)throw new Error(_0x79d5('0x5a'));if(_0x260770[_0x79d5('0x5b')]===_0x79d5('0x59')){var _0x9ab0e7=_0x35a936[_0x79d5('0x35')]({'plain':!![]});var _0x2b3a71='WhatsappAccounts';return db[_0x79d5('0x5c')][_0x79d5('0x57')]({'where':{'name':_0x2b3a71,'userProfileId':_0x260770[_0x79d5('0x5d')]},'raw':!![]})[_0x79d5('0x1d')](function(_0x245d4c){if(_0x245d4c&&_0x245d4c[_0x79d5('0x5e')]===0x0){return db['UserProfileResource'][_0x79d5('0x58')]({'name':_0x9ab0e7[_0x79d5('0x39')],'resourceId':_0x9ab0e7['id'],'type':_0x245d4c[_0x79d5('0x39')],'sectionId':_0x245d4c['id']},{})[_0x79d5('0x1d')](function(){return _0x35a936;});}else{return _0x35a936;}})[_0x79d5('0x53')](function(_0x27ec8d){logger[_0x79d5('0x23')](_0x79d5('0x5f'),_0x27ec8d);throw _0x27ec8d;});}return _0x35a936;})['then'](respondWithResult(_0x288f24,0xc9))[_0x79d5('0x53')](handleError(_0x288f24,null));};exports[_0x79d5('0x34')]=function(_0x1d81b4,_0x513cae){if(_0x1d81b4[_0x79d5('0x60')]['id']){delete _0x1d81b4[_0x79d5('0x60')]['id'];}return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x1d81b4[_0x79d5('0x61')]['id']},'include':[{'model':db[_0x79d5('0x55')],'as':_0x79d5('0x3a')}]})[_0x79d5('0x1d')](handleEntityNotFound(_0x513cae,null))[_0x79d5('0x1d')](saveUpdates(_0x1d81b4[_0x79d5('0x60')],null))['then'](respondWithResult(_0x513cae,null))[_0x79d5('0x53')](handleError(_0x513cae,null));};exports[_0x79d5('0x37')]=function(_0x2e33b1,_0x4c0bb6){return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x2e33b1['params']['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x4c0bb6,null))[_0x79d5('0x1d')](removeEntity(_0x4c0bb6,null))[_0x79d5('0x53')](handleError(_0x4c0bb6,null));};exports[_0x79d5('0x62')]=function(_0x5a9f35,_0xce2cf3){return db[_0x79d5('0x3c')]['describe']()['then'](respondWithResult(_0xce2cf3,null))[_0x79d5('0x53')](handleError(_0xce2cf3,null));};exports['addDisposition']=function(_0x2ca5af,_0x51189a,_0x399e57){if(_0x2ca5af[_0x79d5('0x60')]['id']){delete _0x2ca5af[_0x79d5('0x60')]['id'];}return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x2ca5af['params']['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x51189a,null))[_0x79d5('0x1d')](function(_0x3a0f58){if(_0x3a0f58){_0x2ca5af[_0x79d5('0x60')][_0x79d5('0x63')]=_0x3a0f58['id'];return db[_0x79d5('0x64')][_0x79d5('0x58')](_0x2ca5af[_0x79d5('0x60')]);}})[_0x79d5('0x1d')](respondWithResult(_0x51189a,null))[_0x79d5('0x53')](handleError(_0x51189a,null));};exports['getDispositions']=function(_0x16bde9,_0x1bfcb6,_0x2da025){var _0x3cc463={'raw':![],'where':{}};var _0x3a213d={};var _0x249a65={'count':0x0,'rows':[]};return db[_0x79d5('0x3c')][_0x79d5('0x65')]({'where':{'id':_0x16bde9[_0x79d5('0x61')]['id']}})['then'](handleEntityNotFound(_0x1bfcb6,null))[_0x79d5('0x1d')](function(_0x227f14){if(_0x227f14){_0x3a213d[_0x79d5('0x41')]=_[_0x79d5('0x43')](db[_0x79d5('0x64')][_0x79d5('0x3d')]);_0x3a213d[_0x79d5('0x42')]=_[_0x79d5('0x43')](_0x16bde9['query']);_0x3a213d[_0x79d5('0x44')]=_[_0x79d5('0x45')](_0x3a213d['model'],_0x3a213d['query']);_0x3cc463[_0x79d5('0x47')]=_[_0x79d5('0x45')](_0x3a213d[_0x79d5('0x41')],qs[_0x79d5('0x46')](_0x16bde9[_0x79d5('0x42')][_0x79d5('0x46')]));_0x3cc463['attributes']=_0x3cc463[_0x79d5('0x47')][_0x79d5('0x48')]?_0x3cc463[_0x79d5('0x47')]:_0x3a213d[_0x79d5('0x41')];if(!_0x16bde9[_0x79d5('0x42')]['hasOwnProperty'](_0x79d5('0x66'))){_0x3cc463['limit']=qs[_0x79d5('0x2c')](_0x16bde9[_0x79d5('0x42')]['limit']);_0x3cc463[_0x79d5('0x2e')]=qs['offset'](_0x16bde9[_0x79d5('0x42')][_0x79d5('0x2e')]);}_0x3cc463[_0x79d5('0x67')]=qs[_0x79d5('0x4a')](_0x16bde9[_0x79d5('0x42')][_0x79d5('0x4a')]);_0x3cc463[_0x79d5('0x4e')]=qs[_0x79d5('0x44')](_[_0x79d5('0x4b')](_0x16bde9['query'],_0x3a213d['filters']));_0x3cc463[_0x79d5('0x4e')]['WhatsappAccountId']=_0x227f14['id'];if(_0x16bde9[_0x79d5('0x42')][_0x79d5('0x4d')]){_0x3cc463['where']=_[_0x79d5('0x4c')](_0x3cc463['where'],{'$or':_[_0x79d5('0x3b')](_0x3cc463[_0x79d5('0x47')],function(_0xecf8ca){var _0x34059d={};_0x34059d[_0xecf8ca]={'$like':'%'+_0x16bde9['query']['filter']+'%'};return _0x34059d;})});}_0x3cc463=_[_0x79d5('0x4c')]({},_0x3cc463,_0x16bde9[_0x79d5('0x56')]);return db[_0x79d5('0x64')][_0x79d5('0x2d')]({'where':_0x3cc463[_0x79d5('0x4e')]})['then'](function(_0x2d332b){_0x249a65[_0x79d5('0x2d')]=_0x2d332b;if(_0x16bde9[_0x79d5('0x42')][_0x79d5('0x4f')]){_0x3cc463[_0x79d5('0x50')]=[{'all':!![]}];}return db[_0x79d5('0x64')][_0x79d5('0x51')](_0x3cc463);})[_0x79d5('0x1d')](function(_0x3d8a89){_0x249a65[_0x79d5('0x52')]=_0x3d8a89;return _0x249a65;});}})['then'](respondWithFilteredResult(_0x1bfcb6,_0x3cc463))['catch'](handleError(_0x1bfcb6,null));};exports[_0x79d5('0x68')]=function(_0x507bff,_0x318194,_0x4e1057){return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x507bff[_0x79d5('0x61')]['id']}})['then'](handleEntityNotFound(_0x318194,null))['then'](function(_0x412e4e){if(_0x412e4e){return _0x412e4e[_0x79d5('0x68')](_0x507bff[_0x79d5('0x42')][_0x79d5('0x69')]);}})[_0x79d5('0x1d')](respondWithStatusCode(_0x318194,null))[_0x79d5('0x53')](handleError(_0x318194,null));};exports['addAnswer']=function(_0x8c51ff,_0x2501e7,_0x11f1b6){if(_0x8c51ff[_0x79d5('0x60')]['id']){delete _0x8c51ff[_0x79d5('0x60')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x8c51ff[_0x79d5('0x61')]['id']}})['then'](handleEntityNotFound(_0x2501e7,null))[_0x79d5('0x1d')](function(_0xae318a){if(_0xae318a){_0x8c51ff['body'][_0x79d5('0x63')]=_0xae318a['id'];return db[_0x79d5('0x6a')]['create'](_0x8c51ff[_0x79d5('0x60')]);}})['then'](respondWithResult(_0x2501e7,null))[_0x79d5('0x53')](handleError(_0x2501e7,null));};exports[_0x79d5('0x6b')]=function(_0x26e0e0,_0x454aef,_0x3bb3df){var _0x346c36={'raw':![],'where':{}};var _0xf8ade3={};var _0x5ca58d={'count':0x0,'rows':[]};return db[_0x79d5('0x3c')][_0x79d5('0x65')]({'where':{'id':_0x26e0e0['params']['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x454aef,null))[_0x79d5('0x1d')](function(_0x2581a9){if(_0x2581a9){_0xf8ade3[_0x79d5('0x41')]=_['keys'](db[_0x79d5('0x6a')][_0x79d5('0x3d')]);_0xf8ade3['query']=_[_0x79d5('0x43')](_0x26e0e0['query']);_0xf8ade3[_0x79d5('0x44')]=_[_0x79d5('0x45')](_0xf8ade3[_0x79d5('0x41')],_0xf8ade3[_0x79d5('0x42')]);_0x346c36['attributes']=_['intersection'](_0xf8ade3[_0x79d5('0x41')],qs[_0x79d5('0x46')](_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x46')]));_0x346c36[_0x79d5('0x47')]=_0x346c36[_0x79d5('0x47')][_0x79d5('0x48')]?_0x346c36[_0x79d5('0x47')]:_0xf8ade3[_0x79d5('0x41')];if(!_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x49')]('nolimit')){_0x346c36[_0x79d5('0x2c')]=qs[_0x79d5('0x2c')](_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x2c')]);_0x346c36[_0x79d5('0x2e')]=qs[_0x79d5('0x2e')](_0x26e0e0[_0x79d5('0x42')]['offset']);}_0x346c36[_0x79d5('0x67')]=qs['sort'](_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x4a')]);_0x346c36[_0x79d5('0x4e')]=qs[_0x79d5('0x44')](_[_0x79d5('0x4b')](_0x26e0e0[_0x79d5('0x42')],_0xf8ade3['filters']));_0x346c36[_0x79d5('0x4e')][_0x79d5('0x63')]=_0x2581a9['id'];if(_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x4d')]){_0x346c36[_0x79d5('0x4e')]=_['merge'](_0x346c36[_0x79d5('0x4e')],{'$or':_['map'](_0x346c36[_0x79d5('0x47')],function(_0x31d193){var _0x1c05e6={};_0x1c05e6[_0x31d193]={'$like':'%'+_0x26e0e0[_0x79d5('0x42')][_0x79d5('0x4d')]+'%'};return _0x1c05e6;})});}_0x346c36=_[_0x79d5('0x4c')]({},_0x346c36,_0x26e0e0[_0x79d5('0x56')]);return db[_0x79d5('0x6a')][_0x79d5('0x2d')]({'where':_0x346c36[_0x79d5('0x4e')]})[_0x79d5('0x1d')](function(_0xa649c8){_0x5ca58d[_0x79d5('0x2d')]=_0xa649c8;if(_0x26e0e0[_0x79d5('0x42')]['includeAll']){_0x346c36['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x79d5('0x51')](_0x346c36);})[_0x79d5('0x1d')](function(_0x2b7625){_0x5ca58d[_0x79d5('0x52')]=_0x2b7625;return _0x5ca58d;});}})[_0x79d5('0x1d')](respondWithFilteredResult(_0x454aef,_0x346c36))[_0x79d5('0x53')](handleError(_0x454aef,null));};exports[_0x79d5('0x6c')]=function(_0x35a801,_0x5b308e,_0x4a9876){return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x35a801[_0x79d5('0x61')]['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x5b308e,null))[_0x79d5('0x1d')](function(_0x616501){if(_0x616501){return _0x616501[_0x79d5('0x6c')](_0x35a801['query'][_0x79d5('0x69')]);}})[_0x79d5('0x1d')](respondWithStatusCode(_0x5b308e,null))[_0x79d5('0x53')](handleError(_0x5b308e,null));};exports['addAgents']=function(_0xc3ffd6,_0x39c8e5,_0x7210d8){return db[_0x79d5('0x3c')]['find']({'where':{'id':_0xc3ffd6[_0x79d5('0x61')]['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x39c8e5,null))[_0x79d5('0x1d')](function(_0x3d8048){if(_0x3d8048){return _0x3d8048['addAgents'](_0xc3ffd6['body'][_0x79d5('0x69')],_[_0x79d5('0x6d')](_0xc3ffd6['body'],[_0x79d5('0x69'),'id'])||{})[_0x79d5('0x6e')](function(_0x442f24){for(var _0x504a57=0x0;_0x504a57<_0xc3ffd6[_0x79d5('0x60')]['ids'][_0x79d5('0x48')];_0x504a57+=0x1){socket[_0x79d5('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0xc3ffd6[_0x79d5('0x60')]['ids'][_0x504a57]),'WhatsappAccountId':Number(_0xc3ffd6[_0x79d5('0x61')]['id'])});}return _0x442f24;});}})[_0x79d5('0x1d')](respondWithResult(_0x39c8e5,null))[_0x79d5('0x53')](handleError(_0x39c8e5,null));};exports[_0x79d5('0x70')]=function(_0x5f3188,_0x3daeb3,_0x2abe0d){return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x5f3188[_0x79d5('0x61')]['id']}})['then'](handleEntityNotFound(_0x3daeb3,null))[_0x79d5('0x1d')](function(_0x10bb9d){if(_0x10bb9d){return _0x10bb9d['removeAgents'](_0x5f3188[_0x79d5('0x42')][_0x79d5('0x69')])[_0x79d5('0x1d')](function(){if(_[_0x79d5('0x71')](_0x5f3188[_0x79d5('0x42')]['ids'])){for(var _0x1084cf=0x0;_0x1084cf<_0x5f3188[_0x79d5('0x42')]['ids'][_0x79d5('0x48')];_0x1084cf+=0x1){socket[_0x79d5('0x6f')](_0x79d5('0x72'),{'UserId':Number(_0x5f3188[_0x79d5('0x42')][_0x79d5('0x69')][_0x1084cf]),'WhatsappAccountId':Number(_0x5f3188[_0x79d5('0x61')]['id'])});}}else{socket[_0x79d5('0x6f')](_0x79d5('0x72'),{'UserId':Number(_0x5f3188['query'][_0x79d5('0x69')]),'WhatsappAccountId':Number(_0x5f3188[_0x79d5('0x61')]['id'])});}});}})[_0x79d5('0x1d')](respondWithStatusCode(_0x3daeb3,null))[_0x79d5('0x53')](handleError(_0x3daeb3,null));};exports[_0x79d5('0x73')]=function(_0x5e77fd,_0x2f8be5,_0x1fbf90){var _0x9518f8={};var _0x1158d9={};var _0x2d7634;var _0x111263;return db[_0x79d5('0x3c')][_0x79d5('0x65')]({'where':{'id':_0x5e77fd[_0x79d5('0x61')]['id']}})['then'](handleEntityNotFound(_0x2f8be5,null))['then'](function(_0x2d91ef){if(_0x2d91ef){_0x2d7634=_0x2d91ef;_0x1158d9['model']=_[_0x79d5('0x43')](db[_0x79d5('0x74')]['rawAttributes']);_0x1158d9[_0x79d5('0x42')]=_[_0x79d5('0x43')](_0x5e77fd['query']);_0x1158d9[_0x79d5('0x44')]=_[_0x79d5('0x45')](_0x1158d9[_0x79d5('0x41')],_0x1158d9['query']);_0x9518f8[_0x79d5('0x47')]=_[_0x79d5('0x45')](_0x1158d9[_0x79d5('0x41')],qs['fields'](_0x5e77fd[_0x79d5('0x42')][_0x79d5('0x46')]));_0x9518f8['attributes']=_0x9518f8[_0x79d5('0x47')][_0x79d5('0x48')]?_0x9518f8[_0x79d5('0x47')]:_0x1158d9['model'];_0x9518f8['order']=qs[_0x79d5('0x4a')](_0x5e77fd[_0x79d5('0x42')]['sort']);_0x9518f8['where']=qs[_0x79d5('0x44')](_['pick'](_0x5e77fd[_0x79d5('0x42')],_0x1158d9[_0x79d5('0x44')]));if(_0x5e77fd[_0x79d5('0x42')]['filter']){_0x9518f8[_0x79d5('0x4e')]=_[_0x79d5('0x4c')](_0x9518f8[_0x79d5('0x4e')],{'$or':_[_0x79d5('0x3b')](_0x9518f8[_0x79d5('0x47')],function(_0xf96bc5){var _0x4d73a8={};_0x4d73a8[_0xf96bc5]={'$like':'%'+_0x5e77fd[_0x79d5('0x42')][_0x79d5('0x4d')]+'%'};return _0x4d73a8;})});}_0x9518f8=_[_0x79d5('0x4c')]({},_0x9518f8,_0x5e77fd[_0x79d5('0x56')]);return _0x2d7634[_0x79d5('0x73')](_0x9518f8);}})[_0x79d5('0x1d')](function(_0x394382){if(_0x394382){_0x111263=_0x394382[_0x79d5('0x48')];if(!_0x5e77fd[_0x79d5('0x42')][_0x79d5('0x49')]('nolimit')){_0x9518f8[_0x79d5('0x2c')]=qs[_0x79d5('0x2c')](_0x5e77fd['query'][_0x79d5('0x2c')]);_0x9518f8[_0x79d5('0x2e')]=qs['offset'](_0x5e77fd['query'][_0x79d5('0x2e')]);}return _0x2d7634[_0x79d5('0x73')](_0x9518f8);}})[_0x79d5('0x1d')](function(_0x1fcb32){if(_0x1fcb32){return _0x1fcb32?{'count':_0x111263,'rows':_0x1fcb32}:null;}})['then'](respondWithResult(_0x2f8be5,null))[_0x79d5('0x53')](handleError(_0x2f8be5,null));};exports[_0x79d5('0x75')]=function(_0x520119,_0x484533){var _0x31bfad=_0x520119[_0x79d5('0x61')]['id'];var _0x42ab3c=_0x520119[_0x79d5('0x60')];var _0x786961=0xc8;var _0x3e503d=null;return db[_0x79d5('0x76')]['transaction']({'isolationLevel':db['sequelize'][_0x79d5('0x77')][_0x79d5('0x78')][_0x79d5('0x79')]},function(_0x2c8128){return db[_0x79d5('0x3c')][_0x79d5('0x65')]({'where':{'id':_0x31bfad},'transaction':_0x2c8128})[_0x79d5('0x1d')](function(_0x3d145a){if(_0x3d145a){return db[_0x79d5('0x7a')][_0x79d5('0x37')]({'where':{'WhatsappAccountId':_0x31bfad},'transaction':_0x2c8128})['then'](function(){var _0x5f4bdf=_[_0x79d5('0x3b')](_0x42ab3c,function(_0x3dfd99){_0x3dfd99['WhatsappAccountId']=_0x31bfad;return _0x3dfd99;});return db[_0x79d5('0x7a')]['bulkCreate'](_0x5f4bdf,{'transaction':_0x2c8128});});}else{_0x786961=0x194;_0x3e503d=[];}});})[_0x79d5('0x1d')](function(){if(_0x786961!==0x194){return db[_0x79d5('0x7a')][_0x79d5('0x7b')]({'where':{'WhatsappAccountId':_0x31bfad},'order':_0x79d5('0x7c')})[_0x79d5('0x1d')](function(_0x42550e){_0x3e503d=_0x42550e;});}})['catch'](function(_0x3205d0){_0x786961=0x1f4;logger[_0x79d5('0x23')](_0x3205d0[_0x79d5('0x38')]);if(_0x3205d0['name']){delete _0x3205d0[_0x79d5('0x39')];}_0x3e503d=_0x3205d0;})[_0x79d5('0x7d')](function(){if(_0x3e503d===null){_0x484533[_0x79d5('0x27')](_0x786961);}else{if(_0x786961===0x1f4){_0x484533[_0x79d5('0x29')](_0x786961)[_0x79d5('0x7e')](_0x3e503d);}else{_0x484533[_0x79d5('0x29')](_0x786961)[_0x79d5('0x2a')](_0x3e503d);}}});};exports[_0x79d5('0x7f')]=function(_0x178379,_0x5c1611,_0x976bb3){var _0x587088={};var _0x2e7c14={};var _0x147c0a;var _0x32b7c5;return db[_0x79d5('0x3c')][_0x79d5('0x65')]({'where':{'id':_0x178379['params']['id']}})[_0x79d5('0x1d')](handleEntityNotFound(_0x5c1611,null))[_0x79d5('0x1d')](function(_0x3af370){if(_0x3af370){_0x147c0a=_0x3af370;_0x2e7c14[_0x79d5('0x41')]=_[_0x79d5('0x43')](db['WhatsappApplication']['rawAttributes']);_0x2e7c14[_0x79d5('0x42')]=_[_0x79d5('0x43')](_0x178379[_0x79d5('0x42')]);_0x2e7c14['filters']=_[_0x79d5('0x45')](_0x2e7c14[_0x79d5('0x41')],_0x2e7c14[_0x79d5('0x42')]);_0x587088[_0x79d5('0x47')]=_[_0x79d5('0x45')](_0x2e7c14[_0x79d5('0x41')],qs[_0x79d5('0x46')](_0x178379[_0x79d5('0x42')]['fields']));_0x587088[_0x79d5('0x47')]=_0x587088[_0x79d5('0x47')][_0x79d5('0x48')]?_0x587088[_0x79d5('0x47')]:_0x2e7c14['model'];_0x587088[_0x79d5('0x67')]=qs['sort'](_0x178379[_0x79d5('0x42')]['sort']);_0x587088['where']=qs[_0x79d5('0x44')](_[_0x79d5('0x4b')](_0x178379[_0x79d5('0x42')],_0x2e7c14['filters']));if(_0x178379['query'][_0x79d5('0x4d')]){_0x587088[_0x79d5('0x4e')]=_[_0x79d5('0x4c')](_0x587088[_0x79d5('0x4e')],{'$or':_[_0x79d5('0x3b')](_0x587088[_0x79d5('0x47')],function(_0x5b565f){var _0x36e760={};_0x36e760[_0x5b565f]={'$like':'%'+_0x178379[_0x79d5('0x42')][_0x79d5('0x4d')]+'%'};return _0x36e760;})});}_0x587088=_['merge']({},_0x587088,_0x178379[_0x79d5('0x56')]);return _0x147c0a[_0x79d5('0x7f')](_0x587088);}})[_0x79d5('0x1d')](function(_0x52bf82){if(_0x52bf82){_0x32b7c5=_0x52bf82[_0x79d5('0x48')];if(!_0x178379['query'][_0x79d5('0x49')](_0x79d5('0x66'))){_0x587088[_0x79d5('0x2c')]=qs['limit'](_0x178379[_0x79d5('0x42')][_0x79d5('0x2c')]);_0x587088[_0x79d5('0x2e')]=qs[_0x79d5('0x2e')](_0x178379[_0x79d5('0x42')][_0x79d5('0x2e')]);}return _0x147c0a[_0x79d5('0x7f')](_0x587088);}})[_0x79d5('0x1d')](function(_0x28a59f){if(_0x28a59f){return _0x28a59f?{'count':_0x32b7c5,'rows':_0x28a59f}:null;}})['then'](respondWithResult(_0x5c1611,null))[_0x79d5('0x53')](handleError(_0x5c1611,null));};exports[_0x79d5('0x80')]=function(_0x58e444,_0x3cb6a1,_0x516763){var _0x49b31e={'channel':_0x79d5('0x81')};var _0x2c79c9=[];var _0x3eed93=[];var _0x1857d6={};return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x58e444[_0x79d5('0x61')]['id']},'include':[{'model':db[_0x79d5('0x7a')],'as':_0x79d5('0x82')}]})[_0x79d5('0x1d')](handleEntityNotFound(_0x3cb6a1,null))[_0x79d5('0x1d')](function(_0x34f473){_0x49b31e[_0x79d5('0x83')]=_0x34f473;if(_0x49b31e[_0x79d5('0x83')]&&_0x49b31e[_0x79d5('0x83')][_0x79d5('0x3f')]===_0x79d5('0x84')&&_0x58e444[_0x79d5('0x60')][_0x79d5('0x85')]){if(_0x58e444['body']['statuses'][_0x79d5('0x48')]===0x0)return;if(_0x58e444[_0x79d5('0x60')][_0x79d5('0x85')][0x0][_0x79d5('0x86')]!=='read')return;return db[_0x79d5('0x87')][_0x79d5('0x34')]({'read':!![],'readAt':_0x58e444[_0x79d5('0x60')][_0x79d5('0x85')][0x0][_0x79d5('0x88')]},{'where':{'messageId':_0x58e444[_0x79d5('0x60')][_0x79d5('0x85')][0x0][_0x79d5('0x89')]},'individualHooks':!![]})[_0x79d5('0x1d')](function(_0x4ef678){return _0x3cb6a1[_0x79d5('0x29')](0xc8)[_0x79d5('0x2a')](_0x4ef678);});}_0x49b31e['applications']=_[_0x79d5('0x8a')](_0x34f473[_0x79d5('0x82')],[_0x79d5('0x7c')],[_0x79d5('0x8b')]);if(_0x49b31e[_0x79d5('0x83')][_0x79d5('0x82')]){delete _0x49b31e[_0x79d5('0x83')][_0x79d5('0x82')];}return db[_0x79d5('0x8c')]['describe']()['then'](function(_0xc563fa){if(!_0xc563fa){throw new db[(_0x79d5('0x8d'))][(_0x79d5('0x8e'))](_0x79d5('0x8f'));}_0x2c79c9=_[_0x79d5('0x90')](_[_0x79d5('0x43')](_0xc563fa),[_0x79d5('0x91'),_0x79d5('0x92')]);_0x3eed93=_['difference'](_[_0x79d5('0x43')](_0xc563fa),[_0x79d5('0x91'),'updatedAt','CompanyId',_0x79d5('0x93')]);_0x49b31e[_0x79d5('0x60')]={'mapKey':_0x79d5('0x94')};if(_0x49b31e['account']&&_0x49b31e[_0x79d5('0x83')]['type']===_0x79d5('0x95')){_0x49b31e[_0x79d5('0x60')][_0x79d5('0x96')]=_0x58e444[_0x79d5('0x60')]['From']['replace'](_0x79d5('0x97'),'');_0x49b31e[_0x79d5('0x60')][_0x79d5('0x60')]=_0x58e444[_0x79d5('0x60')][_0x79d5('0x98')];_0x49b31e[_0x79d5('0x60')][_0x79d5('0x99')]=_0x58e444[_0x79d5('0x60')][_0x79d5('0x9a')];}if(_0x49b31e[_0x79d5('0x83')]&&_0x49b31e[_0x79d5('0x83')][_0x79d5('0x3f')]===_0x79d5('0x84')){_0x49b31e[_0x79d5('0x60')][_0x79d5('0x96')]=_0x58e444[_0x79d5('0x60')][_0x79d5('0x9b')][0x0]['from'];_0x49b31e['body'][_0x79d5('0x60')]=_0x58e444['body'][_0x79d5('0x9b')][0x0]['message'][_0x79d5('0x60')];_0x49b31e[_0x79d5('0x60')][_0x79d5('0x99')]=_0x58e444[_0x79d5('0x60')][_0x79d5('0x9b')][0x0][_0x79d5('0x89')];}if(_0x49b31e[_0x79d5('0x60')]['id']){delete _0x49b31e[_0x79d5('0x60')]['id'];}if(_[_0x79d5('0x9c')](_0x49b31e['body'][_0x79d5('0x96')])){throw new db['Sequelize'][(_0x79d5('0x8e'))](_0x79d5('0x9d'));}if(_['isNil'](_0x49b31e[_0x79d5('0x60')]['body'])||_0x49b31e['body'][_0x79d5('0x60')]===''){throw new db[(_0x79d5('0x8d'))][(_0x79d5('0x8e'))](_0x79d5('0x9e'));}if(_[_0x79d5('0x9c')](_0x49b31e[_0x79d5('0x60')][_0x79d5('0x9f')])){throw new db['Sequelize'][(_0x79d5('0x8e'))](_0x79d5('0xa0')+_0x3eed93);}if(!_[_0x79d5('0xa1')](_0x3eed93,_0x49b31e[_0x79d5('0x60')][_0x79d5('0x9f')])){throw new db[(_0x79d5('0x8d'))][(_0x79d5('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3eed93);}_0x1857d6[_0x49b31e[_0x79d5('0x60')][_0x79d5('0x9f')]]=_0x49b31e['body'][_0x79d5('0x96')];return db[_0x79d5('0xa2')][_0x79d5('0x57')]({'where':{'id':_0x49b31e[_0x79d5('0x83')][_0x79d5('0x93')]},'include':[{'model':db[_0x79d5('0x8c')],'as':_0x79d5('0xa3'),'where':_0x1857d6,'limit':0x1,'order':[[_0x79d5('0x92'),_0x79d5('0xa4')]]}]});})[_0x79d5('0x1d')](handleEntityNotFound(_0x3cb6a1,null))[_0x79d5('0x1d')](function(_0x160a31){if(_0x160a31){_0x49b31e[_0x79d5('0xa5')]=_['omit'](_0x160a31,[_0x79d5('0xa3')]);if(_0x160a31[_0x79d5('0xa3')][_0x79d5('0x48')]){return _0x160a31[_0x79d5('0xa3')][0x0];}var _0x4b677c=_[_0x79d5('0x16')](_0x49b31e[_0x79d5('0x60')],{'firstName':_0x49b31e[_0x79d5('0x60')][_0x79d5('0x96')],'ListId':_0x160a31['id']});_0x4b677c[_0x49b31e['body']['mapKey']]=_0x49b31e[_0x79d5('0x60')][_0x79d5('0x96')];return db['CmContact'][_0x79d5('0x58')](_0x4b677c,{'fields':_0x2c79c9,'raw':!![]});}})['then'](handleEntityNotFound(_0x3cb6a1,null))[_0x79d5('0x1d')](function(_0x3dda29){if(_0x3dda29){_0x49b31e[_0x79d5('0xa6')]=_0x3dda29;var _0x32d982={'ContactId':_0x3dda29['id'],'phone':_0x49b31e[_0x79d5('0x60')][_0x79d5('0x96')],'WhatsappAccountId':_0x58e444[_0x79d5('0x61')]['id']};var _0x17da18={'ContactId':_0x3dda29['id'],'WhatsappAccountId':_0x58e444['params']['id'],'closed':![]};return db[_0x79d5('0xa7')][_0x79d5('0x57')]({'where':_0x17da18})[_0x79d5('0x1d')](function(_0x30669f){if(_0x30669f){return[_0x30669f,![]];}return db[_0x79d5('0xa7')][_0x79d5('0x58')](_0x32d982)[_0x79d5('0x1d')](function(_0x3f7b27){return[_0x3f7b27,!![]];});});}})[_0x79d5('0x6e')](function(_0x1a2629,_0x1dd9ff){_0x49b31e[_0x79d5('0xa8')]=_0x1a2629[_0x79d5('0x35')]({'plain':!![]});_0x49b31e['interaction']['created']=![];if(_0x1dd9ff){if(_0x49b31e[_0x79d5('0x83')][_0x79d5('0xa9')]){_0x49b31e['applications'][_0x79d5('0xaa')]({'id':0x0,'priority':_0x49b31e[_0x79d5('0xab')][_0x79d5('0x48')]+0x1,'app':_0x79d5('0xac'),'appdata':_0x79d5('0xad'),'interval':_0x79d5('0xae')});}_0x49b31e['interaction'][_0x79d5('0xaf')]=!![];}return db[_0x79d5('0x87')]['create']({'phone':_0x49b31e[_0x79d5('0x60')]['from'],'messageId':_0x49b31e[_0x79d5('0x60')][_0x79d5('0x99')],'body':_0x49b31e[_0x79d5('0x60')][_0x79d5('0x60')],'WhatsappAccountId':_0x58e444[_0x79d5('0x61')]['id'],'WhatsappInteractionId':_0x1a2629['id'],'direction':'in','ContactId':_0x1a2629[_0x79d5('0xb0')],'AttachmentId':_0x49b31e[_0x79d5('0x60')][_0x79d5('0xb1')]});})[_0x79d5('0x1d')](function(_0x1e7392){_0x49b31e[_0x79d5('0x26')]=_0x1e7392;if(_0x49b31e['interaction'][_0x79d5('0xb2')]){return db[_0x79d5('0x74')][_0x79d5('0x57')]({'attributes':['id',_0x79d5('0x39')],'where':{'id':_0x49b31e[_0x79d5('0xa8')][_0x79d5('0xb2')]}})[_0x79d5('0x1d')](function(_0x14f31e){if(_0x14f31e){_0x49b31e[_0x79d5('0xab')][_0x79d5('0xb3')]({'id':0x0,'priority':0x0,'app':_0x79d5('0xb4'),'appdata':_0x14f31e[_0x79d5('0x39')]+','+(_0x49b31e[_0x79d5('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0x79d5('0xae')});}return respondWithRpcPromise(_0x79d5('0xb5'),_0x79d5('0xb6'),_0x49b31e);});}return respondWithRpcPromise('Start',_0x79d5('0xb6'),_0x49b31e);})[_0x79d5('0x1d')](function(_0x115989){if(_0x115989){var _0x2338d6=0xc8;var _0x54521f=_0x79d5('0xb7');logger[_0x79d5('0x1e')](_0x79d5('0x21'),_0x54521f,_0x2338d6,_0x79d5('0xb8'));logger['debug'](_0x79d5('0xb9'),_0x54521f,_0x2338d6,_0x79d5('0xb8'),JSON[_0x79d5('0x22')](_0x115989));if(_0x49b31e[_0x79d5('0x83')][_0x79d5('0x3f')]===_0x79d5('0x95')){return _0x3cb6a1[_0x79d5('0x29')](_0x2338d6)['set']('Content-Type',_0x79d5('0xba'))[_0x79d5('0x7e')](_0x79d5('0xbb'));}else{return _0x3cb6a1[_0x79d5('0x29')](_0x2338d6)[_0x79d5('0x2a')](_0x115989);}}});})['catch'](handleError(_0x3cb6a1,null));};exports[_0x79d5('0x7e')]=function(_0x477956,_0x369a84,_0x39cabb){var _0x3740f3,_0x4f8b78,_0x3b794e;if(_[_0x79d5('0x9c')](_0x477956['body'][_0x79d5('0x60')])||_0x477956['body']['body']===''){throw new db[(_0x79d5('0x8d'))]['ValidationError'](_0x79d5('0x9e'));}if(_['isNil'](_0x477956[_0x79d5('0x60')]['to'])){throw new db[(_0x79d5('0x8d'))][(_0x79d5('0x8e'))](_0x79d5('0xbc'));}_0x3740f3=_0x477956['body']['to'];return db[_0x79d5('0x3c')][_0x79d5('0x57')]({'where':{'id':_0x477956[_0x79d5('0x61')]['id']},'include':[{'model':db[_0x79d5('0xa2')],'as':_0x79d5('0xbd'),'include':[{'model':db['CmContact'],'as':_0x79d5('0xa3'),'where':{'mobile':_0x3740f3},'limit':0x1,'order':[[_0x79d5('0x92'),'DESC']]}]}]})[_0x79d5('0x1d')](handleEntityNotFound(_0x369a84,null))[_0x79d5('0x1d')](function(_0x2a0940){if(_0x2a0940&&_0x2a0940[_0x79d5('0xbd')]){_0x4f8b78=_0x2a0940[_0x79d5('0x35')]({'plain':!![]});if(_0x4f8b78[_0x79d5('0xbd')]&&_0x4f8b78[_0x79d5('0xbd')][_0x79d5('0xa3')][_0x79d5('0x48')]){return _0x4f8b78['List'][_0x79d5('0xa3')][0x0];}return db['CmContact'][_0x79d5('0x58')](_['defaults'](_0x477956['body'],{'firstName':_0x3740f3,'mobile':_0x3740f3,'phone':_0x3740f3,'ListId':_0x4f8b78[_0x79d5('0x93')]}));}})['then'](handleEntityNotFound(_0x369a84,null))[_0x79d5('0x1d')](function(_0xba237c){if(_0xba237c){_0x3b794e=_0xba237c;return db[_0x79d5('0xa7')][_0x79d5('0x57')]({'where':{'ContactId':_0x3b794e['id'],'closed':![],'WhatsappAccountId':_0x4f8b78['id']}})[_0x79d5('0x1d')](function(_0x3e4f5b){if(_0x3e4f5b){return[_0x3e4f5b,![]];}return db[_0x79d5('0xa7')][_0x79d5('0x58')]({'UserId':_0x477956[_0x79d5('0x59')]['id'],'ContactId':_0x3b794e['id'],'WhatsappAccountId':_0x4f8b78['id'],'phone':_0x3740f3,'firstMsgDirection':_0x79d5('0xbe'),'Messages':[_['merge'](_0x477956[_0x79d5('0x60')],{'read':![],'body':_0x477956[_0x79d5('0x60')]['body'],'phone':_0x3740f3,'WhatsappAccountId':_0x4f8b78['id'],'UserId':_0x477956[_0x79d5('0x59')]['id'],'ContactId':_0x3b794e['id']})]},{'include':[{'model':db[_0x79d5('0x87')],'as':_0x79d5('0xbf')}]})[_0x79d5('0x1d')](function(_0x562348){return[_0x562348,!![]];});});}})['spread'](function(_0x39c60d,_0x55fd59){if(_0x55fd59){return _0x39c60d;}return db['WhatsappMessage']['create'](_[_0x79d5('0x4c')](_0x477956[_0x79d5('0x60')],{'read':![],'body':_0x477956[_0x79d5('0x60')][_0x79d5('0x60')],'phone':_0x3740f3,'WhatsappAccountId':_0x4f8b78['id'],'WhatsappInteractionId':_0x39c60d['id'],'UserId':_0x477956[_0x79d5('0x59')]['id'],'ContactId':_0x3b794e['id']}))[_0x79d5('0x1d')](function(_0x4a0a96){_0x39c60d['dataValues'][_0x79d5('0xbf')]=[];_0x39c60d[_0x79d5('0xc0')][_0x79d5('0xbf')][_0x79d5('0xaa')](_0x4a0a96[_0x79d5('0xc0')]);return _0x39c60d;});})[_0x79d5('0x1d')](respondWithResult(_0x369a84,null))[_0x79d5('0x53')](handleError(_0x369a84,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 08dec5f..5f6a94e 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 _0x0a2d=['events','../../mysqldb','WhatsappAccount','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x2bc7fa,_0x10771a){var _0x20a728=function(_0x42dd3f){while(--_0x42dd3f){_0x2bc7fa['push'](_0x2bc7fa['shift']());}};_0x20a728(++_0x10771a);}(_0x0a2d,0xee));var _0xd0a2=function(_0x37e5cb,_0xd5d8f5){_0x37e5cb=_0x37e5cb-0x0;var _0x3ba227=_0x0a2d[_0x37e5cb];return _0x3ba227;};'use strict';var EventEmitter=require(_0xd0a2('0x0'));var WhatsappAccount=require(_0xd0a2('0x1'))['db'][_0xd0a2('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd0a2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18e1f1){return function(_0x5d3209,_0x213f1e,_0x34fe60){WhatsappAccountEvents['emit'](_0x18e1f1+':'+_0x5d3209['id'],_0x5d3209);WhatsappAccountEvents[_0xd0a2('0x4')](_0x18e1f1,_0x5d3209);_0x34fe60(null);};}for(var e in events){if(events[_0xd0a2('0x5')](e)){var event=events[e];WhatsappAccount[_0xd0a2('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xca48=['events','WhatsappAccount','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x49a525,_0x13dc6c){var _0x331bbd=function(_0x1df324){while(--_0x1df324){_0x49a525['push'](_0x49a525['shift']());}};_0x331bbd(++_0x13dc6c);}(_0xca48,0x1ea));var _0x8ca4=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xca48[_0x5179a5];return _0x15c8ce;};'use strict';var EventEmitter=require(_0x8ca4('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x8ca4('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8ca4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5db504){return function(_0x224104,_0xa294f6,_0x3b85b9){WhatsappAccountEvents[_0x8ca4('0x3')](_0x5db504+':'+_0x224104['id'],_0x224104);WhatsappAccountEvents[_0x8ca4('0x3')](_0x5db504,_0x224104);_0x3b85b9(null);};}for(var e in events){if(events[_0x8ca4('0x4')](e)){var event=events[e];WhatsappAccount[_0x8ca4('0x5')](e,emitEvent(event));}}module[_0x8ca4('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 7f373ac..155ff71 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 _0xf6f7=['./whatsappAccount.attributes','define','WhatsappAccount','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf6f7,0x66));var _0x7f6f=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xf6f7[_0x22ee1e];return _0x49a5c9;};'use strict';var _=require(_0x7f6f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7f6f('0x1'));var BPromise=require(_0x7f6f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f6f('0x3'));var rimraf=require(_0x7f6f('0x4'));var config=require(_0x7f6f('0x5'));var attributes=require(_0x7f6f('0x6'));module['exports']=function(_0xfabb85,_0x27e279){return _0xfabb85[_0x7f6f('0x7')](_0x7f6f('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2362=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappAccount.attributes','exports'];(function(_0x152418,_0x516fe2){var _0xdfe238=function(_0x1cedf6){while(--_0x1cedf6){_0x152418['push'](_0x152418['shift']());}};_0xdfe238(++_0x516fe2);}(_0x2362,0x196));var _0x2236=function(_0x43c5f0,_0x115576){_0x43c5f0=_0x43c5f0-0x0;var _0x12b9ce=_0x2362[_0x43c5f0];return _0x12b9ce;};'use strict';var _=require(_0x2236('0x0'));var util=require(_0x2236('0x1'));var logger=require(_0x2236('0x2'))(_0x2236('0x3'));var moment=require(_0x2236('0x4'));var BPromise=require(_0x2236('0x5'));var rp=require(_0x2236('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2236('0x7'));var config=require('../../config/environment');var attributes=require(_0x2236('0x8'));module[_0x2236('0x9')]=function(_0x2771e6,_0x30f8ea){return _0x2771e6[_0x2236('0xa')](_0x2236('0xb'),attributes,{'tableName':_0x2236('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index f7157b5..886c51e 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 _0x1c45=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','find','options','raw','attributes','include','map','model','catch'];(function(_0x301b04,_0x584382){var _0x2f5043=function(_0x415474){while(--_0x415474){_0x301b04['push'](_0x301b04['shift']());}};_0x2f5043(++_0x584382);}(_0x1c45,0x1b0));var _0x51c4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c45[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var moment=require(_0x51c4('0x2'));var BPromise=require(_0x51c4('0x3'));var rs=require(_0x51c4('0x4'));var fs=require('fs');var Redis=require(_0x51c4('0x5'));var db=require(_0x51c4('0x6'))['db'];var utils=require(_0x51c4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x51c4('0x8'));var jayson=require(_0x51c4('0x9'));var client=jayson[_0x51c4('0xa')][_0x51c4('0xb')]({'port':0x232a});config[_0x51c4('0xc')]=_[_0x51c4('0xd')](config[_0x51c4('0xc')],{'host':_0x51c4('0xe'),'port':0x18eb});var socket=require(_0x51c4('0xf'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x51c4('0x10')](socket);function respondWithRpcPromise(_0x3f0716,_0x42e523,_0xab88cb){return new BPromise(function(_0x109781,_0x1882e7){return client['request'](_0x3f0716,_0xab88cb)[_0x51c4('0x11')](function(_0xb3ac98){logger[_0x51c4('0x12')](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));logger[_0x51c4('0x15')](_0x51c4('0x16'),_0x42e523,_0x51c4('0x14'),JSON[_0x51c4('0x17')](_0xb3ac98));if(_0xb3ac98[_0x51c4('0x18')]){if(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x19')]===0x1f4){logger[_0x51c4('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x1882e7(_0xb3ac98['error'][_0x51c4('0x1a')]);}logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);return _0x109781(_0xb3ac98[_0x51c4('0x18')][_0x51c4('0x1a')]);}else{logger['info'](_0x51c4('0x13'),_0x42e523,_0x51c4('0x14'));_0x109781(_0xb3ac98['result'][_0x51c4('0x1a')]);}})['catch'](function(_0x2b3e0b){logger[_0x51c4('0x18')](_0x51c4('0x13'),_0x42e523,_0x2b3e0b);_0x1882e7(_0x2b3e0b);});});}exports[_0x51c4('0x1b')]=function(_0x535690){var _0x3a67ed=this;return new Promise(function(_0x3842d8,_0x47878a){return db['WhatsappAccount'][_0x51c4('0x1c')]({'raw':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1e')]===undefined?!![]:![]:!![],'where':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')]['where']||null:null,'attributes':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x1f')]||null:null,'include':_0x535690[_0x51c4('0x1d')]?_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x535690[_0x51c4('0x1d')][_0x51c4('0x20')],function(_0x15154f){return{'model':db[_0x15154f[_0x51c4('0x22')]],'as':_0x15154f['as'],'attributes':_0x15154f['attributes'],'include':_0x15154f[_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x15154f[_0x51c4('0x20')],function(_0x29a148){return{'model':db[_0x29a148[_0x51c4('0x22')]],'as':_0x29a148['as'],'attributes':_0x29a148[_0x51c4('0x1f')],'include':_0x29a148[_0x51c4('0x20')]?_[_0x51c4('0x21')](_0x29a148[_0x51c4('0x20')],function(_0x3a01f2){return{'model':db[_0x3a01f2[_0x51c4('0x22')]],'as':_0x3a01f2['as'],'attributes':_0x3a01f2[_0x51c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x51c4('0x11')](function(_0x1cf544){logger[_0x51c4('0x12')]('ShowWhatsappAccount',_0x535690);logger[_0x51c4('0x15')](_0x51c4('0x1b'),_0x535690,JSON['stringify'](_0x1cf544));_0x3842d8(_0x1cf544);})[_0x51c4('0x23')](function(_0x2974a3){logger[_0x51c4('0x18')](_0x51c4('0x1b'),_0x2974a3[_0x51c4('0x1a')],_0x535690);_0x47878a(_0x3a67ed['error'](0x1f4,_0x2974a3[_0x51c4('0x1a')]));});});}; \ No newline at end of file +var _0x9f91=['model','attributes','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowWhatsappAccount','find','options','raw','where','include','map'];(function(_0x47087a,_0x5ef3c6){var _0x28fdf1=function(_0xe1618e){while(--_0xe1618e){_0x47087a['push'](_0x47087a['shift']());}};_0x28fdf1(++_0x5ef3c6);}(_0x9f91,0x14c));var _0x19f9=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x9f91[_0x4e7d25];return _0x526fe6;};'use strict';var _=require('lodash');var util=require(_0x19f9('0x0'));var moment=require(_0x19f9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19f9('0x2'))['db'];var utils=require(_0x19f9('0x3'));var logger=require('../../config/logger')(_0x19f9('0x4'));var config=require('../../config/environment');var jayson=require(_0x19f9('0x5'));var client=jayson['client'][_0x19f9('0x6')]({'port':0x232a});config[_0x19f9('0x7')]=_['defaults'](config[_0x19f9('0x7')],{'host':_0x19f9('0x8'),'port':0x18eb});var socket=require(_0x19f9('0x9'))(new Redis(config[_0x19f9('0x7')]));require(_0x19f9('0xa'))[_0x19f9('0xb')](socket);function respondWithRpcPromise(_0x14a68d,_0x469168,_0x56e3bf){return new BPromise(function(_0x964eb,_0x55c0ed){return client[_0x19f9('0xc')](_0x14a68d,_0x56e3bf)[_0x19f9('0xd')](function(_0x26a7b4){logger[_0x19f9('0xe')](_0x19f9('0xf'),_0x469168,'request\x20sent');logger[_0x19f9('0x10')](_0x19f9('0x11'),_0x469168,_0x19f9('0x12'),JSON[_0x19f9('0x13')](_0x26a7b4));if(_0x26a7b4[_0x19f9('0x14')]){if(_0x26a7b4['error'][_0x19f9('0x15')]===0x1f4){logger[_0x19f9('0x14')](_0x19f9('0xf'),_0x469168,_0x26a7b4[_0x19f9('0x14')][_0x19f9('0x16')]);return _0x55c0ed(_0x26a7b4[_0x19f9('0x14')][_0x19f9('0x16')]);}logger[_0x19f9('0x14')](_0x19f9('0xf'),_0x469168,_0x26a7b4[_0x19f9('0x14')]['message']);return _0x964eb(_0x26a7b4[_0x19f9('0x14')][_0x19f9('0x16')]);}else{logger[_0x19f9('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x469168,_0x19f9('0x12'));_0x964eb(_0x26a7b4['result'][_0x19f9('0x16')]);}})[_0x19f9('0x17')](function(_0x3c402a){logger['error'](_0x19f9('0xf'),_0x469168,_0x3c402a);_0x55c0ed(_0x3c402a);});});}exports[_0x19f9('0x18')]=function(_0x3462e4){var _0x2ec851=this;return new Promise(function(_0x200268,_0x39c048){return db['WhatsappAccount'][_0x19f9('0x19')]({'raw':_0x3462e4['options']?_0x3462e4[_0x19f9('0x1a')][_0x19f9('0x1b')]===undefined?!![]:![]:!![],'where':_0x3462e4[_0x19f9('0x1a')]?_0x3462e4[_0x19f9('0x1a')][_0x19f9('0x1c')]||null:null,'attributes':_0x3462e4[_0x19f9('0x1a')]?_0x3462e4[_0x19f9('0x1a')]['attributes']||null:null,'include':_0x3462e4['options']?_0x3462e4[_0x19f9('0x1a')][_0x19f9('0x1d')]?_[_0x19f9('0x1e')](_0x3462e4['options'][_0x19f9('0x1d')],function(_0x1ae976){return{'model':db[_0x1ae976['model']],'as':_0x1ae976['as'],'attributes':_0x1ae976['attributes'],'include':_0x1ae976['include']?_[_0x19f9('0x1e')](_0x1ae976[_0x19f9('0x1d')],function(_0x3c9f72){return{'model':db[_0x3c9f72[_0x19f9('0x1f')]],'as':_0x3c9f72['as'],'attributes':_0x3c9f72[_0x19f9('0x20')],'include':_0x3c9f72[_0x19f9('0x1d')]?_[_0x19f9('0x1e')](_0x3c9f72[_0x19f9('0x1d')],function(_0x42b6a0){return{'model':db[_0x42b6a0[_0x19f9('0x1f')]],'as':_0x42b6a0['as'],'attributes':_0x42b6a0[_0x19f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x19f9('0xd')](function(_0x5dcfeb){logger['info'](_0x19f9('0x18'),_0x3462e4);logger[_0x19f9('0x10')](_0x19f9('0x18'),_0x3462e4,JSON['stringify'](_0x5dcfeb));_0x200268(_0x5dcfeb);})[_0x19f9('0x17')](function(_0x2f5763){logger[_0x19f9('0x14')](_0x19f9('0x18'),_0x2f5763['message'],_0x3462e4);_0x39c048(_0x2ec851[_0x19f9('0x14')](0x1f4,_0x2f5763[_0x19f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0b75bdb..eb04b64 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 _0xa632=['remove','update','emit','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x32bfe1,_0x155613){var _0x5b8556=function(_0xdd83ee){while(--_0xdd83ee){_0x32bfe1['push'](_0x32bfe1['shift']());}};_0x5b8556(++_0x155613);}(_0xa632,0xb3));var _0x2a63=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa632[_0x481bf7];return _0x461787;};'use strict';var WhatsappAccountEvents=require(_0x2a63('0x0'));var events=['save',_0x2a63('0x1'),_0x2a63('0x2')];function createListener(_0x1bfdda,_0x56b59e){return function(_0x45c872){_0x56b59e[_0x2a63('0x3')](_0x1bfdda,_0x45c872);};}function removeListener(_0x1ec7fa,_0x3c300e){return function(){WhatsappAccountEvents['removeListener'](_0x1ec7fa,_0x3c300e);};}exports[_0x2a63('0x4')]=function(_0x5ef8c2){for(var _0x247d7f=0x0,_0x5ef626=events['length'];_0x247d7f<_0x5ef626;_0x247d7f++){var _0x9124e5=events[_0x247d7f];var _0x428424=createListener(_0x2a63('0x5')+_0x9124e5,_0x5ef8c2);WhatsappAccountEvents['on'](_0x9124e5,_0x428424);}}; \ No newline at end of file +var _0x0183=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x14bf8b,_0x186798){var _0x571eee=function(_0xf53e1f){while(--_0xf53e1f){_0x14bf8b['push'](_0x14bf8b['shift']());}};_0x571eee(++_0x186798);}(_0x0183,0x199));var _0x3018=function(_0x3aac10,_0x33082f){_0x3aac10=_0x3aac10-0x0;var _0xf0bfcf=_0x0183[_0x3aac10];return _0xf0bfcf;};'use strict';var WhatsappAccountEvents=require(_0x3018('0x0'));var events=[_0x3018('0x1'),_0x3018('0x2'),_0x3018('0x3')];function createListener(_0x6b5b9f,_0x1d2588){return function(_0x18f5df){_0x1d2588[_0x3018('0x4')](_0x6b5b9f,_0x18f5df);};}function removeListener(_0x410c1d,_0x1a53a8){return function(){WhatsappAccountEvents[_0x3018('0x5')](_0x410c1d,_0x1a53a8);};}exports['register']=function(_0x55968f){for(var _0x48b6ca=0x0,_0x241989=events[_0x3018('0x6')];_0x48b6ca<_0x241989;_0x48b6ca++){var _0x2758b6=events[_0x48b6ca];var _0x526d51=createListener(_0x3018('0x7')+_0x2758b6,_0x55968f);WhatsappAccountEvents['on'](_0x2758b6,_0x526d51);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f926766..1a8c0a3 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 _0xd32a=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x38f137,_0x56e82b){var _0x564380=function(_0x3768ae){while(--_0x3768ae){_0x38f137['push'](_0x38f137['shift']());}};_0x564380(++_0x56e82b);}(_0xd32a,0x157));var _0xad32=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd32a[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xad32('0x0'));var util=require(_0xad32('0x1'));var path=require(_0xad32('0x2'));var timeout=require(_0xad32('0x3'));var express=require(_0xad32('0x4'));var router=express['Router']();var fs_extra=require(_0xad32('0x5'));var auth=require(_0xad32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xad32('0x7'));var controller=require(_0xad32('0x8'));router[_0xad32('0x9')]('/',auth[_0xad32('0xa')](),controller[_0xad32('0xb')]);router[_0xad32('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad32('0xc')]);router[_0xad32('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xad32('0xe')](_0xad32('0xf'),auth[_0xad32('0xa')](),controller[_0xad32('0x10')]);router[_0xad32('0x11')](_0xad32('0xf'),auth[_0xad32('0xa')](),controller[_0xad32('0x12')]);module[_0xad32('0x13')]=router; \ No newline at end of file +var _0x4290=['isAuthenticated','index','put','/:id','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4290,0x9c));var _0x0429=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0x4290[_0x5b7606];return _0x186584;};'use strict';var multer=require('multer');var util=require(_0x0429('0x0'));var path=require(_0x0429('0x1'));var timeout=require('connect-timeout');var express=require(_0x0429('0x2'));var router=express[_0x0429('0x3')]();var fs_extra=require(_0x0429('0x4'));var auth=require(_0x0429('0x5'));var interaction=require(_0x0429('0x6'));var config=require(_0x0429('0x7'));var controller=require('./whatsappApplication.controller');router[_0x0429('0x8')]('/',auth[_0x0429('0x9')](),controller[_0x0429('0xa')]);router[_0x0429('0x8')]('/:id',auth[_0x0429('0x9')](),controller['show']);router['post']('/',auth[_0x0429('0x9')](),controller['create']);router[_0x0429('0xb')](_0x0429('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0429('0xd')](_0x0429('0xc'),auth[_0x0429('0x9')](),controller[_0x0429('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 92f5c4c..7882e91 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 _0x4ff9=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2242a5,_0x3604cf){var _0x422ac8=function(_0xf455df){while(--_0xf455df){_0x2242a5['push'](_0x2242a5['shift']());}};_0x422ac8(++_0x3604cf);}(_0x4ff9,0x1d7));var _0x94ff=function(_0x1de5f6,_0x249cae){_0x1de5f6=_0x1de5f6-0x0;var _0x3aa6f2=_0x4ff9[_0x1de5f6];return _0x3aa6f2;};'use strict';var Sequelize=require(_0x94ff('0x0'));module[_0x94ff('0x1')]={'priority':{'type':Sequelize[_0x94ff('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x94ff('0x3')],'allowNull':![],'defaultValue':_0x94ff('0x4')},'appdata':{'type':Sequelize[_0x94ff('0x5')]()},'description':{'type':Sequelize[_0x94ff('0x3')]},'interval':{'type':Sequelize[_0x94ff('0x3')],'defaultValue':_0x94ff('0x6')}}; \ No newline at end of file +var _0x5552=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5552,0xdd));var _0x2555=function(_0x40a046,_0x54b2a3){_0x40a046=_0x40a046-0x0;var _0x5f35b4=_0x5552[_0x40a046];return _0x5f35b4;};'use strict';var Sequelize=require(_0x2555('0x0'));module[_0x2555('0x1')]={'priority':{'type':Sequelize[_0x2555('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2555('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2555('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2555('0x3')],'defaultValue':_0x2555('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1572047..f9a6802 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 _0x27eb=['to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x312686,_0x4a942d){var _0x62a376=function(_0x31f5df){while(--_0x31f5df){_0x312686['push'](_0x312686['shift']());}};_0x62a376(++_0x4a942d);}(_0x27eb,0xd0));var _0xb27e=function(_0x476f79,_0x4c61b6){_0x476f79=_0x476f79-0x0;var _0x2bc4c7=_0x27eb[_0x476f79];return _0x2bc4c7;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x17')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x18')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x19')](_0x1b55e2)[_0xb27e('0x1a')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=typeof _0x522bbf[_0xb27e('0x1b')]===_0xb27e('0x1c')&&typeof _0x522bbf[_0xb27e('0x1d')]===_0xb27e('0x1c');var _0x25ce70=_0x26ec32[_0xb27e('0x1e')];var _0x317f4e=_0x1d14bb?0x0:_0x522bbf['offset'];var _0x8be243=_0x1d14bb?_0x26ec32[_0xb27e('0x1e')]:_0x522bbf[_0xb27e('0x1b')]+_0x522bbf['limit'];var _0x352856;if(_0x8be243>=_0x25ce70){_0x8be243=_0x25ce70;_0x352856=0xc8;}else{_0x352856=0xce;}_0x28cc6d['status'](_0x352856);return _0x28cc6d['set'](_0xb27e('0x1f'),_0x317f4e+'-'+_0x8be243+'/'+_0x25ce70)[_0xb27e('0x1a')](_0x26ec32);}return null;};}function patchUpdates(_0x4ec66c){return function(_0x2a78c0){try{jsonpatch[_0xb27e('0x20')](_0x2a78c0,_0x4ec66c,!![]);}catch(_0x16c950){return BPromise[_0xb27e('0x21')](_0x16c950);}return _0x2a78c0['save']();};}function saveUpdates(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x22')](_0x3c9e21)['then'](function(_0x58fc84){return _0x58fc84;});}return null;};}function removeEntity(_0x2146c0,_0xfbc258){return function(_0x3703ab){if(_0x3703ab){return _0x3703ab[_0xb27e('0x23')]()[_0xb27e('0x24')](function(){_0x2146c0['status'](0xcc)[_0xb27e('0x18')]();});}};}function handleEntityNotFound(_0x4cba0b,_0x3972bc){return function(_0x1ac460){if(!_0x1ac460){_0x4cba0b[_0xb27e('0x17')](0x194);}return _0x1ac460;};}function handleError(_0x3fbc78,_0x3254fb){_0x3254fb=_0x3254fb||0x1f4;return function(_0x4dab95){logger[_0xb27e('0x25')](_0x4dab95['stack']);if(_0x4dab95[_0xb27e('0x26')]){delete _0x4dab95[_0xb27e('0x26')];}_0x3fbc78[_0xb27e('0x19')](_0x3254fb)[_0xb27e('0x27')](_0x4dab95);};}exports[_0xb27e('0x28')]=function(_0x35169a,_0xd27061){var _0x125c0b={},_0x42c5de={},_0x4ef0e6={'count':0x0,'rows':[]};var _0x377d79=_[_0xb27e('0x29')](db[_0xb27e('0x2a')][_0xb27e('0x2b')],function(_0x58a1a9){return{'name':_0x58a1a9[_0xb27e('0x2c')],'type':_0x58a1a9[_0xb27e('0x2d')][_0xb27e('0x2e')]};});_0x42c5de[_0xb27e('0x2f')]=_[_0xb27e('0x29')](_0x377d79,_0xb27e('0x26'));_0x42c5de[_0xb27e('0x30')]=_['keys'](_0x35169a['query']);_0x42c5de[_0xb27e('0x31')]=_['intersection'](_0x42c5de[_0xb27e('0x2f')],_0x42c5de['query']);_0x125c0b[_0xb27e('0x32')]=_[_0xb27e('0x33')](_0x42c5de[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x35169a[_0xb27e('0x30')][_0xb27e('0x34')]));_0x125c0b['attributes']=_0x125c0b[_0xb27e('0x32')]['length']?_0x125c0b[_0xb27e('0x32')]:_0x42c5de['model'];if(!_0x35169a[_0xb27e('0x30')]['hasOwnProperty'](_0xb27e('0x35'))){_0x125c0b[_0xb27e('0x1d')]=qs['limit'](_0x35169a['query'][_0xb27e('0x1d')]);_0x125c0b['offset']=qs['offset'](_0x35169a['query'][_0xb27e('0x1b')]);}_0x125c0b[_0xb27e('0x36')]=qs['sort'](_0x35169a[_0xb27e('0x30')][_0xb27e('0x37')]);_0x125c0b['where']=qs['filters'](_[_0xb27e('0x38')](_0x35169a['query'],_0x42c5de[_0xb27e('0x31')]),_0x377d79);if(_0x35169a['query'][_0xb27e('0x39')]){_0x125c0b[_0xb27e('0x3a')]=_[_0xb27e('0x3b')](_0x125c0b[_0xb27e('0x3a')],{'$or':_[_0xb27e('0x29')](_0x377d79,function(_0x1239d4){if(_0x1239d4[_0xb27e('0x2d')]!==_0xb27e('0x3c')){var _0x533343={};_0x533343[_0x1239d4[_0xb27e('0x26')]]={'$like':'%'+_0x35169a[_0xb27e('0x30')][_0xb27e('0x39')]+'%'};return _0x533343;}})});}_0x125c0b=_[_0xb27e('0x3b')]({},_0x125c0b,_0x35169a[_0xb27e('0x3d')]);var _0x564699={'where':_0x125c0b['where']};return db[_0xb27e('0x2a')][_0xb27e('0x1e')](_0x564699)[_0xb27e('0x24')](function(_0x5c7742){_0x4ef0e6[_0xb27e('0x1e')]=_0x5c7742;if(_0x35169a[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x125c0b[_0xb27e('0x3f')]=[{'all':!![]}];}return db[_0xb27e('0x2a')][_0xb27e('0x40')](_0x125c0b);})[_0xb27e('0x24')](function(_0x4d90bf){_0x4ef0e6['rows']=_0x4d90bf;return _0x4ef0e6;})[_0xb27e('0x24')](respondWithFilteredResult(_0xd27061,_0x125c0b))[_0xb27e('0x41')](handleError(_0xd27061,null));};exports[_0xb27e('0x42')]=function(_0x3272ba,_0x11fafd){var _0x42f5e3={'raw':!![],'where':{'id':_0x3272ba[_0xb27e('0x43')]['id']}},_0x2959f5={};_0x2959f5['model']=_[_0xb27e('0x44')](db[_0xb27e('0x2a')][_0xb27e('0x2b')]);_0x2959f5[_0xb27e('0x30')]=_['keys'](_0x3272ba[_0xb27e('0x30')]);_0x2959f5['filters']=_['intersection'](_0x2959f5[_0xb27e('0x2f')],_0x2959f5[_0xb27e('0x30')]);_0x42f5e3['attributes']=_[_0xb27e('0x33')](_0x2959f5[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x3272ba[_0xb27e('0x30')][_0xb27e('0x34')]));_0x42f5e3[_0xb27e('0x32')]=_0x42f5e3[_0xb27e('0x32')]['length']?_0x42f5e3[_0xb27e('0x32')]:_0x2959f5['model'];if(_0x3272ba[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x42f5e3[_0xb27e('0x3f')]=[{'all':!![]}];}_0x42f5e3=_[_0xb27e('0x3b')]({},_0x42f5e3,_0x3272ba[_0xb27e('0x3d')]);return db[_0xb27e('0x2a')]['find'](_0x42f5e3)['then'](handleEntityNotFound(_0x11fafd,null))[_0xb27e('0x24')](respondWithResult(_0x11fafd,null))[_0xb27e('0x41')](handleError(_0x11fafd,null));};exports[_0xb27e('0x45')]=function(_0x15b5cb,_0x238bb9){return db['WhatsappApplication'][_0xb27e('0x45')](_0x15b5cb[_0xb27e('0x46')],{})[_0xb27e('0x24')](respondWithResult(_0x238bb9,0xc9))[_0xb27e('0x41')](handleError(_0x238bb9,null));};exports[_0xb27e('0x22')]=function(_0x16a71b,_0x320b9c){if(_0x16a71b[_0xb27e('0x46')]['id']){delete _0x16a71b[_0xb27e('0x46')]['id'];}return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x16a71b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x320b9c,null))['then'](saveUpdates(_0x16a71b[_0xb27e('0x46')],null))[_0xb27e('0x24')](respondWithResult(_0x320b9c,null))[_0xb27e('0x41')](handleError(_0x320b9c,null));};exports[_0xb27e('0x23')]=function(_0x91095,_0x1af27d){return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x91095['params']['id']}})['then'](handleEntityNotFound(_0x1af27d,null))[_0xb27e('0x24')](removeEntity(_0x1af27d,null))[_0xb27e('0x41')](handleError(_0x1af27d,null));}; \ No newline at end of file +var _0xf8f2=['end','json','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','options','includeAll','include','findAll','rows','show','length','find','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8f2,0xc2));var _0x2f8f=function(_0xbc8bbb,_0x45ee2f){_0xbc8bbb=_0xbc8bbb-0x0;var _0x2fbd5c=_0xf8f2[_0xbc8bbb];return _0x2fbd5c;};'use strict';var emlformat=require(_0x2f8f('0x0'));var rimraf=require(_0x2f8f('0x1'));var zipdir=require(_0x2f8f('0x2'));var jsonpatch=require(_0x2f8f('0x3'));var rp=require('request-promise');var moment=require(_0x2f8f('0x4'));var BPromise=require(_0x2f8f('0x5'));var Mustache=require(_0x2f8f('0x6'));var util=require(_0x2f8f('0x7'));var path=require(_0x2f8f('0x8'));var sox=require('sox');var csv=require(_0x2f8f('0x9'));var ejs=require(_0x2f8f('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8f('0xb'));var _=require(_0x2f8f('0xc'));var squel=require(_0x2f8f('0xd'));var crypto=require(_0x2f8f('0xe'));var jsforce=require(_0x2f8f('0xf'));var deskjs=require(_0x2f8f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8f('0x11'));var Papa=require(_0x2f8f('0x12'));var Redis=require(_0x2f8f('0x13'));var authService=require(_0x2f8f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8f('0x15'));var hardwareService=require(_0x2f8f('0x16'));var logger=require('../../config/logger')(_0x2f8f('0x17'));var utils=require(_0x2f8f('0x18'));var config=require(_0x2f8f('0x19'));var licenseUtil=require(_0x2f8f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x76061b,_0xcbbb2b){_0xcbbb2b=_0xcbbb2b||0xcc;return function(_0x4e9312){if(_0x4e9312){return _0x76061b['sendStatus'](_0xcbbb2b);}return _0x76061b[_0x2f8f('0x1b')](_0xcbbb2b)[_0x2f8f('0x1c')]();};}function respondWithResult(_0x553035,_0x3327e3){_0x3327e3=_0x3327e3||0xc8;return function(_0x3c8461){if(_0x3c8461){return _0x553035[_0x2f8f('0x1b')](_0x3327e3)[_0x2f8f('0x1d')](_0x3c8461);}};}function respondWithFilteredResult(_0x1e0492,_0x593a53){return function(_0x5a1baf){if(_0x5a1baf){var _0x5d7dfa=typeof _0x593a53['offset']===_0x2f8f('0x1e')&&typeof _0x593a53[_0x2f8f('0x1f')]===_0x2f8f('0x1e');var _0x98a34c=_0x5a1baf[_0x2f8f('0x20')];var _0x54a5d2=_0x5d7dfa?0x0:_0x593a53['offset'];var _0x8329c4=_0x5d7dfa?_0x5a1baf['count']:_0x593a53['offset']+_0x593a53[_0x2f8f('0x1f')];var _0x100344;if(_0x8329c4>=_0x98a34c){_0x8329c4=_0x98a34c;_0x100344=0xc8;}else{_0x100344=0xce;}_0x1e0492[_0x2f8f('0x1b')](_0x100344);return _0x1e0492[_0x2f8f('0x21')](_0x2f8f('0x22'),_0x54a5d2+'-'+_0x8329c4+'/'+_0x98a34c)[_0x2f8f('0x1d')](_0x5a1baf);}return null;};}function patchUpdates(_0x420b47){return function(_0x417130){try{jsonpatch['apply'](_0x417130,_0x420b47,!![]);}catch(_0x2e94df){return BPromise[_0x2f8f('0x23')](_0x2e94df);}return _0x417130['save']();};}function saveUpdates(_0x56083a,_0x305b87){return function(_0x44fba4){if(_0x44fba4){return _0x44fba4[_0x2f8f('0x24')](_0x56083a)[_0x2f8f('0x25')](function(_0x2cc09e){return _0x2cc09e;});}return null;};}function removeEntity(_0x291f10,_0x35d7ca){return function(_0x3cf648){if(_0x3cf648){return _0x3cf648[_0x2f8f('0x26')]()[_0x2f8f('0x25')](function(){_0x291f10[_0x2f8f('0x1b')](0xcc)[_0x2f8f('0x1c')]();});}};}function handleEntityNotFound(_0x1bef3c,_0x55b591){return function(_0x38a16a){if(!_0x38a16a){_0x1bef3c[_0x2f8f('0x27')](0x194);}return _0x38a16a;};}function handleError(_0x14dc5f,_0x613faf){_0x613faf=_0x613faf||0x1f4;return function(_0x286fb2){logger['error'](_0x286fb2[_0x2f8f('0x28')]);if(_0x286fb2[_0x2f8f('0x29')]){delete _0x286fb2['name'];}_0x14dc5f['status'](_0x613faf)['send'](_0x286fb2);};}exports[_0x2f8f('0x2a')]=function(_0x5e3ffe,_0xb6207c){var _0x1f9ad1={},_0x125ed5={},_0x12924d={'count':0x0,'rows':[]};var _0x2ffba2=_[_0x2f8f('0x2b')](db[_0x2f8f('0x2c')][_0x2f8f('0x2d')],function(_0x4cd180){return{'name':_0x4cd180[_0x2f8f('0x2e')],'type':_0x4cd180[_0x2f8f('0x2f')][_0x2f8f('0x30')]};});_0x125ed5[_0x2f8f('0x31')]=_[_0x2f8f('0x2b')](_0x2ffba2,_0x2f8f('0x29'));_0x125ed5[_0x2f8f('0x32')]=_[_0x2f8f('0x33')](_0x5e3ffe[_0x2f8f('0x32')]);_0x125ed5['filters']=_[_0x2f8f('0x34')](_0x125ed5[_0x2f8f('0x31')],_0x125ed5[_0x2f8f('0x32')]);_0x1f9ad1[_0x2f8f('0x35')]=_['intersection'](_0x125ed5[_0x2f8f('0x31')],qs[_0x2f8f('0x36')](_0x5e3ffe[_0x2f8f('0x32')][_0x2f8f('0x36')]));_0x1f9ad1[_0x2f8f('0x35')]=_0x1f9ad1[_0x2f8f('0x35')]['length']?_0x1f9ad1[_0x2f8f('0x35')]:_0x125ed5[_0x2f8f('0x31')];if(!_0x5e3ffe[_0x2f8f('0x32')][_0x2f8f('0x37')](_0x2f8f('0x38'))){_0x1f9ad1[_0x2f8f('0x1f')]=qs['limit'](_0x5e3ffe['query']['limit']);_0x1f9ad1['offset']=qs[_0x2f8f('0x39')](_0x5e3ffe[_0x2f8f('0x32')][_0x2f8f('0x39')]);}_0x1f9ad1[_0x2f8f('0x3a')]=qs[_0x2f8f('0x3b')](_0x5e3ffe[_0x2f8f('0x32')][_0x2f8f('0x3b')]);_0x1f9ad1['where']=qs[_0x2f8f('0x3c')](_[_0x2f8f('0x3d')](_0x5e3ffe[_0x2f8f('0x32')],_0x125ed5[_0x2f8f('0x3c')]),_0x2ffba2);if(_0x5e3ffe['query'][_0x2f8f('0x3e')]){_0x1f9ad1['where']=_['merge'](_0x1f9ad1['where'],{'$or':_[_0x2f8f('0x2b')](_0x2ffba2,function(_0x55b5e8){if(_0x55b5e8['type']!=='VIRTUAL'){var _0x25ab26={};_0x25ab26[_0x55b5e8['name']]={'$like':'%'+_0x5e3ffe[_0x2f8f('0x32')]['filter']+'%'};return _0x25ab26;}})});}_0x1f9ad1=_['merge']({},_0x1f9ad1,_0x5e3ffe[_0x2f8f('0x3f')]);var _0x57654c={'where':_0x1f9ad1['where']};return db[_0x2f8f('0x2c')][_0x2f8f('0x20')](_0x57654c)[_0x2f8f('0x25')](function(_0x49c158){_0x12924d[_0x2f8f('0x20')]=_0x49c158;if(_0x5e3ffe[_0x2f8f('0x32')][_0x2f8f('0x40')]){_0x1f9ad1[_0x2f8f('0x41')]=[{'all':!![]}];}return db[_0x2f8f('0x2c')][_0x2f8f('0x42')](_0x1f9ad1);})[_0x2f8f('0x25')](function(_0xaf0bee){_0x12924d[_0x2f8f('0x43')]=_0xaf0bee;return _0x12924d;})[_0x2f8f('0x25')](respondWithFilteredResult(_0xb6207c,_0x1f9ad1))['catch'](handleError(_0xb6207c,null));};exports[_0x2f8f('0x44')]=function(_0x5d0cb1,_0x4af90b){var _0x8bf041={'raw':!![],'where':{'id':_0x5d0cb1['params']['id']}},_0x5d665b={};_0x5d665b[_0x2f8f('0x31')]=_['keys'](db[_0x2f8f('0x2c')][_0x2f8f('0x2d')]);_0x5d665b[_0x2f8f('0x32')]=_[_0x2f8f('0x33')](_0x5d0cb1[_0x2f8f('0x32')]);_0x5d665b[_0x2f8f('0x3c')]=_[_0x2f8f('0x34')](_0x5d665b[_0x2f8f('0x31')],_0x5d665b[_0x2f8f('0x32')]);_0x8bf041[_0x2f8f('0x35')]=_[_0x2f8f('0x34')](_0x5d665b[_0x2f8f('0x31')],qs[_0x2f8f('0x36')](_0x5d0cb1[_0x2f8f('0x32')][_0x2f8f('0x36')]));_0x8bf041[_0x2f8f('0x35')]=_0x8bf041[_0x2f8f('0x35')][_0x2f8f('0x45')]?_0x8bf041[_0x2f8f('0x35')]:_0x5d665b[_0x2f8f('0x31')];if(_0x5d0cb1[_0x2f8f('0x32')][_0x2f8f('0x40')]){_0x8bf041['include']=[{'all':!![]}];}_0x8bf041=_['merge']({},_0x8bf041,_0x5d0cb1[_0x2f8f('0x3f')]);return db['WhatsappApplication'][_0x2f8f('0x46')](_0x8bf041)[_0x2f8f('0x25')](handleEntityNotFound(_0x4af90b,null))['then'](respondWithResult(_0x4af90b,null))['catch'](handleError(_0x4af90b,null));};exports['create']=function(_0x3c228e,_0x3c1cf4){return db[_0x2f8f('0x2c')]['create'](_0x3c228e[_0x2f8f('0x47')],{})[_0x2f8f('0x25')](respondWithResult(_0x3c1cf4,0xc9))[_0x2f8f('0x48')](handleError(_0x3c1cf4,null));};exports[_0x2f8f('0x24')]=function(_0x5d9938,_0x27d35e){if(_0x5d9938['body']['id']){delete _0x5d9938['body']['id'];}return db['WhatsappApplication'][_0x2f8f('0x46')]({'where':{'id':_0x5d9938[_0x2f8f('0x49')]['id']}})[_0x2f8f('0x25')](handleEntityNotFound(_0x27d35e,null))[_0x2f8f('0x25')](saveUpdates(_0x5d9938[_0x2f8f('0x47')],null))[_0x2f8f('0x25')](respondWithResult(_0x27d35e,null))[_0x2f8f('0x48')](handleError(_0x27d35e,null));};exports[_0x2f8f('0x26')]=function(_0x2cf8d9,_0x34bcdc){return db[_0x2f8f('0x2c')][_0x2f8f('0x46')]({'where':{'id':_0x2cf8d9[_0x2f8f('0x49')]['id']}})[_0x2f8f('0x25')](handleEntityNotFound(_0x34bcdc,null))['then'](removeEntity(_0x34bcdc,null))[_0x2f8f('0x48')](handleError(_0x34bcdc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index bb0dbcd..5cb9342 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 _0xe5d5=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe5d5,0x156));var _0x5e5d=function(_0xb5883,_0x3069f4){_0xb5883=_0xb5883-0x0;var _0x45c919=_0xe5d5[_0xb5883];return _0x45c919;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e5d('0x0'))('api');var moment=require(_0x5e5d('0x1'));var BPromise=require('bluebird');var rp=require(_0x5e5d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var attributes=require(_0x5e5d('0x5'));module[_0x5e5d('0x6')]=function(_0x13bcb7,_0x39077f){return _0x13bcb7[_0x5e5d('0x7')](_0x5e5d('0x8'),attributes,{'tableName':_0x5e5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e5d('0xa'),'collate':_0x5e5d('0xb')});}; \ No newline at end of file +var _0xa1a5=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x24b2e0,_0x3d68bc){var _0x4bb1cb=function(_0x409a6b){while(--_0x409a6b){_0x24b2e0['push'](_0x24b2e0['shift']());}};_0x4bb1cb(++_0x3d68bc);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x4e96a2,_0x18a3fb){_0x4e96a2=_0x4e96a2-0x0;var _0x53d9ac=_0xa1a5[_0x4e96a2];return _0x53d9ac;};'use strict';var _=require(_0x5a1a('0x0'));var util=require('util');var logger=require(_0x5a1a('0x1'))(_0x5a1a('0x2'));var moment=require(_0x5a1a('0x3'));var BPromise=require(_0x5a1a('0x4'));var rp=require(_0x5a1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a1a('0x6'));var config=require(_0x5a1a('0x7'));var attributes=require(_0x5a1a('0x8'));module[_0x5a1a('0x9')]=function(_0x1b718f,_0x27f71f){return _0x1b718f[_0x5a1a('0xa')]('WhatsappApplication',attributes,{'tableName':_0x5a1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a1a('0xc'),'collate':_0x5a1a('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b7df321..27f9d9b 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 _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4488ac,_0x2e1b0c){var _0xdef698=function(_0x3c83c9){while(--_0x3c83c9){_0x4488ac['push'](_0x4488ac['shift']());}};_0xdef698(++_0x2e1b0c);}(_0x98a8,0x12c));var _0x898a=function(_0x2057aa,_0x523872){_0x2057aa=_0x2057aa-0x0;var _0x255f6d=_0x98a8[_0x2057aa];return _0x255f6d;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0xac31=['code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0xac31,0xca));var _0x1ac3=function(_0x264205,_0x708ceb){_0x264205=_0x264205-0x0;var _0x59d3d9=_0xac31[_0x264205];return _0x59d3d9;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4c7c695..d5aef47 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 _0xafb9=['update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsappinteraction:update'];(function(_0x7ef952,_0x43faeb){var _0x421d44=function(_0x29c936){while(--_0x29c936){_0x7ef952['push'](_0x7ef952['shift']());}};_0x421d44(++_0x43faeb);}(_0xafb9,0x68));var _0x9afb=function(_0x24a30c,_0x332d98){_0x24a30c=_0x24a30c-0x0;var _0x4b4a0e=_0xafb9[_0x24a30c];return _0x4b4a0e;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var fs_extra=require(_0x9afb('0x6'));var auth=require(_0x9afb('0x7'));var interaction=require(_0x9afb('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x9afb('0x9')]('/',auth['isAuthenticated'](),controller[_0x9afb('0xa')]);router['get']('/describe',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0x9')]('/:id',auth[_0x9afb('0xb')](),controller[_0x9afb('0xd')]);router[_0x9afb('0x9')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller['getMessages']);router['get'](_0x9afb('0xf'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0x12')]);router[_0x9afb('0x11')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x13')]);router['post'](_0x9afb('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x9afb('0x15'),_0x9afb('0x16')),controller[_0x9afb('0x17')]);router[_0x9afb('0x18')](_0x9afb('0x19'),auth[_0x9afb('0xb')](),interaction[_0x9afb('0x1a')]('whatsapp',_0x9afb('0x1b')),controller[_0x9afb('0x1c')]);router[_0x9afb('0x1d')](_0x9afb('0x19'),auth[_0x9afb('0xb')](),interaction['tracked'](_0x9afb('0x15'),'whatsappinteraction:destroy'),controller[_0x9afb('0x1e')]);router[_0x9afb('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x9afb('0x1f')]);module[_0x9afb('0x20')]=router; \ No newline at end of file +var _0x8958=['destroy','removeTags','util','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x20f92e,_0x36fb5a){var _0x7193=function(_0x3eed79){while(--_0x3eed79){_0x20f92e['push'](_0x20f92e['shift']());}};_0x7193(++_0x36fb5a);}(_0x8958,0x93));var _0x8895=function(_0x33c3be,_0xaba6de){_0x33c3be=_0x33c3be-0x0;var _0x5643fb=_0x8958[_0x33c3be];return _0x5643fb;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get']('/',auth[_0x8895('0x5')](),controller[_0x8895('0x6')]);router[_0x8895('0x7')](_0x8895('0x8'),auth[_0x8895('0x5')](),controller['describe']);router[_0x8895('0x7')](_0x8895('0x9'),auth[_0x8895('0x5')](),controller[_0x8895('0xa')]);router[_0x8895('0x7')](_0x8895('0xb'),auth[_0x8895('0x5')](),controller[_0x8895('0xc')]);router[_0x8895('0x7')](_0x8895('0xd'),auth['isAuthenticated'](),controller[_0x8895('0xe')]);router[_0x8895('0xf')]('/',auth[_0x8895('0x5')](),controller[_0x8895('0x10')]);router[_0x8895('0xf')](_0x8895('0xb'),auth['isAuthenticated'](),controller[_0x8895('0x11')]);router[_0x8895('0xf')](_0x8895('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x8895('0x13'),'whatsappinteraction:addtags'),controller[_0x8895('0x14')]);router[_0x8895('0x15')](_0x8895('0x9'),auth[_0x8895('0x5')](),interaction[_0x8895('0x16')]('whatsapp',_0x8895('0x17')),controller[_0x8895('0x18')]);router[_0x8895('0x19')](_0x8895('0x9'),auth[_0x8895('0x5')](),interaction[_0x8895('0x16')](_0x8895('0x13'),_0x8895('0x1a')),controller[_0x8895('0x1b')]);router[_0x8895('0x19')](_0x8895('0x12'),auth[_0x8895('0x5')](),controller[_0x8895('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9f70caa..6d8b794 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 _0x9b6d=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x564e64,_0x5d9c26){var _0x5caffb=function(_0x230899){while(--_0x230899){_0x564e64['push'](_0x564e64['shift']());}};_0x5caffb(++_0x5d9c26);}(_0x9b6d,0x105));var _0xd9b6=function(_0x2808a4,_0xb44d5){_0x2808a4=_0x2808a4-0x0;var _0x2b0cab=_0x9b6d[_0x2808a4];return _0x2b0cab;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd9b6('0x0'));module[_0xd9b6('0x1')]={'closed':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd9b6('0x3')]},'disposition':{'type':Sequelize[_0xd9b6('0x4')]},'secondDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd9b6('0x4')]},'note':{'type':Sequelize[_0xd9b6('0x4')]},'phone':{'type':Sequelize[_0xd9b6('0x4')]},'read1stAt':{'type':Sequelize[_0xd9b6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd9b6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd9b6('0x5')]('in',_0xd9b6('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd9b6('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1782=['out','ENUM','moment','exports','STRING','DATE'];(function(_0x1ad72a,_0xe7a746){var _0x37ff2f=function(_0x412022){while(--_0x412022){_0x1ad72a['push'](_0x1ad72a['shift']());}};_0x37ff2f(++_0xe7a746);}(_0x1782,0x188));var _0x2178=function(_0x4b3937,_0x15bf8d){_0x4b3937=_0x4b3937-0x0;var _0x170ec1=_0x1782[_0x4b3937];return _0x170ec1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2178('0x0'));module[_0x2178('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2178('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2178('0x2')]},'note':{'type':Sequelize[_0x2178('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2178('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2178('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2178('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2178('0x5')]('in','out'),'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 21e130e..9ec27b8 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 _0xacdd=['renderFile','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','unlinkSync','zip-dir','moment','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','name','index','rawAttributes','type','key','getOptions','findAll','whatsapp','catch','show','params','model','keys','WhatsappInteraction','query','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','color','removeTags','download','join','root','tmp','server','files','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','attachments','Attachment','createdAt','direction','secret','read','Account','Owner','mkdirSync','toString','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','out','System'];(function(_0x544999,_0x50742a){var _0x18a4c6=function(_0x2a5907){while(--_0x2a5907){_0x544999['push'](_0x544999['shift']());}};_0x18a4c6(++_0x50742a);}(_0xacdd,0x16f));var _0xdacd=function(_0x18b165,_0x40a7ea){_0x18b165=_0x18b165-0x0;var _0x1d8e19=_0xacdd[_0x18b165];return _0x1d8e19;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdacd('0x0'));var moment=require(_0xdacd('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xdacd('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdacd('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xdacd('0x4'));var pdf=require(_0xdacd('0x5'));var logger=require(_0xdacd('0x6'))(_0xdacd('0x7'));var config=require('../../config/environment');var db=require(_0xdacd('0x8'))['db'];config['redis']=_[_0xdacd('0x9')](config['redis'],{'host':_0xdacd('0xa'),'port':0x18eb});var socket=require(_0xdacd('0xb'))(new Redis(config[_0xdacd('0xc')]));require(_0xdacd('0xd'))[_0xdacd('0xe')](socket);function respondWithStatusCode(_0x2155c2,_0x80974e){_0x80974e=_0x80974e||0xcc;return function(_0x2ad769){if(_0x2ad769){return _0x2155c2[_0xdacd('0xf')](_0x80974e);}return _0x2155c2[_0xdacd('0x10')](_0x80974e)[_0xdacd('0x11')]();};}function respondWithResult(_0x26f437,_0x537a1a){_0x537a1a=_0x537a1a||0xc8;return function(_0x2dbffe){if(_0x2dbffe){return _0x26f437[_0xdacd('0x10')](_0x537a1a)['json'](_0x2dbffe);}};}function respondWithFilteredResult(_0x3131d6,_0x284853){return function(_0xb3e636){if(_0xb3e636){var _0x3327c0=typeof _0x284853[_0xdacd('0x12')]===_0xdacd('0x13')&&typeof _0x284853[_0xdacd('0x14')]===_0xdacd('0x13');var _0x110dc8=_0xb3e636[_0xdacd('0x15')];var _0x265a4c=_0x3327c0?0x0:_0x284853[_0xdacd('0x12')];var _0x3d6c06=_0x3327c0?_0xb3e636['count']:_0x284853[_0xdacd('0x12')]+_0x284853[_0xdacd('0x14')];var _0x98680e;if(_0x3d6c06>=_0x110dc8){_0x3d6c06=_0x110dc8;_0x98680e=0xc8;}else{_0x98680e=0xce;}_0x3131d6[_0xdacd('0x10')](_0x98680e);return _0x3131d6[_0xdacd('0x16')]('Content-Range',_0x265a4c+'-'+_0x3d6c06+'/'+_0x110dc8)[_0xdacd('0x17')](_0xb3e636);}return null;};}function saveUpdates(_0xc632f4){return function(_0x35a172){if(_0x35a172){return _0x35a172[_0xdacd('0x18')](_0xc632f4)[_0xdacd('0x19')](function(_0x34e0f0){return _0x34e0f0;});}return null;};}function removeEntity(_0x284ce4){return function(_0x106af6){if(_0x106af6){return _0x106af6[_0xdacd('0x1a')]()['then'](function(){_0x284ce4[_0xdacd('0x10')](0xcc)[_0xdacd('0x11')]();});}};}function handleEntityNotFound(_0x5d9035){return function(_0xdf4898){if(!_0xdf4898){_0x5d9035['sendStatus'](0x194);}return _0xdf4898;};}function handleError(_0x9cf821,_0x1fe4e0){_0x1fe4e0=_0x1fe4e0||0x1f4;return function(_0x6f20b1){logger[_0xdacd('0x1b')](_0x6f20b1['stack']);if(_0x6f20b1[_0xdacd('0x1c')]){delete _0x6f20b1[_0xdacd('0x1c')];}_0x9cf821[_0xdacd('0x10')](_0x1fe4e0)['send'](_0x6f20b1);};}exports[_0xdacd('0x1d')]=function(_0x5e629c,_0xdeba09){var _0x599533={};var _0x2248d7=_['map'](db['WhatsappInteraction'][_0xdacd('0x1e')],function(_0x3ce3e9){return{'name':_0x3ce3e9['fieldName'],'type':_0x3ce3e9[_0xdacd('0x1f')][_0xdacd('0x20')]};});_0x599533=qs[_0xdacd('0x21')](_0x2248d7,_0x5e629c);return interaction[_0xdacd('0x22')](_0xdacd('0x23'),_0x5e629c['query'],_0x5e629c['user'],_0x599533,_0x2248d7)[_0xdacd('0x19')](respondWithFilteredResult(_0xdeba09,_0x599533))[_0xdacd('0x24')](handleError(_0xdeba09,null));};exports[_0xdacd('0x25')]=function(_0x23115d,_0x4a42c8){var _0x622fd1={'raw':![],'where':{'id':_0x23115d[_0xdacd('0x26')]['id']}},_0x4c3b1e={};_0x4c3b1e[_0xdacd('0x27')]=_[_0xdacd('0x28')](db[_0xdacd('0x29')][_0xdacd('0x1e')]);_0x4c3b1e[_0xdacd('0x2a')]=_[_0xdacd('0x28')](_0x23115d[_0xdacd('0x2a')]);_0x4c3b1e['filters']=_['intersection'](_0x4c3b1e[_0xdacd('0x27')],_0x4c3b1e[_0xdacd('0x2a')]);_0x622fd1[_0xdacd('0x2b')]=_[_0xdacd('0x2c')](_0x4c3b1e[_0xdacd('0x27')],qs[_0xdacd('0x2d')](_0x23115d[_0xdacd('0x2a')][_0xdacd('0x2d')]));_0x622fd1[_0xdacd('0x2b')]=_0x622fd1[_0xdacd('0x2b')]['length']?_0x622fd1['attributes']:_0x4c3b1e[_0xdacd('0x27')];if(_0x23115d[_0xdacd('0x2a')][_0xdacd('0x2e')]){_0x622fd1[_0xdacd('0x2f')]=[{'all':!![]}];}_0x622fd1=_[_0xdacd('0x30')]({},_0x622fd1,_0x23115d[_0xdacd('0x31')]);return db['WhatsappInteraction'][_0xdacd('0x32')](_0x622fd1)[_0xdacd('0x19')](handleEntityNotFound(_0x4a42c8,null))['then'](respondWithResult(_0x4a42c8,null))[_0xdacd('0x24')](handleError(_0x4a42c8,null));};exports[_0xdacd('0x33')]=function(_0x36a298,_0x38eedc){return db[_0xdacd('0x29')]['create'](_0x36a298[_0xdacd('0x34')],{})[_0xdacd('0x19')](respondWithResult(_0x38eedc,0xc9))[_0xdacd('0x24')](handleError(_0x38eedc,null));};exports[_0xdacd('0x18')]=function(_0x5ea43a,_0x256bb3){if(_0x5ea43a['body']['id']){delete _0x5ea43a['body']['id'];}return db['WhatsappInteraction'][_0xdacd('0x32')]({'where':{'id':_0x5ea43a[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x256bb3,null))[_0xdacd('0x19')](saveUpdates(_0x5ea43a[_0xdacd('0x34')],null))['then'](respondWithResult(_0x256bb3,null))['catch'](handleError(_0x256bb3,null));};exports['destroy']=function(_0x4d3649,_0x45eb1f){return db[_0xdacd('0x29')][_0xdacd('0x32')]({'where':{'id':_0x4d3649[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x45eb1f,null))[_0xdacd('0x19')](removeEntity(_0x45eb1f,null))[_0xdacd('0x24')](handleError(_0x45eb1f,null));};exports[_0xdacd('0x35')]=function(_0x2017bd,_0x1a6661){return db[_0xdacd('0x29')][_0xdacd('0x35')]()[_0xdacd('0x19')](respondWithResult(_0x1a6661,null))[_0xdacd('0x24')](handleError(_0x1a6661,null));};exports[_0xdacd('0x36')]=function(_0x5de1fc,_0x565c3e){return db['WhatsappMessage'][_0xdacd('0x32')]({'where':{'id':_0x5de1fc[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x565c3e,null))[_0xdacd('0x19')](function(_0x97cfc5){if(_0x97cfc5){return _0x97cfc5['addMessage'](_0x5de1fc[_0xdacd('0x34')][_0xdacd('0x37')],_['omit'](_0x5de1fc[_0xdacd('0x34')],[_0xdacd('0x37'),'id'])||{});}})['then'](respondWithResult(_0x565c3e,null))[_0xdacd('0x24')](handleError(_0x565c3e,null));};exports[_0xdacd('0x38')]=function(_0x5e6601,_0x2a36d7){var _0x427d96={'raw':![],'where':{}};var _0x545d00={};var _0xf2e008={'count':0x0,'rows':[]};return db[_0xdacd('0x29')][_0xdacd('0x39')]({'where':{'id':_0x5e6601[_0xdacd('0x26')]['id']}})['then'](handleEntityNotFound(_0x2a36d7,null))[_0xdacd('0x19')](function(_0x325cf2){if(_0x325cf2){_0x545d00[_0xdacd('0x27')]=_[_0xdacd('0x28')](db[_0xdacd('0x3a')][_0xdacd('0x1e')]);_0x545d00[_0xdacd('0x2a')]=_['keys'](_0x5e6601[_0xdacd('0x2a')]);_0x545d00[_0xdacd('0x3b')]=_[_0xdacd('0x2c')](_0x545d00[_0xdacd('0x27')],_0x545d00[_0xdacd('0x2a')]);_0x427d96[_0xdacd('0x2b')]=_[_0xdacd('0x2c')](_0x545d00[_0xdacd('0x27')],qs[_0xdacd('0x2d')](_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x2d')]));_0x427d96[_0xdacd('0x2b')]=_0x427d96[_0xdacd('0x2b')][_0xdacd('0x3c')]?_0x427d96[_0xdacd('0x2b')]:_0x545d00[_0xdacd('0x27')];if(!_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x3d')](_0xdacd('0x3e'))){_0x427d96[_0xdacd('0x14')]=qs['limit'](_0x5e6601[_0xdacd('0x2a')]['limit']);_0x427d96[_0xdacd('0x12')]=qs[_0xdacd('0x12')](_0x5e6601[_0xdacd('0x2a')]['offset']);}_0x427d96[_0xdacd('0x3f')]=qs[_0xdacd('0x40')](_0x5e6601[_0xdacd('0x2a')]['sort']);_0x427d96[_0xdacd('0x41')]=qs[_0xdacd('0x3b')](_[_0xdacd('0x42')](_0x5e6601[_0xdacd('0x2a')],_0x545d00[_0xdacd('0x3b')]));_0x427d96[_0xdacd('0x41')][_0xdacd('0x43')]=_0x325cf2['id'];if(_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x44')]){_0x427d96[_0xdacd('0x41')]=_['merge'](_0x427d96[_0xdacd('0x41')],{'$or':_[_0xdacd('0x45')](_0x427d96[_0xdacd('0x2b')],function(_0x26c798){var _0x49e57d={};_0x49e57d[_0x26c798]={'$like':'%'+_0x5e6601[_0xdacd('0x2a')]['filter']+'%'};return _0x49e57d;})});}if(_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x46')]){var _0xb33a2=_0x5e6601[_0xdacd('0x2a')][_0xdacd('0x46')][_0xdacd('0x47')](',');var _0x1197f3={};_0x1197f3[_0xb33a2[0x0]]={'$gte':moment(_0xb33a2[0x1])[_0xdacd('0x48')](_0xdacd('0x49'))};_0x427d96[_0xdacd('0x41')]=_['merge'](_0x427d96[_0xdacd('0x41')],_0x1197f3);}_0x427d96=_[_0xdacd('0x30')]({},_0x427d96,_0x5e6601[_0xdacd('0x31')]);return db['WhatsappMessage'][_0xdacd('0x15')]({'where':_0x427d96['where']})[_0xdacd('0x19')](function(_0x4b6440){_0xf2e008['count']=_0x4b6440;if(_0x5e6601['query'][_0xdacd('0x2e')]){_0x427d96[_0xdacd('0x2f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xdacd('0x22')](_0x427d96);})['then'](function(_0x363ab0){_0xf2e008['rows']=_0x363ab0;return _0xf2e008;});}})[_0xdacd('0x19')](respondWithFilteredResult(_0x2a36d7,_0x427d96))['catch'](handleError(_0x2a36d7,null));};exports[_0xdacd('0x4a')]=function(_0x2ea5ca,_0x1ed847){return db[_0xdacd('0x29')]['find']({'where':{'id':_0x2ea5ca['params']['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x1ed847,null))[_0xdacd('0x19')](function(_0x2c7a56){if(_0x2c7a56){return _0x2c7a56[_0xdacd('0x4b')](_0x2ea5ca[_0xdacd('0x34')][_0xdacd('0x37')],_['omit'](_0x2ea5ca[_0xdacd('0x34')],[_0xdacd('0x37'),'id'])||{})[_0xdacd('0x4c')](function(){return db[_0xdacd('0x4d')][_0xdacd('0x22')]({'attributes':['id','name',_0xdacd('0x4e')],'where':{'id':_0x2ea5ca[_0xdacd('0x34')][_0xdacd('0x37')]}});})['then'](function(_0x5d9e36){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x2ea5ca[_0xdacd('0x26')]['id']),'tags':_0x5d9e36||[]});return{'id':Number(_0x2ea5ca[_0xdacd('0x26')]['id']),'tags':_0x5d9e36||[]};});}})[_0xdacd('0x19')](respondWithResult(_0x1ed847,null))[_0xdacd('0x24')](handleError(_0x1ed847,null));};exports[_0xdacd('0x4f')]=function(_0xc87553,_0x49dbe0){return db[_0xdacd('0x29')]['find']({'where':{'id':_0xc87553[_0xdacd('0x26')]['id']}})[_0xdacd('0x19')](handleEntityNotFound(_0x49dbe0,null))[_0xdacd('0x19')](function(_0x47a3d0){if(_0x47a3d0){return _0x47a3d0[_0xdacd('0x4f')](_0xc87553[_0xdacd('0x2a')][_0xdacd('0x37')]);}})[_0xdacd('0x19')](respondWithStatusCode(_0x49dbe0,null))['catch'](handleError(_0x49dbe0,null));};exports[_0xdacd('0x50')]=function(_0x3358d6,_0x247bec){var _0x36ee65=moment()['unix']()['toString']();var _0x86bf7e=path[_0xdacd('0x51')](config[_0xdacd('0x52')],'server','files',_0xdacd('0x53'));var _0x14186c=path[_0xdacd('0x51')](config['root'],_0xdacd('0x54'),_0xdacd('0x55'),'attachments');var _0x13255a=path[_0xdacd('0x51')](_0x86bf7e,_0x36ee65);var _0x366a42=util['format'](_0xdacd('0x56'),_0x3358d6['params']['id'],_0x36ee65);var _0x5e8e30=path[_0xdacd('0x51')](_0x86bf7e,_0x366a42);var _0x344f8a=[];_0x344f8a['push']({'model':db[_0xdacd('0x57')],'as':_0xdacd('0x57'),'attributes':['id',_0xdacd('0x58')],'raw':!![]});_0x344f8a[_0xdacd('0x59')]({'model':db[_0xdacd('0x5a')],'as':_0xdacd('0x5b'),'attributes':['id','firstName',_0xdacd('0x5c')],'raw':!![]});if(_0x3358d6['query'][_0xdacd('0x5d')]){_0x344f8a[_0xdacd('0x59')]({'model':db[_0xdacd('0x5e')],'as':'Attachment','raw':!![]});}var _0x5a80bc=[{'model':db[_0xdacd('0x3a')],'as':'Messages','attributes':['id',_0xdacd('0x34'),_0xdacd('0x5f'),_0xdacd('0x60'),_0xdacd('0x61'),_0xdacd('0x62')],'include':_0x344f8a}];_0x5a80bc[_0xdacd('0x59')]({'model':db['WhatsappAccount'],'as':_0xdacd('0x63'),'attributes':['id',_0xdacd('0x1c')]});_0x5a80bc[_0xdacd('0x59')]({'model':db['User'],'as':_0xdacd('0x64'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x3358d6[_0xdacd('0x26')]['id']},'include':_0x5a80bc})['then'](handleEntityNotFound(_0x247bec,null))[_0xdacd('0x19')](function(_0x2a1744){if(_0x2a1744){var _0x235130=_0x2a1744['get']({'plain':!![]});fs[_0xdacd('0x65')](_0x13255a);var _0x801e0f={'channel':'Whatsapp','account':_0x235130[_0xdacd('0x63')][_0xdacd('0x1c')],'agent':_0x235130[_0xdacd('0x64')]?_0x235130[_0xdacd('0x64')]['fullname']:'N.A.','createdAt':moment(_0x235130[_0xdacd('0x5f')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')](),'closedAt':_0x235130[_0xdacd('0x67')]?moment(_0x235130[_0xdacd('0x68')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')]():'','disposition':_0x235130[_0xdacd('0x69')],'messages':_(_0x235130[_0xdacd('0x6a')])['filter']({'secret':![]})[_0xdacd('0x45')](function(_0x3f90da){if(_0x3f90da[_0xdacd('0x5e')]){var _0x391006=path[_0xdacd('0x51')](_0x14186c,_0x3f90da[_0xdacd('0x5e')][_0xdacd('0x6b')]);if(fs[_0xdacd('0x6c')](_0x391006)){fs[_0xdacd('0x6d')](_0x391006)['pipe'](fs[_0xdacd('0x6e')](path[_0xdacd('0x51')](_0x13255a,_0x3f90da[_0xdacd('0x5e')][_0xdacd('0x6b')])));}}return{'date':moment(_0x3f90da[_0xdacd('0x5f')])[_0xdacd('0x48')](_0xdacd('0x49'))[_0xdacd('0x66')](),'sender':_0x3f90da[_0xdacd('0x60')]===_0xdacd('0x6f')?_0x3f90da[_0xdacd('0x57')]?_0x3f90da[_0xdacd('0x57')]['fullname']:_0xdacd('0x70'):_0x3f90da[_0xdacd('0x5b')]['firstName']+(_0x3f90da['Contact'][_0xdacd('0x5c')]?'\x20'+_0x3f90da[_0xdacd('0x5b')][_0xdacd('0x5c')]:''),'body':_0x3f90da[_0xdacd('0x5e')]?_0x3f90da[_0xdacd('0x5e')]['basename']:_0x3f90da[_0xdacd('0x34')],'direction':_0x3f90da['direction']===_0xdacd('0x6f')?'A':'C','secret':_0x3f90da[_0xdacd('0x61')],'read':_0x3f90da[_0xdacd('0x62')],'attachment':_0x3f90da[_0xdacd('0x5e')]};})['value']()};return ejs[_0xdacd('0x71')](path[_0xdacd('0x51')](config[_0xdacd('0x52')],'server','views',_0xdacd('0x72')),{'interaction':_0x801e0f})[_0xdacd('0x19')](function(_0x17f7c4){var _0x361c96=path[_0xdacd('0x51')](_0x13255a,_0xdacd('0x73')+_0x235130['id']+'-'+_0x36ee65+_0xdacd('0x74'));var _0x1f907e={'path':_0x361c96,'channel':_0xdacd('0x75'),'interactionId':_0x235130['id']};return pdf['createPdfFromHTML'](_0x17f7c4,_0x1f907e);})[_0xdacd('0x19')](function(){return new BPromise(function(_0x44428d,_0x53a85f){zipdir(_0x13255a,{'saveTo':_0x5e8e30},function(_0x141262,_0x54ae4b){if(_0x141262)return _0x53a85f(_0x141262);return _0x44428d(_0x54ae4b);});})['then'](function(){return new BPromise(function(_0x4d0c75,_0x5d37fd){rimraf(_0x13255a,function(_0x35ce45){if(_0x35ce45)_0x5d37fd(_0x35ce45);return _0x4d0c75();});});})['then'](function(){return _0x247bec[_0xdacd('0x50')](_0x5e8e30,_0x366a42,function(_0x13e37a){if(_0x13e37a){console[_0xdacd('0x76')]('err',_0x13e37a);}else{fs[_0xdacd('0x77')](_0x5e8e30);}});});});}else{return _0x247bec['sendStatus'](0xc8);}})[_0xdacd('0x24')](handleError(_0x247bec,null));}; \ No newline at end of file +var _0x565e=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','WhatsappInteraction','keys','filters','intersection','model','fields','attributes','length','include','merge','options','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','pick','WhatsappInteractionId','filter','where','$gte','split','format','includeAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','Owner','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','err','unlinkSync','sendStatus','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service'];(function(_0x8aef0f,_0x37c5b9){var _0xd726f7=function(_0x1c6501){while(--_0x1c6501){_0x8aef0f['push'](_0x8aef0f['shift']());}};_0xd726f7(++_0x37c5b9);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xe565('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var util=require(_0xe565('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe565('0x4'));var Redis=require(_0xe565('0x5'));var interaction=require(_0xe565('0x6'));var qs=require(_0xe565('0x7'));var pdf=require(_0xe565('0x8'));var logger=require(_0xe565('0x9'))(_0xe565('0xa'));var config=require(_0xe565('0xb'));var db=require(_0xe565('0xc'))['db'];config[_0xe565('0xd')]=_[_0xe565('0xe')](config[_0xe565('0xd')],{'host':_0xe565('0xf'),'port':0x18eb});var socket=require(_0xe565('0x10'))(new Redis(config[_0xe565('0xd')]));require(_0xe565('0x11'))['register'](socket);function respondWithStatusCode(_0x3dd4dc,_0x36c827){_0x36c827=_0x36c827||0xcc;return function(_0x9fd021){if(_0x9fd021){return _0x3dd4dc['sendStatus'](_0x36c827);}return _0x3dd4dc[_0xe565('0x12')](_0x36c827)[_0xe565('0x13')]();};}function respondWithResult(_0x364a91,_0x26cd29){_0x26cd29=_0x26cd29||0xc8;return function(_0x590517){if(_0x590517){return _0x364a91[_0xe565('0x12')](_0x26cd29)['json'](_0x590517);}};}function respondWithFilteredResult(_0x93b7ea,_0x5ec534){return function(_0x388a9a){if(_0x388a9a){var _0x449750=typeof _0x5ec534[_0xe565('0x14')]==='undefined'&&typeof _0x5ec534[_0xe565('0x15')]===_0xe565('0x16');var _0x127b29=_0x388a9a[_0xe565('0x17')];var _0x52b772=_0x449750?0x0:_0x5ec534[_0xe565('0x14')];var _0x41ebb8=_0x449750?_0x388a9a[_0xe565('0x17')]:_0x5ec534[_0xe565('0x14')]+_0x5ec534[_0xe565('0x15')];var _0x31ccc9;if(_0x41ebb8>=_0x127b29){_0x41ebb8=_0x127b29;_0x31ccc9=0xc8;}else{_0x31ccc9=0xce;}_0x93b7ea['status'](_0x31ccc9);return _0x93b7ea[_0xe565('0x18')](_0xe565('0x19'),_0x52b772+'-'+_0x41ebb8+'/'+_0x127b29)[_0xe565('0x1a')](_0x388a9a);}return null;};}function saveUpdates(_0x13aef8){return function(_0x5b4635){if(_0x5b4635){return _0x5b4635[_0xe565('0x1b')](_0x13aef8)[_0xe565('0x1c')](function(_0x5bf4d8){return _0x5bf4d8;});}return null;};}function removeEntity(_0x515786){return function(_0x1251aa){if(_0x1251aa){return _0x1251aa[_0xe565('0x1d')]()['then'](function(){_0x515786[_0xe565('0x12')](0xcc)[_0xe565('0x13')]();});}};}function handleEntityNotFound(_0x1e1b2e){return function(_0x4ad5df){if(!_0x4ad5df){_0x1e1b2e['sendStatus'](0x194);}return _0x4ad5df;};}function handleError(_0x38898b,_0x5074b9){_0x5074b9=_0x5074b9||0x1f4;return function(_0x2c290c){logger[_0xe565('0x1e')](_0x2c290c['stack']);if(_0x2c290c[_0xe565('0x1f')]){delete _0x2c290c['name'];}_0x38898b[_0xe565('0x12')](_0x5074b9)[_0xe565('0x20')](_0x2c290c);};}exports[_0xe565('0x21')]=function(_0x4edaed,_0x2d31bd){var _0x1e13aa={};var _0x14f04a=_[_0xe565('0x22')](db['WhatsappInteraction'][_0xe565('0x23')],function(_0x519b72){return{'name':_0x519b72[_0xe565('0x24')],'type':_0x519b72[_0xe565('0x25')][_0xe565('0x26')]};});_0x1e13aa=qs['getOptions'](_0x14f04a,_0x4edaed);return interaction[_0xe565('0x27')](_0xe565('0x28'),_0x4edaed[_0xe565('0x29')],_0x4edaed[_0xe565('0x2a')],_0x1e13aa,_0x14f04a)[_0xe565('0x1c')](respondWithFilteredResult(_0x2d31bd,_0x1e13aa))[_0xe565('0x2b')](handleError(_0x2d31bd,null));};exports[_0xe565('0x2c')]=function(_0x2d1828,_0x4ffd31){var _0x15ffeb={'raw':![],'where':{'id':_0x2d1828[_0xe565('0x2d')]['id']}},_0x5af16b={};_0x5af16b['model']=_['keys'](db[_0xe565('0x2e')]['rawAttributes']);_0x5af16b[_0xe565('0x29')]=_[_0xe565('0x2f')](_0x2d1828[_0xe565('0x29')]);_0x5af16b[_0xe565('0x30')]=_[_0xe565('0x31')](_0x5af16b[_0xe565('0x32')],_0x5af16b[_0xe565('0x29')]);_0x15ffeb['attributes']=_['intersection'](_0x5af16b[_0xe565('0x32')],qs[_0xe565('0x33')](_0x2d1828[_0xe565('0x29')][_0xe565('0x33')]));_0x15ffeb['attributes']=_0x15ffeb[_0xe565('0x34')][_0xe565('0x35')]?_0x15ffeb[_0xe565('0x34')]:_0x5af16b[_0xe565('0x32')];if(_0x2d1828[_0xe565('0x29')]['includeAll']){_0x15ffeb[_0xe565('0x36')]=[{'all':!![]}];}_0x15ffeb=_[_0xe565('0x37')]({},_0x15ffeb,_0x2d1828[_0xe565('0x38')]);return db[_0xe565('0x2e')]['find'](_0x15ffeb)[_0xe565('0x1c')](handleEntityNotFound(_0x4ffd31,null))[_0xe565('0x1c')](respondWithResult(_0x4ffd31,null))[_0xe565('0x2b')](handleError(_0x4ffd31,null));};exports['create']=function(_0x33bc9a,_0xa6406e){return db['WhatsappInteraction'][_0xe565('0x39')](_0x33bc9a[_0xe565('0x3a')],{})['then'](respondWithResult(_0xa6406e,0xc9))[_0xe565('0x2b')](handleError(_0xa6406e,null));};exports[_0xe565('0x1b')]=function(_0x40be68,_0xaf1818){if(_0x40be68[_0xe565('0x3a')]['id']){delete _0x40be68[_0xe565('0x3a')]['id'];}return db[_0xe565('0x2e')][_0xe565('0x3b')]({'where':{'id':_0x40be68[_0xe565('0x2d')]['id']}})[_0xe565('0x1c')](handleEntityNotFound(_0xaf1818,null))[_0xe565('0x1c')](saveUpdates(_0x40be68[_0xe565('0x3a')],null))[_0xe565('0x1c')](respondWithResult(_0xaf1818,null))['catch'](handleError(_0xaf1818,null));};exports[_0xe565('0x1d')]=function(_0x42c01e,_0xc06e1b){return db[_0xe565('0x2e')]['find']({'where':{'id':_0x42c01e['params']['id']}})[_0xe565('0x1c')](handleEntityNotFound(_0xc06e1b,null))['then'](removeEntity(_0xc06e1b,null))['catch'](handleError(_0xc06e1b,null));};exports[_0xe565('0x3c')]=function(_0x485cfc,_0x5c0c79){return db[_0xe565('0x2e')]['describe']()['then'](respondWithResult(_0x5c0c79,null))[_0xe565('0x2b')](handleError(_0x5c0c79,null));};exports[_0xe565('0x3d')]=function(_0x17177e,_0x3efcb8){return db[_0xe565('0x3e')][_0xe565('0x3b')]({'where':{'id':_0x17177e[_0xe565('0x2d')]['id']}})[_0xe565('0x1c')](handleEntityNotFound(_0x3efcb8,null))[_0xe565('0x1c')](function(_0x5d8be3){if(_0x5d8be3){return _0x5d8be3[_0xe565('0x3d')](_0x17177e[_0xe565('0x3a')][_0xe565('0x3f')],_[_0xe565('0x40')](_0x17177e[_0xe565('0x3a')],[_0xe565('0x3f'),'id'])||{});}})[_0xe565('0x1c')](respondWithResult(_0x3efcb8,null))[_0xe565('0x2b')](handleError(_0x3efcb8,null));};exports['getMessages']=function(_0x1e75e2,_0x30e322){var _0x451d60={'raw':![],'where':{}};var _0x309ee4={};var _0x33e206={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe565('0x41')]({'where':{'id':_0x1e75e2[_0xe565('0x2d')]['id']}})[_0xe565('0x1c')](handleEntityNotFound(_0x30e322,null))[_0xe565('0x1c')](function(_0x3d779c){if(_0x3d779c){_0x309ee4[_0xe565('0x32')]=_['keys'](db[_0xe565('0x3e')]['rawAttributes']);_0x309ee4[_0xe565('0x29')]=_[_0xe565('0x2f')](_0x1e75e2[_0xe565('0x29')]);_0x309ee4['filters']=_['intersection'](_0x309ee4['model'],_0x309ee4[_0xe565('0x29')]);_0x451d60[_0xe565('0x34')]=_[_0xe565('0x31')](_0x309ee4['model'],qs[_0xe565('0x33')](_0x1e75e2['query'][_0xe565('0x33')]));_0x451d60['attributes']=_0x451d60[_0xe565('0x34')][_0xe565('0x35')]?_0x451d60['attributes']:_0x309ee4[_0xe565('0x32')];if(!_0x1e75e2['query'][_0xe565('0x42')](_0xe565('0x43'))){_0x451d60['limit']=qs[_0xe565('0x15')](_0x1e75e2[_0xe565('0x29')][_0xe565('0x15')]);_0x451d60[_0xe565('0x14')]=qs[_0xe565('0x14')](_0x1e75e2[_0xe565('0x29')]['offset']);}_0x451d60[_0xe565('0x44')]=qs[_0xe565('0x45')](_0x1e75e2['query'][_0xe565('0x45')]);_0x451d60['where']=qs[_0xe565('0x30')](_[_0xe565('0x46')](_0x1e75e2[_0xe565('0x29')],_0x309ee4[_0xe565('0x30')]));_0x451d60['where'][_0xe565('0x47')]=_0x3d779c['id'];if(_0x1e75e2[_0xe565('0x29')][_0xe565('0x48')]){_0x451d60[_0xe565('0x49')]=_[_0xe565('0x37')](_0x451d60[_0xe565('0x49')],{'$or':_[_0xe565('0x22')](_0x451d60[_0xe565('0x34')],function(_0x362f3f){var _0x5988d9={};_0x5988d9[_0x362f3f]={'$like':'%'+_0x1e75e2[_0xe565('0x29')][_0xe565('0x48')]+'%'};return _0x5988d9;})});}if(_0x1e75e2[_0xe565('0x29')][_0xe565('0x4a')]){var _0x395997=_0x1e75e2[_0xe565('0x29')][_0xe565('0x4a')][_0xe565('0x4b')](',');var _0x36de5f={};_0x36de5f[_0x395997[0x0]]={'$gte':moment(_0x395997[0x1])[_0xe565('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x451d60[_0xe565('0x49')]=_[_0xe565('0x37')](_0x451d60[_0xe565('0x49')],_0x36de5f);}_0x451d60=_[_0xe565('0x37')]({},_0x451d60,_0x1e75e2[_0xe565('0x38')]);return db[_0xe565('0x3e')]['count']({'where':_0x451d60[_0xe565('0x49')]})[_0xe565('0x1c')](function(_0x2724cb){_0x33e206[_0xe565('0x17')]=_0x2724cb;if(_0x1e75e2[_0xe565('0x29')][_0xe565('0x4d')]){_0x451d60[_0xe565('0x36')]=[{'all':!![]}];}return db[_0xe565('0x3e')]['findAll'](_0x451d60);})[_0xe565('0x1c')](function(_0x4ebfbf){_0x33e206[_0xe565('0x4e')]=_0x4ebfbf;return _0x33e206;});}})['then'](respondWithFilteredResult(_0x30e322,_0x451d60))[_0xe565('0x2b')](handleError(_0x30e322,null));};exports[_0xe565('0x4f')]=function(_0x1fafec,_0x42316e){return db[_0xe565('0x2e')][_0xe565('0x3b')]({'where':{'id':_0x1fafec[_0xe565('0x2d')]['id']}})[_0xe565('0x1c')](handleEntityNotFound(_0x42316e,null))[_0xe565('0x1c')](function(_0x3a9c18){if(_0x3a9c18){return _0x3a9c18[_0xe565('0x50')](_0x1fafec[_0xe565('0x3a')][_0xe565('0x3f')],_['omit'](_0x1fafec['body'],['ids','id'])||{})[_0xe565('0x51')](function(){return db[_0xe565('0x52')][_0xe565('0x27')]({'attributes':['id','name','color'],'where':{'id':_0x1fafec[_0xe565('0x3a')]['ids']}});})['then'](function(_0x5437f2){socket[_0xe565('0x53')](_0xe565('0x54'),{'id':Number(_0x1fafec[_0xe565('0x2d')]['id']),'tags':_0x5437f2||[]});return{'id':Number(_0x1fafec[_0xe565('0x2d')]['id']),'tags':_0x5437f2||[]};});}})[_0xe565('0x1c')](respondWithResult(_0x42316e,null))['catch'](handleError(_0x42316e,null));};exports[_0xe565('0x55')]=function(_0x37472b,_0xa6a0ce){return db['WhatsappInteraction'][_0xe565('0x3b')]({'where':{'id':_0x37472b[_0xe565('0x2d')]['id']}})['then'](handleEntityNotFound(_0xa6a0ce,null))[_0xe565('0x1c')](function(_0xf423e1){if(_0xf423e1){return _0xf423e1[_0xe565('0x55')](_0x37472b['query']['ids']);}})[_0xe565('0x1c')](respondWithStatusCode(_0xa6a0ce,null))['catch'](handleError(_0xa6a0ce,null));};exports[_0xe565('0x56')]=function(_0x12836b,_0x161b9b){var _0x3c1423=moment()[_0xe565('0x57')]()[_0xe565('0x58')]();var _0x1f07a8=path[_0xe565('0x59')](config[_0xe565('0x5a')],_0xe565('0x5b'),_0xe565('0x5c'),_0xe565('0x5d'));var _0xb6f9a2=path[_0xe565('0x59')](config[_0xe565('0x5a')],_0xe565('0x5b'),'files',_0xe565('0x5e'));var _0xede99=path[_0xe565('0x59')](_0x1f07a8,_0x3c1423);var _0x4ba0ff=util[_0xe565('0x4c')](_0xe565('0x5f'),_0x12836b[_0xe565('0x2d')]['id'],_0x3c1423);var _0x4d0851=path[_0xe565('0x59')](_0x1f07a8,_0x4ba0ff);var _0x5d6889=[];_0x5d6889[_0xe565('0x60')]({'model':db[_0xe565('0x61')],'as':'User','attributes':['id',_0xe565('0x62')],'raw':!![]});_0x5d6889['push']({'model':db[_0xe565('0x63')],'as':_0xe565('0x64'),'attributes':['id','firstName',_0xe565('0x65')],'raw':!![]});if(_0x12836b[_0xe565('0x29')][_0xe565('0x5e')]){_0x5d6889[_0xe565('0x60')]({'model':db[_0xe565('0x66')],'as':_0xe565('0x66'),'raw':!![]});}var _0x595655=[{'model':db[_0xe565('0x3e')],'as':_0xe565('0x67'),'attributes':['id','body','createdAt',_0xe565('0x68'),_0xe565('0x69'),'read'],'include':_0x5d6889}];_0x595655[_0xe565('0x60')]({'model':db[_0xe565('0x6a')],'as':_0xe565('0x6b'),'attributes':['id',_0xe565('0x1f')]});_0x595655[_0xe565('0x60')]({'model':db['User'],'as':'Owner','attributes':['id',_0xe565('0x62')]});return db[_0xe565('0x2e')][_0xe565('0x3b')]({'where':{'id':_0x12836b[_0xe565('0x2d')]['id']},'include':_0x595655})[_0xe565('0x1c')](handleEntityNotFound(_0x161b9b,null))['then'](function(_0x2afed9){if(_0x2afed9){var _0xb076e=_0x2afed9[_0xe565('0x6c')]({'plain':!![]});fs['mkdirSync'](_0xede99);var _0x400ffe={'channel':'Whatsapp','account':_0xb076e[_0xe565('0x6b')][_0xe565('0x1f')],'agent':_0xb076e[_0xe565('0x6d')]?_0xb076e[_0xe565('0x6d')]['fullname']:_0xe565('0x6e'),'createdAt':moment(_0xb076e[_0xe565('0x6f')])[_0xe565('0x4c')](_0xe565('0x70'))['toString'](),'closedAt':_0xb076e[_0xe565('0x71')]?moment(_0xb076e[_0xe565('0x72')])[_0xe565('0x4c')](_0xe565('0x70'))[_0xe565('0x58')]():'','disposition':_0xb076e[_0xe565('0x73')],'messages':_(_0xb076e['Messages'])[_0xe565('0x48')]({'secret':![]})[_0xe565('0x22')](function(_0x402aec){if(_0x402aec[_0xe565('0x66')]){var _0x3ad89e=path[_0xe565('0x59')](_0xb6f9a2,_0x402aec[_0xe565('0x66')][_0xe565('0x74')]);if(fs[_0xe565('0x75')](_0x3ad89e)){fs[_0xe565('0x76')](_0x3ad89e)[_0xe565('0x77')](fs[_0xe565('0x78')](path[_0xe565('0x59')](_0xede99,_0x402aec[_0xe565('0x66')][_0xe565('0x74')])));}}return{'date':moment(_0x402aec[_0xe565('0x6f')])[_0xe565('0x4c')](_0xe565('0x70'))[_0xe565('0x58')](),'sender':_0x402aec[_0xe565('0x68')]==='out'?_0x402aec['User']?_0x402aec[_0xe565('0x61')][_0xe565('0x62')]:_0xe565('0x79'):_0x402aec[_0xe565('0x64')]['firstName']+(_0x402aec['Contact'][_0xe565('0x65')]?'\x20'+_0x402aec[_0xe565('0x64')][_0xe565('0x65')]:''),'body':_0x402aec[_0xe565('0x66')]?_0x402aec[_0xe565('0x66')][_0xe565('0x74')]:_0x402aec['body'],'direction':_0x402aec['direction']===_0xe565('0x7a')?'A':'C','secret':_0x402aec[_0xe565('0x69')],'read':_0x402aec[_0xe565('0x7b')],'attachment':_0x402aec[_0xe565('0x66')]};})['value']()};return ejs[_0xe565('0x7c')](path[_0xe565('0x59')](config['root'],'server',_0xe565('0x7d'),_0xe565('0x7e')),{'interaction':_0x400ffe})[_0xe565('0x1c')](function(_0x4eb4ff){var _0x4b4179=path[_0xe565('0x59')](_0xede99,_0xe565('0x7f')+_0xb076e['id']+'-'+_0x3c1423+_0xe565('0x80'));var _0x440454={'path':_0x4b4179,'channel':_0xe565('0x81'),'interactionId':_0xb076e['id']};return pdf[_0xe565('0x82')](_0x4eb4ff,_0x440454);})[_0xe565('0x1c')](function(){return new BPromise(function(_0x506737,_0x2a882d){zipdir(_0xede99,{'saveTo':_0x4d0851},function(_0x57040b,_0x4343ea){if(_0x57040b)return _0x2a882d(_0x57040b);return _0x506737(_0x4343ea);});})['then'](function(){return new BPromise(function(_0xfae73,_0x1aa069){rimraf(_0xede99,function(_0x3999e1){if(_0x3999e1)_0x1aa069(_0x3999e1);return _0xfae73();});});})[_0xe565('0x1c')](function(){return _0x161b9b[_0xe565('0x56')](_0x4d0851,_0x4ba0ff,function(_0x414870){if(_0x414870){console['log'](_0xe565('0x83'),_0x414870);}else{fs[_0xe565('0x84')](_0x4d0851);}});});});}else{return _0x161b9b[_0xe565('0x85')](0xc8);}})[_0xe565('0x2b')](handleError(_0x161b9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 1a2f190..6b1c249 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 _0xf00e=['length','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x159fd1,_0x73b713){var _0x5c85b1=function(_0x378e6c){while(--_0x378e6c){_0x159fd1['push'](_0x159fd1['shift']());}};_0x5c85b1(++_0x73b713);}(_0xf00e,0x12f));var _0xef00=function(_0x498bbd,_0x168b20){_0x498bbd=_0x498bbd-0x0;var _0x59a0a5=_0xf00e[_0x498bbd];return _0x59a0a5;};'use strict';var EventEmitter=require(_0xef00('0x0'));var WhatsappInteraction=require(_0xef00('0x1'))['db'][_0xef00('0x2')];var WhatsappMessage=require(_0xef00('0x1'))['db'][_0xef00('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xef00('0x4')](0x0);var events={'afterCreate':_0xef00('0x5'),'afterUpdate':_0xef00('0x6'),'afterDestroy':_0xef00('0x7')};function emitEvent(_0x4261ea){return function(_0x409186,_0x471e92,_0x397c39){_0x409186[_0xef00('0x8')]({'attributes':['id'],'raw':!![]})[_0xef00('0x9')](function(_0x17ec9e){_0x409186[_0xef00('0xa')](_0xef00('0xb'),_0x17ec9e['map'](function(_0x1d3b1c){return{'id':_0x1d3b1c['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x409186['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x173074){_0x409186['setDataValue']('unreadMessages',_0x173074[_0xef00('0xc')]);WhatsappInteractionEvents['emit'](_0x4261ea+':'+_0x409186['id'],_0x409186);WhatsappInteractionEvents[_0xef00('0xd')](_0x4261ea,_0x409186);_0x397c39(null);})[_0xef00('0xe')](_0x397c39(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x636f=['exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x2f2acb,_0x5ed1a2){var _0xeaff55=function(_0x4e7bb1){while(--_0x4e7bb1){_0x2f2acb['push'](_0x2f2acb['shift']());}};_0xeaff55(++_0x5ed1a2);}(_0x636f,0x188));var _0xf636=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x636f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xf636('0x0')];var WhatsappMessage=require(_0xf636('0x1'))['db'][_0xf636('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf636('0x3')](0x0);var events={'afterCreate':_0xf636('0x4'),'afterUpdate':'update','afterDestroy':_0xf636('0x5')};function emitEvent(_0x1479ae){return function(_0x1291af,_0x16d1f6,_0x39c5f1){_0x1291af['getUsers']({'attributes':['id'],'raw':!![]})[_0xf636('0x6')](function(_0x46a395){_0x1291af[_0xf636('0x7')](_0xf636('0x8'),_0x46a395[_0xf636('0x9')](function(_0x1b4f04){return{'id':_0x1b4f04['id']};}));return WhatsappMessage[_0xf636('0xa')]({'where':{'WhatsappInteractionId':_0x1291af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf636('0x6')](function(_0xf9e996){_0x1291af[_0xf636('0x7')]('unreadMessages',_0xf9e996[_0xf636('0xb')]);WhatsappInteractionEvents[_0xf636('0xc')](_0x1479ae+':'+_0x1291af['id'],_0x1291af);WhatsappInteractionEvents['emit'](_0x1479ae,_0x1291af);_0x39c5f1(null);})[_0xf636('0xd')](_0x39c5f1(null));};}for(var e in events){if(events[_0xf636('0xe')](e)){var event=events[e];WhatsappInteraction[_0xf636('0xf')](e,emitEvent(event));}}module[_0xf636('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 35cc8fc..9306405 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 _0x09d6=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','util','api','request-promise'];(function(_0x5e09d2,_0xccfe30){var _0x310dae=function(_0x29dd41){while(--_0x29dd41){_0x5e09d2['push'](_0x5e09d2['shift']());}};_0x310dae(++_0xccfe30);}(_0x09d6,0x159));var _0x609d=function(_0x271080,_0x50839d){_0x271080=_0x271080-0x0;var _0x3f08e5=_0x09d6[_0x271080];return _0x3f08e5;};'use strict';var _=require('lodash');var util=require(_0x609d('0x0'));var logger=require('../../config/logger')(_0x609d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x609d('0x2'));var fs=require('fs');var path=require(_0x609d('0x3'));var rimraf=require(_0x609d('0x4'));var config=require(_0x609d('0x5'));var attributes=require(_0x609d('0x6'));module['exports']=function(_0x2ed60d,_0x57772a){return _0x2ed60d[_0x609d('0x7')](_0x609d('0x8'),attributes,{'tableName':_0x609d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x174ed5,_0x210ac6,_0x2b0d60){if(_0x174ed5['changed'](_0x609d('0xa'))){_0x174ed5['closedAt']=moment()['format'](_0x609d('0xb'));}_0x2b0d60(null,_0x174ed5);}}});}; \ No newline at end of file +var _0x9672=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x54a0de,_0x53e023){var _0xc1c419=function(_0x417087){while(--_0x417087){_0x54a0de['push'](_0x54a0de['shift']());}};_0xc1c419(++_0x53e023);}(_0x9672,0xee));var _0x2967=function(_0x109789,_0x5c1279){_0x109789=_0x109789-0x0;var _0x5afa08=_0x9672[_0x109789];return _0x5afa08;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var logger=require('../../config/logger')(_0x2967('0x2'));var moment=require(_0x2967('0x3'));var BPromise=require(_0x2967('0x4'));var rp=require(_0x2967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var attributes=require(_0x2967('0x8'));module['exports']=function(_0x4baad7,_0x24424d){return _0x4baad7[_0x2967('0x9')](_0x2967('0xa'),attributes,{'tableName':_0x2967('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bcd7e,_0xf353b6,_0x45ebae){if(_0x3bcd7e[_0x2967('0xc')]('closed')){_0x3bcd7e[_0x2967('0xd')]=moment()[_0x2967('0xe')](_0x2967('0xf'));}_0x45ebae(null,_0x3bcd7e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fc5ad3f..58d05d9 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 _0xf312=['limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes'];(function(_0x2b91b9,_0x35c185){var _0x428e90=function(_0x2ba0b0){while(--_0x2ba0b0){_0x2b91b9['push'](_0x2b91b9['shift']());}};_0x428e90(++_0x35c185);}(_0xf312,0x179));var _0x2f31=function(_0x3a28e3,_0x168f52){_0x3a28e3=_0x3a28e3-0x0;var _0x54aac4=_0xf312[_0x3a28e3];return _0x54aac4;};'use strict';var _=require('lodash');var util=require(_0x2f31('0x0'));var moment=require(_0x2f31('0x1'));var BPromise=require(_0x2f31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f31('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f31('0x5'));var jayson=require(_0x2f31('0x6'));var client=jayson['client'][_0x2f31('0x7')]({'port':0x232a});config[_0x2f31('0x8')]=_[_0x2f31('0x9')](config[_0x2f31('0x8')],{'host':_0x2f31('0xa'),'port':0x18eb});var socket=require(_0x2f31('0xb'))(new Redis(config[_0x2f31('0x8')]));require(_0x2f31('0xc'))[_0x2f31('0xd')](socket);function respondWithRpcPromise(_0x3fe578,_0x9d7e8d,_0x417727){return new BPromise(function(_0x4b30fa,_0x1e0020){return client['request'](_0x3fe578,_0x417727)[_0x2f31('0xe')](function(_0x47cc3c){logger[_0x2f31('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x9d7e8d,_0x2f31('0x10'));logger[_0x2f31('0x11')](_0x2f31('0x12'),_0x9d7e8d,_0x2f31('0x10'),JSON[_0x2f31('0x13')](_0x47cc3c));if(_0x47cc3c[_0x2f31('0x14')]){if(_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x15')]===0x1f4){logger[_0x2f31('0x14')](_0x2f31('0x16'),_0x9d7e8d,_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x17')]);return _0x1e0020(_0x47cc3c[_0x2f31('0x14')]['message']);}logger[_0x2f31('0x14')](_0x2f31('0x16'),_0x9d7e8d,_0x47cc3c[_0x2f31('0x14')]['message']);return _0x4b30fa(_0x47cc3c[_0x2f31('0x14')][_0x2f31('0x17')]);}else{logger[_0x2f31('0xf')](_0x2f31('0x16'),_0x9d7e8d,_0x2f31('0x10'));_0x4b30fa(_0x47cc3c[_0x2f31('0x18')][_0x2f31('0x17')]);}})[_0x2f31('0x19')](function(_0x5ec8ee){logger[_0x2f31('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x9d7e8d,_0x5ec8ee);_0x1e0020(_0x5ec8ee);});});}exports[_0x2f31('0x1a')]=function(_0xe9ca5f){var _0x26bf5b=this;return new Promise(function(_0x3b552b,_0x504a6c){return db[_0x2f31('0x1b')][_0x2f31('0x1c')](_0xe9ca5f[_0x2f31('0x1d')],{'raw':_0xe9ca5f['options']?_0xe9ca5f[_0x2f31('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9ca5f[_0x2f31('0x1e')]?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x1f')]||null:null,'attributes':_0xe9ca5f[_0x2f31('0x1e')]?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x20')]||null:null,'limit':_0xe9ca5f['options']?_0xe9ca5f[_0x2f31('0x1e')][_0x2f31('0x21')]||null:null})[_0x2f31('0xe')](function(_0x14174c){logger['info'](_0x2f31('0x1a'),_0xe9ca5f);logger[_0x2f31('0x11')](_0x2f31('0x1a'),_0xe9ca5f,JSON[_0x2f31('0x13')](_0x14174c));_0x3b552b(_0x14174c);})['catch'](function(_0x4ce5da){logger[_0x2f31('0x14')]('UpdateWhatsappInteraction',_0x4ce5da['message'],_0xe9ca5f);_0x504a6c(_0x26bf5b[_0x2f31('0x14')](0x1f4,_0x4ce5da['message']));});});};exports[_0x2f31('0x22')]=function(_0x348a12){return new Promise(function(_0xc33708,_0x481f80){return db[_0x2f31('0x1b')][_0x2f31('0x23')]({'where':_0x348a12[_0x2f31('0x1e')]?_0x348a12[_0x2f31('0x1e')][_0x2f31('0x1f')]||null:null})[_0x2f31('0xe')](function(_0x3b366d){if(_0x3b366d){return _0x3b366d[_0x2f31('0x24')](_0x348a12[_0x2f31('0x1d')][_0x2f31('0x25')],_[_0x2f31('0x26')](_0x348a12[_0x2f31('0x1d')],[_0x2f31('0x25'),'id'])||{});}})[_0x2f31('0x27')](function(_0x43c214){logger[_0x2f31('0xf')](_0x2f31('0x28'),_0x348a12);logger[_0x2f31('0x11')](_0x2f31('0x28'),_0x348a12,JSON[_0x2f31('0x13')](_0x43c214));_0xc33708(_0x43c214);})[_0x2f31('0x19')](function(_0xdae53d){logger[_0x2f31('0x14')](_0x2f31('0x28'),_0xdae53d[_0x2f31('0x17')],_0x348a12);_0x481f80(_this['error'](0x1f4,_0xdae53d[_0x2f31('0x17')]));});});}; \ No newline at end of file +var _0xfa11=['raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','catch','UpdateWhatsappInteraction','update','body','options'];(function(_0x2239c1,_0x5595e5){var _0x3cd347=function(_0x2b4ea9){while(--_0x2b4ea9){_0x2239c1['push'](_0x2239c1['shift']());}};_0x3cd347(++_0x5595e5);}(_0xfa11,0x197));var _0x1fa1=function(_0x2c2ad0,_0x554163){_0x2c2ad0=_0x2c2ad0-0x0;var _0x3a6ec8=_0xfa11[_0x2c2ad0];return _0x3a6ec8;};'use strict';var _=require(_0x1fa1('0x0'));var util=require(_0x1fa1('0x1'));var moment=require(_0x1fa1('0x2'));var BPromise=require(_0x1fa1('0x3'));var rs=require(_0x1fa1('0x4'));var fs=require('fs');var Redis=require(_0x1fa1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fa1('0x6'));var logger=require(_0x1fa1('0x7'))(_0x1fa1('0x8'));var config=require(_0x1fa1('0x9'));var jayson=require(_0x1fa1('0xa'));var client=jayson[_0x1fa1('0xb')]['http']({'port':0x232a});config[_0x1fa1('0xc')]=_[_0x1fa1('0xd')](config[_0x1fa1('0xc')],{'host':_0x1fa1('0xe'),'port':0x18eb});var socket=require(_0x1fa1('0xf'))(new Redis(config[_0x1fa1('0xc')]));require('./whatsappInteraction.socket')[_0x1fa1('0x10')](socket);function respondWithRpcPromise(_0x2ebea8,_0x2ab493,_0x457064){return new BPromise(function(_0x29c28f,_0x27a588){return client[_0x1fa1('0x11')](_0x2ebea8,_0x457064)[_0x1fa1('0x12')](function(_0x32eb12){logger[_0x1fa1('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x2ab493,'request\x20sent');logger[_0x1fa1('0x14')](_0x1fa1('0x15'),_0x2ab493,_0x1fa1('0x16'),JSON[_0x1fa1('0x17')](_0x32eb12));if(_0x32eb12[_0x1fa1('0x18')]){if(_0x32eb12[_0x1fa1('0x18')][_0x1fa1('0x19')]===0x1f4){logger[_0x1fa1('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2ab493,_0x32eb12[_0x1fa1('0x18')][_0x1fa1('0x1a')]);return _0x27a588(_0x32eb12[_0x1fa1('0x18')]['message']);}logger[_0x1fa1('0x18')](_0x1fa1('0x1b'),_0x2ab493,_0x32eb12[_0x1fa1('0x18')][_0x1fa1('0x1a')]);return _0x29c28f(_0x32eb12[_0x1fa1('0x18')]['message']);}else{logger[_0x1fa1('0x13')](_0x1fa1('0x1b'),_0x2ab493,_0x1fa1('0x16'));_0x29c28f(_0x32eb12['result']['message']);}})[_0x1fa1('0x1c')](function(_0x4f540b){logger[_0x1fa1('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2ab493,_0x4f540b);_0x27a588(_0x4f540b);});});}exports[_0x1fa1('0x1d')]=function(_0x45c0f7){var _0x2d2e76=this;return new Promise(function(_0x38fbf6,_0x569ce7){return db['WhatsappInteraction'][_0x1fa1('0x1e')](_0x45c0f7[_0x1fa1('0x1f')],{'raw':_0x45c0f7['options']?_0x45c0f7[_0x1fa1('0x20')][_0x1fa1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c0f7[_0x1fa1('0x20')]?_0x45c0f7['options'][_0x1fa1('0x22')]||null:null,'attributes':_0x45c0f7[_0x1fa1('0x20')]?_0x45c0f7[_0x1fa1('0x20')][_0x1fa1('0x23')]||null:null,'limit':_0x45c0f7[_0x1fa1('0x20')]?_0x45c0f7[_0x1fa1('0x20')][_0x1fa1('0x24')]||null:null})[_0x1fa1('0x12')](function(_0x540728){logger['info'](_0x1fa1('0x1d'),_0x45c0f7);logger[_0x1fa1('0x14')](_0x1fa1('0x1d'),_0x45c0f7,JSON['stringify'](_0x540728));_0x38fbf6(_0x540728);})[_0x1fa1('0x1c')](function(_0x3a3ab5){logger['error'](_0x1fa1('0x1d'),_0x3a3ab5[_0x1fa1('0x1a')],_0x45c0f7);_0x569ce7(_0x2d2e76[_0x1fa1('0x18')](0x1f4,_0x3a3ab5[_0x1fa1('0x1a')]));});});};exports[_0x1fa1('0x25')]=function(_0x12124b){return new Promise(function(_0x1bd08c,_0x4ae87b){return db[_0x1fa1('0x26')][_0x1fa1('0x27')]({'where':_0x12124b[_0x1fa1('0x20')]?_0x12124b[_0x1fa1('0x20')][_0x1fa1('0x22')]||null:null})[_0x1fa1('0x12')](function(_0x1afff1){if(_0x1afff1){return _0x1afff1['addTags'](_0x12124b[_0x1fa1('0x1f')][_0x1fa1('0x28')],_[_0x1fa1('0x29')](_0x12124b['body'],[_0x1fa1('0x28'),'id'])||{});}})[_0x1fa1('0x2a')](function(_0x23da66){logger[_0x1fa1('0x13')](_0x1fa1('0x2b'),_0x12124b);logger[_0x1fa1('0x14')]('AddTags',_0x12124b,JSON[_0x1fa1('0x17')](_0x23da66));_0x1bd08c(_0x23da66);})['catch'](function(_0x4b5fb6){logger['error'](_0x1fa1('0x2b'),_0x4b5fb6[_0x1fa1('0x1a')],_0x12124b);_0x4ae87b(_this[_0x1fa1('0x18')](0x1f4,_0x4b5fb6[_0x1fa1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7c85b84..81d522f 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 _0xcb26=['length','save','update','emit','removeListener','register'];(function(_0x36ce02,_0x3e794d){var _0xed10fd=function(_0x2b00b){while(--_0x2b00b){_0x36ce02['push'](_0x36ce02['shift']());}};_0xed10fd(++_0x3e794d);}(_0xcb26,0x97));var _0x6cb2=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xcb26[_0x346737];return _0x1ade2e;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6cb2('0x0'),'remove',_0x6cb2('0x1')];function createListener(_0x5205cc,_0x14b265){return function(_0x323742){_0x14b265[_0x6cb2('0x2')](_0x5205cc,_0x323742);};}function removeListener(_0xedc0a4,_0x330da1){return function(){WhatsappInteractionEvents[_0x6cb2('0x3')](_0xedc0a4,_0x330da1);};}exports[_0x6cb2('0x4')]=function(_0x332cf8){for(var _0x548b22=0x0,_0xde2bd6=events[_0x6cb2('0x5')];_0x548b22<_0xde2bd6;_0x548b22++){var _0x4cbb99=events[_0x548b22];var _0x2de7fd=createListener('whatsappInteraction:'+_0x4cbb99,_0x332cf8);WhatsappInteractionEvents['on'](_0x4cbb99,_0x2de7fd);}}; \ No newline at end of file +var _0x249b=['whatsappInteraction:','remove','update','removeListener','length'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x249b,0x1c8));var _0xb249=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x249b[_0x30ae5e];return _0x1f2e93;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xb249('0x0'),_0xb249('0x1')];function createListener(_0x35737e,_0x21489e){return function(_0x55c19f){_0x21489e['emit'](_0x35737e,_0x55c19f);};}function removeListener(_0x138157,_0x2357cc){return function(){WhatsappInteractionEvents[_0xb249('0x2')](_0x138157,_0x2357cc);};}exports['register']=function(_0x11bfb6){for(var _0x5daf11=0x0,_0x5f0214=events[_0xb249('0x3')];_0x5daf11<_0x5f0214;_0x5daf11++){var _0x4603de=events[_0x5daf11];var _0x11bdd8=createListener(_0xb249('0x4')+_0x4603de,_0x11bfb6);WhatsappInteractionEvents['on'](_0x4603de,_0x11bdd8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 55c6e85..bd90fe0 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 _0x97d3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','util','path','connect-timeout','fs-extra'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0x97d3,0x140));var _0x397d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x97d3[_0x342700];return _0x53406f;};'use strict';var multer=require('multer');var util=require(_0x397d('0x0'));var path=require(_0x397d('0x1'));var timeout=require(_0x397d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x397d('0x3'));var auth=require(_0x397d('0x4'));var interaction=require(_0x397d('0x5'));var config=require(_0x397d('0x6'));var controller=require('./whatsappMessage.controller');router[_0x397d('0x7')]('/',auth[_0x397d('0x8')](),controller[_0x397d('0x9')]);router[_0x397d('0x7')](_0x397d('0xa'),auth[_0x397d('0x8')](),controller[_0x397d('0xb')]);router['get'](_0x397d('0xc'),auth[_0x397d('0x8')](),controller[_0x397d('0xd')]);router[_0x397d('0xe')]('/',auth[_0x397d('0x8')](),interaction[_0x397d('0xf')](_0x397d('0x10'),_0x397d('0x11')),controller[_0x397d('0x12')]);router['post'](_0x397d('0x13'),controller[_0x397d('0x14')]);router[_0x397d('0x15')](_0x397d('0xc'),auth[_0x397d('0x8')](),controller[_0x397d('0x16')]);router['put'](_0x397d('0x17'),auth[_0x397d('0x8')](),controller[_0x397d('0x18')]);router[_0x397d('0x15')]('/:id/reject',auth[_0x397d('0x8')](),controller[_0x397d('0x19')]);router[_0x397d('0x1a')](_0x397d('0xc'),auth[_0x397d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe747=['/:id/status','status','put','/:id/accept','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create'];(function(_0x419259,_0x424ad7){var _0x4dcc5a=function(_0x1ccfac){while(--_0x1ccfac){_0x419259['push'](_0x419259['shift']());}};_0x4dcc5a(++_0x424ad7);}(_0xe747,0x134));var _0x7e74=function(_0x37c938,_0xc4cfaf){_0x37c938=_0x37c938-0x0;var _0x4ec6cb=_0xe747[_0x37c938];return _0x4ec6cb;};'use strict';var multer=require(_0x7e74('0x0'));var util=require('util');var path=require(_0x7e74('0x1'));var timeout=require(_0x7e74('0x2'));var express=require(_0x7e74('0x3'));var router=express[_0x7e74('0x4')]();var fs_extra=require(_0x7e74('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e74('0x6'));var config=require(_0x7e74('0x7'));var controller=require('./whatsappMessage.controller');router[_0x7e74('0x8')]('/',auth[_0x7e74('0x9')](),controller['index']);router['get'](_0x7e74('0xa'),auth[_0x7e74('0x9')](),controller['describe']);router[_0x7e74('0x8')](_0x7e74('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7e74('0xc')]('/',auth['isAuthenticated'](),interaction[_0x7e74('0xd')](_0x7e74('0xe'),_0x7e74('0xf')),controller[_0x7e74('0x10')]);router['post'](_0x7e74('0x11'),controller[_0x7e74('0x12')]);router[_0x7e74('0x13')](_0x7e74('0xb'),auth[_0x7e74('0x9')](),controller['update']);router['put'](_0x7e74('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0x7e74('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x7e74('0x15')]);router[_0x7e74('0x16')]('/:id',auth[_0x7e74('0x9')](),controller[_0x7e74('0x17')]);module[_0x7e74('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4ff9052..7057da8 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 _0x8f2d=['ENUM','STRING','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x28bd31,_0x379174){_0x28bd31=_0x28bd31-0x0;var _0x56d6dd=_0x8f2d[_0x28bd31];return _0x56d6dd;};'use strict';var Sequelize=require(_0xd8f2('0x0'));module[_0xd8f2('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd8f2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd8f2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd8f2('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd8f2('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd8f2('0x5')]},'readAt':{'type':Sequelize[_0xd8f2('0x6')]},'secret':{'type':Sequelize[_0xd8f2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd8f2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x003d=['DATE','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x003d,0x1bd));var _0xd003=function(_0x51fc11,_0x18d245){_0x51fc11=_0x51fc11-0x0;var _0x4fbd6f=_0x003d[_0x51fc11];return _0x4fbd6f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xd003('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xd003('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd003('0x2')]('in',_0xd003('0x3')),'defaultValue':_0xd003('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd003('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd003('0x4')]},'readAt':{'type':Sequelize[_0xd003('0x5')]},'secret':{'type':Sequelize[_0xd003('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd003('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9bea15f..5808991 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 _0x1c22=['where','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','channel','event','EventManager','acceptmessage','whatsapp','info','RejectMessage','fullname','SIP/%s','motionChannel','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','client','http','request','then','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','sendStatus','status','end','limit','count','offset','set','json','reject','save','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c22,0x1d4));var _0x21c2=function(_0x4a36cc,_0x20f92d){_0x4a36cc=_0x4a36cc-0x0;var _0x4a1127=_0x1c22[_0x4a36cc];return _0x4a1127;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c2('0x0'));var zipdir=require(_0x21c2('0x1'));var jsonpatch=require(_0x21c2('0x2'));var rp=require(_0x21c2('0x3'));var moment=require(_0x21c2('0x4'));var BPromise=require(_0x21c2('0x5'));var Mustache=require(_0x21c2('0x6'));var util=require(_0x21c2('0x7'));var path=require(_0x21c2('0x8'));var sox=require(_0x21c2('0x9'));var csv=require(_0x21c2('0xa'));var ejs=require(_0x21c2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21c2('0xc'));var squel=require(_0x21c2('0xd'));var crypto=require(_0x21c2('0xe'));var jsforce=require(_0x21c2('0xf'));var deskjs=require(_0x21c2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x21c2('0x11'));var Papa=require(_0x21c2('0x12'));var Redis=require(_0x21c2('0x13'));var authService=require(_0x21c2('0x14'));var qs=require(_0x21c2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x21c2('0x16'))(_0x21c2('0x17'));var utils=require(_0x21c2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x21c2('0x19'));var db=require(_0x21c2('0x1a'))['db'];config[_0x21c2('0x1b')]=_['defaults'](config[_0x21c2('0x1b')],{'host':_0x21c2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x21c2('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x21c2('0x1e')][_0x21c2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x11252a,_0x3c7567,_0x270d6b,_0x80c45f){return new BPromise(function(_0x311617,_0x7df785){var _0x349dec=_0x80c45f||client;return _0x349dec[_0x21c2('0x20')](_0x11252a,_0x270d6b)[_0x21c2('0x21')](function(_0x471238){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3c7567,_0x21c2('0x22'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3c7567,_0x21c2('0x22'),JSON[_0x21c2('0x23')](_0x471238));if(_0x471238[_0x21c2('0x24')]){if(_0x471238[_0x21c2('0x24')]['code']===0x1f4){logger[_0x21c2('0x24')](_0x21c2('0x25'),_0x3c7567,_0x471238['error'][_0x21c2('0x26')]);return _0x7df785(_0x471238['error'][_0x21c2('0x26')]);}logger['error'](_0x21c2('0x25'),_0x3c7567,_0x471238[_0x21c2('0x24')][_0x21c2('0x26')]);return _0x311617(_0x471238['error']['message']);}else{logger['info'](_0x21c2('0x25'),_0x3c7567,_0x21c2('0x22'));_0x311617(_0x471238['result'][_0x21c2('0x26')]);}})['catch'](function(_0x276475){logger['error'](_0x21c2('0x25'),_0x3c7567,_0x276475);_0x7df785(_0x276475);});});}function respondWithStatusCode(_0x341554,_0x4629d1){_0x4629d1=_0x4629d1||0xcc;return function(_0x5c07f1){if(_0x5c07f1){return _0x341554[_0x21c2('0x27')](_0x4629d1);}return _0x341554[_0x21c2('0x28')](_0x4629d1)[_0x21c2('0x29')]();};}function respondWithResult(_0x184187,_0x22446f){_0x22446f=_0x22446f||0xc8;return function(_0x5d376a){if(_0x5d376a){return _0x184187[_0x21c2('0x28')](_0x22446f)['json'](_0x5d376a);}};}function respondWithFilteredResult(_0x33e848,_0x14e8f1){return function(_0x3be9ed){if(_0x3be9ed){var _0x323281=typeof _0x14e8f1['offset']==='undefined'&&typeof _0x14e8f1[_0x21c2('0x2a')]==='undefined';var _0x3060f4=_0x3be9ed[_0x21c2('0x2b')];var _0x374847=_0x323281?0x0:_0x14e8f1['offset'];var _0x3d2677=_0x323281?_0x3be9ed[_0x21c2('0x2b')]:_0x14e8f1[_0x21c2('0x2c')]+_0x14e8f1[_0x21c2('0x2a')];var _0x4e548b;if(_0x3d2677>=_0x3060f4){_0x3d2677=_0x3060f4;_0x4e548b=0xc8;}else{_0x4e548b=0xce;}_0x33e848[_0x21c2('0x28')](_0x4e548b);return _0x33e848[_0x21c2('0x2d')]('Content-Range',_0x374847+'-'+_0x3d2677+'/'+_0x3060f4)[_0x21c2('0x2e')](_0x3be9ed);}return null;};}function patchUpdates(_0x104834){return function(_0x34397){try{jsonpatch['apply'](_0x34397,_0x104834,!![]);}catch(_0x15a293){return BPromise[_0x21c2('0x2f')](_0x15a293);}return _0x34397[_0x21c2('0x30')]();};}function saveUpdates(_0x1f703f,_0x322f50){return function(_0x540a72){if(_0x540a72){return _0x540a72[_0x21c2('0x31')](_0x1f703f)['then'](function(_0x333636){return _0x333636;});}return null;};}function removeEntity(_0xc977fc,_0x2fed5f){return function(_0xaee3fe){if(_0xaee3fe){return _0xaee3fe[_0x21c2('0x32')]()['then'](function(){_0xc977fc[_0x21c2('0x28')](0xcc)[_0x21c2('0x29')]();});}};}function handleEntityNotFound(_0x1aa54f,_0x2cb658){return function(_0x4e3fe7){if(!_0x4e3fe7){_0x1aa54f[_0x21c2('0x27')](0x194);}return _0x4e3fe7;};}function handleError(_0x327a1d,_0x3da5b3){_0x3da5b3=_0x3da5b3||0x1f4;return function(_0x28db2e){logger[_0x21c2('0x24')](_0x28db2e[_0x21c2('0x33')]);if(_0x28db2e[_0x21c2('0x34')]){delete _0x28db2e[_0x21c2('0x34')];}_0x327a1d[_0x21c2('0x28')](_0x3da5b3)['send'](_0x28db2e);};}exports[_0x21c2('0x35')]=function(_0xd9a56e,_0x2edc22){var _0xe2f98e={},_0x42bef1={},_0x2ca0ea={'count':0x0,'rows':[]};var _0x2f9b11=_['map'](db[_0x21c2('0x36')][_0x21c2('0x37')],function(_0x18802e){return{'name':_0x18802e[_0x21c2('0x38')],'type':_0x18802e[_0x21c2('0x39')][_0x21c2('0x3a')]};});_0x42bef1[_0x21c2('0x3b')]=_[_0x21c2('0x3c')](_0x2f9b11,_0x21c2('0x34'));_0x42bef1[_0x21c2('0x3d')]=_[_0x21c2('0x3e')](_0xd9a56e[_0x21c2('0x3d')]);_0x42bef1[_0x21c2('0x3f')]=_['intersection'](_0x42bef1[_0x21c2('0x3b')],_0x42bef1[_0x21c2('0x3d')]);_0xe2f98e[_0x21c2('0x40')]=_[_0x21c2('0x41')](_0x42bef1['model'],qs[_0x21c2('0x42')](_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x42')]));_0xe2f98e['attributes']=_0xe2f98e[_0x21c2('0x40')][_0x21c2('0x43')]?_0xe2f98e['attributes']:_0x42bef1[_0x21c2('0x3b')];if(!_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x44')](_0x21c2('0x45'))){_0xe2f98e[_0x21c2('0x2a')]=qs[_0x21c2('0x2a')](_0xd9a56e[_0x21c2('0x3d')]['limit']);_0xe2f98e[_0x21c2('0x2c')]=qs[_0x21c2('0x2c')](_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x2c')]);}_0xe2f98e[_0x21c2('0x46')]=qs[_0x21c2('0x47')](_0xd9a56e[_0x21c2('0x3d')]['sort']);_0xe2f98e[_0x21c2('0x48')]=qs[_0x21c2('0x3f')](_['pick'](_0xd9a56e[_0x21c2('0x3d')],_0x42bef1[_0x21c2('0x3f')]),_0x2f9b11);if(_0xd9a56e['query'][_0x21c2('0x49')]){_0xe2f98e[_0x21c2('0x48')]=_[_0x21c2('0x4a')](_0xe2f98e[_0x21c2('0x48')],{'$or':_[_0x21c2('0x3c')](_0x2f9b11,function(_0x4d1f2a){if(_0x4d1f2a['type']!=='VIRTUAL'){var _0x51a1a0={};_0x51a1a0[_0x4d1f2a[_0x21c2('0x34')]]={'$like':'%'+_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x49')]+'%'};return _0x51a1a0;}})});}_0xe2f98e=_['merge']({},_0xe2f98e,_0xd9a56e['options']);var _0x354802={'where':_0xe2f98e[_0x21c2('0x48')]};return db[_0x21c2('0x36')][_0x21c2('0x2b')](_0x354802)[_0x21c2('0x21')](function(_0x400dd4){_0x2ca0ea[_0x21c2('0x2b')]=_0x400dd4;if(_0xd9a56e[_0x21c2('0x3d')][_0x21c2('0x4b')]){_0xe2f98e[_0x21c2('0x4c')]=[{'all':!![]}];}return db[_0x21c2('0x36')][_0x21c2('0x4d')](_0xe2f98e);})[_0x21c2('0x21')](function(_0x417cb1){_0x2ca0ea[_0x21c2('0x4e')]=_0x417cb1;return _0x2ca0ea;})[_0x21c2('0x21')](respondWithFilteredResult(_0x2edc22,_0xe2f98e))[_0x21c2('0x4f')](handleError(_0x2edc22,null));};exports[_0x21c2('0x50')]=function(_0x5bc7fb,_0x504b17){var _0x245896={'raw':!![],'where':{'id':_0x5bc7fb[_0x21c2('0x51')]['id']}},_0xf297a4={};_0xf297a4['model']=_['keys'](db['WhatsappMessage'][_0x21c2('0x37')]);_0xf297a4[_0x21c2('0x3d')]=_[_0x21c2('0x3e')](_0x5bc7fb[_0x21c2('0x3d')]);_0xf297a4[_0x21c2('0x3f')]=_[_0x21c2('0x41')](_0xf297a4['model'],_0xf297a4['query']);_0x245896[_0x21c2('0x40')]=_[_0x21c2('0x41')](_0xf297a4[_0x21c2('0x3b')],qs[_0x21c2('0x42')](_0x5bc7fb[_0x21c2('0x3d')][_0x21c2('0x42')]));_0x245896[_0x21c2('0x40')]=_0x245896[_0x21c2('0x40')][_0x21c2('0x43')]?_0x245896[_0x21c2('0x40')]:_0xf297a4['model'];if(_0x5bc7fb[_0x21c2('0x3d')]['includeAll']){_0x245896['include']=[{'all':!![]}];}_0x245896=_[_0x21c2('0x4a')]({},_0x245896,_0x5bc7fb['options']);return db['WhatsappMessage']['find'](_0x245896)['then'](handleEntityNotFound(_0x504b17,null))[_0x21c2('0x21')](respondWithResult(_0x504b17,null))[_0x21c2('0x4f')](handleError(_0x504b17,null));};exports[_0x21c2('0x52')]=function(_0x5af6f7,_0x992684){return db['WhatsappMessage'][_0x21c2('0x52')](_0x5af6f7['body'],{})[_0x21c2('0x21')](respondWithResult(_0x992684,0xc9))[_0x21c2('0x4f')](handleError(_0x992684,null));};exports[_0x21c2('0x31')]=function(_0x423e73,_0x5a8d15){if(_0x423e73[_0x21c2('0x53')]['id']){delete _0x423e73[_0x21c2('0x53')]['id'];}return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0x423e73[_0x21c2('0x51')]['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x5a8d15,null))[_0x21c2('0x21')](saveUpdates(_0x423e73[_0x21c2('0x53')],null))['then'](respondWithResult(_0x5a8d15,null))['catch'](handleError(_0x5a8d15,null));};exports[_0x21c2('0x32')]=function(_0x4e8eb8,_0x2d5dc7){return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0x4e8eb8['params']['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x2d5dc7,null))[_0x21c2('0x21')](removeEntity(_0x2d5dc7,null))[_0x21c2('0x4f')](handleError(_0x2d5dc7,null));};exports[_0x21c2('0x55')]=function(_0x45b7d5,_0x3274c2){return db[_0x21c2('0x36')][_0x21c2('0x55')]()['then'](respondWithResult(_0x3274c2,null))[_0x21c2('0x4f')](handleError(_0x3274c2,null));};var interaction_log=require(_0x21c2('0x16'))(_0x21c2('0x56'));exports[_0x21c2('0x57')]=function(_0x44aea,_0x2457ee,_0x366876){var _0x4b7fca={'agent':{},'channel':'whatsapp'};if(_0x44aea[_0x21c2('0x53')]['id']){delete _0x44aea['body']['id'];}_0x44aea['body'][_0x21c2('0x58')]=!![];_0x44aea[_0x21c2('0x53')][_0x21c2('0x59')]=moment()[_0x21c2('0x5a')](_0x21c2('0x5b'));_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')]=_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')]||_0x44aea[_0x21c2('0x5d')]['id'];_0x4b7fca[_0x21c2('0x5e')]['id']=_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')];return db['WhatsappMessage'][_0x21c2('0x54')]({'where':{'id':_0x44aea[_0x21c2('0x51')]['id'],'UserId':null}})[_0x21c2('0x21')](handleEntityNotFound(_0x2457ee,null))['then'](saveUpdates(_0x44aea[_0x21c2('0x53')],null))['then'](function(_0x6af9ca){if(_0x6af9ca){_0x4b7fca['message']=_0x6af9ca['get']({'plain':!![]});return db[_0x21c2('0x5f')]['find']({'where':{'id':_0x6af9ca[_0x21c2('0x60')]}});}return null;})[_0x21c2('0x21')](handleEntityNotFound(_0x2457ee,null))[_0x21c2('0x21')](function(_0xdc1e62){if(_0xdc1e62){return _0xdc1e62['update']({'UserId':_0x44aea[_0x21c2('0x53')][_0x21c2('0x5c')],'read1stAt':_[_0x21c2('0x61')](_0xdc1e62[_0x21c2('0x62')])?moment()[_0x21c2('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x21c2('0x21')](function(_0x2e74a3){if(_0x2e74a3){_0x4b7fca[_0x21c2('0x63')]=_0x2e74a3[_0x21c2('0x64')]({'plain':!![]});interaction_log['info'](_0x21c2('0x65'),_0x44aea['user']['id'],_0x44aea[_0x21c2('0x5d')][_0x21c2('0x34')],_0x44aea[_0x21c2('0x5d')][_0x21c2('0x66')],_0x4b7fca[_0x21c2('0x63')]['id'],_0x44aea['body']?JSON[_0x21c2('0x23')](_0x44aea[_0x21c2('0x53')]):_0x21c2('0x67'));return respondWithRpcPromise(_0x21c2('0x68'),_0x21c2('0x69'),_0x4b7fca);}return null;})[_0x21c2('0x21')](function(_0x1993bf){var _0x1531de=_0x21c2('0x6a')+_0x1993bf[_0x21c2('0x26')][_0x21c2('0x6b')];return db[_0x21c2('0x6c')][_0x21c2('0x3d')](_0x1531de,{'type':db[_0x21c2('0x6d')][_0x21c2('0x6e')][_0x21c2('0x6f')],'raw':!![]})[_0x21c2('0x21')](function(_0x81e7f4){return _0x81e7f4;});})[_0x21c2('0x21')](function(_0x49621c){if(_0x49621c){_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x70')]=_0x49621c[0x0];if(!_0x44aea[_0x21c2('0x53')]['UserId'])return;return db['User'][_0x21c2('0x54')]({'where':{'id':_0x44aea[_0x21c2('0x53')]['UserId'],'role':_0x21c2('0x5e')},'attributes':['id','name','fullname',_0x21c2('0x71'),_0x21c2('0x72')],'raw':!![]});}return null;})[_0x21c2('0x21')](function(_0xc026a7){if(!_0xc026a7)return null;_0x4b7fca[_0x21c2('0x26')]['agent']=_0xc026a7;return _0x4b7fca;})[_0x21c2('0x21')](function(_0x2a3418){if(_0x2a3418){if(_0x44aea[_0x21c2('0x53')][_0x21c2('0x73')]){_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x74')]=util[_0x21c2('0x5a')]('SIP/%s',_0x44aea[_0x21c2('0x5d')][_0x21c2('0x34')]);_0x4b7fca[_0x21c2('0x26')][_0x21c2('0x75')]=_0x4b7fca[_0x21c2('0x75')];_0x4b7fca[_0x21c2('0x26')]['motionChannel']=_0x4b7fca[_0x21c2('0x75')];_0x4b7fca['message'][_0x21c2('0x76')]=_0x21c2('0x57');return respondWithRpcPromise('EventManager',_0x21c2('0x77'),{'event':_0x21c2('0x78'),'message':_0x4b7fca[_0x21c2('0x26')]},client9002)[_0x21c2('0x21')](function(){return _0x4b7fca;});}return _0x4b7fca;}return null;})[_0x21c2('0x21')](respondWithResult(_0x2457ee,null))[_0x21c2('0x4f')](handleError(_0x2457ee,null));};var interaction_log=require(_0x21c2('0x16'))('whatsapp-interactions');exports['reject']=function(_0xa17f41,_0x7639c7,_0x139e4d){var _0x4db482={'agent':{},'channel':_0x21c2('0x79')};if(_0xa17f41[_0x21c2('0x53')]['id']){delete _0xa17f41[_0x21c2('0x53')]['id'];}_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')]=_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')]||_0xa17f41['user']['id'];_0x4db482[_0x21c2('0x5e')]['id']=_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')];return db[_0x21c2('0x36')][_0x21c2('0x54')]({'where':{'id':_0xa17f41[_0x21c2('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7639c7,null))[_0x21c2('0x21')](function(_0x5660cb){if(_0x5660cb){_0x4db482[_0x21c2('0x26')]=_0x5660cb[_0x21c2('0x64')]({'plain':!![]});return db[_0x21c2('0x5f')][_0x21c2('0x54')]({'where':{'id':_0x5660cb[_0x21c2('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x7639c7,null))['then'](function(_0xd64d6){if(_0xd64d6){_0x4db482[_0x21c2('0x63')]=_0xd64d6[_0x21c2('0x64')]({'plain':!![]});interaction_log[_0x21c2('0x7a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa17f41[_0x21c2('0x5d')]['id'],_0xa17f41[_0x21c2('0x5d')]['name'],_0xa17f41[_0x21c2('0x5d')]['role'],_0x4db482[_0x21c2('0x63')]['id'],_0xa17f41[_0x21c2('0x53')]?JSON[_0x21c2('0x23')](_0xa17f41[_0x21c2('0x53')]):'null');return respondWithRpcPromise(_0x21c2('0x7b'),'rejectMessage',_0x4db482);}return null;})[_0x21c2('0x21')](function(_0x2f4123){var _0x2875ce=_0x21c2('0x6a')+_0x2f4123[_0x21c2('0x26')][_0x21c2('0x6b')];return db[_0x21c2('0x6c')]['query'](_0x2875ce,{'type':db['Sequelize'][_0x21c2('0x6e')][_0x21c2('0x6f')],'raw':!![]})[_0x21c2('0x21')](function(_0x2c9b47){return _0x2c9b47;});})[_0x21c2('0x21')](function(_0x576998){if(_0x576998){_0x4db482[_0x21c2('0x26')][_0x21c2('0x70')]=_0x576998[0x0];if(!_0xa17f41['body']['UserId'])return;return db['User'][_0x21c2('0x54')]({'where':{'id':_0xa17f41[_0x21c2('0x53')][_0x21c2('0x5c')],'role':_0x21c2('0x5e')},'attributes':['id',_0x21c2('0x34'),_0x21c2('0x7c'),'email',_0x21c2('0x72')],'raw':!![]});}return null;})[_0x21c2('0x21')](function(_0x73e4c0){if(!_0x73e4c0)return null;_0x4db482[_0x21c2('0x26')]['agent']=_0x73e4c0;return _0x4db482;})['then'](function(_0x47138a){if(_0x47138a){_0x47138a[_0x21c2('0x26')][_0x21c2('0x74')]=util[_0x21c2('0x5a')](_0x21c2('0x7d'),_0xa17f41[_0x21c2('0x5d')]['name']);_0x47138a['message'][_0x21c2('0x75')]=_0x4db482['channel'];_0x47138a[_0x21c2('0x26')][_0x21c2('0x7e')]=_0x4db482[_0x21c2('0x75')];_0x47138a['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x47138a[_0x21c2('0x26')]},client9002);return _0x4db482;}return null;})[_0x21c2('0x21')](respondWithResult(_0x7639c7,null))[_0x21c2('0x4f')](handleError(_0x7639c7,null));};exports[_0x21c2('0x28')]=function(_0x10294c,_0x227cd5,_0x1cfdf4){if(_0x10294c[_0x21c2('0x53')]['id']){delete _0x10294c[_0x21c2('0x53')]['id'];}var _0x52732b;return db['WhatsappMessage'][_0x21c2('0x54')]({'where':{'id':_0x10294c[_0x21c2('0x51')]['id']}})[_0x21c2('0x21')](handleEntityNotFound(_0x227cd5,null))[_0x21c2('0x21')](function(_0x3955fc){if(_0x3955fc){_0x52732b=_0x3955fc;return db[_0x21c2('0x7f')][_0x21c2('0x54')]({'where':{'id':_0x3955fc['WhatsappAccountId']}});}})[_0x21c2('0x21')](handleEntityNotFound(_0x227cd5,null))['then'](function(_0xcf2abd){if(_0xcf2abd){logger[_0x21c2('0x80')](_0x21c2('0x81'),_0x21c2('0x28'),'received\x20delivery\x20report\x20from',_0xcf2abd['type'],util[_0x21c2('0x82')](_0x10294c[_0x21c2('0x53')],{'showHidden':![],'depth':null}));switch(_0xcf2abd['type']){case _0x21c2('0x83'):if(_0x10294c[_0x21c2('0x53')][_0x21c2('0x84')]&&_0x10294c[_0x21c2('0x53')][_0x21c2('0x84')]===_0x52732b['messageId']&&_0x10294c[_0x21c2('0x53')][_0x21c2('0x85')]&&_0x10294c['body'][_0x21c2('0x85')]==='read'){return _0x52732b['update']({'read':!![]});}else{logger[_0x21c2('0x24')](_0x21c2('0x86'),_0x21c2('0x28'),_0x21c2('0x83'),util[_0x21c2('0x82')](_0x10294c[_0x21c2('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x52732b;}})['then'](respondWithResult(_0x227cd5,null))[_0x21c2('0x4f')](handleError(_0x227cd5,null));}; \ No newline at end of file +var _0xfea0=['WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT','fullname','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','rows','show','params','length','include','create','body','find','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','update','isNil','read1stAt','interaction','user','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions'];(function(_0x5d93c7,_0x580b09){var _0x54a38b=function(_0x38c4c2){while(--_0x38c4c2){_0x5d93c7['push'](_0x5d93c7['shift']());}};_0x54a38b(++_0x580b09);}(_0xfea0,0x121));var _0x0fea=function(_0x4138dc,_0x18f7d3){_0x4138dc=_0x4138dc-0x0;var _0x14b393=_0xfea0[_0x4138dc];return _0x14b393;};'use strict';var emlformat=require(_0x0fea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fea('0x1'));var jsonpatch=require(_0x0fea('0x2'));var rp=require(_0x0fea('0x3'));var moment=require(_0x0fea('0x4'));var BPromise=require(_0x0fea('0x5'));var Mustache=require(_0x0fea('0x6'));var util=require('util');var path=require(_0x0fea('0x7'));var sox=require(_0x0fea('0x8'));var csv=require(_0x0fea('0x9'));var ejs=require(_0x0fea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fea('0xb'));var squel=require(_0x0fea('0xc'));var crypto=require(_0x0fea('0xd'));var jsforce=require(_0x0fea('0xe'));var deskjs=require(_0x0fea('0xf'));var toCsv=require(_0x0fea('0x9'));var querystring=require(_0x0fea('0x10'));var Papa=require(_0x0fea('0x11'));var Redis=require('ioredis');var authService=require(_0x0fea('0x12'));var qs=require(_0x0fea('0x13'));var as=require(_0x0fea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fea('0x15'))(_0x0fea('0x16'));var utils=require(_0x0fea('0x17'));var config=require(_0x0fea('0x18'));var licenseUtil=require(_0x0fea('0x19'));var db=require('../../mysqldb')['db'];config[_0x0fea('0x1a')]=_['defaults'](config[_0x0fea('0x1a')],{'host':_0x0fea('0x1b'),'port':0x18eb});var socket=require(_0x0fea('0x1c'))(new Redis(config['redis']));require(_0x0fea('0x1d'))[_0x0fea('0x1e')](socket);var jayson=require(_0x0fea('0x1f'));var client=jayson[_0x0fea('0x20')][_0x0fea('0x21')]({'port':0x232c});var client9002=jayson[_0x0fea('0x20')][_0x0fea('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x27452f,_0x45f9ac,_0x282d3d,_0x5f043b){return new BPromise(function(_0x2a5d8b,_0x3fd470){var _0x1b4e31=_0x5f043b||client;return _0x1b4e31[_0x0fea('0x22')](_0x27452f,_0x282d3d)['then'](function(_0x42652a){logger[_0x0fea('0x23')](_0x0fea('0x24'),_0x45f9ac,_0x0fea('0x25'));logger[_0x0fea('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x45f9ac,_0x0fea('0x25'),JSON[_0x0fea('0x27')](_0x42652a));if(_0x42652a[_0x0fea('0x28')]){if(_0x42652a[_0x0fea('0x28')]['code']===0x1f4){logger[_0x0fea('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x45f9ac,_0x42652a['error'][_0x0fea('0x29')]);return _0x3fd470(_0x42652a['error'][_0x0fea('0x29')]);}logger[_0x0fea('0x28')](_0x0fea('0x24'),_0x45f9ac,_0x42652a[_0x0fea('0x28')][_0x0fea('0x29')]);return _0x2a5d8b(_0x42652a[_0x0fea('0x28')][_0x0fea('0x29')]);}else{logger[_0x0fea('0x23')](_0x0fea('0x24'),_0x45f9ac,_0x0fea('0x25'));_0x2a5d8b(_0x42652a[_0x0fea('0x2a')][_0x0fea('0x29')]);}})[_0x0fea('0x2b')](function(_0x398edd){logger[_0x0fea('0x28')](_0x0fea('0x24'),_0x45f9ac,_0x398edd);_0x3fd470(_0x398edd);});});}function respondWithStatusCode(_0x41123e,_0x3d8e07){_0x3d8e07=_0x3d8e07||0xcc;return function(_0x21d946){if(_0x21d946){return _0x41123e[_0x0fea('0x2c')](_0x3d8e07);}return _0x41123e[_0x0fea('0x2d')](_0x3d8e07)[_0x0fea('0x2e')]();};}function respondWithResult(_0x2a86dd,_0x33f8b8){_0x33f8b8=_0x33f8b8||0xc8;return function(_0x2d402d){if(_0x2d402d){return _0x2a86dd['status'](_0x33f8b8)[_0x0fea('0x2f')](_0x2d402d);}};}function respondWithFilteredResult(_0x2fc744,_0x5e791e){return function(_0x5dd84a){if(_0x5dd84a){var _0x5ee2ce=typeof _0x5e791e[_0x0fea('0x30')]===_0x0fea('0x31')&&typeof _0x5e791e[_0x0fea('0x32')]===_0x0fea('0x31');var _0x2d5324=_0x5dd84a[_0x0fea('0x33')];var _0x374c90=_0x5ee2ce?0x0:_0x5e791e[_0x0fea('0x30')];var _0x44641d=_0x5ee2ce?_0x5dd84a[_0x0fea('0x33')]:_0x5e791e[_0x0fea('0x30')]+_0x5e791e[_0x0fea('0x32')];var _0xf382e5;if(_0x44641d>=_0x2d5324){_0x44641d=_0x2d5324;_0xf382e5=0xc8;}else{_0xf382e5=0xce;}_0x2fc744[_0x0fea('0x2d')](_0xf382e5);return _0x2fc744[_0x0fea('0x34')](_0x0fea('0x35'),_0x374c90+'-'+_0x44641d+'/'+_0x2d5324)[_0x0fea('0x2f')](_0x5dd84a);}return null;};}function patchUpdates(_0x2f2684){return function(_0x336627){try{jsonpatch['apply'](_0x336627,_0x2f2684,!![]);}catch(_0x16330b){return BPromise[_0x0fea('0x36')](_0x16330b);}return _0x336627[_0x0fea('0x37')]();};}function saveUpdates(_0x10415f,_0x8d4325){return function(_0x4bf765){if(_0x4bf765){return _0x4bf765['update'](_0x10415f)[_0x0fea('0x38')](function(_0x32bfc5){return _0x32bfc5;});}return null;};}function removeEntity(_0x5c1069,_0x3ccd21){return function(_0x1209ab){if(_0x1209ab){return _0x1209ab[_0x0fea('0x39')]()[_0x0fea('0x38')](function(){_0x5c1069[_0x0fea('0x2d')](0xcc)[_0x0fea('0x2e')]();});}};}function handleEntityNotFound(_0x8ad4ad,_0x11daa2){return function(_0x37c81a){if(!_0x37c81a){_0x8ad4ad['sendStatus'](0x194);}return _0x37c81a;};}function handleError(_0x488a11,_0x58d748){_0x58d748=_0x58d748||0x1f4;return function(_0x57aa2b){logger[_0x0fea('0x28')](_0x57aa2b['stack']);if(_0x57aa2b[_0x0fea('0x3a')]){delete _0x57aa2b[_0x0fea('0x3a')];}_0x488a11[_0x0fea('0x2d')](_0x58d748)[_0x0fea('0x3b')](_0x57aa2b);};}exports[_0x0fea('0x3c')]=function(_0x2c5a77,_0x159bf4){var _0x256152={},_0x5731e0={},_0x377212={'count':0x0,'rows':[]};var _0x4da7a5=_[_0x0fea('0x3d')](db[_0x0fea('0x3e')][_0x0fea('0x3f')],function(_0x2c663c){return{'name':_0x2c663c[_0x0fea('0x40')],'type':_0x2c663c[_0x0fea('0x41')][_0x0fea('0x42')]};});_0x5731e0[_0x0fea('0x43')]=_['map'](_0x4da7a5,'name');_0x5731e0['query']=_[_0x0fea('0x44')](_0x2c5a77['query']);_0x5731e0[_0x0fea('0x45')]=_[_0x0fea('0x46')](_0x5731e0[_0x0fea('0x43')],_0x5731e0[_0x0fea('0x47')]);_0x256152[_0x0fea('0x48')]=_[_0x0fea('0x46')](_0x5731e0[_0x0fea('0x43')],qs['fields'](_0x2c5a77['query'][_0x0fea('0x49')]));_0x256152['attributes']=_0x256152[_0x0fea('0x48')]['length']?_0x256152[_0x0fea('0x48')]:_0x5731e0['model'];if(!_0x2c5a77['query'][_0x0fea('0x4a')](_0x0fea('0x4b'))){_0x256152[_0x0fea('0x32')]=qs[_0x0fea('0x32')](_0x2c5a77[_0x0fea('0x47')][_0x0fea('0x32')]);_0x256152[_0x0fea('0x30')]=qs['offset'](_0x2c5a77[_0x0fea('0x47')][_0x0fea('0x30')]);}_0x256152[_0x0fea('0x4c')]=qs[_0x0fea('0x4d')](_0x2c5a77[_0x0fea('0x47')]['sort']);_0x256152[_0x0fea('0x4e')]=qs[_0x0fea('0x45')](_[_0x0fea('0x4f')](_0x2c5a77[_0x0fea('0x47')],_0x5731e0[_0x0fea('0x45')]),_0x4da7a5);if(_0x2c5a77[_0x0fea('0x47')]['filter']){_0x256152[_0x0fea('0x4e')]=_[_0x0fea('0x50')](_0x256152[_0x0fea('0x4e')],{'$or':_[_0x0fea('0x3d')](_0x4da7a5,function(_0xdca842){if(_0xdca842[_0x0fea('0x41')]!=='VIRTUAL'){var _0x2f7b47={};_0x2f7b47[_0xdca842[_0x0fea('0x3a')]]={'$like':'%'+_0x2c5a77[_0x0fea('0x47')]['filter']+'%'};return _0x2f7b47;}})});}_0x256152=_['merge']({},_0x256152,_0x2c5a77[_0x0fea('0x51')]);var _0x41bea6={'where':_0x256152[_0x0fea('0x4e')]};return db[_0x0fea('0x3e')][_0x0fea('0x33')](_0x41bea6)[_0x0fea('0x38')](function(_0x5edb9e){_0x377212[_0x0fea('0x33')]=_0x5edb9e;if(_0x2c5a77[_0x0fea('0x47')][_0x0fea('0x52')]){_0x256152['include']=[{'all':!![]}];}return db[_0x0fea('0x3e')]['findAll'](_0x256152);})[_0x0fea('0x38')](function(_0x4775ce){_0x377212[_0x0fea('0x53')]=_0x4775ce;return _0x377212;})['then'](respondWithFilteredResult(_0x159bf4,_0x256152))[_0x0fea('0x2b')](handleError(_0x159bf4,null));};exports[_0x0fea('0x54')]=function(_0x2b5ac4,_0x4fd47d){var _0x1843e={'raw':!![],'where':{'id':_0x2b5ac4[_0x0fea('0x55')]['id']}},_0x4f54c9={};_0x4f54c9['model']=_[_0x0fea('0x44')](db[_0x0fea('0x3e')][_0x0fea('0x3f')]);_0x4f54c9['query']=_[_0x0fea('0x44')](_0x2b5ac4[_0x0fea('0x47')]);_0x4f54c9[_0x0fea('0x45')]=_['intersection'](_0x4f54c9[_0x0fea('0x43')],_0x4f54c9['query']);_0x1843e[_0x0fea('0x48')]=_[_0x0fea('0x46')](_0x4f54c9[_0x0fea('0x43')],qs[_0x0fea('0x49')](_0x2b5ac4[_0x0fea('0x47')][_0x0fea('0x49')]));_0x1843e[_0x0fea('0x48')]=_0x1843e[_0x0fea('0x48')][_0x0fea('0x56')]?_0x1843e[_0x0fea('0x48')]:_0x4f54c9[_0x0fea('0x43')];if(_0x2b5ac4[_0x0fea('0x47')][_0x0fea('0x52')]){_0x1843e[_0x0fea('0x57')]=[{'all':!![]}];}_0x1843e=_['merge']({},_0x1843e,_0x2b5ac4['options']);return db[_0x0fea('0x3e')]['find'](_0x1843e)[_0x0fea('0x38')](handleEntityNotFound(_0x4fd47d,null))[_0x0fea('0x38')](respondWithResult(_0x4fd47d,null))[_0x0fea('0x2b')](handleError(_0x4fd47d,null));};exports[_0x0fea('0x58')]=function(_0x35a64d,_0x57254c){return db[_0x0fea('0x3e')][_0x0fea('0x58')](_0x35a64d[_0x0fea('0x59')],{})[_0x0fea('0x38')](respondWithResult(_0x57254c,0xc9))[_0x0fea('0x2b')](handleError(_0x57254c,null));};exports['update']=function(_0x4ebefa,_0x2c3721){if(_0x4ebefa['body']['id']){delete _0x4ebefa['body']['id'];}return db[_0x0fea('0x3e')][_0x0fea('0x5a')]({'where':{'id':_0x4ebefa[_0x0fea('0x55')]['id']}})[_0x0fea('0x38')](handleEntityNotFound(_0x2c3721,null))['then'](saveUpdates(_0x4ebefa[_0x0fea('0x59')],null))['then'](respondWithResult(_0x2c3721,null))['catch'](handleError(_0x2c3721,null));};exports['destroy']=function(_0x379689,_0x1e760b){return db['WhatsappMessage'][_0x0fea('0x5a')]({'where':{'id':_0x379689[_0x0fea('0x55')]['id']}})[_0x0fea('0x38')](handleEntityNotFound(_0x1e760b,null))[_0x0fea('0x38')](removeEntity(_0x1e760b,null))[_0x0fea('0x2b')](handleError(_0x1e760b,null));};exports['describe']=function(_0x1c12dd,_0x4d3929){return db[_0x0fea('0x3e')]['describe']()[_0x0fea('0x38')](respondWithResult(_0x4d3929,null))[_0x0fea('0x2b')](handleError(_0x4d3929,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x0fea('0x5b')]=function(_0x2593cf,_0x4950b4,_0x2b5158){var _0xe634c={'agent':{},'channel':_0x0fea('0x5c')};if(_0x2593cf[_0x0fea('0x59')]['id']){delete _0x2593cf[_0x0fea('0x59')]['id'];}_0x2593cf['body']['read']=!![];_0x2593cf[_0x0fea('0x59')][_0x0fea('0x5d')]=moment()[_0x0fea('0x5e')](_0x0fea('0x5f'));_0x2593cf[_0x0fea('0x59')][_0x0fea('0x60')]=_0x2593cf[_0x0fea('0x59')][_0x0fea('0x60')]||_0x2593cf['user']['id'];_0xe634c['agent']['id']=_0x2593cf[_0x0fea('0x59')][_0x0fea('0x60')];return db[_0x0fea('0x3e')]['find']({'where':{'id':_0x2593cf[_0x0fea('0x55')]['id'],'UserId':null}})[_0x0fea('0x38')](handleEntityNotFound(_0x4950b4,null))[_0x0fea('0x38')](saveUpdates(_0x2593cf[_0x0fea('0x59')],null))[_0x0fea('0x38')](function(_0x261dff){if(_0x261dff){_0xe634c[_0x0fea('0x29')]=_0x261dff[_0x0fea('0x61')]({'plain':!![]});return db[_0x0fea('0x62')]['find']({'where':{'id':_0x261dff['WhatsappInteractionId']}});}return null;})[_0x0fea('0x38')](handleEntityNotFound(_0x4950b4,null))[_0x0fea('0x38')](function(_0x256733){if(_0x256733){return _0x256733[_0x0fea('0x63')]({'UserId':_0x2593cf[_0x0fea('0x59')][_0x0fea('0x60')],'read1stAt':_[_0x0fea('0x64')](_0x256733[_0x0fea('0x65')])?moment()[_0x0fea('0x5e')](_0x0fea('0x5f')):undefined});}return null;})[_0x0fea('0x38')](function(_0x278436){if(_0x278436){_0xe634c[_0x0fea('0x66')]=_0x278436[_0x0fea('0x61')]({'plain':!![]});interaction_log[_0x0fea('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2593cf['user']['id'],_0x2593cf[_0x0fea('0x67')]['name'],_0x2593cf[_0x0fea('0x67')]['role'],_0xe634c[_0x0fea('0x66')]['id'],_0x2593cf[_0x0fea('0x59')]?JSON[_0x0fea('0x27')](_0x2593cf[_0x0fea('0x59')]):_0x0fea('0x68'));return respondWithRpcPromise(_0x0fea('0x69'),'acceptMessage',_0xe634c);}return null;})[_0x0fea('0x38')](function(_0x1f66be){var _0x1c64da=_0x0fea('0x6a')+_0x1f66be[_0x0fea('0x29')][_0x0fea('0x6b')];return db[_0x0fea('0x6c')][_0x0fea('0x47')](_0x1c64da,{'type':db[_0x0fea('0x6d')][_0x0fea('0x6e')]['SELECT'],'raw':!![]})[_0x0fea('0x38')](function(_0x12950){return _0x12950;});})[_0x0fea('0x38')](function(_0x229cfb){if(_0x229cfb){_0xe634c[_0x0fea('0x29')][_0x0fea('0x6f')]=_0x229cfb[0x0];if(!_0x2593cf[_0x0fea('0x59')]['UserId'])return;return db[_0x0fea('0x70')]['find']({'where':{'id':_0x2593cf['body'][_0x0fea('0x60')],'role':_0x0fea('0x71')},'attributes':['id','name','fullname',_0x0fea('0x72'),'internal'],'raw':!![]});}return null;})[_0x0fea('0x38')](function(_0x58b2d2){if(!_0x58b2d2)return null;_0xe634c[_0x0fea('0x29')]['agent']=_0x58b2d2;return _0xe634c;})[_0x0fea('0x38')](function(_0x4c0f7f){if(_0x4c0f7f){if(_0x2593cf[_0x0fea('0x59')]['manual']){_0xe634c[_0x0fea('0x29')][_0x0fea('0x73')]=util['format'](_0x0fea('0x74'),_0x2593cf[_0x0fea('0x67')][_0x0fea('0x3a')]);_0xe634c['message'][_0x0fea('0x75')]=_0xe634c[_0x0fea('0x75')];_0xe634c['message']['motionChannel']=_0xe634c[_0x0fea('0x75')];_0xe634c['message'][_0x0fea('0x76')]=_0x0fea('0x5b');return respondWithRpcPromise('EventManager',_0x0fea('0x77'),{'event':_0x0fea('0x78'),'message':_0xe634c[_0x0fea('0x29')]},client9002)[_0x0fea('0x38')](function(){return _0xe634c;});}return _0xe634c;}return null;})[_0x0fea('0x38')](respondWithResult(_0x4950b4,null))[_0x0fea('0x2b')](handleError(_0x4950b4,null));};var interaction_log=require('../../config/logger')(_0x0fea('0x79'));exports[_0x0fea('0x36')]=function(_0x33d035,_0x3304d3,_0x124cda){var _0x14917a={'agent':{},'channel':_0x0fea('0x5c')};if(_0x33d035[_0x0fea('0x59')]['id']){delete _0x33d035[_0x0fea('0x59')]['id'];}_0x33d035[_0x0fea('0x59')][_0x0fea('0x60')]=_0x33d035[_0x0fea('0x59')][_0x0fea('0x60')]||_0x33d035[_0x0fea('0x67')]['id'];_0x14917a[_0x0fea('0x71')]['id']=_0x33d035[_0x0fea('0x59')][_0x0fea('0x60')];return db[_0x0fea('0x3e')][_0x0fea('0x5a')]({'where':{'id':_0x33d035[_0x0fea('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3304d3,null))[_0x0fea('0x38')](function(_0x2428b3){if(_0x2428b3){_0x14917a['message']=_0x2428b3[_0x0fea('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x0fea('0x5a')]({'where':{'id':_0x2428b3[_0x0fea('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x3304d3,null))[_0x0fea('0x38')](function(_0x438d4c){if(_0x438d4c){_0x14917a[_0x0fea('0x66')]=_0x438d4c['get']({'plain':!![]});interaction_log[_0x0fea('0x23')](_0x0fea('0x7b'),_0x33d035[_0x0fea('0x67')]['id'],_0x33d035[_0x0fea('0x67')][_0x0fea('0x3a')],_0x33d035[_0x0fea('0x67')][_0x0fea('0x7c')],_0x14917a[_0x0fea('0x66')]['id'],_0x33d035[_0x0fea('0x59')]?JSON[_0x0fea('0x27')](_0x33d035[_0x0fea('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x0fea('0x7d'),_0x14917a);}return null;})[_0x0fea('0x38')](function(_0x54cb5a){var _0x41b71d=_0x0fea('0x6a')+_0x54cb5a['message']['ContactId'];return db[_0x0fea('0x6c')][_0x0fea('0x47')](_0x41b71d,{'type':db[_0x0fea('0x6d')]['QueryTypes'][_0x0fea('0x7e')],'raw':!![]})['then'](function(_0x4439fb){return _0x4439fb;});})['then'](function(_0x43fa7b){if(_0x43fa7b){_0x14917a[_0x0fea('0x29')][_0x0fea('0x6f')]=_0x43fa7b[0x0];if(!_0x33d035['body']['UserId'])return;return db[_0x0fea('0x70')][_0x0fea('0x5a')]({'where':{'id':_0x33d035[_0x0fea('0x59')][_0x0fea('0x60')],'role':_0x0fea('0x71')},'attributes':['id',_0x0fea('0x3a'),_0x0fea('0x7f'),_0x0fea('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x41b46f){if(!_0x41b46f)return null;_0x14917a[_0x0fea('0x29')]['agent']=_0x41b46f;return _0x14917a;})['then'](function(_0x131047){if(_0x131047){_0x131047[_0x0fea('0x29')]['interface']=util[_0x0fea('0x5e')]('SIP/%s',_0x33d035[_0x0fea('0x67')][_0x0fea('0x3a')]);_0x131047[_0x0fea('0x29')][_0x0fea('0x75')]=_0x14917a['channel'];_0x131047[_0x0fea('0x29')]['motionChannel']=_0x14917a[_0x0fea('0x75')];_0x131047[_0x0fea('0x29')][_0x0fea('0x76')]=_0x0fea('0x36');respondWithRpcPromise(_0x0fea('0x77'),'EventManager',{'event':_0x0fea('0x80'),'message':_0x131047[_0x0fea('0x29')]},client9002);return _0x14917a;}return null;})[_0x0fea('0x38')](respondWithResult(_0x3304d3,null))[_0x0fea('0x2b')](handleError(_0x3304d3,null));};exports[_0x0fea('0x2d')]=function(_0xa563f2,_0x3890fb,_0x3052a3){if(_0xa563f2[_0x0fea('0x59')]['id']){delete _0xa563f2[_0x0fea('0x59')]['id'];}var _0x5f48d8;return db['WhatsappMessage']['find']({'where':{'id':_0xa563f2[_0x0fea('0x55')]['id']}})[_0x0fea('0x38')](handleEntityNotFound(_0x3890fb,null))['then'](function(_0x53eb68){if(_0x53eb68){_0x5f48d8=_0x53eb68;return db['WhatsappAccount'][_0x0fea('0x5a')]({'where':{'id':_0x53eb68[_0x0fea('0x81')]}});}})[_0x0fea('0x38')](handleEntityNotFound(_0x3890fb,null))[_0x0fea('0x38')](function(_0x2d021c){if(_0x2d021c){logger['debug'](_0x0fea('0x82'),_0x0fea('0x2d'),_0x0fea('0x83'),_0x2d021c[_0x0fea('0x41')],util[_0x0fea('0x84')](_0xa563f2[_0x0fea('0x59')],{'showHidden':![],'depth':null}));switch(_0x2d021c[_0x0fea('0x41')]){case _0x0fea('0x85'):if(_0xa563f2[_0x0fea('0x59')][_0x0fea('0x86')]&&_0xa563f2[_0x0fea('0x59')][_0x0fea('0x86')]===_0x5f48d8['messageId']&&_0xa563f2[_0x0fea('0x59')][_0x0fea('0x87')]&&_0xa563f2['body'][_0x0fea('0x87')]===_0x0fea('0x88')){return _0x5f48d8[_0x0fea('0x63')]({'read':!![]});}else{logger[_0x0fea('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x0fea('0x84')](_0xa563f2[_0x0fea('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5f48d8;}})['then'](respondWithResult(_0x3890fb,null))['catch'](handleError(_0x3890fb,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 72d6ec7..cf3a97a 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x31e6f0,_0x370bdc){var _0x14de41=function(_0x3c3257){while(--_0x3c3257){_0x31e6f0['push'](_0x31e6f0['shift']());}};_0x14de41(++_0x370bdc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var WhatsappMessage=require(_0x0d8b('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){WhatsappMessageEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);WhatsappMessageEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];WhatsappMessage[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xe511=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x272fed,_0x243d67){var _0x2f7ead=function(_0x538090){while(--_0x538090){_0x272fed['push'](_0x272fed['shift']());}};_0x2f7ead(++_0x243d67);}(_0xe511,0x16f));var _0x1e51=function(_0x9aca96,_0x497a2a){_0x9aca96=_0x9aca96-0x0;var _0x2d64a5=_0xe511[_0x9aca96];return _0x2d64a5;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var WhatsappMessage=require(_0x1e51('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e51('0x3'),'afterDestroy':_0x1e51('0x4')};function emitEvent(_0x5bfa5d){return function(_0x42e242,_0x2be2b7,_0x204da7){WhatsappMessageEvents[_0x1e51('0x5')](_0x5bfa5d+':'+_0x42e242['id'],_0x42e242);WhatsappMessageEvents['emit'](_0x5bfa5d,_0x42e242);_0x204da7(null);};}for(var e in events){if(events[_0x1e51('0x6')](e)){var event=events[e];WhatsappMessage[_0x1e51('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ee67851..966d186 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 _0xedad=['moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','update','createdAt','error','out','find','WhatsappAccountId','phone','authToken','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','sid','catch','afterCreate','twilio','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0xedad,0x17e));var _0xdeda=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xedad[_0x4480b9];return _0x3f0f02;};'use strict';var _=require(_0xdeda('0x0'));var util=require(_0xdeda('0x1'));var logger=require(_0xdeda('0x2'))('api');var moment=require(_0xdeda('0x3'));var BPromise=require(_0xdeda('0x4'));var rp=require(_0xdeda('0x5'));var fetch=require(_0xdeda('0x6'));var fs=require('fs');var path=require(_0xdeda('0x7'));var rimraf=require(_0xdeda('0x8'));var config=require('../../config/environment');var attributes=require(_0xdeda('0x9'));module['exports']=function(_0x184fe7,_0x5227cc){return _0x184fe7[_0xdeda('0xa')](_0xdeda('0xb'),attributes,{'tableName':_0xdeda('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xdeda('0xd')]},{'name':_0xdeda('0xe'),'fields':[_0xdeda('0xf')],'type':_0xdeda('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x417a4d,_0x367e32,_0x59d4e0){var _0x3dd9b3=_0x184fe7['models'];var _0x3098ce=_0x417a4d['get']({'plain':!![]});if(_0x3098ce[_0xdeda('0x11')][_0xdeda('0x12')]()==='in'||_0x3098ce[_0xdeda('0x11')][_0xdeda('0x12')]()==='out'&&!_0x3098ce[_0xdeda('0x13')]&&!_[_0xdeda('0x14')](_0x3098ce['UserId'])){_0x3dd9b3[_0xdeda('0x15')][_0xdeda('0x16')]({'where':{'id':_0x3098ce['WhatsappInteractionId']}})['then'](function(_0x4be048){if(_0x4be048){_0x4be048[_0xdeda('0x17')]({'lastMsgAt':_0x3098ce[_0xdeda('0x18')],'lastMsgDirection':_0x3098ce['direction'][_0xdeda('0x12')]()});}})['catch'](function(_0x4d6d27){console[_0xdeda('0x19')](_0x4d6d27);});}if(_0x3098ce['direction']===_0xdeda('0x1a')&&!_0x3098ce[_0xdeda('0x13')]){var _0x58cca3;_0x3dd9b3['WhatsappAccount'][_0xdeda('0x1b')]({'where':{'id':_0x3098ce[_0xdeda('0x1c')]},'raw':!![]})['then'](function(_0x28ef21){_0x58cca3=_0x28ef21;if(_0x58cca3&&_0x58cca3['type']){switch(_0x58cca3['type']){case'twilio':var _0x365f45=require('twilio');if(_0x58cca3['accountSid']&&_0x58cca3['authToken']&&_0x58cca3[_0xdeda('0x1d')]){var _0x40addd=new _0x365f45(_0x58cca3['accountSid'],_0x58cca3[_0xdeda('0x1e')]);_0x40addd['messages'][_0xdeda('0x1f')]({'body':_0x3098ce['body'],'to':_0xdeda('0x20')+_0x3098ce['phone'],'from':_0xdeda('0x20')+_0x58cca3['phone'],'statusCallback':_0x58cca3['remote']+_0xdeda('0x21')+_0x3098ce['id']+_0xdeda('0x22')+_0x58cca3[_0xdeda('0x23')]})[_0xdeda('0x24')](function(_0x53b779){if(_0x53b779['sid']){return _0x417a4d[_0xdeda('0x17')]({'messageId':_0x53b779[_0xdeda('0x25')]});}})[_0xdeda('0x26')](function(_0x311881){logger[_0xdeda('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdeda('0x27'),_0xdeda('0x28'),util[_0xdeda('0x29')](_0x311881,{'showHidden':![],'depth':null}));});}else{logger[_0xdeda('0x19')](_0xdeda('0x2a'),_0xdeda('0x27'),_0xdeda('0x28'),_0xdeda('0x2b'));}break;case _0xdeda('0x2c'):var _0x2d816c=_0x58cca3['accountSid'];var _0x1f6f1a=_0x58cca3[_0xdeda('0x1e')];var _0x1cb818=_0x58cca3[_0xdeda('0x2d')]+_0xdeda('0x2e')+_0x2d816c+'/messages/';var _0x86c373={'to':[_0x3098ce[_0xdeda('0x1d')]],'message':{'type':_0xdeda('0x2f'),'text':_0x3098ce['body']}};var _0x1a0905={'method':'POST','uri':_0x1cb818,'headers':{'Authorization':_0xdeda('0x30')+_0x1f6f1a,'Content-Type':'application/json'},'body':_0x86c373,'json':!![]};rp(_0x1a0905)[_0xdeda('0x24')](function(_0x5bdbb9){if(_0x5bdbb9[_0xdeda('0x31')][0x0][_0xdeda('0x32')]){return _0x417a4d['update']({'messageId':_0x5bdbb9[_0xdeda('0x31')][0x0][_0xdeda('0x32')]});}})[_0xdeda('0x26')](function(_0x1efffe){logger['err'](_0xdeda('0x33'),_0x1efffe);});break;}}})[_0xdeda('0x34')](function(){_0x59d4e0();});}else{_0x59d4e0();}}},'charset':_0xdeda('0x35'),'collate':_0xdeda('0x36')});}; \ No newline at end of file +var _0x1b15=['application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20'];(function(_0x3f5315,_0x32e0ff){var _0x24e216=function(_0x285cfd){while(--_0x285cfd){_0x3f5315['push'](_0x3f5315['shift']());}};_0x24e216(++_0x32e0ff);}(_0x1b15,0x81));var _0x51b1=function(_0x34512d,_0x3e4fa6){_0x34512d=_0x34512d-0x0;var _0x408fa1=_0x1b15[_0x34512d];return _0x408fa1;};'use strict';var _=require(_0x51b1('0x0'));var util=require(_0x51b1('0x1'));var logger=require(_0x51b1('0x2'))('api');var moment=require(_0x51b1('0x3'));var BPromise=require(_0x51b1('0x4'));var rp=require(_0x51b1('0x5'));var fetch=require(_0x51b1('0x6'));var fs=require('fs');var path=require(_0x51b1('0x7'));var rimraf=require(_0x51b1('0x8'));var config=require('../../config/environment');var attributes=require(_0x51b1('0x9'));module['exports']=function(_0x16d0a4,_0x46b3ea){return _0x16d0a4[_0x51b1('0xa')](_0x51b1('0xb'),attributes,{'tableName':_0x51b1('0xc'),'paranoid':![],'indexes':[{'name':_0x51b1('0xd'),'fields':[_0x51b1('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x51b1('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38ad74,_0x65f4ea,_0x55a975){var _0x36f9b4=_0x16d0a4[_0x51b1('0xf')];var _0x482311=_0x38ad74['get']({'plain':!![]});if(_0x482311['direction']['toLowerCase']()==='in'||_0x482311[_0x51b1('0x10')][_0x51b1('0x11')]()===_0x51b1('0x12')&&!_0x482311['secret']&&!_['isNil'](_0x482311[_0x51b1('0x13')])){_0x36f9b4[_0x51b1('0x14')][_0x51b1('0x15')]({'where':{'id':_0x482311[_0x51b1('0x16')]}})[_0x51b1('0x17')](function(_0x5087a4){if(_0x5087a4){_0x5087a4[_0x51b1('0x18')]({'lastMsgAt':_0x482311[_0x51b1('0x19')],'lastMsgDirection':_0x482311['direction'][_0x51b1('0x11')]()});}})[_0x51b1('0x1a')](function(_0x197b33){console['error'](_0x197b33);});}if(_0x482311[_0x51b1('0x10')]===_0x51b1('0x12')&&!_0x482311[_0x51b1('0x1b')]){var _0x2e8be7;_0x36f9b4[_0x51b1('0x1c')][_0x51b1('0x1d')]({'where':{'id':_0x482311[_0x51b1('0x1e')]},'raw':!![]})['then'](function(_0x57be9d){_0x2e8be7=_0x57be9d;if(_0x2e8be7&&_0x2e8be7[_0x51b1('0x1f')]){switch(_0x2e8be7[_0x51b1('0x1f')]){case _0x51b1('0x20'):var _0x3eb55c=require(_0x51b1('0x20'));if(_0x2e8be7[_0x51b1('0x21')]&&_0x2e8be7[_0x51b1('0x22')]&&_0x2e8be7[_0x51b1('0x23')]){var _0x58f790=new _0x3eb55c(_0x2e8be7[_0x51b1('0x21')],_0x2e8be7[_0x51b1('0x22')]);_0x58f790[_0x51b1('0x24')][_0x51b1('0x25')]({'body':_0x482311[_0x51b1('0x26')],'to':_0x51b1('0x27')+_0x482311['phone'],'from':_0x51b1('0x27')+_0x2e8be7[_0x51b1('0x23')],'statusCallback':_0x2e8be7[_0x51b1('0x28')]+_0x51b1('0x29')+_0x482311['id']+_0x51b1('0x2a')+_0x2e8be7['token']})[_0x51b1('0x17')](function(_0x28027e){if(_0x28027e[_0x51b1('0x2b')]){return _0x38ad74[_0x51b1('0x18')]({'messageId':_0x28027e[_0x51b1('0x2b')]});}})['catch'](function(_0x19e728){logger[_0x51b1('0x2c')](_0x51b1('0x2d'),_0x51b1('0x2e'),'twilio',util['inspect'](_0x19e728,{'showHidden':![],'depth':null}));});}else{logger[_0x51b1('0x2c')](_0x51b1('0x2d'),'afterCreate',_0x51b1('0x20'),_0x51b1('0x2f'));}break;case _0x51b1('0x30'):var _0x4b5787=_0x2e8be7['accountSid'];var _0x3a8724=_0x2e8be7['authToken'];var _0x548f2d=_0x2e8be7[_0x51b1('0x31')]+_0x51b1('0x32')+_0x4b5787+_0x51b1('0x33');var _0x412b85={'to':[_0x482311[_0x51b1('0x23')]],'message':{'type':_0x51b1('0x34'),'text':_0x482311[_0x51b1('0x26')]}};var _0x25951c={'method':'POST','uri':_0x548f2d,'headers':{'Authorization':_0x51b1('0x35')+_0x3a8724,'Content-Type':_0x51b1('0x36')},'body':_0x412b85,'json':!![]};rp(_0x25951c)['then'](function(_0x55d4ed){if(_0x55d4ed[_0x51b1('0x37')][0x0][_0x51b1('0x38')]){return _0x38ad74[_0x51b1('0x18')]({'messageId':_0x55d4ed[_0x51b1('0x37')][0x0]['message_id']});}})[_0x51b1('0x1a')](function(_0x4704e5){logger['err'](_0x51b1('0x39'),_0x4704e5);});break;}}})[_0x51b1('0x3a')](function(){_0x55a975();});}else{_0x55a975();}}},'charset':_0x51b1('0x3b'),'collate':_0x51b1('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 84fb47d..ec5c094 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 _0x1ea0=['create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x53b5b1,_0x584a1b){var _0x37d808=function(_0x57b0be){while(--_0x57b0be){_0x53b5b1['push'](_0x53b5b1['shift']());}};_0x37d808(++_0x584a1b);}(_0x1ea0,0x117));var _0x01ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ea0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var moment=require(_0x01ea('0x2'));var BPromise=require(_0x01ea('0x3'));var rs=require(_0x01ea('0x4'));var fs=require('fs');var Redis=require(_0x01ea('0x5'));var db=require(_0x01ea('0x6'))['db'];var utils=require(_0x01ea('0x7'));var logger=require(_0x01ea('0x8'))(_0x01ea('0x9'));var config=require(_0x01ea('0xa'));var jayson=require(_0x01ea('0xb'));var client=jayson[_0x01ea('0xc')][_0x01ea('0xd')]({'port':0x232a});config[_0x01ea('0xe')]=_[_0x01ea('0xf')](config['redis'],{'host':_0x01ea('0x10'),'port':0x18eb});var socket=require(_0x01ea('0x11'))(new Redis(config['redis']));require(_0x01ea('0x12'))[_0x01ea('0x13')](socket);function respondWithRpcPromise(_0x394035,_0x366998,_0x131692){return new BPromise(function(_0x5851f,_0x16f9e0){return client[_0x01ea('0x14')](_0x394035,_0x131692)['then'](function(_0x461b08){logger[_0x01ea('0x15')](_0x01ea('0x16'),_0x366998,_0x01ea('0x17'));logger[_0x01ea('0x18')](_0x01ea('0x19'),_0x366998,'request\x20sent',JSON['stringify'](_0x461b08));if(_0x461b08[_0x01ea('0x1a')]){if(_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1b')]===0x1f4){logger[_0x01ea('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x366998,_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);return _0x16f9e0(_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);}logger[_0x01ea('0x1a')](_0x01ea('0x16'),_0x366998,_0x461b08[_0x01ea('0x1a')][_0x01ea('0x1c')]);return _0x5851f(_0x461b08['error']['message']);}else{logger[_0x01ea('0x15')](_0x01ea('0x16'),_0x366998,'request\x20sent');_0x5851f(_0x461b08[_0x01ea('0x1d')][_0x01ea('0x1c')]);}})[_0x01ea('0x1e')](function(_0x116ae4){logger[_0x01ea('0x1a')](_0x01ea('0x16'),_0x366998,_0x116ae4);_0x16f9e0(_0x116ae4);});});}exports[_0x01ea('0x1f')]=function(_0x236bf6){var _0x28561b=this;return new Promise(function(_0x52e710,_0x5d65e4){return db[_0x01ea('0x20')][_0x01ea('0x21')](_0x236bf6[_0x01ea('0x22')],{'raw':_0x236bf6['options']?_0x236bf6[_0x01ea('0x23')][_0x01ea('0x24')]===undefined?!![]:![]:!![]})[_0x01ea('0x25')](function(_0x361457){logger[_0x01ea('0x15')](_0x01ea('0x1f'),_0x236bf6);logger[_0x01ea('0x18')](_0x01ea('0x1f'),_0x236bf6,JSON[_0x01ea('0x26')](_0x361457));_0x52e710(_0x361457);})[_0x01ea('0x1e')](function(_0x107562){logger['error'](_0x01ea('0x1f'),_0x107562['message'],_0x236bf6);_0x5d65e4(_0x28561b[_0x01ea('0x1a')](0x1f4,_0x107562['message']));});});}; \ No newline at end of file +var _0xc358=['result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc358,0x64));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c35('0x0'));var util=require(_0x8c35('0x1'));var moment=require(_0x8c35('0x2'));var BPromise=require(_0x8c35('0x3'));var rs=require(_0x8c35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c35('0x5'))['db'];var utils=require(_0x8c35('0x6'));var logger=require(_0x8c35('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c35('0x8'));var client=jayson['client'][_0x8c35('0x9')]({'port':0x232a});config[_0x8c35('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c35('0xb'))(new Redis(config[_0x8c35('0xa')]));require(_0x8c35('0xc'))[_0x8c35('0xd')](socket);function respondWithRpcPromise(_0x216481,_0x4a88ec,_0x227fe2){return new BPromise(function(_0x7577a2,_0xd7749a){return client[_0x8c35('0xe')](_0x216481,_0x227fe2)[_0x8c35('0xf')](function(_0x16cfdd){logger[_0x8c35('0x10')](_0x8c35('0x11'),_0x4a88ec,_0x8c35('0x12'));logger[_0x8c35('0x13')](_0x8c35('0x14'),_0x4a88ec,_0x8c35('0x12'),JSON[_0x8c35('0x15')](_0x16cfdd));if(_0x16cfdd['error']){if(_0x16cfdd[_0x8c35('0x16')]['code']===0x1f4){logger[_0x8c35('0x16')](_0x8c35('0x11'),_0x4a88ec,_0x16cfdd[_0x8c35('0x16')][_0x8c35('0x17')]);return _0xd7749a(_0x16cfdd[_0x8c35('0x16')][_0x8c35('0x17')]);}logger[_0x8c35('0x16')](_0x8c35('0x11'),_0x4a88ec,_0x16cfdd[_0x8c35('0x16')][_0x8c35('0x17')]);return _0x7577a2(_0x16cfdd[_0x8c35('0x16')][_0x8c35('0x17')]);}else{logger['info'](_0x8c35('0x11'),_0x4a88ec,_0x8c35('0x12'));_0x7577a2(_0x16cfdd[_0x8c35('0x18')][_0x8c35('0x17')]);}})[_0x8c35('0x19')](function(_0x3a7ca9){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4a88ec,_0x3a7ca9);_0xd7749a(_0x3a7ca9);});});}exports[_0x8c35('0x1a')]=function(_0xce2baa){var _0x52bacb=this;return new Promise(function(_0x8f3ac8,_0x2d444e){return db[_0x8c35('0x1b')][_0x8c35('0x1c')](_0xce2baa['body'],{'raw':_0xce2baa[_0x8c35('0x1d')]?_0xce2baa[_0x8c35('0x1d')][_0x8c35('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4e7330){logger['info']('CreateWhatsappMessage',_0xce2baa);logger[_0x8c35('0x13')]('CreateWhatsappMessage',_0xce2baa,JSON['stringify'](_0x4e7330));_0x8f3ac8(_0x4e7330);})[_0x8c35('0x19')](function(_0x2de777){logger[_0x8c35('0x16')](_0x8c35('0x1a'),_0x2de777['message'],_0xce2baa);_0x2d444e(_0x52bacb[_0x8c35('0x16')](0x1f4,_0x2de777[_0x8c35('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5395bc1..9a47cdb 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 _0x978f=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x105584,_0x1d6506){var _0x19e52e=function(_0x390b10){while(--_0x390b10){_0x105584['push'](_0x105584['shift']());}};_0x19e52e(++_0x1d6506);}(_0x978f,0x1d5));var _0xf978=function(_0xff6d6,_0x55c0ea){_0xff6d6=_0xff6d6-0x0;var _0x1d3f22=_0x978f[_0xff6d6];return _0x1d3f22;};'use strict';var WhatsappMessageEvents=require(_0xf978('0x0'));var events=[_0xf978('0x1'),_0xf978('0x2'),_0xf978('0x3')];function createListener(_0x14c1bb,_0x5765cc){return function(_0x15532d){_0x5765cc[_0xf978('0x4')](_0x14c1bb,_0x15532d);};}function removeListener(_0x1871f2,_0x3b14ae){return function(){WhatsappMessageEvents[_0xf978('0x5')](_0x1871f2,_0x3b14ae);};}exports[_0xf978('0x6')]=function(_0x19a5f1){for(var _0x50fdb7=0x0,_0x3ecc1a=events[_0xf978('0x7')];_0x50fdb7<_0x3ecc1a;_0x50fdb7++){var _0x243285=events[_0x50fdb7];var _0x12ec29=createListener(_0xf978('0x8')+_0x243285,_0x19a5f1);WhatsappMessageEvents['on'](_0x243285,_0x12ec29);}}; \ No newline at end of file +var _0x775a=['register','length','./whatsappMessage.events','remove','emit','removeListener'];(function(_0x5d62dc,_0x42fb89){var _0x415a65=function(_0xe9da8){while(--_0xe9da8){_0x5d62dc['push'](_0x5d62dc['shift']());}};_0x415a65(++_0x42fb89);}(_0x775a,0x13a));var _0xa775=function(_0x25d7e2,_0x59c4f3){_0x25d7e2=_0x25d7e2-0x0;var _0x3f125a=_0x775a[_0x25d7e2];return _0x3f125a;};'use strict';var WhatsappMessageEvents=require(_0xa775('0x0'));var events=['save',_0xa775('0x1'),'update'];function createListener(_0x5686c8,_0x2ad933){return function(_0x45ac09){_0x2ad933[_0xa775('0x2')](_0x5686c8,_0x45ac09);};}function removeListener(_0x13cebb,_0x237ec6){return function(){WhatsappMessageEvents[_0xa775('0x3')](_0x13cebb,_0x237ec6);};}exports[_0xa775('0x4')]=function(_0x2d7715){for(var _0x598458=0x0,_0x441c78=events[_0xa775('0x5')];_0x598458<_0x441c78;_0x598458++){var _0x4ea98b=events[_0x598458];var _0x4a1590=createListener('whatsappMessage:'+_0x4ea98b,_0x2d7715);WhatsappMessageEvents['on'](_0x4ea98b,_0x4a1590);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a75dce1..0150e63 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 _0xb573=['/:id/teams','getTeams','/:id/users','post','addTeams','put','/:id','delete','destroy','removeTeams','removeAgents','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers'];(function(_0x6a21f4,_0x220ad8){var _0x4c15ac=function(_0x52f4dd){while(--_0x52f4dd){_0x6a21f4['push'](_0x6a21f4['shift']());}};_0x4c15ac(++_0x220ad8);}(_0xb573,0x173));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3b57('0x0'));var express=require(_0x3b57('0x1'));var router=express['Router']();var fs_extra=require(_0x3b57('0x2'));var auth=require(_0x3b57('0x3'));var interaction=require(_0x3b57('0x4'));var config=require(_0x3b57('0x5'));var controller=require(_0x3b57('0x6'));router[_0x3b57('0x7')]('/',auth[_0x3b57('0x8')](),controller[_0x3b57('0x9')]);router[_0x3b57('0x7')]('/describe',auth[_0x3b57('0x8')](),controller['describe']);router[_0x3b57('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3b57('0xa')]);router[_0x3b57('0x7')](_0x3b57('0xb'),auth[_0x3b57('0x8')](),controller[_0x3b57('0xc')]);router[_0x3b57('0x7')](_0x3b57('0xd'),auth[_0x3b57('0x8')](),controller[_0x3b57('0xe')]);router[_0x3b57('0x7')](_0x3b57('0xf'),auth[_0x3b57('0x8')](),controller['getAgents']);router[_0x3b57('0x10')]('/',auth[_0x3b57('0x8')](),controller['create']);router[_0x3b57('0x10')](_0x3b57('0xd'),auth['isAuthenticated'](),controller[_0x3b57('0x11')]);router[_0x3b57('0x10')](_0x3b57('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3b57('0x12')](_0x3b57('0x13'),auth[_0x3b57('0x8')](),controller['update']);router[_0x3b57('0x14')](_0x3b57('0x13'),auth[_0x3b57('0x8')](),controller[_0x3b57('0x15')]);router['delete'](_0x3b57('0xd'),auth[_0x3b57('0x8')](),controller[_0x3b57('0x16')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x3b57('0x17')]);module['exports']=router; \ No newline at end of file +var _0x198b=['/describe','describe','/:id','getMembers','getAgents','create','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index'];(function(_0x42885b,_0x226649){var _0x3e3a1e=function(_0x3b401d){while(--_0x3b401d){_0x42885b['push'](_0x42885b['shift']());}};_0x3e3a1e(++_0x226649);}(_0x198b,0x160));var _0xb198=function(_0xd3f942,_0xcdf61c){_0xd3f942=_0xd3f942-0x0;var _0x206a61=_0x198b[_0xd3f942];return _0x206a61;};'use strict';var multer=require(_0xb198('0x0'));var util=require(_0xb198('0x1'));var path=require(_0xb198('0x2'));var timeout=require('connect-timeout');var express=require(_0xb198('0x3'));var router=express[_0xb198('0x4')]();var fs_extra=require(_0xb198('0x5'));var auth=require(_0xb198('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb198('0x7'));var controller=require(_0xb198('0x8'));router[_0xb198('0x9')]('/',auth[_0xb198('0xa')](),controller[_0xb198('0xb')]);router[_0xb198('0x9')](_0xb198('0xc'),auth['isAuthenticated'](),controller[_0xb198('0xd')]);router['get'](_0xb198('0xe'),auth[_0xb198('0xa')](),controller['show']);router[_0xb198('0x9')]('/:id/members',auth[_0xb198('0xa')](),controller[_0xb198('0xf')]);router['get']('/:id/teams',auth[_0xb198('0xa')](),controller['getTeams']);router[_0xb198('0x9')]('/:id/users',auth[_0xb198('0xa')](),controller[_0xb198('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb198('0x11')]);router[_0xb198('0x12')](_0xb198('0x13'),auth['isAuthenticated'](),controller[_0xb198('0x14')]);router[_0xb198('0x12')](_0xb198('0x15'),auth[_0xb198('0xa')](),controller[_0xb198('0x16')]);router[_0xb198('0x17')](_0xb198('0xe'),auth[_0xb198('0xa')](),controller[_0xb198('0x18')]);router[_0xb198('0x19')](_0xb198('0xe'),auth[_0xb198('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xb198('0xa')](),controller[_0xb198('0x1a')]);router['delete'](_0xb198('0x15'),auth[_0xb198('0xa')](),controller[_0xb198('0x1b')]);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 e5659cb..c40eab1 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 _0x0e35=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2ab9fa,_0x1898a1){var _0x5dc487=function(_0x3e9929){while(--_0x3e9929){_0x2ab9fa['push'](_0x2ab9fa['shift']());}};_0x5dc487(++_0x1898a1);}(_0x0e35,0xc2));var _0x50e3=function(_0x3708dc,_0x10c3d1){_0x3708dc=_0x3708dc-0x0;var _0x24e8f4=_0x0e35[_0x3708dc];return _0x24e8f4;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'name':{'type':Sequelize[_0x50e3('0x2')],'unique':_0x50e3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x50e3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x50e3('0x5')](_0x50e3('0x6'),_0x50e3('0x7'),_0x50e3('0x8'))},'description':{'type':Sequelize[_0x50e3('0x2')]}}; \ No newline at end of file +var _0x6c4b=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x5adb18,_0x222326){var _0x420c98=function(_0x146b7b){while(--_0x146b7b){_0x5adb18['push'](_0x5adb18['shift']());}};_0x420c98(++_0x222326);}(_0x6c4b,0x93));var _0xb6c4=function(_0x39f0ae,_0x5a2ec6){_0x39f0ae=_0x39f0ae-0x0;var _0x5ebdf0=_0x6c4b[_0x39f0ae];return _0x5ebdf0;};'use strict';var Sequelize=require(_0xb6c4('0x0'));module[_0xb6c4('0x1')]={'name':{'type':Sequelize[_0xb6c4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb6c4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6c4('0x4')](_0xb6c4('0x5'),_0xb6c4('0x6'),_0xb6c4('0x7'))},'description':{'type':Sequelize[_0xb6c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b6d7694..c165904 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 _0xb24e=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','set','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','WhatsappQueue','findAll','rows','catch','rawAttributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','team_has_whatsapp_queues','join'];(function(_0x25c3a,_0x28b9b0){var _0x35da4c=function(_0x47834b){while(--_0x47834b){_0x25c3a['push'](_0x25c3a['shift']());}};_0x35da4c(++_0x28b9b0);}(_0xb24e,0x122));var _0xeb24=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb24e[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xeb24('0x0'));var rimraf=require(_0xeb24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb24('0x2'));var moment=require(_0xeb24('0x3'));var BPromise=require(_0xeb24('0x4'));var Mustache=require(_0xeb24('0x5'));var util=require('util');var path=require(_0xeb24('0x6'));var sox=require(_0xeb24('0x7'));var csv=require(_0xeb24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb24('0x9'));var _=require('lodash');var squel=require(_0xeb24('0xa'));var crypto=require(_0xeb24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeb24('0xc'));var toCsv=require(_0xeb24('0x8'));var querystring=require(_0xeb24('0xd'));var Papa=require(_0xeb24('0xe'));var Redis=require(_0xeb24('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb24('0x10'));var as=require(_0xeb24('0x11'));var hardwareService=require(_0xeb24('0x12'));var logger=require(_0xeb24('0x13'))(_0xeb24('0x14'));var utils=require(_0xeb24('0x15'));var config=require(_0xeb24('0x16'));var licenseUtil=require(_0xeb24('0x17'));var db=require(_0xeb24('0x18'))['db'];config['redis']=_[_0xeb24('0x19')](config[_0xeb24('0x1a')],{'host':_0xeb24('0x1b'),'port':0x18eb});var socket=require(_0xeb24('0x1c'))(new Redis(config[_0xeb24('0x1a')]));require(_0xeb24('0x1d'))[_0xeb24('0x1e')](socket);function respondWithStatusCode(_0x319d91,_0x17824b){_0x17824b=_0x17824b||0xcc;return function(_0x5392e4){if(_0x5392e4){return _0x319d91[_0xeb24('0x1f')](_0x17824b);}return _0x319d91[_0xeb24('0x20')](_0x17824b)[_0xeb24('0x21')]();};}function respondWithResult(_0x327a7b,_0x446283){_0x446283=_0x446283||0xc8;return function(_0xdcad2e){if(_0xdcad2e){return _0x327a7b[_0xeb24('0x20')](_0x446283)[_0xeb24('0x22')](_0xdcad2e);}};}function respondWithFilteredResult(_0x39e731,_0x510b4d){return function(_0x177c11){if(_0x177c11){var _0x3392ef=typeof _0x510b4d['offset']===_0xeb24('0x23')&&typeof _0x510b4d['limit']==='undefined';var _0x4f5fa2=_0x177c11['count'];var _0x1f5e73=_0x3392ef?0x0:_0x510b4d[_0xeb24('0x24')];var _0x30e48d=_0x3392ef?_0x177c11[_0xeb24('0x25')]:_0x510b4d['offset']+_0x510b4d['limit'];var _0x32f284;if(_0x30e48d>=_0x4f5fa2){_0x30e48d=_0x4f5fa2;_0x32f284=0xc8;}else{_0x32f284=0xce;}_0x39e731[_0xeb24('0x20')](_0x32f284);return _0x39e731[_0xeb24('0x26')]('Content-Range',_0x1f5e73+'-'+_0x30e48d+'/'+_0x4f5fa2)['json'](_0x177c11);}return null;};}function patchUpdates(_0x10c627){return function(_0x257335){try{jsonpatch[_0xeb24('0x27')](_0x257335,_0x10c627,!![]);}catch(_0x20e204){return BPromise[_0xeb24('0x28')](_0x20e204);}return _0x257335['save']();};}function saveUpdates(_0x1cb571,_0x2df7f3){return function(_0x6a1034){if(_0x6a1034){return _0x6a1034[_0xeb24('0x29')](_0x1cb571)[_0xeb24('0x2a')](function(_0x254ad1){return _0x254ad1;});}return null;};}function removeEntity(_0xbb66da,_0x5c672b){return function(_0x3d3156){if(_0x3d3156){return _0x3d3156['destroy']()[_0xeb24('0x2a')](function(){var _0x1ca5bb=_0x3d3156[_0xeb24('0x2b')]({'plain':!![]});var _0x492014=_0xeb24('0x2c');return db[_0xeb24('0x2d')][_0xeb24('0x2e')]({'where':{'type':_0x492014,'resourceId':_0x1ca5bb['id']}})[_0xeb24('0x2a')](function(){return _0x3d3156;});})['then'](function(){_0xbb66da[_0xeb24('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b02c,_0x2b8960){return function(_0x5b647b){if(!_0x5b647b){_0x35b02c[_0xeb24('0x1f')](0x194);}return _0x5b647b;};}function handleError(_0x40e502,_0x52cf46){_0x52cf46=_0x52cf46||0x1f4;return function(_0x3c55bd){logger[_0xeb24('0x2f')](_0x3c55bd[_0xeb24('0x30')]);if(_0x3c55bd[_0xeb24('0x31')]){delete _0x3c55bd['name'];}_0x40e502[_0xeb24('0x20')](_0x52cf46)['send'](_0x3c55bd);};}exports[_0xeb24('0x32')]=function(_0x3f8336,_0x58a780){var _0x57b097={},_0x5ddaeb={},_0x52fa05={'count':0x0,'rows':[]};var _0x5ac017=_[_0xeb24('0x33')](db['WhatsappQueue']['rawAttributes'],function(_0x5a4619){return{'name':_0x5a4619['fieldName'],'type':_0x5a4619[_0xeb24('0x34')][_0xeb24('0x35')]};});_0x5ddaeb[_0xeb24('0x36')]=_[_0xeb24('0x33')](_0x5ac017,'name');_0x5ddaeb[_0xeb24('0x37')]=_[_0xeb24('0x38')](_0x3f8336[_0xeb24('0x37')]);_0x5ddaeb[_0xeb24('0x39')]=_[_0xeb24('0x3a')](_0x5ddaeb['model'],_0x5ddaeb[_0xeb24('0x37')]);_0x57b097['attributes']=_[_0xeb24('0x3a')](_0x5ddaeb[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x3f8336['query'][_0xeb24('0x3b')]));_0x57b097[_0xeb24('0x3c')]=_0x57b097[_0xeb24('0x3c')][_0xeb24('0x3d')]?_0x57b097[_0xeb24('0x3c')]:_0x5ddaeb[_0xeb24('0x36')];if(!_0x3f8336[_0xeb24('0x37')]['hasOwnProperty'](_0xeb24('0x3e'))){_0x57b097[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x3f8336[_0xeb24('0x37')]['limit']);_0x57b097[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x3f8336[_0xeb24('0x37')]['offset']);}_0x57b097[_0xeb24('0x40')]=qs[_0xeb24('0x41')](_0x3f8336[_0xeb24('0x37')][_0xeb24('0x41')]);_0x57b097[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x3f8336[_0xeb24('0x37')],_0x5ddaeb['filters']),_0x5ac017);if(_0x3f8336['query']['filter']){_0x57b097[_0xeb24('0x42')]=_['merge'](_0x57b097[_0xeb24('0x42')],{'$or':_['map'](_0x5ac017,function(_0x3da6e8){if(_0x3da6e8[_0xeb24('0x34')]!==_0xeb24('0x44')){var _0x3020fe={};_0x3020fe[_0x3da6e8[_0xeb24('0x31')]]={'$like':'%'+_0x3f8336[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x3020fe;}})});}_0x57b097=_['merge']({},_0x57b097,_0x3f8336['options']);var _0x3b7b35={'where':_0x57b097[_0xeb24('0x42')]};return db['WhatsappQueue'][_0xeb24('0x25')](_0x3b7b35)[_0xeb24('0x2a')](function(_0x17014c){_0x52fa05[_0xeb24('0x25')]=_0x17014c;if(_0x3f8336['query']['includeAll']){_0x57b097['include']=[{'all':!![]}];}return db[_0xeb24('0x46')][_0xeb24('0x47')](_0x57b097);})['then'](function(_0x522f0e){_0x52fa05[_0xeb24('0x48')]=_0x522f0e;return _0x52fa05;})[_0xeb24('0x2a')](respondWithFilteredResult(_0x58a780,_0x57b097))[_0xeb24('0x49')](handleError(_0x58a780,null));};exports['show']=function(_0x2ede0c,_0x393c6b){var _0x4fd23e={'raw':!![],'where':{'id':_0x2ede0c['params']['id']}},_0x1e85fb={};_0x1e85fb[_0xeb24('0x36')]=_['keys'](db[_0xeb24('0x46')][_0xeb24('0x4a')]);_0x1e85fb['query']=_[_0xeb24('0x38')](_0x2ede0c[_0xeb24('0x37')]);_0x1e85fb[_0xeb24('0x39')]=_['intersection'](_0x1e85fb['model'],_0x1e85fb[_0xeb24('0x37')]);_0x4fd23e['attributes']=_['intersection'](_0x1e85fb[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x2ede0c['query'][_0xeb24('0x3b')]));_0x4fd23e[_0xeb24('0x3c')]=_0x4fd23e[_0xeb24('0x3c')][_0xeb24('0x3d')]?_0x4fd23e['attributes']:_0x1e85fb[_0xeb24('0x36')];if(_0x2ede0c[_0xeb24('0x37')][_0xeb24('0x4b')]){_0x4fd23e['include']=[{'all':!![]}];}_0x4fd23e=_[_0xeb24('0x4c')]({},_0x4fd23e,_0x2ede0c[_0xeb24('0x4d')]);return db['WhatsappQueue'][_0xeb24('0x4e')](_0x4fd23e)[_0xeb24('0x2a')](handleEntityNotFound(_0x393c6b,null))[_0xeb24('0x2a')](respondWithResult(_0x393c6b,null))[_0xeb24('0x49')](handleError(_0x393c6b,null));};exports[_0xeb24('0x4f')]=function(_0x43643c,_0x232602){return db[_0xeb24('0x46')][_0xeb24('0x4f')](_0x43643c['body'],{})['then'](function(_0x132b84){var _0x58cd57=_0x43643c['user'][_0xeb24('0x2b')]({'plain':!![]});if(!_0x58cd57)throw new Error(_0xeb24('0x50'));if(_0x58cd57[_0xeb24('0x51')]===_0xeb24('0x52')){var _0x23fb3d=_0x132b84[_0xeb24('0x2b')]({'plain':!![]});var _0x5b4020='WhatsappQueues';return db[_0xeb24('0x53')][_0xeb24('0x4e')]({'where':{'name':_0x5b4020,'userProfileId':_0x58cd57['userProfileId']},'raw':!![]})[_0xeb24('0x2a')](function(_0x40e801){if(_0x40e801&&_0x40e801[_0xeb24('0x54')]===0x0){return db['UserProfileResource'][_0xeb24('0x4f')]({'name':_0x23fb3d[_0xeb24('0x31')],'resourceId':_0x23fb3d['id'],'type':_0x40e801[_0xeb24('0x31')],'sectionId':_0x40e801['id']},{})[_0xeb24('0x2a')](function(){return _0x132b84;});}else{return _0x132b84;}})[_0xeb24('0x49')](function(_0x3132c5){logger[_0xeb24('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3132c5);throw _0x3132c5;});}return _0x132b84;})[_0xeb24('0x2a')](respondWithResult(_0x232602,0xc9))[_0xeb24('0x49')](handleError(_0x232602,null));};exports[_0xeb24('0x29')]=function(_0x1f6635,_0x3d5429){if(_0x1f6635[_0xeb24('0x55')]['id']){delete _0x1f6635[_0xeb24('0x55')]['id'];}return db[_0xeb24('0x46')]['find']({'where':{'id':_0x1f6635[_0xeb24('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d5429,null))['then'](saveUpdates(_0x1f6635[_0xeb24('0x55')],null))[_0xeb24('0x2a')](respondWithResult(_0x3d5429,null))['catch'](handleError(_0x3d5429,null));};exports[_0xeb24('0x2e')]=function(_0x555daa,_0x2f58c4){return db[_0xeb24('0x46')]['find']({'where':{'id':_0x555daa[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x2f58c4,null))[_0xeb24('0x2a')](removeEntity(_0x2f58c4,null))[_0xeb24('0x49')](handleError(_0x2f58c4,null));};exports['describe']=function(_0xce5c2,_0x4a815c){return db[_0xeb24('0x46')][_0xeb24('0x57')]()[_0xeb24('0x2a')](respondWithResult(_0x4a815c,null))['catch'](handleError(_0x4a815c,null));};exports[_0xeb24('0x58')]=function(_0x3a1379,_0x29f5b8,_0x4ed0a0){var _0x355cf2={'raw':!![],'where':{}},_0x225128={},_0x1eca72;return db['WhatsappQueue'][_0xeb24('0x59')]({'where':{'id':_0x3a1379[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x29f5b8,null))['then'](function(_0x2cf649){if(_0x2cf649){_0x1eca72=_0x2cf649['get']({'plain':!![]});_0x225128[_0xeb24('0x36')]=_[_0xeb24('0x38')](db['UserWhatsappQueue'][_0xeb24('0x4a')]);_0x225128[_0xeb24('0x37')]=_[_0xeb24('0x38')](_0x3a1379['query']);_0x225128['filters']=_[_0xeb24('0x3a')](_0x225128['model'],_0x225128['query']);_0x355cf2['attributes']=_['intersection'](_0x225128[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x3a1379['query']['fields']));_0x355cf2[_0xeb24('0x3c')]=_0x355cf2['attributes'][_0xeb24('0x3d')]?_0x355cf2[_0xeb24('0x3c')]:_0x225128['model'];if(!_0x3a1379[_0xeb24('0x37')][_0xeb24('0x5a')](_0xeb24('0x3e'))){_0x355cf2['limit']=qs['limit'](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x3f')]);_0x355cf2['offset']=qs[_0xeb24('0x24')](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x24')]);}_0x355cf2[_0xeb24('0x40')]=qs['sort'](_0x3a1379[_0xeb24('0x37')][_0xeb24('0x41')]);_0x355cf2[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x3a1379[_0xeb24('0x37')],_0x225128['filters']));_0x355cf2['where'][_0xeb24('0x5b')]=_0x2cf649['id'];if(_0x3a1379['query'][_0xeb24('0x45')]){_0x355cf2[_0xeb24('0x42')]=_[_0xeb24('0x4c')](_0x355cf2['where'],{'$or':_[_0xeb24('0x33')](_0x355cf2[_0xeb24('0x3c')],function(_0x14891c){var _0x1b2b1f={};_0x1b2b1f[_0x14891c]={'$like':'%'+_0x3a1379[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x1b2b1f;})});}_0x355cf2=_['merge']({},_0x355cf2,_0x3a1379[_0xeb24('0x4d')]);return db[_0xeb24('0x5c')]['findAll'](_0x355cf2);}})['then'](function(_0x215cca){if(_0x215cca){return db[_0xeb24('0x5d')][_0xeb24('0x5e')]({'where':{'id':_['map'](_0x215cca,_0xeb24('0x5f')),'role':'agent'},'attributes':['id',_0xeb24('0x31'),_0xeb24('0x60'),_0xeb24('0x61'),_0xeb24('0x62')]});}})['then'](function(_0x1b3483){if(_0x1b3483){return{'count':_0x1b3483[_0xeb24('0x25')],'rows':_['map'](_0x1b3483[_0xeb24('0x48')],function(_0x51b343){return{'membername':_0x51b343[_0xeb24('0x31')],'UserId':_0x51b343['id'],'queue_name':_0x1eca72['name'],'WhatsappQueueId':_0x1eca72['id'],'interface':util[_0xeb24('0x63')](_0xeb24('0x64'),'SIP',_0x51b343[_0xeb24('0x31')]),'penalty':0x0,'paused':_0x51b343[_0xeb24('0x60')],'createdAt':_0x51b343[_0xeb24('0x62')],'updatedAt':_0x51b343['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb24('0x2a')](respondWithFilteredResult(_0x29f5b8,_0x355cf2))[_0xeb24('0x49')](handleError(_0x29f5b8,null));};exports[_0xeb24('0x65')]=function(_0x5c3fd0,_0xedc580,_0x36deff){var _0x516f54={};var _0x2c2773={};var _0x8aee80;var _0x12da6b;return db[_0xeb24('0x46')][_0xeb24('0x59')]({'where':{'id':_0x5c3fd0[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0xedc580,null))['then'](function(_0x594e5b){if(_0x594e5b){_0x8aee80=_0x594e5b;_0x2c2773['model']=_['keys'](db[_0xeb24('0x66')][_0xeb24('0x4a')]);_0x2c2773['query']=_[_0xeb24('0x38')](_0x5c3fd0['query']);_0x2c2773[_0xeb24('0x39')]=_[_0xeb24('0x3a')](_0x2c2773[_0xeb24('0x36')],_0x2c2773['query']);_0x516f54[_0xeb24('0x3c')]=_[_0xeb24('0x3a')](_0x2c2773[_0xeb24('0x36')],qs['fields'](_0x5c3fd0['query'][_0xeb24('0x3b')]));_0x516f54['attributes']=_0x516f54[_0xeb24('0x3c')]['length']?_0x516f54[_0xeb24('0x3c')]:_0x2c2773[_0xeb24('0x36')];_0x516f54['order']=qs[_0xeb24('0x41')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x41')]);_0x516f54[_0xeb24('0x42')]=qs[_0xeb24('0x39')](_['pick'](_0x5c3fd0[_0xeb24('0x37')],_0x2c2773[_0xeb24('0x39')]));if(_0x5c3fd0[_0xeb24('0x37')]['filter']){_0x516f54['where']=_['merge'](_0x516f54[_0xeb24('0x42')],{'$or':_[_0xeb24('0x33')](_0x516f54['attributes'],function(_0x3d684f){var _0x1577cb={};_0x1577cb[_0x3d684f]={'$like':'%'+_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x1577cb;})});}_0x516f54=_[_0xeb24('0x4c')]({},_0x516f54,_0x5c3fd0[_0xeb24('0x4d')]);return _0x8aee80['getTeams'](_0x516f54);}})[_0xeb24('0x2a')](function(_0x3a2183){if(_0x3a2183){_0x12da6b=_0x3a2183[_0xeb24('0x3d')];if(!_0x5c3fd0['query']['hasOwnProperty'](_0xeb24('0x3e'))){_0x516f54[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x3f')]);_0x516f54[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x5c3fd0[_0xeb24('0x37')][_0xeb24('0x24')]);}return _0x8aee80[_0xeb24('0x65')](_0x516f54);}})[_0xeb24('0x2a')](function(_0x35de3c){if(_0x35de3c){return _0x35de3c?{'count':_0x12da6b,'rows':_0x35de3c}:null;}})[_0xeb24('0x2a')](respondWithResult(_0xedc580,null))['catch'](handleError(_0xedc580,null));};exports['addTeams']=function(_0x51d3e9,_0x4557a3,_0x308490){var _0xc67efa=_0x51d3e9[_0xeb24('0x55')][_0xeb24('0x67')];return db['Team'][_0xeb24('0x47')]({'where':{'id':_0xc67efa},'attributes':['id'],'include':[{'model':db[_0xeb24('0x5d')],'as':_0xeb24('0x68'),'attributes':['id','name',_0xeb24('0x69'),'voicePause','interface'],'raw':!![]}]})[_0xeb24('0x2a')](function(_0x3eb2fd){if(_0x3eb2fd){var _0x1a37cf=_[_0xeb24('0x6a')](_0x3eb2fd,function(_0x2a1cf5){var _0x258452=_0x2a1cf5[_0xeb24('0x2b')]({'plain':!![]});return _0x258452['Agents'];});return db[_0xeb24('0x46')][_0xeb24('0x4e')]({'where':{'id':_0x51d3e9['params']['id']}})['then'](function(_0x41afbc){return db[_0xeb24('0x6b')][_0xeb24('0x6c')](function(_0x3ecead){return _0x41afbc['addTeams'](_0xc67efa,{'transaction':_0x3ecead})[_0xeb24('0x2a')](function(){return BPromise[_0xeb24('0x6d')](_0x1a37cf,function(_0x717ba){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x717ba['id'],'WhatsappQueueId':_0x51d3e9[_0xeb24('0x56')]['id']},'transaction':_0x3ecead});});})[_0xeb24('0x2a')](function(){_0x1a37cf[_0xeb24('0x6e')](function(_0xdd764f){socket[_0xeb24('0x6f')](_0xeb24('0x70'),{'UserId':_0xdd764f['id'],'WhatsappQueueId':_0x41afbc['id']});});});});});}})[_0xeb24('0x2a')](respondWithStatusCode(_0x4557a3,null))[_0xeb24('0x49')](handleError(_0x4557a3,null));};exports[_0xeb24('0x71')]=function(_0x1c7f1a,_0x57db9d,_0xcb102){return db[_0xeb24('0x66')][_0xeb24('0x47')]({'where':{'id':_0x1c7f1a[_0xeb24('0x37')][_0xeb24('0x67')]},'attributes':['id'],'include':[{'model':db[_0xeb24('0x5d')],'as':_0xeb24('0x68'),'attributes':['id'],'raw':!![]}]})[_0xeb24('0x2a')](handleEntityNotFound(_0x57db9d,null))['then'](function(_0x3b808c){var _0x1d3751=_[_0xeb24('0x33')](_0x3b808c,'id');var _0x83151c=[];var _0x2f82b5=[];var _0x68e553=squel['select']();_0x68e553[_0xeb24('0x72')](_0xeb24('0x73'))['from'](_0xeb24('0x74'),'tq')[_0xeb24('0x75')](_0xeb24('0x76'),'ut',_0xeb24('0x77'))['where'](_0xeb24('0x78'),_0x1c7f1a[_0xeb24('0x56')]['id']);for(var _0x4f0d6a=0x0;_0x4f0d6a<_0x3b808c[_0xeb24('0x3d')];_0x4f0d6a+=0x1){let _0x2754b9=_0x3b808c[_0x4f0d6a];for(var _0x58954b=0x0;_0x58954b<_0x2754b9['Agents'][_0xeb24('0x3d')];_0x58954b+=0x1){let _0x3760f7=_0x2754b9[_0xeb24('0x68')][_0x58954b];var _0x2d9251=_0x68e553['clone']();_0x2d9251[_0xeb24('0x42')](_0xeb24('0x79'),_0x3760f7['id']);_0x2f82b5['push'](db[_0xeb24('0x6b')][_0xeb24('0x37')](_0x2d9251[_0xeb24('0x7a')](),{'type':db['sequelize'][_0xeb24('0x7b')][_0xeb24('0x7c')]})[_0xeb24('0x2a')](function(_0x17006f){if(_0x17006f['length']===0x1){return _0x3760f7['id'];}else{var _0x934d0d=_['every'](_['map'](_0x17006f,_0xeb24('0x7d')),function(_0x26b268){return _[_0xeb24('0x7e')](_0x1d3751,_0x26b268);});if(_0x934d0d){return _0x3760f7['id'];}}}));}}return BPromise[_0xeb24('0x7f')](_0x2f82b5)['then'](function(_0x3d6bec){_0x83151c=_(_0x83151c)[_0xeb24('0x80')](_0x3d6bec)[_0xeb24('0x81')]()['value']();return db['WhatsappQueue'][_0xeb24('0x4e')]({'where':{'id':_0x1c7f1a[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](function(_0x5f48e2){return db[_0xeb24('0x6b')][_0xeb24('0x6c')](function(_0x34d492){return _0x5f48e2[_0xeb24('0x71')](_0x1c7f1a[_0xeb24('0x37')]['ids'],{'transaction':_0x34d492})[_0xeb24('0x2a')](function(){if(!_['isEmpty'](_0x83151c)){return _0x5f48e2[_0xeb24('0x82')](_0x83151c,{'transaction':_0x34d492});}})[_0xeb24('0x2a')](function(){_0x83151c['forEach'](function(_0x453fe4){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x453fe4,'WhatsappQueueId':_0x5f48e2['id']});});});});});});})['then'](respondWithStatusCode(_0x57db9d,null))['catch'](handleError(_0x57db9d,null));};exports[_0xeb24('0x83')]=function(_0x164615,_0x22c312,_0x44f3f5){return db['WhatsappQueue'][_0xeb24('0x4e')]({'where':{'id':_0x164615[_0xeb24('0x56')]['id']}})['then'](handleEntityNotFound(_0x22c312,null))[_0xeb24('0x2a')](function(_0x58c5bd){if(_0x58c5bd){return _0x58c5bd['addAgents'](_0x164615[_0xeb24('0x55')]['ids'],_['omit'](_0x164615[_0xeb24('0x55')],[_0xeb24('0x67'),'id'])||{})[_0xeb24('0x84')](function(_0x315f1d){for(var _0x3c1b1d=0x0;_0x3c1b1d<_0x164615[_0xeb24('0x55')][_0xeb24('0x67')]['length'];_0x3c1b1d+=0x1){socket[_0xeb24('0x6f')](_0xeb24('0x70'),{'UserId':Number(_0x164615[_0xeb24('0x55')][_0xeb24('0x67')][_0x3c1b1d]),'WhatsappQueueId':Number(_0x164615[_0xeb24('0x56')]['id'])});}return _0x315f1d;});}})[_0xeb24('0x2a')](respondWithResult(_0x22c312,null))[_0xeb24('0x49')](handleError(_0x22c312,null));};exports['removeAgents']=function(_0x196559,_0x3397c0,_0x219aa2){return db[_0xeb24('0x46')][_0xeb24('0x4e')]({'where':{'id':_0x196559[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x3397c0,null))[_0xeb24('0x2a')](function(_0x3db45e){if(_0x3db45e){return _0x3db45e[_0xeb24('0x82')](_0x196559[_0xeb24('0x37')][_0xeb24('0x67')])[_0xeb24('0x2a')](function(){if(_[_0xeb24('0x85')](_0x196559[_0xeb24('0x37')]['ids'])){for(var _0x35112d=0x0;_0x35112d<_0x196559[_0xeb24('0x37')]['ids']['length'];_0x35112d+=0x1){socket['emit'](_0xeb24('0x86'),{'UserId':Number(_0x196559[_0xeb24('0x37')][_0xeb24('0x67')][_0x35112d]),'WhatsappQueueId':Number(_0x196559[_0xeb24('0x56')]['id'])});}}else{socket[_0xeb24('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x196559[_0xeb24('0x37')][_0xeb24('0x67')]),'WhatsappQueueId':Number(_0x196559[_0xeb24('0x56')]['id'])});}});}})[_0xeb24('0x2a')](respondWithStatusCode(_0x3397c0,null))[_0xeb24('0x49')](handleError(_0x3397c0,null));};exports[_0xeb24('0x87')]=function(_0x203327,_0x4217d8,_0x3af25a){var _0xe1ceec={};var _0xeb015f={};var _0x5b0475;var _0x4f3423;return db[_0xeb24('0x46')][_0xeb24('0x59')]({'where':{'id':_0x203327[_0xeb24('0x56')]['id']}})[_0xeb24('0x2a')](handleEntityNotFound(_0x4217d8,null))[_0xeb24('0x2a')](function(_0x3ebe52){if(_0x3ebe52){_0x5b0475=_0x3ebe52;_0xeb015f[_0xeb24('0x36')]=_[_0xeb24('0x38')](db[_0xeb24('0x5d')][_0xeb24('0x4a')]);_0xeb015f['query']=_[_0xeb24('0x38')](_0x203327[_0xeb24('0x37')]);_0xeb015f['filters']=_[_0xeb24('0x3a')](_0xeb015f['model'],_0xeb015f[_0xeb24('0x37')]);_0xe1ceec['attributes']=_['intersection'](_0xeb015f[_0xeb24('0x36')],qs[_0xeb24('0x3b')](_0x203327[_0xeb24('0x37')][_0xeb24('0x3b')]));_0xe1ceec[_0xeb24('0x3c')]=_0xe1ceec['attributes'][_0xeb24('0x3d')]?_0xe1ceec[_0xeb24('0x3c')]:_0xeb015f[_0xeb24('0x36')];_0xe1ceec[_0xeb24('0x40')]=qs[_0xeb24('0x41')](_0x203327[_0xeb24('0x37')][_0xeb24('0x41')]);_0xe1ceec['where']=qs[_0xeb24('0x39')](_[_0xeb24('0x43')](_0x203327['query'],_0xeb015f['filters']));if(_0x203327[_0xeb24('0x37')][_0xeb24('0x45')]){_0xe1ceec[_0xeb24('0x42')]=_[_0xeb24('0x4c')](_0xe1ceec[_0xeb24('0x42')],{'$or':_[_0xeb24('0x33')](_0xe1ceec[_0xeb24('0x3c')],function(_0x650e1d){var _0x4ba3bc={};_0x4ba3bc[_0x650e1d]={'$like':'%'+_0x203327[_0xeb24('0x37')][_0xeb24('0x45')]+'%'};return _0x4ba3bc;})});}_0xe1ceec=_[_0xeb24('0x4c')]({},_0xe1ceec,_0x203327[_0xeb24('0x4d')]);return _0x5b0475[_0xeb24('0x87')](_0xe1ceec);}})[_0xeb24('0x2a')](function(_0x54e6c6){if(_0x54e6c6){_0x4f3423=_0x54e6c6[_0xeb24('0x3d')];if(!_0x203327[_0xeb24('0x37')][_0xeb24('0x5a')](_0xeb24('0x3e'))){_0xe1ceec[_0xeb24('0x3f')]=qs[_0xeb24('0x3f')](_0x203327['query'][_0xeb24('0x3f')]);_0xe1ceec[_0xeb24('0x24')]=qs[_0xeb24('0x24')](_0x203327[_0xeb24('0x37')][_0xeb24('0x24')]);}return _0x5b0475[_0xeb24('0x87')](_0xe1ceec);}})[_0xeb24('0x2a')](function(_0x724d44){if(_0x724d44){return _0x724d44?{'count':_0x4f3423,'rows':_0x724d44}:null;}})['then'](respondWithResult(_0x4217d8,null))[_0xeb24('0x49')](handleError(_0x4217d8,null));}; \ No newline at end of file +var _0x6a09=['redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','map','WhatsappQueue','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','count','catch','params','keys','length','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','pick','WhatsappQueueId','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x6a09,0xf6));var _0x96a0=function(_0x7a35b1,_0x925417){_0x7a35b1=_0x7a35b1-0x0;var _0x3c4535=_0x6a09[_0x7a35b1];return _0x3c4535;};'use strict';var emlformat=require(_0x96a0('0x0'));var rimraf=require(_0x96a0('0x1'));var zipdir=require(_0x96a0('0x2'));var jsonpatch=require(_0x96a0('0x3'));var rp=require('request-promise');var moment=require(_0x96a0('0x4'));var BPromise=require(_0x96a0('0x5'));var Mustache=require('mustache');var util=require(_0x96a0('0x6'));var path=require(_0x96a0('0x7'));var sox=require(_0x96a0('0x8'));var csv=require('to-csv');var ejs=require(_0x96a0('0x9'));var fs=require('fs');var fs_extra=require(_0x96a0('0xa'));var _=require(_0x96a0('0xb'));var squel=require(_0x96a0('0xc'));var crypto=require(_0x96a0('0xd'));var jsforce=require(_0x96a0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96a0('0xf'));var Papa=require(_0x96a0('0x10'));var Redis=require(_0x96a0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96a0('0x13'))(_0x96a0('0x14'));var utils=require(_0x96a0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x96a0('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x96a0('0x17'))(new Redis(config['redis']));require(_0x96a0('0x18'))[_0x96a0('0x19')](socket);function respondWithStatusCode(_0x100d0b,_0x23525e){_0x23525e=_0x23525e||0xcc;return function(_0x22aef9){if(_0x22aef9){return _0x100d0b[_0x96a0('0x1a')](_0x23525e);}return _0x100d0b[_0x96a0('0x1b')](_0x23525e)['end']();};}function respondWithResult(_0x3a0b0f,_0x279a6b){_0x279a6b=_0x279a6b||0xc8;return function(_0x57bbe7){if(_0x57bbe7){return _0x3a0b0f['status'](_0x279a6b)[_0x96a0('0x1c')](_0x57bbe7);}};}function respondWithFilteredResult(_0x1ff3d0,_0x22d02f){return function(_0x2065c8){if(_0x2065c8){var _0x386af5=typeof _0x22d02f[_0x96a0('0x1d')]==='undefined'&&typeof _0x22d02f[_0x96a0('0x1e')]===_0x96a0('0x1f');var _0x5030ab=_0x2065c8['count'];var _0x703aea=_0x386af5?0x0:_0x22d02f[_0x96a0('0x1d')];var _0x4d88a4=_0x386af5?_0x2065c8['count']:_0x22d02f[_0x96a0('0x1d')]+_0x22d02f[_0x96a0('0x1e')];var _0x39fd28;if(_0x4d88a4>=_0x5030ab){_0x4d88a4=_0x5030ab;_0x39fd28=0xc8;}else{_0x39fd28=0xce;}_0x1ff3d0['status'](_0x39fd28);return _0x1ff3d0['set'](_0x96a0('0x20'),_0x703aea+'-'+_0x4d88a4+'/'+_0x5030ab)[_0x96a0('0x1c')](_0x2065c8);}return null;};}function patchUpdates(_0xb868e7){return function(_0x459e3b){try{jsonpatch[_0x96a0('0x21')](_0x459e3b,_0xb868e7,!![]);}catch(_0x15086a){return BPromise['reject'](_0x15086a);}return _0x459e3b['save']();};}function saveUpdates(_0x7709a7,_0x1d1673){return function(_0x358306){if(_0x358306){return _0x358306['update'](_0x7709a7)[_0x96a0('0x22')](function(_0x4878a5){return _0x4878a5;});}return null;};}function removeEntity(_0x28830b,_0xc1faf3){return function(_0x39485d){if(_0x39485d){return _0x39485d[_0x96a0('0x23')]()[_0x96a0('0x22')](function(){var _0x127bb3=_0x39485d[_0x96a0('0x24')]({'plain':!![]});var _0x5ab996=_0x96a0('0x25');return db[_0x96a0('0x26')][_0x96a0('0x23')]({'where':{'type':_0x5ab996,'resourceId':_0x127bb3['id']}})[_0x96a0('0x22')](function(){return _0x39485d;});})[_0x96a0('0x22')](function(){_0x28830b[_0x96a0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26678e,_0x281094){return function(_0x16c476){if(!_0x16c476){_0x26678e[_0x96a0('0x1a')](0x194);}return _0x16c476;};}function handleError(_0x164878,_0x57ec4a){_0x57ec4a=_0x57ec4a||0x1f4;return function(_0x443f1d){logger['error'](_0x443f1d[_0x96a0('0x27')]);if(_0x443f1d[_0x96a0('0x28')]){delete _0x443f1d[_0x96a0('0x28')];}_0x164878[_0x96a0('0x1b')](_0x57ec4a)[_0x96a0('0x29')](_0x443f1d);};}exports['index']=function(_0x337c42,_0x4782aa){var _0x45c169={},_0x5dbb9c={},_0x586b3e={'count':0x0,'rows':[]};var _0x17fdd1=_[_0x96a0('0x2a')](db[_0x96a0('0x2b')][_0x96a0('0x2c')],function(_0x1b0527){return{'name':_0x1b0527['fieldName'],'type':_0x1b0527[_0x96a0('0x2d')]['key']};});_0x5dbb9c[_0x96a0('0x2e')]=_[_0x96a0('0x2a')](_0x17fdd1,_0x96a0('0x28'));_0x5dbb9c[_0x96a0('0x2f')]=_['keys'](_0x337c42['query']);_0x5dbb9c[_0x96a0('0x30')]=_[_0x96a0('0x31')](_0x5dbb9c['model'],_0x5dbb9c['query']);_0x45c169['attributes']=_['intersection'](_0x5dbb9c[_0x96a0('0x2e')],qs[_0x96a0('0x32')](_0x337c42['query'][_0x96a0('0x32')]));_0x45c169[_0x96a0('0x33')]=_0x45c169[_0x96a0('0x33')]['length']?_0x45c169[_0x96a0('0x33')]:_0x5dbb9c['model'];if(!_0x337c42[_0x96a0('0x2f')][_0x96a0('0x34')]('nolimit')){_0x45c169[_0x96a0('0x1e')]=qs[_0x96a0('0x1e')](_0x337c42[_0x96a0('0x2f')][_0x96a0('0x1e')]);_0x45c169[_0x96a0('0x1d')]=qs[_0x96a0('0x1d')](_0x337c42['query'][_0x96a0('0x1d')]);}_0x45c169[_0x96a0('0x35')]=qs[_0x96a0('0x36')](_0x337c42[_0x96a0('0x2f')][_0x96a0('0x36')]);_0x45c169[_0x96a0('0x37')]=qs[_0x96a0('0x30')](_['pick'](_0x337c42['query'],_0x5dbb9c[_0x96a0('0x30')]),_0x17fdd1);if(_0x337c42[_0x96a0('0x2f')]['filter']){_0x45c169[_0x96a0('0x37')]=_[_0x96a0('0x38')](_0x45c169[_0x96a0('0x37')],{'$or':_[_0x96a0('0x2a')](_0x17fdd1,function(_0x1de4f0){if(_0x1de4f0[_0x96a0('0x2d')]!==_0x96a0('0x39')){var _0x880329={};_0x880329[_0x1de4f0[_0x96a0('0x28')]]={'$like':'%'+_0x337c42[_0x96a0('0x2f')][_0x96a0('0x3a')]+'%'};return _0x880329;}})});}_0x45c169=_[_0x96a0('0x38')]({},_0x45c169,_0x337c42[_0x96a0('0x3b')]);var _0x58654f={'where':_0x45c169[_0x96a0('0x37')]};return db[_0x96a0('0x2b')][_0x96a0('0x3c')](_0x58654f)[_0x96a0('0x22')](function(_0x181dcd){_0x586b3e['count']=_0x181dcd;if(_0x337c42[_0x96a0('0x2f')]['includeAll']){_0x45c169['include']=[{'all':!![]}];}return db[_0x96a0('0x2b')]['findAll'](_0x45c169);})[_0x96a0('0x22')](function(_0x318cff){_0x586b3e['rows']=_0x318cff;return _0x586b3e;})['then'](respondWithFilteredResult(_0x4782aa,_0x45c169))[_0x96a0('0x3d')](handleError(_0x4782aa,null));};exports['show']=function(_0x39efb0,_0x5632d6){var _0x148406={'raw':!![],'where':{'id':_0x39efb0[_0x96a0('0x3e')]['id']}},_0x3b1fc7={};_0x3b1fc7['model']=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x3b1fc7[_0x96a0('0x2f')]=_[_0x96a0('0x3f')](_0x39efb0['query']);_0x3b1fc7[_0x96a0('0x30')]=_[_0x96a0('0x31')](_0x3b1fc7['model'],_0x3b1fc7[_0x96a0('0x2f')]);_0x148406[_0x96a0('0x33')]=_[_0x96a0('0x31')](_0x3b1fc7['model'],qs[_0x96a0('0x32')](_0x39efb0[_0x96a0('0x2f')]['fields']));_0x148406[_0x96a0('0x33')]=_0x148406[_0x96a0('0x33')][_0x96a0('0x40')]?_0x148406['attributes']:_0x3b1fc7[_0x96a0('0x2e')];if(_0x39efb0[_0x96a0('0x2f')][_0x96a0('0x41')]){_0x148406[_0x96a0('0x42')]=[{'all':!![]}];}_0x148406=_[_0x96a0('0x38')]({},_0x148406,_0x39efb0[_0x96a0('0x3b')]);return db['WhatsappQueue'][_0x96a0('0x43')](_0x148406)['then'](handleEntityNotFound(_0x5632d6,null))['then'](respondWithResult(_0x5632d6,null))[_0x96a0('0x3d')](handleError(_0x5632d6,null));};exports[_0x96a0('0x44')]=function(_0x3d1b70,_0x2d0048){return db['WhatsappQueue'][_0x96a0('0x44')](_0x3d1b70[_0x96a0('0x45')],{})[_0x96a0('0x22')](function(_0x4526e2){var _0x36b794=_0x3d1b70['user'][_0x96a0('0x24')]({'plain':!![]});if(!_0x36b794)throw new Error(_0x96a0('0x46'));if(_0x36b794[_0x96a0('0x47')]==='user'){var _0x42aea4=_0x4526e2['get']({'plain':!![]});var _0xabe832=_0x96a0('0x25');return db[_0x96a0('0x48')]['find']({'where':{'name':_0xabe832,'userProfileId':_0x36b794[_0x96a0('0x49')]},'raw':!![]})['then'](function(_0x4ae24f){if(_0x4ae24f&&_0x4ae24f[_0x96a0('0x4a')]===0x0){return db[_0x96a0('0x26')][_0x96a0('0x44')]({'name':_0x42aea4[_0x96a0('0x28')],'resourceId':_0x42aea4['id'],'type':_0x4ae24f[_0x96a0('0x28')],'sectionId':_0x4ae24f['id']},{})['then'](function(){return _0x4526e2;});}else{return _0x4526e2;}})[_0x96a0('0x3d')](function(_0x272e82){logger['error'](_0x96a0('0x4b'),_0x272e82);throw _0x272e82;});}return _0x4526e2;})['then'](respondWithResult(_0x2d0048,0xc9))['catch'](handleError(_0x2d0048,null));};exports[_0x96a0('0x4c')]=function(_0x5302da,_0x39fc0c){if(_0x5302da[_0x96a0('0x45')]['id']){delete _0x5302da[_0x96a0('0x45')]['id'];}return db[_0x96a0('0x2b')][_0x96a0('0x43')]({'where':{'id':_0x5302da[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x39fc0c,null))[_0x96a0('0x22')](saveUpdates(_0x5302da[_0x96a0('0x45')],null))[_0x96a0('0x22')](respondWithResult(_0x39fc0c,null))[_0x96a0('0x3d')](handleError(_0x39fc0c,null));};exports[_0x96a0('0x23')]=function(_0x5877e7,_0x2d1502){return db[_0x96a0('0x2b')][_0x96a0('0x43')]({'where':{'id':_0x5877e7[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x2d1502,null))[_0x96a0('0x22')](removeEntity(_0x2d1502,null))[_0x96a0('0x3d')](handleError(_0x2d1502,null));};exports[_0x96a0('0x4d')]=function(_0x5c59dd,_0x2abe6d){return db[_0x96a0('0x2b')][_0x96a0('0x4d')]()[_0x96a0('0x22')](respondWithResult(_0x2abe6d,null))['catch'](handleError(_0x2abe6d,null));};exports[_0x96a0('0x4e')]=function(_0x506fd7,_0x3f8d80,_0x1b9c07){var _0x430212={'raw':!![],'where':{}},_0x9a4747={},_0x1b830d;return db[_0x96a0('0x2b')][_0x96a0('0x4f')]({'where':{'id':_0x506fd7['params']['id']}})['then'](handleEntityNotFound(_0x3f8d80,null))[_0x96a0('0x22')](function(_0x3fc0a9){if(_0x3fc0a9){_0x1b830d=_0x3fc0a9[_0x96a0('0x24')]({'plain':!![]});_0x9a4747[_0x96a0('0x2e')]=_[_0x96a0('0x3f')](db['UserWhatsappQueue'][_0x96a0('0x2c')]);_0x9a4747[_0x96a0('0x2f')]=_['keys'](_0x506fd7['query']);_0x9a4747[_0x96a0('0x30')]=_[_0x96a0('0x31')](_0x9a4747['model'],_0x9a4747[_0x96a0('0x2f')]);_0x430212[_0x96a0('0x33')]=_[_0x96a0('0x31')](_0x9a4747[_0x96a0('0x2e')],qs['fields'](_0x506fd7['query'][_0x96a0('0x32')]));_0x430212['attributes']=_0x430212[_0x96a0('0x33')]['length']?_0x430212['attributes']:_0x9a4747['model'];if(!_0x506fd7[_0x96a0('0x2f')]['hasOwnProperty'](_0x96a0('0x50'))){_0x430212[_0x96a0('0x1e')]=qs[_0x96a0('0x1e')](_0x506fd7[_0x96a0('0x2f')][_0x96a0('0x1e')]);_0x430212[_0x96a0('0x1d')]=qs[_0x96a0('0x1d')](_0x506fd7['query'][_0x96a0('0x1d')]);}_0x430212[_0x96a0('0x35')]=qs[_0x96a0('0x36')](_0x506fd7['query']['sort']);_0x430212['where']=qs['filters'](_[_0x96a0('0x51')](_0x506fd7[_0x96a0('0x2f')],_0x9a4747[_0x96a0('0x30')]));_0x430212[_0x96a0('0x37')][_0x96a0('0x52')]=_0x3fc0a9['id'];if(_0x506fd7[_0x96a0('0x2f')]['filter']){_0x430212[_0x96a0('0x37')]=_[_0x96a0('0x38')](_0x430212[_0x96a0('0x37')],{'$or':_['map'](_0x430212[_0x96a0('0x33')],function(_0x3d61cb){var _0x134a11={};_0x134a11[_0x3d61cb]={'$like':'%'+_0x506fd7['query'][_0x96a0('0x3a')]+'%'};return _0x134a11;})});}_0x430212=_[_0x96a0('0x38')]({},_0x430212,_0x506fd7[_0x96a0('0x3b')]);return db[_0x96a0('0x53')][_0x96a0('0x54')](_0x430212);}})[_0x96a0('0x22')](function(_0x48ea62){if(_0x48ea62){return db[_0x96a0('0x55')][_0x96a0('0x56')]({'where':{'id':_['map'](_0x48ea62,_0x96a0('0x57')),'role':_0x96a0('0x58')},'attributes':['id',_0x96a0('0x28'),_0x96a0('0x59'),_0x96a0('0x5a'),_0x96a0('0x5b')]});}})['then'](function(_0x538423){if(_0x538423){return{'count':_0x538423[_0x96a0('0x3c')],'rows':_['map'](_0x538423[_0x96a0('0x5c')],function(_0x42652c){return{'membername':_0x42652c[_0x96a0('0x28')],'UserId':_0x42652c['id'],'queue_name':_0x1b830d[_0x96a0('0x28')],'WhatsappQueueId':_0x1b830d['id'],'interface':util[_0x96a0('0x5d')](_0x96a0('0x5e'),'SIP',_0x42652c[_0x96a0('0x28')]),'penalty':0x0,'paused':_0x42652c[_0x96a0('0x59')],'createdAt':_0x42652c['createdAt'],'updatedAt':_0x42652c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f8d80,_0x430212))['catch'](handleError(_0x3f8d80,null));};exports[_0x96a0('0x5f')]=function(_0x280933,_0x2eef6f,_0x31f9b5){var _0x40c8d8={};var _0x427adb={};var _0x14ced0;var _0x3b39d1;return db[_0x96a0('0x2b')][_0x96a0('0x4f')]({'where':{'id':_0x280933['params']['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x2eef6f,null))['then'](function(_0x59aa0f){if(_0x59aa0f){_0x14ced0=_0x59aa0f;_0x427adb[_0x96a0('0x2e')]=_[_0x96a0('0x3f')](db[_0x96a0('0x60')][_0x96a0('0x2c')]);_0x427adb[_0x96a0('0x2f')]=_['keys'](_0x280933[_0x96a0('0x2f')]);_0x427adb['filters']=_[_0x96a0('0x31')](_0x427adb[_0x96a0('0x2e')],_0x427adb[_0x96a0('0x2f')]);_0x40c8d8[_0x96a0('0x33')]=_['intersection'](_0x427adb[_0x96a0('0x2e')],qs[_0x96a0('0x32')](_0x280933[_0x96a0('0x2f')][_0x96a0('0x32')]));_0x40c8d8['attributes']=_0x40c8d8[_0x96a0('0x33')][_0x96a0('0x40')]?_0x40c8d8[_0x96a0('0x33')]:_0x427adb['model'];_0x40c8d8[_0x96a0('0x35')]=qs[_0x96a0('0x36')](_0x280933['query'][_0x96a0('0x36')]);_0x40c8d8['where']=qs[_0x96a0('0x30')](_[_0x96a0('0x51')](_0x280933[_0x96a0('0x2f')],_0x427adb[_0x96a0('0x30')]));if(_0x280933[_0x96a0('0x2f')]['filter']){_0x40c8d8[_0x96a0('0x37')]=_[_0x96a0('0x38')](_0x40c8d8[_0x96a0('0x37')],{'$or':_[_0x96a0('0x2a')](_0x40c8d8[_0x96a0('0x33')],function(_0x485019){var _0x57dd7e={};_0x57dd7e[_0x485019]={'$like':'%'+_0x280933[_0x96a0('0x2f')][_0x96a0('0x3a')]+'%'};return _0x57dd7e;})});}_0x40c8d8=_[_0x96a0('0x38')]({},_0x40c8d8,_0x280933[_0x96a0('0x3b')]);return _0x14ced0[_0x96a0('0x5f')](_0x40c8d8);}})[_0x96a0('0x22')](function(_0x494a27){if(_0x494a27){_0x3b39d1=_0x494a27[_0x96a0('0x40')];if(!_0x280933[_0x96a0('0x2f')][_0x96a0('0x34')](_0x96a0('0x50'))){_0x40c8d8[_0x96a0('0x1e')]=qs['limit'](_0x280933['query'][_0x96a0('0x1e')]);_0x40c8d8[_0x96a0('0x1d')]=qs[_0x96a0('0x1d')](_0x280933[_0x96a0('0x2f')]['offset']);}return _0x14ced0[_0x96a0('0x5f')](_0x40c8d8);}})[_0x96a0('0x22')](function(_0x2cc342){if(_0x2cc342){return _0x2cc342?{'count':_0x3b39d1,'rows':_0x2cc342}:null;}})[_0x96a0('0x22')](respondWithResult(_0x2eef6f,null))[_0x96a0('0x3d')](handleError(_0x2eef6f,null));};exports[_0x96a0('0x61')]=function(_0x3a6025,_0x9252af,_0x218f39){var _0x85b89f=_0x3a6025[_0x96a0('0x45')][_0x96a0('0x62')];return db['Team'][_0x96a0('0x54')]({'where':{'id':_0x85b89f},'attributes':['id'],'include':[{'model':db[_0x96a0('0x55')],'as':_0x96a0('0x63'),'attributes':['id','name',_0x96a0('0x64'),'voicePause',_0x96a0('0x65')],'raw':!![]}]})['then'](function(_0x3b2912){if(_0x3b2912){var _0x3b702f=_[_0x96a0('0x66')](_0x3b2912,function(_0x38d05a){var _0x559a36=_0x38d05a['get']({'plain':!![]});return _0x559a36['Agents'];});return db[_0x96a0('0x2b')][_0x96a0('0x43')]({'where':{'id':_0x3a6025['params']['id']}})['then'](function(_0x3cbf87){return db[_0x96a0('0x67')][_0x96a0('0x68')](function(_0x4e13ba){return _0x3cbf87[_0x96a0('0x61')](_0x85b89f,{'transaction':_0x4e13ba})[_0x96a0('0x22')](function(){return BPromise[_0x96a0('0x69')](_0x3b702f,function(_0x5b8fd2){return db[_0x96a0('0x53')][_0x96a0('0x6a')]({'where':{'UserId':_0x5b8fd2['id'],'WhatsappQueueId':_0x3a6025[_0x96a0('0x3e')]['id']},'transaction':_0x4e13ba});});})['then'](function(){_0x3b702f[_0x96a0('0x6b')](function(_0x35e814){socket[_0x96a0('0x6c')](_0x96a0('0x6d'),{'UserId':_0x35e814['id'],'WhatsappQueueId':_0x3cbf87['id']});});});});});}})[_0x96a0('0x22')](respondWithStatusCode(_0x9252af,null))['catch'](handleError(_0x9252af,null));};exports[_0x96a0('0x6e')]=function(_0x1f25f5,_0x291ee0,_0x32a03a){return db[_0x96a0('0x60')]['findAll']({'where':{'id':_0x1f25f5[_0x96a0('0x2f')][_0x96a0('0x62')]},'attributes':['id'],'include':[{'model':db[_0x96a0('0x55')],'as':_0x96a0('0x63'),'attributes':['id'],'raw':!![]}]})[_0x96a0('0x22')](handleEntityNotFound(_0x291ee0,null))['then'](function(_0x21ef1d){var _0x1b63e7=_[_0x96a0('0x2a')](_0x21ef1d,'id');var _0x50e076=[];var _0x3ba695=[];var _0xfa4a62=squel[_0x96a0('0x6f')]();_0xfa4a62[_0x96a0('0x70')](_0x96a0('0x71'))['from'](_0x96a0('0x72'),'tq')[_0x96a0('0x73')](_0x96a0('0x74'),'ut',_0x96a0('0x75'))[_0x96a0('0x37')]('WhatsappQueueId\x20=\x20?',_0x1f25f5[_0x96a0('0x3e')]['id']);for(var _0x3a0877=0x0;_0x3a0877<_0x21ef1d[_0x96a0('0x40')];_0x3a0877+=0x1){let _0x2c1455=_0x21ef1d[_0x3a0877];for(var _0x54e032=0x0;_0x54e032<_0x2c1455[_0x96a0('0x63')][_0x96a0('0x40')];_0x54e032+=0x1){let _0x2892aa=_0x2c1455[_0x96a0('0x63')][_0x54e032];var _0x5a3355=_0xfa4a62[_0x96a0('0x76')]();_0x5a3355[_0x96a0('0x37')](_0x96a0('0x77'),_0x2892aa['id']);_0x3ba695['push'](db[_0x96a0('0x67')]['query'](_0x5a3355[_0x96a0('0x78')](),{'type':db[_0x96a0('0x67')][_0x96a0('0x79')][_0x96a0('0x7a')]})[_0x96a0('0x22')](function(_0xa1f033){if(_0xa1f033[_0x96a0('0x40')]===0x1){return _0x2892aa['id'];}else{var _0x1a8b73=_[_0x96a0('0x7b')](_['map'](_0xa1f033,_0x96a0('0x7c')),function(_0x275f30){return _[_0x96a0('0x7d')](_0x1b63e7,_0x275f30);});if(_0x1a8b73){return _0x2892aa['id'];}}}));}}return BPromise['all'](_0x3ba695)[_0x96a0('0x22')](function(_0x2fe5d4){_0x50e076=_(_0x50e076)[_0x96a0('0x7e')](_0x2fe5d4)[_0x96a0('0x7f')]()['value']();return db[_0x96a0('0x2b')]['find']({'where':{'id':_0x1f25f5[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](function(_0x34df9a){return db[_0x96a0('0x67')][_0x96a0('0x68')](function(_0x3e5995){return _0x34df9a['removeTeams'](_0x1f25f5[_0x96a0('0x2f')][_0x96a0('0x62')],{'transaction':_0x3e5995})[_0x96a0('0x22')](function(){if(!_['isEmpty'](_0x50e076)){return _0x34df9a[_0x96a0('0x80')](_0x50e076,{'transaction':_0x3e5995});}})['then'](function(){_0x50e076[_0x96a0('0x6b')](function(_0x273be3){socket[_0x96a0('0x6c')](_0x96a0('0x81'),{'UserId':_0x273be3,'WhatsappQueueId':_0x34df9a['id']});});});});});});})[_0x96a0('0x22')](respondWithStatusCode(_0x291ee0,null))[_0x96a0('0x3d')](handleError(_0x291ee0,null));};exports[_0x96a0('0x82')]=function(_0x203b21,_0x16733a,_0x5f30be){return db[_0x96a0('0x2b')][_0x96a0('0x43')]({'where':{'id':_0x203b21[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x16733a,null))[_0x96a0('0x22')](function(_0x1db19d){if(_0x1db19d){return _0x1db19d[_0x96a0('0x82')](_0x203b21[_0x96a0('0x45')][_0x96a0('0x62')],_[_0x96a0('0x83')](_0x203b21[_0x96a0('0x45')],['ids','id'])||{})['spread'](function(_0xff7c7){for(var _0x1024e6=0x0;_0x1024e6<_0x203b21[_0x96a0('0x45')]['ids'][_0x96a0('0x40')];_0x1024e6+=0x1){socket[_0x96a0('0x6c')]('userWhatsappQueue:save',{'UserId':Number(_0x203b21[_0x96a0('0x45')][_0x96a0('0x62')][_0x1024e6]),'WhatsappQueueId':Number(_0x203b21[_0x96a0('0x3e')]['id'])});}return _0xff7c7;});}})['then'](respondWithResult(_0x16733a,null))[_0x96a0('0x3d')](handleError(_0x16733a,null));};exports['removeAgents']=function(_0x1c045f,_0x31f86c,_0x2c4e93){return db[_0x96a0('0x2b')]['find']({'where':{'id':_0x1c045f[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x31f86c,null))[_0x96a0('0x22')](function(_0x322a27){if(_0x322a27){return _0x322a27[_0x96a0('0x80')](_0x1c045f[_0x96a0('0x2f')]['ids'])[_0x96a0('0x22')](function(){if(_[_0x96a0('0x84')](_0x1c045f[_0x96a0('0x2f')][_0x96a0('0x62')])){for(var _0x5f40e0=0x0;_0x5f40e0<_0x1c045f[_0x96a0('0x2f')][_0x96a0('0x62')][_0x96a0('0x40')];_0x5f40e0+=0x1){socket[_0x96a0('0x6c')](_0x96a0('0x81'),{'UserId':Number(_0x1c045f[_0x96a0('0x2f')][_0x96a0('0x62')][_0x5f40e0]),'WhatsappQueueId':Number(_0x1c045f['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1c045f['query']['ids']),'WhatsappQueueId':Number(_0x1c045f['params']['id'])});}});}})[_0x96a0('0x22')](respondWithStatusCode(_0x31f86c,null))[_0x96a0('0x3d')](handleError(_0x31f86c,null));};exports['getAgents']=function(_0xf73eb2,_0x17b407,_0x2a0fe8){var _0x5bdc85={};var _0x32c045={};var _0x1a508c;var _0x5bfe92;return db[_0x96a0('0x2b')][_0x96a0('0x4f')]({'where':{'id':_0xf73eb2[_0x96a0('0x3e')]['id']}})[_0x96a0('0x22')](handleEntityNotFound(_0x17b407,null))[_0x96a0('0x22')](function(_0xa4c1bb){if(_0xa4c1bb){_0x1a508c=_0xa4c1bb;_0x32c045[_0x96a0('0x2e')]=_['keys'](db[_0x96a0('0x55')][_0x96a0('0x2c')]);_0x32c045[_0x96a0('0x2f')]=_[_0x96a0('0x3f')](_0xf73eb2[_0x96a0('0x2f')]);_0x32c045['filters']=_['intersection'](_0x32c045['model'],_0x32c045[_0x96a0('0x2f')]);_0x5bdc85['attributes']=_['intersection'](_0x32c045[_0x96a0('0x2e')],qs[_0x96a0('0x32')](_0xf73eb2[_0x96a0('0x2f')]['fields']));_0x5bdc85[_0x96a0('0x33')]=_0x5bdc85[_0x96a0('0x33')]['length']?_0x5bdc85['attributes']:_0x32c045[_0x96a0('0x2e')];_0x5bdc85['order']=qs[_0x96a0('0x36')](_0xf73eb2[_0x96a0('0x2f')][_0x96a0('0x36')]);_0x5bdc85[_0x96a0('0x37')]=qs[_0x96a0('0x30')](_[_0x96a0('0x51')](_0xf73eb2['query'],_0x32c045['filters']));if(_0xf73eb2[_0x96a0('0x2f')]['filter']){_0x5bdc85[_0x96a0('0x37')]=_[_0x96a0('0x38')](_0x5bdc85[_0x96a0('0x37')],{'$or':_[_0x96a0('0x2a')](_0x5bdc85['attributes'],function(_0x129f57){var _0x3ad4bf={};_0x3ad4bf[_0x129f57]={'$like':'%'+_0xf73eb2['query']['filter']+'%'};return _0x3ad4bf;})});}_0x5bdc85=_[_0x96a0('0x38')]({},_0x5bdc85,_0xf73eb2[_0x96a0('0x3b')]);return _0x1a508c[_0x96a0('0x85')](_0x5bdc85);}})[_0x96a0('0x22')](function(_0x14da04){if(_0x14da04){_0x5bfe92=_0x14da04[_0x96a0('0x40')];if(!_0xf73eb2['query'][_0x96a0('0x34')]('nolimit')){_0x5bdc85['limit']=qs[_0x96a0('0x1e')](_0xf73eb2[_0x96a0('0x2f')][_0x96a0('0x1e')]);_0x5bdc85[_0x96a0('0x1d')]=qs[_0x96a0('0x1d')](_0xf73eb2[_0x96a0('0x2f')][_0x96a0('0x1d')]);}return _0x1a508c[_0x96a0('0x85')](_0x5bdc85);}})[_0x96a0('0x22')](function(_0x293142){if(_0x293142){return _0x293142?{'count':_0x5bfe92,'rows':_0x293142}:null;}})[_0x96a0('0x22')](respondWithResult(_0x17b407,null))[_0x96a0('0x3d')](handleError(_0x17b407,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 72aef83..ae41c00 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 _0x2b26=['WhatsappQueue','save','update','hasOwnProperty','hook','exports','events'];(function(_0x165ece,_0x1f0a42){var _0x545fe6=function(_0x1ac8e9){while(--_0x1ac8e9){_0x165ece['push'](_0x165ece['shift']());}};_0x545fe6(++_0x1f0a42);}(_0x2b26,0x12c));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x62b2('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x62b2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x62b2('0x2'),'afterUpdate':_0x62b2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5785a6){return function(_0x301744,_0xdea916,_0x3f7d33){WhatsappQueueEvents['emit'](_0x5785a6+':'+_0x301744['id'],_0x301744);WhatsappQueueEvents['emit'](_0x5785a6,_0x301744);_0x3f7d33(null);};}for(var e in events){if(events[_0x62b2('0x4')](e)){var event=events[e];WhatsappQueue[_0x62b2('0x5')](e,emitEvent(event));}}module[_0x62b2('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xe0e7=['hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','update','remove','emit'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0xe0e7,0x162));var _0x7e0e=function(_0x1ef48d,_0x203c73){_0x1ef48d=_0x1ef48d-0x0;var _0x450096=_0xe0e7[_0x1ef48d];return _0x450096;};'use strict';var EventEmitter=require(_0x7e0e('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x7e0e('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7e0e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e0e('0x3'),'afterDestroy':_0x7e0e('0x4')};function emitEvent(_0xbf0af6){return function(_0x40b9b4,_0x3b5855,_0x5e6383){WhatsappQueueEvents[_0x7e0e('0x5')](_0xbf0af6+':'+_0x40b9b4['id'],_0x40b9b4);WhatsappQueueEvents[_0x7e0e('0x5')](_0xbf0af6,_0x40b9b4);_0x5e6383(null);};}for(var e in events){if(events[_0x7e0e('0x6')](e)){var event=events[e];WhatsappQueue[_0x7e0e('0x7')](e,emitEvent(event));}}module[_0x7e0e('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 598516d..cc0bce5 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 _0xb92a=['request-promise','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb92a,0x1c9));var _0xab92=function(_0x104cf7,_0x4a29d5){_0x104cf7=_0x104cf7-0x0;var _0x50d33f=_0xb92a[_0x104cf7];return _0x50d33f;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var logger=require(_0xab92('0x2'))(_0xab92('0x3'));var moment=require('moment');var BPromise=require(_0xab92('0x4'));var rp=require(_0xab92('0x5'));var fs=require('fs');var path=require(_0xab92('0x6'));var rimraf=require(_0xab92('0x7'));var config=require(_0xab92('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xab92('0x9')]=function(_0x9a7553,_0xe2bcee){return _0x9a7553['define']('WhatsappQueue',attributes,{'tableName':_0xab92('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22e5=['lodash','api','path','rimraf','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues'];(function(_0x29184a,_0xa6d3e0){var _0x133596=function(_0x17d7a3){while(--_0x17d7a3){_0x29184a['push'](_0x29184a['shift']());}};_0x133596(++_0xa6d3e0);}(_0x22e5,0x15e));var _0x522e=function(_0x545cf0,_0x58a59a){_0x545cf0=_0x545cf0-0x0;var _0x2e3a3a=_0x22e5[_0x545cf0];return _0x2e3a3a;};'use strict';var _=require(_0x522e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x522e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x522e('0x2'));var rimraf=require(_0x522e('0x3'));var config=require('../../config/environment');var attributes=require(_0x522e('0x4'));module['exports']=function(_0x4df96f,_0x1c0598){return _0x4df96f['define'](_0x522e('0x5'),attributes,{'tableName':_0x522e('0x6'),'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 fe5d62c..9a788c5 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 _0xf628=['localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','map','include','model','stringify','find','raw','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x2404a3,_0x1c9119){var _0x5d5985=function(_0x55ea6a){while(--_0x55ea6a){_0x2404a3['push'](_0x2404a3['shift']());}};_0x5d5985(++_0x1c9119);}(_0xf628,0x97));var _0x8f62=function(_0x1b3e12,_0x3cbdfd){_0x1b3e12=_0x1b3e12-0x0;var _0x54d691=_0xf628[_0x1b3e12];return _0x54d691;};'use strict';var _=require(_0x8f62('0x0'));var util=require(_0x8f62('0x1'));var moment=require(_0x8f62('0x2'));var BPromise=require(_0x8f62('0x3'));var rs=require(_0x8f62('0x4'));var fs=require('fs');var Redis=require(_0x8f62('0x5'));var db=require(_0x8f62('0x6'))['db'];var utils=require(_0x8f62('0x7'));var logger=require(_0x8f62('0x8'))(_0x8f62('0x9'));var config=require(_0x8f62('0xa'));var jayson=require(_0x8f62('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x8f62('0xc')]=_['defaults'](config[_0x8f62('0xc')],{'host':_0x8f62('0xd'),'port':0x18eb});var socket=require(_0x8f62('0xe'))(new Redis(config[_0x8f62('0xc')]));require(_0x8f62('0xf'))[_0x8f62('0x10')](socket);function respondWithRpcPromise(_0x1aec63,_0x28c12f,_0x554360){return new BPromise(function(_0x444d7c,_0x5c00d4){return client['request'](_0x1aec63,_0x554360)[_0x8f62('0x11')](function(_0x1953b8){logger[_0x8f62('0x12')](_0x8f62('0x13'),_0x28c12f,'request\x20sent');logger[_0x8f62('0x14')](_0x8f62('0x15'),_0x28c12f,_0x8f62('0x16'),JSON['stringify'](_0x1953b8));if(_0x1953b8[_0x8f62('0x17')]){if(_0x1953b8[_0x8f62('0x17')]['code']===0x1f4){logger['error'](_0x8f62('0x13'),_0x28c12f,_0x1953b8[_0x8f62('0x17')][_0x8f62('0x18')]);return _0x5c00d4(_0x1953b8[_0x8f62('0x17')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x28c12f,_0x1953b8[_0x8f62('0x17')]['message']);return _0x444d7c(_0x1953b8[_0x8f62('0x17')][_0x8f62('0x18')]);}else{logger[_0x8f62('0x12')](_0x8f62('0x13'),_0x28c12f,'request\x20sent');_0x444d7c(_0x1953b8[_0x8f62('0x19')][_0x8f62('0x18')]);}})[_0x8f62('0x1a')](function(_0x3c35d2){logger[_0x8f62('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x28c12f,_0x3c35d2);_0x5c00d4(_0x3c35d2);});});}exports[_0x8f62('0x1b')]=function(_0xd81796){var _0x5a6f55=this;return new Promise(function(_0xca8fb,_0x57dee0){return db[_0x8f62('0x1c')][_0x8f62('0x1d')]({'raw':_0xd81796[_0x8f62('0x1e')]?_0xd81796[_0x8f62('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x1f')]||null:null,'attributes':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x20')]||null:null,'limit':_0xd81796['options']?_0xd81796[_0x8f62('0x1e')][_0x8f62('0x21')]||null:null,'include':_0xd81796[_0x8f62('0x1e')]?_0xd81796[_0x8f62('0x1e')]['include']?_[_0x8f62('0x22')](_0xd81796[_0x8f62('0x1e')][_0x8f62('0x23')],function(_0x56b0d3){return{'model':db[_0x56b0d3['model']],'as':_0x56b0d3['as'],'attributes':_0x56b0d3[_0x8f62('0x20')],'include':_0x56b0d3[_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x56b0d3[_0x8f62('0x23')],function(_0x509a28){return{'model':db[_0x509a28['model']],'as':_0x509a28['as'],'attributes':_0x509a28['attributes'],'include':_0x509a28[_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x509a28[_0x8f62('0x23')],function(_0x680343){return{'model':db[_0x680343[_0x8f62('0x24')]],'as':_0x680343['as'],'attributes':_0x680343[_0x8f62('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487680){logger[_0x8f62('0x12')](_0x8f62('0x1b'),_0xd81796);logger[_0x8f62('0x14')](_0x8f62('0x1b'),_0xd81796,JSON[_0x8f62('0x25')](_0x487680));_0xca8fb(_0x487680);})['catch'](function(_0x1a8c0d){logger['error']('GetWhatsappQueue',_0x1a8c0d[_0x8f62('0x18')],_0xd81796);_0x57dee0(_0x5a6f55[_0x8f62('0x17')](0x1f4,_0x1a8c0d['message']));});});};exports['ShowWhatsappQueue']=function(_0x2f2beb){var _0x1aea83=this;return new Promise(function(_0x99d9d5,_0x538a1d){return db[_0x8f62('0x1c')][_0x8f62('0x26')]({'raw':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x27')]===undefined?!![]:![]:!![],'where':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x1f')]||null:null,'attributes':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb['options'][_0x8f62('0x20')]||null:null,'include':_0x2f2beb[_0x8f62('0x1e')]?_0x2f2beb[_0x8f62('0x1e')][_0x8f62('0x23')]?_[_0x8f62('0x22')](_0x2f2beb['options'][_0x8f62('0x23')],function(_0xc0e9e5){return{'model':db[_0xc0e9e5[_0x8f62('0x24')]],'as':_0xc0e9e5['as'],'attributes':_0xc0e9e5[_0x8f62('0x20')],'include':_0xc0e9e5[_0x8f62('0x23')]?_['map'](_0xc0e9e5['include'],function(_0x2ddfc5){return{'model':db[_0x2ddfc5[_0x8f62('0x24')]],'as':_0x2ddfc5['as'],'attributes':_0x2ddfc5['attributes'],'include':_0x2ddfc5[_0x8f62('0x23')]?_['map'](_0x2ddfc5[_0x8f62('0x23')],function(_0x10a9ab){return{'model':db[_0x10a9ab['model']],'as':_0x10a9ab['as'],'attributes':_0x10a9ab[_0x8f62('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8f62('0x11')](function(_0x4b62d8){logger[_0x8f62('0x12')](_0x8f62('0x28'),_0x2f2beb);logger[_0x8f62('0x14')]('ShowWhatsappQueue',_0x2f2beb,JSON[_0x8f62('0x25')](_0x4b62d8));_0x99d9d5(_0x4b62d8);})['catch'](function(_0x470b89){logger[_0x8f62('0x17')](_0x8f62('0x28'),_0x470b89[_0x8f62('0x18')],_0x2f2beb);_0x538a1d(_0x1aea83['error'](0x1f4,_0x470b89[_0x8f62('0x18')]));});});}; \ No newline at end of file +var _0xfedb=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','include','model','attributes','catch','ShowWhatsappQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info'];(function(_0x25154e,_0x3f71e9){var _0x549164=function(_0x2cb2d4){while(--_0x2cb2d4){_0x25154e['push'](_0x25154e['shift']());}};_0x549164(++_0x3f71e9);}(_0xfedb,0x1b1));var _0xbfed=function(_0xccfd6f,_0x8e49f5){_0xccfd6f=_0xccfd6f-0x0;var _0x4551aa=_0xfedb[_0xccfd6f];return _0x4551aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfed('0x0'));var BPromise=require(_0xbfed('0x1'));var rs=require(_0xbfed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfed('0x3'))['db'];var utils=require(_0xbfed('0x4'));var logger=require(_0xbfed('0x5'))(_0xbfed('0x6'));var config=require(_0xbfed('0x7'));var jayson=require(_0xbfed('0x8'));var client=jayson[_0xbfed('0x9')][_0xbfed('0xa')]({'port':0x232a});config[_0xbfed('0xb')]=_[_0xbfed('0xc')](config[_0xbfed('0xb')],{'host':_0xbfed('0xd'),'port':0x18eb});var socket=require(_0xbfed('0xe'))(new Redis(config[_0xbfed('0xb')]));require(_0xbfed('0xf'))[_0xbfed('0x10')](socket);function respondWithRpcPromise(_0x50dfff,_0x43e9eb,_0x2e0e43){return new BPromise(function(_0x31941a,_0x5b8ce9){return client['request'](_0x50dfff,_0x2e0e43)['then'](function(_0x19163f){logger[_0xbfed('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x43e9eb,'request\x20sent');logger[_0xbfed('0x12')](_0xbfed('0x13'),_0x43e9eb,_0xbfed('0x14'),JSON[_0xbfed('0x15')](_0x19163f));if(_0x19163f[_0xbfed('0x16')]){if(_0x19163f[_0xbfed('0x16')][_0xbfed('0x17')]===0x1f4){logger['error'](_0xbfed('0x18'),_0x43e9eb,_0x19163f['error'][_0xbfed('0x19')]);return _0x5b8ce9(_0x19163f[_0xbfed('0x16')]['message']);}logger[_0xbfed('0x16')](_0xbfed('0x18'),_0x43e9eb,_0x19163f[_0xbfed('0x16')][_0xbfed('0x19')]);return _0x31941a(_0x19163f[_0xbfed('0x16')][_0xbfed('0x19')]);}else{logger[_0xbfed('0x11')](_0xbfed('0x18'),_0x43e9eb,'request\x20sent');_0x31941a(_0x19163f[_0xbfed('0x1a')]['message']);}})['catch'](function(_0x28ea0a){logger[_0xbfed('0x16')](_0xbfed('0x18'),_0x43e9eb,_0x28ea0a);_0x5b8ce9(_0x28ea0a);});});}exports[_0xbfed('0x1b')]=function(_0x50926f){var _0x36b5d5=this;return new Promise(function(_0x329047,_0x3defe7){return db[_0xbfed('0x1c')][_0xbfed('0x1d')]({'raw':_0x50926f[_0xbfed('0x1e')]?_0x50926f[_0xbfed('0x1e')][_0xbfed('0x1f')]===undefined?!![]:![]:!![],'where':_0x50926f[_0xbfed('0x1e')]?_0x50926f[_0xbfed('0x1e')][_0xbfed('0x20')]||null:null,'attributes':_0x50926f[_0xbfed('0x1e')]?_0x50926f[_0xbfed('0x1e')]['attributes']||null:null,'limit':_0x50926f[_0xbfed('0x1e')]?_0x50926f[_0xbfed('0x1e')][_0xbfed('0x21')]||null:null,'include':_0x50926f[_0xbfed('0x1e')]?_0x50926f[_0xbfed('0x1e')]['include']?_[_0xbfed('0x22')](_0x50926f[_0xbfed('0x1e')][_0xbfed('0x23')],function(_0x5c1697){return{'model':db[_0x5c1697['model']],'as':_0x5c1697['as'],'attributes':_0x5c1697['attributes'],'include':_0x5c1697[_0xbfed('0x23')]?_[_0xbfed('0x22')](_0x5c1697[_0xbfed('0x23')],function(_0x11cf86){return{'model':db[_0x11cf86[_0xbfed('0x24')]],'as':_0x11cf86['as'],'attributes':_0x11cf86[_0xbfed('0x25')],'include':_0x11cf86['include']?_[_0xbfed('0x22')](_0x11cf86[_0xbfed('0x23')],function(_0x4b4b93){return{'model':db[_0x4b4b93[_0xbfed('0x24')]],'as':_0x4b4b93['as'],'attributes':_0x4b4b93[_0xbfed('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52bb98){logger['info'](_0xbfed('0x1b'),_0x50926f);logger[_0xbfed('0x12')](_0xbfed('0x1b'),_0x50926f,JSON[_0xbfed('0x15')](_0x52bb98));_0x329047(_0x52bb98);})[_0xbfed('0x26')](function(_0x2051f4){logger[_0xbfed('0x16')]('GetWhatsappQueue',_0x2051f4['message'],_0x50926f);_0x3defe7(_0x36b5d5[_0xbfed('0x16')](0x1f4,_0x2051f4[_0xbfed('0x19')]));});});};exports[_0xbfed('0x27')]=function(_0x2c9bd2){var _0x112a61=this;return new Promise(function(_0x4c6729,_0x27fffa){return db[_0xbfed('0x1c')][_0xbfed('0x28')]({'raw':_0x2c9bd2[_0xbfed('0x1e')]?_0x2c9bd2['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c9bd2[_0xbfed('0x1e')]?_0x2c9bd2['options']['where']||null:null,'attributes':_0x2c9bd2[_0xbfed('0x1e')]?_0x2c9bd2['options'][_0xbfed('0x25')]||null:null,'include':_0x2c9bd2[_0xbfed('0x1e')]?_0x2c9bd2['options'][_0xbfed('0x23')]?_[_0xbfed('0x22')](_0x2c9bd2[_0xbfed('0x1e')][_0xbfed('0x23')],function(_0x3116e3){return{'model':db[_0x3116e3['model']],'as':_0x3116e3['as'],'attributes':_0x3116e3['attributes'],'include':_0x3116e3[_0xbfed('0x23')]?_['map'](_0x3116e3[_0xbfed('0x23')],function(_0x46726c){return{'model':db[_0x46726c[_0xbfed('0x24')]],'as':_0x46726c['as'],'attributes':_0x46726c[_0xbfed('0x25')],'include':_0x46726c[_0xbfed('0x23')]?_[_0xbfed('0x22')](_0x46726c['include'],function(_0x3c5915){return{'model':db[_0x3c5915[_0xbfed('0x24')]],'as':_0x3c5915['as'],'attributes':_0x3c5915[_0xbfed('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18752b){logger[_0xbfed('0x11')](_0xbfed('0x27'),_0x2c9bd2);logger[_0xbfed('0x12')](_0xbfed('0x27'),_0x2c9bd2,JSON[_0xbfed('0x15')](_0x18752b));_0x4c6729(_0x18752b);})[_0xbfed('0x26')](function(_0x2dff3d){logger[_0xbfed('0x16')](_0xbfed('0x27'),_0x2dff3d[_0xbfed('0x19')],_0x2c9bd2);_0x27fffa(_0x112a61['error'](0x1f4,_0x2dff3d[_0xbfed('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 802058e..153f6c1 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 _0xd1a1=['whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','length'];(function(_0x4763f7,_0x7c6950){var _0x5d419e=function(_0x593f4b){while(--_0x593f4b){_0x4763f7['push'](_0x4763f7['shift']());}};_0x5d419e(++_0x7c6950);}(_0xd1a1,0x120));var _0x1d1a=function(_0x1cb853,_0x3b0296){_0x1cb853=_0x1cb853-0x0;var _0x8ac2e3=_0xd1a1[_0x1cb853];return _0x8ac2e3;};'use strict';var WhatsappQueueEvents=require(_0x1d1a('0x0'));var events=[_0x1d1a('0x1'),_0x1d1a('0x2'),'update'];function createListener(_0xa9f8e7,_0xb97168){return function(_0x3e7aab){_0xb97168[_0x1d1a('0x3')](_0xa9f8e7,_0x3e7aab);};}function removeListener(_0x1bb44d,_0x329e6e){return function(){WhatsappQueueEvents[_0x1d1a('0x4')](_0x1bb44d,_0x329e6e);};}exports['register']=function(_0x15c866){for(var _0x5bd769=0x0,_0x8616c=events[_0x1d1a('0x5')];_0x5bd769<_0x8616c;_0x5bd769++){var _0x4a5c5=events[_0x5bd769];var _0x13be73=createListener(_0x1d1a('0x6')+_0x4a5c5,_0x15c866);WhatsappQueueEvents['on'](_0x4a5c5,_0x13be73);}}; \ No newline at end of file +var _0x1a0e=['./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x31aec1,_0x394b02){var _0x277efa=function(_0x1b8894){while(--_0x1b8894){_0x31aec1['push'](_0x31aec1['shift']());}};_0x277efa(++_0x394b02);}(_0x1a0e,0x11f));var _0xe1a0=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x1a0e[_0xf2628e];return _0x13863a;};'use strict';var WhatsappQueueEvents=require(_0xe1a0('0x0'));var events=[_0xe1a0('0x1'),_0xe1a0('0x2'),_0xe1a0('0x3')];function createListener(_0x57c010,_0x5911b9){return function(_0x2d280f){_0x5911b9[_0xe1a0('0x4')](_0x57c010,_0x2d280f);};}function removeListener(_0x292d88,_0x64e505){return function(){WhatsappQueueEvents[_0xe1a0('0x5')](_0x292d88,_0x64e505);};}exports[_0xe1a0('0x6')]=function(_0x2455f2){for(var _0x479cb2=0x0,_0x2bba9e=events['length'];_0x479cb2<_0x2bba9e;_0x479cb2++){var _0x1f39fa=events[_0x479cb2];var _0x3e3594=createListener('whatsappQueue:'+_0x1f39fa,_0x2455f2);WhatsappQueueEvents['on'](_0x1f39fa,_0x3e3594);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d618622..349b925 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 _0x7b32=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x137faa,_0x24f399){var _0x35a2f0=function(_0x4a22b3){while(--_0x4a22b3){_0x137faa['push'](_0x137faa['shift']());}};_0x35a2f0(++_0x24f399);}(_0x7b32,0x1d2));var _0x27b3=function(_0x523b8f,_0x4b05ef){_0x523b8f=_0x523b8f-0x0;var _0x5e77fc=_0x7b32[_0x523b8f];return _0x5e77fc;};'use strict';var multer=require(_0x27b3('0x0'));var util=require(_0x27b3('0x1'));var path=require(_0x27b3('0x2'));var timeout=require(_0x27b3('0x3'));var express=require(_0x27b3('0x4'));var router=express[_0x27b3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x27b3('0x6'));var interaction=require(_0x27b3('0x7'));var config=require(_0x27b3('0x8'));var controller=require(_0x27b3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x27b3('0xa')]);router[_0x27b3('0xb')](_0x27b3('0xc'),auth[_0x27b3('0xd')](),controller[_0x27b3('0xe')]);router[_0x27b3('0xb')](_0x27b3('0xf'),auth['isAuthenticated'](),controller[_0x27b3('0x10')]);router[_0x27b3('0x11')]('/',auth[_0x27b3('0xd')](),controller[_0x27b3('0x12')]);router[_0x27b3('0x13')](_0x27b3('0xf'),auth[_0x27b3('0xd')](),controller[_0x27b3('0x14')]);router[_0x27b3('0x15')](_0x27b3('0xf'),auth[_0x27b3('0xd')](),controller[_0x27b3('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfbc8=['get','isAuthenticated','/describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x259659,_0x2cfec9){var _0x3d75ea=function(_0x5af758){while(--_0x5af758){_0x259659['push'](_0x259659['shift']());}};_0x3d75ea(++_0x2cfec9);}(_0xfbc8,0xb5));var _0x8fbc=function(_0x3093fe,_0x5a0cff){_0x3093fe=_0x3093fe-0x0;var _0x31517d=_0xfbc8[_0x3093fe];return _0x31517d;};'use strict';var multer=require(_0x8fbc('0x0'));var util=require(_0x8fbc('0x1'));var path=require('path');var timeout=require(_0x8fbc('0x2'));var express=require(_0x8fbc('0x3'));var router=express[_0x8fbc('0x4')]();var fs_extra=require(_0x8fbc('0x5'));var auth=require(_0x8fbc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8fbc('0x7'));var controller=require(_0x8fbc('0x8'));router[_0x8fbc('0x9')]('/',auth[_0x8fbc('0xa')](),controller['index']);router[_0x8fbc('0x9')](_0x8fbc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8fbc('0x9')](_0x8fbc('0xc'),auth['isAuthenticated'](),controller[_0x8fbc('0xd')]);router[_0x8fbc('0xe')]('/',auth[_0x8fbc('0xa')](),controller[_0x8fbc('0xf')]);router[_0x8fbc('0x10')](_0x8fbc('0xc'),auth[_0x8fbc('0xa')](),controller[_0x8fbc('0x11')]);router['delete'](_0x8fbc('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8fbc('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0e71b06..ac6a022 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(_0x7e9e77,_0x55562c){var _0x1ab1ea=function(_0x51076e){while(--_0x51076e){_0x7e9e77['push'](_0x7e9e77['shift']());}};_0x1ab1ea(++_0x55562c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x1bb835,_0x523123){var _0x4b3e47=function(_0x20fe77){while(--_0x20fe77){_0x1bb835['push'](_0x1bb835['shift']());}};_0x4b3e47(++_0x523123);}(_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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 866e9d5..3768ceb 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 _0x757a=['include','findAll','rows','show','params','WhatsappQueueReport','find','create','body','catch','destroy','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','end','sendStatus','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x5337d2,_0x4b79b1){var _0x4b054d=function(_0x58043f){while(--_0x58043f){_0x5337d2['push'](_0x5337d2['shift']());}};_0x4b054d(++_0x4b79b1);}(_0x757a,0xde));var _0xa757=function(_0x4ff369,_0x47a9a6){_0x4ff369=_0x4ff369-0x0;var _0x1741de=_0x757a[_0x4ff369];return _0x1741de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){_0x2ca10d['status'](0xcc)[_0xa757('0x1f')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x20')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x21')](_0xcd98bd[_0xa757('0x22')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x23')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}exports['index']=function(_0x4f8de2,_0xfdf69d){var _0x596ae2={},_0x2208f9={},_0x3bc24c={'count':0x0,'rows':[]};var _0x55c5f8=_[_0xa757('0x24')](db['WhatsappQueueReport'][_0xa757('0x25')],function(_0xa6d0f6){return{'name':_0xa6d0f6['fieldName'],'type':_0xa6d0f6[_0xa757('0x26')]['key']};});_0x2208f9[_0xa757('0x27')]=_[_0xa757('0x24')](_0x55c5f8,_0xa757('0x23'));_0x2208f9[_0xa757('0x28')]=_[_0xa757('0x29')](_0x4f8de2[_0xa757('0x28')]);_0x2208f9[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],_0x2208f9[_0xa757('0x28')]);_0x596ae2[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],qs[_0xa757('0x2d')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x2d')]));_0x596ae2[_0xa757('0x2c')]=_0x596ae2[_0xa757('0x2c')][_0xa757('0x2e')]?_0x596ae2[_0xa757('0x2c')]:_0x2208f9[_0xa757('0x27')];if(!_0x4f8de2[_0xa757('0x28')][_0xa757('0x2f')](_0xa757('0x30'))){_0x596ae2['limit']=qs[_0xa757('0x1a')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x1a')]);_0x596ae2[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4f8de2['query'][_0xa757('0x17')]);}_0x596ae2[_0xa757('0x31')]=qs[_0xa757('0x32')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x32')]);_0x596ae2[_0xa757('0x33')]=qs['filters'](_[_0xa757('0x34')](_0x4f8de2[_0xa757('0x28')],_0x2208f9[_0xa757('0x2a')]),_0x55c5f8);if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]){_0x596ae2[_0xa757('0x33')]=_[_0xa757('0x36')](_0x596ae2[_0xa757('0x33')],{'$or':_[_0xa757('0x24')](_0x55c5f8,function(_0x4f9d98){if(_0x4f9d98[_0xa757('0x26')]!==_0xa757('0x37')){var _0x9f73c6={};_0x9f73c6[_0x4f9d98[_0xa757('0x23')]]={'$like':'%'+_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]+'%'};return _0x9f73c6;}})});}_0x596ae2=_['merge']({},_0x596ae2,_0x4f8de2[_0xa757('0x38')]);var _0x6d77ed={'where':_0x596ae2['where']};return db['WhatsappQueueReport'][_0xa757('0x19')](_0x6d77ed)[_0xa757('0x1e')](function(_0x5b11fe){_0x3bc24c['count']=_0x5b11fe;if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x39')]){_0x596ae2[_0xa757('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa757('0x3b')](_0x596ae2);})[_0xa757('0x1e')](function(_0x26802c){_0x3bc24c[_0xa757('0x3c')]=_0x26802c;return _0x3bc24c;})[_0xa757('0x1e')](respondWithFilteredResult(_0xfdf69d,_0x596ae2))['catch'](handleError(_0xfdf69d,null));};exports[_0xa757('0x3d')]=function(_0x52c728,_0x564d40){var _0x43329c={'raw':!![],'where':{'id':_0x52c728[_0xa757('0x3e')]['id']}},_0x57298b={};_0x57298b[_0xa757('0x27')]=_[_0xa757('0x29')](db['WhatsappQueueReport']['rawAttributes']);_0x57298b[_0xa757('0x28')]=_[_0xa757('0x29')](_0x52c728[_0xa757('0x28')]);_0x57298b[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x57298b[_0xa757('0x27')],_0x57298b['query']);_0x43329c[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x57298b['model'],qs[_0xa757('0x2d')](_0x52c728['query'][_0xa757('0x2d')]));_0x43329c[_0xa757('0x2c')]=_0x43329c['attributes'][_0xa757('0x2e')]?_0x43329c[_0xa757('0x2c')]:_0x57298b['model'];if(_0x52c728[_0xa757('0x28')][_0xa757('0x39')]){_0x43329c[_0xa757('0x3a')]=[{'all':!![]}];}_0x43329c=_[_0xa757('0x36')]({},_0x43329c,_0x52c728['options']);return db[_0xa757('0x3f')][_0xa757('0x40')](_0x43329c)[_0xa757('0x1e')](handleEntityNotFound(_0x564d40,null))[_0xa757('0x1e')](respondWithResult(_0x564d40,null))['catch'](handleError(_0x564d40,null));};exports[_0xa757('0x41')]=function(_0x5b6017,_0x50c131){return db[_0xa757('0x3f')][_0xa757('0x41')](_0x5b6017[_0xa757('0x42')],{})['then'](respondWithResult(_0x50c131,0xc9))[_0xa757('0x43')](handleError(_0x50c131,null));};exports['update']=function(_0x2ed63f,_0x151cc3){if(_0x2ed63f[_0xa757('0x42')]['id']){delete _0x2ed63f[_0xa757('0x42')]['id'];}return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x2ed63f[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x151cc3,null))['then'](saveUpdates(_0x2ed63f[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0x151cc3,null))[_0xa757('0x43')](handleError(_0x151cc3,null));};exports[_0xa757('0x44')]=function(_0x319988,_0x1f10cf){return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x319988[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x1f10cf,null))[_0xa757('0x1e')](removeEntity(_0x1f10cf,null))[_0xa757('0x43')](handleError(_0x1f10cf,null));};exports[_0xa757('0x45')]=function(_0x354ad5,_0x388573){return db[_0xa757('0x3f')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x388573,null))['catch'](handleError(_0x388573,null));}; \ No newline at end of file +var _0xa74f=['hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','WhatsappQueueReport','include','findAll','rows','params','keys','rawAttributes','create','body','catch','find','describe','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','name','send','map','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x2f9ce2,_0x10e919){var _0x31f26c=function(_0x967d8b){while(--_0x967d8b){_0x2f9ce2['push'](_0x2f9ce2['shift']());}};_0x31f26c(++_0x10e919);}(_0xa74f,0x9a));var _0xfa74=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xa74f[_0x519c88];return _0x4668d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530f99,_0x9eb68c){return function(_0xeb6c11){if(!_0xeb6c11){_0x530f99['sendStatus'](0x194);}return _0xeb6c11;};}function handleError(_0x62e1be,_0x5d3b26){_0x5d3b26=_0x5d3b26||0x1f4;return function(_0x1a8cf7){logger[_0xfa74('0x23')](_0x1a8cf7['stack']);if(_0x1a8cf7[_0xfa74('0x24')]){delete _0x1a8cf7[_0xfa74('0x24')];}_0x62e1be[_0xfa74('0x18')](_0x5d3b26)[_0xfa74('0x25')](_0x1a8cf7);};}exports['index']=function(_0xd9c55d,_0x2f7cd7){var _0x204e01={},_0x57d90e={},_0x4d4bed={'count':0x0,'rows':[]};var _0x1322a4=_[_0xfa74('0x26')](db['WhatsappQueueReport']['rawAttributes'],function(_0x343466){return{'name':_0x343466['fieldName'],'type':_0x343466[_0xfa74('0x27')]['key']};});_0x57d90e[_0xfa74('0x28')]=_[_0xfa74('0x26')](_0x1322a4,_0xfa74('0x24'));_0x57d90e[_0xfa74('0x29')]=_['keys'](_0xd9c55d[_0xfa74('0x29')]);_0x57d90e[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x57d90e[_0xfa74('0x28')],_0x57d90e[_0xfa74('0x29')]);_0x204e01[_0xfa74('0x2c')]=_[_0xfa74('0x2b')](_0x57d90e['model'],qs[_0xfa74('0x2d')](_0xd9c55d['query'][_0xfa74('0x2d')]));_0x204e01[_0xfa74('0x2c')]=_0x204e01[_0xfa74('0x2c')][_0xfa74('0x2e')]?_0x204e01['attributes']:_0x57d90e['model'];if(!_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x2f')](_0xfa74('0x30'))){_0x204e01[_0xfa74('0x1b')]=qs['limit'](_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x1b')]);_0x204e01['offset']=qs['offset'](_0xd9c55d['query']['offset']);}_0x204e01['order']=qs[_0xfa74('0x31')](_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x31')]);_0x204e01[_0xfa74('0x32')]=qs[_0xfa74('0x2a')](_[_0xfa74('0x33')](_0xd9c55d[_0xfa74('0x29')],_0x57d90e[_0xfa74('0x2a')]),_0x1322a4);if(_0xd9c55d[_0xfa74('0x29')]['filter']){_0x204e01[_0xfa74('0x32')]=_[_0xfa74('0x34')](_0x204e01[_0xfa74('0x32')],{'$or':_[_0xfa74('0x26')](_0x1322a4,function(_0x42fc31){if(_0x42fc31[_0xfa74('0x27')]!=='VIRTUAL'){var _0x4307be={};_0x4307be[_0x42fc31[_0xfa74('0x24')]]={'$like':'%'+_0xd9c55d[_0xfa74('0x29')][_0xfa74('0x35')]+'%'};return _0x4307be;}})});}_0x204e01=_['merge']({},_0x204e01,_0xd9c55d[_0xfa74('0x36')]);var _0x13d9a5={'where':_0x204e01[_0xfa74('0x32')]};return db[_0xfa74('0x37')]['count'](_0x13d9a5)[_0xfa74('0x22')](function(_0x1f7023){_0x4d4bed[_0xfa74('0x1c')]=_0x1f7023;if(_0xd9c55d['query']['includeAll']){_0x204e01[_0xfa74('0x38')]=[{'all':!![]}];}return db[_0xfa74('0x37')][_0xfa74('0x39')](_0x204e01);})[_0xfa74('0x22')](function(_0x55f4e3){_0x4d4bed[_0xfa74('0x3a')]=_0x55f4e3;return _0x4d4bed;})[_0xfa74('0x22')](respondWithFilteredResult(_0x2f7cd7,_0x204e01))['catch'](handleError(_0x2f7cd7,null));};exports['show']=function(_0x523b25,_0x492c7d){var _0x95c891={'raw':!![],'where':{'id':_0x523b25[_0xfa74('0x3b')]['id']}},_0x3098ca={};_0x3098ca[_0xfa74('0x28')]=_[_0xfa74('0x3c')](db[_0xfa74('0x37')][_0xfa74('0x3d')]);_0x3098ca['query']=_[_0xfa74('0x3c')](_0x523b25[_0xfa74('0x29')]);_0x3098ca[_0xfa74('0x2a')]=_[_0xfa74('0x2b')](_0x3098ca[_0xfa74('0x28')],_0x3098ca['query']);_0x95c891[_0xfa74('0x2c')]=_[_0xfa74('0x2b')](_0x3098ca[_0xfa74('0x28')],qs[_0xfa74('0x2d')](_0x523b25[_0xfa74('0x29')][_0xfa74('0x2d')]));_0x95c891[_0xfa74('0x2c')]=_0x95c891[_0xfa74('0x2c')][_0xfa74('0x2e')]?_0x95c891[_0xfa74('0x2c')]:_0x3098ca['model'];if(_0x523b25[_0xfa74('0x29')]['includeAll']){_0x95c891[_0xfa74('0x38')]=[{'all':!![]}];}_0x95c891=_[_0xfa74('0x34')]({},_0x95c891,_0x523b25[_0xfa74('0x36')]);return db[_0xfa74('0x37')]['find'](_0x95c891)[_0xfa74('0x22')](handleEntityNotFound(_0x492c7d,null))[_0xfa74('0x22')](respondWithResult(_0x492c7d,null))['catch'](handleError(_0x492c7d,null));};exports[_0xfa74('0x3e')]=function(_0x2f9755,_0x5cbb70){return db[_0xfa74('0x37')][_0xfa74('0x3e')](_0x2f9755[_0xfa74('0x3f')],{})[_0xfa74('0x22')](respondWithResult(_0x5cbb70,0xc9))[_0xfa74('0x40')](handleError(_0x5cbb70,null));};exports['update']=function(_0x54e06c,_0x36f6ca){if(_0x54e06c[_0xfa74('0x3f')]['id']){delete _0x54e06c['body']['id'];}return db[_0xfa74('0x37')][_0xfa74('0x41')]({'where':{'id':_0x54e06c[_0xfa74('0x3b')]['id']}})['then'](handleEntityNotFound(_0x36f6ca,null))['then'](saveUpdates(_0x54e06c[_0xfa74('0x3f')],null))[_0xfa74('0x22')](respondWithResult(_0x36f6ca,null))[_0xfa74('0x40')](handleError(_0x36f6ca,null));};exports[_0xfa74('0x21')]=function(_0x36508a,_0x3cb23d){return db[_0xfa74('0x37')][_0xfa74('0x41')]({'where':{'id':_0x36508a['params']['id']}})[_0xfa74('0x22')](handleEntityNotFound(_0x3cb23d,null))[_0xfa74('0x22')](removeEntity(_0x3cb23d,null))[_0xfa74('0x40')](handleError(_0x3cb23d,null));};exports[_0xfa74('0x42')]=function(_0x569801,_0x4ec218){return db[_0xfa74('0x37')]['describe']()[_0xfa74('0x22')](respondWithResult(_0x4ec218,null))[_0xfa74('0x40')](handleError(_0x4ec218,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c9110c5..aa7e324 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 _0xe989=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x4b017a,_0x171787){var _0x19c799=function(_0x306583){while(--_0x306583){_0x4b017a['push'](_0x4b017a['shift']());}};_0x19c799(++_0x171787);}(_0xe989,0x9c));var _0x9e98=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0xe989[_0xc9b988];return _0x5f14fe;};'use strict';var _=require(_0x9e98('0x0'));var util=require(_0x9e98('0x1'));var logger=require(_0x9e98('0x2'))(_0x9e98('0x3'));var moment=require(_0x9e98('0x4'));var BPromise=require(_0x9e98('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e98('0x6'));var rimraf=require(_0x9e98('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e98('0x8'));module[_0x9e98('0x9')]=function(_0x106746,_0x27d849){return _0x106746[_0x9e98('0xa')](_0x9e98('0xb'),attributes,{'tableName':_0x9e98('0xc'),'paranoid':![],'indexes':[{'name':_0x9e98('0xd'),'fields':[_0x9e98('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x919f=['request-promise','rimraf','../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','moment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x919f,0xed));var _0xf919=function(_0x2b73e0,_0x3c09f2){_0x2b73e0=_0x2b73e0-0x0;var _0x1906a8=_0x919f[_0x2b73e0];return _0x1906a8;};'use strict';var _=require(_0xf919('0x0'));var util=require('util');var logger=require(_0xf919('0x1'))('api');var moment=require(_0xf919('0x2'));var BPromise=require('bluebird');var rp=require(_0xf919('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf919('0x4'));var config=require(_0xf919('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0xf919('0x6')]=function(_0x1a5321,_0x579f61){return _0x1a5321[_0xf919('0x7')]('WhatsappQueueReport',attributes,{'tableName':_0xf919('0x8'),'paranoid':![],'indexes':[{'name':_0xf919('0x9'),'fields':[_0xf919('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 81a283d..ccac45f 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 _0x7562=['info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','raw','then','debug','UpdateWhatsappQueueReport','update','options','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e6d4d,_0x2c9389){var _0x425cc4=function(_0x27c4e4){while(--_0x27c4e4){_0x3e6d4d['push'](_0x3e6d4d['shift']());}};_0x425cc4(++_0x2c9389);}(_0x7562,0x1a0));var _0x2756=function(_0x3caccc,_0x43d12c){_0x3caccc=_0x3caccc-0x0;var _0x2c2c0f=_0x7562[_0x3caccc];return _0x2c2c0f;};'use strict';var _=require(_0x2756('0x0'));var util=require(_0x2756('0x1'));var moment=require(_0x2756('0x2'));var BPromise=require(_0x2756('0x3'));var rs=require(_0x2756('0x4'));var fs=require('fs');var Redis=require(_0x2756('0x5'));var db=require(_0x2756('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2756('0x7'))(_0x2756('0x8'));var config=require(_0x2756('0x9'));var jayson=require(_0x2756('0xa'));var client=jayson[_0x2756('0xb')][_0x2756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b58dc,_0x535f4f,_0x458f48){return new BPromise(function(_0x14eeb3,_0xe111fe){return client['request'](_0x3b58dc,_0x458f48)['then'](function(_0x43f9c2){logger[_0x2756('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x2756('0xe'));logger['debug'](_0x2756('0xf'),_0x535f4f,_0x2756('0xe'),JSON[_0x2756('0x10')](_0x43f9c2));if(_0x43f9c2['error']){if(_0x43f9c2[_0x2756('0x11')][_0x2756('0x12')]===0x1f4){logger[_0x2756('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);return _0xe111fe(_0x43f9c2[_0x2756('0x11')]['message']);}logger[_0x2756('0x11')](_0x2756('0x14'),_0x535f4f,_0x43f9c2[_0x2756('0x11')]['message']);return _0x14eeb3(_0x43f9c2[_0x2756('0x11')][_0x2756('0x13')]);}else{logger['info'](_0x2756('0x14'),_0x535f4f,_0x2756('0xe'));_0x14eeb3(_0x43f9c2[_0x2756('0x15')]['message']);}})[_0x2756('0x16')](function(_0x160089){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x535f4f,_0x160089);_0xe111fe(_0x160089);});});}exports[_0x2756('0x17')]=function(_0x4591eb){var _0x44ba45=this;return new Promise(function(_0xcf8ab0,_0x70f40a){return db[_0x2756('0x18')][_0x2756('0x19')](_0x4591eb['body'],{'raw':_0x4591eb['options']?_0x4591eb['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![]})[_0x2756('0x1b')](function(_0x2d8d34){logger[_0x2756('0xd')]('CreateWhatsappQueueReport',_0x4591eb);logger[_0x2756('0x1c')](_0x2756('0x17'),_0x4591eb,JSON[_0x2756('0x10')](_0x2d8d34));_0xcf8ab0(_0x2d8d34);})[_0x2756('0x16')](function(_0x24b0af){logger['error'](_0x2756('0x17'),_0x24b0af['message'],_0x4591eb);_0x70f40a(_0x44ba45['error'](0x1f4,_0x24b0af[_0x2756('0x13')]));});});};exports[_0x2756('0x1d')]=function(_0x34270d){var _0x2100a2=this;return new Promise(function(_0x5c11bb,_0xbcb050){return db[_0x2756('0x18')][_0x2756('0x1e')](_0x34270d['body'],{'raw':_0x34270d[_0x2756('0x1f')]?_0x34270d['options'][_0x2756('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')]['where']||null:null,'attributes':_0x34270d[_0x2756('0x1f')]?_0x34270d[_0x2756('0x1f')][_0x2756('0x20')]||null:null,'limit':_0x34270d['options']?_0x34270d[_0x2756('0x1f')]['limit']||null:null})[_0x2756('0x1b')](function(_0x832aa3){logger[_0x2756('0xd')](_0x2756('0x1d'),_0x34270d);logger['debug'](_0x2756('0x1d'),_0x34270d,JSON[_0x2756('0x10')](_0x832aa3));_0x5c11bb(_0x832aa3);})[_0x2756('0x16')](function(_0x2e53c1){logger[_0x2756('0x11')](_0x2756('0x1d'),_0x2e53c1[_0x2756('0x13')],_0x34270d);_0xbcb050(_0x2100a2[_0x2756('0x11')](0x1f4,_0x2e53c1[_0x2756('0x13')]));});});}; \ No newline at end of file +var _0xae66=['message','result','CreateWhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x5dc23b,_0x9516f9){var _0x1d720b=function(_0x19725f){while(--_0x19725f){_0x5dc23b['push'](_0x5dc23b['shift']());}};_0x1d720b(++_0x9516f9);}(_0xae66,0x11d));var _0x6ae6=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xae66[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x6ae6('0x0'));var moment=require(_0x6ae6('0x1'));var BPromise=require(_0x6ae6('0x2'));var rs=require(_0x6ae6('0x3'));var fs=require('fs');var Redis=require(_0x6ae6('0x4'));var db=require(_0x6ae6('0x5'))['db'];var utils=require(_0x6ae6('0x6'));var logger=require(_0x6ae6('0x7'))('rpc');var config=require(_0x6ae6('0x8'));var jayson=require(_0x6ae6('0x9'));var client=jayson[_0x6ae6('0xa')][_0x6ae6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ff0eb,_0x309af0,_0x175e04){return new BPromise(function(_0x150807,_0x2b6f91){return client[_0x6ae6('0xc')](_0x4ff0eb,_0x175e04)['then'](function(_0x1159ba){logger[_0x6ae6('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x309af0,_0x6ae6('0xe'));logger[_0x6ae6('0xf')](_0x6ae6('0x10'),_0x309af0,_0x6ae6('0xe'),JSON[_0x6ae6('0x11')](_0x1159ba));if(_0x1159ba['error']){if(_0x1159ba[_0x6ae6('0x12')][_0x6ae6('0x13')]===0x1f4){logger[_0x6ae6('0x12')](_0x6ae6('0x14'),_0x309af0,_0x1159ba[_0x6ae6('0x12')][_0x6ae6('0x15')]);return _0x2b6f91(_0x1159ba['error']['message']);}logger[_0x6ae6('0x12')](_0x6ae6('0x14'),_0x309af0,_0x1159ba[_0x6ae6('0x12')][_0x6ae6('0x15')]);return _0x150807(_0x1159ba['error'][_0x6ae6('0x15')]);}else{logger[_0x6ae6('0xd')](_0x6ae6('0x14'),_0x309af0,_0x6ae6('0xe'));_0x150807(_0x1159ba[_0x6ae6('0x16')]['message']);}})['catch'](function(_0xf76c1){logger[_0x6ae6('0x12')](_0x6ae6('0x14'),_0x309af0,_0xf76c1);_0x2b6f91(_0xf76c1);});});}exports[_0x6ae6('0x17')]=function(_0x5e8831){var _0x2418ea=this;return new Promise(function(_0x27505c,_0x16e804){return db['WhatsappQueueReport'][_0x6ae6('0x18')](_0x5e8831[_0x6ae6('0x19')],{'raw':_0x5e8831[_0x6ae6('0x1a')]?_0x5e8831[_0x6ae6('0x1a')][_0x6ae6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xe4c960){logger[_0x6ae6('0xd')]('CreateWhatsappQueueReport',_0x5e8831);logger[_0x6ae6('0xf')]('CreateWhatsappQueueReport',_0x5e8831,JSON[_0x6ae6('0x11')](_0xe4c960));_0x27505c(_0xe4c960);})[_0x6ae6('0x1c')](function(_0x1742cb){logger[_0x6ae6('0x12')](_0x6ae6('0x17'),_0x1742cb[_0x6ae6('0x15')],_0x5e8831);_0x16e804(_0x2418ea['error'](0x1f4,_0x1742cb['message']));});});};exports[_0x6ae6('0x1d')]=function(_0x5b51a0){var _0x10c5e0=this;return new Promise(function(_0x5006ed,_0x3c742c){return db[_0x6ae6('0x1e')][_0x6ae6('0x1f')](_0x5b51a0[_0x6ae6('0x19')],{'raw':_0x5b51a0[_0x6ae6('0x1a')]?_0x5b51a0['options'][_0x6ae6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b51a0[_0x6ae6('0x1a')]?_0x5b51a0[_0x6ae6('0x1a')]['where']||null:null,'attributes':_0x5b51a0[_0x6ae6('0x1a')]?_0x5b51a0[_0x6ae6('0x1a')][_0x6ae6('0x20')]||null:null,'limit':_0x5b51a0[_0x6ae6('0x1a')]?_0x5b51a0[_0x6ae6('0x1a')]['limit']||null:null})[_0x6ae6('0x21')](function(_0x49bab4){logger[_0x6ae6('0xd')](_0x6ae6('0x1d'),_0x5b51a0);logger[_0x6ae6('0xf')]('UpdateWhatsappQueueReport',_0x5b51a0,JSON[_0x6ae6('0x11')](_0x49bab4));_0x5006ed(_0x49bab4);})[_0x6ae6('0x1c')](function(_0x36c0aa){logger[_0x6ae6('0x12')](_0x6ae6('0x1d'),_0x36c0aa[_0x6ae6('0x15')],_0x5b51a0);_0x3c742c(_0x10c5e0[_0x6ae6('0x12')](0x1f4,_0x36c0aa[_0x6ae6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 215cedc..85b0463 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 _0xcebe=['index','/describe','/:id','show','post','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x2b6361,_0xe212f8){var _0x3fe110=function(_0x28eec7){while(--_0x28eec7){_0x2b6361['push'](_0x2b6361['shift']());}};_0x3fe110(++_0xe212f8);}(_0xcebe,0x85));var _0xeceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcebe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xeceb('0x0'));var util=require(_0xeceb('0x1'));var path=require(_0xeceb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeceb('0x3')]();var fs_extra=require(_0xeceb('0x4'));var auth=require(_0xeceb('0x5'));var interaction=require(_0xeceb('0x6'));var config=require(_0xeceb('0x7'));var controller=require(_0xeceb('0x8'));router[_0xeceb('0x9')]('/',auth[_0xeceb('0xa')](),controller[_0xeceb('0xb')]);router[_0xeceb('0x9')](_0xeceb('0xc'),auth[_0xeceb('0xa')](),controller['describe']);router[_0xeceb('0x9')](_0xeceb('0xd'),auth[_0xeceb('0xa')](),controller[_0xeceb('0xe')]);router[_0xeceb('0xf')]('/',auth[_0xeceb('0xa')](),controller['create']);router['put'](_0xeceb('0xd'),auth['isAuthenticated'](),controller[_0xeceb('0x10')]);router['delete']('/:id',auth[_0xeceb('0xa')](),controller['destroy']);module[_0xeceb('0x11')]=router; \ No newline at end of file +var _0x9605=['/describe','describe','/:id','show','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x9605,0x74));var _0x5960=function(_0x4bfc6e,_0x2dfc35){_0x4bfc6e=_0x4bfc6e-0x0;var _0x3fb52d=_0x9605[_0x4bfc6e];return _0x3fb52d;};'use strict';var multer=require('multer');var util=require(_0x5960('0x0'));var path=require('path');var timeout=require(_0x5960('0x1'));var express=require('express');var router=express[_0x5960('0x2')]();var fs_extra=require(_0x5960('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5960('0x4'));var config=require(_0x5960('0x5'));var controller=require(_0x5960('0x6'));router[_0x5960('0x7')]('/',auth[_0x5960('0x8')](),controller[_0x5960('0x9')]);router[_0x5960('0x7')](_0x5960('0xa'),auth['isAuthenticated'](),controller[_0x5960('0xb')]);router[_0x5960('0x7')](_0x5960('0xc'),auth[_0x5960('0x8')](),controller[_0x5960('0xd')]);router['post']('/',auth[_0x5960('0x8')](),controller['create']);router[_0x5960('0xe')](_0x5960('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5960('0xf')](_0x5960('0xc'),auth['isAuthenticated'](),controller[_0x5960('0x10')]);module[_0x5960('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7855fcd..265b1ad 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 _0x110f=['agent','DATE','sequelize','exports'];(function(_0x106ad9,_0x5d9dd4){var _0x56f33f=function(_0x27debf){while(--_0x27debf){_0x106ad9['push'](_0x106ad9['shift']());}};_0x56f33f(++_0x5d9dd4);}(_0x110f,0x1e6));var _0xf110=function(_0x3e78cf,_0x39e5e6){_0x3e78cf=_0x3e78cf-0x0;var _0x37cefe=_0x110f[_0x3e78cf];return _0x37cefe;};'use strict';var Sequelize=require(_0xf110('0x0'));module[_0xf110('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xf110('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf110('0x3')]}}; \ No newline at end of file +var _0x8ba6=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x46a00c,_0x57cd8a){var _0x247873=function(_0x4edc83){while(--_0x4edc83){_0x46a00c['push'](_0x46a00c['shift']());}};_0x247873(++_0x57cd8a);}(_0x8ba6,0x11b));var _0x68ba=function(_0x86e759,_0x90c0be){_0x86e759=_0x86e759-0x0;var _0x49d990=_0x8ba6[_0x86e759];return _0x49d990;};'use strict';var Sequelize=require(_0x68ba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x68ba('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x68ba('0x2'),_0x68ba('0x3'),_0x68ba('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x68ba('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a44822c..3089ab7 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 _0x1ed7=['undefined','count','limit','set','apply','save','update','destroy','then','error','name','index','WhatsappTransferReport','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x31893f,_0x59d5b1){var _0x4364d2=function(_0x402945){while(--_0x402945){_0x31893f['push'](_0x31893f['shift']());}};_0x4364d2(++_0x59d5b1);}(_0x1ed7,0x6e));var _0x71ed=function(_0x45f143,_0x42ba90){_0x45f143=_0x45f143-0x0;var _0x898312=_0x1ed7[_0x45f143];return _0x898312;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71ed('0x0'));var rp=require(_0x71ed('0x1'));var moment=require(_0x71ed('0x2'));var BPromise=require(_0x71ed('0x3'));var Mustache=require(_0x71ed('0x4'));var util=require('util');var path=require(_0x71ed('0x5'));var sox=require(_0x71ed('0x6'));var csv=require(_0x71ed('0x7'));var ejs=require(_0x71ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x71ed('0x9'));var crypto=require(_0x71ed('0xa'));var jsforce=require(_0x71ed('0xb'));var deskjs=require(_0x71ed('0xc'));var toCsv=require(_0x71ed('0x7'));var querystring=require(_0x71ed('0xd'));var Papa=require('papaparse');var Redis=require(_0x71ed('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x71ed('0xf'));var as=require(_0x71ed('0x10'));var hardwareService=require(_0x71ed('0x11'));var logger=require(_0x71ed('0x12'))(_0x71ed('0x13'));var utils=require(_0x71ed('0x14'));var config=require(_0x71ed('0x15'));var licenseUtil=require(_0x71ed('0x16'));var db=require(_0x71ed('0x17'))['db'];function respondWithStatusCode(_0x5f26e3,_0x363084){_0x363084=_0x363084||0xcc;return function(_0x5b40e8){if(_0x5b40e8){return _0x5f26e3[_0x71ed('0x18')](_0x363084);}return _0x5f26e3[_0x71ed('0x19')](_0x363084)['end']();};}function respondWithResult(_0x40557e,_0x16bc2c){_0x16bc2c=_0x16bc2c||0xc8;return function(_0x53d5e0){if(_0x53d5e0){return _0x40557e['status'](_0x16bc2c)[_0x71ed('0x1a')](_0x53d5e0);}};}function respondWithFilteredResult(_0xe01160,_0x26595e){return function(_0x43eb51){if(_0x43eb51){var _0x4b9b72=typeof _0x26595e[_0x71ed('0x1b')]===_0x71ed('0x1c')&&typeof _0x26595e['limit']===_0x71ed('0x1c');var _0x1c0585=_0x43eb51['count'];var _0x4a9f42=_0x4b9b72?0x0:_0x26595e['offset'];var _0x1ce561=_0x4b9b72?_0x43eb51[_0x71ed('0x1d')]:_0x26595e['offset']+_0x26595e[_0x71ed('0x1e')];var _0x255776;if(_0x1ce561>=_0x1c0585){_0x1ce561=_0x1c0585;_0x255776=0xc8;}else{_0x255776=0xce;}_0xe01160[_0x71ed('0x19')](_0x255776);return _0xe01160[_0x71ed('0x1f')]('Content-Range',_0x4a9f42+'-'+_0x1ce561+'/'+_0x1c0585)[_0x71ed('0x1a')](_0x43eb51);}return null;};}function patchUpdates(_0x500c40){return function(_0x24edf7){try{jsonpatch[_0x71ed('0x20')](_0x24edf7,_0x500c40,!![]);}catch(_0x5a41e5){return BPromise['reject'](_0x5a41e5);}return _0x24edf7[_0x71ed('0x21')]();};}function saveUpdates(_0x3f4fac,_0x134e37){return function(_0x5a1c85){if(_0x5a1c85){return _0x5a1c85[_0x71ed('0x22')](_0x3f4fac)['then'](function(_0x3b9775){return _0x3b9775;});}return null;};}function removeEntity(_0x243da8,_0x5a953e){return function(_0x22cfbb){if(_0x22cfbb){return _0x22cfbb[_0x71ed('0x23')]()[_0x71ed('0x24')](function(){_0x243da8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb01ddd,_0x125065){return function(_0x1472ac){if(!_0x1472ac){_0xb01ddd[_0x71ed('0x18')](0x194);}return _0x1472ac;};}function handleError(_0x4afd64,_0x2a72c6){_0x2a72c6=_0x2a72c6||0x1f4;return function(_0x57b5b3){logger[_0x71ed('0x25')](_0x57b5b3['stack']);if(_0x57b5b3[_0x71ed('0x26')]){delete _0x57b5b3[_0x71ed('0x26')];}_0x4afd64['status'](_0x2a72c6)['send'](_0x57b5b3);};}exports[_0x71ed('0x27')]=function(_0xff59b8,_0x3223d7){var _0x22acb4={},_0x4fb283={},_0x503e00={'count':0x0,'rows':[]};var _0x36ccba=_['map'](db[_0x71ed('0x28')]['rawAttributes'],function(_0x36b7c3){return{'name':_0x36b7c3[_0x71ed('0x29')],'type':_0x36b7c3[_0x71ed('0x2a')][_0x71ed('0x2b')]};});_0x4fb283['model']=_[_0x71ed('0x2c')](_0x36ccba,_0x71ed('0x26'));_0x4fb283['query']=_[_0x71ed('0x2d')](_0xff59b8[_0x71ed('0x2e')]);_0x4fb283[_0x71ed('0x2f')]=_[_0x71ed('0x30')](_0x4fb283[_0x71ed('0x31')],_0x4fb283[_0x71ed('0x2e')]);_0x22acb4[_0x71ed('0x32')]=_[_0x71ed('0x30')](_0x4fb283['model'],qs[_0x71ed('0x33')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x33')]));_0x22acb4['attributes']=_0x22acb4[_0x71ed('0x32')][_0x71ed('0x34')]?_0x22acb4[_0x71ed('0x32')]:_0x4fb283['model'];if(!_0xff59b8[_0x71ed('0x2e')]['hasOwnProperty']('nolimit')){_0x22acb4[_0x71ed('0x1e')]=qs[_0x71ed('0x1e')](_0xff59b8[_0x71ed('0x2e')]['limit']);_0x22acb4[_0x71ed('0x1b')]=qs[_0x71ed('0x1b')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x1b')]);}_0x22acb4['order']=qs[_0x71ed('0x35')](_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x35')]);_0x22acb4[_0x71ed('0x36')]=qs['filters'](_['pick'](_0xff59b8['query'],_0x4fb283[_0x71ed('0x2f')]),_0x36ccba);if(_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x37')]){_0x22acb4[_0x71ed('0x36')]=_[_0x71ed('0x38')](_0x22acb4[_0x71ed('0x36')],{'$or':_[_0x71ed('0x2c')](_0x36ccba,function(_0x530d20){if(_0x530d20['type']!==_0x71ed('0x39')){var _0x301fde={};_0x301fde[_0x530d20[_0x71ed('0x26')]]={'$like':'%'+_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x37')]+'%'};return _0x301fde;}})});}_0x22acb4=_['merge']({},_0x22acb4,_0xff59b8[_0x71ed('0x3a')]);var _0x404383={'where':_0x22acb4['where']};return db[_0x71ed('0x28')][_0x71ed('0x1d')](_0x404383)[_0x71ed('0x24')](function(_0x1387be){_0x503e00[_0x71ed('0x1d')]=_0x1387be;if(_0xff59b8[_0x71ed('0x2e')][_0x71ed('0x3b')]){_0x22acb4[_0x71ed('0x3c')]=[{'all':!![]}];}return db[_0x71ed('0x28')][_0x71ed('0x3d')](_0x22acb4);})['then'](function(_0x17d0dc){_0x503e00['rows']=_0x17d0dc;return _0x503e00;})[_0x71ed('0x24')](respondWithFilteredResult(_0x3223d7,_0x22acb4))[_0x71ed('0x3e')](handleError(_0x3223d7,null));};exports[_0x71ed('0x3f')]=function(_0x530645,_0x18d389){var _0x2fb2e1={'raw':!![],'where':{'id':_0x530645[_0x71ed('0x40')]['id']}},_0x5a3ae3={};_0x5a3ae3[_0x71ed('0x31')]=_['keys'](db[_0x71ed('0x28')][_0x71ed('0x41')]);_0x5a3ae3['query']=_[_0x71ed('0x2d')](_0x530645[_0x71ed('0x2e')]);_0x5a3ae3['filters']=_[_0x71ed('0x30')](_0x5a3ae3['model'],_0x5a3ae3['query']);_0x2fb2e1['attributes']=_[_0x71ed('0x30')](_0x5a3ae3[_0x71ed('0x31')],qs[_0x71ed('0x33')](_0x530645['query'][_0x71ed('0x33')]));_0x2fb2e1[_0x71ed('0x32')]=_0x2fb2e1[_0x71ed('0x32')][_0x71ed('0x34')]?_0x2fb2e1[_0x71ed('0x32')]:_0x5a3ae3[_0x71ed('0x31')];if(_0x530645[_0x71ed('0x2e')]['includeAll']){_0x2fb2e1[_0x71ed('0x3c')]=[{'all':!![]}];}_0x2fb2e1=_[_0x71ed('0x38')]({},_0x2fb2e1,_0x530645[_0x71ed('0x3a')]);return db['WhatsappTransferReport'][_0x71ed('0x42')](_0x2fb2e1)[_0x71ed('0x24')](handleEntityNotFound(_0x18d389,null))['then'](respondWithResult(_0x18d389,null))[_0x71ed('0x3e')](handleError(_0x18d389,null));};exports['create']=function(_0x3fefb7,_0x56f995){return db[_0x71ed('0x28')]['create'](_0x3fefb7[_0x71ed('0x43')],{})[_0x71ed('0x24')](respondWithResult(_0x56f995,0xc9))['catch'](handleError(_0x56f995,null));};exports['update']=function(_0x2307ac,_0x3d55a3){if(_0x2307ac[_0x71ed('0x43')]['id']){delete _0x2307ac[_0x71ed('0x43')]['id'];}return db[_0x71ed('0x28')][_0x71ed('0x42')]({'where':{'id':_0x2307ac[_0x71ed('0x40')]['id']}})[_0x71ed('0x24')](handleEntityNotFound(_0x3d55a3,null))[_0x71ed('0x24')](saveUpdates(_0x2307ac['body'],null))[_0x71ed('0x24')](respondWithResult(_0x3d55a3,null))[_0x71ed('0x3e')](handleError(_0x3d55a3,null));};exports['destroy']=function(_0x93e7df,_0x171914){return db[_0x71ed('0x28')][_0x71ed('0x42')]({'where':{'id':_0x93e7df['params']['id']}})[_0x71ed('0x24')](handleEntityNotFound(_0x171914,null))['then'](removeEntity(_0x171914,null))['catch'](handleError(_0x171914,null));};exports[_0x71ed('0x44')]=function(_0x13e64d,_0x174e48){return db[_0x71ed('0x28')][_0x71ed('0x44')]()[_0x71ed('0x24')](respondWithResult(_0x174e48,null))[_0x71ed('0x3e')](handleError(_0x174e48,null));}; \ No newline at end of file +var _0x2577=['count','set','Content-Range','apply','save','update','then','destroy','stack','name','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','WhatsappTransferReport','includeAll','include','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','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'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x2577,0x1e6));var _0x7257=function(_0x8359b,_0x42cbf9){_0x8359b=_0x8359b-0x0;var _0x1d3c4b=_0x2577[_0x8359b];return _0x1d3c4b;};'use strict';var emlformat=require(_0x7257('0x0'));var rimraf=require(_0x7257('0x1'));var zipdir=require(_0x7257('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7257('0x3'));var moment=require('moment');var BPromise=require(_0x7257('0x4'));var Mustache=require(_0x7257('0x5'));var util=require(_0x7257('0x6'));var path=require(_0x7257('0x7'));var sox=require(_0x7257('0x8'));var csv=require(_0x7257('0x9'));var ejs=require(_0x7257('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7257('0xb'));var crypto=require(_0x7257('0xc'));var jsforce=require(_0x7257('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7257('0x9'));var querystring=require('querystring');var Papa=require(_0x7257('0xe'));var Redis=require(_0x7257('0xf'));var authService=require(_0x7257('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7257('0x11'));var hardwareService=require(_0x7257('0x12'));var logger=require(_0x7257('0x13'))(_0x7257('0x14'));var utils=require(_0x7257('0x15'));var config=require(_0x7257('0x16'));var licenseUtil=require(_0x7257('0x17'));var db=require(_0x7257('0x18'))['db'];function respondWithStatusCode(_0x131944,_0x47e556){_0x47e556=_0x47e556||0xcc;return function(_0x842261){if(_0x842261){return _0x131944[_0x7257('0x19')](_0x47e556);}return _0x131944[_0x7257('0x1a')](_0x47e556)[_0x7257('0x1b')]();};}function respondWithResult(_0x141949,_0x1499de){_0x1499de=_0x1499de||0xc8;return function(_0x55a2f9){if(_0x55a2f9){return _0x141949[_0x7257('0x1a')](_0x1499de)[_0x7257('0x1c')](_0x55a2f9);}};}function respondWithFilteredResult(_0x203e00,_0x426683){return function(_0x439ba3){if(_0x439ba3){var _0x51f7d8=typeof _0x426683[_0x7257('0x1d')]===_0x7257('0x1e')&&typeof _0x426683[_0x7257('0x1f')]===_0x7257('0x1e');var _0x16524f=_0x439ba3['count'];var _0x5a44b1=_0x51f7d8?0x0:_0x426683['offset'];var _0x5d2036=_0x51f7d8?_0x439ba3[_0x7257('0x20')]:_0x426683[_0x7257('0x1d')]+_0x426683[_0x7257('0x1f')];var _0x2dd7af;if(_0x5d2036>=_0x16524f){_0x5d2036=_0x16524f;_0x2dd7af=0xc8;}else{_0x2dd7af=0xce;}_0x203e00[_0x7257('0x1a')](_0x2dd7af);return _0x203e00[_0x7257('0x21')](_0x7257('0x22'),_0x5a44b1+'-'+_0x5d2036+'/'+_0x16524f)[_0x7257('0x1c')](_0x439ba3);}return null;};}function patchUpdates(_0x322d38){return function(_0x1e7496){try{jsonpatch[_0x7257('0x23')](_0x1e7496,_0x322d38,!![]);}catch(_0x2c0340){return BPromise['reject'](_0x2c0340);}return _0x1e7496[_0x7257('0x24')]();};}function saveUpdates(_0x4af539,_0x159f17){return function(_0x1f92d3){if(_0x1f92d3){return _0x1f92d3[_0x7257('0x25')](_0x4af539)[_0x7257('0x26')](function(_0x454db2){return _0x454db2;});}return null;};}function removeEntity(_0x466239,_0x251ea9){return function(_0x22168d){if(_0x22168d){return _0x22168d[_0x7257('0x27')]()[_0x7257('0x26')](function(){_0x466239[_0x7257('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13316a,_0x2d2c1d){return function(_0xf33d96){if(!_0xf33d96){_0x13316a['sendStatus'](0x194);}return _0xf33d96;};}function handleError(_0x4c101b,_0x46ae4b){_0x46ae4b=_0x46ae4b||0x1f4;return function(_0x6b4e72){logger['error'](_0x6b4e72[_0x7257('0x28')]);if(_0x6b4e72[_0x7257('0x29')]){delete _0x6b4e72[_0x7257('0x29')];}_0x4c101b['status'](_0x46ae4b)['send'](_0x6b4e72);};}exports['index']=function(_0xbc3e22,_0x2badba){var _0x3e5a56={},_0x1d44f1={},_0x58530d={'count':0x0,'rows':[]};var _0xdf4bd4=_['map'](db['WhatsappTransferReport'][_0x7257('0x2a')],function(_0x1d9a83){return{'name':_0x1d9a83['fieldName'],'type':_0x1d9a83[_0x7257('0x2b')][_0x7257('0x2c')]};});_0x1d44f1[_0x7257('0x2d')]=_['map'](_0xdf4bd4,_0x7257('0x29'));_0x1d44f1[_0x7257('0x2e')]=_[_0x7257('0x2f')](_0xbc3e22[_0x7257('0x2e')]);_0x1d44f1[_0x7257('0x30')]=_[_0x7257('0x31')](_0x1d44f1[_0x7257('0x2d')],_0x1d44f1[_0x7257('0x2e')]);_0x3e5a56[_0x7257('0x32')]=_[_0x7257('0x31')](_0x1d44f1[_0x7257('0x2d')],qs[_0x7257('0x33')](_0xbc3e22['query'][_0x7257('0x33')]));_0x3e5a56[_0x7257('0x32')]=_0x3e5a56[_0x7257('0x32')][_0x7257('0x34')]?_0x3e5a56['attributes']:_0x1d44f1[_0x7257('0x2d')];if(!_0xbc3e22[_0x7257('0x2e')][_0x7257('0x35')](_0x7257('0x36'))){_0x3e5a56['limit']=qs[_0x7257('0x1f')](_0xbc3e22[_0x7257('0x2e')]['limit']);_0x3e5a56['offset']=qs[_0x7257('0x1d')](_0xbc3e22[_0x7257('0x2e')][_0x7257('0x1d')]);}_0x3e5a56[_0x7257('0x37')]=qs[_0x7257('0x38')](_0xbc3e22[_0x7257('0x2e')][_0x7257('0x38')]);_0x3e5a56[_0x7257('0x39')]=qs[_0x7257('0x30')](_[_0x7257('0x3a')](_0xbc3e22[_0x7257('0x2e')],_0x1d44f1[_0x7257('0x30')]),_0xdf4bd4);if(_0xbc3e22['query'][_0x7257('0x3b')]){_0x3e5a56[_0x7257('0x39')]=_['merge'](_0x3e5a56['where'],{'$or':_[_0x7257('0x3c')](_0xdf4bd4,function(_0x2944b7){if(_0x2944b7[_0x7257('0x2b')]!==_0x7257('0x3d')){var _0x21c694={};_0x21c694[_0x2944b7['name']]={'$like':'%'+_0xbc3e22[_0x7257('0x2e')][_0x7257('0x3b')]+'%'};return _0x21c694;}})});}_0x3e5a56=_[_0x7257('0x3e')]({},_0x3e5a56,_0xbc3e22[_0x7257('0x3f')]);var _0x2d577e={'where':_0x3e5a56[_0x7257('0x39')]};return db[_0x7257('0x40')]['count'](_0x2d577e)[_0x7257('0x26')](function(_0x3603e2){_0x58530d[_0x7257('0x20')]=_0x3603e2;if(_0xbc3e22[_0x7257('0x2e')][_0x7257('0x41')]){_0x3e5a56[_0x7257('0x42')]=[{'all':!![]}];}return db[_0x7257('0x40')]['findAll'](_0x3e5a56);})['then'](function(_0x59775b){_0x58530d['rows']=_0x59775b;return _0x58530d;})[_0x7257('0x26')](respondWithFilteredResult(_0x2badba,_0x3e5a56))[_0x7257('0x43')](handleError(_0x2badba,null));};exports[_0x7257('0x44')]=function(_0x4532b3,_0x4dfbe4){var _0x5fd950={'raw':!![],'where':{'id':_0x4532b3[_0x7257('0x45')]['id']}},_0x4c0fb1={};_0x4c0fb1['model']=_[_0x7257('0x2f')](db[_0x7257('0x40')][_0x7257('0x2a')]);_0x4c0fb1[_0x7257('0x2e')]=_[_0x7257('0x2f')](_0x4532b3['query']);_0x4c0fb1[_0x7257('0x30')]=_[_0x7257('0x31')](_0x4c0fb1[_0x7257('0x2d')],_0x4c0fb1['query']);_0x5fd950[_0x7257('0x32')]=_[_0x7257('0x31')](_0x4c0fb1[_0x7257('0x2d')],qs[_0x7257('0x33')](_0x4532b3[_0x7257('0x2e')]['fields']));_0x5fd950['attributes']=_0x5fd950['attributes']['length']?_0x5fd950['attributes']:_0x4c0fb1[_0x7257('0x2d')];if(_0x4532b3[_0x7257('0x2e')][_0x7257('0x41')]){_0x5fd950[_0x7257('0x42')]=[{'all':!![]}];}_0x5fd950=_[_0x7257('0x3e')]({},_0x5fd950,_0x4532b3[_0x7257('0x3f')]);return db[_0x7257('0x40')]['find'](_0x5fd950)[_0x7257('0x26')](handleEntityNotFound(_0x4dfbe4,null))[_0x7257('0x26')](respondWithResult(_0x4dfbe4,null))[_0x7257('0x43')](handleError(_0x4dfbe4,null));};exports['create']=function(_0x1a2bcd,_0x2a6112){return db['WhatsappTransferReport'][_0x7257('0x46')](_0x1a2bcd[_0x7257('0x47')],{})[_0x7257('0x26')](respondWithResult(_0x2a6112,0xc9))['catch'](handleError(_0x2a6112,null));};exports[_0x7257('0x25')]=function(_0x1385af,_0x4dd4c3){if(_0x1385af[_0x7257('0x47')]['id']){delete _0x1385af[_0x7257('0x47')]['id'];}return db['WhatsappTransferReport'][_0x7257('0x48')]({'where':{'id':_0x1385af[_0x7257('0x45')]['id']}})['then'](handleEntityNotFound(_0x4dd4c3,null))[_0x7257('0x26')](saveUpdates(_0x1385af[_0x7257('0x47')],null))[_0x7257('0x26')](respondWithResult(_0x4dd4c3,null))['catch'](handleError(_0x4dd4c3,null));};exports['destroy']=function(_0x490b76,_0x28a25c){return db[_0x7257('0x40')][_0x7257('0x48')]({'where':{'id':_0x490b76[_0x7257('0x45')]['id']}})[_0x7257('0x26')](handleEntityNotFound(_0x28a25c,null))[_0x7257('0x26')](removeEntity(_0x28a25c,null))['catch'](handleError(_0x28a25c,null));};exports[_0x7257('0x49')]=function(_0x31a61f,_0x38a303){return db[_0x7257('0x40')][_0x7257('0x49')]()[_0x7257('0x26')](respondWithResult(_0x38a303,null))[_0x7257('0x43')](handleError(_0x38a303,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 17bb9b2..bc753b9 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 _0x1a43=['../../config/environment','./whatsappTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a43,0x93));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31a4('0x0'));var util=require(_0x31a4('0x1'));var logger=require(_0x31a4('0x2'))(_0x31a4('0x3'));var moment=require(_0x31a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x31a4('0x5'));var fs=require('fs');var path=require(_0x31a4('0x6'));var rimraf=require('rimraf');var config=require(_0x31a4('0x7'));var attributes=require(_0x31a4('0x8'));module[_0x31a4('0x9')]=function(_0x16aaea,_0x46d5a6){return _0x16aaea['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x31a4('0xa'),'fields':[_0x31a4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3c=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4db40c,_0x5aebda){var _0x572a4b=function(_0x4cb854){while(--_0x4cb854){_0x4db40c['push'](_0x4db40c['shift']());}};_0x572a4b(++_0x5aebda);}(_0xdc3c,0x190));var _0xcdc3=function(_0x1d5855,_0x5974f5){_0x1d5855=_0x1d5855-0x0;var _0x195979=_0xdc3c[_0x1d5855];return _0x195979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcdc3('0x0'))(_0xcdc3('0x1'));var moment=require(_0xcdc3('0x2'));var BPromise=require(_0xcdc3('0x3'));var rp=require(_0xcdc3('0x4'));var fs=require('fs');var path=require(_0xcdc3('0x5'));var rimraf=require('rimraf');var config=require(_0xcdc3('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xcdc3('0x7')]=function(_0x4591be,_0x27fe8a){return _0x4591be['define'](_0xcdc3('0x8'),attributes,{'tableName':_0xcdc3('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcdc3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 70c2869..a751c90 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 _0x2e0e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','../../mysqldb'];(function(_0x1985d0,_0x5983a0){var _0x1e3d7a=function(_0x453a7c){while(--_0x453a7c){_0x1985d0['push'](_0x1985d0['shift']());}};_0x1e3d7a(++_0x5983a0);}(_0x2e0e,0xb0));var _0xe2e0=function(_0x34378e,_0xb6193){_0x34378e=_0x34378e-0x0;var _0x19683c=_0x2e0e[_0x34378e];return _0x19683c;};'use strict';var _=require(_0xe2e0('0x0'));var util=require(_0xe2e0('0x1'));var moment=require(_0xe2e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2e0('0x3'))['db'];var utils=require(_0xe2e0('0x4'));var logger=require('../../config/logger')(_0xe2e0('0x5'));var config=require(_0xe2e0('0x6'));var jayson=require(_0xe2e0('0x7'));var client=jayson['client'][_0xe2e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298b18,_0x551e77,_0xc4f4d1){return new BPromise(function(_0xcbc3d7,_0x11f0d1){return client['request'](_0x298b18,_0xc4f4d1)['then'](function(_0x26e9f2){logger[_0xe2e0('0x9')](_0xe2e0('0xa'),_0x551e77,_0xe2e0('0xb'));logger[_0xe2e0('0xc')](_0xe2e0('0xd'),_0x551e77,_0xe2e0('0xb'),JSON[_0xe2e0('0xe')](_0x26e9f2));if(_0x26e9f2[_0xe2e0('0xf')]){if(_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x10')]===0x1f4){logger['error'](_0xe2e0('0xa'),_0x551e77,_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);return _0x11f0d1(_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x551e77,_0x26e9f2[_0xe2e0('0xf')][_0xe2e0('0x11')]);return _0xcbc3d7(_0x26e9f2['error']['message']);}else{logger[_0xe2e0('0x9')](_0xe2e0('0xa'),_0x551e77,'request\x20sent');_0xcbc3d7(_0x26e9f2['result']['message']);}})['catch'](function(_0x5c4486){logger[_0xe2e0('0xf')](_0xe2e0('0xa'),_0x551e77,_0x5c4486);_0x11f0d1(_0x5c4486);});});} \ No newline at end of file +var _0x50e9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../config/utils'];(function(_0x305f27,_0x2a6d2e){var _0x96e35b=function(_0x1104b1){while(--_0x1104b1){_0x305f27['push'](_0x305f27['shift']());}};_0x96e35b(++_0x2a6d2e);}(_0x50e9,0x89));var _0x950e=function(_0x113eb4,_0x2602e8){_0x113eb4=_0x113eb4-0x0;var _0x5a5293=_0x50e9[_0x113eb4];return _0x5a5293;};'use strict';var _=require('lodash');var util=require(_0x950e('0x0'));var moment=require('moment');var BPromise=require(_0x950e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x950e('0x2'));var logger=require(_0x950e('0x3'))(_0x950e('0x4'));var config=require(_0x950e('0x5'));var jayson=require(_0x950e('0x6'));var client=jayson['client'][_0x950e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29f93e,_0x541369,_0x1716b8){return new BPromise(function(_0x21a42c,_0x2bd7df){return client[_0x950e('0x8')](_0x29f93e,_0x1716b8)[_0x950e('0x9')](function(_0x2ac423){logger[_0x950e('0xa')](_0x950e('0xb'),_0x541369,_0x950e('0xc'));logger['debug'](_0x950e('0xd'),_0x541369,'request\x20sent',JSON[_0x950e('0xe')](_0x2ac423));if(_0x2ac423[_0x950e('0xf')]){if(_0x2ac423[_0x950e('0xf')][_0x950e('0x10')]===0x1f4){logger[_0x950e('0xf')](_0x950e('0xb'),_0x541369,_0x2ac423[_0x950e('0xf')]['message']);return _0x2bd7df(_0x2ac423['error'][_0x950e('0x11')]);}logger[_0x950e('0xf')](_0x950e('0xb'),_0x541369,_0x2ac423[_0x950e('0xf')][_0x950e('0x11')]);return _0x21a42c(_0x2ac423['error'][_0x950e('0x11')]);}else{logger['info'](_0x950e('0xb'),_0x541369,_0x950e('0xc'));_0x21a42c(_0x2ac423[_0x950e('0x12')]['message']);}})[_0x950e('0x13')](function(_0x55986f){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x541369,_0x55986f);_0x2bd7df(_0x55986f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index cb6407f..b5f8478 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x444e=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./config/seedDB','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','start','info','filter'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x444e,0xe8));var _0xe444=function(_0xbace63,_0x2b33ec){_0xbace63=_0xbace63-0x0;var _0x33a7cd=_0x444e[_0xbace63];return _0x33a7cd;};'use strict';var _=require(_0xe444('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe444('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe444('0x2'));var config=require('./config/environment');var logger=require(_0xe444('0x3'))('app');var pm2=require(_0xe444('0x4'));var pm2Config=require(_0xe444('0x5'));var schedule=require(_0xe444('0x6'));var chat=require(_0xe444('0x7'));var whatsapp=require(_0xe444('0x8'));var transcribe=require(_0xe444('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xe444('0xa')]['sync']()[_0xe444('0xb')](function(){if(config['seedDB']){return seedDb[_0xe444('0xc')]();}})[_0xe444('0xb')](function(){return checkLicense[_0xe444('0xc')]();})['then'](function(){return rpc['listen']();})[_0xe444('0xb')](function(_0x1f41ff){logger['info'](_0x1f41ff);return chat[_0xe444('0xd')]();})['then'](function(){return whatsapp['start']();})[_0xe444('0xb')](function(){return schedule['start']();})[_0xe444('0xb')](function(){return transcribe[_0xe444('0xd')]();})['then'](function(){return provider[_0xe444('0xd')]();})['then'](function(_0x5ba044){logger[_0xe444('0xe')](_0x5ba044);return pm2[_0xe444('0xd')](pm2Config);})['then'](function(_0x192c1a){var _0x5d739a=_0x192c1a[_0xe444('0xf')](function(_0x3acd97){return typeof _0x3acd97[_0xe444('0x10')]===_0xe444('0x11')&&_0x3acd97[_0xe444('0x10')]>=0x0;});if(_0x5d739a[_0xe444('0x12')]>0x0){throw new Error(_0x5d739a[_0xe444('0x12')]+_0xe444('0x13')+_[_0xe444('0x14')](_0x5d739a,function(_0x4009c7){return'\x22'+_0x4009c7[_0xe444('0x15')][_0xe444('0x16')]+'\x22';}));}logger[_0xe444('0xe')]('Online\x20apps:',_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,{'status':_0xe444('0x17')}),_0xe444('0x16'))['join']());logger[_0xe444('0xe')](_0xe444('0x18'),_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,function(_0x37c15e){return _0x37c15e['status']!==_0xe444('0x17');}),_0xe444('0x16'))['join']()||_0xe444('0x19'));console['log'](_0xe444('0x1a'));})[_0xe444('0x1b')](function(_0x3d36c7){console[_0xe444('0x1c')](_0xe444('0x1d'),_0x3d36c7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d36c7);process[_0xe444('0x1e')](0x1);});}main(); \ No newline at end of file +var _0x9576=['log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','None'];(function(_0xa49aef,_0x477eb8){var _0x317237=function(_0x510d63){while(--_0x510d63){_0xa49aef['push'](_0xa49aef['shift']());}};_0x317237(++_0x477eb8);}(_0x9576,0x182));var _0x6957=function(_0x1d5703,_0x53c36f){_0x1d5703=_0x1d5703-0x0;var _0x9acb34=_0x9576[_0x1d5703];return _0x9acb34;};'use strict';var _=require(_0x6957('0x0'));var db=require(_0x6957('0x1'))['db'];var seedDb=require(_0x6957('0x2'));var checkLicense=require(_0x6957('0x3'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x6957('0x4'))(_0x6957('0x5'));var pm2=require(_0x6957('0x6'));var pm2Config=require(_0x6957('0x7'));var schedule=require(_0x6957('0x8'));var chat=require(_0x6957('0x9'));var whatsapp=require(_0x6957('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x6957('0xb'));function main(){return db[_0x6957('0xc')][_0x6957('0xd')]()[_0x6957('0xe')](function(){if(config[_0x6957('0xf')]){return seedDb[_0x6957('0x10')]();}})['then'](function(){return checkLicense[_0x6957('0x10')]();})[_0x6957('0xe')](function(){return rpc['listen']();})['then'](function(_0x3e0520){logger[_0x6957('0x11')](_0x3e0520);return chat[_0x6957('0x12')]();})[_0x6957('0xe')](function(){return whatsapp[_0x6957('0x12')]();})[_0x6957('0xe')](function(){return schedule[_0x6957('0x12')]();})['then'](function(){return transcribe['start']();})['then'](function(){return provider[_0x6957('0x12')]();})[_0x6957('0xe')](function(_0x1bf2cc){logger[_0x6957('0x11')](_0x1bf2cc);return pm2[_0x6957('0x12')](pm2Config);})[_0x6957('0xe')](function(_0x25d32e){var _0x5e9758=_0x25d32e['filter'](function(_0x4f82cb){return typeof _0x4f82cb[_0x6957('0x13')]===_0x6957('0x14')&&_0x4f82cb[_0x6957('0x13')]>=0x0;});if(_0x5e9758[_0x6957('0x15')]>0x0){throw new Error(_0x5e9758['length']+_0x6957('0x16')+_['map'](_0x5e9758,function(_0x2a39b5){return'\x22'+_0x2a39b5[_0x6957('0x17')]['name']+'\x22';}));}logger[_0x6957('0x11')](_0x6957('0x18'),_[_0x6957('0x19')](_['filter'](_0x25d32e,{'status':_0x6957('0x1a')}),_0x6957('0x1b'))[_0x6957('0x1c')]());logger[_0x6957('0x11')](_0x6957('0x1d'),_[_0x6957('0x19')](_[_0x6957('0x1e')](_0x25d32e,function(_0x3081b2){return _0x3081b2['status']!=='online';}),_0x6957('0x1b'))[_0x6957('0x1c')]()||_0x6957('0x1f'));console[_0x6957('0x20')](_0x6957('0x21'));})[_0x6957('0x22')](function(_0x395e59){console[_0x6957('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x395e59);logger[_0x6957('0x23')](_0x6957('0x24'),_0x395e59);process[_0x6957('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 74da52d..bc30883 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 _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x4565c6,_0x284e6d){var _0x530df6=function(_0x21451d){while(--_0x21451d){_0x4565c6['push'](_0x4565c6['shift']());}};_0x530df6(++_0x284e6d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file +var _0x70e0=['express-jwt','composable-middleware','crypto','util','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','authenticate','Bearer','status','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','encryptString','promisify','sign','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken'];(function(_0xe4854b,_0x414b50){var _0x1c3d72=function(_0x266317){while(--_0x266317){_0xe4854b['push'](_0xe4854b['shift']());}};_0x1c3d72(++_0x414b50);}(_0x70e0,0x17b));var _0x070e=function(_0x531d42,_0x1f791c){_0x531d42=_0x531d42-0x0;var _0x4b61c9=_0x70e0[_0x531d42];return _0x4b61c9;};'use strict';var db=require(_0x070e('0x0'))['db'];var config=require(_0x070e('0x1'));var hardwareConf=require(_0x070e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x070e('0x3'));var jwt=require(_0x070e('0x4'));var expressJwt=require(_0x070e('0x5'));var compose=require(_0x070e('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x070e('0x7'));var BPromise=require('bluebird');var util=require(_0x070e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x070e('0x9'),_0x070e('0xa'),_0x070e('0xb'),_0x070e('0xc'),_0x070e('0xd'),_0x070e('0xe'),_0x070e('0xf'),'md5secret','voicePause',_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13'),_0x070e('0x14'),_0x070e('0x15'),_0x070e('0x16'),_0x070e('0x17'),_0x070e('0x18'),_0x070e('0x19'),_0x070e('0x1a'),'passwordResetAt','alias',_0x070e('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x070e('0x1c'),_0x070e('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x070e('0x1e'),_0x070e('0x1f'),_0x070e('0x20'),_0x070e('0x21'),'userProfileId','privacyEnabled',_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26'),'ignorePauseForPreviewCalls',_0x070e('0x27'),_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a'),_0x070e('0x2b'),'smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer',_0x070e('0x2c'),_0x070e('0x2d'),_0x070e('0x2e'),'whatsappAutoanswer',_0x070e('0x2f')];exports['isChatInteractionAuthorized']=function(){return this[_0x070e('0x30')](!![])[_0x070e('0x31')](function(_0x27a01e,_0x33e8c6,_0x28a1c3){if(_0x27a01e[_0x070e('0x32')]){_0x28a1c3();}else{return db[_0x070e('0x33')][_0x070e('0x34')]({'where':{'id':_0x27a01e['params']['id']},'attributes':['id',_0x070e('0x35'),_0x070e('0x36')],'raw':!![]})[_0x070e('0x37')](function(_0x503f4d){if(_0x503f4d&&_0x503f4d[_0x070e('0x35')]){return _0x33e8c6['status'](_0x503f4d['disposition']===_0x070e('0x38')?0x195:0x193)[_0x070e('0x39')]({'message':_0x503f4d[_0x070e('0x36')]===_0x070e('0x38')?_0x070e('0x3a'):'Forbidden.'});}else{_0x28a1c3();}})[_0x070e('0x3b')](function(_0x219e48){_0x28a1c3(_0x219e48);});}});};exports[_0x070e('0x30')]=function isAuthenticated(_0x1d2a34){return compose()[_0x070e('0x31')](function(_0x28d7f2,_0x1a1892,_0x26373b){var _0x5e8326;if(_0x28d7f2[_0x070e('0x3c')][_0x070e('0x3d')]){if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x3f'))){var _0x46065c=basicAuth(_0x28d7f2);db[_0x070e('0x40')]['find']({'where':{'name':_0x46065c[_0x070e('0xb')]}})[_0x070e('0x37')](function(_0x3a9425){if(!_0x3a9425||!_0x3a9425[_0x070e('0x41')](_0x46065c['pass'])){return _0x1a1892['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28d7f2[_0x070e('0x32')]={'id':_0x3a9425['id']};_0x26373b();})['catch'](function(_0x1dff97){_0x26373b(_0x1dff97);});}else if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x42'))){validateJwt(_0x28d7f2,_0x1a1892,_0x26373b);}else{if(_0x1d2a34){_0x26373b();}else{return _0x1a1892[_0x070e('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x28d7f2[_0x070e('0x44')][_0x070e('0x45')]){try{var _0x444d02={'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};verifyJwt(_0x28d7f2['query']['apikey'],_0x444d02)[_0x070e('0x37')](function(_0x3011c4){return db[_0x070e('0x40')][_0x070e('0x47')]({'where':{'id':_0x3011c4[_0x070e('0x48')]}})['then'](function(_0x22f3a9){_0x5e8326=_0x22f3a9;return db[_0x070e('0x49')]['findOne']({'where':{'id':0x1},'attributes':[_0x070e('0x4a'),_0x070e('0x4b')],'raw':!![]});})['then'](function(_0x4d4ee8){if(!_0x5e8326||!_['isEqual'](_0x5e8326[_0x070e('0x4c')],_0x3011c4[_0x070e('0x4d')])){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4e')});}if(_0x5e8326['disabled']){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}if(_0x5e8326['blocked']){if(_0x4d4ee8[_0x070e('0x4b')]>0x0){if(moment(_0x5e8326[_0x070e('0x50')])[_0x070e('0x51')](_0x4d4ee8['blockDuration'],_0x070e('0x52'))>moment()){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});}}else{return _0x1a1892['status'](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}}_0x28d7f2[_0x070e('0x32')]={'id':_0x5e8326['id']};_0x26373b();});})[_0x070e('0x3b')](function(){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});});}catch(_0x5db2ce){_0x26373b(_0x5db2ce);}}else if(_0x1d2a34){_0x26373b();}else{return _0x1a1892['status'](0x193)[_0x070e('0x39')]({'message':_0x070e('0x53')});}})[_0x070e('0x31')](function(_0x4d52ff,_0x2ad56c,_0x1223be){if(_0x4d52ff[_0x070e('0x32')]){db[_0x070e('0x40')]['find']({'where':{'id':_0x4d52ff[_0x070e('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x544b53){if(!_0x544b53){return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':_0x070e('0x54')});}_0x4d52ff[_0x070e('0x32')]=_0x544b53;_0x1223be();})[_0x070e('0x3b')](function(_0x34f23e){_0x1223be(_0x34f23e);});}else if(_0x1d2a34){_0x1223be();}else{return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x070e('0x55')]=function canUpdate(){return compose()[_0x070e('0x31')](function(_0xff760c,_0x52fcea,_0x54285a){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x35349f){if(_0x35349f[_0x070e('0x57')]){_0x54285a();}else{return _0x52fcea[_0x070e('0x43')](0x193)['json']({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x48d836){_0x54285a(_0x48d836);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x070e('0x31')](function(_0x945901,_0x2d43ce,_0x1fc7c4){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x20b80e){if(_0x20b80e[_0x070e('0x59')]){_0x1fc7c4();}else{return _0x2d43ce[_0x070e('0x43')](0x193)[_0x070e('0x39')]({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x1f54d5){_0x1fc7c4(_0x1f54d5);});});};exports[_0x070e('0x5a')]=function(_0xd67987,_0x66a3f3,_0x210c4d){_0xd67987[_0x070e('0x5a')]=!![];return _0x210c4d();};exports[_0x070e('0x5b')]=function signToken(_0x216d27){return signJwt(_0x216d27);};exports[_0x070e('0x5c')]=function(_0x5e051a,_0x171621){if(!_0x5e051a[_0x070e('0x32')]){return _0x171621[_0x070e('0x43')](0x194)[_0x070e('0x39')]({'message':_0x070e('0x5d')});}var _0x3bd738={'payload':{'id':_0x5e051a[_0x070e('0x32')]['id'],'role':_0x5e051a[_0x070e('0x32')][_0x070e('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3bd738)['then'](function(_0x251696){_0x171621['cookie'](_0x070e('0x5e'),_0x251696);_0x171621[_0x070e('0x5f')]('/dashboards/general');})[_0x070e('0x3b')](function(_0x130a50){return _0x171621[_0x070e('0x43')](0x1f4)[_0x070e('0x60')](_0x130a50);});};exports[_0x070e('0x61')]=function(_0x1e8a4f){if(_[_0x070e('0x62')](_0x1e8a4f['apiKeyNonce'])||_[_0x070e('0x62')](_0x1e8a4f['apiKeyIat'])){return null;}else{return createJwt(_0x1e8a4f);}};exports['generateApiKey']=function(_0x3a06c6){_0x3a06c6[_0x070e('0x4c')]=generateNonce();_0x3a06c6[_0x070e('0x63')]=generateIssuedAt();return createJwt(_0x3a06c6);};exports[_0x070e('0x64')]=function(_0x202015,_0x7948ed){var _0x440fa1=_0x202015[_0x070e('0x44')]['apikey'];if(_0x440fa1){var _0x477e69={'nonce':_0x7948ed['apiKeyNonce'],'iat':_0x7948ed['apiKeyIat'],'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};return verifyJwt(_0x440fa1,_0x477e69)['then'](function(){return generateApiKey(_0x7948ed);});}else{throw{'message':_0x070e('0x65')};}};exports[_0x070e('0x66')]=function(_0x210f4a){var _0x2f8104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f8104[_0x070e('0x67')](_0x210f4a))throw new db[(_0x070e('0x68'))][(_0x070e('0x69'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5943e3,_0x3087e5,_0x1948a5){var _0x29f497=encryptor[_0x070e('0x6a')](_0x3087e5)['split'](',');for(var _0x25f34c=0x0;_0x25f34c<_0x1948a5;_0x25f34c++){if(!_0x29f497[_0x25f34c])break;if(_0x5943e3['toLowerCase']()===_0x29f497[_0x25f34c][_0x070e('0x6b')]()){var _0x1cbb7e=util[_0x070e('0x6c')](_0x070e('0x6d'),_0x1948a5);if(_0x1948a5===0x1){_0x1cbb7e=_0x070e('0x6e');}throw new db[(_0x070e('0x68'))]['ValidationError'](_0x1cbb7e);}}return;};exports[_0x070e('0x6f')]=function(_0x18e8d0,_0x8aaf00){var _0x533431=_0x8aaf00?encryptor[_0x070e('0x6a')](_0x8aaf00)[_0x070e('0x70')](','):[];if(_0x533431['length']===0x5){_0x533431[_0x070e('0x71')](-0x1,0x1);}_0x533431['unshift'](_0x18e8d0);return encryptor[_0x070e('0x72')](_0x533431['join'](','));};function signJwt(_0x4cb86f){var _0x4b354d=BPromise[_0x070e('0x73')](jwt[_0x070e('0x74')],{'context':jwt});var _0x1100d8=_0x4cb86f[_0x070e('0x75')]||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x498bc6,_0x841c89){_0x4b354d(_0x4cb86f['payload'],_0x1100d8,_0x4cb86f[_0x070e('0x78')])['then'](function(_0x2e10f7){_0x498bc6(_0x2e10f7);})[_0x070e('0x3b')](function(_0x5b0b46){_0x841c89(_0x5b0b46);});});}function verifyJwt(_0x1bcdc3,_0x50399e,_0x1a9e25){var _0x139630=BPromise[_0x070e('0x73')](jwt[_0x070e('0x79')],{'context':jwt});var _0x764b06=_0x1a9e25||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x148f1d,_0x3ef9cc){_0x139630(_0x1bcdc3,_0x764b06,_0x50399e)[_0x070e('0x37')](function(_0x40c560){_0x148f1d(_0x40c560);})[_0x070e('0x3b')](function(_0x455bf2){_0x3ef9cc(_0x455bf2);});});}function generateNonce(){return crypto[_0x070e('0x7a')](0x10)['toString'](_0x070e('0x7b'));}function generateIssuedAt(){return Math[_0x070e('0x7c')](Date[_0x070e('0x7d')]()/0x3e8)[_0x070e('0x7e')]();}function createJwt(_0x5712d1){var _0x2ccd8d={'payload':{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')]},'options':{'algorithm':_0x070e('0x7f'),'subject':_0x5712d1['id'][_0x070e('0x7e')](),'issuer':hardwareConf[_0x070e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2ccd8d)[_0x070e('0x37')](function(_0x7d154){return{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')],'token':_0x7d154};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index a9cba18..a2e9f46 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 _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(_0x52b163,_0x4ccf29){var _0x370394=function(_0x4f89d8){while(--_0x4f89d8){_0x52b163['push'](_0x52b163['shift']());}};_0x370394(++_0x4ccf29);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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 +var _0xd487=['where','fields','filter','user','clause','tags','skip','ids','tag','count','getFilteredContacts','catch','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd487,0x1e4));var _0x7d48=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0xd487[_0x2cdcf9];return _0x39412d;};'use strict';var _=require(_0x7d48('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7d48('0x1'))['db'];exports[_0x7d48('0x2')]=function(_0x281aef,_0x9fca41,_0x5ba6f7,_0xb52ce8){var _0x50f3ab={'count':0x0,'rows':[]};var _0x2a2b2a=sqlUtils[_0x7d48('0x3')](_0x9fca41,_0x281aef);if(_0x2a2b2a){return Promise[_0x7d48('0x4')](_0x50f3ab);}var _0x52ecb0=sqlUtils[_0x7d48('0x5')]();var _0x2103f2={};var _0x2a8606=![];var _0x22166e=![];return Promise[_0x7d48('0x4')]()[_0x7d48('0x6')](function(){if(_0x281aef[_0x7d48('0x7')]){return sqlUtils[_0x7d48('0x8')](_0x281aef['search'],_0xb52ce8);}else{return sqlUtils[_0x7d48('0x9')](_0x281aef,_0xb52ce8);}})['then'](function(_0x13bea2){_0x52ecb0['where'](_0x13bea2[_0x7d48('0xa')]);_0x52ecb0[_0x7d48('0xb')](_0x13bea2[_0x7d48('0xc')]);_0x52ecb0[_0x7d48('0xb')](_0x13bea2[_0x7d48('0xd')]);_0x52ecb0[_0x7d48('0xb')](_0x13bea2[_0x7d48('0xe')][_0x7d48('0xf')]);_0x2103f2=_0x13bea2[_0x7d48('0x10')];_0x22166e=_0x13bea2['user'][_0x7d48('0x11')];return sqlUtils['checkListsRestrictions'](_0x9fca41,_0x281aef,_0x22166e);})[_0x7d48('0x6')](function(_0x4936d5){_0x52ecb0[_0x7d48('0xb')](_0x4936d5);var _0x5bd5dc=_0x281aef[_0x7d48('0x7')]?_0x2103f2[_0x7d48('0x12')]:_0x281aef[_0x7d48('0x13')];_0x2a8606=_0x5bd5dc?!![]:![];return sqlUtils['countFilteredContacts'](_0x52ecb0,_0x5bd5dc);})[_0x7d48('0x6')](function(_0x2a8848){_0x50f3ab[_0x7d48('0x14')]=_0x2a8848;if(_0x50f3ab['count']===0x0){return;}if(_0x281aef['User']){_0x22166e=!![];}return sqlUtils['buildContactsQuery'](_0x52ecb0,_0x281aef['fields'],_0x5ba6f7,_0x2a8606,_0x2103f2[_0x7d48('0xf')],_0x22166e);})['then'](function(_0x2b18cb){if(!_0x2b18cb){return[];}return sqlUtils[_0x7d48('0x15')](_0x2b18cb,_0x281aef,_0x5ba6f7);})[_0x7d48('0x6')](function(_0x207501){_0x50f3ab['rows']=_0x207501;return _0x50f3ab;})[_0x7d48('0x16')](function(_0x4b5195){throw _0x4b5195;});};exports['describe']=function(){var _0x1db2c7={};var _0x5c45cd=[];return db[_0x7d48('0x17')]['describe']()[_0x7d48('0x6')](function(_0x336d62){_0x1db2c7=_0x336d62;var _0x38d587=Object[_0x7d48('0x18')](_0x1db2c7)[_0x7d48('0xd')](function(_0x4c0944){return _[_0x7d48('0x19')](_0x4c0944,_0x7d48('0x1a'))?_0x4c0944:undefined;});var _0x3908d4=_0x38d587[_0x7d48('0x1b')](function(_0x32a346){return db[_0x7d48('0x1c')][_0x7d48('0x1d')]({'where':{'id':_0x32a346[_0x7d48('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x3908d4);})[_0x7d48('0x6')](function(_0x27ae81){for(var _0x4280a1=0x0;_0x4280a1<_0x27ae81['length'];_0x4280a1++){if(_0x27ae81[_0x4280a1]){var _0x304463=_0x7d48('0x1a')+_0x27ae81[_0x4280a1]['id'];_0x1db2c7[_0x304463][_0x7d48('0x1f')]=_0x27ae81[_0x4280a1][_0x7d48('0x20')];}}_0x5c45cd=_[_0x7d48('0x1b')](Object[_0x7d48('0x18')](_0x1db2c7),function(_0x5371c1){return{'name':_0x5371c1,'type':_0x1db2c7[_0x5371c1][_0x7d48('0x20')]};});return _0x5c45cd;})[_0x7d48('0x16')](function(_0x501e21){throw _0x501e21;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 343e89b..b2002e0 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 _0x10eb=['ids','user','skip','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','fieldType','castTo','DATE','type','text','start','value','end','map','clause','and'];(function(_0x3b6dbd,_0x33e896){var _0x3fa193=function(_0x33cf9d){while(--_0x33cf9d){_0x3b6dbd['push'](_0x3b6dbd['shift']());}};_0x3fa193(++_0x33e896);}(_0x10eb,0x176));var _0xb10e=function(_0x32153d,_0xb35650){_0x32153d=_0x32153d-0x0;var _0x1c442d=_0x10eb[_0x32153d];return _0x1c442d;};'use strict';var _=require(_0xb10e('0x0'));var squel=require(_0xb10e('0x1'));var as=require(_0xb10e('0x2'));var qs=require(_0xb10e('0x3'));var utils=require(_0xb10e('0x4'));var db=require(_0xb10e('0x5'))['db'];function skipContactsQuery(_0x42d40f,_0x6561e7){var _0x148587=![];if(_0x42d40f[_0xb10e('0x6')]==='agent'&&!_0x6561e7[_0xb10e('0x7')]&&!_0x6561e7[_0xb10e('0x8')]&&_0x6561e7[_0xb10e('0x9')]!==_0xb10e('0xa')){_0x148587=!![];}return _0x148587;}function getContactsSubquery(){return squel[_0xb10e('0xb')]()[_0xb10e('0xc')](_0xb10e('0xd'),'c')[_0xb10e('0xe')](_0xb10e('0xf'));}function applyJoinClauses(_0x108dd1,_0x4b0acc){var _0x591a68=_0x4b0acc?'c':_0xb10e('0x10');_0x108dd1[_0xb10e('0x11')](_0xb10e('0x12'),'uc','uc.CmContactId\x20=\x20'+_0x591a68+_0xb10e('0x13'))[_0xb10e('0x11')](_0xb10e('0x14'),'ct',_0xb10e('0x15')+_0x591a68+_0xb10e('0x13'))[_0xb10e('0x11')](_0xb10e('0x16'),'t',_0xb10e('0x17'));return _0x108dd1;}function addFieldsToQuery(_0x4b2728,_0x218e88,_0x4f41f1,_0x381ad6,_0x56679d){var _0x1b4165=_0x56679d?'c':_0xb10e('0x10');if(!_0x218e88){_0x218e88=['id','firstName','lastName',_0xb10e('0x18'),_0xb10e('0x19'),_0xb10e('0x1a'),_0xb10e('0x1b'),_0xb10e('0x8'),_0xb10e('0x1c'),_0xb10e('0x1d'),_0xb10e('0x1e'),_0xb10e('0x1f'),_0xb10e('0x20')];}else if(!_0x218e88[_0xb10e('0x21')]('id')){_0x218e88[_0xb10e('0x22')]('id');}var _0x10c2b9=_0x4f41f1&&_0x56679d||!_0x4f41f1&&!_0x56679d;if(_0x381ad6){_0x10c2b9=_0x381ad6&&_0x56679d||!_0x381ad6&&!_0x56679d;}_0x218e88[_0xb10e('0x23')](function(_0x455fbc){if(_0x455fbc===_0xb10e('0x20')){if(_0x10c2b9){_0x4b2728[_0xb10e('0x24')](_0xb10e('0x25'),_0x455fbc);}else if(_0x4f41f1||_0x381ad6){_0x4b2728['field'](_0x1b4165+'.'+_0x455fbc);}}else{_0x4b2728[_0xb10e('0x24')](_0x1b4165+'.'+_0x455fbc);}});return _0x4b2728;}function getSqlClauses(){var _0x5524cf={'default':squel[_0xb10e('0x26')](),'fields':squel[_0xb10e('0x26')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xb10e('0x26')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5524cf;}function parseTagParameter(_0x488124){var _0x4b825c=squel[_0xb10e('0x26')]();if(_0x488124){var _0x155968=utils['getSelectedTags'](_0x488124);_0x155968['forEach'](function(_0xa6bdd5){_0x4b825c['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa6bdd5+',%');});}return _0x4b825c;}function parseSearchFilter(_0x39b716){var _0x21e549=squel[_0xb10e('0x26')]();if(_0x39b716){var _0x3207f0=_0x39b716[_0xb10e('0x27')]('\x5c','\x5c\x5c')[_0xb10e('0x27')](/'/g,'\x27\x27');if(_0x3207f0[_0xb10e('0x28')]('\x20')[_0xb10e('0x29')]>0x1){_0x21e549['or'](_0xb10e('0x2a'),qs[_0xb10e('0x2b')](_0x3207f0),null);}else{if(qs[_0xb10e('0x2c')](_0x3207f0)){_0x21e549['or']('c.id\x20LIKE\x20?',_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2d'),_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2e'),_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x2f'),_0x3207f0+'%');}else if(qs[_0xb10e('0x30')](_0x3207f0)){_0x21e549['or'](_0xb10e('0x31'),_0x3207f0+'%');}else{_0x21e549['or'](_0xb10e('0x32'),'%'+_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x33'),'%'+_0x3207f0+'%');_0x21e549['or'](_0xb10e('0x31'),'%'+_0x3207f0+'%');}}}return _0x21e549;}function parseAdvancedSearchFilter(_0xe85d88,_0x13b9df){var _0x5b74ea=getSqlClauses();var _0x538def=as[_0xb10e('0x34')](_0xe85d88);var _0x46f5f8=_0x538def[_0xb10e('0x35')];for(var _0x36a329=0x0;_0x36a329<_0x538def[_0xb10e('0x36')][_0xb10e('0x29')];_0x36a329++){var _0x5cdff2=_0x538def[_0xb10e('0x36')][_0x36a329];var _0x1c58dd='c';var _0x1ce56c=_['find'](_0x13b9df,['name',_0x5cdff2[_0xb10e('0x24')]]);if(_0x1ce56c){if(_0x5cdff2[_0xb10e('0x24')]==='dateOfBirth'||_0x1ce56c[_0xb10e('0x37')]==='datetime'){_0x5cdff2[_0xb10e('0x38')]=_0xb10e('0x39');}var _0x56486d=as['buildExpression'](_0x1c58dd,_0x1ce56c[_0xb10e('0x3a')],_0x5cdff2);_0x5b74ea['default'][_0x46f5f8](_0x56486d[_0xb10e('0x3b')],_0x56486d['value'][_0xb10e('0x3c')],_0x56486d[_0xb10e('0x3d')][_0xb10e('0x3e')]);}else{if(_0x5cdff2['field']==='Tag'){var _0x101e5d=_0x5cdff2['value'][_0xb10e('0x28')](',')[_0xb10e('0x3f')](function(_0x3570eb){return Number(_0x3570eb);});var _0x5dc950=parseTagParameter(_0x101e5d);_0x5b74ea['tags'][_0xb10e('0x40')][_0xb10e('0x41')](_0x5dc950);_0x5b74ea['tags'][_0xb10e('0x42')]=_0x101e5d;}else if(_0x5cdff2['field']==='User'){_0x5b74ea[_0xb10e('0x43')]['clause'][_0xb10e('0x41')]('uc.UserId\x20=\x20?',_0x5cdff2[_0xb10e('0x3d')]);_0x5b74ea[_0xb10e('0x43')][_0xb10e('0x44')]=!![];}}}return _0x5b74ea;}function parseModelFields(_0x2c0bc5,_0x52aa72){var _0x152fed=squel[_0xb10e('0x26')]();var _0xda6dd1=_(_0x2c0bc5)['keys']()['map'](function(_0x6dc45c){return _['some'](_0x52aa72,[_0xb10e('0x45'),_0x6dc45c])?_0x6dc45c:undefined;})[_0xb10e('0x46')]()[_0xb10e('0x3d')]();if(_0x2c0bc5[_0xb10e('0x47')]){_0xda6dd1['push']('Contact');}if(_0xda6dd1[_0xb10e('0x29')]>0x0){_0xda6dd1['forEach'](function(_0x1b189b){if(_0x1b189b==='ListId'){_0x152fed[_0xb10e('0x41')](_0xb10e('0x48'),[][_0xb10e('0x49')](_0x2c0bc5[_0x1b189b]));}else if(_0x1b189b===_0xb10e('0x47')){var _0x1fd4b6='%'+_0x2c0bc5[_0x1b189b]+'%';_0x152fed[_0xb10e('0x41')](_0xb10e('0x4a'),_0x1fd4b6);}else{_0x152fed[_0xb10e('0x41')]('c.'+_0x1b189b+_0xb10e('0x4b'),_0x2c0bc5[_0x1b189b]);}});}return _0x152fed;}function parseQueryParameters(_0x19fa93,_0x1c1459){var _0x35c920=getSqlClauses();return Promise[_0xb10e('0x4c')]()[_0xb10e('0x4d')](function(){return parseModelFields(_0x19fa93,_0x1c1459);})[_0xb10e('0x4d')](function(_0x233440){_0x35c920['fields'][_0xb10e('0x41')](_0x233440);return parseTagParameter(_0x19fa93[_0xb10e('0x4e')]);})[_0xb10e('0x4d')](function(_0x5a58d6){_0x35c920['tags'][_0xb10e('0x40')][_0xb10e('0x41')](_0x5a58d6);return parseSearchFilter(_0x19fa93[_0xb10e('0x4f')]);})[_0xb10e('0x4d')](function(_0x83744c){_0x35c920[_0xb10e('0x4f')]=_0x83744c;return _0x35c920;});}function checkListsRestrictions(_0x47d9cd,_0x3f1b41,_0x1cc15f){var _0x337840=squel[_0xb10e('0x26')]();return Promise[_0xb10e('0x4c')]()[_0xb10e('0x4d')](function(){if(_0x3f1b41['search']&&_0x47d9cd['role']===_0xb10e('0x50')&&!_0x1cc15f){return _0x47d9cd[_0xb10e('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xb10e('0x4d')](function(_0x1cc0eb){if(_0x1cc0eb){if(_0x1cc0eb[_0xb10e('0x29')]===0x0){_0x337840[_0xb10e('0x41')](_0xb10e('0x52'));}else{_0x337840['and']('c.ListId\x20IN\x20?',_[_0xb10e('0x3f')](_0x1cc0eb,'id'));}}})['then'](function(){return _0x337840;});}function buildContactsQuery(_0x19f7f0,_0x26ce0e,_0x242fd8,_0x1b8392,_0x20c81a,_0x856869){if(_0x26ce0e){_0x26ce0e=_0x242fd8[_0xb10e('0x53')];}_0x19f7f0=addFieldsToQuery(_0x19f7f0,_0x26ce0e,_0x1b8392,_0x856869,!![]);var _0x262426=squel[_0xb10e('0xb')]();_0x262426=addFieldsToQuery(_0x262426,_0x26ce0e,_0x1b8392,_0x856869,![]);if(_0x1b8392||_0x856869){_0x19f7f0=applyJoinClauses(_0x19f7f0,!![]);_0x19f7f0[_0xb10e('0x54')]('c.id');if(_0x242fd8[_0xb10e('0x55')]){_0x262426['limit'](_0x242fd8[_0xb10e('0x55')]);}if(_0x242fd8[_0xb10e('0x56')]){_0x262426[_0xb10e('0x56')](_0x242fd8[_0xb10e('0x56')]);}}else{_0x262426=applyJoinClauses(_0x262426,![]);_0x262426[_0xb10e('0x54')]('subqry.id');if(_0x242fd8[_0xb10e('0x55')]){_0x19f7f0[_0xb10e('0x55')](_0x242fd8[_0xb10e('0x55')]);}if(_0x242fd8[_0xb10e('0x56')]){_0x19f7f0[_0xb10e('0x56')](_0x242fd8[_0xb10e('0x56')]);}}_0x262426[_0xb10e('0x57')](_0x20c81a);if(_0x242fd8[_0xb10e('0x58')]){_0x242fd8[_0xb10e('0x58')][_0xb10e('0x23')](function(_0xe15eb8){_0x19f7f0[_0xb10e('0x58')]('c.'+_0xe15eb8[0x0],_0xe15eb8[0x1]===_0xb10e('0x59')?![]:!![]);_0x262426[_0xb10e('0x58')](_0xb10e('0x5a')+_0xe15eb8[0x0],_0xe15eb8[0x1]===_0xb10e('0x59')?![]:!![]);});}_0x262426[_0xb10e('0xc')](_0x19f7f0,_0xb10e('0x10'));return _0x262426;}function getFilteredContacts(_0x544a14){var _0x2832b0=[];return db[_0xb10e('0x5b')][_0xb10e('0x5c')]({'attributes':['id',_0xb10e('0x45'),_0xb10e('0x5d')],'raw':!![]})[_0xb10e('0x4d')](function(_0x4186a6){_0x2832b0=_[_0xb10e('0x5e')](_0x4186a6,'id');var _0x735a7a={'type':db[_0xb10e('0x5f')][_0xb10e('0x60')][_0xb10e('0x61')],'model':db[_0xb10e('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xb10e('0x63')](_0x544a14[_0xb10e('0x64')](),_0x735a7a);})[_0xb10e('0x4d')](function(_0x3e0b05){_0x3e0b05['forEach'](function(_0x5135b1){if(_0x5135b1['TagIds']){_0x5135b1[_0xb10e('0x65')]=[];_0x5135b1[_0xb10e('0x20')][_0xb10e('0x28')](',')['forEach'](function(_0x265909){_0x5135b1[_0xb10e('0x65')][_0xb10e('0x22')](_0x2832b0[_0x265909]);});}delete _0x5135b1['TagIds'];});return _0x3e0b05;});}function countFilteredContacts(_0x5f1111,_0x12ef60){var _0x9ba9c5=_0x5f1111[_0xb10e('0x66')]();_0x9ba9c5[_0xb10e('0x24')](_0xb10e('0x67'));_0x9ba9c5=applyJoinClauses(_0x9ba9c5,!![]);_0x5f1111[_0xb10e('0x54')](_0xb10e('0x68'));var _0x774b62=utils[_0xb10e('0x69')](_0x12ef60);if(!_[_0xb10e('0x6a')](_0x774b62)){_0x9ba9c5[_0xb10e('0xe')](_0xb10e('0x6b'),_0x774b62);}var _0x14ca07={'type':db[_0xb10e('0x5f')]['QueryTypes'][_0xb10e('0x61')],'raw':!![]};return db[_0xb10e('0x6c')][_0xb10e('0x63')](_0x9ba9c5[_0xb10e('0x64')](),_0x14ca07)[_0xb10e('0x4d')](function(_0x140801){return _0x140801[0x0]['COUNT(*)'];});}module[_0xb10e('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x182c=['expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','value','start','end','Tag','map','clause','and','tags','ids','User','user','skip','some','name','compact','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','order','DESC','subqry.','findAll','color','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','from','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x182c,0x130));var _0xc182=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0x182c[_0x2040dd];return _0x27688f;};'use strict';var _=require('lodash');var squel=require(_0xc182('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xc182('0x1'));var utils=require(_0xc182('0x2'));var db=require(_0xc182('0x3'))['db'];function skipContactsQuery(_0x13bf91,_0x4e3a3a){var _0x1f5e5a=![];if(_0x13bf91[_0xc182('0x4')]===_0xc182('0x5')&&!_0x4e3a3a[_0xc182('0x6')]&&!_0x4e3a3a[_0xc182('0x7')]&&_0x4e3a3a[_0xc182('0x8')]!==_0xc182('0x9')){_0x1f5e5a=!![];}return _0x1f5e5a;}function getContactsSubquery(){return squel['select']()[_0xc182('0xa')]('cm_contacts','c')[_0xc182('0xb')](_0xc182('0xc'));}function applyJoinClauses(_0x4155f9,_0x5d0192){var _0x81279=_0x5d0192?'c':_0xc182('0xd');_0x4155f9['left_join'](_0xc182('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x81279+_0xc182('0xf'))[_0xc182('0x10')](_0xc182('0x11'),'ct',_0xc182('0x12')+_0x81279+'.id')[_0xc182('0x10')](_0xc182('0x13'),'t',_0xc182('0x14'));return _0x4155f9;}function addFieldsToQuery(_0x3b1011,_0xcfe471,_0x297c2f,_0x2bfaea,_0x41c101){var _0x508aee=_0x41c101?'c':_0xc182('0xd');if(!_0xcfe471){_0xcfe471=['id','firstName',_0xc182('0x15'),_0xc182('0x16'),_0xc182('0x17'),_0xc182('0x18'),_0xc182('0x19'),_0xc182('0x7'),_0xc182('0x1a'),_0xc182('0x1b'),_0xc182('0x1c'),_0xc182('0x1d'),_0xc182('0x1e')];}else if(!_0xcfe471[_0xc182('0x1f')]('id')){_0xcfe471['push']('id');}var _0x354ede=_0x297c2f&&_0x41c101||!_0x297c2f&&!_0x41c101;if(_0x2bfaea){_0x354ede=_0x2bfaea&&_0x41c101||!_0x2bfaea&&!_0x41c101;}_0xcfe471[_0xc182('0x20')](function(_0x1ca328){if(_0x1ca328===_0xc182('0x1e')){if(_0x354ede){_0x3b1011[_0xc182('0x21')](_0xc182('0x22'),_0x1ca328);}else if(_0x297c2f||_0x2bfaea){_0x3b1011[_0xc182('0x21')](_0x508aee+'.'+_0x1ca328);}}else{_0x3b1011[_0xc182('0x21')](_0x508aee+'.'+_0x1ca328);}});return _0x3b1011;}function getSqlClauses(){var _0x3b29c2={'default':squel['expr'](),'fields':squel[_0xc182('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xc182('0x23')](),'ids':null},'user':{'clause':squel[_0xc182('0x23')](),'skip':![]}};return _0x3b29c2;}function parseTagParameter(_0x60051e){var _0x23c1dc=squel[_0xc182('0x23')]();if(_0x60051e){var _0x584d63=utils[_0xc182('0x24')](_0x60051e);_0x584d63['forEach'](function(_0x5dd401){_0x23c1dc['or'](_0xc182('0x25'),'%,'+_0x5dd401+',%');});}return _0x23c1dc;}function parseSearchFilter(_0x46eec8){var _0x505bc4=squel[_0xc182('0x23')]();if(_0x46eec8){var _0x36170e=_0x46eec8[_0xc182('0x26')]('\x5c','\x5c\x5c')[_0xc182('0x26')](/'/g,'\x27\x27');if(_0x36170e[_0xc182('0x27')]('\x20')['length']>0x1){_0x505bc4['or'](_0xc182('0x28'),qs[_0xc182('0x29')](_0x36170e,!![]),null);}else{if(qs[_0xc182('0x2a')](_0x36170e)){_0x505bc4['or']('c.id\x20LIKE\x20?',_0x36170e+'%');_0x505bc4['or'](_0xc182('0x2b'),_0x36170e+'%');_0x505bc4['or'](_0xc182('0x2c'),_0x36170e+'%');_0x505bc4['or'](_0xc182('0x2d'),_0x36170e+'%');}else if(qs[_0xc182('0x2e')](_0x36170e)){_0x505bc4['or'](_0xc182('0x2f'),_0x36170e+'%');}else{_0x505bc4['or'](_0xc182('0x30'),'%'+_0x36170e+'%');_0x505bc4['or'](_0xc182('0x31'),'%'+_0x36170e+'%');_0x505bc4['or'](_0xc182('0x2f'),'%'+_0x36170e+'%');}}}return _0x505bc4;}function parseAdvancedSearchFilter(_0x796224,_0x1c86d9){var _0x350766=getSqlClauses();var _0x2f0639=as[_0xc182('0x32')](_0x796224);var _0x409425=_0x2f0639[_0xc182('0x33')];for(var _0x521d5f=0x0;_0x521d5f<_0x2f0639[_0xc182('0x34')][_0xc182('0x35')];_0x521d5f++){var _0x33d8b6=_0x2f0639[_0xc182('0x34')][_0x521d5f];var _0x156d6c='c';var _0x180ee9=_['find'](_0x1c86d9,['name',_0x33d8b6['field']]);if(_0x180ee9){if(_0x33d8b6['field']===_0xc182('0x36')||_0x180ee9[_0xc182('0x37')]===_0xc182('0x38')){_0x33d8b6[_0xc182('0x39')]='DATE';}var _0x5d15da=as[_0xc182('0x3a')](_0x156d6c,_0x180ee9[_0xc182('0x3b')],_0x33d8b6);_0x350766[_0xc182('0x3c')][_0x409425](_0x5d15da['text'],_0x5d15da[_0xc182('0x3d')][_0xc182('0x3e')],_0x5d15da[_0xc182('0x3d')][_0xc182('0x3f')]);}else{if(_0x33d8b6[_0xc182('0x21')]===_0xc182('0x40')){var _0x103861=_0x33d8b6[_0xc182('0x3d')][_0xc182('0x27')](',')[_0xc182('0x41')](function(_0x4c17e8){return Number(_0x4c17e8);});var _0x4de9e8=parseTagParameter(_0x103861);_0x350766['tags'][_0xc182('0x42')][_0xc182('0x43')](_0x4de9e8);_0x350766[_0xc182('0x44')][_0xc182('0x45')]=_0x103861;}else if(_0x33d8b6['field']===_0xc182('0x46')){_0x350766[_0xc182('0x47')]['clause'][_0xc182('0x43')]('uc.UserId\x20=\x20?',_0x33d8b6[_0xc182('0x3d')]);_0x350766[_0xc182('0x47')][_0xc182('0x48')]=!![];}}}return _0x350766;}function parseModelFields(_0x5787e8,_0x16d8a2){var _0x168f86=squel[_0xc182('0x23')]();var _0x133be8=_(_0x5787e8)['keys']()[_0xc182('0x41')](function(_0x4a878c){return _[_0xc182('0x49')](_0x16d8a2,[_0xc182('0x4a'),_0x4a878c])?_0x4a878c:undefined;})[_0xc182('0x4b')]()[_0xc182('0x3d')]();if(_0x5787e8['Contact']){_0x133be8['push'](_0xc182('0x4c'));}if(_0x5787e8[_0xc182('0x46')]){_0x133be8[_0xc182('0x4d')](_0xc182('0x46'));}if(_0x133be8[_0xc182('0x35')]>0x0){_0x133be8[_0xc182('0x20')](function(_0x275c48){if(_0x275c48===_0xc182('0x7')){_0x168f86[_0xc182('0x43')]('c.ListId\x20IN\x20?',[][_0xc182('0x4e')](_0x5787e8[_0x275c48]));}else if(_0x275c48===_0xc182('0x4c')){var _0x59e9db='%'+_0x5787e8[_0x275c48]+'%';_0x168f86[_0xc182('0x43')](_0xc182('0x4f'),_0x59e9db);}else if(_0x275c48==='User'){_0x168f86[_0xc182('0x43')](_0xc182('0x50'),_0x5787e8[_0x275c48]);}else{_0x168f86[_0xc182('0x43')]('c.'+_0x275c48+_0xc182('0x51'),_0x5787e8[_0x275c48]);}});}return _0x168f86;}function parseQueryParameters(_0x30ecdd,_0x41df30){var _0x4d2514=getSqlClauses();return Promise[_0xc182('0x52')]()[_0xc182('0x53')](function(){return parseModelFields(_0x30ecdd,_0x41df30);})['then'](function(_0x4d5d4a){_0x4d2514[_0xc182('0x54')]['and'](_0x4d5d4a);return parseTagParameter(_0x30ecdd[_0xc182('0x55')]);})[_0xc182('0x53')](function(_0x1aa280){_0x4d2514[_0xc182('0x44')][_0xc182('0x42')][_0xc182('0x43')](_0x1aa280);return parseSearchFilter(_0x30ecdd[_0xc182('0x56')]);})[_0xc182('0x53')](function(_0x1dca0d){_0x4d2514[_0xc182('0x56')]=_0x1dca0d;return _0x4d2514;});}function checkListsRestrictions(_0x27d3b2,_0x57419d,_0x1e6b16){var _0x506833=squel[_0xc182('0x23')]();return Promise[_0xc182('0x52')]()[_0xc182('0x53')](function(){if(_0x57419d[_0xc182('0x6')]&&_0x27d3b2[_0xc182('0x4')]===_0xc182('0x5')&&!_0x1e6b16){return _0x27d3b2[_0xc182('0x57')]({'attributes':['id'],'raw':!![]});}})[_0xc182('0x53')](function(_0x13e29c){if(_0x13e29c){if(_0x13e29c['length']===0x0){_0x506833[_0xc182('0x43')](_0xc182('0x58'));}else{_0x506833[_0xc182('0x43')](_0xc182('0x59'),_[_0xc182('0x41')](_0x13e29c,'id'));}}})['then'](function(){return _0x506833;});}function buildContactsQuery(_0x3920b2,_0x4e4c43,_0x3bb102,_0x3bf5ed,_0x3475c2,_0x26256b){if(_0x4e4c43){_0x4e4c43=_0x3bb102[_0xc182('0x5a')];}_0x3920b2=addFieldsToQuery(_0x3920b2,_0x4e4c43,_0x3bf5ed,_0x26256b,!![]);var _0x397159=squel['select']();_0x397159=addFieldsToQuery(_0x397159,_0x4e4c43,_0x3bf5ed,_0x26256b,![]);if(_0x3bf5ed||_0x26256b){_0x3920b2=applyJoinClauses(_0x3920b2,!![]);_0x3920b2[_0xc182('0x5b')](_0xc182('0x5c'));if(_0x3bb102[_0xc182('0x5d')]){_0x397159[_0xc182('0x5d')](_0x3bb102[_0xc182('0x5d')]);}if(_0x3bb102['offset']){_0x397159[_0xc182('0x5e')](_0x3bb102['offset']);}}else{_0x397159=applyJoinClauses(_0x397159,![]);_0x397159[_0xc182('0x5b')]('subqry.id');if(_0x3bb102['limit']){_0x3920b2[_0xc182('0x5d')](_0x3bb102[_0xc182('0x5d')]);}if(_0x3bb102[_0xc182('0x5e')]){_0x3920b2[_0xc182('0x5e')](_0x3bb102['offset']);}}_0x397159['having'](_0x3475c2);if(_0x3bb102[_0xc182('0x5f')]){_0x3bb102['order'][_0xc182('0x20')](function(_0x491562){_0x3920b2[_0xc182('0x5f')]('c.'+_0x491562[0x0],_0x491562[0x1]===_0xc182('0x60')?![]:!![]);_0x397159[_0xc182('0x5f')](_0xc182('0x61')+_0x491562[0x0],_0x491562[0x1]===_0xc182('0x60')?![]:!![]);});}_0x397159[_0xc182('0xa')](_0x3920b2,_0xc182('0xd'));return _0x397159;}function getFilteredContacts(_0x4cbb18){var _0x2e2830=[];return db[_0xc182('0x40')][_0xc182('0x62')]({'attributes':['id','name',_0xc182('0x63')],'raw':!![]})[_0xc182('0x53')](function(_0x4538c1){_0x2e2830=_['keyBy'](_0x4538c1,'id');var _0x48f751={'type':db[_0xc182('0x64')]['QueryTypes'][_0xc182('0x65')],'model':db[_0xc182('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xc182('0x67')][_0xc182('0x68')](_0x4cbb18[_0xc182('0x69')](),_0x48f751);})[_0xc182('0x53')](function(_0x668dca){_0x668dca[_0xc182('0x20')](function(_0x5e7600){if(_0x5e7600[_0xc182('0x1e')]){_0x5e7600[_0xc182('0x6a')]=[];_0x5e7600[_0xc182('0x1e')][_0xc182('0x27')](',')[_0xc182('0x20')](function(_0x373c2d){_0x5e7600[_0xc182('0x6a')]['push'](_0x2e2830[_0x373c2d]);});}delete _0x5e7600[_0xc182('0x1e')];});return _0x668dca;});}function countFilteredContacts(_0xd9e312,_0x3209c2){var _0x8cd609=_0xd9e312[_0xc182('0x6b')]();_0x8cd609['field'](_0xc182('0x6c'));_0x8cd609=applyJoinClauses(_0x8cd609,!![]);_0xd9e312[_0xc182('0x5b')](_0xc182('0x5c'));var _0x389130=utils[_0xc182('0x24')](_0x3209c2);if(!_[_0xc182('0x6d')](_0x389130)){_0x8cd609['where'](_0xc182('0x6e'),_0x389130);}var _0x172105={'type':db['Sequelize'][_0xc182('0x6f')]['SELECT'],'raw':!![]};return db[_0xc182('0x67')][_0xc182('0x68')](_0x8cd609['toString'](),_0x172105)[_0xc182('0x53')](function(_0x24fd7b){return _0x24fd7b[0x0][_0xc182('0x6c')];});}module[_0xc182('0x70')]={'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 9db138e..99e947e 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 _0x80e3=['close','unlink','createReadStream','createDecipher','final','encryptString','base64','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x80e3,0x17f));var _0x380e=function(_0x4491b,_0x599c94){_0x4491b=_0x4491b-0x0;var _0x88cdf3=_0x80e3[_0x4491b];return _0x88cdf3;};'use strict';var crypto=require(_0x380e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x380e('0x1'));var config=require(_0x380e('0x2'));var logger=require(_0x380e('0x3'))(_0x380e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x380e('0x5')][_0x380e('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x380e('0x7')};if(config['encrypt']&&config[_0x380e('0x8')][_0x380e('0x9')]){var isSupported=isAlgorithmSupported(config[_0x380e('0x8')][_0x380e('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x380e('0x8')][_0x380e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x380e('0xa')](',\x20');logger[_0x380e('0xb')](config[_0x380e('0x8')][_0x380e('0x9')],_0x380e('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0xdc6344){return AES_SUPPORTED_RX[_0x380e('0xd')](_0xdc6344);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x380e('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0xa481c4){return getSupportedCiphers()[_0x380e('0xf')](_0xa481c4)>-0x1;}function combineOptions(_0x1ec806){var _0x595282={};for(var _0x38605d in fileOptions){if(fileOptions[_0x380e('0x10')](_0x38605d)){_0x595282[_0x38605d]=fileOptions[_0x38605d];}}if(_0x1ec806){for(var _0x31ce1f in _0x1ec806){if(_0x1ec806['hasOwnProperty'](_0x31ce1f)){_0x595282[_0x31ce1f]=_0x1ec806[_0x31ce1f];}}}return _0x595282;}exports[_0x380e('0x11')]=function(_0x30e89e,_0x6847a,_0x368fa6,_0x45d99c){return new BPromise(function(_0x1f6657,_0x2305cb){_0x45d99c=combineOptions(_0x45d99c);var _0x8e94e2=new Buffer(_0x368fa6);var _0x1b491a=fs['createReadStream'](_0x30e89e);var _0x22faa5=fs[_0x380e('0x12')](_0x6847a);var _0x389bbc=crypto[_0x380e('0x13')](_0x45d99c[_0x380e('0x9')],_0x8e94e2);_0x1b491a['on'](_0x380e('0x14'),function(_0x3d8714){var _0x2b197f=new Buffer(_0x389bbc[_0x380e('0x15')](_0x3d8714),_0x380e('0x16'));_0x22faa5[_0x380e('0x17')](_0x2b197f);});_0x1b491a['on'](_0x380e('0x18'),function(){try{var _0x561698=new Buffer(_0x389bbc['final'](_0x380e('0x16')),_0x380e('0x16'));_0x22faa5[_0x380e('0x17')](_0x561698);_0x22faa5[_0x380e('0x18')]();_0x22faa5['on'](_0x380e('0x19'),function(){return _0x1f6657(_0x6847a);});}catch(_0x49b188){fs[_0x380e('0x1a')](_0x6847a);return _0x2305cb(_0x49b188);}});});};exports['decryptFile']=function(_0x494565,_0x36e1fa,_0x38793a,_0x2decd3){return new BPromise(function(_0x2128a4,_0x3ceaf5){_0x2decd3=combineOptions(_0x2decd3);var _0x3132b4=new Buffer(_0x38793a);var _0x54741e=fs[_0x380e('0x1b')](_0x494565);var _0x5c85aa=fs[_0x380e('0x12')](_0x36e1fa);var _0x4f3a4f=crypto[_0x380e('0x1c')](_0x2decd3[_0x380e('0x9')],_0x3132b4);_0x54741e['on'](_0x380e('0x14'),function(_0x296c72){var _0x1ec422=new Buffer(_0x4f3a4f[_0x380e('0x15')](_0x296c72),'binary');_0x5c85aa['write'](_0x1ec422);});_0x54741e['on'](_0x380e('0x18'),function(){try{var _0x1f38c3=new Buffer(_0x4f3a4f[_0x380e('0x1d')](_0x380e('0x16')),_0x380e('0x16'));_0x5c85aa['write'](_0x1f38c3);_0x5c85aa['end']();_0x5c85aa['on'](_0x380e('0x19'),function(){return _0x2128a4(_0x36e1fa);});}catch(_0x450b2f){fs[_0x380e('0x1a')](_0x36e1fa);return _0x3ceaf5(_0x450b2f);}});});};exports[_0x380e('0x1e')]=function(_0x5b8c22,_0x316b9b,_0x4afafc){var _0x4aeba3=_0x4afafc||stringOptions['algorithm'];var _0x48c437=_0x316b9b||stringOptions['secret'];var _0x497522=crypto['createCipher'](_0x4aeba3,_0x48c437);var _0x2d7871=_0x497522[_0x380e('0x15')](_0x5b8c22,'utf8',_0x380e('0x1f'));_0x2d7871+=_0x497522[_0x380e('0x1d')](_0x380e('0x1f'));return _0x2d7871;};exports['decryptString']=function(_0x43f7de,_0x41a86b,_0x2f076f){var _0x4d1367=_0x2f076f||stringOptions[_0x380e('0x9')];var _0xee9ded=_0x41a86b||stringOptions[_0x380e('0x20')];var _0x1414f9=crypto[_0x380e('0x1c')](_0x4d1367,_0xee9ded);var _0x4907ee=_0x1414f9[_0x380e('0x15')](_0x43f7de,_0x380e('0x1f'),_0x380e('0x21'));_0x4907ee+=_0x1414f9[_0x380e('0x1d')]('utf8');return _0x4907ee;}; \ No newline at end of file +var _0x7d4b=['data','update','binary','write','final','end','close','unlink','decryptFile','createDecipher','encryptString','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x585c73,_0x66b25d){var _0xb13a96=function(_0x130f59){while(--_0x130f59){_0x585c73['push'](_0x585c73['shift']());}};_0xb13a96(++_0x66b25d);}(_0x7d4b,0xa2));var _0xb7d4=function(_0x15fc67,_0x18be2f){_0x15fc67=_0x15fc67-0x0;var _0x3a709f=_0x7d4b[_0x15fc67];return _0x3a709f;};'use strict';var crypto=require(_0xb7d4('0x0'));var fs=require('fs');var BPromise=require(_0xb7d4('0x1'));var _=require(_0xb7d4('0x2'));var config=require(_0xb7d4('0x3'));var logger=require(_0xb7d4('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb7d4('0x5')][_0xb7d4('0x6')],'algorithm':_0xb7d4('0x7')};const fileOptions={'algorithm':_0xb7d4('0x8')};if(config[_0xb7d4('0x9')]&&config[_0xb7d4('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xb7d4('0xa')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb7d4('0xb')](',\x20');logger[_0xb7d4('0xc')](config[_0xb7d4('0x9')]['algorithm'],_0xb7d4('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x50a3c3){return AES_SUPPORTED_RX[_0xb7d4('0xe')](_0x50a3c3);}function getSupportedCiphers(){return crypto[_0xb7d4('0xf')]()[_0xb7d4('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0xb5139){return getSupportedCiphers()[_0xb7d4('0x11')](_0xb5139)>-0x1;}function combineOptions(_0x5ba857){var _0x295ca4={};for(var _0x2dbf17 in fileOptions){if(fileOptions[_0xb7d4('0x12')](_0x2dbf17)){_0x295ca4[_0x2dbf17]=fileOptions[_0x2dbf17];}}if(_0x5ba857){for(var _0x2bc5f3 in _0x5ba857){if(_0x5ba857[_0xb7d4('0x12')](_0x2bc5f3)){_0x295ca4[_0x2bc5f3]=_0x5ba857[_0x2bc5f3];}}}return _0x295ca4;}exports[_0xb7d4('0x13')]=function(_0x53219e,_0xbdff53,_0xdc59a,_0x24286f){return new BPromise(function(_0x37be62,_0x2fc4e7){_0x24286f=combineOptions(_0x24286f);var _0x24538c=new Buffer(_0xdc59a);var _0xa88a63=fs[_0xb7d4('0x14')](_0x53219e);var _0x376fa8=fs[_0xb7d4('0x15')](_0xbdff53);var _0x16ec0b=crypto[_0xb7d4('0x16')](_0x24286f[_0xb7d4('0xa')],_0x24538c);_0xa88a63['on'](_0xb7d4('0x17'),function(_0x42e4bb){var _0x11931f=new Buffer(_0x16ec0b[_0xb7d4('0x18')](_0x42e4bb),_0xb7d4('0x19'));_0x376fa8[_0xb7d4('0x1a')](_0x11931f);});_0xa88a63['on']('end',function(){try{var _0x3d86af=new Buffer(_0x16ec0b[_0xb7d4('0x1b')](_0xb7d4('0x19')),_0xb7d4('0x19'));_0x376fa8['write'](_0x3d86af);_0x376fa8[_0xb7d4('0x1c')]();_0x376fa8['on'](_0xb7d4('0x1d'),function(){return _0x37be62(_0xbdff53);});}catch(_0x597f47){fs[_0xb7d4('0x1e')](_0xbdff53);return _0x2fc4e7(_0x597f47);}});});};exports[_0xb7d4('0x1f')]=function(_0x1a8304,_0x1e1f1a,_0x192747,_0x29770b){return new BPromise(function(_0x1b4d5d,_0x4ac2e1){_0x29770b=combineOptions(_0x29770b);var _0x333635=new Buffer(_0x192747);var _0x55f1b0=fs['createReadStream'](_0x1a8304);var _0x56a4ab=fs[_0xb7d4('0x15')](_0x1e1f1a);var _0x1907b4=crypto[_0xb7d4('0x20')](_0x29770b[_0xb7d4('0xa')],_0x333635);_0x55f1b0['on'](_0xb7d4('0x17'),function(_0x7a6ad7){var _0x3a57de=new Buffer(_0x1907b4[_0xb7d4('0x18')](_0x7a6ad7),_0xb7d4('0x19'));_0x56a4ab[_0xb7d4('0x1a')](_0x3a57de);});_0x55f1b0['on'](_0xb7d4('0x1c'),function(){try{var _0x69c59b=new Buffer(_0x1907b4['final']('binary'),_0xb7d4('0x19'));_0x56a4ab[_0xb7d4('0x1a')](_0x69c59b);_0x56a4ab[_0xb7d4('0x1c')]();_0x56a4ab['on']('close',function(){return _0x1b4d5d(_0x1e1f1a);});}catch(_0x3b1113){fs[_0xb7d4('0x1e')](_0x1e1f1a);return _0x4ac2e1(_0x3b1113);}});});};exports[_0xb7d4('0x21')]=function(_0xc757e5,_0x241b00,_0x154bad){var _0x578b42=_0x154bad||stringOptions[_0xb7d4('0xa')];var _0x3df2ee=_0x241b00||stringOptions['secret'];var _0x519b16=crypto[_0xb7d4('0x16')](_0x578b42,_0x3df2ee);var _0x378ce0=_0x519b16[_0xb7d4('0x18')](_0xc757e5,_0xb7d4('0x22'),_0xb7d4('0x23'));_0x378ce0+=_0x519b16['final'](_0xb7d4('0x23'));return _0x378ce0;};exports[_0xb7d4('0x24')]=function(_0x239312,_0x6146ec,_0x3e8a7f){var _0x3d0faf=_0x3e8a7f||stringOptions[_0xb7d4('0xa')];var _0x47f1e8=_0x6146ec||stringOptions['secret'];var _0x1aa8f6=crypto[_0xb7d4('0x20')](_0x3d0faf,_0x47f1e8);var _0x16a0a8=_0x1aa8f6[_0xb7d4('0x18')](_0x239312,'base64','utf8');_0x16a0a8+=_0x1aa8f6[_0xb7d4('0x1b')]('utf8');return _0x16a0a8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4a3f387..66a931a 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 _0x8d5f=['forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','to-csv','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','info','CSV','Setting','find','split','splitSizeCsv','then','query','format','QueryTypes','SELECT','num','Empty','length','range','isInteger'];(function(_0x28b5ff,_0x3e774e){var _0x17db93=function(_0x54568a){while(--_0x54568a){_0x28b5ff['push'](_0x28b5ff['shift']());}};_0x17db93(++_0x3e774e);}(_0x8d5f,0x74));var _0xf8d5=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x8d5f[_0x35af23];return _0x340506;};'use strict';var util=require(_0xf8d5('0x0'));var path=require('path');var _=require(_0xf8d5('0x1'));var csv=require(_0xf8d5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xf8d5('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf8d5('0x4'))[_0xf8d5('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf8d5('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59c107,_0x5abb9f){var _0x2c1345={'status':_0x59c107};var _0x9379f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5abb9f){_0x2c1345[_0xf8d5('0x7')]=_0x5abb9f;}return db[_0xf8d5('0x8')]['update'](_0x2c1345,_0x9379f6);}function main(){var _0xf5b00=0x1388;var _0x1f8e78;logger[_0xf8d5('0x9')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf8d5('0xa')));return db[_0xf8d5('0xb')][_0xf8d5('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf8d5('0xd'),'splitSizeCsv']})['then'](function(_0x301623){if(_0x301623){_0x1f8e78=_0x301623;_0xf5b00=_0x1f8e78[_0xf8d5('0xe')]||0x1388;}})[_0xf8d5('0xf')](function(){return dbH['sequelize'][_0xf8d5('0x10')](util[_0xf8d5('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]});})[_0xf8d5('0xf')](function(_0x2fa373){if(!_0x2fa373[0x0][_0xf8d5('0x14')]){return analyticExtractedReport(_0xf8d5('0x15'));}var _0x288370=[];var _0xe30b3d=0x0;if(_0x1f8e78[_0xf8d5('0xd')]){if(_0x2fa373&&_0x2fa373[_0xf8d5('0x16')]){var _0x3e3794=_[_0xf8d5('0x17')](_0x2fa373[0x0][_0xf8d5('0x14')]/_0xf5b00);var _0x34c0b2=Number[_0xf8d5('0x18')](_0x2fa373[0x0][_0xf8d5('0x14')]/_0xf5b00)?_0x2fa373[0x0][_0xf8d5('0x14')]%_0xf5b00:0x0;_0x3e3794[_0xf8d5('0x19')](function(_0x21ece3){if(_0x21ece3>0x0){_0xe30b3d+=_0xf5b00;}_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf5b00,_0xe30b3d),{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]}));});if(_0x34c0b2>0x0){_0xe30b3d+=_0xf5b00;_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')]['query'](util[_0xf8d5('0x11')](_0xf8d5('0x1c'),QUERY,_0x34c0b2,_0xe30b3d),{'type':dbH[_0xf8d5('0x1b')]['QueryTypes'][_0xf8d5('0x13')]}));}}}else{_0x288370[_0xf8d5('0x1a')](dbH[_0xf8d5('0x1b')][_0xf8d5('0x10')](QUERY,{'type':dbH['sequelize'][_0xf8d5('0x12')][_0xf8d5('0x13')]}));}var _0x20f807=path[_0xf8d5('0x1d')](PATH);var _0x110a71=path[_0xf8d5('0x1e')](PATH,_0xf8d5('0x1f'));var _0x1a495f=_0x1f8e78['split']&&_0x288370[_0xf8d5('0x16')]>0x1;var _0x79c8c9=[];if(!fs['existsSync'](path[_0xf8d5('0x20')](_0x20f807,_0x110a71))&&_0x1a495f){fs['mkdirSync'](path[_0xf8d5('0x20')](_0x20f807,_0x110a71));}return BPromise[_0xf8d5('0x21')](_0x288370,function(_0x56979a){_0x79c8c9['push'](_0x56979a);})['then'](function(){for(var _0x239663=0x0;_0x239663<_0x79c8c9[_0xf8d5('0x16')];_0x239663+=0x1){var _0x37537d;var _0xacbaee=_0x79c8c9[_0x239663];if(_0x1a495f){_0x37537d=path[_0xf8d5('0x20')](_0x20f807,_0x110a71,util[_0xf8d5('0x11')](_0xf8d5('0x22'),_0x110a71,_0x239663,_0xf8d5('0x23')));}else{_0x37537d=path[_0xf8d5('0x20')](_0x20f807,util[_0xf8d5('0x11')](_0xf8d5('0x24'),_0x110a71,_0xf8d5('0x23')));}fs[_0xf8d5('0x25')](_0x37537d,csv(_0xacbaee));}})[_0xf8d5('0xf')](function(){if(_0x1a495f){return new Promise(function(_0x4e7dce){zipdir(path[_0xf8d5('0x20')](_0x20f807,_0x110a71),{'saveTo':path['join'](_0x20f807,util[_0xf8d5('0x11')]('%s.%s',_0x110a71,_0xf8d5('0x26')))},function(_0x3a05d7,_0x5c686b){rimraf(path[_0xf8d5('0x20')](_0x20f807,_0x110a71),function(){});_0x4e7dce(_0xf8d5('0x27'));});});}})['then'](function(){logger[_0xf8d5('0x9')](util[_0xf8d5('0x11')](_0xf8d5('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf8d5('0x29'),_0x1a495f?util[_0xf8d5('0x11')](_0xf8d5('0x24'),_0x110a71,_0x1a495f?'zip':_0xf8d5('0x23')):null);});})[_0xf8d5('0x2a')](function(_0x31f5ef){logger[_0xf8d5('0x9')](util['format'](_0xf8d5('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0xf8d5('0x2c')](_0x31f5ef,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf8d5('0x2d')](function(){process[_0xf8d5('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xce3c=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','QueryTypes','num','Empty','length','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','existsSync','join','mkdirSync','csv','%s.%s','zip','zip\x20finished','info','Completed'];(function(_0x23b5eb,_0xde940a){var _0xaa62d7=function(_0x395acb){while(--_0x395acb){_0x23b5eb['push'](_0x23b5eb['shift']());}};_0xaa62d7(++_0xde940a);}(_0xce3c,0x175));var _0xcce3=function(_0x2573f7,_0x1200bc){_0x2573f7=_0x2573f7-0x0;var _0x57740d=_0xce3c[_0x2573f7];return _0x57740d;};'use strict';var util=require(_0xcce3('0x0'));var path=require('path');var _=require(_0xcce3('0x1'));var csv=require(_0xcce3('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xcce3('0x3'));var rimraf=require(_0xcce3('0x4'));var db=require(_0xcce3('0x5'))['db'];var dbH=require(_0xcce3('0x5'))[_0xcce3('0x6')];var logger=require(_0xcce3('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xcce3('0x8')][0x3];var PATH=process[_0xcce3('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x24a2a7,_0x5ba155){var _0x5ae141={'status':_0x24a2a7};var _0x1c2781={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ba155){_0x5ae141[_0xcce3('0x9')]=_0x5ba155;}return db[_0xcce3('0xa')][_0xcce3('0xb')](_0x5ae141,_0x1c2781);}function main(){var _0x1266e6=0x1388;var _0x2d9454;logger['info'](util[_0xcce3('0xc')](_0xcce3('0xd'),EXTRACTED_REPORT_ID,_0xcce3('0xe')));return db[_0xcce3('0xf')][_0xcce3('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcce3('0x11'),_0xcce3('0x12')]})[_0xcce3('0x13')](function(_0x2e750c){if(_0x2e750c){_0x2d9454=_0x2e750c;_0x1266e6=_0x2d9454[_0xcce3('0x12')]||0x1388;}})[_0xcce3('0x13')](function(){return dbH['sequelize']['query'](util[_0xcce3('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcce3('0x14')][_0xcce3('0x15')]['SELECT']});})['then'](function(_0xdc7db8){if(!_0xdc7db8[0x0][_0xcce3('0x16')]){return analyticExtractedReport(_0xcce3('0x17'));}var _0x3562e4=[];var _0x5b7f3c=0x0;if(_0x2d9454[_0xcce3('0x11')]){if(_0xdc7db8&&_0xdc7db8[_0xcce3('0x18')]){var _0x385d5c=_['range'](_0xdc7db8[0x0]['num']/_0x1266e6);var _0x21809=Number['isInteger'](_0xdc7db8[0x0][_0xcce3('0x16')]/_0x1266e6)?_0xdc7db8[0x0][_0xcce3('0x16')]%_0x1266e6:0x0;_0x385d5c[_0xcce3('0x19')](function(_0x8002a4){if(_0x8002a4>0x0){_0x5b7f3c+=_0x1266e6;}_0x3562e4[_0xcce3('0x1a')](dbH[_0xcce3('0x14')][_0xcce3('0x1b')](util[_0xcce3('0xc')](_0xcce3('0x1c'),QUERY,_0x1266e6,_0x5b7f3c),{'type':dbH[_0xcce3('0x14')][_0xcce3('0x15')][_0xcce3('0x1d')]}));});if(_0x21809>0x0){_0x5b7f3c+=_0x1266e6;_0x3562e4[_0xcce3('0x1a')](dbH[_0xcce3('0x14')][_0xcce3('0x1b')](util['format'](_0xcce3('0x1c'),QUERY,_0x21809,_0x5b7f3c),{'type':dbH[_0xcce3('0x14')]['QueryTypes'][_0xcce3('0x1d')]}));}}}else{_0x3562e4[_0xcce3('0x1a')](dbH[_0xcce3('0x14')][_0xcce3('0x1b')](QUERY,{'type':dbH['sequelize'][_0xcce3('0x15')][_0xcce3('0x1d')]}));}var _0x33c8ef=path[_0xcce3('0x1e')](PATH);var _0x3f7d12=path['basename'](PATH,_0xcce3('0x1f'));var _0x441eee=_0x2d9454['split']&&_0x3562e4[_0xcce3('0x18')]>0x1;var _0x4ee826=[];if(!fs[_0xcce3('0x20')](path[_0xcce3('0x21')](_0x33c8ef,_0x3f7d12))&&_0x441eee){fs[_0xcce3('0x22')](path[_0xcce3('0x21')](_0x33c8ef,_0x3f7d12));}return BPromise['each'](_0x3562e4,function(_0x53e6da){_0x4ee826[_0xcce3('0x1a')](_0x53e6da);})[_0xcce3('0x13')](function(){for(var _0x37cac6=0x0;_0x37cac6<_0x4ee826[_0xcce3('0x18')];_0x37cac6+=0x1){var _0x2a4ea5;var _0x48d82e=_0x4ee826[_0x37cac6];if(_0x441eee){_0x2a4ea5=path[_0xcce3('0x21')](_0x33c8ef,_0x3f7d12,util[_0xcce3('0xc')]('%s%d.%s',_0x3f7d12,_0x37cac6,_0xcce3('0x23')));}else{_0x2a4ea5=path[_0xcce3('0x21')](_0x33c8ef,util[_0xcce3('0xc')](_0xcce3('0x24'),_0x3f7d12,_0xcce3('0x23')));}fs['writeFileSync'](_0x2a4ea5,csv(_0x48d82e));}})[_0xcce3('0x13')](function(){if(_0x441eee){return new Promise(function(_0x2562c4){zipdir(path[_0xcce3('0x21')](_0x33c8ef,_0x3f7d12),{'saveTo':path[_0xcce3('0x21')](_0x33c8ef,util[_0xcce3('0xc')](_0xcce3('0x24'),_0x3f7d12,_0xcce3('0x25')))},function(_0x2ca5a3,_0x2161a5){rimraf(path[_0xcce3('0x21')](_0x33c8ef,_0x3f7d12),function(){});_0x2562c4(_0xcce3('0x26'));});});}})['then'](function(){logger[_0xcce3('0x27')](util[_0xcce3('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xcce3('0x28'),_0x441eee?util[_0xcce3('0xc')](_0xcce3('0x24'),_0x3f7d12,_0x441eee?_0xcce3('0x25'):_0xcce3('0x23')):null);});})[_0xcce3('0x29')](function(_0x2811c1){logger[_0xcce3('0x27')](util[_0xcce3('0xc')](_0xcce3('0x2a'),EXTRACTED_REPORT_ID,_0xcce3('0xe')),util['inspect'](_0x2811c1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcce3('0x2b'));})[_0xcce3('0x2c')](function(){process[_0xcce3('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2f19fcd..d6a910e 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 _0x09af=['landscape','\x20/\x20','Arial','right','num','Empty','Setting','find','split','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s.%s','pdf','all','then','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','before','margin'];(function(_0x383028,_0x2fae0e){var _0xf358cc=function(_0x48f3bb){while(--_0x48f3bb){_0x383028['push'](_0x383028['shift']());}};_0xf358cc(++_0x2fae0e);}(_0x09af,0xee));var _0xf09a=function(_0x334748,_0x22a885){_0x334748=_0x334748-0x0;var _0x1b56c7=_0x09af[_0x334748];return _0x1b56c7;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xf09a('0x0'));var path=require(_0xf09a('0x1'));var moment=require(_0xf09a('0x2'));var htmlToPdfmake=require(_0xf09a('0x3'));var PdfPrinter=require(_0xf09a('0x4'));var zipdir=require(_0xf09a('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xf09a('0x6'))[_0xf09a('0x7')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0xf09a('0x8'))['db'];var dbH=require(_0xf09a('0x8'))[_0xf09a('0x9')];var logger=require(_0xf09a('0xa'))(_0xf09a('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xf09a('0xc')][0x2]);var QUERY=process[_0xf09a('0xc')][0x3];var PATH=process[_0xf09a('0xc')][0x4];var NAME=process[_0xf09a('0xc')][0x5];var FORMAT=_0xf09a('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x593c30,_0x3bf8fd){var _0x2d12ad={'status':_0x593c30};var _0x4f71ae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bf8fd){_0x2d12ad[_0xf09a('0xe')]=_0x3bf8fd;}return db[_0xf09a('0xf')][_0xf09a('0x10')](_0x2d12ad,_0x4f71ae);}function getHeaders(_0xc9077a){return _[_0xf09a('0x11')](_0xc9077a,function(_0x2d7faa){return{'text':_0x2d7faa,'style':_0xf09a('0x12')};});}function getRows(_0x29b90f,_0x1ff4dc){return _[_0xf09a('0x11')](_0x1ff4dc,function(_0x2f9b8e){return _(_0x2f9b8e)[_0xf09a('0x13')](_0x29b90f)[_0xf09a('0x11')](function(_0x1233ee){return _0x1233ee?_[_0xf09a('0x14')](_0x1233ee):'';})[_0xf09a('0x15')]();});}function createTable(_0x51f57d,_0x6fa67b){var _0x3c8a85={'widths':_[_0xf09a('0x16')](Array(_0x51f57d[_0xf09a('0x17')]),0x91),'heights':function(_0x3882e6){return _0x3882e6===0x0?_0xf09a('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3e0c53=getHeaders(_0x51f57d);_0x3c8a85[_0xf09a('0x19')][_0xf09a('0x1a')](_0x3e0c53);var _0x3cd3c0=getRows(_0x51f57d,_0x6fa67b);_0x3c8a85[_0xf09a('0x19')]=_0x3c8a85['body'][_0xf09a('0x1b')](_0x3cd3c0);return _0x3c8a85;}function createTables(_0x49e89c){var _0x4109fb=[];var _0x31e2a2=_[_0xf09a('0x1c')](Object[_0xf09a('0x1d')](_0x49e89c[0x0]),0x5);_0x31e2a2[_0xf09a('0x1e')](function(_0x568d46){_0x4109fb[_0xf09a('0x1a')](createTable(_0x568d46,_0x49e89c));});return _0x4109fb;}function getPDFDocDefinition(_0xc2d999){var _0x298349=util[_0xf09a('0x1f')](_0xf09a('0x20'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xf09a('0x21')])[_0xf09a('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xf09a('0x22')])[_0xf09a('0x1f')](FORMAT));var _0x56dc66=[];for(var _0x556268=0x0;_0x556268<_0xc2d999[_0xf09a('0x17')];_0x556268++){var _0x353155=[];if(_0x556268===0x0){_0x353155['push']({'text':_0x298349,'style':_0xf09a('0x23')});}var _0x408918={'table':_0xc2d999[_0x556268]};if(_0x556268>0x0){_0x408918['pageBreak']=_0xf09a('0x24');_0x408918[_0xf09a('0x25')]=[0x0,0x46,0x0,0x0];}_0x353155['push'](_0x408918);_0x56dc66[_0xf09a('0x1a')](_0x353155);}return{'pageSize':'A4','pageOrientation':_0xf09a('0x26'),'content':_0x56dc66,'footer':function(_0x4d748f,_0x267865){return{'text':_0x4d748f[_0xf09a('0x14')]()+_0xf09a('0x27')+_0x267865,'style':'footer'};},'defaultStyle':{'font':_0xf09a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xf09a('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5d6823){var _0x304895=0x1388;var _0x527b12;if(!_0x5d6823[0x0][_0xf09a('0x2a')]){return analyticExtractedReport(_0xf09a('0x2b'));}return db[_0xf09a('0x2c')][_0xf09a('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf09a('0x2e'),_0xf09a('0x2f')]})['then'](function(_0x1e9218){if(_0x1e9218){_0x527b12=_0x1e9218;_0x304895=_0x527b12[_0xf09a('0x2f')]||0x3e8;}})['then'](function(){var _0x2932ce=[];var _0x20123c=0x0;if(_0x527b12['split']){if(_0x5d6823&&_0x5d6823['length']){var _0x397589=_[_0xf09a('0x30')](_0x5d6823[0x0]['num']/_0x304895);var _0x42d8b2=Number[_0xf09a('0x31')](_0x5d6823[0x0][_0xf09a('0x2a')]/_0x304895)?_0x5d6823[0x0][_0xf09a('0x2a')]%_0x304895:0x0;_0x397589[_0xf09a('0x1e')](function(_0x226626){if(_0x226626>0x0){_0x20123c+=_0x304895;}_0x2932ce[_0xf09a('0x1a')](dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')](_0xf09a('0x34'),QUERY,_0x304895,_0x20123c),{'type':dbH[_0xf09a('0x32')]['QueryTypes']['SELECT']}));});if(_0x42d8b2>0x0){_0x20123c+=_0x304895;_0x2932ce[_0xf09a('0x1a')](dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')](_0xf09a('0x34'),QUERY,_0x42d8b2,_0x20123c),{'type':dbH[_0xf09a('0x32')][_0xf09a('0x35')][_0xf09a('0x36')]}));}}}else{_0x2932ce['push'](dbH[_0xf09a('0x32')][_0xf09a('0x33')](QUERY,{'type':dbH[_0xf09a('0x32')][_0xf09a('0x35')][_0xf09a('0x36')]}));}var _0x4581b8=path[_0xf09a('0x37')](PATH);var _0x110a4f=path[_0xf09a('0x38')](PATH,'.pdf');var _0x17498c=_0x527b12['split']&&_0x2932ce[_0xf09a('0x17')]>0x1;var _0x31bf90=[];if(!fs[_0xf09a('0x39')](path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f))&&_0x17498c){fs[_0xf09a('0x3b')](path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f));}return BPromise[_0xf09a('0x3c')](_0x2932ce,function(_0x2802e2){_0x31bf90['push'](_0x2802e2);})['then'](function(){var _0x5855a4=[];for(var _0x12cbbe=0x0;_0x12cbbe<_0x31bf90[_0xf09a('0x17')];_0x12cbbe+=0x1){var _0x179dcd=_0x31bf90[_0x12cbbe];var _0x4f8188=createTables(_[_0xf09a('0x3d')](_0x179dcd));var _0x396560;var _0x1c4360=getPDFDocDefinition(_0x4f8188);var _0x506fb4=getPDFPrinter();var _0x20c8c4=_0x506fb4[_0xf09a('0x3e')](_0x1c4360);if(_0x17498c){_0x396560=path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f,util[_0xf09a('0x1f')]('%s%d.%s',_0x110a4f,_0x12cbbe,'pdf'));}else{_0x396560=path[_0xf09a('0x3a')](_0x4581b8,util[_0xf09a('0x1f')](_0xf09a('0x3f'),_0x110a4f,_0xf09a('0x40')));}_0x5855a4[_0xf09a('0x1a')](writePDFDocument(_0x20c8c4,_0x396560));}return Promise[_0xf09a('0x41')](_0x5855a4);})[_0xf09a('0x42')](function(){if(_0x17498c){return new Promise(function(_0x1c9b51){zipdir(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),{'saveTo':path[_0xf09a('0x3a')](_0x4581b8,util[_0xf09a('0x1f')]('%s.%s',_0x110a4f,_0xf09a('0x43')))},function(){rimraf(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),function(){});_0x1c9b51(_0xf09a('0x44'));});});}})[_0xf09a('0x42')](function(){if(!_0x17498c)return;rimraf(path[_0xf09a('0x3a')](_0x4581b8,_0x110a4f),function(){});})[_0xf09a('0x42')](function(){logger[_0xf09a('0x45')](util[_0xf09a('0x1f')](_0xf09a('0x46'),EXTRACTED_REPORT_ID,_0xf09a('0x47')));return analyticExtractedReport('Completed',_0x17498c?util[_0xf09a('0x1f')]('%s.%s',_0x110a4f,_0x17498c?_0xf09a('0x43'):_0xf09a('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xf09a('0x1f')](_0xf09a('0x48'),EXTRACTED_REPORT_ID,_0xf09a('0x47')));return db[_0xf09a('0xf')][_0xf09a('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf09a('0x42')](function(_0x4eacc5){EXTRACTED_REPORT=_0x4eacc5;return dbH[_0xf09a('0x32')][_0xf09a('0x33')](util[_0xf09a('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xf09a('0x35')][_0xf09a('0x36')]});})[_0xf09a('0x42')](extractReport)[_0xf09a('0x4a')](function(_0xa40692){logger[_0xf09a('0x45')](util['format'](_0xf09a('0x4b'),EXTRACTED_REPORT_ID,_0xf09a('0x47')),util[_0xf09a('0x4c')](_0xa40692,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf09a('0x4d'));})[_0xf09a('0x4e')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x11666b=new PdfPrinter({'Arial':{'normal':__dirname+_0xf09a('0x4f'),'bold':__dirname+_0xf09a('0x50'),'italics':__dirname+_0xf09a('0x51'),'bolditalics':__dirname+_0xf09a('0x52')}});return _0x11666b;}function getPDFDocDefinitionFromHTML(_0x2e0ff7,_0x4c5759){var _0x4f3a0a=util[_0xf09a('0x1f')](_0xf09a('0x53'),_0x4c5759['channel'],_0x4c5759[_0xf09a('0x54')]);var _0x1e2d5e=moment()['format'](_0xf09a('0x55'))['toString']();var _0x146639=htmlToPdfmake(_0x2e0ff7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x146639],'defaultStyle':{'font':_0xf09a('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf09a('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xf09a('0x23')}];},'footer':function(_0x26d3a7,_0x2100d6){return[{'text':util[_0xf09a('0x1f')](_0xf09a('0x57'),_0x4f3a0a,_0x26d3a7,_0x2100d6,_0x1e2d5e),'style':_0xf09a('0x58')}];}};}function writePDFDocument(_0xb1e854,_0x5846d3){return new Promise(function(_0x234f8b,_0x47f6b5){var _0x426f4a=_0xb1e854['pipe'](fs[_0xf09a('0x59')](_0x5846d3));_0x426f4a['on'](_0xf09a('0x5a'),function(){_0x234f8b('finish');});_0x426f4a['on']('error',function(_0x43bebf){_0x47f6b5(_0x43bebf);});_0xb1e854[_0xf09a('0x5b')]();});}exports['createPdfFromHTML']=function(_0x2077bd,_0x59af2b){var _0x2681fb=getPDFPrinter();var _0x2d9ade=getPDFDocDefinitionFromHTML(_0x2077bd,_0x59af2b);var _0x3f3c5d=_0x2681fb['createPdfKitDocument'](_0x2d9ade);return writePDFDocument(_0x3f3c5d,_0x59af2b['path'])[_0xf09a('0x4a')](function(_0x3db39d){throw _0x3db39d;});}; \ No newline at end of file +var _0x4277=['pdf','%s.%s','all','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-bold.ttf','channel','interactionId','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','zip-dir','rimraf','jsdom','JSDOM','bluebird','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','then','flatten','createPdfKitDocument','%s%d.%s'];(function(_0x12fdfa,_0x15a04e){var _0x2da436=function(_0xb2d02c){while(--_0xb2d02c){_0x12fdfa['push'](_0x12fdfa['shift']());}};_0x2da436(++_0x15a04e);}(_0x4277,0x75));var _0x7427=function(_0x309957,_0x1bc114){_0x309957=_0x309957-0x0;var _0x1c37ec=_0x4277[_0x309957];return _0x1c37ec;};'use strict';var _=require(_0x7427('0x0'));var fs=require('fs');var util=require(_0x7427('0x1'));var path=require(_0x7427('0x2'));var moment=require(_0x7427('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x7427('0x4'));var rimraf=require(_0x7427('0x5'));var JSDOM=require(_0x7427('0x6'))[_0x7427('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0x7427('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x7427('0x9')];var logger=require(_0x7427('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7427('0xb')][0x2]);var QUERY=process[_0x7427('0xb')][0x3];var PATH=process[_0x7427('0xb')][0x4];var NAME=process[_0x7427('0xb')][0x5];var FORMAT=_0x7427('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x550ce8,_0x2005b3){var _0x428009={'status':_0x550ce8};var _0x1c00c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2005b3){_0x428009[_0x7427('0xd')]=_0x2005b3;}return db['AnalyticExtractedReport'][_0x7427('0xe')](_0x428009,_0x1c00c6);}function getHeaders(_0x347c13){return _[_0x7427('0xf')](_0x347c13,function(_0x1e6125){return{'text':_0x1e6125,'style':_0x7427('0x10')};});}function getRows(_0x5c411a,_0x576bf2){return _['map'](_0x576bf2,function(_0x8fd8ac){return _(_0x8fd8ac)[_0x7427('0x11')](_0x5c411a)[_0x7427('0xf')](function(_0x30056a){return _0x30056a?_[_0x7427('0x12')](_0x30056a):'';})[_0x7427('0x13')]();});}function createTable(_0x234d62,_0x26d7d7){var _0x1ea39d={'widths':_[_0x7427('0x14')](Array(_0x234d62[_0x7427('0x15')]),0x91),'heights':function(_0x1657db){return _0x1657db===0x0?_0x7427('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xac92e1=getHeaders(_0x234d62);_0x1ea39d[_0x7427('0x17')][_0x7427('0x18')](_0xac92e1);var _0x417c8c=getRows(_0x234d62,_0x26d7d7);_0x1ea39d[_0x7427('0x17')]=_0x1ea39d[_0x7427('0x17')][_0x7427('0x19')](_0x417c8c);return _0x1ea39d;}function createTables(_0x51338f){var _0x23cd3d=[];var _0x12583e=_['chunk'](Object[_0x7427('0x1a')](_0x51338f[0x0]),0x5);_0x12583e[_0x7427('0x1b')](function(_0x46efb6){_0x23cd3d['push'](createTable(_0x46efb6,_0x51338f));});return _0x23cd3d;}function getPDFDocDefinition(_0x4b2bc4){var _0x50e97e=util[_0x7427('0x1c')](_0x7427('0x1d'),NAME,EXTRACTED_REPORT[_0x7427('0x1e')],moment(EXTRACTED_REPORT[_0x7427('0x1f')])[_0x7427('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x7427('0x20')])[_0x7427('0x1c')](FORMAT));var _0xe63830=[];for(var _0x2f4708=0x0;_0x2f4708<_0x4b2bc4[_0x7427('0x15')];_0x2f4708++){var _0x1fa99b=[];if(_0x2f4708===0x0){_0x1fa99b['push']({'text':_0x50e97e,'style':_0x7427('0x21')});}var _0x15e867={'table':_0x4b2bc4[_0x2f4708]};if(_0x2f4708>0x0){_0x15e867['pageBreak']='before';_0x15e867[_0x7427('0x22')]=[0x0,0x46,0x0,0x0];}_0x1fa99b[_0x7427('0x18')](_0x15e867);_0xe63830[_0x7427('0x18')](_0x1fa99b);}return{'pageSize':'A4','pageOrientation':_0x7427('0x23'),'content':_0xe63830,'footer':function(_0x2e158c,_0x20ae33){return{'text':_0x2e158c[_0x7427('0x12')]()+_0x7427('0x24')+_0x20ae33,'style':_0x7427('0x25')};},'defaultStyle':{'font':_0x7427('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7427('0x27')},'footer':{'alignment':_0x7427('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x402314){var _0x438f39=0x1388;var _0x481291;if(!_0x402314[0x0][_0x7427('0x29')]){return analyticExtractedReport(_0x7427('0x2a'));}return db[_0x7427('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7427('0x2c'),_0x7427('0x2d')]})['then'](function(_0x2c2d41){if(_0x2c2d41){_0x481291=_0x2c2d41;_0x438f39=_0x481291['splitSizePdf']||0x3e8;}})['then'](function(){var _0x3b5605=[];var _0xd4f5fb=0x0;if(_0x481291[_0x7427('0x2c')]){if(_0x402314&&_0x402314[_0x7427('0x15')]){var _0x16c6c5=_[_0x7427('0x2e')](_0x402314[0x0][_0x7427('0x29')]/_0x438f39);var _0x1a8e07=Number['isInteger'](_0x402314[0x0][_0x7427('0x29')]/_0x438f39)?_0x402314[0x0][_0x7427('0x29')]%_0x438f39:0x0;_0x16c6c5[_0x7427('0x1b')](function(_0x270e8a){if(_0x270e8a>0x0){_0xd4f5fb+=_0x438f39;}_0x3b5605[_0x7427('0x18')](dbH[_0x7427('0x2f')][_0x7427('0x30')](util[_0x7427('0x1c')](_0x7427('0x31'),QUERY,_0x438f39,_0xd4f5fb),{'type':dbH[_0x7427('0x2f')][_0x7427('0x32')]['SELECT']}));});if(_0x1a8e07>0x0){_0xd4f5fb+=_0x438f39;_0x3b5605['push'](dbH['sequelize'][_0x7427('0x30')](util['format'](_0x7427('0x31'),QUERY,_0x1a8e07,_0xd4f5fb),{'type':dbH[_0x7427('0x2f')][_0x7427('0x32')]['SELECT']}));}}}else{_0x3b5605[_0x7427('0x18')](dbH[_0x7427('0x2f')][_0x7427('0x30')](QUERY,{'type':dbH[_0x7427('0x2f')][_0x7427('0x32')][_0x7427('0x33')]}));}var _0x15e2a4=path[_0x7427('0x34')](PATH);var _0xb89886=path[_0x7427('0x35')](PATH,_0x7427('0x36'));var _0x5214df=_0x481291[_0x7427('0x2c')]&&_0x3b5605['length']>0x1;var _0x47ae98=[];if(!fs[_0x7427('0x37')](path['join'](_0x15e2a4,_0xb89886))&&_0x5214df){fs['mkdirSync'](path[_0x7427('0x38')](_0x15e2a4,_0xb89886));}return BPromise['each'](_0x3b5605,function(_0x43d903){_0x47ae98[_0x7427('0x18')](_0x43d903);})[_0x7427('0x39')](function(){var _0x314a71=[];for(var _0x25774e=0x0;_0x25774e<_0x47ae98[_0x7427('0x15')];_0x25774e+=0x1){var _0x256ca3=_0x47ae98[_0x25774e];var _0x50d648=createTables(_[_0x7427('0x3a')](_0x256ca3));var _0xbd0e9a;var _0x21d28a=getPDFDocDefinition(_0x50d648);var _0x5448ea=getPDFPrinter();var _0x580ae5=_0x5448ea[_0x7427('0x3b')](_0x21d28a);if(_0x5214df){_0xbd0e9a=path[_0x7427('0x38')](_0x15e2a4,_0xb89886,util[_0x7427('0x1c')](_0x7427('0x3c'),_0xb89886,_0x25774e,_0x7427('0x3d')));}else{_0xbd0e9a=path[_0x7427('0x38')](_0x15e2a4,util[_0x7427('0x1c')](_0x7427('0x3e'),_0xb89886,'pdf'));}_0x314a71[_0x7427('0x18')](writePDFDocument(_0x580ae5,_0xbd0e9a));}return Promise[_0x7427('0x3f')](_0x314a71);})['then'](function(){if(_0x5214df){return new Promise(function(_0x1f9cc2){zipdir(path[_0x7427('0x38')](_0x15e2a4,_0xb89886),{'saveTo':path['join'](_0x15e2a4,util[_0x7427('0x1c')](_0x7427('0x3e'),_0xb89886,'zip'))},function(){rimraf(path[_0x7427('0x38')](_0x15e2a4,_0xb89886),function(){});_0x1f9cc2(_0x7427('0x40'));});});}})[_0x7427('0x39')](function(){if(!_0x5214df)return;rimraf(path[_0x7427('0x38')](_0x15e2a4,_0xb89886),function(){});})['then'](function(){logger['info'](util['format'](_0x7427('0x41'),EXTRACTED_REPORT_ID,_0x7427('0x42')));return analyticExtractedReport(_0x7427('0x43'),_0x5214df?util['format']('%s.%s',_0xb89886,_0x5214df?_0x7427('0x44'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x7427('0x1c')](_0x7427('0x45'),EXTRACTED_REPORT_ID,_0x7427('0x42')));return db[_0x7427('0x46')][_0x7427('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7427('0x39')](function(_0x1b98bf){EXTRACTED_REPORT=_0x1b98bf;return dbH[_0x7427('0x2f')]['query'](util[_0x7427('0x1c')](_0x7427('0x48'),QUERY),{'type':dbH[_0x7427('0x2f')]['QueryTypes']['SELECT']});})[_0x7427('0x39')](extractReport)[_0x7427('0x49')](function(_0x3c34b6){logger[_0x7427('0x4a')](util[_0x7427('0x1c')](_0x7427('0x4b'),EXTRACTED_REPORT_ID,_0x7427('0x42')),util[_0x7427('0x4c')](_0x3c34b6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7427('0x4d'));})['finally'](function(){process[_0x7427('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2a52a4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x7427('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2a52a4;}function getPDFDocDefinitionFromHTML(_0x2b3904,_0x2c8322){var _0x7fe646=util[_0x7427('0x1c')]('%s\x20#%d',_0x2c8322[_0x7427('0x50')],_0x2c8322[_0x7427('0x51')]);var _0x545644=moment()[_0x7427('0x1c')]('YYYY-MM-DD')['toString']();var _0x299f98=htmlToPdfmake(_0x2b3904,{'window':window,'tableAutoSize':!![]});return{'content':[_0x299f98],'defaultStyle':{'font':_0x7427('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7427('0x52'),'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':_0x7427('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x7427('0x21')}];},'footer':function(_0x478f7e,_0x5dabed){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x7fe646,_0x478f7e,_0x5dabed,_0x545644),'style':_0x7427('0x25')}];}};}function writePDFDocument(_0x5b9afc,_0x39c7d4){return new Promise(function(_0x133e26,_0x4dadd3){var _0x53e1fb=_0x5b9afc[_0x7427('0x53')](fs[_0x7427('0x54')](_0x39c7d4));_0x53e1fb['on']('finish',function(){_0x133e26(_0x7427('0x55'));});_0x53e1fb['on'](_0x7427('0x56'),function(_0x298f96){_0x4dadd3(_0x298f96);});_0x5b9afc[_0x7427('0x57')]();});}exports[_0x7427('0x58')]=function(_0xbe242e,_0x1ffb98){var _0x1b1a84=getPDFPrinter();var _0x1a51f3=getPDFDocDefinitionFromHTML(_0xbe242e,_0x1ffb98);var _0x3a9395=_0x1b1a84[_0x7427('0x3b')](_0x1a51f3);return writePDFDocument(_0x3a9395,_0x1ffb98[_0x7427('0x2')])['catch'](function(_0x1980dd){throw _0x1980dd;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 972a67b..141f56e 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 _0xe458=['finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xe458,0x160));var _0x8e45=function(_0x35e3ea,_0x25ea49){_0x35e3ea=_0x35e3ea-0x0;var _0xbd593e=_0xe458[_0x35e3ea];return _0xbd593e;};'use strict';var util=require(_0x8e45('0x0'));var path=require(_0x8e45('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x8e45('0x2'));var BPromise=require(_0x8e45('0x3'));var zipdir=require(_0x8e45('0x4'));var rimraf=require(_0x8e45('0x5'));var db=require(_0x8e45('0x6'))['db'];var dbH=require(_0x8e45('0x6'))[_0x8e45('0x7')];var logger=require(_0x8e45('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8e45('0x9')][0x3];var PATH=process[_0x8e45('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a646f,_0x37cde4){var _0x27433a={'status':_0x3a646f};var _0x1f60da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37cde4){_0x27433a[_0x8e45('0xa')]=_0x37cde4;}return db['AnalyticExtractedReport']['update'](_0x27433a,_0x1f60da);}function main(){var _0x4a23d8=0x1388;var _0x5e442b;logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x8e45('0xe')][_0x8e45('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8e45('0x10')]})[_0x8e45('0x11')](function(_0x49e36b){if(_0x49e36b){_0x5e442b=_0x49e36b;_0x4a23d8=_0x5e442b[_0x8e45('0x10')]||0x1388;}})[_0x8e45('0x11')](function(){return dbH['sequelize'][_0x8e45('0x12')](util[_0x8e45('0xc')](_0x8e45('0x13'),QUERY),{'type':dbH['sequelize'][_0x8e45('0x14')][_0x8e45('0x15')]});})[_0x8e45('0x11')](function(_0x4310ed){if(!_0x4310ed[0x0][_0x8e45('0x16')]){return analyticExtractedReport(_0x8e45('0x17'));}var _0x46a39b=[];var _0x2e1eeb=0x0;if(_0x5e442b[_0x8e45('0x18')]){if(_0x4310ed&&_0x4310ed[_0x8e45('0x19')]){var _0x3e8be2=_[_0x8e45('0x1a')](_0x4310ed[0x0][_0x8e45('0x16')]/_0x4a23d8);var _0x3521ff=Number[_0x8e45('0x1b')](_0x4310ed[0x0][_0x8e45('0x16')]/_0x4a23d8)?_0x4310ed[0x0][_0x8e45('0x16')]%_0x4a23d8:0x0;_0x3e8be2['forEach'](function(_0xdd2b81){if(_0xdd2b81>0x0){_0x2e1eeb+=_0x4a23d8;}_0x46a39b[_0x8e45('0x1c')](dbH[_0x8e45('0x1d')][_0x8e45('0x12')](util[_0x8e45('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4a23d8,_0x2e1eeb),{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));});if(_0x3521ff>0x0){_0x2e1eeb+=_0x4a23d8;_0x46a39b[_0x8e45('0x1c')](dbH['sequelize'][_0x8e45('0x12')](util['format'](_0x8e45('0x1e'),QUERY,_0x3521ff,_0x2e1eeb),{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));}}}else{_0x46a39b[_0x8e45('0x1c')](dbH[_0x8e45('0x1d')][_0x8e45('0x12')](QUERY,{'type':dbH[_0x8e45('0x1d')][_0x8e45('0x14')][_0x8e45('0x15')]}));}var _0x46d0f0=path[_0x8e45('0x1f')](PATH);var _0x224695=path['basename'](PATH,_0x8e45('0x20'));var _0x1fbc5b=_0x5e442b[_0x8e45('0x18')]&&_0x46a39b[_0x8e45('0x19')]>0x1;var _0x33f40b=[];if(!fs[_0x8e45('0x21')](path[_0x8e45('0x22')](_0x46d0f0,_0x224695))&&_0x1fbc5b){fs[_0x8e45('0x23')](path[_0x8e45('0x22')](_0x46d0f0,_0x224695));}return BPromise['each'](_0x46a39b,function(_0x4306cc){_0x33f40b['push'](_0x4306cc);})[_0x8e45('0x11')](function(){for(var _0x30b004=0x0;_0x30b004<_0x33f40b['length'];_0x30b004+=0x1){var _0x185021;var _0x46792a=_0x33f40b[_0x30b004];if(_0x1fbc5b){_0x185021=path[_0x8e45('0x22')](_0x46d0f0,_0x224695,util[_0x8e45('0xc')](_0x8e45('0x24'),_0x224695,_0x30b004,_0x8e45('0x25')));}else{_0x185021=path['join'](_0x46d0f0,util[_0x8e45('0xc')](_0x8e45('0x26'),_0x224695,'xlsx'));}fs['writeFileSync'](_0x185021,json2xls(_0x46792a),_0x8e45('0x27'));}})['then'](function(){if(_0x1fbc5b){return new Promise(function(_0x59de90){zipdir(path['join'](_0x46d0f0,_0x224695),{'saveTo':path['join'](_0x46d0f0,util[_0x8e45('0xc')]('%s.%s',_0x224695,_0x8e45('0x28')))},function(_0x35214c,_0x1d49eb){rimraf(path[_0x8e45('0x22')](_0x46d0f0,_0x224695),function(){});_0x59de90(_0x8e45('0x29'));});});}})[_0x8e45('0x11')](function(){logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0x2a'),EXTRACTED_REPORT_ID,_0x8e45('0x2b')));return analyticExtractedReport(_0x8e45('0x2c'),_0x1fbc5b?util['format'](_0x8e45('0x26'),_0x224695,_0x1fbc5b?_0x8e45('0x28'):_0x8e45('0x25')):null);});})['catch'](function(_0x1375ec){logger[_0x8e45('0xb')](util[_0x8e45('0xc')](_0x8e45('0x2d'),EXTRACTED_REPORT_ID,_0x8e45('0x2b')),util[_0x8e45('0x2e')](_0x1375ec,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8e45('0x2f'));})[_0x8e45('0x30')](function(){process[_0x8e45('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1131=['QueryTypes','SELECT','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','each','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x4eb2ec,_0x2c7e7e){var _0x3502e1=function(_0x2fa7fe){while(--_0x2fa7fe){_0x4eb2ec['push'](_0x4eb2ec['shift']());}};_0x3502e1(++_0x2c7e7e);}(_0x1131,0x1c4));var _0x1113=function(_0x17218c,_0x3e8bf6){_0x17218c=_0x17218c-0x0;var _0x2fb49a=_0x1131[_0x17218c];return _0x2fb49a;};'use strict';var util=require(_0x1113('0x0'));var path=require(_0x1113('0x1'));var _=require(_0x1113('0x2'));var fs=require('fs');var json2xls=require(_0x1113('0x3'));var BPromise=require(_0x1113('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x1113('0x5'));var db=require(_0x1113('0x6'))['db'];var dbH=require(_0x1113('0x6'))[_0x1113('0x7')];var logger=require(_0x1113('0x8'))(_0x1113('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x1113('0xa')][0x2]);var QUERY=process[_0x1113('0xa')][0x3];var PATH=process[_0x1113('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ee07d,_0x10ec8c){var _0x2f25b6={'status':_0x1ee07d};var _0x34964e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x10ec8c){_0x2f25b6[_0x1113('0xb')]=_0x10ec8c;}return db[_0x1113('0xc')][_0x1113('0xd')](_0x2f25b6,_0x34964e);}function main(){var _0x1066fd=0x1388;var _0x1db4b2;logger[_0x1113('0xe')](util[_0x1113('0xf')](_0x1113('0x10'),EXTRACTED_REPORT_ID,_0x1113('0x11')));return db[_0x1113('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1113('0x13'),'splitSizeXlsx']})[_0x1113('0x14')](function(_0x31ab9e){if(_0x31ab9e){_0x1db4b2=_0x31ab9e;_0x1066fd=_0x1db4b2[_0x1113('0x15')]||0x1388;}})[_0x1113('0x14')](function(){return dbH[_0x1113('0x16')][_0x1113('0x17')](util[_0x1113('0xf')](_0x1113('0x18'),QUERY),{'type':dbH[_0x1113('0x16')][_0x1113('0x19')][_0x1113('0x1a')]});})['then'](function(_0x3fb6e8){if(!_0x3fb6e8[0x0][_0x1113('0x1b')]){return analyticExtractedReport(_0x1113('0x1c'));}var _0x140750=[];var _0x4c17eb=0x0;if(_0x1db4b2['split']){if(_0x3fb6e8&&_0x3fb6e8[_0x1113('0x1d')]){var _0x1f8a59=_[_0x1113('0x1e')](_0x3fb6e8[0x0][_0x1113('0x1b')]/_0x1066fd);var _0x3a3b36=Number['isInteger'](_0x3fb6e8[0x0]['num']/_0x1066fd)?_0x3fb6e8[0x0][_0x1113('0x1b')]%_0x1066fd:0x0;_0x1f8a59[_0x1113('0x1f')](function(_0x3e6cc4){if(_0x3e6cc4>0x0){_0x4c17eb+=_0x1066fd;}_0x140750['push'](dbH[_0x1113('0x16')]['query'](util[_0x1113('0xf')](_0x1113('0x20'),QUERY,_0x1066fd,_0x4c17eb),{'type':dbH[_0x1113('0x16')][_0x1113('0x19')][_0x1113('0x1a')]}));});if(_0x3a3b36>0x0){_0x4c17eb+=_0x1066fd;_0x140750['push'](dbH[_0x1113('0x16')]['query'](util[_0x1113('0xf')](_0x1113('0x20'),QUERY,_0x3a3b36,_0x4c17eb),{'type':dbH[_0x1113('0x16')][_0x1113('0x19')][_0x1113('0x1a')]}));}}}else{_0x140750[_0x1113('0x21')](dbH[_0x1113('0x16')]['query'](QUERY,{'type':dbH[_0x1113('0x16')][_0x1113('0x19')]['SELECT']}));}var _0x3d1cce=path[_0x1113('0x22')](PATH);var _0x3635ac=path[_0x1113('0x23')](PATH,_0x1113('0x24'));var _0xcf153d=_0x1db4b2[_0x1113('0x13')]&&_0x140750[_0x1113('0x1d')]>0x1;var _0x2ca86e=[];if(!fs['existsSync'](path['join'](_0x3d1cce,_0x3635ac))&&_0xcf153d){fs['mkdirSync'](path[_0x1113('0x25')](_0x3d1cce,_0x3635ac));}return BPromise[_0x1113('0x26')](_0x140750,function(_0x3004f3){_0x2ca86e['push'](_0x3004f3);})[_0x1113('0x14')](function(){for(var _0x283cea=0x0;_0x283cea<_0x2ca86e['length'];_0x283cea+=0x1){var _0x1d95d2;var _0x1a5215=_0x2ca86e[_0x283cea];if(_0xcf153d){_0x1d95d2=path[_0x1113('0x25')](_0x3d1cce,_0x3635ac,util[_0x1113('0xf')]('%s%d.%s',_0x3635ac,_0x283cea,_0x1113('0x27')));}else{_0x1d95d2=path[_0x1113('0x25')](_0x3d1cce,util['format'](_0x1113('0x28'),_0x3635ac,_0x1113('0x27')));}fs[_0x1113('0x29')](_0x1d95d2,json2xls(_0x1a5215),_0x1113('0x2a'));}})[_0x1113('0x14')](function(){if(_0xcf153d){return new Promise(function(_0x1a7318){zipdir(path['join'](_0x3d1cce,_0x3635ac),{'saveTo':path[_0x1113('0x25')](_0x3d1cce,util[_0x1113('0xf')](_0x1113('0x28'),_0x3635ac,'zip'))},function(_0x5d7db6,_0x270449){rimraf(path[_0x1113('0x25')](_0x3d1cce,_0x3635ac),function(){});_0x1a7318(_0x1113('0x2b'));});});}})[_0x1113('0x14')](function(){logger['info'](util[_0x1113('0xf')](_0x1113('0x2c'),EXTRACTED_REPORT_ID,_0x1113('0x11')));return analyticExtractedReport(_0x1113('0x2d'),_0xcf153d?util[_0x1113('0xf')](_0x1113('0x28'),_0x3635ac,_0xcf153d?_0x1113('0x2e'):'xlsx'):null);});})[_0x1113('0x2f')](function(_0x380b8a){logger[_0x1113('0xe')](util[_0x1113('0xf')](_0x1113('0x30'),EXTRACTED_REPORT_ID,_0x1113('0x11')),util[_0x1113('0x31')](_0x380b8a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1113('0x32'));})[_0x1113('0x33')](function(){process[_0x1113('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 32d98a5..e817a9b 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 _0x64ac=['VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','extensions','push','Set','CDR(type)=%s','context','VoiceExtensionId','type','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals'];(function(_0x3729c,_0x1b1faf){var _0x20ce1f=function(_0x5f323d){while(--_0x5f323d){_0x3729c['push'](_0x3729c['shift']());}};_0x20ce1f(++_0x1b1faf);}(_0x64ac,0x143));var _0xc64a=function(_0x39e2e1,_0x1b54ac){_0x39e2e1=_0x39e2e1-0x0;var _0xcd723c=_0x64ac[_0x39e2e1];return _0xcd723c;};'use strict';var _=require(_0xc64a('0x0'));var util=require(_0xc64a('0x1'));function rewrite(_0x3eca08,_0x3c3e6c){var _0x2b217e=this;return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x3')][_0xc64a('0x4')]({'raw':!![]})[_0xc64a('0x5')](function(_0x1a1297){_0x2b217e[_0xc64a('0x6')]=_0x1a1297;return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x4')]({'where':{'IntervalId':_0x3c3e6c[_0xc64a('0x8')]},'raw':!![]});})[_0xc64a('0x5')](function(_0x493b6b){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0xc64a('0x9')](_0x493b6b,_0xc64a('0xa')))}},'order':[{'raw':_0xc64a('0xb')}],'raw':!![]});})[_0xc64a('0x5')](function(_0x2d32d8){var _0x2cc528=_[_0xc64a('0xc')](_0x2d32d8,{'priority':'1'});var _0x231a9d=_[_0xc64a('0xc')](_0x2d32d8,{'isApp':0x1});var _0x3a7f39=_['groupBy'](_0x231a9d,'exten');var _0x6a1743=['queue',_0xc64a('0xd')];var _0x517b1e=[];var _0x3a674c=[];for(var _0x57a156 in _0x3a7f39){if(_0x3a7f39[_0xc64a('0xe')](_0x57a156)){_0x2b217e[_0xc64a('0xf')]=0x2;_0x2b217e['extensions']=[];_0x2b217e[_0xc64a('0x10')]=_['find'](_0x2cc528,{'exten':_0x3a7f39[_0x57a156][0x0]['exten']});_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':util['format'](_0xc64a('0x14'),_0x3a7f39[_0x57a156][0x0]['type']),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});if(_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')]==='inbound'){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':'Set','appdata':'CDR(routeid)='+_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')],'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}else if(_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')]===_0xc64a('0x18')){if(_0x2b217e[_0xc64a('0x10')]){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x19')+(_0x2b217e['extension'][_0xc64a('0x1a')]?'${EXTEN:'+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x1a')]+'}':_0xc64a('0x1b')),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':'Set','appdata':_0xc64a('0x1c')+_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')],'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});var _0x22c283=_0x2b217e[_0xc64a('0xf')]++;_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x22c283+0x2)+_0xc64a('0x1e')+(_0x22c283+0x1)+')','context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x22c283,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});if(_0x2b217e[_0xc64a('0x10')]){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0x2b217e[_0xc64a('0x10')]['cutdigits']?_0xc64a('0x1f')+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0]['exten'],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':'Set','appdata':_0xc64a('0x20')+_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId'],'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});if(_0x2b217e[_0xc64a('0x10')]&&_0x2b217e['extension'][_0xc64a('0xe')](_0xc64a('0x21'))&&_0x2b217e['extension']['recordingFormat']!=='none'){_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x22'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e[_0xc64a('0x11')]['push']({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2b217e[_0xc64a('0x10')][_0xc64a('0x21')]||_0xc64a('0x23'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0]['exten'],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});}}_0x2b217e[_0xc64a('0x11')]['push']({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x24'),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0]['type'],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x25'),'context':_0x3a7f39[_0x57a156][0x0]['context'],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x2b217e['extensions'][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x26'),'context':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x15')],'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'priority':_0x2b217e[_0xc64a('0xf')]++,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});for(var _0x1a7331=0x0,_0xdc1e5=0x0;_0x1a7331<_0x3a7f39[_0x57a156]['length'];_0x1a7331+=0x1,_0xdc1e5=0x0){var _0x3efa2b=_0x3a7f39[_0x57a156][_0x1a7331];if(_0x3efa2b[_0xc64a('0x17')]){_0x3efa2b[_0xc64a('0x17')]=_0x3efa2b[_0xc64a('0x17')]['toLowerCase']();}var _0x3ecc61=[];var _0x2c0ea7=[];delete _0x3efa2b['id'];delete _0x3efa2b[_0xc64a('0x27')];delete _0x3efa2b[_0xc64a('0x28')];var _0x534c06=_0x3efa2b[_0xc64a('0x29')]!==_0xc64a('0x2a')?[_0x3efa2b[_0xc64a('0x29')]]:_0x3efa2b[_0xc64a('0x8')]?_['map'](_[_0xc64a('0xc')](_0x2b217e[_0xc64a('0x6')],{'IntervalId':_0x3efa2b[_0xc64a('0x8')]}),_0xc64a('0x29')):[];if(_0x3efa2b['hasOwnProperty'](_0xc64a('0x2b'))){if(_0x3efa2b[_0xc64a('0x2b')]&&_0x3efa2b['tag']!=='--'){_0x3ecc61['push']({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x2c')+_0x3efa2b[_0xc64a('0x2b')],'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06['length']+_0x2b217e['priority']+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}if(_0x3efa2b[_0xc64a('0x17')]===_0xc64a('0x18')&&_0x3efa2b[_0xc64a('0xe')]('callerID')){if(_0x3efa2b[_0xc64a('0x2d')]){_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3efa2b[_0xc64a('0x2d')]+')','context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}else{_0x3ecc61['push']({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x2f'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}if(_0x3efa2b[_0xc64a('0xe')](_0xc64a('0x30'))){if(_0x6a1743[_0xc64a('0x31')](_0x3efa2b[_0xc64a('0x32')]['toLowerCase']())>=0x0&&_0x3efa2b['appType']!==_0xc64a('0x33')){if(_0x3efa2b[_0xc64a('0x30')]){_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b['type'],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x34'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06['length']+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x35'),'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b['exten'],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}else{_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b['type'],'app':_0xc64a('0x1d'),'appdata':_0xc64a('0x36'),'context':_0x3efa2b['context'],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});_0x3ecc61[_0xc64a('0x12')]({'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x13'),'appdata':_0xc64a('0x37'),'context':_0x3efa2b[_0xc64a('0x15')],'exten':_0x3efa2b[_0xc64a('0xa')],'priority':_0x534c06[_0xc64a('0x2e')]+_0x2b217e[_0xc64a('0xf')]+_0xdc1e5++,'VoiceExtensionId':_0x3efa2b[_0xc64a('0x16')]});}}}for(var _0x5ef8a6=0x0;_0x5ef8a6<_0x534c06[_0xc64a('0x2e')];_0x5ef8a6+=0x1){var _0x35cc36=_0x2b217e[_0xc64a('0xf')]+_0x534c06[_0xc64a('0x2e')];var _0x1fde36=_0x5ef8a6===_0x534c06[_0xc64a('0x2e')]-0x1?_0x2b217e[_0xc64a('0xf')]+_0x3ecc61[_0xc64a('0x2e')]+_0x2c0ea7[_0xc64a('0x2e')]+0x2:_0x2b217e[_0xc64a('0xf')]+_0x5ef8a6+0x1;_0x3ecc61['splice'](_0x5ef8a6,0x0,{'type':_0x3efa2b[_0xc64a('0x17')],'app':_0xc64a('0x38'),'appdata':_0x534c06[_0x5ef8a6]+'?'+_0x3efa2b[_0xc64a('0x15')]+_0xc64a('0x39')+_0x35cc36+':'+_0x3efa2b[_0xc64a('0x15')]+_0xc64a('0x39')+_0x1fde36,'exten':_0x3efa2b[_0xc64a('0xa')],'context':_0x3efa2b[_0xc64a('0x15')],'priority':_0x2b217e[_0xc64a('0xf')]+_0x5ef8a6,'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0]['VoiceExtensionId']});}_0x3efa2b[_0xc64a('0xf')]=_0x3ecc61[_0xc64a('0x2e')]?_[_0xc64a('0x3a')](_0x3ecc61)[_0xc64a('0xf')]+0x1:_0x2b217e[_0xc64a('0xf')];_0x2b217e[_0xc64a('0xf')]=(_0x2c0ea7[_0xc64a('0x2e')]?_[_0xc64a('0x3a')](_0x2c0ea7)[_0xc64a('0xf')]:_0x3efa2b['priority'])+0x1;_0x2b217e[_0xc64a('0x11')]=_[_0xc64a('0x3b')](_0x2b217e['extensions'],_0x3ecc61,[_0x3efa2b],_0x2c0ea7);}_0x2b217e[_0xc64a('0x11')][_0xc64a('0x12')]({'type':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x17')],'app':_0xc64a('0x3c'),'exten':_0x3a7f39[_0x57a156][0x0][_0xc64a('0xa')],'context':_0x3a7f39[_0x57a156][0x0]['context'],'priority':_0x2b217e[_0xc64a('0xf')],'VoiceExtensionId':_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]});_0x517b1e[_0xc64a('0x12')](_0x3a7f39[_0x57a156][0x0][_0xc64a('0x16')]);_0x3a674c=_['concat'](_0x3a674c,_0x2b217e['extensions']);}}return _0x3eca08['transaction'](function(_0x2c7b0c){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x517b1e}},'transaction':_0x2c7b0c})[_0xc64a('0x5')](function(_0x3c23a0){return _0x3eca08[_0xc64a('0x2')][_0xc64a('0x7')][_0xc64a('0x3e')](_[_0xc64a('0x3f')](_0x3a674c,_0xc64a('0xf')),{'transaction':_0x2c7b0c});});});})['catch'](function(_0x180af4){console[_0xc64a('0x40')](_0x180af4);});}exports[_0xc64a('0x41')]=rewrite; \ No newline at end of file +var _0xe36c=['rewrite','lodash','util','models','Interval','findAll','intervals','IntervalId','then','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','extensions','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','destroy','sortBy','catch','error'];(function(_0xda80d5,_0x5cb2dc){var _0x38a8fb=function(_0x73567d){while(--_0x73567d){_0xda80d5['push'](_0xda80d5['shift']());}};_0x38a8fb(++_0x5cb2dc);}(_0xe36c,0x164));var _0xce36=function(_0x467c7a,_0x315963){_0x467c7a=_0x467c7a-0x0;var _0x403dc7=_0xe36c[_0x467c7a];return _0x403dc7;};'use strict';var _=require(_0xce36('0x0'));var util=require(_0xce36('0x1'));function rewrite(_0x474d25,_0x52651e){var _0x52e33e=this;return _0x474d25[_0xce36('0x2')][_0xce36('0x3')][_0xce36('0x4')]({'raw':!![]})['then'](function(_0x764a50){_0x52e33e[_0xce36('0x5')]=_0x764a50;return _0x474d25[_0xce36('0x2')]['VoiceExtension'][_0xce36('0x4')]({'where':{'IntervalId':_0x52651e[_0xce36('0x6')]},'raw':!![]});})[_0xce36('0x7')](function(_0x29aa62){return _0x474d25[_0xce36('0x2')][_0xce36('0x8')][_0xce36('0x4')]({'where':{'exten':{'$in':_[_0xce36('0x9')](_['map'](_0x29aa62,_0xce36('0xa')))}},'order':[{'raw':_0xce36('0xb')}],'raw':!![]});})[_0xce36('0x7')](function(_0x36e3b){var _0x5d3470=_[_0xce36('0xc')](_0x36e3b,{'priority':'1'});var _0x9dc949=_[_0xce36('0xc')](_0x36e3b,{'isApp':0x1});var _0x2f8226=_[_0xce36('0xd')](_0x9dc949,_0xce36('0xa'));var _0x12db52=['queue',_0xce36('0xe')];var _0x21129b=[];var _0x22467c=[];for(var _0x331a4d in _0x2f8226){if(_0x2f8226[_0xce36('0xf')](_0x331a4d)){_0x52e33e[_0xce36('0x10')]=0x2;_0x52e33e['extensions']=[];_0x52e33e[_0xce36('0x11')]=_[_0xce36('0x12')](_0x5d3470,{'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')]});_0x52e33e['extensions'][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':util['format'](_0xce36('0x16'),_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')]),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e['priority']++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});if(_0x2f8226[_0x331a4d][0x0]['type']===_0xce36('0x19')){_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0xce36('0x1b')+_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId'],'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0]['exten'],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});}else if(_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')]===_0xce36('0x1c')){if(_0x52e33e[_0xce36('0x11')]){_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0]['type'],'app':_0xce36('0x15'),'appdata':_0xce36('0x1d')+(_0x52e33e[_0xce36('0x11')][_0xce36('0x1e')]?_0xce36('0x1f')+_0x52e33e[_0xce36('0x11')][_0xce36('0x1e')]+'}':'${EXTEN}'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});}_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x1b')+_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')],'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});var _0x2f5bbc=_0x52e33e[_0xce36('0x10')]++;_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x20'),'appdata':_0xce36('0x21')+(_0x2f5bbc+0x2)+_0xce36('0x22')+(_0x2f5bbc+0x1)+')','context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x2f5bbc,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});if(_0x52e33e[_0xce36('0x11')]){_0x52e33e[_0xce36('0x1a')]['push']({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0x52e33e[_0xce36('0x11')][_0xce36('0x1e')]?_0xce36('0x23')+_0x52e33e[_0xce36('0x11')][_0xce36('0x1e')]+'}':_0xce36('0x24'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e['priority']++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId']});}_0x52e33e['extensions'][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0]['type'],'app':_0xce36('0x15'),'appdata':_0xce36('0x25')+_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')],'context':_0x2f8226[_0x331a4d][0x0]['context'],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId']});if(_0x52e33e[_0xce36('0x11')]&&_0x52e33e[_0xce36('0x11')]['hasOwnProperty'](_0xce36('0x26'))&&_0x52e33e[_0xce36('0x11')][_0xce36('0x26')]!==_0xce36('0x27')){_0x52e33e['extensions'][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0]['type'],'app':'Set','appdata':_0xce36('0x28'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0]['exten'],'priority':_0x52e33e['priority']++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x29')+_0x52e33e[_0xce36('0x11')]['recordingFormat']||'wav','context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0]['exten'],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});}}_0x52e33e['extensions'][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0xce36('0x2a'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});_0x52e33e['extensions'][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0xce36('0x2b'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId']});_0x52e33e['extensions']['push']({'type':_0x2f8226[_0x331a4d][0x0]['type'],'app':_0xce36('0x15'),'appdata':_0xce36('0x2c'),'context':_0x2f8226[_0x331a4d][0x0][_0xce36('0x17')],'exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'priority':_0x52e33e[_0xce36('0x10')]++,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId']});for(var _0x4aa6d3=0x0,_0x123daa=0x0;_0x4aa6d3<_0x2f8226[_0x331a4d][_0xce36('0x2d')];_0x4aa6d3+=0x1,_0x123daa=0x0){var _0x4a6515=_0x2f8226[_0x331a4d][_0x4aa6d3];if(_0x4a6515['type']){_0x4a6515[_0xce36('0x14')]=_0x4a6515[_0xce36('0x14')]['toLowerCase']();}var _0x4d7896=[];var _0x16c66a=[];delete _0x4a6515['id'];delete _0x4a6515[_0xce36('0x2e')];delete _0x4a6515[_0xce36('0x2f')];var _0x1c0ff3=_0x4a6515['interval']!==_0xce36('0x30')?[_0x4a6515[_0xce36('0x31')]]:_0x4a6515[_0xce36('0x6')]?_[_0xce36('0x32')](_[_0xce36('0xc')](_0x52e33e[_0xce36('0x5')],{'IntervalId':_0x4a6515[_0xce36('0x6')]}),_0xce36('0x31')):[];if(_0x4a6515[_0xce36('0xf')]('tag')){if(_0x4a6515['tag']&&_0x4a6515[_0xce36('0x33')]!=='--'){_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515[_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0xce36('0x34')+_0x4a6515[_0xce36('0x33')],'context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515['exten'],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515[_0xce36('0x18')]});}}if(_0x4a6515[_0xce36('0x14')]===_0xce36('0x1c')&&_0x4a6515['hasOwnProperty'](_0xce36('0x35'))){if(_0x4a6515['callerID']){_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515[_0xce36('0x14')],'app':_0xce36('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4a6515[_0xce36('0x35')]+')','context':_0x4a6515['context'],'exten':_0x4a6515[_0xce36('0xa')],'priority':_0x1c0ff3['length']+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515['VoiceExtensionId']});}else{_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515['type'],'app':'ExecIf','appdata':_0xce36('0x36'),'context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515[_0xce36('0xa')],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515[_0xce36('0x18')]});}}if(_0x4a6515['hasOwnProperty'](_0xce36('0x37'))){if(_0x12db52[_0xce36('0x38')](_0x4a6515[_0xce36('0x39')]['toLowerCase']())>=0x0&&_0x4a6515[_0xce36('0x3a')]!=='custom'){if(_0x4a6515[_0xce36('0x37')]){_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515['type'],'app':_0xce36('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515['exten'],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515[_0xce36('0x18')]});_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515[_0xce36('0x14')],'app':_0xce36('0x15'),'appdata':_0xce36('0x3b'),'context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515[_0xce36('0xa')],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515[_0xce36('0x18')]});}else{_0x4d7896['push']({'type':_0x4a6515[_0xce36('0x14')],'app':_0xce36('0x20'),'appdata':_0xce36('0x3c'),'context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515[_0xce36('0xa')],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e[_0xce36('0x10')]+_0x123daa++,'VoiceExtensionId':_0x4a6515['VoiceExtensionId']});_0x4d7896[_0xce36('0x13')]({'type':_0x4a6515[_0xce36('0x14')],'app':'Set','appdata':_0xce36('0x3d'),'context':_0x4a6515[_0xce36('0x17')],'exten':_0x4a6515['exten'],'priority':_0x1c0ff3[_0xce36('0x2d')]+_0x52e33e['priority']+_0x123daa++,'VoiceExtensionId':_0x4a6515[_0xce36('0x18')]});}}}for(var _0x12eed4=0x0;_0x12eed4<_0x1c0ff3[_0xce36('0x2d')];_0x12eed4+=0x1){var _0x33042a=_0x52e33e[_0xce36('0x10')]+_0x1c0ff3[_0xce36('0x2d')];var _0x58da45=_0x12eed4===_0x1c0ff3['length']-0x1?_0x52e33e[_0xce36('0x10')]+_0x4d7896[_0xce36('0x2d')]+_0x16c66a[_0xce36('0x2d')]+0x2:_0x52e33e[_0xce36('0x10')]+_0x12eed4+0x1;_0x4d7896[_0xce36('0x3e')](_0x12eed4,0x0,{'type':_0x4a6515['type'],'app':'GotoIfTime','appdata':_0x1c0ff3[_0x12eed4]+'?'+_0x4a6515[_0xce36('0x17')]+',${EXTEN},'+_0x33042a+':'+_0x4a6515[_0xce36('0x17')]+_0xce36('0x3f')+_0x58da45,'exten':_0x4a6515[_0xce36('0xa')],'context':_0x4a6515[_0xce36('0x17')],'priority':_0x52e33e[_0xce36('0x10')]+_0x12eed4,'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]});}_0x4a6515['priority']=_0x4d7896[_0xce36('0x2d')]?_[_0xce36('0x40')](_0x4d7896)[_0xce36('0x10')]+0x1:_0x52e33e[_0xce36('0x10')];_0x52e33e['priority']=(_0x16c66a['length']?_[_0xce36('0x40')](_0x16c66a)[_0xce36('0x10')]:_0x4a6515['priority'])+0x1;_0x52e33e[_0xce36('0x1a')]=_[_0xce36('0x41')](_0x52e33e[_0xce36('0x1a')],_0x4d7896,[_0x4a6515],_0x16c66a);}_0x52e33e[_0xce36('0x1a')][_0xce36('0x13')]({'type':_0x2f8226[_0x331a4d][0x0][_0xce36('0x14')],'app':'Hangup','exten':_0x2f8226[_0x331a4d][0x0][_0xce36('0xa')],'context':_0x2f8226[_0x331a4d][0x0]['context'],'priority':_0x52e33e[_0xce36('0x10')],'VoiceExtensionId':_0x2f8226[_0x331a4d][0x0]['VoiceExtensionId']});_0x21129b[_0xce36('0x13')](_0x2f8226[_0x331a4d][0x0][_0xce36('0x18')]);_0x22467c=_[_0xce36('0x41')](_0x22467c,_0x52e33e[_0xce36('0x1a')]);}}return _0x474d25['transaction'](function(_0x2610e8){return _0x474d25['models']['VoiceExtension'][_0xce36('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x21129b}},'transaction':_0x2610e8})['then'](function(_0x370038){return _0x474d25[_0xce36('0x2')]['VoiceExtension']['bulkCreate'](_[_0xce36('0x43')](_0x22467c,_0xce36('0x10')),{'transaction':_0x2610e8});});});})[_0xce36('0x44')](function(_0x49e57b){console[_0xce36('0x45')](_0x49e57b);});}exports[_0xce36('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 64eedf5..b9ff980 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 _0x56d1=['parse','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','scheduledAt','ContactId','ListId','createdAt','field','NOW()','toString','updatedAt','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','insert','into','fromQuery','from','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','stringify','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x56d1,0x72));var _0x156d=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x56d1[_0x5bc5fe];return _0x298ea7;};'use strict';var BPromise=require(_0x156d('0x0'));var util=require(_0x156d('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x156d('0x2'));var Papa=require(_0x156d('0x3'));var Redis=require(_0x156d('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x156d('0x5'));config[_0x156d('0x6')]=_['defaults'](config[_0x156d('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x156d('0x7'))(new Redis(config[_0x156d('0x6')]));require(_0x156d('0x8'))[_0x156d('0x9')](socket);try{if(!process[_0x156d('0xa')][0x2]||process[_0x156d('0xa')][0x2]===_0x156d('0xb')||process[_0x156d('0xa')][0x2]===_0x156d('0xc')){throw new Error(_0x156d('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x156d('0xa')][0x3]||process['argv'][0x3]===_0x156d('0xb')||process[_0x156d('0xa')][0x3]===_0x156d('0xc')||!process['argv'][0x4]||process[_0x156d('0xa')][0x4]==='undefined'||process[_0x156d('0xa')][0x4]==='null'){throw new Error(_0x156d('0xe'));}var FIELDS=_['zipObject'](process[_0x156d('0xa')][0x3][_0x156d('0xf')](','),process['argv'][0x4][_0x156d('0xf')](','));if(!process[_0x156d('0xa')][0x5]||process[_0x156d('0xa')][0x5]===_0x156d('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x156d('0x10'));}var LISTID=process[_0x156d('0xa')][0x5];var COMPANYID=process[_0x156d('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x156d('0xa')][0x6]!==_0x156d('0xc')?process[_0x156d('0xa')][0x6]:null;var DUPLICATES=process[_0x156d('0xa')][0x7]&&process[_0x156d('0xa')][0x7]!==_0x156d('0xb')&&process[_0x156d('0xa')][0x7]!==_0x156d('0xc')?process['argv'][0x7]:null;if(!process[_0x156d('0xa')][0x8]||process[_0x156d('0xa')][0x8]==='undefined'||process['argv'][0x8]===_0x156d('0xc')){throw new Error(_0x156d('0x11'));}var SOCKET_TIMESTAMP=process[_0x156d('0xa')][0x8];}catch(_0x81f588){logger[_0x156d('0x12')](_0x81f588);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(_0x262cb6,_0x3eb208,_0x4ec2d9,_0x23da99){var _0x45a92e={'message':_0x3eb208};_0x45a92e[_0x262cb6]=!![];if(_0x4ec2d9){_0x45a92e[_0x156d('0x13')]=_0x4ec2d9;}if(_0x23da99){_0x45a92e[_0x156d('0x14')]=_0x23da99;}return _0x45a92e;}function isEmail(_0x5e83cb){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))*$/[_0x156d('0x15')](_0x5e83cb);}function checkRow(_0x122e79,_0x18dbee,_0x3b179e){return new BPromise(function(_0x39b759,_0x539455){if(_[_0x156d('0x16')](_0x122e79)){return _0x539455(handleCheckRowError(_0x156d('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b179e));}if(_0x122e79[_0x156d('0x17')]&&_0x122e79[_0x156d('0x17')][_0x156d('0x18')]){var _0x3f0f63=_[_0x156d('0x19')](_0x122e79[_0x156d('0x17')],'message')['join'](';');return _0x539455(handleCheckRowError('error',_0x3f0f63,null,_0x3b179e));}var _0xc17fda={};for(var _0x428e5f in FIELDS){if(FIELDS[_0x156d('0x1a')](_0x428e5f)&&FIELDS[_0x428e5f]){_0xc17fda[_0x428e5f]=_0x122e79[_0x156d('0x1b')][0x0][FIELDS[_0x428e5f]]||_0x122e79[_0x156d('0x1b')][0x0]['\ufeff'+FIELDS[_0x428e5f]];}}if(!_0xc17fda[_0x156d('0x1c')]){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x1d'),null,_0x3b179e));}if(!_0xc17fda[_0x156d('0x1e')]){return _0x539455(handleCheckRowError('error',_0x156d('0x1f'),null,_0x3b179e));}if(_0xc17fda['birthDate']){var _0x56478f=moment(_0xc17fda['birthDate'],_0x156d('0x20'));if(!_0x56478f['isValid']()){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x21'),null,_0x3b179e));}}if(_0xc17fda[_0x156d('0x22')]){if(!isEmail(_0xc17fda[_0x156d('0x22')])){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x23'),null,_0x3b179e));}}_0xc17fda['ListId']=LISTID;_0xc17fda[_0x156d('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x156d('0x18')]&&_0x18dbee){var _0x48a5f3={};for(var _0x553394=0x0,_0x579746=DUPLICATES[_0x156d('0x18')];_0x553394<_0x579746;_0x553394+=0x1){_0x48a5f3[DUPLICATES[_0x553394]]=_0xc17fda[DUPLICATES[_0x553394]];}var _0xfea7a9=_[_0x156d('0x25')](_0x18dbee,_0x48a5f3);if(_0xfea7a9){return _0x539455(handleCheckRowError(_0x156d('0x26'),_0x156d('0x27'),_0xfea7a9,_0x3b179e));}}return db[_0x156d('0x28')][_0x156d('0x29')](_0xc17fda,{'raw':!![],'hooks':![],'fields':_['keys'](_0xc17fda)})[_0x156d('0x2a')](function(_0x1ed185){if(DUPLICATES&&DUPLICATES['length']&&_0x18dbee){_0x18dbee[_0x156d('0x2b')](_[_0x156d('0x2c')](_0xc17fda,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1ed185['id'];return _0x39b759();})[_0x156d('0x2d')](function(_0xd5ab67){return _0x539455(handleCheckRowError(_0x156d('0x12'),_0x156d('0x2e')+(_0xd5ab67[_0x156d('0x2f')]||JSON['stringify'](_0xd5ab67)),null,_0x3b179e));});});}function checkHopper(){function _0x434c9f(){return function(_0x31fbe9){logger[_0x156d('0x12')](_0x156d('0x30'),_0x156d('0x31'),util[_0x156d('0x32')](_0x31fbe9,{'showHidden':![],'depth':null}));};}var _0x2be297=function(_0x2332c4,_0x55d0a7){var _0x553b2e=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x156d('0x1e'),_0x156d('0x33'),_0x156d('0x34'),_0x156d('0x35'),_0x55d0a7,_0x156d('0x36'),'updatedAt'],squel['select']()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x33'))['field']('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),_0x156d('0x35'))['field'](_0x2332c4['id'][_0x156d('0x39')](),_0x55d0a7)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))['from'](_0x156d('0x3b'))['where'](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x156d('0x3d')](_0x156d('0x3f'),squel[_0x156d('0x40')]()['field'](_0x156d('0x1e'))['from'](_0x156d('0x41'))['where'](_0x55d0a7+_0x156d('0x42'),_0x2332c4['id'][_0x156d('0x39')]())))[_0x156d('0x39')]();return _0x553b2e;};var _0x4d61a6=function(_0x22242f,_0x12cd95){var _0x2993a6=squel[_0x156d('0x43')]()[_0x156d('0x44')]('cm_hopper')[_0x156d('0x45')]([_0x156d('0x1e'),_0x156d('0x33'),'ContactId',_0x156d('0x35'),_0x12cd95,_0x156d('0x36'),'updatedAt'],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')]('NOW()',_0x156d('0x33'))[_0x156d('0x37')]('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),'ListId')['field'](_0x22242f['id'][_0x156d('0x39')](),_0x12cd95)['field'](_0x156d('0x38'),'createdAt')[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')](_0x156d('0x3b'))['where'](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('id\x20IN\x20?',squel[_0x156d('0x47')](hopperContacts))['where'](_0x156d('0x48'))[_0x156d('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x156d('0x37')](_0x156d('0x49'))[_0x156d('0x46')](_0x156d('0x4a'))[_0x156d('0x3d')](_0x12cd95+_0x156d('0x42'),_0x22242f['id'][_0x156d('0x39')]()))['where'](_0x156d('0x3f'),squel[_0x156d('0x40')]()['field'](_0x156d('0x1e'))[_0x156d('0x46')]('cm_hopper')[_0x156d('0x3d')](_0x12cd95+'\x20=\x20?',_0x22242f['id']['toString']())))[_0x156d('0x39')]();return _0x2993a6;};function _0x3f354b(_0x5632c7,_0x500aae){var _0x5c5295=squel['insert']()[_0x156d('0x44')](_0x156d('0x41'))[_0x156d('0x45')]([_0x156d('0x1e'),_0x156d('0x33'),'ContactId',_0x156d('0x35'),_0x500aae,_0x156d('0x36'),_0x156d('0x3a')],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x33'))[_0x156d('0x37')]('id',_0x156d('0x34'))[_0x156d('0x37')](LISTID[_0x156d('0x39')](),_0x156d('0x35'))['field'](_0x5632c7['id'][_0x156d('0x39')](),_0x500aae)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')]('cm_contacts')[_0x156d('0x3d')](_0x156d('0x3c'))[_0x156d('0x3d')](_0x156d('0x3e'),LISTID['toString']())[_0x156d('0x3d')]('id\x20IN\x20?',squel[_0x156d('0x47')](hopperContacts))[_0x156d('0x3d')](_0x156d('0x48')))['toString']();return _0x5c5295;}function _0x250106(_0xb16e01,_0x49c1f0){var _0x147a39=squel[_0x156d('0x43')]()[_0x156d('0x44')](_0x156d('0x4b'))[_0x156d('0x45')](['phone',_0x156d('0x34'),_0x156d('0x35'),_0x49c1f0,_0x156d('0x36'),'updatedAt'],squel[_0x156d('0x40')]()[_0x156d('0x37')](_0x156d('0x1e'),_0x156d('0x1e'))[_0x156d('0x37')]('id',_0x156d('0x34'))['field'](LISTID[_0x156d('0x39')](),'ListId')[_0x156d('0x37')](_0xb16e01['id'][_0x156d('0x39')](),_0x49c1f0)[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x36'))[_0x156d('0x37')](_0x156d('0x38'),_0x156d('0x3a'))[_0x156d('0x46')](_0x156d('0x3b'))[_0x156d('0x3d')](_0x156d('0x3c'))['where'](_0x156d('0x3e'),LISTID[_0x156d('0x39')]())[_0x156d('0x3d')](_0x156d('0x4c'),squel[_0x156d('0x47')](hopperContacts))[_0x156d('0x3d')](_0x156d('0x48')))[_0x156d('0x39')]();return _0x147a39;}return db[_0x156d('0x4d')][_0x156d('0x4e')]({'where':{'type':_0x156d('0x4f')},'attributes':['id',_0x156d('0x50')],'include':[{'model':db['CmList'],'as':_0x156d('0x51'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x50277b){var _0x28acc6=[];if(_0x50277b){var _0x5b6400;for(var _0x42fdc4=0x0,_0x315e90;_0x42fdc4<_0x50277b[_0x156d('0x18')];_0x42fdc4+=0x1){_0x315e90=_0x50277b[_0x42fdc4][_0x156d('0x52')]({'plain':!![]});switch(_0x315e90['dialCheckDuplicateType']){case _0x156d('0x53'):_0x28acc6[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x4d61a6(_0x315e90,_0x156d('0x56')))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));break;case _0x156d('0x57'):_0x28acc6['push'](db[_0x156d('0x54')][_0x156d('0x55')](_0x2be297(_0x315e90,_0x156d('0x56')))['then'](function(){})['catch'](_0x434c9f()));break;default:_0x28acc6[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x3f354b(_0x315e90,_0x156d('0x56')))[_0x156d('0x2a')](function(){})['catch'](_0x434c9f()));}}}return _0x28acc6;})['all']()[_0x156d('0x2a')](function(){return db[_0x156d('0x4d')][_0x156d('0x4e')]({'where':{'type':_0x156d('0x4f')},'attributes':['id'],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x2e9058){var _0x5ed421=[];if(_0x2e9058){var _0x427870;for(var _0x1a2f4c=0x0,_0x580719;_0x1a2f4c<_0x2e9058['length'];_0x1a2f4c+=0x1){_0x580719=_0x2e9058[_0x1a2f4c]['get']({'plain':!![]});_0x5ed421[_0x156d('0x2b')](db['sequelize'][_0x156d('0x55')](_0x250106(_0x580719,_0x156d('0x56')))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));}}return _0x5ed421;})[_0x156d('0x5a')]();})['then'](function(){return db[_0x156d('0x5b')]['findAll']({'attributes':['id',_0x156d('0x50')],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x51'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x146740){var _0x49130f=[];if(_0x146740){for(var _0x341c87=0x0,_0x2d3a8e;_0x341c87<_0x146740[_0x156d('0x18')];_0x341c87+=0x1){_0x2d3a8e=_0x146740[_0x341c87][_0x156d('0x52')]({'plain':!![]});switch(_0x2d3a8e[_0x156d('0x50')]){case _0x156d('0x53'):_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x4d61a6(_0x2d3a8e,'CampaignId'))[_0x156d('0x2a')](function(){})[_0x156d('0x2d')](_0x434c9f()));break;case _0x156d('0x57'):_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x2be297(_0x2d3a8e,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));break;default:_0x49130f[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x3f354b(_0x2d3a8e,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));}}}return _0x49130f;})[_0x156d('0x5a')]();})[_0x156d('0x2a')](function(){return db[_0x156d('0x5b')][_0x156d('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x156d('0x58')],'as':_0x156d('0x59'),'where':{'id':LISTID}}]})[_0x156d('0x2a')](function(_0x43e765){var _0x1f539b=[];if(_0x43e765){for(var _0x258ba6=0x0,_0x249e33;_0x258ba6<_0x43e765['length'];_0x258ba6+=0x1){_0x249e33=_0x43e765[_0x258ba6][_0x156d('0x52')]({'plain':!![]});_0x1f539b[_0x156d('0x2b')](db[_0x156d('0x54')][_0x156d('0x55')](_0x250106(_0x249e33,_0x156d('0x5c')))['then'](function(){})[_0x156d('0x2d')](_0x434c9f()));}}return _0x1f539b;})[_0x156d('0x5a')]();})[_0x156d('0x2d')](function(_0x2842d7){logger['error'](_0x156d('0x5d'),_0x156d('0x5e'),_0x2842d7[_0x156d('0x2f')]);});}var processPromises=function(_0xdbfc22){return BPromise['all'](promises)[_0x156d('0x2a')](function(_0x55693a){})[_0x156d('0x2d')](function(_0xb2aad3){logger[_0x156d('0x12')](_0x156d('0x5f'),JSON['stringify'](_0xb2aad3));})[_0x156d('0x60')](function(){socket[_0x156d('0x61')](_0x156d('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xdbfc22){return _0xdbfc22[_0x156d('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x156d('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x156d('0x2a')](function(){socket[_0x156d('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x156d('0x64')](FILEPATH);}catch(_0x570606){logger[_0x156d('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x156d('0x65')](_0x570606));}finally{process['exit'](0x0);}});};process['on'](_0x156d('0x66'),function(){logger['info'](_0x156d('0x67'));endCsv();});function main(){return BPromise[_0x156d('0x68')]()[_0x156d('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x156d('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x156d('0x2a')](function(_0x161356){var _0x3ad1cd=fs[_0x156d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x156d('0x6a')](_0x3ad1cd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x131989,_0x542bf1){total+=0x1;var _0x349e20=total;promises['push'](checkRow(_0x131989,_0x161356,_0x349e20)[_0x156d('0x2a')](function(){success+=0x1;})[_0x156d('0x2d')](function(_0xc0b8c7){if(_0xc0b8c7[_0x156d('0x12')]){errors+=0x1;delete _0xc0b8c7['error'];}else if(_0xc0b8c7[_0x156d('0x26')]){duplicates+=0x1;delete _0xc0b8c7[_0x156d('0x26')];}rows[_0x156d('0x2b')](_0xc0b8c7);}));if(total%0xc8===0x0){_0x542bf1['pause']();return processPromises(_0x542bf1);}},'complete':function(){return processPromises()[_0x156d('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x159e37,_0x2ad1fc){logger[_0x156d('0x6b')](_0x156d('0x6c'),JSON[_0x156d('0x65')](_0x159e37));endCsv();}});})[_0x156d('0x2d')](function(_0x23eb4c){logger[_0x156d('0x12')](_0x156d('0x6d'),JSON[_0x156d('0x65')](_0x23eb4c));});}main(); \ No newline at end of file +var _0x7fb1=['\x20=\x20?','insert','deletedAt\x20IS\x20NULL','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','CmList','Campaign','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','errors','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','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','pick','catch','stringify','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','ContactId','field','NOW()','toString','createdAt','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select'];(function(_0x2ca254,_0x18d801){var _0x24dde7=function(_0x3160e0){while(--_0x3160e0){_0x2ca254['push'](_0x2ca254['shift']());}};_0x24dde7(++_0x18d801);}(_0x7fb1,0x177));var _0x17fb=function(_0x18f8ff,_0x257e95){_0x18f8ff=_0x18f8ff-0x0;var _0x18de97=_0x7fb1[_0x18f8ff];return _0x18de97;};'use strict';var BPromise=require(_0x17fb('0x0'));var util=require(_0x17fb('0x1'));var _=require(_0x17fb('0x2'));var fs=require('fs');var squel=require(_0x17fb('0x3'));var Papa=require('papaparse');var Redis=require(_0x17fb('0x4'));var db=require(_0x17fb('0x5'))['db'];var config=require(_0x17fb('0x6'));var logger=require(_0x17fb('0x7'))('api');config[_0x17fb('0x8')]=_[_0x17fb('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x17fb('0xa'))(new Redis(config[_0x17fb('0x8')]));require(_0x17fb('0xb'))[_0x17fb('0xc')](socket);try{if(!process[_0x17fb('0xd')][0x2]||process[_0x17fb('0xd')][0x2]==='undefined'||process[_0x17fb('0xd')][0x2]===_0x17fb('0xe')){throw new Error(_0x17fb('0xf'));}var FILEPATH=process[_0x17fb('0xd')][0x2];if(!process[_0x17fb('0xd')][0x3]||process[_0x17fb('0xd')][0x3]===_0x17fb('0x10')||process[_0x17fb('0xd')][0x3]===_0x17fb('0xe')||!process[_0x17fb('0xd')][0x4]||process[_0x17fb('0xd')][0x4]===_0x17fb('0x10')||process[_0x17fb('0xd')][0x4]===_0x17fb('0xe')){throw new Error(_0x17fb('0x11'));}var FIELDS=_['zipObject'](process[_0x17fb('0xd')][0x3][_0x17fb('0x12')](','),process['argv'][0x4][_0x17fb('0x12')](','));if(!process[_0x17fb('0xd')][0x5]||process['argv'][0x5]==='undefined'||process[_0x17fb('0xd')][0x5]===_0x17fb('0xe')){throw new Error(_0x17fb('0x13'));}var LISTID=process[_0x17fb('0xd')][0x5];var COMPANYID=process[_0x17fb('0xd')][0x6]&&process[_0x17fb('0xd')][0x6]!==_0x17fb('0x10')&&process[_0x17fb('0xd')][0x6]!==_0x17fb('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x17fb('0xd')][0x7]&&process['argv'][0x7]!==_0x17fb('0x10')&&process['argv'][0x7]!==_0x17fb('0xe')?process[_0x17fb('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x17fb('0xd')][0x8]==='undefined'||process[_0x17fb('0xd')][0x8]==='null'){throw new Error(_0x17fb('0x14'));}var SOCKET_TIMESTAMP=process[_0x17fb('0xd')][0x8];}catch(_0x1fc1cc){logger[_0x17fb('0x15')](_0x1fc1cc);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(_0x1ee3b0,_0x57776f,_0x2d9616,_0x2a701a){var _0x4dbbef={'message':_0x57776f};_0x4dbbef[_0x1ee3b0]=!![];if(_0x2d9616){_0x4dbbef['contact']=_0x2d9616;}if(_0x2a701a){_0x4dbbef[_0x17fb('0x16')]=_0x2a701a;}return _0x4dbbef;}function isEmail(_0x10ff13){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'](_0x10ff13);}function checkRow(_0x4aa477,_0x25f0c5,_0x14ea9c){return new BPromise(function(_0x397045,_0x92b3d){if(_[_0x17fb('0x17')](_0x4aa477)){return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x14ea9c));}if(_0x4aa477[_0x17fb('0x18')]&&_0x4aa477['errors']['length']){var _0x363386=_[_0x17fb('0x19')](_0x4aa477[_0x17fb('0x18')],_0x17fb('0x1a'))[_0x17fb('0x1b')](';');return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),_0x363386,null,_0x14ea9c));}var _0x38276a={};for(var _0x1bb009 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1bb009)&&FIELDS[_0x1bb009]){_0x38276a[_0x1bb009]=_0x4aa477[_0x17fb('0x1c')][0x0][FIELDS[_0x1bb009]]||_0x4aa477[_0x17fb('0x1c')][0x0]['\ufeff'+FIELDS[_0x1bb009]];}}if(!_0x38276a[_0x17fb('0x1d')]){return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),_0x17fb('0x1e'),null,_0x14ea9c));}if(!_0x38276a[_0x17fb('0x1f')]){return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),_0x17fb('0x20'),null,_0x14ea9c));}if(_0x38276a[_0x17fb('0x21')]){var _0x2dbc8b=moment(_0x38276a['birthDate'],'YYYY-MM-DD');if(!_0x2dbc8b[_0x17fb('0x22')]()){return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),_0x17fb('0x23'),null,_0x14ea9c));}}if(_0x38276a[_0x17fb('0x24')]){if(!isEmail(_0x38276a[_0x17fb('0x24')])){return _0x92b3d(handleCheckRowError(_0x17fb('0x15'),_0x17fb('0x25'),null,_0x14ea9c));}}_0x38276a[_0x17fb('0x26')]=LISTID;_0x38276a[_0x17fb('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x25f0c5){var _0x4239fc={};for(var _0x58c65c=0x0,_0x1e8dc4=DUPLICATES[_0x17fb('0x28')];_0x58c65c<_0x1e8dc4;_0x58c65c+=0x1){_0x4239fc[DUPLICATES[_0x58c65c]]=_0x38276a[DUPLICATES[_0x58c65c]];}var _0x5e9c5d=_['find'](_0x25f0c5,_0x4239fc);if(_0x5e9c5d){return _0x92b3d(handleCheckRowError('duplicate',_0x17fb('0x29'),_0x5e9c5d,_0x14ea9c));}}return db[_0x17fb('0x2a')][_0x17fb('0x2b')](_0x38276a,{'raw':!![],'hooks':![],'fields':_[_0x17fb('0x2c')](_0x38276a)})[_0x17fb('0x2d')](function(_0xdc98a6){if(DUPLICATES&&DUPLICATES[_0x17fb('0x28')]&&_0x25f0c5){_0x25f0c5[_0x17fb('0x2e')](_[_0x17fb('0x2f')](_0x38276a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xdc98a6['id'];return _0x397045();})[_0x17fb('0x30')](function(_0x1779dc){return _0x92b3d(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x1779dc['message']||JSON[_0x17fb('0x31')](_0x1779dc)),null,_0x14ea9c));});});}function checkHopper(){function _0x44b0d8(){return function(_0x3cb262){logger[_0x17fb('0x15')](_0x17fb('0x32'),_0x17fb('0x33'),util['inspect'](_0x3cb262,{'showHidden':![],'depth':null}));};}var _0x41bee2=function(_0x108668,_0x37e09c){var _0x37061e=squel['insert']()[_0x17fb('0x34')](_0x17fb('0x35'))[_0x17fb('0x36')]([_0x17fb('0x1f'),_0x17fb('0x37'),_0x17fb('0x38'),_0x17fb('0x26'),_0x37e09c,'createdAt','updatedAt'],squel['select']()[_0x17fb('0x39')]('phone','phone')['field'](_0x17fb('0x3a'),_0x17fb('0x37'))[_0x17fb('0x39')]('id',_0x17fb('0x38'))[_0x17fb('0x39')](LISTID[_0x17fb('0x3b')](),_0x17fb('0x26'))[_0x17fb('0x39')](_0x108668['id'][_0x17fb('0x3b')](),_0x37e09c)[_0x17fb('0x39')]('NOW()',_0x17fb('0x3c'))['field'](_0x17fb('0x3a'),_0x17fb('0x3d'))[_0x17fb('0x3e')](_0x17fb('0x3f'))[_0x17fb('0x40')]('deletedAt\x20IS\x20NULL')[_0x17fb('0x40')](_0x17fb('0x41'),LISTID[_0x17fb('0x3b')]())[_0x17fb('0x40')](_0x17fb('0x42'))[_0x17fb('0x40')](_0x17fb('0x43'),squel[_0x17fb('0x44')]()[_0x17fb('0x39')](_0x17fb('0x1f'))['from'](_0x17fb('0x35'))[_0x17fb('0x40')](_0x37e09c+_0x17fb('0x45'),_0x108668['id'][_0x17fb('0x3b')]())))['toString']();return _0x37061e;};var _0x476311=function(_0x929140,_0x2e591b){var _0x1a8567=squel[_0x17fb('0x46')]()[_0x17fb('0x34')](_0x17fb('0x35'))[_0x17fb('0x36')]([_0x17fb('0x1f'),'scheduledAt','ContactId','ListId',_0x2e591b,_0x17fb('0x3c'),_0x17fb('0x3d')],squel[_0x17fb('0x44')]()[_0x17fb('0x39')](_0x17fb('0x1f'),_0x17fb('0x1f'))[_0x17fb('0x39')]('NOW()','scheduledAt')[_0x17fb('0x39')]('id',_0x17fb('0x38'))['field'](LISTID[_0x17fb('0x3b')](),_0x17fb('0x26'))[_0x17fb('0x39')](_0x929140['id'][_0x17fb('0x3b')](),_0x2e591b)[_0x17fb('0x39')](_0x17fb('0x3a'),_0x17fb('0x3c'))[_0x17fb('0x39')](_0x17fb('0x3a'),'updatedAt')[_0x17fb('0x3e')](_0x17fb('0x3f'))['where'](_0x17fb('0x47'))[_0x17fb('0x40')](_0x17fb('0x41'),LISTID[_0x17fb('0x3b')]())['where']('id\x20IN\x20?',squel[_0x17fb('0x48')](hopperContacts))[_0x17fb('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x17fb('0x40')](_0x17fb('0x43'),squel[_0x17fb('0x44')]()[_0x17fb('0x39')](_0x17fb('0x49'))[_0x17fb('0x3e')](_0x17fb('0x4a'))['where'](_0x2e591b+_0x17fb('0x45'),_0x929140['id'][_0x17fb('0x3b')]()))[_0x17fb('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x17fb('0x44')]()[_0x17fb('0x39')]('phone')[_0x17fb('0x3e')]('cm_hopper')[_0x17fb('0x40')](_0x2e591b+_0x17fb('0x45'),_0x929140['id'][_0x17fb('0x3b')]())))[_0x17fb('0x3b')]();return _0x1a8567;};function _0x47e8cc(_0x1c980f,_0x2f83cf){var _0x2c365c=squel[_0x17fb('0x46')]()['into'](_0x17fb('0x35'))[_0x17fb('0x36')](['phone',_0x17fb('0x37'),_0x17fb('0x38'),'ListId',_0x2f83cf,_0x17fb('0x3c'),_0x17fb('0x3d')],squel[_0x17fb('0x44')]()[_0x17fb('0x39')](_0x17fb('0x1f'),_0x17fb('0x1f'))[_0x17fb('0x39')](_0x17fb('0x3a'),_0x17fb('0x37'))[_0x17fb('0x39')]('id','ContactId')[_0x17fb('0x39')](LISTID['toString'](),_0x17fb('0x26'))[_0x17fb('0x39')](_0x1c980f['id'][_0x17fb('0x3b')](),_0x2f83cf)['field']('NOW()',_0x17fb('0x3c'))[_0x17fb('0x39')]('NOW()','updatedAt')[_0x17fb('0x3e')]('cm_contacts')[_0x17fb('0x40')](_0x17fb('0x47'))['where'](_0x17fb('0x41'),LISTID['toString']())[_0x17fb('0x40')](_0x17fb('0x4b'),squel[_0x17fb('0x48')](hopperContacts))['where'](_0x17fb('0x42')))[_0x17fb('0x3b')]();return _0x2c365c;}function _0x43c7d9(_0x417aa2,_0x1e7d4c){var _0x1f31c7=squel[_0x17fb('0x46')]()['into'](_0x17fb('0x4c'))[_0x17fb('0x36')]([_0x17fb('0x1f'),_0x17fb('0x38'),_0x17fb('0x26'),_0x1e7d4c,_0x17fb('0x3c'),'updatedAt'],squel[_0x17fb('0x44')]()[_0x17fb('0x39')](_0x17fb('0x1f'),'phone')[_0x17fb('0x39')]('id',_0x17fb('0x38'))[_0x17fb('0x39')](LISTID[_0x17fb('0x3b')](),_0x17fb('0x26'))[_0x17fb('0x39')](_0x417aa2['id'][_0x17fb('0x3b')](),_0x1e7d4c)[_0x17fb('0x39')](_0x17fb('0x3a'),'createdAt')[_0x17fb('0x39')]('NOW()',_0x17fb('0x3d'))[_0x17fb('0x3e')](_0x17fb('0x3f'))['where'](_0x17fb('0x47'))['where'](_0x17fb('0x41'),LISTID[_0x17fb('0x3b')]())[_0x17fb('0x40')](_0x17fb('0x4b'),squel['str'](hopperContacts))[_0x17fb('0x40')](_0x17fb('0x42')))[_0x17fb('0x3b')]();return _0x1f31c7;}return db['VoiceQueue'][_0x17fb('0x4d')]({'where':{'type':_0x17fb('0x4e')},'attributes':['id',_0x17fb('0x4f')],'include':[{'model':db['CmList'],'as':_0x17fb('0x50'),'where':{'id':LISTID}}]})[_0x17fb('0x2d')](function(_0x5b39ba){var _0x217a60=[];if(_0x5b39ba){var _0x3fefae;for(var _0x7a4709=0x0,_0x7ad24d;_0x7a4709<_0x5b39ba[_0x17fb('0x28')];_0x7a4709+=0x1){_0x7ad24d=_0x5b39ba[_0x7a4709][_0x17fb('0x51')]({'plain':!![]});switch(_0x7ad24d[_0x17fb('0x4f')]){case _0x17fb('0x52'):_0x217a60[_0x17fb('0x2e')](db[_0x17fb('0x53')][_0x17fb('0x54')](_0x476311(_0x7ad24d,_0x17fb('0x55')))[_0x17fb('0x2d')](function(){})[_0x17fb('0x30')](_0x44b0d8()));break;case _0x17fb('0x56'):_0x217a60[_0x17fb('0x2e')](db[_0x17fb('0x53')]['query'](_0x41bee2(_0x7ad24d,_0x17fb('0x55')))['then'](function(){})['catch'](_0x44b0d8()));break;default:_0x217a60[_0x17fb('0x2e')](db[_0x17fb('0x53')][_0x17fb('0x54')](_0x47e8cc(_0x7ad24d,'VoiceQueueId'))[_0x17fb('0x2d')](function(){})['catch'](_0x44b0d8()));}}}return _0x217a60;})[_0x17fb('0x57')]()['then'](function(){return db[_0x17fb('0x58')]['findAll']({'where':{'type':_0x17fb('0x4e')},'attributes':['id'],'include':[{'model':db[_0x17fb('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x537f68){var _0x5eef4c=[];if(_0x537f68){var _0x12f652;for(var _0x42ccc7=0x0,_0x47638f;_0x42ccc7<_0x537f68[_0x17fb('0x28')];_0x42ccc7+=0x1){_0x47638f=_0x537f68[_0x42ccc7][_0x17fb('0x51')]({'plain':!![]});_0x5eef4c[_0x17fb('0x2e')](db[_0x17fb('0x53')]['query'](_0x43c7d9(_0x47638f,_0x17fb('0x55')))[_0x17fb('0x2d')](function(){})[_0x17fb('0x30')](_0x44b0d8()));}}return _0x5eef4c;})['all']();})[_0x17fb('0x2d')](function(){return db[_0x17fb('0x5a')][_0x17fb('0x4d')]({'attributes':['id',_0x17fb('0x4f')],'include':[{'model':db['CmList'],'as':_0x17fb('0x50'),'where':{'id':LISTID}}]})[_0x17fb('0x2d')](function(_0x12bfae){var _0xd41947=[];if(_0x12bfae){for(var _0x26b131=0x0,_0x3cf99a;_0x26b131<_0x12bfae['length'];_0x26b131+=0x1){_0x3cf99a=_0x12bfae[_0x26b131]['get']({'plain':!![]});switch(_0x3cf99a[_0x17fb('0x4f')]){case'always':_0xd41947[_0x17fb('0x2e')](db[_0x17fb('0x53')][_0x17fb('0x54')](_0x476311(_0x3cf99a,'CampaignId'))[_0x17fb('0x2d')](function(){})['catch'](_0x44b0d8()));break;case'onlyIfOpen':_0xd41947[_0x17fb('0x2e')](db[_0x17fb('0x53')][_0x17fb('0x54')](_0x41bee2(_0x3cf99a,'CampaignId'))['then'](function(){})[_0x17fb('0x30')](_0x44b0d8()));break;default:_0xd41947[_0x17fb('0x2e')](db['sequelize'][_0x17fb('0x54')](_0x47e8cc(_0x3cf99a,_0x17fb('0x5b')))[_0x17fb('0x2d')](function(){})[_0x17fb('0x30')](_0x44b0d8()));}}}return _0xd41947;})[_0x17fb('0x57')]();})[_0x17fb('0x2d')](function(){return db[_0x17fb('0x5a')][_0x17fb('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x17fb('0x59')],'as':_0x17fb('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x175900){var _0x48c390=[];if(_0x175900){for(var _0x3bb9d2=0x0,_0x2aab4d;_0x3bb9d2<_0x175900[_0x17fb('0x28')];_0x3bb9d2+=0x1){_0x2aab4d=_0x175900[_0x3bb9d2]['get']({'plain':!![]});_0x48c390[_0x17fb('0x2e')](db[_0x17fb('0x53')][_0x17fb('0x54')](_0x43c7d9(_0x2aab4d,_0x17fb('0x5b')))[_0x17fb('0x2d')](function(){})[_0x17fb('0x30')](_0x44b0d8()));}}return _0x48c390;})[_0x17fb('0x57')]();})[_0x17fb('0x30')](function(_0x3c8ad9){logger[_0x17fb('0x15')]('cmContact,\x20%s,\x20%s',_0x17fb('0x5d'),_0x3c8ad9[_0x17fb('0x1a')]);});}var processPromises=function(_0x227a0e){return BPromise['all'](promises)[_0x17fb('0x2d')](function(_0xf399c){})['catch'](function(_0x2e3b4a){logger[_0x17fb('0x15')](_0x17fb('0x5e'),JSON['stringify'](_0x2e3b4a));})[_0x17fb('0x5f')](function(){socket[_0x17fb('0x60')](_0x17fb('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x227a0e){return _0x227a0e[_0x17fb('0x62')]();}});};var endCsv=function(){return BPromise[_0x17fb('0x63')]()[_0x17fb('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x17fb('0x2d')](function(){socket[_0x17fb('0x60')](_0x17fb('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x17fb('0x64')](FILEPATH);}catch(_0x3734ba){logger[_0x17fb('0x15')](_0x17fb('0x65'),JSON['stringify'](_0x3734ba));}finally{process[_0x17fb('0x66')](0x0);}});};process['on'](_0x17fb('0x67'),function(){logger[_0x17fb('0x68')](_0x17fb('0x69'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x17fb('0x12')](',');return db[_0x17fb('0x2a')][_0x17fb('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x14612b){var _0x1d27c9=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x17fb('0x6a')](_0x1d27c9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d680c,_0x507abe){total+=0x1;var _0x875fec=total;promises[_0x17fb('0x2e')](checkRow(_0x3d680c,_0x14612b,_0x875fec)[_0x17fb('0x2d')](function(){success+=0x1;})[_0x17fb('0x30')](function(_0x555cad){if(_0x555cad[_0x17fb('0x15')]){errors+=0x1;delete _0x555cad[_0x17fb('0x15')];}else if(_0x555cad['duplicate']){duplicates+=0x1;delete _0x555cad[_0x17fb('0x6b')];}rows[_0x17fb('0x2e')](_0x555cad);}));if(total%0xc8===0x0){_0x507abe[_0x17fb('0x6c')]();return processPromises(_0x507abe);}},'complete':function(){return processPromises()[_0x17fb('0x2d')](function(){logger[_0x17fb('0x68')](_0x17fb('0x6d'));endCsv();});},'error':function(_0x2e8d31,_0xed555c){logger[_0x17fb('0x68')](_0x17fb('0x6e'),JSON['stringify'](_0x2e8d31));endCsv();}});})[_0x17fb('0x30')](function(_0x3f665a){logger[_0x17fb('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x17fb('0x31')](_0x3f665a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 457e251..b59ac90 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 _0xb786=['contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns_has_cm_lists','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','then','push','all','AdditionalPhones','length','split','isNil','filter','findOne','CmContactHasItem','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert','cm_hopper_black','phone','ListId','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','into','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','dialTimezone','utcOffset','set','offset','main','stringify','send','start','clone','socket_timestamp','root','includes','header','name','_description','parse','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','contactId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb786,0xc1));var _0x6b78=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xb786[_0x3fe6df];return _0x372a0e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x6b78('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x6b78('0x1'));var moment=require(_0x6b78('0x2'));var squel=require('squel');var Redis=require(_0x6b78('0x3'));var db=require(_0x6b78('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0x6b78('0x5'));var logger=require(_0x6b78('0x6'))(_0x6b78('0x7'));config[_0x6b78('0x8')]=_['defaults'](config[_0x6b78('0x8')],{'host':_0x6b78('0x9'),'port':0x18eb});var socket=require(_0x6b78('0xa'))(new Redis(config[_0x6b78('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x6b78('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6b78('0xc')](_0x6b78('0xb'));function isEmail(_0x33b7d0){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'](_0x33b7d0);}function selectNotIn(_0x4cedf7,_0x34feca,_0x57dea6,_0xd6ba8a,_0x3b8171){return squel[_0x6b78('0xd')]()['field']('phone')['from'](_0xd6ba8a)[_0x6b78('0xe')](_0x34feca,null,_0x34feca+_0x6b78('0xf')+_0xd6ba8a+'.'+_0x57dea6)[_0x6b78('0x10')](_0xd6ba8a+'.'+_0x57dea6+_0x6b78('0x11')+_0x4cedf7+'.'+_0x57dea6)[_0x6b78('0x10')](_0x34feca+_0x6b78('0x12')+_0x3b8171['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2387d6,_0x5ba7b1){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6b78('0x13')](function(_0x4a6912){if(_0x4a6912!==null){var _0x4c8803=[];for(var _0x38469b=0x0;_0x38469b<_0x4a6912['length'];_0x38469b++){var _0x38a15f=_0x4a6912[_0x38469b];_0x4c8803[_0x6b78('0x14')](insertAdditionalPhones(_0x38a15f));}}Promise[_0x6b78('0x15')](_0x4c8803)[_0x6b78('0x13')](function(){_0x2387d6({'val':0x1});});});});}function insertAdditionalPhones(_0x4d1d2d){return new Promise(function(_0x9ffd17,_0x1ed603){var _0x3a2d31=_0x4d1d2d[_0x6b78('0x16')];var _0x513111=_0x3a2d31['split'](';');var _0x1bb3f0=[];orderBy=0x0;for(var _0x13d044=0x0;_0x13d044<_0x513111[_0x6b78('0x17')];_0x13d044++){_0x1bb3f0[_0x6b78('0x14')](splitAdditionalPhone(_0x4d1d2d['id'],_0x513111[_0x13d044]));}Promise[_0x6b78('0x15')](_0x1bb3f0)[_0x6b78('0x13')](function(){_0x9ffd17({'val':_0x513111[_0x6b78('0x17')]});});});}function splitAdditionalPhone(_0x5be07a,_0x4cf78d){return new Promise(function(_0x43897f,_0x265d84){var _0x353ee9=_0x4cf78d[_0x6b78('0x18')](':');var _0x2fb749=_0x353ee9[0x0];var _0x187ae6=_0x353ee9[0x1];if(!_[_0x6b78('0x19')](_0x187ae6)){var _0x108843=_0x187ae6[_0x6b78('0x18')]('|');var _0x151241=[];for(var _0x4d83e4=0x0;_0x4d83e4<_0x108843['length'];_0x4d83e4++){if(_0x108843[_0x4d83e4]!==''){var _0x211362=_[_0x6b78('0x1a')](promisesAdditionalPhones,{'contactId':_0x5be07a,'phone':_0x108843[_0x4d83e4]});if(_0x211362['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6b78('0x14')]({'contactId':_0x5be07a,'contactTypeId':_0x2fb749,'phone':_0x108843[_0x4d83e4],'orderBy':orderBy});}}}_0x43897f({'ok':0x1});}else _0x43897f({'res':0x0});});}function createAdditionalPhone(_0x277d7a,_0x57d493,_0x2b45c5,_0x413f1b){var _0x417ff7='';var _0x5abc52='';var _0x4c8e1e=_0x2b45c5[_0x6b78('0x18')]('§');_0x417ff7=_0x4c8e1e[0x0];if(_0x4c8e1e['length']==0x2)_0x5abc52=_0x4c8e1e[0x1];return new Promise(function(_0xae414c,_0x5b6318){return db['CmContactHasItem'][_0x6b78('0x1b')]({'where':{'CmContactId':_0x277d7a,'item':_0x417ff7}})[_0x6b78('0x13')](function(_0x4c150f){if(_0x4c150f){return db[_0x6b78('0x1c')]['update']({'ItemTypeId':_0x57d493,'description':_0x5abc52,'OrderBy':_0x413f1b},{'where':{'CmContactId':_0x277d7a,'item':_0x417ff7}})['then'](function(_0x27c0c1){_0xae414c({'res':_0x6b78('0x1d')});});}else{return db[_0x6b78('0x1c')]['create']({'CmContactId':_0x277d7a,'item':_0x417ff7,'description':_0x5abc52,'ItemTypeId':_0x57d493,'OrderBy':_0x413f1b,'ItemClass':'PHONE'})['then'](function(_0x4c29ae){_0xae414c({'res':_0x6b78('0x1e')});});}});});}function insertCmHopper(_0x16c9af,_0x552489,_0x2304bf,_0x44a346,_0x17492c){var _0x3f6fb0=[_0x6b78('0x1f'),_0x6b78('0x20'),_0x6b78('0x21'),_0x6b78('0x22'),_0x552489+'.'+_0x44a346,_0x6b78('0x23'),_0x6b78('0x24'),_0x6b78('0x25'),'cm_contacts.UserId','\x22'+_0x17492c+'\x22'];return squel['insert']()['into'](_0x6b78('0x26'))[_0x6b78('0x27')](['phone',_0x6b78('0x28'),_0x6b78('0x29'),'ListId',_0x44a346,_0x6b78('0x2a'),_0x6b78('0x2b'),_0x6b78('0x2c'),'UserId',_0x6b78('0x2d')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x3f6fb0)[_0x6b78('0x2f')](_0x552489)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x552489+_0x6b78('0x32'))[_0x6b78('0xe')](_0x2304bf,null,_0x2304bf+_0x6b78('0xf')+_0x552489+'.'+_0x44a346)['where'](_0x552489+_0x6b78('0x33'),_0x16c9af)[_0x6b78('0x10')](_0x6b78('0x34'),NOW)[_0x6b78('0x10')](_0x6b78('0x35'),selectNotIn(_0x552489,_0x2304bf,_0x44a346,_0x6b78('0x26'),[_0x6b78('0x36'),'\x22onlyIfOpen\x22']))[_0x6b78('0x10')](_0x6b78('0x35'),selectNotIn(_0x552489,_0x2304bf,_0x44a346,_0x6b78('0x26'),['\x22always\x22'])))[_0x6b78('0x37')]();}function insertCmHopperBlack(_0x26767e,_0x220939,_0x2bc06b,_0x55ea4a){var _0x2a0779=['cm_contacts.phone',_0x6b78('0x21'),_0x6b78('0x22'),_0x220939+'.'+_0x55ea4a,'cm_contacts.createdAt',_0x6b78('0x24')];return squel[_0x6b78('0x38')]()['into'](_0x6b78('0x39'))[_0x6b78('0x27')]([_0x6b78('0x3a'),_0x6b78('0x29'),_0x6b78('0x3b'),_0x55ea4a,'createdAt',_0x6b78('0x2b')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x2a0779)['from'](_0x220939)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x220939+_0x6b78('0x32'))[_0x6b78('0xe')](_0x2bc06b,null,_0x2bc06b+_0x6b78('0xf')+_0x220939+'.'+_0x55ea4a)['where'](_0x220939+_0x6b78('0x33'),_0x26767e)['where'](_0x6b78('0x34'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6b78('0xd')]()[_0x6b78('0x3c')](_0x6b78('0x3a'))[_0x6b78('0x2f')](_0x6b78('0x39'))['where']('ListId\x20=\x20?',_0x26767e)[_0x6b78('0x10')](_0x55ea4a+_0x6b78('0x11')+_0x220939+'.'+_0x55ea4a)))[_0x6b78('0x37')]();}function insertTzCmHopper(_0x24a587,_0x5d54a0,_0x192575,_0x1e6091,_0x37c7c4,_0x5416e9){var _0x2d714f=[_0x6b78('0x1f'),_0x6b78('0x3d')+_0x5416e9+_0x6b78('0x3e'),_0x6b78('0x21'),_0x6b78('0x22'),_0x5d54a0+'.'+_0x1e6091,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x37c7c4+'\x22'];var _0x40aea6=squel[_0x6b78('0x38')]()['into']('cm_hopper')[_0x6b78('0x27')]([_0x6b78('0x3a'),_0x6b78('0x28'),'ContactId',_0x6b78('0x3b'),_0x1e6091,_0x6b78('0x2a'),_0x6b78('0x2b'),_0x6b78('0x2c'),_0x6b78('0x3f'),_0x6b78('0x2d')],squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x2d714f)[_0x6b78('0x2f')](_0x5d54a0)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x5d54a0+_0x6b78('0x32'))[_0x6b78('0xe')](_0x192575,null,_0x192575+_0x6b78('0xf')+_0x5d54a0+'.'+_0x1e6091)[_0x6b78('0xe')](_0x5416e9,null,_0x5416e9+_0x6b78('0xf')+_0x5d54a0+'.'+_0x1e6091)[_0x6b78('0x10')](_0x5d54a0+_0x6b78('0x33'),_0x24a587)[_0x6b78('0x10')](_0x6b78('0x34'),NOW)[_0x6b78('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d54a0,_0x192575,_0x1e6091,_0x6b78('0x26'),[_0x6b78('0x36'),'\x22onlyIfOpen\x22']))['where'](_0x6b78('0x35'),selectNotIn(_0x5d54a0,_0x192575,_0x1e6091,_0x6b78('0x26'),[_0x6b78('0x36')])))['toString']();return _0x40aea6;}function insertTzCmHopperBlack(_0x11f556,_0x219f09,_0x520c9c,_0x5523df){var _0x36b474=[_0x6b78('0x1f'),_0x6b78('0x21'),'cm_contacts.ListId',_0x219f09+'.'+_0x5523df,_0x6b78('0x23'),_0x6b78('0x24')];return squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x6b78('0x39'))['fromQuery']([_0x6b78('0x3a'),_0x6b78('0x29'),_0x6b78('0x3b'),_0x5523df,_0x6b78('0x2a'),_0x6b78('0x2b')],squel[_0x6b78('0xd')]()['fields'](_0x36b474)[_0x6b78('0x2f')](_0x219f09)[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x31')+_0x219f09+_0x6b78('0x32'))['join'](_0x520c9c,null,_0x520c9c+_0x6b78('0xf')+_0x219f09+'.'+_0x5523df)[_0x6b78('0x10')](_0x219f09+'.CmListId\x20=\x20?',_0x11f556)[_0x6b78('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6b78('0x10')](_0x6b78('0x35'),squel[_0x6b78('0xd')]()[_0x6b78('0x3c')](_0x6b78('0x3a'))[_0x6b78('0x2f')](_0x6b78('0x39'))[_0x6b78('0x10')]('ListId\x20=\x20?',_0x11f556)[_0x6b78('0x10')](_0x5523df+_0x6b78('0x11')+_0x219f09+'.'+_0x5523df)))[_0x6b78('0x37')]();}function insertCmHopperAdditionalPhones(_0x2d4b49){var _0x3f0b92=[_0x6b78('0x41'),_0x6b78('0x42'),_0x6b78('0x43'),_0x6b78('0x44'),_0x6b78('0x45')];return squel[_0x6b78('0x38')]()[_0x6b78('0x40')]('cm_hopper_additional_phones')[_0x6b78('0x27')]([_0x6b78('0x46'),_0x6b78('0x3a'),_0x6b78('0x47'),_0x6b78('0x2a'),_0x6b78('0x2b')],squel[_0x6b78('0xd')]()['fields'](_0x3f0b92)[_0x6b78('0x2f')]('cm_hopper')[_0x6b78('0xe')](_0x6b78('0x30'),null,_0x6b78('0x48'))[_0x6b78('0xe')](_0x6b78('0x49'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6b78('0x10')](_0x6b78('0x4a'),_0x2d4b49)[_0x6b78('0x10')](_0x6b78('0x34'),NOW))[_0x6b78('0x37')]();}function insertCmContact(_0x13c3e5,_0x1f308c,_0x4d7af4,_0x41f4d6){var _0x1ee6df=_['concat'](_[_0x6b78('0x4b')](_0x41f4d6),[_0x6b78('0x3b'),'CompanyId',_0x6b78('0x2a'),_0x6b78('0x2b')]);return squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x6b78('0x30'))['fromQuery'](_0x1ee6df,squel['select']()[_0x6b78('0x2e')](_0x1ee6df)[_0x6b78('0x2f')](_0x1f308c)[_0x6b78('0x10')]('('+_0x4d7af4['join'](',')+_0x6b78('0x4c'),squel[_0x6b78('0xd')]()[_0x6b78('0x2e')](_0x4d7af4)['from'](_0x6b78('0x30'))[_0x6b78('0x10')](_0x6b78('0x4d'),_0x13c3e5)[_0x6b78('0x10')](_0x6b78('0x4e')))[_0x6b78('0x10')](_0x6b78('0x4f'),squel['select']()['field'](_0x6b78('0x50'),'min_id')[_0x6b78('0x2f')](_0x1f308c)[_0x6b78('0x51')](_0x4d7af4[_0x6b78('0xe')](','))))[_0x6b78('0x37')]();}function handleStop(){logger[_0x6b78('0x52')](_0x6b78('0x53'));stopped=!![];}function handleUncaughtException(_0x37780f){logger[_0x6b78('0x54')](_0x37780f[_0x6b78('0x55')]);process[_0x6b78('0x56')](0x1);}function handleError(_0x319927,_0x58ec3f){stats[_0x6b78('0x57')][_0x6b78('0x14')]({'name':_0x58ec3f[_0x6b78('0x58')],'message':_0x58ec3f['message'],'row':_0x319927});}function handleQuery(_0x2d67f9){logger[_0x6b78('0x52')](_0x2d67f9);return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x2d67f9)[_0x6b78('0x5b')](function(_0x5d5d7f){results[_0x6b78('0x14')](_0x5d5d7f);})[_0x6b78('0x5c')](function(_0x3b882c){logger[_0x6b78('0x54')](_0x3b882c[_0x6b78('0x55')]);});}function updateTzCampaigns(_0x37b658){return new Promise(function(_0x2dac8c,_0x4c4c57){var _0x3a0479=squel[_0x6b78('0xd')]()[_0x6b78('0x2e')]([_0x6b78('0x5d'),'campaigns.dialTimezone'])[_0x6b78('0x2f')](_0x6b78('0x5e'))['join']('campaigns_has_cm_lists',null,_0x6b78('0x5f'))[_0x6b78('0x10')]('campaigns_has_cm_lists.CmListId='+_0x37b658);db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x3a0479[_0x6b78('0x37')]())[_0x6b78('0x5b')](function(_0x34d4a9){var _0x5f53e0=[];for(var _0x3944a3=0x0;_0x3944a3<_0x34d4a9[_0x6b78('0x17')];_0x3944a3++){_0x5f53e0[_0x6b78('0x14')](getTimezoneData(_0x34d4a9[_0x3944a3],tmp_campaigns));}BPromise[_0x6b78('0x15')](_0x5f53e0)[_0x6b78('0x13')](function(){_0x2dac8c({'val':0x1});});})['catch'](function(_0x5d633e){logger['error'](_0x5d633e[_0x6b78('0x55')]);_0x2dac8c({'val':0x0});});});}function updateTzVoiceQueues(_0xe54310){return new Promise(function(_0x29b577,_0x22bf22){var _0x360e47=squel['select']()[_0x6b78('0x2e')](['voice_queues.id',_0x6b78('0x60')])['from'](_0x6b78('0x61'))[_0x6b78('0xe')](_0x6b78('0x62'),null,_0x6b78('0x63'))[_0x6b78('0x10')]('voice_queues_has_cm_lists.CmListId='+_0xe54310);db['sequelize'][_0x6b78('0x5a')](_0x360e47['toString']())[_0x6b78('0x5b')](function(_0xd21b79){var _0x2791ac=[];for(var _0x41f153=0x0;_0x41f153<_0xd21b79[_0x6b78('0x17')];_0x41f153++){_0x2791ac[_0x6b78('0x14')](getTimezoneData(_0xd21b79[_0x41f153],tmp_voice_queues));}BPromise[_0x6b78('0x15')](_0x2791ac)[_0x6b78('0x13')](function(){_0x29b577({'val':0x1});});})[_0x6b78('0x5c')](function(_0x361cc7){logger[_0x6b78('0x54')](_0x361cc7['message']);_0x29b577({'val':0x0});});});}function getTimezoneData(_0x43ec27,_0x305ac3){return new Promise(function(_0xd12edb,_0x231e89){var _0x360799=shared['timezones'];var _0x9a6c93=_0x360799[_0x43ec27[_0x6b78('0x64')]];if(_[_0x6b78('0x19')](_0x9a6c93)){_0xd12edb({'ret':0x1});}else{var _0x18e1f4=_0x9a6c93[_0x6b78('0x65')];var _0x86fb10=squel[_0x6b78('0x38')]()[_0x6b78('0x40')](_0x305ac3)[_0x6b78('0x66')]('id',_0x43ec27['id'])[_0x6b78('0x66')](_0x6b78('0x67'),_0x18e1f4)['set']('dialTimezone',_0x43ec27[_0x6b78('0x64')])[_0x6b78('0x37')]();return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x86fb10)[_0x6b78('0x5b')](function(_0x5a9d17){_0xd12edb({'ret':0x1});})['catch'](function(_0x79dd8a){logger[_0x6b78('0x54')](_0x79dd8a[_0x6b78('0x55')]);_0x231e89({'ret':0x1});});}});}function handleTZQuery(_0x371bf3){logger[_0x6b78('0x52')](_0x371bf3);return db[_0x6b78('0x59')][_0x6b78('0x5a')](_0x371bf3)[_0x6b78('0x5b')](function(_0x29486a){})[_0x6b78('0x5c')](function(_0x2485dc){logger[_0x6b78('0x54')](_0x2485dc['message']);});}function main(_0x5eecf1,_0x1dee20,_0xa40c90,_0x4912e1){logger[_0x6b78('0x52')](_0x6b78('0x68'),_0x5eecf1,JSON[_0x6b78('0x69')](_0x1dee20));process[_0x6b78('0x6a')](_0x6b78('0x6b'));var _0x10b932=_0x1dee20['binding'];var _0x20e904=_[_0x6b78('0x6c')](_0x10b932);var _0xbe0fcc=_0x1dee20[_0x6b78('0x6d')];var _0x162027=path[_0x6b78('0xe')](config[_0x6b78('0x6e')],'server/files/tmp',_0xbe0fcc+'.csv');hasTZ=_[_0x6b78('0x4b')](_0x10b932)[_0x6b78('0x6f')]('dialTimezone');var _0x4177f2=_[_0x6b78('0x4b')](_0x10b932)[_0x6b78('0xe')]();logger[_0x6b78('0x52')](_0x6b78('0x70'),_0x4177f2);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x6b78('0x71')]})['then'](function(_0x30d17d){for(var _0x205486=0x0;_0x205486<_0x30d17d[_0x6b78('0x17')];_0x205486++){if(_0x30d17d[_0x205486]['name']in _0x10b932){contactItemTypes[_0x6b78('0x14')](_0x30d17d[_0x205486]);delete _0x20e904[_0x30d17d[_0x205486][_0x6b78('0x71')]];hasAdditionalPhones=!![];}for(var _0x2bfd96 in _0x10b932){if(_0x30d17d[_0x205486]['name']+_0x6b78('0x72')===_0x2bfd96){phoneDescriptions[_0x6b78('0x14')]({'itemTypeId':_0x30d17d[_0x205486]['id'],'description':_0x2bfd96});delete _0x20e904[_0x2bfd96];}}}if(hasAdditionalPhones)_0x20e904['AdditionalPhones']='';var _0x4fd3ef=_[_0x6b78('0x4b')](_0x20e904)[_0x6b78('0xe')]();logger[_0x6b78('0x52')](_0x6b78('0x70'),_0x4fd3ef);fs['writeFileSync'](_0x162027,_0x4fd3ef+'\x0a');Papa[_0x6b78('0x73')](fs['createReadStream'](_0x5eecf1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52d6ea,_0x14cbe6){try{for(var _0x4cd798=0x0,_0x2b069f=[];_0x4cd798<_0x52d6ea[_0x6b78('0x74')][_0x6b78('0x17')];_0x4cd798++){stats[_0x6b78('0x75')]+=0x1;if(_0x52d6ea[_0x6b78('0x57')][_0x4cd798]){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],_0x52d6ea[_0x6b78('0x57')][_0x4cd798]);}else{var _0x2b025a=[];var _0x1cafe9=[];var _0x14f82a={};for(var _0x33ad97 in _0x10b932){let _0xf562ae=contactItemTypes[_0x6b78('0x76')](_0x2b321f=>_0x2b321f[_0x6b78('0x71')]===_0x33ad97);let _0x2fa673=contactItemTypes[_0x6b78('0x76')](_0x1911a4=>_0x1911a4[_0x6b78('0x71')]+_0x6b78('0x72')===_0x33ad97);if(_['isNil'](_0xf562ae)&&_[_0x6b78('0x19')](_0x2fa673)){if(_0x10b932[_0x6b78('0x77')](_0x33ad97)){if(_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]]){var _0x493bb4=_[_0x6b78('0x78')](_0x52d6ea[_0x6b78('0x74')][_0x4cd798][_0x10b932[_0x33ad97]][_0x6b78('0x79')](/"/g,'\x27'));switch(_0x33ad97){case _0x6b78('0x28'):var _0x286a55=moment(_0x493bb4,_0x6b78('0xb'),!![]);if(_0x286a55['isValid']()){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')](_0x6b78('0x7a'));}break;case'priority':var _0x469569=parseInt(_0x493bb4);_0x493bb4=_[_0x6b78('0x7b')](_0x469569)||_0x469569<0x0||_0x469569>0x4?_0x4912e1?0x3:0x2:_0x469569;_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');break;case _0x6b78('0x3f'):var _0x5b9ecd=parseInt(_0x493bb4);if(_[_0x6b78('0x7c')](_0x5b9ecd)&&_[_0x6b78('0x6f')](_0xa40c90,_0x5b9ecd)){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x5b9ecd+'\x22');}else{_0x2b025a[_0x6b78('0x14')]('agent\x20not\x20exists');}break;case _0x6b78('0x7d'):if(isEmail(_0x493bb4)){_0x2b069f['push']('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x3127c6=moment(_0x493bb4,_0x6b78('0x7e'),!![]);if(_0x3127c6[_0x6b78('0x7f')]()){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}else{_0x2b025a[_0x6b78('0x14')](_0x6b78('0x80'));}break;case _0x6b78('0x64'):var _0x583927=shared['timezones'];var _0x19df06=_0x583927[_0x493bb4];if(!_['isNil'](_0x19df06)){var _0x49ded4=_0x19df06['utcOffset'];_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');_0x2b069f['push']('\x22'+_0x49ded4+'\x22');}break;default:_0x2b069f[_0x6b78('0x14')]('\x22'+_0x493bb4+'\x22');}}else{switch(_0x33ad97){case'firstName':case _0x6b78('0x3a'):_0x2b025a[_0x6b78('0x14')](_0x33ad97+_0x6b78('0x81'));break;default:_0x2b069f[_0x6b78('0x14')]('\x22\x22');}}}}else{var _0x43155c='';if(!_['isNil'](_0xf562ae)){if(!_0x14f82a[_0x6b78('0x77')](_0xf562ae['id'])){if(!_['isNil'](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]])){var _0x493bb4=_['trim'](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x33ad97]][_0x6b78('0x79')](/"/g,'\x27'));var _0x12eab1=phoneDescriptions[_0x6b78('0x76')](_0x563b05=>_0x563b05['itemTypeId']===_0xf562ae['id']);if(!_[_0x6b78('0x19')](_0x12eab1)){var _0x53f9b6=_[_0x6b78('0x78')](_0x52d6ea['data'][_0x4cd798][_0x10b932[_0x12eab1[_0x6b78('0x82')]]][_0x6b78('0x79')](/"/g,'\x27'));if(!_[_0x6b78('0x19')](_0x53f9b6))_0x493bb4=_0x493bb4+'§'+_0x53f9b6;}if(_0x43155c=='')_0x43155c=_0x493bb4;else _0x43155c+='|'+_0x493bb4;}_0x1cafe9[_0x6b78('0x14')](_0xf562ae['id']+':'+_0x43155c);_0x14f82a[_0xf562ae['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b069f[_0x6b78('0x14')]('\x22'+_0x1cafe9[_0x6b78('0xe')](';')+'\x22');}if(_0x2b025a[_0x6b78('0x17')]){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],{'code':_0x6b78('0x83'),'message':_0x2b025a[_0x6b78('0xe')]()});}else{fs[_0x6b78('0x84')](_0x162027,_0x2b069f[_0x6b78('0xe')]()+'\x0a');}_0x2b069f=[];}if(!(stats[_0x6b78('0x75')]%0xc8)){socket['emit'](_0x6b78('0x85')+_0xbe0fcc,stats);stats['errors']=[];}}if(stopped){logger[_0x6b78('0x52')](_0x6b78('0x86'));_0x14cbe6[_0x6b78('0x87')]();}}catch(_0x262a52){handleError(_0x52d6ea[_0x6b78('0x74')][_0x4cd798],{'code':_0x6b78('0x88'),'message':_0x262a52['message']});logger['error']('step',_0x262a52[_0x6b78('0x55')]);}},'complete':function(){try{var _0x5d552e=[];var _0x1d61e8=[];var _0x61197f=_0x6b78('0x30');if(_0x1dee20[_0x6b78('0x89')]&&_0x1dee20[_0x6b78('0x89')][_0x6b78('0x17')]){_0x61197f=_0x6b78('0x8a')+_0xbe0fcc;_0x5d552e[_0x6b78('0x14')]('CREATE\x20TABLE\x20'+_0x61197f+_0x6b78('0x8b'));}tmp_campaigns=_0x6b78('0x8c')+_0xbe0fcc;tmp_voice_queues=_0x6b78('0x8d')+_0xbe0fcc;_0x1d61e8[_0x6b78('0x14')](_0x6b78('0x8e')+tmp_campaigns+_0x6b78('0x8f'));_0x1d61e8[_0x6b78('0x14')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x6b78('0x8f'));BPromise[_0x6b78('0x90')](_0x1d61e8,handleTZQuery)['then'](function(_0x11ef18){updateTzCampaigns(_0x1dee20['ListId'])[_0x6b78('0x13')](function(_0x24fbcd){updateTzVoiceQueues(_0x1dee20[_0x6b78('0x3b')])[_0x6b78('0x13')](function(_0x1dd6b7){if(hasTZ)_0x4fd3ef=_0x4fd3ef[_0x6b78('0x79')](_0x6b78('0x64'),_0x6b78('0x91'));var _0xa55523=util['format'](_0x6b78('0x92'),_0x162027,_0x61197f,_0x4fd3ef,_0x1dee20[_0x6b78('0x3b')],_0x1dee20[_0x6b78('0x93')]||null,NOW,NOW);if(_[_0x6b78('0x19')](_0x10b932[_0x6b78('0x28')])){_0xa55523+=',\x20scheduledAt\x20=\x20NOW()';}_0x5d552e[_0x6b78('0x14')](_0xa55523);if(_0x1dee20[_0x6b78('0x89')]&&_0x1dee20[_0x6b78('0x89')][_0x6b78('0x17')]){_0x5d552e['push'](insertCmContact(_0x1dee20[_0x6b78('0x3b')],_0x61197f,_0x1dee20[_0x6b78('0x89')],_0x10b932));_0x5d552e[_0x6b78('0x14')]('DROP\x20TABLE\x20'+_0x61197f+';');}BPromise['each'](_0x5d552e,handleQuery)[_0x6b78('0x13')](function(_0x4915de){BPromise[_0x6b78('0x15')]([handleAdditionalPhones()])[_0x6b78('0x13')](function(){_0x5d552e=[];for(var _0xa637b3=0x0;_0xa637b3\x20\x20','existsSync'];(function(_0x36ce56,_0x1a188b){var _0x2077bd=function(_0x5165fc){while(--_0x5165fc){_0x36ce56['push'](_0x36ce56['shift']());}};_0x2077bd(++_0x1a188b);}(_0x1caa,0xbf));var _0xa1ca=function(_0x5605b1,_0xb79b6c){_0x5605b1=_0x5605b1-0x0;var _0x1247f8=_0x1caa[_0x5605b1];return _0x1247f8;};'use strict';var fs=require('fs');var path=require(_0xa1ca('0x0'));var _=require('lodash');var Papa=require(_0xa1ca('0x1'));var util=require('util');var BPromise=require(_0xa1ca('0x2'));var moment=require(_0xa1ca('0x3'));var squel=require(_0xa1ca('0x4'));var Redis=require(_0xa1ca('0x5'));var db=require(_0xa1ca('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0xa1ca('0x7'));var logger=require(_0xa1ca('0x8'))(_0xa1ca('0x9'));config['redis']=_[_0xa1ca('0xa')](config['redis'],{'host':_0xa1ca('0xb'),'port':0x18eb});var socket=require(_0xa1ca('0xc'))(new Redis(config[_0xa1ca('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa1ca('0xe')](_0xa1ca('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa1ca('0xe')](_0xa1ca('0xf'));function isEmail(_0x5efd7d){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))*$/[_0xa1ca('0x10')](_0x5efd7d);}function selectNotIn(_0x517def,_0x4e951e,_0x22aa72,_0x180300,_0x577c3a){return squel[_0xa1ca('0x11')]()[_0xa1ca('0x12')]('phone')[_0xa1ca('0x13')](_0x180300)[_0xa1ca('0x14')](_0x4e951e,null,_0x4e951e+'.id\x20=\x20'+_0x180300+'.'+_0x22aa72)[_0xa1ca('0x15')](_0x180300+'.'+_0x22aa72+_0xa1ca('0x16')+_0x517def+'.'+_0x22aa72)[_0xa1ca('0x15')](_0x4e951e+_0xa1ca('0x17')+_0x577c3a[_0xa1ca('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e480c,_0x3f53f1){promisesAdditionalPhones=[];return db[_0xa1ca('0x18')][_0xa1ca('0x19')]({'raw':!![],'attributes':['id',_0xa1ca('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x3b03d6){if(_0x3b03d6!==null){var _0x4224be=[];for(var _0x52a4bf=0x0;_0x52a4bf<_0x3b03d6[_0xa1ca('0x1b')];_0x52a4bf++){var _0x3ff1a0=_0x3b03d6[_0x52a4bf];_0x4224be[_0xa1ca('0x1c')](insertAdditionalPhones(_0x3ff1a0));}}Promise['all'](_0x4224be)[_0xa1ca('0x1d')](function(){_0x4e480c({'val':0x1});});});});}function insertAdditionalPhones(_0x3aeef6){return new Promise(function(_0xf40ea2,_0x5ef24c){var _0x3a481f=_0x3aeef6['AdditionalPhones'];var _0x15288e=_0x3a481f['split'](';');var _0x31d021=[];orderBy=0x0;for(var _0xb73483=0x0;_0xb73483<_0x15288e['length'];_0xb73483++){_0x31d021['push'](splitAdditionalPhone(_0x3aeef6['id'],_0x15288e[_0xb73483]));}Promise[_0xa1ca('0x1e')](_0x31d021)[_0xa1ca('0x1d')](function(){_0xf40ea2({'val':_0x15288e['length']});});});}function splitAdditionalPhone(_0x54ba4a,_0x11b3b0){return new Promise(function(_0x183182,_0x119284){var _0x3c823d=_0x11b3b0[_0xa1ca('0x1f')](':');var _0x1679bb=_0x3c823d[0x0];var _0x500062=_0x3c823d[0x1];if(!_[_0xa1ca('0x20')](_0x500062)){var _0x5d48f5=_0x500062[_0xa1ca('0x1f')]('|');var _0xf75513=[];for(var _0x5cd6a8=0x0;_0x5cd6a8<_0x5d48f5[_0xa1ca('0x1b')];_0x5cd6a8++){if(_0x5d48f5[_0x5cd6a8]!==''){var _0x307c44=_['filter'](promisesAdditionalPhones,{'contactId':_0x54ba4a,'phone':_0x5d48f5[_0x5cd6a8]});if(_0x307c44[_0xa1ca('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x54ba4a,'contactTypeId':_0x1679bb,'phone':_0x5d48f5[_0x5cd6a8],'orderBy':orderBy});}}}_0x183182({'ok':0x1});}else _0x183182({'res':0x0});});}function createAdditionalPhone(_0x3b142e,_0x3e3939,_0x5dde19,_0x24c72e){var _0x3d29da='';var _0x50286f='';var _0x364072=_0x5dde19['split']('§');_0x3d29da=_0x364072[0x0];if(_0x364072[_0xa1ca('0x1b')]==0x2)_0x50286f=_0x364072[0x1];return new Promise(function(_0xadd288,_0x5ecbda){return db['CmContactHasItem'][_0xa1ca('0x21')]({'where':{'CmContactId':_0x3b142e,'item':_0x3d29da}})[_0xa1ca('0x1d')](function(_0x31fecb){if(_0x31fecb){return db['CmContactHasItem'][_0xa1ca('0x22')]({'ItemTypeId':_0x3e3939,'description':_0x50286f,'OrderBy':_0x24c72e},{'where':{'CmContactId':_0x3b142e,'item':_0x3d29da}})['then'](function(_0x5d1653){_0xadd288({'res':_0xa1ca('0x23')});});}else{return db[_0xa1ca('0x24')][_0xa1ca('0x25')]({'CmContactId':_0x3b142e,'item':_0x3d29da,'description':_0x50286f,'ItemTypeId':_0x3e3939,'OrderBy':_0x24c72e,'ItemClass':_0xa1ca('0x26')})[_0xa1ca('0x1d')](function(_0x687b7c){_0xadd288({'res':_0xa1ca('0x27')});});}});});}function insertCmHopper(_0x24bbfe,_0x1c3ffe,_0x4d25d1,_0x9542d8,_0x21450f){var _0x270151=['cm_contacts.phone',_0xa1ca('0x28'),_0xa1ca('0x29'),_0xa1ca('0x2a'),_0x1c3ffe+'.'+_0x9542d8,_0xa1ca('0x2b'),_0xa1ca('0x2c'),_0xa1ca('0x2d'),_0xa1ca('0x2e'),'\x22'+_0x21450f+'\x22'];return squel[_0xa1ca('0x2f')]()[_0xa1ca('0x30')](_0xa1ca('0x31'))[_0xa1ca('0x32')](['phone','scheduledat',_0xa1ca('0x33'),'ListId',_0x9542d8,'createdAt','updatedAt',_0xa1ca('0x34'),'UserId',_0xa1ca('0x35')],squel[_0xa1ca('0x11')]()[_0xa1ca('0x36')](_0x270151)[_0xa1ca('0x13')](_0x1c3ffe)['join'](_0xa1ca('0x37'),null,_0xa1ca('0x38')+_0x1c3ffe+_0xa1ca('0x39'))['join'](_0x4d25d1,null,_0x4d25d1+_0xa1ca('0x3a')+_0x1c3ffe+'.'+_0x9542d8)[_0xa1ca('0x15')](_0x1c3ffe+_0xa1ca('0x3b'),_0x24bbfe)[_0xa1ca('0x15')](_0xa1ca('0x3c'),NOW)[_0xa1ca('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1c3ffe,_0x4d25d1,_0x9542d8,_0xa1ca('0x31'),[_0xa1ca('0x3d'),_0xa1ca('0x3e')]))[_0xa1ca('0x15')](_0xa1ca('0x3f'),selectNotIn(_0x1c3ffe,_0x4d25d1,_0x9542d8,_0xa1ca('0x31'),[_0xa1ca('0x3d')])))['toString']();}function insertCmHopperBlack(_0x43c2bc,_0x1e7a99,_0x5ec8da,_0x3732c8){var _0x17242d=['cm_contacts.phone',_0xa1ca('0x29'),_0xa1ca('0x2a'),_0x1e7a99+'.'+_0x3732c8,_0xa1ca('0x2b'),_0xa1ca('0x2c')];return squel[_0xa1ca('0x2f')]()[_0xa1ca('0x30')](_0xa1ca('0x40'))[_0xa1ca('0x32')](['phone',_0xa1ca('0x33'),_0xa1ca('0x41'),_0x3732c8,_0xa1ca('0x42'),'updatedAt'],squel[_0xa1ca('0x11')]()[_0xa1ca('0x36')](_0x17242d)[_0xa1ca('0x13')](_0x1e7a99)[_0xa1ca('0x14')](_0xa1ca('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x1e7a99+_0xa1ca('0x39'))['join'](_0x5ec8da,null,_0x5ec8da+_0xa1ca('0x3a')+_0x1e7a99+'.'+_0x3732c8)['where'](_0x1e7a99+_0xa1ca('0x3b'),_0x43c2bc)[_0xa1ca('0x15')](_0xa1ca('0x3c'),NOW)[_0xa1ca('0x15')](_0xa1ca('0x3f'),squel[_0xa1ca('0x11')]()[_0xa1ca('0x12')]('phone')['from'](_0xa1ca('0x40'))[_0xa1ca('0x15')]('ListId\x20=\x20?',_0x43c2bc)['where'](_0x3732c8+_0xa1ca('0x16')+_0x1e7a99+'.'+_0x3732c8)))['toString']();}function insertTzCmHopper(_0x57828c,_0x4e034a,_0x164c4a,_0x40ba27,_0x474280,_0x182935){var _0x990b71=[_0xa1ca('0x43'),_0xa1ca('0x44')+_0x182935+_0xa1ca('0x45'),_0xa1ca('0x29'),_0xa1ca('0x2a'),_0x4e034a+'.'+_0x40ba27,_0xa1ca('0x2b'),'cm_contacts.updatedAt','cm_contacts.priority',_0xa1ca('0x2e'),'\x22'+_0x474280+'\x22'];var _0x34eabb=squel[_0xa1ca('0x2f')]()[_0xa1ca('0x30')](_0xa1ca('0x31'))[_0xa1ca('0x32')]([_0xa1ca('0x46'),_0xa1ca('0x47'),'ContactId',_0xa1ca('0x41'),_0x40ba27,_0xa1ca('0x42'),'updatedAt',_0xa1ca('0x34'),_0xa1ca('0x48'),_0xa1ca('0x35')],squel[_0xa1ca('0x11')]()[_0xa1ca('0x36')](_0x990b71)['from'](_0x4e034a)['join']('cm_contacts',null,_0xa1ca('0x38')+_0x4e034a+_0xa1ca('0x39'))[_0xa1ca('0x14')](_0x164c4a,null,_0x164c4a+'.id\x20=\x20'+_0x4e034a+'.'+_0x40ba27)['join'](_0x182935,null,_0x182935+_0xa1ca('0x3a')+_0x4e034a+'.'+_0x40ba27)[_0xa1ca('0x15')](_0x4e034a+_0xa1ca('0x3b'),_0x57828c)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa1ca('0x15')](_0xa1ca('0x3f'),selectNotIn(_0x4e034a,_0x164c4a,_0x40ba27,_0xa1ca('0x31'),['\x22always\x22',_0xa1ca('0x3e')]))[_0xa1ca('0x15')](_0xa1ca('0x3f'),selectNotIn(_0x4e034a,_0x164c4a,_0x40ba27,'cm_hopper',[_0xa1ca('0x3d')])))[_0xa1ca('0x49')]();return _0x34eabb;}function insertTzCmHopperBlack(_0x2c5ec3,_0x19f269,_0x67483e,_0x24f296){var _0x3450a8=['cm_contacts.phone','cm_contacts.id',_0xa1ca('0x2a'),_0x19f269+'.'+_0x24f296,_0xa1ca('0x2b'),_0xa1ca('0x2c')];return squel[_0xa1ca('0x2f')]()[_0xa1ca('0x30')]('cm_hopper_black')[_0xa1ca('0x32')]([_0xa1ca('0x46'),'ContactId','ListId',_0x24f296,'createdAt',_0xa1ca('0x4a')],squel['select']()['fields'](_0x3450a8)[_0xa1ca('0x13')](_0x19f269)[_0xa1ca('0x14')]('cm_contacts',null,_0xa1ca('0x38')+_0x19f269+'.CmListId')[_0xa1ca('0x14')](_0x67483e,null,_0x67483e+_0xa1ca('0x3a')+_0x19f269+'.'+_0x24f296)['where'](_0x19f269+_0xa1ca('0x3b'),_0x2c5ec3)['where'](_0xa1ca('0x3c'),NOW)[_0xa1ca('0x15')](_0xa1ca('0x3f'),squel[_0xa1ca('0x11')]()[_0xa1ca('0x12')](_0xa1ca('0x46'))[_0xa1ca('0x13')]('cm_hopper_black')[_0xa1ca('0x15')](_0xa1ca('0x4b'),_0x2c5ec3)[_0xa1ca('0x15')](_0x24f296+'\x20=\x20'+_0x19f269+'.'+_0x24f296)))['toString']();}function insertCmHopperAdditionalPhones(_0x3f1671){var _0x19959a=[_0xa1ca('0x4c'),_0xa1ca('0x4d'),_0xa1ca('0x4e'),_0xa1ca('0x4f'),_0xa1ca('0x50')];return squel[_0xa1ca('0x2f')]()[_0xa1ca('0x30')](_0xa1ca('0x51'))[_0xa1ca('0x32')]([_0xa1ca('0x52'),'phone',_0xa1ca('0x53'),'createdAt',_0xa1ca('0x4a')],squel[_0xa1ca('0x11')]()['fields'](_0x19959a)['from'](_0xa1ca('0x31'))[_0xa1ca('0x14')]('cm_contacts',null,_0xa1ca('0x54'))[_0xa1ca('0x14')](_0xa1ca('0x55'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xa1ca('0x15')](_0xa1ca('0x56'),_0x3f1671)[_0xa1ca('0x15')](_0xa1ca('0x3c'),NOW))[_0xa1ca('0x49')]();}function insertCmContact(_0x3a1385,_0x3aed2a,_0x46e1d8,_0xcb3f19){var _0x468b88=_['concat'](_[_0xa1ca('0x57')](_0xcb3f19),[_0xa1ca('0x41'),_0xa1ca('0x58'),_0xa1ca('0x42'),'updatedAt']);return squel[_0xa1ca('0x2f')]()['into'](_0xa1ca('0x37'))[_0xa1ca('0x32')](_0x468b88,squel[_0xa1ca('0x11')]()[_0xa1ca('0x36')](_0x468b88)[_0xa1ca('0x13')](_0x3aed2a)['where']('('+_0x46e1d8['join'](',')+_0xa1ca('0x59'),squel[_0xa1ca('0x11')]()[_0xa1ca('0x36')](_0x46e1d8)[_0xa1ca('0x13')](_0xa1ca('0x37'))[_0xa1ca('0x15')](_0xa1ca('0x4b'),_0x3a1385)[_0xa1ca('0x15')](_0xa1ca('0x5a')))[_0xa1ca('0x15')](_0xa1ca('0x5b'),squel[_0xa1ca('0x11')]()[_0xa1ca('0x12')]('MIN(id)',_0xa1ca('0x5c'))['from'](_0x3aed2a)['group'](_0x46e1d8[_0xa1ca('0x14')](','))))[_0xa1ca('0x49')]();}function handleStop(){logger[_0xa1ca('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4293f3){logger[_0xa1ca('0x5e')](_0x4293f3[_0xa1ca('0x5f')]);process[_0xa1ca('0x60')](0x1);}function handleError(_0x200694,_0x48138d){stats[_0xa1ca('0x61')][_0xa1ca('0x1c')]({'name':_0x48138d[_0xa1ca('0x62')],'message':_0x48138d[_0xa1ca('0x5f')],'row':_0x200694});}function handleQuery(_0x3b3a4e){logger[_0xa1ca('0x5d')](_0x3b3a4e);return db['sequelize'][_0xa1ca('0x63')](_0x3b3a4e)[_0xa1ca('0x64')](function(_0x49d3c9){results[_0xa1ca('0x1c')](_0x49d3c9);})['catch'](function(_0x1507fb){logger[_0xa1ca('0x5e')](_0x1507fb[_0xa1ca('0x5f')]);});}function updateTzCampaigns(_0x431968){return new Promise(function(_0x2400c7,_0x2245bd){var _0x8df8ef=squel['select']()['fields']([_0xa1ca('0x65'),_0xa1ca('0x66')])[_0xa1ca('0x13')](_0xa1ca('0x67'))['join'](_0xa1ca('0x68'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xa1ca('0x15')]('campaigns_has_cm_lists.CmListId='+_0x431968);db['sequelize']['query'](_0x8df8ef[_0xa1ca('0x49')]())[_0xa1ca('0x64')](function(_0x2dfccf){var _0x4bcd5a=[];for(var _0x141daa=0x0;_0x141daa<_0x2dfccf[_0xa1ca('0x1b')];_0x141daa++){_0x4bcd5a[_0xa1ca('0x1c')](getTimezoneData(_0x2dfccf[_0x141daa],tmp_campaigns));}BPromise[_0xa1ca('0x1e')](_0x4bcd5a)[_0xa1ca('0x1d')](function(){_0x2400c7({'val':0x1});});})[_0xa1ca('0x69')](function(_0x54f4a7){logger['error'](_0x54f4a7[_0xa1ca('0x5f')]);_0x2400c7({'val':0x0});});});}function updateTzVoiceQueues(_0xf014b9){return new Promise(function(_0x1f08d7,_0x2164b6){var _0x5d4b7f=squel['select']()[_0xa1ca('0x36')]([_0xa1ca('0x6a'),_0xa1ca('0x6b')])['from'](_0xa1ca('0x6c'))['join'](_0xa1ca('0x6d'),null,_0xa1ca('0x6e'))['where']('voice_queues_has_cm_lists.CmListId='+_0xf014b9);db[_0xa1ca('0x6f')][_0xa1ca('0x63')](_0x5d4b7f[_0xa1ca('0x49')]())[_0xa1ca('0x64')](function(_0x4cbef3){var _0x358bf3=[];for(var _0x1191d1=0x0;_0x1191d1<_0x4cbef3[_0xa1ca('0x1b')];_0x1191d1++){_0x358bf3[_0xa1ca('0x1c')](getTimezoneData(_0x4cbef3[_0x1191d1],tmp_voice_queues));}BPromise[_0xa1ca('0x1e')](_0x358bf3)[_0xa1ca('0x1d')](function(){_0x1f08d7({'val':0x1});});})[_0xa1ca('0x69')](function(_0x2db6b9){logger['error'](_0x2db6b9['message']);_0x1f08d7({'val':0x0});});});}function getTimezoneData(_0x540a88,_0x46ad56){return new Promise(function(_0x121167,_0x2de21e){var _0xfd4fdc=shared[_0xa1ca('0x70')];var _0x15a31c=_0xfd4fdc[_0x540a88[_0xa1ca('0x71')]];if(_[_0xa1ca('0x20')](_0x15a31c)){_0x121167({'ret':0x1});}else{var _0x1e08e6=_0x15a31c[_0xa1ca('0x72')];var _0x1c2401=squel[_0xa1ca('0x2f')]()['into'](_0x46ad56)[_0xa1ca('0x73')]('id',_0x540a88['id'])[_0xa1ca('0x73')]('offset',_0x1e08e6)['set'](_0xa1ca('0x71'),_0x540a88[_0xa1ca('0x71')])[_0xa1ca('0x49')]();return db[_0xa1ca('0x6f')][_0xa1ca('0x63')](_0x1c2401)[_0xa1ca('0x64')](function(_0x130b33){_0x121167({'ret':0x1});})[_0xa1ca('0x69')](function(_0x185852){logger['error'](_0x185852[_0xa1ca('0x5f')]);_0x2de21e({'ret':0x1});});}});}function handleTZQuery(_0x47a12e){logger[_0xa1ca('0x5d')](_0x47a12e);return db[_0xa1ca('0x6f')][_0xa1ca('0x63')](_0x47a12e)[_0xa1ca('0x64')](function(_0x2410eb){})['catch'](function(_0x1e4baa){logger[_0xa1ca('0x5e')](_0x1e4baa['message']);});}function main(_0x3e6f0b,_0xea2700,_0x9ff06b,_0x21f65f){logger[_0xa1ca('0x5d')](_0xa1ca('0x74'),_0x3e6f0b,JSON[_0xa1ca('0x75')](_0xea2700));process[_0xa1ca('0x76')](_0xa1ca('0x77'));var _0x3f2201=_0xea2700['binding'];var _0x4e125a=_[_0xa1ca('0x78')](_0x3f2201);var _0xb4c5bc=_0xea2700[_0xa1ca('0x79')];var _0x348a89=path[_0xa1ca('0x14')](config[_0xa1ca('0x7a')],_0xa1ca('0x7b'),_0xb4c5bc+'.csv');hasTZ=_[_0xa1ca('0x57')](_0x3f2201)[_0xa1ca('0x7c')](_0xa1ca('0x71'));var _0x1aa9a0=_['keys'](_0x3f2201)[_0xa1ca('0x14')]();logger[_0xa1ca('0x5d')]('header',_0x1aa9a0);db['ContactItemType'][_0xa1ca('0x19')]({'raw':!![],'attributes':['id','name']})[_0xa1ca('0x1d')](function(_0x31079b){for(var _0x548eab=0x0;_0x548eab<_0x31079b['length'];_0x548eab++){if(_0x31079b[_0x548eab][_0xa1ca('0x7d')]in _0x3f2201){contactItemTypes[_0xa1ca('0x1c')](_0x31079b[_0x548eab]);delete _0x4e125a[_0x31079b[_0x548eab][_0xa1ca('0x7d')]];hasAdditionalPhones=!![];}for(var _0xc73446 in _0x3f2201){if(_0x31079b[_0x548eab][_0xa1ca('0x7d')]+_0xa1ca('0x7e')===_0xc73446){phoneDescriptions[_0xa1ca('0x1c')]({'itemTypeId':_0x31079b[_0x548eab]['id'],'description':_0xc73446});delete _0x4e125a[_0xc73446];}}}if(hasAdditionalPhones)_0x4e125a[_0xa1ca('0x1a')]='';var _0xdf4699=_[_0xa1ca('0x57')](_0x4e125a)[_0xa1ca('0x14')]();logger[_0xa1ca('0x5d')]('header',_0xdf4699);fs[_0xa1ca('0x7f')](_0x348a89,_0xdf4699+'\x0a');Papa[_0xa1ca('0x80')](fs['createReadStream'](_0x3e6f0b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x523b6c,_0x2e8b50){try{for(var _0xb41b99=0x0,_0x80b962=[];_0xb41b99<_0x523b6c[_0xa1ca('0x81')][_0xa1ca('0x1b')];_0xb41b99++){stats[_0xa1ca('0x82')]+=0x1;if(_0x523b6c[_0xa1ca('0x61')][_0xb41b99]){handleError(_0x523b6c[_0xa1ca('0x81')][_0xb41b99],_0x523b6c[_0xa1ca('0x61')][_0xb41b99]);}else{var _0x168b3e=[];var _0x5dc67c=[];var _0x2e7e24={};for(var _0x546c21 in _0x3f2201){let _0x495b40=contactItemTypes[_0xa1ca('0x83')](_0x5d378c=>_0x5d378c[_0xa1ca('0x7d')]===_0x546c21);let _0x1cea52=contactItemTypes[_0xa1ca('0x83')](_0x26d4e9=>_0x26d4e9[_0xa1ca('0x7d')]+_0xa1ca('0x7e')===_0x546c21);if(_[_0xa1ca('0x20')](_0x495b40)&&_['isNil'](_0x1cea52)){if(_0x3f2201['hasOwnProperty'](_0x546c21)){if(_0x523b6c['data'][_0xb41b99][_0x3f2201[_0x546c21]]){var _0x1fc65a=_[_0xa1ca('0x84')](_0x523b6c[_0xa1ca('0x81')][_0xb41b99][_0x3f2201[_0x546c21]][_0xa1ca('0x85')](/"/g,'\x27'));switch(_0x546c21){case _0xa1ca('0x47'):var _0x2f9882=moment(_0x1fc65a,_0xa1ca('0xf'),!![]);if(_0x2f9882[_0xa1ca('0x86')]()){_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x1fc65a+'\x22');}else{_0x168b3e[_0xa1ca('0x1c')](_0xa1ca('0x87'));}break;case _0xa1ca('0x34'):var _0x40aca8=parseInt(_0x1fc65a);_0x1fc65a=_['isNaN'](_0x40aca8)||_0x40aca8<0x0||_0x40aca8>0x4?_0x21f65f?0x3:0x2:_0x40aca8;_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x1fc65a+'\x22');break;case _0xa1ca('0x48'):var _0x24601a=parseInt(_0x1fc65a);if(_['isNumber'](_0x24601a)&&_[_0xa1ca('0x7c')](_0x9ff06b,_0x24601a)){_0x80b962['push']('\x22'+_0x24601a+'\x22');}else{_0x168b3e[_0xa1ca('0x1c')](_0xa1ca('0x88'));}break;case'email':if(isEmail(_0x1fc65a)){_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x1fc65a+'\x22');}else{_0x168b3e['push'](_0xa1ca('0x89'));}break;case'dateOfBirth':var _0x570fb5=moment(_0x1fc65a,_0xa1ca('0x8a'),!![]);if(_0x570fb5['isValid']()){_0x80b962['push']('\x22'+_0x1fc65a+'\x22');}else{_0x168b3e['push'](_0xa1ca('0x8b'));}break;case _0xa1ca('0x71'):var _0x2bdaa9=shared[_0xa1ca('0x70')];var _0x446535=_0x2bdaa9[_0x1fc65a];if(!_[_0xa1ca('0x20')](_0x446535)){var _0x24a93e=_0x446535['utcOffset'];_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x1fc65a+'\x22');_0x80b962['push']('\x22'+_0x24a93e+'\x22');}break;default:_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x1fc65a+'\x22');}}else{switch(_0x546c21){case _0xa1ca('0x8c'):case'phone':_0x168b3e[_0xa1ca('0x1c')](_0x546c21+'\x20not\x20specified');break;default:_0x80b962['push']('\x22\x22');}}}}else{var _0x128e0e='';if(!_['isNil'](_0x495b40)){if(!_0x2e7e24[_0xa1ca('0x8d')](_0x495b40['id'])){if(!_['isNil'](_0x523b6c['data'][_0xb41b99][_0x3f2201[_0x546c21]])){var _0x1fc65a=_['trim'](_0x523b6c[_0xa1ca('0x81')][_0xb41b99][_0x3f2201[_0x546c21]][_0xa1ca('0x85')](/"/g,'\x27'));var _0x53e9a3=phoneDescriptions['find'](_0x17c7d2=>_0x17c7d2['itemTypeId']===_0x495b40['id']);if(!_[_0xa1ca('0x20')](_0x53e9a3)){var _0x530fa6=_[_0xa1ca('0x84')](_0x523b6c['data'][_0xb41b99][_0x3f2201[_0x53e9a3[_0xa1ca('0x8e')]]][_0xa1ca('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x530fa6))_0x1fc65a=_0x1fc65a+'§'+_0x530fa6;}if(_0x128e0e=='')_0x128e0e=_0x1fc65a;else _0x128e0e+='|'+_0x1fc65a;}_0x5dc67c['push'](_0x495b40['id']+':'+_0x128e0e);_0x2e7e24[_0x495b40['id']]=0x1;}}}}if(hasAdditionalPhones){_0x80b962[_0xa1ca('0x1c')]('\x22'+_0x5dc67c[_0xa1ca('0x14')](';')+'\x22');}if(_0x168b3e[_0xa1ca('0x1b')]){handleError(_0x523b6c[_0xa1ca('0x81')][_0xb41b99],{'code':'SystemRow','message':_0x168b3e[_0xa1ca('0x14')]()});}else{fs['appendFileSync'](_0x348a89,_0x80b962[_0xa1ca('0x14')]()+'\x0a');}_0x80b962=[];}if(!(stats[_0xa1ca('0x82')]%0xc8)){socket['emit'](_0xa1ca('0x8f')+_0xb4c5bc,stats);stats[_0xa1ca('0x61')]=[];}}if(stopped){logger[_0xa1ca('0x5d')](_0xa1ca('0x90'));_0x2e8b50[_0xa1ca('0x91')]();}}catch(_0x1039ee){handleError(_0x523b6c['data'][_0xb41b99],{'code':'SystemError','message':_0x1039ee[_0xa1ca('0x5f')]});logger[_0xa1ca('0x5e')](_0xa1ca('0x92'),_0x1039ee[_0xa1ca('0x5f')]);}},'complete':function(){try{var _0x56e974=[];var _0x3b89ee=[];var _0x2e1796='cm_contacts';if(_0xea2700[_0xa1ca('0x93')]&&_0xea2700[_0xa1ca('0x93')][_0xa1ca('0x1b')]){_0x2e1796='cm_contacts_'+_0xb4c5bc;_0x56e974[_0xa1ca('0x1c')]('CREATE\x20TABLE\x20'+_0x2e1796+_0xa1ca('0x94'));}tmp_campaigns=_0xa1ca('0x95')+_0xb4c5bc;tmp_voice_queues=_0xa1ca('0x96')+_0xb4c5bc;_0x3b89ee[_0xa1ca('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xa1ca('0x97'));_0x3b89ee[_0xa1ca('0x1c')](_0xa1ca('0x98')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xa1ca('0x99')](_0x3b89ee,handleTZQuery)[_0xa1ca('0x1d')](function(_0x6151ff){updateTzCampaigns(_0xea2700[_0xa1ca('0x41')])[_0xa1ca('0x1d')](function(_0x1c5d31){updateTzVoiceQueues(_0xea2700[_0xa1ca('0x41')])[_0xa1ca('0x1d')](function(_0x5c28d2){if(hasTZ)_0xdf4699=_0xdf4699['replace'](_0xa1ca('0x71'),_0xa1ca('0x9a'));var _0x26e213=util['format'](_0xa1ca('0x9b'),_0x348a89,_0x2e1796,_0xdf4699,_0xea2700[_0xa1ca('0x41')],_0xea2700[_0xa1ca('0x58')]||null,NOW,NOW);if(_[_0xa1ca('0x20')](_0x3f2201[_0xa1ca('0x47')])){_0x26e213+=_0xa1ca('0x9c');}_0x56e974['push'](_0x26e213);if(_0xea2700[_0xa1ca('0x93')]&&_0xea2700['duplicates']['length']){_0x56e974[_0xa1ca('0x1c')](insertCmContact(_0xea2700['ListId'],_0x2e1796,_0xea2700['duplicates'],_0x3f2201));_0x56e974['push'](_0xa1ca('0x9d')+_0x2e1796+';');}BPromise['each'](_0x56e974,handleQuery)[_0xa1ca('0x1d')](function(_0x4e6d57){BPromise['all']([handleAdditionalPhones()])[_0xa1ca('0x1d')](function(){_0x56e974=[];for(var _0x2be48c=0x0;_0x2be48c\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/logger','defaults','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','push','all','catch','error','message','AdditionalPhones','then','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','query','spread','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','priority','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','itemTypeId','trim','description','SystemRow','emit','abort','SystemError','step','CREATE\x20TABLE\x20'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd7ab[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0xbd7a('0x0'));var _=require(_0xbd7a('0x1'));var Papa=require(_0xbd7a('0x2'));var util=require(_0xbd7a('0x3'));var BPromise=require(_0xbd7a('0x4'));var moment=require(_0xbd7a('0x5'));var squel=require(_0xbd7a('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xbd7a('0x7'))('import');config['redis']=_[_0xbd7a('0x8')](config[_0xbd7a('0x9')],{'host':_0xbd7a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd7a('0x9')]));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()[_0xbd7a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xbd7a('0xc')+moment()['format'](_0xbd7a('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4dfbd9){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'](_0x4dfbd9);}function selectNotIn(_0x2b6a14,_0x4a4006,_0x559cde,_0x1ad26f,_0x281a59){return squel[_0xbd7a('0xe')]()[_0xbd7a('0xf')](_0xbd7a('0x10'))['from'](_0x1ad26f)[_0xbd7a('0x11')](_0x4a4006,null,_0x4a4006+'.id\x20=\x20'+_0x1ad26f+'.'+_0x559cde)[_0xbd7a('0x12')](_0x1ad26f+'.'+_0x559cde+_0xbd7a('0x13')+_0x2b6a14+'.'+_0x559cde)[_0xbd7a('0x12')](_0x4a4006+_0xbd7a('0x14')+_0x281a59[_0xbd7a('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x427a93,_0x52ffe0){promisesAdditionalPhones=[];promisesContact=[];return db[_0xbd7a('0x15')]['query'](_0xbd7a('0x16')+tempTableName)['spread'](function(_0x3fb8f4){if(_0x3fb8f4!==null){var _0x70b55b=[];for(var _0x2029c1=0x0;_0x2029c1<_0x3fb8f4[_0xbd7a('0x17')];_0x2029c1++){var _0x238d36=_0x3fb8f4[_0x2029c1];if(!_[_0xbd7a('0x18')](_0x238d36[_0xbd7a('0x10')])){if(!_['isNil'](_0x238d36['AdditionalPhones']))_0x70b55b['push'](insertAdditionalPhones(_0x238d36));promisesContact[_0xbd7a('0x19')]({'contact':_0x238d36});}}}Promise[_0xbd7a('0x1a')](_0x70b55b)['then'](function(){_0x427a93({'val':0x1});});})[_0xbd7a('0x1b')](function(_0x3869d3){logger[_0xbd7a('0x1c')](_0x3869d3[_0xbd7a('0x1d')]);});});}function insertAdditionalPhones(_0x37b210){return new Promise(function(_0x2d6e2f,_0x16bbb5){var _0x3553f0=_0x37b210[_0xbd7a('0x1e')];if(_['isNil'](_0x3553f0))_0x16bbb5({'val':0x0});else{var _0x3d46fb=_0x3553f0['split'](';');var _0x4b2842=[];orderBy=0x0;for(var _0x5d5918=0x0;_0x5d5918<_0x3d46fb['length'];_0x5d5918++){_0x4b2842[_0xbd7a('0x19')](splitAdditionalPhone(_0x37b210['id'],_0x3d46fb[_0x5d5918]));}Promise[_0xbd7a('0x1a')](_0x4b2842)[_0xbd7a('0x1f')](function(){_0x2d6e2f({'val':_0x3d46fb[_0xbd7a('0x17')]});});}});}function splitAdditionalPhone(_0x16a97b,_0x2b7e86){return new Promise(function(_0x5c6ba6,_0x1e5ad6){var _0x54f251=_0x2b7e86[_0xbd7a('0x20')](':');var _0x573913=_0x54f251[0x0];var _0xbd6398=_0x54f251[0x1];if(_0xbd6398!==''){var _0x4bb83f=_0xbd6398[_0xbd7a('0x20')]('|');var _0x4d6123=[];for(var _0x43b306=0x0;_0x43b306<_0x4bb83f[_0xbd7a('0x17')];_0x43b306++){if(_0x4bb83f[_0x43b306]!==''){var _0x5d4558=_[_0xbd7a('0x21')](promisesAdditionalPhones,{'contactId':_0x16a97b,'phone':_0x4bb83f[_0x43b306]});if(_0x5d4558[_0xbd7a('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xbd7a('0x19')]({'contactId':_0x16a97b,'contactTypeId':_0x573913,'phone':_0x4bb83f[_0x43b306],'orderBy':orderBy});}}}_0x5c6ba6({'ok':0x1});}else _0x5c6ba6({'res':0x0});});}function createAdditionalPhone(_0x4e551d,_0x335520,_0x33f0b7,_0x350005){var _0x57f7a9='';var _0x3bfda5='';var _0x457446=_0x33f0b7['split']('§');_0x57f7a9=_0x457446[0x0];if(_0x457446[_0xbd7a('0x17')]==0x2)_0x3bfda5=_0x457446[0x1];return new Promise(function(_0x400b68,_0x269c15){return db[_0xbd7a('0x22')][_0xbd7a('0x23')]({'where':{'CmContactId':_0x4e551d,'item':_0x57f7a9}})[_0xbd7a('0x1f')](function(_0x31ae4e){if(_0x31ae4e){return db[_0xbd7a('0x22')][_0xbd7a('0x24')]({'ItemTypeId':_0x335520,'description':_0x3bfda5,'OrderBy':_0x350005},{'where':{'CmContactId':_0x4e551d,'item':_0x57f7a9}})[_0xbd7a('0x1f')](function(_0x32b095){_0x400b68({'res':_0xbd7a('0x25')});});}else{return db[_0xbd7a('0x22')][_0xbd7a('0x26')]({'CmContactId':_0x4e551d,'item':_0x57f7a9,'ItemTypeId':_0x335520,'description':_0x3bfda5,'OrderBy':_0x350005,'ItemClass':_0xbd7a('0x27')})[_0xbd7a('0x1f')](function(_0x439d26){_0x400b68({'res':'inserted'});});}});});}function updateContact(_0x222025){return new Promise(function(_0x4553b2,_0x365435){var _0x3b6fd6=_0x222025['id'];delete _0x222025['id'];return db[_0xbd7a('0x28')]['update'](_0x222025,{'where':{'id':_0x3b6fd6}})[_0xbd7a('0x1f')](function(_0x41b527){updatedRows+=0x1;return db[_0xbd7a('0x29')]['update']({'phone':_0x222025[_0xbd7a('0x10')]},{'where':{'ContactId':_0x3b6fd6}})['then'](function(_0x3daef1){_0x4553b2({'ret':'OK'});});});});}function insertCmHopper(_0xd23175,_0x1da085,_0x4bf7f1,_0x4dbc18,_0x2c1638){var _0x154833=[_0xbd7a('0x2a'),_0xbd7a('0x2b'),_0xbd7a('0x2c'),_0xbd7a('0x2d'),_0x1da085+'.'+_0x4dbc18,_0xbd7a('0x2e'),_0xbd7a('0x2f'),_0xbd7a('0x30'),_0xbd7a('0x31'),'\x22'+_0x2c1638+'\x22'];return squel[_0xbd7a('0x32')]()[_0xbd7a('0x33')](_0xbd7a('0x34'))[_0xbd7a('0x35')]([_0xbd7a('0x10'),_0xbd7a('0x36'),'ContactId',_0xbd7a('0x37'),_0x4dbc18,_0xbd7a('0x38'),_0xbd7a('0x39'),'priority',_0xbd7a('0x3a'),_0xbd7a('0x3b')],squel['select']()[_0xbd7a('0x3c')](_0x154833)[_0xbd7a('0x3d')](_0x1da085)[_0xbd7a('0x11')]('cm_contacts',null,_0xbd7a('0x3e')+_0x1da085+'.CmListId')[_0xbd7a('0x11')](_0x4bf7f1,null,_0x4bf7f1+_0xbd7a('0x3f')+_0x1da085+'.'+_0x4dbc18)[_0xbd7a('0x12')](_0x1da085+_0xbd7a('0x40'),_0xd23175)[_0xbd7a('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbd7a('0x12')](_0xbd7a('0x41'),selectNotIn(_0x1da085,_0x4bf7f1,_0x4dbc18,_0xbd7a('0x34'),['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0xbd7a('0x41'),selectNotIn(_0x1da085,_0x4bf7f1,_0x4dbc18,_0xbd7a('0x34'),['\x22always\x22'])))[_0xbd7a('0x42')]();}function insertCmHopperBlack(_0xb248f2,_0x223e48,_0xe048e3,_0x4748d1){var _0x4df0a7=[_0xbd7a('0x2a'),_0xbd7a('0x2c'),'cm_contacts.ListId',_0x223e48+'.'+_0x4748d1,_0xbd7a('0x2e'),_0xbd7a('0x2f')];return squel[_0xbd7a('0x32')]()[_0xbd7a('0x33')]('cm_hopper_black')[_0xbd7a('0x35')](['phone','ContactId','ListId',_0x4748d1,_0xbd7a('0x38'),_0xbd7a('0x39')],squel['select']()[_0xbd7a('0x3c')](_0x4df0a7)['from'](_0x223e48)[_0xbd7a('0x11')](_0xbd7a('0x43'),null,_0xbd7a('0x3e')+_0x223e48+_0xbd7a('0x44'))[_0xbd7a('0x11')](_0xe048e3,null,_0xe048e3+_0xbd7a('0x3f')+_0x223e48+'.'+_0x4748d1)[_0xbd7a('0x12')](_0x223e48+_0xbd7a('0x40'),_0xb248f2)[_0xbd7a('0x12')](_0xbd7a('0x45'),NOW)['where'](_0xbd7a('0x41'),squel[_0xbd7a('0xe')]()['field']('phone')[_0xbd7a('0x3d')](_0xbd7a('0x46'))[_0xbd7a('0x12')](_0xbd7a('0x47'),_0xb248f2)[_0xbd7a('0x12')](_0x4748d1+_0xbd7a('0x48'),_0x223e48+'.'+_0x4748d1)))[_0xbd7a('0x42')]();}function insertCmHopperAdditionalPhones(_0x2e3672){var _0x2ba9e7=[_0xbd7a('0x49'),_0xbd7a('0x4a'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xbd7a('0x32')]()['into'](_0xbd7a('0x4b'))[_0xbd7a('0x35')](['CmHopperId',_0xbd7a('0x10'),_0xbd7a('0x4c'),'createdAt',_0xbd7a('0x39')],squel[_0xbd7a('0xe')]()['fields'](_0x2ba9e7)['from'](_0xbd7a('0x34'))['join']('cm_contacts',null,_0xbd7a('0x4d'))[_0xbd7a('0x11')](_0xbd7a('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x2e3672)[_0xbd7a('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xbd7a('0x42')]();}function insertCmContact(_0x2af4cd,_0x2818ae,_0x17431f,_0x3e617e){var _0x30afbf=_[_0xbd7a('0x4f')](_['keys'](_0x3e617e),['ListId','CompanyId',_0xbd7a('0x38'),_0xbd7a('0x39')]);return squel['insert']()[_0xbd7a('0x33')]('cm_contacts')['fromQuery'](_0x30afbf,squel['select']()['fields'](_0x30afbf)[_0xbd7a('0x3d')](_0x2818ae)[_0xbd7a('0x12')]('('+_0x17431f[_0xbd7a('0x11')](',')+_0xbd7a('0x50'),squel[_0xbd7a('0xe')]()['fields'](_0x17431f)[_0xbd7a('0x3d')]('cm_contacts')[_0xbd7a('0x12')](_0xbd7a('0x47'),_0x2af4cd))[_0xbd7a('0x12')](_0xbd7a('0x51'),squel[_0xbd7a('0xe')]()[_0xbd7a('0xf')]('MIN(id)',_0xbd7a('0x52'))[_0xbd7a('0x3d')](_0x2818ae)[_0xbd7a('0x53')](_0x17431f['join'](','))))[_0xbd7a('0x42')]();}function handleStop(){logger[_0xbd7a('0x54')](_0xbd7a('0x55'));stopped=!![];}function handleUncaughtException(_0x5f4b5d){logger[_0xbd7a('0x1c')](_0x5f4b5d['message']);process[_0xbd7a('0x56')](0x1);}function handleError(_0x3435d7,_0x12efc5){stats[_0xbd7a('0x57')]['push']({'name':_0x12efc5[_0xbd7a('0x58')],'message':_0x12efc5['message'],'row':_0x3435d7});}function handleQuery(_0x1354c5){logger['info'](_0x1354c5);return db[_0xbd7a('0x15')][_0xbd7a('0x59')](_0x1354c5)[_0xbd7a('0x5a')](function(_0x416bb0){results[_0xbd7a('0x19')](_0x416bb0);})[_0xbd7a('0x1b')](function(_0x39e5d7){logger['error'](_0x39e5d7[_0xbd7a('0x1d')]);});}function main(_0x9d764e,_0xaaa789,_0x24d507,_0x4e12b2){logger['info'](_0xbd7a('0x5b'),_0x9d764e,JSON[_0xbd7a('0x5c')](_0xaaa789));process[_0xbd7a('0x5d')](_0xbd7a('0x5e'));var _0x1847b4=_0xaaa789[_0xbd7a('0x5f')];var _0x2ddd5f=_['clone'](_0x1847b4);var _0x4fc0fb=_0xaaa789[_0xbd7a('0x60')];var _0x3e6d58=path['join'](config[_0xbd7a('0x61')],_0xbd7a('0x62'),_0x4fc0fb+_0xbd7a('0x63'));logger['info'](_0xbd7a('0x64'),_0xaaa789);db[_0xbd7a('0x65')][_0xbd7a('0x66')]({'raw':!![],'attributes':['id',_0xbd7a('0x67')]})[_0xbd7a('0x1f')](function(_0x5dbe84){for(var _0x58707=0x0;_0x58707<_0x5dbe84[_0xbd7a('0x17')];_0x58707++){if(_0x5dbe84[_0x58707][_0xbd7a('0x67')]in _0x1847b4){contactItemTypes['push'](_0x5dbe84[_0x58707]);delete _0x2ddd5f[_0x5dbe84[_0x58707]['name']];hasAdditionalPhones=!![];}for(var _0x4e9faf in _0x1847b4){if(_0x5dbe84[_0x58707][_0xbd7a('0x67')]+_0xbd7a('0x68')===_0x4e9faf){phoneDescriptions[_0xbd7a('0x19')]({'itemTypeId':_0x5dbe84[_0x58707]['id'],'description':_0x4e9faf});delete _0x2ddd5f[_0x4e9faf];}}}if(hasAdditionalPhones)_0x2ddd5f[_0xbd7a('0x1e')]='';var _0x5cd66a=_['keys'](_0x2ddd5f)[_0xbd7a('0x11')]();logger[_0xbd7a('0x54')]('header',_0x5cd66a);fs[_0xbd7a('0x69')](_0x3e6d58,_0x5cd66a+'\x0a');Papa[_0xbd7a('0x6a')](fs[_0xbd7a('0x6b')](_0x9d764e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x296984,_0x38621a){try{for(var _0x448505=0x0,_0x39c2d1=[];_0x448505<_0x296984[_0xbd7a('0x6c')]['length'];_0x448505++){stats[_0xbd7a('0x6d')]+=0x1;if(_0x296984[_0xbd7a('0x57')][_0x448505]){handleError(_0x296984[_0xbd7a('0x6c')][_0x448505],_0x296984[_0xbd7a('0x57')][_0x448505]);}else{var _0x21c38b=[];var _0xae2cd0=[];var _0x7a7cf1={};for(var _0x3f6c74 in _0x1847b4){let _0x4bb522=contactItemTypes['find'](_0x4f944b=>_0x4f944b[_0xbd7a('0x67')]===_0x3f6c74);let _0x567378=contactItemTypes[_0xbd7a('0x6e')](_0x43393b=>_0x43393b[_0xbd7a('0x67')]+'_description'===_0x3f6c74);if(_[_0xbd7a('0x18')](_0x4bb522)&&_[_0xbd7a('0x18')](_0x567378)){if(_0x1847b4[_0xbd7a('0x6f')](_0x3f6c74)){if(_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74]]){var _0xa60272=_['trim'](_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74]][_0xbd7a('0x70')](/"/g,'\x27'));switch(_0x3f6c74){case _0xbd7a('0x36'):var _0x4cc5dd=moment(_0xa60272,_0xbd7a('0x71'),!![]);if(_0x4cc5dd[_0xbd7a('0x72')]()){_0x39c2d1['push']('\x22'+_0xa60272+'\x22');}else{_0x21c38b[_0xbd7a('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbd7a('0x73'):var _0x47e3f6=parseInt(_0xa60272);_0xa60272=_[_0xbd7a('0x74')](_0x47e3f6)||_0x47e3f6<0x0||_0x47e3f6>0x4?_0x4e12b2?0x3:0x2:_0x47e3f6;_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');break;case _0xbd7a('0x3a'):var _0x441475=parseInt(_0xa60272);if(_['isNumber'](_0x441475)&&_[_0xbd7a('0x75')](_0x24d507,_0x441475)){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0x441475+'\x22');}else{_0x21c38b[_0xbd7a('0x19')](_0xbd7a('0x76'));}break;case _0xbd7a('0x77'):if(isEmail(_0xa60272)){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}else{_0x21c38b['push'](_0xbd7a('0x78'));}break;case _0xbd7a('0x79'):var _0x576324=moment(_0xa60272,_0xbd7a('0x7a'),!![]);if(_0x576324[_0xbd7a('0x72')]()){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}else{_0x21c38b[_0xbd7a('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xa60272+'\x22');}}else{switch(_0x3f6c74){case _0xbd7a('0x7b'):case _0xbd7a('0x10'):_0x21c38b['push'](_0x3f6c74+_0xbd7a('0x7c'));break;default:_0x39c2d1[_0xbd7a('0x19')]('\x22\x22');}}}}else{var _0x3e73e3='';if(!_[_0xbd7a('0x18')](_0x4bb522)){if(!_0x7a7cf1[_0xbd7a('0x6f')](_0x4bb522['id'])){for(var _0x5ad8c1=0x0;_0x5ad8c1<_0x1847b4[_0x3f6c74][_0xbd7a('0x17')];_0x5ad8c1++){var _0xa60272=_['trim'](_0x296984[_0xbd7a('0x6c')][_0x448505][_0x1847b4[_0x3f6c74][_0x5ad8c1]][_0xbd7a('0x70')](/"/g,'\x27'));var _0x33bd90=phoneDescriptions[_0xbd7a('0x6e')](_0x320e14=>_0x320e14[_0xbd7a('0x7d')]===_0x4bb522['id']);if(!_[_0xbd7a('0x18')](_0x33bd90)){var _0xecba26=_[_0xbd7a('0x7e')](_0x296984['data'][_0x448505][_0x1847b4[_0x33bd90[_0xbd7a('0x7f')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0xecba26))_0xa60272=_0xa60272+'§'+_0xecba26;}if(_0x3e73e3=='')_0x3e73e3=_0xa60272;else _0x3e73e3+='|'+_0xa60272;}_0xae2cd0[_0xbd7a('0x19')](_0x4bb522['id']+':'+_0x3e73e3);_0x7a7cf1[_0x4bb522['id']]=0x1;}}}}if(hasAdditionalPhones){_0x39c2d1[_0xbd7a('0x19')]('\x22'+_0xae2cd0[_0xbd7a('0x11')](';')+'\x22');}if(_0x21c38b[_0xbd7a('0x17')]){handleError(_0x296984[_0xbd7a('0x6c')][_0x448505],{'code':_0xbd7a('0x80'),'message':_0x21c38b[_0xbd7a('0x11')]()});}else{fs['appendFileSync'](_0x3e6d58,_0x39c2d1[_0xbd7a('0x11')]()+'\x0a');}_0x39c2d1=[];}if(!(stats[_0xbd7a('0x6d')]%0xc8)){socket[_0xbd7a('0x81')]('contact:import:'+_0x4fc0fb,stats);stats['errors']=[];}}if(stopped){logger[_0xbd7a('0x54')]('Abort\x20parser');_0x38621a[_0xbd7a('0x82')]();}}catch(_0x5bb3ed){handleError(_0x296984['data'][_0x448505],{'code':_0xbd7a('0x83'),'message':_0x5bb3ed[_0xbd7a('0x1d')]});logger[_0xbd7a('0x1c')](_0xbd7a('0x84'),_0x5bb3ed[_0xbd7a('0x1d')]);}},'complete':function(){try{var _0x238267=[];var _0x20cf3d=tempTableName;_0x238267[_0xbd7a('0x19')](_0xbd7a('0x85')+_0x20cf3d+_0xbd7a('0x86'));logger[_0xbd7a('0x54')](_0xbd7a('0x87'),contactItemTypes['length']);var _0x106aa4=util[_0xbd7a('0xb')]('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',_0x3e6d58,_0x20cf3d,_0x5cd66a,_0xaaa789[_0xbd7a('0x37')],_0xaaa789[_0xbd7a('0x88')]||null,NOW,NOW);if(_[_0xbd7a('0x18')](_0x1847b4[_0xbd7a('0x36')])){_0x106aa4+=_0xbd7a('0x89');}_0x238267[_0xbd7a('0x19')](_0x106aa4);BPromise[_0xbd7a('0x8a')](_0x238267,handleQuery)[_0xbd7a('0x1f')](function(_0x575fd9){BPromise[_0xbd7a('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x238267=[];for(var _0x1b2892=0x0;_0x1b2892\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','then','catch','message','all','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones'];(function(_0x21b0ac,_0x5dc1bd){var _0x5e1206=function(_0x420962){while(--_0x420962){_0x21b0ac['push'](_0x21b0ac['shift']());}};_0x5e1206(++_0x5dc1bd);}(_0xa486,0x17d));var _0x6a48=function(_0x50f6ce,_0x2a0116){_0x50f6ce=_0x50f6ce-0x0;var _0x4afb5e=_0xa486[_0x50f6ce];return _0x4afb5e;};'use strict';var fs=require('fs');var path=require(_0x6a48('0x0'));var _=require('lodash');var Papa=require(_0x6a48('0x1'));var util=require('util');var BPromise=require(_0x6a48('0x2'));var moment=require('moment');var squel=require(_0x6a48('0x3'));var Redis=require(_0x6a48('0x4'));var db=require(_0x6a48('0x5'))['db'];var config=require(_0x6a48('0x6'));var logger=require(_0x6a48('0x7'))(_0x6a48('0x8'));config[_0x6a48('0x9')]=_[_0x6a48('0xa')](config[_0x6a48('0x9')],{'host':_0x6a48('0xb'),'port':0x18eb});var socket=require(_0x6a48('0xc'))(new Redis(config[_0x6a48('0x9')]));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()[_0x6a48('0xd')](_0x6a48('0xe'));var tempTableName=_0x6a48('0xf')+moment()[_0x6a48('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3960b0){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'](_0x3960b0);}function selectNotIn(_0x17bc14,_0x454dbd,_0x158714,_0x290bd2,_0x12b760){return squel[_0x6a48('0x10')]()[_0x6a48('0x11')](_0x6a48('0x12'))[_0x6a48('0x13')](_0x290bd2)[_0x6a48('0x14')](_0x454dbd,null,_0x454dbd+_0x6a48('0x15')+_0x290bd2+'.'+_0x158714)[_0x6a48('0x16')](_0x290bd2+'.'+_0x158714+_0x6a48('0x17')+_0x17bc14+'.'+_0x158714)[_0x6a48('0x16')](_0x454dbd+_0x6a48('0x18')+_0x12b760[_0x6a48('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xcbcb4b,_0x4ab8c6){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6a48('0x19')][_0x6a48('0x1a')](_0x6a48('0x1b')+tempTableName)[_0x6a48('0x1c')](function(_0x231930){if(_0x231930!==null){var _0xaf303c=[];for(var _0xad96d0=0x0;_0xad96d0<_0x231930[_0x6a48('0x1d')];_0xad96d0++){var _0x41218a=_0x231930[_0xad96d0];if(!_[_0x6a48('0x1e')](_0x41218a['phone'])){if(!_[_0x6a48('0x1e')](_0x41218a[_0x6a48('0x1f')]))_0xaf303c[_0x6a48('0x20')](insertAdditionalPhones(_0x41218a));promisesContact[_0x6a48('0x20')]({'contact':_0x41218a});}}}Promise['all'](_0xaf303c)[_0x6a48('0x21')](function(){_0xcbcb4b({'val':0x1});});})[_0x6a48('0x22')](function(_0x3f583c){logger['error'](_0x3f583c[_0x6a48('0x23')]);});});}function insertAdditionalPhones(_0x6a0206){return new Promise(function(_0x426272,_0x56fc96){var _0xd0230=_0x6a0206[_0x6a48('0x1f')];if(_[_0x6a48('0x1e')](_0xd0230))_0x56fc96({'val':0x0});else{var _0x22642a=_0xd0230['split'](';');var _0x1afaf3=[];orderBy=0x0;for(var _0x230220=0x0;_0x230220<_0x22642a['length'];_0x230220++){_0x1afaf3['push'](splitAdditionalPhone(_0x6a0206['id'],_0x22642a[_0x230220]));}Promise[_0x6a48('0x24')](_0x1afaf3)[_0x6a48('0x21')](function(){_0x426272({'val':_0x22642a['length']});});}});}function splitAdditionalPhone(_0x2eae9f,_0x4846bf){return new Promise(function(_0x508432,_0x4f38a2){var _0x4fe71c=_0x4846bf[_0x6a48('0x25')](':');var _0x5eeef8=_0x4fe71c[0x0];var _0x19594c=_0x4fe71c[0x1];if(_0x19594c!==''){var _0x52de7c=_0x19594c['split']('|');var _0x483278=[];for(var _0x5d62a6=0x0;_0x5d62a6<_0x52de7c[_0x6a48('0x1d')];_0x5d62a6++){if(_0x52de7c[_0x5d62a6]!==''){var _0x29cfd2=_[_0x6a48('0x26')](promisesAdditionalPhones,{'contactId':_0x2eae9f,'phone':_0x52de7c[_0x5d62a6]});if(_0x29cfd2[_0x6a48('0x1d')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2eae9f,'contactTypeId':_0x5eeef8,'phone':_0x52de7c[_0x5d62a6],'orderBy':orderBy});}}}_0x508432({'ok':0x1});}else _0x508432({'res':0x0});});}function createAdditionalPhone(_0x370bfe,_0x23cbf5,_0xf450b,_0x13fe57){var _0x5188e8='';var _0x57522a='';var _0x39f2ee=_0xf450b[_0x6a48('0x25')]('§');_0x5188e8=_0x39f2ee[0x0];if(_0x39f2ee[_0x6a48('0x1d')]==0x2)_0x57522a=_0x39f2ee[0x1];return new Promise(function(_0x38e417,_0x437622){return db['CmContactHasItem'][_0x6a48('0x27')]({'where':{'CmContactId':_0x370bfe,'item':_0x5188e8}})['then'](function(_0x50e0e8){if(_0x50e0e8){return db[_0x6a48('0x28')][_0x6a48('0x29')]({'ItemTypeId':_0x23cbf5,'description':_0x57522a,'OrderBy':_0x13fe57},{'where':{'CmContactId':_0x370bfe,'item':_0x5188e8}})[_0x6a48('0x21')](function(_0xd53693){_0x38e417({'res':_0x6a48('0x2a')});});}else{return db[_0x6a48('0x28')][_0x6a48('0x2b')]({'CmContactId':_0x370bfe,'item':_0x5188e8,'ItemTypeId':_0x23cbf5,'description':_0x57522a,'OrderBy':_0x13fe57,'ItemClass':_0x6a48('0x2c')})[_0x6a48('0x21')](function(_0x27504a){_0x38e417({'res':_0x6a48('0x2d')});});}});});}function updateContact(_0x28ebfc){return new Promise(function(_0x5aa79c,_0x3e0bc6){var _0x32a90b=_0x28ebfc['id'];delete _0x28ebfc['id'];return db[_0x6a48('0x2e')]['update'](_0x28ebfc,{'where':{'id':_0x32a90b}})[_0x6a48('0x21')](function(_0x4a52a3){updatedRows+=0x1;return db[_0x6a48('0x2f')]['update']({'phone':_0x28ebfc[_0x6a48('0x12')]},{'where':{'ContactId':_0x32a90b}})[_0x6a48('0x21')](function(_0xda28dc){_0x5aa79c({'ret':'OK'});});});});}function insertCmHopper(_0x483428,_0x28e538,_0x258c55,_0x51703a,_0x53004c){var _0x2e6472=[_0x6a48('0x30'),_0x6a48('0x31'),_0x6a48('0x32'),_0x6a48('0x33'),_0x28e538+'.'+_0x51703a,_0x6a48('0x34'),_0x6a48('0x35'),_0x6a48('0x36'),'cm_contacts.UserId','\x22'+_0x53004c+'\x22'];return squel[_0x6a48('0x37')]()[_0x6a48('0x38')](_0x6a48('0x39'))[_0x6a48('0x3a')]([_0x6a48('0x12'),_0x6a48('0x3b'),_0x6a48('0x3c'),_0x6a48('0x3d'),_0x51703a,_0x6a48('0x3e'),_0x6a48('0x3f'),_0x6a48('0x40'),_0x6a48('0x41'),_0x6a48('0x42')],squel[_0x6a48('0x10')]()['fields'](_0x2e6472)[_0x6a48('0x13')](_0x28e538)[_0x6a48('0x14')]('cm_contacts',null,_0x6a48('0x43')+_0x28e538+_0x6a48('0x44'))[_0x6a48('0x14')](_0x258c55,null,_0x258c55+_0x6a48('0x15')+_0x28e538+'.'+_0x51703a)['where'](_0x28e538+_0x6a48('0x45'),_0x483428)[_0x6a48('0x16')](_0x6a48('0x46'),NOW)[_0x6a48('0x16')](_0x6a48('0x47'),selectNotIn(_0x28e538,_0x258c55,_0x51703a,_0x6a48('0x39'),[_0x6a48('0x48'),'\x22onlyIfOpen\x22']))['where'](_0x6a48('0x47'),selectNotIn(_0x28e538,_0x258c55,_0x51703a,_0x6a48('0x39'),['\x22always\x22'])))[_0x6a48('0x49')]();}function insertCmHopperBlack(_0x4399c0,_0x48d8ee,_0x305878,_0x2abea4){var _0x37a17b=[_0x6a48('0x30'),_0x6a48('0x32'),'cm_contacts.ListId',_0x48d8ee+'.'+_0x2abea4,_0x6a48('0x34'),'cm_contacts.updatedAt'];return squel['insert']()[_0x6a48('0x38')]('cm_hopper_black')[_0x6a48('0x3a')](['phone',_0x6a48('0x3c'),_0x6a48('0x3d'),_0x2abea4,_0x6a48('0x3e'),'updatedAt'],squel[_0x6a48('0x10')]()['fields'](_0x37a17b)['from'](_0x48d8ee)['join'](_0x6a48('0x4a'),null,'cm_contacts.ListId\x20=\x20'+_0x48d8ee+_0x6a48('0x44'))[_0x6a48('0x14')](_0x305878,null,_0x305878+_0x6a48('0x15')+_0x48d8ee+'.'+_0x2abea4)[_0x6a48('0x16')](_0x48d8ee+'.CmListId\x20=\x20?',_0x4399c0)[_0x6a48('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6a48('0x16')](_0x6a48('0x47'),squel['select']()['field'](_0x6a48('0x12'))[_0x6a48('0x13')]('cm_hopper_black')[_0x6a48('0x16')](_0x6a48('0x4b'),_0x4399c0)[_0x6a48('0x16')](_0x2abea4+_0x6a48('0x4c'),_0x48d8ee+'.'+_0x2abea4)))[_0x6a48('0x49')]();}function insertCmHopperAdditionalPhones(_0x350a82){var _0x1b00fa=['cm_hopper.id',_0x6a48('0x4d'),_0x6a48('0x4e'),'cm_contact_has_items.createdAt',_0x6a48('0x4f')];return squel[_0x6a48('0x37')]()[_0x6a48('0x38')](_0x6a48('0x50'))[_0x6a48('0x3a')](['CmHopperId',_0x6a48('0x12'),_0x6a48('0x51'),_0x6a48('0x3e'),_0x6a48('0x3f')],squel[_0x6a48('0x10')]()['fields'](_0x1b00fa)['from'](_0x6a48('0x39'))[_0x6a48('0x14')](_0x6a48('0x4a'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6a48('0x14')]('cm_contact_has_items',null,_0x6a48('0x52'))[_0x6a48('0x16')]('cm_hopper.ListId\x20=\x20?',_0x350a82)[_0x6a48('0x16')](_0x6a48('0x46'),NOW))[_0x6a48('0x49')]();}function insertCmContact(_0x2cfd79,_0x1fa7bf,_0x39b7b6,_0x3f336f){var _0x5afd02=_[_0x6a48('0x53')](_[_0x6a48('0x54')](_0x3f336f),['ListId','CompanyId',_0x6a48('0x3e'),'updatedAt']);return squel['insert']()[_0x6a48('0x38')]('cm_contacts')[_0x6a48('0x3a')](_0x5afd02,squel[_0x6a48('0x10')]()[_0x6a48('0x55')](_0x5afd02)['from'](_0x1fa7bf)[_0x6a48('0x16')]('('+_0x39b7b6[_0x6a48('0x14')](',')+_0x6a48('0x56'),squel[_0x6a48('0x10')]()[_0x6a48('0x55')](_0x39b7b6)[_0x6a48('0x13')]('cm_contacts')[_0x6a48('0x16')](_0x6a48('0x4b'),_0x2cfd79))[_0x6a48('0x16')]('id\x20IN\x20?',squel[_0x6a48('0x10')]()['field']('MIN(id)',_0x6a48('0x57'))[_0x6a48('0x13')](_0x1fa7bf)[_0x6a48('0x58')](_0x39b7b6['join'](','))))['toString']();}function handleStop(){logger[_0x6a48('0x59')](_0x6a48('0x5a'));stopped=!![];}function handleUncaughtException(_0x133494){logger['error'](_0x133494[_0x6a48('0x23')]);process[_0x6a48('0x5b')](0x1);}function handleError(_0x47cb9a,_0x476ef6){stats['errors'][_0x6a48('0x20')]({'name':_0x476ef6[_0x6a48('0x5c')],'message':_0x476ef6[_0x6a48('0x23')],'row':_0x47cb9a});}function handleQuery(_0xe3315d){logger[_0x6a48('0x59')](_0xe3315d);return db[_0x6a48('0x19')][_0x6a48('0x1a')](_0xe3315d)['spread'](function(_0xcede73){results[_0x6a48('0x20')](_0xcede73);})[_0x6a48('0x22')](function(_0x238590){logger[_0x6a48('0x5d')](_0x238590[_0x6a48('0x23')]);});}function main(_0x37a6d3,_0x1da744,_0x232456,_0x40b2e1){logger[_0x6a48('0x59')]('main',_0x37a6d3,JSON[_0x6a48('0x5e')](_0x1da744));process[_0x6a48('0x5f')](_0x6a48('0x60'));var _0x1f6e89=_0x1da744[_0x6a48('0x61')];var _0x194ea4=_['clone'](_0x1f6e89);var _0x4b75d3=_0x1da744['socket_timestamp'];var _0x32c497=path[_0x6a48('0x14')](config[_0x6a48('0x62')],_0x6a48('0x63'),_0x4b75d3+'.csv');logger[_0x6a48('0x59')]('body',_0x1da744);db[_0x6a48('0x64')][_0x6a48('0x65')]({'raw':!![],'attributes':['id',_0x6a48('0x66')]})[_0x6a48('0x21')](function(_0x4f8e5f){for(var _0x42481c=0x0;_0x42481c<_0x4f8e5f[_0x6a48('0x1d')];_0x42481c++){if(_0x4f8e5f[_0x42481c][_0x6a48('0x66')]in _0x1f6e89){contactItemTypes[_0x6a48('0x20')](_0x4f8e5f[_0x42481c]);delete _0x194ea4[_0x4f8e5f[_0x42481c][_0x6a48('0x66')]];hasAdditionalPhones=!![];}for(var _0x1635fa in _0x1f6e89){if(_0x4f8e5f[_0x42481c][_0x6a48('0x66')]+_0x6a48('0x67')===_0x1635fa){phoneDescriptions[_0x6a48('0x20')]({'itemTypeId':_0x4f8e5f[_0x42481c]['id'],'description':_0x1635fa});delete _0x194ea4[_0x1635fa];}}}if(hasAdditionalPhones)_0x194ea4[_0x6a48('0x1f')]='';var _0x83d1b9=_[_0x6a48('0x54')](_0x194ea4)[_0x6a48('0x14')]();logger[_0x6a48('0x59')](_0x6a48('0x68'),_0x83d1b9);fs[_0x6a48('0x69')](_0x32c497,_0x83d1b9+'\x0a');Papa[_0x6a48('0x6a')](fs[_0x6a48('0x6b')](_0x37a6d3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14077a,_0x12a200){try{for(var _0x36b8ad=0x0,_0x1c5cdb=[];_0x36b8ad<_0x14077a[_0x6a48('0x6c')][_0x6a48('0x1d')];_0x36b8ad++){stats['rows']+=0x1;if(_0x14077a[_0x6a48('0x6d')][_0x36b8ad]){handleError(_0x14077a['data'][_0x36b8ad],_0x14077a[_0x6a48('0x6d')][_0x36b8ad]);}else{var _0x14b281=[];var _0x5c1d99=[];var _0x1ca7d9={};for(var _0x42ef67 in _0x1f6e89){let _0x5acda6=contactItemTypes[_0x6a48('0x6e')](_0x4f2595=>_0x4f2595[_0x6a48('0x66')]===_0x42ef67);let _0x488a27=contactItemTypes[_0x6a48('0x6e')](_0x1d147d=>_0x1d147d[_0x6a48('0x66')]+'_description'===_0x42ef67);if(_[_0x6a48('0x1e')](_0x5acda6)&&_[_0x6a48('0x1e')](_0x488a27)){if(_0x1f6e89['hasOwnProperty'](_0x42ef67)){if(_0x14077a['data'][_0x36b8ad][_0x1f6e89[_0x42ef67]]){var _0x5e1da7=_['trim'](_0x14077a['data'][_0x36b8ad][_0x1f6e89[_0x42ef67]]['replace'](/"/g,'\x27'));switch(_0x42ef67){case _0x6a48('0x3b'):var _0x29458c=moment(_0x5e1da7,_0x6a48('0xe'),!![]);if(_0x29458c[_0x6a48('0x6f')]()){_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5e1da7+'\x22');}else{_0x14b281['push'](_0x6a48('0x70'));}break;case _0x6a48('0x40'):var _0x81ab7a=parseInt(_0x5e1da7);_0x5e1da7=_[_0x6a48('0x71')](_0x81ab7a)||_0x81ab7a<0x0||_0x81ab7a>0x4?_0x40b2e1?0x3:0x2:_0x81ab7a;_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5e1da7+'\x22');break;case _0x6a48('0x41'):var _0x42b2ac=parseInt(_0x5e1da7);if(_[_0x6a48('0x72')](_0x42b2ac)&&_[_0x6a48('0x73')](_0x232456,_0x42b2ac)){_0x1c5cdb['push']('\x22'+_0x42b2ac+'\x22');}else{_0x14b281[_0x6a48('0x20')](_0x6a48('0x74'));}break;case _0x6a48('0x75'):if(isEmail(_0x5e1da7)){_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5e1da7+'\x22');}else{_0x14b281['push'](_0x6a48('0x76'));}break;case _0x6a48('0x77'):var _0x34a950=moment(_0x5e1da7,_0x6a48('0x78'),!![]);if(_0x34a950['isValid']()){_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5e1da7+'\x22');}else{_0x14b281['push'](_0x6a48('0x79'));}break;default:_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5e1da7+'\x22');}}else{switch(_0x42ef67){case'firstName':case _0x6a48('0x12'):_0x14b281[_0x6a48('0x20')](_0x42ef67+_0x6a48('0x7a'));break;default:_0x1c5cdb['push']('\x22\x22');}}}}else{var _0x10ead7='';if(!_[_0x6a48('0x1e')](_0x5acda6)){if(!_0x1ca7d9[_0x6a48('0x7b')](_0x5acda6['id'])){for(var _0x180389=0x0;_0x180389<_0x1f6e89[_0x42ef67][_0x6a48('0x1d')];_0x180389++){var _0x5e1da7=_[_0x6a48('0x7c')](_0x14077a[_0x6a48('0x6c')][_0x36b8ad][_0x1f6e89[_0x42ef67][_0x180389]][_0x6a48('0x7d')](/"/g,'\x27'));var _0x4fd0e5=phoneDescriptions[_0x6a48('0x6e')](_0x25ba98=>_0x25ba98['itemTypeId']===_0x5acda6['id']);if(!_[_0x6a48('0x1e')](_0x4fd0e5)){var _0x4d7969=_[_0x6a48('0x7c')](_0x14077a[_0x6a48('0x6c')][_0x36b8ad][_0x1f6e89[_0x4fd0e5[_0x6a48('0x7e')]][0x0]][_0x6a48('0x7d')](/"/g,'\x27'));if(!_[_0x6a48('0x1e')](_0x4d7969))_0x5e1da7=_0x5e1da7+'§'+_0x4d7969;}if(_0x10ead7=='')_0x10ead7=_0x5e1da7;else _0x10ead7+='|'+_0x5e1da7;}_0x5c1d99[_0x6a48('0x20')](_0x5acda6['id']+':'+_0x10ead7);_0x1ca7d9[_0x5acda6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1c5cdb[_0x6a48('0x20')]('\x22'+_0x5c1d99[_0x6a48('0x14')](';')+'\x22');}if(_0x14b281[_0x6a48('0x1d')]){handleError(_0x14077a[_0x6a48('0x6c')][_0x36b8ad],{'code':'SystemRow','message':_0x14b281[_0x6a48('0x14')]()});}else{fs[_0x6a48('0x7f')](_0x32c497,_0x1c5cdb[_0x6a48('0x14')]()+'\x0a');}_0x1c5cdb=[];}if(!(stats[_0x6a48('0x80')]%0xc8)){socket[_0x6a48('0x81')](_0x6a48('0x82')+_0x4b75d3,stats);stats[_0x6a48('0x6d')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x12a200[_0x6a48('0x83')]();}}catch(_0x2695d1){handleError(_0x14077a['data'][_0x36b8ad],{'code':'SystemError','message':_0x2695d1[_0x6a48('0x23')]});logger[_0x6a48('0x5d')](_0x6a48('0x84'),_0x2695d1[_0x6a48('0x23')]);}},'complete':function(){try{var _0x2fcaa5=[];var _0x5a0f44=tempTableName;_0x2fcaa5[_0x6a48('0x20')]('CREATE\x20TABLE\x20'+_0x5a0f44+_0x6a48('0x85'));logger[_0x6a48('0x59')](_0x6a48('0x86'),contactItemTypes[_0x6a48('0x1d')]);var _0x16f273=util[_0x6a48('0xd')](_0x6a48('0x87'),_0x32c497,_0x5a0f44,_0x83d1b9,_0x1da744[_0x6a48('0x3d')],_0x1da744[_0x6a48('0x88')]||null,NOW,NOW);if(_[_0x6a48('0x1e')](_0x1f6e89[_0x6a48('0x3b')])){_0x16f273+=',\x20scheduledAt\x20=\x20NOW()';}_0x2fcaa5[_0x6a48('0x20')](_0x16f273);BPromise[_0x6a48('0x89')](_0x2fcaa5,handleQuery)[_0x6a48('0x21')](function(_0x1b048f){BPromise[_0x6a48('0x24')]([handleAdditionalPhones()])['then'](function(){_0x2fcaa5=[];for(var _0x5555d5=0x0;_0x5555d5\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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','squel','../parsers/advancedSearch','./update-interaction','getAccountFK','role','agent','field','name','color','from','getInteractionFK','user_has_','_interactions','select','u.fullname','ui.','left_join','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','interactionsTags','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','includes','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','start','value','unreadMessages','read','and','Contact','$substring','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','end','Tag','split','map','tags','ids','UserId','user','body','plainBody','compact','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','clause','filter','get','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','Sequelize','SELECT','query','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.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.closed','i.closedAt','i.attach','i.lastMsgAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb28a,0x166));var _0xab28=function(_0xa87a5b,_0x50a101){_0xa87a5b=_0xa87a5b-0x0;var _0x293c4=_0xb28a[_0xa87a5b];return _0x293c4;};'use strict';var _=require('lodash');var squel=require(_0xab28('0x0'));var as=require(_0xab28('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0xab28('0x2'))['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x451fc9,_0x1cdc41,_0x17b2a5){var _0x3b6103=![];var _0x133169=utils[_0xab28('0x3')](_0x451fc9);if(_0x1cdc41[_0xab28('0x4')]===_0xab28('0x5')&&!_0x17b2a5['search']&&!_0x17b2a5[_0x133169]){_0x3b6103=!![];}return _0x3b6103;}function getTagsQuery(){return squel['select']()[_0xab28('0x6')]('id')[_0xab28('0x6')](_0xab28('0x7'))[_0xab28('0x6')](_0xab28('0x8'))[_0xab28('0x9')]('tools_tags');}function getUsersQuery(_0x2291dc,_0x49771b){var _0x3e5b85=utils[_0xab28('0xa')](_0x2291dc);var _0x387e2c=_0xab28('0xb')+_0x2291dc+_0xab28('0xc');var _0x3c53a2=squel[_0xab28('0xd')]()[_0xab28('0x6')]('u.id')[_0xab28('0x6')](_0xab28('0xe'))[_0xab28('0x6')](_0xab28('0xf')+_0x3e5b85)[_0xab28('0x9')](_0x387e2c,'ui')[_0xab28('0x10')]('users','u','u.id\x20=\x20ui.UserId');if(_0x49771b[_0xab28('0x11')]>0x0){_0x3c53a2[_0xab28('0x12')](_0xab28('0xf')+_0x3e5b85+_0xab28('0x13'),_['map'](_0x49771b,'id'));}return _0x3c53a2;}function getInteractionsQuery(_0x28ebe2){var _0x4912fa=utils[_0xab28('0x14')](_0x28ebe2);var _0x54f79b=utils[_0xab28('0x3')](_0x28ebe2);var _0x2b0b5c=utils[_0xab28('0xa')](_0x28ebe2);return squel[_0xab28('0xd')]()[_0xab28('0x9')](_0x4912fa[_0xab28('0x15')],'i')[_0xab28('0x10')](_0xab28('0x16'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xab28('0x10')](_0xab28('0x17'),'o',_0xab28('0x18'))[_0xab28('0x10')](_0x4912fa[_0xab28('0x19')],'a',_0xab28('0x1a')+_0x54f79b)[_0xab28('0x10')](_0x4912fa['messages'],'me',_0xab28('0x1b')+_0x2b0b5c+'\x20=\x20i.id')[_0xab28('0x10')](_0x4912fa[_0xab28('0x1c')],'it','it.'+_0x2b0b5c+_0xab28('0x1d'))[_0xab28('0x10')](_0xab28('0x1e'),'t',_0xab28('0x1f'));}function getSqlClauses(){var _0x4549e6={'body':squel[_0xab28('0x20')](),'contact':squel[_0xab28('0x20')](),'default':squel['expr'](),'fields':squel[_0xab28('0x20')](),'filter':squel['expr'](),'read':squel[_0xab28('0x20')](),'tags':{'clause':squel[_0xab28('0x20')](),'ids':null},'user':squel['expr']()};return _0x4549e6;}function parseTagParameter(_0x3928f0){var _0x5e0099=squel[_0xab28('0x20')]();if(_0x3928f0){var _0x2a3405=utils[_0xab28('0x21')](_0x3928f0);_0x2a3405['forEach'](function(_0x24a692){_0x5e0099['or'](_0xab28('0x22'),'%,'+_0x24a692+',%');});}return _0x5e0099;}function parseReadParameter(_0x4a6435){var _0x6a494e='';if(_0x4a6435){_0x6a494e=_0xab28('0x23');if(_0x4a6435==='1'){_0x6a494e=_0x6a494e[_0xab28('0x24')](_0xab28('0x25'),'=');}else{_0x6a494e=_0x6a494e['replace'](_0xab28('0x25'),'>');}}return _0x6a494e;}function parseSearchFilter(_0x299da7,_0x33e5ce){var _0xb6aa4e=squel[_0xab28('0x20')]();if(_0x33e5ce){var _0x4114fd=_0x33e5ce[_0xab28('0x24')]('\x5c','\x5c\x5c')[_0xab28('0x24')](/'/g,'\x27\x27');if(qs[_0xab28('0x26')](_0x4114fd)){_0xb6aa4e['or'](_0xab28('0x27'),_0x4114fd+'%');if(['sms','whatsapp'][_0xab28('0x28')](_0x299da7)){_0xb6aa4e['or']('i.phone\x20LIKE\x20?',_0x4114fd+'%');}else if(_0x299da7==='fax'){_0xb6aa4e['or'](_0xab28('0x29'),_0x4114fd+'%');}else if(_0x299da7===_0xab28('0x2a')){_0xb6aa4e['or'](_0xab28('0x2b'),_0x4114fd+'%');}}else if(_0x299da7===_0xab28('0x2c')&&qs[_0xab28('0x2d')](_0x4114fd)){_0xb6aa4e['or'](_0xab28('0x2e'),_0x4114fd+'%');}else{if(_0x299da7==='mail'){_0xb6aa4e['or'](_0xab28('0x2f'),qs[_0xab28('0x30')](_0x4114fd))['or'](_0xab28('0x31'),qs['getFullTextValue'](_0x4114fd));}else{if(_0x299da7!==_0xab28('0x32')){_0xb6aa4e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xab28('0x30')](_0x4114fd));}_0xb6aa4e['or'](_0xab28('0x33'),_0x4114fd+'%');}}}return _0xb6aa4e;}function parseAdvancedSearchFilter(_0x518202,_0x3dd7d6){var _0x12b5df=getSqlClauses();var _0x215e25=as[_0xab28('0x34')](_0x518202);var _0x64b7ef=_0x215e25[_0xab28('0x35')];for(var _0x4f5e45=0x0;_0x4f5e45<_0x215e25[_0xab28('0x36')][_0xab28('0x11')];_0x4f5e45++){var _0x5869ba=_0x215e25[_0xab28('0x36')][_0x4f5e45];var _0x288260='i';var _0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,[_0xab28('0x7'),_0x5869ba[_0xab28('0x6')]]);if(_0x22cb03){var _0x2d3ba7=as[_0xab28('0x38')](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x39')][_0x64b7ef](_0x2d3ba7[_0xab28('0x3a')],_0x2d3ba7['value'][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);}else{switch(_0x5869ba[_0xab28('0x6')]){case _0xab28('0x3d'):var _0x93d634=parseReadParameter(_0x5869ba[_0xab28('0x3c')]);_0x12b5df[_0xab28('0x3e')][_0xab28('0x3f')](_0x93d634);break;case _0xab28('0x40'):if(_0x5869ba['operator']===_0xab28('0x41')){if(_0x5869ba[_0xab28('0x3c')]['split']('\x20')[_0xab28('0x11')]>0x1){_0x12b5df[_0xab28('0x42')][_0x64b7ef](_0xab28('0x43'),qs[_0xab28('0x30')](_0x5869ba[_0xab28('0x3c')]),null);}else{var _0x5b77c1='%'+_0x5869ba[_0xab28('0x3c')]+'%';_0x12b5df['contact'][_0x64b7ef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5b77c1,_0x5b77c1,_0x5b77c1);}}else{_0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,[_0xab28('0x7'),_0xab28('0x44')]);_0x5869ba[_0xab28('0x6')]=_0xab28('0x44');_0x2d3ba7=as['buildExpression'](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x42')][_0x64b7ef](_0x2d3ba7['text'],_0x2d3ba7[_0xab28('0x3c')]['start'],_0x2d3ba7['value'][_0xab28('0x45')]);}break;case _0xab28('0x46'):var _0x12d90f=_0x5869ba[_0xab28('0x3c')][_0xab28('0x47')](',')[_0xab28('0x48')](function(_0x53c232){return Number(_0x53c232);});var _0x4dd187=parseTagParameter(_0x12d90f);_0x12b5df[_0xab28('0x49')]['clause'][_0xab28('0x3f')](_0x4dd187);_0x12b5df['tags'][_0xab28('0x4a')]=_0x12d90f;break;case'User':if(_0x5869ba['operator']===_0xab28('0x41')){_0x12b5df['user'][_0x64b7ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5869ba['value']+'%',null);}else{_0x22cb03=_[_0xab28('0x37')](_0x3dd7d6,['name',_0xab28('0x4b')]);_0x5869ba[_0xab28('0x6')]=_0xab28('0x4b');_0x2d3ba7=as[_0xab28('0x38')](_0x288260,_0x22cb03['type'],_0x5869ba);_0x12b5df[_0xab28('0x4c')][_0x64b7ef](_0x2d3ba7[_0xab28('0x3a')],_0x2d3ba7[_0xab28('0x3c')][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);}break;case _0xab28('0x4d'):case _0xab28('0x4e'):_0x2d3ba7=as['buildExpression']('me',null,_0x5869ba);_0x12b5df[_0xab28('0x4d')][_0x64b7ef](_0x2d3ba7['text'],_0x2d3ba7['value'][_0xab28('0x3b')],_0x2d3ba7[_0xab28('0x3c')]['end']);break;}}}return _0x12b5df;}function parseModelFields(_0x39a4ef,_0x52fa3a,_0x1d1407){var _0x46c0dd=utils[_0xab28('0x3')](_0x39a4ef);var _0x387b71=squel['expr']();var _0x1e6513=_(_0x52fa3a)['keys']()['map'](function(_0xc22db9){return _['some'](_0x1d1407,[_0xab28('0x7'),_0xc22db9])?_0xc22db9:undefined;})[_0xab28('0x4f')]()['value']();if(_0x1e6513[_0xab28('0x11')]>0x0){_0x1e6513[_0xab28('0x50')](function(_0x49bc36){if(_0x49bc36===_0x46c0dd){_0x387b71[_0xab28('0x3f')]('i.'+_0x46c0dd+'\x20IN\x20?',[][_0xab28('0x51')](_0x52fa3a[_0x49bc36]));}else if(_0x49bc36===_0xab28('0x52')){var _0x41c0b8=JSON[_0xab28('0x53')](_0x52fa3a[_0x49bc36])[_0xab28('0x54')];var _0x237be6=JSON[_0xab28('0x53')](_0x52fa3a[_0x49bc36])[_0xab28('0x55')];_0x387b71['and'](_0xab28('0x56'),_0x41c0b8,_0x237be6);}else{if(_0x52fa3a[_0x49bc36]===_0xab28('0x57')){_0x387b71[_0xab28('0x3f')]('i.'+_0x49bc36+_0xab28('0x58'));}else{_0x387b71[_0xab28('0x3f')]('i.'+_0x49bc36+_0xab28('0x59'),_0x52fa3a[_0x49bc36]);}}});}return _0x387b71;}function parseQueryParameters(_0x9bae23,_0x1f2a25,_0x441dc9){var _0x1cca9b=getSqlClauses();return Promise[_0xab28('0x5a')]()['then'](function(){return parseModelFields(_0x9bae23,_0x1f2a25,_0x441dc9);})[_0xab28('0x5b')](function(_0x534bfc){_0x1cca9b['fields'][_0xab28('0x3f')](_0x534bfc);return parseReadParameter(_0x1f2a25[_0xab28('0x3e')]);})[_0xab28('0x5b')](function(_0x51ba1f){_0x1cca9b['read'][_0xab28('0x3f')](_0x51ba1f);return parseTagParameter(_0x1f2a25[_0xab28('0x5c')]);})[_0xab28('0x5b')](function(_0x701e80){_0x1cca9b[_0xab28('0x49')][_0xab28('0x5d')][_0xab28('0x3f')](_0x701e80);return parseSearchFilter(_0x9bae23,_0x1f2a25[_0xab28('0x5e')]);})[_0xab28('0x5b')](function(_0x2c52e8){_0x1cca9b[_0xab28('0x5e')]=_0x2c52e8;return _0x1cca9b;});}function checkAccountsRestrictions(_0x311261,_0x263fa6,_0x150ee2){var _0x1937cb=utils[_0xab28('0x3')](_0x311261);var _0x74479d=_0xab28('0x5f')+_[_0xab28('0x60')](_0x311261)+(_0x311261===_0xab28('0x61')?_0xab28('0x62'):_0xab28('0x63'));var _0x23b50c=squel[_0xab28('0x20')]();return Promise[_0xab28('0x5a')]()[_0xab28('0x5b')](function(){if(_0x150ee2[_0xab28('0x64')]&&_0x263fa6['role']===_0xab28('0x5')){return _0x263fa6[_0x74479d]({'attributes':['id'],'raw':!![]});}})[_0xab28('0x5b')](function(_0x124e62){if(_0x124e62){if(_0x124e62['length']===0x0){_0x23b50c[_0xab28('0x3f')]('i.'+_0x1937cb+'\x20IS\x20NULL');}else{_0x23b50c[_0xab28('0x3f')]('i.'+_0x1937cb+_0xab28('0x13'),_['map'](_0x124e62,'id'));}}else if(!_0x150ee2[_0x1937cb]){_0x23b50c['and']('i.'+_0x1937cb+_0xab28('0x65'));}})[_0xab28('0x5b')](function(){return _0x23b50c;});}function getClosedOrderClause(_0x59422a,_0x63f569){var _0x58ab41='';var _0x5142fc=[_0xab28('0x66'),_0xab28('0x67'),_0xab28('0x68')];if(_0x59422a==='mail'){_0x5142fc[_0xab28('0x69')](_0xab28('0x6a'));}if(_0x63f569[_0xab28('0x6b')]==='0'&&_0x59422a===_0xab28('0x2c')){_0x58ab41=_0xab28('0x6a');}else{if(_0x63f569[_0xab28('0x6b')]==='1'){_0x5142fc[_0xab28('0x6c')]();}_0x58ab41='CONCAT_WS(\x27\x27,\x20'+_0x5142fc[_0xab28('0x6d')](',\x20')+')';}return _0x58ab41;}function getFilteredInteractions(_0x20cf57,_0x8b9fa3,_0x7c046d,_0x21b1a6){var _0xa7b19a=utils[_0xab28('0xa')](_0x20cf57);var _0x4d19f9=_[_0xab28('0x60')](_0x20cf57)+_0xab28('0x6e');var _0x4e1176=[];var _0x68159a=getTagsQuery();var _0x48ee9b={'type':db[_0xab28('0x6f')]['QueryTypes'][_0xab28('0x70')],'raw':!![]};var _0x283f1c=[];var _0x2a2f69=[];return db['sequelize'][_0xab28('0x71')](_0x68159a[_0xab28('0x72')](),_0x48ee9b)[_0xab28('0x5b')](function(_0x5ea19b){_0x4e1176=_['keyBy'](_0x5ea19b,'id');_0x48ee9b=_['merge'](_0x48ee9b,{'model':db[_0x4d19f9],'mapToModel':!![],'nest':!![]});if(_0x7c046d['fields']){_0x21b1a6['attributes'][_0xab28('0x50')](function(_0x25f342){_0x8b9fa3[_0xab28('0x6')]('i.'+_0x25f342);});}else{_0x8b9fa3[_0xab28('0x6')](_0xab28('0x73'),'unreadMessages');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x74'),_0xab28('0x75'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x76'),'Account.mandatoryDisposition');if(_0x20cf57===_0xab28('0x2c')){_0x8b9fa3['field'](_0xab28('0x77'),'Account.email');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x78'),_0xab28('0x79'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7a'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7b'));_0x8b9fa3[_0xab28('0x6')]('i.updatedAt');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7c'));_0x8b9fa3['field'](_0xab28('0x7d'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7e'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x7f'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x80'));_0x8b9fa3[_0xab28('0x6')]('i.subject');_0x8b9fa3['field']('i.disposition');_0x8b9fa3[_0xab28('0x6')]('i.secondDisposition');_0x8b9fa3['field'](_0xab28('0x66'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x6a'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x81'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x82'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x83'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x84'));}else if(_0x20cf57===_0xab28('0x2a')){_0x8b9fa3[_0xab28('0x6')](_0xab28('0x85'),_0xab28('0x79'));}else{_0x8b9fa3['field'](_0xab28('0x86'),_0xab28('0x79'));}if(_0x20cf57!==_0xab28('0x2c')){_0x8b9fa3[_0xab28('0x6')]('i.*');}_0x8b9fa3['field'](_0xab28('0x87'),_0xab28('0x88'));_0x8b9fa3['field'](_0xab28('0x89'),_0xab28('0x8a'));_0x8b9fa3[_0xab28('0x6')]('c.email','Contact.email');_0x8b9fa3['field'](_0xab28('0x8b'),_0xab28('0x8c'));_0x8b9fa3['field']('c.mobile',_0xab28('0x8d'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x8e'),_0xab28('0x8f'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x90'),'Owner.fullname');_0x8b9fa3[_0xab28('0x6')](_0xab28('0x91'),_0xab28('0x92'));_0x8b9fa3[_0xab28('0x6')](_0xab28('0x93'),_0xab28('0x94'));}if(_0x21b1a6[_0xab28('0x95')]){_0x8b9fa3['limit'](_0x21b1a6[_0xab28('0x95')]);}if(_0x21b1a6['offset']){_0x8b9fa3[_0xab28('0x96')](_0x21b1a6['offset']);}return db[_0xab28('0x97')][_0xab28('0x71')](_0x8b9fa3[_0xab28('0x72')](),_0x48ee9b);})[_0xab28('0x5b')](function(_0x50aea7){_0x283f1c=_0x50aea7;var _0x5a78e8=getUsersQuery(_0x20cf57,_0x283f1c);return db['sequelize']['query'](_0x5a78e8[_0xab28('0x72')](),_0x48ee9b);})[_0xab28('0x5b')](function(_0x2455e6){_0x2a2f69=_[_0xab28('0x98')](_0x2455e6,_0xa7b19a);if(_0x20cf57===_0xab28('0x2c')){return db[_0xab28('0x99')]['findOne']({'attributes':[_0xab28('0x9a')],'raw':!![]});}})[_0xab28('0x5b')](function(_0x1d504b){var _0x154167=_0x1d504b?_0x1d504b[_0xab28('0x9a')]:undefined;var _0x219250=_0x283f1c[_0xab28('0x48')](function(_0x3f783a){return updateInteraction(_0x3f783a,_0x4e1176,_0x2a2f69,_0x154167);});return Promise[_0xab28('0x9b')](_0x219250);});}function countFilteredInteractions(_0x310bc5,_0x2a71c3){var _0x100a35=_0x310bc5[_0xab28('0x9c')]();_0x100a35[_0xab28('0x6')](_0xab28('0x9d'));_0x100a35[_0xab28('0x6')](_0xab28('0x73'),'unreadMessages');var _0x2a1088=utils['getSelectedTags'](_0x2a71c3);if(!_[_0xab28('0x9e')](_0x2a1088)){_0x100a35[_0xab28('0x12')](_0xab28('0x9f'),_0x2a1088);}var _0x3fa57e={'type':db['Sequelize'][_0xab28('0xa0')][_0xab28('0x70')],'raw':!![]};return db[_0xab28('0x97')][_0xab28('0x71')](_0x100a35[_0xab28('0x72')](),_0x3fa57e);}module[_0xab28('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x26ac=['expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','value','end','unreadMessages','read','and','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','map','tags','ids','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','plainBody','some','\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20=\x20?','then','fields','tag','clause','filter','chat','Websites','Accounts','agent','\x20IS\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','getInteractionFK','capitalize','Interaction','Sequelize','query','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','toString','Setting','findOne','enableEmailPreview','clone','COUNT(*)','getSelectedTags','isEmpty','QueryTypes','SELECT','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','search','field','name','color','from','tools_tags','user_has_','_interactions','select','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x26ac,0x1c6));var _0xc26a=function(_0x20f578,_0x12a605){_0x20f578=_0x20f578-0x0;var _0x2cd94a=_0x26ac[_0x20f578];return _0x2cd94a;};'use strict';var _=require(_0xc26a('0x0'));var squel=require(_0xc26a('0x1'));var as=require(_0xc26a('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xc26a('0x3'))[_0xc26a('0x4')];var utils=require('./utils');var db=require(_0xc26a('0x5'))['db'];function skipInteractionsQuery(_0x1421d1,_0x46a237,_0x401af5){var _0x2b59ad=![];var _0x4890e9=utils[_0xc26a('0x6')](_0x1421d1);if(_0x46a237[_0xc26a('0x7')]==='agent'&&!_0x401af5[_0xc26a('0x8')]&&!_0x401af5[_0x4890e9]){_0x2b59ad=!![];}return _0x2b59ad;}function getTagsQuery(){return squel['select']()['field']('id')[_0xc26a('0x9')](_0xc26a('0xa'))['field'](_0xc26a('0xb'))[_0xc26a('0xc')](_0xc26a('0xd'));}function getUsersQuery(_0x4c6331,_0x20b607){var _0x4bf7f8=utils['getInteractionFK'](_0x4c6331);var _0x25efa5=_0xc26a('0xe')+_0x4c6331+_0xc26a('0xf');var _0x1d985f=squel[_0xc26a('0x10')]()[_0xc26a('0x9')](_0xc26a('0x11'))[_0xc26a('0x9')]('u.fullname')[_0xc26a('0x9')](_0xc26a('0x12')+_0x4bf7f8)[_0xc26a('0xc')](_0x25efa5,'ui')[_0xc26a('0x13')](_0xc26a('0x14'),'u',_0xc26a('0x15'));if(_0x20b607[_0xc26a('0x16')]>0x0){_0x1d985f[_0xc26a('0x17')]('ui.'+_0x4bf7f8+'\x20IN\x20?',_['map'](_0x20b607,'id'));}return _0x1d985f;}function getInteractionsQuery(_0x32feea){var _0xacd2ce=utils[_0xc26a('0x18')](_0x32feea);var _0x3ed68f=utils[_0xc26a('0x6')](_0x32feea);var _0x155801=utils['getInteractionFK'](_0x32feea);return squel[_0xc26a('0x10')]()[_0xc26a('0xc')](_0xacd2ce['interactions'],'i')[_0xc26a('0x13')](_0xc26a('0x19'),'c',_0xc26a('0x1a'))['left_join'](_0xc26a('0x14'),'o',_0xc26a('0x1b'))[_0xc26a('0x13')](_0xacd2ce[_0xc26a('0x1c')],'a',_0xc26a('0x1d')+_0x3ed68f)[_0xc26a('0x13')](_0xacd2ce[_0xc26a('0x1e')],'me',_0xc26a('0x1f')+_0x155801+_0xc26a('0x20'))['left_join'](_0xacd2ce[_0xc26a('0x21')],'it',_0xc26a('0x22')+_0x155801+_0xc26a('0x20'))[_0xc26a('0x13')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x4a4fc1={'body':squel[_0xc26a('0x23')](),'contact':squel[_0xc26a('0x23')](),'default':squel[_0xc26a('0x23')](),'fields':squel[_0xc26a('0x23')](),'filter':squel[_0xc26a('0x23')](),'read':squel[_0xc26a('0x23')](),'tags':{'clause':squel[_0xc26a('0x23')](),'ids':null},'user':squel[_0xc26a('0x23')]()};return _0x4a4fc1;}function parseTagParameter(_0x30d152){var _0x3b4bda=squel[_0xc26a('0x23')]();if(_0x30d152){var _0xbecd91=utils['getSelectedTags'](_0x30d152);_0xbecd91[_0xc26a('0x24')](function(_0x41d188){_0x3b4bda['or'](_0xc26a('0x25'),'%,'+_0x41d188+',%');});}return _0x3b4bda;}function parseReadParameter(_0x496670){var _0x2a6721='';if(_0x496670){_0x2a6721=_0xc26a('0x26');if(_0x496670==='1'){_0x2a6721=_0x2a6721[_0xc26a('0x27')](_0xc26a('0x28'),'=');}else{_0x2a6721=_0x2a6721[_0xc26a('0x27')](_0xc26a('0x28'),'>');}}return _0x2a6721;}function parseSearchFilter(_0x3e5859,_0x4d70c9){var _0x11a2b7=squel[_0xc26a('0x23')]();if(_0x4d70c9){var _0x1c6959=_0x4d70c9[_0xc26a('0x27')]('\x5c','\x5c\x5c')[_0xc26a('0x27')](/'/g,'\x27\x27');if(qs[_0xc26a('0x29')](_0x1c6959)){_0x11a2b7['or'](_0xc26a('0x2a'),_0x1c6959+'%');if([_0xc26a('0x2b'),_0xc26a('0x2c')][_0xc26a('0x2d')](_0x3e5859)){_0x11a2b7['or'](_0xc26a('0x2e'),_0x1c6959+'%');}else if(_0x3e5859===_0xc26a('0x2f')){_0x11a2b7['or'](_0xc26a('0x30'),_0x1c6959+'%');}else if(_0x3e5859==='openchannel'){_0x11a2b7['or']('i.from\x20LIKE\x20?',_0x1c6959+'%');}}else if(_0x3e5859===_0xc26a('0x31')&&qs[_0xc26a('0x32')](_0x1c6959)){_0x11a2b7['or'](_0xc26a('0x33'),_0x1c6959+'%');}else{if(_0x3e5859===_0xc26a('0x31')){_0x11a2b7['or'](_0xc26a('0x34'),qs[_0xc26a('0x35')](_0x1c6959,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc26a('0x35')](_0x1c6959));}else if(_0x3e5859!==_0xc26a('0x2f')){_0x11a2b7['or'](_0xc26a('0x36'),qs['getFullTextValue'](_0x1c6959));}_0x11a2b7['or'](_0xc26a('0x37'),qs[_0xc26a('0x35')](_0x1c6959,!![]),null);}}return _0x11a2b7;}function parseAdvancedSearchFilter(_0x870a5d,_0x168f68){var _0x3349bd=getSqlClauses();var _0x4e89c1=as[_0xc26a('0x38')](_0x870a5d);var _0x24b6ab=_0x4e89c1[_0xc26a('0x39')];for(var _0x2e2804=0x0;_0x2e2804<_0x4e89c1[_0xc26a('0x3a')][_0xc26a('0x16')];_0x2e2804++){var _0x4f11db=_0x4e89c1[_0xc26a('0x3a')][_0x2e2804];var _0x2c9a90='i';var _0x2aacc0=_[_0xc26a('0x3b')](_0x168f68,['name',_0x4f11db['field']]);if(_0x2aacc0){var _0x4643b3=as[_0xc26a('0x3c')](_0x2c9a90,_0x2aacc0['type'],_0x4f11db);_0x3349bd[_0xc26a('0x3d')][_0x24b6ab](_0x4643b3['text'],_0x4643b3[_0xc26a('0x3e')]['start'],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x3f')]);}else{switch(_0x4f11db[_0xc26a('0x9')]){case _0xc26a('0x40'):var _0x44b063=parseReadParameter(_0x4f11db[_0xc26a('0x3e')]);_0x3349bd[_0xc26a('0x41')][_0xc26a('0x42')](_0x44b063);break;case _0xc26a('0x43'):if(_0x4f11db[_0xc26a('0x44')]==='$substring'){if(_0x4f11db[_0xc26a('0x3e')][_0xc26a('0x45')]('\x20')[_0xc26a('0x16')]>0x1){_0x3349bd[_0xc26a('0x46')][_0x24b6ab](_0xc26a('0x37'),qs[_0xc26a('0x35')](_0x4f11db[_0xc26a('0x3e')],!![]),null);}else{var _0x465097='%'+_0x4f11db[_0xc26a('0x3e')]+'%';_0x3349bd[_0xc26a('0x46')][_0x24b6ab](_0xc26a('0x47'),_0x465097,_0x465097,_0x465097);}}else{_0x2aacc0=_[_0xc26a('0x3b')](_0x168f68,[_0xc26a('0xa'),_0xc26a('0x48')]);_0x4f11db[_0xc26a('0x9')]=_0xc26a('0x48');_0x4643b3=as[_0xc26a('0x3c')](_0x2c9a90,_0x2aacc0['type'],_0x4f11db);_0x3349bd[_0xc26a('0x46')][_0x24b6ab](_0x4643b3[_0xc26a('0x49')],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x4a')],_0x4643b3['value']['end']);}break;case _0xc26a('0x4b'):var _0x2c0791=_0x4f11db[_0xc26a('0x3e')]['split'](',')[_0xc26a('0x4c')](function(_0x22fe35){return Number(_0x22fe35);});var _0x27fc02=parseTagParameter(_0x2c0791);_0x3349bd[_0xc26a('0x4d')]['clause'][_0xc26a('0x42')](_0x27fc02);_0x3349bd[_0xc26a('0x4d')][_0xc26a('0x4e')]=_0x2c0791;break;case'User':if(_0x4f11db[_0xc26a('0x44')]===_0xc26a('0x4f')){_0x3349bd['user'][_0x24b6ab](_0xc26a('0x50'),'%'+_0x4f11db[_0xc26a('0x3e')]+'%',null);}else{_0x2aacc0=_[_0xc26a('0x3b')](_0x168f68,[_0xc26a('0xa'),_0xc26a('0x51')]);_0x4f11db[_0xc26a('0x9')]=_0xc26a('0x51');_0x4643b3=as[_0xc26a('0x3c')](_0x2c9a90,_0x2aacc0[_0xc26a('0x52')],_0x4f11db);_0x3349bd['user'][_0x24b6ab](_0x4643b3['text'],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x4a')],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x3f')]);}break;case _0xc26a('0x53'):case _0xc26a('0x54'):_0x4643b3=as['buildExpression']('me',null,_0x4f11db);_0x3349bd['body'][_0x24b6ab](_0x4643b3[_0xc26a('0x49')],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x4a')],_0x4643b3[_0xc26a('0x3e')][_0xc26a('0x3f')]);break;}}}return _0x3349bd;}function parseModelFields(_0x29ca27,_0x22c612,_0x249917){var _0x5c1484=utils['getAccountFK'](_0x29ca27);var _0x269c02=squel[_0xc26a('0x23')]();var _0x448b61=_(_0x22c612)['keys']()[_0xc26a('0x4c')](function(_0x13ce58){return _[_0xc26a('0x55')](_0x249917,[_0xc26a('0xa'),_0x13ce58])?_0x13ce58:undefined;})['compact']()[_0xc26a('0x3e')]();if(_0x448b61['length']>0x0){_0x448b61['forEach'](function(_0x1415ca){if(_0x1415ca===_0x5c1484){_0x269c02[_0xc26a('0x42')]('i.'+_0x5c1484+_0xc26a('0x56'),[]['concat'](_0x22c612[_0x1415ca]));}else if(_0x1415ca===_0xc26a('0x57')){var _0x516479=JSON[_0xc26a('0x58')](_0x22c612[_0x1415ca])[_0xc26a('0x59')];var _0x5a4236=JSON[_0xc26a('0x58')](_0x22c612[_0x1415ca])[_0xc26a('0x5a')];_0x269c02[_0xc26a('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x516479,_0x5a4236);}else{if(_0x22c612[_0x1415ca]===_0xc26a('0x5b')){_0x269c02[_0xc26a('0x42')]('i.'+_0x1415ca+'\x20IS\x20NULL');}else{_0x269c02['and']('i.'+_0x1415ca+_0xc26a('0x5c'),_0x22c612[_0x1415ca]);}}});}return _0x269c02;}function parseQueryParameters(_0x24ba05,_0xd41b8b,_0x1916cd){var _0x4281ab=getSqlClauses();return Promise['resolve']()[_0xc26a('0x5d')](function(){return parseModelFields(_0x24ba05,_0xd41b8b,_0x1916cd);})[_0xc26a('0x5d')](function(_0x3975eb){_0x4281ab[_0xc26a('0x5e')]['and'](_0x3975eb);return parseReadParameter(_0xd41b8b[_0xc26a('0x41')]);})['then'](function(_0x3609ac){_0x4281ab[_0xc26a('0x41')]['and'](_0x3609ac);return parseTagParameter(_0xd41b8b[_0xc26a('0x5f')]);})[_0xc26a('0x5d')](function(_0x548bfa){_0x4281ab[_0xc26a('0x4d')][_0xc26a('0x60')]['and'](_0x548bfa);return parseSearchFilter(_0x24ba05,_0xd41b8b['filter']);})[_0xc26a('0x5d')](function(_0x5b0e28){_0x4281ab[_0xc26a('0x61')]=_0x5b0e28;return _0x4281ab;});}function checkAccountsRestrictions(_0xa9eb52,_0x29dea4,_0xf09b63){var _0x4d37e6=utils[_0xc26a('0x6')](_0xa9eb52);var _0x162a14='get'+_['capitalize'](_0xa9eb52)+(_0xa9eb52===_0xc26a('0x62')?_0xc26a('0x63'):_0xc26a('0x64'));var _0x47f43e=squel[_0xc26a('0x23')]();return Promise['resolve']()[_0xc26a('0x5d')](function(){if(_0xf09b63[_0xc26a('0x8')]&&_0x29dea4[_0xc26a('0x7')]===_0xc26a('0x65')){return _0x29dea4[_0x162a14]({'attributes':['id'],'raw':!![]});}})[_0xc26a('0x5d')](function(_0x16c19e){if(_0x16c19e){if(_0x16c19e['length']===0x0){_0x47f43e[_0xc26a('0x42')]('i.'+_0x4d37e6+_0xc26a('0x66'));}else{_0x47f43e[_0xc26a('0x42')]('i.'+_0x4d37e6+_0xc26a('0x56'),_['map'](_0x16c19e,'id'));}}else if(!_0xf09b63[_0x4d37e6]){_0x47f43e[_0xc26a('0x42')]('i.'+_0x4d37e6+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x47f43e;});}function getClosedOrderClause(_0x39cc9d,_0x2f2f06){var _0x1cd549='';var _0x54092d=[_0xc26a('0x67'),_0xc26a('0x68'),_0xc26a('0x69')];if(_0x39cc9d===_0xc26a('0x31')){_0x54092d[_0xc26a('0x6a')](_0xc26a('0x6b'));}if(_0x2f2f06['closed']==='0'&&_0x39cc9d===_0xc26a('0x31')){_0x1cd549=_0xc26a('0x6b');}else{if(_0x2f2f06[_0xc26a('0x6c')]==='1'){_0x54092d['shift']();}_0x1cd549='CONCAT_WS(\x27\x27,\x20'+_0x54092d[_0xc26a('0x6d')](',\x20')+')';}return _0x1cd549;}function getFilteredInteractions(_0x5b7023,_0x4ba6a2,_0x3cad20,_0x49e5f9){var _0x2c36e3=utils[_0xc26a('0x6e')](_0x5b7023);var _0x2031f1=_[_0xc26a('0x6f')](_0x5b7023)+_0xc26a('0x70');var _0x12b7c4=[];var _0x4a6a5d=getTagsQuery();var _0x11cb29={'type':db[_0xc26a('0x71')]['QueryTypes']['SELECT'],'raw':!![]};var _0x52123a=[];var _0x2b3d04=[];return db['sequelize'][_0xc26a('0x72')](_0x4a6a5d['toString'](),_0x11cb29)[_0xc26a('0x5d')](function(_0x5e7546){_0x12b7c4=_['keyBy'](_0x5e7546,'id');_0x11cb29=_[_0xc26a('0x73')](_0x11cb29,{'model':db[_0x2031f1],'mapToModel':!![],'nest':!![]});if(_0x3cad20['fields']){_0x49e5f9['attributes'][_0xc26a('0x24')](function(_0x3b9875){_0x4ba6a2[_0xc26a('0x9')]('i.'+_0x3b9875);});}else{_0x4ba6a2[_0xc26a('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc26a('0x40'));_0x4ba6a2['field'](_0xc26a('0x74'),_0xc26a('0x75'));_0x4ba6a2['field'](_0xc26a('0x76'),_0xc26a('0x77'));if(_0x5b7023===_0xc26a('0x31')){_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x78'),'Account.email');_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x79'),_0xc26a('0x7a'));_0x4ba6a2[_0xc26a('0x9')]('i.id');_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x7b'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x7c'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x7d'));_0x4ba6a2[_0xc26a('0x9')]('i.closedAt');_0x4ba6a2['field'](_0xc26a('0x7e'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x7f'));_0x4ba6a2[_0xc26a('0x9')]('i.lastMsgDirection');_0x4ba6a2[_0xc26a('0x9')]('i.subject');_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x69'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x68'));_0x4ba6a2['field'](_0xc26a('0x67'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x6b'));_0x4ba6a2[_0xc26a('0x9')]('i.to');_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x80'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x81'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x82'));}else if(_0x5b7023===_0xc26a('0x83')){_0x4ba6a2[_0xc26a('0x9')]('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',_0xc26a('0x7a'));}else{_0x4ba6a2['field'](_0xc26a('0x84'),'contactName');}if(_0x5b7023!==_0xc26a('0x31')){_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x85'));}_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x86'),'Contact.firstName');_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x87'),_0xc26a('0x88'));_0x4ba6a2[_0xc26a('0x9')]('c.email',_0xc26a('0x89'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x8a'),_0xc26a('0x8b'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x8c'),_0xc26a('0x8d'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x8e'),_0xc26a('0x8f'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x90'),_0xc26a('0x91'));_0x4ba6a2[_0xc26a('0x9')](_0xc26a('0x92'),_0xc26a('0x93'));_0x4ba6a2['field'](_0xc26a('0x94'),'TagIds');}if(_0x49e5f9[_0xc26a('0x95')]){_0x4ba6a2[_0xc26a('0x95')](_0x49e5f9[_0xc26a('0x95')]);}if(_0x49e5f9['offset']){_0x4ba6a2[_0xc26a('0x96')](_0x49e5f9[_0xc26a('0x96')]);}return db[_0xc26a('0x97')]['query'](_0x4ba6a2[_0xc26a('0x98')](),_0x11cb29);})['then'](function(_0x4a0401){_0x52123a=_0x4a0401;var _0x4eb566=getUsersQuery(_0x5b7023,_0x52123a);return db['sequelize'][_0xc26a('0x72')](_0x4eb566[_0xc26a('0x98')](),_0x11cb29);})['then'](function(_0xc7f659){_0x2b3d04=_['groupBy'](_0xc7f659,_0x2c36e3);if(_0x5b7023==='mail'){return db[_0xc26a('0x99')][_0xc26a('0x9a')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xc26a('0x5d')](function(_0x5e3d72){var _0x18c187=_0x5e3d72?_0x5e3d72[_0xc26a('0x9b')]:undefined;var _0x15d54c=_0x52123a['map'](function(_0x4a71bf){return updateInteraction(_0x4a71bf,_0x12b7c4,_0x2b3d04,_0x18c187);});return Promise['all'](_0x15d54c);});}function countFilteredInteractions(_0x167c3a,_0x58a3c6){var _0x3112b1=_0x167c3a[_0xc26a('0x9c')]();_0x3112b1[_0xc26a('0x9')](_0xc26a('0x9d'));_0x3112b1[_0xc26a('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc26a('0x40'));var _0x5f1d53=utils[_0xc26a('0x9e')](_0x58a3c6);if(!_[_0xc26a('0x9f')](_0x5f1d53)){_0x3112b1[_0xc26a('0x17')]('t.id\x20IN\x20?',_0x5f1d53);}var _0x5488db={'type':db[_0xc26a('0x71')][_0xc26a('0xa0')][_0xc26a('0xa1')],'raw':!![]};return db[_0xc26a('0x97')][_0xc26a('0x72')](_0x3112b1[_0xc26a('0x98')](),_0x5488db);}module[_0xc26a('0xa2')]={'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 ae3dbc2..e6276c5 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 _0xd152=['catch','updateInteraction','then','../../mysqldb','map','fullname','split','waiting','talking','answered','unmanaged','abandoned','closed','UserId','disposition','total','MailMessage','findOne','plainBody','-id','lastMsgText'];(function(_0x21369f,_0x290d79){var _0x1ea990=function(_0x561fa6){while(--_0x561fa6){_0x21369f['push'](_0x21369f['shift']());}};_0x1ea990(++_0x290d79);}(_0xd152,0xc0));var _0x2d15=function(_0x3da157,_0x2be24f){_0x3da157=_0x3da157-0x0;var _0x1166d3=_0xd152[_0x3da157];return _0x1166d3;};'use strict';var _=require('lodash');var db=require(_0x2d15('0x0'))['db'];function getInteractionUsers(_0x4075da,_0x48e1d7){return new Promise(function(_0x1c78d9,_0x5326b7){try{var _0x290a6=[];if(_0x48e1d7[_0x4075da]){_0x290a6=_0x48e1d7[_0x4075da][_0x2d15('0x1')](function(_0x7f29a0){return{'id':_0x7f29a0['id'],'fullname':_0x7f29a0[_0x2d15('0x2')]};});}return _0x1c78d9(_0x290a6);}catch(_0x117a2a){_0x5326b7(_0x117a2a);}});}function getInteractionTags(_0xa0f3e8,_0x53a4a7){var _0x31a803=[];if(_0xa0f3e8){_0xa0f3e8[_0x2d15('0x3')](',')['forEach'](function(_0x3571cb){_0x31a803['push'](_0x53a4a7[_0x3571cb]);});}return _0x31a803;}function updateWaitingCounter(_0x358c25){if(_0x358c25['waiting']){_0x358c25[_0x2d15('0x4')]-=0x1;}}function updateInteractionCounters(_0x296504){_0x296504[_0x2d15('0x4')]=0x0;_0x296504[_0x2d15('0x5')]=0x0;_0x296504[_0x2d15('0x6')]=0x0;_0x296504[_0x2d15('0x7')]=0x0;_0x296504[_0x2d15('0x8')]=0x0;_0x296504['total']=0x0;if(_0x296504[_0x2d15('0x9')]){if(_0x296504['disposition']===_0x2d15('0x8')){_0x296504[_0x2d15('0x8')]+=0x1;updateWaitingCounter(_0x296504);}if(_0x296504[_0x2d15('0xa')]){_0x296504[_0x2d15('0x6')]+=0x1;if(_0x296504[_0x2d15('0x5')]){_0x296504['talking']-=0x1;}}else{if(_0x296504[_0x2d15('0xb')]){_0x296504['unmanaged']+=0x1;updateWaitingCounter(_0x296504);}}}else{if(!_0x296504['UserId']){_0x296504[_0x2d15('0x4')]+=0x1;}if(_0x296504[_0x2d15('0xa')]){_0x296504['talking']+=0x1;updateWaitingCounter(_0x296504);}}_0x296504[_0x2d15('0xc')]+=0x1;return _0x296504;}function getLastMessageText(_0x3e66e6){return db[_0x2d15('0xd')][_0x2d15('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3e66e6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2d15('0xf')],'order':_0x2d15('0x10'),'raw':!![]})['then'](function(_0x269918){if(_0x269918&&_0x269918[_0x2d15('0xf')]){_0x3e66e6[_0x2d15('0x11')]=_['trimStart'](_0x269918[_0x2d15('0xf')]);}return _0x3e66e6;})[_0x2d15('0x12')](function(_0x48bbdd){throw _0x48bbdd;});}exports[_0x2d15('0x13')]=function(_0x1eab36,_0x1937b8,_0x584fa8,_0x916943){return new Promise(function(_0x3c367f,_0x3e6701){return getInteractionUsers(_0x1eab36['id'],_0x584fa8)[_0x2d15('0x14')](function(_0x50a764){_0x1eab36['Users']=_0x50a764;return getInteractionTags(_0x1eab36['TagIds'],_0x1937b8);})['then'](function(_0x5cbb0f){_0x1eab36['Tags']=_0x5cbb0f;delete _0x1eab36['TagIds'];return updateInteractionCounters(_0x1eab36);})['then'](function(_0x4e503b){if(_0x916943){return getLastMessageText(_0x4e503b);}else{return _0x4e503b;}})[_0x2d15('0x14')](function(_0x20a947){_0x3c367f(_0x20a947);})['catch'](function(_0x2f73da){_0x3e6701(_0x2f73da);});});}; \ No newline at end of file +var _0x9b7f=['closed','disposition','abandoned','unmanaged','UserId','MailMessage','findOne','out','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','split','forEach','waiting','talking','answered'];(function(_0x3e7ae6,_0x2e14d9){var _0xdfaa19=function(_0x2f9732){while(--_0x2f9732){_0x3e7ae6['push'](_0x3e7ae6['shift']());}};_0xdfaa19(++_0x2e14d9);}(_0x9b7f,0x1d9));var _0xf9b7=function(_0x3ca1d7,_0x34a0c5){_0x3ca1d7=_0x3ca1d7-0x0;var _0x4287a4=_0x9b7f[_0x3ca1d7];return _0x4287a4;};'use strict';var _=require('lodash');var db=require(_0xf9b7('0x0'))['db'];function getInteractionUsers(_0x351884,_0x4585cf){return new Promise(function(_0x39e036,_0x2789a6){try{var _0x1bdaab=[];if(_0x4585cf[_0x351884]){_0x1bdaab=_0x4585cf[_0x351884][_0xf9b7('0x1')](function(_0xfd13e9){return{'id':_0xfd13e9['id'],'fullname':_0xfd13e9['fullname']};});}return _0x39e036(_0x1bdaab);}catch(_0x27bd0d){_0x2789a6(_0x27bd0d);}});}function getInteractionTags(_0x458781,_0x1bd24b){var _0x189e02=[];if(_0x458781){_0x458781[_0xf9b7('0x2')](',')[_0xf9b7('0x3')](function(_0x216542){_0x189e02['push'](_0x1bd24b[_0x216542]);});}return _0x189e02;}function updateWaitingCounter(_0x2c678b){if(_0x2c678b[_0xf9b7('0x4')]){_0x2c678b[_0xf9b7('0x4')]-=0x1;}}function updateInteractionCounters(_0x4c1547){_0x4c1547[_0xf9b7('0x4')]=0x0;_0x4c1547[_0xf9b7('0x5')]=0x0;_0x4c1547[_0xf9b7('0x6')]=0x0;_0x4c1547['unmanaged']=0x0;_0x4c1547['abandoned']=0x0;_0x4c1547['total']=0x0;if(_0x4c1547[_0xf9b7('0x7')]){if(_0x4c1547[_0xf9b7('0x8')]===_0xf9b7('0x9')){_0x4c1547[_0xf9b7('0x9')]+=0x1;updateWaitingCounter(_0x4c1547);}if(_0x4c1547['UserId']){_0x4c1547[_0xf9b7('0x6')]+=0x1;if(_0x4c1547['talking']){_0x4c1547[_0xf9b7('0x5')]-=0x1;}}else{if(_0x4c1547[_0xf9b7('0x8')]){_0x4c1547[_0xf9b7('0xa')]+=0x1;updateWaitingCounter(_0x4c1547);}}}else{if(!_0x4c1547['UserId']){_0x4c1547['waiting']+=0x1;}if(_0x4c1547[_0xf9b7('0xb')]){_0x4c1547[_0xf9b7('0x5')]+=0x1;updateWaitingCounter(_0x4c1547);}}_0x4c1547['total']+=0x1;return _0x4c1547;}function getLastMessageText(_0x404d57){return db[_0xf9b7('0xc')][_0xf9b7('0xd')]({'where':{'$and':[{'MailInteractionId':_0x404d57['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf9b7('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xf9b7('0xf')](function(_0x3b4983){if(_0x3b4983&&_0x3b4983[_0xf9b7('0x10')]){_0x404d57[_0xf9b7('0x11')]=_[_0xf9b7('0x12')](_0x3b4983['plainBody']);}return _0x404d57;})[_0xf9b7('0x13')](function(_0x33883d){throw _0x33883d;});}exports[_0xf9b7('0x14')]=function(_0x551968,_0x3d99ad,_0x34e8b0,_0x39e666){return new Promise(function(_0x1548e1,_0x5d3636){return getInteractionUsers(_0x551968['id'],_0x34e8b0)[_0xf9b7('0xf')](function(_0x33a785){_0x551968[_0xf9b7('0x15')]=_0x33a785;return getInteractionTags(_0x551968[_0xf9b7('0x16')],_0x3d99ad);})[_0xf9b7('0xf')](function(_0x5b81b5){_0x551968[_0xf9b7('0x17')]=_0x5b81b5;delete _0x551968[_0xf9b7('0x16')];return updateInteractionCounters(_0x551968);})[_0xf9b7('0xf')](function(_0x81053e){if(_0x39e666){return getLastMessageText(_0x81053e);}else{return _0x81053e;}})['then'](function(_0x573747){_0x1548e1(_0x573747);})[_0xf9b7('0x13')](function(_0x1150ea){_0x5d3636(_0x1150ea);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index ea48103..a8ff955 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 _0xb20e=['chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','info','catch','exports','lodash','../../mysqldb','openchannel-interactions','fax-interactions','../../config/logger'];(function(_0x46c15b,_0x1677db){var _0x40e2da=function(_0x97c389){while(--_0x97c389){_0x46c15b['push'](_0x46c15b['shift']());}};_0x40e2da(++_0x1677db);}(_0xb20e,0xeb));var _0xeb20=function(_0x16133f,_0x3dd76b){_0x16133f=_0x16133f-0x0;var _0x2252b2=_0xb20e[_0x16133f];return _0x2252b2;};'use strict';var _=require(_0xeb20('0x0'));var db=require(_0xeb20('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xeb20('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0xeb20('0x3')),'sms':require(_0xeb20('0x4'))('sms-interactions'),'chat':require(_0xeb20('0x4'))(_0xeb20('0x5')),'whatsapp':require(_0xeb20('0x4'))(_0xeb20('0x6'))};function getAccountFK(_0x22a7cb){return _[_0xeb20('0x7')](_0x22a7cb)+(_0x22a7cb===_0xeb20('0x8')?_0xeb20('0x9'):_0xeb20('0xa'))+'Id';}function getInteractionFK(_0x4d5483){return _[_0xeb20('0x7')](_0x4d5483)+_0xeb20('0xb');}function getInteractionId(_0x379e6d,_0x2dcbd4,_0x2dea39){if(_0x379e6d&&_0x379e6d[_['upperFirst'](_0x2dea39)+_0xeb20('0xb')]){return _0x379e6d[_[_0xeb20('0xc')](_0x2dea39)+_0xeb20('0xb')];}else if(_0x379e6d&&_0x379e6d['id']){return _0x379e6d['id'];}else if(_0x2dcbd4&&_0x2dcbd4['id']){return _0x2dcbd4['id'];}else{return _0xeb20('0xd');}}function getInteractionsTables(_0x4b364d){return{'accounts':_0x4b364d+'_'+(_0x4b364d===_0xeb20('0x8')?'websites':_0xeb20('0xe')),'interactions':_0x4b364d+_0xeb20('0xf'),'interactionsTags':_0x4b364d+'_interaction_has_tags','messages':_0x4b364d+_0xeb20('0x10'),'userInteractions':_0xeb20('0x11')+_0x4b364d+'_interactions'};}function getSelectedTags(_0x534249){var _0x1db9a8=[];if(_0x534249){_0x1db9a8=Array['isArray'](_0x534249)?_0x534249:[_0x534249];}return _0x1db9a8;}function log(_0x5d9b68,_0x49f50f,_0x4700b2,_0x4fc381,_0x41dfdb,_0x485206){loggers[_0x41dfdb[_0xeb20('0x12')]()][_0x5d9b68](_0xeb20('0x13'),_0x485206[_0xeb20('0x14')](),_0x49f50f?_0x49f50f['id']:null,_0x49f50f?_0x49f50f[_0xeb20('0x15')]:null,_0x49f50f?_0x49f50f['role']:null,getInteractionId(_0x4700b2,_0x4fc381,_0x41dfdb),_0x4700b2?JSON[_0xeb20('0x16')](_0x4700b2):_0xeb20('0x17'));}function updateUser(_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80){db[_[_0xeb20('0xc')](_0x4e683c)+_0xeb20('0x18')][_0xeb20('0x19')]({'where':{'id':getInteractionId(_0x50ebfd,_0x7dc897,_0x4e683c)}})['then'](function(_0x19d769){if(_0x19d769){return _0x19d769['update']({'UserId':_0x27642c?_0x27642c['id']:null});}})[_0xeb20('0x1a')](function(_0x1fe25b){if(_0x1fe25b){log(_0xeb20('0x1b'),_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80);}})[_0xeb20('0x1c')](function(){log('error',_0x27642c,_0x50ebfd,_0x7dc897,_0x4e683c,_0x3b5b80);});}module[_0xeb20('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x11c2=['_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','then','update','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','_interactions','_interaction_has_tags'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x11c2,0x169));var _0x211c=function(_0x7e4661,_0x3c2acc){_0x7e4661=_0x7e4661-0x0;var _0x4452fd=_0x11c2[_0x7e4661];return _0x4452fd;};'use strict';var _=require('lodash');var db=require(_0x211c('0x0'))['db'];var loggers={'openchannel':require(_0x211c('0x1'))(_0x211c('0x2')),'mail':require(_0x211c('0x1'))('mail-interactions'),'fax':require(_0x211c('0x1'))(_0x211c('0x3')),'sms':require(_0x211c('0x1'))('sms-interactions'),'chat':require(_0x211c('0x1'))(_0x211c('0x4')),'whatsapp':require(_0x211c('0x1'))(_0x211c('0x5'))};function getAccountFK(_0x1f485a){return _[_0x211c('0x6')](_0x1f485a)+(_0x1f485a==='chat'?_0x211c('0x7'):_0x211c('0x8'))+'Id';}function getInteractionFK(_0x38f60d){return _[_0x211c('0x6')](_0x38f60d)+_0x211c('0x9');}function getInteractionId(_0x44ddcb,_0x187c37,_0x54dc39){if(_0x44ddcb&&_0x44ddcb[_['upperFirst'](_0x54dc39)+_0x211c('0x9')]){return _0x44ddcb[_[_0x211c('0xa')](_0x54dc39)+'InteractionId'];}else if(_0x44ddcb&&_0x44ddcb['id']){return _0x44ddcb['id'];}else if(_0x187c37&&_0x187c37['id']){return _0x187c37['id'];}else{return _0x211c('0xb');}}function getInteractionsTables(_0x1af1b8){return{'accounts':_0x1af1b8+'_'+(_0x1af1b8===_0x211c('0xc')?_0x211c('0xd'):'accounts'),'interactions':_0x1af1b8+_0x211c('0xe'),'interactionsTags':_0x1af1b8+_0x211c('0xf'),'messages':_0x1af1b8+_0x211c('0x10'),'userInteractions':'user_has_'+_0x1af1b8+_0x211c('0xe')};}function getSelectedTags(_0x35ba73){var _0x800c19=[];if(_0x35ba73){_0x800c19=Array['isArray'](_0x35ba73)?_0x35ba73:[_0x35ba73];}return _0x800c19;}function log(_0x20b856,_0x45a638,_0x27c088,_0x3269b8,_0x177a37,_0x110966){loggers[_0x177a37[_0x211c('0x11')]()][_0x20b856](_0x211c('0x12'),_0x110966[_0x211c('0x13')](),_0x45a638?_0x45a638['id']:null,_0x45a638?_0x45a638['name']:null,_0x45a638?_0x45a638[_0x211c('0x14')]:null,getInteractionId(_0x27c088,_0x3269b8,_0x177a37),_0x27c088?JSON[_0x211c('0x15')](_0x27c088):_0x211c('0x16'));}function updateUser(_0x50a99a,_0x459ede,_0xfab586,_0x41e47b,_0x5b2416){db[_[_0x211c('0xa')](_0x41e47b)+_0x211c('0x17')]['findOne']({'where':{'id':getInteractionId(_0x459ede,_0xfab586,_0x41e47b)}})[_0x211c('0x18')](function(_0x434e6b){if(_0x434e6b){return _0x434e6b[_0x211c('0x19')]({'UserId':_0x50a99a?_0x50a99a['id']:null});}})[_0x211c('0x18')](function(_0x48844b){if(_0x48844b){log('info',_0x50a99a,_0x459ede,_0xfab586,_0x41e47b,_0x5b2416);}})[_0x211c('0x1a')](function(){log(_0x211c('0x1b'),_0x50a99a,_0x459ede,_0xfab586,_0x41e47b,_0x5b2416);});}module[_0x211c('0x1c')]={'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 26efd69..b0b956e 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 _0x95b5=['use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final'];(function(_0x32b86,_0x1624fc){var _0x37cda4=function(_0x43042e){while(--_0x43042e){_0x32b86['push'](_0x32b86['shift']());}};_0x37cda4(++_0x1624fc);}(_0x95b5,0x12b));var _0x595b=function(_0xa7470c,_0x486789){_0xa7470c=_0xa7470c-0x0;var _0x2fd345=_0x95b5[_0xa7470c];return _0x2fd345;};'use strict';var crypto=require(_0x595b('0x0'));var util=require(_0x595b('0x1'));var compose=require('composable-middleware');var db=require(_0x595b('0x2'))['db'];var config=require(_0x595b('0x3'));function getValueFromLicense(_0x193454,_0x45ea5b){if(_0x193454&&_0x45ea5b){if(_0x45ea5b[_0x595b('0x4')]&&_0x45ea5b[_0x595b('0x5')]){var _0x25c37e=_0x45ea5b[_0x595b('0x4')];var _0x2b4883=_0x45ea5b[_0x595b('0x5')];var _0x449bf5=_0x25c37e['split']('-')[0x4];var _0x20f589=_0x25c37e['split']('-')[0x0];var _0x18ac35=crypto[_0x595b('0x6')](_0x595b('0x7'),util[_0x595b('0x8')](_0x595b('0x9'),_0x449bf5,_0x25c37e,_0x20f589));var _0x4028c5=_0x18ac35['update'](_0x2b4883,_0x595b('0xa'),_0x595b('0xb'));_0x4028c5+=_0x18ac35[_0x595b('0xc')](_0x595b('0xb'));var _0x310b55=JSON['parse'](_0x4028c5);return _0x310b55['hasOwnProperty'](_0x193454)?_0x310b55[_0x193454]:null;}}return null;}function isLimit(_0xc0a1de,_0xb2b8a1,_0x4750ff,_0x1dd7f2){var _0x44b028=_0xb2b8a1;return compose()[_0x595b('0xd')](function(_0x57a763,_0x1804f9,_0x44d21d){return db[_0x595b('0xe')][_0x595b('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x595b('0x10')](function(_0x4443ab){var _0x5472ce=getValueFromLicense(_0xc0a1de,_0x4443ab);return _0x5472ce?_0x5472ce:_0x44b028;})[_0x595b('0x10')](function(_0x521db9){_0x44b028=_0x521db9;return _0x4750ff[_0x595b('0x11')](_0x1dd7f2);})['then'](function(_0x1cf0ed){if(_0x1cf0ed>=_0x44b028){return _0x1804f9[_0x595b('0x12')](0x193)[_0x595b('0x13')]({'message':util['format'](_0x595b('0x14'),_0xc0a1de)});}_0x44d21d();})[_0x595b('0x15')](function(_0x48d90b){_0x44d21d(_0x48d90b);});});}function isUserLimit(){return isLimit(_0x595b('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x595b('0x17')},{'role':_0x595b('0x18')}]}});}exports[_0x595b('0x19')]=isUserLimit; \ No newline at end of file +var _0x2c41=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','use','License','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user'];(function(_0x47b244,_0x168e7b){var _0x305d11=function(_0x51ae18){while(--_0x51ae18){_0x47b244['push'](_0x47b244['shift']());}};_0x305d11(++_0x168e7b);}(_0x2c41,0x6d));var _0x12c4=function(_0x6f3151,_0x406745){_0x6f3151=_0x6f3151-0x0;var _0x305fb8=_0x2c41[_0x6f3151];return _0x305fb8;};'use strict';var crypto=require(_0x12c4('0x0'));var util=require(_0x12c4('0x1'));var compose=require(_0x12c4('0x2'));var db=require(_0x12c4('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5725ab,_0x3716ed){if(_0x5725ab&&_0x3716ed){if(_0x3716ed[_0x12c4('0x4')]&&_0x3716ed[_0x12c4('0x5')]){var _0x366434=_0x3716ed['data1'];var _0x1f4280=_0x3716ed[_0x12c4('0x5')];var _0x3451f1=_0x366434[_0x12c4('0x6')]('-')[0x4];var _0x2f0a53=_0x366434[_0x12c4('0x6')]('-')[0x0];var _0x305d31=crypto[_0x12c4('0x7')](_0x12c4('0x8'),util['format'](_0x12c4('0x9'),_0x3451f1,_0x366434,_0x2f0a53));var _0x594de1=_0x305d31[_0x12c4('0xa')](_0x1f4280,_0x12c4('0xb'),'utf8');_0x594de1+=_0x305d31['final'](_0x12c4('0xc'));var _0x5cd9ad=JSON[_0x12c4('0xd')](_0x594de1);return _0x5cd9ad['hasOwnProperty'](_0x5725ab)?_0x5cd9ad[_0x5725ab]:null;}}return null;}function isLimit(_0x328510,_0xf925f7,_0x4e9885,_0x31f1cb){var _0x9562bf=_0xf925f7;return compose()[_0x12c4('0xe')](function(_0x4ee110,_0x29185e,_0x1d9df8){return db[_0x12c4('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x12c4('0x10')](function(_0x469f45){var _0x31b155=getValueFromLicense(_0x328510,_0x469f45);return _0x31b155?_0x31b155:_0x9562bf;})[_0x12c4('0x10')](function(_0x415851){_0x9562bf=_0x415851;return _0x4e9885['count'](_0x31f1cb);})['then'](function(_0x40faf2){if(_0x40faf2>=_0x9562bf){return _0x29185e[_0x12c4('0x11')](0x193)[_0x12c4('0x12')]({'message':util[_0x12c4('0x13')](_0x12c4('0x14'),_0x328510)});}_0x1d9df8();})[_0x12c4('0x15')](function(_0x2b0a74){_0x1d9df8(_0x2b0a74);});});}function isUserLimit(){return isLimit(_0x12c4('0x16'),0x1,db[_0x12c4('0x17')],{'where':{'$or':[{'role':_0x12c4('0x18')},{'role':_0x12c4('0x19')}]}});}exports[_0x12c4('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9bbfd43..bfd4033 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 _0x52ee=['lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','forEach','shift','match','filter','map','conditions','push','DATE','$eq','operator','value','includes','$gt','$lte','add','format','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes'];(function(_0x28655c,_0x2e737a){var _0x383242=function(_0x195f00){while(--_0x195f00){_0x28655c['push'](_0x28655c['shift']());}};_0x383242(++_0x2e737a);}(_0x52ee,0x14a));var _0xe52e=function(_0x150cc4,_0x15e9f1){_0x150cc4=_0x150cc4-0x0;var _0x22a995=_0x52ee[_0x150cc4];return _0x22a995;};'use strict';var _=require(_0xe52e('0x0'));var moment=require(_0xe52e('0x1'));exports[_0xe52e('0x2')]=function(_0x3cee82){var _0x203069={'conditions':[]};_0x203069[_0xe52e('0x3')]=_[_0xe52e('0x4')](_0x3cee82,_0xe52e('0x5'))?'or':_0xe52e('0x6');var _0x186a7a=_0x3cee82['replace'](_0xe52e('0x7'),'')[_0xe52e('0x8')](_0xe52e('0x5'),'')[_0xe52e('0x9')]('||');for(var _0x19c644=0x0;_0x19c644<_0x186a7a[_0xe52e('0xa')];_0x19c644++){var _0x10dba1=_0x186a7a[_0x19c644][_0xe52e('0x9')](':=');var _0x105b5a=_0x10dba1[0x0];var _0x46efe4=_0x10dba1['slice'](0x1);_0x46efe4[_0xe52e('0xb')](function(_0x553554){var _0xeb05be=_0x553554['split']('[')[_0xe52e('0xc')]();var _0x109dc5=_0x553554[_0xe52e('0xd')](/\[(.*?)\]/g);_0x109dc5[_0xe52e('0xb')](function(_0xbfcd47){var _0x3e89f0=_0xbfcd47[_0xe52e('0x9')]('[')[_0xe52e('0xe')](function(_0xaba09c){return _0xaba09c['indexOf'](']')>-0x1;})[_0xe52e('0xf')](function(_0x384162){return _0x384162[_0xe52e('0x9')](']')[0x0];})[0x0];_0x203069[_0xe52e('0x10')][_0xe52e('0x11')]({'field':_0x105b5a,'operator':_0xeb05be,'value':_0x3e89f0});});});}return _0x203069;};exports['buildExpression']=function(_0x41798a,_0x293056,_0x2e4939){var _0x5886a2={};if(_0x293056===_0xe52e('0x12')){if(_0x2e4939['operator']===_0xe52e('0x13')){_0x2e4939[_0xe52e('0x14')]='$between';_0x2e4939[_0xe52e('0x15')]+=','+_0x2e4939[_0xe52e('0x15')];}else if(_[_0xe52e('0x16')]([_0xe52e('0x17'),_0xe52e('0x18')],_0x2e4939['operator'])){_0x2e4939[_0xe52e('0x15')]=moment(_0x2e4939[_0xe52e('0x15')])[_0xe52e('0x19')](0x1,'days')[_0xe52e('0x1a')]('YYYY-MM-DD');}}if(_0x2e4939[_0xe52e('0x1b')]){_0x293056=_0x2e4939['castTo'];_0x5886a2['text']=_0xe52e('0x1c')+_0x41798a+'.'+_0x2e4939[_0xe52e('0x1d')]+_0xe52e('0x1e')+_0x2e4939['castTo']+')\x20'+parseOperator(_0x2e4939[_0xe52e('0x14')]);}else{_0x5886a2[_0xe52e('0x1f')]=_0x41798a+'.'+_0x2e4939['field']+'\x20'+parseOperator(_0x2e4939['operator']);}if(_[_0xe52e('0x16')]([_0xe52e('0x20'),_0xe52e('0x21')],_0x2e4939['operator']))_0x5886a2[_0xe52e('0x1f')]='('+_0x5886a2[_0xe52e('0x1f')]+_0xe52e('0x22')+_0x41798a+'.'+_0x2e4939[_0xe52e('0x1d')]+_0xe52e('0x23');_0x5886a2[_0xe52e('0x15')]=parseValue(_0x293056,_0x2e4939[_0xe52e('0x14')],_0x2e4939['value']);return _0x5886a2;};function parseOperator(_0x441905){var _0x1d2644;switch(_0x441905){case _0xe52e('0x24'):_0x1d2644=_0xe52e('0x25');break;case _0xe52e('0x21'):_0x1d2644='NOT\x20IN\x20?';break;case _0xe52e('0x13'):_0x1d2644='=\x20?';break;case'$ne':_0x1d2644=_0xe52e('0x26');break;case'$substring':case'$startsWith':case _0xe52e('0x27'):_0x1d2644=_0xe52e('0x28');break;case _0xe52e('0x29'):_0x1d2644=_0xe52e('0x2a');break;case _0xe52e('0x17'):_0x1d2644=_0xe52e('0x2b');break;case _0xe52e('0x18'):_0x1d2644=_0xe52e('0x2c');break;case _0xe52e('0x2d'):_0x1d2644=_0xe52e('0x2e');break;case _0xe52e('0x2f'):_0x1d2644=_0xe52e('0x30');break;}return _0x1d2644;}function parseValue(_0x39b653,_0x38847b,_0x364e09){var _0x15e4c1={'start':undefined,'end':undefined};switch(_0x38847b){case _0xe52e('0x24'):case _0xe52e('0x21'):_0x15e4c1[_0xe52e('0x31')]=_0x364e09[_0xe52e('0x9')](',');break;case _0xe52e('0x32'):_0x15e4c1[_0xe52e('0x31')]='%'+_0x364e09+'%';break;case'$startsWith':_0x15e4c1[_0xe52e('0x31')]=_0x364e09+'%';break;case _0xe52e('0x27'):_0x15e4c1['start']='%'+_0x364e09;break;case'$between':var _0x446f29=_0x364e09[_0xe52e('0x9')](',');var _0x364e09=_0x446f29[_0xe52e('0xc')]();var _0x1c9064=_0x446f29[_0xe52e('0x33')]();if(_0x39b653===_0xe52e('0x12')){_0x364e09=moment(_0x364e09)[_0xe52e('0x34')](0x0,!![])[_0xe52e('0x1a')]();_0x1c9064=moment(_0x1c9064)['utcOffset'](0x0,!![])[_0xe52e('0x19')](0x17,_0xe52e('0x35'))[_0xe52e('0x19')](0x3b,_0xe52e('0x36'))['add'](0x3b,'seconds')[_0xe52e('0x1a')]();}_0x15e4c1={'start':_0x364e09,'end':_0x1c9064};break;default:_0x15e4c1[_0xe52e('0x31')]=_0x364e09;break;}return _0x15e4c1;} \ No newline at end of file +var _0xa698=['shift','match','forEach','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$startsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','utcOffset','add','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','and','[$and]','[$or]','length','split'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa698,0xfa));var _0x8a69=function(_0x3be380,_0x33edc1){_0x3be380=_0x3be380-0x0;var _0x20711e=_0xa698[_0x3be380];return _0x20711e;};'use strict';var _=require(_0x8a69('0x0'));var moment=require(_0x8a69('0x1'));exports[_0x8a69('0x2')]=function(_0x486a6d){var _0x5cc6e1={'conditions':[]};_0x5cc6e1[_0x8a69('0x3')]=_[_0x8a69('0x4')](_0x486a6d,'[$or]')?'or':_0x8a69('0x5');var _0x1c166a=_0x486a6d['replace'](_0x8a69('0x6'),'')['replace'](_0x8a69('0x7'),'')['split']('||');for(var _0x345af9=0x0;_0x345af9<_0x1c166a[_0x8a69('0x8')];_0x345af9++){var _0x2011bb=_0x1c166a[_0x345af9][_0x8a69('0x9')](':=');var _0x291ec5=_0x2011bb[0x0];var _0x2bcbc9=_0x2011bb['slice'](0x1);_0x2bcbc9['forEach'](function(_0x3fbb24){var _0x2830c0=_0x3fbb24[_0x8a69('0x9')]('[')[_0x8a69('0xa')]();var _0x45a2d7=_0x3fbb24[_0x8a69('0xb')](/\[(.*?)\]/g);_0x45a2d7[_0x8a69('0xc')](function(_0x3a2b69){var _0x590e8b=_0x3a2b69[_0x8a69('0x9')]('[')['filter'](function(_0x3b9cae){return _0x3b9cae[_0x8a69('0xd')](']')>-0x1;})[_0x8a69('0xe')](function(_0x37259d){return _0x37259d[_0x8a69('0x9')](']')[0x0];})[0x0];_0x5cc6e1[_0x8a69('0xf')]['push']({'field':_0x291ec5,'operator':_0x2830c0,'value':_0x590e8b});});});}return _0x5cc6e1;};exports[_0x8a69('0x10')]=function(_0x4630fa,_0xb59eda,_0x18ef74){var _0x5ab03d={};if(_0xb59eda===_0x8a69('0x11')){if(_0x18ef74['operator']==='$eq'){_0x18ef74[_0x8a69('0x12')]=_0x8a69('0x13');_0x18ef74[_0x8a69('0x14')]+=','+_0x18ef74[_0x8a69('0x14')];}else if(_[_0x8a69('0x15')]([_0x8a69('0x16'),_0x8a69('0x17')],_0x18ef74[_0x8a69('0x12')])){_0x18ef74[_0x8a69('0x14')]=moment(_0x18ef74['value'])['add'](0x1,'days')[_0x8a69('0x18')](_0x8a69('0x19'));}}if(_0x18ef74[_0x8a69('0x1a')]){_0xb59eda=_0x18ef74[_0x8a69('0x1a')];_0x5ab03d[_0x8a69('0x1b')]=_0x8a69('0x1c')+_0x4630fa+'.'+_0x18ef74['field']+_0x8a69('0x1d')+_0x18ef74[_0x8a69('0x1a')]+')\x20'+parseOperator(_0x18ef74[_0x8a69('0x12')]);}else{_0x5ab03d[_0x8a69('0x1b')]=_0x4630fa+'.'+_0x18ef74[_0x8a69('0x1e')]+'\x20'+parseOperator(_0x18ef74[_0x8a69('0x12')]);}if(_[_0x8a69('0x15')]([_0x8a69('0x1f'),_0x8a69('0x20')],_0x18ef74[_0x8a69('0x12')]))_0x5ab03d[_0x8a69('0x1b')]='('+_0x5ab03d[_0x8a69('0x1b')]+'\x20OR\x20'+_0x4630fa+'.'+_0x18ef74[_0x8a69('0x1e')]+_0x8a69('0x21');_0x5ab03d[_0x8a69('0x14')]=parseValue(_0xb59eda,_0x18ef74[_0x8a69('0x12')],_0x18ef74[_0x8a69('0x14')]);return _0x5ab03d;};function parseOperator(_0x3f4211){var _0x4fb311;switch(_0x3f4211){case _0x8a69('0x22'):_0x4fb311=_0x8a69('0x23');break;case _0x8a69('0x20'):_0x4fb311=_0x8a69('0x24');break;case _0x8a69('0x25'):_0x4fb311='=\x20?';break;case'$ne':_0x4fb311=_0x8a69('0x26');break;case'$substring':case _0x8a69('0x27'):case'$endsWith':_0x4fb311='LIKE\x20?';break;case _0x8a69('0x28'):_0x4fb311=_0x8a69('0x29');break;case _0x8a69('0x16'):_0x4fb311=_0x8a69('0x2a');break;case _0x8a69('0x17'):_0x4fb311=_0x8a69('0x2b');break;case _0x8a69('0x2c'):_0x4fb311='>=\x20?';break;case'$between':_0x4fb311=_0x8a69('0x2d');break;}return _0x4fb311;}function parseValue(_0x15aad2,_0x3aa3b9,_0x5328a8){var _0x39bc59={'start':undefined,'end':undefined};switch(_0x3aa3b9){case _0x8a69('0x22'):case _0x8a69('0x20'):_0x39bc59[_0x8a69('0x2e')]=_0x5328a8['split'](',');break;case _0x8a69('0x2f'):_0x39bc59[_0x8a69('0x2e')]='%'+_0x5328a8+'%';break;case _0x8a69('0x27'):_0x39bc59[_0x8a69('0x2e')]=_0x5328a8+'%';break;case'$endsWith':_0x39bc59[_0x8a69('0x2e')]='%'+_0x5328a8;break;case _0x8a69('0x13'):var _0x1dcc93=_0x5328a8[_0x8a69('0x9')](',');var _0x5328a8=_0x1dcc93[_0x8a69('0xa')]();var _0x5797ad=_0x1dcc93['pop']();if(_0x15aad2===_0x8a69('0x11')){_0x5328a8=moment(_0x5328a8)[_0x8a69('0x30')](0x0,!![])['format']();_0x5797ad=moment(_0x5797ad)[_0x8a69('0x30')](0x0,!![])[_0x8a69('0x31')](0x17,_0x8a69('0x32'))['add'](0x3b,_0x8a69('0x33'))['add'](0x3b,'seconds')[_0x8a69('0x18')]();}_0x39bc59={'start':_0x5328a8,'end':_0x5797ad};break;default:_0x39bc59['start']=_0x5328a8;break;}return _0x39bc59;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 68943d6..1381536 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 _0x24ca=['format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','isEmail','push','getOptions','query','$id','model','map','name','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','columns','merge','type','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','split','isEmpty','forOwn','find','DATE','isPlainObject','$gte'];(function(_0x147ade,_0xf6137d){var _0x4b26d0=function(_0x37da0d){while(--_0x37da0d){_0x147ade['push'](_0x147ade['shift']());}};_0x4b26d0(++_0xf6137d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x24ca[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require(_0xa24c('0x0'));var sequelize=require('sequelize');var moment=require(_0xa24c('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4ebab4){var _0x4defb1=['ne'];try{var _0x5876d6=JSON[_0xa24c('0x2')](_0x4ebab4);var _0x8a54a0=Object[_0xa24c('0x3')](_0x5876d6)[0x0];return _0x4defb1[_0xa24c('0x4')](_0x8a54a0);}catch(_0xe76a30){return![];}}function getOperatorValue(_0x15a5cd){var _0xf0511=JSON[_0xa24c('0x2')](_0x15a5cd);var _0x2dd348=Object[_0xa24c('0x3')](_0xf0511)[0x0];var _0x9a5013=_0xf0511[_0x2dd348];return{['$'+_0x2dd348]:_0x9a5013};}exports['fields']=function(_0x42d89c){var _0x3a5727=null;if(_0x42d89c){_0x3a5727=_0x42d89c[_0xa24c('0x5')](',');}return _0x3a5727;};exports['filters']=function(_0x399f32,_0x325c6d){var _0x288f76={};if(!_[_0xa24c('0x6')](_0x399f32)){_[_0xa24c('0x7')](_0x399f32,function(_0x43aa5a,_0x1a71a8){try{if(_0x325c6d){var _0xc82af0=_[_0xa24c('0x8')](_0x325c6d,{'name':_0x1a71a8})||{};if(hasSequelizeOperator(_0x43aa5a)){_0x288f76[_0x1a71a8]=getOperatorValue(_0x43aa5a);}else if(_0xc82af0['type']===_0xa24c('0x9')&&_[_0xa24c('0xa')](_0x43aa5a)){var _0xcee4fe=JSON[_0xa24c('0x2')](_0x43aa5a);var _0x5a9486={'$gte':moment(moment(_0xcee4fe[_0xa24c('0xb')])[_0xa24c('0xc')](_0xa24c('0xd')))[_0xa24c('0xe')]()[_0xa24c('0xc')](),'$lte':moment(moment(_0xcee4fe[_0xa24c('0xf')])[_0xa24c('0xc')]('YYYY-MM-DD'))['utc']()[_0xa24c('0x10')](0x1,'s')[_0xa24c('0xc')]()};_0x288f76[_0x1a71a8]=_0x5a9486;}else if(_0xc82af0['name']==='uniqueid'){_0x288f76[_0x1a71a8]=_0x43aa5a;}else{_0x288f76[_0x1a71a8]=_[_0xa24c('0x11')](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}else{_0x288f76[_0x1a71a8]=_['isArray'](_0x43aa5a)?_0x43aa5a:JSON[_0xa24c('0x2')](_0x43aa5a);}}catch(_0x5de3e6){_0x288f76[_0x1a71a8]=_0x43aa5a[_0xa24c('0x5')](',');}});}return _0x288f76;};exports[_0xa24c('0x12')]=function(_0x1fcd4b){_0x1fcd4b=parseInt(_0x1fcd4b,0xa);if(!_0x1fcd4b||_0x1fcd4b<0x0){_0x1fcd4b=LIMIT_VALUE;}return _0x1fcd4b;};exports[_0xa24c('0x13')]=function(_0x4ff97c){_0x4ff97c=parseInt(_0x4ff97c,0xa);if(!_0x4ff97c||_0x4ff97c<0x0){_0x4ff97c=0x0;}return _0x4ff97c;};exports[_0xa24c('0x14')]=function(_0x18b7e0){var _0x773f70,_0x4d4bab=null;if(_0x18b7e0){_0x773f70=_0x18b7e0['split'](',');_0x4d4bab=_['map'](_0x773f70,function(_0x4cd77e){if(_0x4cd77e[_0xa24c('0x15')]('-')===0x0){return[_0x4cd77e===_0xa24c('0x16')?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')]('priority'),_0xa24c('0x19')):_0x4cd77e['substr'](0x1),_0xa24c('0x1a')];}else{return[_0x4cd77e===_0xa24c('0x16')?sequelize['cast'](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x4cd77e,_0xa24c('0x1b')];}});}return _0x4d4bab;};exports[_0xa24c('0x1c')]=function(_0x47e0eb,_0xec9167){if(_['isEmpty'](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x11')](_0x47e0eb)){for(var _0x3951ae=0x0;_0x3951ae<_0x47e0eb[_0xa24c('0x1d')];_0x3951ae+=0x1){_0x47e0eb[_0x3951ae]=this['omit'](_0x47e0eb[_0x3951ae],_0xec9167);}return _0x47e0eb;}if(!_[_0xa24c('0x1e')](_0x47e0eb)){return _0x47e0eb;}if(_[_0xa24c('0x1f')](_0xec9167)){_0xec9167=[_0xec9167];}if(!_[_0xa24c('0x11')](_0xec9167)){return _0x47e0eb;}for(var _0x314121=0x0;_0x314121<_0xec9167[_0xa24c('0x1d')];_0x314121+=0x1){_[_0xa24c('0x20')](_0x47e0eb,_0xec9167[_0x314121]);}for(var _0x39609a in _0x47e0eb){if(_0x47e0eb['hasOwnProperty'](_0x39609a)){_0x47e0eb[_0x39609a]=this[_0xa24c('0x1c')](_0x47e0eb[_0x39609a],_0xec9167);}}return _0x47e0eb;};exports[_0xa24c('0x21')]=function(_0x152120){return _0x152120[_0xa24c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa24c('0x23')]=function(_0xc96ce7){return _0xc96ce7[_0xa24c('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x15eaaf){var _0x3dcb1b=[];_0x15eaaf[_0xa24c('0x5')](/[ ,]+/)['forEach'](function(_0x245fb2){_0x245fb2=_0x245fb2['replace'](/([^:]")"+/g,'$1');_0x245fb2='+'+_0x245fb2+'*';var _0x1102ab=/[ `!@#$%^&*()_\-?~]/;if(_0x245fb2[_0xa24c('0x22')](_0x1102ab))_0x245fb2='\x22'+_0x245fb2+'\x22';_0x3dcb1b[_0xa24c('0x24')](_0x245fb2);});return _0x3dcb1b['join']('\x20');};exports[_0xa24c('0x25')]=function(_0x53f90,_0x1d0379,_0x52572f){var _0x1c1ed3={},_0x57c340={};if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')]){_0x1d0379['query']['id']=_0x1d0379['query'][_0xa24c('0x27')];delete _0x1d0379[_0xa24c('0x26')][_0xa24c('0x27')];}_0x1c1ed3[_0xa24c('0x28')]=_[_0xa24c('0x29')](_0x53f90,_0xa24c('0x2a'));_0x1c1ed3[_0xa24c('0x26')]=_['keys'](_0x1d0379[_0xa24c('0x26')]);_0x1c1ed3[_0xa24c('0x2b')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],_0x1c1ed3[_0xa24c('0x26')]);_0x57c340[_0xa24c('0x2d')]=_[_0xa24c('0x2c')](_0x1c1ed3[_0xa24c('0x28')],this[_0xa24c('0x2e')](_0x1d0379[_0xa24c('0x26')]['fields']));_0x57c340[_0xa24c('0x2d')]=_0x57c340[_0xa24c('0x2d')][_0xa24c('0x1d')]?_0x57c340[_0xa24c('0x2d')]:_0x1c1ed3['model'];if(!_0x1d0379['query'][_0xa24c('0x2f')]('nolimit')){_0x57c340[_0xa24c('0x12')]=this[_0xa24c('0x12')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x12')]);_0x57c340[_0xa24c('0x13')]=this['offset'](_0x1d0379['query'][_0xa24c('0x13')]);}_0x57c340[_0xa24c('0x30')]=this[_0xa24c('0x14')](_0x1d0379[_0xa24c('0x26')][_0xa24c('0x14')]);_0x57c340[_0xa24c('0x31')]=this['filters'](_['pick'](_0x1d0379[_0xa24c('0x26')],_0x1c1ed3[_0xa24c('0x2b')]),_0x53f90);if(_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]){var _0x43beff=_0x53f90;var _0x4c5b7e=_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')];if(typeof _0x4c5b7e==='object'){_0x43beff=_['filter'](_0x53f90,function(_0xba7407){return _[_0xa24c('0x4')](_0x4c5b7e[_0xa24c('0x33')],_0xba7407['name']);});_0x4c5b7e=_0x4c5b7e['value'];}_0x57c340[_0xa24c('0x31')]=_[_0xa24c('0x34')](_0x57c340[_0xa24c('0x31')],{'$or':_[_0xa24c('0x29')](_0x43beff,function(_0x3f640e){if(_0x3f640e[_0xa24c('0x35')]!==_0xa24c('0x36')){if(_0x52572f){return sequelize[_0xa24c('0x31')](sequelize['fn']('lower',sequelize['col'](_0x3f640e[_0xa24c('0x2a')])),{'$like':sequelize['fn'](_0xa24c('0x37'),'%'+_0x1d0379[_0xa24c('0x26')]['filter']+'%')});}else{var _0x472c1e={};_0x472c1e[_0x3f640e[_0xa24c('0x2a')]]={'$like':'%'+_0x1d0379[_0xa24c('0x26')][_0xa24c('0x32')]+'%'};return _0x472c1e;}}})});}_0x57c340=_[_0xa24c('0x34')]({},_0x57c340,_0x1d0379[_0xa24c('0x38')]);return _0x57c340;}; \ No newline at end of file +var _0x3757=['match','{EXPR}','join','query','$id','model','intersection','attributes','fields','nolimit','order','where','filter','object','includes','columns','value','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','split','filters','isEmpty','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','cast','priority','unsigned','substr','DESC','col','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','isEmail','getFullTextValue','\x22{EXPR}\x22','replace'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x3757,0x18a));var _0x7375=function(_0x501ccb,_0x122e43){_0x501ccb=_0x501ccb-0x0;var _0x2b7ad3=_0x3757[_0x501ccb];return _0x2b7ad3;};'use strict';var _=require(_0x7375('0x0'));var sequelize=require(_0x7375('0x1'));var moment=require(_0x7375('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x66c5ff){var _0x455d94=['ne'];try{var _0x1639cd=JSON[_0x7375('0x3')](_0x66c5ff);var _0x4028a6=Object[_0x7375('0x4')](_0x1639cd)[0x0];return _0x455d94['includes'](_0x4028a6);}catch(_0x13e312){return![];}}function getOperatorValue(_0x4706a8){var _0x31be75=JSON[_0x7375('0x3')](_0x4706a8);var _0xdb01c3=Object['keys'](_0x31be75)[0x0];var _0x5ad694=_0x31be75[_0xdb01c3];return{['$'+_0xdb01c3]:_0x5ad694};}exports['fields']=function(_0x556591){var _0x36f836=null;if(_0x556591){_0x36f836=_0x556591[_0x7375('0x5')](',');}return _0x36f836;};exports[_0x7375('0x6')]=function(_0x4b1b80,_0x254a39){var _0xf1b0c6={};if(!_[_0x7375('0x7')](_0x4b1b80)){_['forOwn'](_0x4b1b80,function(_0x1a2568,_0xa29e44){try{if(_0x254a39){var _0x11a2b=_['find'](_0x254a39,{'name':_0xa29e44})||{};if(hasSequelizeOperator(_0x1a2568)){_0xf1b0c6[_0xa29e44]=getOperatorValue(_0x1a2568);}else if(_0x11a2b['type']==='DATE'&&_[_0x7375('0x8')](_0x1a2568)){var _0x59fffa=JSON['parse'](_0x1a2568);var _0x563f0b={'$gte':moment(moment(_0x59fffa[_0x7375('0x9')])[_0x7375('0xa')](_0x7375('0xb')))[_0x7375('0xc')]()[_0x7375('0xa')](),'$lte':moment(moment(_0x59fffa[_0x7375('0xd')])['format'](_0x7375('0xb')))[_0x7375('0xc')]()[_0x7375('0xe')](0x1,'s')[_0x7375('0xa')]()};_0xf1b0c6[_0xa29e44]=_0x563f0b;}else if(_0x11a2b[_0x7375('0xf')]===_0x7375('0x10')){_0xf1b0c6[_0xa29e44]=_0x1a2568;}else{_0xf1b0c6[_0xa29e44]=_[_0x7375('0x11')](_0x1a2568)?_0x1a2568:JSON['parse'](_0x1a2568);}}else{_0xf1b0c6[_0xa29e44]=_[_0x7375('0x11')](_0x1a2568)?_0x1a2568:JSON[_0x7375('0x3')](_0x1a2568);}}catch(_0x3d8b10){_0xf1b0c6[_0xa29e44]=_0x1a2568[_0x7375('0x5')](',');}});}return _0xf1b0c6;};exports[_0x7375('0x12')]=function(_0x50e5fc){_0x50e5fc=parseInt(_0x50e5fc,0xa);if(!_0x50e5fc||_0x50e5fc<0x0){_0x50e5fc=LIMIT_VALUE;}return _0x50e5fc;};exports[_0x7375('0x13')]=function(_0x1d2b8f){_0x1d2b8f=parseInt(_0x1d2b8f,0xa);if(!_0x1d2b8f||_0x1d2b8f<0x0){_0x1d2b8f=0x0;}return _0x1d2b8f;};exports[_0x7375('0x14')]=function(_0x39c057){var _0x55b8d7,_0x40b4f0=null;if(_0x39c057){_0x55b8d7=_0x39c057[_0x7375('0x5')](',');_0x40b4f0=_[_0x7375('0x15')](_0x55b8d7,function(_0x241a0a){if(_0x241a0a['indexOf']('-')===0x0){return[_0x241a0a==='priority'?sequelize[_0x7375('0x16')](sequelize['col'](_0x7375('0x17')),_0x7375('0x18')):_0x241a0a[_0x7375('0x19')](0x1),_0x7375('0x1a')];}else{return[_0x241a0a===_0x7375('0x17')?sequelize['cast'](sequelize[_0x7375('0x1b')]('priority'),_0x7375('0x18')):_0x241a0a,_0x7375('0x1c')];}});}return _0x40b4f0;};exports[_0x7375('0x1d')]=function(_0x2007fb,_0x3dc00d){if(_[_0x7375('0x7')](_0x2007fb)){return _0x2007fb;}if(_[_0x7375('0x11')](_0x2007fb)){for(var _0xbfd981=0x0;_0xbfd981<_0x2007fb[_0x7375('0x1e')];_0xbfd981+=0x1){_0x2007fb[_0xbfd981]=this[_0x7375('0x1d')](_0x2007fb[_0xbfd981],_0x3dc00d);}return _0x2007fb;}if(!_[_0x7375('0x1f')](_0x2007fb)){return _0x2007fb;}if(_[_0x7375('0x20')](_0x3dc00d)){_0x3dc00d=[_0x3dc00d];}if(!_[_0x7375('0x11')](_0x3dc00d)){return _0x2007fb;}for(var _0x5d5fe1=0x0;_0x5d5fe1<_0x3dc00d['length'];_0x5d5fe1+=0x1){_[_0x7375('0x21')](_0x2007fb,_0x3dc00d[_0x5d5fe1]);}for(var _0x2e4900 in _0x2007fb){if(_0x2007fb[_0x7375('0x22')](_0x2e4900)){_0x2007fb[_0x2e4900]=this['omit'](_0x2007fb[_0x2e4900],_0x3dc00d);}}return _0x2007fb;};exports[_0x7375('0x23')]=function(_0x23a06c){return _0x23a06c['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x7375('0x24')]=function(_0x5ed1e0){return _0x5ed1e0['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7375('0x25')]=function(_0xd69009,_0x33f661){var _0x28533c=[];var _0x5a776c=/[ `!@#$%^&*()_\-?~]/;var _0x1c0207=_0x33f661?_0x7375('0x26'):'{EXPR}';_0xd69009['split'](/[ ,]+/)['forEach'](function(_0x561fa4){_0x561fa4=_0x561fa4[_0x7375('0x27')](/([^:]")"+/g,'$1');_0x561fa4='+'+_0x561fa4+'*';var _0x4095c8=_0x561fa4[_0x7375('0x28')](_0x5a776c);if(_0x4095c8){_0x561fa4='\x22'+_0x561fa4+'\x22';}_0x28533c['push'](_0x561fa4);});_0x1c0207=_0x1c0207[_0x7375('0x27')](_0x7375('0x29'),_0x28533c[_0x7375('0x2a')]('\x20'));return _0x1c0207;};exports['getOptions']=function(_0x3cd2a2,_0x4b353d,_0x209424){var _0x2fd170={},_0x4aec06={};if(_0x4b353d[_0x7375('0x2b')][_0x7375('0x2c')]){_0x4b353d['query']['id']=_0x4b353d[_0x7375('0x2b')][_0x7375('0x2c')];delete _0x4b353d[_0x7375('0x2b')]['$id'];}_0x2fd170[_0x7375('0x2d')]=_['map'](_0x3cd2a2,'name');_0x2fd170[_0x7375('0x2b')]=_[_0x7375('0x4')](_0x4b353d[_0x7375('0x2b')]);_0x2fd170[_0x7375('0x6')]=_[_0x7375('0x2e')](_0x2fd170[_0x7375('0x2d')],_0x2fd170['query']);_0x4aec06[_0x7375('0x2f')]=_[_0x7375('0x2e')](_0x2fd170[_0x7375('0x2d')],this[_0x7375('0x30')](_0x4b353d[_0x7375('0x2b')]['fields']));_0x4aec06[_0x7375('0x2f')]=_0x4aec06['attributes'][_0x7375('0x1e')]?_0x4aec06[_0x7375('0x2f')]:_0x2fd170[_0x7375('0x2d')];if(!_0x4b353d[_0x7375('0x2b')]['hasOwnProperty'](_0x7375('0x31'))){_0x4aec06[_0x7375('0x12')]=this[_0x7375('0x12')](_0x4b353d[_0x7375('0x2b')][_0x7375('0x12')]);_0x4aec06[_0x7375('0x13')]=this[_0x7375('0x13')](_0x4b353d[_0x7375('0x2b')][_0x7375('0x13')]);}_0x4aec06[_0x7375('0x32')]=this[_0x7375('0x14')](_0x4b353d['query'][_0x7375('0x14')]);_0x4aec06[_0x7375('0x33')]=this[_0x7375('0x6')](_['pick'](_0x4b353d['query'],_0x2fd170[_0x7375('0x6')]),_0x3cd2a2);if(_0x4b353d[_0x7375('0x2b')]['filter']){var _0x4e1704=_0x3cd2a2;var _0x50ba9a=_0x4b353d[_0x7375('0x2b')][_0x7375('0x34')];if(typeof _0x50ba9a===_0x7375('0x35')){_0x4e1704=_['filter'](_0x3cd2a2,function(_0x375f0e){return _[_0x7375('0x36')](_0x50ba9a[_0x7375('0x37')],_0x375f0e[_0x7375('0xf')]);});_0x50ba9a=_0x50ba9a[_0x7375('0x38')];}_0x4aec06[_0x7375('0x33')]=_[_0x7375('0x39')](_0x4aec06[_0x7375('0x33')],{'$or':_[_0x7375('0x15')](_0x4e1704,function(_0x214c01){if(_0x214c01[_0x7375('0x3a')]!==_0x7375('0x3b')){if(_0x209424){return sequelize['where'](sequelize['fn'](_0x7375('0x3c'),sequelize[_0x7375('0x1b')](_0x214c01[_0x7375('0xf')])),{'$like':sequelize['fn'](_0x7375('0x3c'),'%'+_0x4b353d['query'][_0x7375('0x34')]+'%')});}else{var _0x3bdc72={};_0x3bdc72[_0x214c01[_0x7375('0xf')]]={'$like':'%'+_0x4b353d[_0x7375('0x2b')][_0x7375('0x34')]+'%'};return _0x3bdc72;}}})});}_0x4aec06=_[_0x7375('0x39')]({},_0x4aec06,_0x4b353d[_0x7375('0x3d')]);return _0x4aec06;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3db1756..250122e 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 _0xfbb4=['whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','ringing','voiceStatus','pause','smsStatus','whatsappStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xfbb4,0xcc));var _0x4fbb=function(_0x141e16,_0x1f5689){_0x141e16=_0x141e16-0x0;var _0x254287=_0xfbb4[_0x141e16];return _0x254287;};'use strict';var _=require(_0x4fbb('0x0'));var jayson=require(_0x4fbb('0x1'));var db=require(_0x4fbb('0x2'))['db'];var amiClient=jayson[_0x4fbb('0x3')][_0x4fbb('0x4')]({'port':0x232a});var routingClient=jayson[_0x4fbb('0x3')][_0x4fbb('0x4')]({'port':0x232c});function isAgentPaused(_0x2752e1,_0x411b3f){var _0x1021f6=[_0x2752e1[_0x4fbb('0x5')],_0x2752e1[_0x4fbb('0x6')],_0x2752e1[_0x4fbb('0x7')],_0x2752e1[_0x4fbb('0x8')],_0x2752e1['smsPause'],_0x2752e1[_0x4fbb('0x9')],_0x2752e1[_0x4fbb('0xa')]];if(!_0x411b3f)return _[_0x4fbb('0xb')](_0x1021f6);var _0x445360=_[_0x4fbb('0xc')](_0x1021f6);return _0x445360[_0x4fbb('0xd')]>0x0&&_0x445360[_0x4fbb('0xd')]<_0x1021f6[_0x4fbb('0xd')]?!![]:![];}function isIdle(_0x369888){return _0x369888===_0x4fbb('0xe')||_0x369888==='unknown'||_0x369888===_0x4fbb('0xf')||_0x369888===_0x4fbb('0x10')||_['isNil'](_0x369888);}function isAgentIdle(_0xea4a44){if(_0xea4a44[_0x4fbb('0x11')]!==_0x4fbb('0xe')&&_0xea4a44[_0x4fbb('0x9')]){_0xea4a44[_0x4fbb('0x11')]=_0x4fbb('0x12');return![];}return _[_0x4fbb('0xb')]([_0xea4a44['chatStatus'],_0xea4a44['faxStatus'],_0xea4a44['mailStatus'],_0xea4a44['openchannelStatus'],_0xea4a44[_0x4fbb('0x13')],_0xea4a44['voiceStatus'],_0xea4a44[_0x4fbb('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4fbb('0x15')]('Agents',{})[_0x4fbb('0x16')](function(_0x9001d1){if(_0x9001d1[_0x4fbb('0x17')]){throw new Error(_0x4fbb('0x18'));}var _0xde4621=_0x9001d1[_0x4fbb('0x19')];return routingClient['request'](_0x4fbb('0x1a'),{})[_0x4fbb('0x16')](function(_0xc976f2){if(_0xc976f2[_0x4fbb('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1ae968=_0xc976f2[_0x4fbb('0x19')];return _[_0x4fbb('0x1b')]({},_0xde4621,_0x1ae968);});})[_0x4fbb('0x1c')](function(_0x2296eb){throw _0x2296eb;});}exports[_0x4fbb('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3dda93){var _0x9f3814=_0x4fbb('0x1e');if(isAgentPaused(_0x3dda93))_0x9f3814=_0x4fbb('0x12');else if(isAgentPaused(_0x3dda93,!![]))_0x9f3814=_0x4fbb('0x1f');else if(isAgentIdle(_0x3dda93))_0x9f3814=_0x4fbb('0xe');else _0x9f3814=_0x4fbb('0x20');return _0x9f3814;}exports[_0x4fbb('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4277fb,_0xf87847){var _0x12fd2a=_[_0x4fbb('0x22')](_0x4277fb)?_0x4277fb:[_0x4277fb];var _0x51e06e=_['startCase'](_0xf87847)+_0x4fbb('0x23');var _0x44281a=_[_0x4fbb('0x24')](_0x12fd2a,function(_0x5c4d18){return db[_0x51e06e][_0x4fbb('0x25')]({'where':{'id':_0x5c4d18}})[_0x4fbb('0x16')](function(_0xf90e7a){if(!_0xf90e7a)return[];return _0xf90e7a[_0x4fbb('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x44281a)['then'](function(_0x10cb28){var _0x328546=_(_0x10cb28)[_0x4fbb('0x27')]()[_0x4fbb('0x24')]('id')['uniq']()[_0x4fbb('0x28')]();return _0x328546;});}exports[_0x4fbb('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x170f35,_0x34d68e,_0x540c3d){try{if(_0x34d68e[_0x4fbb('0xd')]>0x0){_0x170f35=_0x170f35[_0x4fbb('0xc')](function(_0x10335b){return _0x34d68e[_0x4fbb('0x2a')](_0x10335b['id']);});}var _0x2a6dcb=_0x170f35[_0x4fbb('0xc')](function(_0x235785){var _0x5dd325='busy';if(isAgentIdle(_0x235785)){_0x5dd325=_0x4fbb('0xe');}return _0x5dd325===_0x540c3d;});return _[_0x4fbb('0x24')](_0x2a6dcb,'id');}catch(_0x142eda){throw _0x142eda;}}exports[_0x4fbb('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x48b835,_0x48e4bf,_0xedece0){return Promise[_0x4fbb('0x2c')]()[_0x4fbb('0x16')](function(){if(_0x48e4bf['length']>0x0){_0x48b835=_0x48b835[_0x4fbb('0xc')](function(_0x3489ff){return _0x48e4bf[_0x4fbb('0x2a')](_0x3489ff['id']);});}return _0x48b835;})[_0x4fbb('0x16')](function(){return db[_0x4fbb('0x2d')][_0x4fbb('0x2e')]({'attributes':['id',_0x4fbb('0x2f'),_0x4fbb('0x30'),_0x4fbb('0x5'),_0x4fbb('0x6'),_0x4fbb('0x7'),'openchannelPause','smsPause','voicePause',_0x4fbb('0xa'),_0x4fbb('0x31')],'where':{'id':{'$in':_['map'](_0x48b835,'id')}},'raw':!![]});})[_0x4fbb('0x16')](function(_0x4e8b72){return _0x4e8b72[_0x4fbb('0x24')](function(_0x1ffd4a){var _0xf442ba=_['find'](_0x48b835,['id',_0x1ffd4a['id']]);var _0x23cd3a=filterAgentAttributes(_0xf442ba);_['merge'](_0x1ffd4a,_0x23cd3a);_0x1ffd4a[_0x4fbb('0x32')]=getAgentStatus(_0x1ffd4a);return _0x1ffd4a;});})[_0x4fbb('0x16')](function(_0x4204bd){var _0x9c6e03=sortAgentsByStatus(_0x4204bd,_0xedece0);return _[_0x4fbb('0x24')](_0x9c6e03,'id');})[_0x4fbb('0x1c')](function(_0x29a1ec){throw _0x29a1ec;});}exports[_0x4fbb('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5affec){var _0x129289={'fields':[],'order':null};var _0x3f560a=_0x5affec[_0x4fbb('0x34')](',');_0x129289[_0x4fbb('0x35')]=_[_0x4fbb('0xc')](_0x3f560a,function(_0x40bcca){if(!_0x40bcca['includes'](_0x4fbb('0x32'))){return!![];}_0x129289[_0x4fbb('0x36')]=_[_0x4fbb('0x37')](_0x40bcca,'-')?_0x4fbb('0x38'):_0x4fbb('0x39');return![];});return _0x129289;}exports[_0x4fbb('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0xda0afa){if(_0xda0afa['includes']('fullname')&&!_0xda0afa['includes'](_0x4fbb('0x3b'))){var _0x2d463e=_0xda0afa[_0x4fbb('0x3c')](0x0,_0xda0afa[_0x4fbb('0x3d')](_0x4fbb('0x30')));_0xda0afa+=','+_0x2d463e+'internal';}return _0xda0afa;}exports[_0x4fbb('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1dd666,_0x4a5cda){var _0x4720ab=_0x1dd666['sort'](function(_0x527e18,_0x504966){if(_0x527e18['globalStatus']===_0x504966[_0x4fbb('0x32')]){if(_0x527e18['globalStatus']===_0x4fbb('0x12')){if(_0x4a5cda===_0x4fbb('0x38')){return(_0x527e18['pauseType']||'')<(_0x504966[_0x4fbb('0x31')]||'')||_0x527e18[_0x4fbb('0x30')][_0x4fbb('0x3f')]()>_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?0x1:-0x1;}else{return(_0x527e18[_0x4fbb('0x31')]||'')<(_0x504966[_0x4fbb('0x31')]||'')||_0x527e18[_0x4fbb('0x30')][_0x4fbb('0x3f')]()>_0x504966[_0x4fbb('0x30')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x4a5cda===_0x4fbb('0x38')){return _0x527e18['fullname'][_0x4fbb('0x3f')]()<_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?0x1:-0x1;}else{return _0x527e18[_0x4fbb('0x30')]['toLowerCase']()<_0x504966[_0x4fbb('0x30')][_0x4fbb('0x3f')]()?-0x1:0x1;}}}else{if(_0x4a5cda==='DESC'){return _0x527e18[_0x4fbb('0x32')]<_0x504966[_0x4fbb('0x32')]?0x1:-0x1;}else{return _0x527e18[_0x4fbb('0x32')]<_0x504966[_0x4fbb('0x32')]?-0x1:0x1;}}});return _0x4720ab;}exports[_0x4fbb('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x23904e){var _0x467989=[_0x4fbb('0x41'),_0x4fbb('0x42'),_0x4fbb('0x43'),_0x4fbb('0x44'),_0x4fbb('0x31'),_0x4fbb('0x44'),_0x4fbb('0x3b'),_0x4fbb('0x45'),_0x4fbb('0x5'),_0x4fbb('0x8'),'mailPause',_0x4fbb('0x46'),_0x4fbb('0xa'),_0x4fbb('0x6'),_0x4fbb('0x9'),_0x4fbb('0x47'),_0x4fbb('0x48'),_0x4fbb('0x49'),_0x4fbb('0x4a'),_0x4fbb('0x4b'),_0x4fbb('0x4c'),_0x4fbb('0x4d'),_0x4fbb('0x4e'),_0x4fbb('0x4f'),_0x4fbb('0x50'),_0x4fbb('0x51'),_0x4fbb('0x52'),_0x4fbb('0x53'),_0x4fbb('0x54'),_0x4fbb('0x55'),_0x4fbb('0x13'),_0x4fbb('0x14'),_0x4fbb('0x56'),'voiceStatus',_0x4fbb('0x57'),_0x4fbb('0x58'),_0x4fbb('0x59'),'smsStatusTime',_0x4fbb('0x5a'),'faxStatusTime',_0x4fbb('0x5b'),_0x4fbb('0x5c'),_0x4fbb('0x5d'),'screenrecording',_0x4fbb('0x5e'),_0x4fbb('0x5f'),_0x4fbb('0x60')];var _0x11c1ed=['chatPause',_0x4fbb('0x8'),'mailPause',_0x4fbb('0x46'),_0x4fbb('0xa'),_0x4fbb('0x6'),_0x4fbb('0x9'),_0x4fbb('0x42')];var _0x5afb88=_(_0x23904e)['omit'](_0x11c1ed)[_0x4fbb('0x61')](_0x467989)[_0x4fbb('0x28')]();return _0x5afb88;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0xf672=['validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','ringing','isNil','voiceStatus','idle','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','merge','catch','getRealtimeAgents','*pause','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','busy','resolve','findAll','name','fullname','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0xf672,0xd6));var _0x2f67=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf672[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x2f67('0x0'));var jayson=require(_0x2f67('0x1'));var db=require(_0x2f67('0x2'))['db'];var amiClient=jayson[_0x2f67('0x3')][_0x2f67('0x4')]({'port':0x232a});var routingClient=jayson[_0x2f67('0x3')][_0x2f67('0x4')]({'port':0x232c});function isAgentPaused(_0x4fd143,_0x45e80e){var _0x323372=[_0x4fd143[_0x2f67('0x5')],_0x4fd143[_0x2f67('0x6')],_0x4fd143[_0x2f67('0x7')],_0x4fd143[_0x2f67('0x8')],_0x4fd143[_0x2f67('0x9')],_0x4fd143[_0x2f67('0xa')],_0x4fd143[_0x2f67('0xb')]];if(!_0x45e80e)return _[_0x2f67('0xc')](_0x323372);var _0x5ca8da=_[_0x2f67('0xd')](_0x323372);return _0x5ca8da['length']>0x0&&_0x5ca8da[_0x2f67('0xe')]<_0x323372[_0x2f67('0xe')]?!![]:![];}function isIdle(_0x55e03e){return _0x55e03e==='idle'||_0x55e03e===_0x2f67('0xf')||_0x55e03e==='unavailable'||_0x55e03e===_0x2f67('0x10')||_[_0x2f67('0x11')](_0x55e03e);}function isAgentIdle(_0x329195){if(_0x329195[_0x2f67('0x12')]!==_0x2f67('0x13')&&_0x329195['voicePause']){_0x329195['voiceStatus']=_0x2f67('0x14');return![];}return _[_0x2f67('0xc')]([_0x329195[_0x2f67('0x15')],_0x329195[_0x2f67('0x16')],_0x329195['mailStatus'],_0x329195[_0x2f67('0x17')],_0x329195[_0x2f67('0x18')],_0x329195[_0x2f67('0x12')],_0x329195[_0x2f67('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2f67('0x1a')](_0x2f67('0x1b'),{})[_0x2f67('0x1c')](function(_0x11f594){if(_0x11f594['error']){throw new Error(_0x2f67('0x1d'));}var _0x3483dd=_0x11f594[_0x2f67('0x1e')];return routingClient[_0x2f67('0x1a')](_0x2f67('0x1b'),{})['then'](function(_0x13ebda){if(_0x13ebda[_0x2f67('0x1f')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x451222=_0x13ebda[_0x2f67('0x1e')];return _[_0x2f67('0x20')]({},_0x3483dd,_0x451222);});})[_0x2f67('0x21')](function(_0x35c28a){throw _0x35c28a;});}exports[_0x2f67('0x22')]=getRealtimeAgents;function getAgentStatus(_0x4d02ce){var _0x1df6f7='unknown';if(isAgentPaused(_0x4d02ce))_0x1df6f7=_0x2f67('0x14');else if(isAgentPaused(_0x4d02ce,!![]))_0x1df6f7=_0x2f67('0x23');else if(isAgentIdle(_0x4d02ce))_0x1df6f7='idle';else _0x1df6f7='busy';return _0x1df6f7;}exports[_0x2f67('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0xff918b,_0x4285d7){var _0x5b1caf=_[_0x2f67('0x25')](_0xff918b)?_0xff918b:[_0xff918b];var _0x492277=_[_0x2f67('0x26')](_0x4285d7)+_0x2f67('0x27');var _0x599efa=_[_0x2f67('0x28')](_0x5b1caf,function(_0x4b0b05){return db[_0x492277]['findOne']({'where':{'id':_0x4b0b05}})[_0x2f67('0x1c')](function(_0x861f05){if(!_0x861f05)return[];return _0x861f05[_0x2f67('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x2f67('0x2a')](_0x599efa)[_0x2f67('0x1c')](function(_0x1d2a5b){var _0x37ff2d=_(_0x1d2a5b)[_0x2f67('0x2b')]()['map']('id')[_0x2f67('0x2c')]()[_0x2f67('0x2d')]();return _0x37ff2d;});}exports[_0x2f67('0x2e')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1434f0,_0x2c5525,_0x38665c){try{if(_0x2c5525[_0x2f67('0xe')]>0x0){_0x1434f0=_0x1434f0[_0x2f67('0xd')](function(_0x3e9df1){return _0x2c5525[_0x2f67('0x2f')](_0x3e9df1['id']);});}var _0x457c61=_0x1434f0['filter'](function(_0x33619a){var _0x3cd845=_0x2f67('0x30');if(isAgentIdle(_0x33619a)){_0x3cd845=_0x2f67('0x13');}return _0x3cd845===_0x38665c;});return _['map'](_0x457c61,'id');}catch(_0x4b466f){throw _0x4b466f;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b4928,_0x24b3e1,_0x126b13){return Promise[_0x2f67('0x31')]()[_0x2f67('0x1c')](function(){if(_0x24b3e1[_0x2f67('0xe')]>0x0){_0x2b4928=_0x2b4928['filter'](function(_0x1061fd){return _0x24b3e1['includes'](_0x1061fd['id']);});}return _0x2b4928;})[_0x2f67('0x1c')](function(){return db['User'][_0x2f67('0x32')]({'attributes':['id',_0x2f67('0x33'),_0x2f67('0x34'),_0x2f67('0x5'),_0x2f67('0x6'),_0x2f67('0x7'),_0x2f67('0x8'),_0x2f67('0x9'),_0x2f67('0xa'),_0x2f67('0xb'),_0x2f67('0x35')],'where':{'id':{'$in':_[_0x2f67('0x28')](_0x2b4928,'id')}},'raw':!![]});})[_0x2f67('0x1c')](function(_0x205302){return _0x205302[_0x2f67('0x28')](function(_0x24adc7){var _0x2cf732=_['find'](_0x2b4928,['id',_0x24adc7['id']]);var _0x35775a=filterAgentAttributes(_0x2cf732);_[_0x2f67('0x20')](_0x24adc7,_0x35775a);_0x24adc7[_0x2f67('0x36')]=getAgentStatus(_0x24adc7);return _0x24adc7;});})[_0x2f67('0x1c')](function(_0x589f96){var _0x566a85=sortAgentsByStatus(_0x589f96,_0x126b13);return _['map'](_0x566a85,'id');})[_0x2f67('0x21')](function(_0x147cdd){throw _0x147cdd;});}exports[_0x2f67('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x11a932){var _0x153650={'fields':[],'order':null};var _0x1fdffd=_0x11a932[_0x2f67('0x38')](',');_0x153650['fields']=_[_0x2f67('0xd')](_0x1fdffd,function(_0x62a56f){if(!_0x62a56f[_0x2f67('0x2f')]('globalStatus')){return!![];}_0x153650[_0x2f67('0x39')]=_[_0x2f67('0x3a')](_0x62a56f,'-')?_0x2f67('0x3b'):_0x2f67('0x3c');return![];});return _0x153650;}exports[_0x2f67('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x31be06){if(_0x31be06[_0x2f67('0x2f')](_0x2f67('0x34'))&&!_0x31be06['includes'](_0x2f67('0x3e'))){var _0x1e46c5=_0x31be06[_0x2f67('0x3f')](0x0,_0x31be06[_0x2f67('0x40')](_0x2f67('0x34')));_0x31be06+=','+_0x1e46c5+_0x2f67('0x3e');}return _0x31be06;}exports[_0x2f67('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x5b9e76,_0x385550){var _0xa08d33=_0x5b9e76['sort'](function(_0x3dc173,_0x56ec8e){if(_0x3dc173[_0x2f67('0x36')]===_0x56ec8e['globalStatus']){if(_0x3dc173[_0x2f67('0x36')]==='pause'){if(_0x385550===_0x2f67('0x3b')){return(_0x3dc173[_0x2f67('0x35')]||'')<(_0x56ec8e[_0x2f67('0x35')]||'')||_0x3dc173[_0x2f67('0x34')][_0x2f67('0x42')]()>_0x56ec8e[_0x2f67('0x34')][_0x2f67('0x42')]()?0x1:-0x1;}else{return(_0x3dc173[_0x2f67('0x35')]||'')<(_0x56ec8e[_0x2f67('0x35')]||'')||_0x3dc173[_0x2f67('0x34')][_0x2f67('0x42')]()>_0x56ec8e['fullname'][_0x2f67('0x42')]()?-0x1:0x1;}}else{if(_0x385550===_0x2f67('0x3b')){return _0x3dc173[_0x2f67('0x34')][_0x2f67('0x42')]()<_0x56ec8e['fullname'][_0x2f67('0x42')]()?0x1:-0x1;}else{return _0x3dc173[_0x2f67('0x34')]['toLowerCase']()<_0x56ec8e['fullname'][_0x2f67('0x42')]()?-0x1:0x1;}}}else{if(_0x385550===_0x2f67('0x3b')){return _0x3dc173[_0x2f67('0x36')]<_0x56ec8e[_0x2f67('0x36')]?0x1:-0x1;}else{return _0x3dc173[_0x2f67('0x36')]<_0x56ec8e[_0x2f67('0x36')]?-0x1:0x1;}}});return _0xa08d33;}exports[_0x2f67('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0xd53455){var _0x212cfb=[_0x2f67('0x44'),_0x2f67('0x45'),_0x2f67('0x46'),_0x2f67('0x47'),_0x2f67('0x35'),_0x2f67('0x47'),_0x2f67('0x3e'),_0x2f67('0x48'),'chatPause',_0x2f67('0x8'),_0x2f67('0x7'),'smsPause',_0x2f67('0xb'),'faxPause',_0x2f67('0xa'),_0x2f67('0x49'),_0x2f67('0x4a'),_0x2f67('0x4b'),'smsCapacity',_0x2f67('0x4c'),_0x2f67('0x4d'),_0x2f67('0x4e'),_0x2f67('0x4f'),_0x2f67('0x50'),_0x2f67('0x51'),_0x2f67('0x52'),'faxCurrentCapacity',_0x2f67('0x15'),_0x2f67('0x17'),_0x2f67('0x53'),'smsStatus',_0x2f67('0x19'),'faxStatus',_0x2f67('0x12'),'chatStatusTime',_0x2f67('0x54'),_0x2f67('0x55'),_0x2f67('0x56'),'whatsappStatusTime',_0x2f67('0x57'),'voiceStatusTime','queue',_0x2f67('0x58'),_0x2f67('0x59'),_0x2f67('0x5a'),'phoneBarEnableAutomaticScreenRecording',_0x2f67('0x5b')];var _0x59b823=[_0x2f67('0x5'),_0x2f67('0x8'),'mailPause','smsPause','whatsappPause',_0x2f67('0x6'),'voicePause',_0x2f67('0x45')];var _0x258cdb=_(_0xd53455)['omit'](_0x59b823)['pick'](_0x212cfb)[_0x2f67('0x2d')]();return _0x258cdb;}exports[_0x2f67('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 09404ca..ace536e 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 _0xc63d=['ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','get','waiting','talking','find','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc63d,0x18b));var _0xdc63=function(_0x1b89db,_0x305aa1){_0x1b89db=_0x1b89db-0x0;var _0x22649e=_0xc63d[_0x1b89db];return _0x22649e;};'use strict';var _=require(_0xdc63('0x0'));var jayson=require(_0xdc63('0x1'));var util=require(_0xdc63('0x2'));var amiClient=jayson[_0xdc63('0x3')][_0xdc63('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0xdc63('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdc63('0x5'),_0xdc63('0x6'),_0xdc63('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xdc63('0x8'),_0xdc63('0x9'),_0xdc63('0xa'),_0xdc63('0xb'),_0xdc63('0xc'),_0xdc63('0xd'),_0xdc63('0xe'),'talking',_0xdc63('0xf'),_0xdc63('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xdc63('0x11'),_0xdc63('0x12'),_0xdc63('0x13'),_0xdc63('0x14'),'dialActive',_0xdc63('0x15'),_0xdc63('0x16'),_0xdc63('0x17'),'startProgressive',_0xdc63('0x18'),_0xdc63('0x19'),_0xdc63('0x1a'),_0xdc63('0x1b'),_0xdc63('0x1c'),_0xdc63('0x1d'),_0xdc63('0x1e'),_0xdc63('0x1f'),_0xdc63('0x20'),_0xdc63('0x21'),_0xdc63('0x22'),_0xdc63('0x23'),_0xdc63('0x24'),_0xdc63('0x25')];function getRealtimeQueues(_0x461938,_0x27def8){var _0xbfdb2f=_0x27def8===_0xdc63('0x26')?amiClient:routingClient;return _0xbfdb2f['request'](_['startCase'](_0x27def8)+_0xdc63('0x27'),_0x461938)['then'](function(_0x2a5810){if(_0x2a5810['error'])throw new Error(util['format'](_0xdc63('0x28'),_0x27def8));return _0x2a5810[_0xdc63('0x29')];})[_0xdc63('0x2a')](function(_0x2f05b3){throw _0x2f05b3;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x93697e,_0x338575,_0x1996e3,_0x380b8c){var _0x1395ca=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1996e3===_0xdc63('0x26')){if(_0x380b8c===_0xdc63('0x2b')){_0x1395ca=_0x1395ca[_0xdc63('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x380b8c===_0xdc63('0x2d')){_0x1395ca=_0x1395ca[_0xdc63('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x93697e['map'](function(_0x2f5b87){var _0x150c24=_0x2f5b87[_0xdc63('0x2e')]({'plain':!![]});_0x150c24[_0xdc63('0x7')]=0x0;_0x150c24[_0xdc63('0xa')]=0x0;_0x150c24[_0xdc63('0x6')]=0x0;_0x150c24['available']=0x0;_0x150c24[_0xdc63('0x2f')]=0x0;if(_0x1996e3===_0xdc63('0x26')){_0x150c24[_0xdc63('0x30')]=0x0;_0x150c24['busy']=0x0;if(_0x380b8c===_0xdc63('0x2d')){_0x150c24['pTalking']=0x0;_0x150c24[_0xdc63('0x12')]=0x0;}}var _0x5812d1=_[_0xdc63('0x31')](_0x338575,['id',_0x150c24['id']]);if(_0x5812d1){_['merge'](_0x150c24,_['pick'](_0x5812d1,_0x1395ca));}return _0x150c24;});}exports[_0xdc63('0x32')]=initializeQueues; \ No newline at end of file +var _0xf78a=['invalid','loggedInDb','notInUse','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','find','merge','pick','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse'];(function(_0x1009bd,_0x4cc3e4){var _0x4eece4=function(_0x2667a7){while(--_0x2667a7){_0x1009bd['push'](_0x1009bd['shift']());}};_0x4eece4(++_0x4cc3e4);}(_0xf78a,0xf5));var _0xaf78=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0xf78a[_0x378891];return _0xfbfda2;};'use strict';var _=require(_0xaf78('0x0'));var jayson=require(_0xaf78('0x1'));var util=require(_0xaf78('0x2'));var amiClient=jayson[_0xaf78('0x3')][_0xaf78('0x4')]({'port':0x232a});var routingClient=jayson[_0xaf78('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xaf78('0x5'),'loggedIn',_0xaf78('0x6'),_0xaf78('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xaf78('0x8'),_0xaf78('0x9'),_0xaf78('0xa'),_0xaf78('0xb'),_0xaf78('0xc'),'onHold','ringing',_0xaf78('0xd'),_0xaf78('0xe'),'unavailable',_0xaf78('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xaf78('0x10'),_0xaf78('0x11'),_0xaf78('0x12'),_0xaf78('0x13'),_0xaf78('0x14'),'dialMethod',_0xaf78('0x15'),_0xaf78('0x16'),'startProgressive','erlangCalls',_0xaf78('0x17'),_0xaf78('0x18'),'erlangBusyFactor',_0xaf78('0x19'),_0xaf78('0x1a'),'dialPredictiveIntervalMinThreshold',_0xaf78('0x1b'),_0xaf78('0x1c'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xaf78('0x1d'),'predictiveIntervalAvgHoldtime',_0xaf78('0x1e')];function getRealtimeQueues(_0x3fb711,_0x14bf53){var _0x3492f0=_0x14bf53===_0xaf78('0x1f')?amiClient:routingClient;return _0x3492f0[_0xaf78('0x20')](_[_0xaf78('0x21')](_0x14bf53)+_0xaf78('0x22'),_0x3fb711)[_0xaf78('0x23')](function(_0x5f4708){if(_0x5f4708[_0xaf78('0x24')])throw new Error(util[_0xaf78('0x25')](_0xaf78('0x26'),_0x14bf53));return _0x5f4708[_0xaf78('0x27')];})[_0xaf78('0x28')](function(_0x13b985){throw _0x13b985;});}exports[_0xaf78('0x29')]=getRealtimeQueues;function initializeQueues(_0x17d16c,_0xcdf25d,_0xb23733,_0x24544d){var _0x240e41=DEFAULT_QUEUE_ATTRIBUTES;if(_0xb23733===_0xaf78('0x1f')){if(_0x24544d===_0xaf78('0x2a')){_0x240e41=_0x240e41[_0xaf78('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x24544d===_0xaf78('0x2c')){_0x240e41=_0x240e41['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x17d16c[_0xaf78('0x2d')](function(_0x4bc717){var _0x42bfbd=_0x4bc717[_0xaf78('0x2e')]({'plain':!![]});_0x42bfbd['paused']=0x0;_0x42bfbd['loggedInDb']=0x0;_0x42bfbd[_0xaf78('0x2f')]=0x0;_0x42bfbd[_0xaf78('0x5')]=0x0;_0x42bfbd[_0xaf78('0x7')]=0x0;if(_0xb23733==='voice'){_0x42bfbd[_0xaf78('0xe')]=0x0;_0x42bfbd[_0xaf78('0x8')]=0x0;if(_0x24544d===_0xaf78('0x2c')){_0x42bfbd['pTalking']=0x0;_0x42bfbd[_0xaf78('0x11')]=0x0;}}var _0x51702e=_[_0xaf78('0x30')](_0xcdf25d,['id',_0x42bfbd['id']]);if(_0x51702e){_[_0xaf78('0x31')](_0x42bfbd,_[_0xaf78('0x32')](_0x51702e,_0x240e41));}return _0x42bfbd;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ae84d67..fe416f1 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(_0x2a5864,_0x2b9396){var _0x490ab6=function(_0x3bcd16){while(--_0x3bcd16){_0x2a5864['push'](_0x2a5864['shift']());}};_0x490ab6(++_0x2b9396);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0310d1e..ae61bed 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 _0x9b82=['getFirstInterface','orderBy','cpus','map','model','createHash','md5','update','digest','getUuid','platform','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length','filter','family','internal','mac','address','127.0.0.1'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x9b82,0x150));var _0x29b8=function(_0x2232c6,_0x4030bf){_0x2232c6=_0x2232c6-0x0;var _0x4334f1=_0x9b82[_0x2232c6];return _0x4334f1;};'use strict';var _=require(_0x29b8('0x0'));var os=require('os');var crypto=require(_0x29b8('0x1'));var machine=require(_0x29b8('0x2'));var exec=require('child_process')[_0x29b8('0x3')];var config=require(_0x29b8('0x4'));function getInterfaces(){var _0xf3c718=[];var _0x13a3ba=os[_0x29b8('0x5')]();var _0x496974=_['orderBy'](_[_0x29b8('0x6')](_0x13a3ba));for(var _0xcaa2cf=0x0;_0xcaa2cf<_0x496974[_0x29b8('0x7')];_0xcaa2cf++){var _0x1f4d00=_0x13a3ba[_0x496974[_0xcaa2cf]][_0x29b8('0x8')](function(_0x133f89){return _0x133f89[_0x29b8('0x9')]==='IPv4'&&_0x133f89[_0x29b8('0xa')]===![];});_0xf3c718=_0xf3c718['concat'](_0x1f4d00);}return _0xf3c718;}function getFirstInterface(){var _0xa7529a=_['head'](getInterfaces());return{'macAddress':_0xa7529a&&_0xa7529a['mac']?_0xa7529a[_0x29b8('0xb')]:'00:00:00:00:00:00','ipAddress':_0xa7529a&&_0xa7529a[_0x29b8('0xc')]?_0xa7529a[_0x29b8('0xc')]:_0x29b8('0xd')};}exports[_0x29b8('0xe')]=getFirstInterface;function getCPUhash(){var _0x32a1b4=_[_0x29b8('0xf')](os[_0x29b8('0x10')]()[_0x29b8('0x11')](function(_0x522d69){return _0x522d69[_0x29b8('0x12')];}))['join'](':');return crypto[_0x29b8('0x13')](_0x29b8('0x14'))[_0x29b8('0x15')](_0x32a1b4)[_0x29b8('0x16')]('hex');}exports[_0x29b8('0x17')]=function(){var _0x58a87a=os[_0x29b8('0x18')]();var _0x5bded1=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5bded1[_0x29b8('0x19')](config['licenseToken'])){return config['licenseToken'];}else if(_0x58a87a===_0x29b8('0x1a')){return exec(_0x29b8('0x1b'),{'encoding':_0x29b8('0x1c')})[_0x29b8('0x1d')]('\x0d\x0a','');}else{var _0x50b99c=getFirstInterface();var _0x44b32d=getCPUhash();var _0x4e2323=_0x44b32d+'|'+os[_0x29b8('0x1e')]()+'|'+_0x50b99c[_0x29b8('0x1f')]+'|'+_0x50b99c[_0x29b8('0x20')];var _0x4da5cf=crypto[_0x29b8('0x13')](_0x29b8('0x14'))[_0x29b8('0x15')](_0x4e2323)[_0x29b8('0x16')](_0x29b8('0x21'));return _0x4da5cf[_0x29b8('0x22')](0x0,0x8)+'-'+_0x4da5cf[_0x29b8('0x22')](0x8,0xc)+'-'+_0x4da5cf[_0x29b8('0x22')](0xc,0x10)+'-'+_0x4da5cf[_0x29b8('0x22')](0x10,0x14)+'-'+_0x4da5cf['substring'](0x14);}}; \ No newline at end of file +var _0x026f=['keys','length','family','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','digest','hex','getUuid','licenseToken','test','win32','utf8','replace','hostname','macAddress','update','substring','lodash','crypto','child_process','../environment'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x026f,0x13c));var _0xf026=function(_0x176de3,_0x3a43eb){_0x176de3=_0x176de3-0x0;var _0x664286=_0x026f[_0x176de3];return _0x664286;};'use strict';var _=require(_0xf026('0x0'));var os=require('os');var crypto=require(_0xf026('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xf026('0x2'))['execSync'];var config=require(_0xf026('0x3'));function getInterfaces(){var _0x4c081f=[];var _0x10f211=os['networkInterfaces']();var _0x801ad0=_['orderBy'](_[_0xf026('0x4')](_0x10f211));for(var _0x2bee1a=0x0;_0x2bee1a<_0x801ad0[_0xf026('0x5')];_0x2bee1a++){var _0x1fa85f=_0x10f211[_0x801ad0[_0x2bee1a]]['filter'](function(_0x538953){return _0x538953[_0xf026('0x6')]===_0xf026('0x7')&&_0x538953[_0xf026('0x8')]===![];});_0x4c081f=_0x4c081f['concat'](_0x1fa85f);}return _0x4c081f;}function getFirstInterface(){var _0x27b7d8=_['head'](getInterfaces());return{'macAddress':_0x27b7d8&&_0x27b7d8[_0xf026('0x9')]?_0x27b7d8['mac']:_0xf026('0xa'),'ipAddress':_0x27b7d8&&_0x27b7d8[_0xf026('0xb')]?_0x27b7d8[_0xf026('0xb')]:_0xf026('0xc')};}exports[_0xf026('0xd')]=getFirstInterface;function getCPUhash(){var _0x4ea4c3=_[_0xf026('0xe')](os['cpus']()[_0xf026('0xf')](function(_0x34e853){return _0x34e853[_0xf026('0x10')];}))[_0xf026('0x11')](':');return crypto[_0xf026('0x12')](_0xf026('0x13'))['update'](_0x4ea4c3)[_0xf026('0x14')](_0xf026('0x15'));}exports[_0xf026('0x16')]=function(){var _0x18cd10=os['platform']();var _0x14cd77=/[0-9a-f-]{36}/;if(config[_0xf026('0x17')]&&_0x14cd77[_0xf026('0x18')](config['licenseToken'])){return config[_0xf026('0x17')];}else if(_0x18cd10===_0xf026('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf026('0x1a')})[_0xf026('0x1b')]('\x0d\x0a','');}else{var _0x4b780b=getFirstInterface();var _0x3af146=getCPUhash();var _0x1724c2=_0x3af146+'|'+os[_0xf026('0x1c')]()+'|'+_0x4b780b[_0xf026('0x1d')]+'|'+_0x4b780b['ipAddress'];var _0x225ae9=crypto['createHash']('md5')[_0xf026('0x1e')](_0x1724c2)[_0xf026('0x14')](_0xf026('0x15'));return _0x225ae9[_0xf026('0x1f')](0x0,0x8)+'-'+_0x225ae9[_0xf026('0x1f')](0x8,0xc)+'-'+_0x225ae9[_0xf026('0x1f')](0xc,0x10)+'-'+_0x225ae9[_0xf026('0x1f')](0x10,0x14)+'-'+_0x225ae9[_0xf026('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 8b421f3..b1d9163 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 _0x94a0=['findOrCreate','default','util','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data1','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','getUuid','License'];(function(_0x53ca64,_0x3a8013){var _0x26ba46=function(_0x5a8995){while(--_0x5a8995){_0x53ca64['push'](_0x53ca64['shift']());}};_0x26ba46(++_0x3a8013);}(_0x94a0,0x1c9));var _0x094a=function(_0x16eb6d,_0x5625cf){_0x16eb6d=_0x16eb6d-0x0;var _0x50614c=_0x94a0[_0x16eb6d];return _0x50614c;};'use strict';var util=require(_0x094a('0x0'));var moment=require(_0x094a('0x1'));var rp=require(_0x094a('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x094a('0x3'))(module,_0x094a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x094a('0x5'));var hardware=require(_0x094a('0x6'));var logger=require(_0x094a('0x7'))(_0x094a('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x10ae73){return new BPromise(function(_0x231744,_0x3ce722){var _0x43e0d9=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x10ae73,module['exports']['version']);if(oldToken){_0x43e0d9=util[_0x094a('0x9')](_0x094a('0xa'),HOST,_0x10ae73,module[_0x094a('0xb')][_0x094a('0x4')],oldToken);}var _0x289301={'uri':_0x43e0d9,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x289301)[_0x094a('0xc')](function(_0x37eb43){_0x231744(_0x37eb43);})[_0x094a('0xd')](function(_0x227e44){_0x3ce722(_0x227e44);});});}function manageLicense(_0x16cde4,_0x323064){var _0x516fc9=_0x323064[_0x094a('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x516fc9[_0x094a('0xf')]!==_0x16cde4&&!_0x516fc9['data2']){oldToken=_0x516fc9[_0x094a('0xf')];}httpRequest(_0x16cde4)['then'](function(_0xc67be6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xc67be6[_0x094a('0x10')]){isOldTokenSent=![];if(!_0x516fc9['license']&&_0x516fc9[_0x094a('0x8')]!=_0xc67be6['license']||_0x516fc9['license']&&_0x516fc9[_0x094a('0x11')]){logger['info'](_0x094a('0x12'));}if(_0x516fc9['license']&&!_0x516fc9[_0x094a('0x11')]&&_0x516fc9[_0x094a('0x8')]!=_0xc67be6[_0x094a('0x8')]){logger[_0x094a('0x13')](_0x094a('0x14'));}if(_0x516fc9[_0x094a('0x8')]&&!_0x516fc9[_0x094a('0x11')]&&_0x516fc9[_0x094a('0x8')]==_0xc67be6['license']){return _0x323064;}return _0x323064[_0x094a('0x15')]({'data1':_0x16cde4,'data2':null,'license':_0xc67be6[_0x094a('0x8')]});}else{if(_0xc67be6[_0x094a('0x8')]||_0x516fc9[_0x094a('0x8')]){if(!_0x516fc9[_0x094a('0x11')]){if(_0x516fc9[_0x094a('0xf')]==_0x16cde4){GRAY_PERIOD_REASON='Disabled';logger[_0x094a('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x094a('0x13')](_0x094a('0x16'),_0x516fc9[_0x094a('0xf')],_0x16cde4);}logger[_0x094a('0x13')](_0x094a('0x17'),GRAY_PERIOD_REASON[_0x094a('0x18')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x323064[_0x094a('0x15')]({'data2':encryptor[_0x094a('0x19')](moment()['format'](_0x094a('0x1a')))});}else{if(moment()[_0x094a('0x1b')](encryptor['decryptString'](_0x516fc9['data2']),_0x094a('0x1c'))>DAYS){logger[_0x094a('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x094a('0x9')](_0x094a('0x1a')));isOldTokenSent=![];return _0x323064[_0x094a('0x15')]({'data1':_0x16cde4,'data2':null,'license':null});}}}else{if(_0x516fc9[_0x094a('0xf')]!=_0x16cde4){logger[_0x094a('0x13')](_0x094a('0x16'),_0x516fc9[_0x094a('0xf')],_0x16cde4);return _0x323064['update']({'data1':_0x16cde4,'data2':null,'license':null});}}}return _0x323064;})[_0x094a('0xc')](function(_0x4f1718){_0x323064=_0x4f1718;})[_0x094a('0xd')](function(_0x12a245){logger[_0x094a('0x1d')](_0x12a245[_0x094a('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x094a('0x1f')](),_0x323064);},TIME);});}function defaultLicense(){var _0x3d16a1=hardware[_0x094a('0x1f')]();if(_0x3d16a1){return db[_0x094a('0x20')][_0x094a('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x3d16a1}})['spread'](function(_0x366006,_0x1b9b4a){logger[_0x094a('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3d16a1);manageLicense(_0x3d16a1,_0x366006);})[_0x094a('0xd')](function(_0x296316){logger['error'](_0x296316['message']);});}}exports[_0x094a('0x22')]=defaultLicense; \ No newline at end of file +var _0x3c40=['then','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0x448f93,_0x214cd4){var _0x5da717=function(_0x54cada){while(--_0x54cada){_0x448f93['push'](_0x448f93['shift']());}};_0x5da717(++_0x214cd4);}(_0x3c40,0x1a1));var _0x03c4=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x3c40[_0x3d7022];return _0x40870b;};'use strict';var util=require('util');var moment=require(_0x03c4('0x0'));var rp=require(_0x03c4('0x1'));var BPromise=require(_0x03c4('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x03c4('0x3'))['db'];var encryptor=require(_0x03c4('0x4'));var hardware=require(_0x03c4('0x5'));var logger=require(_0x03c4('0x6'))(_0x03c4('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x118efa){return new BPromise(function(_0x23b199,_0x597f06){var _0x491a2b=util[_0x03c4('0x8')](_0x03c4('0x9'),HOST,_0x118efa,module[_0x03c4('0xa')]['version']);if(oldToken){_0x491a2b=util['format'](_0x03c4('0xb'),HOST,_0x118efa,module['exports']['version'],oldToken);}var _0x4b6bcf={'uri':_0x491a2b,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4b6bcf)[_0x03c4('0xc')](function(_0x37489b){_0x23b199(_0x37489b);})['catch'](function(_0x1af5d1){_0x597f06(_0x1af5d1);});});}function manageLicense(_0x4f019d,_0x72de3c){var _0xf27757=_0x72de3c[_0x03c4('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0xf27757['data1']!==_0x4f019d&&!_0xf27757[_0x03c4('0xe')]){oldToken=_0xf27757[_0x03c4('0xf')];}httpRequest(_0x4f019d)[_0x03c4('0xc')](function(_0x344b7a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x344b7a[_0x03c4('0x10')]){isOldTokenSent=![];if(!_0xf27757[_0x03c4('0x7')]&&_0xf27757['license']!=_0x344b7a[_0x03c4('0x7')]||_0xf27757[_0x03c4('0x7')]&&_0xf27757['data2']){logger['info'](_0x03c4('0x11'));}if(_0xf27757[_0x03c4('0x7')]&&!_0xf27757[_0x03c4('0xe')]&&_0xf27757[_0x03c4('0x7')]!=_0x344b7a[_0x03c4('0x7')]){logger[_0x03c4('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xf27757[_0x03c4('0x7')]&&!_0xf27757[_0x03c4('0xe')]&&_0xf27757[_0x03c4('0x7')]==_0x344b7a[_0x03c4('0x7')]){return _0x72de3c;}return _0x72de3c['update']({'data1':_0x4f019d,'data2':null,'license':_0x344b7a[_0x03c4('0x7')]});}else{if(_0x344b7a[_0x03c4('0x7')]||_0xf27757[_0x03c4('0x7')]){if(!_0xf27757[_0x03c4('0xe')]){if(_0xf27757[_0x03c4('0xf')]==_0x4f019d){GRAY_PERIOD_REASON=_0x03c4('0x13');logger['info'](_0x03c4('0x14'));}else{GRAY_PERIOD_REASON=_0x03c4('0x15');logger[_0x03c4('0x12')](_0x03c4('0x16'),_0xf27757[_0x03c4('0xf')],_0x4f019d);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x03c4('0x17')](),moment()['format'](_0x03c4('0x18')));return _0x72de3c[_0x03c4('0x19')]({'data2':encryptor[_0x03c4('0x1a')](moment()['format'](_0x03c4('0x18')))});}else{if(moment()[_0x03c4('0x1b')](encryptor[_0x03c4('0x1c')](_0xf27757[_0x03c4('0xe')]),'days')>DAYS){logger[_0x03c4('0x12')](_0x03c4('0x1d'),moment()[_0x03c4('0x8')](_0x03c4('0x18')));isOldTokenSent=![];return _0x72de3c[_0x03c4('0x19')]({'data1':_0x4f019d,'data2':null,'license':null});}}}else{if(_0xf27757[_0x03c4('0xf')]!=_0x4f019d){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xf27757['data1'],_0x4f019d);return _0x72de3c[_0x03c4('0x19')]({'data1':_0x4f019d,'data2':null,'license':null});}}}return _0x72de3c;})[_0x03c4('0xc')](function(_0x59c183){_0x72de3c=_0x59c183;})[_0x03c4('0x1e')](function(_0x4be96d){logger[_0x03c4('0x1f')](_0x4be96d['message']);})[_0x03c4('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x03c4('0x21')](),_0x72de3c);},TIME);});}function defaultLicense(){var _0x5dd4a8=hardware[_0x03c4('0x21')]();if(_0x5dd4a8){return db['License'][_0x03c4('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x5dd4a8}})[_0x03c4('0x23')](function(_0x1f9a5b,_0x52d010){logger[_0x03c4('0x12')](_0x03c4('0x24'),_0x5dd4a8);manageLicense(_0x5dd4a8,_0x1f9a5b);})[_0x03c4('0x1e')](function(_0x5635e2){logger[_0x03c4('0x1f')](_0x5635e2[_0x03c4('0x25')]);});}}exports[_0x03c4('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bfd0c7a..a499e55 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 _0xe440=['add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline'];(function(_0x2d05d9,_0x5c5602){var _0x205e59=function(_0x5d7354){while(--_0x5d7354){_0x2d05d9['push'](_0x2d05d9['shift']());}};_0x205e59(++_0x5c5602);}(_0xe440,0x17d));var _0x0e44=function(_0x22b24e,_0x988c76){_0x22b24e=_0x22b24e-0x0;var _0x504ef5=_0xe440[_0x22b24e];return _0x504ef5;};'use strict';var util=require(_0x0e44('0x0'));var _=require(_0x0e44('0x1'));var moment=require(_0x0e44('0x2'));var BPromise=require('bluebird');var hardware=require(_0x0e44('0x3'));var encryptor=require(_0x0e44('0x4'));var db=require(_0x0e44('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0e44('0x7'),'machineUuid':hardware[_0x0e44('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e44('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0e44('0x9'),'machineUuid':hardware[_0x0e44('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26cfb9){return new BPromise(function(_0x80fb58,_0x2203f2){return db[_0x0e44('0xa')][_0x0e44('0xb')](_['defaults'](_0x26cfb9,{'raw':!![],'where':{'id':0x1}}))[_0x0e44('0xc')](function(_0x3aa9b1){return checkLicense(_0x3aa9b1,null);})[_0x0e44('0xc')](function(_0x5a5455){_0x80fb58(_0x5a5455);return;})['catch'](function(_0x45abb7){_0x2203f2(_0x45abb7);});});}function checkLicense(_0x5e44a5,_0xba3c01){if(!_0x5e44a5){demoLicense[_0x0e44('0xd')]=_0x5e44a5['data1'];return demoLicense;}try{var _0x5e9bd7=_0xba3c01||_0x5e44a5[_0x0e44('0xe')];if(_[_0x0e44('0xf')](_0x5e9bd7)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x538a2b=_0x5e44a5[_0x0e44('0x10')];var _0x1e9d9d=_0x5e44a5[_0x0e44('0x11')];var _0x4aa839=_0x538a2b[_0x0e44('0x12')]('-')[0x4];var _0x10e885=_0x538a2b[_0x0e44('0x12')]('-')[0x0];var _0x3ad5d3=encryptor[_0x0e44('0x13')](_0x5e9bd7,util[_0x0e44('0x14')](_0x0e44('0x15'),_0x4aa839,_0x538a2b,_0x10e885));var _0x3f57cf=JSON[_0x0e44('0x16')](_0x3ad5d3);_0x3f57cf[_0x0e44('0x17')]=![];_0x3f57cf[_0x0e44('0xd')]=_0x538a2b;_0x3f57cf[_0x0e44('0x18')]=hardware[_0x0e44('0x8')]();if(_0x1e9d9d){var _0xc288=encryptor['decryptString'](_0x1e9d9d);_0x3f57cf[_0x0e44('0x19')]=_0xc288;_0x3f57cf[_0x0e44('0x1a')]=moment(_0xc288)[_0x0e44('0x1b')](0x7,_0x0e44('0x1c'))['format']();_0x3f57cf[_0x0e44('0x1d')]=_0x3f57cf['uuid']!=_0x3f57cf[_0x0e44('0x18')]?_0x0e44('0x1e'):_0x0e44('0x1f');}return _0x3f57cf;}catch(_0x52893d){breakingLicense[_0x0e44('0xd')]=_0x5e44a5['data1'];breakingLicense[_0x0e44('0x20')]=_0x52893d[_0x0e44('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2eabfc,_0x4ff3e6){getLicense()[_0x0e44('0xc')](function(_0x33fb35){return db[_0x0e44('0x21')][_0x0e44('0x22')]({'attributes':[_0x0e44('0x23'),[db[_0x0e44('0x24')]['fn'](_0x0e44('0x25'),db[_0x0e44('0x24')][_0x0e44('0x26')](_0x0e44('0x23'))),_0x0e44('0x27')]],'group':_0x0e44('0x23'),'where':{'role':{'$or':[_0x0e44('0x28'),_0x0e44('0x29'),_0x0e44('0x2a')]}},'raw':!![]})[_0x0e44('0xc')](function(_0x3396c9){var _0xefcf17={'user':_0x33fb35[_0x0e44('0x2b')]||0x0,'telephone':_0x33fb35[_0x0e44('0x2c')]||0x0};_0x3396c9[_0x0e44('0x2d')](function(_0x54b8d1){var _0x3235a8=_0x54b8d1[_0x0e44('0x23')]===_0x0e44('0x28')?_0x0e44('0x29'):_0x54b8d1[_0x0e44('0x23')];_0xefcf17[_0x3235a8]-=_0x54b8d1['count'];if(_0xefcf17[_0x3235a8]<0x0)_0xefcf17[_0x3235a8]=0x0;});_0x2eabfc(_0xefcf17);return;});})[_0x0e44('0x2e')](function(_0x3bf7ca){_0x4ff3e6(_0x3bf7ca);});});}function checkUserLimits(_0x46d158){return new BPromise(function(_0xb0f1de,_0x52be55){getLimits()[_0x0e44('0xc')](function(_0xc89fe){var _0x2ba2f6=_[_0x0e44('0x2f')](_['countBy'](_0x46d158,_0x0e44('0x23')),[_0x0e44('0x28'),_0x0e44('0x29'),_0x0e44('0x2a')]);var _0x5eb645=(_0x2ba2f6[_0x0e44('0x28')]||0x0)+(_0x2ba2f6[_0x0e44('0x29')]||0x0);var _0x3887a9=_0x2ba2f6[_0x0e44('0x2a')]||0x0;if(_0x5eb645>_0xc89fe[_0x0e44('0x29')])return _0x52be55(_0x0e44('0x30'));if(_0x3887a9>_0xc89fe[_0x0e44('0x2a')])return _0x52be55(_0x0e44('0x31'));return _0xb0f1de();})['catch'](function(_0x3b2d71){_0x52be55(_0x3b2d71);});});}module[_0x0e44('0x32')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0db1=['find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','users','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License'];(function(_0x780f9b,_0x2c65cf){var _0x217e73=function(_0x3d2a02){while(--_0x3d2a02){_0x780f9b['push'](_0x780f9b['shift']());}};_0x217e73(++_0x2c65cf);}(_0x0db1,0xb6));var _0x10db=function(_0x416880,_0x90f852){_0x416880=_0x416880-0x0;var _0x2fe9a0=_0x0db1[_0x416880];return _0x2fe9a0;};'use strict';var util=require(_0x10db('0x0'));var _=require('lodash');var moment=require(_0x10db('0x1'));var BPromise=require(_0x10db('0x2'));var hardware=require(_0x10db('0x3'));var encryptor=require(_0x10db('0x4'));var db=require(_0x10db('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x10db('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x10db('0x7'),'machineUuid':hardware[_0x10db('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x436b1f){return new BPromise(function(_0x5352cf,_0x202ab2){return db[_0x10db('0x9')][_0x10db('0xa')](_[_0x10db('0xb')](_0x436b1f,{'raw':!![],'where':{'id':0x1}}))[_0x10db('0xc')](function(_0x3f0525){return checkLicense(_0x3f0525,null);})[_0x10db('0xc')](function(_0x2665e1){_0x5352cf(_0x2665e1);return;})[_0x10db('0xd')](function(_0xee709e){_0x202ab2(_0xee709e);});});}function checkLicense(_0x3dcd38,_0x568779){if(!_0x3dcd38){demoLicense[_0x10db('0xe')]=_0x3dcd38[_0x10db('0xf')];return demoLicense;}try{var _0x29f5bb=_0x568779||_0x3dcd38[_0x10db('0x10')];if(_[_0x10db('0x11')](_0x29f5bb)){throw new Error(_0x10db('0x12'));}var _0x4ce784=_0x3dcd38[_0x10db('0xf')];var _0x109979=_0x3dcd38[_0x10db('0x13')];var _0x4eba27=_0x4ce784[_0x10db('0x14')]('-')[0x4];var _0x22788e=_0x4ce784[_0x10db('0x14')]('-')[0x0];var _0x3e5b8d=encryptor[_0x10db('0x15')](_0x29f5bb,util[_0x10db('0x16')](_0x10db('0x17'),_0x4eba27,_0x4ce784,_0x22788e));var _0x3cfa67=JSON[_0x10db('0x18')](_0x3e5b8d);_0x3cfa67[_0x10db('0x19')]=![];_0x3cfa67[_0x10db('0xe')]=_0x4ce784;_0x3cfa67[_0x10db('0x1a')]=hardware[_0x10db('0x8')]();if(_0x109979){var _0x4791d8=encryptor[_0x10db('0x15')](_0x109979);_0x3cfa67[_0x10db('0x1b')]=_0x4791d8;_0x3cfa67[_0x10db('0x1c')]=moment(_0x4791d8)['add'](0x7,_0x10db('0x1d'))['format']();_0x3cfa67['grayReason']=_0x3cfa67['uuid']!=_0x3cfa67['machineUuid']?'changed':_0x10db('0x1e');}return _0x3cfa67;}catch(_0x208470){breakingLicense[_0x10db('0xe')]=_0x3dcd38['data1'];breakingLicense[_0x10db('0x1f')]=_0x208470['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x591997,_0x5b30c1){getLicense()[_0x10db('0xc')](function(_0x367e21){return db[_0x10db('0x20')][_0x10db('0x21')]({'attributes':[_0x10db('0x22'),[db[_0x10db('0x23')]['fn'](_0x10db('0x24'),db['sequelize'][_0x10db('0x25')]('role')),_0x10db('0x26')]],'group':_0x10db('0x22'),'where':{'role':{'$or':[_0x10db('0x27'),_0x10db('0x28'),'telephone']}},'raw':!![]})[_0x10db('0xc')](function(_0x3d3e17){var _0x5aa58a={'user':_0x367e21[_0x10db('0x29')]||0x0,'telephone':_0x367e21['telephones']||0x0};_0x3d3e17[_0x10db('0x2a')](function(_0x375c81){var _0x3db299=_0x375c81[_0x10db('0x22')]===_0x10db('0x27')?_0x10db('0x28'):_0x375c81[_0x10db('0x22')];_0x5aa58a[_0x3db299]-=_0x375c81[_0x10db('0x26')];if(_0x5aa58a[_0x3db299]<0x0)_0x5aa58a[_0x3db299]=0x0;});_0x591997(_0x5aa58a);return;});})['catch'](function(_0x2798a8){_0x5b30c1(_0x2798a8);});});}function checkUserLimits(_0x4446dd){return new BPromise(function(_0x5d9bfb,_0x4f73c2){getLimits()[_0x10db('0xc')](function(_0x5dba85){var _0x5a232f=_[_0x10db('0x2b')](_[_0x10db('0x2c')](_0x4446dd,_0x10db('0x22')),[_0x10db('0x27'),'user','telephone']);var _0x809f46=(_0x5a232f[_0x10db('0x27')]||0x0)+(_0x5a232f[_0x10db('0x28')]||0x0);var _0x1d9210=_0x5a232f[_0x10db('0x2d')]||0x0;if(_0x809f46>_0x5dba85[_0x10db('0x28')])return _0x4f73c2('License\x20limit\x20reached\x20for\x20users');if(_0x1d9210>_0x5dba85[_0x10db('0x2d')])return _0x4f73c2(_0x10db('0x2e'));return _0x5d9bfb();})[_0x10db('0xd')](function(_0x474a86){_0x4f73c2(_0x474a86);});});}module[_0x10db('0x2f')]={'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 1d538b9..81e0c54 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 _0x3266=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x390f0d,_0x19dd94){var _0x4c2060=function(_0x2c468a){while(--_0x2c468a){_0x390f0d['push'](_0x390f0d['shift']());}};_0x4c2060(++_0x19dd94);}(_0x3266,0x6a));var _0x6326=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x3266[_0x56ba92];return _0x8fe94d;};'use strict';module[_0x6326('0x0')]={'DOMAIN':_0x6326('0x1'),'SESSION_SECRET':_0x6326('0x2'),'GOOGLE_ID':_0x6326('0x3'),'GOOGLE_SECRET':_0x6326('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xe820=['exports','myappanuglar-secret'];(function(_0x3b3129,_0x2933ce){var _0x377bec=function(_0x4c0fd1){while(--_0x4c0fd1){_0x3b3129['push'](_0x3b3129['shift']());}};_0x377bec(++_0x2933ce);}(_0xe820,0xd2));var _0x0e82=function(_0xb667a9,_0x20bbf4){_0xb667a9=_0xb667a9-0x0;var _0x4186be=_0xe820[_0xb667a9];return _0x4186be;};'use strict';module[_0x0e82('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x0e82('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index bf2caf7..f3c3891 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d14=['fileLogger','exports','../utils/loggers'];(function(_0x2093ea,_0x5e2cba){var _0x244257=function(_0x435349){while(--_0x435349){_0x2093ea['push'](_0x2093ea['shift']());}};_0x244257(++_0x5e2cba);}(_0x8d14,0x1d3));var _0x48d1=function(_0x3a6171,_0x1985e3){_0x3a6171=_0x3a6171-0x0;var _0x215d6a=_0x8d14[_0x3a6171];return _0x215d6a;};'use strict';var fileLogger=require(_0x48d1('0x0'))[_0x48d1('0x1')];module[_0x48d1('0x2')]=fileLogger; \ No newline at end of file +var _0x1c7e=['exports','fileLogger'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1c7e,0xff));var _0xe1c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1c7e[_0x122ef9];return _0x42fba0;};'use strict';var fileLogger=require('../utils/loggers')[_0xe1c7('0x0')];module[_0xe1c7('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4d52249..8a3336f 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 _0x2bf5=['../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami'];(function(_0x304c48,_0x347cbe){var _0xb2528=function(_0x467b24){while(--_0x467b24){_0x304c48['push'](_0x304c48['shift']());}};_0xb2528(++_0x347cbe);}(_0x2bf5,0xb2));var _0x52bf=function(_0x42210b,_0xf05a86){_0x42210b=_0x42210b-0x0;var _0x31353b=_0x2bf5[_0x42210b];return _0x31353b;};'use strict';var path=require(_0x52bf('0x0'));var cfg=require(_0x52bf('0x1'));var env={'NODE_PATH':path[_0x52bf('0x2')](path[_0x52bf('0x3')](cfg[_0x52bf('0x4')],_0x52bf('0x5')))};var pm2config={'apps':[{'name':_0x52bf('0x6'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0x7')),'env':env},{'name':_0x52bf('0x8'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0x9')),'env':env},{'name':_0x52bf('0xa'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0xb')),'env':env},{'name':'email','script':path['join'](__dirname,_0x52bf('0xc')),'env':env},{'name':_0x52bf('0xd'),'script':path[_0x52bf('0x3')](__dirname,_0x52bf('0xe')),'env':env},{'name':_0x52bf('0xf'),'script':path[_0x52bf('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x52bf('0x10')]=pm2config; \ No newline at end of file +var _0x83cd=['../../services/xdr/index.js','exports','path','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr'];(function(_0x4914b7,_0x218896){var _0x47b6e6=function(_0x293b88){while(--_0x293b88){_0x4914b7['push'](_0x4914b7['shift']());}};_0x47b6e6(++_0x218896);}(_0x83cd,0xb2));var _0xd83c=function(_0x397385,_0x4c2766){_0x397385=_0x397385-0x0;var _0x1cccca=_0x83cd[_0x397385];return _0x1cccca;};'use strict';var path=require(_0xd83c('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xd83c('0x1')](path[_0xd83c('0x2')](cfg[_0xd83c('0x3')],_0xd83c('0x4')))};var pm2config={'apps':[{'name':_0xd83c('0x5'),'script':path[_0xd83c('0x2')](__dirname,_0xd83c('0x6')),'env':env},{'name':_0xd83c('0x7'),'script':path['join'](__dirname,_0xd83c('0x8')),'env':env},{'name':_0xd83c('0x9'),'script':path[_0xd83c('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xd83c('0xa'),'script':path[_0xd83c('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xd83c('0xb'),'script':path[_0xd83c('0x2')](__dirname,_0xd83c('0xc')),'env':env},{'name':_0xd83c('0xd'),'script':path[_0xd83c('0x2')](__dirname,_0xd83c('0xe')),'env':env}]};module[_0xd83c('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e6a599f..d435bd3 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 _0x9d98=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x1d71a6,_0x1ce1a0){var _0x3444f2=function(_0x317181){while(--_0x317181){_0x1d71a6['push'](_0x1d71a6['shift']());}};_0x3444f2(++_0x1ce1a0);}(_0x9d98,0x1ae));var _0x89d9=function(_0x301066,_0x349f8b){_0x301066=_0x301066-0x0;var _0x220ff1=_0x9d98[_0x301066];return _0x220ff1;};'use strict';var pm2=require(_0x89d9('0x0'));var BPromise=require(_0x89d9('0x1'));var config=require(_0x89d9('0x2'));function connect(){return new BPromise(function(_0x40828c,_0x9c2faa){return pm2[_0x89d9('0x3')](function(_0x4ec85b){if(_0x4ec85b){return _0x9c2faa(_0x4ec85b);}return _0x40828c(_0x89d9('0x4'));});});};exports[_0x89d9('0x5')]=function(_0x329502){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x22542c,_0x32ecd1){return pm2[_0x89d9('0x5')](_0x329502,function(_0x500a2f,_0x4275af){if(_0x500a2f){return _0x32ecd1(_0x500a2f);}pm2[_0x89d9('0x7')]();return _0x22542c(_0x4275af);});});});};exports[_0x89d9('0x8')]=function(_0x1e2abc){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x46b2cf,_0x53ab91){return pm2[_0x89d9('0x8')](_0x1e2abc,function(_0x55592d,_0x4b4bc4){if(_0x55592d){return _0x53ab91(_0x55592d);}pm2['disconnect']();return _0x46b2cf(_0x4b4bc4);});});});};exports[_0x89d9('0x9')]=function(_0x541f16){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x3e7f1b,_0xd48b0e){return pm2[_0x89d9('0x9')](_0x541f16,function(_0x50ddb9,_0x18a5bc){if(_0x50ddb9){return _0xd48b0e(_0x50ddb9);}pm2['disconnect']();return _0x3e7f1b(_0x18a5bc);});});});};exports[_0x89d9('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x104e09,_0x32dcee){return pm2[_0x89d9('0xa')](function(_0x576fa7,_0x2fa39f){if(_0x576fa7){return _0x32dcee(_0x576fa7);}pm2[_0x89d9('0x7')]();return _0x104e09(_0x2fa39f);});});});};exports['describe']=function(_0xcb9fa9){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x5124f4,_0x14e02d){return pm2[_0x89d9('0xb')](_0xcb9fa9,function(_0x5ad5ec,_0x40e0aa){if(_0x5ad5ec){return _0x14e02d(_0x5ad5ec);}pm2[_0x89d9('0x7')]();return _0x5124f4(_0x40e0aa);});});});};exports[_0x89d9('0xc')]=function(_0x4e1bd){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x37b235,_0x141427){return pm2['delete'](_0x4e1bd,function(_0x4c9cbf,_0x52e04d){if(_0x4c9cbf){return _0x141427(_0x4c9cbf);}pm2[_0x89d9('0x7')]();return _0x37b235(_0x52e04d);});});});};exports[_0x89d9('0xd')]=function(){return connect()[_0x89d9('0x6')](function(){return new BPromise(function(_0x300986,_0x49c74d){return pm2[_0x89d9('0xd')](function(_0x537aed){if(_0x537aed){return _0x49c74d(_0x537aed);}return _0x300986(_0x89d9('0xe'));});});});}; \ No newline at end of file +var _0x6233=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x6795f9,_0x3eb44c){var _0x3f224a=function(_0x10c3ee){while(--_0x10c3ee){_0x6795f9['push'](_0x6795f9['shift']());}};_0x3f224a(++_0x3eb44c);}(_0x6233,0x140));var _0x3623=function(_0x7f8cef,_0x567c50){_0x7f8cef=_0x7f8cef-0x0;var _0x3e2b64=_0x6233[_0x7f8cef];return _0x3e2b64;};'use strict';var pm2=require(_0x3623('0x0'));var BPromise=require(_0x3623('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x31fe59,_0x308d60){return pm2[_0x3623('0x2')](function(_0x474eba){if(_0x474eba){return _0x308d60(_0x474eba);}return _0x31fe59(_0x3623('0x3'));});});};exports[_0x3623('0x4')]=function(_0xb54c0a){return connect()[_0x3623('0x5')](function(){return new BPromise(function(_0x517a11,_0x4ba899){return pm2[_0x3623('0x4')](_0xb54c0a,function(_0x16bf65,_0x1926ce){if(_0x16bf65){return _0x4ba899(_0x16bf65);}pm2[_0x3623('0x6')]();return _0x517a11(_0x1926ce);});});});};exports[_0x3623('0x7')]=function(_0x55ee7b){return connect()['then'](function(){return new BPromise(function(_0x13aff9,_0x48a323){return pm2[_0x3623('0x7')](_0x55ee7b,function(_0x12c198,_0x37cd0d){if(_0x12c198){return _0x48a323(_0x12c198);}pm2[_0x3623('0x6')]();return _0x13aff9(_0x37cd0d);});});});};exports[_0x3623('0x8')]=function(_0x2f2998){return connect()[_0x3623('0x5')](function(){return new BPromise(function(_0x11409c,_0x505d0e){return pm2['restart'](_0x2f2998,function(_0x2d0a06,_0x2c355d){if(_0x2d0a06){return _0x505d0e(_0x2d0a06);}pm2[_0x3623('0x6')]();return _0x11409c(_0x2c355d);});});});};exports[_0x3623('0x9')]=function(){return connect()[_0x3623('0x5')](function(){return new BPromise(function(_0x5cb461,_0x347a2a){return pm2[_0x3623('0x9')](function(_0x395561,_0x2e17a1){if(_0x395561){return _0x347a2a(_0x395561);}pm2[_0x3623('0x6')]();return _0x5cb461(_0x2e17a1);});});});};exports[_0x3623('0xa')]=function(_0x5c3cd4){return connect()[_0x3623('0x5')](function(){return new BPromise(function(_0x41d813,_0x3de245){return pm2['describe'](_0x5c3cd4,function(_0x146955,_0x26dc6a){if(_0x146955){return _0x3de245(_0x146955);}pm2[_0x3623('0x6')]();return _0x41d813(_0x26dc6a);});});});};exports['delete']=function(_0x1e5277){return connect()[_0x3623('0x5')](function(){return new BPromise(function(_0x3c45e9,_0x5ba328){return pm2[_0x3623('0xb')](_0x1e5277,function(_0x3fe205,_0x2db50f){if(_0x3fe205){return _0x5ba328(_0x3fe205);}pm2[_0x3623('0x6')]();return _0x3c45e9(_0x2db50f);});});});};exports[_0x3623('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x490ca4,_0x32770e){return pm2['dump'](function(_0x219dd6){if(_0x219dd6){return _0x32770e(_0x219dd6);}return _0x490ca4(_0x3623('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a5c5ec0..735fd57 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 _0x80a4=['join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:'];(function(_0x310b90,_0x5bb38c){var _0x3726ee=function(_0x4f60e4){while(--_0x4f60e4){_0x310b90['push'](_0x310b90['shift']());}};_0x3726ee(++_0x5bb38c);}(_0x80a4,0x165));var _0x480a=function(_0x35dadd,_0x3ed50f){_0x35dadd=_0x35dadd-0x0;var _0x2728ed=_0x80a4[_0x35dadd];return _0x2728ed;};'use strict';var _=require('lodash');var moment=require(_0x480a('0x0'));var Redis=require(_0x480a('0x1'));var util=require(_0x480a('0x2'));var config=require(_0x480a('0x3'));var db=require(_0x480a('0x4'))['db'];var logger=require(_0x480a('0x5'))(_0x480a('0x6'));config[_0x480a('0x7')]=_[_0x480a('0x8')](config[_0x480a('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x383c2a=0x0;var _0x32ba74=[];return db[_0x480a('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x2f5a47){_0x383c2a=_0x2f5a47[_0x480a('0xa')];if(_0x383c2a){return db[_0x480a('0xb')][_0x480a('0xc')]({'raw':!![],'attributes':['id',_0x480a('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x480a('0xe')](_0x2f5a47[_0x480a('0xa')],_0x480a('0xf'))}}});}else{return[];}})[_0x480a('0x10')](function(_0x37512a){if(_0x37512a&&_0x37512a[_0x480a('0x11')]){_0x32ba74=_['map'](_0x37512a||[],'id');logger[_0x480a('0x12')](_0x480a('0x13'),_0x32ba74[_0x480a('0x14')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x480a('0x15'),'closed':!![],'closedAt':moment()[_0x480a('0x16')](_0x480a('0x17'))},{'where':{'id':_0x32ba74}});}})[_0x480a('0x10')](function(){if(_0x32ba74&&_0x32ba74[_0x480a('0x11')]){logger[_0x480a('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x32ba74[_0x480a('0x14')]());for(var _0x33173c=0x0;_0x33173c<_0x32ba74[_0x480a('0x11')];_0x33173c++){io[_0x480a('0x18')]('chatInteraction:update',{'id':_0x32ba74[_0x33173c],'closed':!![]});}}})['catch'](function(_0x27a101){logger[_0x480a('0x19')](_0x480a('0x1a'),_0x27a101?util[_0x480a('0x1b')](_0x27a101,{'showHidden':![],'depth':null}):'');});}exports[_0x480a('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5bdc=['inspect','start','lodash','ioredis','util','../../config/environment','../logger','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bdc,0x110));var _0xc5bd=function(_0x5411b1,_0x194f33){_0x5411b1=_0x5411b1-0x0;var _0x3eb531=_0x5bdc[_0x5411b1];return _0x3eb531;};'use strict';var _=require(_0xc5bd('0x0'));var moment=require('moment');var Redis=require(_0xc5bd('0x1'));var util=require(_0xc5bd('0x2'));var config=require(_0xc5bd('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc5bd('0x4'))('schedule');config[_0xc5bd('0x5')]=_[_0xc5bd('0x6')](config[_0xc5bd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc5bd('0x7'))(new Redis(config[_0xc5bd('0x5')]));function closeInteractions(){var _0x7b1fd4=0x0;var _0x14fb87=[];return db[_0xc5bd('0x8')][_0xc5bd('0x9')]({'raw':!![],'attributes':['id',_0xc5bd('0xa')],'where':{'id':0x1}})[_0xc5bd('0xb')](function(_0x526869){_0x7b1fd4=_0x526869[_0xc5bd('0xa')];if(_0x7b1fd4){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xc5bd('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x526869[_0xc5bd('0xa')],_0xc5bd('0xd'))}}});}else{return[];}})['then'](function(_0x3c5919){if(_0x3c5919&&_0x3c5919[_0xc5bd('0xe')]){_0x14fb87=_[_0xc5bd('0xf')](_0x3c5919||[],'id');logger[_0xc5bd('0x10')](_0xc5bd('0x11'),_0x14fb87[_0xc5bd('0x12')]());return db[_0xc5bd('0x13')][_0xc5bd('0x14')]({'closeReason':_0xc5bd('0x15'),'disposition':_0xc5bd('0x16'),'closed':!![],'closedAt':moment()[_0xc5bd('0x17')](_0xc5bd('0x18'))},{'where':{'id':_0x14fb87}});}})['then'](function(){if(_0x14fb87&&_0x14fb87[_0xc5bd('0xe')]){logger['info'](_0xc5bd('0x19'),_0x14fb87[_0xc5bd('0x12')]());for(var _0x454eeb=0x0;_0x454eeb<_0x14fb87[_0xc5bd('0xe')];_0x454eeb++){io['emit']('chatInteraction:update',{'id':_0x14fb87[_0x454eeb],'closed':!![]});}}})[_0xc5bd('0x1a')](function(_0x4ea7d7){logger[_0xc5bd('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4ea7d7?util[_0xc5bd('0x1c')](_0x4ea7d7,{'showHidden':![],'depth':null}):'');});}exports[_0xc5bd('0x1d')]=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 fed10b0..86265e6 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 _0xdce4=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x55a1da,_0x8aa038){var _0x55c4bf=function(_0x45c8a7){while(--_0x45c8a7){_0x55a1da['push'](_0x55a1da['shift']());}};_0x55c4bf(++_0x8aa038);}(_0xdce4,0xae));var _0x4dce=function(_0x29110d,_0x54bd86){_0x29110d=_0x29110d-0x0;var _0xb4fcd6=_0xdce4[_0x29110d];return _0xb4fcd6;};'use strict';function start(){var _0x2b70b0=require(_0x4dce('0x0'));return _0x2b70b0['startAllRefreshIntervals']();}module[_0x4dce('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0bfd=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x171873,_0x546a05){var _0x2c090d=function(_0x462ec2){while(--_0x462ec2){_0x171873['push'](_0x171873['shift']());}};_0x2c090d(++_0x546a05);}(_0x0bfd,0xbb));var _0xd0bf=function(_0x4e5d34,_0x5607fa){_0x4e5d34=_0x4e5d34-0x0;var _0x4411fa=_0x0bfd[_0x4e5d34];return _0x4411fa;};'use strict';function start(){var _0x326511=require(_0xd0bf('0x0'));return _0x326511[_0xd0bf('0x1')]();}module[_0xd0bf('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 e63a80f..9410d54 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 _0xd95f=['start','add\x20cron','stop\x20cron','endAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','../../files/reports','%s.%s','savename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','error\x20mail','catch','error','data','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x5e8b8e,_0x1616f2){var _0x3e7b88=function(_0x5b1282){while(--_0x5b1282){_0x5e8b8e['push'](_0x5e8b8e['shift']());}};_0x3e7b88(++_0x1616f2);}(_0xd95f,0x1a6));var _0xfd95=function(_0x12f48a,_0x6ad7b4){_0x12f48a=_0x12f48a-0x0;var _0x1196d9=_0xd95f[_0x12f48a];return _0x1196d9;};'use strict';var fs=require('fs');var util=require(_0xfd95('0x0'));var path=require(_0xfd95('0x1'));var _=require(_0xfd95('0x2'));var moment=require(_0xfd95('0x3'));var CronJobManager=require(_0xfd95('0x4'));var jayson=require(_0xfd95('0x5'));var BPromise=require(_0xfd95('0x6'));var logger=require('../logger')(_0xfd95('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xfd95('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xfd95('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x579104,_0x53ae32){return function(){logger[_0xfd95('0xa')](_0xfd95('0xb'),_0x579104[_0xfd95('0xc')]);var _0x2c7815=!![];var _0x23027c=_0x579104[_0xfd95('0xd')][_0xfd95('0xe')]();var _0x20f474={'account':_0x23027c,'message':{'from':util['format'](_0xfd95('0xf'),_0x579104[_0xfd95('0xd')]['name'],_0x579104[_0xfd95('0xd')][_0xfd95('0xc')]||_0x579104[_0xfd95('0xd')][_0xfd95('0x10')][_0xfd95('0x11')]),'to':_0x579104[_0xfd95('0xc')],'cc':_0x579104['cc'],'bcc':_0x579104[_0xfd95('0x12')],'subject':util[_0xfd95('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x53ae32['name'],_0x579104['subtractNumber'],_0x579104['subtractUnit'])}};var _0x159c74=path['join'](__dirname,_0xfd95('0x14'));var _0x336c43=_0x53ae32['savename'];var _0x1ebb32=util[_0xfd95('0x13')](_0xfd95('0x15'),path['basename'](_0x53ae32[_0xfd95('0x16')],path[_0xfd95('0x17')](_0x53ae32[_0xfd95('0x16')])),_0xfd95('0x18'));var _0x1cf36e=path['join'](_0x159c74,_0x336c43);var _0x13ea2c=path[_0xfd95('0x19')](_0x159c74,_0x1ebb32);if(fs[_0xfd95('0x1a')](_0x1cf36e)){_0x53ae32[_0xfd95('0x1b')]=_0xfd95('0x1c');_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1e')]=[{'filename':_0x336c43,'path':_0x1cf36e}];_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1f')]=util[_0xfd95('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xfd95('0x20')](_0x53ae32,null,0x2));}else if(fs[_0xfd95('0x1a')](_0x13ea2c)){_0x53ae32['status']=_0xfd95('0x1c');_0x20f474[_0xfd95('0x1d')]['attachments']=[{'filename':_0x1ebb32,'path':_0x13ea2c}];}else{_0x20f474[_0xfd95('0x1d')][_0xfd95('0x1f')]=_0xfd95('0x21');if(!_0x579104[_0xfd95('0x22')]){_0x2c7815=![];logger[_0xfd95('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2c7815){return client['request'](_0xfd95('0x23'),_0x20f474)['then'](function(_0x4aafdc){if(_0x4aafdc['error']){return logger['error'](_0xfd95('0x24'),JSON[_0xfd95('0x20')](_0x4aafdc));}return logger[_0xfd95('0xa')]('email\x20sent');})[_0xfd95('0x25')](function(_0x4fc3d9){return logger['error'](_0xfd95('0x24'),JSON[_0xfd95('0x20')](_0x4fc3d9));});}};}function handleError(){return function(_0x5ed471){return logger[_0xfd95('0x26')](JSON[_0xfd95('0x20')](_0x5ed471));};}function handleResult(_0x22a379){return function(_0x2fa9a5){logger[_0xfd95('0xa')](_0xfd95('0x27'),JSON[_0xfd95('0x20')](_0x2fa9a5));if(_0x22a379[_0xfd95('0xd')]&&_0x22a379[_0xfd95('0xd')][_0xfd95('0x10')]&&!_[_0xfd95('0x28')](_0x22a379[_0xfd95('0xc')])){setTimeout(handleSendEmail(_0x22a379,_0x2fa9a5),0x3c*0x3e8);}};}function handleJob(_0x42d466){return function(){try{if(_['isNil'](_0x42d466[_0xfd95('0x29')])){return logger[_0xfd95('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xfd95('0x28')](_0x42d466[_0xfd95('0x2a')])){return logger[_0xfd95('0xa')](_0xfd95('0x2b'));}var _0x1d0751={'startDate':moment()[_0xfd95('0x2c')](_0x42d466[_0xfd95('0x29')],_0x42d466['subtractUnit'])[_0xfd95('0x13')](_0xfd95('0x2d')),'endDate':moment()['format'](_0xfd95('0x2d')),'type':_0xfd95('0x2e'),'output':_0x42d466[_0xfd95('0x2f')],'name':_0x42d466[_0xfd95('0x30')]};if(!_['isNil'](_0x42d466[_0xfd95('0x31')])){logger[_0xfd95('0xa')](_0xfd95('0x32'),_0x42d466[_0xfd95('0x31')]);return analyticDefaultReportController[_0xfd95('0x33')]({'id':_0x42d466['DefaultReportId']},_0x1d0751)['then'](handleResult(_0x42d466))[_0xfd95('0x25')](handleError());}if(!_[_0xfd95('0x28')](_0x42d466['CustomReportId'])){logger[_0xfd95('0xa')](_0xfd95('0x34'),_0x42d466['CustomReportId']);return analyticCustomReportController[_0xfd95('0x33')]({'id':_0x42d466['CustomReportId']},_0x1d0751)[_0xfd95('0x35')](handleResult(_0x42d466))['catch'](handleError());}}catch(_0x5c9b72){logger[_0xfd95('0x26')](JSON[_0xfd95('0x20')](_0x5c9b72));}return logger[_0xfd95('0xa')](_0xfd95('0x36'));};}function getJobs(_0x572fcc){var _0x178ea8={};if(_0x572fcc){_0x178ea8['id']=_0x572fcc;}return db['Schedule'][_0xfd95('0x37')]({'where':_0x178ea8,'include':[{'model':db[_0xfd95('0xd')],'attributes':['id','name',_0xfd95('0xc')],'include':[{'model':db[_0xfd95('0x38')],'as':_0xfd95('0x10'),'include':[{'model':db[_0xfd95('0x39')],'as':_0xfd95('0x39')}]}]}]})[_0xfd95('0x35')](function(_0x3d31c5){var _0x59ad7e=_[_0xfd95('0x3a')](manager[_0xfd95('0x3b')]);var _0x24248e=_['map'](_0x3d31c5,function(_0x151b49){return _0x151b49['id']['toString']();});var _0x4442f5=_[_0xfd95('0x3c')](_0x3d31c5,function(_0x33e292){return _0x33e292['id'][_0xfd95('0x3d')]();});var _0x4731c9=_0x572fcc?_0x24248e:_[_0xfd95('0x3e')](_0x24248e,_0x59ad7e);var _0x1c64bd=_[_0xfd95('0x3f')](_0x24248e,_0x59ad7e);var _0x526aba=_['difference'](_0x59ad7e,_0x24248e);var _0x3ede04;var _0x12fac5;for(_0x3ede04=0x0;_0x3ede04<_0x526aba[_0xfd95('0x40')]&&!_0x572fcc;_0x3ede04+=0x1){_0x12fac5=_0x526aba[_0x3ede04][_0xfd95('0x3d')]();if(manager['exists'](_0x12fac5)){manager[_0xfd95('0x41')](_0x12fac5);manager[_0xfd95('0x42')](_0x12fac5);logger['info'](_0xfd95('0x43'),_0x12fac5);}}logger[_0xfd95('0xa')](_0xfd95('0x44'),JSON['stringify'](_0x4731c9));for(_0x3ede04=0x0;_0x3ede04<_0x4731c9[_0xfd95('0x40')];_0x3ede04+=0x1){_0x12fac5=_0x4731c9[_0x3ede04][_0xfd95('0x3d')]();logger[_0xfd95('0xa')]('index',_0x12fac5);if(_0x572fcc){logger[_0xfd95('0xa')](_0xfd95('0x45'),_0x572fcc);logger[_0xfd95('0xa')](JSON[_0xfd95('0x20')](_0x4442f5[_0x12fac5]));BPromise[_0xfd95('0x46')]()[_0xfd95('0x35')](handleJob(_0x4442f5[_0x12fac5]));logger[_0xfd95('0xa')](_0xfd95('0x47'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}else if(_0x4442f5[_0x12fac5][_0xfd95('0x48')]&&_0x4442f5[_0x12fac5][_0xfd95('0x49')]&&moment()[_0xfd95('0x4a')](_0x4442f5[_0x12fac5][_0xfd95('0x4b')],_0x4442f5[_0x12fac5]['endAt'])){manager['add'](_0x12fac5,_0x4442f5[_0x12fac5][_0xfd95('0x48')],handleJob(_0x4442f5[_0x12fac5]));manager[_0xfd95('0x4c')](_0x12fac5);logger[_0xfd95('0xa')](_0xfd95('0x4d'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}else if(manager['exists'](_0x12fac5)){manager['stop'](_0x12fac5);manager[_0xfd95('0x42')](_0x12fac5);logger[_0xfd95('0xa')](_0xfd95('0x4e'),_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}}for(_0x3ede04=0x0,_0x12fac5;_0x3ede04<_0x1c64bd[_0xfd95('0x40')]&&!_0x572fcc;_0x3ede04+=0x1){_0x12fac5=_0x1c64bd[_0x3ede04][_0xfd95('0x3d')]();if(manager['exists'](_0x12fac5)){if(_0x4442f5[_0x12fac5][_0xfd95('0x48')]&&_0x4442f5[_0x12fac5]['active']&&moment()[_0xfd95('0x4a')](_0x4442f5[_0x12fac5]['startAt'],_0x4442f5[_0x12fac5][_0xfd95('0x4f')])){manager[_0xfd95('0x50')](_0x12fac5,_0x4442f5[_0x12fac5]['cron'],handleJob(_0x4442f5[_0x12fac5]));logger['info'](_0xfd95('0x51'),_0x4442f5[_0x12fac5]['name'],_0x4442f5[_0x12fac5]['cron']);}else{manager['stop'](_0x12fac5);manager['deleteJob'](_0x12fac5);logger[_0xfd95('0xa')]('stop\x20cron',_0x4442f5[_0x12fac5][_0xfd95('0x30')],_0x4442f5[_0x12fac5][_0xfd95('0x48')]);}}}})[_0xfd95('0x25')](function(_0x3066e6){logger[_0xfd95('0x26')](JSON['stringify'](_0x3066e6));});}exports[_0xfd95('0x52')]=function(_0x4948b4){return getJobs(_0x4948b4);};exports[_0xfd95('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8c38=['CloudProvider','keys','jobs','keyBy','toString','difference','intersection','exists','stop','delete\x20cron','length','my\x20id','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','deleteJob','stop\x20cron','update','update\x20cron','run','start','util','lodash','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','zip','join','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x8c38,0x17a));var _0x88c3=function(_0x33e1e6,_0x5e64dd){_0x33e1e6=_0x33e1e6-0x0;var _0x232701=_0x8c38[_0x33e1e6];return _0x232701;};'use strict';var fs=require('fs');var util=require(_0x88c3('0x0'));var path=require('path');var _=require(_0x88c3('0x1'));var moment=require('moment');var CronJobManager=require(_0x88c3('0x2'));var jayson=require(_0x88c3('0x3'));var BPromise=require(_0x88c3('0x4'));var logger=require('../logger')(_0x88c3('0x5'));var db=require(_0x88c3('0x6'))['db'];var analyticCustomReportController=require(_0x88c3('0x7'));var analyticDefaultReportController=require(_0x88c3('0x8'));var client=jayson[_0x88c3('0x9')][_0x88c3('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xc2426e,_0x56c9ec){return function(){logger[_0x88c3('0xb')](_0x88c3('0xc'),_0xc2426e[_0x88c3('0xd')]);var _0x1f4868=!![];var _0x85d64f=_0xc2426e[_0x88c3('0xe')]['getSmtpOptions']();var _0x382d64={'account':_0x85d64f,'message':{'from':util[_0x88c3('0xf')](_0x88c3('0x10'),_0xc2426e[_0x88c3('0xe')][_0x88c3('0x11')],_0xc2426e[_0x88c3('0xe')][_0x88c3('0xd')]||_0xc2426e[_0x88c3('0xe')]['Smtp'][_0x88c3('0x12')]),'to':_0xc2426e['email'],'cc':_0xc2426e['cc'],'bcc':_0xc2426e[_0x88c3('0x13')],'subject':util[_0x88c3('0xf')](_0x88c3('0x14'),_0x56c9ec[_0x88c3('0x11')],_0xc2426e['subtractNumber'],_0xc2426e[_0x88c3('0x15')])}};var _0x18f694=path['join'](__dirname,_0x88c3('0x16'));var _0x394447=_0x56c9ec[_0x88c3('0x17')];var _0x4d115e=util[_0x88c3('0xf')](_0x88c3('0x18'),path['basename'](_0x56c9ec['savename'],path['extname'](_0x56c9ec['savename'])),_0x88c3('0x19'));var _0x5b955d=path[_0x88c3('0x1a')](_0x18f694,_0x394447);var _0x471fd7=path[_0x88c3('0x1a')](_0x18f694,_0x4d115e);if(fs[_0x88c3('0x1b')](_0x5b955d)){_0x56c9ec[_0x88c3('0x1c')]=_0x88c3('0x1d');_0x382d64['message'][_0x88c3('0x1e')]=[{'filename':_0x394447,'path':_0x5b955d}];_0x382d64[_0x88c3('0x1f')][_0x88c3('0x20')]=util[_0x88c3('0xf')](_0x88c3('0x21'),JSON[_0x88c3('0x22')](_0x56c9ec,null,0x2));}else if(fs[_0x88c3('0x1b')](_0x471fd7)){_0x56c9ec[_0x88c3('0x1c')]=_0x88c3('0x1d');_0x382d64['message'][_0x88c3('0x1e')]=[{'filename':_0x4d115e,'path':_0x471fd7}];}else{_0x382d64[_0x88c3('0x1f')]['text']=_0x88c3('0x23');if(!_0xc2426e[_0x88c3('0x24')]){_0x1f4868=![];logger[_0x88c3('0xb')](_0x88c3('0x25'));}}if(_0x1f4868){return client[_0x88c3('0x26')](_0x88c3('0x27'),_0x382d64)[_0x88c3('0x28')](function(_0x38bb37){if(_0x38bb37['error']){return logger[_0x88c3('0x29')](_0x88c3('0x2a'),JSON['stringify'](_0x38bb37));}return logger['info'](_0x88c3('0x2b'));})[_0x88c3('0x2c')](function(_0x2aad41){return logger[_0x88c3('0x29')](_0x88c3('0x2a'),JSON['stringify'](_0x2aad41));});}};}function handleError(){return function(_0x11fb54){return logger['error'](JSON[_0x88c3('0x22')](_0x11fb54));};}function handleResult(_0x57f57b){return function(_0x3fce26){logger[_0x88c3('0xb')](_0x88c3('0x2d'),JSON['stringify'](_0x3fce26));if(_0x57f57b[_0x88c3('0xe')]&&_0x57f57b[_0x88c3('0xe')][_0x88c3('0x2e')]&&!_[_0x88c3('0x2f')](_0x57f57b[_0x88c3('0xd')])){setTimeout(handleSendEmail(_0x57f57b,_0x3fce26),0x3c*0x3e8);}};}function handleJob(_0x1e1806){return function(){try{if(_[_0x88c3('0x2f')](_0x1e1806[_0x88c3('0x30')])){return logger[_0x88c3('0xb')](_0x88c3('0x31'));}if(_[_0x88c3('0x2f')](_0x1e1806['subtractUnit'])){return logger[_0x88c3('0xb')](_0x88c3('0x32'));}var _0x41b77c={'startDate':moment()[_0x88c3('0x33')](_0x1e1806[_0x88c3('0x30')],_0x1e1806[_0x88c3('0x15')])[_0x88c3('0xf')](_0x88c3('0x34')),'endDate':moment()[_0x88c3('0xf')](_0x88c3('0x34')),'type':'scheduled','output':_0x1e1806[_0x88c3('0x35')],'name':_0x1e1806[_0x88c3('0x11')]};if(!_['isNil'](_0x1e1806[_0x88c3('0x36')])){logger[_0x88c3('0xb')](_0x88c3('0x37'),_0x1e1806[_0x88c3('0x36')]);return analyticDefaultReportController[_0x88c3('0x38')]({'id':_0x1e1806[_0x88c3('0x36')]},_0x41b77c)[_0x88c3('0x28')](handleResult(_0x1e1806))[_0x88c3('0x2c')](handleError());}if(!_['isNil'](_0x1e1806[_0x88c3('0x39')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x1e1806['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x1e1806['CustomReportId']},_0x41b77c)[_0x88c3('0x28')](handleResult(_0x1e1806))[_0x88c3('0x2c')](handleError());}}catch(_0xa58103){logger[_0x88c3('0x29')](JSON[_0x88c3('0x22')](_0xa58103));}return logger[_0x88c3('0xb')](_0x88c3('0x3a'));};}function getJobs(_0x50532f){var _0x786acf={};if(_0x50532f){_0x786acf['id']=_0x50532f;}return db[_0x88c3('0x3b')][_0x88c3('0x3c')]({'where':_0x786acf,'include':[{'model':db[_0x88c3('0xe')],'attributes':['id',_0x88c3('0x11'),_0x88c3('0xd')],'include':[{'model':db[_0x88c3('0x3d')],'as':'Smtp','include':[{'model':db[_0x88c3('0x3e')],'as':_0x88c3('0x3e')}]}]}]})[_0x88c3('0x28')](function(_0x300010){var _0x3e1c83=_[_0x88c3('0x3f')](manager[_0x88c3('0x40')]);var _0x3f93d4=_['map'](_0x300010,function(_0x385818){return _0x385818['id']['toString']();});var _0x3f9124=_[_0x88c3('0x41')](_0x300010,function(_0x4a622f){return _0x4a622f['id'][_0x88c3('0x42')]();});var _0x26f4bf=_0x50532f?_0x3f93d4:_[_0x88c3('0x43')](_0x3f93d4,_0x3e1c83);var _0x443212=_[_0x88c3('0x44')](_0x3f93d4,_0x3e1c83);var _0x27c188=_[_0x88c3('0x43')](_0x3e1c83,_0x3f93d4);var _0x5b2fe1;var _0xfa07cc;for(_0x5b2fe1=0x0;_0x5b2fe1<_0x27c188['length']&&!_0x50532f;_0x5b2fe1+=0x1){_0xfa07cc=_0x27c188[_0x5b2fe1][_0x88c3('0x42')]();if(manager[_0x88c3('0x45')](_0xfa07cc)){manager[_0x88c3('0x46')](_0xfa07cc);manager['deleteJob'](_0xfa07cc);logger['info'](_0x88c3('0x47'),_0xfa07cc);}}logger[_0x88c3('0xb')]('toRun',JSON['stringify'](_0x26f4bf));for(_0x5b2fe1=0x0;_0x5b2fe1<_0x26f4bf[_0x88c3('0x48')];_0x5b2fe1+=0x1){_0xfa07cc=_0x26f4bf[_0x5b2fe1][_0x88c3('0x42')]();logger[_0x88c3('0xb')]('index',_0xfa07cc);if(_0x50532f){logger[_0x88c3('0xb')](_0x88c3('0x49'),_0x50532f);logger['info'](JSON[_0x88c3('0x22')](_0x3f9124[_0xfa07cc]));BPromise['resolve']()['then'](handleJob(_0x3f9124[_0xfa07cc]));logger[_0x88c3('0xb')](_0x88c3('0x4a'),_0x3f9124[_0xfa07cc][_0x88c3('0x11')],_0x3f9124[_0xfa07cc]['cron']);}else if(_0x3f9124[_0xfa07cc]['cron']&&_0x3f9124[_0xfa07cc][_0x88c3('0x4b')]&&moment()[_0x88c3('0x4c')](_0x3f9124[_0xfa07cc][_0x88c3('0x4d')],_0x3f9124[_0xfa07cc][_0x88c3('0x4e')])){manager[_0x88c3('0x4f')](_0xfa07cc,_0x3f9124[_0xfa07cc][_0x88c3('0x50')],handleJob(_0x3f9124[_0xfa07cc]));manager['start'](_0xfa07cc);logger[_0x88c3('0xb')](_0x88c3('0x51'),_0x3f9124[_0xfa07cc][_0x88c3('0x11')],_0x3f9124[_0xfa07cc]['cron']);}else if(manager[_0x88c3('0x45')](_0xfa07cc)){manager[_0x88c3('0x46')](_0xfa07cc);manager[_0x88c3('0x52')](_0xfa07cc);logger[_0x88c3('0xb')](_0x88c3('0x53'),_0x3f9124[_0xfa07cc]['name'],_0x3f9124[_0xfa07cc][_0x88c3('0x50')]);}}for(_0x5b2fe1=0x0,_0xfa07cc;_0x5b2fe1<_0x443212[_0x88c3('0x48')]&&!_0x50532f;_0x5b2fe1+=0x1){_0xfa07cc=_0x443212[_0x5b2fe1][_0x88c3('0x42')]();if(manager[_0x88c3('0x45')](_0xfa07cc)){if(_0x3f9124[_0xfa07cc][_0x88c3('0x50')]&&_0x3f9124[_0xfa07cc][_0x88c3('0x4b')]&&moment()[_0x88c3('0x4c')](_0x3f9124[_0xfa07cc][_0x88c3('0x4d')],_0x3f9124[_0xfa07cc][_0x88c3('0x4e')])){manager[_0x88c3('0x54')](_0xfa07cc,_0x3f9124[_0xfa07cc][_0x88c3('0x50')],handleJob(_0x3f9124[_0xfa07cc]));logger[_0x88c3('0xb')](_0x88c3('0x55'),_0x3f9124[_0xfa07cc][_0x88c3('0x11')],_0x3f9124[_0xfa07cc][_0x88c3('0x50')]);}else{manager[_0x88c3('0x46')](_0xfa07cc);manager[_0x88c3('0x52')](_0xfa07cc);logger[_0x88c3('0xb')]('stop\x20cron',_0x3f9124[_0xfa07cc][_0x88c3('0x11')],_0x3f9124[_0xfa07cc][_0x88c3('0x50')]);}}}})[_0x88c3('0x2c')](function(_0x2051e1){logger[_0x88c3('0x29')](JSON['stringify'](_0x2051e1));});}exports[_0x88c3('0x56')]=function(_0x444146){return getJobs(_0x444146);};exports[_0x88c3('0x57')]=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 3a50a14..8c781fd 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 _0x0f42=['No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','name','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','SentimentScore','Mixed','FAILED','FailureReason','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Neutral','catch','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x2ae3e5,_0x299328){var _0x32e028=function(_0x19265b){while(--_0x19265b){_0x2ae3e5['push'](_0x2ae3e5['shift']());}};_0x32e028(++_0x299328);}(_0x0f42,0x126));var _0x20f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0f42[_0x21a9d9];return _0x46adce;};var _=require(_0x20f4('0x0'));var AWS=require(_0x20f4('0x1'));var rp=require(_0x20f4('0x2'));var util=require(_0x20f4('0x3'));var BPromise=require('bluebird');var db=require(_0x20f4('0x4'))['db'];var logger=require('../../config/logger')(_0x20f4('0x5'));function getTranscriptionJob(_0x4a2add,_0x1b1f1a,_0x30ee00,_0x42d4d9){return new Promise(function(_0x4c3214,_0x435359){var _0x1519fe=new AWS['TranscribeService']({'accessKeyId':_0x1b1f1a,'secretAccessKey':_0x4a2add,'region':_0x30ee00});_0x1519fe[_0x20f4('0x6')]({'TranscriptionJobName':_0x42d4d9},function(_0x553d5d,_0x4a452d){if(_0x553d5d){return _0x435359(_0x553d5d);}else{return _0x4c3214(_0x4a452d);}});});}function sentiment(_0x4a9fd1,_0x1f42a2,_0x4f3d95,_0x41c1bb,_0x30f2ef){return new Promise(function(_0x395fda,_0x1ee8c6){var _0x51ab58=new AWS[(_0x20f4('0x7'))]({'accessKeyId':_0x1f42a2,'secretAccessKey':_0x4a9fd1,'region':_0x4f3d95});_0x51ab58['detectSentiment']({'Text':_0x41c1bb,'LanguageCode':_0x30f2ef[_0x20f4('0x8')](0x0,0x2)},function(_0x3002b3,_0x2fce02){if(_0x3002b3){return _0x1ee8c6(_0x3002b3);}else{return _0x395fda(_0x2fce02);}});});}function checkTranscribeJob(_0x35be6e,_0x4b893b,_0x1135e7){var _0x122f9e;return new BPromise(function(_0x166e79,_0x45fb73){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0xb'),_0x35be6e['id'],_0x35be6e[_0x20f4('0xc')]));return getTranscriptionJob(_0x1135e7[_0x20f4('0xd')],_0x1135e7[_0x20f4('0xe')],_0x4b893b[_0x20f4('0xf')],_0x35be6e['transcribeName'])['then'](function(_0x29ef31){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x10'),_0x35be6e['id'],_0x35be6e[_0x20f4('0xc')],_0x29ef31['TranscriptionJob'][_0x20f4('0x11')]));if(!_0x35be6e[_0x20f4('0x12')]){switch(_0x29ef31[_0x20f4('0x13')]['TranscriptionJobStatus']){case _0x20f4('0x14'):var _0xd8de3b={'transcribeStatus':_0x29ef31[_0x20f4('0x13')]['TranscriptionJobStatus'],'fileUri':_0x29ef31['TranscriptionJob'][_0x20f4('0x15')]['TranscriptFileUri']};logger['info'](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x35be6e['id']));return rp({'uri':_0x29ef31[_0x20f4('0x13')][_0x20f4('0x15')][_0x20f4('0x16')],'json':!![]})[_0x20f4('0x17')](function(_0x214bf2){logger[_0x20f4('0x9')](util['format'](_0x20f4('0x18'),_0x35be6e['id']));if(_0x214bf2&&_0x214bf2[_0x20f4('0x19')]&&_0x214bf2[_0x20f4('0x19')][_0x20f4('0x1a')]&&_0x214bf2[_0x20f4('0x19')]['transcripts']['length']){_0xd8de3b[_0x20f4('0x12')]='';for(var _0x328bb8=0x0;_0x328bb8<_0x214bf2['results'][_0x20f4('0x1a')][_0x20f4('0x1b')];_0x328bb8++){_0xd8de3b['fileText']+=_0x214bf2[_0x20f4('0x19')][_0x20f4('0x1a')][_0x328bb8]['transcript']+'';}}return _0x35be6e[_0x20f4('0x1c')](_0xd8de3b);})[_0x20f4('0x17')](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));if(!_0x35be6e[_0x20f4('0x1e')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x21'));}if(!_0x4b893b[_0x20f4('0x22')]||!_0x4b893b[_0x20f4('0x23')]||!_0x4b893b[_0x20f4('0x24')]||!_0x4b893b[_0x20f4('0x25')]||!_0x4b893b[_0x20f4('0x26')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x27'));}if(!_0xd8de3b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4b893b['sentimentAccountId']===_0x1135e7['id']){return _0x1135e7;}else{return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_settings[_0x20f4('0x23')]}});}})['then'](function(_0x5d95f3){if(!_0x5d95f3){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2a'));}if(!_0x5d95f3[_0x20f4('0xd')]||!_0x5d95f3['data2']){throw new db[(_0x20f4('0x1f'))]['ValidationError'](_0x20f4('0x2b'));}_0x122f9e=_0x5d95f3;logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x2c'),_0x35be6e['id']));return sentiment(_0x122f9e[_0x20f4('0xd')],_0x122f9e[_0x20f4('0xe')],_0x4b893b[_0x20f4('0x24')],_0xd8de3b[_0x20f4('0x12')],_0x4b893b[_0x20f4('0x25')]);})['then'](function(_0x176e21){logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35be6e['id']));return _0x35be6e['update']({'sentiment':_0x176e21[_0x20f4('0x2d')],'sPositive':_0x176e21['SentimentScore']['Positive'],'sNegative':_0x176e21['SentimentScore'][_0x20f4('0x2e')],'sMixed':_0x176e21[_0x20f4('0x2f')][_0x20f4('0x30')],'sNeutral':_0x176e21[_0x20f4('0x2f')]['Neutral']});})['then'](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));_0x166e79();});case'FAILED':return _0x35be6e[_0x20f4('0x1c')]({'transcribeStatus':_0x20f4('0x31'),'failureReason':_0x29ef31[_0x20f4('0x13')][_0x20f4('0x32')]})[_0x20f4('0x17')](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x1d'),_0x35be6e['id']));_0x166e79();});default:logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x35be6e['id']));break;}}else{return BPromise[_0x20f4('0x33')]()[_0x20f4('0x17')](function(){if(!_0x35be6e[_0x20f4('0x1e')]){throw new db[(_0x20f4('0x1f'))]['ValidationError'](_0x20f4('0x21'));}if(!_0x4b893b[_0x20f4('0x22')]||!_0x4b893b['sentimentAccountId']||!_0x4b893b[_0x20f4('0x24')]||!_0x4b893b[_0x20f4('0x25')]||!_0x4b893b[_0x20f4('0x26')]){throw new db['Sequelize'][(_0x20f4('0x20'))](_0x20f4('0x27'));}if(!_0x35be6e[_0x20f4('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x4b893b[_0x20f4('0x23')]===_0x1135e7['id']){return _0x1135e7;}else{return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_settings[_0x20f4('0x23')]}});}})[_0x20f4('0x17')](function(_0x4bee91){if(!_0x4bee91){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2a'));}if(!_0x4bee91['data1']||!_0x4bee91[_0x20f4('0xe')]){throw new db['Sequelize'][(_0x20f4('0x20'))](_0x20f4('0x2b'));}_0x122f9e=_0x4bee91;logger['info'](util['format'](_0x20f4('0x2c'),_0x35be6e['id']));return sentiment(_0x122f9e['data1'],_0x122f9e[_0x20f4('0xe')],_0x4b893b[_0x20f4('0x24')],_0x35be6e[_0x20f4('0x12')],_0x4b893b[_0x20f4('0x25')]);})['then'](function(_0x1fc9c5){logger[_0x20f4('0x9')](util[_0x20f4('0xa')](_0x20f4('0x34'),_0x35be6e['id']));return _0x35be6e[_0x20f4('0x1c')]({'sentiment':_0x1fc9c5[_0x20f4('0x2d')],'sPositive':_0x1fc9c5['SentimentScore'][_0x20f4('0x35')],'sNegative':_0x1fc9c5[_0x20f4('0x2f')]['Negative'],'sMixed':_0x1fc9c5[_0x20f4('0x2f')]['Mixed'],'sNeutral':_0x1fc9c5[_0x20f4('0x2f')][_0x20f4('0x36')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x20f4('0x9')](util[_0x20f4('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35be6e['id']));_0x166e79();});}})[_0x20f4('0x37')](function(_0x568584){if(_0x568584){if(!_0x568584['name']||_0x568584['name']!=='SequelizeValidationError'){logger[_0x20f4('0x38')](util[_0x20f4('0xa')](_0x20f4('0x39'),_0x35be6e['id']),util[_0x20f4('0x3a')](_0x568584,{'showHidden':![],'depth':null}));}}_0x166e79();});});}function checkTranscribe(){var _0xc49c10;var _0x1e3f2c;var _0x3838db;return db[_0x20f4('0x3b')][_0x20f4('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x20f4('0x17')](function(_0x20f1ad){if(!_0x20f1ad||!_0x20f1ad[_0x20f4('0x1b')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x3d'));}_0xc49c10=_0x20f1ad;return db[_0x20f4('0x3e')][_0x20f4('0x29')]({'where':{'id':0x1}});})[_0x20f4('0x17')](function(_0x408d68){if(!_0x408d68){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x3f'));}_0x1e3f2c=_0x408d68;if(!_0x1e3f2c[_0x20f4('0x5')]||!_0x1e3f2c['transcribeAccountId']||!_0x1e3f2c['transcribeRegion']||!_0x1e3f2c[_0x20f4('0x25')]||!_0x1e3f2c[_0x20f4('0x26')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x40'));}return db[_0x20f4('0x28')][_0x20f4('0x29')]({'where':{'id':_0x1e3f2c[_0x20f4('0x41')]}});})['then'](function(_0x375460){if(!_0x375460){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x375460['data1']||!_0x375460[_0x20f4('0xe')]){throw new db[(_0x20f4('0x1f'))][(_0x20f4('0x20'))](_0x20f4('0x2b'));}_0x3838db=_0x375460;var _0x20b38b=[];_0xc49c10[_0x20f4('0x42')](function(_0x2ad2aa){_0x20b38b['push'](checkTranscribeJob(_0x2ad2aa,_0x1e3f2c,_0x3838db));});return BPromise[_0x20f4('0x43')](_0x20b38b);})['catch'](function(_0x13df74){if(_0x13df74){if(!_0x13df74['name']||_0x13df74[_0x20f4('0x44')]!==_0x20f4('0x45')){logger[_0x20f4('0x38')](util[_0x20f4('0x3a')](_0x13df74,{'showHidden':![],'depth':null}));}}});}exports[_0x20f4('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x19cb=['transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','update','Sentiment','SentimentScore','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Mixed','Neutral','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','error','aws-sdk','request-promise','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','info','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts'];(function(_0x7cb3c9,_0x4465af){var _0x349c59=function(_0x45d91c){while(--_0x45d91c){_0x7cb3c9['push'](_0x7cb3c9['shift']());}};_0x349c59(++_0x4465af);}(_0x19cb,0x146));var _0xb19c=function(_0x42fb7e,_0x146642){_0x42fb7e=_0x42fb7e-0x0;var _0x13acd6=_0x19cb[_0x42fb7e];return _0x13acd6;};var _=require('lodash');var AWS=require(_0xb19c('0x0'));var rp=require(_0xb19c('0x1'));var util=require('util');var BPromise=require(_0xb19c('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb19c('0x3'))('transcribe');function getTranscriptionJob(_0x503187,_0x56d20c,_0x15e820,_0x110587){return new Promise(function(_0x5a145d,_0x551f8d){var _0x2d6a30=new AWS[(_0xb19c('0x4'))]({'accessKeyId':_0x56d20c,'secretAccessKey':_0x503187,'region':_0x15e820});_0x2d6a30[_0xb19c('0x5')]({'TranscriptionJobName':_0x110587},function(_0x262354,_0x5d50d4){if(_0x262354){return _0x551f8d(_0x262354);}else{return _0x5a145d(_0x5d50d4);}});});}function sentiment(_0x553479,_0x1ee1da,_0x3ffb45,_0x27bfa8,_0x12d1ce){return new Promise(function(_0x3b5682,_0x4de417){var _0x14d90d=new AWS[(_0xb19c('0x6'))]({'accessKeyId':_0x1ee1da,'secretAccessKey':_0x553479,'region':_0x3ffb45});_0x14d90d[_0xb19c('0x7')]({'Text':_0x27bfa8,'LanguageCode':_0x12d1ce[_0xb19c('0x8')](0x0,0x2)},function(_0x436857,_0x258e00){if(_0x436857){return _0x4de417(_0x436857);}else{return _0x3b5682(_0x258e00);}});});}function checkTranscribeJob(_0x516592,_0x506538,_0x58e545){var _0x46bfc2;return new BPromise(function(_0x361bbe,_0x4330b5){logger['info'](util[_0xb19c('0x9')](_0xb19c('0xa'),_0x516592['id'],_0x516592[_0xb19c('0xb')]));return getTranscriptionJob(_0x58e545['data1'],_0x58e545[_0xb19c('0xc')],_0x506538['transcribeRegion'],_0x516592[_0xb19c('0xb')])[_0xb19c('0xd')](function(_0x2d239c){logger[_0xb19c('0xe')](util[_0xb19c('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x516592['id'],_0x516592[_0xb19c('0xb')],_0x2d239c[_0xb19c('0xf')][_0xb19c('0x10')]));if(!_0x516592[_0xb19c('0x11')]){switch(_0x2d239c[_0xb19c('0xf')]['TranscriptionJobStatus']){case'COMPLETED':var _0x2197cc={'transcribeStatus':_0x2d239c[_0xb19c('0xf')]['TranscriptionJobStatus'],'fileUri':_0x2d239c['TranscriptionJob'][_0xb19c('0x12')][_0xb19c('0x13')]};logger[_0xb19c('0xe')](util[_0xb19c('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x516592['id']));return rp({'uri':_0x2d239c[_0xb19c('0xf')][_0xb19c('0x12')][_0xb19c('0x13')],'json':!![]})['then'](function(_0x250604){logger[_0xb19c('0xe')](util[_0xb19c('0x9')](_0xb19c('0x14'),_0x516592['id']));if(_0x250604&&_0x250604[_0xb19c('0x15')]&&_0x250604['results']['transcripts']&&_0x250604[_0xb19c('0x15')]['transcripts'][_0xb19c('0x16')]){_0x2197cc['fileText']='';for(var _0xdc2623=0x0;_0xdc2623<_0x250604[_0xb19c('0x15')][_0xb19c('0x17')][_0xb19c('0x16')];_0xdc2623++){_0x2197cc[_0xb19c('0x11')]+=_0x250604[_0xb19c('0x15')][_0xb19c('0x17')][_0xdc2623][_0xb19c('0x18')]+'';}}return _0x516592['update'](_0x2197cc);})[_0xb19c('0xd')](function(){logger[_0xb19c('0xe')](util[_0xb19c('0x9')](_0xb19c('0x19'),_0x516592['id']));if(!_0x516592['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xb19c('0x1a'));}if(!_0x506538[_0xb19c('0x1b')]||!_0x506538[_0xb19c('0x1c')]||!_0x506538[_0xb19c('0x1d')]||!_0x506538[_0xb19c('0x1e')]||!_0x506538['bucket']){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))](_0xb19c('0x21'));}if(!_0x2197cc[_0xb19c('0x11')]){throw new Error(_0xb19c('0x22'));}if(_0x506538[_0xb19c('0x1c')]===_0x58e545['id']){return _0x58e545;}else{return db[_0xb19c('0x23')]['findOne']({'where':{'id':_settings[_0xb19c('0x1c')]}});}})[_0xb19c('0xd')](function(_0x4df9f4){if(!_0x4df9f4){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))](_0xb19c('0x24'));}if(!_0x4df9f4[_0xb19c('0x25')]||!_0x4df9f4[_0xb19c('0xc')]){throw new db['Sequelize']['ValidationError'](_0xb19c('0x26'));}_0x46bfc2=_0x4df9f4;logger[_0xb19c('0xe')](util[_0xb19c('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x516592['id']));return sentiment(_0x46bfc2[_0xb19c('0x25')],_0x46bfc2[_0xb19c('0xc')],_0x506538[_0xb19c('0x1d')],_0x2197cc[_0xb19c('0x11')],_0x506538[_0xb19c('0x1e')]);})[_0xb19c('0xd')](function(_0x6524a0){logger[_0xb19c('0xe')](util[_0xb19c('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x516592['id']));return _0x516592[_0xb19c('0x27')]({'sentiment':_0x6524a0[_0xb19c('0x28')],'sPositive':_0x6524a0['SentimentScore']['Positive'],'sNegative':_0x6524a0[_0xb19c('0x29')][_0xb19c('0x2a')],'sMixed':_0x6524a0[_0xb19c('0x29')]['Mixed'],'sNeutral':_0x6524a0[_0xb19c('0x29')]['Neutral']});})[_0xb19c('0xd')](function(){logger['info'](util[_0xb19c('0x9')](_0xb19c('0x19'),_0x516592['id']));_0x361bbe();});case _0xb19c('0x2b'):return _0x516592[_0xb19c('0x27')]({'transcribeStatus':_0xb19c('0x2b'),'failureReason':_0x2d239c[_0xb19c('0xf')][_0xb19c('0x2c')]})[_0xb19c('0xd')](function(){logger[_0xb19c('0xe')](util[_0xb19c('0x9')](_0xb19c('0x19'),_0x516592['id']));_0x361bbe();});default:logger['info'](util[_0xb19c('0x9')](_0xb19c('0x2d'),_0x516592['id']));break;}}else{return BPromise[_0xb19c('0x2e')]()[_0xb19c('0xd')](function(){if(!_0x516592[_0xb19c('0x2f')]){throw new db[(_0xb19c('0x1f'))]['ValidationError'](_0xb19c('0x1a'));}if(!_0x506538[_0xb19c('0x1b')]||!_0x506538['sentimentAccountId']||!_0x506538[_0xb19c('0x1d')]||!_0x506538['language']||!_0x506538[_0xb19c('0x30')]){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))](_0xb19c('0x21'));}if(!_0x516592[_0xb19c('0x11')]){throw new Error(_0xb19c('0x22'));}if(_0x506538[_0xb19c('0x1c')]===_0x58e545['id']){return _0x58e545;}else{return db['CloudProvider'][_0xb19c('0x31')]({'where':{'id':_settings[_0xb19c('0x1c')]}});}})['then'](function(_0x10d406){if(!_0x10d406){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))](_0xb19c('0x24'));}if(!_0x10d406['data1']||!_0x10d406['data2']){throw new db['Sequelize'][(_0xb19c('0x20'))](_0xb19c('0x26'));}_0x46bfc2=_0x10d406;logger[_0xb19c('0xe')](util[_0xb19c('0x9')](_0xb19c('0x32'),_0x516592['id']));return sentiment(_0x46bfc2[_0xb19c('0x25')],_0x46bfc2[_0xb19c('0xc')],_0x506538[_0xb19c('0x1d')],_0x516592[_0xb19c('0x11')],_0x506538['language']);})[_0xb19c('0xd')](function(_0x2b3642){logger[_0xb19c('0xe')](util[_0xb19c('0x9')](_0xb19c('0x33'),_0x516592['id']));return _0x516592[_0xb19c('0x27')]({'sentiment':_0x2b3642[_0xb19c('0x28')],'sPositive':_0x2b3642[_0xb19c('0x29')][_0xb19c('0x34')],'sNegative':_0x2b3642[_0xb19c('0x29')][_0xb19c('0x2a')],'sMixed':_0x2b3642['SentimentScore'][_0xb19c('0x35')],'sNeutral':_0x2b3642[_0xb19c('0x29')][_0xb19c('0x36')],'transcribeStatus':_0xb19c('0x37')});})['then'](function(){logger['info'](util[_0xb19c('0x9')](_0xb19c('0x19'),_0x516592['id']));_0x361bbe();});}})[_0xb19c('0x38')](function(_0x36b545){if(_0x36b545){if(!_0x36b545['name']||_0x36b545[_0xb19c('0x39')]!==_0xb19c('0x3a')){logger['error'](util['format'](_0xb19c('0x3b'),_0x516592['id']),util[_0xb19c('0x3c')](_0x36b545,{'showHidden':![],'depth':null}));}}_0x361bbe();});});}function checkTranscribe(){var _0x272d6a;var _0x7a2887;var _0x2f4edd;return db[_0xb19c('0x3d')][_0xb19c('0x3e')]({'where':{'transcribeStatus':_0xb19c('0x3f')}})[_0xb19c('0xd')](function(_0x5bac38){if(!_0x5bac38||!_0x5bac38['length']){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x272d6a=_0x5bac38;return db[_0xb19c('0x40')][_0xb19c('0x31')]({'where':{'id':0x1}});})[_0xb19c('0xd')](function(_0x55b4bf){if(!_0x55b4bf){throw new db[(_0xb19c('0x1f'))][(_0xb19c('0x20'))](_0xb19c('0x41'));}_0x7a2887=_0x55b4bf;if(!_0x7a2887['transcribe']||!_0x7a2887[_0xb19c('0x42')]||!_0x7a2887[_0xb19c('0x43')]||!_0x7a2887['language']||!_0x7a2887[_0xb19c('0x30')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xb19c('0x23')][_0xb19c('0x31')]({'where':{'id':_0x7a2887[_0xb19c('0x42')]}});})[_0xb19c('0xd')](function(_0xcb0169){if(!_0xcb0169){throw new db['Sequelize'][(_0xb19c('0x20'))](_0xb19c('0x24'));}if(!_0xcb0169[_0xb19c('0x25')]||!_0xcb0169[_0xb19c('0xc')]){throw new db[(_0xb19c('0x1f'))]['ValidationError'](_0xb19c('0x26'));}_0x2f4edd=_0xcb0169;var _0x5e2236=[];_0x272d6a[_0xb19c('0x44')](function(_0x4a84c2){_0x5e2236['push'](checkTranscribeJob(_0x4a84c2,_0x7a2887,_0x2f4edd));});return BPromise['all'](_0x5e2236);})[_0xb19c('0x38')](function(_0x4e644f){if(_0x4e644f){if(!_0x4e644f[_0xb19c('0x39')]||_0x4e644f[_0xb19c('0x39')]!==_0xb19c('0x3a')){logger[_0xb19c('0x45')](util[_0xb19c('0x3c')](_0x4e644f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 6b5859d..d6bc448 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 _0xe37f=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0xe37f,0x9e));var _0xfe37=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0xe37f[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0xfe37('0x0'));var moment=require('moment');var Redis=require(_0xfe37('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xfe37('0x2'))['db'];var logger=require(_0xfe37('0x3'))(_0xfe37('0x4'));config[_0xfe37('0x5')]=_[_0xfe37('0x6')](config[_0xfe37('0x5')],{'host':_0xfe37('0x7'),'port':0x18eb});var io=require(_0xfe37('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x14b09a=[];return db[_0xfe37('0x9')][_0xfe37('0xa')]({'raw':!![],'attributes':['id',_0xfe37('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfe37('0xc')](0x18,'hours')}}})[_0xfe37('0xd')](function(_0x1e676e){if(_0x1e676e&&_0x1e676e[_0xfe37('0xe')]){_0x14b09a=_[_0xfe37('0xf')](_0x1e676e||[],'id');logger['info'](_0xfe37('0x10'),_0x14b09a[_0xfe37('0x11')]());return db[_0xfe37('0x9')][_0xfe37('0x12')]({'closeReason':_0xfe37('0x13'),'disposition':_0xfe37('0x14'),'closed':!![],'closedAt':moment()['format'](_0xfe37('0x15'))},{'where':{'id':_0x14b09a}});}})[_0xfe37('0xd')](function(){if(_0x14b09a&&_0x14b09a[_0xfe37('0xe')]){logger[_0xfe37('0x16')](_0xfe37('0x17'),_0x14b09a[_0xfe37('0x11')]());for(var _0x50b4c4=0x0;_0x50b4c4<_0x14b09a[_0xfe37('0xe')];_0x50b4c4++){io[_0xfe37('0x18')](_0xfe37('0x19'),{'id':_0x14b09a[_0x50b4c4],'closed':!![]});}}})[_0xfe37('0x1a')](function(_0xcd222f){logger[_0xfe37('0x1b')](_0xfe37('0x1c'),_0xcd222f?util[_0xfe37('0x1d')](_0xcd222f,{'showHidden':![],'depth':null}):'');});}exports[_0xfe37('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfd22=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','join','update'];(function(_0x2e8abe,_0x3504a7){var _0x2838f9=function(_0x5581c2){while(--_0x5581c2){_0x2e8abe['push'](_0x2e8abe['shift']());}};_0x2838f9(++_0x3504a7);}(_0xfd22,0x1ce));var _0x2fd2=function(_0x38e1a9,_0x728f44){_0x38e1a9=_0x38e1a9-0x0;var _0xd3e30c=_0xfd22[_0x38e1a9];return _0xd3e30c;};'use strict';var _=require(_0x2fd2('0x0'));var moment=require(_0x2fd2('0x1'));var Redis=require('ioredis');var util=require(_0x2fd2('0x2'));var config=require(_0x2fd2('0x3'));var db=require(_0x2fd2('0x4'))['db'];var logger=require('../logger')(_0x2fd2('0x5'));config[_0x2fd2('0x6')]=_[_0x2fd2('0x7')](config[_0x2fd2('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2fd2('0x8'))(new Redis(config[_0x2fd2('0x6')]));function closeInteractions(){var _0x4fca44=[];return db[_0x2fd2('0x9')][_0x2fd2('0xa')]({'raw':!![],'attributes':['id',_0x2fd2('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2fd2('0xc')](0x18,_0x2fd2('0xd'))}}})[_0x2fd2('0xe')](function(_0x3309ad){if(_0x3309ad&&_0x3309ad['length']){_0x4fca44=_[_0x2fd2('0xf')](_0x3309ad||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4fca44[_0x2fd2('0x10')]());return db['WhatsappInteraction'][_0x2fd2('0x11')]({'closeReason':'system','disposition':_0x2fd2('0x12'),'closed':!![],'closedAt':moment()[_0x2fd2('0x13')](_0x2fd2('0x14'))},{'where':{'id':_0x4fca44}});}})['then'](function(){if(_0x4fca44&&_0x4fca44[_0x2fd2('0x15')]){logger[_0x2fd2('0x16')](_0x2fd2('0x17'),_0x4fca44[_0x2fd2('0x10')]());for(var _0x2bcd5d=0x0;_0x2bcd5d<_0x4fca44[_0x2fd2('0x15')];_0x2bcd5d++){io[_0x2fd2('0x18')](_0x2fd2('0x19'),{'id':_0x4fca44[_0x2bcd5d],'closed':!![]});}}})[_0x2fd2('0x1a')](function(_0x35f618){logger[_0x2fd2('0x1b')](_0x2fd2('0x1c'),_0x35f618?util['inspect'](_0x35f618,{'showHidden':![],'depth':null}):'');});}exports[_0x2fd2('0x1d')]=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 4c0ae56..631fe61 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x786f=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','then','CmContact','bulkCreate','log','finished\x20populating','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util'];(function(_0xae2431,_0x47d0ce){var _0x502482=function(_0x58e460){while(--_0x58e460){_0xae2431['push'](_0xae2431['shift']());}};_0x502482(++_0x47d0ce);}(_0x786f,0x1da));var _0xf786=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0x786f[_0x40f9a0];return _0x3e3144;};'use strict';var util=require(_0xf786('0x0'));var db=require(_0xf786('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf786('0x2')]({'id':i,'firstName':_0xf786('0x3')+i,'lastName':_0xf786('0x4')+i,'phone':0xf879fb460+i,'email':_0xf786('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf786('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf786('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf786('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf786('0x2')]({'id':i,'firstName':_0xf786('0x3')+i,'lastName':_0xf786('0x4')+i,'phone':0xf879fb460+i,'email':_0xf786('0x5')+i+_0xf786('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf786('0x2')]({'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[_0xf786('0x6')]()});}db['CmContact']['destroy']({'where':{}})[_0xf786('0x8')](function(){return db[_0xf786('0x9')][_0xf786('0xa')](contacts);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),'contacts1');return db[_0xf786('0xd')][_0xf786('0xe')]({'where':{}});})[_0xf786('0x8')](function(){return db['CmHopper'][_0xf786('0xa')](hopper);})['then'](function(){console['log'](_0xf786('0xc'),_0xf786('0xf'));return db['CmContact'][_0xf786('0xa')](contacts2);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),_0xf786('0x10'));return db[_0xf786('0xd')][_0xf786('0xa')](hopper2);})[_0xf786('0x8')](function(){console[_0xf786('0xb')](_0xf786('0xc'),_0xf786('0x11'));})[_0xf786('0x12')](function(_0x32bc52){console['log'](_0x32bc52);}); \ No newline at end of file +var _0x12b4=['hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','log','finished\x20populating','then','CmHopper','hopper1','contacts2'];(function(_0x2984a0,_0x3ba6b5){var _0x265e5b=function(_0x5bb805){while(--_0x5bb805){_0x2984a0['push'](_0x2984a0['shift']());}};_0x265e5b(++_0x3ba6b5);}(_0x12b4,0xec));var _0x412b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x12b4[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require(_0x412b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x412b('0x1')]({'id':i,'firstName':_0x412b('0x2')+i,'lastName':_0x412b('0x3')+i,'phone':0xf879fb460+i,'email':_0x412b('0x4')+i+_0x412b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x412b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x412b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x412b('0x6')](),'updatedAt':Date[_0x412b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x412b('0x1')]({'id':i,'firstName':_0x412b('0x2')+i,'lastName':_0x412b('0x3')+i,'phone':0xf879fb460+i,'email':_0x412b('0x4')+i+_0x412b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x412b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x412b('0x7')][_0x412b('0x8')]({'where':{}})['then'](function(){return db[_0x412b('0x7')][_0x412b('0x9')](contacts);})['then'](function(){console[_0x412b('0xa')](_0x412b('0xb'),'contacts1');return db['CmHopper'][_0x412b('0x8')]({'where':{}});})[_0x412b('0xc')](function(){return db[_0x412b('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x412b('0xa')](_0x412b('0xb'),_0x412b('0xe'));return db[_0x412b('0x7')][_0x412b('0x9')](contacts2);})[_0x412b('0xc')](function(){console[_0x412b('0xa')](_0x412b('0xb'),_0x412b('0xf'));return db[_0x412b('0xd')][_0x412b('0x9')](hopper2);})[_0x412b('0xc')](function(){console[_0x412b('0xa')]('finished\x20populating',_0x412b('0x10'));})[_0x412b('0x11')](function(_0xc84f18){console['log'](_0xc84f18);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9db6390..4fa0f6e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bd9=['%s%s@xcally.com','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','format','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','%s%s','agent'];(function(_0x3353a9,_0x96bd0a){var _0x3b7cab=function(_0x712caa){while(--_0x712caa){_0x3353a9['push'](_0x3353a9['shift']());}};_0x3b7cab(++_0x96bd0a);}(_0x0bd9,0x1b4));var _0x90bd=function(_0x344a92,_0x586f5e){_0x344a92=_0x344a92-0x0;var _0x966d72=_0x0bd9[_0x344a92];return _0x966d72;};'use strict';var util=require(_0x90bd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x90bd('0x1')]({'name':util['format'](_0x90bd('0x2'),_0x90bd('0x3'),i),'fullname':util['format']('%s%s',_0x90bd('0x3'),i),'email':util['format'](_0x90bd('0x4'),_0x90bd('0x3'),i),'role':_0x90bd('0x3'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x90bd('0x5'),'ws',_0x90bd('0x6')],'disallow':['all'],'allow':[_0x90bd('0x7')],'defaultuser':util['format'](_0x90bd('0x2'),_0x90bd('0x3'),i),'encryption':_0x90bd('0x8'),'avpf':_0x90bd('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x90bd('0x9'),'dtlsprivatekey':_0x90bd('0xa'),'dtlssetup':_0x90bd('0xb'),'callerid':util[_0x90bd('0xc')](_0x90bd('0xd'),util[_0x90bd('0xc')](_0x90bd('0x2'),_0x90bd('0x3'),i),0xfa0+i)});}db[_0x90bd('0xe')][_0x90bd('0xf')](users)[_0x90bd('0x10')](function(){console[_0x90bd('0x11')](_0x90bd('0x12'));})[_0x90bd('0x13')](function(_0x4ebfbc){console[_0x90bd('0x11')](_0x4ebfbc);}); \ No newline at end of file +var _0x8985=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','ulaw'];(function(_0x22486d,_0xef0735){var _0x3feb8f=function(_0x542a72){while(--_0x542a72){_0x22486d['push'](_0x22486d['shift']());}};_0x3feb8f(++_0xef0735);}(_0x8985,0x171));var _0x5898=function(_0x93d258,_0x3b96fa){_0x93d258=_0x93d258-0x0;var _0x32c4ad=_0x8985[_0x93d258];return _0x32c4ad;};'use strict';var util=require(_0x5898('0x0'));var db=require(_0x5898('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5898('0x2')]({'name':util[_0x5898('0x3')]('%s%s',_0x5898('0x4'),i),'fullname':util[_0x5898('0x3')](_0x5898('0x5'),_0x5898('0x4'),i),'email':util[_0x5898('0x3')](_0x5898('0x6'),'agent',i),'role':_0x5898('0x4'),'password':_0x5898('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0x5898('0x8')],'defaultuser':util['format'](_0x5898('0x5'),_0x5898('0x4'),i),'encryption':_0x5898('0x9'),'avpf':_0x5898('0x9'),'force_avp':_0x5898('0x9'),'icesupport':_0x5898('0x9'),'dtlsenable':_0x5898('0x9'),'dtlsverify':'no','dtlscertfile':_0x5898('0xa'),'dtlsprivatekey':_0x5898('0xb'),'dtlssetup':'actpass','callerid':util[_0x5898('0x3')](_0x5898('0xc'),util[_0x5898('0x3')](_0x5898('0x5'),_0x5898('0x4'),i),0xfa0+i)});}db[_0x5898('0xd')]['bulkCreate'](users)[_0x5898('0xe')](function(){console[_0x5898('0xf')](_0x5898('0x10'));})[_0x5898('0x11')](function(_0x54cfb3){console[_0x5898('0xf')](_0x54cfb3);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 61c6d32..0c90cb3 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x414f=['ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','telephone','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','ChatQueues','ChatQueue','FaxQueues','FaxQueue','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave'];(function(_0x21f21b,_0x471748){var _0x360d1e=function(_0x4399aa){while(--_0x4399aa){_0x21f21b['push'](_0x21f21b['shift']());}};_0x360d1e(++_0x471748);}(_0x414f,0x13f));var _0xf414=function(_0x5bed28,_0x3069b3){_0x5bed28=_0x5bed28-0x0;var _0x44fe9f=_0x414f[_0x5bed28];return _0x44fe9f;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var BPromise=require(_0xf414('0x1'));var db=require(_0xf414('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xf414('0x3')],'include':[{'as':_0xf414('0x4'),'model':db[_0xf414('0x5')],'attributes':['id',_0xf414('0x3'),_0xf414('0x6')],'raw':!![],'where':{'role':_0xf414('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf414('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf414('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf414('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf414('0x3'),_0xf414('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4e69bd,_0x26a409,_0x2bbf01){return db[_0xf414('0x9')][_0xf414('0xa')]({'where':{'name':_0x4e69bd,'userProfileId':_0x26a409},'raw':!![]})[_0xf414('0xb')](function(_0x44648f){if(_0x44648f){if(_0x44648f[_0xf414('0xc')]){switch(_0x4e69bd){case _0xf414('0xd'):case'ChatQueues':case'FaxQueues':case _0xf414('0xe'):case _0xf414('0xf'):case _0xf414('0x10'):case _0xf414('0x11'):return db[_0x2bbf01][_0xf414('0x12')](queryQueues);case'Telephones':return db[_0x2bbf01][_0xf414('0x12')](queryTelephones);case _0xf414('0x13'):return db[_0x2bbf01][_0xf414('0x12')](queryTrunks);case _0xf414('0x14'):return db[_0x2bbf01][_0xf414('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0xf414('0x12')]({'attributes':[_0xf414('0x15')],'where':{'sectionId':_0x44648f['id']},'raw':!![]})[_0xf414('0xb')](function(_0x706d2e){if(_0x706d2e){var _0x4d3021={'where':{'id':_[_0xf414('0x16')](_0x706d2e,_0xf414('0x15'))},'raw':!![]};switch(_0x2bbf01){case _0xf414('0x5'):_0x4d3021['where'][_0xf414('0x6')]=_0xf414('0x17');break;case _0xf414('0x18'):_0x4d3021[_0xf414('0x19')][_0xf414('0x8')]='ivr';break;}return db[_0x2bbf01][_0xf414('0x12')](_0x4d3021);}else{return[];}});}}else{return[];}})['then'](function(_0x5ede89){return _0x5ede89;});}function joinOrLeaveQueues(_0x24b65e,_0x44b829,_0x572605,_0x49249b){_0x24b65e[_0x44b829](util['format'](_0xf414('0x1a'),_0x572605,_0x49249b[_0xf414('0x3')]));if(_0x49249b[_0xf414('0x4')]){for(var _0x417af1=0x0;_0x417af1<_0x49249b[_0xf414('0x4')][_0xf414('0x1b')];_0x417af1+=0x1){_0x24b65e[_0x44b829](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x49249b[_0xf414('0x4')][_0x417af1]['name']));}}}function joinOrLeave(_0xcde327,_0x3ae2a0,_0x236504){var _0x4999e4;if(_0xcde327[_0xf414('0x1e')][_0xf414('0x1f')]['id']){db[_0xf414('0x5')][_0xf414('0x20')]({'attributes':['id',_0xf414('0x3'),_0xf414('0x6'),_0xf414('0x21')],'where':{'id':_0xcde327[_0xf414('0x1e')]['query']['id']},'include':[{'model':db[_0xf414('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf414('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x24')],'as':_0xf414('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x26')],'as':_0xf414('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xf414('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf414('0xb')](function(_0x209790){if(_0x209790){_0x4999e4=_0x209790;_0xcde327[_0x3ae2a0](util['format'](_0xf414('0x1d'),_0x209790['name']));var _0x485afe=[];switch(_0x209790[_0xf414('0x6')]){case _0xf414('0x2a'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xf414('0x2c'))){delete queryQueues['include'];}_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2e')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['ChatQueue'][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['FaxQueue'][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2f')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x30')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['OpenchannelQueue']['findAll'](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x31')][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['User'][_0xf414('0x12')](queryTelephones));_0x485afe['push'](db[_0xf414('0x32')]['findAll'](queryTrunks));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x18')]['findAll'](queryCampaigns));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case'user':_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xd'),_0x209790[_0xf414('0x21')],_0xf414('0x2e')));_0x485afe['push'](getAssociatedResources(_0xf414('0x34'),_0x209790[_0xf414('0x21')],_0xf414('0x35')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x36'),_0x209790[_0xf414('0x21')],_0xf414('0x37')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xe'),_0x209790['userProfileId'],_0xf414('0x2f')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xf'),_0x209790[_0xf414('0x21')],_0xf414('0x30')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x10'),_0x209790[_0xf414('0x21')],_0xf414('0x38')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x11'),_0x209790[_0xf414('0x21')],_0xf414('0x31')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x39'),_0x209790[_0xf414('0x21')],_0xf414('0x5')));_0x485afe['push'](getAssociatedResources(_0xf414('0x13'),_0x209790[_0xf414('0x21')],'Trunk'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x14'),_0x209790['userProfileId'],_0xf414('0x18')));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case _0xf414('0x7'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe['push'](_0x209790[_0xf414('0x3a')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3b')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3c')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getSmsQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3d')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe['push'](_0x209790['getOpenchannelQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xf414('0x3e')](_0x485afe);}})[_0xf414('0xb')](function(_0x33c42d){if(_0x33c42d&&_0x33c42d[_0xf414('0x1b')]){for(var _0x1e7e28=0x0;_0x1e7e28<_0x33c42d[_0xf414('0x1b')];_0x1e7e28+=0x1){for(var _0x8754a1=0x0;_0x8754a1<_0x33c42d[_0x1e7e28][_0xf414('0x1b')];_0x8754a1+=0x1){switch(_0x1e7e28){case 0x0:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x3f'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x1:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x40'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x2:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x41'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x3:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x42'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x4:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x43'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x5:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x44'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x6:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x45'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x7:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x46'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;case 0x8:if(_0x4999e4[_0xf414('0x6')]!==_0xf414('0x7'))_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x47'),_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0x9:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')]('campaign:%s:%s',_0x33c42d[_0x1e7e28][_0x8754a1]['type'],_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0xa:_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;}}}}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x20319f=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x49')],'id');return _0x4999e4[_0xf414('0x4a')](_0x20319f)['then'](function(){for(var _0x1f0324=0x0;_0x1f0324<_0x20319f['length'];_0x1f0324+=0x1){_0x236504['emit'](_0xf414('0x4b'),{'ChatInteractionId':Number(_0x20319f[_0x1f0324]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x5ceccb=_['map'](_0x4999e4['MailInteractions'],'id');return _0x4999e4[_0xf414('0x4c')](_0x5ceccb)[_0xf414('0xb')](function(){for(var _0x22d341=0x0;_0x22d341<_0x5ceccb['length'];_0x22d341+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4e'),{'MailInteractionId':Number(_0x5ceccb[_0x22d341]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x5061cc=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x25')],'id');return _0x4999e4['removeFaxInteractions'](_0x5061cc)[_0xf414('0xb')](function(){for(var _0x3f1555=0x0;_0x3f1555<_0x5061cc['length'];_0x3f1555+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4f'),{'FaxInteractionId':Number(_0x5061cc[_0x3f1555]),'UserId':Number(_0x4999e4['id'])});}});}})['then'](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x54d909=_[_0xf414('0x16')](_0x4999e4['SmsInteractions'],'id');return _0x4999e4[_0xf414('0x50')](_0x54d909)['then'](function(){for(var _0x1d17bf=0x0;_0x1d17bf<_0x54d909[_0xf414('0x1b')];_0x1d17bf+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x51'),{'SmsInteractionId':Number(_0x54d909[_0x1d17bf]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x375493=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x52')],'id');return _0x4999e4['removeOpenchannelInteractions'](_0x375493)[_0xf414('0xb')](function(){for(var _0x30b335=0x0;_0x30b335<_0x375493[_0xf414('0x1b')];_0x30b335+=0x1){_0x236504[_0xf414('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x375493[_0x30b335]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x59ad77=_['map'](_0x4999e4[_0xf414('0x29')],'id');return _0x4999e4[_0xf414('0x53')](_0x59ad77)['then'](function(){for(var _0x169835=0x0;_0x169835<_0x59ad77[_0xf414('0x1b')];_0x169835+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x54'),{'WhatsappInteractionId':Number(_0x59ad77[_0x169835]),'UserId':Number(_0x4999e4['id'])});}});}})['catch'](function(_0x4d30f0){_0xcde327[_0xf414('0x55')](_0x4d30f0);});}}function onDisconnect(_0x40762d,_0x20caaf){joinOrLeave(_0x40762d,_0xf414('0x48'),_0x20caaf);}function onConnect(_0x6380d0){joinOrLeave(_0x6380d0,_0xf414('0x56'));}exports[_0xf414('0x57')]=function(_0x31c305){_0x31c305['on'](_0xf414('0x58'),function(_0x2827fd){_0x2827fd[_0xf414('0x59')](0x0);_0x2827fd[_0xf414('0x5a')]=_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')]['remoteAddress']+':'+_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')][_0xf414('0x5c')];_0x2827fd[_0xf414('0x5d')]=new Date();_0x2827fd[_0xf414('0x55')]=function(_0xb9b892){console[_0xf414('0x55')](_0xf414('0x5e')+_0x2827fd[_0xf414('0x5f')]['name']+'['+_0x2827fd[_0xf414('0x5a')]+']',_0xb9b892);};_0x2827fd['on'](_0xf414('0x60'),function(){onDisconnect(_0x2827fd,_0x31c305);_0x2827fd[_0xf414('0x55')]('DISCONNECTED');});onConnect(_0x2827fd);_0x2827fd[_0xf414('0x55')](_0xf414('0x61'));});}; \ No newline at end of file +var _0xdaa1=['address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','telephone','agent','type','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','voice:outbound','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','ChatQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','chat','openchannel','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','WhatsappInteractions','log','join','default','connection','setMaxListeners'];(function(_0x50f14e,_0x3cd896){var _0x2fd95b=function(_0x260925){while(--_0x260925){_0x50f14e['push'](_0x50f14e['shift']());}};_0x2fd95b(++_0x3cd896);}(_0xdaa1,0x17d));var _0x1daa=function(_0xfc34a8,_0x258c1c){_0xfc34a8=_0xfc34a8-0x0;var _0x165863=_0xdaa1[_0xfc34a8];return _0x165863;};'use strict';var _=require(_0x1daa('0x0'));var util=require(_0x1daa('0x1'));var BPromise=require(_0x1daa('0x2'));var db=require(_0x1daa('0x3'))['db'];var config=require(_0x1daa('0x4'));var queryQueues={'attributes':['id',_0x1daa('0x5')],'include':[{'as':_0x1daa('0x6'),'model':db['User'],'attributes':['id',_0x1daa('0x5'),_0x1daa('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1daa('0x5')],'where':{'role':_0x1daa('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x1daa('0x5')],'where':{'role':_0x1daa('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1daa('0x5'),_0x1daa('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x38e9bd,_0x387f2e,_0x35e4f2){return db[_0x1daa('0xb')]['findOne']({'where':{'name':_0x38e9bd,'userProfileId':_0x387f2e},'raw':!![]})[_0x1daa('0xc')](function(_0x55b7dc){if(_0x55b7dc){if(_0x55b7dc[_0x1daa('0xd')]){switch(_0x38e9bd){case _0x1daa('0xe'):case _0x1daa('0xf'):case _0x1daa('0x10'):case _0x1daa('0x11'):case _0x1daa('0x12'):case _0x1daa('0x13'):case'WhatsappQueues':return db[_0x35e4f2][_0x1daa('0x14')](queryQueues);case _0x1daa('0x15'):return db[_0x35e4f2][_0x1daa('0x14')](queryTelephones);case'Trunks':return db[_0x35e4f2]['findAll'](queryTrunks);case _0x1daa('0x16'):return db[_0x35e4f2]['findAll'](queryCampaigns);}}else{return db[_0x1daa('0x17')][_0x1daa('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x55b7dc['id']},'raw':!![]})['then'](function(_0x2a6b01){if(_0x2a6b01){var _0x47b9d6={'where':{'id':_[_0x1daa('0x18')](_0x2a6b01,_0x1daa('0x19'))},'raw':!![]};switch(_0x35e4f2){case _0x1daa('0x1a'):_0x47b9d6[_0x1daa('0x1b')][_0x1daa('0x7')]=_0x1daa('0x8');break;case _0x1daa('0x1c'):_0x47b9d6['where'][_0x1daa('0xa')]='ivr';break;}return db[_0x35e4f2][_0x1daa('0x14')](_0x47b9d6);}else{return[];}});}}else{return[];}})[_0x1daa('0xc')](function(_0xb759ea){return _0xb759ea;});}function joinOrLeaveQueues(_0x4dc700,_0x37886c,_0x1003d8,_0xbb2771){_0x4dc700[_0x37886c](util[_0x1daa('0x1d')](_0x1daa('0x1e'),_0x1003d8,_0xbb2771[_0x1daa('0x5')]));if(_0xbb2771[_0x1daa('0x6')]){for(var _0x423f6b=0x0;_0x423f6b<_0xbb2771[_0x1daa('0x6')][_0x1daa('0x1f')];_0x423f6b+=0x1){_0x4dc700[_0x37886c](util[_0x1daa('0x1d')](_0x1daa('0x20'),_0xbb2771[_0x1daa('0x6')][_0x423f6b][_0x1daa('0x5')]));}}}function joinOrLeave(_0x1c02b6,_0x2cebae,_0x508c5b){var _0x4abe29;if(_0x1c02b6[_0x1daa('0x21')]['query']['id']){db[_0x1daa('0x1a')]['find']({'attributes':['id',_0x1daa('0x5'),_0x1daa('0x7'),'userProfileId'],'where':{'id':_0x1c02b6[_0x1daa('0x21')]['query']['id']},'include':[{'model':db[_0x1daa('0x22')],'as':_0x1daa('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x1daa('0x24')],'as':_0x1daa('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1daa('0x26')],'as':_0x1daa('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x1daa('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1daa('0x29')],'as':_0x1daa('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1daa('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1daa('0xc')](function(_0x11b475){if(_0x11b475){_0x4abe29=_0x11b475;_0x1c02b6[_0x2cebae](util[_0x1daa('0x1d')](_0x1daa('0x20'),_0x11b475[_0x1daa('0x5')]));var _0x142998=[];switch(_0x11b475[_0x1daa('0x7')]){case'admin':_0x1c02b6[_0x2cebae](_0x1daa('0x2c'));_0x1c02b6[_0x2cebae](_0x1daa('0x2d'));if(queryQueues['hasOwnProperty'](_0x1daa('0x2e'))){delete queryQueues['include'];}_0x142998[_0x1daa('0x2f')](db['VoiceQueue'][_0x1daa('0x14')](queryQueues));_0x142998['push'](db['ChatQueue'][_0x1daa('0x14')](queryQueues));_0x142998[_0x1daa('0x2f')](db[_0x1daa('0x30')]['findAll'](queryQueues));_0x142998[_0x1daa('0x2f')](db[_0x1daa('0x31')][_0x1daa('0x14')](queryQueues));_0x142998[_0x1daa('0x2f')](db[_0x1daa('0x32')][_0x1daa('0x14')](queryQueues));_0x142998['push'](db[_0x1daa('0x33')][_0x1daa('0x14')](queryQueues));_0x142998['push'](db[_0x1daa('0x34')][_0x1daa('0x14')](queryQueues));_0x142998[_0x1daa('0x2f')](db[_0x1daa('0x1a')][_0x1daa('0x14')](queryTelephones));_0x142998[_0x1daa('0x2f')](db['Trunk'][_0x1daa('0x14')](queryTrunks));_0x142998['push'](db['Campaign'][_0x1daa('0x14')](queryCampaigns));_0x142998['push'](db[_0x1daa('0x1a')][_0x1daa('0x14')](queryAgents));break;case _0x1daa('0x35'):_0x1c02b6[_0x2cebae](_0x1daa('0x2c'));_0x1c02b6[_0x2cebae]('voice:outbound');_0x142998['push'](getAssociatedResources(_0x1daa('0xe'),_0x11b475['userProfileId'],'VoiceQueue'));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0xf'),_0x11b475[_0x1daa('0x36')],_0x1daa('0x37')));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0x10'),_0x11b475[_0x1daa('0x36')],_0x1daa('0x30')));_0x142998['push'](getAssociatedResources('SmsQueues',_0x11b475[_0x1daa('0x36')],'SmsQueue'));_0x142998[_0x1daa('0x2f')](getAssociatedResources('MailQueues',_0x11b475[_0x1daa('0x36')],_0x1daa('0x32')));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0x13'),_0x11b475[_0x1daa('0x36')],_0x1daa('0x33')));_0x142998[_0x1daa('0x2f')](getAssociatedResources('WhatsappQueues',_0x11b475[_0x1daa('0x36')],_0x1daa('0x34')));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0x15'),_0x11b475['userProfileId'],_0x1daa('0x1a')));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0x38'),_0x11b475['userProfileId'],'Trunk'));_0x142998[_0x1daa('0x2f')](getAssociatedResources(_0x1daa('0x16'),_0x11b475[_0x1daa('0x36')],'Campaign'));_0x142998['push'](db[_0x1daa('0x1a')][_0x1daa('0x14')](queryAgents));break;case _0x1daa('0x9'):_0x1c02b6[_0x2cebae](_0x1daa('0x2c'));_0x1c02b6[_0x2cebae]('voice:outbound');_0x142998[_0x1daa('0x2f')](_0x11b475[_0x1daa('0x39')]({'attributes':['id',_0x1daa('0x5')]}));_0x142998[_0x1daa('0x2f')](_0x11b475[_0x1daa('0x3a')]({'attributes':['id',_0x1daa('0x5')]}));_0x142998[_0x1daa('0x2f')](_0x11b475[_0x1daa('0x3b')]({'attributes':['id',_0x1daa('0x5')]}));_0x142998['push'](_0x11b475[_0x1daa('0x3c')]({'attributes':['id',_0x1daa('0x5')]}));_0x142998[_0x1daa('0x2f')](_0x11b475[_0x1daa('0x3d')]({'attributes':['id','name']}));_0x142998[_0x1daa('0x2f')](_0x11b475[_0x1daa('0x3e')]({'attributes':['id',_0x1daa('0x5')]}));_0x142998[_0x1daa('0x2f')](_0x11b475['getWhatsappQueues']({'attributes':['id',_0x1daa('0x5')]}));break;}return BPromise[_0x1daa('0x3f')](_0x142998);}})[_0x1daa('0xc')](function(_0x1d2416){if(_0x1d2416&&_0x1d2416[_0x1daa('0x1f')]){for(var _0xe7e9c2=0x0;_0xe7e9c2<_0x1d2416[_0x1daa('0x1f')];_0xe7e9c2+=0x1){for(var _0x5d8dea=0x0;_0x5d8dea<_0x1d2416[_0xe7e9c2]['length'];_0x5d8dea+=0x1){switch(_0xe7e9c2){case 0x0:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,'voice',_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x1:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,_0x1daa('0x40'),_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x2:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,'fax',_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x3:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,'sms',_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x4:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,'mail',_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x5:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,_0x1daa('0x41'),_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x6:joinOrLeaveQueues(_0x1c02b6,_0x2cebae,_0x1daa('0x42'),_0x1d2416[_0xe7e9c2][_0x5d8dea]);break;case 0x7:if(_0x4abe29[_0x1daa('0x7')]!==_0x1daa('0x9'))_0x1c02b6[_0x2cebae](util[_0x1daa('0x1d')](_0x1daa('0x43'),_0x1d2416[_0xe7e9c2][_0x5d8dea][_0x1daa('0x5')]));break;case 0x8:if(_0x4abe29[_0x1daa('0x7')]!==_0x1daa('0x9'))_0x1c02b6[_0x2cebae](util[_0x1daa('0x1d')](_0x1daa('0x44'),_0x1d2416[_0xe7e9c2][_0x5d8dea][_0x1daa('0x5')]));break;case 0x9:if(_0x4abe29[_0x1daa('0x7')]!==_0x1daa('0x9'))_0x1c02b6[_0x2cebae](util[_0x1daa('0x1d')]('campaign:%s:%s',_0x1d2416[_0xe7e9c2][_0x5d8dea][_0x1daa('0xa')],_0x1d2416[_0xe7e9c2][_0x5d8dea]['name']));break;case 0xa:_0x1c02b6[_0x2cebae](util[_0x1daa('0x1d')](_0x1daa('0x20'),_0x1d2416[_0xe7e9c2][_0x5d8dea][_0x1daa('0x5')]));break;}}}}})[_0x1daa('0xc')](function(){if(_0x2cebae==='leave'){var _0x46dda7=_[_0x1daa('0x18')](_0x4abe29['ChatInteractions'],'id');return _0x4abe29[_0x1daa('0x45')](_0x46dda7)[_0x1daa('0xc')](function(){for(var _0x47e633=0x0;_0x47e633<_0x46dda7[_0x1daa('0x1f')];_0x47e633+=0x1){_0x508c5b[_0x1daa('0x46')](_0x1daa('0x47'),{'ChatInteractionId':Number(_0x46dda7[_0x47e633]),'UserId':Number(_0x4abe29['id'])});}});}})[_0x1daa('0xc')](function(){if(_0x2cebae===_0x1daa('0x48')){var _0x3e9974=_['map'](_0x4abe29[_0x1daa('0x25')],'id');return _0x4abe29[_0x1daa('0x49')](_0x3e9974)[_0x1daa('0xc')](function(){for(var _0xccb1e3=0x0;_0xccb1e3<_0x3e9974[_0x1daa('0x1f')];_0xccb1e3+=0x1){_0x508c5b[_0x1daa('0x46')](_0x1daa('0x4a'),{'MailInteractionId':Number(_0x3e9974[_0xccb1e3]),'UserId':Number(_0x4abe29['id'])});}});}})[_0x1daa('0xc')](function(){if(_0x2cebae==='leave'){var _0x4d5941=_[_0x1daa('0x18')](_0x4abe29[_0x1daa('0x27')],'id');return _0x4abe29['removeFaxInteractions'](_0x4d5941)[_0x1daa('0xc')](function(){for(var _0x25fb66=0x0;_0x25fb66<_0x4d5941[_0x1daa('0x1f')];_0x25fb66+=0x1){_0x508c5b['emit'](_0x1daa('0x4b'),{'FaxInteractionId':Number(_0x4d5941[_0x25fb66]),'UserId':Number(_0x4abe29['id'])});}});}})[_0x1daa('0xc')](function(){if(_0x2cebae===_0x1daa('0x48')){var _0x16c22e=_[_0x1daa('0x18')](_0x4abe29[_0x1daa('0x28')],'id');return _0x4abe29[_0x1daa('0x4c')](_0x16c22e)[_0x1daa('0xc')](function(){for(var _0x2614d8=0x0;_0x2614d8<_0x16c22e['length'];_0x2614d8+=0x1){_0x508c5b[_0x1daa('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x16c22e[_0x2614d8]),'UserId':Number(_0x4abe29['id'])});}});}})[_0x1daa('0xc')](function(){if(_0x2cebae===_0x1daa('0x48')){var _0x546ac1=_[_0x1daa('0x18')](_0x4abe29[_0x1daa('0x2a')],'id');return _0x4abe29[_0x1daa('0x4d')](_0x546ac1)[_0x1daa('0xc')](function(){for(var _0x2bcae8=0x0;_0x2bcae8<_0x546ac1[_0x1daa('0x1f')];_0x2bcae8+=0x1){_0x508c5b['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x546ac1[_0x2bcae8]),'UserId':Number(_0x4abe29['id'])});}});}})[_0x1daa('0xc')](function(){if(_0x2cebae==='leave'){var _0x3a5c0d=_['map'](_0x4abe29[_0x1daa('0x4e')],'id');return _0x4abe29['removeWhatsappInteractions'](_0x3a5c0d)[_0x1daa('0xc')](function(){for(var _0x24caf9=0x0;_0x24caf9<_0x3a5c0d['length'];_0x24caf9+=0x1){_0x508c5b[_0x1daa('0x46')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3a5c0d[_0x24caf9]),'UserId':Number(_0x4abe29['id'])});}});}})['catch'](function(_0x24e3d2){_0x1c02b6[_0x1daa('0x4f')](_0x24e3d2);});}}function onDisconnect(_0x132da7,_0x956c93){joinOrLeave(_0x132da7,_0x1daa('0x48'),_0x956c93);}function onConnect(_0x42648f){joinOrLeave(_0x42648f,_0x1daa('0x50'));}exports[_0x1daa('0x51')]=function(_0x30b3b2){_0x30b3b2['on'](_0x1daa('0x52'),function(_0x1332a6){_0x1332a6[_0x1daa('0x53')](0x0);_0x1332a6[_0x1daa('0x54')]=_0x1332a6[_0x1daa('0x55')][_0x1daa('0x52')][_0x1daa('0x56')]+':'+_0x1332a6['request'][_0x1daa('0x52')][_0x1daa('0x57')];_0x1332a6['connectedAt']=new Date();_0x1332a6[_0x1daa('0x4f')]=function(_0x5dd982){console[_0x1daa('0x4f')](_0x1daa('0x58')+_0x1332a6[_0x1daa('0x59')][_0x1daa('0x5')]+'['+_0x1332a6[_0x1daa('0x54')]+']',_0x5dd982);};_0x1332a6['on'](_0x1daa('0x5a'),function(){onDisconnect(_0x1332a6,_0x30b3b2);_0x1332a6['log'](_0x1daa('0x5b'));});onConnect(_0x1332a6);_0x1332a6[_0x1daa('0x4f')](_0x1daa('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a61bd5b..ab6c9bc 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 _0x76db=['fullname','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','../logger','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','error','EventManager','get','channel','motionChannel','event','direction','resolve','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','name','incomingmessage','catch','AfterCreateMessage','offlineMessage','contact','undefined','interface','AfterCreate','closed','changed','substatus','agent','AfterUpdate','find'];(function(_0x5e8f9e,_0x253823){var _0x582101=function(_0x54ec0f){while(--_0x54ec0f){_0x5e8f9e['push'](_0x5e8f9e['shift']());}};_0x582101(++_0x253823);}(_0x76db,0x125));var _0xb76d=function(_0x11a4ce,_0x4f48fe){_0x11a4ce=_0x11a4ce-0x0;var _0x459801=_0x76db[_0x11a4ce];return _0x459801;};'use strict';var util=require(_0xb76d('0x0'));var db=require(_0xb76d('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xb76d('0x2'))('triggers');var client=jayson['client'][_0xb76d('0x3')]({'port':0x232a});var triggers=[{'channel':_0xb76d('0x4'),'model':_0xb76d('0x5'),'event':_0xb76d('0x6'),'condition':_0xb76d('0x7'),'callback':afterCreate},{'channel':_0xb76d('0x4'),'model':_0xb76d('0x5'),'event':_0xb76d('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb76d('0x4'),'model':_0xb76d('0x9'),'event':_0xb76d('0x6'),'condition':_0xb76d('0xa'),'callback':afterCreateMessage},{'channel':_0xb76d('0x4'),'model':'ChatOfflineMessage','event':_0xb76d('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xb76d('0xb'),'model':_0xb76d('0xc'),'event':_0xb76d('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xb76d('0xb'),'model':_0xb76d('0xc'),'event':_0xb76d('0x8'),'condition':_0xb76d('0xd'),'callback':afterUpdate},{'channel':_0xb76d('0xb'),'model':_0xb76d('0xe'),'event':_0xb76d('0x6'),'condition':_0xb76d('0xa'),'callback':afterCreateMessage},{'channel':_0xb76d('0xf'),'model':_0xb76d('0x10'),'event':_0xb76d('0x6'),'condition':_0xb76d('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xb76d('0x10'),'event':_0xb76d('0x8'),'condition':_0xb76d('0xd'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xb76d('0x11'),'event':_0xb76d('0x6'),'condition':_0xb76d('0xa'),'callback':afterCreateMessage},{'channel':_0xb76d('0x12'),'model':_0xb76d('0x13'),'event':'afterCreate','condition':_0xb76d('0x7'),'callback':afterCreate},{'channel':_0xb76d('0x12'),'model':'FaxInteraction','event':_0xb76d('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb76d('0x12'),'model':'FaxMessage','event':'afterCreate','condition':_0xb76d('0xa'),'callback':afterCreateMessage},{'channel':_0xb76d('0x14'),'model':_0xb76d('0x15'),'event':_0xb76d('0x6'),'condition':_0xb76d('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0xb76d('0x15'),'event':_0xb76d('0x8'),'condition':_0xb76d('0xd'),'callback':afterUpdate},{'channel':_0xb76d('0x14'),'model':'MailMessage','event':'afterCreate','condition':_0xb76d('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xb76d('0x16'),'event':'afterCreate','condition':_0xb76d('0x7'),'callback':afterCreate},{'channel':_0xb76d('0x17'),'model':_0xb76d('0x16'),'event':'afterUpdate','condition':_0xb76d('0xd'),'callback':afterUpdate},{'channel':_0xb76d('0x17'),'model':_0xb76d('0x18'),'event':_0xb76d('0x6'),'condition':_0xb76d('0xa'),'callback':afterCreateMessage}];function request(_0x2efb9f){return client[_0xb76d('0x19')]('EventManager',_0x2efb9f)['then'](function(_0x2a6b22){logger[_0xb76d('0x1a')](_0xb76d('0x1b'),'EventManager',_0x2a6b22);if(_0x2a6b22[_0xb76d('0x1c')]){if(_0x2a6b22[_0xb76d('0x1c')]['code']===0x1f4){logger['error'](_0xb76d('0x1b'),_0xb76d('0x1d'),_0x2a6b22['error']);}}})['catch'](function(_0xe00b6c){logger[_0xb76d('0x1c')]('Trigger,\x20%s',_0xb76d('0x1d'),_0xe00b6c);});}function afterCreateMessage(_0xb810b0){return function(_0x36fa01){_0x36fa01=_0x36fa01[_0xb76d('0x1e')]({'plain':!![]});_0x36fa01[_0xb76d('0x1f')]=_0xb810b0;_0x36fa01[_0xb76d('0x20')]=_0xb810b0;_0x36fa01[_0xb76d('0x21')]=_0x36fa01[_0xb76d('0x22')];Promise[_0xb76d('0x23')]()[_0xb76d('0x24')](function(){if(typeof _0x36fa01[_0xb76d('0x25')]==='undefined')return null;var _0x153390=_0xb76d('0x26')+_0x36fa01['ContactId'];return db[_0xb76d('0x27')][_0xb76d('0x28')](_0x153390,{'type':db[_0xb76d('0x29')][_0xb76d('0x2a')][_0xb76d('0x2b')],'raw':!![]});})[_0xb76d('0x24')](function(_0x3ffbfc){if(_0x3ffbfc){_0x36fa01['contact']=_0x3ffbfc[0x0];}if(typeof _0x36fa01[_0xb76d('0x2c')]==='undefined')return;return getAgent(_0x36fa01[_0xb76d('0x2c')]);})['then'](function(_0x375852){if(_0x375852){_0x36fa01['interface']=util[_0xb76d('0x2d')](_0xb76d('0x2e'),_0x375852[_0xb76d('0x2f')]);_0x36fa01['agent']=_0x375852;_0x36fa01[_0xb76d('0x1f')]=_0xb810b0;return request({'event':_0xb76d('0x30'),'message':_0x36fa01});}else{return request({'event':'outgoingmessage','message':_0x36fa01});}})[_0xb76d('0x31')](function(_0x141f37){logger[_0xb76d('0x1c')](_0xb76d('0x1b'),_0xb76d('0x32'),_0x141f37);});};}function afterCreateOfflineMessage(_0x3d6bdd){return function(_0x578a72){_0x578a72=_0x578a72[_0xb76d('0x1e')]({'plain':!![]});_0x578a72[_0xb76d('0x1f')]=_0x3d6bdd;_0x578a72[_0xb76d('0x20')]=_0x3d6bdd;_0x578a72[_0xb76d('0x21')]=_0xb76d('0x33');return request({'event':_0x578a72['event'],'message':_0x578a72});};}function afterCreate(_0x340a4b,_0x26b117){return function(_0x4d211c){_0x4d211c=_0x4d211c[_0xb76d('0x1e')]({'plain':!![]});_0x4d211c[_0xb76d('0x1f')]=_0x340a4b;_0x4d211c[_0xb76d('0x20')]=_0x340a4b;_0x4d211c['event']='opened';Promise['resolve']()[_0xb76d('0x24')](function(){var _0x577771=_0xb76d('0x26')+_0x4d211c['ContactId'];return db[_0xb76d('0x27')][_0xb76d('0x28')](_0x577771,{'type':db[_0xb76d('0x29')][_0xb76d('0x2a')][_0xb76d('0x2b')],'raw':!![]});})[_0xb76d('0x24')](function(_0x205d0f){if(_0x205d0f){_0x4d211c[_0xb76d('0x34')]=_0x205d0f[0x0];}if(typeof _0x4d211c['UserId']===_0xb76d('0x35'))return;return getAgent(_0x4d211c[_0xb76d('0x2c')]);})['then'](function(_0x15683a){if(_0x15683a){_0x4d211c[_0xb76d('0x36')]=util[_0xb76d('0x2d')]('SIP/%s',_0x15683a[_0xb76d('0x2f')]);_0x4d211c['agent']=_0x15683a;}return request({'event':_0x26b117,'message':_0x4d211c});})[_0xb76d('0x31')](function(_0x3b6a86){logger[_0xb76d('0x1c')]('Trigger,\x20%s',_0xb76d('0x37'),_0x3b6a86);});};}function afterUpdate(_0x31f5ac){return function(_0x349462){var _0x139c32=_0x349462['changed'](_0xb76d('0x38'))&&_0x349462['closed'];var _0x29e0e9=_0x349462[_0xb76d('0x39')]('substatus');if(_0x139c32||_0x29e0e9){var _0x19e100=_0x139c32?_0xb76d('0xd'):_0xb76d('0x3a');var _0x4d2dd8=_0x349462[_0xb76d('0x1e')]({'plain':!![]});_0x4d2dd8[_0xb76d('0x1f')]=_0x31f5ac;_0x4d2dd8[_0xb76d('0x20')]=_0x31f5ac;_0x4d2dd8[_0xb76d('0x21')]=_0x139c32?_0xb76d('0x38'):_0xb76d('0x3a');var _0x3922a0=_0xb76d('0x26')+_0x4d2dd8[_0xb76d('0x25')];return db[_0xb76d('0x27')]['query'](_0x3922a0,{'type':db[_0xb76d('0x29')]['QueryTypes'][_0xb76d('0x2b')],'raw':!![]})[_0xb76d('0x24')](function(_0x3c4a3b){if(_0x3c4a3b){_0x4d2dd8[_0xb76d('0x34')]=_0x3c4a3b[0x0];}if(typeof _0x4d2dd8[_0xb76d('0x2c')]===_0xb76d('0x35'))return;return getAgent(_0x4d2dd8[_0xb76d('0x2c')]);})[_0xb76d('0x24')](function(_0x2c6cdc){if(_0x2c6cdc){_0x4d2dd8[_0xb76d('0x36')]=util['format'](_0xb76d('0x2e'),_0x2c6cdc[_0xb76d('0x2f')]);_0x4d2dd8[_0xb76d('0x3b')]=_0x2c6cdc;}return request({'event':_0x19e100,'message':_0x4d2dd8});})[_0xb76d('0x31')](function(_0x1cbcd1){logger[_0xb76d('0x1c')](_0xb76d('0x1b'),_0xb76d('0x3c'),_0x1cbcd1);});}};}function getAgent(_0x2bd93e){return db['User'][_0xb76d('0x3d')]({'where':{'id':_0x2bd93e},'attributes':['id',_0xb76d('0x2f'),_0xb76d('0x3e'),_0xb76d('0x3f'),_0xb76d('0x40')],'raw':!![]})[_0xb76d('0x24')](function(_0xff6329){return _0xff6329;});}exports[_0xb76d('0x41')]=function(){for(var _0x5ae2cd=0x0;_0x5ae2cd=_0x388f1b[_0x9ae6('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5b8de2(_0x1784a8);})[_0x9ae6('0x12')](function(_0x54e62a){_0x3947da(_0x54e62a);});});}; \ No newline at end of file +var _0xe7e1=['bluebird','../mysqldb','./license/util','voice','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','then','agents','catch','lodash'];(function(_0x33428f,_0x528590){var _0x3ed09c=function(_0x275f9a){while(--_0x275f9a){_0x33428f['push'](_0x33428f['shift']());}};_0x3ed09c(++_0x528590);}(_0xe7e1,0x175));var _0x1e7e=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xe7e1[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x1e7e('0x0'));var BPromise=require(_0x1e7e('0x1'));var db=require(_0x1e7e('0x2'))['db'];var util=require(_0x1e7e('0x3'));var channels=[_0x1e7e('0x4'),_0x1e7e('0x5'),_0x1e7e('0x6'),'fax',_0x1e7e('0x7'),'whatsapp',_0x1e7e('0x8')];exports[_0x1e7e('0x9')]=function(){return channels;};exports[_0x1e7e('0xa')]=function(_0x231990){_0x231990=_0x231990[_0x1e7e('0xb')]();return _[_0x1e7e('0xc')](channels,_0x231990);};exports[_0x1e7e('0xd')]=function(_0x24c3a0,_0x489238,_0x2733a7,_0x3829c5){var _0x280bf2={'loginAttempts':_0x489238,'blocked':_0x2733a7};if(!_[_0x1e7e('0xe')](_0x3829c5)){_0x280bf2[_0x1e7e('0xf')]=_0x3829c5;}return _0x24c3a0[_0x1e7e('0x10')](_0x280bf2);};exports[_0x1e7e('0x11')]=function(_0xf3c4c1){return new BPromise(function(_0x4978ed,_0x39faaa){var _0x29d0b9=0x0;if(_0xf3c4c1['role']!=='agent'){_0x4978ed(_0xf3c4c1);}db['User']['count']({'where':{'role':_0x1e7e('0x12'),'online':!![],'id':{'$ne':_0xf3c4c1['id']}}})[_0x1e7e('0x13')](function(_0x5dc461){_0x29d0b9=_0x5dc461;return util['getLicense']();})['then'](function(_0x3601cf){if(_0x3601cf&&_0x3601cf[_0x1e7e('0x14')]&&_0x29d0b9>=_0x3601cf['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4978ed(_0xf3c4c1);})[_0x1e7e('0x15')](function(_0x537281){_0x39faaa(_0x537281);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 81091f9..1e8ea61 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Bad\x20Request','Not\x20Found','OutOfInterval','error','name','send','exports','util','../config/logger','api','message','Error','inherits'];(function(_0x2f75b0,_0x18a7a2){var _0x1c082e=function(_0x1ed0d4){while(--_0x1ed0d4){_0x2f75b0['push'](_0x2f75b0['shift']());}};_0x1c082e(++_0x18a7a2);}(_0xac4a,0x13f));var _0xaac4=function(_0x6ee76e,_0x3cf35c){_0x6ee76e=_0x6ee76e-0x0;var _0x347a38=_0xac4a[_0x6ee76e];return _0x347a38;};'use strict';var util=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var APIError=function(_0x132fc3,_0x38f4f4){this[_0xaac4('0x3')]=_0x132fc3||'Internal\x20Server\x20Error';this['name']=_0x38f4f4||_0xaac4('0x4');util[_0xaac4('0x5')](APIError,Error);};var APIBadRequestError=function(_0x32d34c){this['message']=_0x32d34c||_0xaac4('0x6');this['name']=_0xaac4('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1e4283){this[_0xaac4('0x3')]=_0x1e4283||'Entity\x20not\x20found';this['name']=_0xaac4('0x7');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x452573){switch(_0x452573){case'Bad\x20Request':return 0x190;case'Forbidden',_0xaac4('0x8'):return 0x193;case _0xaac4('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x38d1d0){return function(_0x5f393e){logger[_0xaac4('0x9')](_0x5f393e['stack']);var _0x508e14=getStatusCode(_0x5f393e[_0xaac4('0xa')]);if(_0x5f393e[_0xaac4('0xa')])delete _0x5f393e[_0xaac4('0xa')];return _0x38d1d0['status'](_0x508e14)[_0xaac4('0xb')](_0x5f393e);};}module[_0xaac4('0xc')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xac4a=['Bad\x20Request','Not\x20Found','OutOfInterval','error','name','send','exports','util','../config/logger','api','message','Error','inherits'];(function(_0x159948,_0x185569){var _0x5e9073=function(_0xe795ec){while(--_0xe795ec){_0x159948['push'](_0x159948['shift']());}};_0x5e9073(++_0x185569);}(_0xac4a,0x13f));var _0xaac4=function(_0x772db1,_0xdf174c){_0x772db1=_0x772db1-0x0;var _0x246ce4=_0xac4a[_0x772db1];return _0x246ce4;};'use strict';var util=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var APIError=function(_0x132fc3,_0x38f4f4){this[_0xaac4('0x3')]=_0x132fc3||'Internal\x20Server\x20Error';this['name']=_0x38f4f4||_0xaac4('0x4');util[_0xaac4('0x5')](APIError,Error);};var APIBadRequestError=function(_0x32d34c){this['message']=_0x32d34c||_0xaac4('0x6');this['name']=_0xaac4('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1e4283){this[_0xaac4('0x3')]=_0x1e4283||'Entity\x20not\x20found';this['name']=_0xaac4('0x7');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x452573){switch(_0x452573){case'Bad\x20Request':return 0x190;case'Forbidden',_0xaac4('0x8'):return 0x193;case _0xaac4('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x38d1d0){return function(_0x5f393e){logger[_0xaac4('0x9')](_0x5f393e['stack']);var _0x508e14=getStatusCode(_0x5f393e[_0xaac4('0xa')]);if(_0x5f393e[_0xaac4('0xa')])delete _0x5f393e[_0xaac4('0xa')];return _0x38d1d0['status'](_0x508e14)[_0xaac4('0xb')](_0x5f393e);};}module[_0xaac4('0xc')]={'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 e70a470..18bc364 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x675e=['render','json','404','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x675e,0x18a));var _0xe675=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x675e[_0x44c768];return _0x55daf5;};'use strict';module['exports'][0x194]=function pageNotFound(_0x214c62,_0x39f142){var _0x1e0d10=_0xe675('0x0');var _0x4a7210=0x194;var _0x1d05ce={'status':_0x4a7210};_0x39f142[_0xe675('0x1')](_0x1d05ce[_0xe675('0x1')]);_0x39f142[_0xe675('0x2')](_0x1e0d10,{},function(_0x2c46e7,_0x49e9dd){if(_0x2c46e7){return _0x39f142[_0xe675('0x1')](_0x1d05ce[_0xe675('0x1')])[_0xe675('0x3')](_0x1d05ce);}_0x39f142['send'](_0x49e9dd);});}; \ No newline at end of file +var _0xd01c=['404','status','send','exports'];(function(_0x3dbd77,_0x2ecd8e){var _0x5e7ae6=function(_0x59f3e7){while(--_0x59f3e7){_0x3dbd77['push'](_0x3dbd77['shift']());}};_0x5e7ae6(++_0x2ecd8e);}(_0xd01c,0xfb));var _0xcd01=function(_0x2aa524,_0x8439d9){_0x2aa524=_0x2aa524-0x0;var _0x353784=_0xd01c[_0x2aa524];return _0x353784;};'use strict';module[_0xcd01('0x0')][0x194]=function pageNotFound(_0x1f05d0,_0x40344c){var _0x593407=_0xcd01('0x1');var _0x5bbfff=0x194;var _0xad4c60={'status':_0x5bbfff};_0x40344c[_0xcd01('0x2')](_0xad4c60[_0xcd01('0x2')]);_0x40344c['render'](_0x593407,{},function(_0x298492,_0x43e3a9){if(_0x298492){return _0x40344c[_0xcd01('0x2')](_0xad4c60[_0xcd01('0x2')])['json'](_0xad4c60);}_0x40344c[_0xcd01('0x3')](_0x43e3a9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a22dff9..eb93ec1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa071=['Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','Condition','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','AllCondition','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','SugarcrmField','VariableId','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','team_has_whatsapp_queues','VoicePrefix','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSections','userProfileId','UserProfileSection','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','xcall','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','motion2','xC@LL1234','utf8','database','username','options','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','Groups','chat_group_has_users','belongsToMany','Contacts','CmList','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','belongsTo','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','restrict','MailAccountId','CloudProviderId','Smtp','Dispositions','Interactions','ListId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','List','DashboardItem','Items','FaxAccountId','Answers','user_has_fax_accounts','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','Teams','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','CompanyId','Phones'];(function(_0xa4fb42,_0x2dd073){var _0x22c1c8=function(_0x417b50){while(--_0x417b50){_0xa4fb42['push'](_0xa4fb42['shift']());}};_0x22c1c8(++_0x2dd073);}(_0xa071,0x64));var _0x1a07=function(_0x1dc37e,_0x1d8642){_0x1dc37e=_0x1dc37e-0x0;var _0x5e7988=_0xa071[_0x1dc37e];return _0x5e7988;};'use strict';var config=require(_0x1a07('0x0'));var Sequelize=require(_0x1a07('0x1'));var _=require(_0x1a07('0x2'));var jstz=require(_0x1a07('0x3'));var timezone=jstz['determine']();config['sequelize']=_['defaultsDeep'](config[_0x1a07('0x1')],{'database':'motion2','username':_0x1a07('0x4'),'password':'xC@LL1234','options':{'host':_0x1a07('0x5'),'port':0xcea,'dialect':_0x1a07('0x6'),'dialectOptions':{'charset':_0x1a07('0x7')},'logging':![],'timezone':timezone[_0x1a07('0x8')](),'define':{'charset':'utf8','collate':_0x1a07('0x9')}}});config[_0x1a07('0xa')]=_['defaultsDeep'](config[_0x1a07('0xa')],{'database':_0x1a07('0xb'),'username':'xcall','password':_0x1a07('0xc'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x1a07('0x6'),'dialectOptions':{'charset':_0x1a07('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1a07('0xd'),'collate':_0x1a07('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a07('0x1')][_0x1a07('0xe')],config[_0x1a07('0x1')][_0x1a07('0xf')],config[_0x1a07('0x1')]['password'],config['sequelize'][_0x1a07('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a07('0xa')]['database'],config['sequelizeHistory'][_0x1a07('0xf')],config[_0x1a07('0xa')]['password'],config[_0x1a07('0xa')]['options'])};db['User']=db[_0x1a07('0x1')]['import']('../api/user/user.model');db[_0x1a07('0x11')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x12'));db[_0x1a07('0x13')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x15'));db[_0x1a07('0x16')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x1a07('0x17')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x18'));db[_0x1a07('0x19')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x1a'));db[_0x1a07('0x1b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x1c'));db[_0x1a07('0x1d')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x1a07('0x1')]['import'](_0x1a07('0x1e'));db['VoiceMailMessage']=db[_0x1a07('0x1')]['import'](_0x1a07('0x1f'));db[_0x1a07('0x20')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x21'));db[_0x1a07('0x22')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x23'));db['VoiceAgentReport']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1a07('0x24')]=db[_0x1a07('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize']['import'](_0x1a07('0x25'));db[_0x1a07('0x26')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x27'));db['VoiceTransferReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0x28'));db[_0x1a07('0x29')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2a'));db['UserVoiceQueue']=db[_0x1a07('0x1')]['import'](_0x1a07('0x2b'));db[_0x1a07('0x2c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2d'));db[_0x1a07('0x2e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x2f'));db[_0x1a07('0x30')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x31'));db[_0x1a07('0x32')]=db['sequelize'][_0x1a07('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x1a07('0x33')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x34'));db[_0x1a07('0x35')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x36'));db[_0x1a07('0x37')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x38'));db[_0x1a07('0x39')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x3a'));db[_0x1a07('0x3b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x3c'));db[_0x1a07('0x3d')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x3e'));db[_0x1a07('0x3f')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1a07('0x40')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x41'));db[_0x1a07('0x42')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x43'));db['MailApplication']=db['sequelize']['import'](_0x1a07('0x44'));db[_0x1a07('0x45')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x46'));db[_0x1a07('0x47')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x1a07('0x1')]['import'](_0x1a07('0x48'));db['FaxAccount']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x49'));db[_0x1a07('0x4a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4b'));db[_0x1a07('0x4c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4d'));db[_0x1a07('0x4e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x4f'));db[_0x1a07('0x50')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x51'));db[_0x1a07('0x52')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x53'));db[_0x1a07('0x54')]=db[_0x1a07('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x1a07('0x55')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x56'));db[_0x1a07('0x57')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x58'));db[_0x1a07('0x59')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x5a'));db[_0x1a07('0x5b')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/smsQueue/smsQueue.model');db[_0x1a07('0x5c')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x5d'));db[_0x1a07('0x5e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x5f'));db[_0x1a07('0x60')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x61'));db[_0x1a07('0x62')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x63'));db[_0x1a07('0x64')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x65'));db[_0x1a07('0x66')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x67'));db['OpenchannelQueueReport']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x68'));db['ChatApplication']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x69'));db['ChatInteraction']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db['sequelize'][_0x1a07('0x14')]('../api/chatMessage/chatMessage.model');db[_0x1a07('0x6a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x6b'));db[_0x1a07('0x6c')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatQueue/chatQueue.model');db[_0x1a07('0x6d')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x6e'));db[_0x1a07('0x6f')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x70'));db['CmCompany']=db[_0x1a07('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x1a07('0x71')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x72'));db[_0x1a07('0x73')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x74'));db[_0x1a07('0x75')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x76'));db[_0x1a07('0x77')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x78'));db[_0x1a07('0x79')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x1a07('0x7a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7b'));db[_0x1a07('0x7c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7d'));db[_0x1a07('0x7e')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x7f'));db[_0x1a07('0x80')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x81'));db[_0x1a07('0x82')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x1a07('0x83')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/disposition/disposition.model');db['Condition']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x84'));db[_0x1a07('0x85')]=db['sequelize']['import'](_0x1a07('0x86'));db[_0x1a07('0x87')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x88'));db[_0x1a07('0x89')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x8a'));db['VoiceQueuesLog']=db['sequelize']['import'](_0x1a07('0x8b'));db[_0x1a07('0x8c')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/schedule/schedule.model');db['Sound']=db['sequelize']['import'](_0x1a07('0x8d'));db[_0x1a07('0x8e')]=db[_0x1a07('0x1')]['import']('../api/tag/tag.model');db[_0x1a07('0x8f')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x90'));db[_0x1a07('0x91')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x1a07('0x92')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x93'));db[_0x1a07('0x94')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x95'));db[_0x1a07('0x96')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x97'));db[_0x1a07('0x98')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x99'));db['IntegrationReport']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/integrationReport/integrationReport.model');db[_0x1a07('0x9a')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x9b'));db[_0x1a07('0x9c')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x9d'));db[_0x1a07('0x9e')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x9f'));db[_0x1a07('0xa0')]=db[_0x1a07('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x1a07('0xa1')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xa2'));db[_0x1a07('0xa3')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xa4'));db[_0x1a07('0xa5')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xa6'));db[_0x1a07('0xa7')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xa8'));db[_0x1a07('0xa9')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1a07('0xaa')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x1a07('0xab')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xac'));db[_0x1a07('0xad')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xae'));db[_0x1a07('0xaf')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb0'));db[_0x1a07('0xb1')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb2'));db[_0x1a07('0xb3')]=db[_0x1a07('0x1')]['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb4'));db[_0x1a07('0xb5')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb6'));db['ZendeskAccount']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb7'));db[_0x1a07('0xb8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xb9'));db[_0x1a07('0xba')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xbb'));db[_0x1a07('0xbc')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xbd'));db[_0x1a07('0xbe')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xbf'));db[_0x1a07('0xc0')]=db['sequelize'][_0x1a07('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x1a07('0xc1')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc2'));db['VtigerConfiguration']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xc3'));db[_0x1a07('0xc4')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xc5'));db[_0x1a07('0xc6')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc7'));db['ServicenowConfiguration']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xc8'));db[_0x1a07('0xc9')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xca'));db[_0x1a07('0xcb')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x1a07('0xcc')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xcd'));db[_0x1a07('0xce')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xcf'));db[_0x1a07('0xd0')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xd1'));db[_0x1a07('0xd2')]=db['sequelize']['import'](_0x1a07('0xd3'));db[_0x1a07('0xd4')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x1a07('0x98')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x99'));db[_0x1a07('0xd5')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xd6'));db[_0x1a07('0xd7')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x1a07('0xd8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xd9'));db['JscriptyQuestionReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0xda'));db['JscriptySessionReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xdb'));db[_0x1a07('0xdc')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xdd'));db['SquareReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xde'));db['SquareDetailsReport']=db['sequelize']['import'](_0x1a07('0xdf'));db[_0x1a07('0xe0')]=db['sequelize'][_0x1a07('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1a07('0xe1')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xe2'));db[_0x1a07('0xe3')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xe4'));db[_0x1a07('0xe5')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/squareRecording/squareRecording.model');db[_0x1a07('0xe6')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xe7'));db[_0x1a07('0xe8')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xe9'));db[_0x1a07('0xea')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xeb'));db[_0x1a07('0xec')]=db[_0x1a07('0x1')]['import'](_0x1a07('0xed'));db[_0x1a07('0xee')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xef'));db[_0x1a07('0xf0')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf1'));db[_0x1a07('0xf2')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x1a07('0x1')]['import'](_0x1a07('0xf3'));db['ChatTransferReport']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf4'));db[_0x1a07('0xf5')]=db['sequelize'][_0x1a07('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x1a07('0xf6')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf7'));db[_0x1a07('0xf8')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xf9'));db['CmList']=db[_0x1a07('0x1')]['import'](_0x1a07('0xfa'));db['VoicePrefix']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0xfb'));db[_0x1a07('0xfc')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0xfd'));db['UserProfileSection']=db[_0x1a07('0x1')]['import'](_0x1a07('0xfe'));db[_0x1a07('0xff')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x100'));db[_0x1a07('0x101')]=db['sequelize'][_0x1a07('0x14')]('../api/userNotification/userNotification.model');db[_0x1a07('0x102')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x103'));db[_0x1a07('0x104')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x105'));db['WhatsappInteraction']=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x106'));db[_0x1a07('0x107')]=db[_0x1a07('0x1')][_0x1a07('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x1a07('0x108')]=db[_0x1a07('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x1a07('0x109')]=db[_0x1a07('0x1')]['import'](_0x1a07('0x10a'));db[_0x1a07('0x10b')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x10c'));db[_0x1a07('0x10d')]=db['sequelize']['import'](_0x1a07('0x10e'));db['TeamVoiceQueue']=db['sequelize'][_0x1a07('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x1a07('0x10f')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x110'));db[_0x1a07('0x111')]=db[_0x1a07('0x1')][_0x1a07('0x14')](_0x1a07('0x112'));db[_0x1a07('0x113')]=db['sequelize'][_0x1a07('0x14')](_0x1a07('0x114'));db[_0x1a07('0x115')][_0x1a07('0x116')](db[_0x1a07('0x117')],{'as':'VoiceMail','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x119')});db['User'][_0x1a07('0x116')](db['UserSetting'],{'as':_0x1a07('0x11a'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x29')],{'as':_0x1a07('0x11c'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db['VoiceExtension'],{'as':_0x1a07('0x11d'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x115')]['hasMany'](db['CmHopperFinal'],{'as':_0x1a07('0x11e'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x79')],{'as':'HopperHistory','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x119')});db['User']['hasMany'](db[_0x1a07('0x60')],{'as':_0x1a07('0x11f'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')]['hasMany'](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x57')],{'as':_0x1a07('0x122'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'foreignKey':'UserId'});db[_0x1a07('0x115')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x124'),'foreignKey':_0x1a07('0x119')});db['User']['hasMany'](db[_0x1a07('0x125')],{'as':_0x1a07('0x126'),'foreignKey':_0x1a07('0x119')});db['User'][_0x1a07('0x11b')](db[_0x1a07('0x101')],{'as':'UserNotifications','foreignKey':_0x1a07('0x127')});db[_0x1a07('0x115')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x1a07('0x115')]['belongsToMany'](db['ChatGroup'],{'as':_0x1a07('0x128'),'through':_0x1a07('0x129')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x71')],{'as':_0x1a07('0x12b'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0x1a07('0x12c')],{'as':'Lists','through':_0x1a07('0x12d')});db[_0x1a07('0x115')]['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x12e')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x40')],{'as':'MailInteractions','through':_0x1a07('0x12f')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'through':_0x1a07('0x130')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'through':_0x1a07('0x131')});db['User'][_0x1a07('0x12a')](db['SmsInteraction'],{'as':_0x1a07('0x122'),'through':_0x1a07('0x132')});db[_0x1a07('0x115')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x1a07('0x133')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x125')],{'as':_0x1a07('0x126'),'through':_0x1a07('0x134')});db[_0x1a07('0x115')]['belongsToMany'](db[_0x1a07('0x19')],{'as':'VoiceQueues','through':_0x1a07('0x135'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['VoicePrefix'],{'as':_0x1a07('0x136'),'through':'UserVoicePrefix','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x3d')],{'as':_0x1a07('0x137'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db[_0x1a07('0x6c')],{'as':_0x1a07('0x138'),'through':_0x1a07('0x2c'),'required':![],'hooks':!![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['FaxQueue'],{'as':'FaxQueues','through':_0x1a07('0x30'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x5b')],{'as':_0x1a07('0x139'),'through':'UserSmsQueue','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x64')],{'as':_0x1a07('0x13a'),'through':'UserOpenchannelQueue','required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x10b')],{'as':_0x1a07('0x13b'),'through':_0x1a07('0x35'),'required':![]});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x1a07('0x66')],{'as':'ChatWebsites','through':_0x1a07('0x13c')});db['User'][_0x1a07('0x12a')](db[_0x1a07('0x13d')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x13e'),'through':_0x1a07('0x13f')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db[_0x1a07('0x5c')],{'as':'OpenchannelAccounts','through':_0x1a07('0x140')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x1a07('0x141')});db[_0x1a07('0x115')][_0x1a07('0x12a')](db['WhatsappAccount'],{'as':_0x1a07('0x142'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy']['hasMany'](db[_0x1a07('0x16')],{'as':_0x1a07('0x143'),'onDelete':'cascade','foreignKey':_0x1a07('0x144')});db[_0x1a07('0x13')][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'onDelete':'cascade'});db[_0x1a07('0x16')]['hasMany'](db[_0x1a07('0x16')],{'as':_0x1a07('0x145'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x17')][_0x1a07('0x12a')](db['Sound'],{'as':_0x1a07('0x146'),'through':'moh_has_sounds'});db[_0x1a07('0x19')]['hasMany'](db[_0x1a07('0x29')],{'as':_0x1a07('0x147'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':_0x1a07('0x149'),'foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x77')],{'as':'HopperFinals','foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db['CmHopperHistory'],{'as':_0x1a07('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x75')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x1a07('0x19')][_0x1a07('0x11b')](db[_0x1a07('0x14b')],{'as':_0x1a07('0x14c'),'foreignKey':_0x1a07('0x148')});db[_0x1a07('0x19')]['belongsTo'](db[_0x1a07('0x26')],{'as':_0x1a07('0x26'),'foreignKey':_0x1a07('0x14d')});db[_0x1a07('0x19')]['belongsTo'](db[_0x1a07('0x26')],{'as':_0x1a07('0x14e'),'foreignKey':_0x1a07('0x14f')});db['VoiceQueue'][_0x1a07('0x150')](db['Interval'],{'as':_0x1a07('0x85'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x19')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x19')]['belongsToMany'](db[_0x1a07('0x12c')],{'as':_0x1a07('0x154'),'through':'voice_queues_has_cm_lists'});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x135')});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'as':'Teams','through':_0x1a07('0x155')});db[_0x1a07('0x19')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x156'),'through':_0x1a07('0x157')});db[_0x1a07('0x1b')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x115'),'foreignKey':'UserId'});db[_0x1a07('0x1d')]['belongsTo'](db[_0x1a07('0x115')],{'as':_0x1a07('0x115'),'foreignKey':'UserId'});db[_0x1a07('0x117')][_0x1a07('0x11b')](db[_0x1a07('0x158')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':'mailboxuser','sourceKey':_0x1a07('0x15a')});db[_0x1a07('0x158')][_0x1a07('0x150')](db[_0x1a07('0x117')],{'foreignKey':_0x1a07('0x15b'),'targetKey':_0x1a07('0x15a')});db[_0x1a07('0x20')][_0x1a07('0x11b')](db[_0x1a07('0x24')],{'as':_0x1a07('0x15c'),'foreignKey':_0x1a07('0x15d'),'constraints':![]});db[_0x1a07('0x20')][_0x1a07('0x11b')](db[_0x1a07('0x15e')],{'as':_0x1a07('0x15f'),'foreignKey':_0x1a07('0x15d'),'constraints':![]});db[_0x1a07('0x20')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':'User','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x20')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x37')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x1a07('0x37')][_0x1a07('0x150')](db[_0x1a07('0x10d')],{'as':_0x1a07('0x10d'),'foreignKey':'CloudProviderId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x39')][_0x1a07('0x150')](db['MailAccount'],{'as':_0x1a07('0x3b'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x39')]['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x1a07('0x164'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x3b')][_0x1a07('0x116')](db[_0x1a07('0x37')],{'as':'Imap','onDelete':_0x1a07('0x118')});db[_0x1a07('0x3b')][_0x1a07('0x116')](db[_0x1a07('0x39')],{'as':_0x1a07('0x165'),'onDelete':'cascade'});db[_0x1a07('0x3b')]['hasMany'](db['Disposition'],{'as':_0x1a07('0x166'),'foreignKey':'MailAccountId','onDelete':_0x1a07('0x118')});db['MailAccount']['hasMany'](db[_0x1a07('0x82')],{'as':'Answers','foreignKey':_0x1a07('0x163')});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db[_0x1a07('0x42')],{'as':_0x1a07('0x159'),'foreignKey':'MailAccountId'});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x167')});db[_0x1a07('0x3b')][_0x1a07('0x11b')](db['MailApplication'],{'as':_0x1a07('0x145')});db[_0x1a07('0x3b')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':'List','foreignKey':_0x1a07('0x168')});db['MailAccount'][_0x1a07('0x150')](db[_0x1a07('0x94')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x3b')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x13f')});db[_0x1a07('0x3d')]['belongsToMany'](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x2e')});db[_0x1a07('0x3d')][_0x1a07('0x12a')](db['Team'],{'through':_0x1a07('0x16a'),'as':'Teams'});db[_0x1a07('0x40')]['hasMany'](db[_0x1a07('0x42')],{'as':_0x1a07('0x159'),'onDelete':'cascade','foreignKey':_0x1a07('0x16b')});db[_0x1a07('0x40')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x40')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x40')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':'UserId'});db['MailInteraction'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x16e'),'as':'Tags'});db['MailInteraction'][_0x1a07('0x12a')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x40')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x12f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x1a07('0x11b')](db[_0x1a07('0xf0')],{'as':_0x1a07('0x171'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x42')][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x115')});db['MailMessage'][_0x1a07('0x150')](db['CmContact'],{'onDelete':'cascade','as':_0x1a07('0x160')});db[_0x1a07('0x42')][_0x1a07('0x150')](db[_0x1a07('0x40')],{'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x16b')});db['MailMessage'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'as':_0x1a07('0x16c'),'foreignKey':'MailAccountId'});db[_0x1a07('0x42')]['belongsTo'](db[_0x1a07('0x66')],{'as':_0x1a07('0x66'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x42')][_0x1a07('0x150')](db['ChatOfflineMessage'],{'as':_0x1a07('0x6a'),'foreignKey':_0x1a07('0x174')});db['MailApplication']['belongsTo'](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x175')][_0x1a07('0x150')](db[_0x1a07('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'onDelete':'restrict'});db[_0x1a07('0x175')][_0x1a07('0x150')](db[_0x1a07('0x85')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x175')][_0x1a07('0x150')](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x45')]['belongsTo'](db[_0x1a07('0x3b')],{});db[_0x1a07('0x45')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x45')][_0x1a07('0x150')](db[_0x1a07('0x40')],{});db[_0x1a07('0x45')]['belongsTo'](db['MailMessage'],{});db[_0x1a07('0x45')][_0x1a07('0x150')](db['User'],{});db[_0x1a07('0x45')]['belongsTo'](db[_0x1a07('0x3d')],{});db['Dashboard'][_0x1a07('0x11b')](db[_0x1a07('0x178')],{'as':_0x1a07('0x179'),'onDelete':'cascade'});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x1a07('0x17a'),'onDelete':_0x1a07('0x118')});db['FaxAccount'][_0x1a07('0x11b')](db['CannedAnswer'],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x167')});db[_0x1a07('0x13d')][_0x1a07('0x11b')](db[_0x1a07('0x4a')],{'as':_0x1a07('0x145')});db[_0x1a07('0x13d')]['hasMany'](db[_0x1a07('0x16')],{'as':'Exntensions','onDelete':_0x1a07('0x118')});db[_0x1a07('0x13d')]['hasMany'](db[_0x1a07('0x4e')],{'as':'Messages'});db['FaxAccount'][_0x1a07('0x150')](db[_0x1a07('0x26')],{'as':'Trunk'});db[_0x1a07('0x13d')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x13d')][_0x1a07('0x150')](db['Pause'],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x13d')]['belongsToMany'](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x17c')});db[_0x1a07('0x4a')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x4a')]['belongsTo'](db[_0x1a07('0x50')],{'onDelete':_0x1a07('0x162')});db['FaxApplication']['belongsTo'](db[_0x1a07('0x13d')],{'onDelete':_0x1a07('0x162')});db['FaxApplication'][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db['FaxInteraction'][_0x1a07('0x11b')](db['FaxMessage'],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':'FaxInteractionId'});db[_0x1a07('0x4c')]['belongsTo'](db[_0x1a07('0x13d')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x4c')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x17d'),'as':_0x1a07('0x17e')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'fax_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x4c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x131'),'foreignKey':_0x1a07('0x17f')});db[_0x1a07('0x4e')][_0x1a07('0x150')](db['User'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db[_0x1a07('0x4e')]['belongsTo'](db[_0x1a07('0x4c')],{'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x17f')});db[_0x1a07('0x4e')]['belongsTo'](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db['FaxMessage']['belongsTo'](db[_0x1a07('0xf0')],{'as':'Attachment','foreignKey':_0x1a07('0x180')});db[_0x1a07('0x4e')][_0x1a07('0x150')](db['FaxAccount'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x17a')});db[_0x1a07('0x50')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':'UserFaxQueue'});db[_0x1a07('0x50')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':'team_has_fax_queues','as':_0x1a07('0x181')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x13d')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':'Contact','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x4c')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db['FaxMessage'],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db[_0x1a07('0x52')][_0x1a07('0x150')](db[_0x1a07('0x50')],{});db[_0x1a07('0x54')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x182'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x182')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x59')],{'as':_0x1a07('0x159'),'foreignKey':_0x1a07('0x182')});db[_0x1a07('0x54')]['hasMany'](db[_0x1a07('0x57')],{'as':_0x1a07('0x167')});db[_0x1a07('0x54')][_0x1a07('0x11b')](db[_0x1a07('0x55')],{'as':_0x1a07('0x145')});db['SmsAccount'][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':'List','foreignKey':_0x1a07('0x168')});db['SmsAccount'][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x54')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x141')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x5b')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x55')][_0x1a07('0x150')](db['Interval'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x151')});db['SmsApplication'][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db['SmsInteraction'][_0x1a07('0x11b')](db[_0x1a07('0x59')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x183')});db[_0x1a07('0x57')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'as':'Account','foreignKey':_0x1a07('0x182')});db[_0x1a07('0x57')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db['SmsInteraction'][_0x1a07('0x150')](db['User'],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x57')]['belongsToMany'](db['Tag'],{'through':_0x1a07('0x184'),'as':_0x1a07('0x17e')});db[_0x1a07('0x57')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x184'),'as':'ThroughTags'});db[_0x1a07('0x57')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':'user_has_sms_interactions','foreignKey':_0x1a07('0x183')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x115')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db[_0x1a07('0x59')][_0x1a07('0x150')](db[_0x1a07('0x57')],{'onDelete':_0x1a07('0x118'),'as':'Interaction','foreignKey':_0x1a07('0x183')});db[_0x1a07('0x59')][_0x1a07('0x150')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1a07('0x182')});db[_0x1a07('0x5b')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x32'),'foreignKey':_0x1a07('0x185')});db['SmsQueue']['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x186'),'as':'Teams'});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x187'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x1a07('0x11b')](db['OpenchannelInteraction'],{'as':_0x1a07('0x167'),'foreignKey':_0x1a07('0x187')});db[_0x1a07('0x5c')][_0x1a07('0x11b')](db[_0x1a07('0x62')],{'as':_0x1a07('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x1a07('0x5c')]['hasMany'](db[_0x1a07('0x5e')],{'as':'Applications','foreignKey':_0x1a07('0x187')});db['OpenchannelAccount']['belongsTo'](db[_0x1a07('0x12c')],{'as':'List','foreignKey':'ListId'});db[_0x1a07('0x5c')][_0x1a07('0x150')](db['Pause'],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x5c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x140')});db[_0x1a07('0x5e')]['belongsTo'](db[_0x1a07('0x115')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db[_0x1a07('0x64')],{'onDelete':_0x1a07('0x162'),'foreignKey':'OpenchannelQueueId'});db[_0x1a07('0x5e')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x187')});db[_0x1a07('0x5e')]['belongsTo'](db[_0x1a07('0x85')],{'onDelete':'restrict','foreignKey':_0x1a07('0x151')});db[_0x1a07('0x5e')]['belongsTo'](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x60')][_0x1a07('0x11b')](db[_0x1a07('0x62')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x1a07('0x188')});db[_0x1a07('0x60')]['belongsTo'](db[_0x1a07('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x1a07('0x60')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x1a07('0x119')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x189'),'as':_0x1a07('0x17e')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x1a07('0x16f')});db['OpenchannelInteraction'][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x170'),'through':_0x1a07('0x133'),'foreignKey':_0x1a07('0x188')});db[_0x1a07('0x62')][_0x1a07('0x150')](db['User'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db[_0x1a07('0x62')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160')});db[_0x1a07('0x62')][_0x1a07('0x150')](db['OpenchannelInteraction'],{'onDelete':_0x1a07('0x118'),'as':'Interaction','foreignKey':_0x1a07('0x188')});db[_0x1a07('0x62')][_0x1a07('0x150')](db[_0x1a07('0xf0')],{'as':_0x1a07('0xf0'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x1a07('0x150')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x1a07('0x187')});db['OpenchannelQueue'][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':'Agents','through':_0x1a07('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x1a07('0x64')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':_0x1a07('0x18a'),'as':_0x1a07('0x181')});db[_0x1a07('0x66')]['hasMany'](db[_0x1a07('0x83')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x1a07('0x118')});db[_0x1a07('0x66')][_0x1a07('0x11b')](db['CannedAnswer'],{'as':_0x1a07('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x1a07('0x11b')](db[_0x1a07('0x6f')],{'as':_0x1a07('0x18b')});db['ChatWebsite'][_0x1a07('0x11b')](db[_0x1a07('0x120')],{'as':_0x1a07('0x167')});db[_0x1a07('0x66')][_0x1a07('0x11b')](db[_0x1a07('0x18c')],{'as':_0x1a07('0x145')});db['ChatWebsite']['hasMany'](db[_0x1a07('0x18d')],{'as':'Messages'});db[_0x1a07('0x66')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':'ListId'});db[_0x1a07('0x66')]['belongsTo'](db[_0x1a07('0x85')],{'as':_0x1a07('0x85'),'foreignKey':_0x1a07('0x151')});db['ChatWebsite'][_0x1a07('0x150')](db['MailAccount'],{'as':_0x1a07('0x3b'),'foreignKey':_0x1a07('0x163')});db[_0x1a07('0x66')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a07('0x153')});db[_0x1a07('0x66')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x169'),'through':'user_has_chat_websites'});db[_0x1a07('0x18e')][_0x1a07('0x150')](db['OpenchannelAccount'],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x18e')]['belongsTo'](db[_0x1a07('0x60')],{});db[_0x1a07('0x18e')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db[_0x1a07('0x18e')][_0x1a07('0x150')](db[_0x1a07('0x64')],{});db['ChatApplication'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x18f'),'foreignKey':_0x1a07('0x119'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x18c')][_0x1a07('0x150')](db[_0x1a07('0x6c')],{'as':_0x1a07('0x190'),'foreignKey':_0x1a07('0x191'),'onDelete':_0x1a07('0x162')});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x1a07('0x173'),'onDelete':'restrict'});db[_0x1a07('0x18c')][_0x1a07('0x150')](db[_0x1a07('0x8e')],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x120')][_0x1a07('0x11b')](db[_0x1a07('0x18d')],{'as':_0x1a07('0x159'),'onDelete':'cascade','foreignKey':_0x1a07('0x192')});db[_0x1a07('0x120')][_0x1a07('0x150')](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x120')]['belongsTo'](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x120')]['belongsTo'](db[_0x1a07('0x115')],{'as':_0x1a07('0x16d'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x193'),'as':_0x1a07('0x17e')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x1a07('0x16f')});db[_0x1a07('0x120')][_0x1a07('0x12a')](db['User'],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x1a07('0x18d')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x115')});db['ChatMessage'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x18d')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x172'),'foreignKey':'ChatInteractionId'});db[_0x1a07('0x18d')][_0x1a07('0x150')](db[_0x1a07('0xf0')],{'as':_0x1a07('0xf0'),'foreignKey':_0x1a07('0x180')});db['ChatMessage']['belongsTo'](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x1a07('0x6a')][_0x1a07('0x11b')](db[_0x1a07('0xf0')],{'as':_0x1a07('0x171'),'foreignKey':_0x1a07('0x174'),'onDelete':'cascade','hooks':!![]});db[_0x1a07('0x6a')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x6a')][_0x1a07('0x150')](db[_0x1a07('0x66')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x173')});db[_0x1a07('0x6c')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x2c'),'hooks':!![]});db[_0x1a07('0x6c')]['belongsToMany'](db[_0x1a07('0xe8')],{'through':_0x1a07('0x194'),'as':_0x1a07('0x181')});db[_0x1a07('0x6d')][_0x1a07('0x11b')](db[_0x1a07('0x195')],{'as':'Messages','foreignKey':_0x1a07('0x196'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x6d')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x147'),'through':'chat_group_has_users'});db[_0x1a07('0x6f')][_0x1a07('0x150')](db['ChatWebsite'],{'as':_0x1a07('0x197'),'foreignKey':_0x1a07('0x173')});db['CmCompany'][_0x1a07('0x11b')](db['CmContact'],{'as':_0x1a07('0x12b'),'foreignKey':_0x1a07('0x198')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['CmContactHasItem'],{'as':_0x1a07('0x199'),'foreignKey':'CmContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':'Hoppers','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['CmHopperFinal'],{'as':_0x1a07('0x11e'),'foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x14a'),'foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['ReportAgentPreview'],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x14b')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db['OpenchannelInteraction'],{'as':_0x1a07('0x11f'),'foreignKey':'ContactId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x120')],{'as':_0x1a07('0x121'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db['CmContact'][_0x1a07('0x11b')](db['SmsInteraction'],{'as':_0x1a07('0x122'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x4c')],{'as':_0x1a07('0x123'),'foreignKey':_0x1a07('0x161'),'onDelete':'restrict'});db[_0x1a07('0x71')][_0x1a07('0x11b')](db[_0x1a07('0x40')],{'as':_0x1a07('0x124'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x71')][_0x1a07('0x150')](db['CmCompany'],{'as':_0x1a07('0x19a'),'foreignKey':_0x1a07('0x198')});db[_0x1a07('0x71')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x71')][_0x1a07('0x12a')](db['User'],{'as':_0x1a07('0x170'),'through':_0x1a07('0x19b')});db[_0x1a07('0x71')]['belongsToMany'](db['Tag'],{'as':_0x1a07('0x17e'),'through':'cm_contact_has_tags'});db[_0x1a07('0x71')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x19c'),'as':_0x1a07('0x16f')});db[_0x1a07('0x73')]['hasMany'](db[_0x1a07('0x92')],{'as':_0x1a07('0x19d'),'foreignKey':_0x1a07('0x19e')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')]['belongsTo'](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x18f'),'foreignKey':_0x1a07('0x119')});db[_0x1a07('0x73')][_0x1a07('0x150')](db[_0x1a07('0x19')],{'as':_0x1a07('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')][_0x1a07('0x150')](db['Campaign'],{'as':_0x1a07('0xec'),'foreignKey':_0x1a07('0x19f'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x73')]['belongsTo'](db[_0x1a07('0x115')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x75')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x75')][_0x1a07('0x150')](db[_0x1a07('0x19')],{'as':'Queue','foreignKey':_0x1a07('0x148'),'onDelete':'cascade'});db[_0x1a07('0x75')][_0x1a07('0x150')](db[_0x1a07('0xec')],{'as':_0x1a07('0xec'),'foreignKey':_0x1a07('0x19f'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x80')][_0x1a07('0x11b')](db[_0x1a07('0x1a0')],{'as':{'plural':'All','singular':_0x1a07('0x1a1')},'foreignKey':_0x1a07('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x1a07('0x80')][_0x1a07('0x11b')](db[_0x1a07('0x1a0')],{'as':{'plural':'Any','singular':_0x1a07('0x1a3')},'foreignKey':_0x1a07('0x1a4'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x80')]['hasMany'](db[_0x1a07('0x7e')],{'as':_0x1a07('0x1a5'),'foreignKey':_0x1a07('0x1a6'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x83')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x1a7'),'onDelete':_0x1a07('0x118')});db['Interval'][_0x1a07('0x11b')](db['Interval'],{'as':_0x1a07('0x1a8'),'foreignKey':_0x1a07('0x151'),'onDelete':_0x1a07('0x118'),'hooks':!![],'required':![]});db['Interval'][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x1a07('0x162')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x1a07('0x151')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x18c')],{'as':_0x1a07('0x1a9'),'foreignKey':'IntervalId'});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x4a')],{'as':_0x1a07('0x1aa'),'foreignKey':_0x1a07('0x151')});db[_0x1a07('0x85')][_0x1a07('0x11b')](db[_0x1a07('0x55')],{'as':_0x1a07('0x1ab'),'foreignKey':_0x1a07('0x151')});db['Schedule'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{});db[_0x1a07('0x8c')][_0x1a07('0x150')](db[_0x1a07('0x9c')],{'foreignKey':_0x1a07('0x1ac')});db[_0x1a07('0x8c')][_0x1a07('0x150')](db[_0x1a07('0x9a')],{'foreignKey':_0x1a07('0x1ad')});db[_0x1a07('0x1ae')][_0x1a07('0x12a')](db[_0x1a07('0x17')],{'as':_0x1a07('0x1af'),'through':_0x1a07('0x1b0'),'onDelete':'restrict'});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x71')],{'through':_0x1a07('0x19c')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x120')],{'through':_0x1a07('0x193')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x1a07('0x12a')](db[_0x1a07('0x57')],{'through':_0x1a07('0x184')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db[_0x1a07('0x4c')],{'through':_0x1a07('0x17d')});db[_0x1a07('0x8e')][_0x1a07('0x12a')](db['OpenchannelInteraction'],{'through':_0x1a07('0x189')});db[_0x1a07('0x8e')]['belongsToMany'](db[_0x1a07('0x125')],{'through':_0x1a07('0x1b1')});db[_0x1a07('0x91')][_0x1a07('0x150')](db[_0x1a07('0x8f')],{'as':_0x1a07('0x1b2'),'foreignKey':_0x1a07('0x1b3')});db[_0x1a07('0x92')][_0x1a07('0x150')](db['CmHopper'],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x1a07('0x91')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x1b4')});db[_0x1a07('0x96')]['hasMany'](db[_0x1a07('0x1a0')],{'as':{'plural':'AllConditions','singular':_0x1a07('0x1b5')},'foreignKey':'TriggerAllId','onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x96')]['hasMany'](db[_0x1a07('0x1a0')],{'as':{'plural':'AnyConditions','singular':_0x1a07('0x1b6')},'foreignKey':_0x1a07('0x1b7'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x96')][_0x1a07('0x11b')](db[_0x1a07('0x7e')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x1a07('0x9a')][_0x1a07('0x11b')](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a07('0x1ad'),'hooks':!![]});db[_0x1a07('0x9c')]['hasMany'](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1ac')});db[_0x1a07('0xa0')][_0x1a07('0x11b')](db[_0x1a07('0xa1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1b9')});db[_0x1a07('0xa1')]['belongsTo'](db[_0x1a07('0xa0')],{'foreignKey':_0x1a07('0x1b9')});db['SalesforceAccount'][_0x1a07('0x11b')](db[_0x1a07('0xa7')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xa7')][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1bd'),'onDelete':'cascade','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xa7')]['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db['SalesforceConfiguration'][_0x1a07('0x150')](db[_0x1a07('0xa5')],{'as':_0x1a07('0x16c'),'foreignKey':'AccountId'});db['SalesforceField'][_0x1a07('0x11b')](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xa9')]['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db['SalesforceField']['hasMany'](db[_0x1a07('0xa9')],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db['SalesforceField'][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x1a07('0x11b')](db[_0x1a07('0xab')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db[_0x1a07('0xab')]['hasMany'](db[_0x1a07('0x1c5')],{'as':'Subjects','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xab')][_0x1a07('0x11b')](db['SugarcrmField'],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xab')][_0x1a07('0x150')](db['SugarcrmAccount'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1c5')]['hasMany'](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1c5')]['hasMany'](db[_0x1a07('0x1c5')],{'as':'Description','foreignKey':_0x1a07('0x1be')});db['SugarcrmField'][_0x1a07('0x11b')](db[_0x1a07('0x1c5')],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1c5')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xad')][_0x1a07('0x11b')](db[_0x1a07('0xaf')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db['DeskConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':'SubjectId'});db[_0x1a07('0xaf')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xaf')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xaf')][_0x1a07('0x150')](db[_0x1a07('0xad')],{'as':'Account','foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xaf')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':_0x1a07('0x1c7')});db['DeskField']['hasMany'](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xb1')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xb1')][_0x1a07('0x11b')](db[_0x1a07('0xb1')],{'as':_0x1a07('0x1c3'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x1a07('0x1c4')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a07('0xb3')][_0x1a07('0x11b')](db[_0x1a07('0x1c8')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1c8')][_0x1a07('0x11b')](db['ZohoField'],{'as':'Subjects','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1c8')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':'Descriptions','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db['ZohoConfiguration'][_0x1a07('0x11b')](db['ZohoField'],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db['ZohoConfiguration'][_0x1a07('0x150')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xb5')][_0x1a07('0x11b')](db[_0x1a07('0xb5')],{'as':'Field','foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xb5')][_0x1a07('0x150')](db['Variable'],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0x1c9')]['hasMany'](db[_0x1a07('0xb8')],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xb8')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1bc'),'foreignKey':'SubjectId'});db[_0x1a07('0xb8')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1bd'),'foreignKey':'DescriptionId'});db[_0x1a07('0xb8')]['hasMany'](db['ZendeskField'],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db['ZendeskConfiguration'][_0x1a07('0x150')](db[_0x1a07('0x1c9')],{'as':_0x1a07('0x16c'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xba')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xba')][_0x1a07('0x11b')](db[_0x1a07('0xba')],{'as':_0x1a07('0x1c3'),'foreignKey':'FieldId'});db[_0x1a07('0xba')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xbc')][_0x1a07('0x11b')](db[_0x1a07('0xbe')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1bc'),'onDelete':'cascade','foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':'DescriptionId'});db[_0x1a07('0xbe')][_0x1a07('0x11b')](db['FreshdeskField'],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xbe')]['belongsTo'](db[_0x1a07('0xbc')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a07('0xbe')]['belongsToMany'](db[_0x1a07('0x8e')],{'through':_0x1a07('0x1ca')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':'Description','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xc0')][_0x1a07('0x11b')](db[_0x1a07('0xc0')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a07('0xc0')][_0x1a07('0x150')](db['Variable'],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1cb')][_0x1a07('0x11b')](db[_0x1a07('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x1a07('0x1cb')]['hasMany'](db[_0x1a07('0xc4')],{'as':_0x1a07('0x1bd'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0x1cb')][_0x1a07('0x11b')](db['VtigerField'],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1cb')][_0x1a07('0x150')](db[_0x1a07('0xc1')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xc4')][_0x1a07('0x11b')](db[_0x1a07('0xc4')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db['VtigerField'][_0x1a07('0x11b')](db['VtigerField'],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xc4')]['hasMany'](db['VtigerField'],{'as':_0x1a07('0x1c3'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xc4')][_0x1a07('0x150')](db['Variable'],{'as':'Variable','foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xc6')]['hasMany'](db[_0x1a07('0x1cc')],{'as':'Configurations','onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0x1cc')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1bc'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0x1cc')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1bd'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db[_0x1a07('0xc9')],{'as':'Fields','foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0x1cc')][_0x1a07('0x150')](db[_0x1a07('0xc6')],{'as':'Account','foreignKey':'AccountId'});db[_0x1a07('0xc9')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':_0x1a07('0x1c0'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xc9')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a07('0xc9')][_0x1a07('0x11b')](db[_0x1a07('0xc9')],{'as':'Field','foreignKey':'FieldId'});db['ServicenowField']['belongsTo'](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':'VariableId'});db[_0x1a07('0xcb')][_0x1a07('0x11b')](db[_0x1a07('0xcc')],{'as':_0x1a07('0x1ba'),'onDelete':'cascade','foreignKey':_0x1a07('0x1bb')});db['Dynamics365Account'][_0x1a07('0x150')](db[_0x1a07('0x10d')],{'as':_0x1a07('0x10d'),'foreignKey':_0x1a07('0x164')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db['Dynamics365Field'],{'as':_0x1a07('0x1bc'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1bd'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xcc')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1b8'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xcc')][_0x1a07('0x150')](db['Dynamics365Account'],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db['Dynamics365Field'][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':_0x1a07('0x1c0'),'foreignKey':'SubjectId'});db[_0x1a07('0xce')][_0x1a07('0x11b')](db['Dynamics365Field'],{'as':_0x1a07('0x1c2'),'foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xce')][_0x1a07('0x11b')](db[_0x1a07('0xce')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a07('0xce')][_0x1a07('0x150')](db[_0x1a07('0x1c4')],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xd0')][_0x1a07('0x11b')](db['FreshsalesConfiguration'],{'as':_0x1a07('0x1ba'),'onDelete':_0x1a07('0x118'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':_0x1a07('0x1bc'),'foreignKey':_0x1a07('0x1c1')});db[_0x1a07('0xd2')][_0x1a07('0x11b')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x1a07('0x1be')});db['FreshsalesConfiguration'][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':_0x1a07('0x1b8'),'foreignKey':_0x1a07('0x1bf')});db[_0x1a07('0xd2')][_0x1a07('0x150')](db[_0x1a07('0xd0')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1bb')});db[_0x1a07('0xd4')]['hasMany'](db[_0x1a07('0xd4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1a07('0xd4')][_0x1a07('0x11b')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x1a07('0x1be')});db[_0x1a07('0xd4')][_0x1a07('0x11b')](db[_0x1a07('0xd4')],{'as':'Field','foreignKey':_0x1a07('0x1bf')});db['FreshsalesField'][_0x1a07('0x150')](db['Variable'],{'as':_0x1a07('0x1c4'),'foreignKey':_0x1a07('0x1c6')});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x66')],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':'ContactId'});db[_0x1a07('0xd7')][_0x1a07('0x150')](db['ChatInteraction'],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x18d')],{});db[_0x1a07('0xd7')]['belongsTo'](db['User'],{});db[_0x1a07('0xd7')][_0x1a07('0x150')](db[_0x1a07('0x6c')],{});db[_0x1a07('0x195')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1cd')});db[_0x1a07('0x195')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1ce')});db[_0x1a07('0x14b')][_0x1a07('0x11b')](db[_0x1a07('0x1cf')],{'foreignKey':_0x1a07('0x1d0'),'onDelete':'cascade'});db[_0x1a07('0x14b')][_0x1a07('0x11b')](db[_0x1a07('0xd8')],{'foreignKey':_0x1a07('0x1d0'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['SmsAccount'],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['CmContact'],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0xdc')][_0x1a07('0x150')](db[_0x1a07('0x57')],{});db['SmsQueueReport'][_0x1a07('0x150')](db[_0x1a07('0x59')],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db['User'],{});db[_0x1a07('0xdc')][_0x1a07('0x150')](db[_0x1a07('0x5b')],{});db[_0x1a07('0xe0')]['hasMany'](db[_0x1a07('0x14b')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe0')][_0x1a07('0x11b')](db[_0x1a07('0x1cf')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe0')]['hasMany'](db[_0x1a07('0xd8')],{'foreignKey':_0x1a07('0x1d1')});db[_0x1a07('0xe8')]['belongsToMany'](db['User'],{'as':_0x1a07('0x169'),'through':_0x1a07('0x12e')});db[_0x1a07('0xe8')][_0x1a07('0x12a')](db[_0x1a07('0x19')],{'through':'TeamVoiceQueue','as':_0x1a07('0x1d2')});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x3d')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x1a07('0xe8')]['belongsToMany'](db['ChatQueue'],{'through':_0x1a07('0x194'),'as':_0x1a07('0x138')});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x50')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x1a07('0xe8')]['belongsToMany'](db[_0x1a07('0x5b')],{'through':_0x1a07('0x186'),'as':_0x1a07('0x139')});db['Team'][_0x1a07('0x12a')](db[_0x1a07('0x64')],{'through':_0x1a07('0x18a'),'as':_0x1a07('0x13a')});db[_0x1a07('0xe8')][_0x1a07('0x12a')](db[_0x1a07('0x10b')],{'through':_0x1a07('0x1d3'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0x1a07('0x1d4')],{'through':'TeamVoicePrefix','as':_0x1a07('0x136')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x73')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x1a07('0xec')][_0x1a07('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x1a07('0x19f')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x14a'),'foreignKey':_0x1a07('0x19f')});db[_0x1a07('0xec')][_0x1a07('0x11b')](db[_0x1a07('0x75')],{'as':_0x1a07('0x1d5'),'foreignKey':'CampaignId'});db[_0x1a07('0xec')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x1a07('0xec')]['belongsTo'](db['Trunk'],{'as':_0x1a07('0x14e'),'foreignKey':_0x1a07('0x14f')});db[_0x1a07('0xec')][_0x1a07('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x1a07('0x151')});db[_0x1a07('0xec')][_0x1a07('0x150')](db[_0x1a07('0xe3')],{'as':_0x1a07('0xe3'),'foreignKey':_0x1a07('0x1d6')});db[_0x1a07('0xec')][_0x1a07('0x12a')](db['CmList'],{'as':_0x1a07('0x154'),'through':_0x1a07('0x1d7')});db[_0x1a07('0xec')][_0x1a07('0x12a')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x156'),'through':'campaigns_has_cm_blacklists'});db[_0x1a07('0xf0')][_0x1a07('0x150')](db[_0x1a07('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x1a07('0x174')});db['MailTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x42')],{});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x40')],{});db['MailTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'foreignKey':_0x1a07('0x1d9'),'as':_0x1a07('0x1da')});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db['User'],{'foreignKey':'FromUserId','as':_0x1a07('0x1db')});db[_0x1a07('0x1d8')]['belongsTo'](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x3d')],{'foreignKey':_0x1a07('0x1de'),'as':'ToQueue'});db[_0x1a07('0x1d8')][_0x1a07('0x150')](db[_0x1a07('0x3b')],{'foreignKey':_0x1a07('0x1df'),'as':'ToAccount'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x18d')],{});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x120')],{});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatWebsite'],{'foreignKey':_0x1a07('0x1e1'),'as':_0x1a07('0x1da')});db['ChatTransferReport'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':'ToAgent'});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x1a07('0x1e2')});db[_0x1a07('0x1e0')][_0x1a07('0x150')](db['ChatWebsite'],{'foreignKey':_0x1a07('0x1e3'),'as':_0x1a07('0x1e4')});db[_0x1a07('0xf5')]['belongsTo'](db[_0x1a07('0x4e')],{});db[_0x1a07('0xf5')][_0x1a07('0x150')](db[_0x1a07('0x4c')],{});db[_0x1a07('0xf5')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x1a07('0x1e5'),'as':_0x1a07('0x1da')});db['FaxTransferReport'][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':'FromAgent'});db[_0x1a07('0xf5')][_0x1a07('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x1a07('0x1dd')});db[_0x1a07('0xf5')][_0x1a07('0x150')](db[_0x1a07('0x50')],{'foreignKey':_0x1a07('0x1e7'),'as':_0x1a07('0x1e2')});db['FaxTransferReport'][_0x1a07('0x150')](db['FaxAccount'],{'foreignKey':_0x1a07('0x1e8'),'as':_0x1a07('0x1e4')});db[_0x1a07('0xf6')]['belongsTo'](db[_0x1a07('0x62')],{});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x60')],{});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'foreignKey':_0x1a07('0x1e9'),'as':_0x1a07('0x1da')});db[_0x1a07('0xf6')]['belongsTo'](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x64')],{'foreignKey':_0x1a07('0x1ea'),'as':_0x1a07('0x1e2')});db[_0x1a07('0xf6')][_0x1a07('0x150')](db[_0x1a07('0x5c')],{'foreignKey':'ToOpenchannelAccountId','as':_0x1a07('0x1e4')});db[_0x1a07('0xf8')]['belongsTo'](db[_0x1a07('0x59')],{});db[_0x1a07('0xf8')][_0x1a07('0x150')](db[_0x1a07('0x57')],{});db[_0x1a07('0xf8')][_0x1a07('0x150')](db['SmsAccount'],{'foreignKey':_0x1a07('0x1eb'),'as':'FromAccount'});db[_0x1a07('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0xf8')][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db[_0x1a07('0xf8')]['belongsTo'](db[_0x1a07('0x5b')],{'foreignKey':'ToSmsQueueId','as':_0x1a07('0x1e2')});db[_0x1a07('0xf8')][_0x1a07('0x150')](db[_0x1a07('0x54')],{'foreignKey':_0x1a07('0x1ec'),'as':'ToAccount'});db[_0x1a07('0x12c')]['hasMany'](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x168'),'onDelete':_0x1a07('0x118')});db['CmList']['hasMany'](db[_0x1a07('0x7c')],{'as':_0x1a07('0x1ed'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')]['hasMany'](db['CmContact'],{'as':_0x1a07('0x12b'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x77')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x79')],{'as':_0x1a07('0x1ee'),'foreignKey':'ListId'});db[_0x1a07('0x12c')][_0x1a07('0x11b')](db[_0x1a07('0x7a')],{'as':_0x1a07('0x7a'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x12c')]['belongsToMany'](db[_0x1a07('0x19')],{'as':_0x1a07('0x1ef'),'through':_0x1a07('0x1f0')});db[_0x1a07('0x12c')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x12d')});db[_0x1a07('0x1d4')][_0x1a07('0x11b')](db[_0x1a07('0x16')],{'as':_0x1a07('0x11d'),'onDelete':'cascade'});db[_0x1a07('0x1d4')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x111')});db[_0x1a07('0x1d4')][_0x1a07('0x12a')](db[_0x1a07('0xe8')],{'through':_0x1a07('0x10f'),'as':_0x1a07('0x181')});db[_0x1a07('0xfc')][_0x1a07('0x11b')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x1a07('0xfc')][_0x1a07('0x11b')](db['UserProfileSection'],{'as':_0x1a07('0x1f1'),'foreignKey':_0x1a07('0x1f2'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x1f3')]['hasMany'](db[_0x1a07('0xff')],{'as':_0x1a07('0x1f4'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x83')],{'as':_0x1a07('0x166'),'foreignKey':_0x1a07('0x1f5'),'onDelete':_0x1a07('0x118')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x82')],{'as':_0x1a07('0x17b'),'foreignKey':_0x1a07('0x1f5')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x107')],{'as':_0x1a07('0x159'),'foreignKey':_0x1a07('0x1f5')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x125')],{'as':_0x1a07('0x167')});db[_0x1a07('0x102')][_0x1a07('0x11b')](db[_0x1a07('0x104')],{'as':_0x1a07('0x145')});db[_0x1a07('0x102')][_0x1a07('0x150')](db[_0x1a07('0x12c')],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db[_0x1a07('0x102')][_0x1a07('0x150')](db[_0x1a07('0x87')],{'as':_0x1a07('0x152'),'foreignKey':_0x1a07('0x153')});db[_0x1a07('0x102')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':_0x1a07('0x1f6')});db[_0x1a07('0x104')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'onDelete':_0x1a07('0x162')});db['WhatsappApplication'][_0x1a07('0x150')](db[_0x1a07('0x10b')],{'onDelete':_0x1a07('0x162')});db[_0x1a07('0x104')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'onDelete':'restrict'});db[_0x1a07('0x104')][_0x1a07('0x150')](db['Interval'],{'onDelete':_0x1a07('0x162'),'foreignKey':'IntervalId'});db[_0x1a07('0x104')][_0x1a07('0x150')](db['Tag'],{'onDelete':_0x1a07('0x162'),'foreignKey':_0x1a07('0x176')});db[_0x1a07('0x125')][_0x1a07('0x11b')](db[_0x1a07('0x107')],{'as':_0x1a07('0x159'),'onDelete':_0x1a07('0x118'),'foreignKey':_0x1a07('0x1f7')});db['WhatsappInteraction']['belongsTo'](db[_0x1a07('0x102')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x1a07('0x150')](db[_0x1a07('0x71')],{'as':'Contact','foreignKey':_0x1a07('0x161')});db[_0x1a07('0x125')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':'Owner','foreignKey':_0x1a07('0x119')});db[_0x1a07('0x125')][_0x1a07('0x12a')](db[_0x1a07('0x8e')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x1a07('0x125')]['belongsToMany'](db['Tag'],{'through':_0x1a07('0x1b1'),'as':'ThroughTags'});db[_0x1a07('0x125')][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x170'),'through':_0x1a07('0x134'),'foreignKey':_0x1a07('0x1f7')});db[_0x1a07('0x107')]['belongsTo'](db[_0x1a07('0x115')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0x1a07('0x71')],{'onDelete':'cascade','as':_0x1a07('0x160')});db['WhatsappMessage'][_0x1a07('0x150')](db['WhatsappInteraction'],{'onDelete':_0x1a07('0x118'),'as':_0x1a07('0x172'),'foreignKey':_0x1a07('0x1f7')});db[_0x1a07('0x107')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'as':_0x1a07('0x16c'),'foreignKey':_0x1a07('0x1f5')});db['WhatsappQueueReport'][_0x1a07('0x150')](db['WhatsappAccount'],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db['CmList'],{'as':_0x1a07('0x177'),'foreignKey':_0x1a07('0x168')});db['WhatsappQueueReport']['belongsTo'](db[_0x1a07('0x71')],{'as':_0x1a07('0x160'),'foreignKey':_0x1a07('0x161')});db[_0x1a07('0x108')][_0x1a07('0x150')](db[_0x1a07('0x125')],{});db['WhatsappQueueReport'][_0x1a07('0x150')](db[_0x1a07('0x10b')],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db['WhatsappMessage'],{});db[_0x1a07('0x108')][_0x1a07('0x150')](db[_0x1a07('0x115')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappMessage'],{});db[_0x1a07('0x109')][_0x1a07('0x150')](db['WhatsappInteraction'],{});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'foreignKey':_0x1a07('0x1f8'),'as':_0x1a07('0x1da')});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x102')],{'foreignKey':_0x1a07('0x1f9'),'as':_0x1a07('0x1e4')});db[_0x1a07('0x109')]['belongsTo'](db[_0x1a07('0x10b')],{'foreignKey':_0x1a07('0x1fa'),'as':'ToQueue'});db[_0x1a07('0x109')][_0x1a07('0x150')](db['User'],{'foreignKey':_0x1a07('0x1e6'),'as':_0x1a07('0x1db')});db[_0x1a07('0x109')][_0x1a07('0x150')](db[_0x1a07('0x115')],{'foreignKey':_0x1a07('0x1dc'),'as':_0x1a07('0x1dd')});db['WhatsappQueue'][_0x1a07('0x12a')](db[_0x1a07('0x115')],{'as':_0x1a07('0x169'),'through':'UserWhatsappQueue','foreignKey':_0x1a07('0x1fb')});db[_0x1a07('0x10b')]['belongsToMany'](db['Team'],{'through':_0x1a07('0x1d3'),'as':_0x1a07('0x181')});db['UserSetting'][_0x1a07('0x150')](db[_0x1a07('0x115')],{'as':_0x1a07('0x1fc'),'foreignKey':_0x1a07('0x119'),'onDelete':_0x1a07('0x118'),'hooks':!![]});db[_0x1a07('0x10d')]['hasOne'](db['Dynamics365Account'],{'as':_0x1a07('0xcb'),'onDelete':_0x1a07('0x162')});db[_0x1a07('0x10d')]['hasOne'](db[_0x1a07('0x37')],{'as':'Imap','onDelete':_0x1a07('0x162')});db[_0x1a07('0x10d')]['hasOne'](db[_0x1a07('0x39')],{'as':'Smtp','onDelete':_0x1a07('0x162')});module[_0x1a07('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0382=['../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','userSetting','VoiceRecording','Recordings','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','ChatInteraction','ChatInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','Lists','user_has_teams','user_has_mail_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','ChatQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','OpenchannelAccount','OpenchannelAccounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','VoiceMailMessage','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Dispositions','Answers','Interactions','List','ListId','Agents','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailQueueReport','Items','FaxAccountId','FaxApplication','FaxMessage','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','Account','team_has_fax_queues','SmsAccountId','mandatoryDispositionPause','user_has_sms_accounts','TagId','sms_interaction_has_tags','Users','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','Agent','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','CmCompany','CompanyId','CmContactHasItem','Phones','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperId','OwnerId','CampaignId','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','Extensions','ChatApplications','SmsApplications','CustomReportId','VoiceMusicOnHold','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','SugarcrmAccount','SugarcrmConfiguration','Description','VariableId','DeskAccount','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Field','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SmsQueueReport','ProjectId','MailQueues','SmsQueues','team_has_whatsapp_queues','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','Queues','UserVoicePrefix','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','xC@LL1234','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0382,0x157));var _0x2038=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x0382[_0x274dd7];return _0x148829;};'use strict';var config=require(_0x2038('0x0'));var Sequelize=require('sequelize');var _=require(_0x2038('0x1'));var jstz=require(_0x2038('0x2'));var timezone=jstz[_0x2038('0x3')]();config[_0x2038('0x4')]=_[_0x2038('0x5')](config['sequelize'],{'database':'motion2','username':_0x2038('0x6'),'password':'xC@LL1234','options':{'host':_0x2038('0x7'),'port':0xcea,'dialect':_0x2038('0x8'),'dialectOptions':{'charset':_0x2038('0x9')},'logging':![],'timezone':timezone[_0x2038('0xa')](),'define':{'charset':'utf8','collate':_0x2038('0xb')}}});config[_0x2038('0xc')]=_[_0x2038('0x5')](config[_0x2038('0xc')],{'database':'motion2','username':_0x2038('0x6'),'password':_0x2038('0xd'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2038('0x8'),'dialectOptions':{'charset':_0x2038('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x2038('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2038('0x4')][_0x2038('0xe')],config['sequelize'][_0x2038('0xf')],config[_0x2038('0x4')][_0x2038('0x10')],config[_0x2038('0x4')][_0x2038('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2038('0xc')][_0x2038('0xe')],config[_0x2038('0xc')]['username'],config['sequelizeHistory'][_0x2038('0x10')],config[_0x2038('0xc')][_0x2038('0x11')])};db[_0x2038('0x12')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x14'));db[_0x2038('0x15')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x16'));db['VoiceContext']=db['sequelize'][_0x2038('0x13')](_0x2038('0x17'));db[_0x2038('0x18')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x19'));db['VoiceMusicOnHold']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x1a'));db[_0x2038('0x1b')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x1c'));db['VoiceRecording']=db['sequelize'][_0x2038('0x13')](_0x2038('0x1d'));db[_0x2038('0x1e')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x1f'));db[_0x2038('0x20')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x21'));db['VoiceMailMessage']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x2038('0x22')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x2038('0x23')]=db[_0x2038('0x4')]['import'](_0x2038('0x24'));db[_0x2038('0x25')]=db[_0x2038('0x4')]['import'](_0x2038('0x26'));db['VoiceQueueReport']=db['sequelize'][_0x2038('0x13')](_0x2038('0x27'));db[_0x2038('0x28')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x29'));db[_0x2038('0x2a')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x2b'));db[_0x2038('0x2c')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x2038('0x2d')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x2e'));db[_0x2038('0x2f')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x2038('0x30')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x31'));db[_0x2038('0x32')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x33'));db['UserFaxQueue']=db[_0x2038('0x4')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x2038('0x34')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x35'));db[_0x2038('0x36')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x37'));db[_0x2038('0x38')]=db[_0x2038('0x4')]['import'](_0x2038('0x39'));db[_0x2038('0x3a')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x3b'));db[_0x2038('0x3c')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x3d'));db['MailAccount']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x3e'));db[_0x2038('0x3f')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x40'));db[_0x2038('0x41')]=db[_0x2038('0x4')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x2038('0x42')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/mailMessage/mailMessage.model');db[_0x2038('0x43')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x44'));db['MailQueueReport']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x45'));db[_0x2038('0x46')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x47'));db[_0x2038('0x48')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x49'));db[_0x2038('0x4a')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x4b'));db['FaxApplication']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x4c'));db[_0x2038('0x4d')]=db[_0x2038('0x4')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x4e'));db[_0x2038('0x4f')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/faxQueue/faxQueue.model');db[_0x2038('0x50')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x2038('0x51')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x52'));db[_0x2038('0x53')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/smsApplication/smsApplication.model');db[_0x2038('0x54')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x2038('0x55')]=db[_0x2038('0x4')]['import'](_0x2038('0x56'));db[_0x2038('0x57')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x58'));db['OpenchannelAccount']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x59'));db['OpenchannelApplication']=db['sequelize'][_0x2038('0x13')](_0x2038('0x5a'));db[_0x2038('0x5b')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x2038('0x5c')]=db['sequelize']['import'](_0x2038('0x5d'));db[_0x2038('0x5e')]=db['sequelize'][_0x2038('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x2038('0x5f')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x60'));db[_0x2038('0x61')]=db['sequelize']['import'](_0x2038('0x62'));db[_0x2038('0x63')]=db[_0x2038('0x4')]['import'](_0x2038('0x64'));db['ChatInteraction']=db[_0x2038('0x4')]['import'](_0x2038('0x65'));db[_0x2038('0x66')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x67'));db[_0x2038('0x68')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x69'));db[_0x2038('0x6a')]=db[_0x2038('0x4')]['import'](_0x2038('0x6b'));db[_0x2038('0x6c')]=db['sequelize']['import'](_0x2038('0x6d'));db['CmCompany']=db['sequelize']['import'](_0x2038('0x6e'));db[_0x2038('0x6f')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x70'));db[_0x2038('0x71')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/cmHopper/cmHopper.model');db[_0x2038('0x72')]=db[_0x2038('0x4')]['import'](_0x2038('0x73'));db[_0x2038('0x74')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x75'));db[_0x2038('0x76')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x77'));db[_0x2038('0x78')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x79'));db[_0x2038('0x7a')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x7b'));db[_0x2038('0x7c')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x7d'));db[_0x2038('0x7e')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x7f'));db[_0x2038('0x80')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x81'));db[_0x2038('0x82')]=db['sequelize'][_0x2038('0x13')]('../api/condition/condition.model');db[_0x2038('0x83')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x84'));db['Pause']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x85'));db['Cdr']=db['sequelize'][_0x2038('0x13')]('../api/cdr/cdr.model');db[_0x2038('0x86')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2038('0x87')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x88'));db['Sound']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/sound/sound.model');db[_0x2038('0x89')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x8a'));db[_0x2038('0x8b')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x8c'));db['CmContactHasItem']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x2038('0x8d')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x8e'));db[_0x2038('0x8f')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x90'));db[_0x2038('0x91')]=db[_0x2038('0x4')]['import'](_0x2038('0x92'));db['Variable']=db['sequelize']['import'](_0x2038('0x93'));db['Integration']=db['sequelize'][_0x2038('0x13')](_0x2038('0x94'));db[_0x2038('0x95')]=db[_0x2038('0x4')]['import'](_0x2038('0x96'));db[_0x2038('0x97')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x98'));db[_0x2038('0x99')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x9a'));db[_0x2038('0x9b')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x9c'));db[_0x2038('0x9d')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x9e'));db['AnalyticFieldReport']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x2038('0x9f')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xa0'));db[_0x2038('0xa1')]=db['sequelize'][_0x2038('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x2038('0xa2')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xa3'));db[_0x2038('0xa4')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xa5'));db['SugarcrmAccount']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xa6'));db[_0x2038('0xa7')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xa8'));db['DeskAccount']=db[_0x2038('0x4')]['import'](_0x2038('0xa9'));db[_0x2038('0xaa')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xab'));db[_0x2038('0xac')]=db['sequelize'][_0x2038('0x13')](_0x2038('0xad'));db[_0x2038('0xae')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xaf'));db[_0x2038('0xb0')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xb1'));db[_0x2038('0xb2')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xb3'));db['ZendeskAccount']=db[_0x2038('0x4')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x2038('0xb4')]=db[_0x2038('0x4')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x2038('0xb5')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xb6'));db[_0x2038('0xb7')]=db['sequelize'][_0x2038('0x13')](_0x2038('0xb8'));db[_0x2038('0xb9')]=db['sequelize'][_0x2038('0x13')](_0x2038('0xba'));db[_0x2038('0xbb')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xbc'));db['VtigerAccount']=db[_0x2038('0x4')]['import'](_0x2038('0xbd'));db[_0x2038('0xbe')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xbf'));db[_0x2038('0xc0')]=db['sequelize'][_0x2038('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x2038('0xc1')]=db[_0x2038('0x4')]['import'](_0x2038('0xc2'));db['ServicenowConfiguration']=db[_0x2038('0x4')]['import'](_0x2038('0xc3'));db[_0x2038('0xc4')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x2038('0xc5')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xc6'));db[_0x2038('0xc7')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x2038('0xc8')]=db[_0x2038('0x4')]['import'](_0x2038('0xc9'));db[_0x2038('0xca')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xcb'));db['FreshsalesField']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x2038('0xcc')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x94'));db[_0x2038('0xcd')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xce'));db[_0x2038('0xcf')]=db[_0x2038('0x4')]['import'](_0x2038('0xd0'));db[_0x2038('0xd1')]=db[_0x2038('0x4')]['import'](_0x2038('0xd2'));db[_0x2038('0xd3')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0x2038('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x2038('0xd4')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0x2038('0xd5')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xd6'));db['SquareDetailsReport']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x2038('0xd7')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xd8'));db[_0x2038('0xd9')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xda'));db[_0x2038('0xdb')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xdc'));db[_0x2038('0xdd')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xde'));db[_0x2038('0xdf')]=db[_0x2038('0x4')]['import']('../api/squareRecording/squareRecording.model');db[_0x2038('0xe0')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/squareMessage/squareMessage.model');db[_0x2038('0xe1')]=db['sequelize'][_0x2038('0x13')]('../api/team/team.model');db[_0x2038('0xe2')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xe3'));db[_0x2038('0xe4')]=db[_0x2038('0x4')]['import'](_0x2038('0xe5'));db[_0x2038('0xe6')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xe7'));db[_0x2038('0xe8')]=db[_0x2038('0x4')]['import'](_0x2038('0xe9'));db[_0x2038('0xea')]=db[_0x2038('0x4')]['import'](_0x2038('0xeb'));db['MailTransferReport']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x2038('0xec')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xed'));db['FaxTransferReport']=db[_0x2038('0x4')]['import'](_0x2038('0xee'));db[_0x2038('0xef')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xf0'));db[_0x2038('0xf1')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xf2'));db['CmList']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/cmList/cmList.model');db[_0x2038('0xf3')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xf4'));db[_0x2038('0xf5')]=db[_0x2038('0x4')]['import']('../api/userProfile/userProfile.model');db[_0x2038('0xf6')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xf7'));db['UserProfileResource']=db['sequelize']['import'](_0x2038('0xf8'));db[_0x2038('0xf9')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0xfa'));db[_0x2038('0xfb')]=db[_0x2038('0x4')]['import'](_0x2038('0xfc'));db[_0x2038('0xfd')]=db['sequelize']['import'](_0x2038('0xfe'));db[_0x2038('0xff')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x100'));db['WhatsappMessage']=db[_0x2038('0x4')][_0x2038('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x2038('0x101')]=db['sequelize'][_0x2038('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x2038('0x102')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x103'));db['CloudProvider']=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x104'));db[_0x2038('0x105')]=db['sequelize'][_0x2038('0x13')](_0x2038('0x106'));db[_0x2038('0x107')]=db[_0x2038('0x4')][_0x2038('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x2038('0x4')]['import'](_0x2038('0x108'));db[_0x2038('0x109')]=db[_0x2038('0x4')][_0x2038('0x13')](_0x2038('0x10a'));db[_0x2038('0x12')][_0x2038('0x10b')](db[_0x2038('0x20')],{'as':'VoiceMail','onDelete':_0x2038('0x10c'),'foreignKey':'UserId'});db['User'][_0x2038('0x10b')](db[_0x2038('0x109')],{'as':_0x2038('0x10d'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x2038('0x12')]['hasMany'](db[_0x2038('0x10e')],{'as':_0x2038('0x10f'),'foreignKey':_0x2038('0x110')});db['User'][_0x2038('0x111')](db['UserVoiceQueueRt'],{'as':_0x2038('0x112'),'foreignKey':'UserId'});db[_0x2038('0x12')]['hasMany'](db[_0x2038('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x2038('0x12')][_0x2038('0x111')](db[_0x2038('0x74')],{'as':_0x2038('0x113'),'foreignKey':'UserId'});db[_0x2038('0x12')][_0x2038('0x111')](db[_0x2038('0x76')],{'as':_0x2038('0x114'),'foreignKey':_0x2038('0x110')});db[_0x2038('0x12')][_0x2038('0x111')](db['ReportAgentPreview'],{'as':_0x2038('0x78'),'foreignKey':_0x2038('0x110')});db[_0x2038('0x12')][_0x2038('0x111')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x2038('0x110')});db[_0x2038('0x12')]['hasMany'](db[_0x2038('0x115')],{'as':_0x2038('0x116'),'foreignKey':'UserId'});db[_0x2038('0x12')][_0x2038('0x111')](db[_0x2038('0x54')],{'as':'SmsInteractions','foreignKey':_0x2038('0x110')});db[_0x2038('0x12')][_0x2038('0x111')](db[_0x2038('0x4d')],{'as':_0x2038('0x117'),'foreignKey':_0x2038('0x110')});db['User'][_0x2038('0x111')](db[_0x2038('0x41')],{'as':_0x2038('0x118'),'foreignKey':_0x2038('0x110')});db['User'][_0x2038('0x111')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x2038('0x110')});db[_0x2038('0x12')]['hasMany'](db[_0x2038('0xf9')],{'as':_0x2038('0x119'),'foreignKey':_0x2038('0x11a')});db[_0x2038('0x12')][_0x2038('0x11b')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x2038('0x11c')});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x6a')],{'as':'Groups','through':_0x2038('0x11e')});db['User'][_0x2038('0x11d')](db[_0x2038('0x6f')],{'as':_0x2038('0x11f'),'through':'cm_user_has_contacts'});db['User'][_0x2038('0x11d')](db['CmList'],{'as':_0x2038('0x120'),'through':'cm_user_has_lists'});db['User'][_0x2038('0x11d')](db[_0x2038('0xe1')],{'through':_0x2038('0x121')});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x41')],{'as':_0x2038('0x118'),'through':_0x2038('0x122')});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x115')],{'as':_0x2038('0x116'),'through':'user_has_chat_interactions'});db[_0x2038('0x12')]['belongsToMany'](db[_0x2038('0x4d')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x2038('0x12')][_0x2038('0x11d')](db['SmsInteraction'],{'as':_0x2038('0x123'),'through':_0x2038('0x124')});db[_0x2038('0x12')][_0x2038('0x11d')](db['OpenchannelInteraction'],{'as':_0x2038('0x125'),'through':_0x2038('0x126')});db[_0x2038('0x12')][_0x2038('0x11d')](db['WhatsappInteraction'],{'as':_0x2038('0x127'),'through':_0x2038('0x128')});db[_0x2038('0x12')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2038('0x129'),'through':'UserVoiceQueue','required':![]});db[_0x2038('0x12')]['belongsToMany'](db[_0x2038('0xf3')],{'as':_0x2038('0x12a'),'through':'UserVoicePrefix','required':![]});db['User'][_0x2038('0x11d')](db[_0x2038('0x12b')],{'as':'MailQueues','through':_0x2038('0x32'),'required':![]});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x12c')],{'as':'ChatQueues','through':_0x2038('0x30'),'required':![],'hooks':!![]});db['User'][_0x2038('0x11d')](db['FaxQueue'],{'as':_0x2038('0x12d'),'through':_0x2038('0x12e'),'required':![]});db[_0x2038('0x12')][_0x2038('0x11d')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x2038('0x12')]['belongsToMany'](db[_0x2038('0x5e')],{'as':_0x2038('0x12f'),'through':_0x2038('0x36'),'required':![]});db[_0x2038('0x12')]['belongsToMany'](db[_0x2038('0x130')],{'as':_0x2038('0x131'),'through':_0x2038('0x38'),'required':![]});db[_0x2038('0x12')][_0x2038('0x11d')](db['CmList'],{'through':_0x2038('0x132')});db['User'][_0x2038('0x11d')](db['ChatWebsite'],{'as':_0x2038('0x133'),'through':_0x2038('0x134')});db[_0x2038('0x12')]['belongsToMany'](db[_0x2038('0x4a')],{'as':_0x2038('0x135'),'through':_0x2038('0x136')});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x137')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x138')],{'as':_0x2038('0x139'),'through':'user_has_openchannel_accounts'});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0x51')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x2038('0x12')][_0x2038('0x11d')](db[_0x2038('0xfb')],{'as':_0x2038('0x13a'),'through':_0x2038('0x13b')});db[_0x2038('0x15')][_0x2038('0x111')](db[_0x2038('0x18')],{'as':'SpiedAgents','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x13c')});db['VoiceContext'][_0x2038('0x111')](db['VoiceExtension'],{'onDelete':_0x2038('0x10c')});db['VoiceExtension'][_0x2038('0x111')](db['VoiceExtension'],{'as':_0x2038('0x13d'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0x2038('0x11d')](db[_0x2038('0x13e')],{'as':_0x2038('0x13f'),'through':'moh_has_sounds'});db[_0x2038('0x1b')]['hasMany'](db[_0x2038('0x2d')],{'as':_0x2038('0x140'),'foreignKey':_0x2038('0x141')});db['VoiceQueue']['hasMany'](db[_0x2038('0x71')],{'as':_0x2038('0x142'),'foreignKey':'VoiceQueueId'});db[_0x2038('0x1b')]['hasMany'](db[_0x2038('0x74')],{'as':'HopperFinals','foreignKey':_0x2038('0x141')});db[_0x2038('0x1b')][_0x2038('0x111')](db[_0x2038('0x76')],{'as':_0x2038('0x143'),'foreignKey':_0x2038('0x141')});db[_0x2038('0x1b')][_0x2038('0x111')](db[_0x2038('0x78')],{'as':_0x2038('0x78'),'foreignKey':_0x2038('0x141')});db[_0x2038('0x1b')][_0x2038('0x111')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x2038('0x141')});db[_0x2038('0x1b')]['hasMany'](db['JscriptySessionReport'],{'as':_0x2038('0x144'),'foreignKey':_0x2038('0x141')});db[_0x2038('0x1b')][_0x2038('0x11b')](db[_0x2038('0x2a')],{'as':'Trunk','foreignKey':_0x2038('0x145')});db[_0x2038('0x1b')][_0x2038('0x11b')](db['Trunk'],{'as':_0x2038('0x146'),'foreignKey':_0x2038('0x147')});db[_0x2038('0x1b')][_0x2038('0x11b')](db[_0x2038('0x83')],{'as':_0x2038('0x83'),'foreignKey':_0x2038('0x148')});db['VoiceQueue'][_0x2038('0x11b')](db[_0x2038('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0x2038('0x14a')});db['VoiceQueue'][_0x2038('0x11d')](db[_0x2038('0x14b')],{'as':_0x2038('0x120'),'through':_0x2038('0x14c')});db[_0x2038('0x1b')]['belongsToMany'](db[_0x2038('0x12')],{'as':'Agents','through':_0x2038('0x2f')});db['VoiceQueue'][_0x2038('0x11d')](db[_0x2038('0xe1')],{'as':_0x2038('0x14d'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x2038('0x11d')](db[_0x2038('0x14b')],{'as':_0x2038('0x14e'),'through':_0x2038('0x14f')});db[_0x2038('0x10e')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x12'),'foreignKey':_0x2038('0x110')});db['ScreenRecording']['belongsTo'](db[_0x2038('0x12')],{'as':'User','foreignKey':'UserId'});db[_0x2038('0x20')][_0x2038('0x111')](db['VoiceMailMessage'],{'as':_0x2038('0x150'),'onDelete':_0x2038('0x10c'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x2038('0x151')]['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x2038('0x152')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0x2038('0x153'),'foreignKey':_0x2038('0x154'),'constraints':![]});db[_0x2038('0x22')]['hasMany'](db[_0x2038('0x25')],{'as':_0x2038('0x155'),'foreignKey':_0x2038('0x154'),'constraints':![]});db[_0x2038('0x22')][_0x2038('0x11b')](db['User'],{'as':_0x2038('0x12'),'foreignKey':'UserId'});db['VoiceCallReport'][_0x2038('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x3a')][_0x2038('0x11b')](db['MailAccount'],{'as':_0x2038('0x137'),'foreignKey':_0x2038('0x157')});db[_0x2038('0x3a')]['belongsTo'](db[_0x2038('0x158')],{'as':_0x2038('0x158'),'foreignKey':_0x2038('0x159'),'onDelete':_0x2038('0x15a')});db[_0x2038('0x3c')][_0x2038('0x11b')](db[_0x2038('0x137')],{'as':_0x2038('0x137'),'foreignKey':_0x2038('0x157')});db['MailServerOut'][_0x2038('0x11b')](db[_0x2038('0x158')],{'as':_0x2038('0x158'),'foreignKey':_0x2038('0x159'),'onDelete':_0x2038('0x15a')});db['MailAccount']['hasOne'](db[_0x2038('0x3a')],{'as':_0x2038('0x15b'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x137')][_0x2038('0x10b')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x2038('0x10c')});db[_0x2038('0x137')][_0x2038('0x111')](db[_0x2038('0x80')],{'as':_0x2038('0x15c'),'foreignKey':_0x2038('0x157'),'onDelete':'cascade'});db[_0x2038('0x137')][_0x2038('0x111')](db[_0x2038('0x7e')],{'as':_0x2038('0x15d'),'foreignKey':_0x2038('0x157')});db[_0x2038('0x137')][_0x2038('0x111')](db[_0x2038('0x42')],{'as':'Messages','foreignKey':_0x2038('0x157')});db['MailAccount']['hasMany'](db[_0x2038('0x41')],{'as':_0x2038('0x15e')});db[_0x2038('0x137')][_0x2038('0x111')](db[_0x2038('0x43')],{'as':_0x2038('0x13d')});db[_0x2038('0x137')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x137')][_0x2038('0x11b')](db[_0x2038('0x8f')],{'as':_0x2038('0x8f'),'foreignKey':'TemplateId'});db[_0x2038('0x137')][_0x2038('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2038('0x14a')});db[_0x2038('0x137')]['belongsToMany'](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':'user_has_mail_accounts'});db[_0x2038('0x12b')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x32')});db[_0x2038('0x12b')]['belongsToMany'](db[_0x2038('0xe1')],{'through':_0x2038('0x162'),'as':_0x2038('0x14d')});db[_0x2038('0x41')][_0x2038('0x111')](db[_0x2038('0x42')],{'as':'Messages','onDelete':_0x2038('0x10c'),'foreignKey':'MailInteractionId'});db[_0x2038('0x41')][_0x2038('0x11b')](db[_0x2038('0x137')],{'as':'Account','foreignKey':_0x2038('0x157')});db[_0x2038('0x41')][_0x2038('0x11b')](db['CmContact'],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db['MailInteraction']['belongsTo'](db[_0x2038('0x12')],{'as':_0x2038('0x164'),'foreignKey':_0x2038('0x110')});db[_0x2038('0x41')][_0x2038('0x11d')](db['Tag'],{'through':_0x2038('0x165'),'as':_0x2038('0x166')});db[_0x2038('0x41')][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':_0x2038('0x165'),'as':_0x2038('0x167')});db[_0x2038('0x41')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':'Users','through':_0x2038('0x122'),'foreignKey':_0x2038('0x168')});db['MailMessage'][_0x2038('0x111')](db[_0x2038('0xe8')],{'as':_0x2038('0x169'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0x2038('0x12')],{'as':_0x2038('0x12')});db[_0x2038('0x42')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x163')});db[_0x2038('0x42')][_0x2038('0x11b')](db['MailInteraction'],{'as':_0x2038('0x16a'),'foreignKey':'MailInteractionId'});db[_0x2038('0x42')]['belongsTo'](db[_0x2038('0x137')],{'as':'Account','foreignKey':_0x2038('0x157')});db['MailMessage'][_0x2038('0x11b')](db[_0x2038('0x5f')],{'as':_0x2038('0x5f'),'foreignKey':_0x2038('0x16b')});db[_0x2038('0x42')][_0x2038('0x11b')](db['ChatOfflineMessage'],{'as':_0x2038('0x68'),'foreignKey':_0x2038('0x16c')});db['MailApplication']['belongsTo'](db[_0x2038('0x12')],{'onDelete':_0x2038('0x15a')});db['MailApplication'][_0x2038('0x11b')](db['MailQueue'],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x43')][_0x2038('0x11b')](db['MailAccount'],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x43')][_0x2038('0x11b')](db[_0x2038('0x83')],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x148')});db['MailApplication'][_0x2038('0x11b')](db[_0x2038('0x89')],{'onDelete':_0x2038('0x15a'),'foreignKey':'TagId'});db[_0x2038('0x16d')][_0x2038('0x11b')](db[_0x2038('0x137')],{});db[_0x2038('0x16d')]['belongsTo'](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x16d')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x2038('0x11b')](db[_0x2038('0x41')],{});db[_0x2038('0x16d')][_0x2038('0x11b')](db[_0x2038('0x42')],{});db[_0x2038('0x16d')]['belongsTo'](db[_0x2038('0x12')],{});db[_0x2038('0x16d')]['belongsTo'](db[_0x2038('0x12b')],{});db[_0x2038('0x46')][_0x2038('0x111')](db['DashboardItem'],{'as':_0x2038('0x16e'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x4a')][_0x2038('0x111')](db['Disposition'],{'as':_0x2038('0x15c'),'foreignKey':_0x2038('0x16f'),'onDelete':'cascade'});db[_0x2038('0x4a')][_0x2038('0x111')](db[_0x2038('0x7e')],{'as':_0x2038('0x15d'),'foreignKey':_0x2038('0x16f')});db['FaxAccount']['hasMany'](db[_0x2038('0x4d')],{'as':_0x2038('0x15e')});db[_0x2038('0x4a')][_0x2038('0x111')](db[_0x2038('0x170')],{'as':_0x2038('0x13d')});db[_0x2038('0x4a')][_0x2038('0x111')](db[_0x2038('0x18')],{'as':'Exntensions','onDelete':_0x2038('0x10c')});db[_0x2038('0x4a')][_0x2038('0x111')](db[_0x2038('0x171')],{'as':_0x2038('0x150')});db['FaxAccount'][_0x2038('0x11b')](db[_0x2038('0x2a')],{'as':_0x2038('0x2a')});db[_0x2038('0x4a')]['belongsTo'](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':'ListId'});db[_0x2038('0x4a')][_0x2038('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x2038('0x14a')});db[_0x2038('0x4a')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x136')});db['FaxApplication'][_0x2038('0x11b')](db[_0x2038('0x12')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x170')][_0x2038('0x11b')](db[_0x2038('0x4f')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x170')][_0x2038('0x11b')](db[_0x2038('0x4a')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x170')][_0x2038('0x11b')](db[_0x2038('0x89')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2038('0x4d')]['hasMany'](db[_0x2038('0x171')],{'as':_0x2038('0x150'),'onDelete':_0x2038('0x10c'),'foreignKey':'FaxInteractionId'});db[_0x2038('0x4d')][_0x2038('0x11b')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x2038('0x4d')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x4d')]['belongsTo'](db['User'],{'as':_0x2038('0x164'),'foreignKey':'UserId'});db['FaxInteraction'][_0x2038('0x11d')](db['Tag'],{'through':_0x2038('0x172'),'as':_0x2038('0x166')});db['FaxInteraction'][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':'fax_interaction_has_tags','as':_0x2038('0x167')});db[_0x2038('0x4d')][_0x2038('0x11d')](db['User'],{'as':'Users','through':_0x2038('0x173'),'foreignKey':_0x2038('0x174')});db[_0x2038('0x171')][_0x2038('0x11b')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x2038('0x171')]['belongsTo'](db[_0x2038('0x4d')],{'as':_0x2038('0x16a'),'foreignKey':_0x2038('0x174')});db[_0x2038('0x171')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':'cascade','as':_0x2038('0x163')});db['FaxMessage']['belongsTo'](db[_0x2038('0xe8')],{'as':_0x2038('0xe8'),'foreignKey':_0x2038('0x175')});db[_0x2038('0x171')][_0x2038('0x11b')](db[_0x2038('0x4a')],{'as':_0x2038('0x176'),'foreignKey':'FaxAccountId'});db[_0x2038('0x4f')][_0x2038('0x11d')](db['User'],{'as':_0x2038('0x161'),'through':'UserFaxQueue'});db['FaxQueue'][_0x2038('0x11d')](db[_0x2038('0xe1')],{'through':_0x2038('0x177'),'as':_0x2038('0x14d')});db[_0x2038('0x50')][_0x2038('0x11b')](db[_0x2038('0x4a')],{});db[_0x2038('0x50')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':'ListId'});db[_0x2038('0x50')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x50')]['belongsTo'](db[_0x2038('0x4d')],{});db['FaxQueueReport'][_0x2038('0x11b')](db['FaxMessage'],{});db[_0x2038('0x50')][_0x2038('0x11b')](db[_0x2038('0x12')],{});db[_0x2038('0x50')][_0x2038('0x11b')](db[_0x2038('0x4f')],{});db[_0x2038('0x51')][_0x2038('0x111')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2038('0x178'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x51')][_0x2038('0x111')](db[_0x2038('0x7e')],{'as':_0x2038('0x15d'),'foreignKey':_0x2038('0x178')});db[_0x2038('0x51')][_0x2038('0x111')](db[_0x2038('0x55')],{'as':_0x2038('0x150'),'foreignKey':_0x2038('0x178')});db[_0x2038('0x51')]['hasMany'](db[_0x2038('0x54')],{'as':'Interactions'});db[_0x2038('0x51')][_0x2038('0x111')](db[_0x2038('0x53')],{'as':_0x2038('0x13d')});db[_0x2038('0x51')][_0x2038('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x2038('0x160')});db[_0x2038('0x51')][_0x2038('0x11b')](db[_0x2038('0x149')],{'as':_0x2038('0x179'),'foreignKey':_0x2038('0x14a')});db[_0x2038('0x51')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x17a')});db[_0x2038('0x53')]['belongsTo'](db[_0x2038('0x12')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x53')]['belongsTo'](db[_0x2038('0x57')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x53')][_0x2038('0x11b')](db[_0x2038('0x51')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0x53')][_0x2038('0x11b')](db[_0x2038('0x83')],{'onDelete':_0x2038('0x15a'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x2038('0x11b')](db['Tag'],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x17b')});db[_0x2038('0x54')][_0x2038('0x111')](db[_0x2038('0x55')],{'as':'Messages','onDelete':_0x2038('0x10c'),'foreignKey':'SmsInteractionId'});db[_0x2038('0x54')]['belongsTo'](db['SmsAccount'],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x178')});db[_0x2038('0x54')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x54')]['belongsTo'](db[_0x2038('0x12')],{'as':_0x2038('0x164'),'foreignKey':_0x2038('0x110')});db[_0x2038('0x54')][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':_0x2038('0x17c'),'as':'Tags'});db[_0x2038('0x54')]['belongsToMany'](db[_0x2038('0x89')],{'through':_0x2038('0x17c'),'as':_0x2038('0x167')});db['SmsInteraction'][_0x2038('0x11d')](db['User'],{'as':_0x2038('0x17d'),'through':_0x2038('0x124'),'foreignKey':_0x2038('0x17e')});db[_0x2038('0x55')]['belongsTo'](db[_0x2038('0x12')],{'as':_0x2038('0x12')});db['SmsMessage'][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':'cascade','as':_0x2038('0x163')});db[_0x2038('0x55')][_0x2038('0x11b')](db[_0x2038('0x54')],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x16a'),'foreignKey':_0x2038('0x17e')});db[_0x2038('0x55')][_0x2038('0x11b')](db['SmsAccount'],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x178')});db[_0x2038('0x57')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x34'),'foreignKey':_0x2038('0x17f')});db['SmsQueue'][_0x2038('0x11d')](db[_0x2038('0xe1')],{'through':_0x2038('0x180'),'as':_0x2038('0x14d')});db[_0x2038('0x138')][_0x2038('0x111')](db[_0x2038('0x80')],{'as':'Dispositions','foreignKey':_0x2038('0x181'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x138')]['hasMany'](db[_0x2038('0x7e')],{'as':_0x2038('0x15d'),'foreignKey':_0x2038('0x181')});db[_0x2038('0x138')][_0x2038('0x111')](db[_0x2038('0x5b')],{'as':_0x2038('0x15e'),'foreignKey':_0x2038('0x181')});db[_0x2038('0x138')][_0x2038('0x111')](db[_0x2038('0x5c')],{'as':_0x2038('0x150'),'foreignKey':_0x2038('0x181')});db[_0x2038('0x138')][_0x2038('0x111')](db[_0x2038('0x182')],{'as':_0x2038('0x13d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2038('0x11b')](db['CmList'],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x138')]['belongsTo'](db[_0x2038('0x149')],{'as':_0x2038('0x179'),'foreignKey':_0x2038('0x14a')});db['OpenchannelAccount'][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x183')});db[_0x2038('0x182')][_0x2038('0x11b')](db[_0x2038('0x12')],{'onDelete':_0x2038('0x15a')});db['OpenchannelApplication'][_0x2038('0x11b')](db[_0x2038('0x5e')],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x184')});db[_0x2038('0x182')][_0x2038('0x11b')](db[_0x2038('0x138')],{'onDelete':'restrict','foreignKey':_0x2038('0x181')});db['OpenchannelApplication'][_0x2038('0x11b')](db[_0x2038('0x83')],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x148')});db[_0x2038('0x182')]['belongsTo'](db[_0x2038('0x89')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2038('0x5b')]['hasMany'](db[_0x2038('0x5c')],{'as':'Messages','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x185')});db[_0x2038('0x5b')][_0x2038('0x11b')](db[_0x2038('0x138')],{'as':'Account','foreignKey':_0x2038('0x181')});db[_0x2038('0x5b')]['belongsTo'](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x5b')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x164'),'foreignKey':'UserId'});db[_0x2038('0x5b')]['belongsToMany'](db[_0x2038('0x89')],{'through':_0x2038('0x186'),'as':_0x2038('0x166')});db['OpenchannelInteraction'][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':_0x2038('0x186'),'as':_0x2038('0x167')});db[_0x2038('0x5b')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x17d'),'through':_0x2038('0x126'),'foreignKey':_0x2038('0x185')});db[_0x2038('0x5c')][_0x2038('0x11b')](db[_0x2038('0x12')],{'onDelete':'cascade','as':_0x2038('0x12')});db['OpenchannelMessage'][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':_0x2038('0x10c'),'as':'Contact'});db[_0x2038('0x5c')][_0x2038('0x11b')](db[_0x2038('0x5b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x2038('0x185')});db[_0x2038('0x5c')][_0x2038('0x11b')](db[_0x2038('0xe8')],{'as':_0x2038('0xe8'),'foreignKey':_0x2038('0x175')});db['OpenchannelMessage'][_0x2038('0x11b')](db[_0x2038('0x138')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x181')});db[_0x2038('0x5e')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x36'),'foreignKey':_0x2038('0x184')});db[_0x2038('0x5e')][_0x2038('0x11d')](db['Team'],{'through':_0x2038('0x187'),'as':'Teams'});db[_0x2038('0x5f')][_0x2038('0x111')](db[_0x2038('0x80')],{'as':_0x2038('0x15c'),'foreignKey':_0x2038('0x16b'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x5f')][_0x2038('0x111')](db['CannedAnswer'],{'as':_0x2038('0x15d'),'foreignKey':_0x2038('0x16b')});db['ChatWebsite'][_0x2038('0x111')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db['ChatWebsite'][_0x2038('0x111')](db[_0x2038('0x115')],{'as':'Interactions'});db[_0x2038('0x5f')]['hasMany'](db[_0x2038('0x63')],{'as':_0x2038('0x13d')});db['ChatWebsite'][_0x2038('0x111')](db[_0x2038('0x66')],{'as':_0x2038('0x150')});db['ChatWebsite']['belongsTo'](db[_0x2038('0x14b')],{'as':'List','foreignKey':_0x2038('0x160')});db['ChatWebsite'][_0x2038('0x11b')](db[_0x2038('0x83')],{'as':_0x2038('0x83'),'foreignKey':_0x2038('0x148')});db[_0x2038('0x5f')][_0x2038('0x11b')](db['MailAccount'],{'as':_0x2038('0x137'),'foreignKey':_0x2038('0x157')});db['ChatWebsite'][_0x2038('0x11b')](db['Pause'],{'as':_0x2038('0x179'),'foreignKey':_0x2038('0x14a')});db[_0x2038('0x5f')]['belongsToMany'](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x134')});db['OpenchannelQueueReport'][_0x2038('0x11b')](db[_0x2038('0x138')],{});db[_0x2038('0x61')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x61')]['belongsTo'](db[_0x2038('0x6f')],{'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x61')][_0x2038('0x11b')](db[_0x2038('0x5b')],{});db['OpenchannelQueueReport'][_0x2038('0x11b')](db[_0x2038('0x5c')],{});db[_0x2038('0x61')]['belongsTo'](db[_0x2038('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x2038('0x5e')],{});db[_0x2038('0x63')][_0x2038('0x11b')](db['User'],{'as':_0x2038('0x188'),'foreignKey':_0x2038('0x110'),'onDelete':'restrict'});db[_0x2038('0x63')][_0x2038('0x11b')](db[_0x2038('0x12c')],{'as':_0x2038('0x189'),'foreignKey':_0x2038('0x18a'),'onDelete':'restrict'});db[_0x2038('0x63')][_0x2038('0x11b')](db[_0x2038('0x5f')],{'as':_0x2038('0x18b'),'foreignKey':_0x2038('0x16b'),'onDelete':_0x2038('0x15a')});db[_0x2038('0x63')]['belongsTo'](db['Tag'],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x17b')});db[_0x2038('0x115')][_0x2038('0x111')](db[_0x2038('0x66')],{'as':_0x2038('0x150'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x18c')});db['ChatInteraction'][_0x2038('0x11b')](db[_0x2038('0x5f')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x16b')});db[_0x2038('0x115')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':'Contact','foreignKey':_0x2038('0x156')});db['ChatInteraction']['belongsTo'](db[_0x2038('0x12')],{'as':'Owner','foreignKey':_0x2038('0x110')});db['ChatInteraction'][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':'chat_interaction_has_tags','as':_0x2038('0x166')});db[_0x2038('0x115')][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':'chat_interaction_has_tags','as':_0x2038('0x167')});db[_0x2038('0x115')]['belongsToMany'](db['User'],{'as':_0x2038('0x17d'),'through':'user_has_chat_interactions','foreignKey':_0x2038('0x18c')});db[_0x2038('0x66')]['belongsTo'](db['User'],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x12')});db['ChatMessage'][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x66')][_0x2038('0x11b')](db[_0x2038('0x115')],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x16a'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x2038('0x11b')](db[_0x2038('0xe8')],{'as':_0x2038('0xe8'),'foreignKey':_0x2038('0x175')});db[_0x2038('0x66')][_0x2038('0x11b')](db[_0x2038('0x5f')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x16b')});db[_0x2038('0x68')][_0x2038('0x111')](db[_0x2038('0xe8')],{'as':'Attachments','foreignKey':_0x2038('0x16c'),'onDelete':_0x2038('0x10c'),'hooks':!![]});db[_0x2038('0x68')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'onDelete':_0x2038('0x10c'),'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x68')][_0x2038('0x11b')](db[_0x2038('0x5f')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x16b')});db['ChatQueue'][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x30'),'hooks':!![]});db[_0x2038('0x12c')][_0x2038('0x11d')](db[_0x2038('0xe1')],{'through':_0x2038('0x18d'),'as':_0x2038('0x14d')});db['ChatGroup'][_0x2038('0x111')](db[_0x2038('0xd1')],{'as':_0x2038('0x150'),'foreignKey':'ChatGroupId','onDelete':_0x2038('0x10c')});db[_0x2038('0x6a')][_0x2038('0x11d')](db['User'],{'as':_0x2038('0x140'),'through':_0x2038('0x11e')});db[_0x2038('0x6c')]['belongsTo'](db[_0x2038('0x5f')],{'as':_0x2038('0x18b'),'foreignKey':_0x2038('0x16b')});db[_0x2038('0x18e')][_0x2038('0x111')](db[_0x2038('0x6f')],{'as':'Contacts','foreignKey':_0x2038('0x18f')});db[_0x2038('0x6f')][_0x2038('0x111')](db[_0x2038('0x190')],{'as':_0x2038('0x191'),'foreignKey':'CmContactId'});db['CmContact'][_0x2038('0x111')](db['CmHopper'],{'as':_0x2038('0x142'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x6f')]['hasMany'](db[_0x2038('0x74')],{'as':_0x2038('0x113'),'foreignKey':'ContactId'});db[_0x2038('0x6f')][_0x2038('0x111')](db[_0x2038('0x76')],{'as':_0x2038('0x143'),'foreignKey':_0x2038('0x156')});db['CmContact'][_0x2038('0x111')](db[_0x2038('0x78')],{'as':_0x2038('0x78'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x6f')][_0x2038('0x111')](db[_0x2038('0xd4')],{'as':'JscriptySessions','foreignKey':_0x2038('0x156')});db[_0x2038('0x6f')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x2038('0x125'),'foreignKey':_0x2038('0x156'),'onDelete':_0x2038('0x15a')});db['CmContact'][_0x2038('0x111')](db[_0x2038('0x115')],{'as':_0x2038('0x116'),'foreignKey':'ContactId','onDelete':_0x2038('0x15a')});db[_0x2038('0x6f')][_0x2038('0x111')](db[_0x2038('0x54')],{'as':_0x2038('0x123'),'foreignKey':_0x2038('0x156'),'onDelete':_0x2038('0x15a')});db[_0x2038('0x6f')][_0x2038('0x111')](db['FaxInteraction'],{'as':_0x2038('0x117'),'foreignKey':_0x2038('0x156'),'onDelete':_0x2038('0x15a')});db[_0x2038('0x6f')]['hasMany'](db[_0x2038('0x41')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x2038('0x15a')});db[_0x2038('0x6f')][_0x2038('0x11b')](db['CmCompany'],{'as':_0x2038('0x192'),'foreignKey':_0x2038('0x18f')});db[_0x2038('0x6f')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160'),'onDelete':_0x2038('0x10c')});db['CmContact']['belongsToMany'](db[_0x2038('0x12')],{'as':_0x2038('0x17d'),'through':_0x2038('0x193')});db[_0x2038('0x6f')][_0x2038('0x11d')](db[_0x2038('0x89')],{'as':_0x2038('0x166'),'through':'cm_contact_has_tags'});db[_0x2038('0x6f')]['belongsToMany'](db[_0x2038('0x89')],{'through':_0x2038('0x194'),'as':_0x2038('0x167')});db[_0x2038('0x71')]['hasMany'](db[_0x2038('0x8d')],{'as':'AdditionalPhones','foreignKey':_0x2038('0x195')});db[_0x2038('0x71')][_0x2038('0x11b')](db['CmContact'],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x71')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':'List','foreignKey':_0x2038('0x160'),'onDelete':'cascade'});db[_0x2038('0x71')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x188'),'foreignKey':_0x2038('0x110')});db[_0x2038('0x71')][_0x2038('0x11b')](db[_0x2038('0x1b')],{'as':_0x2038('0x189'),'foreignKey':_0x2038('0x141'),'onDelete':'cascade'});db[_0x2038('0x71')][_0x2038('0x11b')](db[_0x2038('0xe4')],{'as':_0x2038('0xe4'),'foreignKey':'CampaignId','onDelete':_0x2038('0x10c')});db['CmHopper'][_0x2038('0x11b')](db['User'],{'as':_0x2038('0x164'),'foreignKey':_0x2038('0x196')});db[_0x2038('0x72')]['belongsTo'](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x72')][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x72')][_0x2038('0x11b')](db[_0x2038('0x1b')],{'as':'Queue','foreignKey':_0x2038('0x141'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x72')]['belongsTo'](db[_0x2038('0xe4')],{'as':_0x2038('0xe4'),'foreignKey':_0x2038('0x197'),'onDelete':'cascade'});db[_0x2038('0x7c')][_0x2038('0x111')](db[_0x2038('0x82')],{'as':{'plural':'All','singular':_0x2038('0x198')},'foreignKey':_0x2038('0x199'),'onDelete':_0x2038('0x10c'),'hooks':!![]});db[_0x2038('0x7c')][_0x2038('0x111')](db[_0x2038('0x82')],{'as':{'plural':_0x2038('0x19a'),'singular':_0x2038('0x19b')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x2038('0x7c')][_0x2038('0x111')](db[_0x2038('0x7a')],{'as':_0x2038('0x19c'),'foreignKey':_0x2038('0x19d'),'onDelete':_0x2038('0x10c'),'hooks':!![]});db[_0x2038('0x80')][_0x2038('0x111')](db[_0x2038('0x80')],{'as':_0x2038('0x15c'),'foreignKey':_0x2038('0x19e'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x83')][_0x2038('0x111')](db[_0x2038('0x83')],{'as':_0x2038('0x19f'),'foreignKey':_0x2038('0x148'),'onDelete':_0x2038('0x10c'),'hooks':!![],'required':![]});db[_0x2038('0x83')][_0x2038('0x111')](db['VoiceExtension'],{'as':_0x2038('0x1a0'),'foreignKey':_0x2038('0x148'),'onDelete':'restrict'});db['Interval'][_0x2038('0x111')](db[_0x2038('0x43')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x2038('0x83')][_0x2038('0x111')](db[_0x2038('0x63')],{'as':_0x2038('0x1a1'),'foreignKey':_0x2038('0x148')});db[_0x2038('0x83')][_0x2038('0x111')](db[_0x2038('0x170')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x2038('0x83')]['hasMany'](db['SmsApplication'],{'as':_0x2038('0x1a2'),'foreignKey':_0x2038('0x148')});db[_0x2038('0x87')][_0x2038('0x11b')](db[_0x2038('0x137')],{});db['Schedule'][_0x2038('0x11b')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0x2038('0x97')],{'foreignKey':_0x2038('0x1a3')});db[_0x2038('0x13e')][_0x2038('0x11d')](db[_0x2038('0x1a4')],{'as':_0x2038('0x1a5'),'through':_0x2038('0x1a6'),'onDelete':'restrict'});db['Tag'][_0x2038('0x11d')](db[_0x2038('0x6f')],{'through':_0x2038('0x194')});db[_0x2038('0x89')][_0x2038('0x11d')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x2038('0x89')][_0x2038('0x11d')](db[_0x2038('0x41')],{'through':_0x2038('0x165')});db[_0x2038('0x89')]['belongsToMany'](db[_0x2038('0x54')],{'through':'sms_interaction_has_tags'});db[_0x2038('0x89')][_0x2038('0x11d')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x2038('0x89')]['belongsToMany'](db[_0x2038('0x5b')],{'through':_0x2038('0x186')});db[_0x2038('0x89')][_0x2038('0x11d')](db[_0x2038('0xff')],{'through':_0x2038('0x1a7')});db[_0x2038('0x190')][_0x2038('0x11b')](db[_0x2038('0x8b')],{'as':'ItemType','foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0x2038('0x11b')](db[_0x2038('0x71')],{'as':'Hopper','foreignKey':_0x2038('0x195')});db[_0x2038('0x190')][_0x2038('0x11b')](db['CmContact'],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x1a8')});db['Trigger'][_0x2038('0x111')](db[_0x2038('0x82')],{'as':{'plural':_0x2038('0x1a9'),'singular':_0x2038('0x1aa')},'foreignKey':_0x2038('0x1ab'),'onDelete':_0x2038('0x10c'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x2038('0x82')],{'as':{'plural':_0x2038('0x1ac'),'singular':_0x2038('0x1ad')},'foreignKey':_0x2038('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x2038('0x91')][_0x2038('0x111')](db[_0x2038('0x7a')],{'as':'Actions','foreignKey':_0x2038('0x1af'),'onDelete':'cascade','hooks':!![]});db[_0x2038('0x97')]['hasMany'](db[_0x2038('0x1b0')],{'as':'Fields','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1a3'),'hooks':!![]});db[_0x2038('0x99')][_0x2038('0x111')](db[_0x2038('0x1b0')],{'as':_0x2038('0x1b1'),'onDelete':'cascade','foreignKey':_0x2038('0x1b2')});db[_0x2038('0x9d')]['hasMany'](db[_0x2038('0x1b0')],{'as':_0x2038('0x1b1'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b3')});db[_0x2038('0x1b0')]['belongsTo'](db[_0x2038('0x9d')],{'foreignKey':_0x2038('0x1b3')});db[_0x2038('0xa1')][_0x2038('0x111')](db['SalesforceConfiguration'],{'as':_0x2038('0x1b4'),'onDelete':'cascade','foreignKey':_0x2038('0x1b5')});db['SalesforceConfiguration']['hasMany'](db[_0x2038('0xa4')],{'as':_0x2038('0x1b6'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xa2')]['hasMany'](db[_0x2038('0xa4')],{'as':_0x2038('0x1b8'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0xa2')][_0x2038('0x111')](db[_0x2038('0xa4')],{'as':'Fields','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1ba')});db['SalesforceConfiguration'][_0x2038('0x11b')](db['SalesforceAccount'],{'as':_0x2038('0x176'),'foreignKey':'AccountId'});db[_0x2038('0xa4')]['hasMany'](db[_0x2038('0xa4')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db['SalesforceField'][_0x2038('0x111')](db[_0x2038('0xa4')],{'as':'Description','foreignKey':_0x2038('0x1b9')});db[_0x2038('0xa4')][_0x2038('0x111')](db[_0x2038('0xa4')],{'as':_0x2038('0x1bc'),'foreignKey':'FieldId'});db['SalesforceField'][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':'VariableId'});db[_0x2038('0x1be')]['hasMany'](db[_0x2038('0x1bf')],{'as':_0x2038('0x1b4'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0x1bf')]['hasMany'](db[_0x2038('0xa7')],{'as':_0x2038('0x1b6'),'onDelete':'cascade','foreignKey':_0x2038('0x1b7')});db[_0x2038('0x1bf')][_0x2038('0x111')](db[_0x2038('0xa7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x2038('0x1b9')});db[_0x2038('0x1bf')][_0x2038('0x111')](db[_0x2038('0xa7')],{'as':_0x2038('0x1b1'),'onDelete':_0x2038('0x10c'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x2038('0x11b')](db[_0x2038('0x1be')],{'as':'Account','foreignKey':_0x2038('0x1b5')});db[_0x2038('0xa7')]['hasMany'](db['SugarcrmField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2038('0xa7')][_0x2038('0x111')](db['SugarcrmField'],{'as':_0x2038('0x1c0'),'foreignKey':'DescriptionId'});db[_0x2038('0xa7')][_0x2038('0x111')](db[_0x2038('0xa7')],{'as':'Field','foreignKey':_0x2038('0x1ba')});db[_0x2038('0xa7')][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':_0x2038('0x1c1')});db['DeskAccount'][_0x2038('0x111')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xaa')][_0x2038('0x111')](db[_0x2038('0xac')],{'as':_0x2038('0x1b6'),'onDelete':_0x2038('0x10c'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0x2038('0xac')],{'as':'Descriptions','onDelete':_0x2038('0x10c'),'foreignKey':'DescriptionId'});db[_0x2038('0xaa')]['hasMany'](db[_0x2038('0xac')],{'as':_0x2038('0x1b1'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xaa')][_0x2038('0x11b')](db[_0x2038('0x1c2')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xaa')][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':_0x2038('0x1c3')});db['DeskField']['hasMany'](db[_0x2038('0xac')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xac')][_0x2038('0x111')](db['DeskField'],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db['DeskField'][_0x2038('0x111')](db[_0x2038('0xac')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db['DeskField'][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':_0x2038('0x1c1')});db[_0x2038('0xae')][_0x2038('0x111')](db[_0x2038('0xb0')],{'as':_0x2038('0x1b4'),'onDelete':'cascade','foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb0')][_0x2038('0x111')](db[_0x2038('0xb2')],{'as':_0x2038('0x1b6'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b7')});db['ZohoConfiguration'][_0x2038('0x111')](db[_0x2038('0xb2')],{'as':_0x2038('0x1b8'),'onDelete':_0x2038('0x10c'),'foreignKey':'DescriptionId'});db[_0x2038('0xb0')][_0x2038('0x111')](db[_0x2038('0xb2')],{'as':_0x2038('0x1b1'),'onDelete':_0x2038('0x10c'),'foreignKey':'FieldId'});db[_0x2038('0xb0')]['belongsTo'](db[_0x2038('0xae')],{'as':'Account','foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb2')]['hasMany'](db['ZohoField'],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db['ZohoField']['hasMany'](db[_0x2038('0xb2')],{'as':_0x2038('0x1c0'),'foreignKey':'DescriptionId'});db[_0x2038('0xb2')]['hasMany'](db[_0x2038('0xb2')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db['ZohoField'][_0x2038('0x11b')](db['Variable'],{'as':_0x2038('0x1bd'),'foreignKey':'VariableId'});db[_0x2038('0x1c4')][_0x2038('0x111')](db[_0x2038('0xb4')],{'as':_0x2038('0x1b4'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb4')][_0x2038('0x111')](db['ZendeskField'],{'as':_0x2038('0x1b6'),'foreignKey':_0x2038('0x1b7')});db['ZendeskConfiguration']['hasMany'](db[_0x2038('0xb5')],{'as':_0x2038('0x1b8'),'foreignKey':'DescriptionId'});db[_0x2038('0xb4')][_0x2038('0x111')](db[_0x2038('0xb5')],{'as':_0x2038('0x1b1'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xb4')]['belongsTo'](db['ZendeskAccount'],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb4')][_0x2038('0x11d')](db[_0x2038('0x89')],{'through':_0x2038('0x1c5')});db[_0x2038('0xb5')][_0x2038('0x111')](db[_0x2038('0xb5')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xb5')][_0x2038('0x111')](db[_0x2038('0xb5')],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0xb5')]['hasMany'](db[_0x2038('0xb5')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xb5')][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2038('0xb7')]['hasMany'](db[_0x2038('0xb9')],{'as':'Configurations','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb9')][_0x2038('0x111')](db[_0x2038('0xbb')],{'as':'Subjects','onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xb9')][_0x2038('0x111')](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x2038('0x1b9')});db[_0x2038('0xb9')][_0x2038('0x111')](db[_0x2038('0xbb')],{'as':'Fields','onDelete':_0x2038('0x10c'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x2038('0x11b')](db[_0x2038('0xb7')],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xb9')]['belongsToMany'](db[_0x2038('0x89')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x2038('0xbb')][_0x2038('0x111')](db[_0x2038('0xbb')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xbb')][_0x2038('0x111')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x2038('0x1b9')});db[_0x2038('0xbb')][_0x2038('0x111')](db[_0x2038('0xbb')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db['FreshdeskField'][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':_0x2038('0x1c1')});db[_0x2038('0x1c6')][_0x2038('0x111')](db[_0x2038('0xbe')],{'as':_0x2038('0x1b4'),'onDelete':_0x2038('0x10c'),'foreignKey':'AccountId'});db[_0x2038('0xbe')][_0x2038('0x111')](db[_0x2038('0xc0')],{'as':_0x2038('0x1b6'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xbe')][_0x2038('0x111')](db[_0x2038('0xc0')],{'as':_0x2038('0x1b8'),'foreignKey':_0x2038('0x1b9')});db['VtigerConfiguration'][_0x2038('0x111')](db['VtigerField'],{'as':_0x2038('0x1b1'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x2038('0x11b')](db[_0x2038('0x1c6')],{'as':'Account','foreignKey':'AccountId'});db[_0x2038('0xc0')][_0x2038('0x111')](db['VtigerField'],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db['VtigerField'][_0x2038('0x111')](db['VtigerField'],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0xc0')]['hasMany'](db['VtigerField'],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xc0')]['belongsTo'](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':_0x2038('0x1c1')});db[_0x2038('0xc1')][_0x2038('0x111')](db[_0x2038('0x1c7')],{'as':_0x2038('0x1b4'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0x1c7')][_0x2038('0x111')](db[_0x2038('0xc4')],{'as':_0x2038('0x1b6'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0x1c7')][_0x2038('0x111')](db[_0x2038('0xc4')],{'as':_0x2038('0x1b8'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x2038('0x111')](db['ServicenowField'],{'as':_0x2038('0x1b1'),'foreignKey':'FieldId'});db[_0x2038('0x1c7')]['belongsTo'](db['ServicenowAccount'],{'as':_0x2038('0x176'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xc4')][_0x2038('0x111')](db[_0x2038('0xc4')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0xc4')][_0x2038('0x111')](db[_0x2038('0xc4')],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0xc4')]['hasMany'](db[_0x2038('0xc4')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xc4')][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0x2038('0x111')](db['Dynamics365Configuration'],{'as':_0x2038('0x1b4'),'onDelete':'cascade','foreignKey':'AccountId'});db['Dynamics365Account'][_0x2038('0x11b')](db[_0x2038('0x158')],{'as':_0x2038('0x158'),'foreignKey':_0x2038('0x159')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2038('0x1b7')});db[_0x2038('0xc7')][_0x2038('0x111')](db[_0x2038('0x1c8')],{'as':_0x2038('0x1b8'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0xc7')][_0x2038('0x111')](db[_0x2038('0x1c8')],{'as':_0x2038('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x2038('0x11b')](db['Dynamics365Account'],{'as':_0x2038('0x176'),'foreignKey':'AccountId'});db[_0x2038('0x1c8')][_0x2038('0x111')](db[_0x2038('0x1c8')],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0x1c8')][_0x2038('0x111')](db[_0x2038('0x1c8')],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db[_0x2038('0x1c8')][_0x2038('0x111')](db[_0x2038('0x1c8')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0x1c8')][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':_0x2038('0x1bd'),'foreignKey':_0x2038('0x1c1')});db['FreshsalesAccount'][_0x2038('0x111')](db[_0x2038('0xca')],{'as':_0x2038('0x1b4'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1b5')});db[_0x2038('0xca')][_0x2038('0x111')](db[_0x2038('0x1c9')],{'as':'Subjects','foreignKey':_0x2038('0x1b7')});db[_0x2038('0xca')]['hasMany'](db[_0x2038('0x1c9')],{'as':_0x2038('0x1b8'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x2038('0x111')](db[_0x2038('0x1c9')],{'as':_0x2038('0x1b1'),'foreignKey':_0x2038('0x1ba')});db[_0x2038('0xca')][_0x2038('0x11b')](db[_0x2038('0xc8')],{'as':'Account','foreignKey':_0x2038('0x1b5')});db[_0x2038('0x1c9')][_0x2038('0x111')](db['FreshsalesField'],{'as':_0x2038('0x1bb'),'foreignKey':_0x2038('0x1b7')});db[_0x2038('0x1c9')][_0x2038('0x111')](db[_0x2038('0x1c9')],{'as':_0x2038('0x1c0'),'foreignKey':_0x2038('0x1b9')});db['FreshsalesField'][_0x2038('0x111')](db[_0x2038('0x1c9')],{'as':_0x2038('0x1bc'),'foreignKey':_0x2038('0x1ba')});db['FreshsalesField'][_0x2038('0x11b')](db[_0x2038('0x1bd')],{'as':'Variable','foreignKey':'VariableId'});db['ChatQueueReport'][_0x2038('0x11b')](db[_0x2038('0x5f')],{});db['ChatQueueReport'][_0x2038('0x11b')](db[_0x2038('0x14b')],{'as':_0x2038('0x15f'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x2038('0x11b')](db['CmContact'],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db[_0x2038('0xcf')][_0x2038('0x11b')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x2038('0x11b')](db[_0x2038('0x66')],{});db['ChatQueueReport']['belongsTo'](db[_0x2038('0x12')],{});db['ChatQueueReport'][_0x2038('0x11b')](db[_0x2038('0x12c')],{});db[_0x2038('0xd1')]['belongsTo'](db[_0x2038('0x12')],{'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1ca')});db[_0x2038('0xd1')][_0x2038('0x11b')](db['User'],{'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1cb')});db['JscriptySessionReport']['hasMany'](db[_0x2038('0x1cc')],{'foreignKey':'SessionId','onDelete':_0x2038('0x10c')});db[_0x2038('0xd4')][_0x2038('0x111')](db[_0x2038('0xd3')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x2038('0x1cd')][_0x2038('0x11b')](db[_0x2038('0x51')],{});db['SmsQueueReport'][_0x2038('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x2038('0x160')});db[_0x2038('0x1cd')][_0x2038('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0x2038('0x156')});db[_0x2038('0x1cd')]['belongsTo'](db[_0x2038('0x54')],{});db[_0x2038('0x1cd')][_0x2038('0x11b')](db[_0x2038('0x55')],{});db['SmsQueueReport'][_0x2038('0x11b')](db[_0x2038('0x12')],{});db['SmsQueueReport'][_0x2038('0x11b')](db[_0x2038('0x57')],{});db[_0x2038('0xd7')]['hasMany'](db[_0x2038('0xd4')],{'foreignKey':_0x2038('0x1ce')});db[_0x2038('0xd7')][_0x2038('0x111')](db['JscriptyQuestionReport'],{'foreignKey':_0x2038('0x1ce')});db[_0x2038('0xd7')][_0x2038('0x111')](db['JscriptyAnswerReport'],{'foreignKey':_0x2038('0x1ce')});db['Team'][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x121')});db[_0x2038('0xe1')][_0x2038('0x11d')](db['VoiceQueue'],{'through':_0x2038('0x105'),'as':_0x2038('0x129')});db[_0x2038('0xe1')][_0x2038('0x11d')](db[_0x2038('0x12b')],{'through':_0x2038('0x162'),'as':_0x2038('0x1cf')});db[_0x2038('0xe1')][_0x2038('0x11d')](db[_0x2038('0x12c')],{'through':_0x2038('0x18d'),'as':'ChatQueues'});db[_0x2038('0xe1')][_0x2038('0x11d')](db[_0x2038('0x4f')],{'through':_0x2038('0x177'),'as':_0x2038('0x12d')});db[_0x2038('0xe1')]['belongsToMany'](db[_0x2038('0x57')],{'through':'team_has_sms_queues','as':_0x2038('0x1d0')});db['Team']['belongsToMany'](db[_0x2038('0x5e')],{'through':_0x2038('0x187'),'as':_0x2038('0x12f')});db[_0x2038('0xe1')][_0x2038('0x11d')](db[_0x2038('0x130')],{'through':_0x2038('0x1d1'),'as':'WhatsappQueues'});db['Team'][_0x2038('0x11d')](db[_0x2038('0xf3')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db['Campaign']['hasMany'](db[_0x2038('0x71')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x2038('0xe4')]['hasMany'](db[_0x2038('0x74')],{'as':_0x2038('0x113'),'foreignKey':'CampaignId'});db['Campaign'][_0x2038('0x111')](db[_0x2038('0x76')],{'as':_0x2038('0x143'),'foreignKey':_0x2038('0x197')});db[_0x2038('0xe4')][_0x2038('0x111')](db[_0x2038('0x72')],{'as':_0x2038('0x1d2'),'foreignKey':'CampaignId'});db[_0x2038('0xe4')][_0x2038('0x11b')](db[_0x2038('0x2a')],{'as':_0x2038('0x2a'),'foreignKey':_0x2038('0x145')});db['Campaign']['belongsTo'](db[_0x2038('0x2a')],{'as':_0x2038('0x146'),'foreignKey':_0x2038('0x147')});db['Campaign'][_0x2038('0x11b')](db[_0x2038('0x83')],{'as':_0x2038('0x83'),'foreignKey':'IntervalId'});db[_0x2038('0xe4')][_0x2038('0x11b')](db[_0x2038('0xdd')],{'as':_0x2038('0xdd'),'foreignKey':'SquareProjectId'});db[_0x2038('0xe4')]['belongsToMany'](db['CmList'],{'as':_0x2038('0x120'),'through':_0x2038('0x1d3')});db['Campaign'][_0x2038('0x11d')](db[_0x2038('0x14b')],{'as':'BlackLists','through':_0x2038('0x1d4')});db[_0x2038('0xe8')][_0x2038('0x11b')](db[_0x2038('0x68')],{'as':_0x2038('0x68'),'foreignKey':_0x2038('0x16c')});db['MailTransferReport'][_0x2038('0x11b')](db['MailMessage'],{});db[_0x2038('0x1d5')][_0x2038('0x11b')](db[_0x2038('0x41')],{});db['MailTransferReport'][_0x2038('0x11b')](db[_0x2038('0x137')],{'foreignKey':_0x2038('0x1d6'),'as':_0x2038('0x1d7')});db[_0x2038('0x1d5')][_0x2038('0x11b')](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1d8'),'as':_0x2038('0x1d9')});db[_0x2038('0x1d5')]['belongsTo'](db[_0x2038('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x2038('0x1d5')][_0x2038('0x11b')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x2038('0x1da')});db[_0x2038('0x1d5')][_0x2038('0x11b')](db[_0x2038('0x137')],{'foreignKey':_0x2038('0x1db'),'as':_0x2038('0x1dc')});db[_0x2038('0xec')][_0x2038('0x11b')](db[_0x2038('0x66')],{});db[_0x2038('0xec')]['belongsTo'](db[_0x2038('0x115')],{});db['ChatTransferReport'][_0x2038('0x11b')](db[_0x2038('0x5f')],{'foreignKey':_0x2038('0x1dd'),'as':_0x2038('0x1d7')});db[_0x2038('0xec')][_0x2038('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0x2038('0x1d9')});db['ChatTransferReport']['belongsTo'](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1de'),'as':_0x2038('0x1df')});db[_0x2038('0xec')][_0x2038('0x11b')](db[_0x2038('0x12c')],{'foreignKey':_0x2038('0x1e0'),'as':_0x2038('0x1da')});db[_0x2038('0xec')]['belongsTo'](db[_0x2038('0x5f')],{'foreignKey':_0x2038('0x1e1'),'as':_0x2038('0x1dc')});db[_0x2038('0x1e2')][_0x2038('0x11b')](db[_0x2038('0x171')],{});db[_0x2038('0x1e2')][_0x2038('0x11b')](db[_0x2038('0x4d')],{});db['FaxTransferReport']['belongsTo'](db[_0x2038('0x4a')],{'foreignKey':'FromFaxAccountId','as':_0x2038('0x1d7')});db[_0x2038('0x1e2')]['belongsTo'](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1d8'),'as':'FromAgent'});db[_0x2038('0x1e2')][_0x2038('0x11b')](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1de'),'as':_0x2038('0x1df')});db['FaxTransferReport'][_0x2038('0x11b')](db['FaxQueue'],{'foreignKey':_0x2038('0x1e3'),'as':_0x2038('0x1da')});db[_0x2038('0x1e2')][_0x2038('0x11b')](db[_0x2038('0x4a')],{'foreignKey':_0x2038('0x1e4'),'as':_0x2038('0x1dc')});db['OpenchannelTransferReport'][_0x2038('0x11b')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x2038('0x11b')](db[_0x2038('0x5b')],{});db[_0x2038('0xef')][_0x2038('0x11b')](db[_0x2038('0x138')],{'foreignKey':'FromOpenchannelAccountId','as':_0x2038('0x1d7')});db['OpenchannelTransferReport'][_0x2038('0x11b')](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1d8'),'as':'FromAgent'});db[_0x2038('0xef')][_0x2038('0x11b')](db['User'],{'foreignKey':_0x2038('0x1de'),'as':_0x2038('0x1df')});db['OpenchannelTransferReport'][_0x2038('0x11b')](db['OpenchannelQueue'],{'foreignKey':_0x2038('0x1e5'),'as':_0x2038('0x1da')});db[_0x2038('0xef')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x2038('0x1e6'),'as':_0x2038('0x1dc')});db[_0x2038('0xf1')][_0x2038('0x11b')](db[_0x2038('0x55')],{});db[_0x2038('0xf1')]['belongsTo'](db[_0x2038('0x54')],{});db[_0x2038('0xf1')]['belongsTo'](db[_0x2038('0x51')],{'foreignKey':_0x2038('0x1e7'),'as':'FromAccount'});db[_0x2038('0xf1')][_0x2038('0x11b')](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1d8'),'as':_0x2038('0x1d9')});db[_0x2038('0xf1')][_0x2038('0x11b')](db['User'],{'foreignKey':_0x2038('0x1de'),'as':_0x2038('0x1df')});db[_0x2038('0xf1')][_0x2038('0x11b')](db[_0x2038('0x57')],{'foreignKey':_0x2038('0x1e8'),'as':_0x2038('0x1da')});db[_0x2038('0xf1')][_0x2038('0x11b')](db[_0x2038('0x51')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x2038('0x14b')][_0x2038('0x111')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2038('0x160'),'onDelete':_0x2038('0x10c')});db[_0x2038('0x14b')][_0x2038('0x111')](db[_0x2038('0x1e9')],{'as':_0x2038('0x1ea'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x14b')][_0x2038('0x111')](db['CmContact'],{'as':'Contacts','onDelete':_0x2038('0x10c'),'foreignKey':'ListId'});db[_0x2038('0x14b')]['hasMany'](db[_0x2038('0x74')],{'as':_0x2038('0x113'),'foreignKey':_0x2038('0x160')});db[_0x2038('0x14b')]['hasMany'](db[_0x2038('0x76')],{'as':'HopperHistory','foreignKey':_0x2038('0x160')});db[_0x2038('0x14b')][_0x2038('0x111')](db[_0x2038('0x78')],{'as':_0x2038('0x78'),'foreignKey':'ListId'});db[_0x2038('0x14b')][_0x2038('0x11d')](db['VoiceQueue'],{'as':_0x2038('0x1eb'),'through':'voice_queues_has_cm_lists'});db[_0x2038('0x14b')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':'cm_user_has_lists'});db[_0x2038('0xf3')][_0x2038('0x111')](db[_0x2038('0x18')],{'as':_0x2038('0x1a0'),'onDelete':_0x2038('0x10c')});db[_0x2038('0xf3')][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':'Agents','through':_0x2038('0x1ec')});db[_0x2038('0xf3')][_0x2038('0x11d')](db['Team'],{'through':'TeamVoicePrefix','as':_0x2038('0x14d')});db[_0x2038('0xf5')][_0x2038('0x111')](db[_0x2038('0x12')],{'as':'Users','foreignKey':_0x2038('0x11c')});db[_0x2038('0xf5')]['hasMany'](db['UserProfileSection'],{'as':_0x2038('0x1ed'),'foreignKey':'userProfileId','onDelete':_0x2038('0x10c')});db[_0x2038('0xf6')]['hasMany'](db[_0x2038('0x1ee')],{'as':'Resources','foreignKey':_0x2038('0x1ef'),'onDelete':_0x2038('0x10c')});db['WhatsappAccount'][_0x2038('0x111')](db[_0x2038('0x80')],{'as':_0x2038('0x15c'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x2038('0xfb')][_0x2038('0x111')](db[_0x2038('0x7e')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0x2038('0xfb')][_0x2038('0x111')](db['WhatsappMessage'],{'as':_0x2038('0x150'),'foreignKey':_0x2038('0x1f0')});db[_0x2038('0xfb')][_0x2038('0x111')](db[_0x2038('0xff')],{'as':_0x2038('0x15e')});db[_0x2038('0xfb')][_0x2038('0x111')](db['WhatsappApplication'],{'as':_0x2038('0x13d')});db[_0x2038('0xfb')][_0x2038('0x11b')](db['CmList'],{'as':_0x2038('0x15f'),'foreignKey':_0x2038('0x160')});db[_0x2038('0xfb')][_0x2038('0x11b')](db[_0x2038('0x149')],{'as':_0x2038('0x179'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2038('0xfb')]['belongsToMany'](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':'user_has_whatsapp_accounts'});db[_0x2038('0xfd')][_0x2038('0x11b')](db[_0x2038('0x12')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0xfd')][_0x2038('0x11b')](db['WhatsappQueue'],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x2038('0xfb')],{'onDelete':_0x2038('0x15a')});db[_0x2038('0xfd')]['belongsTo'](db['Interval'],{'onDelete':_0x2038('0x15a'),'foreignKey':'IntervalId'});db[_0x2038('0xfd')]['belongsTo'](db[_0x2038('0x89')],{'onDelete':_0x2038('0x15a'),'foreignKey':_0x2038('0x17b')});db[_0x2038('0xff')]['hasMany'](db[_0x2038('0x1f1')],{'as':_0x2038('0x150'),'onDelete':_0x2038('0x10c'),'foreignKey':_0x2038('0x1f2')});db[_0x2038('0xff')][_0x2038('0x11b')](db[_0x2038('0xfb')],{'as':_0x2038('0x176'),'foreignKey':'WhatsappAccountId'});db[_0x2038('0xff')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':'ContactId'});db[_0x2038('0xff')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x164'),'foreignKey':_0x2038('0x110')});db['WhatsappInteraction'][_0x2038('0x11d')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x2038('0x166')});db[_0x2038('0xff')][_0x2038('0x11d')](db['Tag'],{'through':_0x2038('0x1a7'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x2038('0x128'),'foreignKey':_0x2038('0x1f2')});db[_0x2038('0x1f1')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x12')});db['WhatsappMessage']['belongsTo'](db[_0x2038('0x6f')],{'onDelete':'cascade','as':_0x2038('0x163')});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x2038('0x10c'),'as':_0x2038('0x16a'),'foreignKey':_0x2038('0x1f2')});db[_0x2038('0x1f1')]['belongsTo'](db[_0x2038('0xfb')],{'as':_0x2038('0x176'),'foreignKey':'WhatsappAccountId'});db[_0x2038('0x101')]['belongsTo'](db['WhatsappAccount'],{});db[_0x2038('0x101')][_0x2038('0x11b')](db['CmList'],{'as':_0x2038('0x15f'),'foreignKey':'ListId'});db[_0x2038('0x101')][_0x2038('0x11b')](db[_0x2038('0x6f')],{'as':_0x2038('0x163'),'foreignKey':_0x2038('0x156')});db[_0x2038('0x101')]['belongsTo'](db[_0x2038('0xff')],{});db[_0x2038('0x101')][_0x2038('0x11b')](db[_0x2038('0x130')],{});db[_0x2038('0x101')][_0x2038('0x11b')](db[_0x2038('0x1f1')],{});db[_0x2038('0x101')][_0x2038('0x11b')](db[_0x2038('0x12')],{});db[_0x2038('0x102')][_0x2038('0x11b')](db[_0x2038('0x1f1')],{});db['WhatsappTransferReport'][_0x2038('0x11b')](db[_0x2038('0xff')],{});db['WhatsappTransferReport'][_0x2038('0x11b')](db[_0x2038('0xfb')],{'foreignKey':_0x2038('0x1f3'),'as':_0x2038('0x1d7')});db[_0x2038('0x102')][_0x2038('0x11b')](db[_0x2038('0xfb')],{'foreignKey':_0x2038('0x1f4'),'as':_0x2038('0x1dc')});db[_0x2038('0x102')][_0x2038('0x11b')](db[_0x2038('0x130')],{'foreignKey':_0x2038('0x1f5'),'as':'ToQueue'});db[_0x2038('0x102')][_0x2038('0x11b')](db['User'],{'foreignKey':_0x2038('0x1d8'),'as':_0x2038('0x1d9')});db[_0x2038('0x102')][_0x2038('0x11b')](db[_0x2038('0x12')],{'foreignKey':_0x2038('0x1de'),'as':_0x2038('0x1df')});db['WhatsappQueue'][_0x2038('0x11d')](db[_0x2038('0x12')],{'as':_0x2038('0x161'),'through':_0x2038('0x38'),'foreignKey':_0x2038('0x1f6')});db[_0x2038('0x130')][_0x2038('0x11d')](db['Team'],{'through':_0x2038('0x1d1'),'as':'Teams'});db[_0x2038('0x109')][_0x2038('0x11b')](db[_0x2038('0x12')],{'as':_0x2038('0x1f7'),'foreignKey':_0x2038('0x110'),'onDelete':_0x2038('0x10c'),'hooks':!![]});db[_0x2038('0x158')][_0x2038('0x10b')](db[_0x2038('0xc5')],{'as':_0x2038('0xc5'),'onDelete':_0x2038('0x15a')});db[_0x2038('0x158')][_0x2038('0x10b')](db[_0x2038('0x3a')],{'as':_0x2038('0x15b'),'onDelete':'restrict'});db['CloudProvider'][_0x2038('0x10b')](db['MailServerOut'],{'as':_0x2038('0x1f8'),'onDelete':_0x2038('0x15a')});module[_0x2038('0x1f9')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6d751cb..c2573a4 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcebf=['/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/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/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','/api/logs','/apidoc','join','root','/demo','static','/snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/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/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration'];(function(_0x535d17,_0x50a2a2){var _0x56cb1d=function(_0x4e0f8d){while(--_0x4e0f8d){_0x535d17['push'](_0x535d17['shift']());}};_0x56cb1d(++_0x50a2a2);}(_0xcebf,0x7d));var _0xfceb=function(_0x3495a0,_0x3b9a3f){_0x3495a0=_0x3495a0-0x0;var _0x4c0c69=_0xcebf[_0x3495a0];return _0x4c0c69;};'use strict';var path=require('path');var express=require(_0xfceb('0x0'));var errors=require(_0xfceb('0x1'));var config=require(_0xfceb('0x2'));var setupLoggers=require(_0xfceb('0x3'))[_0xfceb('0x4')];var clientSideLogs=require(_0xfceb('0x5'));exports[_0xfceb('0x6')]=function(_0x1d81b6){return setupLoggers(_0x1d81b6)[_0xfceb('0x7')](function(){_0x1d81b6[_0xfceb('0x8')]('/api/users',require(_0xfceb('0x9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa'),require(_0xfceb('0xb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc'),require(_0xfceb('0xd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe'),require('./api/voiceExtension'));_0x1d81b6['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf'),require('./api/voiceQueue'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x10'),require(_0xfceb('0x11')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x12'),require(_0xfceb('0x13')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x14'),require('./api/voiceMail'));_0x1d81b6['use'](_0xfceb('0x15'),require(_0xfceb('0x16')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x17'),require(_0xfceb('0x18')));_0x1d81b6['use'](_0xfceb('0x19'),require(_0xfceb('0x1a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1b'),require(_0xfceb('0x1c')));_0x1d81b6[_0xfceb('0x8')]('/api/voice/queues/reports',require(_0xfceb('0x1d')));_0x1d81b6[_0xfceb('0x8')]('/api/members/reports',require('./api/memberReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1e'),require('./api/trunk'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x1f'),require(_0xfceb('0x20')));_0x1d81b6['use'](_0xfceb('0x21'),require(_0xfceb('0x22')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x23'),require('./api/mailAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x24'),require('./api/mailQueue'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x25'),require(_0xfceb('0x26')));_0x1d81b6['use'](_0xfceb('0x27'),require(_0xfceb('0x28')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x29'),require('./api/mailMessage'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2a'),require('./api/mailApplication'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2b'),require(_0xfceb('0x2c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2d'),require(_0xfceb('0x2e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x2f'),require(_0xfceb('0x30')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x31'),require(_0xfceb('0x32')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x33'),require(_0xfceb('0x34')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x35'),require(_0xfceb('0x36')));_0x1d81b6['use'](_0xfceb('0x37'),require(_0xfceb('0x38')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x39'),require(_0xfceb('0x3a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3b'),require(_0xfceb('0x3c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3d'),require('./api/smsAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x3e'),require(_0xfceb('0x3f')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x40'),require(_0xfceb('0x41')));_0x1d81b6[_0xfceb('0x8')]('/api/sms/messages',require(_0xfceb('0x42')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x43'),require(_0xfceb('0x44')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x45'),require(_0xfceb('0x46')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x47'),require(_0xfceb('0x48')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x49'),require('./api/openchannelInteraction'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4a'),require(_0xfceb('0x4b')));_0x1d81b6['use'](_0xfceb('0x4c'),require('./api/openchannelQueue'));_0x1d81b6['use']('/api/chat/websites',require(_0xfceb('0x4d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4e'),require('./api/openchannelQueueReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x4f'),require(_0xfceb('0x50')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x51'),require(_0xfceb('0x52')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x53'),require(_0xfceb('0x54')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x1d81b6['use'](_0xfceb('0x55'),require(_0xfceb('0x56')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x57'),require(_0xfceb('0x58')));_0x1d81b6['use'](_0xfceb('0x59'),require(_0xfceb('0x5a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5b'),require('./api/cmContact'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5c'),require(_0xfceb('0x5d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x5e'),require(_0xfceb('0x5f')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x60'),require(_0xfceb('0x61')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x62'),require(_0xfceb('0x63')));_0x1d81b6[_0xfceb('0x8')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x64'),require('./api/action'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x65'),require(_0xfceb('0x66')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x67'),require('./api/cannedAnswer'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x68'),require('./api/disposition'));_0x1d81b6[_0xfceb('0x8')]('/api/conditions',require(_0xfceb('0x69')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6a'),require('./api/interval'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6b'),require(_0xfceb('0x6c')));_0x1d81b6['use'](_0xfceb('0x6d'),require('./api/cdr'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x6e'),require(_0xfceb('0x6f')));_0x1d81b6['use'](_0xfceb('0x70'),require(_0xfceb('0x71')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x72'),require(_0xfceb('0x73')));_0x1d81b6[_0xfceb('0x8')]('/api/tags',require(_0xfceb('0x74')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x75'),require('./api/contactItemType'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x76'),require(_0xfceb('0x77')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x78'),require(_0xfceb('0x79')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7a'),require(_0xfceb('0x7b')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7c'),require(_0xfceb('0x7d')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7e'),require('./api/variable'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations',require('./api/integration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x7f'),require(_0xfceb('0x80')));_0x1d81b6['use'](_0xfceb('0x81'),require(_0xfceb('0x82')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x83'),require(_0xfceb('0x84')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x85'),require(_0xfceb('0x86')));_0x1d81b6['use'](_0xfceb('0x87'),require(_0xfceb('0x88')));_0x1d81b6['use'](_0xfceb('0x89'),require(_0xfceb('0x8a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x8b'),require(_0xfceb('0x8c')));_0x1d81b6['use'](_0xfceb('0x8d'),require(_0xfceb('0x8e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x8f'),require(_0xfceb('0x90')));_0x1d81b6['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1d81b6['use'](_0xfceb('0x91'),require('./api/intSugarcrmAccount'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xfceb('0x92')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x93'),require(_0xfceb('0x94')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/desk/configurations',require(_0xfceb('0x95')));_0x1d81b6['use'](_0xfceb('0x96'),require(_0xfceb('0x97')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/zoho/accounts',require(_0xfceb('0x98')));_0x1d81b6['use'](_0xfceb('0x99'),require(_0xfceb('0x9a')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9b'),require(_0xfceb('0x9c')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9d'),require(_0xfceb('0x9e')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x9f'),require(_0xfceb('0xa0')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa1'),require(_0xfceb('0xa2')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa3'),require(_0xfceb('0xa4')));_0x1d81b6['use'](_0xfceb('0xa5'),require(_0xfceb('0xa6')));_0x1d81b6['use'](_0xfceb('0xa7'),require(_0xfceb('0xa8')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xa9'),require('./api/intVtigerConfiguration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xaa'),require(_0xfceb('0xab')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xac'),require(_0xfceb('0xad')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xae'),require(_0xfceb('0xaf')));_0x1d81b6['use'](_0xfceb('0xb0'),require(_0xfceb('0xb1')));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/dynamics365/accounts',require(_0xfceb('0xb2')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb3'),require(_0xfceb('0xb4')));_0x1d81b6['use'](_0xfceb('0xb5'),require('./api/intDynamics365Field'));_0x1d81b6[_0xfceb('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb6'),require(_0xfceb('0xb7')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xb8'),require(_0xfceb('0xb9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xba'),require(_0xfceb('0xbb')));_0x1d81b6['use'](_0xfceb('0xbc'),require('./api/chatQueueReport'));_0x1d81b6[_0xfceb('0x8')]('/api/chat/internal/messages',require(_0xfceb('0xbd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xbe'),require(_0xfceb('0xbf')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc0'),require('./api/jscriptyQuestionReport'));_0x1d81b6[_0xfceb('0x8')]('/api/jscripty/sessions/reports',require(_0xfceb('0xc1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc2'),require(_0xfceb('0xc3')));_0x1d81b6[_0xfceb('0x8')]('/api/square/reports',require(_0xfceb('0xc4')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc5'),require(_0xfceb('0xc6')));_0x1d81b6[_0xfceb('0x8')]('/api/jscripty/projects',require(_0xfceb('0xc7')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xc8'),require(_0xfceb('0xc9')));_0x1d81b6[_0xfceb('0x8')]('/api/square/odbc',require(_0xfceb('0xca')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xcb'),require(_0xfceb('0xcc')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xcd'),require('./api/squareRecording'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xce'),require(_0xfceb('0xcf')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd0'),require(_0xfceb('0xd1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd2'),require('./api/license'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd3'),require(_0xfceb('0xd4')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd5'),require('./api/migration'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xd6'),require('./api/attachment'));_0x1d81b6[_0xfceb('0x8')]('/api/plugins',require(_0xfceb('0xd7')));_0x1d81b6['use']('/api/mail/reports/transfer',require(_0xfceb('0xd8')));_0x1d81b6[_0xfceb('0x8')]('/api/chat/reports/transfer',require(_0xfceb('0xd9')));_0x1d81b6['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xda'),require(_0xfceb('0xdb')));_0x1d81b6['use'](_0xfceb('0xdc'),require(_0xfceb('0xdd')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xde'),require('./api/cmList'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xdf'),require('./api/voicePrefix'));_0x1d81b6[_0xfceb('0x8')]('/api/userProfiles',require(_0xfceb('0xe0')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe1'),require('./api/userProfileSection'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe2'),require(_0xfceb('0xe3')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe4'),require(_0xfceb('0xe5')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xe6'),require('./api/whatsappAccount'));_0x1d81b6[_0xfceb('0x8')]('/api/whatsapp/applications',require(_0xfceb('0xe7')));_0x1d81b6['use'](_0xfceb('0xe8'),require(_0xfceb('0xe9')));_0x1d81b6['use'](_0xfceb('0xea'),require(_0xfceb('0xeb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xec'),require(_0xfceb('0xed')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xee'),require(_0xfceb('0xef')));_0x1d81b6['use'](_0xfceb('0xf0'),require(_0xfceb('0xf1')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf2'),require(_0xfceb('0xf3')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf4'),require(_0xfceb('0xf5')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xf6'),require(_0xfceb('0xf7')));_0x1d81b6['use'](_0xfceb('0xf8'),require(_0xfceb('0xf9')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xfa'),require(_0xfceb('0xfb')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0xfc'),require('./api/authActiveDirectory'));_0x1d81b6[_0xfceb('0x8')]('/api/jira',require(_0xfceb('0xfd')));_0x1d81b6[_0xfceb('0x8')]('/api/rpc',require(_0xfceb('0xfe')));_0x1d81b6[_0xfceb('0x8')]('/api/version',require(_0xfceb('0xff')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x100'),require(_0xfceb('0x101')));_0x1d81b6['use']('/api/pm2',require('./api/pm2'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x102'),require('./api/webbar'));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x103'),clientSideLogs);_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x104'),express['static'](path[_0xfceb('0x105')](config[_0xfceb('0x106')],'/apidoc')));_0x1d81b6[_0xfceb('0x8')]('/www',express['static'](path['join'](config['root'],'/www')));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x107'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],_0xfceb('0x107'))));_0x1d81b6[_0xfceb('0x8')](_0xfceb('0x109'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],'snippet',_0xfceb('0x10a'))));_0x1d81b6['use'](_0xfceb('0x10b'),express[_0xfceb('0x108')](path[_0xfceb('0x105')](config[_0xfceb('0x106')],_0xfceb('0x10c'))));_0x1d81b6[_0xfceb('0x10d')](_0xfceb('0x10e'))[_0xfceb('0x10f')](errors[0x194]);_0x1d81b6[_0xfceb('0x10d')]('/*')[_0xfceb('0x10f')](function(_0x385b70,_0x38ed79){_0x38ed79['sendFile'](path[_0xfceb('0x110')](_0x1d81b6[_0xfceb('0x10f')](_0xfceb('0x111'))+_0xfceb('0x112')));});return _0x1d81b6;});}; \ No newline at end of file +var _0xb33b=['./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_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/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/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/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc'];(function(_0xf54f2f,_0x58321f){var _0x4ae356=function(_0x264bba){while(--_0x264bba){_0xf54f2f['push'](_0xf54f2f['shift']());}};_0x4ae356(++_0x58321f);}(_0xb33b,0x129));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xbb33('0x0'));var express=require(_0xbb33('0x1'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0xbb33('0x2'))[_0xbb33('0x3')];var clientSideLogs=require(_0xbb33('0x4'));exports[_0xbb33('0x5')]=function(_0x446118){return setupLoggers(_0x446118)['then'](function(){_0x446118[_0xbb33('0x6')](_0xbb33('0x7'),require(_0xbb33('0x8')));_0x446118['use'](_0xbb33('0x9'),require('./api/voiceChanSpy'));_0x446118['use']('/api/voice/contexts',require(_0xbb33('0xa')));_0x446118[_0xbb33('0x6')](_0xbb33('0xb'),require('./api/voiceExtension'));_0x446118[_0xbb33('0x6')]('/api/voice/mohs',require(_0xbb33('0xc')));_0x446118['use'](_0xbb33('0xd'),require(_0xbb33('0xe')));_0x446118['use'](_0xbb33('0xf'),require(_0xbb33('0x10')));_0x446118['use']('/api/screen/recordings',require(_0xbb33('0x11')));_0x446118[_0xbb33('0x6')]('/api/voice/mails',require(_0xbb33('0x12')));_0x446118[_0xbb33('0x6')](_0xbb33('0x13'),require(_0xbb33('0x14')));_0x446118['use']('/api/voice/calls/reports',require(_0xbb33('0x15')));_0x446118[_0xbb33('0x6')]('/api/voice/dials/reports',require(_0xbb33('0x16')));_0x446118['use'](_0xbb33('0x17'),require(_0xbb33('0x18')));_0x446118[_0xbb33('0x6')]('/api/voice/queues/reports',require(_0xbb33('0x19')));_0x446118[_0xbb33('0x6')]('/api/members/reports',require(_0xbb33('0x1a')));_0x446118[_0xbb33('0x6')](_0xbb33('0x1b'),require('./api/trunk'));_0x446118['use']('/api/voice/transfers/reports',require(_0xbb33('0x1c')));_0x446118[_0xbb33('0x6')](_0xbb33('0x1d'),require('./api/mailServerOut'));_0x446118['use'](_0xbb33('0x1e'),require(_0xbb33('0x1f')));_0x446118[_0xbb33('0x6')](_0xbb33('0x20'),require(_0xbb33('0x21')));_0x446118['use']('/api/mail/substatuses',require(_0xbb33('0x22')));_0x446118[_0xbb33('0x6')](_0xbb33('0x23'),require('./api/mailInteraction'));_0x446118[_0xbb33('0x6')]('/api/mail/messages',require(_0xbb33('0x24')));_0x446118[_0xbb33('0x6')](_0xbb33('0x25'),require(_0xbb33('0x26')));_0x446118[_0xbb33('0x6')]('/api/mail/reports/queue',require(_0xbb33('0x27')));_0x446118[_0xbb33('0x6')]('/api/dashboards',require(_0xbb33('0x28')));_0x446118['use'](_0xbb33('0x29'),require(_0xbb33('0x2a')));_0x446118[_0xbb33('0x6')]('/api/fax/accounts',require(_0xbb33('0x2b')));_0x446118['use'](_0xbb33('0x2c'),require(_0xbb33('0x2d')));_0x446118[_0xbb33('0x6')](_0xbb33('0x2e'),require(_0xbb33('0x2f')));_0x446118['use'](_0xbb33('0x30'),require(_0xbb33('0x31')));_0x446118['use'](_0xbb33('0x32'),require(_0xbb33('0x33')));_0x446118['use'](_0xbb33('0x34'),require(_0xbb33('0x35')));_0x446118[_0xbb33('0x6')]('/api/sms/accounts',require('./api/smsAccount'));_0x446118[_0xbb33('0x6')]('/api/sms/applications',require('./api/smsApplication'));_0x446118[_0xbb33('0x6')]('/api/sms/interactions',require('./api/smsInteraction'));_0x446118[_0xbb33('0x6')](_0xbb33('0x36'),require(_0xbb33('0x37')));_0x446118['use']('/api/sms/queues',require(_0xbb33('0x38')));_0x446118[_0xbb33('0x6')]('/api/openchannel/accounts',require(_0xbb33('0x39')));_0x446118['use'](_0xbb33('0x3a'),require('./api/openchannelApplication'));_0x446118[_0xbb33('0x6')](_0xbb33('0x3b'),require(_0xbb33('0x3c')));_0x446118[_0xbb33('0x6')](_0xbb33('0x3d'),require(_0xbb33('0x3e')));_0x446118[_0xbb33('0x6')](_0xbb33('0x3f'),require(_0xbb33('0x40')));_0x446118[_0xbb33('0x6')](_0xbb33('0x41'),require('./api/chatWebsite'));_0x446118[_0xbb33('0x6')]('/api/openchannel/reports/queue',require(_0xbb33('0x42')));_0x446118[_0xbb33('0x6')](_0xbb33('0x43'),require(_0xbb33('0x44')));_0x446118['use'](_0xbb33('0x45'),require(_0xbb33('0x46')));_0x446118['use']('/api/chat/messages',require(_0xbb33('0x47')));_0x446118[_0xbb33('0x6')](_0xbb33('0x48'),require(_0xbb33('0x49')));_0x446118['use'](_0xbb33('0x4a'),require(_0xbb33('0x4b')));_0x446118['use'](_0xbb33('0x4c'),require(_0xbb33('0x4d')));_0x446118[_0xbb33('0x6')]('/api/chat/proactive_actions',require(_0xbb33('0x4e')));_0x446118[_0xbb33('0x6')]('/api/cm/companies',require(_0xbb33('0x4f')));_0x446118['use'](_0xbb33('0x50'),require(_0xbb33('0x51')));_0x446118[_0xbb33('0x6')](_0xbb33('0x52'),require(_0xbb33('0x53')));_0x446118[_0xbb33('0x6')](_0xbb33('0x54'),require(_0xbb33('0x55')));_0x446118['use'](_0xbb33('0x56'),require(_0xbb33('0x57')));_0x446118[_0xbb33('0x6')](_0xbb33('0x58'),require(_0xbb33('0x59')));_0x446118[_0xbb33('0x6')](_0xbb33('0x5a'),require(_0xbb33('0x5b')));_0x446118[_0xbb33('0x6')]('/api/actions',require(_0xbb33('0x5c')));_0x446118[_0xbb33('0x6')](_0xbb33('0x5d'),require(_0xbb33('0x5e')));_0x446118[_0xbb33('0x6')]('/api/canned_answers',require(_0xbb33('0x5f')));_0x446118[_0xbb33('0x6')](_0xbb33('0x60'),require(_0xbb33('0x61')));_0x446118[_0xbb33('0x6')](_0xbb33('0x62'),require(_0xbb33('0x63')));_0x446118[_0xbb33('0x6')](_0xbb33('0x64'),require(_0xbb33('0x65')));_0x446118[_0xbb33('0x6')]('/api/pauses',require(_0xbb33('0x66')));_0x446118[_0xbb33('0x6')]('/api/cdr',require(_0xbb33('0x67')));_0x446118[_0xbb33('0x6')](_0xbb33('0x68'),require(_0xbb33('0x69')));_0x446118['use'](_0xbb33('0x6a'),require('./api/schedule'));_0x446118[_0xbb33('0x6')](_0xbb33('0x6b'),require(_0xbb33('0x6c')));_0x446118[_0xbb33('0x6')](_0xbb33('0x6d'),require(_0xbb33('0x6e')));_0x446118[_0xbb33('0x6')](_0xbb33('0x6f'),require('./api/contactItemType'));_0x446118[_0xbb33('0x6')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x446118[_0xbb33('0x6')]('/api/cm_hopper_additional_phones',require(_0xbb33('0x70')));_0x446118[_0xbb33('0x6')](_0xbb33('0x71'),require(_0xbb33('0x72')));_0x446118['use'](_0xbb33('0x73'),require(_0xbb33('0x74')));_0x446118[_0xbb33('0x6')](_0xbb33('0x75'),require('./api/variable'));_0x446118[_0xbb33('0x6')](_0xbb33('0x76'),require(_0xbb33('0x77')));_0x446118['use'](_0xbb33('0x78'),require(_0xbb33('0x79')));_0x446118[_0xbb33('0x6')]('/api/analytics/custom_reports',require(_0xbb33('0x7a')));_0x446118[_0xbb33('0x6')](_0xbb33('0x7b'),require('./api/analyticDefaultReport'));_0x446118[_0xbb33('0x6')]('/api/analytics/extracted_reports',require(_0xbb33('0x7c')));_0x446118['use'](_0xbb33('0x7d'),require(_0xbb33('0x7e')));_0x446118[_0xbb33('0x6')](_0xbb33('0x7f'),require(_0xbb33('0x80')));_0x446118['use'](_0xbb33('0x81'),require(_0xbb33('0x82')));_0x446118[_0xbb33('0x6')](_0xbb33('0x83'),require(_0xbb33('0x84')));_0x446118['use'](_0xbb33('0x85'),require('./api/intSalesforceConfiguration'));_0x446118[_0xbb33('0x6')]('/api/integrations/salesforce/fields',require(_0xbb33('0x86')));_0x446118[_0xbb33('0x6')](_0xbb33('0x87'),require(_0xbb33('0x88')));_0x446118['use'](_0xbb33('0x89'),require(_0xbb33('0x8a')));_0x446118[_0xbb33('0x6')](_0xbb33('0x8b'),require(_0xbb33('0x8c')));_0x446118[_0xbb33('0x6')](_0xbb33('0x8d'),require('./api/intDeskAccount'));_0x446118[_0xbb33('0x6')](_0xbb33('0x8e'),require(_0xbb33('0x8f')));_0x446118['use']('/api/integrations/desk/fields',require(_0xbb33('0x90')));_0x446118[_0xbb33('0x6')]('/api/integrations/zoho/accounts',require(_0xbb33('0x91')));_0x446118['use'](_0xbb33('0x92'),require('./api/intZohoConfiguration'));_0x446118['use'](_0xbb33('0x93'),require(_0xbb33('0x94')));_0x446118[_0xbb33('0x6')](_0xbb33('0x95'),require(_0xbb33('0x96')));_0x446118[_0xbb33('0x6')]('/api/integrations/zendesk/configurations',require(_0xbb33('0x97')));_0x446118[_0xbb33('0x6')](_0xbb33('0x98'),require(_0xbb33('0x99')));_0x446118[_0xbb33('0x6')]('/api/integrations/freshdesk/accounts',require(_0xbb33('0x9a')));_0x446118[_0xbb33('0x6')](_0xbb33('0x9b'),require(_0xbb33('0x9c')));_0x446118['use'](_0xbb33('0x9d'),require(_0xbb33('0x9e')));_0x446118[_0xbb33('0x6')](_0xbb33('0x9f'),require(_0xbb33('0xa0')));_0x446118['use'](_0xbb33('0xa1'),require(_0xbb33('0xa2')));_0x446118[_0xbb33('0x6')]('/api/integrations/vtiger/fields',require(_0xbb33('0xa3')));_0x446118[_0xbb33('0x6')](_0xbb33('0xa4'),require('./api/intServicenowAccount'));_0x446118[_0xbb33('0x6')](_0xbb33('0xa5'),require(_0xbb33('0xa6')));_0x446118[_0xbb33('0x6')]('/api/integrations/servicenow/fields',require(_0xbb33('0xa7')));_0x446118[_0xbb33('0x6')](_0xbb33('0xa8'),require(_0xbb33('0xa9')));_0x446118[_0xbb33('0x6')](_0xbb33('0xaa'),require('./api/intDynamics365Configuration'));_0x446118[_0xbb33('0x6')](_0xbb33('0xab'),require(_0xbb33('0xac')));_0x446118[_0xbb33('0x6')](_0xbb33('0xad'),require(_0xbb33('0xae')));_0x446118[_0xbb33('0x6')](_0xbb33('0xaf'),require(_0xbb33('0xb0')));_0x446118[_0xbb33('0x6')](_0xbb33('0xb1'),require(_0xbb33('0xb2')));_0x446118[_0xbb33('0x6')](_0xbb33('0xb3'),require(_0xbb33('0xb4')));_0x446118['use'](_0xbb33('0xb5'),require('./api/chatQueueReport'));_0x446118['use']('/api/chat/internal/messages',require(_0xbb33('0xb6')));_0x446118['use'](_0xbb33('0xb7'),require(_0xbb33('0xb8')));_0x446118['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x446118[_0xbb33('0x6')](_0xbb33('0xb9'),require('./api/jscriptySessionReport'));_0x446118[_0xbb33('0x6')](_0xbb33('0xba'),require(_0xbb33('0xbb')));_0x446118[_0xbb33('0x6')]('/api/square/reports',require('./api/squareReport'));_0x446118[_0xbb33('0x6')]('/api/square/details/reports',require(_0xbb33('0xbc')));_0x446118[_0xbb33('0x6')](_0xbb33('0xbd'),require(_0xbb33('0xbe')));_0x446118[_0xbb33('0x6')](_0xbb33('0xbf'),require(_0xbb33('0xc0')));_0x446118[_0xbb33('0x6')](_0xbb33('0xc1'),require(_0xbb33('0xc2')));_0x446118[_0xbb33('0x6')](_0xbb33('0xc3'),require('./api/squareProject'));_0x446118[_0xbb33('0x6')](_0xbb33('0xc4'),require(_0xbb33('0xc5')));_0x446118[_0xbb33('0x6')]('/api/square/messages',require(_0xbb33('0xc6')));_0x446118[_0xbb33('0x6')](_0xbb33('0xc7'),require(_0xbb33('0xc8')));_0x446118[_0xbb33('0x6')]('/api/license',require(_0xbb33('0xc9')));_0x446118[_0xbb33('0x6')](_0xbb33('0xca'),require(_0xbb33('0xcb')));_0x446118[_0xbb33('0x6')](_0xbb33('0xcc'),require(_0xbb33('0xcd')));_0x446118['use']('/api/attachments',require(_0xbb33('0xce')));_0x446118[_0xbb33('0x6')](_0xbb33('0xcf'),require(_0xbb33('0xd0')));_0x446118['use'](_0xbb33('0xd1'),require(_0xbb33('0xd2')));_0x446118['use'](_0xbb33('0xd3'),require('./api/chatTransferReport'));_0x446118[_0xbb33('0x6')](_0xbb33('0xd4'),require(_0xbb33('0xd5')));_0x446118['use'](_0xbb33('0xd6'),require(_0xbb33('0xd7')));_0x446118[_0xbb33('0x6')](_0xbb33('0xd8'),require(_0xbb33('0xd9')));_0x446118[_0xbb33('0x6')](_0xbb33('0xda'),require(_0xbb33('0xdb')));_0x446118[_0xbb33('0x6')](_0xbb33('0xdc'),require('./api/voicePrefix'));_0x446118[_0xbb33('0x6')](_0xbb33('0xdd'),require('./api/userProfile'));_0x446118[_0xbb33('0x6')](_0xbb33('0xde'),require(_0xbb33('0xdf')));_0x446118[_0xbb33('0x6')](_0xbb33('0xe0'),require(_0xbb33('0xe1')));_0x446118[_0xbb33('0x6')](_0xbb33('0xe2'),require(_0xbb33('0xe3')));_0x446118[_0xbb33('0x6')](_0xbb33('0xe4'),require('./api/whatsappAccount'));_0x446118[_0xbb33('0x6')](_0xbb33('0xe5'),require(_0xbb33('0xe6')));_0x446118[_0xbb33('0x6')](_0xbb33('0xe7'),require(_0xbb33('0xe8')));_0x446118[_0xbb33('0x6')](_0xbb33('0xe9'),require('./api/whatsappMessage'));_0x446118[_0xbb33('0x6')](_0xbb33('0xea'),require(_0xbb33('0xeb')));_0x446118[_0xbb33('0x6')](_0xbb33('0xec'),require(_0xbb33('0xed')));_0x446118[_0xbb33('0x6')](_0xbb33('0xee'),require('./api/whatsappQueue'));_0x446118[_0xbb33('0x6')](_0xbb33('0xef'),require(_0xbb33('0xf0')));_0x446118[_0xbb33('0x6')]('/api/realtime',require(_0xbb33('0xf1')));_0x446118[_0xbb33('0x6')](_0xbb33('0xf2'),require('./api/user-setting'));_0x446118[_0xbb33('0x6')](_0xbb33('0xf3'),require(_0xbb33('0xf4')));_0x446118[_0xbb33('0x6')](_0xbb33('0xf5'),require(_0xbb33('0xf6')));_0x446118[_0xbb33('0x6')](_0xbb33('0xf7'),require('./api/authActiveDirectory'));_0x446118[_0xbb33('0x6')](_0xbb33('0xf8'),require(_0xbb33('0xf9')));_0x446118['use'](_0xbb33('0xfa'),require(_0xbb33('0xfb')));_0x446118[_0xbb33('0x6')](_0xbb33('0xfc'),require(_0xbb33('0xfd')));_0x446118['use'](_0xbb33('0xfe'),require(_0xbb33('0xff')));_0x446118[_0xbb33('0x6')](_0xbb33('0x100'),require(_0xbb33('0x101')));_0x446118[_0xbb33('0x6')](_0xbb33('0x102'),require('./api/webbar'));_0x446118[_0xbb33('0x6')](_0xbb33('0x103'),clientSideLogs);_0x446118['use']('/apidoc',express[_0xbb33('0x104')](path[_0xbb33('0x105')](config[_0xbb33('0x106')],'/apidoc')));_0x446118[_0xbb33('0x6')]('/www',express[_0xbb33('0x104')](path[_0xbb33('0x105')](config[_0xbb33('0x106')],_0xbb33('0x107'))));_0x446118[_0xbb33('0x6')](_0xbb33('0x108'),express['static'](path[_0xbb33('0x105')](config['root'],'/demo')));_0x446118[_0xbb33('0x6')]('/snippet',express[_0xbb33('0x104')](path[_0xbb33('0x105')](config[_0xbb33('0x106')],_0xbb33('0x109'),'3.1.0')));_0x446118[_0xbb33('0x6')](_0xbb33('0x10a'),express[_0xbb33('0x104')](path[_0xbb33('0x105')](config[_0xbb33('0x106')],_0xbb33('0x10b'))));_0x446118[_0xbb33('0x10c')](_0xbb33('0x10d'))[_0xbb33('0x10e')](errors[0x194]);_0x446118['route']('/*')[_0xbb33('0x10e')](function(_0x167d37,_0x4cca9a){_0x4cca9a[_0xbb33('0x10f')](path['resolve'](_0x446118['get'](_0xbb33('0x110'))+_0xbb33('0x111')));});return _0x446118;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index daf5189..257c341 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15f8=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x4b8fc7,_0x5022fc){var _0x249f4a=function(_0x1b25d4){while(--_0x1b25d4){_0x4b8fc7['push'](_0x4b8fc7['shift']());}};_0x249f4a(++_0x5022fc);}(_0x15f8,0x149));var _0x815f=function(_0x3a39b1,_0x2b6222){_0x3a39b1=_0x3a39b1-0x0;var _0x49aecb=_0x15f8[_0x3a39b1];return _0x49aecb;};'use strict';var jayson=require(_0x815f('0x0'));var _=require('lodash');var config=require(_0x815f('0x1'));exports['listen']=function(){return new Promise(function(_0x1f9a17,_0x5030cc){var _0xdbfa57={};_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x3')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x4')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x5')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x6')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x7')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x8')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x9')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xa')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0xb')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xc')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/mailAccount/mailAccount.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xd')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/mailInteraction/mailInteraction.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xe')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0xf')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x10')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x11')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/faxApplication/faxApplication.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x12')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x13')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x14')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsAccount/smsAccount.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x15')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x16')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsQueue/smsQueue.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x17')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x18')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x19')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1a')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x1b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1c')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/chatMessage/chatMessage.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1d')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/cmContact/cmContact.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1e')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x1f')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x20')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x21')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x22')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x23')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x24')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x25')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x26')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x27')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x28')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x29')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2a')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2c')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x2d')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x2e')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x2f')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x30')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x31')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x32')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/squareReport/squareReport.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x33')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x34')));_0xdbfa57=_['merge'](_0xdbfa57,require('../api/squareOdbc/squareOdbc.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x35')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x36')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x37')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x38')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/attachment/attachment.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/plugin/plugin.rpc'));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x39')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require(_0x815f('0x3a')));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x3b')));_0xdbfa57=_[_0x815f('0x2')](_0xdbfa57,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xdbfa57=_['merge'](_0xdbfa57,require(_0x815f('0x3c')));var _0x4763fa=jayson[_0x815f('0x3d')](_0xdbfa57)[_0x815f('0x3e')]();var _0x549a1b=config['rpc'][_0x815f('0x3f')]||config[_0x815f('0x3f')]+0x1;var _0x5e8c18=config[_0x815f('0x40')]['ip']||'localhost';_0x4763fa['on']('error',function(_0x3681ed){return _0x5030cc(_0x3681ed);});_0x4763fa[_0x815f('0x41')](_0x549a1b,_0x5e8c18,function(){console[_0x815f('0x42')](_0x815f('0x43'),_0x5e8c18,_0x549a1b);require('../config/triggers')['default']();return _0x1f9a17(_0x815f('0x44')+_0x5e8c18+':'+_0x549a1b);});});}; \ No newline at end of file +var _0x9b7c=['../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/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxMessage/faxMessage.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc'];(function(_0x5639fa,_0x5bced6){var _0x240fe2=function(_0x1861f0){while(--_0x1861f0){_0x5639fa['push'](_0x5639fa['shift']());}};_0x240fe2(++_0x5bced6);}(_0x9b7c,0x176));var _0xc9b7=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x9b7c[_0xabbd2f];return _0x34a040;};'use strict';var jayson=require(_0xc9b7('0x0'));var _=require(_0xc9b7('0x1'));var config=require(_0xc9b7('0x2'));exports[_0xc9b7('0x3')]=function(){return new Promise(function(_0x5dbca0,_0x4fbe0e){var _0x3917a6={};_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x5')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/voiceExtension/voiceExtension.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x6')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/voiceRecording/voiceRecording.rpc'));_0x3917a6=_['merge'](_0x3917a6,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x7')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x8')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x9')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/memberReport/memberReport.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xa')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/mailServerIn/mailServerIn.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xb')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xc')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xd')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/mailMessage/mailMessage.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xe')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/faxAccount/faxAccount.rpc'));_0x3917a6=_['merge'](_0x3917a6,require('../api/faxApplication/faxApplication.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/faxInteraction/faxInteraction.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0xf')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x10')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x11')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x12')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x13')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x14')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x15')));_0x3917a6=_['merge'](_0x3917a6,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x16')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x17')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x18')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x19')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x1a')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x1b')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x1c')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x1d')));_0x3917a6=_['merge'](_0x3917a6,require('../api/cmHopper/cmHopper.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x1e')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x1f')));_0x3917a6=_['merge'](_0x3917a6,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x20')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x21')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x22')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/sound/sound.rpc'));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x23')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x24')));_0x3917a6=_['merge'](_0x3917a6,require('../api/trigger/trigger.rpc'));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x25')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x26')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x27')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x28')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x29')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x2a')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x2b')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x2c')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x2d')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x2e')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x2f')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x30')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x31')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x32')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x33')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x34')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x35')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x36')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x37')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x38')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x39')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require('../api/plugin/plugin.rpc'));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x3a')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x3b')));_0x3917a6=_['merge'](_0x3917a6,require(_0xc9b7('0x3c')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x3d')));_0x3917a6=_[_0xc9b7('0x4')](_0x3917a6,require(_0xc9b7('0x3e')));var _0x18301c=jayson[_0xc9b7('0x3f')](_0x3917a6)['http']();var _0x56ffea=config[_0xc9b7('0x40')][_0xc9b7('0x41')]||config[_0xc9b7('0x41')]+0x1;var _0x34b5fa=config[_0xc9b7('0x40')]['ip']||_0xc9b7('0x42');_0x18301c['on'](_0xc9b7('0x43'),function(_0x1bf554){return _0x4fbe0e(_0x1bf554);});_0x18301c[_0xc9b7('0x3')](_0x56ffea,_0x34b5fa,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x34b5fa,_0x56ffea);require(_0xc9b7('0x44'))[_0xc9b7('0x45')]();return _0x5dbca0(_0xc9b7('0x46')+_0x34b5fa+':'+_0x56ffea);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 99c8ff6..e786b69 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 _0x3408=['indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','prototype','ANSWER','sendRequest','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','line','toLowerCase','hangup','emit','520-Invalid','function','substring','no\x20code','replace','result='];(function(_0x323a91,_0x21a26a){var _0x24a511=function(_0x4c2c68){while(--_0x4c2c68){_0x323a91['push'](_0x323a91['shift']());}};_0x24a511(++_0x21a26a);}(_0x3408,0x177));var _0x8340=function(_0x9022d,_0x3208db){_0x9022d=_0x9022d-0x0;var _0x5badee=_0x3408[_0x9022d];return _0x5badee;};'use strict';var util=require(_0x8340('0x0'));var _=require(_0x8340('0x1'));var EventEmitter=require(_0x8340('0x2'))[_0x8340('0x3')];var AGIReply=require(_0x8340('0x4'));var AGIError=require(_0x8340('0x5'));function AGIChannel(_0x34cb8a){var _0x3c8360=this,_0x1ca22c=new AGIReply(),_0x33ee17=![],_0x67180={};EventEmitter[_0x8340('0x6')](_0x3c8360);_0x34cb8a[_0x8340('0x7')](_0x8340('0x8'));_0x34cb8a[_0x8340('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1ca22c[_0x8340('0x7')](_0x8340('0x8'));_0x1ca22c['on']('headers',function(_0x1da6f3){for(var _0x5b1a7b in _0x1da6f3){_0x3c8360[_0x5b1a7b]=_0x1da6f3[_0x5b1a7b];}_0x3c8360['emit']('ready');});_0x1ca22c['on'](_0x8340('0xa'),function(_0x1fb81d){if(_0x1fb81d[_0x8340('0xb')]()==_0x8340('0xc')){_0x3c8360[_0x8340('0xd')](_0x8340('0xc'));return;}if(_0x1fb81d['substring'](0x0,0xb)==_0x8340('0xe')){_0x33ee17=!![];}if(_0x33ee17){_0x67180['rx']+=_0x1fb81d+'\x0a';if(_0x1fb81d['search']('520\x20End\x20of\x20proper')!=-0x1){_0x33ee17=![];}}else{_0x67180['rx']=_0x1fb81d;}if(_0x33ee17){return;}if(typeof _0x67180['cb']==_0x8340('0xf')){var _0x3d3e91=_0x67180['rx'][_0x8340('0x10')](0x0,0x3),_0x4e5e02=null,_0x30836e=null;_0x3d3e91=parseInt(_0x3d3e91);if(isNaN(_0x3d3e91)){_0x67180['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8340('0x11')});return;}if(_0x3d3e91!=0xc8){_0x67180['cb'](null,{'code':_0x3d3e91,'result':-0x1,'extra':'KO'});return;}_0x4e5e02=_0x67180['rx'][_0x8340('0x10')](0x4)[_0x8340('0x12')](_0x8340('0x13'),'');if(_0x4e5e02[_0x8340('0x14')]('\x20')!=-0x1){_0x4e5e02=_0x4e5e02[_0x8340('0x15')](0x0,_0x4e5e02[_0x8340('0x14')]('\x20'));}if(_['startsWith'](_0x4e5e02,'-1')){_0x4e5e02=parseInt(_0x4e5e02);}_0x30836e=_0x67180['rx']['split']('\x20');if(_0x30836e[_0x8340('0x16')]==0x3){_0x30836e=_0x30836e[0x2]['substring'](0x1,_0x30836e[0x2][_0x8340('0x16')]-0x1);}else if(_0x30836e[_0x8340('0x16')]>0x3){var _0x7e80dc=/\((.+)\)/;var _0x4d6d65=_0x67180['rx'][_0x8340('0x17')](_0x7e80dc);if(_0x4d6d65){_0x30836e=_0x4d6d65[0x1];}else{_0x30836e=null;}}else{_0x30836e=null;}_0x67180['cb'](null,{'code':_0x3d3e91,'result':_0x4e5e02,'extra':_0x30836e});}});_0x34cb8a['on']('error',function(_0x30febd){_0x3c8360[_0x8340('0xd')](_0x8340('0x18'),new AGIError(_0x8340('0x19'),_0x30febd[_0x8340('0x1a')]));});_0x34cb8a['on']('close',function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1b'),new AGIError(_0x8340('0x1c')));});_0x34cb8a['on'](_0x8340('0x1d'),function(){_0x3c8360[_0x8340('0xd')](_0x8340('0x1d'),new AGIError(_0x8340('0x1e')));_0x34cb8a[_0x8340('0x1f')]();});_0x34cb8a[_0x8340('0x20')](_0x1ca22c);this[_0x8340('0x21')]=function(_0x33e2d6,_0x15c4e0){var _0x33e2d6=_0x33e2d6||'',_0x15c4e0=typeof _0x15c4e0=='function'?_0x15c4e0:new Function();_0x67180={'tx':_0x33e2d6,'rx':'','cb':_0x15c4e0};_0x34cb8a[_0x8340('0x22')](_0x33e2d6+'\x0a');},this[_0x8340('0x1b')]=function(){_0x34cb8a[_0x8340('0x1f')]();};}util[_0x8340('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xbdc721){return this['command'][_0x8340('0x24')](this,_0xbdc721);};AGIChannel[_0x8340('0x25')]['answer']=function(){return this['sendRequest'](_0x8340('0x26'));};AGIChannel[_0x8340('0x25')]['getData']=function(_0xd51905,_0x4cbd0c,_0x3496e5){_0xd51905=_0xd51905===undefined?'beep':_0xd51905;_0x4cbd0c=_0x4cbd0c===undefined?'5':_0x4cbd0c;_0x3496e5=_0x3496e5===undefined?'1':_0x3496e5;return this[_0x8340('0x27')](util[_0x8340('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xd51905,_0x4cbd0c*0x3e8,_0x3496e5));};AGIChannel[_0x8340('0x25')]['noop']=function(_0x2f57c7){_0x2f57c7=_0x2f57c7||_0x8340('0x29');return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2a'),_0x2f57c7));};AGIChannel[_0x8340('0x25')][_0x8340('0x2b')]=function(_0x3e6e9d,_0x3d7ca4){if(_[_0x8340('0x2c')](_0x3d7ca4)){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4[_0x8340('0x2e')](',')));}return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x2d'),_0x3e6e9d,_0x3d7ca4));};AGIChannel[_0x8340('0x25')]['setContext']=function(_0x1ff5d3){return this['sendRequest'](util['format'](_0x8340('0x2f'),_0x1ff5d3));};AGIChannel[_0x8340('0x25')][_0x8340('0x30')]=function(_0x3faed2){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x31'),_0x3faed2));};AGIChannel['prototype']['setPriority']=function(_0x5e008a){return this[_0x8340('0x27')](util[_0x8340('0x28')](_0x8340('0x32'),_0x5e008a));};AGIChannel[_0x8340('0x25')]['hangup']=function(){return this[_0x8340('0x27')](_0x8340('0x33'));};AGIChannel[_0x8340('0x25')][_0x8340('0x34')]=function(_0x4f5344,_0x328862){var _0x3149b4=_[_0x8340('0x35')](_0x328862)||_[_0x8340('0x36')](_0x328862)?_0x328862[_0x8340('0x37')]():_0x328862;return this[_0x8340('0x27')](util['format'](_0x8340('0x38'),_0x4f5344,_0x3149b4?_0x3149b4[_0x8340('0x37')]()[_0x8340('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8340('0x25')][_0x8340('0x39')]=function(_0x2fefea,_0xa9a5ab){return this[_0x8340('0x27')](util['format'](_0x8340('0x3a'),_0x2fefea,_0xa9a5ab));};AGIChannel[_0x8340('0x25')][_0x8340('0x3b')]=function(_0x4c3018,_0x5893a2){return this[_0x8340('0x27')](util[_0x8340('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x4c3018,_0x5893a2));};AGIChannel[_0x8340('0x25')][_0x8340('0x3c')]=function(_0xbe63d7,_0x1c0b93){return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x3d'),_0xbe63d7,_0x1c0b93));};AGIChannel[_0x8340('0x25')][_0x8340('0x3e')]=function(_0x4ea6ca,_0x115b40,_0x1ef321){_0x115b40=_0x115b40||this[_0x8340('0x3f')];_0x1ef321=_0x1ef321||0x1;this['setContext'](_0x4ea6ca);this[_0x8340('0x30')](_0x115b40);this[_0x8340('0x40')](_0x1ef321);return this[_0x8340('0x41')](util[_0x8340('0x28')](_0x8340('0x42'),_0x4ea6ca,_0x115b40,_0x1ef321));};AGIChannel[_0x8340('0x25')]['getVariable']=function(_0x5ac6f9){return this[_0x8340('0x27')](util['format'](_0x8340('0x43'),_0x5ac6f9));};AGIChannel[_0x8340('0x25')][_0x8340('0x44')]=function(_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x4e89a0,_0x5cc854){_0x32b258=_0x32b258||_0x8340('0x45');_0x50523b=_0x50523b||'';_0x8e0b13=_0x8e0b13===undefined?-0x1:_0x8e0b13==='-1'?-0x1:_0x8e0b13*0x3e8;_0x4e89a0=_0x4e89a0===undefined?'':'s='+_0x4e89a0;_0x5cc854=_0x5cc854?_0x8340('0x46'):'';return this[_0x8340('0x27')](util['format'](_0x8340('0x47'),_0x3b4b20,_0x32b258,_0x50523b,_0x8e0b13,_0x5cc854,_0x4e89a0));};AGIChannel['prototype'][_0x8340('0x48')]=function(_0x1543e8,_0xa7d56c){_0xa7d56c=_0xa7d56c||'';return this['sendRequest'](util[_0x8340('0x28')](_0x8340('0x49'),_0x1543e8,_0xa7d56c));};AGIChannel[_0x8340('0x25')][_0x8340('0x4a')]=function(_0x110d09){return this[_0x8340('0x2b')](_0x8340('0x4b'),_0x110d09);};AGIChannel[_0x8340('0x25')]['wait']=function(_0x31d1ba){return this[_0x8340('0x2b')](_0x8340('0x4c'),_0x31d1ba);};AGIChannel[_0x8340('0x25')][_0x8340('0x18')]=function(_0x537018,_0x457f3a){this[_0x8340('0x41')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x537018['id'],_0x537018[_0x8340('0x4d')],_0x457f3a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8340('0x4e')]=AGIChannel; \ No newline at end of file +var _0xcef4=['destroy','pipe','command','inherits','prototype','sync','answer','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','label','exports','util','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x21434a,_0x4694d6){var _0x69a71a=function(_0x382319){while(--_0x382319){_0x21434a['push'](_0x21434a['shift']());}};_0x69a71a(++_0x4694d6);}(_0xcef4,0x11a));var _0x4cef=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0xcef4[_0x810025];return _0x4dbc81;};'use strict';var util=require(_0x4cef('0x0'));var _=require('lodash');var EventEmitter=require(_0x4cef('0x1'))[_0x4cef('0x2')];var AGIReply=require(_0x4cef('0x3'));var AGIError=require(_0x4cef('0x4'));function AGIChannel(_0x2154ed){var _0x354621=this,_0x16a92b=new AGIReply(),_0x34a7f8=![],_0x29da00={};EventEmitter['call'](_0x354621);_0x2154ed[_0x4cef('0x5')](_0x4cef('0x6'));_0x2154ed['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x16a92b[_0x4cef('0x5')](_0x4cef('0x6'));_0x16a92b['on'](_0x4cef('0x7'),function(_0x5b0ddc){for(var _0x2b4de3 in _0x5b0ddc){_0x354621[_0x2b4de3]=_0x5b0ddc[_0x2b4de3];}_0x354621[_0x4cef('0x8')](_0x4cef('0x9'));});_0x16a92b['on'](_0x4cef('0xa'),function(_0x4401b4){if(_0x4401b4['toLowerCase']()=='hangup'){_0x354621['emit'](_0x4cef('0xb'));return;}if(_0x4401b4[_0x4cef('0xc')](0x0,0xb)==_0x4cef('0xd')){_0x34a7f8=!![];}if(_0x34a7f8){_0x29da00['rx']+=_0x4401b4+'\x0a';if(_0x4401b4[_0x4cef('0xe')](_0x4cef('0xf'))!=-0x1){_0x34a7f8=![];}}else{_0x29da00['rx']=_0x4401b4;}if(_0x34a7f8){return;}if(typeof _0x29da00['cb']==_0x4cef('0x10')){var _0xa258d4=_0x29da00['rx'][_0x4cef('0xc')](0x0,0x3),_0x212d60=null,_0x538e22=null;_0xa258d4=parseInt(_0xa258d4);if(isNaN(_0xa258d4)){_0x29da00['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4cef('0x11')});return;}if(_0xa258d4!=0xc8){_0x29da00['cb'](null,{'code':_0xa258d4,'result':-0x1,'extra':'KO'});return;}_0x212d60=_0x29da00['rx'][_0x4cef('0xc')](0x4)[_0x4cef('0x12')](_0x4cef('0x13'),'');if(_0x212d60[_0x4cef('0x14')]('\x20')!=-0x1){_0x212d60=_0x212d60[_0x4cef('0x15')](0x0,_0x212d60['indexOf']('\x20'));}if(_['startsWith'](_0x212d60,'-1')){_0x212d60=parseInt(_0x212d60);}_0x538e22=_0x29da00['rx']['split']('\x20');if(_0x538e22[_0x4cef('0x16')]==0x3){_0x538e22=_0x538e22[0x2][_0x4cef('0xc')](0x1,_0x538e22[0x2][_0x4cef('0x16')]-0x1);}else if(_0x538e22[_0x4cef('0x16')]>0x3){var _0x17c395=/\((.+)\)/;var _0x25ec1f=_0x29da00['rx'][_0x4cef('0x17')](_0x17c395);if(_0x25ec1f){_0x538e22=_0x25ec1f[0x1];}else{_0x538e22=null;}}else{_0x538e22=null;}_0x29da00['cb'](null,{'code':_0xa258d4,'result':_0x212d60,'extra':_0x538e22});}});_0x2154ed['on'](_0x4cef('0x18'),function(_0x315c37){_0x354621[_0x4cef('0x8')]('error',new AGIError(_0x4cef('0x19'),_0x315c37[_0x4cef('0x1a')]));});_0x2154ed['on'](_0x4cef('0x1b'),function(){_0x354621[_0x4cef('0x8')](_0x4cef('0x1b'),new AGIError(_0x4cef('0x1c')));});_0x2154ed['on'](_0x4cef('0x1d'),function(){_0x354621[_0x4cef('0x8')](_0x4cef('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2154ed[_0x4cef('0x1e')]();});_0x2154ed[_0x4cef('0x1f')](_0x16a92b);this[_0x4cef('0x20')]=function(_0x47e23c,_0x259ff0){var _0x47e23c=_0x47e23c||'',_0x259ff0=typeof _0x259ff0==_0x4cef('0x10')?_0x259ff0:new Function();_0x29da00={'tx':_0x47e23c,'rx':'','cb':_0x259ff0};_0x2154ed['write'](_0x47e23c+'\x0a');},this[_0x4cef('0x1b')]=function(){_0x2154ed['destroy']();};}util[_0x4cef('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x4cef('0x22')]['sendRequest']=function(_0xe7da6f){return this[_0x4cef('0x20')][_0x4cef('0x23')](this,_0xe7da6f);};AGIChannel[_0x4cef('0x22')][_0x4cef('0x24')]=function(){return this[_0x4cef('0x25')]('ANSWER');};AGIChannel[_0x4cef('0x22')][_0x4cef('0x26')]=function(_0x2c2243,_0x476a86,_0x1deed4){_0x2c2243=_0x2c2243===undefined?_0x4cef('0x27'):_0x2c2243;_0x476a86=_0x476a86===undefined?'5':_0x476a86;_0x1deed4=_0x1deed4===undefined?'1':_0x1deed4;return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x29'),_0x2c2243,_0x476a86*0x3e8,_0x1deed4));};AGIChannel[_0x4cef('0x22')]['noop']=function(_0x5c5d5c){_0x5c5d5c=_0x5c5d5c||_0x4cef('0x2a');return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x2b'),_0x5c5d5c));};AGIChannel['prototype'][_0x4cef('0x2c')]=function(_0xe19ae2,_0x1c61f9){if(_['isArray'](_0x1c61f9)){return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x2d'),_0xe19ae2,_0x1c61f9[_0x4cef('0x2e')](',')));}return this['sendRequest'](util[_0x4cef('0x28')]('EXEC\x20%s\x20%s',_0xe19ae2,_0x1c61f9));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x2f')]=function(_0x12636f){return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x30'),_0x12636f));};AGIChannel[_0x4cef('0x22')]['setExtension']=function(_0x4a4be4){return this['sendRequest'](util[_0x4cef('0x28')](_0x4cef('0x31'),_0x4a4be4));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x32')]=function(_0x1f6f0f){return this['sendRequest'](util[_0x4cef('0x28')](_0x4cef('0x33'),_0x1f6f0f));};AGIChannel[_0x4cef('0x22')][_0x4cef('0xb')]=function(){return this[_0x4cef('0x25')](_0x4cef('0x34'));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x35')]=function(_0x1c98f8,_0x1ca887){var _0x534a46=_[_0x4cef('0x36')](_0x1ca887)||_[_0x4cef('0x37')](_0x1ca887)?_0x1ca887['toString']():_0x1ca887;return this[_0x4cef('0x25')](util['format'](_0x4cef('0x38'),_0x1c98f8,_0x534a46?_0x534a46[_0x4cef('0x39')]()[_0x4cef('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x3a')]=function(_0x3e17a3,_0x4a89cf){return this['sendRequest'](util['format'](_0x4cef('0x3b'),_0x3e17a3,_0x4a89cf));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x3c')]=function(_0x4c9c92,_0x594e25){return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x3d'),_0x4c9c92,_0x594e25));};AGIChannel['prototype'][_0x4cef('0x3e')]=function(_0x4f8c74,_0xc98622){return this[_0x4cef('0x25')](util[_0x4cef('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x4f8c74,_0xc98622));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x3f')]=function(_0x205246,_0x31278c,_0x3921d5){_0x31278c=_0x31278c||this[_0x4cef('0x40')];_0x3921d5=_0x3921d5||0x1;this[_0x4cef('0x2f')](_0x205246);this[_0x4cef('0x41')](_0x31278c);this[_0x4cef('0x32')](_0x3921d5);return this[_0x4cef('0x42')](util[_0x4cef('0x28')](_0x4cef('0x43'),_0x205246,_0x31278c,_0x3921d5));};AGIChannel[_0x4cef('0x22')]['getVariable']=function(_0x5beb66){return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x44'),_0x5beb66));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x45')]=function(_0x54cc97,_0x17e264,_0x212aca,_0x3e132b,_0x2f361e,_0x1dc441){_0x17e264=_0x17e264||'wav';_0x212aca=_0x212aca||'';_0x3e132b=_0x3e132b===undefined?-0x1:_0x3e132b==='-1'?-0x1:_0x3e132b*0x3e8;_0x2f361e=_0x2f361e===undefined?'':'s='+_0x2f361e;_0x1dc441=_0x1dc441?_0x4cef('0x46'):'';return this[_0x4cef('0x25')](util[_0x4cef('0x28')](_0x4cef('0x47'),_0x54cc97,_0x17e264,_0x212aca,_0x3e132b,_0x1dc441,_0x2f361e));};AGIChannel['prototype'][_0x4cef('0x48')]=function(_0x3c0dc3,_0x5df870){_0x5df870=_0x5df870||'';return this['sendRequest'](util[_0x4cef('0x28')](_0x4cef('0x49'),_0x3c0dc3,_0x5df870));};AGIChannel[_0x4cef('0x22')][_0x4cef('0x4a')]=function(_0x12dc51){return this['exec']('AGI',_0x12dc51);};AGIChannel[_0x4cef('0x22')][_0x4cef('0x4b')]=function(_0x51fb3f){return this['exec']('WAIT',_0x51fb3f);};AGIChannel[_0x4cef('0x22')]['error']=function(_0x433896,_0x7ebd72){this[_0x4cef('0x42')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x433896['id'],_0x433896[_0x4cef('0x4c')],_0x7ebd72));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4cef('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index b6382bc..0276b7d 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 _0x92ee=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x92ee,0x1ca));var _0xe92e=function(_0x31ce94,_0x246777){_0x31ce94=_0x31ce94-0x0;var _0x16ca31=_0x92ee[_0x31ce94];return _0x16ca31;};'use strict';var util=require(_0xe92e('0x0'));var error={'E_AGI_UNDEFINED':_0xe92e('0x1'),'E_AGI_ARGUMENT_PORT':_0xe92e('0x2'),'E_AGI_SERVER_ERROR':_0xe92e('0x3'),'E_AGI_SERVER_CLOSE':_0xe92e('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xe92e('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xe92e('0x6'),'E_AGI_SOCKET_ERROR':_0xe92e('0x7'),'E_AGI_SOCKET_CLOSE':_0xe92e('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe92e('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x435314){var _0x435314=_0x435314||null,_0x463788=_0x463788||[],_0x1d6c7c=0x1,_0xa01599='';if(!error[_0x435314]){_0x435314=_0xe92e('0xa');}_0x463788[_0xe92e('0xb')](error[_0x435314]);while(arguments[_0x1d6c7c]){_0x463788[_0xe92e('0xb')](arguments[_0x1d6c7c]);_0x1d6c7c++;}_0xa01599=util['format'][_0xe92e('0xc')](util,_0x463788);this[_0xe92e('0xd')]=_0xa01599;this[_0xe92e('0xe')]=_0x435314;}module[_0xe92e('0xf')]=AGIError; \ No newline at end of file +var _0x221b=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x44c6d2,_0xf20531){var _0x3ed580=function(_0x5f8624){while(--_0x5f8624){_0x44c6d2['push'](_0x44c6d2['shift']());}};_0x3ed580(++_0xf20531);}(_0x221b,0x18c));var _0xb221=function(_0x5a84e0,_0x2358a1){_0x5a84e0=_0x5a84e0-0x0;var _0x1c737e=_0x221b[_0x5a84e0];return _0x1c737e;};'use strict';var util=require(_0xb221('0x0'));var error={'E_AGI_UNDEFINED':_0xb221('0x1'),'E_AGI_ARGUMENT_PORT':_0xb221('0x2'),'E_AGI_SERVER_ERROR':_0xb221('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xb221('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xb221('0x5'),'E_AGI_SOCKET_ERROR':_0xb221('0x6'),'E_AGI_SOCKET_CLOSE':_0xb221('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xb221('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb221('0x9'),'E_AGI_IVR_ENTRY':_0xb221('0xa')};function AGIError(_0x5aafbc){var _0x5aafbc=_0x5aafbc||null,_0x3239da=_0x3239da||[],_0x2160ff=0x1,_0x5a854a='';if(!error[_0x5aafbc]){_0x5aafbc=_0xb221('0xb');}_0x3239da['push'](error[_0x5aafbc]);while(arguments[_0x2160ff]){_0x3239da['push'](arguments[_0x2160ff]);_0x2160ff++;}_0x5a854a=util[_0xb221('0xc')][_0xb221('0xd')](util,_0x3239da);this[_0xb221('0xe')]=_0x5a854a;this['name']=_0x5aafbc;}module[_0xb221('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index a86f6f6..65495db 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 _0x335c=['error','E_AGI_SERVER_ERROR','message','agi','parse','lodash','../../config/environment','redis','defaults','localhost','emit'];(function(_0x153a86,_0x5c521d){var _0x205dbb=function(_0x16355e){while(--_0x16355e){_0x153a86['push'](_0x153a86['shift']());}};_0x205dbb(++_0x5c521d);}(_0x335c,0x17b));var _0xc335=function(_0x1d090a,_0x5b1696){_0x1d090a=_0x1d090a-0x0;var _0x51ebb3=_0x335c[_0x1d090a];return _0x51ebb3;};'use strict';var _=require(_0xc335('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0xc335('0x1'));config[_0xc335('0x2')]=_[_0xc335('0x3')](config['redis'],{'host':_0xc335('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xc335('0x2')]);sub['subscribe']('agi',function(_0x26b7d8){if(_0x26b7d8)return eventEmitter[_0xc335('0x5')](_0xc335('0x6'),new AGIError(_0xc335('0x7'),_0x26b7d8));});sub['on'](_0xc335('0x8'),function(_0x43575c,_0x351fe4){if(_0x43575c!==_0xc335('0x9'))return;try{var _0x43e42c=JSON[_0xc335('0xa')](_0x351fe4);eventEmitter[_0xc335('0x5')]('projectUpdate',_0x43e42c);}catch(_0x48a21c){eventEmitter[_0xc335('0x5')]('error',new AGIError(_0xc335('0x7'),_0x48a21c));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa68c=['agi','emit','error','E_AGI_SERVER_ERROR','message','parse','events','EventEmitter','ioredis','redis','localhost'];(function(_0x9de475,_0x356fce){var _0x46c9f6=function(_0x285b20){while(--_0x285b20){_0x9de475['push'](_0x9de475['shift']());}};_0x46c9f6(++_0x356fce);}(_0xa68c,0xc1));var _0xca68=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa68c[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var EventEmitter=require(_0xca68('0x0'))[_0xca68('0x1')];var Redis=require(_0xca68('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0xca68('0x3')]=_['defaults'](config[_0xca68('0x3')],{'host':_0xca68('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xca68('0x3')]);sub['subscribe'](_0xca68('0x5'),function(_0x5df9f0){if(_0x5df9f0)return eventEmitter[_0xca68('0x6')](_0xca68('0x7'),new AGIError(_0xca68('0x8'),_0x5df9f0));});sub['on'](_0xca68('0x9'),function(_0xfcd9fa,_0x206377){if(_0xfcd9fa!==_0xca68('0x5'))return;try{var _0x51746e=JSON[_0xca68('0xa')](_0x206377);eventEmitter[_0xca68('0x6')]('projectUpdate',_0x51746e);}catch(_0x2106ef){eventEmitter[_0xca68('0x6')](_0xca68('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x2106ef));}});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 968582e..46fe9d0 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 _0x134b=['../../../config/logger','menu','getdigits','vertices','edges','prototype','addVertex','addEdge','push','size','relations','numberOfEdges','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x125199,_0x41b9e6){var _0x348a71=function(_0x3bec13){while(--_0x3bec13){_0x125199['push'](_0x125199['shift']());}};_0x348a71(++_0x41b9e6);}(_0x134b,0x1ef));var _0xb134=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x134b[_0x5235a6];return _0x1cf37e;};'use strict';var _=require(_0xb134('0x0'));var logger=require(_0xb134('0x1'))('agi');var verticesWithRetry=[_0xb134('0x2'),_0xb134('0x3'),'getsecretdigits'];var Graph=function(){this[_0xb134('0x4')]={};this[_0xb134('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xb134('0x6')][_0xb134('0x7')]=function(_0x3e9bf1){this[_0xb134('0x4')][_0x3e9bf1['id']]=_0x3e9bf1;this[_0xb134('0x5')][_0x3e9bf1['id']]=[];};Graph[_0xb134('0x6')][_0xb134('0x8')]=function(_0x18f8f4,_0x412861,_0x1b6327){this[_0xb134('0x5')][_0x18f8f4][_0xb134('0x9')]({'target':_0x412861,'condition':_0x1b6327});this['numberOfEdges']+=0x1;};Graph[_0xb134('0x6')]['size']=function(){return _[_0xb134('0xa')](this[_0xb134('0x4')]);};Graph[_0xb134('0x6')][_0xb134('0xb')]=function(){return this[_0xb134('0xc')];};Graph[_0xb134('0x6')][_0xb134('0xd')]=function(_0x1efb5f){return this[_0xb134('0x4')][_0x1efb5f];};Graph['prototype']['traverseBFS']=function(_0x7ad5e7,_0x46a49b){if(!this[_0xb134('0x4')][_0x7ad5e7]){return logger[_0xb134('0xe')](_0xb134('0xf'));}var _0x2a981e=_0x46a49b(this[_0xb134('0x4')][_0x7ad5e7]);if(!_0x2a981e){return logger[_0xb134('0xe')](_0xb134('0x10'));}if(this[_0xb134('0x5')][_0x7ad5e7]['length']===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x1064af=0x0,_0x5be68b=[],_0x3b830a=![];_0x1064af\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','push','error','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','info','arg_1','calleridname','dnid','uniqueid','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x274a23,_0xba9cbb){var _0x39be73=function(_0x1dd0ab){while(--_0x1dd0ab){_0x274a23['push'](_0x274a23['shift']());}};_0x39be73(++_0xba9cbb);}(_0xb2a8,0x16f));var _0x8b2a=function(_0x329485,_0x4f7e0d){_0x329485=_0x329485-0x0;var _0x3dd0bb=_0xb2a8[_0x329485];return _0x3dd0bb;};'use strict';var _=require('lodash');var syncho=require(_0x8b2a('0x0'));var util=require(_0x8b2a('0x1'));var config=require(_0x8b2a('0x2'));var logger=require(_0x8b2a('0x3'))('agi');var utilLicense=require(_0x8b2a('0x4'));var rpc=require('./rpc');var Project=require(_0x8b2a('0x5'));var AGIEmitter=require(_0x8b2a('0x6'))[_0x8b2a('0x7')];var projects=[];config[_0x8b2a('0x8')]=_['defaults'](config['agi'],{'ip':_0x8b2a('0x9'),'port':0x11dd});AGIEmitter['on'](_0x8b2a('0xa'),projectUpdateHandler);function connectionHandler(_0x491184){process[_0x8b2a('0xb')](function(){syncho(function(){try{setChannelVariables(_0x491184);agiHandler(_0x491184);}catch(_0x446d21){logger['error'](_0x446d21[_0x8b2a('0xc')]);}});});}function projectUpdateHandler(_0x1a3da0){try{var _0x2b8266=_[_0x8b2a('0xd')](projects,['id',_0x1a3da0['id']]);if(_0x2b8266>-0x1){if(_0x1a3da0[_0x8b2a('0xe')]===!![]){projects[_0x8b2a('0xf')](_0x2b8266,0x1);}else{projects[_0x2b8266]=_0x1a3da0;}}else{projects[_0x8b2a('0x10')](_0x1a3da0);}}catch(_0x266fc7){logger[_0x8b2a('0x11')](_0x266fc7[_0x8b2a('0xc')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x8b2a('0x12')]);logger['info'](util[_0x8b2a('0x13')](_0x8b2a('0x14'),config['agi']['ip'],config[_0x8b2a('0x8')][_0x8b2a('0x12')]));}function errorHandler(_0x3c873b){if(_0x3c873b&&_0x3c873b[_0x8b2a('0x15')]&&_0x3c873b[_0x8b2a('0x16')]){logger[_0x8b2a('0x11')](util[_0x8b2a('0x13')]('[%s]\x20%s',_0x3c873b[_0x8b2a('0x15')],_0x3c873b[_0x8b2a('0x16')]));}else{logger['error'](util[_0x8b2a('0x13')](_0x8b2a('0x17'),_0x3c873b[_0x8b2a('0xc')]));}}function closeHandler(){logger[_0x8b2a('0x18')](util[_0x8b2a('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8b2a('0x19')],this[_0x8b2a('0x1a')],this['callerid'],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));try{createSquareReport(this);}catch(_0x1a9178){logger['error'](_0x1a9178[_0x8b2a('0xc')]);}}function timeoutHandler(){logger[_0x8b2a('0x18')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8b2a('0x19')],this['calleridname'],this[_0x8b2a('0x1d')],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));}function hangupHandler(){logger[_0x8b2a('0x18')](util['format'](_0x8b2a('0x1e'),this[_0x8b2a('0x19')],this[_0x8b2a('0x1a')],this[_0x8b2a('0x1d')],this[_0x8b2a('0x1b')],this[_0x8b2a('0x1c')]));this[_0x8b2a('0x1f')]=!![];}function createSquareReport(_0x2c3776,_0x2fae35){rpc[_0x8b2a('0x20')](_0x2c3776)[_0x8b2a('0x21')](function(_0x258a2d){if(_0x2fae35){_0x2fae35(null,_0x258a2d);}})[_0x8b2a('0x22')](function(_0x20f84c){if(_0x2fae35){_0x2fae35(null,_0x20f84c);}});}function setChannelVariables(_0x3a494b){for(var _0x4554ac in _0x3a494b){if(_0x3a494b[_0x8b2a('0x23')](_0x4554ac)){if(_0x4554ac[_0x8b2a('0x24')](_0x8b2a('0x25'))===0x0){_0x3a494b[_0x4554ac['substring'](0x4)]=_0x3a494b[_0x4554ac];delete _0x3a494b[_0x4554ac];}}}}function agiHandler(_0x7da768){logger[_0x8b2a('0x26')](_0x8b2a('0x27'),JSON[_0x8b2a('0x28')](_0x7da768,null,0x2));logger[_0x8b2a('0x18')](util['format'](_0x8b2a('0x29'),_0x7da768['arg_1'],_0x7da768['calleridname'],_0x7da768['callerid'],_0x7da768[_0x8b2a('0x1b')],_0x7da768['uniqueid']));_0x7da768['on'](_0x8b2a('0x11'),errorHandler);_0x7da768['on'](_0x8b2a('0x2a'),closeHandler);_0x7da768['on'](_0x8b2a('0x2b'),timeoutHandler);_0x7da768[_0x8b2a('0x1f')]=![];_0x7da768['on'](_0x8b2a('0x2c'),hangupHandler);var _0x32a977=_['find'](projects,[_0x8b2a('0x15'),_0x7da768[_0x8b2a('0x19')]]);if(!_0x32a977)return Project[_0x8b2a('0x2d')](_0x7da768);if(!_0x32a977[_0x8b2a('0x2e')])return Project[_0x8b2a('0x2f')](_0x7da768);return Project['initialize'](_0x32a977,_0x7da768);}function main(){var _0x37d852;return utilLicense[_0x8b2a('0x30')]()[_0x8b2a('0x21')](function(_0x44b8bb){if(!_0x44b8bb)return;if(_0x44b8bb[_0x8b2a('0x31')]){if(_0x44b8bb[_0x8b2a('0x32')]&&_0x44b8bb[_0x8b2a('0x32')]>0x0){logger[_0x8b2a('0x18')](util[_0x8b2a('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x44b8bb[_0x8b2a('0x32')]));_0x37d852=_0x44b8bb[_0x8b2a('0x32')];}else{logger[_0x8b2a('0x18')](_0x8b2a('0x33'));}}else{logger['info'](_0x8b2a('0x34'));_0x37d852=-0x1;}})[_0x8b2a('0x21')](function(){return Project[_0x8b2a('0x35')]();})[_0x8b2a('0x21')](function(_0x5dc671){projects=_0x5dc671;return;})[_0x8b2a('0x22')](function(_0x16e945){logger['error'](_0x8b2a('0x36'),_0x16e945['stack']);})[_0x8b2a('0x37')](function(){var _0x410c55=require(_0x8b2a('0x38'))(config['agi'][_0x8b2a('0x12')],config['agi']['ip'],_0x37d852);_0x410c55['on']('error',errorHandler);_0x410c55['on']('listening',listeningHandler);_0x410c55['on']('connection',connectionHandler);_0x410c55['on'](_0x8b2a('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x88ac=['uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','indexOf','agi_','debug','variables','stringify','close','hangup','find','production','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','util','../../config/environment','agi','../../config/license/util','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','deleted','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x88ac,0x1a4));var _0xc88a=function(_0x50c7d6,_0x43aaed){_0x50c7d6=_0x50c7d6-0x0;var _0x4e1b11=_0x88ac[_0x50c7d6];return _0x4e1b11;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0xc88a('0x0'));var config=require(_0xc88a('0x1'));var logger=require('../../config/logger')(_0xc88a('0x2'));var utilLicense=require(_0xc88a('0x3'));var rpc=require('./rpc');var Project=require(_0xc88a('0x4'));var AGIEmitter=require(_0xc88a('0x5'))[_0xc88a('0x6')];var projects=[];config[_0xc88a('0x2')]=_[_0xc88a('0x7')](config[_0xc88a('0x2')],{'ip':_0xc88a('0x8'),'port':0x11dd});AGIEmitter['on'](_0xc88a('0x9'),projectUpdateHandler);function connectionHandler(_0x397e29){process[_0xc88a('0xa')](function(){syncho(function(){try{setChannelVariables(_0x397e29);agiHandler(_0x397e29);}catch(_0x22e64c){logger['error'](_0x22e64c['stack']);}});});}function projectUpdateHandler(_0x39619a){try{var _0x2f5dc3=_['findIndex'](projects,['id',_0x39619a['id']]);if(_0x2f5dc3>-0x1){if(_0x39619a[_0xc88a('0xb')]===!![]){projects['splice'](_0x2f5dc3,0x1);}else{projects[_0x2f5dc3]=_0x39619a;}}else{projects['push'](_0x39619a);}}catch(_0x45162a){logger[_0xc88a('0xc')](_0x45162a['stack']);}}function listeningHandler(){console[_0xc88a('0xd')](_0xc88a('0xe'),config[_0xc88a('0x2')][_0xc88a('0xf')]);logger['info'](util[_0xc88a('0x10')](_0xc88a('0x11'),config[_0xc88a('0x2')]['ip'],config[_0xc88a('0x2')][_0xc88a('0xf')]));}function errorHandler(_0x2b6f1c){if(_0x2b6f1c&&_0x2b6f1c[_0xc88a('0x12')]&&_0x2b6f1c[_0xc88a('0x13')]){logger['error'](util[_0xc88a('0x10')](_0xc88a('0x14'),_0x2b6f1c[_0xc88a('0x12')],_0x2b6f1c[_0xc88a('0x13')]));}else{logger[_0xc88a('0xc')](util['format'](_0xc88a('0x15'),_0x2b6f1c[_0xc88a('0x16')]));}}function closeHandler(){logger[_0xc88a('0x17')](util[_0xc88a('0x10')](_0xc88a('0x18'),this[_0xc88a('0x19')],this[_0xc88a('0x1a')],this[_0xc88a('0x1b')],this['dnid'],this[_0xc88a('0x1c')]));try{createSquareReport(this);}catch(_0x42af5d){logger['error'](_0x42af5d[_0xc88a('0x16')]);}}function timeoutHandler(){logger[_0xc88a('0x17')](util[_0xc88a('0x10')](_0xc88a('0x1d'),this['arg_1'],this['calleridname'],this[_0xc88a('0x1b')],this[_0xc88a('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0xc88a('0x17')](util[_0xc88a('0x10')](_0xc88a('0x1f'),this['arg_1'],this['calleridname'],this[_0xc88a('0x1b')],this[_0xc88a('0x1e')],this[_0xc88a('0x1c')]));this[_0xc88a('0x20')]=!![];}function createSquareReport(_0x16d5b0,_0x413659){rpc[_0xc88a('0x21')](_0x16d5b0)['then'](function(_0x5a7db5){if(_0x413659){_0x413659(null,_0x5a7db5);}})['catch'](function(_0x4ce030){if(_0x413659){_0x413659(null,_0x4ce030);}});}function setChannelVariables(_0x5d0fb7){for(var _0x30bb25 in _0x5d0fb7){if(_0x5d0fb7['hasOwnProperty'](_0x30bb25)){if(_0x30bb25[_0xc88a('0x22')](_0xc88a('0x23'))===0x0){_0x5d0fb7[_0x30bb25['substring'](0x4)]=_0x5d0fb7[_0x30bb25];delete _0x5d0fb7[_0x30bb25];}}}}function agiHandler(_0x214f11){logger[_0xc88a('0x24')](_0xc88a('0x25'),JSON[_0xc88a('0x26')](_0x214f11,null,0x2));logger[_0xc88a('0x17')](util[_0xc88a('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x214f11[_0xc88a('0x19')],_0x214f11[_0xc88a('0x1a')],_0x214f11[_0xc88a('0x1b')],_0x214f11['dnid'],_0x214f11[_0xc88a('0x1c')]));_0x214f11['on'](_0xc88a('0xc'),errorHandler);_0x214f11['on'](_0xc88a('0x27'),closeHandler);_0x214f11['on']('timeout',timeoutHandler);_0x214f11['evtHangup']=![];_0x214f11['on'](_0xc88a('0x28'),hangupHandler);var _0x583877=_[_0xc88a('0x29')](projects,[_0xc88a('0x12'),_0x214f11[_0xc88a('0x19')]]);if(!_0x583877)return Project['handleNotFound'](_0x214f11);if(!_0x583877[_0xc88a('0x2a')])return Project['handleUnpublished'](_0x214f11);return Project[_0xc88a('0x2b')](_0x583877,_0x214f11);}function main(){var _0xabd37b;return utilLicense['getLicense']()[_0xc88a('0x2c')](function(_0x54060a){if(!_0x54060a)return;if(_0x54060a[_0xc88a('0x2d')]){if(_0x54060a[_0xc88a('0x2e')]&&_0x54060a[_0xc88a('0x2e')]>0x0){logger[_0xc88a('0x17')](util['format'](_0xc88a('0x2f'),_0x54060a[_0xc88a('0x2e')]));_0xabd37b=_0x54060a['callysquare'];}else{logger[_0xc88a('0x17')](_0xc88a('0x30'));}}else{logger['info'](_0xc88a('0x31'));_0xabd37b=-0x1;}})['then'](function(){return Project[_0xc88a('0x32')]();})[_0xc88a('0x2c')](function(_0xd245d){projects=_0xd245d;return;})[_0xc88a('0x33')](function(_0xc7f545){logger[_0xc88a('0xc')]('[LICENSE]',_0xc7f545[_0xc88a('0x16')]);})[_0xc88a('0x34')](function(){var _0x30293a=require(_0xc88a('0x35'))(config['agi']['port'],config['agi']['ip'],_0xabd37b);_0x30293a['on']('error',errorHandler);_0x30293a['on'](_0xc88a('0x36'),listeningHandler);_0x30293a['on'](_0xc88a('0x37'),connectionHandler);_0x30293a['on'](_0xc88a('0x27'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index ef5f9d1..cdc361b 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 _0xf056=['then','error','result','catch','sendMailMessage','bluebird','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf056,0x125));var _0x6f05=function(_0x2009cd,_0x542bfa){_0x2009cd=_0x2009cd-0x0;var _0x4723e8=_0xf056[_0x2009cd];return _0x4723e8;};'use strict';var BPromise=require(_0x6f05('0x0'));var jayson=require(_0x6f05('0x1'));var client=jayson['client'][_0x6f05('0x2')]({'port':0x232b});function request(_0x47b818,_0x2e9bcc){return new BPromise(function(_0x8cfb95,_0x18adb4){return client[_0x6f05('0x3')](_0x47b818,_0x2e9bcc)[_0x6f05('0x4')](function(_0x54bc7a){if(_0x54bc7a['error']){return _0x18adb4(_0x54bc7a[_0x6f05('0x5')]['message']);}else{return _0x8cfb95(_0x54bc7a[_0x6f05('0x6')]);}})[_0x6f05('0x7')](function(_0x5168ce){return _0x18adb4(_0x5168ce);});});}exports[_0x6f05('0x8')]=function(_0xa691b5,_0xf49790){return request('SendMail',{'account':_0xa691b5,'message':_0xf49790});}; \ No newline at end of file +var _0x5b3e=['http','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x509240,_0x275072){var _0x475994=function(_0x50e8f5){while(--_0x50e8f5){_0x509240['push'](_0x509240['shift']());}};_0x475994(++_0x275072);}(_0x5b3e,0x15c));var _0xe5b3=function(_0x15e8eb,_0x1c3450){_0x15e8eb=_0x15e8eb-0x0;var _0x1859f7=_0x5b3e[_0x15e8eb];return _0x1859f7;};'use strict';var BPromise=require(_0xe5b3('0x0'));var jayson=require(_0xe5b3('0x1'));var client=jayson[_0xe5b3('0x2')][_0xe5b3('0x3')]({'port':0x232b});function request(_0x5e618b,_0x1e5610){return new BPromise(function(_0x393206,_0x3ba98b){return client['request'](_0x5e618b,_0x1e5610)['then'](function(_0x3ec596){if(_0x3ec596[_0xe5b3('0x4')]){return _0x3ba98b(_0x3ec596[_0xe5b3('0x4')][_0xe5b3('0x5')]);}else{return _0x393206(_0x3ec596[_0xe5b3('0x6')]);}})[_0xe5b3('0x7')](function(_0x7699b1){return _0x3ba98b(_0x7699b1);});});}exports[_0xe5b3('0x8')]=function(_0x2aa071,_0x605acc){return request('SendMail',{'account':_0x2aa071,'message':_0x605acc});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 8c1b06c..8169cb4 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 _0x8234=['xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','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','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','result','toString','agicommand\x20not\x20found','finally','calleridname','debug','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','continueAt','exports','lodash','moment'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x8234,0x80));var _0x4823=function(_0xd3fb91,_0xfc54c0){_0xd3fb91=_0xd3fb91-0x0;var _0x33438c=_0x8234[_0xd3fb91];return _0x33438c;};'use strict';var _=require(_0x4823('0x0'));var moment=require(_0x4823('0x1'));var parser=require(_0x4823('0x2'));var util=require(_0x4823('0x3'));var logger=require(_0x4823('0x4'))(_0x4823('0x5'));var rpc=require(_0x4823('0x6'));var mailRpc=require(_0x4823('0x7'));var Graph=require(_0x4823('0x8'));var Vertices=require(_0x4823('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4823('0xa')]()[_0x4823('0xb')](function(_0x25beb){logger[_0x4823('0xc')](_0x4823('0xd'),_0x25beb[_0x4823('0xe')]);return[];});}function addVertex(_0x4e7029,_0x2e889c,_0x25fb87){_0x2e889c[_0x4823('0xf')]=_0x25fb87;if(_0x2e889c[_0x4823('0x10')]('retry')){_0x2e889c[_0x4823('0x11')]=parseInt(_0x2e889c[_0x4823('0x12')],0xa);}_0x4e7029[_0x4823('0x13')](_[_0x4823('0x14')](_0x2e889c,_0x4823('0x15')));}function initGraph(_0x408e99,_0x4c7da5){var _0x1a8511=new Graph();for(var _0x5d39ab in _0x408e99){if(_0x408e99[_0x4823('0x10')](_0x5d39ab)){if(_['isArray'](_0x408e99[_0x5d39ab])){for(var _0x3fa8d0=0x0;_0x3fa8d0<_0x408e99[_0x5d39ab][_0x4823('0x16')];_0x3fa8d0+=0x1){addVertex(_0x1a8511,_0x408e99[_0x5d39ab][_0x3fa8d0],_0x5d39ab);}}else{addVertex(_0x1a8511,_0x408e99[_0x5d39ab],_0x5d39ab);}}}for(var _0x5131bd=0x0;_0x5131bd<_0x4c7da5['length'];_0x5131bd+=0x1){if(_0x4c7da5[_0x5131bd][_0x4823('0x17')]&&_0x4c7da5[_0x5131bd][_0x4823('0x18')]){_0x1a8511['addEdge'](_0x4c7da5[_0x5131bd]['source'],_0x4c7da5[_0x5131bd][_0x4823('0x18')],_0x4c7da5[_0x5131bd][_0x4823('0x19')]);}}return _0x1a8511;}function getRoot(_0x4e8068){return parser[_0x4823('0x1a')](_0x4e8068,{'object':!![]})[_0x4823('0x1b')][_0x4823('0x1c')];}function inspect(_0x4d74a7){return util[_0x4823('0x1d')](_0x4d74a7,{'showHidden':![],'depth':null});}function initialize(_0x394d7b,_0x511e23){var _0x12afe9=getRoot(_0x394d7b[_0x4823('0x1e')]);if(!_0x12afe9||!_0x12afe9['start'])return;var _0x1d07a3,_0x2bb2c4,_0xee270c;logger['debug'](_0x4823('0x1c'),JSON[_0x4823('0x1f')](_0x12afe9,null,0x2));_0x511e23[_0x4823('0x20')]=moment()[_0x4823('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d07a3=initGraph(_[_0x4823('0x14')](_0x12afe9,_0x4823('0x15')),_0x12afe9[_0x4823('0x15')]);_0x2bb2c4=new Vertices(_0x511e23,rpc,mailRpc);logger[_0x4823('0x22')](util['format'](_0x4823('0x23'),_0x511e23[_0x4823('0x24')],_0x511e23['calleridname'],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));_0x1d07a3[_0x4823('0x28')](_0x12afe9[_0x4823('0x29')]['id'],function(_0x2bbb12){try{_0x2bbb12=_0x2bb2c4[_0x4823('0x2a')](_0x2bbb12);logger['debug'](_0x4823('0x2b'),JSON[_0x4823('0x1f')](_0x2bbb12,null,0x2));if(_0x2bbb12[_0x4823('0xf')]===_0x4823('0x2c')){logger[_0x4823('0x22')](_0x4823('0x2d'));_0x511e23[_0x4823('0x2e')]=_0x2bbb12[_0x4823('0x2e')]||_0x511e23[_0x4823('0x2e')];_0x511e23[_0x4823('0x2f')]=_0x2bbb12[_0x4823('0x2f')];_0x511e23[_0x4823('0x30')]=_0x2bbb12[_0x4823('0x30')]?_0x2bbb12['priority']-0x1:0x1;return null;}else if(_0x2bbb12&&_0x2bb2c4[_0x2bbb12[_0x4823('0xf')]]){_0xee270c=_0x2bb2c4[_0x2bbb12[_0x4823('0xf')]](_0x2bbb12);logger[_0x4823('0x22')](_0x4823('0x31'),JSON[_0x4823('0x1f')](_0xee270c,null,0x2));if(_0xee270c&&_0xee270c[_0x4823('0x32')]===AGI_CODE_SUCCESS&&_0xee270c['result']!==AGI_RESULT_ERROR&&!_0x511e23[_0x4823('0x33')]){logger['debug'](_0x4823('0x31'),inspect(_0xee270c));return _['isUndefined'](_0xee270c['result'])?null:_0xee270c[_0x4823('0x34')][_0x4823('0x35')]();}else{logger['error'](_0x4823('0x31'),inspect(_0xee270c));return null;}}else{logger['error'](_0x4823('0x36'));return null;}}catch(_0x977146){logger[_0x4823('0xc')](_0x977146['stack']);return null;}});if(_0x12afe9[_0x4823('0x37')]){logger[_0x4823('0x22')](util[_0x4823('0x21')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x511e23['arg_1'],_0x511e23[_0x4823('0x38')],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));_0x1d07a3['traverseBFS'](_0x12afe9[_0x4823('0x37')]['id'],function(_0x19a7e3){try{_0x19a7e3=_0x2bb2c4[_0x4823('0x2a')](_0x19a7e3);logger['debug'](_0x4823('0x2b'),JSON['stringify'](_0x19a7e3,null,0x2));if(_0x19a7e3&&_0x2bb2c4[_0x19a7e3['agicommand']]){_0xee270c=_0x2bb2c4[_0x19a7e3['agicommand']](_0x19a7e3);if(_0xee270c){logger[_0x4823('0x39')](_0x4823('0x31'),inspect(_0xee270c));return _[_0x4823('0x3a')](_0xee270c['result'])?null:_0xee270c[_0x4823('0x34')][_0x4823('0x35')]();}else{logger['error']('response',inspect(_0xee270c));return null;}}else{logger[_0x4823('0xc')](_0x4823('0x36'));return null;}}catch(_0x4afb8d){logger[_0x4823('0xc')](_0x4afb8d[_0x4823('0xe')]);return null;}});}logger[_0x4823('0x22')](util[_0x4823('0x21')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x511e23[_0x4823('0x24')],_0x511e23[_0x4823('0x38')],_0x511e23[_0x4823('0x25')],_0x511e23[_0x4823('0x26')],_0x511e23[_0x4823('0x27')]));logger[_0x4823('0x22')](util['format'](_0x4823('0x3b'),_0x511e23['context'],_0x511e23[_0x4823('0x2f')],parseInt(_0x511e23[_0x4823('0x30')],0xa)+0x1));_0x511e23['continueAt'](_0x511e23[_0x4823('0x2e')],_0x511e23[_0x4823('0x2f')],parseInt(_0x511e23['priority'],0xa)+0x1);_0x511e23[_0x4823('0x3c')]();}function handleNotFound(_0x4678d0){logger[_0x4823('0xc')](util[_0x4823('0x21')](_0x4823('0x3d'),_0x4678d0[_0x4823('0x24')]));_0x4678d0['continueAt'](_0x4678d0['context'],_0x4678d0[_0x4823('0x2f')],parseInt(_0x4678d0['priority'],0xa)+0x1);_0x4678d0['close']();}function handleUnpublished(_0x1bda33){logger[_0x4823('0xc')](util['format'](_0x4823('0x3e'),_0x1bda33['arg_1']));_0x1bda33[_0x4823('0x3f')](_0x1bda33['context'],_0x1bda33['extension'],parseInt(_0x1bda33[_0x4823('0x30')],0xa)+0x1);_0x1bda33['close']();}module[_0x4823('0x40')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xbef9=['traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','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','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','inspect','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','callerid','dnid'];(function(_0x26178e,_0x3542d5){var _0x3d214e=function(_0x30b44e){while(--_0x30b44e){_0x26178e['push'](_0x26178e['shift']());}};_0x3d214e(++_0x3542d5);}(_0xbef9,0x104));var _0x9bef=function(_0x47fccc,_0x30e401){_0x47fccc=_0x47fccc-0x0;var _0x1f3660=_0xbef9[_0x47fccc];return _0x1f3660;};'use strict';var _=require('lodash');var moment=require(_0x9bef('0x0'));var parser=require(_0x9bef('0x1'));var util=require(_0x9bef('0x2'));var logger=require('../../config/logger')(_0x9bef('0x3'));var rpc=require(_0x9bef('0x4'));var mailRpc=require(_0x9bef('0x5'));var Graph=require(_0x9bef('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9bef('0x7')]()['catch'](function(_0x1485d2){logger[_0x9bef('0x8')](_0x9bef('0x9'),_0x1485d2[_0x9bef('0xa')]);return[];});}function addVertex(_0x40c570,_0xce1ae0,_0x1f93e1){_0xce1ae0[_0x9bef('0xb')]=_0x1f93e1;if(_0xce1ae0[_0x9bef('0xc')](_0x9bef('0xd'))){_0xce1ae0['maxRetry']=parseInt(_0xce1ae0[_0x9bef('0xd')],0xa);}_0x40c570[_0x9bef('0xe')](_[_0x9bef('0xf')](_0xce1ae0,_0x9bef('0x10')));}function initGraph(_0x536486,_0x3b1d94){var _0x2db2ce=new Graph();for(var _0x512026 in _0x536486){if(_0x536486[_0x9bef('0xc')](_0x512026)){if(_[_0x9bef('0x11')](_0x536486[_0x512026])){for(var _0x94d200=0x0;_0x94d200<_0x536486[_0x512026][_0x9bef('0x12')];_0x94d200+=0x1){addVertex(_0x2db2ce,_0x536486[_0x512026][_0x94d200],_0x512026);}}else{addVertex(_0x2db2ce,_0x536486[_0x512026],_0x512026);}}}for(var _0x3abfe9=0x0;_0x3abfe9<_0x3b1d94[_0x9bef('0x12')];_0x3abfe9+=0x1){if(_0x3b1d94[_0x3abfe9][_0x9bef('0x13')]&&_0x3b1d94[_0x3abfe9]['target']){_0x2db2ce[_0x9bef('0x14')](_0x3b1d94[_0x3abfe9]['source'],_0x3b1d94[_0x3abfe9][_0x9bef('0x15')],_0x3b1d94[_0x3abfe9]['value']);}}return _0x2db2ce;}function getRoot(_0x2c8103){return parser[_0x9bef('0x16')](_0x2c8103,{'object':!![]})[_0x9bef('0x17')][_0x9bef('0x18')];}function inspect(_0x5a5ef2){return util[_0x9bef('0x19')](_0x5a5ef2,{'showHidden':![],'depth':null});}function initialize(_0x2d23b0,_0x112671){var _0x4a542c=getRoot(_0x2d23b0['production']);if(!_0x4a542c||!_0x4a542c[_0x9bef('0x1a')])return;var _0x22937a,_0x4e674b,_0x38e528;logger[_0x9bef('0x1b')]('root',JSON[_0x9bef('0x1c')](_0x4a542c,null,0x2));_0x112671['joinAt']=moment()[_0x9bef('0x1d')](_0x9bef('0x1e'));_0x22937a=initGraph(_[_0x9bef('0xf')](_0x4a542c,'mxCell'),_0x4a542c['mxCell']);_0x4e674b=new Vertices(_0x112671,rpc,mailRpc);logger[_0x9bef('0x1f')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x112671[_0x9bef('0x20')],_0x112671['calleridname'],_0x112671[_0x9bef('0x21')],_0x112671[_0x9bef('0x22')],_0x112671['uniqueid']));_0x22937a[_0x9bef('0x23')](_0x4a542c[_0x9bef('0x1a')]['id'],function(_0x1a3351){try{_0x1a3351=_0x4e674b[_0x9bef('0x24')](_0x1a3351);logger[_0x9bef('0x1b')](_0x9bef('0x25'),JSON[_0x9bef('0x1c')](_0x1a3351,null,0x2));if(_0x1a3351[_0x9bef('0xb')]==='gotoc'){logger[_0x9bef('0x1f')](_0x9bef('0x26'));_0x112671['context']=_0x1a3351['context']||_0x112671[_0x9bef('0x27')];_0x112671[_0x9bef('0x28')]=_0x1a3351[_0x9bef('0x28')];_0x112671[_0x9bef('0x29')]=_0x1a3351[_0x9bef('0x29')]?_0x1a3351[_0x9bef('0x29')]-0x1:0x1;return null;}else if(_0x1a3351&&_0x4e674b[_0x1a3351[_0x9bef('0xb')]]){_0x38e528=_0x4e674b[_0x1a3351[_0x9bef('0xb')]](_0x1a3351);logger[_0x9bef('0x1f')](_0x9bef('0x2a'),JSON[_0x9bef('0x1c')](_0x38e528,null,0x2));if(_0x38e528&&_0x38e528[_0x9bef('0x2b')]===AGI_CODE_SUCCESS&&_0x38e528[_0x9bef('0x2c')]!==AGI_RESULT_ERROR&&!_0x112671[_0x9bef('0x2d')]){logger[_0x9bef('0x1b')](_0x9bef('0x2a'),inspect(_0x38e528));return _[_0x9bef('0x2e')](_0x38e528[_0x9bef('0x2c')])?null:_0x38e528['result'][_0x9bef('0x2f')]();}else{logger[_0x9bef('0x8')](_0x9bef('0x2a'),inspect(_0x38e528));return null;}}else{logger[_0x9bef('0x8')](_0x9bef('0x30'));return null;}}catch(_0x3e0903){logger['error'](_0x3e0903[_0x9bef('0xa')]);return null;}});if(_0x4a542c[_0x9bef('0x31')]){logger[_0x9bef('0x1f')](util[_0x9bef('0x1d')](_0x9bef('0x32'),_0x112671[_0x9bef('0x20')],_0x112671['calleridname'],_0x112671[_0x9bef('0x21')],_0x112671[_0x9bef('0x22')],_0x112671[_0x9bef('0x33')]));_0x22937a['traverseBFS'](_0x4a542c[_0x9bef('0x31')]['id'],function(_0xb50ac5){try{_0xb50ac5=_0x4e674b[_0x9bef('0x24')](_0xb50ac5);logger[_0x9bef('0x1b')](_0x9bef('0x25'),JSON['stringify'](_0xb50ac5,null,0x2));if(_0xb50ac5&&_0x4e674b[_0xb50ac5[_0x9bef('0xb')]]){_0x38e528=_0x4e674b[_0xb50ac5[_0x9bef('0xb')]](_0xb50ac5);if(_0x38e528){logger['debug'](_0x9bef('0x2a'),inspect(_0x38e528));return _[_0x9bef('0x2e')](_0x38e528['result'])?null:_0x38e528[_0x9bef('0x2c')][_0x9bef('0x2f')]();}else{logger[_0x9bef('0x8')]('response',inspect(_0x38e528));return null;}}else{logger['error'](_0x9bef('0x30'));return null;}}catch(_0x5f58f0){logger[_0x9bef('0x8')](_0x5f58f0['stack']);return null;}});}logger[_0x9bef('0x1f')](util[_0x9bef('0x1d')](_0x9bef('0x34'),_0x112671[_0x9bef('0x20')],_0x112671[_0x9bef('0x35')],_0x112671['callerid'],_0x112671[_0x9bef('0x22')],_0x112671[_0x9bef('0x33')]));logger[_0x9bef('0x1f')](util[_0x9bef('0x1d')](_0x9bef('0x36'),_0x112671[_0x9bef('0x27')],_0x112671[_0x9bef('0x28')],parseInt(_0x112671['priority'],0xa)+0x1));_0x112671[_0x9bef('0x37')](_0x112671[_0x9bef('0x27')],_0x112671['extension'],parseInt(_0x112671[_0x9bef('0x29')],0xa)+0x1);_0x112671[_0x9bef('0x38')]();}function handleNotFound(_0x3ac189){logger['error'](util[_0x9bef('0x1d')](_0x9bef('0x39'),_0x3ac189[_0x9bef('0x20')]));_0x3ac189['continueAt'](_0x3ac189[_0x9bef('0x27')],_0x3ac189[_0x9bef('0x28')],parseInt(_0x3ac189[_0x9bef('0x29')],0xa)+0x1);_0x3ac189[_0x9bef('0x38')]();}function handleUnpublished(_0x50f441){logger['error'](util[_0x9bef('0x1d')]('Project\x20%s\x20not\x20published',_0x50f441[_0x9bef('0x20')]));_0x50f441[_0x9bef('0x37')](_0x50f441[_0x9bef('0x27')],_0x50f441[_0x9bef('0x28')],parseInt(_0x50f441['priority'],0xa)+0x1);_0x50f441[_0x9bef('0x38')]();}module[_0x9bef('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 11f1dd9..144fdde 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 _0x8b0c=['headers','substring','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','length','split','slice','trim'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8b0c,0xec));var _0xc8b0=function(_0xc5f804,_0x2f3ea2){_0xc5f804=_0xc5f804-0x0;var _0x10412e=_0x8b0c[_0xc5f804];return _0x10412e;};'use strict';var util=require(_0xc8b0('0x0'));var Transform=require(_0xc8b0('0x1'))[_0xc8b0('0x2')];function AGIReply(_0x508c7d){Transform[_0xc8b0('0x3')](this,_0x508c7d);this[_0xc8b0('0x4')]='';this[_0xc8b0('0x5')]=![];}util[_0xc8b0('0x6')](AGIReply,Transform);AGIReply[_0xc8b0('0x7')][_0xc8b0('0x8')]=function(_0x2f0cea,_0x4f8ce5,_0x396e58){var _0x358de8='\x0a',_0x480e5e=['\x0a\x0a',_0xc8b0('0x9')],_0x2b4494=-0x1,_0x44a4b3=-0x1,_0x707783='',_0x562159=0x0,_0x311417='',_0x58ed3f='';this[_0xc8b0('0x4')]+=_0x2f0cea[_0xc8b0('0xa')]();_0x311417=this['_localBuffer'];if(!this['_inBody']){_0x562159=0x0;while(_0x480e5e[_0x562159]){while((_0x44a4b3=_0x311417[_0xc8b0('0xb')](_0x480e5e[_0x562159]))!=-0x1){_0x707783=_0x480e5e[_0x562159];_0x58ed3f=_0x311417['substring'](0x0,_0x44a4b3);_0x311417=_0x311417['substring'](_0x44a4b3+_0x707783[_0xc8b0('0xc')]);var _0x50cefc=_0x58ed3f[_0xc8b0('0xd')](_0x358de8),_0x5dde5f=0x0,_0x5116fc={},_0x3a295e='',_0x44a16e='',_0x2917cf=-0x1;while(_0x50cefc[_0x5dde5f]){_0x2917cf=_0x50cefc[_0x5dde5f]['indexOf'](':');if(_0x2917cf!=-0x1){_0x3a295e=_0x50cefc[_0x5dde5f][_0xc8b0('0xe')](0x0,_0x2917cf)['trim']();_0x44a16e=_0x50cefc[_0x5dde5f]['slice'](_0x2917cf+0x1)[_0xc8b0('0xf')]();if(_0x3a295e[_0xc8b0('0xc')]>0x0){_0x5116fc[_0x3a295e]=_0x44a16e;}}else{}_0x5dde5f++;}this['emit'](_0xc8b0('0x10'),_0x5116fc);this[_0xc8b0('0x5')]=!![];}_0x562159++;}this[_0xc8b0('0x4')]=_0x311417;}else{while((_0x2b4494=_0x311417[_0xc8b0('0xb')](_0x358de8))!=-0x1){_0x58ed3f=_0x311417[_0xc8b0('0x11')](0x0,_0x2b4494);this[_0xc8b0('0x12')](_0xc8b0('0x13'),_0x58ed3f);_0x311417=_0x311417['substring'](_0x2b4494+_0x358de8[_0xc8b0('0xc')]);}this['_localBuffer']=_0x311417;}_0x396e58();};module[_0xc8b0('0x14')]=AGIReply; \ No newline at end of file +var _0x3482=['prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','slice','trim','emit','headers','indexOf','line','Transform','_localBuffer','_inBody','inherits'];(function(_0xca2488,_0x14de01){var _0xa77bb9=function(_0x2b820c){while(--_0x2b820c){_0xca2488['push'](_0xca2488['shift']());}};_0xa77bb9(++_0x14de01);}(_0x3482,0x1bc));var _0x2348=function(_0x2589a4,_0x5bbc0e){_0x2589a4=_0x2589a4-0x0;var _0x4951f9=_0x3482[_0x2589a4];return _0x4951f9;};'use strict';var util=require('util');var Transform=require('stream')[_0x2348('0x0')];function AGIReply(_0x336922){Transform['call'](this,_0x336922);this[_0x2348('0x1')]='';this[_0x2348('0x2')]=![];}util[_0x2348('0x3')](AGIReply,Transform);AGIReply[_0x2348('0x4')][_0x2348('0x5')]=function(_0x270cf4,_0x331728,_0x41aefc){var _0x2d3023='\x0a',_0x2c7b2a=['\x0a\x0a',_0x2348('0x6')],_0x316bd6=-0x1,_0x131a9a=-0x1,_0x308afb='',_0x3cdc9a=0x0,_0x210d1b='',_0x4137cc='';this[_0x2348('0x1')]+=_0x270cf4[_0x2348('0x7')]();_0x210d1b=this[_0x2348('0x1')];if(!this[_0x2348('0x2')]){_0x3cdc9a=0x0;while(_0x2c7b2a[_0x3cdc9a]){while((_0x131a9a=_0x210d1b['indexOf'](_0x2c7b2a[_0x3cdc9a]))!=-0x1){_0x308afb=_0x2c7b2a[_0x3cdc9a];_0x4137cc=_0x210d1b[_0x2348('0x8')](0x0,_0x131a9a);_0x210d1b=_0x210d1b['substring'](_0x131a9a+_0x308afb[_0x2348('0x9')]);var _0x36a47a=_0x4137cc['split'](_0x2d3023),_0x2a4608=0x0,_0x114ce6={},_0x908e72='',_0x209c3e='',_0x5d3d04=-0x1;while(_0x36a47a[_0x2a4608]){_0x5d3d04=_0x36a47a[_0x2a4608]['indexOf'](':');if(_0x5d3d04!=-0x1){_0x908e72=_0x36a47a[_0x2a4608][_0x2348('0xa')](0x0,_0x5d3d04)[_0x2348('0xb')]();_0x209c3e=_0x36a47a[_0x2a4608][_0x2348('0xa')](_0x5d3d04+0x1)[_0x2348('0xb')]();if(_0x908e72[_0x2348('0x9')]>0x0){_0x114ce6[_0x908e72]=_0x209c3e;}}else{}_0x2a4608++;}this[_0x2348('0xc')](_0x2348('0xd'),_0x114ce6);this[_0x2348('0x2')]=!![];}_0x3cdc9a++;}this[_0x2348('0x1')]=_0x210d1b;}else{while((_0x316bd6=_0x210d1b[_0x2348('0xe')](_0x2d3023))!=-0x1){_0x4137cc=_0x210d1b[_0x2348('0x8')](0x0,_0x316bd6);this['emit'](_0x2348('0xf'),_0x4137cc);_0x210d1b=_0x210d1b[_0x2348('0x8')](_0x316bd6+_0x2d3023[_0x2348('0x9')]);}this[_0x2348('0x1')]=_0x210d1b;}_0x41aefc();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 02c1555..e4560c9 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 _0x0834=['CreateSquareReport','merge','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','createSmsMessage','createSquareDetailsReport'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x0834,0x18e));var _0x4083=function(_0x53dccc,_0xad9fb1){_0x53dccc=_0x53dccc-0x0;var _0x17241e=_0x0834[_0x53dccc];return _0x17241e;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x4083('0x0'));var client=jayson[_0x4083('0x1')]['http']({'port':0x2329});function request(_0x491147,_0x5e1812){return new Promise(function(_0x14d004,_0x14b7c6){return client['request'](_0x491147,_0x5e1812)[_0x4083('0x2')](function(_0x32ea06){if(_0x32ea06['error']){return _0x14b7c6(_0x32ea06[_0x4083('0x3')]['message']);}else{return _0x14d004(_0x32ea06[_0x4083('0x4')]);}})[_0x4083('0x5')](function(_0x2c42bb){return _0x14b7c6(_0x2c42bb);});});}exports[_0x4083('0x6')]=function(){return request(_0x4083('0x7'),{'options':{'raw':![],'attributes':['id',_0x4083('0x8'),_0x4083('0x9')]}});};exports[_0x4083('0xa')]=function(_0x2a5093){return request(_0x4083('0xb'),{'options':{'raw':![],'where':{'name':_0x2a5093},'attributes':[_0x4083('0x9')]}});};exports[_0x4083('0xc')]=function(_0x1da687){return request(_0x4083('0xd'),{'options':{'raw':![],'where':{'id':_0x1da687},'include':[{'model':_0x4083('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','as':_0x4083('0xf')}]}],'attributes':['id',_0x4083('0x8'),'email'],'smtp':!![]}});};exports[_0x4083('0x10')]=function(_0x136077){return request(_0x4083('0xb'),{'options':{'where':{'id':_0x136077},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xb5badb){return request(_0x4083('0x11'),{'options':{'where':{'id':_0xb5badb},'attributes':['name']}});};exports[_0x4083('0x12')]=function(_0x316e54){return request(_0x4083('0x13'),{'options':{'where':{'id':_0x316e54},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x14')]=function(_0x4d59c7){return request(_0x4083('0x15'),{'options':{'where':{'id':_0x4d59c7},'attributes':[_0x4083('0x16')]}});};exports[_0x4083('0x17')]=function(_0x2658b0){return request('ShowUser',{'options':{'where':{'id':_0x2658b0},'attributes':['name']}});};exports['getContactByPhone']=function(_0xafda0c){return request(_0x4083('0x18'),{'options':{'where':{'phone':_0xafda0c['phone']},'attributes':['id']}});};exports[_0x4083('0x19')]=function(_0x4a16dc){return request(_0x4083('0x1a'),{'options':{'where':{'id':_0x4a16dc},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x1b')]=function(_0xa18842){return request('ShowSound',{'options':{'where':{'id':_0xa18842},'attributes':[_0x4083('0x1c')]}});};exports['getIntervalById']=function(_0x3d8045){return request(_0x4083('0x1d'),{'options':{'raw':![],'where':{'id':_0x3d8045},'include':[{'model':_0x4083('0x1e'),'as':_0x4083('0x1f')}]}});};exports['getSmsAccountById']=function(_0x328efe){return request('ShowSmsAccount',{'options':{'where':{'id':_0x328efe},'attributes':['id',_0x4083('0x8')]}});};exports[_0x4083('0x20')]=function(_0x577a80){return request('CreateSmsMessage',{'body':_0x577a80});};exports[_0x4083('0x21')]=function(_0x5b1f8a){return request('CreateSquareDetailsReport',{'body':_0x5b1f8a});};exports['createSquareReport']=function(_0x14e274){return request(_0x4083('0x22'),{'body':_[_0x4083('0x23')](_0x14e274,{'project_name':_0x14e274['arg_1'],'prev_project_name':_0x14e274[_0x4083('0x24')]||'','is_subproject':_0x14e274[_0x4083('0x24')]?!![]:![],'leaveAt':moment()[_0x4083('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4083('0x26')]=function(_0x323736){return request('CreateSquareRecording',{'body':_0x323736});};exports[_0x4083('0x27')]=function(_0x467c01){return request(_0x4083('0x28'),{'body':_0x467c01});};exports[_0x4083('0x29')]=function(_0xdf4d9e){return request(_0x4083('0x2a'),{'options':{'raw':![],'where':{'phone':_0xdf4d9e[_0x4083('0x2b')],'ListId':_0xdf4d9e[_0x4083('0x2c')]}}})[_0x4083('0x2')](function(_0x5dc9c6){if(_0x5dc9c6){return _0x5dc9c6;}return request('CreateCmContact',{'body':_0xdf4d9e});});};exports[_0x4083('0x2d')]=function(_0x189e4d){return request(_0x4083('0x2e'),{'options':{'where':{'id':_0x189e4d},'attributes':[_0x4083('0x8')]}});};exports[_0x4083('0x2f')]=function(_0x191f79,_0x55832a){return request(_0x4083('0x30'),{'body':{'interface':_0x55832a},'options':{'where':_0x191f79}});};exports[_0x4083('0x31')]=function(_0x2a1eda,_0x414ac9,_0x16fa65){return request(_0x4083('0x32'),{'body':{'type':_0x414ac9,'uniqueid':_0x16fa65},'options':{'where':_0x2a1eda}});};exports['agentUnpause']=function(_0x36feac){return request(_0x4083('0x33'),{'body':{},'options':{'where':_0x36feac}});};exports[_0x4083('0x34')]=function(_0x452bae){return request(_0x4083('0x35'),{'body':{},'options':{'where':_0x452bae}});}; \ No newline at end of file +var _0xbec5=['LogoutUser','lodash','moment','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','getTrunkById','ShowTrunk','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentLogout'];(function(_0x5a3f3a,_0x3ae10e){var _0x5a6216=function(_0x1303cd){while(--_0x1303cd){_0x5a3f3a['push'](_0x5a3f3a['shift']());}};_0x5a6216(++_0x3ae10e);}(_0xbec5,0xe5));var _0x5bec=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xbec5[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x5bec('0x0'));var moment=require(_0x5bec('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x5bec('0x2')][_0x5bec('0x3')]({'port':0x2329});function request(_0x276b9e,_0x3859a1){return new Promise(function(_0x244027,_0x4ee982){return client[_0x5bec('0x4')](_0x276b9e,_0x3859a1)[_0x5bec('0x5')](function(_0x3a963f){if(_0x3a963f['error']){return _0x4ee982(_0x3a963f[_0x5bec('0x6')][_0x5bec('0x7')]);}else{return _0x244027(_0x3a963f[_0x5bec('0x8')]);}})[_0x5bec('0x9')](function(_0x43d96e){return _0x4ee982(_0x43d96e);});});}exports[_0x5bec('0xa')]=function(){return request(_0x5bec('0xb'),{'options':{'raw':![],'attributes':['id',_0x5bec('0xc'),'production']}});};exports[_0x5bec('0xd')]=function(_0x5c2d67){return request(_0x5bec('0xe'),{'options':{'raw':![],'where':{'name':_0x5c2d67},'attributes':[_0x5bec('0xf')]}});};exports[_0x5bec('0x10')]=function(_0x4a5482){return request(_0x5bec('0x11'),{'options':{'raw':![],'where':{'id':_0x4a5482},'include':[{'model':_0x5bec('0x12'),'as':_0x5bec('0x13'),'include':[{'model':'CloudProvider','as':_0x5bec('0x14')}]}],'attributes':['id',_0x5bec('0xc'),'email'],'smtp':!![]}});};exports[_0x5bec('0x15')]=function(_0xaa984d){return request(_0x5bec('0xe'),{'options':{'where':{'id':_0xaa984d},'attributes':[_0x5bec('0xc')]}});};exports[_0x5bec('0x16')]=function(_0xcd6d90){return request(_0x5bec('0x17'),{'options':{'where':{'id':_0xcd6d90},'attributes':[_0x5bec('0xc')]}});};exports[_0x5bec('0x18')]=function(_0x3ebc41){return request(_0x5bec('0x19'),{'options':{'where':{'id':_0x3ebc41},'attributes':[_0x5bec('0xc')]}});};exports[_0x5bec('0x1a')]=function(_0x506639){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x506639},'attributes':[_0x5bec('0x1b')]}});};exports[_0x5bec('0x1c')]=function(_0x31ad9c){return request(_0x5bec('0x1d'),{'options':{'where':{'id':_0x31ad9c},'attributes':['name']}});};exports['getContactByPhone']=function(_0x3cd354){return request(_0x5bec('0x1e'),{'options':{'where':{'phone':_0x3cd354['phone']},'attributes':['id']}});};exports[_0x5bec('0x1f')]=function(_0xa7e223){return request(_0x5bec('0x20'),{'options':{'where':{'id':_0xa7e223},'attributes':[_0x5bec('0xc')]}});};exports['getSoundById']=function(_0xab397b){return request('ShowSound',{'options':{'where':{'id':_0xab397b},'attributes':[_0x5bec('0x21')]}});};exports[_0x5bec('0x22')]=function(_0x3e1896){return request(_0x5bec('0x23'),{'options':{'raw':![],'where':{'id':_0x3e1896},'include':[{'model':_0x5bec('0x24'),'as':'Intervals'}]}});};exports[_0x5bec('0x25')]=function(_0x4cfcb8){return request(_0x5bec('0x26'),{'options':{'where':{'id':_0x4cfcb8},'attributes':['id',_0x5bec('0xc')]}});};exports['createSmsMessage']=function(_0xa414f8){return request(_0x5bec('0x27'),{'body':_0xa414f8});};exports['createSquareDetailsReport']=function(_0x45afb7){return request(_0x5bec('0x28'),{'body':_0x45afb7});};exports[_0x5bec('0x29')]=function(_0x20da89){return request(_0x5bec('0x2a'),{'body':_[_0x5bec('0x2b')](_0x20da89,{'project_name':_0x20da89[_0x5bec('0x2c')],'prev_project_name':_0x20da89['arg_2']||'','is_subproject':_0x20da89['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x5bec('0x2d'))})});};exports[_0x5bec('0x2e')]=function(_0x338c25){return request('CreateSquareRecording',{'body':_0x338c25});};exports[_0x5bec('0x2f')]=function(_0x472e54){return request('CreateSquareMessage',{'body':_0x472e54});};exports[_0x5bec('0x30')]=function(_0x63ac8){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x63ac8['phone'],'ListId':_0x63ac8[_0x5bec('0x31')]}}})[_0x5bec('0x5')](function(_0x3039f0){if(_0x3039f0){return _0x3039f0;}return request(_0x5bec('0x32'),{'body':_0x63ac8});});};exports[_0x5bec('0x33')]=function(_0x3f224c){return request('ShowPause',{'options':{'where':{'id':_0x3f224c},'attributes':[_0x5bec('0xc')]}});};exports['agentLogin']=function(_0x45863b,_0xafbd94){return request(_0x5bec('0x34'),{'body':{'interface':_0xafbd94},'options':{'where':_0x45863b}});};exports[_0x5bec('0x35')]=function(_0x5128c0,_0x2b42c8,_0x1aba46){return request(_0x5bec('0x36'),{'body':{'type':_0x2b42c8,'uniqueid':_0x1aba46},'options':{'where':_0x5128c0}});};exports['agentUnpause']=function(_0xf6ae6b){return request('UnpauseUser',{'body':{},'options':{'where':_0xf6ae6b}});};exports[_0x5bec('0x37')]=function(_0x207192){return request(_0x5bec('0x38'),{'body':{},'options':{'where':_0x207192}});}; \ 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 676855e..468d34f 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 _0xe574=['./polly','exports'];(function(_0x5288e2,_0x65ca08){var _0x9088d9=function(_0x1ab7ab){while(--_0x1ab7ab){_0x5288e2['push'](_0x5288e2['shift']());}};_0x9088d9(++_0x65ca08);}(_0xe574,0x100));var _0x4e57=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe574[_0x42cae2];return _0x5f256f;};var polly=require(_0x4e57('0x0'));var lex=require('./lex');module[_0x4e57('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb89c=['./polly','./lex','exports'];(function(_0x517580,_0x449c42){var _0x1413dc=function(_0x317aa7){while(--_0x317aa7){_0x517580['push'](_0x517580['shift']());}};_0x1413dc(++_0x449c42);}(_0xb89c,0x198));var _0xcb89=function(_0x267db5,_0x86eff){_0x267db5=_0x267db5-0x0;var _0xee8ec4=_0xb89c[_0x267db5];return _0xee8ec4;};var polly=require(_0xcb89('0x0'));var lex=require(_0xcb89('0x1'));module[_0xcb89('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 119be18..2947507 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['./lib/api','exports'];(function(_0x548c1d,_0x4e2101){var _0x52d761=function(_0xd7d080){while(--_0xd7d080){_0x548c1d['push'](_0x548c1d['shift']());}};_0x52d761(++_0x4e2101);}(_0x5c00,0x17e));var _0x05c0=function(_0x2a87fc,_0x30a039){_0x2a87fc=_0x2a87fc-0x0;var _0x32d9f5=_0x5c00[_0x2a87fc];return _0x32d9f5;};'use strict';var lex=require(_0x05c0('0x0'));module[_0x05c0('0x1')]=function(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9){return lex(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9);}; \ No newline at end of file +var _0xb4e6=['./lib/api'];(function(_0x9682c,_0x21f496){var _0x124f9d=function(_0x3b2e2f){while(--_0x3b2e2f){_0x9682c['push'](_0x9682c['shift']());}};_0x124f9d(++_0x21f496);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xb4e6[_0x4bfade];return _0x272465;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 31582a0..6691014 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(_0x44f719,_0x273c9e){var _0x324299=function(_0x281e5c){while(--_0x281e5c){_0x44f719['push'](_0x44f719['shift']());}};_0x324299(++_0x273c9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x229b2a,_0xdfa5a9){var _0x347304=function(_0x531b39){while(--_0x531b39){_0x229b2a['push'](_0x229b2a['shift']());}};_0x347304(++_0xdfa5a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 830f99d..1891172 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 _0x25cf=['exports'];(function(_0x425e60,_0x14e7b6){var _0x356e1a=function(_0x37650c){while(--_0x37650c){_0x425e60['push'](_0x425e60['shift']());}};_0x356e1a(++_0x14e7b6);}(_0x25cf,0x148));var _0xf25c=function(_0x72bc68,_0x394332){_0x72bc68=_0x72bc68-0x0;var _0x1b61d7=_0x25cf[_0x72bc68];return _0x1b61d7;};'use strict';var polly=require('./lib/api');module[_0xf25c('0x0')]=function(_0x9a0663,_0x1addcd,_0x331fa7,_0x1acd26,_0x573e57,_0x3905ad,_0x545eb8){return polly(_0x9a0663,_0x1addcd,_0x331fa7,_0x1acd26,_0x573e57,_0x3905ad,_0x545eb8);}; \ No newline at end of file +var _0xe3ee=['exports','./lib/api'];(function(_0x1f7980,_0x17d664){var _0x4678d7=function(_0x478d31){while(--_0x478d31){_0x1f7980['push'](_0x1f7980['shift']());}};_0x4678d7(++_0x17d664);}(_0xe3ee,0x11b));var _0xee3e=function(_0x2885b0,_0x274e33){_0x2885b0=_0x2885b0-0x0;var _0x424f73=_0xe3ee[_0x2885b0];return _0x424f73;};'use strict';var polly=require(_0xee3e('0x0'));module[_0xee3e('0x1')]=function(_0x4bb164,_0x4c805c,_0x5c0977,_0x3e641a,_0x336b,_0x10c9c8,_0x41230b){return polly(_0x4bb164,_0x4c805c,_0x5c0977,_0x3e641a,_0x336b,_0x10c9c8,_0x41230b);}; \ 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 4679393..52a7d56 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 _0x71f9=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x71f9,0x6e));var _0x971f=function(_0x576ad5,_0x10ac33){_0x576ad5=_0x576ad5-0x0;var _0x52d4c5=_0x71f9[_0x576ad5];return _0x52d4c5;};'use strict';var fs=require('fs');var path=require(_0x971f('0x0'));var BPromise=require(_0x971f('0x1'));var rs=require(_0x971f('0x2'));var AWS=require(_0x971f('0x3'));function pollyResult(_0x56ebdb,_0x1ca39d,_0x319103){return new BPromise(function(_0x149255,_0x9dd8ef){_0x56ebdb[_0x971f('0x4')](_0x1ca39d,function(_0x485617,_0x321f41){if(_0x485617){_0x9dd8ef(_0x485617);}else if(_0x321f41){if(_0x321f41['AudioStream']instanceof Buffer){fs[_0x971f('0x5')](_0x319103,_0x321f41['AudioStream'],function(_0x36c65f){if(_0x36c65f){_0x9dd8ef(_0x36c65f);}else{_0x149255();}});}else{_0x9dd8ef(new Error(_0x971f('0x6')));}}else{_0x9dd8ef(new Error(_0x971f('0x7')));}});});}module[_0x971f('0x8')]=function(_0xa64009,_0x116711,_0x1079c5,_0x39018d,_0x386916,_0x217806,_0x43ca91){var _0x20e5c2=new AWS[(_0x971f('0x9'))]({'accessKeyId':_0xa64009,'secretAccessKey':_0x116711,'region':_0x1079c5});var _0x2054dc={'Text':_0x386916,'TextType':_0x217806||_0x971f('0xa'),'OutputFormat':_0x971f('0xb'),'VoiceId':_0x39018d};return pollyResult(_0x20e5c2,_0x2054dc,_0x43ca91);}; \ No newline at end of file +var _0x36de=['mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x5d9544,_0x105068){var _0x4dd401=function(_0xadbf07){while(--_0xadbf07){_0x5d9544['push'](_0x5d9544['shift']());}};_0x4dd401(++_0x105068);}(_0x36de,0x181));var _0xe36d=function(_0x5c5e8a,_0x4d0b1e){_0x5c5e8a=_0x5c5e8a-0x0;var _0x2bfeb2=_0x36de[_0x5c5e8a];return _0x2bfeb2;};'use strict';var fs=require('fs');var path=require(_0xe36d('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36d('0x1'));var AWS=require(_0xe36d('0x2'));function pollyResult(_0x28cf8e,_0x4853d1,_0x50f182){return new BPromise(function(_0xfbb508,_0x50a7e0){_0x28cf8e[_0xe36d('0x3')](_0x4853d1,function(_0x230048,_0x5a8a97){if(_0x230048){_0x50a7e0(_0x230048);}else if(_0x5a8a97){if(_0x5a8a97[_0xe36d('0x4')]instanceof Buffer){fs[_0xe36d('0x5')](_0x50f182,_0x5a8a97['AudioStream'],function(_0x3ec82d){if(_0x3ec82d){_0x50a7e0(_0x3ec82d);}else{_0xfbb508();}});}else{_0x50a7e0(new Error(_0xe36d('0x6')));}}else{_0x50a7e0(new Error(_0xe36d('0x7')));}});});}module[_0xe36d('0x8')]=function(_0x30f899,_0xb1f3f0,_0x35c379,_0x5b3e75,_0x13f60c,_0x3cfa10,_0x337d71){var _0x1f3778=new AWS[(_0xe36d('0x9'))]({'accessKeyId':_0x30f899,'secretAccessKey':_0xb1f3f0,'region':_0x35c379});var _0x5898db={'Text':_0x13f60c,'TextType':_0x3cfa10||_0xe36d('0xa'),'OutputFormat':_0xe36d('0xb'),'VoiceId':_0x5b3e75};return pollyResult(_0x1f3778,_0x5898db,_0x337d71);}; \ 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 17797bb..c02b40c 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x216635,_0x42e4ea,_0x40d112,_0x3a20c0){return asr(_0x216635,_0x42e4ea,_0x40d112);}; \ No newline at end of file +var _0x85a8=['exports'];(function(_0x41ede1,_0x42e44e){var _0x1b2e7c=function(_0x82ae80){while(--_0x82ae80){_0x41ede1['push'](_0x41ede1['shift']());}};_0x1b2e7c(++_0x42e44e);}(_0x85a8,0x101));var _0x885a=function(_0x5cb333,_0x43da2c){_0x5cb333=_0x5cb333-0x0;var _0x54e703=_0x85a8[_0x5cb333];return _0x54e703;};'use strict';var asr=require('./lib/api');module[_0x885a('0x0')]=function(_0x53f864,_0x4942db,_0x387eb2,_0xa35551){return asr(_0x53f864,_0x4942db,_0x387eb2);}; \ 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 6e0ca36..4b0da80 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 _0x644a=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0xaca276,_0x6f6f35){var _0x54a633=function(_0x2b0772){while(--_0x2b0772){_0xaca276['push'](_0xaca276['shift']());}};_0x54a633(++_0x6f6f35);}(_0x644a,0xfd));var _0xa644=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0x644a[_0x4ec42];return _0x385e11;};'use strict';var url=require(_0xa644('0x0'));var BPromise=require(_0xa644('0x1'));var fs=require('fs');var host=_0xa644('0x2');module[_0xa644('0x3')]=function(_0x3a3218,_0x48801b,_0x1423b7){return new BPromise(function(_0x704008,_0x526de6){var _0x4f6ed9;if(typeof _0x3a3218!==_0xa644('0x4')||_0x3a3218[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x6'));}if(typeof _0x48801b!=='string'||_0x48801b[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x7'));}if(typeof _0x1423b7!=='undefined'&&(typeof _0x1423b7!==_0xa644('0x4')||_0x1423b7[_0xa644('0x5')]===0x0)){return _0x526de6('lang\x20should\x20be\x20a\x20string');}try{_0x4f6ed9=fs['readFileSync'](_0x3a3218)[_0xa644('0x8')](_0xa644('0x9'));}catch(_0x55415d){return _0x526de6(_0x55415d);}return _0x704008({'method':_0xa644('0xa'),'uri':host+_0xa644('0xb')+_0x48801b,'body':{'config':{'encoding':_0xa644('0xc'),'sampleRateHertz':_0xa644('0xd'),'languageCode':_0x1423b7},'audio':{'content':_0x4f6ed9}},'json':!![]});});}; \ No newline at end of file +var _0x3f19=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','length','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x3589a0,_0x2808c6){var _0xd0e739=function(_0x4ee13f){while(--_0x4ee13f){_0x3589a0['push'](_0x3589a0['shift']());}};_0xd0e739(++_0x2808c6);}(_0x3f19,0xc0));var _0x93f1=function(_0x157298,_0x2f1dd2){_0x157298=_0x157298-0x0;var _0x43368c=_0x3f19[_0x157298];return _0x43368c;};'use strict';var url=require(_0x93f1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x33bddc,_0x4d1cac,_0x452cf9){return new BPromise(function(_0x9a0ee0,_0x3bd3fa){var _0x2057aa;if(typeof _0x33bddc!=='string'||_0x33bddc[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x2'));}if(typeof _0x4d1cac!==_0x93f1('0x3')||_0x4d1cac[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x4'));}if(typeof _0x452cf9!==_0x93f1('0x5')&&(typeof _0x452cf9!=='string'||_0x452cf9[_0x93f1('0x1')]===0x0)){return _0x3bd3fa(_0x93f1('0x6'));}try{_0x2057aa=fs[_0x93f1('0x7')](_0x33bddc)[_0x93f1('0x8')](_0x93f1('0x9'));}catch(_0x558623){return _0x3bd3fa(_0x558623);}return _0x9a0ee0({'method':_0x93f1('0xa'),'uri':host+_0x93f1('0xb')+_0x4d1cac,'body':{'config':{'encoding':_0x93f1('0xc'),'sampleRateHertz':_0x93f1('0xd'),'languageCode':_0x452cf9},'audio':{'content':_0x2057aa}},'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 bced0f9..a42dd57 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 _0xbe8c=['exports','./asr'];(function(_0x25b1f8,_0x5a41af){var _0x2e8005=function(_0x1e2836){while(--_0x1e2836){_0x25b1f8['push'](_0x25b1f8['shift']());}};_0x2e8005(++_0x5a41af);}(_0xbe8c,0xeb));var _0xcbe8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe8c[_0xfae23b];return _0x200640;};var asr=require(_0xcbe8('0x0'));module[_0xcbe8('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb4f5=['./asr','exports'];(function(_0x2fdba5,_0x5f1529){var _0x132f69=function(_0x11f604){while(--_0x11f604){_0x2fdba5['push'](_0x2fdba5['shift']());}};_0x132f69(++_0x5f1529);}(_0xb4f5,0x11e));var _0x5b4f=function(_0x405aeb,_0x5ee732){_0x405aeb=_0x405aeb-0x0;var _0x50e76a=_0xb4f5[_0x405aeb];return _0x50e76a;};var asr=require(_0x5b4f('0x0'));module[_0x5b4f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 6e2b065..7b0c08c 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 _0x2d0b=['awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','error','download\x20error','pipe','end','host','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','tmp','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','unlink','info','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d0b,0x115));var _0xb2d0=function(_0x2e5482,_0x2055df){_0x2e5482=_0x2e5482-0x0;var _0x300046=_0x2d0b[_0x2e5482];return _0x300046;};'use strict';var apiai=require(_0xb2d0('0x0'));var BPromise=require(_0xb2d0('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0xb2d0('0x2'));var md5=require(_0xb2d0('0x3'));var path=require(_0xb2d0('0x4'));var querystring=require(_0xb2d0('0x5'));var rp=require(_0xb2d0('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xb2d0('0x7'));var urlParse=require(_0xb2d0('0x8'))[_0xb2d0('0x9')];var util=require(_0xb2d0('0xa'));var aws=require(_0xb2d0('0xb'));var google=require(_0xb2d0('0xc'));var sestek=require(_0xb2d0('0xd'));var tilde=require('./tilde');var logger=require(_0xb2d0('0xe'))('agi');var ISPEECH_API=_0xb2d0('0xf');function downloadFile(_0x53e57f,_0x4459cf){return new BPromise(function(_0x48eefa,_0x25228a){var _0xc7a00c=urlParse(_0x53e57f);var _0x479c78=_0xc7a00c['protocol']==='https:'?https:http;var _0x3e8031={'host':_0xc7a00c['host'],'path':_0xc7a00c[_0xb2d0('0x4')],'headers':{'user-agent':_0xb2d0('0x10')}};_0x479c78[_0xb2d0('0x11')](_0x3e8031,function(_0x7412ef){if(_0x7412ef['statusCode']!==0xc8){logger['error'](_0xb2d0('0x12')+_0x53e57f+_0xb2d0('0x13')+_0x7412ef[_0xb2d0('0x14')]+'\x20('+_0x7412ef['statusMessage']+')');_0x25228a(new Error('request\x20to\x20'+_0x53e57f+_0xb2d0('0x13')+_0x7412ef[_0xb2d0('0x14')]+'\x20('+_0x7412ef[_0xb2d0('0x15')]+')'));return;}var _0xd9f331=fs[_0xb2d0('0x16')](_0x4459cf);_0xd9f331['on']('finish',function(){logger['info']('finish\x20download\x20file');_0xd9f331[_0xb2d0('0x17')](_0x48eefa);});_0xd9f331['on'](_0xb2d0('0x18'),function(_0x1df459){fs['unlink'](_0x4459cf);logger[_0xb2d0('0x18')](_0xb2d0('0x19'),_0x1df459);_0x25228a(_0x1df459);});_0x7412ef[_0xb2d0('0x1a')](_0xd9f331);})['on'](_0xb2d0('0x18'),function(_0x1d97a3){logger[_0xb2d0('0x18')](_0x1d97a3);_0x25228a(_0x1d97a3);})[_0xb2d0('0x1b')]();});}function uploadFile(_0x3572aa){return new BPromise(function(_0x32cfe9,_0x2616af){var _0x2a464d=urlParse(_0x3572aa);var _0x45e0d4=_0x2a464d['protocol']==='https:'?https:http;var _0x521f19={'host':_0x2a464d[_0xb2d0('0x1c')],'path':_0x2a464d[_0xb2d0('0x4')],'headers':{'user-agent':_0xb2d0('0x10')}};_0x45e0d4[_0xb2d0('0x11')](_0x521f19,function(_0x4bd8bf){if(_0x4bd8bf[_0xb2d0('0x14')]!==0xc8){_0x2616af(new Error(_0xb2d0('0x12')+_0x3572aa+_0xb2d0('0x13')+_0x4bd8bf[_0xb2d0('0x14')]+'\x20('+_0x4bd8bf[_0xb2d0('0x15')]+')'));return;}var _0x3806d6='';_0x4bd8bf['on']('data',function(_0x160584){_0x3806d6+=_0x160584;});_0x4bd8bf['on'](_0xb2d0('0x1b'),function(){_0x32cfe9(_0x3806d6);});})['on']('error',function(_0x5d5add){_0x2616af(_0x5d5add);})[_0xb2d0('0x1b')]();});}function convertFile(_0x11c09a,_0x408cdb){return new BPromise(function(_0x572c08,_0x2f2a61){var _0x542b84=sox['transcode'](_0x11c09a,_0x408cdb,{'sampleRate':0x1f40,'format':_0xb2d0('0x1d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x542b84['on'](_0xb2d0('0x18'),function(_0x299743){logger['error'](_0xb2d0('0x1e'),_0x299743);_0x2f2a61(_0x299743);});_0x542b84['on']('end',function(){logger['info'](_0xb2d0('0x1f'));_0x572c08();});_0x542b84[_0xb2d0('0x20')]();});}function base64Decode(_0x383ed7,_0x4d33c5){var _0x4a2135=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));fs[_0xb2d0('0x24')](_0x4a2135,_0x383ed7,_0xb2d0('0x25'));return convertFile(_0x4a2135,_0x4d33c5)[_0xb2d0('0x26')](function(){try{fs['unlink'](_0x4a2135);fs[_0xb2d0('0x27')](_0x4d33c5,_0xb2d0('0x28'));}catch(_0x135548){logger[_0xb2d0('0x18')](_0x135548);}return _0x4d33c5[_0xb2d0('0x29')]('.')[0x0];});}function base64Encode(_0x39ac11){var _0x279416=fs['readFileSync'](_0x39ac11);return new Buffer(_0x279416)[_0xb2d0('0x2a')]('base64');}exports[_0xb2d0('0x2b')]=function(_0x54752e,_0x545b99,_0x5eeb3d,_0x53528e,_0x4896ed,_0x5efdf4){var _0x131fe5,_0x20f876;var _0x3007bc='https://texttospeech.googleapis.com/v1/';var _0x1cecc0=_0xb2d0('0x2c')+_0x54752e;var _0x23c1e7={};if(_0x545b99===_0xb2d0('0x2d')){_0x23c1e7[_0xb2d0('0x2e')]={'ssml':_0x5eeb3d};}else{_0x23c1e7[_0xb2d0('0x2e')]={'text':_0x5eeb3d};};_0x23c1e7['voice']={'languageCode':_0x53528e,'ssmlGender':_0x4896ed};_0x23c1e7[_0xb2d0('0x2f')]={'audioEncoding':_0xb2d0('0x30'),'sampleRateHertz':0x1f40};var _0x2f3a2a={'url':_0x3007bc+_0xb2d0('0x31')+_0x1cecc0,'method':_0xb2d0('0x32'),'json':!![],'body':_0x23c1e7};return rp(_0x2f3a2a)[_0xb2d0('0x26')](function(_0x2f2c01){return new BPromise(function(_0x429fdc,_0x446f79){_0x131fe5=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x33'));var _0x583abe=Buffer[_0xb2d0('0x34')](_0x2f2c01['audioContent'],'base64');return fs['writeFile'](_0x131fe5,_0x583abe,function(_0x275b88){_0x446f79(_0x275b88);},function(_0x398616){fs['chmodSync'](_0x131fe5,_0xb2d0('0x28'));_0x429fdc(_0x398616);});});})[_0xb2d0('0x26')](function(_0x6cc86e){_0x20f876=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs['generate'](0x4)+'.wav');return convertFile(_0x131fe5,_0x20f876);})[_0xb2d0('0x26')](function(){try{fs['unlink'](_0x131fe5);fs['chmodSync'](_0x20f876,_0xb2d0('0x28'));}catch(_0x43157a){logger['error'](_0x43157a);}logger['info']('googleCloudTTS\x20path',_0x20f876[_0xb2d0('0x29')]('.')[0x0]);return _0x20f876[_0xb2d0('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x2292cf,_0x345c06){var _0x4e6026=_0xb2d0('0x36');var _0x446bfb,_0xe4fd1f;var _0x341ceb;var _0x52df23={'encoding':_0xb2d0('0x37'),'method':_0xb2d0('0x32'),'timeout':0x2710,'url':_0x4e6026,'headers':{'Content-Type':_0xb2d0('0x38')},'body':_0xb2d0('0x39')+encodeURIComponent(JSON[_0xb2d0('0x3a')]([[[_0xb2d0('0x3b'),JSON[_0xb2d0('0x3a')]([_0x2292cf,_0x345c06||'en',![],_0xb2d0('0x3c')]),null,_0xb2d0('0x3d')]]]))};return rp(_0x52df23)[_0xb2d0('0x26')](function(_0x32723a){try{_0x341ceb=eval(_0x32723a[_0xb2d0('0x3e')](0x5))[0x0][0x2];}catch(_0x41b342){throw new Error(_0xb2d0('0x3f')+_0x32723a[_0xb2d0('0x40')]);}if(!_0x341ceb){if(_0x2292cf['length']>0xc8){throw new Error(_0xb2d0('0x41'));}else{throw new Error('lang\x20\x22'+_0x345c06+_0xb2d0('0x42'));}}try{_0x341ceb=eval(_0x341ceb)[0x0];}catch(_0x1eda12){throw new Error(_0xb2d0('0x3f')+res['data']);}const _0x3d1eb4=_0x341ceb;_0x446bfb=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+'.mp3');fs[_0xb2d0('0x24')](_0x446bfb,_0x341ceb,{'encoding':'base64'});_0xe4fd1f=path['resolve'](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));return convertFile(_0x446bfb,_0xe4fd1f);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0x446bfb);fs['chmodSync'](_0xe4fd1f,_0xb2d0('0x28'));}catch(_0x602a1f){logger[_0xb2d0('0x18')](_0x602a1f);}logger[_0xb2d0('0x44')](_0xb2d0('0x45'),_0xe4fd1f['split']('.')[0x0]);return _0xe4fd1f['split']('.')[0x0];});};exports[_0xb2d0('0x46')]=function(_0x4d5df9,_0x17b922,_0x182e01){return google[_0xb2d0('0x47')](_0x4d5df9,_0x17b922,_0x182e01)[_0xb2d0('0x26')](function(_0x3ccd30){logger[_0xb2d0('0x44')](_0x3ccd30['uri']);return rp(_0x3ccd30);})['then'](function(_0x3bd363){var _0x176ef6='';var _0x21d643=0x0;try{fs[_0xb2d0('0x43')](_0x4d5df9);}catch(_0x112a75){logger[_0xb2d0('0x18')](_0x112a75);}if(_0x3bd363&&_0x3bd363['results']){_0x176ef6=_0x3bd363[_0xb2d0('0x48')]['map'](function(_0x84d863){return _0x84d863&&_0x84d863[_0xb2d0('0x49')][0x0]&&_0x84d863[_0xb2d0('0x49')][0x0][_0xb2d0('0x4a')]?_0x84d863[_0xb2d0('0x49')][0x0][_0xb2d0('0x4a')]:'';})[_0xb2d0('0x4b')]('\x0a');_0x21d643=_0x3bd363[_0xb2d0('0x48')][_0xb2d0('0x4c')](function(_0x31d839){return _0x31d839&&_0x31d839[_0xb2d0('0x49')][0x0]&&_0x31d839[_0xb2d0('0x49')][0x0][_0xb2d0('0x4d')]?_0x31d839[_0xb2d0('0x49')][0x0][_0xb2d0('0x4d')]:0x0;})[_0xb2d0('0x4b')]('\x0a');}logger[_0xb2d0('0x44')](_0xb2d0('0x4e'),_0x176ef6);logger[_0xb2d0('0x44')]('googleASR\x20confidence',_0x21d643);return{'transcript':_0x176ef6,'confidence':_0x21d643};})[_0xb2d0('0x4f')](function(_0x4a355e){logger['error'](_0xb2d0('0x50'),_0x4a355e['statusCode'],_0x4a355e[_0xb2d0('0x51')],_0x4a355e[_0xb2d0('0x52')]);});};exports[_0xb2d0('0x53')]=function(_0x10c87a,_0x4cee3c,_0x27d208,_0xd7e028){var _0x27b8a3=apiai(_0x4cee3c,{'language':_0xd7e028||'en'});return _0x27b8a3[_0xb2d0('0x54')](_0x27d208,{'sessionId':md5(_0x10c87a)})[_0xb2d0('0x26')](function(_0x5eb18f){logger[_0xb2d0('0x44')](JSON[_0xb2d0('0x3a')](_0x5eb18f));return{'source':_0x5eb18f[_0xb2d0('0x55')]['source'],'resolvedQuery':_0x5eb18f['result']['resolvedQuery'],'action':_0x5eb18f[_0xb2d0('0x55')]['action'],'actionIncomplete':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x56')],'speech':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x57')][_0xb2d0('0x58')],'score':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x59')],'statusCode':_0x5eb18f[_0xb2d0('0x5a')]['code'],'endConversation':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x5b')]['endConversation']||![],'isFallbackIntent':_0x5eb18f[_0xb2d0('0x55')][_0xb2d0('0x5b')][_0xb2d0('0x5c')]};});};exports['googleDialogflowV2']=function(_0x5d42f2,_0x243b25,_0x6bf9c7,_0x4b7986,_0x4d6382,_0x51ae24){var _0xf15853=_0x4b7986[_0xb2d0('0x5d')](/\\n/g,'\x0a');var _0x1aa2bd={'credentials':{'private_key':_0xf15853,'client_email':_0x6bf9c7}};var _0x557a27=new dialogflow[(_0xb2d0('0x5e'))](_0x1aa2bd);var _0x2abac1=_0x557a27[_0xb2d0('0x5f')](_0x243b25,md5(_0x5d42f2));var _0x36347f={'session':_0x2abac1,'queryInput':{'text':{'text':_0x4d6382,'languageCode':_0x51ae24}}};return _0x557a27['detectIntent'](_0x36347f)[_0xb2d0('0x26')](function(_0x1ea018){if(_0x1ea018&&_0x1ea018['length']){logger['info'](_0xb2d0('0x60'),JSON[_0xb2d0('0x3a')](_0x1ea018));var _0x356540=_0x1ea018[0x0];if(_0x356540){var _0x58e6a9={'action':_0x356540[_0xb2d0('0x61')]['action'],'allRequiredParamsPresent':_0x356540['queryResult'][_0xb2d0('0x62')],'endConversation':_0x356540['queryResult'][_0xb2d0('0x63')]&&_0x356540[_0xb2d0('0x61')][_0xb2d0('0x63')][_0xb2d0('0x64')]?_0x356540[_0xb2d0('0x61')]['diagnosticInfo']['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x65')],'intentName':_0x356540['queryResult'][_0xb2d0('0x66')][_0xb2d0('0x51')],'intentDisplayName':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x66')][_0xb2d0('0x67')],'isFallbackIntent':_0x356540['queryResult'][_0xb2d0('0x66')][_0xb2d0('0x68')],'languageCode':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x69')],'queryText':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x6a')],'responseId':_0x356540[_0xb2d0('0x6b')],'score':_0x356540[_0xb2d0('0x61')]['intentDetectionConfidence'],'speech':_0x356540[_0xb2d0('0x61')][_0xb2d0('0x65')],'providerResponse':JSON[_0xb2d0('0x3a')](_0x1ea018)};return _0x58e6a9;}}});};exports[_0xb2d0('0x6c')]=function(_0x5c3fbe,_0x3a6799,_0x1273ca,_0x9efe11){return tilde[_0xb2d0('0x47')](_0x5c3fbe,_0x3a6799,_0x1273ca,_0x9efe11)[_0xb2d0('0x26')](function(_0x4ea79c){try{fs[_0xb2d0('0x43')](_0x5c3fbe);}catch(_0x2ae1ea){logger[_0xb2d0('0x18')](_0x2ae1ea);}logger['info']('Tilde\x20ASR\x20transcription',_0x4ea79c[_0xb2d0('0x4a')]);logger[_0xb2d0('0x44')](_0xb2d0('0x6d'),_0x4ea79c[_0xb2d0('0x4d')]);return _0x4ea79c;});};exports[_0xb2d0('0x6e')]=function(_0x58a80a,_0x5e1e97,_0x443f0d,_0xddb124,_0x141822,_0x7c4b28){var _0xaa2ac5=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x33'));var _0x312238;return aws[_0xb2d0('0x6f')](_0x58a80a,_0x5e1e97,_0x443f0d,_0xddb124,_0x141822,_0x7c4b28,_0xaa2ac5)[_0xb2d0('0x26')](function(){_0x312238=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23'));return convertFile(_0xaa2ac5,_0x312238);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0xaa2ac5);fs[_0xb2d0('0x27')](_0x312238,_0xb2d0('0x28'));}catch(_0x553bcd){logger['error'](_0x553bcd);}return _0x312238['split']('.')[0x0];});};exports[_0xb2d0('0x70')]=function(_0x52e03f,_0x52f08a,_0x8b35b7,_0x4f8991,_0x56c53f,_0x59e873){return aws[_0xb2d0('0x71')](_0x52e03f,_0x52f08a,_0x8b35b7,_0x4f8991,_0x56c53f,_0x59e873)[_0xb2d0('0x26')](function(_0x29ef39){logger[_0xb2d0('0x44')](JSON['stringify'](_0x29ef39));return _0x29ef39;});};exports[_0xb2d0('0x72')]=function(_0x42c23a,_0x14ef54,_0x312a78,_0x5a383c){var _0x1fe693=util[_0xb2d0('0x73')](_0xb2d0('0x74'),ISPEECH_API,_0x42c23a,encodeURIComponent(_0x14ef54),_0x312a78,_0x5a383c);var _0x27aa2d=path[_0xb2d0('0x21')](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+'.mp3');var _0x449be4;return downloadFile(_0x1fe693,_0x27aa2d)['then'](function(){_0x449be4=path[_0xb2d0('0x21')](__dirname,_0xb2d0('0x35'),rs[_0xb2d0('0x22')](0x4)+'.wav');return convertFile(_0x27aa2d,_0x449be4);})[_0xb2d0('0x26')](function(){try{fs[_0xb2d0('0x43')](_0x27aa2d);fs[_0xb2d0('0x27')](_0x449be4,_0xb2d0('0x28'));}catch(_0x367f64){logger[_0xb2d0('0x18')](_0x367f64);}return _0x449be4[_0xb2d0('0x29')]('.')[0x0];});};exports[_0xb2d0('0x75')]=function(_0x3dce19,_0x7b18c6,_0x503533,_0x5c57b0){var _0x15a2af=util[_0xb2d0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x7b18c6,_0x503533,base64Encode(_0x3dce19),_0x5c57b0?util[_0xb2d0('0x73')](_0xb2d0('0x76'),encodeURIComponent(_0x5c57b0)):'freeform=3');return uploadFile(_0x15a2af)['then'](function(_0x11f6d4){return querystring[_0xb2d0('0x9')](_0x11f6d4);});};exports[_0xb2d0('0x77')]=function(_0x599b40,_0x17aa82){return sestek[_0xb2d0('0x78')](_0x599b40,_0x17aa82)[_0xb2d0('0x26')](function(_0x379ff5){logger[_0xb2d0('0x44')](JSON['stringify'](_0x379ff5));var _0x1f5cb7={'speech':_0x379ff5[_0xb2d0('0x79')],'action':_0x379ff5[_0xb2d0('0x7a')]?_0x379ff5['channelData'][_0xb2d0('0x7b')]:undefined,'actiondata':_0x379ff5[_0xb2d0('0x7a')]?_0x379ff5[_0xb2d0('0x7a')][_0xb2d0('0x7c')]:undefined};if(_0x379ff5[_0xb2d0('0x7a')]&&_0x379ff5[_0xb2d0('0x7a')][_0xb2d0('0x7d')]){return base64Decode(_0x379ff5['channelData'][_0xb2d0('0x7d')][_0xb2d0('0x7e')],path['resolve'](__dirname,'tmp',rs[_0xb2d0('0x22')](0x4)+_0xb2d0('0x23')))['then'](function(_0x2697ec){_0x1f5cb7[_0xb2d0('0x7f')]=_0x2697ec;return _0x1f5cb7;});}return _0x1f5cb7;});};exports[_0xb2d0('0x80')]=function(){return __dirname;}; \ No newline at end of file +var _0x42b5=['fulfillmentText','displayName','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','unlink','error','download\x20error','pipe','https:','host','WHAT_EVER','data','end','transcode','wav','info','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','writeFile','tmp','777','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','map','transcript','alternatives','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','isFallbackIntent','SessionsClient','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x42b5,0x1a7));var _0x542b=function(_0x39a07e,_0x1a621d){_0x39a07e=_0x39a07e-0x0;var _0x52465f=_0x42b5[_0x39a07e];return _0x52465f;};'use strict';var apiai=require(_0x542b('0x0'));var BPromise=require(_0x542b('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x542b('0x2'));var https=require(_0x542b('0x3'));var md5=require(_0x542b('0x4'));var path=require(_0x542b('0x5'));var querystring=require('querystring');var rp=require(_0x542b('0x6'));var rs=require(_0x542b('0x7'));var sox=require(_0x542b('0x8'));var tts=require(_0x542b('0x9'));var urlParse=require(_0x542b('0xa'))[_0x542b('0xb')];var util=require(_0x542b('0xc'));var aws=require(_0x542b('0xd'));var google=require(_0x542b('0xe'));var sestek=require(_0x542b('0xf'));var tilde=require(_0x542b('0x10'));var logger=require(_0x542b('0x11'))(_0x542b('0x12'));var ISPEECH_API=_0x542b('0x13');function downloadFile(_0xf95f5c,_0x467255){return new BPromise(function(_0x78ff9b,_0x62860d){var _0x12cb02=urlParse(_0xf95f5c);var _0x1aac7f=_0x12cb02[_0x542b('0x14')]==='https:'?https:http;var _0x94ad4e={'host':_0x12cb02['host'],'path':_0x12cb02[_0x542b('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x1aac7f[_0x542b('0x15')](_0x94ad4e,function(_0x4bcc24){if(_0x4bcc24[_0x542b('0x16')]!==0xc8){logger['error'](_0x542b('0x17')+_0xf95f5c+_0x542b('0x18')+_0x4bcc24['statusCode']+'\x20('+_0x4bcc24['statusMessage']+')');_0x62860d(new Error(_0x542b('0x17')+_0xf95f5c+'\x20failed,\x20status\x20code\x20=\x20'+_0x4bcc24[_0x542b('0x16')]+'\x20('+_0x4bcc24[_0x542b('0x19')]+')'));return;}var _0x561218=fs[_0x542b('0x1a')](_0x467255);_0x561218['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x561218['close'](_0x78ff9b);});_0x561218['on']('error',function(_0x35c114){fs[_0x542b('0x1b')](_0x467255);logger[_0x542b('0x1c')](_0x542b('0x1d'),_0x35c114);_0x62860d(_0x35c114);});_0x4bcc24[_0x542b('0x1e')](_0x561218);})['on']('error',function(_0x4288f2){logger[_0x542b('0x1c')](_0x4288f2);_0x62860d(_0x4288f2);})['end']();});}function uploadFile(_0x2eb0f0){return new BPromise(function(_0x5a98cf,_0xa4bf49){var _0x595b9e=urlParse(_0x2eb0f0);var _0x2690af=_0x595b9e[_0x542b('0x14')]===_0x542b('0x1f')?https:http;var _0x4a825d={'host':_0x595b9e[_0x542b('0x20')],'path':_0x595b9e[_0x542b('0x5')],'headers':{'user-agent':_0x542b('0x21')}};_0x2690af[_0x542b('0x15')](_0x4a825d,function(_0x27c0f8){if(_0x27c0f8[_0x542b('0x16')]!==0xc8){_0xa4bf49(new Error(_0x542b('0x17')+_0x2eb0f0+_0x542b('0x18')+_0x27c0f8[_0x542b('0x16')]+'\x20('+_0x27c0f8[_0x542b('0x19')]+')'));return;}var _0x1f01d9='';_0x27c0f8['on'](_0x542b('0x22'),function(_0x42cefb){_0x1f01d9+=_0x42cefb;});_0x27c0f8['on'](_0x542b('0x23'),function(){_0x5a98cf(_0x1f01d9);});})['on'](_0x542b('0x1c'),function(_0x519775){_0xa4bf49(_0x519775);})['end']();});}function convertFile(_0x58f0fc,_0x4a4ea2){return new BPromise(function(_0xb7384c,_0x1cbba9){var _0x1a4868=sox[_0x542b('0x24')](_0x58f0fc,_0x4a4ea2,{'sampleRate':0x1f40,'format':_0x542b('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a4868['on']('error',function(_0x45dbc0){logger[_0x542b('0x1c')]('error\x20convert',_0x45dbc0);_0x1cbba9(_0x45dbc0);});_0x1a4868['on'](_0x542b('0x23'),function(){logger[_0x542b('0x26')](_0x542b('0x27'));_0xb7384c();});_0x1a4868[_0x542b('0x28')]();});}function base64Decode(_0x18bb65,_0xa9ee74){var _0x151120=path[_0x542b('0x29')](__dirname,'tmp',rs[_0x542b('0x2a')](0x4)+_0x542b('0x2b'));fs[_0x542b('0x2c')](_0x151120,_0x18bb65,_0x542b('0x2d'));return convertFile(_0x151120,_0xa9ee74)[_0x542b('0x2e')](function(){try{fs[_0x542b('0x1b')](_0x151120);fs[_0x542b('0x2f')](_0xa9ee74,'777');}catch(_0x5cc49b){logger[_0x542b('0x1c')](_0x5cc49b);}return _0xa9ee74['split']('.')[0x0];});}function base64Encode(_0x152c1e){var _0x1ffcf9=fs[_0x542b('0x30')](_0x152c1e);return new Buffer(_0x1ffcf9)[_0x542b('0x31')](_0x542b('0x2d'));}exports[_0x542b('0x32')]=function(_0x52dfc8,_0x246cd0,_0x359901,_0x3b41e1,_0x12b965,_0x372bcc){var _0x3192e9,_0x5dc7d0;var _0xd89bf3=_0x542b('0x33');var _0x405d56='?key='+_0x52dfc8;var _0x5eecf1={};if(_0x246cd0==='ssml'){_0x5eecf1[_0x542b('0x34')]={'ssml':_0x359901};}else{_0x5eecf1[_0x542b('0x34')]={'text':_0x359901};};_0x5eecf1[_0x542b('0x35')]={'languageCode':_0x3b41e1,'ssmlGender':_0x12b965};_0x5eecf1[_0x542b('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x495d99={'url':_0xd89bf3+_0x542b('0x37')+_0x405d56,'method':_0x542b('0x38'),'json':!![],'body':_0x5eecf1};return rp(_0x495d99)['then'](function(_0xd264ac){return new BPromise(function(_0x2863f5,_0x277241){_0x3192e9=path[_0x542b('0x29')](__dirname,'tmp',rs[_0x542b('0x2a')](0x4)+_0x542b('0x39'));var _0x335b65=Buffer[_0x542b('0x3a')](_0xd264ac[_0x542b('0x3b')],_0x542b('0x2d'));return fs[_0x542b('0x3c')](_0x3192e9,_0x335b65,function(_0x416c43){_0x277241(_0x416c43);},function(_0xdc9166){fs[_0x542b('0x2f')](_0x3192e9,'777');_0x2863f5(_0xdc9166);});});})[_0x542b('0x2e')](function(_0x322cc2){_0x5dc7d0=path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+'.wav');return convertFile(_0x3192e9,_0x5dc7d0);})[_0x542b('0x2e')](function(){try{fs[_0x542b('0x1b')](_0x3192e9);fs[_0x542b('0x2f')](_0x5dc7d0,_0x542b('0x3e'));}catch(_0x4f44b6){logger[_0x542b('0x1c')](_0x4f44b6);}logger[_0x542b('0x26')]('googleCloudTTS\x20path',_0x5dc7d0[_0x542b('0x3f')]('.')[0x0]);return _0x5dc7d0['split']('.')[0x0];});};exports[_0x542b('0x40')]=function(_0x209236,_0x389194){var _0x5a1410=_0x542b('0x41');var _0x5d30b3,_0xd7197c;var _0xe3c6e9;var _0x3ae87d={'encoding':_0x542b('0x42'),'method':'POST','timeout':0x2710,'url':_0x5a1410,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x542b('0x43')+encodeURIComponent(JSON[_0x542b('0x44')]([[[_0x542b('0x45'),JSON[_0x542b('0x44')]([_0x209236,_0x389194||'en',![],_0x542b('0x46')]),null,'generic']]]))};return rp(_0x3ae87d)[_0x542b('0x2e')](function(_0x4b8b43){try{_0xe3c6e9=eval(_0x4b8b43[_0x542b('0x47')](0x5))[0x0][0x2];}catch(_0x3434c6){throw new Error(_0x542b('0x48')+_0x4b8b43[_0x542b('0x22')]);}if(!_0xe3c6e9){if(_0x209236[_0x542b('0x49')]>0xc8){throw new Error(_0x542b('0x4a'));}else{throw new Error('lang\x20\x22'+_0x389194+_0x542b('0x4b'));}}try{_0xe3c6e9=eval(_0xe3c6e9)[0x0];}catch(_0x465726){throw new Error(_0x542b('0x48')+res[_0x542b('0x22')]);}const _0x482c7a=_0xe3c6e9;_0x5d30b3=path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+_0x542b('0x39'));fs['writeFileSync'](_0x5d30b3,_0xe3c6e9,{'encoding':'base64'});_0xd7197c=path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs['generate'](0x4)+_0x542b('0x2b'));return convertFile(_0x5d30b3,_0xd7197c);})[_0x542b('0x2e')](function(){try{fs[_0x542b('0x1b')](_0x5d30b3);fs[_0x542b('0x2f')](_0xd7197c,_0x542b('0x3e'));}catch(_0x453862){logger[_0x542b('0x1c')](_0x453862);}logger[_0x542b('0x26')](_0x542b('0x4c'),_0xd7197c[_0x542b('0x3f')]('.')[0x0]);return _0xd7197c[_0x542b('0x3f')]('.')[0x0];});};exports[_0x542b('0x4d')]=function(_0x463f75,_0x2f2f05,_0x4c7511){return google[_0x542b('0x4e')](_0x463f75,_0x2f2f05,_0x4c7511)[_0x542b('0x2e')](function(_0x22700d){logger['info'](_0x22700d[_0x542b('0x4f')]);return rp(_0x22700d);})[_0x542b('0x2e')](function(_0x4cbae4){var _0x2a8b0b='';var _0x6cf9ef=0x0;try{fs[_0x542b('0x1b')](_0x463f75);}catch(_0x1c434f){logger[_0x542b('0x1c')](_0x1c434f);}if(_0x4cbae4&&_0x4cbae4['results']){_0x2a8b0b=_0x4cbae4['results'][_0x542b('0x50')](function(_0x6a0ebb){return _0x6a0ebb&&_0x6a0ebb['alternatives'][0x0]&&_0x6a0ebb['alternatives'][0x0][_0x542b('0x51')]?_0x6a0ebb[_0x542b('0x52')][0x0]['transcript']:'';})[_0x542b('0x53')]('\x0a');_0x6cf9ef=_0x4cbae4['results'][_0x542b('0x50')](function(_0x588b7a){return _0x588b7a&&_0x588b7a[_0x542b('0x52')][0x0]&&_0x588b7a[_0x542b('0x52')][0x0]['confidence']?_0x588b7a['alternatives'][0x0][_0x542b('0x54')]:0x0;})[_0x542b('0x53')]('\x0a');}logger['info']('googleASR\x20transcription',_0x2a8b0b);logger['info'](_0x542b('0x55'),_0x6cf9ef);return{'transcript':_0x2a8b0b,'confidence':_0x6cf9ef};})[_0x542b('0x56')](function(_0x101d33){logger[_0x542b('0x1c')](_0x542b('0x57'),_0x101d33[_0x542b('0x16')],_0x101d33[_0x542b('0x58')],_0x101d33[_0x542b('0x59')]);});};exports[_0x542b('0x5a')]=function(_0xc93702,_0x42c47f,_0x4aacc4,_0x416ef1){var _0x4331a5=apiai(_0x42c47f,{'language':_0x416ef1||'en'});return _0x4331a5[_0x542b('0x5b')](_0x4aacc4,{'sessionId':md5(_0xc93702)})[_0x542b('0x2e')](function(_0x1981cd){logger['info'](JSON[_0x542b('0x44')](_0x1981cd));return{'source':_0x1981cd[_0x542b('0x5c')]['source'],'resolvedQuery':_0x1981cd[_0x542b('0x5c')][_0x542b('0x5d')],'action':_0x1981cd[_0x542b('0x5c')][_0x542b('0x5e')],'actionIncomplete':_0x1981cd['result'][_0x542b('0x5f')],'speech':_0x1981cd[_0x542b('0x5c')]['fulfillment'][_0x542b('0x60')],'score':_0x1981cd[_0x542b('0x5c')][_0x542b('0x61')],'statusCode':_0x1981cd[_0x542b('0x62')][_0x542b('0x63')],'endConversation':_0x1981cd[_0x542b('0x5c')][_0x542b('0x64')]['endConversation']||![],'isFallbackIntent':_0x1981cd[_0x542b('0x5c')][_0x542b('0x64')][_0x542b('0x65')]};});};exports['googleDialogflowV2']=function(_0x29c565,_0x44dd39,_0x2cdfc6,_0x4c78a3,_0x56afbe,_0x17cfbe){var _0x40d978=_0x4c78a3['replace'](/\\n/g,'\x0a');var _0x308469={'credentials':{'private_key':_0x40d978,'client_email':_0x2cdfc6}};var _0x4bf9eb=new dialogflow[(_0x542b('0x66'))](_0x308469);var _0x23a34c=_0x4bf9eb['sessionPath'](_0x44dd39,md5(_0x29c565));var _0x483138={'session':_0x23a34c,'queryInput':{'text':{'text':_0x56afbe,'languageCode':_0x17cfbe}}};return _0x4bf9eb[_0x542b('0x67')](_0x483138)['then'](function(_0x130d50){if(_0x130d50&&_0x130d50[_0x542b('0x49')]){logger[_0x542b('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0x542b('0x44')](_0x130d50));var _0x552452=_0x130d50[0x0];if(_0x552452){var _0x534c0b={'action':_0x552452[_0x542b('0x68')][_0x542b('0x5e')],'allRequiredParamsPresent':_0x552452[_0x542b('0x68')][_0x542b('0x69')],'endConversation':_0x552452['queryResult'][_0x542b('0x6a')]&&_0x552452[_0x542b('0x68')][_0x542b('0x6a')][_0x542b('0x6b')]?_0x552452[_0x542b('0x68')]['diagnosticInfo']['fields']['end_conversation'][_0x542b('0x6c')]:![],'fulfillmentText':_0x552452['queryResult'][_0x542b('0x6d')],'intentName':_0x552452[_0x542b('0x68')]['intent'][_0x542b('0x58')],'intentDisplayName':_0x552452[_0x542b('0x68')]['intent'][_0x542b('0x6e')],'isFallbackIntent':_0x552452[_0x542b('0x68')]['intent']['isFallback'],'languageCode':_0x552452[_0x542b('0x68')]['languageCode'],'queryText':_0x552452[_0x542b('0x68')][_0x542b('0x6f')],'responseId':_0x552452['responseId'],'score':_0x552452[_0x542b('0x68')][_0x542b('0x70')],'speech':_0x552452[_0x542b('0x68')][_0x542b('0x6d')],'providerResponse':JSON['stringify'](_0x130d50)};return _0x534c0b;}}});};exports[_0x542b('0x71')]=function(_0x460814,_0x8a7de4,_0xd2893a,_0x2e0abc){return tilde['asr'](_0x460814,_0x8a7de4,_0xd2893a,_0x2e0abc)['then'](function(_0x5b7540){try{fs[_0x542b('0x1b')](_0x460814);}catch(_0x58fd31){logger[_0x542b('0x1c')](_0x58fd31);}logger[_0x542b('0x26')](_0x542b('0x72'),_0x5b7540[_0x542b('0x51')]);logger['info'](_0x542b('0x73'),_0x5b7540[_0x542b('0x54')]);return _0x5b7540;});};exports[_0x542b('0x74')]=function(_0x5d7d17,_0x21f87d,_0x3b056f,_0x4af939,_0x3d9200,_0x32d9d6){var _0x4601c9=path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+_0x542b('0x39'));var _0x1f6414;return aws[_0x542b('0x75')](_0x5d7d17,_0x21f87d,_0x3b056f,_0x4af939,_0x3d9200,_0x32d9d6,_0x4601c9)[_0x542b('0x2e')](function(){_0x1f6414=path['resolve'](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+_0x542b('0x2b'));return convertFile(_0x4601c9,_0x1f6414);})[_0x542b('0x2e')](function(){try{fs['unlink'](_0x4601c9);fs[_0x542b('0x2f')](_0x1f6414,'777');}catch(_0x159d8f){logger[_0x542b('0x1c')](_0x159d8f);}return _0x1f6414['split']('.')[0x0];});};exports[_0x542b('0x76')]=function(_0x881994,_0x53c9c3,_0x4af0c2,_0x161839,_0x24d5aa,_0x16c3e0){return aws['lex'](_0x881994,_0x53c9c3,_0x4af0c2,_0x161839,_0x24d5aa,_0x16c3e0)[_0x542b('0x2e')](function(_0x5a9fad){logger[_0x542b('0x26')](JSON['stringify'](_0x5a9fad));return _0x5a9fad;});};exports[_0x542b('0x77')]=function(_0x288642,_0x2375a3,_0x3b4c18,_0x19c9ad){var _0x29acc4=util[_0x542b('0x78')](_0x542b('0x79'),ISPEECH_API,_0x288642,encodeURIComponent(_0x2375a3),_0x3b4c18,_0x19c9ad);var _0x6d4ae9=path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+'.mp3');var _0x28022f;return downloadFile(_0x29acc4,_0x6d4ae9)[_0x542b('0x2e')](function(){_0x28022f=path['resolve'](__dirname,_0x542b('0x3d'),rs['generate'](0x4)+_0x542b('0x2b'));return convertFile(_0x6d4ae9,_0x28022f);})['then'](function(){try{fs[_0x542b('0x1b')](_0x6d4ae9);fs[_0x542b('0x2f')](_0x28022f,_0x542b('0x3e'));}catch(_0x33b662){logger[_0x542b('0x1c')](_0x33b662);}return _0x28022f[_0x542b('0x3f')]('.')[0x0];});};exports[_0x542b('0x7a')]=function(_0x408608,_0x5f436b,_0x24dcea,_0x47d37a){var _0x545b6f=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5f436b,_0x24dcea,base64Encode(_0x408608),_0x47d37a?util['format'](_0x542b('0x7b'),encodeURIComponent(_0x47d37a)):'freeform=3');return uploadFile(_0x545b6f)['then'](function(_0x350f16){return querystring['parse'](_0x350f16);});};exports[_0x542b('0x7c')]=function(_0x37e805,_0x315197){return sestek[_0x542b('0x7d')](_0x37e805,_0x315197)['then'](function(_0x3b60a9){logger[_0x542b('0x26')](JSON[_0x542b('0x44')](_0x3b60a9));var _0x556e44={'speech':_0x3b60a9[_0x542b('0x7e')],'action':_0x3b60a9[_0x542b('0x7f')]?_0x3b60a9[_0x542b('0x7f')][_0x542b('0x80')]:undefined,'actiondata':_0x3b60a9[_0x542b('0x7f')]?_0x3b60a9[_0x542b('0x7f')]['CustomActionData']:undefined};if(_0x3b60a9[_0x542b('0x7f')]&&_0x3b60a9[_0x542b('0x7f')][_0x542b('0x81')]){return base64Decode(_0x3b60a9[_0x542b('0x7f')]['AudioFromTts'][_0x542b('0x82')],path[_0x542b('0x29')](__dirname,_0x542b('0x3d'),rs[_0x542b('0x2a')](0x4)+_0x542b('0x2b')))[_0x542b('0x2e')](function(_0x51a3f7){_0x556e44[_0x542b('0x83')]=_0x51a3f7;return _0x556e44;});}return _0x556e44;});};exports[_0x542b('0x84')]=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 968d04c..f3c7909 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 _0x95ee=['./nda','exports'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x95ee,0xec));var _0xe95e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x95ee[_0x263a74];return _0x2aa86c;};var nda=require(_0xe95e('0x0'));module[_0xe95e('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2dd2=['./nda'];(function(_0x2c41ec,_0x26c602){var _0x34b915=function(_0x2de42d){while(--_0x2de42d){_0x2c41ec['push'](_0x2c41ec['shift']());}};_0x34b915(++_0x26c602);}(_0x2dd2,0xe8));var _0x22dd=function(_0x162a0c,_0x550acd){_0x162a0c=_0x162a0c-0x0;var _0x19042e=_0x2dd2[_0x162a0c];return _0x19042e;};var nda=require(_0x22dd('0x0'));module['exports']={'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 cb4cab7..4c7073b 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 _0x49e9=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','agi','exports','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension'];(function(_0xf16016,_0x209c97){var _0x23b444=function(_0x39d106){while(--_0x39d106){_0xf16016['push'](_0xf16016['shift']());}};_0x23b444(++_0x209c97);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x949e('0x0'));var url=require(_0x949e('0x1'));var logger=require('../../../../../config/logger')(_0x949e('0x2'));module[_0x949e('0x3')]=function(_0x259795,_0x5c303a){var _0x4f1295={'method':_0x949e('0x4'),'uri':url['resolve'](_0x5c303a[_0x949e('0x5')],_0x949e('0x6')),'form':{'grant_type':_0x949e('0x7'),'username':_0x5c303a['username'],'password':_0x5c303a[_0x949e('0x7')]},'json':!![]};return rp(_0x4f1295)[_0x949e('0x8')](function(_0xfc4f8a){var _0x34ee57={'method':_0x949e('0x4'),'uri':url[_0x949e('0x9')](_0x5c303a[_0x949e('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c303a[_0x949e('0xb')]||'message','channelId':_0x949e('0xc'),'conversation':{'id':_0x259795[_0x949e('0xd')]},'from':{'id':_0x259795[_0x949e('0xe')],'name':_0x259795['calleridname']},'recipient':{'id':_0x259795[_0x949e('0xf')],'name':_0x259795[_0x949e('0x10')]},'text':_0x5c303a[_0x949e('0x11')],'channelData':{}},'headers':{'Authorization':_0x949e('0x12')+_0xfc4f8a[_0x949e('0x13')]},'json':!![]};if(_0x5c303a[_0x949e('0x14')]){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x17')]=_0x5c303a[_0x949e('0x14')];}if(_0x5c303a[_0x949e('0x18')]=='1'){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x949e('0x1a')};}if(_0x5c303a['custom_action']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')][_0x949e('0x1b')]=_0x5c303a[_0x949e('0x1c')];if(_0x5c303a['custom_action_data']){_0x34ee57[_0x949e('0x15')][_0x949e('0x16')]['CustomActionData']=_0x5c303a[_0x949e('0x1d')];}}logger[_0x949e('0x1e')](JSON[_0x949e('0x1f')](_0x34ee57));return rp(_0x34ee57);});}; \ No newline at end of file +var _0x1c8a=['stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','calleridname','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1c8a,0x140));var _0xa1c8=function(_0x11d5c2,_0x596f2f){_0x11d5c2=_0x11d5c2-0x0;var _0x53c0cf=_0x1c8a[_0x11d5c2];return _0x53c0cf;};'use strict';var rp=require(_0xa1c8('0x0'));var url=require(_0xa1c8('0x1'));var logger=require(_0xa1c8('0x2'))(_0xa1c8('0x3'));module[_0xa1c8('0x4')]=function(_0x50af02,_0x250aa9){var _0x530257={'method':_0xa1c8('0x5'),'uri':url[_0xa1c8('0x6')](_0x250aa9[_0xa1c8('0x7')],'/token'),'form':{'grant_type':_0xa1c8('0x8'),'username':_0x250aa9[_0xa1c8('0x9')],'password':_0x250aa9[_0xa1c8('0x8')]},'json':!![]};return rp(_0x530257)['then'](function(_0x32993e){var _0xf93962={'method':_0xa1c8('0x5'),'uri':url['resolve'](_0x250aa9[_0xa1c8('0xa')],_0xa1c8('0xb')),'body':{'type':_0x250aa9[_0xa1c8('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x50af02[_0xa1c8('0xd')]},'from':{'id':_0x50af02['callerid'],'name':_0x50af02[_0xa1c8('0xe')]},'recipient':{'id':_0x50af02['dnid'],'name':_0x50af02['extension']},'text':_0x250aa9['text'],'channelData':{}},'headers':{'Authorization':_0xa1c8('0xf')+_0x32993e[_0xa1c8('0x10')]},'json':!![]};if(_0x250aa9[_0xa1c8('0x11')]){_0xf93962[_0xa1c8('0x12')][_0xa1c8('0x13')][_0xa1c8('0x14')]=_0x250aa9['project'];}if(_0x250aa9[_0xa1c8('0x15')]=='1'){_0xf93962[_0xa1c8('0x12')][_0xa1c8('0x13')][_0xa1c8('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa1c8('0x17')};}if(_0x250aa9[_0xa1c8('0x18')]){_0xf93962['body'][_0xa1c8('0x13')][_0xa1c8('0x19')]=_0x250aa9[_0xa1c8('0x18')];if(_0x250aa9[_0xa1c8('0x1a')]){_0xf93962[_0xa1c8('0x12')]['channelData'][_0xa1c8('0x1b')]=_0x250aa9['custom_action_data'];}}logger['info'](JSON[_0xa1c8('0x1c')](_0xf93962));return rp(_0xf93962);});}; \ 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 5ca20e6..e77db8f 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 _0xc106=['exports'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0xc106,0x112));var _0x6c10=function(_0x1d8ce4,_0x45fbb4){_0x1d8ce4=_0x1d8ce4-0x0;var _0x48e3bc=_0xc106[_0x1d8ce4];return _0x48e3bc;};'use strict';var asr=require('./lib/api');module[_0x6c10('0x0')]=function(_0x12c5cf,_0x4f171e,_0x3c5476,_0x4b54d0){return asr(_0x12c5cf,_0x4f171e,_0x3c5476,_0x4b54d0);}; \ No newline at end of file +var _0x889e=['exports','./lib/api'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x889e,0x77));var _0xe889=function(_0x4deb9a,_0x29e7dc){_0x4deb9a=_0x4deb9a-0x0;var _0x5ccd47=_0x889e[_0x4deb9a];return _0x5ccd47;};'use strict';var asr=require(_0xe889('0x0'));module[_0xe889('0x1')]=function(_0x5646b8,_0x252230,_0x53be95,_0xd27c39){return asr(_0x5646b8,_0x252230,_0x53be95,_0xd27c39);}; \ 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 48874cb..6b89d24 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 _0xfb0b=['stringify','createReadStream','data','send','EOS','error','terminate','status','result','final','info','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','isNil','open','message','bluebird','lodash','moment','crypto','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb0b,0x13f));var _0xbfb0=function(_0xf44777,_0x419161){_0xf44777=_0xf44777-0x0;var _0x4a38cc=_0xfb0b[_0xf44777];return _0x4a38cc;};'use strict';var BPromise=require(_0xbfb0('0x0'));var _=require(_0xbfb0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbfb0('0x2'));var crypto=require(_0xbfb0('0x3'));var logger=require('../../../../../../config/logger')(_0xbfb0('0x4'));module[_0xbfb0('0x5')]=function(_0x55275d,_0x2451bd,_0x2d5375,_0x429106){return new BPromise(function(_0xe0360f,_0x43d514){logger['info']('Tilde\x20URI',_0x429106||_0xbfb0('0x6'));var _0xec90b6=new WebSocket(_0x429106||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x56841c='';var _0x22493c='0';var _0x20433b='1';var _0x2cc41c=_0xbfb0('0x7');function _0x5efdbe(_0x1720b5){var _0x35247a=crypto[_0xbfb0('0x8')](_0xbfb0('0x9'));_0x35247a[_0xbfb0('0xa')](_0x1720b5);return _0x35247a[_0xbfb0('0xb')](_0xbfb0('0xc'));}function _0xb802ea(){try{logger['info'](_0xbfb0('0xd'));var _0x20ff32=moment()['unix']();var _0x2fb91d=_0x5efdbe(_0x20ff32+_0x2451bd+_0x2d5375);_0xec90b6['send'](JSON[_0xbfb0('0xe')]({'appID':_0x2451bd,'timestamp':_0x20ff32,'appKey':_0x2fb91d}));var _0xf62695=fs[_0xbfb0('0xf')](_0x55275d);_0xf62695['on'](_0xbfb0('0x10'),function(_0x478b92){_0xec90b6[_0xbfb0('0x11')](_0x478b92);});_0xf62695['on']('close',function(){_0xec90b6[_0xbfb0('0x11')](_0xbfb0('0x12'));});}catch(_0x1f1832){logger[_0xbfb0('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x1f1832));_0xec90b6[_0xbfb0('0x14')]();}}function _0x3d3702(_0x4e4bc2){try{if(_0x4e4bc2){var _0x492fb7=JSON['parse'](_0x4e4bc2);switch(_0x492fb7[_0xbfb0('0x15')]){case 0x0:if(_0x492fb7[_0xbfb0('0x16')]){if(_0x492fb7[_0xbfb0('0x16')][_0xbfb0('0x17')]){logger[_0xbfb0('0x18')](_0xbfb0('0x19'),JSON[_0xbfb0('0xe')](_0x492fb7['result'][_0xbfb0('0x1a')]));_0x56841c=_0x492fb7['result'][_0xbfb0('0x1a')][0x0][_0xbfb0('0x1b')];_0x22493c=_0x492fb7['result'][_0xbfb0('0x1a')][0x0]['likelihood'];_0x20433b='0';_0x2cc41c=_0xbfb0('0x1c');_0xec90b6[_0xbfb0('0x14')]();}}break;case 0x1:logger['info'](_0xbfb0('0x7'));_0x20433b='1';_0x2cc41c=_0xbfb0('0x7');break;case 0x2:logger[_0xbfb0('0x18')](_0xbfb0('0x1d'));_0x20433b='2';_0x2cc41c=_0xbfb0('0x1d');break;case 0x9:logger['info'](_0xbfb0('0x1e'));_0x20433b='9';_0x2cc41c=_0xbfb0('0x1e');break;case 0xa:logger[_0xbfb0('0x18')](_0xbfb0('0x1f'));_0x20433b='10';_0x2cc41c=_0xbfb0('0x1f');break;case 0xb:logger['info'](_0xbfb0('0x20'));_0x20433b='11';_0x2cc41c=_0xbfb0('0x20');}}}catch(_0xd46e69){logger[_0xbfb0('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0xd46e69));_0xec90b6[_0xbfb0('0x14')]();}}function _0x254b39(){logger[_0xbfb0('0x18')](_0xbfb0('0x21'));_0xe0360f({'transcript':_0x56841c,'confidence':_0x22493c,'status':_0x20433b,'status_message':_0x2cc41c});}function _0x11df3c(_0xef84c9){logger[_0xbfb0('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xbfb0('0x22')](_0xef84c9)){logger['error'](_['isObject'](_0xef84c9)?JSON[_0xbfb0('0xe')](_0xef84c9):_0xef84c9);}}_0xec90b6['on'](_0xbfb0('0x23'),_0xb802ea);_0xec90b6['on'](_0xbfb0('0x24'),_0x3d3702);_0xec90b6['on']('close',_0x254b39);_0xec90b6['on']('error',_0x11df3c);});}; \ No newline at end of file +var _0x38b3=['bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x38b3,0x148));var _0x338b=function(_0x200e88,_0xebbcc6){_0x200e88=_0x200e88-0x0;var _0x574031=_0x38b3[_0x200e88];return _0x574031;};'use strict';var BPromise=require(_0x338b('0x0'));var _=require(_0x338b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x338b('0x2'));var crypto=require(_0x338b('0x3'));var logger=require('../../../../../../config/logger')(_0x338b('0x4'));module[_0x338b('0x5')]=function(_0x16abff,_0xf3813b,_0x488d82,_0x1c236a){return new BPromise(function(_0x421fc0,_0x11ad3d){logger[_0x338b('0x6')](_0x338b('0x7'),_0x1c236a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x21015c=new WebSocket(_0x1c236a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x16ace2='';var _0x4dc7a1='0';var _0x48bf20='1';var _0x1d850e=_0x338b('0x8');function _0x34b84c(_0x571f6e){var _0x41ab22=crypto['createHash'](_0x338b('0x9'));_0x41ab22[_0x338b('0xa')](_0x571f6e);return _0x41ab22[_0x338b('0xb')](_0x338b('0xc'));}function _0x324c17(){try{logger[_0x338b('0x6')](_0x338b('0xd'));var _0x50e7c9=moment()['unix']();var _0x43a273=_0x34b84c(_0x50e7c9+_0xf3813b+_0x488d82);_0x21015c[_0x338b('0xe')](JSON[_0x338b('0xf')]({'appID':_0xf3813b,'timestamp':_0x50e7c9,'appKey':_0x43a273}));var _0x17baf2=fs[_0x338b('0x10')](_0x16abff);_0x17baf2['on'](_0x338b('0x11'),function(_0x47e8cf){_0x21015c[_0x338b('0xe')](_0x47e8cf);});_0x17baf2['on']('close',function(){_0x21015c[_0x338b('0xe')]('EOS');});}catch(_0xc5a656){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x338b('0xf')](_0xc5a656));_0x21015c[_0x338b('0x12')]();}}function _0x4d9f4e(_0x21f8ad){try{if(_0x21f8ad){var _0x280d3b=JSON[_0x338b('0x13')](_0x21f8ad);switch(_0x280d3b[_0x338b('0x14')]){case 0x0:if(_0x280d3b['result']){if(_0x280d3b[_0x338b('0x15')][_0x338b('0x16')]){logger[_0x338b('0x6')](_0x338b('0x17'),JSON[_0x338b('0xf')](_0x280d3b[_0x338b('0x15')][_0x338b('0x18')]));_0x16ace2=_0x280d3b[_0x338b('0x15')][_0x338b('0x18')][0x0][_0x338b('0x19')];_0x4dc7a1=_0x280d3b[_0x338b('0x15')][_0x338b('0x18')][0x0][_0x338b('0x1a')];_0x48bf20='0';_0x1d850e=_0x338b('0x1b');_0x21015c[_0x338b('0x12')]();}}break;case 0x1:logger[_0x338b('0x6')](_0x338b('0x8'));_0x48bf20='1';_0x1d850e=_0x338b('0x8');break;case 0x2:logger[_0x338b('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x48bf20='2';_0x1d850e=_0x338b('0x1c');break;case 0x9:logger['info'](_0x338b('0x1d'));_0x48bf20='9';_0x1d850e=_0x338b('0x1d');break;case 0xa:logger[_0x338b('0x6')](_0x338b('0x1e'));_0x48bf20='10';_0x1d850e='Authentication\x20failed.';break;case 0xb:logger[_0x338b('0x6')](_0x338b('0x1f'));_0x48bf20='11';_0x1d850e=_0x338b('0x1f');}}}catch(_0x16c8d3){logger[_0x338b('0x20')](_0x338b('0x21'),JSON[_0x338b('0xf')](_0x16c8d3));_0x21015c['terminate']();}}function _0x43c6f3(){logger[_0x338b('0x6')](_0x338b('0x22'));_0x421fc0({'transcript':_0x16ace2,'confidence':_0x4dc7a1,'status':_0x48bf20,'status_message':_0x1d850e});}function _0x475eb0(_0x180a93){logger[_0x338b('0x20')](_0x338b('0x23'));if(!_[_0x338b('0x24')](_0x180a93)){logger[_0x338b('0x20')](_[_0x338b('0x25')](_0x180a93)?JSON[_0x338b('0xf')](_0x180a93):_0x180a93);}}_0x21015c['on'](_0x338b('0x26'),_0x324c17);_0x21015c['on'](_0x338b('0x27'),_0x4d9f4e);_0x21015c['on'](_0x338b('0x28'),_0x43c6f3);_0x21015c['on']('error',_0x475eb0);});}; \ 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 aff9795..542bde0 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 _0x5212=['exports','./asr'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5212,0x1a9));var _0x2521=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x5212[_0xa60623];return _0x4a6487;};var asr=require(_0x2521('0x0'));module[_0x2521('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa23b=['./asr','exports'];(function(_0x7f5b7a,_0x29e606){var _0x183062=function(_0x258b20){while(--_0x258b20){_0x7f5b7a['push'](_0x7f5b7a['shift']());}};_0x183062(++_0x29e606);}(_0xa23b,0xd0));var _0xba23=function(_0x316bc2,_0x156cd3){_0x316bc2=_0x316bc2-0x0;var _0x22692e=_0xa23b[_0x316bc2];return _0x22692e;};var asr=require(_0xba23('0x0'));module[_0xba23('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c238ef7..7a2d99c 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _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(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'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 21de7ea..e0c4c06 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 _0x4e81=['menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunkById','getSound','getSoundById','getMailAccount','getIntervals','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','result','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%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','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','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','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','lodash','shelljs','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','rawHeaders','rawBody'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x4e81[_0x2ef8f1];return _0x17498d;};'use strict';var fs=require('fs');var util=require(_0x14e8('0x0'));var _=require(_0x14e8('0x1'));var sh=require(_0x14e8('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x14e8('0x3'));var rp=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var shared=require(_0x14e8('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x14e8('0x9'),_0x14e8('0xa')];var verticesWithRetry=[_0x14e8('0xb'),_0x14e8('0xc'),_0x14e8('0xd')];var AGIVertices=function(_0x20f053,_0x39127a,_0x1d8402){this[_0x14e8('0xe')]=_0x20f053;this['rpc']=_0x39127a;this[_0x14e8('0xf')]=_0x1d8402;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x11')]=function(_0x2906b3,_0x421fec){this[_0x14e8('0x12')][_0x14e8('0x13')](_0x2906b3)[_0x14e8('0x14')](function(_0x52d13c){_0x421fec(null,_0x52d13c?_0x52d13c[_0x14e8('0x15')]:![]);})['catch'](function(_0x2607ef){_0x421fec(_0x2607ef);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16')]=function(_0x5a95b7,_0x22fa86){this['rpc'][_0x14e8('0x17')](_0x5a95b7)['then'](function(_0x347216){_0x22fa86(null,_0x347216?_0x347216[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x135996){_0x22fa86(_0x135996);});};AGIVertices['prototype'][_0x14e8('0x19')]=function(_0x3793a0,_0x30581){this[_0x14e8('0x12')][_0x14e8('0x1a')](_0x3793a0)[_0x14e8('0x14')](function(_0x10dc8b){_0x30581(null,_0x10dc8b?_0x10dc8b[_0x14e8('0x15')]:![]);})['catch'](function(_0x328c5a){_0x30581(_0x328c5a);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b')]=function(_0x7b10f2,_0x246c5d){this['rpc'][_0x14e8('0x1c')](_0x7b10f2)[_0x14e8('0x14')](function(_0x2abfec){_0x246c5d(null,_0x2abfec?_0x2abfec['dsn']:![]);})[_0x14e8('0x18')](function(_0x47f060){_0x246c5d(_0x47f060);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1d')]=function(_0x3e8d5c,_0x117b00){this[_0x14e8('0x12')]['getUserById'](_0x3e8d5c)[_0x14e8('0x14')](function(_0x5b11f9){_0x117b00(null,_0x5b11f9?_0x5b11f9[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x4ffc8b){_0x117b00(_0x4ffc8b);});};AGIVertices['prototype']['getTrunk']=function(_0x4a758c,_0x271e5d){this[_0x14e8('0x12')][_0x14e8('0x1e')](_0x4a758c)[_0x14e8('0x14')](function(_0x57eb46){_0x271e5d(null,_0x57eb46?_0x57eb46[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x3c09cb){_0x271e5d(_0x3c09cb);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1f')]=function(_0xfc0545,_0x2813ae){var _0x4abc29=this;this[_0x14e8('0x12')][_0x14e8('0x20')](_0xfc0545)[_0x14e8('0x14')](function(_0x5f5abb){_0x2813ae(null,_0x5f5abb?_0x4abc29['getSoundPath'](_0x5f5abb['save_name']):![]);})[_0x14e8('0x18')](function(_0x2a408d){_0x2813ae(_0x2a408d);});};AGIVertices['prototype'][_0x14e8('0x21')]=function(_0x1d71ca,_0x176e8f){this[_0x14e8('0x12')]['getMailAccountById'](_0x1d71ca)[_0x14e8('0x14')](function(_0x260d51){_0x176e8f(null,_0x260d51?_0x260d51:![]);})[_0x14e8('0x18')](function(_0x37da89){_0x176e8f(_0x37da89);});};AGIVertices[_0x14e8('0x10')]['sendMailMessage']=function(_0x2f83c3,_0x29ee7a,_0xc398b6){this[_0x14e8('0xf')]['sendMailMessage'](_0x2f83c3,_0x29ee7a)[_0x14e8('0x14')](function(){_0xc398b6(null);})['catch'](function(_0x14a038){_0xc398b6(_0x14a038);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x22')]=function(_0x34a7c8,_0x17fc40){this[_0x14e8('0x12')][_0x14e8('0x23')](_0x34a7c8)[_0x14e8('0x14')](function(_0xd144b){if(_0xd144b){if(_0xd144b[_0x14e8('0x24')]){_0x17fc40(null,[_0xd144b[_0x14e8('0x25')]]);}else{_0x17fc40(null,_[_0x14e8('0x26')](_0xd144b['Intervals'],'interval'));}}else{_0x17fc40(null,![]);}})['catch'](function(_0x16ff09){_0x17fc40(_0x16ff09);});};AGIVertices['prototype'][_0x14e8('0x27')]=function(_0x5bdf42){return util[_0x14e8('0x28')](_0x14e8('0x29'),FILES_PATH,_0x5bdf42);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x2a')]=function(_0x51a63d,_0x13b44e,_0x514415){odbc[_0x14e8('0x2b')](_0x51a63d,function(_0x3ae459){if(_0x3ae459){logger[_0x14e8('0x2c')](_0x14e8('0x2d'),_0x3ae459);_0x514415(_0x3ae459);}else{logger[_0x14e8('0x2e')](_0x14e8('0x2f'));odbc['query'](_0x13b44e,function(_0xd05faa,_0x5b9e6b){if(_0xd05faa){logger[_0x14e8('0x2e')](_0x14e8('0x30'),_0x13b44e);_0x514415(_0xd05faa);}else{logger[_0x14e8('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x13b44e);odbc[_0x14e8('0x31')](function(_0x12c8ff){if(_0x12c8ff){logger['error'](_0x14e8('0x32'),_0x12c8ff);}_0x514415(null,_0x5b9e6b);});}});}});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x33')]=function(_0x3a7aa7,_0x77e8a0){this[_0x14e8('0x12')][_0x14e8('0x34')](_0x3a7aa7)[_0x14e8('0x14')](function(_0x33743a){_0x77e8a0(null,_0x33743a?_0x33743a:![]);})[_0x14e8('0x18')](function(_0x11f0ee){_0x77e8a0(_0x11f0ee);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x35')]=function(_0x21e781,_0x3829f8){this['rpc'][_0x14e8('0x35')](_0x21e781)['then'](function(_0x555f70){_0x3829f8(null,_0x555f70);})['catch'](function(_0x3d2d95){_0x3829f8(_0x3d2d95);});};AGIVertices['prototype'][_0x14e8('0x36')]=function(_0x45bff0,_0x7907e8,_0x264cb7){this[_0x14e8('0x12')][_0x14e8('0x36')]({'uniqueid':this[_0x14e8('0xe')][_0x14e8('0x37')],'node':_0x45bff0[_0x14e8('0x38')],'application':_0x45bff0[_0x14e8('0x39')],'data':_0x7907e8||null,'project_name':this[_0x14e8('0xe')]['arg_1'],'callerid':this[_0x14e8('0xe')][_0x14e8('0x3a')]})[_0x14e8('0x14')](function(_0xae5d61){if(_0x264cb7){_0x264cb7(null,_0xae5d61);}})['catch'](function(_0x205848){if(_0x264cb7){_0x264cb7(_0x205848);}});};AGIVertices[_0x14e8('0x10')]['createSquareRecording']=function(_0x553002,_0x3a8b91,_0x485563,_0x58b609){this[_0x14e8('0x12')][_0x14e8('0x3b')]({'uniqueid':this['channel'][_0x14e8('0x37')],'callerid':this[_0x14e8('0xe')]['callerid'],'calleridname':this[_0x14e8('0xe')][_0x14e8('0x3c')],'context':this[_0x14e8('0xe')][_0x14e8('0x3d')],'extension':this[_0x14e8('0xe')][_0x14e8('0x3e')],'priority':this[_0x14e8('0xe')][_0x14e8('0x3f')],'accountcode':this[_0x14e8('0xe')][_0x14e8('0x40')],'dnid':this[_0x14e8('0xe')][_0x14e8('0x41')],'projectName':this[_0x14e8('0xe')][_0x14e8('0x42')],'saveName':_0x3a8b91,'filename':_0x553002[_0x14e8('0x43')]||_0x3a8b91,'savePath':_0x485563})[_0x14e8('0x14')](function(_0x59820f){_0x58b609(null,_0x59820f);})[_0x14e8('0x18')](function(_0x49324a){_0x58b609(_0x49324a);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x44')]=function(_0x403628,_0x297780,_0x5dcb68,_0x4d91df,_0x59b172){this[_0x14e8('0x12')]['createSquareMessage']({'uniqueid':this['channel'][_0x14e8('0x37')],'body':_0x403628,'direction':_0x297780,'providerName':_0x5dcb68,'providerResponse':_0x4d91df})[_0x14e8('0x14')](function(_0x590bcd){if(_0x59b172){_0x59b172(null,_0x590bcd);}})[_0x14e8('0x18')](function(_0x27e319){if(_0x59b172){_0x59b172(_0x27e319);}});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x45')]=function(_0x4cc86a,_0x519c9c){this[_0x14e8('0x12')][_0x14e8('0x45')]({'firstName':_[_0x14e8('0x46')](_0x4cc86a[_0x14e8('0x15')])||_[_0x14e8('0x47')](_0x4cc86a[_0x14e8('0x15')])?'callback_'+Math[_0x14e8('0x48')]():_0x4cc86a[_0x14e8('0x15')],'lastName':_[_0x14e8('0x46')](_0x4cc86a[_0x14e8('0x49')])||_['isNil'](_0x4cc86a[_0x14e8('0x49')])?null:_0x4cc86a[_0x14e8('0x49')],'phone':_0x4cc86a[_0x14e8('0x4a')],'ListId':_0x4cc86a[_0x14e8('0x4b')],'scheduledat':_0x4cc86a['scheduledAt'],'callbackUniqueid':this[_0x14e8('0xe')][_0x14e8('0x37')],'tags':_0x14e8('0x4c'),'description':_0x14e8('0x4d')+_0x4cc86a[_0x14e8('0x4e')][_0x14e8('0x4f')](),'priority':_0x4cc86a[_0x14e8('0x50')]})[_0x14e8('0x14')](function(_0x5ab659){_0x519c9c(null,_0x5ab659);})['catch'](function(_0x2fcc63){_0x519c9c(_0x2fcc63);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x51')]=function(_0x4229a0,_0x3f0b2a){this['rpc']['getPauseById'](_0x4229a0)['then'](function(_0xf8a05d){_0x3f0b2a(null,_0xf8a05d?_0xf8a05d[_0x14e8('0x15')]:![]);})[_0x14e8('0x18')](function(_0x58e2a4){_0x3f0b2a(_0x58e2a4);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x52')]=function(_0x1d6683,_0x54e164,_0x274837){var _0x63b342={'role':_0x14e8('0x53')};_0x63b342[_0x1d6683]=this[_0x14e8('0xe')][_0x14e8('0x3a')];this[_0x14e8('0x12')][_0x14e8('0x52')](_0x63b342,_0x54e164,this[_0x14e8('0xe')][_0x14e8('0x37')])[_0x14e8('0x14')](function(_0x1b2007){_0x274837(null,_['isNil'](_0x1b2007)?![]:!![]);})[_0x14e8('0x18')](function(_0x25297b){logger[_0x14e8('0x2c')](_0x25297b);_0x274837(null,![]);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x54')]=function(_0xa6738d,_0x364344){var _0x12e0a8={'role':_0x14e8('0x53')};_0x12e0a8[_0xa6738d]=this[_0x14e8('0xe')][_0x14e8('0x3a')];this[_0x14e8('0x12')]['agentUnpause'](_0x12e0a8)[_0x14e8('0x14')](function(_0x93238a){_0x364344(null,_['isNil'](_0x93238a)?![]:!![]);})[_0x14e8('0x18')](function(_0x2c2630){logger[_0x14e8('0x2c')](_0x2c2630);_0x364344(null,![]);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x55')]=function(_0x271941,_0x139405){var _0x5b6e28={'role':'agent'};_0x5b6e28[_0x271941]=this['channel'][_0x14e8('0x3a')];this[_0x14e8('0x12')][_0x14e8('0x55')](_0x5b6e28)[_0x14e8('0x14')](function(_0x39de9d){_0x139405(null,_[_0x14e8('0x47')](_0x39de9d)?![]:!![]);})[_0x14e8('0x18')](function(_0x4c34d7){logger[_0x14e8('0x2c')](_0x4c34d7);_0x139405(null,![]);});};AGIVertices[_0x14e8('0x10')]['agentLogin']=function(_0x27afee,_0x3a5602){var _0x4c3ead={'role':'agent'};_0x4c3ead[_0x27afee]=this['channel'][_0x14e8('0x3a')];var _0xf0cae3=_0x27afee!=_0x14e8('0x56')?util[_0x14e8('0x28')]('%s/%s@from-sip/n',_0x14e8('0x57'),this[_0x14e8('0xe')][_0x14e8('0x3a')]):undefined;this[_0x14e8('0x12')][_0x14e8('0x58')](_0x4c3ead,_0xf0cae3)[_0x14e8('0x14')](function(_0x504c7c){_0x3a5602(null,_[_0x14e8('0x47')](_0x504c7c)?![]:!![]);})[_0x14e8('0x18')](function(_0x164414){logger['error'](_0x164414);_0x3a5602(null,![]);});};AGIVertices['prototype'][_0x14e8('0x59')]=function(_0x53d0c8,_0x25f63c){sh['exec'](_[_0x14e8('0x5a')](_0x53d0c8),function(_0x54b023,_0x28aac4){var _0x362bda=_0x28aac4['replace'](/(\r\n|\n|\r)/gm,'');_0x25f63c(null,_0x362bda);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x5b')]=function(_0x3c4679,_0xd1cd5e){scripts[_0x14e8('0x5b')](_0x3c4679[_0x14e8('0x5c')],_0x3c4679[_0x14e8('0x5d')]||_0x14e8('0x5e'),_0x3c4679[_0x14e8('0x5e')],_0x3c4679[_0x14e8('0x5f')]||_0x14e8('0x60'),_0x3c4679[_0x14e8('0x61')]||_0x14e8('0x62'),_0x3c4679['audioEncoding']||'MP3')['then'](function(_0xd7427f){_0xd1cd5e(null,_0xd7427f);})[_0x14e8('0x18')](function(_0x10e994){_0xd1cd5e(_0x10e994);});};AGIVertices['prototype'][_0x14e8('0x63')]=function(_0x557a0f,_0x50337a){scripts['googleTTS'](_0x557a0f[_0x14e8('0x5e')],_0x557a0f[_0x14e8('0x64')]||'en',0x1)[_0x14e8('0x14')](function(_0x4d29e3){_0x50337a(null,_0x4d29e3);})[_0x14e8('0x18')](function(_0x4f83e9){_0x50337a(_0x4f83e9);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x65')]=function(_0x12db6a,_0x30d7a1){var _0x3ab99d={'uri':_0x12db6a[_0x14e8('0x66')],'method':_0x12db6a[_0x14e8('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x12db6a[_0x14e8('0x68')])===_0x14e8('0x69')&&parseInt(_0x12db6a['timeout'])>=0x1?parseInt(_0x12db6a[_0x14e8('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x14e8('0x6a'),_0x14e8('0x6b')],_0x3ab99d[_0x14e8('0x67')][_0x14e8('0x6c')]())){try{_0x3ab99d[_0x14e8('0x6d')]=_0x12db6a[_0x14e8('0xa')]?JSON[_0x14e8('0x6e')](_0x12db6a[_0x14e8('0xa')]):{};}catch(_0x1b3f84){logger['error'](_0x14e8('0x6f'),_0x1b3f84);}}try{_0x3ab99d[_0x14e8('0x70')]=_0x12db6a[_0x14e8('0x9')]?JSON[_0x14e8('0x6e')](_0x12db6a['rawHeaders']):{};}catch(_0x361eb3){logger[_0x14e8('0x2c')](_0x14e8('0x71'),_0x361eb3);}if(_0x12db6a[_0x14e8('0x72')]){try{var _0x4af04b=require(_0x12db6a[_0x14e8('0x72')])['sync'](this,_0x3ab99d);_0x3ab99d[_0x14e8('0x73')]=Mustache['render'](_0x12db6a['url'],_0x4af04b,{},['$$','$$']);if(_0x3ab99d[_0x14e8('0x70')]){_0x3ab99d[_0x14e8('0x70')]=JSON[_0x14e8('0x6e')](Mustache[_0x14e8('0x74')](JSON[_0x14e8('0x75')](_0x3ab99d[_0x14e8('0x70')]),_0x4af04b,{},['$$','$$']));}if(_0x3ab99d[_0x14e8('0x6d')]){_0x3ab99d[_0x14e8('0x6d')]=JSON[_0x14e8('0x6e')](Mustache[_0x14e8('0x74')](JSON[_0x14e8('0x75')](_0x3ab99d['body']),_0x4af04b,{},['$$','$$']));}}catch(_0x43dbee){logger[_0x14e8('0x2c')](_0x14e8('0x76'),_0x43dbee);}}rp(_0x3ab99d)['then'](function(_0x5a9e57){var _0x2e24fa={'statusCode':_0x5a9e57[_0x14e8('0x77')]||0xc8,'statusMessage':_0x5a9e57[_0x14e8('0x78')]||'OK','headers':_0x5a9e57[_0x14e8('0x70')]||{},'body':_0x5a9e57[_0x14e8('0x6d')]||{}};_0x30d7a1(null,_0x2e24fa);})[_0x14e8('0x18')](function(_0x7ad347){var _0x196815={'statusCode':_0x7ad347[_0x14e8('0x77')]||0x1f4,'statusMessage':_0x7ad347[_0x14e8('0x79')]||_0x14e8('0x7a'),'headers':_0x7ad347[_0x14e8('0x7b')][_0x14e8('0x70')]||{},'body':_0x7ad347[_0x14e8('0x7b')]['body']||{}};_0x30d7a1(null,_0x196815);});};AGIVertices[_0x14e8('0x10')]['googleDialogflow']=function(_0x533006,_0x298f64){scripts[_0x14e8('0x7c')](this[_0x14e8('0xe')][_0x14e8('0x37')],_0x533006[_0x14e8('0x7d')],_0x533006['text'],_0x533006[_0x14e8('0x7e')]||'en')[_0x14e8('0x14')](function(_0x5f4fbf){_0x298f64(null,_0x5f4fbf);})[_0x14e8('0x18')](function(_0x32ef32){_0x298f64(_0x32ef32);});};AGIVertices[_0x14e8('0x10')]['googleDialogflowV2']=function(_0x2f05f7,_0x3f3dab){scripts[_0x14e8('0x7f')](this[_0x14e8('0xe')][_0x14e8('0x37')],_0x2f05f7[_0x14e8('0x80')],_0x2f05f7[_0x14e8('0x81')],_0x2f05f7[_0x14e8('0x82')],_0x2f05f7[_0x14e8('0x5e')],_0x2f05f7[_0x14e8('0x83')]||'en')[_0x14e8('0x14')](function(_0x2491f9){_0x3f3dab(null,_0x2491f9);})['catch'](function(_0x1eb0aa){_0x3f3dab(_0x1eb0aa);});};AGIVertices['prototype']['sestekNDA']=function(_0x26853c,_0x5d5c64){scripts[_0x14e8('0x84')](this[_0x14e8('0xe')],_0x26853c)[_0x14e8('0x14')](function(_0x28886b){_0x5d5c64(null,_0x28886b);})['catch'](function(_0x15dbd9){_0x5d5c64(_0x15dbd9);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x85')]=function(_0x509c76,_0x4aec7d){scripts[_0x14e8('0x85')](_0x509c76[_0x14e8('0x7d')],_0x509c76[_0x14e8('0x5e')],_0x509c76['ispeech_tts_language']||_0x14e8('0x60'),_0x509c76[_0x14e8('0x86')])['then'](function(_0x2c7c45){_0x4aec7d(null,_0x2c7c45);})[_0x14e8('0x18')](function(_0x18624f){_0x4aec7d(_0x18624f);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x87')]=function(_0x2015d3,_0x1627c0,_0x1fd8eb){scripts[_0x14e8('0x87')](_0x1627c0,_0x2015d3[_0x14e8('0x7d')],_0x2015d3['ispeech_asr_language']||_0x14e8('0x60'),this['isConfigured'](_0x2015d3[_0x14e8('0x88')])?_0x2015d3[_0x14e8('0x88')]:undefined)[_0x14e8('0x14')](function(_0x58fa79){_0x1fd8eb(null,_0x58fa79);})['catch'](function(_0x43489d){_0x1fd8eb(_0x43489d);});};AGIVertices[_0x14e8('0x10')][_0x14e8('0x89')]=function(_0x209e12,_0xb2bf5c){scripts[_0x14e8('0x89')](_0x209e12['aws_access_key_id'],_0x209e12[_0x14e8('0x8a')],_0x209e12['aws_polly_region'],_0x209e12[_0x14e8('0x8b')]||_0x14e8('0x8c'),_0x209e12[_0x14e8('0x5e')],_0x209e12['aws_text_type']||_0x14e8('0x5e'))[_0x14e8('0x14')](function(_0x2bd242){_0xb2bf5c(null,_0x2bd242);})[_0x14e8('0x18')](function(_0x2d148f){_0xb2bf5c(_0x2d148f);});};AGIVertices['prototype'][_0x14e8('0x8d')]=function(_0x2cb268,_0x5068f6){scripts['awsLex'](this['channel'][_0x14e8('0x37')],_0x2cb268['aws_access_key_id'],_0x2cb268[_0x14e8('0x8a')],_0x2cb268[_0x14e8('0x8e')],_0x2cb268[_0x14e8('0x5e')],_0x2cb268[_0x14e8('0x8f')])[_0x14e8('0x14')](function(_0x2b554f){_0x5068f6(null,_0x2b554f);})[_0x14e8('0x18')](function(_0x4b6a71){_0x5068f6(_0x4b6a71);});};AGIVertices[_0x14e8('0x10')]['googleASR']=function(_0x3578af,_0x5f123a,_0x351dd6){scripts[_0x14e8('0x90')](_0x5f123a,_0x3578af['key'],_0x3578af[_0x14e8('0x91')]||'en-US')[_0x14e8('0x14')](function(_0x15515b){_0x351dd6(null,_0x15515b);})[_0x14e8('0x18')](function(_0x5cd93d){_0x351dd6(_0x5cd93d);});};AGIVertices[_0x14e8('0x10')]['tildeASR']=function(_0xcb4d16,_0x53d846,_0x5f5283){scripts['tildeASR'](_0x53d846,_0xcb4d16[_0x14e8('0x92')],_0xcb4d16[_0x14e8('0x93')],_0xcb4d16[_0x14e8('0x73')])[_0x14e8('0x14')](function(_0x59f340){_0x5f5283(null,_0x59f340);})['catch'](function(_0x47238f){_0x5f5283(_0x47238f);});};AGIVertices['prototype'][_0x14e8('0x94')]=function(_0x2a5874){var _0x5157b2=_['includes'](verticesWithRetry,_0x2a5874[_0x14e8('0x39')])?_0x2a5874:_[_0x14e8('0x95')](_0x2a5874);for(var _0x21ab5b in _0x5157b2){if(_0x5157b2['hasOwnProperty'](_0x21ab5b)){if(_0x5157b2[_0x21ab5b]&&_[_0x14e8('0x96')](_0x5157b2[_0x21ab5b])){if(_['includes'](recursiveMapAttributes,_0x21ab5b)){_0x5157b2[_0x21ab5b]=this[_0x14e8('0x97')](_0x5157b2[_0x21ab5b]);}else{_0x5157b2[_0x21ab5b]=this[_0x14e8('0x98')](_0x5157b2[_0x21ab5b]);}}}}return _0x5157b2;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x99')]=function(_0x253844){for(var _0x24c093 in _0x253844){if(_0x253844[_0x14e8('0x9a')](_0x24c093)){if(_[_0x14e8('0x9b')](_0x253844[_0x24c093])){this[_0x14e8('0x99')](_0x253844[_0x24c093]);}else if(_[_0x14e8('0x9c')](_0x253844[_0x24c093])){for(var _0x2c50a8=0x0;_0x2c50a8<_0x253844[_0x24c093][_0x14e8('0x9d')];_0x2c50a8++){this['recursiveNodeIndex'](_0x253844[_0x24c093][_0x2c50a8]);}}else if(_[_0x14e8('0x96')](_0x253844[_0x24c093])){_0x253844[_0x24c093]=this[_0x14e8('0x98')](_0x253844[_0x24c093]);}}}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x9e')]=function(_0x54dd09,_0x2f342d){for(var _0x5ba50f in _0x54dd09){if(_0x54dd09[_0x14e8('0x9a')](_0x5ba50f)){if(_[_0x14e8('0x9b')](_0x54dd09[_0x5ba50f])){if(!_[_0x14e8('0x46')](_0x54dd09[_0x5ba50f])){this[_0x14e8('0x9e')](_0x54dd09[_0x5ba50f],util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x2f342d,_0x5ba50f));}}else if(_[_0x14e8('0x9c')](_0x54dd09[_0x5ba50f])){for(var _0x3f38ea=0x0;_0x3f38ea<_0x54dd09[_0x5ba50f][_0x14e8('0x9d')];_0x3f38ea++){this[_0x14e8('0x9e')](_0x54dd09[_0x5ba50f][_0x3f38ea],util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x2f342d,_0x5ba50f+'['+_0x3f38ea+']'));}}else{if(!_[_0x14e8('0x47')](_0x54dd09[_0x5ba50f])){this['channel']['setVariable'](util[_0x14e8('0x28')]('%s.%s',_0x2f342d,_0x5ba50f),_0x54dd09[_0x5ba50f]);}}}}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x97')]=function(_0x4f9858){try{var _0x312ab0=JSON[_0x14e8('0x6e')](_0x4f9858);this[_0x14e8('0x99')](_0x312ab0);return JSON[_0x14e8('0x75')](_0x312ab0);}catch(_0x2d2a21){return this[_0x14e8('0x98')](_0x4f9858);}};AGIVertices['prototype'][_0x14e8('0x98')]=function(_0x3d2ec1){var _0x3e3f60=_0x3d2ec1[_0x14e8('0xa0')]('{');for(var _0x2e7cb9=0x1;_0x2e7cb9<_0x3e3f60['length'];_0x2e7cb9+=0x1){var _0x2c8d86=_0x3e3f60[_0x2e7cb9]['split']('}');if(_0x2c8d86['length']>0x1){_0x3d2ec1=_0x3d2ec1[_0x14e8('0xa1')]('{'+_0x2c8d86[0x0]+'}',this[_0x14e8('0xe')]['getVariable'](_0x2c8d86[0x0])[_0x14e8('0xa2')]||_0x2c8d86[0x0]);}}if(_0x3e3f60['length']===0x1){return _0x3d2ec1[_0x14e8('0x4f')]();}return this[_0x14e8('0x98')](_0x3d2ec1);};AGIVertices['prototype'][_0x14e8('0xa3')]=function(_0x40b6da,_0xb5c786){var _0x154ed0=this[_0x14e8('0xe')]['getVariable'](_0x40b6da);if(_0x154ed0[_0x14e8('0xa4')]===-0x1){return _0x154ed0;}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xb5c786,_0x154ed0['extra']));return this[_0x14e8('0xe')]['setVariable'](_0xb5c786,_0x154ed0['extra']);};AGIVertices[_0x14e8('0x10')]['isConfigured']=function(_0x47d5be){return _0x47d5be&&_0x47d5be!=='0'&&_0x47d5be!=='-1'&&_0x47d5be!=='';};AGIVertices[_0x14e8('0x10')][_0x14e8('0xa5')]=function(_0x7d515f){this['createSquareDetailsReport'][_0x14e8('0xa6')](this,_0x7d515f,'-');_0x7d515f['retry']=_0x7d515f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x14e8('0xa7')]=function(_0x23fa20){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xa8'),_0x23fa20['label']));if(!this[_0x14e8('0xa9')](_0x23fa20[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x39edc6='\x22'+_0x23fa20[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x23fa20[_0x14e8('0x7b')])){_0x39edc6+=','+_0x23fa20[_0x14e8('0x7b')];}var _0x2e61d3=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0xad'),_0x39edc6);if(_0x2e61d3[_0x14e8('0xa4')]===-0x1){return _0x2e61d3;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xae'),_0x39edc6));};AGIVertices[_0x14e8('0x10')]['mrcprecog']=function(_0x2f5465){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xaf'),_0x2f5465['label']));if(!this[_0x14e8('0xa9')](_0x2f5465[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x28ce0b=_0x2f5465[_0x14e8('0xb0')];if(this[_0x14e8('0xa9')](_0x2f5465['options'])){_0x28ce0b+=','+_0x2f5465[_0x14e8('0x7b')];}var _0x1e8b93=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0xb2'),_0x28ce0b);if(_0x1e8b93[_0x14e8('0xa4')]===-0x1){return _0x1e8b93;}var _0x4874b0=this[_0x14e8('0xa3')](_0x14e8('0xb3'),_0x14e8('0xb4'));if(_0x4874b0[_0x14e8('0xa4')]===-0x1){return _0x4874b0;}var _0x647f1c=this['getAndSetVariable'](_0x14e8('0xb5'),_0x14e8('0xb6'));if(_0x647f1c[_0x14e8('0xa4')]===-0x1){return _0x647f1c;}var _0x278dfb=this[_0x14e8('0xa3')](_0x14e8('0xb7'),_0x14e8('0xb8'));if(_0x278dfb[_0x14e8('0xa4')]===-0x1){return _0x278dfb;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x28ce0b));};AGIVertices['prototype'][_0x14e8('0x6')]=function(_0x547489){logger['info'](util[_0x14e8('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x547489[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x6')]([_0x547489[_0x14e8('0xba')],_0x547489[_0x14e8('0xbb')]]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0xbc')]=function(_0x143ae3){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xbd'),_0x143ae3[_0x14e8('0x38')]));if(this[_0x14e8('0xa9')](_0x143ae3[_0x14e8('0x68')])){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x143ae3['timeout']));var _0x539785=this[_0x14e8('0xe')][_0x14e8('0xbe')](_0x143ae3['timeout']);if(_0x539785[_0x14e8('0xa4')]===-0x1){return _0x539785;}}return this['channel'][_0x14e8('0xbc')]();};AGIVertices[_0x14e8('0x10')][_0x14e8('0x4c')]=function(_0x5b0a99){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xbf'),_0x5b0a99[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5b0a99[_0x14e8('0x4b')])){return this['channel'][_0x14e8('0x2c')](_0x5b0a99,_0x14e8('0xc0'));}_0x5b0a99[_0x14e8('0x4e')]=moment();if(this['isConfigured'](_0x5b0a99['delay'])){_0x5b0a99[_0x14e8('0x4e')]=moment()[_0x14e8('0xc1')](_0x5b0a99[_0x14e8('0xc2')],_0x14e8('0xc3'));}if(!this[_0x14e8('0xa9')](_0x5b0a99['callback_priority'])){_0x5b0a99['callback_priority']=0x2;}this['createCmContact'][_0x14e8('0xa6')](this,_0x5b0a99);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5b0a99['phone'],_0x5b0a99[_0x14e8('0x4b')],_0x5b0a99[_0x14e8('0x4e')]));};AGIVertices['prototype'][_0x14e8('0xc4')]=function(_0x92e465){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xc5'),_0x92e465[_0x14e8('0x38')]));var _0x383f70=this[_0x14e8('0xe')]['exec'](_0x92e465[_0x14e8('0xc6')],_0x92e465[_0x14e8('0x7b')]);if(_0x383f70[_0x14e8('0xa4')]===-0x1){return _0x383f70;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x92e465['application'],_0x92e465[_0x14e8('0x7b')]));};AGIVertices[_0x14e8('0x10')]['lumenvoxtts']=function(_0x4a77c5){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xc7'),_0x4a77c5[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x4a77c5[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x2be0b5='\x22'+_0x4a77c5[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x4a77c5[_0x14e8('0x7b')])){_0x2be0b5+=','+_0x4a77c5[_0x14e8('0x7b')];}var _0x555704=this['channel'][_0x14e8('0xac')](_0x14e8('0xad'),_0x2be0b5);if(_0x555704[_0x14e8('0xa4')]===-0x1){return _0x555704;}return this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0xae'),_0x2be0b5));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xc8')]=function(_0x4caca6){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xc9'),_0x4caca6[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x4caca6['text'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}var _0x3117a1='\x22'+_0x4caca6[_0x14e8('0x5e')]+'\x22';if(this[_0x14e8('0xa9')](_0x4caca6[_0x14e8('0x7b')])){_0x3117a1+=','+_0x4caca6['options'];}var _0x210cbc=this['channel']['exec'](_0x14e8('0xad'),_0x3117a1);if(_0x210cbc[_0x14e8('0xa4')]===-0x1){return _0x210cbc;}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0xae'),_0x3117a1));};AGIVertices[_0x14e8('0x10')]['lumenvoxasr']=function(_0x5e961b){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xca'),_0x5e961b[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5e961b[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x356320=_0x5e961b[_0x14e8('0xb0')];if(this['isConfigured'](_0x5e961b[_0x14e8('0x7b')])){_0x356320+=','+_0x5e961b[_0x14e8('0x7b')];}var _0x344da8=this['channel'][_0x14e8('0xac')](_0x14e8('0xb2'),_0x356320);if(_0x344da8[_0x14e8('0xa4')]===-0x1){return _0x344da8;}var _0x567cfc=this[_0x14e8('0xa3')](_0x14e8('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x567cfc[_0x14e8('0xa4')]===-0x1){return _0x567cfc;}var _0x30c593=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x30c593['result']===-0x1){return _0x30c593;}var _0x4215ec=this[_0x14e8('0xa3')](_0x14e8('0xb7'),'LUMENVOX_ASR_INSTANCE');if(_0x4215ec[_0x14e8('0xa4')]===-0x1){return _0x4215ec;}return this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x356320));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xcb')]=function(_0xe2c10e){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0xcc'),_0xe2c10e[_0x14e8('0x38')]));if(!this['isConfigured'](_0xe2c10e[_0x14e8('0xb0')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xb1'));}var _0x2d1b6a=_0xe2c10e[_0x14e8('0xb0')];if(this['isConfigured'](_0xe2c10e[_0x14e8('0x7b')])){_0x2d1b6a+=','+_0xe2c10e[_0x14e8('0x7b')];}var _0x596d7b=this['channel']['exec'](_0x14e8('0xb2'),_0x2d1b6a);if(_0x596d7b[_0x14e8('0xa4')]===-0x1){return _0x596d7b;}var _0x5c85ab=this[_0x14e8('0xa3')](_0x14e8('0xb3'),_0x14e8('0xcd'));if(_0x5c85ab[_0x14e8('0xa4')]===-0x1){return _0x5c85ab;}var _0x418ff2=this[_0x14e8('0xa3')](_0x14e8('0xb5'),_0x14e8('0xce'));if(_0x418ff2[_0x14e8('0xa4')]===-0x1){return _0x418ff2;}var _0x551ef3=this[_0x14e8('0xa3')]('RECOG_INSTANCE()',_0x14e8('0xcf'));if(_0x551ef3['result']===-0x1){return _0x551ef3;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xb9'),_0x2d1b6a));};AGIVertices['prototype'][_0x14e8('0xd0')]=function(_0x2d9891){logger['info'](util[_0x14e8('0x28')](_0x14e8('0xd1'),_0x2d9891[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd2')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd3'));}var _0x2d3d2c=this['getSquareOdbc'][_0x14e8('0xa6')](this,_0x2d9891[_0x14e8('0xd2')]);if(!_0x2d3d2c){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd4'));}if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd5')])){return this['channel'][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd6'));}var _0x342aa9=_0x2d9891['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xd7'),_0x342aa9));var _0x5b739d=this[_0x14e8('0x2a')][_0x14e8('0xa6')](this,_0x2d3d2c,_0x342aa9);this[_0x14e8('0x36')]['sync'](this,_0x2d9891,_0x342aa9);if(!this[_0x14e8('0xa9')](_0x2d9891[_0x14e8('0xd8')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2f74ab=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x2d9891[_0x14e8('0xd8')]);if(!_0x2f74ab){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2d9891,_0x14e8('0xd9'));}var _0x406525=this;_0x5b739d[_0x14e8('0xda')](function(_0x4aedb6,_0x2f2317){Object[_0x14e8('0xdb')](_0x4aedb6)[_0x14e8('0xda')](function(_0x17ce0c){_0x406525['channel'][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0xdd'),_0x2f74ab,_0x2f2317,_0x17ce0c),_0x4aedb6[_0x17ce0c]);});});this['channel'][_0x14e8('0xdc')](util['format'](_0x14e8('0xde'),_0x2f74ab),_0x5b739d['length']);return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xdf'),_0x2f74ab));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xe0')]=function(_0x38f311){logger[_0x14e8('0xe1')](util['format'](_0x14e8('0xe2'),_0x38f311[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x38f311['sip_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x38f311,'no\x20user\x20selected');}var _0x1a330f=this['getUser'][_0x14e8('0xa6')](this,_0x38f311['sip_id']);if(!_0x1a330f){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x38f311,_0x14e8('0xe3'));}var _0x21c129=this[_0x14e8('0xe')]['exec']('DIAL',[util[_0x14e8('0x28')]('SIP/%s',_0x1a330f),_0x38f311['timeout'],_0x38f311[_0x14e8('0xe4')],_0x38f311[_0x14e8('0x66')]]);if(_0x21c129['result']===-0x1){return _0x21c129;}return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xe5'),'DIAL'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xe6')]=function(_0x275fb0){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xe7'),_0x275fb0['label']));if(!this['isConfigured'](_0x275fb0[_0x14e8('0x7d')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0xe8'));}if(!this['isConfigured'](_0x275fb0[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['bot']=!![];this[_0x14e8('0x36')](_0x275fb0);this[_0x14e8('0x44')](_0x275fb0[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Trying\x20Dialogflow:\x20%s',_0x275fb0[_0x14e8('0x5e')]));var _0x400b86=this['googleDialogflow'][_0x14e8('0xa6')](this,_0x275fb0);if(_0x400b86){for(var _0x2b2e71 in _0x400b86){if(_0x400b86['hasOwnProperty'](_0x2b2e71)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0xe9'),_0x2b2e71[_0x14e8('0x6c')]()),_0x400b86[_0x2b2e71]);}}this[_0x14e8('0x44')](_0x400b86['speech'],_0x14e8('0xea'),_0x14e8('0xe6'),'');return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xeb'),_0x400b86['speech']));}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x275fb0,_0x14e8('0xec'));};AGIVertices['prototype'][_0x14e8('0xed')]=function(_0x4650f6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0xee'),_0x4650f6['label']));if(!this[_0x14e8('0xa9')](_0x4650f6[_0x14e8('0x80')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xef'));}if(!this['isConfigured'](_0x4650f6[_0x14e8('0x81')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xf0'));}if(!this[_0x14e8('0xa9')](_0x4650f6['private_key'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xf1'));}if(!this[_0x14e8('0xa9')](_0x4650f6['dialogflowV2_language'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x4650f6['text'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20text\x20configured');}this[_0x14e8('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x4650f6);this[_0x14e8('0x44')](_0x4650f6[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0xf2'),_0x4650f6[_0x14e8('0x5e')]));var _0x4ec5df=this[_0x14e8('0x7f')]['sync'](this,_0x4650f6);if(_0x4ec5df){for(var _0xfce0a7 in _0x4ec5df){if(_0x4ec5df[_0x14e8('0x9a')](_0xfce0a7)){if(_0xfce0a7!==_0x14e8('0xf3')){this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0xe9'),_0xfce0a7['toUpperCase']()),_0x4ec5df[_0xfce0a7]);}}}this[_0x14e8('0x44')](_0x4ec5df[_0x14e8('0xf4')],_0x14e8('0xea'),_0x14e8('0xed'),_0x4ec5df[_0x14e8('0xf3')]);return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0xf5'),_0x4ec5df[_0x14e8('0xf4')]));}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x4650f6,_0x14e8('0xf6'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0xf7')]=function(_0x31049c){logger['info'](util[_0x14e8('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x31049c[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xf8')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0xf9'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfa')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xfb'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfc')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xfd'));}if(!this[_0x14e8('0xa9')](_0x31049c[_0x14e8('0xfe')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')][_0x14e8('0xff')]=!![];this[_0x14e8('0x36')](_0x31049c);this[_0x14e8('0x44')](_0x31049c[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x100'),_0x31049c[_0x14e8('0x5e')]));var _0x34d140=this[_0x14e8('0x84')][_0x14e8('0xa6')](this,_0x31049c);if(_0x34d140){for(var _0x56cfed in _0x34d140){if(_0x34d140[_0x14e8('0x9a')](_0x56cfed)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')]('SESTEK_NDA_%s',_0x56cfed[_0x14e8('0x6c')]()),_0x34d140[_0x56cfed]);}}this[_0x14e8('0x44')](_0x34d140[_0x14e8('0xf4')],_0x14e8('0xea'),'sesteknda','');if(_0x34d140[_0x14e8('0x101')]){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x102'),_0x34d140[_0x14e8('0x101')]));var _0x320761=this[_0x14e8('0xe')][_0x14e8('0x103')](_0x34d140[_0x14e8('0x101')]);try{fs['unlink'](_0x34d140[_0x14e8('0x101')]+_0x14e8('0x104'));}catch(_0x13b31b){logger['error'](_0x13b31b);}return _0x320761;}else{return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x105'),_0x34d140[_0x14e8('0xf4')]));}}return this[_0x14e8('0xe')]['error'](_0x31049c,_0x14e8('0x106'));};AGIVertices['prototype'][_0x14e8('0x107')]=function(_0x121d1b){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x108'),_0x121d1b[_0x14e8('0x38')]));return this['channel'][_0x14e8('0xaa')](_0x14e8('0x107'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x109')]=function(_0x277b37){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x10a'),_0x277b37[_0x14e8('0x38')]));var _0x4c8810='';if(_0x277b37[_0x14e8('0x10b')]){if(!this[_0x14e8('0xa9')](_0x277b37[_0x14e8('0x10b')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,_0x14e8('0x10c'));}else{var _0x1c9e3b=parseInt(_0x277b37['trunk_id'],0xa);if(isNaN(_0x1c9e3b)){_0x4c8810=_0x277b37[_0x14e8('0x10b')];}else{_0x4c8810=this[_0x14e8('0x10d')][_0x14e8('0xa6')](this,_0x277b37[_0x14e8('0x10b')]);if(!_0x4c8810){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,_0x14e8('0x10e'));}}}}else if(_0x277b37[_0x14e8('0x10f')]){_0x4c8810=_0x277b37[_0x14e8('0x10f')];}else{return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x277b37,'no\x20trunk\x20selected');}var _0x49afd1=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x110'),[util['format'](_0x14e8('0x111'),_0x4c8810,_0x277b37[_0x14e8('0x4a')]),_0x277b37[_0x14e8('0x68')],_0x277b37[_0x14e8('0xe4')],_0x277b37[_0x14e8('0x66')]]);if(_0x49afd1[_0x14e8('0xa4')]===-0x1){return _0x49afd1;}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0xe5'),_0x14e8('0x110')));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x112')]=function(_0x2816fd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2816fd[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x112'));};AGIVertices['prototype'][_0x14e8('0xc')]=function(_0x108efc){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x113'),_0x108efc[_0x14e8('0x38')]));if(_0x108efc['retry']===0x0){return this['maxRetry'](_0x108efc);}_0x108efc[_0x14e8('0x114')]-=0x1;if(!this['isConfigured'](_0x108efc[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,'no\x20file\x20audio\x20selected');}var _0x333a9b=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x108efc[_0x14e8('0x115')]);if(!_0x333a9b){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,_0x14e8('0x116'));}if(!this[_0x14e8('0xa9')](_0x108efc['variable_id'])){return this[_0x14e8('0xe')]['error'](_0x14e8('0x117'));}var _0x479498=this['channel'][_0x14e8('0x118')](_0x333a9b,_0x108efc[_0x14e8('0x119')],_0x108efc[_0x14e8('0x11a')]);var _0x449cd2=_0x479498[_0x14e8('0xa4')]?_0x479498[_0x14e8('0xa4')][_0x14e8('0x4f')]():'';logger[_0x14e8('0x2e')](_0x14e8('0x11b'),JSON['stringify'](_0x479498));if(_0x479498[_0x14e8('0xa4')]===-0x1){this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x449cd2);return _0x479498;}else if(_0x479498[_0x14e8('0xa2')]===_0x14e8('0x68')){_0x479498[_0x14e8('0xa4')]=_0x449cd2['length']>=parseInt(_0x108efc[_0x14e8('0x11c')])?'x':'i';}else{_0x479498[_0x14e8('0xa4')]=_0x449cd2[_0x14e8('0x9d')]>=parseInt(_0x108efc['mindigit'])&&_0x449cd2[_0x14e8('0x9d')]<=parseInt(_0x108efc['maxdigit'])?'x':'i';}var _0x24af11=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x108efc[_0x14e8('0xd8')]);if(!_0x24af11){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x108efc,_0x14e8('0xd9'));}this['channel'][_0x14e8('0xdc')](_0x24af11,_0x449cd2);if(this[_0x14e8('0xa9')](_0x108efc[_0x14e8('0x11d')])){var _0x4fb1bd=parseInt(_0x108efc[_0x14e8('0x11d')],0xa);var _0x314dfe=rs[_0x14e8('0x11e')]({'charset':'*','length':_0x4fb1bd});var _0x5caa1b=_0x449cd2[_0x14e8('0x9d')];if(_0x5caa1b>0x0){if(_0x5caa1b>_0x4fb1bd){this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x108efc[_0x14e8('0x11f')]==='first'?_0x314dfe+_0x449cd2['substr'](_0x4fb1bd):_0x449cd2[_0x14e8('0x120')](0x0,_0x5caa1b-_0x4fb1bd)+_0x314dfe);}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,rs['generate']({'charset':'*','length':_0x5caa1b}));}}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,'');}}else{this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x108efc,_0x449cd2);}return _0x479498;};AGIVertices['prototype'][_0x14e8('0xd')]=function(_0x53ec26){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x121'),_0x53ec26[_0x14e8('0x38')]));return this[_0x14e8('0xc')](_0x53ec26);};AGIVertices['prototype']['goal']=function(_0xaa3049){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xaa3049[_0x14e8('0x38')]));this[_0x14e8('0x36')]['sync'](this,_0xaa3049,_0xaa3049[_0x14e8('0x122')]);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x123'),_0xaa3049[_0x14e8('0x122')]));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x124')]=function(_0x2c33ca){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x125'),_0x2c33ca[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2c33ca[_0x14e8('0x126')])||!this['isConfigured'](_0x2c33ca[_0x14e8('0x8a')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2c33ca[_0x14e8('0x5e')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x127'),_0x2c33ca['text']));var _0x5a7dac=this[_0x14e8('0x89')][_0x14e8('0xa6')](this,_0x2c33ca);if(_0x5a7dac){this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x128'),_0x5a7dac));var _0x1b5cf8=this[_0x14e8('0xe')][_0x14e8('0x103')](_0x5a7dac);try{fs[_0x14e8('0x129')](_0x5a7dac+_0x14e8('0x104'));}catch(_0xd4c74f){logger[_0x14e8('0x2c')](_0xd4c74f);}return _0x1b5cf8;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2c33ca,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x14e8('0x10')][_0x14e8('0x12a')]=function(_0x976315){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x976315[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x126')])||!this[_0x14e8('0xa9')](_0x976315['aws_secret_access_key'])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x8f')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20bot\x20name\x20configured');}if(!this[_0x14e8('0xa9')](_0x976315[_0x14e8('0x5e')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x14e8('0xe')][_0x14e8('0xff')]=!![];this[_0x14e8('0x36')](_0x976315);this[_0x14e8('0x44')](_0x976315[_0x14e8('0x5e')],'in','','');this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x12b'),_0x976315[_0x14e8('0x5e')]));var _0x443357=this['awsLex'][_0x14e8('0xa6')](this,_0x976315);if(_0x443357){for(var _0x1f9b54 in _0x443357){if(_0x443357[_0x14e8('0x9a')](_0x1f9b54)&&_[_0x14e8('0x96')](_0x443357[_0x1f9b54])){this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x12c'),_0x1f9b54[_0x14e8('0x6c')]()),_0x443357[_0x1f9b54]);}}if(_[_0x14e8('0x47')](_0x443357[_0x14e8('0x79')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x12d'));}else{this[_0x14e8('0x44')](_0x443357[_0x14e8('0x79')],_0x14e8('0xea'),_0x14e8('0x12e'),'');return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x12f'),_0x443357[_0x14e8('0x79')]));}}return this[_0x14e8('0xe')]['error'](_0x976315,_0x14e8('0x130'));};AGIVertices['prototype'][_0x14e8('0x131')]=function(_0x196a82){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x132'),_0x196a82[_0x14e8('0x38')],_0x196a82['timeout']));if(!this['isConfigured'](_0x196a82[_0x14e8('0x7d')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xe8'));}var _0x34c03f='wav';var _0x5eb492=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs[_0x14e8('0x11e')](0x4));var _0x4f4da8=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x5eb492,_0x34c03f);var _0x1f2d35=!![];if(_0x196a82[_0x14e8('0x134')]==='NOBEEP'){_0x1f2d35=![];}var _0x4e0723=this['channel'][_0x14e8('0x135')](_0x5eb492,_0x34c03f,_0x196a82[_0x14e8('0x136')],_0x196a82[_0x14e8('0x68')],undefined,_0x1f2d35);if(_0x4e0723[_0x14e8('0xa4')]!==-0x1){this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x137'),_0x4f4da8));var _0x1d2f1a=this[_0x14e8('0x90')][_0x14e8('0xa6')](this,_0x196a82,_0x4f4da8);if(_0x1d2f1a){for(var _0x3e67d4 in _0x1d2f1a){if(_0x1d2f1a[_0x14e8('0x9a')](_0x3e67d4)){this[_0x14e8('0xe')]['setVariable'](util['format'](_0x14e8('0x138'),_0x3e67d4[_0x14e8('0x6c')]()),_0x1d2f1a[_0x3e67d4]);}}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format']('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x1d2f1a)));}}return _0x4e0723;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x139')]=function(_0xd9d0cd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x13a'),_0xd9d0cd['label']));if(!this[_0x14e8('0xa9')](_0xd9d0cd[_0x14e8('0x92')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x13b'));}if(!this[_0x14e8('0xa9')](_0xd9d0cd[_0x14e8('0x93')])){return this[_0x14e8('0xe')]['noop'](_0x14e8('0x13c'));}var _0x3f6a2f=_0x14e8('0x13d');var _0xd1bb9e=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs[_0x14e8('0x11e')](0x4));var _0x1f4157=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0xd1bb9e,_0x3f6a2f);var _0x27a7d3=!![];if(_0xd9d0cd['beep']===_0x14e8('0x13e')){_0x27a7d3=![];}var _0x2db9f6=this[_0x14e8('0xe')][_0x14e8('0x135')](_0xd1bb9e,_0x3f6a2f,_0xd9d0cd[_0x14e8('0x136')],_0xd9d0cd[_0x14e8('0x68')],undefined,_0x27a7d3);if(_0x2db9f6['result']!==-0x1){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x13f'),_0x1f4157));var _0xc77233=this[_0x14e8('0x140')][_0x14e8('0xa6')](this,_0xd9d0cd,_0x1f4157);if(_0xc77233){for(var _0x24f5e5 in _0xc77233){if(_0xc77233['hasOwnProperty'](_0x24f5e5)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0x141'),_0x24f5e5[_0x14e8('0x6c')]()),_0xc77233[_0x24f5e5]);}}return this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x142'),JSON[_0x14e8('0x75')](_0xc77233)));}}return _0x2db9f6;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x143')]=function(_0x59421d){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x144'),_0x59421d['label']));return this[_0x14e8('0xe')]['continueAt'](_0x59421d[_0x14e8('0x3d')],_0x59421d[_0x14e8('0x3e')],_0x59421d[_0x14e8('0x3f')]);};AGIVertices[_0x14e8('0x10')]['gotoif']=function(_0x122317){logger['info'](util['format'](_0x14e8('0x145'),_0x122317['label']));if(!this[_0x14e8('0xa9')](_0x122317[_0x14e8('0x146')])){return this[_0x14e8('0xe')]['error'](_0x122317,_0x14e8('0x147'));}try{var _0x3eb885=eval(_0x122317[_0x14e8('0x146')])?_0x14e8('0x148'):_0x14e8('0x149');this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x14a'),_0x122317['condition'],_0x3eb885));return{'code':0xc8,'result':_0x3eb885};}catch(_0x6f5bb8){return{'code':0xc8,'result':_0x14e8('0x149')};}};AGIVertices[_0x14e8('0x10')]['gotoiftime']=function(_0x560cbd){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x560cbd[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x560cbd['interval_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x560cbd,_0x14e8('0x14b'));}var _0x4d9871=this[_0x14e8('0x22')][_0x14e8('0xa6')](this,_0x560cbd['interval_id']);if(!_0x4d9871){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x560cbd,_0x14e8('0x14c'));}for(var _0x5adcd5=0x0;_0x5adcd5<_0x4d9871[_0x14e8('0x9d')];_0x5adcd5+=0x1){var _0x4a8df3=this['channel'][_0x14e8('0x11')](util[_0x14e8('0x28')]('IFTIME(%s?true:false)',_0x4d9871[_0x5adcd5]));if(_0x4a8df3['result']===-0x1){return _0x4a8df3;}logger['info'](util[_0x14e8('0x28')]('IFTIME\x20%s\x20%s',_0x4d9871[_0x5adcd5],_0x4a8df3[_0x14e8('0xa2')]));if(_0x4a8df3[_0x14e8('0xa2')]===_0x14e8('0x148')){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x148')));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x148')));return{'code':0xc8,'result':_0x14e8('0x148')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('IFTIME\x20%s\x20%s',_0x4d9871[_0x5adcd5],_0x14e8('0x149')));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x14d'),_0x4d9871[_0x5adcd5],_0x14e8('0x149')));}}return{'code':0xc8,'result':_0x14e8('0x149')};};AGIVertices[_0x14e8('0x10')][_0x14e8('0x14e')]=function(_0x924cbe){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x924cbe[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x14e')]();};AGIVertices[_0x14e8('0x10')][_0x14e8('0x14f')]=function(_0x5addbb){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5addbb[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5addbb[_0x14e8('0x7d')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xe8'));}var _0x3e08cb=_0x14e8('0x13d');var _0x51a472=util[_0x14e8('0x28')](_0x14e8('0x133'),FILES_PATH,rs['generate'](0x4));var _0x1fdc63=util[_0x14e8('0x28')](_0x14e8('0x9f'),_0x51a472,_0x3e08cb);var _0x3d625f=!![];if(_0x5addbb[_0x14e8('0x134')]===_0x14e8('0x13e')){_0x3d625f=![];}var _0x18338a=this[_0x14e8('0xe')][_0x14e8('0x135')](_0x51a472,_0x3e08cb,_0x5addbb[_0x14e8('0x136')],_0x5addbb[_0x14e8('0x68')],undefined,_0x3d625f);if(_0x18338a['result']!==-0x1){this[_0x14e8('0xe')][_0x14e8('0xaa')](util['format'](_0x14e8('0x150'),_0x1fdc63));var _0x209ddd=this[_0x14e8('0x87')]['sync'](this,_0x5addbb,_0x1fdc63);if(_0x209ddd){for(var _0x11619a in _0x209ddd){if(_0x209ddd['hasOwnProperty'](_0x11619a)){this[_0x14e8('0xe')][_0x14e8('0xdc')](util[_0x14e8('0x28')](_0x14e8('0x151'),_0x11619a[_0x14e8('0x6c')]()),_0x209ddd[_0x11619a]);}}return this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x152'),JSON[_0x14e8('0x75')](_0x209ddd)));}}return _0x18338a;};AGIVertices[_0x14e8('0x10')][_0x14e8('0x153')]=function(_0x31a0ce){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x154'),_0x31a0ce[_0x14e8('0x38')]));if(!this['isConfigured'](_0x31a0ce[_0x14e8('0x7d')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xe8'));}if(!this['isConfigured'](_0x31a0ce[_0x14e8('0x5e')])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x155'),_0x31a0ce['text']));var _0x2c412f=this[_0x14e8('0x85')][_0x14e8('0xa6')](this,_0x31a0ce);if(_0x2c412f){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x150'),_0x2c412f));var _0x5d077f=this['channel'][_0x14e8('0x103')](_0x2c412f,_0x31a0ce[_0x14e8('0x136')]);try{fs[_0x14e8('0x129')](_0x2c412f+_0x14e8('0x104'));}catch(_0x3dbdf9){logger[_0x14e8('0x2c')](_0x3dbdf9);}return _0x5d077f;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x31a0ce,_0x14e8('0x156'));};AGIVertices['prototype'][_0x14e8('0x157')]=function(_0x2aa24b){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x158'),_0x2aa24b[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x2aa24b[_0x14e8('0x159')])){return this[_0x14e8('0xe')]['error'](_0x2aa24b,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));var _0x10de51=this['agentLogin'][_0x14e8('0xa6')](this,_0x2aa24b[_0x14e8('0x159')]);if(_0x10de51){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));this['channel']['noop'](util[_0x14e8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x2aa24b[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x15f')]=function(_0x28c73a){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x28c73a[_0x14e8('0x38')]));if(!this['isConfigured'](_0x28c73a[_0x14e8('0x159')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x28c73a,'no\x20find\x20by\x20configured');}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x14e8('0x3a')],_0x28c73a[_0x14e8('0x159')]));var _0x2be58f=this[_0x14e8('0x55')]['sync'](this,_0x28c73a[_0x14e8('0x159')]);if(_0x2be58f){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this['channel']['callerid'],_0x28c73a[_0x14e8('0x159')]));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a['findBy']));return{'code':0xc8,'result':_0x14e8('0x160')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a['findBy']));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x28c73a[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x161')]=function(_0x11cfe6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x162'),_0x11cfe6[_0x14e8('0x38')]));if(!this['isConfigured'](_0x11cfe6['operation'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x11cfe6,_0x14e8('0x163'));}this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0x164'),_0x11cfe6[_0x14e8('0x165')]));var _0x9893f4=eval(_0x11cfe6[_0x14e8('0x165')]);if(!this[_0x14e8('0xa9')](_0x11cfe6[_0x14e8('0xd8')])){return this[_0x14e8('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8eb1d0=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x11cfe6[_0x14e8('0xd8')]);if(!_0x8eb1d0){return this[_0x14e8('0xe')]['error'](_0x11cfe6,_0x14e8('0xd9'));}if(_[_0x14e8('0x9c')](_0x9893f4)){var _0x2a5238=this;_0x9893f4['forEach'](function(_0x4d433c,_0x3519aa){_0x2a5238['channel'][_0x14e8('0xdc')](util[_0x14e8('0x28')]('%s[%s]',_0x8eb1d0,_0x3519aa),_0x4d433c);});return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')]('variable\x20%s[key]\x20set',_0x8eb1d0));}else{return this['channel'][_0x14e8('0xdc')](_0x8eb1d0,_0x9893f4);}};AGIVertices[_0x14e8('0x10')][_0x14e8('0xb')]=function(_0x22e74d){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x166'),_0x22e74d[_0x14e8('0x38')]));if(_0x22e74d[_0x14e8('0x114')]===0x0){return this[_0x14e8('0xa5')](_0x22e74d);}_0x22e74d['retry']-=0x1;if(!this['isConfigured'](_0x22e74d[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x22e74d,_0x14e8('0x167'));}var _0x259e7d=this['getSound'][_0x14e8('0xa6')](this,_0x22e74d[_0x14e8('0x115')]);if(!_0x259e7d){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x22e74d,_0x14e8('0x116'));}var _0x2fc5bb=this['channel'][_0x14e8('0x118')](_0x259e7d,_0x22e74d['response'],_0x22e74d[_0x14e8('0x168')]);var _0x7426d8=_0x2fc5bb['result'];if(_0x2fc5bb['result']===-0x1){this[_0x14e8('0x36')]['sync'](this,_0x22e74d,'-1');return _0x2fc5bb;}else if(_0x2fc5bb[_0x14e8('0xa2')]===_0x14e8('0x68')){_0x2fc5bb[_0x14e8('0xa4')]=_0x2fc5bb['result'][_0x14e8('0x9d')]>0x0?_0x2fc5bb[_0x14e8('0xa4')]:'t';}else if(_[_0x14e8('0x46')](_0x2fc5bb[_0x14e8('0xa4')])){_0x2fc5bb[_0x14e8('0xa4')]='#';_0x7426d8='#';}if(!this[_0x14e8('0xa9')](_0x22e74d[_0x14e8('0xd8')])){this[_0x14e8('0xe')]['noop'](_0x14e8('0x117'));}else{var _0x93ff4c=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x22e74d[_0x14e8('0xd8')]);if(!_0x93ff4c){return this[_0x14e8('0xe')]['error'](_0x22e74d,_0x14e8('0xd9'));}this[_0x14e8('0xe')]['setVariable'](_0x93ff4c,_0x7426d8);}this[_0x14e8('0x36')]['sync'](this,_0x22e74d,_0x7426d8);return _0x2fc5bb;};AGIVertices[_0x14e8('0x10')][_0x14e8('0xaa')]=function(_0x16caac){logger[_0x14e8('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x16caac[_0x14e8('0x38')]));return this[_0x14e8('0xe')]['noop'](_0x16caac[_0x14e8('0x169')]||_0x16caac[_0x14e8('0x38')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16a')]=function(_0x1cf410){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x16b'),_0x1cf410[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x1cf410[_0x14e8('0x159')])){return this['channel'][_0x14e8('0x2c')](_0x1cf410,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410['findBy']));var _0x30bdae=this['getPause'][_0x14e8('0xa6')](this,_0x1cf410['pause_id']);var _0x4ed356=this[_0x14e8('0x52')][_0x14e8('0xa6')](this,_0x1cf410['findBy'],_0x30bdae);if(_0x4ed356){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410[_0x14e8('0x159')]));this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410['findBy']));return{'code':0xc8,'result':_0x14e8('0x160')};}else{logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x1cf410[_0x14e8('0x159')]));this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')](_0x14e8('0x15c'),this['channel']['callerid'],_0x1cf410['findBy']));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')]['playback']=function(_0x33a55c){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x16c'),_0x33a55c[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x33a55c[_0x14e8('0x115')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x33a55c,_0x14e8('0x167'));}var _0x233b99=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x33a55c[_0x14e8('0x115')]);if(!_0x233b99){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x33a55c,'no\x20file\x20audio\x20found');}var _0x1be21b=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x16d'),[_0x233b99,_0x33a55c[_0x14e8('0xe4')]]);if(_0x1be21b[_0x14e8('0xa4')]===-0x1){return _0x1be21b;}return this[_0x14e8('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x14e8('0x16d'),_0x233b99));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x16e')]=function(_0x5868b0){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x16f'),_0x5868b0[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x5868b0[_0x14e8('0x170')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x5868b0,_0x14e8('0x171'));}var _0x35bfaa='';var _0x3047cd=parseInt(_0x5868b0['queue_id'],0xa);if(isNaN(_0x3047cd)){_0x35bfaa=_0x5868b0[_0x14e8('0x170')];}else{_0x35bfaa=this[_0x14e8('0x16')][_0x14e8('0xa6')](this,_0x5868b0[_0x14e8('0x170')]);if(!_0x35bfaa){return this[_0x14e8('0xe')]['error'](_0x5868b0,_0x14e8('0x172'));}}var _0x3cb51e='';if(this['isConfigured'](_0x5868b0[_0x14e8('0x115')])){var _0x388a64=this[_0x14e8('0x1f')][_0x14e8('0xa6')](this,_0x5868b0[_0x14e8('0x115')]);if(_0x388a64){_0x3cb51e=_0x388a64;}}this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x5868b0,_0x35bfaa);if(_0x5868b0['opts'][_0x14e8('0x173')]('x')<0x0){_0x5868b0[_0x14e8('0xe4')]+='x';}if(_0x5868b0[_0x14e8('0xe4')]['indexOf']('X')<0x0){_0x5868b0['opts']+='X';}this[_0x14e8('0xe')][_0x14e8('0xdc')](_0x14e8('0x174'),_0x35bfaa?_0x35bfaa[_0x14e8('0x175')]():'');var _0x1bb77b=this['channel'][_0x14e8('0xac')](_0x14e8('0x176'),[_0x35bfaa,_0x5868b0[_0x14e8('0xe4')],_0x5868b0['url'],_0x3cb51e,_0x5868b0[_0x14e8('0x68')],_0x5868b0[_0x14e8('0x6')],_0x5868b0[_0x14e8('0x177')],_0x5868b0['gosub'],'',_0x5868b0[_0x14e8('0x178')]]);if(_0x1bb77b[_0x14e8('0xa4')]===-0x1){return _0x1bb77b;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x35bfaa));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x179')]=function(_0x1c7de2){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x17a'),_0x1c7de2[_0x14e8('0x38')]));var _0x2bd29b=_0x1c7de2['recordingFormat']||'wav';var _0x3f8988=util[_0x14e8('0x28')](_0x14e8('0x17b'),this[_0x14e8('0xe')][_0x14e8('0x37')],rs['generate'](0x5));var _0x21fd26=util[_0x14e8('0x28')](_0x14e8('0x17c'),FILES_PATH,_0x3f8988,_0x2bd29b);var _0x5891b1=util['format'](_0x14e8('0x133'),FILES_PATH,_0x3f8988);this['createSquareRecording'][_0x14e8('0xa6')](this,_0x1c7de2,_0x3f8988,_0x21fd26);this['channel']['setVariable']('RECORDING_SAVENAME',_0x3f8988);logger[_0x14e8('0x2e')](_0x14e8('0x17d'),_0x5891b1,_0x2bd29b,_0x1c7de2[_0x14e8('0x17e')],_0x1c7de2[_0x14e8('0x68')]);return this['channel']['recordFile'](_0x5891b1,_0x2bd29b,_0x1c7de2[_0x14e8('0x17e')],_0x1c7de2[_0x14e8('0x68')],undefined,!![]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x17f')]=function(_0x20bdd8){logger['info'](util['format'](_0x14e8('0x180'),_0x20bdd8[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x20bdd8[_0x14e8('0x66')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x181'));}var _0x479327=this[_0x14e8('0x65')][_0x14e8('0xa6')](this,_0x20bdd8);logger['info'](util[_0x14e8('0x28')](_0x14e8('0x182'),util[_0x14e8('0x183')](_0x479327,{'showHidden':![],'depth':null})));if(!this[_0x14e8('0xa9')](_0x20bdd8['variable_id'])){return this['channel'][_0x14e8('0xaa')](_0x14e8('0x184'));}var _0x3c5f54=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x20bdd8['variable_id']);if(!_0x3c5f54){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x20bdd8,_0x14e8('0xd9'));}this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x185'),_0x3c5f54),_0x479327[_0x14e8('0x77')]?_0x479327['statusCode']:_0x14e8('0x186'));this[_0x14e8('0xe')][_0x14e8('0xdc')](util['format'](_0x14e8('0x187'),_0x3c5f54),_0x479327[_0x14e8('0x78')]?_0x479327['statusMessage']:'OK');if(_0x479327[_0x14e8('0x6d')]){try{this[_0x14e8('0x9e')](_0x479327['body'],_0x3c5f54);}catch(_0x3486e1){logger[_0x14e8('0x2c')](util[_0x14e8('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3c5f54));}}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0xdf'),_0x3c5f54));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x188')]=function(_0x2f3e94){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x189'),_0x2f3e94[_0x14e8('0x38')]));return this['channel'][_0x14e8('0x18a')](_0x2f3e94['digits'][_0x14e8('0x18b')](/\s+/g,''),_0x2f3e94[_0x14e8('0x17e')]);};AGIVertices['prototype'][_0x14e8('0x18c')]=function(_0x5ceb09){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x18d'),_0x5ceb09[_0x14e8('0x38')]));return this['channel']['sayNumber'](_0x5ceb09[_0x14e8('0x69')][_0x14e8('0x18b')](/\s+/g,''),_0x5ceb09[_0x14e8('0x17e')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x18e')]=function(_0x4b37d4){logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x18f'),_0x4b37d4[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0x190')](_0x4b37d4[_0x14e8('0x5e')],_0x4b37d4['escape_digits']);};AGIVertices['prototype'][_0x14e8('0x191')]=function(_0x3430f6){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x192'),_0x3430f6[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x3430f6[_0x14e8('0x193')])){return this['channel']['noop']('no\x20mail\x20account\x20configured');}var _0x668dda=this[_0x14e8('0x21')][_0x14e8('0xa6')](this,_0x3430f6['account_id']);if(!_0x668dda||!_0x668dda[_0x14e8('0x194')]){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3430f6,_0x14e8('0x195'));}var _0x24a0f8={'from':util['format'](_0x14e8('0x196'),_0x668dda[_0x14e8('0x15')],_0x668dda[_0x14e8('0x197')]||_0x668dda[_0x14e8('0x194')][_0x14e8('0x198')]),'to':_0x3430f6['to']||'','cc':_0x3430f6['cc']||'','bcc':_0x3430f6[_0x14e8('0x199')]||'','subject':_0x3430f6[_0x14e8('0x19a')],'html':_0x3430f6[_0x14e8('0x5e')],'text':_0x3430f6['text']};if(this['isConfigured'](_0x3430f6['template_id'])){}logger[_0x14e8('0xe1')](_0x14e8('0x19b'),JSON[_0x14e8('0x75')](_0x24a0f8));this[_0x14e8('0x36')]['sync'](this,_0x3430f6,_0x3430f6[_0x14e8('0x193')]);this['channel']['noop'](util[_0x14e8('0x28')](_0x14e8('0x19c'),_0x668dda[_0x14e8('0x15')]));this['sendMailMessage']['sync'](this,_0x668dda['smtpOptions'],_0x24a0f8);return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x19d'));};AGIVertices[_0x14e8('0x10')]['sendFax']=function(_0x169203){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x19e'),_0x169203[_0x14e8('0x38')]));return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x19f'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1a0')]=function(_0x2956e9){logger['info'](util['format'](_0x14e8('0x1a1'),_0x2956e9[_0x14e8('0x38')]));if(!this['isConfigured'](_0x2956e9[_0x14e8('0x1a2')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')]('no\x20sms\x20account\x20configured');}var _0x22b94c=this[_0x14e8('0x33')][_0x14e8('0xa6')](this,_0x2956e9[_0x14e8('0x1a2')]);if(!_0x22b94c){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x2956e9,'no\x20sms\x20account\x20found');}var _0x50218f={'body':_0x2956e9[_0x14e8('0x1a3')],'phone':_0x2956e9['to']||'','SmsAccountId':_0x22b94c['id']};logger['debug'](_0x14e8('0x1a4'),JSON[_0x14e8('0x75')](_0x50218f));this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x2956e9,_0x2956e9[_0x14e8('0x1a2')]);this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x22b94c[_0x14e8('0x15')]));this['createSmsMessage'][_0x14e8('0xa6')](this,_0x50218f);return this['channel'][_0x14e8('0xaa')](_0x14e8('0x1a5'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1a6')]=function(_0x4f7ff9){logger['info'](util[_0x14e8('0x28')](_0x14e8('0x1a7'),_0x4f7ff9[_0x14e8('0x38')]));if(!this['isConfigured'](_0x4f7ff9[_0x14e8('0xd8')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x4f7ff9,_0x14e8('0x1a8'));}var _0x2f5b09=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x4f7ff9[_0x14e8('0xd8')]);if(!_0x2f5b09){return this['channel'][_0x14e8('0x2c')](_0x4f7ff9,_0x14e8('0xd9'));}return this[_0x14e8('0xe')][_0x14e8('0xdc')](_0x2f5b09,_0x4f7ff9[_0x14e8('0x1a9')]);};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1aa')]=function(_0xc8ab66){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0xc8ab66[_0x14e8('0x38')]));this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1ab'));if(_0xc8ab66[_0x14e8('0xbc')]===_0x14e8('0x1ac')){this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1ad'));return this[_0x14e8('0xe')]['answer']();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1ae')]=function(_0x3176cf){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3176cf[_0x14e8('0x38')]));if(!this['isConfigured'](_0x3176cf[_0x14e8('0x1af')])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3176cf,_0x14e8('0x1b0'));}var _0x2d9e61=this['getSquareProject'][_0x14e8('0xa6')](this,_0x3176cf['project_id']);if(!this[_0x14e8('0xa9')](_0x2d9e61)){return this['channel']['error'](_0x3176cf,util[_0x14e8('0x28')](_0x14e8('0x1b1'),_0x3176cf[_0x14e8('0x1af')]));}if(_0x2d9e61===this[_0x14e8('0xe')]['arg_1']){return this['channel'][_0x14e8('0x2c')](_0x3176cf,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x14e8('0x36')]['sync'](this,_0x3176cf,_0x2d9e61);var _0x3085c5=this[_0x14e8('0xe')]['exec']('AGI',util['format'](_0x14e8('0x1b2'),config[_0x14e8('0x6')][_0x14e8('0x1b3')]||'127.0.0.1',_0x2d9e61,this['channel'][_0x14e8('0x42')]));if(_0x3085c5[_0x14e8('0xa4')]===-0x1){return _0x3085c5;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x2d9e61));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b4')]=function(_0x30f849){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1b5'),_0x30f849[_0x14e8('0x38')]));var _0x292fdd=this[_0x14e8('0x59')]['sync'](this,_0x30f849['command']);this[_0x14e8('0x36')][_0x14e8('0xa6')](this,_0x30f849,_0x30f849[_0x14e8('0xba')]);if(this[_0x14e8('0xa9')](_0x30f849[_0x14e8('0xd8')])){var _0x33cfb2=this[_0x14e8('0x11')][_0x14e8('0xa6')](this,_0x30f849['variable_id']);if(_0x33cfb2){this['channel'][_0x14e8('0xdc')](_0x33cfb2,_0x292fdd);return this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x1b6'),_0x30f849[_0x14e8('0xba')],_0x33cfb2));}}return this['channel'][_0x14e8('0xaa')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x30f849['command']));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1b7')]=function(_0x3c1011){logger['info'](util['format'](_0x14e8('0x1b8'),_0x3c1011[_0x14e8('0x38')]));_0x3c1011[_0x14e8('0x5e')]=_0x3c1011[_0x14e8('0x5e')][_0x14e8('0x18b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14e8('0xa9')](_0x3c1011[_0x14e8('0x5c')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0x1b9'));}if(!this['isConfigured'](_0x3c1011[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3c1011[_0x14e8('0x5e')]));var _0x35f35e=this['googleCloudTTS']['sync'](this,_0x3c1011);if(_0x35f35e){this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x35f35e));var _0x5ed0be=this[_0x14e8('0xe')]['streamFile'](_0x35f35e);try{fs[_0x14e8('0x129')](_0x35f35e+'.wav');}catch(_0x2f08f4){logger[_0x14e8('0x2c')](_0x2f08f4);}return _0x5ed0be;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x3c1011,_0x14e8('0x1ba'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1bb')]=function(_0x194c99){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1bc'),_0x194c99[_0x14e8('0x38')]));_0x194c99[_0x14e8('0x5e')]=_0x194c99[_0x14e8('0x5e')][_0x14e8('0x18b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14e8('0xa9')](_0x194c99[_0x14e8('0x5e')])){return this[_0x14e8('0xe')][_0x14e8('0xaa')](_0x14e8('0xab'));}this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x1bd'),_0x194c99[_0x14e8('0x5e')]));var _0x42ad42=this['googleTTS'][_0x14e8('0xa6')](this,_0x194c99);if(_0x42ad42){this[_0x14e8('0xe')]['noop'](util[_0x14e8('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x42ad42));var _0x1f2108=this[_0x14e8('0xe')]['streamFile'](_0x42ad42);try{fs[_0x14e8('0x129')](_0x42ad42+_0x14e8('0x104'));}catch(_0x36ac40){logger['error'](_0x36ac40);}return _0x1f2108;}return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x194c99,_0x14e8('0x1be'));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1bf')]=function(_0x543ce7){logger[_0x14e8('0x2e')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x543ce7['label']));if(!this['isConfigured'](_0x543ce7[_0x14e8('0x159')])){return this['channel'][_0x14e8('0x2c')](_0x543ce7,_0x14e8('0x15a'));}logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15b'),this['channel'][_0x14e8('0x3a')],_0x543ce7[_0x14e8('0x159')]));var _0x1d1800=this['agentUnpause']['sync'](this,_0x543ce7[_0x14e8('0x159')]);if(_0x1d1800){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x15c'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x543ce7['findBy']));this['channel'][_0x14e8('0xaa')](util['format'](_0x14e8('0x15c'),this[_0x14e8('0xe')]['callerid'],_0x543ce7[_0x14e8('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x14e8('0x2e')](util['format'](_0x14e8('0x15d'),this[_0x14e8('0xe')][_0x14e8('0x3a')],_0x543ce7['findBy']));this['channel'][_0x14e8('0xaa')](util[_0x14e8('0x28')](_0x14e8('0x15d'),this[_0x14e8('0xe')]['callerid'],_0x543ce7[_0x14e8('0x159')]));return{'code':0xc8,'result':_0x14e8('0x15e')};}};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1c0')]=function(_0x15dacf){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')](_0x14e8('0x1c1'),_0x15dacf[_0x14e8('0x38')]));var _0x319e27=this[_0x14e8('0xe')][_0x14e8('0xac')](_0x14e8('0x1c2'),[_0x15dacf[_0x14e8('0x1c3')],_0x15dacf['options']]);if(_0x319e27[_0x14e8('0xa4')]===-0x1){return _0x319e27;}return this[_0x14e8('0xe')][_0x14e8('0xaa')](util[_0x14e8('0x28')]('Executed\x20command\x20%s\x20%s',_0x14e8('0x1c2'),_0x15dacf['mailbox']));};AGIVertices[_0x14e8('0x10')][_0x14e8('0x1c4')]=function(_0x572928){logger[_0x14e8('0x2e')](util[_0x14e8('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x572928[_0x14e8('0x38')]));if(!this[_0x14e8('0xa9')](_0x572928['variable_id'])){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x572928,_0x14e8('0x1a8'));}var _0x3e4ca5=this[_0x14e8('0x11')]['sync'](this,_0x572928[_0x14e8('0xd8')]);if(!_0x3e4ca5){return this[_0x14e8('0xe')][_0x14e8('0x2c')](_0x572928,_0x14e8('0xd9'));}var _0xe607ab=this[_0x14e8('0xe')][_0x14e8('0x11')](_0x3e4ca5);return{'code':0xc8,'result':_0xe607ab[_0x14e8('0xa2')]?_0xe607ab[_0x14e8('0xa2')]:'-'};};String[_0x14e8('0x10')][_0x14e8('0xa1')]=function(_0x59b5ff,_0x21d388){return this[_0x14e8('0xa0')](_0x59b5ff)[_0x14e8('0x1c5')](_0x21d388);};module[_0x14e8('0x1c6')]=AGIVertices; \ No newline at end of file +var _0xc961=['getPauseById','agentUnpause','agentLogout','agent','agentLogin','internal','format','LOCAL','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','includes','PUT','toUpperCase','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','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','sestekNDA','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','noop','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','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','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','position','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','no\x20find\x20by\x20configured','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','randomstring','moment','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','getSoundPath','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause'];(function(_0x2d9b84,_0x1ed432){var _0x3eed50=function(_0x38b368){while(--_0x38b368){_0x2d9b84['push'](_0x2d9b84['shift']());}};_0x3eed50(++_0x1ed432);}(_0xc961,0x17a));var _0x1c96=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0xc961[_0x67b075];return _0x39d030;};'use strict';var fs=require('fs');var util=require(_0x1c96('0x0'));var _=require(_0x1c96('0x1'));var sh=require(_0x1c96('0x2'));var odbc=require(_0x1c96('0x3'))();var rs=require(_0x1c96('0x4'));var moment=require(_0x1c96('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require('../../config/logger')(_0x1c96('0x6'));var config=require('../../config/environment');var shared=require(_0x1c96('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x1c96('0x8');var recursiveMapAttributes=[_0x1c96('0x9'),_0x1c96('0xa')];var verticesWithRetry=[_0x1c96('0xb'),_0x1c96('0xc'),_0x1c96('0xd')];var AGIVertices=function(_0x5523de,_0x360c75,_0x362e46){this[_0x1c96('0xe')]=_0x5523de;this[_0x1c96('0xf')]=_0x360c75;this[_0x1c96('0x10')]=_0x362e46;};AGIVertices[_0x1c96('0x11')][_0x1c96('0x12')]=function(_0x435394,_0x909718){this[_0x1c96('0xf')][_0x1c96('0x13')](_0x435394)[_0x1c96('0x14')](function(_0x5bb3c3){_0x909718(null,_0x5bb3c3?_0x5bb3c3[_0x1c96('0x15')]:![]);})[_0x1c96('0x16')](function(_0x5a8f97){_0x909718(_0x5a8f97);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x17')]=function(_0x2e9577,_0x3bf224){this[_0x1c96('0xf')][_0x1c96('0x18')](_0x2e9577)[_0x1c96('0x14')](function(_0x11456c){_0x3bf224(null,_0x11456c?_0x11456c[_0x1c96('0x15')]:![]);})[_0x1c96('0x16')](function(_0x8f03c4){_0x3bf224(_0x8f03c4);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x19')]=function(_0x53f0e6,_0x32596e){this['rpc'][_0x1c96('0x1a')](_0x53f0e6)[_0x1c96('0x14')](function(_0x595429){_0x32596e(null,_0x595429?_0x595429[_0x1c96('0x15')]:![]);})['catch'](function(_0x57efce){_0x32596e(_0x57efce);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1b')]=function(_0x15b2bf,_0x4aff57){this[_0x1c96('0xf')]['getSquareOdbcById'](_0x15b2bf)[_0x1c96('0x14')](function(_0x174ebf){_0x4aff57(null,_0x174ebf?_0x174ebf['dsn']:![]);})[_0x1c96('0x16')](function(_0x4e1c7c){_0x4aff57(_0x4e1c7c);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1c')]=function(_0x23722c,_0x3f4293){this[_0x1c96('0xf')][_0x1c96('0x1d')](_0x23722c)[_0x1c96('0x14')](function(_0x275189){_0x3f4293(null,_0x275189?_0x275189[_0x1c96('0x15')]:![]);})[_0x1c96('0x16')](function(_0x4d2c9c){_0x3f4293(_0x4d2c9c);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1e')]=function(_0x289ee5,_0x528afc){this['rpc'][_0x1c96('0x1f')](_0x289ee5)[_0x1c96('0x14')](function(_0x48798a){_0x528afc(null,_0x48798a?_0x48798a[_0x1c96('0x15')]:![]);})[_0x1c96('0x16')](function(_0x1b31d0){_0x528afc(_0x1b31d0);});};AGIVertices['prototype']['getSound']=function(_0x32c3b8,_0x8d0b51){var _0x57f408=this;this[_0x1c96('0xf')][_0x1c96('0x20')](_0x32c3b8)[_0x1c96('0x14')](function(_0x25db8a){_0x8d0b51(null,_0x25db8a?_0x57f408['getSoundPath'](_0x25db8a['save_name']):![]);})[_0x1c96('0x16')](function(_0x556730){_0x8d0b51(_0x556730);});};AGIVertices[_0x1c96('0x11')]['getMailAccount']=function(_0x5c7b1d,_0x318052){this[_0x1c96('0xf')][_0x1c96('0x21')](_0x5c7b1d)[_0x1c96('0x14')](function(_0x45cc03){_0x318052(null,_0x45cc03?_0x45cc03:![]);})[_0x1c96('0x16')](function(_0x5a6672){_0x318052(_0x5a6672);});};AGIVertices['prototype'][_0x1c96('0x22')]=function(_0x25b92f,_0x423ba9,_0x85a6e3){this[_0x1c96('0x10')][_0x1c96('0x22')](_0x25b92f,_0x423ba9)[_0x1c96('0x14')](function(){_0x85a6e3(null);})[_0x1c96('0x16')](function(_0xb1a196){_0x85a6e3(_0xb1a196);});};AGIVertices['prototype'][_0x1c96('0x23')]=function(_0x933d9f,_0x1e22a7){this[_0x1c96('0xf')][_0x1c96('0x24')](_0x933d9f)[_0x1c96('0x14')](function(_0x563213){if(_0x563213){if(_0x563213[_0x1c96('0x25')]){_0x1e22a7(null,[_0x563213[_0x1c96('0x26')]]);}else{_0x1e22a7(null,_['map'](_0x563213[_0x1c96('0x27')],_0x1c96('0x26')));}}else{_0x1e22a7(null,![]);}})[_0x1c96('0x16')](function(_0x2f0884){_0x1e22a7(_0x2f0884);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x28')]=function(_0xee0a9f){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0xee0a9f);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x29')]=function(_0x51fd52,_0x30a200,_0x53214a){odbc[_0x1c96('0x2a')](_0x51fd52,function(_0xfa8664){if(_0xfa8664){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0xfa8664);_0x53214a(_0xfa8664);}else{logger[_0x1c96('0x2b')](_0x1c96('0x2c'));odbc[_0x1c96('0x2d')](_0x30a200,function(_0x6deeb8,_0x15f14c){if(_0x6deeb8){logger[_0x1c96('0x2b')](_0x1c96('0x2e'),_0x30a200);_0x53214a(_0x6deeb8);}else{logger['info'](_0x1c96('0x2f'),_0x30a200);odbc[_0x1c96('0x30')](function(_0x5e0df7){if(_0x5e0df7){logger[_0x1c96('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5e0df7);}_0x53214a(null,_0x15f14c);});}});}});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x32')]=function(_0x4167f8,_0x435748){this['rpc'][_0x1c96('0x33')](_0x4167f8)[_0x1c96('0x14')](function(_0x2b2113){_0x435748(null,_0x2b2113?_0x2b2113:![]);})[_0x1c96('0x16')](function(_0x58e706){_0x435748(_0x58e706);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x34')]=function(_0x4a0264,_0x33b68f){this[_0x1c96('0xf')][_0x1c96('0x34')](_0x4a0264)[_0x1c96('0x14')](function(_0x1ade48){_0x33b68f(null,_0x1ade48);})[_0x1c96('0x16')](function(_0x1f1213){_0x33b68f(_0x1f1213);});};AGIVertices[_0x1c96('0x11')]['createSquareDetailsReport']=function(_0x1404b0,_0x24ee34,_0x27e421){this[_0x1c96('0xf')][_0x1c96('0x35')]({'uniqueid':this[_0x1c96('0xe')][_0x1c96('0x36')],'node':_0x1404b0[_0x1c96('0x37')],'application':_0x1404b0[_0x1c96('0x38')],'data':_0x24ee34||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x1c96('0xe')][_0x1c96('0x39')]})[_0x1c96('0x14')](function(_0x25f8e7){if(_0x27e421){_0x27e421(null,_0x25f8e7);}})[_0x1c96('0x16')](function(_0x5e8a29){if(_0x27e421){_0x27e421(_0x5e8a29);}});};AGIVertices['prototype'][_0x1c96('0x3a')]=function(_0x3e74c0,_0x21c78d,_0x50eb6c,_0x112152){this[_0x1c96('0xf')]['createSquareRecording']({'uniqueid':this[_0x1c96('0xe')]['uniqueid'],'callerid':this['channel'][_0x1c96('0x39')],'calleridname':this[_0x1c96('0xe')][_0x1c96('0x3b')],'context':this['channel']['context'],'extension':this['channel'][_0x1c96('0x3c')],'priority':this['channel'][_0x1c96('0x3d')],'accountcode':this['channel'][_0x1c96('0x3e')],'dnid':this[_0x1c96('0xe')][_0x1c96('0x3f')],'projectName':this[_0x1c96('0xe')]['arg_1'],'saveName':_0x21c78d,'filename':_0x3e74c0[_0x1c96('0x40')]||_0x21c78d,'savePath':_0x50eb6c})[_0x1c96('0x14')](function(_0x124cb3){_0x112152(null,_0x124cb3);})[_0x1c96('0x16')](function(_0x5b711c){_0x112152(_0x5b711c);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x41')]=function(_0x2d5ee3,_0x3a76db,_0x229c62,_0x3ded43,_0x2dd40b){this['rpc'][_0x1c96('0x41')]({'uniqueid':this['channel'][_0x1c96('0x36')],'body':_0x2d5ee3,'direction':_0x3a76db,'providerName':_0x229c62,'providerResponse':_0x3ded43})[_0x1c96('0x14')](function(_0x4b238f){if(_0x2dd40b){_0x2dd40b(null,_0x4b238f);}})['catch'](function(_0x4692b5){if(_0x2dd40b){_0x2dd40b(_0x4692b5);}});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x42')]=function(_0x4df750,_0x1265af){this[_0x1c96('0xf')][_0x1c96('0x42')]({'firstName':_['isEmpty'](_0x4df750['name'])||_[_0x1c96('0x43')](_0x4df750['name'])?'callback_'+Math['random']():_0x4df750['name'],'lastName':_[_0x1c96('0x44')](_0x4df750['lastName'])||_['isNil'](_0x4df750['lastName'])?null:_0x4df750[_0x1c96('0x45')],'phone':_0x4df750[_0x1c96('0x46')],'ListId':_0x4df750[_0x1c96('0x47')],'scheduledat':_0x4df750[_0x1c96('0x48')],'callbackUniqueid':this[_0x1c96('0xe')][_0x1c96('0x36')],'tags':_0x1c96('0x49'),'description':_0x1c96('0x4a')+_0x4df750[_0x1c96('0x48')]['toString'](),'priority':_0x4df750[_0x1c96('0x4b')]})[_0x1c96('0x14')](function(_0x1fe7ab){_0x1265af(null,_0x1fe7ab);})[_0x1c96('0x16')](function(_0x557b43){_0x1265af(_0x557b43);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x4c')]=function(_0x69c1a7,_0x2dab72){this[_0x1c96('0xf')][_0x1c96('0x4d')](_0x69c1a7)[_0x1c96('0x14')](function(_0x1eb1fb){_0x2dab72(null,_0x1eb1fb?_0x1eb1fb['name']:![]);})[_0x1c96('0x16')](function(_0xf59cde){_0x2dab72(_0xf59cde);});};AGIVertices[_0x1c96('0x11')]['agentPause']=function(_0x28cb48,_0x172a34,_0x24e5d5){var _0x50f37f={'role':'agent'};_0x50f37f[_0x28cb48]=this[_0x1c96('0xe')][_0x1c96('0x39')];this['rpc']['agentPause'](_0x50f37f,_0x172a34,this['channel'][_0x1c96('0x36')])[_0x1c96('0x14')](function(_0x35807e){_0x24e5d5(null,_[_0x1c96('0x43')](_0x35807e)?![]:!![]);})['catch'](function(_0x23e87a){logger[_0x1c96('0x31')](_0x23e87a);_0x24e5d5(null,![]);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x4e')]=function(_0x3f97e4,_0xd8f923){var _0x269baa={'role':'agent'};_0x269baa[_0x3f97e4]=this['channel'][_0x1c96('0x39')];this[_0x1c96('0xf')][_0x1c96('0x4e')](_0x269baa)[_0x1c96('0x14')](function(_0x186860){_0xd8f923(null,_['isNil'](_0x186860)?![]:!![]);})['catch'](function(_0x2f8f04){logger[_0x1c96('0x31')](_0x2f8f04);_0xd8f923(null,![]);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x4f')]=function(_0x43148b,_0x5d3e70){var _0x54fa49={'role':_0x1c96('0x50')};_0x54fa49[_0x43148b]=this[_0x1c96('0xe')][_0x1c96('0x39')];this[_0x1c96('0xf')][_0x1c96('0x4f')](_0x54fa49)['then'](function(_0x47d7df){_0x5d3e70(null,_[_0x1c96('0x43')](_0x47d7df)?![]:!![]);})[_0x1c96('0x16')](function(_0x58e053){logger[_0x1c96('0x31')](_0x58e053);_0x5d3e70(null,![]);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x51')]=function(_0x715778,_0x47d6e9){var _0x383b0a={'role':'agent'};_0x383b0a[_0x715778]=this['channel'][_0x1c96('0x39')];var _0x5842f4=_0x715778!=_0x1c96('0x52')?util[_0x1c96('0x53')]('%s/%s@from-sip/n',_0x1c96('0x54'),this[_0x1c96('0xe')]['callerid']):undefined;this[_0x1c96('0xf')][_0x1c96('0x51')](_0x383b0a,_0x5842f4)[_0x1c96('0x14')](function(_0x53fd9a){_0x47d6e9(null,_[_0x1c96('0x43')](_0x53fd9a)?![]:!![]);})['catch'](function(_0x5d0006){logger[_0x1c96('0x31')](_0x5d0006);_0x47d6e9(null,![]);});};AGIVertices[_0x1c96('0x11')]['shellCommand']=function(_0x5f11db,_0x94892){sh['exec'](_[_0x1c96('0x55')](_0x5f11db),function(_0x3a628c,_0x401fd2){var _0x36ea60=_0x401fd2['replace'](/(\r\n|\n|\r)/gm,'');_0x94892(null,_0x36ea60);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5f0f78,_0x3e09a7){scripts[_0x1c96('0x56')](_0x5f0f78[_0x1c96('0x57')],_0x5f0f78[_0x1c96('0x58')]||_0x1c96('0x59'),_0x5f0f78[_0x1c96('0x59')],_0x5f0f78['languageCode']||_0x1c96('0x5a'),_0x5f0f78[_0x1c96('0x5b')]||_0x1c96('0x5c'),_0x5f0f78[_0x1c96('0x5d')]||_0x1c96('0x5e'))['then'](function(_0x3d8d4b){_0x3e09a7(null,_0x3d8d4b);})[_0x1c96('0x16')](function(_0x2455d9){_0x3e09a7(_0x2455d9);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x5f')]=function(_0x28d7d4,_0x19760a){scripts['googleTTS'](_0x28d7d4[_0x1c96('0x59')],_0x28d7d4[_0x1c96('0x60')]||'en',0x1)[_0x1c96('0x14')](function(_0x1f4f89){_0x19760a(null,_0x1f4f89);})[_0x1c96('0x16')](function(_0x1e04d0){_0x19760a(_0x1e04d0);});};AGIVertices['prototype']['restAPI']=function(_0x17d319,_0x1fb894){var _0x3d1823={'uri':_0x17d319['url'],'method':_0x17d319[_0x1c96('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x17d319[_0x1c96('0x62')])===_0x1c96('0x63')&&parseInt(_0x17d319['timeout'])>=0x1?parseInt(_0x17d319[_0x1c96('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x1c96('0x64')](['POST',_0x1c96('0x65')],_0x3d1823[_0x1c96('0x61')][_0x1c96('0x66')]())){try{_0x3d1823['body']=_0x17d319[_0x1c96('0xa')]?JSON['parse'](_0x17d319[_0x1c96('0xa')]):{};}catch(_0x27825d){logger[_0x1c96('0x31')](_0x1c96('0x67'),_0x27825d);}}try{_0x3d1823[_0x1c96('0x68')]=_0x17d319[_0x1c96('0x9')]?JSON[_0x1c96('0x69')](_0x17d319[_0x1c96('0x9')]):{};}catch(_0x1df25c){logger['error'](_0x1c96('0x6a'),_0x1df25c);}if(_0x17d319[_0x1c96('0x6b')]){try{var _0x416d21=require(_0x17d319[_0x1c96('0x6b')])['sync'](this,_0x3d1823);_0x3d1823['uri']=Mustache[_0x1c96('0x6c')](_0x17d319[_0x1c96('0x6d')],_0x416d21,{},['$$','$$']);if(_0x3d1823[_0x1c96('0x68')]){_0x3d1823[_0x1c96('0x68')]=JSON[_0x1c96('0x69')](Mustache[_0x1c96('0x6c')](JSON[_0x1c96('0x6e')](_0x3d1823[_0x1c96('0x68')]),_0x416d21,{},['$$','$$']));}if(_0x3d1823[_0x1c96('0x6f')]){_0x3d1823[_0x1c96('0x6f')]=JSON['parse'](Mustache[_0x1c96('0x6c')](JSON[_0x1c96('0x6e')](_0x3d1823['body']),_0x416d21,{},['$$','$$']));}}catch(_0x25b372){logger['error'](_0x1c96('0x70'),_0x25b372);}}rp(_0x3d1823)[_0x1c96('0x14')](function(_0x84b59){var _0x2a2434={'statusCode':_0x84b59[_0x1c96('0x71')]||0xc8,'statusMessage':_0x84b59[_0x1c96('0x72')]||'OK','headers':_0x84b59[_0x1c96('0x68')]||{},'body':_0x84b59[_0x1c96('0x6f')]||{}};_0x1fb894(null,_0x2a2434);})[_0x1c96('0x16')](function(_0x327759){var _0x28ec58={'statusCode':_0x327759['statusCode']||0x1f4,'statusMessage':_0x327759[_0x1c96('0x73')]||_0x1c96('0x74'),'headers':_0x327759[_0x1c96('0x75')][_0x1c96('0x68')]||{},'body':_0x327759[_0x1c96('0x75')][_0x1c96('0x6f')]||{}};_0x1fb894(null,_0x28ec58);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x76')]=function(_0x179ced,_0x2bec7b){scripts[_0x1c96('0x76')](this['channel'][_0x1c96('0x36')],_0x179ced[_0x1c96('0x77')],_0x179ced[_0x1c96('0x59')],_0x179ced[_0x1c96('0x78')]||'en')[_0x1c96('0x14')](function(_0x4de6a7){_0x2bec7b(null,_0x4de6a7);})['catch'](function(_0x568d56){_0x2bec7b(_0x568d56);});};AGIVertices['prototype'][_0x1c96('0x79')]=function(_0x317d89,_0x58a35c){scripts[_0x1c96('0x79')](this[_0x1c96('0xe')]['uniqueid'],_0x317d89[_0x1c96('0x7a')],_0x317d89['client_email'],_0x317d89['private_key'],_0x317d89[_0x1c96('0x59')],_0x317d89['dialogflowV2_language']||'en')[_0x1c96('0x14')](function(_0x4c2295){_0x58a35c(null,_0x4c2295);})[_0x1c96('0x16')](function(_0x16bd34){_0x58a35c(_0x16bd34);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x7b')]=function(_0x29b3bb,_0x481f9d){scripts[_0x1c96('0x7b')](this[_0x1c96('0xe')],_0x29b3bb)[_0x1c96('0x14')](function(_0xb5847b){_0x481f9d(null,_0xb5847b);})[_0x1c96('0x16')](function(_0x5bb379){_0x481f9d(_0x5bb379);});};AGIVertices[_0x1c96('0x11')]['ispeechTTS']=function(_0x340ba1,_0x33c80f){scripts['ispeechTTS'](_0x340ba1['key'],_0x340ba1[_0x1c96('0x59')],_0x340ba1[_0x1c96('0x7c')]||'en-US',_0x340ba1[_0x1c96('0x7d')])[_0x1c96('0x14')](function(_0x47cf63){_0x33c80f(null,_0x47cf63);})['catch'](function(_0x5c5be2){_0x33c80f(_0x5c5be2);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x7e')]=function(_0x11ffa0,_0x4ea7e4,_0x4d4191){scripts[_0x1c96('0x7e')](_0x4ea7e4,_0x11ffa0[_0x1c96('0x77')],_0x11ffa0['ispeech_asr_language']||_0x1c96('0x5a'),this[_0x1c96('0x7f')](_0x11ffa0[_0x1c96('0x80')])?_0x11ffa0[_0x1c96('0x80')]:undefined)['then'](function(_0x3bee17){_0x4d4191(null,_0x3bee17);})[_0x1c96('0x16')](function(_0x338d4e){_0x4d4191(_0x338d4e);});};AGIVertices['prototype']['awsPolly']=function(_0x828af,_0x4050aa){scripts[_0x1c96('0x81')](_0x828af[_0x1c96('0x82')],_0x828af['aws_secret_access_key'],_0x828af[_0x1c96('0x83')],_0x828af['aws_polly_voice']||_0x1c96('0x84'),_0x828af[_0x1c96('0x59')],_0x828af[_0x1c96('0x85')]||_0x1c96('0x59'))[_0x1c96('0x14')](function(_0x15bb69){_0x4050aa(null,_0x15bb69);})[_0x1c96('0x16')](function(_0x6420eb){_0x4050aa(_0x6420eb);});};AGIVertices[_0x1c96('0x11')]['awsLex']=function(_0x311b26,_0x3a7f46){scripts[_0x1c96('0x86')](this['channel'][_0x1c96('0x36')],_0x311b26[_0x1c96('0x82')],_0x311b26[_0x1c96('0x87')],_0x311b26[_0x1c96('0x88')],_0x311b26[_0x1c96('0x59')],_0x311b26[_0x1c96('0x89')])[_0x1c96('0x14')](function(_0x38e267){_0x3a7f46(null,_0x38e267);})['catch'](function(_0x267fb6){_0x3a7f46(_0x267fb6);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x8a')]=function(_0x3224e6,_0x463cd6,_0x1de93d){scripts[_0x1c96('0x8a')](_0x463cd6,_0x3224e6['key'],_0x3224e6[_0x1c96('0x8b')]||_0x1c96('0x5a'))[_0x1c96('0x14')](function(_0x57d437){_0x1de93d(null,_0x57d437);})[_0x1c96('0x16')](function(_0x13b8e4){_0x1de93d(_0x13b8e4);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x8c')]=function(_0x42d61e,_0x204f08,_0xae540c){scripts['tildeASR'](_0x204f08,_0x42d61e[_0x1c96('0x8d')],_0x42d61e[_0x1c96('0x8e')],_0x42d61e[_0x1c96('0x8f')])[_0x1c96('0x14')](function(_0x18a3c3){_0xae540c(null,_0x18a3c3);})['catch'](function(_0x4dc6c9){_0xae540c(_0x4dc6c9);});};AGIVertices[_0x1c96('0x11')][_0x1c96('0x90')]=function(_0x4686dc){var _0x56fb25=_[_0x1c96('0x64')](verticesWithRetry,_0x4686dc['agicommand'])?_0x4686dc:_['clone'](_0x4686dc);for(var _0x3c6fee in _0x56fb25){if(_0x56fb25[_0x1c96('0x91')](_0x3c6fee)){if(_0x56fb25[_0x3c6fee]&&_[_0x1c96('0x92')](_0x56fb25[_0x3c6fee])){if(_[_0x1c96('0x64')](recursiveMapAttributes,_0x3c6fee)){_0x56fb25[_0x3c6fee]=this[_0x1c96('0x93')](_0x56fb25[_0x3c6fee]);}else{_0x56fb25[_0x3c6fee]=this[_0x1c96('0x94')](_0x56fb25[_0x3c6fee]);}}}}return _0x56fb25;};AGIVertices['prototype'][_0x1c96('0x95')]=function(_0x598dd9){for(var _0xfb2dfe in _0x598dd9){if(_0x598dd9['hasOwnProperty'](_0xfb2dfe)){if(_[_0x1c96('0x96')](_0x598dd9[_0xfb2dfe])){this['recursiveNodeIndex'](_0x598dd9[_0xfb2dfe]);}else if(_[_0x1c96('0x97')](_0x598dd9[_0xfb2dfe])){for(var _0x22828a=0x0;_0x22828a<_0x598dd9[_0xfb2dfe][_0x1c96('0x98')];_0x22828a++){this[_0x1c96('0x95')](_0x598dd9[_0xfb2dfe][_0x22828a]);}}else if(_[_0x1c96('0x92')](_0x598dd9[_0xfb2dfe])){_0x598dd9[_0xfb2dfe]=this['replaceAllVariables'](_0x598dd9[_0xfb2dfe]);}}}};AGIVertices[_0x1c96('0x11')][_0x1c96('0x99')]=function(_0x3e8d92,_0x109016){for(var _0x5aca94 in _0x3e8d92){if(_0x3e8d92[_0x1c96('0x91')](_0x5aca94)){if(_[_0x1c96('0x96')](_0x3e8d92[_0x5aca94])){if(!_[_0x1c96('0x44')](_0x3e8d92[_0x5aca94])){this['saveRestApiResult'](_0x3e8d92[_0x5aca94],util[_0x1c96('0x53')]('%s.%s',_0x109016,_0x5aca94));}}else if(_[_0x1c96('0x97')](_0x3e8d92[_0x5aca94])){for(var _0x3f405c=0x0;_0x3f405c<_0x3e8d92[_0x5aca94][_0x1c96('0x98')];_0x3f405c++){this[_0x1c96('0x99')](_0x3e8d92[_0x5aca94][_0x3f405c],util['format'](_0x1c96('0x9a'),_0x109016,_0x5aca94+'['+_0x3f405c+']'));}}else{if(!_[_0x1c96('0x43')](_0x3e8d92[_0x5aca94])){this[_0x1c96('0xe')][_0x1c96('0x9b')](util['format']('%s.%s',_0x109016,_0x5aca94),_0x3e8d92[_0x5aca94]);}}}}};AGIVertices[_0x1c96('0x11')][_0x1c96('0x93')]=function(_0x2aa3f0){try{var _0x23f355=JSON[_0x1c96('0x69')](_0x2aa3f0);this[_0x1c96('0x95')](_0x23f355);return JSON[_0x1c96('0x6e')](_0x23f355);}catch(_0x48ee9e){return this['replaceAllVariables'](_0x2aa3f0);}};AGIVertices['prototype'][_0x1c96('0x94')]=function(_0x1d3425){var _0x459c77=_0x1d3425[_0x1c96('0x9c')]('{');for(var _0x41062b=0x1;_0x41062b<_0x459c77[_0x1c96('0x98')];_0x41062b+=0x1){var _0x30f0cb=_0x459c77[_0x41062b][_0x1c96('0x9c')]('}');if(_0x30f0cb[_0x1c96('0x98')]>0x1){_0x1d3425=_0x1d3425[_0x1c96('0x9d')]('{'+_0x30f0cb[0x0]+'}',this[_0x1c96('0xe')][_0x1c96('0x12')](_0x30f0cb[0x0])['extra']||_0x30f0cb[0x0]);}}if(_0x459c77['length']===0x1){return _0x1d3425[_0x1c96('0x9e')]();}return this[_0x1c96('0x94')](_0x1d3425);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x9f')]=function(_0x1036ff,_0x414d4e){var _0x4c2a62=this['channel'][_0x1c96('0x12')](_0x1036ff);if(_0x4c2a62[_0x1c96('0xa0')]===-0x1){return _0x4c2a62;}logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xa1'),_0x414d4e,_0x4c2a62[_0x1c96('0xa2')]));return this[_0x1c96('0xe')][_0x1c96('0x9b')](_0x414d4e,_0x4c2a62['extra']);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x7f')]=function(_0x197efb){return _0x197efb&&_0x197efb!=='0'&&_0x197efb!=='-1'&&_0x197efb!=='';};AGIVertices['prototype']['maxRetry']=function(_0x51b275){this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x51b275,'-');_0x51b275[_0x1c96('0xa4')]=_0x51b275[_0x1c96('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1c96('0x11')][_0x1c96('0xa6')]=function(_0x50a043){logger['info'](util[_0x1c96('0x53')](_0x1c96('0xa7'),_0x50a043[_0x1c96('0x37')]));if(!this['isConfigured'](_0x50a043[_0x1c96('0x59')])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xa8'));}var _0x5602e5='\x22'+_0x50a043[_0x1c96('0x59')]+'\x22';if(this[_0x1c96('0x7f')](_0x50a043['options'])){_0x5602e5+=','+_0x50a043['options'];}var _0x16b59a=this['channel']['exec']('MRCPSynth',_0x5602e5);if(_0x16b59a[_0x1c96('0xa0')]===-0x1){return _0x16b59a;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5602e5));};AGIVertices[_0x1c96('0x11')]['mrcprecog']=function(_0x347937){logger['info'](util[_0x1c96('0x53')](_0x1c96('0xaa'),_0x347937[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x347937[_0x1c96('0xab')])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xac'));}var _0x697129=_0x347937[_0x1c96('0xab')];if(this[_0x1c96('0x7f')](_0x347937[_0x1c96('0x75')])){_0x697129+=','+_0x347937[_0x1c96('0x75')];}var _0x4e9b02=this[_0x1c96('0xe')][_0x1c96('0xad')](_0x1c96('0xae'),_0x697129);if(_0x4e9b02[_0x1c96('0xa0')]===-0x1){return _0x4e9b02;}var _0x37c895=this[_0x1c96('0x9f')](_0x1c96('0xaf'),_0x1c96('0xb0'));if(_0x37c895[_0x1c96('0xa0')]===-0x1){return _0x37c895;}var _0x224a49=this[_0x1c96('0x9f')](_0x1c96('0xb1'),_0x1c96('0xb2'));if(_0x224a49[_0x1c96('0xa0')]===-0x1){return _0x224a49;}var _0x11e5d2=this[_0x1c96('0x9f')](_0x1c96('0xb3'),_0x1c96('0xb4'));if(_0x11e5d2[_0x1c96('0xa0')]===-0x1){return _0x11e5d2;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xb5'),_0x697129));};AGIVertices[_0x1c96('0x11')]['agi']=function(_0x1cb976){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xb6'),_0x1cb976['label']));return this['channel'][_0x1c96('0x6')]([_0x1cb976[_0x1c96('0xb7')],_0x1cb976[_0x1c96('0xb8')]]);};AGIVertices[_0x1c96('0x11')]['answer']=function(_0xb02e02){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0xb9'),_0xb02e02[_0x1c96('0x37')]));if(this[_0x1c96('0x7f')](_0xb02e02[_0x1c96('0x62')])){logger['info'](util[_0x1c96('0x53')](_0x1c96('0xba'),_0xb02e02[_0x1c96('0x62')]));var _0x31ce4b=this[_0x1c96('0xe')]['wait'](_0xb02e02[_0x1c96('0x62')]);if(_0x31ce4b[_0x1c96('0xa0')]===-0x1){return _0x31ce4b;}}return this[_0x1c96('0xe')]['answer']();};AGIVertices['prototype'][_0x1c96('0x49')]=function(_0x4fd495){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xbb'),_0x4fd495['label']));if(!this['isConfigured'](_0x4fd495['list_id'])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x4fd495,'no\x20list\x20selected');}_0x4fd495[_0x1c96('0x48')]=moment();if(this['isConfigured'](_0x4fd495[_0x1c96('0xbc')])){_0x4fd495['scheduledAt']=moment()[_0x1c96('0xbd')](_0x4fd495[_0x1c96('0xbc')],_0x1c96('0xbe'));}if(!this[_0x1c96('0x7f')](_0x4fd495[_0x1c96('0x4b')])){_0x4fd495['callback_priority']=0x2;}this[_0x1c96('0x42')]['sync'](this,_0x4fd495);return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xbf'),_0x4fd495[_0x1c96('0x46')],_0x4fd495[_0x1c96('0x47')],_0x4fd495[_0x1c96('0x48')]));};AGIVertices['prototype']['custom_app']=function(_0x29d814){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x29d814[_0x1c96('0x37')]));var _0x2ebb9d=this[_0x1c96('0xe')][_0x1c96('0xad')](_0x29d814['application'],_0x29d814[_0x1c96('0x75')]);if(_0x2ebb9d[_0x1c96('0xa0')]===-0x1){return _0x2ebb9d;}return this['channel'][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xc0'),_0x29d814[_0x1c96('0xc1')],_0x29d814[_0x1c96('0x75')]));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xc2')]=function(_0x27eee2){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xc3'),_0x27eee2[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x27eee2[_0x1c96('0x59')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}var _0x2734aa='\x22'+_0x27eee2[_0x1c96('0x59')]+'\x22';if(this[_0x1c96('0x7f')](_0x27eee2[_0x1c96('0x75')])){_0x2734aa+=','+_0x27eee2['options'];}var _0x23b63a=this[_0x1c96('0xe')][_0x1c96('0xad')](_0x1c96('0xc4'),_0x2734aa);if(_0x23b63a['result']===-0x1){return _0x23b63a;}return this['channel'][_0x1c96('0xa9')](util['format'](_0x1c96('0xc5'),_0x2734aa));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xc6')]=function(_0x150d8c){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xc7'),_0x150d8c[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x150d8c[_0x1c96('0x59')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}var _0x1b77d1='\x22'+_0x150d8c['text']+'\x22';if(this[_0x1c96('0x7f')](_0x150d8c[_0x1c96('0x75')])){_0x1b77d1+=','+_0x150d8c[_0x1c96('0x75')];}var _0x53a4a3=this[_0x1c96('0xe')]['exec'](_0x1c96('0xc4'),_0x1b77d1);if(_0x53a4a3[_0x1c96('0xa0')]===-0x1){return _0x53a4a3;}return this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1b77d1));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xc8')]=function(_0x5b9ff2){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xc9'),_0x5b9ff2[_0x1c96('0x37')]));if(!this['isConfigured'](_0x5b9ff2['grammar'])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xac'));}var _0x66545a=_0x5b9ff2[_0x1c96('0xab')];if(this['isConfigured'](_0x5b9ff2[_0x1c96('0x75')])){_0x66545a+=','+_0x5b9ff2[_0x1c96('0x75')];}var _0x16f5db=this[_0x1c96('0xe')][_0x1c96('0xad')](_0x1c96('0xae'),_0x66545a);if(_0x16f5db[_0x1c96('0xa0')]===-0x1){return _0x16f5db;}var _0x1c69cf=this[_0x1c96('0x9f')](_0x1c96('0xaf'),_0x1c96('0xca'));if(_0x1c69cf['result']===-0x1){return _0x1c69cf;}var _0x3e1047=this[_0x1c96('0x9f')](_0x1c96('0xb1'),_0x1c96('0xcb'));if(_0x3e1047[_0x1c96('0xa0')]===-0x1){return _0x3e1047;}var _0x65c84=this[_0x1c96('0x9f')]('RECOG_INSTANCE()',_0x1c96('0xcc'));if(_0x65c84['result']===-0x1){return _0x65c84;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xb5'),_0x66545a));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xcd')]=function(_0x961bd3){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xce'),_0x961bd3['label']));if(!this[_0x1c96('0x7f')](_0x961bd3['grammar'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xac'));}var _0x36d6ca=_0x961bd3[_0x1c96('0xab')];if(this['isConfigured'](_0x961bd3[_0x1c96('0x75')])){_0x36d6ca+=','+_0x961bd3[_0x1c96('0x75')];}var _0x270d95=this[_0x1c96('0xe')][_0x1c96('0xad')](_0x1c96('0xae'),_0x36d6ca);if(_0x270d95['result']===-0x1){return _0x270d95;}var _0x12421e=this[_0x1c96('0x9f')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x12421e['result']===-0x1){return _0x12421e;}var _0x5c37fc=this['getAndSetVariable'](_0x1c96('0xb1'),_0x1c96('0xcf'));if(_0x5c37fc['result']===-0x1){return _0x5c37fc;}var _0x4fe089=this[_0x1c96('0x9f')](_0x1c96('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x4fe089[_0x1c96('0xa0')]===-0x1){return _0x4fe089;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xb5'),_0x36d6ca));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xd0')]=function(_0x56051f){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x56051f[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x56051f[_0x1c96('0xd1')])){return this[_0x1c96('0xe')]['error'](_0x56051f,_0x1c96('0xd2'));}var _0x1b700b=this[_0x1c96('0x1b')]['sync'](this,_0x56051f[_0x1c96('0xd1')]);if(!_0x1b700b){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x56051f,_0x1c96('0xd3'));}if(!this[_0x1c96('0x7f')](_0x56051f[_0x1c96('0x2d')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x56051f,_0x1c96('0xd4'));}var _0x5db1d6=_0x56051f[_0x1c96('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0xd5'),_0x5db1d6));var _0x28aa5b=this[_0x1c96('0x29')][_0x1c96('0xa3')](this,_0x1b700b,_0x5db1d6);this['createSquareDetailsReport']['sync'](this,_0x56051f,_0x5db1d6);if(!this[_0x1c96('0x7f')](_0x56051f['variable_id'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xd6'));}var _0x9fa663=this[_0x1c96('0x12')][_0x1c96('0xa3')](this,_0x56051f[_0x1c96('0xd7')]);if(!_0x9fa663){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x56051f,_0x1c96('0xd8'));}var _0x4ed891=this;_0x28aa5b[_0x1c96('0xd9')](function(_0x13ae2c,_0x3cf35d){Object['keys'](_0x13ae2c)['forEach'](function(_0x5a9c9c){_0x4ed891[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')](_0x1c96('0xda'),_0x9fa663,_0x3cf35d,_0x5a9c9c),_0x13ae2c[_0x5a9c9c]);});});this[_0x1c96('0xe')]['setVariable'](util[_0x1c96('0x53')](_0x1c96('0xdb'),_0x9fa663),_0x28aa5b[_0x1c96('0x98')]);return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xdc'),_0x9fa663));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xdd')]=function(_0x14a063){logger['debug'](util[_0x1c96('0x53')](_0x1c96('0xde'),_0x14a063[_0x1c96('0x37')]));if(!this['isConfigured'](_0x14a063[_0x1c96('0xdf')])){return this[_0x1c96('0xe')]['error'](_0x14a063,'no\x20user\x20selected');}var _0x39e479=this[_0x1c96('0x1c')][_0x1c96('0xa3')](this,_0x14a063[_0x1c96('0xdf')]);if(!_0x39e479){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x14a063,_0x1c96('0xe0'));}var _0x421626=this[_0x1c96('0xe')]['exec'](_0x1c96('0xe1'),[util[_0x1c96('0x53')]('SIP/%s',_0x39e479),_0x14a063[_0x1c96('0x62')],_0x14a063[_0x1c96('0xe2')],_0x14a063[_0x1c96('0x6d')]]);if(_0x421626['result']===-0x1){return _0x421626;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format'](_0x1c96('0xe3'),_0x1c96('0xe1')));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xe4')]=function(_0x5b022e){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xe5'),_0x5b022e['label']));if(!this[_0x1c96('0x7f')](_0x5b022e['key'])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xe6'));}if(!this[_0x1c96('0x7f')](_0x5b022e[_0x1c96('0x59')])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xe7')]=!![];this[_0x1c96('0x35')](_0x5b022e);this['createSquareMessage'](_0x5b022e[_0x1c96('0x59')],'in','','');this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format'](_0x1c96('0xe8'),_0x5b022e[_0x1c96('0x59')]));var _0x2e68db=this[_0x1c96('0x76')][_0x1c96('0xa3')](this,_0x5b022e);if(_0x2e68db){for(var _0x7b8d1b in _0x2e68db){if(_0x2e68db[_0x1c96('0x91')](_0x7b8d1b)){this['channel'][_0x1c96('0x9b')](util[_0x1c96('0x53')]('DIALOGFLOW_%s',_0x7b8d1b['toUpperCase']()),_0x2e68db[_0x7b8d1b]);}}this[_0x1c96('0x41')](_0x2e68db[_0x1c96('0xe9')],_0x1c96('0xea'),_0x1c96('0xe4'),'');return this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0xeb'),_0x2e68db[_0x1c96('0xe9')]));}return this[_0x1c96('0xe')]['error'](_0x5b022e,_0x1c96('0xec'));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xed')]=function(_0x38cb5b){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xee'),_0x38cb5b['label']));if(!this['isConfigured'](_0x38cb5b[_0x1c96('0x7a')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xef'));}if(!this['isConfigured'](_0x38cb5b['client_email'])){return this['channel'][_0x1c96('0xa9')](_0x1c96('0xf0'));}if(!this[_0x1c96('0x7f')](_0x38cb5b['private_key'])){return this['channel'][_0x1c96('0xa9')](_0x1c96('0xf1'));}if(!this[_0x1c96('0x7f')](_0x38cb5b[_0x1c96('0xf2')])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xf3'));}if(!this['isConfigured'](_0x38cb5b[_0x1c96('0x59')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xe7')]=!![];this[_0x1c96('0x35')](_0x38cb5b);this['createSquareMessage'](_0x38cb5b[_0x1c96('0x59')],'in','','');this['channel']['noop'](util[_0x1c96('0x53')]('Trying\x20DialogflowV2:\x20%s',_0x38cb5b[_0x1c96('0x59')]));var _0x31111e=this[_0x1c96('0x79')][_0x1c96('0xa3')](this,_0x38cb5b);if(_0x31111e){for(var _0x36db65 in _0x31111e){if(_0x31111e[_0x1c96('0x91')](_0x36db65)){if(_0x36db65!=='providerResponse'){this['channel'][_0x1c96('0x9b')](util[_0x1c96('0x53')](_0x1c96('0xf4'),_0x36db65['toUpperCase']()),_0x31111e[_0x36db65]);}}}this[_0x1c96('0x41')](_0x31111e[_0x1c96('0xe9')],_0x1c96('0xea'),_0x1c96('0xed'),_0x31111e[_0x1c96('0xf5')]);return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('DialogflowV2\x20Result\x20%s',_0x31111e[_0x1c96('0xe9')]));}return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x38cb5b,_0x1c96('0xf6'));};AGIVertices['prototype'][_0x1c96('0xf7')]=function(_0x1630d3){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0xf8'),_0x1630d3[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x1630d3['ndauth_url'])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xf9'));}if(!this[_0x1c96('0x7f')](_0x1630d3['username'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xfa'));}if(!this[_0x1c96('0x7f')](_0x1630d3[_0x1c96('0xfb')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xfc'));}if(!this[_0x1c96('0x7f')](_0x1630d3[_0x1c96('0xfd')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xe7')]=!![];this[_0x1c96('0x35')](_0x1630d3);this[_0x1c96('0x41')](_0x1630d3[_0x1c96('0x59')],'in','','');this['channel'][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xfe'),_0x1630d3['text']));var _0x55fc48=this[_0x1c96('0x7b')][_0x1c96('0xa3')](this,_0x1630d3);if(_0x55fc48){for(var _0x1b1e1a in _0x55fc48){if(_0x55fc48[_0x1c96('0x91')](_0x1b1e1a)){this['channel'][_0x1c96('0x9b')](util['format'](_0x1c96('0xff'),_0x1b1e1a[_0x1c96('0x66')]()),_0x55fc48[_0x1b1e1a]);}}this[_0x1c96('0x41')](_0x55fc48[_0x1c96('0xe9')],_0x1c96('0xea'),_0x1c96('0xf7'),'');if(_0x55fc48['audiofile']){this['channel'][_0x1c96('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x55fc48[_0x1c96('0x100')]));var _0x48536f=this['channel'][_0x1c96('0x101')](_0x55fc48[_0x1c96('0x100')]);try{fs[_0x1c96('0x102')](_0x55fc48[_0x1c96('0x100')]+_0x1c96('0x103'));}catch(_0x41101a){logger['error'](_0x41101a);}return _0x48536f;}else{return this['channel'][_0x1c96('0xa9')](util['format']('SestekNDA\x20Result\x20%s',_0x55fc48[_0x1c96('0xe9')]));}}return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1630d3,_0x1c96('0x104'));};AGIVertices[_0x1c96('0x11')]['end']=function(_0x2d7fd8){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x2d7fd8['label']));return this['channel'][_0x1c96('0xa9')](_0x1c96('0x105'));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x106')]=function(_0x1fa87e){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x107'),_0x1fa87e[_0x1c96('0x37')]));var _0x3ce136='';if(_0x1fa87e[_0x1c96('0x108')]){if(!this[_0x1c96('0x7f')](_0x1fa87e[_0x1c96('0x108')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1fa87e,_0x1c96('0x109'));}else{var _0x1d3203=parseInt(_0x1fa87e[_0x1c96('0x108')],0xa);if(isNaN(_0x1d3203)){_0x3ce136=_0x1fa87e['trunk_id'];}else{_0x3ce136=this[_0x1c96('0x1e')][_0x1c96('0xa3')](this,_0x1fa87e[_0x1c96('0x108')]);if(!_0x3ce136){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1fa87e,'no\x20trunk\x20found');}}}}else if(_0x1fa87e[_0x1c96('0x10a')]){_0x3ce136=_0x1fa87e[_0x1c96('0x10a')];}else{return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1fa87e,_0x1c96('0x109'));}var _0x78fd41=this['channel'][_0x1c96('0xad')](_0x1c96('0xe1'),[util[_0x1c96('0x53')](_0x1c96('0x10b'),_0x3ce136,_0x1fa87e[_0x1c96('0x46')]),_0x1fa87e[_0x1c96('0x62')],_0x1fa87e['opts'],_0x1fa87e[_0x1c96('0x6d')]]);if(_0x78fd41['result']===-0x1){return _0x78fd41;}return this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0xe3'),_0x1c96('0xe1')));};AGIVertices[_0x1c96('0x11')]['finally']=function(_0x46593c){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x46593c['label']));return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x10c'));};AGIVertices[_0x1c96('0x11')][_0x1c96('0xc')]=function(_0x2ebe89){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x10d'),_0x2ebe89['label']));if(_0x2ebe89[_0x1c96('0xa4')]===0x0){return this[_0x1c96('0xa5')](_0x2ebe89);}_0x2ebe89['retry']-=0x1;if(!this[_0x1c96('0x7f')](_0x2ebe89[_0x1c96('0x10e')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x2ebe89,'no\x20file\x20audio\x20selected');}var _0x57c41c=this['getSound'][_0x1c96('0xa3')](this,_0x2ebe89[_0x1c96('0x10e')]);if(!_0x57c41c){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x2ebe89,_0x1c96('0x10f'));}if(!this[_0x1c96('0x7f')](_0x2ebe89[_0x1c96('0xd7')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1c96('0xd6'));}var _0x2a3197=this[_0x1c96('0xe')][_0x1c96('0x110')](_0x57c41c,_0x2ebe89[_0x1c96('0x111')],_0x2ebe89['maxdigit']);var _0x2bc8ad=_0x2a3197[_0x1c96('0xa0')]?_0x2a3197[_0x1c96('0xa0')][_0x1c96('0x9e')]():'';logger[_0x1c96('0x2b')](_0x1c96('0x112'),JSON[_0x1c96('0x6e')](_0x2a3197));if(_0x2a3197[_0x1c96('0xa0')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x2ebe89,_0x2bc8ad);return _0x2a3197;}else if(_0x2a3197['extra']==='timeout'){_0x2a3197[_0x1c96('0xa0')]=_0x2bc8ad[_0x1c96('0x98')]>=parseInt(_0x2ebe89[_0x1c96('0x113')])?'x':'i';}else{_0x2a3197[_0x1c96('0xa0')]=_0x2bc8ad[_0x1c96('0x98')]>=parseInt(_0x2ebe89[_0x1c96('0x113')])&&_0x2bc8ad[_0x1c96('0x98')]<=parseInt(_0x2ebe89[_0x1c96('0x114')])?'x':'i';}var _0x20025d=this[_0x1c96('0x12')]['sync'](this,_0x2ebe89[_0x1c96('0xd7')]);if(!_0x20025d){return this[_0x1c96('0xe')]['error'](_0x2ebe89,_0x1c96('0xd8'));}this[_0x1c96('0xe')][_0x1c96('0x9b')](_0x20025d,_0x2bc8ad);if(this[_0x1c96('0x7f')](_0x2ebe89['hiddendigitsnum'])){var _0x10fef5=parseInt(_0x2ebe89[_0x1c96('0x115')],0xa);var _0x3c0670=rs[_0x1c96('0x116')]({'charset':'*','length':_0x10fef5});var _0x377365=_0x2bc8ad[_0x1c96('0x98')];if(_0x377365>0x0){if(_0x377365>_0x10fef5){this['createSquareDetailsReport']['sync'](this,_0x2ebe89,_0x2ebe89[_0x1c96('0x117')]==='first'?_0x3c0670+_0x2bc8ad[_0x1c96('0x118')](_0x10fef5):_0x2bc8ad[_0x1c96('0x118')](0x0,_0x377365-_0x10fef5)+_0x3c0670);}else{this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x2ebe89,rs[_0x1c96('0x116')]({'charset':'*','length':_0x377365}));}}else{this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x2ebe89,'');}}else{this['createSquareDetailsReport'][_0x1c96('0xa3')](this,_0x2ebe89,_0x2bc8ad);}return _0x2a3197;};AGIVertices[_0x1c96('0x11')][_0x1c96('0xd')]=function(_0x115240){logger['info'](util[_0x1c96('0x53')](_0x1c96('0x119'),_0x115240[_0x1c96('0x37')]));return this[_0x1c96('0xc')](_0x115240);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x11a')]=function(_0x38a5f7){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x11b'),_0x38a5f7[_0x1c96('0x37')]));this[_0x1c96('0x35')]['sync'](this,_0x38a5f7,_0x38a5f7[_0x1c96('0x11c')]);return this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0x11d'),_0x38a5f7[_0x1c96('0x11c')]));};AGIVertices['prototype'][_0x1c96('0x11e')]=function(_0x96ea67){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x96ea67['label']));if(!this['isConfigured'](_0x96ea67[_0x1c96('0x82')])||!this[_0x1c96('0x7f')](_0x96ea67['aws_secret_access_key'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x11f'));}if(!this['isConfigured'](_0x96ea67['text'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0x120'),_0x96ea67[_0x1c96('0x59')]));var _0x2836b5=this[_0x1c96('0x81')][_0x1c96('0xa3')](this,_0x96ea67);if(_0x2836b5){this['channel'][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x121'),_0x2836b5));var _0x56a339=this[_0x1c96('0xe')][_0x1c96('0x101')](_0x2836b5);try{fs['unlink'](_0x2836b5+_0x1c96('0x103'));}catch(_0x57d673){logger['error'](_0x57d673);}return _0x56a339;}return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x96ea67,_0x1c96('0x122'));};AGIVertices['prototype'][_0x1c96('0x123')]=function(_0x131e84){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x124'),_0x131e84['label']));if(!this[_0x1c96('0x7f')](_0x131e84[_0x1c96('0x82')])||!this[_0x1c96('0x7f')](_0x131e84['aws_secret_access_key'])){return this['channel'][_0x1c96('0xa9')](_0x1c96('0x11f'));}if(!this['isConfigured'](_0x131e84[_0x1c96('0x89')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x125'));}if(!this['isConfigured'](_0x131e84[_0x1c96('0x59')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xe7')]=!![];this['createSquareDetailsReport'](_0x131e84);this['createSquareMessage'](_0x131e84['text'],'in','','');this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x126'),_0x131e84[_0x1c96('0x59')]));var _0x25e228=this[_0x1c96('0x86')][_0x1c96('0xa3')](this,_0x131e84);if(_0x25e228){for(var _0x5ed99d in _0x25e228){if(_0x25e228[_0x1c96('0x91')](_0x5ed99d)&&_['isString'](_0x25e228[_0x5ed99d])){this[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')]('AWS_LEX_%s',_0x5ed99d[_0x1c96('0x66')]()),_0x25e228[_0x5ed99d]);}}if(_[_0x1c96('0x43')](_0x25e228['message'])){return this['channel']['noop'](_0x1c96('0x127'));}else{this[_0x1c96('0x41')](_0x25e228[_0x1c96('0x73')],_0x1c96('0xea'),_0x1c96('0x128'),'');return this[_0x1c96('0xe')]['noop'](util['format'](_0x1c96('0x129'),_0x25e228[_0x1c96('0x73')]));}}return this['channel'][_0x1c96('0x31')](_0x131e84,_0x1c96('0x12a'));};AGIVertices['prototype']['googleasr']=function(_0x31bee1){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x12b'),_0x31bee1['label'],_0x31bee1[_0x1c96('0x62')]));if(!this[_0x1c96('0x7f')](_0x31bee1[_0x1c96('0x77')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')]('no\x20key\x20configured');}var _0x511b65=_0x1c96('0x12c');var _0x4e165b=util['format'](_0x1c96('0x12d'),FILES_PATH,rs[_0x1c96('0x116')](0x4));var _0x25df43=util['format'](_0x1c96('0x9a'),_0x4e165b,_0x511b65);var _0x541f9a=!![];if(_0x31bee1[_0x1c96('0x12e')]===_0x1c96('0x12f')){_0x541f9a=![];}var _0x3e9614=this[_0x1c96('0xe')][_0x1c96('0x130')](_0x4e165b,_0x511b65,_0x31bee1[_0x1c96('0x131')],_0x31bee1[_0x1c96('0x62')],undefined,_0x541f9a);if(_0x3e9614[_0x1c96('0xa0')]!==-0x1){this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0x132'),_0x25df43));var _0x14c668=this[_0x1c96('0x8a')]['sync'](this,_0x31bee1,_0x25df43);if(_0x14c668){for(var _0x588a25 in _0x14c668){if(_0x14c668['hasOwnProperty'](_0x588a25)){this[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')](_0x1c96('0x133'),_0x588a25[_0x1c96('0x66')]()),_0x14c668[_0x588a25]);}}return this['channel'][_0x1c96('0xa9')](util['format'](_0x1c96('0x134'),JSON[_0x1c96('0x6e')](_0x14c668)));}}return _0x3e9614;};AGIVertices[_0x1c96('0x11')]['tildeasr']=function(_0x19d15c){logger['info'](util['format'](_0x1c96('0x135'),_0x19d15c[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x19d15c[_0x1c96('0x8d')])){return this[_0x1c96('0xe')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x19d15c[_0x1c96('0x8e')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')]('no\x20appsecret\x20configured');}var _0x446b87='wav';var _0x1f8ff=util[_0x1c96('0x53')](_0x1c96('0x12d'),FILES_PATH,rs[_0x1c96('0x116')](0x4));var _0x364308=util[_0x1c96('0x53')](_0x1c96('0x9a'),_0x1f8ff,_0x446b87);var _0xdcfcb3=!![];if(_0x19d15c[_0x1c96('0x12e')]===_0x1c96('0x12f')){_0xdcfcb3=![];}var _0x1e2711=this[_0x1c96('0xe')][_0x1c96('0x130')](_0x1f8ff,_0x446b87,_0x19d15c[_0x1c96('0x131')],_0x19d15c[_0x1c96('0x62')],undefined,_0xdcfcb3);if(_0x1e2711[_0x1c96('0xa0')]!==-0x1){this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')]('tilde\x20%s\x20file\x20created',_0x364308));var _0x4ebfe9=this[_0x1c96('0x8c')][_0x1c96('0xa3')](this,_0x19d15c,_0x364308);if(_0x4ebfe9){for(var _0x28f2df in _0x4ebfe9){if(_0x4ebfe9[_0x1c96('0x91')](_0x28f2df)){this[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')]('TILDE_ASR_%s',_0x28f2df[_0x1c96('0x66')]()),_0x4ebfe9[_0x28f2df]);}}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x4ebfe9)));}}return _0x1e2711;};AGIVertices[_0x1c96('0x11')][_0x1c96('0x136')]=function(_0x3bb94c){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x137'),_0x3bb94c[_0x1c96('0x37')]));return this['channel'][_0x1c96('0x138')](_0x3bb94c[_0x1c96('0x139')],_0x3bb94c[_0x1c96('0x3c')],_0x3bb94c[_0x1c96('0x3d')]);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x13a')]=function(_0x5d8c67){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x13b'),_0x5d8c67['label']));if(!this[_0x1c96('0x7f')](_0x5d8c67[_0x1c96('0x13c')])){return this[_0x1c96('0xe')]['error'](_0x5d8c67,_0x1c96('0x13d'));}try{var _0x316de7=eval(_0x5d8c67[_0x1c96('0x13c')])?_0x1c96('0x13e'):_0x1c96('0x13f');this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x140'),_0x5d8c67[_0x1c96('0x13c')],_0x316de7));return{'code':0xc8,'result':_0x316de7};}catch(_0x1c5331){return{'code':0xc8,'result':_0x1c96('0x13f')};}};AGIVertices[_0x1c96('0x11')]['gotoiftime']=function(_0x2d64a7){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x141'),_0x2d64a7['label']));if(!this[_0x1c96('0x7f')](_0x2d64a7['interval_id'])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x2d64a7,_0x1c96('0x142'));}var _0x437c85=this['getIntervals']['sync'](this,_0x2d64a7[_0x1c96('0x143')]);if(!_0x437c85){return this['channel'][_0x1c96('0x31')](_0x2d64a7,'no\x20intervals\x20found');}for(var _0x2eaba0=0x0;_0x2eaba0<_0x437c85[_0x1c96('0x98')];_0x2eaba0+=0x1){var _0x497e25=this[_0x1c96('0xe')]['getVariable'](util['format'](_0x1c96('0x144'),_0x437c85[_0x2eaba0]));if(_0x497e25[_0x1c96('0xa0')]===-0x1){return _0x497e25;}logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('IFTIME\x20%s\x20%s',_0x437c85[_0x2eaba0],_0x497e25['extra']));if(_0x497e25[_0x1c96('0xa2')]===_0x1c96('0x13e')){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x145'),_0x437c85[_0x2eaba0],_0x1c96('0x13e')));this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('IFTIME\x20%s\x20%s',_0x437c85[_0x2eaba0],_0x1c96('0x13e')));return{'code':0xc8,'result':_0x1c96('0x13e')};}else{logger[_0x1c96('0x2b')](util['format']('IFTIME\x20%s\x20%s',_0x437c85[_0x2eaba0],_0x1c96('0x13f')));this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format'](_0x1c96('0x145'),_0x437c85[_0x2eaba0],_0x1c96('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x1c96('0x11')][_0x1c96('0x146')]=function(_0xfd9aeb){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xfd9aeb[_0x1c96('0x37')]));return this[_0x1c96('0xe')]['hangup']();};AGIVertices['prototype'][_0x1c96('0x147')]=function(_0x298a59){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x298a59[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x298a59['key'])){return this[_0x1c96('0xe')]['noop'](_0x1c96('0xe6'));}var _0x21958d=_0x1c96('0x12c');var _0x199ffc=util[_0x1c96('0x53')](_0x1c96('0x12d'),FILES_PATH,rs[_0x1c96('0x116')](0x4));var _0xadcafb=util[_0x1c96('0x53')](_0x1c96('0x9a'),_0x199ffc,_0x21958d);var _0x499005=!![];if(_0x298a59[_0x1c96('0x12e')]===_0x1c96('0x12f')){_0x499005=![];}var _0x1cc5e6=this[_0x1c96('0xe')][_0x1c96('0x130')](_0x199ffc,_0x21958d,_0x298a59[_0x1c96('0x131')],_0x298a59[_0x1c96('0x62')],undefined,_0x499005);if(_0x1cc5e6[_0x1c96('0xa0')]!==-0x1){this['channel'][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x148'),_0xadcafb));var _0x43bc35=this[_0x1c96('0x7e')]['sync'](this,_0x298a59,_0xadcafb);if(_0x43bc35){for(var _0x2efccb in _0x43bc35){if(_0x43bc35[_0x1c96('0x91')](_0x2efccb)){this['channel'][_0x1c96('0x9b')](util['format'](_0x1c96('0x149'),_0x2efccb[_0x1c96('0x66')]()),_0x43bc35[_0x2efccb]);}}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x14a'),JSON['stringify'](_0x43bc35)));}}return _0x1cc5e6;};AGIVertices['prototype'][_0x1c96('0x14b')]=function(_0x51afc6){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x14c'),_0x51afc6['label']));if(!this['isConfigured'](_0x51afc6[_0x1c96('0x77')])){return this['channel'][_0x1c96('0xa9')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x51afc6['text'])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('Trying\x20ispeech\x20TTS\x20%s',_0x51afc6[_0x1c96('0x59')]));var _0x18dda8=this[_0x1c96('0x14d')]['sync'](this,_0x51afc6);if(_0x18dda8){this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')]('ispeech\x20%s\x20file\x20created',_0x18dda8));var _0x33d60f=this[_0x1c96('0xe')][_0x1c96('0x101')](_0x18dda8,_0x51afc6[_0x1c96('0x131')]);try{fs[_0x1c96('0x102')](_0x18dda8+_0x1c96('0x103'));}catch(_0x2f684c){logger[_0x1c96('0x31')](_0x2f684c);}return _0x33d60f;}return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x51afc6,_0x1c96('0x14e'));};AGIVertices['prototype'][_0x1c96('0x14f')]=function(_0x431dee){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x150'),_0x431dee['label']));if(!this[_0x1c96('0x7f')](_0x431dee[_0x1c96('0x151')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x431dee,'no\x20find\x20by\x20configured');}logger['info'](util[_0x1c96('0x53')](_0x1c96('0x152'),this['channel'][_0x1c96('0x39')],_0x431dee[_0x1c96('0x151')]));var _0x444224=this[_0x1c96('0x51')]['sync'](this,_0x431dee['findBy']);if(_0x444224){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x153'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0x431dee['findBy']));this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1c96('0xe')][_0x1c96('0x39')],_0x431dee[_0x1c96('0x151')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x1c96('0x154'),this[_0x1c96('0xe')]['callerid'],_0x431dee[_0x1c96('0x151')]));this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1c96('0xe')][_0x1c96('0x39')],_0x431dee[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x155')};}};AGIVertices[_0x1c96('0x11')]['logout']=function(_0x50a18d){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x156'),_0x50a18d[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x50a18d[_0x1c96('0x151')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x50a18d,'no\x20find\x20by\x20configured');}logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x152'),this[_0x1c96('0xe')]['callerid'],_0x50a18d[_0x1c96('0x151')]));var _0x34a5dd=this[_0x1c96('0x4f')][_0x1c96('0xa3')](this,_0x50a18d[_0x1c96('0x151')]);if(_0x34a5dd){logger[_0x1c96('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1c96('0x39')],_0x50a18d['findBy']));this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0x153'),this['channel'][_0x1c96('0x39')],_0x50a18d[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x157')};}else{logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x154'),this['channel'][_0x1c96('0x39')],_0x50a18d['findBy']));this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0x154'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0x50a18d[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x155')};}};AGIVertices['prototype'][_0x1c96('0x158')]=function(_0x257733){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x257733[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x257733[_0x1c96('0x159')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x257733,_0x1c96('0x15a'));}this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('math\x20%s',_0x257733['operation']));var _0x2edaed=eval(_0x257733[_0x1c96('0x159')]);if(!this[_0x1c96('0x7f')](_0x257733[_0x1c96('0xd7')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5a77a0=this[_0x1c96('0x12')][_0x1c96('0xa3')](this,_0x257733['variable_id']);if(!_0x5a77a0){return this['channel']['error'](_0x257733,'no\x20variable\x20found');}if(_[_0x1c96('0x97')](_0x2edaed)){var _0x34d095=this;_0x2edaed[_0x1c96('0xd9')](function(_0x4181c1,_0x315e00){_0x34d095[_0x1c96('0xe')]['setVariable'](util[_0x1c96('0x53')](_0x1c96('0x15b'),_0x5a77a0,_0x315e00),_0x4181c1);});return this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0x15c'),_0x5a77a0));}else{return this['channel'][_0x1c96('0x9b')](_0x5a77a0,_0x2edaed);}};AGIVertices[_0x1c96('0x11')][_0x1c96('0xb')]=function(_0x1a21bf){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x15d'),_0x1a21bf[_0x1c96('0x37')]));if(_0x1a21bf[_0x1c96('0xa4')]===0x0){return this[_0x1c96('0xa5')](_0x1a21bf);}_0x1a21bf[_0x1c96('0xa4')]-=0x1;if(!this['isConfigured'](_0x1a21bf['file_id'])){return this['channel'][_0x1c96('0x31')](_0x1a21bf,_0x1c96('0x15e'));}var _0x512e61=this[_0x1c96('0x15f')]['sync'](this,_0x1a21bf[_0x1c96('0x10e')]);if(!_0x512e61){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x1a21bf,_0x1c96('0x10f'));}var _0x33eb12=this[_0x1c96('0xe')]['getData'](_0x512e61,_0x1a21bf[_0x1c96('0x111')],_0x1a21bf[_0x1c96('0x160')]);var _0x1faff4=_0x33eb12[_0x1c96('0xa0')];if(_0x33eb12['result']===-0x1){this['createSquareDetailsReport'][_0x1c96('0xa3')](this,_0x1a21bf,'-1');return _0x33eb12;}else if(_0x33eb12['extra']===_0x1c96('0x62')){_0x33eb12['result']=_0x33eb12[_0x1c96('0xa0')][_0x1c96('0x98')]>0x0?_0x33eb12[_0x1c96('0xa0')]:'t';}else if(_['isEmpty'](_0x33eb12['result'])){_0x33eb12[_0x1c96('0xa0')]='#';_0x1faff4='#';}if(!this[_0x1c96('0x7f')](_0x1a21bf[_0x1c96('0xd7')])){this[_0x1c96('0xe')][_0x1c96('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4cd869=this['getVariable']['sync'](this,_0x1a21bf[_0x1c96('0xd7')]);if(!_0x4cd869){return this[_0x1c96('0xe')]['error'](_0x1a21bf,'no\x20variable\x20found');}this[_0x1c96('0xe')][_0x1c96('0x9b')](_0x4cd869,_0x1faff4);}this['createSquareDetailsReport'][_0x1c96('0xa3')](this,_0x1a21bf,_0x1faff4);return _0x33eb12;};AGIVertices[_0x1c96('0x11')][_0x1c96('0xa9')]=function(_0x3c4855){logger['info'](util[_0x1c96('0x53')](_0x1c96('0x161'),_0x3c4855['label']));return this[_0x1c96('0xe')]['noop'](_0x3c4855[_0x1c96('0x162')]||_0x3c4855[_0x1c96('0x37')]);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x163')]=function(_0xe8fa09){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x164'),_0xe8fa09[_0x1c96('0x37')]));if(!this['isConfigured'](_0xe8fa09['findBy'])){return this['channel'][_0x1c96('0x31')](_0xe8fa09,'no\x20find\x20by\x20configured');}logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x152'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0xe8fa09[_0x1c96('0x151')]));var _0x4aa43f=this[_0x1c96('0x4c')]['sync'](this,_0xe8fa09[_0x1c96('0x165')]);var _0x687589=this[_0x1c96('0x166')]['sync'](this,_0xe8fa09['findBy'],_0x4aa43f);if(_0x687589){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x153'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0xe8fa09['findBy']));this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x153'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0xe8fa09[_0x1c96('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1c96('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1c96('0x39')],_0xe8fa09[_0x1c96('0x151')]));this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0x153'),this['channel']['callerid'],_0xe8fa09[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x155')};}};AGIVertices[_0x1c96('0x11')]['playback']=function(_0x916342){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x167'),_0x916342[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x916342[_0x1c96('0x10e')])){return this['channel']['error'](_0x916342,_0x1c96('0x15e'));}var _0x580e95=this['getSound'][_0x1c96('0xa3')](this,_0x916342['file_id']);if(!_0x580e95){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x916342,_0x1c96('0x10f'));}var _0x4bcbdc=this[_0x1c96('0xe')]['exec'](_0x1c96('0x168'),[_0x580e95,_0x916342[_0x1c96('0xe2')]]);if(_0x4bcbdc[_0x1c96('0xa0')]===-0x1){return _0x4bcbdc;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')]('Executed\x20command\x20%s\x20%s',_0x1c96('0x168'),_0x580e95));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x169')]=function(_0x3561f3){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x16a'),_0x3561f3[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x3561f3[_0x1c96('0x16b')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x3561f3,_0x1c96('0x16c'));}var _0x81f66b='';var _0x2624e9=parseInt(_0x3561f3[_0x1c96('0x16b')],0xa);if(isNaN(_0x2624e9)){_0x81f66b=_0x3561f3[_0x1c96('0x16b')];}else{_0x81f66b=this[_0x1c96('0x17')][_0x1c96('0xa3')](this,_0x3561f3[_0x1c96('0x16b')]);if(!_0x81f66b){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x3561f3,_0x1c96('0x16d'));}}var _0x16b3ee='';if(this[_0x1c96('0x7f')](_0x3561f3['file_id'])){var _0x466217=this['getSound'][_0x1c96('0xa3')](this,_0x3561f3[_0x1c96('0x10e')]);if(_0x466217){_0x16b3ee=_0x466217;}}this[_0x1c96('0x35')]['sync'](this,_0x3561f3,_0x81f66b);if(_0x3561f3[_0x1c96('0xe2')][_0x1c96('0x16e')]('x')<0x0){_0x3561f3[_0x1c96('0xe2')]+='x';}if(_0x3561f3[_0x1c96('0xe2')][_0x1c96('0x16e')]('X')<0x0){_0x3561f3['opts']+='X';}this[_0x1c96('0xe')]['setVariable'](_0x1c96('0x16f'),_0x81f66b?_0x81f66b['toLowerCase']():'');var _0x13dad1=this[_0x1c96('0xe')]['exec']('QUEUE',[_0x81f66b,_0x3561f3[_0x1c96('0xe2')],_0x3561f3[_0x1c96('0x6d')],_0x16b3ee,_0x3561f3['timeout'],_0x3561f3[_0x1c96('0x6')],_0x3561f3['macro'],_0x3561f3[_0x1c96('0x170')],'',_0x3561f3[_0x1c96('0x171')]]);if(_0x13dad1[_0x1c96('0xa0')]===-0x1){return _0x13dad1;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format'](_0x1c96('0xc0'),'QUEUE',_0x81f66b));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x172')]=function(_0x2789e6){logger['info'](util[_0x1c96('0x53')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2789e6[_0x1c96('0x37')]));var _0x5eb1d3=_0x2789e6['recordingFormat']||_0x1c96('0x12c');var _0x4ffaba=util[_0x1c96('0x53')](_0x1c96('0x173'),this[_0x1c96('0xe')][_0x1c96('0x36')],rs[_0x1c96('0x116')](0x5));var _0x53f3ab=util[_0x1c96('0x53')](_0x1c96('0x174'),FILES_PATH,_0x4ffaba,_0x5eb1d3);var _0x243ea0=util[_0x1c96('0x53')](_0x1c96('0x12d'),FILES_PATH,_0x4ffaba);this[_0x1c96('0x3a')][_0x1c96('0xa3')](this,_0x2789e6,_0x4ffaba,_0x53f3ab);this[_0x1c96('0xe')][_0x1c96('0x9b')](_0x1c96('0x175'),_0x4ffaba);logger[_0x1c96('0x2b')](_0x1c96('0x176'),_0x243ea0,_0x5eb1d3,_0x2789e6[_0x1c96('0x177')],_0x2789e6['timeout']);return this[_0x1c96('0xe')]['recordFile'](_0x243ea0,_0x5eb1d3,_0x2789e6[_0x1c96('0x177')],_0x2789e6[_0x1c96('0x62')],undefined,!![]);};AGIVertices[_0x1c96('0x11')]['restapi']=function(_0x46d28c){logger['info'](util[_0x1c96('0x53')](_0x1c96('0x178'),_0x46d28c['label']));if(!this[_0x1c96('0x7f')](_0x46d28c[_0x1c96('0x6d')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x179'));}var _0x400366=this[_0x1c96('0x17a')][_0x1c96('0xa3')](this,_0x46d28c);logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Response:',util[_0x1c96('0x17b')](_0x400366,{'showHidden':![],'depth':null})));if(!this[_0x1c96('0x7f')](_0x46d28c[_0x1c96('0xd7')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x173344=this[_0x1c96('0x12')][_0x1c96('0xa3')](this,_0x46d28c['variable_id']);if(!_0x173344){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x46d28c,'no\x20variable\x20found');}this[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')](_0x1c96('0x17c'),_0x173344),_0x400366[_0x1c96('0x71')]?_0x400366[_0x1c96('0x71')]:'200');this[_0x1c96('0xe')][_0x1c96('0x9b')](util[_0x1c96('0x53')](_0x1c96('0x17d'),_0x173344),_0x400366[_0x1c96('0x72')]?_0x400366[_0x1c96('0x72')]:'OK');if(_0x400366['body']){try{this[_0x1c96('0x99')](_0x400366[_0x1c96('0x6f')],_0x173344);}catch(_0x538ae5){logger['error'](util[_0x1c96('0x53')](_0x1c96('0x17e'),_0x173344));}}return this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0xdc'),_0x173344));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x17f')]=function(_0x43c503){logger[_0x1c96('0x2b')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x43c503[_0x1c96('0x37')]));return this['channel']['sayDigits'](_0x43c503[_0x1c96('0x180')][_0x1c96('0x181')](/\s+/g,''),_0x43c503[_0x1c96('0x177')]);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x182')]=function(_0x11dd6d){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x183'),_0x11dd6d['label']));return this[_0x1c96('0xe')][_0x1c96('0x184')](_0x11dd6d[_0x1c96('0x63')][_0x1c96('0x181')](/\s+/g,''),_0x11dd6d[_0x1c96('0x177')]);};AGIVertices[_0x1c96('0x11')]['sayphonetic']=function(_0x2a3c8c){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x185'),_0x2a3c8c[_0x1c96('0x37')]));return this['channel'][_0x1c96('0x186')](_0x2a3c8c[_0x1c96('0x59')],_0x2a3c8c[_0x1c96('0x177')]);};AGIVertices[_0x1c96('0x11')]['sendMail']=function(_0x2ad6c5){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x187'),_0x2ad6c5['label']));if(!this['isConfigured'](_0x2ad6c5[_0x1c96('0x188')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x189'));}var _0x574af3=this['getMailAccount'][_0x1c96('0xa3')](this,_0x2ad6c5[_0x1c96('0x188')]);if(!_0x574af3||!_0x574af3[_0x1c96('0x18a')]){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x2ad6c5,_0x1c96('0x18b'));}var _0x2aaa2d={'from':util[_0x1c96('0x53')](_0x1c96('0x18c'),_0x574af3[_0x1c96('0x15')],_0x574af3['email']||_0x574af3[_0x1c96('0x18a')][_0x1c96('0x18d')]),'to':_0x2ad6c5['to']||'','cc':_0x2ad6c5['cc']||'','bcc':_0x2ad6c5[_0x1c96('0x18e')]||'','subject':_0x2ad6c5['subject'],'html':_0x2ad6c5['text'],'text':_0x2ad6c5[_0x1c96('0x59')]};if(this['isConfigured'](_0x2ad6c5[_0x1c96('0x18f')])){}logger[_0x1c96('0x190')]('sendMail\x20message',JSON[_0x1c96('0x6e')](_0x2aaa2d));this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x2ad6c5,_0x2ad6c5['account_id']);this['channel'][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x191'),_0x574af3[_0x1c96('0x15')]));this[_0x1c96('0x22')]['sync'](this,_0x574af3[_0x1c96('0x192')],_0x2aaa2d);return this[_0x1c96('0xe')][_0x1c96('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x1c96('0x193')]=function(_0x304982){logger['info'](util[_0x1c96('0x53')](_0x1c96('0x194'),_0x304982[_0x1c96('0x37')]));return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x195'));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x196')]=function(_0x18e1fa){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x197'),_0x18e1fa['label']));if(!this[_0x1c96('0x7f')](_0x18e1fa[_0x1c96('0x198')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x199'));}var _0x197dd5=this[_0x1c96('0x32')][_0x1c96('0xa3')](this,_0x18e1fa[_0x1c96('0x198')]);if(!_0x197dd5){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x18e1fa,_0x1c96('0x19a'));}var _0x52db27={'body':_0x18e1fa[_0x1c96('0x19b')],'phone':_0x18e1fa['to']||'','SmsAccountId':_0x197dd5['id']};logger['debug'](_0x1c96('0x19c'),JSON['stringify'](_0x52db27));this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x18e1fa,_0x18e1fa[_0x1c96('0x198')]);this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format'](_0x1c96('0x19d'),_0x197dd5[_0x1c96('0x15')]));this[_0x1c96('0x34')][_0x1c96('0xa3')](this,_0x52db27);return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x19e'));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x19f')]=function(_0xc2574e){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1a0'),_0xc2574e[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0xc2574e[_0x1c96('0xd7')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0xc2574e,_0x1c96('0x1a1'));}var _0x3bb7d2=this[_0x1c96('0x12')]['sync'](this,_0xc2574e[_0x1c96('0xd7')]);if(!_0x3bb7d2){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0xc2574e,_0x1c96('0xd8'));}return this[_0x1c96('0xe')]['setVariable'](_0x3bb7d2,_0xc2574e[_0x1c96('0x1a2')]);};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1a3')]=function(_0x2b8f9b){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1a4'),_0x2b8f9b[_0x1c96('0x37')]));this['channel']['noop'](_0x1c96('0x1a5'));if(_0x2b8f9b[_0x1c96('0x1a6')]===_0x1c96('0x1a7')){this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x1a8'));return this[_0x1c96('0xe')][_0x1c96('0x1a6')]();}return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x1a9'));};AGIVertices['prototype'][_0x1c96('0x1aa')]=function(_0x2ab9b7){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x1ab'),_0x2ab9b7['label']));if(!this[_0x1c96('0x7f')](_0x2ab9b7[_0x1c96('0x1ac')])){return this['channel']['error'](_0x2ab9b7,_0x1c96('0x1ad'));}var _0x341b84=this[_0x1c96('0x19')][_0x1c96('0xa3')](this,_0x2ab9b7['project_id']);if(!this[_0x1c96('0x7f')](_0x341b84)){return this[_0x1c96('0xe')]['error'](_0x2ab9b7,util[_0x1c96('0x53')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2ab9b7[_0x1c96('0x1ac')]));}if(_0x341b84===this[_0x1c96('0xe')][_0x1c96('0x1ae')]){return this['channel'][_0x1c96('0x31')](_0x2ab9b7,_0x1c96('0x1af'));}this[_0x1c96('0x35')]['sync'](this,_0x2ab9b7,_0x341b84);var _0xc745d7=this[_0x1c96('0xe')]['exec']('AGI',util[_0x1c96('0x53')](_0x1c96('0x1b0'),config['agi'][_0x1c96('0x1b1')]||_0x1c96('0x1b2'),_0x341b84,this['channel'][_0x1c96('0x1ae')]));if(_0xc745d7[_0x1c96('0xa0')]===-0x1){return _0xc745d7;}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0xc0'),_0x1c96('0x1b3'),_0x341b84));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1b4')]=function(_0x3d1361){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1b5'),_0x3d1361[_0x1c96('0x37')]));var _0x3df2b2=this[_0x1c96('0x1b6')][_0x1c96('0xa3')](this,_0x3d1361[_0x1c96('0xb7')]);this[_0x1c96('0x35')][_0x1c96('0xa3')](this,_0x3d1361,_0x3d1361[_0x1c96('0xb7')]);if(this[_0x1c96('0x7f')](_0x3d1361[_0x1c96('0xd7')])){var _0x517b0e=this[_0x1c96('0x12')][_0x1c96('0xa3')](this,_0x3d1361[_0x1c96('0xd7')]);if(_0x517b0e){this[_0x1c96('0xe')][_0x1c96('0x9b')](_0x517b0e,_0x3df2b2);return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x1b7'),_0x3d1361[_0x1c96('0xb7')],_0x517b0e));}}return this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x1b8'),_0x3d1361[_0x1c96('0xb7')]));};AGIVertices[_0x1c96('0x11')]['google_cloud_tts']=function(_0x4b250b){logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x1b9'),_0x4b250b[_0x1c96('0x37')]));_0x4b250b[_0x1c96('0x59')]=_0x4b250b['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1c96('0x7f')](_0x4b250b[_0x1c96('0x57')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0x1ba'));}if(!this[_0x1c96('0x7f')](_0x4b250b[_0x1c96('0x59')])){return this['channel'][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x1bb'),_0x4b250b[_0x1c96('0x59')]));var _0x11998a=this[_0x1c96('0x56')]['sync'](this,_0x4b250b);if(_0x11998a){this['channel']['noop'](util[_0x1c96('0x53')](_0x1c96('0x1bc'),_0x11998a));var _0x1845ba=this[_0x1c96('0xe')][_0x1c96('0x101')](_0x11998a);try{fs[_0x1c96('0x102')](_0x11998a+_0x1c96('0x103'));}catch(_0x287e66){logger[_0x1c96('0x31')](_0x287e66);}return _0x1845ba;}return this['channel']['error'](_0x4b250b,_0x1c96('0x1bd'));};AGIVertices[_0x1c96('0x11')]['tts']=function(_0x5bcd5d){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1be'),_0x5bcd5d[_0x1c96('0x37')]));_0x5bcd5d[_0x1c96('0x59')]=_0x5bcd5d[_0x1c96('0x59')][_0x1c96('0x181')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5bcd5d[_0x1c96('0x59')])){return this[_0x1c96('0xe')][_0x1c96('0xa9')](_0x1c96('0xa8'));}this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x1bf'),_0x5bcd5d[_0x1c96('0x59')]));var _0x27571d=this['googleTTS'][_0x1c96('0xa3')](this,_0x5bcd5d);if(_0x27571d){this['channel']['noop'](util[_0x1c96('0x53')]('Google\x20TTS\x20%s\x20file\x20created',_0x27571d));var _0x30e996=this[_0x1c96('0xe')]['streamFile'](_0x27571d);try{fs[_0x1c96('0x102')](_0x27571d+'.wav');}catch(_0x9ea293){logger['error'](_0x9ea293);}return _0x30e996;}return this['channel']['error'](_0x5bcd5d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1c96('0x11')]['unpause']=function(_0x331313){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x331313[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x331313['findBy'])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x331313,_0x1c96('0x1c0'));}logger[_0x1c96('0x2b')](util['format'](_0x1c96('0x152'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0x331313[_0x1c96('0x151')]));var _0x546220=this[_0x1c96('0x4e')][_0x1c96('0xa3')](this,_0x331313['findBy']);if(_0x546220){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x153'),this[_0x1c96('0xe')][_0x1c96('0x39')],_0x331313[_0x1c96('0x151')]));this[_0x1c96('0xe')][_0x1c96('0xa9')](util[_0x1c96('0x53')](_0x1c96('0x153'),this['channel'][_0x1c96('0x39')],_0x331313[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x157')};}else{logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x154'),this[_0x1c96('0xe')]['callerid'],_0x331313[_0x1c96('0x151')]));this[_0x1c96('0xe')][_0x1c96('0xa9')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1c96('0xe')][_0x1c96('0x39')],_0x331313[_0x1c96('0x151')]));return{'code':0xc8,'result':_0x1c96('0x155')};}};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1c1')]=function(_0x1f12da){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1c2'),_0x1f12da[_0x1c96('0x37')]));var _0x1b21c2=this['channel']['exec'](_0x1c96('0x1c3'),[_0x1f12da['mailbox'],_0x1f12da[_0x1c96('0x75')]]);if(_0x1b21c2[_0x1c96('0xa0')]===-0x1){return _0x1b21c2;}return this[_0x1c96('0xe')]['noop'](util[_0x1c96('0x53')](_0x1c96('0xc0'),_0x1c96('0x1c3'),_0x1f12da[_0x1c96('0x1c4')]));};AGIVertices[_0x1c96('0x11')][_0x1c96('0x1c5')]=function(_0x5b3210){logger[_0x1c96('0x2b')](util[_0x1c96('0x53')](_0x1c96('0x1c6'),_0x5b3210[_0x1c96('0x37')]));if(!this[_0x1c96('0x7f')](_0x5b3210[_0x1c96('0xd7')])){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x5b3210,_0x1c96('0x1a1'));}var _0x194054=this[_0x1c96('0x12')]['sync'](this,_0x5b3210['variable_id']);if(!_0x194054){return this[_0x1c96('0xe')][_0x1c96('0x31')](_0x5b3210,_0x1c96('0xd8'));}var _0x211027=this['channel'][_0x1c96('0x12')](_0x194054);return{'code':0xc8,'result':_0x211027[_0x1c96('0xa2')]?_0x211027['extra']:'-'};};String[_0x1c96('0x11')][_0x1c96('0x9d')]=function(_0xef78ae,_0x1d41e8){return this[_0x1c96('0x9c')](_0xef78ae)['join'](_0x1d41e8);};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 3b69945..00a939f 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 _0x7c53=['mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','catch','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c53,0x1e7));var _0x37c5=function(_0x373ac2,_0x146652){_0x373ac2=_0x373ac2-0x0;var _0x3fcdf5=_0x7c53[_0x373ac2];return _0x3fcdf5;};'use strict';var _=require(_0x37c5('0x0'));var moment=require(_0x37c5('0x1'));var ami=require(_0x37c5('0x2'));var logger=require('../../../config/logger')(_0x37c5('0x3'));var RpcUser=require(_0x37c5('0x4'));var RpcVoiceAgentReport=require(_0x37c5('0x5'));function Acw(_0x3c447f){this[_0x37c5('0x6')]=_0x3c447f[_0x37c5('0x6')];this[_0x37c5('0x7')]=_0x3c447f[_0x37c5('0x7')];this[_0x37c5('0x8')]=_0x3c447f[_0x37c5('0x8')];this[_0x37c5('0x9')]={};ami['on']('agentconnect',this[_0x37c5('0xa')][_0x37c5('0xb')](this));ami['on'](_0x37c5('0xc'),this[_0x37c5('0xd')][_0x37c5('0xb')](this));ami['on'](_0x37c5('0xe'),this[_0x37c5('0xf')]['bind'](this));ami['on'](_0x37c5('0x10'),this[_0x37c5('0x11')]['bind'](this));ami['on'](_0x37c5('0x12'),this['syncAttendedTransfer'][_0x37c5('0xb')](this));ami['on'](_0x37c5('0x13'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x37c5('0x14'),this[_0x37c5('0x15')][_0x37c5('0xb')](this));}function getDiff(_0x4796e7){var _0x4020b0=moment()[_0x37c5('0x16')](0x0);var _0x2eb72a=moment(_0x4796e7)[_0x37c5('0x16')](0x0);return _0x4020b0[_0x37c5('0x17')](_0x2eb72a,_0x37c5('0x18'));}Acw['prototype'][_0x37c5('0x19')]=function(_0x12924b){try{var _0x471e09=this;var _0x3999ca=this[_0x37c5('0x9')][_0x12924b][_0x37c5('0x1a')];var _0x35068f=this[_0x37c5('0x9')][_0x12924b]['queue'];var _0xf0696c=this['voiceQueues'][_0x35068f];var _0x5e28ec=![];var _0x2563a3=_0x37c5('0x1b');if(_0xf0696c[_0x37c5('0x1c')]){if(_0xf0696c[_0x37c5('0x1d')]['name']){_0x5e28ec=!![];_0x2563a3=_0xf0696c[_0x37c5('0x1d')][_0x37c5('0x1e')];}}return ami['Action']({'action':'QueuePause','interface':_0x3999ca,'paused':!![],'reason':_0x2563a3})[_0x37c5('0x1f')](function(){if(_0x471e09[_0x37c5('0x7')][_0x3999ca]){return RpcUser[_0x37c5('0x20')](_0x471e09['agents'][_0x3999ca]['id'])[_0x37c5('0x1f')](function(_0x22ae84){if(_0x22ae84&&!_0x22ae84[_0x37c5('0x21')]){logger[_0x37c5('0x22')](_0x37c5('0x23'),_0x12924b,_0x3999ca,_0x35068f);var _0x15ecea=_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x24')]&&_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x25')]?_0x471e09[_0x37c5('0x9')][_0x12924b][_0x37c5('0x25')]:_0x12924b;return RpcUser[_0x37c5('0x26')](_0x471e09[_0x37c5('0x7')][_0x3999ca],_0x2563a3,_0x15ecea)[_0x37c5('0x1f')](function(){if(!_0x5e28ec){_0x471e09[_0x37c5('0x8')][_0x3999ca]={};logger[_0x37c5('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x12924b,_0x471e09[_0x37c5('0x6')][_0x35068f][_0x37c5('0x27')],_0x3999ca,_0x35068f);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x28')]=setTimeout(_0x471e09[_0x37c5('0x29')]['bind'](_0x471e09,_0x3999ca),_0x471e09['voiceQueues'][_0x35068f][_0x37c5('0x27')]*0x3e8);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2a')]=moment()[_0x37c5('0x2b')](_0x37c5('0x2c'));_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2d')]=_0x12924b;_0x471e09['timers'][_0x3999ca][_0x37c5('0x2e')]=_0x35068f;_0x471e09['timers'][_0x3999ca][_0x37c5('0x2f')]=function(){var _0x1d7867=getDiff(_0x471e09['timers'][_0x3999ca][_0x37c5('0x2a')]);clearTimeout(_0x471e09['timers'][_0x3999ca][_0x37c5('0x28')]);_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1d7867},_0x471e09[_0x37c5('0x8')][_0x3999ca][_0x37c5('0x2d')],_0x3999ca)[_0x37c5('0x1f')](function(_0x37e427){logger['info'](_0x37c5('0x30'),_0x12924b,_0x1d7867,_0x37e427);})['catch'](function(_0x1d2cba){logger['error'](_0x37c5('0x31'),_0x12924b,_0x1d2cba);});delete _0x471e09[_0x37c5('0x8')][_0x3999ca];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x12924b,_0x3999ca,_0x35068f);}});}})[_0x37c5('0x32')](function(){logger[_0x37c5('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x12924b,_0x471e09['voiceQueues'][_0x35068f][_0x37c5('0x27')],_0x3999ca,_0x35068f);})[_0x37c5('0x34')](function(){delete _0x471e09['channels'][_0x12924b];});}catch(_0x12b444){logger[_0x37c5('0x33')](_0x37c5('0x35'),_0x12b444[_0x37c5('0x36')]);}};Acw['prototype']['stopAcw']=function(_0x49b5f1){try{var _0x479b30=this;if(_0x479b30[_0x37c5('0x8')][_0x49b5f1]){_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x28')]=![];var _0x2adafc=_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x2d')];var _0xdf316f=_0x479b30[_0x37c5('0x8')][_0x49b5f1][_0x37c5('0x2e')];var _0x24d842=_0x479b30[_0x37c5('0x6')][_0xdf316f][_0x37c5('0x27')];logger[_0x37c5('0x22')](_0x37c5('0x37'),_0x2adafc,_0x49b5f1);RpcUser['saveUnpause'](this[_0x37c5('0x7')][_0x49b5f1]);RpcVoiceAgentReport['update']({'acwtime':_0x24d842,'agentacw':!![]},_0x2adafc,_0x49b5f1)[_0x37c5('0x1f')](function(_0x12bf2c){logger[_0x37c5('0x22')](_0x37c5('0x30'),_0x2adafc,_0x24d842,_0x12bf2c);})[_0x37c5('0x32')](function(_0x2fa42a){logger[_0x37c5('0x33')](_0x37c5('0x31'),_0x2adafc,_0x2fa42a);});}else{logger[_0x37c5('0x33')](_0x37c5('0x38'),_0x49b5f1);if(_0x479b30[_0x37c5('0x8')]){logger[_0x37c5('0x22')](_0x37c5('0x39'),JSON[_0x37c5('0x3a')](_0x479b30[_0x37c5('0x8')]));}}}catch(_0x221f4e){logger[_0x37c5('0x33')](_0x37c5('0x3b'),_0x221f4e['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x1c8b0d){try{if(this[_0x37c5('0x6')][_0x1c8b0d[_0x37c5('0x2e')]]&&(this[_0x37c5('0x6')][_0x1c8b0d['queue']]['acw']||this[_0x37c5('0x6')][_0x1c8b0d[_0x37c5('0x2e')]][_0x37c5('0x1c')])){if(this['agents'][_0x1c8b0d[_0x37c5('0x1a')]]){this[_0x37c5('0x9')][_0x1c8b0d['uniqueid']]={'queue':_0x1c8b0d['queue'],'interface':_0x1c8b0d[_0x37c5('0x1a')],'destlinkedid':_0x1c8b0d[_0x37c5('0x25')]};}}}catch(_0x390e1a){logger[_0x37c5('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x390e1a[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x15')]=function(_0x4d1059){try{if(this[_0x37c5('0x6')][_0x4d1059[_0x37c5('0x2e')]]&&(this[_0x37c5('0x6')][_0x4d1059[_0x37c5('0x2e')]]['acw']||this['voiceQueues'][_0x4d1059[_0x37c5('0x2e')]][_0x37c5('0x1c')])){if(this[_0x37c5('0x7')][_0x4d1059['interface']]){this[_0x37c5('0x9')][_0x4d1059[_0x37c5('0x2d')]]={'queue':_0x4d1059['queue'],'interface':_0x4d1059['interface']};}}}catch(_0x8ae6e9){logger[_0x37c5('0x33')](_0x37c5('0x3d'),_0x8ae6e9['message']);}};Acw[_0x37c5('0x3c')]['syncHangupRequest']=function(_0xc2d9b1){try{if(this[_0x37c5('0x9')][_0xc2d9b1['uniqueid']]&&_[_0x37c5('0x3e')](this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x2d')]][_0x37c5('0x24')])){logger[_0x37c5('0x22')](_0x37c5('0x3f'),_0xc2d9b1[_0x37c5('0x2d')]);this[_0x37c5('0x19')](_0xc2d9b1[_0x37c5('0x2d')]);}else if(this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x40')]]&&_[_0x37c5('0x3e')](this[_0x37c5('0x9')][_0xc2d9b1[_0x37c5('0x40')]][_0x37c5('0x24')])){logger[_0x37c5('0x22')](_0x37c5('0x41'),_0xc2d9b1[_0x37c5('0x40')]);this[_0x37c5('0x19')](_0xc2d9b1[_0x37c5('0x40')]);}}catch(_0x27f3ad){logger[_0x37c5('0x33')](_0x37c5('0x42'),_0x27f3ad[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0xf')]=function(_0x510b97){try{if(this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x2d')]]&&this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x2d')]]['attended']){logger[_0x37c5('0x22')](_0x37c5('0x43'),_0x510b97['uniqueid']);this[_0x37c5('0x19')](_0x510b97['uniqueid']);}else if(this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x40')]]&&this[_0x37c5('0x9')][_0x510b97[_0x37c5('0x40')]][_0x37c5('0x24')]){logger[_0x37c5('0x22')](_0x37c5('0x44'),_0x510b97[_0x37c5('0x40')]);this[_0x37c5('0x19')](_0x510b97['linkedid']);}}catch(_0x19e56){logger[_0x37c5('0x33')](_0x37c5('0x45'),_0x19e56[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x46')]=function(_0x52a82a){try{if(!_[_0x37c5('0x47')](this[_0x37c5('0x9')][_0x52a82a['transfereeuniqueid']])){this[_0x37c5('0x19')](_0x52a82a[_0x37c5('0x48')]);if(this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]]){this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]][_0x37c5('0x24')]=!![];this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4a')]]=this[_0x37c5('0x9')][_0x52a82a['secondtransfereruniqueid']];delete this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x49')]];}}else if(!_['isNil'](this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4a')]])){this[_0x37c5('0x19')](_0x52a82a[_0x37c5('0x4a')]);if(this['channels'][_0x52a82a[_0x37c5('0x4b')]]){this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]][_0x37c5('0x24')]=!![];this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x48')]]=this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]];delete this[_0x37c5('0x9')][_0x52a82a[_0x37c5('0x4b')]];}}}catch(_0x2339fb){logger['error'](_0x37c5('0x4c'),_0x2339fb[_0x37c5('0x36')]);}};Acw['prototype'][_0x37c5('0x4d')]=function(_0x193bc5){try{if(this[_0x37c5('0x9')][_0x193bc5[_0x37c5('0x4e')]]){logger[_0x37c5('0x22')](_0x37c5('0x4f'),JSON[_0x37c5('0x3a')](_0x193bc5[_0x37c5('0x4e')]));this[_0x37c5('0x19')](_0x193bc5[_0x37c5('0x4e')]);}else if(this[_0x37c5('0x9')][_0x193bc5['transfererlinkedid']]){logger[_0x37c5('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x37c5('0x3a')](_0x193bc5['transfererlinkedid']));this[_0x37c5('0x19')](_0x193bc5['transfererlinkedid']);}}catch(_0x48926e){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x48926e[_0x37c5('0x36')]);}};Acw[_0x37c5('0x3c')][_0x37c5('0x11')]=function(_0x2d6de7){try{if(this[_0x37c5('0x6')][_0x2d6de7[_0x37c5('0x2e')]]&&this[_0x37c5('0x6')][_0x2d6de7['queue']][_0x37c5('0x50')]===_0x37c5('0x51')){if(this[_0x37c5('0x7')][_0x2d6de7[_0x37c5('0x1a')]]){logger[_0x37c5('0x22')](_0x37c5('0x52'),_0x2d6de7[_0x37c5('0x2d')],_0x2d6de7['interface'],_0x2d6de7[_0x37c5('0x2e')]);return RpcUser[_0x37c5('0x26')](this[_0x37c5('0x7')][_0x2d6de7['interface']],_0x37c5('0x53'),_0x2d6de7[_0x37c5('0x2d')]);}}}catch(_0x5c55dd){logger[_0x37c5('0x33')](_0x37c5('0x54'),_0x5c55dd['message']);}};module[_0x37c5('0x55')]=Acw; \ No newline at end of file +var _0x78b5=['attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timers','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x65ecc0,_0x35e08e){var _0x5612fa=function(_0x24fb78){while(--_0x24fb78){_0x65ecc0['push'](_0x65ecc0['shift']());}};_0x5612fa(++_0x35e08e);}(_0x78b5,0x8f));var _0x578b=function(_0x35598e,_0x1e7a33){_0x35598e=_0x35598e-0x0;var _0x4799d6=_0x78b5[_0x35598e];return _0x4799d6;};'use strict';var _=require('lodash');var moment=require(_0x578b('0x0'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x578b('0x1'));var RpcUser=require(_0x578b('0x2'));var RpcVoiceAgentReport=require(_0x578b('0x3'));function Acw(_0x322624){this['voiceQueues']=_0x322624[_0x578b('0x4')];this[_0x578b('0x5')]=_0x322624[_0x578b('0x5')];this['timers']=_0x322624['timers'];this[_0x578b('0x6')]={};ami['on'](_0x578b('0x7'),this[_0x578b('0x8')][_0x578b('0x9')](this));ami['on']('hanguprequest',this[_0x578b('0xa')][_0x578b('0x9')](this));ami['on']('hangup',this[_0x578b('0xb')][_0x578b('0x9')](this));ami['on'](_0x578b('0xc'),this[_0x578b('0xd')]['bind'](this));ami['on'](_0x578b('0xe'),this[_0x578b('0xf')][_0x578b('0x9')](this));ami['on'](_0x578b('0x10'),this[_0x578b('0x11')][_0x578b('0x9')](this));ami['on'](_0x578b('0x12'),this['syncAgentConnectPreview'][_0x578b('0x9')](this));}function getDiff(_0x3273b1){var _0xfe97c=moment()[_0x578b('0x13')](0x0);var _0x125e1b=moment(_0x3273b1)['milliseconds'](0x0);return _0xfe97c['diff'](_0x125e1b,_0x578b('0x14'));}Acw[_0x578b('0x15')][_0x578b('0x16')]=function(_0xf44e8f){try{var _0x19ce94=this;var _0x3ddf77=this[_0x578b('0x6')][_0xf44e8f]['interface'];var _0x4ff184=this[_0x578b('0x6')][_0xf44e8f][_0x578b('0x17')];var _0x1a1bff=this[_0x578b('0x4')][_0x4ff184];var _0x3274b5=![];var _0xf940c6=_0x578b('0x18');if(_0x1a1bff[_0x578b('0x19')]){if(_0x1a1bff[_0x578b('0x1a')]['name']){_0x3274b5=!![];_0xf940c6=_0x1a1bff[_0x578b('0x1a')][_0x578b('0x1b')];}}return ami[_0x578b('0x1c')]({'action':_0x578b('0x1d'),'interface':_0x3ddf77,'paused':!![],'reason':_0xf940c6})[_0x578b('0x1e')](function(){if(_0x19ce94[_0x578b('0x5')][_0x3ddf77]){return RpcUser[_0x578b('0x1f')](_0x19ce94[_0x578b('0x5')][_0x3ddf77]['id'])['then'](function(_0x161076){if(_0x161076&&!_0x161076[_0x578b('0x20')]){logger[_0x578b('0x21')](_0x578b('0x22'),_0xf44e8f,_0x3ddf77,_0x4ff184);var _0x7c0b2f=_0x19ce94[_0x578b('0x6')][_0xf44e8f][_0x578b('0x23')]&&_0x19ce94['channels'][_0xf44e8f][_0x578b('0x24')]?_0x19ce94['channels'][_0xf44e8f]['destlinkedid']:_0xf44e8f;return RpcUser[_0x578b('0x25')](_0x19ce94[_0x578b('0x5')][_0x3ddf77],_0xf940c6,_0x7c0b2f)[_0x578b('0x1e')](function(){if(!_0x3274b5){_0x19ce94['timers'][_0x3ddf77]={};logger['info'](_0x578b('0x26'),_0xf44e8f,_0x19ce94[_0x578b('0x4')][_0x4ff184][_0x578b('0x27')],_0x3ddf77,_0x4ff184);_0x19ce94[_0x578b('0x28')][_0x3ddf77][_0x578b('0x29')]=setTimeout(_0x19ce94[_0x578b('0x2a')][_0x578b('0x9')](_0x19ce94,_0x3ddf77),_0x19ce94[_0x578b('0x4')][_0x4ff184][_0x578b('0x27')]*0x3e8);_0x19ce94['timers'][_0x3ddf77][_0x578b('0x2b')]=moment()[_0x578b('0x2c')](_0x578b('0x2d'));_0x19ce94[_0x578b('0x28')][_0x3ddf77][_0x578b('0x2e')]=_0xf44e8f;_0x19ce94[_0x578b('0x28')][_0x3ddf77][_0x578b('0x17')]=_0x4ff184;_0x19ce94[_0x578b('0x28')][_0x3ddf77]['updateAcw']=function(){var _0x52a909=getDiff(_0x19ce94[_0x578b('0x28')][_0x3ddf77]['lastPauseAt']);clearTimeout(_0x19ce94['timers'][_0x3ddf77][_0x578b('0x29')]);_0x19ce94[_0x578b('0x28')][_0x3ddf77][_0x578b('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x52a909},_0x19ce94[_0x578b('0x28')][_0x3ddf77][_0x578b('0x2e')],_0x3ddf77)[_0x578b('0x1e')](function(_0x52ec6f){logger[_0x578b('0x21')](_0x578b('0x2f'),_0xf44e8f,_0x52a909,_0x52ec6f);})['catch'](function(_0x48bb23){logger[_0x578b('0x30')]('[%s][UPDATE][ERRORS:%s]',_0xf44e8f,_0x48bb23);});delete _0x19ce94['timers'][_0x3ddf77];};}});}else{logger[_0x578b('0x21')](_0x578b('0x31'),_0xf44e8f,_0x3ddf77,_0x4ff184);}});}})[_0x578b('0x32')](function(){logger['error'](_0x578b('0x26'),_0xf44e8f,_0x19ce94[_0x578b('0x4')][_0x4ff184]['acwTimeout'],_0x3ddf77,_0x4ff184);})[_0x578b('0x33')](function(){delete _0x19ce94[_0x578b('0x6')][_0xf44e8f];});}catch(_0x2ce5a5){logger[_0x578b('0x30')](_0x578b('0x34'),_0x2ce5a5[_0x578b('0x35')]);}};Acw['prototype']['stopAcw']=function(_0x2a7651){try{var _0x39a2ff=this;if(_0x39a2ff[_0x578b('0x28')][_0x2a7651]){_0x39a2ff[_0x578b('0x28')][_0x2a7651][_0x578b('0x29')]=![];var _0x1bd58b=_0x39a2ff[_0x578b('0x28')][_0x2a7651]['uniqueid'];var _0x578c4c=_0x39a2ff[_0x578b('0x28')][_0x2a7651][_0x578b('0x17')];var _0x2650b8=_0x39a2ff[_0x578b('0x4')][_0x578c4c][_0x578b('0x27')];logger[_0x578b('0x21')](_0x578b('0x36'),_0x1bd58b,_0x2a7651);RpcUser[_0x578b('0x37')](this[_0x578b('0x5')][_0x2a7651]);RpcVoiceAgentReport[_0x578b('0x38')]({'acwtime':_0x2650b8,'agentacw':!![]},_0x1bd58b,_0x2a7651)['then'](function(_0x370e0e){logger['info'](_0x578b('0x2f'),_0x1bd58b,_0x2650b8,_0x370e0e);})[_0x578b('0x32')](function(_0x36b6be){logger[_0x578b('0x30')](_0x578b('0x39'),_0x1bd58b,_0x36b6be);});}else{logger[_0x578b('0x30')](_0x578b('0x3a'),_0x2a7651);if(_0x39a2ff[_0x578b('0x28')]){logger[_0x578b('0x21')](_0x578b('0x3b'),JSON[_0x578b('0x3c')](_0x39a2ff[_0x578b('0x28')]));}}}catch(_0x1ad765){logger[_0x578b('0x30')](_0x578b('0x3d'),_0x1ad765['message']);}};Acw[_0x578b('0x15')][_0x578b('0x8')]=function(_0xb19917){try{if(this[_0x578b('0x4')][_0xb19917[_0x578b('0x17')]]&&(this['voiceQueues'][_0xb19917['queue']][_0x578b('0x1')]||this[_0x578b('0x4')][_0xb19917[_0x578b('0x17')]][_0x578b('0x19')])){if(this[_0x578b('0x5')][_0xb19917[_0x578b('0x3e')]]){this[_0x578b('0x6')][_0xb19917['uniqueid']]={'queue':_0xb19917['queue'],'interface':_0xb19917['interface'],'destlinkedid':_0xb19917['destlinkedid']};}}}catch(_0x3ef07a){logger[_0x578b('0x30')](_0x578b('0x3f'),_0x3ef07a[_0x578b('0x35')]);}};Acw[_0x578b('0x15')][_0x578b('0x40')]=function(_0x2da791){try{if(this[_0x578b('0x4')][_0x2da791[_0x578b('0x17')]]&&(this[_0x578b('0x4')][_0x2da791[_0x578b('0x17')]][_0x578b('0x1')]||this[_0x578b('0x4')][_0x2da791[_0x578b('0x17')]]['mandatoryDisposition'])){if(this[_0x578b('0x5')][_0x2da791['interface']]){this[_0x578b('0x6')][_0x2da791[_0x578b('0x2e')]]={'queue':_0x2da791[_0x578b('0x17')],'interface':_0x2da791[_0x578b('0x3e')]};}}}catch(_0x459987){logger[_0x578b('0x30')](_0x578b('0x41'),_0x459987['message']);}};Acw[_0x578b('0x15')][_0x578b('0xa')]=function(_0xe8b8de){try{if(this[_0x578b('0x6')][_0xe8b8de[_0x578b('0x2e')]]&&_[_0x578b('0x42')](this['channels'][_0xe8b8de['uniqueid']][_0x578b('0x23')])){logger['info'](_0x578b('0x43'),_0xe8b8de[_0x578b('0x2e')]);this[_0x578b('0x16')](_0xe8b8de[_0x578b('0x2e')]);}else if(this[_0x578b('0x6')][_0xe8b8de['linkedid']]&&_[_0x578b('0x42')](this['channels'][_0xe8b8de[_0x578b('0x44')]][_0x578b('0x23')])){logger[_0x578b('0x21')]('[%s][HANGUP:LINKEDID]',_0xe8b8de[_0x578b('0x44')]);this[_0x578b('0x16')](_0xe8b8de[_0x578b('0x44')]);}}catch(_0x47cf03){logger[_0x578b('0x30')](_0x578b('0x45'),_0x47cf03[_0x578b('0x35')]);}};Acw[_0x578b('0x15')][_0x578b('0xb')]=function(_0x281f1e){try{if(this[_0x578b('0x6')][_0x281f1e[_0x578b('0x2e')]]&&this[_0x578b('0x6')][_0x281f1e[_0x578b('0x2e')]][_0x578b('0x23')]){logger[_0x578b('0x21')](_0x578b('0x46'),_0x281f1e[_0x578b('0x2e')]);this['startAcw'](_0x281f1e[_0x578b('0x2e')]);}else if(this['channels'][_0x281f1e[_0x578b('0x44')]]&&this[_0x578b('0x6')][_0x281f1e[_0x578b('0x44')]][_0x578b('0x23')]){logger[_0x578b('0x21')](_0x578b('0x47'),_0x281f1e['linkedid']);this[_0x578b('0x16')](_0x281f1e[_0x578b('0x44')]);}}catch(_0x5ef214){logger[_0x578b('0x30')](_0x578b('0x48'),_0x5ef214[_0x578b('0x35')]);}};Acw[_0x578b('0x15')][_0x578b('0xf')]=function(_0x50e116){try{if(!_[_0x578b('0x49')](this[_0x578b('0x6')][_0x50e116[_0x578b('0x4a')]])){this[_0x578b('0x16')](_0x50e116[_0x578b('0x4a')]);if(this[_0x578b('0x6')][_0x50e116[_0x578b('0x4b')]]){this[_0x578b('0x6')][_0x50e116[_0x578b('0x4b')]]['attended']=!![];this[_0x578b('0x6')][_0x50e116['transfertargetuniqueid']]=this['channels'][_0x50e116[_0x578b('0x4b')]];delete this[_0x578b('0x6')][_0x50e116['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x578b('0x6')][_0x50e116[_0x578b('0x4c')]])){this[_0x578b('0x16')](_0x50e116['transfertargetuniqueid']);if(this[_0x578b('0x6')][_0x50e116['origtransfereruniqueid']]){this[_0x578b('0x6')][_0x50e116[_0x578b('0x4d')]][_0x578b('0x23')]=!![];this[_0x578b('0x6')][_0x50e116['transfereeuniqueid']]=this['channels'][_0x50e116['origtransfereruniqueid']];delete this[_0x578b('0x6')][_0x50e116[_0x578b('0x4d')]];}}}catch(_0x352d23){logger[_0x578b('0x30')](_0x578b('0x4e'),_0x352d23[_0x578b('0x35')]);}};Acw[_0x578b('0x15')][_0x578b('0x11')]=function(_0x39fdf5){try{if(this[_0x578b('0x6')][_0x39fdf5['transfereruniqueid']]){logger[_0x578b('0x21')](_0x578b('0x4f'),JSON['stringify'](_0x39fdf5[_0x578b('0x50')]));this[_0x578b('0x16')](_0x39fdf5[_0x578b('0x50')]);}else if(this['channels'][_0x39fdf5[_0x578b('0x51')]]){logger[_0x578b('0x21')](_0x578b('0x52'),JSON[_0x578b('0x3c')](_0x39fdf5['transfererlinkedid']));this['startAcw'](_0x39fdf5['transfererlinkedid']);}}catch(_0x408adc){logger[_0x578b('0x30')](_0x578b('0x53'),_0x408adc[_0x578b('0x35')]);}};Acw[_0x578b('0x15')][_0x578b('0xd')]=function(_0x28c6fa){try{if(this[_0x578b('0x4')][_0x28c6fa[_0x578b('0x17')]]&&this[_0x578b('0x4')][_0x28c6fa[_0x578b('0x17')]][_0x578b('0x54')]===_0x578b('0x55')){if(this[_0x578b('0x5')][_0x28c6fa[_0x578b('0x3e')]]){logger[_0x578b('0x21')](_0x578b('0x56'),_0x28c6fa[_0x578b('0x2e')],_0x28c6fa[_0x578b('0x3e')],_0x28c6fa[_0x578b('0x17')]);return RpcUser[_0x578b('0x25')](this['agents'][_0x28c6fa[_0x578b('0x3e')]],_0x578b('0x57'),_0x28c6fa[_0x578b('0x2e')]);}}}catch(_0x57e0e2){logger['error'](_0x578b('0x58'),_0x57e0e2[_0x578b('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d1dc9f8..d879610 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 _0x95ba=['username','password','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','util','../../config/logger','ami','asterisk','port'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x95ba,0xf7));var _0xa95b=function(_0xc1d6f8,_0x2354a2){_0xc1d6f8=_0xc1d6f8-0x0;var _0x14a730=_0x95ba[_0xc1d6f8];return _0x14a730;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0xa95b('0x0'));var logger=require(_0xa95b('0x1'))(_0xa95b('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xa95b('0x3')][_0xa95b('0x4')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x5')],config['asterisk'][_0xa95b('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0xa95b('0x7')]);function error(_0x4abe84){logger[_0xa95b('0x8')](util[_0xa95b('0x9')](_0xa95b('0xa'),config[_0xa95b('0x3')][_0xa95b('0x5')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x4')],util[_0xa95b('0xb')](_0x4abe84,![],null)));}function close(){logger[_0xa95b('0x8')](util['format'](_0xa95b('0xc'),config['asterisk']['username'],config[_0xa95b('0x3')]['ip'],config['asterisk']['port']));}ami[_0xa95b('0xd')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x10')});};};ami[_0xa95b('0x11')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x13')});};};ami[_0xa95b('0x14')]=function(){return function(){return ami[_0xa95b('0xe')]({'action':_0xa95b('0x15')});};};function connect(){logger[_0xa95b('0x16')](util[_0xa95b('0x9')](_0xa95b('0x17'),config[_0xa95b('0x3')][_0xa95b('0x5')],config['asterisk']['ip'],config['asterisk'][_0xa95b('0x4')]));ami[_0xa95b('0x18')](_0xa95b('0x8'),error);ami[_0xa95b('0x18')](_0xa95b('0x19'),close);}ami['on']('connect',connect);ami['on'](_0xa95b('0x1a'),function(_0x241d57){logger[_0xa95b('0x16')](util['format'](_0xa95b('0x1b'),config[_0xa95b('0x3')]['username'],config[_0xa95b('0x3')]['ip'],config['asterisk'][_0xa95b('0x4')],util[_0xa95b('0xb')](_0x241d57,![],null)));});ami['on'](_0xa95b('0x1c'),function(){logger[_0xa95b('0x16')](util[_0xa95b('0x9')](_0xa95b('0x1d'),config['asterisk'][_0xa95b('0x5')],config[_0xa95b('0x3')]['ip'],config['asterisk'][_0xa95b('0x4')]));return Promise[_0xa95b('0x1e')]()['then'](ami[_0xa95b('0xd')]())[_0xa95b('0x1f')](ami[_0xa95b('0x20')]())[_0xa95b('0x1f')](ami[_0xa95b('0x11')]())['then'](ami[_0xa95b('0x21')]())[_0xa95b('0x1f')](ami['actionCoreShowChannels']())[_0xa95b('0x22')](function(_0x17b737){logger[_0xa95b('0x8')](_0xa95b('0x23'),util['inspect'](_0x17b737,{'showHidden':![],'depth':null}));});});ami[_0xa95b('0x18')](_0xa95b('0x8'),error);ami[_0xa95b('0x18')](_0xa95b('0x19'),close);module['exports']=ami; \ No newline at end of file +var _0xae6c=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','Action','action','error'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xae6c,0x1c3));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var Manager=require(_0xcae6('0x0'));var BPromise=require(_0xcae6('0x1'));var util=require('util');var logger=require(_0xcae6('0x2'))(_0xcae6('0x3'));var config=require(_0xcae6('0x4'));var ami=new Manager(config[_0xcae6('0x5')][_0xcae6('0x6')],config['asterisk']['ip'],config['asterisk'][_0xcae6('0x7')],config[_0xcae6('0x5')]['password'],!![]);ami['keepConnected']();ami[_0xcae6('0x8')]=BPromise['promisify'](ami[_0xcae6('0x9')]);function error(_0x34887e){logger[_0xcae6('0xa')](util[_0xcae6('0xb')](_0xcae6('0xc'),config['asterisk'][_0xcae6('0x7')],config[_0xcae6('0x5')]['ip'],config['asterisk'][_0xcae6('0x6')],util[_0xcae6('0xd')](_0x34887e,![],null)));}function close(){logger['error'](util[_0xcae6('0xb')](_0xcae6('0xe'),config[_0xcae6('0x5')]['username'],config[_0xcae6('0x5')]['ip'],config['asterisk']['port']));}ami[_0xcae6('0xf')]=function(){return function(){return ami[_0xcae6('0x8')]({'action':_0xcae6('0x10')});};};ami[_0xcae6('0x11')]=function(){return function(){return ami[_0xcae6('0x8')]({'action':_0xcae6('0x12')});};};ami[_0xcae6('0x13')]=function(){return function(){return ami[_0xcae6('0x8')]({'action':'sippeerstatus'});};};ami[_0xcae6('0x14')]=function(){return function(){return ami[_0xcae6('0x8')]({'action':_0xcae6('0x15')});};};ami[_0xcae6('0x16')]=function(){return function(){return ami[_0xcae6('0x8')]({'action':_0xcae6('0x17')});};};function connect(){logger[_0xcae6('0x18')](util[_0xcae6('0xb')](_0xcae6('0x19'),config['asterisk'][_0xcae6('0x7')],config[_0xcae6('0x5')]['ip'],config[_0xcae6('0x5')][_0xcae6('0x6')]));ami[_0xcae6('0x1a')](_0xcae6('0xa'),error);ami[_0xcae6('0x1a')](_0xcae6('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0xcae6('0x1c'),function(_0x560b05){logger[_0xcae6('0x18')](util[_0xcae6('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xcae6('0x5')]['username'],config[_0xcae6('0x5')]['ip'],config[_0xcae6('0x5')][_0xcae6('0x6')],util[_0xcae6('0xd')](_0x560b05,![],null)));});ami['on']('fullybooted',function(){logger[_0xcae6('0x18')](util['format'](_0xcae6('0x1d'),config['asterisk'][_0xcae6('0x7')],config[_0xcae6('0x5')]['ip'],config[_0xcae6('0x5')][_0xcae6('0x6')]));return Promise['resolve']()['then'](ami[_0xcae6('0xf')]())[_0xcae6('0x1e')](ami['actionDeviceStateList']())[_0xcae6('0x1e')](ami[_0xcae6('0x13')]())[_0xcae6('0x1e')](ami[_0xcae6('0x14')]())['then'](ami['actionCoreShowChannels']())[_0xcae6('0x1f')](function(_0x329a99){logger[_0xcae6('0xa')](_0xcae6('0x20'),util[_0xcae6('0xd')](_0x329a99,{'showHidden':![],'depth':null}));});});ami[_0xcae6('0x1a')](_0xcae6('0xa'),error);ami[_0xcae6('0x1a')](_0xcae6('0x1b'),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 9892161..56a4d14 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 _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x1602c3,_0x250007){var _0x4808ef=function(_0x361463){while(--_0x361463){_0x1602c3['push'](_0x1602c3['shift']());}};_0x4808ef(++_0x250007);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xe706,0xa3));var _0x6e70=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0xe706[_0xdb01a];return _0x107ede;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9cba823..900eeb4 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 _0xc648=['---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','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','getSeconds','name','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','indexOf','true','catch','iftime\x20%s,%s','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','type','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','starttime','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','countabandonedretry','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','merge','idHopper','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','HANGUP','buildObj','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','running','isPreviewCampaign','statusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[actionOriginate]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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]','Umin\x20=\x20','util','lodash','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime'];(function(_0x2382b7,_0x271ef2){var _0x4ea157=function(_0x13209c){while(--_0x13209c){_0x2382b7['push'](_0x2382b7['shift']());}};_0x4ea157(++_0x271ef2);}(_0xc648,0x1c9));var _0x8c64=function(_0x2999a2,_0x165ee0){_0x2999a2=_0x2999a2-0x0;var _0x48e984=_0xc648[_0x2999a2];return _0x48e984;};'use strict';var util=require(_0x8c64('0x0'));var _=require(_0x8c64('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x8c64('0x2'));var hopperUtils=require(_0x8c64('0x3'));var ut=require(_0x8c64('0x4'));var config=require(_0x8c64('0x5'));var logger=require(_0x8c64('0x6'))(_0x8c64('0x7'));var loggerBooked=require(_0x8c64('0x6'))(_0x8c64('0x8'));var loggerPredictive=require(_0x8c64('0x6'))(_0x8c64('0x9'));var loggerPredictiveCalls=require(_0x8c64('0x6'))(_0x8c64('0xa'));var loggerSyncQueueSummary=require(_0x8c64('0x6'))(_0x8c64('0xb'));var ami=require(_0x8c64('0xc'));config[_0x8c64('0xd')]=_[_0x8c64('0xe')](config[_0x8c64('0xd')],{'host':_0x8c64('0xf'),'port':0x18eb});var io=require(_0x8c64('0x10'))(new Redis(config[_0x8c64('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x8c64('0x11'));var Interval=require(_0x8c64('0x12'));var Action=require(_0x8c64('0x13'));var History=require(_0x8c64('0x14'));var Final=require(_0x8c64('0x15'));var AgentComplete=require(_0x8c64('0x16'));var QueueCallerAbandon=require(_0x8c64('0x17'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x8c64('0x18')]||_0x8c64('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8c64('0x1a')][_0x8c64('0x1b')]=function(_0x384419){this[_0x8c64('0x1c')]=this['tail']?this[_0x8c64('0x1c')][_0x8c64('0x1d')](_0x384419):_0x384419();};function Dialer(_0x511e2e,_0x365a4b){this[_0x8c64('0x1e')]=new Sequence();this['preview']=_0x365a4b;this[_0x8c64('0x1f')]=_0x511e2e[_0x8c64('0x1f')];this[_0x8c64('0x20')]=_0x511e2e[_0x8c64('0x20')];this[_0x8c64('0x21')]=_0x511e2e['agents'];this[_0x8c64('0x22')]=_0x511e2e[_0x8c64('0x22')];this[_0x8c64('0x23')]=config[_0x8c64('0x23')]||0x2;this[_0x8c64('0x24')]={};this[_0x8c64('0x25')]={};this[_0x8c64('0x26')]={};this[_0x8c64('0x27')]={};this[_0x8c64('0x28')]={};this[_0x8c64('0x29')]={};this[_0x8c64('0x2a')]={};this['ivrOriginated']={};this[_0x8c64('0x2b')]={};this[_0x8c64('0x2c')]={};this[_0x8c64('0x2d')]={};ami['on'](_0x8c64('0x2e'),this[_0x8c64('0x2f')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x31'),this[_0x8c64('0x32')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x33'),this[_0x8c64('0x34')][_0x8c64('0x30')](this));ami['on']('agentcomplete',this[_0x8c64('0x35')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x36'),this[_0x8c64('0xb')]['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x8c64('0x30')](this));ami['on']('hangup',this['syncHangup'][_0x8c64('0x30')](this));ami['on']('newexten',this['syncNewExten'][_0x8c64('0x30')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x8c64('0x37'),this[_0x8c64('0x38')][_0x8c64('0x30')](this));ami['on'](_0x8c64('0x39'),this[_0x8c64('0x3a')][_0x8c64('0x30')](this));this[_0x8c64('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x8c64('0x3c')]()[_0x8c64('0x3d')](function(_0x3b14b8){previewRecallmeReminderInterval=_0x3b14b8[_0x8c64('0x3e')];});}function isNotNull(_0x104a61){return _0x104a61!==null&&!_[_0x8c64('0x3f')](_0x104a61);}function msgResponse(_0x2cd133,_0x2800f0,_0x4d134e){return{'action':_0x2cd133,'response':_0x2800f0,'message':_0x4d134e,'stack':_0x4d134e};}function emit(_0x427404,_0x502b2e,_0x596c34){io['to'](_0x427404)['emit'](_0x502b2e,_0x596c34);}function emitOutboundVoiceQueueSummary(_0x5a976f){if(_0x5a976f['type']===_0x8c64('0x40')){logger[_0x8c64('0x41')](_0x8c64('0x42'),util[_0x8c64('0x43')](_0x5a976f,{'showHidden':![],'depth':null}));emit(util[_0x8c64('0x44')](_0x8c64('0x45'),_0x5a976f['name']),_0x8c64('0x46'),_0x5a976f);}}function checkGetDataPredictive(_0x54693b){if(isNotNull(_0x54693b)&&!_[_0x8c64('0x47')](_0x54693b)){loggerPredictive[_0x8c64('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8c64('0x48')](_0x8c64('0x49'),_0x54693b[_0x8c64('0x4a')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x4b'),_0x54693b[_0x8c64('0x4c')]);loggerPredictive[_0x8c64('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54693b[_0x8c64('0x4d')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x4e'),_0x54693b[_0x8c64('0x4f')]);loggerPredictive[_0x8c64('0x48')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54693b[_0x8c64('0x50')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x51'),_0x54693b[_0x8c64('0x52')]);loggerPredictive['info'](_0x8c64('0x53'));if(_0x54693b[_0x8c64('0x4a')]>0x0){if(!_['isUndefined'](_0x54693b[_0x8c64('0x52')])&&_0x54693b['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x8c64('0x48')](_0x8c64('0x54'));if(!_[_0x8c64('0x3f')](_0x54693b[_0x8c64('0x50')])&&_0x54693b[_0x8c64('0x50')]>0x0){return!![];}loggerPredictive[_0x8c64('0x48')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x8c64('0x48')](_0x8c64('0x55'));}}else{loggerPredictive[_0x8c64('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2a5449){return function(_0x560cbd){loggerPredictive[_0x8c64('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x8c64('0x48')](_0x8c64('0x56'),_0x560cbd[_0x8c64('0x57')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x58'),_0x560cbd['erlangCallToSecond']);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x59'),_0x560cbd[_0x8c64('0x5a')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x5b'),_0x560cbd[_0x8c64('0x5c')]);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x59'),_0x560cbd['erlangAbandonmentRate']);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x53'));_['merge'](_0x2a5449,_0x560cbd);};}function ifInterval(_0x49ac13,_0x475d10){if(_[_0x8c64('0x3f')](_0x475d10)){return![];}return utils[_0x8c64('0x5d')](undefined,_0x475d10)<_0x49ac13*0x3c;}function clearPredictiveAttributes(_0x1783eb){if(_0x1783eb['startProgressive']){_0x1783eb['startProgressive']=undefined;loggerPredictive[_0x8c64('0x41')](_0x1783eb[_0x8c64('0x5e')],'startProgressive\x20value\x20cleared');}if(_0x1783eb[_0x8c64('0x29')]){_0x1783eb[_0x8c64('0x29')]=undefined;loggerPredictive[_0x8c64('0x41')](_0x1783eb[_0x8c64('0x5e')],_0x8c64('0x5f'));}if(_0x1783eb[_0x8c64('0x60')]){clearInterval(_0x1783eb[_0x8c64('0x60')]);_0x1783eb[_0x8c64('0x60')]=undefined;loggerPredictive['debug'](_0x1783eb[_0x8c64('0x5e')],_0x8c64('0x61'));}}function loggerCatchPredictive(_0x3cc58a,_0xfbaaed){return function(_0x3a8b17){loggerPredictive[_0x8c64('0x62')](_0xfbaaed[_0x8c64('0x5e')],_0x3cc58a);loggerPredictive[_0x8c64('0x62')](_0x3a8b17[_0x8c64('0x63')]);clearPredictiveAttributes(_0xfbaaed);};}function loggerCatch(_0x4a1780){return function(_0x5d39fd){logger[_0x8c64('0x62')](_0x4a1780,util[_0x8c64('0x43')](_0x5d39fd,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x162f3c,_0x3e6a83,_0xf1ad6b){return function(_0x414283){utils[_0x8c64('0x64')](_0x3e6a83,_0xf1ad6b,0x0);logger[_0x8c64('0x62')](_0x162f3c,util[_0x8c64('0x43')](_0x414283,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37082f){return function(_0xa76d5a){if(isNotNull(_0xa76d5a)&&isNotNull(_0xa76d5a[0x0])){if(_0xa76d5a[0x0][_0x8c64('0x65')]>0x0){_0x37082f[_0x8c64('0x66')]=utils[_0x8c64('0x67')]['CONTACTS_RESCHEDULED'];logger[_0x8c64('0x48')](_0x8c64('0x68')+_0x37082f['name'],_0xa76d5a[0x0][_0x8c64('0x65')],'contacts');}else{_0x37082f['message']=utils[_0x8c64('0x67')][_0x8c64('0x69')];logger[_0x8c64('0x48')]('[getContactDialer2][Empty]'+_0x37082f[_0x8c64('0x5e')]);}}};}function createObjHistory(_0x14e1b3,_0x46521f,_0x5eddfb,_0x3a17d4,_0x4ac1fb){_0x14e1b3[_0x8c64('0x66')]=_0x5eddfb;var _0x506910=new Action(_0x14e1b3,_0x46521f);var _0x5e1137=new History(_0x506910);_0x5e1137['state']=_0x3a17d4;_0x5e1137[_0x8c64('0x6a')]=_0x4ac1fb;_0x5e1137[_0x8c64('0x6b')]=_0x506910['starttime'];return _0x5e1137;}function unlockQueueStatus(_0x265a30,_0x3a6c3d){setTimeout(function(){if(_[_0x8c64('0x3f')](_0x265a30[_0x8c64('0x6c')])){loggerBooked['error'](_0x8c64('0x6d'),_0x3a6c3d);}_0x265a30[_0x8c64('0x6c')]=!![];loggerBooked['info'](_0x8c64('0x6e'),_0x3a6c3d,JSON[_0x8c64('0x6f')](_[_0x8c64('0x70')](_0x265a30,[_0x8c64('0x5e'),_0x8c64('0x6c')])));},0x1f3);}function checkInterval(_0x49b16d){return function(){if(!isNotNull(_0x49b16d[_0x8c64('0x71')])){_0x49b16d[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+_0x8c64('0x73');}if(!isNotNull(_0x49b16d[_0x8c64('0x71')][_0x8c64('0x74')])){_0x49b16d[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x8c64('0x47')](_0x49b16d['Interval'][_0x8c64('0x74')]))){_0x49b16d['message']=utils['CAMPAIGN_STATUS'][_0x8c64('0x72')];throw _0x49b16d[_0x8c64('0x5e')]+_0x8c64('0x73');}};}function checkIsIVRCampaignActive(_0x3a52b6){return function(){if(!utils[_0x8c64('0x75')](_0x3a52b6)){_0x3a52b6[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS'][_0x8c64('0x76')];throw _0x3a52b6['name']+_0x8c64('0x77');}};}function emitCampaignSummary(_0x161423){if(utils[_0x8c64('0x78')](_0x161423)){emit(util[_0x8c64('0x44')](_0x8c64('0x79'),_0x161423['name']),_0x8c64('0x7a'),_0x161423);}}function loggerCatchQueueSummary(_0x3bfdbd,_0x4b378f){return function(_0x251647){clearPredictiveAttributes(_0x4b378f);emitCampaignSummary(_0x4b378f);loggerSyncQueueSummary['debug'](_0x3bfdbd,util['inspect'](_0x251647,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x94541c){if(_0x94541c[_0x8c64('0x7b')]){if(_0x94541c[_0x8c64('0x7c')]===0x0){_0x94541c[_0x8c64('0x7b')]=![];_0x94541c[_0x8c64('0x66')]=utils[_0x8c64('0x67')]['INACTIVE'];loggerSyncQueueSummary[_0x8c64('0x41')](_0x8c64('0x7d'),_0x94541c['name'],_0x8c64('0x7e'));}else{_0x94541c[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS'][_0x8c64('0x7f')];loggerSyncQueueSummary['debug'](_0x8c64('0x7d'),_0x94541c[_0x8c64('0x5e')],_0x8c64('0x80'));}emitCampaignSummary(_0x94541c);}}function myreject(_0x96ab57){return function(_0x2c521c){return _0x96ab57(msgResponse(_0x8c64('0x81'),_0x8c64('0x82'),JSON[_0x8c64('0x6f')](_0x2c521c)));};}Dialer[_0x8c64('0x1a')][_0x8c64('0x83')]=function(_0x262aab){return!_[_0x8c64('0x3f')](_0x262aab)&&_0x262aab&&!_[_0x8c64('0x3f')](_0x262aab[_0x8c64('0x5e')])&&!_[_0x8c64('0x3f')](_0x262aab[_0x8c64('0x84')])&&_0x262aab[_0x8c64('0x84')]&&(this['trunks'][util[_0x8c64('0x44')](_0x8c64('0x85'),_0x262aab[_0x8c64('0x5e')])][_0x8c64('0x86')]===_0x8c64('0x87')||this['trunks'][util['format'](_0x8c64('0x85'),_0x262aab[_0x8c64('0x5e')])]['status']===_0x8c64('0x88'));};Dialer['prototype'][_0x8c64('0x89')]=function(_0x575fd5){var _0x30ec49=this;return function(){if(!_0x30ec49[_0x8c64('0x83')](_0x575fd5[_0x8c64('0x8a')])){if(!_0x30ec49[_0x8c64('0x83')](_0x575fd5[_0x8c64('0x8b')])){_0x575fd5[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x8c')];throw _0x575fd5['name']+_0x8c64('0x8d');}}};};Dialer[_0x8c64('0x1a')][_0x8c64('0x8e')]=function(_0x2f66d0,_0x2bf0c4,_0x28e36f,_0x2ad279){var _0x1ca2f2=this;return function(){var _0x4291d0=!![];return _0x1ca2f2[_0x8c64('0x8f')](_0x2f66d0,_0x2bf0c4,_0x28e36f,_0x2ad279,_0x4291d0);};};Dialer[_0x8c64('0x1a')][_0x8c64('0x90')]=function(_0xf6e1e0,_0x6d0022,_0x5c1138,_0x3405bd){var _0x47b7cf=this;return function(){var _0x3991f4=![];return _0x47b7cf['ifTimeIvr'](_0xf6e1e0[_0x8c64('0x74')],_0x6d0022,_0x5c1138,_0x3405bd,_0x3991f4);};};Dialer[_0x8c64('0x1a')][_0x8c64('0x8f')]=function(_0x299d82,_0x1764b4,_0x3f2a86,_0x2b74c4,_0x412a54){var _0x1fddca=[];return new Promise(function(_0x1befb9,_0x436a67){if(!isNotNull(_0x299d82)){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x72')];return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',_0x3f2a86+_0x8c64('0x92')));}if(_[_0x8c64('0x47')](_0x299d82)){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x93')];return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',_0x3f2a86+_0x8c64('0x94')));}if(_0x1764b4&&_[_0x8c64('0x3f')](config[_0x8c64('0x95')][_0x1764b4])){_0x2b74c4[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x96')];return _0x436a67(msgResponse(_0x8c64('0x91'),_0x8c64('0x97'),_0x3f2a86+_0x8c64('0x98')+_0x1764b4));}if(_[_0x8c64('0x99')](_0x299d82)){for(var _0xfbfa3d=0x0;_0xfbfa3d<_0x299d82[_0x8c64('0x9a')];_0xfbfa3d+=0x1){_0x1fddca[_0x8c64('0x9b')](ami[_0x8c64('0x9c')]({'action':_0x8c64('0x9d'),'command':util['format']('iftime\x20%s,%s',_0x299d82[_0xfbfa3d][_0x8c64('0x9e')],!_['isUndefined'](config[_0x8c64('0x95')][_0x1764b4])?_0x1764b4:'')})[_0x8c64('0x3d')](function(_0x3ada21){return _0x3ada21['content'][_0x8c64('0x9f')](_0x8c64('0xa0'))>=0x0;})[_0x8c64('0xa1')](myreject(_0x436a67)));}}else{_0x1fddca[_0x8c64('0x9b')](ami['Action']({'action':_0x8c64('0x9d'),'command':util[_0x8c64('0x44')](_0x8c64('0xa2'),_0x299d82,!_[_0x8c64('0x3f')](config[_0x8c64('0x95')][_0x1764b4])?_0x1764b4:'')})[_0x8c64('0x3d')](function(_0x577fbb){return _0x577fbb[_0x8c64('0xa3')]['indexOf'](_0x8c64('0xa0'))>=0x0;})[_0x8c64('0xa1')](myreject(_0x436a67)));}Promise[_0x8c64('0xa4')](_0x1fddca)['then'](function(_0x2eb798){var _0x34956a=_[_0x8c64('0xa5')](_0x2eb798);if(_0x34956a){return _0x1befb9(_0x34956a);}else{_0x2b74c4[_0x8c64('0x66')]=_0x412a54?utils[_0x8c64('0x67')][_0x8c64('0xa6')]:utils[_0x8c64('0x67')][_0x8c64('0xa7')];return _0x436a67(msgResponse(_0x8c64('0xa8'),_0x8c64('0x97'),_0x8c64('0xa9')+_0x412a54+'\x20'+_0x3f2a86+_0x8c64('0xaa')+util[_0x8c64('0x43')](_0x299d82,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1764b4));}})[_0x8c64('0xa1')](function(_0x37d15){return _0x436a67(msgResponse(_0x8c64('0x91'),'Failure',JSON['stringify'](_0x37d15)));});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x3b')]=function(){var _0x509b3b=this;return cmHopper[_0x8c64('0xab')]({'active':![]},{'where':{'active':!![]}})[_0x8c64('0x3d')](function(){setInterval(function(){_0x509b3b[_0x8c64('0xac')]();},0x3e8);});};Dialer[_0x8c64('0x1a')][_0x8c64('0xac')]=function(){var _0x34c11f=this;var _0x4d8610;for(var _0x5d4098 in this[_0x8c64('0x20')]){if(typeof this[_0x8c64('0x20')][_0x5d4098]!==_0x8c64('0xad')){_0x4d8610=this[_0x8c64('0x20')][_0x5d4098];if(utils[_0x8c64('0x78')](_0x4d8610)&&utils['isIVRCampaignActive'](_0x4d8610)){_0x4d8610[_0x8c64('0x7b')]=!![];Promise['resolve']()[_0x8c64('0x3d')](checkIsIVRCampaignActive(_0x4d8610))['then'](checkInterval(_0x4d8610))[_0x8c64('0x3d')](_0x34c11f[_0x8c64('0x89')](_0x4d8610))[_0x8c64('0x3d')](_0x34c11f[_0x8c64('0x8e')](_0x4d8610['dialGlobalInterval'],_0x4d8610[_0x8c64('0xae')],_0x4d8610[_0x8c64('0x5e')],_0x4d8610))[_0x8c64('0x3d')](_0x34c11f['checkIfTimeIntervals'](_0x4d8610[_0x8c64('0x71')],_0x4d8610['dialTimezone'],_0x4d8610[_0x8c64('0x5e')],_0x4d8610))[_0x8c64('0x3d')](_0x34c11f['launchHandleIvr'](_0x4d8610))[_0x8c64('0xa1')](loggerCatchQueueSummary(_0x8c64('0xaf'),_0x4d8610));}else{notSendMessagesCampaign(_0x4d8610);}}}};Dialer['prototype'][_0x8c64('0xb0')]=function(_0x368873){if(_0x368873[_0x8c64('0xb1')]!==_0x8c64('0x9')){clearPredictiveAttributes(_0x368873);}switch(_0x368873['dialMethod']){case _0x8c64('0xb2'):this[_0x8c64('0xb3')](_0x368873,0x1);break;case _0x8c64('0xb4'):this['handlePower'](_0x368873,_0x368873[_0x8c64('0xb5')]);break;case'predictive':this[_0x8c64('0x9')](_0x368873);break;case _0x8c64('0x8'):this['handlePower'](_0x368873,0x1);break;default:logger[_0x8c64('0x62')](_0x8c64('0xb6'),_0x368873[_0x8c64('0x5e')],_0x8c64('0xb7'));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x91')]=function(_0x19b57e,_0x4337e3){var _0x1bfe71=_0x19b57e[_0x8c64('0xae')];var _0x27d9c6=_0x4337e3?_0x19b57e[_0x8c64('0xb8')]:_0x19b57e[_0x8c64('0x71')][_0x8c64('0x74')];logger[_0x8c64('0xb9')](_0x8c64('0xba'),_0x27d9c6,_0x1bfe71,_0x19b57e['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x19b57e[_0x8c64('0x5e')],_0x19b57e['id']));var _0x42b147=null;return Interval[_0x8c64('0xbb')](_0x27d9c6,_0x1bfe71)[_0x8c64('0x3d')](function(_0x5b9e47){if(_0x5b9e47===!![]){return _0x5b9e47;}else{_0x19b57e[_0x8c64('0x66')]=_0x4337e3?utils[_0x8c64('0x67')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8c64('0x67')][_0x8c64('0xa7')];_0x42b147=msgResponse(_0x8c64('0xa8'),_0x8c64('0x97'),_0x8c64('0xa9')+_0x4337e3+'\x20'+_0x19b57e[_0x8c64('0x5e')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x27d9c6,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1bfe71);}if(_0x42b147!==null){logger[_0x8c64('0xb9')](_0x8c64('0xbc'),_0x42b147);_0x42b147[_0x8c64('0xbd')]=_0x4337e3;throw _0x42b147;}})[_0x8c64('0xa1')](function(_0xcd2cc0){logger['error'](_0x8c64('0xbe'),_0xcd2cc0);throw msgResponse(_0x8c64('0x81'),'Error',util[_0x8c64('0x43')](_0xcd2cc0,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x8c64('0x2f')]=function(_0x1112d9){if(this[_0x8c64('0x1f')][_0x1112d9[_0x8c64('0xbf')]]){if(this['uniqueId'][_0x1112d9[_0x8c64('0xc0')]]&&this['uniqueId'][_0x1112d9[_0x8c64('0xc0')]]['type']!==_0x8c64('0xc1')){this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][_0x1112d9['queue']]);this[_0x8c64('0x27')][_0x1112d9[_0x8c64('0xc0')]][_0x8c64('0xc3')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));}}};Dialer['prototype'][_0x8c64('0x35')]=function(_0x48d7d5){var _0xb9d6e1=this[_0x8c64('0x27')][_0x48d7d5['uniqueid']];if(this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]]){if(_0xb9d6e1&&_0xb9d6e1[_0x8c64('0xc5')]!=='ivr'){delete this[_0x8c64('0x27')][_0x48d7d5['uniqueid']];this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]]['outboundAnswerCallsDay']+=0x1;var _0x5dba8a=new AgentComplete(_0xb9d6e1,_0x48d7d5);if(_0x48d7d5[_0x8c64('0xc6')]===_0x8c64('0xc7')){_0x5dba8a['agiafterat']=this[_0x8c64('0x1f')][_0x48d7d5[_0x8c64('0xbf')]][_0x8c64('0xc8')]&&this['voiceQueues'][_0x48d7d5[_0x8c64('0xbf')]][_0x8c64('0xc9')]?moment()[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x5dba8a)['catch'](loggerCatch(_0x8c64('0xca')));hopperUtils[_0x8c64('0xcb')](_0x5dba8a)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xcc')));}}};Dialer[_0x8c64('0x1a')][_0x8c64('0x32')]=function(_0x242bae){var _0x42efaa=this[_0x8c64('0x27')][_0x242bae[_0x8c64('0xc0')]];var _0x4224b7=this;var _0x21dbf7=![];var _0x526646;var _0x56d214;if(this['voiceQueues'][_0x242bae[_0x8c64('0xbf')]]){if(_0x42efaa&&_0x42efaa[_0x8c64('0xc5')]!=='ivr'){delete this[_0x8c64('0x27')][_0x242bae[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][_0x242bae['queue']]);_0x42efaa[_0x8c64('0xcd')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));var _0x3d34f2=new QueueCallerAbandon(_0x42efaa,_0x242bae);if(utils[_0x8c64('0x5d')](_0x42efaa[_0x8c64('0xcd')],_0x42efaa[_0x8c64('0xce')])>=_0x42efaa[_0x8c64('0xcf')]){this[_0x8c64('0x1f')][_0x242bae['queue']][_0x8c64('0x4d')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd0')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd1')]+=0x1;_0x3d34f2[_0x8c64('0xd2')]=0xa;_0x3d34f2[_0x8c64('0x6a')]=_0x8c64('0xd3');_0x3d34f2[_0x8c64('0xd4')]=_0x8c64('0xd5');_0x3d34f2[_0x8c64('0xd6')]=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['dialQueueProject2']?moment()[_0x8c64('0x44')](_0x8c64('0xc4')):undefined;_0x3d34f2[_0x8c64('0xd7')]+=0x1;_0x3d34f2[_0x8c64('0xd8')]+=0x1;_0x526646=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd9')];_0x56d214=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x8c64('0xda')](_0x3d34f2,_0x3d34f2[_0x8c64('0xd2')],_0x42efaa[_0x8c64('0xdb')])[_0x8c64('0x3d')](function(_0x163147){_0x21dbf7=_0x163147[_0x8c64('0xdc')]==0x1;if(_0x3d34f2[_0x8c64('0xd7')]>=_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xdd')]){_0x4224b7[_0x8c64('0xde')](_0x3d34f2,_0x163147[_0x8c64('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3d34f2['countdropretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xd9')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x42efaa[_0x8c64('0xe1')],'ListId':_0x42efaa[_0x8c64('0xe2')],'VoiceQueueId':_0x42efaa[_0x8c64('0xe3')]||undefined,'CampaignId':_0x42efaa[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x448837=new History(_0x3d34f2);_0x448837[_0x8c64('0xd2')]=0xa;_0x448837[_0x8c64('0x6a')]=_0x8c64('0xd3');_0x448837['starttime']=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));_0x448837[_0x8c64('0x6b')]=_0x448837[_0x8c64('0xe5')];_0x448837['calleridname']=_0x3d34f2['calleridname'];_0x448837['calleridnum']=_0x3d34f2[_0x8c64('0xe6')];hopperUtils[_0x8c64('0xe7')](_0x448837)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xe8')));}})[_0x8c64('0x3d')](function(){if(_0x21dbf7)hopperUtils[_0x8c64('0xe9')](_0x3d34f2,_0x526646,_0x56d214)[_0x8c64('0x3d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0x4f')]+=0x1;this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xea')]+=0x1;_0x3d34f2['state']=0xb;_0x3d34f2[_0x8c64('0x6a')]=_0x8c64('0xeb');_0x3d34f2[_0x8c64('0xd4')]='CALLEREXIT';_0x3d34f2['countabandonedretry']+=0x1;_0x3d34f2['countglobal']+=0x1;_0x526646=this['voiceQueues'][_0x242bae['queue']][_0x8c64('0xec')];_0x56d214=this[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xed')];hopperUtils['verifyAdditionalPhones'](_0x3d34f2,_0x3d34f2[_0x8c64('0xd2')],_0x42efaa[_0x8c64('0xdb')])[_0x8c64('0x3d')](function(_0x28942c){if(_0x3d34f2['countabandonedretry']>=_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]][_0x8c64('0xee')]){_0x4224b7[_0x8c64('0xde')](_0x3d34f2,_0x28942c[_0x8c64('0xdc')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3d34f2[_0x8c64('0xef')],'scheduledat':moment()[_0x8c64('0xdf')](_0x4224b7[_0x8c64('0x1f')][_0x242bae[_0x8c64('0xbf')]]['dialAbandonedRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42efaa[_0x8c64('0xe1')],'ListId':_0x42efaa[_0x8c64('0xe2')],'VoiceQueueId':_0x42efaa[_0x8c64('0xe3')]||undefined,'CampaignId':_0x42efaa[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf0')));var _0xb95155=new History(_0x3d34f2);_0xb95155[_0x8c64('0xd2')]=0xb;_0xb95155[_0x8c64('0x6a')]=_0x8c64('0xeb');_0xb95155[_0x8c64('0xe5')]=moment()['format'](_0x8c64('0xc4'));_0xb95155[_0x8c64('0x6b')]=_0xb95155[_0x8c64('0xe5')];_0xb95155[_0x8c64('0xf1')]=_0x3d34f2[_0x8c64('0xf1')];_0xb95155[_0x8c64('0xe6')]=_0x3d34f2[_0x8c64('0xe6')];hopperUtils['createHistory'](_0xb95155)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf2')));}})[_0x8c64('0x3d')](function(){if(_0x21dbf7)hopperUtils['swapAdditionalPhones'](_0x3d34f2,_0x526646,_0x56d214)[_0x8c64('0x3d')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x8c64('0xf3')]=function(_0x543e57){if(this[_0x8c64('0x25')][_0x543e57[_0x8c64('0xc0')]]){this[_0x8c64('0x25')][_0x543e57[_0x8c64('0xc0')]][_0x8c64('0xf4')]=_0x543e57[_0x8c64('0xf4')];}if(this[_0x8c64('0x27')][_0x543e57[_0x8c64('0xc0')]]){this['uniqueId'][_0x543e57[_0x8c64('0xc0')]][_0x8c64('0xf4')]=_0x543e57[_0x8c64('0xf4')];}};Dialer[_0x8c64('0x1a')][_0x8c64('0x38')]=function(_0x12f551){if(!this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]){return;}var _0x42e8e7=this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]['queue']][_0x8c64('0xf6')]||_0x8c64('0xf7');if(_0x42e8e7===_0x8c64('0xf8')){if(this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]&&_['isNil'](this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xf9')])&&_0x12f551[_0x8c64('0x86')]==='1'&&_0x12f551[_0x8c64('0xfa')]==='0'){if(this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]]){if(!this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]][_0x8c64('0xf9')]){this[_0x8c64('0x21')][_0x12f551[_0x8c64('0xfb')]]['locked']=!![];this['actions'][_0x12f551['actionid']][_0x8c64('0xf9')]=!![];this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xfb')]=_0x12f551[_0x8c64('0xfb')];}}}}else if(_0x42e8e7===_0x8c64('0xf7')){if(this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]]){if(this['agents'][_0x12f551[_0x8c64('0xfb')]]){this[_0x8c64('0x25')][_0x12f551['actionid']][_0x8c64('0xfb')]=_0x12f551[_0x8c64('0xfb')];if(_[_0x8c64('0xfc')](this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x12f551['actionid']]['queue']])){this['queueBooked'][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xbf')]]=[];}this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x12f551[_0x8c64('0xf5')]][_0x8c64('0xbf')]][_0x8c64('0x9b')](_[_0x8c64('0xfd')](_[_0x8c64('0x70')](this[_0x8c64('0x25')][_0x12f551['actionid']],[_0x8c64('0xfe'),_0x8c64('0xfb')]),{'status':_0x12f551[_0x8c64('0x86')],'paused':_0x12f551['paused']}));}}}};Dialer[_0x8c64('0x1a')]['syncQueueStatusComplete']=function(_0x457648){if(!this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]){return;}var _0x4520b9=this;var _0x204a8f=this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]];var _0x35bfea=_0x204a8f[_0x8c64('0xf6')]||_0x8c64('0xf7');if(_0x35bfea==='roundrobin'){if(this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]&&this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')]){this[_0x8c64('0xff')]['run'](this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfe')],this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')])['catch'](function(_0x23ca65){logger[_0x8c64('0x62')](_0x8c64('0x100'),util[_0x8c64('0x43')](_0x23ca65,{'showHidden':![],'depth':null}));})[_0x8c64('0x1d')](function(){_0x4520b9['updateOriginated'](_0x4520b9['voiceQueues'][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]);_0x4520b9[_0x8c64('0x21')][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xfb')]]['locked']=![];delete _0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]];unlockQueueStatus(_0x204a8f);});}else{this[_0x8c64('0xc2')](this[_0x8c64('0x1f')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe1')],'ListId':this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe2')],'VoiceQueueId':this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe3')]||undefined,'CampaignId':this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x101')));delete this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]];unlockQueueStatus(_0x204a8f);}}else if(_0x35bfea===_0x8c64('0xf7')){var _0x55a197;if(this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]&&!_[_0x8c64('0x47')](this['queueBooked'][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]['queue']])){if(this[_0x8c64('0x2c')][_0x4520b9['actions'][_0x457648[_0x8c64('0xf5')]]['queue']]){this[_0x8c64('0x2c')][_0x4520b9[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]]['queue']]=this['queueBookedRR'][this[_0x8c64('0x25')][_0x457648['actionid']][_0x8c64('0xbf')]]?this[_0x8c64('0x2c')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]:this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]?this[_0x8c64('0x2b')][this[_0x8c64('0x25')][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]['_rr']||0x0:0x0;}this[_0x8c64('0x2b')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]]['_rr']=this[_0x8c64('0x2c')][this['actions'][_0x457648[_0x8c64('0xf5')]][_0x8c64('0xbf')]];for(var _0x547f85=0x0;_0x547f85=_0x1cbe98['dialGlobalMaxRetry']){_0x5958fb[_0x8c64('0x12a')](_0x97dc29,_0xd854db,_0x1f98e5,'reason19\x20machine....');}else{if(_0x97dc29['countmachineretry']>=_0x1cbe98[_0x8c64('0x12b')]){_0x5958fb['createStateFinal'](_0x97dc29,_0xd854db,_0x1f98e5,_0x8c64('0x12c'));}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x97dc29['countmachineretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x1cbe98['dialMachineRetryFrequency'],_0x8c64('0xe0'))['format'](_0x8c64('0xc4')),'ContactId':_0x97dc29['ContactId'],'ListId':_0x97dc29[_0x8c64('0xe2')],'VoiceQueueId':_0x97dc29[_0x8c64('0xe3')]||undefined,'CampaignId':_0x97dc29['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Machine]'));_0xd854db({'reschedule':0x1});}}});}if(_0x5ca938[_0x8c64('0xc5')]===_0x8c64('0xc1')&&this[_0x8c64('0x20')][_0x5ca938[_0x8c64('0xbf')]]['dialAMDActive']&&_0x3c786e[_0x8c64('0x116')]===_0x8c64('0x12d')){delete this[_0x8c64('0x27')][_0x3c786e['uniqueid']];this['updateOriginated'](this[_0x8c64('0x20')][_0x5ca938[_0x8c64('0xbf')]]);_0x41a721=new Hangup(_0x5ca938,_0x3c786e);_0x41a721[_0x8c64('0xd2')]=0x12;_0x41a721['statedesc']=_0x8c64('0x119');_0x41a721[_0x8c64('0x11a')]=_0x8c64('0x11b');ami[_0x8c64('0x11c')]('custom:amd',ut[_0x8c64('0x12e')](_0x41a721,'amd'));this['saveInDb'](_0x41a721,_0x8c64('0x12f'),'[syncHangupInAMDIvr]');}if(_0x5ca938['type']===_0x8c64('0xc1')&&this['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x122')]&&_0x3c786e['value']==='MACHINE'){return new Promise(function(_0x42ed4d,_0x102a53){delete _0x5958fb[_0x8c64('0x27')][_0x3c786e[_0x8c64('0xc0')]];_0x5958fb['updateOriginated'](_0x5958fb['campaigns'][_0x5ca938['queue']]);_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x117')]+=0x1;_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]][_0x8c64('0x118')]+=0x1;var _0x5b5cb0=_0x5958fb['campaigns'][_0x5ca938[_0x8c64('0xbf')]];var _0x51c71f=new Hangup(_0x5ca938,_0x3c786e);_0x51c71f[_0x8c64('0xd2')]=0x13;_0x51c71f[_0x8c64('0x6a')]=_0x8c64('0x124');_0x51c71f[_0x8c64('0x11a')]=_0x8c64('0x11b');_0x51c71f[_0x8c64('0x125')]+=0x1;_0x51c71f[_0x8c64('0xd8')]+=0x1;_0x51c71f[_0x8c64('0x11e')]=!![];ami[_0x8c64('0x11c')](_0x8c64('0x11d'),ut[_0x8c64('0x12e')](_0x51c71f,'amd'));hopperUtils[_0x8c64('0xe7')](_0x51c71f)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x130')));if(_0x51c71f[_0x8c64('0x126')]+_0x51c71f['countcongestionretry']+_0x51c71f[_0x8c64('0x128')]+_0x51c71f[_0x8c64('0x129')]+_0x51c71f[_0x8c64('0xd7')]+_0x51c71f[_0x8c64('0xef')]+_0x51c71f[_0x8c64('0x125')]+_0x51c71f[_0x8c64('0x131')]>=_0x5b5cb0[_0x8c64('0x132')]){_0x5958fb[_0x8c64('0x12a')](_0x51c71f,_0x42ed4d,_0x102a53,_0x8c64('0x133'));}else{if(_0x51c71f[_0x8c64('0x125')]>=_0x5b5cb0[_0x8c64('0x12b')]){_0x5958fb[_0x8c64('0x134')](_0x51c71f,_0x42ed4d,_0x102a53,_0x8c64('0x12c'));}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x51c71f['countmachineretry'],'scheduledat':moment()[_0x8c64('0xdf')](_0x5b5cb0['dialMachineRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x51c71f[_0x8c64('0xe1')],'ListId':_0x51c71f[_0x8c64('0xe2')],'VoiceQueueId':_0x51c71f[_0x8c64('0xe3')]||undefined,'CampaignId':_0x51c71f[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x135')));_0x42ed4d({'reschedule':0x1});}}});}}};Dialer[_0x8c64('0x1a')][_0x8c64('0x136')]=function(_0x14f871){var _0x4eb323=this['uniqueId'][_0x14f871[_0x8c64('0xc0')]];var _0x5624e7;if(_0x4eb323&&_0x4eb323['type']===_0x8c64('0xc1')){delete this[_0x8c64('0x27')][_0x14f871[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this['campaigns'][_0x4eb323[_0x8c64('0xbf')]]);this[_0x8c64('0x20')][_0x4eb323['queue']][_0x8c64('0x137')]+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);hopperUtils[_0x8c64('0xe7')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils['moveContactManagedDialer'](_0x5624e7)['catch'](loggerCatch(_0x8c64('0x139')));}if(_0x4eb323&&_0x4eb323['type']!==_0x8c64('0xc1')&&isNotNull(this['voiceQueues'][_0x4eb323[_0x8c64('0xbf')]][_0x8c64('0x13a')])){delete this[_0x8c64('0x27')][_0x14f871['uniqueid']];this[_0x8c64('0xc2')](this['voiceQueues'][_0x4eb323['queue']]);this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]]['outboundAnswerCallsDay']+=0x1;this[_0x8c64('0x1f')][_0x4eb323['queue']][_0x8c64('0x118')]+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);_0x5624e7[_0x8c64('0xd2')]=0x10;_0x5624e7[_0x8c64('0x6a')]='AnswerAGI';_0x5624e7[_0x8c64('0x11a')]='AGI';hopperUtils['createHistory'](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils[_0x8c64('0xcb')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0x4eb323&&_0x4eb323[_0x8c64('0xc5')]!==_0x8c64('0xc1')&&!isNotNull(this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]][_0x8c64('0x13a')])){delete this['uniqueId'][_0x14f871[_0x8c64('0xc0')]];this[_0x8c64('0xc2')](this['voiceQueues'][_0x4eb323['queue']]);this[_0x8c64('0x1f')][_0x4eb323[_0x8c64('0xbf')]]['outboundUnknownCallsDay']+=0x1;_0x5624e7=new Hangup(_0x4eb323,_0x14f871);_0x5624e7[_0x8c64('0xd2')]=0xc;_0x5624e7[_0x8c64('0x6a')]=_0x14f871[_0x8c64('0x13b')];_0x5624e7[_0x8c64('0x11a')]='Unknow';hopperUtils[_0x8c64('0xe7')](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x138')));hopperUtils['moveContactManagedDialer'](_0x5624e7)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x139')));}};Dialer['prototype'][_0x8c64('0xb')]=function(_0x3ce689){var _0x8a6459=this;if(!_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]]){_0x8a6459[_0x8c64('0x2d')][_0x3ce689['name']]={'running':![]};}else if(_0x8a6459['queuesSummary'][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]===!![]){return;}else if(_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]===![]){_0x8a6459[_0x8c64('0x2d')][_0x3ce689[_0x8c64('0x5e')]][_0x8c64('0x13c')]=!![];}var _0x48ee22=_0x8a6459['voiceQueues'][_0x3ce689[_0x8c64('0x5e')]];var _0x395a88=_0x48ee22[_0x8c64('0x66')]!==utils[_0x8c64('0x67')][_0x8c64('0x76')];var _0x36acf8=utils[_0x8c64('0x13d')](_0x48ee22);_0x48ee22[_0x8c64('0x13e')]=utils['getQueueCampaignStatusMessage'](_0x48ee22,_0x8a6459[_0x8c64('0x22')]);Promise[_0x8c64('0x13f')]()['then'](function(){if(_0x48ee22[_0x8c64('0x13e')]===utils[_0x8c64('0x67')][_0x8c64('0x76')]){if(_0x395a88){clearPredictiveAttributes(_0x48ee22);_0x3ce689['startPredictive']=undefined;_0x3ce689['startProgressive']=undefined;}if(_0x48ee22['statusMessage']===utils[_0x8c64('0x67')]['INACTIVE']){_0x3ce689[_0x8c64('0x140')]=0x0;_0x3ce689[_0x8c64('0xfa')]=0x0;_0x3ce689[_0x8c64('0x141')]=0x0;_0x3ce689[_0x8c64('0x142')]=0x0;_0x3ce689[_0x8c64('0x143')]=0x0;}}else if(_0x48ee22['statusMessage']===utils[_0x8c64('0x67')][_0x8c64('0x144')]&&!_0x36acf8){return _0x8a6459[_0x8c64('0x91')](_0x48ee22,!![])[_0x8c64('0x3d')](function(){return _0x8a6459[_0x8c64('0x91')](_0x48ee22,![]);})['then'](function(){return _0x8a6459[_0x8c64('0xb0')](_0x48ee22);})[_0x8c64('0xa1')](function(_0x3b782b){loggerSyncQueueSummary[_0x8c64('0x41')](_0x8c64('0x145'),util[_0x8c64('0x43')](_0x3b782b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x48ee22);});}else{clearPredictiveAttributes(_0x48ee22);}})[_0x8c64('0x3d')](function(){var _0x37a6a6=_0x3ce689['compareToOutboundQueue'](_0x48ee22);if(_0x37a6a6||_0x48ee22['queueSummaryCountersUpdated']){_0x48ee22['queueSummaryCountersUpdated']=![];_0x3ce689[_0x8c64('0x146')](_0x48ee22);Object[_0x8c64('0x147')](_0x48ee22,_0x3ce689);emitOutboundVoiceQueueSummary(_0x3ce689);}_0x8a6459[_0x8c64('0x2d')][_0x48ee22[_0x8c64('0x5e')]][_0x8c64('0x13c')]=![];})['catch'](function(_0x20d282){logger[_0x8c64('0x62')](_0x8c64('0x145'),util[_0x8c64('0x43')](_0x20d282,{'showHidden':![],'depth':null}));_0x8a6459[_0x8c64('0x2d')][_0x48ee22[_0x8c64('0x5e')]][_0x8c64('0x13c')]=![];});};Dialer[_0x8c64('0x1a')][_0x8c64('0x148')]=_['throttle'](function(){var _0x2dd137=_[_0x8c64('0x149')](this[_0x8c64('0x1f')],function(_0x5d22b4){return _0x5d22b4[_0x8c64('0x14a')];});var _0x3492a5=_[_0x8c64('0x149')](this['agents'],function(_0xd9f6cc){return _0xd9f6cc[_0x8c64('0x14b')]&&_0xd9f6cc['status']===_0x8c64('0x87');});if(_0x2dd137['length']>0x0&&_0x3492a5[_0x8c64('0x9a')]>0x0){return Promise[_0x8c64('0x13f')]()[_0x8c64('0x3d')](cmHopper[_0x8c64('0x14c')](_['map'](_0x2dd137,'id'),previewRecallmeReminderInterval,_['map'](_0x3492a5,'id')))[_0x8c64('0x3d')](function(_0x36a02c){for(var _0xbd5b4b=0x0;_0xbd5b4b<_0x36a02c[_0x8c64('0x9a')];_0xbd5b4b++){var _0x35c52b=_0x36a02c[_0xbd5b4b]['Agent']['name'];if(_0x35c52b)io['to'](util[_0x8c64('0x44')](_0x8c64('0x14d'),_0x35c52b))[_0x8c64('0x11c')](_0x8c64('0x14e'),{'hopper':_0x36a02c[_0xbd5b4b]});}})[_0x8c64('0xa1')](function(_0xfc2888){logger[_0x8c64('0x62')](_0x8c64('0x14f'),_0xfc2888);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8c64('0x1a')][_0x8c64('0x150')]=function(){var _0x2dfd79=this;setInterval(function(){_0x2dfd79[_0x8c64('0x151')](_0x2dfd79[_0x8c64('0x27')],_0x8c64('0x152'));_0x2dfd79[_0x8c64('0x151')](_0x2dfd79[_0x8c64('0x25')],'[actions]');},0x32c8);};Dialer[_0x8c64('0x1a')][_0x8c64('0x151')]=function(_0x42b3e8,_0x4409fb){var _0x4cacc9=this;for(var _0x23bddf in _0x42b3e8){if(typeof _0x42b3e8[_0x23bddf]!=='undefined'){this[_0x8c64('0x1e')][_0x8c64('0x1b')](function(){if(!_[_0x8c64('0xfc')](_0x42b3e8[_0x23bddf])){return ami[_0x8c64('0x9c')]({'action':_0x8c64('0x86'),'channel':_0x42b3e8[_0x23bddf][_0x8c64('0xf4')]})[_0x8c64('0xa1')](function(_0x41a0f1){if(_0x41a0f1[_0x8c64('0x66')]===_0x8c64('0x153')){setTimeout(function(){if(_0x42b3e8[_0x23bddf]&&_0x42b3e8[_0x23bddf]['type']!==_0x8c64('0xc1')){_0x4cacc9[_0x8c64('0xc2')](_0x4cacc9[_0x8c64('0x1f')][_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]]);logger['error'](_0x8c64('0x154'),_0x4409fb,_0x23bddf,_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]);delete _0x42b3e8[_0x23bddf];}if(_0x42b3e8[_0x23bddf]&&_0x42b3e8[_0x23bddf][_0x8c64('0xc5')]===_0x8c64('0xc1')){_0x4cacc9['updateOriginated'](_0x4cacc9[_0x8c64('0x20')][_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]]);logger[_0x8c64('0x62')](_0x8c64('0x155'),_0x4409fb,_0x23bddf,_0x42b3e8[_0x23bddf][_0x8c64('0xbf')]);delete _0x42b3e8[_0x23bddf];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x560df1){return Promise[_0x8c64('0x13f')]()['then'](voiceQueueRt[_0x8c64('0x156')](_0x560df1))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8c64('0x1a')][_0x8c64('0xc2')]=function(_0x1b734a){if(!_[_0x8c64('0x3f')](_0x1b734a)&&_0x1b734a!==null){if(typeof _0x1b734a['originated']!=='undefined'){if(_0x1b734a[_0x8c64('0x7c')]>0x0){_0x1b734a[_0x8c64('0x7c')]-=0x1;}else{logger[_0x8c64('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8c64('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8c64('0x1a')][_0x8c64('0x157')]=function(_0x3a45ef,_0x5788ee){var _0x14b581=this;return function(_0x5b9bbf){_0x14b581[_0x8c64('0xc2')](_0x5788ee);logger[_0x8c64('0x62')](_0x3a45ef,util[_0x8c64('0x43')](_0x5b9bbf,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x8c64('0x158')]=function(_0x24499f,_0x21ab21,_0x1d45a6){var _0x5d44d8={'state':0x19,'statedesc':_0x8c64('0x159')};this[_0x8c64('0xc2')](_0x21ab21);this['saveInDb'](_['merge'](_0x5d44d8,_[_0x8c64('0x70')](_0x1d45a6,['ContactId',_0x8c64('0xe2'),_0x8c64('0x15a'),_0x8c64('0xe3'),'CampaignId'])),_0x8c64('0x15b'),_0x8c64('0x15c'));logger[_0x8c64('0x62')](_0x24499f);};Dialer[_0x8c64('0x1a')]['saveInDb']=function(_0x37eed1,_0x16aeca,_0x4fbc17){hopperUtils['createHistory'](_0x37eed1)[_0x8c64('0xa1')](loggerCatch(_0x16aeca));hopperUtils[_0x8c64('0xcb')](_0x37eed1)[_0x8c64('0xa1')](loggerCatch(_0x4fbc17));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x4037bd,_0x42eebe){hopperUtils['createHistory'](_0x4037bd)[_0x8c64('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x42eebe==0x0){hopperUtils[_0x8c64('0xcb')](_0x4037bd)[_0x8c64('0xa1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x14f')]=function(_0x4a9755){return Promise[_0x8c64('0x13f')]()['then'](cmHopper[_0x8c64('0x14c')](_0x4a9755['id'],previewRecallmeReminderInterval))[_0x8c64('0x3d')](function(_0x4804eb){for(var _0x4c4914=0x0;_0x4c4914<_0x4804eb[_0x8c64('0x9a')];_0x4c4914++){var _0xb1ecbd=_0x4804eb[_0x4c4914]['Agent'][_0x8c64('0x5e')];if(_0xb1ecbd)io['to'](util[_0x8c64('0x44')](_0x8c64('0x14d'),_0xb1ecbd))['emit'](_0x8c64('0x14e'),{'hopper':_0x4804eb[_0x4c4914]});}})[_0x8c64('0xa1')](function(){});};Dialer['prototype'][_0x8c64('0x15d')]=function(_0x424bd2){var _0x204e24=this;return function(){_0x204e24[_0x8c64('0x15e')](_0x424bd2);};};Dialer['prototype'][_0x8c64('0x15f')]=function(_0x31f97c,_0x57936f){var _0xea9319=this;var _0x58c48c=uuid['v4']();this[_0x8c64('0x25')][_0x58c48c]=new Action(_0x31f97c,_0x57936f,_0x58c48c);return new Promise(function(_0x4e8ae6,_0x1b7b16){if(_[_0x8c64('0x3f')](_0x31f97c)&&typeof _0x31f97c!==_0x8c64('0x160')){return _0x1b7b16(msgResponse(_0x8c64('0x161'),_0x8c64('0x97'),_0x8c64('0x162')));}if(_[_0x8c64('0x3f')](_0x57936f['phone'])||_0x57936f['phone']===null){return _0x1b7b16(msgResponse('originate',_0x8c64('0x97'),_0x8c64('0x163')));}var _0x572a73={'XMD-CALLERID':_0xea9319[_0x8c64('0x25')][_0x58c48c][_0x8c64('0x164')](),'XMD-AGI':_0x31f97c[_0x8c64('0x13a')]?util[_0x8c64('0x44')](_0x8c64('0x165'),ipAgi,_0x31f97c['dialQueueProject']):_0x8c64('0x166'),'XMD-AGIAFTER':_0x31f97c[_0x8c64('0xc8')]?util[_0x8c64('0x44')](_0x8c64('0x165'),ipAgi,_0x31f97c[_0x8c64('0xc8')]):_0x8c64('0x166'),'XMD-QUEUE':utils[_0x8c64('0x167')](_0x31f97c)?util[_0x8c64('0x44')](_0x8c64('0x168'),_0x31f97c[_0x8c64('0x5e')],_0x31f97c[_0x8c64('0x169')]||'',_0x31f97c[_0x8c64('0xc9')]?'c':'',_0x31f97c[_0x8c64('0xcf')]||0x3):_0x8c64('0x166'),'XMD-CONTACTID':_0x57936f[_0x8c64('0xe1')],'XMD-CDRTYPE':_0x8c64('0x7'),'CALLERID(all)':_0xea9319['actions'][_0x58c48c]['getCaller'](),'XMD-AMD':_0x31f97c[_0x8c64('0x122')]?_0x8c64('0x144'):_0x8c64('0x166'),'XMD-DESTINATION':_0x8c64('0x115')};if(_0x31f97c['dialAMDActive']){_0x572a73[_0x8c64('0x16a')]=_0x31f97c[_0x8c64('0x16b')]||0x9c4;_0x572a73['XMD-AMDGREETING']=_0x31f97c[_0x8c64('0x16c')]||0x5dc;_0x572a73['XMD-AMDAFTERGREETINGSILENCE']=_0x31f97c[_0x8c64('0x16d')]||0x320;_0x572a73['XMD-AMDTOTALANALYSISTIME']=_0x31f97c[_0x8c64('0x16e')]||0x1388;_0x572a73[_0x8c64('0x16f')]=_0x31f97c[_0x8c64('0x170')]||0x64;_0x572a73['XMD-AMDBETWEENWORDSSILENCE']=_0x31f97c[_0x8c64('0x171')]||0x32;_0x572a73[_0x8c64('0x172')]=_0x31f97c['dialAMDMaximumNumberOfWords']||0x3;_0x572a73[_0x8c64('0x173')]=_0x31f97c[_0x8c64('0x174')]||0x100;_0x572a73[_0x8c64('0x175')]=_0x31f97c[_0x8c64('0x176')]||0x1388;}if(utils[_0x8c64('0x167')](_0x31f97c)){_0x572a73[_0x8c64('0x177')]=_0x57936f[_0x8c64('0xe3')];}else{_0x572a73[_0x8c64('0x178')]=_0x57936f[_0x8c64('0xe4')];}for(var _0x20a667 in _0x57936f[_0x8c64('0x179')]){if(typeof _0x57936f[_0x8c64('0x179')][_0x20a667]!==_0x8c64('0xad')){if(isNotNull(_0x57936f[_0x8c64('0x179')][_0x20a667])&&_0x20a667!=='id'&&_0x20a667!==_0x8c64('0x17a')&&_0x20a667!==_0x8c64('0x17b')&&_0x20a667!==_0x8c64('0x17c')){_0x572a73[util[_0x8c64('0x44')]('%s%s',_0x8c64('0x17d'),_[_0x8c64('0x17e')](_0x20a667))]=_0x57936f[_0x8c64('0x179')][_0x20a667];}}}var _0x9c6d9c=_0xea9319[_0x8c64('0x83')](_0x31f97c[_0x8c64('0x8a')])?utils[_0x8c64('0x17f')](_0x31f97c[_0x8c64('0x8a')][_0x8c64('0x180')],_0x31f97c[_0x8c64('0x181')],_0x31f97c[_0x8c64('0x182')]>0x0?utils['getCallerIdRandom'](_0x31f97c[_0x8c64('0x183')],_0x31f97c['dialRandomLastDigitCallerIdNumber']):_0x31f97c['dialOriginateCallerIdNumber']):utils[_0x8c64('0x17f')](_['isNil'](_0x31f97c['TrunkBackup'])?_0x31f97c['Trunk']['callerid']:_0x31f97c[_0x8c64('0x8b')]['callerid'],_0x31f97c[_0x8c64('0x181')],_0x31f97c[_0x8c64('0x182')]>0x0?utils[_0x8c64('0x184')](_0x31f97c[_0x8c64('0x183')],_0x31f97c[_0x8c64('0x182')]):_0x31f97c[_0x8c64('0x183')]);if(_0x9c6d9c){_0x572a73[_0x8c64('0x185')]=_0xea9319[_0x8c64('0x25')][_0x58c48c][_0x8c64('0x186')]=utils[_0x8c64('0x187')](_0x9c6d9c);_0x572a73[_0x8c64('0x188')]=_0x57936f[_0x8c64('0x189')];}_0x31f97c[_0x8c64('0x18a')]=_0x572a73;return ami[_0x8c64('0x9c')]({'actionid':_0x58c48c,'action':_0x8c64('0x161'),'channel':_0xea9319[_0x8c64('0x83')](_0x31f97c[_0x8c64('0x8a')])?util[_0x8c64('0x44')](_0x8c64('0x18b'),_0x31f97c['Trunk'][_0x8c64('0x5e')],isNotNull(_0x31f97c[_0x8c64('0x18c')])?_0x31f97c['dialPrefix'][_0x8c64('0x18d')]()||'':'',_0x31f97c[_0x8c64('0x18e')]>0x0?_0x57936f[_0x8c64('0x189')][_0x8c64('0x18f')](_0x31f97c['dialCutDigit']):_0x57936f[_0x8c64('0x189')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x31f97c[_0x8c64('0x8b')])?_0x31f97c[_0x8c64('0x8a')][_0x8c64('0x5e')]:_0x31f97c[_0x8c64('0x8b')][_0x8c64('0x5e')],isNotNull(_0x31f97c['dialPrefix'])?_0x31f97c[_0x8c64('0x18c')]['trim']()||'':'',_0x31f97c['dialCutDigit']>0x0?_0x57936f['phone'][_0x8c64('0x18f')](_0x31f97c[_0x8c64('0x18e')]):_0x57936f[_0x8c64('0x189')]),'callerid':_0x9c6d9c,'Exten':'xcally-motion-dialer','Context':_0x8c64('0x190'),'Priority':'1','variable':_0x572a73,'timeout':(_0x31f97c[_0x8c64('0x191')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58c48c})['then'](function(_0xb74621){return _0x4e8ae6(_0xb74621);})[_0x8c64('0xa1')](function(_0x1e08dc){_0x31f97c['outboundOriginateFailureCallsDay']+=0x1;var _0x53e314=new History(_0xea9319['actions'][_0x58c48c]);logger[_0x8c64('0x62')](util[_0x8c64('0x44')]('[originateError]:\x20%s',JSON['stringify'](_0x1e08dc)));_0x53e314['state']=0xe;_0x53e314[_0x8c64('0x6a')]='OriginateError';_0x53e314[_0x8c64('0xe5')]=moment()['format'](_0x8c64('0xc4'));_0x53e314['endtime']=_0x53e314[_0x8c64('0xe5')];hopperUtils[_0x8c64('0xe7')](_0x53e314)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x192')));_0xea9319[_0x8c64('0xcb')](_0x53e314)['catch'](loggerCatch('[originate][error]'))[_0x8c64('0x1d')](function(){delete _0xea9319[_0x8c64('0x25')][_0x58c48c];return _0x1b7b16(msgResponse('originate',_0x8c64('0x82'),'originate\x20action\x20Error'));});});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x193')]=function(_0x464495,_0x4ad3fd,_0x2644e6){var _0x1aa476=new History(_0x4ad3fd);if(_0x1aa476[_0x8c64('0x126')]+_0x1aa476[_0x8c64('0x127')]+_0x1aa476[_0x8c64('0x128')]+_0x1aa476[_0x8c64('0x129')]+_0x1aa476[_0x8c64('0xd7')]+_0x1aa476[_0x8c64('0xef')]+_0x1aa476[_0x8c64('0x125')]+_0x1aa476[_0x8c64('0x131')]>=_0x2644e6[_0x8c64('0x132')]-0x1){return!![];}switch(_0x464495){case 0x3:if(_0x1aa476[_0x8c64('0x128')]>=_0x2644e6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countnoanswerretry':_0x1aa476[_0x8c64('0x128')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476['ContactId'],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476['VoiceQueueId']||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x194')));break;case 0x5:if(_0x1aa476[_0x8c64('0x126')]>=_0x2644e6[_0x8c64('0x195')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countbusyretry':_0x1aa476[_0x8c64('0x126')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6['dialBusyRetryFrequency'],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x196')));break;case 0x8:if(_0x1aa476[_0x8c64('0x127')]>=_0x2644e6['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1aa476[_0x8c64('0x127')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0x197')],'minutes')['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476['ListId'],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x198')));break;case 0x0:if(_0x1aa476[_0x8c64('0x129')]>=_0x2644e6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x8c64('0x108')]({'active':![],'countnosuchnumberretry':_0x1aa476[_0x8c64('0x129')]+=0x1,'scheduledat':moment()['add'](_0x2644e6['dialNoSuchNumberRetryFrequency'],_0x8c64('0xe0'))['format'](_0x8c64('0xc4')),'ContactId':_0x1aa476['ContactId'],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1aa476[_0x8c64('0xd7')]>=_0x2644e6[_0x8c64('0xdd')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countdropretry':_0x1aa476[_0x8c64('0xd7')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0xd9')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x199')));break;case 0xb:if(_0x1aa476[_0x8c64('0xef')]>=_0x2644e6[_0x8c64('0xee')]-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countabandonedretry':_0x1aa476[_0x8c64('0xef')]+=0x1,'scheduledat':moment()['add'](_0x2644e6[_0x8c64('0xec')],_0x8c64('0xe0'))[_0x8c64('0x44')](_0x8c64('0xc4')),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476['VoiceQueueId']||undefined,'CampaignId':_0x1aa476['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1aa476[_0x8c64('0x125')]>=_0x2644e6['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countmachineretry':_0x1aa476['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x2644e6['dialMachineRetryFrequency'],_0x8c64('0xe0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x135')));break;case 0x14:if(_0x1aa476[_0x8c64('0x131')]>=_0x2644e6['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x8c64('0x108')]({'active':![],'countagentrejectretry':_0x1aa476[_0x8c64('0x131')]+=0x1,'scheduledat':moment()[_0x8c64('0xdf')](_0x2644e6[_0x8c64('0x19a')],'minutes')[_0x8c64('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1aa476[_0x8c64('0xe1')],'ListId':_0x1aa476[_0x8c64('0xe2')],'VoiceQueueId':_0x1aa476[_0x8c64('0xe3')]||undefined,'CampaignId':_0x1aa476[_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x19b')));break;default:return!![];}};Dialer[_0x8c64('0x1a')]['callProgressDetecting']=function(_0x29dce5,_0x1d6695,_0x182f6f){var _0x252b00=this;var _0x1fb487=new History(_0x29dce5);var _0x4410bd=![];var _0x21e96f;var _0x426df7;return new Promise(function(_0x416caf,_0x178851){if(_[_0x8c64('0x3f')](_0x1d6695)&&typeof _0x1d6695!==_0x8c64('0x160')){return _0x178851(msgResponse(_0x8c64('0x19c'),_0x8c64('0x97'),_0x8c64('0x19d')));}if(_[_0x8c64('0x3f')](_0x182f6f)&&typeof _0x182f6f!==_0x8c64('0x160')){return _0x178851(msgResponse(_0x8c64('0x19c'),_0x8c64('0x97'),'evt\x20is\x20undefine'));}hopperUtils[_0x8c64('0xda')](_0x1fb487,_0x182f6f[_0x8c64('0xc6')],_0x1d6695)['then'](function(_0x4334b2){if(_0x4334b2[_0x8c64('0xdc')]==0x1)_0x4410bd=!![];switch(_0x182f6f[_0x8c64('0xc6')]){case'0':_0x1d6695['outboundNoSuchCallsDay']+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x0;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x19e');_0x1fb487[_0x8c64('0x129')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;ami[_0x8c64('0x11c')]('custom:agentnosuchnumber',ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x19f')));_0x21e96f=_0x1d6695['dialNoSuchNumberRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x252b00[_0x8c64('0x193')](0x0,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x129')]>=_0x1d6695[_0x8c64('0x1a0')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,'reason\x200\x20no\x20such\x20number....');}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1d6695[_0x8c64('0x1a1')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x3;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1a2');_0x1fb487[_0x8c64('0x128')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;var _0x2f1a51=ut[_0x8c64('0x1a3')](_0x29dce5,_0x1d6695);ami['emit']('custom:agentnoanswer',_0x2f1a51);_0x21e96f=_0x1d6695[_0x8c64('0x1a4')];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1a5')));if(_0x252b00['checkRetriveMax'](0x3,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x128')]>=_0x1d6695['dialNoAnswerMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1a6'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1a6'));}}break;case'5':_0x1d6695[_0x8c64('0x1a7')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x5;_0x1fb487['statedesc']='Busy';_0x1fb487[_0x8c64('0x126')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;ami[_0x8c64('0x11c')](_0x8c64('0x1a8'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1a9')));_0x21e96f=_0x1d6695['dialBusyRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils[_0x8c64('0xe7')](_0x1fb487)[_0x8c64('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x252b00[_0x8c64('0x193')](0x5,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x126')]>=_0x1d6695['dialBusyMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1aa'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x205\x20busy');}}break;case'8':_0x1d6695[_0x8c64('0x1ab')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x8;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1ac');_0x1fb487[_0x8c64('0x127')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695[_0x8c64('0x197')];_0x426df7=_0x1d6695['callAdditionalPhoneAfterMin'];ami[_0x8c64('0x11c')](_0x8c64('0x1ad'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1ae')));hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1af')));if(_0x252b00['checkRetriveMax'](0x8,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x127')]>=_0x1d6695[_0x8c64('0x1b0')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b1'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b1'));}}break;case'11':_0x1d6695[_0x8c64('0x1b2')]+=0x1;_0x1fb487['state']=0xb;_0x1fb487['statedesc']=_0x8c64('0xeb');_0x1fb487[_0x8c64('0xef')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695[_0x8c64('0xec')];_0x426df7=_0x1d6695['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1fb487)[_0x8c64('0xa1')](loggerCatch(_0x8c64('0xf2')));if(_0x252b00[_0x8c64('0x193')](0xb,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0xef')]>=_0x1d6695[_0x8c64('0xee')]){_0x252b00['createStateFinal'](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b3'));}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,'reason\x2011\x20abandoned');}}break;case'20':_0x1d6695[_0x8c64('0x1b4')]+=0x1;_0x1fb487[_0x8c64('0xd2')]=0x14;_0x1fb487[_0x8c64('0x6a')]=_0x8c64('0x1b5');_0x1fb487[_0x8c64('0x131')]+=0x1;_0x1fb487[_0x8c64('0xd8')]+=0x1;_0x21e96f=_0x1d6695['dialAgentRejectRetryFrequency'];_0x426df7=_0x1d6695[_0x8c64('0xed')];ami[_0x8c64('0x11c')](_0x8c64('0x1b6'),ut[_0x8c64('0x12e')](_0x29dce5,_0x8c64('0x1b7')));hopperUtils[_0x8c64('0xe7')](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1b8')));if(_0x252b00['checkRetriveMax'](0x14,_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x131')]>=_0x1d6695['dialAgentRejectMaxRetry']){_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,'reason\x2020\x20agentreject');}else{_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x8c64('0x1b9'));}}break;default:_0x1d6695[_0x8c64('0x1ba')]+=0x1;_0x1fb487['state']=0xc;_0x1fb487['statedesc']=_0x182f6f[_0x8c64('0xc6')];_0x21e96f=_0x1d6695[_0x8c64('0x19a')];_0x426df7=_0x1d6695[_0x8c64('0xed')];hopperUtils['createHistory'](_0x1fb487)['catch'](loggerCatch(_0x8c64('0x1bb')));if(_0x252b00[_0x8c64('0x193')](_0x182f6f[_0x8c64('0xc6')],_0x29dce5,_0x1d6695)&&!_0x4410bd){if(_0x1fb487[_0x8c64('0x126')]+_0x1fb487['countcongestionretry']+_0x1fb487[_0x8c64('0x128')]+_0x1fb487[_0x8c64('0x129')]+_0x1fb487[_0x8c64('0xd7')]+_0x1fb487[_0x8c64('0xef')]+_0x1fb487[_0x8c64('0x125')]+_0x1fb487[_0x8c64('0x131')]>=_0x1d6695['dialGlobalMaxRetry']){_0x252b00[_0x8c64('0x12a')](_0x1fb487,_0x416caf,_0x178851,_0x182f6f['reason']);}else{_0x252b00[_0x8c64('0x134')](_0x1fb487,_0x416caf,_0x178851,_0x182f6f[_0x8c64('0xc6')]);}}}})[_0x8c64('0x3d')](function(){if(_0x4410bd){hopperUtils[_0x8c64('0xe9')](_0x1fb487,_0x21e96f,_0x426df7)['then'](function(){return _0x416caf(0x1);});}});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x12a')]=function(_0x4c07ee,_0x1936a2,_0x5808f5,_0x4a41f9){var _0x18dbed=new Final(_0x4c07ee);_0x18dbed[_0x8c64('0xd2')]=0xf;_0x18dbed['statedesc']=_0x8c64('0x1bc');this[_0x8c64('0x134')](_0x18dbed,_0x1936a2,_0x5808f5,_0x4a41f9);};Dialer[_0x8c64('0x1a')]['createStateFinal']=function(_0x4b57d2,_0x5ce168,_0x19cb73,_0x3bc9eb){hopperUtils[_0x8c64('0xcb')](_0x4b57d2)[_0x8c64('0x3d')](function(){return _0x5ce168(msgResponse(_0x8c64('0x19c'),_0x8c64('0x10f'),_0x3bc9eb));})[_0x8c64('0xa1')](function(){return _0x19cb73(msgResponse(_0x8c64('0x1bd'),_0x8c64('0x97'),_0x8c64('0x1be')));});};Dialer['prototype'][_0x8c64('0x9')]=function(_0x4b10c7){var _0xa7a68f=_0x4b10c7[_0x8c64('0x1bf')]/0x64;var _0x3ffa6a=_0x4b10c7[_0x8c64('0xd0')]/(_0x4b10c7[_0x8c64('0xd0')]+_0x4b10c7[_0x8c64('0x117')]);var _0x50f88b=Math['round'](_0x4b10c7[_0x8c64('0x1c0')]*(_0x4b10c7[_0x8c64('0x1c1')]/0x64));var _0x5bb68f=Math['round'](_0x4b10c7[_0x8c64('0x1c0')]*(_0x4b10c7[_0x8c64('0x1c2')]/0x64));var _0x115ce3=_0x4b10c7[_0x8c64('0x140')]+_0x4b10c7['talking'];var _0x1d6136=Math[_0x8c64('0x1c3')](_0x4b10c7['erlangCalls']*_0x4b10c7['erlangAbandonmentRate']*_0x4b10c7[_0x8c64('0x1c4')]*_0x4b10c7[_0x8c64('0x1c5')]);if(_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x2a')])){if(!_['isUndefined'](_0x4b10c7[_0x8c64('0x29')])){_0x4b10c7[_0x8c64('0x29')]=undefined;loggerPredictive[_0x8c64('0x62')](_0x8c64('0x1c6'),_0x8c64('0x1c7'));}if(!_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x60')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x8c64('0x1c8'));clearInterval(_0x4b10c7[_0x8c64('0x60')]);_0x4b10c7[_0x8c64('0x60')]=undefined;}_0x4b10c7[_0x8c64('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8c64('0x48')](_0x4b10c7['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4b10c7[_0x8c64('0x2a')]);this[_0x8c64('0xb3')](_0x4b10c7,0x1);}else if(ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7['startProgressive'])){this['handlePower'](_0x4b10c7,0x1);loggerPredictiveCalls['info'](_0x8c64('0x1ca'),_0x4b10c7[_0x8c64('0x2a')],_0x4b10c7[_0x8c64('0x5e')]);_0x4b10c7[_0x8c64('0x57')]=0x0;_0x4b10c7[_0x8c64('0xd1')]=0x0;}else if(_0xa7a68f<_0x3ffa6a&&_0x4b10c7['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x1cb'),_0x8c64('0x1cc'),_0x3ffa6a,_0x8c64('0x2a'),_0x4b10c7[_0x8c64('0x5e')]);}else if(_0x1d6136<_0x4b10c7[_0x8c64('0xd1')]&&_0x4b10c7[_0x8c64('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x1ce'),_0x8c64('0x1cf'),_0x1d6136,_0x8c64('0x1d0'),_0x4b10c7[_0x8c64('0xd1')],_0x8c64('0x2a'),_0x4b10c7[_0x8c64('0x5e')]);}else if(!ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7[_0x8c64('0x2a')])&&_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x29')])&&!_[_0x8c64('0x3f')](_0x4b10c7[_0x8c64('0x2a')])){_0x4b10c7['startPredictive']=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d1'),_0x4b10c7['startPredictive']);hopperUtils['avgHandleTime'](_0x4b10c7[_0x8c64('0x1c9')])[_0x8c64('0x3d')](this[_0x8c64('0x1d2')](_0x4b10c7))[_0x8c64('0x3d')](mergeDataErlangB(_0x4b10c7))['then'](this[_0x8c64('0x1d3')](_0x4b10c7))[_0x8c64('0xa1')](loggerCatchPredictive(_0x8c64('0x1d4'),_0x4b10c7));}else if(!ifInterval(_0x4b10c7[_0x8c64('0x1c9')],_0x4b10c7[_0x8c64('0x29')])){_0x4b10c7[_0x8c64('0xd1')]=0x0;_0x4b10c7[_0x8c64('0x29')]=moment()[_0x8c64('0x44')](_0x8c64('0xc4'));loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d5'),_0x4b10c7[_0x8c64('0x29')]);clearInterval(_0x4b10c7[_0x8c64('0x60')]);_0x4b10c7[_0x8c64('0x60')]=undefined;hopperUtils[_0x8c64('0x1d6')](_0x4b10c7[_0x8c64('0x1c9')])['then'](this['getDataPredictive'](_0x4b10c7))[_0x8c64('0x3d')](mergeDataErlangB(_0x4b10c7))[_0x8c64('0x3d')](this['startMethodPredictive'](_0x4b10c7))[_0x8c64('0xa1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4b10c7));}else if(_0x4b10c7[_0x8c64('0x1c0')]&&_0x115ce3<_0x4b10c7['predictiveIntervalAvailable']-_0x5bb68f){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d7'),_0x115ce3,_0x8c64('0x1d8'),_0x4b10c7['predictiveIntervalAvailable'],'-',_0x5bb68f,'=',_0x4b10c7[_0x8c64('0x1c0')]-_0x5bb68f,')');}else if(_0x4b10c7[_0x8c64('0x1c0')]&&_0x115ce3>_0x4b10c7[_0x8c64('0x1c0')]+_0x50f88b){clearPredictiveAttributes(_0x4b10c7);loggerPredictive[_0x8c64('0x48')](_0x4b10c7[_0x8c64('0x5e')],_0x8c64('0x1d7'),_0x115ce3,_0x8c64('0x1d9'),_0x4b10c7[_0x8c64('0x1c0')],'+',_0x50f88b,'=',_0x4b10c7[_0x8c64('0x1c0')]+_0x50f88b,')');}};Dialer['prototype'][_0x8c64('0x1d2')]=function(_0x31752f){var _0x4efd8c=this;return function(_0x4964c6){return new Promise(function(_0x280656,_0xb89f0b){_[_0x8c64('0xfd')](_0x31752f,_0x4964c6[0x0]);if(checkGetDataPredictive(_0x4964c6[0x0])){var _0x52d204=_0x31752f['predictiveIntervalAvailable']=_0x31752f['talking']+_0x31752f[_0x8c64('0x140')];var _0x28e154=_0x31752f['dialPredictiveInterval']*0x3c;var _0x57a820=_0x4964c6[0x0][_0x8c64('0x52')]+_0x4964c6[0x0][_0x8c64('0x50')];var _0x353d95=(_0x4964c6[0x0][_0x8c64('0x4c')]+_0x4964c6[0x0][_0x8c64('0x4d')]+_0x4964c6[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4964c6[0x0][_0x8c64('0x4a')];_0x31752f[_0x8c64('0x1c4')]=_0x353d95>0x0?_0x353d95:0x1;switch(_0x31752f[_0x8c64('0x1cd')]){case _0x8c64('0x1da'):var _0x3cf63=_0x31752f[_0x8c64('0x1bf')]/0x64;return _0x4efd8c[_0x8c64('0x1db')](_0x52d204,_0x28e154,_0x57a820,_0x353d95,_0x3cf63)[_0x8c64('0x3d')](function(_0x146682){return _0x280656(_0x146682);});case _0x8c64('0x1dc'):var _0x3a9dc6=_0x31752f['dialPredictiveOptimizationPercentage']/0x64;return _0x4efd8c[_0x8c64('0x1dd')](_0x52d204,_0x28e154,_0x57a820,_0x353d95,_0x3a9dc6)[_0x8c64('0x3d')](function(_0x200042){return _0x280656(_0x200042);});default:return _0xb89f0b(msgResponse('[getDataPredictive]','Failure',_0x8c64('0x1de')));}}else{return _0xb89f0b(msgResponse(_0x8c64('0x1df'),_0x8c64('0x97'),_0x8c64('0x1e0')));}});};};Dialer[_0x8c64('0x1a')][_0x8c64('0x1e1')]=function(_0xd0329d){var _0x55f2d0=this;return function(_0xbd19e7){return new Promise(function(_0x5d7f12,_0x57df02){_[_0x8c64('0xfd')](_0xd0329d,_0xbd19e7[0x0]);if(checkGetDataPredictive(_0xbd19e7[0x0])){loggerPredictive['info'](JSON[_0x8c64('0x6f')](_0xbd19e7[0x0]));if(_0xd0329d[_0x8c64('0x1cd')]===_0x8c64('0x1da')){return _0x55f2d0[_0x8c64('0x156')](_0xd0329d['id'])[_0x8c64('0x3d')](function(_0x3f69ee){var _0x238e4e=_0xd0329d[_0x8c64('0x1e2')]-_0x3f69ee[0x0]['outboundQueuePauses'];var _0x70a27a=_0xd0329d[_0x8c64('0x1c9')]*0x3c;var _0x56e2a4=_0xbd19e7[0x0][_0x8c64('0x52')]+_0xbd19e7[0x0][_0x8c64('0x50')];var _0x1f4a2e=(_0xbd19e7[0x0]['predictiveIntervalAnsweredCalls']+_0xbd19e7[0x0][_0x8c64('0x4d')]+_0xbd19e7[0x0][_0x8c64('0x4f')])/_0xbd19e7[0x0][_0x8c64('0x4a')];var _0x1d2af2=_0xd0329d[_0x8c64('0x1bf')]/0x64;_0xd0329d[_0x8c64('0x1e3')]=_0x3f69ee[0x0][_0x8c64('0x1e4')]||0x0;_0xd0329d['predictiveIntervalHitRate']=_0x1f4a2e>0x0?_0x1f4a2e:0x1;return _0x55f2d0['abandonmentRate'](_0x238e4e,_0x70a27a,_0x56e2a4,_0x1f4a2e,_0x1d2af2);})[_0x8c64('0x3d')](function(_0x3537f5){return _0x5d7f12(_0x3537f5);})[_0x8c64('0xa1')](function(_0x415612){return _0x57df02(msgResponse('[CatchErlangB]',_0x8c64('0x97'),JSON[_0x8c64('0x6f')](_0x415612)));});}if(_0xd0329d[_0x8c64('0x1cd')]===_0x8c64('0x1dc')){return _0x55f2d0[_0x8c64('0x156')](_0xd0329d['id'])[_0x8c64('0x3d')](function(_0x425031){var _0x35fb73=_0xd0329d[_0x8c64('0x1e2')]-_0x425031[0x0][_0x8c64('0x1e4')];var _0x292c2f=_0xd0329d[_0x8c64('0x1c9')]*0x3c;var _0x3b3b02=_0xbd19e7[0x0][_0x8c64('0x52')]+_0xbd19e7[0x0][_0x8c64('0x50')];var _0x2b7836=(_0xbd19e7[0x0][_0x8c64('0x4c')]+_0xbd19e7[0x0][_0x8c64('0x4d')]+_0xbd19e7[0x0][_0x8c64('0x4f')])/_0xbd19e7[0x0][_0x8c64('0x4a')];var _0x371765=_0xd0329d[_0x8c64('0x1bf')]/0x64;_0xd0329d['predictiveIntervalPauses']=_0x425031[0x0][_0x8c64('0x1e4')]||0x0;_0xd0329d[_0x8c64('0x1c4')]=_0x2b7836>0x0?_0x2b7836:0x1;return _0x55f2d0['busyFactor'](_0x35fb73,_0x292c2f,_0x3b3b02,_0x2b7836,_0x371765);})[_0x8c64('0x3d')](function(_0x43247e){return _0x5d7f12(_0x43247e);})[_0x8c64('0xa1')](function(_0xa5414){return _0x57df02(msgResponse(_0x8c64('0x1e5'),_0x8c64('0x97'),JSON[_0x8c64('0x6f')](_0xa5414)));});}}else{return _0x57df02(msgResponse(_0x8c64('0x1df'),'Failure',_0x8c64('0x1e0')));}});};};Dialer['prototype'][_0x8c64('0x1d3')]=function(_0x26842e){var _0x52eead=this;return function(){var _0x2f7213=0x0;var _0xb43513=Math[_0x8c64('0x1c3')](_0x26842e['erlangCallToSecond']*0x3e8);if(_0xb43513>0x0){_0xb43513=_0xb43513<0x64?0x64:_0xb43513;loggerPredictive[_0x8c64('0x48')](_0x26842e[_0x8c64('0x5e')],_0x8c64('0x1e6'),_0xb43513,'milliseconds');_0x26842e[_0x8c64('0x60')]=setInterval(function(){_0x52eead['handlePredictive'](_0x26842e);loggerPredictiveCalls[_0x8c64('0x48')](_0x8c64('0x1e7'),_0x2f7213+=0x1);},_0xb43513);}else{loggerPredictive[_0x8c64('0x48')](_0x26842e['name'],_0x8c64('0x1e8'));}};};Dialer[_0x8c64('0x1a')]['checkContactBlack']=function(_0x339c2b,_0x5e9c69){var _0x49696e=this;return function(_0x39f6e4){if(_['isEmpty'](_0x39f6e4)){if(_[_0x8c64('0xfc')](_0x5e9c69[_0x8c64('0x15a')])||!_0x5e9c69[_0x8c64('0x1e9')]){if(_0x339c2b[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x339c2b[_0x8c64('0x6c')]=_['isUndefined'](_0x339c2b[_0x8c64('0x6c')])?!![]:_0x339c2b['queueStatusComplete'];var _0x2cbdcd=uuid['v4']();_0x49696e[_0x8c64('0x25')][_0x2cbdcd]=new Action(_0x339c2b,_0x5e9c69,_0x2cbdcd);loggerBooked[_0x8c64('0x48')](_0x8c64('0x1ea'),_0x2cbdcd,_0x8c64('0x1eb'),JSON[_0x8c64('0x6f')](_0x339c2b[_0x8c64('0x6c')]),_0x8c64('0x1ec'),_0x339c2b[_0x8c64('0x5e')]);if(_0x339c2b[_0x8c64('0x6c')]){_0x339c2b['queueStatusComplete']=![];_0x49696e[_0x8c64('0x2b')][_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['queue']]=[];ami[_0x8c64('0x9c')]({'actionid':_0x2cbdcd,'action':'queuestatus','queue':_0x339c2b[_0x8c64('0x5e')]})[_0x8c64('0xa1')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);hopperUtils[_0x8c64('0x108')]({'active':![],'ContactId':_0x49696e['actions'][_0x2cbdcd]['ContactId'],'ListId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['ListId'],'VoiceQueueId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe3')]||undefined,'CampaignId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd]['CampaignId']||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1ed')));delete _0x49696e[_0x8c64('0x25')][_0x2cbdcd];});}else{loggerBooked['info'](_0x8c64('0x1ee'),JSON[_0x8c64('0x6f')](_0x339c2b['queueStatusComplete']),_0x8c64('0x1ec'),_0x339c2b['name']);_0x49696e['updateOriginated'](_0x339c2b);hopperUtils[_0x8c64('0x108')]({'active':![],'ContactId':_0x49696e['actions'][_0x2cbdcd][_0x8c64('0xe1')],'ListId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe2')],'VoiceQueueId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe3')]||undefined,'CampaignId':_0x49696e[_0x8c64('0x25')][_0x2cbdcd][_0x8c64('0xe4')]||undefined})[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1ed')));delete _0x49696e[_0x8c64('0x25')][_0x2cbdcd];}}else{return _0x49696e[_0x8c64('0x15f')](_0x339c2b,_0x5e9c69);}}else{if(utils['getSeconds'](undefined,_0x5e9c69['scheduledat'])<_0x339c2b[_0x8c64('0x1ef')]*0x3c){if(_0x5e9c69[_0x8c64('0x1f0')]&&!_0x5e9c69[_0x8c64('0x1f0')][_0x8c64('0x1f1')]){_0x49696e['preview'][_0x8c64('0x105')](_0x5e9c69['id'])[_0x8c64('0x1d')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);});}else{hopperUtils[_0x8c64('0x1f2')]({'active':![]},_0x5e9c69['id'],0x1)[_0x8c64('0x1d')](function(){_0x49696e[_0x8c64('0xc2')](_0x339c2b);});}}else{_0x339c2b[_0x8c64('0x1f3')]+=0x1;_0x49696e[_0x8c64('0xc2')](_0x339c2b);if(_0x339c2b['dialRecallInQueue']){hopperUtils[_0x8c64('0x108')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e9c69[_0x8c64('0xe1')],'ListId':_0x5e9c69[_0x8c64('0xe2')],'VoiceQueueId':_0x5e9c69[_0x8c64('0xe3')]||undefined,'CampaignId':_0x5e9c69[_0x8c64('0xe4')]||undefined})['catch'](loggerCatch(_0x8c64('0x1f4')));hopperUtils['createHistory'](createObjHistory(_0x339c2b,_0x5e9c69,utils[_0x8c64('0x67')][_0x8c64('0x1f5')],0x17,_0x8c64('0x1f6')))[_0x8c64('0xa1')](loggerCatch(_0x8c64('0x1f7')));}else{_0x49696e['saveInDb'](createObjHistory(_0x339c2b,_0x5e9c69,utils['CAMPAIGN_STATUS'][_0x8c64('0x1f8')],0x16,'RecallFailedTimeout'),_0x8c64('0x1f9'),_0x8c64('0x1fa'));}}}}else{_0x339c2b['outboundBlacklistCallsDay']+=0x1;_0x49696e[_0x8c64('0x11f')](createObjHistory(_0x339c2b,_0x5e9c69,utils[_0x8c64('0x67')][_0x8c64('0x1fb')],0xd,_0x8c64('0x1fc')),'[Originate][historyBlacklist]',_0x8c64('0x1fd'));throw'inBlackList';}};};Dialer[_0x8c64('0x1a')][_0x8c64('0x15e')]=function(_0x2211bb){var _0x8744e0=this;var _0x54ecdd=_0x2211bb[_0x8c64('0x1fe')]-_0x2211bb['originated']-_0x2211bb[_0x8c64('0x1ff')];emitCampaignSummary(_0x2211bb);if(_0x54ecdd>0x0){if(_0x54ecdd>this[_0x8c64('0x23')]){_0x54ecdd=this[_0x8c64('0x23')];}_0x2211bb[_0x8c64('0x1ff')]+=_0x54ecdd;hopperUtils[_0x8c64('0x200')](_0x2211bb['id'],_0x54ecdd,_0x2211bb[_0x8c64('0x201')],_0x2211bb)[_0x8c64('0x3d')](function(_0x1ae46a){_0x2211bb[_0x8c64('0x1ff')]-=_0x54ecdd;_0x2211bb['temp']=_0x2211bb[_0x8c64('0x1ff')]>0x0?_0x2211bb['temp']:0x0;if(!utils[_0x8c64('0x202')](_0x1ae46a)){_0x2211bb[_0x8c64('0x66')]=utils[_0x8c64('0x67')][_0x8c64('0x69')];logger[_0x8c64('0x48')](_0x8c64('0x203')+_0x2211bb[_0x8c64('0x5e')]);}else{_0x2211bb[_0x8c64('0x7c')]+=_0x1ae46a[_0x8c64('0x9a')];_0x2211bb['message']=utils[_0x8c64('0x67')][_0x8c64('0x204')];for(var _0x154b87=0x0;_0x154b87<_0x1ae46a['length'];_0x154b87+=0x1){_0x2211bb[_0x8c64('0x205')]+=0x1;if(_[_0x8c64('0xfc')](_0x1ae46a[_0x154b87])||_['isNil'](_0x1ae46a[_0x154b87][_0x8c64('0x179')])||_[_0x8c64('0xfc')](_0x1ae46a[_0x154b87][_0x8c64('0x189')])){_0x8744e0[_0x8c64('0x158')]('[actionOriginate]\x20',_0x2211bb,_0x1ae46a[_0x154b87]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x8c64('0x70')](_0x1ae46a[_0x154b87],[_0x8c64('0xe4'),'phone']))[_0x8c64('0x3d')](_0x8744e0[_0x8c64('0x206')](_0x2211bb,_0x1ae46a[_0x154b87]))['catch'](_0x8744e0[_0x8c64('0x157')]('[actionOriginateIvr]\x20',_0x2211bb));}}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactCampaign2]',_0x2211bb,_0x54ecdd));}};Dialer[_0x8c64('0x1a')][_0x8c64('0xb3')]=function(_0x3d6042,_0x6584ce){var _0x4d05b3=this;var _0x535f7d=[];if(_0x6584ce<0x1||_0x3d6042[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x6584ce=0x1;}var _0x4a121c=Math[_0x8c64('0x1c3')](_0x3d6042[_0x8c64('0x140')]*_0x6584ce)-_0x3d6042[_0x8c64('0x7c')]-_0x3d6042[_0x8c64('0x1ff')];if(_0x3d6042[_0x8c64('0x207')]>0x0){var _0x1a715f=_0x3d6042[_0x8c64('0x207')]-_0x3d6042[_0x8c64('0x7c')]-_0x3d6042['talking']-_0x3d6042[_0x8c64('0x1ff')]-_0x3d6042[_0x8c64('0x143')];if(_0x4a121c>_0x1a715f){_0x4a121c=_0x1a715f;}}if(_0x4a121c>0x0){if(_0x3d6042[_0x8c64('0xb1')]===_0x8c64('0x8')){_0x4a121c=0x1;}if(_0x4a121c>this[_0x8c64('0x23')]){_0x4a121c=this[_0x8c64('0x23')];}_0x3d6042[_0x8c64('0x1ff')]+=_0x4a121c;for(var _0x576998 in this[_0x8c64('0x21')]){if(typeof this[_0x8c64('0x21')][_0x576998]!=='undefined'){if(this[_0x8c64('0x21')][_0x576998][_0x8c64('0xd2')]===_0x8c64('0x208')&&this['agents'][_0x576998]['status']==='reachable'){_0x535f7d[_0x8c64('0x9b')](this[_0x8c64('0x21')][_0x576998]['id']);}}}hopperUtils[_0x8c64('0x209')](_0x3d6042,_0x535f7d,_0x4a121c)[_0x8c64('0x3d')](function(_0x27ddca){_0x3d6042['temp']-=_0x4a121c;_0x3d6042['temp']=_0x3d6042[_0x8c64('0x1ff')]>0x0?_0x3d6042['temp']:0x0;if(!utils[_0x8c64('0x202')](_0x27ddca)){hopperUtils[_0x8c64('0x20a')](_0x3d6042)['then'](sendMessageReschedule(_0x3d6042))[_0x8c64('0xa1')](loggerCatch('[countReScheduled]\x20'));}else{_0x3d6042[_0x8c64('0x7c')]+=_0x27ddca[_0x8c64('0x9a')];_0x3d6042[_0x8c64('0x66')]=_0x3d6042['dialMethod']==='booked'?utils[_0x8c64('0x67')][_0x8c64('0x144')]:utils[_0x8c64('0x67')][_0x8c64('0x204')];for(var _0x322b24=0x0;_0x322b24<_0x27ddca['length'];_0x322b24+=0x1){if(_['isNil'](_0x27ddca[_0x322b24])||_[_0x8c64('0xfc')](_0x27ddca[_0x322b24][_0x8c64('0x179')])||_[_0x8c64('0xfc')](_0x27ddca[_0x322b24]['phone'])){_0x4d05b3[_0x8c64('0x158')](_0x8c64('0x20b'),_0x3d6042,_0x27ddca[_0x322b24]);}else{hopperUtils['checkIsBlackList'](_[_0x8c64('0x70')](_0x27ddca[_0x322b24],[_0x8c64('0xe3'),_0x8c64('0x189')]))[_0x8c64('0x3d')](_0x4d05b3['checkContactBlack'](_0x3d6042,_0x27ddca[_0x322b24]))[_0x8c64('0xa1')](_0x4d05b3[_0x8c64('0x157')](_0x8c64('0x20b'),_0x3d6042));}}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactDialer2]',_0x3d6042,_0x4a121c));}};Dialer[_0x8c64('0x1a')][_0x8c64('0x60')]=function(_0x1747f7){if(_0x1747f7[_0x8c64('0x207')]>0x0){var _0x4ace64=_0x1747f7[_0x8c64('0x207')]-_0x1747f7['originated']-_0x1747f7[_0x8c64('0x142')];if(_0x4ace64>0x0){this['tryOriginatePredictive'](_0x1747f7);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x1747f7);}};Dialer[_0x8c64('0x1a')]['tryOriginatePredictive']=function(_0x5564fa){var _0x3bd91f=this;var _0x48453a=[];_0x5564fa[_0x8c64('0x7c')]+=0x1;for(var _0x4f52d8 in this['agents']){if(typeof this[_0x8c64('0x21')][_0x4f52d8]!==_0x8c64('0xad')){if(this['agents'][_0x4f52d8][_0x8c64('0xd2')]===_0x8c64('0x208')&&this[_0x8c64('0x21')][_0x4f52d8]['status']===_0x8c64('0x87')){_0x48453a[_0x8c64('0x9b')](this[_0x8c64('0x21')][_0x4f52d8]['id']);}}}return this[_0x8c64('0x209')](_0x5564fa['id'],_0x48453a,0x1,_0x5564fa['dialOrderByScheduledAt'],_0x5564fa)[_0x8c64('0x3d')](function(_0x2e2d26){if(!utils[_0x8c64('0x202')](_0x2e2d26)){utils[_0x8c64('0x64')](_0x5564fa,0x1,0x0);return hopperUtils[_0x8c64('0x20a')](_0x5564fa)[_0x8c64('0x3d')](sendMessageReschedule(_0x5564fa))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5564fa[_0x8c64('0x66')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_['isNil'](_0x2e2d26[0x0])||_['isNil'](_0x2e2d26[0x0][_0x8c64('0x179')])||_['isNil'](_0x2e2d26[0x0][_0x8c64('0x189')])){_0x3bd91f[_0x8c64('0x158')](_0x8c64('0x20b'),_0x5564fa,_0x2e2d26[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x8c64('0x70')](_0x2e2d26[0x0],['VoiceQueueId',_0x8c64('0x189')]))[_0x8c64('0x3d')](_0x3bd91f[_0x8c64('0x206')](_0x5564fa,_0x2e2d26[0x0]))[_0x8c64('0xa1')](_0x3bd91f[_0x8c64('0x157')](_0x8c64('0x20c'),_0x5564fa));}}})[_0x8c64('0xa1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5564fa,0x1));};Dialer['prototype'][_0x8c64('0x1db')]=function(_0x4bd55e,_0x3dc5a9,_0x483b51,_0x1b99ee,_0x2dd838,_0x309303){loggerPredictive['info'](_0x8c64('0x20d'));loggerPredictive['info'](_0x8c64('0x20e'),_0x4bd55e);loggerPredictive[_0x8c64('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3dc5a9);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x20f'),_0x483b51);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x210'),_0x1b99ee);loggerPredictive['info'](_0x8c64('0x211'),_0x2dd838);loggerPredictive[_0x8c64('0x48')]('---------------------------');return new Promise(function(_0x30ea3e,_0x49309e){if(_0x4bd55e<=0x0||isNaN(_0x4bd55e)){return _0x49309e(msgResponse(_0x8c64('0x212'),_0x8c64('0x82'),_0x8c64('0x213')+_0x4bd55e));}if(_0x483b51<=0x0||isNaN(_0x483b51)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error',_0x8c64('0x214')+_0x483b51));}if(_0x1b99ee<=0x0||isNaN(_0x1b99ee)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error',_0x8c64('0x215')+_0x1b99ee));}if(_0x3dc5a9<=0x0||isNaN(_0x3dc5a9)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error','interval\x20=\x20'+_0x3dc5a9));}if(_0x2dd838<=0x0||isNaN(_0x2dd838)){return _0x49309e(msgResponse(_0x8c64('0x212'),'Error','Amax\x20=\x20'+_0x2dd838));}_0x309303=_0x309303||0x0;var _0x42d38a=0x1/_0x483b51;var _0x17f49d=0x0;var _0x4a362e=0x0;var _0x5e7bc3=0x0;var _0x1afdeb=0x0;for(var _0x49ba3b=0x0;_0x5e7bc3<_0x2dd838;_0x49ba3b+=0x1){_0x4a362e=_0x49ba3b/_0x3dc5a9;_0x17f49d=(_0x1b99ee*_0x4a362e+_0x309303)/_0x42d38a;_0x5e7bc3=utils[_0x8c64('0x216')](_0x17f49d,_0x4bd55e);_0x1afdeb=_0x17f49d/_0x4bd55e*(0x1-utils[_0x8c64('0x216')](_0x17f49d,_0x4bd55e));}return _0x30ea3e({'erlangCalls':_0x49ba3b,'erlangCallToSecond':_0x3dc5a9/_0x49ba3b,'erlangAbandonmentRate':_0x5e7bc3,'erlangBusyFactor':_0x1afdeb});});};Dialer[_0x8c64('0x1a')][_0x8c64('0x1dd')]=function(_0x305039,_0x1b3f32,_0x2db6f1,_0x3cb536,_0x915332,_0x1a8fa8){loggerPredictive['info'](_0x8c64('0x217'));loggerPredictive[_0x8c64('0x48')](_0x8c64('0x20e'),_0x305039);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x218'),_0x1b3f32);loggerPredictive[_0x8c64('0x48')]('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',_0x2db6f1);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x210'),_0x3cb536);loggerPredictive[_0x8c64('0x48')](_0x8c64('0x219'),_0x915332);loggerPredictive['info'](_0x8c64('0x53'));return new Promise(function(_0x2e2401,_0x301022){if(_0x305039<=0x0||isNaN(_0x305039)){return _0x301022(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x305039));}if(_0x2db6f1<=0x0||isNaN(_0x2db6f1)){return _0x301022(msgResponse('[busyFactor]',_0x8c64('0x82'),_0x8c64('0x214')+_0x2db6f1));}if(_0x3cb536<=0x0||isNaN(_0x3cb536)){return _0x301022(msgResponse(_0x8c64('0x21a'),_0x8c64('0x82'),'p\x20=\x20'+_0x3cb536));}if(_0x1b3f32<=0x0||isNaN(_0x1b3f32)){return _0x301022(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x1b3f32));}if(_0x915332<=0x0||isNaN(_0x915332)){return _0x301022(msgResponse(_0x8c64('0x21a'),_0x8c64('0x82'),_0x8c64('0x21b')+_0x915332));}_0x1a8fa8=_0x1a8fa8||0x0;var _0x2b2247=0x1/_0x2db6f1;var _0x354f57=0x0;var _0xea2e81=0x0;var _0x5da1c4=0x0;var _0x4cdc5b=0x0;for(var _0x23fc29=0x0;_0x4cdc5b<_0x915332;_0x23fc29+=0x1){_0xea2e81=_0x23fc29/_0x1b3f32;_0x354f57=(_0x3cb536*_0xea2e81+_0x1a8fa8)/_0x2b2247;_0x5da1c4=utils[_0x8c64('0x216')](_0x354f57,_0x305039);_0x4cdc5b=_0x354f57/_0x305039*(0x1-utils[_0x8c64('0x216')](_0x354f57,_0x305039));}return _0x2e2401({'erlangCalls':_0x23fc29,'erlangCallToSecond':_0x1b3f32/_0x23fc29,'erlangAbandonmentRate':_0x5da1c4,'erlangBusyFactor':_0x4cdc5b});});};module['exports']=Dialer; \ No newline at end of file +var _0xea57=['voiceQueue','countdropretry','additional','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','countabandonedretry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','ListId','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','value','HangupInAMD','membername','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr]','countnoanswerretry','countagentrejectretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','reachable','map','Agent','loopClearZombieChannels','clearZombieChannels','undefined','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','loggedIn','[CatchErlangB]','outboundQueuePauses','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[getContactDialerPredictive]','--------\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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','trunks','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','command','iftime\x20%s,%s','interval','content','indexOf','catch','Action','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','sendMessageOneNotActive','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','dialPowerLevel','handlePower','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea57,0x146));var _0x7ea5=function(_0x1d6fda,_0x12310d){_0x1d6fda=_0x1d6fda-0x0;var _0x5ca253=_0xea57[_0x1d6fda];return _0x5ca253;};'use strict';var util=require(_0x7ea5('0x0'));var _=require(_0x7ea5('0x1'));var uuid=require(_0x7ea5('0x2'));var moment=require(_0x7ea5('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x7ea5('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x7ea5('0x5'));var config=require(_0x7ea5('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x7ea5('0x7'))(_0x7ea5('0x8'));var loggerPredictive=require(_0x7ea5('0x7'))(_0x7ea5('0x9'));var loggerPredictiveCalls=require(_0x7ea5('0x7'))(_0x7ea5('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x7ea5('0xb'));config[_0x7ea5('0xc')]=_[_0x7ea5('0xd')](config[_0x7ea5('0xc')],{'host':_0x7ea5('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7ea5('0xc')]));var cmHopper=require(_0x7ea5('0xf'));var voiceQueueRt=require(_0x7ea5('0x10'));var RpcSetting=require(_0x7ea5('0x11'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x7ea5('0x12'));var Final=require(_0x7ea5('0x13'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x7ea5('0x14'));var ipAgi=process[_0x7ea5('0x15')][_0x7ea5('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7ea5('0x17')][_0x7ea5('0x18')]=function(_0x257a15){this[_0x7ea5('0x19')]=this[_0x7ea5('0x19')]?this[_0x7ea5('0x19')][_0x7ea5('0x1a')](_0x257a15):_0x257a15();};function Dialer(_0x596cc8,_0x3df62c){this[_0x7ea5('0x1b')]=new Sequence();this[_0x7ea5('0x1c')]=_0x3df62c;this[_0x7ea5('0x1d')]=_0x596cc8[_0x7ea5('0x1d')];this[_0x7ea5('0x1e')]=_0x596cc8[_0x7ea5('0x1e')];this[_0x7ea5('0x1f')]=_0x596cc8['agents'];this['trunks']=_0x596cc8['trunks'];this[_0x7ea5('0x20')]=config['maxNumberOriginate']||0x2;this[_0x7ea5('0x21')]={};this[_0x7ea5('0x22')]={};this[_0x7ea5('0x23')]={};this[_0x7ea5('0x24')]={};this[_0x7ea5('0x25')]={};this[_0x7ea5('0x26')]={};this[_0x7ea5('0x27')]={};this[_0x7ea5('0x28')]={};this[_0x7ea5('0x29')]={};this[_0x7ea5('0x2a')]={};this['queuesSummary']={};ami['on'](_0x7ea5('0x2b'),this[_0x7ea5('0x2c')][_0x7ea5('0x2d')](this));ami['on']('queuecallerabandon',this[_0x7ea5('0x2e')][_0x7ea5('0x2d')](this));ami['on'](_0x7ea5('0x2f'),this[_0x7ea5('0x30')][_0x7ea5('0x2d')](this));ami['on'](_0x7ea5('0x31'),this[_0x7ea5('0x32')][_0x7ea5('0x2d')](this));ami['on'](_0x7ea5('0x33'),this[_0x7ea5('0x34')][_0x7ea5('0x2d')](this));ami['on']('custom:queuesummarycomplete',this[_0x7ea5('0x35')][_0x7ea5('0x2d')](this));ami['on'](_0x7ea5('0x36'),this[_0x7ea5('0x37')][_0x7ea5('0x2d')](this));ami['on'](_0x7ea5('0x38'),this[_0x7ea5('0x39')]['bind'](this));ami['on']('varset',this[_0x7ea5('0x3a')]['bind'](this));ami['on'](_0x7ea5('0x3b'),this[_0x7ea5('0x3c')][_0x7ea5('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x7ea5('0x3d')][_0x7ea5('0x2d')](this));this[_0x7ea5('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0x7ea5('0x3f')]()[_0x7ea5('0x40')](function(_0x1c00ae){previewRecallmeReminderInterval=_0x1c00ae['previewRecallmeReminderInterval'];});}function isNotNull(_0x352b0e){return _0x352b0e!==null&&!_[_0x7ea5('0x41')](_0x352b0e);}function msgResponse(_0x3149e0,_0x268ca4,_0xc1bdb){return{'action':_0x3149e0,'response':_0x268ca4,'message':_0xc1bdb,'stack':_0xc1bdb};}function emit(_0x5cf505,_0x15cad6,_0xf008f4){io['to'](_0x5cf505)['emit'](_0x15cad6,_0xf008f4);}function emitOutboundVoiceQueueSummary(_0x2f0550){if(_0x2f0550[_0x7ea5('0x42')]===_0x7ea5('0x43')){logger[_0x7ea5('0x44')](_0x7ea5('0x45'),util[_0x7ea5('0x46')](_0x2f0550,{'showHidden':![],'depth':null}));emit(util[_0x7ea5('0x47')]('voice:queue:%s',_0x2f0550[_0x7ea5('0x48')]),_0x7ea5('0x49'),_0x2f0550);}}function checkGetDataPredictive(_0x172cb1){if(isNotNull(_0x172cb1)&&!_['isEmpty'](_0x172cb1)){loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x4b'));loggerPredictive[_0x7ea5('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x172cb1[_0x7ea5('0x4c')]);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x4d'),_0x172cb1[_0x7ea5('0x4e')]);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x4f'),_0x172cb1[_0x7ea5('0x50')]);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x51'),_0x172cb1[_0x7ea5('0x52')]);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x53'),_0x172cb1[_0x7ea5('0x54')]);loggerPredictive['info'](_0x7ea5('0x55'),_0x172cb1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7ea5('0x4a')]('---------------------------');if(_0x172cb1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x7ea5('0x41')](_0x172cb1[_0x7ea5('0x56')])&&_0x172cb1[_0x7ea5('0x56')]>0x0){return!![];}loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x57'));if(!_['isUndefined'](_0x172cb1['predictiveIntervalAvgHoldtime'])&&_0x172cb1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x58'));}else{loggerPredictive[_0x7ea5('0x4a')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x7ea5('0x59'));}return![];}function mergeDataErlangB(_0x5ff9d){return function(_0x3f3be4){loggerPredictive['info'](_0x7ea5('0x5a'));loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x5b'),_0x3f3be4['erlangCalls']);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x5c'),_0x3f3be4[_0x7ea5('0x5d')]);loggerPredictive[_0x7ea5('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f3be4[_0x7ea5('0x5e')]);loggerPredictive[_0x7ea5('0x4a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f3be4[_0x7ea5('0x5f')]);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x60'),_0x3f3be4['erlangAbandonmentRate']);loggerPredictive['info'](_0x7ea5('0x61'));_[_0x7ea5('0x62')](_0x5ff9d,_0x3f3be4);};}function ifInterval(_0x5c2d6c,_0x2c376d){if(_[_0x7ea5('0x41')](_0x2c376d)){return![];}return utils[_0x7ea5('0x63')](undefined,_0x2c376d)<_0x5c2d6c*0x3c;}function clearPredictiveAttributes(_0x465c5a){if(_0x465c5a[_0x7ea5('0x27')]){_0x465c5a[_0x7ea5('0x27')]=undefined;loggerPredictive[_0x7ea5('0x44')](_0x465c5a['name'],_0x7ea5('0x64'));}if(_0x465c5a[_0x7ea5('0x26')]){_0x465c5a[_0x7ea5('0x26')]=undefined;loggerPredictive['debug'](_0x465c5a[_0x7ea5('0x48')],_0x7ea5('0x65'));}if(_0x465c5a['handlePredictive']){clearInterval(_0x465c5a[_0x7ea5('0x66')]);_0x465c5a[_0x7ea5('0x66')]=undefined;loggerPredictive[_0x7ea5('0x44')](_0x465c5a[_0x7ea5('0x48')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0xd239ea,_0x5311d1){return function(_0x18b417){loggerPredictive[_0x7ea5('0x67')](_0x5311d1[_0x7ea5('0x48')],_0xd239ea);loggerPredictive[_0x7ea5('0x67')](_0x18b417[_0x7ea5('0x68')]);clearPredictiveAttributes(_0x5311d1);};}function loggerCatch(_0x337f32){return function(_0x4ff685){logger['error'](_0x337f32,util[_0x7ea5('0x46')](_0x4ff685,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x46f630,_0x2c6b5f,_0x5e2179){return function(_0x3c550c){utils[_0x7ea5('0x69')](_0x2c6b5f,_0x5e2179,0x0);logger[_0x7ea5('0x67')](_0x46f630,util[_0x7ea5('0x46')](_0x3c550c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b5711){return function(_0x2dfb6f){if(isNotNull(_0x2dfb6f)&&isNotNull(_0x2dfb6f[0x0])){if(_0x2dfb6f[0x0][_0x7ea5('0x6a')]>0x0){_0x2b5711[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x6d')];logger[_0x7ea5('0x4a')](_0x7ea5('0x6e')+_0x2b5711[_0x7ea5('0x48')],_0x2dfb6f[0x0][_0x7ea5('0x6a')],_0x7ea5('0x6f'));}else{_0x2b5711[_0x7ea5('0x6b')]=utils['CAMPAIGN_STATUS'][_0x7ea5('0x70')];logger[_0x7ea5('0x4a')](_0x7ea5('0x71')+_0x2b5711[_0x7ea5('0x48')]);}}};}function createObjHistory(_0xca7a8c,_0x341291,_0x71b2e0,_0x7f1998,_0x1f7cfb){_0xca7a8c[_0x7ea5('0x6b')]=_0x71b2e0;var _0x174918=new Action(_0xca7a8c,_0x341291);var _0x311604=new History(_0x174918);_0x311604[_0x7ea5('0x72')]=_0x7f1998;_0x311604['statedesc']=_0x1f7cfb;_0x311604[_0x7ea5('0x73')]=_0x174918['starttime'];return _0x311604;}function unlockQueueStatus(_0x1ca243,_0x40827d){setTimeout(function(){if(_[_0x7ea5('0x41')](_0x1ca243[_0x7ea5('0x74')])){loggerBooked[_0x7ea5('0x67')](_0x7ea5('0x75'),_0x40827d);}_0x1ca243['queueStatusComplete']=!![];loggerBooked[_0x7ea5('0x4a')]('[booked][unlockQueueStatus]',_0x40827d,JSON[_0x7ea5('0x76')](_[_0x7ea5('0x77')](_0x1ca243,[_0x7ea5('0x48'),_0x7ea5('0x74')])));},0x1f3);}function checkInterval(_0x4b0009){return function(){if(!isNotNull(_0x4b0009[_0x7ea5('0x78')])){_0x4b0009[_0x7ea5('0x6b')]=utils['CAMPAIGN_STATUS'][_0x7ea5('0x79')];throw _0x4b0009[_0x7ea5('0x48')]+_0x7ea5('0x7a');}if(!isNotNull(_0x4b0009[_0x7ea5('0x78')][_0x7ea5('0x7b')])){_0x4b0009[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x79')];throw _0x4b0009[_0x7ea5('0x48')]+_0x7ea5('0x7a');}if(!isNotNull(_[_0x7ea5('0x7c')](_0x4b0009[_0x7ea5('0x78')][_0x7ea5('0x7b')]))){_0x4b0009['message']=utils[_0x7ea5('0x6c')][_0x7ea5('0x79')];throw _0x4b0009[_0x7ea5('0x48')]+_0x7ea5('0x7a');}};}function checkIsIVRCampaignActive(_0x221bc4){return function(){if(!utils['isIVRCampaignActive'](_0x221bc4)){_0x221bc4['message']=utils[_0x7ea5('0x6c')][_0x7ea5('0x7d')];throw _0x221bc4[_0x7ea5('0x48')]+_0x7ea5('0x7e');}};}function emitCampaignSummary(_0x4d33f4){if(utils[_0x7ea5('0x7f')](_0x4d33f4)){emit(util[_0x7ea5('0x47')](_0x7ea5('0x80'),_0x4d33f4[_0x7ea5('0x48')]),_0x7ea5('0x81'),_0x4d33f4);}}function loggerCatchQueueSummary(_0x39d710,_0x2e0be2){return function(_0x1dbced){clearPredictiveAttributes(_0x2e0be2);emitCampaignSummary(_0x2e0be2);loggerSyncQueueSummary[_0x7ea5('0x44')](_0x39d710,util[_0x7ea5('0x46')](_0x1dbced,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3df9a8){if(_0x3df9a8['sendMessageOneNotActive']){if(_0x3df9a8[_0x7ea5('0x82')]===0x0){_0x3df9a8['sendMessageOneNotActive']=![];_0x3df9a8[_0x7ea5('0x6b')]=utils['CAMPAIGN_STATUS'][_0x7ea5('0x7d')];loggerSyncQueueSummary[_0x7ea5('0x44')](_0x7ea5('0x83'),_0x3df9a8['name'],_0x7ea5('0x84'));}else{_0x3df9a8[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0x7ea5('0x83'),_0x3df9a8[_0x7ea5('0x48')],_0x7ea5('0x85'));}emitCampaignSummary(_0x3df9a8);}}function myreject(_0xe73b49){return function(_0x3ea89b){return _0xe73b49(msgResponse(_0x7ea5('0x86'),_0x7ea5('0x87'),JSON[_0x7ea5('0x76')](_0x3ea89b)));};}Dialer['prototype']['isTrunkReachable']=function(_0x47b4f6){return!_[_0x7ea5('0x41')](_0x47b4f6)&&_0x47b4f6&&!_[_0x7ea5('0x41')](_0x47b4f6[_0x7ea5('0x48')])&&!_['isUndefined'](_0x47b4f6['active'])&&_0x47b4f6[_0x7ea5('0x88')]&&(this['trunks'][util['format'](_0x7ea5('0x89'),_0x47b4f6[_0x7ea5('0x48')])][_0x7ea5('0x8a')]==='reachable'||this[_0x7ea5('0x8b')][util[_0x7ea5('0x47')](_0x7ea5('0x89'),_0x47b4f6[_0x7ea5('0x48')])][_0x7ea5('0x8a')]===_0x7ea5('0x8c'));};Dialer[_0x7ea5('0x17')][_0x7ea5('0x8d')]=function(_0x385555){var _0x1313f9=this;return function(){if(!_0x1313f9[_0x7ea5('0x8e')](_0x385555[_0x7ea5('0x8f')])){if(!_0x1313f9[_0x7ea5('0x8e')](_0x385555[_0x7ea5('0x90')])){_0x385555[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x91')];throw _0x385555[_0x7ea5('0x48')]+_0x7ea5('0x92');}}};};Dialer['prototype']['checkIfTime']=function(_0x3b5959,_0x264c1b,_0x115357,_0x2de796){var _0x1eec09=this;return function(){var _0x597987=!![];return _0x1eec09['ifTimeIvr'](_0x3b5959,_0x264c1b,_0x115357,_0x2de796,_0x597987);};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x93')]=function(_0x15f7c4,_0x2cee64,_0x34fbd1,_0x5e90ef){var _0x16f0b3=this;return function(){var _0x2053c4=![];return _0x16f0b3[_0x7ea5('0x94')](_0x15f7c4[_0x7ea5('0x7b')],_0x2cee64,_0x34fbd1,_0x5e90ef,_0x2053c4);};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x94')]=function(_0xd410ba,_0xc26187,_0x17667c,_0x2f7991,_0x13869c){var _0x57f262=[];return new Promise(function(_0x1eda2d,_0x40cad2){if(!isNotNull(_0xd410ba)){_0x2f7991[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x79')];return _0x40cad2(msgResponse(_0x7ea5('0x95'),_0x7ea5('0x96'),_0x17667c+_0x7ea5('0x97')));}if(_[_0x7ea5('0x7c')](_0xd410ba)){_0x2f7991['message']=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x40cad2(msgResponse(_0x7ea5('0x95'),_0x7ea5('0x96'),_0x17667c+_0x7ea5('0x98')));}if(_0xc26187&&_[_0x7ea5('0x41')](config[_0x7ea5('0x99')][_0xc26187])){_0x2f7991[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x9a')];return _0x40cad2(msgResponse('ifTime',_0x7ea5('0x96'),_0x17667c+'\x20Timezone\x20unknow\x20'+_0xc26187));}if(_[_0x7ea5('0x9b')](_0xd410ba)){for(var _0x3dedf8=0x0;_0x3dedf8<_0xd410ba[_0x7ea5('0x9c')];_0x3dedf8+=0x1){_0x57f262[_0x7ea5('0x9d')](ami['Action']({'action':_0x7ea5('0x9e'),'command':util['format'](_0x7ea5('0x9f'),_0xd410ba[_0x3dedf8][_0x7ea5('0xa0')],!_['isUndefined'](config[_0x7ea5('0x99')][_0xc26187])?_0xc26187:'')})['then'](function(_0x3a15c0){return _0x3a15c0[_0x7ea5('0xa1')][_0x7ea5('0xa2')]('true')>=0x0;})[_0x7ea5('0xa3')](myreject(_0x40cad2)));}}else{_0x57f262['push'](ami[_0x7ea5('0xa4')]({'action':_0x7ea5('0x9e'),'command':util['format'](_0x7ea5('0x9f'),_0xd410ba,!_['isUndefined'](config[_0x7ea5('0x99')][_0xc26187])?_0xc26187:'')})['then'](function(_0x2c398a){return _0x2c398a['content']['indexOf']('true')>=0x0;})[_0x7ea5('0xa3')](myreject(_0x40cad2)));}Promise[_0x7ea5('0xa5')](_0x57f262)['then'](function(_0xea80da){var _0x48995b=_['some'](_0xea80da);if(_0x48995b){return _0x1eda2d(_0x48995b);}else{_0x2f7991[_0x7ea5('0x6b')]=_0x13869c?utils[_0x7ea5('0x6c')][_0x7ea5('0xa6')]:utils[_0x7ea5('0x6c')][_0x7ea5('0xa7')];return _0x40cad2(msgResponse('[ifTime][promiseAll]',_0x7ea5('0x96'),_0x7ea5('0xa8')+_0x13869c+'\x20'+_0x17667c+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7ea5('0x46')](_0xd410ba,{'showHidden':![],'depth':null})+_0x7ea5('0xa9')+_0xc26187));}})[_0x7ea5('0xa3')](function(_0x1fbfcc){return _0x40cad2(msgResponse(_0x7ea5('0x95'),_0x7ea5('0x96'),JSON[_0x7ea5('0x76')](_0x1fbfcc)));});});};Dialer['prototype'][_0x7ea5('0x3e')]=function(){var _0x5b9a8b=this;return cmHopper[_0x7ea5('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x7ea5('0x40')](function(){setInterval(function(){_0x5b9a8b[_0x7ea5('0xab')]();},0x3e8);});};Dialer['prototype'][_0x7ea5('0xab')]=function(){var _0x2ac963=this;var _0x4a478d;for(var _0x2af165 in this[_0x7ea5('0x1e')]){if(typeof this[_0x7ea5('0x1e')][_0x2af165]!=='undefined'){_0x4a478d=this[_0x7ea5('0x1e')][_0x2af165];if(utils[_0x7ea5('0x7f')](_0x4a478d)&&utils[_0x7ea5('0xac')](_0x4a478d)){_0x4a478d[_0x7ea5('0xad')]=!![];Promise[_0x7ea5('0xae')]()[_0x7ea5('0x40')](checkIsIVRCampaignActive(_0x4a478d))['then'](checkInterval(_0x4a478d))[_0x7ea5('0x40')](_0x2ac963['checkIsTrunkReachable'](_0x4a478d))['then'](_0x2ac963[_0x7ea5('0xaf')](_0x4a478d[_0x7ea5('0xb0')],_0x4a478d[_0x7ea5('0xb1')],_0x4a478d['name'],_0x4a478d))['then'](_0x2ac963[_0x7ea5('0x93')](_0x4a478d[_0x7ea5('0x78')],_0x4a478d['dialTimezone'],_0x4a478d[_0x7ea5('0x48')],_0x4a478d))[_0x7ea5('0x40')](_0x2ac963[_0x7ea5('0xb2')](_0x4a478d))[_0x7ea5('0xa3')](loggerCatchQueueSummary(_0x7ea5('0xb3'),_0x4a478d));}else{notSendMessagesCampaign(_0x4a478d);}}}};Dialer['prototype'][_0x7ea5('0xb4')]=function(_0x43d075){if(_0x43d075[_0x7ea5('0xb5')]!==_0x7ea5('0x9')){clearPredictiveAttributes(_0x43d075);}switch(_0x43d075['dialMethod']){case _0x7ea5('0xb6'):this['handlePower'](_0x43d075,0x1);break;case _0x7ea5('0xb7'):this['handlePower'](_0x43d075,_0x43d075[_0x7ea5('0xb8')]);break;case _0x7ea5('0x9'):this[_0x7ea5('0x9')](_0x43d075);break;case _0x7ea5('0x8'):this[_0x7ea5('0xb9')](_0x43d075,0x1);break;default:logger[_0x7ea5('0x67')]('Queue',_0x43d075[_0x7ea5('0x48')],'method\x20not\x20recognized');}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x95')]=function(_0x44af96,_0x58323f){var _0x147b61=_0x44af96['dialTimezone'];var _0x254f45=_0x58323f?_0x44af96[_0x7ea5('0xb0')]:_0x44af96[_0x7ea5('0x78')][_0x7ea5('0x7b')];logger[_0x7ea5('0xba')](_0x7ea5('0xbb'),_0x254f45,_0x147b61,_0x44af96[_0x7ea5('0x48')],util['format'](_0x7ea5('0xbc'),_0x44af96['name'],_0x44af96['id']));var _0x57db25=null;return Interval[_0x7ea5('0xbd')](_0x254f45,_0x147b61)[_0x7ea5('0x40')](function(_0x413683){if(_0x413683===!![]){return _0x413683;}else{_0x44af96[_0x7ea5('0x6b')]=_0x58323f?utils[_0x7ea5('0x6c')][_0x7ea5('0xa6')]:utils[_0x7ea5('0x6c')][_0x7ea5('0xa7')];_0x57db25=msgResponse(_0x7ea5('0xbe'),_0x7ea5('0x96'),_0x7ea5('0xa8')+_0x58323f+'\x20'+_0x44af96[_0x7ea5('0x48')]+_0x7ea5('0xbf')+util[_0x7ea5('0x46')](_0x254f45,{'showHidden':![],'depth':null})+_0x7ea5('0xa9')+_0x147b61);}if(_0x57db25!==null){logger[_0x7ea5('0xba')](_0x7ea5('0xc0'),_0x57db25);_0x57db25['isGlobal']=_0x58323f;throw _0x57db25;}})[_0x7ea5('0xa3')](function(_0x3e4761){logger[_0x7ea5('0x67')]('AMI\x20IfTime',_0x3e4761);throw msgResponse(_0x7ea5('0x86'),_0x7ea5('0x87'),util[_0x7ea5('0x46')](_0x3e4761,{'showHidden':![],'depth':null}));});};Dialer[_0x7ea5('0x17')][_0x7ea5('0x2c')]=function(_0x1833cb){if(this[_0x7ea5('0x1d')][_0x1833cb[_0x7ea5('0xc1')]]){if(this['uniqueId'][_0x1833cb[_0x7ea5('0xc2')]]&&this[_0x7ea5('0x24')][_0x1833cb['uniqueid']][_0x7ea5('0x42')]!==_0x7ea5('0xc3')){this[_0x7ea5('0xc4')](this['voiceQueues'][_0x1833cb[_0x7ea5('0xc1')]]);this[_0x7ea5('0x24')][_0x1833cb[_0x7ea5('0xc2')]]['answertime']=moment()[_0x7ea5('0x47')](_0x7ea5('0xc5'));}}};Dialer['prototype'][_0x7ea5('0x32')]=function(_0xb03db4){var _0x2bc4a6=this[_0x7ea5('0x24')][_0xb03db4[_0x7ea5('0xc2')]];if(this['voiceQueues'][_0xb03db4[_0x7ea5('0xc1')]]){if(_0x2bc4a6&&_0x2bc4a6[_0x7ea5('0x42')]!=='ivr'){delete this[_0x7ea5('0x24')][_0xb03db4['uniqueid']];this[_0x7ea5('0x1d')][_0xb03db4[_0x7ea5('0xc1')]][_0x7ea5('0xc6')]+=0x1;var _0x5dc47a=new AgentComplete(_0x2bc4a6,_0xb03db4);if(_0xb03db4[_0x7ea5('0xc7')]===_0x7ea5('0xc8')){_0x5dc47a[_0x7ea5('0xc9')]=this[_0x7ea5('0x1d')][_0xb03db4[_0x7ea5('0xc1')]][_0x7ea5('0xca')]&&this[_0x7ea5('0x1d')][_0xb03db4['queue']][_0x7ea5('0xcb')]?moment()[_0x7ea5('0x47')](_0x7ea5('0xc5')):undefined;}hopperUtils[_0x7ea5('0xcc')](_0x5dc47a)[_0x7ea5('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x7ea5('0xcd')](_0x5dc47a)['catch'](loggerCatch(_0x7ea5('0xce')));}}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x54b4ee){var _0x3cf4e8=this[_0x7ea5('0x24')][_0x54b4ee[_0x7ea5('0xc2')]];var _0x8d7b36=this;var _0xb1d4a4=![];var _0x11ed92;var _0x3489f6;if(this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]]){if(_0x3cf4e8&&_0x3cf4e8[_0x7ea5('0x42')]!==_0x7ea5('0xc3')){delete this[_0x7ea5('0x24')][_0x54b4ee[_0x7ea5('0xc2')]];this['updateOriginated'](this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]]);_0x3cf4e8['droptime']=moment()[_0x7ea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12373c=new QueueCallerAbandon(_0x3cf4e8,_0x54b4ee);if(utils['getSeconds'](_0x3cf4e8[_0x7ea5('0xcf')],_0x3cf4e8[_0x7ea5('0xd0')])>=_0x3cf4e8[_0x7ea5('0xd1')]){this[_0x7ea5('0x1d')][_0x54b4ee['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0xd2')]+=0x1;this['voiceQueues'][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0xd3')]+=0x1;_0x12373c[_0x7ea5('0x72')]=0xa;_0x12373c[_0x7ea5('0xd4')]=_0x7ea5('0xd5');_0x12373c[_0x7ea5('0xd6')]='TIMEOUT';_0x12373c[_0x7ea5('0xc9')]=this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0xca')]?moment()[_0x7ea5('0x47')](_0x7ea5('0xc5')):undefined;_0x12373c['countdropretry']+=0x1;_0x12373c[_0x7ea5('0xd7')]+=0x1;_0x11ed92=this[_0x7ea5('0x1d')][_0x54b4ee['queue']][_0x7ea5('0xd8')];_0x3489f6=this[_0x7ea5('0x1d')][_0x54b4ee['queue']][_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xda')](_0x12373c,_0x12373c[_0x7ea5('0x72')],_0x3cf4e8[_0x7ea5('0xdb')])['then'](function(_0x2f7e30){_0xb1d4a4=_0x2f7e30['additional']==0x1;if(_0x12373c[_0x7ea5('0xdc')]>=_0x8d7b36[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]]['dialDropMaxRetry']){_0x8d7b36['queueCallerAbandonCreateState'](_0x12373c,_0x2f7e30[_0x7ea5('0xdd')]);}else{hopperUtils[_0x7ea5('0xde')]({'active':![],'countdropretry':_0x12373c[_0x7ea5('0xdc')],'scheduledat':moment()[_0x7ea5('0xdf')](_0x8d7b36[_0x7ea5('0x1d')][_0x54b4ee['queue']][_0x7ea5('0xd8')],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3cf4e8[_0x7ea5('0xe1')],'ListId':_0x3cf4e8['ListId'],'VoiceQueueId':_0x3cf4e8[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3cf4e8[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch('[rescheduleContact][Drop]'));var _0x29d01c=new History(_0x12373c);_0x29d01c[_0x7ea5('0x72')]=0xa;_0x29d01c['statedesc']=_0x7ea5('0xd5');_0x29d01c[_0x7ea5('0xe4')]=moment()[_0x7ea5('0x47')](_0x7ea5('0xc5'));_0x29d01c[_0x7ea5('0x73')]=_0x29d01c[_0x7ea5('0xe4')];_0x29d01c[_0x7ea5('0xe5')]=_0x12373c[_0x7ea5('0xe5')];_0x29d01c[_0x7ea5('0xe6')]=_0x12373c[_0x7ea5('0xe6')];hopperUtils[_0x7ea5('0xcc')](_0x29d01c)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0xe7')));}})[_0x7ea5('0x40')](function(){if(_0xb1d4a4)hopperUtils[_0x7ea5('0xe8')](_0x12373c,_0x11ed92,_0x3489f6)[_0x7ea5('0x40')](function(){return 0x1;});});}else{this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0x52')]+=0x1;this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0xe9')]+=0x1;_0x12373c[_0x7ea5('0x72')]=0xb;_0x12373c[_0x7ea5('0xd4')]=_0x7ea5('0xea');_0x12373c[_0x7ea5('0xd6')]=_0x7ea5('0xeb');_0x12373c['countabandonedretry']+=0x1;_0x12373c['countglobal']+=0x1;_0x11ed92=this['voiceQueues'][_0x54b4ee['queue']][_0x7ea5('0xec')];_0x3489f6=this[_0x7ea5('0x1d')][_0x54b4ee[_0x7ea5('0xc1')]][_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xda')](_0x12373c,_0x12373c[_0x7ea5('0x72')],_0x3cf4e8[_0x7ea5('0xdb')])[_0x7ea5('0x40')](function(_0x41c982){if(_0x12373c['countabandonedretry']>=_0x8d7b36[_0x7ea5('0x1d')][_0x54b4ee['queue']][_0x7ea5('0xed')]){_0x8d7b36[_0x7ea5('0xee')](_0x12373c,_0x41c982[_0x7ea5('0xdd')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x12373c[_0x7ea5('0xef')],'scheduledat':moment()['add'](_0x8d7b36[_0x7ea5('0x1d')][_0x54b4ee['queue']][_0x7ea5('0xec')],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3cf4e8[_0x7ea5('0xe1')],'ListId':_0x3cf4e8['ListId'],'VoiceQueueId':_0x3cf4e8[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3cf4e8['CampaignId']||undefined})['catch'](loggerCatch(_0x7ea5('0xf0')));var _0x5cd02f=new History(_0x12373c);_0x5cd02f[_0x7ea5('0x72')]=0xb;_0x5cd02f['statedesc']=_0x7ea5('0xea');_0x5cd02f[_0x7ea5('0xe4')]=moment()[_0x7ea5('0x47')](_0x7ea5('0xc5'));_0x5cd02f[_0x7ea5('0x73')]=_0x5cd02f[_0x7ea5('0xe4')];_0x5cd02f['calleridname']=_0x12373c[_0x7ea5('0xe5')];_0x5cd02f[_0x7ea5('0xe6')]=_0x12373c[_0x7ea5('0xe6')];hopperUtils['createHistory'](_0x5cd02f)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0xf1')));}})[_0x7ea5('0x40')](function(){if(_0xb1d4a4)hopperUtils[_0x7ea5('0xe8')](_0x12373c,_0x11ed92,_0x3489f6)[_0x7ea5('0x40')](function(){return 0x1;});});}}}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x39')]=function(_0x2b2aee){if(this[_0x7ea5('0x22')][_0x2b2aee[_0x7ea5('0xc2')]]){this[_0x7ea5('0x22')][_0x2b2aee[_0x7ea5('0xc2')]][_0x7ea5('0xf2')]=_0x2b2aee[_0x7ea5('0xf2')];}if(this[_0x7ea5('0x24')][_0x2b2aee[_0x7ea5('0xc2')]]){this[_0x7ea5('0x24')][_0x2b2aee[_0x7ea5('0xc2')]][_0x7ea5('0xf2')]=_0x2b2aee['channel'];}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x3c')]=function(_0xc7653d){if(!this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]]){return;}var _0x33baa1=this['voiceQueues'][this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]][_0x7ea5('0xf4')]||_0x7ea5('0xf5');if(_0x33baa1===_0x7ea5('0xf6')){if(this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]]&&_[_0x7ea5('0xf7')](this[_0x7ea5('0x22')][_0xc7653d['actionid']]['locked'])&&_0xc7653d[_0x7ea5('0x8a')]==='1'&&_0xc7653d[_0x7ea5('0xf8')]==='0'){if(this[_0x7ea5('0x1f')][_0xc7653d['stateinterface']]){if(!this['agents'][_0xc7653d[_0x7ea5('0xf9')]][_0x7ea5('0xfa')]){this[_0x7ea5('0x1f')][_0xc7653d['stateinterface']]['locked']=!![];this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]][_0x7ea5('0xfa')]=!![];this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]][_0x7ea5('0xf9')]=_0xc7653d[_0x7ea5('0xf9')];}}}}else if(_0x33baa1===_0x7ea5('0xf5')){if(this['actions'][_0xc7653d[_0x7ea5('0xf3')]]){if(this[_0x7ea5('0x1f')][_0xc7653d[_0x7ea5('0xf9')]]){this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]][_0x7ea5('0xf9')]=_0xc7653d[_0x7ea5('0xf9')];if(_[_0x7ea5('0xf7')](this['queueBooked'][this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]]['queue']])){this['queueBooked'][this['actions'][_0xc7653d['actionid']][_0x7ea5('0xc1')]]=[];}this[_0x7ea5('0x29')][this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]]['queue']][_0x7ea5('0x9d')](_[_0x7ea5('0x62')](_['pick'](this[_0x7ea5('0x22')][_0xc7653d[_0x7ea5('0xf3')]],[_0x7ea5('0xfb'),'stateinterface']),{'status':_0xc7653d['status'],'paused':_0xc7653d[_0x7ea5('0xf8')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x31be24){if(!this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]){return;}var _0x4f4ea1=this;var _0x3eb226=this[_0x7ea5('0x1d')][this['actions'][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]];var _0x281711=_0x3eb226['strategy']||'rrmemory';if(_0x281711===_0x7ea5('0xf6')){if(this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]&&this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xf9')]){this[_0x7ea5('0x1c')]['run'](this['actions'][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xfb')],this[_0x7ea5('0x22')][_0x31be24['actionid']][_0x7ea5('0xf9')])['catch'](function(_0x454aca){logger['error'](_0x7ea5('0xfc'),util[_0x7ea5('0x46')](_0x454aca,{'showHidden':![],'depth':null}));})[_0x7ea5('0x1a')](function(){_0x4f4ea1[_0x7ea5('0xc4')](_0x4f4ea1['voiceQueues'][_0x4f4ea1[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]]);_0x4f4ea1[_0x7ea5('0x1f')][_0x4f4ea1[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xf9')]][_0x7ea5('0xfa')]=![];delete _0x4f4ea1[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]];unlockQueueStatus(_0x3eb226);});}else{this[_0x7ea5('0xc4')](this['voiceQueues'][this[_0x7ea5('0x22')][_0x31be24['actionid']][_0x7ea5('0xc1')]]);hopperUtils[_0x7ea5('0xde')]({'active':![],'ContactId':this[_0x7ea5('0x22')][_0x31be24['actionid']][_0x7ea5('0xe1')],'ListId':this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]['ListId'],'VoiceQueueId':this['actions'][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xe2')]||undefined,'CampaignId':this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0xfd')));delete this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]];unlockQueueStatus(_0x3eb226);}}else if(_0x281711===_0x7ea5('0xf5')){var _0x5aad60;if(this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]&&!_['isEmpty'](this[_0x7ea5('0x29')][this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]['queue']])){if(this['queueBookedRR'][_0x4f4ea1[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]]['queue']]){this[_0x7ea5('0x2a')][_0x4f4ea1[_0x7ea5('0x22')][_0x31be24['actionid']][_0x7ea5('0xc1')]]=this[_0x7ea5('0x2a')][this['actions'][_0x31be24['actionid']][_0x7ea5('0xc1')]]?this[_0x7ea5('0x2a')][this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]]:this[_0x7ea5('0x29')][this[_0x7ea5('0x22')][_0x31be24['actionid']][_0x7ea5('0xc1')]]?this[_0x7ea5('0x29')][this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]][_0x7ea5('0xfe')]||0x0:0x0;}this['queueBooked'][this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]][_0x7ea5('0xfe')]=this[_0x7ea5('0x2a')][this[_0x7ea5('0x22')][_0x31be24[_0x7ea5('0xf3')]][_0x7ea5('0xc1')]];for(var _0x436b79=0x0;_0x436b79=_0x46aafb[_0x7ea5('0x124')]){_0x5ac18d['stateGlobal'](_0x4e1a78,_0x204a8f,_0xc87532,_0x7ea5('0x125'));}else{if(_0x4e1a78[_0x7ea5('0x11e')]>=_0x46aafb[_0x7ea5('0x126')]){_0x5ac18d[_0x7ea5('0x127')](_0x4e1a78,_0x204a8f,_0xc87532,_0x7ea5('0x128'));}else{hopperUtils[_0x7ea5('0xde')]({'active':![],'countmachineretry':_0x4e1a78[_0x7ea5('0x11e')],'scheduledat':moment()[_0x7ea5('0xdf')](_0x46aafb[_0x7ea5('0x129')],'minutes')[_0x7ea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e1a78[_0x7ea5('0xe1')],'ListId':_0x4e1a78[_0x7ea5('0x106')],'VoiceQueueId':_0x4e1a78['VoiceQueueId']||undefined,'CampaignId':_0x4e1a78[_0x7ea5('0xe3')]||undefined})['catch'](loggerCatch(_0x7ea5('0x12a')));_0x204a8f({'reschedule':0x1});}}});}if(_0x5aa4d4['type']===_0x7ea5('0xc3')&&this[_0x7ea5('0x1e')][_0x5aa4d4['queue']]['dialAMDActive']&&_0xd01cb7[_0x7ea5('0x111')]==='HANGUP'){delete this[_0x7ea5('0x24')][_0xd01cb7['uniqueid']];this[_0x7ea5('0xc4')](this['campaigns'][_0x5aa4d4['queue']]);_0x3fbd82=new Hangup(_0x5aa4d4,_0xd01cb7);_0x3fbd82[_0x7ea5('0x72')]=0x12;_0x3fbd82[_0x7ea5('0xd4')]='HangupInAMD';_0x3fbd82[_0x7ea5('0x113')]=_0x7ea5('0x114');ami[_0x7ea5('0x115')](_0x7ea5('0x116'),ut[_0x7ea5('0x11f')](_0x3fbd82,_0x7ea5('0x117')));this[_0x7ea5('0x12b')](_0x3fbd82,'[syncHangupInAMDIvr][createHistory]',_0x7ea5('0x12c'));}if(_0x5aa4d4[_0x7ea5('0x42')]===_0x7ea5('0xc3')&&this[_0x7ea5('0x1e')][_0x5aa4d4[_0x7ea5('0xc1')]][_0x7ea5('0x11a')]&&_0xd01cb7[_0x7ea5('0x111')]===_0x7ea5('0x11b')){return new Promise(function(_0x3adac1,_0x122813){delete _0x5ac18d[_0x7ea5('0x24')][_0xd01cb7[_0x7ea5('0xc2')]];_0x5ac18d[_0x7ea5('0xc4')](_0x5ac18d['campaigns'][_0x5aa4d4[_0x7ea5('0xc1')]]);_0x5ac18d[_0x7ea5('0x1e')][_0x5aa4d4[_0x7ea5('0xc1')]][_0x7ea5('0xc6')]+=0x1;_0x5ac18d[_0x7ea5('0x1e')][_0x5aa4d4[_0x7ea5('0xc1')]][_0x7ea5('0x11c')]+=0x1;var _0x20ab88=_0x5ac18d[_0x7ea5('0x1e')][_0x5aa4d4[_0x7ea5('0xc1')]];var _0x29db19=new Hangup(_0x5aa4d4,_0xd01cb7);_0x29db19[_0x7ea5('0x72')]=0x13;_0x29db19[_0x7ea5('0xd4')]=_0x7ea5('0x11d');_0x29db19[_0x7ea5('0x113')]='AMD';_0x29db19[_0x7ea5('0x11e')]+=0x1;_0x29db19[_0x7ea5('0xd7')]+=0x1;_0x29db19[_0x7ea5('0x117')]=!![];ami['emit'](_0x7ea5('0x116'),ut[_0x7ea5('0x11f')](_0x29db19,_0x7ea5('0x117')));hopperUtils[_0x7ea5('0xcc')](_0x29db19)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x120')));if(_0x29db19[_0x7ea5('0x121')]+_0x29db19['countcongestionretry']+_0x29db19[_0x7ea5('0x12d')]+_0x29db19[_0x7ea5('0x123')]+_0x29db19[_0x7ea5('0xdc')]+_0x29db19['countabandonedretry']+_0x29db19[_0x7ea5('0x11e')]+_0x29db19[_0x7ea5('0x12e')]>=_0x20ab88[_0x7ea5('0x124')]){_0x5ac18d['stateGlobal'](_0x29db19,_0x3adac1,_0x122813,'reason19\x20machine....');}else{if(_0x29db19[_0x7ea5('0x11e')]>=_0x20ab88[_0x7ea5('0x126')]){_0x5ac18d[_0x7ea5('0x127')](_0x29db19,_0x3adac1,_0x122813,'reason\x2019\x20machine....');}else{hopperUtils[_0x7ea5('0xde')]({'active':![],'countmachineretry':_0x29db19[_0x7ea5('0x11e')],'scheduledat':moment()[_0x7ea5('0xdf')](_0x20ab88[_0x7ea5('0x129')],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x29db19[_0x7ea5('0xe1')],'ListId':_0x29db19['ListId'],'VoiceQueueId':_0x29db19[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x29db19[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x12a')));_0x3adac1({'reschedule':0x1});}}});}}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x37')]=function(_0x78b0f2){var _0x2cb772=this[_0x7ea5('0x24')][_0x78b0f2[_0x7ea5('0xc2')]];var _0xf8759;if(_0x2cb772&&_0x2cb772[_0x7ea5('0x42')]==='ivr'){delete this[_0x7ea5('0x24')][_0x78b0f2[_0x7ea5('0xc2')]];this[_0x7ea5('0xc4')](this[_0x7ea5('0x1e')][_0x2cb772[_0x7ea5('0xc1')]]);this[_0x7ea5('0x1e')][_0x2cb772[_0x7ea5('0xc1')]][_0x7ea5('0x12f')]+=0x1;_0xf8759=new Hangup(_0x2cb772,_0x78b0f2);hopperUtils[_0x7ea5('0xcc')](_0xf8759)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x130')));hopperUtils[_0x7ea5('0xcd')](_0xf8759)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x2cb772&&_0x2cb772['type']!==_0x7ea5('0xc3')&&isNotNull(this['voiceQueues'][_0x2cb772[_0x7ea5('0xc1')]][_0x7ea5('0x131')])){delete this[_0x7ea5('0x24')][_0x78b0f2['uniqueid']];this[_0x7ea5('0xc4')](this['voiceQueues'][_0x2cb772[_0x7ea5('0xc1')]]);this[_0x7ea5('0x1d')][_0x2cb772[_0x7ea5('0xc1')]][_0x7ea5('0xc6')]+=0x1;this[_0x7ea5('0x1d')][_0x2cb772[_0x7ea5('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0xf8759=new Hangup(_0x2cb772,_0x78b0f2);_0xf8759['state']=0x10;_0xf8759[_0x7ea5('0xd4')]=_0x7ea5('0x132');_0xf8759['membername']='AGI';hopperUtils[_0x7ea5('0xcc')](_0xf8759)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x130')));hopperUtils['moveContactManagedDialer'](_0xf8759)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x133')));}if(_0x2cb772&&_0x2cb772['type']!==_0x7ea5('0xc3')&&!isNotNull(this[_0x7ea5('0x1d')][_0x2cb772[_0x7ea5('0xc1')]][_0x7ea5('0x131')])){delete this['uniqueId'][_0x78b0f2[_0x7ea5('0xc2')]];this[_0x7ea5('0xc4')](this[_0x7ea5('0x1d')][_0x2cb772[_0x7ea5('0xc1')]]);this[_0x7ea5('0x1d')][_0x2cb772[_0x7ea5('0xc1')]][_0x7ea5('0x134')]+=0x1;_0xf8759=new Hangup(_0x2cb772,_0x78b0f2);_0xf8759[_0x7ea5('0x72')]=0xc;_0xf8759[_0x7ea5('0xd4')]=_0x78b0f2[_0x7ea5('0x135')];_0xf8759[_0x7ea5('0x113')]=_0x7ea5('0x136');hopperUtils[_0x7ea5('0xcc')](_0xf8759)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xf8759)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x133')));}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x34')]=function(_0x33de59){var _0x49349c=this;if(!_0x49349c['queuesSummary'][_0x33de59[_0x7ea5('0x48')]]){_0x49349c[_0x7ea5('0x137')][_0x33de59[_0x7ea5('0x48')]]={'running':![]};}else if(_0x49349c['queuesSummary'][_0x33de59[_0x7ea5('0x48')]][_0x7ea5('0x138')]===!![]){return;}else if(_0x49349c[_0x7ea5('0x137')][_0x33de59['name']]['running']===![]){_0x49349c['queuesSummary'][_0x33de59[_0x7ea5('0x48')]][_0x7ea5('0x138')]=!![];}var _0x3047f3=_0x49349c[_0x7ea5('0x1d')][_0x33de59['name']];var _0x37a6a5=_0x3047f3[_0x7ea5('0x6b')]!==utils[_0x7ea5('0x6c')][_0x7ea5('0x7d')];var _0x335b8d=utils[_0x7ea5('0x139')](_0x3047f3);_0x3047f3[_0x7ea5('0x13a')]=utils[_0x7ea5('0x13b')](_0x3047f3,_0x49349c[_0x7ea5('0x8b')]);Promise['resolve']()[_0x7ea5('0x40')](function(){if(_0x3047f3['statusMessage']===utils[_0x7ea5('0x6c')]['INACTIVE']){if(_0x37a6a5){clearPredictiveAttributes(_0x3047f3);_0x33de59['startPredictive']=undefined;_0x33de59[_0x7ea5('0x27')]=undefined;}if(_0x3047f3[_0x7ea5('0x13a')]===utils[_0x7ea5('0x6c')][_0x7ea5('0x7d')]){_0x33de59[_0x7ea5('0x13c')]=0x0;_0x33de59['paused']=0x0;_0x33de59[_0x7ea5('0x13d')]=0x0;_0x33de59[_0x7ea5('0x13e')]=0x0;_0x33de59[_0x7ea5('0x13f')]=0x0;}}else if(_0x3047f3['statusMessage']===utils[_0x7ea5('0x6c')]['ACTIVE']&&!_0x335b8d){return _0x49349c[_0x7ea5('0x95')](_0x3047f3,!![])['then'](function(){return _0x49349c[_0x7ea5('0x95')](_0x3047f3,![]);})[_0x7ea5('0x40')](function(){return _0x49349c[_0x7ea5('0xb4')](_0x3047f3);})[_0x7ea5('0xa3')](function(_0x44799c){loggerSyncQueueSummary[_0x7ea5('0x44')](_0x7ea5('0x140'),util[_0x7ea5('0x46')](_0x44799c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3047f3);});}else{clearPredictiveAttributes(_0x3047f3);}})[_0x7ea5('0x40')](function(){var _0x446fc3=_0x33de59[_0x7ea5('0x141')](_0x3047f3);if(_0x446fc3||_0x3047f3[_0x7ea5('0x142')]){_0x3047f3[_0x7ea5('0x142')]=![];_0x33de59[_0x7ea5('0x143')](_0x3047f3);Object[_0x7ea5('0x144')](_0x3047f3,_0x33de59);emitOutboundVoiceQueueSummary(_0x33de59);}_0x49349c['queuesSummary'][_0x3047f3[_0x7ea5('0x48')]][_0x7ea5('0x138')]=![];})[_0x7ea5('0xa3')](function(_0x1c66eb){logger[_0x7ea5('0x67')](_0x7ea5('0x140'),util[_0x7ea5('0x46')](_0x1c66eb,{'showHidden':![],'depth':null}));_0x49349c[_0x7ea5('0x137')][_0x3047f3[_0x7ea5('0x48')]][_0x7ea5('0x138')]=![];});};Dialer[_0x7ea5('0x17')][_0x7ea5('0x35')]=_['throttle'](function(){var _0x339d92=_[_0x7ea5('0x145')](this[_0x7ea5('0x1d')],function(_0x2907f5){return _0x2907f5[_0x7ea5('0x146')];});var _0x21a637=_[_0x7ea5('0x145')](this[_0x7ea5('0x1f')],function(_0x588f4f){return _0x588f4f['online']&&_0x588f4f[_0x7ea5('0x8a')]===_0x7ea5('0x147');});if(_0x339d92[_0x7ea5('0x9c')]>0x0&&_0x21a637[_0x7ea5('0x9c')]>0x0){return Promise[_0x7ea5('0xae')]()[_0x7ea5('0x40')](cmHopper['handlePreviewRecallNotifications'](_[_0x7ea5('0x148')](_0x339d92,'id'),previewRecallmeReminderInterval,_[_0x7ea5('0x148')](_0x21a637,'id')))[_0x7ea5('0x40')](function(_0x61c6a0){for(var _0xc02869=0x0;_0xc02869<_0x61c6a0[_0x7ea5('0x9c')];_0xc02869++){var _0x1ab276=_0x61c6a0[_0xc02869][_0x7ea5('0x149')][_0x7ea5('0x48')];if(_0x1ab276)io['to'](util[_0x7ea5('0x47')]('user:%s',_0x1ab276))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x61c6a0[_0xc02869]});}})[_0x7ea5('0xa3')](function(_0x80dec5){logger[_0x7ea5('0x67')]('checkPreviewRecallReminder',_0x80dec5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7ea5('0x17')][_0x7ea5('0x14a')]=function(){var _0x2f3c34=this;setInterval(function(){_0x2f3c34[_0x7ea5('0x14b')](_0x2f3c34[_0x7ea5('0x24')],'[uniqueid]');_0x2f3c34[_0x7ea5('0x14b')](_0x2f3c34['actions'],'[actions]');},0x32c8);};Dialer[_0x7ea5('0x17')][_0x7ea5('0x14b')]=function(_0x4284da,_0x1b0d9a){var _0x493f45=this;for(var _0x1b0886 in _0x4284da){if(typeof _0x4284da[_0x1b0886]!==_0x7ea5('0x14c')){this[_0x7ea5('0x1b')]['enqueue'](function(){if(!_[_0x7ea5('0xf7')](_0x4284da[_0x1b0886])){return ami[_0x7ea5('0xa4')]({'action':_0x7ea5('0x8a'),'channel':_0x4284da[_0x1b0886][_0x7ea5('0xf2')]})[_0x7ea5('0xa3')](function(_0x4fe3de){if(_0x4fe3de[_0x7ea5('0x6b')]===_0x7ea5('0x14d')){setTimeout(function(){if(_0x4284da[_0x1b0886]&&_0x4284da[_0x1b0886]['type']!=='ivr'){_0x493f45[_0x7ea5('0xc4')](_0x493f45['voiceQueues'][_0x4284da[_0x1b0886][_0x7ea5('0xc1')]]);logger[_0x7ea5('0x67')](_0x7ea5('0x14e'),_0x1b0d9a,_0x1b0886,_0x4284da[_0x1b0886]['queue']);delete _0x4284da[_0x1b0886];}if(_0x4284da[_0x1b0886]&&_0x4284da[_0x1b0886]['type']===_0x7ea5('0xc3')){_0x493f45[_0x7ea5('0xc4')](_0x493f45[_0x7ea5('0x1e')][_0x4284da[_0x1b0886][_0x7ea5('0xc1')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x1b0d9a,_0x1b0886,_0x4284da[_0x1b0886][_0x7ea5('0xc1')]);delete _0x4284da[_0x1b0886];}},0x2328);}});}});}}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x14f')]=function(_0x6e244b){return Promise[_0x7ea5('0xae')]()[_0x7ea5('0x40')](voiceQueueRt[_0x7ea5('0x14f')](_0x6e244b))[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x150')));};Dialer['prototype'][_0x7ea5('0xc4')]=function(_0x1e5057){if(!_['isUndefined'](_0x1e5057)&&_0x1e5057!==null){if(typeof _0x1e5057['originated']!=='undefined'){if(_0x1e5057[_0x7ea5('0x82')]>0x0){_0x1e5057[_0x7ea5('0x82')]-=0x1;}else{logger[_0x7ea5('0x67')](_0x7ea5('0x151'));}}}else{logger[_0x7ea5('0x67')](_0x7ea5('0x152'));}};Dialer[_0x7ea5('0x17')]['loggerHandler']=function(_0x193c2b,_0x57ade3){var _0x2837b9=this;return function(_0x3d5c02){_0x2837b9[_0x7ea5('0xc4')](_0x57ade3);logger[_0x7ea5('0x67')](_0x193c2b,util[_0x7ea5('0x46')](_0x3d5c02,{'showHidden':![],'depth':null}));};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x153')]=function(_0x31e2f2,_0x2bb75c,_0x36c25d){var _0x33577e={'state':0x19,'statedesc':_0x7ea5('0x154')};this[_0x7ea5('0xc4')](_0x2bb75c);this['saveInDb'](_[_0x7ea5('0x62')](_0x33577e,_[_0x7ea5('0x77')](_0x36c25d,[_0x7ea5('0xe1'),_0x7ea5('0x106'),_0x7ea5('0x155'),_0x7ea5('0xe2'),_0x7ea5('0xe3')])),_0x7ea5('0x156'),'[emptyContact]');logger[_0x7ea5('0x67')](_0x31e2f2);};Dialer['prototype']['saveInDb']=function(_0x40133b,_0x3d24d2,_0x5eecfd){hopperUtils['createHistory'](_0x40133b)[_0x7ea5('0xa3')](loggerCatch(_0x3d24d2));hopperUtils['moveContactManagedDialer'](_0x40133b)['catch'](loggerCatch(_0x5eecfd));};Dialer[_0x7ea5('0x17')]['queueCallerAbandonCreateState']=function(_0x2a8536,_0x3e9206){hopperUtils[_0x7ea5('0xcc')](_0x2a8536)[_0x7ea5('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3e9206==0x0){hopperUtils[_0x7ea5('0xcd')](_0x2a8536)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x157')));}};Dialer['prototype'][_0x7ea5('0x158')]=function(_0x475780){return Promise[_0x7ea5('0xae')]()[_0x7ea5('0x40')](cmHopper[_0x7ea5('0x159')](_0x475780['id'],previewRecallmeReminderInterval))[_0x7ea5('0x40')](function(_0x33a35e){for(var _0x3000fd=0x0;_0x3000fd<_0x33a35e[_0x7ea5('0x9c')];_0x3000fd++){var _0x52f672=_0x33a35e[_0x3000fd]['Agent'][_0x7ea5('0x48')];if(_0x52f672)io['to'](util[_0x7ea5('0x47')](_0x7ea5('0x15a'),_0x52f672))[_0x7ea5('0x115')]('user:dialPreviewRecallReminder',{'hopper':_0x33a35e[_0x3000fd]});}})[_0x7ea5('0xa3')](function(){});};Dialer[_0x7ea5('0x17')]['launchHandleIvr']=function(_0x42533b){var _0x27055c=this;return function(){_0x27055c['handleIvr'](_0x42533b);};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x15b')]=function(_0x56e8d1,_0x43c70e){var _0x4d7d29=this;var _0xcbe0b1=uuid['v4']();this[_0x7ea5('0x22')][_0xcbe0b1]=new Action(_0x56e8d1,_0x43c70e,_0xcbe0b1);return new Promise(function(_0x58d18b,_0x5cc78b){if(_['isUndefined'](_0x56e8d1)&&typeof _0x56e8d1!==_0x7ea5('0x15c')){return _0x5cc78b(msgResponse(_0x7ea5('0x15d'),_0x7ea5('0x96'),_0x7ea5('0x15e')));}if(_[_0x7ea5('0x41')](_0x43c70e['phone'])||_0x43c70e[_0x7ea5('0x15f')]===null){return _0x5cc78b(msgResponse(_0x7ea5('0x15d'),'Failure',_0x7ea5('0x160')));}var _0x5443a2={'XMD-CALLERID':_0x4d7d29[_0x7ea5('0x22')][_0xcbe0b1][_0x7ea5('0x161')](),'XMD-AGI':_0x56e8d1[_0x7ea5('0x131')]?util[_0x7ea5('0x47')](_0x7ea5('0x162'),ipAgi,_0x56e8d1[_0x7ea5('0x131')]):_0x7ea5('0x163'),'XMD-AGIAFTER':_0x56e8d1['dialQueueProject2']?util[_0x7ea5('0x47')](_0x7ea5('0x162'),ipAgi,_0x56e8d1[_0x7ea5('0xca')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x56e8d1)?util[_0x7ea5('0x47')](_0x7ea5('0x164'),_0x56e8d1[_0x7ea5('0x48')],_0x56e8d1[_0x7ea5('0x165')]||'',_0x56e8d1[_0x7ea5('0xcb')]?'c':'',_0x56e8d1[_0x7ea5('0xd1')]||0x3):_0x7ea5('0x163'),'XMD-CONTACTID':_0x43c70e[_0x7ea5('0xe1')],'XMD-CDRTYPE':_0x7ea5('0x166'),'CALLERID(all)':_0x4d7d29[_0x7ea5('0x22')][_0xcbe0b1][_0x7ea5('0x161')](),'XMD-AMD':_0x56e8d1[_0x7ea5('0x11a')]?_0x7ea5('0x167'):_0x7ea5('0x163'),'XMD-DESTINATION':_0x7ea5('0x110')};if(_0x56e8d1['dialAMDActive']){_0x5443a2[_0x7ea5('0x168')]=_0x56e8d1[_0x7ea5('0x169')]||0x9c4;_0x5443a2['XMD-AMDGREETING']=_0x56e8d1[_0x7ea5('0x16a')]||0x5dc;_0x5443a2[_0x7ea5('0x16b')]=_0x56e8d1['dialAMDAfterGreetingSilence']||0x320;_0x5443a2[_0x7ea5('0x16c')]=_0x56e8d1[_0x7ea5('0x16d')]||0x1388;_0x5443a2[_0x7ea5('0x16e')]=_0x56e8d1[_0x7ea5('0x16f')]||0x64;_0x5443a2[_0x7ea5('0x170')]=_0x56e8d1['dialAMDBetweenWordsSilence']||0x32;_0x5443a2[_0x7ea5('0x171')]=_0x56e8d1[_0x7ea5('0x172')]||0x3;_0x5443a2[_0x7ea5('0x173')]=_0x56e8d1[_0x7ea5('0x174')]||0x100;_0x5443a2[_0x7ea5('0x175')]=_0x56e8d1[_0x7ea5('0x176')]||0x1388;}if(utils[_0x7ea5('0x177')](_0x56e8d1)){_0x5443a2[_0x7ea5('0x178')]=_0x43c70e[_0x7ea5('0xe2')];}else{_0x5443a2['XMD-CAMPAIGNID']=_0x43c70e[_0x7ea5('0xe3')];}for(var _0x15323b in _0x43c70e[_0x7ea5('0x179')]){if(typeof _0x43c70e[_0x7ea5('0x179')][_0x15323b]!==_0x7ea5('0x14c')){if(isNotNull(_0x43c70e[_0x7ea5('0x179')][_0x15323b])&&_0x15323b!=='id'&&_0x15323b!==_0x7ea5('0x17a')&&_0x15323b!=='createdAt'&&_0x15323b!==_0x7ea5('0x17b')){_0x5443a2[util[_0x7ea5('0x47')](_0x7ea5('0x17c'),_0x7ea5('0x17d'),_[_0x7ea5('0x17e')](_0x15323b))]=_0x43c70e[_0x7ea5('0x179')][_0x15323b];}}}var _0x4ef015=_0x4d7d29[_0x7ea5('0x8e')](_0x56e8d1['Trunk'])?utils[_0x7ea5('0x17f')](_0x56e8d1['Trunk'][_0x7ea5('0x180')],_0x56e8d1['dialOriginateCallerIdName'],_0x56e8d1[_0x7ea5('0x181')]>0x0?utils['getCallerIdRandom'](_0x56e8d1[_0x7ea5('0x182')],_0x56e8d1[_0x7ea5('0x181')]):_0x56e8d1[_0x7ea5('0x182')]):utils[_0x7ea5('0x17f')](_['isNil'](_0x56e8d1[_0x7ea5('0x90')])?_0x56e8d1[_0x7ea5('0x8f')][_0x7ea5('0x180')]:_0x56e8d1[_0x7ea5('0x90')]['callerid'],_0x56e8d1[_0x7ea5('0x183')],_0x56e8d1[_0x7ea5('0x181')]>0x0?utils[_0x7ea5('0x184')](_0x56e8d1[_0x7ea5('0x182')],_0x56e8d1['dialRandomLastDigitCallerIdNumber']):_0x56e8d1[_0x7ea5('0x182')]);if(_0x4ef015){_0x5443a2['XMD-ORIGINATECALLERIDNAME']=_0x4d7d29['actions'][_0xcbe0b1][_0x7ea5('0x185')]=utils[_0x7ea5('0x186')](_0x4ef015);_0x5443a2[_0x7ea5('0x187')]=_0x43c70e[_0x7ea5('0x15f')];}_0x56e8d1[_0x7ea5('0x188')]=_0x5443a2;return ami[_0x7ea5('0xa4')]({'actionid':_0xcbe0b1,'action':_0x7ea5('0x15d'),'channel':_0x4d7d29['isTrunkReachable'](_0x56e8d1[_0x7ea5('0x8f')])?util[_0x7ea5('0x47')](_0x7ea5('0x189'),_0x56e8d1[_0x7ea5('0x8f')][_0x7ea5('0x48')],isNotNull(_0x56e8d1[_0x7ea5('0x18a')])?_0x56e8d1[_0x7ea5('0x18a')][_0x7ea5('0x18b')]()||'':'',_0x56e8d1[_0x7ea5('0x18c')]>0x0?_0x43c70e[_0x7ea5('0x15f')][_0x7ea5('0x18d')](_0x56e8d1[_0x7ea5('0x18c')]):_0x43c70e[_0x7ea5('0x15f')]):util[_0x7ea5('0x47')](_0x7ea5('0x189'),_[_0x7ea5('0xf7')](_0x56e8d1['TrunkBackup'])?_0x56e8d1['Trunk']['name']:_0x56e8d1[_0x7ea5('0x90')][_0x7ea5('0x48')],isNotNull(_0x56e8d1[_0x7ea5('0x18a')])?_0x56e8d1['dialPrefix'][_0x7ea5('0x18b')]()||'':'',_0x56e8d1[_0x7ea5('0x18c')]>0x0?_0x43c70e[_0x7ea5('0x15f')][_0x7ea5('0x18d')](_0x56e8d1['dialCutDigit']):_0x43c70e[_0x7ea5('0x15f')]),'callerid':_0x4ef015,'Exten':_0x7ea5('0x110'),'Context':'from-sip','Priority':'1','variable':_0x5443a2,'timeout':(_0x56e8d1[_0x7ea5('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcbe0b1})[_0x7ea5('0x40')](function(_0x47f141){return _0x58d18b(_0x47f141);})[_0x7ea5('0xa3')](function(_0x1127a7){_0x56e8d1[_0x7ea5('0x18f')]+=0x1;var _0x22f091=new History(_0x4d7d29[_0x7ea5('0x22')][_0xcbe0b1]);logger[_0x7ea5('0x67')](util[_0x7ea5('0x47')]('[originateError]:\x20%s',JSON[_0x7ea5('0x76')](_0x1127a7)));_0x22f091['state']=0xe;_0x22f091[_0x7ea5('0xd4')]='OriginateError';_0x22f091['starttime']=moment()[_0x7ea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x22f091[_0x7ea5('0x73')]=_0x22f091['starttime'];hopperUtils[_0x7ea5('0xcc')](_0x22f091)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x190')));_0x4d7d29[_0x7ea5('0xcd')](_0x22f091)['catch'](loggerCatch(_0x7ea5('0x190')))['finally'](function(){delete _0x4d7d29['actions'][_0xcbe0b1];return _0x5cc78b(msgResponse(_0x7ea5('0x15d'),'Error',_0x7ea5('0x191')));});});});};Dialer[_0x7ea5('0x17')]['checkRetriveMax']=function(_0x53884d,_0x4ab039,_0x5309d0){var _0x3ad0bd=new History(_0x4ab039);if(_0x3ad0bd[_0x7ea5('0x121')]+_0x3ad0bd[_0x7ea5('0x122')]+_0x3ad0bd[_0x7ea5('0x12d')]+_0x3ad0bd[_0x7ea5('0x123')]+_0x3ad0bd[_0x7ea5('0xdc')]+_0x3ad0bd[_0x7ea5('0xef')]+_0x3ad0bd[_0x7ea5('0x11e')]+_0x3ad0bd[_0x7ea5('0x12e')]>=_0x5309d0[_0x7ea5('0x124')]-0x1){return!![];}switch(_0x53884d){case 0x3:if(_0x3ad0bd[_0x7ea5('0x12d')]>=_0x5309d0[_0x7ea5('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3ad0bd[_0x7ea5('0x12d')]+=0x1,'scheduledat':moment()['add'](_0x5309d0['dialNoAnswerRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd[_0x7ea5('0x106')],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x193')));break;case 0x5:if(_0x3ad0bd['countbusyretry']>=_0x5309d0[_0x7ea5('0x194')]-0x1){return!![];}hopperUtils[_0x7ea5('0xde')]({'active':![],'countbusyretry':_0x3ad0bd[_0x7ea5('0x121')]+=0x1,'scheduledat':moment()['add'](_0x5309d0[_0x7ea5('0x195')],_0x7ea5('0xe0'))[_0x7ea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd[_0x7ea5('0x106')],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x196')));break;case 0x8:if(_0x3ad0bd[_0x7ea5('0x122')]>=_0x5309d0[_0x7ea5('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x3ad0bd[_0x7ea5('0x122')]+=0x1,'scheduledat':moment()['add'](_0x5309d0['dialCongestionRetryFrequency'],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd[_0x7ea5('0x106')],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3ad0bd[_0x7ea5('0x123')]>=_0x5309d0[_0x7ea5('0x198')]-0x1){return!![];}else{hopperUtils[_0x7ea5('0xde')]({'active':![],'countnosuchnumberretry':_0x3ad0bd[_0x7ea5('0x123')]+=0x1,'scheduledat':moment()['add'](_0x5309d0[_0x7ea5('0x199')],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd['ListId'],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x19a')));}break;case 0xa:if(_0x3ad0bd[_0x7ea5('0xdc')]>=_0x5309d0[_0x7ea5('0x19b')]-0x1){return!![];}hopperUtils[_0x7ea5('0xde')]({'active':![],'countdropretry':_0x3ad0bd[_0x7ea5('0xdc')]+=0x1,'scheduledat':moment()[_0x7ea5('0xdf')](_0x5309d0[_0x7ea5('0xd8')],_0x7ea5('0xe0'))[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3ad0bd['ContactId'],'ListId':_0x3ad0bd[_0x7ea5('0x106')],'VoiceQueueId':_0x3ad0bd['VoiceQueueId']||undefined,'CampaignId':_0x3ad0bd['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x19c')));break;case 0xb:if(_0x3ad0bd[_0x7ea5('0xef')]>=_0x5309d0['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x7ea5('0xde')]({'active':![],'countabandonedretry':_0x3ad0bd['countabandonedretry']+=0x1,'scheduledat':moment()[_0x7ea5('0xdf')](_0x5309d0[_0x7ea5('0xec')],_0x7ea5('0xe0'))['format'](_0x7ea5('0xc5')),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd['ListId'],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd['CampaignId']||undefined})['catch'](loggerCatch(_0x7ea5('0xf0')));break;case 0x13:if(_0x3ad0bd[_0x7ea5('0x11e')]>=_0x5309d0[_0x7ea5('0x126')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3ad0bd[_0x7ea5('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x5309d0[_0x7ea5('0x129')],_0x7ea5('0xe0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd['ListId'],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd[_0x7ea5('0xe3')]||undefined})[_0x7ea5('0xa3')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3ad0bd[_0x7ea5('0x12e')]>=_0x5309d0[_0x7ea5('0x19d')]-0x1){return!![];}hopperUtils[_0x7ea5('0xde')]({'active':![],'countagentrejectretry':_0x3ad0bd[_0x7ea5('0x12e')]+=0x1,'scheduledat':moment()[_0x7ea5('0xdf')](_0x5309d0[_0x7ea5('0x19e')],'minutes')[_0x7ea5('0x47')](_0x7ea5('0xc5')),'ContactId':_0x3ad0bd[_0x7ea5('0xe1')],'ListId':_0x3ad0bd[_0x7ea5('0x106')],'VoiceQueueId':_0x3ad0bd[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x3ad0bd[_0x7ea5('0xe3')]||undefined})['catch'](loggerCatch(_0x7ea5('0x19f')));break;default:return!![];}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x10c')]=function(_0x50ebd6,_0x212c64,_0x1a60d3){var _0x2bb99b=this;var _0x563dd7=new History(_0x50ebd6);var _0x26efb1=![];var _0x4628d0;var _0x305b22;return new Promise(function(_0x4f3f6e,_0x3e5a78){if(_['isUndefined'](_0x212c64)&&typeof _0x212c64!==_0x7ea5('0x15c')){return _0x3e5a78(msgResponse(_0x7ea5('0x1a0'),_0x7ea5('0x96'),'entity\x20is\x20undefine'));}if(_[_0x7ea5('0x41')](_0x1a60d3)&&typeof _0x1a60d3!==_0x7ea5('0x15c')){return _0x3e5a78(msgResponse(_0x7ea5('0x1a0'),_0x7ea5('0x96'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x563dd7,_0x1a60d3['reason'],_0x212c64)[_0x7ea5('0x40')](function(_0x321a92){if(_0x321a92[_0x7ea5('0xdd')]==0x1)_0x26efb1=!![];switch(_0x1a60d3[_0x7ea5('0xc7')]){case'0':_0x212c64[_0x7ea5('0x1a1')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0x0;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0x1a2');_0x563dd7[_0x7ea5('0x123')]+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;ami[_0x7ea5('0x115')](_0x7ea5('0x1a3'),ut[_0x7ea5('0x11f')](_0x50ebd6,'nosuchnumber'));_0x4628d0=_0x212c64[_0x7ea5('0x199')];_0x305b22=_0x212c64[_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xcc')](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x120')));if(_0x2bb99b[_0x7ea5('0x1a4')](0x0,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7['countnosuchnumberretry']>=_0x212c64['dialNoSuchNumberMaxRetry']){_0x2bb99b['createStateFinal'](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1a5'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1a5'));}}break;case'3':_0x212c64[_0x7ea5('0x1a7')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0x3;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0x1a8');_0x563dd7[_0x7ea5('0x12d')]+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;var _0x43a63c=ut[_0x7ea5('0x1a9')](_0x50ebd6,_0x212c64);ami[_0x7ea5('0x115')](_0x7ea5('0x1aa'),_0x43a63c);_0x4628d0=_0x212c64['dialNoAnswerRetryFrequency'];_0x305b22=_0x212c64[_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xcc')](_0x563dd7)['catch'](loggerCatch(_0x7ea5('0x1ab')));if(_0x2bb99b[_0x7ea5('0x1a4')](0x3,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0x12d')]>=_0x212c64[_0x7ea5('0x192')]){_0x2bb99b[_0x7ea5('0x127')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1ac'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1ac'));}}break;case'5':_0x212c64[_0x7ea5('0x1ad')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0x5;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0x1ae');_0x563dd7['countbusyretry']+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;ami[_0x7ea5('0x115')](_0x7ea5('0x1af'),ut['buildObj'](_0x50ebd6,'busy'));_0x4628d0=_0x212c64['dialBusyRetryFrequency'];_0x305b22=_0x212c64[_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xcc')](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2bb99b['checkRetriveMax'](0x5,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0x121')]>=_0x212c64[_0x7ea5('0x194')]){_0x2bb99b[_0x7ea5('0x127')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1b0'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1b0'));}}break;case'8':_0x212c64[_0x7ea5('0x1b1')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0x8;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0x1b2');_0x563dd7[_0x7ea5('0x122')]+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;_0x4628d0=_0x212c64['dialCongestionRetryFrequency'];_0x305b22=_0x212c64['callAdditionalPhoneAfterMin'];ami[_0x7ea5('0x115')](_0x7ea5('0x1b3'),ut[_0x7ea5('0x11f')](_0x50ebd6,_0x7ea5('0x1b4')));hopperUtils[_0x7ea5('0xcc')](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2bb99b['checkRetriveMax'](0x8,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0x122')]>=_0x212c64[_0x7ea5('0x197')]){_0x2bb99b['createStateFinal'](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1b5'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,'reason\x208\x20congestion');}}break;case'11':_0x212c64[_0x7ea5('0x1b6')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0xb;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0xea');_0x563dd7[_0x7ea5('0xef')]+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;_0x4628d0=_0x212c64[_0x7ea5('0xec')];_0x305b22=_0x212c64[_0x7ea5('0xd9')];hopperUtils['createHistory'](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0xf1')));if(_0x2bb99b[_0x7ea5('0x1a4')](0xb,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0xef')]>=_0x212c64[_0x7ea5('0xed')]){_0x2bb99b['createStateFinal'](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1b7'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1b7'));}}break;case'20':_0x212c64[_0x7ea5('0x1b8')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0x14;_0x563dd7[_0x7ea5('0xd4')]=_0x7ea5('0x1b9');_0x563dd7['countagentrejectretry']+=0x1;_0x563dd7[_0x7ea5('0xd7')]+=0x1;_0x4628d0=_0x212c64['dialAgentRejectRetryFrequency'];_0x305b22=_0x212c64[_0x7ea5('0xd9')];ami['emit'](_0x7ea5('0x1ba'),ut['buildObj'](_0x50ebd6,_0x7ea5('0x1bb')));hopperUtils['createHistory'](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2bb99b[_0x7ea5('0x1a4')](0x14,_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0x12e')]>=_0x212c64[_0x7ea5('0x19d')]){_0x2bb99b[_0x7ea5('0x127')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1bc'));}else{_0x2bb99b[_0x7ea5('0x1a6')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x7ea5('0x1bc'));}}break;default:_0x212c64[_0x7ea5('0x134')]+=0x1;_0x563dd7[_0x7ea5('0x72')]=0xc;_0x563dd7[_0x7ea5('0xd4')]=_0x1a60d3[_0x7ea5('0xc7')];_0x4628d0=_0x212c64[_0x7ea5('0x19e')];_0x305b22=_0x212c64[_0x7ea5('0xd9')];hopperUtils[_0x7ea5('0xcc')](_0x563dd7)[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x1bd')));if(_0x2bb99b['checkRetriveMax'](_0x1a60d3[_0x7ea5('0xc7')],_0x50ebd6,_0x212c64)&&!_0x26efb1){if(_0x563dd7[_0x7ea5('0x121')]+_0x563dd7[_0x7ea5('0x122')]+_0x563dd7[_0x7ea5('0x12d')]+_0x563dd7[_0x7ea5('0x123')]+_0x563dd7['countdropretry']+_0x563dd7['countabandonedretry']+_0x563dd7['countmachineretry']+_0x563dd7[_0x7ea5('0x12e')]>=_0x212c64['dialGlobalMaxRetry']){_0x2bb99b['stateGlobal'](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x1a60d3[_0x7ea5('0xc7')]);}else{_0x2bb99b[_0x7ea5('0x127')](_0x563dd7,_0x4f3f6e,_0x3e5a78,_0x1a60d3[_0x7ea5('0xc7')]);}}}})['then'](function(){if(_0x26efb1){hopperUtils[_0x7ea5('0xe8')](_0x563dd7,_0x4628d0,_0x305b22)[_0x7ea5('0x40')](function(){return _0x4f3f6e(0x1);});}});});};Dialer[_0x7ea5('0x17')]['stateGlobal']=function(_0x4b5f8d,_0x589ea5,_0x16877e,_0x1c2ad8){var _0x2e83c9=new Final(_0x4b5f8d);_0x2e83c9[_0x7ea5('0x72')]=0xf;_0x2e83c9['statedesc']='Global';this['createStateFinal'](_0x2e83c9,_0x589ea5,_0x16877e,_0x1c2ad8);};Dialer[_0x7ea5('0x17')][_0x7ea5('0x127')]=function(_0x3b762d,_0x255668,_0x1927b3,_0x40de03){hopperUtils[_0x7ea5('0xcd')](_0x3b762d)[_0x7ea5('0x40')](function(){return _0x255668(msgResponse('[callProgressDetecting]',_0x7ea5('0x10b'),_0x40de03));})[_0x7ea5('0xa3')](function(){return _0x1927b3(msgResponse(_0x7ea5('0x1be'),_0x7ea5('0x96'),_0x7ea5('0x1bf')));});};Dialer[_0x7ea5('0x17')][_0x7ea5('0x9')]=function(_0x29a9b2){var _0x4ab6a7=_0x29a9b2[_0x7ea5('0x1c0')]/0x64;var _0x44634a=_0x29a9b2[_0x7ea5('0xd2')]/(_0x29a9b2[_0x7ea5('0xd2')]+_0x29a9b2[_0x7ea5('0xc6')]);var _0x119e9f=Math[_0x7ea5('0x1c1')](_0x29a9b2['predictiveIntervalAvailable']*(_0x29a9b2[_0x7ea5('0x1c2')]/0x64));var _0x1d0e63=Math[_0x7ea5('0x1c1')](_0x29a9b2['predictiveIntervalAvailable']*(_0x29a9b2[_0x7ea5('0x1c3')]/0x64));var _0x3467f6=_0x29a9b2[_0x7ea5('0x13c')]+_0x29a9b2[_0x7ea5('0x13e')];var _0x2bff03=Math[_0x7ea5('0x1c4')](_0x29a9b2[_0x7ea5('0x1c5')]*_0x29a9b2[_0x7ea5('0x5e')]*_0x29a9b2[_0x7ea5('0x1c6')]*_0x29a9b2[_0x7ea5('0x1c7')]);if(_[_0x7ea5('0x41')](_0x29a9b2['startProgressive'])){if(!_[_0x7ea5('0x41')](_0x29a9b2['startPredictive'])){_0x29a9b2[_0x7ea5('0x26')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x7ea5('0x1c8'));}if(!_[_0x7ea5('0x41')](_0x29a9b2[_0x7ea5('0x66')])){loggerPredictive[_0x7ea5('0x67')](_0x7ea5('0x1c9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x29a9b2[_0x7ea5('0x66')]);_0x29a9b2[_0x7ea5('0x66')]=undefined;}_0x29a9b2['startProgressive']=moment()[_0x7ea5('0x47')](_0x7ea5('0xc5'));loggerPredictive[_0x7ea5('0x4a')](_0x29a9b2[_0x7ea5('0x48')],_0x7ea5('0x1ca'),_0x29a9b2['startProgressive']);this[_0x7ea5('0xb9')](_0x29a9b2,0x1);}else if(ifInterval(_0x29a9b2['dialPredictiveInterval'],_0x29a9b2['startProgressive'])){this[_0x7ea5('0xb9')](_0x29a9b2,0x1);loggerPredictiveCalls[_0x7ea5('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x29a9b2['startProgressive'],_0x29a9b2[_0x7ea5('0x48')]);_0x29a9b2[_0x7ea5('0x1c5')]=0x0;_0x29a9b2[_0x7ea5('0xd3')]=0x0;}else if(_0x4ab6a7<_0x44634a&&_0x29a9b2[_0x7ea5('0x1cb')]===_0x7ea5('0x1cc')){clearPredictiveAttributes(_0x29a9b2);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x1cd'),_0x7ea5('0x1ce'),_0x44634a,_0x7ea5('0x27'),_0x29a9b2[_0x7ea5('0x48')]);}else if(_0x2bff03<_0x29a9b2[_0x7ea5('0xd3')]&&_0x29a9b2[_0x7ea5('0x1cb')]===_0x7ea5('0x1cc')){clearPredictiveAttributes(_0x29a9b2);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x1cf'),_0x7ea5('0x1d0'),_0x2bff03,_0x7ea5('0x1d1'),_0x29a9b2['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x29a9b2['name']);}else if(!ifInterval(_0x29a9b2[_0x7ea5('0x1d2')],_0x29a9b2[_0x7ea5('0x27')])&&_[_0x7ea5('0x41')](_0x29a9b2[_0x7ea5('0x26')])&&!_[_0x7ea5('0x41')](_0x29a9b2[_0x7ea5('0x27')])){_0x29a9b2[_0x7ea5('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7ea5('0x4a')](_0x29a9b2['name'],'started\x20in\x20predictive\x20at',_0x29a9b2[_0x7ea5('0x26')]);hopperUtils[_0x7ea5('0x1d3')](_0x29a9b2['dialPredictiveInterval'])[_0x7ea5('0x40')](this[_0x7ea5('0x1d4')](_0x29a9b2))[_0x7ea5('0x40')](mergeDataErlangB(_0x29a9b2))[_0x7ea5('0x40')](this[_0x7ea5('0x1d5')](_0x29a9b2))[_0x7ea5('0xa3')](loggerCatchPredictive(_0x7ea5('0x1d6'),_0x29a9b2));}else if(!ifInterval(_0x29a9b2[_0x7ea5('0x1d2')],_0x29a9b2[_0x7ea5('0x26')])){_0x29a9b2[_0x7ea5('0xd3')]=0x0;_0x29a9b2[_0x7ea5('0x26')]=moment()[_0x7ea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x29a9b2['name'],_0x7ea5('0x1d7'),_0x29a9b2[_0x7ea5('0x26')]);clearInterval(_0x29a9b2[_0x7ea5('0x66')]);_0x29a9b2[_0x7ea5('0x66')]=undefined;hopperUtils['avgHandleTime'](_0x29a9b2[_0x7ea5('0x1d2')])[_0x7ea5('0x40')](this['getDataPredictive'](_0x29a9b2))[_0x7ea5('0x40')](mergeDataErlangB(_0x29a9b2))[_0x7ea5('0x40')](this['startMethodPredictive'](_0x29a9b2))['catch'](loggerCatchPredictive(_0x7ea5('0x1d8'),_0x29a9b2));}else if(_0x29a9b2['predictiveIntervalAvailable']&&_0x3467f6<_0x29a9b2[_0x7ea5('0x1d9')]-_0x1d0e63){clearPredictiveAttributes(_0x29a9b2);loggerPredictive['info'](_0x29a9b2[_0x7ea5('0x48')],_0x7ea5('0x1da'),_0x3467f6,_0x7ea5('0x1db'),_0x29a9b2[_0x7ea5('0x1d9')],'-',_0x1d0e63,'=',_0x29a9b2[_0x7ea5('0x1d9')]-_0x1d0e63,')');}else if(_0x29a9b2[_0x7ea5('0x1d9')]&&_0x3467f6>_0x29a9b2[_0x7ea5('0x1d9')]+_0x119e9f){clearPredictiveAttributes(_0x29a9b2);loggerPredictive[_0x7ea5('0x4a')](_0x29a9b2[_0x7ea5('0x48')],_0x7ea5('0x1da'),_0x3467f6,_0x7ea5('0x1dc'),_0x29a9b2[_0x7ea5('0x1d9')],'+',_0x119e9f,'=',_0x29a9b2[_0x7ea5('0x1d9')]+_0x119e9f,')');}};Dialer['prototype'][_0x7ea5('0x1d4')]=function(_0x95332c){var _0x3c68fa=this;return function(_0x5785ec){return new Promise(function(_0x588e3d,_0x17017e){_[_0x7ea5('0x62')](_0x95332c,_0x5785ec[0x0]);if(checkGetDataPredictive(_0x5785ec[0x0])){var _0x497103=_0x95332c[_0x7ea5('0x1d9')]=_0x95332c[_0x7ea5('0x13e')]+_0x95332c[_0x7ea5('0x13c')];var _0x11a6dd=_0x95332c[_0x7ea5('0x1d2')]*0x3c;var _0x58d9b4=_0x5785ec[0x0][_0x7ea5('0x56')]+_0x5785ec[0x0][_0x7ea5('0x54')];var _0x456624=(_0x5785ec[0x0][_0x7ea5('0x4e')]+_0x5785ec[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5785ec[0x0][_0x7ea5('0x52')])/_0x5785ec[0x0][_0x7ea5('0x4c')];_0x95332c[_0x7ea5('0x1c6')]=_0x456624>0x0?_0x456624:0x1;switch(_0x95332c['dialPredictiveOptimization']){case _0x7ea5('0x1cc'):var _0x75a625=_0x95332c['dialPredictiveOptimizationPercentage']/0x64;return _0x3c68fa[_0x7ea5('0x1dd')](_0x497103,_0x11a6dd,_0x58d9b4,_0x456624,_0x75a625)[_0x7ea5('0x40')](function(_0x367c0b){return _0x588e3d(_0x367c0b);});case _0x7ea5('0x1de'):var _0x448847=_0x95332c[_0x7ea5('0x1c0')]/0x64;return _0x3c68fa[_0x7ea5('0x1df')](_0x497103,_0x11a6dd,_0x58d9b4,_0x456624,_0x448847)[_0x7ea5('0x40')](function(_0xde47c8){return _0x588e3d(_0xde47c8);});default:return _0x17017e(msgResponse('[getDataPredictive]',_0x7ea5('0x96'),'Unknown\x20Predictive'));}}else{return _0x17017e(msgResponse(_0x7ea5('0x1e0'),'Failure','check\x20failure'));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x45d7ca){var _0x5265ce=this;return function(_0x21ce7a){return new Promise(function(_0x18b095,_0x2947e4){_[_0x7ea5('0x62')](_0x45d7ca,_0x21ce7a[0x0]);if(checkGetDataPredictive(_0x21ce7a[0x0])){loggerPredictive[_0x7ea5('0x4a')](JSON[_0x7ea5('0x76')](_0x21ce7a[0x0]));if(_0x45d7ca[_0x7ea5('0x1cb')]===_0x7ea5('0x1cc')){return _0x5265ce[_0x7ea5('0x14f')](_0x45d7ca['id'])[_0x7ea5('0x40')](function(_0x540328){var _0x5e3980=_0x45d7ca[_0x7ea5('0x1e1')]-_0x540328[0x0]['outboundQueuePauses'];var _0x15b67d=_0x45d7ca[_0x7ea5('0x1d2')]*0x3c;var _0x1be9b6=_0x21ce7a[0x0][_0x7ea5('0x56')]+_0x21ce7a[0x0][_0x7ea5('0x54')];var _0x15e4eb=(_0x21ce7a[0x0][_0x7ea5('0x4e')]+_0x21ce7a[0x0][_0x7ea5('0x50')]+_0x21ce7a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x21ce7a[0x0][_0x7ea5('0x4c')];var _0x2fec77=_0x45d7ca[_0x7ea5('0x1c0')]/0x64;_0x45d7ca['predictiveIntervalPauses']=_0x540328[0x0]['outboundQueuePauses']||0x0;_0x45d7ca[_0x7ea5('0x1c6')]=_0x15e4eb>0x0?_0x15e4eb:0x1;return _0x5265ce['abandonmentRate'](_0x5e3980,_0x15b67d,_0x1be9b6,_0x15e4eb,_0x2fec77);})['then'](function(_0x3c4e9d){return _0x18b095(_0x3c4e9d);})[_0x7ea5('0xa3')](function(_0x55d83e){return _0x2947e4(msgResponse(_0x7ea5('0x1e2'),_0x7ea5('0x96'),JSON['stringify'](_0x55d83e)));});}if(_0x45d7ca[_0x7ea5('0x1cb')]===_0x7ea5('0x1de')){return _0x5265ce[_0x7ea5('0x14f')](_0x45d7ca['id'])[_0x7ea5('0x40')](function(_0x123bd){var _0x16ebbd=_0x45d7ca[_0x7ea5('0x1e1')]-_0x123bd[0x0][_0x7ea5('0x1e3')];var _0x4526c0=_0x45d7ca[_0x7ea5('0x1d2')]*0x3c;var _0x297d74=_0x21ce7a[0x0]['predictiveIntervalAvgTalktime']+_0x21ce7a[0x0][_0x7ea5('0x54')];var _0x1d3cc6=(_0x21ce7a[0x0]['predictiveIntervalAnsweredCalls']+_0x21ce7a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x21ce7a[0x0][_0x7ea5('0x52')])/_0x21ce7a[0x0][_0x7ea5('0x4c')];var _0x1305e8=_0x45d7ca['dialPredictiveOptimizationPercentage']/0x64;_0x45d7ca[_0x7ea5('0x1e4')]=_0x123bd[0x0]['outboundQueuePauses']||0x0;_0x45d7ca['predictiveIntervalHitRate']=_0x1d3cc6>0x0?_0x1d3cc6:0x1;return _0x5265ce['busyFactor'](_0x16ebbd,_0x4526c0,_0x297d74,_0x1d3cc6,_0x1305e8);})[_0x7ea5('0x40')](function(_0x536bad){return _0x18b095(_0x536bad);})[_0x7ea5('0xa3')](function(_0x1d79ed){return _0x2947e4(msgResponse(_0x7ea5('0x1e2'),_0x7ea5('0x96'),JSON['stringify'](_0x1d79ed)));});}}else{return _0x2947e4(msgResponse('[getDataPredictive]',_0x7ea5('0x96'),'check\x20failure'));}});};};Dialer[_0x7ea5('0x17')]['startMethodPredictive']=function(_0x397331){var _0xff36dd=this;return function(){var _0x22924c=0x0;var _0x31d880=Math[_0x7ea5('0x1c4')](_0x397331[_0x7ea5('0x5d')]*0x3e8);if(_0x31d880>0x0){_0x31d880=_0x31d880<0x64?0x64:_0x31d880;loggerPredictive[_0x7ea5('0x4a')](_0x397331[_0x7ea5('0x48')],_0x7ea5('0x1e5'),_0x31d880,_0x7ea5('0x1e6'));_0x397331['handlePredictive']=setInterval(function(){_0xff36dd[_0x7ea5('0x66')](_0x397331);loggerPredictiveCalls['info'](_0x7ea5('0x1e7'),_0x22924c+=0x1);},_0x31d880);}else{loggerPredictive['info'](_0x397331[_0x7ea5('0x48')],_0x7ea5('0x1e8'));}};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x1e9')]=function(_0x3009b3,_0x18a1b0){var _0x7652d6=this;return function(_0x531687){if(_[_0x7ea5('0x7c')](_0x531687)){if(_[_0x7ea5('0xf7')](_0x18a1b0['UserId'])||!_0x18a1b0[_0x7ea5('0x1ea')]){if(_0x3009b3[_0x7ea5('0xb5')]==='booked'){_0x3009b3[_0x7ea5('0x74')]=_[_0x7ea5('0x41')](_0x3009b3[_0x7ea5('0x74')])?!![]:_0x3009b3[_0x7ea5('0x74')];var _0x115c49=uuid['v4']();_0x7652d6[_0x7ea5('0x22')][_0x115c49]=new Action(_0x3009b3,_0x18a1b0,_0x115c49);loggerBooked['info']('[booked][checkContactBlack]',_0x115c49,_0x7ea5('0x1eb'),JSON[_0x7ea5('0x76')](_0x3009b3['queueStatusComplete']),_0x7ea5('0x1ec'),_0x3009b3[_0x7ea5('0x48')]);if(_0x3009b3[_0x7ea5('0x74')]){_0x3009b3[_0x7ea5('0x74')]=![];_0x7652d6[_0x7ea5('0x29')][_0x7652d6[_0x7ea5('0x22')][_0x115c49][_0x7ea5('0xc1')]]=[];ami[_0x7ea5('0xa4')]({'actionid':_0x115c49,'action':_0x7ea5('0x1ed'),'queue':_0x3009b3[_0x7ea5('0x48')]})[_0x7ea5('0xa3')](function(){_0x7652d6[_0x7ea5('0xc4')](_0x3009b3);hopperUtils[_0x7ea5('0xde')]({'active':![],'ContactId':_0x7652d6['actions'][_0x115c49][_0x7ea5('0xe1')],'ListId':_0x7652d6[_0x7ea5('0x22')][_0x115c49][_0x7ea5('0x106')],'VoiceQueueId':_0x7652d6[_0x7ea5('0x22')][_0x115c49]['VoiceQueueId']||undefined,'CampaignId':_0x7652d6[_0x7ea5('0x22')][_0x115c49]['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x1ee')));delete _0x7652d6[_0x7ea5('0x22')][_0x115c49];});}else{loggerBooked[_0x7ea5('0x4a')](_0x7ea5('0x1ef'),JSON[_0x7ea5('0x76')](_0x3009b3[_0x7ea5('0x74')]),_0x7ea5('0x1ec'),_0x3009b3[_0x7ea5('0x48')]);_0x7652d6['updateOriginated'](_0x3009b3);hopperUtils[_0x7ea5('0xde')]({'active':![],'ContactId':_0x7652d6[_0x7ea5('0x22')][_0x115c49]['ContactId'],'ListId':_0x7652d6[_0x7ea5('0x22')][_0x115c49][_0x7ea5('0x106')],'VoiceQueueId':_0x7652d6[_0x7ea5('0x22')][_0x115c49][_0x7ea5('0xe2')]||undefined,'CampaignId':_0x7652d6[_0x7ea5('0x22')][_0x115c49]['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x1ee')));delete _0x7652d6[_0x7ea5('0x22')][_0x115c49];}}else{return _0x7652d6[_0x7ea5('0x15b')](_0x3009b3,_0x18a1b0);}}else{if(utils[_0x7ea5('0x63')](undefined,_0x18a1b0[_0x7ea5('0x1f0')])<_0x3009b3[_0x7ea5('0x1f1')]*0x3c){if(_0x18a1b0[_0x7ea5('0x149')]&&!_0x18a1b0[_0x7ea5('0x149')]['voicePause']){_0x7652d6[_0x7ea5('0x1c')][_0x7ea5('0x103')](_0x18a1b0['id'])['finally'](function(){_0x7652d6[_0x7ea5('0xc4')](_0x3009b3);});}else{hopperUtils['unlockContact']({'active':![]},_0x18a1b0['id'],0x1)[_0x7ea5('0x1a')](function(){_0x7652d6[_0x7ea5('0xc4')](_0x3009b3);});}}else{_0x3009b3['outboundReCallsDay']+=0x1;_0x7652d6[_0x7ea5('0xc4')](_0x3009b3);if(_0x3009b3['dialRecallInQueue']){hopperUtils[_0x7ea5('0xde')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x18a1b0[_0x7ea5('0xe1')],'ListId':_0x18a1b0[_0x7ea5('0x106')],'VoiceQueueId':_0x18a1b0[_0x7ea5('0xe2')]||undefined,'CampaignId':_0x18a1b0['CampaignId']||undefined})[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x1f2')));hopperUtils[_0x7ea5('0xcc')](createObjHistory(_0x3009b3,_0x18a1b0,utils[_0x7ea5('0x6c')][_0x7ea5('0x1f3')],0x17,_0x7ea5('0x1f4')))[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x1f5')));}else{_0x7652d6[_0x7ea5('0x12b')](createObjHistory(_0x3009b3,_0x18a1b0,utils[_0x7ea5('0x6c')]['RECALL_TIMEOUT'],0x16,_0x7ea5('0x1f6')),_0x7ea5('0x1f7'),_0x7ea5('0x1f8'));}}}}else{_0x3009b3['outboundBlacklistCallsDay']+=0x1;_0x7652d6[_0x7ea5('0x12b')](createObjHistory(_0x3009b3,_0x18a1b0,utils[_0x7ea5('0x6c')]['BLACKLIST'],0xd,_0x7ea5('0x1f9')),_0x7ea5('0x1fa'),_0x7ea5('0x1fb'));throw _0x7ea5('0x1fc');}};};Dialer[_0x7ea5('0x17')][_0x7ea5('0x1fd')]=function(_0x303841){var _0x5bf491=this;var _0x3dfa2f=_0x303841[_0x7ea5('0x1fe')]-_0x303841[_0x7ea5('0x82')]-_0x303841[_0x7ea5('0x1ff')];emitCampaignSummary(_0x303841);if(_0x3dfa2f>0x0){if(_0x3dfa2f>this[_0x7ea5('0x20')]){_0x3dfa2f=this[_0x7ea5('0x20')];}_0x303841['temp']+=_0x3dfa2f;hopperUtils['getContactDialerIvr'](_0x303841['id'],_0x3dfa2f,_0x303841['dialOrderByScheduledAt'],_0x303841)[_0x7ea5('0x40')](function(_0x1016dd){_0x303841[_0x7ea5('0x1ff')]-=_0x3dfa2f;_0x303841[_0x7ea5('0x1ff')]=_0x303841[_0x7ea5('0x1ff')]>0x0?_0x303841['temp']:0x0;if(!utils[_0x7ea5('0x200')](_0x1016dd)){_0x303841['message']=utils[_0x7ea5('0x6c')]['NO_AVAILABLE_CONTACTS'];logger[_0x7ea5('0x4a')](_0x7ea5('0x201')+_0x303841[_0x7ea5('0x48')]);}else{_0x303841['originated']+=_0x1016dd[_0x7ea5('0x9c')];_0x303841[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x202')];for(var _0x30f06c=0x0;_0x30f06c<_0x1016dd[_0x7ea5('0x9c')];_0x30f06c+=0x1){_0x303841['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x1016dd[_0x30f06c])||_[_0x7ea5('0xf7')](_0x1016dd[_0x30f06c]['Contact'])||_[_0x7ea5('0xf7')](_0x1016dd[_0x30f06c][_0x7ea5('0x15f')])){_0x5bf491[_0x7ea5('0x153')]('[actionOriginate]\x20',_0x303841,_0x1016dd[_0x30f06c]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x7ea5('0x77')](_0x1016dd[_0x30f06c],[_0x7ea5('0xe3'),'phone']))[_0x7ea5('0x40')](_0x5bf491[_0x7ea5('0x1e9')](_0x303841,_0x1016dd[_0x30f06c]))[_0x7ea5('0xa3')](_0x5bf491[_0x7ea5('0x203')]('[actionOriginateIvr]\x20',_0x303841));}}}})['catch'](loggerGetContactDialer(_0x7ea5('0x204'),_0x303841,_0x3dfa2f));}};Dialer['prototype'][_0x7ea5('0xb9')]=function(_0x4e64f1,_0x10be2d){var _0x410e6b=this;var _0x49efa6=[];if(_0x10be2d<0x1||_0x4e64f1['dialMethod']===_0x7ea5('0x8')){_0x10be2d=0x1;}var _0x17f74a=Math[_0x7ea5('0x1c4')](_0x4e64f1[_0x7ea5('0x13c')]*_0x10be2d)-_0x4e64f1['originated']-_0x4e64f1[_0x7ea5('0x1ff')];if(_0x4e64f1[_0x7ea5('0x205')]>0x0){var _0x25938e=_0x4e64f1['dialLimitQueue']-_0x4e64f1[_0x7ea5('0x82')]-_0x4e64f1[_0x7ea5('0x13e')]-_0x4e64f1['temp']-_0x4e64f1['pTalking'];if(_0x17f74a>_0x25938e){_0x17f74a=_0x25938e;}}if(_0x17f74a>0x0){if(_0x4e64f1[_0x7ea5('0xb5')]===_0x7ea5('0x8')){_0x17f74a=0x1;}if(_0x17f74a>this[_0x7ea5('0x20')]){_0x17f74a=this[_0x7ea5('0x20')];}_0x4e64f1[_0x7ea5('0x1ff')]+=_0x17f74a;for(var _0x5076f0 in this['agents']){if(typeof this[_0x7ea5('0x1f')][_0x5076f0]!==_0x7ea5('0x14c')){if(this[_0x7ea5('0x1f')][_0x5076f0]['state']===_0x7ea5('0x206')&&this[_0x7ea5('0x1f')][_0x5076f0][_0x7ea5('0x8a')]===_0x7ea5('0x147')){_0x49efa6[_0x7ea5('0x9d')](this[_0x7ea5('0x1f')][_0x5076f0]['id']);}}}hopperUtils['getContactDialer'](_0x4e64f1,_0x49efa6,_0x17f74a)['then'](function(_0x233c07){_0x4e64f1[_0x7ea5('0x1ff')]-=_0x17f74a;_0x4e64f1[_0x7ea5('0x1ff')]=_0x4e64f1[_0x7ea5('0x1ff')]>0x0?_0x4e64f1[_0x7ea5('0x1ff')]:0x0;if(!utils[_0x7ea5('0x200')](_0x233c07)){hopperUtils[_0x7ea5('0x207')](_0x4e64f1)[_0x7ea5('0x40')](sendMessageReschedule(_0x4e64f1))[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x208')));}else{_0x4e64f1[_0x7ea5('0x82')]+=_0x233c07[_0x7ea5('0x9c')];_0x4e64f1[_0x7ea5('0x6b')]=_0x4e64f1[_0x7ea5('0xb5')]==='booked'?utils[_0x7ea5('0x6c')][_0x7ea5('0x167')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x11cb83=0x0;_0x11cb83<_0x233c07[_0x7ea5('0x9c')];_0x11cb83+=0x1){if(_[_0x7ea5('0xf7')](_0x233c07[_0x11cb83])||_[_0x7ea5('0xf7')](_0x233c07[_0x11cb83]['Contact'])||_[_0x7ea5('0xf7')](_0x233c07[_0x11cb83]['phone'])){_0x410e6b[_0x7ea5('0x153')](_0x7ea5('0x209'),_0x4e64f1,_0x233c07[_0x11cb83]);}else{hopperUtils[_0x7ea5('0x20a')](_[_0x7ea5('0x77')](_0x233c07[_0x11cb83],['VoiceQueueId',_0x7ea5('0x15f')]))[_0x7ea5('0x40')](_0x410e6b[_0x7ea5('0x1e9')](_0x4e64f1,_0x233c07[_0x11cb83]))[_0x7ea5('0xa3')](_0x410e6b[_0x7ea5('0x203')](_0x7ea5('0x209'),_0x4e64f1));}}}})[_0x7ea5('0xa3')](loggerGetContactDialer(_0x7ea5('0x20b'),_0x4e64f1,_0x17f74a));}};Dialer['prototype'][_0x7ea5('0x66')]=function(_0x23df27){if(_0x23df27[_0x7ea5('0x205')]>0x0){var _0x57889c=_0x23df27['dialLimitQueue']-_0x23df27[_0x7ea5('0x82')]-_0x23df27['talking'];if(_0x57889c>0x0){this[_0x7ea5('0x20c')](_0x23df27);}else{loggerPredictiveCalls[_0x7ea5('0x4a')](_0x7ea5('0x20d'));}}else{this[_0x7ea5('0x20c')](_0x23df27);}};Dialer[_0x7ea5('0x17')][_0x7ea5('0x20c')]=function(_0x3e2bfe){var _0x1d44dc=this;var _0x14f07e=[];_0x3e2bfe[_0x7ea5('0x82')]+=0x1;for(var _0x38f398 in this['agents']){if(typeof this[_0x7ea5('0x1f')][_0x38f398]!=='undefined'){if(this[_0x7ea5('0x1f')][_0x38f398][_0x7ea5('0x72')]===_0x7ea5('0x206')&&this[_0x7ea5('0x1f')][_0x38f398]['status']===_0x7ea5('0x147')){_0x14f07e[_0x7ea5('0x9d')](this['agents'][_0x38f398]['id']);}}}return this[_0x7ea5('0x20e')](_0x3e2bfe['id'],_0x14f07e,0x1,_0x3e2bfe['dialOrderByScheduledAt'],_0x3e2bfe)[_0x7ea5('0x40')](function(_0x325dcf){if(!utils[_0x7ea5('0x200')](_0x325dcf)){utils[_0x7ea5('0x69')](_0x3e2bfe,0x1,0x0);return hopperUtils[_0x7ea5('0x207')](_0x3e2bfe)['then'](sendMessageReschedule(_0x3e2bfe))[_0x7ea5('0xa3')](loggerCatch(_0x7ea5('0x208')));}else{_0x3e2bfe[_0x7ea5('0x6b')]=utils[_0x7ea5('0x6c')][_0x7ea5('0x202')];if(_[_0x7ea5('0xf7')](_0x325dcf[0x0])||_[_0x7ea5('0xf7')](_0x325dcf[0x0]['Contact'])||_[_0x7ea5('0xf7')](_0x325dcf[0x0][_0x7ea5('0x15f')])){_0x1d44dc['emptyContact'](_0x7ea5('0x209'),_0x3e2bfe,_0x325dcf[0x0]);}else{return hopperUtils[_0x7ea5('0x20a')](_[_0x7ea5('0x77')](_0x325dcf[0x0],['VoiceQueueId',_0x7ea5('0x15f')]))[_0x7ea5('0x40')](_0x1d44dc[_0x7ea5('0x1e9')](_0x3e2bfe,_0x325dcf[0x0]))[_0x7ea5('0xa3')](_0x1d44dc[_0x7ea5('0x203')]('[actionOriginatePredictive]\x20',_0x3e2bfe));}}})[_0x7ea5('0xa3')](loggerGetContactDialer(_0x7ea5('0x20f'),_0x3e2bfe,0x1));};Dialer[_0x7ea5('0x17')][_0x7ea5('0x1dd')]=function(_0x57a93a,_0x109644,_0x53d3b0,_0x1b6b51,_0x43cb8f,_0x15f94d){loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x210'));loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x211'),_0x57a93a);loggerPredictive['info'](_0x7ea5('0x212'),_0x109644);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x213'),_0x53d3b0);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x214'),_0x1b6b51);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x215'),_0x43cb8f);loggerPredictive[_0x7ea5('0x4a')]('---------------------------');return new Promise(function(_0x384dc3,_0x5665a5){if(_0x57a93a<=0x0||isNaN(_0x57a93a)){return _0x5665a5(msgResponse('[abandonmentRate]','Error',_0x7ea5('0x216')+_0x57a93a));}if(_0x53d3b0<=0x0||isNaN(_0x53d3b0)){return _0x5665a5(msgResponse(_0x7ea5('0x217'),_0x7ea5('0x87'),'Ts\x20=\x20'+_0x53d3b0));}if(_0x1b6b51<=0x0||isNaN(_0x1b6b51)){return _0x5665a5(msgResponse(_0x7ea5('0x217'),_0x7ea5('0x87'),_0x7ea5('0x218')+_0x1b6b51));}if(_0x109644<=0x0||isNaN(_0x109644)){return _0x5665a5(msgResponse(_0x7ea5('0x217'),_0x7ea5('0x87'),_0x7ea5('0x219')+_0x109644));}if(_0x43cb8f<=0x0||isNaN(_0x43cb8f)){return _0x5665a5(msgResponse(_0x7ea5('0x217'),_0x7ea5('0x87'),_0x7ea5('0x21a')+_0x43cb8f));}_0x15f94d=_0x15f94d||0x0;var _0x178ae6=0x1/_0x53d3b0;var _0x76f659=0x0;var _0x3c4105=0x0;var _0x57fdb1=0x0;var _0x38bafa=0x0;for(var _0x5047f7=0x0;_0x57fdb1<_0x43cb8f;_0x5047f7+=0x1){_0x3c4105=_0x5047f7/_0x109644;_0x76f659=(_0x1b6b51*_0x3c4105+_0x15f94d)/_0x178ae6;_0x57fdb1=utils[_0x7ea5('0x21b')](_0x76f659,_0x57a93a);_0x38bafa=_0x76f659/_0x57a93a*(0x1-utils[_0x7ea5('0x21b')](_0x76f659,_0x57a93a));}return _0x384dc3({'erlangCalls':_0x5047f7,'erlangCallToSecond':_0x109644/_0x5047f7,'erlangAbandonmentRate':_0x57fdb1,'erlangBusyFactor':_0x38bafa});});};Dialer[_0x7ea5('0x17')][_0x7ea5('0x1df')]=function(_0x10e523,_0x2b56ff,_0x421308,_0x4ce044,_0x3d3a7a,_0x5085d5){loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x21c'));loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x211'),_0x10e523);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x212'),_0x2b56ff);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x213'),_0x421308);loggerPredictive['info'](_0x7ea5('0x214'),_0x4ce044);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x21d'),_0x3d3a7a);loggerPredictive[_0x7ea5('0x4a')](_0x7ea5('0x61'));return new Promise(function(_0x112e24,_0x119b35){if(_0x10e523<=0x0||isNaN(_0x10e523)){return _0x119b35(msgResponse(_0x7ea5('0x21e'),_0x7ea5('0x87'),_0x7ea5('0x216')+_0x10e523));}if(_0x421308<=0x0||isNaN(_0x421308)){return _0x119b35(msgResponse('[busyFactor]',_0x7ea5('0x87'),'Ts\x20=\x20'+_0x421308));}if(_0x4ce044<=0x0||isNaN(_0x4ce044)){return _0x119b35(msgResponse(_0x7ea5('0x21e'),_0x7ea5('0x87'),_0x7ea5('0x218')+_0x4ce044));}if(_0x2b56ff<=0x0||isNaN(_0x2b56ff)){return _0x119b35(msgResponse(_0x7ea5('0x21e'),_0x7ea5('0x87'),'interval\x20=\x20'+_0x2b56ff));}if(_0x3d3a7a<=0x0||isNaN(_0x3d3a7a)){return _0x119b35(msgResponse(_0x7ea5('0x21e'),_0x7ea5('0x87'),_0x7ea5('0x21f')+_0x3d3a7a));}_0x5085d5=_0x5085d5||0x0;var _0x3e04f4=0x1/_0x421308;var _0x6217fb=0x0;var _0x17d9aa=0x0;var _0xc54465=0x0;var _0x1f171e=0x0;for(var _0x26b34a=0x0;_0x1f171e<_0x3d3a7a;_0x26b34a+=0x1){_0x17d9aa=_0x26b34a/_0x2b56ff;_0x6217fb=(_0x4ce044*_0x17d9aa+_0x5085d5)/_0x3e04f4;_0xc54465=utils['erlangb'](_0x6217fb,_0x10e523);_0x1f171e=_0x6217fb/_0x10e523*(0x1-utils[_0x7ea5('0x21b')](_0x6217fb,_0x10e523));}return _0x112e24({'erlangCalls':_0x26b34a,'erlangCallToSecond':_0x2b56ff/_0x26b34a,'erlangAbandonmentRate':_0xc54465,'erlangBusyFactor':_0x1f171e});});};module[_0x7ea5('0x220')]=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 7f05fad..4de4dcb 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 _0x1940=['getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','lodash','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype'];(function(_0x309f95,_0x1f5165){var _0x3b2c3a=function(_0x43064e){while(--_0x43064e){_0x309f95['push'](_0x309f95['shift']());}};_0x3b2c3a(++_0x1f5165);}(_0x1940,0x132));var _0x0194=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0x1940[_0x3c6b7d];return _0x1d3ed2;};'use strict';var util=require(_0x0194('0x0'));var _=require(_0x0194('0x1'));var moment=require('moment');function checkNameSurname(_0x588409,_0x11b0b1,_0x497c9f){var _0x53f419='';if(!_[_0x0194('0x2')](_0x11b0b1)&&_0x0194('0x3')===typeof _0x11b0b1){_0x53f419+=_0x11b0b1;}if(!_['isNil'](_0x497c9f)&&_0x0194('0x3')===typeof _0x497c9f){_0x53f419+='\x20'+_0x497c9f;}if(_0x53f419!==''){return _0x53f419;}return _0x588409;}function Action(_0xafd920,_0x339759,_0x1b691d){this[_0x0194('0x4')]=_0xafd920;this['uniqueid']=_0x1b691d||undefined;this[_0x0194('0x5')]=checkNameSurname(_0x339759[_0x0194('0x6')][_0x0194('0x7')],_0x339759[_0x0194('0x6')][_0x0194('0x8')],_0x339759[_0x0194('0x6')][_0x0194('0x9')]);this[_0x0194('0xa')]=_0x339759[_0x0194('0x7')];this[_0x0194('0xb')]=_0xafd920[_0x0194('0x5')];this['active']=_0x339759[_0x0194('0xc')]||![];this[_0x0194('0xd')]=_0xafd920[_0x0194('0xd')];this[_0x0194('0xe')]=_0xafd920[_0x0194('0xe')]||0x3;this[_0x0194('0xf')]=_0x339759[_0x0194('0xf')];this['countbusyretry']=_0x339759[_0x0194('0x10')];this[_0x0194('0x11')]=_0x339759[_0x0194('0x11')];this[_0x0194('0x12')]=_0x339759[_0x0194('0x12')];this['countnosuchnumberretry']=_0x339759[_0x0194('0x13')];this[_0x0194('0x14')]=_0x339759['countdropretry'];this[_0x0194('0x15')]=_0x339759['countabandonedretry'];this['countmachineretry']=_0x339759[_0x0194('0x16')];this['countagentrejectretry']=_0x339759[_0x0194('0x17')];this[_0x0194('0x18')]=_0x339759['ContactId'];this[_0x0194('0x19')]=_0x339759[_0x0194('0x19')];this['UserId']=_0x339759['UserId'];this[_0x0194('0x1a')]=_0x339759[_0x0194('0x1a')];this['CampaignId']=_0x339759[_0x0194('0x1b')];this[_0x0194('0x1c')]=_0x339759['id'];this['ContactFirstName']=_0x339759[_0x0194('0x6')][_0x0194('0x8')]||'';this[_0x0194('0x1d')]=moment()[_0x0194('0x1e')](_0x0194('0x1f'));this['callback']=_0x339759[_0x0194('0x20')];this[_0x0194('0x21')]=_0x339759[_0x0194('0x21')];this[_0x0194('0x22')]=_0x339759[_0x0194('0x22')];this['recallme']=_0x339759[_0x0194('0x23')];this['originatecalleridnum']='';this[_0x0194('0x24')]='';}Action[_0x0194('0x25')][_0x0194('0x26')]=function(){return util[_0x0194('0x1e')](_0x0194('0x27'),this[_0x0194('0x5')],this[_0x0194('0x4')][_0x0194('0x28')]>0x0?this[_0x0194('0xa')]['substring'](this[_0x0194('0x4')][_0x0194('0x28')]):this[_0x0194('0xa')]);};Action[_0x0194('0x25')][_0x0194('0x29')]=function(){return this[_0x0194('0xb')];};module[_0x0194('0x2a')]=Action; \ No newline at end of file +var _0x0922=['lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','phone','Contact'];(function(_0x270a79,_0x56589c){var _0x18fbf7=function(_0x55547e){while(--_0x55547e){_0x270a79['push'](_0x270a79['shift']());}};_0x18fbf7(++_0x56589c);}(_0x0922,0xa3));var _0x2092=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x0922[_0x37a79c];return _0x561d89;};'use strict';var util=require(_0x2092('0x0'));var _=require(_0x2092('0x1'));var moment=require(_0x2092('0x2'));function checkNameSurname(_0x1c1858,_0x417727,_0x28a820){var _0x2cdbfc='';if(!_[_0x2092('0x3')](_0x417727)&&'string'===typeof _0x417727){_0x2cdbfc+=_0x417727;}if(!_['isNil'](_0x28a820)&&_0x2092('0x4')===typeof _0x28a820){_0x2cdbfc+='\x20'+_0x28a820;}if(_0x2cdbfc!==''){return _0x2cdbfc;}return _0x1c1858;}function Action(_0x5b17af,_0x382950,_0x563c54){this[_0x2092('0x5')]=_0x5b17af;this['uniqueid']=_0x563c54||undefined;this[_0x2092('0x6')]=checkNameSurname(_0x382950['Contact'][_0x2092('0x7')],_0x382950['Contact']['firstName'],_0x382950[_0x2092('0x8')][_0x2092('0x9')]);this['number']=_0x382950[_0x2092('0x7')];this[_0x2092('0xa')]=_0x5b17af['name'];this[_0x2092('0xb')]=_0x382950['active']||![];this[_0x2092('0xc')]=_0x5b17af[_0x2092('0xc')];this[_0x2092('0xd')]=_0x5b17af['dialQueueTimeout']||0x3;this[_0x2092('0xe')]=_0x382950[_0x2092('0xe')];this[_0x2092('0xf')]=_0x382950[_0x2092('0xf')];this['countcongestionretry']=_0x382950[_0x2092('0x10')];this[_0x2092('0x11')]=_0x382950['countnoanswerretry'];this['countnosuchnumberretry']=_0x382950[_0x2092('0x12')];this[_0x2092('0x13')]=_0x382950[_0x2092('0x13')];this[_0x2092('0x14')]=_0x382950[_0x2092('0x14')];this['countmachineretry']=_0x382950[_0x2092('0x15')];this['countagentrejectretry']=_0x382950['countagentrejectretry'];this[_0x2092('0x16')]=_0x382950[_0x2092('0x16')];this[_0x2092('0x17')]=_0x382950['ListId'];this[_0x2092('0x18')]=_0x382950['UserId'];this[_0x2092('0x19')]=_0x382950[_0x2092('0x19')];this[_0x2092('0x1a')]=_0x382950['CampaignId'];this[_0x2092('0x1b')]=_0x382950['id'];this[_0x2092('0x1c')]=_0x382950[_0x2092('0x8')]['firstName']||'';this[_0x2092('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2092('0x1e')]=_0x382950[_0x2092('0x1e')];this['callbackuniqueid']=_0x382950[_0x2092('0x1f')];this[_0x2092('0x20')]=_0x382950[_0x2092('0x20')];this[_0x2092('0x21')]=_0x382950[_0x2092('0x21')];this['originatecalleridnum']='';this[_0x2092('0x22')]='';}Action[_0x2092('0x23')]['getCaller']=function(){return util[_0x2092('0x24')](_0x2092('0x25'),this[_0x2092('0x6')],this['voiceQueue'][_0x2092('0x26')]>0x0?this['number'][_0x2092('0x27')](this[_0x2092('0x5')][_0x2092('0x26')]):this[_0x2092('0x28')]);};Action['prototype'][_0x2092('0x29')]=function(){return this[_0x2092('0xa')];};module[_0x2092('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 555e946..77248f2 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 _0x6ff1=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5c16a4,_0x834eff){var _0x291451=function(_0x41f650){while(--_0x41f650){_0x5c16a4['push'](_0x5c16a4['shift']());}};_0x291451(++_0x834eff);}(_0x6ff1,0x1eb));var _0x16ff=function(_0x5a319a,_0x27cd74){_0x5a319a=_0x5a319a-0x0;var _0x59f6d8=_0x6ff1[_0x5a319a];return _0x59f6d8;};'use strict';var moment=require(_0x16ff('0x0'));var utils=require(_0x16ff('0x1'));function AgentComplete(_0x159828,_0x3e03b6){this[_0x16ff('0x2')]=0x4;this[_0x16ff('0x3')]=_0x16ff('0x4');this[_0x16ff('0x5')]=_0x159828[_0x16ff('0x5')];this['type']=_0x159828[_0x16ff('0x6')];this[_0x16ff('0x7')]=_0x159828[_0x16ff('0x6')]==='outbound'?'queue':_0x159828[_0x16ff('0x6')];this[_0x16ff('0x8')]=_0x159828['countbusyretry'];this[_0x16ff('0x9')]=_0x159828['countcongestionretry'];this[_0x16ff('0xa')]=_0x159828[_0x16ff('0xa')];this['countglobal']=_0x159828[_0x16ff('0x8')]+_0x159828['countcongestionretry']+_0x159828[_0x16ff('0xa')]+_0x159828[_0x16ff('0xb')]+_0x159828['countdropretry']+_0x159828[_0x16ff('0xc')]+_0x159828['countmachineretry']+_0x159828[_0x16ff('0xd')];this[_0x16ff('0xb')]=_0x159828[_0x16ff('0xb')];this[_0x16ff('0xe')]=_0x159828['countdropretry'];this[_0x16ff('0xc')]=_0x159828[_0x16ff('0xc')];this[_0x16ff('0xf')]=_0x159828[_0x16ff('0xf')];this['countagentrejectretry']=_0x159828[_0x16ff('0xd')];this['uniqueid']=_0x3e03b6[_0x16ff('0x10')];this[_0x16ff('0x11')]=_0x159828[_0x16ff('0x12')];this[_0x16ff('0x13')]=_0x159828[_0x16ff('0x14')];this[_0x16ff('0x15')]=_0x159828[_0x16ff('0x15')];this['responsetime']=_0x159828[_0x16ff('0x16')];this[_0x16ff('0x17')]=_0x159828[_0x16ff('0x17')];this[_0x16ff('0x18')]=moment()[_0x16ff('0x19')](_0x16ff('0x1a'));this['ringtime']=utils['getSeconds'](_0x159828[_0x16ff('0x16')],_0x159828[_0x16ff('0x15')]);this['holdtime']=utils['getSeconds'](_0x159828[_0x16ff('0x17')],_0x159828[_0x16ff('0x16')]);this[_0x16ff('0x1b')]=utils[_0x16ff('0x1c')](this[_0x16ff('0x18')],_0x159828[_0x16ff('0x17')]);this[_0x16ff('0x1d')]=_0x3e03b6[_0x16ff('0x1d')];this[_0x16ff('0x1e')]=_0x3e03b6['membername'];this[_0x16ff('0x1f')]=_0x3e03b6['reason'];this[_0x16ff('0x20')]=_0x159828[_0x16ff('0x20')];this[_0x16ff('0x21')]=_0x159828['callbackuniqueid'];this[_0x16ff('0x22')]=_0x159828[_0x16ff('0x22')];this[_0x16ff('0x23')]=_0x159828[_0x16ff('0x23')];this[_0x16ff('0x24')]=_0x159828[_0x16ff('0x24')];this[_0x16ff('0x25')]=_0x159828[_0x16ff('0x25')];this[_0x16ff('0x26')]=_0x159828[_0x16ff('0x26')];this[_0x16ff('0x27')]=_0x159828[_0x16ff('0x27')];this[_0x16ff('0x28')]=_0x159828[_0x16ff('0x28')];this[_0x16ff('0x29')]=_0x159828[_0x16ff('0x29')]||'';this['originatecalleridname']=_0x159828[_0x16ff('0x2a')]||'';this['agiafterat']=_0x159828[_0x16ff('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x866e=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername'];(function(_0x2fd6a4,_0x5e9670){var _0xeeb77f=function(_0x325267){while(--_0x325267){_0x2fd6a4['push'](_0x2fd6a4['shift']());}};_0xeeb77f(++_0x5e9670);}(_0x866e,0x12d));var _0xe866=function(_0x5c6593,_0x5d9b87){_0x5c6593=_0x5c6593-0x0;var _0x410fbb=_0x866e[_0x5c6593];return _0x410fbb;};'use strict';var moment=require(_0xe866('0x0'));var utils=require('../utils');function AgentComplete(_0xa78f2f,_0x2e8795){this['state']=0x4;this['statedesc']='Answer';this[_0xe866('0x1')]=_0xa78f2f['scheduledat'];this[_0xe866('0x2')]=_0xa78f2f['type'];this[_0xe866('0x3')]=_0xa78f2f[_0xe866('0x2')]===_0xe866('0x4')?_0xe866('0x5'):_0xa78f2f[_0xe866('0x2')];this[_0xe866('0x6')]=_0xa78f2f[_0xe866('0x6')];this[_0xe866('0x7')]=_0xa78f2f[_0xe866('0x7')];this[_0xe866('0x8')]=_0xa78f2f[_0xe866('0x8')];this['countglobal']=_0xa78f2f[_0xe866('0x6')]+_0xa78f2f['countcongestionretry']+_0xa78f2f['countnoanswerretry']+_0xa78f2f[_0xe866('0x9')]+_0xa78f2f[_0xe866('0xa')]+_0xa78f2f[_0xe866('0xb')]+_0xa78f2f[_0xe866('0xc')]+_0xa78f2f[_0xe866('0xd')];this[_0xe866('0x9')]=_0xa78f2f[_0xe866('0x9')];this[_0xe866('0xa')]=_0xa78f2f[_0xe866('0xa')];this[_0xe866('0xb')]=_0xa78f2f[_0xe866('0xb')];this[_0xe866('0xc')]=_0xa78f2f[_0xe866('0xc')];this['countagentrejectretry']=_0xa78f2f[_0xe866('0xd')];this['uniqueid']=_0x2e8795[_0xe866('0xe')];this['calleridname']=_0xa78f2f[_0xe866('0xf')];this[_0xe866('0x10')]=_0xa78f2f['number'];this['starttime']=_0xa78f2f[_0xe866('0x11')];this[_0xe866('0x12')]=_0xa78f2f['responsetime'];this['answertime']=_0xa78f2f[_0xe866('0x13')];this[_0xe866('0x14')]=moment()[_0xe866('0x15')](_0xe866('0x16'));this[_0xe866('0x17')]=utils[_0xe866('0x18')](_0xa78f2f['responsetime'],_0xa78f2f[_0xe866('0x11')]);this[_0xe866('0x19')]=utils['getSeconds'](_0xa78f2f[_0xe866('0x13')],_0xa78f2f[_0xe866('0x12')]);this['talktime']=utils['getSeconds'](this[_0xe866('0x14')],_0xa78f2f[_0xe866('0x13')]);this[_0xe866('0x5')]=_0x2e8795[_0xe866('0x5')];this[_0xe866('0x1a')]=_0x2e8795[_0xe866('0x1a')];this[_0xe866('0x1b')]=_0x2e8795[_0xe866('0x1b')];this[_0xe866('0x1c')]=_0xa78f2f[_0xe866('0x1c')];this[_0xe866('0x1d')]=_0xa78f2f[_0xe866('0x1d')];this[_0xe866('0x1e')]=_0xa78f2f[_0xe866('0x1e')];this[_0xe866('0x1f')]=_0xa78f2f[_0xe866('0x1f')];this['ContactId']=_0xa78f2f[_0xe866('0x20')];this[_0xe866('0x21')]=_0xa78f2f[_0xe866('0x21')];this['UserId']=_0xa78f2f[_0xe866('0x22')];this[_0xe866('0x23')]=_0xa78f2f[_0xe866('0x23')];this[_0xe866('0x24')]=_0xa78f2f[_0xe866('0x24')];this[_0xe866('0x25')]=_0xa78f2f[_0xe866('0x25')]||'';this[_0xe866('0x26')]=_0xa78f2f[_0xe866('0x26')]||'';this['agiafterat']=_0xa78f2f[_0xe866('0x27')];}module[_0xe866('0x28')]=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 45eb186..00de1de 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 _0xb5b8=['countagentrejectretry','queue','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x386b6b,_0x489623){var _0x39969e=function(_0x36c740){while(--_0x36c740){_0x386b6b['push'](_0x386b6b['shift']());}};_0x39969e(++_0x489623);}(_0xb5b8,0x1de));var _0x8b5b=function(_0x16f9a2,_0x31123a){_0x16f9a2=_0x16f9a2-0x0;var _0x4bf956=_0xb5b8[_0x16f9a2];return _0x4bf956;};'use strict';function Final(_0x48b588){this[_0x8b5b('0x0')]=_0x48b588['uniqueid'];this[_0x8b5b('0x1')]=_0x48b588[_0x8b5b('0x1')];this[_0x8b5b('0x2')]=_0x48b588[_0x8b5b('0x2')];this['campaigntype']=_0x48b588[_0x8b5b('0x2')]===_0x8b5b('0x3')?'queue':_0x48b588[_0x8b5b('0x2')];this[_0x8b5b('0x4')]=_0x48b588['countbusyretry'];this[_0x8b5b('0x5')]=_0x48b588[_0x8b5b('0x5')];this[_0x8b5b('0x6')]=_0x48b588[_0x8b5b('0x6')];this[_0x8b5b('0x7')]=_0x48b588['countbusyretry']+_0x48b588[_0x8b5b('0x5')]+_0x48b588[_0x8b5b('0x6')]+_0x48b588[_0x8b5b('0x8')]+_0x48b588[_0x8b5b('0x9')]+_0x48b588['countabandonedretry']+_0x48b588['countmachineretry']+_0x48b588['countagentrejectretry'];this['countnosuchnumberretry']=_0x48b588[_0x8b5b('0x8')];this[_0x8b5b('0x9')]=_0x48b588[_0x8b5b('0x9')];this[_0x8b5b('0xa')]=_0x48b588[_0x8b5b('0xa')];this[_0x8b5b('0xb')]=_0x48b588[_0x8b5b('0xb')];this[_0x8b5b('0xc')]=_0x48b588[_0x8b5b('0xc')];this[_0x8b5b('0xd')]=_0x48b588[_0x8b5b('0xd')];this['calleridname']=_0x48b588['calleridname'];this[_0x8b5b('0xe')]=_0x48b588[_0x8b5b('0xe')];this[_0x8b5b('0xf')]=_0x48b588['starttime'];this[_0x8b5b('0x10')]=_0x48b588[_0x8b5b('0x10')];this[_0x8b5b('0x11')]=_0x48b588['responsetime'];this[_0x8b5b('0x12')]=_0x48b588[_0x8b5b('0x12')]||0x0;this[_0x8b5b('0x13')]=_0x48b588[_0x8b5b('0x13')]||0x0;this[_0x8b5b('0x14')]=_0x48b588['talktime']||0x0;this[_0x8b5b('0x15')]=_0x48b588[_0x8b5b('0x15')];this['callbackuniqueid']=_0x48b588[_0x8b5b('0x16')];this['callbackat']=_0x48b588[_0x8b5b('0x17')];this[_0x8b5b('0x18')]=_0x48b588[_0x8b5b('0x18')];this[_0x8b5b('0x19')]=_0x48b588[_0x8b5b('0x19')];this['ListId']=_0x48b588[_0x8b5b('0x1a')];this[_0x8b5b('0x1b')]=_0x48b588[_0x8b5b('0x1b')];this[_0x8b5b('0x1c')]=_0x48b588[_0x8b5b('0x1c')];this['CampaignId']=_0x48b588[_0x8b5b('0x1d')];this['originatecalleridnum']=_0x48b588[_0x8b5b('0x1e')]||'';this['originatecalleridname']=_0x48b588[_0x8b5b('0x1f')]||'';this[_0x8b5b('0x20')]=_0x48b588[_0x8b5b('0x20')];this['statedesc']=_0x48b588[_0x8b5b('0x21')];}module[_0x8b5b('0x22')]=Final; \ No newline at end of file +var _0x5517=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3287a6,_0x35e598){var _0x9c6449=function(_0x407e41){while(--_0x407e41){_0x3287a6['push'](_0x3287a6['shift']());}};_0x9c6449(++_0x35e598);}(_0x5517,0x169));var _0x7551=function(_0x3391b2,_0x26bef1){_0x3391b2=_0x3391b2-0x0;var _0x21165e=_0x5517[_0x3391b2];return _0x21165e;};'use strict';function Final(_0x1a8cfa){this[_0x7551('0x0')]=_0x1a8cfa[_0x7551('0x0')];this[_0x7551('0x1')]=_0x1a8cfa[_0x7551('0x1')];this['type']=_0x1a8cfa[_0x7551('0x2')];this[_0x7551('0x3')]=_0x1a8cfa[_0x7551('0x2')]===_0x7551('0x4')?_0x7551('0x5'):_0x1a8cfa[_0x7551('0x2')];this[_0x7551('0x6')]=_0x1a8cfa[_0x7551('0x6')];this[_0x7551('0x7')]=_0x1a8cfa[_0x7551('0x7')];this[_0x7551('0x8')]=_0x1a8cfa[_0x7551('0x8')];this[_0x7551('0x9')]=_0x1a8cfa[_0x7551('0x6')]+_0x1a8cfa[_0x7551('0x7')]+_0x1a8cfa[_0x7551('0x8')]+_0x1a8cfa[_0x7551('0xa')]+_0x1a8cfa[_0x7551('0xb')]+_0x1a8cfa['countabandonedretry']+_0x1a8cfa[_0x7551('0xc')]+_0x1a8cfa[_0x7551('0xd')];this[_0x7551('0xa')]=_0x1a8cfa['countnosuchnumberretry'];this[_0x7551('0xb')]=_0x1a8cfa[_0x7551('0xb')];this['countabandonedretry']=_0x1a8cfa[_0x7551('0xe')];this[_0x7551('0xc')]=_0x1a8cfa[_0x7551('0xc')];this[_0x7551('0xd')]=_0x1a8cfa['countagentrejectretry'];this[_0x7551('0x5')]=_0x1a8cfa[_0x7551('0x5')];this[_0x7551('0xf')]=_0x1a8cfa[_0x7551('0xf')];this[_0x7551('0x10')]=_0x1a8cfa[_0x7551('0x10')];this[_0x7551('0x11')]=_0x1a8cfa[_0x7551('0x11')];this[_0x7551('0x12')]=_0x1a8cfa[_0x7551('0x12')];this[_0x7551('0x13')]=_0x1a8cfa['responsetime'];this['ringtime']=_0x1a8cfa[_0x7551('0x14')]||0x0;this['holdtime']=_0x1a8cfa[_0x7551('0x15')]||0x0;this['talktime']=_0x1a8cfa[_0x7551('0x16')]||0x0;this[_0x7551('0x17')]=_0x1a8cfa[_0x7551('0x17')];this[_0x7551('0x18')]=_0x1a8cfa[_0x7551('0x18')];this[_0x7551('0x19')]=_0x1a8cfa[_0x7551('0x19')];this['recallme']=_0x1a8cfa[_0x7551('0x1a')];this['ContactId']=_0x1a8cfa[_0x7551('0x1b')];this[_0x7551('0x1c')]=_0x1a8cfa['ListId'];this[_0x7551('0x1d')]=_0x1a8cfa[_0x7551('0x1d')];this[_0x7551('0x1e')]=_0x1a8cfa['VoiceQueueId'];this[_0x7551('0x1f')]=_0x1a8cfa[_0x7551('0x1f')];this['originatecalleridnum']=_0x1a8cfa[_0x7551('0x20')]||'';this[_0x7551('0x21')]=_0x1a8cfa['originatecalleridname']||'';this[_0x7551('0x22')]=_0x1a8cfa[_0x7551('0x22')];this[_0x7551('0x23')]=_0x1a8cfa[_0x7551('0x23')];}module[_0x7551('0x24')]=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 1455ccb..ec219b8 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 _0xd236=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd236,0x1d6));var _0x6d23=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xd236[_0x500419];return _0x241c1a;};'use strict';var moment=require(_0x6d23('0x0'));var utils=require(_0x6d23('0x1'));function Hangup(_0x16c55c,_0x10c489){this['state']=0x4;this[_0x6d23('0x2')]=_0x6d23('0x3');this[_0x6d23('0x4')]=_0x16c55c['scheduledat'];this[_0x6d23('0x5')]=_0x16c55c[_0x6d23('0x5')];this[_0x6d23('0x6')]=_0x16c55c['type']===_0x6d23('0x7')?'queue':_0x16c55c[_0x6d23('0x5')];this[_0x6d23('0x8')]=_0x16c55c[_0x6d23('0x8')]||![];this[_0x6d23('0x9')]=_0x16c55c['countbusyretry'];this[_0x6d23('0xa')]=_0x16c55c[_0x6d23('0xa')];this[_0x6d23('0xb')]=_0x16c55c[_0x6d23('0xb')];this[_0x6d23('0xc')]=_0x16c55c['countbusyretry']+_0x16c55c[_0x6d23('0xa')]+_0x16c55c[_0x6d23('0xb')]+_0x16c55c[_0x6d23('0xd')]+_0x16c55c['countdropretry']+_0x16c55c[_0x6d23('0xe')]+_0x16c55c['countmachineretry']+_0x16c55c['countagentrejectretry'];this[_0x6d23('0xd')]=_0x16c55c[_0x6d23('0xd')];this[_0x6d23('0xf')]=_0x16c55c[_0x6d23('0xf')];this['countabandonedretry']=_0x16c55c[_0x6d23('0xe')];this['countmachineretry']=_0x16c55c['countmachineretry'];this[_0x6d23('0x10')]=_0x16c55c[_0x6d23('0x10')];this[_0x6d23('0x11')]=_0x10c489[_0x6d23('0x11')];this['calleridname']=_0x16c55c[_0x6d23('0x12')];this['calleridnum']=_0x16c55c[_0x6d23('0x13')];this[_0x6d23('0x14')]=_0x16c55c[_0x6d23('0x14')];this[_0x6d23('0x15')]=_0x16c55c[_0x6d23('0x15')];this[_0x6d23('0x16')]=moment()[_0x6d23('0x17')](_0x6d23('0x18'));this['ringtime']=utils[_0x6d23('0x19')](_0x16c55c['responsetime'],_0x16c55c[_0x6d23('0x14')]);this[_0x6d23('0x1a')]=0x0;this['talktime']=utils[_0x6d23('0x19')](this[_0x6d23('0x16')],_0x16c55c['responsetime']);this[_0x6d23('0x1b')]=_0x16c55c[_0x6d23('0x1b')];this[_0x6d23('0x1c')]='IVR';this[_0x6d23('0x1d')]=_0x10c489[_0x6d23('0x1e')];this[_0x6d23('0x1f')]=_0x16c55c['callback'];this[_0x6d23('0x20')]=_0x16c55c[_0x6d23('0x20')];this['callbackat']=_0x16c55c[_0x6d23('0x21')];this[_0x6d23('0x22')]=_0x16c55c[_0x6d23('0x22')];this[_0x6d23('0x23')]=_0x16c55c[_0x6d23('0x23')];this[_0x6d23('0x24')]=_0x16c55c[_0x6d23('0x24')];this[_0x6d23('0x25')]=_0x16c55c[_0x6d23('0x25')];this['VoiceQueueId']=_0x16c55c[_0x6d23('0x26')];this[_0x6d23('0x27')]=_0x16c55c[_0x6d23('0x27')];}module[_0x6d23('0x28')]=Hangup; \ No newline at end of file +var _0x9aa9=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','Answer','scheduledat','type','outbound','queue'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9aa9,0x193));var _0x99aa=function(_0x1fb994,_0x199671){_0x1fb994=_0x1fb994-0x0;var _0x27fbe6=_0x9aa9[_0x1fb994];return _0x27fbe6;};'use strict';var moment=require(_0x99aa('0x0'));var utils=require('../utils');function Hangup(_0x23171f,_0x8a36e4){this[_0x99aa('0x1')]=0x4;this['statedesc']=_0x99aa('0x2');this[_0x99aa('0x3')]=_0x23171f['scheduledat'];this[_0x99aa('0x4')]=_0x23171f['type'];this['campaigntype']=_0x23171f[_0x99aa('0x4')]===_0x99aa('0x5')?_0x99aa('0x6'):_0x23171f['type'];this[_0x99aa('0x7')]=_0x23171f[_0x99aa('0x7')]||![];this['countbusyretry']=_0x23171f[_0x99aa('0x8')];this[_0x99aa('0x9')]=_0x23171f[_0x99aa('0x9')];this['countnoanswerretry']=_0x23171f[_0x99aa('0xa')];this['countglobal']=_0x23171f[_0x99aa('0x8')]+_0x23171f[_0x99aa('0x9')]+_0x23171f[_0x99aa('0xa')]+_0x23171f['countnosuchnumberretry']+_0x23171f[_0x99aa('0xb')]+_0x23171f[_0x99aa('0xc')]+_0x23171f[_0x99aa('0xd')]+_0x23171f[_0x99aa('0xe')];this['countnosuchnumberretry']=_0x23171f[_0x99aa('0xf')];this[_0x99aa('0xb')]=_0x23171f['countdropretry'];this[_0x99aa('0xc')]=_0x23171f[_0x99aa('0xc')];this['countmachineretry']=_0x23171f[_0x99aa('0xd')];this[_0x99aa('0xe')]=_0x23171f[_0x99aa('0xe')];this[_0x99aa('0x10')]=_0x8a36e4[_0x99aa('0x10')];this[_0x99aa('0x11')]=_0x23171f[_0x99aa('0x12')];this[_0x99aa('0x13')]=_0x23171f['number'];this[_0x99aa('0x14')]=_0x23171f[_0x99aa('0x14')];this[_0x99aa('0x15')]=_0x23171f[_0x99aa('0x15')];this[_0x99aa('0x16')]=moment()['format'](_0x99aa('0x17'));this[_0x99aa('0x18')]=utils[_0x99aa('0x19')](_0x23171f[_0x99aa('0x15')],_0x23171f[_0x99aa('0x14')]);this['holdtime']=0x0;this[_0x99aa('0x1a')]=utils[_0x99aa('0x19')](this[_0x99aa('0x16')],_0x23171f[_0x99aa('0x15')]);this[_0x99aa('0x6')]=_0x23171f[_0x99aa('0x6')];this[_0x99aa('0x1b')]=_0x99aa('0x1c');this[_0x99aa('0x1d')]=_0x8a36e4[_0x99aa('0x1e')];this[_0x99aa('0x1f')]=_0x23171f[_0x99aa('0x1f')];this[_0x99aa('0x20')]=_0x23171f[_0x99aa('0x20')];this[_0x99aa('0x21')]=_0x23171f[_0x99aa('0x21')];this['recallme']=_0x23171f[_0x99aa('0x22')];this[_0x99aa('0x23')]=_0x23171f[_0x99aa('0x23')];this[_0x99aa('0x24')]=_0x23171f[_0x99aa('0x24')];this[_0x99aa('0x25')]=_0x23171f[_0x99aa('0x25')];this['VoiceQueueId']=_0x23171f[_0x99aa('0x26')];this['CampaignId']=_0x23171f[_0x99aa('0x27')];}module[_0x99aa('0x28')]=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 c3275a0..ee56eda 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 _0xf847=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0xc943d4,_0x134dc7){var _0x25e636=function(_0x3f6017){while(--_0x3f6017){_0xc943d4['push'](_0xc943d4['shift']());}};_0x25e636(++_0x134dc7);}(_0xf847,0x10a));var _0x7f84=function(_0x459922,_0x47c03e){_0x459922=_0x459922-0x0;var _0x5ca995=_0xf847[_0x459922];return _0x5ca995;};'use strict';var utils=require(_0x7f84('0x0'));function History(_0x31988e){this[_0x7f84('0x1')]=_0x31988e['uniqueid'];this[_0x7f84('0x2')]=_0x31988e[_0x7f84('0x2')]||undefined;this[_0x7f84('0x3')]=_0x31988e['type'];this[_0x7f84('0x4')]=_0x31988e[_0x7f84('0x3')]===_0x7f84('0x5')?_0x7f84('0x6'):_0x31988e[_0x7f84('0x3')];this[_0x7f84('0x7')]=_0x31988e[_0x7f84('0x7')];this[_0x7f84('0x8')]=_0x31988e['countcongestionretry'];this[_0x7f84('0x9')]=_0x31988e['countnoanswerretry'];this[_0x7f84('0xa')]=_0x31988e[_0x7f84('0x7')]+_0x31988e[_0x7f84('0x8')]+_0x31988e['countnoanswerretry']+_0x31988e['countnosuchnumberretry']+_0x31988e[_0x7f84('0xb')]+_0x31988e[_0x7f84('0xc')]+_0x31988e[_0x7f84('0xd')]+_0x31988e[_0x7f84('0xe')];this[_0x7f84('0xf')]=_0x31988e['countnosuchnumberretry'];this[_0x7f84('0xb')]=_0x31988e[_0x7f84('0xb')];this[_0x7f84('0xc')]=_0x31988e[_0x7f84('0xc')];this[_0x7f84('0xd')]=_0x31988e['countmachineretry'];this[_0x7f84('0xe')]=_0x31988e[_0x7f84('0xe')];this[_0x7f84('0x6')]=_0x31988e[_0x7f84('0x6')];this[_0x7f84('0x10')]=_0x31988e[_0x7f84('0x11')];this[_0x7f84('0x12')]=_0x31988e[_0x7f84('0x13')];this[_0x7f84('0x14')]=_0x31988e[_0x7f84('0x14')];this[_0x7f84('0x15')]=_0x31988e[_0x7f84('0x15')];this[_0x7f84('0x16')]=_0x31988e[_0x7f84('0x15')];this[_0x7f84('0x17')]=utils['getSeconds'](_0x31988e['responsetime'],_0x31988e['starttime']);this[_0x7f84('0x18')]=0x0;this[_0x7f84('0x19')]=0x0;this[_0x7f84('0x1a')]=_0x31988e['callback'];this['callbackuniqueid']=_0x31988e[_0x7f84('0x1b')];this[_0x7f84('0x1c')]=_0x31988e['callbackat'];this[_0x7f84('0x1d')]=_0x31988e[_0x7f84('0x1d')];this[_0x7f84('0x1e')]=_0x31988e['ContactId'];this['ListId']=_0x31988e[_0x7f84('0x1f')];this[_0x7f84('0x20')]=_0x31988e[_0x7f84('0x20')];this[_0x7f84('0x21')]=_0x31988e[_0x7f84('0x21')];this['CampaignId']=_0x31988e[_0x7f84('0x22')];this[_0x7f84('0x23')]=_0x31988e[_0x7f84('0x23')]||'';this['originatecalleridname']=_0x31988e[_0x7f84('0x24')]||'';this['state']=_0x31988e[_0x7f84('0x25')];this['statedesc']=_0x31988e['statedesc'];}module[_0x7f84('0x26')]=History; \ No newline at end of file +var _0x82dd=['statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','queue','calleridname','name','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0xc4b8d3,_0x4b2ecf){var _0x1fc151=function(_0x39f9f9){while(--_0x39f9f9){_0xc4b8d3['push'](_0xc4b8d3['shift']());}};_0x1fc151(++_0x4b2ecf);}(_0x82dd,0x1be));var _0xd82d=function(_0x4b87a3,_0x3a698c){_0x4b87a3=_0x4b87a3-0x0;var _0x334112=_0x82dd[_0x4b87a3];return _0x334112;};'use strict';var utils=require(_0xd82d('0x0'));function History(_0x9a52e9){this[_0xd82d('0x1')]=_0x9a52e9['uniqueid'];this[_0xd82d('0x2')]=_0x9a52e9[_0xd82d('0x2')]||undefined;this[_0xd82d('0x3')]=_0x9a52e9[_0xd82d('0x3')];this[_0xd82d('0x4')]=_0x9a52e9[_0xd82d('0x3')]===_0xd82d('0x5')?'queue':_0x9a52e9[_0xd82d('0x3')];this[_0xd82d('0x6')]=_0x9a52e9[_0xd82d('0x6')];this[_0xd82d('0x7')]=_0x9a52e9[_0xd82d('0x7')];this['countnoanswerretry']=_0x9a52e9[_0xd82d('0x8')];this[_0xd82d('0x9')]=_0x9a52e9[_0xd82d('0x6')]+_0x9a52e9[_0xd82d('0x7')]+_0x9a52e9[_0xd82d('0x8')]+_0x9a52e9['countnosuchnumberretry']+_0x9a52e9[_0xd82d('0xa')]+_0x9a52e9['countabandonedretry']+_0x9a52e9[_0xd82d('0xb')]+_0x9a52e9['countagentrejectretry'];this['countnosuchnumberretry']=_0x9a52e9[_0xd82d('0xc')];this['countdropretry']=_0x9a52e9['countdropretry'];this[_0xd82d('0xd')]=_0x9a52e9[_0xd82d('0xd')];this[_0xd82d('0xb')]=_0x9a52e9['countmachineretry'];this[_0xd82d('0xe')]=_0x9a52e9[_0xd82d('0xe')];this[_0xd82d('0xf')]=_0x9a52e9[_0xd82d('0xf')];this[_0xd82d('0x10')]=_0x9a52e9[_0xd82d('0x11')];this['calleridnum']=_0x9a52e9[_0xd82d('0x12')];this['starttime']=_0x9a52e9[_0xd82d('0x13')];this[_0xd82d('0x14')]=_0x9a52e9[_0xd82d('0x14')];this['endtime']=_0x9a52e9['responsetime'];this[_0xd82d('0x15')]=utils[_0xd82d('0x16')](_0x9a52e9[_0xd82d('0x14')],_0x9a52e9[_0xd82d('0x13')]);this['holdtime']=0x0;this[_0xd82d('0x17')]=0x0;this[_0xd82d('0x18')]=_0x9a52e9[_0xd82d('0x18')];this[_0xd82d('0x19')]=_0x9a52e9[_0xd82d('0x19')];this[_0xd82d('0x1a')]=_0x9a52e9['callbackat'];this[_0xd82d('0x1b')]=_0x9a52e9[_0xd82d('0x1b')];this[_0xd82d('0x1c')]=_0x9a52e9[_0xd82d('0x1c')];this[_0xd82d('0x1d')]=_0x9a52e9[_0xd82d('0x1d')];this['UserId']=_0x9a52e9['UserId'];this[_0xd82d('0x1e')]=_0x9a52e9[_0xd82d('0x1e')];this['CampaignId']=_0x9a52e9[_0xd82d('0x1f')];this[_0xd82d('0x20')]=_0x9a52e9['originatecalleridnum']||'';this[_0xd82d('0x21')]=_0x9a52e9[_0xd82d('0x21')]||'';this[_0xd82d('0x22')]=_0x9a52e9['state'];this[_0xd82d('0x23')]=_0x9a52e9[_0xd82d('0x23')];}module[_0xd82d('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 2374afa..3091110 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 _0xde19=['talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime'];(function(_0x1b273b,_0x8169b){var _0x585ff4=function(_0xc6a38){while(--_0xc6a38){_0x1b273b['push'](_0x1b273b['shift']());}};_0x585ff4(++_0x8169b);}(_0xde19,0x88));var _0x9de1=function(_0x287234,_0x4b9e28){_0x287234=_0x287234-0x0;var _0x4bfc27=_0xde19[_0x287234];return _0x4bfc27;};'use strict';var utils=require(_0x9de1('0x0'));function QueueCallerAbandon(_0x2168fe,_0x1c5a51){this[_0x9de1('0x1')]=_0x2168fe['scheduledat'];this['type']=_0x2168fe['type'];this[_0x9de1('0x2')]=_0x2168fe[_0x9de1('0x3')]===_0x9de1('0x4')?_0x9de1('0x5'):_0x2168fe[_0x9de1('0x3')];this[_0x9de1('0x6')]=_0x2168fe[_0x9de1('0x6')];this['countcongestionretry']=_0x2168fe['countcongestionretry'];this[_0x9de1('0x7')]=_0x2168fe[_0x9de1('0x7')];this[_0x9de1('0x8')]=_0x2168fe['countbusyretry']+_0x2168fe['countcongestionretry']+_0x2168fe[_0x9de1('0x7')]+_0x2168fe['countnosuchnumberretry']+_0x2168fe[_0x9de1('0x9')]+_0x2168fe[_0x9de1('0xa')]+_0x2168fe['countmachineretry']+_0x2168fe['countagentrejectretry'];this[_0x9de1('0xb')]=_0x2168fe[_0x9de1('0xb')];this[_0x9de1('0x9')]=_0x2168fe[_0x9de1('0x9')];this['countabandonedretry']=_0x2168fe[_0x9de1('0xa')];this['countmachineretry']=_0x2168fe['countmachineretry'];this['countagentrejectretry']=_0x2168fe['countagentrejectretry'];this['uniqueid']=_0x1c5a51[_0x9de1('0xc')];this[_0x9de1('0xd')]=_0x2168fe['name'];this[_0x9de1('0xe')]=_0x2168fe[_0x9de1('0xf')];this[_0x9de1('0x10')]=_0x2168fe[_0x9de1('0x10')];this[_0x9de1('0x11')]=_0x2168fe[_0x9de1('0x11')];this[_0x9de1('0x12')]=_0x2168fe[_0x9de1('0x12')];this[_0x9de1('0x13')]=_0x2168fe[_0x9de1('0x13')];this[_0x9de1('0x14')]=this[_0x9de1('0x12')];this[_0x9de1('0x15')]=utils[_0x9de1('0x16')](_0x2168fe[_0x9de1('0x11')],_0x2168fe[_0x9de1('0x10')]);this[_0x9de1('0x17')]=utils['getSeconds'](this['droptime'],_0x2168fe['responsetime']);this[_0x9de1('0x18')]=0x0;this['queue']=_0x1c5a51[_0x9de1('0x5')];this['membername']=_0x1c5a51[_0x9de1('0x19')];this[_0x9de1('0x1a')]=_0x1c5a51[_0x9de1('0x1a')];this[_0x9de1('0x1b')]=_0x2168fe[_0x9de1('0x1b')];this[_0x9de1('0x1c')]=_0x2168fe[_0x9de1('0x1c')];this[_0x9de1('0x1d')]=_0x2168fe['callbackat'];this[_0x9de1('0x1e')]=_0x2168fe[_0x9de1('0x1e')];this[_0x9de1('0x1f')]=_0x2168fe[_0x9de1('0x1f')];this[_0x9de1('0x20')]=_0x2168fe[_0x9de1('0x20')];this[_0x9de1('0x21')]=_0x2168fe[_0x9de1('0x21')];this[_0x9de1('0x22')]=_0x2168fe['VoiceQueueId'];this[_0x9de1('0x23')]=_0x2168fe[_0x9de1('0x23')];this[_0x9de1('0x24')]=_0x2168fe[_0x9de1('0x24')]||'';this['originatecalleridname']=_0x2168fe['originatecalleridname']||'';this['agiafterat']=_0x2168fe['agiafterat'];this[_0x9de1('0x25')]=_0x2168fe[_0x9de1('0x25')];this[_0x9de1('0x26')]=_0x2168fe[_0x9de1('0x26')];}module[_0x9de1('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x1f1a=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','dropreason','droptime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x1f4e3d,_0x2e27c3){var _0x2aab6c=function(_0x474b92){while(--_0x474b92){_0x1f4e3d['push'](_0x1f4e3d['shift']());}};_0x2aab6c(++_0x2e27c3);}(_0x1f1a,0xdc));var _0xa1f1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x1f1a[_0x4e1d03];return _0x362d4b;};'use strict';var utils=require(_0xa1f1('0x0'));function QueueCallerAbandon(_0x2387fd,_0x113e1c){this[_0xa1f1('0x1')]=_0x2387fd[_0xa1f1('0x1')];this[_0xa1f1('0x2')]=_0x2387fd[_0xa1f1('0x2')];this['campaigntype']=_0x2387fd[_0xa1f1('0x2')]===_0xa1f1('0x3')?_0xa1f1('0x4'):_0x2387fd['type'];this[_0xa1f1('0x5')]=_0x2387fd[_0xa1f1('0x5')];this[_0xa1f1('0x6')]=_0x2387fd[_0xa1f1('0x6')];this[_0xa1f1('0x7')]=_0x2387fd[_0xa1f1('0x7')];this[_0xa1f1('0x8')]=_0x2387fd[_0xa1f1('0x5')]+_0x2387fd[_0xa1f1('0x6')]+_0x2387fd[_0xa1f1('0x7')]+_0x2387fd[_0xa1f1('0x9')]+_0x2387fd['countdropretry']+_0x2387fd[_0xa1f1('0xa')]+_0x2387fd[_0xa1f1('0xb')]+_0x2387fd[_0xa1f1('0xc')];this[_0xa1f1('0x9')]=_0x2387fd['countnosuchnumberretry'];this[_0xa1f1('0xd')]=_0x2387fd[_0xa1f1('0xd')];this[_0xa1f1('0xa')]=_0x2387fd[_0xa1f1('0xa')];this['countmachineretry']=_0x2387fd['countmachineretry'];this[_0xa1f1('0xc')]=_0x2387fd[_0xa1f1('0xc')];this[_0xa1f1('0xe')]=_0x113e1c[_0xa1f1('0xe')];this[_0xa1f1('0xf')]=_0x2387fd[_0xa1f1('0x10')];this['calleridnum']=_0x2387fd[_0xa1f1('0x11')];this[_0xa1f1('0x12')]=_0x2387fd[_0xa1f1('0x12')];this[_0xa1f1('0x13')]=_0x2387fd[_0xa1f1('0x13')];this['droptime']=_0x2387fd['droptime'];this[_0xa1f1('0x14')]=_0x2387fd[_0xa1f1('0x14')];this['endtime']=this[_0xa1f1('0x15')];this[_0xa1f1('0x16')]=utils[_0xa1f1('0x17')](_0x2387fd[_0xa1f1('0x13')],_0x2387fd['starttime']);this[_0xa1f1('0x18')]=utils[_0xa1f1('0x17')](this['droptime'],_0x2387fd['responsetime']);this[_0xa1f1('0x19')]=0x0;this['queue']=_0x113e1c[_0xa1f1('0x4')];this['membername']=_0x113e1c[_0xa1f1('0x1a')];this[_0xa1f1('0x1b')]=_0x113e1c[_0xa1f1('0x1b')];this['callback']=_0x2387fd['callback'];this[_0xa1f1('0x1c')]=_0x2387fd[_0xa1f1('0x1c')];this[_0xa1f1('0x1d')]=_0x2387fd[_0xa1f1('0x1d')];this['recallme']=_0x2387fd[_0xa1f1('0x1e')];this[_0xa1f1('0x1f')]=_0x2387fd['ContactId'];this[_0xa1f1('0x20')]=_0x2387fd[_0xa1f1('0x20')];this[_0xa1f1('0x21')]=_0x2387fd[_0xa1f1('0x21')];this[_0xa1f1('0x22')]=_0x2387fd[_0xa1f1('0x22')];this['CampaignId']=_0x2387fd[_0xa1f1('0x23')];this[_0xa1f1('0x24')]=_0x2387fd[_0xa1f1('0x24')]||'';this['originatecalleridname']=_0x2387fd[_0xa1f1('0x25')]||'';this[_0xa1f1('0x26')]=_0x2387fd['agiafterat'];this[_0xa1f1('0x27')]=_0x2387fd[_0xa1f1('0x27')];this[_0xa1f1('0x28')]=_0x2387fd[_0xa1f1('0x28')];}module[_0xa1f1('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index d2793da..4119974 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(_0x462e55,_0x460798){var _0x183cb0=function(_0x5577a8){while(--_0x5577a8){_0x462e55['push'](_0x462e55['shift']());}};_0x183cb0(++_0x460798);}(_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 _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x1ed792,_0x3a10d9){var _0x850a90=function(_0x118b53){while(--_0x118b53){_0x1ed792['push'](_0x1ed792['shift']());}};_0x850a90(++_0x3a10d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=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 aef6052..98df151 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 _0x0f6a=['pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','talking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','erlangb','lodash','moment','util','../../../../config/logger','dialer','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused'];(function(_0x5ae771,_0x40b184){var _0x410044=function(_0x4501d7){while(--_0x4501d7){_0x5ae771['push'](_0x5ae771['shift']());}};_0x410044(++_0x40b184);}(_0x0f6a,0x16a));var _0xa0f6=function(_0x83b5b,_0x5537c2){_0x83b5b=_0x83b5b-0x0;var _0x5617f1=_0x0f6a[_0x83b5b];return _0x5617f1;};'use strict';var _=require(_0xa0f6('0x0'));var moment=require(_0xa0f6('0x1'));var util=require(_0xa0f6('0x2'));var logger=require(_0xa0f6('0x3'))(_0xa0f6('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa0f6('0x5'),'BLACKLIST':_0xa0f6('0x6'),'CONTACTS_RESCHEDULED':_0xa0f6('0x7'),'DEACTIVATED':_0xa0f6('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xa0f6('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xa0f6('0xa'),'NO_AVAILABLE_CONTACTS':_0xa0f6('0xb'),'NULL_INTERVAL':_0xa0f6('0xc'),'OVERTIME_INTERVAL':_0xa0f6('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xa0f6('0xe'),'QUEUE_RECALL':_0xa0f6('0xf'),'RECALL_TIMEOUT':_0xa0f6('0x10'),'RUNNING':_0xa0f6('0x11'),'UNKNOWN_TIMEZONE':_0xa0f6('0x12'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xa0f6('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x376731){return _0x376731[_0xa0f6('0x14')]===_0xa0f6('0x15');}exports[_0xa0f6('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x3da427){return _0x3da427[_0xa0f6('0x17')]===_0xa0f6('0x18');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x46d4b2){return _0x46d4b2['type']===_0xa0f6('0x19');}exports[_0xa0f6('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x19e1bf){return _0x19e1bf[_0xa0f6('0x1b')];}exports[_0xa0f6('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4a874e){return _0x4a874e[_0xa0f6('0x1d')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x167cc4,_0x2b079e){var _0x550592=moment(_0x167cc4)[_0xa0f6('0x1e')](0x0);var _0x492a9e=moment(_0x2b079e)[_0xa0f6('0x1e')](0x0);return _0x550592['diff'](_0x492a9e,_0xa0f6('0x1f'));}exports[_0xa0f6('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x49453b,_0x645d73){var _0x430233=![];var _0x953f32=_0x49453b[_0xa0f6('0x14')]!==_0x645d73[_0xa0f6('0x14')]||_0x49453b['dialActive']!==_0x645d73['dialActive']||_0x49453b[_0xa0f6('0x21')]!==_0x645d73['message'];var _0x5d37c5=_0x49453b[_0xa0f6('0x22')]!==_0x645d73[_0xa0f6('0x22')]||_0x49453b[_0xa0f6('0x23')]!==_0x645d73[_0xa0f6('0x23')]||_0x49453b[_0xa0f6('0x24')]!==_0x645d73[_0xa0f6('0x24')]||_0x49453b['paused']!==_0x645d73[_0xa0f6('0x25')]||_0x49453b['talking']!==_0x645d73['talking']||_0x49453b[_0xa0f6('0x26')]!==_0x645d73[_0xa0f6('0x26')]||_0x49453b[_0xa0f6('0x27')]!==_0x645d73[_0xa0f6('0x27')]||_0x49453b[_0xa0f6('0x28')]!==_0x645d73[_0xa0f6('0x28')]||_0x49453b[_0xa0f6('0x29')]!==_0x645d73['originated'];if(_0x49453b[_0xa0f6('0x2a')]&&_0x645d73[_0xa0f6('0x2a')]){_0x430233=_0x49453b[_0xa0f6('0x2a')]['name']!==_0x645d73[_0xa0f6('0x2a')][_0xa0f6('0x2b')]||_0x49453b[_0xa0f6('0x2a')][_0xa0f6('0x1d')]!==_0x645d73[_0xa0f6('0x2a')][_0xa0f6('0x1d')];}return _0x953f32||_0x5d37c5||_0x430233;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5bce4f){var _0x46b3fe=null;var _0x214df4=_0x5bce4f[_0xa0f6('0x2c')];if(_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2e')])||_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2f')])||_[_0xa0f6('0x2d')](_0x5bce4f[_0xa0f6('0x2f')][_0xa0f6('0x30')])){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x31')];}else if(_[_0xa0f6('0x32')](_0x5bce4f[_0xa0f6('0x2e')])||_['isEmpty'](_0x5bce4f[_0xa0f6('0x2f')]['Intervals'])){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x33')];}else if(_0x214df4&&!timezones[_0x214df4]){_0x46b3fe=CAMPAIGN_STATUS[_0xa0f6('0x34')];}return _0x46b3fe;}function checkAnyValidTrunk(_0x2e48b4,_0x367517){var _0x15ac2b=null;var _0x4c24e4=_0xa0f6('0x35');var _0x4f6818=[_0xa0f6('0x36'),_0xa0f6('0x37')];var _0x113aaf=!![];if(_0x2e48b4[_0xa0f6('0x2a')]&&_0x2e48b4['Trunk'][_0xa0f6('0x1d')]){_0x4c24e4+=_0x2e48b4[_0xa0f6('0x2a')]['name'];_0x15ac2b=_0x367517[_0x4c24e4];_0x113aaf=_0x4f6818[_0xa0f6('0x38')](_0x15ac2b[_0xa0f6('0x39')]);}else if(_0x2e48b4[_0xa0f6('0x3a')]&&_0x2e48b4[_0xa0f6('0x3a')]['active']){_0x4c24e4+=_0x2e48b4['TrunkBackup'][_0xa0f6('0x2b')];_0x15ac2b=_0x367517[_0x4c24e4];_0x113aaf=_0x4f6818[_0xa0f6('0x38')](_0x15ac2b[_0xa0f6('0x39')]);}return _0x113aaf;}function getQueueCampaignStatusMessage(_0x552778,_0xb4e9e6){var _0x288221=CAMPAIGN_STATUS[_0xa0f6('0x5')];var _0x501bdc=isPreviewCampaign(_0x552778);if(!isQueueCampaignActive(_0x552778)){if(_0x501bdc){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}else{if(_0x552778[_0xa0f6('0x29')]===0x0&&_0x552778[_0xa0f6('0x3c')]===0x0&&_0x552778[_0xa0f6('0x27')]===0x0&&(_0x552778[_0xa0f6('0x26')]||0x0)===0x0){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}else{_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3d')];}}}else if(_0x552778['loggedIn']===0x0){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3e')];}else if(!checkAnyValidTrunk(_0x552778,_0xb4e9e6)){_0x288221=CAMPAIGN_STATUS[_0xa0f6('0x3f')];}else if(!isPreviewCampaign(_0x552778)){var _0x51298b=checkAnyValidQueueCampaignInterval(_0x552778);if(_0x51298b){_0x288221=_0x51298b;}}return _0x288221;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa02d93){var _0x322f4e=CAMPAIGN_STATUS[_0xa0f6('0x3d')];if(_0xa02d93[_0xa0f6('0x29')]===0x0&&_0xa02d93['talking']===0x0&&_0xa02d93['waiting']===0x0&&(_0xa02d93[_0xa0f6('0x26')]||0x0)===0x0){_0x322f4e=CAMPAIGN_STATUS[_0xa0f6('0x3b')];}return _0x322f4e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e90aa){var _0x29fe38=_0x2e90aa[_0xa0f6('0x40')](/"(.*?)"/);return _0x29fe38?_0x29fe38[0x1]:_0x2e90aa;}exports[_0xa0f6('0x41')]=extractCalleridName;function getCallerId(_0x427f44,_0x394c3d,_0x468373){if(!_['isUndefined'](_0x468373)&&typeof _0x468373===_0xa0f6('0x42')&&!_['isEmpty'](_0x468373)){if(!_[_0xa0f6('0x43')](_0x394c3d)&&typeof _0x394c3d===_0xa0f6('0x42')&&!_['isEmpty'](_0x394c3d)){return util[_0xa0f6('0x44')](_0xa0f6('0x45'),_0x394c3d,_0x468373);}return util[_0xa0f6('0x44')]('\x22%s\x22\x20<%s>',_0x468373,_0x468373);}if(!_['isUndefined'](_0x427f44)&&typeof _0x427f44===_0xa0f6('0x42')&&!_['isEmpty'](_0x427f44)){return _0x427f44;}return _0xa0f6('0x46');}exports[_0xa0f6('0x47')]=getCallerId;function getCallerIdRandom(_0x44f217,_0x1371c2){var _0x2ec85a;var _0x2c9a2f;var _0x2a0be2;if(_0x1371c2<=0x0){_0x1371c2=0x1;}_0x2ec85a=new RegExp(_0xa0f6('0x48')+_0x1371c2+'}$');_0x2c9a2f=Math[_0xa0f6('0x49')](0xa,_0x1371c2-0x1);_0x2a0be2=Math[_0xa0f6('0x49')](0xa,_0x1371c2)-0x1;return util[_0xa0f6('0x44')]('%s',_[_0xa0f6('0x4a')](_0x44f217,_0x2ec85a,_['random'](_0x2c9a2f,_0x2a0be2)['toString']()));}exports[_0xa0f6('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x47cfa0){if(_0x47cfa0[_0xa0f6('0x29')]&&_0x47cfa0['originated']>0x0){_0x47cfa0[_0xa0f6('0x29')]-=0x1;}else{logger[_0xa0f6('0x4c')](_0xa0f6('0x4d'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x169f11){return _0x169f11&&_0x169f11['length']>0x0;}exports[_0xa0f6('0x4e')]=checkContactEmpty;function erlangb(_0x1c78ec,_0x1dc0db){if(_0x1dc0db===0x0){return 0x0;}var _0x2b6e8a=0x1;for(var _0x2148aa=0x1;_0x2148aa<=_0x1dc0db;_0x2148aa+=0x1){_0x2b6e8a=0x1+_0x2b6e8a*_0x2148aa/_0x1c78ec;}return 0x1/_0x2b6e8a;}exports[_0xa0f6('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x478f29,_0x41919d,_0x415414){if(_0x41919d>_0x415414){for(var _0x4faffb=0x0;_0x4faffb<_0x41919d-_0x415414;_0x4faffb+=0x1){decrementOriginate(_0x478f29);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x8eac=['isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','includes','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','getCallerIdRandom','error','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive'];(function(_0x599e38,_0x158e19){var _0x5c6717=function(_0x59d0d8){while(--_0x59d0d8){_0x599e38['push'](_0x599e38['shift']());}};_0x5c6717(++_0x158e19);}(_0x8eac,0x15e));var _0xc8ea=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x8eac[_0x254076];return _0x21a93e;};'use strict';var _=require(_0xc8ea('0x0'));var moment=require(_0xc8ea('0x1'));var util=require(_0xc8ea('0x2'));var logger=require('../../../../config/logger')(_0xc8ea('0x3'));var timezones=require(_0xc8ea('0x4'))[_0xc8ea('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xc8ea('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xc8ea('0x7'),'DEACTIVATED':_0xc8ea('0x8'),'DISACTIVED':_0xc8ea('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xc8ea('0xa'),'NO_AGENTS_LOGGED':_0xc8ea('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xc8ea('0xc'),'OVERTIME_INTERVAL':_0xc8ea('0xd'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc8ea('0xe'),'UNKNOWN_TIMEZONE':_0xc8ea('0xf'),'UNREACHABLE_TRUNK':_0xc8ea('0x10')};exports[_0xc8ea('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5951b0){return _0x5951b0['dialMethod']===_0xc8ea('0x12');}exports[_0xc8ea('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x1710c8){return _0x1710c8[_0xc8ea('0x14')]===_0xc8ea('0x15');}exports[_0xc8ea('0x16')]=isIVRCampaign;function isOutboundQueue(_0x20759e){return _0x20759e[_0xc8ea('0x14')]==='outbound';}exports[_0xc8ea('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x4a2cb4){return _0x4a2cb4[_0xc8ea('0x18')];}exports[_0xc8ea('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x575565){return _0x575565['active'];}exports[_0xc8ea('0x1a')]=isIVRCampaignActive;function getSeconds(_0x3a432f,_0xce92c6){var _0x40bc0c=moment(_0x3a432f)[_0xc8ea('0x1b')](0x0);var _0x1aab89=moment(_0xce92c6)['milliseconds'](0x0);return _0x40bc0c[_0xc8ea('0x1c')](_0x1aab89,_0xc8ea('0x1d'));}exports[_0xc8ea('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x329bd1,_0x11d637){var _0x48f590=![];var _0x4c3b52=_0x329bd1[_0xc8ea('0x1f')]!==_0x11d637[_0xc8ea('0x1f')]||_0x329bd1[_0xc8ea('0x18')]!==_0x11d637['dialActive']||_0x329bd1[_0xc8ea('0x20')]!==_0x11d637[_0xc8ea('0x20')];var _0x2852c2=_0x329bd1[_0xc8ea('0x21')]!==_0x11d637[_0xc8ea('0x21')]||_0x329bd1[_0xc8ea('0x22')]!==_0x11d637[_0xc8ea('0x22')]||_0x329bd1['loggedInDb']!==_0x11d637[_0xc8ea('0x23')]||_0x329bd1[_0xc8ea('0x24')]!==_0x11d637[_0xc8ea('0x24')]||_0x329bd1[_0xc8ea('0x25')]!==_0x11d637['talking']||_0x329bd1[_0xc8ea('0x26')]!==_0x11d637['pTalking']||_0x329bd1[_0xc8ea('0x27')]!==_0x11d637[_0xc8ea('0x27')]||_0x329bd1['inUse']!==_0x11d637['inUse']||_0x329bd1[_0xc8ea('0x28')]!==_0x11d637[_0xc8ea('0x28')];if(_0x329bd1['Trunk']&&_0x11d637[_0xc8ea('0x29')]){_0x48f590=_0x329bd1[_0xc8ea('0x29')][_0xc8ea('0x2a')]!==_0x11d637[_0xc8ea('0x29')][_0xc8ea('0x2a')]||_0x329bd1[_0xc8ea('0x29')]['active']!==_0x11d637['Trunk'][_0xc8ea('0x2b')];}return _0x4c3b52||_0x2852c2||_0x48f590;}exports[_0xc8ea('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x230f97){var _0x50061e=null;var _0x1653f6=_0x230f97[_0xc8ea('0x2d')];if(_[_0xc8ea('0x2e')](_0x230f97[_0xc8ea('0x2f')])||_[_0xc8ea('0x2e')](_0x230f97[_0xc8ea('0x30')])||_['isNil'](_0x230f97[_0xc8ea('0x30')][_0xc8ea('0x31')])){_0x50061e=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xc8ea('0x32')](_0x230f97[_0xc8ea('0x2f')])||_[_0xc8ea('0x32')](_0x230f97[_0xc8ea('0x30')][_0xc8ea('0x31')])){_0x50061e=CAMPAIGN_STATUS[_0xc8ea('0x33')];}else if(_0x1653f6&&!timezones[_0x1653f6]){_0x50061e=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x50061e;}function checkAnyValidTrunk(_0x5e37ea,_0x2bb9a5){var _0x1f49ea=null;var _0x205c26='SIP/';var _0x464703=['reachable','unmonitored'];var _0x464af1=!![];if(_0x5e37ea[_0xc8ea('0x29')]&&_0x5e37ea[_0xc8ea('0x29')][_0xc8ea('0x2b')]){_0x205c26+=_0x5e37ea[_0xc8ea('0x29')]['name'];_0x1f49ea=_0x2bb9a5[_0x205c26];_0x464af1=_0x464703[_0xc8ea('0x34')](_0x1f49ea[_0xc8ea('0x35')]);}else if(_0x5e37ea['TrunkBackup']&&_0x5e37ea['TrunkBackup'][_0xc8ea('0x2b')]){_0x205c26+=_0x5e37ea['TrunkBackup']['name'];_0x1f49ea=_0x2bb9a5[_0x205c26];_0x464af1=_0x464703['includes'](_0x1f49ea[_0xc8ea('0x35')]);}return _0x464af1;}function getQueueCampaignStatusMessage(_0x2dc62d,_0x3486bb){var _0x4010e0=CAMPAIGN_STATUS[_0xc8ea('0x6')];var _0x4c269b=isPreviewCampaign(_0x2dc62d);if(!isQueueCampaignActive(_0x2dc62d)){if(_0x4c269b){_0x4010e0=CAMPAIGN_STATUS[_0xc8ea('0x36')];}else{if(_0x2dc62d[_0xc8ea('0x28')]===0x0&&_0x2dc62d['talking']===0x0&&_0x2dc62d[_0xc8ea('0x27')]===0x0&&(_0x2dc62d[_0xc8ea('0x26')]||0x0)===0x0){_0x4010e0=CAMPAIGN_STATUS[_0xc8ea('0x36')];}else{_0x4010e0=CAMPAIGN_STATUS[_0xc8ea('0x37')];}}}else if(_0x2dc62d[_0xc8ea('0x22')]===0x0){_0x4010e0=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2dc62d,_0x3486bb)){_0x4010e0=CAMPAIGN_STATUS[_0xc8ea('0x38')];}else if(!isPreviewCampaign(_0x2dc62d)){var _0x17387d=checkAnyValidQueueCampaignInterval(_0x2dc62d);if(_0x17387d){_0x4010e0=_0x17387d;}}return _0x4010e0;}exports[_0xc8ea('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5a5f29){var _0x34b0f6=CAMPAIGN_STATUS[_0xc8ea('0x37')];if(_0x5a5f29[_0xc8ea('0x28')]===0x0&&_0x5a5f29[_0xc8ea('0x25')]===0x0&&_0x5a5f29[_0xc8ea('0x27')]===0x0&&(_0x5a5f29[_0xc8ea('0x26')]||0x0)===0x0){_0x34b0f6=CAMPAIGN_STATUS[_0xc8ea('0x36')];}return _0x34b0f6;}exports[_0xc8ea('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x30a98c){var _0xbc988b=_0x30a98c[_0xc8ea('0x3b')](/"(.*?)"/);return _0xbc988b?_0xbc988b[0x1]:_0x30a98c;}exports[_0xc8ea('0x3c')]=extractCalleridName;function getCallerId(_0x2a6607,_0x5d111c,_0x1e967d){if(!_['isUndefined'](_0x1e967d)&&typeof _0x1e967d==='string'&&!_[_0xc8ea('0x32')](_0x1e967d)){if(!_[_0xc8ea('0x3d')](_0x5d111c)&&typeof _0x5d111c===_0xc8ea('0x3e')&&!_[_0xc8ea('0x32')](_0x5d111c)){return util['format'](_0xc8ea('0x3f'),_0x5d111c,_0x1e967d);}return util[_0xc8ea('0x40')]('\x22%s\x22\x20<%s>',_0x1e967d,_0x1e967d);}if(!_[_0xc8ea('0x3d')](_0x2a6607)&&typeof _0x2a6607===_0xc8ea('0x3e')&&!_['isEmpty'](_0x2a6607)){return _0x2a6607;}return'\x22\x22\x20<>';}exports[_0xc8ea('0x41')]=getCallerId;function getCallerIdRandom(_0x3fd4f3,_0x51d259){var _0x57c62d;var _0x397bab;var _0x57a628;if(_0x51d259<=0x0){_0x51d259=0x1;}_0x57c62d=new RegExp(_0xc8ea('0x42')+_0x51d259+'}$');_0x397bab=Math[_0xc8ea('0x43')](0xa,_0x51d259-0x1);_0x57a628=Math[_0xc8ea('0x43')](0xa,_0x51d259)-0x1;return util[_0xc8ea('0x40')]('%s',_[_0xc8ea('0x44')](_0x3fd4f3,_0x57c62d,_['random'](_0x397bab,_0x57a628)['toString']()));}exports[_0xc8ea('0x45')]=getCallerIdRandom;function decrementOriginate(_0x2aeaef){if(_0x2aeaef[_0xc8ea('0x28')]&&_0x2aeaef[_0xc8ea('0x28')]>0x0){_0x2aeaef[_0xc8ea('0x28')]-=0x1;}else{logger[_0xc8ea('0x46')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x478d72){return _0x478d72&&_0x478d72[_0xc8ea('0x47')]>0x0;}exports[_0xc8ea('0x48')]=checkContactEmpty;function erlangb(_0x5a4352,_0x1b2077){if(_0x1b2077===0x0){return 0x0;}var _0x6fb710=0x1;for(var _0xa085a8=0x1;_0xa085a8<=_0x1b2077;_0xa085a8+=0x1){_0x6fb710=0x1+_0x6fb710*_0xa085a8/_0x5a4352;}return 0x1/_0x6fb710;}exports[_0xc8ea('0x49')]=erlangb;function checkContactLowerLimitOriginate(_0x1f5e93,_0x4294f4,_0x6e8132){if(_0x4294f4>_0x6e8132){for(var _0x341777=0x0;_0x341777<_0x4294f4-_0x6e8132;_0x341777+=0x1){decrementOriginate(_0x1f5e93);}}}exports[_0xc8ea('0x4a')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index cfac40e..e95e34d 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(_0x9b1e58,_0x275770){var _0x50d9d4=function(_0x392e6e){while(--_0x392e6e){_0x9b1e58['push'](_0x9b1e58['shift']());}};_0x50d9d4(++_0x275770);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x50767b,_0x10ad8d){var _0x21060d=function(_0x5dd4ea){while(--_0x5dd4ea){_0x50767b['push'](_0x50767b['shift']());}};_0x21060d(++_0x10ad8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 2c1053c..b516fe0 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 _0x4de1=['newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','localstationid','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','catch','error','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState'];(function(_0x31f69b,_0x577037){var _0x88237=function(_0x4e646a){while(--_0x4e646a){_0x31f69b['push'](_0x31f69b['shift']());}};_0x88237(++_0x577037);}(_0x4de1,0x1b9));var _0x14de=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x4de1[_0x1d558c];return _0x15767d;};'use strict';var util=require(_0x14de('0x0'));var _=require(_0x14de('0x1'));var BPromise=require(_0x14de('0x2'));var uuid=require(_0x14de('0x3'));var moment=require(_0x14de('0x4'));var path=require(_0x14de('0x5'));var tiff2pdf=require(_0x14de('0x6'));var gs=require(_0x14de('0x7'));var logger=require(_0x14de('0x8'))(_0x14de('0x9'));var ami=require(_0x14de('0xa'));var rpcDb=require(_0x14de('0xb'));var Channel=require(_0x14de('0xc'));var ut=require(_0x14de('0xd'));var Action=require('./action');var faxAccount=require(_0x14de('0xe'));var attachment=require(_0x14de('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x55e506){this['channels']={};this['faxAccounts']=_0x55e506['faxAccounts'];this[_0x14de('0x10')]=_0x55e506['trunks'];this[_0x14de('0x11')]={};ami['on']('newchannel',this[_0x14de('0x12')][_0x14de('0x13')](this));ami['on']('varset',this[_0x14de('0x14')]['bind'](this));ami['on'](_0x14de('0x15'),this[_0x14de('0x16')][_0x14de('0x13')](this));ami['on'](_0x14de('0x17'),this[_0x14de('0x18')][_0x14de('0x13')](this));ami['on'](_0x14de('0x19'),this[_0x14de('0x1a')]['bind'](this));ami['on'](_0x14de('0x1b'),this[_0x14de('0x1c')][_0x14de('0x13')](this));ami['on'](_0x14de('0x1d'),this[_0x14de('0x1e')][_0x14de('0x13')](this));ami['on'](_0x14de('0x1f'),this[_0x14de('0x20')][_0x14de('0x13')](this));}Fax[_0x14de('0x21')][_0x14de('0x12')]=function(_0x53501f){if(_0x53501f['context']===_0x14de('0x22')){for(var _0x5847e8 in this[_0x14de('0x23')]){if(this[_0x14de('0x23')][_0x14de('0x24')](_0x5847e8)){if(_0x53501f['exten']===this[_0x14de('0x23')][_0x5847e8][_0x14de('0x25')]){this['channels'][_0x53501f[_0x14de('0x26')]]={};this[_0x14de('0x27')][_0x53501f[_0x14de('0x26')]][_0x14de('0x28')]=_0x53501f[_0x14de('0x28')];this[_0x14de('0x27')][_0x53501f['uniqueid']]['id']=this[_0x14de('0x23')][_0x5847e8]['id'];this[_0x14de('0x27')][_0x53501f[_0x14de('0x26')]]['name']=this['faxAccounts'][_0x5847e8][_0x14de('0x29')];logger[_0x14de('0x2a')](_0x53501f[_0x14de('0x26')],_0x14de('0x2b'));}}}}if(this[_0x14de('0x11')][_0x53501f[_0x14de('0x26')]]){this['channels'][_0x53501f['uniqueid']]={};this['channels'][_0x53501f[_0x14de('0x26')]][_0x14de('0x28')]=_0x53501f[_0x14de('0x28')];logger['info'](_0x53501f[_0x14de('0x26')],_0x14de('0x2b'));}};Fax[_0x14de('0x21')][_0x14de('0x14')]=function(_0x456396){if(this[_0x14de('0x27')][_0x456396['uniqueid']]){for(var _0x26237d in _0x456396[_0x14de('0x2c')]){if(_0x456396['variable']['hasOwnProperty'](_0x26237d)){this[_0x14de('0x27')][_0x456396[_0x14de('0x26')]][_0x26237d]=_0x456396[_0x14de('0x2d')];}}}};Fax[_0x14de('0x21')][_0x14de('0x16')]=function(_0x3a5f59){if(this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]]){this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]][_0x14de('0x2e')]=_0x3a5f59[_0x14de('0x2e')];this[_0x14de('0x27')][_0x3a5f59[_0x14de('0x26')]][_0x14de('0x2f')]=_0x3a5f59[_0x14de('0x2f')];}};Fax[_0x14de('0x21')][_0x14de('0x18')]=function(_0x1f8209){if(this[_0x14de('0x27')][_0x1f8209[_0x14de('0x26')]]){for(var _0x319919 in _0x1f8209[_0x14de('0x2c')]){if(_0x1f8209['variable']['hasOwnProperty'](_0x319919)){this[_0x14de('0x27')][_0x1f8209[_0x14de('0x26')]][_0x319919]=_0x1f8209[_0x14de('0x2d')];}}}};Fax[_0x14de('0x21')]['syncFaxStatus']=function(_0x309167){if(this['channels'][_0x309167['uniqueid']]){this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x30')]=_0x309167['operation'];this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x31')]=_0x309167[_0x14de('0x31')];this[_0x14de('0x27')][_0x309167[_0x14de('0x26')]][_0x14de('0x25')]=_0x309167[_0x14de('0x25')];this['channels'][_0x309167['uniqueid']]['filename']=_0x309167['filename'];logger[_0x14de('0x2a')](_0x309167[_0x14de('0x26')],_0x14de('0x32'));}};Fax[_0x14de('0x21')][_0x14de('0x1c')]=function(_0x566d62){var _0x433e45=this;if(this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]){var _0x1e13a=this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['id'];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['remotestationid']=_0x566d62['remotestationid'];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x33')]=_0x566d62[_0x14de('0x33')];this[_0x14de('0x27')][_0x566d62['uniqueid']][_0x14de('0x25')]=_0x566d62[_0x14de('0x25')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]]['resolution']=_0x566d62[_0x14de('0x34')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x35')]=_0x566d62[_0x14de('0x35')];this[_0x14de('0x27')][_0x566d62[_0x14de('0x26')]][_0x14de('0x36')]=_0x566d62[_0x14de('0x36')];this['channels'][_0x566d62[_0x14de('0x26')]][_0x14de('0x37')]=_0x566d62['calleridnum'];if(this[_0x14de('0x27')][_0x566d62['uniqueid']][_0x14de('0x33')]>0x0){tiff2pdf(_0x566d62[_0x14de('0x36')],_0x14de('0x38'),function(_0x551989){logger['info'](_0x566d62['uniqueid'],_0x14de('0x39'),_0x551989[_0x14de('0x3a')]);attachment[_0x14de('0x3b')]({'name':path[_0x14de('0x3c')](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')],'basename':path['parse'](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')]+_0x14de('0x3d'),'type':'application/pdf'})[_0x14de('0x3e')](function(_0x4be546){faxAccount['notify'](_0x1e13a,{'from':_0x566d62[_0x14de('0x37')],'mapKey':'fax','body':path['parse'](_0x566d62[_0x14de('0x36')])[_0x14de('0x29')]+'.pdf','AttachmentId':_0x4be546['id']})[_0x14de('0x3f')](function(_0x75f6cd){logger[_0x14de('0x40')](_0x566d62[_0x14de('0x26')],'\x20notify\x20',JSON[_0x14de('0x41')](_0x75f6cd));});})[_0x14de('0x3f')](function(_0x11bdc0){logger[_0x14de('0x40')](_0x566d62[_0x14de('0x26')],_0x14de('0x42'),JSON[_0x14de('0x41')](_0x11bdc0));});});}logger[_0x14de('0x2a')](_0x566d62['uniqueid'],_0x14de('0x42'));}};Fax[_0x14de('0x21')]['syncOriginateResponse']=function(_0x468d6a){if(this[_0x14de('0x11')][_0x468d6a[_0x14de('0x26')]]){_['merge'](this[_0x14de('0x27')][_0x468d6a[_0x14de('0x26')]],_[_0x14de('0x43')](_0x468d6a,[_0x14de('0x44'),_0x14de('0x45')]));}};function updateStatus(_0x23f48e){if(_0x23f48e[_0x14de('0x46')]){faxMessage[_0x14de('0x47')](_0x23f48e[_0x14de('0x46')],{'failMessage':_0x14de('0x48')})[_0x14de('0x3e')](function(_0x33a309){ut[_0x14de('0x49')](_0x14de('0x4a'),_0x33a309);})[_0x14de('0x3f')](function(_0x438df0){ut[_0x14de('0x49')](_0x14de('0x4b'),_0x438df0);});}else{ut['logger'](_0x14de('0x4c'));}}Fax[_0x14de('0x21')][_0x14de('0x4d')]=function(_0x3a12d9,_0x3a6329,_0x367f83){var _0x2b2b86=this;var _0x3cb725={};if(_0x3a6329){_0x3cb725={'read':_0x3a6329};}else{_0x3cb725={'failMessage':_0x367f83};}if(this[_0x14de('0x11')][_0x3a12d9][_0x14de('0x46')]){faxMessage[_0x14de('0x47')](this[_0x14de('0x11')][_0x3a12d9][_0x14de('0x46')],_0x3cb725)[_0x14de('0x3e')](function(_0x2c9e4f){ut[_0x14de('0x49')]('[Fax][Message][Updated]',_0x2c9e4f);})[_0x14de('0x3f')](function(_0x1d9221){ut[_0x14de('0x49')](_0x14de('0x4e'),_0x1d9221);})[_0x14de('0x4f')](function(){delete _0x2b2b86[_0x14de('0x27')][_0x3a12d9];delete _0x2b2b86[_0x14de('0x11')][_0x3a12d9];});}else{ut[_0x14de('0x49')](_0x14de('0x50'));delete this[_0x14de('0x27')][_0x3a12d9];delete this[_0x14de('0x11')][_0x3a12d9];}};Fax[_0x14de('0x21')][_0x14de('0x1e')]=function(_0x3c2d3c){var _0x1d2555=this;if(this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]]){if(this['actions'][_0x3c2d3c[_0x14de('0x26')]]){this[_0x14de('0x27')][_0x3c2d3c['uniqueid']]['id']=this['actions'][_0x3c2d3c[_0x14de('0x26')]]['id'];this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x29')]=this['actions'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x29')];}logger['info'](_0x3c2d3c[_0x14de('0x26')],this['actions'][_0x3c2d3c[_0x14de('0x26')]]?_0x14de('0x51'):_0x14de('0x52'),JSON[_0x14de('0x41')](this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]]));if(this[_0x14de('0x11')][_0x3c2d3c[_0x14de('0x26')]]){if(this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x53')]>0x0&&this['channels'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x19')]===_0x14de('0x54')){this['updateStatus'](_0x3c2d3c[_0x14de('0x26')],!![]);}else{this['updateStatus'](_0x3c2d3c['uniqueid'],![],this['channels'][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x55')]?_0x14de('0x56')+this[_0x14de('0x27')][_0x3c2d3c[_0x14de('0x26')]][_0x14de('0x55')]:_0x14de('0x57'));}}}};Fax[_0x14de('0x21')]['send']=function(_0x340996){var _0x34af1e=this;return new BPromise(function(_0x5dc910,_0x2c29fb){_0x34af1e[_0x14de('0x58')](_0x340996,_0x34af1e[_0x14de('0x23')][_0x340996[_0x14de('0x59')]])[_0x14de('0x3e')](function(_0x34abb5){ut[_0x14de('0x49')]('[Fax][execOriginate][success]',_0x34abb5);_0x5dc910(ut[_0x14de('0x3a')](_0x14de('0x5a')));})[_0x14de('0x3f')](function(_0x49f74b){ut[_0x14de('0x49')](_0x14de('0x5b'),_0x49f74b);updateStatus(_0x340996);_0x2c29fb(ut[_0x14de('0x3a')](_0x14de('0x5c')));});});};Fax[_0x14de('0x21')]['checkAfterSend']=function(_0x1d30af){var _0x4999cf=this;return new BPromise(function(_0x673e59,_0x105423){var _0x4ca1d4=_0x4999cf[_0x14de('0x5d')](_0x4999cf[_0x14de('0x23')][_0x1d30af['FaxAccountId']][_0x14de('0x5e')],_0x1d30af);if(_0x4ca1d4[_0x14de('0x5f')]){_0x673e59(ut[_0x14de('0x3a')](_0x14de('0x60')));}else{_0x105423(ut['message'](_0x4ca1d4[_0x14de('0x3a')]));}});};function originate(_0x2c3301,_0x5519c9,_0x31c02e){return new BPromise(function(_0x390f26,_0x37aa70){if(_0x31c02e){var _0x5dd2ba=util[_0x14de('0x61')](_0x14de('0x62'),path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])['name'],_0x2c3301[_0x14de('0x5')]);gs[_0x14de('0x63')](_0x5dd2ba)[_0x14de('0x3e')](function(){_0x2c3301[_0x14de('0x5')]=util[_0x14de('0x61')]('%s/%s.tif',path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])[_0x14de('0x64')],path[_0x14de('0x3c')](_0x2c3301[_0x14de('0x5')])[_0x14de('0x29')]);_0x5519c9[_0x14de('0x65')]=_0x2c3301[_0x14de('0x5')];ut[_0x14de('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x14de('0x66')](ut[_0x14de('0x67')](_0x2c3301,_0x5519c9))[_0x14de('0x3e')](function(_0xa8ba59){_0x390f26(_0xa8ba59);})[_0x14de('0x3f')](function(_0x45b310){_0x37aa70(_0x45b310);});})[_0x14de('0x3f')](function(_0xceb6b7){_0x37aa70(_0xceb6b7);});}else{ami[_0x14de('0x66')](ut[_0x14de('0x67')](_0x2c3301,_0x5519c9))[_0x14de('0x3e')](function(_0x1bd017){_0x390f26(_0x1bd017);})[_0x14de('0x3f')](function(_0x5d1e87){_0x37aa70(_0x5d1e87);});}});}Fax[_0x14de('0x21')][_0x14de('0x58')]=function(_0x9e4341,_0x3626f4){var _0x4a16cc=this;return new BPromise(function(_0x3a27d5,_0xb9672e){var _0x180922=uuid['v4']();var _0x15a54f=ut[_0x14de('0x68')](_0x9e4341,_0x3626f4);_0x4a16cc[_0x14de('0x11')][_0x180922]=new Action(_0x180922,_0x3626f4,_0x9e4341);var _0x4da41b=_0x4a16cc[_0x14de('0x11')][_0x180922];if(path['parse'](_0x9e4341[_0x14de('0x5')])[_0x14de('0x69')]==='.pdf'){originate(_0x4da41b,_0x15a54f,!![])[_0x14de('0x3e')](function(_0xb148fa){_0x3a27d5(_0xb148fa);})[_0x14de('0x3f')](function(_0x367792){_0xb9672e(_0x367792);});}else{originate(_0x4da41b,_0x15a54f,![])['then'](function(_0x6286d1){_0x3a27d5(_0x6286d1);})['catch'](function(_0x5ca41a){_0xb9672e(_0x5ca41a);});}});};Fax[_0x14de('0x21')][_0x14de('0x6a')]=function(_0x513e33){return!_[_0x14de('0x6b')](_0x513e33)&&!_[_0x14de('0x6b')](_0x513e33[_0x14de('0x29')])&&!_[_0x14de('0x6b')](_0x513e33['active'])&&_0x513e33[_0x14de('0x6c')]&&!_[_0x14de('0x6b')](this[_0x14de('0x10')][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33['name'])])&&!_['isNil'](this['trunks'][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33['name'])][_0x14de('0x31')])&&(this[_0x14de('0x10')][util[_0x14de('0x61')]('SIP/%s',_0x513e33[_0x14de('0x29')])]['status']==='reachable'||this[_0x14de('0x10')][util[_0x14de('0x61')](_0x14de('0x6d'),_0x513e33[_0x14de('0x29')])][_0x14de('0x31')]==='unmonitored');};Fax['prototype'][_0x14de('0x5d')]=function(_0x5322b2,_0x5c6b7b){if(!this[_0x14de('0x6a')](_0x5322b2)){ut[_0x14de('0x49')](_0x14de('0x6e'),_[_0x14de('0x6b')](_0x5322b2)?'':_0x5322b2[_0x14de('0x29')]+_0x14de('0x6f'));return{'isValid':![],'message':_0x14de('0x70')};}if(_[_0x14de('0x6b')](_0x5c6b7b[_0x14de('0x9')])){ut[_0x14de('0x49')](_0x14de('0x71'),JSON[_0x14de('0x41')](_0x5c6b7b));return{'isValid':![],'message':_0x14de('0x72')};}if(_[_0x14de('0x6b')](_0x5c6b7b[_0x14de('0x5')])){ut[_0x14de('0x49')](_0x14de('0x73'),JSON[_0x14de('0x41')](_0x5c6b7b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x3ff3=['syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','resolution','transferrate','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','calleridnum','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','AttachmentId','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup'];(function(_0x48c98b,_0x47b99b){var _0x97a662=function(_0x130907){while(--_0x130907){_0x48c98b['push'](_0x48c98b['shift']());}};_0x97a662(++_0x47b99b);}(_0x3ff3,0x1b9));var _0x33ff=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3ff3[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0x33ff('0x0'));var _=require(_0x33ff('0x1'));var BPromise=require(_0x33ff('0x2'));var uuid=require(_0x33ff('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x33ff('0x4'));var gs=require(_0x33ff('0x5'));var logger=require(_0x33ff('0x6'))(_0x33ff('0x7'));var ami=require(_0x33ff('0x8'));var rpcDb=require(_0x33ff('0x9'));var Channel=require(_0x33ff('0xa'));var ut=require('./util/util');var Action=require(_0x33ff('0xb'));var faxAccount=require(_0x33ff('0xc'));var attachment=require(_0x33ff('0xd'));var faxMessage=require(_0x33ff('0xe'));function Fax(_0x547e08){this[_0x33ff('0xf')]={};this[_0x33ff('0x10')]=_0x547e08[_0x33ff('0x10')];this[_0x33ff('0x11')]=_0x547e08[_0x33ff('0x11')];this[_0x33ff('0x12')]={};ami['on'](_0x33ff('0x13'),this[_0x33ff('0x14')][_0x33ff('0x15')](this));ami['on'](_0x33ff('0x16'),this[_0x33ff('0x17')][_0x33ff('0x15')](this));ami['on']('newstate',this['syncNewState'][_0x33ff('0x15')](this));ami['on'](_0x33ff('0x18'),this[_0x33ff('0x19')][_0x33ff('0x15')](this));ami['on'](_0x33ff('0x1a'),this[_0x33ff('0x1b')]['bind'](this));ami['on'](_0x33ff('0x1c'),this[_0x33ff('0x1d')][_0x33ff('0x15')](this));ami['on'](_0x33ff('0x1e'),this[_0x33ff('0x1f')]['bind'](this));ami['on'](_0x33ff('0x20'),this['syncOriginateResponse'][_0x33ff('0x15')](this));}Fax[_0x33ff('0x21')]['syncNewchannel']=function(_0x1df606){if(_0x1df606['context']===_0x33ff('0x22')){for(var _0x36632b in this[_0x33ff('0x10')]){if(this['faxAccounts'][_0x33ff('0x23')](_0x36632b)){if(_0x1df606[_0x33ff('0x24')]===this['faxAccounts'][_0x36632b][_0x33ff('0x25')]){this['channels'][_0x1df606[_0x33ff('0x26')]]={};this[_0x33ff('0xf')][_0x1df606[_0x33ff('0x26')]][_0x33ff('0x27')]=_0x1df606[_0x33ff('0x27')];this['channels'][_0x1df606['uniqueid']]['id']=this[_0x33ff('0x10')][_0x36632b]['id'];this[_0x33ff('0xf')][_0x1df606[_0x33ff('0x26')]]['name']=this[_0x33ff('0x10')][_0x36632b][_0x33ff('0x28')];logger[_0x33ff('0x29')](_0x1df606[_0x33ff('0x26')],_0x33ff('0x2a'));}}}}if(this['actions'][_0x1df606[_0x33ff('0x26')]]){this[_0x33ff('0xf')][_0x1df606[_0x33ff('0x26')]]={};this[_0x33ff('0xf')][_0x1df606[_0x33ff('0x26')]][_0x33ff('0x27')]=_0x1df606['channel'];logger[_0x33ff('0x29')](_0x1df606[_0x33ff('0x26')],_0x33ff('0x2a'));}};Fax['prototype']['syncVarSet']=function(_0x5bccb4){if(this[_0x33ff('0xf')][_0x5bccb4['uniqueid']]){for(var _0x441196 in _0x5bccb4['variable']){if(_0x5bccb4[_0x33ff('0x2b')][_0x33ff('0x23')](_0x441196)){this[_0x33ff('0xf')][_0x5bccb4[_0x33ff('0x26')]][_0x441196]=_0x5bccb4[_0x33ff('0x2c')];}}}};Fax[_0x33ff('0x21')]['syncNewState']=function(_0x21902f){if(this[_0x33ff('0xf')][_0x21902f[_0x33ff('0x26')]]){this[_0x33ff('0xf')][_0x21902f[_0x33ff('0x26')]][_0x33ff('0x2d')]=_0x21902f[_0x33ff('0x2d')];this[_0x33ff('0xf')][_0x21902f[_0x33ff('0x26')]][_0x33ff('0x2e')]=_0x21902f[_0x33ff('0x2e')];}};Fax['prototype'][_0x33ff('0x19')]=function(_0x1fbfd4){if(this[_0x33ff('0xf')][_0x1fbfd4[_0x33ff('0x26')]]){for(var _0x405913 in _0x1fbfd4['variable']){if(_0x1fbfd4[_0x33ff('0x2b')][_0x33ff('0x23')](_0x405913)){this[_0x33ff('0xf')][_0x1fbfd4[_0x33ff('0x26')]][_0x405913]=_0x1fbfd4['value'];}}}};Fax[_0x33ff('0x21')][_0x33ff('0x1b')]=function(_0x1aedf9){if(this[_0x33ff('0xf')][_0x1aedf9['uniqueid']]){this['channels'][_0x1aedf9['uniqueid']][_0x33ff('0x2f')]=_0x1aedf9[_0x33ff('0x2f')];this[_0x33ff('0xf')][_0x1aedf9[_0x33ff('0x26')]][_0x33ff('0x30')]=_0x1aedf9[_0x33ff('0x30')];this[_0x33ff('0xf')][_0x1aedf9[_0x33ff('0x26')]][_0x33ff('0x25')]=_0x1aedf9[_0x33ff('0x25')];this[_0x33ff('0xf')][_0x1aedf9[_0x33ff('0x26')]][_0x33ff('0x31')]=_0x1aedf9['filename'];logger[_0x33ff('0x29')](_0x1aedf9[_0x33ff('0x26')],'\x20syncFaxStatus\x20');}};Fax[_0x33ff('0x21')][_0x33ff('0x1d')]=function(_0x4f7c4e){var _0x2c9a1c=this;if(this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]]){var _0x415175=this[_0x33ff('0xf')][_0x4f7c4e['uniqueid']]['id'];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x32')]=_0x4f7c4e[_0x33ff('0x32')];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]]['pagestransferred']=_0x4f7c4e['pagestransferred'];this['channels'][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x25')]=_0x4f7c4e[_0x33ff('0x25')];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x33')]=_0x4f7c4e[_0x33ff('0x33')];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x34')]=_0x4f7c4e[_0x33ff('0x34')];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x31')]=_0x4f7c4e[_0x33ff('0x31')];this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]]['calleridnum']=_0x4f7c4e['calleridnum'];if(this[_0x33ff('0xf')][_0x4f7c4e[_0x33ff('0x26')]][_0x33ff('0x35')]>0x0){tiff2pdf(_0x4f7c4e[_0x33ff('0x31')],_0x33ff('0x36'),function(_0x33181e){logger[_0x33ff('0x29')](_0x4f7c4e[_0x33ff('0x26')],_0x33ff('0x37'),_0x33181e[_0x33ff('0x38')]);attachment[_0x33ff('0x39')]({'name':path[_0x33ff('0x3a')](_0x4f7c4e[_0x33ff('0x31')])['name'],'basename':path[_0x33ff('0x3a')](_0x4f7c4e[_0x33ff('0x31')])[_0x33ff('0x28')]+'.pdf','type':_0x33ff('0x3b')})[_0x33ff('0x3c')](function(_0x36252f){faxAccount[_0x33ff('0x3d')](_0x415175,{'from':_0x4f7c4e[_0x33ff('0x3e')],'mapKey':_0x33ff('0x7'),'body':path[_0x33ff('0x3a')](_0x4f7c4e['filename'])[_0x33ff('0x28')]+_0x33ff('0x3f'),'AttachmentId':_0x36252f['id']})[_0x33ff('0x40')](function(_0x4a50bd){logger['error'](_0x4f7c4e[_0x33ff('0x26')],_0x33ff('0x41'),JSON[_0x33ff('0x42')](_0x4a50bd));});})[_0x33ff('0x40')](function(_0x19848e){logger[_0x33ff('0x43')](_0x4f7c4e[_0x33ff('0x26')],_0x33ff('0x44'),JSON[_0x33ff('0x42')](_0x19848e));});});}logger[_0x33ff('0x29')](_0x4f7c4e[_0x33ff('0x26')],_0x33ff('0x44'));}};Fax[_0x33ff('0x21')]['syncOriginateResponse']=function(_0x2f8825){if(this[_0x33ff('0x12')][_0x2f8825[_0x33ff('0x26')]]){_[_0x33ff('0x45')](this[_0x33ff('0xf')][_0x2f8825[_0x33ff('0x26')]],_['pick'](_0x2f8825,['response','reason']));}};function updateStatus(_0x3db7b2){if(_0x3db7b2['AttachmentId']){faxMessage['update'](_0x3db7b2[_0x33ff('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x33ff('0x3c')](function(_0x21e123){ut[_0x33ff('0x47')]('[Fax][Message][Error][Updated]',_0x21e123);})[_0x33ff('0x40')](function(_0x30dbbd){ut[_0x33ff('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x30dbbd);});}else{ut[_0x33ff('0x47')](_0x33ff('0x48'));}}Fax[_0x33ff('0x21')][_0x33ff('0x49')]=function(_0x522110,_0x1ee269,_0x3ab8a8){var _0x2d62ca=this;var _0xb8a81c={};if(_0x1ee269){_0xb8a81c={'read':_0x1ee269};}else{_0xb8a81c={'failMessage':_0x3ab8a8};}if(this[_0x33ff('0x12')][_0x522110][_0x33ff('0x46')]){faxMessage[_0x33ff('0x4a')](this[_0x33ff('0x12')][_0x522110]['AttachmentId'],_0xb8a81c)[_0x33ff('0x3c')](function(_0x4a86d0){ut[_0x33ff('0x47')](_0x33ff('0x4b'),_0x4a86d0);})['catch'](function(_0x51afcd){ut['logger'](_0x33ff('0x4c'),_0x51afcd);})[_0x33ff('0x4d')](function(){delete _0x2d62ca['channels'][_0x522110];delete _0x2d62ca[_0x33ff('0x12')][_0x522110];});}else{ut[_0x33ff('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x33ff('0xf')][_0x522110];delete this[_0x33ff('0x12')][_0x522110];}};Fax[_0x33ff('0x21')][_0x33ff('0x1f')]=function(_0x4bad13){var _0x2ddd41=this;if(this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]]){if(this[_0x33ff('0x12')][_0x4bad13[_0x33ff('0x26')]]){this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]]['id']=this[_0x33ff('0x12')][_0x4bad13[_0x33ff('0x26')]]['id'];this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]][_0x33ff('0x28')]=this[_0x33ff('0x12')][_0x4bad13[_0x33ff('0x26')]][_0x33ff('0x28')];}logger[_0x33ff('0x29')](_0x4bad13[_0x33ff('0x26')],this[_0x33ff('0x12')][_0x4bad13[_0x33ff('0x26')]]?'\x20hangup\x20sendFile\x20':_0x33ff('0x4e'),JSON[_0x33ff('0x42')](this[_0x33ff('0xf')][_0x4bad13['uniqueid']]));if(this['actions'][_0x4bad13[_0x33ff('0x26')]]){if(this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]][_0x33ff('0x4f')]>0x0&&this[_0x33ff('0xf')][_0x4bad13['uniqueid']][_0x33ff('0x1a')]===_0x33ff('0x50')){this['updateStatus'](_0x4bad13[_0x33ff('0x26')],!![]);}else{this['updateStatus'](_0x4bad13[_0x33ff('0x26')],![],this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]][_0x33ff('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x33ff('0xf')][_0x4bad13[_0x33ff('0x26')]][_0x33ff('0x51')]:'SENDING\x20FAILED');}}}};Fax[_0x33ff('0x21')][_0x33ff('0x52')]=function(_0x3fd996){var _0x12b561=this;return new BPromise(function(_0x233a8a,_0x498aed){_0x12b561[_0x33ff('0x53')](_0x3fd996,_0x12b561['faxAccounts'][_0x3fd996[_0x33ff('0x54')]])[_0x33ff('0x3c')](function(_0x325f57){ut[_0x33ff('0x47')](_0x33ff('0x55'),_0x325f57);_0x233a8a(ut['message']('Fax\x20received'));})['catch'](function(_0x45d9e6){ut[_0x33ff('0x47')](_0x33ff('0x56'),_0x45d9e6);updateStatus(_0x3fd996);_0x498aed(ut[_0x33ff('0x38')](_0x33ff('0x57')));});});};Fax[_0x33ff('0x21')][_0x33ff('0x58')]=function(_0x97839b){var _0x22f332=this;return new BPromise(function(_0x4b0087,_0x5036f6){var _0x556b65=_0x22f332[_0x33ff('0x59')](_0x22f332[_0x33ff('0x10')][_0x97839b[_0x33ff('0x54')]][_0x33ff('0x5a')],_0x97839b);if(_0x556b65[_0x33ff('0x5b')]){_0x4b0087(ut[_0x33ff('0x38')](_0x33ff('0x5c')));}else{_0x5036f6(ut['message'](_0x556b65[_0x33ff('0x38')]));}});};function originate(_0x1b96a2,_0x124c9b,_0x20643d){return new BPromise(function(_0x42c5bc,_0x36410f){if(_0x20643d){var _0x34baf6=util['format'](_0x33ff('0x5d'),path[_0x33ff('0x3a')](_0x1b96a2[_0x33ff('0x5e')])[_0x33ff('0x28')],_0x1b96a2[_0x33ff('0x5e')]);gs[_0x33ff('0x5f')](_0x34baf6)[_0x33ff('0x3c')](function(){_0x1b96a2['path']=util[_0x33ff('0x60')](_0x33ff('0x61'),path['parse'](_0x1b96a2[_0x33ff('0x5e')])[_0x33ff('0x62')],path['parse'](_0x1b96a2[_0x33ff('0x5e')])[_0x33ff('0x28')]);_0x124c9b[_0x33ff('0x63')]=_0x1b96a2['path'];ut[_0x33ff('0x47')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x1b96a2,_0x124c9b))[_0x33ff('0x3c')](function(_0x446148){_0x42c5bc(_0x446148);})[_0x33ff('0x40')](function(_0x220bfc){_0x36410f(_0x220bfc);});})[_0x33ff('0x40')](function(_0x140484){_0x36410f(_0x140484);});}else{ami[_0x33ff('0x64')](ut[_0x33ff('0x65')](_0x1b96a2,_0x124c9b))['then'](function(_0x363aec){_0x42c5bc(_0x363aec);})[_0x33ff('0x40')](function(_0x147d62){_0x36410f(_0x147d62);});}});}Fax[_0x33ff('0x21')][_0x33ff('0x53')]=function(_0x2b5966,_0x40f428){var _0xf9841a=this;return new BPromise(function(_0x46ac4a,_0x55ebe9){var _0x3d4def=uuid['v4']();var _0x336098=ut['addVariables'](_0x2b5966,_0x40f428);_0xf9841a['actions'][_0x3d4def]=new Action(_0x3d4def,_0x40f428,_0x2b5966);var _0x2903ad=_0xf9841a[_0x33ff('0x12')][_0x3d4def];if(path['parse'](_0x2b5966[_0x33ff('0x5e')])[_0x33ff('0x66')]==='.pdf'){originate(_0x2903ad,_0x336098,!![])[_0x33ff('0x3c')](function(_0x5c609a){_0x46ac4a(_0x5c609a);})['catch'](function(_0x52c5a1){_0x55ebe9(_0x52c5a1);});}else{originate(_0x2903ad,_0x336098,![])[_0x33ff('0x3c')](function(_0x229166){_0x46ac4a(_0x229166);})[_0x33ff('0x40')](function(_0x2624a5){_0x55ebe9(_0x2624a5);});}});};Fax[_0x33ff('0x21')][_0x33ff('0x67')]=function(_0x1a44c5){return!_[_0x33ff('0x68')](_0x1a44c5)&&!_['isNil'](_0x1a44c5[_0x33ff('0x28')])&&!_['isNil'](_0x1a44c5['active'])&&_0x1a44c5[_0x33ff('0x69')]&&!_['isNil'](this['trunks'][util[_0x33ff('0x60')](_0x33ff('0x6a'),_0x1a44c5[_0x33ff('0x28')])])&&!_[_0x33ff('0x68')](this[_0x33ff('0x11')][util[_0x33ff('0x60')](_0x33ff('0x6a'),_0x1a44c5['name'])][_0x33ff('0x30')])&&(this[_0x33ff('0x11')][util[_0x33ff('0x60')](_0x33ff('0x6a'),_0x1a44c5[_0x33ff('0x28')])][_0x33ff('0x30')]===_0x33ff('0x6b')||this[_0x33ff('0x11')][util['format'](_0x33ff('0x6a'),_0x1a44c5[_0x33ff('0x28')])][_0x33ff('0x30')]===_0x33ff('0x6c'));};Fax['prototype'][_0x33ff('0x59')]=function(_0x2c8ee5,_0x2e7fba){if(!this['isTrunkReachable'](_0x2c8ee5)){ut[_0x33ff('0x47')](_0x33ff('0x6d'),_[_0x33ff('0x68')](_0x2c8ee5)?'':_0x2c8ee5['name']+_0x33ff('0x6e'));return{'isValid':![],'message':_0x33ff('0x6f')};}if(_['isNil'](_0x2e7fba[_0x33ff('0x7')])){ut[_0x33ff('0x47')](_0x33ff('0x70'),JSON[_0x33ff('0x42')](_0x2e7fba));return{'isValid':![],'message':_0x33ff('0x71')};}if(_[_0x33ff('0x68')](_0x2e7fba[_0x33ff('0x5e')])){ut['logger'](_0x33ff('0x72'),JSON[_0x33ff('0x42')](_0x2e7fba));return{'isValid':![],'message':_0x33ff('0x73')};}return{'isValid':!![],'message':_0x33ff('0x74')};};module[_0x33ff('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2e5ad88..9ad30ee 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 _0x95cc=['../../../config/logger','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird'];(function(_0x4e822d,_0x4f74eb){var _0x1194e0=function(_0x4feb08){while(--_0x4feb08){_0x4e822d['push'](_0x4e822d['shift']());}};_0x1194e0(++_0x4f74eb);}(_0x95cc,0x1c1));var _0xc95c=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x95cc[_0x1c8c28];return _0x1f59b4;};'use strict';var util=require(_0xc95c('0x0'));var BPromise=require(_0xc95c('0x1'));var logger=require(_0xc95c('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xc95c('0x3'));function loggerCatch(_0x163f1b){return function(_0x4a4132){logger[_0xc95c('0x4')](_0x163f1b,util[_0xc95c('0x5')](_0x4a4132,{'showHidden':![],'depth':null}));};}exports[_0xc95c('0x6')]=function(_0xe95a7a,_0x250136){return BPromise[_0xc95c('0x7')]()[_0xc95c('0x8')](faxAccount['notify'](_0xe95a7a,_0x250136))[_0xc95c('0x9')](loggerCatch(_0xc95c('0xa')));}; \ No newline at end of file +var _0x75d8=['resolve','notify','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect'];(function(_0x20aebf,_0x3e7ca3){var _0x205b1d=function(_0x263ffd){while(--_0x263ffd){_0x20aebf['push'](_0x20aebf['shift']());}};_0x205b1d(++_0x3e7ca3);}(_0x75d8,0x185));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0x875d('0x0'));var logger=require(_0x875d('0x1'))(_0x875d('0x2'));var _=require(_0x875d('0x3'));var faxAccount=require(_0x875d('0x4'));function loggerCatch(_0x1fd30a){return function(_0x4ccec1){logger[_0x875d('0x5')](_0x1fd30a,util[_0x875d('0x6')](_0x4ccec1,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x872b05,_0x544f08){return BPromise[_0x875d('0x7')]()['then'](faxAccount[_0x875d('0x8')](_0x872b05,_0x544f08))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index f0716f4..b73e38b 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 _0x6330=['exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x2aadeb,_0x149a61){var _0x22cb44=function(_0x59c028){while(--_0x59c028){_0x2aadeb['push'](_0x2aadeb['shift']());}};_0x22cb44(++_0x149a61);}(_0x6330,0x188));var _0x0633=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x6330[_0x4d07cc];return _0x42de3b;};'use strict';var util=require(_0x0633('0x0'));var logger=require(_0x0633('0x1'))('fax');var BPromise=require(_0x0633('0x2'));var exec=require(_0x0633('0x3'))[_0x0633('0x4')];exports[_0x0633('0x5')]=function(_0x34418f){return new BPromise(function(_0x1b404a,_0x7c9bbd){exec(_0x34418f,function(_0xe69d55,_0x15e2e9,_0x254ae1){logger['info'](_0x0633('0x6'),_0x15e2e9);if(_0xe69d55){logger['info'](_0x0633('0x6'),_0x0633('0x7'),util[_0x0633('0x8')](_0xe69d55,{'showHidden':![],'depth':null}),_0x15e2e9,_0x254ae1);_0x7c9bbd(_0xe69d55);}_0x1b404a(_0x15e2e9);});});}; \ No newline at end of file +var _0xf45e=['bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0xf45e,0x1b7));var _0xef45=function(_0x3ea196,_0x19f049){_0x3ea196=_0x3ea196-0x0;var _0xc8e6d3=_0xf45e[_0x3ea196];return _0xc8e6d3;};'use strict';var util=require(_0xef45('0x0'));var logger=require('../../../../config/logger')(_0xef45('0x1'));var BPromise=require(_0xef45('0x2'));var exec=require(_0xef45('0x3'))['exec'];exports[_0xef45('0x4')]=function(_0x428fea){return new BPromise(function(_0x4b51f1,_0x47367a){exec(_0x428fea,function(_0xbd8c65,_0x2150da,_0x4f2edd){logger[_0xef45('0x5')](_0xef45('0x6'),_0x2150da);if(_0xbd8c65){logger['info']('Exec\x20gs',_0xef45('0x7'),util[_0xef45('0x8')](_0xbd8c65,{'showHidden':![],'depth':null}),_0x2150da,_0x4f2edd);_0x47367a(_0xbd8c65);}_0x4b51f1(_0x2150da);});});}; \ 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 ca27efe..a852206 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 _0xfe92=['path','variablesAction','originate','xcally-motion-fax','format','headerinfo','util','lodash','../../../../config/logger','fax','logger','addVariables','ecm','\x22%s\x22','t38timeout','localstationid'];(function(_0x38b575,_0x1f33cf){var _0x53f0c8=function(_0x2bf959){while(--_0x2bf959){_0x38b575['push'](_0x38b575['shift']());}};_0x53f0c8(++_0x1f33cf);}(_0xfe92,0x86));var _0x2fe9=function(_0x216327,_0x5482e3){_0x216327=_0x216327-0x0;var _0x4f152b=_0xfe92[_0x216327];return _0x4f152b;};'use strict';var util=require(_0x2fe9('0x0'));var _=require(_0x2fe9('0x1'));var moment=require('moment');var logger=require(_0x2fe9('0x2'))(_0x2fe9('0x3'));exports['message']=function(_0x577cb5){return{'message':_0x577cb5};};exports[_0x2fe9('0x4')]=function(_0x45a085,_0x1f3829){logger['info'](_0x45a085,util['inspect'](_0x1f3829,{'showHidden':![],'depth':null}));};exports[_0x2fe9('0x5')]=function(_0x1828f9,_0x4de12c){var _0x41cf2e={'XMF-ECM':_0x4de12c[_0x2fe9('0x6')],'XMF-HEADERINFO':_0x4de12c['headerinfo'],'XMF-MINRATE':_0x4de12c['minrate'],'XMF-MAXRATE':_0x4de12c['maxrate'],'XMF-MODEM':util['format'](_0x2fe9('0x7'),_0x4de12c['modem']),'XMF-GATEWAY':_0x4de12c['gateway'],'XMF-FAXDETECT':_0x4de12c['faxdetect'],'XMF-T38TIMEOUT':_0x4de12c[_0x2fe9('0x8')],'XMF-LOCALSTATIONID':_0x4de12c[_0x2fe9('0x9')],'XMF-PATH':_0x1828f9[_0x2fe9('0xa')]};return _0x41cf2e;};exports[_0x2fe9('0xb')]=function(_0x10883e,_0x37e64b){return{'actionid':_0x10883e['uniqueid'],'action':_0x2fe9('0xc'),'channel':_0x10883e['channel'],'Exten':_0x2fe9('0xd'),'Context':'from-sip','Priority':'1','callerid':util[_0x2fe9('0xe')]('\x22%s\x22\x20<%s>',_0x10883e['headerinfo']?_0x10883e[_0x2fe9('0xf')]:'',_0x10883e[_0x2fe9('0x9')]),'variable':_0x37e64b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10883e['uniqueid']};}; \ No newline at end of file +var _0x304d=['lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util'];(function(_0x11d2ab,_0x43d0a2){var _0x5e05fd=function(_0x35591b){while(--_0x35591b){_0x11d2ab['push'](_0x11d2ab['shift']());}};_0x5e05fd(++_0x43d0a2);}(_0x304d,0x11d));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xd304('0x0'));var _=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var logger=require(_0xd304('0x3'))(_0xd304('0x4'));exports[_0xd304('0x5')]=function(_0x2a87ec){return{'message':_0x2a87ec};};exports['logger']=function(_0x5cc1f4,_0x53afa1){logger[_0xd304('0x6')](_0x5cc1f4,util[_0xd304('0x7')](_0x53afa1,{'showHidden':![],'depth':null}));};exports[_0xd304('0x8')]=function(_0x3e6ee9,_0x2f5968){var _0x5cddc3={'XMF-ECM':_0x2f5968[_0xd304('0x9')],'XMF-HEADERINFO':_0x2f5968[_0xd304('0xa')],'XMF-MINRATE':_0x2f5968[_0xd304('0xb')],'XMF-MAXRATE':_0x2f5968[_0xd304('0xc')],'XMF-MODEM':util['format'](_0xd304('0xd'),_0x2f5968[_0xd304('0xe')]),'XMF-GATEWAY':_0x2f5968[_0xd304('0xf')],'XMF-FAXDETECT':_0x2f5968[_0xd304('0x10')],'XMF-T38TIMEOUT':_0x2f5968[_0xd304('0x11')],'XMF-LOCALSTATIONID':_0x2f5968[_0xd304('0x12')],'XMF-PATH':_0x3e6ee9['path']};return _0x5cddc3;};exports[_0xd304('0x13')]=function(_0x29910c,_0x25aede){return{'actionid':_0x29910c[_0xd304('0x14')],'action':'originate','channel':_0x29910c[_0xd304('0x15')],'Exten':_0xd304('0x16'),'Context':_0xd304('0x17'),'Priority':'1','callerid':util[_0xd304('0x18')](_0xd304('0x19'),_0x29910c[_0xd304('0xa')]?_0x29910c['headerinfo']:'',_0x29910c[_0xd304('0x12')]),'variable':_0x25aede,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29910c[_0xd304('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 62ecd88..7aa792b 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 _0x1e53=['initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports'];(function(_0x229be5,_0x9156f6){var _0x326189=function(_0x2cca17){while(--_0x2cca17){_0x229be5['push'](_0x229be5['shift']());}};_0x326189(++_0x9156f6);}(_0x1e53,0x177));var _0x31e5=function(_0x4d26af,_0x2f07e6){_0x4d26af=_0x4d26af-0x0;var _0x4d6d3c=_0x1e53[_0x4d26af];return _0x4d6d3c;};'use strict';var util=require('util');var moment=require(_0x31e5('0x0'));var server=require(_0x31e5('0x1'));var Realtime=require('./realtime');var Report=require(_0x31e5('0x2'));var Acw=require(_0x31e5('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x31e5('0x4'));var Preview=require(_0x31e5('0x5'));var Fax=require(_0x31e5('0x6'));var user=require(_0x31e5('0x7'));var voiceQueue=require(_0x31e5('0x8'));var voiceQueueReport=require(_0x31e5('0x9'));var voiceCallReport=require(_0x31e5('0xa'));var trunk=require(_0x31e5('0xb'));var trigger=require(_0x31e5('0xc'));var template=require(_0x31e5('0xd'));var cmHopperHistory=require(_0x31e5('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x31e5('0xf'));var faxAccount=require(_0x31e5('0x10'));var zendesk=require(_0x31e5('0x11'));var salesforce=require(_0x31e5('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x31e5('0x13'));var desk=require(_0x31e5('0x14'));var zoho=require(_0x31e5('0x15'));var vtiger=require(_0x31e5('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x31e5('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x31e5('0x18'))(_0x31e5('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x31e5('0x1a')](_0x31e5('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x31e5('0x1a')](_0x31e5('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x31e5('0x1c')]()[_0x31e5('0x1d')](user[_0x31e5('0x1e')]())['then'](realtime[_0x31e5('0x1f')]())['then'](user[_0x31e5('0x20')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x21')]())[_0x31e5('0x1d')](trunk[_0x31e5('0x22')]())['then'](realtime[_0x31e5('0x23')]())['then'](voiceQueue['getVoiceQueues']())[_0x31e5('0x1d')](realtime['initVoiceQueues']())[_0x31e5('0x1d')](trigger[_0x31e5('0x24')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x25')]())[_0x31e5('0x1d')](template[_0x31e5('0x26')]())['then'](realtime[_0x31e5('0x27')]())[_0x31e5('0x1d')](zendesk[_0x31e5('0x28')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x29')]())[_0x31e5('0x1d')](salesforce[_0x31e5('0x2a')]())[_0x31e5('0x1d')](realtime['initSalesforceAccounts']())[_0x31e5('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x31e5('0x1d')](realtime[_0x31e5('0x2b')]())[_0x31e5('0x1d')](freshdesk[_0x31e5('0x2c')]())['then'](realtime[_0x31e5('0x2d')]())[_0x31e5('0x1d')](desk[_0x31e5('0x2e')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x2f')]())['then'](zoho[_0x31e5('0x30')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x31')]())[_0x31e5('0x1d')](vtiger[_0x31e5('0x32')]())[_0x31e5('0x1d')](realtime['initVtigerAccounts']())[_0x31e5('0x1d')](freshsales[_0x31e5('0x33')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x34')]())[_0x31e5('0x1d')](servicenow[_0x31e5('0x35')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x36')]())[_0x31e5('0x1d')](dynamics365[_0x31e5('0x37')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x38')]())['then'](campaign[_0x31e5('0x39')]())[_0x31e5('0x1d')](realtime[_0x31e5('0x3a')]())[_0x31e5('0x1d')](voiceExtension[_0x31e5('0x3b')]())['then'](realtime[_0x31e5('0x3c')]())[_0x31e5('0x1d')](faxAccount[_0x31e5('0x3d')]())['then'](realtime['initFaxAccounts']())[_0x31e5('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x31e5('0x1d')](realtime[_0x31e5('0x3e')]())[_0x31e5('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x31e5('0x1d')](realtime[_0x31e5('0x3f')]())[_0x31e5('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x31e5('0x1d')](realtime[_0x31e5('0x40')]())['then'](voiceCallReport[_0x31e5('0x41')]())['then'](realtime[_0x31e5('0x42')]())[_0x31e5('0x43')](function(_0x1c89c3){logger[_0x31e5('0x44')]('[index.js][initParams]',util[_0x31e5('0x45')](_0x1c89c3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x31e5('0x46')](realtime,preview,fax)[_0x31e5('0x1d')](function(){return initRealtime();})[_0x31e5('0x1d')](function(){return initParams();})[_0x31e5('0x1d')](function(){report[_0x31e5('0x47')]();setInterval(initRealtime,0x1388);})[_0x31e5('0x43')](function(_0x2b4fd9){logger[_0x31e5('0x44')](_0x31e5('0x48'),util['inspect'](_0x2b4fd9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xa10c=['moment','./server','./realtime','./dialer','./preview','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','getAgents','getTelephones','initTelephones','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','util'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xa10c,0xeb));var _0xca10=function(_0x2d25f2,_0x535f1b){_0x2d25f2=_0x2d25f2-0x0;var _0x5d1ccf=_0xa10c[_0x2d25f2];return _0x5d1ccf;};'use strict';var util=require(_0xca10('0x0'));var moment=require(_0xca10('0x1'));var server=require(_0xca10('0x2'));var Realtime=require(_0xca10('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xca10('0x4'));var Preview=require(_0xca10('0x5'));var Fax=require('./fax');var user=require(_0xca10('0x6'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xca10('0x7'));var trunk=require(_0xca10('0x8'));var trigger=require('./rpc/trigger');var template=require(_0xca10('0x9'));var cmHopperHistory=require(_0xca10('0xa'));var campaign=require(_0xca10('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xca10('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xca10('0xd'));var sugarcrm=require(_0xca10('0xe'));var freshdesk=require(_0xca10('0xf'));var desk=require(_0xca10('0x10'));var zoho=require(_0xca10('0x11'));var vtiger=require(_0xca10('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xca10('0x13'));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(_0xca10('0x14'))(_0xca10('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xca10('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xca10('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xca10('0x18')]()[_0xca10('0x19')](user[_0xca10('0x1a')]())[_0xca10('0x19')](realtime['initAgents']())[_0xca10('0x19')](user[_0xca10('0x1b')]())[_0xca10('0x19')](realtime[_0xca10('0x1c')]())[_0xca10('0x19')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0xca10('0x19')](voiceQueue[_0xca10('0x1d')]())[_0xca10('0x19')](realtime['initVoiceQueues']())[_0xca10('0x19')](trigger[_0xca10('0x1e')]())[_0xca10('0x19')](realtime[_0xca10('0x1f')]())['then'](template[_0xca10('0x20')]())[_0xca10('0x19')](realtime[_0xca10('0x21')]())['then'](zendesk[_0xca10('0x22')]())[_0xca10('0x19')](realtime[_0xca10('0x23')]())['then'](salesforce[_0xca10('0x24')]())[_0xca10('0x19')](realtime[_0xca10('0x25')]())[_0xca10('0x19')](sugarcrm['getSugarcrmAccounts']())[_0xca10('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xca10('0x26')]())[_0xca10('0x19')](realtime[_0xca10('0x27')]())[_0xca10('0x19')](desk[_0xca10('0x28')]())[_0xca10('0x19')](realtime['initDeskAccounts']())[_0xca10('0x19')](zoho['getZohoAccounts']())[_0xca10('0x19')](realtime[_0xca10('0x29')]())[_0xca10('0x19')](vtiger[_0xca10('0x2a')]())[_0xca10('0x19')](realtime[_0xca10('0x2b')]())[_0xca10('0x19')](freshsales[_0xca10('0x2c')]())[_0xca10('0x19')](realtime['initFreshsalesAccounts']())[_0xca10('0x19')](servicenow['getServicenowAccounts']())[_0xca10('0x19')](realtime['initServicenowAccounts']())[_0xca10('0x19')](dynamics365[_0xca10('0x2d')]())[_0xca10('0x19')](realtime['initDynamics365Accounts']())[_0xca10('0x19')](campaign[_0xca10('0x2e')]())[_0xca10('0x19')](realtime['initCampaigns']())[_0xca10('0x19')](voiceExtension[_0xca10('0x2f')]())[_0xca10('0x19')](realtime[_0xca10('0x30')]())[_0xca10('0x19')](faxAccount[_0xca10('0x31')]())[_0xca10('0x19')](realtime[_0xca10('0x32')]())[_0xca10('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xca10('0x18')]()['then'](voiceQueueReport[_0xca10('0x33')]())[_0xca10('0x19')](realtime[_0xca10('0x34')]())[_0xca10('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())[_0xca10('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0xca10('0x19')](realtime['initCampaignHopperHistory']())[_0xca10('0x19')](voiceCallReport[_0xca10('0x35')]())[_0xca10('0x19')](realtime['initVoiceCallReports']())[_0xca10('0x36')](function(_0x26a5e3){logger[_0xca10('0x37')](_0xca10('0x38'),util[_0xca10('0x39')](_0x26a5e3,{'showHidden':![],'depth':null}));});}function main(){return server[_0xca10('0x3a')](realtime,preview,fax)[_0xca10('0x19')](function(){return initRealtime();})[_0xca10('0x19')](function(){return initParams();})[_0xca10('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xca10('0x36')](function(_0x26cf69){logger[_0xca10('0x37')]('[index.js][main]',util[_0xca10('0x39')](_0x26cf69,{'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 9bb32e7..cda2130 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 _0xadcf=['socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause','toNumber','format','stringify','user:%s','emit','user:save','user:presence','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x1f983d,_0x38ea41){var _0x470773=function(_0x1acb3a){while(--_0x1acb3a){_0x1f983d['push'](_0x1f983d['shift']());}};_0x470773(++_0x38ea41);}(_0xadcf,0xbf));var _0xfadc=function(_0x28a55a,_0x1490bb){_0x28a55a=_0x28a55a-0x0;var _0x176d8c=_0xadcf[_0x28a55a];return _0x176d8c;};'use strict';var _=require(_0xfadc('0x0'));var util=require(_0xfadc('0x1'));var moment=require(_0xfadc('0x2'));var md5=require(_0xfadc('0x3'));var Redis=require(_0xfadc('0x4'));var config=require(_0xfadc('0x5'));config[_0xfadc('0x6')]=_[_0xfadc('0x7')](config[_0xfadc('0x6')],{'host':_0xfadc('0x8'),'port':0x18eb});var io=require(_0xfadc('0x9'))(new Redis(config[_0xfadc('0x6')]));function Agent(_0x35274f){this['id']=_0x35274f['id']||0x0;this[_0xfadc('0xa')]=_0x35274f[_0xfadc('0xa')]||'';this[_0xfadc('0xb')]=_0x35274f['email']||'';this[_0xfadc('0xc')]=_0x35274f[_0xfadc('0xc')]||'';this[_0xfadc('0xd')]=_0x35274f[_0xfadc('0xd')]||'';this['state']=_0xfadc('0xe');this[_0xfadc('0xf')]=0x0;this[_0xfadc('0x10')]=_0xfadc('0xe');this[_0xfadc('0x11')]='';this[_0xfadc('0x12')]='';this[_0xfadc('0x13')]='';this['interface']='';this[_0xfadc('0x14')]=_0x35274f[_0xfadc('0x14')]||![];this['voiceStatus']=_0xfadc('0xe');this['voiceStatusTime']=0x0;this[_0xfadc('0x15')]='';this[_0xfadc('0x16')]='';this[_0xfadc('0x17')]=![];this[_0xfadc('0x18')]=![];this[_0xfadc('0x3')]='';}Agent[_0xfadc('0x19')]['updateStatusRealtime']=function(_0x249c26){var _0x285549;if(_0x249c26&&_0x249c26[_0xfadc('0x1a')]){_0x285549=_0x249c26[_0xfadc('0x1a')][_0xfadc('0x1b')]();switch(_0x285549){case _0xfadc('0x1c'):_0x285549='idle';break;case _0xfadc('0x1d'):_0x285549=_0xfadc('0x1e');break;}}if(_0x285549&&this[_0xfadc('0x1f')]!==_0x285549||_0x249c26[_0xfadc('0x20')]){this['voiceStatusTime']=_[_0xfadc('0x21')](moment()[_0xfadc('0x22')]('x'));}if(_0x285549){this['voiceStatus']=_0x285549;}var _0x2d67b4={'id':this['id'],'name':this[_0xfadc('0xa')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xfadc('0xd')],'state':this['state'],'stateTime':this[_0xfadc('0xf')],'status':this[_0xfadc('0x10')],'address':this[_0xfadc('0x11')],'online':this[_0xfadc('0x14')],'voiceStatus':this[_0xfadc('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xfadc('0x15')],'voiceStatusQueue':this[_0xfadc('0x16')],'interface':this['interface'],'onhold':this['onhold']};var _0x343d8c=md5(JSON[_0xfadc('0x23')](_0x2d67b4));if(this['md5']!==_0x343d8c){this[_0xfadc('0x3')]=_0x343d8c;io['to'](util[_0xfadc('0x22')](_0xfadc('0x24'),_0x2d67b4['name']))[_0xfadc('0x25')](_0xfadc('0x26'),_0x2d67b4);io[_0xfadc('0x25')](_0xfadc('0x27'),_0x2d67b4);}};module['exports']=Agent; \ No newline at end of file +var _0x1387=['exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','talking','statePause','toNumber','stringify','user:%s','emit','user:save','user:presence'];(function(_0xdab9a0,_0x31ab86){var _0x5c771a=function(_0x2f1b52){while(--_0x2f1b52){_0xdab9a0['push'](_0xdab9a0['shift']());}};_0x5c771a(++_0x31ab86);}(_0x1387,0x7c));var _0x7138=function(_0x4080b8,_0x1f8794){_0x4080b8=_0x4080b8-0x0;var _0x17512a=_0x1387[_0x4080b8];return _0x17512a;};'use strict';var _=require(_0x7138('0x0'));var util=require(_0x7138('0x1'));var moment=require(_0x7138('0x2'));var md5=require(_0x7138('0x3'));var Redis=require(_0x7138('0x4'));var config=require('../../../config/environment');config[_0x7138('0x5')]=_[_0x7138('0x6')](config[_0x7138('0x5')],{'host':_0x7138('0x7'),'port':0x18eb});var io=require(_0x7138('0x8'))(new Redis(config['redis']));function Agent(_0x536ae6){this['id']=_0x536ae6['id']||0x0;this['name']=_0x536ae6[_0x7138('0x9')]||'';this[_0x7138('0xa')]=_0x536ae6[_0x7138('0xa')]||'';this[_0x7138('0xb')]=_0x536ae6['accountcode']||'';this[_0x7138('0xc')]=_0x536ae6[_0x7138('0xc')]||'';this[_0x7138('0xd')]=_0x7138('0xe');this[_0x7138('0xf')]=0x0;this[_0x7138('0x10')]=_0x7138('0xe');this[_0x7138('0x11')]='';this[_0x7138('0x12')]='';this[_0x7138('0x13')]='';this[_0x7138('0x14')]='';this[_0x7138('0x15')]=_0x536ae6[_0x7138('0x15')]||![];this[_0x7138('0x16')]=_0x7138('0xe');this[_0x7138('0x17')]=0x0;this[_0x7138('0x18')]='';this[_0x7138('0x19')]='';this[_0x7138('0x1a')]=![];this[_0x7138('0x1b')]=![];this[_0x7138('0x3')]='';}Agent[_0x7138('0x1c')][_0x7138('0x1d')]=function(_0x2ff11c){var _0x55c506;if(_0x2ff11c&&_0x2ff11c[_0x7138('0xd')]){_0x55c506=_0x2ff11c[_0x7138('0xd')][_0x7138('0x1e')]();switch(_0x55c506){case'not_inuse':_0x55c506=_0x7138('0x1f');break;case'inuse':_0x55c506=_0x7138('0x20');break;}}if(_0x55c506&&this[_0x7138('0x16')]!==_0x55c506||_0x2ff11c[_0x7138('0x21')]){this['voiceStatusTime']=_[_0x7138('0x22')](moment()['format']('x'));}if(_0x55c506){this[_0x7138('0x16')]=_0x55c506;}var _0x24ba84={'id':this['id'],'name':this[_0x7138('0x9')],'email':this[_0x7138('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x7138('0xc')],'state':this['state'],'stateTime':this[_0x7138('0xf')],'status':this['status'],'address':this['address'],'online':this[_0x7138('0x15')],'voiceStatus':this[_0x7138('0x16')],'voiceStatusTime':this[_0x7138('0x17')],'voiceStatusCallerIdNumber':this[_0x7138('0x18')],'voiceStatusQueue':this[_0x7138('0x19')],'interface':this['interface'],'onhold':this[_0x7138('0x1a')]};var _0x3170aa=md5(JSON[_0x7138('0x23')](_0x24ba84));if(this[_0x7138('0x3')]!==_0x3170aa){this['md5']=_0x3170aa;io['to'](util['format'](_0x7138('0x24'),_0x24ba84[_0x7138('0x9')]))[_0x7138('0x25')](_0x7138('0x26'),_0x24ba84);io['emit'](_0x7138('0x27'),_0x24ba84);}};module[_0x7138('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ed6f0e0..61f4dc9 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 _0x0586=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x3164dd,_0x2f2f42){var _0xa93942=function(_0x47f07d){while(--_0x47f07d){_0x3164dd['push'](_0x3164dd['shift']());}};_0xa93942(++_0x2f2f42);}(_0x0586,0x9b));var _0x6058=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0586[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x275fe4){this['id']=_0x275fe4['id']||0x0;this['name']=_0x275fe4['name']||'';this[_0x6058('0x0')]=_0x275fe4[_0x6058('0x0')]||'campaign';this['originated']=0x0;this[_0x6058('0x1')]=0x0;this[_0x6058('0x2')]=0x0;this[_0x6058('0x3')]=0x0;this[_0x6058('0x4')]='';this[_0x6058('0x5')]=!![];this['active']=_0x275fe4[_0x6058('0x6')];this[_0x6058('0x7')]=_0x275fe4['limitCalls'];this[_0x6058('0x8')]=_0x275fe4[_0x6058('0x8')]||null;this['dialGlobalInterval']=_0x275fe4[_0x6058('0x9')]?_0x275fe4['dialGlobalInterval']:null;this[_0x6058('0xa')]=_0x275fe4[_0x6058('0xa')];this[_0x6058('0xb')]=_0x275fe4['dialOriginateCallerIdNumber'];this[_0x6058('0xc')]=_0x275fe4[_0x6058('0xc')]||0x1e;this[_0x6058('0xd')]=_0x275fe4[_0x6058('0xd')];this['dialCongestionRetryFrequency']=_0x275fe4[_0x6058('0xe')];this['dialBusyMaxRetry']=_0x275fe4[_0x6058('0xf')];this['dialBusyRetryFrequency']=_0x275fe4['dialBusyRetryFrequency'];this[_0x6058('0x10')]=_0x275fe4[_0x6058('0x10')];this[_0x6058('0x11')]=_0x275fe4[_0x6058('0x11')];this['dialGlobalMaxRetry']=_0x275fe4[_0x6058('0x12')];this[_0x6058('0x13')]=_0x275fe4[_0x6058('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x275fe4['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6058('0x14')]=_0x275fe4[_0x6058('0x14')]||0x3;this[_0x6058('0x15')]=_0x275fe4[_0x6058('0x15')]||0x96;this[_0x6058('0x16')]=_0x275fe4['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x275fe4['dialAbandonedRetryFrequency']||0x96;this[_0x6058('0x17')]=_0x275fe4[_0x6058('0x17')]||0x3;this[_0x6058('0x18')]=_0x275fe4[_0x6058('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x275fe4[_0x6058('0x19')]||0x3;this[_0x6058('0x1a')]=_0x275fe4[_0x6058('0x1a')]||0x96;this[_0x6058('0x1b')]=_0x275fe4['dialOrderByScheduledAt']||_0x6058('0x1c');this[_0x6058('0x1d')]=_0x275fe4['dialPrefix']||undefined;this[_0x6058('0x1e')]=_0x275fe4['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6058('0x1f')]=_0x275fe4['dialCutDigit']||undefined;this[_0x6058('0x20')]=_0x275fe4[_0x6058('0x20')]?_0x275fe4['TrunkBackup']:undefined;this[_0x6058('0x21')]=_0x275fe4['Trunk']?_0x275fe4[_0x6058('0x21')]:undefined;this['Interval']=_0x275fe4['Interval']?_0x275fe4[_0x6058('0x22')]:undefined;this[_0x6058('0x23')]=_0x275fe4[_0x6058('0x23')]?_0x275fe4['SquareProject']:undefined;this[_0x6058('0x24')]=_0x275fe4[_0x6058('0x23')]?_0x275fe4[_0x6058('0x23')][_0x6058('0x25')]:undefined;this[_0x6058('0x26')]=_0x275fe4[_0x6058('0x26')]||![];this[_0x6058('0x27')]=_0x275fe4[_0x6058('0x27')];this[_0x6058('0x28')]=_0x275fe4['dialAMDGreeting'];this[_0x6058('0x29')]=_0x275fe4[_0x6058('0x29')];this['dialAMDTotalAnalysisTime']=_0x275fe4[_0x6058('0x2a')];this[_0x6058('0x2b')]=_0x275fe4[_0x6058('0x2b')];this['dialAMDBetweenWordsSilence']=_0x275fe4[_0x6058('0x2c')];this[_0x6058('0x2d')]=_0x275fe4[_0x6058('0x2d')];this['dialAMDSilenceThreshold']=_0x275fe4[_0x6058('0x2e')];this[_0x6058('0x2f')]=_0x275fe4[_0x6058('0x2f')];}module[_0x6058('0x30')]=Campaign; \ No newline at end of file +var _0x43d3=['Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43d3,0x6d));var _0x343d=function(_0x2d44b5,_0x5c7219){_0x2d44b5=_0x2d44b5-0x0;var _0x34291d=_0x43d3[_0x2d44b5];return _0x34291d;};'use strict';function Campaign(_0x25621b){this['id']=_0x25621b['id']||0x0;this[_0x343d('0x0')]=_0x25621b[_0x343d('0x0')]||'';this[_0x343d('0x1')]=_0x25621b[_0x343d('0x1')]||'campaign';this[_0x343d('0x2')]=0x0;this[_0x343d('0x3')]=0x0;this[_0x343d('0x4')]=0x0;this[_0x343d('0x5')]=0x0;this[_0x343d('0x6')]='';this[_0x343d('0x7')]=!![];this[_0x343d('0x8')]=_0x25621b[_0x343d('0x8')];this[_0x343d('0x9')]=_0x25621b[_0x343d('0x9')];this[_0x343d('0xa')]=_0x25621b[_0x343d('0xa')]||null;this[_0x343d('0xb')]=_0x25621b[_0x343d('0xb')]?_0x25621b[_0x343d('0xb')]:null;this['dialOriginateCallerIdName']=_0x25621b[_0x343d('0xc')];this[_0x343d('0xd')]=_0x25621b['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x25621b[_0x343d('0xe')]||0x1e;this[_0x343d('0xf')]=_0x25621b['dialCongestionMaxRetry'];this[_0x343d('0x10')]=_0x25621b['dialCongestionRetryFrequency'];this[_0x343d('0x11')]=_0x25621b[_0x343d('0x11')];this['dialBusyRetryFrequency']=_0x25621b[_0x343d('0x12')];this[_0x343d('0x13')]=_0x25621b[_0x343d('0x13')];this[_0x343d('0x14')]=_0x25621b[_0x343d('0x14')];this[_0x343d('0x15')]=_0x25621b['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x25621b[_0x343d('0x16')]||0x3;this[_0x343d('0x17')]=_0x25621b['dialNoSuchNumberRetryFrequency']||0x96;this[_0x343d('0x18')]=_0x25621b[_0x343d('0x18')]||0x3;this['dialDropRetryFrequency']=_0x25621b[_0x343d('0x19')]||0x96;this[_0x343d('0x1a')]=_0x25621b[_0x343d('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x25621b[_0x343d('0x1b')]||0x96;this[_0x343d('0x1c')]=_0x25621b[_0x343d('0x1c')]||0x3;this[_0x343d('0x1d')]=_0x25621b[_0x343d('0x1d')]||0x96;this[_0x343d('0x1e')]=_0x25621b[_0x343d('0x1e')]||0x3;this[_0x343d('0x1f')]=_0x25621b[_0x343d('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x25621b[_0x343d('0x20')]||'DESC';this[_0x343d('0x21')]=_0x25621b[_0x343d('0x21')]||undefined;this[_0x343d('0x22')]=_0x25621b[_0x343d('0x22')]||undefined;this[_0x343d('0x23')]=_0x25621b[_0x343d('0x23')]||undefined;this['TrunkBackup']=_0x25621b[_0x343d('0x24')]?_0x25621b[_0x343d('0x24')]:undefined;this['Trunk']=_0x25621b[_0x343d('0x25')]?_0x25621b[_0x343d('0x25')]:undefined;this[_0x343d('0x26')]=_0x25621b[_0x343d('0x26')]?_0x25621b[_0x343d('0x26')]:undefined;this['SquareProject']=_0x25621b[_0x343d('0x27')]?_0x25621b[_0x343d('0x27')]:undefined;this[_0x343d('0x28')]=_0x25621b['SquareProject']?_0x25621b['SquareProject']['name']:undefined;this[_0x343d('0x29')]=_0x25621b[_0x343d('0x29')]||![];this[_0x343d('0x2a')]=_0x25621b[_0x343d('0x2a')];this[_0x343d('0x2b')]=_0x25621b['dialAMDGreeting'];this[_0x343d('0x2c')]=_0x25621b['dialAMDAfterGreetingSilence'];this[_0x343d('0x2d')]=_0x25621b[_0x343d('0x2d')];this[_0x343d('0x2e')]=_0x25621b[_0x343d('0x2e')];this[_0x343d('0x2f')]=_0x25621b['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x25621b['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x25621b[_0x343d('0x30')];this['dialAMDMaximumWordLength']=_0x25621b['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3333c5b..87c56ff 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 _0x6629=['disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','abandoned','lastdata','duration','billableseconds','holdtime','type','tag'];(function(_0x5f0cb3,_0x1812d4){var _0x31ea89=function(_0x4be075){while(--_0x4be075){_0x5f0cb3['push'](_0x5f0cb3['shift']());}};_0x31ea89(++_0x1812d4);}(_0x6629,0x1c2));var _0x9662=function(_0x2520af,_0x217d68){_0x2520af=_0x2520af-0x0;var _0x2a39fb=_0x6629[_0x2520af];return _0x2a39fb;};'use strict';function Channel(){this[_0x9662('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x9662('0x1')]=0x0;this[_0x9662('0x2')]='';this[_0x9662('0x3')]=undefined;this[_0x9662('0x4')]=undefined;this['accountcode']=0x0;this[_0x9662('0x5')]='';this[_0x9662('0x6')]=0x0;this[_0x9662('0x7')]=0x0;this['exten']=0x0;this[_0x9662('0x8')]=![];this[_0x9662('0x9')]=null;this[_0x9662('0xa')]=null;this['unmanaged']=![];this[_0x9662('0xb')]=![];this['lastapplication']='';this[_0x9662('0xc')]='';this[_0x9662('0xd')]=0x0;this[_0x9662('0xe')]=0x0;this[_0x9662('0xf')]=0x0;this[_0x9662('0x10')]=null;this[_0x9662('0x11')]=null;this[_0x9662('0x12')]=null;this[_0x9662('0x13')]=![];this[_0x9662('0x14')]=null;this[_0x9662('0x15')]=null;this[_0x9662('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x9662('0x17')]=undefined;this['transferType']=undefined;this[_0x9662('0x18')]=0x0;}module[_0x9662('0x19')]=Channel; \ No newline at end of file +var _0x81b7=['uniqueid','linkedid','exten','answertime','endtime','lastapplication','lastdata','duration','billableseconds','type','tag','monitorFilename','monitors','transferconnectedlinenum','mohtime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','context'];(function(_0x2950fa,_0x309824){var _0x3407dd=function(_0x17400f){while(--_0x17400f){_0x2950fa['push'](_0x2950fa['shift']());}};_0x3407dd(++_0x309824);}(_0x81b7,0x1f2));var _0x781b=function(_0x49ae71,_0x4733eb){_0x49ae71=_0x49ae71-0x0;var _0x2e37ce=_0x81b7[_0x49ae71];return _0x2e37ce;};'use strict';function Channel(){this['starttime']=null;this[_0x781b('0x0')]='';this[_0x781b('0x1')]='';this[_0x781b('0x2')]=0x0;this[_0x781b('0x3')]='';this['connectedlinenum']=undefined;this[_0x781b('0x4')]=undefined;this['accountcode']=0x0;this[_0x781b('0x5')]='';this[_0x781b('0x6')]=0x0;this[_0x781b('0x7')]=0x0;this[_0x781b('0x8')]=0x0;this['answered']=![];this[_0x781b('0x9')]=null;this[_0x781b('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x781b('0xb')]='';this[_0x781b('0xc')]='';this[_0x781b('0xd')]=0x0;this[_0x781b('0xe')]=0x0;this['holdtime']=0x0;this[_0x781b('0xf')]=null;this[_0x781b('0x10')]=null;this['disposition']=null;this['monitor']=![];this[_0x781b('0x11')]=null;this['queue']=null;this[_0x781b('0x12')]=[];this['transfercalleridnum']=undefined;this[_0x781b('0x13')]=undefined;this['transferType']=undefined;this[_0x781b('0x14')]=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 5c17e6c..49f99ec 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 _0xf008=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xf008,0x79));var _0x8f00=function(_0xeff96,_0x11afb6){_0xeff96=_0xeff96-0x0;var _0x3a14a0=_0xf008[_0xeff96];return _0x3a14a0;};'use strict';function DeskAccount(_0xf10853){this['id']=_0xf10853['id']||0x0;this[_0x8f00('0x0')]=_0xf10853[_0x8f00('0x0')]||'';this[_0x8f00('0x1')]=_0xf10853[_0x8f00('0x1')]||'';this[_0x8f00('0x2')]=_0xf10853[_0x8f00('0x2')]||'';this[_0x8f00('0x3')]=_0xf10853['authType']||'';this[_0x8f00('0x4')]=_0xf10853['password']||'';this['consumerKey']=_0xf10853[_0x8f00('0x5')]||'';this[_0x8f00('0x6')]=_0xf10853[_0x8f00('0x6')]||'';this[_0x8f00('0x7')]=_0xf10853[_0x8f00('0x7')]||'';this[_0x8f00('0x8')]=_0xf10853[_0x8f00('0x8')]||'';this['type']=_0xf10853[_0x8f00('0x9')]||'';this[_0x8f00('0xa')]=_0xf10853[_0x8f00('0xa')]||'';this['Configurations']=_0xf10853[_0x8f00('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xcada=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x334908,_0x109538){var _0x5dce5c=function(_0x45a339){while(--_0x45a339){_0x334908['push'](_0x334908['shift']());}};_0x5dce5c(++_0x109538);}(_0xcada,0x1a3));var _0xacad=function(_0xfb8cd0,_0x5d8877){_0xfb8cd0=_0xfb8cd0-0x0;var _0x160a82=_0xcada[_0xfb8cd0];return _0x160a82;};'use strict';function DeskAccount(_0x34f47a){this['id']=_0x34f47a['id']||0x0;this[_0xacad('0x0')]=_0x34f47a['name']||'';this[_0xacad('0x1')]=_0x34f47a['username']||'';this[_0xacad('0x2')]=_0x34f47a[_0xacad('0x2')]||'';this[_0xacad('0x3')]=_0x34f47a['authType']||'';this['password']=_0x34f47a[_0xacad('0x4')]||'';this[_0xacad('0x5')]=_0x34f47a[_0xacad('0x5')]||'';this[_0xacad('0x6')]=_0x34f47a[_0xacad('0x6')]||'';this[_0xacad('0x7')]=_0x34f47a[_0xacad('0x7')]||'';this['tokenSecret']=_0x34f47a[_0xacad('0x8')]||'';this[_0xacad('0x9')]=_0x34f47a['type']||'';this[_0xacad('0xa')]=_0x34f47a['serverUrl']||'';this[_0xacad('0xb')]=_0x34f47a[_0xacad('0xb')]||{};}module[_0xacad('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6765943..b134163 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 _0x0375=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x0375,0x115));var _0x5037=function(_0x364bce,_0x22a82d){_0x364bce=_0x364bce-0x0;var _0x40d1db=_0x0375[_0x364bce];return _0x40d1db;};'use strict';function Dynamics365Account(_0x2a9a42){this['id']=_0x2a9a42['id']||0x0;this['name']=_0x2a9a42[_0x5037('0x0')]||'';this[_0x5037('0x1')]=_0x2a9a42[_0x5037('0x1')]||'';this['password']=_0x2a9a42[_0x5037('0x2')]||'';this['remoteUri']=_0x2a9a42[_0x5037('0x3')]||'';this['tenantId']=_0x2a9a42[_0x5037('0x4')]||'';this[_0x5037('0x5')]=_0x2a9a42['clientId']||'';this[_0x5037('0x6')]=_0x2a9a42[_0x5037('0x6')]||{};this['serverUrl']=_0x2a9a42[_0x5037('0x7')]||'';this[_0x5037('0x8')]=_0x2a9a42['modernAuthentication']||![];this[_0x5037('0x9')]=_0x2a9a42['Configurations']||{};this['CloudProvider']=_0x2a9a42['CloudProvider']||{};}module[_0x5037('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xf3d7=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x430fc1,_0x1f7eb7){var _0x4fc952=function(_0x2f6df6){while(--_0x2f6df6){_0x430fc1['push'](_0x430fc1['shift']());}};_0x4fc952(++_0x1f7eb7);}(_0xf3d7,0x1be));var _0x7f3d=function(_0x567f0e,_0x2be7a0){_0x567f0e=_0x567f0e-0x0;var _0x15aca8=_0xf3d7[_0x567f0e];return _0x15aca8;};'use strict';function Dynamics365Account(_0x3712d2){this['id']=_0x3712d2['id']||0x0;this[_0x7f3d('0x0')]=_0x3712d2[_0x7f3d('0x0')]||'';this[_0x7f3d('0x1')]=_0x3712d2[_0x7f3d('0x1')]||'';this[_0x7f3d('0x2')]=_0x3712d2[_0x7f3d('0x2')]||'';this[_0x7f3d('0x3')]=_0x3712d2[_0x7f3d('0x3')]||'';this[_0x7f3d('0x4')]=_0x3712d2[_0x7f3d('0x4')]||'';this[_0x7f3d('0x5')]=_0x3712d2['clientId']||'';this[_0x7f3d('0x6')]=_0x3712d2[_0x7f3d('0x6')]||{};this[_0x7f3d('0x7')]=_0x3712d2['serverUrl']||'';this[_0x7f3d('0x8')]=_0x3712d2[_0x7f3d('0x8')]||![];this[_0x7f3d('0x9')]=_0x3712d2[_0x7f3d('0x9')]||{};this[_0x7f3d('0xa')]=_0x3712d2[_0x7f3d('0xa')]||{};}module[_0x7f3d('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 49c82b5..833803c 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 _0x56b9=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x56b9,0x196));var _0x956b=function(_0x5f159a,_0x22553f){_0x5f159a=_0x5f159a-0x0;var _0x38945c=_0x56b9[_0x5f159a];return _0x38945c;};'use strict';function FaxAccount(_0x1189ae){this['id']=_0x1189ae['id']||0x0;this[_0x956b('0x0')]=_0x1189ae[_0x956b('0x0')]||'';this[_0x956b('0x1')]=_0x1189ae[_0x956b('0x1')];this[_0x956b('0x2')]=_0x1189ae['ecm'];this[_0x956b('0x3')]=_0x1189ae['headerinfo'];this[_0x956b('0x4')]=_0x1189ae[_0x956b('0x4')];this[_0x956b('0x5')]=_0x1189ae['minrate']||0x960;this[_0x956b('0x6')]=_0x1189ae[_0x956b('0x6')]||0x3840;this[_0x956b('0x7')]=_0x1189ae[_0x956b('0x7')]||_0x956b('0x8');this[_0x956b('0x9')]=_0x1189ae[_0x956b('0x9')]||'no';this[_0x956b('0xa')]=_0x1189ae['faxdetect']||'no';this[_0x956b('0xb')]=_0x1189ae[_0x956b('0xb')]||0x1388;this['tech']=_0x1189ae[_0x956b('0xc')]||_0x956b('0xd');this[_0x956b('0xe')]=_0x1189ae[_0x956b('0xe')]?_0x1189ae[_0x956b('0xe')]:undefined;this['ListId']=_0x1189ae[_0x956b('0xf')];this[_0x956b('0x10')]=_0x1189ae[_0x956b('0x10')];}module[_0x956b('0x11')]=FaxAccount; \ No newline at end of file +var _0x0323=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk'];(function(_0x37fde3,_0x1c5900){var _0x4532fc=function(_0x26f46){while(--_0x26f46){_0x37fde3['push'](_0x37fde3['shift']());}};_0x4532fc(++_0x1c5900);}(_0x0323,0x102));var _0x3032=function(_0x59b23f,_0x11b0cc){_0x59b23f=_0x59b23f-0x0;var _0x33bf90=_0x0323[_0x59b23f];return _0x33bf90;};'use strict';function FaxAccount(_0x50516b){this['id']=_0x50516b['id']||0x0;this['name']=_0x50516b[_0x3032('0x0')]||'';this[_0x3032('0x1')]=_0x50516b[_0x3032('0x1')];this[_0x3032('0x2')]=_0x50516b[_0x3032('0x2')];this[_0x3032('0x3')]=_0x50516b[_0x3032('0x3')];this['localstationid']=_0x50516b[_0x3032('0x4')];this[_0x3032('0x5')]=_0x50516b[_0x3032('0x5')]||0x960;this[_0x3032('0x6')]=_0x50516b['maxrate']||0x3840;this[_0x3032('0x7')]=_0x50516b[_0x3032('0x7')]||_0x3032('0x8');this[_0x3032('0x9')]=_0x50516b[_0x3032('0x9')]||'no';this['faxdetect']=_0x50516b['faxdetect']||'no';this[_0x3032('0xa')]=_0x50516b[_0x3032('0xa')]||0x1388;this[_0x3032('0xb')]=_0x50516b['tech']||_0x3032('0xc');this[_0x3032('0xd')]=_0x50516b['Trunk']?_0x50516b[_0x3032('0xd')]:undefined;this[_0x3032('0xe')]=_0x50516b[_0x3032('0xe')];this[_0x3032('0xf')]=_0x50516b[_0x3032('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d839fc4..16871f4 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 _0x45e7=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x45e7,0xd1));var _0x745e=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0x45e7[_0xbd3a05];return _0x101f90;};'use strict';function FreshdeskAccount(_0x48f113){this['id']=_0x48f113['id']||0x0;this[_0x745e('0x0')]=_0x48f113[_0x745e('0x0')]||'';this[_0x745e('0x1')]=_0x48f113[_0x745e('0x1')]||'';this[_0x745e('0x2')]=_0x48f113['token']||'';this[_0x745e('0x3')]=_0x48f113[_0x745e('0x3')]||'';this[_0x745e('0x4')]=_0x48f113[_0x745e('0x4')]||'';this[_0x745e('0x5')]=_0x48f113[_0x745e('0x5')]||{};}module[_0x745e('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x03d8=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0xacc118,_0x3aa0d1){var _0x51c83d=function(_0x2a9e9f){while(--_0x2a9e9f){_0xacc118['push'](_0xacc118['shift']());}};_0x51c83d(++_0x3aa0d1);}(_0x03d8,0x1ba));var _0x803d=function(_0x3ea91d,_0x5e4c06){_0x3ea91d=_0x3ea91d-0x0;var _0x3f0629=_0x03d8[_0x3ea91d];return _0x3f0629;};'use strict';function FreshdeskAccount(_0x2049d3){this['id']=_0x2049d3['id']||0x0;this[_0x803d('0x0')]=_0x2049d3[_0x803d('0x0')]||'';this[_0x803d('0x1')]=_0x2049d3[_0x803d('0x1')]||'';this[_0x803d('0x2')]=_0x2049d3[_0x803d('0x3')]||'';this[_0x803d('0x4')]=_0x2049d3['remoteUri']||'';this[_0x803d('0x5')]=_0x2049d3[_0x803d('0x5')]||'';this[_0x803d('0x6')]=_0x2049d3[_0x803d('0x6')]||{};}module[_0x803d('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 31470f0..adfaf7e 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 _0x6dfa=['remoteUri','Configurations','exports','name','username','token'];(function(_0xcdac3b,_0xa8b0c3){var _0xabe044=function(_0x1d7197){while(--_0x1d7197){_0xcdac3b['push'](_0xcdac3b['shift']());}};_0xabe044(++_0xa8b0c3);}(_0x6dfa,0x7b));var _0xa6df=function(_0x160767,_0x1a10c8){_0x160767=_0x160767-0x0;var _0x327818=_0x6dfa[_0x160767];return _0x327818;};'use strict';function FreshsalesAccount(_0x21c653){this['id']=_0x21c653['id']||0x0;this[_0xa6df('0x0')]=_0x21c653[_0xa6df('0x0')]||'';this[_0xa6df('0x1')]=_0x21c653[_0xa6df('0x1')]||'';this['apiKey']=_0x21c653[_0xa6df('0x2')]||'';this['remoteUri']=_0x21c653[_0xa6df('0x3')]||'';this['serverUrl']=_0x21c653['serverUrl']||'';this[_0xa6df('0x4')]=_0x21c653[_0xa6df('0x4')]||{};}module[_0xa6df('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x2070=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0xdbf272,_0x2ba789){var _0x236b25=function(_0x3c2606){while(--_0x3c2606){_0xdbf272['push'](_0xdbf272['shift']());}};_0x236b25(++_0x2ba789);}(_0x2070,0x1a2));var _0x0207=function(_0x3164c7,_0x253f44){_0x3164c7=_0x3164c7-0x0;var _0x57ecb6=_0x2070[_0x3164c7];return _0x57ecb6;};'use strict';function FreshsalesAccount(_0x14e8e6){this['id']=_0x14e8e6['id']||0x0;this['name']=_0x14e8e6[_0x0207('0x0')]||'';this[_0x0207('0x1')]=_0x14e8e6[_0x0207('0x1')]||'';this['apiKey']=_0x14e8e6[_0x0207('0x2')]||'';this[_0x0207('0x3')]=_0x14e8e6['remoteUri']||'';this[_0x0207('0x4')]=_0x14e8e6[_0x0207('0x4')]||'';this['Configurations']=_0x14e8e6[_0x0207('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 c258854..a4eb6a5 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 _0x4869=['connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel'];(function(_0x9516f,_0x28069a){var _0x596bb9=function(_0x127531){while(--_0x127531){_0x9516f['push'](_0x9516f['shift']());}};_0x596bb9(++_0x28069a);}(_0x4869,0x125));var _0x9486=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4869[_0x3ab51d];return _0x29a04e;};'use strict';function QueueReport(){this[_0x9486('0x0')]=_0x9486('0x1');this['uniqueid']='';this[_0x9486('0x2')]='';this[_0x9486('0x3')]='';this[_0x9486('0x4')]='';this[_0x9486('0x5')]=null;this[_0x9486('0x6')]=null;this[_0x9486('0x7')]=0x1;this['count']=0x1;this[_0x9486('0x8')]=![];this[_0x9486('0x9')]=null;this[_0x9486('0xa')]=![];this[_0x9486('0xb')]=null;this[_0x9486('0xc')]=![];this[_0x9486('0xd')]=null;this['originalposition']=0x1;this[_0x9486('0xe')]='';this[_0x9486('0xf')]='';this[_0x9486('0x10')]='';this[_0x9486('0x11')]='';this[_0x9486('0x12')]='';this['exten']='';this[_0x9486('0x13')]='';this[_0x9486('0x14')]=0x0;this[_0x9486('0x15')]=![];this[_0x9486('0x16')]='';this[_0x9486('0x17')]=_0x9486('0x18');this[_0x9486('0x19')]=null;this[_0x9486('0x1a')]=0x0;this['variables']={};}module[_0x9486('0x1b')]=QueueReport; \ No newline at end of file +var _0x2242=['calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum'];(function(_0x320ee1,_0xc23924){var _0x27f4bd=function(_0x3d41ca){while(--_0x3d41ca){_0x320ee1['push'](_0x320ee1['shift']());}};_0x27f4bd(++_0xc23924);}(_0x2242,0x99));var _0x2224=function(_0x3e0f39,_0x21ecdc){_0x3e0f39=_0x3e0f39-0x0;var _0x138771=_0x2242[_0x3e0f39];return _0x138771;};'use strict';function QueueReport(){this[_0x2224('0x0')]=_0x2224('0x1');this['uniqueid']='';this[_0x2224('0x2')]='';this[_0x2224('0x3')]='';this[_0x2224('0x4')]='';this[_0x2224('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x2224('0x6')]=0x1;this[_0x2224('0x7')]=0x1;this[_0x2224('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x2224('0x9')]=![];this[_0x2224('0xa')]=null;this[_0x2224('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x2224('0xc')]='';this['connectedlinenum']='';this[_0x2224('0xd')]='';this[_0x2224('0xe')]='';this[_0x2224('0xf')]='';this[_0x2224('0x10')]='';this[_0x2224('0x11')]='';this[_0x2224('0x12')]=0x0;this[_0x2224('0x13')]=![];this[_0x2224('0x14')]='';this[_0x2224('0x15')]=_0x2224('0x16');this['routealias']=null;this[_0x2224('0x17')]=0x0;this[_0x2224('0x18')]={};}module[_0x2224('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 42a64a8..42a42af 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 _0x0c8d=['name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x1fe2b7,_0x46f1d8){var _0x549911=function(_0x3160bb){while(--_0x3160bb){_0x1fe2b7['push'](_0x1fe2b7['shift']());}};_0x549911(++_0x46f1d8);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0c8d[_0x2e4e19];return _0x9ba20b;};'use strict';function SalesforceAccount(_0x58354d){this['id']=_0x58354d['id']||0x0;this[_0xd0c8('0x0')]=_0x58354d[_0xd0c8('0x0')]||'';this[_0xd0c8('0x1')]=_0x58354d[_0xd0c8('0x1')]||'';this[_0xd0c8('0x2')]=_0x58354d['remoteUri']||'';this['password']=_0x58354d['password']||'';this['clientId']=_0x58354d[_0xd0c8('0x3')]||'';this[_0xd0c8('0x4')]=_0x58354d[_0xd0c8('0x4')]||'';this['securityToken']=_0x58354d[_0xd0c8('0x5')]||'';this['type']=_0x58354d[_0xd0c8('0x6')]||_0xd0c8('0x7');this[_0xd0c8('0x8')]=_0x58354d[_0xd0c8('0x8')]||'';this[_0xd0c8('0x9')]=_0x58354d['Configurations']||{};}module[_0xd0c8('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xea0f=['type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xea0f,0x73));var _0xfea0=function(_0x440aff,_0x4e6611){_0x440aff=_0x440aff-0x0;var _0x801d4a=_0xea0f[_0x440aff];return _0x801d4a;};'use strict';function SalesforceAccount(_0x455bfa){this['id']=_0x455bfa['id']||0x0;this[_0xfea0('0x0')]=_0x455bfa[_0xfea0('0x0')]||'';this['username']=_0x455bfa['username']||'';this[_0xfea0('0x1')]=_0x455bfa[_0xfea0('0x1')]||'';this[_0xfea0('0x2')]=_0x455bfa['password']||'';this['clientId']=_0x455bfa[_0xfea0('0x3')]||'';this[_0xfea0('0x4')]=_0x455bfa[_0xfea0('0x4')]||'';this[_0xfea0('0x5')]=_0x455bfa['securityToken']||'';this[_0xfea0('0x6')]=_0x455bfa['type']||_0xfea0('0x7');this[_0xfea0('0x8')]=_0x455bfa[_0xfea0('0x8')]||'';this[_0xfea0('0x9')]=_0x455bfa[_0xfea0('0x9')]||{};}module[_0xfea0('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 96c408b..a5c1ad8 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 _0x67a7=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4d452c,_0x1e69be){var _0x4bed65=function(_0x32291f){while(--_0x32291f){_0x4d452c['push'](_0x4d452c['shift']());}};_0x4bed65(++_0x1e69be);}(_0x67a7,0x175));var _0x767a=function(_0x502c6e,_0x1f3a40){_0x502c6e=_0x502c6e-0x0;var _0x5b2123=_0x67a7[_0x502c6e];return _0x5b2123;};'use strict';function ServicenowAccount(_0x1878d0){this['id']=_0x1878d0['id']||0x0;this[_0x767a('0x0')]=_0x1878d0[_0x767a('0x0')]||'';this[_0x767a('0x1')]=_0x1878d0['username']||'';this['password']=_0x1878d0[_0x767a('0x2')]||'';this[_0x767a('0x3')]=_0x1878d0[_0x767a('0x3')]||'';this['serverUrl']=_0x1878d0[_0x767a('0x4')]||'';this[_0x767a('0x5')]=_0x1878d0[_0x767a('0x5')]||{};}module[_0x767a('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0fab=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3ad5a9,_0x2a4f4b){var _0x239e7c=function(_0x4722a9){while(--_0x4722a9){_0x3ad5a9['push'](_0x3ad5a9['shift']());}};_0x239e7c(++_0x2a4f4b);}(_0x0fab,0x12d));var _0xb0fa=function(_0x54d54c,_0x1e35ec){_0x54d54c=_0x54d54c-0x0;var _0x47ee83=_0x0fab[_0x54d54c];return _0x47ee83;};'use strict';function ServicenowAccount(_0x360f43){this['id']=_0x360f43['id']||0x0;this[_0xb0fa('0x0')]=_0x360f43[_0xb0fa('0x0')]||'';this[_0xb0fa('0x1')]=_0x360f43[_0xb0fa('0x1')]||'';this[_0xb0fa('0x2')]=_0x360f43[_0xb0fa('0x2')]||'';this['remoteUri']=_0x360f43[_0xb0fa('0x3')]||'';this[_0xb0fa('0x4')]=_0x360f43[_0xb0fa('0x4')]||'';this[_0xb0fa('0x5')]=_0x360f43[_0xb0fa('0x5')]||{};}module[_0xb0fa('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 2751ba6..243ece8 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 _0xa2d7=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0xe687b3,_0x468b9f){var _0x1b765d=function(_0x443767){while(--_0x443767){_0xe687b3['push'](_0xe687b3['shift']());}};_0x1b765d(++_0x468b9f);}(_0xa2d7,0xbb));var _0x7a2d=function(_0x5590fd,_0x58b8b9){_0x5590fd=_0x5590fd-0x0;var _0x54e3e2=_0xa2d7[_0x5590fd];return _0x54e3e2;};'use strict';function SugarcrmAccount(_0x370cd6){this['id']=_0x370cd6['id']||0x0;this[_0x7a2d('0x0')]=_0x370cd6[_0x7a2d('0x0')]||'';this[_0x7a2d('0x1')]=_0x370cd6['username']||'';this[_0x7a2d('0x2')]=_0x370cd6[_0x7a2d('0x2')]||'';this[_0x7a2d('0x3')]=_0x370cd6[_0x7a2d('0x3')]||'';this['serverUrl']=_0x370cd6[_0x7a2d('0x4')]||'';this[_0x7a2d('0x5')]=_0x370cd6[_0x7a2d('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x4e19=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x5b71e6,_0x20a53b){var _0x5fb746=function(_0x44a865){while(--_0x44a865){_0x5b71e6['push'](_0x5b71e6['shift']());}};_0x5fb746(++_0x20a53b);}(_0x4e19,0x13b));var _0x94e1=function(_0x3c11e5,_0x72618c){_0x3c11e5=_0x3c11e5-0x0;var _0x163e43=_0x4e19[_0x3c11e5];return _0x163e43;};'use strict';function SugarcrmAccount(_0x357259){this['id']=_0x357259['id']||0x0;this[_0x94e1('0x0')]=_0x357259[_0x94e1('0x0')]||'';this[_0x94e1('0x1')]=_0x357259['username']||'';this['password']=_0x357259[_0x94e1('0x2')]||'';this['remoteUri']=_0x357259[_0x94e1('0x3')]||'';this[_0x94e1('0x4')]=_0x357259[_0x94e1('0x4')]||'';this['Configurations']=_0x357259['Configurations']||{};}module[_0x94e1('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 543f773..0b64b12 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 _0x84fd=['address','exports','name','accountcode','state','stateTime','status','unknown'];(function(_0x3e6ead,_0x61f91a){var _0x28f590=function(_0x1e2242){while(--_0x1e2242){_0x3e6ead['push'](_0x3e6ead['shift']());}};_0x28f590(++_0x61f91a);}(_0x84fd,0xda));var _0xd84f=function(_0xfc59b1,_0x4721d8){_0xfc59b1=_0xfc59b1-0x0;var _0x12d428=_0x84fd[_0xfc59b1];return _0x12d428;};'use strict';function Telephone(_0xea478d){this['id']=_0xea478d['id']||0x0;this[_0xd84f('0x0')]=_0xea478d[_0xd84f('0x0')]||'';this[_0xd84f('0x1')]=_0xea478d[_0xd84f('0x1')]||'';this[_0xd84f('0x2')]='unknown';this[_0xd84f('0x3')]=0x0;this[_0xd84f('0x4')]=_0xd84f('0x5');this[_0xd84f('0x6')]='';}module[_0xd84f('0x7')]=Telephone; \ No newline at end of file +var _0x74ba=['accountcode','unknown','stateTime','status','address','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x74ba,0x174));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';function Telephone(_0x4403ce){this['id']=_0x4403ce['id']||0x0;this['name']=_0x4403ce['name']||'';this[_0xa74b('0x0')]=_0x4403ce['accountcode']||'';this['state']=_0xa74b('0x1');this[_0xa74b('0x2')]=0x0;this[_0xa74b('0x3')]='unknown';this[_0xa74b('0x4')]='';}module[_0xa74b('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fe779e1..4df5265 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(_0x1ae2f7,_0x129974){var _0x4e9446=function(_0x23cdcc){while(--_0x23cdcc){_0x1ae2f7['push'](_0x1ae2f7['shift']());}};_0x4e9446(++_0x129974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x18f9dd,_0x55bee5){var _0x30ee92=function(_0x530869){while(--_0x530869){_0x18f9dd['push'](_0x18f9dd['shift']());}};_0x30ee92(++_0x55bee5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb10b[_0x3d42d8];return _0x27fc41;};'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 cd8c8c5..28292b2 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x3d0bb2,_0x55345c){var _0xbdcd28=function(_0x114d0b){while(--_0x114d0b){_0x3d0bb2['push'](_0x3d0bb2['shift']());}};_0xbdcd28(++_0x55345c);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ccee3,_0x462810){_0x1ccee3=_0x1ccee3-0x0;var _0xd975d8=_0xb10b[_0x1ccee3];return _0xd975d8;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x118bc3,_0x5ea08a){var _0x35d7f3=function(_0xfab654){while(--_0xfab654){_0x118bc3['push'](_0x118bc3['shift']());}};_0x35d7f3(++_0x5ea08a);}(_0x8603,0x190));var _0x3860=function(_0x28a433,_0x53d91b){_0x28a433=_0x28a433-0x0;var _0x2d7b59=_0x8603[_0x28a433];return _0x2d7b59;};'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 bf13434..f0b8c4b 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 _0xb5ca=['split','host','port','domainport','stateRegistry','defaultuser','active','name','state','unknown','stateTime','registry'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xb5ca,0x16e));var _0xab5c=function(_0x3e8a0a,_0x32413c){_0x3e8a0a=_0x3e8a0a-0x0;var _0x3596ca=_0xb5ca[_0x3e8a0a];return _0x3596ca;};'use strict';function Trunk(_0x247f1f){this['id']=_0x247f1f['id']||0x0;this[_0xab5c('0x0')]=_0x247f1f[_0xab5c('0x0')]||![];this[_0xab5c('0x1')]=_0x247f1f['name']||'';this[_0xab5c('0x2')]=_0xab5c('0x3');this[_0xab5c('0x4')]=0x0;this['status']=_0xab5c('0x3');this[_0xab5c('0x5')]=_0x247f1f['registry']&&_0x247f1f['registry']['indexOf'](':')?_0x247f1f['registry'][_0xab5c('0x6')](':')[0x0]:'';this[_0xab5c('0x7')]='';this[_0xab5c('0x8')]='';this['domain']='';this[_0xab5c('0x9')]='';this['refresh']='';this[_0xab5c('0xa')]=_0xab5c('0x3');this['registrationtime']='';this['address']='';this[_0xab5c('0xb')]=_0x247f1f[_0xab5c('0xb')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x3f57=['address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x16bf9f,_0x3dd38d){var _0x5e4858=function(_0x5d2634){while(--_0x5d2634){_0x16bf9f['push'](_0x16bf9f['shift']());}};_0x5e4858(++_0x3dd38d);}(_0x3f57,0x9b));var _0x73f5=function(_0x41a40d,_0x3bad40){_0x41a40d=_0x41a40d-0x0;var _0x3ad2d3=_0x3f57[_0x41a40d];return _0x3ad2d3;};'use strict';function Trunk(_0x4c3ae0){this['id']=_0x4c3ae0['id']||0x0;this[_0x73f5('0x0')]=_0x4c3ae0[_0x73f5('0x0')]||![];this[_0x73f5('0x1')]=_0x4c3ae0[_0x73f5('0x1')]||'';this[_0x73f5('0x2')]=_0x73f5('0x3');this[_0x73f5('0x4')]=0x0;this['status']='unknown';this[_0x73f5('0x5')]=_0x4c3ae0[_0x73f5('0x5')]&&_0x4c3ae0['registry'][_0x73f5('0x6')](':')?_0x4c3ae0[_0x73f5('0x5')][_0x73f5('0x7')](':')[0x0]:'';this[_0x73f5('0x8')]='';this[_0x73f5('0x9')]='';this[_0x73f5('0xa')]='';this[_0x73f5('0xb')]='';this[_0x73f5('0xc')]='';this[_0x73f5('0xd')]='unknown';this[_0x73f5('0xe')]='';this[_0x73f5('0xf')]='';this[_0x73f5('0x10')]=_0x4c3ae0['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 34cb996..41992a3 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 _0x2c39=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x21e4ac,_0x1dc8fb){var _0x59bff6=function(_0x486775){while(--_0x486775){_0x21e4ac['push'](_0x21e4ac['shift']());}};_0x59bff6(++_0x1dc8fb);}(_0x2c39,0x10c));var _0x92c3=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x2c39[_0x1809c5];return _0x5254a4;};'use strict';function voiceExtension(_0x254ce6){this['id']=_0x254ce6['id']||0x0;this[_0x92c3('0x0')]=_0x254ce6[_0x92c3('0x0')]||'';this[_0x92c3('0x1')]=_0x254ce6[_0x92c3('0x1')]||_0x92c3('0x2');this['mandatoryDisposition']=_0x254ce6[_0x92c3('0x3')]||![];}module[_0x92c3('0x4')]=voiceExtension; \ No newline at end of file +var _0x0298=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x2711b2,_0x5d6c25){var _0x5f5533=function(_0x58ab7b){while(--_0x58ab7b){_0x2711b2['push'](_0x2711b2['shift']());}};_0x5f5533(++_0x5d6c25);}(_0x0298,0x1b2));var _0x8029=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0x0298[_0x3512c3];return _0x3b2842;};'use strict';function voiceExtension(_0x53df8c){this['id']=_0x53df8c['id']||0x0;this[_0x8029('0x0')]=_0x53df8c[_0x8029('0x0')]||'';this[_0x8029('0x1')]=_0x53df8c[_0x8029('0x1')]||_0x8029('0x2');this[_0x8029('0x3')]=_0x53df8c[_0x8029('0x3')]||![];}module[_0x8029('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 26693e9..5954a64 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 _0x026b=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','ringall','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls'];(function(_0x34ab1f,_0x47b5cd){var _0x159921=function(_0x595ea5){while(--_0x595ea5){_0x34ab1f['push'](_0x34ab1f['shift']());}};_0x159921(++_0x47b5cd);}(_0x026b,0x98));var _0xb026=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x026b[_0x5581ba];return _0x1e927f;};'use strict';var monitorFormat={'wav':_0xb026('0x0'),'wav49':_0xb026('0x1'),'gsm':_0xb026('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xb026('0x3'),'linear':_0xb026('0x4'),'random':'random','ringall':_0xb026('0x5'),'rr':'roundrobin','rrmemory':_0xb026('0x6'),'rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x7fb731){this['id']=_0x7fb731['id']||0x0;this[_0xb026('0x7')]=_0x7fb731['name']||'';this[_0xb026('0x8')]=_0x7fb731[_0xb026('0x8')]||'';this['type']=_0x7fb731[_0xb026('0x9')]||_0xb026('0xa');this[_0xb026('0xb')]=0x0;this[_0xb026('0xc')]=0x0;this[_0xb026('0xd')]=0x0;this[_0xb026('0xe')]=0x0;this[_0xb026('0xf')]=0x0;this[_0xb026('0x10')]=0x0;this[_0xb026('0x11')]=0x0;this[_0xb026('0x12')]=0x0;this[_0xb026('0x13')]=0x0;this[_0xb026('0x14')]=0x0;this['inUse']=0x0;this[_0xb026('0x15')]=0x0;this[_0xb026('0x16')]=0x0;this[_0xb026('0x17')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0xb026('0x18')]=0x0;this[_0xb026('0x19')]=0x0;this['talking']=0x0;this[_0xb026('0x1a')]=0x0;this[_0xb026('0x1b')]=0x0;this[_0xb026('0x1c')]=_0x7fb731[_0xb026('0x1c')]||![];this[_0xb026('0x1d')]=_0x7fb731['acwTimeout']||0xa;this[_0xb026('0x1e')]=_0x7fb731['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0xb026('0x1f')]='';this['statusMessage']='';this['originated']=0x0;this[_0xb026('0x20')]=0x0;this[_0xb026('0x21')]=_0x7fb731['dialTimezone']||null;this[_0xb026('0x22')]=_0x7fb731[_0xb026('0x22')]?_0x7fb731['dialGlobalInterval']:null;this['dialActive']=_0x7fb731['dialActive'];this[_0xb026('0x23')]=_0x7fb731[_0xb026('0x23')]||'progressive';this['dialLimitChannel']=_0x7fb731[_0xb026('0x24')]||0x0;this['dialLimitQueue']=_0x7fb731['dialLimitQueue']||0x0;this[_0xb026('0x25')]=_0x7fb731[_0xb026('0x25')]||0x1;this[_0xb026('0x26')]=_0x7fb731[_0xb026('0x26')]||_0xb026('0x27');this[_0xb026('0x28')]=_0x7fb731[_0xb026('0x28')]||0.03;this[_0xb026('0x29')]=_0x7fb731[_0xb026('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x7fb731[_0xb026('0x2a')]||_0xb026('0x2b');this[_0xb026('0x2c')]=_0x7fb731[_0xb026('0x2c')]||_0xb026('0x2b');this[_0xb026('0x2d')]=_0x7fb731['dialOriginateTimeout']||0x1e;this[_0xb026('0x2e')]=_0x7fb731['dialQueueOptions']||_0xb026('0x2f');this[_0xb026('0x30')]=_0x7fb731['dialQueueTimeout']||0x3;this[_0xb026('0x31')]=_0x7fb731[_0xb026('0x31')]||undefined;this[_0xb026('0x32')]=_0x7fb731[_0xb026('0x32')]||0x3;this[_0xb026('0x33')]=_0x7fb731['dialCongestionRetryFrequency']||0x96;this[_0xb026('0x34')]=_0x7fb731[_0xb026('0x34')]||0x3;this[_0xb026('0x35')]=_0x7fb731['dialBusyRetryFrequency']||0x96;this[_0xb026('0x36')]=_0x7fb731[_0xb026('0x36')]||0x3;this[_0xb026('0x37')]=_0x7fb731['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x7fb731[_0xb026('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x7fb731[_0xb026('0x39')]||0x96;this['dialDropMaxRetry']=_0x7fb731[_0xb026('0x3a')]||0x3;this[_0xb026('0x3b')]=_0x7fb731[_0xb026('0x3b')]||0x96;this[_0xb026('0x3c')]=_0x7fb731[_0xb026('0x3c')]||0x3;this[_0xb026('0x3d')]=_0x7fb731[_0xb026('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x7fb731[_0xb026('0x3e')]||0x3;this[_0xb026('0x3f')]=_0x7fb731['dialMachineRetryFrequency']||0x96;this[_0xb026('0x40')]=_0x7fb731['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x7fb731[_0xb026('0x41')]||0x96;this[_0xb026('0x42')]=_0x7fb731['callAdditionalPhoneAfterMin']||0x3;this[_0xb026('0x43')]=_0x7fb731[_0xb026('0x43')]||0x4;this['Trunk']=_0x7fb731[_0xb026('0x44')]?_0x7fb731[_0xb026('0x44')]:undefined;this[_0xb026('0x45')]=_0x7fb731[_0xb026('0x45')]?_0x7fb731[_0xb026('0x45')]:undefined;this[_0xb026('0x46')]=_0x7fb731[_0xb026('0x46')]||undefined;this[_0xb026('0x47')]=_0x7fb731[_0xb026('0x47')]?_0x7fb731[_0xb026('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x7fb731[_0xb026('0x48')]||_0xb026('0x49');this[_0xb026('0x4a')]=_0x7fb731[_0xb026('0x4a')]||undefined;this[_0xb026('0x4b')]=_0x7fb731[_0xb026('0x4b')]||undefined;this['strategy']=strategy[_0x7fb731[_0xb026('0x4c')]];this[_0xb026('0x4d')]=!![];this[_0xb026('0x4e')]=_0x7fb731[_0xb026('0x4e')]||![];this[_0xb026('0x4f')]=_0x7fb731[_0xb026('0x4f')];this[_0xb026('0x50')]=_0x7fb731[_0xb026('0x50')];this[_0xb026('0x51')]=_0x7fb731[_0xb026('0x51')];this[_0xb026('0x52')]=_0x7fb731['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x7fb731['dialAMDMinWordLength'];this[_0xb026('0x53')]=_0x7fb731['dialAMDBetweenWordsSilence'];this[_0xb026('0x54')]=_0x7fb731['dialAMDMaximumNumberOfWords'];this[_0xb026('0x55')]=_0x7fb731[_0xb026('0x55')];this[_0xb026('0x56')]=_0x7fb731['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xb026('0x57')]=0x0;this[_0xb026('0x58')]=_0x7fb731[_0xb026('0x58')];this[_0xb026('0x59')]=0x0;this[_0xb026('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb026('0x5b')]=0x0;this[_0xb026('0x5c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xb026('0x5d')]=0x0;this[_0xb026('0x5e')]=0x0;this[_0xb026('0x5f')]=0x0;this[_0xb026('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb026('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xb026('0x62')]=undefined;this[_0xb026('0x63')]=undefined;this[_0xb026('0x64')]=undefined;this[_0xb026('0x65')]=1.05;this[_0xb026('0x66')]=0x0;this[_0xb026('0x67')]=0x0;this[_0xb026('0x68')]=0x0;this[_0xb026('0x69')]=0x0;this[_0xb026('0x6a')]=0x0;this[_0xb026('0x6b')]=0x0;this[_0xb026('0x6c')]=0x0;this[_0xb026('0x6d')]=0x0;this[_0xb026('0x6e')]=_0x7fb731[_0xb026('0x6f')]||0x14;this[_0xb026('0x70')]=_0x7fb731[_0xb026('0x6f')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb026('0x71')]=0x0;this[_0xb026('0x72')]=0x1;this[_0xb026('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xb026('0x74')]=0x0;this[_0xb026('0x75')]=_0x7fb731['dialRecallMeTimeout']||0x1e;this[_0xb026('0x76')]=_0x7fb731[_0xb026('0x76')]||![];this[_0xb026('0x77')]=!!_0x7fb731[_0xb026('0x77')]||![];this[_0xb026('0x78')]=!!_0x7fb731[_0xb026('0x78')]||![];this[_0xb026('0x79')]=_0x7fb731['dialQueueProject2']||undefined;this[_0xb026('0x7a')]=_0x7fb731[_0xb026('0x7a')]||![];this[_0xb026('0x7b')]=_0x7fb731['dialAgiAfterHangupAgent']||![];this[_0xb026('0x8')]=monitorFormat[_0x7fb731[_0xb026('0x8')]]?monitorFormat[_0x7fb731[_0xb026('0x8')]]:undefined;this['mandatoryDisposition']=_0x7fb731[_0xb026('0x7c')]||![];this[_0xb026('0x7d')]=_0x7fb731['mandatoryDispositionPause']?_0x7fb731['mandatoryDispositionPause']:undefined;this[_0xb026('0x7e')]=![];}module[_0xb026('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x7925=['total','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','paused','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound'];(function(_0x1ca1ca,_0x112b71){var _0xe70e9a=function(_0x343892){while(--_0x343892){_0x1ca1ca['push'](_0x1ca1ca['shift']());}};_0xe70e9a(++_0x112b71);}(_0x7925,0xfb));var _0x5792=function(_0x1f0dc5,_0xcb6714){_0x1f0dc5=_0x1f0dc5-0x0;var _0x10b5b7=_0x7925[_0x1f0dc5];return _0x10b5b7;};'use strict';var monitorFormat={'wav':_0x5792('0x0'),'wav49':_0x5792('0x1'),'gsm':_0x5792('0x2')};var strategy={'fewestcalls':_0x5792('0x3'),'leastrecent':'leastrecent','linear':'linear','random':_0x5792('0x4'),'ringall':_0x5792('0x5'),'rr':_0x5792('0x6'),'rrmemory':_0x5792('0x7'),'rrordered':'rrordered','wrandom':_0x5792('0x8')};function VoiceQueue(_0x566c46){this['id']=_0x566c46['id']||0x0;this[_0x5792('0x9')]=_0x566c46['name']||'';this[_0x5792('0xa')]=_0x566c46[_0x5792('0xa')]||'';this[_0x5792('0xb')]=_0x566c46[_0x5792('0xb')]||_0x5792('0xc');this['waiting']=0x0;this[_0x5792('0xd')]=0x0;this['answered']=0x0;this[_0x5792('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0x5792('0xf')]=0x0;this[_0x5792('0x10')]=0x0;this[_0x5792('0x11')]=0x0;this[_0x5792('0x12')]=0x0;this[_0x5792('0x13')]=0x0;this[_0x5792('0x14')]=0x0;this[_0x5792('0x15')]=0x0;this['loggedIn']=0x0;this[_0x5792('0x16')]=0x0;this[_0x5792('0x17')]=0x0;this[_0x5792('0x18')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x5792('0x19')]=0x0;this['unavailable']=0x0;this[_0x5792('0x1a')]=0x0;this[_0x5792('0x1b')]=_0x566c46['acw']||![];this[_0x5792('0x1c')]=_0x566c46['acwTimeout']||0xa;this[_0x5792('0x1d')]=_0x566c46['autopause']||'no';this[_0x5792('0x1e')]=!![];this[_0x5792('0x1f')]='';this[_0x5792('0x20')]='';this[_0x5792('0x21')]=0x0;this['temp']=0x0;this[_0x5792('0x22')]=_0x566c46[_0x5792('0x22')]||null;this['dialGlobalInterval']=_0x566c46[_0x5792('0x23')]?_0x566c46['dialGlobalInterval']:null;this[_0x5792('0x24')]=_0x566c46['dialActive'];this[_0x5792('0x25')]=_0x566c46[_0x5792('0x25')]||_0x5792('0x26');this[_0x5792('0x27')]=_0x566c46['dialLimitChannel']||0x0;this[_0x5792('0x28')]=_0x566c46[_0x5792('0x28')]||0x0;this[_0x5792('0x29')]=_0x566c46[_0x5792('0x29')]||0x1;this['dialPredictiveOptimization']=_0x566c46[_0x5792('0x2a')]||_0x5792('0x2b');this[_0x5792('0x2c')]=_0x566c46[_0x5792('0x2c')]||0.03;this[_0x5792('0x2d')]=_0x566c46['dialPredictiveInterval']||0x258;this[_0x5792('0x2e')]=_0x566c46[_0x5792('0x2e')]||_0x5792('0x2f');this[_0x5792('0x30')]=_0x566c46[_0x5792('0x30')]||'anonymous';this['dialOriginateTimeout']=_0x566c46[_0x5792('0x31')]||0x1e;this[_0x5792('0x32')]=_0x566c46[_0x5792('0x32')]||_0x5792('0x33');this[_0x5792('0x34')]=_0x566c46[_0x5792('0x34')]||0x3;this[_0x5792('0x35')]=_0x566c46[_0x5792('0x35')]||undefined;this[_0x5792('0x36')]=_0x566c46[_0x5792('0x36')]||0x3;this[_0x5792('0x37')]=_0x566c46['dialCongestionRetryFrequency']||0x96;this[_0x5792('0x38')]=_0x566c46['dialBusyMaxRetry']||0x3;this[_0x5792('0x39')]=_0x566c46[_0x5792('0x39')]||0x96;this[_0x5792('0x3a')]=_0x566c46[_0x5792('0x3a')]||0x3;this['dialNoAnswerRetryFrequency']=_0x566c46['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x566c46[_0x5792('0x3b')]||0x3;this[_0x5792('0x3c')]=_0x566c46[_0x5792('0x3c')]||0x96;this[_0x5792('0x3d')]=_0x566c46[_0x5792('0x3d')]||0x3;this[_0x5792('0x3e')]=_0x566c46['dialDropRetryFrequency']||0x96;this[_0x5792('0x3f')]=_0x566c46[_0x5792('0x3f')]||0x3;this[_0x5792('0x40')]=_0x566c46['dialAbandonedRetryFrequency']||0x96;this[_0x5792('0x41')]=_0x566c46[_0x5792('0x41')]||0x3;this[_0x5792('0x42')]=_0x566c46[_0x5792('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x566c46['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x566c46[_0x5792('0x43')]||0x96;this[_0x5792('0x44')]=_0x566c46['callAdditionalPhoneAfterMin']||0x3;this[_0x5792('0x45')]=_0x566c46[_0x5792('0x45')]||0x4;this[_0x5792('0x46')]=_0x566c46[_0x5792('0x46')]?_0x566c46[_0x5792('0x46')]:undefined;this[_0x5792('0x47')]=_0x566c46[_0x5792('0x47')]?_0x566c46['TrunkBackup']:undefined;this[_0x5792('0x48')]=_0x566c46['dialPrefix']||undefined;this[_0x5792('0x49')]=_0x566c46[_0x5792('0x49')]?_0x566c46[_0x5792('0x49')]:undefined;this[_0x5792('0x4a')]=_0x566c46[_0x5792('0x4a')]||_0x5792('0x4b');this[_0x5792('0x4c')]=_0x566c46['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5792('0x4d')]=_0x566c46[_0x5792('0x4d')]||undefined;this[_0x5792('0x4e')]=strategy[_0x566c46[_0x5792('0x4e')]];this[_0x5792('0x4f')]=!![];this[_0x5792('0x50')]=_0x566c46[_0x5792('0x50')]||![];this[_0x5792('0x51')]=_0x566c46['dialAMDInitialSilence'];this[_0x5792('0x52')]=_0x566c46[_0x5792('0x52')];this['dialAMDAfterGreetingSilence']=_0x566c46[_0x5792('0x53')];this[_0x5792('0x54')]=_0x566c46[_0x5792('0x54')];this[_0x5792('0x55')]=_0x566c46[_0x5792('0x55')];this['dialAMDBetweenWordsSilence']=_0x566c46['dialAMDBetweenWordsSilence'];this[_0x5792('0x56')]=_0x566c46[_0x5792('0x56')];this[_0x5792('0x57')]=_0x566c46[_0x5792('0x57')];this[_0x5792('0x58')]=_0x566c46[_0x5792('0x58')];this[_0x5792('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x566c46[_0x5792('0x5a')];this[_0x5792('0x5b')]=0x0;this[_0x5792('0x5c')]=0x0;this[_0x5792('0x5d')]=0x0;this[_0x5792('0x5e')]=0x0;this[_0x5792('0x5f')]=0x0;this[_0x5792('0x60')]=0x0;this[_0x5792('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x5792('0x62')]=0x0;this[_0x5792('0x63')]=0x0;this[_0x5792('0x64')]=0x0;this[_0x5792('0x65')]=0x0;this[_0x5792('0x66')]=0x0;this[_0x5792('0x67')]=0x0;this[_0x5792('0x68')]=undefined;this['startPredictive']=undefined;this[_0x5792('0x69')]=undefined;this[_0x5792('0x6a')]=1.05;this[_0x5792('0x6b')]=0x0;this[_0x5792('0x6c')]=0x0;this[_0x5792('0x6d')]=0x0;this[_0x5792('0x6e')]=0x0;this[_0x5792('0x6f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5792('0x70')]=0x0;this[_0x5792('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x566c46['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x5792('0x72')]=_0x566c46[_0x5792('0x73')]||0xa;this[_0x5792('0x74')]=0x0;this[_0x5792('0x75')]=0x0;this[_0x5792('0x76')]=0x1;this[_0x5792('0x77')]=0x0;this[_0x5792('0x78')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x5792('0x79')]=0x0;this[_0x5792('0x7a')]=_0x566c46[_0x5792('0x7a')]||0x1e;this[_0x5792('0x7b')]=_0x566c46['dialRecallInQueue']||![];this[_0x5792('0x7c')]=!!_0x566c46[_0x5792('0x7c')]||![];this['dialPreviewRecallmeReminder']=!!_0x566c46[_0x5792('0x7d')]||![];this[_0x5792('0x7e')]=_0x566c46[_0x5792('0x7e')]||undefined;this[_0x5792('0x7f')]=_0x566c46[_0x5792('0x7f')]||![];this['dialAgiAfterHangupAgent']=_0x566c46[_0x5792('0x80')]||![];this[_0x5792('0xa')]=monitorFormat[_0x566c46[_0x5792('0xa')]]?monitorFormat[_0x566c46[_0x5792('0xa')]]:undefined;this[_0x5792('0x81')]=_0x566c46['mandatoryDisposition']||![];this[_0x5792('0x82')]=_0x566c46[_0x5792('0x82')]?_0x566c46['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x5792('0x83')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index c807880..09f6b30 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 _0x16a6=['available','loggedIn','paused','ringing','talking','waiting','answered','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','SIP/','incall','includes','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports'];(function(_0x287517,_0x1c3b71){var _0x2306f1=function(_0x138f6e){while(--_0x138f6e){_0x287517['push'](_0x287517['shift']());}};_0x2306f1(++_0x1c3b71);}(_0x16a6,0x15c));var _0x616a=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x16a6[_0x4907de];return _0x482054;};'use strict';var INBOUND_COUNTERS=[_0x616a('0x0'),_0x616a('0x1'),'loggedInDb',_0x616a('0x2'),_0x616a('0x3'),_0x616a('0x4'),_0x616a('0x5')];var OUTBOUND_COUNTERS=[_0x616a('0x0'),_0x616a('0x6'),'inUse',_0x616a('0x1'),_0x616a('0x7'),'originated','outboundAbandonedCallsDay',_0x616a('0x8'),_0x616a('0x9'),'outboundBusyCallsDay','outboundCongestionCallsDay',_0x616a('0xa'),'outboundNoSuchCallsDay',_0x616a('0xb'),'outboundRejectCallsDay',_0x616a('0xc'),_0x616a('0x2'),_0x616a('0xd'),'talking',_0x616a('0xe'),_0x616a('0xf'),_0x616a('0x10'),_0x616a('0x5')];function VoiceQueueSummary(_0x34562a){this['id']=_0x34562a['id'];this[_0x616a('0x11')]=_0x34562a[_0x616a('0x11')];this[_0x616a('0x12')]=_0x34562a['strategy'];this[_0x616a('0x13')]=_0x34562a[_0x616a('0x13')]||0x0;this[_0x616a('0x6')]=_0x34562a[_0x616a('0x6')]||0x0;this[_0x616a('0x0')]=_0x34562a['available']||0x0;this[_0x616a('0x14')]=_0x34562a[_0x616a('0x14')]||0x0;this[_0x616a('0x15')]=_0x34562a[_0x616a('0x15')]||0x0;this[_0x616a('0x16')]=_0x34562a['invalid']||0x0;this[_0x616a('0x1')]=_0x34562a[_0x616a('0x1')]||0x0;this['loggedInDb']=_0x34562a['loggedInDb']||0x0;this[_0x616a('0x17')]=_0x34562a[_0x616a('0x17')]||0x0;this[_0x616a('0x18')]=_0x34562a['notInUse']||0x0;this[_0x616a('0x2')]=_0x34562a[_0x616a('0x2')]||0x0;this['ringing']=_0x34562a['ringing']||0x0;this[_0x616a('0x19')]=_0x34562a[_0x616a('0x19')];this[_0x616a('0xe')]=_0x34562a[_0x616a('0xe')];this['sumDuration']=_0x34562a['sumDuration'];this['sumHoldTime']=_0x34562a['sumHoldTime']||0x0;this['talking']=_0x34562a['talking']||0x0;this[_0x616a('0x10')]=_0x34562a['total']||0x0;this[_0x616a('0x1a')]=_0x34562a[_0x616a('0x1a')];this['unavailable']=_0x34562a[_0x616a('0x1b')]||0x0;this[_0x616a('0x1c')]=_0x34562a[_0x616a('0x1c')]||0x0;this[_0x616a('0x1d')]=_0x34562a['unmanaged']||0x0;this[_0x616a('0x5')]=_0x34562a[_0x616a('0x5')]||0x0;if(_0x34562a[_0x616a('0x1a')]===_0x616a('0x1e')){this['pTalking']=_0x34562a[_0x616a('0xd')]||0x0;this['dialActive']=_0x34562a[_0x616a('0x1f')];this[_0x616a('0x20')]=_0x34562a['dialMethod'];this['dialOriginateCallerIdName']=_0x34562a['dialOriginateCallerIdName'];this[_0x616a('0x21')]=_0x34562a[_0x616a('0x21')];this[_0x616a('0x22')]=_0x34562a[_0x616a('0x22')];this['dialPrefix']=_0x34562a[_0x616a('0x23')];this[_0x616a('0x24')]=_0x34562a[_0x616a('0x24')];this[_0x616a('0x25')]=_0x34562a[_0x616a('0x25')];this[_0x616a('0x8')]=_0x34562a[_0x616a('0x8')];this['outboundBlacklistCallsDay']=_0x34562a[_0x616a('0x9')];this[_0x616a('0x26')]=_0x34562a['outboundBusyCallsDay'];this[_0x616a('0x27')]=_0x34562a['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x34562a[_0x616a('0x28')];this[_0x616a('0x29')]=_0x34562a[_0x616a('0x29')];this['outboundDropCallsDayTimeout']=_0x34562a[_0x616a('0x2a')];this[_0x616a('0xa')]=_0x34562a[_0x616a('0xa')];this[_0x616a('0x2b')]=_0x34562a[_0x616a('0x2b')];this[_0x616a('0x2c')]=_0x34562a['outboundOriginateFailureCallsDay'];this[_0x616a('0xb')]=_0x34562a['outboundReCallsDay'];this[_0x616a('0x2d')]=_0x34562a[_0x616a('0x2d')];this[_0x616a('0xc')]=_0x34562a['outboundUnknownCallsDay'];this[_0x616a('0x2e')]=_0x34562a[_0x616a('0x2e')];this['predictiveIntervalAvgHoldtime']=_0x34562a['predictiveIntervalAvgHoldtime'];this[_0x616a('0x2f')]=_0x34562a[_0x616a('0x2f')];this[_0x616a('0x30')]=_0x34562a[_0x616a('0x30')];this['predictiveIntervalDroppedCallsTimeout']=_0x34562a['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x34562a[_0x616a('0x31')];this[_0x616a('0x32')]=_0x34562a[_0x616a('0x32')];this[_0x616a('0x33')]=_0x34562a[_0x616a('0x33')];this[_0x616a('0x34')]=_0x34562a[_0x616a('0x34')];this[_0x616a('0x35')]=_0x34562a[_0x616a('0x35')];this[_0x616a('0x36')]=_0x34562a['predictiveIntervalAvailable'];this[_0x616a('0x37')]=_0x34562a['predictiveIntervalTotalCalls'];this[_0x616a('0x38')]=_0x34562a[_0x616a('0x38')];this[_0x616a('0x39')]=_0x34562a[_0x616a('0x39')];this[_0x616a('0x3a')]=_0x34562a[_0x616a('0x3a')];this[_0x616a('0x3b')]=_0x34562a[_0x616a('0x3b')];this[_0x616a('0x3c')]=_0x34562a['erlangBusyFactor'];this[_0x616a('0x3d')]=_0x34562a[_0x616a('0x3d')];this[_0x616a('0x3e')]=_0x34562a[_0x616a('0x3e')];this['message']=_0x34562a[_0x616a('0x3f')];this['statusMessage']=_0x34562a[_0x616a('0x40')];}if(_0x34562a['Trunk']){this[_0x616a('0x41')]={'id':_0x34562a[_0x616a('0x41')]['id'],'name':_0x34562a['Trunk'][_0x616a('0x11')],'active':_0x34562a['Trunk'][_0x616a('0x42')],'callerid':_0x34562a[_0x616a('0x41')][_0x616a('0x43')]};}}VoiceQueueSummary[_0x616a('0x44')][_0x616a('0x45')]=function(_0x21fd2b,_0x3719b,_0x54cad0,_0x3a4ef5){this['loggedInDb']=0x0;this[_0x616a('0x4')]=0x0;this[_0x616a('0x2')]=0x0;this[_0x616a('0x1c')]=0x0;this['notInUse']=0x0;this[_0x616a('0x15')]=0x0;this[_0x616a('0x14')]=0x0;this[_0x616a('0x16')]=0x0;this[_0x616a('0x1b')]=0x0;this[_0x616a('0x3')]=0x0;this['ringInUse']=0x0;this[_0x616a('0x17')]=0x0;if(_0x54cad0){if(_0x54cad0[_0x616a('0x0')]){this[_0x616a('0x0')]=Number(_0x54cad0['available']);}if(_0x54cad0[_0x616a('0x46')]){this[_0x616a('0x1')]=Number(_0x54cad0[_0x616a('0x46')]);}if(_0x54cad0[_0x616a('0x47')]){this[_0x616a('0x5')]=Number(_0x54cad0[_0x616a('0x47')]);}}for(var _0x7052ba=0x0;_0x7052ba<_0x21fd2b['length'];_0x7052ba++){var _0x19059c=_0x3719b[_0x616a('0x48')+_0x21fd2b[_0x7052ba]['name']];if(_0x19059c&&_0x19059c['online']){this[_0x616a('0x7')]+=0x1;}if(_0x21fd2b[_0x7052ba][_0x616a('0x49')]==='1'){this[_0x616a('0x4')]+=0x1;}if(_0x21fd2b[_0x7052ba][_0x616a('0x2')]==='1'&&!['2','7','8'][_0x616a('0x4a')](_0x21fd2b[_0x7052ba][_0x616a('0x4b')])){this['paused']+=0x1;}switch(_0x21fd2b[_0x7052ba][_0x616a('0x4b')]){case'0':this[_0x616a('0x1c')]+=0x1;break;case'1':this[_0x616a('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x616a('0x14')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x616a('0x1b')]+=0x1;break;case'6':this[_0x616a('0x3')]+=0x1;break;case'7':this[_0x616a('0x19')]+=0x1;break;case'8':this[_0x616a('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x616a('0x4c')){var _0x3976b4=Object[_0x616a('0x4d')](_0x3a4ef5);for(var _0x3d42fc=0x0;_0x3d42fc<_0x3976b4[_0x616a('0x4e')];_0x3d42fc++){var _0x588090=_0x3976b4[_0x3d42fc];var _0x35281b=_0x3a4ef5[_0x588090];if(_0x35281b[_0x616a('0x4f')]===this[_0x616a('0x11')]&&_0x35281b[_0x616a('0x1a')]===_0x616a('0x50')&&_0x35281b[_0x616a('0x51')]==='xcally-motion-preview'){this[_0x616a('0x4')]+=0x1;}}if(this[_0x616a('0x4')]>this[_0x616a('0x15')]){this[_0x616a('0x4')]=this['inUse'];}this[_0x616a('0xd')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x616a('0x52')]=function(_0x3f015c){var _0x515419=![];if(_0x3f015c){_0x515419=INBOUND_COUNTERS[_0x616a('0x53')](function(_0x1ea086){return this[_0x1ea086]!==_0x3f015c[_0x1ea086];},this);}return _0x515419;};VoiceQueueSummary[_0x616a('0x44')]['compareToOutboundQueue']=function(_0x32749f){var _0x37fb4d=![];var _0x21c462=![];var _0x3c78f0=![];if(_0x32749f){_0x37fb4d=this['dialMethod']!==_0x32749f['dialMethod']||this[_0x616a('0x1f')]!==_0x32749f[_0x616a('0x1f')]||this[_0x616a('0x3f')]!==_0x32749f[_0x616a('0x3f')]||this['statusMessage']!==_0x32749f[_0x616a('0x40')];_0x21c462=OUTBOUND_COUNTERS[_0x616a('0x53')](function(_0x1b8c83){return this[_0x1b8c83]!==_0x32749f[_0x1b8c83];},this);if(this['Trunk']&&_0x32749f['Trunk']){_0x3c78f0=this[_0x616a('0x41')][_0x616a('0x11')]!==_0x32749f[_0x616a('0x41')][_0x616a('0x11')]||this[_0x616a('0x41')][_0x616a('0x42')]!==_0x32749f[_0x616a('0x41')][_0x616a('0x42')];}}return _0x37fb4d||_0x21c462||_0x3c78f0;};VoiceQueueSummary[_0x616a('0x44')][_0x616a('0x54')]=function(_0x1e8029){this['answered']=_0x1e8029['answered'];this[_0x616a('0x3f')]=_0x1e8029[_0x616a('0x3f')];this[_0x616a('0x40')]=_0x1e8029[_0x616a('0x40')];this['originated']=_0x1e8029['originated'];this[_0x616a('0x55')]=_0x1e8029['outboundAbandonedCallsDay'];this[_0x616a('0x8')]=_0x1e8029[_0x616a('0x8')];this[_0x616a('0x9')]=_0x1e8029[_0x616a('0x9')];this['outboundBusyCallsDay']=_0x1e8029[_0x616a('0x26')];this[_0x616a('0x27')]=_0x1e8029[_0x616a('0x27')];this[_0x616a('0xa')]=_0x1e8029[_0x616a('0xa')];this['outboundNoSuchCallsDay']=_0x1e8029['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1e8029[_0x616a('0xb')];this['outboundRejectCallsDay']=_0x1e8029[_0x616a('0x2d')];this[_0x616a('0xc')]=_0x1e8029['outboundUnknownCallsDay'];this[_0x616a('0xe')]=_0x1e8029['sumBillable'];this['sumDuration']=_0x1e8029[_0x616a('0xf')];this['total']=_0x1e8029['total'];if(this[_0x616a('0x20')]==='preview'){this[_0x616a('0xd')]=_0x1e8029[_0x616a('0xd')];}};module[_0x616a('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x04f1=['inUse','invalid','onHold','notInUse','paused','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','online','includes','status','exten','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','originated','preview','exports','available','loggedIn','loggedInDb','talking','waiting','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy'];(function(_0x31b7ea,_0x5db17a){var _0x5c3cfb=function(_0x7b4ddb){while(--_0x7b4ddb){_0x31b7ea['push'](_0x31b7ea['shift']());}};_0x5c3cfb(++_0x5db17a);}(_0x04f1,0x92));var _0x104f=function(_0xd65d34,_0x3ef837){_0xd65d34=_0xd65d34-0x0;var _0x37496b=_0x04f1[_0xd65d34];return _0x37496b;};'use strict';var INBOUND_COUNTERS=[_0x104f('0x0'),_0x104f('0x1'),_0x104f('0x2'),'paused','ringing',_0x104f('0x3'),_0x104f('0x4')];var OUTBOUND_COUNTERS=[_0x104f('0x0'),'answered','inUse','loggedIn','loggedInDb','originated',_0x104f('0x5'),_0x104f('0x6'),_0x104f('0x7'),_0x104f('0x8'),'outboundCongestionCallsDay',_0x104f('0x9'),_0x104f('0xa'),_0x104f('0xb'),_0x104f('0xc'),'outboundUnknownCallsDay','paused',_0x104f('0xd'),_0x104f('0x3'),_0x104f('0xe'),_0x104f('0xf'),_0x104f('0x10'),_0x104f('0x4')];function VoiceQueueSummary(_0x395321){this['id']=_0x395321['id'];this[_0x104f('0x11')]=_0x395321[_0x104f('0x11')];this[_0x104f('0x12')]=_0x395321['strategy'];this[_0x104f('0x13')]=_0x395321[_0x104f('0x13')]||0x0;this[_0x104f('0x14')]=_0x395321[_0x104f('0x14')]||0x0;this[_0x104f('0x0')]=_0x395321[_0x104f('0x0')]||0x0;this[_0x104f('0x15')]=_0x395321[_0x104f('0x15')]||0x0;this[_0x104f('0x16')]=_0x395321[_0x104f('0x16')]||0x0;this[_0x104f('0x17')]=_0x395321[_0x104f('0x17')]||0x0;this[_0x104f('0x1')]=_0x395321[_0x104f('0x1')]||0x0;this['loggedInDb']=_0x395321[_0x104f('0x2')]||0x0;this[_0x104f('0x18')]=_0x395321[_0x104f('0x18')]||0x0;this[_0x104f('0x19')]=_0x395321['notInUse']||0x0;this[_0x104f('0x1a')]=_0x395321[_0x104f('0x1a')]||0x0;this['ringing']=_0x395321[_0x104f('0x1b')]||0x0;this[_0x104f('0x1c')]=_0x395321['ringInUse'];this[_0x104f('0xe')]=_0x395321[_0x104f('0xe')];this[_0x104f('0xf')]=_0x395321[_0x104f('0xf')];this[_0x104f('0x1d')]=_0x395321[_0x104f('0x1d')]||0x0;this['talking']=_0x395321[_0x104f('0x3')]||0x0;this['total']=_0x395321['total']||0x0;this[_0x104f('0x1e')]=_0x395321[_0x104f('0x1e')];this[_0x104f('0x1f')]=_0x395321['unavailable']||0x0;this['unknown']=_0x395321[_0x104f('0x20')]||0x0;this['unmanaged']=_0x395321[_0x104f('0x21')]||0x0;this[_0x104f('0x4')]=_0x395321[_0x104f('0x4')]||0x0;if(_0x395321['type']===_0x104f('0x22')){this['pTalking']=_0x395321[_0x104f('0xd')]||0x0;this[_0x104f('0x23')]=_0x395321[_0x104f('0x23')];this['dialMethod']=_0x395321[_0x104f('0x24')];this[_0x104f('0x25')]=_0x395321[_0x104f('0x25')];this[_0x104f('0x26')]=_0x395321['dialOriginateCallerIdNumber'];this[_0x104f('0x27')]=_0x395321['dialOriginateTimeout'];this[_0x104f('0x28')]=_0x395321[_0x104f('0x28')];this['temp']=_0x395321[_0x104f('0x29')];this['outboundAnswerAgiCallsDay']=_0x395321[_0x104f('0x2a')];this[_0x104f('0x6')]=_0x395321[_0x104f('0x6')];this[_0x104f('0x7')]=_0x395321[_0x104f('0x7')];this[_0x104f('0x8')]=_0x395321[_0x104f('0x8')];this[_0x104f('0x2b')]=_0x395321[_0x104f('0x2b')];this[_0x104f('0x2c')]=_0x395321['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x395321[_0x104f('0x2d')];this[_0x104f('0x2e')]=_0x395321[_0x104f('0x2e')];this[_0x104f('0x9')]=_0x395321[_0x104f('0x9')];this[_0x104f('0xa')]=_0x395321['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x395321[_0x104f('0x2f')];this[_0x104f('0xb')]=_0x395321[_0x104f('0xb')];this[_0x104f('0xc')]=_0x395321[_0x104f('0xc')];this[_0x104f('0x30')]=_0x395321['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x395321['predictiveIntervalAnsweredCalls'];this[_0x104f('0x31')]=_0x395321[_0x104f('0x31')];this['predictiveIntervalAvgTalktime']=_0x395321[_0x104f('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x395321['predictiveIntervalDroppedCallsCallersExit'];this[_0x104f('0x33')]=_0x395321['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x395321['predictiveIntervalErlangCalls'];this[_0x104f('0x34')]=_0x395321['predictiveIntervalErlangCallsDroppedCalls'];this[_0x104f('0x35')]=_0x395321[_0x104f('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x395321['predictiveIntervalMultiplicativeFactor'];this[_0x104f('0x36')]=_0x395321['predictiveIntervalPauses'];this[_0x104f('0x37')]=_0x395321[_0x104f('0x37')];this['predictiveIntervalTotalCalls']=_0x395321[_0x104f('0x38')];this['originated']=_0x395321['originated'];this['erlangCalls']=_0x395321[_0x104f('0x39')];this[_0x104f('0x3a')]=_0x395321['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x395321[_0x104f('0x3b')];this[_0x104f('0x3c')]=_0x395321[_0x104f('0x3c')];this[_0x104f('0x3d')]=_0x395321[_0x104f('0x3d')];this[_0x104f('0x3e')]=_0x395321['startProgressive'];this[_0x104f('0x3f')]=_0x395321['message'];this[_0x104f('0x40')]=_0x395321['statusMessage'];}if(_0x395321[_0x104f('0x41')]){this['Trunk']={'id':_0x395321['Trunk']['id'],'name':_0x395321[_0x104f('0x41')][_0x104f('0x11')],'active':_0x395321[_0x104f('0x41')][_0x104f('0x42')],'callerid':_0x395321['Trunk'][_0x104f('0x43')]};}}VoiceQueueSummary[_0x104f('0x44')][_0x104f('0x45')]=function(_0xcf740f,_0x2046ad,_0x18cdbd,_0x58fe76){this['loggedInDb']=0x0;this[_0x104f('0x3')]=0x0;this[_0x104f('0x1a')]=0x0;this[_0x104f('0x20')]=0x0;this[_0x104f('0x19')]=0x0;this[_0x104f('0x16')]=0x0;this[_0x104f('0x15')]=0x0;this['invalid']=0x0;this[_0x104f('0x1f')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x18cdbd){if(_0x18cdbd[_0x104f('0x0')]){this['available']=Number(_0x18cdbd[_0x104f('0x0')]);}if(_0x18cdbd[_0x104f('0x46')]){this[_0x104f('0x1')]=Number(_0x18cdbd[_0x104f('0x46')]);}if(_0x18cdbd[_0x104f('0x47')]){this[_0x104f('0x4')]=Number(_0x18cdbd[_0x104f('0x47')]);}}for(var _0x5d5ebf=0x0;_0x5d5ebf<_0xcf740f[_0x104f('0x48')];_0x5d5ebf++){var _0x39266b=_0x2046ad['SIP/'+_0xcf740f[_0x5d5ebf][_0x104f('0x11')]];if(_0x39266b&&_0x39266b[_0x104f('0x49')]){this[_0x104f('0x2')]+=0x1;}if(_0xcf740f[_0x5d5ebf]['incall']==='1'){this[_0x104f('0x3')]+=0x1;}if(_0xcf740f[_0x5d5ebf][_0x104f('0x1a')]==='1'&&!['2','7','8'][_0x104f('0x4a')](_0xcf740f[_0x5d5ebf][_0x104f('0x4b')])){this['paused']+=0x1;}switch(_0xcf740f[_0x5d5ebf][_0x104f('0x4b')]){case'0':this[_0x104f('0x20')]+=0x1;break;case'1':this[_0x104f('0x19')]+=0x1;break;case'2':this[_0x104f('0x16')]+=0x1;break;case'3':this[_0x104f('0x15')]+=0x1;break;case'4':this[_0x104f('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x104f('0x1b')]+=0x1;break;case'7':this[_0x104f('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x104f('0x24')]==='booked'){var _0x79ba52=Object['keys'](_0x58fe76);for(var _0x4e9458=0x0;_0x4e9458<_0x79ba52[_0x104f('0x48')];_0x4e9458++){var _0x5eb872=_0x79ba52[_0x4e9458];var _0x576e8f=_0x58fe76[_0x5eb872];if(_0x576e8f['queue']===this[_0x104f('0x11')]&&_0x576e8f[_0x104f('0x1e')]==='dialer'&&_0x576e8f[_0x104f('0x4c')]===_0x104f('0x4d')){this[_0x104f('0x3')]+=0x1;}}if(this[_0x104f('0x3')]>this['inUse']){this[_0x104f('0x3')]=this[_0x104f('0x16')];}this[_0x104f('0xd')]=0x0;}return this;};VoiceQueueSummary[_0x104f('0x44')]['compareToInboundQueue']=function(_0x4a88f3){var _0x24e0c9=![];if(_0x4a88f3){_0x24e0c9=INBOUND_COUNTERS[_0x104f('0x4e')](function(_0x51b0d5){return this[_0x51b0d5]!==_0x4a88f3[_0x51b0d5];},this);}return _0x24e0c9;};VoiceQueueSummary['prototype'][_0x104f('0x4f')]=function(_0x36eb30){var _0x510453=![];var _0x220818=![];var _0x2f2494=![];if(_0x36eb30){_0x510453=this[_0x104f('0x24')]!==_0x36eb30[_0x104f('0x24')]||this[_0x104f('0x23')]!==_0x36eb30[_0x104f('0x23')]||this['message']!==_0x36eb30['message']||this['statusMessage']!==_0x36eb30[_0x104f('0x40')];_0x220818=OUTBOUND_COUNTERS[_0x104f('0x4e')](function(_0x2de210){return this[_0x2de210]!==_0x36eb30[_0x2de210];},this);if(this['Trunk']&&_0x36eb30[_0x104f('0x41')]){_0x2f2494=this[_0x104f('0x41')][_0x104f('0x11')]!==_0x36eb30['Trunk'][_0x104f('0x11')]||this[_0x104f('0x41')][_0x104f('0x42')]!==_0x36eb30['Trunk']['active'];}}return _0x510453||_0x220818||_0x2f2494;};VoiceQueueSummary[_0x104f('0x44')][_0x104f('0x50')]=function(_0x49ac55){this['answered']=_0x49ac55[_0x104f('0x14')];this['message']=_0x49ac55[_0x104f('0x3f')];this[_0x104f('0x40')]=_0x49ac55[_0x104f('0x40')];this[_0x104f('0x51')]=_0x49ac55['originated'];this['outboundAbandonedCallsDay']=_0x49ac55[_0x104f('0x5')];this['outboundAnswerCallsDay']=_0x49ac55[_0x104f('0x6')];this[_0x104f('0x7')]=_0x49ac55[_0x104f('0x7')];this[_0x104f('0x8')]=_0x49ac55[_0x104f('0x8')];this[_0x104f('0x2b')]=_0x49ac55['outboundCongestionCallsDay'];this[_0x104f('0x9')]=_0x49ac55['outboundNoAnswerCallsDay'];this[_0x104f('0xa')]=_0x49ac55[_0x104f('0xa')];this[_0x104f('0xb')]=_0x49ac55[_0x104f('0xb')];this[_0x104f('0xc')]=_0x49ac55[_0x104f('0xc')];this['outboundUnknownCallsDay']=_0x49ac55[_0x104f('0x30')];this[_0x104f('0xe')]=_0x49ac55[_0x104f('0xe')];this['sumDuration']=_0x49ac55[_0x104f('0xf')];this[_0x104f('0x10')]=_0x49ac55[_0x104f('0x10')];if(this[_0x104f('0x24')]===_0x104f('0x52')){this[_0x104f('0xd')]=_0x49ac55['pTalking'];}};module[_0x104f('0x53')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1aac995..4761b65 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 _0xbaa5=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5b7d6a,_0x63e6a2){var _0x992adf=function(_0x4511ae){while(--_0x4511ae){_0x5b7d6a['push'](_0x5b7d6a['shift']());}};_0x992adf(++_0x63e6a2);}(_0xbaa5,0x1d5));var _0x5baa=function(_0x3e6f3a,_0xac6434){_0x3e6f3a=_0x3e6f3a-0x0;var _0x50ed3b=_0xbaa5[_0x3e6f3a];return _0x50ed3b;};'use strict';function VtigerAccount(_0x5e55b3){this['id']=_0x5e55b3['id']||0x0;this[_0x5baa('0x0')]=_0x5e55b3[_0x5baa('0x0')]||'';this[_0x5baa('0x1')]=_0x5e55b3[_0x5baa('0x1')]||'';this[_0x5baa('0x2')]=_0x5e55b3[_0x5baa('0x2')]||'';this[_0x5baa('0x3')]=_0x5e55b3[_0x5baa('0x3')]||'';this[_0x5baa('0x4')]=_0x5e55b3['serverUrl']||'';this[_0x5baa('0x5')]=_0x5e55b3[_0x5baa('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa680=['serverUrl','exports','name','username','accessKey','remoteUri'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xa680,0xb0));var _0x0a68=function(_0x3f1853,_0x3953ee){_0x3f1853=_0x3f1853-0x0;var _0x3eac4d=_0xa680[_0x3f1853];return _0x3eac4d;};'use strict';function VtigerAccount(_0x24285c){this['id']=_0x24285c['id']||0x0;this[_0x0a68('0x0')]=_0x24285c['name']||'';this['username']=_0x24285c[_0x0a68('0x1')]||'';this[_0x0a68('0x2')]=_0x24285c[_0x0a68('0x2')]||'';this[_0x0a68('0x3')]=_0x24285c['remoteUri']||'';this[_0x0a68('0x4')]=_0x24285c['serverUrl']||'';this['Configurations']=_0x24285c['Configurations']||{};}module[_0x0a68('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c75ddd2..7d2feb5 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 _0x01a2=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x58e747,_0x2d0476){var _0x31163b=function(_0x99d628){while(--_0x99d628){_0x58e747['push'](_0x58e747['shift']());}};_0x31163b(++_0x2d0476);}(_0x01a2,0xb8));var _0x201a=function(_0x4f2520,_0x2e8b63){_0x4f2520=_0x4f2520-0x0;var _0x417d13=_0x01a2[_0x4f2520];return _0x417d13;};'use strict';function ZendeskAccount(_0x3d4fb1){this['id']=_0x3d4fb1['id']||0x0;this[_0x201a('0x0')]=_0x3d4fb1[_0x201a('0x0')]||'';this[_0x201a('0x1')]=_0x3d4fb1[_0x201a('0x1')]||'';this['password']=_0x3d4fb1[_0x201a('0x2')]||'';this[_0x201a('0x3')]=_0x3d4fb1[_0x201a('0x3')]||'';this['remoteUri']=_0x3d4fb1[_0x201a('0x4')]||'';this[_0x201a('0x5')]=_0x3d4fb1['authType']||'';this['type']=_0x3d4fb1['type']||_0x201a('0x6');this[_0x201a('0x7')]=_0x3d4fb1[_0x201a('0x7')]||'';this[_0x201a('0x8')]=_0x3d4fb1[_0x201a('0x8')]||{};}module[_0x201a('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xd36b=['Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x412f64,_0x2b2059){var _0x39b3ce=function(_0x4bd3ac){while(--_0x4bd3ac){_0x412f64['push'](_0x412f64['shift']());}};_0x39b3ce(++_0x2b2059);}(_0xd36b,0x65));var _0xbd36=function(_0x525e2d,_0x143061){_0x525e2d=_0x525e2d-0x0;var _0x458e2b=_0xd36b[_0x525e2d];return _0x458e2b;};'use strict';function ZendeskAccount(_0x22406d){this['id']=_0x22406d['id']||0x0;this[_0xbd36('0x0')]=_0x22406d[_0xbd36('0x0')]||'';this[_0xbd36('0x1')]=_0x22406d[_0xbd36('0x1')]||'';this[_0xbd36('0x2')]=_0x22406d[_0xbd36('0x2')]||'';this['token']=_0x22406d[_0xbd36('0x3')]||'';this['remoteUri']=_0x22406d[_0xbd36('0x4')]||'';this[_0xbd36('0x5')]=_0x22406d[_0xbd36('0x5')]||'';this[_0xbd36('0x6')]=_0x22406d[_0xbd36('0x6')]||'integrationTab';this['serverUrl']=_0x22406d['serverUrl']||'';this['Configurations']=_0x22406d[_0xbd36('0x7')]||{};}module[_0xbd36('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index e0fe98d..0786a64 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 _0x2f89=['host','zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description'];(function(_0x897090,_0x113ad9){var _0x37b9c3=function(_0x1f27cf){while(--_0x1f27cf){_0x897090['push'](_0x897090['shift']());}};_0x37b9c3(++_0x113ad9);}(_0x2f89,0x13e));var _0x92f8=function(_0x2908d7,_0x1eb380){_0x2908d7=_0x2908d7-0x0;var _0x30c2c4=_0x2f89[_0x2908d7];return _0x30c2c4;};'use strict';function ZohoAccount(_0x472c5a){this['id']=_0x472c5a['id']||0x0;this[_0x92f8('0x0')]=_0x472c5a[_0x92f8('0x0')]||'';this[_0x92f8('0x1')]=_0x472c5a[_0x92f8('0x1')]||'';this['host']=_0x472c5a[_0x92f8('0x2')]||'';this[_0x92f8('0x3')]=_0x472c5a[_0x92f8('0x3')]||'';this[_0x92f8('0x4')]=_0x472c5a['clientId']||'';this[_0x92f8('0x5')]=_0x472c5a[_0x92f8('0x5')]||'';this['serverUrl']=_0x472c5a['serverUrl']||'';this[_0x92f8('0x6')]=_0x472c5a['code']||'';this[_0x92f8('0x7')]=_0x472c5a[_0x92f8('0x7')]||'';this[_0x92f8('0x8')]=_0x472c5a[_0x92f8('0x8')]||{};}module[_0x92f8('0x9')]=ZohoAccount; \ No newline at end of file +var _0x5616=['Configurations','exports','name','description','host','zone','clientId','clientSecret','code','refreshToken'];(function(_0x10e5d9,_0x52e4fd){var _0x5df441=function(_0x235127){while(--_0x235127){_0x10e5d9['push'](_0x10e5d9['shift']());}};_0x5df441(++_0x52e4fd);}(_0x5616,0x192));var _0x6561=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0x5616[_0x210b93];return _0x2b020f;};'use strict';function ZohoAccount(_0x59f849){this['id']=_0x59f849['id']||0x0;this[_0x6561('0x0')]=_0x59f849[_0x6561('0x0')]||'';this[_0x6561('0x1')]=_0x59f849[_0x6561('0x1')]||'';this['host']=_0x59f849[_0x6561('0x2')]||'';this['zone']=_0x59f849[_0x6561('0x3')]||'';this[_0x6561('0x4')]=_0x59f849[_0x6561('0x4')]||'';this[_0x6561('0x5')]=_0x59f849[_0x6561('0x5')]||'';this['serverUrl']=_0x59f849['serverUrl']||'';this[_0x6561('0x6')]=_0x59f849[_0x6561('0x6')]||'';this[_0x6561('0x7')]=_0x59f849[_0x6561('0x7')]||'';this[_0x6561('0x8')]=_0x59f849[_0x6561('0x8')]||{};}module[_0x6561('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 23596c6..458a801 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 _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x2e77ed,_0x368892){var _0x34f1db=function(_0x389934){while(--_0x389934){_0x2e77ed['push'](_0x2e77ed['shift']());}};_0x34f1db(++_0x368892);}(_0xe820,0xd2));var _0x0e82=function(_0x8025b0,_0xa09308){_0x8025b0=_0x8025b0-0x0;var _0x68ae30=_0xe820[_0x8025b0];return _0x68ae30;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file +var _0x1c9a=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x2617ae,_0x171008){var _0x2330dc=function(_0x2900c6){while(--_0x2900c6){_0x2617ae['push'](_0x2617ae['shift']());}};_0x2330dc(++_0x171008);}(_0x1c9a,0x98));var _0xa1c9=function(_0x36d28d,_0x1ae141){_0x36d28d=_0x36d28d-0x0;var _0x3149cd=_0x1c9a[_0x36d28d];return _0x3149cd;};'use strict';var util=require(_0xa1c9('0x0'));var _=require('lodash');var moment=require(_0xa1c9('0x1'));function checkNameSurname(_0x5c45c5,_0x1a771d,_0x1d631b){var _0x1a05a3='';if(!_['isNil'](_0x1a771d)&&_0xa1c9('0x2')===typeof _0x1a771d){_0x1a05a3+=_0x1a771d;}if(!_[_0xa1c9('0x3')](_0x1d631b)&&_0xa1c9('0x2')===typeof _0x1d631b){_0x1a05a3+='\x20'+_0x1d631b;}if(_0x1a05a3!==''){return _0x1a05a3;}return _0x5c45c5;}function Action(_0x3a4387,_0x572229,_0x144e91,_0x5448f2,_0x222624){this[_0xa1c9('0x4')]=_0x144e91||undefined;this[_0xa1c9('0x5')]=_0x3a4387['id'];this['queue']=_0x572229[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x572229[_0xa1c9('0x7')];this[_0xa1c9('0x8')]='queue';this[_0xa1c9('0x9')]=![];this[_0xa1c9('0xa')]=_[_0xa1c9('0x3')](_0x3a4387[_0xa1c9('0xb')])?undefined:_0x3a4387[_0xa1c9('0xb')][_0xa1c9('0x6')];this[_0xa1c9('0xc')]=this[_0xa1c9('0xa')]?util[_0xa1c9('0xd')](_0xa1c9('0xe'),this['membername']):_0x5448f2||undefined;this[_0xa1c9('0xf')]=checkNameSurname(_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x11')],_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x12')],_0x3a4387['Contact'][_0xa1c9('0x13')]);this[_0xa1c9('0x14')]=_0x3a4387[_0xa1c9('0x14')]||![];this[_0xa1c9('0x15')]=_0x3a4387[_0xa1c9('0x11')];this[_0xa1c9('0x16')]=_0x3a4387[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3a4387[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3a4387['countcongestionretry']||0x0;this[_0xa1c9('0x19')]=_0x3a4387[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=(_0x3a4387['countbusyretry']||0x0)+(_0x3a4387[_0xa1c9('0x18')]||0x0)+(_0x3a4387['countnoanswerretry']||0x0)+(_0x3a4387[_0xa1c9('0x1b')]||0x0)+(_0x3a4387[_0xa1c9('0x1c')]||0x0)+(_0x3a4387[_0xa1c9('0x1d')]||0x0)+(_0x3a4387['countmachineretry']||0x0)+(_0x3a4387[_0xa1c9('0x1e')]||0x0);this[_0xa1c9('0x1b')]=_0x3a4387[_0xa1c9('0x1b')]||0x0;this['countdropretry']=_0x3a4387[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x1d')]=_0x3a4387['countabandonedretry']||0x0;this[_0xa1c9('0x1f')]=_0x3a4387[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x1e')]=_0x3a4387['countagentrejectretry']||0x0;this[_0xa1c9('0x20')]=_0x3a4387[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3a4387[_0xa1c9('0x21')];this[_0xa1c9('0x22')]=_0x3a4387['callbackat'];this['recallme']=_0x3a4387[_0xa1c9('0x23')];this['ContactId']=_0x3a4387[_0xa1c9('0x24')];this[_0xa1c9('0x25')]=_0x3a4387[_0xa1c9('0x25')];this[_0xa1c9('0x26')]=_[_0xa1c9('0x3')](_0x3a4387['Agent'])?_0x3a4387[_0xa1c9('0x26')]:_0x3a4387[_0xa1c9('0xb')]['id'];this[_0xa1c9('0x27')]=_0x3a4387['VoiceQueueId'];this[_0xa1c9('0x28')]='';this[_0xa1c9('0x29')]='';}Action[_0xa1c9('0x2a')]['getCaller']=function(){return util[_0xa1c9('0xd')](_0xa1c9('0x2b'),this['calleridname'],this[_0xa1c9('0x2c')]);};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 4aef958..0843cdd 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 _0xa41a=['logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','checkInBlack','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','pick','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[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','dialActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','starttime','variablesAction','Action','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking:\x20','pTalking','dialAnswer','contactId','UserId','VoiceQueueId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','isUndefined','object','reason'];(function(_0x5e7c52,_0x52f168){var _0x3d92cc=function(_0x423870){while(--_0x423870){_0x5e7c52['push'](_0x5e7c52['shift']());}};_0x3d92cc(++_0x52f168);}(_0xa41a,0x6b));var _0xaa41=function(_0x5ab509,_0x42b2b2){_0x5ab509=_0x5ab509-0x0;var _0x1bd8af=_0xa41a[_0x5ab509];return _0x1bd8af;};'use strict';var util=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));var uuid=require('uuid');var moment=require(_0xaa41('0x2'));var Redis=require(_0xaa41('0x3'));var config=require(_0xaa41('0x4'));var logger=require(_0xaa41('0x5'))(_0xaa41('0x6'));var loggerAction=require(_0xaa41('0x5'))(_0xaa41('0x7'));var ami=require(_0xaa41('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xaa41('0x9'));var Action=require(_0xaa41('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0xaa41('0xb')]=_[_0xaa41('0xc')](config['redis'],{'host':_0xaa41('0xd'),'port':0x18eb});var io=require(_0xaa41('0xe'))(new Redis(config[_0xaa41('0xb')]));var Sequence=function(){};Sequence[_0xaa41('0xf')][_0xaa41('0x10')]=function(_0x38d930){this[_0xaa41('0x11')]=this[_0xaa41('0x11')]?this[_0xaa41('0x11')]['finally'](_0x38d930):_0x38d930();};function Preview(_0x1d3aac){this[_0xaa41('0x12')]=new Sequence();this['campaignsPreview']=_0x1d3aac['voiceQueues'];this[_0xaa41('0x13')]=_0x1d3aac['trunks'];this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]=_0x1d3aac[_0xaa41('0x15')];this[_0xaa41('0x16')]=0x0;ami['on'](_0xaa41('0x17'),this['syncOriginateResponse'][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x19'),this[_0xaa41('0x1a')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1b'),this[_0xaa41('0x1c')][_0xaa41('0x18')](this));ami['on']('dialend',this[_0xaa41('0x1d')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x1e'),this[_0xaa41('0x1f')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x20'),this[_0xaa41('0x21')][_0xaa41('0x18')](this));ami['on'](_0xaa41('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa41('0x23'),this[_0xaa41('0x24')][_0xaa41('0x18')](this));this['loopCampaigns'](this[_0xaa41('0x25')]);}function emit(_0x1f692b,_0x4e768e,_0x513c61){io['to'](_0x1f692b)[_0xaa41('0x26')](_0x4e768e,_0x513c61);}function emitVoiceQueueChannelRemove(_0x5d4374){logger[_0xaa41('0x27')](_0xaa41('0x28'),JSON[_0xaa41('0x29')](_0x5d4374));emit(util[_0xaa41('0x2a')](_0xaa41('0x2b'),_0x5d4374['name']),_0xaa41('0x2c'),_0x5d4374);io[_0xaa41('0x26')](_0xaa41('0x2d'),_0x5d4374);}function notSendMessagesQueue(_0x21f596){if(_0x21f596[_0xaa41('0x2e')]){if(_0x21f596[_0xaa41('0x2f')]===0x0&&_0x21f596['pTalking']===0x0){_0x21f596['sendMessageOneNotActive']=![];_0x21f596[_0xaa41('0x30')]=0x0;_0x21f596['paused']=0x0;_0x21f596['message']=utils[_0xaa41('0x31')]['INACTIVE'];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x34'));}else{_0x21f596[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x36')];ut['logger'](_0xaa41('0x32'),_0x21f596[_0xaa41('0x33')]+_0xaa41('0x37'));}}}Preview[_0xaa41('0xf')][_0xaa41('0x38')]=function(){var _0x4466a3=this;setInterval(function(){_0x4466a3[_0xaa41('0x39')]();},0x7cf);};Preview[_0xaa41('0xf')]['syncCampaigns']=function(){var _0x377add=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x714537 in _0x377add){if(_0x377add[_0xaa41('0x3a')](_0x714537)&&(_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')||_0x377add[_0x714537][_0xaa41('0x3b')]==='booked')&&_0x377add[_0x714537]['type']==='outbound'){if(this[_0xaa41('0x16')]>0x7){this[_0xaa41('0x16')]=0x0;this[_0xaa41('0x3c')]();}}if(_0x377add[_0xaa41('0x3a')](_0x714537)&&_0x377add[_0x714537]['dialMethod']===_0xaa41('0x6')&&_0x377add[_0x714537][_0xaa41('0x3d')]===_0xaa41('0x3e')){if(_0x377add[_0x714537]['dialActive']){this[_0xaa41('0x3f')](_0x377add[_0x714537]);if(_0x377add[_0x714537][_0xaa41('0x40')])this[_0xaa41('0x41')](_0x377add[_0x714537]);}else{notSendMessagesQueue(_0x377add[_0x714537]);}}}};Preview['prototype'][_0xaa41('0x42')]=function(_0x374117){var _0x57fe1d=this;this[_0xaa41('0x12')][_0xaa41('0x10')](function(){if(!_[_0xaa41('0x43')](_0x57fe1d['actions'][_0x374117])){loggerAction[_0xaa41('0x27')]('[clearZombieChannels][talking]',_0x374117,_0xaa41('0x44'),_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')],'originated:\x20',JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x2f')]),_0xaa41('0x46'),JSON['stringify'](_0x57fe1d['campaignsPreview'][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]][_0xaa41('0x47')]),JSON[_0xaa41('0x29')](_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x48')]),JSON[_0xaa41('0x29')](_['pick'](_0x57fe1d[_0xaa41('0x14')][_0x374117],[_0xaa41('0x49'),_0xaa41('0x4a'),_0xaa41('0x4b'),'ListId'])));return ami['Action']({'action':_0xaa41('0x4c'),'channel':_0x57fe1d[_0xaa41('0x14')][_0x374117]['channel']})[_0xaa41('0x4d')](function(_0x563687){if(_0x563687[_0xaa41('0x35')]===_0xaa41('0x4e')){setTimeout(function(){if(_0x57fe1d[_0xaa41('0x14')][_0x374117]){ut[_0xaa41('0x4f')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));if(_0x57fe1d['actions'][_0x374117][_0xaa41('0x48')]===!![]){ut[_0xaa41('0x51')](_0x57fe1d[_0xaa41('0x25')][_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]],_0xaa41('0x50'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117]['queue']);}ut[_0xaa41('0x52')](_0xaa41('0x53')+_0x374117,_0x57fe1d[_0xaa41('0x14')][_0x374117][_0xaa41('0x45')]);delete _0x57fe1d[_0xaa41('0x14')][_0x374117];}},0x2328);}});}});};Preview[_0xaa41('0xf')][_0xaa41('0x3c')]=function(){var _0x5ee74c=this;loggerAction[_0xaa41('0x27')]('[action]',_['size'](this[_0xaa41('0x14')]));for(var _0x5ee127 in this['actions']){if(_0x5ee74c['actions'][_0xaa41('0x3a')](_0x5ee127)){_0x5ee74c['clearZombieChannel'](_0x5ee127);}}};Preview[_0xaa41('0xf')][_0xaa41('0x41')]=function(_0x4a6882){var _0x576f81=this;rpcDb[_0xaa41('0x54')](_0x4a6882['id'],ut[_0xaa41('0x55')](this[_0xaa41('0x15')]))[_0xaa41('0x56')](function(_0x3fe1a9){if(!_[_0xaa41('0x43')](_0x3fe1a9)){for(var _0x258096=0x0;_0x258096<_0x3fe1a9[_0xaa41('0x57')];_0x258096+=0x1){if(ut[_0xaa41('0x58')](_0x3fe1a9[_0x258096]['scheduledat'])<_0x4a6882[_0xaa41('0x59')]*0x3c){if(_0x3fe1a9[_0x258096][_0xaa41('0x5a')]&&!_0x3fe1a9[_0x258096][_0xaa41('0x5a')][_0xaa41('0x5b')]){_0x576f81[_0xaa41('0x5c')](_0x3fe1a9[_0x258096]['id'])[_0xaa41('0x56')](ut['logger2'](_0xaa41('0x5d')))[_0xaa41('0x4d')](ut[_0xaa41('0x5e')](_0xaa41('0x5d')));}else{rpcDb['disableContact'](_0x3fe1a9[_0x258096]['id']);}}else{var _0x23bc61=new Action(_0x3fe1a9[_0x258096],_0x4a6882);_0x23bc61['starttime']=moment()['format'](_0xaa41('0x5f'));_0x4a6882[_0xaa41('0x60')]+=0x1;ut[_0xaa41('0x61')](_0x23bc61,0x17,'RecallInQueue');if(_0x4a6882[_0xaa41('0x62')]){rpcDb[_0xaa41('0x63')](ut[_0xaa41('0x64')](_0x3fe1a9[_0x258096]));rpcDb['createCustomerHistory'](_0x23bc61,_0xaa41('0x65'));}else{ut[_0xaa41('0x61')](_0x23bc61,0x16,_0xaa41('0x66'));rpcDb[_0xaa41('0x67')](_0x23bc61,_0xaa41('0x68'));rpcDb[_0xaa41('0x69')](_0x23bc61,_0xaa41('0x68'));}}}}})[_0xaa41('0x4d')](ut['logger2'](_0xaa41('0x6a')));};Preview['prototype']['setMessage']=function(_0x1bdcd6){_0x1bdcd6[_0xaa41('0x2e')]=!![];if(ut[_0xaa41('0x6b')](_0x1bdcd6[_0xaa41('0x6c')])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6d')];}else if(!ut[_0xaa41('0x6e')](_0x1bdcd6['dialActive'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x6f')];}else if(!this['isTrunkReachable'](_0x1bdcd6[_0xaa41('0x70')])){if(!this[_0xaa41('0x71')](_0x1bdcd6['TrunkBackup'])){_0x1bdcd6[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x72')];}else{_0x1bdcd6['message']=utils[_0xaa41('0x31')][_0xaa41('0x73')];}}else{_0x1bdcd6['message']=utils['CAMPAIGN_STATUS'][_0xaa41('0x73')];}};Preview[_0xaa41('0xf')][_0xaa41('0x74')]=function(_0x4d20c6,_0x5a76b9,_0x137f3f){var _0x1746b4=this;var _0x32f2b4=this[_0xaa41('0x14')][_0x5a76b9];var _0x5ccdc5=this[_0xaa41('0x25')][_0x32f2b4['queue']];var _0x555186;var _0x3ba305=![];var _0x52ae7f=0x2;var _0x3621c0=0x3;if(_0x5ccdc5){switch(_0x137f3f){case'1':_0x5ccdc5[_0xaa41('0x75')]+=0x1;_0x32f2b4[_0xaa41('0x76')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x0,_0xaa41('0x78'));ami[_0xaa41('0x26')](_0xaa41('0x79'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0x7b')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0x7c'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'0',_0x5ccdc5)[_0xaa41('0x56')](function(_0x40cdfc){_0x3ba305=_0x40cdfc[_0xaa41('0x7d')]==0x1;_0x52ae7f=_0x5ccdc5['dialNoSuchNumberRetryFrequency'];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0x82'));}else{if(_0x32f2b4['countnosuchnumberretry']>=_0x5ccdc5['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x32f2b4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x32f2b4,_0xaa41('0x76'),_0x5ccdc5['dialNoSuchNumberRetryFrequency']),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x32f2b4[_0xaa41('0x76')]++;logger['info'](_0xaa41('0x85'),_0x32f2b4[_0xaa41('0x76')]);logger[_0xaa41('0x27')]('id',_0x32f2b4[_0xaa41('0x86')]);_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnosuchnumberretry':_0x32f2b4[_0xaa41('0x76')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});break;case _0xaa41('0x89'):var _0x2d2af8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32f2b4['responsetime']=_0x2d2af8;_0x32f2b4[_0xaa41('0x8a')]=_0x2d2af8;_0x32f2b4['dialAnswer']=!![];_0x5ccdc5[_0xaa41('0x47')]+=0x1;logger['info'](_0xaa41('0x8b'),_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);ami[_0xaa41('0x26')]('custom:agentconnect',ut['buildObj'](_0x32f2b4,_0xaa41('0x8d'),this[_0xaa41('0x25')][_0x32f2b4['queue']]));if(_0x5ccdc5['acw']){ami[_0xaa41('0x26')](_0xaa41('0x8e'),ut[_0xaa41('0x8f')](_0x32f2b4));}break;case'16':ami[_0xaa41('0x26')](_0xaa41('0x90'),ut['buildObj'](_0x32f2b4,_0xaa41('0x91'),this['campaignsPreview'][_0x32f2b4['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x32f2b4,_0xaa41('0x91')));_0x5ccdc5[_0xaa41('0x92')]+=0x1;_0x5ccdc5[_0xaa41('0x93')]+=0x1;_0x5ccdc5['answered']+=0x1;ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0x94'));_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x4,_0xaa41('0x96'));rpcDb[_0xaa41('0x67')](_0x32f2b4,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0x97'));rpcDb[_0xaa41('0x98')](_0x32f2b4);_0x5ccdc5[_0xaa41('0x99')]+=_0x32f2b4['talktime'];_0x5ccdc5[_0xaa41('0x9a')]+=_0x32f2b4['talktime'];logger[_0xaa41('0x27')](_0xaa41('0x9b'),_0x32f2b4[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x5ccdc5['name'],_0xaa41('0x46'),_0x5ccdc5[_0xaa41('0x47')]);delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];break;case'BUSY':_0x5ccdc5[_0xaa41('0x9d')]+=0x1;_0x32f2b4['countbusyretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x5,_0xaa41('0x9e'));_0x52ae7f=_0x5ccdc5[_0xaa41('0x9f')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xa0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xa1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xa2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'5',_0x5ccdc5)[_0xaa41('0x56')](function(_0x59a30b){_0x3ba305=_0x59a30b[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xa4'));}else{if(_0x32f2b4['countbusyretry']>=_0x5ccdc5[_0xaa41('0xa5')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xa8'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4[_0xaa41('0xa8')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countbusyretry':_0x32f2b4['countbusyretry']}})[_0xaa41('0x56')](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xaa'):_0x5ccdc5[_0xaa41('0xab')]+=0x1;_0x32f2b4['countnoanswerretry']+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x3,'NoAnswer');_0x52ae7f=_0x5ccdc5[_0xaa41('0xac')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];var _0x5bd574=ut[_0xaa41('0xad')](_0x32f2b4,_0x5ccdc5);ami['emit']('custom:agentnoanswer',_0x5bd574);rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xae'));_0x1746b4['verifyAdditionalPhones'](_0x32f2b4,'3',_0x5ccdc5)['then'](function(_0x241e1a){_0x3ba305=_0x241e1a[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut['cloneAction'](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xaf'));}else{if(_0x32f2b4['countnoanswerretry']>=_0x5ccdc5[_0xaa41('0xb0')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xae'));}else{rpcDb['rescheduleContact'](ut[_0xaa41('0xa7')](_0x32f2b4,'countnoanswerretry',_0x5ccdc5['dialNoAnswerRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})['then'](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xb2'):_0x5ccdc5[_0xaa41('0xb3')]+=0x1;_0x32f2b4[_0xaa41('0xb4')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0x8,_0xaa41('0xb5'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xb6')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xb7'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xb8')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xb9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'8',_0x5ccdc5)[_0xaa41('0x56')](function(_0x58ad21){_0x3ba305=_0x58ad21[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,'Global');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xba'));}else{if(_0x32f2b4[_0xaa41('0xb4')]>=_0x5ccdc5[_0xaa41('0xbb')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xb9'));}else{rpcDb[_0xaa41('0xa6')](ut['scheduledAt'](_0x32f2b4,_0xaa41('0xb4'),_0x5ccdc5[_0xaa41('0x9f')]),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countcongestionretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4['idContact'],'field':{'countcongestionretry':_0x32f2b4[_0xaa41('0xb4')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xbc'):_0x5ccdc5['outboundRejectCallsDay']+=0x1;_0x32f2b4[_0xaa41('0xbd')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x14,_0xaa41('0xbe'));_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];ami[_0xaa41('0x26')](_0xaa41('0xc0'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xc1')));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x78265){_0x3ba305=_0x78265[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut['cloneAction'](_0x32f2b4,0x14,'AgentReject');rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc3'));}else{if(_0x32f2b4['countagentrejectretry']>=_0x5ccdc5[_0xaa41('0xc4')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,_0xaa41('0xbd'),_0x5ccdc5[_0xaa41('0xbf')]),_0x32f2b4['unlockAgent'],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case _0xaa41('0xc5'):_0x5ccdc5[_0xaa41('0xc6')]+=0x1;_0x32f2b4[_0xaa41('0xc7')]+=0x1;_0x32f2b4['countglobal']=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0xb,_0xaa41('0xc8'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xc9'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'11',_0x5ccdc5)[_0xaa41('0x56')](function(_0x408d95){_0x3ba305=_0x408d95[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xc9'));}else{if(_0x32f2b4['countabandonedetry']>=_0x5ccdc5[_0xaa41('0xca')]){rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xc9'));}else{rpcDb[_0xaa41('0xa6')](ut[_0xaa41('0xa7')](_0x32f2b4,'countabandonedretry',_0x5ccdc5['dialAbandonedRetryFrequency']),_0x32f2b4[_0xaa41('0xa9')],_0x32f2b4[_0xaa41('0x83')]);}}}else{_0x32f2b4['countnoanswerretry']++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})['then'](function(){_0x1746b4['swapAdditionalPhones'](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});break;case'18':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0xcc')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x12,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,'amd'));rpcDb['createCustomerHistory'](_0x32f2b4,_0xaa41('0xd0'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)['then'](function(_0x30e8cb){_0x3ba305=_0x30e8cb['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0x12,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd0'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd0'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4['incrementPreviewCounters']({'id':_0x32f2b4['idContact'],'field':{'countnoanswerretry':_0x32f2b4['countnoanswerretry']}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)['then'](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;case'19':_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4['countglobal']=ut['totalGlobal'](_0x32f2b4);ut[_0xaa41('0x61')](_0x32f2b4,0x13,_0x4d20c6['cause-txt']||_0x4d20c6[_0xaa41('0xce')]);ami[_0xaa41('0x26')](_0xaa41('0xcf'),ut[_0xaa41('0x7a')](_0x32f2b4,_0xaa41('0xd1')));rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd2'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'18',_0x5ccdc5)[_0xaa41('0x56')](function(_0x573889){_0x3ba305=_0x573889['additional']==0x1;if(!_0x3ba305){if(ut[_0xaa41('0x77')](_0x32f2b4)>=_0x5ccdc5[_0xaa41('0x7f')]){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd2'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd2'));}}else{_0x32f2b4[_0xaa41('0xb1')]++;_0x1746b4[_0xaa41('0x87')]({'id':_0x32f2b4[_0xaa41('0x86')],'field':{'countnoanswerretry':_0x32f2b4[_0xaa41('0xb1')]}})[_0xaa41('0x56')](function(){_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});});}});delete this['actions'][_0x4d20c6[_0xaa41('0x84')]];break;default:if(_0x32f2b4['dialAnswer']){ut[_0xaa41('0x51')](_0x5ccdc5,_0xaa41('0xd3'));ut[_0xaa41('0x52')](_0xaa41('0xd4')+_0x5ccdc5[_0xaa41('0x33')],_0x4d20c6);}_0x5ccdc5[_0xaa41('0xcb')]+=0x1;_0x32f2b4[_0xaa41('0x95')]=ut[_0xaa41('0x77')](_0x32f2b4);ut['logCustomer'](_0x32f2b4,0xc,_0x4d20c6[_0xaa41('0xcd')]||_0x4d20c6[_0xaa41('0xce')]);_0x52ae7f=_0x5ccdc5[_0xaa41('0xbf')];_0x3621c0=_0x5ccdc5[_0xaa41('0x7e')];rpcDb[_0xaa41('0x67')](_0x32f2b4,_0xaa41('0xd5'));_0x1746b4[_0xaa41('0xa3')](_0x32f2b4,'20',_0x5ccdc5)[_0xaa41('0x56')](function(_0x1b5933){_0x3ba305=_0x1b5933[_0xaa41('0x7d')]==0x1;if(!_0x3ba305){if(ut['totalGlobal'](_0x32f2b4)>=_0x5ccdc5['dialGlobalMaxRetry']){_0x555186=ut[_0xaa41('0x80')](_0x32f2b4,0xf,_0xaa41('0x81'));rpcDb[_0xaa41('0x69')](_0x555186,_0xaa41('0xd6'));}else{rpcDb[_0xaa41('0x69')](_0x32f2b4,_0xaa41('0xd6'));}delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];}else{_0x1746b4[_0xaa41('0x88')](_0x32f2b4,_0x52ae7f,_0x3621c0)[_0xaa41('0x56')](function(){});}});}if(!(_0x32f2b4['dialAnswer']&&_0x137f3f==='16')){ut['updateOriginated'](_0x5ccdc5,_0xaa41('0xd7'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingCustomer]',_0x32f2b4[_0xaa41('0x8c')],'\x20Queue',_0x5ccdc5[_0xaa41('0x33')],_0xaa41('0xd8'),_0x5ccdc5['originated']);}if(_0x137f3f!=='ANSWER'){delete this[_0xaa41('0x14')][_0x4d20c6[_0xaa41('0x84')]];delete this[_0xaa41('0x14')][_0x4d20c6['destlinkedid']];}_0x5ccdc5['queueSummaryCountersUpdated']=!![];}};Preview[_0xaa41('0xf')]['callProgressDetectingAgent']=function(_0x94423a,_0x59d6cf,_0x37dc6f){if(_[_0xaa41('0xd9')](_0x59d6cf)&&_0xaa41('0xda')!==typeof _0x59d6cf){return;}if(_[_0xaa41('0xd9')](_0x37dc6f)&&_0xaa41('0xda')!==typeof _0x37dc6f){return;}switch(_0x37dc6f[_0xaa41('0xdb')]){case'0':ut[_0xaa41('0xdc')](_0x94423a,0x0,'NoSuchNumber');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xde'));break;case'3':ut['logAgent'](_0x94423a,0x3,_0xaa41('0xdf'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe0'));break;case'5':ut[_0xaa41('0xdc')](_0x94423a,0x5,'Busy');rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe1'));break;case'8':ut[_0xaa41('0xdc')](_0x94423a,0x8,_0xaa41('0xb5'));rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));break;case'22':ut[_0xaa41('0xdc')](_0x94423a,0x16,_0xaa41('0xe3'));rpcDb[_0xaa41('0xdd')](_0x94423a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x94423a,0xc,_0x37dc6f[_0xaa41('0xdb')]);rpcDb[_0xaa41('0xdd')](_0x94423a,_0xaa41('0xe2'));}ut[_0xaa41('0x4f')](_0x59d6cf,_0xaa41('0xe4'));logger[_0xaa41('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x94423a[_0xaa41('0x8c')],_0xaa41('0x9c'),_0x59d6cf[_0xaa41('0x33')],_0xaa41('0xd8'),_0x59d6cf[_0xaa41('0x2f')]);delete this[_0xaa41('0x14')][_0x94423a['uniqueid']];};Preview[_0xaa41('0xf')][_0xaa41('0xa3')]=function(_0x13ddbe,_0x4cf0c5,_0x1ddfe5){return cmHopperAdditionalPhone[_0xaa41('0xa3')](_0x13ddbe,_0x4cf0c5,_0x1ddfe5)[_0xaa41('0x4d')](logger[_0xaa41('0x27')](_0xaa41('0xe5')));};Preview[_0xaa41('0xf')][_0xaa41('0x88')]=function(_0x943973,_0xe17579,_0x1a6de8){return cmHopperAdditionalPhone[_0xaa41('0x88')](_0x943973,_0xe17579,_0x1a6de8)[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xaa41('0x87')]=function(_0xb9d685){return Promise[_0xaa41('0xe6')]()[_0xaa41('0x56')](cmHopperAdditionalPhone[_0xaa41('0x87')](_0xb9d685))[_0xaa41('0x4d')](logger[_0xaa41('0x27')]('[incrementPreviewCounters]\x20'));};Preview[_0xaa41('0xf')][_0xaa41('0xe7')]=function(_0xa3687e,_0x7e0e69,_0x361819,_0x377e17,_0x1e879d){var _0x1a7527=this;return new Promise(function(_0x1aac0c,_0x1a5a7a){if(_[_0xaa41('0x43')](_0x7e0e69)||_[_0xaa41('0x43')](_0x7e0e69['Contact'])||_[_0xaa41('0x43')](_0x7e0e69[_0xaa41('0xe8')])||_['isNil'](_0x7e0e69[_0xaa41('0x4b')])){_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xe9'),_0x377e17,_0x1e879d));return;}var _0x400fb7=uuid['v4']();var _0x5c0c5c=_0x1a7527[_0xaa41('0x25')][_0x7e0e69[_0xaa41('0x44')][_0xaa41('0x33')]];var _0x3a223c=_0x361819?_0x1a7527[_0xaa41('0x15')][_0x361819]['id']:undefined;_0x1a7527['actions'][_0x400fb7]=new Action(_0x7e0e69,_0x5c0c5c,_0x400fb7,_0x361819,_0x3a223c);var _0xc59a12=_0x1a7527['actions'][_0x400fb7];_0xc59a12['unlockAgent']=_0x377e17;_0xc59a12[_0xaa41('0x83')]=_0x1e879d;_0xc59a12['lookAgent']=_0x361819;if(_['isEmpty'](_0xa3687e)){_0x1a7527[_0xaa41('0xea')](_0xc59a12,_0x5c0c5c,_0x7e0e69,_0x361819)[_0xaa41('0x56')](function(_0x5b241e){logger['info'](_0xaa41('0xeb'),_0xaa41('0xec')+_0xc59a12[_0xaa41('0x45')]+_0xaa41('0xed')+_0xc59a12[_0xaa41('0x86')],JSON[_0xaa41('0x29')](_0x5b241e));ami[_0xaa41('0x26')](_0xaa41('0xee'),ut['buildObj'](_0xc59a12,_0xaa41('0xef'),_0x1a7527[_0xaa41('0x25')][_0xc59a12[_0xaa41('0x45')]]));_0x1aac0c(ut[_0xaa41('0x35')](_0xaa41('0xf0')));})['catch'](function(_0x519843){ut[_0xaa41('0xf1')](_0xaa41('0xf2'),_0x519843);_0x1a5a7a(ut[_0xaa41('0x35')](_0xaa41('0xf3'),_0x377e17,_0x1e879d));});}else{_0x5c0c5c[_0xaa41('0xf4')]+=0x1;ut[_0xaa41('0xf5')](_0xc59a12);rpcDb['createHistory'](_0xc59a12,_0xaa41('0xf6'));delete _0x1a7527[_0xaa41('0x14')][_0x400fb7];_0x1a5a7a(ut['message'](_0xaa41('0xf7'),_0x377e17,_0x1e879d));}});};Preview[_0xaa41('0xf')][_0xaa41('0x71')]=function(_0x27149e){return!_[_0xaa41('0x43')](_0x27149e)&&!_[_0xaa41('0x43')](_0x27149e[_0xaa41('0x33')])&&!_['isNil'](_0x27149e[_0xaa41('0xf8')])&&_0x27149e[_0xaa41('0xf8')]&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])])&&!_['isNil'](this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')])&&(this['trunks'][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e['name'])]['status']===_0xaa41('0xfa')||this[_0xaa41('0x13')][util[_0xaa41('0x2a')](_0xaa41('0xf9'),_0x27149e[_0xaa41('0x33')])][_0xaa41('0x4c')]==='unmonitored');};Preview['prototype'][_0xaa41('0x5c')]=function(_0x2ff3fb,_0x566832){return this['execRun'](_0x2ff3fb,_0x566832)[_0xaa41('0x56')](function(_0x44dea3){return _[_0xaa41('0xfb')](_0x44dea3,['message']);})['catch'](function(_0x1d609e){if(_0x1d609e[_0xaa41('0xfc')]){rpcDb[_0xaa41('0xfd')](_0x2ff3fb);}if(_0x1d609e['active']){rpcDb[_0xaa41('0xfe')](_0x2ff3fb);}throw _[_0xaa41('0xfb')](_0x1d609e,['message']);});};Preview['prototype'][_0xaa41('0xff')]=function(_0x561447,_0x4679e5){var _0x3fb6f0=this;var _0xdf9297,_0x10252a;return rpcDb[_0xaa41('0x100')](_0x561447)[_0xaa41('0x56')](function(_0x2b083a){if(!_['isNil'](_0x2b083a[0x0])){_0x10252a=_0x2b083a[0x0][_0xaa41('0x101')]?![]:!![];_0xdf9297=_0x2b083a[0x0][_0xaa41('0x101')]?!![]:![];_0xdf9297=_0x4679e5?!![]:_0xdf9297;}var _0x5534ef=_0x3fb6f0[_0xaa41('0x102')](_0x2b083a);if(_0x5534ef[_0xaa41('0x103')]){rpcDb[_0xaa41('0x104')](_[_0xaa41('0xfb')](_0x2b083a[0x0],[_0xaa41('0x4b'),_0xaa41('0xe8')]))['then'](function(_0xa2d55d){_0x3fb6f0[_0xaa41('0xe7')](_0xa2d55d,_0x2b083a[0x0],_0x4679e5,_0x10252a,_0xdf9297)[_0xaa41('0x56')](function(_0x2fa831){return _0x2fa831;})[_0xaa41('0x4d')](function(_0xf8f3e1){throw _0xf8f3e1;});})[_0xaa41('0x4d')](function(_0x5083ff){ut[_0xaa41('0xf1')](_0xaa41('0x105'),_0x5083ff);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',_0x10252a,_0xdf9297);});}else{throw ut['message'](_0x5534ef['message'],_0x10252a,_0xdf9297);}})[_0xaa41('0x4d')](function(_0x1331f8){ut[_0xaa41('0xf1')](_0xaa41('0x106'),_0x1331f8);throw ut[_0xaa41('0x35')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xaa41('0xf')][_0xaa41('0x102')]=function(_0x1fe1e3){if(_[_0xaa41('0x43')](_0x1fe1e3)||_[_0xaa41('0x107')](_0x1fe1e3)||!_[_0xaa41('0x43')](_0x1fe1e3[0x0][_0xaa41('0x5a')])&&_['isNil'](_0x1fe1e3[0x0][_0xaa41('0x5a')][_0xaa41('0x33')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Empty\x20Contact]',_0x1fe1e3);return{'isValid':![],'message':_0xaa41('0x108')};}var _0x53a519=this['campaignsPreview'][_0x1fe1e3[0x0][_0xaa41('0x44')]['name']];_0x53a519[_0xaa41('0x35')]=utils[_0xaa41('0x31')][_0xaa41('0x73')];if(_[_0xaa41('0x43')](_0x53a519)){ut[_0xaa41('0xf1')](_0xaa41('0x109'),_0x53a519);return{'isValid':![],'message':_0xaa41('0x10a')};}if(!this['isTrunkReachable'](_0x53a519[_0xaa41('0x70')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0xaa41('0x10c')+_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10d'));if(!this[_0xaa41('0x71')](_0x53a519[_0xaa41('0x10e')])){ut[_0xaa41('0xf1')](_0xaa41('0x10b'),_0x53a519[_0xaa41('0x33')]+_0xaa41('0x10f'));return{'isValid':![],'message':_0xaa41('0x110')};}}if(!ut[_0xaa41('0x6e')](_0x53a519[_0xaa41('0x111')])){ut[_0xaa41('0xf1')]('[Preview][validateContact][Campaign\x20Active]',_0x53a519[_0xaa41('0x33')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53a519['name']+_0xaa41('0x112')};}return{'isValid':!![],'message':_0xaa41('0x113')};};Preview['prototype'][_0xaa41('0xea')]=function(_0x356256,_0x1e86cc,_0x15bb60,_0x232732){var _0x34d857=this;return new Promise(function(_0x239f1b,_0x445925){var _0x1e8591=_0x356256[_0xaa41('0x8c')];var _0x347d0c=_0x34d857[_0xaa41('0x71')](_0x1e86cc[_0xaa41('0x70')])?util[_0xaa41('0x2a')](_0xaa41('0x114'),_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')],_['isNil'](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc[_0xaa41('0x115')][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60['phone'][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60['phone']):util[_0xaa41('0x2a')](_0xaa41('0x114'),_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x33')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x33')],_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x115')])?'':_0x1e86cc['dialPrefix'][_0xaa41('0x116')]()||'',_0x1e86cc[_0xaa41('0x117')]>0x0?_0x15bb60[_0xaa41('0xe8')][_0xaa41('0x118')](_0x1e86cc[_0xaa41('0x117')]):_0x15bb60[_0xaa41('0xe8')]);var _0x53dea3=_0x34d857[_0xaa41('0x71')](_0x1e86cc['Trunk'])?ut[_0xaa41('0x119')](_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut['getCallerIdRandom'](_0x1e86cc[_0xaa41('0x11d')],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc['dialOriginateCallerIdNumber']):ut[_0xaa41('0x119')](_[_0xaa41('0x43')](_0x1e86cc[_0xaa41('0x10e')])?_0x1e86cc[_0xaa41('0x70')][_0xaa41('0x11a')]:_0x1e86cc[_0xaa41('0x10e')][_0xaa41('0x11a')],_0x1e86cc[_0xaa41('0x11b')],_0x1e86cc[_0xaa41('0x11c')]>0x0?ut[_0xaa41('0x11e')](_0x1e86cc['dialOriginateCallerIdNumber'],_0x1e86cc[_0xaa41('0x11c')]):_0x1e86cc[_0xaa41('0x11d')]);if(_0x53dea3){_0x356256[_0xaa41('0x11f')]=ut['extractCalleridName'](_0x53dea3);_0x356256['originatecalleridnum']=ut[_0xaa41('0x120')](_0x53dea3);}var _0x5aee9b=ut['addVariables'](_0x1e86cc,_0x15bb60,_0x347d0c,_0x53dea3,_0x1e8591,_0x356256);_[_0xaa41('0x121')](_0x356256,ut[_0xaa41('0x122')](_0x5aee9b));_0x356256[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e86cc['variables']=_0x5aee9b;var _0xa63e60=ut[_0xaa41('0x124')](_0x356256,_0x1e86cc,_0x5aee9b,_0x356256[_0xaa41('0x83')],_0x232732);return ami[_0xaa41('0x125')](_0xa63e60)[_0xaa41('0x56')](function(_0x5e3bb2){_0x1e86cc[_0xaa41('0x2f')]+=0x1;logger[_0xaa41('0x27')]('[originated][increment]',_0x1e8591,_0xaa41('0x9c'),_0x1e86cc[_0xaa41('0x33')],'originated:\x20',_0x1e86cc[_0xaa41('0x2f')]);_0x239f1b(_0x5e3bb2);})[_0xaa41('0x4d')](function(_0x58a5e5){ut[_0xaa41('0xdc')](_0x356256,0xe,_0xaa41('0x126'));rpcDb['createAgentHistory'](_0x356256,_0xaa41('0x127'));_0x445925(_0x58a5e5);});});};Preview['prototype']['syncNewExten']=function(_0x1ffee2){if(this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]){this[_0xaa41('0x14')][_0x1ffee2[_0xaa41('0x84')]]['channel']=_0x1ffee2[_0xaa41('0x128')];}};Preview['prototype']['syncOriginateResponse']=function(_0x25548d){var _0x28685a=this;var _0x2f62f6=this[_0xaa41('0x14')][_0x25548d[_0xaa41('0x129')]];if(_0x2f62f6){if(_0x2f62f6[_0xaa41('0x12a')]&&this[_0xaa41('0x15')][_0x2f62f6['lookAgent']]){ut[_0xaa41('0x12b')](_0x2f62f6,this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]][_0xaa41('0x33')],this[_0xaa41('0x15')][_0x2f62f6[_0xaa41('0x12a')]]['id']);}var _0x3aafe6=_[_0xaa41('0x12c')](_0x2f62f6);_0x3aafe6[_0xaa41('0x12d')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));var _0x2e8c8f=_0x28685a['campaignsPreview'][_0x2f62f6['queue']];if(ut[_0xaa41('0x12e')](_0x25548d[_0xaa41('0x12f')])){if(_0x2f62f6[_0xaa41('0xa9')]){rpcDb['unlockContact'](_0x2f62f6[_0xaa41('0x86')]);}if(_0x2f62f6[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0x2f62f6[_0xaa41('0x86')]);}ami[_0xaa41('0x26')](_0xaa41('0x130'),ut[_0xaa41('0x7a')](_0x2f62f6,_0xaa41('0x131'),this[_0xaa41('0x25')][_0x2f62f6[_0xaa41('0x45')]]));this[_0xaa41('0x132')](_0x3aafe6,_0x2e8c8f,_0x25548d);}else{_0x2f62f6[_0xaa41('0x123')]=moment()[_0xaa41('0x2a')](_0xaa41('0x5f'));ut[_0xaa41('0xdc')](_0x3aafe6,0x4,'Answer');rpcDb[_0xaa41('0xdd')](_0x3aafe6,_0xaa41('0x133'));}}};Preview[_0xaa41('0xf')]['syncHangup']=function(_0x125efb){var _0xfc1e24=this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]];var _0x21c0c6;if(_0xfc1e24){_0x21c0c6=this[_0xaa41('0x25')][_0xfc1e24[_0xaa41('0x45')]];logger[_0xaa41('0x27')]('[syncHangup][talking]',_0x125efb[_0xaa41('0x84')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);}if(this['actions'][_0x125efb[_0xaa41('0x84')]]&&_0x125efb['linkedid']!==_0x125efb[_0xaa41('0x8c')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6[_0xaa41('0x33')],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')]);}}else if(_0xfc1e24&&_['isNil'](_0xfc1e24[_0xaa41('0x135')])&&_0x21c0c6[_0xaa41('0x136')]&&_0x125efb[_0xaa41('0x84')]===_0x125efb[_0xaa41('0x8c')]&&_[_0xaa41('0x43')](_0x125efb[_0xaa41('0xdb')])&&_0x125efb['cause']==='16'&&_0x125efb['channelstate']==='6'&&_[_0xaa41('0xd9')](_0xfc1e24['transfer'])){if(_0xfc1e24[_0xaa41('0xa9')]){rpcDb[_0xaa41('0xfd')](_0xfc1e24[_0xaa41('0x86')]);}if(_0xfc1e24[_0xaa41('0x83')]){rpcDb[_0xaa41('0xfe')](_0xfc1e24[_0xaa41('0x86')]);}_0x125efb[_0xaa41('0xdb')]='22';this[_0xaa41('0x132')](_0xfc1e24,_0x21c0c6,_0x125efb);}else if(_0xfc1e24&&_0xfc1e24[_0xaa41('0x137')]){if(_0x125efb[_0xaa41('0x134')]==='16'&&this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]][_0xaa41('0x48')]){logger[_0xaa41('0x27')]('[syncHangup][talking][transfer]',_0x125efb[_0xaa41('0x84')],_0x125efb['cause'],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this[_0xaa41('0x74')](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}else if(this[_0xaa41('0x14')][_0x125efb[_0xaa41('0x84')]]['dialAnswer']){logger[_0xaa41('0x27')]('[syncHangup][talking][cause]',_0x125efb['linkedid'],_0x125efb[_0xaa41('0x134')],_0xaa41('0x9c'),_0x21c0c6['name'],_0xaa41('0x46'),_0x21c0c6[_0xaa41('0x47')]);this['callProgressDetectingCustomer'](_0x125efb,_0x125efb[_0xaa41('0x84')],_0x125efb[_0xaa41('0x134')]);}}};Preview[_0xaa41('0xf')]['syncDialEnd']=function(_0x3ecde6){if(this['actions'][_0x3ecde6[_0xaa41('0x138')]]&&_0x3ecde6[_0xaa41('0x138')]!==_0x3ecde6[_0xaa41('0x139')]){this[_0xaa41('0x74')](_0x3ecde6,_0x3ecde6['destlinkedid'],_0x3ecde6[_0xaa41('0xce')]);}};Preview[_0xaa41('0xf')][_0xaa41('0x1c')]=function(_0x49e4a5){if(this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]]&&_0x49e4a5[_0xaa41('0x84')]!==_0x49e4a5[_0xaa41('0x8c')]&&!this[_0xaa41('0x14')][_0x49e4a5[_0xaa41('0x84')]][_0xaa41('0x48')]){if(_0x49e4a5[_0xaa41('0x134')]==='1'){this['callProgressDetectingCustomer'](_0x49e4a5,_0x49e4a5[_0xaa41('0x84')],_0x49e4a5['cause']);}}};Preview[_0xaa41('0xf')][_0xaa41('0x13a')]=function(_0x1fa855,_0x272f3f,_0x36cdd2){if(this[_0xaa41('0x14')][_0x1fa855]){if(_[_0xaa41('0x43')](this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')])){this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')]={};}this[_0xaa41('0x14')][_0x1fa855][_0xaa41('0x13b')][_0x272f3f]=_0x36cdd2;}};Preview['prototype'][_0xaa41('0x21')]=function(_0x366b1c){try{if(!_[_0xaa41('0x43')](_0x366b1c)){if(ut[_0xaa41('0x13c')](_[_0xaa41('0x13d')](_0x366b1c[_0xaa41('0x13e')])[0x0])){this[_0xaa41('0x13a')](_0x366b1c[_0xaa41('0x8c')],_[_0xaa41('0x13d')](_0x366b1c['variable'])[0x0],_0x366b1c[_0xaa41('0x13f')]);}}}catch(_0x30a438){logger[_0xaa41('0x140')](_0xaa41('0x141'),util[_0xaa41('0x142')](_0x30a438,{'showHidden':![],'depth':null}));}};Preview[_0xaa41('0xf')][_0xaa41('0x143')]=function(_0x3f1b1a){if(_0x3f1b1a){if(this[_0xaa41('0x14')][_0x3f1b1a[_0xaa41('0x144')]]){this['actions'][_0x3f1b1a['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xaa41('0xf')][_0xaa41('0x24')]=function(_0x5ccba6){if(_0x5ccba6){if(this[_0xaa41('0x14')][_0x5ccba6[_0xaa41('0x145')]]){this['actions'][_0x5ccba6[_0xaa41('0x145')]]['transfer']=!![];}}};module[_0xaa41('0x146')]=Preview; \ No newline at end of file +var _0x3e74=['unmonitored','run','execRun','unlock','unlockContact','getContactPreview','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variables','variablesAction','Action','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','response','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','uuid','moment','ioredis','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','prototype','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','recallMe','clearZombieChannel','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','Agent','voicePause','[RecallMe]','disableContact','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','dialBusyRetryFrequency','busy','additional','Global','dialBusyMaxRetry','countbusyretry','incrementPreviewCounters','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Queue','agents','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable'];(function(_0x1e49a8,_0x51aa1c){var _0x271541=function(_0x299f8f){while(--_0x299f8f){_0x1e49a8['push'](_0x1e49a8['shift']());}};_0x271541(++_0x51aa1c);}(_0x3e74,0x175));var _0x43e7=function(_0x1b42e7,_0x2a2ca3){_0x1b42e7=_0x1b42e7-0x0;var _0x3b591a=_0x3e74[_0x1b42e7];return _0x3b591a;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var uuid=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x43e7('0x4'));var loggerAction=require('../../../config/logger')(_0x43e7('0x5'));var ami=require(_0x43e7('0x6'));var rpcDb=require(_0x43e7('0x7'));var cmHopperAdditionalPhone=require(_0x43e7('0x8'));var Action=require(_0x43e7('0x9'));var ut=require('./util/util');var utils=require(_0x43e7('0xa'));config[_0x43e7('0xb')]=_[_0x43e7('0xc')](config[_0x43e7('0xb')],{'host':_0x43e7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x39c8bd){this[_0x43e7('0xe')]=this['tail']?this[_0x43e7('0xe')]['finally'](_0x39c8bd):_0x39c8bd();};function Preview(_0xf7c520){this[_0x43e7('0xf')]=new Sequence();this['campaignsPreview']=_0xf7c520[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xf7c520[_0x43e7('0x11')];this[_0x43e7('0x12')]={};this['agents']=_0xf7c520['agents'];this[_0x43e7('0x13')]=0x0;ami['on'](_0x43e7('0x14'),this[_0x43e7('0x15')]['bind'](this));ami['on']('hangup',this[_0x43e7('0x16')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x18'),this[_0x43e7('0x19')]['bind'](this));ami['on']('dialend',this[_0x43e7('0x1a')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x17')](this));this[_0x43e7('0x22')](this[_0x43e7('0x23')]);}function emit(_0x177ee1,_0x4b5d64,_0xef1a5a){io['to'](_0x177ee1)[_0x43e7('0x24')](_0x4b5d64,_0xef1a5a);}function emitVoiceQueueChannelRemove(_0x4b386b){logger[_0x43e7('0x25')](_0x43e7('0x26'),JSON[_0x43e7('0x27')](_0x4b386b));emit(util[_0x43e7('0x28')](_0x43e7('0x29'),_0x4b386b[_0x43e7('0x2a')]),'voice_queue_channel:remove',_0x4b386b);io[_0x43e7('0x24')]('voice_queue_presence:remove',_0x4b386b);}function notSendMessagesQueue(_0x4c9df3){if(_0x4c9df3[_0x43e7('0x2b')]){if(_0x4c9df3[_0x43e7('0x2c')]===0x0&&_0x4c9df3['pTalking']===0x0){_0x4c9df3[_0x43e7('0x2b')]=![];_0x4c9df3['available']=0x0;_0x4c9df3[_0x43e7('0x2d')]=0x0;_0x4c9df3['message']=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3['name']+'\x20is\x20not\x20active');}else{_0x4c9df3[_0x43e7('0x32')]=utils['CAMPAIGN_STATUS'][_0x43e7('0x33')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3[_0x43e7('0x2a')]+'\x20is\x20deactivated');}}}Preview[_0x43e7('0x34')][_0x43e7('0x22')]=function(){var _0x45b675=this;setInterval(function(){_0x45b675[_0x43e7('0x35')]();},0x7cf);};Preview[_0x43e7('0x34')][_0x43e7('0x35')]=function(){var _0x2b85a5=this[_0x43e7('0x23')];this[_0x43e7('0x13')]+=0x1;for(var _0x35dbcd in _0x2b85a5){if(_0x2b85a5[_0x43e7('0x36')](_0x35dbcd)&&(_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')||_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]==='booked')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(this[_0x43e7('0x13')]>0x7){this[_0x43e7('0x13')]=0x0;this[_0x43e7('0x3a')]();}}if(_0x2b85a5['hasOwnProperty'](_0x35dbcd)&&_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(_0x2b85a5[_0x35dbcd]['dialActive']){this['setMessage'](_0x2b85a5[_0x35dbcd]);if(_0x2b85a5[_0x35dbcd]['dialPreviewAutoRecallMe'])this[_0x43e7('0x3b')](_0x2b85a5[_0x35dbcd]);}else{notSendMessagesQueue(_0x2b85a5[_0x35dbcd]);}}}};Preview[_0x43e7('0x34')][_0x43e7('0x3c')]=function(_0x234fe6){var _0x108313=this;this[_0x43e7('0xf')]['enqueue'](function(){if(!_['isNil'](_0x108313['actions'][_0x234fe6])){loggerAction['info']('[clearZombieChannels][talking]',_0x234fe6,'Queue',_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')],'originated:\x20',JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]][_0x43e7('0x2c')]),_0x43e7('0x3e'),JSON[_0x43e7('0x27')](_0x108313['campaignsPreview'][_0x108313['actions'][_0x234fe6]['queue']][_0x43e7('0x3f')]),JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]),JSON[_0x43e7('0x27')](_[_0x43e7('0x41')](_0x108313[_0x43e7('0x12')][_0x234fe6],[_0x43e7('0x42'),'UserId',_0x43e7('0x43'),_0x43e7('0x44')])));return ami['Action']({'action':_0x43e7('0x45'),'channel':_0x108313['actions'][_0x234fe6][_0x43e7('0x46')]})[_0x43e7('0x47')](function(_0x1c6f45){if(_0x1c6f45[_0x43e7('0x32')]===_0x43e7('0x48')){setTimeout(function(){if(_0x108313[_0x43e7('0x12')][_0x234fe6]){ut['updateOriginated'](_0x108313['campaignsPreview'][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]],_0x43e7('0x49'));if(_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]===!![]){ut['decrementTalkink'](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']],_0x43e7('0x49'));ut['loggerError'](_0x43e7('0x4a')+_0x234fe6,_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')]);}ut[_0x43e7('0x4b')](_0x43e7('0x4c')+_0x234fe6,_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']);delete _0x108313['actions'][_0x234fe6];}},0x2328);}});}});};Preview[_0x43e7('0x34')][_0x43e7('0x3a')]=function(){var _0xe979b5=this;loggerAction[_0x43e7('0x25')]('[action]',_['size'](this['actions']));for(var _0x35e4fb in this['actions']){if(_0xe979b5[_0x43e7('0x12')]['hasOwnProperty'](_0x35e4fb)){_0xe979b5['clearZombieChannel'](_0x35e4fb);}}};Preview[_0x43e7('0x34')]['recallMe']=function(_0x2de14f){var _0x39db7f=this;rpcDb[_0x43e7('0x4d')](_0x2de14f['id'],ut[_0x43e7('0x4e')](this['agents']))[_0x43e7('0x4f')](function(_0x2b9046){if(!_[_0x43e7('0x50')](_0x2b9046)){for(var _0x1fd277=0x0;_0x1fd277<_0x2b9046[_0x43e7('0x51')];_0x1fd277+=0x1){if(ut[_0x43e7('0x52')](_0x2b9046[_0x1fd277]['scheduledat'])<_0x2de14f['dialRecallMeTimeout']*0x3c){if(_0x2b9046[_0x1fd277][_0x43e7('0x53')]&&!_0x2b9046[_0x1fd277][_0x43e7('0x53')][_0x43e7('0x54')]){_0x39db7f['run'](_0x2b9046[_0x1fd277]['id'])['then'](ut['logger2'](_0x43e7('0x55')))[_0x43e7('0x47')](ut['logger2'](_0x43e7('0x55')));}else{rpcDb[_0x43e7('0x56')](_0x2b9046[_0x1fd277]['id']);}}else{var _0x3c96fe=new Action(_0x2b9046[_0x1fd277],_0x2de14f);_0x3c96fe['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2de14f['outboundReCallsDay']+=0x1;ut[_0x43e7('0x57')](_0x3c96fe,0x17,_0x43e7('0x58'));if(_0x2de14f['dialRecallInQueue']){rpcDb[_0x43e7('0x59')](ut[_0x43e7('0x5a')](_0x2b9046[_0x1fd277]));rpcDb[_0x43e7('0x5b')](_0x3c96fe,_0x43e7('0x5c'));}else{ut['logCustomer'](_0x3c96fe,0x16,_0x43e7('0x5d'));rpcDb['createCustomerHistory'](_0x3c96fe,'[HistoryRecallClose]');rpcDb[_0x43e7('0x5e')](_0x3c96fe,_0x43e7('0x5f'));}}}}})[_0x43e7('0x47')](ut[_0x43e7('0x60')](_0x43e7('0x61')));};Preview[_0x43e7('0x34')][_0x43e7('0x62')]=function(_0x256ddd){_0x256ddd[_0x43e7('0x2b')]=!![];if(ut[_0x43e7('0x63')](_0x256ddd['loggedIn'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x43e7('0x64')](_0x256ddd['dialActive'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];}else if(!this[_0x43e7('0x65')](_0x256ddd[_0x43e7('0x66')])){if(!this['isTrunkReachable'](_0x256ddd['TrunkBackup'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x67')];}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}};Preview[_0x43e7('0x34')][_0x43e7('0x69')]=function(_0x4ace49,_0x1ec35a,_0x2da2f3){var _0x50a3fa=this;var _0x4314d8=this[_0x43e7('0x12')][_0x1ec35a];var _0x2d0052=this['campaignsPreview'][_0x4314d8['queue']];var _0x459c13;var _0x3d9a29=![];var _0x4ebdde=0x2;var _0x283dd8=0x3;if(_0x2d0052){switch(_0x2da2f3){case'1':_0x2d0052['outboundNoSuchCallsDay']+=0x1;_0x4314d8['countnosuchnumberretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x0,_0x43e7('0x6c'));ami[_0x43e7('0x24')]('custom:agentnosuchnumber',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x6e')));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0x6f'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'0',_0x2d0052)[_0x43e7('0x4f')](function(_0x5bb536){_0x3d9a29=_0x5bb536['additional']==0x1;_0x4ebdde=_0x2d0052['dialNoSuchNumberRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0x74'));}else{if(_0x4314d8[_0x43e7('0x75')]>=_0x2d0052[_0x43e7('0x76')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x75'),_0x2d0052[_0x43e7('0x79')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x4314d8[_0x43e7('0x75')]++;logger[_0x43e7('0x25')](_0x43e7('0x7d'),_0x4314d8['countnosuchnumberretry']);logger['info']('id',_0x4314d8[_0x43e7('0x7e')]);_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8['idContact'],'field':{'countnosuchnumberretry':_0x4314d8['countnosuchnumberretry']}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});break;case _0x43e7('0x80'):var _0x135791=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x4314d8[_0x43e7('0x81')]=_0x135791;_0x4314d8[_0x43e7('0x82')]=_0x135791;_0x4314d8[_0x43e7('0x40')]=!![];_0x2d0052[_0x43e7('0x3f')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x83'),_0x4314d8[_0x43e7('0x84')],'\x20Queue',_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);ami['emit']('custom:agentconnect',ut[_0x43e7('0x6d')](_0x4314d8,'connect',this['campaignsPreview'][_0x4314d8[_0x43e7('0x3d')]]));if(_0x2d0052[_0x43e7('0x85')]){ami['emit'](_0x43e7('0x86'),ut[_0x43e7('0x87')](_0x4314d8));}break;case'16':ami[_0x43e7('0x24')](_0x43e7('0x88'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89'),this[_0x43e7('0x23')][_0x4314d8['queue']]));emitVoiceQueueChannelRemove(ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89')));_0x2d0052['outboundAnswerCallsDay']+=0x1;_0x2d0052[_0x43e7('0x8a')]+=0x1;_0x2d0052['answered']+=0x1;ut[_0x43e7('0x8b')](_0x2d0052,_0x43e7('0x8c'));_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x4,_0x43e7('0x8d'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0x8e'));rpcDb['createCustomerFinal'](_0x4314d8,_0x43e7('0x8f'));rpcDb[_0x43e7('0x90')](_0x4314d8);_0x2d0052[_0x43e7('0x91')]+=_0x4314d8[_0x43e7('0x92')];_0x2d0052[_0x43e7('0x93')]+=_0x4314d8['talktime'];logger[_0x43e7('0x25')](_0x43e7('0x94'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);delete this['actions'][_0x4ace49['linkedid']];break;case _0x43e7('0x96'):_0x2d0052['outboundBusyCallsDay']+=0x1;_0x4314d8['countbusyretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x5,_0x43e7('0x97'));_0x4ebdde=_0x2d0052[_0x43e7('0x98')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentbusy',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x99')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'5',_0x2d0052)[_0x43e7('0x4f')](function(_0x184ae3){_0x3d9a29=_0x184ae3[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4314d8['countbusyretry']>=_0x2d0052[_0x43e7('0x9c')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x9d'),_0x2d0052[_0x43e7('0x98')]),_0x4314d8['unlockAgent'],_0x4314d8['activeContact']);}}}else{_0x4314d8['countbusyretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countbusyretry':_0x4314d8['countbusyretry']}})['then'](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0x9f'):_0x2d0052['outboundNoAnswerCallsDay']+=0x1;_0x4314d8[_0x43e7('0xa0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x3,'NoAnswer');_0x4ebdde=_0x2d0052[_0x43e7('0xa1')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];var _0xa66309=ut[_0x43e7('0xa2')](_0x4314d8,_0x2d0052);ami[_0x43e7('0x24')](_0x43e7('0xa3'),_0xa66309);rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xa4'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'3',_0x2d0052)['then'](function(_0x109c86){_0x3d9a29=_0x109c86[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xa5'));}else{if(_0x4314d8['countnoanswerretry']>=_0x2d0052[_0x43e7('0xa6')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xa4'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xa0'),_0x2d0052[_0x43e7('0xa1')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xa7'):_0x2d0052['outboundCongestionCallsDay']+=0x1;_0x4314d8['countcongestionretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x8,_0x43e7('0xa8'));_0x4ebdde=_0x2d0052[_0x43e7('0xa9')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];ami['emit'](_0x43e7('0xaa'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xab')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xac'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'8',_0x2d0052)['then'](function(_0x403276){_0x3d9a29=_0x403276[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xad'));}else{if(_0x4314d8[_0x43e7('0xae')]>=_0x2d0052['dialCongestionMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xac'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xae'),_0x2d0052['dialBusyRetryFrequency']),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8['countcongestionretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countcongestionretry':_0x4314d8[_0x43e7('0xae')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'CANCEL':_0x2d0052[_0x43e7('0xaf')]+=0x1;_0x4314d8[_0x43e7('0xb0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x14,_0x43e7('0xb1'));_0x4ebdde=_0x2d0052[_0x43e7('0xb2')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentreject',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xb3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xb4'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'20',_0x2d0052)['then'](function(_0x2c5bf9){_0x3d9a29=_0x2c5bf9[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4314d8[_0x43e7('0xb0')]>=_0x2d0052['dialAgentRejectMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xb5'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xb0'),_0x2d0052['dialAgentRejectRetryFrequency']),_0x4314d8['unlockAgent'],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xb6'):_0x2d0052[_0x43e7('0xb7')]+=0x1;_0x4314d8[_0x43e7('0xb8')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xb,_0x43e7('0xb9'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xba'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'11',_0x2d0052)[_0x43e7('0x4f')](function(_0x3286b1){_0x3d9a29=_0x3286b1[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xba'));}else{if(_0x4314d8[_0x43e7('0xbb')]>=_0x2d0052[_0x43e7('0xbc')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x43e7('0x77')](ut['scheduledAt'](_0x4314d8,_0x43e7('0xb8'),_0x2d0052[_0x43e7('0xbd')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'18':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countmachineretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x12,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami[_0x43e7('0x24')](_0x43e7('0xc1'),ut['buildObj'](_0x4314d8,'amd'));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0xc2'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'18',_0x2d0052)['then'](function(_0x4d7f0f){_0x3d9a29=_0x4d7f0f[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x12,'Global');rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc2'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc2'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];break;case'19':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut['totalGlobal'](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x13,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami['emit'](_0x43e7('0xc1'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xc3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][machine]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'18',_0x2d0052)['then'](function(_0x299086){_0x3d9a29=_0x299086[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut['totalGlobal'](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc4'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc4'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});delete this['actions'][_0x4ace49[_0x43e7('0x7c')]];break;default:if(_0x4314d8[_0x43e7('0x40')]){ut[_0x43e7('0x8b')](_0x2d0052,'[default]');ut[_0x43e7('0x4b')](_0x43e7('0xc5')+_0x2d0052[_0x43e7('0x2a')],_0x4ace49);}_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xc,_0x4ace49['cause-txt']||_0x4ace49['dialstatus']);_0x4ebdde=_0x2d0052['dialAgentRejectRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xc6'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'20',_0x2d0052)[_0x43e7('0x4f')](function(_0x40019e){_0x3d9a29=_0x40019e[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc7'));}else{rpcDb['createCustomerFinal'](_0x4314d8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});}});}if(!(_0x4314d8['dialAnswer']&&_0x2da2f3==='16')){ut[_0x43e7('0xc8')](_0x2d0052,_0x43e7('0xc9'));logger[_0x43e7('0x25')](_0x43e7('0xca'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052['name'],_0x43e7('0xcb'),_0x2d0052['originated']);}if(_0x2da2f3!=='ANSWER'){delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];delete this['actions'][_0x4ace49['destlinkedid']];}_0x2d0052[_0x43e7('0xcc')]=!![];}};Preview[_0x43e7('0x34')]['callProgressDetectingAgent']=function(_0x189c38,_0x156a3c,_0x302138){if(_[_0x43e7('0xcd')](_0x156a3c)&&'object'!==typeof _0x156a3c){return;}if(_['isUndefined'](_0x302138)&&_0x43e7('0xce')!==typeof _0x302138){return;}switch(_0x302138[_0x43e7('0xcf')]){case'0':ut[_0x43e7('0xd0')](_0x189c38,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x189c38,_0x43e7('0xd1'));break;case'3':ut[_0x43e7('0xd0')](_0x189c38,0x3,_0x43e7('0xd2'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd4'));break;case'5':ut[_0x43e7('0xd0')](_0x189c38,0x5,_0x43e7('0x97'));rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x189c38,0x8,'Congestion');rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x43e7('0xd0')](_0x189c38,0x16,_0x43e7('0xd5'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd6'));break;default:ut[_0x43e7('0xd0')](_0x189c38,0xc,_0x302138['reason']);rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd7'));}ut[_0x43e7('0xc8')](_0x156a3c,_0x43e7('0xd8'));logger['info'](_0x43e7('0xd9'),_0x189c38[_0x43e7('0x84')],_0x43e7('0x95'),_0x156a3c[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x156a3c[_0x43e7('0x2c')]);delete this[_0x43e7('0x12')][_0x189c38['uniqueid']];};Preview[_0x43e7('0x34')][_0x43e7('0x70')]=function(_0x20fab2,_0x3637d9,_0x3c52d3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20fab2,_0x3637d9,_0x3c52d3)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x7f')]=function(_0x577ac6,_0x235418,_0x368c57){return cmHopperAdditionalPhone[_0x43e7('0x7f')](_0x577ac6,_0x235418,_0x368c57)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x9e')]=function(_0x1e5d48){return Promise['resolve']()[_0x43e7('0x4f')](cmHopperAdditionalPhone[_0x43e7('0x9e')](_0x1e5d48))['catch'](logger[_0x43e7('0x25')](_0x43e7('0xda')));};Preview[_0x43e7('0x34')][_0x43e7('0xdb')]=function(_0x15b04a,_0x3b5f39,_0x4d5736,_0xcbdb35,_0xa5981f){var _0x19ddfa=this;return new Promise(function(_0x4a4031,_0x5a7f2e){if(_[_0x43e7('0x50')](_0x3b5f39)||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdc')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdd')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0x43')])){_0x5a7f2e(ut[_0x43e7('0x32')]('Contact\x20is\x20undefined',_0xcbdb35,_0xa5981f));return;}var _0x723c7=uuid['v4']();var _0xfbdb90=_0x19ddfa[_0x43e7('0x23')][_0x3b5f39[_0x43e7('0xde')][_0x43e7('0x2a')]];var _0x114e00=_0x4d5736?_0x19ddfa[_0x43e7('0xdf')][_0x4d5736]['id']:undefined;_0x19ddfa[_0x43e7('0x12')][_0x723c7]=new Action(_0x3b5f39,_0xfbdb90,_0x723c7,_0x4d5736,_0x114e00);var _0x51e17c=_0x19ddfa[_0x43e7('0x12')][_0x723c7];_0x51e17c[_0x43e7('0x7a')]=_0xcbdb35;_0x51e17c[_0x43e7('0x7b')]=_0xa5981f;_0x51e17c[_0x43e7('0xe0')]=_0x4d5736;if(_[_0x43e7('0xe1')](_0x15b04a)){_0x19ddfa['execCall'](_0x51e17c,_0xfbdb90,_0x3b5f39,_0x4d5736)[_0x43e7('0x4f')](function(_0x186e57){logger[_0x43e7('0x25')](_0x43e7('0xe2'),_0x43e7('0xe3')+_0x51e17c['queue']+_0x43e7('0xe4')+_0x51e17c['idContact'],JSON[_0x43e7('0x27')](_0x186e57));ami[_0x43e7('0x24')](_0x43e7('0xe5'),ut[_0x43e7('0x6d')](_0x51e17c,'called',_0x19ddfa[_0x43e7('0x23')][_0x51e17c[_0x43e7('0x3d')]]));_0x4a4031(ut[_0x43e7('0x32')](_0x43e7('0xe6')));})[_0x43e7('0x47')](function(_0x27bbd6){ut[_0x43e7('0x30')](_0x43e7('0xe7'),_0x27bbd6);_0x5a7f2e(ut[_0x43e7('0x32')](_0x43e7('0xe8'),_0xcbdb35,_0xa5981f));});}else{_0xfbdb90[_0x43e7('0xe9')]+=0x1;ut['logBlacklist'](_0x51e17c);rpcDb['createHistory'](_0x51e17c,_0x43e7('0xea'));delete _0x19ddfa['actions'][_0x723c7];_0x5a7f2e(ut['message'](_0x43e7('0xeb'),_0xcbdb35,_0xa5981f));}});};Preview[_0x43e7('0x34')]['isTrunkReachable']=function(_0x143be2){return!_['isNil'](_0x143be2)&&!_['isNil'](_0x143be2['name'])&&!_[_0x43e7('0x50')](_0x143be2[_0x43e7('0xec')])&&_0x143be2[_0x43e7('0xec')]&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])])&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')])&&(this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')]===_0x43e7('0xee')||this['trunks'][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2['name'])][_0x43e7('0x45')]===_0x43e7('0xef'));};Preview[_0x43e7('0x34')][_0x43e7('0xf0')]=function(_0x49441c,_0x31797a){return this[_0x43e7('0xf1')](_0x49441c,_0x31797a)['then'](function(_0x43500a){return _[_0x43e7('0x41')](_0x43500a,[_0x43e7('0x32')]);})['catch'](function(_0x22b824){if(_0x22b824[_0x43e7('0xf2')]){rpcDb[_0x43e7('0xf3')](_0x49441c);}if(_0x22b824[_0x43e7('0xec')]){rpcDb[_0x43e7('0x56')](_0x49441c);}throw _['pick'](_0x22b824,[_0x43e7('0x32')]);});};Preview[_0x43e7('0x34')]['execRun']=function(_0x1d31f5,_0x47b03b){var _0x4bf8ad=this;var _0x55baca,_0x5486a6;return rpcDb[_0x43e7('0xf4')](_0x1d31f5)[_0x43e7('0x4f')](function(_0x7f518f){if(!_[_0x43e7('0x50')](_0x7f518f[0x0])){_0x5486a6=_0x7f518f[0x0]['recallme']?![]:!![];_0x55baca=_0x7f518f[0x0]['recallme']?!![]:![];_0x55baca=_0x47b03b?!![]:_0x55baca;}var _0x267b26=_0x4bf8ad['validateContact'](_0x7f518f);if(_0x267b26[_0x43e7('0xf5')]){rpcDb['checkIsBlackList'](_[_0x43e7('0x41')](_0x7f518f[0x0],['VoiceQueueId','phone']))['then'](function(_0x5653b0){_0x4bf8ad[_0x43e7('0xdb')](_0x5653b0,_0x7f518f[0x0],_0x47b03b,_0x5486a6,_0x55baca)[_0x43e7('0x4f')](function(_0x574658){return _0x574658;})['catch'](function(_0x466aa7){throw _0x466aa7;});})[_0x43e7('0x47')](function(_0x517289){ut['logger'](_0x43e7('0xf6'),_0x517289);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),_0x5486a6,_0x55baca);});}else{throw ut[_0x43e7('0x32')](_0x267b26['message'],_0x5486a6,_0x55baca);}})[_0x43e7('0x47')](function(_0x536b7d){ut[_0x43e7('0x30')](_0x43e7('0xf8'),_0x536b7d);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),![],!![]);});};Preview[_0x43e7('0x34')][_0x43e7('0xf9')]=function(_0x2cbbda){if(_['isNil'](_0x2cbbda)||_[_0x43e7('0xe1')](_0x2cbbda)||!_[_0x43e7('0x50')](_0x2cbbda[0x0]['Agent'])&&_[_0x43e7('0x50')](_0x2cbbda[0x0][_0x43e7('0x53')][_0x43e7('0x2a')])){ut[_0x43e7('0x30')](_0x43e7('0xfa'),_0x2cbbda);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3fd573=this['campaignsPreview'][_0x2cbbda[0x0][_0x43e7('0xde')]['name']];_0x3fd573[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];if(_[_0x43e7('0x50')](_0x3fd573)){ut[_0x43e7('0x30')]('[Preview][validateContact][Empty\x20Campaign]',_0x3fd573);return{'isValid':![],'message':_0x43e7('0xfb')};}if(!this['isTrunkReachable'](_0x3fd573[_0x43e7('0x66')])){ut[_0x43e7('0x30')](_0x43e7('0xfc'),'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0xfd'));if(!this[_0x43e7('0x65')](_0x3fd573[_0x43e7('0xfe')])){ut[_0x43e7('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x3fd573[_0x43e7('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x43e7('0xff')};}}if(!ut[_0x43e7('0x64')](_0x3fd573[_0x43e7('0x100')])){ut[_0x43e7('0x30')](_0x43e7('0x101'),_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0x102'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x43e7('0x103')};};Preview[_0x43e7('0x34')][_0x43e7('0x104')]=function(_0xbc6e18,_0x16c757,_0xf9178f,_0x3bb7ab){var _0x2be8c7=this;return new Promise(function(_0x2bb14d,_0x57f7ea){var _0x240478=_0xbc6e18['uniqueid'];var _0x2b7b33=_0x2be8c7[_0x43e7('0x65')](_0x16c757['Trunk'])?util[_0x43e7('0x28')](_0x43e7('0x105'),_0x16c757['Trunk'][_0x43e7('0x2a')],_[_0x43e7('0x50')](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757[_0x43e7('0x108')]>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]):util[_0x43e7('0x28')](_0x43e7('0x105'),_['isNil'](_0x16c757[_0x43e7('0xfe')])?_0x16c757[_0x43e7('0x66')]['name']:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x2a')],_['isNil'](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757['dialCutDigit']>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]);var _0x2ed5e0=_0x2be8c7[_0x43e7('0x65')](_0x16c757[_0x43e7('0x66')])?ut['getCallerId'](_0x16c757['Trunk'][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757[_0x43e7('0x10c')]>0x0?ut[_0x43e7('0x10d')](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]):ut[_0x43e7('0x10f')](_[_0x43e7('0x50')](_0x16c757['TrunkBackup'])?_0x16c757[_0x43e7('0x66')][_0x43e7('0x10a')]:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]);if(_0x2ed5e0){_0xbc6e18[_0x43e7('0x110')]=ut['extractCalleridName'](_0x2ed5e0);_0xbc6e18[_0x43e7('0x111')]=ut['extractCalleridNumber'](_0x2ed5e0);}var _0x1c7f6a=ut[_0x43e7('0x112')](_0x16c757,_0xf9178f,_0x2b7b33,_0x2ed5e0,_0x240478,_0xbc6e18);_[_0x43e7('0x113')](_0xbc6e18,ut[_0x43e7('0x114')](_0x1c7f6a));_0xbc6e18[_0x43e7('0x115')]=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x16c757[_0x43e7('0x116')]=_0x1c7f6a;var _0x202421=ut[_0x43e7('0x117')](_0xbc6e18,_0x16c757,_0x1c7f6a,_0xbc6e18[_0x43e7('0x7b')],_0x3bb7ab);return ami[_0x43e7('0x118')](_0x202421)[_0x43e7('0x4f')](function(_0x4637f6){_0x16c757[_0x43e7('0x2c')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x119'),_0x240478,_0x43e7('0x95'),_0x16c757[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x16c757['originated']);_0x2bb14d(_0x4637f6);})[_0x43e7('0x47')](function(_0x24d6e4){ut['logAgent'](_0xbc6e18,0xe,_0x43e7('0x11a'));rpcDb[_0x43e7('0xd3')](_0xbc6e18,'[originateFailure][logOriginateFailure]');_0x57f7ea(_0x24d6e4);});});};Preview[_0x43e7('0x34')][_0x43e7('0x11b')]=function(_0x2b9cf9){if(this['actions'][_0x2b9cf9['linkedid']]){this[_0x43e7('0x12')][_0x2b9cf9[_0x43e7('0x7c')]][_0x43e7('0x46')]=_0x2b9cf9[_0x43e7('0x46')];}};Preview[_0x43e7('0x34')][_0x43e7('0x15')]=function(_0x25b5a2){var _0xfe77ea=this;var _0x5d2cb0=this[_0x43e7('0x12')][_0x25b5a2[_0x43e7('0x11c')]];if(_0x5d2cb0){if(_0x5d2cb0[_0x43e7('0xe0')]&&this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]){ut[_0x43e7('0x11d')](_0x5d2cb0,this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]][_0x43e7('0x2a')],this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]['id']);}var _0x218743=_['clone'](_0x5d2cb0);_0x218743[_0x43e7('0x81')]=moment()[_0x43e7('0x28')](_0x43e7('0x11e'));var _0x21c8b9=_0xfe77ea[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]];if(ut['isFailure'](_0x25b5a2[_0x43e7('0x11f')])){if(_0x5d2cb0['unlockAgent']){rpcDb[_0x43e7('0xf3')](_0x5d2cb0[_0x43e7('0x7e')]);}if(_0x5d2cb0[_0x43e7('0x7b')]){rpcDb['disableContact'](_0x5d2cb0[_0x43e7('0x7e')]);}ami[_0x43e7('0x24')]('custom:agentringnoanswer',ut[_0x43e7('0x6d')](_0x5d2cb0,'rejected',this[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]]));this[_0x43e7('0x120')](_0x218743,_0x21c8b9,_0x25b5a2);}else{_0x5d2cb0[_0x43e7('0x115')]=moment()['format'](_0x43e7('0x11e'));ut[_0x43e7('0xd0')](_0x218743,0x4,_0x43e7('0x8d'));rpcDb['createAgentHistory'](_0x218743,_0x43e7('0x121'));}}};Preview[_0x43e7('0x34')][_0x43e7('0x16')]=function(_0x431345){var _0x77c2f=this[_0x43e7('0x12')][_0x431345['linkedid']];var _0x3f057e;if(_0x77c2f){_0x3f057e=this['campaignsPreview'][_0x77c2f[_0x43e7('0x3d')]];logger[_0x43e7('0x25')]('[syncHangup][talking]',_0x431345[_0x43e7('0x7c')],_0x43e7('0x95'),_0x3f057e['name'],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);}if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]]&&_0x431345['linkedid']!==_0x431345['uniqueid']){if(_0x431345[_0x43e7('0x122')]==='16'&&this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345['linkedid']][_0x43e7('0x40')]){logger[_0x43e7('0x25')]('[syncHangup][talking][cause]',_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],_0x43e7('0x95'),_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345['linkedid'],_0x431345[_0x43e7('0x122')]);}}else if(_0x77c2f&&_['isNil'](_0x77c2f[_0x43e7('0x123')])&&_0x3f057e[_0x43e7('0x124')]&&_0x431345['linkedid']===_0x431345[_0x43e7('0x84')]&&_['isNil'](_0x431345[_0x43e7('0xcf')])&&_0x431345[_0x43e7('0x122')]==='16'&&_0x431345[_0x43e7('0x125')]==='6'&&_['isUndefined'](_0x77c2f['transfer'])){if(_0x77c2f[_0x43e7('0x7a')]){rpcDb[_0x43e7('0xf3')](_0x77c2f['idContact']);}if(_0x77c2f[_0x43e7('0x7b')]){rpcDb[_0x43e7('0x56')](_0x77c2f[_0x43e7('0x7e')]);}_0x431345['reason']='22';this[_0x43e7('0x120')](_0x77c2f,_0x3f057e,_0x431345);}else if(_0x77c2f&&_0x77c2f[_0x43e7('0x126')]){if(_0x431345[_0x43e7('0x122')]==='16'&&this['actions'][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x127'),_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],'\x20Queue',_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x128'),_0x431345[_0x43e7('0x7c')],_0x431345['cause'],'\x20Queue',_0x3f057e['name'],'pTalking:\x20',_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')][_0x43e7('0x1a')]=function(_0x51dc07){if(this['actions'][_0x51dc07[_0x43e7('0x129')]]&&_0x51dc07[_0x43e7('0x129')]!==_0x51dc07['destuniqueid']){this['callProgressDetectingCustomer'](_0x51dc07,_0x51dc07[_0x43e7('0x129')],_0x51dc07[_0x43e7('0xc0')]);}};Preview['prototype'][_0x43e7('0x19')]=function(_0x57bcab){if(this['actions'][_0x57bcab[_0x43e7('0x7c')]]&&_0x57bcab[_0x43e7('0x7c')]!==_0x57bcab['uniqueid']&&!this['actions'][_0x57bcab[_0x43e7('0x7c')]][_0x43e7('0x40')]){if(_0x57bcab[_0x43e7('0x122')]==='1'){this[_0x43e7('0x69')](_0x57bcab,_0x57bcab['linkedid'],_0x57bcab[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')]['addVariable']=function(_0x560373,_0x4cdb87,_0x4eaf92){if(this[_0x43e7('0x12')][_0x560373]){if(_[_0x43e7('0x50')](this['actions'][_0x560373]['variables'])){this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')]={};}this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')][_0x4cdb87]=_0x4eaf92;}};Preview[_0x43e7('0x34')]['syncVarSet']=function(_0x3836e7){try{if(!_[_0x43e7('0x50')](_0x3836e7)){if(ut[_0x43e7('0x12a')](_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0])){this['addVariable'](_0x3836e7[_0x43e7('0x84')],_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0],_0x3836e7[_0x43e7('0x12d')]);}}}catch(_0x5564b4){logger[_0x43e7('0x12e')](_0x43e7('0x12f'),util[_0x43e7('0x130')](_0x5564b4,{'showHidden':![],'depth':null}));}};Preview[_0x43e7('0x34')][_0x43e7('0x1f')]=function(_0x308403){if(_0x308403){if(this['actions'][_0x308403[_0x43e7('0x131')]]){this[_0x43e7('0x12')][_0x308403[_0x43e7('0x131')]][_0x43e7('0x126')]=!![];}}};Preview['prototype'][_0x43e7('0x21')]=function(_0x48c784){if(_0x48c784){if(this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']]){this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']][_0x43e7('0x126')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 007074d..6863e86 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 _0x1956=['[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x4288de,_0x12e9a0){var _0x27c707=function(_0x540205){while(--_0x540205){_0x4288de['push'](_0x4288de['shift']());}};_0x27c707(++_0x12e9a0);}(_0x1956,0x1c8));var _0x6195=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x1956[_0x57975f];return _0x4793b8;};'use strict';var util=require('util');var BPromise=require(_0x6195('0x0'));var logger=require('../../../config/logger')(_0x6195('0x1'));var cmHopper=require(_0x6195('0x2'));var cmHopperHistory=require(_0x6195('0x3'));var cmHopperBlack=require(_0x6195('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6195('0x5'));function loggerCatch(_0x5caf09){return function(_0x5a0b21){logger[_0x6195('0x6')](_0x5caf09,util[_0x6195('0x7')](_0x5a0b21,{'showHidden':![],'depth':null}));};}function create(_0x56c5d6){return cmHopperHistory[_0x6195('0x8')](_0x56c5d6)[_0x6195('0x9')](loggerCatch(_0x6195('0xa')));}function createAgent(_0x15a119){return BPromise[_0x6195('0xb')]()['then'](agentReportPreview[_0x6195('0x8')](_0x15a119))['catch'](loggerCatch(_0x6195('0xa')));}function moveContact(_0x1218da){return cmHopper['moveContactManagedDialer'](_0x1218da,!![])['catch'](loggerCatch(_0x6195('0xc')));}exports[_0x6195('0xd')]=function(_0x26ef5b){return cmHopperBlack[_0x6195('0xd')](_0x26ef5b)['catch'](loggerCatch(_0x6195('0xe')));};exports[_0x6195('0xf')]=function(_0xab5fc0){return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](cmHopper[_0x6195('0xf')](_0xab5fc0))[_0x6195('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6195('0x8')]=function(_0x366c27,_0x4b3128){create(_0x366c27)[_0x6195('0x9')](loggerCatch(_0x4b3128));moveContact(_0x366c27)[_0x6195('0x9')](loggerCatch(_0x4b3128));};exports[_0x6195('0x11')]=function(_0x3ddfe8,_0x3208c9){createAgent(_0x3ddfe8)[_0x6195('0x9')](loggerCatch(_0x3208c9));};exports[_0x6195('0x12')]=function(_0x60b95c,_0x916626){create(_0x60b95c)[_0x6195('0x9')](loggerCatch(_0x916626));};exports[_0x6195('0x13')]=function(_0x3d02a1,_0x223c4c){moveContact(_0x3d02a1)['catch'](loggerCatch(_0x223c4c));};exports[_0x6195('0x14')]=function(_0x3d934e,_0x13f6cc,_0x96b43a){if(_0x13f6cc){_0x3d934e['UserId']=null;}if(_0x96b43a){_0x3d934e[_0x6195('0x15')]=![];}return cmHopper[_0x6195('0x14')](_0x3d934e)['catch'](loggerCatch(_0x6195('0x16')));};exports['countReScheduled']=function(_0x19b1e6){return cmHopper['countReScheduled'](_0x19b1e6)[_0x6195('0x9')](loggerCatch(_0x6195('0x17')));};exports[_0x6195('0x18')]=function(_0x1da453){return cmHopper['unlockContact']({'UserId':null},_0x1da453,0x1)[_0x6195('0x9')](loggerCatch(_0x6195('0x19')));};exports[_0x6195('0x1a')]=function(_0x414c63){return cmHopper['unlockContact']({'active':![]},_0x414c63,0x1)['catch'](loggerCatch(_0x6195('0x1b')));};exports[_0x6195('0x1c')]=function(_0x346285){var _0x2face6={};_0x2face6[_0x6195('0x1d')]=_0x346285[_0x6195('0x1d')];_0x2face6[_0x6195('0x1e')]=_0x346285[_0x6195('0x1e')];_0x2face6['calleridnum']=_0x346285['calleridnum'];_0x2face6[_0x6195('0x1f')]=_0x346285[_0x6195('0x1f')];_0x2face6[_0x6195('0x20')]=_0x346285[_0x6195('0x20')];_0x2face6[_0x6195('0x21')]=_0x346285[_0x6195('0x22')];_0x2face6[_0x6195('0x23')]=_0x346285[_0x6195('0x22')];_0x2face6[_0x6195('0x24')]=0x1;_0x2face6[_0x6195('0x25')]=_0x346285[_0x6195('0x26')];_0x2face6[_0x6195('0x27')]=_0x346285[_0x6195('0x28')];_0x2face6['context']=_0x6195('0x29');_0x2face6[_0x6195('0x2a')]='xcally-motion-preview';_0x2face6[_0x6195('0x2b')]=0x0;_0x2face6[_0x6195('0x2c')]=0x1;_0x2face6['lastAssignedTo']=_0x346285[_0x6195('0x28')];_0x2face6[_0x6195('0x2d')]=_0x6195('0x2e');return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](voiceQueueReport[_0x6195('0x2f')](_0x2face6))[_0x6195('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x6195('0x30')]=function(_0x604c4e,_0x99661b){return BPromise[_0x6195('0xb')]()[_0x6195('0x10')](cmHopper[_0x6195('0x30')](_0x604c4e,_0x99661b))[_0x6195('0x9')](loggerCatch(_0x6195('0x31')));};exports[_0x6195('0x32')]=function(_0x23cb90){return cmHopper[_0x6195('0x14')](_0x23cb90,!![],!![])[_0x6195('0x9')](loggerCatch(_0x6195('0x33')));}; \ No newline at end of file +var _0xa111=['[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList'];(function(_0x2b90dc,_0x10b832){var _0x4794a6=function(_0x3720ca){while(--_0x3720ca){_0x2b90dc['push'](_0x2b90dc['shift']());}};_0x4794a6(++_0x10b832);}(_0xa111,0x1ef));var _0x1a11=function(_0x14a522,_0x49d6f4){_0x14a522=_0x14a522-0x0;var _0x17e658=_0xa111[_0x14a522];return _0x17e658;};'use strict';var util=require('util');var BPromise=require(_0x1a11('0x0'));var logger=require('../../../config/logger')(_0x1a11('0x1'));var cmHopper=require(_0x1a11('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x1a11('0x3'));var agentReportPreview=require(_0x1a11('0x4'));var voiceQueueReport=require(_0x1a11('0x5'));function loggerCatch(_0x226f8e){return function(_0x3a9e4f){logger[_0x1a11('0x6')](_0x226f8e,util[_0x1a11('0x7')](_0x3a9e4f,{'showHidden':![],'depth':null}));};}function create(_0x29fae3){return cmHopperHistory[_0x1a11('0x8')](_0x29fae3)[_0x1a11('0x9')](loggerCatch(_0x1a11('0xa')));}function createAgent(_0x577d3e){return BPromise[_0x1a11('0xb')]()[_0x1a11('0xc')](agentReportPreview[_0x1a11('0x8')](_0x577d3e))[_0x1a11('0x9')](loggerCatch(_0x1a11('0xa')));}function moveContact(_0x5a7aad){return cmHopper[_0x1a11('0xd')](_0x5a7aad,!![])[_0x1a11('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1a11('0xe')]=function(_0xa50b99){return cmHopperBlack[_0x1a11('0xe')](_0xa50b99)['catch'](loggerCatch(_0x1a11('0xf')));};exports[_0x1a11('0x10')]=function(_0x541708){return BPromise['resolve']()[_0x1a11('0xc')](cmHopper[_0x1a11('0x10')](_0x541708))[_0x1a11('0x9')](loggerCatch(_0x1a11('0x11')));};exports[_0x1a11('0x8')]=function(_0x5e2005,_0x494517){create(_0x5e2005)[_0x1a11('0x9')](loggerCatch(_0x494517));moveContact(_0x5e2005)[_0x1a11('0x9')](loggerCatch(_0x494517));};exports['createAgentHistory']=function(_0x1e264e,_0x2ba812){createAgent(_0x1e264e)[_0x1a11('0x9')](loggerCatch(_0x2ba812));};exports['createCustomerHistory']=function(_0x3d384f,_0x2ef6b0){create(_0x3d384f)['catch'](loggerCatch(_0x2ef6b0));};exports[_0x1a11('0x12')]=function(_0x4bd08b,_0xcc3ba9){moveContact(_0x4bd08b)[_0x1a11('0x9')](loggerCatch(_0xcc3ba9));};exports[_0x1a11('0x13')]=function(_0x5b3fac,_0x438e38,_0x3b7b13){if(_0x438e38){_0x5b3fac[_0x1a11('0x14')]=null;}if(_0x3b7b13){_0x5b3fac[_0x1a11('0x15')]=![];}return cmHopper[_0x1a11('0x13')](_0x5b3fac)[_0x1a11('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1a11('0x16')]=function(_0x3d9df3){return cmHopper[_0x1a11('0x16')](_0x3d9df3)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x1a11('0x17')]=function(_0x51da1f){return cmHopper[_0x1a11('0x17')]({'UserId':null},_0x51da1f,0x1)[_0x1a11('0x9')](loggerCatch(_0x1a11('0x18')));};exports[_0x1a11('0x19')]=function(_0x69592){return cmHopper[_0x1a11('0x17')]({'active':![]},_0x69592,0x1)[_0x1a11('0x9')](loggerCatch(_0x1a11('0x1a')));};exports[_0x1a11('0x1b')]=function(_0x53c96d){var _0x119249={};_0x119249['type']=_0x53c96d[_0x1a11('0x1c')];_0x119249[_0x1a11('0x1d')]=_0x53c96d[_0x1a11('0x1d')];_0x119249[_0x1a11('0x1e')]=_0x53c96d[_0x1a11('0x1e')];_0x119249[_0x1a11('0x1f')]=_0x53c96d['calleridname'];_0x119249[_0x1a11('0x20')]=_0x53c96d[_0x1a11('0x20')];_0x119249['queuecallerjoinAt']=_0x53c96d[_0x1a11('0x21')];_0x119249[_0x1a11('0x22')]=_0x53c96d['answertime'];_0x119249[_0x1a11('0x23')]=0x1;_0x119249[_0x1a11('0x24')]=_0x53c96d['endtime'];_0x119249[_0x1a11('0x25')]=_0x53c96d[_0x1a11('0x26')];_0x119249[_0x1a11('0x27')]=_0x1a11('0x28');_0x119249[_0x1a11('0x29')]=_0x1a11('0x2a');_0x119249['holdtime']=0x0;_0x119249[_0x1a11('0x2b')]=0x1;_0x119249[_0x1a11('0x2c')]=_0x53c96d[_0x1a11('0x26')];_0x119249[_0x1a11('0x2d')]=_0x1a11('0x2e');return BPromise[_0x1a11('0xb')]()[_0x1a11('0xc')](voiceQueueReport['create'](_0x119249))[_0x1a11('0x9')](loggerCatch(_0x1a11('0x2f')));};exports[_0x1a11('0x30')]=function(_0x286cca,_0x4b46d0){return BPromise[_0x1a11('0xb')]()[_0x1a11('0xc')](cmHopper[_0x1a11('0x30')](_0x286cca,_0x4b46d0))[_0x1a11('0x9')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x1a11('0x31')]=function(_0x8fe44c){return cmHopper['rescheduleContact'](_0x8fe44c,!![],!![])[_0x1a11('0x9')](loggerCatch(_0x1a11('0x32')));}; \ 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 3b64138..45b1b04 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 _0x0116=['calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','responsetime','endtime','getSeconds','talktime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','queue','status','push','getDiff','milliseconds','CampaignId','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','loggerError','logger2','info','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x0116,0x10b));var _0x6011=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0116[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0x6011('0x0'));var _=require(_0x6011('0x1'));var moment=require(_0x6011('0x2'));var logger=require(_0x6011('0x3'))(_0x6011('0x4'));var ipAgi=process[_0x6011('0x5')][_0x6011('0x6')]||_0x6011('0x7');var utils=require('../../dialer/utils');exports[_0x6011('0x8')]=function(_0x5693d2){return function(_0x369c10){logger[_0x6011('0x9')](_0x5693d2,util[_0x6011('0xa')](_0x369c10,{'showHidden':![],'depth':null}));};};exports[_0x6011('0xb')]=function(_0x583d76,_0x403dc0){logger['info'](_0x583d76,util[_0x6011('0xa')](_0x403dc0,{'showHidden':![],'depth':null}));};exports[_0x6011('0xc')]=function(_0x39d855,_0x49b41a){logger[_0x6011('0x9')](_0x39d855,util['inspect'](_0x49b41a,{'showHidden':![],'depth':null}));};exports[_0x6011('0xd')]=function(_0x3eaa50){return function(_0x35c2ec){logger[_0x6011('0xe')](_0x3eaa50,util[_0x6011('0xa')](_0x35c2ec,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x21fa75,_0x37b7c3,_0x24a26d){return{'message':_0x21fa75,'unlock':_0x37b7c3,'active':_0x24a26d};};exports['getCallerId']=function(_0x5a44ce,_0x1bf106,_0x5c421c){if(!_[_0x6011('0xf')](_0x5c421c)&&_0x6011('0x10')===typeof _0x5c421c&&!_['isEmpty'](_0x5c421c)){if(!_[_0x6011('0xf')](_0x1bf106)&&'string'===typeof _0x1bf106&&!_[_0x6011('0x11')](_0x1bf106)){return util[_0x6011('0x12')](_0x6011('0x13'),_0x1bf106,_0x5c421c);}return util[_0x6011('0x12')](_0x6011('0x13'),_0x5c421c,_0x5c421c);}if(!_[_0x6011('0xf')](_0x5a44ce)&&_0x6011('0x10')===typeof _0x5a44ce&&!_[_0x6011('0x11')](_0x5a44ce)){return _0x5a44ce;}return _0x6011('0x14');};exports[_0x6011('0x15')]=function(_0x57e8f6){if(_[_0x6011('0x16')](_0x57e8f6)){return![];}return _0x57e8f6;};exports[_0x6011('0x17')]=function(_0x974523,_0x3331b1,_0x29c2ff,_0x1b5629,_0x108637,_0x4eae58){var _0x277156={'XMD-QUEUE':_0x3331b1['Queue']?_0x3331b1[_0x6011('0x18')][_0x6011('0x19')]:'','XMD-CALLERID':_0x1b5629,'XMD-CALLERID-PREVIEW':_0x4eae58?util['format']('\x22%s\x22\x20<%s>',_0x4eae58[_0x6011('0x1a')],_0x4eae58[_0x6011('0x1b')]):_0x1b5629,'XMD-DIALID':_0x108637,'XMD-CONTACTID':_0x3331b1[_0x6011('0x1c')],'XMD-CDRTYPE':_0x6011('0x1d'),'CALLERID(all)':_0x1b5629,'XMD-VOICEQUEUEID':_0x3331b1['VoiceQueueId'],'XMD-DIALCHANNEL':_0x29c2ff,'XMD-DIALTIMEOUT':_0x974523[_0x6011('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x6011('0x12')]('\x22rtTxX%s%s\x22',_0x974523[_0x6011('0x1f')]?'g':'',_[_0x6011('0x11')](_0x974523[_0x6011('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x974523[_0x6011('0x21')]||'','XMD-AGI':_0x974523['dialQueueProject']?util[_0x6011('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x974523[_0x6011('0x22')]):_0x6011('0x23'),'XMD-AGIAFTER':_0x974523['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x974523['dialQueueProject2']):_0x6011('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x4eae58?_0x4eae58[_0x6011('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4eae58?_0x4eae58[_0x6011('0x25')]:'','XMD-DESTINATION':_0x6011('0x26'),'SIPADDHEADER':_0x6011('0x27')};if(!_['isEmpty'](_0x974523[_0x6011('0x20')])){_0x277156[util[_0x6011('0x12')]('%s',_0x6011('0x28'))]=_0x974523[_0x6011('0x20')];_0x277156[util[_0x6011('0x12')]('%s',_0x6011('0x29'))]=_0x108637;}if(_0x3331b1&&_0x3331b1['Contact']){for(var _0x5df31f in _0x3331b1[_0x6011('0x2a')]){if(_0x3331b1[_0x6011('0x2a')][_0x6011('0x2b')](_0x5df31f)){if(!_['isNil'](_0x3331b1[_0x6011('0x2a')][_0x5df31f])&&_0x5df31f!=='id'&&_0x5df31f!==_0x6011('0x2c')&&_0x5df31f!==_0x6011('0x2d')&&_0x5df31f!==_0x6011('0x2e')){_0x277156[util[_0x6011('0x12')](_0x6011('0x2f'),_0x6011('0x30'),_['toUpper'](_0x5df31f))]=_0x3331b1[_0x6011('0x2a')][_0x5df31f];}}}}return _0x277156;};exports[_0x6011('0x31')]=function(_0x2e6272){var _0x85f1a7={};for(var _0x4b4165 in _0x2e6272){if(_0x2e6272[_0x6011('0x2b')](_0x4b4165)){_0x85f1a7[util[_0x6011('0x12')]('%s',_[_0x6011('0x32')](_0x4b4165))]=_0x2e6272[_0x4b4165];}}return{'variables':_0x85f1a7};};exports[_0x6011('0x33')]=function(_0x59b4e8,_0x3542b5){if(!_[_0x6011('0x16')](_0x59b4e8)){if(_0x59b4e8[_0x6011('0x2b')](_0x6011('0x34'))){if(_0x59b4e8[_0x6011('0x34')]>0x0){_0x59b4e8[_0x6011('0x34')]-=0x1;}else{logger[_0x6011('0x9')](_0x6011('0x35'),_0x3542b5);}}}else{logger[_0x6011('0x9')](_0x6011('0x36'),_0x3542b5);}};exports[_0x6011('0x37')]=function(_0x559cd9){var _0x30b0d8=moment()[_0x6011('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x559cd9[_0x6011('0x38')]=0xd;_0x559cd9['statedesc']=_0x6011('0x39');_0x559cd9[_0x6011('0x3a')]=_0x30b0d8;_0x559cd9['responsetime']=_0x30b0d8;_0x559cd9['endtime']=_0x30b0d8;};exports[_0x6011('0x3b')]=function(_0x5c0c2f,_0x1f5a86,_0x27ea28){var _0x33b918=moment()[_0x6011('0x12')](_0x6011('0x3c'));_0x5c0c2f[_0x6011('0x38')]=_0x1f5a86;_0x5c0c2f[_0x6011('0x3d')]=_0x27ea28;_0x5c0c2f['responsetime']=_0x33b918;_0x5c0c2f[_0x6011('0x3e')]=utils['getSeconds'](_0x5c0c2f['responsetime'],_0x5c0c2f['starttime']);};exports[_0x6011('0x3f')]=function(_0x48387a,_0x5c4eef,_0x3a11f4){_0x48387a[_0x6011('0x40')]=_0x5c4eef;_0x48387a[_0x6011('0x41')]=_0x3a11f4;};exports[_0x6011('0x42')]=function(_0x54739a,_0x3e6bd4,_0x5ee57a){var _0x123ed5=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x54739a[_0x6011('0x38')]=_0x3e6bd4;_0x54739a[_0x6011('0x3d')]=_0x5ee57a;_0x54739a[_0x6011('0x43')]=_0x54739a[_0x6011('0x43')]?_0x54739a[_0x6011('0x43')]:_0x123ed5;_0x54739a[_0x6011('0x44')]=_0x54739a['endtime']?_0x54739a[_0x6011('0x44')]:_0x123ed5;_0x54739a['ringtime']=utils[_0x6011('0x45')](_0x54739a[_0x6011('0x43')]||0x0,_0x54739a[_0x6011('0x3a')]||0x0);_0x54739a[_0x6011('0x46')]=_0x54739a['answertime']?utils[_0x6011('0x45')](_0x54739a[_0x6011('0x44')],_0x54739a['answertime']):0x0;};exports[_0x6011('0x47')]=function(_0x453ca8){return _0x453ca8==='Failure';};exports[_0x6011('0x48')]=function(_0x6f6ae7,_0x2f07d1,_0x917230,_0x986384,_0x5b647b){var _0x5393a1=_0x986384?_0x6011('0x49'):_0x6f6ae7['calleridname'];_0x5393a1=_0x5b647b?_0x6011('0x4a'):_0x5393a1;return{'actionid':_0x6f6ae7[_0x6011('0x4b')],'action':'originate','channel':_0x6f6ae7[_0x6011('0x4c')],'callerid':util[_0x6011('0x12')](_0x6011('0x13'),_0x5393a1,_0x6f6ae7[_0x6011('0x1b')]),'Exten':_0x6011('0x26'),'Context':_0x6011('0x4d'),'Priority':'1','variable':_0x917230,'timeout':(_0x2f07d1[_0x6011('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6f6ae7['uniqueid']};};exports['totalGlobal']=function(_0x104f94){return _0x104f94[_0x6011('0x4f')]+_0x104f94['countcongestionretry']+_0x104f94[_0x6011('0x50')]+_0x104f94[_0x6011('0x51')]+_0x104f94[_0x6011('0x52')];};exports[_0x6011('0x53')]=function(_0x4dde2f){var _0x39739c=_[_0x6011('0x54')](_0x4dde2f);_0x39739c['state']=0xf;_0x39739c[_0x6011('0x3d')]=_0x6011('0x55');return _0x39739c;};exports[_0x6011('0x56')]=function(_0x9dec6c,_0x540867,_0x14f7c2){var _0x58e6c8={};_0x58e6c8[_0x540867]=_0x9dec6c[_0x540867];_0x58e6c8[_0x6011('0x57')]=![];_0x58e6c8['scheduledat']=moment()[_0x6011('0x58')](_0x14f7c2,_0x6011('0x59'))[_0x6011('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x58e6c8['ContactId']=_0x9dec6c[_0x6011('0x1c')];_0x58e6c8['ListId']=_0x9dec6c[_0x6011('0x5a')];_0x58e6c8[_0x6011('0x5b')]=_0x9dec6c[_0x6011('0x5b')]||undefined;return _0x58e6c8;};exports[_0x6011('0x5c')]=function(_0x30ba65,_0x504653){if(!_['isNil'](_0x30ba65)){if(_0x30ba65[_0x6011('0x5d')]>0x0){_0x30ba65['pTalking']-=0x1;}else{logger[_0x6011('0x9')](_0x504653,_0x6011('0x5e'));}}else{logger['error'](_0x504653,_0x6011('0x5f'));}};exports[_0x6011('0x60')]=function(_0x3df8a5){if(_0x3df8a5<=0x0){return!![];}return![];};function buildObj(_0x77c159,_0x16b761,_0x4e1cdc){_0x77c159[_0x6011('0x61')]=_0x16b761;_0x77c159['name']=_0x77c159['queue'];_0x77c159[_0x6011('0x62')]=_0x77c159[_0x6011('0x4c')];_0x77c159[_0x6011('0x63')]=_0x6011('0x64');if(_0x4e1cdc){_0x77c159[_0x6011('0x65')]=_0x4e1cdc['mandatoryDisposition'];}return _0x77c159;}exports[_0x6011('0x66')]=buildObj;exports['buildAcw']=function(_0x36a297){var _0x127a02={};_0x127a02['queue']=_0x36a297[_0x6011('0x67')];_0x127a02[_0x6011('0x62')]=_0x36a297[_0x6011('0x4c')];_0x127a02[_0x6011('0x4b')]=_0x36a297[_0x6011('0x4b')];return _0x127a02;};exports['agentReadyId']=function(_0x1dec12){var _0x39a811=[];for(var _0x3e0741 in _0x1dec12){if(_0x1dec12[_0x6011('0x2b')](_0x3e0741)){if(!_[_0x6011('0x16')](_0x1dec12[_0x3e0741])&&_0x1dec12[_0x3e0741][_0x6011('0x38')]==='not_inuse'&&_0x1dec12[_0x3e0741][_0x6011('0x68')]==='reachable'){_0x39a811[_0x6011('0x69')](_0x1dec12[_0x3e0741]['id']);}}}return _0x39a811;};exports[_0x6011('0x6a')]=function(_0x3714aa){var _0x20ceac=moment()[_0x6011('0x6b')](0x0);var _0x2efa4b=moment(_0x3714aa)[_0x6011('0x6b')](0x0);return _0x20ceac['diff'](_0x2efa4b,'seconds');};exports['createBody']=function(_0x72343a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x72343a['ContactId'],'ListId':_0x72343a[_0x6011('0x5a')],'VoiceQueueId':_0x72343a[_0x6011('0x5b')]||undefined,'CampaignId':_0x72343a[_0x6011('0x6c')]||undefined};};exports['filterKey']=function(_0x210d62){if(_0x210d62==='uniqueid'||_0x210d62===_0x6011('0x6d')||_0x210d62===_0x6011('0x67')||_0x210d62===_0x6011('0x6e')||_0x210d62===_0x6011('0x6f')||_0x210d62===_0x6011('0x70')||_0x210d62===_0x6011('0x40')||_0x210d62==='channelAgent'||_0x210d62===_0x6011('0x1a')||_0x210d62===_0x6011('0x57')||_0x210d62===_0x6011('0x1b')||_0x210d62===_0x6011('0x71')||_0x210d62==='countbusyretry'||_0x210d62==='countcongestionretry'||_0x210d62===_0x6011('0x50')||_0x210d62===_0x6011('0x72')||_0x210d62===_0x6011('0x73')||_0x210d62===_0x6011('0x74')||_0x210d62===_0x6011('0x75')||_0x210d62===_0x6011('0x76')||_0x210d62===_0x6011('0x1c')||_0x210d62===_0x6011('0x5a')||_0x210d62===_0x6011('0x41')||_0x210d62===_0x6011('0x5b')||_0x210d62===_0x6011('0x77')||_0x210d62===_0x6011('0x78')||_0x210d62==='xmd-queue'||_0x210d62==='xmd-phone'||_0x210d62==='xmd-listid'||_0x210d62===_0x6011('0x79')||_0x210d62==='xmd-dialtimeout'||_0x210d62===_0x6011('0x7a')||_0x210d62===_0x6011('0x7b')||_0x210d62===_0x6011('0x7c')||_0x210d62===_0x6011('0x7d')||_0x210d62==='xmd-cdrtype'||_0x210d62==='xmd-callerid'||_0x210d62===_0x6011('0x7e')||_0x210d62==='xmd-agi'||_0x210d62===_0x6011('0x7f')||_0x210d62===_0x6011('0x80')||_0x210d62===_0x6011('0x81')||_0x210d62==='rtpaudioqosjitterbridged'||_0x210d62===_0x6011('0x82')||_0x210d62==='rtpaudioqoslossbridged'||_0x210d62===_0x6011('0x83')||_0x210d62===_0x6011('0x84')||_0x210d62===_0x6011('0x7f')||_0x210d62===_0x6011('0x80')||_0x210d62===_0x6011('0x81')||_0x210d62===_0x6011('0x85')||_0x210d62===_0x6011('0x82')||_0x210d62===_0x6011('0x86')||_0x210d62==='rtpaudioqosrtt'||_0x210d62===_0x6011('0x84')||_0x210d62===_0x6011('0x87')||_0x210d62==='bridgepvtcallid'||_0x210d62===_0x6011('0x38')||_0x210d62==='statedesc'){return![];}return!![];};exports[_0x6011('0x88')]=function(_0x3abe4d,_0x579755){var _0x2a3c8f,_0x3f55a7,_0x19e695;if(_0x579755<=0x0){_0x579755=0x1;}_0x2a3c8f=new RegExp(_0x6011('0x89')+_0x579755+'}$');_0x3f55a7=Math['pow'](0xa,_0x579755-0x1);_0x19e695=Math[_0x6011('0x8a')](0xa,_0x579755)-0x1;return util[_0x6011('0x12')]('%s',_[_0x6011('0x8b')](_0x3abe4d,_0x2a3c8f,_[_0x6011('0x8c')](_0x3f55a7,_0x19e695)));};exports[_0x6011('0x8d')]=function(_0xc3752d){var _0x1bff48=_0xc3752d['match'](/"(.*?)"/);return _0x1bff48?_0x1bff48[0x1]:_0xc3752d;};exports['extractCalleridNumber']=function(_0x2acd95){var _0x13dbe9=_0x2acd95['match'](/<(.*?)>/);return _0x13dbe9?_0x13dbe9[0x1]:_0x2acd95;};function buildNoAnswerEventPayload(_0x30516f,_0x2882f4){var _0x46ca29=buildObj(_0x30516f,_0x6011('0x8e'));if(!_[_0x6011('0x11')](_0x2882f4[_0x6011('0x8f')])){Object[_0x6011('0x90')](_0x2882f4['variables'])[_0x6011('0x91')](function(_0x28eadd){_0x46ca29[_0x28eadd['toLowerCase']()]=_0x2882f4[_0x6011('0x8f')][_0x28eadd];});}return _0x46ca29;}exports[_0x6011('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xbf38=['hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','countbusyretry','countcongestionretry','countglobal','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','statedesc','getCallerIdRandom','\x5cw{0,','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','util','moment','../../../../config/logger','preview','env','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>','isActive','isNil','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xbf38,0x108));var _0x8bf3=function(_0x4bb722,_0x1db86e){_0x4bb722=_0x4bb722-0x0;var _0x407977=_0xbf38[_0x4bb722];return _0x407977;};'use strict';var util=require(_0x8bf3('0x0'));var _=require('lodash');var moment=require(_0x8bf3('0x1'));var logger=require(_0x8bf3('0x2'))(_0x8bf3('0x3'));var ipAgi=process[_0x8bf3('0x4')][_0x8bf3('0x5')]||_0x8bf3('0x6');var utils=require(_0x8bf3('0x7'));exports[_0x8bf3('0x8')]=function(_0x3f63b8){return function(_0x2fc700){logger['error'](_0x3f63b8,util['inspect'](_0x2fc700,{'showHidden':![],'depth':null}));};};exports[_0x8bf3('0x9')]=function(_0x2e5ec6,_0x5f522e){logger[_0x8bf3('0xa')](_0x2e5ec6,util[_0x8bf3('0xb')](_0x5f522e,{'showHidden':![],'depth':null}));};exports[_0x8bf3('0xc')]=function(_0x42fd32,_0x450867){logger[_0x8bf3('0xd')](_0x42fd32,util[_0x8bf3('0xb')](_0x450867,{'showHidden':![],'depth':null}));};exports[_0x8bf3('0xe')]=function(_0x29f3f2){return function(_0x24bfb4){logger['info'](_0x29f3f2,util[_0x8bf3('0xb')](_0x24bfb4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3e24aa,_0x29eed8,_0x6763a1){return{'message':_0x3e24aa,'unlock':_0x29eed8,'active':_0x6763a1};};exports[_0x8bf3('0xf')]=function(_0x25746d,_0x48bb0e,_0x157038){if(!_['isUndefined'](_0x157038)&&_0x8bf3('0x10')===typeof _0x157038&&!_[_0x8bf3('0x11')](_0x157038)){if(!_[_0x8bf3('0x12')](_0x48bb0e)&&_0x8bf3('0x10')===typeof _0x48bb0e&&!_['isEmpty'](_0x48bb0e)){return util[_0x8bf3('0x13')](_0x8bf3('0x14'),_0x48bb0e,_0x157038);}return util[_0x8bf3('0x13')](_0x8bf3('0x14'),_0x157038,_0x157038);}if(!_[_0x8bf3('0x12')](_0x25746d)&&_0x8bf3('0x10')===typeof _0x25746d&&!_['isEmpty'](_0x25746d)){return _0x25746d;}return'\x22\x22\x20<>';};exports[_0x8bf3('0x15')]=function(_0x643c06){if(_[_0x8bf3('0x16')](_0x643c06)){return![];}return _0x643c06;};exports['addVariables']=function(_0xe41af9,_0x158e43,_0x44cc7a,_0x4e5e11,_0x297ef0,_0x2250a0){var _0x10dd69={'XMD-QUEUE':_0x158e43['Queue']?_0x158e43[_0x8bf3('0x17')]['name']:'','XMD-CALLERID':_0x4e5e11,'XMD-CALLERID-PREVIEW':_0x2250a0?util[_0x8bf3('0x13')](_0x8bf3('0x14'),_0x2250a0[_0x8bf3('0x18')],_0x2250a0[_0x8bf3('0x19')]):_0x4e5e11,'XMD-DIALID':_0x297ef0,'XMD-CONTACTID':_0x158e43[_0x8bf3('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4e5e11,'XMD-VOICEQUEUEID':_0x158e43[_0x8bf3('0x1b')],'XMD-DIALCHANNEL':_0x44cc7a,'XMD-DIALTIMEOUT':_0xe41af9[_0x8bf3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x8bf3('0x13')](_0x8bf3('0x1d'),_0xe41af9['dialQueueProject2']?'g':'',_[_0x8bf3('0x11')](_0xe41af9[_0x8bf3('0x1e')])?'':_0x8bf3('0x1f')),'XMD-DIALURL':_0xe41af9['dialPreviewUrl']||'','XMD-AGI':_0xe41af9[_0x8bf3('0x20')]?util[_0x8bf3('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xe41af9[_0x8bf3('0x20')]):_0x8bf3('0x21'),'XMD-AGIAFTER':_0xe41af9['dialQueueProject2']?util[_0x8bf3('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xe41af9['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2250a0?_0x2250a0[_0x8bf3('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2250a0?_0x2250a0[_0x8bf3('0x23')]:'','XMD-DESTINATION':_0x8bf3('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0xe41af9['monitor_format'])){_0x10dd69[util[_0x8bf3('0x13')]('%s',_0x8bf3('0x25'))]=_0xe41af9['monitor_format'];_0x10dd69[util[_0x8bf3('0x13')]('%s',_0x8bf3('0x26'))]=_0x297ef0;}if(_0x158e43&&_0x158e43['Contact']){for(var _0x1ae8b5 in _0x158e43['Contact']){if(_0x158e43[_0x8bf3('0x27')][_0x8bf3('0x28')](_0x1ae8b5)){if(!_['isNil'](_0x158e43[_0x8bf3('0x27')][_0x1ae8b5])&&_0x1ae8b5!=='id'&&_0x1ae8b5!==_0x8bf3('0x29')&&_0x1ae8b5!==_0x8bf3('0x2a')&&_0x1ae8b5!==_0x8bf3('0x2b')){_0x10dd69[util[_0x8bf3('0x13')](_0x8bf3('0x2c'),_0x8bf3('0x2d'),_[_0x8bf3('0x2e')](_0x1ae8b5))]=_0x158e43['Contact'][_0x1ae8b5];}}}}return _0x10dd69;};exports[_0x8bf3('0x2f')]=function(_0xc30005){var _0x549c0e={};for(var _0x2dc19a in _0xc30005){if(_0xc30005[_0x8bf3('0x28')](_0x2dc19a)){_0x549c0e[util[_0x8bf3('0x13')]('%s',_[_0x8bf3('0x30')](_0x2dc19a))]=_0xc30005[_0x2dc19a];}}return{'variables':_0x549c0e};};exports[_0x8bf3('0x31')]=function(_0x428d56,_0x399d85){if(!_['isNil'](_0x428d56)){if(_0x428d56[_0x8bf3('0x28')]('originated')){if(_0x428d56[_0x8bf3('0x32')]>0x0){_0x428d56['originated']-=0x1;}else{logger['error'](_0x8bf3('0x33'),_0x399d85);}}}else{logger[_0x8bf3('0xd')](_0x8bf3('0x34'),_0x399d85);}};exports[_0x8bf3('0x35')]=function(_0x400d39){var _0x1606d0=moment()['format'](_0x8bf3('0x36'));_0x400d39[_0x8bf3('0x37')]=0xd;_0x400d39['statedesc']=_0x8bf3('0x38');_0x400d39[_0x8bf3('0x39')]=_0x1606d0;_0x400d39[_0x8bf3('0x3a')]=_0x1606d0;_0x400d39[_0x8bf3('0x3b')]=_0x1606d0;};exports[_0x8bf3('0x3c')]=function(_0x374379,_0x2b32be,_0x69b009){var _0x37b9da=moment()[_0x8bf3('0x13')](_0x8bf3('0x36'));_0x374379[_0x8bf3('0x37')]=_0x2b32be;_0x374379['statedesc']=_0x69b009;_0x374379[_0x8bf3('0x3a')]=_0x37b9da;_0x374379[_0x8bf3('0x3d')]=utils[_0x8bf3('0x3e')](_0x374379[_0x8bf3('0x3a')],_0x374379[_0x8bf3('0x39')]);};exports[_0x8bf3('0x3f')]=function(_0x5b9f4b,_0x40cf29,_0x449e33){_0x5b9f4b[_0x8bf3('0x40')]=_0x40cf29;_0x5b9f4b['UserId']=_0x449e33;};exports[_0x8bf3('0x41')]=function(_0x20d318,_0x21488a,_0x4980f9){var _0x52fa80=moment()[_0x8bf3('0x13')](_0x8bf3('0x36'));_0x20d318[_0x8bf3('0x37')]=_0x21488a;_0x20d318['statedesc']=_0x4980f9;_0x20d318[_0x8bf3('0x3a')]=_0x20d318['responsetime']?_0x20d318[_0x8bf3('0x3a')]:_0x52fa80;_0x20d318[_0x8bf3('0x3b')]=_0x20d318[_0x8bf3('0x3b')]?_0x20d318[_0x8bf3('0x3b')]:_0x52fa80;_0x20d318[_0x8bf3('0x3d')]=utils[_0x8bf3('0x3e')](_0x20d318['responsetime']||0x0,_0x20d318[_0x8bf3('0x39')]||0x0);_0x20d318[_0x8bf3('0x42')]=_0x20d318[_0x8bf3('0x43')]?utils[_0x8bf3('0x3e')](_0x20d318['endtime'],_0x20d318[_0x8bf3('0x43')]):0x0;};exports[_0x8bf3('0x44')]=function(_0x18ee2c){return _0x18ee2c===_0x8bf3('0x45');};exports[_0x8bf3('0x46')]=function(_0x1f2c23,_0x4cc6e6,_0x1fd57b,_0x12a16f,_0x5a860e){var _0x57c239=_0x12a16f?_0x8bf3('0x47'):_0x1f2c23['calleridname'];_0x57c239=_0x5a860e?_0x8bf3('0x48'):_0x57c239;return{'actionid':_0x1f2c23[_0x8bf3('0x49')],'action':'originate','channel':_0x1f2c23[_0x8bf3('0x4a')],'callerid':util[_0x8bf3('0x13')](_0x8bf3('0x14'),_0x57c239,_0x1f2c23[_0x8bf3('0x19')]),'Exten':_0x8bf3('0x24'),'Context':_0x8bf3('0x4b'),'Priority':'1','variable':_0x1fd57b,'timeout':(_0x4cc6e6[_0x8bf3('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f2c23[_0x8bf3('0x49')]};};exports[_0x8bf3('0x4d')]=function(_0x2db820){return _0x2db820['countbusyretry']+_0x2db820['countcongestionretry']+_0x2db820[_0x8bf3('0x4e')]+_0x2db820[_0x8bf3('0x4f')]+_0x2db820['countnosuchnumberretry'];};exports['cloneAction']=function(_0x73cafc){var _0x39f6ea=_['clone'](_0x73cafc);_0x39f6ea[_0x8bf3('0x37')]=0xf;_0x39f6ea['statedesc']='Global';return _0x39f6ea;};exports[_0x8bf3('0x50')]=function(_0x3bba2d,_0x2c8a8d,_0x150e39){var _0x594f05={};_0x594f05[_0x2c8a8d]=_0x3bba2d[_0x2c8a8d];_0x594f05[_0x8bf3('0x51')]=![];_0x594f05[_0x8bf3('0x52')]=moment()[_0x8bf3('0x53')](_0x150e39,'minutes')[_0x8bf3('0x13')](_0x8bf3('0x36'));_0x594f05[_0x8bf3('0x1a')]=_0x3bba2d[_0x8bf3('0x1a')];_0x594f05[_0x8bf3('0x54')]=_0x3bba2d[_0x8bf3('0x54')];_0x594f05[_0x8bf3('0x1b')]=_0x3bba2d['VoiceQueueId']||undefined;return _0x594f05;};exports[_0x8bf3('0x55')]=function(_0x1bbea0,_0x41f679){if(!_[_0x8bf3('0x16')](_0x1bbea0)){if(_0x1bbea0[_0x8bf3('0x56')]>0x0){_0x1bbea0[_0x8bf3('0x56')]-=0x1;}else{logger[_0x8bf3('0xd')](_0x41f679,_0x8bf3('0x57'));}}else{logger[_0x8bf3('0xd')](_0x41f679,_0x8bf3('0x58'));}};exports['IsNotLoggedIn']=function(_0x15a626){if(_0x15a626<=0x0){return!![];}return![];};function buildObj(_0x5cd693,_0x3156f8,_0x278e9a){_0x5cd693[_0x8bf3('0x59')]=_0x3156f8;_0x5cd693[_0x8bf3('0x5a')]=_0x5cd693[_0x8bf3('0x5b')];_0x5cd693['interface']=_0x5cd693[_0x8bf3('0x4a')];_0x5cd693['motionChannel']=_0x8bf3('0x5c');if(_0x278e9a){_0x5cd693['mandatoryDisposition']=_0x278e9a[_0x8bf3('0x5d')];}return _0x5cd693;}exports[_0x8bf3('0x5e')]=buildObj;exports[_0x8bf3('0x5f')]=function(_0x58d814){var _0x1c7659={};_0x1c7659['queue']=_0x58d814[_0x8bf3('0x5b')];_0x1c7659[_0x8bf3('0x60')]=_0x58d814[_0x8bf3('0x4a')];_0x1c7659[_0x8bf3('0x49')]=_0x58d814[_0x8bf3('0x49')];return _0x1c7659;};exports[_0x8bf3('0x61')]=function(_0x4ebf5c){var _0x418c75=[];for(var _0x49bdc3 in _0x4ebf5c){if(_0x4ebf5c[_0x8bf3('0x28')](_0x49bdc3)){if(!_['isNil'](_0x4ebf5c[_0x49bdc3])&&_0x4ebf5c[_0x49bdc3][_0x8bf3('0x37')]==='not_inuse'&&_0x4ebf5c[_0x49bdc3][_0x8bf3('0x62')]===_0x8bf3('0x63')){_0x418c75[_0x8bf3('0x64')](_0x4ebf5c[_0x49bdc3]['id']);}}}return _0x418c75;};exports[_0x8bf3('0x65')]=function(_0x69d7f4){var _0x27c617=moment()['milliseconds'](0x0);var _0x23ff7f=moment(_0x69d7f4)[_0x8bf3('0x66')](0x0);return _0x27c617[_0x8bf3('0x67')](_0x23ff7f,_0x8bf3('0x68'));};exports['createBody']=function(_0x266049){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x266049[_0x8bf3('0x1a')],'ListId':_0x266049['ListId'],'VoiceQueueId':_0x266049[_0x8bf3('0x1b')]||undefined,'CampaignId':_0x266049[_0x8bf3('0x69')]||undefined};};exports[_0x8bf3('0x6a')]=function(_0x12de6a){if(_0x12de6a===_0x8bf3('0x49')||_0x12de6a==='idContact'||_0x12de6a===_0x8bf3('0x5b')||_0x12de6a===_0x8bf3('0x6b')||_0x12de6a===_0x8bf3('0x6c')||_0x12de6a===_0x8bf3('0x6d')||_0x12de6a===_0x8bf3('0x40')||_0x12de6a===_0x8bf3('0x4a')||_0x12de6a===_0x8bf3('0x18')||_0x12de6a==='active'||_0x12de6a===_0x8bf3('0x19')||_0x12de6a==='scheduledat'||_0x12de6a===_0x8bf3('0x6e')||_0x12de6a===_0x8bf3('0x6f')||_0x12de6a==='countnoanswerretry'||_0x12de6a===_0x8bf3('0x70')||_0x12de6a==='callback'||_0x12de6a===_0x8bf3('0x71')||_0x12de6a===_0x8bf3('0x72')||_0x12de6a===_0x8bf3('0x73')||_0x12de6a===_0x8bf3('0x1a')||_0x12de6a===_0x8bf3('0x54')||_0x12de6a===_0x8bf3('0x74')||_0x12de6a===_0x8bf3('0x1b')||_0x12de6a===_0x8bf3('0x75')||_0x12de6a===_0x8bf3('0x76')||_0x12de6a===_0x8bf3('0x77')||_0x12de6a===_0x8bf3('0x78')||_0x12de6a===_0x8bf3('0x79')||_0x12de6a===_0x8bf3('0x7a')||_0x12de6a===_0x8bf3('0x7b')||_0x12de6a==='xmd-dialoptions'||_0x12de6a===_0x8bf3('0x7c')||_0x12de6a===_0x8bf3('0x7d')||_0x12de6a===_0x8bf3('0x7e')||_0x12de6a===_0x8bf3('0x7f')||_0x12de6a===_0x8bf3('0x80')||_0x12de6a===_0x8bf3('0x81')||_0x12de6a===_0x8bf3('0x82')||_0x12de6a===_0x8bf3('0x83')||_0x12de6a===_0x8bf3('0x84')||_0x12de6a===_0x8bf3('0x85')||_0x12de6a===_0x8bf3('0x86')||_0x12de6a===_0x8bf3('0x87')||_0x12de6a===_0x8bf3('0x88')||_0x12de6a===_0x8bf3('0x89')||_0x12de6a===_0x8bf3('0x8a')||_0x12de6a===_0x8bf3('0x83')||_0x12de6a==='rtpaudioqosbridged'||_0x12de6a===_0x8bf3('0x85')||_0x12de6a===_0x8bf3('0x86')||_0x12de6a===_0x8bf3('0x87')||_0x12de6a==='rtpaudioqoslossbridged'||_0x12de6a===_0x8bf3('0x89')||_0x12de6a===_0x8bf3('0x8a')||_0x12de6a===_0x8bf3('0x8b')||_0x12de6a===_0x8bf3('0x8c')||_0x12de6a===_0x8bf3('0x37')||_0x12de6a===_0x8bf3('0x8d')){return![];}return!![];};exports[_0x8bf3('0x8e')]=function(_0x2dbf27,_0x38ab98){var _0x2b3ea6,_0x28d8ad,_0x4be3a4;if(_0x38ab98<=0x0){_0x38ab98=0x1;}_0x2b3ea6=new RegExp(_0x8bf3('0x8f')+_0x38ab98+'}$');_0x28d8ad=Math['pow'](0xa,_0x38ab98-0x1);_0x4be3a4=Math['pow'](0xa,_0x38ab98)-0x1;return util['format']('%s',_['replace'](_0x2dbf27,_0x2b3ea6,_[_0x8bf3('0x90')](_0x28d8ad,_0x4be3a4)));};exports[_0x8bf3('0x91')]=function(_0x35e771){var _0x3c4c66=_0x35e771[_0x8bf3('0x92')](/"(.*?)"/);return _0x3c4c66?_0x3c4c66[0x1]:_0x35e771;};exports[_0x8bf3('0x93')]=function(_0x4454f0){var _0x22df35=_0x4454f0[_0x8bf3('0x92')](/<(.*?)>/);return _0x22df35?_0x22df35[0x1]:_0x4454f0;};function buildNoAnswerEventPayload(_0x29b4a0,_0x165692){var _0x2e10ec=buildObj(_0x29b4a0,_0x8bf3('0x94'));if(!_['isEmpty'](_0x165692[_0x8bf3('0x95')])){Object[_0x8bf3('0x96')](_0x165692['variables'])[_0x8bf3('0x97')](function(_0x19da14){_0x2e10ec[_0x19da14['toLowerCase']()]=_0x165692[_0x8bf3('0x95')][_0x19da14];});}return _0x2e10ec;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 36ab947..2efb897 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 _0x62c8=['number','boolean','queueremove','string','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x39947f,_0x5787a6){var _0x415d92=function(_0x148fcd){while(--_0x148fcd){_0x39947f['push'](_0x39947f['shift']());}};_0x415d92(++_0x5787a6);}(_0x62c8,0x153));var _0x862c=function(_0x139893,_0x170faa){_0x139893=_0x139893-0x0;var _0xa4885b=_0x62c8[_0x139893];return _0xa4885b;};'use strict';exports[_0x862c('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x862c('0x1'),'required':![]},'paused':{'type':_0x862c('0x2'),'required':![]}};exports[_0x862c('0x3')]={'queue':{'type':_0x862c('0x4'),'required':!![]},'interface':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x862c('0x2')},'reason':{'type':'string','required':![]}};exports[_0x862c('0x6')]={'module':{'type':_0x862c('0x4'),'required':![]}};exports[_0x862c('0x7')]={'uniqueid':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x862c('0x4')},'format':{'type':_0x862c('0x4')},'mixmonitorid':{'type':_0x862c('0x4')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x862c('0x4'),'required':!![]}};exports[_0x862c('0x9')]={'uniqueid':{'type':_0x862c('0x4'),'required':!![]},'exten':{'type':_0x862c('0x4'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x91ca=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x39d317,_0x1b4898){var _0x23ada5=function(_0x2287ee){while(--_0x2287ee){_0x39d317['push'](_0x39d317['shift']());}};_0x23ada5(++_0x1b4898);}(_0x91ca,0xa7));var _0xa91c=function(_0x2890af,_0xf87541){_0x2890af=_0x2890af-0x0;var _0x4e8077=_0x91ca[_0x2890af];return _0x4e8077;};'use strict';exports['queueadd']={'queue':{'type':_0xa91c('0x0'),'required':!![]},'interface':{'type':_0xa91c('0x0'),'required':!![]},'membername':{'type':_0xa91c('0x0'),'required':!![]},'penalty':{'type':_0xa91c('0x1'),'required':![]},'paused':{'type':_0xa91c('0x2'),'required':![]}};exports[_0xa91c('0x3')]={'queue':{'type':_0xa91c('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa91c('0x4')]={'interface':{'type':_0xa91c('0x0'),'required':!![]},'paused':{'type':_0xa91c('0x2')},'reason':{'type':'string','required':![]}};exports[_0xa91c('0x5')]={'module':{'type':_0xa91c('0x0'),'required':![]}};exports[_0xa91c('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa91c('0x7')]={'uniqueid':{'type':_0xa91c('0x0'),'required':!![]},'filename':{'type':_0xa91c('0x0')},'format':{'type':_0xa91c('0x0')},'mixmonitorid':{'type':_0xa91c('0x0')}};exports[_0xa91c('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa91c('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xa91c('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5421c18..bb7e691 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x2b8474,_0x290408){var _0x4bcfad=function(_0x448832){while(--_0x448832){_0x2b8474['push'](_0x2b8474['shift']());}};_0x4bcfad(++_0x290408);}(_0xadb5,0xad));var _0x5adb=function(_0x15cbcb,_0x33fc3d){_0x15cbcb=_0x15cbcb-0x0;var _0x565622=_0xadb5[_0x15cbcb];return _0x565622;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x131d77,_0x5e284a){_0x131d77=_0x131d77-0x0;var _0x12ab18=_0x2032[_0x131d77];return _0x12ab18;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e787288..63b2614 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 _0xb174=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x3b3007,_0x4c455a){var _0x45e5fa=function(_0xe9a1e5){while(--_0xe9a1e5){_0x3b3007['push'](_0x3b3007['shift']());}};_0x45e5fa(++_0x4c455a);}(_0xb174,0x1b8));var _0x4b17=function(_0x525fb5,_0x564b51){_0x525fb5=_0x525fb5-0x0;var _0xa92b01=_0xb174[_0x525fb5];return _0xa92b01;};'use strict';function mergeDBDataToRealtime(_0x2897ea,_0x4684c3){var _0x19afad=Object[_0x4b17('0x0')]({},_0x2897ea);for(var _0x20f894 in _0x4684c3){if(_0x19afad[_0x4b17('0x1')](_0x20f894)){_0x19afad[_0x20f894]=_0x4684c3[_0x20f894];}}return _0x19afad;}exports[_0x4b17('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x27b4=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0xe020b,_0x4a93d1){var _0x18ff72=function(_0x4150ac){while(--_0x4150ac){_0xe020b['push'](_0xe020b['shift']());}};_0x18ff72(++_0x4a93d1);}(_0x27b4,0xbc));var _0x427b=function(_0x4ee0f7,_0x1d8e65){_0x4ee0f7=_0x4ee0f7-0x0;var _0x1cd101=_0x27b4[_0x4ee0f7];return _0x1cd101;};'use strict';function mergeDBDataToRealtime(_0x315d01,_0xd51abc){var _0x540a41=Object[_0x427b('0x0')]({},_0x315d01);for(var _0x434ea2 in _0xd51abc){if(_0x540a41[_0x427b('0x1')](_0x434ea2)){_0x540a41[_0x434ea2]=_0xd51abc[_0x434ea2];}}return _0x540a41;}exports[_0x427b('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f3f8bd6..187e561 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 _0x84a9=['forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','split','internal','destination','exten','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','getCallType','UserId','monitor','monitorFilename','filename','monitors','connectedlinename','membername','xcally-motion-dialer'];(function(_0x3e9f00,_0x50e9e6){var _0x14afb4=function(_0x4f5126){while(--_0x4f5126){_0x3e9f00['push'](_0x3e9f00['shift']());}};_0x14afb4(++_0x50e9e6);}(_0x84a9,0x119));var _0x984a=function(_0x95d36,_0x339cbd){_0x95d36=_0x95d36-0x0;var _0x324f84=_0x84a9[_0x95d36];return _0x324f84;};'use strict';var _=require(_0x984a('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x984a('0x1'));var ami=require(_0x984a('0x2'));var RpcVoiceAgentReport=require(_0x984a('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x984a('0x4'));var RpcMemberReport=require(_0x984a('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x984a('0x6'));var VoiceCallReport=require(_0x984a('0x7'));var VoiceAgentReport=require(_0x984a('0x8'));var VoiceDialReport=require(_0x984a('0x9'));var UserReport=require('./userReport');function Report(_0x7ff41f){this[_0x984a('0xa')]=_0x7ff41f;this[_0x984a('0xb')]=_0x7ff41f['agents'];this['telephones']=_0x7ff41f[_0x984a('0xc')];}Report[_0x984a('0xd')][_0x984a('0xe')]=function(_0x204794){var _0x5b0d34=new VoiceQueueReport(this[_0x984a('0xa')]);var _0x52e111=new VoiceAgentReport(this[_0x984a('0xa')]);var _0x1acf02=new VoiceDialReport(this['realtime']);var _0xeedaf1=new VoiceCallReport(this[_0x984a('0xa')]);var _0x268e8a=new UserReport(this[_0x984a('0xa')]);if(config[_0x984a('0xf')]&&config[_0x984a('0xf')][_0x984a('0x10')]){ami['on'](_0x984a('0x11'),this[_0x984a('0x12')]['bind'](this));ami['on'](_0x984a('0x13'),this[_0x984a('0x14')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x984a('0x15')][_0x984a('0x16')](this));ami['on'](_0x984a('0x17'),this[_0x984a('0x18')][_0x984a('0x16')](this));ami['on'](_0x984a('0x19'),this[_0x984a('0x1a')][_0x984a('0x16')](this));ami['on'](_0x984a('0x1b'),this['attendedTransfer'][_0x984a('0x16')](this));}};Report[_0x984a('0xd')][_0x984a('0x1c')]=function(_0x592004){var _0xaa195a;_0xaa195a=_[_0x984a('0x1d')](this[_0x984a('0xb')],function(_0x2f9a92){return _0x2f9a92[_0x984a('0x1e')]==_0x592004||_0x2f9a92[_0x984a('0x1f')]==_0x592004;});if(_[_0x984a('0x20')](_0xaa195a)){var _0x34b7b7=_[_0x984a('0x1d')](this['telephones'],function(_0x74bd1d){return _0x74bd1d[_0x984a('0x1e')]==_0x592004||_0x74bd1d['name']==_0x592004;});if(_0x34b7b7){_0xaa195a=_[_0x984a('0x1d')](this[_0x984a('0xb')],function(_0x492bb1){return _0x492bb1[_0x984a('0x21')]==util[_0x984a('0x22')]('SIP/%s',_0x34b7b7[_0x984a('0x1f')]);});}}return _0xaa195a;};Report[_0x984a('0xd')][_0x984a('0x12')]=function(_0x4c3c8){for(var _0x523893=0x0;_0x523893<_0x4c3c8[_0x984a('0x23')];_0x523893+=0x1){var _0xef002f=this[_0x984a('0x1c')](_0x4c3c8[_0x523893]['connectedlinenum']);if(_0xef002f){_0x4c3c8[_0x523893][_0x984a('0x1e')]=_0xef002f[_0x984a('0x1e')];_0x4c3c8[_0x523893][_0x984a('0x24')]=!![];_0x4c3c8[_0x523893][_0x984a('0x25')]=_0xef002f[_0x984a('0x1f')];_0x4c3c8[_0x523893]['interface']=_[_0x984a('0x20')](_0xef002f[_0x984a('0x21')])?util[_0x984a('0x22')](_0x984a('0x26'),_0xef002f[_0x984a('0x1f')]):_0xef002f['interface'];if(_0x4c3c8[_0x523893]['queuecallercomplete']){_0x4c3c8[_0x523893][_0x984a('0x27')]=moment()['format'](_0x984a('0x28'));}if(_0x4c3c8[_0x523893][_0x984a('0x29')]){_0x4c3c8[_0x523893][_0x984a('0x2a')]=moment()[_0x984a('0x22')](_0x984a('0x28'));}RpcMemberReport[_0x984a('0x12')](_0x4c3c8[_0x523893]);}RpcVoiceQueueReport[_0x984a('0x2b')](_0x4c3c8[_0x523893]);}};function extractCalleridNumber(_0x4fd4e9){var _0x351b7a=_0x4fd4e9['match'](/<(.*?)>/);return _0x351b7a?_0x351b7a[0x1]:_0x4fd4e9;}Report[_0x984a('0xd')][_0x984a('0x2c')]=function(_0x4cab76){for(var _0x3cdfa9=0x0;_0x3cdfa9','transfers','linkedid','transfereelinkedid','uniqueid','UserId','split','membername','monitors','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','phone','transfererlinkedid','lodash','util'];(function(_0x56da10,_0x130646){var _0x16ac5a=function(_0x2b1a76){while(--_0x2b1a76){_0x56da10['push'](_0x56da10['shift']());}};_0x16ac5a(++_0x130646);}(_0xc1a2,0x1c0));var _0x2c1a=function(_0x34a8e1,_0x1d2f75){_0x34a8e1=_0x34a8e1-0x0;var _0xaa7aec=_0xc1a2[_0x34a8e1];return _0xaa7aec;};'use strict';var _=require(_0x2c1a('0x0'));var moment=require('moment');var util=require(_0x2c1a('0x1'));var config=require('../../../config/environment');var ami=require(_0x2c1a('0x2'));var RpcVoiceAgentReport=require(_0x2c1a('0x3'));var RpcVoiceCallReport=require(_0x2c1a('0x4'));var RpcVoiceDialReport=require(_0x2c1a('0x5'));var RpcMemberReport=require(_0x2c1a('0x6'));var RpcVoiceQueueReport=require(_0x2c1a('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x2c1a('0x8'));var VoiceQueueReport=require(_0x2c1a('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2c1a('0xa'));var VoiceDialReport=require(_0x2c1a('0xb'));var UserReport=require(_0x2c1a('0xc'));function Report(_0x57a2ee){this[_0x2c1a('0xd')]=_0x57a2ee;this['agents']=_0x57a2ee[_0x2c1a('0xe')];this[_0x2c1a('0xf')]=_0x57a2ee[_0x2c1a('0xf')];}Report[_0x2c1a('0x10')]['sync']=function(_0x41acc8){var _0x507d0d=new VoiceQueueReport(this[_0x2c1a('0xd')]);var _0x4b4aca=new VoiceAgentReport(this[_0x2c1a('0xd')]);var _0x2919f8=new VoiceDialReport(this['realtime']);var _0x5ca09b=new VoiceCallReport(this[_0x2c1a('0xd')]);var _0x453cf6=new UserReport(this[_0x2c1a('0xd')]);if(config[_0x2c1a('0x11')]&&config['xdr'][_0x2c1a('0x12')]){ami['on'](_0x2c1a('0x13'),this[_0x2c1a('0x14')][_0x2c1a('0x15')](this));ami['on'](_0x2c1a('0x16'),this[_0x2c1a('0x17')][_0x2c1a('0x15')](this));ami['on'](_0x2c1a('0x18'),this[_0x2c1a('0x19')][_0x2c1a('0x15')](this));ami['on'](_0x2c1a('0x1a'),this[_0x2c1a('0x1b')][_0x2c1a('0x15')](this));ami['on'](_0x2c1a('0x1c'),this[_0x2c1a('0x1d')][_0x2c1a('0x15')](this));ami['on']('attendedtransfer',this[_0x2c1a('0x1e')][_0x2c1a('0x15')](this));}};Report['prototype'][_0x2c1a('0x1f')]=function(_0x428720){var _0x1374c3;_0x1374c3=_[_0x2c1a('0x20')](this[_0x2c1a('0xe')],function(_0x576449){return _0x576449[_0x2c1a('0x21')]==_0x428720||_0x576449[_0x2c1a('0x22')]==_0x428720;});if(_['isNil'](_0x1374c3)){var _0x5bf34b=_['find'](this['telephones'],function(_0x2709d4){return _0x2709d4[_0x2c1a('0x21')]==_0x428720||_0x2709d4['name']==_0x428720;});if(_0x5bf34b){_0x1374c3=_[_0x2c1a('0x20')](this[_0x2c1a('0xe')],function(_0x4f32d3){return _0x4f32d3[_0x2c1a('0x23')]==util['format']('SIP/%s',_0x5bf34b['name']);});}}return _0x1374c3;};Report[_0x2c1a('0x10')][_0x2c1a('0x14')]=function(_0x441f88){for(var _0x8aeb96=0x0;_0x8aeb96<_0x441f88[_0x2c1a('0x24')];_0x8aeb96+=0x1){var _0x50873e=this['findAgent'](_0x441f88[_0x8aeb96][_0x2c1a('0x25')]);if(_0x50873e){_0x441f88[_0x8aeb96][_0x2c1a('0x21')]=_0x50873e[_0x2c1a('0x21')];_0x441f88[_0x8aeb96][_0x2c1a('0x26')]=!![];_0x441f88[_0x8aeb96][_0x2c1a('0x27')]=_0x50873e[_0x2c1a('0x22')];_0x441f88[_0x8aeb96][_0x2c1a('0x23')]=_[_0x2c1a('0x28')](_0x50873e[_0x2c1a('0x23')])?util[_0x2c1a('0x29')](_0x2c1a('0x2a'),_0x50873e[_0x2c1a('0x22')]):_0x50873e[_0x2c1a('0x23')];if(_0x441f88[_0x8aeb96]['queuecallercomplete']){_0x441f88[_0x8aeb96][_0x2c1a('0x2b')]=moment()[_0x2c1a('0x29')](_0x2c1a('0x2c'));}if(_0x441f88[_0x8aeb96][_0x2c1a('0x2d')]){_0x441f88[_0x8aeb96][_0x2c1a('0x2e')]=moment()[_0x2c1a('0x29')](_0x2c1a('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x441f88[_0x8aeb96]);}RpcVoiceQueueReport[_0x2c1a('0x2f')](_0x441f88[_0x8aeb96]);}};function extractCalleridNumber(_0x5a5048){var _0x24e1a0=_0x5a5048[_0x2c1a('0x30')](/<(.*?)>/);return _0x24e1a0?_0x24e1a0[0x1]:_0x5a5048;}Report[_0x2c1a('0x10')][_0x2c1a('0x31')]=function(_0x5022b1){for(var _0x93845=0x0;_0x938450x0?!![]:![];if(!_0x50064e){return this[_0xe8fe('0x6e')](this[_0xe8fe('0x49')][_0xe8fe('0x6f')]);}};VoiceQueueReport['prototype'][_0xe8fe('0x1c')]=function(_0x26ae06){var _0x2157d1=this[_0xe8fe('0x49')]['id'];if(this['summary'][_0xe8fe('0x62')][_0x2157d1]&&this[_0xe8fe('0x49')][_0xe8fe('0x62')][_0x2157d1][_0x26ae06['actionid']]){this['summary'][_0xe8fe('0x62')][_0x2157d1][_0x26ae06['actionid']][_0xe8fe('0x13')][_0xe8fe('0x70')](_0x26ae06);}};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueSummary']=function(_0x423108){var _0x3d7c64=this;try{if(this[_0xe8fe('0x71')](_0x423108)&&this['isNotNull'](_0x423108[_0xe8fe('0x52')])){logger[_0xe8fe('0x54')](_0xe8fe('0x72'),util[_0xe8fe('0x46')](_0x423108,{'showHidden':![],'depth':null}));var _0x30005f=this[_0xe8fe('0x15')][_0x423108[_0xe8fe('0x52')]];if(_0x30005f){logger[_0xe8fe('0x54')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x30005f[_0xe8fe('0x5c')]);this['summary']['queues'][_0x30005f[_0xe8fe('0x5c')]]={'summaryEvent':_0x423108};this['summary'][_0xe8fe('0x6d')]+=0x1;return ami[_0xe8fe('0x41')]({'action':_0xe8fe('0x62'),'queue':_0x30005f[_0xe8fe('0x5c')]})['then'](function(_0x2f5a66){if(!_0x3d7c64[_0xe8fe('0x49')]['queuestatus'][_0x423108[_0xe8fe('0x61')]]){_0x3d7c64['summary'][_0xe8fe('0x62')][_0x423108[_0xe8fe('0x61')]]={};}_0x3d7c64[_0xe8fe('0x49')][_0xe8fe('0x62')][_0x423108[_0xe8fe('0x61')]][_0x2f5a66[_0xe8fe('0x61')]]={'queue':_0x30005f[_0xe8fe('0x5c')],'agents':[]};})[_0xe8fe('0x43')](function(_0x2df4d5){throw _0x2df4d5;});}}}catch(_0x57c236){logger[_0xe8fe('0x47')](_0xe8fe('0x63'),util[_0xe8fe('0x46')](_0x57c236,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x6e')]=function(_0x302448){if(this['summary'][_0xe8fe('0x6d')]>0x0){this[_0xe8fe('0x49')][_0xe8fe('0x6f')]=_0x302448;return;}logger['debug'](_0xe8fe('0x73'),util[_0xe8fe('0x46')](_0x302448,{'showHidden':![],'depth':null}));this[_0xe8fe('0x49')]=initializeSummary();ami[_0xe8fe('0x4d')](_0xe8fe('0x74'),{});};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueCallerJoin']=function(_0x4cf91b){try{if(this['isNotNull'](_0x4cf91b)){logger[_0xe8fe('0x54')](_0xe8fe('0x75'),_0x4cf91b[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x4cf91b,{'showHidden':![],'depth':null}));if(_[_0xe8fe('0x5d')](this[_0xe8fe('0x11')][_0x4cf91b['uniqueid']])){this[_0xe8fe('0x11')][_0x4cf91b[_0xe8fe('0x50')]]=[];}if(_['isUndefined'](this['channels'][_0x4cf91b['uniqueid']])){this[_0xe8fe('0x3e')][_0x4cf91b['uniqueid']]={};}var _0x58d632=new QueueReport();_0x58d632[_0xe8fe('0x52')]=_0x4cf91b[_0xe8fe('0x52')];_0x58d632['type']=this['voiceQueues'][_0x58d632[_0xe8fe('0x52')]]&&this[_0xe8fe('0x15')][_0x58d632[_0xe8fe('0x52')]]['type']?this[_0xe8fe('0x15')][_0x58d632[_0xe8fe('0x52')]][_0xe8fe('0x6a')]||'inbound':_0xe8fe('0x5a');_0x58d632[_0xe8fe('0x76')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x58d632['position']=_0x4cf91b[_0xe8fe('0x78')];_0x58d632['count']=_0x4cf91b[_0xe8fe('0x79')];_0x58d632['uniqueid']=_0x4cf91b['uniqueid'];_0x58d632[_0xe8fe('0x7a')]=this[_0xe8fe('0x3e')][_0x4cf91b[_0xe8fe('0x50')]][_0xe8fe('0x7a')];logger[_0xe8fe('0x7b')](_0xe8fe('0x7c'),_0x58d632[_0xe8fe('0x52')],_0x58d632[_0xe8fe('0x6a')]);Object[_0xe8fe('0x68')](_0x58d632,_[_0xe8fe('0x7d')](_0x4cf91b,_[_0xe8fe('0x7e')](_0x58d632)));this['queueReports'][_0x4cf91b['uniqueid']][_0xe8fe('0x70')](_0x58d632);this[_0xe8fe('0x3e')][_0x4cf91b[_0xe8fe('0x50')]]=_0x58d632;this['emitVoiceQueueChannelSave'](_0x58d632,'queuecallerjoin');}}catch(_0x47f976){logger[_0xe8fe('0x47')](_0xe8fe('0x75'),_0x4cf91b[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x47f976,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0x21')]=function(_0x4ccdd7){try{if(this[_0xe8fe('0x71')](_0x4ccdd7)){logger[_0xe8fe('0x54')](_0xe8fe('0x7f'),_0x4ccdd7['uniqueid'],util[_0xe8fe('0x46')](_0x4ccdd7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4ccdd7[_0xe8fe('0x50')]]){var _0x4f3883=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x4ccdd7[_0xe8fe('0x50')]]);_0x4f3883[_0xe8fe('0x3c')]=![];_0x4f3883[_0xe8fe('0x81')]=null;_0x4f3883[_0xe8fe('0x82')]=_0x4ccdd7['holdtime'];_0x4f3883[_0xe8fe('0x83')]=_0x4ccdd7[_0xe8fe('0x83')];_0x4f3883['queuecallerabandon']=!![];_0x4f3883[_0xe8fe('0x84')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x4f3883[_0xe8fe('0x85')]=_0xe8fe('0x86');_0x4f3883[_0xe8fe('0x87')]=null;logger['info'](_0xe8fe('0x88'),_0x4f3883[_0xe8fe('0x52')],_0x4f3883[_0xe8fe('0x6a')]);this[_0xe8fe('0x3e')][_0x4ccdd7['uniqueid']]=_0x4f3883;this[_0xe8fe('0x4b')](_0x4f3883,_0xe8fe('0x20'));}}}catch(_0x1b4f6b){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x4ccdd7['uniqueid'],util['inspect'](_0x1b4f6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')]['syncQueueCallerLeave']=function(_0x5d5c66){try{if(this[_0xe8fe('0x71')](_0x5d5c66)){logger[_0xe8fe('0x54')]('[%s][voiceQueueReport][queuecallerleave]',_0x5d5c66[_0xe8fe('0x50')],util['inspect'](_0x5d5c66,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x5d5c66[_0xe8fe('0x50')]]){var _0x5ef964=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x5d5c66[_0xe8fe('0x50')]]);_0x5ef964[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x5ef964[_0xe8fe('0x8a')]=_0x5d5c66['connectedlinenum'];_0x5ef964['connectedlinename']=_0x5d5c66[_0xe8fe('0x8b')];logger[_0xe8fe('0x7b')](_0xe8fe('0x8c'),_0x5ef964['queue'],_0x5ef964[_0xe8fe('0x6a')],_0x5d5c66[_0xe8fe('0x8a')],_0x5d5c66[_0xe8fe('0x8b')]);this[_0xe8fe('0x3e')][_0x5d5c66[_0xe8fe('0x50')]]=_0x5ef964;this[_0xe8fe('0x8d')](_0x5ef964,_0xe8fe('0x22'));}}}catch(_0x2b272d){logger[_0xe8fe('0x47')](_0xe8fe('0x8e'),_0x5d5c66[_0xe8fe('0x50')],util['inspect'](_0x2b272d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x26')]=function(_0x2b7cb1){try{if(this[_0xe8fe('0x71')](_0x2b7cb1)){logger[_0xe8fe('0x54')](_0xe8fe('0x8f'),_0x2b7cb1[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2b7cb1,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x2b7cb1[_0xe8fe('0x50')]]){var _0x8c3983=_['last'](this['queueReports'][_0x2b7cb1[_0xe8fe('0x50')]]);_0x8c3983[_0xe8fe('0x3c')]=!![];_0x8c3983[_0xe8fe('0x85')]='COMPLETEDBYAGENT';logger[_0xe8fe('0x7b')](_0xe8fe('0x90'),_0x8c3983[_0xe8fe('0x52')],_0x8c3983[_0xe8fe('0x6a')]);}}}catch(_0x2a5fe4){logger['error'](_0xe8fe('0x8f'),_0x2b7cb1[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2a5fe4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe8fe('0x25')]=function(_0x9f1ff9){try{if(this['isNotNull'](_0x9f1ff9)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x9f1ff9['uniqueid'],util[_0xe8fe('0x46')](_0x9f1ff9,{'showHidden':![],'depth':null}));if(this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]]){var _0x8e958c=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]]);_0x8e958c[_0xe8fe('0x20')]=![];_0x8e958c[_0xe8fe('0x84')]=null;_0x8e958c[_0xe8fe('0x91')]=!![];_0x8e958c[_0xe8fe('0x87')]=_0x9f1ff9[_0xe8fe('0x92')];_0x8e958c[_0xe8fe('0x82')]=_0x9f1ff9[_0xe8fe('0x82')];_0x8e958c[_0xe8fe('0x3c')]=!![];_0x8e958c[_0xe8fe('0x3b')]=![];_0x8e958c[_0xe8fe('0x93')]=null;if(!_0x8e958c[_0xe8fe('0x94')]){if(_0x9f1ff9[_0xe8fe('0x95')]==_0xe8fe('0x94')){_0x8e958c[_0xe8fe('0x85')]=_0xe8fe('0x96');logger[_0xe8fe('0x7b')](_0xe8fe('0x97'),_0x8e958c[_0xe8fe('0x52')],_0x8e958c['type']);}else{if(_['startsWith'](_0x9f1ff9[_0xe8fe('0x42')][_0xe8fe('0x98')](),_0xe8fe('0x99'))){if(this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x9a')]]){var _0x5307d8=_['last'](this['queueReports'][_0x9f1ff9[_0xe8fe('0x9a')]]);_0x5307d8[_0xe8fe('0x3c')]=![];_0x5307d8[_0xe8fe('0x3b')]=!![];_0x5307d8['queuecallerexitAt']=moment(_0x8e958c[_0xe8fe('0x76')])[_0xe8fe('0x9b')](_0x9f1ff9['holdtime'],_0xe8fe('0x9c'))[_0xe8fe('0x57')](_0xe8fe('0x77'));_0x5307d8[_0xe8fe('0x85')]='FORWARDTRANSFER';_0x5307d8['transfer']=!![];_0x5307d8[_0xe8fe('0x9d')]=_0xe8fe('0x9e');_0x5307d8[_0xe8fe('0x9f')]=_0x9f1ff9[_0xe8fe('0xa0')];_0x5307d8[_0xe8fe('0xa1')]=_0x9f1ff9['uniqueid'];logger[_0xe8fe('0x7b')](_0xe8fe('0xa2'),_0x5307d8[_0xe8fe('0x52')],_0x5307d8[_0xe8fe('0x6a')]);var _0x1da70b=this[_0xe8fe('0x11')][_0x9f1ff9['linkedid']];this['queueReports'][_0x9f1ff9[_0xe8fe('0x9a')]]=this[_0xe8fe('0x11')][_0x9f1ff9[_0xe8fe('0x50')]];this[_0xe8fe('0x11')][_0x9f1ff9['uniqueid']]=_0x1da70b;}}else{_0x8e958c['queuecallerexitreason']=_0xe8fe('0xa3')+_0x9f1ff9[_0xe8fe('0x95')][_0xe8fe('0xa4')]();logger[_0xe8fe('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x8e958c[_0xe8fe('0x52')],_0x8e958c[_0xe8fe('0x6a')],_0x8e958c['queuecallerexitreason']);}}}this['channels'][_0x9f1ff9[_0xe8fe('0x50')]]=_0x8e958c;this['emitVoiceQueueChannelRemove'](_0x8e958c,_0xe8fe('0x24'));}}}catch(_0x113a5c){logger['error'](_0xe8fe('0xa5'),_0x9f1ff9[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x113a5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0x28')]=function(_0x492e41){try{if(this[_0xe8fe('0x71')](_0x492e41)){logger[_0xe8fe('0x54')](_0xe8fe('0xa6'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x492e41,{'showHidden':![],'depth':null}));this[_0xe8fe('0xa7')](_0x492e41[_0xe8fe('0x50')],_[_0xe8fe('0x7e')](_0x492e41['variable'])[0x0],_0x492e41[_0xe8fe('0xa8')]);if(this[_0xe8fe('0x11')][_0x492e41['uniqueid']]){var _0x2aeec4=_[_0xe8fe('0x80')](this[_0xe8fe('0x11')][_0x492e41['uniqueid']]);if(_0x2aeec4){if(this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')])&&this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')][_0xe8fe('0x62')])){switch(_0x492e41['value']){case'CONTINUE':_0x2aeec4[_0xe8fe('0x3b')]=![];_0x2aeec4['queuecallerexitAt']=null;break;case _0xe8fe('0xaa'):_0x2aeec4[_0xe8fe('0xab')]='timeout';_0x2aeec4[_0xe8fe('0x3b')]=!![];_0x2aeec4['queuecallerexitAt']=moment()[_0xe8fe('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aeec4['queuecallerleaveAt']=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));logger[_0xe8fe('0x54')](_0xe8fe('0xac'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0x2aeec4,{'showHidden':![],'depth':null}));ami['emit'](_0xe8fe('0xad'),_0x2aeec4);break;default:_0x2aeec4[_0xe8fe('0x3b')]=!![];_0x2aeec4[_0xe8fe('0x93')]=moment()['format'](_0xe8fe('0x77'));_0x2aeec4[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));}_0x2aeec4[_0xe8fe('0x20')]=![];_0x2aeec4['queuecallerabandonAt']=null;_0x2aeec4[_0xe8fe('0x85')]=_0x492e41[_0xe8fe('0xa8')];this[_0xe8fe('0x3e')][_0x492e41[_0xe8fe('0x50')]]=_0x2aeec4;this['emitVoiceQueueChannelRemove'](_0x2aeec4,_0xe8fe('0x27'));}else if(this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')])&&this[_0xe8fe('0x71')](_0x492e41[_0xe8fe('0xa9')]['queueposition'])){if(!_0x2aeec4[_0xe8fe('0x20')]){_0x2aeec4['queuecallerexit']=!![];_0x2aeec4['queuecallerexitAt']=moment()[_0xe8fe('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aeec4[_0xe8fe('0x85')]=_0xe8fe('0xae');_0x2aeec4[_0xe8fe('0x89')]=moment()[_0xe8fe('0x57')](_0xe8fe('0x77'));this[_0xe8fe('0x3e')][_0x492e41[_0xe8fe('0x50')]]=_0x2aeec4;}}logger['info'](_0xe8fe('0xaf'),_0x492e41[_0xe8fe('0x50')],_0x2aeec4[_0xe8fe('0x52')],_0x2aeec4[_0xe8fe('0x6a')],_[_0xe8fe('0x7e')](_0x492e41[_0xe8fe('0xa9')])[0x0],_0x492e41[_0xe8fe('0xa8')]);_0x2aeec4[_0xe8fe('0x17')]=this[_0xe8fe('0x17')][_0x492e41[_0xe8fe('0x50')]];}}}}catch(_0xc6b7c1){logger[_0xe8fe('0x47')](_0xe8fe('0xa6'),_0x492e41[_0xe8fe('0x50')],util[_0xe8fe('0x46')](_0xc6b7c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0xa7')]=function(_0x1830c3,_0x2c1ec2,_0x38a613){var _0x43f9f9=[_0xe8fe('0xb0'),_0xe8fe('0xb1'),_0xe8fe('0xb2'),_0xe8fe('0xb3'),_0xe8fe('0xb4'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xe8fe('0xb5'),_0xe8fe('0xb6'),_0xe8fe('0xb7'),'bridgepeer',_0xe8fe('0xb8'),_0xe8fe('0xb9'),_0xe8fe('0xba'),_0xe8fe('0xbb'),_0xe8fe('0xbc'),_0xe8fe('0x92'),'memberpenalty',_0xe8fe('0xbd')];if(!_['isNil'](_0x2c1ec2)&&!_[_0xe8fe('0xbe')](_0x43f9f9,_0x2c1ec2)){if(_[_0xe8fe('0x5d')](this['variables'][_0x1830c3])){this['variables'][_0x1830c3]={};}this[_0xe8fe('0x17')][_0x1830c3][_0x2c1ec2]=_0x38a613;}};VoiceQueueReport[_0xe8fe('0xc')][_0xe8fe('0xbf')]=function(_0x55f455,_0x2bc300,_0x660820){var _0x38d0ce={};for(var _0x5ed23a=0x0;_0x5ed23a0x0?!![]:![];if(!_0x39611a){return this['syncQueueSummaryComplete'](this['summary'][_0x00e5('0x67')]);}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x1b')]=function(_0x205a54){var _0x155de0=this[_0x00e5('0x15')]['id'];if(this[_0x00e5('0x15')][_0x00e5('0x5e')][_0x155de0]&&this['summary'][_0x00e5('0x5e')][_0x155de0][_0x205a54[_0x00e5('0x5d')]]){this[_0x00e5('0x15')]['queuestatus'][_0x155de0][_0x205a54[_0x00e5('0x5d')]][_0x00e5('0x10')][_0x00e5('0x68')](_0x205a54);}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x17')]=function(_0x368b27){var _0xb0003c=this;try{if(this[_0x00e5('0x69')](_0x368b27)&&this[_0x00e5('0x69')](_0x368b27[_0x00e5('0x4d')])){logger[_0x00e5('0x4f')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x00e5('0x3f')](_0x368b27,{'showHidden':![],'depth':null}));var _0x46198a=this[_0x00e5('0x13')][_0x368b27[_0x00e5('0x4d')]];if(_0x46198a){logger[_0x00e5('0x6a')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x46198a[_0x00e5('0x55')]);this['summary'][_0x00e5('0x58')][_0x46198a['name']]={'summaryEvent':_0x368b27};this[_0x00e5('0x15')][_0x00e5('0x66')]+=0x1;return ami['Action']({'action':_0x00e5('0x5e'),'queue':_0x46198a[_0x00e5('0x55')]})[_0x00e5('0x5c')](function(_0x3922f7){if(!_0xb0003c[_0x00e5('0x15')][_0x00e5('0x5e')][_0x368b27[_0x00e5('0x5d')]]){_0xb0003c[_0x00e5('0x15')]['queuestatus'][_0x368b27[_0x00e5('0x5d')]]={};}_0xb0003c[_0x00e5('0x15')][_0x00e5('0x5e')][_0x368b27[_0x00e5('0x5d')]][_0x3922f7[_0x00e5('0x5d')]]={'queue':_0x46198a['name'],'agents':[]};})['catch'](function(_0x40656c){throw _0x40656c;});}}}catch(_0x22f3ad){logger[_0x00e5('0x3e')](_0x00e5('0x5f'),util[_0x00e5('0x3f')](_0x22f3ad,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x19')]=function(_0x1784b2){if(this[_0x00e5('0x15')][_0x00e5('0x66')]>0x0){this[_0x00e5('0x15')][_0x00e5('0x67')]=_0x1784b2;return;}logger['debug'](_0x00e5('0x6b'),util['inspect'](_0x1784b2,{'showHidden':![],'depth':null}));this[_0x00e5('0x15')]=initializeSummary();ami[_0x00e5('0x47')](_0x00e5('0x6c'),{});};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x1f')]=function(_0x445f35){try{if(this[_0x00e5('0x69')](_0x445f35)){logger[_0x00e5('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x445f35[_0x00e5('0x4b')],util[_0x00e5('0x3f')](_0x445f35,{'showHidden':![],'depth':null}));if(_[_0x00e5('0x57')](this[_0x00e5('0xe')][_0x445f35[_0x00e5('0x4b')]])){this[_0x00e5('0xe')][_0x445f35[_0x00e5('0x4b')]]=[];}if(_[_0x00e5('0x57')](this[_0x00e5('0x11')][_0x445f35[_0x00e5('0x4b')]])){this[_0x00e5('0x11')][_0x445f35[_0x00e5('0x4b')]]={};}var _0x37f723=new QueueReport();_0x37f723['queue']=_0x445f35[_0x00e5('0x4d')];_0x37f723['type']=this[_0x00e5('0x13')][_0x37f723[_0x00e5('0x4d')]]&&this[_0x00e5('0x13')][_0x37f723[_0x00e5('0x4d')]][_0x00e5('0x53')]?this['voiceQueues'][_0x37f723[_0x00e5('0x4d')]]['type']||_0x00e5('0x54'):'inbound';_0x37f723['queuecallerjoinAt']=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));_0x37f723['position']=_0x445f35['position'];_0x37f723[_0x00e5('0x6e')]=_0x445f35[_0x00e5('0x6e')];_0x37f723['uniqueid']=_0x445f35['uniqueid'];_0x37f723['routealias']=this[_0x00e5('0x11')][_0x445f35[_0x00e5('0x4b')]][_0x00e5('0x6f')];logger[_0x00e5('0x6a')](_0x00e5('0x70'),_0x37f723[_0x00e5('0x4d')],_0x37f723[_0x00e5('0x53')]);_[_0x00e5('0x71')](_0x37f723,_[_0x00e5('0x72')](_0x445f35,_['keys'](_0x37f723)));this[_0x00e5('0xe')][_0x445f35[_0x00e5('0x4b')]][_0x00e5('0x68')](_0x37f723);this[_0x00e5('0x11')][_0x445f35[_0x00e5('0x4b')]]=_0x37f723;this['emitVoiceQueueChannelSave'](_0x37f723,_0x00e5('0x1e'));}}catch(_0x470099){logger[_0x00e5('0x3e')](_0x00e5('0x73'),_0x445f35[_0x00e5('0x4b')],util['inspect'](_0x470099,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x00e5('0xa')]['syncQueueCallerAbandon']=function(_0x38f31e){try{if(this[_0x00e5('0x69')](_0x38f31e)){logger[_0x00e5('0x4f')](_0x00e5('0x74'),_0x38f31e['uniqueid'],util[_0x00e5('0x3f')](_0x38f31e,{'showHidden':![],'depth':null}));if(this[_0x00e5('0xe')][_0x38f31e[_0x00e5('0x4b')]]){var _0x99ae9=_[_0x00e5('0x75')](this['queueReports'][_0x38f31e['uniqueid']]);_0x99ae9['queuecallercomplete']=![];_0x99ae9[_0x00e5('0x76')]=null;_0x99ae9[_0x00e5('0x77')]=_0x38f31e[_0x00e5('0x77')];_0x99ae9['originalposition']=_0x38f31e[_0x00e5('0x78')];_0x99ae9[_0x00e5('0x79')]=!![];_0x99ae9[_0x00e5('0x7a')]=moment()[_0x00e5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x99ae9[_0x00e5('0x50')]='ABANDONED';_0x99ae9['lastAssignedTo']=null;logger[_0x00e5('0x6a')](_0x00e5('0x7b'),_0x99ae9['queue'],_0x99ae9[_0x00e5('0x53')]);this[_0x00e5('0x11')][_0x38f31e[_0x00e5('0x4b')]]=_0x99ae9;this[_0x00e5('0x45')](_0x99ae9,_0x00e5('0x79'));}}}catch(_0xf7d23e){logger[_0x00e5('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x38f31e[_0x00e5('0x4b')],util['inspect'](_0xf7d23e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x00e5('0xa')]['syncQueueCallerLeave']=function(_0x215541){try{if(this[_0x00e5('0x69')](_0x215541)){logger[_0x00e5('0x4f')](_0x00e5('0x7c'),_0x215541[_0x00e5('0x4b')],util[_0x00e5('0x3f')](_0x215541,{'showHidden':![],'depth':null}));if(this[_0x00e5('0xe')][_0x215541[_0x00e5('0x4b')]]){var _0xfb607e=_[_0x00e5('0x75')](this[_0x00e5('0xe')][_0x215541[_0x00e5('0x4b')]]);_0xfb607e[_0x00e5('0x7d')]=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));_0xfb607e[_0x00e5('0x7e')]=_0x215541[_0x00e5('0x7e')];_0xfb607e[_0x00e5('0x7f')]=_0x215541['connectedlinename'];logger[_0x00e5('0x6a')](_0x00e5('0x80'),_0xfb607e['queue'],_0xfb607e[_0x00e5('0x53')],_0x215541[_0x00e5('0x7e')],_0x215541[_0x00e5('0x7f')]);this[_0x00e5('0x11')][_0x215541[_0x00e5('0x4b')]]=_0xfb607e;this[_0x00e5('0x48')](_0xfb607e,_0x00e5('0x20'));}}}catch(_0x2133c7){logger[_0x00e5('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x215541[_0x00e5('0x4b')],util['inspect'](_0x2133c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x00e5('0x24')]=function(_0x544aa8){try{if(this[_0x00e5('0x69')](_0x544aa8)){logger[_0x00e5('0x4f')](_0x00e5('0x81'),_0x544aa8['uniqueid'],util['inspect'](_0x544aa8,{'showHidden':![],'depth':null}));if(this[_0x00e5('0xe')][_0x544aa8['uniqueid']]){var _0x32ea3d=_['last'](this[_0x00e5('0xe')][_0x544aa8[_0x00e5('0x4b')]]);_0x32ea3d['queuecallercomplete']=!![];_0x32ea3d[_0x00e5('0x50')]='COMPLETEDBYAGENT';logger['info'](_0x00e5('0x82'),_0x32ea3d[_0x00e5('0x4d')],_0x32ea3d['type']);}}}catch(_0xa67301){logger[_0x00e5('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x544aa8['uniqueid'],util[_0x00e5('0x3f')](_0xa67301,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x83')]=function(_0x23b616){try{if(this[_0x00e5('0x69')](_0x23b616)){logger['debug'](_0x00e5('0x84'),_0x23b616[_0x00e5('0x4b')],util['inspect'](_0x23b616,{'showHidden':![],'depth':null}));if(this[_0x00e5('0xe')][_0x23b616[_0x00e5('0x4b')]]){var _0x2a32d4=_[_0x00e5('0x75')](this[_0x00e5('0xe')][_0x23b616[_0x00e5('0x4b')]]);_0x2a32d4[_0x00e5('0x79')]=![];_0x2a32d4[_0x00e5('0x7a')]=null;_0x2a32d4[_0x00e5('0x85')]=!![];_0x2a32d4[_0x00e5('0x86')]=_0x23b616[_0x00e5('0x87')];_0x2a32d4[_0x00e5('0x77')]=_0x23b616[_0x00e5('0x77')];_0x2a32d4[_0x00e5('0x88')]=!![];_0x2a32d4[_0x00e5('0x89')]=![];_0x2a32d4['queuecallerexitAt']=null;if(!_0x2a32d4[_0x00e5('0x8a')]){if(_0x23b616[_0x00e5('0x8b')]==_0x00e5('0x8a')){_0x2a32d4['queuecallerexitreason']=_0x00e5('0x8c');logger[_0x00e5('0x6a')](_0x00e5('0x8d'),_0x2a32d4['queue'],_0x2a32d4['type']);}else{if(_['startsWith'](_0x23b616[_0x00e5('0x3a')]['toLowerCase'](),'local/')){if(this[_0x00e5('0xe')][_0x23b616[_0x00e5('0x8e')]]){var _0x220723=_['last'](this['queueReports'][_0x23b616[_0x00e5('0x8e')]]);_0x220723[_0x00e5('0x88')]=![];_0x220723['queuecallerexit']=!![];_0x220723[_0x00e5('0x8f')]=moment(_0x2a32d4['queuecallerjoinAt'])['add'](_0x23b616[_0x00e5('0x77')],_0x00e5('0x90'))[_0x00e5('0x4c')](_0x00e5('0x6d'));_0x220723[_0x00e5('0x50')]=_0x00e5('0x91');_0x220723['transfer']=!![];_0x220723['transfertype']=_0x00e5('0x92');_0x220723[_0x00e5('0x93')]=_0x23b616[_0x00e5('0x94')];_0x220723[_0x00e5('0x95')]=_0x23b616[_0x00e5('0x4b')];logger[_0x00e5('0x6a')](_0x00e5('0x96'),_0x220723[_0x00e5('0x4d')],_0x220723[_0x00e5('0x53')]);var _0x3d1319=this[_0x00e5('0xe')][_0x23b616[_0x00e5('0x8e')]];this[_0x00e5('0xe')][_0x23b616['linkedid']]=this[_0x00e5('0xe')][_0x23b616['uniqueid']];this[_0x00e5('0xe')][_0x23b616['uniqueid']]=_0x3d1319;}}else{_0x2a32d4[_0x00e5('0x50')]=_0x00e5('0x97')+_0x23b616['reason'][_0x00e5('0x98')]();logger['info'](_0x00e5('0x99'),_0x2a32d4[_0x00e5('0x4d')],_0x2a32d4[_0x00e5('0x53')],_0x2a32d4[_0x00e5('0x50')]);}}}this[_0x00e5('0x11')][_0x23b616[_0x00e5('0x4b')]]=_0x2a32d4;this[_0x00e5('0x45')](_0x2a32d4,'agentcomplete');}}}catch(_0x529e3e){logger[_0x00e5('0x3e')](_0x00e5('0x84'),_0x23b616[_0x00e5('0x4b')],util[_0x00e5('0x3f')](_0x529e3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x00e5('0x25')]=function(_0x30cc3d){try{if(this[_0x00e5('0x69')](_0x30cc3d)){logger[_0x00e5('0x4f')]('[%s][voiceQueueReport][varset]',_0x30cc3d[_0x00e5('0x4b')],util['inspect'](_0x30cc3d,{'showHidden':![],'depth':null}));this[_0x00e5('0x9a')](_0x30cc3d[_0x00e5('0x4b')],_[_0x00e5('0x9b')](_0x30cc3d[_0x00e5('0x9c')])[0x0],_0x30cc3d[_0x00e5('0x9d')]);if(this[_0x00e5('0xe')][_0x30cc3d[_0x00e5('0x4b')]]){var _0x5bfda1=_[_0x00e5('0x75')](this['queueReports'][_0x30cc3d[_0x00e5('0x4b')]]);if(_0x5bfda1){if(this[_0x00e5('0x69')](_0x30cc3d[_0x00e5('0x9c')])&&this[_0x00e5('0x69')](_0x30cc3d['variable'][_0x00e5('0x5e')])){switch(_0x30cc3d['value']){case'CONTINUE':_0x5bfda1[_0x00e5('0x89')]=![];_0x5bfda1[_0x00e5('0x8f')]=null;break;case _0x00e5('0x9e'):_0x5bfda1['lastevent']=_0x00e5('0x9f');_0x5bfda1['queuecallerexit']=!![];_0x5bfda1[_0x00e5('0x8f')]=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));_0x5bfda1['queuecallerleaveAt']=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));logger[_0x00e5('0x4f')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x30cc3d['uniqueid'],util[_0x00e5('0x3f')](_0x5bfda1,{'showHidden':![],'depth':null}));ami[_0x00e5('0x47')](_0x00e5('0xa0'),_0x5bfda1);break;default:_0x5bfda1[_0x00e5('0x89')]=!![];_0x5bfda1[_0x00e5('0x8f')]=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));_0x5bfda1[_0x00e5('0x7d')]=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));}_0x5bfda1[_0x00e5('0x79')]=![];_0x5bfda1[_0x00e5('0x7a')]=null;_0x5bfda1[_0x00e5('0x50')]=_0x30cc3d['value'];this[_0x00e5('0x11')][_0x30cc3d[_0x00e5('0x4b')]]=_0x5bfda1;this[_0x00e5('0x45')](_0x5bfda1,_0x00e5('0xa1'));}else if(this['isNotNull'](_0x30cc3d[_0x00e5('0x9c')])&&this[_0x00e5('0x69')](_0x30cc3d[_0x00e5('0x9c')][_0x00e5('0xa2')])){if(!_0x5bfda1[_0x00e5('0x79')]){_0x5bfda1[_0x00e5('0x89')]=!![];_0x5bfda1[_0x00e5('0x8f')]=moment()[_0x00e5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bfda1['queuecallerexitreason']=_0x00e5('0xa3');_0x5bfda1[_0x00e5('0x7d')]=moment()[_0x00e5('0x4c')](_0x00e5('0x6d'));this[_0x00e5('0x11')][_0x30cc3d[_0x00e5('0x4b')]]=_0x5bfda1;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x30cc3d[_0x00e5('0x4b')],_0x5bfda1['queue'],_0x5bfda1[_0x00e5('0x53')],_[_0x00e5('0x9b')](_0x30cc3d[_0x00e5('0x9c')])[0x0],_0x30cc3d['value']);_0x5bfda1[_0x00e5('0x41')]=this[_0x00e5('0x41')][_0x30cc3d[_0x00e5('0x4b')]];}}}}catch(_0x57c627){logger[_0x00e5('0x3e')](_0x00e5('0xa4'),_0x30cc3d[_0x00e5('0x4b')],util[_0x00e5('0x3f')](_0x57c627,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0x9a')]=function(_0x58952b,_0x14f3d2,_0xc1b64d){var _0x57842c=['rtpaudioqos','rtpaudioqosbridged',_0x00e5('0xa5'),_0x00e5('0xa6'),_0x00e5('0xa7'),_0x00e5('0xa8'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x00e5('0xa9'),'sipuri',_0x00e5('0xaa'),'bridgepvtcallid',_0x00e5('0xab'),_0x00e5('0xac'),_0x00e5('0xad'),_0x00e5('0xae'),_0x00e5('0x87'),_0x00e5('0xaf'),_0x00e5('0xb0')];if(!_[_0x00e5('0x38')](_0x14f3d2)&&!_[_0x00e5('0xb1')](_0x57842c,_0x14f3d2)){if(_[_0x00e5('0x57')](this[_0x00e5('0x41')][_0x58952b])){this[_0x00e5('0x41')][_0x58952b]={};}this[_0x00e5('0x41')][_0x58952b][_0x14f3d2]=_0xc1b64d;}};VoiceQueueReport[_0x00e5('0xa')][_0x00e5('0xb2')]=function(_0x47ef5e,_0x10d9da,_0x45221a){var _0x2e9c66={};for(var _0x15c362=0x0;_0x15c362=0x0?moment(_0x2f0563[_0x3eb3('0x19')])[_0x3eb3('0xb')](_0x2f0563[_0x3eb3('0x18')],_0x3eb3('0x1a')):null,'data1':_0x3eb3('0x1b'),'data2':_0x2f0563['accountcode'],'data3':_0x2f0563['exten'],'data4':_0x2f0563[_0x3eb3('0x1c')]||null,'role':'agent','internal':_0x2f0563[_0x3eb3('0x11')]?_['toNumber'](_0x2f0563['accountcode']):undefined,'uniqueid':_0x2f0563['uniqueid']},'log':_0x3eb3('0x14')});}; \ No newline at end of file +var _0x3a00=['SIP/%s','TALKING','diff','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','toNumber','accountcode','uniqueid','CreateMemberReport','starttime','endtime','seconds','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format'];(function(_0x2e8ea0,_0x5d0e07){var _0x3ad251=function(_0x45b3fa){while(--_0x45b3fa){_0x2e8ea0['push'](_0x2e8ea0['shift']());}};_0x3ad251(++_0x5d0e07);}(_0x3a00,0x150));var _0x03a0=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x3a00[_0x5ef55a];return _0x20ae40;};'use strict';var moment=require(_0x03a0('0x0'));var _=require(_0x03a0('0x1'));var util=require(_0x03a0('0x2'));var client=require('../client');exports[_0x03a0('0x3')]=function(_0x3d160c){var _0x17e5b0=_0x3d160c[_0x03a0('0x4')]||_0x3d160c[_0x03a0('0x5')];return client[_0x03a0('0x6')]('CreateMemberReport',{'body':{'channel':_0x03a0('0x7'),'membername':_0x3d160c[_0x03a0('0x8')],'interface':_[_0x03a0('0x9')](_0x3d160c[_0x03a0('0xa')])?util[_0x03a0('0xb')](_0x03a0('0xc'),_0x3d160c[_0x03a0('0x8')]):_0x3d160c[_0x03a0('0xa')],'type':_0x03a0('0xd'),'enterAt':_0x3d160c['queuecallerleaveAt'],'exitAt':_0x17e5b0,'duration':moment(_0x17e5b0)[_0x03a0('0xe')](_0x3d160c[_0x03a0('0xf')],'seconds'),'data1':_0x03a0('0x10'),'data2':_0x3d160c[_0x03a0('0x11')],'data3':_0x3d160c[_0x03a0('0x12')],'data4':null,'data5':_0x3d160c[_0x03a0('0x13')],'role':_0x03a0('0x14'),'internal':_0x3d160c['accountcode']?_[_0x03a0('0x15')](_0x3d160c[_0x03a0('0x16')]):undefined,'uniqueid':_0x3d160c[_0x03a0('0x17')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x424602){return client['Request'](_0x03a0('0x18'),{'body':{'channel':'voice','membername':_0x424602['membername'],'interface':_0x424602['interface'],'type':_0x03a0('0xd'),'enterAt':_0x424602[_0x03a0('0x19')],'exitAt':_0x424602['endtime'],'duration':moment(_0x424602[_0x03a0('0x1a')])['diff'](_0x424602[_0x03a0('0x19')],_0x03a0('0x1b'))>=0x0?moment(_0x424602[_0x03a0('0x1a')])[_0x03a0('0xe')](_0x424602['starttime'],_0x03a0('0x1b')):null,'data1':'outbound','data2':_0x424602[_0x03a0('0x16')],'data3':_0x424602[_0x03a0('0x12')],'data4':_0x424602[_0x03a0('0x1c')]||null,'role':_0x03a0('0x14'),'internal':_0x424602[_0x03a0('0x16')]?_['toNumber'](_0x424602[_0x03a0('0x16')]):undefined,'uniqueid':_0x424602[_0x03a0('0x17')]},'log':_0x03a0('0x18')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a92b7da..1cae7c8 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 _0x0833=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x16a69f,_0xe4f30f){var _0x55728e=function(_0x75d573){while(--_0x75d573){_0x16a69f['push'](_0x16a69f['shift']());}};_0x55728e(++_0xe4f30f);}(_0x0833,0x1bd));var _0x3083=function(_0x338bbe,_0x59d53d){_0x338bbe=_0x338bbe-0x0;var _0xdbf323=_0x0833[_0x338bbe];return _0xdbf323;};'use strict';var client=require(_0x3083('0x0'));exports[_0x3083('0x1')]=function(){return client[_0x3083('0x2')](_0x3083('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3083('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0xb5fb=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xb5fb,0x172));var _0xbb5f=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0xb5fb[_0x9c1f48];return _0x52ecd4;};'use strict';var client=require(_0xbb5f('0x0'));exports[_0xbb5f('0x1')]=function(){return client[_0xbb5f('0x2')](_0xbb5f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbb5f('0x4'),_0xbb5f('0x5')]},'log':_0xbb5f('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 16775e3..dac77fb 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 _0xe44d=['name','html','../client','Request','GetTemplate'];(function(_0x3fbc08,_0x3b8845){var _0x42299e=function(_0x1a130d){while(--_0x1a130d){_0x3fbc08['push'](_0x3fbc08['shift']());}};_0x42299e(++_0x3b8845);}(_0xe44d,0xc0));var _0xde44=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe44d[_0x29d94e];return _0x106237;};'use strict';var client=require(_0xde44('0x0'));exports['getTemplates']=function(_0x34973f){return function(_0xc56c8f){return client[_0xde44('0x1')](_0xde44('0x2'),{'options':{'raw':!![],'attributes':['id',_0xde44('0x3'),_0xde44('0x4')]},'log':_0xde44('0x2')});};}; \ No newline at end of file +var _0x81df=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x291748,_0x2cddd8){var _0x48981d=function(_0x470429){while(--_0x470429){_0x291748['push'](_0x291748['shift']());}};_0x48981d(++_0x2cddd8);}(_0x81df,0xb3));var _0xf81d=function(_0x149df5,_0x3bf4cb){_0x149df5=_0x149df5-0x0;var _0x404796=_0x81df[_0x149df5];return _0x404796;};'use strict';var client=require(_0xf81d('0x0'));exports[_0xf81d('0x1')]=function(_0x97f014){return function(_0x1eb7b6){return client[_0xf81d('0x2')](_0xf81d('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf81d('0x4'),_0xf81d('0x5')]},'log':_0xf81d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d2d0342..ef329aa 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 _0xf833=['field','Action','Actions','action','data1','data2','data3','data4','data7','GetTrigger','Request','Condition','AllConditions','operator','value','AnyConditions'];(function(_0x12767f,_0x41b198){var _0x29b55f=function(_0x1b3a8a){while(--_0x1b3a8a){_0x12767f['push'](_0x12767f['shift']());}};_0x29b55f(++_0x41b198);}(_0xf833,0x1aa));var _0x3f83=function(_0x5bfc44,_0x319a4f){_0x5bfc44=_0x5bfc44-0x0;var _0x3cddc1=_0xf833[_0x5bfc44];return _0x3cddc1;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x2641c2){return function(_0x4bf777){return client[_0x3f83('0x0')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x3f83('0x1'),'as':_0x3f83('0x2'),'attributes':['id','field',_0x3f83('0x3'),_0x3f83('0x4')]},{'model':_0x3f83('0x1'),'as':_0x3f83('0x5'),'attributes':['id',_0x3f83('0x6'),'operator',_0x3f83('0x4')]},{'model':_0x3f83('0x7'),'as':_0x3f83('0x8'),'attributes':['id',_0x3f83('0x9'),_0x3f83('0xa'),_0x3f83('0xb'),_0x3f83('0xc'),_0x3f83('0xd'),'data5','data6',_0x3f83('0xe')]}]},'log':_0x3f83('0xf')});};}; \ No newline at end of file +var _0x6686=['GetTrigger','name','status','AllConditions','field','value','Condition','AnyConditions','operator','Action','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x6686,0x123));var _0x6668=function(_0x412d1e,_0x3850f0){_0x412d1e=_0x412d1e-0x0;var _0x8c5482=_0x6686[_0x412d1e];return _0x8c5482;};'use strict';var client=require(_0x6668('0x0'));exports[_0x6668('0x1')]=function(_0x4272df){return function(_0x3ee824){return client[_0x6668('0x2')](_0x6668('0x3'),{'options':{'raw':![],'attributes':['id',_0x6668('0x4'),'channel',_0x6668('0x5')],'include':[{'model':'Condition','as':_0x6668('0x6'),'attributes':['id',_0x6668('0x7'),'operator',_0x6668('0x8')]},{'model':_0x6668('0x9'),'as':_0x6668('0xa'),'attributes':['id','field',_0x6668('0xb'),_0x6668('0x8')]},{'model':_0x6668('0xc'),'as':'Actions','attributes':['id',_0x6668('0xd'),_0x6668('0xe'),_0x6668('0xf'),_0x6668('0x10'),_0x6668('0x11'),_0x6668('0x12'),_0x6668('0x13'),_0x6668('0x14')]}]},'log':_0x6668('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 7093f4c..2a5804a 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 _0x493b=['../client','GetTrunk','name'];(function(_0x20dd60,_0x33d1dd){var _0x303ece=function(_0x2248fb){while(--_0x2248fb){_0x20dd60['push'](_0x20dd60['shift']());}};_0x303ece(++_0x33d1dd);}(_0x493b,0x1b9));var _0xb493=function(_0xf31403,_0xfa2757){_0xf31403=_0xf31403-0x0;var _0x47d7b8=_0x493b[_0xf31403];return _0x47d7b8;};'use strict';var client=require(_0xb493('0x0'));exports['getTrunks']=function(_0xc8cc3a){return function(_0x173aa3){return client['Request'](_0xb493('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb493('0x2'),'registry','defaultuser']},'log':_0xb493('0x1')});};}; \ No newline at end of file +var _0x899a=['name','registry','defaultuser','GetTrunk','../client','getTrunks','Request'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x899a,0x1b6));var _0xa899=function(_0x57090b,_0x1b7b9f){_0x57090b=_0x57090b-0x0;var _0x2756b4=_0x899a[_0x57090b];return _0x2756b4;};'use strict';var client=require(_0xa899('0x0'));exports[_0xa899('0x1')]=function(_0x4f77af){return function(_0x26e9a7){return client[_0xa899('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa899('0x3'),_0xa899('0x4'),_0xa899('0x5')]},'log':_0xa899('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0fd9e27..f4048db 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(_0x4de995,_0xf56718){var _0x3d7a14=function(_0x1c9d79){while(--_0x1c9d79){_0x4de995['push'](_0x4de995['shift']());}};_0x3d7a14(++_0xf56718);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x3a2acc,_0x594b44){var _0x34a4f1=function(_0x58aac6){while(--_0x58aac6){_0x3a2acc['push'](_0x3a2acc['shift']());}};_0x34a4f1(++_0x594b44);}(_0xedd9,0xfc));var _0x9edd=function(_0x10eb38,_0x270821){_0x10eb38=_0x10eb38-0x0;var _0x17afaf=_0xedd9[_0x10eb38];return _0x17afaf;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d621c6b..a9d54e2 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 _0xdf7f=['Request','CreateVoiceAgentReport','update','../client','create'];(function(_0x3e4e06,_0x577430){var _0x58e857=function(_0x19dc70){while(--_0x19dc70){_0x3e4e06['push'](_0x3e4e06['shift']());}};_0x58e857(++_0x577430);}(_0xdf7f,0x7b));var _0xfdf7=function(_0x117643,_0x2b3351){_0x117643=_0x117643-0x0;var _0x4f9ce1=_0xdf7f[_0x117643];return _0x4f9ce1;};'use strict';var client=require(_0xfdf7('0x0'));exports[_0xfdf7('0x1')]=function(_0x1a5708){return client[_0xfdf7('0x2')]('CreateVoiceAgentReport',{'body':_0x1a5708,'log':_0xfdf7('0x3')});};exports[_0xfdf7('0x4')]=function(_0x3e49c7,_0x1f46c1,_0x3235d7){return client['Request']('UpdateVoiceAgentReport',{'body':_0x3e49c7,'options':{'where':{'uniqueid':_0x1f46c1,'interface':_0x3235d7,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x55a7=['UpdateVoiceAgentReport','Request'];(function(_0xed3b6a,_0x5514fb){var _0x14ef8e=function(_0x29283e){while(--_0x29283e){_0xed3b6a['push'](_0xed3b6a['shift']());}};_0x14ef8e(++_0x5514fb);}(_0x55a7,0x161));var _0x755a=function(_0x3afdfc,_0x124e82){_0x3afdfc=_0x3afdfc-0x0;var _0x4112d0=_0x55a7[_0x3afdfc];return _0x4112d0;};'use strict';var client=require('../client');exports['create']=function(_0x3bc1e8){return client[_0x755a('0x0')]('CreateVoiceAgentReport',{'body':_0x3bc1e8,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x3db19d,_0x39d7ff,_0xdc0086){return client['Request'](_0x755a('0x1'),{'body':_0x3db19d,'options':{'where':{'uniqueid':_0x39d7ff,'interface':_0xdc0086,'agentcomplete':!![]}},'log':_0x755a('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3a3cb09..c49a187 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 _0xd581=['context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','util','../client','merge','calleridnum'];(function(_0x1cfca1,_0x165c1f){var _0x2ab941=function(_0x2ce9f0){while(--_0x2ce9f0){_0x1cfca1['push'](_0x1cfca1['shift']());}};_0x2ab941(++_0x165c1f);}(_0xd581,0x81));var _0x1d58=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xd581[_0x35885a];return _0xe86249;};'use strict';var moment=require('moment');var util=require(_0x1d58('0x0'));var _=require('lodash');var client=require(_0x1d58('0x1'));exports['create']=function(_0x2f8a4f){return client['Request']('CreateVoiceCallReport',{'body':_[_0x1d58('0x2')](_0x2f8a4f,{'source':_0x2f8a4f[_0x1d58('0x3')],'destinationcontext':_0x2f8a4f[_0x1d58('0x4')],'callerid':_0x2f8a4f[_0x1d58('0x5')],'amaflags':_0x1d58('0x6')}),'log':_0x1d58('0x7')});};exports[_0x1d58('0x8')]=function(){return function(){return client[_0x1d58('0x9')](_0x1d58('0xa'),{'options':{'where':{'type':[_0x1d58('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x1d58('0xc'))[_0x1d58('0xd')](_0x1d58('0xe')),moment()[_0x1d58('0xf')](_0x1d58('0xc'))[_0x1d58('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1d58('0x10'),'disposition',_0x1d58('0x11'),'billableseconds']},'log':_0x1d58('0x12')});};}; \ No newline at end of file +var _0x031e=['GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x031e,0x1ef));var _0xe031=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x031e[_0x45d1fd];return _0xd0e542;};'use strict';var moment=require(_0xe031('0x0'));var util=require(_0xe031('0x1'));var _=require('lodash');var client=require(_0xe031('0x2'));exports[_0xe031('0x3')]=function(_0x1c2b6c){return client[_0xe031('0x4')](_0xe031('0x5'),{'body':_[_0xe031('0x6')](_0x1c2b6c,{'source':_0x1c2b6c[_0xe031('0x7')],'destinationcontext':_0x1c2b6c[_0xe031('0x8')],'callerid':_0x1c2b6c['callerid'],'amaflags':_0xe031('0x9')}),'log':_0xe031('0x5')});};exports[_0xe031('0xa')]=function(){return function(){return client[_0xe031('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe031('0xb')]('day')[_0xe031('0xc')](_0xe031('0xd')),moment()['endOf'](_0xe031('0xe'))[_0xe031('0xc')](_0xe031('0xd'))]}},'attributes':[_0xe031('0xf'),_0xe031('0x10'),_0xe031('0x11'),'billableseconds']},'log':_0xe031('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 817c040..4a74e3a 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 _0x5b20=['CreateVoiceDialReport','Request'];(function(_0x118561,_0x3bd7cb){var _0x4b614a=function(_0xe68c26){while(--_0xe68c26){_0x118561['push'](_0x118561['shift']());}};_0x4b614a(++_0x3bd7cb);}(_0x5b20,0x1b5));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var client=require('../client');exports['create']=function(_0x5a97f9){return client[_0x05b2('0x0')](_0x05b2('0x1'),{'body':_0x5a97f9,'log':_0x05b2('0x1')});}; \ No newline at end of file +var _0x56f0=['create','Request','CreateVoiceDialReport','../client'];(function(_0x4de5bc,_0x50fa9f){var _0x1d498c=function(_0x2dff1b){while(--_0x2dff1b){_0x4de5bc['push'](_0x4de5bc['shift']());}};_0x1d498c(++_0x50fa9f);}(_0x56f0,0x15b));var _0x056f=function(_0x558dad,_0x1a9b5a){_0x558dad=_0x558dad-0x0;var _0x1921ea=_0x56f0[_0x558dad];return _0x1921ea;};'use strict';var client=require(_0x056f('0x0'));exports[_0x056f('0x1')]=function(_0x37c080){return client[_0x056f('0x2')](_0x056f('0x3'),{'body':_0x37c080,'log':_0x056f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1fd5753..3d6e8a6 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 _0x6b24=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x2cfd49,_0x3cb610){var _0x1d0cd7=function(_0x4ced7a){while(--_0x4ced7a){_0x2cfd49['push'](_0x2cfd49['shift']());}};_0x1d0cd7(++_0x3cb610);}(_0x6b24,0x1ce));var _0x46b2=function(_0x200af4,_0x8416e8){_0x200af4=_0x200af4-0x0;var _0x3831b6=_0x6b24[_0x200af4];return _0x3831b6;};'use strict';var client=require('../client');exports[_0x46b2('0x0')]=function(){return function(){return client[_0x46b2('0x1')](_0x46b2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x46b2('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9f4d=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x5305c0,_0x2588e3){var _0x5c27bd=function(_0x3e5cce){while(--_0x3e5cce){_0x5305c0['push'](_0x5305c0['shift']());}};_0x5c27bd(++_0x2588e3);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x9f4d[_0x208505];return _0x1a985f;};'use strict';var client=require(_0xd9f4('0x0'));exports[_0xd9f4('0x1')]=function(){return function(){return client[_0xd9f4('0x2')](_0xd9f4('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd9f4('0x4'),_0xd9f4('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xd9f4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 6a4401c..d597297 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 _0xd4b3=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence'];(function(_0x1e2f72,_0x4ecd3d){var _0x2f00a8=function(_0xf1ee63){while(--_0xf1ee63){_0x1e2f72['push'](_0x1e2f72['shift']());}};_0x2f00a8(++_0x4ecd3d);}(_0xd4b3,0xa8));var _0x3d4b=function(_0x14c948,_0xd8f51e){_0x14c948=_0x14c948-0x0;var _0x1c1f69=_0xd4b3[_0x14c948];return _0x1c1f69;};'use strict';var client=require(_0x3d4b('0x0'));exports[_0x3d4b('0x1')]=function(){return function(){return client[_0x3d4b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x4'),_0x3d4b('0x5'),_0x3d4b('0x6'),_0x3d4b('0x7'),'type','dialActive','dialMethod',_0x3d4b('0x8'),_0x3d4b('0x9'),_0x3d4b('0xa'),_0x3d4b('0xb'),_0x3d4b('0xc'),_0x3d4b('0xd'),_0x3d4b('0xe'),_0x3d4b('0xf'),'dialOriginateTimeout',_0x3d4b('0x10'),_0x3d4b('0x11'),_0x3d4b('0x12'),'dialCongestionMaxRetry',_0x3d4b('0x13'),'dialBusyMaxRetry',_0x3d4b('0x14'),_0x3d4b('0x15'),_0x3d4b('0x16'),_0x3d4b('0x17'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x3d4b('0x18'),_0x3d4b('0x19'),_0x3d4b('0x1a'),_0x3d4b('0x1b'),_0x3d4b('0x1c'),_0x3d4b('0x1d'),_0x3d4b('0x1e'),_0x3d4b('0x1f'),_0x3d4b('0x20'),_0x3d4b('0x21'),_0x3d4b('0x22'),_0x3d4b('0x23'),_0x3d4b('0x24'),'dialRecallInQueue',_0x3d4b('0x25'),_0x3d4b('0x26'),_0x3d4b('0x27'),_0x3d4b('0x28'),_0x3d4b('0x7'),_0x3d4b('0x29'),_0x3d4b('0x2a'),_0x3d4b('0x2b'),_0x3d4b('0x2c'),_0x3d4b('0x2d'),_0x3d4b('0x2e'),'dialDropRetryFrequency',_0x3d4b('0x2f'),'dialAbandonedRetryFrequency',_0x3d4b('0x30'),_0x3d4b('0x31'),_0x3d4b('0x32'),_0x3d4b('0x33'),_0x3d4b('0x34'),'dialPredictiveIntervalMaxThreshold',_0x3d4b('0x35'),_0x3d4b('0x36'),_0x3d4b('0x37')],'include':[{'model':'Trunk','as':_0x3d4b('0x38'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x39'),_0x3d4b('0x3a')]},{'model':_0x3d4b('0x3b'),'as':_0x3d4b('0x3c'),'attributes':['id',_0x3d4b('0x3')]},{'model':'Trunk','as':_0x3d4b('0x3d'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x39'),_0x3d4b('0x3a')]},{'model':_0x3d4b('0x3e'),'as':_0x3d4b('0x3e'),'attributes':['id',_0x3d4b('0x3')],'include':[{'model':'Interval','as':_0x3d4b('0x3f'),'attributes':['id',_0x3d4b('0x3'),_0x3d4b('0x40')]}]}]},'log':_0x3d4b('0x1')});};}; \ No newline at end of file +var _0x4870=['active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4870,0x12d));var _0x0487=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4870[_0x1b2ff7];return _0x31656a;};'use strict';var client=require(_0x0487('0x0'));exports[_0x0487('0x1')]=function(){return function(){return client[_0x0487('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x0487('0x3'),_0x0487('0x4'),_0x0487('0x5'),'autopause',_0x0487('0x6'),'type',_0x0487('0x7'),_0x0487('0x8'),'dialLimitChannel','dialLimitQueue',_0x0487('0x9'),_0x0487('0xa'),_0x0487('0xb'),_0x0487('0xc'),_0x0487('0xd'),_0x0487('0xe'),_0x0487('0xf'),_0x0487('0x10'),_0x0487('0x11'),_0x0487('0x12'),_0x0487('0x13'),'dialCongestionRetryFrequency',_0x0487('0x14'),_0x0487('0x15'),_0x0487('0x16'),_0x0487('0x17'),'dialGlobalMaxRetry',_0x0487('0x18'),_0x0487('0x19'),_0x0487('0x1a'),_0x0487('0x1b'),_0x0487('0x1c'),_0x0487('0x1d'),'dialAMDGreeting',_0x0487('0x1e'),_0x0487('0x1f'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x0487('0x20'),_0x0487('0x21'),_0x0487('0x22'),'timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0x0487('0x23'),_0x0487('0x24'),_0x0487('0x25'),'monitor_format',_0x0487('0x26'),'dialRandomLastDigitCallerIdNumber',_0x0487('0x27'),'dialNoSuchNumberMaxRetry',_0x0487('0x28'),_0x0487('0x29'),_0x0487('0x2a'),_0x0487('0x2b'),_0x0487('0x2c'),_0x0487('0x2d'),_0x0487('0x2e'),'dialAgentRejectMaxRetry',_0x0487('0x2f'),'mandatoryDisposition',_0x0487('0x30'),_0x0487('0x31'),_0x0487('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x0487('0x33'),'as':_0x0487('0x33'),'attributes':['id',_0x0487('0x3'),_0x0487('0x34'),_0x0487('0x35')]},{'model':_0x0487('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x0487('0x3')]},{'model':_0x0487('0x33'),'as':_0x0487('0x37'),'attributes':['id',_0x0487('0x3'),_0x0487('0x34'),_0x0487('0x35')]},{'model':_0x0487('0x38'),'as':_0x0487('0x38'),'attributes':['id',_0x0487('0x3')],'include':[{'model':_0x0487('0x38'),'as':_0x0487('0x39'),'attributes':['id',_0x0487('0x3'),_0x0487('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1761a5e..b64db83 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(_0x4d4e35,_0x3ad9e0){var _0x26031d=function(_0x58d68f){while(--_0x58d68f){_0x4d4e35['push'](_0x4d4e35['shift']());}};_0x26031d(++_0x3ad9e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x32657b,_0x49731a){var _0x4c735d=function(_0x2ad20e){while(--_0x2ad20e){_0x32657b['push'](_0x32657b['shift']());}};_0x4c735d(++_0x49731a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 e4ea60d..7dbfdf2 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 _0xd175=['getVoiceQueueRtPauses','../client','Request'];(function(_0x51dd27,_0x5b6f42){var _0x379561=function(_0x2eab99){while(--_0x2eab99){_0x51dd27['push'](_0x51dd27['shift']());}};_0x379561(++_0x5b6f42);}(_0xd175,0x1b1));var _0x5d17=function(_0x488cb6,_0xfb31a8){_0x488cb6=_0x488cb6-0x0;var _0x20c533=_0xd175[_0x488cb6];return _0x20c533;};'use strict';var client=require(_0x5d17('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5b9b9){return function(){return client[_0x5d17('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5b9b9,'paused':!![]},'raw':!![]},'log':_0x5d17('0x2')});};}; \ No newline at end of file +var _0xcb92=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x12022c,_0x24f3fd){var _0x64582b=function(_0x29075c){while(--_0x29075c){_0x12022c['push'](_0x12022c['shift']());}};_0x64582b(++_0x24f3fd);}(_0xcb92,0xa1));var _0x2cb9=function(_0xb2f515,_0x509339){_0xb2f515=_0xb2f515-0x0;var _0x199917=_0xcb92[_0xb2f515];return _0x199917;};'use strict';var client=require(_0x2cb9('0x0'));exports[_0x2cb9('0x1')]=function(_0x3043b7){return function(){return client[_0x2cb9('0x2')](_0x2cb9('0x3'),{'options':{'where':{'VoiceQueueId':_0x3043b7,'paused':!![]},'raw':!![]},'log':_0x2cb9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7c4fad4..0ee16f3 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(_0x244a81,_0x48a444){var _0x3493bb=function(_0x39efcf){while(--_0x39efcf){_0x244a81['push'](_0x244a81['shift']());}};_0x3493bb(++_0x48a444);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x24ed76,_0x18a1f5){var _0x4ce56d=function(_0x1ae378){while(--_0x1ae378){_0x24ed76['push'](_0x24ed76['shift']());}};_0x4ce56d(++_0x18a1f5);}(_0x7a54,0x106));var _0x47a5=function(_0x56b0a3,_0x71980f){_0x56b0a3=_0x56b0a3-0x0;var _0x195ce6=_0x7a54[_0x56b0a3];return _0x195ce6;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e008539..c6c63ca 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 _0x2dbd=['origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x2dbd,0x148));var _0xd2db=function(_0x7ff42c,_0x2a77cb){_0x7ff42c=_0x7ff42c-0x0;var _0x305d45=_0x2dbd[_0x7ff42c];return _0x305d45;};'use strict';var client=require(_0xd2db('0x0'));exports[_0xd2db('0x1')]={};exports[_0xd2db('0x2')]=function(_0x3caa93){return client[_0xd2db('0x3')](_0xd2db('0x4'),{'body':{'result':_0x3caa93[_0xd2db('0x5')],'transfererchannel':_0x3caa93[_0xd2db('0x6')],'transferercalleridnum':_0x3caa93[_0xd2db('0x7')],'transferercalleridname':_0x3caa93['transferercalleridname'],'transfererconnectedlinenum':_0x3caa93[_0xd2db('0x8')],'transfererconnectedlinename':_0x3caa93[_0xd2db('0x9')],'transfereraccountcode':_0x3caa93[_0xd2db('0xa')],'transferercontext':_0x3caa93[_0xd2db('0xb')],'transfererexten':_0x3caa93[_0xd2db('0xc')],'transfererlinkedid':_0x3caa93[_0xd2db('0xd')],'transfereechannel':_0x3caa93[_0xd2db('0xe')],'transfereecalleridnum':_0x3caa93[_0xd2db('0xf')],'transfereecalleridname':_0x3caa93[_0xd2db('0x10')],'transfereeconnectedlinenum':_0x3caa93[_0xd2db('0x11')],'transfereeconnectedlinename':_0x3caa93['transfereeconnectedlinename'],'transfereeaccountcode':_0x3caa93[_0xd2db('0x12')],'transfereecontext':_0x3caa93[_0xd2db('0x13')],'transfereeexten':_0x3caa93[_0xd2db('0x14')],'transfereelinkedid':_0x3caa93[_0xd2db('0x15')],'isexternal':_0x3caa93['isexternal'],'context':_0x3caa93[_0xd2db('0x16')],'extension':_0x3caa93[_0xd2db('0x17')],'type':_0xd2db('0x18')},'log':_0xd2db('0x4')});};exports[_0xd2db('0x19')]=function(_0x3232af){return client[_0xd2db('0x3')](_0xd2db('0x4'),{'body':{'result':_0x3232af[_0xd2db('0x5')],'transfererchannel':_0x3232af['origtransfererchannel'],'transferercalleridnum':_0x3232af['origtransferercalleridnum'],'transferercalleridname':_0x3232af[_0xd2db('0x1a')],'transfererconnectedlinenum':_0x3232af[_0xd2db('0x1b')],'transfererconnectedlinename':_0x3232af[_0xd2db('0x1c')],'transfereraccountcode':_0x3232af[_0xd2db('0x1d')],'transferercontext':_0x3232af[_0xd2db('0x1e')],'transfererexten':_0x3232af[_0xd2db('0x1f')],'transfererlinkedid':_0x3232af[_0xd2db('0x20')],'transfereechannel':_0x3232af['transfertargetchannel'],'transfereecalleridnum':_0x3232af['transfertargetcalleridnum'],'transfereecalleridname':_0x3232af['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3232af[_0xd2db('0x21')],'transfereeconnectedlinename':_0x3232af['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3232af[_0xd2db('0x22')],'transfereecontext':_0x3232af[_0xd2db('0x23')],'transfereeexten':_0x3232af['transfertargetexten'],'transfereelinkedid':_0x3232af[_0xd2db('0x24')],'isexternal':_0x3232af['isexternal'],'context':_0x3232af[_0xd2db('0x25')],'extension':_0x3232af[_0xd2db('0x26')],'type':_0xd2db('0x27')},'log':_0xd2db('0x4')});}; \ No newline at end of file +var _0x9aeb=['attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetlinkedid','isexternal','origtransfererexten'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x9aeb,0x17d));var _0xb9ae=function(_0x70c9b,_0xa5fb7d){_0x70c9b=_0x70c9b-0x0;var _0x41c194=_0x9aeb[_0x70c9b];return _0x41c194;};'use strict';var client=require(_0xb9ae('0x0'));exports[_0xb9ae('0x1')]={};exports[_0xb9ae('0x2')]=function(_0xc6aa63){return client[_0xb9ae('0x3')](_0xb9ae('0x4'),{'body':{'result':_0xc6aa63[_0xb9ae('0x5')],'transfererchannel':_0xc6aa63[_0xb9ae('0x6')],'transferercalleridnum':_0xc6aa63[_0xb9ae('0x7')],'transferercalleridname':_0xc6aa63[_0xb9ae('0x8')],'transfererconnectedlinenum':_0xc6aa63[_0xb9ae('0x9')],'transfererconnectedlinename':_0xc6aa63['transfererconnectedlinename'],'transfereraccountcode':_0xc6aa63['transfereraccountcode'],'transferercontext':_0xc6aa63[_0xb9ae('0xa')],'transfererexten':_0xc6aa63['transfererexten'],'transfererlinkedid':_0xc6aa63[_0xb9ae('0xb')],'transfereechannel':_0xc6aa63[_0xb9ae('0xc')],'transfereecalleridnum':_0xc6aa63[_0xb9ae('0xd')],'transfereecalleridname':_0xc6aa63['transfereecalleridname'],'transfereeconnectedlinenum':_0xc6aa63[_0xb9ae('0xe')],'transfereeconnectedlinename':_0xc6aa63[_0xb9ae('0xf')],'transfereeaccountcode':_0xc6aa63[_0xb9ae('0x10')],'transfereecontext':_0xc6aa63[_0xb9ae('0x11')],'transfereeexten':_0xc6aa63['transfereeexten'],'transfereelinkedid':_0xc6aa63[_0xb9ae('0x12')],'isexternal':_0xc6aa63['isexternal'],'context':_0xc6aa63[_0xb9ae('0x13')],'extension':_0xc6aa63[_0xb9ae('0x14')],'type':_0xb9ae('0x15')},'log':_0xb9ae('0x4')});};exports['attendedTransfer']=function(_0x257c12){return client[_0xb9ae('0x3')](_0xb9ae('0x4'),{'body':{'result':_0x257c12['result'],'transfererchannel':_0x257c12[_0xb9ae('0x16')],'transferercalleridnum':_0x257c12[_0xb9ae('0x17')],'transferercalleridname':_0x257c12['origtransferercalleridname'],'transfererconnectedlinenum':_0x257c12[_0xb9ae('0x18')],'transfererconnectedlinename':_0x257c12[_0xb9ae('0x19')],'transfereraccountcode':_0x257c12['origtransfereraccountcode'],'transferercontext':_0x257c12[_0xb9ae('0x1a')],'transfererexten':_0x257c12[_0xb9ae('0x1b')],'transfererlinkedid':_0x257c12[_0xb9ae('0x1c')],'transfereechannel':_0x257c12[_0xb9ae('0x1d')],'transfereecalleridnum':_0x257c12[_0xb9ae('0x1e')],'transfereecalleridname':_0x257c12[_0xb9ae('0x1f')],'transfereeconnectedlinenum':_0x257c12[_0xb9ae('0x20')],'transfereeconnectedlinename':_0x257c12['transfertargetconnectedlinename'],'transfereeaccountcode':_0x257c12['transfertargetaccountcode'],'transfereecontext':_0x257c12[_0xb9ae('0x21')],'transfereeexten':_0x257c12['transfertargetexten'],'transfereelinkedid':_0x257c12[_0xb9ae('0x22')],'isexternal':_0x257c12[_0xb9ae('0x23')],'context':_0x257c12['origtransferercontext'],'extension':_0x257c12[_0xb9ae('0x24')],'type':_0xb9ae('0x25')},'log':_0xb9ae('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f01120d..800bb12 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 _0x9957=['content','error','voiceQueues','hasOwnProperty','push','find','undefined','channels','length','voicechannel','uniqueid','format','%s.%s','MixMonitor','channel','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','stop','/var/spool/asterisk/monitor/','values','queueChannels','inbound','includes','type','count','rows','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Action','then','message','catch','isConnected','command','Command'];(function(_0x22498b,_0xf605c8){var _0x9c0dfb=function(_0x2ba715){while(--_0x2ba715){_0x22498b['push'](_0x22498b['shift']());}};_0x9c0dfb(++_0xf605c8);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var jayson=require(_0x7995('0x2'));var schema=require(_0x7995('0x3'));var moment=require('moment');var config=require(_0x7995('0x4'));var properties=require(_0x7995('0x5'));var ami=require(_0x7995('0x6'));var VoiceQueueSummary=require(_0x7995('0x7'));exports['listen']=function(_0x744bea,_0x1a36d8,_0x137b6b){return new Promise(function(_0x219534,_0xbda126){var _0x326741={'QueuePause':function(_0x4996ca){return new Promise(function(_0x465276){var _0x1cad37=util['format'](_0x7995('0x8'),_0x7995('0x9'),_0x4996ca[_0x7995('0xa')]);if(_0x744bea[_0x7995('0xb')]&&_0x744bea[_0x7995('0xb')][_0x1cad37]&&_0x744bea[_0x7995('0xb')][_0x1cad37][_0x7995('0xc')]){_0x744bea['timers'][_0x1cad37][_0x7995('0xd')]();}if(_0x744bea[_0x7995('0xe')][_0x1cad37]){_0x744bea['agents'][_0x1cad37][_0x7995('0xf')]({'statePause':_0x4996ca[_0x7995('0x10')]?!![]:![]});}_0x465276({'code':0xc8,'message':_0x7995('0x11')});});},'Reload':function(_0x385f00){var _0x281576=this;return new Promise(function(_0x23999f,_0x2bbe7a){if(ami['isConnected']()==![]){return _0x2bbe7a(_0x281576['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x385f00=_[_0x7995('0x16')](_0x385f00,_[_0x7995('0x17')](properties[_0x7995('0x18')]['module']));_0x385f00[_0x7995('0x19')]='Reload';return ami[_0x7995('0x1a')](_0x385f00)[_0x7995('0x1b')](function(_0x43d4b8){_0x23999f({'code':0xc8,'message':_0x43d4b8[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x37a7d4){_0x2bbe7a(_0x281576['error'](0x1f5,_0x37a7d4['message']));});});},'Command':function(_0x2536c8){var _0x5e6f90=this;return new Promise(function(_0x555f74,_0x3ec178){if(ami[_0x7995('0x1e')]()==![]){return _0x3ec178(_0x5e6f90['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk']['username'],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x2536c8=_[_0x7995('0x16')](_0x2536c8,_0x7995('0x1f'));_0x2536c8[_0x7995('0x19')]=_0x7995('0x20');return ami['Action'](_0x2536c8)[_0x7995('0x1b')](function(_0x46ee4b){_0x555f74({'code':0xc8,'message':_0x46ee4b[_0x7995('0x21')]});})[_0x7995('0x1d')](function(_0x563799){_0x3ec178(_0x5e6f90[_0x7995('0x22')](0x1f5,_0x563799[_0x7995('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x472195){var _0x59405a=[];for(var _0x39df42 in _0x744bea[_0x7995('0x23')]){if(_0x744bea[_0x7995('0x23')][_0x7995('0x24')](_0x39df42)){var _0x3a3fcf=_0x744bea[_0x7995('0x23')][_0x39df42];var _0x56691a=new VoiceQueueSummary(_0x3a3fcf);_0x59405a[_0x7995('0x25')](_0x56691a);}}_0x472195({'count':_0x59405a['length'],'rows':_0x59405a});});},'UpdateVoiceQueue':function(_0x229742){return new Promise(function(_0x49bc7e,_0xf16cc2){var _0x132a42=_[_0x7995('0x26')](_0x744bea['voiceQueues'],{'id':parseInt(_0x229742['id'])});var _0x9b2a15=_['omit'](_0x229742,['id']);if(_0x132a42){for(var _0x456a28 in _0x9b2a15){if(typeof _0x9b2a15[_0x456a28]!==_0x7995('0x27')&&typeof _0x132a42[_0x456a28]!==_0x7995('0x27')){_0x132a42[_0x456a28]=_0x9b2a15[_0x456a28];}}_0x49bc7e(_0x132a42);}else{_0xf16cc2();}});},'VoiceChannels':function(){return new Promise(function(_0x574574){var _0x530611=_['values'](_0x744bea[_0x7995('0x28')]);_0x574574({'count':_0x530611[_0x7995('0x29')],'rows':_0x530611});});},'VoiceChannelMixMonitor':function(_0x327a81){var _0x2b874d=this;return new Promise(function(_0x2e3493,_0x1ca460){if(ami['isConnected']()==![]){return _0x1ca460(_0x2b874d['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x1e9fa4=schema(properties[_0x7995('0x2a')])['validate'](_0x327a81);if(_0x1e9fa4[_0x7995('0x29')]>0x0){return _0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f4,_['map'](_0x1e9fa4,'message')['join'](',\x20')));}var _0x45bc5e=_[_0x7995('0x26')](_0x744bea['channels'],{'uniqueid':_0x327a81[_0x7995('0x2b')]});if(_0x45bc5e&&_0x45bc5e['channel']){var _0x37917b=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x327a81['filename']||_0x327a81['uniqueid'],_0x327a81[_0x7995('0x2c')]||'wav');return ami['Action']({'action':_0x7995('0x2e'),'channel':_0x45bc5e[_0x7995('0x2f')],'file':_0x37917b,'options':'ai(mixmonitorid)'})[_0x7995('0x1b')](function(_0x1922b4){var _0x2b772f=_[_0x7995('0x26')](_0x45bc5e[_0x7995('0x30')],{'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')]()});if(_[_0x7995('0x32')](_0x2b772f)){_0x45bc5e[_0x7995('0x30')][_0x7995('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')](),'createdAt':moment()[_0x7995('0x2c')](_0x7995('0x33')),'mixmonitorid':_0x1922b4[_0x7995('0x34')],'status':_0x7995('0x35')});}else{_0x2b772f[_0x7995('0x34')]=_0x1922b4['mixmonitorid'];_0x2b772f[_0x7995('0x36')]=_0x7995('0x35');}_0x2e3493({'code':0xc8,'message':[_0x327a81[_0x7995('0x2b')],_0x7995('0x37'),_0x1922b4[_0x7995('0x34')]][_0x7995('0x15')]('\x20'),'mixmonitorid':_0x1922b4[_0x7995('0x34')]});})[_0x7995('0x1d')](function(_0x1234e1){_0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f5,[_0x327a81[_0x7995('0x2b')],_0x1234e1[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x1ca460(_0x2b874d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x7325e8){var _0x58523e=this;return new Promise(function(_0x4b0855,_0x3f8522){if(ami['isConnected']()==![]){return _0x3f8522(_0x58523e['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],'ami\x20disconnected'][_0x7995('0x15')]('\x20')));}var _0x5e85b9=schema(properties[_0x7995('0x2a')])['validate'](_0x7325e8);if(_0x5e85b9['length']>0x0){return _0x3f8522(_0x58523e[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x5e85b9,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x599ecb=_[_0x7995('0x26')](_0x744bea[_0x7995('0x28')],{'uniqueid':_0x7325e8[_0x7995('0x2b')]});if(_0x599ecb){return Promise[_0x7995('0x3a')]()['then'](function(){if(_0x599ecb['channel']){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x2f')],'mixmonitorid':_0x7325e8['mixmonitorid']})[_0x7995('0x1d')](function(){});}})['then'](function(){if(_0x599ecb[_0x7995('0x3b')]){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x3b')],'mixmonitorid':_0x7325e8[_0x7995('0x34')]})[_0x7995('0x1d')](function(){});}})[_0x7995('0x1b')](function(){var _0x4c6837=_[_0x7995('0x26')](_0x599ecb[_0x7995('0x30')],{'mixmonitorid':_0x7325e8[_0x7995('0x34')]});if(_0x4c6837){_0x4c6837['status']=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){var _0x511567=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x7325e8['filename']||_0x7325e8[_0x7995('0x2b')],_0x7325e8[_0x7995('0x2c')]||'wav');var _0x3d1dbb=_['find'](_0x599ecb[_0x7995('0x30')],{'filename':_0x7995('0x3d')+_0x511567[_0x7995('0x31')]()});if(_0x3d1dbb){_0x3d1dbb[_0x7995('0x36')]=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){_0x4b0855({'code':0xc8,'message':[_0x7325e8[_0x7995('0x2b')],'StopMixMonitor\x20Success'][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x418eb9){_0x3f8522(_0x58523e['error'](0x1f5,[_0x7325e8[_0x7995('0x2b')],_0x418eb9[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x3f8522(_0x58523e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xb70620){var _0x1fd1ca=this;return new Promise(function(_0x4cf5db){var _0x1cd85=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x3f')]);var _0x1a9bd7={'count':_0x1cd85[_0x7995('0x29')],'rows':_0x1cd85};if(_0xb70620&&_0xb70620['type']){if(![_0x7995('0x40'),'outbound'][_0x7995('0x41')](_0xb70620[_0x7995('0x42')])){return _0xbda126(_0x1fd1ca[_0x7995('0x22')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x5e1f34=_['filter'](_0x1cd85,function(_0x563f8e){return _0x563f8e[_0x7995('0x42')]===_0xb70620[_0x7995('0x42')];});_0x1a9bd7[_0x7995('0x43')]=_0x5e1f34[_0x7995('0x29')];_0x1a9bd7[_0x7995('0x44')]=_0x5e1f34;}_0x4cf5db(_0x1a9bd7);});},'VoiceQueuesChannel':function(_0x357e60){var _0x1f4270=this;return new Promise(function(_0xda6ce8,_0x328671){var _0x17ecd3=schema(properties[_0x7995('0x45')])[_0x7995('0x3')](_0x357e60);if(_0x17ecd3[_0x7995('0x29')]>0x0){return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x17ecd3,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x223e08=_[_0x7995('0x26')](_0x744bea['queueChannels'],{'uniqueid':_0x357e60[_0x7995('0x2b')]});if(_0x223e08){_0xda6ce8(_0x223e08);}else{return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x32c0d3){var _0x5d160d=this;return new Promise(function(_0x53125a,_0x402fa0){if(ami[_0x7995('0x1e')]()==![]){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x33c49c=schema(properties['voicequeuechannelhangup'])['validate'](_0x32c0d3);if(_0x33c49c[_0x7995('0x29')]>0x0){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x33c49c,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x27c5cd=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0x32c0d3[_0x7995('0x2b')]});if(_0x27c5cd&&_0x27c5cd['channel']){return ami[_0x7995('0x1a')]({'action':_0x7995('0x46'),'channel':_0x27c5cd[_0x7995('0x2f')]})[_0x7995('0x1b')](function(_0x59c5aa){_0x53125a({'code':0xc8,'message':[_0x32c0d3['uniqueid'],_0x59c5aa[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')});})[_0x7995('0x1d')](function(_0x375fc9){_0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f5,[_0x32c0d3[_0x7995('0x2b')],_0x375fc9[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x402fa0(_0x5d160d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0xe31dcb){var _0x1722e2=this;return new Promise(function(_0x25b534,_0x4388c1){if(ami[_0x7995('0x1e')]()==![]){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x56eb85=schema(properties[_0x7995('0x47')])[_0x7995('0x3')](_0xe31dcb);if(_0x56eb85[_0x7995('0x29')]>0x0){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x56eb85,'message')['join'](',\x20')));}var _0x268fde=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0xe31dcb[_0x7995('0x2b')]});if(_0x268fde&&_0x268fde['channel']){return ami[_0x7995('0x1a')]({'action':'Redirect','channel':_0x268fde['channel'],'exten':_0xe31dcb[_0x7995('0x48')],'context':_0xe31dcb[_0x7995('0x49')]||_0x268fde[_0x7995('0x49')],'priority':0x1})[_0x7995('0x1b')](function(_0x290eae){_0x25b534({'code':0xc8,'message':[_0xe31dcb[_0x7995('0x2b')],_0x290eae[_0x7995('0x1c')][_0x7995('0x31')]()][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x560b0a){_0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,[_0xe31dcb[_0x7995('0x2b')],_0x560b0a[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'Agents':function(_0x3a7d9d){return new Promise(function(_0x3b0d30){var _0x51ab1e=_[_0x7995('0x3e')](_0x744bea[_0x7995('0xe')]);if(_0x3a7d9d&&_0x3a7d9d['id']){var _0x2f94c4=_[_0x7995('0x26')](_0x51ab1e,function(_0x435a1b){return _0x435a1b['id']===_0x3a7d9d['id'];});_0x3b0d30(_0x2f94c4);}else{_0x3b0d30({'count':_0x51ab1e['length'],'rows':_0x51ab1e});}});},'Telephones':function(){return new Promise(function(_0x5e8b4c){var _0xd07c1c=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x4a')]);_0x5e8b4c({'count':_0xd07c1c[_0x7995('0x29')],'rows':_0xd07c1c});});},'Trunks':function(){return new Promise(function(_0x4dbab8){var _0x3b45e8=_[_0x7995('0x3e')](_0x744bea['trunks']);_0x4dbab8({'count':_0x3b45e8['length'],'rows':_0x3b45e8});});},'OutboundChannels':function(){return new Promise(function(_0x3253b5){var _0x305b5a=_['values'](_0x744bea[_0x7995('0x4b')]);_0x3253b5({'count':_0x305b5a['length'],'rows':_0x305b5a});});},'Outbound':function(){return new Promise(function(_0x3758f9){_0x3758f9(_0x744bea[_0x7995('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x4ff9ff){var _0x5d9d33=_[_0x7995('0x3e')](_0x744bea['campaigns']);_0x4ff9ff({'count':_0x5d9d33[_0x7995('0x29')],'rows':_0x5d9d33});});},'VoiceQueuesPreview':function(_0xa41fff){var _0x3dd197=this;return new Promise(function(_0x45bd8a,_0x1a1873){_0x1a36d8[_0x7995('0x4d')](_0xa41fff['id'])[_0x7995('0x1b')](function(_0x14cb17){_0x45bd8a({'code':0xc8,'message':_0x14cb17[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x1ab590){_0x1a1873(_0x3dd197[_0x7995('0x22')](0x1f4,_0x1ab590[_0x7995('0x1c')]));});});},'EventManager':function(_0x1ff436){var _0x36e3a7=this;return new Promise(function(_0x3773de,_0x6ad274){if(!_0x1ff436[_0x7995('0x4e')]){return _0x6ad274(_0x36e3a7[_0x7995('0x22')](0x1f4,_0x7995('0x4f')));}ami[_0x7995('0x50')](_0x7995('0x51')+_0x1ff436[_0x7995('0x4e')],_0x1ff436[_0x7995('0x1c')]);_0x3773de({'code':0xc8,'message':_0x1ff436});});},'FaxAccounts':function(){return new Promise(function(_0x260ef1){var _0x33479a=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x52')]);_0x260ef1({'count':_0x33479a['length'],'rows':_0x33479a});});},'SendFax':function(_0x3fdb4b){var _0x10f4ca=this;return new Promise(function(_0x5683b2,_0x4c85cb){_0x137b6b[_0x7995('0x53')](_0x3fdb4b)[_0x7995('0x1b')](function(_0x2d45d5){_0x5683b2({'code':0xc8,'message':_0x2d45d5[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x2491fe){_0x4c85cb(_0x10f4ca['error'](0x1f4,_0x2491fe[_0x7995('0x1c')]));});});},'CheckAfterSend':function(_0xb68962){var _0x3fea6a=this;return new Promise(function(_0x77b03f,_0x7d9c6e){_0x137b6b[_0x7995('0x54')](_0xb68962)[_0x7995('0x1b')](function(_0xc93dcb){_0x77b03f({'code':0xc8,'message':_0xc93dcb['message']});})[_0x7995('0x1d')](function(_0x2b8217){_0x7d9c6e(_0x3fea6a['error'](0x1f4,_0x2b8217['message']));});});}};var _0xd24c64=jayson[_0x7995('0x55')](_0x326741)[_0x7995('0x56')]();_0xd24c64['on'](_0x7995('0x22'),function(_0xe42797){return _0xbda126(_0xe42797);});_0xd24c64['listen'](0x232a,_0x7995('0x57'),function(){console[_0x7995('0x58')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219534(_0x7995('0x59')+0x232a);});});}; \ No newline at end of file +var _0xf494=['event','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','module','action','Reload','then','message','username','command','Action','content','catch','voiceQueues','hasOwnProperty','push','length','find','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','inbound','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','emit'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf494,0x1c6));var _0x4f49=function(_0x345284,_0xc566d7){_0x345284=_0x345284-0x0;var _0x5b6f42=_0xf494[_0x345284];return _0x5b6f42;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var jayson=require(_0x4f49('0x2'));var schema=require('validate');var moment=require(_0x4f49('0x3'));var config=require(_0x4f49('0x4'));var properties=require(_0x4f49('0x5'));var ami=require(_0x4f49('0x6'));var VoiceQueueSummary=require(_0x4f49('0x7'));exports[_0x4f49('0x8')]=function(_0x3267c1,_0x790e8b,_0xc5e778){return new Promise(function(_0x413530,_0x42b0e8){var _0x5eb186={'QueuePause':function(_0x58e9a0){return new Promise(function(_0x169c95){var _0x327bd5=util[_0x4f49('0x9')](_0x4f49('0xa'),_0x4f49('0xb'),_0x58e9a0[_0x4f49('0xc')]);if(_0x3267c1[_0x4f49('0xd')]&&_0x3267c1[_0x4f49('0xd')][_0x327bd5]&&_0x3267c1['timers'][_0x327bd5][_0x4f49('0xe')]){_0x3267c1[_0x4f49('0xd')][_0x327bd5]['updateAcw']();}if(_0x3267c1[_0x4f49('0xf')][_0x327bd5]){_0x3267c1['agents'][_0x327bd5]['updateStatusRealtime']({'statePause':_0x58e9a0[_0x4f49('0x10')]?!![]:![]});}_0x169c95({'code':0xc8,'message':_0x4f49('0x11')});});},'Reload':function(_0x4bf89f){var _0x1e1c37=this;return new Promise(function(_0x111a8b,_0x1b9145){if(ami[_0x4f49('0x12')]()==![]){return _0x1b9145(_0x1e1c37[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')]['username'],_0x4f49('0x15')][_0x4f49('0x16')]('\x20')));}_0x4bf89f=_[_0x4f49('0x17')](_0x4bf89f,_['keys'](properties['reload'][_0x4f49('0x18')]));_0x4bf89f[_0x4f49('0x19')]=_0x4f49('0x1a');return ami['Action'](_0x4bf89f)[_0x4f49('0x1b')](function(_0x399be7){_0x111a8b({'code':0xc8,'message':_0x399be7[_0x4f49('0x1c')]});})['catch'](function(_0x5bb23b){_0x1b9145(_0x1e1c37['error'](0x1f5,_0x5bb23b['message']));});});},'Command':function(_0xb2081a){var _0x1834f4=this;return new Promise(function(_0x1c2d70,_0x407042){if(ami['isConnected']()==![]){return _0x407042(_0x1834f4[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x1d')],_0x4f49('0x15')]['join']('\x20')));}_0xb2081a=_[_0x4f49('0x17')](_0xb2081a,_0x4f49('0x1e'));_0xb2081a[_0x4f49('0x19')]='Command';return ami[_0x4f49('0x1f')](_0xb2081a)[_0x4f49('0x1b')](function(_0x32ca7b){_0x1c2d70({'code':0xc8,'message':_0x32ca7b[_0x4f49('0x20')]});})[_0x4f49('0x21')](function(_0x36187b){_0x407042(_0x1834f4['error'](0x1f5,_0x36187b['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x3a947b){var _0x429de7=[];for(var _0x4fedbb in _0x3267c1[_0x4f49('0x22')]){if(_0x3267c1[_0x4f49('0x22')][_0x4f49('0x23')](_0x4fedbb)){var _0x525950=_0x3267c1[_0x4f49('0x22')][_0x4fedbb];var _0x2eed1c=new VoiceQueueSummary(_0x525950);_0x429de7[_0x4f49('0x24')](_0x2eed1c);}}_0x3a947b({'count':_0x429de7[_0x4f49('0x25')],'rows':_0x429de7});});},'UpdateVoiceQueue':function(_0xfefbab){return new Promise(function(_0x122404,_0x4915af){var _0x50c571=_[_0x4f49('0x26')](_0x3267c1[_0x4f49('0x22')],{'id':parseInt(_0xfefbab['id'])});var _0x605c91=_['omit'](_0xfefbab,['id']);if(_0x50c571){for(var _0x3cbfbd in _0x605c91){if(typeof _0x605c91[_0x3cbfbd]!==_0x4f49('0x27')&&typeof _0x50c571[_0x3cbfbd]!==_0x4f49('0x27')){_0x50c571[_0x3cbfbd]=_0x605c91[_0x3cbfbd];}}_0x122404(_0x50c571);}else{_0x4915af();}});},'VoiceChannels':function(){return new Promise(function(_0x506b20){var _0x4dd55a=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0x29')]);_0x506b20({'count':_0x4dd55a[_0x4f49('0x25')],'rows':_0x4dd55a});});},'VoiceChannelMixMonitor':function(_0x5e7076){var _0x1eaac6=this;return new Promise(function(_0x35aa33,_0x173657){if(ami[_0x4f49('0x12')]()==![]){return _0x173657(_0x1eaac6[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x1d')],_0x4f49('0x15')][_0x4f49('0x16')]('\x20')));}var _0x2291d4=schema(properties[_0x4f49('0x2a')])[_0x4f49('0x2b')](_0x5e7076);if(_0x2291d4[_0x4f49('0x25')]>0x0){return _0x173657(_0x1eaac6[_0x4f49('0x13')](0x1f4,_[_0x4f49('0x2c')](_0x2291d4,_0x4f49('0x1c'))[_0x4f49('0x16')](',\x20')));}var _0x3e7a08=_['find'](_0x3267c1[_0x4f49('0x29')],{'uniqueid':_0x5e7076[_0x4f49('0x2d')]});if(_0x3e7a08&&_0x3e7a08[_0x4f49('0x2e')]){var _0x1cb3cc=util[_0x4f49('0x9')](_0x4f49('0x2f'),_0x5e7076[_0x4f49('0x30')]||_0x5e7076[_0x4f49('0x2d')],_0x5e7076[_0x4f49('0x9')]||_0x4f49('0x31'));return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x32'),'channel':_0x3e7a08[_0x4f49('0x2e')],'file':_0x1cb3cc,'options':'ai(mixmonitorid)'})[_0x4f49('0x1b')](function(_0x27b7a9){var _0x36000a=_[_0x4f49('0x26')](_0x3e7a08[_0x4f49('0x33')],{'filename':_0x4f49('0x34')+_0x1cb3cc[_0x4f49('0x35')]()});if(_[_0x4f49('0x36')](_0x36000a)){_0x3e7a08[_0x4f49('0x33')][_0x4f49('0x24')]({'filename':_0x4f49('0x34')+_0x1cb3cc[_0x4f49('0x35')](),'createdAt':moment()[_0x4f49('0x9')](_0x4f49('0x37')),'mixmonitorid':_0x27b7a9['mixmonitorid'],'status':_0x4f49('0x38')});}else{_0x36000a[_0x4f49('0x39')]=_0x27b7a9['mixmonitorid'];_0x36000a[_0x4f49('0x3a')]=_0x4f49('0x38');}_0x35aa33({'code':0xc8,'message':[_0x5e7076['uniqueid'],_0x4f49('0x3b'),_0x27b7a9[_0x4f49('0x39')]][_0x4f49('0x16')]('\x20'),'mixmonitorid':_0x27b7a9[_0x4f49('0x39')]});})[_0x4f49('0x21')](function(_0x3d5cf2){_0x173657(_0x1eaac6[_0x4f49('0x13')](0x1f5,[_0x5e7076['uniqueid'],_0x3d5cf2['message']['toLowerCase']()][_0x4f49('0x16')]('\x20')));});}else{return _0x173657(_0x1eaac6[_0x4f49('0x13')](0x1f5,_0x4f49('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x373f90){var _0x1053b2=this;return new Promise(function(_0x1ecf6c,_0x38aff8){if(ami[_0x4f49('0x12')]()==![]){return _0x38aff8(_0x1053b2[_0x4f49('0x13')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x4f49('0x1d')],_0x4f49('0x15')][_0x4f49('0x16')]('\x20')));}var _0x58281d=schema(properties[_0x4f49('0x2a')])['validate'](_0x373f90);if(_0x58281d['length']>0x0){return _0x38aff8(_0x1053b2[_0x4f49('0x13')](0x1f4,_[_0x4f49('0x2c')](_0x58281d,_0x4f49('0x1c'))['join'](',\x20')));}var _0x287781=_[_0x4f49('0x26')](_0x3267c1['channels'],{'uniqueid':_0x373f90[_0x4f49('0x2d')]});if(_0x287781){return Promise['resolve']()[_0x4f49('0x1b')](function(){if(_0x287781[_0x4f49('0x2e')]){return ami[_0x4f49('0x1f')]({'action':'StopMixMonitor','channel':_0x287781[_0x4f49('0x2e')],'mixmonitorid':_0x373f90[_0x4f49('0x39')]})[_0x4f49('0x21')](function(){});}})[_0x4f49('0x1b')](function(){if(_0x287781[_0x4f49('0x3d')]){return ami[_0x4f49('0x1f')]({'action':_0x4f49('0x3e'),'channel':_0x287781[_0x4f49('0x3d')],'mixmonitorid':_0x373f90[_0x4f49('0x39')]})[_0x4f49('0x21')](function(){});}})['then'](function(){var _0x26c222=_[_0x4f49('0x26')](_0x287781['monitors'],{'mixmonitorid':_0x373f90[_0x4f49('0x39')]});if(_0x26c222){_0x26c222['status']=_0x4f49('0x3f');}})[_0x4f49('0x1b')](function(){var _0x2d3dcd=util[_0x4f49('0x9')]('%s.%s',_0x373f90[_0x4f49('0x30')]||_0x373f90[_0x4f49('0x2d')],_0x373f90[_0x4f49('0x9')]||_0x4f49('0x31'));var _0x3ec266=_[_0x4f49('0x26')](_0x287781[_0x4f49('0x33')],{'filename':_0x4f49('0x34')+_0x2d3dcd[_0x4f49('0x35')]()});if(_0x3ec266){_0x3ec266[_0x4f49('0x3a')]=_0x4f49('0x3f');}})[_0x4f49('0x1b')](function(){_0x1ecf6c({'code':0xc8,'message':[_0x373f90[_0x4f49('0x2d')],_0x4f49('0x40')][_0x4f49('0x16')]('\x20')});})[_0x4f49('0x21')](function(_0x526a91){_0x38aff8(_0x1053b2['error'](0x1f5,[_0x373f90[_0x4f49('0x2d')],_0x526a91[_0x4f49('0x1c')][_0x4f49('0x35')]()][_0x4f49('0x16')]('\x20')));});}else{return _0x38aff8(_0x1053b2[_0x4f49('0x13')](0x1f5,_0x4f49('0x3c')));}});},'VoiceQueuesChannels':function(_0x2c5599){var _0x51c756=this;return new Promise(function(_0x6637f4){var _0x4ff0a2=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0x41')]);var _0x3ab4ea={'count':_0x4ff0a2[_0x4f49('0x25')],'rows':_0x4ff0a2};if(_0x2c5599&&_0x2c5599['type']){if(![_0x4f49('0x42'),'outbound']['includes'](_0x2c5599[_0x4f49('0x43')])){return _0x42b0e8(_0x51c756[_0x4f49('0x13')](0x190,_0x4f49('0x44')));}var _0x26ae33=_['filter'](_0x4ff0a2,function(_0x599c51){return _0x599c51[_0x4f49('0x43')]===_0x2c5599[_0x4f49('0x43')];});_0x3ab4ea['count']=_0x26ae33[_0x4f49('0x25')];_0x3ab4ea['rows']=_0x26ae33;}_0x6637f4(_0x3ab4ea);});},'VoiceQueuesChannel':function(_0x5a929a){var _0xf90696=this;return new Promise(function(_0x5f3a80,_0xfa7dd6){var _0x492aaa=schema(properties[_0x4f49('0x45')])[_0x4f49('0x2b')](_0x5a929a);if(_0x492aaa[_0x4f49('0x25')]>0x0){return _0xfa7dd6(_0xf90696[_0x4f49('0x13')](0x1f4,_[_0x4f49('0x2c')](_0x492aaa,_0x4f49('0x1c'))[_0x4f49('0x16')](',\x20')));}var _0x3389e6=_['find'](_0x3267c1[_0x4f49('0x41')],{'uniqueid':_0x5a929a['uniqueid']});if(_0x3389e6){_0x5f3a80(_0x3389e6);}else{return _0xfa7dd6(_0xf90696[_0x4f49('0x13')](0x1f5,_0x4f49('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0xc4fc6b){var _0x467f12=this;return new Promise(function(_0x1981e0,_0xb7538c){if(ami['isConnected']()==![]){return _0xb7538c(_0x467f12[_0x4f49('0x13')](0x1f4,[config[_0x4f49('0x14')]['ip'],config['asterisk']['username'],_0x4f49('0x15')][_0x4f49('0x16')]('\x20')));}var _0x2e0df5=schema(properties[_0x4f49('0x46')])[_0x4f49('0x2b')](_0xc4fc6b);if(_0x2e0df5['length']>0x0){return _0xb7538c(_0x467f12[_0x4f49('0x13')](0x1f4,_['map'](_0x2e0df5,_0x4f49('0x1c'))[_0x4f49('0x16')](',\x20')));}var _0x2a2b0d=_['find'](_0x3267c1[_0x4f49('0x41')],{'uniqueid':_0xc4fc6b[_0x4f49('0x2d')]});if(_0x2a2b0d&&_0x2a2b0d[_0x4f49('0x2e')]){return ami[_0x4f49('0x1f')]({'action':'Hangup','channel':_0x2a2b0d[_0x4f49('0x2e')]})[_0x4f49('0x1b')](function(_0x5e6898){_0x1981e0({'code':0xc8,'message':[_0xc4fc6b[_0x4f49('0x2d')],_0x5e6898[_0x4f49('0x1c')][_0x4f49('0x35')]()][_0x4f49('0x16')]('\x20')});})[_0x4f49('0x21')](function(_0x1b80f2){_0xb7538c(_0x467f12[_0x4f49('0x13')](0x1f5,[_0xc4fc6b[_0x4f49('0x2d')],_0x1b80f2['message'][_0x4f49('0x35')]()][_0x4f49('0x16')]('\x20')));});}else{return _0xb7538c(_0x467f12[_0x4f49('0x13')](0x1f5,_0x4f49('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x30e7f7){var _0x26b022=this;return new Promise(function(_0x335875,_0x5426d6){if(ami[_0x4f49('0x12')]()==![]){return _0x5426d6(_0x26b022['error'](0x1f4,[config[_0x4f49('0x14')]['ip'],config[_0x4f49('0x14')][_0x4f49('0x1d')],_0x4f49('0x15')][_0x4f49('0x16')]('\x20')));}var _0x3f2f3f=schema(properties[_0x4f49('0x47')])[_0x4f49('0x2b')](_0x30e7f7);if(_0x3f2f3f[_0x4f49('0x25')]>0x0){return _0x5426d6(_0x26b022[_0x4f49('0x13')](0x1f4,_['map'](_0x3f2f3f,_0x4f49('0x1c'))[_0x4f49('0x16')](',\x20')));}var _0x2d5f40=_[_0x4f49('0x26')](_0x3267c1['queueChannels'],{'uniqueid':_0x30e7f7['uniqueid']});if(_0x2d5f40&&_0x2d5f40[_0x4f49('0x2e')]){return ami['Action']({'action':_0x4f49('0x48'),'channel':_0x2d5f40[_0x4f49('0x2e')],'exten':_0x30e7f7[_0x4f49('0x49')],'context':_0x30e7f7[_0x4f49('0x4a')]||_0x2d5f40[_0x4f49('0x4a')],'priority':0x1})[_0x4f49('0x1b')](function(_0x179431){_0x335875({'code':0xc8,'message':[_0x30e7f7[_0x4f49('0x2d')],_0x179431[_0x4f49('0x1c')][_0x4f49('0x35')]()][_0x4f49('0x16')]('\x20')});})[_0x4f49('0x21')](function(_0x2b3484){_0x5426d6(_0x26b022[_0x4f49('0x13')](0x1f5,[_0x30e7f7[_0x4f49('0x2d')],_0x2b3484[_0x4f49('0x1c')][_0x4f49('0x35')]()][_0x4f49('0x16')]('\x20')));});}else{return _0x5426d6(_0x26b022[_0x4f49('0x13')](0x1f5,_0x4f49('0x3c')));}});},'Agents':function(_0x2c3962){return new Promise(function(_0x3e9389){var _0xf6d04b=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0xf')]);if(_0x2c3962&&_0x2c3962['id']){var _0x49a79d=_[_0x4f49('0x26')](_0xf6d04b,function(_0x4ff0c1){return _0x4ff0c1['id']===_0x2c3962['id'];});_0x3e9389(_0x49a79d);}else{_0x3e9389({'count':_0xf6d04b[_0x4f49('0x25')],'rows':_0xf6d04b});}});},'Telephones':function(){return new Promise(function(_0x3b0990){var _0x38fe50=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0x4b')]);_0x3b0990({'count':_0x38fe50[_0x4f49('0x25')],'rows':_0x38fe50});});},'Trunks':function(){return new Promise(function(_0xfe14d3){var _0x33ae31=_[_0x4f49('0x28')](_0x3267c1['trunks']);_0xfe14d3({'count':_0x33ae31['length'],'rows':_0x33ae31});});},'OutboundChannels':function(){return new Promise(function(_0x539e21){var _0x592c3c=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0x4c')]);_0x539e21({'count':_0x592c3c[_0x4f49('0x25')],'rows':_0x592c3c});});},'Outbound':function(){return new Promise(function(_0x1c0ded){_0x1c0ded(_0x3267c1[_0x4f49('0x4d')]);});},'Campaigns':function(){return new Promise(function(_0x5a8b1c){var _0x4e0d42=_[_0x4f49('0x28')](_0x3267c1[_0x4f49('0x4e')]);_0x5a8b1c({'count':_0x4e0d42['length'],'rows':_0x4e0d42});});},'VoiceQueuesPreview':function(_0x8ba79d){var _0x2dca37=this;return new Promise(function(_0x5c824f,_0x24da23){_0x790e8b['run'](_0x8ba79d['id'])[_0x4f49('0x1b')](function(_0x160cf8){_0x5c824f({'code':0xc8,'message':_0x160cf8['message']});})[_0x4f49('0x21')](function(_0x4551d9){_0x24da23(_0x2dca37[_0x4f49('0x13')](0x1f4,_0x4551d9[_0x4f49('0x1c')]));});});},'EventManager':function(_0x204fd0){var _0x3f9b54=this;return new Promise(function(_0x5f0dbf,_0x25ed14){if(!_0x204fd0['event']){return _0x25ed14(_0x3f9b54[_0x4f49('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x4f49('0x4f')]('custom:'+_0x204fd0[_0x4f49('0x50')],_0x204fd0[_0x4f49('0x1c')]);_0x5f0dbf({'code':0xc8,'message':_0x204fd0});});},'FaxAccounts':function(){return new Promise(function(_0x18a618){var _0x2dbd0f=_['values'](_0x3267c1[_0x4f49('0x51')]);_0x18a618({'count':_0x2dbd0f['length'],'rows':_0x2dbd0f});});},'SendFax':function(_0x5ddfe4){var _0x534d88=this;return new Promise(function(_0x44da44,_0x4f2e07){_0xc5e778['send'](_0x5ddfe4)[_0x4f49('0x1b')](function(_0x20b2be){_0x44da44({'code':0xc8,'message':_0x20b2be[_0x4f49('0x1c')]});})['catch'](function(_0x289810){_0x4f2e07(_0x534d88[_0x4f49('0x13')](0x1f4,_0x289810['message']));});});},'CheckAfterSend':function(_0x5d52ae){var _0x5c2acd=this;return new Promise(function(_0x3fb913,_0x18d37f){_0xc5e778[_0x4f49('0x52')](_0x5d52ae)[_0x4f49('0x1b')](function(_0x1643fc){_0x3fb913({'code':0xc8,'message':_0x1643fc['message']});})[_0x4f49('0x21')](function(_0x1b922e){_0x18d37f(_0x5c2acd[_0x4f49('0x13')](0x1f4,_0x1b922e['message']));});});}};var _0x307be4=jayson[_0x4f49('0x53')](_0x5eb186)[_0x4f49('0x54')]();_0x307be4['on'](_0x4f49('0x13'),function(_0x5ea6b4){return _0x42b0e8(_0x5ea6b4);});_0x307be4[_0x4f49('0x8')](0x232a,_0x4f49('0x55'),function(){console[_0x4f49('0x56')](_0x4f49('0x57'),0x232a);return _0x413530(_0x4f49('0x58')+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 b5c0717..c3948b3 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 _0x5205=['data4','isNil','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','createdAt','scheduledAt','updatedAt','resolve','getContacts','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2bf03b,_0x1f8ca0){var _0x1a7d5d=function(_0x24972c){while(--_0x24972c){_0x2bf03b['push'](_0x2bf03b['shift']());}};_0x1a7d5d(++_0x1f8ca0);}(_0x5205,0x1e1));var _0x5520=function(_0x5a7314,_0x38678c){_0x5a7314=_0x5a7314-0x0;var _0x21037f=_0x5205[_0x5a7314];return _0x21037f;};'use strict';var _=require(_0x5520('0x0'));var BPromise=require(_0x5520('0x1'));var Redis=require('ioredis');var util=require(_0x5520('0x2'));var config=require(_0x5520('0x3'));var logger=require('../../../../config/logger')(_0x5520('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x5520('0x5')]=_[_0x5520('0x6')](config['redis'],{'host':_0x5520('0x7'),'port':0x18eb});var io=require(_0x5520('0x8'))(new Redis(config[_0x5520('0x5')]));function emit(_0x42a8df,_0x1d8fab,_0x50b0d2,_0x40fa21,_0x1220d7){logger[_0x5520('0x9')](_0x5520('0xa'),_0x42a8df,_0x1d8fab['id'],_0x50b0d2,_0x40fa21,JSON['stringify'](_0x1220d7));io['to'](_0x50b0d2)[_0x5520('0xb')](_0x40fa21,_0x1220d7);}exports[_0x5520('0xc')]=function(_0x20fe9a,_0x2937d9,_0x3a648b,_0x32c5c9){var _0x3941d7,_0x4520f0;var _0x5d8540={};var _0x781663;var _0x39941f=Number(_0x3a648b['data1']);var _0x3e7a9a=_0x3a648b['data2']?Boolean(Number(_0x3a648b[_0x5520('0xd')])):![];var _0x418773;var _0x36ec57=![];if(!_['isNil'](_0x3a648b['data5'])){if(_0x3a648b[_0x5520('0xe')]=='1')_0x36ec57=!![];}if(!_0x36ec57){if(_0x32c5c9[_0x5520('0xf')]){_0x5d8540['id']=_0x32c5c9[_0x5520('0xf')];}}if(!_0x5d8540['id']){_0x5d8540[_0x5520('0x10')]=_0x39941f;_0x418773=_0x3a648b[_0x5520('0x11')]&&_0x3a648b[_0x5520('0x11')]!=='0'?_0x3a648b['data3'][_0x5520('0x12')](','):['phone'];_0x5d8540[_0x5520('0x13')]=_[_0x5520('0x14')](_0x418773,function(_0xb9cf21){var _0x146b0a={};_0x146b0a[_0xb9cf21]=_0x32c5c9[_0x5520('0x15')]?_0x32c5c9[_0x5520('0x16')]:_0x32c5c9[_0x5520('0x17')];return _0x146b0a;});_0x781663=_0x32c5c9[_0x5520('0x15')]?_0x32c5c9[_0x5520('0x16')]:_0x32c5c9[_0x5520('0x17')];}var _0x410024=['id',_0x5520('0x18'),_0x5520('0x19'),_0x5520('0x1a'),'mobile','fax',_0x5520('0x10'),_0x5520('0x1b'),_0x5520('0x1c'),_0x5520('0x1d')];var _0x2805a7=_['union'](_0x410024,_0x418773);BPromise[_0x5520('0x1e')]()['then'](cmContactRpc[_0x5520('0x1f')]({'attributes':_0x2805a7,'where':_0x5d8540,'phone':_0x781663}))[_0x5520('0x20')](function(_0x1bf55a){_0x4520f0=_0x1bf55a;if(!_[_0x5520('0x21')](_0x4520f0)){if(_0x4520f0[_0x5520('0x22')]===0x1){_0x3941d7=_0x4520f0[0x0];logger[_0x5520('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_0x3941d7['id']);}else{logger[_0x5520('0x9')](_0x5520('0x24'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_['map'](_0x4520f0,'id')[_0x5520('0x25')](','));}return;}else{logger['info'](_0x5520('0x26'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);var _0x20955a={'ListId':_0x39941f};var _0xfd36ec=_0x3a648b[_0x5520('0x27')]&&_0x3a648b[_0x5520('0x27')]!=='0'?_0x3a648b['data4']:'phone';if(_0x3e7a9a){logger[_0x5520('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);_0x20955a[_0xfd36ec]=_[_0x5520('0x28')](_0x32c5c9[_0x5520('0x15')])?_0x32c5c9[_0x5520('0x17')]:_0x32c5c9[_0x5520('0x16')];if(_['isNil'](_0x32c5c9[_0x5520('0x15')])){_0x20955a[_0x5520('0x18')]=_0x32c5c9[_0x5520('0x29')]&&_0x32c5c9[_0x5520('0x29')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x29')]:'Unknown';}else{_0x20955a[_0x5520('0x18')]=_0x32c5c9[_0x5520('0x2b')]&&_0x32c5c9[_0x5520('0x2b')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x2b')]:_0x5520('0x2c');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x20955a))[_0x5520('0x20')](function(_0x1df36b){_0x3941d7=_0x1df36b;_0x4520f0[_0x5520('0x2d')](_0x1df36b);if(_0x3941d7){logger[_0x5520('0x9')](_0x5520('0x2e'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id'],_0x3941d7['id']);}return;});}else{logger[_0x5520('0x9')](_0x5520('0x2f'),_0x32c5c9[_0x5520('0x23')],_0x2937d9['id']);_0x20955a[_0xfd36ec]=_['isNil'](_0x32c5c9[_0x5520('0x15')])?_0x32c5c9[_0x5520('0x17')]:_0x32c5c9[_0x5520('0x16')];if(_[_0x5520('0x28')](_0x32c5c9[_0x5520('0x15')])){_0x20955a['firstName']=_0x32c5c9[_0x5520('0x29')]&&_0x32c5c9[_0x5520('0x29')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x29')]:_0x5520('0x2c');}else{_0x20955a['firstName']=_0x32c5c9[_0x5520('0x2b')]&&_0x32c5c9[_0x5520('0x2b')]!==_0x5520('0x2a')?_0x32c5c9[_0x5520('0x2b')]:_0x5520('0x2c');}_0x3941d7=_0x20955a;_0x4520f0[_0x5520('0x2d')](_0x20955a);return;}}})[_0x5520('0x20')](function(){if(_0x20fe9a){emit(_0x32c5c9[_0x5520('0x23')],_0x2937d9,util[_0x5520('0x30')]('user:%s',_0x20fe9a[_0x5520('0x31')]),util[_0x5520('0x30')]('trigger:%s',_0x3a648b[_0x5520('0x32')][_0x5520('0x33')]()),{'evt':_['merge'](_0x32c5c9,{'autoCreate':_0x3e7a9a}),'contact':_0x3941d7===undefined?{}:_0x3941d7,'contacts':_0x4520f0[_0x5520('0x22')]===0x0?undefined:_0x4520f0});}});}; \ No newline at end of file +var _0xd8c4=['defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','isNil','calleridname','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','push','format','user:%s','name','action','toLowerCase','merge','../../../../config/logger','trigger','../../rpc/cmContact','redis'];(function(_0x4cc2b5,_0x2f2be6){var _0x477333=function(_0x10d5fb){while(--_0x10d5fb){_0x4cc2b5['push'](_0x4cc2b5['shift']());}};_0x477333(++_0x2f2be6);}(_0xd8c4,0xd8));var _0x4d8c=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xd8c4[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x4d8c('0x0'))(_0x4d8c('0x1'));var cmContactRpc=require(_0x4d8c('0x2'));config[_0x4d8c('0x3')]=_[_0x4d8c('0x4')](config[_0x4d8c('0x3')],{'host':_0x4d8c('0x5'),'port':0x18eb});var io=require(_0x4d8c('0x6'))(new Redis(config[_0x4d8c('0x3')]));function emit(_0x8ee162,_0x235bed,_0x1ed4ca,_0x3c72f1,_0x13c660){logger['info'](_0x4d8c('0x7'),_0x8ee162,_0x235bed['id'],_0x1ed4ca,_0x3c72f1,JSON[_0x4d8c('0x8')](_0x13c660));io['to'](_0x1ed4ca)[_0x4d8c('0x9')](_0x3c72f1,_0x13c660);}exports[_0x4d8c('0xa')]=function(_0x487284,_0x4e0417,_0x25fc7f,_0x364267){var _0x5e5269,_0x595d9a;var _0x56cd0c={};var _0xcf7858;var _0x1df148=Number(_0x25fc7f[_0x4d8c('0xb')]);var _0x563949=_0x25fc7f[_0x4d8c('0xc')]?Boolean(Number(_0x25fc7f[_0x4d8c('0xc')])):![];var _0x4b5960;var _0xd851f3=![];if(!_['isNil'](_0x25fc7f[_0x4d8c('0xd')])){if(_0x25fc7f[_0x4d8c('0xd')]=='1')_0xd851f3=!![];}if(!_0xd851f3){if(_0x364267[_0x4d8c('0xe')]){_0x56cd0c['id']=_0x364267[_0x4d8c('0xe')];}}if(!_0x56cd0c['id']){_0x56cd0c[_0x4d8c('0xf')]=_0x1df148;_0x4b5960=_0x25fc7f[_0x4d8c('0x10')]&&_0x25fc7f[_0x4d8c('0x10')]!=='0'?_0x25fc7f[_0x4d8c('0x10')][_0x4d8c('0x11')](','):['phone'];_0x56cd0c['$or']=_[_0x4d8c('0x12')](_0x4b5960,function(_0x3f28c0){var _0x38f7f8={};_0x38f7f8[_0x3f28c0]=_0x364267[_0x4d8c('0x13')]?_0x364267['destcalleridnum']:_0x364267[_0x4d8c('0x14')];return _0x38f7f8;});_0xcf7858=_0x364267[_0x4d8c('0x13')]?_0x364267[_0x4d8c('0x15')]:_0x364267['calleridnum'];}var _0x24757d=['id',_0x4d8c('0x16'),_0x4d8c('0x17'),_0x4d8c('0x18'),_0x4d8c('0x19'),_0x4d8c('0x1a'),'ListId',_0x4d8c('0x1b'),_0x4d8c('0x1c'),_0x4d8c('0x1d')];var _0x17a3be=_[_0x4d8c('0x1e')](_0x24757d,_0x4b5960);BPromise[_0x4d8c('0x1f')]()[_0x4d8c('0x20')](cmContactRpc[_0x4d8c('0x21')]({'attributes':_0x17a3be,'where':_0x56cd0c,'phone':_0xcf7858}))[_0x4d8c('0x20')](function(_0x2b8f84){_0x595d9a=_0x2b8f84;if(!_['isEmpty'](_0x595d9a)){if(_0x595d9a['length']===0x1){_0x5e5269=_0x595d9a[0x0];logger[_0x4d8c('0x22')](_0x4d8c('0x23'),_0x364267['uniqueid'],_0x4e0417['id'],_0x5e5269['id']);}else{logger['info'](_0x4d8c('0x24'),_0x364267[_0x4d8c('0x25')],_0x4e0417['id'],_['map'](_0x595d9a,'id')[_0x4d8c('0x26')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x364267[_0x4d8c('0x25')],_0x4e0417['id']);var _0x278088={'ListId':_0x1df148};var _0x42f704=_0x25fc7f['data4']&&_0x25fc7f[_0x4d8c('0x27')]!=='0'?_0x25fc7f[_0x4d8c('0x27')]:_0x4d8c('0x18');if(_0x563949){logger[_0x4d8c('0x22')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x364267[_0x4d8c('0x25')],_0x4e0417['id']);_0x278088[_0x42f704]=_[_0x4d8c('0x28')](_0x364267[_0x4d8c('0x13')])?_0x364267[_0x4d8c('0x14')]:_0x364267[_0x4d8c('0x15')];if(_[_0x4d8c('0x28')](_0x364267[_0x4d8c('0x13')])){_0x278088['firstName']=_0x364267[_0x4d8c('0x29')]&&_0x364267['calleridname']!==''?_0x364267[_0x4d8c('0x29')]:_0x4d8c('0x2a');}else{_0x278088[_0x4d8c('0x16')]=_0x364267[_0x4d8c('0x2b')]&&_0x364267[_0x4d8c('0x2b')]!==''?_0x364267[_0x4d8c('0x2b')]:'Unknown';}return BPromise[_0x4d8c('0x1f')]()['then'](cmContactRpc[_0x4d8c('0x2c')](_0x278088))['then'](function(_0x4dd1fe){_0x5e5269=_0x4dd1fe;_0x595d9a['push'](_0x4dd1fe);if(_0x5e5269){logger[_0x4d8c('0x22')](_0x4d8c('0x2d'),_0x364267[_0x4d8c('0x25')],_0x4e0417['id'],_0x5e5269['id']);}return;});}else{logger[_0x4d8c('0x22')](_0x4d8c('0x2e'),_0x364267[_0x4d8c('0x25')],_0x4e0417['id']);_0x278088[_0x42f704]=_[_0x4d8c('0x28')](_0x364267[_0x4d8c('0x13')])?_0x364267[_0x4d8c('0x14')]:_0x364267[_0x4d8c('0x15')];if(_[_0x4d8c('0x28')](_0x364267[_0x4d8c('0x13')])){_0x278088[_0x4d8c('0x16')]=_0x364267[_0x4d8c('0x29')]&&_0x364267[_0x4d8c('0x29')]!==_0x4d8c('0x2f')?_0x364267[_0x4d8c('0x29')]:_0x4d8c('0x2a');}else{_0x278088[_0x4d8c('0x16')]=_0x364267[_0x4d8c('0x2b')]&&_0x364267['destcalleridname']!==_0x4d8c('0x2f')?_0x364267[_0x4d8c('0x2b')]:'Unknown';}_0x5e5269=_0x278088;_0x595d9a[_0x4d8c('0x30')](_0x278088);return;}}})[_0x4d8c('0x20')](function(){if(_0x487284){emit(_0x364267[_0x4d8c('0x25')],_0x4e0417,util[_0x4d8c('0x31')](_0x4d8c('0x32'),_0x487284[_0x4d8c('0x33')]),util[_0x4d8c('0x31')]('trigger:%s',_0x25fc7f[_0x4d8c('0x34')][_0x4d8c('0x35')]()),{'evt':_[_0x4d8c('0x36')](_0x364267,{'autoCreate':_0x563949}),'contact':_0x5e5269===undefined?{}:_0x5e5269,'contacts':_0x595d9a['length']===0x0?undefined:_0x595d9a});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6740fdd..1fa7e78 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 _0xfc5c=['windowHeight','data6','600','winapp','winArguments','format','user:%s','trigger:%s:%s','action','jscripty','trigger:%s','name','exec','integration','queue','routeId','urlforward','parse','search','replace','channel','AllConditions','checkConditions','AnyConditions','some','field','operator','ChatWebsiteId','upperFirst','AccountId','value','event','agent','membername','lastevent','null','substatus','undefined','created','equals','exports','lodash','url','mustache','./urlforward','./cmContact','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','checkTriggers','interface','status','merge','variables','length','Actions','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','buildUri','data3','data4','uriLocation','isNil','data5'];(function(_0x559b43,_0x436635){var _0x328a50=function(_0x127bd1){while(--_0x127bd1){_0x559b43['push'](_0x559b43['shift']());}};_0x328a50(++_0x436635);}(_0xfc5c,0x185));var _0xcfc5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xfc5c[_0x53ccf2];return _0x5a2964;};'use strict';var util=require('util');var _=require(_0xcfc5('0x0'));var url=require(_0xcfc5('0x1'));var Mustache=require(_0xcfc5('0x2'));var Redis=require('ioredis');var urlforward=require(_0xcfc5('0x3'));var integration=require('./integration');var cmContact=require(_0xcfc5('0x4'));var script=require('./script');var config=require(_0xcfc5('0x5'));var logger=require(_0xcfc5('0x6'))('trigger');var ami=require('../ami');config[_0xcfc5('0x7')]=_[_0xcfc5('0x8')](config[_0xcfc5('0x7')],{'host':_0xcfc5('0x9'),'port':0x18eb});var io=require(_0xcfc5('0xa'))(new Redis(config[_0xcfc5('0x7')]));var operators={'equals':function(_0x2ada0a,_0x2d5e05){return _0x2ada0a==_0x2d5e05;},'not_equals':function(_0x437f63,_0x2cc8cf){return _0x437f63!=_0x2cc8cf;}};var barAndWebActions=[_0xcfc5('0xb'),_0xcfc5('0x1'),'winapp'];function Trigger(_0x405744){this[_0xcfc5('0xc')]=_0x405744[_0xcfc5('0xc')];this['agents']=_0x405744[_0xcfc5('0xd')];this[_0xcfc5('0xe')]=_0x405744[_0xcfc5('0xe')];this['templates']=_0x405744[_0xcfc5('0xf')];this['voiceExtensions']=_0x405744[_0xcfc5('0x10')];this[_0xcfc5('0x11')]=_0x405744[_0xcfc5('0x11')];this[_0xcfc5('0x12')]=_0x405744[_0xcfc5('0x12')];this['salesforceAccounts']=_0x405744['salesforceAccounts'];this[_0xcfc5('0x13')]=_0x405744[_0xcfc5('0x13')];this[_0xcfc5('0x14')]=_0x405744[_0xcfc5('0x14')];this[_0xcfc5('0x15')]=_0x405744[_0xcfc5('0x15')];this['vtigerAccounts']=_0x405744['vtigerAccounts'];this[_0xcfc5('0x16')]=_0x405744[_0xcfc5('0x16')];this[_0xcfc5('0x17')]=_0x405744[_0xcfc5('0x17')];this[_0xcfc5('0x18')]=_0x405744[_0xcfc5('0x18')];this[_0xcfc5('0x19')]={'zendesk':this[_0xcfc5('0x11')],'salesforce':this[_0xcfc5('0x1a')],'freshdesk':this[_0xcfc5('0x12')],'sugarcrm':this[_0xcfc5('0x13')],'zoho':this[_0xcfc5('0x14')],'desk':this['deskAccounts'],'vtiger':this[_0xcfc5('0x1b')],'dynamics365':this[_0xcfc5('0x17')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xcfc5('0x16')]};ami['on'](_0xcfc5('0x1c'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x1f'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on']('custom:agentringnoanswer',this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x20'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x21'),this[_0xcfc5('0x1d')]['bind'](this));ami['on'](_0xcfc5('0x22'),this['syncCustomEvent'][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x23'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x24'),this['syncCustomEvent'][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x25'),this['syncCustomEvent'][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x26'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on']('custom:timeout',this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on']('custom:dialbegin',this[_0xcfc5('0x27')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x28'),this['syncAgentDial']['bind'](this));ami['on'](_0xcfc5('0x29'),this[_0xcfc5('0x27')][_0xcfc5('0x1e')](this));ami['on']('custom:newinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xcfc5('0x2a'),this['syncCustomEvent'][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x2b'),this[_0xcfc5('0x1d')]['bind'](this));ami['on'](_0xcfc5('0x2c'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x2d'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on']('custom:acceptmessage',this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x2e'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));ami['on'](_0xcfc5('0x2f'),this[_0xcfc5('0x1d')][_0xcfc5('0x1e')](this));}Trigger[_0xcfc5('0x30')][_0xcfc5('0x31')]=function(_0x3e6512,_0x596e9b,_0x485fd8){logger[_0xcfc5('0x32')](_0x3e6512,_0x596e9b,JSON['stringify'](_0x485fd8));io['to'](_0x3e6512)[_0xcfc5('0x31')](_0x596e9b,_0x485fd8);};Trigger[_0xcfc5('0x30')][_0xcfc5('0x1d')]=function(_0x247540){var _0x36e4d7=_[_0xcfc5('0x33')](_0x247540);if(typeof _0x36e4d7[_0xcfc5('0x34')]==='undefined'){_0x36e4d7[_0xcfc5('0x34')]='voice';}this[_0xcfc5('0x35')](_0x36e4d7);};Trigger[_0xcfc5('0x30')][_0xcfc5('0x27')]=function(_0x2af8e5){if(this[_0xcfc5('0xd')][_0x2af8e5[_0xcfc5('0x36')]]){this['syncCustomEvent'](_0x2af8e5);}};Trigger[_0xcfc5('0x30')][_0xcfc5('0x35')]=function(_0x3e2155){var _0x5debb8;for(var _0x362e36 in this[_0xcfc5('0xc')]){if(this[_0xcfc5('0xc')]['hasOwnProperty'](_0x362e36)){if(this[_0xcfc5('0xc')][_0x362e36][_0xcfc5('0x37')]){_0x5debb8=this['checkTrigger'](this[_0xcfc5('0xc')][_0x362e36],_0x3e2155);if(_0x5debb8){_[_0xcfc5('0x38')](_0x3e2155,_0x3e2155[_0xcfc5('0x39')]);for(var _0x45efb6=0x0,_0x8e06ad,_0x59d102,_0x3c3a91;_0x45efb60x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x2c0f40,_0x4195b5){var _0x1a90b4=function(_0x5dd689){while(--_0x5dd689){_0x2c0f40['push'](_0x2c0f40['shift']());}};_0x1a90b4(++_0x4195b5);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index ce22f44..a2af0a1 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 _0x17c0=['length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','lastIndexOf','outbound','telephone1','GET','&$filter=','\x20eq\x20\x27','replace','%2b','value','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','nameField','customField','idField','toLowerCase','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','userEmail','email'];(function(_0x5b76ad,_0x52efae){var _0x347b4a=function(_0x2c3e3b){while(--_0x2c3e3b){_0x5b76ad['push'](_0x5b76ad['shift']());}};_0x347b4a(++_0x52efae);}(_0x17c0,0x19a));var _0x017c=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x17c0[_0x163040];return _0x364667;};'use strict';var _=require(_0x017c('0x0'));var rp=require(_0x017c('0x1'));var util=require(_0x017c('0x2'));var intUtil=require(_0x017c('0x3'));var md5=require('md5');var Redis=require(_0x017c('0x4'));var logger=require(_0x017c('0x5'))(_0x017c('0x6'));var config=require(_0x017c('0x7'));config[_0x017c('0x8')]=_['defaults'](config[_0x017c('0x8')],{'host':_0x017c('0x9'),'port':0x18eb});var io=require(_0x017c('0xa'))(new Redis(config['redis']));function getAuthToken(_0x137c5a,_0x50bb08,_0x58c83a){if(_0x137c5a[_0x017c('0xb')]){_0x137c5a[_0x017c('0xc')]=_0x137c5a[_0x017c('0xd')]['data7'];_0x137c5a[_0x017c('0xe')]=_0x137c5a[_0x017c('0xd')][_0x017c('0xf')];return Promise[_0x017c('0x10')](_0x137c5a[_0x017c('0xd')][_0x017c('0x11')]);}var _0x1c7ece={'method':_0x017c('0x12'),'uri':_0x50bb08,'form':{'client_id':_0x137c5a[_0x017c('0x13')],'resource':_0x137c5a[_0x017c('0xc')],'username':_0x137c5a['username'],'password':_0x137c5a['password'],'grant_type':_0x017c('0x14'),'client_secret':_0x137c5a[_0x017c('0x15')]},'json':!![]};return rp(_0x1c7ece)['then'](function(_0x4229d2){return _0x4229d2[_0x017c('0x16')];})[_0x017c('0x17')](function(_0x3a93f7){logger[_0x017c('0x18')]('['+[_0x58c83a[_0x017c('0x19')]()]+_0x017c('0x1a'));return _0x3a93f7['message'];});}function getUser(_0xb1fc0,_0x7747fc,_0x27f111,_0x123bce,_0xc645c8,_0x3cdcec){return new Promise(function(_0x5f3920,_0x15ad7c){return getAuthToken(_0x7747fc,_0x123bce,_0x3cdcec)[_0x017c('0x1b')](function(_0x297ca2){var _0x13a0da={'method':'GET','uri':_0xc645c8+_0x017c('0x1c'),'headers':{'Authorization':_0x017c('0x1d')+_0x297ca2,'OData-Version':_0x017c('0x1e')},'json':!![]};return rp(_0x13a0da);})[_0x017c('0x1b')](function(_0x3b2f1c){var _0x376bc2=_0x3b2f1c['value'];var _0x3c54f8=![];var _0x5d068c=null;if(!_[_0x017c('0x1f')](_0x27f111)){if(intUtil['validateEmail'](_0x27f111['email'])){_0xb1fc0[_0x017c('0x20')]=_0x27f111[_0x017c('0x21')];for(_0x5d068c=0x0;_0x5d068c<_0x376bc2[_0x017c('0x22')];_0x5d068c++){if(_0x376bc2[_0x5d068c][_0x017c('0x23')]===_0x27f111[_0x017c('0x21')]&&!_0x376bc2[_0x5d068c][_0x017c('0x24')]){_0x3c54f8=!![];logger['info']('['+[_0x3cdcec[_0x017c('0x19')]()]+_0x017c('0x25')+_0x376bc2[_0x5d068c][_0x017c('0x26')]+'!');_0xb1fc0[_0x017c('0x27')]=_0x376bc2[_0x5d068c]['systemuserid'];}}}}if(!_0x3c54f8){logger[_0x017c('0x28')]('['+[_0x3cdcec['toUpperCase']()]+_0x017c('0x29'));_0xb1fc0['userEmail']=_0x7747fc['username'];for(_0x5d068c=0x0;_0x5d068c<_0x376bc2[_0x017c('0x22')];_0x5d068c++){if(_0x376bc2[_0x5d068c][_0x017c('0x23')]===_0x7747fc['username']){_0xb1fc0['userId']=_0x376bc2[_0x5d068c][_0x017c('0x26')];}}}_0x5f3920(_0xb1fc0);})[_0x017c('0x17')](function(_0x4f02e3){_0x15ad7c(_0x4f02e3[_0x017c('0x2a')]);});});}function createEndUser(_0x394743,_0x1b9385,_0x4f5fe1,_0x45f69d,_0x411977,_0x381f53,_0x4b8be3){return new Promise(function(_0x34a944,_0x52b835){return getAuthToken(_0x1b9385,_0x4f5fe1,_0x381f53)[_0x017c('0x1b')](function(_0x25fc82){var _0x2c2f94=_0x381f53['toLowerCase']()==='outbound'?_0x411977[_0x017c('0x2b')]:_0x411977[_0x017c('0x2c')];var _0x2acf17={'method':_0x017c('0x12'),'uri':_0x45f69d+_0x017c('0x2d'),'body':{'fullname':_0x2c2f94,'firstname':_0x2c2f94,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x017c('0x2e')+_0x394743[_0x017c('0x27')]+')'},'headers':{'Authorization':_0x017c('0x1d')+_0x25fc82,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x2acf17[_0x017c('0x2f')][_0x4b8be3]=_0x2c2f94;return rp(_0x2acf17);})['then'](function(_0x74422c){var _0x27bc1f=_0x74422c['headers'][_0x017c('0x30')];var _0x4efcbd=_0x27bc1f['substring'](_0x27bc1f[_0x017c('0x31')]('(')+0x1,_0x27bc1f[_0x017c('0x31')](')'));_0x394743['enduserId']=_0x4efcbd;_0x34a944(_0x394743);})[_0x017c('0x17')](function(_0x35e133){_0x52b835(_0x35e133['message']);});});}function getEndUser(_0x280197,_0x4946ad,_0x56d298,_0x51f04c,_0x1f0f50,_0x364072,_0x24cf72,_0x4bff4c){var _0x2e9a97=_0x364072['toLowerCase']()===_0x017c('0x32')?_0x1f0f50[_0x017c('0x2b')]:_0x1f0f50[_0x017c('0x2c')];return getAuthToken(_0x4946ad,_0x56d298,_0x364072)['then'](function(_0x4075ba){_0x4bff4c=_0x4bff4c?_0x4bff4c:_0x017c('0x33');var _0x37bd11={'method':_0x017c('0x34'),'uri':_0x51f04c+'contacts?$select='+_0x4bff4c+_0x017c('0x35')+_0x4bff4c+_0x017c('0x36')+_0x2e9a97[_0x017c('0x37')]('+',_0x017c('0x38'))+'\x27','headers':{'Authorization':_0x017c('0x1d')+_0x4075ba,'If-None-Match':null,'OData-Version':_0x017c('0x1e')},'json':!![]};return rp(_0x37bd11);})[_0x017c('0x1b')](function(_0x55fc01){var _0x517bf1=![];if(!_0x55fc01)return _0x517bf1;var _0x5d784b=_0x55fc01[_0x017c('0x39')];for(var _0x3cfab6=0x0;_0x3cfab6<_0x5d784b[_0x017c('0x22')];_0x3cfab6++){if(_0x5d784b[_0x3cfab6][_0x4bff4c]===_0x2e9a97){_0x517bf1=!![];_0x280197[_0x017c('0x3a')]=_0x5d784b[_0x3cfab6][_0x017c('0x3b')];}}return _0x517bf1;})[_0x017c('0x1b')](function(_0x107222){if(_0x107222)return _0x280197;if(_0x24cf72==='nothing'){logger[_0x017c('0x28')]('['+[_0x364072[_0x017c('0x19')]()]+_0x017c('0x3c'));return _0x280197;}return createEndUser(_0x280197,_0x4946ad,_0x56d298,_0x51f04c,_0x1f0f50,_0x364072,_0x4bff4c)[_0x017c('0x1b')](function(_0x4f0490){logger[_0x017c('0x28')]('['+[_0x364072[_0x017c('0x19')]()]+_0x017c('0x3d'),_0x4f0490[_0x017c('0x3a')]);return _0x4f0490;});});}function getCustomFields(_0x1711f8,_0x22ebd3,_0x2a0e82){var _0x25daed={};if(_0x1711f8['length']>0x0){_[_0x017c('0x3e')](_0x1711f8,function(_0x48e1dc){if(_['includes']([_0x017c('0x3f'),'picklist'],_0x48e1dc[_0x017c('0x40')])&&_0x48e1dc[_0x017c('0x41')]&&!_0x48e1dc[_0x017c('0x42')]){var _0x2a2318=_0x48e1dc[_0x017c('0x43')][_0x017c('0x44')]();var _0x37a861=_0x2a2318[_0x017c('0x45')](0x0,_0x2a2318[_0x017c('0x46')]('_'));var _0x29a25e=_0x2a2318[_0x017c('0x45')](_0x2a2318[_0x017c('0x46')]('_')+0x1);if(_0x37a861===_0x2a0e82){_0x25daed[_0x29a25e]=_0x48e1dc[_0x017c('0x47')];}}});}return _0x25daed;}function getTicket(_0x47eea4,_0x6766b7,_0x2def3b,_0x1a7bb3,_0x19185a,_0x472ec1,_0x1a4b91){return new Promise(function(_0x5600e1,_0x106e81){var _0x3f2162;return getAuthToken(_0x6766b7,_0x2def3b,_0x1a4b91)[_0x017c('0x1b')](function(_0xd6710f){if(_0x472ec1[_0x017c('0x48')]===_0x017c('0x49')){_0x3f2162={'method':_0x017c('0x12'),'uri':_0x1a7bb3+_0x017c('0x4a'),'body':Object[_0x017c('0x4b')]({},{'title':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4d')],_0x19185a,'\x20'),'description':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4e')],_0x19185a,'\x0a'),'customerid_contact@odata.bind':_0x47eea4[_0x017c('0x3a')]?_0x017c('0x4f')+_0x47eea4['enduserId']+')':undefined,'ownerid@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x472ec1[_0x017c('0x50')],_0x19185a,_0x472ec1[_0x017c('0x48')])),'headers':{'Authorization':_0x017c('0x1d')+_0xd6710f,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x472ec1[_0x017c('0x48')]==='phonecall'){var _0x4d7523=_0x47eea4['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x47eea4[_0x017c('0x27')]+')','participationtypemask':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?0x2:0x1},{'partyid_contact@odata.bind':_0x017c('0x4f')+_0x47eea4['enduserId']+')','participationtypemask':_0x47eea4[_0x017c('0x51')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','participationtypemask':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?0x2:0x1}];_0x3f2162={'method':_0x017c('0x12'),'uri':_0x1a7bb3+_0x017c('0x53'),'body':Object[_0x017c('0x4b')]({},{'subject':intUtil[_0x017c('0x4c')](_0x472ec1[_0x017c('0x4d')],_0x19185a,'\x20'),'phonenumber':String(_0x19185a['calleridnum']),'description':intUtil[_0x017c('0x4c')](_0x472ec1['Descriptions'],_0x19185a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x47eea4[_0x017c('0x3a')]?'/contacts('+_0x47eea4[_0x017c('0x3a')]+')':undefined,'ownerid@odata.bind':_0x017c('0x2e')+_0x47eea4[_0x017c('0x27')]+')','directioncode':_0x47eea4[_0x017c('0x51')]===_0x017c('0x52')?![]:!![],'phonecall_activity_parties':_0x4d7523},getCustomFields(_0x472ec1[_0x017c('0x50')],_0x19185a,_0x472ec1[_0x017c('0x48')])),'headers':{'Authorization':_0x017c('0x1d')+_0xd6710f,'OData-Version':_0x017c('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3f2162);})[_0x017c('0x1b')](function(_0x3534d1){var _0x5b8da1=_0x3534d1[_0x017c('0x54')][_0x017c('0x30')];var _0xab3355=_0x5b8da1['substring'](_0x5b8da1['lastIndexOf']('(')+0x1,_0x5b8da1[_0x017c('0x31')](')'));_0x47eea4[_0x017c('0x55')]=_0xab3355;_0x5600e1(_0x47eea4);})[_0x017c('0x17')](function(_0x64e87){_0x106e81(_0x64e87[_0x017c('0x2a')]);});});}function emit(_0x2b9702,_0x35b7aa,_0x5bc685,_0x3a8968){var _0x7fd261={'uri':util[_0x017c('0x56')](_0x017c('0x57'),_0x2b9702,_0x5bc685,_0x3a8968)};io['to'](util['format'](_0x017c('0x58'),_0x35b7aa))[_0x017c('0x59')]('trigger:browser:url',_0x7fd261);}exports['cs']=function(_0x5b873c,_0x3cbc35,_0x456e55,_0x54c7b7,_0xa88881,_0x70b7cf,_0x41d041,_0xefd3a0){var _0x38b196={};_0x70b7cf[_0x017c('0xc')]=_0x70b7cf[_0x017c('0xb')]?intUtil[_0x017c('0x5a')](_0x70b7cf['CloudProvider'][_0x017c('0x5b')]):intUtil[_0x017c('0x5a')](_0x70b7cf[_0x017c('0xc')]);_0x70b7cf[_0x017c('0x5c')]=intUtil[_0x017c('0x5a')](_0x70b7cf[_0x017c('0x5c')]);_0x38b196[_0x017c('0x51')]=_0xefd3a0===_0x017c('0x52')||_0xefd3a0===_0x017c('0x5d')?_0x017c('0x52'):_0x017c('0x32');var _0x2fa182=_0x70b7cf[_0x017c('0xb')]?util[_0x017c('0x56')](_0x017c('0x5e'),_0x70b7cf[_0x017c('0xd')][_0x017c('0x5b')]):util[_0x017c('0x56')](_0x017c('0x5e'),_0x70b7cf[_0x017c('0xc')]);var _0x1d6fec=util[_0x017c('0x56')](_0x017c('0x5f'),_0x70b7cf[_0x017c('0xe')]);var _0x327a3f=util[_0x017c('0x56')](_0x017c('0x60'),_0x70b7cf['serverUrl'],_0x3cbc35['uniqueid'],md5(_0x3cbc35[_0x017c('0x61')]));if(_0xa88881&&_0xa88881[_0x017c('0x62')]){logger['info']('[QUEUE]',_0x017c('0x63'));_0x3cbc35[_0x017c('0x64')]=_0x327a3f;}else if(_0x41d041&&_0x41d041[_0x017c('0x65')]&&_0x41d041['recordingFormat']!==_0x017c('0x66')){logger[_0x017c('0x28')](_0x017c('0x67'),_0x017c('0x63'));_0x3cbc35[_0x017c('0x64')]=_0x327a3f;}else{_0x3cbc35['recordingURL']='';}return getUser(_0x38b196,_0x70b7cf,_0x54c7b7,_0x1d6fec,_0x2fa182,_0xefd3a0)[_0x017c('0x1b')](function(_0x13392d){logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x68'),_0x13392d[_0x017c('0x27')]);logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x69'),_0x13392d['userEmail']);return getEndUser(_0x13392d,_0x70b7cf,_0x1d6fec,_0x2fa182,_0x3cbc35,_0xefd3a0,_0x456e55['moduleCreate'],_0x456e55[_0x017c('0x6a')]);})['then'](function(_0x3b42b6){logger[_0x017c('0x28')]('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3b42b6[_0x017c('0x3a')]);logger['info']('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3cbc35[_0x017c('0x2c')]);return getTicket(_0x3b42b6,_0x70b7cf,_0x1d6fec,_0x2fa182,_0x3cbc35,_0x456e55,_0xefd3a0);})[_0x017c('0x1b')](function(_0x3301aa){logger['info'](util[_0x017c('0x56')]('['+_0xefd3a0[_0x017c('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x456e55[_0x017c('0x48')],_0x3301aa[_0x017c('0x55')]));logger['info'](util[_0x017c('0x56')]('['+_0xefd3a0[_0x017c('0x19')]()+_0x017c('0x6b'),_0xefd3a0));if(_0xefd3a0!=='unmanaged'&&_0x456e55['openNewTab']){logger[_0x017c('0x28')]('['+_0xefd3a0[_0x017c('0x19')]()+']',_0x017c('0x6c'));emit(_0x70b7cf[_0x017c('0xc')],_0x54c7b7[_0x017c('0x6d')],_0x456e55[_0x017c('0x48')],_0x3301aa[_0x017c('0x55')]);}})[_0x017c('0x17')](function(_0x256dce){logger['error']('['+_0xefd3a0[_0x017c('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x256dce[_0x017c('0x2a')]);console[_0x017c('0x18')](_0x017c('0x6e'),_0x256dce);});}; \ No newline at end of file +var _0xbd1d=['resolve','data5','POST','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','/systemusers(','body','headers','substring','calleridnum','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','assign','odata-entityid','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0xbd1d,0x1a3));var _0xdbd1=function(_0x4aeca6,_0x2a8453){_0x4aeca6=_0x4aeca6-0x0;var _0x2fbe77=_0xbd1d[_0x4aeca6];return _0x2fbe77;};'use strict';var _=require(_0xdbd1('0x0'));var rp=require(_0xdbd1('0x1'));var util=require(_0xdbd1('0x2'));var intUtil=require(_0xdbd1('0x3'));var md5=require(_0xdbd1('0x4'));var Redis=require(_0xdbd1('0x5'));var logger=require(_0xdbd1('0x6'))(_0xdbd1('0x7'));var config=require(_0xdbd1('0x8'));config[_0xdbd1('0x9')]=_[_0xdbd1('0xa')](config[_0xdbd1('0x9')],{'host':_0xdbd1('0xb'),'port':0x18eb});var io=require(_0xdbd1('0xc'))(new Redis(config[_0xdbd1('0x9')]));function getAuthToken(_0x1c026f,_0x354086,_0xe2a4b){if(_0x1c026f[_0xdbd1('0xd')]){_0x1c026f[_0xdbd1('0xe')]=_0x1c026f[_0xdbd1('0xf')][_0xdbd1('0x10')];_0x1c026f['tenantId']=_0x1c026f[_0xdbd1('0xf')]['data2'];return Promise[_0xdbd1('0x11')](_0x1c026f[_0xdbd1('0xf')][_0xdbd1('0x12')]);}var _0x3bcb52={'method':_0xdbd1('0x13'),'uri':_0x354086,'form':{'client_id':_0x1c026f['clientId'],'resource':_0x1c026f['remoteUri'],'username':_0x1c026f[_0xdbd1('0x14')],'password':_0x1c026f[_0xdbd1('0x15')],'grant_type':_0xdbd1('0x15'),'client_secret':_0x1c026f[_0xdbd1('0x16')]},'json':!![]};return rp(_0x3bcb52)[_0xdbd1('0x17')](function(_0x258cd6){return _0x258cd6[_0xdbd1('0x18')];})[_0xdbd1('0x19')](function(_0x121c75){logger[_0xdbd1('0x1a')]('['+[_0xe2a4b[_0xdbd1('0x1b')]()]+_0xdbd1('0x1c'));return _0x121c75[_0xdbd1('0x1d')];});}function getUser(_0x98bb55,_0x56986a,_0xbec2a4,_0xfa840b,_0x43bafa,_0x30813d){return new Promise(function(_0x57dca1,_0x2981cb){return getAuthToken(_0x56986a,_0xfa840b,_0x30813d)[_0xdbd1('0x17')](function(_0x3c5170){var _0x545b75={'method':'GET','uri':_0x43bafa+_0xdbd1('0x1e'),'headers':{'Authorization':_0xdbd1('0x1f')+_0x3c5170,'OData-Version':_0xdbd1('0x20')},'json':!![]};return rp(_0x545b75);})['then'](function(_0x2aca64){var _0x14274d=_0x2aca64[_0xdbd1('0x21')];var _0x260ef6=![];var _0x334174=null;if(!_['isNil'](_0xbec2a4)){if(intUtil[_0xdbd1('0x22')](_0xbec2a4['email'])){_0x98bb55[_0xdbd1('0x23')]=_0xbec2a4[_0xdbd1('0x24')];for(_0x334174=0x0;_0x334174<_0x14274d['length'];_0x334174++){if(_0x14274d[_0x334174][_0xdbd1('0x25')]===_0xbec2a4['email']&&!_0x14274d[_0x334174][_0xdbd1('0x26')]){_0x260ef6=!![];logger['info']('['+[_0x30813d[_0xdbd1('0x1b')]()]+_0xdbd1('0x27')+_0x14274d[_0x334174][_0xdbd1('0x28')]+'!');_0x98bb55[_0xdbd1('0x29')]=_0x14274d[_0x334174][_0xdbd1('0x28')];}}}}if(!_0x260ef6){logger[_0xdbd1('0x2a')]('['+[_0x30813d[_0xdbd1('0x1b')]()]+_0xdbd1('0x2b'));_0x98bb55[_0xdbd1('0x23')]=_0x56986a[_0xdbd1('0x14')];for(_0x334174=0x0;_0x334174<_0x14274d[_0xdbd1('0x2c')];_0x334174++){if(_0x14274d[_0x334174][_0xdbd1('0x25')]===_0x56986a['username']){_0x98bb55['userId']=_0x14274d[_0x334174][_0xdbd1('0x28')];}}}_0x57dca1(_0x98bb55);})[_0xdbd1('0x19')](function(_0x5674e0){_0x2981cb(_0x5674e0['message']);});});}function createEndUser(_0x4aeeb5,_0x3dd374,_0x253a1c,_0x19a837,_0x4948bb,_0x51e8c4,_0x4c9925){return new Promise(function(_0x5e84a3,_0x13832f){return getAuthToken(_0x3dd374,_0x253a1c,_0x51e8c4)[_0xdbd1('0x17')](function(_0x29515e){var _0x223e15=_0x51e8c4[_0xdbd1('0x2d')]()===_0xdbd1('0x2e')?_0x4948bb[_0xdbd1('0x2f')]:_0x4948bb['calleridnum'];var _0x4afd25={'method':'POST','uri':_0x19a837+'contacts','body':{'fullname':_0x223e15,'firstname':_0x223e15,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xdbd1('0x30')+_0x4aeeb5['userId']+')'},'headers':{'Authorization':_0xdbd1('0x1f')+_0x29515e,'OData-Version':_0xdbd1('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x4afd25[_0xdbd1('0x31')][_0x4c9925]=_0x223e15;return rp(_0x4afd25);})['then'](function(_0x4a98b8){var _0x4e6770=_0x4a98b8[_0xdbd1('0x32')]['odata-entityid'];var _0x2ca29e=_0x4e6770[_0xdbd1('0x33')](_0x4e6770['lastIndexOf']('(')+0x1,_0x4e6770['lastIndexOf'](')'));_0x4aeeb5['enduserId']=_0x2ca29e;_0x5e84a3(_0x4aeeb5);})[_0xdbd1('0x19')](function(_0x283a21){_0x13832f(_0x283a21[_0xdbd1('0x1d')]);});});}function getEndUser(_0x3bd75f,_0x36fd88,_0x39e23e,_0x157d1d,_0x559c63,_0x9777f3,_0xd7d2d3,_0x28b566){var _0x34ab73=_0x9777f3[_0xdbd1('0x2d')]()==='outbound'?_0x559c63[_0xdbd1('0x2f')]:_0x559c63[_0xdbd1('0x34')];return getAuthToken(_0x36fd88,_0x39e23e,_0x9777f3)[_0xdbd1('0x17')](function(_0x233347){_0x28b566=_0x28b566?_0x28b566:'telephone1';var _0x501a5f={'method':_0xdbd1('0x35'),'uri':_0x157d1d+_0xdbd1('0x36')+_0x28b566+_0xdbd1('0x37')+_0x28b566+_0xdbd1('0x38')+_0x34ab73['replace']('+',_0xdbd1('0x39'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x233347,'If-None-Match':null,'OData-Version':_0xdbd1('0x20')},'json':!![]};return rp(_0x501a5f);})[_0xdbd1('0x17')](function(_0x51a8f4){var _0x2435b2=![];if(!_0x51a8f4)return _0x2435b2;var _0x52eed2=_0x51a8f4[_0xdbd1('0x21')];for(var _0x36038a=0x0;_0x36038a<_0x52eed2['length'];_0x36038a++){if(_0x52eed2[_0x36038a][_0x28b566]===_0x34ab73){_0x2435b2=!![];_0x3bd75f[_0xdbd1('0x3a')]=_0x52eed2[_0x36038a][_0xdbd1('0x3b')];}}return _0x2435b2;})[_0xdbd1('0x17')](function(_0x423403){if(_0x423403)return _0x3bd75f;if(_0xd7d2d3===_0xdbd1('0x3c')){logger['info']('['+[_0x9777f3[_0xdbd1('0x1b')]()]+_0xdbd1('0x3d'));return _0x3bd75f;}return createEndUser(_0x3bd75f,_0x36fd88,_0x39e23e,_0x157d1d,_0x559c63,_0x9777f3,_0x28b566)[_0xdbd1('0x17')](function(_0x239a2a){logger[_0xdbd1('0x2a')]('['+[_0x9777f3['toUpperCase']()]+_0xdbd1('0x3e'),_0x239a2a[_0xdbd1('0x3a')]);return _0x239a2a;});});}function getCustomFields(_0x7b9d04,_0x58f210,_0x1549be){var _0x53f937={};if(_0x7b9d04[_0xdbd1('0x2c')]>0x0){_[_0xdbd1('0x3f')](_0x7b9d04,function(_0xdc53f){if(_[_0xdbd1('0x40')]([_0xdbd1('0x41'),_0xdbd1('0x42')],_0xdc53f[_0xdbd1('0x43')])&&_0xdc53f[_0xdbd1('0x44')]&&!_0xdc53f['customField']){var _0x40919f=_0xdc53f[_0xdbd1('0x45')]['toLowerCase']();var _0x1763e9=_0x40919f[_0xdbd1('0x33')](0x0,_0x40919f[_0xdbd1('0x46')]('_'));var _0x11cc83=_0x40919f[_0xdbd1('0x33')](_0x40919f[_0xdbd1('0x46')]('_')+0x1);if(_0x1763e9===_0x1549be){_0x53f937[_0x11cc83]=_0xdc53f[_0xdbd1('0x47')];}}});}return _0x53f937;}function getTicket(_0x236aea,_0x6ceb79,_0x44b52e,_0xdc3179,_0x83cb8c,_0x1a800f,_0xdb8e7b){return new Promise(function(_0x547744,_0x57d7e9){var _0x20b6c2;return getAuthToken(_0x6ceb79,_0x44b52e,_0xdb8e7b)[_0xdbd1('0x17')](function(_0x11f14f){if(_0x1a800f['ticketType']===_0xdbd1('0x48')){_0x20b6c2={'method':_0xdbd1('0x13'),'uri':_0xdc3179+_0xdbd1('0x49'),'body':Object['assign']({},{'title':intUtil[_0xdbd1('0x4a')](_0x1a800f[_0xdbd1('0x4b')],_0x83cb8c,'\x20'),'description':intUtil[_0xdbd1('0x4a')](_0x1a800f[_0xdbd1('0x4c')],_0x83cb8c,'\x0a'),'customerid_contact@odata.bind':_0x236aea[_0xdbd1('0x3a')]?_0xdbd1('0x4d')+_0x236aea[_0xdbd1('0x3a')]+')':undefined,'ownerid@odata.bind':_0xdbd1('0x30')+_0x236aea[_0xdbd1('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x1a800f[_0xdbd1('0x4e')],_0x83cb8c,_0x1a800f[_0xdbd1('0x4f')])),'headers':{'Authorization':_0xdbd1('0x1f')+_0x11f14f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1a800f[_0xdbd1('0x4f')]==='phonecall'){var _0x1fc876=_0x236aea[_0xdbd1('0x3a')]?[{'partyid_systemuser@odata.bind':_0xdbd1('0x30')+_0x236aea[_0xdbd1('0x29')]+')','participationtypemask':_0x236aea[_0xdbd1('0x50')]===_0xdbd1('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xdbd1('0x4d')+_0x236aea['enduserId']+')','participationtypemask':_0x236aea['callDirection']===_0xdbd1('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xdbd1('0x30')+_0x236aea[_0xdbd1('0x29')]+')','participationtypemask':_0x236aea[_0xdbd1('0x50')]==='queue'?0x2:0x1}];_0x20b6c2={'method':_0xdbd1('0x13'),'uri':_0xdc3179+'phonecalls','body':Object[_0xdbd1('0x52')]({},{'subject':intUtil[_0xdbd1('0x4a')](_0x1a800f[_0xdbd1('0x4b')],_0x83cb8c,'\x20'),'phonenumber':String(_0x83cb8c[_0xdbd1('0x34')]),'description':intUtil[_0xdbd1('0x4a')](_0x1a800f['Descriptions'],_0x83cb8c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x236aea[_0xdbd1('0x3a')]?_0xdbd1('0x4d')+_0x236aea[_0xdbd1('0x3a')]+')':undefined,'ownerid@odata.bind':_0xdbd1('0x30')+_0x236aea[_0xdbd1('0x29')]+')','directioncode':_0x236aea[_0xdbd1('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1fc876},getCustomFields(_0x1a800f[_0xdbd1('0x4e')],_0x83cb8c,_0x1a800f['ticketType'])),'headers':{'Authorization':_0xdbd1('0x1f')+_0x11f14f,'OData-Version':_0xdbd1('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x20b6c2);})[_0xdbd1('0x17')](function(_0xd891f3){var _0x589b9a=_0xd891f3[_0xdbd1('0x32')][_0xdbd1('0x53')];var _0x32cdfb=_0x589b9a['substring'](_0x589b9a[_0xdbd1('0x54')]('(')+0x1,_0x589b9a[_0xdbd1('0x54')](')'));_0x236aea[_0xdbd1('0x55')]=_0x32cdfb;_0x547744(_0x236aea);})[_0xdbd1('0x19')](function(_0x1ae63e){_0x57d7e9(_0x1ae63e[_0xdbd1('0x1d')]);});});}function emit(_0x2383ec,_0x3184ab,_0x45819a,_0x24c21b){var _0x2c0226={'uri':util[_0xdbd1('0x56')](_0xdbd1('0x57'),_0x2383ec,_0x45819a,_0x24c21b)};io['to'](util[_0xdbd1('0x56')](_0xdbd1('0x58'),_0x3184ab))[_0xdbd1('0x59')](_0xdbd1('0x5a'),_0x2c0226);}exports['cs']=function(_0x5dbaa9,_0x968764,_0x2568ec,_0x18b5eb,_0x3d4481,_0x5706c1,_0x4fc3d5,_0x563718){var _0x4da655={};_0x5706c1[_0xdbd1('0xe')]=_0x5706c1['modernAuthentication']?intUtil[_0xdbd1('0x5b')](_0x5706c1[_0xdbd1('0xf')][_0xdbd1('0x10')]):intUtil[_0xdbd1('0x5b')](_0x5706c1[_0xdbd1('0xe')]);_0x5706c1[_0xdbd1('0x5c')]=intUtil[_0xdbd1('0x5b')](_0x5706c1['serverUrl']);_0x4da655[_0xdbd1('0x50')]=_0x563718===_0xdbd1('0x51')||_0x563718===_0xdbd1('0x5d')?'queue':_0xdbd1('0x2e');var _0x3d68c1=_0x5706c1[_0xdbd1('0xd')]?util[_0xdbd1('0x56')](_0xdbd1('0x5e'),_0x5706c1[_0xdbd1('0xf')][_0xdbd1('0x10')]):util[_0xdbd1('0x56')](_0xdbd1('0x5e'),_0x5706c1[_0xdbd1('0xe')]);var _0xccd99f=util[_0xdbd1('0x56')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5706c1['tenantId']);var _0x2a7606=util['format'](_0xdbd1('0x5f'),_0x5706c1[_0xdbd1('0x5c')],_0x968764[_0xdbd1('0x60')],md5(_0x968764[_0xdbd1('0x60')]));if(_0x3d4481&&_0x3d4481[_0xdbd1('0x61')]){logger['info']('[QUEUE]',_0xdbd1('0x62'));_0x968764[_0xdbd1('0x63')]=_0x2a7606;}else if(_0x4fc3d5&&_0x4fc3d5[_0xdbd1('0x64')]&&_0x4fc3d5[_0xdbd1('0x64')]!==_0xdbd1('0x65')){logger[_0xdbd1('0x2a')](_0xdbd1('0x66'),_0xdbd1('0x62'));_0x968764[_0xdbd1('0x63')]=_0x2a7606;}else{_0x968764[_0xdbd1('0x63')]='';}return getUser(_0x4da655,_0x5706c1,_0x18b5eb,_0xccd99f,_0x3d68c1,_0x563718)[_0xdbd1('0x17')](function(_0x292599){logger['info']('['+_0x563718['toUpperCase']()+_0xdbd1('0x67'),_0x292599[_0xdbd1('0x29')]);logger[_0xdbd1('0x2a')]('['+_0x563718[_0xdbd1('0x1b')]()+']\x20The\x20User\x20email\x20is:',_0x292599[_0xdbd1('0x23')]);return getEndUser(_0x292599,_0x5706c1,_0xccd99f,_0x3d68c1,_0x968764,_0x563718,_0x2568ec['moduleCreate'],_0x2568ec['additionalSearchContact']);})[_0xdbd1('0x17')](function(_0x5588b3){logger[_0xdbd1('0x2a')]('['+_0x563718['toUpperCase']()+_0xdbd1('0x68'),_0x5588b3[_0xdbd1('0x3a')]);logger[_0xdbd1('0x2a')]('['+_0x563718[_0xdbd1('0x1b')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x968764['calleridnum']);return getTicket(_0x5588b3,_0x5706c1,_0xccd99f,_0x3d68c1,_0x968764,_0x2568ec,_0x563718);})['then'](function(_0xecbb32){logger[_0xdbd1('0x2a')](util[_0xdbd1('0x56')]('['+_0x563718['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2568ec[_0xdbd1('0x4f')],_0xecbb32[_0xdbd1('0x55')]));logger[_0xdbd1('0x2a')](util[_0xdbd1('0x56')]('['+_0x563718['toUpperCase']()+_0xdbd1('0x69'),_0x563718));if(_0x563718!=='unmanaged'&&_0x2568ec[_0xdbd1('0x6a')]){logger[_0xdbd1('0x2a')]('['+_0x563718[_0xdbd1('0x1b')]()+']',_0xdbd1('0x6b'));emit(_0x5706c1['remoteUri'],_0x18b5eb[_0xdbd1('0x6c')],_0x2568ec[_0xdbd1('0x4f')],_0xecbb32[_0xdbd1('0x55')]);}})[_0xdbd1('0x19')](function(_0x19eb6e){logger[_0xdbd1('0x1a')]('['+_0x563718[_0xdbd1('0x1b')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x19eb6e[_0xdbd1('0x1d')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x19eb6e);});}; \ 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 6462443..85cf389 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 _0x9aae=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','custom_fields','mapValues','keyBy','value','remoteUri','then','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','nameField','customField','toLowerCase','content','idField','type','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','serverUrl','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost'];(function(_0x588faa,_0x387b78){var _0x2809aa=function(_0x26264a){while(--_0x26264a){_0x588faa['push'](_0x588faa['shift']());}};_0x2809aa(++_0x387b78);}(_0x9aae,0x1d0));var _0xe9aa=function(_0x1fce40,_0x14da33){_0x1fce40=_0x1fce40-0x0;var _0x24a31c=_0x9aae[_0x1fce40];return _0x24a31c;};'use strict';var _=require(_0xe9aa('0x0'));var rp=require(_0xe9aa('0x1'));var md5=require(_0xe9aa('0x2'));var util=require(_0xe9aa('0x3'));var Redis=require(_0xe9aa('0x4'));var intUtil=require(_0xe9aa('0x5'));var config=require(_0xe9aa('0x6'));var logger=require('../../../../config/logger')(_0xe9aa('0x7'));config[_0xe9aa('0x8')]=_[_0xe9aa('0x9')](config[_0xe9aa('0x8')],{'host':_0xe9aa('0xa'),'port':0x18eb});var io=require(_0xe9aa('0xb'))(new Redis(config[_0xe9aa('0x8')]));var headers={'Content-Type':_0xe9aa('0xc'),'Accept':_0xe9aa('0xc')};function emit(_0x1e3662,_0x10389c,_0x267090){io['to'](_0x1e3662)[_0xe9aa('0xd')](_0x10389c,_0x267090);}function getTicket(_0x456f6c,_0x3e1246,_0x5441e9,_0x379ce2,_0x24f496){logger[_0xe9aa('0xe')](_0xe9aa('0xf'));var _0x48cf1d=_[_0xe9aa('0x10')]({'responder_id':_0x3e1246['id'],'requester_id':_0x5441e9['id'],'name':util[_0xe9aa('0x11')](_0xe9aa('0x12'),_0x24f496[_0xe9aa('0x13')]),'phone':_0x24f496[_0xe9aa('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe9aa('0x15')](_0x379ce2[_0xe9aa('0x16')],_0x24f496,'\x20'),'description':intUtil[_0xe9aa('0x15')](_0x379ce2['Descriptions'],_0x24f496,'
'),'tags':getTags(_0x379ce2[_0xe9aa('0x17')],_0xe9aa('0x18'))},getCustomFields(_0x379ce2['Fields'],_0x24f496));_0x48cf1d[_0xe9aa('0x19')]=_[_0xe9aa('0x1a')](_[_0xe9aa('0x1b')](_0x48cf1d['custom_fields'],'id'),_0xe9aa('0x1c'));return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/tickets',_0x456f6c[_0xe9aa('0x1d')]),'method':'POST','body':_0x48cf1d})[_0xe9aa('0x1e')](function(_0xe5fe13){logger[_0xe9aa('0xe')]('Ticket\x20created!');return _0xe5fe13;});}function getUser(_0x53520e,_0x33a481){if(intUtil[_0xe9aa('0x1f')](_0x33a481)){return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/agents',_0x53520e['remoteUri']),'qs':{'email':_0x33a481}})[_0xe9aa('0x1e')](function(_0x3d265c){if(_0x3d265c[_0xe9aa('0x20')]){logger[_0xe9aa('0xe')](_0xe9aa('0x21'));return _[_0xe9aa('0x22')](_0x3d265c,function(_0x225392){return _0x225392[_0xe9aa('0x23')][_0xe9aa('0x24')]===_0x33a481;});}else{logger[_0xe9aa('0xe')](_0xe9aa('0x25'));return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x26'),_0x53520e['remoteUri'])})[_0xe9aa('0x1e')](function(_0x553821){logger[_0xe9aa('0xe')](_0xe9aa('0x27'));return _0x553821;});}});}else{logger['info'](_0xe9aa('0x28'));return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x26'),_0x53520e[_0xe9aa('0x1d')])})['then'](function(_0x5116fb){logger[_0xe9aa('0xe')](_0xe9aa('0x27'));return _0x5116fb;});}}function getEndUser(_0x227689,_0xf72678,_0xa4c0ac){logger[_0xe9aa('0xe')]('Searching\x20enduser\x20with\x20phone',_0xa4c0ac);return request({'uri':util[_0xe9aa('0x11')](_0xe9aa('0x29'),_0x227689['remoteUri']),'qs':{'phone':_0xa4c0ac}})[_0xe9aa('0x1e')](function(_0x5a2f11){if(_0x5a2f11['length']){logger[_0xe9aa('0xe')](_0xe9aa('0x2a'));return _[_0xe9aa('0x22')](_0x5a2f11,{'phone':_0xa4c0ac});}else{logger[_0xe9aa('0xe')](_0xe9aa('0x2b'));return request({'uri':util[_0xe9aa('0x11')]('%s/api/v2/contacts',_0x227689[_0xe9aa('0x1d')]),'method':_0xe9aa('0x2c'),'body':{'name':_0xf72678,'phone':_0xa4c0ac}})[_0xe9aa('0x1e')](function(_0x55f81a){logger['info'](_0xe9aa('0x2d'));return _0x55f81a;});}});}function getAuth(_0x46e4e7){return util[_0xe9aa('0x11')]('Basic\x20%s',new Buffer(_0x46e4e7[_0xe9aa('0x2e')]+':X')[_0xe9aa('0x2f')](_0xe9aa('0x30')));}function request(_0x3cabb0){logger[_0xe9aa('0x31')](_0xe9aa('0x32'),JSON[_0xe9aa('0x33')](_0x3cabb0));return rp(_[_0xe9aa('0x9')](_0x3cabb0,{'method':_0xe9aa('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4813e3,_0x1be4b9){var _0x375977=[];if(_0x4813e3&&_0x4813e3[_0xe9aa('0x20')]>0x0){_0x375977=_[_0xe9aa('0x35')](_0x4813e3,_0x1be4b9);}return _0x375977;}function getCustomFields(_0x5aae33,_0x136f13){var _0x2bf4b7=[];var _0x137700={'custom_fields':[]};if(_0x5aae33['length']>0x0){_['forEach'](_0x5aae33,function(_0x4be669){if(_[_0xe9aa('0x36')]([_0xe9aa('0x37'),_0xe9aa('0x38')],_0x4be669['type'])&&_0x4be669[_0xe9aa('0x39')]&&!_0x4be669[_0xe9aa('0x3a')]){_0x137700[_0x4be669[_0xe9aa('0x39')][_0xe9aa('0x3b')]()]=_0x4be669[_0xe9aa('0x3c')]['toString']();}else if(_[_0xe9aa('0x36')]([_0xe9aa('0x37'),_0xe9aa('0x38')],_0x4be669['type'])&&_0x4be669[_0xe9aa('0x3d')]&&_0x4be669['customField']){_0x137700[_0xe9aa('0x19')]['push']({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x4be669['content'][_0xe9aa('0x2f')]()});}else if(_0x4be669[_0xe9aa('0x3e')]===_0xe9aa('0x3f')&&_0x4be669['variableName']&&_0x4be669[_0xe9aa('0x3d')]&&_0x4be669[_0xe9aa('0x3a')]){_0x136f13[_0x4be669[_0xe9aa('0x40')]]&&_0x137700[_0xe9aa('0x19')][_0xe9aa('0x41')]({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x136f13[_0x4be669[_0xe9aa('0x40')]][_0xe9aa('0x2f')]()});}else if(_0x4be669[_0xe9aa('0x3e')]===_0xe9aa('0x42')&&_0x4be669[_0xe9aa('0x43')]&&_0x4be669[_0xe9aa('0x43')][_0xe9aa('0x18')]&&_0x4be669['idField']&&_0x4be669['customField']){_0x136f13[_0x4be669[_0xe9aa('0x43')][_0xe9aa('0x18')][_0xe9aa('0x3b')]()]&&_0x137700[_0xe9aa('0x19')]['push']({'id':_0x4be669[_0xe9aa('0x3d')],'value':_0x136f13[_0x4be669['Variable'][_0xe9aa('0x18')]['toLowerCase']()][_0xe9aa('0x2f')]()});}});}return _0x137700;}exports[_0xe9aa('0x44')]=function(_0xedfd09,_0x469411,_0x34d9cf,_0x361286,_0xa44d5a,_0x522089){var _0x3acc9d,_0x34ff86;_0x522089['remoteUri']=intUtil[_0xe9aa('0x45')](_0x522089[_0xe9aa('0x1d')]);_0x522089['serverUrl']=intUtil['stripTrailingSlash'](_0x522089['serverUrl']);if(_0xa44d5a&&_0xa44d5a[_0xe9aa('0x46')]){logger['info'](_0xe9aa('0x47'),_0xe9aa('0x48'));_0x469411[_0xe9aa('0x49')]=util[_0xe9aa('0x11')](_0xe9aa('0x4a'),_0x522089['serverUrl'],_0x469411[_0xe9aa('0x4b')],md5(_0x469411[_0xe9aa('0x4b')]));}else{_0x469411[_0xe9aa('0x49')]='';}headers[_0xe9aa('0x4c')]=getAuth(_0x522089);return getUser(_0x522089,_0x361286[_0xe9aa('0x24')])[_0xe9aa('0x1e')](function(_0x1ec301){_0x3acc9d=_0x1ec301;logger[_0xe9aa('0xe')](_0xe9aa('0x4d'),_0x3acc9d['id']);return getEndUser(_0x522089,_0x469411['calleridname'],_0x469411[_0xe9aa('0x14')]);})['then'](function(_0x154468){_0x34ff86=_0x154468;logger['info']('The\x20Enduser\x20ID\x20is:',_0x34ff86['id']);return getTicket(_0x522089,_0x3acc9d,_0x34ff86,_0x34d9cf,_0x469411);})[_0xe9aa('0x1e')](function(_0x542f61){if(_0x542f61&&_0x542f61['id']){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')](_0xe9aa('0x4f'),_0x542f61['id']);logger[_0xe9aa('0xe')](_0xe9aa('0x47'),_0xe9aa('0x50'));emit(util[_0xe9aa('0x11')](_0xe9aa('0x51'),_0x361286['name']),_0xe9aa('0x52'),{'uri':util[_0xe9aa('0x11')](_0xe9aa('0x53'),_0x522089[_0xe9aa('0x1d')],_0x542f61['id'])});}})[_0xe9aa('0x54')](function(_0x1ef583){logger[_0xe9aa('0x55')](_0xe9aa('0x47'),JSON[_0xe9aa('0x33')](_0x1ef583));});};exports['outbound']=function(_0x44efeb,_0x296b8a,_0x5397a4,_0x1a68ed,_0x24c35d,_0x3b7460,_0xad1189){var _0x27f7e2,_0x1db1e2;_0x3b7460[_0xe9aa('0x1d')]=intUtil[_0xe9aa('0x45')](_0x3b7460[_0xe9aa('0x1d')]);_0x3b7460[_0xe9aa('0x56')]=intUtil[_0xe9aa('0x45')](_0x3b7460['serverUrl']);if(_0xad1189&&_0xad1189[_0xe9aa('0x57')]&&_0xad1189[_0xe9aa('0x57')]!=='none'){logger[_0xe9aa('0xe')](_0xe9aa('0x58'),_0xe9aa('0x48'));_0x296b8a[_0xe9aa('0x49')]=util[_0xe9aa('0x11')](_0xe9aa('0x4a'),_0x3b7460[_0xe9aa('0x56')],_0x296b8a[_0xe9aa('0x4b')],md5(_0x296b8a[_0xe9aa('0x4b')]));}headers[_0xe9aa('0x4c')]=getAuth(_0x3b7460);return getUser(_0x3b7460,_0x1a68ed['email'])[_0xe9aa('0x1e')](function(_0x60c944){_0x27f7e2=_0x60c944;logger[_0xe9aa('0xe')]('The\x20User\x20ID\x20is:',_0x27f7e2['id']);return getEndUser(_0x3b7460,_0x296b8a[_0xe9aa('0x59')],_0x296b8a[_0xe9aa('0x5a')]);})[_0xe9aa('0x1e')](function(_0x379c53){_0x1db1e2=_0x379c53;logger['info'](_0xe9aa('0x5b'),_0x1db1e2['id']);return getTicket(_0x3b7460,_0x27f7e2,_0x1db1e2,_0x5397a4,_0x296b8a);})['then'](function(_0x5864bb){if(_0x5864bb&&_0x5864bb['id']){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5864bb['id']);logger[_0xe9aa('0xe')](_0xe9aa('0x58'),_0xe9aa('0x50'));emit(util[_0xe9aa('0x11')](_0xe9aa('0x51'),_0x1a68ed[_0xe9aa('0x18')]),_0xe9aa('0x52'),{'uri':util[_0xe9aa('0x11')](_0xe9aa('0x53'),_0x3b7460[_0xe9aa('0x1d')],_0x5864bb['id'])});}})[_0xe9aa('0x54')](function(_0x53d89f){logger[_0xe9aa('0x55')](_0xe9aa('0x58'),JSON[_0xe9aa('0x33')](_0x53d89f));});};exports[_0xe9aa('0x5c')]=function(_0x19b465,_0x3f7fa8,_0x104571,_0x144001,_0x450a96,_0x23afc4){var _0x4cc620,_0x392a85;_0x23afc4[_0xe9aa('0x1d')]=intUtil['stripTrailingSlash'](_0x23afc4[_0xe9aa('0x1d')]);_0x23afc4[_0xe9aa('0x56')]=intUtil[_0xe9aa('0x45')](_0x23afc4[_0xe9aa('0x56')]);if(_0x450a96&&_0x450a96[_0xe9aa('0x46')]){logger['info']('['+_0x3f7fa8[_0xe9aa('0x5d')][_0xe9aa('0x5e')]()+']',_0xe9aa('0x48'));_0x3f7fa8['recordingURL']=util['format'](_0xe9aa('0x4a'),_0x23afc4['serverUrl'],_0x3f7fa8['uniqueid'],md5(_0x3f7fa8['uniqueid']));}else{_0x3f7fa8[_0xe9aa('0x49')]='';}headers[_0xe9aa('0x4c')]=getAuth(_0x23afc4);return getUser(_0x23afc4,'')[_0xe9aa('0x1e')](function(_0x16f629){_0x4cc620=_0x16f629;logger['info'](_0xe9aa('0x4d'),_0x4cc620['id']);return getEndUser(_0x23afc4,_0x3f7fa8[_0xe9aa('0x13')],_0x3f7fa8['calleridnum']);})[_0xe9aa('0x1e')](function(_0x4009cd){_0x392a85=_0x4009cd;logger['info'](_0xe9aa('0x5b'),_0x392a85['id']);return getTicket(_0x23afc4,_0x4cc620,_0x392a85,_0x104571,_0x3f7fa8);})[_0xe9aa('0x1e')](function(_0x229092){if(_0x229092){logger[_0xe9aa('0xe')](_0xe9aa('0x4e'));logger[_0xe9aa('0xe')](_0xe9aa('0x4f'),_0x229092['id']);}})[_0xe9aa('0x54')](function(_0x34d897){logger['error']('['+_0x3f7fa8['lastevent'][_0xe9aa('0x5e')]()+']',JSON[_0xe9aa('0x33')](_0x34d897));});}; \ No newline at end of file +var _0x0dec=['application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter'];(function(_0x2dbf6d,_0x1ed975){var _0x269475=function(_0x217213){while(--_0x217213){_0x2dbf6d['push'](_0x2dbf6d['shift']());}};_0x269475(++_0x1ed975);}(_0x0dec,0xb7));var _0xc0de=function(_0x3913c5,_0x29776c){_0x3913c5=_0x3913c5-0x0;var _0x283916=_0x0dec[_0x3913c5];return _0x283916;};'use strict';var _=require(_0xc0de('0x0'));var rp=require(_0xc0de('0x1'));var md5=require('md5');var util=require(_0xc0de('0x2'));var Redis=require(_0xc0de('0x3'));var intUtil=require('./util');var config=require(_0xc0de('0x4'));var logger=require(_0xc0de('0x5'))('freshdesk');config[_0xc0de('0x6')]=_[_0xc0de('0x7')](config[_0xc0de('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc0de('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0xc0de('0x9'),'Accept':_0xc0de('0x9')};function emit(_0xb2158a,_0x453e05,_0x17536b){io['to'](_0xb2158a)[_0xc0de('0xa')](_0x453e05,_0x17536b);}function getTicket(_0x3d3bb3,_0x291c15,_0x130b0b,_0x40c717,_0x319fb3){logger[_0xc0de('0xb')](_0xc0de('0xc'));var _0x45959c=_[_0xc0de('0xd')]({'responder_id':_0x291c15['id'],'requester_id':_0x130b0b['id'],'name':util[_0xc0de('0xe')](_0xc0de('0xf'),_0x319fb3[_0xc0de('0x10')]),'phone':_0x319fb3[_0xc0de('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x40c717[_0xc0de('0x12')],_0x319fb3,'\x20'),'description':intUtil[_0xc0de('0x13')](_0x40c717[_0xc0de('0x14')],_0x319fb3,_0xc0de('0x15')),'tags':getTags(_0x40c717[_0xc0de('0x16')],_0xc0de('0x17'))},getCustomFields(_0x40c717['Fields'],_0x319fb3));_0x45959c[_0xc0de('0x18')]=_[_0xc0de('0x19')](_[_0xc0de('0x1a')](_0x45959c[_0xc0de('0x18')],'id'),_0xc0de('0x1b'));return request({'uri':util[_0xc0de('0xe')](_0xc0de('0x1c'),_0x3d3bb3[_0xc0de('0x1d')]),'method':_0xc0de('0x1e'),'body':_0x45959c})['then'](function(_0x5aa254){logger[_0xc0de('0xb')](_0xc0de('0x1f'));return _0x5aa254;});}function getUser(_0x3b352f,_0x19c5fc){if(intUtil[_0xc0de('0x20')](_0x19c5fc)){return request({'uri':util[_0xc0de('0xe')](_0xc0de('0x21'),_0x3b352f[_0xc0de('0x1d')]),'qs':{'email':_0x19c5fc}})['then'](function(_0x408990){if(_0x408990[_0xc0de('0x22')]){logger[_0xc0de('0xb')](_0xc0de('0x23'));return _[_0xc0de('0x24')](_0x408990,function(_0x247c56){return _0x247c56['contact'][_0xc0de('0x25')]===_0x19c5fc;});}else{logger['info'](_0xc0de('0x26'));return request({'uri':util[_0xc0de('0xe')](_0xc0de('0x27'),_0x3b352f[_0xc0de('0x1d')])})[_0xc0de('0x28')](function(_0x4942c4){logger[_0xc0de('0xb')]('Admin\x20account\x20selected.');return _0x4942c4;});}});}else{logger[_0xc0de('0xb')](_0xc0de('0x29'));return request({'uri':util[_0xc0de('0xe')](_0xc0de('0x27'),_0x3b352f[_0xc0de('0x1d')])})[_0xc0de('0x28')](function(_0x85249c){logger['info'](_0xc0de('0x2a'));return _0x85249c;});}}function getEndUser(_0x41a2ad,_0x589d52,_0x35be95){logger[_0xc0de('0xb')](_0xc0de('0x2b'),_0x35be95);return request({'uri':util[_0xc0de('0xe')]('%s/api/v2/contacts',_0x41a2ad[_0xc0de('0x1d')]),'qs':{'phone':_0x35be95}})[_0xc0de('0x28')](function(_0x3f2dab){if(_0x3f2dab[_0xc0de('0x22')]){logger['info'](_0xc0de('0x2c'));return _[_0xc0de('0x24')](_0x3f2dab,{'phone':_0x35be95});}else{logger[_0xc0de('0xb')](_0xc0de('0x2d'));return request({'uri':util[_0xc0de('0xe')](_0xc0de('0x2e'),_0x41a2ad[_0xc0de('0x1d')]),'method':'POST','body':{'name':_0x589d52,'phone':_0x35be95}})['then'](function(_0x58c167){logger[_0xc0de('0xb')](_0xc0de('0x2f'));return _0x58c167;});}});}function getAuth(_0x343939){return util[_0xc0de('0xe')](_0xc0de('0x30'),new Buffer(_0x343939[_0xc0de('0x31')]+':X')[_0xc0de('0x32')]('base64'));}function request(_0x47712b){logger[_0xc0de('0x33')](_0xc0de('0x34'),JSON[_0xc0de('0x35')](_0x47712b));return rp(_['defaults'](_0x47712b,{'method':_0xc0de('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4d7bc1,_0x5c4511){var _0xcb94dd=[];if(_0x4d7bc1&&_0x4d7bc1['length']>0x0){_0xcb94dd=_[_0xc0de('0x37')](_0x4d7bc1,_0x5c4511);}return _0xcb94dd;}function getCustomFields(_0xec671d,_0x1d7a5e){var _0x541db3=[];var _0x4b9374={'custom_fields':[]};if(_0xec671d[_0xc0de('0x22')]>0x0){_[_0xc0de('0x38')](_0xec671d,function(_0x27b0f8){if(_[_0xc0de('0x39')]([_0xc0de('0x3a'),_0xc0de('0x3b')],_0x27b0f8[_0xc0de('0x3c')])&&_0x27b0f8[_0xc0de('0x3d')]&&!_0x27b0f8[_0xc0de('0x3e')]){_0x4b9374[_0x27b0f8[_0xc0de('0x3d')]['toLowerCase']()]=_0x27b0f8[_0xc0de('0x3f')][_0xc0de('0x32')]();}else if(_['includes']([_0xc0de('0x3a'),_0xc0de('0x3b')],_0x27b0f8[_0xc0de('0x3c')])&&_0x27b0f8[_0xc0de('0x40')]&&_0x27b0f8['customField']){_0x4b9374[_0xc0de('0x18')]['push']({'id':_0x27b0f8[_0xc0de('0x40')],'value':_0x27b0f8['content'][_0xc0de('0x32')]()});}else if(_0x27b0f8[_0xc0de('0x3c')]===_0xc0de('0x41')&&_0x27b0f8['variableName']&&_0x27b0f8[_0xc0de('0x40')]&&_0x27b0f8[_0xc0de('0x3e')]){_0x1d7a5e[_0x27b0f8[_0xc0de('0x42')]]&&_0x4b9374[_0xc0de('0x18')]['push']({'id':_0x27b0f8['idField'],'value':_0x1d7a5e[_0x27b0f8[_0xc0de('0x42')]][_0xc0de('0x32')]()});}else if(_0x27b0f8[_0xc0de('0x3c')]===_0xc0de('0x43')&&_0x27b0f8['Variable']&&_0x27b0f8[_0xc0de('0x44')][_0xc0de('0x17')]&&_0x27b0f8[_0xc0de('0x40')]&&_0x27b0f8[_0xc0de('0x3e')]){_0x1d7a5e[_0x27b0f8[_0xc0de('0x44')][_0xc0de('0x17')][_0xc0de('0x45')]()]&&_0x4b9374[_0xc0de('0x18')]['push']({'id':_0x27b0f8[_0xc0de('0x40')],'value':_0x1d7a5e[_0x27b0f8[_0xc0de('0x44')][_0xc0de('0x17')][_0xc0de('0x45')]()][_0xc0de('0x32')]()});}});}return _0x4b9374;}exports[_0xc0de('0x46')]=function(_0x7f04e3,_0x522c57,_0x59a834,_0x54778e,_0x5c2443,_0x2fb8cf){var _0x50319e,_0x187da3;_0x2fb8cf[_0xc0de('0x1d')]=intUtil[_0xc0de('0x47')](_0x2fb8cf[_0xc0de('0x1d')]);_0x2fb8cf[_0xc0de('0x48')]=intUtil['stripTrailingSlash'](_0x2fb8cf[_0xc0de('0x48')]);if(_0x5c2443&&_0x5c2443[_0xc0de('0x49')]){logger[_0xc0de('0xb')](_0xc0de('0x4a'),'Recording\x20is\x20enabled!');_0x522c57[_0xc0de('0x4b')]=util['format'](_0xc0de('0x4c'),_0x2fb8cf[_0xc0de('0x48')],_0x522c57['uniqueid'],md5(_0x522c57[_0xc0de('0x4d')]));}else{_0x522c57['recordingURL']='';}headers[_0xc0de('0x4e')]=getAuth(_0x2fb8cf);return getUser(_0x2fb8cf,_0x54778e[_0xc0de('0x25')])[_0xc0de('0x28')](function(_0x131f29){_0x50319e=_0x131f29;logger[_0xc0de('0xb')](_0xc0de('0x4f'),_0x50319e['id']);return getEndUser(_0x2fb8cf,_0x522c57['calleridname'],_0x522c57[_0xc0de('0x11')]);})[_0xc0de('0x28')](function(_0x24c077){_0x187da3=_0x24c077;logger[_0xc0de('0xb')](_0xc0de('0x50'),_0x187da3['id']);return getTicket(_0x2fb8cf,_0x50319e,_0x187da3,_0x59a834,_0x522c57);})[_0xc0de('0x28')](function(_0x170e41){if(_0x170e41&&_0x170e41['id']){logger[_0xc0de('0xb')](_0xc0de('0x1f'));logger[_0xc0de('0xb')]('The\x20Ticket\x20ID\x20is:',_0x170e41['id']);logger[_0xc0de('0xb')](_0xc0de('0x4a'),_0xc0de('0x51'));emit(util[_0xc0de('0xe')](_0xc0de('0x52'),_0x54778e[_0xc0de('0x17')]),_0xc0de('0x53'),{'uri':util[_0xc0de('0xe')](_0xc0de('0x54'),_0x2fb8cf['remoteUri'],_0x170e41['id'])});}})[_0xc0de('0x55')](function(_0x26181e){logger[_0xc0de('0x56')]('[QUEUE]',JSON[_0xc0de('0x35')](_0x26181e));});};exports['outbound']=function(_0x13a777,_0x36af82,_0x4f69bd,_0x11cc11,_0x599bce,_0x33007e,_0x1629c7){var _0x396bd6,_0x3cd953;_0x33007e[_0xc0de('0x1d')]=intUtil[_0xc0de('0x47')](_0x33007e['remoteUri']);_0x33007e[_0xc0de('0x48')]=intUtil[_0xc0de('0x47')](_0x33007e['serverUrl']);if(_0x1629c7&&_0x1629c7[_0xc0de('0x57')]&&_0x1629c7[_0xc0de('0x57')]!==_0xc0de('0x58')){logger[_0xc0de('0xb')](_0xc0de('0x59'),_0xc0de('0x5a'));_0x36af82[_0xc0de('0x4b')]=util['format'](_0xc0de('0x4c'),_0x33007e['serverUrl'],_0x36af82['uniqueid'],md5(_0x36af82[_0xc0de('0x4d')]));}headers[_0xc0de('0x4e')]=getAuth(_0x33007e);return getUser(_0x33007e,_0x11cc11['email'])[_0xc0de('0x28')](function(_0x1c39fe){_0x396bd6=_0x1c39fe;logger['info'](_0xc0de('0x4f'),_0x396bd6['id']);return getEndUser(_0x33007e,_0x36af82[_0xc0de('0x5b')],_0x36af82['destcalleridnum']);})[_0xc0de('0x28')](function(_0x32bd0f){_0x3cd953=_0x32bd0f;logger['info'](_0xc0de('0x50'),_0x3cd953['id']);return getTicket(_0x33007e,_0x396bd6,_0x3cd953,_0x4f69bd,_0x36af82);})[_0xc0de('0x28')](function(_0x532852){if(_0x532852&&_0x532852['id']){logger[_0xc0de('0xb')](_0xc0de('0x1f'));logger[_0xc0de('0xb')]('The\x20Ticket\x20ID\x20is:',_0x532852['id']);logger[_0xc0de('0xb')](_0xc0de('0x59'),_0xc0de('0x51'));emit(util[_0xc0de('0xe')](_0xc0de('0x52'),_0x11cc11[_0xc0de('0x17')]),_0xc0de('0x53'),{'uri':util[_0xc0de('0xe')](_0xc0de('0x54'),_0x33007e['remoteUri'],_0x532852['id'])});}})['catch'](function(_0x37675a){logger[_0xc0de('0x56')](_0xc0de('0x59'),JSON[_0xc0de('0x35')](_0x37675a));});};exports[_0xc0de('0x5c')]=function(_0x2cf0ed,_0x135ab5,_0x3b0450,_0x5e3eab,_0x237591,_0xb85d6c){var _0x1a8b5f,_0x3a348a;_0xb85d6c[_0xc0de('0x1d')]=intUtil['stripTrailingSlash'](_0xb85d6c['remoteUri']);_0xb85d6c[_0xc0de('0x48')]=intUtil[_0xc0de('0x47')](_0xb85d6c['serverUrl']);if(_0x237591&&_0x237591['monitor_format']){logger[_0xc0de('0xb')]('['+_0x135ab5[_0xc0de('0x5d')][_0xc0de('0x5e')]()+']',_0xc0de('0x5a'));_0x135ab5[_0xc0de('0x4b')]=util[_0xc0de('0xe')](_0xc0de('0x4c'),_0xb85d6c[_0xc0de('0x48')],_0x135ab5[_0xc0de('0x4d')],md5(_0x135ab5[_0xc0de('0x4d')]));}else{_0x135ab5[_0xc0de('0x4b')]='';}headers[_0xc0de('0x4e')]=getAuth(_0xb85d6c);return getUser(_0xb85d6c,'')[_0xc0de('0x28')](function(_0x5ad021){_0x1a8b5f=_0x5ad021;logger['info']('The\x20User\x20ID\x20is:',_0x1a8b5f['id']);return getEndUser(_0xb85d6c,_0x135ab5[_0xc0de('0x10')],_0x135ab5[_0xc0de('0x11')]);})['then'](function(_0x3eee2d){_0x3a348a=_0x3eee2d;logger['info'](_0xc0de('0x50'),_0x3a348a['id']);return getTicket(_0xb85d6c,_0x1a8b5f,_0x3a348a,_0x3b0450,_0x135ab5);})['then'](function(_0x3e6dbb){if(_0x3e6dbb){logger[_0xc0de('0xb')](_0xc0de('0x1f'));logger[_0xc0de('0xb')](_0xc0de('0x5f'),_0x3e6dbb['id']);}})[_0xc0de('0x55')](function(_0x102de1){logger[_0xc0de('0x56')]('['+_0x135ab5[_0xc0de('0x5d')][_0xc0de('0x5e')]()+']',JSON['stringify'](_0x102de1));});}; \ 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 dc3a987..9478e8b 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 _0xbf9b=['contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','bluebird','ioredis','freshsales','redis','localhost','GET','/api/selector/owners','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','userId','User\x20found:','userEmail','/api/lookup?q=','&f=','&entities=contact','find'];(function(_0x23aeaa,_0x18e477){var _0x5758bb=function(_0x5651ad){while(--_0x5651ad){_0x23aeaa['push'](_0x23aeaa['shift']());}};_0x5758bb(++_0x18e477);}(_0xbf9b,0xd8));var _0xbbf9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbf9b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xbbf9('0x0'));var rp=require(_0xbbf9('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xbbf9('0x2'));var Promise=require(_0xbbf9('0x3'));var Redis=require(_0xbbf9('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xbbf9('0x5'));config[_0xbbf9('0x6')]=_['defaults'](config[_0xbbf9('0x6')],{'host':_0xbbf9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbbf9('0x6')]));function getAdminId(_0x6d6161,_0x37f2f1,_0x213d2d,_0x11d096){return new Promise(function(_0x120799,_0x162805){var _0x5430e3=![];var _0x32528e={'method':_0xbbf9('0x8'),'uri':_0x11d096+_0xbbf9('0x9'),'json':!![]};_0x32528e['headers']=_0x213d2d;logger[_0xbbf9('0xa')]('Getting\x20admin\x20information');return rp(_0x32528e)[_0xbbf9('0xb')](function(_0x1cfadf){if(_0x1cfadf){var _0x37ebbd=_0x1cfadf[_0xbbf9('0xc')];var _0x4cb265=null;for(_0x4cb265=0x0;_0x4cb265<_0x37ebbd[_0xbbf9('0xd')];_0x4cb265++){if(_0x37ebbd[_0x4cb265][_0xbbf9('0xe')]===_0x6d6161[_0xbbf9('0xf')]){_0x6d6161[_0xbbf9('0x10')]=_0x37ebbd[_0x4cb265]['id'];_0x5430e3=!![];}}if(_0x5430e3){logger[_0xbbf9('0xa')](_0xbbf9('0x11'),_0x6d6161[_0xbbf9('0x10')]);_0x120799(_0x6d6161);}else{_0x162805({'statusCode':0x194,'message':_0xbbf9('0x12')});}}else{_0x162805({'statusCode':0x194,'message':_0xbbf9('0x12')});}})[_0xbbf9('0x13')](function(_0x458b7a){logger[_0xbbf9('0x14')]('['+[_0x37f2f1[_0xbbf9('0x15')]()]+']',_0x458b7a[_0xbbf9('0x16')]);_0x162805(_0x458b7a);});});}function getUser(_0x1fa116,_0x9b862e,_0x13b485){return function(_0x3d03c0){return new Promise(function(_0x2ee8a2,_0x229434){var _0x1b2637={'method':_0xbbf9('0x8'),'uri':_0x13b485+_0xbbf9('0x9'),'json':!![]};_0x1b2637[_0xbbf9('0x17')]=_0x9b862e;logger['info'](_0xbbf9('0x18'));return rp(_0x1b2637)[_0xbbf9('0xb')](function(_0x173c25){if(_0x173c25){var _0x58a158=_0x173c25[_0xbbf9('0xc')];var _0x459ba3=![];var _0x532757=null;if(_0x3d03c0[_0xbbf9('0x19')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3d03c0['agentEmail']);_0x3d03c0['userEmail']=_0x3d03c0[_0xbbf9('0x19')];for(_0x532757=0x0;_0x532757<_0x58a158[_0xbbf9('0xd')];_0x532757++){if(_0x58a158[_0x532757]['email']===_0x3d03c0[_0xbbf9('0x19')]){_0x459ba3=!![];_0x3d03c0[_0xbbf9('0x1a')]=_0x58a158[_0x532757]['id'];logger['info'](_0xbbf9('0x1b'),_0x3d03c0[_0xbbf9('0x1a')]);}}}if(!_0x459ba3){logger[_0xbbf9('0xa')]('Admin\x20selected');_0x3d03c0[_0xbbf9('0x1c')]=_0x3d03c0[_0xbbf9('0xf')];_0x3d03c0['userId']=_0x3d03c0[_0xbbf9('0x10')];_0x459ba3=!![];}if(_0x459ba3){_0x2ee8a2(_0x3d03c0);}else{_0x229434({'statusCode':0x194,'message':_0xbbf9('0x12')});}}else{_0x229434({'statusCode':0x194,'message':_0xbbf9('0x12')});}})['catch'](function(_0x41f844){logger[_0xbbf9('0x14')]('['+[_0x1fa116['toUpperCase']()]+']',_0x41f844[_0xbbf9('0x16')]);_0x229434(_0x41f844);});});};}function searchContact(_0x3ce6d5,_0x1046e7,_0x29d501,_0x57c198){return new Promise(function(_0x54cc15,_0xcbb3e6){var _0x4ffde6={'method':_0xbbf9('0x8'),'headers':_0x1046e7,'uri':_0x3ce6d5+_0xbbf9('0x1d')+_0x57c198+_0xbbf9('0x1e')+_0x29d501+_0xbbf9('0x1f'),'json':!![]};rp(_0x4ffde6)['then'](function(_0x54cc69){var _0x2c2ece=_[_0xbbf9('0x20')](_0x54cc69[_0xbbf9('0x21')][_0xbbf9('0x21')],[_0x29d501,_0x57c198]);_0x54cc15(_0x2c2ece);})[_0xbbf9('0x13')](function(_0x2e2bd3){_0xcbb3e6(_0x2e2bd3);});});}function getEndUser(_0x335be8,_0x186045,_0x41825c){return function(_0x2974d6){return new Promise(function(_0x45afb7,_0x71ee2d){logger['info'](util[_0xbbf9('0x22')](_0xbbf9('0x23'),_0x2974d6[_0xbbf9('0x24')]));searchContact(_0x41825c,_0x186045,_0xbbf9('0x25'),_0x2974d6[_0xbbf9('0x24')])['then'](function(_0x2fd05e){if(_0x2fd05e){_0x2974d6['endUserId']=_0x2fd05e['id'];logger[_0xbbf9('0xa')](_0xbbf9('0x26'),_0x2974d6[_0xbbf9('0x27')]);return _0x45afb7(_0x2974d6);}searchContact(_0x41825c,_0x186045,_0xbbf9('0x28'),_0x2974d6[_0xbbf9('0x24')])[_0xbbf9('0xb')](function(_0x1efe65){if(_0x1efe65){_0x2974d6['endUserId']=_0x1efe65['id'];logger[_0xbbf9('0xa')](_0xbbf9('0x29'),_0x2974d6[_0xbbf9('0x27')]);return _0x45afb7(_0x2974d6);}createEndUser(_0x2974d6,_0x335be8,_0x186045,_0x41825c)[_0xbbf9('0xb')](function(_0x138f56){logger[_0xbbf9('0xa')](_0xbbf9('0x2a'),_0x138f56[_0xbbf9('0x27')]);return _0x45afb7(_0x138f56);});});})[_0xbbf9('0x13')](function(_0x27b2d6){_0x71ee2d(_0x27b2d6);});});};}function createEndUser(_0x21a2c1,_0x545490,_0x5b1a66,_0x6a974a){return new Promise(function(_0x476ed7,_0x1258b3){var _0x3bded2=moment();var _0x42495e={'method':_0xbbf9('0x2b'),'uri':_0x6a974a+_0xbbf9('0x2c'),'body':{'contact':{'last_name':_0x21a2c1[_0xbbf9('0x24')],'work_number':_0x21a2c1['contactNumber'],'mobile_number':_0x21a2c1['contactNumber'],'owner_id':_0x21a2c1[_0xbbf9('0x1a')],'created_at':_0x3bded2['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x42495e[_0xbbf9('0x17')]=_0x5b1a66;logger[_0xbbf9('0xa')](_0xbbf9('0x2d'));return rp(_0x42495e)[_0xbbf9('0xb')](function(_0xe9c656){_0x21a2c1[_0xbbf9('0x27')]=_0xe9c656['contact']['id'];_0x476ed7(_0x21a2c1);})['catch'](function(_0x37aa50){logger['error']('['+[_0x545490[_0xbbf9('0x15')]()]+']',_0x37aa50['message']);_0x1258b3(_0x37aa50[_0xbbf9('0x16')]);});});}function getTicket(_0x1a3a26,_0x3a135f,_0x5802f3,_0x3aaec5,_0x52ae8d){return function(_0x43ec06){logger[_0xbbf9('0xa')](_0xbbf9('0x2e'));return new Promise(function(_0x530a4b,_0x24338c){var _0xa2024a=moment();var _0xb296d={'method':'POST','uri':_0x5802f3+_0xbbf9('0x2f'),'body':{'title':intUtil[_0xbbf9('0x30')](_0x3aaec5['Subjects'],_0x52ae8d,'\x20'),'description':intUtil[_0xbbf9('0x30')](_0x3aaec5[_0xbbf9('0x31')],_0x52ae8d,'\x0a'),'owner_id':_0x43ec06[_0xbbf9('0x1a')],'creater_id':_0x43ec06[_0xbbf9('0x10')],'targetable_id':_0x43ec06[_0xbbf9('0x27')],'targetable_type':_0xbbf9('0x32'),'created_at':_0xa2024a[_0xbbf9('0x22')](_0xbbf9('0x33')),'due_date':_0xa2024a[_0xbbf9('0x34')](0x1e,'m')['format'](_0xbbf9('0x33'))},'json':!![]};_0xb296d[_0xbbf9('0x17')]=_0x3a135f;return rp(_0xb296d)[_0xbbf9('0xb')](function(_0x3c50b6){_0x43ec06[_0xbbf9('0x35')]=_0x3c50b6[_0xbbf9('0x36')]['id'];logger['info'](_0xbbf9('0x37'),_0x43ec06[_0xbbf9('0x35')]);_0x530a4b(_0x43ec06);})[_0xbbf9('0x13')](function(_0x196093){logger[_0xbbf9('0x14')]('['+[_0x1a3a26[_0xbbf9('0x15')]()]+']',_0x196093['message']);_0x24338c(_0x196093['message']);});});};}function emit(_0xbffa8a,_0x424ebc,_0x2dcbe3){var _0x28eeca={'uri':_0xbffa8a+'/contacts/'+_0x2dcbe3};io['to'](util[_0xbbf9('0x22')](_0xbbf9('0x38'),_0x424ebc))[_0xbbf9('0x39')](_0xbbf9('0x3a'),_0x28eeca);}exports['cs']=function(_0x45d19e,_0x56e426,_0x22b861,_0x2888fd,_0x101210,_0x3c285d,_0xc917d7,_0x5f16af){var _0x1cc4d3={};var _0x225afd={'Authorization':'Token\x20token='+_0x3c285d[_0xbbf9('0x3b')]};_0x3c285d[_0xbbf9('0x3c')]=intUtil['stripTrailingSlash'](_0x3c285d[_0xbbf9('0x3c')]);_0x3c285d[_0xbbf9('0x3d')]=intUtil[_0xbbf9('0x3e')](_0x3c285d[_0xbbf9('0x3d')]);var _0x434538=_0x3c285d[_0xbbf9('0x3c')];_0x1cc4d3[_0xbbf9('0xf')]=_0x3c285d[_0xbbf9('0x3f')];_0x1cc4d3[_0xbbf9('0x24')]=_0x5f16af[_0xbbf9('0x40')]()===_0xbbf9('0x41')?_0x56e426[_0xbbf9('0x42')]:_0x56e426[_0xbbf9('0x43')];_0x1cc4d3[_0xbbf9('0x44')]=_0x5f16af==='queue'||_0x5f16af==='unmanaged'?_0xbbf9('0x45'):'outbound';if(_0x2888fd){_0x1cc4d3['agentEmail']=_0x2888fd[_0xbbf9('0xe')];}var _0x4e120c=util[_0xbbf9('0x22')](_0xbbf9('0x46'),_0x3c285d[_0xbbf9('0x3d')],_0x56e426[_0xbbf9('0x47')],md5(_0x56e426[_0xbbf9('0x47')]));if(_0x101210&&_0x101210[_0xbbf9('0x48')]){logger['info'](_0xbbf9('0x49'),_0xbbf9('0x4a'));_0x56e426['recordingURL']=_0x4e120c;}else if(_0xc917d7&&_0xc917d7[_0xbbf9('0x4b')]&&_0xc917d7[_0xbbf9('0x4b')]!==_0xbbf9('0x4c')){logger[_0xbbf9('0xa')](_0xbbf9('0x4d'),_0xbbf9('0x4a'));_0x56e426['recordingURL']=_0x4e120c;}else{_0x56e426[_0xbbf9('0x4e')]='';}return getAdminId(_0x1cc4d3,_0x5f16af,_0x225afd,_0x434538)[_0xbbf9('0xb')](getUser(_0x5f16af,_0x225afd,_0x434538))[_0xbbf9('0xb')](getEndUser(_0x5f16af,_0x225afd,_0x434538))[_0xbbf9('0xb')](getTicket(_0x5f16af,_0x225afd,_0x434538,_0x22b861,_0x56e426))[_0xbbf9('0xb')](function(_0x1d9334){logger[_0xbbf9('0xa')](util[_0xbbf9('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1d9334['ticketId']));if(_0x5f16af!==_0xbbf9('0x4f')){logger[_0xbbf9('0xa')]('['+[_0x5f16af[_0xbbf9('0x15')]()]+']',_0xbbf9('0x50'));emit(_0x434538,_0x2888fd['name'],_0x1d9334['endUserId']);}})[_0xbbf9('0x13')](function(_0x209816){logger[_0xbbf9('0x14')]('['+[_0x5f16af[_0xbbf9('0x15')]()]+_0xbbf9('0x51'),util[_0xbbf9('0x52')](_0x209816,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd88e=['task','message','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','catch','error','Getting\x20user\x20list','agentEmail','length','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId'];(function(_0x1b9f16,_0x5cbcbb){var _0xb6b21a=function(_0x5caf10){while(--_0x5caf10){_0x1b9f16['push'](_0x1b9f16['shift']());}};_0xb6b21a(++_0x5cbcbb);}(_0xd88e,0x71));var _0xed88=function(_0xf7877a,_0x9cd429){_0xf7877a=_0xf7877a-0x0;var _0x632c5a=_0xd88e[_0xf7877a];return _0x632c5a;};'use strict';var _=require(_0xed88('0x0'));var rp=require(_0xed88('0x1'));var md5=require('md5');var util=require(_0xed88('0x2'));var moment=require(_0xed88('0x3'));var Promise=require(_0xed88('0x4'));var Redis=require(_0xed88('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xed88('0x6'))(_0xed88('0x7'));config['redis']=_['defaults'](config[_0xed88('0x8')],{'host':_0xed88('0x9'),'port':0x18eb});var io=require(_0xed88('0xa'))(new Redis(config[_0xed88('0x8')]));function getAdminId(_0x3f8752,_0x1f545c,_0x214145,_0x30ec9f){return new Promise(function(_0x1d5386,_0x26a8fa){var _0x4a0e79=![];var _0x5b1926={'method':_0xed88('0xb'),'uri':_0x30ec9f+_0xed88('0xc'),'json':!![]};_0x5b1926[_0xed88('0xd')]=_0x214145;logger[_0xed88('0xe')](_0xed88('0xf'));return rp(_0x5b1926)[_0xed88('0x10')](function(_0x36a515){if(_0x36a515){var _0xd4aa4d=_0x36a515[_0xed88('0x11')];var _0x26e4d1=null;for(_0x26e4d1=0x0;_0x26e4d1<_0xd4aa4d['length'];_0x26e4d1++){if(_0xd4aa4d[_0x26e4d1][_0xed88('0x12')]===_0x3f8752[_0xed88('0x13')]){_0x3f8752[_0xed88('0x14')]=_0xd4aa4d[_0x26e4d1]['id'];_0x4a0e79=!![];}}if(_0x4a0e79){logger[_0xed88('0xe')](_0xed88('0x15'),_0x3f8752[_0xed88('0x14')]);_0x1d5386(_0x3f8752);}else{_0x26a8fa({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x26a8fa({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xed88('0x16')](function(_0x573ac7){logger[_0xed88('0x17')]('['+[_0x1f545c['toUpperCase']()]+']',_0x573ac7['message']);_0x26a8fa(_0x573ac7);});});}function getUser(_0x4e730d,_0x47d56b,_0x38cb4b){return function(_0x5b3555){return new Promise(function(_0x105fd3,_0x2a116c){var _0x5131e8={'method':'GET','uri':_0x38cb4b+_0xed88('0xc'),'json':!![]};_0x5131e8[_0xed88('0xd')]=_0x47d56b;logger[_0xed88('0xe')](_0xed88('0x18'));return rp(_0x5131e8)[_0xed88('0x10')](function(_0x4b8c6b){if(_0x4b8c6b){var _0x54e4b8=_0x4b8c6b[_0xed88('0x11')];var _0x39039e=![];var _0x2cc041=null;if(_0x5b3555['agentEmail']!==null){logger[_0xed88('0xe')]('Getting\x20user\x20with\x20email',_0x5b3555[_0xed88('0x19')]);_0x5b3555['userEmail']=_0x5b3555['agentEmail'];for(_0x2cc041=0x0;_0x2cc041<_0x54e4b8[_0xed88('0x1a')];_0x2cc041++){if(_0x54e4b8[_0x2cc041][_0xed88('0x12')]===_0x5b3555['agentEmail']){_0x39039e=!![];_0x5b3555[_0xed88('0x1b')]=_0x54e4b8[_0x2cc041]['id'];logger[_0xed88('0xe')](_0xed88('0x1c'),_0x5b3555[_0xed88('0x1b')]);}}}if(!_0x39039e){logger[_0xed88('0xe')](_0xed88('0x1d'));_0x5b3555[_0xed88('0x1e')]=_0x5b3555['adminEmail'];_0x5b3555['userId']=_0x5b3555[_0xed88('0x14')];_0x39039e=!![];}if(_0x39039e){_0x105fd3(_0x5b3555);}else{_0x2a116c({'statusCode':0x194,'message':_0xed88('0x1f')});}}else{_0x2a116c({'statusCode':0x194,'message':_0xed88('0x1f')});}})[_0xed88('0x16')](function(_0x1822ae){logger[_0xed88('0x17')]('['+[_0x4e730d[_0xed88('0x20')]()]+']',_0x1822ae['message']);_0x2a116c(_0x1822ae);});});};}function searchContact(_0x1c03ba,_0x37ee28,_0x558f8a,_0x5c311a){return new Promise(function(_0x5da807,_0x15f12f){var _0x5cd5f8={'method':_0xed88('0xb'),'headers':_0x37ee28,'uri':_0x1c03ba+_0xed88('0x21')+_0x5c311a+_0xed88('0x22')+_0x558f8a+_0xed88('0x23'),'json':!![]};rp(_0x5cd5f8)[_0xed88('0x10')](function(_0x4eed7b){var _0x39c670=_['find'](_0x4eed7b[_0xed88('0x24')][_0xed88('0x24')],[_0x558f8a,_0x5c311a]);_0x5da807(_0x39c670);})[_0xed88('0x16')](function(_0x7cc1d){_0x15f12f(_0x7cc1d);});});}function getEndUser(_0x2f9b7b,_0x154780,_0x57dfb5){return function(_0x4dc9c3){return new Promise(function(_0x12c69a,_0x4a07b9){logger['info'](util[_0xed88('0x25')](_0xed88('0x26'),_0x4dc9c3['contactNumber']));searchContact(_0x57dfb5,_0x154780,_0xed88('0x27'),_0x4dc9c3[_0xed88('0x28')])['then'](function(_0x18e0d8){if(_0x18e0d8){_0x4dc9c3[_0xed88('0x29')]=_0x18e0d8['id'];logger[_0xed88('0xe')]('Contact\x20found\x20mobile_number:',_0x4dc9c3[_0xed88('0x29')]);return _0x12c69a(_0x4dc9c3);}searchContact(_0x57dfb5,_0x154780,_0xed88('0x2a'),_0x4dc9c3[_0xed88('0x28')])[_0xed88('0x10')](function(_0x42d40c){if(_0x42d40c){_0x4dc9c3[_0xed88('0x29')]=_0x42d40c['id'];logger[_0xed88('0xe')]('Contact\x20found\x20work_number:',_0x4dc9c3[_0xed88('0x29')]);return _0x12c69a(_0x4dc9c3);}createEndUser(_0x4dc9c3,_0x2f9b7b,_0x154780,_0x57dfb5)[_0xed88('0x10')](function(_0x4ff92e){logger['info'](_0xed88('0x2b'),_0x4ff92e[_0xed88('0x29')]);return _0x12c69a(_0x4ff92e);});});})[_0xed88('0x16')](function(_0x1bcec4){_0x4a07b9(_0x1bcec4);});});};}function createEndUser(_0x275803,_0x45761b,_0x3fae98,_0x307883){return new Promise(function(_0x3e824f,_0x2d3e8){var _0x9a2a6f=moment();var _0xe4c3b2={'method':_0xed88('0x2c'),'uri':_0x307883+_0xed88('0x2d'),'body':{'contact':{'last_name':_0x275803[_0xed88('0x28')],'work_number':_0x275803[_0xed88('0x28')],'mobile_number':_0x275803[_0xed88('0x28')],'owner_id':_0x275803['userId'],'created_at':_0x9a2a6f[_0xed88('0x25')](_0xed88('0x2e'))}},'json':!![]};_0xe4c3b2[_0xed88('0xd')]=_0x3fae98;logger[_0xed88('0xe')](_0xed88('0x2f'));return rp(_0xe4c3b2)[_0xed88('0x10')](function(_0x52ec1d){_0x275803[_0xed88('0x29')]=_0x52ec1d[_0xed88('0x30')]['id'];_0x3e824f(_0x275803);})[_0xed88('0x16')](function(_0x30bfc2){logger[_0xed88('0x17')]('['+[_0x45761b[_0xed88('0x20')]()]+']',_0x30bfc2['message']);_0x2d3e8(_0x30bfc2['message']);});});}function getTicket(_0x586a0a,_0x41ea33,_0x53c26a,_0x371e90,_0x344208){return function(_0x2189f5){logger[_0xed88('0xe')](_0xed88('0x31'));return new Promise(function(_0x4cd67a,_0xb815b9){var _0x24c1c3=moment();var _0x1ab598={'method':_0xed88('0x2c'),'uri':_0x53c26a+_0xed88('0x32'),'body':{'title':intUtil[_0xed88('0x33')](_0x371e90[_0xed88('0x34')],_0x344208,'\x20'),'description':intUtil['getString'](_0x371e90[_0xed88('0x35')],_0x344208,'\x0a'),'owner_id':_0x2189f5['userId'],'creater_id':_0x2189f5[_0xed88('0x14')],'targetable_id':_0x2189f5[_0xed88('0x29')],'targetable_type':_0xed88('0x36'),'created_at':_0x24c1c3[_0xed88('0x25')](_0xed88('0x2e')),'due_date':_0x24c1c3[_0xed88('0x37')](0x1e,'m')[_0xed88('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1ab598[_0xed88('0xd')]=_0x41ea33;return rp(_0x1ab598)[_0xed88('0x10')](function(_0x4466d7){_0x2189f5[_0xed88('0x38')]=_0x4466d7[_0xed88('0x39')]['id'];logger[_0xed88('0xe')]('Task\x20created:',_0x2189f5[_0xed88('0x38')]);_0x4cd67a(_0x2189f5);})['catch'](function(_0x2b371d){logger['error']('['+[_0x586a0a['toUpperCase']()]+']',_0x2b371d[_0xed88('0x3a')]);_0xb815b9(_0x2b371d[_0xed88('0x3a')]);});});};}function emit(_0x38380b,_0x54d2c6,_0x271f7a){var _0x14f113={'uri':_0x38380b+_0xed88('0x3b')+_0x271f7a};io['to'](util[_0xed88('0x25')](_0xed88('0x3c'),_0x54d2c6))['emit'](_0xed88('0x3d'),_0x14f113);}exports['cs']=function(_0x3abd39,_0x3ed521,_0x401de8,_0x1e0b05,_0x2c993b,_0x203e4c,_0x111315,_0x1dde53){var _0x299766={};var _0x5f58db={'Authorization':_0xed88('0x3e')+_0x203e4c['apiKey']};_0x203e4c[_0xed88('0x3f')]=intUtil[_0xed88('0x40')](_0x203e4c[_0xed88('0x3f')]);_0x203e4c[_0xed88('0x41')]=intUtil[_0xed88('0x40')](_0x203e4c[_0xed88('0x41')]);var _0x159571=_0x203e4c[_0xed88('0x3f')];_0x299766[_0xed88('0x13')]=_0x203e4c['username'];_0x299766[_0xed88('0x28')]=_0x1dde53[_0xed88('0x42')]()===_0xed88('0x43')?_0x3ed521[_0xed88('0x44')]:_0x3ed521[_0xed88('0x45')];_0x299766[_0xed88('0x46')]=_0x1dde53===_0xed88('0x47')||_0x1dde53==='unmanaged'?_0xed88('0x47'):_0xed88('0x43');if(_0x1e0b05){_0x299766[_0xed88('0x19')]=_0x1e0b05[_0xed88('0x12')];}var _0xb68775=util[_0xed88('0x25')](_0xed88('0x48'),_0x203e4c['serverUrl'],_0x3ed521[_0xed88('0x49')],md5(_0x3ed521['uniqueid']));if(_0x2c993b&&_0x2c993b[_0xed88('0x4a')]){logger[_0xed88('0xe')](_0xed88('0x4b'),_0xed88('0x4c'));_0x3ed521[_0xed88('0x4d')]=_0xb68775;}else if(_0x111315&&_0x111315[_0xed88('0x4e')]&&_0x111315[_0xed88('0x4e')]!=='none'){logger[_0xed88('0xe')](_0xed88('0x4f'),_0xed88('0x4c'));_0x3ed521[_0xed88('0x4d')]=_0xb68775;}else{_0x3ed521[_0xed88('0x4d')]='';}return getAdminId(_0x299766,_0x1dde53,_0x5f58db,_0x159571)[_0xed88('0x10')](getUser(_0x1dde53,_0x5f58db,_0x159571))[_0xed88('0x10')](getEndUser(_0x1dde53,_0x5f58db,_0x159571))[_0xed88('0x10')](getTicket(_0x1dde53,_0x5f58db,_0x159571,_0x401de8,_0x3ed521))[_0xed88('0x10')](function(_0x44705f){logger[_0xed88('0xe')](util[_0xed88('0x25')](_0xed88('0x50'),_0x44705f[_0xed88('0x38')]));if(_0x1dde53!==_0xed88('0x51')){logger[_0xed88('0xe')]('['+[_0x1dde53[_0xed88('0x20')]()]+']',_0xed88('0x52'));emit(_0x159571,_0x1e0b05[_0xed88('0x53')],_0x44705f[_0xed88('0x29')]);}})[_0xed88('0x16')](function(_0x13c637){logger['error']('['+[_0x1dde53[_0xed88('0x20')]()]+_0xed88('0x54'),util['inspect'](_0x13c637,{'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 450bd66..ec060f3 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 _0xa659=['./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','servicenow','log','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow'];(function(_0x31c201,_0x2f0396){var _0xe880b4=function(_0xc17602){while(--_0xc17602){_0x31c201['push'](_0x31c201['shift']());}};_0xe880b4(++_0x2f0396);}(_0xa659,0xe7));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a65('0x0'));var util=require(_0x9a65('0x1'));var zendesk=require(_0x9a65('0x2'));var salesforce=require(_0x9a65('0x3'));var sugarcrm=require(_0x9a65('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x9a65('0x5'));var desk=require(_0x9a65('0x6'));var vtiger=require(_0x9a65('0x7'));var servicenow=require(_0x9a65('0x8'));var dynamics365=require(_0x9a65('0x9'));var freshsales=require(_0x9a65('0xa'));var integrations=[_0x9a65('0xb'),'salesforce',_0x9a65('0xc'),_0x9a65('0xd'),_0x9a65('0xe'),_0x9a65('0xf'),_0x9a65('0x10'),_0x9a65('0x11'),'freshsales','servicenow'];exports[_0x9a65('0x12')]=function(_0x43f38a,_0x250098,_0x2b23c2,_0x30082d,_0x156fc6,_0x59a918){if(_0x2b23c2){if(_[_0x9a65('0x13')](integrations,_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]())){try{var _0x2f8dc4=null;var _0xb723dc='';var _0x4a4a31=_0x2b23c2[_0x43f38a[_0x9a65('0x14')]['toLowerCase']()];if(_0x4a4a31){var _0x264fca=_0x4a4a31[_0x43f38a['data2']];if(_0x264fca){var _0x3362db=_[_0x9a65('0x16')](_0x264fca[_0x9a65('0x17')],{'id':parseInt(_0x43f38a[_0x9a65('0x18')],0xa)});if(_0x3362db){if(_0x30082d){if(_0x156fc6&&_0x250098[_0x9a65('0x19')]){_0xb723dc='queue';}else if(_0x250098[_0x9a65('0x1a')]){_0xb723dc=_0x9a65('0x1b');}else{console['log'](_0x9a65('0x1c'),_0x250098);}}else{_0xb723dc=_0x9a65('0x1d');}switch(_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]()){case'zendesk':zendesk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x1e'):salesforce[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xc'):sugarcrm[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xd'):freshdesk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case'zoho':zoho[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0xf'):desk[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x10'):vtiger[_0xb723dc](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918);break;case _0x9a65('0x1f'):freshsales['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;case _0x9a65('0x20'):servicenow['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;case _0x9a65('0x11'):dynamics365['cs'](_0x43f38a,_0x250098,_0x3362db,_0x30082d,_0x156fc6,_0x264fca,_0x59a918,_0xb723dc);break;default:console[_0x9a65('0x21')](_0x9a65('0x22'));}}else{_0x2f8dc4=require(_0x9a65('0x23'))(_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')]());_0x2f8dc4[_0x9a65('0x24')]('[EXEC]',util[_0x9a65('0x25')]('%s\x20configuration\x20#%s\x20not\x20found',_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')](),_0x43f38a[_0x9a65('0x18')]));}}else{_0x2f8dc4=require(_0x9a65('0x23'))(_0x43f38a['data1'][_0x9a65('0x15')]());_0x2f8dc4[_0x9a65('0x24')](_0x9a65('0x26'),util['format'](_0x9a65('0x27'),_0x43f38a[_0x9a65('0x14')][_0x9a65('0x15')](),_0x43f38a['data2']));}}else{}}catch(_0x4c03b9){console[_0x9a65('0x24')](_0x4c03b9);}}}}; \ No newline at end of file +var _0xb663=['data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','exec','toLowerCase','data1','data2','Configurations','queue','outbound','log','freshsales','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xb663,0x161));var _0x3b66=function(_0x422559,_0x431db3){_0x422559=_0x422559-0x0;var _0x33b51a=_0xb663[_0x422559];return _0x33b51a;};'use strict';var _=require(_0x3b66('0x0'));var util=require(_0x3b66('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x3b66('0x2'));var sugarcrm=require(_0x3b66('0x3'));var freshdesk=require(_0x3b66('0x4'));var zoho=require(_0x3b66('0x5'));var desk=require(_0x3b66('0x6'));var vtiger=require(_0x3b66('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x3b66('0x8'));var freshsales=require(_0x3b66('0x9'));var integrations=[_0x3b66('0xa'),_0x3b66('0xb'),_0x3b66('0xc'),_0x3b66('0xd'),_0x3b66('0xe'),_0x3b66('0xf'),_0x3b66('0x10'),'dynamics365','freshsales',_0x3b66('0x11')];exports[_0x3b66('0x12')]=function(_0x2c334f,_0x30c2be,_0x14aa17,_0x1eb080,_0x56a7ac,_0x32a9c3){if(_0x14aa17){if(_['includes'](integrations,_0x2c334f['data1'][_0x3b66('0x13')]())){try{var _0x3fc541=null;var _0x57d41f='';var _0x11fe43=_0x14aa17[_0x2c334f[_0x3b66('0x14')]['toLowerCase']()];if(_0x11fe43){var _0x249089=_0x11fe43[_0x2c334f[_0x3b66('0x15')]];if(_0x249089){var _0x5cbd31=_['find'](_0x249089[_0x3b66('0x16')],{'id':parseInt(_0x2c334f['data3'],0xa)});if(_0x5cbd31){if(_0x1eb080){if(_0x56a7ac&&_0x30c2be[_0x3b66('0x17')]){_0x57d41f=_0x3b66('0x17');}else if(_0x30c2be['routeId']){_0x57d41f=_0x3b66('0x18');}else{console[_0x3b66('0x19')]('EVENT\x20UNKNOWN',_0x30c2be);}}else{_0x57d41f='unmanaged';}switch(_0x2c334f[_0x3b66('0x14')]['toLowerCase']()){case _0x3b66('0xa'):zendesk[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case'salesforce':salesforce[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case _0x3b66('0xc'):sugarcrm[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case _0x3b66('0xd'):freshdesk[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case _0x3b66('0xe'):zoho[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case _0x3b66('0xf'):desk[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case'vtiger':vtiger[_0x57d41f](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3);break;case _0x3b66('0x1a'):freshsales['cs'](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3,_0x57d41f);break;case _0x3b66('0x11'):servicenow['cs'](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3,_0x57d41f);break;case'dynamics365':dynamics365['cs'](_0x2c334f,_0x30c2be,_0x5cbd31,_0x1eb080,_0x56a7ac,_0x249089,_0x32a9c3,_0x57d41f);break;default:console[_0x3b66('0x19')](_0x3b66('0x1b'));}}else{_0x3fc541=require(_0x3b66('0x1c'))(_0x2c334f[_0x3b66('0x14')][_0x3b66('0x13')]());_0x3fc541[_0x3b66('0x1d')]('[EXEC]',util[_0x3b66('0x1e')](_0x3b66('0x1f'),_0x2c334f['data1'][_0x3b66('0x13')](),_0x2c334f[_0x3b66('0x20')]));}}else{_0x3fc541=require(_0x3b66('0x1c'))(_0x2c334f[_0x3b66('0x14')][_0x3b66('0x13')]());_0x3fc541[_0x3b66('0x1d')](_0x3b66('0x21'),util[_0x3b66('0x1e')](_0x3b66('0x22'),_0x2c334f[_0x3b66('0x14')][_0x3b66('0x13')](),_0x2c334f['data2']));}}else{}}catch(_0x3f1d86){console[_0x3b66('0x1d')](_0x3f1d86);}}}}; \ 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 521063e..43fcf5f 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 _0x0dff=['newTab','trigger:browser:url','instanceUrl','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ticketType','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0x0dff,0x119));var _0xf0df=function(_0x3a164e,_0x390f0d){_0x3a164e=_0x3a164e-0x0;var _0x4274b6=_0x0dff[_0x3a164e];return _0x4274b6;};'use strict';var _=require(_0xf0df('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xf0df('0x1'));var util=require('util');var Redis=require(_0xf0df('0x2'));var intUtil=require('./util');var config=require(_0xf0df('0x3'));var logger=require(_0xf0df('0x4'))(_0xf0df('0x5'));config[_0xf0df('0x6')]=_[_0xf0df('0x7')](config[_0xf0df('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf0df('0x8'))(new Redis(config['redis']));function emit(_0x3d0dc4,_0x19591b,_0x36de15){io['to'](_0x3d0dc4)[_0xf0df('0x9')](_0x19591b,_0x36de15);}function getTicket(_0x4b65a5,_0x15c974,_0x1a87ce,_0x3d7d35,_0x2ebf6f,_0x1a5889,_0x4b88a7,_0x1157c9){var _0x26e013=Object[_0xf0df('0xa')]({},{'OwnerId':_0x15c974['id'],'Subject':intUtil[_0xf0df('0xb')](_0x3d7d35[_0xf0df('0xc')],_0x2ebf6f,'\x20'),'Description':intUtil['getString'](_0x3d7d35[_0xf0df('0xd')],_0x2ebf6f,'\x0a')},getCustomFields(_0x1a5889,_0x2ebf6f));if(_0x1a87ce){if(_0x3d7d35['ticketType']===_0xf0df('0xe')){_0x26e013[_0xf0df('0xf')]=moment['utc']();_0x26e013[_0xf0df('0x10')]=![];_0x26e013[_0xf0df('0x11')]=![];if(_0x1a87ce[_0xf0df('0x12')]==='contact'||_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x13')){_0x26e013[_0xf0df('0x14')]=_0x1a87ce['id'];}else if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x15')){_0x26e013[_0xf0df('0x16')]=_0x1a87ce['id'];}}else if(_0x3d7d35[_0xf0df('0x17')]===_0xf0df('0x18')){if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x19')){_0x26e013['ContactId']=_0x1a87ce['id'];}else if(_0x1a87ce[_0xf0df('0x12')]===_0xf0df('0x15')){_0x26e013[_0xf0df('0x1a')]=_0x1a87ce['id'];}else if(_0x1a87ce['endUserType']===_0xf0df('0x13')&&_0x3d7d35[_0xf0df('0x1b')]){_0x26e013[_0x3d7d35[_0xf0df('0x1b')]]=_0x1a87ce['id'];}else{logger[_0xf0df('0x1c')](_0xf0df('0x1d'));}}}return _0x4b88a7[_0xf0df('0x1e')](_0x3d7d35[_0xf0df('0x17')])['create'](_0x26e013);}function getUser(_0x29ac8f,_0x59ade7,_0x2e2be6){if(!_[_0xf0df('0x1f')](_0x59ade7)&&intUtil[_0xf0df('0x20')](_0x59ade7)){var _0x44a7e9={'Email':_0x59ade7};var _0xb17746={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e2be6[_0xf0df('0x1e')](_0xf0df('0x21'))[_0xf0df('0x22')](_0x44a7e9,_0xb17746)['execute']()[_0xf0df('0x23')](function(_0xbb2bd0){if(_0xbb2bd0[_0xf0df('0x24')]){var _0x5c2a01=_['find'](_0xbb2bd0,function(_0x60ce5d){return _0x60ce5d[_0xf0df('0x25')]===_0x59ade7;});if(_0x5c2a01){logger[_0xf0df('0x1c')](_0xf0df('0x26'),_0x59ade7);return BPromise[_0xf0df('0x27')]({'id':_0x5c2a01['Id'],'name':_0x5c2a01[_0xf0df('0x28')]});}}else{logger[_0xf0df('0x1c')](_0xf0df('0x29'),_0x59ade7);return _0x2e2be6[_0xf0df('0x2a')]()[_0xf0df('0x23')](function(_0x3dd72b){return BPromise[_0xf0df('0x27')]({'id':_0x3dd72b[_0xf0df('0x2b')],'name':_0x3dd72b['display_name']});});}});}else{logger[_0xf0df('0x1c')](_0xf0df('0x29'),_0x59ade7);return _0x2e2be6[_0xf0df('0x2a')]()[_0xf0df('0x23')](function(_0x2e004a){return BPromise[_0xf0df('0x27')]({'id':_0x2e004a[_0xf0df('0x2b')],'name':_0x2e004a[_0xf0df('0x2c')]});});}}function getEndUser(_0x18964d,_0x46e0fb,_0x10fbbc,_0x47dd41,_0x43d589){var _0x39585f={'$or':{'Phone':_0x47dd41}};var _0x1d2c34={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf0df('0x27')]()[_0xf0df('0x23')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x2d')]);switch(_0x46e0fb[_0xf0df('0x2d')]){case _0xf0df('0x2e'):var _0xe387a8=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchContact']){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x30')]]=_0x47dd41;_['merge'](_0xe387a8[_0xf0df('0x31')],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x32'))['find'](_0xe387a8,_0x1d2c34)[_0xf0df('0x33')]()['then'](function(_0x46f8eb){if(_0x46f8eb&&_0x46f8eb['length']){return _0x46f8eb;}else{var _0x1a4663=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchLead']){var _0xfe039b={};_0xfe039b[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x1a4663[_0xf0df('0x31')],_0xfe039b);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x36'))[_0xf0df('0x22')](_0x1a4663,_0x1d2c34);}});case'account_contact_lead':var _0x381b5c=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x37')]){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x37')]]=_0x47dd41;_[_0xf0df('0x35')](_0x381b5c[_0xf0df('0x31')],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x38'))[_0xf0df('0x22')](_0x381b5c,_0x1d2c34)[_0xf0df('0x33')]()[_0xf0df('0x23')](function(_0x3af400){if(_0x3af400&&_0x3af400[_0xf0df('0x24')]){return _0x3af400;}else{var _0x25bc4f=_['cloneDeep'](_0x39585f);if(_0x46e0fb[_0xf0df('0x30')]){var _0x2626cc={};_0x2626cc[_0x46e0fb[_0xf0df('0x30')]]=_0x47dd41;_['merge'](_0x25bc4f['$or'],_0x2626cc);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x32'))[_0xf0df('0x22')](_0x25bc4f,_0x1d2c34)[_0xf0df('0x23')](function(_0x5cfa52){if(_0x5cfa52&&_0x5cfa52[_0xf0df('0x24')]){return _0x5cfa52;}else{var _0x3844c5=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchLead']){var _0x1c104b={};_0x1c104b[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x3844c5[_0xf0df('0x31')],_0x1c104b);}return _0x43d589[_0xf0df('0x1e')](_0xf0df('0x36'))[_0xf0df('0x22')](_0x3844c5,_0x1d2c34);}});}});case _0xf0df('0x19'):var _0xe387a8=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb['additionalSearchContact']){var _0x4378cb={};_0x4378cb[_0x46e0fb['additionalSearchContact']]=_0x47dd41;_[_0xf0df('0x35')](_0xe387a8[_0xf0df('0x31')],_0x4378cb);}return _0x43d589['sobject'](_0xf0df('0x32'))[_0xf0df('0x22')](_0xe387a8,_0x1d2c34)[_0xf0df('0x33')]();case _0xf0df('0x13'):var _0x5c6730=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x34')]){var _0x4378cb={};_0x4378cb[_0x46e0fb[_0xf0df('0x34')]]=_0x47dd41;_[_0xf0df('0x35')](_0x5c6730['$or'],_0x4378cb);}return _0x43d589['sobject'](_0xf0df('0x36'))[_0xf0df('0x22')](_0x5c6730,_0x1d2c34);case _0xf0df('0x15'):var _0x381b5c=_[_0xf0df('0x2f')](_0x39585f);if(_0x46e0fb[_0xf0df('0x37')]){var _0x4378cb={};_0x4378cb[_0x46e0fb['additionalSearchAccount']]=_0x47dd41;_['merge'](_0x381b5c['$or'],_0x4378cb);}return _0x43d589[_0xf0df('0x1e')]('Account')['find'](_0x381b5c,_0x1d2c34);default:return null;}})[_0xf0df('0x23')](function(_0x48f747){if(_0x48f747&&_0x48f747[_0xf0df('0x24')]){var _0x53d3e2=_[_0xf0df('0x39')](_0x48f747);if(_0x53d3e2){return BPromise['resolve']({'id':_0x53d3e2['Id'],'name':_0x53d3e2[_0xf0df('0x28')],'phone':_0x53d3e2[_0xf0df('0x3a')],'endUserType':_0x53d3e2[_0xf0df('0x3b')]['type'][_0xf0df('0x3c')]()});}}})[_0xf0df('0x23')](function(_0x16f6e1){if(_0x16f6e1){logger[_0xf0df('0x1c')](_0xf0df('0x3d'),_0x16f6e1[_0xf0df('0x12')],_0x47dd41);return BPromise['resolve'](_0x16f6e1);}else{logger[_0xf0df('0x1c')](_0xf0df('0x3e'),_0x47dd41);var _0xabe077={'Phone':_0x47dd41};if(_0x46e0fb[_0xf0df('0x3f')]){if(_0x46e0fb[_0xf0df('0x3f')]===_0xf0df('0x19')){logger[_0xf0df('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077[_0xf0df('0x40')]=_0x10fbbc!==_0xf0df('0x41')?_0x10fbbc:util['format'](_0xf0df('0x42'),_0x47dd41);}else if(_0x46e0fb[_0xf0df('0x3f')]==='lead'){logger[_0xf0df('0x1c')](_0xf0df('0x43'),_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077['LastName']=_0x10fbbc!==''?_0x10fbbc:util[_0xf0df('0x44')](_0xf0df('0x42'),_0x47dd41);_0xabe077[_0xf0df('0x45')]=_0xf0df('0x46');}else if(_0x46e0fb[_0xf0df('0x3f')]===_0xf0df('0x15')){logger[_0xf0df('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47dd41,_0x46e0fb[_0xf0df('0x3f')]);_0xabe077[_0xf0df('0x28')]=_0x10fbbc!==_0xf0df('0x41')?_0x10fbbc:util[_0xf0df('0x44')](_0xf0df('0x42'),_0x47dd41);}else{return null;}}return _0x43d589['sobject'](_[_0xf0df('0x47')](_0x46e0fb[_0xf0df('0x3f')]))[_0xf0df('0x48')](_0xabe077)[_0xf0df('0x23')](function(_0x1d39fe){return BPromise[_0xf0df('0x27')]({'id':_0x1d39fe['id'],'endUserType':_0x46e0fb[_0xf0df('0x3f')]});});}});}function getCustomFields(_0x1bdd45,_0x971c0f){var _0x1049b3={};if(_0x1bdd45['length']>0x0){_[_0xf0df('0x49')](_0x1bdd45,function(_0x3e8b31){if(_[_0xf0df('0x4a')]([_0xf0df('0x4b'),_0xf0df('0x4c')],_0x3e8b31['type'])&&_0x3e8b31[_0xf0df('0x4d')]){_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x3e8b31[_0xf0df('0x4e')][_0xf0df('0x4f')]();}else if(_0x3e8b31[_0xf0df('0x50')]===_0xf0df('0x51')&&_0x3e8b31['variableName']&&_0x3e8b31[_0xf0df('0x4d')]){_0x971c0f[_0x3e8b31[_0xf0df('0x52')]]&&(_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x971c0f[_0x3e8b31['variableName']]['toString']());}else if(_0x3e8b31['type']===_0xf0df('0x53')&&_0x3e8b31[_0xf0df('0x54')]&&_0x3e8b31[_0xf0df('0x54')][_0xf0df('0x55')]&&_0x3e8b31[_0xf0df('0x4d')]){_0x971c0f[_0x3e8b31[_0xf0df('0x54')][_0xf0df('0x55')]['toLowerCase']()]&&(_0x1049b3[_0x3e8b31[_0xf0df('0x4d')]]=_0x971c0f[_0x3e8b31['Variable'][_0xf0df('0x55')][_0xf0df('0x3c')]()][_0xf0df('0x4f')]());}});}return _0x1049b3;}function getConnection(_0x5e09d4){var _0x56731a=_0x5e09d4['password'][_0xf0df('0x56')](_0x5e09d4[_0xf0df('0x57')]);var _0x35fb52=new jsforce[(_0xf0df('0x58'))]({'oauth2':{'loginUrl':_0x5e09d4[_0xf0df('0x59')]||_0xf0df('0x5a'),'clientId':_0x5e09d4[_0xf0df('0x5b')],'clientSecret':_0x5e09d4['clientSecret']}});return _0x35fb52[_0xf0df('0x5c')](_0x5e09d4[_0xf0df('0x5d')],_0x56731a)[_0xf0df('0x23')](function(){logger[_0xf0df('0x1c')](_0xf0df('0x5e'));return _0x35fb52;});}exports[_0xf0df('0x5f')]=function(_0x738755,_0xec022f,_0x538848,_0x54427a,_0x415b55,_0x4345b5){var _0x46a16d,_0x5e4b0b,_0x29f501,_0x417998;_0x4345b5['serverUrl']=intUtil[_0xf0df('0x60')](_0x4345b5[_0xf0df('0x61')]);_0x4345b5[_0xf0df('0x59')]=intUtil[_0xf0df('0x60')](_0x4345b5[_0xf0df('0x59')]);if(_0x415b55&&_0x415b55[_0xf0df('0x62')]){logger[_0xf0df('0x1c')](_0xf0df('0x63'),_0xf0df('0x64'));_0xec022f[_0xf0df('0x65')]=util['format'](_0xf0df('0x66'),_0x4345b5[_0xf0df('0x61')],_0xec022f['uniqueid'],md5(_0xec022f[_0xf0df('0x67')]));}else{_0xec022f['recordingURL']='';}return getConnection(_0x4345b5)[_0xf0df('0x23')](function(_0x4fc596){_0x417998=_0x4fc596;return getUser(_0x4345b5,_0x54427a[_0xf0df('0x68')],_0x417998);})[_0xf0df('0x23')](function(_0x3bcd03){_0x46a16d=_0x3bcd03;return getEndUser(_0x4345b5,_0x538848,_0xec022f[_0xf0df('0x69')],_0xec022f['calleridnum'],_0x417998);})[_0xf0df('0x23')](function(_0x5bd3a4){_0x5e4b0b=_0x5bd3a4;return getTicket(_0x4345b5,_0x46a16d,_0x5e4b0b,_0x538848,_0xec022f,_0x538848[_0xf0df('0x6a')],_0x417998,'queue');})[_0xf0df('0x23')](function(_0x27d25c){_0x29f501=_0x27d25c;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x29f501['id']);logger[_0xf0df('0x1c')](_0xf0df('0x6b'),_0x29f501['id'],_0x54427a[_0xf0df('0x55')],_0x4345b5['type']);switch(_0x4345b5['type']){case'integrationTab':emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x54427a[_0xf0df('0x55')]),'trigger:salesforce:display',{'recordId':_0x29f501['id']});break;case _0xf0df('0x6d'):emit(util[_0xf0df('0x44')]('user:%s',_0x54427a['name']),_0xf0df('0x6e'),{'uri':util[_0xf0df('0x44')]('%s/%s/e',_0x417998[_0xf0df('0x6f')],_0x29f501['id'])});break;default:logger[_0xf0df('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x595a40){logger[_0xf0df('0x70')]('[QUEUE]',_0x595a40);});};exports[_0xf0df('0x71')]=function(_0x278c20,_0x573a84,_0x4559a3,_0x30391b,_0x1080f7,_0x539c38,_0x2b370b){var _0x70b16f,_0x3af3f9,_0x5d2a5b,_0x12fb3e;_0x539c38['serverUrl']=intUtil[_0xf0df('0x60')](_0x539c38['serverUrl']);_0x539c38[_0xf0df('0x59')]=intUtil[_0xf0df('0x60')](_0x539c38[_0xf0df('0x59')]);if(_0x2b370b&&_0x2b370b[_0xf0df('0x72')]&&_0x2b370b[_0xf0df('0x72')]!==_0xf0df('0x73')){logger[_0xf0df('0x1c')](_0xf0df('0x74'),_0xf0df('0x64'));_0x573a84['recordingURL']=util[_0xf0df('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x539c38[_0xf0df('0x61')],_0x573a84[_0xf0df('0x67')],md5(_0x573a84['uniqueid']));}return getConnection(_0x539c38)[_0xf0df('0x23')](function(_0x235d5b){_0x12fb3e=_0x235d5b;return getUser(_0x539c38,_0x30391b['email'],_0x12fb3e);})[_0xf0df('0x23')](function(_0x300612){_0x70b16f=_0x300612;return getEndUser(_0x539c38,_0x4559a3,_0x573a84[_0xf0df('0x75')],_0x573a84[_0xf0df('0x76')],_0x12fb3e);})['then'](function(_0x1137b4){_0x3af3f9=_0x1137b4;return getTicket(_0x539c38,_0x70b16f,_0x3af3f9,_0x4559a3,_0x573a84,_0x4559a3[_0xf0df('0x6a')],_0x12fb3e,_0xf0df('0x71'));})[_0xf0df('0x23')](function(_0x3541cb){_0x5d2a5b=_0x3541cb;logger[_0xf0df('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5d2a5b['id']);logger[_0xf0df('0x1c')](_0xf0df('0x77'),_0x5d2a5b['id'],_0x30391b['name'],_0x539c38[_0xf0df('0x50')]);switch(_0x539c38[_0xf0df('0x50')]){case _0xf0df('0x78'):emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x30391b[_0xf0df('0x55')]),'trigger:salesforce:display',{'recordId':_0x5d2a5b['id']});break;case _0xf0df('0x6d'):emit(util[_0xf0df('0x44')](_0xf0df('0x6c'),_0x30391b[_0xf0df('0x55')]),_0xf0df('0x6e'),{'uri':util[_0xf0df('0x44')](_0xf0df('0x79'),_0x12fb3e[_0xf0df('0x6f')],_0x5d2a5b['id'])});break;default:logger[_0xf0df('0x70')]('[OUTBOUND]',_0xf0df('0x7a'));}})[_0xf0df('0x7b')](function(_0x29ecba){logger[_0xf0df('0x70')](_0xf0df('0x74'),_0x29ecba);});};exports[_0xf0df('0x7c')]=function(_0x4774d9,_0x36796d,_0x189026,_0x1c3692,_0x37ae12,_0x47c60c){var _0x2b4b10,_0x390edd,_0x46c40a,_0x3a546e;_0x47c60c[_0xf0df('0x61')]=intUtil[_0xf0df('0x60')](_0x47c60c[_0xf0df('0x61')]);_0x47c60c[_0xf0df('0x59')]=intUtil['stripTrailingSlash'](_0x47c60c[_0xf0df('0x59')]);if(_0x37ae12&&_0x37ae12['monitor_format']){logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')][_0xf0df('0x7e')]()+']',_0xf0df('0x64'));_0x36796d[_0xf0df('0x65')]=util[_0xf0df('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47c60c[_0xf0df('0x61')],_0x36796d[_0xf0df('0x67')],md5(_0x36796d[_0xf0df('0x67')]));}else{_0x36796d[_0xf0df('0x65')]='';}return getConnection(_0x47c60c)[_0xf0df('0x23')](function(_0x5a1730){_0x3a546e=_0x5a1730;if(!_[_0xf0df('0x1f')](_0x1c3692)){return getUser(_0x47c60c,_0x1c3692[_0xf0df('0x55')],_0x3a546e);}else{return getUser(_0x47c60c,null,_0x3a546e);}})[_0xf0df('0x23')](function(_0x3b0576){_0x2b4b10=_0x3b0576;return getEndUser(_0x47c60c,_0x189026,_0x36796d[_0xf0df('0x69')],_0x36796d[_0xf0df('0x7f')],_0x3a546e);})[_0xf0df('0x23')](function(_0x10988d){_0x390edd=_0x10988d;return getTicket(_0x47c60c,_0x2b4b10,_0x390edd,_0x189026,_0x36796d,_0x189026[_0xf0df('0x6a')],_0x3a546e);})['then'](function(_0x56ae23){_0x46c40a=_0x56ae23;logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')]['toUpperCase']()+_0xf0df('0x80'),_0x46c40a['id']);logger[_0xf0df('0x1c')]('['+_0x36796d[_0xf0df('0x7d')][_0xf0df('0x7e')]()+_0xf0df('0x81'),_0x47c60c[_0xf0df('0x50')]);})[_0xf0df('0x7b')](function(_0x1421b4){logger['error']('['+_0x36796d['lastevent'][_0xf0df('0x7e')]()+']',_0x1421b4);});}; \ No newline at end of file +var _0x4bfe=['[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','content','toString','variable','variableName','customVariable','Variable','name','idField','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.'];(function(_0x5ea59b,_0x3fc308){var _0x164d24=function(_0x22880d){while(--_0x22880d){_0x5ea59b['push'](_0x5ea59b['shift']());}};_0x164d24(++_0x3fc308);}(_0x4bfe,0x107));var _0xe4bf=function(_0x173b34,_0x5040e5){_0x173b34=_0x173b34-0x0;var _0xc3d25c=_0x4bfe[_0x173b34];return _0xc3d25c;};'use strict';var _=require('lodash');var rp=require(_0xe4bf('0x0'));var moment=require('moment');var BPromise=require(_0xe4bf('0x1'));var md5=require(_0xe4bf('0x2'));var jsforce=require('jsforce');var util=require(_0xe4bf('0x3'));var Redis=require('ioredis');var intUtil=require(_0xe4bf('0x4'));var config=require(_0xe4bf('0x5'));var logger=require(_0xe4bf('0x6'))(_0xe4bf('0x7'));config[_0xe4bf('0x8')]=_[_0xe4bf('0x9')](config[_0xe4bf('0x8')],{'host':_0xe4bf('0xa'),'port':0x18eb});var io=require(_0xe4bf('0xb'))(new Redis(config[_0xe4bf('0x8')]));function emit(_0x1990c0,_0x49b683,_0x4f8e56){io['to'](_0x1990c0)[_0xe4bf('0xc')](_0x49b683,_0x4f8e56);}function getTicket(_0x6a012,_0x493aa9,_0x473208,_0xf48b1e,_0x726924,_0x4874b7,_0x27364c,_0x14980f){var _0x1cddff=Object['assign']({},{'OwnerId':_0x493aa9['id'],'Subject':intUtil[_0xe4bf('0xd')](_0xf48b1e['Subjects'],_0x726924,'\x20'),'Description':intUtil[_0xe4bf('0xd')](_0xf48b1e[_0xe4bf('0xe')],_0x726924,'\x0a')},getCustomFields(_0x4874b7,_0x726924));if(_0x473208){if(_0xf48b1e[_0xe4bf('0xf')]==='Task'){_0x1cddff[_0xe4bf('0x10')]=moment[_0xe4bf('0x11')]();_0x1cddff['IsReminderSet']=![];_0x1cddff[_0xe4bf('0x12')]=![];if(_0x473208[_0xe4bf('0x13')]==='contact'||_0x473208[_0xe4bf('0x13')]==='lead'){_0x1cddff[_0xe4bf('0x14')]=_0x473208['id'];}else if(_0x473208['endUserType']===_0xe4bf('0x15')){_0x1cddff[_0xe4bf('0x16')]=_0x473208['id'];}}else if(_0xf48b1e[_0xe4bf('0xf')]===_0xe4bf('0x17')){if(_0x473208['endUserType']===_0xe4bf('0x18')){_0x1cddff['ContactId']=_0x473208['id'];}else if(_0x473208[_0xe4bf('0x13')]===_0xe4bf('0x15')){_0x1cddff[_0xe4bf('0x19')]=_0x473208['id'];}else if(_0x473208['endUserType']===_0xe4bf('0x1a')&&_0xf48b1e[_0xe4bf('0x1b')]){_0x1cddff[_0xf48b1e[_0xe4bf('0x1b')]]=_0x473208['id'];}else{logger[_0xe4bf('0x1c')](_0xe4bf('0x1d'));}}}return _0x27364c[_0xe4bf('0x1e')](_0xf48b1e[_0xe4bf('0xf')])[_0xe4bf('0x1f')](_0x1cddff);}function getUser(_0x35d75a,_0x108f95,_0xeac066){if(!_[_0xe4bf('0x20')](_0x108f95)&&intUtil[_0xe4bf('0x21')](_0x108f95)){var _0x2dc351={'Email':_0x108f95};var _0x4a9624={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xeac066[_0xe4bf('0x1e')]('User')[_0xe4bf('0x22')](_0x2dc351,_0x4a9624)[_0xe4bf('0x23')]()[_0xe4bf('0x24')](function(_0x2c8646){if(_0x2c8646[_0xe4bf('0x25')]){var _0x175201=_['find'](_0x2c8646,function(_0x13a6a7){return _0x13a6a7[_0xe4bf('0x26')]===_0x108f95;});if(_0x175201){logger['info']('Agent\x20%s\x20found.',_0x108f95);return BPromise[_0xe4bf('0x27')]({'id':_0x175201['Id'],'name':_0x175201[_0xe4bf('0x28')]});}}else{logger[_0xe4bf('0x1c')](_0xe4bf('0x29'),_0x108f95);return _0xeac066['identity']()[_0xe4bf('0x24')](function(_0x2331ca){return BPromise['resolve']({'id':_0x2331ca[_0xe4bf('0x2a')],'name':_0x2331ca[_0xe4bf('0x2b')]});});}});}else{logger[_0xe4bf('0x1c')](_0xe4bf('0x29'),_0x108f95);return _0xeac066['identity']()[_0xe4bf('0x24')](function(_0x43e741){return BPromise[_0xe4bf('0x27')]({'id':_0x43e741['user_id'],'name':_0x43e741[_0xe4bf('0x2b')]});});}}function getEndUser(_0x3267a8,_0x20ae0e,_0x322116,_0x2300a2,_0x23a895){var _0x90c535={'$or':{'Phone':_0x2300a2}};var _0x1f6537={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe4bf('0x24')](function(){logger[_0xe4bf('0x1c')](_0xe4bf('0x2c'),_0x2300a2,_0x20ae0e[_0xe4bf('0x2d')]);switch(_0x20ae0e[_0xe4bf('0x2d')]){case'contact_lead':var _0x554e37=_[_0xe4bf('0x2e')](_0x90c535);if(_0x20ae0e[_0xe4bf('0x2f')]){var _0x21f2bd={};_0x21f2bd[_0x20ae0e[_0xe4bf('0x2f')]]=_0x2300a2;_[_0xe4bf('0x30')](_0x554e37[_0xe4bf('0x31')],_0x21f2bd);}return _0x23a895[_0xe4bf('0x1e')](_0xe4bf('0x32'))[_0xe4bf('0x22')](_0x554e37,_0x1f6537)['execute']()[_0xe4bf('0x24')](function(_0x1e190b){if(_0x1e190b&&_0x1e190b[_0xe4bf('0x25')]){return _0x1e190b;}else{var _0x5f27c9=_[_0xe4bf('0x2e')](_0x90c535);if(_0x20ae0e[_0xe4bf('0x33')]){var _0x3dd51a={};_0x3dd51a[_0x20ae0e[_0xe4bf('0x33')]]=_0x2300a2;_[_0xe4bf('0x30')](_0x5f27c9[_0xe4bf('0x31')],_0x3dd51a);}return _0x23a895[_0xe4bf('0x1e')](_0xe4bf('0x34'))[_0xe4bf('0x22')](_0x5f27c9,_0x1f6537);}});case _0xe4bf('0x35'):var _0x3a2e24=_['cloneDeep'](_0x90c535);if(_0x20ae0e[_0xe4bf('0x36')]){var _0x21f2bd={};_0x21f2bd[_0x20ae0e[_0xe4bf('0x36')]]=_0x2300a2;_['merge'](_0x3a2e24[_0xe4bf('0x31')],_0x21f2bd);}return _0x23a895[_0xe4bf('0x1e')](_0xe4bf('0x37'))[_0xe4bf('0x22')](_0x3a2e24,_0x1f6537)[_0xe4bf('0x23')]()['then'](function(_0x5d9fa6){if(_0x5d9fa6&&_0x5d9fa6['length']){return _0x5d9fa6;}else{var _0x38599f=_['cloneDeep'](_0x90c535);if(_0x20ae0e[_0xe4bf('0x2f')]){var _0x4f4513={};_0x4f4513[_0x20ae0e[_0xe4bf('0x2f')]]=_0x2300a2;_[_0xe4bf('0x30')](_0x38599f[_0xe4bf('0x31')],_0x4f4513);}return _0x23a895['sobject'](_0xe4bf('0x32'))[_0xe4bf('0x22')](_0x38599f,_0x1f6537)[_0xe4bf('0x24')](function(_0x4b0a1a){if(_0x4b0a1a&&_0x4b0a1a[_0xe4bf('0x25')]){return _0x4b0a1a;}else{var _0x1b4e28=_['cloneDeep'](_0x90c535);if(_0x20ae0e['additionalSearchLead']){var _0x499276={};_0x499276[_0x20ae0e[_0xe4bf('0x33')]]=_0x2300a2;_['merge'](_0x1b4e28[_0xe4bf('0x31')],_0x499276);}return _0x23a895[_0xe4bf('0x1e')]('Lead')['find'](_0x1b4e28,_0x1f6537);}});}});case _0xe4bf('0x18'):var _0x554e37=_['cloneDeep'](_0x90c535);if(_0x20ae0e[_0xe4bf('0x2f')]){var _0x21f2bd={};_0x21f2bd[_0x20ae0e['additionalSearchContact']]=_0x2300a2;_[_0xe4bf('0x30')](_0x554e37[_0xe4bf('0x31')],_0x21f2bd);}return _0x23a895[_0xe4bf('0x1e')](_0xe4bf('0x32'))[_0xe4bf('0x22')](_0x554e37,_0x1f6537)[_0xe4bf('0x23')]();case'lead':var _0x2849f5=_[_0xe4bf('0x2e')](_0x90c535);if(_0x20ae0e['additionalSearchLead']){var _0x21f2bd={};_0x21f2bd[_0x20ae0e[_0xe4bf('0x33')]]=_0x2300a2;_['merge'](_0x2849f5[_0xe4bf('0x31')],_0x21f2bd);}return _0x23a895['sobject'](_0xe4bf('0x34'))['find'](_0x2849f5,_0x1f6537);case _0xe4bf('0x15'):var _0x3a2e24=_[_0xe4bf('0x2e')](_0x90c535);if(_0x20ae0e[_0xe4bf('0x36')]){var _0x21f2bd={};_0x21f2bd[_0x20ae0e[_0xe4bf('0x36')]]=_0x2300a2;_[_0xe4bf('0x30')](_0x3a2e24['$or'],_0x21f2bd);}return _0x23a895['sobject'](_0xe4bf('0x37'))[_0xe4bf('0x22')](_0x3a2e24,_0x1f6537);default:return null;}})[_0xe4bf('0x24')](function(_0x31d81f){if(_0x31d81f&&_0x31d81f[_0xe4bf('0x25')]){var _0x456431=_['first'](_0x31d81f);if(_0x456431){return BPromise[_0xe4bf('0x27')]({'id':_0x456431['Id'],'name':_0x456431['Name'],'phone':_0x456431[_0xe4bf('0x38')],'endUserType':_0x456431[_0xe4bf('0x39')][_0xe4bf('0x3a')][_0xe4bf('0x3b')]()});}}})[_0xe4bf('0x24')](function(_0x16f1b4){if(_0x16f1b4){logger[_0xe4bf('0x1c')](_0xe4bf('0x3c'),_0x16f1b4['endUserType'],_0x2300a2);return BPromise[_0xe4bf('0x27')](_0x16f1b4);}else{logger[_0xe4bf('0x1c')](_0xe4bf('0x3d'),_0x2300a2);var _0x55d74d={'Phone':_0x2300a2};if(_0x20ae0e[_0xe4bf('0x3e')]){if(_0x20ae0e['moduleCreate']==='contact'){logger[_0xe4bf('0x1c')](_0xe4bf('0x3f'),_0x2300a2,_0x20ae0e[_0xe4bf('0x3e')]);_0x55d74d[_0xe4bf('0x40')]=_0x322116!==_0xe4bf('0x41')?_0x322116:util[_0xe4bf('0x42')](_0xe4bf('0x43'),_0x2300a2);}else if(_0x20ae0e[_0xe4bf('0x3e')]===_0xe4bf('0x1a')){logger[_0xe4bf('0x1c')](_0xe4bf('0x3f'),_0x2300a2,_0x20ae0e[_0xe4bf('0x3e')]);_0x55d74d['LastName']=_0x322116!==_0xe4bf('0x41')?_0x322116:util[_0xe4bf('0x42')](_0xe4bf('0x43'),_0x2300a2);_0x55d74d[_0xe4bf('0x44')]=_0xe4bf('0x45');}else if(_0x20ae0e[_0xe4bf('0x3e')]===_0xe4bf('0x15')){logger['info'](_0xe4bf('0x3f'),_0x2300a2,_0x20ae0e[_0xe4bf('0x3e')]);_0x55d74d['Name']=_0x322116!==_0xe4bf('0x41')?_0x322116:util[_0xe4bf('0x42')](_0xe4bf('0x43'),_0x2300a2);}else{return null;}}return _0x23a895[_0xe4bf('0x1e')](_[_0xe4bf('0x46')](_0x20ae0e[_0xe4bf('0x3e')]))['create'](_0x55d74d)['then'](function(_0x5734df){return BPromise[_0xe4bf('0x27')]({'id':_0x5734df['id'],'endUserType':_0x20ae0e[_0xe4bf('0x3e')]});});}});}function getCustomFields(_0x1510c5,_0x3314c1){var _0x16a9c4={};if(_0x1510c5['length']>0x0){_[_0xe4bf('0x47')](_0x1510c5,function(_0xc11dc9){if(_[_0xe4bf('0x48')]([_0xe4bf('0x49'),'picklist'],_0xc11dc9[_0xe4bf('0x3a')])&&_0xc11dc9['idField']){_0x16a9c4[_0xc11dc9['idField']]=_0xc11dc9[_0xe4bf('0x4a')][_0xe4bf('0x4b')]();}else if(_0xc11dc9[_0xe4bf('0x3a')]===_0xe4bf('0x4c')&&_0xc11dc9[_0xe4bf('0x4d')]&&_0xc11dc9['idField']){_0x3314c1[_0xc11dc9[_0xe4bf('0x4d')]]&&(_0x16a9c4[_0xc11dc9['idField']]=_0x3314c1[_0xc11dc9[_0xe4bf('0x4d')]][_0xe4bf('0x4b')]());}else if(_0xc11dc9[_0xe4bf('0x3a')]===_0xe4bf('0x4e')&&_0xc11dc9[_0xe4bf('0x4f')]&&_0xc11dc9[_0xe4bf('0x4f')][_0xe4bf('0x50')]&&_0xc11dc9[_0xe4bf('0x51')]){_0x3314c1[_0xc11dc9[_0xe4bf('0x4f')][_0xe4bf('0x50')][_0xe4bf('0x3b')]()]&&(_0x16a9c4[_0xc11dc9[_0xe4bf('0x51')]]=_0x3314c1[_0xc11dc9[_0xe4bf('0x4f')][_0xe4bf('0x50')][_0xe4bf('0x3b')]()][_0xe4bf('0x4b')]());}});}return _0x16a9c4;}function getConnection(_0x3f7e24){var _0x219250=_0x3f7e24['password'][_0xe4bf('0x52')](_0x3f7e24[_0xe4bf('0x53')]);var _0x3cadbf=new jsforce[(_0xe4bf('0x54'))]({'oauth2':{'loginUrl':_0x3f7e24['remoteUri']||_0xe4bf('0x55'),'clientId':_0x3f7e24[_0xe4bf('0x56')],'clientSecret':_0x3f7e24[_0xe4bf('0x57')]}});return _0x3cadbf[_0xe4bf('0x58')](_0x3f7e24[_0xe4bf('0x59')],_0x219250)['then'](function(){logger[_0xe4bf('0x1c')](_0xe4bf('0x5a'));return _0x3cadbf;});}exports[_0xe4bf('0x5b')]=function(_0x2d0c4c,_0x4cbdf8,_0x5eba42,_0x4f796f,_0x2c300e,_0x34ddc5){var _0x1dcb89,_0x9c93ce,_0x4a68e0,_0x1b3490;_0x34ddc5[_0xe4bf('0x5c')]=intUtil[_0xe4bf('0x5d')](_0x34ddc5[_0xe4bf('0x5c')]);_0x34ddc5[_0xe4bf('0x5e')]=intUtil[_0xe4bf('0x5d')](_0x34ddc5[_0xe4bf('0x5e')]);if(_0x2c300e&&_0x2c300e['monitor_format']){logger['info'](_0xe4bf('0x5f'),_0xe4bf('0x60'));_0x4cbdf8[_0xe4bf('0x61')]=util[_0xe4bf('0x42')](_0xe4bf('0x62'),_0x34ddc5[_0xe4bf('0x5c')],_0x4cbdf8[_0xe4bf('0x63')],md5(_0x4cbdf8[_0xe4bf('0x63')]));}else{_0x4cbdf8[_0xe4bf('0x61')]='';}return getConnection(_0x34ddc5)['then'](function(_0x2f088d){_0x1b3490=_0x2f088d;return getUser(_0x34ddc5,_0x4f796f[_0xe4bf('0x64')],_0x1b3490);})[_0xe4bf('0x24')](function(_0x11aa6f){_0x1dcb89=_0x11aa6f;return getEndUser(_0x34ddc5,_0x5eba42,_0x4cbdf8[_0xe4bf('0x65')],_0x4cbdf8['calleridnum'],_0x1b3490);})[_0xe4bf('0x24')](function(_0x5b8458){_0x9c93ce=_0x5b8458;return getTicket(_0x34ddc5,_0x1dcb89,_0x9c93ce,_0x5eba42,_0x4cbdf8,_0x5eba42[_0xe4bf('0x66')],_0x1b3490,'queue');})[_0xe4bf('0x24')](function(_0x2e0c77){_0x4a68e0=_0x2e0c77;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x4a68e0['id']);logger[_0xe4bf('0x1c')](_0xe4bf('0x67'),_0x4a68e0['id'],_0x4f796f[_0xe4bf('0x50')],_0x34ddc5[_0xe4bf('0x3a')]);switch(_0x34ddc5[_0xe4bf('0x3a')]){case _0xe4bf('0x68'):emit(util['format'](_0xe4bf('0x69'),_0x4f796f[_0xe4bf('0x50')]),_0xe4bf('0x6a'),{'recordId':_0x4a68e0['id']});break;case _0xe4bf('0x6b'):emit(util['format'](_0xe4bf('0x69'),_0x4f796f[_0xe4bf('0x50')]),'trigger:browser:url',{'uri':util['format'](_0xe4bf('0x6c'),_0x1b3490[_0xe4bf('0x6d')],_0x4a68e0['id'])});break;default:logger[_0xe4bf('0x6e')](_0xe4bf('0x6f'));}})[_0xe4bf('0x70')](function(_0xd83d){logger[_0xe4bf('0x6e')](_0xe4bf('0x5f'),_0xd83d);});};exports[_0xe4bf('0x71')]=function(_0x36b914,_0x5568f2,_0x3c76d4,_0x48dccf,_0x520761,_0x38fbae,_0x31a0c1){var _0x4178f7,_0x31951e,_0x47da33,_0x3fea02;_0x38fbae[_0xe4bf('0x5c')]=intUtil[_0xe4bf('0x5d')](_0x38fbae[_0xe4bf('0x5c')]);_0x38fbae[_0xe4bf('0x5e')]=intUtil['stripTrailingSlash'](_0x38fbae[_0xe4bf('0x5e')]);if(_0x31a0c1&&_0x31a0c1[_0xe4bf('0x72')]&&_0x31a0c1[_0xe4bf('0x72')]!==_0xe4bf('0x73')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5568f2['recordingURL']=util[_0xe4bf('0x42')](_0xe4bf('0x62'),_0x38fbae[_0xe4bf('0x5c')],_0x5568f2[_0xe4bf('0x63')],md5(_0x5568f2[_0xe4bf('0x63')]));}return getConnection(_0x38fbae)['then'](function(_0x43c768){_0x3fea02=_0x43c768;return getUser(_0x38fbae,_0x48dccf[_0xe4bf('0x64')],_0x3fea02);})[_0xe4bf('0x24')](function(_0x5496cc){_0x4178f7=_0x5496cc;return getEndUser(_0x38fbae,_0x3c76d4,_0x5568f2['destcalleridname'],_0x5568f2[_0xe4bf('0x74')],_0x3fea02);})['then'](function(_0x2f1ab0){_0x31951e=_0x2f1ab0;return getTicket(_0x38fbae,_0x4178f7,_0x31951e,_0x3c76d4,_0x5568f2,_0x3c76d4[_0xe4bf('0x66')],_0x3fea02,_0xe4bf('0x71'));})['then'](function(_0xd9c51b){_0x47da33=_0xd9c51b;logger[_0xe4bf('0x1c')](_0xe4bf('0x75'),_0x47da33['id']);logger['info'](_0xe4bf('0x76'),_0x47da33['id'],_0x48dccf[_0xe4bf('0x50')],_0x38fbae[_0xe4bf('0x3a')]);switch(_0x38fbae[_0xe4bf('0x3a')]){case _0xe4bf('0x68'):emit(util[_0xe4bf('0x42')](_0xe4bf('0x69'),_0x48dccf[_0xe4bf('0x50')]),'trigger:salesforce:display',{'recordId':_0x47da33['id']});break;case _0xe4bf('0x6b'):emit(util['format'](_0xe4bf('0x69'),_0x48dccf[_0xe4bf('0x50')]),'trigger:browser:url',{'uri':util[_0xe4bf('0x42')](_0xe4bf('0x6c'),_0x3fea02['instanceUrl'],_0x47da33['id'])});break;default:logger[_0xe4bf('0x6e')](_0xe4bf('0x77'),_0xe4bf('0x78'));}})[_0xe4bf('0x70')](function(_0x365089){logger[_0xe4bf('0x6e')](_0xe4bf('0x77'),_0x365089);});};exports[_0xe4bf('0x79')]=function(_0x202ccb,_0xf17f26,_0x4c657d,_0x155125,_0xbe7015,_0x45ca53){var _0x38a1c3,_0x3ce8d4,_0x357787,_0x3116ba;_0x45ca53[_0xe4bf('0x5c')]=intUtil['stripTrailingSlash'](_0x45ca53[_0xe4bf('0x5c')]);_0x45ca53['remoteUri']=intUtil[_0xe4bf('0x5d')](_0x45ca53['remoteUri']);if(_0xbe7015&&_0xbe7015[_0xe4bf('0x7a')]){logger[_0xe4bf('0x1c')]('['+_0xf17f26[_0xe4bf('0x7b')]['toUpperCase']()+']',_0xe4bf('0x60'));_0xf17f26[_0xe4bf('0x61')]=util[_0xe4bf('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45ca53['serverUrl'],_0xf17f26[_0xe4bf('0x63')],md5(_0xf17f26['uniqueid']));}else{_0xf17f26[_0xe4bf('0x61')]='';}return getConnection(_0x45ca53)[_0xe4bf('0x24')](function(_0x242565){_0x3116ba=_0x242565;if(!_[_0xe4bf('0x20')](_0x155125)){return getUser(_0x45ca53,_0x155125[_0xe4bf('0x50')],_0x3116ba);}else{return getUser(_0x45ca53,null,_0x3116ba);}})[_0xe4bf('0x24')](function(_0x179fc0){_0x38a1c3=_0x179fc0;return getEndUser(_0x45ca53,_0x4c657d,_0xf17f26['calleridname'],_0xf17f26['calleridnum'],_0x3116ba);})[_0xe4bf('0x24')](function(_0x2f49b0){_0x3ce8d4=_0x2f49b0;return getTicket(_0x45ca53,_0x38a1c3,_0x3ce8d4,_0x4c657d,_0xf17f26,_0x4c657d[_0xe4bf('0x66')],_0x3116ba);})['then'](function(_0xd9b970){_0x357787=_0xd9b970;logger[_0xe4bf('0x1c')]('['+_0xf17f26[_0xe4bf('0x7b')][_0xe4bf('0x7c')]()+_0xe4bf('0x7d'),_0x357787['id']);logger['info']('['+_0xf17f26[_0xe4bf('0x7b')][_0xe4bf('0x7c')]()+_0xe4bf('0x7e'),_0x45ca53[_0xe4bf('0x3a')]);})[_0xe4bf('0x70')](function(_0x2affd1){logger['error']('['+_0xf17f26['lastevent'][_0xe4bf('0x7c')]()+']',_0x2affd1);});}; \ 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 c427a6a..910b12e 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 _0x6cda=['unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','adminEmail','userId','POST','sys_user?','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','endUserNumber','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','toString','idField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection'];(function(_0x365b01,_0x4d1cb4){var _0x4235f5=function(_0x5927db){while(--_0x5927db){_0x365b01['push'](_0x365b01['shift']());}};_0x4235f5(++_0x4d1cb4);}(_0x6cda,0x151));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Promise=require(_0xa6cd('0x0'));var rp=require(_0xa6cd('0x1'));var util=require(_0xa6cd('0x2'));var md5=require(_0xa6cd('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa6cd('0x4'));var config=require(_0xa6cd('0x5'));var logger=require(_0xa6cd('0x6'))(_0xa6cd('0x7'));config[_0xa6cd('0x8')]=_[_0xa6cd('0x9')](config['redis'],{'host':_0xa6cd('0xa'),'port':0x18eb});var io=require(_0xa6cd('0xb'))(new Redis(config['redis']));function getAdminUser(_0x359c1a,_0x1fddf0,_0x1389b0,_0x2ada0f,_0x429f8c,_0x9da37a){return new Promise(function(_0x1e1188,_0x179e10){var _0x46c056={'method':_0xa6cd('0xc'),'uri':_0x2ada0f+_0xa6cd('0xd')+'&'+_0x429f8c+'&'+_0x9da37a,'auth':_0x1fddf0,'json':!![]};return rp(_0x46c056)[_0xa6cd('0xe')](function(_0x5de242){if(_0x5de242[_0xa6cd('0xf')]['length']>0x0){_0x1389b0[_0xa6cd('0x10')]=_0x5de242[_0xa6cd('0xf')][0x0][_0xa6cd('0x11')];}logger[_0xa6cd('0x12')]('['+[_0x359c1a['toUpperCase']()]+_0xa6cd('0x13'),_0x1389b0);_0x1e1188(_0x1389b0);})[_0xa6cd('0x14')](function(_0x3312e0){logger[_0xa6cd('0x15')]('['+[_0x359c1a[_0xa6cd('0x16')]()]+']',_0x3312e0[_0xa6cd('0x17')]);_0x179e10(_0x3312e0[_0xa6cd('0x17')]);});});}function getUser(_0xfa2ceb,_0x885b97,_0x1b8fd1,_0x25eaee,_0x105e6d){return function(_0x351a2f){logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+'],\x20getUser\x20input\x20crm',_0x351a2f);return new Promise(function(_0x7cb4af,_0xe3769a){if(intUtil[_0xa6cd('0x18')](_0x351a2f[_0xa6cd('0x19')])){var _0x89163f={'method':_0xa6cd('0xc'),'uri':_0x1b8fd1+_0xa6cd('0x1a')+_0x351a2f[_0xa6cd('0x19')]+'&'+_0x25eaee+'&'+_0x105e6d,'auth':_0x885b97,'json':!![]};logger['info']('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+_0xa6cd('0x1b'),_0x89163f);return rp(_0x89163f)['then'](function(_0x2c9d81){logger['info']('['+[_0xfa2ceb['toUpperCase']()]+_0xa6cd('0x1c'),_0x2c9d81);if(_0x2c9d81[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0&&String(_0x2c9d81[_0xa6cd('0xf')][0x0][_0xa6cd('0x1e')])===_0xa6cd('0x1f')){_0x351a2f['userId']=_0x2c9d81['result'][0x0][_0xa6cd('0x11')];}else{_0x351a2f['userId']=_0x351a2f[_0xa6cd('0x10')];_0x351a2f[_0xa6cd('0x19')]=_0x351a2f[_0xa6cd('0x20')];}logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+'],\x20getUser\x20crm',_0x351a2f);_0x7cb4af(_0x351a2f);})[_0xa6cd('0x14')](function(_0xb9158c){logger[_0xa6cd('0x15')]('['+[_0xfa2ceb['toUpperCase']()]+']',_0xb9158c[_0xa6cd('0x17')]);_0xe3769a(_0xb9158c['message']);});}else{logger[_0xa6cd('0x12')]('['+[_0xfa2ceb[_0xa6cd('0x16')]()]+']\x20using\x20admin\x20profile');_0x351a2f[_0xa6cd('0x21')]=_0x351a2f[_0xa6cd('0x10')];_0x351a2f[_0xa6cd('0x19')]=_0x351a2f[_0xa6cd('0x20')];_0x7cb4af(_0x351a2f);}});};}function createEndUser(_0x352ecb,_0x4aafbc,_0x2f1d12,_0x493f65,_0x5ed0a2){logger[_0xa6cd('0x12')]('['+[_0x352ecb[_0xa6cd('0x16')]()]+'],\x20createEndUser\x20input\x20crm',_0x2f1d12);return new Promise(function(_0x5f4b9f,_0x205e64){var _0x4e366f={'method':_0xa6cd('0x22'),'uri':_0x493f65+_0xa6cd('0x23')+_0x5ed0a2,'body':{'user_name':_0x2f1d12['endUserNumber'],'roles':'user','first_name':_0x2f1d12['endUserNumber'],'active':_0xa6cd('0x1f'),'date_format':_0xa6cd('0x24'),'phone':_0x2f1d12['endUserNumber']},'auth':_0x4aafbc,'json':!![]};return rp(_0x4e366f)[_0xa6cd('0xe')](function(_0x2ec904){logger[_0xa6cd('0x12')]('['+[_0x352ecb[_0xa6cd('0x16')]()]+_0xa6cd('0x25'),_0x2ec904['result']);_0x2f1d12[_0xa6cd('0x26')]=_0x2ec904[_0xa6cd('0xf')]['sys_id'];_0x5f4b9f(_0x2f1d12);})[_0xa6cd('0x14')](function(_0x4ec462){logger['error']('['+[_0x352ecb[_0xa6cd('0x16')]()]+']',_0x4ec462['message']);_0x205e64(_0x4ec462['message']);});});}function getEndUser(_0x4b3999,_0x58969e,_0x28bc65,_0x5e5a8d,_0x18d329){return function(_0x3f9527){logger['info']('['+[_0x4b3999[_0xa6cd('0x16')]()]+'],\x20getEndUser\x20input\x20crm',_0x3f9527);return new Promise(function(_0x33ee47,_0x2bda27){var _0x244e18={'method':_0xa6cd('0xc'),'uri':_0x28bc65+_0xa6cd('0x27')+_0x3f9527[_0xa6cd('0x28')]+'&'+_0x5e5a8d+'&'+_0x18d329,'auth':_0x58969e,'json':!![]};return rp(_0x244e18)[_0xa6cd('0xe')](function(_0x41fa86){if(_0x41fa86[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0){_0x3f9527[_0xa6cd('0x26')]=_0x41fa86['result'][0x0][_0xa6cd('0x11')];logger[_0xa6cd('0x12')]('['+[_0x4b3999[_0xa6cd('0x16')]()]+_0xa6cd('0x29'),_0x3f9527);_0x33ee47(_0x3f9527);}else{return createEndUser(_0x4b3999,_0x58969e,_0x3f9527,_0x28bc65,_0x5e5a8d)[_0xa6cd('0xe')](function(_0x19f39d){logger[_0xa6cd('0x12')]('['+[_0x4b3999[_0xa6cd('0x16')]()]+'],\x20createEndUser\x20crm',_0x19f39d);_0x33ee47(_0x19f39d);});}})['catch'](function(_0x2d6403){logger[_0xa6cd('0x15')]('['+[_0x4b3999['toUpperCase']()]+']',_0x2d6403[_0xa6cd('0x17')]);_0x2bda27(_0x2d6403[_0xa6cd('0x17')]);});});};}function getCustomFields(_0x4ca04c,_0x379805){var _0x2eee1d={};if(_0x4ca04c[_0xa6cd('0x1d')]>0x0){_[_0xa6cd('0x2a')](_0x4ca04c,function(_0x240323){if(_[_0xa6cd('0x2b')]([_0xa6cd('0x2c'),_0xa6cd('0x2d')],_0x240323[_0xa6cd('0x2e')])&&_0x240323[_0xa6cd('0x2f')]&&!_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323[_0xa6cd('0x2f')]['toLowerCase']()]=_0x240323[_0xa6cd('0x31')][_0xa6cd('0x32')]();}else if(_[_0xa6cd('0x2b')]([_0xa6cd('0x2c'),_0xa6cd('0x2d')],_0x240323[_0xa6cd('0x2e')])&&_0x240323[_0xa6cd('0x33')]&&_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323['idField'][_0xa6cd('0x34')]()]=_0x240323['content']['toString']();}else if(_0x240323[_0xa6cd('0x2e')]==='variable'&&_0x240323[_0xa6cd('0x35')]&&_0x240323[_0xa6cd('0x33')]&&_0x240323['customField']){_0x2eee1d[_0x240323[_0xa6cd('0x33')][_0xa6cd('0x34')]()]=_0x379805[_0x240323[_0xa6cd('0x35')]][_0xa6cd('0x32')]();}else if(_0x240323['type']===_0xa6cd('0x36')&&_0x240323[_0xa6cd('0x37')]&&_0x240323[_0xa6cd('0x37')][_0xa6cd('0x38')]&&_0x240323[_0xa6cd('0x33')]&&_0x240323[_0xa6cd('0x30')]){_0x2eee1d[_0x240323[_0xa6cd('0x33')][_0xa6cd('0x34')]()]=_0x379805[_0x240323['Variable']['name']['toLowerCase']()][_0xa6cd('0x32')]();}});}return _0x2eee1d;}function getTicket(_0x5bfb34,_0x4909c2,_0x5c6ba8,_0x19d3c0,_0x5973,_0x4bc839){return function(_0x2d7b78){logger['info']('['+[_0x5bfb34[_0xa6cd('0x16')]()]+_0xa6cd('0x39'),_0x2d7b78);return new Promise(function(_0x4e28fc,_0x36a72f){var _0x25e8f3=_0x5bfb34['toLowerCase']()===_0xa6cd('0x3a')?_0x2d7b78[_0xa6cd('0x21')]:_0x2d7b78[_0xa6cd('0x26')];var _0x4d71ad={'method':_0xa6cd('0x22'),'uri':_0x5c6ba8+'incident'+'?'+_0x4bc839,'body':Object['assign']({},{'active':_0xa6cd('0x1f'),'caller_id':_0x25e8f3,'assigned_to':_0x2d7b78[_0xa6cd('0x21')],'short_description':intUtil['getString'](_0x19d3c0[_0xa6cd('0x3b')],_0x5973,'\x20'),'description':intUtil[_0xa6cd('0x3c')](_0x19d3c0[_0xa6cd('0x3d')],_0x5973,'\x0a')},getCustomFields(_0x19d3c0[_0xa6cd('0x3e')],_0x5973)),'auth':_0x4909c2,'json':!![]};return rp(_0x4d71ad)[_0xa6cd('0xe')](function(_0x36518a){logger[_0xa6cd('0x12')]('['+[_0x5bfb34['toUpperCase']()]+_0xa6cd('0x3f'),_0x36518a[_0xa6cd('0xf')]);_0x2d7b78[_0xa6cd('0x40')]=_0x36518a[_0xa6cd('0xf')][_0xa6cd('0x11')];_0x2d7b78[_0xa6cd('0x41')]=_0x36518a['result'][_0xa6cd('0x42')];logger['info']('['+[_0x5bfb34[_0xa6cd('0x16')]()]+_0xa6cd('0x43'),_0x2d7b78);_0x4e28fc(_0x2d7b78);})[_0xa6cd('0x14')](function(_0x387c79){logger[_0xa6cd('0x15')]('['+[_0x5bfb34['toUpperCase']()]+']',_0x387c79[_0xa6cd('0x17')]);_0x36a72f(_0x387c79[_0xa6cd('0x17')]);});});};}function createRemoteTag(_0x1fd16a,_0x47d40f,_0x2d2189,_0x34e775){return new Promise(function(_0x33fdbf,_0x38c298){var _0x289aed={'method':'POST','uri':_0x2d2189+_0xa6cd('0x44')+'?'+_0x34e775,'body':{'short_description':_0x1fd16a,'global':!![],'active':!![],'name':_0x1fd16a},'auth':_0x47d40f,'json':!![]};return rp(_0x289aed)[_0xa6cd('0xe')](function(_0x17d784){var _0x41b172=_0x17d784[_0xa6cd('0xf')][_0xa6cd('0x11')];_0x33fdbf(_0x41b172);});});}function getRemoteTag(_0x4a6230,_0x4ae54b,_0x3fe771,_0x53e821,_0x1e1bca){return new Promise(function(_0x18e845,_0x548e33){var _0x154d0c={'method':_0xa6cd('0xc'),'uri':_0x3fe771+'label'+_0xa6cd('0x45')+_0x4a6230+'&'+_0x53e821,'auth':_0x4ae54b,'json':!![]};return rp(_0x154d0c)[_0xa6cd('0xe')](function(_0x2969ff){if(_0x2969ff[_0xa6cd('0xf')][_0xa6cd('0x1d')]>0x0){var _0x79754a=_0x2969ff['result'][0x0][_0xa6cd('0x11')];_0x18e845(_0x79754a);}else{return createRemoteTag(_0x4a6230,_0x4ae54b,_0x3fe771,_0x53e821)[_0xa6cd('0xe')](function(_0x21b797){_0x18e845(_0x21b797);});}});});}function assignTagToIncident(_0x11e1ae,_0x2735fa,_0x4ba59e,_0x1e16ae,_0x974089){return new Promise(function(_0x1444a9,_0x1826a6){var _0x334d2e={'method':'POST','uri':_0x4ba59e+_0xa6cd('0x46')+'?'+_0x974089,'body':{'label':_0x11e1ae,'table':'incident','id_type':'Incident','table_key':_0x1e16ae['ticketId'],'title':_0xa6cd('0x47')+_0x1e16ae[_0xa6cd('0x41')],'id_display':_0x1e16ae['ticketNumber']},'auth':_0x2735fa,'json':!![]};return rp(_0x334d2e)['then'](function(_0x2e79d2){_0x1444a9();})[_0xa6cd('0x14')](function(){_0x1444a9();});});}function manageTags(_0x281194,_0x247fdc,_0x529670,_0x135a3b,_0x315800,_0x9b674b,_0xd3b12f){return new Promise(function(_0x4aa59f,_0x418a9f){var _0x103cb6=[];_0x247fdc[_0xa6cd('0x2a')](function(_0x1e0a8a){_0x103cb6[_0xa6cd('0x48')](getRemoteTag(_0x1e0a8a,_0x529670,_0x135a3b,_0x9b674b,_0xd3b12f));});return Promise[_0xa6cd('0x49')](_0x103cb6)['then'](function(_0x4b616c){if(_0x4b616c[_0xa6cd('0x1d')]){logger[_0xa6cd('0x12')]('['+[_0x281194[_0xa6cd('0x16')]()]+_0xa6cd('0x4a'),_0x4b616c);var _0x415385=[];_0x4b616c[_0xa6cd('0x2a')](function(_0x1c7736){_0x415385[_0xa6cd('0x48')](assignTagToIncident(_0x1c7736,_0x529670,_0x135a3b,_0x315800,_0x9b674b));});return Promise[_0xa6cd('0x49')](_0x415385)[_0xa6cd('0xe')](function(){_0x4aa59f();})[_0xa6cd('0x14')](function(){_0x4aa59f();});}else{_0x4aa59f();}});});}function getTags(_0xdbd92,_0x38d4d6,_0x1ff067,_0x1f2103,_0x20bb41,_0x26f9e4){return function(_0x2b42c7){return new Promise(function(_0x2434ff,_0xfcec77){var _0x30c65a=[];var _0x6cd21a=_0x1f2103[_0xa6cd('0x4b')];if(_0x6cd21a&&_0x6cd21a[_0xa6cd('0x1d')]>0x0){_0x30c65a=_['map'](_0x6cd21a,_0xa6cd('0x38'));}if(_0x30c65a[_0xa6cd('0x1d')]>0x0){return manageTags(_0xdbd92,_0x30c65a,_0x38d4d6,_0x1ff067,_0x2b42c7,_0x20bb41,_0x26f9e4)[_0xa6cd('0xe')](function(){_0x2434ff(_0x2b42c7);});}else{_0x2434ff(_0x2b42c7);}});};}function emit(_0x334331,_0x2564a6,_0x5d685c){var _0x1f4d04='%26sysparm_record_target%3Dincident'+_0xa6cd('0x4c')+_0xa6cd('0x4d')+_0xa6cd('0x4e');var _0x205b84={'uri':_0x334331+_0xa6cd('0x4f')+_0x5d685c+_0x1f4d04};io['to'](util[_0xa6cd('0x50')](_0xa6cd('0x51'),_0x2564a6))[_0xa6cd('0x52')](_0xa6cd('0x53'),_0x205b84);}exports['cs']=function(_0x306547,_0x26901c,_0xcb2893,_0xa23dda,_0x47de80,_0x4cc773,_0x292fc2,_0x2c0327){var _0x5c6b26={};var _0x1938dc={'user':_0x4cc773[_0xa6cd('0x54')],'pass':_0x4cc773['password']};var _0x48d6f0=_0xa6cd('0x55');var _0x51d40b=_0xa6cd('0x56');_0x4cc773[_0xa6cd('0x57')]=intUtil[_0xa6cd('0x58')](_0x4cc773['remoteUri']);_0x4cc773['serverUrl']=intUtil[_0xa6cd('0x58')](_0x4cc773['serverUrl']);var _0xf5a95c=util['format'](_0xa6cd('0x59'),_0x4cc773[_0xa6cd('0x57')]);_0x5c6b26[_0xa6cd('0x19')]=!_[_0xa6cd('0x5a')](_0xa23dda)?_0xa23dda[_0xa6cd('0x5b')]:null;_0x5c6b26['adminEmail']=_0x4cc773[_0xa6cd('0x5b')];_0x5c6b26[_0xa6cd('0x28')]=_0x2c0327[_0xa6cd('0x34')]()===_0xa6cd('0x3a')?_0x26901c[_0xa6cd('0x5c')]:_0x26901c[_0xa6cd('0x5d')];_0x5c6b26[_0xa6cd('0x5e')]=_0x2c0327==='queue'||_0x2c0327===_0xa6cd('0x5f')?_0xa6cd('0x60'):'outbound';var _0x32bf65=util['format'](_0xa6cd('0x61'),_0x4cc773[_0xa6cd('0x62')],_0x26901c[_0xa6cd('0x63')],md5(_0x26901c[_0xa6cd('0x63')]));if(_0x47de80&&_0x47de80['monitor_format']){logger[_0xa6cd('0x12')](_0xa6cd('0x64'),_0xa6cd('0x65'));_0x26901c[_0xa6cd('0x66')]=_0x32bf65;}else if(_0x292fc2&&_0x292fc2[_0xa6cd('0x67')]&&_0x292fc2['recordingFormat']!==_0xa6cd('0x68')){logger[_0xa6cd('0x12')]('[OUTBOUND]',_0xa6cd('0x65'));_0x26901c['recordingURL']=_0x32bf65;}else{_0x26901c[_0xa6cd('0x66')]='';}return getAdminUser(_0x2c0327,_0x1938dc,_0x5c6b26,_0xf5a95c,_0x51d40b,_0x48d6f0)[_0xa6cd('0xe')](getUser(_0x2c0327,_0x1938dc,_0xf5a95c,_0x51d40b,_0x48d6f0))[_0xa6cd('0xe')](getEndUser(_0x2c0327,_0x1938dc,_0xf5a95c,_0x51d40b,_0x48d6f0))[_0xa6cd('0xe')](getTicket(_0x2c0327,_0x1938dc,_0xf5a95c,_0xcb2893,_0x26901c,_0x51d40b))[_0xa6cd('0xe')](function(_0x2c423d){logger[_0xa6cd('0x12')](util[_0xa6cd('0x50')](_0xa6cd('0x69'),_0x2c423d[_0xa6cd('0x40')]));logger['info'](util['format'](_0xa6cd('0x6a'),_0x2c0327));if(_0x2c0327!=='unmanaged'){logger[_0xa6cd('0x12')]('['+[_0x2c0327['toUpperCase']()]+']',_0xa6cd('0x6b'));emit(_0x4cc773[_0xa6cd('0x57')],_0xa23dda[_0xa6cd('0x38')],_0x2c423d[_0xa6cd('0x40')]);}})[_0xa6cd('0x14')](function(_0x210573){logger[_0xa6cd('0x15')]('['+[_0x2c0327[_0xa6cd('0x16')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x210573,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xea34=['info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20entity','active','true','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','nameField','toLowerCase','content','includes','type','idField','customField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','Subjects','getString','Descriptions','Fields','ticketId','ticketNumber','label','label_entry','incident','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','ioredis','./util','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','catch','error','message'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xea34,0xbe));var _0x4ea3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xea34[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4ea3('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x4ea3('0x1'));var intUtil=require(_0x4ea3('0x2'));var config=require('../../../../config/environment');var logger=require(_0x4ea3('0x3'))('servicenow');config['redis']=_[_0x4ea3('0x4')](config['redis'],{'host':_0x4ea3('0x5'),'port':0x18eb});var io=require(_0x4ea3('0x6'))(new Redis(config[_0x4ea3('0x7')]));function getAdminUser(_0x456662,_0x346754,_0xc782a1,_0x58ee7c,_0x545eed,_0x35c808){return new Promise(function(_0xff0aeb,_0x5d36f8){var _0x31021f={'method':'GET','uri':_0x58ee7c+_0x4ea3('0x8')+'&'+_0x545eed+'&'+_0x35c808,'auth':_0x346754,'json':!![]};return rp(_0x31021f)[_0x4ea3('0x9')](function(_0x191772){if(_0x191772[_0x4ea3('0xa')][_0x4ea3('0xb')]>0x0){_0xc782a1[_0x4ea3('0xc')]=_0x191772['result'][0x0][_0x4ea3('0xd')];}logger['info']('['+[_0x456662[_0x4ea3('0xe')]()]+'],\x20getAdminUser\x20crm',_0xc782a1);_0xff0aeb(_0xc782a1);})[_0x4ea3('0xf')](function(_0x480a84){logger[_0x4ea3('0x10')]('['+[_0x456662[_0x4ea3('0xe')]()]+']',_0x480a84['message']);_0x5d36f8(_0x480a84[_0x4ea3('0x11')]);});});}function getUser(_0x2c815a,_0x48a25a,_0x246f0f,_0x475f7d,_0x35b464){return function(_0x530e5d){logger[_0x4ea3('0x12')]('['+[_0x2c815a[_0x4ea3('0xe')]()]+_0x4ea3('0x13'),_0x530e5d);return new Promise(function(_0x2eb875,_0x2fd7e3){if(intUtil[_0x4ea3('0x14')](_0x530e5d[_0x4ea3('0x15')])){var _0x4f0343={'method':_0x4ea3('0x16'),'uri':_0x246f0f+'sys_user?sysparm_query=email%3D'+_0x530e5d['userEmail']+'&'+_0x475f7d+'&'+_0x35b464,'auth':_0x48a25a,'json':!![]};logger[_0x4ea3('0x12')]('['+[_0x2c815a[_0x4ea3('0xe')]()]+'],\x20getUser\x20rp\x20obj',_0x4f0343);return rp(_0x4f0343)['then'](function(_0x3febed){logger[_0x4ea3('0x12')]('['+[_0x2c815a[_0x4ea3('0xe')]()]+_0x4ea3('0x17'),_0x3febed);if(_0x3febed[_0x4ea3('0xa')][_0x4ea3('0xb')]>0x0&&String(_0x3febed[_0x4ea3('0xa')][0x0][_0x4ea3('0x18')])===_0x4ea3('0x19')){_0x530e5d['userId']=_0x3febed[_0x4ea3('0xa')][0x0][_0x4ea3('0xd')];}else{_0x530e5d['userId']=_0x530e5d[_0x4ea3('0xc')];_0x530e5d[_0x4ea3('0x15')]=_0x530e5d[_0x4ea3('0x1a')];}logger[_0x4ea3('0x12')]('['+[_0x2c815a[_0x4ea3('0xe')]()]+_0x4ea3('0x1b'),_0x530e5d);_0x2eb875(_0x530e5d);})['catch'](function(_0x5bc3b1){logger['error']('['+[_0x2c815a['toUpperCase']()]+']',_0x5bc3b1[_0x4ea3('0x11')]);_0x2fd7e3(_0x5bc3b1['message']);});}else{logger['info']('['+[_0x2c815a[_0x4ea3('0xe')]()]+_0x4ea3('0x1c'));_0x530e5d[_0x4ea3('0x1d')]=_0x530e5d[_0x4ea3('0xc')];_0x530e5d[_0x4ea3('0x15')]=_0x530e5d[_0x4ea3('0x1a')];_0x2eb875(_0x530e5d);}});};}function createEndUser(_0x184bde,_0x47eab8,_0x147176,_0x5e03fc,_0xc83417){logger[_0x4ea3('0x12')]('['+[_0x184bde[_0x4ea3('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x147176);return new Promise(function(_0x406582,_0x5e9776){var _0x1941bd={'method':_0x4ea3('0x1e'),'uri':_0x5e03fc+'sys_user?'+_0xc83417,'body':{'user_name':_0x147176[_0x4ea3('0x1f')],'roles':_0x4ea3('0x20'),'first_name':_0x147176[_0x4ea3('0x1f')],'active':_0x4ea3('0x19'),'date_format':'System','phone':_0x147176[_0x4ea3('0x1f')]},'auth':_0x47eab8,'json':!![]};return rp(_0x1941bd)['then'](function(_0x3a2ecc){logger[_0x4ea3('0x12')]('['+[_0x184bde['toUpperCase']()]+_0x4ea3('0x21'),_0x3a2ecc['result']);_0x147176[_0x4ea3('0x22')]=_0x3a2ecc[_0x4ea3('0xa')][_0x4ea3('0xd')];_0x406582(_0x147176);})[_0x4ea3('0xf')](function(_0x5ba532){logger[_0x4ea3('0x10')]('['+[_0x184bde['toUpperCase']()]+']',_0x5ba532[_0x4ea3('0x11')]);_0x5e9776(_0x5ba532[_0x4ea3('0x11')]);});});}function getEndUser(_0x2c5928,_0x2a4ff9,_0x3f200a,_0x41ba6d,_0x2c51c8){return function(_0x45bde8){logger[_0x4ea3('0x12')]('['+[_0x2c5928['toUpperCase']()]+_0x4ea3('0x23'),_0x45bde8);return new Promise(function(_0x1fde71,_0x10be37){var _0x2ae9b5={'method':_0x4ea3('0x16'),'uri':_0x3f200a+_0x4ea3('0x24')+_0x45bde8[_0x4ea3('0x1f')]+'&'+_0x41ba6d+'&'+_0x2c51c8,'auth':_0x2a4ff9,'json':!![]};return rp(_0x2ae9b5)[_0x4ea3('0x9')](function(_0x76785){if(_0x76785[_0x4ea3('0xa')][_0x4ea3('0xb')]>0x0){_0x45bde8[_0x4ea3('0x22')]=_0x76785[_0x4ea3('0xa')][0x0][_0x4ea3('0xd')];logger['info']('['+[_0x2c5928[_0x4ea3('0xe')]()]+_0x4ea3('0x25'),_0x45bde8);_0x1fde71(_0x45bde8);}else{return createEndUser(_0x2c5928,_0x2a4ff9,_0x45bde8,_0x3f200a,_0x41ba6d)[_0x4ea3('0x9')](function(_0x5607dd){logger[_0x4ea3('0x12')]('['+[_0x2c5928[_0x4ea3('0xe')]()]+_0x4ea3('0x26'),_0x5607dd);_0x1fde71(_0x5607dd);});}})[_0x4ea3('0xf')](function(_0x23b413){logger[_0x4ea3('0x10')]('['+[_0x2c5928['toUpperCase']()]+']',_0x23b413[_0x4ea3('0x11')]);_0x10be37(_0x23b413[_0x4ea3('0x11')]);});});};}function getCustomFields(_0x420cb7,_0x32d395){var _0x319b64={};if(_0x420cb7[_0x4ea3('0xb')]>0x0){_[_0x4ea3('0x27')](_0x420cb7,function(_0x4e5ee1){if(_['includes']([_0x4ea3('0x28'),_0x4ea3('0x29')],_0x4e5ee1['type'])&&_0x4e5ee1[_0x4ea3('0x2a')]&&!_0x4e5ee1['customField']){_0x319b64[_0x4e5ee1[_0x4ea3('0x2a')][_0x4ea3('0x2b')]()]=_0x4e5ee1[_0x4ea3('0x2c')]['toString']();}else if(_[_0x4ea3('0x2d')](['string',_0x4ea3('0x29')],_0x4e5ee1[_0x4ea3('0x2e')])&&_0x4e5ee1[_0x4ea3('0x2f')]&&_0x4e5ee1[_0x4ea3('0x30')]){_0x319b64[_0x4e5ee1[_0x4ea3('0x2f')]['toLowerCase']()]=_0x4e5ee1['content'][_0x4ea3('0x31')]();}else if(_0x4e5ee1[_0x4ea3('0x2e')]===_0x4ea3('0x32')&&_0x4e5ee1['variableName']&&_0x4e5ee1[_0x4ea3('0x2f')]&&_0x4e5ee1[_0x4ea3('0x30')]){_0x319b64[_0x4e5ee1[_0x4ea3('0x2f')][_0x4ea3('0x2b')]()]=_0x32d395[_0x4e5ee1[_0x4ea3('0x33')]][_0x4ea3('0x31')]();}else if(_0x4e5ee1['type']===_0x4ea3('0x34')&&_0x4e5ee1[_0x4ea3('0x35')]&&_0x4e5ee1[_0x4ea3('0x35')]['name']&&_0x4e5ee1[_0x4ea3('0x2f')]&&_0x4e5ee1['customField']){_0x319b64[_0x4e5ee1[_0x4ea3('0x2f')]['toLowerCase']()]=_0x32d395[_0x4e5ee1['Variable'][_0x4ea3('0x36')]['toLowerCase']()][_0x4ea3('0x31')]();}});}return _0x319b64;}function getTicket(_0x265466,_0x2e7e71,_0x26bc46,_0x3f596a,_0x1c92e1,_0x2b2107){return function(_0x2d2bce){logger[_0x4ea3('0x12')]('['+[_0x265466['toUpperCase']()]+_0x4ea3('0x37'),_0x2d2bce);return new Promise(function(_0x172e92,_0x43ed40){var _0x524866=_0x265466['toLowerCase']()===_0x4ea3('0x38')?_0x2d2bce[_0x4ea3('0x1d')]:_0x2d2bce[_0x4ea3('0x22')];var _0x4d5b09={'method':_0x4ea3('0x1e'),'uri':_0x26bc46+'incident'+'?'+_0x2b2107,'body':Object[_0x4ea3('0x39')]({},{'active':_0x4ea3('0x19'),'caller_id':_0x524866,'assigned_to':_0x2d2bce['userId'],'short_description':intUtil['getString'](_0x3f596a[_0x4ea3('0x3a')],_0x1c92e1,'\x20'),'description':intUtil[_0x4ea3('0x3b')](_0x3f596a[_0x4ea3('0x3c')],_0x1c92e1,'\x0a')},getCustomFields(_0x3f596a[_0x4ea3('0x3d')],_0x1c92e1)),'auth':_0x2e7e71,'json':!![]};return rp(_0x4d5b09)['then'](function(_0x2eef37){logger[_0x4ea3('0x12')]('['+[_0x265466['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x2eef37[_0x4ea3('0xa')]);_0x2d2bce[_0x4ea3('0x3e')]=_0x2eef37[_0x4ea3('0xa')][_0x4ea3('0xd')];_0x2d2bce[_0x4ea3('0x3f')]=_0x2eef37[_0x4ea3('0xa')]['number'];logger['info']('['+[_0x265466[_0x4ea3('0xe')]()]+']\x20getTicket\x20crm',_0x2d2bce);_0x172e92(_0x2d2bce);})[_0x4ea3('0xf')](function(_0x246baa){logger[_0x4ea3('0x10')]('['+[_0x265466['toUpperCase']()]+']',_0x246baa[_0x4ea3('0x11')]);_0x43ed40(_0x246baa['message']);});});};}function createRemoteTag(_0x270284,_0x1509b2,_0x56263a,_0x496ce1){return new Promise(function(_0x27bf9c,_0x3b5f7){var _0x32c21e={'method':'POST','uri':_0x56263a+_0x4ea3('0x40')+'?'+_0x496ce1,'body':{'short_description':_0x270284,'global':!![],'active':!![],'name':_0x270284},'auth':_0x1509b2,'json':!![]};return rp(_0x32c21e)['then'](function(_0x32f001){var _0x2bab4e=_0x32f001['result']['sys_id'];_0x27bf9c(_0x2bab4e);});});}function getRemoteTag(_0x1a0b54,_0x195a19,_0x3881c2,_0x10e36e,_0x2617e8){return new Promise(function(_0x1e9896,_0x1510bc){var _0x4f4805={'method':'GET','uri':_0x3881c2+_0x4ea3('0x40')+'?sysparm_query=name%3D'+_0x1a0b54+'&'+_0x10e36e,'auth':_0x195a19,'json':!![]};return rp(_0x4f4805)[_0x4ea3('0x9')](function(_0x45d13c){if(_0x45d13c[_0x4ea3('0xa')][_0x4ea3('0xb')]>0x0){var _0x2039ff=_0x45d13c[_0x4ea3('0xa')][0x0][_0x4ea3('0xd')];_0x1e9896(_0x2039ff);}else{return createRemoteTag(_0x1a0b54,_0x195a19,_0x3881c2,_0x10e36e)[_0x4ea3('0x9')](function(_0x2672be){_0x1e9896(_0x2672be);});}});});}function assignTagToIncident(_0x9085e9,_0xc63ad3,_0x51671d,_0x5688b1,_0x5c3c0a){return new Promise(function(_0x28da6a,_0x2322f2){var _0x12d846={'method':_0x4ea3('0x1e'),'uri':_0x51671d+_0x4ea3('0x41')+'?'+_0x5c3c0a,'body':{'label':_0x9085e9,'table':_0x4ea3('0x42'),'id_type':'Incident','table_key':_0x5688b1[_0x4ea3('0x3e')],'title':'Incident\x20-\x20'+_0x5688b1[_0x4ea3('0x3f')],'id_display':_0x5688b1[_0x4ea3('0x3f')]},'auth':_0xc63ad3,'json':!![]};return rp(_0x12d846)[_0x4ea3('0x9')](function(_0x27a30a){_0x28da6a();})[_0x4ea3('0xf')](function(){_0x28da6a();});});}function manageTags(_0x25ed7d,_0x2e21ea,_0x56e1a2,_0x3d3a66,_0x2235a0,_0x2c4f14,_0x51d6e8){return new Promise(function(_0x30de0f,_0x16772f){var _0x191b12=[];_0x2e21ea[_0x4ea3('0x27')](function(_0x3aa4c8){_0x191b12[_0x4ea3('0x43')](getRemoteTag(_0x3aa4c8,_0x56e1a2,_0x3d3a66,_0x2c4f14,_0x51d6e8));});return Promise[_0x4ea3('0x44')](_0x191b12)[_0x4ea3('0x9')](function(_0x597d6d){if(_0x597d6d[_0x4ea3('0xb')]){logger[_0x4ea3('0x12')]('['+[_0x25ed7d[_0x4ea3('0xe')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x597d6d);var _0x37d5dc=[];_0x597d6d[_0x4ea3('0x27')](function(_0x312890){_0x37d5dc[_0x4ea3('0x43')](assignTagToIncident(_0x312890,_0x56e1a2,_0x3d3a66,_0x2235a0,_0x2c4f14));});return Promise[_0x4ea3('0x44')](_0x37d5dc)['then'](function(){_0x30de0f();})[_0x4ea3('0xf')](function(){_0x30de0f();});}else{_0x30de0f();}});});}function getTags(_0x1ba90d,_0x476ec2,_0x469009,_0x2681ee,_0x4a2aef,_0x1abd86){return function(_0x19e9a6){return new Promise(function(_0x1969e8,_0x2ad4e3){var _0x2f19b5=[];var _0x23bb9d=_0x2681ee[_0x4ea3('0x45')];if(_0x23bb9d&&_0x23bb9d[_0x4ea3('0xb')]>0x0){_0x2f19b5=_[_0x4ea3('0x46')](_0x23bb9d,'name');}if(_0x2f19b5['length']>0x0){return manageTags(_0x1ba90d,_0x2f19b5,_0x476ec2,_0x469009,_0x19e9a6,_0x4a2aef,_0x1abd86)[_0x4ea3('0x9')](function(){_0x1969e8(_0x19e9a6);});}else{_0x1969e8(_0x19e9a6);}});};}function emit(_0x1daab5,_0x282664,_0x14ba39){var _0x1d6677=_0x4ea3('0x47')+_0x4ea3('0x48')+_0x4ea3('0x49')+_0x4ea3('0x4a');var _0x5c8e9a={'uri':_0x1daab5+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x14ba39+_0x1d6677};io['to'](util[_0x4ea3('0x4b')](_0x4ea3('0x4c'),_0x282664))[_0x4ea3('0x4d')]('trigger:browser:url',_0x5c8e9a);}exports['cs']=function(_0x2f90d6,_0x5e8171,_0x5e165d,_0x3735e5,_0x2b6a59,_0x299dda,_0x44d5da,_0x312b0d){var _0x411830={};var _0x459c54={'user':_0x299dda[_0x4ea3('0x4e')],'pass':_0x299dda[_0x4ea3('0x4f')]};var _0x293c1a=_0x4ea3('0x50');var _0x2809d1=_0x4ea3('0x51');_0x299dda[_0x4ea3('0x52')]=intUtil[_0x4ea3('0x53')](_0x299dda[_0x4ea3('0x52')]);_0x299dda[_0x4ea3('0x54')]=intUtil['stripTrailingSlash'](_0x299dda[_0x4ea3('0x54')]);var _0x2d7f89=util[_0x4ea3('0x4b')]('%s/api/now/table/',_0x299dda[_0x4ea3('0x52')]);_0x411830[_0x4ea3('0x15')]=!_[_0x4ea3('0x55')](_0x3735e5)?_0x3735e5[_0x4ea3('0x56')]:null;_0x411830[_0x4ea3('0x1a')]=_0x299dda[_0x4ea3('0x56')];_0x411830[_0x4ea3('0x1f')]=_0x312b0d[_0x4ea3('0x2b')]()===_0x4ea3('0x38')?_0x5e8171['destcalleridnum']:_0x5e8171[_0x4ea3('0x57')];_0x411830[_0x4ea3('0x58')]=_0x312b0d===_0x4ea3('0x59')||_0x312b0d===_0x4ea3('0x5a')?_0x4ea3('0x59'):_0x4ea3('0x38');var _0xca7e7b=util[_0x4ea3('0x4b')](_0x4ea3('0x5b'),_0x299dda[_0x4ea3('0x54')],_0x5e8171['uniqueid'],md5(_0x5e8171[_0x4ea3('0x5c')]));if(_0x2b6a59&&_0x2b6a59[_0x4ea3('0x5d')]){logger[_0x4ea3('0x12')](_0x4ea3('0x5e'),_0x4ea3('0x5f'));_0x5e8171[_0x4ea3('0x60')]=_0xca7e7b;}else if(_0x44d5da&&_0x44d5da[_0x4ea3('0x61')]&&_0x44d5da[_0x4ea3('0x61')]!==_0x4ea3('0x62')){logger['info'](_0x4ea3('0x63'),_0x4ea3('0x5f'));_0x5e8171['recordingURL']=_0xca7e7b;}else{_0x5e8171[_0x4ea3('0x60')]='';}return getAdminUser(_0x312b0d,_0x459c54,_0x411830,_0x2d7f89,_0x2809d1,_0x293c1a)['then'](getUser(_0x312b0d,_0x459c54,_0x2d7f89,_0x2809d1,_0x293c1a))[_0x4ea3('0x9')](getEndUser(_0x312b0d,_0x459c54,_0x2d7f89,_0x2809d1,_0x293c1a))[_0x4ea3('0x9')](getTicket(_0x312b0d,_0x459c54,_0x2d7f89,_0x5e165d,_0x5e8171,_0x2809d1))[_0x4ea3('0x9')](function(_0xe05c6c){logger['info'](util['format'](_0x4ea3('0x64'),_0xe05c6c[_0x4ea3('0x3e')]));logger[_0x4ea3('0x12')](util[_0x4ea3('0x4b')](_0x4ea3('0x65'),_0x312b0d));if(_0x312b0d!=='unmanaged'){logger[_0x4ea3('0x12')]('['+[_0x312b0d[_0x4ea3('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x299dda[_0x4ea3('0x52')],_0x3735e5['name'],_0xe05c6c[_0x4ea3('0x3e')]);}})[_0x4ea3('0xf')](function(_0xb5018b){logger[_0x4ea3('0x10')]('['+[_0x312b0d[_0x4ea3('0xe')]()]+_0x4ea3('0x66'),util[_0x4ea3('0x67')](_0xb5018b,{'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 a316203..775e2a3 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 _0xf04b=['base64','get_server_info','JSON','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','string','custom_fields','variable','variableName','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','contacts','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','isNil','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','stringify','Calls','format','Basic\x20%s','apiKey','toString'];(function(_0x2e74e0,_0x100308){var _0x47fe34=function(_0x3d44ab){while(--_0x3d44ab){_0x2e74e0['push'](_0x2e74e0['shift']());}};_0x47fe34(++_0x100308);}(_0xf04b,0x15c));var _0xbf04=function(_0xff0e1c,_0x445b2b){_0xff0e1c=_0xff0e1c-0x0;var _0x38fcc6=_0xf04b[_0xff0e1c];return _0x38fcc6;};'use strict';var _=require(_0xbf04('0x0'));var rp=require(_0xbf04('0x1'));var BPromise=require('bluebird');var md5=require(_0xbf04('0x2'));var util=require(_0xbf04('0x3'));var Redis=require('ioredis');var intUtil=require(_0xbf04('0x4'));var config=require(_0xbf04('0x5'));var logger=require(_0xbf04('0x6'))(_0xbf04('0x7'));config[_0xbf04('0x8')]=_['defaults'](config[_0xbf04('0x8')],{'host':_0xbf04('0x9'),'port':0x18eb});var io=require(_0xbf04('0xa'))(new Redis(config[_0xbf04('0x8')]));var def={'method':_0xbf04('0xb'),'json':!![]};function emit(_0x33bf22,_0xa045b8,_0x3890ad){io['to'](_0x33bf22)[_0xbf04('0xc')](_0xa045b8,_0x3890ad);}function getTicket(_0x557700,_0x45dd9e,_0x1890e3,_0x4988f4,_0x5be186,_0x433a18,_0x1b9536,_0x4b4ed7){logger[_0xbf04('0xd')](_0xbf04('0xe'));var _0x5f202a=new Date();var _0x568fd5=[{'name':_0xbf04('0xf'),'value':intUtil[_0xbf04('0x10')](_0x4988f4[_0xbf04('0x11')],_0x5be186,'\x20')},{'name':_0xbf04('0x12'),'value':_0x45dd9e['id']},{'name':_0xbf04('0x13'),'value':_0x45dd9e['id']},{'name':_0xbf04('0x14'),'value':intUtil[_0xbf04('0x10')](_0x4988f4[_0xbf04('0x15')],_0x5be186,'\x0a')},{'name':_0xbf04('0x16'),'value':_0x5f202a[_0xbf04('0x17')]()['slice'](0x0,0x13)[_0xbf04('0x18')]('T','\x20')},{'name':_0xbf04('0x19'),'value':'0'},{'name':_0xbf04('0x1a'),'value':'15'},{'name':_0xbf04('0x1b'),'value':_0x1890e3['id']},{'name':_0xbf04('0x1c'),'value':_0xbf04('0x1d')},{'name':_0xbf04('0x1e'),'value':_0x1890e3[_0xbf04('0xf')]},{'name':_0xbf04('0x1f'),'value':_0x4b4ed7}];if(_0x433a18[_0xbf04('0x20')]){_[_0xbf04('0x21')](_0x433a18,function(_0x243f3d){if(_0x5be186[_0x243f3d['variableName']]){_0x568fd5[_0xbf04('0x22')]({'name':_0x243f3d[_0xbf04('0x23')],'value':_0x5be186[_0x243f3d['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x1b9536['id'],'module_name':_0xbf04('0x25'),'name_value_list':_0x568fd5})}});}function getAuth(_0x17b89c){return util[_0xbf04('0x26')](_0xbf04('0x27'),new Buffer(_0x17b89c[_0xbf04('0x28')]+':X')[_0xbf04('0x29')](_0xbf04('0x2a')));}function getServerInfo(_0x3ac8c8){return request({'form':{'method':_0xbf04('0x2b'),'input_type':_0xbf04('0x2c'),'response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x3ac8c8['id']})}});}function getUser(_0x580e1a,_0x55fb23,_0x15463d){if(!_['isNil'](_0x55fb23)){logger[_0xbf04('0xd')]('Getting\x20agent\x20with\x20name',_0x55fb23);return request({'form':{'method':_0xbf04('0x2d'),'input_type':'JSON','response_type':_0xbf04('0x2c'),'rest_data':JSON['stringify']({'session':_0x15463d['id'],'module_name':'Employees','query':util[_0xbf04('0x26')](_0xbf04('0x2e'),_0x55fb23),'order_by':'','offset':'0','select_fields':['id','name',_0xbf04('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf04('0x30')](function(_0xe35f29){if(_0xe35f29[_0xbf04('0x31')][_0xbf04('0x20')]){var _0x43edfc=_[_0xbf04('0x32')](_0xe35f29[_0xbf04('0x31')],function(_0x831ef3){return _0x831ef3[_0xbf04('0x33')][_0xbf04('0x2f')][_0xbf04('0x34')]===_0x55fb23;});if(_0x43edfc){logger[_0xbf04('0xd')](_0xbf04('0x35'));return BPromise['resolve']({'id':_0x43edfc['name_value_list']['id']['value'],'name':_0x43edfc[_0xbf04('0x33')]['name'][_0xbf04('0x34')]});}}logger[_0xbf04('0xd')](_0xbf04('0x36'));return BPromise['resolve']({'id':_0x15463d['name_value_list'][_0xbf04('0x37')][_0xbf04('0x34')],'name':_0x15463d[_0xbf04('0x33')]['user_name']['value']});});}else{logger[_0xbf04('0xd')](_0xbf04('0x38'));return BPromise[_0xbf04('0x39')]({'id':_0x15463d[_0xbf04('0x33')]['user_id'][_0xbf04('0x34')],'name':_0x15463d[_0xbf04('0x33')][_0xbf04('0x2f')][_0xbf04('0x34')]});}}function getEndUser(_0x55a855,_0x2c9bbd,_0x4901d1,_0x26192c){logger[_0xbf04('0xd')](_0xbf04('0x3a'),_0x4901d1);return request({'form':{'method':_0xbf04('0x2d'),'input_type':_0xbf04('0x2c'),'response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'session':_0x26192c['id'],'module_name':_0xbf04('0x1d'),'query':util['format'](_0xbf04('0x3b'),_0x4901d1),'order_by':'','offset':'0','select_fields':['id',_0xbf04('0xf'),_0xbf04('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbf04('0x30')](function(_0x2e15f6){if(_0x2e15f6[_0xbf04('0x31')][_0xbf04('0x20')]){var _0x5a59eb=_[_0xbf04('0x32')](_0x2e15f6[_0xbf04('0x31')],function(_0x562e9f){return _0x562e9f[_0xbf04('0x33')][_0xbf04('0x3c')][_0xbf04('0x34')]===_0x4901d1;});if(_0x5a59eb){logger[_0xbf04('0xd')](_0xbf04('0x3d'));return BPromise[_0xbf04('0x39')]({'id':_0x5a59eb[_0xbf04('0x33')]['id'][_0xbf04('0x34')],'name':_0x5a59eb['name_value_list'][_0xbf04('0xf')][_0xbf04('0x34')],'phone':_0x5a59eb[_0xbf04('0x33')]['phone_home'][_0xbf04('0x34')]});}}else{logger['info'](_0xbf04('0x3e'));return request({'form':{'method':_0xbf04('0x3f'),'input_type':'JSON','response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'session':_0x26192c['id'],'module_name':_0xbf04('0x1d'),'name_value_list':[{'name':_0xbf04('0x40'),'value':_0x2c9bbd!==_0xbf04('0x41')?_0x2c9bbd:util[_0xbf04('0x26')](_0xbf04('0x42'),_0x4901d1)},{'name':_0xbf04('0x3c'),'value':_0x4901d1}]})}})['then'](function(_0x3df977){logger[_0xbf04('0xd')](_0xbf04('0x43'));return BPromise['resolve']({'id':_0x3df977['id'],'name':_0x3df977[_0xbf04('0x31')][_0xbf04('0x40')][_0xbf04('0x34')],'phone':_0x3df977[_0xbf04('0x31')][_0xbf04('0x3c')][_0xbf04('0x34')]});});}});}function request(_0x3aba6d){logger[_0xbf04('0x44')](_0xbf04('0x45'),JSON['stringify'](_0x3aba6d));return rp(_[_0xbf04('0x46')](def,_0x3aba6d));}function getTags(_0x58bc40,_0x1d6292){var _0xe156c9=[];if(_0x58bc40&&_0x58bc40[_0xbf04('0x20')]>0x0){_0xe156c9=_[_0xbf04('0x47')](_0x58bc40,_0x1d6292);}return _0xe156c9;}function getCustomFields(_0x4ab00e,_0x3dba07){var _0x2c9647=[];var _0x284579={'custom_fields':[]};if(_0x4ab00e[_0xbf04('0x20')]>0x0){_[_0xbf04('0x21')](_0x4ab00e,function(_0x451342){if(_0x451342['type']==='string'&&_0x451342[_0xbf04('0x48')]&&!_0x451342[_0xbf04('0x49')]){_0x284579[_0x451342[_0xbf04('0x48')][_0xbf04('0x4a')]()]=_0x451342[_0xbf04('0x4b')][_0xbf04('0x29')]();}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x4d')&&_0x451342[_0xbf04('0x23')]&&_0x451342['customField']){_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342[_0xbf04('0x23')],'value':_0x451342['content']['toString']()});}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x4f')&&_0x451342['variableName']&&_0x451342[_0xbf04('0x23')]&&_0x451342[_0xbf04('0x49')]){_0x3dba07[_0x451342[_0xbf04('0x50')]]&&_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342[_0xbf04('0x23')],'value':_0x3dba07[_0x451342[_0xbf04('0x50')]][_0xbf04('0x29')]()});}else if(_0x451342[_0xbf04('0x4c')]===_0xbf04('0x51')&&_0x451342['Variable']&&_0x451342[_0xbf04('0x52')]['name']&&_0x451342[_0xbf04('0x23')]&&_0x451342[_0xbf04('0x49')]){_0x3dba07[_0x451342['Variable'][_0xbf04('0xf')][_0xbf04('0x4a')]()]&&_0x284579[_0xbf04('0x4e')][_0xbf04('0x22')]({'id':_0x451342['idField'],'value':_0x3dba07[_0x451342[_0xbf04('0x52')][_0xbf04('0xf')][_0xbf04('0x4a')]()]['toString']()});}});}return _0x284579;}function getConnection(_0x512b79){return request({'method':_0xbf04('0xb'),'form':{'method':_0xbf04('0x53'),'input_type':_0xbf04('0x2c'),'response_type':_0xbf04('0x2c'),'rest_data':JSON[_0xbf04('0x24')]({'user_auth':{'user_name':_0x512b79[_0xbf04('0x54')],'password':_0x512b79[_0xbf04('0x55')],'encryption':_0xbf04('0x56')},'application':_0xbf04('0x57')})}})[_0xbf04('0x30')](function(_0xacb340){var _0x1b6710=_0xacb340;if(_0x1b6710['id']){def[_0xbf04('0x58')]=_0x1b6710['id'];return BPromise[_0xbf04('0x39')](_0x1b6710);}else{throw new Error(util[_0xbf04('0x26')](_0xbf04('0x59'),_0x512b79['id']));}});}function setRelationship(_0x8e2a22,_0x4df133,_0x4731b8,_0x57460e){return request({'form':{'method':_0xbf04('0x5a'),'input_type':_0xbf04('0x2c'),'response_type':'JSON','rest_data':JSON[_0xbf04('0x24')]({'session':_0x8e2a22['id'],'module_name':_0xbf04('0x25'),'module_id':_0x4731b8['id'],'link_field_name':_0x57460e,'related_ids':[_0x4df133['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3fde1b,_0x3b1e0e,_0x2b5a17,_0x57a315,_0xa32f0f,_0x5d0230){var _0x3b702d,_0x4bc663,_0x4e62a1,_0x2610d0;_0x5d0230[_0xbf04('0x5b')]=intUtil[_0xbf04('0x5c')](_0x5d0230[_0xbf04('0x5b')]);_0x5d0230[_0xbf04('0x5d')]=intUtil[_0xbf04('0x5c')](_0x5d0230[_0xbf04('0x5d')]);def['uri']=util[_0xbf04('0x26')](_0xbf04('0x5e'),_0x5d0230['remoteUri']);if(_0xa32f0f&&_0xa32f0f[_0xbf04('0x5f')]){logger[_0xbf04('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b1e0e['recordingURL']=util[_0xbf04('0x26')](_0xbf04('0x60'),_0x5d0230[_0xbf04('0x5d')],_0x3b1e0e['uniqueid'],md5(_0x3b1e0e[_0xbf04('0x61')]));}else{_0x3b1e0e[_0xbf04('0x62')]='';}return getConnection(_0x5d0230)[_0xbf04('0x30')](function(_0x57cdbf){_0x2610d0=_0x57cdbf;return getUser(_0x5d0230,_0x57a315[_0xbf04('0xf')],_0x2610d0);})[_0xbf04('0x30')](function(_0x7b485a){_0x3b702d=_0x7b485a;logger[_0xbf04('0xd')](_0xbf04('0x63'),_0x3b702d['id']);return getEndUser(_0x5d0230,_0x3b1e0e[_0xbf04('0x64')],_0x3b1e0e[_0xbf04('0x65')],_0x2610d0);})[_0xbf04('0x30')](function(_0x47e566){_0x4bc663=_0x47e566;logger['info'](_0xbf04('0x66'),_0x4bc663['id']);return getTicket(_0x5d0230,_0x3b702d,_0x4bc663,_0x2b5a17,_0x3b1e0e,_0x2b5a17[_0xbf04('0x67')],_0x2610d0,_0xbf04('0x68'));})[_0xbf04('0x30')](function(_0x3ed482){_0x4e62a1=_0x3ed482;logger[_0xbf04('0xd')](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4e62a1['id']);return setRelationship(_0x2610d0,_0x3b702d,_0x4e62a1,'users');})[_0xbf04('0x30')](function(){return setRelationship(_0x2610d0,_0x4bc663,_0x4e62a1,'contacts');})['then'](function(){return getServerInfo(_0x2610d0);})['then'](function(_0x11ce78){var _0x5e9128=parseInt(_0x11ce78[_0xbf04('0x6a')][_0xbf04('0x6b')](0x0));var _0xd09e9d=util['format'](_0xbf04('0x6c'),_0x5d0230[_0xbf04('0x5b')],_0x4e62a1['id']);if(_0x5e9128>0x6){_0xd09e9d=util[_0xbf04('0x26')](_0xbf04('0x6d'),_0x5d0230['remoteUri'],_0x4e62a1['id']);}logger['info'](_0xbf04('0x6e'),_0xbf04('0x6f'));emit(util['format'](_0xbf04('0x70'),_0x57a315[_0xbf04('0xf')]),_0xbf04('0x71'),{'uri':_0xd09e9d});})['catch'](function(_0x17febd){logger[_0xbf04('0x72')](_0xbf04('0x6e'),JSON[_0xbf04('0x24')](_0x17febd));});};exports[_0xbf04('0x73')]=function(_0x1a2c0c,_0x1e28b8,_0x378c85,_0x5e7634,_0x595607,_0x4dc7fc,_0x5a120c){var _0x4ddf70,_0x4657d5,_0xd75d41,_0x22adb8;_0x4dc7fc[_0xbf04('0x5b')]=intUtil['stripTrailingSlash'](_0x4dc7fc[_0xbf04('0x5b')]);_0x4dc7fc['serverUrl']=intUtil[_0xbf04('0x5c')](_0x4dc7fc[_0xbf04('0x5d')]);def[_0xbf04('0x74')]=util['format'](_0xbf04('0x5e'),_0x4dc7fc['remoteUri']);if(_0x5a120c&&_0x5a120c[_0xbf04('0x75')]&&_0x5a120c['recordingFormat']!=='none'){logger['info'](_0xbf04('0x76'),'Recording\x20is\x20enabled!');_0x1e28b8[_0xbf04('0x62')]=util[_0xbf04('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dc7fc[_0xbf04('0x5d')],_0x1e28b8[_0xbf04('0x61')],md5(_0x1e28b8[_0xbf04('0x61')]));}return getConnection(_0x4dc7fc)[_0xbf04('0x30')](function(_0x55dfd3){_0x22adb8=_0x55dfd3;return getUser(_0x4dc7fc,_0x5e7634[_0xbf04('0xf')],_0x22adb8);})[_0xbf04('0x30')](function(_0x56667a){_0x4ddf70=_0x56667a;logger['info'](_0xbf04('0x63'),_0x4ddf70['id']);return getEndUser(_0x4dc7fc,_0x1e28b8[_0xbf04('0x77')],_0x1e28b8[_0xbf04('0x78')],_0x22adb8);})[_0xbf04('0x30')](function(_0x4fd13c){_0x4657d5=_0x4fd13c;logger[_0xbf04('0xd')](_0xbf04('0x66'),_0x4657d5['id']);return getTicket(_0x4dc7fc,_0x4ddf70,_0x4657d5,_0x378c85,_0x1e28b8,_0x378c85[_0xbf04('0x67')],_0x22adb8,_0xbf04('0x79'));})[_0xbf04('0x30')](function(_0x13f77d){_0xd75d41=_0x13f77d;logger[_0xbf04('0xd')](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0xd75d41['id']);return setRelationship(_0x22adb8,_0x4ddf70,_0xd75d41,_0xbf04('0x7a'));})[_0xbf04('0x30')](function(){return setRelationship(_0x22adb8,_0x4657d5,_0xd75d41,_0xbf04('0x7b'));})[_0xbf04('0x30')](function(){return getServerInfo(_0x22adb8);})['then'](function(_0x1934aa){var _0x2803ce=parseInt(_0x1934aa[_0xbf04('0x6a')][_0xbf04('0x6b')](0x0));var _0x2bf923=util['format'](_0xbf04('0x6c'),_0x4dc7fc[_0xbf04('0x5b')],_0xd75d41['id']);if(_0x2803ce>0x6){_0x2bf923=util[_0xbf04('0x26')](_0xbf04('0x6d'),_0x4dc7fc['remoteUri'],_0xd75d41['id']);}logger[_0xbf04('0xd')](_0xbf04('0x76'),_0xbf04('0x6f'));emit(util[_0xbf04('0x26')](_0xbf04('0x70'),_0x5e7634[_0xbf04('0xf')]),_0xbf04('0x71'),{'uri':_0x2bf923});})[_0xbf04('0x7c')](function(_0x3c153e){logger[_0xbf04('0x72')](_0xbf04('0x76'),JSON[_0xbf04('0x24')](_0x3c153e));});};exports[_0xbf04('0x7d')]=function(_0x35a97e,_0x4ef81f,_0x25eebc,_0x27d657,_0x37fb56,_0x2b5e02){var _0x1b5693,_0x40fa2d,_0x4326ed,_0x2f4d94;_0x2b5e02['remoteUri']=intUtil[_0xbf04('0x5c')](_0x2b5e02[_0xbf04('0x5b')]);_0x2b5e02[_0xbf04('0x5d')]=intUtil[_0xbf04('0x5c')](_0x2b5e02[_0xbf04('0x5d')]);def['uri']=util[_0xbf04('0x26')]('%s/service/v4_1/rest.php',_0x2b5e02[_0xbf04('0x5b')]);if(_0x37fb56&&_0x37fb56[_0xbf04('0x5f')]){logger[_0xbf04('0xd')]('['+_0x4ef81f[_0xbf04('0x7e')][_0xbf04('0x7f')]()+']',_0xbf04('0x80'));_0x4ef81f[_0xbf04('0x62')]=util[_0xbf04('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b5e02[_0xbf04('0x5d')],_0x4ef81f[_0xbf04('0x61')],md5(_0x4ef81f['uniqueid']));}else{_0x4ef81f[_0xbf04('0x62')]='';}return getConnection(_0x2b5e02)[_0xbf04('0x30')](function(_0x19ed5e){_0x2f4d94=_0x19ed5e;if(!_[_0xbf04('0x81')](_0x27d657)){return getUser(_0x2b5e02,_0x27d657['name'],_0x2f4d94);}else{return getUser(_0x2b5e02,null,_0x2f4d94);}})[_0xbf04('0x30')](function(_0xfbe2a1){_0x1b5693=_0xfbe2a1;logger[_0xbf04('0xd')](_0xbf04('0x63'),_0x1b5693['id']);return getEndUser(_0x2b5e02,_0x4ef81f['calleridname'],_0x4ef81f[_0xbf04('0x65')],_0x2f4d94);})[_0xbf04('0x30')](function(_0x405f87){_0x40fa2d=_0x405f87;logger[_0xbf04('0xd')](_0xbf04('0x66'),_0x40fa2d['id']);return getTicket(_0x2b5e02,_0x1b5693,_0x40fa2d,_0x25eebc,_0x4ef81f,_0x25eebc[_0xbf04('0x67')],_0x2f4d94,'Inbound');})[_0xbf04('0x30')](function(_0x5b379a){_0x4326ed=_0x5b379a;logger['info'](_0xbf04('0x69'));logger[_0xbf04('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4326ed['id']);return setRelationship(_0x2f4d94,_0x1b5693,_0x4326ed,_0xbf04('0x7a'));})[_0xbf04('0x30')](function(){return setRelationship(_0x2f4d94,_0x40fa2d,_0x4326ed,_0xbf04('0x7b'));})['then'](function(){return getServerInfo(_0x2f4d94);})['catch'](function(_0x264c11){logger['error']('['+_0x4ef81f['lastevent'][_0xbf04('0x7f')]()+']',JSON[_0xbf04('0x24')](_0x264c11));});}; \ No newline at end of file +var _0x6247=['PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','uri','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','Fields','contacts','catch','[OUTBOUND]','unmanaged','monitor_format','recordingURL','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','set_entry','','Caller\x20-\x20%s','first_name','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','password'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6247,0x120));var _0x7624=function(_0xbf286a,_0x127ac9){_0xbf286a=_0xbf286a-0x0;var _0x513b39=_0x6247[_0xbf286a];return _0x513b39;};'use strict';var _=require(_0x7624('0x0'));var rp=require('request-promise');var BPromise=require(_0x7624('0x1'));var md5=require(_0x7624('0x2'));var util=require(_0x7624('0x3'));var Redis=require(_0x7624('0x4'));var intUtil=require(_0x7624('0x5'));var config=require(_0x7624('0x6'));var logger=require(_0x7624('0x7'))('sugarcrm');config[_0x7624('0x8')]=_[_0x7624('0x9')](config[_0x7624('0x8')],{'host':_0x7624('0xa'),'port':0x18eb});var io=require(_0x7624('0xb'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x5e34f1,_0x17894e,_0x14ad6a){io['to'](_0x5e34f1)[_0x7624('0xc')](_0x17894e,_0x14ad6a);}function getTicket(_0x3084a2,_0x4f8ac6,_0x2fc65e,_0x4af6af,_0x162837,_0x314a2b,_0x52b493,_0x50c2f3){logger[_0x7624('0xd')]('Creating\x20new\x20ticket...');var _0x5688ae=new Date();var _0x28330c=[{'name':_0x7624('0xe'),'value':intUtil[_0x7624('0xf')](_0x4af6af[_0x7624('0x10')],_0x162837,'\x20')},{'name':_0x7624('0x11'),'value':_0x4f8ac6['id']},{'name':_0x7624('0x12'),'value':_0x4f8ac6['id']},{'name':_0x7624('0x13'),'value':intUtil[_0x7624('0xf')](_0x4af6af['Descriptions'],_0x162837,'\x0a')},{'name':_0x7624('0x14'),'value':_0x5688ae['toISOString']()[_0x7624('0x15')](0x0,0x13)[_0x7624('0x16')]('T','\x20')},{'name':_0x7624('0x17'),'value':'0'},{'name':_0x7624('0x18'),'value':'15'},{'name':_0x7624('0x19'),'value':_0x2fc65e['id']},{'name':'parent_type','value':_0x7624('0x1a')},{'name':_0x7624('0x1b'),'value':_0x2fc65e[_0x7624('0xe')]},{'name':_0x7624('0x1c'),'value':_0x50c2f3}];if(_0x314a2b[_0x7624('0x1d')]){_[_0x7624('0x1e')](_0x314a2b,function(_0x56f798){if(_0x162837[_0x56f798[_0x7624('0x1f')]]){_0x28330c[_0x7624('0x20')]({'name':_0x56f798[_0x7624('0x21')],'value':_0x162837[_0x56f798[_0x7624('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x7624('0x22'),'response_type':'JSON','rest_data':JSON[_0x7624('0x23')]({'session':_0x52b493['id'],'module_name':_0x7624('0x24'),'name_value_list':_0x28330c})}});}function getAuth(_0x39d13b){return util['format'](_0x7624('0x25'),new Buffer(_0x39d13b[_0x7624('0x26')]+':X')[_0x7624('0x27')]('base64'));}function getServerInfo(_0x295a9b){return request({'form':{'method':_0x7624('0x28'),'input_type':_0x7624('0x22'),'response_type':_0x7624('0x22'),'rest_data':JSON[_0x7624('0x23')]({'session':_0x295a9b['id']})}});}function getUser(_0x48cfec,_0x44267d,_0x33293d){if(!_[_0x7624('0x29')](_0x44267d)){logger[_0x7624('0xd')](_0x7624('0x2a'),_0x44267d);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7624('0x23')]({'session':_0x33293d['id'],'module_name':_0x7624('0x2b'),'query':util[_0x7624('0x2c')](_0x7624('0x2d'),_0x44267d),'order_by':'','offset':'0','select_fields':['id',_0x7624('0xe'),_0x7624('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7624('0x2f')](function(_0x331ca3){if(_0x331ca3[_0x7624('0x30')][_0x7624('0x1d')]){var _0x1b7e61=_['find'](_0x331ca3[_0x7624('0x30')],function(_0x45df11){return _0x45df11[_0x7624('0x31')][_0x7624('0x2e')]['value']===_0x44267d;});if(_0x1b7e61){logger[_0x7624('0xd')](_0x7624('0x32'));return BPromise[_0x7624('0x33')]({'id':_0x1b7e61['name_value_list']['id'][_0x7624('0x34')],'name':_0x1b7e61['name_value_list'][_0x7624('0xe')][_0x7624('0x34')]});}}logger[_0x7624('0xd')](_0x7624('0x35'));return BPromise['resolve']({'id':_0x33293d['name_value_list'][_0x7624('0x36')][_0x7624('0x34')],'name':_0x33293d[_0x7624('0x31')][_0x7624('0x2e')][_0x7624('0x34')]});});}else{logger[_0x7624('0xd')](_0x7624('0x37'));return BPromise[_0x7624('0x33')]({'id':_0x33293d[_0x7624('0x31')][_0x7624('0x36')]['value'],'name':_0x33293d['name_value_list']['user_name'][_0x7624('0x34')]});}}function getEndUser(_0x5d3f8e,_0x538c8a,_0x4969cf,_0x315b4e){logger[_0x7624('0xd')](_0x7624('0x38'),_0x4969cf);return request({'form':{'method':_0x7624('0x39'),'input_type':'JSON','response_type':_0x7624('0x22'),'rest_data':JSON[_0x7624('0x23')]({'session':_0x315b4e['id'],'module_name':_0x7624('0x1a'),'query':util[_0x7624('0x2c')](_0x7624('0x3a'),_0x4969cf),'order_by':'','offset':'0','select_fields':['id',_0x7624('0xe'),_0x7624('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7624('0x2f')](function(_0x1a1413){if(_0x1a1413[_0x7624('0x30')][_0x7624('0x1d')]){var _0x4bbdcf=_[_0x7624('0x3c')](_0x1a1413[_0x7624('0x30')],function(_0x14a18a){return _0x14a18a[_0x7624('0x31')][_0x7624('0x3b')]['value']===_0x4969cf;});if(_0x4bbdcf){logger[_0x7624('0xd')](_0x7624('0x3d'));return BPromise[_0x7624('0x33')]({'id':_0x4bbdcf[_0x7624('0x31')]['id'][_0x7624('0x34')],'name':_0x4bbdcf[_0x7624('0x31')][_0x7624('0xe')][_0x7624('0x34')],'phone':_0x4bbdcf[_0x7624('0x31')]['phone_home'][_0x7624('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x7624('0x3e'),'input_type':_0x7624('0x22'),'response_type':_0x7624('0x22'),'rest_data':JSON[_0x7624('0x23')]({'session':_0x315b4e['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x538c8a!==_0x7624('0x3f')?_0x538c8a:util[_0x7624('0x2c')](_0x7624('0x40'),_0x4969cf)},{'name':_0x7624('0x3b'),'value':_0x4969cf}]})}})['then'](function(_0xfd9dad){logger[_0x7624('0xd')]('Enduser\x20created.');return BPromise[_0x7624('0x33')]({'id':_0xfd9dad['id'],'name':_0xfd9dad[_0x7624('0x30')][_0x7624('0x41')][_0x7624('0x34')],'phone':_0xfd9dad[_0x7624('0x30')]['phone_home'][_0x7624('0x34')]});});}});}function request(_0x55f640){logger['debug'](_0x7624('0x42'),JSON['stringify'](_0x55f640));return rp(_[_0x7624('0x43')](def,_0x55f640));}function getTags(_0xabb874,_0x31bfb0){var _0x1e6f03=[];if(_0xabb874&&_0xabb874['length']>0x0){_0x1e6f03=_[_0x7624('0x44')](_0xabb874,_0x31bfb0);}return _0x1e6f03;}function getCustomFields(_0x2de708,_0x1f6cb4){var _0x5c9ad1=[];var _0x9aadd0={'custom_fields':[]};if(_0x2de708[_0x7624('0x1d')]>0x0){_[_0x7624('0x1e')](_0x2de708,function(_0x2a3107){if(_0x2a3107[_0x7624('0x45')]===_0x7624('0x46')&&_0x2a3107[_0x7624('0x47')]&&!_0x2a3107[_0x7624('0x48')]){_0x9aadd0[_0x2a3107['nameField'][_0x7624('0x49')]()]=_0x2a3107[_0x7624('0x4a')][_0x7624('0x27')]();}else if(_0x2a3107[_0x7624('0x45')]===_0x7624('0x46')&&_0x2a3107['idField']&&_0x2a3107[_0x7624('0x48')]){_0x9aadd0[_0x7624('0x4b')][_0x7624('0x20')]({'id':_0x2a3107['idField'],'value':_0x2a3107[_0x7624('0x4a')][_0x7624('0x27')]()});}else if(_0x2a3107[_0x7624('0x45')]==='variable'&&_0x2a3107[_0x7624('0x1f')]&&_0x2a3107[_0x7624('0x21')]&&_0x2a3107[_0x7624('0x48')]){_0x1f6cb4[_0x2a3107[_0x7624('0x1f')]]&&_0x9aadd0[_0x7624('0x4b')][_0x7624('0x20')]({'id':_0x2a3107[_0x7624('0x21')],'value':_0x1f6cb4[_0x2a3107[_0x7624('0x1f')]][_0x7624('0x27')]()});}else if(_0x2a3107[_0x7624('0x45')]===_0x7624('0x4c')&&_0x2a3107[_0x7624('0x4d')]&&_0x2a3107[_0x7624('0x4d')][_0x7624('0xe')]&&_0x2a3107[_0x7624('0x21')]&&_0x2a3107[_0x7624('0x48')]){_0x1f6cb4[_0x2a3107[_0x7624('0x4d')][_0x7624('0xe')][_0x7624('0x49')]()]&&_0x9aadd0[_0x7624('0x4b')][_0x7624('0x20')]({'id':_0x2a3107[_0x7624('0x21')],'value':_0x1f6cb4[_0x2a3107[_0x7624('0x4d')][_0x7624('0xe')][_0x7624('0x49')]()][_0x7624('0x27')]()});}});}return _0x9aadd0;}function getConnection(_0x171258){return request({'method':'POST','form':{'method':_0x7624('0x4e'),'input_type':_0x7624('0x22'),'response_type':_0x7624('0x22'),'rest_data':JSON[_0x7624('0x23')]({'user_auth':{'user_name':_0x171258[_0x7624('0x4f')],'password':_0x171258[_0x7624('0x50')],'encryption':_0x7624('0x51')},'application':_0x7624('0x52')})}})[_0x7624('0x2f')](function(_0x55d68f){var _0x364ab3=_0x55d68f;if(_0x364ab3['id']){def[_0x7624('0x53')]=_0x364ab3['id'];return BPromise[_0x7624('0x33')](_0x364ab3);}else{throw new Error(util[_0x7624('0x2c')]('Account\x20%d\x20is\x20not\x20valid',_0x171258['id']));}});}function setRelationship(_0x6c6781,_0x5bab7b,_0xe0ff82,_0x2103c7){return request({'form':{'method':_0x7624('0x54'),'input_type':_0x7624('0x22'),'response_type':'JSON','rest_data':JSON[_0x7624('0x23')]({'session':_0x6c6781['id'],'module_name':_0x7624('0x24'),'module_id':_0xe0ff82['id'],'link_field_name':_0x2103c7,'related_ids':[_0x5bab7b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7624('0x55')]=function(_0x18c2fc,_0x41e8c1,_0x6783f4,_0x1a9e23,_0x1b1834,_0x25599b){var _0x2dad7b,_0x50e8a0,_0xaa4bb6,_0x425884;_0x25599b['remoteUri']=intUtil[_0x7624('0x56')](_0x25599b[_0x7624('0x57')]);_0x25599b[_0x7624('0x58')]=intUtil['stripTrailingSlash'](_0x25599b[_0x7624('0x58')]);def['uri']=util[_0x7624('0x2c')](_0x7624('0x59'),_0x25599b[_0x7624('0x57')]);if(_0x1b1834&&_0x1b1834['monitor_format']){logger[_0x7624('0xd')](_0x7624('0x5a'),_0x7624('0x5b'));_0x41e8c1['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25599b[_0x7624('0x58')],_0x41e8c1[_0x7624('0x5c')],md5(_0x41e8c1[_0x7624('0x5c')]));}else{_0x41e8c1['recordingURL']='';}return getConnection(_0x25599b)['then'](function(_0x3c2379){_0x425884=_0x3c2379;return getUser(_0x25599b,_0x1a9e23['name'],_0x425884);})[_0x7624('0x2f')](function(_0x20ec21){_0x2dad7b=_0x20ec21;logger[_0x7624('0xd')]('The\x20User\x20ID\x20is:',_0x2dad7b['id']);return getEndUser(_0x25599b,_0x41e8c1[_0x7624('0x5d')],_0x41e8c1[_0x7624('0x5e')],_0x425884);})[_0x7624('0x2f')](function(_0x1ca87f){_0x50e8a0=_0x1ca87f;logger['info'](_0x7624('0x5f'),_0x50e8a0['id']);return getTicket(_0x25599b,_0x2dad7b,_0x50e8a0,_0x6783f4,_0x41e8c1,_0x6783f4['Fields'],_0x425884,_0x7624('0x60'));})[_0x7624('0x2f')](function(_0x1c5f1a){_0xaa4bb6=_0x1c5f1a;logger[_0x7624('0xd')](_0x7624('0x61'));logger[_0x7624('0xd')](_0x7624('0x62'),_0xaa4bb6['id']);return setRelationship(_0x425884,_0x2dad7b,_0xaa4bb6,_0x7624('0x63'));})[_0x7624('0x2f')](function(){return setRelationship(_0x425884,_0x50e8a0,_0xaa4bb6,'contacts');})[_0x7624('0x2f')](function(){return getServerInfo(_0x425884);})[_0x7624('0x2f')](function(_0x52161f){var _0x3bb347=parseInt(_0x52161f[_0x7624('0x64')][_0x7624('0x65')](0x0));var _0x24a689=util[_0x7624('0x2c')](_0x7624('0x66'),_0x25599b[_0x7624('0x57')],_0xaa4bb6['id']);if(_0x3bb347>0x6){_0x24a689=util['format'](_0x7624('0x67'),_0x25599b[_0x7624('0x57')],_0xaa4bb6['id']);}logger['info'](_0x7624('0x5a'),_0x7624('0x68'));emit(util['format'](_0x7624('0x69'),_0x1a9e23[_0x7624('0xe')]),_0x7624('0x6a'),{'uri':_0x24a689});})['catch'](function(_0x271607){logger[_0x7624('0x6b')]('[QUEUE]',JSON['stringify'](_0x271607));});};exports['outbound']=function(_0x12eca3,_0x52896,_0x39a489,_0x55c69b,_0x53cf65,_0x40bef8,_0x4dc876){var _0x342ac5,_0x294c86,_0x5de24f,_0x1b3be9;_0x40bef8[_0x7624('0x57')]=intUtil['stripTrailingSlash'](_0x40bef8[_0x7624('0x57')]);_0x40bef8['serverUrl']=intUtil[_0x7624('0x56')](_0x40bef8['serverUrl']);def[_0x7624('0x6c')]=util[_0x7624('0x2c')]('%s/service/v4_1/rest.php',_0x40bef8[_0x7624('0x57')]);if(_0x4dc876&&_0x4dc876[_0x7624('0x6d')]&&_0x4dc876[_0x7624('0x6d')]!==_0x7624('0x6e')){logger[_0x7624('0xd')]('[OUTBOUND]',_0x7624('0x5b'));_0x52896['recordingURL']=util['format'](_0x7624('0x6f'),_0x40bef8[_0x7624('0x58')],_0x52896[_0x7624('0x5c')],md5(_0x52896[_0x7624('0x5c')]));}return getConnection(_0x40bef8)[_0x7624('0x2f')](function(_0x1e6a33){_0x1b3be9=_0x1e6a33;return getUser(_0x40bef8,_0x55c69b['name'],_0x1b3be9);})[_0x7624('0x2f')](function(_0x5772a1){_0x342ac5=_0x5772a1;logger['info'](_0x7624('0x70'),_0x342ac5['id']);return getEndUser(_0x40bef8,_0x52896['destcalleridname'],_0x52896[_0x7624('0x71')],_0x1b3be9);})[_0x7624('0x2f')](function(_0x491186){_0x294c86=_0x491186;logger['info'](_0x7624('0x5f'),_0x294c86['id']);return getTicket(_0x40bef8,_0x342ac5,_0x294c86,_0x39a489,_0x52896,_0x39a489[_0x7624('0x72')],_0x1b3be9,'Outbound');})[_0x7624('0x2f')](function(_0x3b08b7){_0x5de24f=_0x3b08b7;logger[_0x7624('0xd')](_0x7624('0x61'));logger['info'](_0x7624('0x62'),_0x5de24f['id']);return setRelationship(_0x1b3be9,_0x342ac5,_0x5de24f,_0x7624('0x63'));})[_0x7624('0x2f')](function(){return setRelationship(_0x1b3be9,_0x294c86,_0x5de24f,_0x7624('0x73'));})['then'](function(){return getServerInfo(_0x1b3be9);})[_0x7624('0x2f')](function(_0x334976){var _0x16b173=parseInt(_0x334976['version'][_0x7624('0x65')](0x0));var _0x297288=util['format'](_0x7624('0x66'),_0x40bef8[_0x7624('0x57')],_0x5de24f['id']);if(_0x16b173>0x6){_0x297288=util[_0x7624('0x2c')](_0x7624('0x67'),_0x40bef8['remoteUri'],_0x5de24f['id']);}logger[_0x7624('0xd')]('[OUTBOUND]',_0x7624('0x68'));emit(util[_0x7624('0x2c')]('user:%s',_0x55c69b[_0x7624('0xe')]),_0x7624('0x6a'),{'uri':_0x297288});})[_0x7624('0x74')](function(_0x569bf5){logger[_0x7624('0x6b')](_0x7624('0x75'),JSON[_0x7624('0x23')](_0x569bf5));});};exports[_0x7624('0x76')]=function(_0x3c08df,_0x4965c9,_0x683066,_0x4295b3,_0x2eb49c,_0x1d7e04){var _0x387fe4,_0x1cb223,_0x110c82,_0xc9f3f1;_0x1d7e04[_0x7624('0x57')]=intUtil[_0x7624('0x56')](_0x1d7e04[_0x7624('0x57')]);_0x1d7e04[_0x7624('0x58')]=intUtil[_0x7624('0x56')](_0x1d7e04[_0x7624('0x58')]);def[_0x7624('0x6c')]=util[_0x7624('0x2c')]('%s/service/v4_1/rest.php',_0x1d7e04['remoteUri']);if(_0x2eb49c&&_0x2eb49c[_0x7624('0x77')]){logger['info']('['+_0x4965c9['lastevent']['toUpperCase']()+']',_0x7624('0x5b'));_0x4965c9[_0x7624('0x78')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d7e04['serverUrl'],_0x4965c9[_0x7624('0x5c')],md5(_0x4965c9[_0x7624('0x5c')]));}else{_0x4965c9[_0x7624('0x78')]='';}return getConnection(_0x1d7e04)[_0x7624('0x2f')](function(_0xd6ed26){_0xc9f3f1=_0xd6ed26;if(!_[_0x7624('0x29')](_0x4295b3)){return getUser(_0x1d7e04,_0x4295b3[_0x7624('0xe')],_0xc9f3f1);}else{return getUser(_0x1d7e04,null,_0xc9f3f1);}})[_0x7624('0x2f')](function(_0x503322){_0x387fe4=_0x503322;logger[_0x7624('0xd')](_0x7624('0x70'),_0x387fe4['id']);return getEndUser(_0x1d7e04,_0x4965c9[_0x7624('0x5d')],_0x4965c9[_0x7624('0x5e')],_0xc9f3f1);})[_0x7624('0x2f')](function(_0x988f68){_0x1cb223=_0x988f68;logger[_0x7624('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1cb223['id']);return getTicket(_0x1d7e04,_0x387fe4,_0x1cb223,_0x683066,_0x4965c9,_0x683066[_0x7624('0x72')],_0xc9f3f1,_0x7624('0x60'));})[_0x7624('0x2f')](function(_0x347ea){_0x110c82=_0x347ea;logger[_0x7624('0xd')](_0x7624('0x61'));logger[_0x7624('0xd')](_0x7624('0x62'),_0x110c82['id']);return setRelationship(_0xc9f3f1,_0x387fe4,_0x110c82,_0x7624('0x63'));})[_0x7624('0x2f')](function(){return setRelationship(_0xc9f3f1,_0x1cb223,_0x110c82,_0x7624('0x73'));})[_0x7624('0x2f')](function(){return getServerInfo(_0xc9f3f1);})[_0x7624('0x74')](function(_0x7bdd70){logger[_0x7624('0x6b')]('['+_0x4965c9[_0x7624('0x79')][_0x7624('0x7a')]()+']',JSON[_0x7624('0x23')](_0x7bdd70));});}; \ 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 2dff77c..5dcf782 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 _0x1c10=['key','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','length','sortBy','type','string','push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1c10,0x185));var _0x01c1=function(_0x1daa7f,_0x190ab7){_0x1daa7f=_0x1daa7f-0x0;var _0x40acff=_0x1c10[_0x1daa7f];return _0x40acff;};'use strict';var _=require(_0x01c1('0x0'));var util=require(_0x01c1('0x1'));exports['getString']=function(_0x148404,_0x2a8600,_0x791c){var _0x26e669=[];if(_0x148404[_0x01c1('0x2')]>0x0){var _0x16bfd3=_[_0x01c1('0x3')](_0x148404,['id']);for(var _0x123edd=0x0;_0x123edd<_0x16bfd3[_0x01c1('0x2')];_0x123edd++){var _0x11070f=_0x16bfd3[_0x123edd];if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0x5')){_0x26e669[_0x01c1('0x6')](_0x11070f[_0x01c1('0x7')]);}else if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0x8')&&_0x11070f[_0x01c1('0x9')]){_0x2a8600[_0x11070f[_0x01c1('0x9')]]&&_0x26e669[_0x01c1('0x6')](_0x2a8600[_0x11070f['variableName']]['toString']());}else if(_0x11070f[_0x01c1('0x4')]==='customVariable'&&_0x11070f['Variable']&&_0x11070f[_0x01c1('0xa')]['name']){_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')][_0x01c1('0xc')]()]&&_0x26e669[_0x01c1('0x6')](_0x2a8600[_0x11070f['Variable'][_0x01c1('0xb')][_0x01c1('0xc')]()][_0x01c1('0xd')]());}else if(_0x11070f[_0x01c1('0x4')]===_0x01c1('0xe')){if(_0x11070f[_0x01c1('0xf')]===_0x01c1('0x5')&&_0x11070f[_0x01c1('0x10')]){_0x26e669[_0x01c1('0x6')](util['format'](_0x01c1('0x11'),_0x11070f['key'],_0x11070f[_0x01c1('0x12')]));}else if(_0x11070f[_0x01c1('0xf')]==='variable'&&_0x11070f[_0x01c1('0x9')]&&_0x11070f[_0x01c1('0x10')]){_0x2a8600[_0x11070f[_0x01c1('0x9')]]&&_0x26e669['push'](util['format'](_0x01c1('0x11'),_0x11070f['key'],_0x2a8600[_0x11070f[_0x01c1('0x9')]]));}else if(_0x11070f[_0x01c1('0xf')]===_0x01c1('0x13')&&_0x11070f['Variable']&&_0x11070f['Variable'][_0x01c1('0xb')]&&_0x11070f[_0x01c1('0x10')]){_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')]['toLowerCase']()]&&_0x26e669[_0x01c1('0x6')](util['format']('%s:\x20%s',_0x11070f[_0x01c1('0x10')],_0x2a8600[_0x11070f[_0x01c1('0xa')][_0x01c1('0xb')][_0x01c1('0xc')]()]));}}}}return _0x26e669[_0x01c1('0x14')](_0x791c);};exports[_0x01c1('0x15')]=function(_0x264f96){var _0x2cfd57=_0x264f96[_0x01c1('0x16')](-0x1);if(_0x2cfd57==='/'){_0x264f96=_0x264f96[_0x01c1('0x17')](0x0,_0x264f96[_0x01c1('0x18')](_0x2cfd57));}return _0x264f96;};exports[_0x01c1('0x19')]=function(_0x4497bb){if(!_[_0x01c1('0x1a')](_0x4497bb)&&_0x4497bb!==''){var _0x47ac96=/^(([^<>()\[\]\\.,;:\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 _0x47ac96['test'](String(_0x4497bb)[_0x01c1('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x8a79=['validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','variableName','toString','Variable','toLowerCase','name','keyValue','key','format','%s:\x20%s','keyContent','keyType','variable','customVariable','slice','substring','lastIndexOf'];(function(_0x25c518,_0x4ff5bb){var _0x2c85c6=function(_0xa99028){while(--_0xa99028){_0x25c518['push'](_0x25c518['shift']());}};_0x2c85c6(++_0x4ff5bb);}(_0x8a79,0x106));var _0x98a7=function(_0x2af3c8,_0x4c5e1f){_0x2af3c8=_0x2af3c8-0x0;var _0x5ceefd=_0x8a79[_0x2af3c8];return _0x5ceefd;};'use strict';var _=require(_0x98a7('0x0'));var util=require(_0x98a7('0x1'));exports[_0x98a7('0x2')]=function(_0x453a32,_0x930197,_0x5df1bf){var _0x9bc4d0=[];if(_0x453a32[_0x98a7('0x3')]>0x0){var _0x268a07=_[_0x98a7('0x4')](_0x453a32,['id']);for(var _0x4cf23a=0x0;_0x4cf23a<_0x268a07['length'];_0x4cf23a++){var _0x5d8520=_0x268a07[_0x4cf23a];if(_0x5d8520[_0x98a7('0x5')]===_0x98a7('0x6')){_0x9bc4d0[_0x98a7('0x7')](_0x5d8520['content']);}else if(_0x5d8520['type']==='variable'&&_0x5d8520[_0x98a7('0x8')]){_0x930197[_0x5d8520['variableName']]&&_0x9bc4d0['push'](_0x930197[_0x5d8520[_0x98a7('0x8')]][_0x98a7('0x9')]());}else if(_0x5d8520[_0x98a7('0x5')]==='customVariable'&&_0x5d8520[_0x98a7('0xa')]&&_0x5d8520[_0x98a7('0xa')]['name']){_0x930197[_0x5d8520[_0x98a7('0xa')]['name'][_0x98a7('0xb')]()]&&_0x9bc4d0[_0x98a7('0x7')](_0x930197[_0x5d8520[_0x98a7('0xa')][_0x98a7('0xc')][_0x98a7('0xb')]()][_0x98a7('0x9')]());}else if(_0x5d8520[_0x98a7('0x5')]===_0x98a7('0xd')){if(_0x5d8520['keyType']==='string'&&_0x5d8520[_0x98a7('0xe')]){_0x9bc4d0[_0x98a7('0x7')](util[_0x98a7('0xf')](_0x98a7('0x10'),_0x5d8520['key'],_0x5d8520[_0x98a7('0x11')]));}else if(_0x5d8520[_0x98a7('0x12')]===_0x98a7('0x13')&&_0x5d8520[_0x98a7('0x8')]&&_0x5d8520['key']){_0x930197[_0x5d8520['variableName']]&&_0x9bc4d0[_0x98a7('0x7')](util[_0x98a7('0xf')](_0x98a7('0x10'),_0x5d8520[_0x98a7('0xe')],_0x930197[_0x5d8520[_0x98a7('0x8')]]));}else if(_0x5d8520[_0x98a7('0x12')]===_0x98a7('0x14')&&_0x5d8520['Variable']&&_0x5d8520[_0x98a7('0xa')][_0x98a7('0xc')]&&_0x5d8520[_0x98a7('0xe')]){_0x930197[_0x5d8520[_0x98a7('0xa')][_0x98a7('0xc')]['toLowerCase']()]&&_0x9bc4d0[_0x98a7('0x7')](util['format']('%s:\x20%s',_0x5d8520[_0x98a7('0xe')],_0x930197[_0x5d8520['Variable'][_0x98a7('0xc')]['toLowerCase']()]));}}}}return _0x9bc4d0['join'](_0x5df1bf);};exports['stripTrailingSlash']=function(_0x5ee224){var _0x479c39=_0x5ee224[_0x98a7('0x15')](-0x1);if(_0x479c39==='/'){_0x5ee224=_0x5ee224[_0x98a7('0x16')](0x0,_0x5ee224[_0x98a7('0x17')](_0x479c39));}return _0x5ee224;};exports[_0x98a7('0x18')]=function(_0x327cff){if(!_[_0x98a7('0x19')](_0x327cff)&&_0x327cff!==''){var _0x5b1bb9=/^(([^<>()\[\]\\.,;:\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 _0x5b1bb9['test'](String(_0x327cff)[_0x98a7('0xb')]());}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 b4d8c27..926947e 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +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(_0x1a8a43,_0x33e6ea){var _0x285275=function(_0x454791){while(--_0x454791){_0x1a8a43['push'](_0x1a8a43['shift']());}};_0x285275(++_0x33e6ea);}(_0xe706,0xa3));var _0x6e70=function(_0x3ef1dc,_0x210a81){_0x3ef1dc=_0x3ef1dc-0x0;var _0x151f5f=_0xe706[_0x3ef1dc];return _0x151f5f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e8d20b7..79539de 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 _0xd187=['getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','find','results','agent','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','base64','debug','stringify','GET','map','forEach','string','picklist','type','nameField','toLowerCase','toString','includes','customField','custom_fields','content','variableName','idField','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]','user:%s','%s/agent/tickets/%s','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xd187,0xc6));var _0x7d18=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd187[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7d18('0x0'));var rp=require('request-promise');var md5=require(_0x7d18('0x1'));var util=require(_0x7d18('0x2'));var Redis=require(_0x7d18('0x3'));var intUtil=require(_0x7d18('0x4'));var config=require(_0x7d18('0x5'));var logger=require(_0x7d18('0x6'))('zendesk');config[_0x7d18('0x7')]=_[_0x7d18('0x8')](config['redis'],{'host':_0x7d18('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3c6995,_0x29b7ec,_0x446b1e){io['to'](_0x3c6995)['emit'](_0x29b7ec,_0x446b1e);}var headers={'Content-Type':_0x7d18('0xa'),'Accept':'application/json'};function getTicket(_0x1eeba5,_0x2c8dce,_0x393363,_0x5b9626,_0x166ae7){logger[_0x7d18('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0xd'),_0x1eeba5[_0x7d18('0xe')]),'method':_0x7d18('0xf'),'body':{'ticket':_[_0x7d18('0x10')]({'requester_id':_0x393363['id'],'submitter_id':_0x2c8dce?_0x2c8dce['id']:undefined,'assignee_id':_0x2c8dce?_0x2c8dce['id']:undefined,'tags':getTags(_0x5b9626[_0x7d18('0x11')],_0x7d18('0x12')),'subject':intUtil['getString'](_0x5b9626[_0x7d18('0x13')],_0x166ae7,'\x20'),'description':intUtil[_0x7d18('0x14')](_0x5b9626[_0x7d18('0x15')],_0x166ae7,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7d18('0x14')](_0x5b9626[_0x7d18('0x15')],_0x166ae7,'\x0a')}},getCustomFields(_0x5b9626[_0x7d18('0x16')],_0x166ae7))}})[_0x7d18('0x17')](function(_0x4895f6){logger[_0x7d18('0xb')]('Ticket\x20created!');return _0x4895f6[_0x7d18('0x18')];});}function getUser(_0x4074c4,_0xf7c495){if(intUtil['validateEmail'](_0xf7c495)){logger[_0x7d18('0xb')](_0x7d18('0x19'),_0xf7c495);return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x1a'),_0x4074c4[_0x7d18('0xe')]),'qs':{'query':util[_0x7d18('0xc')]('type:user\x20role:agent\x20email:%s',_0xf7c495)}})[_0x7d18('0x17')](function(_0x22611a){if(_0x22611a['count']){logger[_0x7d18('0xb')](_0x7d18('0x1b'));return _[_0x7d18('0x1c')](_0x22611a[_0x7d18('0x1d')],{'email':_0xf7c495,'role':_0x7d18('0x1e')});}else{logger[_0x7d18('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x4074c4['remoteUri'])})[_0x7d18('0x17')](function(_0x46ab04){logger[_0x7d18('0xb')]('Admin\x20account\x20selected.');return _0x46ab04[_0x7d18('0x1f')];});}});}else{logger[_0x7d18('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x20'),_0x4074c4['remoteUri'])})[_0x7d18('0x17')](function(_0x3d092e){logger[_0x7d18('0xb')](_0x7d18('0x21'));return _0x3d092e[_0x7d18('0x1f')];});}}function getEndUser(_0x182c38,_0x48df75,_0x8eec96){logger[_0x7d18('0xb')](_0x7d18('0x22'),_0x8eec96);return request({'uri':util[_0x7d18('0xc')]('%s/search.json',_0x182c38['remoteUri']),'qs':{'query':util['format'](_0x7d18('0x23'),_0x8eec96)}})[_0x7d18('0x17')](function(_0x363048){var _0x215b4a;if(_0x363048[_0x7d18('0x1d')][_0x7d18('0x24')]){_0x363048[_0x7d18('0x1d')]=_[_0x7d18('0x25')](_0x363048['results'],{'suspended':![],'role':_0x7d18('0x26')});if(_0x363048[_0x7d18('0x1d')][_0x7d18('0x24')]){_0x215b4a=_[_0x7d18('0x27')](_0x363048['results']);}}if(_0x215b4a){logger[_0x7d18('0xb')](_0x7d18('0x28'));return _0x215b4a;}else{logger[_0x7d18('0xb')](_0x7d18('0x29'));return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x2a'),_0x182c38[_0x7d18('0xe')]),'method':_0x7d18('0xf'),'body':{'user':{'role':_0x7d18('0x26'),'name':util['format'](_0x7d18('0x2b'),_0x48df75||_0x8eec96),'phone':_0x8eec96}}})[_0x7d18('0x17')](function(_0x10dc78){logger[_0x7d18('0xb')](_0x7d18('0x2c'));return _0x10dc78[_0x7d18('0x1f')];});}});}function getAuth(_0x529321){var _0x56a419;if(_0x529321[_0x7d18('0x2d')]===_0x7d18('0x2e')){_0x56a419=util[_0x7d18('0xc')]('%s:%s',_0x529321[_0x7d18('0x2f')],_0x529321[_0x7d18('0x2e')]);}else if(_0x529321['authType']===_0x7d18('0x30')){_0x56a419=util[_0x7d18('0xc')](_0x7d18('0x31'),_0x529321['username'],_0x529321[_0x7d18('0x30')]);}return util[_0x7d18('0xc')](_0x7d18('0x32'),new Buffer(_0x56a419)['toString'](_0x7d18('0x33')));}function request(_0x961c51){logger[_0x7d18('0x34')]('[HTTP]',JSON[_0x7d18('0x35')](_0x961c51));return rp(_[_0x7d18('0x8')](_0x961c51,{'method':_0x7d18('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x485951,_0xa0dfc8){var _0x5ec4e8=[];if(_0x485951&&_0x485951[_0x7d18('0x24')]>0x0){_0x5ec4e8=_[_0x7d18('0x37')](_0x485951,_0xa0dfc8);}return _0x5ec4e8;}function getCustomFields(_0x52d8e4,_0x5b87f2){var _0x3d81f8=[];var _0x3b50dd={'custom_fields':[]};if(_0x52d8e4['length']>0x0){_[_0x7d18('0x38')](_0x52d8e4,function(_0x5d7fcc){if(_['includes']([_0x7d18('0x39'),_0x7d18('0x3a')],_0x5d7fcc[_0x7d18('0x3b')])&&_0x5d7fcc[_0x7d18('0x3c')]&&!_0x5d7fcc['customField']){_0x3b50dd[_0x5d7fcc[_0x7d18('0x3c')][_0x7d18('0x3d')]()]=_0x5d7fcc['content'][_0x7d18('0x3e')]();}else if(_[_0x7d18('0x3f')](['string',_0x7d18('0x3a')],_0x5d7fcc[_0x7d18('0x3b')])&&_0x5d7fcc['idField']&&_0x5d7fcc[_0x7d18('0x40')]){_0x3b50dd[_0x7d18('0x41')]['push']({'id':_0x5d7fcc['idField'],'value':_0x5d7fcc[_0x7d18('0x42')][_0x7d18('0x3e')]()});}else if(_0x5d7fcc[_0x7d18('0x3b')]==='variable'&&_0x5d7fcc[_0x7d18('0x43')]&&_0x5d7fcc[_0x7d18('0x44')]&&_0x5d7fcc[_0x7d18('0x40')]){_0x5b87f2[_0x5d7fcc[_0x7d18('0x43')]]&&_0x3b50dd[_0x7d18('0x41')][_0x7d18('0x45')]({'id':_0x5d7fcc[_0x7d18('0x44')],'value':_0x5b87f2[_0x5d7fcc[_0x7d18('0x43')]][_0x7d18('0x3e')]()});}else if(_0x5d7fcc[_0x7d18('0x3b')]===_0x7d18('0x46')&&_0x5d7fcc['Variable']&&_0x5d7fcc['Variable'][_0x7d18('0x12')]&&_0x5d7fcc[_0x7d18('0x44')]&&_0x5d7fcc[_0x7d18('0x40')]){_0x5b87f2[_0x5d7fcc[_0x7d18('0x47')]['name'][_0x7d18('0x3d')]()]&&_0x3b50dd['custom_fields'][_0x7d18('0x45')]({'id':_0x5d7fcc['idField'],'value':_0x5b87f2[_0x5d7fcc[_0x7d18('0x47')][_0x7d18('0x12')][_0x7d18('0x3d')]()][_0x7d18('0x3e')]()});}});}return _0x3b50dd;}exports['queue']=function(_0x25ea49,_0x4e8440,_0x46138a,_0x2adc2a,_0x433255,_0x3c7389){var _0x2607ed,_0x5269ff;_0x3c7389['remoteUri']=intUtil[_0x7d18('0x48')](_0x3c7389['remoteUri']);_0x3c7389['serverUrl']=intUtil[_0x7d18('0x48')](_0x3c7389[_0x7d18('0x49')]);if(_0x433255&&_0x433255[_0x7d18('0x4a')]){logger['info'](_0x7d18('0x4b'),_0x7d18('0x4c'));_0x4e8440['recordingURL']=util['format'](_0x7d18('0x4d'),_0x3c7389[_0x7d18('0x49')],_0x4e8440['uniqueid'],md5(_0x4e8440[_0x7d18('0x4e')]));}else{_0x4e8440[_0x7d18('0x4f')]='';}headers[_0x7d18('0x50')]=getAuth(_0x3c7389);return getUser(_0x3c7389,_0x2adc2a[_0x7d18('0x51')])[_0x7d18('0x17')](function(_0x4cd500){_0x2607ed=_0x4cd500;logger['info'](_0x7d18('0x52'),_0x2607ed['id']);return getEndUser(_0x3c7389,_0x4e8440[_0x7d18('0x53')],_0x4e8440['calleridnum']);})[_0x7d18('0x17')](function(_0x2fe6fe){_0x5269ff=_0x2fe6fe;logger[_0x7d18('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5269ff['id']);return getTicket(_0x3c7389,_0x2607ed,_0x5269ff,_0x46138a,_0x4e8440);})['then'](function(_0x690e){if(_0x690e){logger[_0x7d18('0xb')]('The\x20Ticket\x20ID\x20is:',_0x690e['id']);switch(_0x3c7389[_0x7d18('0x3b')]){case'integrationTab':logger[_0x7d18('0xb')](_0x7d18('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x54'),_0x3c7389[_0x7d18('0xe')],_0x2607ed['id'],_0x690e['id']),'method':_0x7d18('0xf')});case _0x7d18('0x55'):logger[_0x7d18('0xb')]('[QUEUE]',_0x7d18('0x56'));emit(util[_0x7d18('0xc')]('user:%s',_0x2adc2a[_0x7d18('0x12')]),_0x7d18('0x57'),{'uri':util['format']('%s/agent/tickets/%s',_0x3c7389[_0x7d18('0xe')][_0x7d18('0x58')](_0x7d18('0x59'),''),_0x690e['id'])});break;default:logger['error'](_0x7d18('0x4b'),_0x7d18('0x5a'));}}})[_0x7d18('0x5b')](function(_0x2be7cd){logger['error'](_0x7d18('0x5c'),util[_0x7d18('0x5d')](_0x2be7cd,{'showHidden':!![],'depth':null}));});};exports[_0x7d18('0x5e')]=function(_0x3a25be,_0x364b7d,_0x416f91,_0x2f4b80,_0x252c8c,_0x122134,_0x1fb1b1){var _0x16a3d7,_0x37735e;_0x122134[_0x7d18('0xe')]=intUtil[_0x7d18('0x48')](_0x122134[_0x7d18('0xe')]);_0x122134[_0x7d18('0x49')]=intUtil['stripTrailingSlash'](_0x122134[_0x7d18('0x49')]);if(_0x1fb1b1&&_0x1fb1b1['recordingFormat']&&_0x1fb1b1[_0x7d18('0x5f')]!==_0x7d18('0x60')){logger['info']('[OUTBOUND]',_0x7d18('0x4c'));_0x364b7d[_0x7d18('0x4f')]=util[_0x7d18('0xc')](_0x7d18('0x4d'),_0x122134['serverUrl'],_0x364b7d[_0x7d18('0x4e')],md5(_0x364b7d[_0x7d18('0x4e')]));}headers[_0x7d18('0x50')]=getAuth(_0x122134);return getUser(_0x122134,_0x2f4b80['email'])[_0x7d18('0x17')](function(_0x5970b1){_0x16a3d7=_0x5970b1;logger['info']('The\x20User\x20ID\x20is:',_0x16a3d7['id']);return getEndUser(_0x122134,_0x364b7d['destcalleridname'],_0x364b7d['destcalleridnum']);})[_0x7d18('0x17')](function(_0x40aac8){_0x37735e=_0x40aac8;logger[_0x7d18('0xb')](_0x7d18('0x61'),_0x37735e['id']);return getTicket(_0x122134,_0x16a3d7,_0x37735e,_0x416f91,_0x364b7d);})[_0x7d18('0x17')](function(_0x2eda1c){if(_0x2eda1c){logger[_0x7d18('0xb')](_0x7d18('0x62'),_0x2eda1c['id']);switch(_0x122134[_0x7d18('0x3b')]){case _0x7d18('0x63'):logger[_0x7d18('0xb')](_0x7d18('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7d18('0xc')](_0x7d18('0x54'),_0x122134[_0x7d18('0xe')],_0x16a3d7['id'],_0x2eda1c['id']),'method':_0x7d18('0xf')});case _0x7d18('0x55'):logger[_0x7d18('0xb')](_0x7d18('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7d18('0xc')](_0x7d18('0x65'),_0x2f4b80[_0x7d18('0x12')]),_0x7d18('0x57'),{'uri':util['format'](_0x7d18('0x66'),_0x122134[_0x7d18('0xe')]['replace']('/api/v2',''),_0x2eda1c['id'])});break;default:logger[_0x7d18('0x67')](_0x7d18('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7d18('0x5b')](function(_0x394958){logger[_0x7d18('0x67')](_0x7d18('0x68'),util[_0x7d18('0x5d')](_0x394958,{'showHidden':!![],'depth':null}));});};exports[_0x7d18('0x69')]=function(_0x38feba,_0x2cad73,_0x249cf2,_0x119c4a,_0x426297,_0x4eafa9){var _0x34d562,_0x26c1f8;_0x4eafa9[_0x7d18('0xe')]=intUtil[_0x7d18('0x48')](_0x4eafa9[_0x7d18('0xe')]);_0x4eafa9['serverUrl']=intUtil[_0x7d18('0x48')](_0x4eafa9[_0x7d18('0x49')]);if(_0x426297&&_0x426297['monitor_format']){logger[_0x7d18('0xb')]('['+_0x2cad73['lastevent'][_0x7d18('0x6a')]()+']',_0x7d18('0x4c'));_0x2cad73[_0x7d18('0x4f')]=util[_0x7d18('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4eafa9['serverUrl'],_0x2cad73[_0x7d18('0x4e')],md5(_0x2cad73[_0x7d18('0x4e')]));}else{_0x2cad73['recordingURL']='';}headers[_0x7d18('0x50')]=getAuth(_0x4eafa9);return getUser(_0x4eafa9)[_0x7d18('0x17')](function(_0x4c1f60){_0x34d562=_0x4c1f60;logger[_0x7d18('0xb')]('The\x20User\x20ID\x20is:',_0x34d562['id']);return getEndUser(_0x4eafa9,_0x2cad73[_0x7d18('0x53')],_0x2cad73['calleridnum']);})[_0x7d18('0x17')](function(_0x2c86a6){_0x26c1f8=_0x2c86a6;logger[_0x7d18('0xb')](_0x7d18('0x61'),_0x26c1f8['id']);return getTicket(_0x4eafa9,_0x34d562,_0x26c1f8,_0x249cf2,_0x2cad73);})[_0x7d18('0x17')](function(_0x5250c4){if(_0x5250c4){logger[_0x7d18('0xb')](_0x7d18('0x62'),_0x5250c4['id']);}})[_0x7d18('0x5b')](function(_0x4d0526){logger['error']('['+_0x2cad73[_0x7d18('0x6b')][_0x7d18('0x6a')]()+']'+_0x7d18('0x6c'),util[_0x7d18('0x5d')](_0x4d0526,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb356=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','integrationTab','newTab','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','application/json','info','format','POST','merge','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','%s/token:%s','username','toString','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','content','includes','picklist','idField','custom_fields','variable','variableName','Variable','name','toLowerCase','push','stripTrailingSlash'];(function(_0x51b829,_0xb2594c){var _0x12437a=function(_0x480822){while(--_0x480822){_0x51b829['push'](_0x51b829['shift']());}};_0x12437a(++_0xb2594c);}(_0xb356,0x16c));var _0x6b35=function(_0x55034c,_0x415f7d){_0x55034c=_0x55034c-0x0;var _0x4b8eed=_0xb356[_0x55034c];return _0x4b8eed;};'use strict';var _=require(_0x6b35('0x0'));var rp=require('request-promise');var md5=require(_0x6b35('0x1'));var util=require(_0x6b35('0x2'));var Redis=require(_0x6b35('0x3'));var intUtil=require(_0x6b35('0x4'));var config=require(_0x6b35('0x5'));var logger=require(_0x6b35('0x6'))(_0x6b35('0x7'));config['redis']=_[_0x6b35('0x8')](config[_0x6b35('0x9')],{'host':_0x6b35('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b35('0x9')]));function emit(_0x150b57,_0x415e3b,_0x1e1ef5){io['to'](_0x150b57)['emit'](_0x415e3b,_0x1e1ef5);}var headers={'Content-Type':_0x6b35('0xb'),'Accept':_0x6b35('0xb')};function getTicket(_0x3de84b,_0x189579,_0x29d992,_0x45d6d2,_0x2cfb4f){logger[_0x6b35('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x6b35('0xd')]('%s/tickets.json',_0x3de84b['remoteUri']),'method':_0x6b35('0xe'),'body':{'ticket':_[_0x6b35('0xf')]({'requester_id':_0x29d992['id'],'submitter_id':_0x189579?_0x189579['id']:undefined,'assignee_id':_0x189579?_0x189579['id']:undefined,'tags':getTags(_0x45d6d2['Tags'],'name'),'subject':intUtil['getString'](_0x45d6d2[_0x6b35('0x10')],_0x2cfb4f,'\x20'),'description':intUtil[_0x6b35('0x11')](_0x45d6d2[_0x6b35('0x12')],_0x2cfb4f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6b35('0x11')](_0x45d6d2[_0x6b35('0x12')],_0x2cfb4f,'\x0a')}},getCustomFields(_0x45d6d2[_0x6b35('0x13')],_0x2cfb4f))}})[_0x6b35('0x14')](function(_0x877b36){logger[_0x6b35('0xc')](_0x6b35('0x15'));return _0x877b36[_0x6b35('0x16')];});}function getUser(_0x16a493,_0x1de58b){if(intUtil[_0x6b35('0x17')](_0x1de58b)){logger[_0x6b35('0xc')]('Getting\x20agent\x20with\x20email',_0x1de58b);return request({'uri':util[_0x6b35('0xd')](_0x6b35('0x18'),_0x16a493['remoteUri']),'qs':{'query':util[_0x6b35('0xd')](_0x6b35('0x19'),_0x1de58b)}})[_0x6b35('0x14')](function(_0x18e0f7){if(_0x18e0f7[_0x6b35('0x1a')]){logger[_0x6b35('0xc')](_0x6b35('0x1b'));return _[_0x6b35('0x1c')](_0x18e0f7['results'],{'email':_0x1de58b,'role':_0x6b35('0x1d')});}else{logger['info'](_0x6b35('0x1e'));return request({'uri':util[_0x6b35('0xd')](_0x6b35('0x1f'),_0x16a493[_0x6b35('0x20')])})['then'](function(_0x3b6bb7){logger[_0x6b35('0xc')](_0x6b35('0x21'));return _0x3b6bb7[_0x6b35('0x22')];});}});}else{logger['info'](_0x6b35('0x1e'));return request({'uri':util['format'](_0x6b35('0x1f'),_0x16a493['remoteUri'])})[_0x6b35('0x14')](function(_0x57ecfe){logger[_0x6b35('0xc')]('Admin\x20account\x20selected.');return _0x57ecfe[_0x6b35('0x22')];});}}function getEndUser(_0x3a4ce0,_0x54cb33,_0xbeab51){logger['info']('Searching\x20enduser\x20with\x20phone',_0xbeab51);return request({'uri':util['format'](_0x6b35('0x18'),_0x3a4ce0['remoteUri']),'qs':{'query':util[_0x6b35('0xd')](_0x6b35('0x23'),_0xbeab51)}})[_0x6b35('0x14')](function(_0x227d86){var _0x154218;if(_0x227d86[_0x6b35('0x24')][_0x6b35('0x25')]){_0x227d86['results']=_['filter'](_0x227d86[_0x6b35('0x24')],{'suspended':![],'role':'end-user'});if(_0x227d86[_0x6b35('0x24')]['length']){_0x154218=_[_0x6b35('0x26')](_0x227d86[_0x6b35('0x24')]);}}if(_0x154218){logger['info'](_0x6b35('0x27'));return _0x154218;}else{logger[_0x6b35('0xc')](_0x6b35('0x28'));return request({'uri':util[_0x6b35('0xd')](_0x6b35('0x29'),_0x3a4ce0['remoteUri']),'method':_0x6b35('0xe'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x54cb33||_0xbeab51),'phone':_0xbeab51}}})['then'](function(_0x5d5afb){logger['info'](_0x6b35('0x2a'));return _0x5d5afb[_0x6b35('0x22')];});}});}function getAuth(_0x169801){var _0x42b0f5;if(_0x169801['authType']===_0x6b35('0x2b')){_0x42b0f5=util[_0x6b35('0xd')](_0x6b35('0x2c'),_0x169801['username'],_0x169801[_0x6b35('0x2b')]);}else if(_0x169801['authType']==='token'){_0x42b0f5=util['format'](_0x6b35('0x2d'),_0x169801[_0x6b35('0x2e')],_0x169801['token']);}return util[_0x6b35('0xd')]('Basic\x20%s',new Buffer(_0x42b0f5)[_0x6b35('0x2f')]('base64'));}function request(_0x3ee658){logger['debug'](_0x6b35('0x30'),JSON[_0x6b35('0x31')](_0x3ee658));return rp(_[_0x6b35('0x8')](_0x3ee658,{'method':_0x6b35('0x32'),'headers':headers,'json':!![]}));}function getTags(_0xf85fd2,_0x248f06){var _0x574970=[];if(_0xf85fd2&&_0xf85fd2[_0x6b35('0x25')]>0x0){_0x574970=_[_0x6b35('0x33')](_0xf85fd2,_0x248f06);}return _0x574970;}function getCustomFields(_0x582ffb,_0x3d76b0){var _0x22afbe=[];var _0x4ee302={'custom_fields':[]};if(_0x582ffb[_0x6b35('0x25')]>0x0){_[_0x6b35('0x34')](_0x582ffb,function(_0x2fdf55){if(_['includes'](['string','picklist'],_0x2fdf55[_0x6b35('0x35')])&&_0x2fdf55[_0x6b35('0x36')]&&!_0x2fdf55[_0x6b35('0x37')]){_0x4ee302[_0x2fdf55[_0x6b35('0x36')]['toLowerCase']()]=_0x2fdf55[_0x6b35('0x38')][_0x6b35('0x2f')]();}else if(_[_0x6b35('0x39')](['string',_0x6b35('0x3a')],_0x2fdf55[_0x6b35('0x35')])&&_0x2fdf55[_0x6b35('0x3b')]&&_0x2fdf55['customField']){_0x4ee302[_0x6b35('0x3c')]['push']({'id':_0x2fdf55[_0x6b35('0x3b')],'value':_0x2fdf55[_0x6b35('0x38')][_0x6b35('0x2f')]()});}else if(_0x2fdf55[_0x6b35('0x35')]===_0x6b35('0x3d')&&_0x2fdf55['variableName']&&_0x2fdf55['idField']&&_0x2fdf55[_0x6b35('0x37')]){_0x3d76b0[_0x2fdf55[_0x6b35('0x3e')]]&&_0x4ee302['custom_fields']['push']({'id':_0x2fdf55[_0x6b35('0x3b')],'value':_0x3d76b0[_0x2fdf55['variableName']][_0x6b35('0x2f')]()});}else if(_0x2fdf55[_0x6b35('0x35')]==='customVariable'&&_0x2fdf55[_0x6b35('0x3f')]&&_0x2fdf55[_0x6b35('0x3f')][_0x6b35('0x40')]&&_0x2fdf55['idField']&&_0x2fdf55[_0x6b35('0x37')]){_0x3d76b0[_0x2fdf55['Variable'][_0x6b35('0x40')][_0x6b35('0x41')]()]&&_0x4ee302['custom_fields'][_0x6b35('0x42')]({'id':_0x2fdf55[_0x6b35('0x3b')],'value':_0x3d76b0[_0x2fdf55[_0x6b35('0x3f')]['name'][_0x6b35('0x41')]()][_0x6b35('0x2f')]()});}});}return _0x4ee302;}exports['queue']=function(_0x203137,_0x94b338,_0x12e144,_0x129576,_0x45a246,_0x1eeeb3){var _0x26842e,_0xbd7ce;_0x1eeeb3['remoteUri']=intUtil[_0x6b35('0x43')](_0x1eeeb3['remoteUri']);_0x1eeeb3[_0x6b35('0x44')]=intUtil['stripTrailingSlash'](_0x1eeeb3[_0x6b35('0x44')]);if(_0x45a246&&_0x45a246[_0x6b35('0x45')]){logger[_0x6b35('0xc')](_0x6b35('0x46'),_0x6b35('0x47'));_0x94b338[_0x6b35('0x48')]=util[_0x6b35('0xd')](_0x6b35('0x49'),_0x1eeeb3['serverUrl'],_0x94b338[_0x6b35('0x4a')],md5(_0x94b338[_0x6b35('0x4a')]));}else{_0x94b338['recordingURL']='';}headers[_0x6b35('0x4b')]=getAuth(_0x1eeeb3);return getUser(_0x1eeeb3,_0x129576[_0x6b35('0x4c')])[_0x6b35('0x14')](function(_0x344c2c){_0x26842e=_0x344c2c;logger[_0x6b35('0xc')](_0x6b35('0x4d'),_0x26842e['id']);return getEndUser(_0x1eeeb3,_0x94b338['calleridname'],_0x94b338[_0x6b35('0x4e')]);})[_0x6b35('0x14')](function(_0x29d20a){_0xbd7ce=_0x29d20a;logger[_0x6b35('0xc')](_0x6b35('0x4f'),_0xbd7ce['id']);return getTicket(_0x1eeeb3,_0x26842e,_0xbd7ce,_0x12e144,_0x94b338);})[_0x6b35('0x14')](function(_0x5db599){if(_0x5db599){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5db599['id']);switch(_0x1eeeb3[_0x6b35('0x35')]){case'integrationTab':logger['info'](_0x6b35('0x46'),_0x6b35('0x50'));return request({'uri':util['format'](_0x6b35('0x51'),_0x1eeeb3[_0x6b35('0x20')],_0x26842e['id'],_0x5db599['id']),'method':'POST'});case'newTab':logger[_0x6b35('0xc')](_0x6b35('0x46'),_0x6b35('0x52'));emit(util[_0x6b35('0xd')](_0x6b35('0x53'),_0x129576['name']),_0x6b35('0x54'),{'uri':util[_0x6b35('0xd')](_0x6b35('0x55'),_0x1eeeb3[_0x6b35('0x20')][_0x6b35('0x56')](_0x6b35('0x57'),''),_0x5db599['id'])});break;default:logger[_0x6b35('0x58')](_0x6b35('0x46'),_0x6b35('0x59'));}}})[_0x6b35('0x5a')](function(_0x3771f1){logger['error'](_0x6b35('0x5b'),util[_0x6b35('0x5c')](_0x3771f1,{'showHidden':!![],'depth':null}));});};exports[_0x6b35('0x5d')]=function(_0x30e010,_0x66481e,_0x17ffaa,_0x4e876c,_0x2eaf06,_0x91e6d2,_0x5dfa50){var _0x1c594d,_0x32e625;_0x91e6d2[_0x6b35('0x20')]=intUtil[_0x6b35('0x43')](_0x91e6d2['remoteUri']);_0x91e6d2[_0x6b35('0x44')]=intUtil[_0x6b35('0x43')](_0x91e6d2[_0x6b35('0x44')]);if(_0x5dfa50&&_0x5dfa50['recordingFormat']&&_0x5dfa50[_0x6b35('0x5e')]!==_0x6b35('0x5f')){logger[_0x6b35('0xc')]('[OUTBOUND]',_0x6b35('0x47'));_0x66481e[_0x6b35('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x91e6d2[_0x6b35('0x44')],_0x66481e['uniqueid'],md5(_0x66481e[_0x6b35('0x4a')]));}headers[_0x6b35('0x4b')]=getAuth(_0x91e6d2);return getUser(_0x91e6d2,_0x4e876c['email'])['then'](function(_0x487299){_0x1c594d=_0x487299;logger[_0x6b35('0xc')](_0x6b35('0x4d'),_0x1c594d['id']);return getEndUser(_0x91e6d2,_0x66481e[_0x6b35('0x60')],_0x66481e[_0x6b35('0x61')]);})['then'](function(_0x3e4c32){_0x32e625=_0x3e4c32;logger[_0x6b35('0xc')](_0x6b35('0x4f'),_0x32e625['id']);return getTicket(_0x91e6d2,_0x1c594d,_0x32e625,_0x17ffaa,_0x66481e);})['then'](function(_0x2bbccf){if(_0x2bbccf){logger[_0x6b35('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2bbccf['id']);switch(_0x91e6d2[_0x6b35('0x35')]){case _0x6b35('0x62'):logger['info']('[OUTBOUND]',_0x6b35('0x50'));return request({'uri':util['format'](_0x6b35('0x51'),_0x91e6d2[_0x6b35('0x20')],_0x1c594d['id'],_0x2bbccf['id']),'method':_0x6b35('0xe')});case _0x6b35('0x63'):logger['info'](_0x6b35('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6b35('0xd')](_0x6b35('0x53'),_0x4e876c['name']),'trigger:browser:url',{'uri':util[_0x6b35('0xd')]('%s/agent/tickets/%s',_0x91e6d2['remoteUri'][_0x6b35('0x56')](_0x6b35('0x57'),''),_0x2bbccf['id'])});break;default:logger[_0x6b35('0x58')]('[OUTBOUND]',_0x6b35('0x59'));}}})[_0x6b35('0x5a')](function(_0x44f6ce){logger[_0x6b35('0x58')](_0x6b35('0x65'),util[_0x6b35('0x5c')](_0x44f6ce,{'showHidden':!![],'depth':null}));});};exports[_0x6b35('0x66')]=function(_0x2bfdbf,_0x2e222d,_0x295977,_0x535e82,_0x475e43,_0x4df640){var _0x26f6a1,_0x11983c;_0x4df640[_0x6b35('0x20')]=intUtil[_0x6b35('0x43')](_0x4df640[_0x6b35('0x20')]);_0x4df640[_0x6b35('0x44')]=intUtil[_0x6b35('0x43')](_0x4df640['serverUrl']);if(_0x475e43&&_0x475e43['monitor_format']){logger[_0x6b35('0xc')]('['+_0x2e222d[_0x6b35('0x67')][_0x6b35('0x68')]()+']',_0x6b35('0x47'));_0x2e222d['recordingURL']=util[_0x6b35('0xd')](_0x6b35('0x49'),_0x4df640[_0x6b35('0x44')],_0x2e222d[_0x6b35('0x4a')],md5(_0x2e222d[_0x6b35('0x4a')]));}else{_0x2e222d['recordingURL']='';}headers['Authorization']=getAuth(_0x4df640);return getUser(_0x4df640)[_0x6b35('0x14')](function(_0x36add7){_0x26f6a1=_0x36add7;logger[_0x6b35('0xc')](_0x6b35('0x4d'),_0x26f6a1['id']);return getEndUser(_0x4df640,_0x2e222d[_0x6b35('0x69')],_0x2e222d[_0x6b35('0x4e')]);})['then'](function(_0x5d7ab4){_0x11983c=_0x5d7ab4;logger[_0x6b35('0xc')](_0x6b35('0x4f'),_0x11983c['id']);return getTicket(_0x4df640,_0x26f6a1,_0x11983c,_0x295977,_0x2e222d);})['then'](function(_0xdb116d){if(_0xdb116d){logger[_0x6b35('0xc')](_0x6b35('0x6a'),_0xdb116d['id']);}})[_0x6b35('0x5a')](function(_0x1a5de0){logger[_0x6b35('0x58')]('['+_0x2e222d['lastevent']['toUpperCase']()+']'+_0x6b35('0x6b'),util[_0x6b35('0x5c')](_0x1a5de0,{'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 1a7ac30..8342e13 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 _0x59e7=['user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','https://crm.','unmanaged','toUpperCase','/api/voice/recordings/','calleridname','calleridnum','The\x20Call\x20ID\x20is:','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','[HTTP]','stringify','includes','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','then','access_token','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Leads','nothing','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','connect','Answered','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59e7,0x1ce));var _0x759e=function(_0x442fee,_0x16b130){_0x442fee=_0x442fee-0x0;var _0xf1a85c=_0x59e7[_0x442fee];return _0xf1a85c;};'use strict';var _=require('lodash');var rp=require(_0x759e('0x0'));var md5=require('md5');var util=require(_0x759e('0x1'));var intUtil=require(_0x759e('0x2'));var moment=require(_0x759e('0x3'));var Redis=require(_0x759e('0x4'));var BPromise=require(_0x759e('0x5'));var config=require(_0x759e('0x6'));var logger=require(_0x759e('0x7'))(_0x759e('0x8'));config['redis']=_[_0x759e('0x9')](config['redis'],{'host':_0x759e('0xa'),'port':0x18eb});var io=require(_0x759e('0xb'))(new Redis(config[_0x759e('0xc')]));function emit(_0x572241,_0x390a69,_0x128724){io['to'](_0x572241)['emit'](_0x390a69,_0x128724);}function request(_0x25b360){logger['debug'](_0x759e('0xd'),JSON[_0x759e('0xe')](_0x25b360));return rp(_0x25b360);}function getCustomFields(_0x5b7a24,_0x1e0f52){var _0x332ff8={};if(_0x5b7a24['length']>0x0){_['forEach'](_0x5b7a24,function(_0x66f82f){if(_[_0x759e('0xf')](['string','picklist'],_0x66f82f[_0x759e('0x10')])&&_0x66f82f[_0x759e('0x11')]){_0x332ff8[_0x66f82f['idField']]=_0x66f82f['content'][_0x759e('0x12')]();}else if(_0x66f82f['type']===_0x759e('0x13')&&_0x66f82f[_0x759e('0x14')]&&_0x66f82f[_0x759e('0x11')]&&_0x1e0f52[_0x66f82f[_0x759e('0x14')]]){_0x332ff8[_0x66f82f[_0x759e('0x11')]]=_0x1e0f52[_0x66f82f['variableName']][_0x759e('0x12')]();}else if(_0x66f82f['type']===_0x759e('0x15')&&_0x66f82f['Variable']&&_0x66f82f[_0x759e('0x16')][_0x759e('0x17')]&&_0x66f82f[_0x759e('0x11')]&&_0x1e0f52[_0x66f82f[_0x759e('0x16')][_0x759e('0x17')][_0x759e('0x18')]()]){_0x332ff8[_0x66f82f['idField']]=_0x1e0f52[_0x66f82f[_0x759e('0x16')][_0x759e('0x17')][_0x759e('0x18')]()][_0x759e('0x12')]();}});}return _0x332ff8;}function getName(_0x56406d){if(_0x56406d[_0x759e('0x19')]('\x20')>0x0){var _0x3782b9=_0x56406d[_0x759e('0x1a')](/ (.+)/);if(_0x3782b9[0x1]){return _0x3782b9;}}return[_0x56406d,_0x56406d];}var accountsTokens={};function getAccessToken(_0x54060f){return new Promise(function(_0x47ca9d,_0x68d00f){if(!_[_0x759e('0x1b')](accountsTokens[_0x54060f['id']])&&!_['isNil'](accountsTokens[_0x54060f['id']]['access_token'])){if(moment()[_0x759e('0x1c')](accountsTokens[_0x54060f['id']]['expires_in'])){_0x47ca9d(accountsTokens[_0x54060f['id']]['access_token']);}}var _0x550120;switch(_0x54060f[_0x759e('0x1d')]){case'US':_0x550120=_0x759e('0x1e');break;case'AU':_0x550120=_0x759e('0x1f');break;case'EU':_0x550120=_0x759e('0x20');break;case'IN':_0x550120=_0x759e('0x21');break;case'CN':_0x550120=_0x759e('0x22');break;default:_0x550120=_0x759e('0x20');break;}var _0x266625={'method':'POST','uri':_0x550120+_0x759e('0x23'),'qs':{'refresh_token':_0x54060f[_0x759e('0x24')],'client_id':_0x54060f[_0x759e('0x25')],'client_secret':_0x54060f['clientSecret'],'grant_type':_0x759e('0x26')},'json':!![]};return rp(_0x266625)[_0x759e('0x27')](function(_0x3ef648){accountsTokens[_0x54060f['id']]={'access_token':_0x3ef648[_0x759e('0x28')],'expires_in':moment()['add'](_0x3ef648[_0x759e('0x29')],_0x759e('0x2a'))};_0x47ca9d(_0x3ef648['access_token']);})['catch'](function(_0x4f6508){logger['error'](_0x759e('0x2b'),_0x4f6508[_0x759e('0x2c')]);_0x68d00f(_0x4f6508);});});}function getUser(_0x4b0300,_0x23e1ed,_0x4fc1ed,_0x34b206){logger['info']('Search\x20user');return request({'method':_0x759e('0x2d'),'uri':util[_0x759e('0x2e')](_0x759e('0x2f'),_0x23e1ed),'qs':{'type':_0x759e('0x30')},'headers':{'Authorization':_0x759e('0x31')+_0x4b0300},'json':!![]})[_0x759e('0x27')](function(_0x19ef83){if(_0x19ef83[_0x759e('0x32')]){var _0x473e2a=-0x1;if(_['isArrayLikeObject'](_0x19ef83[_0x759e('0x32')])){if(!_['isNil'](_0x34b206)){_0x473e2a=_[_0x759e('0x33')](_0x19ef83[_0x759e('0x32')],function(_0x3d42d3){return _0x3d42d3[_0x759e('0x34')]===_0x34b206;});}if(_0x473e2a>=0x0){logger['info'](_0x759e('0x35'));}else{logger[_0x759e('0x36')]('Using\x20the\x20admin\x20account!');_0x473e2a=_['findIndex'](_0x19ef83[_0x759e('0x32')],function(_0xc2ba37){return _0xc2ba37[_0x759e('0x37')]['name']===_0x759e('0x38');});}return _0x19ef83[_0x759e('0x32')][_0x473e2a];}else{if(_0x19ef83['user'][_0x759e('0x37')][_0x759e('0x17')]===_0x759e('0x38')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x19ef83[_0x759e('0x39')];return user;}else{logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON[_0x759e('0xe')](_0x19ef83));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x759e('0xe')](_0x19ef83));}}}else{logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON['stringify'](_0x19ef83));throw new Error(_0x759e('0x3c')+JSON[_0x759e('0xe')](_0x19ef83));}})[_0x759e('0x3d')](function(_0x4d17b1){console['error'](_0x4d17b1);});}function getZohoUser(_0x2d39e5,_0x427b21){return new BPromise(function(_0x4372b1,_0x50c6d0){request(_0x2d39e5)['then'](function(_0x110851){var _0x594fbe=null;if(_0x110851){_0x594fbe=_0x110851['data'][0x0];_0x594fbe[_0x759e('0x3e')]=_0x427b21;}_0x4372b1(_0x594fbe);})[_0x759e('0x3d')](function(_0x11292a){_0x50c6d0(_0x11292a);});});}function createEndUser(_0x19715f,_0x44d13f,_0x2d1a91,_0x53a0f6,_0x546fb4,_0x4008dd){var _0x2d1a91=getName(_0x2d1a91);return request({'method':_0x759e('0x3f'),'uri':_0x759e('0x40')+_0x44d13f+'/crm/v2/'+_[_0x759e('0x41')](_0x4008dd[_0x759e('0x42')])+'s','body':{'data':[{'Last_Name':_0x2d1a91[0x1],'First_Name':_0x2d1a91[0x0],'Phone':_0x53a0f6,'Owner':{'name':!_[_0x759e('0x1b')](_0x546fb4['role'][_0x759e('0x17')])?_0x546fb4[_0x759e('0x43')][_0x759e('0x17')]:!_['isNil'](_0x546fb4[_0x759e('0x44')])?_0x546fb4[_0x759e('0x44')]+'\x20'+_0x546fb4[_0x759e('0x45')]:_0x546fb4[_0x759e('0x45')],'id':_0x546fb4['id']}}]},'headers':{'Authorization':_0x759e('0x31')+_0x19715f},'json':!![]})[_0x759e('0x27')](function(_0x47dbe0){if(_0x47dbe0&&_0x47dbe0[_0x759e('0x46')][0x0][_0x759e('0x47')]===_0x759e('0x48')){var _0x1cdefd=_0x47dbe0[_0x759e('0x46')][0x0][_0x759e('0x49')];_0x1cdefd[_0x759e('0x3e')]=_[_0x759e('0x41')](_0x4008dd[_0x759e('0x42')])+'s';return _0x1cdefd;}logger[_0x759e('0x3a')](_0x759e('0x3b'),JSON['stringify'](data));throw new Error(_0x759e('0x4a')+JSON[_0x759e('0xe')](data));})['catch'](function(_0x4a19d4){console['log'](_0x759e('0x4b'),_0x4a19d4);});}function getEndUser(_0xa51ac5,_0x5045f5,_0x2f19e1,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06){var _0x1b76fa={'method':_0x759e('0x2d'),'uri':'','headers':{'Authorization':_0x759e('0x31')+_0xa51ac5},'json':!![]};switch(_0x17aa06[_0x759e('0x4c')]){case _0x759e('0x4d'):_0x1b76fa[_0x759e('0x4e')]='https://www.zohoapis.'+_0x5045f5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,'Contacts')[_0x759e('0x27')](function(_0xcc3af4){if(_0xcc3af4)return _0xcc3af4;_0x1b76fa['uri']='https://www.zohoapis.'+_0x5045f5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x4f'))['then'](function(_0x4f09b5){if(_0x4f09b5)return _0x4f09b5;if(_0x17aa06['moduleCreate']!=_0x759e('0x50')){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});});break;case'contact':_0x1b76fa['uri']=_0x759e('0x40')+_0x5045f5+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x51'))[_0x759e('0x27')](function(_0x4c9c7d){if(_0x4c9c7d)return _0x4c9c7d;if(_0x17aa06[_0x759e('0x42')]!='nothing'){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});break;case _0x759e('0x52'):_0x1b76fa[_0x759e('0x4e')]=_0x759e('0x40')+_0x5045f5+_0x759e('0x53')+_0x34d54a+'))';return getZohoUser(_0x1b76fa,_0x759e('0x4f'))[_0x759e('0x27')](function(_0x325d3b){if(_0x325d3b)return _0x325d3b;if(_0x17aa06[_0x759e('0x42')]!=_0x759e('0x50')){return createEndUser(_0xa51ac5,_0x5045f5,_0x40993b,_0x34d54a,_0x5a1841,_0x17aa06);}else{return{};}});break;}}function getCall(_0x10a025,_0x35d3c2,_0x1c7d45,_0x586921,_0x5a3c9e,_0x52c2ac,_0xa117b8,_0x118875){logger[_0x759e('0x36')](_0x759e('0x54'));var _0x4f44fb={};_0x4f44fb[_0x759e('0x55')]={'name':!_[_0x759e('0x1b')](_0x586921[_0x759e('0x43')][_0x759e('0x17')])&&!_['isNil'](_0x586921['profile'][_0x759e('0x17')])&&_0x586921[_0x759e('0x37')][_0x759e('0x17')]===_0x759e('0x56')?_0x586921[_0x759e('0x43')]['name']:!_['isNil'](_0x586921[_0x759e('0x44')])?_0x586921[_0x759e('0x44')]+'\x20'+_0x586921[_0x759e('0x45')]:_0x586921['last_name'],'id':_0x586921['id']};_0x4f44fb['Subject']=intUtil['getString'](_0x52c2ac[_0x759e('0x57')],_0xa117b8,'\x20');_0x4f44fb[_0x759e('0x58')]=intUtil['getString'](_0x52c2ac['Descriptions'],_0xa117b8,'\x0a');if(_0x5a3c9e[_0x759e('0x3e')]===_0x759e('0x51')){_0x4f44fb[_0x759e('0x59')]={'name':!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5a')])?_0x5a3c9e[_0x759e('0x5a')]:!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5b')])?_0x5a3c9e['First_Name']+'\x20'+_0x5a3c9e['Last_Name']:_0x5a3c9e[_0x759e('0x5c')],'id':_0x5a3c9e['id']};}if(_0x5a3c9e['enduserType']===_0x759e('0x4f')){_0x4f44fb[_0x759e('0x5d')]={'name':!_[_0x759e('0x1b')](_0x5a3c9e[_0x759e('0x5a')])?_0x5a3c9e[_0x759e('0x5a')]:!_[_0x759e('0x1b')](_0x5a3c9e['First_Name'])?_0x5a3c9e[_0x759e('0x5b')]+'\x20'+_0x5a3c9e[_0x759e('0x5c')]:_0x5a3c9e['Last_Name'],'id':_0x5a3c9e['id']};_0x4f44fb[_0x759e('0x5e')]=_[_0x759e('0x41')](_0x5a3c9e[_0x759e('0x3e')]);}if(_0xa117b8[_0x759e('0x5f')]){_0x4f44fb[_0x759e('0x60')]=moment[_0x759e('0x61')](parseInt(_0xa117b8[_0x759e('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0xa117b8[_0x759e('0x62')]&&_0xa117b8[_0x759e('0x63')]){_0x4f44fb[_0x759e('0x60')]=moment[_0x759e('0x61')](moment(_0xa117b8[_0x759e('0x63')],'YYYY-MM-DDTHH:mm:ss')[_0x759e('0x64')](moment(_0xa117b8['starttime'],_0x759e('0x65'))))['format']('mm:ss');}switch(_0xa117b8[_0x759e('0x66')]){case'called':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x68');break;case'complete':case _0x759e('0x69'):_0x4f44fb['Call_Result']=_0x759e('0x6a');break;case'rejected':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6b');break;case _0x759e('0x6c'):_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6d');break;case'timeout':_0x4f44fb[_0x759e('0x67')]=_0x759e('0x6e');default:}_0x4f44fb['Call_Start_Time']=(_0x118875===_0x759e('0x6f')?moment(_0xa117b8['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0xa117b8[_0x759e('0x70')])[_0x759e('0x2e')](_0x759e('0x65')))||moment()[_0x759e('0x2e')](_0x759e('0x65'));_0x4f44fb[_0x759e('0x71')]=_0x118875||'Inbound';_0x4f44fb=_[_0x759e('0x72')](_0x4f44fb,getCustomFields(_0x52c2ac[_0x759e('0x73')],_0xa117b8));return request({'method':_0x759e('0x3f'),'uri':_0x759e('0x40')+_0x35d3c2+_0x759e('0x74'),'headers':{'Authorization':_0x759e('0x31')+_0x10a025},'body':{'data':[_0x4f44fb]},'json':!![]})[_0x759e('0x27')](function(_0x37d546){if(_0x37d546&&_0x37d546['data'][0x0]['code']===_0x759e('0x48')){logger[_0x759e('0x36')](_0x759e('0x75'));return{'id':_0x37d546[_0x759e('0x46')][0x0][_0x759e('0x49')]['id']};}})[_0x759e('0x3d')](function(_0x4ab4cf){logger['info'](_0x759e('0x76'),_0x4ab4cf['stack']);console['log'](_0x759e('0x76'),_0x4ab4cf);});}exports[_0x759e('0x77')]=function(_0x536096,_0x29bf0c,_0x18df0f,_0x4d22ea,_0x30e383,_0x4af518){var _0x282afd,_0x51de4c,_0x542332;_0x4af518[_0x759e('0x78')]=intUtil['stripTrailingSlash'](_0x4af518[_0x759e('0x78')]);_0x4af518['serverUrl']=intUtil[_0x759e('0x79')](_0x4af518[_0x759e('0x7a')]);if(_0x30e383&&_0x30e383[_0x759e('0x7b')]){logger[_0x759e('0x36')](_0x759e('0x7c'),_0x759e('0x7d'));_0x29bf0c['recordingURL']=_0x4af518[_0x759e('0x7a')]+'/api/voice/recordings/'+_0x29bf0c[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x29bf0c[_0x759e('0x7e')]);}else{_0x29bf0c[_0x759e('0x80')]='';}var _0x45802f=_0x4af518[_0x759e('0x78')]===_0x759e('0x81')?'eu':_0x759e('0x82');return getAccessToken(_0x4af518)[_0x759e('0x27')](function(_0x4c90fe){_0x542332=_0x4c90fe;return getUser(_0x542332,_0x45802f,_0x4af518,_0x4d22ea[_0x759e('0x34')]);})[_0x759e('0x27')](function(_0x5b8171){_0x282afd=_0x5b8171;logger[_0x759e('0x36')](_0x759e('0x83'),_0x282afd['id']);return getEndUser(_0x542332,_0x45802f,_0x4af518,_0x29bf0c['calleridname'],_0x29bf0c['calleridnum'],_0x282afd,_0x18df0f);})['then'](function(_0xd9e917){_0x51de4c=_0xd9e917;return getCall(_0x542332,_0x45802f,_0x4af518,_0x282afd,_0x51de4c,_0x18df0f,_0x29bf0c,_0x759e('0x84'));})[_0x759e('0x27')](function(_0x1744ff){if(_0x1744ff){logger[_0x759e('0x36')]('The\x20Call\x20ID\x20is:',_0x1744ff['id']);logger[_0x759e('0x36')](_0x759e('0x7c'),_0x759e('0x85'));emit(util[_0x759e('0x2e')](_0x759e('0x86'),_0x4d22ea[_0x759e('0x17')]),_0x759e('0x87'),{'uri':'https://crm.'+_0x4af518[_0x759e('0x78')]+_0x759e('0x88')+_0x1744ff['id']});}})[_0x759e('0x3d')](function(_0x341bf5){logger[_0x759e('0x3a')](_0x759e('0x7c'),JSON[_0x759e('0xe')](_0x341bf5));});};exports[_0x759e('0x6f')]=function(_0x13b8f5,_0x56f8de,_0x5c0b99,_0x35966e,_0x3d9510,_0x303f59,_0x43b9e6){var _0x2a6b0f,_0x8c4ef7,_0x4dfc42;_0x303f59[_0x759e('0x78')]=intUtil[_0x759e('0x79')](_0x303f59[_0x759e('0x78')]);_0x303f59[_0x759e('0x7a')]=intUtil[_0x759e('0x79')](_0x303f59[_0x759e('0x7a')]);if(_0x43b9e6&&_0x43b9e6[_0x759e('0x89')]&&_0x43b9e6[_0x759e('0x89')]!==_0x759e('0x8a')){logger['info'](_0x759e('0x8b'),_0x759e('0x7d'));_0x56f8de[_0x759e('0x80')]=_0x303f59[_0x759e('0x7a')]+'/api/voice/recordings/'+_0x56f8de[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x56f8de[_0x759e('0x7e')]);}var _0x3951be=_0x303f59[_0x759e('0x78')]==='zoho.eu'?'eu':_0x759e('0x82');return getAccessToken(_0x303f59)[_0x759e('0x27')](function(_0x16f1a2){_0x4dfc42=_0x16f1a2;return getUser(_0x4dfc42,_0x3951be,_0x303f59,_0x35966e['email']);})[_0x759e('0x27')](function(_0x356efc){_0x2a6b0f=_0x356efc;logger['info'](_0x759e('0x83'),_0x2a6b0f['id']);return getEndUser(_0x4dfc42,_0x3951be,_0x303f59,_0x56f8de[_0x759e('0x8c')],_0x56f8de[_0x759e('0x8d')],_0x2a6b0f,_0x5c0b99);})[_0x759e('0x27')](function(_0x4c8a25){_0x8c4ef7=_0x4c8a25;return getCall(_0x4dfc42,_0x3951be,_0x303f59,_0x2a6b0f,_0x8c4ef7,_0x5c0b99,_0x56f8de,'Outbound');})['then'](function(_0x5533fa){if(_0x5533fa){logger[_0x759e('0x36')]('The\x20Call\x20ID\x20is:',_0x5533fa['id']);logger['info']('[OUTBOUND]',_0x759e('0x85'));emit(util[_0x759e('0x2e')](_0x759e('0x86'),_0x35966e[_0x759e('0x17')]),_0x759e('0x87'),{'uri':_0x759e('0x8e')+_0x303f59['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x5533fa['id']});}})['catch'](function(_0x44080e){logger[_0x759e('0x3a')](_0x759e('0x8b'),JSON['stringify'](_0x44080e));});};exports[_0x759e('0x8f')]=function(_0x15283c,_0x163c43,_0x82eee4,_0x56336f,_0x51c019,_0x8295ab){var _0x36f564,_0x1478e6,_0x502a1a;_0x8295ab['host']=intUtil['stripTrailingSlash'](_0x8295ab[_0x759e('0x78')]);_0x8295ab['serverUrl']=intUtil[_0x759e('0x79')](_0x8295ab[_0x759e('0x7a')]);if(_0x51c019&&_0x51c019[_0x759e('0x7b')]){logger[_0x759e('0x36')]('['+_0x163c43[_0x759e('0x66')][_0x759e('0x90')]()+']',_0x759e('0x7d'));_0x163c43[_0x759e('0x80')]=_0x8295ab['serverUrl']+_0x759e('0x91')+_0x163c43[_0x759e('0x7e')]+_0x759e('0x7f')+md5(_0x163c43[_0x759e('0x7e')]);}else{_0x163c43[_0x759e('0x80')]='';}var _0x4fffbb=_0x8295ab['host']===_0x759e('0x81')?'eu':_0x759e('0x82');return getAccessToken(_0x8295ab)[_0x759e('0x27')](function(_0x52a070){_0x502a1a=_0x52a070;return getUser(_0x502a1a,_0x4fffbb,_0x8295ab);})[_0x759e('0x27')](function(_0xd0111b){_0x36f564=_0xd0111b;logger['info'](_0x759e('0x83'),_0x36f564['id']);return getEndUser(_0x502a1a,_0x4fffbb,_0x8295ab,_0x163c43[_0x759e('0x92')],_0x163c43[_0x759e('0x93')],_0x36f564,_0x82eee4);})[_0x759e('0x27')](function(_0x35b345){_0x1478e6=_0x35b345;return getCall(_0x502a1a,_0x4fffbb,_0x8295ab,_0x36f564,_0x1478e6,_0x82eee4,_0x163c43,'Inbound');})['then'](function(_0x51448a){if(_0x51448a){logger[_0x759e('0x36')](_0x759e('0x94'),_0x51448a['id']);}})[_0x759e('0x3d')](function(_0x2b219e){logger[_0x759e('0x3a')]('['+_0x163c43[_0x759e('0x66')][_0x759e('0x90')]()+']',JSON[_0x759e('0xe')](_0x2b219e));});}; \ No newline at end of file +var _0x795a=['catch','startCase','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','com','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','calleridname','calleridnum','request-promise','md5','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','then','add','seconds','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is'];(function(_0x489f85,_0x520d28){var _0x4e4fd0=function(_0xa1a98e){while(--_0xa1a98e){_0x489f85['push'](_0x489f85['shift']());}};_0x4e4fd0(++_0x520d28);}(_0x795a,0xeb));var _0xa795=function(_0x45a326,_0xb7b873){_0x45a326=_0x45a326-0x0;var _0x3347be=_0x795a[_0x45a326];return _0x3347be;};'use strict';var _=require('lodash');var rp=require(_0xa795('0x0'));var md5=require(_0xa795('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0xa795('0x2'));var Redis=require('ioredis');var BPromise=require(_0xa795('0x3'));var config=require(_0xa795('0x4'));var logger=require(_0xa795('0x5'))(_0xa795('0x6'));config[_0xa795('0x7')]=_['defaults'](config['redis'],{'host':_0xa795('0x8'),'port':0x18eb});var io=require(_0xa795('0x9'))(new Redis(config[_0xa795('0x7')]));function emit(_0x467fa1,_0x227d7d,_0x2fe478){io['to'](_0x467fa1)[_0xa795('0xa')](_0x227d7d,_0x2fe478);}function request(_0x41bec1){logger[_0xa795('0xb')](_0xa795('0xc'),JSON[_0xa795('0xd')](_0x41bec1));return rp(_0x41bec1);}function getCustomFields(_0x181324,_0x419d1e){var _0x6d6169={};if(_0x181324[_0xa795('0xe')]>0x0){_[_0xa795('0xf')](_0x181324,function(_0xd226cb){if(_['includes']([_0xa795('0x10'),_0xa795('0x11')],_0xd226cb[_0xa795('0x12')])&&_0xd226cb[_0xa795('0x13')]){_0x6d6169[_0xd226cb[_0xa795('0x13')]]=_0xd226cb['content'][_0xa795('0x14')]();}else if(_0xd226cb[_0xa795('0x12')]===_0xa795('0x15')&&_0xd226cb['variableName']&&_0xd226cb[_0xa795('0x13')]&&_0x419d1e[_0xd226cb[_0xa795('0x16')]]){_0x6d6169[_0xd226cb[_0xa795('0x13')]]=_0x419d1e[_0xd226cb[_0xa795('0x16')]][_0xa795('0x14')]();}else if(_0xd226cb['type']===_0xa795('0x17')&&_0xd226cb[_0xa795('0x18')]&&_0xd226cb[_0xa795('0x18')][_0xa795('0x19')]&&_0xd226cb[_0xa795('0x13')]&&_0x419d1e[_0xd226cb[_0xa795('0x18')][_0xa795('0x19')][_0xa795('0x1a')]()]){_0x6d6169[_0xd226cb[_0xa795('0x13')]]=_0x419d1e[_0xd226cb[_0xa795('0x18')][_0xa795('0x19')][_0xa795('0x1a')]()][_0xa795('0x14')]();}});}return _0x6d6169;}function getName(_0x57355d){if(_0x57355d['indexOf']('\x20')>0x0){var _0x221f65=_0x57355d['split'](/ (.+)/);if(_0x221f65[0x1]){return _0x221f65;}}return[_0x57355d,_0x57355d];}var accountsTokens={};function getAccessToken(_0x583af7){return new Promise(function(_0x38e0d3,_0xfb754e){if(!_['isNil'](accountsTokens[_0x583af7['id']])&&!_['isNil'](accountsTokens[_0x583af7['id']][_0xa795('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x583af7['id']][_0xa795('0x1c')])){_0x38e0d3(accountsTokens[_0x583af7['id']][_0xa795('0x1b')]);}}var _0x380510;switch(_0x583af7['zone']){case'US':_0x380510=_0xa795('0x1d');break;case'AU':_0x380510=_0xa795('0x1e');break;case'EU':_0x380510=_0xa795('0x1f');break;case'IN':_0x380510=_0xa795('0x20');break;case'CN':_0x380510='https://accounts.zoho.com.cn';break;default:_0x380510='https://accounts.zoho.eu';break;}var _0x40c2b4={'method':_0xa795('0x21'),'uri':_0x380510+_0xa795('0x22'),'qs':{'refresh_token':_0x583af7['refreshToken'],'client_id':_0x583af7['clientId'],'client_secret':_0x583af7[_0xa795('0x23')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x40c2b4)[_0xa795('0x24')](function(_0x57de59){accountsTokens[_0x583af7['id']]={'access_token':_0x57de59[_0xa795('0x1b')],'expires_in':moment()[_0xa795('0x25')](_0x57de59[_0xa795('0x1c')],_0xa795('0x26'))};_0x38e0d3(_0x57de59[_0xa795('0x1b')]);})['catch'](function(_0x53d087){logger[_0xa795('0x27')]('Failing\x20creating\x20the\x20access_token',_0x53d087[_0xa795('0x28')]);_0xfb754e(_0x53d087);});});}function getUser(_0x91bbde,_0x2dcb62,_0x312e36,_0x2bff3b){logger[_0xa795('0x29')](_0xa795('0x2a'));return request({'method':_0xa795('0x2b'),'uri':util[_0xa795('0x2c')](_0xa795('0x2d'),_0x2dcb62),'qs':{'type':_0xa795('0x2e')},'headers':{'Authorization':_0xa795('0x2f')+_0x91bbde},'json':!![]})[_0xa795('0x24')](function(_0x3c2097){if(_0x3c2097[_0xa795('0x30')]){var _0x5896c9=-0x1;if(_[_0xa795('0x31')](_0x3c2097[_0xa795('0x30')])){if(!_[_0xa795('0x32')](_0x2bff3b)){_0x5896c9=_['findIndex'](_0x3c2097[_0xa795('0x30')],function(_0x3d4666){return _0x3d4666[_0xa795('0x33')]===_0x2bff3b;});}if(_0x5896c9>=0x0){logger['info'](_0xa795('0x34'));}else{logger['info'](_0xa795('0x35'));_0x5896c9=_['findIndex'](_0x3c2097[_0xa795('0x30')],function(_0x31d7c8){return _0x31d7c8[_0xa795('0x36')][_0xa795('0x19')]===_0xa795('0x37');});}return _0x3c2097[_0xa795('0x30')][_0x5896c9];}else{if(_0x3c2097[_0xa795('0x38')]['profile'][_0xa795('0x19')]==='Administrator'){logger[_0xa795('0x29')](_0xa795('0x35'));user=_0x3c2097[_0xa795('0x38')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x3c2097));throw new Error(_0xa795('0x39')+JSON[_0xa795('0xd')](_0x3c2097));}}}else{logger[_0xa795('0x27')](_0xa795('0x3a'),JSON[_0xa795('0xd')](_0x3c2097));throw new Error(_0xa795('0x39')+JSON[_0xa795('0xd')](_0x3c2097));}})[_0xa795('0x3b')](function(_0x154a93){console[_0xa795('0x27')](_0x154a93);});}function getZohoUser(_0x2f4830,_0x65055f){return new BPromise(function(_0x4bc53a,_0x5190cc){request(_0x2f4830)[_0xa795('0x24')](function(_0x1be235){var _0x1dbb96=null;if(_0x1be235){_0x1dbb96=_0x1be235['data'][0x0];_0x1dbb96['enduserType']=_0x65055f;}_0x4bc53a(_0x1dbb96);})[_0xa795('0x3b')](function(_0x4ad308){_0x5190cc(_0x4ad308);});});}function createEndUser(_0x5e7d84,_0x50374b,_0x22940e,_0x5ca03d,_0x490156,_0x258e0c){var _0x22940e=getName(_0x22940e);return request({'method':_0xa795('0x21'),'uri':'https://www.zohoapis.'+_0x50374b+'/crm/v2/'+_[_0xa795('0x3c')](_0x258e0c['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x22940e[0x1],'First_Name':_0x22940e[0x0],'Phone':_0x5ca03d,'Owner':{'name':!_[_0xa795('0x32')](_0x490156['role'][_0xa795('0x19')])?_0x490156[_0xa795('0x3d')][_0xa795('0x19')]:!_[_0xa795('0x32')](_0x490156[_0xa795('0x3e')])?_0x490156[_0xa795('0x3e')]+'\x20'+_0x490156[_0xa795('0x3f')]:_0x490156['last_name'],'id':_0x490156['id']}}]},'headers':{'Authorization':_0xa795('0x2f')+_0x5e7d84},'json':!![]})[_0xa795('0x24')](function(_0x21c306){if(_0x21c306&&_0x21c306[_0xa795('0x40')][0x0][_0xa795('0x41')]==='SUCCESS'){var _0x2601f3=_0x21c306[_0xa795('0x40')][0x0][_0xa795('0x42')];_0x2601f3['enduserType']=_[_0xa795('0x3c')](_0x258e0c['moduleCreate'])+'s';return _0x2601f3;}logger[_0xa795('0x27')](_0xa795('0x3a'),JSON[_0xa795('0xd')](data));throw new Error(_0xa795('0x43')+JSON[_0xa795('0xd')](data));})[_0xa795('0x3b')](function(_0x499940){console[_0xa795('0x44')](_0xa795('0x45'),_0x499940);});}function getEndUser(_0x563a93,_0x170d6c,_0x1f40cb,_0xc0ba7b,_0x1bbbe0,_0x354ce8,_0x2a996b){var _0x4dd9de={'method':_0xa795('0x2b'),'uri':'','headers':{'Authorization':_0xa795('0x2f')+_0x563a93},'json':!![]};switch(_0x2a996b[_0xa795('0x46')]){case _0xa795('0x47'):_0x4dd9de[_0xa795('0x48')]=_0xa795('0x49')+_0x170d6c+_0xa795('0x4a')+_0x1bbbe0+'))';return getZohoUser(_0x4dd9de,_0xa795('0x4b'))[_0xa795('0x24')](function(_0x40cc2b){if(_0x40cc2b)return _0x40cc2b;_0x4dd9de[_0xa795('0x48')]=_0xa795('0x49')+_0x170d6c+_0xa795('0x4c')+_0x1bbbe0+'))';return getZohoUser(_0x4dd9de,_0xa795('0x4d'))[_0xa795('0x24')](function(_0x2034c0){if(_0x2034c0)return _0x2034c0;if(_0x2a996b[_0xa795('0x4e')]!=_0xa795('0x4f')){return createEndUser(_0x563a93,_0x170d6c,_0xc0ba7b,_0x1bbbe0,_0x354ce8,_0x2a996b);}else{return{};}});});break;case _0xa795('0x50'):_0x4dd9de['uri']=_0xa795('0x49')+_0x170d6c+_0xa795('0x4a')+_0x1bbbe0+'))';return getZohoUser(_0x4dd9de,_0xa795('0x4b'))[_0xa795('0x24')](function(_0x561e05){if(_0x561e05)return _0x561e05;if(_0x2a996b[_0xa795('0x4e')]!='nothing'){return createEndUser(_0x563a93,_0x170d6c,_0xc0ba7b,_0x1bbbe0,_0x354ce8,_0x2a996b);}else{return{};}});break;case _0xa795('0x51'):_0x4dd9de['uri']=_0xa795('0x49')+_0x170d6c+_0xa795('0x4c')+_0x1bbbe0+'))';return getZohoUser(_0x4dd9de,_0xa795('0x4d'))[_0xa795('0x24')](function(_0x28c49a){if(_0x28c49a)return _0x28c49a;if(_0x2a996b[_0xa795('0x4e')]!=_0xa795('0x4f')){return createEndUser(_0x563a93,_0x170d6c,_0xc0ba7b,_0x1bbbe0,_0x354ce8,_0x2a996b);}else{return{};}});break;}}function getCall(_0x1c8ba7,_0x63a9bd,_0x1c71f3,_0x5814f6,_0xa54144,_0x5f1604,_0x30e5d1,_0xad3d07){logger[_0xa795('0x29')](_0xa795('0x52'));var _0x3339a7={};_0x3339a7[_0xa795('0x53')]={'name':!_[_0xa795('0x32')](_0x5814f6[_0xa795('0x3d')][_0xa795('0x19')])&&!_[_0xa795('0x32')](_0x5814f6[_0xa795('0x36')][_0xa795('0x19')])&&_0x5814f6[_0xa795('0x36')][_0xa795('0x19')]==='administrator'?_0x5814f6[_0xa795('0x3d')]['name']:!_[_0xa795('0x32')](_0x5814f6[_0xa795('0x3e')])?_0x5814f6[_0xa795('0x3e')]+'\x20'+_0x5814f6[_0xa795('0x3f')]:_0x5814f6['last_name'],'id':_0x5814f6['id']};_0x3339a7[_0xa795('0x54')]=intUtil[_0xa795('0x55')](_0x5f1604[_0xa795('0x56')],_0x30e5d1,'\x20');_0x3339a7[_0xa795('0x57')]=intUtil[_0xa795('0x55')](_0x5f1604['Descriptions'],_0x30e5d1,'\x0a');if(_0xa54144['enduserType']===_0xa795('0x4b')){_0x3339a7[_0xa795('0x58')]={'name':!_[_0xa795('0x32')](_0xa54144[_0xa795('0x59')])?_0xa54144[_0xa795('0x59')]:!_[_0xa795('0x32')](_0xa54144[_0xa795('0x5a')])?_0xa54144[_0xa795('0x5a')]+'\x20'+_0xa54144[_0xa795('0x5b')]:_0xa54144[_0xa795('0x5b')],'id':_0xa54144['id']};}if(_0xa54144['enduserType']===_0xa795('0x4d')){_0x3339a7[_0xa795('0x5c')]={'name':!_[_0xa795('0x32')](_0xa54144[_0xa795('0x59')])?_0xa54144[_0xa795('0x59')]:!_[_0xa795('0x32')](_0xa54144[_0xa795('0x5a')])?_0xa54144[_0xa795('0x5a')]+'\x20'+_0xa54144[_0xa795('0x5b')]:_0xa54144['Last_Name'],'id':_0xa54144['id']};_0x3339a7[_0xa795('0x5d')]=_[_0xa795('0x3c')](_0xa54144['enduserType']);}if(_0x30e5d1[_0xa795('0x5e')]){_0x3339a7[_0xa795('0x5f')]=moment['utc'](parseInt(_0x30e5d1[_0xa795('0x5e')])*0x3e8)[_0xa795('0x2c')]('mm:ss');}else if(_0x30e5d1[_0xa795('0x60')]&&_0x30e5d1[_0xa795('0x61')]){_0x3339a7['Call_Duration']=moment[_0xa795('0x62')](moment(_0x30e5d1[_0xa795('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0xa795('0x63')](moment(_0x30e5d1[_0xa795('0x64')],_0xa795('0x65'))))[_0xa795('0x2c')]('mm:ss');}switch(_0x30e5d1[_0xa795('0x66')]){case _0xa795('0x67'):_0x3339a7[_0xa795('0x68')]=_0xa795('0x69');break;case _0xa795('0x6a'):case _0xa795('0x6b'):_0x3339a7[_0xa795('0x68')]=_0xa795('0x6c');break;case _0xa795('0x6d'):_0x3339a7['Call_Result']=_0xa795('0x6e');break;case'abandoned':_0x3339a7[_0xa795('0x68')]=_0xa795('0x6f');break;case _0xa795('0x70'):_0x3339a7['Call_Result']=_0xa795('0x71');default:}_0x3339a7[_0xa795('0x72')]=(_0xad3d07===_0xa795('0x73')?moment(_0x30e5d1['starttime'])['format'](_0xa795('0x65')):moment(_0x30e5d1[_0xa795('0x74')])[_0xa795('0x2c')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xa795('0x65'));_0x3339a7[_0xa795('0x75')]=_0xad3d07||_0xa795('0x76');_0x3339a7=_['merge'](_0x3339a7,getCustomFields(_0x5f1604[_0xa795('0x77')],_0x30e5d1));return request({'method':'POST','uri':_0xa795('0x49')+_0x63a9bd+_0xa795('0x78'),'headers':{'Authorization':_0xa795('0x2f')+_0x1c8ba7},'body':{'data':[_0x3339a7]},'json':!![]})[_0xa795('0x24')](function(_0x4625ee){if(_0x4625ee&&_0x4625ee[_0xa795('0x40')][0x0][_0xa795('0x41')]==='SUCCESS'){logger[_0xa795('0x29')]('Call\x20created!');return{'id':_0x4625ee[_0xa795('0x40')][0x0][_0xa795('0x42')]['id']};}})[_0xa795('0x3b')](function(_0x1a1db6){logger[_0xa795('0x29')]('err',_0x1a1db6[_0xa795('0x28')]);console[_0xa795('0x44')](_0xa795('0x79'),_0x1a1db6);});}exports['queue']=function(_0x5e2249,_0xf61dbd,_0x1a7d61,_0x2e2ed3,_0x1b3431,_0x5e0b9b){var _0x122f6c,_0xb4735c,_0x667930;_0x5e0b9b[_0xa795('0x7a')]=intUtil[_0xa795('0x7b')](_0x5e0b9b[_0xa795('0x7a')]);_0x5e0b9b[_0xa795('0x7c')]=intUtil[_0xa795('0x7b')](_0x5e0b9b[_0xa795('0x7c')]);if(_0x1b3431&&_0x1b3431[_0xa795('0x7d')]){logger[_0xa795('0x29')]('[QUEUE]',_0xa795('0x7e'));_0xf61dbd[_0xa795('0x7f')]=_0x5e0b9b[_0xa795('0x7c')]+_0xa795('0x80')+_0xf61dbd[_0xa795('0x81')]+_0xa795('0x82')+md5(_0xf61dbd[_0xa795('0x81')]);}else{_0xf61dbd['recordingURL']='';}var _0x4d96cc=_0x5e0b9b[_0xa795('0x7a')]===_0xa795('0x83')?'eu':'com';return getAccessToken(_0x5e0b9b)[_0xa795('0x24')](function(_0x48f62f){_0x667930=_0x48f62f;return getUser(_0x667930,_0x4d96cc,_0x5e0b9b,_0x2e2ed3['email']);})['then'](function(_0x235b19){_0x122f6c=_0x235b19;logger[_0xa795('0x29')](_0xa795('0x84'),_0x122f6c['id']);return getEndUser(_0x667930,_0x4d96cc,_0x5e0b9b,_0xf61dbd['calleridname'],_0xf61dbd['calleridnum'],_0x122f6c,_0x1a7d61);})[_0xa795('0x24')](function(_0x188400){_0xb4735c=_0x188400;return getCall(_0x667930,_0x4d96cc,_0x5e0b9b,_0x122f6c,_0xb4735c,_0x1a7d61,_0xf61dbd,_0xa795('0x76'));})[_0xa795('0x24')](function(_0x664869){if(_0x664869){logger[_0xa795('0x29')](_0xa795('0x85'),_0x664869['id']);logger['info'](_0xa795('0x86'),_0xa795('0x87'));emit(util[_0xa795('0x2c')](_0xa795('0x88'),_0x2e2ed3[_0xa795('0x19')]),_0xa795('0x89'),{'uri':_0xa795('0x8a')+_0x5e0b9b[_0xa795('0x7a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x664869['id']});}})[_0xa795('0x3b')](function(_0x4b724c){logger[_0xa795('0x27')](_0xa795('0x86'),JSON[_0xa795('0xd')](_0x4b724c));});};exports[_0xa795('0x73')]=function(_0x15d260,_0x4e17b8,_0x46de06,_0x4f25c7,_0x5aa99b,_0x2a4229,_0x5393a5){var _0x3d0cea,_0x468198,_0x52dfb4;_0x2a4229[_0xa795('0x7a')]=intUtil['stripTrailingSlash'](_0x2a4229[_0xa795('0x7a')]);_0x2a4229[_0xa795('0x7c')]=intUtil[_0xa795('0x7b')](_0x2a4229[_0xa795('0x7c')]);if(_0x5393a5&&_0x5393a5[_0xa795('0x8b')]&&_0x5393a5[_0xa795('0x8b')]!==_0xa795('0x8c')){logger[_0xa795('0x29')](_0xa795('0x8d'),_0xa795('0x7e'));_0x4e17b8['recordingURL']=_0x2a4229['serverUrl']+_0xa795('0x80')+_0x4e17b8['uniqueid']+_0xa795('0x82')+md5(_0x4e17b8[_0xa795('0x81')]);}var _0x356c17=_0x2a4229['host']===_0xa795('0x83')?'eu':_0xa795('0x8e');return getAccessToken(_0x2a4229)[_0xa795('0x24')](function(_0x39791b){_0x52dfb4=_0x39791b;return getUser(_0x52dfb4,_0x356c17,_0x2a4229,_0x4f25c7[_0xa795('0x33')]);})[_0xa795('0x24')](function(_0x4e6081){_0x3d0cea=_0x4e6081;logger[_0xa795('0x29')](_0xa795('0x84'),_0x3d0cea['id']);return getEndUser(_0x52dfb4,_0x356c17,_0x2a4229,_0x4e17b8['destcalleridname'],_0x4e17b8['destcalleridnum'],_0x3d0cea,_0x46de06);})[_0xa795('0x24')](function(_0x4e67e3){_0x468198=_0x4e67e3;return getCall(_0x52dfb4,_0x356c17,_0x2a4229,_0x3d0cea,_0x468198,_0x46de06,_0x4e17b8,'Outbound');})[_0xa795('0x24')](function(_0x407266){if(_0x407266){logger[_0xa795('0x29')]('The\x20Call\x20ID\x20is:',_0x407266['id']);logger[_0xa795('0x29')](_0xa795('0x8d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa795('0x2c')](_0xa795('0x88'),_0x4f25c7[_0xa795('0x19')]),'trigger:browser:url',{'uri':_0xa795('0x8a')+_0x2a4229[_0xa795('0x7a')]+_0xa795('0x8f')+_0x407266['id']});}})[_0xa795('0x3b')](function(_0x1d7815){logger[_0xa795('0x27')]('[OUTBOUND]',JSON[_0xa795('0xd')](_0x1d7815));});};exports['unmanaged']=function(_0x4663a0,_0x237bab,_0x497430,_0x5d4392,_0x5351eb,_0x4bdd86){var _0x285941,_0x2df6a6,_0x170e1f;_0x4bdd86[_0xa795('0x7a')]=intUtil[_0xa795('0x7b')](_0x4bdd86[_0xa795('0x7a')]);_0x4bdd86[_0xa795('0x7c')]=intUtil['stripTrailingSlash'](_0x4bdd86[_0xa795('0x7c')]);if(_0x5351eb&&_0x5351eb['monitor_format']){logger[_0xa795('0x29')]('['+_0x237bab[_0xa795('0x66')][_0xa795('0x90')]()+']',_0xa795('0x7e'));_0x237bab[_0xa795('0x7f')]=_0x4bdd86[_0xa795('0x7c')]+_0xa795('0x80')+_0x237bab[_0xa795('0x81')]+_0xa795('0x82')+md5(_0x237bab[_0xa795('0x81')]);}else{_0x237bab[_0xa795('0x7f')]='';}var _0x4508bb=_0x4bdd86[_0xa795('0x7a')]===_0xa795('0x83')?'eu':_0xa795('0x8e');return getAccessToken(_0x4bdd86)['then'](function(_0x46c30d){_0x170e1f=_0x46c30d;return getUser(_0x170e1f,_0x4508bb,_0x4bdd86);})[_0xa795('0x24')](function(_0x5715a2){_0x285941=_0x5715a2;logger[_0xa795('0x29')](_0xa795('0x84'),_0x285941['id']);return getEndUser(_0x170e1f,_0x4508bb,_0x4bdd86,_0x237bab[_0xa795('0x91')],_0x237bab[_0xa795('0x92')],_0x285941,_0x497430);})[_0xa795('0x24')](function(_0x391e57){_0x2df6a6=_0x391e57;return getCall(_0x170e1f,_0x4508bb,_0x4bdd86,_0x285941,_0x2df6a6,_0x497430,_0x237bab,_0xa795('0x76'));})[_0xa795('0x24')](function(_0x7a7f3b){if(_0x7a7f3b){logger[_0xa795('0x29')](_0xa795('0x85'),_0x7a7f3b['id']);}})[_0xa795('0x3b')](function(_0x481791){logger[_0xa795('0x27')]('['+_0x237bab['lastevent'][_0xa795('0x90')]()+']',JSON[_0xa795('0xd')](_0x481791));});}; \ 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 2e9b419..6821de3 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 _0xe601=['../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache'];(function(_0x33011e,_0x3aec60){var _0x301452=function(_0x35a3a5){while(--_0x35a3a5){_0x33011e['push'](_0x33011e['shift']());}};_0x301452(++_0x3aec60);}(_0xe601,0x7c));var _0x1e60=function(_0x5bc8a7,_0x4fdaf2){_0x5bc8a7=_0x5bc8a7-0x0;var _0x1f518e=_0xe601[_0x5bc8a7];return _0x1f518e;};'use strict';var util=require('util');var sh=require(_0x1e60('0x0'));var Mustache=require(_0x1e60('0x1'));var logger=require(_0x1e60('0x2'))(_0x1e60('0x3'));exports[_0x1e60('0x4')]=function(_0x40c4a2,_0x3efc33){var _0x3d4d40=_0x40c4a2[_0x1e60('0x5')]?_0x40c4a2[_0x1e60('0x5')]:_0x1e60('0x6');var _0x485b78=_0x40c4a2[_0x1e60('0x7')]?Mustache[_0x1e60('0x8')](_0x40c4a2[_0x1e60('0x7')],_0x3efc33):_0x3efc33;sh[_0x1e60('0x4')](_0x485b78,function(_0x185098,_0x148e9e,_0x439d2e){if(_0x185098!==0x0){logger[_0x1e60('0x9')](util[_0x1e60('0xa')](_0x1e60('0xb'),_0x3d4d40,_0x485b78,_0x185098,_0x439d2e));}else{logger[_0x1e60('0xc')](util[_0x1e60('0xa')](_0x1e60('0xd'),_0x3d4d40,_0x485b78,_0x148e9e));}});}; \ No newline at end of file +var _0x5ad1=['mustache','../../../../config/logger','trigger','data2','Script','render','data3','exec','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0x42be7a,_0x4cb6b4){var _0x20bfd4=function(_0x127293){while(--_0x127293){_0x42be7a['push'](_0x42be7a['shift']());}};_0x20bfd4(++_0x4cb6b4);}(_0x5ad1,0x67));var _0x15ad=function(_0x3907ab,_0x50fff5){_0x3907ab=_0x3907ab-0x0;var _0x5657b1=_0x5ad1[_0x3907ab];return _0x5657b1;};'use strict';var util=require('util');var sh=require(_0x15ad('0x0'));var Mustache=require(_0x15ad('0x1'));var logger=require(_0x15ad('0x2'))(_0x15ad('0x3'));exports['exec']=function(_0x4d66d7,_0x4569e8){var _0x35702e=_0x4d66d7[_0x15ad('0x4')]?_0x4d66d7[_0x15ad('0x4')]:_0x15ad('0x5');var _0x162701=_0x4d66d7['data3']?Mustache[_0x15ad('0x6')](_0x4d66d7[_0x15ad('0x7')],_0x4569e8):_0x4569e8;sh[_0x15ad('0x8')](_0x162701,function(_0x590181,_0x43111b,_0x4496e7){if(_0x590181!==0x0){logger[_0x15ad('0x9')](util[_0x15ad('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x35702e,_0x162701,_0x590181,_0x4496e7));}else{logger[_0x15ad('0xb')](util[_0x15ad('0xa')](_0x15ad('0xc'),_0x35702e,_0x162701,_0x43111b));}});}; \ 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 078442a..4091930 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 _0x0513=['body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','info','%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','lodash','trigger','exec','data1','render','data2','number','data5','data6','error','stack','POST','PUT','data7','parse'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x0513,0x1a4));var _0x3051=function(_0x318a06,_0x32c5ac){_0x318a06=_0x318a06-0x0;var _0x552d7b=_0x0513[_0x318a06];return _0x552d7b;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x3051('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x3051('0x1'));exports[_0x3051('0x2')]=function(_0x17e284,_0x30f05c){var _0x41205c,_0xddc29;var _0x29300b={'method':_0x17e284[_0x3051('0x3')]['toUpperCase'](),'uri':Mustache[_0x3051('0x4')](_0x17e284[_0x3051('0x5')],_0x30f05c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x17e284['data5'])===_0x3051('0x6')&&parseInt(_0x17e284[_0x3051('0x7')])>=0x1&&parseInt(_0x17e284['data5'])<=0xa?parseInt(_0x17e284[_0x3051('0x7')])*0x3e8:0x5*0x3e8};try{_0x29300b['headers']=_0x17e284[_0x3051('0x8')]?JSON['parse'](Mustache['render'](_0x17e284[_0x3051('0x8')],_0x30f05c)):{};}catch(_0x124fa5){logger[_0x3051('0x9')](_0x124fa5[_0x3051('0xa')]);}switch(_0x17e284[_0x3051('0x3')]['toUpperCase']()){case'GET':case'DELETE':_0x41205c=null;_0x29300b['qs']=_0x30f05c;break;case _0x3051('0xb'):case _0x3051('0xc'):if(_0x17e284[_0x3051('0xd')]){try{_0x41205c=JSON[_0x3051('0xe')](Mustache[_0x3051('0x4')](_0x17e284[_0x3051('0xd')],_0x30f05c));_0x29300b[_0x3051('0xf')]=_0x41205c;}catch(_0x465666){logger[_0x3051('0x9')](_0x465666[_0x3051('0xa')]);logger[_0x3051('0x9')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x41205c=_0x30f05c;_0x29300b[_0x3051('0xf')]=_0x41205c;}break;}logger['info'](util[_0x3051('0x10')](_0x3051('0x11'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],JSON[_0x3051('0x12')](_0x29300b)));rp(_0x29300b)['then'](function(_0x49704b){_0x41205c=!_[_0x3051('0x13')](_0x41205c)?_0x3051('0x14')+_0x41205c:'';_0xddc29=typeof _0x49704b[_0x3051('0xf')]===_0x3051('0x15')?JSON[_0x3051('0x12')](_0x49704b['body']):_0x49704b[_0x3051('0xf')];logger[_0x3051('0x16')](util[_0x3051('0x10')](_0x3051('0x17'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],_0x49704b[_0x3051('0x18')],_0xddc29));})[_0x3051('0x19')](function(_0x6082cd){logger[_0x3051('0x9')](util[_0x3051('0x10')](_0x3051('0x1a'),_0x17e284[_0x3051('0x3')],_0x17e284[_0x3051('0x5')],_0x6082cd[_0x3051('0x18')],_0x6082cd[_0x3051('0x1b')],_0x6082cd[_0x3051('0x1c')]));});}; \ No newline at end of file +var _0xf076=['../../../../config/logger','exec','data1','render','data5','number','headers','data6','parse','error','stack','toUpperCase','DELETE','POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','request-promise','util','lodash'];(function(_0x5c1911,_0x5063d9){var _0x360290=function(_0x5081a7){while(--_0x5081a7){_0x5c1911['push'](_0x5c1911['shift']());}};_0x360290(++_0x5063d9);}(_0xf076,0x105));var _0x6f07=function(_0x24a809,_0x2e3ea1){_0x24a809=_0x24a809-0x0;var _0x2b6c56=_0xf076[_0x24a809];return _0x2b6c56;};'use strict';var rp=require(_0x6f07('0x0'));var util=require(_0x6f07('0x1'));var _=require(_0x6f07('0x2'));var Mustache=require('mustache');var logger=require(_0x6f07('0x3'))('trigger');exports[_0x6f07('0x4')]=function(_0x4ab079,_0x52ef88){var _0x2dd63c,_0x46992d;var _0x4f3aab={'method':_0x4ab079[_0x6f07('0x5')]['toUpperCase'](),'uri':Mustache[_0x6f07('0x6')](_0x4ab079['data2'],_0x52ef88),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4ab079[_0x6f07('0x7')])===_0x6f07('0x8')&&parseInt(_0x4ab079[_0x6f07('0x7')])>=0x1&&parseInt(_0x4ab079[_0x6f07('0x7')])<=0xa?parseInt(_0x4ab079['data5'])*0x3e8:0x5*0x3e8};try{_0x4f3aab[_0x6f07('0x9')]=_0x4ab079[_0x6f07('0xa')]?JSON[_0x6f07('0xb')](Mustache['render'](_0x4ab079[_0x6f07('0xa')],_0x52ef88)):{};}catch(_0x174374){logger[_0x6f07('0xc')](_0x174374[_0x6f07('0xd')]);}switch(_0x4ab079[_0x6f07('0x5')][_0x6f07('0xe')]()){case'GET':case _0x6f07('0xf'):_0x2dd63c=null;_0x4f3aab['qs']=_0x52ef88;break;case _0x6f07('0x10'):case _0x6f07('0x11'):if(_0x4ab079[_0x6f07('0x12')]){try{_0x2dd63c=JSON[_0x6f07('0xb')](Mustache[_0x6f07('0x6')](_0x4ab079['data7'],_0x52ef88));_0x4f3aab['body']=_0x2dd63c;}catch(_0x2891f5){logger['error'](_0x2891f5[_0x6f07('0xd')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2dd63c=_0x52ef88;_0x4f3aab[_0x6f07('0x13')]=_0x2dd63c;}break;}logger[_0x6f07('0x14')](util[_0x6f07('0x15')](_0x6f07('0x16'),_0x4ab079[_0x6f07('0x5')],_0x4ab079[_0x6f07('0x17')],JSON[_0x6f07('0x18')](_0x4f3aab)));rp(_0x4f3aab)[_0x6f07('0x19')](function(_0x40e661){_0x2dd63c=!_[_0x6f07('0x1a')](_0x2dd63c)?_0x6f07('0x1b')+_0x2dd63c:'';_0x46992d=typeof _0x40e661[_0x6f07('0x13')]===_0x6f07('0x1c')?JSON[_0x6f07('0x18')](_0x40e661[_0x6f07('0x13')]):_0x40e661[_0x6f07('0x13')];logger['info'](util['format'](_0x6f07('0x1d'),_0x4ab079[_0x6f07('0x5')],_0x4ab079[_0x6f07('0x17')],_0x40e661[_0x6f07('0x1e')],_0x46992d));})['catch'](function(_0x2d9c33){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4ab079['data1'],_0x4ab079[_0x6f07('0x17')],_0x2d9c33[_0x6f07('0x1e')],_0x2d9c33[_0x6f07('0x1f')],_0x2d9c33[_0x6f07('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 333cc48..62b6484 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 _0xff85=['client','http','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff85,0x10d));var _0x5ff8=function(_0x131931,_0x4d5255){_0x131931=_0x131931-0x0;var _0x4083d4=_0xff85[_0x131931];return _0x4083d4;};'use strict';var jayson=require(_0x5ff8('0x0'));var BPromise=require(_0x5ff8('0x1'));var logger=require(_0x5ff8('0x2'))(_0x5ff8('0x3'));var client=jayson[_0x5ff8('0x4')][_0x5ff8('0x5')]({'port':0x2329});client['Request']=function(_0x51f598,_0x59d0b5){return new BPromise(function(_0x41db23,_0x4e8ce8){return client['request'](_0x51f598,_0x59d0b5)[_0x5ff8('0x6')](function(_0x5885ff){logger[_0x5ff8('0x7')](_0x5ff8('0x8'),_0x5ff8('0x3'),_0x51f598,_0x59d0b5,_0x5885ff);if(_0x5885ff[_0x5ff8('0x9')]){logger[_0x5ff8('0x9')]('rpc',_0x5ff8('0x3'),_0x51f598,_0x5885ff[_0x5ff8('0x9')]['message'],_0x59d0b5);return _0x4e8ce8(_0x5885ff[_0x5ff8('0x9')][_0x5ff8('0xa')]);}else{return _0x41db23(_0x5885ff[_0x5ff8('0xb')]);}})['catch'](function(_0x47da11){logger[_0x5ff8('0x9')](_0x5ff8('0x8'),'routing',_0x51f598,_0x47da11,_0x59d0b5);return _0x4e8ce8(_0x47da11);});});};module[_0x5ff8('0xc')]=client; \ No newline at end of file +var _0x0a92=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','then','debug','rpc','error','message','result'];(function(_0x1e8074,_0x363645){var _0x3f7da2=function(_0x37d192){while(--_0x37d192){_0x1e8074['push'](_0x1e8074['shift']());}};_0x3f7da2(++_0x363645);}(_0x0a92,0x1c2));var _0x20a9=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0x0a92[_0x37b1d8];return _0x3739e7;};'use strict';var jayson=require(_0x20a9('0x0'));var BPromise=require(_0x20a9('0x1'));var logger=require(_0x20a9('0x2'))(_0x20a9('0x3'));var client=jayson[_0x20a9('0x4')][_0x20a9('0x5')]({'port':0x2329});client['Request']=function(_0x27eca2,_0x27eea0){return new BPromise(function(_0x3b1775,_0xc4f79){return client['request'](_0x27eca2,_0x27eea0)[_0x20a9('0x6')](function(_0x2f557d){logger[_0x20a9('0x7')](_0x20a9('0x8'),'routing',_0x27eca2,_0x27eea0,_0x2f557d);if(_0x2f557d[_0x20a9('0x9')]){logger[_0x20a9('0x9')](_0x20a9('0x8'),_0x20a9('0x3'),_0x27eca2,_0x2f557d[_0x20a9('0x9')][_0x20a9('0xa')],_0x27eea0);return _0xc4f79(_0x2f557d[_0x20a9('0x9')][_0x20a9('0xa')]);}else{return _0x3b1775(_0x2f557d[_0x20a9('0xb')]);}})[_0x20a9('0xc')](function(_0x228465){logger[_0x20a9('0x9')]('rpc',_0x20a9('0x3'),_0x27eca2,_0x228465,_0x27eea0);return _0xc4f79(_0x228465);});});};module[_0x20a9('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index dbf8e2e..d28a901 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 _0xaf8f=['loginMailFrequency','error','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x3ef4a9,_0xd0d094){var _0x459339=function(_0x3a3fdb){while(--_0x3a3fdb){_0x3ef4a9['push'](_0x3ef4a9['shift']());}};_0x459339(++_0xd0d094);}(_0xaf8f,0xa7));var _0xfaf8=function(_0x1cc3eb,_0x1e26f9){_0x1cc3eb=_0x1cc3eb-0x0;var _0x3ac1c9=_0xaf8f[_0x1cc3eb];return _0x3ac1c9;};'use strict';var server=require(_0xfaf8('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xfaf8('0x1'));var mailAccount=require(_0xfaf8('0x2'));var setting=require(_0xfaf8('0x3'));var logger=require(_0xfaf8('0x4'))(_0xfaf8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xfaf8('0x6')](mailAccount[_0xfaf8('0x7')]())[_0xfaf8('0x6')](realtime[_0xfaf8('0x8')]())[_0xfaf8('0x6')](function(){email[_0xfaf8('0x9')](realtime[_0xfaf8('0xa')]);return realtime;});}function main(){return server[_0xfaf8('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0xfaf8('0x6')](function(){return setting[_0xfaf8('0xc')]();})['then'](function(_0x1f70ed){return setInterval(initRealtime,_0x1f70ed[_0xfaf8('0xd')]*0x3e8);})['catch'](function(_0x232fc6){logger[_0xfaf8('0xe')]('Email\x20service\x20initialization',_0x232fc6);});}main(); \ No newline at end of file +var _0x7775=['./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','then','refresh','mailAccounts','listen','catch','Email\x20service\x20initialization','./server'];(function(_0x13c722,_0x5b4caa){var _0xa2b6f8=function(_0x316532){while(--_0x316532){_0x13c722['push'](_0x13c722['shift']());}};_0xa2b6f8(++_0x5b4caa);}(_0x7775,0x133));var _0x5777=function(_0x12ce4c,_0xc7c660){_0x12ce4c=_0x12ce4c-0x0;var _0x37c624=_0x7775[_0x12ce4c];return _0x37c624;};'use strict';var server=require(_0x5777('0x0'));var Realtime=require(_0x5777('0x1'));var EmailChannel=require(_0x5777('0x2'));var mailAccount=require(_0x5777('0x3'));var setting=require(_0x5777('0x4'));var logger=require(_0x5777('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x5777('0x6')]()['then'](mailAccount[_0x5777('0x7')]())[_0x5777('0x8')](realtime['initMailAccounts']())[_0x5777('0x8')](function(){email[_0x5777('0x9')](realtime[_0x5777('0xa')]);return realtime;});}function main(){return server[_0x5777('0xb')](realtime,email)[_0x5777('0x8')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x5777('0x8')](function(_0x1313bf){return setInterval(initRealtime,_0x1313bf['loginMailFrequency']*0x3e8);})[_0x5777('0xc')](function(_0x1b4c00){logger['error'](_0x5777('0xd'),_0x1b4c00);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 37cdc73..2ade154 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 _0x2e1f=['then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','smtp','verifySmtp','Smtp','verified','verify','exports','lodash','bluebird','md5','ioredis','redis','localhost','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','service','box','handleImapBox','bind','email','handleImapEnd','error','disabled','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify'];(function(_0x43379c,_0x271d36){var _0x495648=function(_0x3f4652){while(--_0x3f4652){_0x43379c['push'](_0x43379c['shift']());}};_0x495648(++_0x271d36);}(_0x2e1f,0x1e1));var _0xf2e1=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x2e1f[_0x13187a];return _0x65b85f;};'use strict';var _=require(_0xf2e1('0x0'));var moment=require('moment');var BPromise=require(_0xf2e1('0x1'));var md5=require(_0xf2e1('0x2'));var Redis=require(_0xf2e1('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0xf2e1('0x4')]=_['defaults'](config[_0xf2e1('0x4')],{'host':_0xf2e1('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xf2e1('0x6'));var md5Accounts={};function EmailChannel(_0x2d5b74){logger['info'](_0xf2e1('0x7'));this['mailAccounts']=_0x2d5b74[_0xf2e1('0x8')];this[_0xf2e1('0x9')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xf2e1('0xa')][_0xf2e1('0xb')]=function(_0x38ef48){var _0x2a7d9c=this['mailAccounts'][_0x38ef48];var _0x5e94d7={'id':_0x2a7d9c['id'],'name':_0x2a7d9c[_0xf2e1('0xc')],'key':_0x2a7d9c['key'],'active':_0x2a7d9c[_0xf2e1('0xd')],'Imap':{'status':_0x2a7d9c['Imap'][_0xf2e1('0xe')],'messageStatus':_0x2a7d9c[_0xf2e1('0xf')][_0xf2e1('0x10')],'total':_0x2a7d9c[_0xf2e1('0xf')][_0xf2e1('0x11')]}};if(_[_0xf2e1('0x12')](md5Accounts[_0x38ef48])){md5Accounts[_0x38ef48]={};}var _0x5d41ee=md5(JSON[_0xf2e1('0x13')](_0x5e94d7));if(md5Accounts[_0x38ef48][_0xf2e1('0x2')]!==_0x5d41ee){md5Accounts[_0x38ef48][_0xf2e1('0x2')]=_0x5d41ee;io['emit'](_0xf2e1('0x14'),_0x5e94d7);}};EmailChannel[_0xf2e1('0xa')]['refresh']=function(_0x4f707a){for(var _0x1bd5cd in _0x4f707a){if(_0x4f707a['hasOwnProperty'](_0x1bd5cd)){if(_0x4f707a[_0x1bd5cd][_0xf2e1('0xf')]&&_0x4f707a[_0x1bd5cd][_0xf2e1('0xd')]){var _0x11ea4d=_0x4f707a[_0x1bd5cd][_0xf2e1('0xf')];if(!_0x11ea4d['service']&&_0x4f707a[_0x1bd5cd]['provider']!=='custom')_0x11ea4d[_0xf2e1('0x15')]=_0x4f707a[_0x1bd5cd]['provider'];if(!this['imapAccounts']['hasOwnProperty'](_0x11ea4d['id'])){this[_0xf2e1('0x9')][_0x11ea4d['id']]=new EmailImap(_0x11ea4d,_0x4f707a[_0x1bd5cd]['email']);this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x16'),this[_0xf2e1('0x17')][_0xf2e1('0x18')](this,_0x1bd5cd));this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x19'),this['handleImapEmail'][_0xf2e1('0x18')](this,_0x1bd5cd));this['imapAccounts'][_0x11ea4d['id']]['on']('end',this[_0xf2e1('0x1a')][_0xf2e1('0x18')](this,_0x1bd5cd));this[_0xf2e1('0x9')][_0x11ea4d['id']]['on'](_0xf2e1('0x1b'),this['handleImapError']['bind'](this,_0x1bd5cd));}}else{if(_['isNil'](this[_0xf2e1('0x8')][_0x1bd5cd]['Imap'])){this[_0xf2e1('0x8')][_0x1bd5cd]['Imap']={};}this['mailAccounts'][_0x1bd5cd]['Imap']['status']=_0xf2e1('0x1c');this[_0xf2e1('0x8')][_0x1bd5cd]['Imap']['messageStatus']='';this['emit'](_0x1bd5cd);}}}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x17')]=function(_0x19d478,_0x423115){if(this['mailAccounts'][_0x19d478]){this[_0xf2e1('0x8')][_0x19d478][_0xf2e1('0xf')]['status']=_0xf2e1('0x1d');this[_0xf2e1('0x8')][_0x19d478]['Imap']['messageStatus']=_0x423115['name'];if(_0x423115[_0xf2e1('0x1e')]){this['mailAccounts'][_0x19d478][_0xf2e1('0xf')]['total']=_0x423115['messages'][_0xf2e1('0x11')];}return this[_0xf2e1('0xb')](_0x19d478);}};EmailChannel['prototype'][_0xf2e1('0x1f')]=function(_0x3f83ca,_0x593024){logger[_0xf2e1('0x20')](_0xf2e1('0x21'),_0x593024[_0xf2e1('0x22')],_0x593024['lastName'],_0x593024['from'],_0x3f83ca);if(this[_0xf2e1('0x8')][_0x3f83ca]){return mailAccount[_0xf2e1('0x23')](_0x3f83ca,_0x593024)[_0xf2e1('0x24')](function(_0x3338ad){if(_0x3338ad){logger[_0xf2e1('0x20')](_0xf2e1('0x25'));}})[_0xf2e1('0x26')](function(_0x34da68){logger[_0xf2e1('0x1b')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x34da68));});}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x1a')]=function(_0xd2a57a){if(this['mailAccounts'][_0xd2a57a]&&this['mailAccounts'][_0xd2a57a][_0xf2e1('0xf')]){if(this[_0xf2e1('0x9')][this[_0xf2e1('0x8')][_0xd2a57a][_0xf2e1('0xf')]['id']]){delete this[_0xf2e1('0x9')][this[_0xf2e1('0x8')][_0xd2a57a][_0xf2e1('0xf')]['id']];}this[_0xf2e1('0x8')][_0xd2a57a]['Imap'][_0xf2e1('0x27')]=moment();this[_0xf2e1('0xb')](_0xd2a57a);}};EmailChannel[_0xf2e1('0xa')]['handleImapError']=function(_0xcb891c,_0x40ade2){if(this[_0xf2e1('0x8')][_0xcb891c]){this['mailAccounts'][_0xcb891c][_0xf2e1('0xf')][_0xf2e1('0xe')]=_0xf2e1('0x1b');this[_0xf2e1('0x8')][_0xcb891c][_0xf2e1('0xf')][_0xf2e1('0x10')]=_0x40ade2;return this[_0xf2e1('0xb')](_0xcb891c);}};EmailChannel[_0xf2e1('0xa')][_0xf2e1('0x28')]=function(_0x440553,_0x133af8){return this[_0xf2e1('0x29')]['send'](_0x440553,_0x133af8);};EmailChannel['prototype'][_0xf2e1('0x2a')]=function(_0x1f2439){var _0xc4a66f=this;if(this[_0xf2e1('0x8')][_0x1f2439['id']]){if(_[_0xf2e1('0x12')](this[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')])){this['mailAccounts'][_0x1f2439['id']][_0xf2e1('0x2b')]={};}this[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0x27')]=moment();return new BPromise(function(_0x4db16d,_0x397d01){return _0xc4a66f[_0xf2e1('0x29')]['verify'](_0x1f2439)[_0xf2e1('0x24')](function(_0x5b1875){_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0xe')]=_0xf2e1('0x2c');_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0x10')]='';_0xc4a66f['emit'](_0x1f2439['id']);_0x4db16d(_0x5b1875);})[_0xf2e1('0x26')](function(_0x1424e9){_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']][_0xf2e1('0x2b')][_0xf2e1('0xe')]=_0xf2e1('0x1b');_0xc4a66f[_0xf2e1('0x8')][_0x1f2439['id']]['Smtp'][_0xf2e1('0x10')]=_0x1424e9;_0xc4a66f[_0xf2e1('0xb')](_0x1f2439['id']);_0x397d01(_0x1424e9);});});}return this['smtp'][_0xf2e1('0x2d')](_0x1f2439);};module[_0xf2e1('0x2e')]=EmailChannel; \ No newline at end of file +var _0x12c7=['send','Smtp','verify','verified','exports','moment','ioredis','../../../config/logger','email','redis','localhost','./imap','./smtp','info','start\x20email\x20channel','smtp','prototype','emit','mailAccounts','name','active','Imap','status','messageStatus','total','isNil','stringify','md5','refresh','provider','custom','service','imapAccounts','hasOwnProperty','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s'];(function(_0x250da2,_0x1bc4b8){var _0x146075=function(_0xa4bca2){while(--_0xa4bca2){_0x250da2['push'](_0x250da2['shift']());}};_0x146075(++_0x1bc4b8);}(_0x12c7,0x137));var _0x712c=function(_0x5026e1,_0x5297c0){_0x5026e1=_0x5026e1-0x0;var _0x58919e=_0x12c7[_0x5026e1];return _0x58919e;};'use strict';var _=require('lodash');var moment=require(_0x712c('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x712c('0x1'));var config=require('../../../config/environment');var logger=require(_0x712c('0x2'))(_0x712c('0x3'));config['redis']=_['defaults'](config[_0x712c('0x4')],{'host':_0x712c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x712c('0x4')]));var EmailImap=require(_0x712c('0x6'));var EmailSmtp=require(_0x712c('0x7'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x292687){logger[_0x712c('0x8')](_0x712c('0x9'));this['mailAccounts']=_0x292687['mailAccounts'];this['imapAccounts']={};this[_0x712c('0xa')]=new EmailSmtp();}EmailChannel[_0x712c('0xb')][_0x712c('0xc')]=function(_0x5eb97a){var _0x43af89=this[_0x712c('0xd')][_0x5eb97a];var _0x4be37f={'id':_0x43af89['id'],'name':_0x43af89[_0x712c('0xe')],'key':_0x43af89['key'],'active':_0x43af89[_0x712c('0xf')],'Imap':{'status':_0x43af89[_0x712c('0x10')][_0x712c('0x11')],'messageStatus':_0x43af89[_0x712c('0x10')][_0x712c('0x12')],'total':_0x43af89[_0x712c('0x10')][_0x712c('0x13')]}};if(_[_0x712c('0x14')](md5Accounts[_0x5eb97a])){md5Accounts[_0x5eb97a]={};}var _0x4d3373=md5(JSON[_0x712c('0x15')](_0x4be37f));if(md5Accounts[_0x5eb97a][_0x712c('0x16')]!==_0x4d3373){md5Accounts[_0x5eb97a][_0x712c('0x16')]=_0x4d3373;io[_0x712c('0xc')]('mailAccount:update',_0x4be37f);}};EmailChannel[_0x712c('0xb')][_0x712c('0x17')]=function(_0xc96c55){for(var _0x1fd16f in _0xc96c55){if(_0xc96c55['hasOwnProperty'](_0x1fd16f)){if(_0xc96c55[_0x1fd16f][_0x712c('0x10')]&&_0xc96c55[_0x1fd16f][_0x712c('0xf')]){var _0x332e4a=_0xc96c55[_0x1fd16f]['Imap'];if(!_0x332e4a['service']&&_0xc96c55[_0x1fd16f][_0x712c('0x18')]!==_0x712c('0x19'))_0x332e4a[_0x712c('0x1a')]=_0xc96c55[_0x1fd16f][_0x712c('0x18')];if(!this[_0x712c('0x1b')][_0x712c('0x1c')](_0x332e4a['id'])){this['imapAccounts'][_0x332e4a['id']]=new EmailImap(_0x332e4a,_0xc96c55[_0x1fd16f][_0x712c('0x3')]);this[_0x712c('0x1b')][_0x332e4a['id']]['on']('box',this[_0x712c('0x1d')]['bind'](this,_0x1fd16f));this[_0x712c('0x1b')][_0x332e4a['id']]['on'](_0x712c('0x3'),this[_0x712c('0x1e')]['bind'](this,_0x1fd16f));this[_0x712c('0x1b')][_0x332e4a['id']]['on'](_0x712c('0x1f'),this[_0x712c('0x20')][_0x712c('0x21')](this,_0x1fd16f));this[_0x712c('0x1b')][_0x332e4a['id']]['on'](_0x712c('0x22'),this[_0x712c('0x23')][_0x712c('0x21')](this,_0x1fd16f));}}else{if(_[_0x712c('0x14')](this[_0x712c('0xd')][_0x1fd16f][_0x712c('0x10')])){this['mailAccounts'][_0x1fd16f][_0x712c('0x10')]={};}this[_0x712c('0xd')][_0x1fd16f][_0x712c('0x10')][_0x712c('0x11')]=_0x712c('0x24');this[_0x712c('0xd')][_0x1fd16f]['Imap'][_0x712c('0x12')]='';this[_0x712c('0xc')](_0x1fd16f);}}}};EmailChannel['prototype'][_0x712c('0x1d')]=function(_0x2a627c,_0x1ecbff){if(this[_0x712c('0xd')][_0x2a627c]){this['mailAccounts'][_0x2a627c]['Imap'][_0x712c('0x11')]='connected';this[_0x712c('0xd')][_0x2a627c][_0x712c('0x10')][_0x712c('0x12')]=_0x1ecbff[_0x712c('0xe')];if(_0x1ecbff[_0x712c('0x25')]){this[_0x712c('0xd')][_0x2a627c][_0x712c('0x10')]['total']=_0x1ecbff['messages'][_0x712c('0x13')];}return this['emit'](_0x2a627c);}};EmailChannel['prototype']['handleImapEmail']=function(_0x563da,_0x509b3b){logger[_0x712c('0x8')](_0x712c('0x26'),_0x509b3b[_0x712c('0x27')],_0x509b3b[_0x712c('0x28')],_0x509b3b['from'],_0x563da);if(this[_0x712c('0xd')][_0x563da]){return mailAccount[_0x712c('0x29')](_0x563da,_0x509b3b)[_0x712c('0x2a')](function(_0x34a229){if(_0x34a229){logger[_0x712c('0x8')](_0x712c('0x2b'));}})[_0x712c('0x2c')](function(_0x558086){logger[_0x712c('0x22')](_0x712c('0x2d'),JSON[_0x712c('0x15')](_0x558086));});}};EmailChannel[_0x712c('0xb')][_0x712c('0x20')]=function(_0x53220a){if(this[_0x712c('0xd')][_0x53220a]&&this['mailAccounts'][_0x53220a][_0x712c('0x10')]){if(this[_0x712c('0x1b')][this[_0x712c('0xd')][_0x53220a][_0x712c('0x10')]['id']]){delete this[_0x712c('0x1b')][this[_0x712c('0xd')][_0x53220a][_0x712c('0x10')]['id']];}this[_0x712c('0xd')][_0x53220a][_0x712c('0x10')]['lastSync']=moment();this[_0x712c('0xc')](_0x53220a);}};EmailChannel[_0x712c('0xb')][_0x712c('0x23')]=function(_0x37d163,_0x1b34f4){if(this['mailAccounts'][_0x37d163]){this['mailAccounts'][_0x37d163][_0x712c('0x10')][_0x712c('0x11')]=_0x712c('0x22');this[_0x712c('0xd')][_0x37d163]['Imap']['messageStatus']=_0x1b34f4;return this['emit'](_0x37d163);}};EmailChannel[_0x712c('0xb')]['sendMail']=function(_0x374d8b,_0x1cb0e8){return this['smtp'][_0x712c('0x2e')](_0x374d8b,_0x1cb0e8);};EmailChannel[_0x712c('0xb')]['verifySmtp']=function(_0x51e4eb){var _0x295435=this;if(this[_0x712c('0xd')][_0x51e4eb['id']]){if(_[_0x712c('0x14')](this[_0x712c('0xd')][_0x51e4eb['id']][_0x712c('0x2f')])){this[_0x712c('0xd')][_0x51e4eb['id']][_0x712c('0x2f')]={};}this[_0x712c('0xd')][_0x51e4eb['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x5b96e1,_0x37543e){return _0x295435['smtp'][_0x712c('0x30')](_0x51e4eb)[_0x712c('0x2a')](function(_0x3cf23c){_0x295435[_0x712c('0xd')][_0x51e4eb['id']]['Smtp'][_0x712c('0x11')]=_0x712c('0x31');_0x295435['mailAccounts'][_0x51e4eb['id']][_0x712c('0x2f')][_0x712c('0x12')]='';_0x295435[_0x712c('0xc')](_0x51e4eb['id']);_0x5b96e1(_0x3cf23c);})[_0x712c('0x2c')](function(_0x30c997){_0x295435[_0x712c('0xd')][_0x51e4eb['id']][_0x712c('0x2f')][_0x712c('0x11')]='error';_0x295435['mailAccounts'][_0x51e4eb['id']][_0x712c('0x2f')][_0x712c('0x12')]=_0x30c997;_0x295435[_0x712c('0xc')](_0x51e4eb['id']);_0x37543e(_0x30c997);});});}return this[_0x712c('0xa')][_0x712c('0x30')](_0x51e4eb);};module[_0x712c('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 43ee969..6adedff 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 _0x613f=['../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','iconv','Iconv','./utils'];(function(_0xaa6fe5,_0x4d4520){var _0x2eeeb8=function(_0x2e3d8c){while(--_0x2e3d8c){_0xaa6fe5['push'](_0xaa6fe5['shift']());}};_0x2eeeb8(++_0x4d4520);}(_0x613f,0xea));var _0xf613=function(_0x1943fb,_0x3a8d99){_0x1943fb=_0x1943fb-0x0;var _0x3361bd=_0x613f[_0x1943fb];return _0x3361bd;};'use strict';var _=require(_0xf613('0x0'));var util=require('util');var Imap=require(_0xf613('0x1'));var simpleParser=require(_0xf613('0x2'))['simpleParser'];var Iconv=require(_0xf613('0x3'))[_0xf613('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xf613('0x5'));var logger=require(_0xf613('0x6'))(_0xf613('0x7'));function EmailImap(_0x237fec,_0x486b66){this[_0xf613('0x8')]=_0x237fec[_0xf613('0x8')];this[_0xf613('0x9')]=this['getAccount'](_0x237fec,_0x486b66);this['imap']=new Imap(this[_0xf613('0x9')]);this['imap'][_0xf613('0xa')](_0xf613('0xb'),this[_0xf613('0xc')][_0xf613('0xd')](this));this[_0xf613('0x1')][_0xf613('0xa')](_0xf613('0xe'),this[_0xf613('0xf')]['bind'](this));this[_0xf613('0x1')]['on'](_0xf613('0x10'),this[_0xf613('0x11')]['bind'](this));this[_0xf613('0x1')]['connect']();}util[_0xf613('0x12')](EmailImap,EventEmitter);EmailImap[_0xf613('0x13')][_0xf613('0x14')]=function(_0x83c1ef,_0x749857){var _0x5da546={'connTimeout':_0x83c1ef[_0xf613('0x15')]?_0x83c1ef[_0xf613('0x15')]*0x3e8:0x2710,'authTimeout':_0x83c1ef[_0xf613('0x16')]?_0x83c1ef[_0xf613('0x16')]*0x3e8:0x1388};if(_0x83c1ef[_0xf613('0x17')]){_0x5da546[_0xf613('0x18')]=_0x83c1ef[_0xf613('0x18')];if(_0x83c1ef[_0xf613('0x19')]){_0x5da546[_0xf613('0x1a')]=utils[_0xf613('0x1b')](_0x83c1ef[_0xf613('0x1c')][_0xf613('0x1d')],_0x83c1ef[_0xf613('0x18')]);}else{_0x5da546['password']=_0x83c1ef[_0xf613('0x1e')];}}else{if(_0x83c1ef[_0xf613('0x1f')]){_0x5da546[_0xf613('0x18')]=_0x83c1ef[_0xf613('0x18')];_0x5da546[_0xf613('0x1e')]=_0x83c1ef[_0xf613('0x1e')];}}_0x5da546['email']=_0x749857||_0x83c1ef[_0xf613('0x18')]||_0xf613('0x20');_0x5da546[_0xf613('0x21')]=_0x83c1ef[_0xf613('0x21')];_0x5da546[_0xf613('0x22')]=_0x83c1ef[_0xf613('0x22')]||0x3e1;if(_0x83c1ef[_0xf613('0x23')]){_0x5da546[_0xf613('0x23')]=!![];}else{_0x5da546[_0xf613('0x23')]=![];_0x5da546[_0xf613('0x24')]='required';}return _0x5da546;};EmailImap['prototype'][_0xf613('0xc')]=function(){this[_0xf613('0x1')]['openBox'](this[_0xf613('0x8')],![],this[_0xf613('0x25')]['bind'](this));};EmailImap['prototype'][_0xf613('0x25')]=function(_0xa4123a,_0x35636b){if(_0xa4123a){this[_0xf613('0x11')](_0xa4123a,!![]);}else{this[_0xf613('0x26')]('box',_0x35636b);this[_0xf613('0x27')]();}};EmailImap[_0xf613('0x13')][_0xf613('0x28')]=function(_0x5d6425){if(_0x5d6425){this['handleError'](_0x5d6425,!![]);}else{this[_0xf613('0x1')]['end']();}};EmailImap[_0xf613('0x13')][_0xf613('0x27')]=function(){this['imap'][_0xf613('0x29')]([_0xf613('0x2a')],this[_0xf613('0x2b')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x2b')]=function(_0x286464,_0x207443){if(_0x286464){this[_0xf613('0x11')](_0x286464,!![]);}else{if(_0x207443['length']){try{var _0x41260b=this[_0xf613('0x1')][_0xf613('0x2c')](_0x207443,{'bodies':'','markSeen':!![]});_0x41260b['on'](_0xf613('0x2d'),this[_0xf613('0x2e')][_0xf613('0xd')](this));_0x41260b['once'](_0xf613('0x10'),this[_0xf613('0x2f')][_0xf613('0xd')](this));_0x41260b[_0xf613('0xa')]('end',this[_0xf613('0x30')][_0xf613('0xd')](this));}catch(_0xbd17bd){logger[_0xf613('0x10')](_0xbd17bd);}}else{this['imap'][_0xf613('0x31')](!![],this['handleCloseBox'][_0xf613('0xd')](this));}}};EmailImap[_0xf613('0x13')]['handleFetchMessage']=function(_0x45d1b3){_0x45d1b3['on'](_0xf613('0x32'),this[_0xf613('0x33')]['bind'](this));_0x45d1b3[_0xf613('0xa')]('attributes',this[_0xf613('0x34')]['bind'](this));_0x45d1b3[_0xf613('0xa')](_0xf613('0xe'),this[_0xf613('0x35')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x33')]=function(_0x38afcf){simpleParser(_0x38afcf,{'Iconv':Iconv},this[_0xf613('0x36')]['bind'](this));};EmailImap[_0xf613('0x13')][_0xf613('0x34')]=function(){};EmailImap[_0xf613('0x13')][_0xf613('0x35')]=function(){};EmailImap[_0xf613('0x13')][_0xf613('0x36')]=function(_0x1033c8,_0x2e97e1){if(_0x1033c8){logger[_0xf613('0x10')](_0x1033c8);}else{var _0x49ae20=this;utils['parser'](this[_0xf613('0x9')],_0x2e97e1,function(_0x5b560b){_0x49ae20[_0xf613('0x26')](_0xf613('0x7'),_0x5b560b);});}};EmailImap[_0xf613('0x13')][_0xf613('0x30')]=function(){this[_0xf613('0x1')][_0xf613('0x31')](!![],this[_0xf613('0x28')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0x2f')]=function(_0x36c560){this[_0xf613('0x11')](_0x36c560);this[_0xf613('0x1')][_0xf613('0x31')](!![],this[_0xf613('0x28')][_0xf613('0xd')](this));};EmailImap[_0xf613('0x13')][_0xf613('0xf')]=function(){this[_0xf613('0x26')](_0xf613('0xe'));};EmailImap[_0xf613('0x13')][_0xf613('0x11')]=function(_0x1f442c,_0x12f25a){logger[_0xf613('0x10')]('handleError',this[_0xf613('0x9')][_0xf613('0x7')],JSON[_0xf613('0x37')](_0x1f442c));var _0x4ecc21='';if(_0x1f442c){if(_0x1f442c[_0xf613('0x38')]){_0x4ecc21=_0x1f442c['textCode'];}else{for(var _0x5324ad in _0x1f442c){if(_0x1f442c[_0xf613('0x39')](_0x5324ad)){_0x4ecc21+=_[_0xf613('0x3a')](_0x5324ad)+':\x20'+_0x1f442c[_0x5324ad]+'\x0a';}}}}if(_0x12f25a){this[_0xf613('0x1')][_0xf613('0xe')]();}else{this[_0xf613('0x26')](_0xf613('0x10'),_0x4ecc21);this[_0xf613('0x26')](_0xf613('0xe'));}};module[_0xf613('0x3b')]=EmailImap; \ No newline at end of file +var _0xdbf3=['util','imap','simpleParser','iconv','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','lodash'];(function(_0x2027f5,_0x5a68c1){var _0x346d21=function(_0x28735c){while(--_0x28735c){_0x2027f5['push'](_0x2027f5['shift']());}};_0x346d21(++_0x5a68c1);}(_0xdbf3,0x19c));var _0x3dbf=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xdbf3[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x3dbf('0x0'));var util=require(_0x3dbf('0x1'));var Imap=require(_0x3dbf('0x2'));var simpleParser=require('mailparser')[_0x3dbf('0x3')];var Iconv=require(_0x3dbf('0x4'))['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x3dbf('0x5'));var logger=require(_0x3dbf('0x6'))(_0x3dbf('0x7'));function EmailImap(_0x3b68cc,_0x52572a){this[_0x3dbf('0x8')]=_0x3b68cc[_0x3dbf('0x8')];this[_0x3dbf('0x9')]=this[_0x3dbf('0xa')](_0x3b68cc,_0x52572a);this[_0x3dbf('0x2')]=new Imap(this[_0x3dbf('0x9')]);this[_0x3dbf('0x2')]['once'](_0x3dbf('0xb'),this[_0x3dbf('0xc')][_0x3dbf('0xd')](this));this['imap'][_0x3dbf('0xe')](_0x3dbf('0xf'),this[_0x3dbf('0x10')][_0x3dbf('0xd')](this));this[_0x3dbf('0x2')]['on'](_0x3dbf('0x11'),this[_0x3dbf('0x12')]['bind'](this));this[_0x3dbf('0x2')]['connect']();}util[_0x3dbf('0x13')](EmailImap,EventEmitter);EmailImap[_0x3dbf('0x14')][_0x3dbf('0xa')]=function(_0x5bc42d,_0x2bbf2e){var _0x3629cd={'connTimeout':_0x5bc42d['connTimeout']?_0x5bc42d[_0x3dbf('0x15')]*0x3e8:0x2710,'authTimeout':_0x5bc42d[_0x3dbf('0x16')]?_0x5bc42d['authTimeout']*0x3e8:0x1388};if(_0x5bc42d[_0x3dbf('0x17')]){_0x3629cd[_0x3dbf('0x18')]=_0x5bc42d[_0x3dbf('0x18')];if(_0x5bc42d['modernAuthentication']){_0x3629cd[_0x3dbf('0x19')]=utils[_0x3dbf('0x1a')](_0x5bc42d[_0x3dbf('0x1b')][_0x3dbf('0x1c')],_0x5bc42d[_0x3dbf('0x18')]);}else{_0x3629cd[_0x3dbf('0x1d')]=_0x5bc42d[_0x3dbf('0x1d')];}}else{if(_0x5bc42d[_0x3dbf('0x1e')]){_0x3629cd[_0x3dbf('0x18')]=_0x5bc42d['user'];_0x3629cd['password']=_0x5bc42d[_0x3dbf('0x1d')];}}_0x3629cd['email']=_0x2bbf2e||_0x5bc42d[_0x3dbf('0x18')]||_0x3dbf('0x1f');_0x3629cd[_0x3dbf('0x20')]=_0x5bc42d['host'];_0x3629cd[_0x3dbf('0x21')]=_0x5bc42d['port']||0x3e1;if(_0x5bc42d[_0x3dbf('0x22')]){_0x3629cd[_0x3dbf('0x22')]=!![];}else{_0x3629cd[_0x3dbf('0x22')]=![];_0x3629cd[_0x3dbf('0x23')]=_0x3dbf('0x24');}return _0x3629cd;};EmailImap['prototype'][_0x3dbf('0xc')]=function(){this[_0x3dbf('0x2')]['openBox'](this['mailbox'],![],this[_0x3dbf('0x25')][_0x3dbf('0xd')](this));};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x25')]=function(_0x61297e,_0x5c7682){if(_0x61297e){this[_0x3dbf('0x12')](_0x61297e,!![]);}else{this['emit']('box',_0x5c7682);this[_0x3dbf('0x26')]();}};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x27')]=function(_0x39f0a7){if(_0x39f0a7){this['handleError'](_0x39f0a7,!![]);}else{this[_0x3dbf('0x2')][_0x3dbf('0xf')]();}};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x26')]=function(){this[_0x3dbf('0x2')]['search'](['UNSEEN'],this['handleReadUnseen'][_0x3dbf('0xd')](this));};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x28')]=function(_0x5a4978,_0x277236){if(_0x5a4978){this[_0x3dbf('0x12')](_0x5a4978,!![]);}else{if(_0x277236[_0x3dbf('0x29')]){try{var _0x4af2db=this[_0x3dbf('0x2')][_0x3dbf('0x2a')](_0x277236,{'bodies':'','markSeen':!![]});_0x4af2db['on'](_0x3dbf('0x2b'),this[_0x3dbf('0x2c')][_0x3dbf('0xd')](this));_0x4af2db[_0x3dbf('0xe')](_0x3dbf('0x11'),this[_0x3dbf('0x2d')][_0x3dbf('0xd')](this));_0x4af2db[_0x3dbf('0xe')](_0x3dbf('0xf'),this[_0x3dbf('0x2e')][_0x3dbf('0xd')](this));}catch(_0x44346f){logger['error'](_0x44346f);}}else{this[_0x3dbf('0x2')][_0x3dbf('0x2f')](!![],this['handleCloseBox'][_0x3dbf('0xd')](this));}}};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x2c')]=function(_0x181ae3){_0x181ae3['on'](_0x3dbf('0x30'),this[_0x3dbf('0x31')]['bind'](this));_0x181ae3[_0x3dbf('0xe')](_0x3dbf('0x32'),this['handleMessageAttributes'][_0x3dbf('0xd')](this));_0x181ae3[_0x3dbf('0xe')](_0x3dbf('0xf'),this[_0x3dbf('0x33')][_0x3dbf('0xd')](this));};EmailImap[_0x3dbf('0x14')]['handleMessageBody']=function(_0x30e578){simpleParser(_0x30e578,{'Iconv':Iconv},this[_0x3dbf('0x34')][_0x3dbf('0xd')](this));};EmailImap[_0x3dbf('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x33')]=function(){};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x34')]=function(_0x1fa024,_0x2814b2){if(_0x1fa024){logger[_0x3dbf('0x11')](_0x1fa024);}else{var _0x1c0897=this;utils[_0x3dbf('0x35')](this['account'],_0x2814b2,function(_0x30b263){_0x1c0897['emit']('email',_0x30b263);});}};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x2e')]=function(){this[_0x3dbf('0x2')][_0x3dbf('0x2f')](!![],this[_0x3dbf('0x27')][_0x3dbf('0xd')](this));};EmailImap['prototype'][_0x3dbf('0x2d')]=function(_0x51a658){this[_0x3dbf('0x12')](_0x51a658);this['imap']['closeBox'](!![],this[_0x3dbf('0x27')]['bind'](this));};EmailImap['prototype'][_0x3dbf('0x10')]=function(){this[_0x3dbf('0x36')](_0x3dbf('0xf'));};EmailImap[_0x3dbf('0x14')][_0x3dbf('0x12')]=function(_0x4cdb9b,_0xcc1547){logger[_0x3dbf('0x11')]('handleError',this[_0x3dbf('0x9')]['email'],JSON[_0x3dbf('0x37')](_0x4cdb9b));var _0x32160d='';if(_0x4cdb9b){if(_0x4cdb9b[_0x3dbf('0x38')]){_0x32160d=_0x4cdb9b[_0x3dbf('0x38')];}else{for(var _0xdf675e in _0x4cdb9b){if(_0x4cdb9b[_0x3dbf('0x39')](_0xdf675e)){_0x32160d+=_[_0x3dbf('0x3a')](_0xdf675e)+':\x20'+_0x4cdb9b[_0xdf675e]+'\x0a';}}}}if(_0xcc1547){this[_0x3dbf('0x2')][_0x3dbf('0xf')]();}else{this[_0x3dbf('0x36')](_0x3dbf('0x11'),_0x32160d);this[_0x3dbf('0x36')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 15408b4..8c549df 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 _0x8893=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x6335f1,_0x45bcb4){var _0x4fba6c=function(_0x32c86d){while(--_0x32c86d){_0x6335f1['push'](_0x6335f1['shift']());}};_0x4fba6c(++_0x45bcb4);}(_0x8893,0x19c));var _0x3889=function(_0x501777,_0x412680){_0x501777=_0x501777-0x0;var _0x2f2681=_0x8893[_0x501777];return _0x2f2681;};'use strict';var nodemailer=require(_0x3889('0x0'));var inlineBase64=require(_0x3889('0x1'));function EmailSmtp(){}EmailSmtp[_0x3889('0x2')][_0x3889('0x3')]=function(_0x2f1f7a,_0x48f00d){return new Promise(function(_0x406f64,_0x1dc04f){var _0x1d516c=nodemailer[_0x3889('0x4')](_0x2f1f7a);_0x1d516c['use'](_0x3889('0x5'),inlineBase64());_0x1d516c[_0x3889('0x6')](_0x48f00d,function(_0x5ee68c,_0x85d0f2){if(_0x5ee68c){_0x1dc04f(_0x5ee68c[_0x3889('0x7')]());}else{_0x406f64(_0x85d0f2);}});});};EmailSmtp['prototype']['verify']=function(_0x25c123){return new Promise(function(_0x233763,_0x37e60a){var _0x39c422=nodemailer[_0x3889('0x4')](_0x25c123);_0x39c422[_0x3889('0x8')](function(_0x44e403,_0x4a358a){if(_0x44e403){_0x37e60a(_0x44e403[_0x3889('0x7')]());}else{if(_0x4a358a){_0x233763(_0x4a358a);}else{_0x37e60a(_0x3889('0x9'));}}});});};module[_0x3889('0xa')]=EmailSmtp; \ No newline at end of file +var _0x7c68=['sendMail','toString','verify','Not\x20verifired','prototype','send','createTransport','use','compile'];(function(_0x2bca9a,_0x580728){var _0x580fef=function(_0x4d7a4d){while(--_0x4d7a4d){_0x2bca9a['push'](_0x2bca9a['shift']());}};_0x580fef(++_0x580728);}(_0x7c68,0x1cf));var _0x87c6=function(_0x5d5cd7,_0x5e10b7){_0x5d5cd7=_0x5d5cd7-0x0;var _0x3ae18e=_0x7c68[_0x5d5cd7];return _0x3ae18e;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x87c6('0x0')][_0x87c6('0x1')]=function(_0x5097e5,_0x93717a){return new Promise(function(_0x5a4a73,_0x303422){var _0x19db5a=nodemailer[_0x87c6('0x2')](_0x5097e5);_0x19db5a[_0x87c6('0x3')](_0x87c6('0x4'),inlineBase64());_0x19db5a[_0x87c6('0x5')](_0x93717a,function(_0x37e42c,_0x41b608){if(_0x37e42c){_0x303422(_0x37e42c[_0x87c6('0x6')]());}else{_0x5a4a73(_0x41b608);}});});};EmailSmtp[_0x87c6('0x0')][_0x87c6('0x7')]=function(_0x5ee397){return new Promise(function(_0x326467,_0x59a676){var _0x2494d8=nodemailer['createTransport'](_0x5ee397);_0x2494d8['verify'](function(_0x54aa14,_0x5e6bb1){if(_0x54aa14){_0x59a676(_0x54aa14[_0x87c6('0x6')]());}else{if(_0x5e6bb1){_0x326467(_0x5e6bb1);}else{_0x59a676(_0x87c6('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0557869..2e2c419 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 _0x3162=['join','generate','html','test','replace','','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','length','slice'];(function(_0x5ebda0,_0x385f04){var _0x4ec370=function(_0x16a040){while(--_0x16a040){_0x5ebda0['push'](_0x5ebda0['shift']());}};_0x4ec370(++_0x385f04);}(_0x3162,0x110));var _0x2316=function(_0x197b38,_0x394a4d){_0x197b38=_0x197b38-0x0;var _0x20a23a=_0x3162[_0x197b38];return _0x20a23a;};'use strict';var _=require(_0x2316('0x0'));var moment=require(_0x2316('0x1'));var random=require(_0x2316('0x2'));var fs=require('fs');var path=require(_0x2316('0x3'));var util=require(_0x2316('0x4'));var tnef=require(_0x2316('0x5'));var logger=require(_0x2316('0x6'))('email');var config=require(_0x2316('0x7'));function getAddress(_0x475439){var _0x5bdbbe=_[_0x2316('0x8')](_0x475439[_0x2316('0x9')]);return _0x5bdbbe&&_0x5bdbbe['address']?_0x5bdbbe[_0x2316('0xa')]:_0x2316('0xb')+random['generate'](0x6)+_0x2316('0xc');}function getFirstName(_0x428e23){var _0x420970=_[_0x2316('0x8')](_0x428e23[_0x2316('0x9')]);if(_0x420970&&_0x420970[_0x2316('0xd')]){if(_0x420970['name']==_0x420970[_0x2316('0xa')]){return _0x420970[_0x2316('0xd')]['substring'](0x0,_0x420970[_0x2316('0xd')]['indexOf']('@'));}var _0x5acbb7=_0x420970[_0x2316('0xd')]['split'](/\s+/);return _0x5acbb7[_0x2316('0xe')]>0x1?_0x5acbb7[_0x2316('0xf')](0x0,-0x1)[_0x2316('0x10')]('\x20'):_0x420970['name'];}return'Anonymous';}function getLastName(_0x4439d6){var _0x504995=_[_0x2316('0x8')](_0x4439d6[_0x2316('0x9')]);if(_0x504995&&_0x504995[_0x2316('0xd')]){var _0x5082ed=_0x504995[_0x2316('0xd')]['split'](/\s+/);return _0x5082ed[_0x2316('0xe')]>0x1?_0x5082ed['pop']():'';}return'';}function getMails(_0x29df36,_0x11e6d5){var _0x3798aa='';for(var _0x54ba47=0x0;_0x54ba47<_0x11e6d5['value']['length'];_0x54ba47+=0x1){if(_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]!==_0x29df36){if(!_['isEmpty'](_0x3798aa)){_0x3798aa+=',';}_0x3798aa+=_0x11e6d5[_0x2316('0x9')][_0x54ba47]['name']||_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]||'';_0x3798aa+='\x20<';_0x3798aa+=_0x11e6d5['value'][_0x54ba47]['address']?_0x11e6d5[_0x2316('0x9')][_0x54ba47][_0x2316('0xa')]:_0x2316('0xb')+random[_0x2316('0x11')](0x6)+_0x2316('0xc');_0x3798aa+='>';}}return _0x3798aa;}function parseEmail(_0x2a8474,_0x3064ca,_0x40a478){if(_0x3064ca[_0x2316('0x12')]){var _0x4bd7ad=/)<[^<]*)*<\/script>/gi;while(_0x4bd7ad[_0x2316('0x13')](_0x3064ca[_0x2316('0x12')])){_0x3064ca[_0x2316('0x12')]=_0x3064ca[_0x2316('0x12')][_0x2316('0x14')](_0x4bd7ad,'');}if(_0x3064ca['html']['includes'](_0x2316('0x15'))){var _0x4b68e3=[];_0x3064ca['attachments']['forEach'](_0x4d0079=>{_0x4b68e3[_0x2316('0x16')](_0x4d0079[_0x2316('0x17')]);});var _0x279fa7=/]+>/g;var _0x2876cf=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5b6779=_0x3064ca[_0x2316('0x12')]['replace'](_0x2876cf,_0x2316('0x18'));var _0x559244=_0x5b6779[_0x2316('0x14')](_0x279fa7,_0x2316('0x19'));for(let _0x49274c=0x0;_0x49274c<_0x4b68e3[_0x2316('0xe')];_0x49274c++){var _0xac35a9=_0x559244[_0x2316('0x14')](_0x2316('0x19'),'\x20[Attachment:\x20'+_0x4b68e3[_0x49274c]+_0x2316('0x1a'));_0x559244=_0xac35a9;}_0x3064ca[_0x2316('0x12')]=_0x559244;}_0x40a478[_0x2316('0x1b')]=_0x3064ca['html'];}else{_0x40a478[_0x2316('0x1b')]=_0x3064ca[_0x2316('0x1c')];}if(_0x40a478[_0x2316('0x1b')]){_0x40a478[_0x2316('0x1b')]=_0x40a478[_0x2316('0x1b')][_0x2316('0x14')](/0x0){var _0xdff37e=[_0x2316('0x31'),'X-Auto-Response-Suppress:\x20All',_0x2316('0x32')];for(var _0x134e0f=0x0;_0x134e0f<_0x3064ca[_0x2316('0x30')][_0x2316('0xe')];_0x134e0f++){var _0x307a32=_[_0x2316('0x33')](_0xdff37e,_0x3064ca[_0x2316('0x30')][_0x134e0f]['line']);if(_0x307a32>=0x0){_0x40a478[_0x2316('0x34')]=!![];}}}return _0x40a478;}exports[_0x2316('0x35')]=function(_0x5ca3d0,_0xf82603,_0x574d68){var _0x185549={'from':getAddress(_0xf82603[_0x2316('0x36')]),'firstName':getFirstName(_0xf82603['from']),'lastName':getLastName(_0xf82603[_0x2316('0x36')]),'mapKey':_0x2316('0x1f'),'message':{'from':getMails(_0x5ca3d0['email'],_0xf82603[_0x2316('0x36')]),'to':_0x5ca3d0[_0x2316('0x1f')],'cc':'','subject':_0xf82603[_0x2316('0x37')]||'','messageId':_0xf82603['messageId'],'inReplyTo':_0xf82603['inReplyTo'],'sentAt':moment(_0xf82603['date'])[_0x2316('0x38')](_0x2316('0x39')),'attach':![],'attachments':[]}};if(!_0xf82603[_0x2316('0x12')]&&!_0xf82603[_0x2316('0x1c')]){var _0x244d6a=_['filter'](_0xf82603[_0x2316('0x26')],{'contentType':'application/ms-tnef'});if(_0x244d6a[_0x2316('0xe')]){logger[_0x2316('0x3a')](util[_0x2316('0x38')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xf82603[_0x2316('0x3b')]));tnef[_0x2316('0x3c')](_[_0x2316('0x3d')](_0x244d6a)[_0x2316('0x2e')],function(_0x7165ae,_0x1bd5ca){if(_0x1bd5ca){_0xf82603[_0x2316('0x12')]=_0x1bd5ca[_0x2316('0x3e')]||'

Empty\x20message

';if(_0x1bd5ca[_0x2316('0x3f')]){for(var _0x4d9b9a=0x0;_0x4d9b9a<_0x1bd5ca[_0x2316('0x3f')][_0x2316('0xe')];_0x4d9b9a++){var _0x1c4018=_0x1bd5ca[_0x2316('0x3f')][_0x4d9b9a];_0x185549[_0x2316('0x21')][_0x2316('0x26')][_0x2316('0x16')]({'filename':_0x1c4018[_0x2316('0x40')],'content':Buffer[_0x2316('0x36')](_0x1c4018[_0x2316('0x41')])});}}}_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));});}else{_0xf82603[_0x2316('0x12')]=_0x2316('0x42');_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));}}else{_0x574d68(parseEmail(_0x5ca3d0,_0xf82603,_0x185549));}};exports[_0x2316('0x43')]=function(_0x19c1e6,_0x52995c){var _0x2291d5=['user='+(_0x52995c||''),_0x2316('0x44')+_0x19c1e6,'',''];return Buffer[_0x2316('0x36')](_0x2291d5[_0x2316('0x10')](''),_0x2316('0x45'))[_0x2316('0x46')](_0x2316('0x47'));}; \ No newline at end of file +var _0x91c4=['head','name','indexOf','split','length','Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','value','address','generate','@xcally.com'];(function(_0x19865b,_0x279613){var _0x186b3a=function(_0xe8278a){while(--_0xe8278a){_0x19865b['push'](_0x19865b['shift']());}};_0x186b3a(++_0x279613);}(_0x91c4,0x14d));var _0x491c=function(_0x569ae3,_0x3e8a5e){_0x569ae3=_0x569ae3-0x0;var _0x10e903=_0x91c4[_0x569ae3];return _0x10e903;};'use strict';var _=require(_0x491c('0x0'));var moment=require(_0x491c('0x1'));var random=require(_0x491c('0x2'));var fs=require('fs');var path=require(_0x491c('0x3'));var util=require(_0x491c('0x4'));var tnef=require(_0x491c('0x5'));var logger=require('../../../config/logger')(_0x491c('0x6'));var config=require(_0x491c('0x7'));function getAddress(_0x135f00){var _0x4e0da9=_['head'](_0x135f00[_0x491c('0x8')]);return _0x4e0da9&&_0x4e0da9[_0x491c('0x9')]?_0x4e0da9[_0x491c('0x9')]:'anonymous'+random[_0x491c('0xa')](0x6)+_0x491c('0xb');}function getFirstName(_0x124033){var _0x17b3a5=_[_0x491c('0xc')](_0x124033[_0x491c('0x8')]);if(_0x17b3a5&&_0x17b3a5['name']){if(_0x17b3a5['name']==_0x17b3a5[_0x491c('0x9')]){return _0x17b3a5[_0x491c('0xd')]['substring'](0x0,_0x17b3a5[_0x491c('0xd')][_0x491c('0xe')]('@'));}var _0x5da3ab=_0x17b3a5[_0x491c('0xd')][_0x491c('0xf')](/\s+/);return _0x5da3ab[_0x491c('0x10')]>0x1?_0x5da3ab['slice'](0x0,-0x1)['join']('\x20'):_0x17b3a5[_0x491c('0xd')];}return _0x491c('0x11');}function getLastName(_0x3905bc){var _0x4c241d=_[_0x491c('0xc')](_0x3905bc[_0x491c('0x8')]);if(_0x4c241d&&_0x4c241d[_0x491c('0xd')]){var _0x58238a=_0x4c241d['name'][_0x491c('0xf')](/\s+/);return _0x58238a[_0x491c('0x10')]>0x1?_0x58238a[_0x491c('0x12')]():'';}return'';}function getMails(_0x2ef4b3,_0x42593d){var _0x56ba39='';for(var _0x4fbf62=0x0;_0x4fbf62<_0x42593d[_0x491c('0x8')][_0x491c('0x10')];_0x4fbf62+=0x1){if(_0x42593d[_0x491c('0x8')][_0x4fbf62]['address']!==_0x2ef4b3){if(!_[_0x491c('0x13')](_0x56ba39)){_0x56ba39+=',';}_0x56ba39+=_0x42593d[_0x491c('0x8')][_0x4fbf62][_0x491c('0xd')]||_0x42593d['value'][_0x4fbf62][_0x491c('0x9')]||'';_0x56ba39+='\x20<';_0x56ba39+=_0x42593d['value'][_0x4fbf62][_0x491c('0x9')]?_0x42593d[_0x491c('0x8')][_0x4fbf62][_0x491c('0x9')]:_0x491c('0x14')+random[_0x491c('0xa')](0x6)+_0x491c('0xb');_0x56ba39+='>';}}return _0x56ba39;}function parseEmail(_0x249c2b,_0x36fd1e,_0x47c661){if(_0x36fd1e[_0x491c('0x15')]){var _0x4cb01c=/)<[^<]*)*<\/script>/gi;while(_0x4cb01c[_0x491c('0x16')](_0x36fd1e[_0x491c('0x15')])){_0x36fd1e[_0x491c('0x15')]=_0x36fd1e[_0x491c('0x15')][_0x491c('0x17')](_0x4cb01c,'');}if(_0x36fd1e[_0x491c('0x15')][_0x491c('0x18')](_0x491c('0x19'))){var _0x1bbc17=[];_0x36fd1e['attachments'][_0x491c('0x1a')](_0x5712cb=>{_0x1bbc17['push'](_0x5712cb[_0x491c('0x1b')]);});var _0x4382ae=/]+>/g;var _0x109c36=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2fdbbc=_0x36fd1e[_0x491c('0x15')]['replace'](_0x109c36,'_SRC');var _0x5bad50=_0x2fdbbc[_0x491c('0x17')](_0x4382ae,_0x491c('0x1c'));for(let _0x7b589a=0x0;_0x7b589a<_0x1bbc17[_0x491c('0x10')];_0x7b589a++){var _0x568401=_0x5bad50[_0x491c('0x17')](_0x491c('0x1c'),_0x491c('0x1d')+_0x1bbc17[_0x7b589a]+_0x491c('0x1e'));_0x5bad50=_0x568401;}_0x36fd1e[_0x491c('0x15')]=_0x5bad50;}_0x47c661[_0x491c('0x1f')]=_0x36fd1e[_0x491c('0x15')];}else{_0x47c661[_0x491c('0x1f')]=_0x36fd1e['textAsHtml'];}if(_0x47c661[_0x491c('0x1f')]){_0x47c661[_0x491c('0x1f')]=_0x47c661[_0x491c('0x1f')][_0x491c('0x17')](/0x0){var _0x1166f0=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x491c('0x31')];for(var _0x174cf1=0x0;_0x174cf1<_0x36fd1e[_0x491c('0x30')][_0x491c('0x10')];_0x174cf1++){var _0x161938=_['indexOf'](_0x1166f0,_0x36fd1e[_0x491c('0x30')][_0x174cf1][_0x491c('0x32')]);if(_0x161938>=0x0){_0x47c661[_0x491c('0x33')]=!![];}}}return _0x47c661;}exports[_0x491c('0x34')]=function(_0x9cab75,_0x2c7c64,_0x4c360f){var _0x581161={'from':getAddress(_0x2c7c64[_0x491c('0x35')]),'firstName':getFirstName(_0x2c7c64[_0x491c('0x35')]),'lastName':getLastName(_0x2c7c64[_0x491c('0x35')]),'mapKey':_0x491c('0x6'),'message':{'from':getMails(_0x9cab75[_0x491c('0x6')],_0x2c7c64[_0x491c('0x35')]),'to':_0x9cab75[_0x491c('0x6')],'cc':'','subject':_0x2c7c64['subject']||'','messageId':_0x2c7c64[_0x491c('0x36')],'inReplyTo':_0x2c7c64[_0x491c('0x37')],'sentAt':moment(_0x2c7c64['date'])[_0x491c('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2c7c64['html']&&!_0x2c7c64[_0x491c('0x38')]){var _0x90adb2=_[_0x491c('0x39')](_0x2c7c64['attachments'],{'contentType':_0x491c('0x3a')});if(_0x90adb2[_0x491c('0x10')]){logger['info'](util[_0x491c('0x28')](_0x491c('0x3b'),_0x2c7c64[_0x491c('0x36')]));tnef[_0x491c('0x3c')](_['first'](_0x90adb2)['content'],function(_0x42fcff,_0x20c43d){if(_0x20c43d){_0x2c7c64[_0x491c('0x15')]=_0x20c43d[_0x491c('0x3d')]||_0x491c('0x3e');if(_0x20c43d['Attachments']){for(var _0x542af5=0x0;_0x542af5<_0x20c43d['Attachments']['length'];_0x542af5++){var _0x29c379=_0x20c43d[_0x491c('0x3f')][_0x542af5];_0x581161[_0x491c('0x22')][_0x491c('0x24')][_0x491c('0x2f')]({'filename':_0x29c379[_0x491c('0x40')],'content':Buffer[_0x491c('0x35')](_0x29c379[_0x491c('0x41')])});}}}_0x4c360f(parseEmail(_0x9cab75,_0x2c7c64,_0x581161));});}else{_0x2c7c64[_0x491c('0x15')]=_0x491c('0x3e');_0x4c360f(parseEmail(_0x9cab75,_0x2c7c64,_0x581161));}}else{_0x4c360f(parseEmail(_0x9cab75,_0x2c7c64,_0x581161));}};exports[_0x491c('0x42')]=function(_0x3d0691,_0x4ca397){var _0x25c28e=[_0x491c('0x43')+(_0x4ca397||''),_0x491c('0x44')+_0x3d0691,'',''];return Buffer[_0x491c('0x35')](_0x25c28e['join'](''),'utf-8')['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f07e087..24d97fa 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 _0x32e1=['Service','key','active','Imap','Smtp','name'];(function(_0x48481c,_0x1e2ce2){var _0x1781a9=function(_0x2d965f){while(--_0x2d965f){_0x48481c['push'](_0x48481c['shift']());}};_0x1781a9(++_0x1e2ce2);}(_0x32e1,0x1a9));var _0x132e=function(_0x17c1d0,_0x4b931a){_0x17c1d0=_0x17c1d0-0x0;var _0x336506=_0x32e1[_0x17c1d0];return _0x336506;};'use strict';var _=require('lodash');function MailAccount(_0x4e90bd){this['id']=_0x4e90bd['id']||0x0;this[_0x132e('0x0')]=_0x4e90bd[_0x132e('0x0')]||_0x132e('0x1');this[_0x132e('0x2')]=_0x4e90bd[_0x132e('0x2')]||'SERV';this[_0x132e('0x3')]=_0x4e90bd['active']||![];this[_0x132e('0x4')]=_0x4e90bd[_0x132e('0x4')]||[];this[_0x132e('0x5')]=_0x4e90bd[_0x132e('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x3c36=['Smtp','exports','name','Service','key','SERV','active','Imap'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3c36,0xda));var _0x63c3=function(_0x305f5b,_0x4f8acc){_0x305f5b=_0x305f5b-0x0;var _0x2597be=_0x3c36[_0x305f5b];return _0x2597be;};'use strict';var _=require('lodash');function MailAccount(_0x1da853){this['id']=_0x1da853['id']||0x0;this['name']=_0x1da853[_0x63c3('0x0')]||_0x63c3('0x1');this[_0x63c3('0x2')]=_0x1da853['key']||_0x63c3('0x3');this['active']=_0x1da853[_0x63c3('0x4')]||![];this[_0x63c3('0x5')]=_0x1da853[_0x63c3('0x5')]||[];this[_0x63c3('0x6')]=_0x1da853['Smtp']||[];}module[_0x63c3('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6d0d53b..724d8c6 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 _0xf409=['isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','length'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0xf409,0x1cf));var _0x9f40=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf409[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x9f40('0x0'));var MailAccount=require(_0x9f40('0x1'));var Realtime=function(){this[_0x9f40('0x2')]={};};function freeIsNotKey(_0x297a2c,_0x24f243,_0x303fc4){var _0x18da4f=_[_0x9f40('0x3')](_0x297a2c,function(_0x491473,_0x4c1655){return _0x491473[_0x303fc4];});for(var _0x50a2b2 in _0x24f243){if(_0x24f243['hasOwnProperty'](_0x50a2b2)){if(!_0x18da4f[_0x50a2b2]){delete _0x24f243[_0x50a2b2];}}}}Realtime['prototype'][_0x9f40('0x4')]=function(_0x355739,_0xac0e7d){for(var _0x16f95f in _0xac0e7d){if(_0x355739[_0x9f40('0x5')](_0x16f95f)){_0x355739[_0x16f95f]=_0xac0e7d[_0x16f95f];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x417aa4=this;return function(_0x4ebb9b){if(_0x4ebb9b){freeIsNotKey(_0x4ebb9b,_0x417aa4[_0x9f40('0x2')],'id');for(var _0x966072=0x0,_0x3efcee={},_0x1f61f2={};_0x966072<_0x4ebb9b[_0x9f40('0x6')];_0x966072+=0x1){_0x3efcee=_0x4ebb9b[_0x966072];if(_[_0x9f40('0x7')](_0x417aa4[_0x9f40('0x2')][_0x3efcee['id']])){_0x417aa4['mailAccounts'][_0x3efcee['id']]=new MailAccount(_0x3efcee);}else{_[_0x9f40('0x8')](_0x417aa4['mailAccounts'][_0x3efcee['id']],_0x3efcee);}}}return _0x417aa4[_0x9f40('0x2')];};};module[_0x9f40('0x9')]=Realtime; \ No newline at end of file +var _0x0858=['isUndefined','mailAccounts','merge','../model/mailAccount','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x5dbbad,_0xefa252){var _0x128103=function(_0x2ac6ab){while(--_0x2ac6ab){_0x5dbbad['push'](_0x5dbbad['shift']());}};_0x128103(++_0xefa252);}(_0x0858,0x1f3));var _0x8085=function(_0x3ba10b,_0xc068a5){_0x3ba10b=_0x3ba10b-0x0;var _0x373af8=_0x0858[_0x3ba10b];return _0x373af8;};'use strict';var _=require('lodash');var MailAccount=require(_0x8085('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x263fec,_0x31d713,_0x31fef0){var _0x46d14a=_['mapKeys'](_0x263fec,function(_0x18d5b4,_0x1c1e97){return _0x18d5b4[_0x31fef0];});for(var _0x375555 in _0x31d713){if(_0x31d713['hasOwnProperty'](_0x375555)){if(!_0x46d14a[_0x375555]){delete _0x31d713[_0x375555];}}}}Realtime[_0x8085('0x1')][_0x8085('0x2')]=function(_0x584bc0,_0x26686e){for(var _0x5b20a0 in _0x26686e){if(_0x584bc0['hasOwnProperty'](_0x5b20a0)){_0x584bc0[_0x5b20a0]=_0x26686e[_0x5b20a0];}}};Realtime[_0x8085('0x1')][_0x8085('0x3')]=function(){var _0x557956=this;return function(_0x4a59d7){if(_0x4a59d7){freeIsNotKey(_0x4a59d7,_0x557956['mailAccounts'],'id');for(var _0x44b4d2=0x0,_0x44e674={},_0x43c081={};_0x44b4d2<_0x4a59d7[_0x8085('0x4')];_0x44b4d2+=0x1){_0x44e674=_0x4a59d7[_0x44b4d2];if(_[_0x8085('0x5')](_0x557956[_0x8085('0x6')][_0x44e674['id']])){_0x557956[_0x8085('0x6')][_0x44e674['id']]=new MailAccount(_0x44e674);}else{_[_0x8085('0x7')](_0x557956['mailAccounts'][_0x44e674['id']],_0x44e674);}}}return _0x557956[_0x8085('0x6')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d322c7f..897450c 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 _0xe714=['GetMailAccount','name','provider','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request'];(function(_0x16b691,_0x1d92eb){var _0x4c5dee=function(_0x5c6905){while(--_0x5c6905){_0x16b691['push'](_0x16b691['shift']());}};_0x4c5dee(++_0x1d92eb);}(_0xe714,0xe2));var _0x4e71=function(_0xf7248e,_0x326d62){_0xf7248e=_0xf7248e-0x0;var _0x1eac94=_0xe714[_0xf7248e];return _0x1eac94;};'use strict';var client=require(_0x4e71('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x4e71('0x1')](_0x4e71('0x2'),{'options':{'attributes':['id',_0x4e71('0x3'),_0x4e71('0x4'),'service',_0x4e71('0x5'),'active',_0x4e71('0x6'),_0x4e71('0x7'),_0x4e71('0x8')],'raw':![],'include':[{'model':_0x4e71('0x9'),'as':_0x4e71('0xa'),'include':[{'model':_0x4e71('0xb'),'attributes':['id','name',_0x4e71('0xc'),_0x4e71('0xd'),_0x4e71('0xe')],'as':'CloudProvider'}]},{'model':_0x4e71('0xf'),'as':'Smtp','include':[{'model':_0x4e71('0xb'),'attributes':['id',_0x4e71('0x3'),_0x4e71('0xc'),_0x4e71('0xd'),_0x4e71('0xe')],'as':_0x4e71('0xb')}]}]},'log':_0x4e71('0x10')});};};exports[_0x4e71('0x11')]=function(_0x52d45f,_0x13c582){return client[_0x4e71('0x1')]('NotifyMailAccount',{'account':{'id':_0x52d45f},'body':_0x13c582,'log':_0x4e71('0x12')});}; \ No newline at end of file +var _0x889d=['getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','Smtp','notify','NotifyMailAccount','../client'];(function(_0x25fee2,_0x926b6b){var _0x1afb16=function(_0x576ba2){while(--_0x576ba2){_0x25fee2['push'](_0x25fee2['shift']());}};_0x1afb16(++_0x926b6b);}(_0x889d,0x179));var _0xd889=function(_0x4a231f,_0x1989a6){_0x4a231f=_0x4a231f-0x0;var _0x7ea6bf=_0x889d[_0x4a231f];return _0x7ea6bf;};'use strict';var client=require(_0xd889('0x0'));exports[_0xd889('0x1')]=function(){return function(){return client[_0xd889('0x2')](_0xd889('0x3'),{'options':{'attributes':['id',_0xd889('0x4'),_0xd889('0x5'),_0xd889('0x6'),_0xd889('0x7'),_0xd889('0x8'),_0xd889('0x9'),_0xd889('0xa'),_0xd889('0xb')],'raw':![],'include':[{'model':_0xd889('0xc'),'as':_0xd889('0xd'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xd889('0x6'),_0xd889('0xe'),_0xd889('0xf')],'as':_0xd889('0x10')}]},{'model':_0xd889('0x11'),'as':_0xd889('0x12'),'include':[{'model':'CloudProvider','attributes':['id',_0xd889('0x4'),_0xd889('0x6'),_0xd889('0xe'),_0xd889('0xf')],'as':_0xd889('0x10')}]}]},'log':'getMailAccount'});};};exports[_0xd889('0x13')]=function(_0x3f3907,_0x1486be){return client['Request'](_0xd889('0x14'),{'account':{'id':_0x3f3907},'body':_0x1486be,'log':_0xd889('0x14')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 2ee86ba..75bbd66 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 _0x3e0c=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x4c6bca,_0x3de390){var _0x29d58e=function(_0x1ac871){while(--_0x1ac871){_0x4c6bca['push'](_0x4c6bca['shift']());}};_0x29d58e(++_0x3de390);}(_0x3e0c,0x1cd));var _0xc3e0=function(_0x34434d,_0x5ad557){_0x34434d=_0x34434d-0x0;var _0x29b809=_0x3e0c[_0x34434d];return _0x29b809;};'use strict';var client=require(_0xc3e0('0x0'));exports[_0xc3e0('0x1')]=function(){return client[_0xc3e0('0x2')](_0xc3e0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc3e0('0x4')]},'log':_0xc3e0('0x5')});}; \ No newline at end of file +var _0x42f8=['loginMailFrequency','getSettings','Request'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x42f8,0xa6));var _0x842f=function(_0x4bef68,_0x5d0163){_0x4bef68=_0x4bef68-0x0;var _0x54eb1b=_0x42f8[_0x4bef68];return _0x54eb1b;};'use strict';var client=require('../client');exports[_0x842f('0x0')]=function(){return client[_0x842f('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x842f('0x2')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 729c9ce..17df061 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 b4aed33..9e7d332 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 _0x2234=['http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports'];(function(_0x5bab55,_0x28c54d){var _0x34ddc1=function(_0x22583e){while(--_0x22583e){_0x5bab55['push'](_0x5bab55['shift']());}};_0x34ddc1(++_0x28c54d);}(_0x2234,0x1b8));var _0x4223=function(_0x48fefe,_0x341c3f){_0x48fefe=_0x48fefe-0x0;var _0x5dd63b=_0x2234[_0x48fefe];return _0x5dd63b;};'use strict';var _=require('lodash');var http=require(_0x4223('0x0'));var express=require(_0x4223('0x1'));var sticky=require(_0x4223('0x2'));var Redis=require(_0x4223('0x3'));var config=require(_0x4223('0x4'));var app=express();var server=http[_0x4223('0x5')](app);server[_0x4223('0x6')]=0xdbba0;if(sticky[_0x4223('0x7')](server,config['port'])){var socketio=require(_0x4223('0x8'))(server,{'transports':[_0x4223('0x9'),'polling']});config[_0x4223('0xa')]=_[_0x4223('0xb')](config[_0x4223('0xa')],{'host':_0x4223('0xc'),'port':0x18eb});socketio[_0x4223('0xd')](require(_0x4223('0xe'))({'pubClient':new Redis(config[_0x4223('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require('../../config/socketio')[_0x4223('0xf')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x4223('0xf')](app);}else{server[_0x4223('0x10')](_0x4223('0x11'),function(){console[_0x4223('0x12')](_0x4223('0x13'),config[_0x4223('0x14')]);});}exports=module[_0x4223('0x15')]=app; \ No newline at end of file +var _0x2f10=['default','../../config/socketio','../../config/express','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','ioredis','../../config/environment','createServer','listen','port','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x2f10,0xce));var _0x02f1=function(_0xfb0ec4,_0x33037d){_0xfb0ec4=_0xfb0ec4-0x0;var _0x1a2829=_0x2f10[_0xfb0ec4];return _0x1a2829;};'use strict';var _=require('lodash');var http=require(_0x02f1('0x0'));var express=require(_0x02f1('0x1'));var sticky=require('sticky-session');var Redis=require(_0x02f1('0x2'));var config=require(_0x02f1('0x3'));var app=express();var server=http[_0x02f1('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x02f1('0x5')](server,config[_0x02f1('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x02f1('0x7'),_0x02f1('0x8')]});config[_0x02f1('0x9')]=_[_0x02f1('0xa')](config[_0x02f1('0x9')],{'host':_0x02f1('0xb'),'port':0x18eb});socketio[_0x02f1('0xc')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x02f1('0xd'))[_0x02f1('0xe')]();require(_0x02f1('0xf'))[_0x02f1('0xe')](socketio);require(_0x02f1('0x10'))[_0x02f1('0xe')](app);require('../../routes')[_0x02f1('0xe')](app);}else{server[_0x02f1('0x11')]('listening',function(){console['log'](_0x02f1('0x12'),config[_0x02f1('0x6')]);});}exports=module[_0x02f1('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index aa72a87..65ffa54 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 _0x733e=['exports','jayson/promise','bluebird','../../config/logger','http','Request','request','debug','rpc','routing','error','message','result','catch'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x733e,0x15f));var _0xe733=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x733e[_0x171fdc];return _0x3782ea;};'use strict';var jayson=require(_0xe733('0x0'));var BPromise=require(_0xe733('0x1'));var logger=require(_0xe733('0x2'))('routing');var client=jayson['client'][_0xe733('0x3')]({'port':0x2329});client[_0xe733('0x4')]=function(_0x3e6dda,_0x535393){return new BPromise(function(_0x19cc93,_0x2dbcf5){return client[_0xe733('0x5')](_0x3e6dda,_0x535393)['then'](function(_0x23fe1b){logger[_0xe733('0x6')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x535393,_0x23fe1b);if(_0x23fe1b[_0xe733('0x9')]){logger[_0xe733('0x9')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x23fe1b[_0xe733('0x9')]['message'],_0x535393);return _0x2dbcf5(_0x23fe1b[_0xe733('0x9')][_0xe733('0xa')]);}else{return _0x19cc93(_0x23fe1b[_0xe733('0xb')]);}})[_0xe733('0xc')](function(_0x1d7d7f){logger[_0xe733('0x9')](_0xe733('0x7'),_0xe733('0x8'),_0x3e6dda,_0x1d7d7f,_0x535393);return _0x2dbcf5(_0x1d7d7f);});});};module[_0xe733('0xd')]=client; \ No newline at end of file +var _0x4aaf=['Request','request','then','debug','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x4aaf,0x15b));var _0xf4aa=function(_0x2915a7,_0x451590){_0x2915a7=_0x2915a7-0x0;var _0xbaaeeb=_0x4aaf[_0x2915a7];return _0xbaaeeb;};'use strict';var jayson=require(_0xf4aa('0x0'));var BPromise=require(_0xf4aa('0x1'));var logger=require(_0xf4aa('0x2'))('routing');var client=jayson[_0xf4aa('0x3')][_0xf4aa('0x4')]({'port':0x2329});client[_0xf4aa('0x5')]=function(_0x458250,_0x245c91){return new BPromise(function(_0x5919df,_0x192ed2){return client[_0xf4aa('0x6')](_0x458250,_0x245c91)[_0xf4aa('0x7')](function(_0x59e300){logger[_0xf4aa('0x8')](_0xf4aa('0x9'),'routing',_0x458250,_0x245c91,_0x59e300);if(_0x59e300['error']){logger[_0xf4aa('0xa')](_0xf4aa('0x9'),_0xf4aa('0xb'),_0x458250,_0x59e300[_0xf4aa('0xa')]['message'],_0x245c91);return _0x192ed2(_0x59e300[_0xf4aa('0xa')][_0xf4aa('0xc')]);}else{return _0x5919df(_0x59e300[_0xf4aa('0xd')]);}})[_0xf4aa('0xe')](function(_0xce7e4a){logger[_0xf4aa('0xa')]('rpc',_0xf4aa('0xb'),_0x458250,_0xce7e4a,_0x245c91);return _0x192ed2(_0xce7e4a);});});};module[_0xf4aa('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c5aa4df..8c497b0 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 _0x9dcf=['initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then'];(function(_0x4ea3b2,_0x4ed581){var _0x14a255=function(_0x4dfce6){while(--_0x4dfce6){_0x4ea3b2['push'](_0x4ea3b2['shift']());}};_0x14a255(++_0x4ed581);}(_0x9dcf,0x114));var _0xf9dc=function(_0xef841b,_0x4ee8b5){_0xef841b=_0xef841b-0x0;var _0x51adc2=_0x9dcf[_0xef841b];return _0x51adc2;};'use strict';var BPromise=require(_0xf9dc('0x0'));var server=require(_0xf9dc('0x1'));var Realtime=require(_0xf9dc('0x2'));var user=require(_0xf9dc('0x3'));var interval=require(_0xf9dc('0x4'));var openchannelQueue=require(_0xf9dc('0x5'));var chatQueue=require(_0xf9dc('0x6'));var smsQueue=require(_0xf9dc('0x7'));var mailQueue=require(_0xf9dc('0x8'));var faxQueue=require(_0xf9dc('0x9'));var whatsappQueue=require(_0xf9dc('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf9dc('0xb')]()['then'](user[_0xf9dc('0xc')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0xe')]())['then'](interval[_0xf9dc('0xf')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x10')]())['then'](openchannelQueue[_0xf9dc('0x11')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x12')]())[_0xf9dc('0xd')](chatQueue[_0xf9dc('0x13')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x14')]())[_0xf9dc('0xd')](smsQueue['getSmsQueues']())[_0xf9dc('0xd')](realtime[_0xf9dc('0x15')]())[_0xf9dc('0xd')](mailQueue[_0xf9dc('0x16')]())[_0xf9dc('0xd')](realtime[_0xf9dc('0x17')]())['then'](faxQueue['getFaxQueues']())[_0xf9dc('0xd')](realtime[_0xf9dc('0x18')]())[_0xf9dc('0xd')](whatsappQueue[_0xf9dc('0x19')]())['then'](realtime[_0xf9dc('0x1a')]())[_0xf9dc('0xd')](function(){return realtime;});}function main(){return server[_0xf9dc('0x1b')](realtime)[_0xf9dc('0xd')](function(_0x538e15){return initRealtime();})['then'](function(_0x3be1e3){return setInterval(initRealtime,0x1388);})[_0xf9dc('0x1c')](function(_0x356d01){console['log'](_0x356d01);});}main(); \ No newline at end of file +var _0xb961=['./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','listen','catch','log'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb961,0xd8));var _0x1b96=function(_0x639b4b,_0x37c1c1){_0x639b4b=_0x639b4b-0x0;var _0x88755e=_0xb961[_0x639b4b];return _0x88755e;};'use strict';var BPromise=require('bluebird');var server=require(_0x1b96('0x0'));var Realtime=require('./realtime');var user=require(_0x1b96('0x1'));var interval=require(_0x1b96('0x2'));var openchannelQueue=require(_0x1b96('0x3'));var chatQueue=require(_0x1b96('0x4'));var smsQueue=require(_0x1b96('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1b96('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x1b96('0x7')]()[_0x1b96('0x8')](user['getAgents']())[_0x1b96('0x8')](realtime[_0x1b96('0x9')]())[_0x1b96('0x8')](interval[_0x1b96('0xa')]())[_0x1b96('0x8')](realtime[_0x1b96('0xb')]())[_0x1b96('0x8')](openchannelQueue[_0x1b96('0xc')]())[_0x1b96('0x8')](realtime[_0x1b96('0xd')]())[_0x1b96('0x8')](chatQueue[_0x1b96('0xe')]())[_0x1b96('0x8')](realtime[_0x1b96('0xf')]())['then'](smsQueue[_0x1b96('0x10')]())['then'](realtime[_0x1b96('0x11')]())[_0x1b96('0x8')](mailQueue[_0x1b96('0x12')]())[_0x1b96('0x8')](realtime[_0x1b96('0x13')]())['then'](faxQueue['getFaxQueues']())[_0x1b96('0x8')](realtime['initFaxQueues']())[_0x1b96('0x8')](whatsappQueue[_0x1b96('0x14')]())['then'](realtime['initWhatsappQueues']())[_0x1b96('0x8')](function(){return realtime;});}function main(){return server[_0x1b96('0x15')](realtime)['then'](function(_0x28a2fe){return initRealtime();})[_0x1b96('0x8')](function(_0x1f367d){return setInterval(initRealtime,0x1388);})[_0x1b96('0x16')](function(_0x24e5ab){console[_0x1b96('0x17')](_0x24e5ab);});}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 c9e8d82..d0b5d09 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x272c2f,_0x46ff66){var _0x381941=function(_0x32e1cd){while(--_0x32e1cd){_0x272c2f['push'](_0x272c2f['shift']());}};_0x381941(++_0x46ff66);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x57c741,_0x26dcc5){var _0x248821=function(_0x3bd8af){while(--_0x3bd8af){_0x57c741['push'](_0x57c741['shift']());}};_0x248821(++_0x26dcc5);}(_0x814b,0x1a2));var _0xb814=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x814b[_0xa8b370];return _0x643e37;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 36073e0..aa0ac3b 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 _0x405f=['result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3d2efa,_0x4a2e5c){var _0x5f108e=function(_0x2b1ef9){while(--_0x2b1ef9){_0x3d2efa['push'](_0x3d2efa['shift']());}};_0x5f108e(++_0x4a2e5c);}(_0x405f,0xd4));var _0xf405=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x405f[_0x59d89e];return _0x554e93;};'use strict';var BPromise=require(_0xf405('0x0'));var jayson=require(_0xf405('0x1'));var client=jayson[_0xf405('0x2')][_0xf405('0x3')]({'port':0x232b});function request(_0x50ad3d,_0x5d8658){return new BPromise(function(_0x298b79,_0x3b1b1c){return client[_0xf405('0x4')](_0x50ad3d,_0x5d8658)[_0xf405('0x5')](function(_0x547266){if(_0x547266['error']){return _0x3b1b1c(_0x547266[_0xf405('0x6')][_0xf405('0x7')]);}else{return _0x298b79(_0x547266[_0xf405('0x8')]);}})[_0xf405('0x9')](function(_0x187b17){return _0x3b1b1c(_0x187b17);});});}exports[_0xf405('0xa')]=function(_0x22ae3b,_0x122020){return request('SendMail',{'account':_0x22ae3b,'message':_0x122020});}; \ No newline at end of file +var _0xa0bd=['then','error','message','result','sendMailMessage','SendMail','client','http','request'];(function(_0x608181,_0x214819){var _0x16ade8=function(_0x2c3482){while(--_0x2c3482){_0x608181['push'](_0x608181['shift']());}};_0x16ade8(++_0x214819);}(_0xa0bd,0x1b6));var _0xda0b=function(_0x13e395,_0x5d49de){_0x13e395=_0x13e395-0x0;var _0x9fa5fd=_0xa0bd[_0x13e395];return _0x9fa5fd;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xda0b('0x0')][_0xda0b('0x1')]({'port':0x232b});function request(_0x550540,_0x110d3b){return new BPromise(function(_0x20c317,_0x2a82f5){return client[_0xda0b('0x2')](_0x550540,_0x110d3b)[_0xda0b('0x3')](function(_0x1767a7){if(_0x1767a7[_0xda0b('0x4')]){return _0x2a82f5(_0x1767a7[_0xda0b('0x4')][_0xda0b('0x5')]);}else{return _0x20c317(_0x1767a7[_0xda0b('0x6')]);}})['catch'](function(_0xa990ad){return _0x2a82f5(_0xa990ad);});});}exports[_0xda0b('0x7')]=function(_0x205b2d,_0x3d6e81){return request(_0xda0b('0x8'),{'account':_0x205b2d,'message':_0x3d6e81});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5e6faad..c48961e 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 _0xc319=['updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','whatsappStatusTime','mailWaitingInteractions','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle'];(function(_0x4ca43f,_0x1b1897){var _0x20b24f=function(_0x140d9c){while(--_0x140d9c){_0x4ca43f['push'](_0x4ca43f['shift']());}};_0x20b24f(++_0x1b1897);}(_0xc319,0x155));var _0x9c31=function(_0x51f19f,_0x5f5ab9){_0x51f19f=_0x51f19f-0x0;var _0x3e2313=_0xc319[_0x51f19f];return _0x3e2313;};'use strict';var _=require(_0x9c31('0x0'));var moment=require(_0x9c31('0x1'));var md5=require(_0x9c31('0x2'));var Redis=require(_0x9c31('0x3'));var config=require('../../../config/environment');config[_0x9c31('0x4')]=_[_0x9c31('0x5')](config[_0x9c31('0x4')],{'host':_0x9c31('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c31('0x4')]));function Agent(_0x3059c6){this['id']=_0x3059c6['id']||0x0;this[_0x9c31('0x7')]=_0x3059c6['name']||'';this['online']=_0x3059c6[_0x9c31('0x8')]||!![];this[_0x9c31('0x9')]=_0x3059c6[_0x9c31('0x9')]||![];this[_0x9c31('0xa')]=_0x3059c6['chatPause']||![];this[_0x9c31('0xb')]=_0x3059c6['mailPause']||![];this[_0x9c31('0xc')]=_0x3059c6[_0x9c31('0xc')]||![];this[_0x9c31('0xd')]=_0x3059c6[_0x9c31('0xd')]||![];this[_0x9c31('0xe')]=_0x3059c6[_0x9c31('0xe')]||![];this['chatStatus']=_0x9c31('0xf');this['chatStatusTime']=0x0;this[_0x9c31('0x10')]=_0x3059c6[_0x9c31('0x10')]||0x0;this[_0x9c31('0x11')]=0x0;this[_0x9c31('0x12')]='unknown';this[_0x9c31('0x13')]=0x0;this[_0x9c31('0x14')]=_0x3059c6['mailCapacity']||0x0;this[_0x9c31('0x15')]=0x0;this[_0x9c31('0x16')]=_0x9c31('0xf');this[_0x9c31('0x17')]=0x0;this[_0x9c31('0x18')]=_0x3059c6[_0x9c31('0x18')]||0x0;this[_0x9c31('0x19')]=0x0;this[_0x9c31('0x1a')]=_0x9c31('0xf');this[_0x9c31('0x1b')]=0x0;this[_0x9c31('0x1c')]=_0x3059c6['smsCapacity']||0x0;this[_0x9c31('0x1d')]=0x0;this[_0x9c31('0x1e')]=_0x9c31('0xf');this['whatsappStatusTime']=0x0;this[_0x9c31('0x1f')]=_0x3059c6['whatsappCapacity']||0x0;this[_0x9c31('0x20')]=0x0;this[_0x9c31('0x21')]=_0x9c31('0xf');this[_0x9c31('0x22')]=0x0;this[_0x9c31('0x23')]=_0x3059c6[_0x9c31('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x9c31('0x24')]=![];this[_0x9c31('0x25')]=undefined;this[_0x9c31('0x2')]='';this[_0x9c31('0x26')]={};this[_0x9c31('0x27')]={};this['mailWaitingInteractions']={};this[_0x9c31('0x28')]={};this[_0x9c31('0x29')]={};this[_0x9c31('0x2a')]={};this['updateRealtime']();}Agent[_0x9c31('0x2b')][_0x9c31('0x2c')]=function(_0x4bc774){if(this[_0x4bc774+_0x9c31('0x2d')]>0x0){if(this[_0x4bc774+_0x9c31('0x2e')]>0x0&&this[_0x4bc774+_0x9c31('0x2d')]>=this[_0x4bc774+'Capacity']){return'maxcapacity';}else{return _0x9c31('0x2f');}}else{return _0x9c31('0x30');}};Agent['prototype'][_0x9c31('0x31')]=function(){var _0x49d6a8=[_0x9c31('0x32'),_0x9c31('0x33'),'openchannel',_0x9c31('0x34'),_0x9c31('0x35'),_0x9c31('0x36')];for(var _0x5345ff=0x0;_0x5345ff<_0x49d6a8[_0x9c31('0x37')];_0x5345ff+=0x1){var _0x5043ac=this[_0x9c31('0x2c')](_0x49d6a8[_0x5345ff]);if(this[_0x49d6a8[_0x5345ff]+_0x9c31('0x38')]!==_0x5043ac){this[_0x49d6a8[_0x5345ff]+_0x9c31('0x39')]=_[_0x9c31('0x3a')](moment()[_0x9c31('0x3b')]('x'));}this[_0x49d6a8[_0x5345ff]+_0x9c31('0x38')]=_0x5043ac;}var _0x33197f={'id':this['id'],'name':this[_0x9c31('0x7')],'online':this[_0x9c31('0x8')],'voicePause':this[_0x9c31('0x9')],'chatPause':this[_0x9c31('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x9c31('0xd')],'faxPause':this[_0x9c31('0xc')],'openchannelPause':this[_0x9c31('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x9c31('0x10')],'chatCurrentCapacity':this[_0x9c31('0x11')],'mailStatus':this[_0x9c31('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x9c31('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9c31('0x16')],'faxStatusTime':this[_0x9c31('0x17')],'faxCapacity':this[_0x9c31('0x18')],'faxCurrentCapacity':this[_0x9c31('0x19')],'smsStatus':this[_0x9c31('0x1a')],'smsStatusTime':this[_0x9c31('0x1b')],'smsCapacity':this[_0x9c31('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x9c31('0x1e')],'whatsappStatusTime':this[_0x9c31('0x3c')],'whatsappCapacity':this[_0x9c31('0x1f')],'whatsappCurrentCapacity':this[_0x9c31('0x20')],'openchannelStatus':this[_0x9c31('0x21')],'openchannelStatusTime':this[_0x9c31('0x22')],'openchannelCapacity':this[_0x9c31('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x9c31('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x9c31('0x27')],'mailWaitingInteractions':this[_0x9c31('0x3d')],'openchannelWaitingInteractions':this[_0x9c31('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x50ba7e=md5(JSON['stringify'](_0x33197f));if(this[_0x9c31('0x2')]!==_0x50ba7e){this[_0x9c31('0x2')]=_0x50ba7e;io[_0x9c31('0x3e')](_0x9c31('0x3f'),_0x33197f);}};module[_0x9c31('0x40')]=Agent; \ No newline at end of file +var _0x5503=['socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','smsStatus','smsCapacity','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','Status','StatusTime','toNumber','format','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','smsWaitingInteractions','stringify','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x5503,0x109));var _0x3550=function(_0x426699,_0xa44d5b){_0x426699=_0x426699-0x0;var _0x39407d=_0x5503[_0x426699];return _0x39407d;};'use strict';var _=require(_0x3550('0x0'));var moment=require('moment');var md5=require(_0x3550('0x1'));var Redis=require(_0x3550('0x2'));var config=require(_0x3550('0x3'));config[_0x3550('0x4')]=_[_0x3550('0x5')](config[_0x3550('0x4')],{'host':_0x3550('0x6'),'port':0x18eb});var io=require(_0x3550('0x7'))(new Redis(config[_0x3550('0x4')]));function Agent(_0x4003b9){this['id']=_0x4003b9['id']||0x0;this[_0x3550('0x8')]=_0x4003b9['name']||'';this[_0x3550('0x9')]=_0x4003b9['online']||!![];this[_0x3550('0xa')]=_0x4003b9[_0x3550('0xa')]||![];this['chatPause']=_0x4003b9[_0x3550('0xb')]||![];this['mailPause']=_0x4003b9['mailPause']||![];this[_0x3550('0xc')]=_0x4003b9[_0x3550('0xc')]||![];this[_0x3550('0xd')]=_0x4003b9['smsPause']||![];this[_0x3550('0xe')]=_0x4003b9[_0x3550('0xe')]||![];this[_0x3550('0xf')]=_0x3550('0x10');this[_0x3550('0x11')]=0x0;this[_0x3550('0x12')]=_0x4003b9[_0x3550('0x12')]||0x0;this[_0x3550('0x13')]=0x0;this[_0x3550('0x14')]=_0x3550('0x10');this[_0x3550('0x15')]=0x0;this[_0x3550('0x16')]=_0x4003b9['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x3550('0x17')]=_0x3550('0x10');this[_0x3550('0x18')]=0x0;this['faxCapacity']=_0x4003b9['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x3550('0x19')]='unknown';this['smsStatusTime']=0x0;this[_0x3550('0x1a')]=_0x4003b9[_0x3550('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x3550('0x10');this[_0x3550('0x1b')]=0x0;this['whatsappCapacity']=_0x4003b9['whatsappCapacity']||0x0;this[_0x3550('0x1c')]=0x0;this[_0x3550('0x1d')]=_0x3550('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x4003b9[_0x3550('0x1e')]||0x0;this[_0x3550('0x1f')]=0x0;this[_0x3550('0x20')]=![];this[_0x3550('0x21')]=undefined;this['md5']='';this[_0x3550('0x22')]={};this[_0x3550('0x23')]={};this[_0x3550('0x24')]={};this[_0x3550('0x25')]={};this['smsWaitingInteractions']={};this[_0x3550('0x26')]={};this[_0x3550('0x27')]();}Agent[_0x3550('0x28')][_0x3550('0x29')]=function(_0x433cb7){if(this[_0x433cb7+_0x3550('0x2a')]>0x0){if(this[_0x433cb7+'Capacity']>0x0&&this[_0x433cb7+_0x3550('0x2a')]>=this[_0x433cb7+_0x3550('0x2b')]){return _0x3550('0x2c');}else{return _0x3550('0x2d');}}else{return _0x3550('0x2e');}};Agent[_0x3550('0x28')][_0x3550('0x27')]=function(){var _0x517c70=[_0x3550('0x2f'),_0x3550('0x30'),_0x3550('0x31'),_0x3550('0x32'),_0x3550('0x33'),'whatsapp'];for(var _0x48de17=0x0;_0x48de17<_0x517c70['length'];_0x48de17+=0x1){var _0x1df823=this[_0x3550('0x29')](_0x517c70[_0x48de17]);if(this[_0x517c70[_0x48de17]+_0x3550('0x34')]!==_0x1df823){this[_0x517c70[_0x48de17]+_0x3550('0x35')]=_[_0x3550('0x36')](moment()[_0x3550('0x37')]('x'));}this[_0x517c70[_0x48de17]+_0x3550('0x34')]=_0x1df823;}var _0x63f9a1={'id':this['id'],'name':this[_0x3550('0x8')],'online':this[_0x3550('0x9')],'voicePause':this[_0x3550('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x3550('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x3550('0xe')],'chatStatus':this[_0x3550('0xf')],'chatStatusTime':this[_0x3550('0x11')],'chatCapacity':this[_0x3550('0x12')],'chatCurrentCapacity':this[_0x3550('0x13')],'mailStatus':this[_0x3550('0x14')],'mailStatusTime':this[_0x3550('0x15')],'mailCapacity':this[_0x3550('0x16')],'mailCurrentCapacity':this[_0x3550('0x38')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3550('0x18')],'faxCapacity':this[_0x3550('0x39')],'faxCurrentCapacity':this[_0x3550('0x3a')],'smsStatus':this[_0x3550('0x19')],'smsStatusTime':this[_0x3550('0x3b')],'smsCapacity':this[_0x3550('0x1a')],'smsCurrentCapacity':this[_0x3550('0x3c')],'whatsappStatus':this[_0x3550('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x3550('0x3e')],'whatsappCurrentCapacity':this[_0x3550('0x1c')],'openchannelStatus':this[_0x3550('0x1d')],'openchannelStatusTime':this[_0x3550('0x3f')],'openchannelCapacity':this[_0x3550('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x3550('0x20')],'busyQueue':this[_0x3550('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x3550('0x23')],'mailWaitingInteractions':this[_0x3550('0x24')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x3550('0x40')],'whatsappWaitingInteractions':this[_0x3550('0x26')]};var _0x1751f2=md5(JSON[_0x3550('0x41')](_0x63f9a1));if(this[_0x3550('0x1')]!==_0x1751f2){this['md5']=_0x1751f2;io[_0x3550('0x42')](_0x3550('0x43'),_0x63f9a1);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 886fede..42c37cd 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 _0x6c5a=['ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','length','online','available','loggedIn','format','chat:queue:%s','emit','chat_queue:save','lodash','md5'];(function(_0x13fd95,_0x1062c5){var _0xe3aa3d=function(_0xc48a64){while(--_0xc48a64){_0x13fd95['push'](_0x13fd95['shift']());}};_0xe3aa3d(++_0x1062c5);}(_0x6c5a,0xb4));var _0xa6c5=function(_0x15135a,_0x1c56b0){_0x15135a=_0x15135a-0x0;var _0x272512=_0x6c5a[_0x15135a];return _0x272512;};'use strict';var _=require(_0xa6c5('0x0'));var md5=require(_0xa6c5('0x1'));var util=require('util');var Redis=require(_0xa6c5('0x2'));var config=require(_0xa6c5('0x3'));config[_0xa6c5('0x4')]=_['defaults'](config[_0xa6c5('0x4')],{'host':_0xa6c5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6c5('0x4')]));function ChatQueue(_0x4fa4bc){this['id']=_0x4fa4bc['id']||0x0;this[_0xa6c5('0x6')]=_0x4fa4bc[_0xa6c5('0x6')]||'';this[_0xa6c5('0x7')]=_0x4fa4bc[_0xa6c5('0x7')]||0xa;this['strategy']=_0x4fa4bc[_0xa6c5('0x8')]||_0xa6c5('0x9');this[_0xa6c5('0xa')]=_0x4fa4bc[_0xa6c5('0xa')];this['mapAgentsId']={};this[_0xa6c5('0xb')]=0x0;this[_0xa6c5('0x1')]='';this[_0xa6c5('0xc')]();this[_0xa6c5('0xd')]();}ChatQueue[_0xa6c5('0xe')][_0xa6c5('0xc')]=function(){var _0x5133e6=this[_0xa6c5('0xf')]['_rr'];this[_0xa6c5('0xf')]=_[_0xa6c5('0x10')](this[_0xa6c5('0xa')],'id');this[_0xa6c5('0xf')]['_rr']=_0x5133e6;};ChatQueue[_0xa6c5('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xa6c5('0x11')]=0x0;for(var _0x25fa83=0x0;_0x25fa83=0x0?this[_0xa6c5('0x14')]:0x0;var _0x272c1d={'id':this['id'],'available':this[_0xa6c5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xa6c5('0x6')],'paused':this['paused'],'waiting':this[_0xa6c5('0xb')]};var _0x1c78be=md5(JSON['stringify'](_0x272c1d));if(this['md5']!==_0x1c78be){this[_0xa6c5('0x1')]=_0x1c78be;io['to'](util[_0xa6c5('0x16')](_0xa6c5('0x17'),_0x272c1d[_0xa6c5('0x6')]))[_0xa6c5('0x18')](_0xa6c5('0x19'),_0x272c1d);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xcce1=['available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','length','paused','loggedIn'];(function(_0x24e04e,_0x4953b2){var _0xe76697=function(_0xc72c66){while(--_0xc72c66){_0x24e04e['push'](_0x24e04e['shift']());}};_0xe76697(++_0x4953b2);}(_0xcce1,0xc3));var _0x1cce=function(_0x56ea6f,_0x15535a){_0x56ea6f=_0x56ea6f-0x0;var _0x43ac31=_0xcce1[_0x56ea6f];return _0x43ac31;};'use strict';var _=require('lodash');var md5=require(_0x1cce('0x0'));var util=require(_0x1cce('0x1'));var Redis=require(_0x1cce('0x2'));var config=require(_0x1cce('0x3'));config[_0x1cce('0x4')]=_[_0x1cce('0x5')](config[_0x1cce('0x4')],{'host':_0x1cce('0x6'),'port':0x18eb});var io=require(_0x1cce('0x7'))(new Redis(config[_0x1cce('0x4')]));function ChatQueue(_0x52eaf5){this['id']=_0x52eaf5['id']||0x0;this[_0x1cce('0x8')]=_0x52eaf5[_0x1cce('0x8')]||'';this[_0x1cce('0x9')]=_0x52eaf5[_0x1cce('0x9')]||0xa;this['strategy']=_0x52eaf5['strategy']||_0x1cce('0xa');this['Agents']=_0x52eaf5[_0x1cce('0xb')];this[_0x1cce('0xc')]={};this[_0x1cce('0xd')]=0x0;this[_0x1cce('0x0')]='';this[_0x1cce('0xe')]();this[_0x1cce('0xf')]();}ChatQueue['prototype'][_0x1cce('0xe')]=function(){var _0x11792c=this['mapAgentsId'][_0x1cce('0x10')];this[_0x1cce('0xc')]=_['map'](this[_0x1cce('0xb')],'id');this[_0x1cce('0xc')][_0x1cce('0x10')]=_0x11792c;};ChatQueue[_0x1cce('0x11')][_0x1cce('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2fbb6b=0x0;_0x2fbb6b=0x0?this[_0x1cce('0x15')]:0x0;var _0x1aad01={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1cce('0x13')],'waiting':this[_0x1cce('0xd')]};var _0x1b426f=md5(JSON[_0x1cce('0x16')](_0x1aad01));if(this[_0x1cce('0x0')]!==_0x1b426f){this[_0x1cce('0x0')]=_0x1b426f;io['to'](util[_0x1cce('0x17')](_0x1cce('0x18'),_0x1aad01[_0x1cce('0x8')]))['emit'](_0x1cce('0x19'),_0x1aad01);}};module[_0x1cce('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ac33b3b..e21adc5 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 _0x48c8=['loggedIn','faxPause','available','stringify','format','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','paused','length','online'];(function(_0x5dfc68,_0x425216){var _0xb8e0a8=function(_0x3652ff){while(--_0x3652ff){_0x5dfc68['push'](_0x5dfc68['shift']());}};_0xb8e0a8(++_0x425216);}(_0x48c8,0xa9));var _0x848c=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x48c8[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x848c('0x0'));var md5=require(_0x848c('0x1'));var util=require(_0x848c('0x2'));var Redis=require(_0x848c('0x3'));var config=require(_0x848c('0x4'));config['redis']=_['defaults'](config[_0x848c('0x5')],{'host':_0x848c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x848c('0x5')]));function FaxQueue(_0x2dee0f){this['id']=_0x2dee0f['id']||0x0;this[_0x848c('0x7')]=_0x2dee0f[_0x848c('0x7')]||'';this[_0x848c('0x8')]=_0x2dee0f[_0x848c('0x8')]||0xa;this['strategy']=_0x2dee0f[_0x848c('0x9')]||'beepall';this['Agents']=_0x2dee0f[_0x848c('0xa')];this[_0x848c('0xb')]={};this[_0x848c('0xc')]=0x0;this[_0x848c('0x1')]='';this['updateRouting']();this[_0x848c('0xd')]();}FaxQueue['prototype'][_0x848c('0xe')]=function(){var _0x2e653a=this[_0x848c('0xb')][_0x848c('0xf')];this[_0x848c('0xb')]=_[_0x848c('0x10')](this[_0x848c('0xa')],'id');this[_0x848c('0xb')]['_rr']=_0x2e653a;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x848c('0x11')]=0x0;for(var _0x243d0a=0x0;_0x243d0a=0x0?this['available']:0x0;var _0x2b6591={'id':this['id'],'available':this[_0x848c('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x848c('0x7')],'paused':this[_0x848c('0x11')],'waiting':this[_0x848c('0xc')]};var _0x4e5bd2=md5(JSON[_0x848c('0x17')](_0x2b6591));if(this[_0x848c('0x1')]!==_0x4e5bd2){this['md5']=_0x4e5bd2;io['to'](util[_0x848c('0x18')]('fax:queue:%s',_0x2b6591['name']))[_0x848c('0x19')](_0x848c('0x1a'),_0x2b6591);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x5238=['updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5238,0x197));var _0x8523=function(_0x1029b0,_0x56c2b3){_0x1029b0=_0x1029b0-0x0;var _0xb69260=_0x5238[_0x1029b0];return _0xb69260;};'use strict';var _=require(_0x8523('0x0'));var md5=require(_0x8523('0x1'));var util=require('util');var Redis=require(_0x8523('0x2'));var config=require(_0x8523('0x3'));config[_0x8523('0x4')]=_[_0x8523('0x5')](config[_0x8523('0x4')],{'host':_0x8523('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8523('0x4')]));function FaxQueue(_0x20c42a){this['id']=_0x20c42a['id']||0x0;this[_0x8523('0x7')]=_0x20c42a['name']||'';this[_0x8523('0x8')]=_0x20c42a[_0x8523('0x8')]||0xa;this['strategy']=_0x20c42a[_0x8523('0x9')]||'beepall';this[_0x8523('0xa')]=_0x20c42a[_0x8523('0xa')];this[_0x8523('0xb')]={};this[_0x8523('0xc')]=0x0;this[_0x8523('0x1')]='';this[_0x8523('0xd')]();this[_0x8523('0xe')]();}FaxQueue[_0x8523('0xf')][_0x8523('0xd')]=function(){var _0x19a051=this['mapAgentsId']['_rr'];this[_0x8523('0xb')]=_['map'](this[_0x8523('0xa')],'id');this['mapAgentsId'][_0x8523('0x10')]=_0x19a051;};FaxQueue['prototype'][_0x8523('0xe')]=function(){this[_0x8523('0x11')]=0x0;this[_0x8523('0x12')]=0x0;for(var _0x46bc55=0x0;_0x46bc55=0x0?this[_0x8523('0x16')]:0x0;var _0x2a2747={'id':this['id'],'available':this[_0x8523('0x16')],'loggedIn':this[_0x8523('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x8523('0xc')]};var _0x150016=md5(JSON[_0x8523('0x17')](_0x2a2747));if(this['md5']!==_0x150016){this[_0x8523('0x1')]=_0x150016;io['to'](util[_0x8523('0x18')](_0x8523('0x19'),_0x2a2747[_0x8523('0x7')]))['emit'](_0x8523('0x1a'),_0x2a2747);}};module[_0x8523('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6a445e4..b0e0f3d 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 _0x0a8a=['exports','name','Intervals'];(function(_0xc589ad,_0x456701){var _0x19eb9b=function(_0x326208){while(--_0x326208){_0xc589ad['push'](_0xc589ad['shift']());}};_0x19eb9b(++_0x456701);}(_0x0a8a,0x6a));var _0xa0a8=function(_0x10bf39,_0x3cd4bc){_0x10bf39=_0x10bf39-0x0;var _0x2ccd63=_0x0a8a[_0x10bf39];return _0x2ccd63;};'use strict';function Interval(_0x469ee4){this['id']=_0x469ee4['id']||0x0;this[_0xa0a8('0x0')]=_0x469ee4[_0xa0a8('0x0')]||'';this['Intervals']=_0x469ee4[_0xa0a8('0x1')]||{};}module[_0xa0a8('0x2')]=Interval; \ No newline at end of file +var _0x2a0d=['exports','name','Intervals'];(function(_0x18b36c,_0xe906ce){var _0x5c95c5=function(_0x22b766){while(--_0x22b766){_0x18b36c['push'](_0x18b36c['shift']());}};_0x5c95c5(++_0xe906ce);}(_0x2a0d,0x163));var _0xd2a0=function(_0x3551c8,_0x4f3f44){_0x3551c8=_0x3551c8-0x0;var _0x2ce5fc=_0x2a0d[_0x3551c8];return _0x2ce5fc;};'use strict';function Interval(_0x49b639){this['id']=_0x49b639['id']||0x0;this[_0xd2a0('0x0')]=_0x49b639[_0xd2a0('0x0')]||'';this[_0xd2a0('0x1')]=_0x49b639[_0xd2a0('0x1')]||{};}module[_0xd2a0('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 2809a51..20eea42 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 _0x312d=['paused','length','Agents','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','redis','defaults','localhost','name','timeout','strategy','beepall','waiting','updateRouting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x312d,0x14d));var _0xd312=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x312d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xd312('0x0'));var md5=require(_0xd312('0x1'));var util=require(_0xd312('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd312('0x3')]=_[_0xd312('0x4')](config[_0xd312('0x3')],{'host':_0xd312('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd312('0x3')]));function MailQueue(_0x342e78){this['id']=_0x342e78['id']||0x0;this['name']=_0x342e78[_0xd312('0x6')]||'';this[_0xd312('0x7')]=_0x342e78['timeout']||0xa;this[_0xd312('0x8')]=_0x342e78[_0xd312('0x8')]||_0xd312('0x9');this['Agents']=_0x342e78['Agents'];this['mapAgentsId']={};this[_0xd312('0xa')]=0x0;this[_0xd312('0x1')]='';this[_0xd312('0xb')]();this['updateRealtime']();}MailQueue[_0xd312('0xc')][_0xd312('0xb')]=function(){var _0x357249=this['mapAgentsId'][_0xd312('0xd')];this[_0xd312('0xe')]=_[_0xd312('0xf')](this['Agents'],'id');this[_0xd312('0xe')][_0xd312('0xd')]=_0x357249;};MailQueue['prototype'][_0xd312('0x10')]=function(){this[_0xd312('0x11')]=0x0;this[_0xd312('0x12')]=0x0;for(var _0x1af3a9=0x0;_0x1af3a9=0x0?this[_0xd312('0x15')]:0x0;var _0xd31e7c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xd312('0x6')],'paused':this[_0xd312('0x12')],'waiting':this[_0xd312('0xa')]};var _0x8ef79=md5(JSON['stringify'](_0xd31e7c));if(this['md5']!==_0x8ef79){this[_0xd312('0x1')]=_0x8ef79;io['to'](util[_0xd312('0x16')](_0xd312('0x17'),_0xd31e7c['name']))[_0xd312('0x18')](_0xd312('0x19'),_0xd31e7c);}};module[_0xd312('0x1a')]=MailQueue; \ No newline at end of file +var _0xbf31=['mapAgentsId','_rr','map','prototype','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','Agents','updateRealtime'];(function(_0x44eaff,_0x42f085){var _0x4f3635=function(_0x23b971){while(--_0x23b971){_0x44eaff['push'](_0x44eaff['shift']());}};_0x4f3635(++_0x42f085);}(_0xbf31,0xcc));var _0x1bf3=function(_0x2d9a4c,_0x2a2ecc){_0x2d9a4c=_0x2d9a4c-0x0;var _0x101fa7=_0xbf31[_0x2d9a4c];return _0x101fa7;};'use strict';var _=require(_0x1bf3('0x0'));var md5=require(_0x1bf3('0x1'));var util=require(_0x1bf3('0x2'));var Redis=require(_0x1bf3('0x3'));var config=require(_0x1bf3('0x4'));config[_0x1bf3('0x5')]=_['defaults'](config['redis'],{'host':_0x1bf3('0x6'),'port':0x18eb});var io=require(_0x1bf3('0x7'))(new Redis(config['redis']));function MailQueue(_0x2cc2da){this['id']=_0x2cc2da['id']||0x0;this[_0x1bf3('0x8')]=_0x2cc2da['name']||'';this['timeout']=_0x2cc2da[_0x1bf3('0x9')]||0xa;this['strategy']=_0x2cc2da['strategy']||'beepall';this[_0x1bf3('0xa')]=_0x2cc2da[_0x1bf3('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1bf3('0x1')]='';this['updateRouting']();this[_0x1bf3('0xb')]();}MailQueue['prototype']['updateRouting']=function(){var _0x2b9ec2=this[_0x1bf3('0xc')][_0x1bf3('0xd')];this[_0x1bf3('0xc')]=_[_0x1bf3('0xe')](this[_0x1bf3('0xa')],'id');this[_0x1bf3('0xc')]['_rr']=_0x2b9ec2;};MailQueue[_0x1bf3('0xf')]['updateRealtime']=function(){this[_0x1bf3('0x10')]=0x0;this[_0x1bf3('0x11')]=0x0;for(var _0x213176=0x0;_0x213176=0x0?this[_0x1bf3('0x14')]:0x0;var _0x115912={'id':this['id'],'available':this[_0x1bf3('0x14')],'loggedIn':this[_0x1bf3('0x10')],'name':this[_0x1bf3('0x8')],'paused':this[_0x1bf3('0x11')],'waiting':this['waiting']};var _0x4b6590=md5(JSON[_0x1bf3('0x15')](_0x115912));if(this[_0x1bf3('0x1')]!==_0x4b6590){this[_0x1bf3('0x1')]=_0x4b6590;io['to'](util[_0x1bf3('0x16')](_0x1bf3('0x17'),_0x115912['name']))[_0x1bf3('0x18')](_0x1bf3('0x19'),_0x115912);}};module[_0x1bf3('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index da27b3a..ba60bd9 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(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x2d3160,_0xec23d7){var _0x73e127=function(_0x1dba61){while(--_0x1dba61){_0x2d3160['push'](_0x2d3160['shift']());}};_0x73e127(++_0xec23d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0x5fc3[_0x19d350];return _0x3bfc8d;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 72fcd9d..b88a465 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0269=['util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','available','paused','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x2fbdcc,_0x1f73be){var _0x185d08=function(_0x297bf1){while(--_0x297bf1){_0x2fbdcc['push'](_0x2fbdcc['shift']());}};_0x185d08(++_0x1f73be);}(_0x0269,0x135));var _0x9026=function(_0x3c42ae,_0xfd8e90){_0x3c42ae=_0x3c42ae-0x0;var _0x58ea11=_0x0269[_0x3c42ae];return _0x58ea11;};'use strict';var _=require(_0x9026('0x0'));var md5=require('md5');var util=require(_0x9026('0x1'));var Redis=require('ioredis');var config=require(_0x9026('0x2'));config['redis']=_[_0x9026('0x3')](config[_0x9026('0x4')],{'host':_0x9026('0x5'),'port':0x18eb});var io=require(_0x9026('0x6'))(new Redis(config['redis']));function SmsQueue(_0x314458){this['id']=_0x314458['id']||0x0;this[_0x9026('0x7')]=_0x314458['name']||'';this['timeout']=_0x314458[_0x9026('0x8')]||0xa;this[_0x9026('0x9')]=_0x314458[_0x9026('0x9')]||_0x9026('0xa');this['Agents']=_0x314458[_0x9026('0xb')];this[_0x9026('0xc')]={};this[_0x9026('0xd')]=0x0;this['md5']='';this[_0x9026('0xe')]();this[_0x9026('0xf')]();}SmsQueue[_0x9026('0x10')]['updateRouting']=function(){var _0x2c1dd2=this['mapAgentsId'][_0x9026('0x11')];this[_0x9026('0xc')]=_[_0x9026('0x12')](this[_0x9026('0xb')],'id');this[_0x9026('0xc')][_0x9026('0x11')]=_0x2c1dd2;};SmsQueue[_0x9026('0x10')]['updateRealtime']=function(){this[_0x9026('0x13')]=0x0;this['paused']=0x0;for(var _0x385afc=0x0;_0x385afc=0x0?this[_0x9026('0x17')]:0x0;var _0x4e37d0={'id':this['id'],'available':this[_0x9026('0x17')],'loggedIn':this[_0x9026('0x13')],'name':this[_0x9026('0x7')],'paused':this[_0x9026('0x18')],'waiting':this['waiting']};var _0x7985=md5(JSON['stringify'](_0x4e37d0));if(this[_0x9026('0x19')]!==_0x7985){this['md5']=_0x7985;io['to'](util[_0x9026('0x1a')](_0x9026('0x1b'),_0x4e37d0[_0x9026('0x7')]))[_0x9026('0x1c')](_0x9026('0x1d'),_0x4e37d0);}};module[_0x9026('0x1e')]=SmsQueue; \ No newline at end of file +var _0x919e=['stringify','format','emit','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','paused','available'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var md5=require(_0xe919('0x1'));var util=require(_0xe919('0x2'));var Redis=require('ioredis');var config=require(_0xe919('0x3'));config['redis']=_['defaults'](config[_0xe919('0x4')],{'host':_0xe919('0x5'),'port':0x18eb});var io=require(_0xe919('0x6'))(new Redis(config[_0xe919('0x4')]));function SmsQueue(_0x2171e9){this['id']=_0x2171e9['id']||0x0;this[_0xe919('0x7')]=_0x2171e9[_0xe919('0x7')]||'';this['timeout']=_0x2171e9[_0xe919('0x8')]||0xa;this[_0xe919('0x9')]=_0x2171e9['strategy']||_0xe919('0xa');this['Agents']=_0x2171e9[_0xe919('0xb')];this[_0xe919('0xc')]={};this[_0xe919('0xd')]=0x0;this['md5']='';this[_0xe919('0xe')]();this[_0xe919('0xf')]();}SmsQueue[_0xe919('0x10')]['updateRouting']=function(){var _0x12098d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xe919('0x11')](this[_0xe919('0xb')],'id');this[_0xe919('0xc')]['_rr']=_0x12098d;};SmsQueue['prototype'][_0xe919('0xf')]=function(){this[_0xe919('0x12')]=0x0;this['paused']=0x0;for(var _0x3c09be=0x0;_0x3c09be=0x0?this['available']:0x0;var _0x5250b9={'id':this['id'],'available':this[_0xe919('0x16')],'loggedIn':this[_0xe919('0x12')],'name':this[_0xe919('0x7')],'paused':this[_0xe919('0x15')],'waiting':this['waiting']};var _0x4cc471=md5(JSON[_0xe919('0x17')](_0x5250b9));if(this[_0xe919('0x1')]!==_0x4cc471){this[_0xe919('0x1')]=_0x4cc471;io['to'](util[_0xe919('0x18')]('sms:queue:%s',_0x5250b9[_0xe919('0x7')]))[_0xe919('0x19')]('sms_queue:save',_0x5250b9);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 73dbfd7..66ec024 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 _0xe78d=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x520477,_0x5ea467){var _0x3856e1=function(_0xd78ba4){while(--_0xd78ba4){_0x520477['push'](_0x520477['shift']());}};_0x3856e1(++_0x5ea467);}(_0xe78d,0x162));var _0xde78=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe78d[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var md5=require(_0xde78('0x0'));var util=require(_0xde78('0x1'));var Redis=require(_0xde78('0x2'));var config=require(_0xde78('0x3'));config[_0xde78('0x4')]=_[_0xde78('0x5')](config[_0xde78('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xde78('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x5495c3){this['id']=_0x5495c3['id']||0x0;this[_0xde78('0x7')]=_0x5495c3[_0xde78('0x7')]||'';this[_0xde78('0x8')]=_0x5495c3[_0xde78('0x8')]||0xa;this[_0xde78('0x9')]=_0x5495c3[_0xde78('0x9')]||_0xde78('0xa');this[_0xde78('0xb')]=_0x5495c3[_0xde78('0xb')];this[_0xde78('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xde78('0xd')]();this[_0xde78('0xe')]();}WhatsappQueue[_0xde78('0xf')][_0xde78('0xd')]=function(){var _0x2c11f7=this[_0xde78('0xc')][_0xde78('0x10')];this[_0xde78('0xc')]=_[_0xde78('0x11')](this['Agents'],'id');this[_0xde78('0xc')][_0xde78('0x10')]=_0x2c11f7;};WhatsappQueue[_0xde78('0xf')]['updateRealtime']=function(){this[_0xde78('0x12')]=0x0;this[_0xde78('0x13')]=0x0;for(var _0x483faf=0x0;_0x483faf=0x0?this[_0xde78('0x17')]:0x0;var _0x4fa454={'id':this['id'],'available':this['available'],'loggedIn':this[_0xde78('0x12')],'name':this[_0xde78('0x7')],'paused':this[_0xde78('0x13')],'waiting':this[_0xde78('0x18')]};var _0x3ea4ff=md5(JSON['stringify'](_0x4fa454));if(this[_0xde78('0x0')]!==_0x3ea4ff){this[_0xde78('0x0')]=_0x3ea4ff;io['to'](util[_0xde78('0x19')](_0xde78('0x1a'),_0x4fa454[_0xde78('0x7')]))[_0xde78('0x1b')](_0xde78('0x1c'),_0x4fa454);}};module[_0xde78('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x9045=['whatsappPause','available','waiting','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','online'];(function(_0x4e5736,_0x31c77b){var _0x59e392=function(_0x27aa30){while(--_0x27aa30){_0x4e5736['push'](_0x4e5736['shift']());}};_0x59e392(++_0x31c77b);}(_0x9045,0x146));var _0x5904=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x9045[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x5904('0x0'));var md5=require(_0x5904('0x1'));var util=require(_0x5904('0x2'));var Redis=require(_0x5904('0x3'));var config=require(_0x5904('0x4'));config[_0x5904('0x5')]=_[_0x5904('0x6')](config[_0x5904('0x5')],{'host':_0x5904('0x7'),'port':0x18eb});var io=require(_0x5904('0x8'))(new Redis(config[_0x5904('0x5')]));function WhatsappQueue(_0x1db1a4){this['id']=_0x1db1a4['id']||0x0;this[_0x5904('0x9')]=_0x1db1a4[_0x5904('0x9')]||'';this[_0x5904('0xa')]=_0x1db1a4[_0x5904('0xa')]||0xa;this['strategy']=_0x1db1a4[_0x5904('0xb')]||'beepall';this[_0x5904('0xc')]=_0x1db1a4[_0x5904('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x5904('0x1')]='';this['updateRouting']();this[_0x5904('0xd')]();}WhatsappQueue[_0x5904('0xe')][_0x5904('0xf')]=function(){var _0x1a3e20=this[_0x5904('0x10')][_0x5904('0x11')];this[_0x5904('0x10')]=_[_0x5904('0x12')](this[_0x5904('0xc')],'id');this['mapAgentsId'][_0x5904('0x11')]=_0x1a3e20;};WhatsappQueue['prototype'][_0x5904('0xd')]=function(){this[_0x5904('0x13')]=0x0;this[_0x5904('0x14')]=0x0;for(var _0x34bcea=0x0;_0x34bcea=0x0?this[_0x5904('0x17')]:0x0;var _0x55ab40={'id':this['id'],'available':this[_0x5904('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x5904('0x9')],'paused':this[_0x5904('0x14')],'waiting':this[_0x5904('0x18')]};var _0x225067=md5(JSON[_0x5904('0x19')](_0x55ab40));if(this[_0x5904('0x1')]!==_0x225067){this['md5']=_0x225067;io['to'](util['format']('whatsapp:queue:%s',_0x55ab40['name']))[_0x5904('0x1a')](_0x5904('0x1b'),_0x55ab40);}};module[_0x5904('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c7e73bb..03e44f3 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(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0xc4327,_0x3831e6){var _0x5d25be=function(_0x2a1bff){while(--_0x2a1bff){_0xc4327['push'](_0xc4327['shift']());}};_0x5d25be(++_0x3831e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x8fc9d1,_0x55be5e){_0x8fc9d1=_0x8fc9d1-0x0;var _0x445c72=_0xb10b[_0x8fc9d1];return _0x445c72;};'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 1ed8fa5..e4ff244 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 _0xb097=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb097,0x72));var _0x7b09=function(_0x4fc136,_0x69d1f4){_0x4fc136=_0x4fc136-0x0;var _0x1fbb3f=_0xb097[_0x4fc136];return _0x1fbb3f;};'use strict';var client=require('../client');exports[_0x7b09('0x0')]=function(_0x7615b5,_0x1551b6){return client[_0x7b09('0x1')](_0x7b09('0x2'),{'body':_0x1551b6,'options':{'where':{'id':_0x7615b5}},'log':_0x7b09('0x3')});};exports[_0x7b09('0x4')]=function(_0xa88835,_0x5b4e95){return client[_0x7b09('0x1')](_0x7b09('0x5'),{'body':_0x5b4e95,'options':{'where':{'id':_0xa88835}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7f5e=['updateChatInteraction','addTags','addTagsToChatInteraction','../client','Request'];(function(_0x21e5ad,_0x2bf42d){var _0xad5f43=function(_0x7fc785){while(--_0x7fc785){_0x21e5ad['push'](_0x21e5ad['shift']());}};_0xad5f43(++_0x2bf42d);}(_0x7f5e,0xc1));var _0xe7f5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f5e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xe7f5('0x0'));exports['update']=function(_0x4e7ce1,_0x21af9b){return client[_0xe7f5('0x1')]('UpdateChatInteraction',{'body':_0x21af9b,'options':{'where':{'id':_0x4e7ce1}},'log':_0xe7f5('0x2')});};exports[_0xe7f5('0x3')]=function(_0x14da3b,_0xb71364){return client['Request']('AddTagsToChatInteraction',{'body':_0xb71364,'options':{'where':{'id':_0x14da3b}},'log':_0xe7f5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4ac48aa..aa6fec6 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 _0x8067=['create','../client'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x8067,0xa5));var _0x7806=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8067[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x7806('0x0'));exports[_0x7806('0x1')]=function(_0x294e7c){return client['Request']('CreateChatMessage',{'body':_0x294e7c,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2cba=['../client','create','Request','CreateChatMessage'];(function(_0x2b8f4c,_0x168814){var _0x131298=function(_0x26b7dc){while(--_0x26b7dc){_0x2b8f4c['push'](_0x2b8f4c['shift']());}};_0x131298(++_0x168814);}(_0x2cba,0xc0));var _0xa2cb=function(_0x49b5f7,_0x59cef8){_0x49b5f7=_0x49b5f7-0x0;var _0x14469e=_0x2cba[_0x49b5f7];return _0x14469e;};'use strict';var client=require(_0xa2cb('0x0'));exports[_0xa2cb('0x1')]=function(_0xc16bad){return client[_0xa2cb('0x2')](_0xa2cb('0x3'),{'body':_0xc16bad,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 413d70b..960b1c4 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 _0x4944=['Request','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','getChatQueues','../client'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0x4944,0x6d));var _0x4494=function(_0x155b4d,_0x369502){_0x155b4d=_0x155b4d-0x0;var _0x19f51d=_0x4944[_0x155b4d];return _0x19f51d;};'use strict';var client=require(_0x4494('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4494('0x1')](_0x4494('0x2'),{'options':{'raw':![],'attributes':['id',_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5')],'include':[{'model':'User','as':_0x4494('0x6'),'attributes':['id','name',_0x4494('0x7'),_0x4494('0x8')]}]},'log':_0x4494('0x9')});};}; \ No newline at end of file +var _0xdad2=['strategy','Agents','chatPause','getChatQueues','Request','name','timeout'];(function(_0xb5dc17,_0x1573a1){var _0x15fc95=function(_0x1fb004){while(--_0x1fb004){_0xb5dc17['push'](_0xb5dc17['shift']());}};_0x15fc95(++_0x1573a1);}(_0xdad2,0x14c));var _0x2dad=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdad2[_0x1cc8fe];return _0x230054;};'use strict';var client=require('../client');exports[_0x2dad('0x0')]=function(){return function(){return client[_0x2dad('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x2dad('0x2'),_0x2dad('0x3'),_0x2dad('0x4')],'include':[{'model':'User','as':_0x2dad('0x5'),'attributes':['id',_0x2dad('0x2'),'online',_0x2dad('0x6')]}]},'log':_0x2dad('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index eb8b804..a846030 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 _0x2ce1=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','Request'];(function(_0x3b70bb,_0x5c7950){var _0x32cd33=function(_0xbcd387){while(--_0xbcd387){_0x3b70bb['push'](_0x3b70bb['shift']());}};_0x32cd33(++_0x5c7950);}(_0x2ce1,0x8b));var _0x12ce=function(_0x49860c,_0x49237e){_0x49860c=_0x49860c-0x0;var _0x4e2361=_0x2ce1[_0x49860c];return _0x4e2361;};'use strict';var client=require('../client');exports['create']=function(_0x5cfde5){return client[_0x12ce('0x0')](_0x12ce('0x1'),{'body':_0x5cfde5,'log':_0x12ce('0x1')});};exports[_0x12ce('0x2')]=function(_0x4918dc,_0x37b568){return client[_0x12ce('0x0')]('UpdateChatQueueReport',{'body':_0x37b568,'options':{'where':{'uniqueid':_0x4918dc},'order':[['id',_0x12ce('0x3')]],'limit':0x1},'log':_0x12ce('0x4')});}; \ No newline at end of file +var _0xc678=['Request','CreateChatQueueReport','update','DESC'];(function(_0x2faee9,_0x1ca570){var _0x4928ea=function(_0x1b99e6){while(--_0x1b99e6){_0x2faee9['push'](_0x2faee9['shift']());}};_0x4928ea(++_0x1ca570);}(_0xc678,0x1b4));var _0x8c67=function(_0x56bb9c,_0x14fbc9){_0x56bb9c=_0x56bb9c-0x0;var _0x3aa624=_0xc678[_0x56bb9c];return _0x3aa624;};'use strict';var client=require('../client');exports['create']=function(_0x3002e5){return client[_0x8c67('0x0')](_0x8c67('0x1'),{'body':_0x3002e5,'log':'CreateChatQueueReport'});};exports[_0x8c67('0x2')]=function(_0x3b01cc,_0xcfea76){return client[_0x8c67('0x0')]('UpdateChatQueueReport',{'body':_0xcfea76,'options':{'where':{'uniqueid':_0x3b01cc},'order':[['id',_0x8c67('0x3')]],'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 61ceeca..13341af 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x280cc1,_0x5ea95b){var _0x1e3fcb=function(_0x413acf){while(--_0x413acf){_0x280cc1['push'](_0x280cc1['shift']());}};_0x1e3fcb(++_0x5ea95b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x61c0bb,_0x48e4bf){var _0x5d549a=function(_0x4a4153){while(--_0x4a4153){_0x61c0bb['push'](_0x61c0bb['shift']());}};_0x5d549a(++_0x48e4bf);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0bc0f7b..4f86b05 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 _0x1cdc=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0x1cdc,0x182));var _0xc1cd=function(_0x9a9f46,_0x1d1e25){_0x9a9f46=_0x9a9f46-0x0;var _0x5dc8be=_0x1cdc[_0x9a9f46];return _0x5dc8be;};'use strict';var client=require(_0xc1cd('0x0'));exports['create']=function(_0x5b6e60){return client[_0xc1cd('0x1')](_0xc1cd('0x2'),{'body':_0x5b6e60,'log':_0xc1cd('0x3')});}; \ No newline at end of file +var _0xb451=['Request','CreateFaxMessage','../client'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb451,0x1e2));var _0x1b45=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xb451[_0x36436d];return _0x34615d;};'use strict';var client=require(_0x1b45('0x0'));exports['create']=function(_0x30cd35){return client[_0x1b45('0x1')](_0x1b45('0x2'),{'body':_0x30cd35,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cf5544c..708312a 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 _0x0554=['getFaxQueues','../client','Request','GetFaxQueue','name','timeout','Agents','online','faxPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0554,0x133));var _0x4055=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x0554[_0x1ac120];return _0x19b703;};'use strict';var client=require(_0x4055('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x4055('0x1')](_0x4055('0x2'),{'options':{'raw':![],'attributes':['id',_0x4055('0x3'),_0x4055('0x4'),'strategy'],'include':[{'model':'User','as':_0x4055('0x5'),'attributes':['id','name',_0x4055('0x6'),_0x4055('0x7')]}]},'log':_0x4055('0x8')});};}; \ No newline at end of file +var _0x686a=['strategy','User','online','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x31ba1e,_0x2308df){var _0xa179ed=function(_0x297f9b){while(--_0x297f9b){_0x31ba1e['push'](_0x31ba1e['shift']());}};_0xa179ed(++_0x2308df);}(_0x686a,0xfb));var _0xa686=function(_0x65f140,_0x45cbc7){_0x65f140=_0x65f140-0x0;var _0x18fbda=_0x686a[_0x65f140];return _0x18fbda;};'use strict';var client=require('../client');exports[_0xa686('0x0')]=function(){return function(){return client[_0xa686('0x1')](_0xa686('0x2'),{'options':{'raw':![],'attributes':['id',_0xa686('0x3'),_0xa686('0x4'),_0xa686('0x5')],'include':[{'model':_0xa686('0x6'),'as':'Agents','attributes':['id',_0xa686('0x3'),_0xa686('0x7'),'faxPause']}]},'log':_0xa686('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a6197b8..9124e03 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 _0xf802=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xf802,0x1b0));var _0x2f80=function(_0x176429,_0x1e6c5a){_0x176429=_0x176429-0x0;var _0x2be140=_0xf802[_0x176429];return _0x2be140;};'use strict';var client=require(_0x2f80('0x0'));exports[_0x2f80('0x1')]=function(_0x178d29){return client['Request'](_0x2f80('0x2'),{'body':_0x178d29,'log':'CreateFaxQueueReport'});};exports[_0x2f80('0x3')]=function(_0x2528af,_0x191f0b){return client[_0x2f80('0x4')](_0x2f80('0x5'),{'body':_0x191f0b,'options':{'where':{'uniqueid':_0x2528af},'order':[['id',_0x2f80('0x6')]],'limit':0x1},'log':_0x2f80('0x5')});}; \ No newline at end of file +var _0xecc2=['CreateFaxQueueReport','UpdateFaxQueueReport','Request'];(function(_0xc94023,_0x4d1e1a){var _0xb9e145=function(_0x49c81e){while(--_0x49c81e){_0xc94023['push'](_0xc94023['shift']());}};_0xb9e145(++_0x4d1e1a);}(_0xecc2,0x119));var _0x2ecc=function(_0x54bfa9,_0x424d55){_0x54bfa9=_0x54bfa9-0x0;var _0x160e13=_0xecc2[_0x54bfa9];return _0x160e13;};'use strict';var client=require('../client');exports['create']=function(_0x5e5b0f){return client[_0x2ecc('0x0')](_0x2ecc('0x1'),{'body':_0x5e5b0f,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x1e18d0,_0x17b2a7){return client['Request']('UpdateFaxQueueReport',{'body':_0x17b2a7,'options':{'where':{'uniqueid':_0x1e18d0},'order':[['id','DESC']],'limit':0x1},'log':_0x2ecc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 718211a..c95b3a3 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 _0x8793=['interval','../client','getIntervals','name','Interval','Intervals'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x8793,0xf7));var _0x3879=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x8793[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x3879('0x0'));exports[_0x3879('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3879('0x2')],'include':[{'model':_0x3879('0x3'),'as':_0x3879('0x4'),'attributes':['id',_0x3879('0x2'),_0x3879('0x5')]}]},'log':_0x3879('0x1')});};}; \ No newline at end of file +var _0xa817=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xa817,0x186));var _0x7a81=function(_0x31b95e,_0x32fb6a){_0x31b95e=_0x31b95e-0x0;var _0x4a7145=_0xa817[_0x31b95e];return _0x4a7145;};'use strict';var client=require(_0x7a81('0x0'));exports[_0x7a81('0x1')]=function(){return function(){return client[_0x7a81('0x2')](_0x7a81('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7a81('0x4')],'include':[{'model':_0x7a81('0x5'),'as':_0x7a81('0x6'),'attributes':['id',_0x7a81('0x4'),_0x7a81('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ea8b9fb..a369d62 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 _0x0120=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0xa69dc2,_0x4394db){var _0x473981=function(_0x104a7f){while(--_0x104a7f){_0xa69dc2['push'](_0xa69dc2['shift']());}};_0x473981(++_0x4394db);}(_0x0120,0x6f));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x0012('0x0'));exports[_0x0012('0x1')]=function(_0x3d23e7,_0xb8d57c){return client[_0x0012('0x2')](_0x0012('0x3'),{'body':_0xb8d57c,'options':{'where':{'id':_0x3d23e7}},'log':_0x0012('0x4')});};exports[_0x0012('0x5')]=function(_0x357f77,_0x302029){return client[_0x0012('0x2')](_0x0012('0x6'),{'body':_0x302029,'options':{'where':{'id':_0x357f77}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x558cf5,_0x3caae2){var _0x45f531=function(_0x260d74){while(--_0x260d74){_0x558cf5['push'](_0x558cf5['shift']());}};_0x45f531(++_0x3caae2);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'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 diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ad1f2fc..a4c0e19 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 _0x6daf=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0xb0336d,_0x106a81){var _0x28e10e=function(_0x13c0a5){while(--_0x13c0a5){_0xb0336d['push'](_0xb0336d['shift']());}};_0x28e10e(++_0x106a81);}(_0x6daf,0x77));var _0xf6da=function(_0x151ffb,_0x504e4c){_0x151ffb=_0x151ffb-0x0;var _0x2f620f=_0x6daf[_0x151ffb];return _0x2f620f;};'use strict';var client=require(_0xf6da('0x0'));exports[_0xf6da('0x1')]=function(_0x5b294d){return client[_0xf6da('0x2')](_0xf6da('0x3'),{'body':_0x5b294d,'log':_0xf6da('0x4')});}; \ No newline at end of file +var _0xe001=['create','CreateMailMessage','../client'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0xe001,0x7d));var _0x1e00=function(_0x4e8119,_0xb8ad34){_0x4e8119=_0x4e8119-0x0;var _0x4e23b2=_0xe001[_0x4e8119];return _0x4e23b2;};'use strict';var client=require(_0x1e00('0x0'));exports[_0x1e00('0x1')]=function(_0x1c79bc){return client['Request'](_0x1e00('0x2'),{'body':_0x1c79bc,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e06ebc6..c86b315 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 _0x0fbe=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x3750ff,_0x3c185d){var _0x483cce=function(_0x40c8d4){while(--_0x40c8d4){_0x3750ff['push'](_0x3750ff['shift']());}};_0x483cce(++_0x3c185d);}(_0x0fbe,0x8a));var _0xe0fb=function(_0x4318fb,_0x21dde4){_0x4318fb=_0x4318fb-0x0;var _0x461161=_0x0fbe[_0x4318fb];return _0x461161;};'use strict';var client=require(_0xe0fb('0x0'));exports[_0xe0fb('0x1')]=function(){return function(){return client[_0xe0fb('0x2')](_0xe0fb('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0fb('0x4'),_0xe0fb('0x5'),_0xe0fb('0x6')],'include':[{'model':_0xe0fb('0x7'),'as':_0xe0fb('0x8'),'attributes':['id','name',_0xe0fb('0x9'),_0xe0fb('0xa')]}]},'log':_0xe0fb('0x1')});};}; \ No newline at end of file +var _0xa858=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','User','online'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xa858,0x1cc));var _0x8a85=function(_0x1f2fee,_0x3c3fca){_0x1f2fee=_0x1f2fee-0x0;var _0x19b4c0=_0xa858[_0x1f2fee];return _0x19b4c0;};'use strict';var client=require(_0x8a85('0x0'));exports[_0x8a85('0x1')]=function(){return function(){return client[_0x8a85('0x2')](_0x8a85('0x3'),{'options':{'raw':![],'attributes':['id',_0x8a85('0x4'),_0x8a85('0x5'),'strategy'],'include':[{'model':_0x8a85('0x6'),'as':'Agents','attributes':['id',_0x8a85('0x4'),_0x8a85('0x7'),_0x8a85('0x8')]}]},'log':_0x8a85('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ba2f94c..8dee8a1 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 _0x2db5=['create','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x249d7f,_0x1a8430){var _0xf7fed6=function(_0x23c18d){while(--_0x23c18d){_0x249d7f['push'](_0x249d7f['shift']());}};_0xf7fed6(++_0x1a8430);}(_0x2db5,0x168));var _0x52db=function(_0x50b651,_0x2ce0c5){_0x50b651=_0x50b651-0x0;var _0x1ec2b0=_0x2db5[_0x50b651];return _0x1ec2b0;};'use strict';var client=require('../client');exports[_0x52db('0x0')]=function(_0x479ac5){return client['Request'](_0x52db('0x1'),{'body':_0x479ac5,'log':'CreateMailQueueReport'});};exports[_0x52db('0x2')]=function(_0x522f80,_0x3db923){return client['Request'](_0x52db('0x3'),{'body':_0x3db923,'options':{'where':{'uniqueid':_0x522f80},'order':[['id','DESC']],'limit':0x1},'log':_0x52db('0x3')});}; \ No newline at end of file +var _0x4524=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4756a1,_0x3f8d1){var _0x177c4f=function(_0xddb5e2){while(--_0xddb5e2){_0x4756a1['push'](_0x4756a1['shift']());}};_0x177c4f(++_0x3f8d1);}(_0x4524,0x1cc));var _0x4452=function(_0x19c0ba,_0x7fa833){_0x19c0ba=_0x19c0ba-0x0;var _0x23b446=_0x4524[_0x19c0ba];return _0x23b446;};'use strict';var client=require(_0x4452('0x0'));exports[_0x4452('0x1')]=function(_0x3f2ac7){return client['Request'](_0x4452('0x2'),{'body':_0x3f2ac7,'log':'CreateMailQueueReport'});};exports[_0x4452('0x3')]=function(_0x583fb4,_0x531b53){return client[_0x4452('0x4')](_0x4452('0x5'),{'body':_0x531b53,'options':{'where':{'uniqueid':_0x583fb4},'order':[['id',_0x4452('0x6')]],'limit':0x1},'log':_0x4452('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d5f3eb3..774fdda 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 _0xd970=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x29a728,_0x352bf8){var _0x405405=function(_0x4555a4){while(--_0x4555a4){_0x29a728['push'](_0x29a728['shift']());}};_0x405405(++_0x352bf8);}(_0xd970,0x169));var _0x0d97=function(_0xe2c64,_0x5f28c5){_0xe2c64=_0xe2c64-0x0;var _0xccf2a4=_0xd970[_0xe2c64];return _0xccf2a4;};'use strict';var client=require(_0x0d97('0x0'));exports['update']=function(_0x2f96d0,_0x586aa3){return client[_0x0d97('0x1')](_0x0d97('0x2'),{'body':_0x586aa3,'options':{'where':{'id':_0x2f96d0}},'log':_0x0d97('0x3')});};exports[_0x0d97('0x4')]=function(_0x34ed27,_0x460378){return client[_0x0d97('0x1')](_0x0d97('0x5'),{'body':_0x460378,'options':{'where':{'id':_0x34ed27}},'log':_0x0d97('0x6')});}; \ No newline at end of file +var _0x09ca=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x5e5214,_0x51b960){var _0x5d44e5=function(_0x14b60a){while(--_0x14b60a){_0x5e5214['push'](_0x5e5214['shift']());}};_0x5d44e5(++_0x51b960);}(_0x09ca,0x154));var _0xa09c=function(_0x4174b7,_0x526c9d){_0x4174b7=_0x4174b7-0x0;var _0x3cf94=_0x09ca[_0x4174b7];return _0x3cf94;};'use strict';var client=require('../client');exports[_0xa09c('0x0')]=function(_0x567410,_0x13ca4c){return client[_0xa09c('0x1')](_0xa09c('0x2'),{'body':_0x13ca4c,'options':{'where':{'id':_0x567410}},'log':_0xa09c('0x3')});};exports[_0xa09c('0x4')]=function(_0x15daf6,_0x3b2c1a){return client[_0xa09c('0x1')](_0xa09c('0x5'),{'body':_0x3b2c1a,'options':{'where':{'id':_0x15daf6}},'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 70ef7b9..257aea8 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 _0x7ecc=['create','createOpenchannelMessage','../client'];(function(_0x53f47e,_0x16d729){var _0x240345=function(_0x4b3e9b){while(--_0x4b3e9b){_0x53f47e['push'](_0x53f47e['shift']());}};_0x240345(++_0x16d729);}(_0x7ecc,0xaa));var _0xc7ec=function(_0x284a19,_0x1b41cb){_0x284a19=_0x284a19-0x0;var _0x50f263=_0x7ecc[_0x284a19];return _0x50f263;};'use strict';var client=require(_0xc7ec('0x0'));exports[_0xc7ec('0x1')]=function(_0x3513ff){return client['Request']('CreateOpenchannelMessage',{'body':_0x3513ff,'log':_0xc7ec('0x2')});}; \ No newline at end of file +var _0x8d06=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d06,0x12b));var _0x68d0=function(_0x46741d,_0x25f854){_0x46741d=_0x46741d-0x0;var _0xbb5787=_0x8d06[_0x46741d];return _0xbb5787;};'use strict';var client=require('../client');exports['create']=function(_0xb33a4b){return client[_0x68d0('0x0')](_0x68d0('0x1'),{'body':_0xb33a4b,'log':_0x68d0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0ffe219..99462c9 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 _0x1f45=['User','Agents','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','strategy'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x1f45,0x1d4));var _0x51f4=function(_0x30bb75,_0x1b58ec){_0x30bb75=_0x30bb75-0x0;var _0x1ea59b=_0x1f45[_0x30bb75];return _0x1ea59b;};'use strict';var client=require(_0x51f4('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x51f4('0x1')](_0x51f4('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x51f4('0x3')],'include':[{'model':_0x51f4('0x4'),'as':_0x51f4('0x5'),'attributes':['id','name',_0x51f4('0x6'),'openchannelPause']}]},'log':_0x51f4('0x7')});};}; \ No newline at end of file +var _0x64ef=['Request','name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3577dd,_0x23a08c){var _0x380b24=function(_0x536260){while(--_0x536260){_0x3577dd['push'](_0x3577dd['shift']());}};_0x380b24(++_0x23a08c);}(_0x64ef,0x73));var _0xf64e=function(_0x4f1819,_0x3b8c5d){_0x4f1819=_0x4f1819-0x0;var _0x4c7b51=_0x64ef[_0x4f1819];return _0x4c7b51;};'use strict';var client=require(_0xf64e('0x0'));exports[_0xf64e('0x1')]=function(){return function(){return client[_0xf64e('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xf64e('0x3'),'timeout',_0xf64e('0x4')],'include':[{'model':_0xf64e('0x5'),'as':_0xf64e('0x6'),'attributes':['id',_0xf64e('0x3'),_0xf64e('0x7'),_0xf64e('0x8')]}]},'log':_0xf64e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a1142ee..b6b6bea 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 _0x1a56=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x1a56,0x13a));var _0x61a5=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x1a56[_0xe6e78c];return _0x2a09c8;};'use strict';var client=require(_0x61a5('0x0'));exports[_0x61a5('0x1')]=function(_0x28ff1a){return client[_0x61a5('0x2')](_0x61a5('0x3'),{'body':_0x28ff1a,'log':_0x61a5('0x3')});};exports[_0x61a5('0x4')]=function(_0x29a5c0,_0x524c8b){return client[_0x61a5('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x524c8b,'options':{'where':{'uniqueid':_0x29a5c0},'order':[['id','DESC']],'limit':0x1},'log':_0x61a5('0x5')});}; \ No newline at end of file +var _0xc8f2=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x3d0e12,_0x41e165){var _0x22da51=function(_0x274763){while(--_0x274763){_0x3d0e12['push'](_0x3d0e12['shift']());}};_0x22da51(++_0x41e165);}(_0xc8f2,0x120));var _0x2c8f=function(_0x4c69c7,_0x2f4850){_0x4c69c7=_0x4c69c7-0x0;var _0x20d218=_0xc8f2[_0x4c69c7];return _0x20d218;};'use strict';var client=require(_0x2c8f('0x0'));exports['create']=function(_0x30aee9){return client[_0x2c8f('0x1')](_0x2c8f('0x2'),{'body':_0x30aee9,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x4603ac,_0x1aad6b){return client[_0x2c8f('0x1')](_0x2c8f('0x3'),{'body':_0x1aad6b,'options':{'where':{'uniqueid':_0x4603ac},'order':[['id',_0x2c8f('0x4')]],'limit':0x1},'log':_0x2c8f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index abc2024..f4ca2cf 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 _0xc9f5=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x38c06b,_0xaa82f2){var _0x23d1a3=function(_0x3859de){while(--_0x3859de){_0x38c06b['push'](_0x38c06b['shift']());}};_0x23d1a3(++_0xaa82f2);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xc9f5[_0x2555d0];return _0x3bb486;};'use strict';var client=require('../client');exports[_0x5c9f('0x0')]=function(_0x3bae7f,_0x52597d){return client[_0x5c9f('0x1')](_0x5c9f('0x2'),{'body':_0x52597d,'options':{'where':{'id':_0x3bae7f}},'log':_0x5c9f('0x3')});};exports['addTags']=function(_0x4a046a,_0x1af905){return client['Request'](_0x5c9f('0x4'),{'body':_0x1af905,'options':{'where':{'id':_0x4a046a}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x562d=['updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction'];(function(_0x3ae304,_0x2c7de4){var _0x12b392=function(_0x4b4d1f){while(--_0x4b4d1f){_0x3ae304['push'](_0x3ae304['shift']());}};_0x12b392(++_0x2c7de4);}(_0x562d,0xe1));var _0xd562=function(_0x25f725,_0x462719){_0x25f725=_0x25f725-0x0;var _0x1d8e00=_0x562d[_0x25f725];return _0x1d8e00;};'use strict';var client=require(_0xd562('0x0'));exports[_0xd562('0x1')]=function(_0x41a5c7,_0x590061){return client['Request'](_0xd562('0x2'),{'body':_0x590061,'options':{'where':{'id':_0x41a5c7}},'log':_0xd562('0x3')});};exports[_0xd562('0x4')]=function(_0x4c6430,_0xf71ee1){return client['Request']('AddTagsToSmsInteraction',{'body':_0xf71ee1,'options':{'where':{'id':_0x4c6430}},'log':_0xd562('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8965d41..2928e3d 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 _0xcc0c=['../client','create','Request'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xcc0c,0xb7));var _0xccc0=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xcc0c[_0x100682];return _0xcb6e87;};'use strict';var client=require(_0xccc0('0x0'));exports[_0xccc0('0x1')]=function(_0x47e483){return client[_0xccc0('0x2')]('CreateSmsMessage',{'body':_0x47e483,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xbac5=['Request','createSmsMessage','../client','create'];(function(_0x5dcd43,_0x2123bd){var _0x200591=function(_0x5ce6f8){while(--_0x5ce6f8){_0x5dcd43['push'](_0x5dcd43['shift']());}};_0x200591(++_0x2123bd);}(_0xbac5,0x10a));var _0x5bac=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0xbac5[_0x34190e];return _0x41a4e6;};'use strict';var client=require(_0x5bac('0x0'));exports[_0x5bac('0x1')]=function(_0x5a4fce){return client[_0x5bac('0x2')]('CreateSmsMessage',{'body':_0x5a4fce,'log':_0x5bac('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bd2c119..8a1ec7b 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x12d013,_0x286e4c){var _0x54220c=function(_0x31d518){while(--_0x31d518){_0x12d013['push'](_0x12d013['shift']());}};_0x54220c(++_0x286e4c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x18750a,_0x2e86a8){var _0x1fb507=function(_0x5d61d2){while(--_0x5d61d2){_0x18750a['push'](_0x18750a['shift']());}};_0x1fb507(++_0x2e86a8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c85cd68..e2e0ac5 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x20270e,_0x4e03cc){var _0x515150=function(_0x361e78){while(--_0x361e78){_0x20270e['push'](_0x20270e['shift']());}};_0x515150(++_0x4e03cc);}(_0x70e0,0x17b));var _0x070e=function(_0x58b1e2,_0xd58a43){_0x58b1e2=_0x58b1e2-0x0;var _0x4dc64b=_0x70e0[_0x58b1e2];return _0x4dc64b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x2ebc89,_0x316c0c){var _0x28b25f=function(_0x2974e4){while(--_0x2974e4){_0x2ebc89['push'](_0x2ebc89['shift']());}};_0x28b25f(++_0x316c0c);}(_0x34e8,0x12c));var _0x834e=function(_0x3d5743,_0x12d482){_0x3d5743=_0x3d5743-0x0;var _0x4286fb=_0x34e8[_0x3d5743];return _0x4286fb;};'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 3f1c36a..46945e3 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(_0x1c9bb3,_0x375f48){var _0x16c1dc=function(_0xa1087b){while(--_0xa1087b){_0x1c9bb3['push'](_0x1c9bb3['shift']());}};_0x16c1dc(++_0x375f48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x299a43,_0x252347){var _0xe4e92d=function(_0x3412c8){while(--_0x3412c8){_0x299a43['push'](_0x299a43['shift']());}};_0xe4e92d(++_0x252347);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('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 ebc6f70..b30eb2c 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 _0xfb65=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0xd421a2,_0x25bb0a){var _0x3c8ccf=function(_0x253e80){while(--_0x253e80){_0xd421a2['push'](_0xd421a2['shift']());}};_0x3c8ccf(++_0x25bb0a);}(_0xfb65,0x82));var _0x5fb6=function(_0x1151fa,_0x2784a7){_0x1151fa=_0x1151fa-0x0;var _0x49da2b=_0xfb65[_0x1151fa];return _0x49da2b;};'use strict';var client=require('../client');exports[_0x5fb6('0x0')]=function(_0x50bb32,_0x5cc692){return client[_0x5fb6('0x1')]('UpdateWhatsappInteraction',{'body':_0x5cc692,'options':{'where':{'id':_0x50bb32}},'log':_0x5fb6('0x2')});};exports[_0x5fb6('0x3')]=function(_0xca6345,_0xb5f7c4){return client[_0x5fb6('0x1')](_0x5fb6('0x4'),{'body':_0xb5f7c4,'options':{'where':{'id':_0xca6345}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xd991=['AddTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0x2057ea,_0x5ef9d8){var _0x69f99a=function(_0x19e97e){while(--_0x19e97e){_0x2057ea['push'](_0x2057ea['shift']());}};_0x69f99a(++_0x5ef9d8);}(_0xd991,0x115));var _0x1d99=function(_0x2ce8d9,_0x35a9d5){_0x2ce8d9=_0x2ce8d9-0x0;var _0xa865ca=_0xd991[_0x2ce8d9];return _0xa865ca;};'use strict';var client=require(_0x1d99('0x0'));exports[_0x1d99('0x1')]=function(_0x1ef5c1,_0x2095b5){return client[_0x1d99('0x2')]('UpdateWhatsappInteraction',{'body':_0x2095b5,'options':{'where':{'id':_0x1ef5c1}},'log':_0x1d99('0x3')});};exports[_0x1d99('0x4')]=function(_0xf03459,_0x1f6da3){return client[_0x1d99('0x2')](_0x1d99('0x5'),{'body':_0x1f6da3,'options':{'where':{'id':_0xf03459}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f761ddc..3c83f50 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 _0xd892=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x25b4cc,_0x1186ff){var _0x1b1bc9=function(_0x172525){while(--_0x172525){_0x25b4cc['push'](_0x25b4cc['shift']());}};_0x1b1bc9(++_0x1186ff);}(_0xd892,0x84));var _0x2d89=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd892[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x2d89('0x0'));exports[_0x2d89('0x1')]=function(_0xfd6f51){return client[_0x2d89('0x2')](_0x2d89('0x3'),{'body':_0xfd6f51,'log':_0x2d89('0x4')});}; \ No newline at end of file +var _0xb2a8=['Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5e4ecd,_0x54f6e3){var _0x2b2c16=function(_0x4e6e92){while(--_0x4e6e92){_0x5e4ecd['push'](_0x5e4ecd['shift']());}};_0x2b2c16(++_0x54f6e3);}(_0xb2a8,0x1c2));var _0x8b2a=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xb2a8[_0x5a26f5];return _0x2e9ef7;};'use strict';var client=require('../client');exports['create']=function(_0x322e6f){return client[_0x8b2a('0x0')](_0x8b2a('0x1'),{'body':_0x322e6f,'log':_0x8b2a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bbbde14..7e6fabd 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 _0x2c4c=['GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x1005a7,_0x175ccb){var _0x1b381c=function(_0x3da76c){while(--_0x3da76c){_0x1005a7['push'](_0x1005a7['shift']());}};_0x1b381c(++_0x175ccb);}(_0x2c4c,0x10c));var _0xc2c4=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0x2c4c[_0x4f84c3];return _0x460f9f;};'use strict';var client=require('../client');exports[_0xc2c4('0x0')]=function(){return function(){return client[_0xc2c4('0x1')](_0xc2c4('0x2'),{'options':{'raw':![],'attributes':['id',_0xc2c4('0x3'),_0xc2c4('0x4'),_0xc2c4('0x5')],'include':[{'model':_0xc2c4('0x6'),'as':'Agents','attributes':['id','name',_0xc2c4('0x7'),_0xc2c4('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x92c8=['getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy','online','whatsappPause'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0x92c8,0x159));var _0x892c=function(_0x50cbf9,_0x16846a){_0x50cbf9=_0x50cbf9-0x0;var _0x2fedf2=_0x92c8[_0x50cbf9];return _0x2fedf2;};'use strict';var client=require(_0x892c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x892c('0x1'),{'options':{'raw':![],'attributes':['id',_0x892c('0x2'),_0x892c('0x3'),_0x892c('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x892c('0x2'),_0x892c('0x5'),_0x892c('0x6')]}]},'log':_0x892c('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0bec3ee..a14d336 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 _0x26a8=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x9d7f95,_0x4fa273){var _0x8f9e78=function(_0x505a93){while(--_0x505a93){_0x9d7f95['push'](_0x9d7f95['shift']());}};_0x8f9e78(++_0x4fa273);}(_0x26a8,0x13e));var _0x826a=function(_0x4a2cf3,_0x22b1f7){_0x4a2cf3=_0x4a2cf3-0x0;var _0x36746c=_0x26a8[_0x4a2cf3];return _0x36746c;};'use strict';var client=require(_0x826a('0x0'));exports[_0x826a('0x1')]=function(_0x409a72){return client[_0x826a('0x2')](_0x826a('0x3'),{'body':_0x409a72,'log':_0x826a('0x3')});};exports[_0x826a('0x4')]=function(_0x187db0,_0x2cb959){return client[_0x826a('0x2')](_0x826a('0x5'),{'body':_0x2cb959,'options':{'where':{'uniqueid':_0x187db0},'order':[['id',_0x826a('0x6')]],'limit':0x1},'log':_0x826a('0x5')});}; \ No newline at end of file +var _0x9e2b=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x3ac0fa,_0x42723c){var _0x5cd62e=function(_0x1923e2){while(--_0x1923e2){_0x3ac0fa['push'](_0x3ac0fa['shift']());}};_0x5cd62e(++_0x42723c);}(_0x9e2b,0xa1));var _0xb9e2=function(_0x52d730,_0x59128a){_0x52d730=_0x52d730-0x0;var _0x57d5a9=_0x9e2b[_0x52d730];return _0x57d5a9;};'use strict';var client=require(_0xb9e2('0x0'));exports[_0xb9e2('0x1')]=function(_0x3dba7d){return client[_0xb9e2('0x2')](_0xb9e2('0x3'),{'body':_0x3dba7d,'log':'CreateWhatsappQueueReport'});};exports[_0xb9e2('0x4')]=function(_0x2fa6a4,_0x5c38ee){return client[_0xb9e2('0x2')](_0xb9e2('0x5'),{'body':_0x5c38ee,'options':{'where':{'uniqueid':_0x2fa6a4},'order':[['id',_0xb9e2('0x6')]],'limit':0x1},'log':_0xb9e2('0x5')});}; \ 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 d7f168b..5d65e72 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 _0x4313=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x49ab20,_0xdd7290){var _0x347254=function(_0x246f6d){while(--_0x246f6d){_0x49ab20['push'](_0x49ab20['shift']());}};_0x347254(++_0xdd7290);}(_0x4313,0xe6));var _0x3431=function(_0x3895f4,_0x315ce5){_0x3895f4=_0x3895f4-0x0;var _0x1daba0=_0x4313[_0x3895f4];return _0x1daba0;};'use strict';var schema=require(_0x3431('0x0'));var _=require('lodash');var util=require(_0x3431('0x1'));var seqqueue=require(_0x3431('0x2'));var logger=require(_0x3431('0x3'))('routing');var strategy=require(_0x3431('0x4'));var queue=schema({'name':{'type':_0x3431('0x5'),'required':!![],'message':_0x3431('0x6')},'timeout':{'type':_0x3431('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x15d173,_0x38b945,_0x35e8ed){return logger['info'](util[_0x3431('0x8')](_0x3431('0x9'),_0x15d173,_0x38b945[_0x3431('0xa')],_0x35e8ed));}function handleFindAgent(_0x3b811b){return function(_0x141b72){return _0x141b72[_0x3431('0xa')]['toLowerCase']()===_0x3b811b[_0x3431('0xb')]();};}exports[_0x3431('0xc')]=function(_0xe486fe,_0x390ba8,_0x52df30,_0x101dcb){return function(_0x1601ee){try{var _0x356c69={'name':_0x390ba8[0x0],'timeout':_0x390ba8[0x1]};var _0x3f9a40=queue[_0x3431('0x0')](_0x356c69,{'typecast':!![]});if(_0x3f9a40[_0x3431('0xd')]){logger[_0x3431('0xe')]('[%s][AGENT]\x20%s',_0xe486fe,_[_0x3431('0xf')](_0x3f9a40,_0x3431('0x10'))[_0x3431('0x11')](',\x20'));_0x1601ee[_0x3431('0x12')]();}else{var _0x444f4e=_['find'](_0x52df30[_0x3431('0x13')],handleFindAgent(_0x356c69[_0x3431('0xa')]));if(_0x444f4e){var _0x56bd74=(_0x356c69[_0x3431('0x14')]||0xa)*0x3e8;var _0x4afa48,_0x5b2c17;var _0x28b087=seqqueue[_0x3431('0x15')](_0x56bd74);_0x28b087['id']=_0xe486fe;_0x28b087[_0x3431('0x16')]=_0x56bd74;_0x28b087['channel']=_0x101dcb[_0x3431('0x17')];writeLog(_0xe486fe,_0x444f4e,util[_0x3431('0x8')](_0x3431('0x18'),_0x56bd74));_0x52df30[_0x3431('0x19')][_0xe486fe]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xe486fe);clearTimeout(_0x5b2c17);_0x5b2c17=undefined;_0x28b087[_0x3431('0x1a')]();if(_0x52df30['rules'][_0xe486fe]){delete _0x52df30[_0x3431('0x19')][_0xe486fe];}_0x1601ee[_0x3431('0x12')]();});_0x52df30[_0x3431('0x19')][_0xe486fe]['on'](_0x3431('0x1b'),function(){if(_0x52df30[_0x3431('0x19')][_0xe486fe]){delete _0x52df30[_0x3431('0x19')][_0xe486fe];}});_0x5b2c17=setTimeout(function(){logger[_0x3431('0x1c')](_0x3431('0x1d'),_0xe486fe);clearTimeout(_0x5b2c17);_0x28b087[_0x3431('0x1a')]();_0x1601ee[_0x3431('0x1e')]();},_0x56bd74);strategy[_0x3431('0x1f')](_0x28b087,_0x444f4e,_0x52df30,_0x101dcb);}else{logger[_0x3431('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xe486fe,_0x356c69[_0x3431('0xa')]);_0x1601ee[_0x3431('0x12')]();}}}catch(_0x370e29){console[_0x3431('0x20')](_0x370e29);logger[_0x3431('0xe')](_0x3431('0x21'),_0xe486fe,_0x370e29['stack']);_0x1601ee[_0x3431('0x12')]();}};}; \ No newline at end of file +var _0x144f=['toLowerCase','consequence','error','map','join','stop','find','agents','timeout','createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x5aabcb,_0x219fbd){var _0x4b6e71=function(_0x1546ee){while(--_0x1546ee){_0x5aabcb['push'](_0x5aabcb['shift']());}};_0x4b6e71(++_0x219fbd);}(_0x144f,0xc0));var _0xf144=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x144f[_0x82129b];return _0x2ae5dc;};'use strict';var schema=require(_0xf144('0x0'));var _=require(_0xf144('0x1'));var util=require('util');var seqqueue=require(_0xf144('0x2'));var logger=require(_0xf144('0x3'))(_0xf144('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf144('0x5'),'required':!![],'message':_0xf144('0x6')},'timeout':{'type':_0xf144('0x7'),'message':_0xf144('0x8')}});function writeLog(_0x2ad943,_0x81462f,_0x55bf74){return logger[_0xf144('0x9')](util[_0xf144('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2ad943,_0x81462f[_0xf144('0xb')],_0x55bf74));}function handleFindAgent(_0x1684f4){return function(_0x486089){return _0x486089['name'][_0xf144('0xc')]()===_0x1684f4[_0xf144('0xc')]();};}exports[_0xf144('0xd')]=function(_0xef21ff,_0x6a9806,_0x241739,_0x55a2c6){return function(_0x3d4f72){try{var _0x52165c={'name':_0x6a9806[0x0],'timeout':_0x6a9806[0x1]};var _0x3208d5=queue[_0xf144('0x0')](_0x52165c,{'typecast':!![]});if(_0x3208d5['length']){logger[_0xf144('0xe')]('[%s][AGENT]\x20%s',_0xef21ff,_[_0xf144('0xf')](_0x3208d5,'message')[_0xf144('0x10')](',\x20'));_0x3d4f72[_0xf144('0x11')]();}else{var _0x480ae3=_[_0xf144('0x12')](_0x241739[_0xf144('0x13')],handleFindAgent(_0x52165c[_0xf144('0xb')]));if(_0x480ae3){var _0x5c3aac=(_0x52165c[_0xf144('0x14')]||0xa)*0x3e8;var _0x366566,_0x49395b;var _0xb25f1d=seqqueue[_0xf144('0x15')](_0x5c3aac);_0xb25f1d['id']=_0xef21ff;_0xb25f1d['atimeout']=_0x5c3aac;_0xb25f1d[_0xf144('0x16')]=_0x55a2c6[_0xf144('0x16')];writeLog(_0xef21ff,_0x480ae3,util['format'](_0xf144('0x17'),_0x5c3aac));_0x241739['rules'][_0xef21ff]['on'](_0xf144('0x18'),function(){logger[_0xf144('0x9')](_0xf144('0x19'),_0xef21ff);clearTimeout(_0x49395b);_0x49395b=undefined;_0xb25f1d[_0xf144('0x1a')]();if(_0x241739[_0xf144('0x1b')][_0xef21ff]){delete _0x241739[_0xf144('0x1b')][_0xef21ff];}_0x3d4f72[_0xf144('0x11')]();});_0x241739[_0xf144('0x1b')][_0xef21ff]['on'](_0xf144('0x1c'),function(){if(_0x241739[_0xf144('0x1b')][_0xef21ff]){delete _0x241739[_0xf144('0x1b')][_0xef21ff];}});_0x49395b=setTimeout(function(){logger['info'](_0xf144('0x1d'),_0xef21ff);clearTimeout(_0x49395b);_0xb25f1d[_0xf144('0x1a')]();_0x3d4f72['next']();},_0x5c3aac);strategy[_0xf144('0x1e')](_0xb25f1d,_0x480ae3,_0x241739,_0x55a2c6);}else{logger[_0xf144('0xe')](_0xf144('0x1f'),_0xef21ff,_0x52165c[_0xf144('0xb')]);_0x3d4f72['stop']();}}}catch(_0x3822e8){console[_0xf144('0x20')](_0x3822e8);logger[_0xf144('0xe')]('[%s][QUEUE]\x20%s',_0xef21ff,_0x3822e8[_0xf144('0x21')]);_0x3d4f72[_0xf144('0x11')]();}};}; \ 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 7b079d2..5cd815a 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 _0x3bf0=['../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','account','AccountId','InteractionId','created','isEmpty','body','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','create','dialogState','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x311cf6,_0x270ded){var _0x39d8a1=function(_0x356441){while(--_0x356441){_0x311cf6['push'](_0x311cf6['shift']());}};_0x39d8a1(++_0x270ded);}(_0x3bf0,0xe7));var _0x03bf=function(_0xa0a18e,_0x2e79d2){_0xa0a18e=_0xa0a18e-0x0;var _0x553022=_0x3bf0[_0xa0a18e];return _0x553022;};'use strict';var _=require(_0x03bf('0x0'));var moment=require(_0x03bf('0x1'));var AWS=require('aws-sdk');var utils=require(_0x03bf('0x2'));var logger=require('../../../../config/logger')(_0x03bf('0x3'));var rpc={'chatMessage':require(_0x03bf('0x4')),'openchannelMessage':require(_0x03bf('0x5')),'mailMessage':require(_0x03bf('0x6')),'smsMessage':require(_0x03bf('0x7')),'faxMessage':require(_0x03bf('0x8')),'whatsappMessage':require(_0x03bf('0x9'))};exports[_0x03bf('0xa')]=function(_0x3b6e4c,_0x4d1c8f){return function(_0x4d2e69){try{if(!_['isNil'](this['interaction'][_0x03bf('0xb')])){logger[_0x03bf('0xc')](_0x03bf('0xd'),_0x3b6e4c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4d2e69[_0x03bf('0xe')]();}var _0x32b9fb={'ContactId':this[_0x03bf('0xf')]['id'],'sentAt':moment()['format'](_0x03bf('0x10')),'direction':_0x03bf('0x11')};if(this[_0x03bf('0x12')]===_0x03bf('0x13')||this[_0x03bf('0x12')]===_0x03bf('0x14')){_0x32b9fb[_0x03bf('0x15')]=this[_0x03bf('0x16')][_0x03bf('0x15')];}var _0x3bc08b=this[_0x03bf('0x12')];if(_0x3bc08b===_0x03bf('0x17')){_0x32b9fb['ChatWebsiteId']=this[_0x03bf('0x18')]['id'];}else{_0x32b9fb[_['upperFirst'](_0x3bc08b)+_0x03bf('0x19')]=this['account']['id'];}_0x32b9fb[_['upperFirst'](_0x3bc08b)+_0x03bf('0x1a')]=this['interaction']['id'];if(this[_0x03bf('0x16')][_0x03bf('0x1b')]){var _0xdd4819=_0x4d1c8f[0x4];if(!_[_0x03bf('0x1c')](_0xdd4819)){_0x32b9fb[_0x03bf('0x1d')]=utils['getMustacheRender'](_0xdd4819,this);return rpc[_0x3bc08b+_0x03bf('0x1e')]['create'](_0x32b9fb)[_0x03bf('0x1f')](function(_0x462952){logger[_0x03bf('0xc')](_0x03bf('0xd'),_0x3b6e4c,_0x32b9fb[_0x03bf('0x1d')]);})[_0x03bf('0x20')](function(_0x73fe24){logger[_0x03bf('0x21')](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x73fe24));})[_0x03bf('0x23')](function(){logger[_0x03bf('0xc')](_0x03bf('0x24'),_0x3b6e4c);_0x4d2e69['stop']();});}else{logger[_0x03bf('0xc')](_0x03bf('0x25'),_0x3b6e4c);_0x4d2e69[_0x03bf('0x26')]();}}else{var _0x26ef0b=this;var _0x2dc4da=new AWS['LexRuntime']({'accessKeyId':_0x4d1c8f[0x0],'secretAccessKey':_0x4d1c8f[0x1],'region':_0x4d1c8f[0x2]});var _0xeda8dc={'botAlias':_0x03bf('0x27'),'botName':_0x4d1c8f[0x3],'inputText':this[_0x03bf('0x28')][_0x03bf('0x1d')],'userId':this[_0x03bf('0x12')]+':'+this[_0x03bf('0x16')]['id'][_0x03bf('0x29')]()};_0x2dc4da[_0x03bf('0x2a')](_0xeda8dc,function(_0x1b4077,_0xd4673d){if(_0x1b4077){logger['error'](_0x03bf('0xd'),_0x3b6e4c,_0x1b4077['message']);_0x4d2e69[_0x03bf('0xe')]();}else if(_0xd4673d&&_0xd4673d[_0x03bf('0x28')]){_0x26ef0b[_0x03bf('0x1d')]['amazonlex']=_0xd4673d;_0x32b9fb[_0x03bf('0x1d')]=_0xd4673d['message'];_0x32b9fb[_0x03bf('0x2b')]=_0x03bf('0x2c');_0x32b9fb[_0x03bf('0x2d')]=JSON[_0x03bf('0x22')](_0xd4673d);return rpc[_0x3bc08b+_0x03bf('0x1e')][_0x03bf('0x2e')](_0x32b9fb)[_0x03bf('0x1f')](function(_0x13ba3d){logger['info'](_0x03bf('0xd'),_0x3b6e4c,_0x32b9fb[_0x03bf('0x1d')]);if(_0xd4673d[_0x03bf('0x2f')]=='Failed'){_0x4d2e69[_0x03bf('0xe')]();}else{_0x4d2e69['stop']();}})['catch'](function(_0x5059e){logger[_0x03bf('0x21')](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x5059e));_0x4d2e69[_0x03bf('0xe')]();});}else{_0x4d2e69[_0x03bf('0xe')]();}});}}catch(_0x16a420){logger['error'](_0x03bf('0xd'),_0x3b6e4c,JSON[_0x03bf('0x22')](_0x16a420));_0x4d2e69['stop']();}};}; \ No newline at end of file +var _0x676b=['stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','error','[%s][AMAZONLEX]\x20%s','amazonlex','providerName','providerResponse','create','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','body','getMustacheRender','then','catch'];(function(_0x506527,_0x4af777){var _0x461b49=function(_0x5b8059){while(--_0x5b8059){_0x506527['push'](_0x506527['shift']());}};_0x461b49(++_0x4af777);}(_0x676b,0x97));var _0xb676=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x676b[_0x22b68a];return _0x1ac67a;};'use strict';var _=require('lodash');var moment=require(_0xb676('0x0'));var AWS=require('aws-sdk');var utils=require(_0xb676('0x1'));var logger=require(_0xb676('0x2'))(_0xb676('0x3'));var rpc={'chatMessage':require(_0xb676('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb676('0x5')),'smsMessage':require(_0xb676('0x6')),'faxMessage':require(_0xb676('0x7')),'whatsappMessage':require(_0xb676('0x8'))};exports[_0xb676('0x9')]=function(_0x3279ee,_0x3e57d1){return function(_0x44616e){try{if(!_[_0xb676('0xa')](this[_0xb676('0xb')][_0xb676('0xc')])){logger[_0xb676('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3279ee,_0xb676('0xe'));return _0x44616e[_0xb676('0xf')]();}var _0x1c7522={'ContactId':this[_0xb676('0x10')]['id'],'sentAt':moment()[_0xb676('0x11')](_0xb676('0x12')),'direction':_0xb676('0x13')};if(this['channel']===_0xb676('0x14')||this[_0xb676('0x15')]===_0xb676('0x16')){_0x1c7522[_0xb676('0x17')]=this['interaction'][_0xb676('0x17')];}var _0x5ed073=this[_0xb676('0x15')];if(_0x5ed073===_0xb676('0x18')){_0x1c7522['ChatWebsiteId']=this[_0xb676('0x19')]['id'];}else{_0x1c7522[_[_0xb676('0x1a')](_0x5ed073)+_0xb676('0x1b')]=this[_0xb676('0x19')]['id'];}_0x1c7522[_[_0xb676('0x1a')](_0x5ed073)+_0xb676('0x1c')]=this[_0xb676('0xb')]['id'];if(this[_0xb676('0xb')]['created']){var _0xc2b6ed=_0x3e57d1[0x4];if(!_['isEmpty'](_0xc2b6ed)){_0x1c7522[_0xb676('0x1d')]=utils[_0xb676('0x1e')](_0xc2b6ed,this);return rpc[_0x5ed073+'Message']['create'](_0x1c7522)[_0xb676('0x1f')](function(_0xf4d692){logger[_0xb676('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3279ee,_0x1c7522[_0xb676('0x1d')]);})[_0xb676('0x20')](function(_0x12b464){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3279ee,JSON[_0xb676('0x21')](_0x12b464));})['finally'](function(){logger[_0xb676('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3279ee);_0x44616e['stop']();});}else{logger['info'](_0xb676('0x22'),_0x3279ee);_0x44616e[_0xb676('0x23')]();}}else{var _0x22912e=this;var _0x46e8cb=new AWS[(_0xb676('0x24'))]({'accessKeyId':_0x3e57d1[0x0],'secretAccessKey':_0x3e57d1[0x1],'region':_0x3e57d1[0x2]});var _0x1e196c={'botAlias':'$LATEST','botName':_0x3e57d1[0x3],'inputText':this[_0xb676('0x25')]['body'],'userId':this[_0xb676('0x15')]+':'+this[_0xb676('0xb')]['id'][_0xb676('0x26')]()};_0x46e8cb[_0xb676('0x27')](_0x1e196c,function(_0x3e4271,_0x1b6de4){if(_0x3e4271){logger[_0xb676('0x28')](_0xb676('0x29'),_0x3279ee,_0x3e4271[_0xb676('0x25')]);_0x44616e[_0xb676('0xf')]();}else if(_0x1b6de4&&_0x1b6de4['message']){_0x22912e[_0xb676('0x1d')][_0xb676('0x2a')]=_0x1b6de4;_0x1c7522[_0xb676('0x1d')]=_0x1b6de4[_0xb676('0x25')];_0x1c7522[_0xb676('0x2b')]=_0xb676('0x2a');_0x1c7522[_0xb676('0x2c')]=JSON[_0xb676('0x21')](_0x1b6de4);return rpc[_0x5ed073+'Message'][_0xb676('0x2d')](_0x1c7522)['then'](function(_0x3357e3){logger['info'](_0xb676('0x29'),_0x3279ee,_0x1c7522['body']);if(_0x1b6de4['dialogState']=='Failed'){_0x44616e['next']();}else{_0x44616e['stop']();}})[_0xb676('0x20')](function(_0x506a90){logger[_0xb676('0x28')](_0xb676('0x29'),_0x3279ee,JSON['stringify'](_0x506a90));_0x44616e[_0xb676('0xf')]();});}else{_0x44616e[_0xb676('0xf')]();}});}}catch(_0x13cb63){logger['error'](_0xb676('0x29'),_0x3279ee,JSON['stringify'](_0x13cb63));_0x44616e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 76d18bc..a0886ab 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 _0x13f7=['./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','channel','getMustacheRender','message','from','phone','startsWith','subject','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','messageId','html','','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','Interaction','update','error','create','finally','stop','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13f7,0x106));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var moment=require(_0x713f('0x1'));var utils=require(_0x713f('0x2'));var logger=require('../../../../config/logger')(_0x713f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x713f('0x4')),'mailMessage':require(_0x713f('0x5')),'smsMessage':require(_0x713f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x713f('0x7')),'chatInteraction':require(_0x713f('0x8')),'openchannelInteraction':require(_0x713f('0x9')),'mailInteraction':require(_0x713f('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x713f('0xb'))};var mailRpc=require(_0x713f('0xc'));exports[_0x713f('0xd')]=function(_0x3d9939,_0x4a4581,_0x529c39,_0x5901a7){return function(_0xbec80a){try{var _0xe4dcdb=this['channel'];if(_0xe4dcdb===_0x713f('0xe')&&_0x5901a7[_0x713f('0xf')][_0x713f('0x10')]){logger[_0x713f('0x11')](_0x713f('0x12'),_0x3d9939,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xbec80a[_0x713f('0x13')]();}if(_0x4a4581[0x0]==='1'&&(_['isNil'](this[_0x713f('0x14')][_0x713f('0x15')])||!this['interaction'][_0x713f('0x15')])){logger[_0x713f('0x11')](_0x713f('0x12'),_0x3d9939,_0x713f('0x16'));return _0xbec80a[_0x713f('0x13')]();}if(_0x4a4581[0x0]==='2'&&this[_0x713f('0x14')][_0x713f('0x17')]){logger[_0x713f('0x11')](_0x713f('0x18'),_0x3d9939,_0x713f('0x19'));return _0xbec80a[_0x713f('0x13')]();}var _0x56a98f={'ContactId':this[_0x713f('0x1a')]['id'],'sentAt':moment()[_0x713f('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x713f('0x1c')};if(this[_0x713f('0x1d')]===_0x713f('0xe')){_0x56a98f['body']=utils[_0x713f('0x1e')](_0x4a4581[0x2],this);}else{_0x56a98f[_0x713f('0xf')]=utils[_0x713f('0x1e')](_0x4a4581[0x1],this);}if(this[_0x713f('0x1f')]){_0x56a98f['to']=this[_0x713f('0x1f')][_0x713f('0x20')]||'';if(this['channel']==='mail'&&_0x4a4581[0x1]==='1'){_0x56a98f['cc']=this[_0x713f('0x1f')]['cc']||'';}_0x56a98f['from']=this[_0x713f('0x1f')]['to']||'';_0x56a98f['phone']=this[_0x713f('0x1f')][_0x713f('0x21')]||'';_0x56a98f['read']=!![];if(this[_0x713f('0x1f')]['subject']){_0x56a98f['subject']='';_0x56a98f['subject']+=_[_0x713f('0x22')](this['message'][_0x713f('0x23')],'Re:')?'':'Re:\x20';_0x56a98f[_0x713f('0x23')]+=this[_0x713f('0x1f')][_0x713f('0x23')];}}if(this[_0x713f('0x1d')]===_0x713f('0x24')){_0x56a98f[_0x713f('0x25')]=this['account']['id'];}else{_0x56a98f[_[_0x713f('0x26')](this['channel'])+_0x713f('0x27')]=this[_0x713f('0x28')]['id'];}_0x56a98f[_[_0x713f('0x26')](this[_0x713f('0x1d')])+_0x713f('0x29')]=this[_0x713f('0x14')]['id'];var _0x1fdfd0=this[_0x713f('0x14')];if(rpc[this['channel']+_0x713f('0x2a')]){if(this[_0x713f('0x1d')]===_0x713f('0xe')){_0x56a98f['inReplyTo']=this[_0x713f('0x1f')][_0x713f('0x2b')];_0x56a98f[_0x713f('0x2c')]=_0x713f('0x2d')+_['replace'](_0x56a98f[_0x713f('0xf')],_0x713f('0x2e'),_0x713f('0x2f'))+_0x713f('0x30');_0x56a98f[_0x713f('0x31')]={'Auto-Submitted':_0x713f('0x32'),'X-Auto-Response-Suppress':'All','Precedence':_0x713f('0x33')};return mailRpc[_0x713f('0x34')](this['account'][_0x713f('0x35')],_0x56a98f)[_0x713f('0x36')](function(_0x58d994){logger[_0x713f('0x11')](_0x713f('0x37'),_0x3d9939);_0x56a98f[_0x713f('0x2b')]=_0x58d994['message'][_0x713f('0x2b')];return rpc[_0xe4dcdb+_0x713f('0x2a')]['create'](_0x56a98f);})['then'](function(_0x425259){logger['info'](_0x713f('0x12'),_0x3d9939,JSON['stringify'](_0x425259));})[_0x713f('0x38')](function(_0x4c5d10){logger['error'](_0x713f('0x39'),_0x3d9939,JSON[_0x713f('0x3a')](_0x4c5d10));})['finally'](function(){Promise[_0x713f('0x3b')]()[_0x713f('0x36')](function(){if(_0x4a4581[0x0]!=='2'||_0x1fdfd0[_0x713f('0x17')])return;return rpc[_0xe4dcdb+_0x713f('0x3c')][_0x713f('0x3d')](_0x1fdfd0['id'],{'autoreplyExecuted':!![]})[_0x713f('0x36')](function(_0x1980a1){logger[_0x713f('0x11')](_0x713f('0x18'),_0x3d9939,JSON['stringify'](_0x1980a1));})[_0x713f('0x38')](function(_0xc6846){logger[_0x713f('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3d9939,JSON['stringify'](_0xc6846));});})['then'](function(){_0xbec80a['next']();});});}else{return rpc[this['channel']+_0x713f('0x2a')][_0x713f('0x3f')](_0x56a98f)['then'](function(){logger[_0x713f('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3d9939,_0x56a98f['body']);})['catch'](function(_0x257303){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3d9939,JSON[_0x713f('0x3a')](_0x257303));})[_0x713f('0x40')](function(){Promise[_0x713f('0x3b')]()['then'](function(){if(_0x4a4581[0x0]!=='2'||_0x1fdfd0['autoreplyExecuted'])return;return rpc[_0xe4dcdb+_0x713f('0x3c')][_0x713f('0x3d')](_0x1fdfd0['id'],{'autoreplyExecuted':!![]})['then'](function(_0x457545){logger['info'](_0x713f('0x18'),_0x3d9939,JSON[_0x713f('0x3a')](_0x457545));})[_0x713f('0x38')](function(_0xd20b70){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3d9939,JSON[_0x713f('0x3a')](_0xd20b70));});})[_0x713f('0x36')](function(){_0xbec80a[_0x713f('0x13')]();});});}}}catch(_0x531e6e){logger[_0x713f('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x3d9939,JSON['stringify'](_0x531e6e));_0xbec80a[_0x713f('0x41')]();}};}; \ No newline at end of file +var _0x867e=['create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','channel','getMustacheRender','message','from','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x3b7006,_0x5bf704){var _0x3944a8=function(_0x4fb1b3){while(--_0x4fb1b3){_0x3b7006['push'](_0x3b7006['shift']());}};_0x3944a8(++_0x5bf704);}(_0x867e,0x95));var _0xe867=function(_0x53a08d,_0x4d8b25){_0x53a08d=_0x53a08d-0x0;var _0x2ead71=_0x867e[_0x53a08d];return _0x2ead71;};'use strict';var _=require(_0xe867('0x0'));var moment=require(_0xe867('0x1'));var utils=require('./utils');var logger=require(_0xe867('0x2'))(_0xe867('0x3'));var rpc={'chatMessage':require(_0xe867('0x4')),'openchannelMessage':require(_0xe867('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe867('0x6')),'faxMessage':require(_0xe867('0x7')),'whatsappMessage':require(_0xe867('0x8')),'chatInteraction':require(_0xe867('0x9')),'openchannelInteraction':require(_0xe867('0xa')),'mailInteraction':require(_0xe867('0xb')),'smsInteraction':require(_0xe867('0xc')),'faxInteraction':require(_0xe867('0xd')),'whatsappInteraction':require(_0xe867('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x46666b,_0x30a53a,_0x1d1c22,_0x37ece3){return function(_0x24a670){try{var _0x5320eb=this['channel'];if(_0x5320eb===_0xe867('0xf')&&_0x37ece3[_0xe867('0x10')][_0xe867('0x11')]){logger['info'](_0xe867('0x12'),_0x46666b,_0xe867('0x13'));return _0x24a670[_0xe867('0x14')]();}if(_0x30a53a[0x0]==='1'&&(_[_0xe867('0x15')](this['interaction'][_0xe867('0x16')])||!this[_0xe867('0x17')]['created'])){logger['info'](_0xe867('0x12'),_0x46666b,'Autoreply\x20already\x20sent');return _0x24a670[_0xe867('0x14')]();}if(_0x30a53a[0x0]==='2'&&this[_0xe867('0x17')]['autoreplyExecuted']){logger['info'](_0xe867('0x18'),_0x46666b,_0xe867('0x19'));return _0x24a670[_0xe867('0x14')]();}var _0x1afdd9={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe867('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe867('0x1b')};if(this[_0xe867('0x1c')]===_0xe867('0xf')){_0x1afdd9[_0xe867('0x10')]=utils[_0xe867('0x1d')](_0x30a53a[0x2],this);}else{_0x1afdd9[_0xe867('0x10')]=utils['getMustacheRender'](_0x30a53a[0x1],this);}if(this[_0xe867('0x1e')]){_0x1afdd9['to']=this[_0xe867('0x1e')][_0xe867('0x1f')]||'';if(this['channel']===_0xe867('0xf')&&_0x30a53a[0x1]==='1'){_0x1afdd9['cc']=this['message']['cc']||'';}_0x1afdd9[_0xe867('0x1f')]=this[_0xe867('0x1e')]['to']||'';_0x1afdd9['phone']=this[_0xe867('0x1e')]['phone']||'';_0x1afdd9[_0xe867('0x20')]=!![];if(this[_0xe867('0x1e')][_0xe867('0x21')]){_0x1afdd9[_0xe867('0x21')]='';_0x1afdd9[_0xe867('0x21')]+=_[_0xe867('0x22')](this[_0xe867('0x1e')][_0xe867('0x21')],_0xe867('0x23'))?'':_0xe867('0x24');_0x1afdd9[_0xe867('0x21')]+=this[_0xe867('0x1e')]['subject'];}}if(this['channel']===_0xe867('0x25')){_0x1afdd9[_0xe867('0x26')]=this[_0xe867('0x27')]['id'];}else{_0x1afdd9[_[_0xe867('0x28')](this[_0xe867('0x1c')])+_0xe867('0x29')]=this[_0xe867('0x27')]['id'];}_0x1afdd9[_[_0xe867('0x28')](this['channel'])+_0xe867('0x2a')]=this['interaction']['id'];var _0x5222a7=this['interaction'];if(rpc[this[_0xe867('0x1c')]+_0xe867('0x2b')]){if(this[_0xe867('0x1c')]===_0xe867('0xf')){_0x1afdd9[_0xe867('0x2c')]=this[_0xe867('0x1e')][_0xe867('0x2d')];_0x1afdd9[_0xe867('0x2e')]=_0xe867('0x2f')+_[_0xe867('0x30')](_0x1afdd9[_0xe867('0x10')],']+(>|$)/g,''),'priorityTrue':_0x38632f[0x1],'priorityFalse':_0x38632f[0x2]};var _0x1ac89c=gotoif['validate'](_0x5650b3,{'typecast':!![]});if(_0x1ac89c[_0x837f('0xc')]){logger[_0x837f('0xd')]('[%s][GOTOIF]\x20%s',_0x27db0f,_[_0x837f('0xe')](_0x1ac89c,_0x837f('0xf'))[_0x837f('0x10')](',\x20'));_0x46bff6[_0x837f('0x11')]();}else{try{var _0x5caa5f=eval('('+_0x5650b3[_0x837f('0x12')]+')');var _0x43cb01=_0x5caa5f?_0x5650b3[_0x837f('0x13')]:_0x5650b3['priorityFalse'];logger['info'](_0x837f('0x14'),_0x27db0f,_0x5650b3[_0x837f('0x12')],_0x5caa5f,_0x43cb01||_0x837f('0x15'));if(_0x43cb01){var _0x112506=_[_0x837f('0x16')](_0x46bff6['rules'](),{'p':_0x43cb01});if(_0x112506>=0x0){logger[_0x837f('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x27db0f,_0x43cb01||'next',_0x112506);_0x46bff6['next'](_0x112506);}else{logger['info'](_0x837f('0x18'),_0x27db0f,_0x43cb01||_0x837f('0x15'));_0x46bff6['stop']();}}else{_0x46bff6['next']();}}catch(_0x1adc29){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x27db0f,_0x1adc29[_0x837f('0xf')]);_0x46bff6[_0x837f('0x11')]();}}}catch(_0x57dfa6){logger[_0x837f('0xd')](_0x837f('0x19'),_0x27db0f,JSON[_0x837f('0x1a')](_0x57dfa6));_0x46bff6[_0x837f('0x11')]();}};}; \ No newline at end of file +var _0x4ecc=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','number','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x41598b,_0x897d53){var _0x2cb5e5=function(_0x18087f){while(--_0x18087f){_0x41598b['push'](_0x41598b['shift']());}};_0x2cb5e5(++_0x897d53);}(_0x4ecc,0x86));var _0xc4ec=function(_0x4a3f5e,_0x2ed7d7){_0x4a3f5e=_0x4a3f5e-0x0;var _0x4f448f=_0x4ecc[_0x4a3f5e];return _0x4f448f;};'use strict';var schema=require('validate');var _=require(_0xc4ec('0x0'));var htmlToText=require(_0xc4ec('0x1'));var utils=require(_0xc4ec('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xc4ec('0x3'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x509b9a,_0x40d130){return function(_0x53b11c){try{var _0x1e67b8={'condition':htmlToText[_0xc4ec('0x4')](utils[_0xc4ec('0x5')](_0x40d130[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x40d130[0x1],'priorityFalse':_0x40d130[0x2]};var _0x1a2ee0=gotoif['validate'](_0x1e67b8,{'typecast':!![]});if(_0x1a2ee0[_0xc4ec('0x6')]){logger[_0xc4ec('0x7')](_0xc4ec('0x8'),_0x509b9a,_['map'](_0x1a2ee0,_0xc4ec('0x9'))['join'](',\x20'));_0x53b11c[_0xc4ec('0xa')]();}else{try{var _0x192e31=eval('('+_0x1e67b8[_0xc4ec('0xb')]+')');var _0x45ef33=_0x192e31?_0x1e67b8[_0xc4ec('0xc')]:_0x1e67b8[_0xc4ec('0xd')];logger[_0xc4ec('0xe')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x509b9a,_0x1e67b8[_0xc4ec('0xb')],_0x192e31,_0x45ef33||_0xc4ec('0xf'));if(_0x45ef33){var _0x392fd0=_[_0xc4ec('0x10')](_0x53b11c[_0xc4ec('0x11')](),{'p':_0x45ef33});if(_0x392fd0>=0x0){logger[_0xc4ec('0xe')](_0xc4ec('0x12'),_0x509b9a,_0x45ef33||'next',_0x392fd0);_0x53b11c[_0xc4ec('0xf')](_0x392fd0);}else{logger[_0xc4ec('0xe')](_0xc4ec('0x13'),_0x509b9a,_0x45ef33||_0xc4ec('0xf'));_0x53b11c['stop']();}}else{_0x53b11c[_0xc4ec('0xf')]();}}catch(_0x20153b){logger['error'](_0xc4ec('0x14'),_0x509b9a,_0x20153b[_0xc4ec('0x9')]);_0x53b11c[_0xc4ec('0xa')]();}}}catch(_0x4c27b1){logger[_0xc4ec('0x7')]('[%s][GOTOIF]\x20%s',_0x509b9a,JSON[_0xc4ec('0x15')](_0x4c27b1));_0x53b11c[_0xc4ec('0xa')]();}};}; \ 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 4ee9278..6877df7 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 _0x03c2=['validate','length','error','message','join','stop','info','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x3ba01c,_0x29e86e){var _0x3f883d=function(_0x4a1e97){while(--_0x4a1e97){_0x3ba01c['push'](_0x3ba01c['shift']());}};_0x3f883d(++_0x29e86e);}(_0x03c2,0x150));var _0x203c=function(_0x28d8da,_0x1d1ead){_0x28d8da=_0x28d8da-0x0;var _0x3a09e8=_0x03c2[_0x28d8da];return _0x3a09e8;};'use strict';var schema=require('validate');var _=require(_0x203c('0x0'));var logger=require(_0x203c('0x1'))('routing');var gotop=schema({'priority':{'type':_0x203c('0x2'),'required':!![],'message':_0x203c('0x3')}});exports['consequence']=function(_0x294d19,_0x14a00b){return function(_0xdfbf00){try{var _0x7e7589={'priority':_0x14a00b[0x0]};var _0x43e1a1=gotop[_0x203c('0x4')](_0x7e7589,{'typecast':!![]});if(_0x43e1a1[_0x203c('0x5')]){logger[_0x203c('0x6')]('[%s][GOTOP]\x20%s',_0x294d19,_['map'](_0x43e1a1,_0x203c('0x7'))[_0x203c('0x8')](',\x20'));_0xdfbf00[_0x203c('0x9')]();}else{logger[_0x203c('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x294d19,_0x7e7589[_0x203c('0xb')]);if(_0x7e7589[_0x203c('0xb')]){var _0x274942=_[_0x203c('0xc')](_0xdfbf00[_0x203c('0xd')](),{'p':_0x7e7589[_0x203c('0xb')]});if(_0x274942>=0x0){logger[_0x203c('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x294d19,_0x7e7589['priority']||_0x203c('0xe'),_0x274942);_0xdfbf00[_0x203c('0xe')](_0x274942);}else{logger['info'](_0x203c('0xf'),_0x294d19,_0x7e7589[_0x203c('0xb')]||_0x203c('0xe'));_0xdfbf00['stop']();}}else{_0xdfbf00['next']();}}}catch(_0x38b099){logger[_0x203c('0x6')]('[%s][GOTOP]\x20%s',_0x294d19,JSON[_0x203c('0x10')](_0x38b099));_0xdfbf00[_0x203c('0x9')]();}};}; \ No newline at end of file +var _0xbdb9=['number','consequence','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','rules','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','routing'];(function(_0x4fef08,_0x4c98c7){var _0x1bde5d=function(_0x192d56){while(--_0x192d56){_0x4fef08['push'](_0x4fef08['shift']());}};_0x1bde5d(++_0x4c98c7);}(_0xbdb9,0x107));var _0x9bdb=function(_0x184f73,_0x4d0be6){_0x184f73=_0x184f73-0x0;var _0xcf2ecd=_0xbdb9[_0x184f73];return _0xcf2ecd;};'use strict';var schema=require(_0x9bdb('0x0'));var _=require(_0x9bdb('0x1'));var logger=require('../../../../config/logger')(_0x9bdb('0x2'));var gotop=schema({'priority':{'type':_0x9bdb('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x9bdb('0x4')]=function(_0x589e26,_0x335076){return function(_0x93feab){try{var _0x21f66c={'priority':_0x335076[0x0]};var _0x3cbf57=gotop[_0x9bdb('0x0')](_0x21f66c,{'typecast':!![]});if(_0x3cbf57['length']){logger['error'](_0x9bdb('0x5'),_0x589e26,_[_0x9bdb('0x6')](_0x3cbf57,_0x9bdb('0x7'))[_0x9bdb('0x8')](',\x20'));_0x93feab[_0x9bdb('0x9')]();}else{logger[_0x9bdb('0xa')](_0x9bdb('0xb'),_0x589e26,_0x21f66c['priority']);if(_0x21f66c['priority']){var _0xe459cd=_['findIndex'](_0x93feab[_0x9bdb('0xc')](),{'p':_0x21f66c[_0x9bdb('0xd')]});if(_0xe459cd>=0x0){logger[_0x9bdb('0xa')](_0x9bdb('0xe'),_0x589e26,_0x21f66c['priority']||'next',_0xe459cd);_0x93feab[_0x9bdb('0xf')](_0xe459cd);}else{logger[_0x9bdb('0xa')](_0x9bdb('0x10'),_0x589e26,_0x21f66c['priority']||_0x9bdb('0xf'));_0x93feab[_0x9bdb('0x9')]();}}else{_0x93feab[_0x9bdb('0xf')]();}}}catch(_0x3363db){logger[_0x9bdb('0x11')]('[%s][GOTOP]\x20%s',_0x589e26,JSON[_0x9bdb('0x12')](_0x3363db));_0x93feab[_0x9bdb('0x9')]();}};}; \ 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 1070579..acfea99 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 _0x6002=['Message','info','[%s][MESSAGE]\x20%s','body','error','stop','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction'];(function(_0x4bf054,_0x34a7d4){var _0x299937=function(_0x3a27a4){while(--_0x3a27a4){_0x4bf054['push'](_0x4bf054['shift']());}};_0x299937(++_0x34a7d4);}(_0x6002,0x103));var _0x2600=function(_0x1385bd,_0x1e5841){_0x1385bd=_0x1385bd-0x0;var _0x2cb8a1=_0x6002[_0x1385bd];return _0x2cb8a1;};'use strict';var _=require(_0x2600('0x0'));var utils=require(_0x2600('0x1'));var logger=require('../../../../config/logger')(_0x2600('0x2'));var rpc={'chatMessage':require(_0x2600('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2600('0x4')),'smsMessage':require(_0x2600('0x5')),'faxMessage':require(_0x2600('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x595a8d,_0x233a38){return function(_0x16fa0e){try{var _0x557d06={'body':utils['getMustacheRender'](_0x233a38[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x557d06[_0x2600('0x7')]=this[_0x2600('0x8')]['id'];}else{_0x557d06[_[_0x2600('0x9')](this[_0x2600('0xa')])+_0x2600('0xb')]=this[_0x2600('0x8')]['id'];}_0x557d06[_['upperFirst'](this[_0x2600('0xa')])+_0x2600('0xc')]=this[_0x2600('0xd')]['id'];if(rpc[this[_0x2600('0xa')]+_0x2600('0xe')]){return rpc[this['channel']+_0x2600('0xe')]['create'](_0x557d06)['then'](function(_0x1bb53c){logger[_0x2600('0xf')](_0x2600('0x10'),_0x595a8d,_0x557d06[_0x2600('0x11')]);_0x16fa0e['next']();})['catch'](function(_0x567da0){logger[_0x2600('0x12')](_0x2600('0x10'),_0x595a8d,JSON['stringify'](_0x567da0));_0x16fa0e[_0x2600('0x13')]();});}}catch(_0x2a502c){logger['error'](_0x2600('0x10'),_0x595a8d,JSON[_0x2600('0x14')](_0x2a502c));_0x16fa0e[_0x2600('0x13')]();}};}; \ No newline at end of file +var _0xebe6=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xebe6,0x13a));var _0x6ebe=function(_0x423dd4,_0x287532){_0x423dd4=_0x423dd4-0x0;var _0xb29406=_0xebe6[_0x423dd4];return _0xb29406;};'use strict';var _=require(_0x6ebe('0x0'));var utils=require(_0x6ebe('0x1'));var logger=require(_0x6ebe('0x2'))(_0x6ebe('0x3'));var rpc={'chatMessage':require(_0x6ebe('0x4')),'openchannelMessage':require(_0x6ebe('0x5')),'mailMessage':require(_0x6ebe('0x6')),'smsMessage':require(_0x6ebe('0x7')),'faxMessage':require(_0x6ebe('0x8')),'whatsappMessage':require(_0x6ebe('0x9'))};exports['consequence']=function(_0x59ebe9,_0x1c3c2c){return function(_0x2a63a5){try{var _0x1226b9={'body':utils[_0x6ebe('0xa')](_0x1c3c2c[0x0],this),'ContactId':this[_0x6ebe('0xb')]['id']};if(this['channel']===_0x6ebe('0xc')){_0x1226b9['ChatWebsiteId']=this[_0x6ebe('0xd')]['id'];}else{_0x1226b9[_[_0x6ebe('0xe')](this[_0x6ebe('0xf')])+_0x6ebe('0x10')]=this[_0x6ebe('0xd')]['id'];}_0x1226b9[_[_0x6ebe('0xe')](this['channel'])+_0x6ebe('0x11')]=this[_0x6ebe('0x12')]['id'];if(rpc[this[_0x6ebe('0xf')]+_0x6ebe('0x13')]){return rpc[this[_0x6ebe('0xf')]+_0x6ebe('0x13')][_0x6ebe('0x14')](_0x1226b9)[_0x6ebe('0x15')](function(_0x51bb4e){logger[_0x6ebe('0x16')]('[%s][MESSAGE]\x20%s',_0x59ebe9,_0x1226b9[_0x6ebe('0x17')]);_0x2a63a5[_0x6ebe('0x18')]();})['catch'](function(_0x43c552){logger[_0x6ebe('0x19')](_0x6ebe('0x1a'),_0x59ebe9,JSON[_0x6ebe('0x1b')](_0x43c552));_0x2a63a5[_0x6ebe('0x1c')]();});}}catch(_0x1a9cac){logger[_0x6ebe('0x19')](_0x6ebe('0x1a'),_0x59ebe9,JSON[_0x6ebe('0x1b')](_0x1a9cac));_0x2a63a5['stop']();}};}; \ 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 c83df90..f1f1862 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 _0x58e9=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0xafdc22,_0x3982f9){var _0x54756a=function(_0x4edc7c){while(--_0x4edc7c){_0xafdc22['push'](_0xafdc22['shift']());}};_0x54756a(++_0x3982f9);}(_0x58e9,0x1a8));var _0x958e=function(_0x5655b8,_0x52e7d6){_0x5655b8=_0x5655b8-0x0;var _0x37b4b5=_0x58e9[_0x5655b8];return _0x37b4b5;};'use strict';var utils=require(_0x958e('0x0'));var logger=require(_0x958e('0x1'))(_0x958e('0x2'));exports[_0x958e('0x3')]=function(_0x23cb1a,_0x4e1373){return function(_0x566cb0){try{logger[_0x958e('0x4')](_0x958e('0x5'),_0x23cb1a,utils[_0x958e('0x6')](_0x4e1373[0x0],this));_0x566cb0[_0x958e('0x7')]();}catch(_0x4b7596){logger['error'](_0x958e('0x5'),_0x23cb1a,JSON[_0x958e('0x8')](_0x4b7596));_0x566cb0['stop']();}};}; \ No newline at end of file +var _0x753e=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x20e8ee,_0x2ae9f2){var _0x49f800=function(_0x270926){while(--_0x270926){_0x20e8ee['push'](_0x20e8ee['shift']());}};_0x49f800(++_0x2ae9f2);}(_0x753e,0xe2));var _0xe753=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x753e[_0x465028];return _0xb783d4;};'use strict';var utils=require(_0xe753('0x0'));var logger=require(_0xe753('0x1'))(_0xe753('0x2'));exports[_0xe753('0x3')]=function(_0x15cd15,_0x459172){return function(_0x5e1250){try{logger[_0xe753('0x4')](_0xe753('0x5'),_0x15cd15,utils[_0xe753('0x6')](_0x459172[0x0],this));_0x5e1250[_0xe753('0x7')]();}catch(_0x34c2a6){logger[_0xe753('0x8')]('[%s][NOOP]\x20%s',_0x15cd15,JSON['stringify'](_0x34c2a6));_0x5e1250[_0xe753('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 1d8e845..020bf64 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 _0x7590=['interaction','message','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','accepted','info','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','clone','queue','capitalize','InteractionId','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel'];(function(_0xc12ef6,_0x3f3852){var _0x242bd0=function(_0x104908){while(--_0x104908){_0xc12ef6['push'](_0xc12ef6['shift']());}};_0x242bd0(++_0x3f3852);}(_0x7590,0x15d));var _0x0759=function(_0x105e01,_0x199717){_0x105e01=_0x105e01-0x0;var _0x421f22=_0x7590[_0x105e01];return _0x421f22;};'use strict';var schema=require('validate');var _=require(_0x0759('0x0'));var util=require(_0x0759('0x1'));var seqqueue=require(_0x0759('0x2'));var moment=require(_0x0759('0x3'));var Redis=require(_0x0759('0x4'));var config=require(_0x0759('0x5'));var logger=require(_0x0759('0x6'))(_0x0759('0x7'));var strategy=require(_0x0759('0x8'));config[_0x0759('0x9')]=_[_0x0759('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0759('0xb'))(new Redis(config[_0x0759('0x9')]));var attributes=['id',_0x0759('0xc'),_0x0759('0xd'),'queue','from','joinAt'];function emit(_0x314e0a,_0x318c18,_0x260061){io['to'](_0x314e0a)['emit'](_0x318c18,_0x260061);}function emitChannelQueueInteraction(_0x49be18,_0x1a1be6,_0x3da45a,_0x30d6ec,_0x863fc0,_0x2cf734,_0x2b399e,_0x5c2e73){var _0x254bdf=_[_0x0759('0xe')](_0x3da45a);_0x254bdf[_0x0759('0xc')]=_0x5c2e73;_0x254bdf[_0x0759('0xf')]=_0x1a1be6;_0x254bdf[_0x0759('0xd')]=_0x30d6ec;_0x254bdf['id']=_0x863fc0;if(_0x2cf734){attributes['push'](_[_0x0759('0x10')](_0x49be18)+_0x0759('0x11'));_0x2b399e[util['format']('%sQueuesWaitingInteractions',_0x49be18)][_0x863fc0]=_[_0x0759('0x12')](_0x254bdf,attributes);}else{delete _0x2b399e[util[_0x0759('0x13')]('%sQueuesWaitingInteractions',_0x49be18)][_0x863fc0];}emit(util[_0x0759('0x13')](_0x0759('0x14'),_0x49be18,_0x1a1be6),util[_0x0759('0x13')](_0x0759('0x15'),_0x49be18,_0x2cf734?_0x0759('0x16'):_0x0759('0x17')),_[_0x0759('0x12')](_0x254bdf,attributes));}var rpc={'openchannelQueueReport':require(_0x0759('0x18')),'mailQueueReport':require(_0x0759('0x19')),'chatQueueReport':require(_0x0759('0x1a')),'smsQueueReport':require(_0x0759('0x1b')),'faxQueueReport':require(_0x0759('0x1c')),'whatsappQueueReport':require(_0x0759('0x1d'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0759('0x1e')},'timeout':{'type':_0x0759('0x1f'),'message':_0x0759('0x20')}});function startRouting(_0x12d06e,_0x52c3ba,_0x5e0ff1,_0x47b638){if(_0x12d06e&&_0x52c3ba&&_0x5e0ff1){_0x52c3ba[_0x0759('0x21')]+=0x1;var _0x47e520={'uniqueid':_0x12d06e,'from':_0x5e0ff1[_0x0759('0x22')]?_0x5e0ff1['body']['from']:'','joinAt':moment()['format'](_0x0759('0x23')),'ContactId':_0x5e0ff1['contact']?_0x5e0ff1[_0x0759('0x24')]['id']:null,'ListId':_0x5e0ff1[_0x0759('0x25')]?_0x5e0ff1[_0x0759('0x25')]['id']:null};_0x47e520[_[_0x0759('0x26')](_0x5e0ff1['channel'])+_0x0759('0x27')]=_0x52c3ba['id']||null;_0x47e520[_[_0x0759('0x26')](_0x5e0ff1[_0x0759('0x28')])+'InteractionId']=_0x5e0ff1[_0x0759('0x29')]?_0x5e0ff1[_0x0759('0x29')]['id']:null;_0x47e520[_[_0x0759('0x26')](_0x5e0ff1[_0x0759('0x28')])+'MessageId']=_0x5e0ff1[_0x0759('0x2a')]?_0x5e0ff1['message']['id']:null;_0x47e520[_['upperFirst'](_0x5e0ff1[_0x0759('0x28')])+(_0x5e0ff1[_0x0759('0x28')]!=='chat'?'AccountId':_0x0759('0x2b'))]=_0x5e0ff1[_0x0759('0xd')]?_0x5e0ff1[_0x0759('0xd')]['id']:null;logger['info'](util[_0x0759('0x13')](_0x0759('0x2c'),_0x12d06e,_0x52c3ba[_0x0759('0x2d')]));emitChannelQueueInteraction(_0x5e0ff1[_0x0759('0x28')],_0x52c3ba['name'],_0x47e520,_0x5e0ff1[_0x0759('0xd')][_0x0759('0x2d')],_0x5e0ff1[_0x0759('0x2a')]['id'],!![],_0x47b638,_0x52c3ba['id']);if(rpc[_0x5e0ff1['channel']+_0x0759('0x2e')]){return rpc[_0x5e0ff1[_0x0759('0x28')]+'QueueReport']['create'](_0x47e520)['catch'](function(_0x27a6de){logger['error'](_0x0759('0x2f'));});}}}function stopRouting(_0xb943f5,_0x2d112d,_0x157a20,_0x124cd5){if(_0xb943f5&&_0x2d112d){_0x2d112d[_0x0759('0x21')]-=0x1;var _0x86d804={'leaveAt':moment()['format'](_0x0759('0x23')),'acceptAt':moment()[_0x0759('0x13')](_0x0759('0x23')),'reason':_0x0759('0x30')};logger[_0x0759('0x31')](util[_0x0759('0x13')]('[%s][STOP:QUEUE][NAME:%s]',_0xb943f5,_0x2d112d['name']));emitChannelQueueInteraction(_0x157a20[_0x0759('0x28')],_0x2d112d[_0x0759('0x2d')],_0x157a20['body'],_0x157a20[_0x0759('0xd')][_0x0759('0x2d')],_0x157a20[_0x0759('0x2a')]['id'],![],_0x124cd5,_0x2d112d['id']);if(rpc[_0x157a20[_0x0759('0x28')]+_0x0759('0x2e')]){return rpc[_0x157a20['channel']+'QueueReport'][_0x0759('0x32')](_0xb943f5,_0x86d804)[_0x0759('0x33')](function(_0x1cb535){logger[_0x0759('0x34')](_0x0759('0x35'));});}}}function endRouting(_0x36e9d0,_0x1ddd97,_0x509acd,_0x37b467){if(_0x36e9d0&&_0x1ddd97){_0x1ddd97[_0x0759('0x21')]-=0x1;var _0x525625={'leaveAt':moment()['format'](_0x0759('0x23')),'exitAt':moment()[_0x0759('0x13')](_0x0759('0x23')),'reason':_0x0759('0x36')};logger[_0x0759('0x31')](util['format'](_0x0759('0x37'),_0x36e9d0,_0x1ddd97[_0x0759('0x2d')]));emitChannelQueueInteraction(_0x509acd['channel'],_0x1ddd97[_0x0759('0x2d')],_0x509acd[_0x0759('0x22')],_0x509acd[_0x0759('0xd')]['name'],_0x509acd[_0x0759('0x2a')]['id'],![],_0x37b467);if(rpc[_0x509acd[_0x0759('0x28')]+'QueueReport']){return rpc[_0x509acd['channel']+_0x0759('0x2e')][_0x0759('0x32')](_0x36e9d0,_0x525625)[_0x0759('0x33')](function(_0x2c0cdd){logger[_0x0759('0x34')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3cf210){return function(_0x403a91){return _0x403a91[_0x0759('0x2d')]['toLowerCase']()===_0x3cf210[_0x0759('0x38')]();};}exports[_0x0759('0x39')]=function(_0x1541ba,_0x5ce311,_0x2b6a48,_0x2190d7){return function(_0x447f5c){try{var _0x226794={'name':_0x5ce311[0x0],'timeout':_0x5ce311[0x1]};var _0x356a6d=queue[_0x0759('0x3a')](_0x226794,{'typecast':!![]});if(_0x356a6d[_0x0759('0x3b')]){logger[_0x0759('0x34')](_0x0759('0x3c'),_0x1541ba,_[_0x0759('0x3d')](_0x356a6d,_0x0759('0x2a'))[_0x0759('0x3e')](',\x20'));_0x447f5c[_0x0759('0x3f')]();}else{var _0x751c9c=_[_0x0759('0x40')](_0x2b6a48[_0x2190d7['channel']+_0x0759('0x41')],handleFindQueue(_0x226794[_0x0759('0x2d')]));if(_0x751c9c){startRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);var _0x88ac80=(_0x751c9c[_0x0759('0x36')]||0xa)*0x3e8;var _0x1a946b=(_0x226794['timeout']||0x14)*0x3e8;var _0x3e1f25;if(_0x88ac80>_0x1a946b){_0x1a946b=_0x88ac80;}var _0x5b36c0=seqqueue[_0x0759('0x42')](_0x88ac80);_0x5b36c0['id']=_0x1541ba;_0x5b36c0['atimeout']=_0x88ac80;_0x5b36c0[_0x0759('0x43')]=_0x1a946b;_0x5b36c0[_0x0759('0x28')]=_0x2190d7[_0x0759('0x28')];_0x2b6a48[_0x0759('0x44')][_0x1541ba]['on']('end',function(){logger['info'](_0x0759('0x45'),_0x1541ba);stopRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);clearTimeout(_0x3e1f25);_0x3e1f25=undefined;_0x5b36c0[_0x0759('0x46')](!![]);if(_0x2b6a48['rules'][_0x1541ba]){delete _0x2b6a48[_0x0759('0x44')][_0x1541ba];}_0x447f5c['stop']();});_0x2b6a48['rules'][_0x1541ba]['on'](_0x0759('0x47'),function(){if(_0x2b6a48[_0x0759('0x44')][_0x1541ba]){delete _0x2b6a48[_0x0759('0x44')][_0x1541ba];}});_0x3e1f25=setTimeout(function(){logger[_0x0759('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x1541ba);endRouting(_0x1541ba,_0x751c9c,_0x2190d7,_0x2b6a48);clearTimeout(_0x3e1f25);_0x5b36c0['close'](!![]);_0x447f5c[_0x0759('0x48')]();},_0x1a946b);switch(_0x751c9c[_0x0759('0x49')]){case _0x0759('0x4a'):strategy[_0x0759('0x4a')](_0x5b36c0,_0x751c9c,_0x2b6a48,_0x2190d7);break;default:strategy[_0x0759('0x4b')](_0x5b36c0,_0x751c9c,_0x2b6a48,_0x2190d7);}}else{logger['error'](_0x0759('0x4c'),_0x1541ba,_0x226794[_0x0759('0x2d')]);_0x447f5c['stop']();}}}catch(_0x11fc79){console[_0x0759('0x4d')](_0x11fc79);logger[_0x0759('0x34')](_0x0759('0x3c'),_0x1541ba,_0x11fc79['stack']);_0x447f5c[_0x0759('0x3f')]();}};}; \ No newline at end of file +var _0x973c=['../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','from','emit','clone','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','accepted','update','error','[%s][END:QUEUE][NAME:%s]','catch','update\x20queue\x20report','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','stop','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','ioredis','../../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x973c,0x121));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0xc973('0x0'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xc973('0x1'));var config=require(_0xc973('0x2'));var logger=require(_0xc973('0x3'))(_0xc973('0x4'));var strategy=require(_0xc973('0x5'));config[_0xc973('0x6')]=_[_0xc973('0x7')](config[_0xc973('0x6')],{'host':_0xc973('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc973('0x6')]));var attributes=['id',_0xc973('0x9'),_0xc973('0xa'),'queue',_0xc973('0xb'),'joinAt'];function emit(_0x3d6047,_0x5b6a0d,_0x5917ed){io['to'](_0x3d6047)[_0xc973('0xc')](_0x5b6a0d,_0x5917ed);}function emitChannelQueueInteraction(_0x5686d8,_0xe260de,_0x25c765,_0x4f7cad,_0x300f52,_0x19d05c,_0x3e3c87,_0x5b05c3){var _0x2c9af3=_[_0xc973('0xd')](_0x25c765);_0x2c9af3['queue_id']=_0x5b05c3;_0x2c9af3['queue']=_0xe260de;_0x2c9af3[_0xc973('0xa')]=_0x4f7cad;_0x2c9af3['id']=_0x300f52;if(_0x19d05c){attributes['push'](_[_0xc973('0xe')](_0x5686d8)+_0xc973('0xf'));_0x3e3c87[util['format'](_0xc973('0x10'),_0x5686d8)][_0x300f52]=_[_0xc973('0x11')](_0x2c9af3,attributes);}else{delete _0x3e3c87[util[_0xc973('0x12')](_0xc973('0x10'),_0x5686d8)][_0x300f52];}emit(util[_0xc973('0x12')]('%s:queue:%s',_0x5686d8,_0xe260de),util['format'](_0xc973('0x13'),_0x5686d8,_0x19d05c?_0xc973('0x14'):_0xc973('0x15')),_['pick'](_0x2c9af3,attributes));}var rpc={'openchannelQueueReport':require(_0xc973('0x16')),'mailQueueReport':require(_0xc973('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xc973('0x18')),'faxQueueReport':require(_0xc973('0x19')),'whatsappQueueReport':require(_0xc973('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc973('0x1b'),'message':_0xc973('0x1c')}});function startRouting(_0x53eb42,_0xa5f24c,_0x1c836d,_0xb155fa){if(_0x53eb42&&_0xa5f24c&&_0x1c836d){_0xa5f24c[_0xc973('0x1d')]+=0x1;var _0x1545ff={'uniqueid':_0x53eb42,'from':_0x1c836d[_0xc973('0x1e')]?_0x1c836d[_0xc973('0x1e')][_0xc973('0xb')]:'','joinAt':moment()[_0xc973('0x12')](_0xc973('0x1f')),'ContactId':_0x1c836d[_0xc973('0x20')]?_0x1c836d[_0xc973('0x20')]['id']:null,'ListId':_0x1c836d[_0xc973('0x21')]?_0x1c836d['list']['id']:null};_0x1545ff[_[_0xc973('0x22')](_0x1c836d['channel'])+_0xc973('0x23')]=_0xa5f24c['id']||null;_0x1545ff[_[_0xc973('0x22')](_0x1c836d[_0xc973('0x24')])+'InteractionId']=_0x1c836d['interaction']?_0x1c836d[_0xc973('0x25')]['id']:null;_0x1545ff[_[_0xc973('0x22')](_0x1c836d[_0xc973('0x24')])+_0xc973('0x26')]=_0x1c836d['message']?_0x1c836d[_0xc973('0x27')]['id']:null;_0x1545ff[_['upperFirst'](_0x1c836d['channel'])+(_0x1c836d['channel']!==_0xc973('0x28')?'AccountId':_0xc973('0x29'))]=_0x1c836d['account']?_0x1c836d[_0xc973('0xa')]['id']:null;logger[_0xc973('0x2a')](util['format'](_0xc973('0x2b'),_0x53eb42,_0xa5f24c[_0xc973('0x2c')]));emitChannelQueueInteraction(_0x1c836d[_0xc973('0x24')],_0xa5f24c['name'],_0x1545ff,_0x1c836d[_0xc973('0xa')][_0xc973('0x2c')],_0x1c836d[_0xc973('0x27')]['id'],!![],_0xb155fa,_0xa5f24c['id']);if(rpc[_0x1c836d[_0xc973('0x24')]+'QueueReport']){return rpc[_0x1c836d[_0xc973('0x24')]+_0xc973('0x2d')][_0xc973('0x2e')](_0x1545ff)['catch'](function(_0xff3313){logger['error'](_0xc973('0x2f'));});}}}function stopRouting(_0x484b47,_0x6cc588,_0xcde46f,_0xe0f266){if(_0x484b47&&_0x6cc588){_0x6cc588[_0xc973('0x1d')]-=0x1;var _0x2dd4d3={'leaveAt':moment()[_0xc973('0x12')](_0xc973('0x1f')),'acceptAt':moment()[_0xc973('0x12')](_0xc973('0x1f')),'reason':_0xc973('0x30')};logger[_0xc973('0x2a')](util[_0xc973('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x484b47,_0x6cc588[_0xc973('0x2c')]));emitChannelQueueInteraction(_0xcde46f[_0xc973('0x24')],_0x6cc588[_0xc973('0x2c')],_0xcde46f[_0xc973('0x1e')],_0xcde46f[_0xc973('0xa')][_0xc973('0x2c')],_0xcde46f['message']['id'],![],_0xe0f266,_0x6cc588['id']);if(rpc[_0xcde46f[_0xc973('0x24')]+_0xc973('0x2d')]){return rpc[_0xcde46f['channel']+_0xc973('0x2d')][_0xc973('0x31')](_0x484b47,_0x2dd4d3)['catch'](function(_0x57f2f1){logger[_0xc973('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x16b00f,_0x490877,_0x2348ec,_0x5f2aa3){if(_0x16b00f&&_0x490877){_0x490877['waiting']-=0x1;var _0x5c2ffb={'leaveAt':moment()['format'](_0xc973('0x1f')),'exitAt':moment()[_0xc973('0x12')](_0xc973('0x1f')),'reason':'timeout'};logger[_0xc973('0x2a')](util[_0xc973('0x12')](_0xc973('0x33'),_0x16b00f,_0x490877[_0xc973('0x2c')]));emitChannelQueueInteraction(_0x2348ec['channel'],_0x490877[_0xc973('0x2c')],_0x2348ec[_0xc973('0x1e')],_0x2348ec[_0xc973('0xa')][_0xc973('0x2c')],_0x2348ec['message']['id'],![],_0x5f2aa3);if(rpc[_0x2348ec[_0xc973('0x24')]+_0xc973('0x2d')]){return rpc[_0x2348ec[_0xc973('0x24')]+_0xc973('0x2d')][_0xc973('0x31')](_0x16b00f,_0x5c2ffb)[_0xc973('0x34')](function(_0x13b441){logger[_0xc973('0x32')](_0xc973('0x35'));});}}}function handleFindQueue(_0x4024aa){return function(_0x4ca3e7){return _0x4ca3e7['name'][_0xc973('0x36')]()===_0x4024aa[_0xc973('0x36')]();};}exports[_0xc973('0x37')]=function(_0x18fba7,_0x1435dc,_0x3b3b48,_0x12143b){return function(_0x53deee){try{var _0x2a1681={'name':_0x1435dc[0x0],'timeout':_0x1435dc[0x1]};var _0xf04579=queue[_0xc973('0x38')](_0x2a1681,{'typecast':!![]});if(_0xf04579[_0xc973('0x39')]){logger['error'](_0xc973('0x3a'),_0x18fba7,_['map'](_0xf04579,_0xc973('0x27'))['join'](',\x20'));_0x53deee[_0xc973('0x3b')]();}else{var _0xc7c480=_['find'](_0x3b3b48[_0x12143b[_0xc973('0x24')]+'Queues'],handleFindQueue(_0x2a1681['name']));if(_0xc7c480){startRouting(_0x18fba7,_0xc7c480,_0x12143b,_0x3b3b48);var _0x75389e=(_0xc7c480[_0xc973('0x3c')]||0xa)*0x3e8;var _0x28298c=(_0x2a1681[_0xc973('0x3c')]||0x14)*0x3e8;var _0x33756f;if(_0x75389e>_0x28298c){_0x28298c=_0x75389e;}var _0x5b0a27=seqqueue[_0xc973('0x3d')](_0x75389e);_0x5b0a27['id']=_0x18fba7;_0x5b0a27[_0xc973('0x3e')]=_0x75389e;_0x5b0a27[_0xc973('0x3f')]=_0x28298c;_0x5b0a27[_0xc973('0x24')]=_0x12143b[_0xc973('0x24')];_0x3b3b48[_0xc973('0x40')][_0x18fba7]['on']('end',function(){logger['info'](_0xc973('0x41'),_0x18fba7);stopRouting(_0x18fba7,_0xc7c480,_0x12143b,_0x3b3b48);clearTimeout(_0x33756f);_0x33756f=undefined;_0x5b0a27['close'](!![]);if(_0x3b3b48[_0xc973('0x40')][_0x18fba7]){delete _0x3b3b48[_0xc973('0x40')][_0x18fba7];}_0x53deee[_0xc973('0x3b')]();});_0x3b3b48['rules'][_0x18fba7]['on']('complete',function(){if(_0x3b3b48[_0xc973('0x40')][_0x18fba7]){delete _0x3b3b48['rules'][_0x18fba7];}});_0x33756f=setTimeout(function(){logger[_0xc973('0x2a')](_0xc973('0x42'),_0x18fba7);endRouting(_0x18fba7,_0xc7c480,_0x12143b,_0x3b3b48);clearTimeout(_0x33756f);_0x5b0a27[_0xc973('0x43')](!![]);_0x53deee['next']();},_0x28298c);switch(_0xc7c480['strategy']){case _0xc973('0x44'):strategy[_0xc973('0x44')](_0x5b0a27,_0xc7c480,_0x3b3b48,_0x12143b);break;default:strategy[_0xc973('0x45')](_0x5b0a27,_0xc7c480,_0x3b3b48,_0x12143b);}}else{logger[_0xc973('0x32')](_0xc973('0x46'),_0x18fba7,_0x2a1681[_0xc973('0x2c')]);_0x53deee[_0xc973('0x3b')]();}}}catch(_0x1c73cd){console[_0xc973('0x47')](_0x1c73cd);logger['error']('[%s][QUEUE]\x20%s',_0x18fba7,_0x1c73cd[_0xc973('0x48')]);_0x53deee[_0xc973('0x3b')]();}};}; \ 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 aa31703..a3ce571 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 _0x5089=['uuid','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','timeout','squeue','drained','handleDrained','prototype','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash'];(function(_0x3a7165,_0x42ae52){var _0x59b3a7=function(_0x4b5f7a){while(--_0x4b5f7a){_0x3a7165['push'](_0x3a7165['shift']());}};_0x59b3a7(++_0x42ae52);}(_0x5089,0x1bb));var _0x9508=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x5089[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x9508('0x0'));var uuid=require(_0x9508('0x1'));var util=require('./util');var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var Agent=function(_0x7dd13d,_0x100d7e,_0x172549,_0x59d3ee){this[_0x9508('0x4')]=uuid['v4']();this['squeue']=_0x7dd13d;this[_0x9508('0x5')]=_0x100d7e;this[_0x9508('0x6')]=_0x172549;this[_0x9508('0x3')]=_0x59d3ee;this['squeue'][_0x9508('0x7')](this[_0x9508('0x8')]['bind'](this),this[_0x9508('0x9')][_0x9508('0xa')](this));this['squeue']['on'](_0x9508('0xb'),this['handleTimeout'][_0x9508('0xa')](this));this[_0x9508('0xc')]['on'](_0x9508('0xd'),this[_0x9508('0xe')][_0x9508('0xa')](this));};Agent[_0x9508('0xf')]['push']=function(){this[_0x9508('0xc')]['push'](this[_0x9508('0x8')][_0x9508('0xa')](this),this['handleTimeout'][_0x9508('0xa')](this));};Agent[_0x9508('0xf')][_0x9508('0xe')]=function(){this[_0x9508('0x9')](!![]);};Agent['prototype'][_0x9508('0x8')]=function(){logger[_0x9508('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x9508('0xc')]['id'],this['agent']['id']);if(_[_0x9508('0x11')](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){logger[_0x9508('0x10')](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this['push'][_0x9508('0xa')](this),0x3e8);}else{if(this[_0x9508('0x3')][_0x9508('0x14')]||util[_0x9508('0x15')](this[_0x9508('0xc')]['id'],this[_0x9508('0x6')]['agents'][this['agent']['id']],this[_0x9508('0xc')]['channel'],![])){this[_0x9508('0x6')]['agents'][this[_0x9508('0x5')]['id']][_0x9508('0x16')]=!![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x18')](this['realtime'],this['routing'],this[_0x9508('0x5')],this[_0x9508('0xc')][_0x9508('0x19')]);util[_0x9508('0x1a')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],_0x9508('0x1b')+(this['routing'][_0x9508('0x14')]?_0x9508('0x1c'):''));}else{logger[_0x9508('0x10')](_0x9508('0x1d'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}}};Agent[_0x9508('0xf')][_0x9508('0x9')]=function(_0x19a984){if(_['isNil'](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){return logger['debug'](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this['agent']['id']);}else{logger[_0x9508('0x10')](_0x9508('0x1e'),this['squeue']['id'],this[_0x9508('0x5')]['id']);util[_0x9508('0x1f')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this[_0x9508('0x3')]);this[_0x9508('0x6')]['agents'][this['agent']['id']][_0x9508('0x16')]=![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x20')](this[_0x9508('0x6')],this[_0x9508('0x3')],this[_0x9508('0x5')],this[_0x9508('0xc')]['channel']);util[_0x9508('0x21')](this[_0x9508('0xc')]['id'],this['realtime'][_0x9508('0x12')][this[_0x9508('0x5')]['id']],_0x19a984?_0x9508('0x22'):_0x9508('0x23'));}if(!_0x19a984){setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}};function agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75){return new Agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75);}module[_0x9508('0x24')]=agent; \ No newline at end of file +var _0x0b78=['squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','busyQueue','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','routing','notificationId'];(function(_0x2fbbbf,_0x12ea46){var _0x2a9d83=function(_0x1e2ad8){while(--_0x1e2ad8){_0x2fbbbf['push'](_0x2fbbbf['shift']());}};_0x2a9d83(++_0x12ea46);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x80b7('0x0'));var uuid=require(_0x80b7('0x1'));var util=require('./util');var logger=require(_0x80b7('0x2'))(_0x80b7('0x3'));var Agent=function(_0x4bffac,_0x261012,_0x4ee9b4,_0x6a187e){this[_0x80b7('0x4')]=uuid['v4']();this[_0x80b7('0x5')]=_0x4bffac;this['agent']=_0x261012;this['realtime']=_0x4ee9b4;this[_0x80b7('0x3')]=_0x6a187e;this['squeue'][_0x80b7('0x6')](this[_0x80b7('0x7')][_0x80b7('0x8')](this),this[_0x80b7('0x9')]['bind'](this));this[_0x80b7('0x5')]['on'](_0x80b7('0xa'),this[_0x80b7('0x9')]['bind'](this));this[_0x80b7('0x5')]['on']('drained',this[_0x80b7('0xb')][_0x80b7('0x8')](this));};Agent[_0x80b7('0xc')][_0x80b7('0x6')]=function(){this[_0x80b7('0x5')][_0x80b7('0x6')](this[_0x80b7('0x7')][_0x80b7('0x8')](this),this[_0x80b7('0x9')][_0x80b7('0x8')](this));};Agent[_0x80b7('0xc')]['handleDrained']=function(){this[_0x80b7('0x9')](!![]);};Agent[_0x80b7('0xc')]['handleRun']=function(){logger[_0x80b7('0xd')](_0x80b7('0xe'),this['squeue']['id'],this[_0x80b7('0xf')]['id']);if(_[_0x80b7('0x10')](this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']])){logger[_0x80b7('0xd')](_0x80b7('0x13'),this[_0x80b7('0x5')]['id'],this[_0x80b7('0xf')]['id']);setTimeout(this[_0x80b7('0x6')]['bind'](this),0x3e8);}else{if(this[_0x80b7('0x3')][_0x80b7('0x14')]||util[_0x80b7('0x15')](this[_0x80b7('0x5')]['id'],this['realtime']['agents'][this[_0x80b7('0xf')]['id']],this[_0x80b7('0x5')][_0x80b7('0x16')],![])){this[_0x80b7('0x11')]['agents'][this['agent']['id']][_0x80b7('0x17')]=!![];this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']]['busyQueue']=undefined;util[_0x80b7('0x18')](this['realtime'],this['routing'],this[_0x80b7('0xf')],this[_0x80b7('0x5')][_0x80b7('0x16')]);util[_0x80b7('0x19')](this[_0x80b7('0x4')],this[_0x80b7('0x5')]['id'],this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']],null,this[_0x80b7('0x3')]);util[_0x80b7('0x1a')](this[_0x80b7('0x5')]['id'],this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']],'RINGING'+(this[_0x80b7('0x3')][_0x80b7('0x14')]?':FORCED':''));}else{logger[_0x80b7('0xd')](_0x80b7('0x1b'),this[_0x80b7('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x80b7('0x6')][_0x80b7('0x8')](this),0x3e8);}}};Agent[_0x80b7('0xc')][_0x80b7('0x9')]=function(_0x1c4607){if(_[_0x80b7('0x10')](this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']])){return logger[_0x80b7('0xd')](_0x80b7('0x13'),this[_0x80b7('0x5')]['id'],this[_0x80b7('0xf')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x80b7('0x5')]['id'],this[_0x80b7('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0x80b7('0x5')]['id'],this[_0x80b7('0x11')][_0x80b7('0x12')][this[_0x80b7('0xf')]['id']],null,this[_0x80b7('0x3')]);this[_0x80b7('0x11')]['agents'][this[_0x80b7('0xf')]['id']][_0x80b7('0x17')]=![];this[_0x80b7('0x11')][_0x80b7('0x12')][this['agent']['id']][_0x80b7('0x1c')]=undefined;util[_0x80b7('0x1d')](this['realtime'],this[_0x80b7('0x3')],this[_0x80b7('0xf')],this[_0x80b7('0x5')][_0x80b7('0x16')]);util[_0x80b7('0x1a')](this[_0x80b7('0x5')]['id'],this[_0x80b7('0x11')][_0x80b7('0x12')][this['agent']['id']],_0x1c4607?'STOP':'TIMEOUT');}if(!_0x1c4607){setTimeout(this[_0x80b7('0x6')][_0x80b7('0x8')](this),0x3e8);}};function agent(_0x6f55,_0x28cc08,_0x462eb0,_0x2e0136){return new Agent(_0x6f55,_0x28cc08,_0x462eb0,_0x2e0136);}module[_0x80b7('0x1e')]=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 333f551..ab5b07e 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 _0xf6ef=['lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','timeout','handleTimeout','push','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','exports'];(function(_0x7dfec7,_0x209c8b){var _0x110845=function(_0x447a06){while(--_0x447a06){_0x7dfec7['push'](_0x7dfec7['shift']());}};_0x110845(++_0x209c8b);}(_0xf6ef,0x18c));var _0xff6e=function(_0x3d3ddd,_0x59b504){_0x3d3ddd=_0x3d3ddd-0x0;var _0x52a4f9=_0xf6ef[_0x3d3ddd];return _0x52a4f9;};'use strict';var _=require(_0xff6e('0x0'));var uuid=require(_0xff6e('0x1'));var util=require(_0xff6e('0x2'));var logger=require(_0xff6e('0x3'))(_0xff6e('0x4'));var Beepall=function(_0x2de5d3,_0xa5f30c,_0x2ea5c7,_0x4bea2d){this[_0xff6e('0x5')]=uuid['v4']();this[_0xff6e('0x6')]=_0x2de5d3;this[_0xff6e('0x7')]=_0xa5f30c;this[_0xff6e('0x8')]=_0x2ea5c7;this[_0xff6e('0x4')]=_0x4bea2d;this[_0xff6e('0x6')]['push'](this[_0xff6e('0x9')][_0xff6e('0xa')](this),this['handleTimeout'][_0xff6e('0xa')](this));this['squeue']['on'](_0xff6e('0xb'),this[_0xff6e('0xc')][_0xff6e('0xa')](this));this[_0xff6e('0x6')]['on']('drained',this['handleDrained']['bind'](this));};Beepall['prototype'][_0xff6e('0xd')]=function(){this[_0xff6e('0x6')][_0xff6e('0xd')](this[_0xff6e('0x9')][_0xff6e('0xa')](this),this['handleTimeout'][_0xff6e('0xa')](this));};Beepall[_0xff6e('0xe')]['handleDrained']=function(){this[_0xff6e('0xc')](!![]);};Beepall['prototype'][_0xff6e('0x9')]=function(){var _0x5904f8=!![];if(!_[_0xff6e('0xf')](this[_0xff6e('0x7')])&&!_[_0xff6e('0xf')](this[_0xff6e('0x7')]['Agents'])&&this[_0xff6e('0x7')][_0xff6e('0x10')][_0xff6e('0x11')]>0x0){for(var _0x57329b=0x0,_0x2438c6;_0x57329b0x0){for(var _0x4bde00=0x0,_0x1b148a;_0x4bde000x0&&_0x211e21[_0x53a953+_0xbceb('0x23')]>=_0x211e21[_0x53a953+'Capacity']){writeLog(_0x18d8e6,_0x211e21,_0x53a953[_0xbceb('0x24')]()+_0xbceb('0x25'));return![];}}return!![];};exports[_0xbceb('0x26')]=function(_0x5dfb1c,_0x20174c,_0x53fa24,_0x4daf70,_0xb41de2){return sendNotification(!![],_0x5dfb1c,_0x20174c,_0x53fa24,_0x4daf70,_0xb41de2);};exports['hideNotification']=function(_0xb754aa,_0x33bf2e,_0x19abed,_0x3475ab,_0x42bcdd){return sendNotification(![],_0xb754aa,_0x33bf2e,_0x19abed,_0x3475ab,_0x42bcdd);};exports['checkWaitingNotifications']=function(_0x5b2569,_0x4173a3,_0x1e1073){var _0x269575=_0x4173a3[_0xbceb('0x27')]['UserId'];if(!_0x269575&&_0x1e1073){_0x269575=_0x1e1073['id'];}var _0x3771df=_[_0xbceb('0x28')](_0x5b2569[_0x4173a3[_0xbceb('0x29')]+_0xbceb('0x2a')],function(_0xc4130d){var _0x41dc8b=_[_0xbceb('0x2b')](_0x4173a3[_0xbceb('0x29')])+_0xbceb('0x2c');return _0xc4130d[_0x41dc8b]===_0x4173a3['interaction']['id'];});if(!_0x3771df&&_0x269575){_0x3771df=_[_0xbceb('0x28')](_0x5b2569['agents'][_0x269575][_0x4173a3[_0xbceb('0x29')]+_0xbceb('0x2d')],function(_0x26b532){return _0x26b532['id']===_0x4173a3['interaction']['id'];});}return _0x3771df;};exports[_0xbceb('0x2e')]=function(_0x49ddbf,_0x2b35e6,_0x39080e,_0x4c65e2){_0x49ddbf[_0xbceb('0x2f')][_0x39080e['id']][_0x4c65e2+_0xbceb('0x2d')][_0x2b35e6[_0xbceb('0x19')]['id']]={'id':_0x2b35e6[_0xbceb('0x27')]['id']};};exports[_0xbceb('0x30')]=function(_0x28f3b1,_0x4f458e,_0x13ec17,_0x5f08c9){delete _0x28f3b1['agents'][_0x13ec17['id']][_0x5f08c9+'WaitingInteractions'][_0x4f458e['message']['id']];};exports[_0xbceb('0x31')]=writeLog; \ No newline at end of file +var _0xb4be=['body','queue','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','emit','user:save','\x20interaction','name','account','notificationSound'];(function(_0x54a24b,_0x423b2b){var _0x3c8bec=function(_0xfc3221){while(--_0xfc3221){_0x54a24b['push'](_0x54a24b['shift']());}};_0x3c8bec(++_0x423b2b);}(_0xb4be,0x84));var _0xeb4b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb4be[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xeb4b('0x0'));var util=require(_0xeb4b('0x1'));var utils=require(_0xeb4b('0x2'));var Redis=require(_0xeb4b('0x3'));var config=require('../../../../../config/environment');var logger=require(_0xeb4b('0x4'))(_0xeb4b('0x5'));config[_0xeb4b('0x6')]=_[_0xeb4b('0x7')](config['redis'],{'host':_0xeb4b('0x8'),'port':0x18eb});var io=require(_0xeb4b('0x9'))(new Redis(config[_0xeb4b('0x6')]));function sendNotification(_0x589376,_0x258dcc,_0x1dd274,_0x5c0928,_0x505282,_0x4392c7){io['to'](util[_0xeb4b('0xa')](_0xeb4b('0xb'),_0x5c0928['name']))[_0xeb4b('0xc')](_0xeb4b('0xd'),_0x5c0928);var _0x919e1a=_0x4392c7||{};var _0x27e1bd=_0x1dd274['split']('.');var _0x83f21d={'uniqueid':_0x258dcc,'channel':_0x27e1bd[0x0],'id':_0x27e1bd[0x1],'title':_0x27e1bd[0x0]+_0xeb4b('0xe'),'interactionId':_0x27e1bd[0x2],'queue':_0x505282?_0x505282[_0xeb4b('0xf')]:null,'sound':_0x919e1a[_0xeb4b('0x10')][_0xeb4b('0x11')],'shake':_0x919e1a['account']['notificationShake']};try{if(!_0x919e1a[_0xeb4b('0x12')]){_0x919e1a[_0xeb4b('0x12')]={};}if(_0x505282){_0x919e1a['body'][_0xeb4b('0x13')]=_0x505282;}else if(_0x919e1a['body']['queue']){delete _0x919e1a[_0xeb4b('0x12')][_0xeb4b('0x13')];}_0x83f21d['msg']=utils['getMustacheRender'](_0x919e1a[_0xeb4b('0x10')][_0xeb4b('0x14')],_0x919e1a);}catch(_0x3d475b){_0x83f21d[_0xeb4b('0x15')]=_0xeb4b('0x16');logger[_0xeb4b('0x17')](util['format'](_0xeb4b('0x18'),_0x258dcc,_0x3d475b[_0xeb4b('0x19')]));}io['to'](util[_0xeb4b('0xa')](_0xeb4b('0xb'),_0x5c0928[_0xeb4b('0xf')]))[_0xeb4b('0xc')](util['format'](_0xeb4b('0x1a'),_0x589376?_0xeb4b('0x1b'):_0xeb4b('0x1c')),_0x83f21d);}function writeLog(_0x293b12,_0x16043f,_0x8e90c5){return logger[_0xeb4b('0x1d')](util['format'](_0xeb4b('0x1e'),_0x293b12,_0x16043f[_0xeb4b('0xf')],_0x8e90c5));}exports[_0xeb4b('0x1f')]=function(_0x82e93b,_0x23a6e5,_0x218875,_0x21a44a){if(_0x23a6e5[_0xeb4b('0x20')]){writeLog(_0x82e93b,_0x23a6e5,_0xeb4b('0x21'));return![];}if(!_0x23a6e5[_0xeb4b('0x22')]){writeLog(_0x82e93b,_0x23a6e5,'OFFLINE');return![];}if(_0x23a6e5[_0x218875+_0xeb4b('0x23')]){writeLog(_0x82e93b,_0x23a6e5,'PAUSE');return![];}if(_0x21a44a&&_0x23a6e5[_0xeb4b('0x24')](_0x218875+_0xeb4b('0x25'))&&_0x23a6e5[_0xeb4b('0x24')](_0x218875+_0xeb4b('0x26'))){if(_0x23a6e5[_0x218875+'Capacity']>0x0&&_0x23a6e5[_0x218875+'CurrentCapacity']>=_0x23a6e5[_0x218875+_0xeb4b('0x25')]){writeLog(_0x82e93b,_0x23a6e5,_0x218875['toUpperCase']()+_0xeb4b('0x27'));return![];}}return!![];};exports[_0xeb4b('0x28')]=function(_0x346ea6,_0x2ebfc9,_0x231490,_0x2f9819,_0x36ceeb){return sendNotification(!![],_0x346ea6,_0x2ebfc9,_0x231490,_0x2f9819,_0x36ceeb);};exports[_0xeb4b('0x29')]=function(_0x48e204,_0x523fe5,_0x48fade,_0x16f5c8,_0x2a6360){return sendNotification(![],_0x48e204,_0x523fe5,_0x48fade,_0x16f5c8,_0x2a6360);};exports[_0xeb4b('0x2a')]=function(_0x5ad8c3,_0x535cff,_0x1b9337){var _0x3b7c9b=_0x535cff[_0xeb4b('0x2b')]['UserId'];if(!_0x3b7c9b&&_0x1b9337){_0x3b7c9b=_0x1b9337['id'];}var _0xfecbb0=_[_0xeb4b('0x2c')](_0x5ad8c3[_0x535cff[_0xeb4b('0x2d')]+'QueuesWaitingInteractions'],function(_0x3e0d94){var _0x217b91=_['capitalize'](_0x535cff['channel'])+'InteractionId';return _0x3e0d94[_0x217b91]===_0x535cff['interaction']['id'];});if(!_0xfecbb0&&_0x3b7c9b){_0xfecbb0=_[_0xeb4b('0x2c')](_0x5ad8c3[_0xeb4b('0x2e')][_0x3b7c9b][_0x535cff[_0xeb4b('0x2d')]+_0xeb4b('0x2f')],function(_0x12ebee){return _0x12ebee['id']===_0x535cff[_0xeb4b('0x2b')]['id'];});}return _0xfecbb0;};exports[_0xeb4b('0x30')]=function(_0xce7f77,_0x5e3ba8,_0x9ca4fc,_0xf8ef71){_0xce7f77['agents'][_0x9ca4fc['id']][_0xf8ef71+_0xeb4b('0x2f')][_0x5e3ba8[_0xeb4b('0x19')]['id']]={'id':_0x5e3ba8['interaction']['id']};};exports[_0xeb4b('0x31')]=function(_0x8727d5,_0x1a4539,_0x5893cc,_0x37d6ec){delete _0x8727d5['agents'][_0x5893cc['id']][_0x37d6ec+_0xeb4b('0x2f')][_0x1a4539['message']['id']];};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3fd9c19..469437e 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 _0xb011=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','next','error','[%s][SYSTEM]\x20%s','isObject','validate','./utils'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb011,0x19c));var _0x1b01=function(_0x2bc16e,_0x4f757e){_0x2bc16e=_0x2bc16e-0x0;var _0x3f3a65=_0xb011[_0x2bc16e];return _0x3f3a65;};'use strict';var schema=require(_0x1b01('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x1b01('0x1'));var logger=require(_0x1b01('0x2'))(_0x1b01('0x3'));var system=schema({'command':{'type':_0x1b01('0x4'),'required':!![],'message':_0x1b01('0x5')}});exports['consequence']=function(_0x3a90cb,_0x1fa5fb){return function(_0xda7090){try{var _0x54b415={'command':_0x1fa5fb[0x0]};var _0x521a1b=system[_0x1b01('0x0')](_0x54b415,{'typecast':!![]});if(_0x521a1b['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x3a90cb,_[_0x1b01('0x6')](_0x521a1b,'message')[_0x1b01('0x7')](',\x20'));logger['info'](_0x1b01('0x8'),_0x3a90cb);_0xda7090['next']();}else{var _0x3da94d=this;var _0x4ee98a=utils[_0x1b01('0x9')](_0x1fa5fb[0x0],this);logger[_0x1b01('0xa')](_0x1b01('0xb'),_0x3a90cb,_0x4ee98a);sh[_0x1b01('0xc')](_[_0x1b01('0xd')](_0x4ee98a),function(_0x111260,_0x46a182){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3a90cb,_0x111260);if(_0x111260==0x0){var _0x5e9ac0=_0x46a182[_0x1b01('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x1b01('0xf')](_0x1fa5fb[0x1])||_[_0x1b01('0x10')](_0x1fa5fb[0x1])){logger[_0x1b01('0xa')](_0x1b01('0x11'),_0x3a90cb);_0x3da94d[_0x1b01('0x12')][_0x1fa5fb[0x1]]=_0x5e9ac0;}else{logger[_0x1b01('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3a90cb,_0x1fa5fb[0x1],_0x5e9ac0);_0x3da94d[_0x1b01('0x12')][_0x1fa5fb[0x1]]=_0x5e9ac0;}}_0xda7090[_0x1b01('0x13')]();});}}catch(_0x52b9e3){logger[_0x1b01('0x14')](_0x1b01('0x15'),_0x3a90cb,_[_0x1b01('0x16')](_0x52b9e3)?JSON['stringify'](_0x52b9e3):_0x52b9e3);logger[_0x1b01('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3a90cb);_0xda7090[_0x1b01('0x13')]();}};}; \ No newline at end of file +var _0x370d=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec'];(function(_0x391ad3,_0x4502d4){var _0x687ef=function(_0x5a7754){while(--_0x5a7754){_0x391ad3['push'](_0x391ad3['shift']());}};_0x687ef(++_0x4502d4);}(_0x370d,0xc6));var _0xd370=function(_0x343edc,_0x46133a){_0x343edc=_0x343edc-0x0;var _0x5a0882=_0x370d[_0x343edc];return _0x5a0882;};'use strict';var schema=require(_0xd370('0x0'));var sh=require(_0xd370('0x1'));var _=require('lodash');var utils=require(_0xd370('0x2'));var logger=require(_0xd370('0x3'))(_0xd370('0x4'));var system=schema({'command':{'type':_0xd370('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd370('0x6')]=function(_0x4e565a,_0x5205d3){return function(_0x4e3c50){try{var _0x49bc6d={'command':_0x5205d3[0x0]};var _0x419445=system[_0xd370('0x0')](_0x49bc6d,{'typecast':!![]});if(_0x419445[_0xd370('0x7')]){logger[_0xd370('0x8')](_0xd370('0x9'),_0x4e565a,_[_0xd370('0xa')](_0x419445,_0xd370('0xb'))[_0xd370('0xc')](',\x20'));logger['info'](_0xd370('0xd'),_0x4e565a);_0x4e3c50[_0xd370('0xe')]();}else{var _0x2f2181=this;var _0x494667=utils[_0xd370('0xf')](_0x5205d3[0x0],this);logger[_0xd370('0x10')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4e565a,_0x494667);sh[_0xd370('0x11')](_[_0xd370('0x12')](_0x494667),function(_0x49cf8b,_0x278ba2){logger['info'](_0xd370('0x13'),_0x4e565a,_0x49cf8b);if(_0x49cf8b==0x0){var _0x28b570=_0x278ba2[_0xd370('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xd370('0x15')](_0x5205d3[0x1])||_[_0xd370('0x16')](_0x5205d3[0x1])){logger[_0xd370('0x10')]('[%s][SYSTEM]\x20no\x20variable',_0x4e565a);_0x2f2181['body'][_0x5205d3[0x1]]=_0x28b570;}else{logger[_0xd370('0x10')](_0xd370('0x17'),_0x4e565a,_0x5205d3[0x1],_0x28b570);_0x2f2181[_0xd370('0x18')][_0x5205d3[0x1]]=_0x28b570;}}_0x4e3c50['next']();});}}catch(_0x5f5298){logger[_0xd370('0x8')](_0xd370('0x9'),_0x4e565a,_[_0xd370('0x19')](_0x5f5298)?JSON[_0xd370('0x1a')](_0x5f5298):_0x5f5298);logger[_0xd370('0x10')](_0xd370('0xd'),_0x4e565a);_0x4e3c50['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 da10d2e..063d1a5 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 _0x3c0e=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','error','[%s][TAG]\x20%s','stringify','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x1a561c,_0x156a13){var _0x5541ae=function(_0x25c97d){while(--_0x25c97d){_0x1a561c['push'](_0x1a561c['shift']());}};_0x5541ae(++_0x156a13);}(_0x3c0e,0xb8));var _0xe3c0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3c0e[_0x59ee6f];return _0x4c0979;};'use strict';var schema=require(_0xe3c0('0x0'));var _=require(_0xe3c0('0x1'));var rpc={'chatInteraction':require(_0xe3c0('0x2')),'openchannelInteraction':require(_0xe3c0('0x3')),'smsInteraction':require(_0xe3c0('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe3c0('0x5')),'whatsappInteraction':require(_0xe3c0('0x6'))};var logger=require(_0xe3c0('0x7'))('routing');var tag=schema({'tag':{'type':_0xe3c0('0x8'),'required':!![],'message':_0xe3c0('0x9')}});exports[_0xe3c0('0xa')]=function(_0x19f078,_0x2edb3f,_0x15e910,_0x524838){return function(_0x414835){try{var _0x45f95d={'tag':_0x2edb3f[0x0]};var _0x422b3a=tag[_0xe3c0('0x0')](_0x45f95d,{'typecast':!![]});if(_0x422b3a['length']){logger['error']('[%s][TAG]\x20%s',_0x19f078,_[_0xe3c0('0xb')](_0x422b3a,_0xe3c0('0xc'))[_0xe3c0('0xd')](',\x20'));logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);_0x414835['next']();}else{var _0x26438a={'ids':[_0x2edb3f[0x0]]};if(rpc[_0x524838[_0xe3c0('0x10')]+'Interaction']){rpc[_0x524838['channel']+_0xe3c0('0x11')][_0xe3c0('0x12')](_0x524838[_0xe3c0('0x13')]['id'],_0x26438a)['then'](function(_0x1d9165){logger[_0xe3c0('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x19f078,_0x2edb3f[0x1],_0x524838[_0xe3c0('0x10')],_0x524838['interaction']['id']);})['catch'](function(_0x5612f3){logger[_0xe3c0('0x14')](_0xe3c0('0x15'),_0x19f078,JSON[_0xe3c0('0x16')](_0x5612f3));logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);})['finally'](function(){_0x414835[_0xe3c0('0x17')]();});}}}catch(_0x530e01){logger[_0xe3c0('0x14')]('[%s][TAG]\x20%s',_0x19f078,_['isObject'](_0x530e01)?JSON[_0xe3c0('0x16')](_0x530e01):_0x530e01);logger[_0xe3c0('0xe')](_0xe3c0('0xf'),_0x19f078);_0x414835['next']();}};}; \ No newline at end of file +var _0x2a63=['catch','error','[%s][TAG]\x20%s','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0x5cf3f1,_0x216254){var _0x1d6dbf=function(_0xf29b14){while(--_0xf29b14){_0x5cf3f1['push'](_0x5cf3f1['shift']());}};_0x1d6dbf(++_0x216254);}(_0x2a63,0x6d));var _0x32a6=function(_0x5c7939,_0x22f61e){_0x5c7939=_0x5c7939-0x0;var _0x5bcfbc=_0x2a63[_0x5c7939];return _0x5bcfbc;};'use strict';var schema=require('validate');var _=require(_0x32a6('0x0'));var rpc={'chatInteraction':require(_0x32a6('0x1')),'openchannelInteraction':require(_0x32a6('0x2')),'smsInteraction':require(_0x32a6('0x3')),'mailInteraction':require(_0x32a6('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x32a6('0x5'))(_0x32a6('0x6'));var tag=schema({'tag':{'type':_0x32a6('0x7'),'required':!![],'message':_0x32a6('0x8')}});exports[_0x32a6('0x9')]=function(_0x193588,_0x20d61b,_0x423861,_0x4bd0ff){return function(_0x5cb99c){try{var _0x60ce65={'tag':_0x20d61b[0x0]};var _0x2f0713=tag[_0x32a6('0xa')](_0x60ce65,{'typecast':!![]});if(_0x2f0713[_0x32a6('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x193588,_[_0x32a6('0xc')](_0x2f0713,_0x32a6('0xd'))['join'](',\x20'));logger[_0x32a6('0xe')](_0x32a6('0xf'),_0x193588);_0x5cb99c[_0x32a6('0x10')]();}else{var _0x248b5f={'ids':[_0x20d61b[0x0]]};if(rpc[_0x4bd0ff[_0x32a6('0x11')]+_0x32a6('0x12')]){rpc[_0x4bd0ff[_0x32a6('0x11')]+_0x32a6('0x12')][_0x32a6('0x13')](_0x4bd0ff[_0x32a6('0x14')]['id'],_0x248b5f)['then'](function(_0x5402b3){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x193588,_0x20d61b[0x1],_0x4bd0ff[_0x32a6('0x11')],_0x4bd0ff[_0x32a6('0x14')]['id']);})[_0x32a6('0x15')](function(_0x4a463b){logger[_0x32a6('0x16')](_0x32a6('0x17'),_0x193588,JSON[_0x32a6('0x18')](_0x4a463b));logger[_0x32a6('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x193588);})[_0x32a6('0x19')](function(){_0x5cb99c[_0x32a6('0x10')]();});}}}catch(_0x54d4b9){logger[_0x32a6('0x16')]('[%s][TAG]\x20%s',_0x193588,_['isObject'](_0x54d4b9)?JSON[_0x32a6('0x18')](_0x54d4b9):_0x54d4b9);logger[_0x32a6('0xe')](_0x32a6('0xf'),_0x193588);_0x5cb99c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1bb111d..0c9b9f2 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 _0xa0e1=['includes','push','urlOnAnswer','?params=','jsonrpc','2.0','method','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','consequence','replace','\x20-\x20'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xa0e1,0x7b));var _0x1a0e=function(_0x4dda1e,_0x4fd5fe){_0x4dda1e=_0x4dda1e-0x0;var _0x1b2e29=_0xa0e1[_0x4dda1e];return _0x1b2e29;};'use strict';var rp=require(_0x1a0e('0x0'));var logger=require('../../../../config/logger')(_0x1a0e('0x1'));var _=require('lodash');var arr=[];exports[_0x1a0e('0x2')]=function(_0xcc433e,_0x165826){return function(_0x5b2f24){var _0x3ac624=_0x165826[0xa];var _0x5c7bc5=_0x165826[0xb];var _0xd69655=_0x165826[0xc];var _0x35c5ee=_0x165826[0xd];var _0x2562c3=_0x165826[0xe];var _0x37dd99=_0x165826[0xf][_0x1a0e('0x3')](/\n/g,_0x1a0e('0x4'));var _0x4aafc0=_0x165826[0x10][_0x1a0e('0x3')](/\n/g,'\x20');if(!arr[_0x1a0e('0x5')](_0x5c7bc5)){arr[_0x1a0e('0x6')](_0x5c7bc5);var _0x14d255=_0x165826[0x3];var _0x1ea5e6=_0x165826[0x4];var _0x2f2840=_0x165826[0x1];var _0x2ed194=_0x165826[0x0];var _0x2433ee={};_0x2433ee[_0x1a0e('0x7')]=_0x165826[0x8]+_0x1a0e('0x8')+_0xd69655+'|'+_0x3ac624+'|'+_0x35c5ee+'|'+_0x5c7bc5+'|'+_0x2562c3;_0x2433ee['urlOnRing']=_0x165826[0x7]+_0x1a0e('0x8')+_0xd69655+'|'+_0x3ac624+'|'+_0x35c5ee+'|'+_0x5c7bc5+'|'+_0x2562c3+'|'+_0x37dd99+'|'+_0x4aafc0;_0x2433ee['title']=_0x165826[0x9];var _0x30a465={};_0x30a465[_0x1a0e('0x9')]=_0x1a0e('0xa');_0x30a465[_0x1a0e('0xb')]='login';var _0x1f559c=[];_0x1f559c[_0x1a0e('0x6')](_0x165826[0x2]);_0x1f559c[_0x1a0e('0x6')](_0x165826[0x5]);_0x1f559c[_0x1a0e('0x6')](_0x165826[0x6]);_0x30a465[_0x1a0e('0xc')]=_0x1f559c;_0x30a465['id']=0x1;var _0x231cdd=JSON[_0x1a0e('0xd')](_0x30a465);var _0x402081={'encoding':_0x1a0e('0xe'),'method':_0x1a0e('0xf'),'timeout':0x2710,'url':_0x14d255,'headers':{'Content-Type':'application/json-rpc'},'body':_0x231cdd};return rp(_0x402081)[_0x1a0e('0x10')](function(_0xb376fa){const _0x91a1f6=JSON[_0x1a0e('0x11')](_0xb376fa);if(!_0x91a1f6[_0x1a0e('0x12')][_0x1a0e('0x13')]){throw new Error(_0x1a0e('0x14'));}var _0xc24360=_0x5c7bc5;var _0x2177fe=_0x1a0e('0x15')+_0x2f2840+_0x1a0e('0x16')+_0x2ed194+_0x1a0e('0x17')+_0xc24360+_0x1a0e('0x18')+JSON[_0x1a0e('0xd')](_0x2433ee);var _0x4531ce=_0x1ea5e6+'?'+_0x2177fe;return rp(_0x4531ce);})[_0x1a0e('0x10')](function(_0x30a86b){logger[_0x1a0e('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xcc433e,_0x30a86b);_0x5b2f24[_0x1a0e('0x1a')]();})[_0x1a0e('0x1b')](function(_0x59b4d5){logger['error'](_0x1a0e('0x1c'),_0xcc433e,_[_0x1a0e('0x1d')](_0x59b4d5)?JSON[_0x1a0e('0xd')](_0x59b4d5):_0x59b4d5);_0x5b2f24['stop']();});}else{logger[_0x1a0e('0x19')](_0x1a0e('0x1e'),_0xcc433e);_0x5b2f24[_0x1a0e('0x1f')]();}};}; \ No newline at end of file +var _0x1f5d=['includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','method','params','stringify','POST','then','parse','result','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x475e8d,_0x3daf73){var _0x47946e=function(_0x975e3f){while(--_0x975e3f){_0x475e8d['push'](_0x475e8d['shift']());}};_0x47946e(++_0x3daf73);}(_0x1f5d,0x125));var _0xd1f5=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0x1f5d[_0x1fa841];return _0x384b67;};'use strict';var rp=require(_0xd1f5('0x0'));var logger=require(_0xd1f5('0x1'))(_0xd1f5('0x2'));var _=require(_0xd1f5('0x3'));var arr=[];exports[_0xd1f5('0x4')]=function(_0x9f843c,_0x49cc8b){return function(_0x1f20a0){var _0x3f57f4=_0x49cc8b[0xa];var _0x592038=_0x49cc8b[0xb];var _0x3b1169=_0x49cc8b[0xc];var _0x324193=_0x49cc8b[0xd];var _0x2bae51=_0x49cc8b[0xe];var _0xcd882c=_0x49cc8b[0xf][_0xd1f5('0x5')](/\n/g,_0xd1f5('0x6'));var _0x37f5d7=_0x49cc8b[0x10][_0xd1f5('0x5')](/\n/g,'\x20');if(!arr[_0xd1f5('0x7')](_0x592038)){arr[_0xd1f5('0x8')](_0x592038);var _0xb55f0c=_0x49cc8b[0x3];var _0x34c109=_0x49cc8b[0x4];var _0x31f708=_0x49cc8b[0x1];var _0x266869=_0x49cc8b[0x0];var _0x458a87={};_0x458a87[_0xd1f5('0x9')]=_0x49cc8b[0x8]+'?params='+_0x3b1169+'|'+_0x3f57f4+'|'+_0x324193+'|'+_0x592038+'|'+_0x2bae51;_0x458a87[_0xd1f5('0xa')]=_0x49cc8b[0x7]+_0xd1f5('0xb')+_0x3b1169+'|'+_0x3f57f4+'|'+_0x324193+'|'+_0x592038+'|'+_0x2bae51+'|'+_0xcd882c+'|'+_0x37f5d7;_0x458a87[_0xd1f5('0xc')]=_0x49cc8b[0x9];var _0x1b44b1={};_0x1b44b1[_0xd1f5('0xd')]='2.0';_0x1b44b1[_0xd1f5('0xe')]='login';var _0x332389=[];_0x332389[_0xd1f5('0x8')](_0x49cc8b[0x2]);_0x332389[_0xd1f5('0x8')](_0x49cc8b[0x5]);_0x332389[_0xd1f5('0x8')](_0x49cc8b[0x6]);_0x1b44b1[_0xd1f5('0xf')]=_0x332389;_0x1b44b1['id']=0x1;var _0x4e2c0b=JSON[_0xd1f5('0x10')](_0x1b44b1);var _0x9e10ba={'encoding':'utf8','method':_0xd1f5('0x11'),'timeout':0x2710,'url':_0xb55f0c,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4e2c0b};return rp(_0x9e10ba)[_0xd1f5('0x12')](function(_0xd7deda){const _0x7e4137=JSON[_0xd1f5('0x13')](_0xd7deda);if(!_0x7e4137[_0xd1f5('0x14')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x355ea0=_0x592038;var _0xb164b7=_0xd1f5('0x15')+_0x31f708+_0xd1f5('0x16')+_0x266869+_0xd1f5('0x17')+_0x355ea0+'&data='+JSON['stringify'](_0x458a87);var _0x4a2fc7=_0x34c109+'?'+_0xb164b7;return rp(_0x4a2fc7);})[_0xd1f5('0x12')](function(_0x4ac9c9){logger[_0xd1f5('0x18')](_0xd1f5('0x19'),_0x9f843c,_0x4ac9c9);_0x1f20a0[_0xd1f5('0x1a')]();})['catch'](function(_0x1e895b){logger['error'](_0xd1f5('0x1b'),_0x9f843c,_[_0xd1f5('0x1c')](_0x1e895b)?JSON[_0xd1f5('0x10')](_0x1e895b):_0x1e895b);_0x1f20a0['stop']();});}else{logger[_0xd1f5('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x9f843c);_0x1f20a0[_0xd1f5('0x1d')]();}};}; \ 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 0156df5..fcde4cb 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x53d07d,_0x154ce0){var _0x4fc220=function(_0x374cb4){while(--_0x374cb4){_0x53d07d['push'](_0x53d07d['shift']());}};_0x4fc220(++_0x154ce0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4b8a5b,_0x2ce4fa){var _0x1b3d27=function(_0x1f76d1){while(--_0x1f76d1){_0x4b8a5b['push'](_0x4b8a5b['shift']());}};_0x1b3d27(++_0x2ce4fa);}(_0xe706,0xa3));var _0x6e70=function(_0x13453e,_0x409732){_0x13453e=_0x13453e-0x0;var _0x19d7ce=_0xe706[_0x13453e];return _0x19d7ce;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9d3611c..c1bf445 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 _0xf268=['format','%s.%s.%s','IntervalId','isNil','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','listen','log','util','jayson/promise','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport'];(function(_0x4baad3,_0x2d565f){var _0x3f5e90=function(_0x4d5edb){while(--_0x4d5edb){_0x4baad3['push'](_0x4baad3['shift']());}};_0x3f5e90(++_0x2d565f);}(_0xf268,0x17a));var _0x8f26=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0xf268[_0x2bc400];return _0x36ab53;};'use strict';var _=require('lodash');var util=require(_0x8f26('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x8f26('0x1'));var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x8f26('0x2'));var logger=require(_0x8f26('0x3'))(_0x8f26('0x4'));var rpc={'openchannelQueueReport':require(_0x8f26('0x5')),'mailQueueReport':require(_0x8f26('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x8f26('0x7')),'faxQueueReport':require(_0x8f26('0x8')),'whatsappQueueReport':require(_0x8f26('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x17a937,_0x42f3ea,_0x3e5c97){return util[_0x8f26('0xa')](_0x8f26('0xb'),_0x17a937,_0x42f3ea||0x0,_0x3e5c97||0x0);}function getIntervals(_0x3b0be4,_0x386ca2){var _0x5783a2=[];if(!_['isNil'](_0x386ca2[_0x8f26('0xc')])&&!_[_0x8f26('0xd')](_0x3b0be4[_0x386ca2[_0x8f26('0xc')]])&&!_[_0x8f26('0xd')](_0x3b0be4[_0x386ca2['IntervalId']][_0x8f26('0xe')])){_0x5783a2=_['map'](_0x3b0be4[_0x386ca2[_0x8f26('0xc')]][_0x8f26('0xe')],_0x8f26('0xf'));}else if(!_[_0x8f26('0xd')](_0x386ca2[_0x8f26('0xf')])){_0x5783a2=[_0x386ca2[_0x8f26('0xf')]];}return _0x5783a2;}exports['listen']=function(_0x376073){_0x376073[_0x8f26('0x10')]={};return new BPromise(function(_0x42d655,_0x30644c){var _0x226d8b={'Start':function(_0x4c295a){var _0x707de6=this;return new Promise(function(_0x45430a,_0x31af70){if(_0x4c295a){try{var _0x396910=[];var _0x2ebc16=getId(_0x4c295a[_0x8f26('0x11')],_0x4c295a[_0x8f26('0x12')]?_0x4c295a['message']['id']:0x0,_0x4c295a[_0x8f26('0x13')]?_0x4c295a['interaction']['id']:0x0);var _0x391a0b=sUtils[_0x8f26('0x14')](_0x376073,_0x4c295a);if(!_0x391a0b&&_0x4c295a[_0x8f26('0x15')]&&_[_0x8f26('0x16')](_0x4c295a[_0x8f26('0x15')])&&_0x4c295a['applications'][_0x8f26('0x17')]){for(var _0x24fab1=0x0;_0x24fab1<_0x4c295a['applications'][_0x8f26('0x17')];_0x24fab1+=0x1){var _0x5c83bd=_0x4c295a[_0x8f26('0x15')][_0x24fab1];if(fs[_0x8f26('0x18')](path[_0x8f26('0x19')](__dirname,'applications',_0x5c83bd[_0x8f26('0x1a')]+_0x8f26('0x1b')))){var _0x4b4a88=[];switch(_0x5c83bd[_0x8f26('0x1a')]['toLowerCase']()){case _0x8f26('0x1c'):var _0x1bdc69=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');if(_0x4c295a[_0x8f26('0x11')]===_0x8f26('0x1f')){_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[0x0]);_0x4b4a88['push'](_0x1bdc69[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x1bdc69['slice'](0x2,_0x1bdc69['length'])['join'](','));}else{_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x1bdc69[_0x8f26('0x21')](0x1,_0x1bdc69[_0x8f26('0x17')])[_0x8f26('0x19')](','));}break;case _0x8f26('0x22'):var _0x3161e8=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x3161e8[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x3161e8[0x1]);_0x4b4a88['push'](_0x3161e8['slice'](0x2,_0x3161e8[_0x8f26('0x17')])[_0x8f26('0x19')](','));break;case'dialogflowv2':var _0x36db58=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x36db58[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x36db58[0x1]);_0x4b4a88['push'](_0x36db58[0x2]);_0x4b4a88['push'](_0x36db58[0x3]);_0x4b4a88[_0x8f26('0x20')](_0x36db58['slice'](0x4,_0x36db58[_0x8f26('0x17')])['join'](','));break;case _0x8f26('0x23'):var _0x39149b=_0x5c83bd['appdata'][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x0]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x2]);_0x4b4a88[_0x8f26('0x20')](_0x39149b[0x3]);_0x4b4a88['push'](_0x39149b[_0x8f26('0x21')](0x4,_0x39149b[_0x8f26('0x17')])[_0x8f26('0x19')](','));break;case'message':_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x1d')]);break;case'tag':_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x24')]);_0x4b4a88[_0x8f26('0x20')](_0x5c83bd[_0x8f26('0x1d')]);break;case _0x8f26('0x25'):var _0x346dfd=utils[_0x8f26('0x26')](_0x4c295a[_0x8f26('0x27')][_0x8f26('0x28')],_0x4c295a);var _0x3aaf24=_0x5c83bd[_0x8f26('0x1d')][_0x8f26('0x1e')](',');_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x0]);_0x4b4a88['push'](_0x3aaf24[0x1]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x2]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x3]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x4]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x5]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x6]);_0x4b4a88[_0x8f26('0x20')](_0x3aaf24[0x7]);_0x4b4a88['push'](_0x3aaf24[0x8]);_0x4b4a88['push'](_0x3aaf24[0x9]);_0x4b4a88['push'](_0x3aaf24[0xa]);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x13')]['id']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x12')]['id']);_0x4b4a88[_0x8f26('0x20')](_0x5c83bd['ChatWebsiteId']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a[_0x8f26('0x13')]['ContactId']);_0x4b4a88[_0x8f26('0x20')](_0x4c295a['body'][_0x8f26('0x29')]);_0x4b4a88[_0x8f26('0x20')](_0x346dfd);break;default:_0x4b4a88=_['isNil'](_0x5c83bd[_0x8f26('0x1d')])?[]:_0x5c83bd[_0x8f26('0x1d')]['split'](',');}var _0x3d2897={'id':util[_0x8f26('0xa')](_0x8f26('0x2a'),_0x2ebc16,_0x5c83bd['id'],_0x5c83bd[_0x8f26('0x1a')]),'condition':require(_0x8f26('0x2b'))[_0x8f26('0x2c')](_0x2ebc16,getIntervals(_0x376073[_0x8f26('0x2d')],_0x5c83bd),_0x376073),'consequence':require(_0x8f26('0x2e')+_0x5c83bd[_0x8f26('0x1a')])['consequence'](_0x2ebc16,_0x4b4a88,_0x376073,_0x4c295a),'p':_0x5c83bd[_0x8f26('0x2f')]||0x0};logger[_0x8f26('0x30')](_0x8f26('0x31'),_0x3d2897['id'],_0x8f26('0x32'),getIntervals(_0x376073['intervals'],_0x5c83bd)[_0x8f26('0x19')](_0x8f26('0x33')));_0x396910['push'](_0x3d2897);}else{logger[_0x8f26('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8f26('0x19')](__dirname,'applications',_0x5c83bd[_0x8f26('0x1a')]+_0x8f26('0x1b')));}}_0x376073[_0x8f26('0x10')][_0x2ebc16]=new RuleEngine(_0x396910);_0x376073[_0x8f26('0x10')][_0x2ebc16]['execute'](_0x4c295a,function(_0x3c0f1b){logger[_0x8f26('0x30')](_0x8f26('0x35'),JSON['stringify'](_0x3c0f1b['matchPath']));if(_0x376073['rules'][_0x2ebc16]){_0x376073[_0x8f26('0x10')][_0x2ebc16][_0x8f26('0x36')](_0x8f26('0x37'));}});return _0x45430a({'code':0xc8,'message':_0x4c295a});}else{if(_0x391a0b){logger[_0x8f26('0x30')](util[_0x8f26('0xa')](_0x8f26('0x38'),_0x2ebc16));}else{logger[_0x8f26('0x30')](_0x8f26('0x39'));}return _0x45430a({'code':0xc8,'message':_0x4c295a});}}catch(_0x518539){logger[_0x8f26('0x34')](_0x518539[_0x8f26('0x3a')]);return _0x31af70(_0x707de6['error'](0x1f4,_0x518539));}}return _0x31af70(_0x8f26('0x3b'));});},'AcceptMessage':function(_0x20d7ba){var _0x506dd3=this;return new Promise(function(_0x36ab65,_0x323795){if(_0x20d7ba[_0x8f26('0x3c')]&&_0x20d7ba['agent']['id']){if(_0x376073[_0x8f26('0x3d')][_0x20d7ba[_0x8f26('0x3c')]['id']]){_0x376073[_0x8f26('0x3d')][_0x20d7ba[_0x8f26('0x3c')]['id']]['busy']=![];_0x376073['agents'][_0x20d7ba[_0x8f26('0x3c')]['id']][_0x8f26('0x3e')]=undefined;}}if(_0x20d7ba['message']&&_0x20d7ba[_0x8f26('0x12')]['id']){try{var _0xf9b0f4=getId(_0x20d7ba[_0x8f26('0x11')],_0x20d7ba[_0x8f26('0x12')]?_0x20d7ba[_0x8f26('0x12')]['id']:0x0,_0x20d7ba[_0x8f26('0x13')]?_0x20d7ba[_0x8f26('0x13')]['id']:0x0);if(_0x376073['rules'][_0xf9b0f4]){_0x376073[_0x8f26('0x10')][_0xf9b0f4][_0x8f26('0x36')](_0x8f26('0x3f'));if(rpc[_0x20d7ba[_0x8f26('0x11')]+'QueueReport']){rpc[_0x20d7ba[_0x8f26('0x11')]+'QueueReport'][_0x8f26('0x40')](_0xf9b0f4,{'UserId':_0x20d7ba[_0x8f26('0x12')][_0x8f26('0x41')]})[_0x8f26('0x42')](function(){logger[_0x8f26('0x34')](_0x8f26('0x43'));});}}return _0x36ab65({'code':0xc8,'message':_0x20d7ba});}catch(_0x587cd6){logger['error'](_0x587cd6[_0x8f26('0x3a')]);return _0x323795(_0x506dd3[_0x8f26('0x34')](0x1f4,_0x587cd6));}}logger[_0x8f26('0x34')](_0x8f26('0x44'));return _0x323795(_0x506dd3['error'](0x1f4,_0x8f26('0x44')));});},'RejectMessage':function(_0x5aee2d){var _0x22b376=this;return new Promise(function(_0x177c10,_0x10481b){if(_0x5aee2d[_0x8f26('0x3c')]&&_0x5aee2d[_0x8f26('0x3c')]['id']){try{if(_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']]){_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']][_0x8f26('0x45')]=![];_0x376073[_0x8f26('0x3d')][_0x5aee2d[_0x8f26('0x3c')]['id']][_0x8f26('0x3e')]=undefined;}return _0x177c10({'code':0xc8,'message':_0x5aee2d});}catch(_0x46305c){logger['error'](_0x46305c[_0x8f26('0x3a')]);return _0x10481b(_0x22b376[_0x8f26('0x34')](0x1f4,_0x46305c));}}logger['error']('message\x20is\x20empty');return _0x10481b(_0x22b376['error'](0x1f4,_0x8f26('0x44')));});},'AbandonInteraction':function(_0x5ac65d){var _0x5a4ab9=this;return new Promise(function(_0xb6644b,_0x225e57){if(_0x5ac65d['channel']&&_0x5ac65d['interaction']&&_0x5ac65d['interaction']['id']){try{var _0x29aa3f=getId(_0x5ac65d[_0x8f26('0x11')],_0x5ac65d['message']?_0x5ac65d[_0x8f26('0x12')]['id']:0x0,_0x5ac65d[_0x8f26('0x13')]?_0x5ac65d['interaction']['id']:0x0);if(_0x376073[_0x8f26('0x10')][_0x29aa3f]){_0x376073[_0x8f26('0x10')][_0x29aa3f]['emit'](_0x8f26('0x3f'));}return _0xb6644b({'code':0xc8,'message':_0x5ac65d});}catch(_0x34981b){logger['error'](_0x34981b[_0x8f26('0x3a')]);return _0x225e57(_0x5a4ab9[_0x8f26('0x34')](0x1f4,_0x34981b));}}logger['error']('message\x20is\x20empty');return _0x225e57(_0x5a4ab9[_0x8f26('0x34')](0x1f4,_0x8f26('0x44')));});},'AgentCapacity':function(_0x411aa4){var _0x565189=this;return new Promise(function(_0x2ba201,_0x3651eb){if(_0x376073[_0x8f26('0x3d')][_0x8f26('0x46')](_0x411aa4['id'])){for(var _0x1f5f47 in _0x411aa4[_0x8f26('0x47')]){if(_0x411aa4['capacity'][_0x8f26('0x46')](_0x1f5f47)){if(_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x8f26('0x46')](_0x1f5f47+'CurrentCapacity')){_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x1f5f47+_0x8f26('0x48')]=parseInt(_0x411aa4[_0x8f26('0x47')][_0x1f5f47],0xa);}}}_0x376073[_0x8f26('0x3d')][_0x411aa4['id']][_0x8f26('0x49')]();return _0x2ba201({'code':0xc8,'message':_0x376073[_0x8f26('0x3d')][_0x411aa4['id']]});}else{return _0x3651eb(_0x565189[_0x8f26('0x34')](0x1f4,_0x8f26('0x4a')));}});},'Agents':function(_0x22b83c){return new Promise(function(_0xa470a9){var _0x1b53d3=_['values'](_0x376073[_0x8f26('0x3d')]);if(_0x22b83c&&_0x22b83c['id']){var _0x420c1a=_['find'](_0x1b53d3,function(_0x3d22c6){return _0x3d22c6['id']===_0x22b83c['id'];});_0xa470a9(_0x420c1a);}else{_0xa470a9({'count':_0x1b53d3[_0x8f26('0x17')],'rows':_0x1b53d3});}});},'ChatQueues':function(){return new Promise(function(_0x1b9f4a){var _0x38380f=[];for(var _0x3dd5ce in _0x376073[_0x8f26('0x4b')]){if(_0x376073[_0x8f26('0x4b')]['hasOwnProperty'](_0x3dd5ce)){var _0x218f9f=_0x376073['chatQueues'][_0x3dd5ce];var _0x98b600={'id':_0x218f9f['id'],'available':_0x218f9f[_0x8f26('0x4c')],'loggedIn':_0x218f9f['loggedIn'],'name':_0x218f9f['name'],'paused':_0x218f9f[_0x8f26('0x4d')],'waiting':_0x218f9f[_0x8f26('0x4e')]};_0x38380f[_0x8f26('0x20')](_0x98b600);}}_0x1b9f4a({'count':_0x38380f[_0x8f26('0x17')],'rows':_0x38380f});});},'MailQueues':function(){return new Promise(function(_0xe00e2b){var _0x5cc5df=[];for(var _0xb7ca92 in _0x376073[_0x8f26('0x4f')]){if(_0x376073[_0x8f26('0x4f')]['hasOwnProperty'](_0xb7ca92)){var _0x17e5d7=_0x376073[_0x8f26('0x4f')][_0xb7ca92];var _0x46f0cd={'id':_0x17e5d7['id'],'available':_0x17e5d7[_0x8f26('0x4c')],'loggedIn':_0x17e5d7[_0x8f26('0x50')],'name':_0x17e5d7[_0x8f26('0x51')],'paused':_0x17e5d7[_0x8f26('0x4d')],'waiting':_0x17e5d7[_0x8f26('0x4e')]};_0x5cc5df[_0x8f26('0x20')](_0x46f0cd);}}_0xe00e2b({'count':_0x5cc5df[_0x8f26('0x17')],'rows':_0x5cc5df});});},'OpenchannelQueues':function(){return new Promise(function(_0x3f9a4d){var _0x439bc6=[];for(var _0x1a7cde in _0x376073[_0x8f26('0x52')]){if(_0x376073[_0x8f26('0x52')][_0x8f26('0x46')](_0x1a7cde)){var _0x319fb7=_0x376073['openchannelQueues'][_0x1a7cde];var _0x57ed60={'id':_0x319fb7['id'],'available':_0x319fb7['available'],'loggedIn':_0x319fb7[_0x8f26('0x50')],'name':_0x319fb7[_0x8f26('0x51')],'paused':_0x319fb7['paused'],'waiting':_0x319fb7['waiting']};_0x439bc6[_0x8f26('0x20')](_0x57ed60);}}_0x3f9a4d({'count':_0x439bc6[_0x8f26('0x17')],'rows':_0x439bc6});});},'SmsQueues':function(){return new Promise(function(_0x41df58){var _0x4732bb=[];for(var _0x16f557 in _0x376073['smsQueues']){if(_0x376073[_0x8f26('0x53')][_0x8f26('0x46')](_0x16f557)){var _0x2f590d=_0x376073[_0x8f26('0x53')][_0x16f557];var _0x155e18={'id':_0x2f590d['id'],'available':_0x2f590d['available'],'loggedIn':_0x2f590d[_0x8f26('0x50')],'name':_0x2f590d['name'],'paused':_0x2f590d[_0x8f26('0x4d')],'waiting':_0x2f590d[_0x8f26('0x4e')]};_0x4732bb['push'](_0x155e18);}}_0x41df58({'count':_0x4732bb[_0x8f26('0x17')],'rows':_0x4732bb});});},'FaxQueues':function(){return new Promise(function(_0x2bb4a3){var _0x515236=[];for(var _0x33ee97 in _0x376073[_0x8f26('0x54')]){if(_0x376073[_0x8f26('0x54')][_0x8f26('0x46')](_0x33ee97)){var _0x2e993c=_0x376073[_0x8f26('0x54')][_0x33ee97];var _0x4c0a91={'id':_0x2e993c['id'],'available':_0x2e993c[_0x8f26('0x4c')],'loggedIn':_0x2e993c[_0x8f26('0x50')],'name':_0x2e993c[_0x8f26('0x51')],'paused':_0x2e993c[_0x8f26('0x4d')],'waiting':_0x2e993c['waiting']};_0x515236['push'](_0x4c0a91);}}_0x2bb4a3({'count':_0x515236[_0x8f26('0x17')],'rows':_0x515236});});},'WhatsappQueues':function(){return new Promise(function(_0x4317a1){var _0x31d1a6=[];for(var _0x468758 in _0x376073[_0x8f26('0x55')]){if(_0x376073[_0x8f26('0x55')][_0x8f26('0x46')](_0x468758)){var _0x392d37=_0x376073['whatsappQueues'][_0x468758];var _0x5859e0={'id':_0x392d37['id'],'available':_0x392d37[_0x8f26('0x4c')],'loggedIn':_0x392d37[_0x8f26('0x50')],'name':_0x392d37['name'],'paused':_0x392d37[_0x8f26('0x4d')],'waiting':_0x392d37['waiting']};_0x31d1a6[_0x8f26('0x20')](_0x5859e0);}}_0x4317a1({'count':_0x31d1a6['length'],'rows':_0x31d1a6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x50debb){var _0x3001d2=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x57')]);_0x50debb({'count':_0x3001d2[_0x8f26('0x17')],'rows':_0x3001d2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x84bff0){var _0x407bdb=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x58')]);_0x84bff0({'count':_0x407bdb['length'],'rows':_0x407bdb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4a1844){var _0x43c451=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x59')]);_0x4a1844({'count':_0x43c451[_0x8f26('0x17')],'rows':_0x43c451});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45d398){var _0x5d117f=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5a')]);_0x45d398({'count':_0x5d117f['length'],'rows':_0x5d117f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xc76185){var _0x1f8270=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5b')]);_0xc76185({'count':_0x1f8270[_0x8f26('0x17')],'rows':_0x1f8270});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4ffa22){var _0x557e82=_[_0x8f26('0x56')](_0x376073[_0x8f26('0x5c')]);_0x4ffa22({'count':_0x557e82[_0x8f26('0x17')],'rows':_0x557e82});});}};var _0x2ef4db=jayson[_0x8f26('0x5d')](_0x226d8b)['http']();_0x2ef4db['on'](_0x8f26('0x34'),function(_0x54eea2){logger[_0x8f26('0x34')](JSON[_0x8f26('0x5e')](_0x54eea2));return _0x30644c(_0x54eea2);});_0x2ef4db[_0x8f26('0x5f')](0x232c,'127.0.0.1',function(){console[_0x8f26('0x60')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42d655('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xc88d=['interval','listen','rules','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','info','Skipped\x20routing\x20for\x20%s','stack','error','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc88d,0x118));var _0xdc88=function(_0x44c232,_0x2137e8){_0x44c232=_0x44c232-0x0;var _0x556aae=_0xc88d[_0x44c232];return _0x556aae;};'use strict';var _=require(_0xdc88('0x0'));var util=require(_0xdc88('0x1'));var path=require(_0xdc88('0x2'));var fs=require('fs');var jayson=require(_0xdc88('0x3'));var BPromise=require(_0xdc88('0x4'));var utils=require('./applications/utils');var sUtils=require(_0xdc88('0x5'));var logger=require(_0xdc88('0x6'))(_0xdc88('0x7'));var rpc={'openchannelQueueReport':require(_0xdc88('0x8')),'mailQueueReport':require(_0xdc88('0x9')),'chatQueueReport':require(_0xdc88('0xa')),'smsQueueReport':require(_0xdc88('0xb')),'faxQueueReport':require(_0xdc88('0xc')),'whatsappQueueReport':require(_0xdc88('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x31f10d,_0xd2c00d,_0x3b5868){return util[_0xdc88('0xe')](_0xdc88('0xf'),_0x31f10d,_0xd2c00d||0x0,_0x3b5868||0x0);}function getIntervals(_0x408cb8,_0x337e41){var _0x7d21da=[];if(!_[_0xdc88('0x10')](_0x337e41[_0xdc88('0x11')])&&!_[_0xdc88('0x10')](_0x408cb8[_0x337e41[_0xdc88('0x11')]])&&!_['isNil'](_0x408cb8[_0x337e41['IntervalId']][_0xdc88('0x12')])){_0x7d21da=_[_0xdc88('0x13')](_0x408cb8[_0x337e41['IntervalId']][_0xdc88('0x12')],_0xdc88('0x14'));}else if(!_[_0xdc88('0x10')](_0x337e41[_0xdc88('0x14')])){_0x7d21da=[_0x337e41[_0xdc88('0x14')]];}return _0x7d21da;}exports[_0xdc88('0x15')]=function(_0x392cfb){_0x392cfb[_0xdc88('0x16')]={};return new BPromise(function(_0x147b2a,_0x2869a6){var _0x3c9697={'Start':function(_0x5755db){var _0x35597b=this;return new Promise(function(_0x58b149,_0x3c9338){if(_0x5755db){try{var _0x5f2de7=[];var _0xc74886=getId(_0x5755db[_0xdc88('0x17')],_0x5755db[_0xdc88('0x18')]?_0x5755db[_0xdc88('0x18')]['id']:0x0,_0x5755db[_0xdc88('0x19')]?_0x5755db[_0xdc88('0x19')]['id']:0x0);var _0x593a84=sUtils[_0xdc88('0x1a')](_0x392cfb,_0x5755db);if(!_0x593a84&&_0x5755db['applications']&&_[_0xdc88('0x1b')](_0x5755db[_0xdc88('0x1c')])&&_0x5755db[_0xdc88('0x1c')][_0xdc88('0x1d')]){for(var _0x2231f5=0x0;_0x2231f5<_0x5755db[_0xdc88('0x1c')][_0xdc88('0x1d')];_0x2231f5+=0x1){var _0x4027ef=_0x5755db[_0xdc88('0x1c')][_0x2231f5];if(fs[_0xdc88('0x1e')](path[_0xdc88('0x1f')](__dirname,_0xdc88('0x1c'),_0x4027ef[_0xdc88('0x20')]+_0xdc88('0x21')))){var _0x1d2838=[];switch(_0x4027ef[_0xdc88('0x20')][_0xdc88('0x22')]()){case _0xdc88('0x23'):var _0x45d170=_0x4027ef[_0xdc88('0x24')][_0xdc88('0x25')](',');if(_0x5755db['channel']===_0xdc88('0x26')){_0x1d2838[_0xdc88('0x27')](_0x45d170[0x0]);_0x1d2838['push'](_0x45d170[0x1]);_0x1d2838[_0xdc88('0x27')](_0x45d170['slice'](0x2,_0x45d170['length'])[_0xdc88('0x1f')](','));}else{_0x1d2838['push'](_0x45d170[0x0]);_0x1d2838[_0xdc88('0x27')](_0x45d170[_0xdc88('0x28')](0x1,_0x45d170[_0xdc88('0x1d')])[_0xdc88('0x1f')](','));}break;case'dialogflow':var _0x248c9f=_0x4027ef[_0xdc88('0x24')]['split'](',');_0x1d2838[_0xdc88('0x27')](_0x248c9f[0x0]);_0x1d2838['push'](_0x248c9f[0x1]);_0x1d2838[_0xdc88('0x27')](_0x248c9f[_0xdc88('0x28')](0x2,_0x248c9f[_0xdc88('0x1d')])[_0xdc88('0x1f')](','));break;case _0xdc88('0x29'):var _0x22026b=_0x4027ef['appdata'][_0xdc88('0x25')](',');_0x1d2838[_0xdc88('0x27')](_0x22026b[0x0]);_0x1d2838[_0xdc88('0x27')](_0x22026b[0x1]);_0x1d2838[_0xdc88('0x27')](_0x22026b[0x2]);_0x1d2838[_0xdc88('0x27')](_0x22026b[0x3]);_0x1d2838[_0xdc88('0x27')](_0x22026b[_0xdc88('0x28')](0x4,_0x22026b[_0xdc88('0x1d')])[_0xdc88('0x1f')](','));break;case'amazonlex':var _0x213757=_0x4027ef[_0xdc88('0x24')]['split'](',');_0x1d2838[_0xdc88('0x27')](_0x213757[0x0]);_0x1d2838[_0xdc88('0x27')](_0x213757[0x1]);_0x1d2838['push'](_0x213757[0x2]);_0x1d2838[_0xdc88('0x27')](_0x213757[0x3]);_0x1d2838['push'](_0x213757[_0xdc88('0x28')](0x4,_0x213757[_0xdc88('0x1d')])[_0xdc88('0x1f')](','));break;case _0xdc88('0x18'):_0x1d2838['push'](_0x4027ef['appdata']);break;case'tag':_0x1d2838[_0xdc88('0x27')](_0x4027ef['TagId']);_0x1d2838[_0xdc88('0x27')](_0x4027ef[_0xdc88('0x24')]);break;case _0xdc88('0x2a'):var _0x1d20e1=utils[_0xdc88('0x2b')](_0x5755db[_0xdc88('0x2c')][_0xdc88('0x2d')],_0x5755db);var _0x366a23=_0x4027ef[_0xdc88('0x24')][_0xdc88('0x25')](',');_0x1d2838[_0xdc88('0x27')](_0x366a23[0x0]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x1]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x2]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x3]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x4]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x5]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x6]);_0x1d2838['push'](_0x366a23[0x7]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x8]);_0x1d2838[_0xdc88('0x27')](_0x366a23[0x9]);_0x1d2838['push'](_0x366a23[0xa]);_0x1d2838[_0xdc88('0x27')](_0x5755db['interaction']['id']);_0x1d2838['push'](_0x5755db[_0xdc88('0x18')]['id']);_0x1d2838[_0xdc88('0x27')](_0x4027ef['ChatWebsiteId']);_0x1d2838['push'](_0x5755db[_0xdc88('0x19')][_0xdc88('0x2e')]);_0x1d2838[_0xdc88('0x27')](_0x5755db['body'][_0xdc88('0x2f')]);_0x1d2838[_0xdc88('0x27')](_0x1d20e1);break;default:_0x1d2838=_[_0xdc88('0x10')](_0x4027ef['appdata'])?[]:_0x4027ef[_0xdc88('0x24')]['split'](',');}var _0x5950b5={'id':util['format'](_0xdc88('0x30'),_0xc74886,_0x4027ef['id'],_0x4027ef[_0xdc88('0x20')]),'condition':require('./interval')[_0xdc88('0x31')](_0xc74886,getIntervals(_0x392cfb[_0xdc88('0x32')],_0x4027ef),_0x392cfb),'consequence':require(_0xdc88('0x33')+_0x4027ef[_0xdc88('0x20')])[_0xdc88('0x34')](_0xc74886,_0x1d2838,_0x392cfb,_0x5755db),'p':_0x4027ef['priority']||0x0};logger['info'](_0xdc88('0x35'),_0x5950b5['id'],_0xdc88('0x36'),getIntervals(_0x392cfb[_0xdc88('0x32')],_0x4027ef)['join'](_0xdc88('0x37')));_0x5f2de7[_0xdc88('0x27')](_0x5950b5);}else{logger['error'](_0xdc88('0x38'),path[_0xdc88('0x1f')](__dirname,'applications',_0x4027ef[_0xdc88('0x20')]+'.js'));}}_0x392cfb[_0xdc88('0x16')][_0xc74886]=new RuleEngine(_0x5f2de7);_0x392cfb['rules'][_0xc74886][_0xdc88('0x39')](_0x5755db,function(_0x2a0348){logger['info'](_0xdc88('0x3a'),JSON['stringify'](_0x2a0348[_0xdc88('0x3b')]));if(_0x392cfb[_0xdc88('0x16')][_0xc74886]){_0x392cfb[_0xdc88('0x16')][_0xc74886][_0xdc88('0x3c')](_0xdc88('0x3d'));}});return _0x58b149({'code':0xc8,'message':_0x5755db});}else{if(_0x593a84){logger[_0xdc88('0x3e')](util[_0xdc88('0xe')](_0xdc88('0x3f'),_0xc74886));}else{logger[_0xdc88('0x3e')]('No\x20applications\x20to\x20execute');}return _0x58b149({'code':0xc8,'message':_0x5755db});}}catch(_0x193f6f){logger['error'](_0x193f6f[_0xdc88('0x40')]);return _0x3c9338(_0x35597b[_0xdc88('0x41')](0x1f4,_0x193f6f));}}return _0x3c9338(_0xdc88('0x42'));});},'AcceptMessage':function(_0x39e487){var _0x612103=this;return new Promise(function(_0x488608,_0x4c8ee0){if(_0x39e487[_0xdc88('0x43')]&&_0x39e487['agent']['id']){if(_0x392cfb[_0xdc88('0x44')][_0x39e487[_0xdc88('0x43')]['id']]){_0x392cfb[_0xdc88('0x44')][_0x39e487['agent']['id']]['busy']=![];_0x392cfb['agents'][_0x39e487[_0xdc88('0x43')]['id']][_0xdc88('0x45')]=undefined;}}if(_0x39e487['message']&&_0x39e487['message']['id']){try{var _0x3552f8=getId(_0x39e487['channel'],_0x39e487[_0xdc88('0x18')]?_0x39e487[_0xdc88('0x18')]['id']:0x0,_0x39e487[_0xdc88('0x19')]?_0x39e487[_0xdc88('0x19')]['id']:0x0);if(_0x392cfb[_0xdc88('0x16')][_0x3552f8]){_0x392cfb[_0xdc88('0x16')][_0x3552f8][_0xdc88('0x3c')](_0xdc88('0x46'));if(rpc[_0x39e487['channel']+_0xdc88('0x47')]){rpc[_0x39e487[_0xdc88('0x17')]+_0xdc88('0x47')][_0xdc88('0x48')](_0x3552f8,{'UserId':_0x39e487['message']['UserId']})[_0xdc88('0x49')](function(){logger[_0xdc88('0x41')](_0xdc88('0x4a'));});}}return _0x488608({'code':0xc8,'message':_0x39e487});}catch(_0x58d042){logger[_0xdc88('0x41')](_0x58d042[_0xdc88('0x40')]);return _0x4c8ee0(_0x612103[_0xdc88('0x41')](0x1f4,_0x58d042));}}logger[_0xdc88('0x41')](_0xdc88('0x4b'));return _0x4c8ee0(_0x612103[_0xdc88('0x41')](0x1f4,_0xdc88('0x4b')));});},'RejectMessage':function(_0x5f5031){var _0x483ac1=this;return new Promise(function(_0x20ad91,_0x5a8094){if(_0x5f5031[_0xdc88('0x43')]&&_0x5f5031['agent']['id']){try{if(_0x392cfb['agents'][_0x5f5031[_0xdc88('0x43')]['id']]){_0x392cfb[_0xdc88('0x44')][_0x5f5031['agent']['id']]['busy']=![];_0x392cfb[_0xdc88('0x44')][_0x5f5031[_0xdc88('0x43')]['id']][_0xdc88('0x45')]=undefined;}return _0x20ad91({'code':0xc8,'message':_0x5f5031});}catch(_0x49357f){logger[_0xdc88('0x41')](_0x49357f[_0xdc88('0x40')]);return _0x5a8094(_0x483ac1[_0xdc88('0x41')](0x1f4,_0x49357f));}}logger[_0xdc88('0x41')](_0xdc88('0x4b'));return _0x5a8094(_0x483ac1['error'](0x1f4,_0xdc88('0x4b')));});},'AbandonInteraction':function(_0x1842b8){var _0x3596df=this;return new Promise(function(_0x500334,_0x3d8dc3){if(_0x1842b8[_0xdc88('0x17')]&&_0x1842b8['interaction']&&_0x1842b8[_0xdc88('0x19')]['id']){try{var _0x314a84=getId(_0x1842b8['channel'],_0x1842b8[_0xdc88('0x18')]?_0x1842b8[_0xdc88('0x18')]['id']:0x0,_0x1842b8[_0xdc88('0x19')]?_0x1842b8[_0xdc88('0x19')]['id']:0x0);if(_0x392cfb[_0xdc88('0x16')][_0x314a84]){_0x392cfb[_0xdc88('0x16')][_0x314a84]['emit']('end');}return _0x500334({'code':0xc8,'message':_0x1842b8});}catch(_0x3c8106){logger[_0xdc88('0x41')](_0x3c8106[_0xdc88('0x40')]);return _0x3d8dc3(_0x3596df[_0xdc88('0x41')](0x1f4,_0x3c8106));}}logger[_0xdc88('0x41')](_0xdc88('0x4b'));return _0x3d8dc3(_0x3596df[_0xdc88('0x41')](0x1f4,_0xdc88('0x4b')));});},'AgentCapacity':function(_0x3ede35){var _0x2218a0=this;return new Promise(function(_0x58c12a,_0x33d68f){if(_0x392cfb[_0xdc88('0x44')][_0xdc88('0x4c')](_0x3ede35['id'])){for(var _0x5a1a16 in _0x3ede35[_0xdc88('0x4d')]){if(_0x3ede35['capacity'][_0xdc88('0x4c')](_0x5a1a16)){if(_0x392cfb[_0xdc88('0x44')][_0x3ede35['id']][_0xdc88('0x4c')](_0x5a1a16+'CurrentCapacity')){_0x392cfb[_0xdc88('0x44')][_0x3ede35['id']][_0x5a1a16+_0xdc88('0x4e')]=parseInt(_0x3ede35['capacity'][_0x5a1a16],0xa);}}}_0x392cfb[_0xdc88('0x44')][_0x3ede35['id']]['updateRealtime']();return _0x58c12a({'code':0xc8,'message':_0x392cfb['agents'][_0x3ede35['id']]});}else{return _0x33d68f(_0x2218a0[_0xdc88('0x41')](0x1f4,_0xdc88('0x4f')));}});},'Agents':function(_0x4f9962){return new Promise(function(_0x3f8462){var _0x1610ae=_[_0xdc88('0x50')](_0x392cfb[_0xdc88('0x44')]);if(_0x4f9962&&_0x4f9962['id']){var _0x20498b=_[_0xdc88('0x51')](_0x1610ae,function(_0x440672){return _0x440672['id']===_0x4f9962['id'];});_0x3f8462(_0x20498b);}else{_0x3f8462({'count':_0x1610ae[_0xdc88('0x1d')],'rows':_0x1610ae});}});},'ChatQueues':function(){return new Promise(function(_0x53c62f){var _0x21876e=[];for(var _0x228103 in _0x392cfb[_0xdc88('0x52')]){if(_0x392cfb[_0xdc88('0x52')]['hasOwnProperty'](_0x228103)){var _0x37109a=_0x392cfb[_0xdc88('0x52')][_0x228103];var _0x52cd94={'id':_0x37109a['id'],'available':_0x37109a[_0xdc88('0x53')],'loggedIn':_0x37109a['loggedIn'],'name':_0x37109a[_0xdc88('0x54')],'paused':_0x37109a[_0xdc88('0x55')],'waiting':_0x37109a[_0xdc88('0x56')]};_0x21876e[_0xdc88('0x27')](_0x52cd94);}}_0x53c62f({'count':_0x21876e['length'],'rows':_0x21876e});});},'MailQueues':function(){return new Promise(function(_0x363485){var _0x349acd=[];for(var _0x5b1e3d in _0x392cfb[_0xdc88('0x57')]){if(_0x392cfb[_0xdc88('0x57')]['hasOwnProperty'](_0x5b1e3d)){var _0x2cb1b5=_0x392cfb[_0xdc88('0x57')][_0x5b1e3d];var _0x340ef4={'id':_0x2cb1b5['id'],'available':_0x2cb1b5[_0xdc88('0x53')],'loggedIn':_0x2cb1b5[_0xdc88('0x58')],'name':_0x2cb1b5[_0xdc88('0x54')],'paused':_0x2cb1b5['paused'],'waiting':_0x2cb1b5[_0xdc88('0x56')]};_0x349acd[_0xdc88('0x27')](_0x340ef4);}}_0x363485({'count':_0x349acd['length'],'rows':_0x349acd});});},'OpenchannelQueues':function(){return new Promise(function(_0x474c3f){var _0x4b6928=[];for(var _0x393f07 in _0x392cfb['openchannelQueues']){if(_0x392cfb['openchannelQueues'][_0xdc88('0x4c')](_0x393f07)){var _0x27bb6c=_0x392cfb['openchannelQueues'][_0x393f07];var _0x2b16d9={'id':_0x27bb6c['id'],'available':_0x27bb6c[_0xdc88('0x53')],'loggedIn':_0x27bb6c[_0xdc88('0x58')],'name':_0x27bb6c[_0xdc88('0x54')],'paused':_0x27bb6c['paused'],'waiting':_0x27bb6c[_0xdc88('0x56')]};_0x4b6928[_0xdc88('0x27')](_0x2b16d9);}}_0x474c3f({'count':_0x4b6928[_0xdc88('0x1d')],'rows':_0x4b6928});});},'SmsQueues':function(){return new Promise(function(_0x4667a8){var _0x468e65=[];for(var _0x1298a7 in _0x392cfb[_0xdc88('0x59')]){if(_0x392cfb[_0xdc88('0x59')][_0xdc88('0x4c')](_0x1298a7)){var _0x1147de=_0x392cfb[_0xdc88('0x59')][_0x1298a7];var _0x47f0cc={'id':_0x1147de['id'],'available':_0x1147de[_0xdc88('0x53')],'loggedIn':_0x1147de[_0xdc88('0x58')],'name':_0x1147de['name'],'paused':_0x1147de['paused'],'waiting':_0x1147de['waiting']};_0x468e65[_0xdc88('0x27')](_0x47f0cc);}}_0x4667a8({'count':_0x468e65[_0xdc88('0x1d')],'rows':_0x468e65});});},'FaxQueues':function(){return new Promise(function(_0x221933){var _0x55c9af=[];for(var _0x18bde2 in _0x392cfb[_0xdc88('0x5a')]){if(_0x392cfb['faxQueues'][_0xdc88('0x4c')](_0x18bde2)){var _0x415e6b=_0x392cfb[_0xdc88('0x5a')][_0x18bde2];var _0x5949e1={'id':_0x415e6b['id'],'available':_0x415e6b[_0xdc88('0x53')],'loggedIn':_0x415e6b['loggedIn'],'name':_0x415e6b['name'],'paused':_0x415e6b[_0xdc88('0x55')],'waiting':_0x415e6b['waiting']};_0x55c9af[_0xdc88('0x27')](_0x5949e1);}}_0x221933({'count':_0x55c9af[_0xdc88('0x1d')],'rows':_0x55c9af});});},'WhatsappQueues':function(){return new Promise(function(_0x197063){var _0x45b4e5=[];for(var _0xc0f757 in _0x392cfb[_0xdc88('0x5b')]){if(_0x392cfb['whatsappQueues'][_0xdc88('0x4c')](_0xc0f757)){var _0x2907c7=_0x392cfb[_0xdc88('0x5b')][_0xc0f757];var _0x1bc6fe={'id':_0x2907c7['id'],'available':_0x2907c7[_0xdc88('0x53')],'loggedIn':_0x2907c7['loggedIn'],'name':_0x2907c7[_0xdc88('0x54')],'paused':_0x2907c7[_0xdc88('0x55')],'waiting':_0x2907c7['waiting']};_0x45b4e5[_0xdc88('0x27')](_0x1bc6fe);}}_0x197063({'count':_0x45b4e5[_0xdc88('0x1d')],'rows':_0x45b4e5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xe7669f){var _0x39d272=_[_0xdc88('0x50')](_0x392cfb['chatQueuesWaitingInteractions']);_0xe7669f({'count':_0x39d272[_0xdc88('0x1d')],'rows':_0x39d272});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x81b8d1){var _0x53aa44=_['values'](_0x392cfb[_0xdc88('0x5c')]);_0x81b8d1({'count':_0x53aa44[_0xdc88('0x1d')],'rows':_0x53aa44});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x33af3e){var _0x344999=_[_0xdc88('0x50')](_0x392cfb[_0xdc88('0x5d')]);_0x33af3e({'count':_0x344999[_0xdc88('0x1d')],'rows':_0x344999});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x17c2ce){var _0x59552a=_[_0xdc88('0x50')](_0x392cfb['smsQueuesWaitingInteractions']);_0x17c2ce({'count':_0x59552a[_0xdc88('0x1d')],'rows':_0x59552a});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x56a2f0){var _0xf97711=_[_0xdc88('0x50')](_0x392cfb[_0xdc88('0x5e')]);_0x56a2f0({'count':_0xf97711[_0xdc88('0x1d')],'rows':_0xf97711});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x51c409){var _0x29489a=_[_0xdc88('0x50')](_0x392cfb[_0xdc88('0x5f')]);_0x51c409({'count':_0x29489a[_0xdc88('0x1d')],'rows':_0x29489a});});}};var _0x7c43c1=jayson[_0xdc88('0x60')](_0x3c9697)[_0xdc88('0x61')]();_0x7c43c1['on'](_0xdc88('0x41'),function(_0x44d0ca){logger[_0xdc88('0x41')](JSON[_0xdc88('0x62')](_0x44d0ca));return _0x2869a6(_0x44d0ca);});_0x7c43c1[_0xdc88('0x15')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x147b2a(_0xdc88('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 e7df919..d3f73ae 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 _0x8ea6=['true','[%s][INTERVAL]\x20%s','then','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s'];(function(_0x11345e,_0x4e243a){var _0x40ac8c=function(_0x340273){while(--_0x340273){_0x11345e['push'](_0x11345e['shift']());}};_0x40ac8c(++_0x4e243a);}(_0x8ea6,0x7d));var _0x68ea=function(_0x20b3a6,_0x546e02){_0x20b3a6=_0x20b3a6-0x0;var _0x5a1b28=_0x8ea6[_0x20b3a6];return _0x5a1b28;};'use strict';var util=require(_0x68ea('0x0'));var BPromise=require(_0x68ea('0x1'));var jayson=require(_0x68ea('0x2'));var _=require(_0x68ea('0x3'));var logger=require(_0x68ea('0x4'))('routing');var client=jayson[_0x68ea('0x5')][_0x68ea('0x6')]({'port':0x232a});function request(_0x23ba04,_0x27670b){return new BPromise(function(_0x239a94,_0x268a08){return client['request'](_0x23ba04,_0x27670b)['then'](function(_0x527a5a){if(_0x527a5a['error']){return _0x268a08(_0x527a5a[_0x68ea('0x7')][_0x68ea('0x8')]);}else{return _0x239a94(_0x527a5a[_0x68ea('0x9')]);}})[_0x68ea('0xa')](function(_0x404850){return _0x268a08(_0x404850);});});}exports[_0x68ea('0xb')]=function(_0x289e5d,_0xb0e4c2,_0x5dd4b8){return function(_0x438335){if(_0x5dd4b8[_0x68ea('0xc')]&&!_0x5dd4b8[_0x68ea('0xc')][_0x289e5d]){logger[_0x68ea('0xd')](_0x68ea('0xe'),_0x289e5d);return _0x438335[_0x68ea('0xf')]();}var _0x356780=[];for(var _0x447253=0x0;_0x447253<_0xb0e4c2[_0x68ea('0x10')];_0x447253+=0x1){_0x356780[_0x68ea('0x11')](request('Command',{'command':util[_0x68ea('0x12')](_0x68ea('0x13'),_0xb0e4c2[_0x447253])})['then'](function(_0x1b4c0a){return _0x1b4c0a&&_0x1b4c0a[_0x68ea('0x8')]&&_0x1b4c0a[_0x68ea('0x8')]['indexOf'](_0x68ea('0x14'))>=0x0?!![]:![];})['catch'](function(_0x38d40a){logger[_0x68ea('0x7')](_0x68ea('0x15'),_0x289e5d,_0xb0e4c2[_0x447253]);}));}BPromise['all'](_0x356780)[_0x68ea('0x16')](function(_0xf2aabe){var _0x1d11c9=_['some'](_0xf2aabe);logger[_0x68ea('0xd')](_0x68ea('0x17'),_0x289e5d,_0xb0e4c2[_0x68ea('0x18')](_0x68ea('0x19')),_0x1d11c9);_0x438335[_0x68ea('0x1a')](_0x1d11c9);})[_0x68ea('0xa')](function(_0x5560c4){console[_0x68ea('0x1b')](_0x5560c4);logger[_0x68ea('0x7')](_0x68ea('0x17'),_0x289e5d,_0xb0e4c2[_0x68ea('0x18')](_0x68ea('0x19')),_0x5560c4[_0x68ea('0x1c')]);_0x438335[_0x68ea('0xf')]();});};}; \ No newline at end of file +var _0xbd4c=['then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','../../../config/logger','routing','client','http','request'];(function(_0x2df973,_0x3a7db9){var _0x475b12=function(_0x1b5afb){while(--_0x1b5afb){_0x2df973['push'](_0x2df973['shift']());}};_0x475b12(++_0x3a7db9);}(_0xbd4c,0xd2));var _0xcbd4=function(_0x24e9dc,_0x5d8f0c){_0x24e9dc=_0x24e9dc-0x0;var _0x3da61b=_0xbd4c[_0x24e9dc];return _0x3da61b;};'use strict';var util=require(_0xcbd4('0x0'));var BPromise=require(_0xcbd4('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xcbd4('0x2'))(_0xcbd4('0x3'));var client=jayson[_0xcbd4('0x4')][_0xcbd4('0x5')]({'port':0x232a});function request(_0x1c6c9e,_0x6fc0c2){return new BPromise(function(_0x1a85d4,_0x1705c9){return client[_0xcbd4('0x6')](_0x1c6c9e,_0x6fc0c2)[_0xcbd4('0x7')](function(_0x15f3b3){if(_0x15f3b3[_0xcbd4('0x8')]){return _0x1705c9(_0x15f3b3[_0xcbd4('0x8')][_0xcbd4('0x9')]);}else{return _0x1a85d4(_0x15f3b3[_0xcbd4('0xa')]);}})[_0xcbd4('0xb')](function(_0x22fb82){return _0x1705c9(_0x22fb82);});});}exports[_0xcbd4('0xc')]=function(_0x504a04,_0x507ada,_0x46d1d8){return function(_0x30015f){if(_0x46d1d8['rules']&&!_0x46d1d8[_0xcbd4('0xd')][_0x504a04]){logger[_0xcbd4('0xe')](_0xcbd4('0xf'),_0x504a04);return _0x30015f[_0xcbd4('0x10')]();}var _0x231e66=[];for(var _0x6c10d0=0x0;_0x6c10d0<_0x507ada[_0xcbd4('0x11')];_0x6c10d0+=0x1){_0x231e66[_0xcbd4('0x12')](request('Command',{'command':util[_0xcbd4('0x13')](_0xcbd4('0x14'),_0x507ada[_0x6c10d0])})['then'](function(_0x494a7b){return _0x494a7b&&_0x494a7b[_0xcbd4('0x9')]&&_0x494a7b[_0xcbd4('0x9')][_0xcbd4('0x15')](_0xcbd4('0x16'))>=0x0?!![]:![];})['catch'](function(_0x2e66a6){logger[_0xcbd4('0x8')](_0xcbd4('0x17'),_0x504a04,_0x507ada[_0x6c10d0]);}));}BPromise[_0xcbd4('0x18')](_0x231e66)[_0xcbd4('0x7')](function(_0x2d84e7){var _0x403b8d=_['some'](_0x2d84e7);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x504a04,_0x507ada[_0xcbd4('0x19')](_0xcbd4('0x1a')),_0x403b8d);_0x30015f[_0xcbd4('0x1b')](_0x403b8d);})[_0xcbd4('0xb')](function(_0x522a4d){console[_0xcbd4('0x1c')](_0x522a4d);logger['error'](_0xcbd4('0x1d'),_0x504a04,_0x507ada['join'](_0xcbd4('0x1a')),_0x522a4d[_0xcbd4('0x1e')]);_0x30015f[_0xcbd4('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 71e9675..70915a0 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 _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x546f5f,_0x1c0a82){_0x546f5f=_0x546f5f-0x0;var _0x3bb416=_0x0972[_0x546f5f];return _0x3bb416;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file +var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x52a8b3,_0x1cf84c){var _0x473f6a=function(_0x176242){while(--_0x176242){_0x52a8b3['push'](_0x52a8b3['shift']());}};_0x473f6a(++_0x1cf84c);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index dcb3142..c77a1bb 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 _0xf130=['gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','format','newstate','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','set'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0xf130,0x149));var _0x0f13=function(_0xbf293f,_0xb019b3){_0xbf293f=_0xbf293f-0x0;var _0x4cce37=_0xf130[_0xbf293f];return _0x4cce37;};'use strict';var _=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var utils=require(_0x0f13('0x2'));var transfers=require(_0x0f13('0x3'));var dispositions=[_0x0f13('0x4'),_0x0f13('0x5'),_0x0f13('0x5'),_0x0f13('0x4'),'NO\x20ANSWER',_0x0f13('0x4'),_0x0f13('0x6'),_0x0f13('0x7'),_0x0f13('0x5'),'FAILED',_0x0f13('0x5')];var channels={};function writeDB(_0x4d637f){var _0x40cade;if(transfers['blinds'][_0x4d637f[_0x0f13('0x8')]]){_0x40cade=_0x4d637f[_0x0f13('0x8')];_0x4d637f[_0x0f13('0x8')]=transfers[_0x0f13('0x9')][_0x4d637f[_0x0f13('0x8')]][_0x0f13('0xa')];}utils['info'](util['format'](_0x0f13('0xb'),_0x4d637f['uniqueid'],_0x4d637f[_0x0f13('0xc')],_0x4d637f[_0x0f13('0xd')],_0x4d637f[_0x0f13('0xe')],_0x4d637f['interface'],_0x4d637f[_0x0f13('0xf')],_0x4d637f[_0x0f13('0x10')],_0x4d637f[_0x0f13('0x11')]));if(_0x4d637f[_0x0f13('0x12')]){utils[_0x0f13('0x13')](_0x4d637f[_0x0f13('0x12')])['then'](function(_0x273e5f){if(_0x273e5f){_0x4d637f[_0x0f13('0x14')]=_0x273e5f['id'];}utils['request'](_0x0f13('0x15'),_0x4d637f);});}else{utils[_0x0f13('0x16')](_0x0f13('0x15'),_0x4d637f);}if(channels[_0x4d637f[_0x0f13('0x8')]]){delete channels[_0x4d637f[_0x0f13('0x8')]];}else if(_0x40cade&&channels[_0x40cade]){if(!transfers[_0x0f13('0x9')][_0x40cade][_0x0f13('0x17')])delete transfers[_0x0f13('0x9')][_0x40cade];delete channels[_0x40cade];}}exports['newchannel']=function(_0x2d3c7a){try{utils[_0x0f13('0x18')](util['format'](_0x0f13('0x19'),_0x2d3c7a['uniqueid']),_0x2d3c7a);if(_0x2d3c7a[_0x0f13('0x8')]==_0x2d3c7a[_0x0f13('0x1a')]&&_0x2d3c7a[_0x0f13('0xc')]!=_0x0f13('0x1b')){utils['info'](util['format'](_0x0f13('0x1c'),_0x2d3c7a[_0x0f13('0x8')],_0x2d3c7a[_0x0f13('0x1d')],_0x2d3c7a[_0x0f13('0x1e')]));channels[_0x2d3c7a[_0x0f13('0x8')]]={'uniqueid':_0x2d3c7a[_0x0f13('0x8')],'accountcode':_0x2d3c7a[_0x0f13('0x12')],'source':_0x2d3c7a[_0x0f13('0xf')],'destination':_0x2d3c7a[_0x0f13('0x1e')],'destinationcontext':_0x2d3c7a[_0x0f13('0x1d')],'channel':_0x2d3c7a['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0f13('0x4'),'amaflags':_0x0f13('0x1f')};}}catch(_0x860f0c){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x19'),_0x2d3c7a['uniqueid']),_0x860f0c);}};exports[_0x0f13('0x22')]=function(_0x1fae09){try{utils[_0x0f13('0x18')](util[_0x0f13('0x21')]('[%s][calls][newstate]',_0x1fae09[_0x0f13('0x8')]),_0x1fae09);if(!_['isNil'](channels[_0x1fae09[_0x0f13('0x8')]])&&_0x1fae09[_0x0f13('0x23')]==0x6){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x25'),_0x1fae09[_0x0f13('0x8')],_0x1fae09[_0x0f13('0x1d')],_0x1fae09[_0x0f13('0xc')]));if(_['isNil'](channels[_0x1fae09[_0x0f13('0x8')]]['systemanswertime'])){channels[_0x1fae09['uniqueid']]['systemanswertime']=utils[_0x0f13('0x26')]();}}else if(!_[_0x0f13('0x27')](channels[_0x1fae09[_0x0f13('0x1a')]])&&_0x1fae09['channelstate']==0x6&&_0x1fae09[_0x0f13('0x1d')]!=_0x0f13('0x28')){utils['info'](util['format'](_0x0f13('0x29'),_0x1fae09[_0x0f13('0x8')],_0x1fae09['linkedid'],_0x1fae09['context'],_0x1fae09[_0x0f13('0xc')]));channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x12')]=_0x1fae09[_0x0f13('0x12')];channels[_0x1fae09['linkedid']][_0x0f13('0x2a')]=_0x1fae09[_0x0f13('0xc')];if(_['isNil'](channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x2b')])){channels[_0x1fae09[_0x0f13('0x1a')]][_0x0f13('0x2b')]=utils[_0x0f13('0x26')]();}channels[_0x1fae09['linkedid']]['disposition']=dispositions[_['toNumber'](_0x1fae09[_0x0f13('0x23')])]||'ANSWERED';}}catch(_0x39c4db){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x2c'),_0x1fae09['uniqueid']),_0x39c4db);}};exports[_0x0f13('0x2d')]=function(_0x25d20f){try{if(!_[_0x0f13('0x27')](channels[_0x25d20f['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x2e'),_0x25d20f[_0x0f13('0x8')]),_0x25d20f);if(_[_0x0f13('0x27')](channels[_0x25d20f['uniqueid']][_0x0f13('0x2f')])){channels[_0x25d20f[_0x0f13('0x8')]]['callerid']=_0x25d20f['calleridname']+'\x20<'+_0x25d20f[_0x0f13('0xf')]+'>';}utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x30'),_0x25d20f['uniqueid'],channels[_0x25d20f[_0x0f13('0x8')]]['callerid'],_0x25d20f[_0x0f13('0x31')]));channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x32')]=utils[_0x0f13('0x26')]();channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x33')]=utils[_0x0f13('0x34')](channels[_0x25d20f['uniqueid']]['endtime'],channels[_0x25d20f[_0x0f13('0x8')]]['starttime']);channels[_0x25d20f[_0x0f13('0x8')]]['billableseconds']=channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x2b')]?utils[_0x0f13('0x34')](channels[_0x25d20f[_0x0f13('0x8')]]['endtime'],channels[_0x25d20f[_0x0f13('0x8')]][_0x0f13('0x2b')]):0x0;writeDB(channels[_0x25d20f['uniqueid']]);}}catch(_0x1c9507){utils[_0x0f13('0x20')](util['format']('[%s][calls][hangup]',_0x25d20f[_0x0f13('0x8')]),_0x1c9507);}};exports[_0x0f13('0x35')]=function(_0x21ec9d){try{if(!_[_0x0f13('0x27')](channels[_0x21ec9d[_0x0f13('0x36')]])){utils['debug'](util[_0x0f13('0x21')](_0x0f13('0x37'),_0x21ec9d['origtransfereruniqueid']),_0x21ec9d);if(channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0xc')]==_0x21ec9d[_0x0f13('0x38')]){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x21ec9d[_0x0f13('0x39')],_0x21ec9d[_0x0f13('0x36')],_0x21ec9d[_0x0f13('0x3a')]));channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x2a')]=_0x21ec9d[_0x0f13('0x3a')];channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x3b')]=_0x0f13('0x3c');}else if(channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0xc')]=_0x21ec9d['transfertargetchannel']){utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x3d'),_0x21ec9d[_0x0f13('0x39')],_0x21ec9d['localtwolinkedid'],_0x21ec9d[_0x0f13('0x3e')]));channels[_0x21ec9d[_0x0f13('0x36')]][_0x0f13('0x2a')]=_0x21ec9d[_0x0f13('0x3e')];channels[_0x21ec9d['localtwolinkedid']][_0x0f13('0x3b')]=_0x0f13('0x3c');}}}catch(_0x1609b5){utils[_0x0f13('0x20')](util['format'](_0x0f13('0x37'),_0x21ec9d[_0x0f13('0x39')]),_0x1609b5);}};exports['musiconholdstart']=function(_0x5cec9b){try{if(!_[_0x0f13('0x27')](channels[_0x5cec9b[_0x0f13('0x8')]])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x3f'),_0x5cec9b[_0x0f13('0x8')]),_0x5cec9b);channels[_0x5cec9b[_0x0f13('0x8')]]['musiconholdstartAt']=utils[_0x0f13('0x26')]();utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x40'),_0x5cec9b[_0x0f13('0x8')],channels[_0x5cec9b['uniqueid']][_0x0f13('0x41')]));}}catch(_0x57a20a){utils[_0x0f13('0x20')](util[_0x0f13('0x21')](_0x0f13('0x3f'),_0x5cec9b[_0x0f13('0x8')]),_0x57a20a);}};exports[_0x0f13('0x42')]=function(_0x15afc5){try{if(!_[_0x0f13('0x27')](channels[_0x15afc5['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x43'),_0x15afc5[_0x0f13('0x8')]),_0x15afc5);if(!_['isNil'](channels[_0x15afc5['uniqueid']][_0x0f13('0x41')])){channels[_0x15afc5['uniqueid']][_0x0f13('0x44')]+=utils[_0x0f13('0x34')](utils['now'](),channels[_0x15afc5[_0x0f13('0x8')]][_0x0f13('0x41')]);utils['info'](util[_0x0f13('0x21')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x15afc5[_0x0f13('0x8')],channels[_0x15afc5['uniqueid']][_0x0f13('0x44')]));delete channels[_0x15afc5[_0x0f13('0x8')]][_0x0f13('0x41')];}}}catch(_0x1597a0){utils['error'](util[_0x0f13('0x21')](_0x0f13('0x43'),_0x15afc5['uniqueid']),_0x1597a0);}};exports[_0x0f13('0x45')]=function(_0x1569c0){try{if(!_['isNil'](channels[_0x1569c0[_0x0f13('0x8')]])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')](_0x0f13('0x46'),_0x1569c0[_0x0f13('0x8')]),_0x1569c0);if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x48')])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x49'),_0x1569c0['uniqueid'],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x4b')]=_0x1569c0['value'];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmd-phone'])){utils['info'](util[_0x0f13('0x21')](_0x0f13('0x4c'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]]['destination']=_0x1569c0[_0x0f13('0x4a')];channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x2f')]='\x22'+_0x1569c0[_0x0f13('0x4a')]+_0x0f13('0x4d')+_0x1569c0[_0x0f13('0x4a')]+'>';}if(!_[_0x0f13('0x27')](_0x1569c0['variable']['xmd-callerid-preview'])||!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x4e')])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x4f'),_0x1569c0[_0x0f13('0x8')],!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x50')])?'xmd-callerid-preview':_0x0f13('0x4e'),_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0['uniqueid']][_0x0f13('0x2f')]=_0x1569c0[_0x0f13('0x4a')];}if(!_['isNil'](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x51')])||!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmcs-queue'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1569c0[_0x0f13('0x8')],!_[_0x0f13('0x27')](_0x1569c0['variable'][_0x0f13('0x51')])?_0x0f13('0x51'):_0x0f13('0x52'),_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x53')]=_0x0f13('0x54');channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x55')]=_0x1569c0[_0x0f13('0x4a')];channels[_0x1569c0[_0x0f13('0x8')]]['queue']=!![];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')][_0x0f13('0x56')])){utils['info'](util[_0x0f13('0x21')](_0x0f13('0x57'),_0x1569c0['uniqueid'],_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x58')]=_0x1569c0[_0x0f13('0x4a')];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['xmd-cdrtype'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')](_0x0f13('0x59'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5a')]=_0x1569c0[_0x0f13('0x4a')];}if(!_['isNil'](_0x1569c0[_0x0f13('0x47')]['outboundrouteid'])){utils[_0x0f13('0x24')](util[_0x0f13('0x21')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1569c0[_0x0f13('0x8')],_0x1569c0['value']));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5b')]=_0x1569c0[_0x0f13('0x4a')];}if(!_[_0x0f13('0x27')](_0x1569c0[_0x0f13('0x47')]['sipcallid'])){utils[_0x0f13('0x24')](util['format'](_0x0f13('0x5c'),_0x1569c0[_0x0f13('0x8')],_0x1569c0[_0x0f13('0x4a')]));channels[_0x1569c0[_0x0f13('0x8')]][_0x0f13('0x5d')]=_0x1569c0[_0x0f13('0x4a')];}}}catch(_0x14c221){utils[_0x0f13('0x20')](util['format']('[%s][calls][varset]',_0x1569c0['uniqueid']),_0x14c221);}};exports[_0x0f13('0x5e')]=function(_0x166ed4){try{if(!_[_0x0f13('0x27')](channels[_0x166ed4['uniqueid']])){utils[_0x0f13('0x18')](util[_0x0f13('0x21')]('[%s][calls][newexten]',_0x166ed4[_0x0f13('0x8')]),_0x166ed4);utils['info'](util['format'](_0x0f13('0x5f'),_0x166ed4[_0x0f13('0x8')],_0x166ed4[_0x0f13('0x60')],_0x166ed4[_0x0f13('0x61')]));if(_0x166ed4[_0x0f13('0x60')][_0x0f13('0x62')]()=='set'&&_[_0x0f13('0x63')](_0x166ed4[_0x0f13('0x61')][_0x0f13('0x62')](),_0x0f13('0x64'))){var _0x485c3b=_0x166ed4[_0x0f13('0x61')][_0x0f13('0x65')]('=');var _0xc28470=_0x485c3b[0x0][_0x0f13('0x66')](_0x485c3b[0x0][_0x0f13('0x67')]('(')+0x1,_0x485c3b[0x0][_0x0f13('0x67')](')'));var _0x1eb7f9=_0x485c3b[0x1];channels[_0x166ed4[_0x0f13('0x8')]][_0xc28470]=_0x1eb7f9;}if(!_[_0x0f13('0x68')]([_0x0f13('0x2d'),'noop',_0x0f13('0x69'),_0x0f13('0x6a'),_0x0f13('0x6b')],_0x166ed4['application'][_0x0f13('0x62')]())){channels[_0x166ed4['uniqueid']]['lastapplication']=_0x166ed4['application'];channels[_0x166ed4[_0x0f13('0x8')]]['lastdata']=_0x166ed4[_0x0f13('0x61')];}}}catch(_0x563933){utils[_0x0f13('0x20')](util['format'](_0x0f13('0x6c'),_0x166ed4[_0x0f13('0x8')]),_0x563933);}}; \ No newline at end of file +var _0x6faf=['[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','blinds','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','info','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','starttime','billableseconds','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime'];(function(_0x5e8fd3,_0x3a04c4){var _0x3328e9=function(_0x34cecc){while(--_0x34cecc){_0x5e8fd3['push'](_0x5e8fd3['shift']());}};_0x3328e9(++_0x3a04c4);}(_0x6faf,0xf9));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var utils=require(_0xf6fa('0x1'));var transfers=require(_0xf6fa('0x2'));var dispositions=[_0xf6fa('0x3'),_0xf6fa('0x4'),_0xf6fa('0x4'),'NO\x20ANSWER',_0xf6fa('0x3'),'NO\x20ANSWER',_0xf6fa('0x5'),'BUSY',_0xf6fa('0x4'),_0xf6fa('0x4'),_0xf6fa('0x4')];var channels={};function writeDB(_0x1ac55e){var _0x2de713;if(transfers['blinds'][_0x1ac55e[_0xf6fa('0x6')]]){_0x2de713=_0x1ac55e[_0xf6fa('0x6')];_0x1ac55e[_0xf6fa('0x6')]=transfers['blinds'][_0x1ac55e['uniqueid']][_0xf6fa('0x7')];}utils['info'](util[_0xf6fa('0x8')](_0xf6fa('0x9'),_0x1ac55e['uniqueid'],_0x1ac55e[_0xf6fa('0xa')],_0x1ac55e['queue'],_0x1ac55e[_0xf6fa('0xb')],_0x1ac55e['interface'],_0x1ac55e['calleridnum'],_0x1ac55e['connectedlinenum'],_0x1ac55e[_0xf6fa('0xc')]));if(_0x1ac55e[_0xf6fa('0xd')]){utils[_0xf6fa('0xe')](_0x1ac55e[_0xf6fa('0xd')])[_0xf6fa('0xf')](function(_0x2c55ee){if(_0x2c55ee){_0x1ac55e[_0xf6fa('0x10')]=_0x2c55ee['id'];}utils[_0xf6fa('0x11')](_0xf6fa('0x12'),_0x1ac55e);});}else{utils[_0xf6fa('0x11')](_0xf6fa('0x12'),_0x1ac55e);}if(channels[_0x1ac55e['uniqueid']]){delete channels[_0x1ac55e[_0xf6fa('0x6')]];}else if(_0x2de713&&channels[_0x2de713]){if(!transfers[_0xf6fa('0x13')][_0x2de713]['recording'])delete transfers[_0xf6fa('0x13')][_0x2de713];delete channels[_0x2de713];}}exports[_0xf6fa('0x14')]=function(_0x1e9f42){try{utils['debug'](util[_0xf6fa('0x8')](_0xf6fa('0x15'),_0x1e9f42[_0xf6fa('0x6')]),_0x1e9f42);if(_0x1e9f42[_0xf6fa('0x6')]==_0x1e9f42[_0xf6fa('0x16')]&&_0x1e9f42['channel']!=_0xf6fa('0x17')){utils['info'](util[_0xf6fa('0x8')](_0xf6fa('0x18'),_0x1e9f42[_0xf6fa('0x6')],_0x1e9f42['context'],_0x1e9f42[_0xf6fa('0x19')]));channels[_0x1e9f42[_0xf6fa('0x6')]]={'uniqueid':_0x1e9f42[_0xf6fa('0x6')],'accountcode':_0x1e9f42[_0xf6fa('0xd')],'source':_0x1e9f42[_0xf6fa('0x1a')],'destination':_0x1e9f42[_0xf6fa('0x19')],'destinationcontext':_0x1e9f42[_0xf6fa('0x1b')],'channel':_0x1e9f42[_0xf6fa('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xf6fa('0x1c')};}}catch(_0x4ebcd3){utils[_0xf6fa('0x1d')](util['format']('[%s][calls][newchannel]',_0x1e9f42['uniqueid']),_0x4ebcd3);}};exports['newstate']=function(_0x53caf6){try{utils[_0xf6fa('0x1e')](util[_0xf6fa('0x8')](_0xf6fa('0x1f'),_0x53caf6[_0xf6fa('0x6')]),_0x53caf6);if(!_[_0xf6fa('0x20')](channels[_0x53caf6[_0xf6fa('0x6')]])&&_0x53caf6[_0xf6fa('0x21')]==0x6){utils['info'](util[_0xf6fa('0x8')](_0xf6fa('0x22'),_0x53caf6[_0xf6fa('0x6')],_0x53caf6['context'],_0x53caf6[_0xf6fa('0xa')]));if(_[_0xf6fa('0x20')](channels[_0x53caf6[_0xf6fa('0x6')]][_0xf6fa('0x23')])){channels[_0x53caf6[_0xf6fa('0x6')]][_0xf6fa('0x23')]=utils[_0xf6fa('0x24')]();}}else if(!_['isNil'](channels[_0x53caf6[_0xf6fa('0x16')]])&&_0x53caf6[_0xf6fa('0x21')]==0x6&&_0x53caf6[_0xf6fa('0x1b')]!='transfer'){utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')](_0xf6fa('0x26'),_0x53caf6['uniqueid'],_0x53caf6[_0xf6fa('0x16')],_0x53caf6[_0xf6fa('0x1b')],_0x53caf6[_0xf6fa('0xa')]));channels[_0x53caf6['linkedid']]['accountcode']=_0x53caf6[_0xf6fa('0xd')];channels[_0x53caf6[_0xf6fa('0x16')]][_0xf6fa('0x27')]=_0x53caf6[_0xf6fa('0xa')];if(_[_0xf6fa('0x20')](channels[_0x53caf6[_0xf6fa('0x16')]][_0xf6fa('0x28')])){channels[_0x53caf6[_0xf6fa('0x16')]][_0xf6fa('0x28')]=utils['now']();}channels[_0x53caf6[_0xf6fa('0x16')]][_0xf6fa('0x29')]=dispositions[_[_0xf6fa('0x2a')](_0x53caf6['channelstate'])]||_0xf6fa('0x5');}}catch(_0x395ee9){utils['error'](util[_0xf6fa('0x8')](_0xf6fa('0x1f'),_0x53caf6[_0xf6fa('0x6')]),_0x395ee9);}};exports[_0xf6fa('0x2b')]=function(_0x38a345){try{if(!_[_0xf6fa('0x20')](channels[_0x38a345[_0xf6fa('0x6')]])){utils['debug'](util[_0xf6fa('0x8')](_0xf6fa('0x2c'),_0x38a345[_0xf6fa('0x6')]),_0x38a345);if(_[_0xf6fa('0x20')](channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x2d')])){channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x2d')]=_0x38a345[_0xf6fa('0x2e')]+'\x20<'+_0x38a345[_0xf6fa('0x1a')]+'>';}utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')](_0xf6fa('0x2f'),_0x38a345['uniqueid'],channels[_0x38a345['uniqueid']][_0xf6fa('0x2d')],_0x38a345['cause-txt']));channels[_0x38a345['uniqueid']]['endtime']=utils[_0xf6fa('0x24')]();channels[_0x38a345['uniqueid']][_0xf6fa('0x30')]=utils[_0xf6fa('0x31')](channels[_0x38a345['uniqueid']]['endtime'],channels[_0x38a345['uniqueid']][_0xf6fa('0x32')]);channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x33')]=channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x28')]?utils[_0xf6fa('0x31')](channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x34')],channels[_0x38a345[_0xf6fa('0x6')]][_0xf6fa('0x28')]):0x0;writeDB(channels[_0x38a345['uniqueid']]);}}catch(_0x1be856){utils['error'](util['format'](_0xf6fa('0x2c'),_0x38a345[_0xf6fa('0x6')]),_0x1be856);}};exports[_0xf6fa('0x35')]=function(_0x16e9e7){try{if(!_[_0xf6fa('0x20')](channels[_0x16e9e7[_0xf6fa('0x36')]])){utils[_0xf6fa('0x1e')](util[_0xf6fa('0x8')](_0xf6fa('0x37'),_0x16e9e7['origtransfereruniqueid']),_0x16e9e7);if(channels[_0x16e9e7[_0xf6fa('0x36')]][_0xf6fa('0xa')]==_0x16e9e7[_0xf6fa('0x38')]){utils['info'](util[_0xf6fa('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x16e9e7[_0xf6fa('0x39')],_0x16e9e7['localtwolinkedid'],_0x16e9e7[_0xf6fa('0x3a')]));channels[_0x16e9e7[_0xf6fa('0x36')]][_0xf6fa('0x27')]=_0x16e9e7[_0xf6fa('0x3a')];channels[_0x16e9e7[_0xf6fa('0x36')]]['userfield']=_0xf6fa('0x3b');}else if(channels[_0x16e9e7[_0xf6fa('0x36')]]['channel']=_0x16e9e7[_0xf6fa('0x3c')]){utils[_0xf6fa('0x25')](util['format'](_0xf6fa('0x3d'),_0x16e9e7[_0xf6fa('0x39')],_0x16e9e7[_0xf6fa('0x36')],_0x16e9e7['origtransfererchannel']));channels[_0x16e9e7['localtwolinkedid']][_0xf6fa('0x27')]=_0x16e9e7[_0xf6fa('0x3e')];channels[_0x16e9e7[_0xf6fa('0x36')]][_0xf6fa('0x3f')]=_0xf6fa('0x3b');}}}catch(_0x9de298){utils[_0xf6fa('0x1d')](util['format'](_0xf6fa('0x37'),_0x16e9e7[_0xf6fa('0x39')]),_0x9de298);}};exports['musiconholdstart']=function(_0x2033a3){try{if(!_[_0xf6fa('0x20')](channels[_0x2033a3[_0xf6fa('0x6')]])){utils[_0xf6fa('0x1e')](util[_0xf6fa('0x8')](_0xf6fa('0x40'),_0x2033a3['uniqueid']),_0x2033a3);channels[_0x2033a3['uniqueid']][_0xf6fa('0x41')]=utils['now']();utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2033a3[_0xf6fa('0x6')],channels[_0x2033a3['uniqueid']][_0xf6fa('0x41')]));}}catch(_0x336a19){utils[_0xf6fa('0x1d')](util[_0xf6fa('0x8')](_0xf6fa('0x40'),_0x2033a3[_0xf6fa('0x6')]),_0x336a19);}};exports[_0xf6fa('0x42')]=function(_0x4a8ae1){try{if(!_['isNil'](channels[_0x4a8ae1[_0xf6fa('0x6')]])){utils[_0xf6fa('0x1e')](util[_0xf6fa('0x8')](_0xf6fa('0x43'),_0x4a8ae1[_0xf6fa('0x6')]),_0x4a8ae1);if(!_[_0xf6fa('0x20')](channels[_0x4a8ae1[_0xf6fa('0x6')]]['musiconholdstartAt'])){channels[_0x4a8ae1[_0xf6fa('0x6')]][_0xf6fa('0x44')]+=utils['diffTime'](utils[_0xf6fa('0x24')](),channels[_0x4a8ae1[_0xf6fa('0x6')]]['musiconholdstartAt']);utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')](_0xf6fa('0x45'),_0x4a8ae1[_0xf6fa('0x6')],channels[_0x4a8ae1['uniqueid']][_0xf6fa('0x44')]));delete channels[_0x4a8ae1['uniqueid']][_0xf6fa('0x41')];}}}catch(_0x31168e){utils['error'](util[_0xf6fa('0x8')]('[%s][calls][musiconholdstop]',_0x4a8ae1[_0xf6fa('0x6')]),_0x31168e);}};exports['varset']=function(_0x33aad0){try{if(!_['isNil'](channels[_0x33aad0[_0xf6fa('0x6')]])){utils['debug'](util[_0xf6fa('0x8')](_0xf6fa('0x46'),_0x33aad0[_0xf6fa('0x6')]),_0x33aad0);if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')]['xmd-originatecalleridnum'])){utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x33aad0[_0xf6fa('0x6')],_0x33aad0['value']));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x48')]=_0x33aad0[_0xf6fa('0x49')];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')][_0xf6fa('0x4a')])){utils['info'](util['format'](_0xf6fa('0x4b'),_0x33aad0['uniqueid'],_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x4c')]=_0x33aad0['value'];channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x2d')]='\x22'+_0x33aad0[_0xf6fa('0x49')]+_0xf6fa('0x4d')+_0x33aad0[_0xf6fa('0x49')]+'>';}if(!_[_0xf6fa('0x20')](_0x33aad0['variable']['xmd-callerid-preview'])||!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')][_0xf6fa('0x4e')])){utils[_0xf6fa('0x25')](util['format'](_0xf6fa('0x4f'),_0x33aad0[_0xf6fa('0x6')],!_['isNil'](_0x33aad0[_0xf6fa('0x47')][_0xf6fa('0x50')])?_0xf6fa('0x50'):_0xf6fa('0x4e'),_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x2d')]=_0x33aad0['value'];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')]['xmd-queue'])||!_[_0xf6fa('0x20')](_0x33aad0['variable']['xmcs-queue'])){utils['info'](util['format'](_0xf6fa('0x4f'),_0x33aad0[_0xf6fa('0x6')],!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')]['xmd-queue'])?_0xf6fa('0x51'):_0xf6fa('0x52'),_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0['uniqueid']][_0xf6fa('0x53')]=_0xf6fa('0x54');channels[_0x33aad0[_0xf6fa('0x6')]]['lastdata']=_0x33aad0[_0xf6fa('0x49')];channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x55')]=!![];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')]['xmd-contactid'])){utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')](_0xf6fa('0x56'),_0x33aad0[_0xf6fa('0x6')],_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0['uniqueid']]['ContactId']=_0x33aad0[_0xf6fa('0x49')];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')][_0xf6fa('0x57')])){utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')](_0xf6fa('0x58'),_0x33aad0[_0xf6fa('0x6')],_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x59')]=_0x33aad0[_0xf6fa('0x49')];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')][_0xf6fa('0x5a')])){utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x33aad0['uniqueid'],_0x33aad0['value']));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x5b')]=_0x33aad0[_0xf6fa('0x49')];}if(!_[_0xf6fa('0x20')](_0x33aad0[_0xf6fa('0x47')]['sipcallid'])){utils[_0xf6fa('0x25')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x33aad0['uniqueid'],_0x33aad0[_0xf6fa('0x49')]));channels[_0x33aad0[_0xf6fa('0x6')]][_0xf6fa('0x5c')]=_0x33aad0[_0xf6fa('0x49')];}}}catch(_0x22cc76){utils[_0xf6fa('0x1d')](util[_0xf6fa('0x8')](_0xf6fa('0x46'),_0x33aad0[_0xf6fa('0x6')]),_0x22cc76);}};exports[_0xf6fa('0x5d')]=function(_0x3c04b2){try{if(!_[_0xf6fa('0x20')](channels[_0x3c04b2[_0xf6fa('0x6')]])){utils[_0xf6fa('0x1e')](util[_0xf6fa('0x8')](_0xf6fa('0x5e'),_0x3c04b2['uniqueid']),_0x3c04b2);utils[_0xf6fa('0x25')](util[_0xf6fa('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3c04b2[_0xf6fa('0x6')],_0x3c04b2[_0xf6fa('0x5f')],_0x3c04b2[_0xf6fa('0x60')]));if(_0x3c04b2[_0xf6fa('0x5f')][_0xf6fa('0x61')]()=='set'&&_['startsWith'](_0x3c04b2[_0xf6fa('0x60')][_0xf6fa('0x61')](),_0xf6fa('0x62'))){var _0x59c0ff=_0x3c04b2[_0xf6fa('0x60')]['split']('=');var _0x548127=_0x59c0ff[0x0][_0xf6fa('0x63')](_0x59c0ff[0x0][_0xf6fa('0x64')]('(')+0x1,_0x59c0ff[0x0][_0xf6fa('0x64')](')'));var _0x382ec4=_0x59c0ff[0x1];channels[_0x3c04b2[_0xf6fa('0x6')]][_0x548127]=_0x382ec4;}if(!_[_0xf6fa('0x65')]([_0xf6fa('0x2b'),_0xf6fa('0x66'),_0xf6fa('0x67'),_0xf6fa('0x68'),_0xf6fa('0x69')],_0x3c04b2[_0xf6fa('0x5f')][_0xf6fa('0x61')]())){channels[_0x3c04b2['uniqueid']][_0xf6fa('0x53')]=_0x3c04b2[_0xf6fa('0x5f')];channels[_0x3c04b2[_0xf6fa('0x6')]]['lastdata']=_0x3c04b2['appdata'];}}}catch(_0x2141b3){utils[_0xf6fa('0x1d')](util['format']('[%s][calls][newexten]',_0x3c04b2[_0xf6fa('0x6')]),_0x2141b3);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8b04818..2e754f9 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 _0x3feb=['error','close','[core]\x20close','managerevent','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x19da8c,_0x5c2246){var _0x51708b=function(_0x24276a){while(--_0x24276a){_0x19da8c['push'](_0x19da8c['shift']());}};_0x51708b(++_0x5c2246);}(_0x3feb,0xf4));var _0xb3fe=function(_0x963557,_0xcd95cb){_0x963557=_0x963557-0x0;var _0x3d07eb=_0x3feb[_0x963557];return _0x3d07eb;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xb3fe('0x0')](_0xb3fe('0x1'));};exports['shutdown']=function(){utils[_0xb3fe('0x0')](_0xb3fe('0x2'));};exports['fullybooted']=function(){utils['info'](_0xb3fe('0x3'));};exports[_0xb3fe('0x4')]=function(_0x2af11f){utils['error']('[core]\x20error',_0x2af11f);};exports[_0xb3fe('0x5')]=function(){utils['info'](_0xb3fe('0x6'));};exports[_0xb3fe('0x7')]=function(_0x322632){}; \ No newline at end of file +var _0x7f05=['./utils','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7f05,0xdc));var _0x57f0=function(_0x85ac1f,_0xe184e8){_0x85ac1f=_0x85ac1f-0x0;var _0x1e7c27=_0x7f05[_0x85ac1f];return _0x1e7c27;};'use strict';var utils=require(_0x57f0('0x0'));exports[_0x57f0('0x1')]=function(){utils[_0x57f0('0x2')]('[core]\x20connected');};exports[_0x57f0('0x3')]=function(){utils['info'](_0x57f0('0x4'));};exports[_0x57f0('0x5')]=function(){utils['info'](_0x57f0('0x6'));};exports[_0x57f0('0x7')]=function(_0x4c3a58){utils[_0x57f0('0x7')](_0x57f0('0x8'),_0x4c3a58);};exports['close']=function(){utils[_0x57f0('0x2')](_0x57f0('0x9'));};exports[_0x57f0('0xa')]=function(_0x55d417){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b57568c..c7135ca 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 _0x8bb1=['varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','util','./utils','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','toLowerCase','set','startsWith','cdr(routeid)','split','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8bb1,0xeb));var _0x18bb=function(_0x55881e,_0x245b4d){_0x55881e=_0x55881e-0x0;var _0x5cc48e=_0x8bb1[_0x55881e];return _0x5cc48e;};'use strict';var _=require('lodash');var util=require(_0x18bb('0x0'));var utils=require(_0x18bb('0x1'));var dials={};function writeDB(_0x1a6b25){utils[_0x18bb('0x2')](util[_0x18bb('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1a6b25[_0x18bb('0x4')],_0x1a6b25[_0x18bb('0x5')],_0x1a6b25[_0x18bb('0x6')],_0x1a6b25['calleridnum'],_0x1a6b25[_0x18bb('0x7')],_0x1a6b25[_0x18bb('0x8')]));utils['request'](_0x18bb('0x9'),_0x1a6b25);delete dials[_0x1a6b25[_0x18bb('0x4')]];}exports[_0x18bb('0xa')]=function(_0x2c8286){try{utils[_0x18bb('0xb')](util['format'](_0x18bb('0xc'),_0x2c8286[_0x18bb('0x4')]),_0x2c8286);utils[_0x18bb('0x2')](util[_0x18bb('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2c8286[_0x18bb('0x4')],_0x2c8286[_0x18bb('0xd')],_0x2c8286['appdata']));if(_0x2c8286[_0x18bb('0xd')][_0x18bb('0xe')]()==_0x18bb('0xf')&&_[_0x18bb('0x10')](_0x2c8286['appdata'][_0x18bb('0xe')](),_0x18bb('0x11'))){var _0x5cbdfb=_0x2c8286['appdata'][_0x18bb('0x12')]('=');dials[_0x2c8286[_0x18bb('0x4')]]={'routeId':_0x5cbdfb[0x1]};}}catch(_0x5559f9){utils[_0x18bb('0x13')](util[_0x18bb('0x3')]('[%s][dials][newexten]',_0x2c8286[_0x18bb('0x4')]),_0x5559f9);}};exports[_0x18bb('0x14')]=function(_0x52828f){try{utils['debug'](util[_0x18bb('0x3')](_0x18bb('0x15'),_0x52828f[_0x18bb('0x4')]),_0x52828f);if(!_[_0x18bb('0x16')](_0x52828f[_0x18bb('0x17')]['outboundrouteid'])){utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x18'),_0x52828f[_0x18bb('0x4')],_0x52828f[_0x18bb('0x19')]));dials[_0x52828f['uniqueid']]={'routeId':_0x52828f[_0x18bb('0x19')]};}}catch(_0x44d72c){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x15'),_0x52828f[_0x18bb('0x4')]),_0x44d72c);}};exports['dialbegin']=function(_0x1fdebf){try{if(!_[_0x18bb('0x16')](dials[_0x1fdebf[_0x18bb('0x4')]])){utils[_0x18bb('0xb')](util[_0x18bb('0x3')](_0x18bb('0x1a'),_0x1fdebf[_0x18bb('0x4')]),_0x1fdebf);dials[_0x1fdebf[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x1fdebf[_0x18bb('0x4')]],_0x1fdebf);dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1c')]=utils[_0x18bb('0x1d')]();dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1e')]=_0x18bb('0x1f');utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x20'),_0x1fdebf[_0x18bb('0x4')],dials[_0x1fdebf[_0x18bb('0x4')]][_0x18bb('0x1c')]));}}catch(_0x24d8f9){utils[_0x18bb('0x13')](util[_0x18bb('0x3')]('[%s][dials][dialbegin]',_0x1fdebf['uniqueid']),_0x24d8f9);}};exports[_0x18bb('0x21')]=function(_0x102bde){try{if(!_[_0x18bb('0x16')](dials[_0x102bde[_0x18bb('0x4')]])){utils['debug'](util['format'](_0x18bb('0x22'),_0x102bde[_0x18bb('0x4')]),_0x102bde);dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x8')]=_0x102bde[_0x18bb('0x8')];if(_0x102bde[_0x18bb('0x8')]==_0x18bb('0x23')){dials[_0x102bde[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x102bde[_0x18bb('0x4')]],_0x102bde);dials[_0x102bde['uniqueid']][_0x18bb('0x24')]=utils[_0x18bb('0x1d')]();dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x1e')]=_0x18bb('0x25');utils['info'](util[_0x18bb('0x3')](_0x18bb('0x26'),_0x102bde[_0x18bb('0x4')],_0x102bde[_0x18bb('0x8')],dials[_0x102bde[_0x18bb('0x4')]][_0x18bb('0x24')]));}else{utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x27'),_0x102bde[_0x18bb('0x4')],_0x102bde[_0x18bb('0x8')]));}}}catch(_0x362482){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x22'),_0x102bde[_0x18bb('0x4')]),_0x362482);}};exports[_0x18bb('0x28')]=function(_0x58742e){try{if(!_[_0x18bb('0x16')](dials[_0x58742e['uniqueid']])){utils['debug'](util['format'](_0x18bb('0x29'),_0x58742e['uniqueid']),_0x58742e);utils[_0x18bb('0x2')](util[_0x18bb('0x3')](_0x18bb('0x2a'),_0x58742e[_0x18bb('0x4')],_0x58742e[_0x18bb('0x2b')],_0x58742e[_0x18bb('0x2c')],_0x58742e[_0x18bb('0x2d')]));dials[_0x58742e[_0x18bb('0x4')]]=_[_0x18bb('0x1b')](dials[_0x58742e[_0x18bb('0x4')]],{'endtime':utils[_0x18bb('0x1d')](),'lastevent':_0x18bb('0x2e')});dials[_0x58742e['uniqueid']][_0x18bb('0x2f')]=utils[_0x18bb('0x30')](dials[_0x58742e['uniqueid']][_0x18bb('0x31')],dials[_0x58742e['uniqueid']]['starttime']);dials[_0x58742e['uniqueid']][_0x18bb('0x32')]=utils['diffTime'](dials[_0x58742e[_0x18bb('0x4')]]['answertime']||dials[_0x58742e['uniqueid']][_0x18bb('0x31')],dials[_0x58742e['uniqueid']][_0x18bb('0x1c')]);dials[_0x58742e[_0x18bb('0x4')]]['billableseconds']=dials[_0x58742e[_0x18bb('0x4')]]['answertime']?utils[_0x18bb('0x30')](dials[_0x58742e[_0x18bb('0x4')]][_0x18bb('0x31')],dials[_0x58742e['uniqueid']][_0x18bb('0x24')]):0x0;writeDB(dials[_0x58742e[_0x18bb('0x4')]]);}}catch(_0x4dbcc2){utils[_0x18bb('0x13')](util[_0x18bb('0x3')](_0x18bb('0x29'),_0x58742e[_0x18bb('0x4')]),_0x4dbcc2);}}; \ No newline at end of file +var _0xa1a6=['assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','error','varset','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xa1a6,0x1ac));var _0x6a1a=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0xa1a6[_0x3b0c9d];return _0xcfc8d7;};'use strict';var _=require('lodash');var util=require(_0x6a1a('0x0'));var utils=require(_0x6a1a('0x1'));var dials={};function writeDB(_0x8dfde7){utils[_0x6a1a('0x2')](util[_0x6a1a('0x3')](_0x6a1a('0x4'),_0x8dfde7[_0x6a1a('0x5')],_0x8dfde7[_0x6a1a('0x6')],_0x8dfde7[_0x6a1a('0x7')],_0x8dfde7[_0x6a1a('0x8')],_0x8dfde7['connectedlinenum'],_0x8dfde7[_0x6a1a('0x9')]));utils[_0x6a1a('0xa')](_0x6a1a('0xb'),_0x8dfde7);delete dials[_0x8dfde7[_0x6a1a('0x5')]];}exports[_0x6a1a('0xc')]=function(_0x4852a8){try{utils['debug'](util[_0x6a1a('0x3')](_0x6a1a('0xd'),_0x4852a8[_0x6a1a('0x5')]),_0x4852a8);utils[_0x6a1a('0x2')](util[_0x6a1a('0x3')](_0x6a1a('0xe'),_0x4852a8[_0x6a1a('0x5')],_0x4852a8['application'],_0x4852a8[_0x6a1a('0xf')]));if(_0x4852a8[_0x6a1a('0x10')]['toLowerCase']()==_0x6a1a('0x11')&&_[_0x6a1a('0x12')](_0x4852a8[_0x6a1a('0xf')][_0x6a1a('0x13')](),'cdr(routeid)')){var _0x1cf71c=_0x4852a8[_0x6a1a('0xf')]['split']('=');dials[_0x4852a8['uniqueid']]={'routeId':_0x1cf71c[0x1]};}}catch(_0x5f268e){utils[_0x6a1a('0x14')](util[_0x6a1a('0x3')]('[%s][dials][newexten]',_0x4852a8['uniqueid']),_0x5f268e);}};exports[_0x6a1a('0x15')]=function(_0x31662e){try{utils[_0x6a1a('0x16')](util['format']('[%s][dials][varset]',_0x31662e[_0x6a1a('0x5')]),_0x31662e);if(!_[_0x6a1a('0x17')](_0x31662e[_0x6a1a('0x18')][_0x6a1a('0x19')])){utils['info'](util['format'](_0x6a1a('0x1a'),_0x31662e['uniqueid'],_0x31662e[_0x6a1a('0x1b')]));dials[_0x31662e[_0x6a1a('0x5')]]={'routeId':_0x31662e[_0x6a1a('0x1b')]};}}catch(_0x470b84){utils[_0x6a1a('0x14')](util[_0x6a1a('0x3')](_0x6a1a('0x1c'),_0x31662e[_0x6a1a('0x5')]),_0x470b84);}};exports[_0x6a1a('0x1d')]=function(_0x59df2e){try{if(!_[_0x6a1a('0x17')](dials[_0x59df2e['uniqueid']])){utils[_0x6a1a('0x16')](util[_0x6a1a('0x3')](_0x6a1a('0x1e'),_0x59df2e[_0x6a1a('0x5')]),_0x59df2e);dials[_0x59df2e[_0x6a1a('0x5')]]=_[_0x6a1a('0x1f')](dials[_0x59df2e[_0x6a1a('0x5')]],_0x59df2e);dials[_0x59df2e[_0x6a1a('0x5')]][_0x6a1a('0x20')]=utils[_0x6a1a('0x21')]();dials[_0x59df2e['uniqueid']][_0x6a1a('0x22')]='called';utils[_0x6a1a('0x2')](util['format'](_0x6a1a('0x23'),_0x59df2e[_0x6a1a('0x5')],dials[_0x59df2e[_0x6a1a('0x5')]]['starttime']));}}catch(_0x18ae81){utils[_0x6a1a('0x14')](util['format']('[%s][dials][dialbegin]',_0x59df2e[_0x6a1a('0x5')]),_0x18ae81);}};exports[_0x6a1a('0x24')]=function(_0x28ca89){try{if(!_[_0x6a1a('0x17')](dials[_0x28ca89[_0x6a1a('0x5')]])){utils[_0x6a1a('0x16')](util['format'](_0x6a1a('0x25'),_0x28ca89['uniqueid']),_0x28ca89);dials[_0x28ca89['uniqueid']]['dialstatus']=_0x28ca89[_0x6a1a('0x9')];if(_0x28ca89[_0x6a1a('0x9')]=='ANSWER'){dials[_0x28ca89[_0x6a1a('0x5')]]=_[_0x6a1a('0x1f')](dials[_0x28ca89[_0x6a1a('0x5')]],_0x28ca89);dials[_0x28ca89[_0x6a1a('0x5')]][_0x6a1a('0x26')]=utils[_0x6a1a('0x21')]();dials[_0x28ca89[_0x6a1a('0x5')]]['lastevent']=_0x6a1a('0x27');utils[_0x6a1a('0x2')](util[_0x6a1a('0x3')](_0x6a1a('0x28'),_0x28ca89[_0x6a1a('0x5')],_0x28ca89[_0x6a1a('0x9')],dials[_0x28ca89[_0x6a1a('0x5')]][_0x6a1a('0x26')]));}else{utils[_0x6a1a('0x2')](util[_0x6a1a('0x3')](_0x6a1a('0x29'),_0x28ca89[_0x6a1a('0x5')],_0x28ca89[_0x6a1a('0x9')]));}}}catch(_0x4fb851){utils[_0x6a1a('0x14')](util[_0x6a1a('0x3')](_0x6a1a('0x25'),_0x28ca89[_0x6a1a('0x5')]),_0x4fb851);}};exports['hangup']=function(_0x2fcbe0){try{if(!_[_0x6a1a('0x17')](dials[_0x2fcbe0[_0x6a1a('0x5')]])){utils[_0x6a1a('0x16')](util['format'](_0x6a1a('0x2a'),_0x2fcbe0[_0x6a1a('0x5')]),_0x2fcbe0);utils['info'](util[_0x6a1a('0x3')](_0x6a1a('0x2b'),_0x2fcbe0[_0x6a1a('0x5')],_0x2fcbe0[_0x6a1a('0x8')],_0x2fcbe0[_0x6a1a('0x2c')],_0x2fcbe0[_0x6a1a('0x2d')]));dials[_0x2fcbe0[_0x6a1a('0x5')]]=_[_0x6a1a('0x1f')](dials[_0x2fcbe0[_0x6a1a('0x5')]],{'endtime':utils[_0x6a1a('0x21')](),'lastevent':_0x6a1a('0x2e')});dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x2f')]=utils[_0x6a1a('0x30')](dials[_0x2fcbe0['uniqueid']][_0x6a1a('0x31')],dials[_0x2fcbe0[_0x6a1a('0x5')]]['starttime']);dials[_0x2fcbe0['uniqueid']]['holdtime']=utils[_0x6a1a('0x30')](dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x26')]||dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x31')],dials[_0x2fcbe0[_0x6a1a('0x5')]]['starttime']);dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x32')]=dials[_0x2fcbe0['uniqueid']]['answertime']?utils[_0x6a1a('0x30')](dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x31')],dials[_0x2fcbe0[_0x6a1a('0x5')]][_0x6a1a('0x26')]):0x0;writeDB(dials[_0x2fcbe0['uniqueid']]);}}catch(_0x23b078){utils[_0x6a1a('0x14')](util[_0x6a1a('0x3')](_0x6a1a('0x2a'),_0x2fcbe0[_0x6a1a('0x5')]),_0x23b078);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a552782..113cb00 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 _0x1f51=['info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','password'];(function(_0x324cda,_0x399192){var _0x370f58=function(_0x466754){while(--_0x466754){_0x324cda['push'](_0x324cda['shift']());}};_0x370f58(++_0x399192);}(_0x1f51,0x14e));var _0x11f5=function(_0x3d494e,_0x332f20){_0x3d494e=_0x3d494e-0x0;var _0x2081bb=_0x1f51[_0x3d494e];return _0x2081bb;};var AsteriskManager=require(_0x11f5('0x0'));var config=require(_0x11f5('0x1'));var utils=require(_0x11f5('0x2'));var util=require(_0x11f5('0x3'));var isXDREnabled=config['xdr']&&config[_0x11f5('0x4')][_0x11f5('0x5')]?!config[_0x11f5('0x4')][_0x11f5('0x5')]:!![];var isProduction=config[_0x11f5('0x6')]==='production'||![];var isLocalAsterisk=config[_0x11f5('0x4')]&&config[_0x11f5('0x4')][_0x11f5('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x11f5('0x8')][_0x11f5('0x9')],config['asterisk']['ip'],config['asterisk']['username'],config[_0x11f5('0x8')][_0x11f5('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x11f5('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x11f5('0xb')](_0x11f5('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x11f5('0xd'));var queues=require(_0x11f5('0xe'));var recordings=require('./recordings.controller');var members=require(_0x11f5('0xf'));var dials=require(_0x11f5('0x10'));var transfers=require(_0x11f5('0x11'));var core=require(_0x11f5('0x12'));ami['on'](_0x11f5('0x13'),core['connect']);ami['on'](_0x11f5('0x14'),core[_0x11f5('0x14')]);ami['on'](_0x11f5('0x15'),core['fullybooted']);ami['on'](_0x11f5('0x16'),core[_0x11f5('0x16')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0x11f5('0x17')]);ami['on']('devicestatechange',function(_0x344a2e){try{utils['debug'](util[_0x11f5('0x18')]('[%s][index][devicestatechange]',_0x344a2e[_0x11f5('0x19')]),_0x344a2e);members['devicestatechange'](_0x344a2e);}catch(_0x2c2d7b){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x1a'),_0x344a2e[_0x11f5('0x19')]),_0x2c2d7b);}});ami['on'](_0x11f5('0x1b'),function(_0x28f5a4){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x1d'),_0x28f5a4[_0x11f5('0x1e')]),_0x28f5a4);agents[_0x11f5('0x1b')](_0x28f5a4);}catch(_0x2d26d9){utils['error'](util[_0x11f5('0x18')](_0x11f5('0x1d'),_0x28f5a4['uniqueid']),_0x2d26d9);}});ami['on']('agentringnoanswer',function(_0x2ee9e7){try{utils[_0x11f5('0x1c')](util['format']('[%s][index][agentringnoanswer]',_0x2ee9e7[_0x11f5('0x1e')]),_0x2ee9e7);agents[_0x11f5('0x1f')](_0x2ee9e7);}catch(_0x1ff45f){utils['error'](util['format'](_0x11f5('0x20'),_0x2ee9e7['uniqueid']),_0x1ff45f);}});ami['on'](_0x11f5('0x21'),function(_0x8e8602){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x8e8602['uniqueid']),_0x8e8602);agents[_0x11f5('0x21')](_0x8e8602);queues[_0x11f5('0x21')](_0x8e8602);}catch(_0x3b7a68){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x22'),_0x8e8602[_0x11f5('0x1e')]),_0x3b7a68);}});ami['on'](_0x11f5('0x23'),function(_0x55dab8){try{utils['debug'](util[_0x11f5('0x18')]('[%s][index][agentcomplete]',_0x55dab8[_0x11f5('0x1e')]),_0x55dab8);agents[_0x11f5('0x23')](_0x55dab8);queues[_0x11f5('0x23')](_0x55dab8);members['agentcomplete'](_0x55dab8);}catch(_0x466477){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x24'),_0x55dab8[_0x11f5('0x1e')]),_0x466477);}});ami['on'](_0x11f5('0x25'),function(_0x90cc65){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')]('[%s][index][queuecallerabandon]',_0x90cc65[_0x11f5('0x1e')]),_0x90cc65);agents[_0x11f5('0x25')](_0x90cc65);queues['queuecallerabandon'](_0x90cc65);}catch(_0x8eba79){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x26'),_0x90cc65[_0x11f5('0x1e')]),_0x8eba79);}});ami['on'](_0x11f5('0x27'),function(_0x437f19){try{utils['debug'](util[_0x11f5('0x18')](_0x11f5('0x28'),_0x437f19[_0x11f5('0x1e')]),_0x437f19);queues[_0x11f5('0x27')](_0x437f19);recordings[_0x11f5('0x27')](_0x437f19);}catch(_0x467b03){utils[_0x11f5('0x16')](util[_0x11f5('0x18')]('[%s][index][queuecallerjoin]',_0x437f19[_0x11f5('0x1e')]),_0x467b03);}});ami['on'](_0x11f5('0x29'),function(_0x363393){try{utils['debug'](util[_0x11f5('0x18')](_0x11f5('0x2a'),_0x363393[_0x11f5('0x1e')]),_0x363393);queues[_0x11f5('0x29')](_0x363393);}catch(_0x28bcd8){utils['error'](util[_0x11f5('0x18')](_0x11f5('0x2a'),_0x363393[_0x11f5('0x1e')]),_0x28bcd8);}});ami['on'](_0x11f5('0x2b'),function(_0x58758c){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x2c'),_0x58758c[_0x11f5('0x1e')]),_0x58758c);queues[_0x11f5('0x2b')](_0x58758c);calls['musiconholdstart'](_0x58758c);}catch(_0x3b6367){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x2c'),_0x58758c[_0x11f5('0x1e')]),_0x3b6367);}});ami['on'](_0x11f5('0x2d'),function(_0x573301){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x2e'),_0x573301[_0x11f5('0x1e')]),_0x573301);queues[_0x11f5('0x2d')](_0x573301);calls[_0x11f5('0x2d')](_0x573301);}catch(_0x51ce21){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x2e'),_0x573301['uniqueid']),_0x51ce21);}});ami['on'](_0x11f5('0x2f'),function(_0x20cb1d){try{utils[_0x11f5('0x1c')](util['format']('[%s][index][newstate]',_0x20cb1d['uniqueid']),_0x20cb1d);calls[_0x11f5('0x2f')](_0x20cb1d);recordings['newstate'](_0x20cb1d);}catch(_0x5c0ecf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x30'),_0x20cb1d[_0x11f5('0x1e')]),_0x5c0ecf);}});ami['on'](_0x11f5('0x31'),function(_0xe02d27){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x32'),_0xe02d27[_0x11f5('0x1e')]),_0xe02d27);calls['hangup'](_0xe02d27);recordings[_0x11f5('0x31')](_0xe02d27);dials['hangup'](_0xe02d27);agents[_0x11f5('0x31')](_0xe02d27);queues[_0x11f5('0x31')](_0xe02d27);}catch(_0x5346cf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x32'),_0xe02d27['uniqueid']),_0x5346cf);}});ami['on'](_0x11f5('0x33'),function(_0x29673a){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x34'),_0x29673a['uniqueid']),_0x29673a);members[_0x11f5('0x33')](_0x29673a);}catch(_0x175277){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x34'),_0x29673a[_0x11f5('0x1e')]),_0x175277);}});ami['on'](_0x11f5('0x35'),function(_0x4ae500){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x36'),_0x4ae500['uniqueid']),_0x4ae500);queues[_0x11f5('0x35')](_0x4ae500);agents[_0x11f5('0x35')](_0x4ae500);transfers[_0x11f5('0x35')](_0x4ae500);recordings[_0x11f5('0x35')](_0x4ae500);}catch(_0x95f00f){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x36'),_0x4ae500['uniqueid']),_0x95f00f);}});ami['on'](_0x11f5('0x37'),function(_0x5b0a40){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')]('[%s][index][attendedtransfer]',_0x5b0a40[_0x11f5('0x38')]),_0x5b0a40);queues['attendedtransfer'](_0x5b0a40);transfers['attendedtransfer'](_0x5b0a40);agents[_0x11f5('0x37')](_0x5b0a40);calls[_0x11f5('0x37')](_0x5b0a40);}catch(_0x3f1fca){utils[_0x11f5('0x16')](util['format'](_0x11f5('0x39'),_0x5b0a40[_0x11f5('0x38')]),_0x3f1fca);}});ami['on'](_0x11f5('0x3a'),function(_0x5a955f){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3b'),_0x5a955f[_0x11f5('0x1e')]),_0x5a955f);queues[_0x11f5('0x3a')](_0x5a955f);recordings[_0x11f5('0x3a')](_0x5a955f);calls[_0x11f5('0x3a')](_0x5a955f);dials[_0x11f5('0x3a')](_0x5a955f);}catch(_0x1c13a6){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x3b'),_0x5a955f['uniqueid']),_0x1c13a6);}});ami['on'](_0x11f5('0x3c'),function(_0x51c330){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3d'),_0x51c330['uniqueid']),_0x51c330);calls['newexten'](_0x51c330);recordings[_0x11f5('0x3c')](_0x51c330);dials[_0x11f5('0x3c')](_0x51c330);}catch(_0x6a047c){utils[_0x11f5('0x16')](util[_0x11f5('0x18')]('[%s][index][newexten]',_0x51c330[_0x11f5('0x1e')]),_0x6a047c);}});ami['on'](_0x11f5('0x3e'),function(_0x393955){try{utils[_0x11f5('0x1c')](util[_0x11f5('0x18')](_0x11f5('0x3f'),_0x393955['uniqueid']),_0x393955);calls[_0x11f5('0x3e')](_0x393955);recordings[_0x11f5('0x3e')](_0x393955);}catch(_0x56591c){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x3f'),_0x393955['uniqueid']),_0x56591c);}});ami['on'](_0x11f5('0x40'),function(_0xf23cd0){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x41'),_0xf23cd0[_0x11f5('0x1e')]),_0xf23cd0);dials[_0x11f5('0x40')](_0xf23cd0);}catch(_0x316b49){utils['error'](util['format'](_0x11f5('0x42'),_0xf23cd0[_0x11f5('0x1e')]),_0x316b49);}});ami['on'](_0x11f5('0x43'),function(_0x4146ad){try{utils[_0x11f5('0x1c')](util['format'](_0x11f5('0x44'),_0x4146ad[_0x11f5('0x1e')]),_0x4146ad);dials[_0x11f5('0x43')](_0x4146ad);}catch(_0x323caf){utils[_0x11f5('0x16')](util[_0x11f5('0x18')](_0x11f5('0x44'),_0x4146ad[_0x11f5('0x1e')]),_0x323caf);}});} \ No newline at end of file +var _0x65a9=['musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','env','production','local','asterisk','port','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]'];(function(_0x20fd3f,_0x507cf3){var _0x4561d8=function(_0x388383){while(--_0x388383){_0x20fd3f['push'](_0x20fd3f['shift']());}};_0x4561d8(++_0x507cf3);}(_0x65a9,0xa4));var _0x965a=function(_0x2d1647,_0x559ec6){_0x2d1647=_0x2d1647-0x0;var _0x2db93d=_0x65a9[_0x2d1647];return _0x2db93d;};var AsteriskManager=require(_0x965a('0x0'));var config=require(_0x965a('0x1'));var utils=require('./utils');var util=require(_0x965a('0x2'));var isXDREnabled=config[_0x965a('0x3')]&&config[_0x965a('0x3')]['disabled']?!config['xdr']['disabled']:!![];var isProduction=config[_0x965a('0x4')]===_0x965a('0x5')||![];var isLocalAsterisk=config[_0x965a('0x3')]&&config['xdr'][_0x965a('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x965a('0x7')][_0x965a('0x8')],config['asterisk']['ip'],config[_0x965a('0x7')][_0x965a('0x9')],config[_0x965a('0x7')]['password'],!![]);ami[_0x965a('0xa')]();if(!isXDREnabled){utils[_0x965a('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x965a('0xb')](_0x965a('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x965a('0xd'));var queues=require(_0x965a('0xe'));var recordings=require(_0x965a('0xf'));var members=require(_0x965a('0x10'));var dials=require(_0x965a('0x11'));var transfers=require(_0x965a('0x12'));var core=require(_0x965a('0x13'));ami['on'](_0x965a('0x14'),core[_0x965a('0x14')]);ami['on'](_0x965a('0x15'),core['shutdown']);ami['on']('fullybooted',core[_0x965a('0x16')]);ami['on'](_0x965a('0x17'),core[_0x965a('0x17')]);ami['on'](_0x965a('0x18'),core[_0x965a('0x18')]);ami['on'](_0x965a('0x19'),core[_0x965a('0x19')]);ami['on'](_0x965a('0x1a'),function(_0x3a2dde){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')]('[%s][index][devicestatechange]',_0x3a2dde[_0x965a('0x1d')]),_0x3a2dde);members[_0x965a('0x1a')](_0x3a2dde);}catch(_0x1ebd2a){utils[_0x965a('0x17')](util[_0x965a('0x1c')](_0x965a('0x1e'),_0x3a2dde['device']),_0x1ebd2a);}});ami['on'](_0x965a('0x1f'),function(_0x33db0f){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x20'),_0x33db0f[_0x965a('0x21')]),_0x33db0f);agents[_0x965a('0x1f')](_0x33db0f);}catch(_0x1e38c9){utils[_0x965a('0x17')](util['format'](_0x965a('0x20'),_0x33db0f[_0x965a('0x21')]),_0x1e38c9);}});ami['on'](_0x965a('0x22'),function(_0x541531){try{utils['debug'](util[_0x965a('0x1c')](_0x965a('0x23'),_0x541531[_0x965a('0x21')]),_0x541531);agents[_0x965a('0x22')](_0x541531);}catch(_0x294a97){utils[_0x965a('0x17')](util[_0x965a('0x1c')]('[%s][index][agentringnoanswer]',_0x541531[_0x965a('0x21')]),_0x294a97);}});ami['on']('agentconnect',function(_0x38a432){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x24'),_0x38a432['uniqueid']),_0x38a432);agents[_0x965a('0x25')](_0x38a432);queues[_0x965a('0x25')](_0x38a432);}catch(_0x200389){utils['error'](util[_0x965a('0x1c')]('[%s][index][agentconnect]',_0x38a432['uniqueid']),_0x200389);}});ami['on'](_0x965a('0x26'),function(_0x3477d0){try{utils[_0x965a('0x1b')](util['format']('[%s][index][agentcomplete]',_0x3477d0[_0x965a('0x21')]),_0x3477d0);agents[_0x965a('0x26')](_0x3477d0);queues[_0x965a('0x26')](_0x3477d0);members[_0x965a('0x26')](_0x3477d0);}catch(_0x1bbe33){utils[_0x965a('0x17')](util[_0x965a('0x1c')]('[%s][index][agentcomplete]',_0x3477d0[_0x965a('0x21')]),_0x1bbe33);}});ami['on'](_0x965a('0x27'),function(_0x2d8586){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x28'),_0x2d8586['uniqueid']),_0x2d8586);agents[_0x965a('0x27')](_0x2d8586);queues[_0x965a('0x27')](_0x2d8586);}catch(_0x4881d5){utils[_0x965a('0x17')](util['format'](_0x965a('0x28'),_0x2d8586['uniqueid']),_0x4881d5);}});ami['on'](_0x965a('0x29'),function(_0x21359b){try{utils['debug'](util[_0x965a('0x1c')](_0x965a('0x2a'),_0x21359b[_0x965a('0x21')]),_0x21359b);queues['queuecallerjoin'](_0x21359b);recordings[_0x965a('0x29')](_0x21359b);}catch(_0x46153a){utils['error'](util[_0x965a('0x1c')](_0x965a('0x2a'),_0x21359b[_0x965a('0x21')]),_0x46153a);}});ami['on']('queuecallerleave',function(_0x2d4496){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x2b'),_0x2d4496[_0x965a('0x21')]),_0x2d4496);queues['queuecallerleave'](_0x2d4496);}catch(_0x6a56f5){utils[_0x965a('0x17')](util[_0x965a('0x1c')]('[%s][index][queuecallerleave]',_0x2d4496[_0x965a('0x21')]),_0x6a56f5);}});ami['on'](_0x965a('0x2c'),function(_0x5e86a3){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x2d'),_0x5e86a3[_0x965a('0x21')]),_0x5e86a3);queues['musiconholdstart'](_0x5e86a3);calls[_0x965a('0x2c')](_0x5e86a3);}catch(_0x42a25d){utils['error'](util[_0x965a('0x1c')](_0x965a('0x2d'),_0x5e86a3['uniqueid']),_0x42a25d);}});ami['on'](_0x965a('0x2e'),function(_0x5ce4b9){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x2f'),_0x5ce4b9[_0x965a('0x21')]),_0x5ce4b9);queues[_0x965a('0x2e')](_0x5ce4b9);calls[_0x965a('0x2e')](_0x5ce4b9);}catch(_0x2fb7c3){utils[_0x965a('0x17')](util[_0x965a('0x1c')]('[%s][index][musiconholdstop]',_0x5ce4b9[_0x965a('0x21')]),_0x2fb7c3);}});ami['on']('newstate',function(_0x3eafa4){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x30'),_0x3eafa4[_0x965a('0x21')]),_0x3eafa4);calls[_0x965a('0x31')](_0x3eafa4);recordings[_0x965a('0x31')](_0x3eafa4);}catch(_0x114cb0){utils['error'](util[_0x965a('0x1c')](_0x965a('0x30'),_0x3eafa4[_0x965a('0x21')]),_0x114cb0);}});ami['on']('hangup',function(_0xa28081){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x32'),_0xa28081[_0x965a('0x21')]),_0xa28081);calls[_0x965a('0x33')](_0xa28081);recordings[_0x965a('0x33')](_0xa28081);dials[_0x965a('0x33')](_0xa28081);agents[_0x965a('0x33')](_0xa28081);queues['hangup'](_0xa28081);}catch(_0x598a1f){utils[_0x965a('0x17')](util['format'](_0x965a('0x32'),_0xa28081[_0x965a('0x21')]),_0x598a1f);}});ami['on'](_0x965a('0x34'),function(_0x92c9e3){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x35'),_0x92c9e3['uniqueid']),_0x92c9e3);members['cdr'](_0x92c9e3);}catch(_0x3eb833){utils[_0x965a('0x17')](util['format'](_0x965a('0x35'),_0x92c9e3[_0x965a('0x21')]),_0x3eb833);}});ami['on'](_0x965a('0x36'),function(_0x4f5fa7){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x37'),_0x4f5fa7[_0x965a('0x21')]),_0x4f5fa7);queues[_0x965a('0x36')](_0x4f5fa7);agents[_0x965a('0x36')](_0x4f5fa7);transfers[_0x965a('0x36')](_0x4f5fa7);recordings[_0x965a('0x36')](_0x4f5fa7);}catch(_0x2d303d){utils['error'](util[_0x965a('0x1c')](_0x965a('0x37'),_0x4f5fa7[_0x965a('0x21')]),_0x2d303d);}});ami['on'](_0x965a('0x38'),function(_0x460a35){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x39'),_0x460a35[_0x965a('0x3a')]),_0x460a35);queues[_0x965a('0x38')](_0x460a35);transfers[_0x965a('0x38')](_0x460a35);agents[_0x965a('0x38')](_0x460a35);calls[_0x965a('0x38')](_0x460a35);}catch(_0x36fc3b){utils['error'](util[_0x965a('0x1c')]('[%s][index][attendedtransfer]',_0x460a35[_0x965a('0x3a')]),_0x36fc3b);}});ami['on'](_0x965a('0x3b'),function(_0x5a069a){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x3c'),_0x5a069a[_0x965a('0x21')]),_0x5a069a);queues[_0x965a('0x3b')](_0x5a069a);recordings[_0x965a('0x3b')](_0x5a069a);calls[_0x965a('0x3b')](_0x5a069a);dials[_0x965a('0x3b')](_0x5a069a);}catch(_0x5da2ca){utils[_0x965a('0x17')](util['format']('[%s][index][varset]',_0x5a069a['uniqueid']),_0x5da2ca);}});ami['on']('newexten',function(_0x30308a){try{utils['debug'](util[_0x965a('0x1c')](_0x965a('0x3d'),_0x30308a[_0x965a('0x21')]),_0x30308a);calls['newexten'](_0x30308a);recordings[_0x965a('0x3e')](_0x30308a);dials[_0x965a('0x3e')](_0x30308a);}catch(_0x3daf90){utils[_0x965a('0x17')](util[_0x965a('0x1c')](_0x965a('0x3d'),_0x30308a['uniqueid']),_0x3daf90);}});ami['on'](_0x965a('0x3f'),function(_0x216b12){try{utils[_0x965a('0x1b')](util[_0x965a('0x1c')](_0x965a('0x40'),_0x216b12['uniqueid']),_0x216b12);calls[_0x965a('0x3f')](_0x216b12);recordings[_0x965a('0x3f')](_0x216b12);}catch(_0x24d184){utils[_0x965a('0x17')](util[_0x965a('0x1c')](_0x965a('0x40'),_0x216b12[_0x965a('0x21')]),_0x24d184);}});ami['on']('dialbegin',function(_0x155047){try{utils[_0x965a('0x1b')](util['format'](_0x965a('0x41'),_0x155047[_0x965a('0x21')]),_0x155047);dials[_0x965a('0x42')](_0x155047);}catch(_0x15abe8){utils[_0x965a('0x17')](util[_0x965a('0x1c')](_0x965a('0x43'),_0x155047[_0x965a('0x21')]),_0x15abe8);}});ami['on'](_0x965a('0x44'),function(_0x19db65){try{utils['debug'](util[_0x965a('0x1c')](_0x965a('0x45'),_0x19db65[_0x965a('0x21')]),_0x19db65);dials[_0x965a('0x44')](_0x19db65);}catch(_0x3b85b6){utils[_0x965a('0x17')](util[_0x965a('0x1c')](_0x965a('0x45'),_0x19db65[_0x965a('0x21')]),_0x3b85b6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b8cf946..d7d125a 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 _0xd73a=['./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','then','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','assign','lodash','util'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xd73a,0x171));var _0xad73=function(_0x5c6bc9,_0x4276f7){_0x5c6bc9=_0x5c6bc9-0x0;var _0x5b1fa5=_0xd73a[_0x5c6bc9];return _0x5b1fa5;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var utils=require(_0xad73('0x2'));var members={};var exclude=[_0xad73('0x3'),_0xad73('0x4')];function writeDB(_0x59c24f){utils['info'](util[_0xad73('0x5')](_0xad73('0x6'),_0x59c24f[_0xad73('0x7')],_0x59c24f[_0xad73('0x8')],_0x59c24f[_0xad73('0x9')],_0x59c24f[_0xad73('0xa')],_0x59c24f[_0xad73('0xb')],_0x59c24f[_0xad73('0xc')]));if(_0x59c24f[_0xad73('0x8')]){utils[_0xad73('0xd')](_0x59c24f[_0xad73('0x8')])['then'](function(_0x39cd6d){if(_0x39cd6d){_0x59c24f['membername']=_0x39cd6d[_0xad73('0xe')];_0x59c24f[_0xad73('0xf')]=_0x39cd6d[_0xad73('0xf')];utils['request'](_0xad73('0x10'),_0x59c24f);}else{utils['getUserByName'](_0x59c24f[_0xad73('0x8')]['split']('/')[0x1])[_0xad73('0x11')](function(_0x32be55){if(_0x32be55){_0x59c24f[_0xad73('0xb')]=_0x32be55['name'];_0x59c24f[_0xad73('0xf')]=_0x32be55[_0xad73('0xf')];utils['request'](_0xad73('0x10'),_0x59c24f);}});}})[_0xad73('0x12')](function(_0x2ba4d5){utils[_0xad73('0x13')](util[_0xad73('0x5')](_0xad73('0x14'),_0x59c24f['uniqueid']),_0x2ba4d5);});}delete members[_0x59c24f[_0xad73('0x8')]];}function startsWith(_0x35c2c5,_0x4336fa){return _[_0xad73('0x15')](_0x35c2c5,function(_0x2f0dcd){return _[_0xad73('0x16')](_0x4336fa,_0x2f0dcd);});}exports[_0xad73('0x17')]=function(_0x367a5d){try{utils[_0xad73('0x18')](util[_0xad73('0x5')]('[%s][members][devicestatechange]',members[_0x367a5d[_0xad73('0x19')]]?members[_0x367a5d['device']]['uniqueid']:_0x367a5d[_0xad73('0x19')]),_0x367a5d);utils[_0xad73('0x1a')](util[_0xad73('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x367a5d[_0xad73('0x19')]]?members[_0x367a5d[_0xad73('0x19')]]['uniqueid']:_0x367a5d[_0xad73('0x19')],_0x367a5d[_0xad73('0x1b')],_0x367a5d[_0xad73('0x19')]));switch(_0x367a5d[_0xad73('0x1b')]){case _0xad73('0x1c'):case _0xad73('0x1d'):if(!startsWith(exclude,_0x367a5d[_0xad73('0x19')])){members[_0x367a5d['device']]={'channel':_0xad73('0x1e'),'interface':_0x367a5d[_0xad73('0x19')],'type':_0xad73('0x1f'),'enterAt':utils[_0xad73('0x20')](),'role':_0xad73('0x21')};}break;case _0xad73('0x22'):if(!_[_0xad73('0x23')](members[_0x367a5d[_0xad73('0x19')]])){members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x24')]=utils[_0xad73('0x20')]();members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x25')]=utils[_0xad73('0x26')](members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x24')],members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x27')]);if(members[_0x367a5d[_0xad73('0x19')]][_0xad73('0x7')]){writeDB(members[_0x367a5d['device']]);}}break;default:break;}}catch(_0x4e0855){utils['error'](util[_0xad73('0x5')](_0xad73('0x28'),members[_0x367a5d['device']]?members[_0x367a5d[_0xad73('0x19')]]['uniqueid']:_0x367a5d['device']),_0x4e0855);}};exports[_0xad73('0x29')]=function(_0x377273){try{if(!_[_0xad73('0x23')](members[_0x377273[_0xad73('0x8')]])){utils['debug'](util[_0xad73('0x5')](_0xad73('0x2a'),_0x377273[_0xad73('0x7')]),_0x377273);utils['info'](util[_0xad73('0x5')](_0xad73('0x2b'),_0x377273[_0xad73('0x7')],_0x377273[_0xad73('0x8')],_0x377273[_0xad73('0x2c')]));members[_0x377273['interface']]=_['assign'](members[_0x377273['interface']],{'data4':_0x377273[_0xad73('0x2c')],'uniqueid':_0x377273['uniqueid']});}}catch(_0x3f4a8a){utils['error'](util[_0xad73('0x5')](_0xad73('0x2a'),_0x377273['uniqueid']),_0x3f4a8a);}};exports['cdr']=function(_0x2f9b2b){try{utils[_0xad73('0x18')](util['format']('[%s][members][cdr]',_0x2f9b2b[_0xad73('0x7')]),_0x2f9b2b);if(_0x2f9b2b['channel']){var _0x4016ec=_0x2f9b2b[_0xad73('0x9')]['split']('-')[0x0];if(!_[_0xad73('0x23')](members[_0x4016ec])){members[_0x4016ec]=_['assign'](members[_0x4016ec],{'data1':members[_0x4016ec][_0xad73('0x2d')]||_0x2f9b2b[_0xad73('0xc')],'data2':members[_0x4016ec][_0xad73('0xa')]||_0x2f9b2b[_0xad73('0x2e')],'data3':members[_0x4016ec][_0xad73('0x2f')]||_0x2f9b2b[_0xad73('0x30')],'uniqueid':members[_0x4016ec][_0xad73('0x7')]||_0x2f9b2b[_0xad73('0x7')]});utils[_0xad73('0x1a')](util['format'](_0xad73('0x31'),_0x2f9b2b[_0xad73('0x7')],members[_0x4016ec]['data1'],members[_0x4016ec][_0xad73('0xa')],members[_0x4016ec][_0xad73('0x2f')]));if(members[_0x4016ec][_0xad73('0x24')]){writeDB(members[_0x4016ec]);}}}if(_0x2f9b2b[_0xad73('0x32')]){var _0x45210f=_0x2f9b2b[_0xad73('0x32')][_0xad73('0x33')]('-')[0x0];if(!_[_0xad73('0x23')](members[_0x45210f])){members[_0x45210f]=_[_0xad73('0x34')](members[_0x45210f],{'data1':members[_0x45210f]['data1']||_0x2f9b2b[_0xad73('0xc')],'data2':members[_0x45210f][_0xad73('0xa')]||_0x2f9b2b[_0xad73('0x2e')],'data3':members[_0x45210f]['data3']||_0x2f9b2b['destination'],'uniqueid':members[_0x45210f][_0xad73('0x7')]||_0x2f9b2b['uniqueid']});utils['info'](util[_0xad73('0x5')](_0xad73('0x31'),_0x2f9b2b[_0xad73('0x7')],members[_0x45210f][_0xad73('0x2d')],members[_0x45210f]['data2'],members[_0x45210f][_0xad73('0x2f')]));if(members[_0x45210f][_0xad73('0x24')]){writeDB(members[_0x45210f]);}}}}catch(_0x486961){utils[_0xad73('0x13')](util[_0xad73('0x5')]('[%s][members][cdr]',_0x2f9b2b[_0xad73('0x7')]),_0x486961);}}; \ No newline at end of file +var _0x3e0b=['voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]','assign','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','Local/_attended@transfer','Queue:','info','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','getUserByName','then','catch','format','some','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY'];(function(_0xc0921a,_0x1f107f){var _0x3f6189=function(_0x5cd2fe){while(--_0x5cd2fe){_0xc0921a['push'](_0xc0921a['shift']());}};_0x3f6189(++_0x1f107f);}(_0x3e0b,0x16e));var _0xb3e0=function(_0x167784,_0x677c2e){_0x167784=_0x167784-0x0;var _0x386ef9=_0x3e0b[_0x167784];return _0x386ef9;};'use strict';var _=require('lodash');var util=require(_0xb3e0('0x0'));var utils=require('./utils');var members={};var exclude=[_0xb3e0('0x1'),_0xb3e0('0x2')];function writeDB(_0x346728){utils[_0xb3e0('0x3')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x346728['uniqueid'],_0x346728[_0xb3e0('0x4')],_0x346728[_0xb3e0('0x5')],_0x346728[_0xb3e0('0x6')],_0x346728[_0xb3e0('0x7')],_0x346728[_0xb3e0('0x8')]));if(_0x346728[_0xb3e0('0x4')]){utils[_0xb3e0('0x9')](_0x346728[_0xb3e0('0x4')])['then'](function(_0x7cbd60){if(_0x7cbd60){_0x346728[_0xb3e0('0x7')]=_0x7cbd60[_0xb3e0('0xa')];_0x346728[_0xb3e0('0xb')]=_0x7cbd60['internal'];utils[_0xb3e0('0xc')]('CreateMemberReport',_0x346728);}else{utils[_0xb3e0('0xd')](_0x346728[_0xb3e0('0x4')]['split']('/')[0x1])[_0xb3e0('0xe')](function(_0x13b0e9){if(_0x13b0e9){_0x346728[_0xb3e0('0x7')]=_0x13b0e9[_0xb3e0('0xa')];_0x346728['internal']=_0x13b0e9[_0xb3e0('0xb')];utils['request']('CreateMemberReport',_0x346728);}});}})[_0xb3e0('0xf')](function(_0x42ef47){utils['error'](util[_0xb3e0('0x10')]('[%s][members][writeDB]',_0x346728['uniqueid']),_0x42ef47);});}delete members[_0x346728['interface']];}function startsWith(_0x5886f9,_0x399281){return _[_0xb3e0('0x11')](_0x5886f9,function(_0x18d6ce){return _['startsWith'](_0x399281,_0x18d6ce);});}exports[_0xb3e0('0x12')]=function(_0xe5ddbe){try{utils[_0xb3e0('0x13')](util[_0xb3e0('0x10')](_0xb3e0('0x14'),members[_0xe5ddbe[_0xb3e0('0x15')]]?members[_0xe5ddbe['device']][_0xb3e0('0x16')]:_0xe5ddbe[_0xb3e0('0x15')]),_0xe5ddbe);utils['info'](util['format'](_0xb3e0('0x17'),members[_0xe5ddbe['device']]?members[_0xe5ddbe[_0xb3e0('0x15')]]['uniqueid']:_0xe5ddbe[_0xb3e0('0x15')],_0xe5ddbe[_0xb3e0('0x18')],_0xe5ddbe[_0xb3e0('0x15')]));switch(_0xe5ddbe[_0xb3e0('0x18')]){case'INUSE':case _0xb3e0('0x19'):if(!startsWith(exclude,_0xe5ddbe[_0xb3e0('0x15')])){members[_0xe5ddbe['device']]={'channel':_0xb3e0('0x1a'),'interface':_0xe5ddbe[_0xb3e0('0x15')],'type':_0xb3e0('0x1b'),'enterAt':utils[_0xb3e0('0x1c')](),'role':_0xb3e0('0x1d')};}break;case _0xb3e0('0x1e'):if(!_['isNil'](members[_0xe5ddbe[_0xb3e0('0x15')]])){members[_0xe5ddbe[_0xb3e0('0x15')]][_0xb3e0('0x1f')]=utils[_0xb3e0('0x1c')]();members[_0xe5ddbe[_0xb3e0('0x15')]][_0xb3e0('0x20')]=utils[_0xb3e0('0x21')](members[_0xe5ddbe['device']][_0xb3e0('0x1f')],members[_0xe5ddbe[_0xb3e0('0x15')]][_0xb3e0('0x22')]);if(members[_0xe5ddbe['device']][_0xb3e0('0x16')]){writeDB(members[_0xe5ddbe[_0xb3e0('0x15')]]);}}break;default:break;}}catch(_0x287ca9){utils[_0xb3e0('0x23')](util['format'](_0xb3e0('0x14'),members[_0xe5ddbe[_0xb3e0('0x15')]]?members[_0xe5ddbe[_0xb3e0('0x15')]]['uniqueid']:_0xe5ddbe[_0xb3e0('0x15')]),_0x287ca9);}};exports[_0xb3e0('0x24')]=function(_0xbf8641){try{if(!_[_0xb3e0('0x25')](members[_0xbf8641['interface']])){utils[_0xb3e0('0x13')](util[_0xb3e0('0x10')](_0xb3e0('0x26'),_0xbf8641[_0xb3e0('0x16')]),_0xbf8641);utils[_0xb3e0('0x3')](util[_0xb3e0('0x10')](_0xb3e0('0x27'),_0xbf8641[_0xb3e0('0x16')],_0xbf8641[_0xb3e0('0x4')],_0xbf8641['queue']));members[_0xbf8641[_0xb3e0('0x4')]]=_['assign'](members[_0xbf8641[_0xb3e0('0x4')]],{'data4':_0xbf8641[_0xb3e0('0x28')],'uniqueid':_0xbf8641[_0xb3e0('0x16')]});}}catch(_0x33f309){utils[_0xb3e0('0x23')](util[_0xb3e0('0x10')](_0xb3e0('0x26'),_0xbf8641['uniqueid']),_0x33f309);}};exports['cdr']=function(_0x351e7f){try{utils['debug'](util[_0xb3e0('0x10')](_0xb3e0('0x29'),_0x351e7f[_0xb3e0('0x16')]),_0x351e7f);if(_0x351e7f[_0xb3e0('0x5')]){var _0x49bd86=_0x351e7f[_0xb3e0('0x5')]['split']('-')[0x0];if(!_['isNil'](members[_0x49bd86])){members[_0x49bd86]=_[_0xb3e0('0x2a')](members[_0x49bd86],{'data1':members[_0x49bd86][_0xb3e0('0x2b')]||_0x351e7f[_0xb3e0('0x8')],'data2':members[_0x49bd86][_0xb3e0('0x6')]||_0x351e7f[_0xb3e0('0x2c')],'data3':members[_0x49bd86]['data3']||_0x351e7f[_0xb3e0('0x2d')],'uniqueid':members[_0x49bd86]['uniqueid']||_0x351e7f[_0xb3e0('0x16')]});utils[_0xb3e0('0x3')](util[_0xb3e0('0x10')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x351e7f[_0xb3e0('0x16')],members[_0x49bd86]['data1'],members[_0x49bd86][_0xb3e0('0x6')],members[_0x49bd86][_0xb3e0('0x2e')]));if(members[_0x49bd86]['exitAt']){writeDB(members[_0x49bd86]);}}}if(_0x351e7f[_0xb3e0('0x2f')]){var _0x589806=_0x351e7f[_0xb3e0('0x2f')]['split']('-')[0x0];if(!_[_0xb3e0('0x25')](members[_0x589806])){members[_0x589806]=_[_0xb3e0('0x2a')](members[_0x589806],{'data1':members[_0x589806][_0xb3e0('0x2b')]||_0x351e7f[_0xb3e0('0x8')],'data2':members[_0x589806][_0xb3e0('0x6')]||_0x351e7f[_0xb3e0('0x2c')],'data3':members[_0x589806][_0xb3e0('0x2e')]||_0x351e7f[_0xb3e0('0x2d')],'uniqueid':members[_0x589806]['uniqueid']||_0x351e7f[_0xb3e0('0x16')]});utils[_0xb3e0('0x3')](util[_0xb3e0('0x10')](_0xb3e0('0x30'),_0x351e7f[_0xb3e0('0x16')],members[_0x589806]['data1'],members[_0x589806][_0xb3e0('0x6')],members[_0x589806][_0xb3e0('0x2e')]));if(members[_0x589806][_0xb3e0('0x1f')]){writeDB(members[_0x589806]);}}}}catch(_0x448896){utils['error'](util[_0xb3e0('0x10')]('[%s][members][cdr]',_0x351e7f['uniqueid']),_0x448896);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4651812..0a084b9 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 _0x4627=['queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%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]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit'];(function(_0x44c742,_0x5d69a4){var _0x40fcf0=function(_0x453d3c){while(--_0x453d3c){_0x44c742['push'](_0x44c742['shift']());}};_0x40fcf0(++_0x5d69a4);}(_0x4627,0xb0));var _0x7462=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x4627[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0x7462('0x0'));var util=require(_0x7462('0x1'));var utils=require(_0x7462('0x2'));var queues={};function writeDB(_0x24ee82){utils[_0x7462('0x3')](util['format'](_0x7462('0x4'),_0x24ee82[_0x7462('0x5')],_0x24ee82[_0x7462('0x6')],_0x24ee82[_0x7462('0x7')],_0x24ee82[_0x7462('0x8')],_0x24ee82['calleridnum'],_0x24ee82[_0x7462('0x9')],_0x24ee82[_0x7462('0xa')]));if(_0x24ee82[_0x7462('0x7')]){utils[_0x7462('0xb')](_0x24ee82[_0x7462('0x7')])[_0x7462('0xc')](function(_0x507c9c){if(_0x507c9c){_0x24ee82[_0x7462('0xd')]=_0x507c9c['type'];}utils[_0x7462('0xe')](_0x7462('0xf'),_0x24ee82);});}else{utils[_0x7462('0xe')](_0x7462('0xf'),_0x24ee82);}if(_0x24ee82[_0x7462('0x10')]){delete queues[_0x24ee82[_0x7462('0x10')]];}else{delete queues[_0x24ee82[_0x7462('0x5')]];}}exports[_0x7462('0x11')]=function(_0x522a87){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x14'),_0x522a87[_0x7462('0x5')]),_0x522a87);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x15'),_0x522a87['uniqueid'],_0x522a87[_0x7462('0x7')],_0x522a87[_0x7462('0x16')]));queues[_0x522a87['uniqueid']]=_['assign'](_0x522a87,{'originalposition':_0x522a87[_0x7462('0x16')],'queuecallerjoinAt':utils[_0x7462('0x17')](),'mohtime':0x0});}catch(_0xdc4446){utils[_0x7462('0x18')](util['format']('[%s][queues][queuecallerjoin]',_0x522a87['uniqueid']),_0xdc4446);}};exports['hangup']=function(_0x18ca75){try{if(!_[_0x7462('0x19')](queues[_0x18ca75[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x1a'),_0x18ca75['uniqueid']),_0x18ca75);if(queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1b')]){if(!queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1c')]&&!queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1d')]){queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1e')]=!![];queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x1f')]=utils[_0x7462('0x17')]();queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0xa')]=_0x7462('0x20');}utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x18ca75[_0x7462('0x5')],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0xa')]));writeDB(queues[_0x18ca75[_0x7462('0x5')]]);}else if(queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]){utils['info'](util['format'](_0x7462('0x22'),_0x18ca75[_0x7462('0x5')],queues[_0x18ca75[_0x7462('0x5')]]['name'],queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]));queues[queues[_0x18ca75[_0x7462('0x5')]]['transfereduniqueid']]=queues[_0x18ca75[_0x7462('0x5')]];queues[queues[_0x18ca75[_0x7462('0x5')]][_0x7462('0x10')]][_0x7462('0x23')]=0x2;delete queues[_0x18ca75['uniqueid']];}}}catch(_0x1c3b46){utils[_0x7462('0x18')](util['format'](_0x7462('0x1a'),_0x18ca75[_0x7462('0x5')]),_0x1c3b46);}};exports[_0x7462('0x24')]=function(_0x2a25f1){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x25'),_0x2a25f1[_0x7462('0x5')]),_0x2a25f1);if(!_[_0x7462('0x19')](_0x2a25f1[_0x7462('0x26')][_0x7462('0x27')])&&_0x2a25f1['value']['toUpperCase']()!==_0x7462('0x28')){if(!_[_0x7462('0x19')](queues[_0x2a25f1[_0x7462('0x5')]])){queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x2a25f1[_0x7462('0x5')]]['queuecallerexit']=!![];queues[_0x2a25f1['uniqueid']][_0x7462('0x2a')]=utils[_0x7462('0x17')]();queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]=_0x2a25f1[_0x7462('0x2b')]['toUpperCase']();utils['info'](util[_0x7462('0x13')](_0x7462('0x2c'),_0x2a25f1[_0x7462('0x5')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x21')],_0x2a25f1['value'],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]));writeDB(queues[_0x2a25f1[_0x7462('0x5')]]);}}else if(!_[_0x7462('0x19')](_0x2a25f1[_0x7462('0x26')]['queueposition'])){if(!_['isNil'](queues[_0x2a25f1[_0x7462('0x5')]])&&!queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1c')]){queues[_0x2a25f1['uniqueid']][_0x7462('0x1c')]=![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x1d')]=!![];queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x2a')]=utils[_0x7462('0x17')]();queues[_0x2a25f1['uniqueid']][_0x7462('0xa')]=_0x7462('0x2d');utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x2e'),_0x2a25f1[_0x7462('0x5')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0x21')],_0x2a25f1[_0x7462('0x2b')],queues[_0x2a25f1[_0x7462('0x5')]][_0x7462('0xa')]));}}}catch(_0x66bb03){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x25'),_0x2a25f1[_0x7462('0x5')]),_0x66bb03);}};exports['queuecallerabandon']=function(_0x27c12e){try{if(!_[_0x7462('0x19')](queues[_0x27c12e['uniqueid']])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x2f'),_0x27c12e[_0x7462('0x5')]),_0x27c12e);queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x1d')]=![];queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x2a')]=null;queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x1c')]=!![];queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x29')]=utils[_0x7462('0x17')]();queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0xa')]=_0x7462('0x30');utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x31'),_0x27c12e[_0x7462('0x5')],queues[_0x27c12e[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x27c12e['uniqueid']]['queuecallerexitreason']));}}catch(_0x27c4db){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x2f'),_0x27c12e[_0x7462('0x5')]),_0x27c4db);}};exports[_0x7462('0x32')]=function(_0x557bac){try{if(!_[_0x7462('0x19')](queues[_0x557bac[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x33'),_0x557bac['uniqueid']),_0x557bac);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x34'),_0x557bac[_0x7462('0x5')],queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x21')],_0x557bac['connectedlinenum'],_0x557bac[_0x7462('0x35')]));queues[_0x557bac['uniqueid']][_0x7462('0x32')]=!![];queues[_0x557bac['uniqueid']]['queuecallerleaveAt']=utils[_0x7462('0x17')]();queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x36')]=utils[_0x7462('0x37')](queues[_0x557bac['uniqueid']][_0x7462('0x1b')],queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x38')]);queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x16')]=_0x557bac[_0x7462('0x16')];queues[_0x557bac[_0x7462('0x5')]][_0x7462('0x39')]=_0x557bac[_0x7462('0x39')];queues[_0x557bac['uniqueid']]['connectedlinenum']=_0x557bac[_0x7462('0x3a')];queues[_0x557bac['uniqueid']]['connectedlinename']=_0x557bac[_0x7462('0x35')];}}catch(_0x97a3a3){utils[_0x7462('0x18')](util[_0x7462('0x13')]('[%s][queues][queuecallerleave]',_0x557bac[_0x7462('0x5')]),_0x97a3a3);}};exports[_0x7462('0x3b')]=function(_0x220557){try{if(!_[_0x7462('0x19')](queues[_0x220557['uniqueid']])){utils['debug'](util['format'](_0x7462('0x3c'),_0x220557['uniqueid']),_0x220557);utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x3d'),_0x220557['uniqueid'],queues[_0x220557['uniqueid']][_0x7462('0x21')],_0x220557[_0x7462('0x3e')],_0x220557[_0x7462('0x3f')]));queues[_0x220557[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x220557[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x220557[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x220557['uniqueid']]['queuecallerexit']=![];queues[_0x220557['uniqueid']][_0x7462('0xa')]=null;queues[_0x220557[_0x7462('0x5')]]['queuecallerexitAt']=null;queues[_0x220557[_0x7462('0x5')]][_0x7462('0x40')]=!![];queues[_0x220557[_0x7462('0x5')]]['accountcode']=_0x220557[_0x7462('0x3f')];queues[_0x220557['uniqueid']]['lastAssignedTo']=_0x220557[_0x7462('0x3e')];}}catch(_0x5665eb){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x3c'),_0x220557[_0x7462('0x5')]),_0x5665eb);}};exports[_0x7462('0x41')]=function(_0x57e825){try{if(!_['isNil'](queues[_0x57e825[_0x7462('0x5')]])){if(queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1b')]){utils['debug'](util[_0x7462('0x13')]('[%s][queues][agentcomplete]',_0x57e825[_0x7462('0x5')]),_0x57e825);queues[_0x57e825['uniqueid']][_0x7462('0x1c')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1c')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x29')]=null;queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x1d')]=![];queues[_0x57e825[_0x7462('0x5')]][_0x7462('0x2a')]=null;queues[_0x57e825[_0x7462('0x5')]]['assigned']=!![];queues[_0x57e825['uniqueid']][_0x7462('0x8')]=_0x57e825[_0x7462('0x3e')];queues[_0x57e825[_0x7462('0x5')]]['queuecallercomplete']=!![];queues[_0x57e825[_0x7462('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0x57e825['reason']==_0x7462('0x42')){if(!queues[_0x57e825[_0x7462('0x5')]]['transfer']){queues[_0x57e825[_0x7462('0x5')]][_0x7462('0xa')]='TRANSFER';}}else{queues[_0x57e825[_0x7462('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x57e825['reason'][_0x7462('0x43')]();}utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x44'),_0x57e825[_0x7462('0x5')],queues[_0x57e825[_0x7462('0x5')]]['name'],_0x57e825[_0x7462('0x3e')],queues[_0x57e825['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x57e825[_0x7462('0x5')]]);}}}catch(_0x1289e0){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x45'),_0x57e825[_0x7462('0x5')]),_0x1289e0);}};exports['blindtransfer']=function(_0x1ead09){try{if(!_['isNil'](queues[_0x1ead09[_0x7462('0x46')]])){utils['debug'](util['format'](_0x7462('0x47'),_0x1ead09[_0x7462('0x5')]),_0x1ead09);queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x42')]=!![];queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x48')]='BLIND';queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x49')]=_0x1ead09['extension'];queues[_0x1ead09['transfereeuniqueid']][_0x7462('0x4a')]=_0x1ead09[_0x7462('0x46')];queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0xa')]='BLINDTRANSFER';utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x4b'),_0x1ead09[_0x7462('0x5')],queues[_0x1ead09[_0x7462('0x46')]][_0x7462('0x21')],_0x1ead09['transfereeuniqueid'],_0x1ead09[_0x7462('0x4c')]));}}catch(_0x3f2623){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x47'),_0x1ead09[_0x7462('0x5')]),_0x3f2623);}};exports[_0x7462('0x4d')]=function(_0x5241f7){try{utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x4e'),_0x5241f7[_0x7462('0x4f')]),_0x5241f7);if(_0x5241f7[_0x7462('0x4f')]==_0x5241f7['origtransfererlinkedid']){if(!_[_0x7462('0x19')](queues[_0x5241f7['secondtransfererlinkedid']])){utils[_0x7462('0x3')](util['format'](_0x7462('0x50'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x21')],_0x5241f7['origtransfererexten']));queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x42')]=!![];queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x48')]='ATTENDED';queues[_0x5241f7['secondtransfererlinkedid']][_0x7462('0x49')]=_0x5241f7[_0x7462('0x52')];queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x4a')]=_0x5241f7[_0x7462('0x4f')];queues[_0x5241f7[_0x7462('0x51')]]['queuecallerexitreason']=_0x7462('0x53');}if(!_[_0x7462('0x19')](queues[_0x5241f7[_0x7462('0x54')]])){if(_0x5241f7['transfereelinkedid']&&queues[_0x5241f7[_0x7462('0x55')]]){queues[_0x5241f7[_0x7462('0x55')]][_0x7462('0x23')]=0x1;queues[_0x5241f7[_0x7462('0x46')]]=_['clone'](queues[_0x5241f7['transfereelinkedid']]);queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x56')];queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x23')]=0x2;queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x57')]=queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x57')];queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x58')]=queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x58')];queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x38')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x46')]][_0x7462('0x1b')]=utils[_0x7462('0x17')]();queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x36')]=0x0;queues[_0x5241f7['transfereeuniqueid']]['mohtime']=0x0;utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x59'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7['transfereeuniqueid']]['name'],queues[_0x5241f7['transfereeuniqueid']]['calleridnum'],queues[_0x5241f7['transfereeuniqueid']][_0x7462('0x58')]));}else{utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x5a'),_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x51')]));queues[_0x5241f7[_0x7462('0x54')]]['transfereduniqueid']=_0x5241f7[_0x7462('0x51')];}}}else if(_0x5241f7[_0x7462('0x5b')]==_0x5241f7[_0x7462('0x51')]){if(!_[_0x7462('0x19')](queues[_0x5241f7['origtransfererlinkedid']])){utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x5b')],_0x5241f7[_0x7462('0x5c')]));queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x42')]=!![];queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x48')]=_0x7462('0x5d');queues[_0x5241f7[_0x7462('0x54')]]['transferexten']=_0x5241f7[_0x7462('0x5c')];queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x4a')]=_0x5241f7[_0x7462('0x5b')];queues[_0x5241f7[_0x7462('0x54')]]['queuecallerexitreason']=_0x7462('0x53');}if(!_['isNil'](queues[_0x5241f7[_0x7462('0x51')]])){if(_0x5241f7[_0x7462('0x5e')]&&queues[_0x5241f7[_0x7462('0x5e')]]){queues[_0x5241f7[_0x7462('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x5241f7['transfertargetuniqueid']]=_[_0x7462('0x5f')](queues[_0x5241f7[_0x7462('0x5e')]]);queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x56')];queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x23')]=0x2;queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x57')]=queues[_0x5241f7[_0x7462('0x54')]][_0x7462('0x57')];queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x58')]=queues[_0x5241f7['origtransfererlinkedid']][_0x7462('0x58')];queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x38')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x1b')]=utils[_0x7462('0x17')]();queues[_0x5241f7[_0x7462('0x56')]]['holdtime']=0x0;queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x60')]=0x0;utils[_0x7462('0x3')](util[_0x7462('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7['transfertargetuniqueid']][_0x7462('0x21')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x10')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x57')],queues[_0x5241f7[_0x7462('0x56')]][_0x7462('0x58')]));}else{utils[_0x7462('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5241f7[_0x7462('0x4f')],queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x21')],_0x5241f7[_0x7462('0x54')]));queues[_0x5241f7[_0x7462('0x51')]][_0x7462('0x10')]=_0x5241f7[_0x7462('0x54')];}}}}catch(_0x4093d4){utils['error'](util[_0x7462('0x13')](_0x7462('0x4e'),_0x5241f7[_0x7462('0x4f')]),_0x4093d4);}};exports[_0x7462('0x61')]=function(_0xf4701f){try{if(!_[_0x7462('0x19')](queues[_0xf4701f[_0x7462('0x5')]])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x62'),_0xf4701f['uniqueid']),_0xf4701f);queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x63')]=utils[_0x7462('0x17')]();utils[_0x7462('0x3')](util[_0x7462('0x13')](_0x7462('0x64'),_0xf4701f[_0x7462('0x5')],queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x21')],queues[_0xf4701f[_0x7462('0x5')]][_0x7462('0x63')]));}}catch(_0x7c1152){utils[_0x7462('0x18')](util[_0x7462('0x13')](_0x7462('0x62'),_0xf4701f[_0x7462('0x5')]),_0x7c1152);}};exports['musiconholdstop']=function(_0x4eb151){try{if(!_[_0x7462('0x19')](queues[_0x4eb151[_0x7462('0x5')]])){if(!_[_0x7462('0x19')](queues[_0x4eb151[_0x7462('0x5')]]['musiconholdstartAt'])){utils[_0x7462('0x12')](util[_0x7462('0x13')](_0x7462('0x65'),_0x4eb151[_0x7462('0x5')]),_0x4eb151);queues[_0x4eb151[_0x7462('0x5')]]['mohtime']+=utils[_0x7462('0x37')](utils[_0x7462('0x17')](),queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x63')]);utils['info'](util[_0x7462('0x13')](_0x7462('0x66'),_0x4eb151[_0x7462('0x5')],queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x21')],queues[_0x4eb151[_0x7462('0x5')]][_0x7462('0x60')]));delete queues[_0x4eb151[_0x7462('0x5')]]['musiconholdstartAt'];}}}catch(_0x555783){utils['error'](util[_0x7462('0x13')](_0x7462('0x65'),_0x4eb151[_0x7462('0x5')]),_0x555783);}}; \ No newline at end of file +var _0xacb9=['[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','assign','position','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','reason','transfer','TRANSFER','COMPLETEDBY'];(function(_0x2ea794,_0x55c5a4){var _0x22731d=function(_0x591bf5){while(--_0x591bf5){_0x2ea794['push'](_0x2ea794['shift']());}};_0x22731d(++_0x55c5a4);}(_0xacb9,0xef));var _0x9acb=function(_0x407b00,_0x3868c1){_0x407b00=_0x407b00-0x0;var _0x2450aa=_0xacb9[_0x407b00];return _0x2450aa;};'use strict';var _=require(_0x9acb('0x0'));var util=require(_0x9acb('0x1'));var utils=require(_0x9acb('0x2'));var queues={};function writeDB(_0x3fbed6){utils['info'](util[_0x9acb('0x3')](_0x9acb('0x4'),_0x3fbed6['uniqueid'],_0x3fbed6['channel'],_0x3fbed6['queue'],_0x3fbed6[_0x9acb('0x5')],_0x3fbed6[_0x9acb('0x6')],_0x3fbed6[_0x9acb('0x7')],_0x3fbed6['queuecallerexitreason']));if(_0x3fbed6['queue']){utils[_0x9acb('0x8')](_0x3fbed6[_0x9acb('0x9')])[_0x9acb('0xa')](function(_0x5cc104){if(_0x5cc104){_0x3fbed6['type']=_0x5cc104[_0x9acb('0xb')];}utils[_0x9acb('0xc')](_0x9acb('0xd'),_0x3fbed6);});}else{utils['request']('CreateVoiceQueueReport',_0x3fbed6);}if(_0x3fbed6['transfereduniqueid']){delete queues[_0x3fbed6[_0x9acb('0xe')]];}else{delete queues[_0x3fbed6[_0x9acb('0xf')]];}}exports[_0x9acb('0x10')]=function(_0x20f93c){try{utils['debug'](util[_0x9acb('0x3')](_0x9acb('0x11'),_0x20f93c['uniqueid']),_0x20f93c);utils[_0x9acb('0x12')](util[_0x9acb('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x20f93c['uniqueid'],_0x20f93c['queue'],_0x20f93c['position']));queues[_0x20f93c[_0x9acb('0xf')]]=_[_0x9acb('0x13')](_0x20f93c,{'originalposition':_0x20f93c[_0x9acb('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4acf90){utils['error'](util[_0x9acb('0x3')](_0x9acb('0x11'),_0x20f93c[_0x9acb('0xf')]),_0x4acf90);}};exports[_0x9acb('0x15')]=function(_0x445c51){try{if(!_[_0x9acb('0x16')](queues[_0x445c51[_0x9acb('0xf')]])){utils[_0x9acb('0x17')](util[_0x9acb('0x3')](_0x9acb('0x18'),_0x445c51[_0x9acb('0xf')]),_0x445c51);if(queues[_0x445c51[_0x9acb('0xf')]]['queuecallerleaveAt']){if(!queues[_0x445c51[_0x9acb('0xf')]][_0x9acb('0x19')]&&!queues[_0x445c51['uniqueid']][_0x9acb('0x1a')]){queues[_0x445c51[_0x9acb('0xf')]][_0x9acb('0x1b')]=!![];queues[_0x445c51['uniqueid']][_0x9acb('0x1c')]=utils[_0x9acb('0x1d')]();queues[_0x445c51[_0x9acb('0xf')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x9acb('0x12')](util[_0x9acb('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x445c51[_0x9acb('0xf')],queues[_0x445c51[_0x9acb('0xf')]]['name'],queues[_0x445c51[_0x9acb('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x445c51[_0x9acb('0xf')]]);}else if(queues[_0x445c51[_0x9acb('0xf')]][_0x9acb('0xe')]){utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x1e'),_0x445c51['uniqueid'],queues[_0x445c51[_0x9acb('0xf')]][_0x9acb('0x1f')],queues[_0x445c51['uniqueid']][_0x9acb('0xe')]));queues[queues[_0x445c51['uniqueid']][_0x9acb('0xe')]]=queues[_0x445c51['uniqueid']];queues[queues[_0x445c51[_0x9acb('0xf')]][_0x9acb('0xe')]][_0x9acb('0x20')]=0x2;delete queues[_0x445c51['uniqueid']];}}}catch(_0x54f525){utils['error'](util[_0x9acb('0x3')](_0x9acb('0x18'),_0x445c51[_0x9acb('0xf')]),_0x54f525);}};exports[_0x9acb('0x21')]=function(_0x5e24b6){try{utils[_0x9acb('0x17')](util['format'](_0x9acb('0x22'),_0x5e24b6[_0x9acb('0xf')]),_0x5e24b6);if(!_[_0x9acb('0x16')](_0x5e24b6[_0x9acb('0x23')][_0x9acb('0x24')])&&_0x5e24b6[_0x9acb('0x25')][_0x9acb('0x26')]()!==_0x9acb('0x27')){if(!_[_0x9acb('0x16')](queues[_0x5e24b6['uniqueid']])){queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x19')]=![];queues[_0x5e24b6['uniqueid']][_0x9acb('0x28')]=null;queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x1a')]=!![];queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x29')]=utils[_0x9acb('0x1d')]();queues[_0x5e24b6['uniqueid']][_0x9acb('0x2a')]=_0x5e24b6[_0x9acb('0x25')]['toUpperCase']();utils['info'](util[_0x9acb('0x3')](_0x9acb('0x2b'),_0x5e24b6[_0x9acb('0xf')],queues[_0x5e24b6[_0x9acb('0xf')]]['name'],_0x5e24b6[_0x9acb('0x25')],queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x2a')]));writeDB(queues[_0x5e24b6[_0x9acb('0xf')]]);}}else if(!_[_0x9acb('0x16')](_0x5e24b6['variable'][_0x9acb('0x2c')])){if(!_[_0x9acb('0x16')](queues[_0x5e24b6[_0x9acb('0xf')]])&&!queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x19')]){queues[_0x5e24b6['uniqueid']]['queuecallerabandon']=![];queues[_0x5e24b6['uniqueid']][_0x9acb('0x28')]=null;queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x1a')]=!![];queues[_0x5e24b6[_0x9acb('0xf')]]['queuecallerexitAt']=utils[_0x9acb('0x1d')]();queues[_0x5e24b6['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x2d'),_0x5e24b6[_0x9acb('0xf')],queues[_0x5e24b6['uniqueid']][_0x9acb('0x1f')],_0x5e24b6[_0x9acb('0x25')],queues[_0x5e24b6[_0x9acb('0xf')]][_0x9acb('0x2a')]));}}}catch(_0x618aa3){utils[_0x9acb('0x2e')](util[_0x9acb('0x3')](_0x9acb('0x22'),_0x5e24b6['uniqueid']),_0x618aa3);}};exports[_0x9acb('0x19')]=function(_0x5da9c4){try{if(!_[_0x9acb('0x16')](queues[_0x5da9c4[_0x9acb('0xf')]])){utils[_0x9acb('0x17')](util[_0x9acb('0x3')](_0x9acb('0x2f'),_0x5da9c4[_0x9acb('0xf')]),_0x5da9c4);queues[_0x5da9c4[_0x9acb('0xf')]][_0x9acb('0x1a')]=![];queues[_0x5da9c4['uniqueid']][_0x9acb('0x29')]=null;queues[_0x5da9c4[_0x9acb('0xf')]][_0x9acb('0x19')]=!![];queues[_0x5da9c4[_0x9acb('0xf')]][_0x9acb('0x28')]=utils[_0x9acb('0x1d')]();queues[_0x5da9c4[_0x9acb('0xf')]][_0x9acb('0x2a')]=_0x9acb('0x30');utils['info'](util[_0x9acb('0x3')](_0x9acb('0x31'),_0x5da9c4[_0x9acb('0xf')],queues[_0x5da9c4[_0x9acb('0xf')]][_0x9acb('0x1f')],queues[_0x5da9c4[_0x9acb('0xf')]]['queuecallerexitreason']));}}catch(_0x469abe){utils[_0x9acb('0x2e')](util['format']('[%s][queues][queuecallerabandon]',_0x5da9c4[_0x9acb('0xf')]),_0x469abe);}};exports[_0x9acb('0x32')]=function(_0x8e8e2b){try{if(!_[_0x9acb('0x16')](queues[_0x8e8e2b[_0x9acb('0xf')]])){utils['debug'](util['format'](_0x9acb('0x33'),_0x8e8e2b[_0x9acb('0xf')]),_0x8e8e2b);utils['info'](util['format'](_0x9acb('0x34'),_0x8e8e2b['uniqueid'],queues[_0x8e8e2b['uniqueid']][_0x9acb('0x1f')],_0x8e8e2b[_0x9acb('0x35')],_0x8e8e2b[_0x9acb('0x36')]));queues[_0x8e8e2b['uniqueid']][_0x9acb('0x32')]=!![];queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x37')]=utils[_0x9acb('0x1d')]();queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x38')]=utils[_0x9acb('0x39')](queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x37')],queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x3a')]);queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x14')]=_0x8e8e2b['position'];queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x3b')]=_0x8e8e2b[_0x9acb('0x3b')];queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x35')]=_0x8e8e2b['connectedlinenum'];queues[_0x8e8e2b[_0x9acb('0xf')]][_0x9acb('0x36')]=_0x8e8e2b[_0x9acb('0x36')];}}catch(_0x319aee){utils[_0x9acb('0x2e')](util[_0x9acb('0x3')]('[%s][queues][queuecallerleave]',_0x8e8e2b[_0x9acb('0xf')]),_0x319aee);}};exports[_0x9acb('0x3c')]=function(_0x31b73a){try{if(!_[_0x9acb('0x16')](queues[_0x31b73a['uniqueid']])){utils['debug'](util[_0x9acb('0x3')]('[%s][queues][agentconnect]',_0x31b73a[_0x9acb('0xf')]),_0x31b73a);utils[_0x9acb('0x12')](util['format'](_0x9acb('0x3d'),_0x31b73a['uniqueid'],queues[_0x31b73a[_0x9acb('0xf')]][_0x9acb('0x1f')],_0x31b73a[_0x9acb('0x3e')],_0x31b73a[_0x9acb('0x3f')]));queues[_0x31b73a[_0x9acb('0xf')]]['queuecallerabandon']=![];queues[_0x31b73a['uniqueid']]['queuecallerabandon']=![];queues[_0x31b73a['uniqueid']]['queuecallerabandonAt']=null;queues[_0x31b73a['uniqueid']][_0x9acb('0x1a')]=![];queues[_0x31b73a[_0x9acb('0xf')]][_0x9acb('0x2a')]=null;queues[_0x31b73a[_0x9acb('0xf')]][_0x9acb('0x29')]=null;queues[_0x31b73a[_0x9acb('0xf')]][_0x9acb('0x40')]=!![];queues[_0x31b73a['uniqueid']][_0x9acb('0x7')]=_0x31b73a[_0x9acb('0x3f')];queues[_0x31b73a[_0x9acb('0xf')]][_0x9acb('0x5')]=_0x31b73a[_0x9acb('0x3e')];}}catch(_0x51675d){utils[_0x9acb('0x2e')](util[_0x9acb('0x3')](_0x9acb('0x41'),_0x31b73a[_0x9acb('0xf')]),_0x51675d);}};exports['agentcomplete']=function(_0x16268c){try{if(!_['isNil'](queues[_0x16268c[_0x9acb('0xf')]])){if(queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x37')]){utils[_0x9acb('0x17')](util[_0x9acb('0x3')]('[%s][queues][agentcomplete]',_0x16268c[_0x9acb('0xf')]),_0x16268c);queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x19')]=![];queues[_0x16268c['uniqueid']][_0x9acb('0x19')]=![];queues[_0x16268c['uniqueid']][_0x9acb('0x28')]=null;queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x1a')]=![];queues[_0x16268c[_0x9acb('0xf')]]['queuecallerexitAt']=null;queues[_0x16268c['uniqueid']]['assigned']=!![];queues[_0x16268c['uniqueid']][_0x9acb('0x5')]=_0x16268c[_0x9acb('0x3e')];queues[_0x16268c['uniqueid']]['queuecallercomplete']=!![];queues[_0x16268c['uniqueid']][_0x9acb('0x1c')]=utils[_0x9acb('0x1d')]();if(_0x16268c[_0x9acb('0x42')]==_0x9acb('0x43')){if(!queues[_0x16268c['uniqueid']][_0x9acb('0x43')]){queues[_0x16268c[_0x9acb('0xf')]]['queuecallerexitreason']=_0x9acb('0x44');}}else{queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x2a')]=_0x9acb('0x45')+_0x16268c['reason'][_0x9acb('0x26')]();}utils[_0x9acb('0x12')](util['format'](_0x9acb('0x46'),_0x16268c['uniqueid'],queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x1f')],_0x16268c[_0x9acb('0x3e')],queues[_0x16268c[_0x9acb('0xf')]][_0x9acb('0x2a')]));writeDB(queues[_0x16268c[_0x9acb('0xf')]]);}}}catch(_0x14112c){utils[_0x9acb('0x2e')](util[_0x9acb('0x3')]('[%s][queues][agentcomplete]',_0x16268c['uniqueid']),_0x14112c);}};exports['blindtransfer']=function(_0x96e4fb){try{if(!_['isNil'](queues[_0x96e4fb[_0x9acb('0x47')]])){utils['debug'](util['format'](_0x9acb('0x48'),_0x96e4fb[_0x9acb('0xf')]),_0x96e4fb);queues[_0x96e4fb[_0x9acb('0x47')]][_0x9acb('0x43')]=!![];queues[_0x96e4fb[_0x9acb('0x47')]][_0x9acb('0x49')]=_0x9acb('0x4a');queues[_0x96e4fb[_0x9acb('0x47')]][_0x9acb('0x4b')]=_0x96e4fb[_0x9acb('0x4c')];queues[_0x96e4fb['transfereeuniqueid']]['transferuniqueid']=_0x96e4fb['transfereeuniqueid'];queues[_0x96e4fb['transfereeuniqueid']][_0x9acb('0x2a')]=_0x9acb('0x4d');utils[_0x9acb('0x12')](util[_0x9acb('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x96e4fb[_0x9acb('0xf')],queues[_0x96e4fb[_0x9acb('0x47')]][_0x9acb('0x1f')],_0x96e4fb['transfereeuniqueid'],_0x96e4fb[_0x9acb('0x4c')]));}}catch(_0xaa9970){utils[_0x9acb('0x2e')](util[_0x9acb('0x3')](_0x9acb('0x48'),_0x96e4fb[_0x9acb('0xf')]),_0xaa9970);}};exports[_0x9acb('0x4e')]=function(_0x736f0f){try{utils[_0x9acb('0x17')](util[_0x9acb('0x3')](_0x9acb('0x4f'),_0x736f0f[_0x9acb('0x50')]),_0x736f0f);if(_0x736f0f[_0x9acb('0x50')]==_0x736f0f[_0x9acb('0x51')]){if(!_[_0x9acb('0x16')](queues[_0x736f0f[_0x9acb('0x52')]])){utils[_0x9acb('0x12')](util[_0x9acb('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x736f0f[_0x9acb('0x50')],queues[_0x736f0f['secondtransfererlinkedid']]['name'],_0x736f0f[_0x9acb('0x53')]));queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0x43')]=!![];queues[_0x736f0f[_0x9acb('0x52')]]['transfertype']=_0x9acb('0x54');queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0x4b')]=_0x736f0f[_0x9acb('0x53')];queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0x55')]=_0x736f0f[_0x9acb('0x50')];queues[_0x736f0f['secondtransfererlinkedid']]['queuecallerexitreason']=_0x9acb('0x56');}if(!_['isNil'](queues[_0x736f0f[_0x9acb('0x51')]])){if(_0x736f0f[_0x9acb('0x57')]&&queues[_0x736f0f[_0x9acb('0x57')]]){queues[_0x736f0f['transfereelinkedid']][_0x9acb('0x20')]=0x1;queues[_0x736f0f[_0x9acb('0x47')]]=_[_0x9acb('0x58')](queues[_0x736f0f['transfereelinkedid']]);queues[_0x736f0f['transfereeuniqueid']][_0x9acb('0xe')]=_0x736f0f[_0x9acb('0x59')];queues[_0x736f0f[_0x9acb('0x47')]][_0x9acb('0x20')]=0x2;queues[_0x736f0f[_0x9acb('0x47')]]['calleridnum']=queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0x6')];queues[_0x736f0f[_0x9acb('0x47')]]['calleridname']=queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0x5a')];queues[_0x736f0f[_0x9acb('0x47')]][_0x9acb('0x3a')]=utils[_0x9acb('0x1d')]();queues[_0x736f0f[_0x9acb('0x47')]]['queuecallerleaveAt']=utils['now']();queues[_0x736f0f['transfereeuniqueid']][_0x9acb('0x38')]=0x0;queues[_0x736f0f[_0x9acb('0x47')]][_0x9acb('0x5b')]=0x0;utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x5c'),_0x736f0f['origtransfereruniqueid'],queues[_0x736f0f['transfereeuniqueid']][_0x9acb('0x1f')],queues[_0x736f0f[_0x9acb('0x47')]][_0x9acb('0x6')],queues[_0x736f0f['transfereeuniqueid']][_0x9acb('0x5a')]));}else{utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x5d'),_0x736f0f[_0x9acb('0x50')],queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x1f')],_0x736f0f[_0x9acb('0x52')]));queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0xe')]=_0x736f0f[_0x9acb('0x52')];}}}else if(_0x736f0f[_0x9acb('0x5e')]==_0x736f0f[_0x9acb('0x52')]){if(!_[_0x9acb('0x16')](queues[_0x736f0f['origtransfererlinkedid']])){utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x5f'),_0x736f0f[_0x9acb('0x50')],queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x1f')],_0x736f0f[_0x9acb('0x5e')],_0x736f0f[_0x9acb('0x60')]));queues[_0x736f0f[_0x9acb('0x51')]]['transfer']=!![];queues[_0x736f0f['origtransfererlinkedid']][_0x9acb('0x49')]=_0x9acb('0x54');queues[_0x736f0f[_0x9acb('0x51')]]['transferexten']=_0x736f0f[_0x9acb('0x60')];queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x55')]=_0x736f0f[_0x9acb('0x5e')];queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x2a')]=_0x9acb('0x56');}if(!_['isNil'](queues[_0x736f0f[_0x9acb('0x52')]])){if(_0x736f0f['transfertargetlinkedid']&&queues[_0x736f0f[_0x9acb('0x61')]]){queues[_0x736f0f['transfertargetlinkedid']][_0x9acb('0x20')]=0x1;queues[_0x736f0f[_0x9acb('0x59')]]=_[_0x9acb('0x58')](queues[_0x736f0f[_0x9acb('0x61')]]);queues[_0x736f0f['transfertargetuniqueid']][_0x9acb('0xe')]=_0x736f0f[_0x9acb('0x59')];queues[_0x736f0f['transfertargetuniqueid']][_0x9acb('0x20')]=0x2;queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x6')]=queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x6')];queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x5a')]=queues[_0x736f0f[_0x9acb('0x51')]][_0x9acb('0x5a')];queues[_0x736f0f['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x9acb('0x1d')]();queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x37')]=utils[_0x9acb('0x1d')]();queues[_0x736f0f[_0x9acb('0x59')]]['holdtime']=0x0;queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x5b')]=0x0;utils[_0x9acb('0x12')](util[_0x9acb('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x736f0f[_0x9acb('0x50')],queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x1f')],queues[_0x736f0f[_0x9acb('0x59')]]['transfereduniqueid'],queues[_0x736f0f[_0x9acb('0x59')]][_0x9acb('0x6')],queues[_0x736f0f['transfertargetuniqueid']][_0x9acb('0x5a')]));}else{utils[_0x9acb('0x12')](util['format'](_0x9acb('0x5d'),_0x736f0f[_0x9acb('0x50')],queues[_0x736f0f[_0x9acb('0x52')]]['name'],_0x736f0f[_0x9acb('0x51')]));queues[_0x736f0f[_0x9acb('0x52')]][_0x9acb('0xe')]=_0x736f0f[_0x9acb('0x51')];}}}}catch(_0x17b629){utils['error'](util[_0x9acb('0x3')](_0x9acb('0x4f'),_0x736f0f[_0x9acb('0x50')]),_0x17b629);}};exports['musiconholdstart']=function(_0xc2fcfb){try{if(!_['isNil'](queues[_0xc2fcfb[_0x9acb('0xf')]])){utils[_0x9acb('0x17')](util['format'](_0x9acb('0x62'),_0xc2fcfb[_0x9acb('0xf')]),_0xc2fcfb);queues[_0xc2fcfb[_0x9acb('0xf')]]['musiconholdstartAt']=utils['now']();utils[_0x9acb('0x12')](util[_0x9acb('0x3')](_0x9acb('0x63'),_0xc2fcfb[_0x9acb('0xf')],queues[_0xc2fcfb['uniqueid']]['name'],queues[_0xc2fcfb['uniqueid']][_0x9acb('0x64')]));}}catch(_0x5004b1){utils[_0x9acb('0x2e')](util['format']('[%s][queues][musiconholdstart]',_0xc2fcfb[_0x9acb('0xf')]),_0x5004b1);}};exports[_0x9acb('0x65')]=function(_0x3a1d3c){try{if(!_[_0x9acb('0x16')](queues[_0x3a1d3c[_0x9acb('0xf')]])){if(!_[_0x9acb('0x16')](queues[_0x3a1d3c[_0x9acb('0xf')]][_0x9acb('0x64')])){utils[_0x9acb('0x17')](util[_0x9acb('0x3')](_0x9acb('0x66'),_0x3a1d3c[_0x9acb('0xf')]),_0x3a1d3c);queues[_0x3a1d3c[_0x9acb('0xf')]][_0x9acb('0x5b')]+=utils['diffTime'](utils[_0x9acb('0x1d')](),queues[_0x3a1d3c['uniqueid']][_0x9acb('0x64')]);utils[_0x9acb('0x12')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3a1d3c['uniqueid'],queues[_0x3a1d3c[_0x9acb('0xf')]][_0x9acb('0x1f')],queues[_0x3a1d3c[_0x9acb('0xf')]][_0x9acb('0x5b')]));delete queues[_0x3a1d3c[_0x9acb('0xf')]][_0x9acb('0x64')];}}}catch(_0x52d6b5){utils[_0x9acb('0x2e')](util['format'](_0x9acb('0x66'),_0x3a1d3c['uniqueid']),_0x52d6b5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8f59faa..d1eec80 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 _0x443b=['CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','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','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','name','UserId'];(function(_0x4c1951,_0x5db715){var _0x2534cc=function(_0xdd8b6e){while(--_0xdd8b6e){_0x4c1951['push'](_0x4c1951['shift']());}};_0x2534cc(++_0x5db715);}(_0x443b,0x1ae));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb443('0x0'));var util=require(_0xb443('0x1'));var utils=require(_0xb443('0x2'));var transfers=require(_0xb443('0x3'));var recordings={};function writeDB(_0x338607){var _0x42bb4c;utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][writeDB]',_0x338607[_0xb443('0x6')]));if(transfers[_0xb443('0x7')][_0x338607[_0xb443('0x6')]]){_0x42bb4c=_0x338607['uniqueid'];_0x338607[_0xb443('0x6')]=transfers['blinds'][_0x338607['uniqueid']][_0xb443('0x8')];}if(_0x338607['accountcode']){utils[_0xb443('0x9')](_0x338607[_0xb443('0xa')])[_0xb443('0xb')](function(_0x10df09){if(_0x10df09){_0x338607['membername']=_0x10df09[_0xb443('0xc')];_0x338607[_0xb443('0xd')]=_0x10df09['id'];}utils['request'](_0xb443('0xe'),_0x338607);});}else{utils[_0xb443('0xf')](_0xb443('0xe'),_0x338607);}if(_0x42bb4c)delete transfers[_0xb443('0x7')][_0x42bb4c];}exports[_0xb443('0x10')]=function(_0x2bbd2e){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x12'),_0x2bbd2e['uniqueid']),_0x2bbd2e);if(_0x2bbd2e['uniqueid']==_0x2bbd2e['linkedid']){utils[_0xb443('0x4')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2bbd2e[_0xb443('0x6')],_0x2bbd2e[_0xb443('0x13')],_0x2bbd2e[_0xb443('0x14')]));recordings[_0x2bbd2e[_0xb443('0x6')]]={'uniqueid':_0x2bbd2e[_0xb443('0x6')],'accountcode':_0x2bbd2e['accountcode'],'exten':_0x2bbd2e['exten'],'context':_0x2bbd2e[_0xb443('0x13')],'channel':_0x2bbd2e[_0xb443('0x15')],'monitors':[]};}}catch(_0x272da6){utils['error'](util['format'](_0xb443('0x12'),_0x2bbd2e[_0xb443('0x6')]),_0x272da6);}};exports[_0xb443('0x16')]=function(_0x22e7ab){try{utils[_0xb443('0x11')](util['format'](_0xb443('0x17'),_0x22e7ab[_0xb443('0x6')]),_0x22e7ab);if(!_[_0xb443('0x18')](recordings[_0x22e7ab[_0xb443('0x6')]])&&_0x22e7ab['channelstate']==0x6){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x19'),_0x22e7ab[_0xb443('0x6')],_0x22e7ab[_0xb443('0x13')],_0x22e7ab[_0xb443('0x15')]));}else if(!_['isNil'](recordings[_0x22e7ab[_0xb443('0x1a')]])&&_0x22e7ab['channelstate']==0x6&&_0x22e7ab[_0xb443('0x13')]!=_0xb443('0x1b')){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x1c'),_0x22e7ab[_0xb443('0x6')],_0x22e7ab[_0xb443('0x1a')],_0x22e7ab['context'],_0x22e7ab['channel']));recordings[_0x22e7ab['linkedid']][_0xb443('0xa')]=_0x22e7ab[_0xb443('0xa')];}}catch(_0x39b45e){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x17'),_0x22e7ab[_0xb443('0x6')]),_0x39b45e);}};exports[_0xb443('0x1e')]=function(_0x588410){try{if(!_[_0xb443('0x18')](_0x588410[_0xb443('0x1f')])&&!_[_0xb443('0x18')](_0x588410['variable'][_0xb443('0x20')])){utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x21'),_0x588410[_0xb443('0x6')]),_0x588410);utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x22'),_0x588410['uniqueid'],_0x588410['variable'],_0x588410[_0xb443('0x23')]));if(_[_0xb443('0x24')](_0x588410[_0xb443('0x23')],_0xb443('0x25'))){_0x588410[_0xb443('0x23')]=_0x588410['value'][_0xb443('0x26')]('.wav49',_0xb443('0x27'));}if(recordings[_0x588410['linkedid']]){var _0x2a696e=_[_0xb443('0x28')](recordings[_0x588410[_0xb443('0x1a')]]['monitors'],{'value':_0x588410[_0xb443('0x23')]});if(_[_0xb443('0x18')](_0x2a696e)){recordings[_0x588410[_0xb443('0x1a')]][_0xb443('0x29')][_0xb443('0x2a')]({'value':_0x588410[_0xb443('0x23')]});}}}}catch(_0x1826ca){utils['error'](util['format'](_0xb443('0x21'),_0x588410[_0xb443('0x6')]),_0x1826ca);}};exports[_0xb443('0x2b')]=function(_0x4df719){try{if(!_[_0xb443('0x18')](recordings[_0x4df719[_0xb443('0x6')]])){utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x2c'),_0x4df719['uniqueid']),_0x4df719);utils[_0xb443('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4df719[_0xb443('0x6')],_0x4df719[_0xb443('0x2d')],_0x4df719[_0xb443('0x2e')],_0x4df719[_0xb443('0x2f')]));recordings[_0x4df719['uniqueid']][_0xb443('0x2d')]=_0x4df719[_0xb443('0x2d')];recordings[_0x4df719['uniqueid']][_0xb443('0x2e')]=_0x4df719[_0xb443('0x2e')];recordings[_0x4df719[_0xb443('0x6')]]['connectedlinenum']=_0x4df719[_0xb443('0x30')];recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x31')]=_0x4df719[_0xb443('0x31')];if(recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x32')]==_0xb443('0x33')&&recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0xa')]){recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x30')]=recordings[_0x4df719['uniqueid']][_0xb443('0xa')];recordings[_0x4df719[_0xb443('0x6')]][_0xb443('0x31')]='';}recordings[_0x4df719[_0xb443('0x6')]]['monitors']['forEach'](function(_0x30ec43){var _0x42b04a=_['clone'](recordings[_0x4df719[_0xb443('0x6')]]);_0x42b04a[_0xb443('0x23')]=_0x30ec43[_0xb443('0x23')];writeDB(_0x42b04a);});delete recordings[_0x4df719['uniqueid']];}}catch(_0x3d11fc){utils[_0xb443('0x1d')](util['format']('[%s][recordings][hangup]',_0x4df719['uniqueid']),_0x3d11fc);}};exports[_0xb443('0x34')]=function(_0x48e563){try{if(!_[_0xb443('0x18')](recordings[_0x48e563[_0xb443('0x6')]])){utils[_0xb443('0x11')](util['format'](_0xb443('0x35'),_0x48e563['uniqueid']),_0x48e563);utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x48e563[_0xb443('0x6')],_0x48e563[_0xb443('0x36')],_0x48e563[_0xb443('0x37')]));if(_0x48e563[_0xb443('0x36')][_0xb443('0x38')]()==_0xb443('0x39')&&_['startsWith'](_0x48e563[_0xb443('0x37')][_0xb443('0x38')](),_0xb443('0x3a'))){var _0x369b26=_0x48e563[_0xb443('0x37')]['split']('=');var _0xce10b2=_0x369b26[0x0][_0xb443('0x3b')](_0x369b26[0x0][_0xb443('0x3c')]('(')+0x1,_0x369b26[0x0][_0xb443('0x3c')](')'));var _0x33a81f=_0x369b26[0x1];recordings[_0x48e563[_0xb443('0x6')]][_0xce10b2]=_0x33a81f;}}}catch(_0x532b6d){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x35'),_0x48e563[_0xb443('0x6')]),_0x532b6d);}};exports[_0xb443('0x3d')]=function(_0x278f17){try{if(!_[_0xb443('0x18')](recordings[_0x278f17[_0xb443('0x6')]])){utils['debug'](util[_0xb443('0x5')](_0xb443('0x3e'),_0x278f17[_0xb443('0x6')]),_0x278f17);utils['info'](util['format'](_0xb443('0x3f'),_0x278f17[_0xb443('0x6')],_0x278f17[_0xb443('0x40')]));recordings[_0x278f17[_0xb443('0x6')]]['queue']=_0x278f17[_0xb443('0x40')];}}catch(_0x58a914){utils['error'](util[_0xb443('0x5')](_0xb443('0x3e'),_0x278f17[_0xb443('0x6')]),_0x58a914);}};exports[_0xb443('0x41')]=function(_0x5cbc2b){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x42'),_0x5cbc2b['uniqueid']),_0x5cbc2b);utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x43'),_0x5cbc2b['uniqueid'],_0x5cbc2b[_0xb443('0x44')],_0x5cbc2b[_0xb443('0x45')],_0x5cbc2b[_0xb443('0x46')],_0x5cbc2b[_0xb443('0x47')]));if(recordings[_0x5cbc2b[_0xb443('0x48')]]&&transfers[_0xb443('0x7')][_0x5cbc2b[_0xb443('0x48')]]){transfers[_0xb443('0x7')][_0x5cbc2b['transfereruniqueid']][_0xb443('0x49')]=!![];}}catch(_0x41c633){utils[_0xb443('0x1d')](util[_0xb443('0x5')](_0xb443('0x42'),_0x5cbc2b[_0xb443('0x6')]),_0x41c633);}}; \ No newline at end of file +var _0x59a6=['transfereeuniqueid','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','context','exten','channel','[%s][recordings][newchannel]','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','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','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds'];(function(_0x8fc09c,_0x4b12e4){var _0x2dba47=function(_0x14a7ba){while(--_0x14a7ba){_0x8fc09c['push'](_0x8fc09c['shift']());}};_0x2dba47(++_0x4b12e4);}(_0x59a6,0x1af));var _0x659a=function(_0x24025d,_0x32a7ab){_0x24025d=_0x24025d-0x0;var _0x40f5b2=_0x59a6[_0x24025d];return _0x40f5b2;};'use strict';var _=require('lodash');var util=require(_0x659a('0x0'));var utils=require(_0x659a('0x1'));var transfers=require(_0x659a('0x2'));var recordings={};function writeDB(_0x4fbc04){var _0x157f34;utils[_0x659a('0x3')](util['format'](_0x659a('0x4'),_0x4fbc04[_0x659a('0x5')]));if(transfers[_0x659a('0x6')][_0x4fbc04['uniqueid']]){_0x157f34=_0x4fbc04[_0x659a('0x5')];_0x4fbc04[_0x659a('0x5')]=transfers[_0x659a('0x6')][_0x4fbc04[_0x659a('0x5')]][_0x659a('0x7')];}if(_0x4fbc04[_0x659a('0x8')]){utils['getUserByInternal'](_0x4fbc04[_0x659a('0x8')])['then'](function(_0x1df5a0){if(_0x1df5a0){_0x4fbc04[_0x659a('0x9')]=_0x1df5a0[_0x659a('0xa')];_0x4fbc04[_0x659a('0xb')]=_0x1df5a0['id'];}utils[_0x659a('0xc')](_0x659a('0xd'),_0x4fbc04);});}else{utils[_0x659a('0xc')]('CreateVoiceRecording',_0x4fbc04);}if(_0x157f34)delete transfers[_0x659a('0x6')][_0x157f34];}exports[_0x659a('0xe')]=function(_0x27f78e){try{utils[_0x659a('0xf')](util['format']('[%s][recordings][newchannel]',_0x27f78e['uniqueid']),_0x27f78e);if(_0x27f78e[_0x659a('0x5')]==_0x27f78e['linkedid']){utils[_0x659a('0x3')](util[_0x659a('0x10')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x27f78e['uniqueid'],_0x27f78e[_0x659a('0x11')],_0x27f78e[_0x659a('0x12')]));recordings[_0x27f78e[_0x659a('0x5')]]={'uniqueid':_0x27f78e['uniqueid'],'accountcode':_0x27f78e[_0x659a('0x8')],'exten':_0x27f78e['exten'],'context':_0x27f78e[_0x659a('0x11')],'channel':_0x27f78e[_0x659a('0x13')],'monitors':[]};}}catch(_0x3fea8d){utils['error'](util['format'](_0x659a('0x14'),_0x27f78e[_0x659a('0x5')]),_0x3fea8d);}};exports['newstate']=function(_0x56fb8b){try{utils[_0x659a('0xf')](util['format'](_0x659a('0x15'),_0x56fb8b[_0x659a('0x5')]),_0x56fb8b);if(!_['isNil'](recordings[_0x56fb8b[_0x659a('0x5')]])&&_0x56fb8b[_0x659a('0x16')]==0x6){utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x17'),_0x56fb8b[_0x659a('0x5')],_0x56fb8b[_0x659a('0x11')],_0x56fb8b['channel']));}else if(!_[_0x659a('0x18')](recordings[_0x56fb8b[_0x659a('0x19')]])&&_0x56fb8b[_0x659a('0x16')]==0x6&&_0x56fb8b[_0x659a('0x11')]!=_0x659a('0x1a')){utils['info'](util[_0x659a('0x10')](_0x659a('0x1b'),_0x56fb8b['uniqueid'],_0x56fb8b[_0x659a('0x19')],_0x56fb8b['context'],_0x56fb8b[_0x659a('0x13')]));recordings[_0x56fb8b[_0x659a('0x19')]]['accountcode']=_0x56fb8b[_0x659a('0x8')];}}catch(_0x4e800c){utils[_0x659a('0x1c')](util[_0x659a('0x10')]('[%s][recordings][newstate]',_0x56fb8b[_0x659a('0x5')]),_0x4e800c);}};exports[_0x659a('0x1d')]=function(_0x2556c3){try{if(!_[_0x659a('0x18')](_0x2556c3[_0x659a('0x1e')])&&!_['isNil'](_0x2556c3[_0x659a('0x1e')][_0x659a('0x1f')])){utils[_0x659a('0xf')](util['format']('[%s][recordings][varset]',_0x2556c3['uniqueid']),_0x2556c3);utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x20'),_0x2556c3['uniqueid'],_0x2556c3[_0x659a('0x1e')],_0x2556c3[_0x659a('0x21')]));if(_[_0x659a('0x22')](_0x2556c3[_0x659a('0x21')],_0x659a('0x23'))){_0x2556c3['value']=_0x2556c3[_0x659a('0x21')][_0x659a('0x24')](_0x659a('0x23'),_0x659a('0x25'));}if(recordings[_0x2556c3[_0x659a('0x19')]]){var _0x3f9625=_[_0x659a('0x26')](recordings[_0x2556c3['linkedid']][_0x659a('0x27')],{'value':_0x2556c3[_0x659a('0x21')]});if(_[_0x659a('0x18')](_0x3f9625)){recordings[_0x2556c3[_0x659a('0x19')]][_0x659a('0x27')][_0x659a('0x28')]({'value':_0x2556c3['value']});}}}}catch(_0x567f29){utils[_0x659a('0x1c')](util[_0x659a('0x10')](_0x659a('0x29'),_0x2556c3[_0x659a('0x5')]),_0x567f29);}};exports['hangup']=function(_0x430d9e){try{if(!_['isNil'](recordings[_0x430d9e[_0x659a('0x5')]])){utils[_0x659a('0xf')](util[_0x659a('0x10')](_0x659a('0x2a'),_0x430d9e[_0x659a('0x5')]),_0x430d9e);utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x2b'),_0x430d9e[_0x659a('0x5')],_0x430d9e[_0x659a('0x2c')],_0x430d9e[_0x659a('0x2d')],_0x430d9e[_0x659a('0x2e')]));recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x2c')]=_0x430d9e[_0x659a('0x2c')];recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x2d')]=_0x430d9e[_0x659a('0x2d')];recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x2f')]=_0x430d9e[_0x659a('0x2f')];recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x30')]=_0x430d9e['connectedlinename'];if(recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x31')]==_0x659a('0x32')&&recordings[_0x430d9e[_0x659a('0x5')]]['accountcode']){recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x2f')]=recordings[_0x430d9e[_0x659a('0x5')]][_0x659a('0x8')];recordings[_0x430d9e['uniqueid']][_0x659a('0x30')]='';}recordings[_0x430d9e[_0x659a('0x5')]]['monitors'][_0x659a('0x33')](function(_0x5e9e9f){var _0x570fde=_[_0x659a('0x34')](recordings[_0x430d9e['uniqueid']]);_0x570fde[_0x659a('0x21')]=_0x5e9e9f['value'];writeDB(_0x570fde);});delete recordings[_0x430d9e[_0x659a('0x5')]];}}catch(_0x5e0e12){utils['error'](util[_0x659a('0x10')]('[%s][recordings][hangup]',_0x430d9e[_0x659a('0x5')]),_0x5e0e12);}};exports['newexten']=function(_0x379ce6){try{if(!_[_0x659a('0x18')](recordings[_0x379ce6[_0x659a('0x5')]])){utils[_0x659a('0xf')](util[_0x659a('0x10')](_0x659a('0x35'),_0x379ce6[_0x659a('0x5')]),_0x379ce6);utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x36'),_0x379ce6[_0x659a('0x5')],_0x379ce6[_0x659a('0x37')],_0x379ce6[_0x659a('0x38')]));if(_0x379ce6[_0x659a('0x37')][_0x659a('0x39')]()==_0x659a('0x3a')&&_['startsWith'](_0x379ce6[_0x659a('0x38')][_0x659a('0x39')](),'cdr')){var _0xff01c5=_0x379ce6['appdata'][_0x659a('0x3b')]('=');var _0x3d9bc1=_0xff01c5[0x0][_0x659a('0x3c')](_0xff01c5[0x0][_0x659a('0x3d')]('(')+0x1,_0xff01c5[0x0]['lastIndexOf'](')'));var _0x3717af=_0xff01c5[0x1];recordings[_0x379ce6['uniqueid']][_0x3d9bc1]=_0x3717af;}}}catch(_0x39cb31){utils[_0x659a('0x1c')](util['format'](_0x659a('0x35'),_0x379ce6[_0x659a('0x5')]),_0x39cb31);}};exports[_0x659a('0x3e')]=function(_0x19e0bb){try{if(!_['isNil'](recordings[_0x19e0bb[_0x659a('0x5')]])){utils[_0x659a('0xf')](util[_0x659a('0x10')](_0x659a('0x3f'),_0x19e0bb[_0x659a('0x5')]),_0x19e0bb);utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x40'),_0x19e0bb[_0x659a('0x5')],_0x19e0bb[_0x659a('0x41')]));recordings[_0x19e0bb[_0x659a('0x5')]][_0x659a('0x41')]=_0x19e0bb[_0x659a('0x41')];}}catch(_0x1370b0){utils[_0x659a('0x1c')](util[_0x659a('0x10')](_0x659a('0x3f'),_0x19e0bb['uniqueid']),_0x1370b0);}};exports[_0x659a('0x42')]=function(_0x40ae08){try{utils['debug'](util[_0x659a('0x10')](_0x659a('0x43'),_0x40ae08[_0x659a('0x5')]),_0x40ae08);utils[_0x659a('0x3')](util[_0x659a('0x10')](_0x659a('0x44'),_0x40ae08[_0x659a('0x5')],_0x40ae08['transferercalleridnum'],_0x40ae08['transferercalleridname'],_0x40ae08[_0x659a('0x45')],_0x40ae08[_0x659a('0x46')]));if(recordings[_0x40ae08['transfereruniqueid']]&&transfers['blinds'][_0x40ae08[_0x659a('0x47')]]){transfers[_0x659a('0x6')][_0x40ae08['transfereruniqueid']][_0x659a('0x48')]=!![];}}catch(_0x5b6751){utils[_0x659a('0x1c')](util['format'](_0x659a('0x43'),_0x40ae08['uniqueid']),_0x5b6751);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index e2e94da..04e0346 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 _0x56d4=['util','./utils','info','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','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','assign','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash'];(function(_0x1a41e1,_0x5b2099){var _0x2bbd3e=function(_0x38b92a){while(--_0x38b92a){_0x1a41e1['push'](_0x1a41e1['shift']());}};_0x2bbd3e(++_0x5b2099);}(_0x56d4,0x179));var _0x456d=function(_0x45aced,_0x2f6ba8){_0x45aced=_0x45aced-0x0;var _0x9b8720=_0x56d4[_0x45aced];return _0x9b8720;};'use strict';var _=require(_0x456d('0x0'));var util=require(_0x456d('0x1'));var utils=require(_0x456d('0x2'));function writeDB(_0x2f9239){utils[_0x456d('0x3')](util[_0x456d('0x4')](_0x456d('0x5'),_0x2f9239[_0x456d('0x6')]===_0x456d('0x7')?_0x2f9239[_0x456d('0x8')]:_0x2f9239[_0x456d('0x9')],_0x2f9239[_0x456d('0x6')]));utils[_0x456d('0xa')]('CreateVoiceTransferReport',_0x2f9239);}exports[_0x456d('0xb')]={};exports[_0x456d('0xc')]=function(_0x368b4e){try{utils[_0x456d('0xd')](util[_0x456d('0x4')](_0x456d('0xe'),_0x368b4e[_0x456d('0x9')]),_0x368b4e);utils[_0x456d('0x3')](util[_0x456d('0x4')](_0x456d('0xf'),_0x368b4e[_0x456d('0x9')],_0x368b4e[_0x456d('0x10')],_0x368b4e[_0x456d('0x11')],_0x368b4e[_0x456d('0x12')],_0x368b4e[_0x456d('0x13')]));_0x368b4e['type']=_0x456d('0x14');exports[_0x456d('0xb')][_0x368b4e[_0x456d('0x15')]]=_0x368b4e;writeDB(_0x368b4e);}catch(_0x38785c){utils[_0x456d('0x16')](util[_0x456d('0x4')](_0x456d('0xe'),_0x368b4e[_0x456d('0x9')]),_0x38785c);}};exports[_0x456d('0x17')]=function(_0x39583c){try{utils[_0x456d('0xd')](util[_0x456d('0x4')](_0x456d('0x18'),_0x39583c[_0x456d('0x8')]),_0x39583c);utils[_0x456d('0x3')](util[_0x456d('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x39583c['origtransfereruniqueid'],_0x39583c[_0x456d('0x19')],_0x39583c[_0x456d('0x1a')],_0x39583c[_0x456d('0x1b')],_0x39583c[_0x456d('0x1c')]));_0x39583c=_['assign'](_0x39583c,{'transfererchannel':_0x39583c[_0x456d('0x1d')],'transferercalleridnum':_0x39583c[_0x456d('0x19')],'transferercalleridname':_0x39583c[_0x456d('0x1a')],'transfererconnectedlinenum':_0x39583c[_0x456d('0x1e')],'transfererconnectedlinename':_0x39583c[_0x456d('0x1f')],'transfereraccountcode':_0x39583c[_0x456d('0x20')],'transferercontext':_0x39583c[_0x456d('0x21')],'transfererexten':_0x39583c[_0x456d('0x22')],'transfererlinkedid':_0x39583c[_0x456d('0x23')],'context':_0x39583c[_0x456d('0x24')],'extension':_0x39583c['origtransfererexten'],'type':_0x456d('0x7')});if(_['isNil'](_0x39583c[_0x456d('0x25')])){_0x39583c=_[_0x456d('0x26')](_0x39583c,{'transfereechannel':_0x39583c['transfertargetchannel'],'transfereecalleridnum':_0x39583c[_0x456d('0x1b')],'transfereecalleridname':_0x39583c[_0x456d('0x1c')],'transfereeconnectedlinenum':_0x39583c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x39583c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x39583c['transfertargetaccountcode'],'transfereecontext':_0x39583c[_0x456d('0x27')],'transfereeexten':_0x39583c[_0x456d('0x28')],'transfereelinkedid':_0x39583c[_0x456d('0x29')]});}writeDB(_0x39583c);}catch(_0x25b64f){utils['error'](util[_0x456d('0x4')](_0x456d('0x18'),_0x39583c[_0x456d('0x8')]),_0x25b64f);}}; \ No newline at end of file +var _0x4d66=['type','blinds','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x1d83dd,_0x1c092d){var _0x3a3abe=function(_0x12dc5e){while(--_0x12dc5e){_0x1d83dd['push'](_0x1d83dd['shift']());}};_0x3a3abe(++_0x1c092d);}(_0x4d66,0x176));var _0x64d6=function(_0x57cc7a,_0x1e738d){_0x57cc7a=_0x57cc7a-0x0;var _0x5d6159=_0x4d66[_0x57cc7a];return _0x5d6159;};'use strict';var _=require(_0x64d6('0x0'));var util=require(_0x64d6('0x1'));var utils=require(_0x64d6('0x2'));function writeDB(_0x3f29a3){utils[_0x64d6('0x3')](util[_0x64d6('0x4')](_0x64d6('0x5'),_0x3f29a3['type']==='attended'?_0x3f29a3['origtransfereruniqueid']:_0x3f29a3['uniqueid'],_0x3f29a3[_0x64d6('0x6')]));utils['request']('CreateVoiceTransferReport',_0x3f29a3);}exports[_0x64d6('0x7')]={};exports[_0x64d6('0x8')]=function(_0x3470c9){try{utils['debug'](util[_0x64d6('0x4')](_0x64d6('0x9'),_0x3470c9[_0x64d6('0xa')]),_0x3470c9);utils[_0x64d6('0x3')](util[_0x64d6('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3470c9['uniqueid'],_0x3470c9[_0x64d6('0xb')],_0x3470c9[_0x64d6('0xc')],_0x3470c9[_0x64d6('0xd')],_0x3470c9[_0x64d6('0xe')]));_0x3470c9[_0x64d6('0x6')]=_0x64d6('0xf');exports[_0x64d6('0x7')][_0x3470c9[_0x64d6('0x10')]]=_0x3470c9;writeDB(_0x3470c9);}catch(_0x11d7e3){utils[_0x64d6('0x11')](util['format'](_0x64d6('0x9'),_0x3470c9['uniqueid']),_0x11d7e3);}};exports[_0x64d6('0x12')]=function(_0x38c27c){try{utils['debug'](util[_0x64d6('0x4')](_0x64d6('0x13'),_0x38c27c[_0x64d6('0x14')]),_0x38c27c);utils[_0x64d6('0x3')](util[_0x64d6('0x4')](_0x64d6('0x15'),_0x38c27c['origtransfereruniqueid'],_0x38c27c[_0x64d6('0x16')],_0x38c27c['origtransferercalleridname'],_0x38c27c[_0x64d6('0x17')],_0x38c27c['transfertargetcalleridname']));_0x38c27c=_[_0x64d6('0x18')](_0x38c27c,{'transfererchannel':_0x38c27c[_0x64d6('0x19')],'transferercalleridnum':_0x38c27c[_0x64d6('0x16')],'transferercalleridname':_0x38c27c[_0x64d6('0x1a')],'transfererconnectedlinenum':_0x38c27c[_0x64d6('0x1b')],'transfererconnectedlinename':_0x38c27c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x38c27c['origtransfereraccountcode'],'transferercontext':_0x38c27c['secondtransferercontext'],'transfererexten':_0x38c27c[_0x64d6('0x1c')],'transfererlinkedid':_0x38c27c[_0x64d6('0x1d')],'context':_0x38c27c['origtransferercontext'],'extension':_0x38c27c[_0x64d6('0x1e')],'type':_0x64d6('0x1f')});if(_[_0x64d6('0x20')](_0x38c27c['transfereechannel'])){_0x38c27c=_[_0x64d6('0x18')](_0x38c27c,{'transfereechannel':_0x38c27c[_0x64d6('0x21')],'transfereecalleridnum':_0x38c27c[_0x64d6('0x17')],'transfereecalleridname':_0x38c27c[_0x64d6('0x22')],'transfereeconnectedlinenum':_0x38c27c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x38c27c[_0x64d6('0x23')],'transfereeaccountcode':_0x38c27c['transfertargetaccountcode'],'transfereecontext':_0x38c27c[_0x64d6('0x24')],'transfereeexten':_0x38c27c[_0x64d6('0x25')],'transfereelinkedid':_0x38c27c['transfertargetlinkedid']});}writeDB(_0x38c27c);}catch(_0x44ae53){utils[_0x64d6('0x11')](util['format'](_0x64d6('0x13'),_0x38c27c[_0x64d6('0x14')]),_0x44ae53);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 62cd52b..e039e7b 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 _0x531a=['[utils][request]\x20name:%s','catch','GetUser','name','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','info','error','inspect','request','then','debug'];(function(_0x375cca,_0x407894){var _0x34f39c=function(_0x3fea86){while(--_0x3fea86){_0x375cca['push'](_0x375cca['shift']());}};_0x34f39c(++_0x407894);}(_0x531a,0x79));var _0xa531=function(_0x1f95f7,_0x361b99){_0x1f95f7=_0x1f95f7-0x0;var _0x1a0a51=_0x531a[_0x1f95f7];return _0x1a0a51;};'use strict';var BPromise=require(_0xa531('0x0'));var jayson=require('jayson/promise');var moment=require(_0xa531('0x1'));var util=require(_0xa531('0x2'));var client=jayson[_0xa531('0x3')][_0xa531('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xa531('0x5')]=function(_0x2f2b7a,_0x34dc3c){logger[_0xa531('0x5')](_0x2f2b7a,_0x34dc3c?util['inspect'](_0x34dc3c,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3bf622,_0x19dae3){logger['debug'](_0x3bf622,_0x19dae3?util['inspect'](_0x19dae3,{'showHidden':![],'depth':null}):'');};exports[_0xa531('0x6')]=function(_0x31e630,_0x57dcf5){logger[_0xa531('0x6')](_0x31e630,_0x57dcf5?util[_0xa531('0x7')](_0x57dcf5,{'showHidden':![],'depth':null}):'');};exports[_0xa531('0x8')]=function(_0x1b080,_0x308c3c){return client[_0xa531('0x8')](_0x1b080,{'body':_0x308c3c})[_0xa531('0x9')](function(_0x280c3f){logger[_0xa531('0xa')](_0xa531('0xb'),_0x1b080,_0x280c3f?util[_0xa531('0x7')](_0x280c3f,{'showHidden':![],'depth':null}):'');})[_0xa531('0xc')](function(_0x46edae){logger[_0xa531('0x6')](_0xa531('0xb'),_0x1b080,_0x46edae?util[_0xa531('0x7')](_0x46edae,{'showHidden':![],'depth':null}):'');});};function getUser(_0x590c42){return client['request'](_0xa531('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xa531('0xe'),'interface'],'where':_0x590c42,'limit':0x1}})[_0xa531('0x9')](function(_0x54ab07){logger['debug'](_0xa531('0xf'),JSON[_0xa531('0x10')](_0x590c42),_0x54ab07?util['inspect'](_0x54ab07,{'showHidden':![],'depth':null}):'');return _0x54ab07[_0xa531('0x11')]['length']?_0x54ab07[_0xa531('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0xa5e2d){return new BPromise(function(_0x4a750c,_0xd28bae){if(_0xa5e2d){return getUser({'internal':_0xa5e2d})[_0xa531('0x9')](function(_0x456482){logger[_0xa531('0x5')](_0xa531('0x12'),_0xa5e2d,_0x456482?_0xa531('0x13'):'notfound');return _0x4a750c(_0x456482);})['catch'](function(_0x6e50f6){logger[_0xa531('0x6')]('[utils][getUserByInternal]',_0x6e50f6?util[_0xa531('0x7')](_0x6e50f6,{'showHidden':![],'depth':null}):'');return _0x4a750c(null);});}return _0x4a750c(null);});};exports[_0xa531('0x14')]=function(_0x538b27){return new BPromise(function(_0x246df7,_0x2d0426){if(_0x538b27){return getUser({'interface':_0x538b27})[_0xa531('0x9')](function(_0x5af22e){logger[_0xa531('0x5')](_0xa531('0x15'),_0x538b27,_0x5af22e?_0xa531('0x13'):_0xa531('0x16'));return _0x246df7(_0x5af22e);})[_0xa531('0xc')](function(_0x1bed18){logger[_0xa531('0x6')](_0xa531('0x17'),_0x1bed18?util[_0xa531('0x7')](_0x1bed18,{'showHidden':![],'depth':null}):'');return _0x246df7(null);});}return _0x246df7(null);});};exports[_0xa531('0x18')]=function(_0x4c2bd2){return new BPromise(function(_0x2d59de,_0x5013b3){if(_0x4c2bd2){return getUser({'name':_0x4c2bd2})[_0xa531('0x9')](function(_0x501dd8){logger[_0xa531('0x5')](_0xa531('0x19'),_0x4c2bd2,_0x501dd8?_0xa531('0x13'):_0xa531('0x16'));return _0x2d59de(_0x501dd8);})[_0xa531('0xc')](function(_0x113f78){logger['error'](_0xa531('0x1a'),_0x113f78?util[_0xa531('0x7')](_0x113f78,{'showHidden':![],'depth':null}):'');return _0x2d59de(null);});}return _0x2d59de(null);});};exports[_0xa531('0x1b')]=function(_0x52761f){return new BPromise(function(_0x4d1a8b,_0x49cff6){if(_0x52761f){return client[_0xa531('0x8')](_0xa531('0x1c'),{'options':{'raw':!![],'attributes':['id','name','type',_0xa531('0x1d'),'acwTimeout'],'where':{'name':_0x52761f},'limit':0x1}})[_0xa531('0x9')](function(_0x4e4b26){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x52761f,_0x4e4b26?util[_0xa531('0x7')](_0x4e4b26,{'showHidden':![],'depth':null}):'');logger[_0xa531('0x5')](_0xa531('0x1e'),_0x52761f,_0x4e4b26?_0xa531('0x13'):_0xa531('0x16'));return _0x4d1a8b(_0x4e4b26['result'][_0xa531('0x1f')]?_0x4e4b26[_0xa531('0x11')][0x0]:null);})['catch'](function(_0x2d9a3f){logger[_0xa531('0x6')](_0xa531('0x20'),_0x2d9a3f?util[_0xa531('0x7')](_0x2d9a3f,{'showHidden':![],'depth':null}):'');return _0x4d1a8b(null);});}return _0x4d1a8b(null);});};exports['addTime']=function(_0x9931a9,_0x576bf0){return moment(_0x9931a9)[_0xa531('0x21')](_0x576bf0,_0xa531('0x22'))[_0xa531('0x23')](_0xa531('0x24'));};exports[_0xa531('0x25')]=function(_0x113d29,_0x4e1a4b){return moment(_0x113d29)[_0xa531('0x26')](_0x4e1a4b,_0xa531('0x22'))[_0xa531('0x23')](_0xa531('0x24'));};exports['diffTime']=function(_0x2c2620,_0x34849b){return moment(_0x2c2620)[_0xa531('0x27')](moment(_0x34849b),'seconds');};exports[_0xa531('0x28')]=function(_0x17ba05,_0x249bcb){return parseInt(_0x17ba05,0xa)+parseInt(_0x249bcb,0xa);};exports[_0xa531('0x29')]=function(){return moment()[_0xa531('0x23')](_0xa531('0x24'));};exports[_0xa531('0x2a')]=function(_0x121d0e,_0x4ed68a){if(_0x4ed68a){return moment(_0x121d0e)['isAfter'](_0x4ed68a);}return!![];};exports[_0xa531('0x2b')]=function(_0x449ca5,_0x10b9cf){if(_0x10b9cf){return moment(_0x449ca5)[_0xa531('0x2b')](_0x10b9cf);}else if(_0x449ca5){return!![];}return![];}; \ No newline at end of file +var _0xae35=['seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','internal','name','interface','stringify','result','getUserByInternal','found','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae35,0x172));var _0x5ae3=function(_0x39617e,_0x7a02c9){_0x39617e=_0x39617e-0x0;var _0x506955=_0xae35[_0x39617e];return _0x506955;};'use strict';var BPromise=require(_0x5ae3('0x0'));var jayson=require(_0x5ae3('0x1'));var moment=require(_0x5ae3('0x2'));var util=require(_0x5ae3('0x3'));var client=jayson[_0x5ae3('0x4')][_0x5ae3('0x5')]({'port':0x2329});var logger=require(_0x5ae3('0x6'))(_0x5ae3('0x7'));exports['info']=function(_0x6dffe3,_0x4d1536){logger[_0x5ae3('0x8')](_0x6dffe3,_0x4d1536?util[_0x5ae3('0x9')](_0x4d1536,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x45e748,_0x1e1d6b){logger['debug'](_0x45e748,_0x1e1d6b?util[_0x5ae3('0x9')](_0x1e1d6b,{'showHidden':![],'depth':null}):'');};exports[_0x5ae3('0xa')]=function(_0x2bdef8,_0x58a13c){logger[_0x5ae3('0xa')](_0x2bdef8,_0x58a13c?util[_0x5ae3('0x9')](_0x58a13c,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x327eba,_0x4ef543){return client[_0x5ae3('0xb')](_0x327eba,{'body':_0x4ef543})[_0x5ae3('0xc')](function(_0xd9661a){logger[_0x5ae3('0xd')](_0x5ae3('0xe'),_0x327eba,_0xd9661a?util[_0x5ae3('0x9')](_0xd9661a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x294df1){logger[_0x5ae3('0xa')](_0x5ae3('0xe'),_0x327eba,_0x294df1?util[_0x5ae3('0x9')](_0x294df1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3d80c6){return client[_0x5ae3('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5ae3('0xf'),_0x5ae3('0x10'),_0x5ae3('0x11')],'where':_0x3d80c6,'limit':0x1}})[_0x5ae3('0xc')](function(_0x1f4fb2){logger[_0x5ae3('0xd')]('[utils][getUser]\x20where:%s',JSON[_0x5ae3('0x12')](_0x3d80c6),_0x1f4fb2?util['inspect'](_0x1f4fb2,{'showHidden':![],'depth':null}):'');return _0x1f4fb2[_0x5ae3('0x13')]['length']?_0x1f4fb2[_0x5ae3('0x13')][0x0]:null;});}exports[_0x5ae3('0x14')]=function(_0x10b13a){return new BPromise(function(_0x2d8626,_0x3b34eb){if(_0x10b13a){return getUser({'internal':_0x10b13a})[_0x5ae3('0xc')](function(_0x1d45bc){logger[_0x5ae3('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x10b13a,_0x1d45bc?_0x5ae3('0x15'):_0x5ae3('0x16'));return _0x2d8626(_0x1d45bc);})['catch'](function(_0x2df9fc){logger[_0x5ae3('0xa')]('[utils][getUserByInternal]',_0x2df9fc?util[_0x5ae3('0x9')](_0x2df9fc,{'showHidden':![],'depth':null}):'');return _0x2d8626(null);});}return _0x2d8626(null);});};exports['getUserByInterface']=function(_0xef0540){return new BPromise(function(_0x208847,_0x2ede90){if(_0xef0540){return getUser({'interface':_0xef0540})[_0x5ae3('0xc')](function(_0x3e9831){logger[_0x5ae3('0x8')](_0x5ae3('0x17'),_0xef0540,_0x3e9831?_0x5ae3('0x15'):_0x5ae3('0x16'));return _0x208847(_0x3e9831);})[_0x5ae3('0x18')](function(_0x4f97c6){logger['error'](_0x5ae3('0x19'),_0x4f97c6?util[_0x5ae3('0x9')](_0x4f97c6,{'showHidden':![],'depth':null}):'');return _0x208847(null);});}return _0x208847(null);});};exports['getUserByName']=function(_0x13fdce){return new BPromise(function(_0x49ec7b,_0x289b97){if(_0x13fdce){return getUser({'name':_0x13fdce})[_0x5ae3('0xc')](function(_0x2f7951){logger[_0x5ae3('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x13fdce,_0x2f7951?_0x5ae3('0x15'):_0x5ae3('0x16'));return _0x49ec7b(_0x2f7951);})['catch'](function(_0x8ee010){logger['error']('[utils][getUserByName]',_0x8ee010?util[_0x5ae3('0x9')](_0x8ee010,{'showHidden':![],'depth':null}):'');return _0x49ec7b(null);});}return _0x49ec7b(null);});};exports[_0x5ae3('0x1a')]=function(_0x4f6bd7){return new BPromise(function(_0x9a97b,_0x150e86){if(_0x4f6bd7){return client['request'](_0x5ae3('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x5ae3('0x10'),'type',_0x5ae3('0x1c'),_0x5ae3('0x1d')],'where':{'name':_0x4f6bd7},'limit':0x1}})['then'](function(_0x37d206){logger[_0x5ae3('0xd')](_0x5ae3('0x1e'),_0x4f6bd7,_0x37d206?util[_0x5ae3('0x9')](_0x37d206,{'showHidden':![],'depth':null}):'');logger[_0x5ae3('0x8')](_0x5ae3('0x1f'),_0x4f6bd7,_0x37d206?'found':_0x5ae3('0x16'));return _0x9a97b(_0x37d206[_0x5ae3('0x13')][_0x5ae3('0x20')]?_0x37d206[_0x5ae3('0x13')][0x0]:null);})[_0x5ae3('0x18')](function(_0x4f6979){logger[_0x5ae3('0xa')]('[utils][getVoiceQueueByName]',_0x4f6979?util['inspect'](_0x4f6979,{'showHidden':![],'depth':null}):'');return _0x9a97b(null);});}return _0x9a97b(null);});};exports[_0x5ae3('0x21')]=function(_0x3ac7e7,_0x41526f){return moment(_0x3ac7e7)[_0x5ae3('0x22')](_0x41526f,_0x5ae3('0x23'))['format'](_0x5ae3('0x24'));};exports[_0x5ae3('0x25')]=function(_0x367447,_0x315c59){return moment(_0x367447)[_0x5ae3('0x26')](_0x315c59,_0x5ae3('0x23'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5ae3('0x27')]=function(_0x3cffb6,_0x2c7d9c){return moment(_0x3cffb6)[_0x5ae3('0x28')](moment(_0x2c7d9c),'seconds');};exports[_0x5ae3('0x29')]=function(_0xec0247,_0x3d2fa6){return parseInt(_0xec0247,0xa)+parseInt(_0x3d2fa6,0xa);};exports[_0x5ae3('0x2a')]=function(){return moment()['format'](_0x5ae3('0x24'));};exports['isAfter']=function(_0x47e7e3,_0xfe25df){if(_0xfe25df){return moment(_0x47e7e3)[_0x5ae3('0x2b')](_0xfe25df);}return!![];};exports[_0x5ae3('0x2c')]=function(_0x3e4d17,_0x456557){if(_0x456557){return moment(_0x3e4d17)['isBefore'](_0x456557);}else if(_0x3e4d17){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 7dee955..83fddf2 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 _0x8b1b=['util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','role','name','client','catch','user','then','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','agent_id','agent_name','setupLoggers','fs-extra','lodash','express-winston','path'];(function(_0x40501d,_0x1011f2){var _0x5c53cf=function(_0x5eb05a){while(--_0x5eb05a){_0x40501d['push'](_0x40501d['shift']());}};_0x5c53cf(++_0x1011f2);}(_0x8b1b,0x1dc));var _0xb8b1=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x8b1b[_0x44bcb0];return _0xfaf881;};var fs=require(_0xb8b1('0x0'));var _=require(_0xb8b1('0x1'));var ewinston=require(_0xb8b1('0x2'));var path=require(_0xb8b1('0x3'));var util=require(_0xb8b1('0x4'));var fileLogger=require(_0xb8b1('0x5'))[_0xb8b1('0x6')];var safeTemplate=require(_0xb8b1('0x7'))[_0xb8b1('0x8')];var maskSensitiveData=require('./mask-sensitive-data')[_0xb8b1('0x9')];function ClientSideLogger(){function _0x344488(_0x51e87e){var _0x44393d=path[_0xb8b1('0xa')](_0xb8b1('0xb'),_0xb8b1('0xc'),_0xb8b1('0xd'));var _0x351fca=path[_0xb8b1('0xa')]('client',_0x51e87e[_0xb8b1('0xe')]+'-'+_0x51e87e[_0xb8b1('0xf')]);return fs['ensureDir'](path[_0xb8b1('0xa')](_0x44393d,_0x351fca))['then'](function(){var _0x413430=fileLogger(_0xb8b1('0x10'),path['join'](_0x44393d,_0x351fca));return _0x413430;})[_0xb8b1('0x11')](function(_0x34f812){throw _0x34f812;});}this[_0xb8b1('0xc')]=function(_0x67938e,_0x226ebd,_0x547338,_0x3a2c16){return _0x344488(_0x67938e[_0xb8b1('0x12')])[_0xb8b1('0x13')](function(_0x2e36ba){var _0x6b29c3=_0x2e36ba[_0x226ebd];return _0x6b29c3;})[_0xb8b1('0x13')](function(_0x1b183b){var _0x475ba1=_0x67938e[_0xb8b1('0x12')]?_0x67938e[_0xb8b1('0x12')]['id']:_0xb8b1('0x14');var _0x920c3f=_0x3a2c16[_0xb8b1('0x15')];var _0x398092=_0x3a2c16[_0xb8b1('0x16')];var _0x4a9604=new Date(Number(_0x398092));return _0x1b183b(_0x475ba1,_0x4a9604,_0x547338,_0x920c3f);})[_0xb8b1('0x11')](function(_0x4fd38a){fileLogger(_0xb8b1('0x10'))[_0xb8b1('0x17')](_0x4fd38a);});};}function setupLoggers(_0xbb9a61){return new Promise(function(_0x59b96e){var _0x6f589b=new ClientSideLogger();var _0x4c4c31=fileLogger(_0xb8b1('0x18'));var _0x28f085=fileLogger(_0xb8b1('0x19'));_0xbb9a61[_0xb8b1('0x1a')](_0xb8b1('0x1b'),_0x6f589b);_0xbb9a61[_0xb8b1('0x1c')](ewinston[_0xb8b1('0x1d')]({'winstonInstance':_0x4c4c31,'meta':![],'statusLevels':!![],'msg':function(_0x4ba9bd,_0x250878){var _0x11c3a2=_0xb8b1('0x1e');if(!_['isEmpty'](_0x4ba9bd[_0xb8b1('0x1f')])){_0x11c3a2+='\x20body=%s';var _0x2307a0=_0x4ba9bd['body'];maskSensitiveData(_0x2307a0);}return safeTemplate(util[_0xb8b1('0x20')](_0x11c3a2,_0x4ba9bd[_0xb8b1('0x21')],_0x4ba9bd[_0xb8b1('0x22')][_0xb8b1('0x23')]?_0x4ba9bd['headers']['x-forwarded-for']:_0x4ba9bd[_0xb8b1('0x24')]['remoteAddress']||_0x4ba9bd['ip'],_0x4ba9bd[_0xb8b1('0x25')],_0x250878[_0xb8b1('0x26')],_0x250878[_0xb8b1('0x27')],_0x4ba9bd['user']?_0x4ba9bd[_0xb8b1('0x12')]['id']:null,_0x4ba9bd['user']?_0x4ba9bd[_0xb8b1('0x12')]['name']:null,_0x4ba9bd[_0xb8b1('0x12')]?_0x4ba9bd[_0xb8b1('0x12')][_0xb8b1('0xe')]:null,_0x2307a0?util[_0xb8b1('0x28')](_0x2307a0,![],null):''));}}));_0xbb9a61['use'](ewinston[_0xb8b1('0x1d')]({'winstonInstance':_0x28f085,'meta':![],'statusLevels':!![],'msg':function(_0x351823,_0x2a4c49){var _0xef671b=_0xb8b1('0x29');if(_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2a')]&&_0x351823[_0xb8b1('0x1f')]['agent_id']){_0xef671b=_0xb8b1('0x2b');}return util[_0xb8b1('0x20')](_0xef671b,_0x351823[_0xb8b1('0x21')],_0x351823[_0xb8b1('0x22')][_0xb8b1('0x23')]?_0x351823['headers'][_0xb8b1('0x23')]:_0x351823[_0xb8b1('0x24')][_0xb8b1('0x2c')]||_0x351823['ip'],_0x351823['url'],_0x2a4c49['statusCode'],_0x2a4c49[_0xb8b1('0x27')],_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')]['id']:null,_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')]['name']:null,_0x351823[_0xb8b1('0x12')]?_0x351823[_0xb8b1('0x12')][_0xb8b1('0xe')]:null,_0x351823[_0xb8b1('0x1f')]&&_0x351823['body'][_0xb8b1('0x2a')]?_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2a')]:'other',_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2d')]?_0x351823['body']['agent_id']:'',_0x351823[_0xb8b1('0x1f')]&&_0x351823[_0xb8b1('0x1f')][_0xb8b1('0x2e')]?_0x351823['body'][_0xb8b1('0x2e')]:'');},'ignoreRoute':function(_0x509581){var _0x4f4b5e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4f4b5e['test'](_0x509581[_0xb8b1('0x25')]);}}));return _0x59b96e();});}exports[_0xb8b1('0x2f')]=setupLoggers; \ No newline at end of file +var _0xd641=['api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','xcally','client','name','ensureDir','catch','user','then','data','error'];(function(_0x58b6c7,_0x5331f6){var _0x2369ca=function(_0x591499){while(--_0x591499){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x2369ca(++_0x5331f6);}(_0xd641,0x1f2));var _0x1d64=function(_0x3b2edf,_0x1fadd3){_0x3b2edf=_0x3b2edf-0x0;var _0x1bbf60=_0xd641[_0x3b2edf];return _0x1bbf60;};var fs=require(_0x1d64('0x0'));var _=require(_0x1d64('0x1'));var ewinston=require(_0x1d64('0x2'));var path=require(_0x1d64('0x3'));var util=require(_0x1d64('0x4'));var fileLogger=require('./loggers')[_0x1d64('0x5')];var safeTemplate=require(_0x1d64('0x6'))[_0x1d64('0x7')];var maskSensitiveData=require(_0x1d64('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x251edf(_0x395aeb){var _0x496a36=path[_0x1d64('0x9')]('/var','log',_0x1d64('0xa'));var _0x13f22c=path['join'](_0x1d64('0xb'),_0x395aeb['role']+'-'+_0x395aeb[_0x1d64('0xc')]);return fs[_0x1d64('0xd')](path[_0x1d64('0x9')](_0x496a36,_0x13f22c))['then'](function(){var _0x53de53=fileLogger(_0x1d64('0xb'),path['join'](_0x496a36,_0x13f22c));return _0x53de53;})[_0x1d64('0xe')](function(_0x52beb2){throw _0x52beb2;});}this['log']=function(_0x4e52f6,_0x5d5310,_0x3ace59,_0x42616f){return _0x251edf(_0x4e52f6[_0x1d64('0xf')])[_0x1d64('0x10')](function(_0x1c4007){var _0x3542e3=_0x1c4007[_0x5d5310];return _0x3542e3;})[_0x1d64('0x10')](function(_0x3f6425){var _0x56a27b=_0x4e52f6[_0x1d64('0xf')]?_0x4e52f6[_0x1d64('0xf')]['id']:'no-user';var _0x2ddb76=_0x42616f[_0x1d64('0x11')];var _0x6771ca=_0x42616f['timestamp'];var _0x58f13a=new Date(Number(_0x6771ca));return _0x3f6425(_0x56a27b,_0x58f13a,_0x3ace59,_0x2ddb76);})[_0x1d64('0xe')](function(_0x434833){fileLogger(_0x1d64('0xb'))[_0x1d64('0x12')](_0x434833);});};}function setupLoggers(_0x56dd67){return new Promise(function(_0x1d6d23){var _0x13d815=new ClientSideLogger();var _0x2bc963=fileLogger(_0x1d64('0x13'));var _0x19ae68=fileLogger(_0x1d64('0x14'));_0x56dd67[_0x1d64('0x15')](_0x1d64('0x16'),_0x13d815);_0x56dd67['use'](ewinston[_0x1d64('0x17')]({'winstonInstance':_0x2bc963,'meta':![],'statusLevels':!![],'msg':function(_0x380f4e,_0x19ce01){var _0x399d87=_0x1d64('0x18');if(!_[_0x1d64('0x19')](_0x380f4e[_0x1d64('0x1a')])){_0x399d87+='\x20body=%s';var _0x335614=_0x380f4e[_0x1d64('0x1a')];maskSensitiveData(_0x335614);}return safeTemplate(util[_0x1d64('0x1b')](_0x399d87,_0x380f4e[_0x1d64('0x1c')],_0x380f4e[_0x1d64('0x1d')][_0x1d64('0x1e')]?_0x380f4e[_0x1d64('0x1d')]['x-forwarded-for']:_0x380f4e[_0x1d64('0x1f')][_0x1d64('0x20')]||_0x380f4e['ip'],_0x380f4e[_0x1d64('0x21')],_0x19ce01['statusCode'],_0x19ce01['responseTime'],_0x380f4e[_0x1d64('0xf')]?_0x380f4e['user']['id']:null,_0x380f4e[_0x1d64('0xf')]?_0x380f4e[_0x1d64('0xf')]['name']:null,_0x380f4e['user']?_0x380f4e[_0x1d64('0xf')][_0x1d64('0x22')]:null,_0x335614?util[_0x1d64('0x23')](_0x335614,![],null):''));}}));_0x56dd67[_0x1d64('0x24')](ewinston[_0x1d64('0x17')]({'winstonInstance':_0x19ae68,'meta':![],'statusLevels':!![],'msg':function(_0x1f17ef,_0x1d2a41){var _0x249f36=_0x1d64('0x25');if(_0x1f17ef[_0x1d64('0x1a')]&&_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x26')]&&_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x27')]){_0x249f36=_0x1d64('0x28');}return util[_0x1d64('0x1b')](_0x249f36,_0x1f17ef[_0x1d64('0x1c')],_0x1f17ef[_0x1d64('0x1d')][_0x1d64('0x1e')]?_0x1f17ef[_0x1d64('0x1d')]['x-forwarded-for']:_0x1f17ef[_0x1d64('0x1f')]['remoteAddress']||_0x1f17ef['ip'],_0x1f17ef[_0x1d64('0x21')],_0x1d2a41[_0x1d64('0x29')],_0x1d2a41[_0x1d64('0x2a')],_0x1f17ef[_0x1d64('0xf')]?_0x1f17ef[_0x1d64('0xf')]['id']:null,_0x1f17ef[_0x1d64('0xf')]?_0x1f17ef[_0x1d64('0xf')][_0x1d64('0xc')]:null,_0x1f17ef[_0x1d64('0xf')]?_0x1f17ef[_0x1d64('0xf')][_0x1d64('0x22')]:null,_0x1f17ef['body']&&_0x1f17ef[_0x1d64('0x1a')]['device']?_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x26')]:_0x1d64('0x2b'),_0x1f17ef[_0x1d64('0x1a')]&&_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x27')]?_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x27')]:'',_0x1f17ef[_0x1d64('0x1a')]&&_0x1f17ef[_0x1d64('0x1a')][_0x1d64('0x2c')]?_0x1f17ef['body'][_0x1d64('0x2c')]:'');},'ignoreRoute':function(_0x2bc0ba){var _0x5e3a32=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5e3a32[_0x1d64('0x2d')](_0x2bc0ba[_0x1d64('0x21')]);}}));return _0x1d6d23();});}exports[_0x1d64('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 6818381..12b567d 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0913=['isBetween','timeCompare','format','date','daysInMonth','max','min','domCompare','includes','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','startOf','day','endOf'];(function(_0x2b9c5a,_0x52f3e7){var _0x2e0b2b=function(_0x51b225){while(--_0x51b225){_0x2b9c5a['push'](_0x2b9c5a['shift']());}};_0x2e0b2b(++_0x52f3e7);}(_0x0913,0xcd));var _0x3091=function(_0x1fb720,_0x4f4e7b){_0x1fb720=_0x1fb720-0x0;var _0x118a44=_0x0913[_0x1fb720];return _0x118a44;};var _=require(_0x3091('0x0'));var moment=require(_0x3091('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][_0x3091('0x2')](function(_0x3788f4){return _0x3788f4[_0x3091('0x3')];})[_0x3091('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3091('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4f8bd9){if(!_0x4f8bd9['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1406be){var _0x1be705=_0x1406be[_0x3091('0x6')](':')[_0x3091('0x2')](function(_0x2f69b4){return parseInt(_0x2f69b4,0xa);});var _0x361546=_0x1be705[0x0];var _0x326aca=_0x1be705[0x1];if(_0x361546<0x0||_0x361546>0x17||_0x326aca<0x0||_0x326aca>0x3b){throw new Error(EINVALID_DATE);}return[_0x361546,_0x326aca];}function circularDoWInterval(_0x3bcce5,_0x31e64a){if(_0x3bcce5===_0x31e64a){return[_0x3bcce5];}else{var _0x455b2b=moment[_0x3091('0x7')]();moment[_0x3091('0x7')]('en');var _0x7e7bcc=moment[_0x3091('0x8')]()['map'](function(_0x574f6b){return _0x574f6b['toLowerCase']();});moment[_0x3091('0x7')](_0x455b2b);var _0x2d441a=_0x7e7bcc[_0x3091('0x9')](_0x3bcce5);var _0x482f65=_0x7e7bcc[_0x3091('0x9')](_0x31e64a);if(_0x482f65>_0x2d441a){return _0x7e7bcc[_0x3091('0xa')](_0x2d441a,_0x482f65+0x1);}else{var _0x51f771=_0x7e7bcc[_0x3091('0xa')](0x0,_0x482f65+0x1);var _0x22e8e7=_0x7e7bcc['slice'](_0x2d441a);return _0x22e8e7[_0x3091('0xb')](_0x51f771);}}}module[_0x3091('0xc')][_0x3091('0xd')]=circularDoWInterval;function circularMonthInterval(_0x53bf8a,_0x35e873){if(_0x53bf8a===_0x35e873){return[_0x53bf8a];}else{var _0x58698e=moment['locale']();moment['locale']('en');var _0x50704d=moment[_0x3091('0xe')]()[_0x3091('0x2')](function(_0x5aae7e){return _0x5aae7e[_0x3091('0xf')]();});moment[_0x3091('0x7')](_0x58698e);var _0x3b8827=_0x50704d[_0x3091('0x9')](_0x53bf8a);var _0x87a56c=_0x50704d['indexOf'](_0x35e873);if(_0x87a56c>_0x3b8827){return _0x50704d[_0x3091('0xa')](_0x3b8827,_0x87a56c+0x1);}else{var _0x18aef6=_0x50704d[_0x3091('0xa')](0x0,_0x87a56c+0x1);var _0x58b364=_0x50704d[_0x3091('0xa')](_0x3b8827);return _0x58b364[_0x3091('0xb')](_0x18aef6);}}}module['exports'][_0x3091('0x10')]=circularMonthInterval;function parseDom(_0x29b542){var _0xf07348=parseInt(_0x29b542,0xa);if(_0xf07348<0x1||_0xf07348>0x1f){throw new Error(EINVALID_DATE);}return _0xf07348;}function timeCompare(_0xe385fa,_0x3b8190,_0x313da9){var _0x4aed34=_0xe385fa[_0x3091('0x11')]();var _0x1a53ec=extractTime(_0x3b8190);var _0x10d2aa=_0x1a53ec[0x0];var _0x30dfea=_0x1a53ec[0x1];var _0x51eca5=_0xe385fa['clone']()[_0x3091('0x12')](_0x10d2aa)[_0x3091('0x13')](_0x30dfea);throwIfDateNotValid(_0x51eca5);var _0x31be1b=extractTime(_0x313da9);var _0x142582=_0x31be1b[0x0];var _0x209b79=_0x31be1b[0x1];var _0x3c5dee=_0xe385fa['clone']()['hours'](_0x142582)[_0x3091('0x13')](_0x209b79);throwIfDateNotValid(_0x3c5dee);if(_0x3c5dee['isBefore'](_0x51eca5)){var _0x2b33e8=_0x4aed34[_0x3091('0x11')]()[_0x3091('0x14')](_0x3091('0x15'));var _0x59ec6d=_0x4aed34[_0x3091('0x11')]()[_0x3091('0x16')](_0x3091('0x15'));return _0x4aed34['isBetween'](_0x51eca5,_0x59ec6d,undefined,'[]')||_0x4aed34[_0x3091('0x17')](_0x2b33e8,_0x3c5dee,undefined,'[]');}else{return _0x4aed34[_0x3091('0x17')](_0x51eca5,_0x3c5dee,undefined,'[]');}}module[_0x3091('0xc')][_0x3091('0x18')]=timeCompare;function dowCompare(_0x51d028,_0x3117c3,_0x2b1720){var _0x32066c=_0x51d028[_0x3091('0x7')]('en')[_0x3091('0x19')]('ddd')['toLowerCase']();return circularDoWInterval(_0x3117c3,_0x2b1720)['includes'](_0x32066c);}module[_0x3091('0xc')]['dowCompare']=dowCompare;function domCompare(_0x23805f,_0x4b7c3e,_0x1c874f){var _0xdacdcc=_0x23805f[_0x3091('0x1a')]();if(_0x4b7c3e===_0x1c874f){return _0xdacdcc===_0x4b7c3e;}else{var _0x4d5a96=_0x23805f[_0x3091('0x1b')]();var _0x40e6b2=_0x4b7c3e<_0x1c874f;let _0x2c889a=![];var _0x422c3f=0x0;var _0x36fd60=0x0;if(_0x40e6b2){_0x422c3f=Math[_0x3091('0x1c')](0x1,_0x4b7c3e);_0x36fd60=Math[_0x3091('0x1d')](_0x1c874f,_0x4d5a96);_0x2c889a=_0xdacdcc>=_0x422c3f&&_0xdacdcc<=_0x36fd60;}else{_0x422c3f=Math[_0x3091('0x1d')](_0x4b7c3e,_0x4d5a96);_0x36fd60=Math[_0x3091('0x1c')](0x1,_0x1c874f);_0x2c889a=_0xdacdcc>=_0x422c3f||_0xdacdcc<=_0x36fd60;}return _0x2c889a;}}module[_0x3091('0xc')][_0x3091('0x1e')]=domCompare;function monthCompare(_0x54a619,_0x353cf1,_0x12de3d){var _0x4faf16=_0x54a619[_0x3091('0x7')]('en')[_0x3091('0x19')]('MMM')[_0x3091('0xf')]();return circularMonthInterval(_0x353cf1,_0x12de3d)[_0x3091('0x1f')](_0x4faf16);}module['exports']['monthCompare']=monthCompare;function iftime(_0x75282f,_0x4ac91c=moment['tz'][_0x3091('0x20')](),_0x2727e4=moment()){if(!validateRx[_0x3091('0x21')](_0x75282f)){throw new Error(EINVALID_STRING);}else{var _0x2d937a=(moment[_0x3091('0x22')](_0x2727e4)?_0x2727e4[_0x3091('0x11')]():moment(_0x2727e4))['tz'](_0x4ac91c)[_0x3091('0x7')]('en');throwIfDateNotValid(_0x2d937a);var _0x129f56=_0x75282f[_0x3091('0x6')](',');var _0x411e8c=_0x129f56[0x0];var _0x322485=_0x129f56[0x1];var _0x5636f0=_0x129f56[0x2];var _0x4cf024=_0x129f56[0x3];let _0x8d8fb8=!![];if(_0x411e8c!=='*'){var _0x65bd91=_0x411e8c[_0x3091('0x6')]('-');var _0xc49a00=_[_0x3091('0x23')](_0x65bd91[0x0],0x5,'0');var _0xcc1b0=_0x65bd91[_0x3091('0x24')]===0x2?_[_0x3091('0x23')](_0x65bd91[0x1],0x5,'0'):_0xc49a00;_0x8d8fb8=timeCompare(_0x2d937a,_0xc49a00,_0xcc1b0);}let _0x54dac3=!![];if(_0x322485!=='*'){var _0x21fe9a=_0x322485[_0x3091('0x6')]('-');var _0x557403=_0x21fe9a[0x0];var _0x1eb7aa=_0x21fe9a['length']===0x2?_0x21fe9a[0x1]:_0x557403;_0x54dac3=dowCompare(_0x2d937a,_0x557403,_0x1eb7aa);}let _0x248c77=!![];if(_0x5636f0!=='*'){var _0x334df3=_0x5636f0[_0x3091('0x6')]('-');var _0x36017e=parseDom(_0x334df3[0x0]);var _0x368220=_0x334df3[_0x3091('0x24')]===0x2?parseDom(_0x334df3[0x1]):_0x36017e;_0x248c77=domCompare(_0x2d937a,_0x36017e,_0x368220);}let _0x1bacdf=!![];if(_0x4cf024!=='*'){var _0x53aeef=_0x4cf024[_0x3091('0x6')]('-');var _0x2cb40f=_0x53aeef[0x0];var _0xce03b1=_0x53aeef['length']===0x2?_0x53aeef[0x1]:_0x53aeef[0x0];_0x1bacdf=monthCompare(_0x2d937a,_0x2cb40f,_0xce03b1);}return _0x8d8fb8&&_0x54dac3&&_0x248c77&&_0x1bacdf;}}module['exports'][_0x3091('0x25')]=iftime; \ No newline at end of file +var _0xf8ab=['concat','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','toLowerCase','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','exports'];(function(_0x4f6617,_0x54c1c9){var _0x5df2c9=function(_0x12a396){while(--_0x12a396){_0x4f6617['push'](_0x4f6617['shift']());}};_0x5df2c9(++_0x54c1c9);}(_0xf8ab,0x142));var _0xbf8a=function(_0x5abb85,_0x1a1332){_0x5abb85=_0x5abb85-0x0;var _0x6fcc02=_0xf8ab[_0x5abb85];return _0x6fcc02;};var _=require(_0xbf8a('0x0'));var moment=require(_0xbf8a('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][_0xbf8a('0x2')](function(_0x422b8f){return _0x422b8f[_0xbf8a('0x3')];})[_0xbf8a('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xbf8a('0x5');var EINVALID_DATE=_0xbf8a('0x6');function throwIfDateNotValid(_0x532c34){if(!_0x532c34[_0xbf8a('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1032b0){var _0x4533d0=_0x1032b0[_0xbf8a('0x8')](':')[_0xbf8a('0x2')](function(_0x238815){return parseInt(_0x238815,0xa);});var _0x12b149=_0x4533d0[0x0];var _0x1a2154=_0x4533d0[0x1];if(_0x12b149<0x0||_0x12b149>0x17||_0x1a2154<0x0||_0x1a2154>0x3b){throw new Error(EINVALID_DATE);}return[_0x12b149,_0x1a2154];}function circularDoWInterval(_0x290766,_0x2db997){if(_0x290766===_0x2db997){return[_0x290766];}else{var _0x23a84a=moment[_0xbf8a('0x9')]();moment[_0xbf8a('0x9')]('en');var _0x22f279=moment[_0xbf8a('0xa')]()[_0xbf8a('0x2')](function(_0x11a303){return _0x11a303['toLowerCase']();});moment[_0xbf8a('0x9')](_0x23a84a);var _0x1caa57=_0x22f279[_0xbf8a('0xb')](_0x290766);var _0x36b75d=_0x22f279[_0xbf8a('0xb')](_0x2db997);if(_0x36b75d>_0x1caa57){return _0x22f279[_0xbf8a('0xc')](_0x1caa57,_0x36b75d+0x1);}else{var _0x98c305=_0x22f279[_0xbf8a('0xc')](0x0,_0x36b75d+0x1);var _0x4c01db=_0x22f279['slice'](_0x1caa57);return _0x4c01db['concat'](_0x98c305);}}}module[_0xbf8a('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5aaf1f,_0xfd3fa8){if(_0x5aaf1f===_0xfd3fa8){return[_0x5aaf1f];}else{var _0x5e69b5=moment['locale']();moment[_0xbf8a('0x9')]('en');var _0x461072=moment['monthsShort']()[_0xbf8a('0x2')](function(_0x33a068){return _0x33a068['toLowerCase']();});moment[_0xbf8a('0x9')](_0x5e69b5);var _0x3a0a05=_0x461072[_0xbf8a('0xb')](_0x5aaf1f);var _0x59ea33=_0x461072[_0xbf8a('0xb')](_0xfd3fa8);if(_0x59ea33>_0x3a0a05){return _0x461072[_0xbf8a('0xc')](_0x3a0a05,_0x59ea33+0x1);}else{var _0x4820a4=_0x461072[_0xbf8a('0xc')](0x0,_0x59ea33+0x1);var _0xcf6bbf=_0x461072[_0xbf8a('0xc')](_0x3a0a05);return _0xcf6bbf[_0xbf8a('0xe')](_0x4820a4);}}}module[_0xbf8a('0xd')][_0xbf8a('0xf')]=circularMonthInterval;function parseDom(_0x1664a0){var _0x38b2da=parseInt(_0x1664a0,0xa);if(_0x38b2da<0x1||_0x38b2da>0x1f){throw new Error(EINVALID_DATE);}return _0x38b2da;}function timeCompare(_0x396389,_0x20d41c,_0x4a5b6e){var _0xa7c97d=_0x396389['clone']();var _0x5cecb5=extractTime(_0x20d41c);var _0x17f96b=_0x5cecb5[0x0];var _0x2572ab=_0x5cecb5[0x1];var _0x56eda8=_0x396389[_0xbf8a('0x10')]()[_0xbf8a('0x11')](_0x17f96b)[_0xbf8a('0x12')](_0x2572ab);throwIfDateNotValid(_0x56eda8);var _0x4336a4=extractTime(_0x4a5b6e);var _0x1b8ef9=_0x4336a4[0x0];var _0x4e91ba=_0x4336a4[0x1];var _0x362c56=_0x396389[_0xbf8a('0x10')]()[_0xbf8a('0x11')](_0x1b8ef9)['minutes'](_0x4e91ba);throwIfDateNotValid(_0x362c56);if(_0x362c56[_0xbf8a('0x13')](_0x56eda8)){var _0x4c828c=_0xa7c97d[_0xbf8a('0x10')]()[_0xbf8a('0x14')](_0xbf8a('0x15'));var _0x332ca7=_0xa7c97d[_0xbf8a('0x10')]()['endOf'](_0xbf8a('0x15'));return _0xa7c97d[_0xbf8a('0x16')](_0x56eda8,_0x332ca7,undefined,'[]')||_0xa7c97d[_0xbf8a('0x16')](_0x4c828c,_0x362c56,undefined,'[]');}else{return _0xa7c97d[_0xbf8a('0x16')](_0x56eda8,_0x362c56,undefined,'[]');}}module[_0xbf8a('0xd')][_0xbf8a('0x17')]=timeCompare;function dowCompare(_0x56f864,_0x3daba4,_0xfe0ca5){var _0x499441=_0x56f864[_0xbf8a('0x9')]('en')[_0xbf8a('0x18')](_0xbf8a('0x19'))['toLowerCase']();return circularDoWInterval(_0x3daba4,_0xfe0ca5)[_0xbf8a('0x1a')](_0x499441);}module[_0xbf8a('0xd')][_0xbf8a('0x1b')]=dowCompare;function domCompare(_0x6fd33a,_0x2a272b,_0x59d194){var _0x5b29fc=_0x6fd33a[_0xbf8a('0x1c')]();if(_0x2a272b===_0x59d194){return _0x5b29fc===_0x2a272b;}else{var _0x770378=_0x6fd33a[_0xbf8a('0x1d')]();var _0x3030de=_0x2a272b<_0x59d194;let _0x5ebf05=![];var _0x3c3fd9=0x0;var _0x480f99=0x0;if(_0x3030de){_0x3c3fd9=Math[_0xbf8a('0x1e')](0x1,_0x2a272b);_0x480f99=Math['min'](_0x59d194,_0x770378);_0x5ebf05=_0x5b29fc>=_0x3c3fd9&&_0x5b29fc<=_0x480f99;}else{_0x3c3fd9=Math[_0xbf8a('0x1f')](_0x2a272b,_0x770378);_0x480f99=Math[_0xbf8a('0x1e')](0x1,_0x59d194);_0x5ebf05=_0x5b29fc>=_0x3c3fd9||_0x5b29fc<=_0x480f99;}return _0x5ebf05;}}module['exports'][_0xbf8a('0x20')]=domCompare;function monthCompare(_0x399f94,_0x50e8de,_0x3b86f9){var _0x5f50ad=_0x399f94[_0xbf8a('0x9')]('en')[_0xbf8a('0x18')](_0xbf8a('0x21'))[_0xbf8a('0x22')]();return circularMonthInterval(_0x50e8de,_0x3b86f9)[_0xbf8a('0x1a')](_0x5f50ad);}module[_0xbf8a('0xd')][_0xbf8a('0x23')]=monthCompare;function iftime(_0x33093c,_0x78f3fd=moment['tz'][_0xbf8a('0x24')](),_0x3bd49f=moment()){if(!validateRx[_0xbf8a('0x25')](_0x33093c)){throw new Error(EINVALID_STRING);}else{var _0x415572=(moment[_0xbf8a('0x26')](_0x3bd49f)?_0x3bd49f['clone']():moment(_0x3bd49f))['tz'](_0x78f3fd)[_0xbf8a('0x9')]('en');throwIfDateNotValid(_0x415572);var _0x2b7b47=_0x33093c['split'](',');var _0x1039ef=_0x2b7b47[0x0];var _0x374dcb=_0x2b7b47[0x1];var _0x4dc684=_0x2b7b47[0x2];var _0x1b06d9=_0x2b7b47[0x3];let _0x2460e6=!![];if(_0x1039ef!=='*'){var _0x50debb=_0x1039ef['split']('-');var _0x32bbdc=_[_0xbf8a('0x27')](_0x50debb[0x0],0x5,'0');var _0x2fc4ec=_0x50debb[_0xbf8a('0x28')]===0x2?_['padStart'](_0x50debb[0x1],0x5,'0'):_0x32bbdc;_0x2460e6=timeCompare(_0x415572,_0x32bbdc,_0x2fc4ec);}let _0x5ced30=!![];if(_0x374dcb!=='*'){var _0x18de78=_0x374dcb[_0xbf8a('0x8')]('-');var _0x4055b5=_0x18de78[0x0];var _0x3c835b=_0x18de78[_0xbf8a('0x28')]===0x2?_0x18de78[0x1]:_0x4055b5;_0x5ced30=dowCompare(_0x415572,_0x4055b5,_0x3c835b);}let _0x1c7592=!![];if(_0x4dc684!=='*'){var _0x1e618b=_0x4dc684[_0xbf8a('0x8')]('-');var _0xbb130f=parseDom(_0x1e618b[0x0]);var _0x285c76=_0x1e618b[_0xbf8a('0x28')]===0x2?parseDom(_0x1e618b[0x1]):_0xbb130f;_0x1c7592=domCompare(_0x415572,_0xbb130f,_0x285c76);}let _0x4316bd=!![];if(_0x1b06d9!=='*'){var _0x4e0fac=_0x1b06d9[_0xbf8a('0x8')]('-');var _0x4601a4=_0x4e0fac[0x0];var _0x17bd89=_0x4e0fac['length']===0x2?_0x4e0fac[0x1]:_0x4e0fac[0x0];_0x4316bd=monthCompare(_0x415572,_0x4601a4,_0x17bd89);}return _0x2460e6&&_0x5ced30&&_0x1c7592&&_0x4316bd;}}module[_0xbf8a('0xd')][_0xbf8a('0x29')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 0d78cec..d336f64 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b64=['transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x254639,_0x52d8b2){var _0x582063=function(_0x2e9c74){while(--_0x2e9c74){_0x254639['push'](_0x254639['shift']());}};_0x582063(++_0x52d8b2);}(_0x7b64,0x151));var _0x47b6=function(_0x3bdd0a,_0x5b3484){_0x3bdd0a=_0x3bdd0a-0x0;var _0x17f42e=_0x7b64[_0x3bdd0a];return _0x17f42e;};'use strict';var path=require(_0x47b6('0x0'));var util=require(_0x47b6('0x1'));var moment=require('moment');var winston=require(_0x47b6('0x2'));var config=require(_0x47b6('0x3'));var debugLevel=config['debugLevel']?config[_0x47b6('0x4')]['toLowerCase']():_0x47b6('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x47b6('0x6'),'error':_0x47b6('0x7'),'warn':_0x47b6('0x8'),'info':_0x47b6('0x9'),'print':_0x47b6('0xa'),'success':_0x47b6('0xb'),'http':_0x47b6('0xc'),'verbose':_0x47b6('0xd'),'debug':'bold\x20blue','silly':_0x47b6('0xe')};winston[_0x47b6('0xf')](XC_LOG_COLORS);function getLogFileName(_0x52c622,_0x5ac843,_0x414ad1){var _0x250355=_0x52c622||_0x47b6('0x10');return path['join'](_0x250355,util[_0x47b6('0x11')](_0x47b6('0x12'),_0x5ac843,_0x414ad1));}function formatter(_0x59c5bf,_0x5aac03){_0x5aac03['message']=_0x5aac03[_0x47b6('0x13')][_0x47b6('0x14')](/@@{/g,_0x47b6('0x15'))[_0x47b6('0x14')](/}@@/g,_0x47b6('0x16'))[_0x47b6('0x14')](/@{/g,'{{')[_0x47b6('0x14')](/}@/g,'}}');return util[_0x47b6('0x11')](_0x47b6('0x17'),moment()[_0x47b6('0x11')](_0x47b6('0x18')),_0x5aac03[_0x47b6('0x19')][_0x47b6('0x1a')](),_0x59c5bf,_0x5aac03[_0x47b6('0x13')]);}function fileFormat(_0x2f0c98,_0x5b92f8){_0x5b92f8[_0x47b6('0x13')]=_0x5b92f8[_0x47b6('0x13')][_0x47b6('0x14')](/@@{/g,_0x47b6('0x15'))[_0x47b6('0x14')](/}@@/g,_0x47b6('0x16'))[_0x47b6('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4c030e=_0x5b92f8['meta']&&Object[_0x47b6('0x1b')](_0x5b92f8[_0x47b6('0x1c')])[_0x47b6('0x1d')]?'\x0a\x09'+JSON[_0x47b6('0x1e')](_0x5b92f8[_0x47b6('0x1c')]):'';return util[_0x47b6('0x11')](_0x47b6('0x1f'),moment()[_0x47b6('0x11')](_0x47b6('0x18')),_0x5b92f8['level']['toUpperCase'](),_0x2f0c98,_0x5b92f8[_0x47b6('0x13')],_0x4c030e);}function consoleLogger(){var _0x554a24=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x47b6('0x20'))][(_0x47b6('0x21'))]({'level':_0x47b6('0x22'),'json':![],'formatter':function(_0x5b7f1f){return formatter('',_0x5b7f1f);}})]});return _0x554a24;}function fileLogger(_0x592fdf,_0x3133fd){var _0x3cb2f6=new winston[(_0x47b6('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x47b6('0x24'))]({'name':util['format'](_0x47b6('0x25'),_0x592fdf,_0x47b6('0x26')),'filename':getLogFileName(_0x3133fd,_0x592fdf,_0x47b6('0x26')),'level':_0x47b6('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x363260){return fileFormat(_0x592fdf,_0x363260);}}),new winston[(_0x47b6('0x20'))][(_0x47b6('0x24'))]({'name':util['format'](_0x47b6('0x25'),_0x592fdf,debugLevel),'filename':getLogFileName(_0x3133fd,_0x592fdf,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc1588b){return fileFormat(_0x592fdf,_0xc1588b);}}),new winston[(_0x47b6('0x20'))][(_0x47b6('0x21'))]({'level':_0x47b6('0x22'),'json':![],'formatter':function(_0x16ae39){return fileFormat(_0x592fdf,_0x16ae39);}})]});return _0x3cb2f6;}exports[_0x47b6('0x27')]=consoleLogger;exports[_0x47b6('0x28')]=fileLogger; \ No newline at end of file +var _0xe463=['error','File','%s-%s','warn','fileLogger','util','winston','../config/environment','debugLevel','info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe463,0x19c));var _0x3e46=function(_0x489860,_0x5f3608){_0x489860=_0x489860-0x0;var _0x981e3c=_0xe463[_0x489860];return _0x981e3c;};'use strict';var path=require('path');var util=require(_0x3e46('0x0'));var moment=require('moment');var winston=require(_0x3e46('0x1'));var config=require(_0x3e46('0x2'));var debugLevel=config[_0x3e46('0x3')]?config['debugLevel']['toLowerCase']():_0x3e46('0x4');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':_0x3e46('0x5'),'error':_0x3e46('0x6'),'warn':'bold\x20yellow','info':_0x3e46('0x7'),'print':_0x3e46('0x8'),'success':'bold\x20green','http':_0x3e46('0x9'),'verbose':_0x3e46('0xa'),'debug':_0x3e46('0xb'),'silly':'bold\x20cyan'};winston[_0x3e46('0xc')](XC_LOG_COLORS);function getLogFileName(_0x2ea82c,_0x1ef1ed,_0x141660){var _0x3e6c5b=_0x2ea82c||'/var/log/xcally';return path[_0x3e46('0xd')](_0x3e6c5b,util[_0x3e46('0xe')](_0x3e46('0xf'),_0x1ef1ed,_0x141660));}function formatter(_0x123227,_0x18da05){_0x18da05[_0x3e46('0x10')]=_0x18da05[_0x3e46('0x10')][_0x3e46('0x11')](/@@{/g,_0x3e46('0x12'))[_0x3e46('0x11')](/}@@/g,_0x3e46('0x13'))[_0x3e46('0x11')](/@{/g,'{{')[_0x3e46('0x11')](/}@/g,'}}');return util[_0x3e46('0xe')](_0x3e46('0x14'),moment()['format'](_0x3e46('0x15')),_0x18da05[_0x3e46('0x16')][_0x3e46('0x17')](),_0x123227,_0x18da05[_0x3e46('0x10')]);}function fileFormat(_0x33af43,_0x21ed5c){_0x21ed5c[_0x3e46('0x10')]=_0x21ed5c['message'][_0x3e46('0x11')](/@@{/g,'{{{')[_0x3e46('0x11')](/}@@/g,_0x3e46('0x13'))[_0x3e46('0x11')](/@{/g,'{{')[_0x3e46('0x11')](/}@/g,'}}');var _0x57d194=_0x21ed5c['meta']&&Object[_0x3e46('0x18')](_0x21ed5c[_0x3e46('0x19')])[_0x3e46('0x1a')]?'\x0a\x09'+JSON[_0x3e46('0x1b')](_0x21ed5c[_0x3e46('0x19')]):'';return util[_0x3e46('0xe')](_0x3e46('0x1c'),moment()[_0x3e46('0xe')](_0x3e46('0x15')),_0x21ed5c[_0x3e46('0x16')][_0x3e46('0x17')](),_0x33af43,_0x21ed5c['message'],_0x57d194);}function consoleLogger(){var _0xec4bb9=new winston[(_0x3e46('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3e46('0x1e'))][(_0x3e46('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x58018a){return formatter('',_0x58018a);}})]});return _0xec4bb9;}function fileLogger(_0x59a8d5,_0x5d0606){var _0x2ad10d=new winston[(_0x3e46('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3e46('0x1e'))]['File']({'name':util[_0x3e46('0xe')]('%s-%s',_0x59a8d5,_0x3e46('0x20')),'filename':getLogFileName(_0x5d0606,_0x59a8d5,'error'),'level':_0x3e46('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21f45f){return fileFormat(_0x59a8d5,_0x21f45f);}}),new winston['transports'][(_0x3e46('0x21'))]({'name':util[_0x3e46('0xe')](_0x3e46('0x22'),_0x59a8d5,debugLevel),'filename':getLogFileName(_0x5d0606,_0x59a8d5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc34bd1){return fileFormat(_0x59a8d5,_0xc34bd1);}}),new winston[(_0x3e46('0x1e'))][(_0x3e46('0x1f'))]({'level':_0x3e46('0x23'),'json':![],'formatter':function(_0x145dbe){return fileFormat(_0x59a8d5,_0x145dbe);}})]});return _0x2ad10d;}exports['consoleLogger']=consoleLogger;exports[_0x3e46('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 73fa70b..b08568b 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x2034f7,_0x52688c){var _0x5e85c2=function(_0x5c9a4f){while(--_0x5c9a4f){_0x2034f7['push'](_0x2034f7['shift']());}};_0x5e85c2(++_0x52688c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1dae94,_0x239003){_0x1dae94=_0x1dae94-0x0;var _0x36ce2d=_0x0b0e[_0x1dae94];return _0x36ce2d;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x3eb0a5,_0x26eba9){var _0x34d034=function(_0x25c039){while(--_0x25c039){_0x3eb0a5['push'](_0x3eb0a5['shift']());}};_0x34d034(++_0x26eba9);}(_0x66fa,0x117));var _0xa66f=function(_0x30df39,_0x583504){_0x30df39=_0x30df39-0x0;var _0x348a93=_0x66fa[_0x30df39];return _0x348a93;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 1345787..8cb605b 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 _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x9c00[_0x2980de];return _0x81a4ca;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x8952,0x17e));var _0x2895=function(_0x44607c,_0x1b7d04){_0x44607c=_0x44607c-0x0;var _0x54c88e=_0x8952[_0x44607c];return _0x54c88e;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 70152cd..bd207c2 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 _0x5f59=['exports','path','root','resolve','legacy-libs','isArray','findIndex','motion2','env','NODE_PATH','string','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON'];(function(_0x436ff6,_0x57beff){var _0x5e1fe9=function(_0x44a13f){while(--_0x44a13f){_0x436ff6['push'](_0x436ff6['shift']());}};_0x5e1fe9(++_0x57beff);}(_0x5f59,0x1dd));var _0x95f5=function(_0x4aada6,_0x7adb07){_0x4aada6=_0x4aada6-0x0;var _0x3c8986=_0x5f59[_0x4aada6];return _0x3c8986;};var fs=require('fs-extra');var path=require(_0x95f5('0x0'));var config=require('../config/environment');var root=config[_0x95f5('0x1')];var APP_JSON_PATH=path[_0x95f5('0x2')](root,'server/app.json');var NODEPATH=path[_0x95f5('0x2')](root,_0x95f5('0x3'));function setLegacyLibsNodeEnvPath(_0x2d5eb5){let _0x425e49=![];if(Array[_0x95f5('0x4')](_0x2d5eb5['apps'])){var _0x20d864=_0x2d5eb5['apps'][_0x95f5('0x5')](function(_0xca9a1b){return _0xca9a1b['name']===_0x95f5('0x6');});if(_0x20d864>-0x1){var _0x5bc339=_0x2d5eb5['apps'][_0x20d864];if(typeof _0x5bc339[_0x95f5('0x7')][_0x95f5('0x8')]!==_0x95f5('0x9')){_0x5bc339['env'][_0x95f5('0x8')]=NODEPATH;_0x425e49=!![];}}return{'appConfig':_0x2d5eb5,'updated':_0x425e49};}}function updateAppConfig(_0x228fb5){return fs[_0x95f5('0xa')](APP_JSON_PATH)[_0x95f5('0xb')](function(_0x15a7f7){if(_0x15a7f7){return fs[_0x95f5('0xc')](APP_JSON_PATH)[_0x95f5('0xb')](function(_0x54a92a){var _0x2d1241=setLegacyLibsNodeEnvPath(_0x54a92a);if(_0x2d1241['updated']){_0x228fb5[_0x95f5('0xd')](_0x95f5('0xe'));return fs[_0x95f5('0xf')](APP_JSON_PATH,_0x54a92a,{'spaces':0x2});}else{return Promise[_0x95f5('0x2')]();}});}else{return Promise[_0x95f5('0x2')]();}});}module[_0x95f5('0x10')]=updateAppConfig; \ No newline at end of file +var _0xa561=['findIndex','name','motion2','NODE_PATH','string','env','then','readJSON','updated','info','Updating\x20app.json','writeJSON','resolve','exports','fs-extra','path','../config/environment','root','server/app.json','legacy-libs','apps'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa561,0x149));var _0x1a56=function(_0x47ae97,_0x3af709){_0x47ae97=_0x47ae97-0x0;var _0x1c9afe=_0xa561[_0x47ae97];return _0x1c9afe;};var fs=require(_0x1a56('0x0'));var path=require(_0x1a56('0x1'));var config=require(_0x1a56('0x2'));var root=config[_0x1a56('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x1a56('0x4'));var NODEPATH=path['resolve'](root,_0x1a56('0x5'));function setLegacyLibsNodeEnvPath(_0x18c6a1){let _0xe92aa1=![];if(Array['isArray'](_0x18c6a1[_0x1a56('0x6')])){var _0x16a394=_0x18c6a1[_0x1a56('0x6')][_0x1a56('0x7')](function(_0x113639){return _0x113639[_0x1a56('0x8')]===_0x1a56('0x9');});if(_0x16a394>-0x1){var _0x57d55f=_0x18c6a1[_0x1a56('0x6')][_0x16a394];if(typeof _0x57d55f['env'][_0x1a56('0xa')]!==_0x1a56('0xb')){_0x57d55f[_0x1a56('0xc')][_0x1a56('0xa')]=NODEPATH;_0xe92aa1=!![];}}return{'appConfig':_0x18c6a1,'updated':_0xe92aa1};}}function updateAppConfig(_0x4a9051){return fs['pathExists'](APP_JSON_PATH)[_0x1a56('0xd')](function(_0x595742){if(_0x595742){return fs[_0x1a56('0xe')](APP_JSON_PATH)[_0x1a56('0xd')](function(_0x13b6cc){var _0x3c58a7=setLegacyLibsNodeEnvPath(_0x13b6cc);if(_0x3c58a7[_0x1a56('0xf')]){_0x4a9051[_0x1a56('0x10')](_0x1a56('0x11'));return fs[_0x1a56('0x12')](APP_JSON_PATH,_0x13b6cc,{'spaces':0x2});}else{return Promise[_0x1a56('0x13')]();}});}else{return Promise[_0x1a56('0x13')]();}});}module[_0x1a56('0x14')]=updateAppConfig; \ No newline at end of file